diff --git a/.gitattributes b/.gitattributes index a7be37ae37000..1df7067002c88 100644 --- a/.gitattributes +++ b/.gitattributes @@ -30,7 +30,7 @@ pcre/testdata/greppatN4 -text *.c diff=cpp *.h diff=cpp *.cc diff=cpp -*.ic diff=cpp +*.inl diff=cpp *.cpp diff=cpp *.java diff=cpp diff --git a/.gitignore b/.gitignore index 8f8a7b5a19a9c..05c658485147e 100644 --- a/.gitignore +++ b/.gitignore @@ -133,6 +133,7 @@ scripts/mysqld_safe scripts/mysqldumpslow scripts/mysqlhotcopy scripts/mytop +scripts/wsrep_sst_backup scripts/wsrep_sst_common scripts/wsrep_sst_mysqldump scripts/wsrep_sst_rsync @@ -254,6 +255,7 @@ support-files/mariadb-extra.socket support-files/mariadb@.service support-files/mariadb@.socket support-files/mariadb-extra@.socket +support-files/mini-benchmark support-files/my-huge.cnf support-files/my-innodb-heavy-4G.cnf support-files/my-large.cnf diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cd22fc5dd8cd1..8c2b4ae363d98 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,9 +28,12 @@ stages: - test - Salsa-CI -# Base image for builds and tests unless otherwise defined -# @TODO: Fedora 34 is latest, but fails to start on Gitlab.com with error "shell not found" -image: fedora:33 +default: + # Base image for builds and tests unless otherwise defined + image: fedora:latest + # Extend build jobs to have longer timeout as the default GitLab + # timeout (1h) is often not enough + timeout: 3h # Define common CMAKE_FLAGS for all builds. Skim down build by omitting all # submodules (a commit in this repo does not affect their builds anyway) and @@ -39,7 +42,7 @@ variables: CMAKE_FLAGS: "-DWITH_SSL=system -DPLUGIN_COLUMNSTORE=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_S3=NO -DPLUGIN_MROONGA=NO -DPLUGIN_CONNECT=NO -DPLUGIN_MROONGA=NO -DPLUGIN_TOKUDB=NO -DPLUGIN_PERFSCHEMA=NO -DWITH_WSREP=OFF" # Major version dictates which branches share the same ccache. E.g. 10.6-abc # and 10.6-xyz will have the same cache. - MARIADB_MAJOR_VERSION: "10.6" + MARIADB_MAJOR_VERSION: "10.8" # NOTE! Currently ccache is only used on the Centos8 build. As each job has # sufficiently different environments they are unable to benefit from each # other's ccaches. As each build generates about 1 GB of ccache, having @@ -68,7 +71,7 @@ variables: echo "$package" rpm -qlpv "$package" | awk '{print $1 " " $3 "/" $4 " ." $9 " " $10 " " $11}' | sort -k 3 echo "------------------------------------------------" - done >> ../rpmlist-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log + done >> "../rpmlist-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log" # CPackRPM lists contents in build log, so no need to show the output of this, # just store it as a build artifact that can be downloaded and diffed against # other builds to detect which files where added/removed/moved @@ -118,8 +121,10 @@ fedora-ninja: - mkdir builddir; cd builddir - cmake -DRPM=generic $CMAKE_FLAGS -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -G Ninja .. 2>&1 | tee -a ../build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log - ninja -t graph > ../dependencies.dot && dot -Tpng -o ../dependencies.png ../dependencies.dot - - eatmydata ninja package --verbose 2>&1 | tee -a ../build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log - # Ninja builds are not affected by bug https://jira.mariadb.org/browse/MDEV-25968 + - eatmydata ninja package -j 2 --verbose 2>&1 | tee -a ../build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log + # @TODO: Unlike other builds, the Ninja builds using Gitlab.com runners don't get stuck, but they do get + # stuck on runners with more processors, see https://jira.mariadb.org/browse/MDEV-25968. + # Thus, use the same limitation on Ninja builds as well to ensure it never gets stuck due to this bug. - ninja test - *rpm_listfiles - mkdir ../rpm; mv *.rpm ../rpm @@ -170,14 +175,47 @@ fedora-clang: - dependencies.dot - dependencies.png +fedora-sanitizer: + stage: build + variables: + GIT_STRATEGY: fetch + GIT_SUBMODULE_STRATEGY: normal + script: + - yum install -y yum-utils rpm-build openssl-devel clang + - yum install -y libasan libtsan libubsan + # This repository does not have any .spec files, so install dependencies based on Fedora spec file + - yum-builddep -y mariadb-server + - mkdir builddir; cd builddir + - export CXX=${CXX:-clang++} + - export CC=${CC:-clang} + - export CXX_FOR_BUILD=${CXX_FOR_BUILD:-clang++} + - export CC_FOR_BUILD=${CC_FOR_BUILD:-clang} + - export CFLAGS='-Wno-unused-command-line-argument' + - export CXXFLAGS='-Wno-unused-command-line-argument' + - cmake -DRPM=$CI_JOB_NAME $CMAKE_FLAGS $SANITIZER .. 2>&1 | tee -a ../build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log + # @TODO: the build will fail consistently at 24% when trying to make using eatmydata + - make package -j 2 2>&1 | tee -a ../build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log + - *rpm_listfiles + - mkdir ../rpm; mv *.rpm ../rpm + artifacts: + when: always # Must be able to see logs + paths: + - build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log + - rpmlist-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log + - rpm + - builddir/_CPack_Packages/Linux/RPM/SPECS/ + parallel: + matrix: + - SANITIZER: [-DWITH_ASAN=YES, -DWITH_TSAN=YES, -DWITH_UBSAN=YES, -DWITH_MSAN=YES] + centos8: stage: build - image: centos:8 + image: quay.io/centos/centos:stream8 # CentOS 8 is deprecated, use this Stream8 instead variables: GIT_STRATEGY: fetch GIT_SUBMODULE_STRATEGY: normal script: - - yum install -y yum-utils rpm-build openssl-devel + - yum install -y yum-utils rpm-build openssl-devel pcre2-devel - yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm # dnf --enablerepo=powertools install Judy-devel #--> not found - dnf config-manager --set-enabled powertools @@ -186,7 +224,7 @@ centos8: # - package Judy-devel-1.0.5-18.module_el8.3.0+757+d382997d.i686 is filtered out by modular filtering # - package Judy-devel-1.0.5-18.module_el8.3.0+757+d382997d.x86_64 is filtered out by modular filtering # Solution: install Judy-devel directly from downloaded rpm file: - - yum install -y http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/Judy-devel-1.0.5-18.module_el8.3.0+757+d382997d.x86_64.rpm + - yum install -y http://vault.centos.org/centos/8/PowerTools/x86_64/os/Packages/Judy-devel-1.0.5-18.module_el8.3.0+757+d382997d.x86_64.rpm # Use eatmydata to speed up build - yum install -y https://github.com/stewartsmith/libeatmydata/releases/download/v129/libeatmydata-129-1.fc33.x86_64.rpm - yum install -y ccache # From EPEL @@ -226,7 +264,7 @@ centos7: # This repository does not have any .spec files, so install dependencies based on Fedora spec file - yum-builddep -y mariadb-server # ..with a few extra ones, as CentOS 7 is very old and these are added in newer MariaDB releases - - yum install -y yum-utils rpm-build gcc gcc-c++ bison libxml2-devel libevent-devel openssl-devel + - yum install -y yum-utils rpm-build gcc gcc-c++ bison libxml2-devel libevent-devel openssl-devel pcre2-devel - mkdir builddir; cd builddir - cmake -DRPM=$CI_JOB_NAME $CMAKE_FLAGS .. 2>&1 | tee -a ../build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log - make package -j 2 2>&1 | tee -a ../build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log @@ -244,10 +282,8 @@ centos7: - rpm - builddir/_CPack_Packages/Linux/RPM/SPECS/ -mysql-test-run: +.mysql-test-run: &mysql-test-run-def stage: test - dependencies: - - fedora script: # Install packages so tests and the dependencies install # @TODO: RPM missing 'patch' and 'diff' as dependency, so installing it manually for now @@ -263,7 +299,87 @@ mysql-test-run: main.flush_logs_not_windows : query 'flush logs' succeeded - should have failed with error ER_CANT_CREATE_FILE (1004) main.mysql_upgrade_noengine : upgrade output order does not match the expected " > skiplist - - ./mtr --suite=main --force --parallel=auto --xml-report=$CI_PROJECT_DIR/junit.xml --skip-test-list=skiplist + - ./mtr --suite=main --force --parallel=auto --xml-report=$CI_PROJECT_DIR/junit.xml --skip-test-list=skiplist $RESTART_POLICY + +mysql-test-run: + stage: test + dependencies: + - fedora + needs: + - fedora + <<: *mysql-test-run-def + artifacts: + when: always # Also show results when tests fail + reports: + junit: + - junit.xml + +# Duplicate of the above jobs, except we use sanitizer build jobs as a dependency. This is so we can keep +# sanitizer errors separate from functional test failures. Currently, there is no way to run the same +# job for different dependencies. +# +# Additionally, for each sanitizer MTR job, we enable --force-restart so that +# sanitizer errors can be traced to individual tests. The difference in test +# suite runtime as a result of this flag is negligable (~30s for the entire test suite). +# (see https://dev.mysql.com/doc/dev/mysql-server/latest/PAGE_MYSQL_TEST_RUN_PL.html) +mysql-test-run-asan: + stage: test + variables: + RESTART_POLICY: "--force-restart" + dependencies: + - "fedora-sanitizer: [-DWITH_ASAN=YES]" + needs: + - "fedora-sanitizer: [-DWITH_ASAN=YES]" + <<: *mysql-test-run-def + allow_failure: true + artifacts: + when: always # Also show results when tests fail + reports: + junit: + - junit.xml + +mysql-test-run-tsan: + stage: test + variables: + RESTART_POLICY: "--force-restart" + dependencies: + - "fedora-sanitizer: [-DWITH_TSAN=YES]" + needs: + - "fedora-sanitizer: [-DWITH_TSAN=YES]" + <<: *mysql-test-run-def + allow_failure: true + artifacts: + when: always # Also show results when tests fail + reports: + junit: + - junit.xml + +mysql-test-run-ubsan: + stage: test + variables: + RESTART_POLICY: "--force-restart" + dependencies: + - "fedora-sanitizer: [-DWITH_UBSAN=YES]" + needs: + - "fedora-sanitizer: [-DWITH_UBSAN=YES]" + <<: *mysql-test-run-def + allow_failure: true + artifacts: + when: always # Also show results when tests fail + reports: + junit: + - junit.xml + +mysql-test-run-msan: + stage: test + variables: + RESTART_POLICY: "--force-restart" + dependencies: + - "fedora-sanitizer: [-DWITH_MSAN=YES]" + needs: + - "fedora-sanitizer: [-DWITH_MSAN=YES]" + <<: *mysql-test-run-def + allow_failure: true artifacts: when: always # Also show results when tests fail reports: @@ -274,6 +390,8 @@ rpmlint: stage: test dependencies: - fedora + needs: + - fedora script: - yum install -y rpmlint - rm -f rpm/*debuginfo* # Not relevant in this test @@ -291,6 +409,8 @@ fedora install: stage: test dependencies: - fedora + needs: + - fedora script: - rm -f rpm/*debuginfo* # Not relevant in this test # Nothing provides galera-4 on Fedora, so this step fails if built with wsrep @@ -324,15 +444,17 @@ fedora upgrade: stage: test dependencies: - fedora + needs: + - fedora script: - - yum install -y mariadb-server + - dnf install -y mariadb-server # Fedora does not support running services in Docker (like Debian packages do) so start it manually - - /usr/libexec/mysql-check-socket - - /usr/libexec/mysql-prepare-db-dir - - sudo -u mysql /usr/libexec/mysqld --basedir=/usr & sleep 10 + - /usr/libexec/mariadb-check-socket + - /usr/libexec/mariadb-prepare-db-dir + - sudo -u mysql /usr/libexec/mariadbd --basedir=/usr & sleep 10 # Dump database contents in installed state - mariadb-dump --all-databases --all-tablespaces --triggers --routines --events --skip-extended-insert > old-installed-database.sql - - /usr/libexec/mysql-check-upgrade + - /usr/libexec/mariadb-check-upgrade # Dump database contents in upgraded state - mariadb-dump --all-databases --all-tablespaces --triggers --routines --events --skip-extended-insert > old-upgraded-database.sql - mariadb --skip-column-names -e "SELECT @@version, @@version_comment" # Show version @@ -364,6 +486,37 @@ fedora upgrade: - new-installed-database.sql - new-upgraded-database.sql +mini-benchmark: + stage: test + dependencies: + - fedora + needs: + - fedora + script: + - ls -la rpm; rm -vf rpm/*.el?.* # Delete artifacts from Centos builds + # Don't use cracklib, otherwise the Sysbench user password will be rejected + - rm -vf rpm/*cracklib*.rpm + # Nothing provides galera-4 on Fedora, so this step fails if built with wsrep + - yum install -y rpm/*.rpm + # Fedora does not support running services in Docker (like Debian packages do) so start it manually + - /usr/bin/mariadb-install-db -u mysql + - sudo -u mysql /usr/sbin/mariadbd & sleep 10 + # Since we did a manual start, we also need to run upgrade manually + - /usr/bin/mariadb-upgrade -u root + - | + mariadb --skip-column-names -e "SELECT @@version, @@version_comment" | tee /tmp/version + grep $MARIADB_MAJOR_VERSION /tmp/version || echo "MariaDB didn't install properly" + - yum install -y sysbench procps-ng perf util-linux || yum install -y https://kojipkgs.fedoraproject.org//packages/luajit/2.0.4/3.el7/x86_64/luajit-2.0.4-3.el7.x86_64.rpm https://kojipkgs.fedoraproject.org//packages/sysbench/1.0.17/2.el7/x86_64/sysbench-1.0.17-2.el7.x86_64.rpm https://kojipkgs.fedoraproject.org//packages/ck/0.5.2/2.el7/x86_64/ck-0.5.2-2.el7.x86_64.rpm + - /usr/share/mysql/mini-benchmark + - cp -av */sysbench-run-*.log */metrics.txt .. # Move files one level down so they can be saved as artifacts + artifacts: + when: always + paths: + - sysbench-run-*.log + reports: + metrics: + - metrics.txt + # Once all RPM builds and tests have passed, also run the DEB builds and tests # @NOTE: This is likely to work well only on salsa.debian.org as the Gitlab.com # runners are too small for everything this stage does. diff --git a/.travis.compiler.sh b/.travis.compiler.sh deleted file mode 100755 index c140f15d66d4d..0000000000000 --- a/.travis.compiler.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -set -v -x - -# Exclude modules from build not directly affecting the current -# test suites found in $MYSQL_TEST_SUITES, to conserve job time -# as well as disk usage - -function exclude_modules() { -# excludes for all -CMAKE_OPT="${CMAKE_OPT} -DPLUGIN_MROONGA=NO -DPLUGIN_SPIDER=NO -DPLUGIN_OQGRAPH=NO -DPLUGIN_PERFSCHEMA=NO -DPLUGIN_SPHINX=NO" -# exclude storage engines not being tested in current job -if [[ ! "${MYSQL_TEST_SUITES}" =~ "archive" ]]; then - CMAKE_OPT="${CMAKE_OPT} -DPLUGIN_ARCHIVE=NO" -fi -if [[ ! "${MYSQL_TEST_SUITES}" =~ "rocksdb" ]]; then - CMAKE_OPT="${CMAKE_OPT} -DPLUGIN_ROCKSDB=NO" -fi -} - -if [[ "${TRAVIS_OS_NAME}" == 'linux' ]]; then - TEST_CASE_TIMEOUT=2 - exclude_modules; - if which ccache ; then - CMAKE_OPT="${CMAKE_OPT} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache" - fi - if [[ "${CXX}" == 'clang++' ]]; then - 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} == 7 ]]; then - export WSREP_PROVIDER=/usr/lib/galera/libgalera_smm.so - MYSQL_TEST_SUITES="${MYSQL_TEST_SUITES},wsrep" - fi -fi - -if [[ "${TRAVIS_OS_NAME}" == 'osx' ]]; then - TEST_CASE_TIMEOUT=20 - exclude_modules; - CMAKE_OPT="${CMAKE_OPT} -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl" - if which ccache ; then - CMAKE_OPT="${CMAKE_OPT} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache" - fi -fi - -set +v +x diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5c227b49b09bb..0000000000000 --- a/.travis.yml +++ /dev/null @@ -1,240 +0,0 @@ -# vim ft=yaml -# travis-ci.org definition - -# NOTE TO MERGERS: Most of the contents in the Travis-CI configuration has been -# tailored for a specific release or MariaDB. As a general rule, do not merge -# changes in this file across MariaDB branches to avoid breaking the CI. Updates -# the the Travis-CI pipeline are most of the time better done manually. - -dist: focal - -git: - depth: 2 - -language: cpp - -cache: - timeout: 500 - apt: true - ccache: true - -addons: - apt: - sources: &add-sources - # Remember to document well what packages each extra repository is used for - - ubuntu-toolchain-r-test - # => gcc-9 and gcc-10 for Ubuntu Bionic - # https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test/+packages?field.name_filter=&field.status_filter=published&field.series_filter=bionic - - sourceline: 'ppa:maria-captains/travis-ci-helper-repo' - # => galera-4 for Ubuntu Bionic - # https://launchpad.net/~maria-captains/+archive/ubuntu/travis-ci-helper-repo/+packages?field.name_filter=&field.status_filter=published&field.series_filter=bionic - packages: &common-packages - # Remember to update this list if the Debian build dependencies are updated - - bison - - chrpath - - clang-7 # In suites: focal, bionic-updates - - clang-10 # In suites: focal, bionic - - cmake - - cracklib-runtime - - galera-4 # In suites: focal, bionic (via ppa:maria-captains/travis-ci-helper-repo) - - g++-7 # In suites: focal, bionic - - g++-10 # In suites: focal, bionic (via ppa:ubuntu-toolchain-r/test) - - gdb - - libaio-dev - - libarchive-dev - - libboost-atomic-dev - - libboost-chrono-dev - - libboost-date-time-dev - - libboost-dev - - libboost-filesystem-dev - - libboost-regex-dev - - libboost-system-dev - - libboost-thread-dev - - libcrack2-dev - - libcurl4-openssl-dev - - libdbd-mysql - - libedit-dev - - libjemalloc-dev - - libjudy-dev - - libkrb5-dev - - liblz4-dev - - libncurses5-dev - - libnuma-dev - - libpam0g-dev - - libpcre2-dev - - libpmem-dev - - libreadline-gplv2-dev - - libsnappy-dev - - libssl-dev - - libxml2-dev - - lsb-release - - perl - - psmisc - - uuid-dev - - zlib1g-dev - # libsystemd-daemon-dev # https://github.com/travis-ci/apt-package-whitelist/issues/3882 - homebrew: - # OSX builds are not properly maintained on Travis-CI nor buildbot and - # thus this list of dependencies is likely to be inaccurate. - packages: - - bison - - boost - - ccache - - cmake - - cracklib - - curl - - gnutls - - groonga - - jemalloc - - libxml2 - - lz4 - - lzo - - ncurses - - openssl@1.1 - - ossp-uuid - - pcre2 - - perl - - pkg-config - - readline - - snappy - - xz - - zlib - - zstd - -## Build jobs matrix -# The jobs matrix consists of all the combinations of 'arch', 'os', 'compiler' -# and 'env'. Ensure there is a good variation of architectures and at least the -# main suite is run on all architectures, as the main test suite needs to pass -# on all architectures (amd64, arm64, ppc64le, s390x) before a release is made. -# -# In gcc and clang use a fairly old version and one very recent and assume that -# if both of them built successfully all the intermediate version work as well. -arch: amd64 -os: linux -compiler: - - gcc - - clang -env: - - CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts - - CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,rocksdb,versioning,rpl - - CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles,encryption - - CC_VERSION=10 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main - -jobs: - # Define extra jobs that are run in addition to the main jobs matrix - include: - - os: linux - compiler: gcc - env: DebPackages=focal - addons: &deb-addons - apt: - sources: *add-sources - # make sure these match debian/control contents - packages: - - *common-packages - - debhelper - - devscripts - - dh-apparmor - - dh-exec - - dh-systemd - - fakeroot - - libsystemd-dev - - libzstd-dev - - po-debconf - - unixodbc-dev - script: &deb-script - - ${CC} --version ; ${CXX} --version - - apt-cache policy - - env DEB_BUILD_OPTIONS="parallel=4" debian/autobake-deb.sh; - - os: linux - dist: bionic - arch: s390x - compiler: gcc - env: DebPackages=bionic - addons: *deb-addons - script: *deb-script - # Just one OS X build is enough - - os: osx - osx_image: xcode12u - compiler: clang - env: CC_VERSION=10 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main - # Some chosen ones with s390x and gcc - - os: linux - arch: s390x - compiler: gcc - env: CC_VERSION=10 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main - - os: linux - arch: s390x - compiler: gcc - env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption,rocksdb,versioning,rpl - # Some chosen ones with s390x and clang - - os: linux - arch: s390x - compiler: clang - env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts - - os: linux - arch: s390x - compiler: clang - env: CC_VERSION=10 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles - # Extra tests to ensure IBM Power and ARM 64 work - - os: linux - arch: ppc64le - compiler: gcc - env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main - - os: linux - arch: arm64 - compiler: gcc - env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main - - allow_failures: - # Permanently fails on main.column_compression 'innodb' test (MDEV-23954) - - os: linux - arch: s390x - compiler: gcc - env: CC_VERSION=10 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main - # Until OSX becomes a bit more stable - - os: osx - # ppc64el builder frequently runs out of memory - - arch: ppc64le - -before_install: - - if [[ "${TRAVIS_OS_NAME}" == 'osx' ]]; then - brew update; - 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: -# clang disabled: mroonga just generates too many warnings with clang and travis stops the job -# gcc/rpl: mroonga - - source .travis.compiler.sh - - cmake . - -DCMAKE_BUILD_TYPE=${TYPE} - ${CMAKE_OPT} - -DWITH_SSL=system -DWITH_ZLIB=system - - make -j 4 - - cd mysql-test - - travis_wait 30 ./mtr --force --max-test-fail=20 --parallel=4 --testcase-timeout=${TEST_CASE_TIMEOUT} - --suite=${MYSQL_TEST_SUITES} - --skip-test=binlog.binlog_unsafe - -after_script: - - ccache --show-stats - - df -h - -notifications: - irc: - channels: - - "chat.freenode.net#maria" - on_success: never # [always|never|change] - on_failure: never - template: - - "%{repository}/%{branch} (%{commit} - %{author}): %{build_url}: %{message}" diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh index 14347ca823290..cc66ed09f5d29 100644 --- a/BUILD/FINISH.sh +++ b/BUILD/FINISH.sh @@ -62,11 +62,15 @@ commands="$commands path=`dirname $0` . \"$path/autorun.sh\"" -if [ -z "$just_clean" ] +if [ -z "$just_clean"] then -commands="$commands -git submodule update -CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\" CXXLDFLAGS=\"$CXXLDFLAGS\" $configure" + if test -d .git + then + commands="$commands + git submodule update" + fi + commands="$commands + CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\" CXXLDFLAGS=\"$CXXLDFLAGS\" $configure" fi if [ -z "$just_configure" -a -z "$just_clean" ] diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index e77d86d246208..0ddf02813e387 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -125,7 +125,7 @@ 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. +# then the bundled one --with-ssl=system will use the system library. # We use bundled by default as this is guaranteed to work with Galera SSL_LIBRARY=--with-ssl diff --git a/BUILD/compile-irix-mips64-mipspro b/BUILD/compile-irix-mips64-mipspro index 917f3d07bbbd3..94d19358aca81 100755 --- a/BUILD/compile-irix-mips64-mipspro +++ b/BUILD/compile-irix-mips64-mipspro @@ -55,7 +55,7 @@ path=`dirname $0` . "$path/autorun.sh" # C options: -# -apo - auto-parallize for multiprocessors (implies -mp) +# -apo - auto-parallelize for multiprocessors (implies -mp) # -mp - generate multiprocessor code # These two common optimization options apparently use 'sproc' model of # threading, which is not compatible with PTHREADS: don't add them unless you diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c045360631d4..ce77fdc5f1fc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) 2006, 2017, Oracle and/or its affiliates. -# Copyright (c) 2008, 2021, MariaDB Corporation. +# Copyright (c) 2008, 2022, 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 @@ -33,7 +33,7 @@ PROJECT(MySQL) # in RPM's: #set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true") -FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0075 CMP0069) +FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0075 CMP0069 CMP0135) IF(POLICY ${p}) CMAKE_POLICY(SET ${p} NEW) ENDIF() @@ -80,9 +80,11 @@ SET(MYSQL_PROJECT_NAME_DOCSTRING "MySQL project name") IF(CMAKE_VERSION VERSION_LESS "3.1") IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") ENDIF() ELSE() + SET(CMAKE_C_STANDARD 99) SET(CMAKE_CXX_STANDARD 11) ENDIF() @@ -234,7 +236,7 @@ IF (WITH_MSAN) MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO) ENDIF() -OPTION(WITH_GPROF "Enable profilingg with gprof" OFF) +OPTION(WITH_GPROF "Enable profiling with gprof" OFF) IF (WITH_GPROF) MY_CHECK_AND_SET_COMPILER_FLAG("-pg -g -no-pie -fPIC") ENDIF() @@ -255,9 +257,11 @@ ENDIF() INCLUDE(wsrep) -OPTION(WITH_DBUG_TRACE "Enable DBUG_ENTER()/DBUG_EXIT()" ON) +OPTION(WITH_DBUG_TRACE "Enable DBUG_ENTER()/DBUG_RETURN()/DBUG_PRINT()" ON) IF(WITH_DBUG_TRACE) - ADD_DEFINITIONS(-DDBUG_TRACE) + FOREACH(LANG C CXX) + SET(CMAKE_${LANG}_FLAGS_DEBUG "${CMAKE_${LANG}_FLAGS_DEBUG} -DDBUG_TRACE") + ENDFOREACH() ENDIF() # Always enable debug sync for debug builds. @@ -419,10 +423,12 @@ IF(WITH_UNIT_TESTS) ENDIF() ENDIF() + UNSET (MYSQLD_STATIC_PLUGIN_LIBS CACHE) INCLUDE(mariadb_connector_c) # this does ADD_SUBDIRECTORY(libmariadb) +INCLUDE(cpack_tgz) INCLUDE(cpack_rpm) INCLUDE(cpack_deb) @@ -535,7 +541,10 @@ INSTALL_DOCUMENTATION(README.md CREDITS COPYING THIRDPARTY COMPONENT Readme) # ${CMAKE_BINARY_DIR}/Docs/INFO_BIN) IF(UNIX) - INSTALL_DOCUMENTATION(Docs/INSTALL-BINARY Docs/README-wsrep COMPONENT Readme) + INSTALL_DOCUMENTATION(Docs/INSTALL-BINARY COMPONENT Readme) + IF(WITH_WSREP) + INSTALL_DOCUMENTATION(Docs/README-wsrep COMPONENT Readme) + ENDIF() ENDIF() INCLUDE(build_depends) diff --git a/CREDITS b/CREDITS index f5e87e18752f4..3560406498022 100644 --- a/CREDITS +++ b/CREDITS @@ -4,13 +4,14 @@ organization registered in the USA. The current main sponsors of the MariaDB Foundation are: Alibaba Cloud https://www.alibabacloud.com/ (2017) +Intel https://www.intel.com (2022) MariaDB Corporation https://www.mariadb.com (2013) Microsoft https://microsoft.com/ (2017) ServiceNow https://servicenow.com (2019) +SIT https://sit.org (2022) Tencent Cloud https://cloud.tencent.com (2017) Development Bank of Singapore https://dbs.com (2016) IBM https://www.ibm.com (2017) -Visma https://visma.com (2015) Automattic https://automattic.com (2019) Galera Cluster https://galeracluster.com (2020) Percona https://www.percona.com (2018) diff --git a/Docs/INSTALL-BINARY b/Docs/INSTALL-BINARY index b9153f7cb6700..081f4dc969161 100644 --- a/Docs/INSTALL-BINARY +++ b/Docs/INSTALL-BINARY @@ -44,8 +44,8 @@ However most documentation at www.mysql.com also applies. shell> groupadd mysql shell> useradd -g mysql mysql shell> cd /usr/local -shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf - -shell> ln -s full-path-to-mysql-VERSION-OS mysql +shell> gunzip < /path/to/mariadb-VERSION-OS.tar.gz | tar xvf - +shell> ln -s full-path-to-mariadb-VERSION-OS mysql shell> cd mysql shell> chown -R mysql . shell> chgrp -R mysql . @@ -88,16 +88,16 @@ shell> cd /usr/local 4. Unpack the distribution, which creates the installation directory. Then create a symbolic link to that directory: -shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf - -shell> ln -s full-path-to-mysql-VERSION-OS mysql - The tar command creates a directory named mysql-VERSION-OS. +shell> gunzip < /path/to/mariadb-VERSION-OS.tar.gz | tar xvf - +shell> ln -s full-path-to-mariadb-VERSION-OS mysql + The tar command creates a directory named mariadb-VERSION-OS. The ln command makes a symbolic link to that directory. This lets you refer more easily to the installation directory as /usr/local/mysql. With GNU tar, no separate invocation of gunzip is necessary. You can replace the first line with the following alternative command to uncompress and extract the distribution: -shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz +shell> tar zxvf /path/to/mariadb-VERSION-OS.tar.gz 5. Change location into the installation directory: shell> cd mysql diff --git a/Docs/README-wsrep b/Docs/README-wsrep index 79278ed8927f7..2e3bf52219d01 100644 --- a/Docs/README-wsrep +++ b/Docs/README-wsrep @@ -365,7 +365,7 @@ wsrep_forced_binlog_format=none special value NONE, meaning that there is no forced binlog format in effect. This variable was introduced to support STATEMENT format replication during rolling schema upgrade processing. However, in most cases ROW replication - is valid for asymmetrict schema replication. + is valid for asymmetric schema replication. State snapshot transfer options. @@ -416,7 +416,7 @@ wsrep_sst_donor= 6. ONLINE SCHEMA UPGRADE - Schema upgrades mean any data definition statements (DDL statemnents) run + Schema upgrades mean any data definition statements (DDL statements) run for the database. They change the database structure and are non- transactional. @@ -429,7 +429,7 @@ wsrep_sst_donor= With earlier releases, DDL processing happened always by Total Order Isolation (TOI) method. With TOI, the DDL was scheduled to be processed in - same transaction seqeuncing 'slot' in each cluster node. + same transaction sequencing 'slot' in each cluster node. The processing is secured by locking the affected table from any other use. With TOI method, the whole cluster has part of the database locked for the duration of the DDL processing. diff --git a/Docs/myisam.txt b/Docs/myisam.txt index db41fb911cacb..f959d8eb775e2 100644 --- a/Docs/myisam.txt +++ b/Docs/myisam.txt @@ -177,7 +177,7 @@ HA_EXTRA_NO_KEYREAD=8 Normal read of records (def) HA_EXTRA_NO_USER_CHANGE=9 No user is allowed to write HA_EXTRA_KEY_CACHE=10 HA_EXTRA_NO_KEY_CACHE=11 -HA_EXTRA_WAIT_LOCK=12 Wait until file is avalably (def) +HA_EXTRA_WAIT_LOCK=12 Wait until file is available (def) HA_EXTRA_NO_WAIT_LOCK=13 If file is locked, return quickly HA_EXTRA_WRITE_CACHE=14 Use write cache in ha_write() HA_EXTRA_FLUSH_CACHE=15 flush write_record_cache diff --git a/VERSION b/VERSION index d52c6e9f89b9e..215e558a471f0 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=8 -MYSQL_VERSION_PATCH=0 -SERVER_MATURITY=alpha +MYSQL_VERSION_PATCH=8 +SERVER_MATURITY=stable diff --git a/appveyor.yml b/appveyor.yml index 85da76129314a..8e7b0fcb7155e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,15 +1,5 @@ -init: - # Install bison - - choco feature disable --name showDownloadProgress - - choco install -y winflexbison - - C:\ProgramData\chocolatey\lib\winflexbison\tools\win_bison.exe --version - version: build-{build}~branch-{branch} -cache: - - C:\ProgramData\chocolatey\bin -> appveyor.yml - - C:\ProgramData\chocolatey\lib -> appveyor.yml - clone_depth: 1 build_script: @@ -26,8 +16,8 @@ build_script: - cd _build - set BUILD_TYPE=MinSizeRel - set GENERATOR=-GNinja - - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" - - cmake -E time cmake %GENERATOR% .. -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DMYSQL_MAINTAINER_MODE=ERR -DFAST_BUILD=1 -DBISON_EXECUTABLE=C:\ProgramData\chocolatey\lib\winflexbison\tools\win_bison.exe -DPLUGIN_PERFSCHEMA=NO -DPLUGIN_FEEDBACK=NO + - call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" + - cmake -E time cmake %GENERATOR% .. -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DMYSQL_MAINTAINER_MODE=ERR -DFAST_BUILD=1 -DBISON_EXECUTABLE=C:\cygwin64\bin\bison.exe -DPLUGIN_PERFSCHEMA=NO -DPLUGIN_FEEDBACK=NO - set /A jobs=2*%NUMBER_OF_PROCESSORS% - cmake -E time cmake --build . -j %jobs% --config %BUILD_TYPE% --target minbuild @@ -35,6 +25,6 @@ test_script: - set PATH=C:\Strawberry\perl\bin;%PATH%;C:\Program Files (x86)\Windows Kits\10\Debuggers\x64 - cd %APPVEYOR_BUILD_FOLDER%\_build\mysql-test - set /A parallel=4*%NUMBER_OF_PROCESSORS% - - perl mysql-test-run.pl --force --max-test-fail=10 --retry=2 -parallel=%parallel% --testcase-timeout=4 --suite=main --skip-test-list=%APPVEYOR_BUILD_FOLDER%\win\appveyor_skip_tests.txt --mysqld=--loose-innodb-flush-log-at-trx-commit=2 + - perl mysql-test-run.pl --force --max-test-fail=10 --retry=2 --parallel=%parallel% --testcase-timeout=4 --suite=main --skip-test-list=%APPVEYOR_BUILD_FOLDER%\win\appveyor_skip_tests.txt --mysqld=--loose-innodb-flush-log-at-trx-commit=2 -image: Visual Studio 2019 +image: Visual Studio 2022 diff --git a/client/client_priv.h b/client/client_priv.h index 23b2e6782a1e1..bde5a697b241c 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -1,6 +1,6 @@ /* Copyright (c) 2001, 2012, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB + Copyright (c) 2009, 2022, 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 @@ -101,6 +101,8 @@ enum options_client OPT_SSL_CRL, OPT_SSL_CRLPATH, OPT_IGNORE_DATA, OPT_PRINT_ROW_COUNT, OPT_PRINT_ROW_EVENT_POSITIONS, + OPT_CHECK_IF_UPGRADE_NEEDED, + OPT_COMPATIBILTY_CLEARTEXT_PLUGIN, OPT_SHUTDOWN_WAIT_FOR_SLAVES, OPT_COPY_S3_TABLES, OPT_PRINT_TABLE_METADATA, @@ -147,51 +149,3 @@ enum options_client #else #define SOCKET_PROTOCOL_TO_FORCE MYSQL_PROTOCOL_PIPE #endif - -/** - Utility function to implicitly change the connection protocol to a - consistent value given the command line arguments. Additionally, - warns the user that the protocol has been changed. - - Arguments: - @param [in] host Name of the host to connect to - @param [in, out] opt_protocol Location of the protocol option - variable to update - @param [in] new_protocol New protocol to force -*/ -static inline void warn_protocol_override(char *host, - uint *opt_protocol, - uint new_protocol) -{ - DBUG_ASSERT(new_protocol == MYSQL_PROTOCOL_TCP - || new_protocol == SOCKET_PROTOCOL_TO_FORCE); - - - if ((host == NULL - || strncmp(host, LOCAL_HOST, sizeof(LOCAL_HOST)-1) == 0)) - { - const char *protocol_name; - - if (*opt_protocol == MYSQL_PROTOCOL_DEFAULT -#ifndef _WIN32 - && new_protocol == MYSQL_PROTOCOL_SOCKET -#else - && new_protocol == MYSQL_PROTOCOL_TCP -#endif - ) - { - /* This is already the default behavior, do nothing */ - return; - } - - protocol_name= sql_protocol_typelib.type_names[new_protocol-1]; - - fprintf(stderr, "%s %s %s\n", - "WARNING: Forcing protocol to ", - protocol_name, - " due to option specification. " - "Please explicitly state intended protocol."); - - *opt_protocol = new_protocol; - } -} diff --git a/client/echo.c b/client/echo.c index 90a538faf6287..6904f54196082 100644 --- a/client/echo.c +++ b/client/echo.c @@ -16,7 +16,7 @@ /* echo is a replacement for the "echo" command builtin to cmd.exe - on Windows, to get a Unix eqvivalent behaviour when running commands + on Windows, to get a Unix equivalent behaviour when running commands like: $> echo "hello" | mysql diff --git a/client/mysql.cc b/client/mysql.cc index 6612b273d1753..4833025755414 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2018, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB Corporation. + Copyright (c) 2009, 2022, 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,7 +42,7 @@ #include #include #include -#if defined(USE_LIBEDIT_INTERFACE) && defined(HAVE_LOCALE_H) +#if defined(HAVE_LOCALE_H) #include #endif @@ -299,8 +299,6 @@ unsigned short terminal_width= 80; static uint opt_protocol=0; static const char *opt_protocol_type= ""; -static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT; - #include "sslopt-vars.h" const char *default_dbug_option="d:t:o,/tmp/mariadb.trace"; @@ -1269,14 +1267,6 @@ int main(int argc,char *argv[]) exit(status.exit_status); } - /* Command line options override configured protocol */ - if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT - && protocol_to_force != opt_protocol) - { - warn_protocol_override(current_host, &opt_protocol, protocol_to_force); - } - - if (status.batch && !status.line_buff && !(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin))) { @@ -1660,6 +1650,8 @@ static struct my_option my_long_options[] = &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"execute", 'e', "Execute command and quit. (Disables --force and history file.)", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"enable-cleartext-plugin", OPT_COMPATIBILTY_CLEARTEXT_PLUGIN, "Obsolete option. Exists only for MySQL compatibility.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"vertical", 'E', "Print the output of a query (rows) vertically.", &vertical, &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -1868,11 +1860,9 @@ static void usage(int version) my_bool -get_one_option(const struct my_option *opt, const char *argument, const char *filename) +get_one_option(const struct my_option *opt, const char *argument, + const char *filename) { - /* Track when protocol is set via CLI to not force port TCP protocol override */ - static my_bool ignore_protocol_override = FALSE; - switch(opt->id) { case OPT_CHARSETS_DIR: strmake_buf(mysql_charsets_dir, argument); @@ -1933,18 +1923,11 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi #ifndef EMBEDDED_LIBRARY if (!argument[0]) opt_protocol= 0; - else if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + else if ((opt_protocol= + find_type_with_warning(argument, &sql_protocol_typelib, opt->name)) <= 0) exit(1); #endif - - /* Specification of protocol via CLI trumps implicit overrides */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - break; case OPT_SERVER_ARG: #ifdef EMBEDDED_LIBRARY @@ -1969,6 +1952,14 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi printf("WARNING: --server-arg option not supported in this configuration.\n"); #endif break; + case OPT_COMPATIBILTY_CLEARTEXT_PLUGIN: + /* + This option exists in MySQL client but not in MariaDB. Users switching from + MySQL might still have this option in their commands, and it will not work + in MariaDB unless it is handled. Therefore output a warning and continue. + */ + printf("WARNING: option '--enable-cleartext-plugin' is obsolete.\n"); + break; case 'A': opt_rehash= 0; break; @@ -2036,13 +2027,6 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi #ifdef _WIN32 opt_protocol = MYSQL_PROTOCOL_PIPE; opt_protocol_type= "pipe"; - - /* Prioritize pipe if explicit via command line */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } #endif break; #include @@ -2055,35 +2039,17 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi mysql_end(-1); break; case 'P': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* If port is set via CLI, try to force protocol to TCP */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = MYSQL_PROTOCOL_TCP; + /* Port given on command line, switch protocol to use TCP */ + opt_protocol= MYSQL_PROTOCOL_TCP; } break; case 'S': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == MYSQL_PROTOCOL_TCP) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* Prioritize socket if set via command line */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = SOCKET_PROTOCOL_TO_FORCE; + /* Socket given on command line, switch protocol to use SOCKETSt */ + opt_protocol= MYSQL_PROTOCOL_SOCKET; } break; case 'I': @@ -2496,7 +2462,7 @@ static bool add_line(String &buffer, char *line, size_t line_length, !(*in_string && (mysql.server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES))) { - // Found possbile one character command like \c + // Found possible one character command like \c /* The null-terminating character (ASCII '\0') marks the end of user @@ -2847,6 +2813,9 @@ static void initialize_readline () /* Allow conditional parsing of the ~/.inputrc file. */ rl_readline_name= (char *) "mysql"; rl_terminal_name= getenv("TERM"); +#ifdef HAVE_SETLOCALE + setlocale(LC_ALL,""); +#endif /* Tell the completer that we want a crack first. */ #if defined(USE_NEW_READLINE_INTERFACE) @@ -2855,9 +2824,6 @@ static void initialize_readline () rl_add_defun("magic-space", (rl_command_func_t *)&fake_magic_space, -1); #elif defined(USE_LIBEDIT_INTERFACE) -#ifdef HAVE_LOCALE_H - setlocale(LC_ALL,""); /* so as libedit use isprint */ -#endif rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion; rl_completion_entry_function= &no_completion; rl_add_defun("magic-space", (Function*)&fake_magic_space, -1); @@ -3778,7 +3744,6 @@ print_table_data(MYSQL_RES *result) { String separator(256); MYSQL_ROW cur; - MYSQL_FIELD *field; bool *num_flag; num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result)); @@ -3786,11 +3751,14 @@ print_table_data(MYSQL_RES *result) { print_field_types(result); if (!mysql_num_rows(result)) + { + my_afree((uchar*) num_flag); return; + } mysql_field_seek(result,0); } separator.copy("+",1,charset_info); - while ((field = mysql_fetch_field(result))) + while (MYSQL_FIELD *field= mysql_fetch_field(result)) { uint length= column_names ? field->name_length : 0; if (quick) @@ -3812,7 +3780,7 @@ print_table_data(MYSQL_RES *result) { mysql_field_seek(result,0); (void) tee_fputs("|", PAGER); - for (uint off=0; (field = mysql_fetch_field(result)) ; off++) + while (MYSQL_FIELD *field= mysql_fetch_field(result)) { size_t name_length= (uint) strlen(field->name); size_t numcells= charset_info->numcells(field->name, @@ -3854,7 +3822,7 @@ print_table_data(MYSQL_RES *result) data_length= (uint) lengths[off]; } - field= mysql_fetch_field(result); + MYSQL_FIELD *field= mysql_fetch_field(result); field_max_length= field->max_length; /* @@ -5584,6 +5552,7 @@ static void init_username() full_username=my_strdup(PSI_NOT_INSTRUMENTED, cur[0],MYF(MY_WME)); part_username=my_strdup(PSI_NOT_INSTRUMENTED, strtok(cur[0],"@"),MYF(MY_WME)); (void) mysql_fetch_row(result); // Read eof + mysql_free_result(result); } } diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c index 366d5d07d691c..a96af01509ef6 100644 --- a/client/mysql_plugin.c +++ b/client/mysql_plugin.c @@ -102,7 +102,7 @@ int main(int argc,char *argv[]) MY_INIT(argv[0]); sf_leaking_memory=1; /* don't report memory leaks on early exits */ plugin_data.name= 0; /* initialize name */ - + /* The following operations comprise the method for enabling or disabling a plugin. We begin by processing the command options then check the @@ -110,15 +110,15 @@ int main(int argc,char *argv[]) --plugin-ini (if specified). If the directories are Ok, we then look for the mysqld executable and the plugin soname. Finally, we build a bootstrap command file for use in bootstraping the server. - + If any step fails, the method issues an error message and the tool exits. - + 1) Parse, execute, and verify command options. 2) Check access to directories. 3) Look for mysqld executable. 4) Look for the plugin. 5) Build a bootstrap file with commands to enable or disable plugin. - + */ if ((error= process_options(argc, argv, operation)) || (error= check_access()) || @@ -126,11 +126,11 @@ int main(int argc,char *argv[]) (error= find_plugin(tp_path)) || (error= build_bootstrap_file(operation, bootstrap))) goto exit; - + /* Dump the bootstrap file if --verbose specified. */ if (opt_verbose && ((error= dump_bootstrap_file(bootstrap)))) goto exit; - + /* Start the server in bootstrap mode and execute bootstrap commands */ error= bootstrap_server(server_path, bootstrap); @@ -238,7 +238,7 @@ static int run_command(char* cmd, const char *mode) #ifdef _WIN32 /** Check to see if there are spaces in a path. - + @param[in] path The Windows path to examine. @retval int spaces found = 1, no spaces = 0 @@ -253,7 +253,7 @@ static int has_spaces(const char *path) /** Convert a Unix path to a Windows path. - + @param[in] path The Windows path to examine. @returns string containing path with / changed to \\ @@ -281,7 +281,7 @@ static char *convert_path(const char *argument) @param[in] path The Windows path to examine. - @returns string containing excaped quotes if spaces found in path + @returns string containing escaped quotes if spaces found in path */ static char *add_quotes(const char *path) { @@ -335,12 +335,12 @@ static int get_default_values() #ifdef _WIN32 { char *format_str= 0; - + if (has_spaces(tool_path) || has_spaces(defaults_file)) format_str = "\"%s --mysqld > %s\""; else format_str = "%s --mysqld > %s"; - + snprintf(defaults_cmd, sizeof(defaults_cmd), format_str, add_quotes(tool_path), add_quotes(defaults_file)); if (opt_verbose) @@ -569,14 +569,14 @@ static int file_exists(char * filename) @retval int error = 1, success = 0 */ -static int search_dir(const char * base_path, const char *tool_name, +static int search_dir(const char *base_path, const char *tool_name, const char *subdir, char *tool_path) { char new_path[FN_REFLEN]; char source_path[FN_REFLEN]; - strcpy(source_path, base_path); - strcat(source_path, subdir); + safe_strcpy(source_path, sizeof(source_path), base_path); + safe_strcat(source_path, sizeof(source_path), subdir); fn_format(new_path, tool_name, source_path, "", MY_UNPACK_FILENAME); if (file_exists(new_path)) { @@ -632,7 +632,7 @@ static int load_plugin_data(char *plugin_name, char *config_file) FILE *file_ptr; char path[FN_REFLEN]; char line[1024]; - char *reason= 0; + const char *reason= 0; char *res; int i= -1; @@ -643,14 +643,14 @@ static int load_plugin_data(char *plugin_name, char *config_file) } if (!file_exists(opt_plugin_ini)) { - reason= (char *)"File does not exist."; + reason= "File does not exist."; goto error; } file_ptr= fopen(opt_plugin_ini, "r"); if (file_ptr == NULL) { - reason= (char *)"Cannot open file."; + reason= "Cannot open file."; goto error; } @@ -660,19 +660,22 @@ static int load_plugin_data(char *plugin_name, char *config_file) /* Read plugin components */ while (i < 16) { + size_t line_len; + res= fgets(line, sizeof(line), file_ptr); + line_len= strlen(line); + /* strip /n */ - if (line[strlen(line)-1] == '\n') - { - line[strlen(line)-1]= '\0'; - } + if (line[line_len - 1] == '\n') + line[line_len - 1]= '\0'; + if (res == NULL) { if (i < 1) { - reason= (char *)"Bad format in plugin configuration file."; + reason= "Bad format in plugin configuration file."; fclose(file_ptr); - goto error; + goto error; } break; } @@ -683,14 +686,19 @@ static int load_plugin_data(char *plugin_name, char *config_file) if (i == -1) /* if first pass, read this line as so_name */ { /* Add proper file extension for soname */ - strcat(line, FN_SOEXT); + if (safe_strcpy(line + line_len - 1, sizeof(line), FN_SOEXT)) + { + reason= "Plugin name too long."; + fclose(file_ptr); + goto error; + } /* save so_name */ plugin_data.so_name= my_strdup(PSI_NOT_INSTRUMENTED, line, MYF(MY_WME|MY_ZEROFILL)); i++; } else { - if (strlen(line) > 0) + if (line_len > 0) { plugin_data.components[i]= my_strdup(PSI_NOT_INSTRUMENTED, line, MYF(MY_WME)); i++; @@ -701,7 +709,7 @@ static int load_plugin_data(char *plugin_name, char *config_file) } } } - + fclose(file_ptr); return 0; @@ -732,7 +740,7 @@ static int check_options(int argc, char **argv, char *operation) int num_found= 0; /* number of options found (shortcut loop) */ char config_file[FN_REFLEN]; /* configuration file name */ char plugin_name[FN_REFLEN]; /* plugin name */ - + /* Form prefix strings for the options. */ const char *basedir_prefix = "--basedir="; size_t basedir_len= strlen(basedir_prefix); @@ -779,14 +787,13 @@ static int check_options(int argc, char **argv, char *operation) /* read the plugin config file and check for match against argument */ else { - if (strlen(argv[i]) + 4 + 1 > FN_REFLEN) + if (safe_strcpy(plugin_name, sizeof(plugin_name), argv[i]) || + safe_strcpy(config_file, sizeof(config_file), argv[i]) || + safe_strcat(config_file, sizeof(config_file), ".ini")) { fprintf(stderr, "ERROR: argument is too long.\n"); return 1; } - strcpy(plugin_name, argv[i]); - strcpy(config_file, argv[i]); - strcat(config_file, ".ini"); } } @@ -808,7 +815,7 @@ static int check_options(int argc, char **argv, char *operation) return 1; } /* If a plugin was specified, read the config file. */ - else if (strlen(plugin_name) > 0) + else if (strlen(plugin_name) > 0) { if (load_plugin_data(plugin_name, config_file)) { @@ -840,65 +847,57 @@ static int check_options(int argc, char **argv, char *operation) /** Parse, execute, and verify command options. - + This method handles all of the option processing including the optional features for displaying data (--print-defaults, --help ,etc.) that do not result in an attempt to ENABLE or DISABLE of a plugin. - + @param[in] arc Count of arguments @param[in] argv Array of arguments @param[out] operation Operation (ENABLE or DISABLE) - + @retval int error = 1, success = 0, exit program = -1 */ static int process_options(int argc, char *argv[], char *operation) { int error= 0; - int i= 0; - + /* Parse and execute command-line options */ if ((error= handle_options(&argc, &argv, my_long_options, get_one_option))) - goto exit; + return error; /* If the print defaults option used, exit. */ if (opt_print_defaults) - { - error= -1; - goto exit; - } + return -1; /* Add a trailing directory separator if not present */ if (opt_basedir) { - i= (int)strlength(opt_basedir); - if (opt_basedir[i-1] != FN_LIBCHAR || opt_basedir[i-1] != FN_LIBCHAR2) + size_t basedir_len= strlength(opt_basedir); + if (opt_basedir[basedir_len - 1] != FN_LIBCHAR || + opt_basedir[basedir_len - 1] != FN_LIBCHAR2) { char buff[FN_REFLEN]; - memset(buff, 0, sizeof(buff)); - - strncpy(buff, opt_basedir, sizeof(buff) - 1); -#ifdef _WIN32 - strncat(buff, "/", sizeof(buff) - strlen(buff) - 1); -#else - strncat(buff, FN_DIRSEP, sizeof(buff) - strlen(buff) - 1); -#endif - buff[sizeof(buff) - 1]= 0; + if (basedir_len + 2 > FN_REFLEN) + return -1; + + memcpy(buff, opt_basedir, basedir_len); + buff[basedir_len]= '/'; + buff[basedir_len + 1]= '\0'; + my_free(opt_basedir); opt_basedir= my_strdup(PSI_NOT_INSTRUMENTED, buff, MYF(MY_FAE)); } } - + /* If the user did not specify the option to skip loading defaults from a config file and the required options are not present or there was an error generated when the defaults were read from the file, exit. */ if (!opt_no_defaults && ((error= get_default_values()))) - { - error= -1; - goto exit; - } + return -1; /* Check to ensure required options are present and validate the operation. @@ -906,11 +905,9 @@ static int process_options(int argc, char *argv[], char *operation) read a configuration file named .ini from the --plugin-dir or --plugin-ini location if the --plugin-ini option presented. */ - strcpy(operation, ""); - if ((error = check_options(argc, argv, operation))) - { - goto exit; - } + operation[0]= '\0'; + if ((error= check_options(argc, argv, operation))) + return error; if (opt_verbose) { @@ -922,25 +919,24 @@ static int process_options(int argc, char *argv[], char *operation) printf("# lc_messages_dir = %s\n", opt_lc_messages_dir); } -exit: - return error; + return 0; } /** Check access - + This method checks to ensure all of the directories (opt_basedir, opt_plugin_dir, opt_datadir, and opt_plugin_ini) are accessible by the user. - + @retval int error = 1, success = 0 */ static int check_access() { int error= 0; - + if ((error= my_access(opt_basedir, F_OK))) { fprintf(stderr, "ERROR: Cannot access basedir at '%s'.\n", @@ -1052,13 +1048,13 @@ static int find_plugin(char *tp_path) /** Build the bootstrap file. - + Create a new file and populate it with SQL commands to ENABLE or DISABLE the plugin via REPLACE and DELETE operations on the mysql.plugin table. param[in] operation The type of operation (ENABLE or DISABLE) param[out] bootstrap A FILE* pointer - + @retval int error = 1, success = 0 */ @@ -1066,7 +1062,7 @@ static int build_bootstrap_file(char *operation, char *bootstrap) { int error= 0; FILE *file= 0; - + /* Perform plugin operation : ENABLE or DISABLE @@ -1077,10 +1073,10 @@ static int build_bootstrap_file(char *operation, char *bootstrap) .ini configuration file. Once the file is built, a call to mysqld is made in read only, bootstrap modes to read the SQL statements and execute them. - + Note: Replace was used so that if a user loads a newer version of a library with a different library name, the new library name is - used for symbols that match. + used for symbols that match. */ if ((error= make_tempfile(bootstrap, "sql"))) { @@ -1127,7 +1123,7 @@ static int build_bootstrap_file(char *operation, char *bootstrap) printf("# Disabling %s...\n", plugin_data.name); } } - + exit: fclose(file); return error; @@ -1136,11 +1132,11 @@ static int build_bootstrap_file(char *operation, char *bootstrap) /** Dump bootstrap file. - + Read the contents of the bootstrap file and print it out. - + @param[in] bootstrap_file Name of bootstrap file to read - + @retval int error = 1, success = 0 */ @@ -1177,7 +1173,7 @@ static int dump_bootstrap_file(char *bootstrap_file) /** Bootstrap the server - + Create a command line sequence to launch mysqld in bootstrap mode. This will allow mysqld to launch a minimal server instance to read and execute SQL commands from a file piped in (the bootstrap file). We use @@ -1198,47 +1194,39 @@ static int dump_bootstrap_file(char *bootstrap_file) static int bootstrap_server(char *server_path, char *bootstrap_file) { - char bootstrap_cmd[FN_REFLEN]; + char bootstrap_cmd[FN_REFLEN]= {0}; + char lc_messages_dir_str[FN_REFLEN]= {0}; int error= 0; #ifdef _WIN32 char *format_str= 0; const char *verbose_str= NULL; - - +#endif + + if (opt_lc_messages_dir != NULL) + snprintf(lc_messages_dir_str, sizeof(lc_messages_dir_str), "--lc-messages-dir=%s", + opt_lc_messages_dir); + +#ifdef _WIN32 if (opt_verbose) verbose_str= "--console"; else verbose_str= ""; + if (has_spaces(opt_datadir) || has_spaces(opt_basedir) || - has_spaces(bootstrap_file)) - { - if (opt_lc_messages_dir != NULL) - format_str= "\"%s %s --bootstrap --datadir=%s --basedir=%s --lc-messages-dir=%s <%s\""; - else - format_str= "\"%s %s --bootstrap --datadir=%s --basedir=%s <%s\""; - } + has_spaces(bootstrap_file) || has_spaces(lc_messages_dir_str)) + format_str= "\"%s %s --bootstrap --datadir=%s --basedir=%s %s <%s\""; else - { - if (opt_lc_messages_dir != NULL) - format_str= "\"%s %s --bootstrap --datadir=%s --basedir=%s --lc-messages-dir=%s <%s\""; - else - format_str= "%s %s --bootstrap --datadir=%s --basedir=%s <%s"; - } + format_str= "%s %s --bootstrap --datadir=%s --basedir=%s %s <%s"; + snprintf(bootstrap_cmd, sizeof(bootstrap_cmd), format_str, add_quotes(convert_path(server_path)), verbose_str, add_quotes(opt_datadir), add_quotes(opt_basedir), - add_quotes(bootstrap_file)); + add_quotes(lc_messages_dir_str), add_quotes(bootstrap_file)); #else - if (opt_lc_messages_dir != NULL) - snprintf(bootstrap_cmd, sizeof(bootstrap_cmd), - "%s --no-defaults --bootstrap --datadir=%s --basedir=%s --lc-messages-dir=%s" - " <%s", server_path, opt_datadir, opt_basedir, opt_lc_messages_dir, bootstrap_file); - else - snprintf(bootstrap_cmd, sizeof(bootstrap_cmd), - "%s --no-defaults --bootstrap --datadir=%s --basedir=%s" - " <%s", server_path, opt_datadir, opt_basedir, bootstrap_file); - + snprintf(bootstrap_cmd, sizeof(bootstrap_cmd), + "%s --no-defaults --bootstrap --datadir=%s --basedir=%s %s" + " <%s", server_path, opt_datadir, opt_basedir, lc_messages_dir_str, bootstrap_file); #endif /* Execute the command */ @@ -1251,6 +1239,6 @@ static int bootstrap_server(char *server_path, char *bootstrap_file) fprintf(stderr, "ERROR: Unexpected result from bootstrap. Error code: %d.\n", error); - + return error; } diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index d35591cd71c80..b4902d32e0233 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -22,7 +22,7 @@ #include /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ -#define VER "1.4" +#define VER "2.0" #ifdef HAVE_SYS_WAIT_H #include @@ -37,13 +37,15 @@ #endif static int phase = 0; +static int info_file= -1; static const int phases_total = 7; static char mysql_path[FN_REFLEN]; static char mysqlcheck_path[FN_REFLEN]; -static my_bool opt_force, opt_verbose, debug_info_flag, debug_check_flag, +static my_bool debug_info_flag, debug_check_flag, opt_systables_only, opt_version_check; -static my_bool opt_not_used, opt_silent; +static my_bool opt_not_used, opt_silent, opt_check_upgrade; +static uint opt_force, opt_verbose; static uint my_end_arg= 0; static char *opt_user= (char*)"root"; @@ -74,6 +76,8 @@ char upgrade_from_version[1024]; static my_bool opt_write_binlog; +static void print_conn_args(const char *tool_name); + #define OPT_SILENT OPT_MAX_CLIENT_OPTION static struct my_option my_long_options[]= @@ -96,8 +100,8 @@ static struct my_option my_long_options[]= {"debug", '#', "This is a non-debug version. Catch this and exit.", 0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, #else - {"debug", '#', "Output debug log.", &default_dbug_option, - &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"debug", '#', "Output debug log.", + 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, @@ -111,12 +115,15 @@ static struct my_option my_long_options[]= "Default authentication client-side plugin to use.", &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"check-if-upgrade-is-needed", OPT_CHECK_IF_UPGRADE_NEEDED, + "Exits with status 0 if an upgrades is required, 1 otherwise.", + &opt_check_upgrade, &opt_check_upgrade, + 0, GET_BOOL, NO_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 MariaDB.", - &opt_force, &opt_force, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + &opt_not_used, &opt_not_used, 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}, -#define PASSWORD_OPT 12 {"password", 'p', "Password to use when connecting to server. If password is not given," " it's solicited on the tty.", &opt_password,&opt_password, @@ -148,10 +155,12 @@ static struct my_option my_long_options[]= {"upgrade-system-tables", 's', "Only upgrade the system tables in the mysql database. Tables in other databases are not checked or touched.", &opt_systables_only, &opt_systables_only, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#define USER_OPT (array_elements(my_long_options) - 6) {"user", 'u', "User for login.", &opt_user, &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"verbose", 'v', "Display more output about the process; Using it twice will print connection argument; Using it 3 times will print out all CHECK, RENAME and ALTER TABLE during the check phase.", + {"verbose", 'v', "Display more output about the process; Using it twice will print connection argument;" + "Using it 3 times will print out all CHECK, RENAME and ALTER TABLE during the check phase;" + "Using it 4 times (added in MariaDB 10.0.14) will also write out all mariadb-check commands used;" + "Using it 5 times will print all the mariadb commands used and their results while running mysql_fix_privilege_tables script.", &opt_not_used, &opt_not_used, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -191,6 +200,12 @@ static void free_used_memory(void) dynstr_free(&ds_plugin_data_types); if (cnf_file_path) my_delete(cnf_file_path, MYF(MY_WME)); + if (info_file >= 0) + { + (void) my_lock(info_file, F_UNLCK, 0, 1, MYF(0)); + my_close(info_file, MYF(MY_WME)); + info_file= -1; + } } @@ -200,6 +215,7 @@ static void die(const char *fmt, ...) DBUG_ENTER("die"); /* Print the error message */ + print_conn_args("mariadb-check"); fflush(stdout); va_start(args, fmt); if (fmt) @@ -236,6 +252,13 @@ static void verbose(const char *fmt, ...) } +static void print_error(const char *error_msg, DYNAMIC_STRING *output) +{ + fprintf(stderr, "%s\n", error_msg); + fprintf(stderr, "%s", output->str); +} + + /* Add one option - passed to mysql_upgrade on command line or by defaults file(my.cnf) - to a dynamic string, in @@ -243,11 +266,11 @@ static void verbose(const char *fmt, ...) */ static void add_one_option_cmd_line(DYNAMIC_STRING *ds, - const struct my_option *opt, - const char* arg) + const char *name, + const char *arg) { dynstr_append(ds, "--"); - dynstr_append(ds, opt->name); + dynstr_append(ds, name); if (arg) { dynstr_append(ds, "="); @@ -257,10 +280,10 @@ static void add_one_option_cmd_line(DYNAMIC_STRING *ds, } static void add_one_option_cnf_file(DYNAMIC_STRING *ds, - const struct my_option *opt, - const char* arg) + const char *name, + const char *arg) { - dynstr_append(ds, opt->name); + dynstr_append(ds, name); if (arg) { dynstr_append(ds, "="); @@ -269,6 +292,7 @@ static void add_one_option_cnf_file(DYNAMIC_STRING *ds, dynstr_append(ds, "\n"); } + static my_bool get_one_option(const struct my_option *opt, const char *argument, const char *filename __attribute__((unused))) @@ -307,7 +331,7 @@ get_one_option(const struct my_option *opt, const char *argument, */ char *start= (char*) argument; /* Add password to ds_args before overwriting the arg with x's */ - add_one_option_cnf_file(&ds_args, opt, argument); + add_one_option_cnf_file(&ds_args, opt->name, argument); while (*argument) *(char*)argument++= 'x'; /* Destroy argument */ if (*start) @@ -344,11 +368,17 @@ get_one_option(const struct my_option *opt, const char *argument, my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); die(0); break; + case 'f': /* --force */ + opt_force++; + if (argument == disabled_my_option) + opt_force= 0; + add_option= 0; + break; case OPT_SILENT: opt_verbose= 0; add_option= 0; break; - case 'f': /* --force */ + case OPT_CHECK_IF_UPGRADE_NEEDED: /* --check-if-upgrade-needed */ case 's': /* --upgrade-system-tables */ case OPT_WRITE_BINLOG: /* --write-binlog */ add_option= FALSE; @@ -361,7 +391,7 @@ get_one_option(const struct my_option *opt, const char *argument, case OPT_MYSQL_PROTOCOL: /* --protocol */ case OPT_PLUGIN_DIR: /* --plugin-dir */ case OPT_DEFAULT_AUTH: /* --default-auth */ - add_one_option_cmd_line(&conn_args, opt, argument); + add_one_option_cmd_line(&conn_args, opt->name, argument); break; } @@ -372,12 +402,24 @@ get_one_option(const struct my_option *opt, const char *argument, it can be passed on to "mysql" and "mysqlcheck" Save it in the ds_args string */ - add_one_option_cnf_file(&ds_args, opt, argument); + add_one_option_cnf_file(&ds_args, opt->name, argument); } return 0; } +/* Convert the specified version string into the numeric format. */ + +static ulong STDCALL calc_server_version(char *some_version) +{ + uint major, minor, version; + char *point= some_version, *end_point; + major= (uint) strtoul(point, &end_point, 10); point=end_point+1; + minor= (uint) strtoul(point, &end_point, 10); point=end_point+1; + version= (uint) strtoul(point, &end_point, 10); + return (ulong) major * 10000L + (ulong)(minor * 100 + version); +} + /** Run a command using the shell, storing its output in the supplied dynamic string. @@ -584,7 +626,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res, if (my_write(fd, sql_log_bin, sizeof(sql_log_bin)-1, MYF(MY_FNABP | MY_WME))) { - my_close(fd, MYF(0)); + my_close(fd, MYF(MY_WME)); my_delete(query_file_path, MYF(0)); die("Failed to write to '%s'", query_file_path); } @@ -593,7 +635,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res, if (my_write(fd, (uchar*) query, strlen(query), MYF(MY_FNABP | MY_WME))) { - my_close(fd, MYF(0)); + my_close(fd, MYF(MY_WME)); my_delete(query_file_path, MYF(0)); die("Failed to write to '%s'", query_file_path); } @@ -604,13 +646,14 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res, "--database=mysql", "--batch", /* Turns off pager etc. */ force ? "--force": "--skip-force", + opt_verbose >= 5 ? "--verbose" : "", ds_res || opt_silent ? "--silent": "", "<", query_file_path, "2>&1", NULL); - my_close(fd, MYF(0)); + my_close(fd, MYF(MY_WME)); my_delete(query_file_path, MYF(0)); DBUG_RETURN(ret); @@ -657,6 +700,9 @@ static int get_upgrade_info_file_name(char* name) &ds_datadir, FALSE) || extract_variable_from_show(&ds_datadir, name)) { + print_error("Reading datadir from the MariaDB server failed. Got the " + "following error when executing the 'mysql' command line client", + &ds_datadir); dynstr_free(&ds_datadir); DBUG_RETURN(1); /* Query failed */ } @@ -668,6 +714,83 @@ static int get_upgrade_info_file_name(char* name) DBUG_RETURN(0); } +static char upgrade_info_file[FN_REFLEN]= {0}; + + +/* + Open or create mysql_upgrade_info file in servers data dir. + + Take a lock to ensure there cannot be any other mysql_upgrades + running concurrently +*/ + +const char *create_error_message= + "%sCould not open or create the upgrade info file '%s' in " + "the MariaDB Servers data directory, errno: %d (%s)\n"; + + + +static void open_mysql_upgrade_file() +{ + char errbuff[80]; + if (get_upgrade_info_file_name(upgrade_info_file)) + { + die("Upgrade failed"); + } + if ((info_file= my_create(upgrade_info_file, 0, + O_RDWR | O_NOFOLLOW, + MYF(0))) < 0) + { + if (opt_force >= 2) + { + fprintf(stdout, create_error_message, + "", upgrade_info_file, errno, + my_strerror(errbuff, sizeof(errbuff)-1, errno)); + fprintf(stdout, + "--force --force used, continuing without using the %s file.\n" + "Note that this means that there is no protection against " + "concurrent mysql_upgrade executions and next mysql_upgrade run " + "will do a full upgrade again!\n", + upgrade_info_file); + return; + } + fprintf(stdout, create_error_message, + "FATAL ERROR: ", + upgrade_info_file, errno, + my_strerror(errbuff, sizeof(errbuff)-1, errno)); + if (errno == EACCES) + { + fprintf(stderr, + "Note that mysql_upgrade should be run as the same user as the " + "MariaDB server binary, normally 'mysql' or 'root'.\n" + "Alternatively you can use mysql_upgrade --force --force. " + "Please check the documentation if you decide to use the force " + "option!\n"); + } + fflush(stderr); + die(0); + } + if (my_lock(info_file, F_WRLCK, 0, 1, MYF(0))) + { + die("Could not exclusively lock on file '%s'. Error %d: %s\n", + upgrade_info_file, my_errno, + my_strerror(errbuff, sizeof(errbuff)-1, my_errno)); + } +} + + +/** + Place holder for versions that require a major upgrade + + @return 0 upgrade has already been run on this version + @return 1 upgrade has to be run + +*/ + +static int faulty_server_versions(const char *version) +{ + return 0; +} /* Read the content of mysql_upgrade_info file and @@ -677,86 +800,110 @@ static int get_upgrade_info_file_name(char* name) NOTE This is an optimization to avoid running mysql_upgrade when it's already been performed for the particular - version of MySQL. + version of MariaDB. - In case the MySQL server can't return the upgrade info + In case the MariaDBL server can't return the upgrade info file it's always better to report that the upgrade hasn't been performed. + @return 0 Upgrade has already been run on this version + @return > 0 Upgrade has to be run */ -static int upgrade_already_done(myf flags) +static int upgrade_already_done(int silent) { - FILE *in; - char upgrade_info_file[FN_REFLEN]= {0}; - - if (get_upgrade_info_file_name(upgrade_info_file)) - return 0; /* Could not get filename => not sure */ - - if (!(in= my_fopen(upgrade_info_file, O_RDONLY, flags))) - return 0; /* Could not open file => not sure */ + const char *version = MYSQL_SERVER_VERSION; + const char *s; + char *pos; + my_off_t length; - bzero(upgrade_from_version, sizeof(upgrade_from_version)); - if (!fgets(upgrade_from_version, sizeof(upgrade_from_version), in)) + if (info_file < 0) { - /* Preserve errno for caller */ - int save_errno= errno; - (void) my_fclose(in, flags); - errno= save_errno; - return 0; + DBUG_ASSERT(opt_force > 1); + return 1; /* No info file and --force */ } - if (my_fclose(in, flags)) - return 0; - - errno= 0; - return (strncmp(upgrade_from_version, MYSQL_SERVER_VERSION, - sizeof(MYSQL_SERVER_VERSION)-1)==0); -} - + bzero(upgrade_from_version, sizeof(upgrade_from_version)); -/* - Write mysql_upgrade_info file in servers data dir indicating that - upgrade has been done for this version + (void) my_seek(info_file, 0, SEEK_SET, MYF(0)); + /* We have -3 here to make calc_server_version() safe */ + length= my_read(info_file, (uchar*) upgrade_from_version, + sizeof(upgrade_from_version)-3, + MYF(MY_WME)); - NOTE - This might very well fail but since it's just an optimization - to run mysql_upgrade only when necessary the error can be - ignored. + if (!length) + { + if (opt_verbose) + verbose("Empty or non existent %s. Assuming mysql_upgrade has to be run!", + upgrade_info_file); + return 1; + } -*/ + /* Remove possible \ŋ that may end in output */ + if ((pos= strchr(upgrade_from_version, '\n'))) + *pos= 0; -static void create_mysql_upgrade_info_file(void) -{ - FILE *out; - char upgrade_info_file[FN_REFLEN]= {0}; + if (faulty_server_versions(upgrade_from_version)) + { + if (opt_verbose) + verbose("Upgrading from version %s requires mysql_upgrade to be run!", + upgrade_from_version); + return 2; + } - if (get_upgrade_info_file_name(upgrade_info_file)) - return; /* Could not get filename => skip */ + s= strchr(version, '.'); + s= strchr(s + 1, '.'); - if (!(out= my_fopen(upgrade_info_file, O_TRUNC | O_WRONLY, MYF(0)))) + if (strncmp(upgrade_from_version, version, + (size_t)(s - version + 1))) { - fprintf(stderr, - "Could not create the upgrade info file '%s' in " - "the MariaDB Servers datadir, errno: %d\n", - upgrade_info_file, errno); - return; + if (calc_server_version(upgrade_from_version) <= MYSQL_VERSION_ID) + { + verbose("Major version upgrade detected from %s to %s. Check required!", + upgrade_from_version, version); + return 3; + } + die("Version mismatch (%s -> %s): Trying to downgrade from a higher to " + "lower version is not supported!", + upgrade_from_version, version); + } + if (!silent) + { + verbose("This installation of MariaDB is already upgraded to %s.\n" + "There is no need to run mysql_upgrade again for %s.", + upgrade_from_version, version); + if (!opt_check_upgrade) + verbose("You can use --force if you still want to run mysql_upgrade"); } + return 0; +} + +static void finish_mysql_upgrade_info_file(void) +{ + if (info_file < 0) + return; /* Write new version to file */ - my_fwrite(out, (uchar*) MYSQL_SERVER_VERSION, - sizeof(MYSQL_SERVER_VERSION), MY_WME); - my_fclose(out, MYF(MY_WME)); + (void) my_seek(info_file, 0, SEEK_CUR, MYF(0)); + (void) my_chsize(info_file, 0, 0, MYF(0)); + (void) my_seek(info_file, 0, 0, MYF(0)); + (void) my_write(info_file, (uchar*) MYSQL_SERVER_VERSION, + sizeof(MYSQL_SERVER_VERSION)-1, MYF(MY_WME)); + (void) my_write(info_file, (uchar*) "\n", 1, MYF(MY_WME)); + (void) my_lock(info_file, F_UNLCK, 0, 1, MYF(0)); /* - Check if the upgrad_info_file was properly created/updated + Check if the upgrade_info_file was properly created/updated It's not a fatal error -> just print a message if it fails */ - if (!upgrade_already_done(MY_WME)) + if (upgrade_already_done(1)) fprintf(stderr, - "Upgrade file '%s' was not properly created. " - "Got error errno while checking file content: %d\n", + "Could not write to the upgrade info file '%s' in " + "the MariaDB Servers datadir, errno: %d\n", upgrade_info_file, errno); + + my_close(info_file, MYF(MY_WME)); + info_file= -1; return; } @@ -794,7 +941,7 @@ static int run_mysqlcheck_upgrade(my_bool mysql_db_only) return 0; } verbose("Phase %d/%d: Checking and upgrading %s", ++phase, phases_total, what); - print_conn_args("mysqlcheck"); + print_conn_args("mariadb-check"); retch= run_tool(mysqlcheck_path, NULL, /* Send output from mysqlcheck directly to screen */ defaults_file, @@ -906,6 +1053,7 @@ static const char *expected_errors[]= "ERROR 1347", /* 'mysql.user' is not of type 'BASE TABLE' */ "ERROR 1348", /* Column 'Show_db_priv' is not updatable */ "ERROR 1356", /* definer of view lack rights (UPDATE) */ + "ERROR 1449", /* definer ('mariadb.sys'@'localhost') of mysql.user does not exist */ 0 }; @@ -1151,7 +1299,7 @@ static int check_slave_repositories(void) } /* - Update all system tables in MySQL Server to current + Update all system tables in MariaDB Server to current version using "mysql" to execute all the SQL commands compiled into the mysql_fix_privilege_tables array */ @@ -1187,9 +1335,7 @@ static int run_sql_fix_privilege_tables(void) dynstr_append(&ds_script, *query_ptr); } - run_query(ds_script.str, - &ds_result, /* Collect result */ - TRUE); + run_query(ds_script.str, (opt_verbose >= 5) ? NULL : &ds_result, TRUE); { /* @@ -1220,24 +1366,6 @@ static int run_sql_fix_privilege_tables(void) } -static void print_error(const char *error_msg, DYNAMIC_STRING *output) -{ - fprintf(stderr, "%s\n", error_msg); - fprintf(stderr, "%s", output->str); -} - - -/* Convert the specified version string into the numeric format. */ -static ulong STDCALL calc_server_version(char *some_version) -{ - uint major, minor, version; - char *point= some_version, *end_point; - major= (uint) strtoul(point, &end_point, 10); point=end_point+1; - minor= (uint) strtoul(point, &end_point, 10); point=end_point+1; - version= (uint) strtoul(point, &end_point, 10); - return (ulong) major * 10000L + (ulong)(minor * 100 + version); -} - /** Check if the server version matches with the server version mysql_upgrade was compiled with. @@ -1273,8 +1401,7 @@ static int check_version_match(void) "check.\n", version_str, MYSQL_SERVER_VERSION); return 1; } - else - return 0; + return 0; } @@ -1283,6 +1410,8 @@ int main(int argc, char **argv) char self_name[FN_REFLEN + 1]; MY_INIT(argv[0]); + DBUG_PROCESS(argv[0]); + load_defaults_or_exit("my", load_default_groups, &argc, &argv); defaults_argv= argv; /* Must be freed by 'free_defaults' */ @@ -1309,12 +1438,10 @@ int main(int argc, char **argv) { opt_password= get_tty_password(NullS); /* add password to defaults file */ - add_one_option_cnf_file(&ds_args, &my_long_options[PASSWORD_OPT], opt_password); - DBUG_ASSERT(strcmp(my_long_options[PASSWORD_OPT].name, "password") == 0); + add_one_option_cnf_file(&ds_args, "password", opt_password); } /* add user to defaults file */ - add_one_option_cnf_file(&ds_args, &my_long_options[USER_OPT], opt_user); - DBUG_ASSERT(strcmp(my_long_options[USER_OPT].name, "user") == 0); + add_one_option_cnf_file(&ds_args, "user", opt_user); cnf_file_path= strmov(defaults_file, "--defaults-file="); { @@ -1324,29 +1451,29 @@ int main(int argc, char **argv) die(NULL); my_write(fd, USTRING_WITH_LEN( "[client]\n"), MYF(MY_FAE)); my_write(fd, (uchar*)ds_args.str, ds_args.length, MYF(MY_FAE)); - my_close(fd, MYF(0)); + my_close(fd, MYF(MY_WME)); } /* Find mysql */ - find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name); + find_tool(mysql_path, IF_WIN("mariadb.exe", "mariadb"), self_name); + + open_mysql_upgrade_file(); + + if (opt_check_upgrade) + exit(upgrade_already_done(0) == 0); /* Find mysqlcheck */ - find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name); + find_tool(mysqlcheck_path, IF_WIN("mariadb-check.exe", "mariadb-check"), self_name); if (opt_systables_only && !opt_silent) printf("The --upgrade-system-tables option was used, user tables won't be touched.\n"); /* Read the mysql_upgrade_info file to check if mysql_upgrade - already has been run for this installation of MySQL + already has been run for this installation of MariaDB */ - if (!opt_force && upgrade_already_done(0)) - { - 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; - } + if (!opt_force && !upgrade_already_done(0)) + goto end; /* Upgrade already done */ if (opt_version_check && check_version_match()) die("Upgrade failed"); @@ -1373,12 +1500,13 @@ int main(int argc, char **argv) verbose("OK"); - /* Create a file indicating upgrade has been performed */ - create_mysql_upgrade_info_file(); + /* Finish writing indicating upgrade has been performed */ + finish_mysql_upgrade_info_file(); DBUG_ASSERT(phase == phases_total); end: + print_conn_args("mariadb-check"); free_used_memory(); my_end(my_end_arg); exit(0); diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index a7159d2bb6a85..3bba27b41035f 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ -/* maintaince of mysql databases */ +/* maintenance of mysql databases */ #include "client_priv.h" #include @@ -54,8 +54,6 @@ static bool sql_log_bin_off= false; static uint opt_protocol=0; static myf error_flags; /* flags to pass to my_printf_error, like ME_BELL */ -static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT; - /* When using extended-status relatively, ex_val_max_len is the estimated maximum length for any relative value printed by extended-status. The @@ -243,12 +241,9 @@ static const char *load_default_groups[]= 0 }; my_bool -get_one_option(const struct my_option *opt, const char *argument, const char *filename) +get_one_option(const struct my_option *opt, const char *argument, + const char *filename) { - - /* Track when protocol is set via CLI to not force overrides */ - static my_bool ignore_protocol_override = FALSE; - switch(opt->id) { case 'c': opt_count_iterations= 1; @@ -280,13 +275,6 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi case 'W': #ifdef _WIN32 opt_protocol = MYSQL_PROTOCOL_PIPE; - - /* Prioritize pipe if explicit via command line */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } #endif break; case '#': @@ -322,45 +310,19 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi sf_leaking_memory= 1; /* no memory leak reports here */ exit(1); } - - /* Specification of protocol via CLI trumps implicit overrides */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - break; case 'P': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* If port is set via CLI, try to force protocol to TCP */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = MYSQL_PROTOCOL_TCP; + /* Port given on command line, switch protocol to use TCP */ + opt_protocol= MYSQL_PROTOCOL_TCP; } break; case 'S': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == MYSQL_PROTOCOL_TCP) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* Prioritize socket if set via command line */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = SOCKET_PROTOCOL_TO_FORCE; + /* Socket given on command line, switch protocol to use SOCKETSt */ + opt_protocol= MYSQL_PROTOCOL_SOCKET; } break; } @@ -388,13 +350,6 @@ int main(int argc,char *argv[]) temp_argv= mask_password(argc, &argv); temp_argc= argc; - /* Command line options override configured protocol */ - if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT - && protocol_to_force != opt_protocol) - { - warn_protocol_override(host, &opt_protocol, protocol_to_force); - } - if (debug_info_flag) my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO; if (debug_check_flag) @@ -1600,7 +1555,8 @@ static void print_relative_row_vert(MYSQL_RES *result __attribute__((unused)), llstr((tmp - last_values[row]), buff)); /* Find the minimum row length needed to output the relative value */ - if ((length=(uint) strlen(buff) > ex_val_max_len[row]) && ex_status_printed) + length=(uint) strlen(buff); + if (length > ex_val_max_len[row] && ex_status_printed) ex_val_max_len[row] = length; last_values[row] = tmp; } diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 3d9b9712ec8e5..4808090aaf2aa 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -98,8 +98,6 @@ static const char *output_prefix= ""; static char **defaults_argv= 0; static MEM_ROOT glob_root; -static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT; - #ifndef DBUG_OFF static const char *default_dbug_option = "d:t:o,/tmp/mariadb-binlog.trace"; const char *current_dbug_option= default_dbug_option; @@ -128,6 +126,7 @@ static my_bool print_row_count_used= 0, print_row_event_positions_used= 0; static my_bool debug_info_flag, debug_check_flag; static my_bool force_if_open_opt= 1; static my_bool opt_raw_mode= 0, opt_stop_never= 0; +my_bool opt_gtid_strict_mode= true; static ulong opt_stop_never_slave_server_id= 0; static my_bool opt_verify_binlog_checksum= 1; static ulonglong offset = 0; @@ -143,10 +142,15 @@ static char *charset= 0; static uint verbose= 0; -static ulonglong start_position, stop_position; +static char *start_pos_str, *stop_pos_str; +static ulonglong start_position= BIN_LOG_HEADER_SIZE, + stop_position= (longlong)(~(my_off_t)0) ; #define start_position_mot ((my_off_t)start_position) #define stop_position_mot ((my_off_t)stop_position) +static Binlog_gtid_state_validator *gtid_state_validator= NULL; +static Domain_gtid_event_filter *domain_gtid_filter= NULL; + static char *start_datetime_str, *stop_datetime_str; static my_time_t start_datetime= 0, stop_datetime= MY_TIME_T_MAX; static ulonglong rec_count= 0; @@ -185,7 +189,7 @@ enum Exit_status { /** Pointer to the last read Annotate_rows_log_event. Having read an - Annotate_rows event, we should not print it immediatedly because all + Annotate_rows event, we should not print it immediately because all subsequent rbr events can be filtered away, and have to keep it for a while. Also because of that when reading a remote Annotate event we have to keep its binary log representation in a separately allocated buffer. @@ -314,8 +318,8 @@ class Load_log_processor } public: - Load_log_processor() {} - ~Load_log_processor() {} + Load_log_processor() = default; + ~Load_log_processor() = default; int init() { @@ -981,6 +985,10 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, return result; } +static inline my_bool is_gtid_filtering_enabled() +{ + return domain_gtid_filter != NULL; +} /** Print the given event, and either delete it or delegate the deletion @@ -1008,16 +1016,143 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, char ll_buff[21]; Log_event_type ev_type= ev->get_type_code(); my_bool destroy_evt= TRUE; + my_bool gtid_err= FALSE; DBUG_ENTER("process_event"); Exit_status retval= OK_CONTINUE; IO_CACHE *const head= &print_event_info->head_cache; + /* + We use Gtid_list_log_event information to determine if there is missing + data between where a user expects events to start/stop (i.e. the GTIDs + provided by --start-position and --stop-position), and the true start of + the specified binary logs. The first GLLE provides the initial state of the + binary logs. + + If --start-position is provided as a file offset, we want to skip initial + GTID state verification + */ + static my_bool was_first_glle_processed= start_position > BIN_LOG_HEADER_SIZE; + /* Bypass flashback settings to event */ ev->is_flashback= opt_flashback; #ifdef WHEN_FLASHBACK_REVIEW_READY ev->need_flashback_review= opt_flashback_review; #endif + /* + Run time estimation of the output window configuration. + + Do not validate GLLE information is start position is provided as a file + offset. + */ + if (ev_type == GTID_LIST_EVENT && ev->when) + { + Gtid_list_log_event *glev= (Gtid_list_log_event *)ev; + + /* + If this is the first Gtid_list_log_event, initialize the state of the + GTID stream auditor to be consistent with the binary logs provided + */ + if (gtid_state_validator && !was_first_glle_processed && glev->count) + { + if (gtid_state_validator->initialize_gtid_state(stderr, glev->list, + glev->count)) + goto err; + + if (domain_gtid_filter && !domain_gtid_filter->get_num_start_gtids()) + { + /* + We need to validate the GTID list from --stop-position because we + couldn't prove it intrinsically (i.e. using stop > start) + */ + rpl_gtid *stop_gtids= domain_gtid_filter->get_stop_gtids(); + size_t n_stop_gtids= domain_gtid_filter->get_num_stop_gtids(); + if (gtid_state_validator->verify_stop_state(stderr, stop_gtids, + n_stop_gtids)) + { + my_free(stop_gtids); + goto err; + } + my_free(stop_gtids); + } + } + + /* + Verify that we are able to process events from this binlog. For example, + if our current GTID state is behind the state of the GLLE in the new log, + a user may have accidentally left out a log file to process. + */ + if (gtid_state_validator && verbose >= 3) + for (size_t k= 0; k < glev->count; k++) + gtid_state_validator->verify_gtid_state(stderr, &(glev->list[k])); + + was_first_glle_processed= TRUE; + } + + if (ev_type == GTID_EVENT) + { + rpl_gtid ev_gtid; + Gtid_log_event *gle= (Gtid_log_event*) ev; + ev_gtid= {gle->domain_id, gle->server_id, gle->seq_no}; + + /* + If the binlog output should be filtered using GTIDs, test the new event + group to see if its events should be ignored. + */ + if (domain_gtid_filter) + { + if (domain_gtid_filter->has_finished()) + { + retval= OK_STOP; + goto end; + } + + if (!domain_gtid_filter->exclude(&ev_gtid)) + print_event_info->activate_current_event_group(); + else + print_event_info->deactivate_current_event_group(); + } + + /* + Where we always ensure the initial binlog state is valid, we only + continually monitor the GTID stream for validity if we are in GTID + strict mode (for errors) or if three levels of verbosity is provided + (for warnings). + + If we don't care about ensuring GTID validity, just delete the auditor + object to disable it for future checks. + */ + if (gtid_state_validator) + { + if (!(opt_gtid_strict_mode || verbose >= 3)) + { + delete gtid_state_validator; + + /* + Explicitly reset to NULL to simplify checks on if auditing is enabled + i.e. if it is defined, assume we want to use it + */ + gtid_state_validator= NULL; + } + else + { + gtid_err= gtid_state_validator->record(&ev_gtid); + if (gtid_err && opt_gtid_strict_mode) + { + gtid_state_validator->report(stderr, opt_gtid_strict_mode); + goto err; + } + } + } + } + + /* + If the GTID is ignored, it shouldn't count towards offset (rec_count should + not be incremented) + */ + if (!print_event_info->is_event_group_active()) + goto end_skip_count; + /* Format events are not concerned by --offset and such, we always need to read them to be able to process the wanted events. @@ -1458,6 +1593,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, retval= ERROR_STOP; end: rec_count++; +end_skip_count: DBUG_PRINT("info", ("end event processing")); /* @@ -1658,15 +1794,22 @@ static struct my_option my_options[] = &start_datetime_str, &start_datetime_str, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"start-position", 'j', - "Start reading the binlog at position N. Applies to the first binlog " - "passed on the command line.", - &start_position, &start_position, 0, GET_ULL, - REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE, - /* - COM_BINLOG_DUMP accepts only 4 bytes for the position - so remote log reading has lower limit. - */ - (ulonglong)(0xffffffffffffffffULL), 0, 0, 0}, + "Start reading the binlog at this position. Type can either be a positive " + "integer or a GTID list. When using a positive integer, the value only " + "applies to the first binlog passed on the command line. In GTID mode, " + "multiple GTIDs can be passed as a comma separated list, where each must " + "have a unique domain id. The list represents the gtid binlog state that " + "the client (another \"replica\" server) is aware of. Therefore, each GTID " + "is exclusive; only events after a given sequence number will be printed to " + "allow users to receive events after their current state.", + &start_pos_str, &start_pos_str, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, + 0, 0, 0}, + {"gtid-strict-mode", 0, "Process binlog according to gtid-strict-mode " + "specification. The start, stop positions are verified to satisfy " + "start < stop comparison condition. Sequence numbers of any gtid domain " + "must comprise monotically growing sequence", + &opt_gtid_strict_mode, &opt_gtid_strict_mode, 0, + GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"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 " @@ -1684,11 +1827,14 @@ static struct my_option my_options[] = &opt_stop_never_slave_server_id, &opt_stop_never_slave_server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"stop-position", OPT_STOP_POSITION, - "Stop reading the binlog at position N. Applies to the last binlog " - "passed on the command line.", - &stop_position, &stop_position, 0, GET_ULL, - REQUIRED_ARG, (longlong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE, - (ulonglong)(~(my_off_t)0), 0, 0, 0}, + "Stop reading the binlog at this position. Type can either be a positive " + "integer or a GTID list. When using a positive integer, the value only " + "applies to the last binlog passed on the command line. In GTID mode, " + "multiple GTIDs can be passed as a comma separated list, where each must " + "have a unique domain id. Each GTID is inclusive; only events up to the " + "given sequence numbers are printed.", + &stop_pos_str, &stop_pos_str, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, + 0, 0}, {"table", 'T', "List entries for just this table (local log only).", &table, &table, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1702,7 +1848,9 @@ that may lead to an endless loop.", &user, &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"verbose", 'v', "Reconstruct SQL statements out of row events. " - "-v -v adds comments on column data types.", + "-v -v adds comments on column data types. " + "-v -v -v adds diagnostic warnings about event " + "integrity before program exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -1725,7 +1873,7 @@ that may lead to an endless loop.", &opt_binlog_rows_event_max_encoded_size, 0, GET_ULONG, REQUIRED_ARG, UINT_MAX/4, 256, ULONG_MAX, 0, 256, 0}, #endif - {"verify-binlog-checksum", 'c', "Verify checksum binlog events.", + {"verify-binlog-checksum", 'c', "Verify binlog event checksums.", (uchar**) &opt_verify_binlog_checksum, (uchar**) &opt_verify_binlog_checksum, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"rewrite-db", OPT_REWRITE_DB, @@ -1824,8 +1972,14 @@ static void cleanup() my_free(const_cast(dirname_for_local_load)); my_free(start_datetime_str); my_free(stop_datetime_str); + my_free(start_pos_str); + my_free(stop_pos_str); free_root(&glob_root, MYF(0)); + delete domain_gtid_filter; + if (gtid_state_validator) + delete gtid_state_validator; + delete binlog_filter; delete glob_description_event; if (mysql) @@ -1835,15 +1989,20 @@ static void cleanup() my_free_open_file_info(); load_processor.destroy(); mysql_server_end(); + if (opt_flashback) + { + delete_dynamic(&binlog_events); + delete_dynamic(&events_in_stmt); + } DBUG_VOID_RETURN; } -static void die() +static void die(int err) { cleanup(); my_end(MY_DONT_FREE_DBUG); - exit(1); + exit(err); } @@ -1880,7 +2039,7 @@ static my_time_t convert_str_to_timestamp(const char* str) l_time.time_type != MYSQL_TIMESTAMP_DATETIME || status.warnings) { error("Incorrect date and time argument: %s", str); - die(); + die(1); } /* Note that Feb 30th, Apr 31st cause no error messages and are mapped to @@ -1893,13 +2052,11 @@ static my_time_t convert_str_to_timestamp(const char* str) extern "C" my_bool -get_one_option(const struct my_option *opt, const char *argument, const char *filename) +get_one_option(const struct my_option *opt, const char *argument, + const char *filename) { bool tty_password=0; - /* Track when protocol is set via CLI to not force overrides */ - static my_bool ignore_protocol_override = FALSE; - switch (opt->id) { #ifndef DBUG_OFF case '#': @@ -1947,16 +2104,8 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi opt->name)) <= 0) { sf_leaking_memory= 1; /* no memory leak reports here */ - die(); + die(1); } - - /* Specification of protocol via CLI trumps implicit overrides */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - break; #ifdef WHEN_FLASHBACK_REVIEW_READY case opt_flashback_review: @@ -1976,7 +2125,7 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi opt->name)) <= 0) { sf_leaking_memory= 1; /* no memory leak reports here */ - die(); + die(1); } opt_base64_output_mode= (enum_base64_output_mode)(val - 1); break; @@ -2034,35 +2183,17 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi print_row_event_positions_used= 1; break; case 'P': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* If port is set via CLI, try to force protocol to TCP */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = MYSQL_PROTOCOL_TCP; + /* Port given on command line, switch protocol to use TCP */ + opt_protocol= MYSQL_PROTOCOL_TCP; } break; case 'S': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == MYSQL_PROTOCOL_TCP) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* Prioritize socket if set via command line */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = SOCKET_PROTOCOL_TO_FORCE; + /* Socket given on command line, switch protocol to use SOCKETSt */ + opt_protocol= MYSQL_PROTOCOL_SOCKET; } break; case 'v': @@ -2075,6 +2206,110 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi print_version(); opt_version= 1; break; + case OPT_STOP_POSITION: + { + /* Stop position was already specified, so reset it and use the new list */ + if (domain_gtid_filter && domain_gtid_filter->get_num_stop_gtids() > 0) + domain_gtid_filter->clear_stop_gtids(); + + uint32 n_stop_gtid_ranges= 0; + rpl_gtid *stop_gtids= gtid_parse_string_to_list( + stop_pos_str, strlen(stop_pos_str), &n_stop_gtid_ranges); + if (stop_gtids == NULL) + { + int err= 0; + char *end_ptr= NULL; + /* + No GTIDs specified in OPT_STOP_POSITION specification. Treat the value + as a singular index. + */ + stop_position= my_strtoll10(stop_pos_str, &end_ptr, &err); + + if (err || *end_ptr) + { + // Can't parse the position from the user + sql_print_error("Stop position argument value is invalid. Should be " + "either a positive integer or GTID."); + return 1; + } + } + else if (n_stop_gtid_ranges > 0) + { + uint32 gtid_idx; + + if (domain_gtid_filter == NULL) + domain_gtid_filter= new Domain_gtid_event_filter(); + + for (gtid_idx = 0; gtid_idx < n_stop_gtid_ranges; gtid_idx++) + { + rpl_gtid *stop_gtid= &stop_gtids[gtid_idx]; + if (domain_gtid_filter->add_stop_gtid(stop_gtid)) + { + my_free(stop_gtids); + return 1; + } + } + my_free(stop_gtids); + } + else + { + DBUG_ASSERT(0); + } + break; + } + case 'j': + { + /* Start position was already specified, so reset it and use the new list */ + if (domain_gtid_filter && domain_gtid_filter->get_num_start_gtids() > 0) + domain_gtid_filter->clear_start_gtids(); + + uint32 n_start_gtid_ranges= 0; + rpl_gtid *start_gtids= gtid_parse_string_to_list( + start_pos_str, strlen(start_pos_str), &n_start_gtid_ranges); + + if (start_gtids == NULL) + { + int err= 0; + char *end_ptr= NULL; + /* + No GTIDs specified in OPT_START_POSITION specification. Treat the value + as a singular index. + */ + start_position= my_strtoll10(start_pos_str, &end_ptr, &err); + + if (err || *end_ptr) + { + // Can't parse the position from the user + sql_print_error("Start position argument value is invalid. Should be " + "either a positive integer or GTID."); + return 1; + } + } + else if (n_start_gtid_ranges > 0) + { + uint32 gtid_idx; + + if (domain_gtid_filter == NULL) + domain_gtid_filter= new Domain_gtid_event_filter(); + + for (gtid_idx = 0; gtid_idx < n_start_gtid_ranges; gtid_idx++) + { + rpl_gtid *start_gtid= &start_gtids[gtid_idx]; + if (start_gtid->seq_no && + domain_gtid_filter->add_start_gtid(start_gtid)) + { + my_free(start_gtids); + return 1; + } + } + my_free(start_gtids); + } + else + { + DBUG_ASSERT(0); + } + break; + } case '?': usage(); opt_version= 1; @@ -2093,7 +2328,7 @@ static int parse_args(int *argc, char*** argv) if ((ho_error=handle_options(argc, argv, my_options, get_one_option))) { - die(); + die(ho_error); } if (debug_info_flag) my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO; @@ -2107,6 +2342,37 @@ static int parse_args(int *argc, char*** argv) start_position); start_position= UINT_MAX32; } + + /* + Always initialize the stream auditor initially because it is used to check + the initial state of the binary log is correct. If we don't want it later + (i.e. --skip-gtid-strict-mode or -vvv is not given), it is deleted when we + are certain the initial gtid state is set. + */ + gtid_state_validator= new Binlog_gtid_state_validator(); + + if (domain_gtid_filter) + { + if (opt_gtid_strict_mode && domain_gtid_filter->validate_window_filters()) + { + /* + In strict mode, if any --start/stop-position GTID ranges are invalid, + quit in error. Note that any specific error messages will have + already been written. + */ + die(1); + } + + /* + GTIDs before a start position shouldn't be validated, so we initialize + the stream auditor to only monitor GTIDs after these positions. + */ + size_t n_start_gtids= domain_gtid_filter->get_num_start_gtids(); + rpl_gtid *start_gtids= domain_gtid_filter->get_start_gtids(); + gtid_state_validator->initialize_start_gtids(start_gtids, n_start_gtids); + my_free(start_gtids); + } + return 0; } @@ -2187,6 +2453,9 @@ static Exit_status dump_log_entries(const char* logname) if (!print_event_info.init_ok()) return ERROR_STOP; + + if (domain_gtid_filter) + print_event_info.enable_event_group_filtering(); /* Set safe delimiter, to dump things like CREATE PROCEDURE safely @@ -2288,6 +2557,40 @@ static Exit_status check_master_version() goto err; } + if (domain_gtid_filter && domain_gtid_filter->get_num_start_gtids() > 0) + { + char str_buf[256]; + String query_str(str_buf, sizeof(str_buf), system_charset_info); + query_str.length(0); + query_str.append(STRING_WITH_LEN("SET @slave_connect_state='"), + system_charset_info); + + size_t n_start_gtids= domain_gtid_filter->get_num_start_gtids(); + rpl_gtid *start_gtids= domain_gtid_filter->get_start_gtids(); + + for (size_t gtid_idx = 0; gtid_idx < n_start_gtids; gtid_idx++) + { + char buf[256]; + rpl_gtid *start_gtid= &start_gtids[gtid_idx]; + + sprintf(buf, "%u-%u-%llu", + start_gtid->domain_id, start_gtid->server_id, + start_gtid->seq_no); + query_str.append(buf, strlen(buf)); + if (gtid_idx < n_start_gtids - 1) + query_str.append(','); + } + my_free(start_gtids); + + query_str.append(STRING_WITH_LEN("'"), system_charset_info); + if (unlikely(mysql_real_query(mysql, query_str.ptr(), query_str.length()))) + { + error("Setting @slave_connect_state failed with error: %s", + mysql_error(mysql)); + goto err; + } + } + delete glob_description_event; glob_description_event= NULL; @@ -2565,6 +2868,7 @@ static Exit_status handle_event_raw_mode(PRINT_EVENT_INFO *print_event_info, error("Could not write into log file '%s'", out_file_name); DBUG_RETURN(ERROR_STOP); } + fflush(result_file); DBUG_RETURN(OK_CONTINUE); } @@ -3037,13 +3341,6 @@ int main(int argc, char** argv) parse_args(&argc, (char***)&argv); - /* Command line options override configured protocol */ - if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT - && protocol_to_force != opt_protocol) - { - warn_protocol_override(host, &opt_protocol, protocol_to_force); - } - if (!argc || opt_version) { if (!opt_version) @@ -3059,6 +3356,12 @@ int main(int argc, char** argv) my_set_max_open_files(open_files_limit); + if (opt_flashback && opt_raw_mode) + { + error("The --raw mode is not allowed with --flashback mode"); + die(1); + } + if (opt_flashback) { my_init_dynamic_array(PSI_NOT_INSTRUMENTED, &binlog_events, @@ -3074,7 +3377,7 @@ int main(int argc, char** argv) if (!remote_opt) { error("The --raw mode only works with --read-from-remote-server"); - die(); + die(1); } if (one_database) warning("The --database option is ignored in raw mode"); @@ -3096,7 +3399,7 @@ int main(int argc, char** argv) O_WRONLY | O_BINARY, MYF(MY_WME)))) { error("Could not create log file '%s'", result_file_name); - die(); + die(1); } } else @@ -3185,7 +3488,7 @@ int main(int argc, char** argv) /* Set delimiter back to semicolon */ if (retval != ERROR_STOP) { - if (!stop_event_string.is_empty()) + if (!stop_event_string.is_empty() && result_file) fprintf(result_file, "%s", stop_event_string.ptr()); if (!opt_raw_mode && opt_flashback) fprintf(result_file, "DELIMITER ;\n"); @@ -3208,14 +3511,33 @@ int main(int argc, char** argv) "/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n" "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n" "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n"); - fprintf(result_file, "/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;\n"); + + if (is_gtid_filtering_enabled()) + { + fprintf(result_file, + "/*!100001 SET @@SESSION.SERVER_ID=@@GLOBAL.SERVER_ID */;\n" + "/*!100001 SET @@SESSION.GTID_DOMAIN_ID=@@GLOBAL.GTID_DOMAIN_ID " + "*/;\n"); + } } if (tmpdir.list) free_tmpdir(&tmpdir); if (result_file && result_file != stdout) my_fclose(result_file, MYF(0)); + + /* + Ensure the GTID state is correct. If not, end in error. + + Note that in gtid strict mode, we will not report here if any invalid GTIDs + are processed because it immediately errors (i.e. retval will be + ERROR_STOP) + */ + if (retval != ERROR_STOP && gtid_state_validator && + gtid_state_validator->report(stderr, opt_gtid_strict_mode)) + retval= ERROR_STOP; + cleanup(); /* We cannot free DBUG, it is used in global destructors after exit(). */ my_end(my_end_arg | MY_DONT_FREE_DBUG); @@ -3271,3 +3593,4 @@ struct encryption_service_st encryption_handler= #include "sql_list.cc" #include "rpl_filter.cc" #include "compat56.cc" +#include "rpl_gtid.cc" diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index eb063765a3797..088be65417bbf 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2017, MariaDB + Copyright (c) 2010, 2012, 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 @@ -57,8 +57,6 @@ DYNAMIC_ARRAY tables4repair, tables4rebuild, alter_table_cmds; DYNAMIC_ARRAY views4repair; static uint opt_protocol=0; -static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT; - enum operations { DO_CHECK=1, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_FIX_NAMES }; const char *operation_name[]= { @@ -291,10 +289,6 @@ get_one_option(const struct my_option *opt, const char *filename) { int orig_what_to_do= what_to_do; - - /* Track when protocol is set via CLI to not force overrides */ - static my_bool ignore_protocol_override = FALSE; - DBUG_ENTER("get_one_option"); switch(opt->id) { @@ -357,13 +351,6 @@ get_one_option(const struct my_option *opt, case 'W': #ifdef _WIN32 opt_protocol = MYSQL_PROTOCOL_PIPE; - - /* Prioritize pipe if explicit via command line */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } #endif break; case '#': @@ -387,45 +374,19 @@ get_one_option(const struct my_option *opt, sf_leaking_memory= 1; /* no memory leak reports here */ exit(1); } - - /* Specification of protocol via CLI trumps implicit overrides */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - break; case 'P': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* If port is set via CLI, try to force protocol to TCP */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = MYSQL_PROTOCOL_TCP; + /* Port given on command line, switch protocol to use TCP */ + opt_protocol= MYSQL_PROTOCOL_TCP; } break; case 'S': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == MYSQL_PROTOCOL_TCP) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* Prioritize socket if set via command line */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = SOCKET_PROTOCOL_TO_FORCE; + /* Socket given on command line, switch protocol to use SOCKETSt */ + opt_protocol= MYSQL_PROTOCOL_SOCKET; } break; } @@ -974,7 +935,7 @@ static int handle_request_for_tables(char *tables, size_t length, case DO_ANALYZE: if (view) { - printf("%-50s %s\n", tables, "Can't run anaylyze on a view"); + printf("%-50s %s\n", tables, "Can't run analyze on a view"); DBUG_RETURN(1); } DBUG_ASSERT(!view); @@ -1002,6 +963,7 @@ static int handle_request_for_tables(char *tables, size_t length, DBUG_RETURN(1); if (dont_quote) { + DBUG_ASSERT(op); DBUG_ASSERT(strlen(op)+strlen(tables)+strlen(options)+8+1 <= query_size); /* No backticks here as we added them before */ @@ -1061,7 +1023,6 @@ static void print_result() char prev[(NAME_LEN+9)*3+2]; char prev_alter[MAX_ALTER_STR_SIZE]; size_t length_of_db= strlen(sock->db); - uint i; my_bool found_error=0, table_rebuild=0; DYNAMIC_ARRAY *array4repair= &tables4repair; DBUG_ENTER("print_result"); @@ -1070,7 +1031,7 @@ static void print_result() prev[0] = '\0'; prev_alter[0]= 0; - for (i = 0; (row = mysql_fetch_row(res)); i++) + while ((row = mysql_fetch_row(res))) { int changed = strcmp(prev, row[0]); my_bool status = !strcmp(row[2], "status"); @@ -1166,7 +1127,10 @@ static int dbConnect(char *host, char *user, char *passwd) opt_ssl_capath, opt_ssl_cipher); mysql_options(&mysql_connection, MYSQL_OPT_SSL_CRL, opt_ssl_crl); mysql_options(&mysql_connection, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + mysql_options(&mysql_connection, MARIADB_OPT_TLS_VERSION, opt_tls_version); } + mysql_options(&mysql_connection, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, + (char*)&opt_ssl_verify_server_cert); #endif if (opt_protocol) mysql_options(&mysql_connection,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); @@ -1246,14 +1210,6 @@ int main(int argc, char **argv) if (get_options(&argc, &argv)) goto end1; - - /* Command line options override configured protocol */ - if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT - && protocol_to_force != opt_protocol) - { - warn_protocol_override(current_host, &opt_protocol, protocol_to_force); - } - sf_leaking_memory=0; /* from now on we cleanup properly */ ret= EX_MYSQLERR; diff --git a/client/mysqldump.c b/client/mysqldump.c index a73f06d592ab3..52c1dc94537f6 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -148,6 +148,7 @@ static ulonglong opt_system= 0ULL; static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0, select_field_names_inited= 0; static ulong opt_max_allowed_packet, opt_net_buffer_length; +static double opt_max_statement_time= 0.0; static MYSQL mysql_connection,*mysql=0; static DYNAMIC_STRING insert_pat, select_field_names; static char *opt_password=0,*current_user=0, @@ -164,6 +165,7 @@ static my_bool server_supports_switching_charsets= TRUE; static ulong opt_compatible_mode= 0; #define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1 #define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2 +#define MYSQL_OPT_MAX_STATEMENT_TIME 0 #define MYSQL_OPT_SLAVE_DATA_EFFECTIVE_SQL 1 #define MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL 2 static uint opt_mysql_port= 0, opt_master_data; @@ -192,12 +194,10 @@ FILE *stderror_file=0; static uint opt_protocol= 0; static char *opt_plugin_dir= 0, *opt_default_auth= 0; -static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT; - /* -Dynamic_string wrapper functions. In this file use these -wrappers, they will terminate the process if there is -an allocation failure. + Dynamic_string wrapper functions. In this file use these + wrappers, they will terminate the process if there is + an allocation failure. */ static void init_dynamic_string_checked(DYNAMIC_STRING *str, const char *init_str, size_t init_alloc, size_t alloc_increment); @@ -279,7 +279,9 @@ static struct my_option my_long_options[] = &opt_slave_apply, &opt_slave_apply, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"as-of", OPT_ASOF_TIMESTAMP, - "Dump system versioned table as of specified timestamp.", + "Dump system versioned table(s) as of specified timestamp. " + "Argument is interpreted according to the --tz-utc setting. " + "Table structures are always dumped as of current timestamp.", &opt_asof_timestamp, &opt_asof_timestamp, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR, "Directory for character set files.", (char **)&charsets_dir, @@ -473,6 +475,10 @@ static struct my_option my_long_options[] = &opt_max_allowed_packet, &opt_max_allowed_packet, 0, GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096, (longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0}, + {"max-statement-time", MYSQL_OPT_MAX_STATEMENT_TIME, + "Max statement execution time. If unset, overrides server default with 0.", + &opt_max_statement_time, &opt_max_statement_time, 0, GET_DOUBLE, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"net_buffer_length", OPT_NET_BUFFER_LENGTH, "The buffer size for TCP/IP and socket communication.", &opt_net_buffer_length, &opt_net_buffer_length, 0, @@ -577,7 +583,8 @@ static struct my_option my_long_options[] = &opt_dump_triggers, &opt_dump_triggers, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"tz-utc", OPT_TZ_UTC, - "SET TIME_ZONE='+00:00' at top of dump to allow dumping of TIMESTAMP data when a server has data in different time zones or data is being moved between servers with different time zones.", + "Set connection time zone to UTC before commencing the dump and add " + "SET TIME_ZONE=´+00:00´ to the top of the dump file.", &opt_tz_utc, &opt_tz_utc, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, #ifndef DONT_ALLOW_USER_CHANGE {"user", 'u', "User for login if not current user.", @@ -868,9 +875,6 @@ get_one_option(const struct my_option *opt, const char *filename) { - /* Track when protocol is set via CLI to not force overrides */ - static my_bool ignore_protocol_override = FALSE; - switch (opt->id) { case 'p': if (argument == disabled_my_option) @@ -901,13 +905,6 @@ get_one_option(const struct my_option *opt, case 'W': #ifdef _WIN32 opt_protocol= MYSQL_PROTOCOL_PIPE; - - /* Prioritize pipe if explicit via command line */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } #endif break; case 'N': @@ -1058,49 +1055,23 @@ get_one_option(const struct my_option *opt, sf_leaking_memory= 1; /* no memory leak reports here */ exit(1); } - - /* Specification of protocol via CLI trumps implicit overrides */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - break; case (int) OPT_DEFAULT_CHARSET: if (default_charset == disabled_my_option) default_charset= (char *)mysql_universal_client_charset; break; case 'P': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* If port is set via CLI, try to force protocol to TCP */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = MYSQL_PROTOCOL_TCP; + /* Port given on command line, switch protocol to use TCP */ + opt_protocol= MYSQL_PROTOCOL_TCP; } break; case 'S': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == MYSQL_PROTOCOL_TCP) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* Prioritize socket if set via command line */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = SOCKET_PROTOCOL_TO_FORCE; + /* Socket given on command line, switch protocol to use SOCKETSt */ + opt_protocol= MYSQL_PROTOCOL_SOCKET; } break; } @@ -1149,19 +1120,9 @@ static int get_options(int *argc, char ***argv) return(ho_error); /* - Command line options override configured protocol - */ - if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT - && protocol_to_force != opt_protocol) - { - warn_protocol_override(current_host, &opt_protocol, protocol_to_force); - } - - - /* - Dumping under --system=stats with --replace or --inser-ignore is safe and will not - retult into race condition. Otherwise dump only structure and ignore data by default - while dumping. + Dumping under --system=stats with --replace or --insert-ignore is + safe and will not result into race condition. Otherwise dump only + structure and ignore data by default while dumping. */ if (!(opt_system & OPT_SYSTEM_STATS) && !(opt_ignore || opt_replace_into)) { @@ -2585,7 +2546,7 @@ static uint dump_events_for_db(char *db) if (mysql_query_with_error_report(mysql, &event_list_res, "show events")) DBUG_RETURN(0); - strcpy(delimiter, ";"); + safe_strcpy(delimiter, sizeof(delimiter), ";"); if (mysql_num_rows(event_list_res) > 0) { if (opt_xml) @@ -2597,7 +2558,10 @@ static uint dump_events_for_db(char *db) /* Get database collation. */ if (fetch_db_collation(db_name_buff, db_cl_name, sizeof (db_cl_name))) + { + mysql_free_result(event_list_res); DBUG_RETURN(1); + } } if (switch_character_set_results(mysql, "binary")) @@ -2870,6 +2834,9 @@ static uint dump_routines_for_db(char *db) create_caption_xml[i]); continue; } + + switch_sql_mode(sql_file, ";", row[1]); + if (opt_drop) fprintf(sql_file, "/*!50003 DROP %s IF EXISTS %s */;\n", routine_type[i], routine_name); @@ -2909,9 +2876,6 @@ static uint dump_routines_for_db(char *db) "--\n"); } - - switch_sql_mode(sql_file, ";", row[1]); - fprintf(sql_file, "DELIMITER ;;\n" "%s ;;\n" @@ -2971,7 +2935,7 @@ static inline my_bool general_log_or_slow_log_tables(const char *db, !my_strcasecmp(charset_info, table, "transaction_registry")); } /* - get_sequence_structure-- retrievs sequence structure, prints out corresponding + get_sequence_structure-- retrieves sequence structure, prints out corresponding CREATE statement ARGS seq - sequence name @@ -3033,7 +2997,7 @@ static void get_sequence_structure(const char *seq, const char *db) DBUG_VOID_RETURN; } /* - get_table_structure -- retrievs database structure, prints out corresponding + get_table_structure -- retrieves database structure, prints out corresponding CREATE statement and fills out insert_pat if the table is the type we will be dumping. @@ -3206,9 +3170,8 @@ static uint get_table_structure(const char *table, const char *db, char *table_t if (strcmp(field->name, "View") == 0) { char *scv_buff= NULL; - my_ulonglong n_cols; - verbose_msg("-- It's a view, create dummy table for view\n"); + verbose_msg("-- It's a view, create dummy view for view\n"); /* save "show create" statement for later */ if ((row= mysql_fetch_row(result)) && (scv_buff=row[1])) @@ -3217,9 +3180,9 @@ static uint get_table_structure(const char *table, const char *db, char *table_t mysql_free_result(result); /* - Create a table with the same name as the view and with columns of + Create a view with the same name as the view and with columns of the same name in order to satisfy views that depend on this view. - The table will be removed when the actual view is created. + The view will be removed when the actual view is created. The properties of each column, are not preserved in this temporary table, because they are not necessary. @@ -3251,23 +3214,9 @@ static uint get_table_structure(const char *table, const char *db, char *table_t else my_free(scv_buff); - n_cols= mysql_num_rows(result); - if (0 != n_cols) + if (mysql_num_rows(result) != 0) { - /* - The actual formula is based on the column names and how the .FRM - files are stored and is too volatile to be repeated here. - Thus we simply warn the user if the columns exceed a limit we - know works most of the time. - */ - if (n_cols >= 1000) - fprintf(stderr, - "-- Warning: Creating a stand-in table for view %s may" - " fail when replaying the dump file produced because " - "of the number of columns exceeding 1000. Exercise " - "caution when replaying the produced dump file.\n", - table); if (opt_drop) { /* @@ -3283,7 +3232,7 @@ static uint get_table_structure(const char *table, const char *db, char *table_t fprintf(sql_file, "SET @saved_cs_client = @@character_set_client;\n" "SET character_set_client = utf8;\n" - "/*!50001 CREATE TABLE %s (\n", + "/*!50001 CREATE VIEW %s AS SELECT\n", result_table); /* @@ -3295,28 +3244,21 @@ static uint get_table_structure(const char *table, const char *db, char *table_t row= mysql_fetch_row(result); /* - The actual column type doesn't matter anyway, since the table will + The actual column value doesn't matter anyway, since the view will be dropped at run time. - We do tinyint to avoid hitting the row size limit. */ - fprintf(sql_file, " %s tinyint NOT NULL", + fprintf(sql_file, " 1 AS %s", quote_name(row[0], name_buff, 0)); while((row= mysql_fetch_row(result))) { /* col name, col type */ - fprintf(sql_file, ",\n %s tinyint NOT NULL", + fprintf(sql_file, ",\n 1 AS %s", quote_name(row[0], name_buff, 0)); } - /* - Stand-in tables are always MyISAM tables as the default - engine might have a column-limit that's lower than the - number of columns in the view, and MyISAM support is - guaranteed to be in the server anyway. - */ fprintf(sql_file, - "\n) ENGINE=MyISAM */;\n" + " */;\n" "SET character_set_client = @saved_cs_client;\n"); check_io(sql_file); @@ -3442,7 +3384,10 @@ static uint get_table_structure(const char *table, const char *db, char *table_t if (path) { if (!(sql_file= open_sql_file_for_table(table, O_WRONLY))) + { + mysql_free_result(result); DBUG_RETURN(0); + } write_header(sql_file, db); } @@ -3843,7 +3788,7 @@ static int dump_triggers_for_table(char *table_name, char *db_name) char name_buff[NAME_LEN*4+3]; char query_buff[QUERY_LENGTH]; uint old_opt_compatible_mode= opt_compatible_mode; - MYSQL_RES *show_triggers_rs; + MYSQL_RES *show_triggers_rs= NULL; MYSQL_ROW row; FILE *sql_file= md_result_file; @@ -3927,8 +3872,6 @@ static int dump_triggers_for_table(char *table_name, char *db_name) } skip: - mysql_free_result(show_triggers_rs); - if (switch_character_set_results(mysql, default_charset)) goto done; @@ -3943,7 +3886,7 @@ static int dump_triggers_for_table(char *table_name, char *db_name) done: if (path) my_fclose(sql_file, MYF(0)); - + mysql_free_result(show_triggers_rs); DBUG_RETURN(ret); } @@ -4059,7 +4002,7 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key, size_t total_length, init_length; my_bool versioned= 0; - MYSQL_RES *res; + MYSQL_RES *res= NULL; MYSQL_FIELD *field; MYSQL_ROW row; DBUG_ENTER("dump_table"); @@ -4257,6 +4200,8 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key, fprintf(stderr,"%s: Error in field count for table: %s ! Aborting.\n", my_progname_short, result_table); error= EX_CONSCHECK; + if (!quick) + mysql_free_result(res); goto err; } @@ -4565,6 +4510,7 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key, err: dynstr_free(&query_string); maybe_exit(error); + mysql_free_result(res); DBUG_VOID_RETURN; } /* dump_table */ @@ -4732,7 +4678,7 @@ static int dump_all_users_roles_and_grants() echo "$dosomethingspecial" ) | mysql -h $host - doesn't end up with a suprise that the $dosomethingspecial cannot + doesn't end up with a surprise that the $dosomethingspecial cannot be done because `special_role` isn't active. We create a new role for importing that becomes the default admin for new @@ -4741,8 +4687,8 @@ static int dump_all_users_roles_and_grants() create new admins for the created role. At the end of the import the mariadb_dump_import_role is be dropped, - which implictly drops all its admin aspects of the dropped role. - This is significiantly easlier than revoking the ADMIN of each role + which implicitly drops all its admin aspects of the dropped role. + This is significantly easier than revoking the ADMIN of each role from the current user. */ fputs("SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role;\n" @@ -4830,7 +4776,11 @@ static int dump_all_users_roles_and_grants() " '@', QUOTE(DEFAULT_ROLE_HOST))) as r," " CONCAT(QUOTE(mu.USER),'@',QUOTE(mu.HOST)) as u " "FROM mysql.user mu LEFT JOIN mysql.default_roles using (USER, HOST)")) + { + mysql_free_result(tableres); return 1; + } + while ((row= mysql_fetch_row(tableres))) { if (dump_grants(row[1])) @@ -5422,6 +5372,55 @@ int init_dumping_views(char *qdatabase __attribute__((unused))) } /* init_dumping_views */ +/* +mysql specific database initialization. + +SYNOPSIS + init_dumping_mysql_tables + + protections around dumping general/slow query log + qdatabase quoted name of the "mysql" database + +RETURN VALUES + 0 Success. + 1 Failure. +*/ +static int init_dumping_mysql_tables(char *qdatabase) +{ + DBUG_ENTER("init_dumping_mysql_tables"); + + if (opt_drop_database) + fprintf(md_result_file, + "\n/*!50106 SET @save_log_output=@@LOG_OUTPUT*/;\n" + "/*M!100203 EXECUTE IMMEDIATE IF(@@LOG_OUTPUT='TABLE' AND (@@SLOW_QUERY_LOG=1 OR @@GENERAL_LOG=1)," + "\"SET GLOBAL LOG_OUTPUT='NONE'\", \"DO 0\") */;\n"); + + DBUG_RETURN(init_dumping_tables(qdatabase)); +} + + +static void dump_first_mysql_tables(char *database) +{ + char table_type[NAME_LEN]; + char ignore_flag; + DBUG_ENTER("dump_first_mysql_tables"); + + if (!get_table_structure((char *) "general_log", + database, table_type, &ignore_flag, NULL) ) + verbose_msg("-- Warning: get_table_structure() failed with some internal " + "error for 'general_log' table\n"); + if (!get_table_structure((char *) "slow_log", + database, table_type, &ignore_flag, NULL) ) + verbose_msg("-- Warning: get_table_structure() failed with some internal " + "error for 'slow_log' table\n"); + /* general and slow query logs exist now */ + if (opt_drop_database) + fprintf(md_result_file, + "\n/*!50106 SET GLOBAL LOG_OUTPUT=@save_log_output*/;\n\n"); + DBUG_VOID_RETURN; +} + + /* Table Specific database initialization. @@ -5528,7 +5527,6 @@ static int dump_all_tables_in_db(char *database) char table_buff[NAME_LEN*2+3]; char hash_key[2*NAME_LEN+2]; /* "db.tablename" */ char *afterdot; - my_bool general_log_table_exists= 0, slow_log_table_exists=0; my_bool transaction_registry_table_exists= 0; int using_mysql_db= !my_strcasecmp(charset_info, database, "mysql"); DBUG_ENTER("dump_all_tables_in_db"); @@ -5536,11 +5534,15 @@ static int dump_all_tables_in_db(char *database) afterdot= strmov(hash_key, database); *afterdot++= '.'; - if (init_dumping(database, init_dumping_tables)) + if (init_dumping(database, using_mysql_db ? init_dumping_mysql_tables + : init_dumping_tables)) DBUG_RETURN(1); if (opt_xml) print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS); + if (using_mysql_db) + dump_first_mysql_tables(database); + if (lock_tables) { DYNAMIC_STRING query; @@ -5629,24 +5631,16 @@ static int dump_all_tables_in_db(char *database) else { /* - If general_log and slow_log exists in the 'mysql' database, + If transaction_registry exists in the 'mysql' database, we should dump the table structure. But we cannot call get_table_structure() here as 'LOCK TABLES' query got executed above on the session and that 'LOCK TABLES' query does not contain - 'general_log' and 'slow_log' tables. (you cannot acquire lock - on log tables). Hence mark the existence of these log tables here and + 'transaction_registry'. Hence mark the existence of the table here and after 'UNLOCK TABLES' query is executed on the session, get the table structure from server and dump it in the file. */ - if (using_mysql_db) - { - if (!my_strcasecmp(charset_info, table, "general_log")) - general_log_table_exists= 1; - else if (!my_strcasecmp(charset_info, table, "slow_log")) - slow_log_table_exists= 1; - else if (!my_strcasecmp(charset_info, table, "transaction_registry")) - transaction_registry_table_exists= 1; - } + if (using_mysql_db && !my_strcasecmp(charset_info, table, "transaction_registry")) + transaction_registry_table_exists= 1; } } @@ -5667,39 +5661,25 @@ static int dump_all_tables_in_db(char *database) DBUG_PRINT("info", ("Dumping routines for database %s", database)); dump_routines_for_db(database); } - if (opt_xml) - { - fputs("\n", md_result_file); - check_io(md_result_file); - } if (lock_tables) (void) mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES"); if (using_mysql_db) { - char table_type[NAME_LEN]; - char ignore_flag; - if (general_log_table_exists) - { - if (!get_table_structure((char *) "general_log", - database, table_type, &ignore_flag, NULL) ) - verbose_msg("-- Warning: get_table_structure() failed with some internal " - "error for 'general_log' table\n"); - } - if (slow_log_table_exists) - { - if (!get_table_structure((char *) "slow_log", - database, table_type, &ignore_flag, NULL) ) - verbose_msg("-- Warning: get_table_structure() failed with some internal " - "error for 'slow_log' table\n"); - } if (transaction_registry_table_exists) { + char table_type[NAME_LEN]; + char ignore_flag; if (!get_table_structure((char *) "transaction_registry", database, table_type, &ignore_flag, NULL) ) verbose_msg("-- Warning: get_table_structure() failed with some internal " "error for 'transaction_registry' table\n"); } } + if (opt_xml) + { + fputs("\n", md_result_file); + check_io(md_result_file); + } if (flush_privileges && using_mysql_db) { fprintf(md_result_file,"\n--\n-- Flush Grant Tables \n--\n"); @@ -5885,7 +5865,8 @@ static int get_sys_var_lower_case_table_names() lower_case_table_names= atoi(row[1]); mysql_free_result(table_res); } - + if (!row) + mysql_free_result(table_res); return lower_case_table_names; } @@ -6128,7 +6109,11 @@ static int do_show_master_status(MYSQL *mysql_con, int consistent_binlog_pos, } if (have_mariadb_gtid && get_gtid_pos(gtid_pos, 1)) + { + mysql_free_result(master); return 1; + } + } /* SHOW MASTER STATUS reports file and position */ @@ -6250,7 +6235,10 @@ static int do_show_slave_status(MYSQL *mysql_con, int use_gtid, { char gtid_pos[MAX_GTID_LENGTH]; if (have_mariadb_gtid && get_gtid_pos(gtid_pos, 0)) + { + mysql_free_result(slave); return 1; + } if (opt_comments) fprintf(md_result_file, "\n--\n-- Gtid position to start replication " "from\n--\n\n"); @@ -6446,7 +6434,7 @@ static ulong find_set(TYPELIB *lib, const char *x, size_t length, { const char *end= x + length; ulong found= 0; - uint find; + int find; char buff[255]; *err_pos= 0; /* No error yet */ @@ -6803,15 +6791,8 @@ static my_bool get_view_structure(char *table, char* db) "\n--\n-- Final view structure for view %s\n--\n\n", fix_for_comment(result_table)); - /* Table might not exist if this view was dumped with --tab. */ - fprintf(sql_file, "/*!50001 DROP TABLE IF EXISTS %s*/;\n", opt_quoted_table); - if (opt_drop) - { - fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n", - opt_quoted_table); - check_io(sql_file); - } - + /* View might not exist if this view was dumped with --tab. */ + fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n", opt_quoted_table); my_snprintf(query, sizeof(query), "SELECT CHECK_OPTION, DEFINER, SECURITY_TYPE, " @@ -6983,6 +6964,7 @@ static void dynstr_realloc_checked(DYNAMIC_STRING *str, ulong additional_size) int main(int argc, char **argv) { + char query[48]; char bin_log_name[FN_REFLEN]; int exit_code; int consistent_binlog_pos= 0; @@ -7024,6 +7006,13 @@ int main(int argc, char **argv) if (!path) write_header(md_result_file, *argv); + /* Set MAX_STATEMENT_TIME to 0 unless set in client */ + my_snprintf(query, sizeof(query), "/*!100100 SET @@MAX_STATEMENT_TIME=%f */", opt_max_statement_time); + mysql_query(mysql, query); + + /* Set server side timeout between client commands to server compiled-in default */ + mysql_query(mysql, "/*!100100 SET WAIT_TIMEOUT=DEFAULT */"); + /* Check if the server support multi source */ if (mysql_get_server_version(mysql) >= 100000) { @@ -7056,7 +7045,12 @@ int main(int argc, char **argv) if (flush_logs || opt_delete_master_logs) { if (mysql_refresh(mysql, REFRESH_LOG)) + { + fprintf(stderr, + "Flush logs or delete master logs failure in server \n"); + first_error= EX_MYSQLERR; goto err; + } verbose_msg("-- main : logs flushed successfully!\n"); } @@ -7142,7 +7136,7 @@ int main(int argc, char **argv) if (opt_system & OPT_SYSTEM_SERVERS) dump_all_servers(); - /* These must be last as they explictly change the current database to mysql */ + /* These must be last as they explicitly change the current database to mysql */ if (opt_system & OPT_SYSTEM_STATS) dump_all_stats(); diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 48f11667cd10e..03f47b3a4ad33 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2011, 2017, MariaDB + Copyright (c) 2011, 2022, 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 @@ -64,8 +64,6 @@ static char * opt_mysql_unix_port=0; static char *opt_plugin_dir= 0, *opt_default_auth= 0; static longlong opt_ignore_lines= -1; -static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT; - #include static char **argv_to_free; @@ -227,9 +225,6 @@ static my_bool get_one_option(const struct my_option *opt, const char *argument, const char *filename) { - /* Track when protocol is set via CLI to not force overrides */ - static my_bool ignore_protocol_override = FALSE; - switch(opt->id) { case 'p': if (argument == disabled_my_option) @@ -256,14 +251,6 @@ get_one_option(const struct my_option *opt, const char *argument, case 'W': opt_protocol = MYSQL_PROTOCOL_PIPE; opt_local_file=1; - - /* Prioritize pipe if explicit via command line */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - break; #endif case OPT_MYSQL_PROTOCOL: @@ -273,45 +260,19 @@ get_one_option(const struct my_option *opt, const char *argument, sf_leaking_memory= 1; /* no memory leak reports here */ exit(1); } - - /* Specification of protocol via CLI trumps implicit overrides */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - break; case 'P': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* If port is set via CLI, try to force protocol to TCP */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = MYSQL_PROTOCOL_TCP; + /* Port given on command line, switch protocol to use TCP */ + opt_protocol= MYSQL_PROTOCOL_TCP; } break; case 'S': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == MYSQL_PROTOCOL_TCP) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* Prioritize socket if set via command line */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = SOCKET_PROTOCOL_TO_FORCE; + /* Socket given on command line, switch protocol to use SOCKETSt */ + opt_protocol= MYSQL_PROTOCOL_SOCKET; } break; case '#': @@ -382,11 +343,7 @@ static int write_to_table(char *filename, MYSQL *mysql) { if (verbose) fprintf(stdout, "Deleting the old data from table %s\n", tablename); -#ifdef HAVE_SNPRINTF snprintf(sql_statement, FN_REFLEN*16+256, "DELETE FROM %s", tablename); -#else - sprintf(sql_statement, "DELETE FROM %s", tablename); -#endif if (mysql_query(mysql, sql_statement)) { db_error_with_table(mysql, tablename); @@ -574,13 +531,15 @@ static void safe_exit(int error, MYSQL *mysql) if (mysql) mysql_close(mysql); - mysql_library_end(); - free_defaults(argv_to_free); - my_free(opt_password); if (error) sf_leaking_memory= 1; /* dirty exit, some threads are still running */ else + { + mysql_library_end(); + free_defaults(argv_to_free); + my_free(opt_password); my_end(my_end_arg); /* clean exit */ + } exit(error); } @@ -624,7 +583,7 @@ static char *add_load_option(char *ptr, const char *object, /* ** Allow the user to specify field terminator strings like: ** "'", "\", "\\" (escaped backslash), "\t" (tab), "\n" (newline) -** This is done by doubleing ' and add a end -\ if needed to avoid +** This is done by doubling ' and add a end -\ if needed to avoid ** syntax errors from the SQL parser. */ @@ -712,13 +671,6 @@ int main(int argc, char **argv) return(1); } - /* Command line options override configured protocol */ - if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT - && protocol_to_force != opt_protocol) - { - warn_protocol_override(current_host, &opt_protocol, protocol_to_force); - } - sf_leaking_memory=0; /* from now on we cleanup properly */ if (opt_use_threads && !lock_tables) diff --git a/client/mysqlshow.c b/client/mysqlshow.c index cbac1817c3cb8..0a114ad94fbdb 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -41,8 +41,6 @@ static char *opt_plugin_dir= 0, *opt_default_auth= 0; static uint opt_protocol=0; -static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT; - static void get_options(int *argc,char ***argv); static uint opt_mysql_port=0; static int list_dbs(MYSQL *mysql,const char *wild); @@ -81,14 +79,6 @@ int main(int argc, char **argv) get_options(&argc,&argv); - - /* Command line options override configured protocol */ - if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT - && protocol_to_force != opt_protocol) - { - warn_protocol_override(host, &opt_protocol, protocol_to_force); - } - sf_leaking_memory=0; /* from now on we cleanup properly */ wild=0; if (argc) @@ -308,9 +298,6 @@ get_one_option(const struct my_option *opt, const char *argument, const char *filename) { - /* Track when protocol is set via CLI to not force overrides */ - static my_bool ignore_protocol_override = FALSE; - switch(opt->id) { case 'v': opt_verbose++; @@ -339,13 +326,6 @@ get_one_option(const struct my_option *opt, const char *argument, case 'W': #ifdef _WIN32 opt_protocol = MYSQL_PROTOCOL_PIPE; - - /* Prioritize pipe if explicit via command line */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } #endif break; case OPT_MYSQL_PROTOCOL: @@ -355,47 +335,22 @@ get_one_option(const struct my_option *opt, const char *argument, sf_leaking_memory= 1; /* no memory leak reports here */ exit(1); } - - /* Specification of protocol via CLI trumps implicit overrides */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - break; case 'P': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* If port is set via CLI, try to force protocol to TCP */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = MYSQL_PROTOCOL_TCP; + /* Port given on command line, switch protocol to use TCP */ + opt_protocol= MYSQL_PROTOCOL_TCP; } break; case 'S': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == MYSQL_PROTOCOL_TCP) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* Prioritize socket if set via command line */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = SOCKET_PROTOCOL_TO_FORCE; + /* Socket given on command line, switch protocol to use SOCKETSt */ + opt_protocol= MYSQL_PROTOCOL_SOCKET; } break; + break; case '#': DBUG_PUSH(argument ? argument : "d:t:o"); debug_check_flag= 1; @@ -507,7 +462,7 @@ list_dbs(MYSQL *mysql,const char *wild) MYSQL_RES *tresult = mysql_list_tables(mysql,(char*)NULL); if (mysql_affected_rows(mysql) > 0) { - sprintf(tables,"%6lu",(ulong) mysql_affected_rows(mysql)); + snprintf(tables, sizeof(tables), "%6lu",(ulong) mysql_affected_rows(mysql)); rowcount = 0; if (opt_verbose > 1) { @@ -528,13 +483,13 @@ list_dbs(MYSQL *mysql,const char *wild) } } } - sprintf(rows,"%12lu",rowcount); + snprintf(rows, sizeof(rows), "%12lu", rowcount); } } else { - sprintf(tables,"%6d",0); - sprintf(rows,"%12d",0); + snprintf(tables, sizeof(tables), "%6d" ,0); + snprintf(rows, sizeof(rows), "%12d", 0); } mysql_free_result(tresult); } @@ -652,7 +607,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table) } else { - sprintf(fields,"%8u",(uint) mysql_num_fields(rresult)); + snprintf(fields, sizeof(fields), "%8u", (uint) mysql_num_fields(rresult)); mysql_free_result(rresult); if (opt_verbose > 1) @@ -668,10 +623,10 @@ list_tables(MYSQL *mysql,const char *db,const char *table) rowcount += (unsigned long) strtoull(rrow[0], (char**) 0, 10); mysql_free_result(rresult); } - sprintf(rows,"%10lu",rowcount); + snprintf(rows, sizeof(rows), "%10lu", rowcount); } else - sprintf(rows,"%10d",0); + snprintf(rows, sizeof(rows), "%10d", 0); } } } diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 5813107732162..79e5fe1f8bcd2 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -1,6 +1,6 @@ /* Copyright (c) 2005, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2017, MariaDB + Copyright (c) 2010, 2022, 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 @@ -23,7 +23,7 @@ then reporting the timing of each stage. MySQL slap runs three stages: - 1) Create schema,table, and optionally any SP or data you want to beign + 1) Create schema,table, and optionally any SP or data you want to begin the test with. (single client) 2) Load test (many clients) 3) Cleanup (disconnection, drop table if specified, single client) @@ -172,8 +172,6 @@ File csv_file; static uint opt_protocol= 0; -static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT; - static int get_options(int *argc,char ***argv); static uint opt_mysql_port= 0; @@ -304,7 +302,10 @@ void set_mysql_connect_options(MYSQL *mysql) opt_ssl_capath, opt_ssl_cipher); mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + mysql_options(mysql, MARIADB_OPT_TLS_VERSION, opt_tls_version); } + mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, + (char*)&opt_ssl_verify_server_cert); #endif if (opt_protocol) mysql_options(mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); @@ -332,13 +333,6 @@ int main(int argc, char **argv) exit(1); } - /* Command line options override configured protocol */ - if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT - && protocol_to_force != opt_protocol) - { - warn_protocol_override(host, &opt_protocol, protocol_to_force); - } - sf_leaking_memory=0; /* from now on we cleanup properly */ /* Seed the random number generator if we will be using it. */ @@ -741,9 +735,6 @@ static my_bool get_one_option(const struct my_option *opt, const char *argument, const char *filename) { - /* Track when protocol is set via CLI to not force overrides */ - static my_bool ignore_protocol_override = FALSE; - DBUG_ENTER("get_one_option"); switch(opt->id) { case 'v': @@ -773,13 +764,6 @@ get_one_option(const struct my_option *opt, const char *argument, case 'W': #ifdef _WIN32 opt_protocol= MYSQL_PROTOCOL_PIPE; - - /* Prioritize pipe if explicit via command line */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } #endif break; case OPT_MYSQL_PROTOCOL: @@ -789,45 +773,19 @@ get_one_option(const struct my_option *opt, const char *argument, sf_leaking_memory= 1; /* no memory leak reports here */ exit(1); } - - /* Specification of protocol via CLI trumps implicit overrides */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - break; case 'P': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* If port is set via CLI, try to force protocol to TCP */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = MYSQL_PROTOCOL_TCP; + /* Port given on command line, switch protocol to use TCP */ + opt_protocol= MYSQL_PROTOCOL_TCP; } break; case 'S': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == MYSQL_PROTOCOL_TCP) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* Prioritize socket if set via command line */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = SOCKET_PROTOCOL_TO_FORCE; + /* Socket given on command line, switch protocol to use SOCKETSt */ + opt_protocol= MYSQL_PROTOCOL_SOCKET; } break; case '#': @@ -1832,6 +1790,7 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit) uint x; struct timeval start_time, end_time; thread_context con; + int error; pthread_t mainthread; /* Thread descriptor */ pthread_attr_t attr; /* Thread attributes */ DBUG_ENTER("run_scheduler"); @@ -1840,8 +1799,11 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit) con.limit= limit; pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, - PTHREAD_CREATE_DETACHED); + if ((error= pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED))) + { + printf("Got error: %d from pthread_attr_setdetachstate\n", error); + exit(1); + } pthread_mutex_lock(&counter_mutex); thread_counter= 0; @@ -1897,12 +1859,11 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit) pthread_handler_t run_task(void *p) { - ulonglong counter= 0, queries; + ulonglong queries; ulonglong detach_counter; unsigned int commit_counter; MYSQL *mysql; MYSQL_RES *result; - MYSQL_ROW row; statement *ptr; thread_context *con= (thread_context *)p; @@ -2023,8 +1984,7 @@ pthread_handler_t run_task(void *p) my_progname, mysql_errno(mysql), mysql_error(mysql)); else { - while ((row= mysql_fetch_row(result))) - counter++; + while (mysql_fetch_row(result)) {} mysql_free_result(result); } } @@ -2034,7 +1994,7 @@ pthread_handler_t run_task(void *p) if (commit_rate && (++commit_counter == commit_rate)) { commit_counter= 0; - run_query(mysql, "COMMIT", strlen("COMMIT")); + run_query(mysql, C_STRING_WITH_LEN("COMMIT")); } if (con->limit && queries == con->limit) @@ -2046,7 +2006,7 @@ pthread_handler_t run_task(void *p) end: if (commit_rate) - run_query(mysql, "COMMIT", strlen("COMMIT")); + run_query(mysql, C_STRING_WITH_LEN("COMMIT")); mysql_close(mysql); @@ -2086,7 +2046,7 @@ parse_option(const char *origin, option_string **stmt, char delm) char *buffer_ptr; /* - Return an error if the length of the any of the comma seprated value + Return an error if the length of the comma separated values exceeds HUGE_STRING_LENGTH. */ if ((size_t)(retstr - ptr) > HUGE_STRING_LENGTH) @@ -2132,7 +2092,7 @@ parse_option(const char *origin, option_string **stmt, char delm) char *origin_ptr; /* - Return an error if the length of the any of the comma seprated value + Return an error if the length of any of the comma separated values exceeds HUGE_STRING_LENGTH. */ if (strlen(ptr) > HUGE_STRING_LENGTH) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 3d64552922ab3..9854001ba1ac2 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB + Copyright (c) 2009, 2022, 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 @@ -119,6 +119,7 @@ static my_bool opt_mark_progress= 0; static my_bool ps_protocol= 0, ps_protocol_enabled= 0; static my_bool sp_protocol= 0, sp_protocol_enabled= 0; static my_bool view_protocol= 0, view_protocol_enabled= 0; +static my_bool service_connection_enabled= 1; static my_bool cursor_protocol= 0, cursor_protocol_enabled= 0; static my_bool parsing_disabled= 0; static my_bool display_result_vertically= FALSE, display_result_lower= FALSE, @@ -156,6 +157,8 @@ static struct property prop_list[] = { { &display_session_track_info, 0, 1, 1, "$ENABLED_STATE_CHANGE_INFO" }, { &display_metadata, 0, 0, 0, "$ENABLED_METADATA" }, { &ps_protocol_enabled, 0, 0, 0, "$ENABLED_PS_PROTOCOL" }, + { &view_protocol_enabled, 0, 0, 0, "$ENABLED_VIEW_PROTOCOL"}, + { &service_connection_enabled, 0, 1, 0, "$ENABLED_SERVICE_CONNECTION"}, { &disable_query_log, 0, 0, 1, "$ENABLED_QUERY_LOG" }, { &disable_result_log, 0, 0, 1, "$ENABLED_RESULT_LOG" }, { &disable_warnings, 0, 0, 1, "$ENABLED_WARNINGS" } @@ -170,6 +173,8 @@ enum enum_prop { P_SESSION_TRACK, P_META, P_PS, + P_VIEW, + P_CONN, P_QUERY, P_RESULT, P_WARN, @@ -317,6 +322,7 @@ struct st_connection char *name; size_t name_len; MYSQL_STMT* stmt; + MYSQL_BIND *ps_params; /* Set after send to disallow other queries before reap */ my_bool pending; @@ -375,6 +381,8 @@ enum enum_commands { Q_LOWERCASE, Q_START_TIMER, Q_END_TIMER, Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL, + Q_DISABLE_VIEW_PROTOCOL, Q_ENABLE_VIEW_PROTOCOL, + Q_DISABLE_SERVICE_CONNECTION, Q_ENABLE_SERVICE_CONNECTION, Q_ENABLE_NON_BLOCKING_API, Q_DISABLE_NON_BLOCKING_API, Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT, Q_IF, @@ -390,6 +398,10 @@ enum enum_commands { Q_ENABLE_PREPARE_WARNINGS, Q_DISABLE_PREPARE_WARNINGS, Q_RESET_CONNECTION, Q_OPTIMIZER_TRACE, + Q_PS_PREPARE, + Q_PS_BIND, + Q_PS_EXECUTE, + Q_PS_CLOSE, Q_UNKNOWN, /* Unknown command. */ Q_COMMENT, /* Comments, ignored. */ Q_COMMENT_WITH_COMMAND, @@ -462,6 +474,10 @@ const char *command_names[]= "character_set", "disable_ps_protocol", "enable_ps_protocol", + "disable_view_protocol", + "enable_view_protocol", + "disable_service_connection", + "enable_service_connection", "enable_non_blocking_api", "disable_non_blocking_api", "disable_reconnect", @@ -501,6 +517,10 @@ const char *command_names[]= "disable_prepare_warnings", "reset_connection", "optimizer_trace", + "PS_prepare", + "PS_bind", + "PS_execute", + "PS_close", 0 }; @@ -560,10 +580,10 @@ char builtin_echo[FN_REFLEN]; struct st_replace_regex { -DYNAMIC_ARRAY regex_arr; /* stores a list of st_regex subsitutions */ +DYNAMIC_ARRAY regex_arr; /* stores a list of st_regex substitutions */ /* -Temporary storage areas for substitutions. To reduce unnessary copying +Temporary storage areas for substitutions. To reduce unnecessary copying and memory freeing/allocation, we pre-allocate two buffers, and alternate their use, one for input/one for output, the roles changing on the next st_regex substitution. At the end of substitutions buf points to the @@ -1387,6 +1407,16 @@ void close_connections() DBUG_VOID_RETURN; } +void close_util_connections() +{ + DBUG_ENTER("close_util_connections"); + if (cur_con->util_mysql) + { + mysql_close(cur_con->util_mysql); + cur_con->util_mysql = 0; + } + DBUG_VOID_RETURN; +} void close_statements() { @@ -1718,7 +1748,8 @@ int cat_file(DYNAMIC_STRING* ds, const char* filename) len= (size_t) my_seek(fd, 0, SEEK_END, MYF(0)); my_seek(fd, 0, SEEK_SET, MYF(0)); if (len == (size_t)MY_FILEPOS_ERROR || - !(buff= (char*)my_malloc(PSI_NOT_INSTRUMENTED, len + 1, MYF(0)))) + !(buff= (char*)my_malloc(PSI_NOT_INSTRUMENTED, len + 1, + MYF(MY_WME|MY_FAE)))) { my_close(fd, MYF(0)); return 1; @@ -1919,7 +1950,7 @@ void show_diff(DYNAMIC_STRING* ds, needs special processing due to return values on that OS This test is only done on Windows since it's only needed there - in order to correctly detect non-availibility of 'diff', and + in order to correctly detect non-availability of 'diff', and the way it's implemented does not work with default 'diff' on Solaris. */ #ifdef _WIN32 @@ -2298,7 +2329,7 @@ static int strip_surrounding(char* str, char c1, char c2) /* Replace it with a space */ *ptr= ' '; - /* Last non space charecter should be c2 */ + /* Last non space character should be c2 */ ptr= strend(str)-1; while(*ptr && my_isspace(charset_info, *ptr)) ptr--; @@ -2377,7 +2408,7 @@ VAR *var_init(VAR *v, const char *name, size_t name_len, const char *val, size_t val_len= 0; val_alloc_len = val_len + 16; /* room to grow */ if (!(tmp_var=v) && !(tmp_var = (VAR*)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(*tmp_var) - + name_len+2, MYF(MY_WME)))) + + name_len+2, MYF(MY_WME|MY_FAE)))) die("Out of memory"); if (name != NULL) @@ -2391,7 +2422,8 @@ VAR *var_init(VAR *v, const char *name, size_t name_len, const char *val, size_t tmp_var->alloced = (v == 0); - if (!(tmp_var->str_val = (char*)my_malloc(PSI_NOT_INSTRUMENTED, val_alloc_len+1, MYF(MY_WME)))) + if (!(tmp_var->str_val = (char*)my_malloc(PSI_NOT_INSTRUMENTED, + val_alloc_len+1, MYF(MY_WME|MY_FAE)))) die("Out of memory"); if (val) @@ -2939,8 +2971,10 @@ void var_copy(VAR *dest, VAR *src) /* Alloc/realloc data for str_val in dest */ if (dest->alloced_len < src->alloced_len && !(dest->str_val= dest->str_val - ? (char*)my_realloc(PSI_NOT_INSTRUMENTED, dest->str_val, src->alloced_len, MYF(MY_WME)) - : (char*)my_malloc(PSI_NOT_INSTRUMENTED, src->alloced_len, MYF(MY_WME)))) + ? (char*)my_realloc(PSI_NOT_INSTRUMENTED, dest->str_val, src->alloced_len, + MYF(MY_WME|MY_FAE)) + : (char*)my_malloc(PSI_NOT_INSTRUMENTED, src->alloced_len, + MYF(MY_WME|MY_FAE)))) die("Out of memory"); else dest->alloced_len= src->alloced_len; @@ -3017,8 +3051,10 @@ void eval_expr(VAR *v, const char *p, const char **p_end, MIN_VAR_ALLOC : new_val_len + 1; if (!(v->str_val = v->str_val ? - (char*)my_realloc(PSI_NOT_INSTRUMENTED, v->str_val, v->alloced_len+1, MYF(MY_WME)) : - (char*)my_malloc(PSI_NOT_INSTRUMENTED, v->alloced_len+1, MYF(MY_WME)))) + (char*)my_realloc(PSI_NOT_INSTRUMENTED, v->str_val, v->alloced_len+1, + MYF(MY_WME|MY_FAE)) : + (char*)my_malloc(PSI_NOT_INSTRUMENTED, v->alloced_len+1, + MYF(MY_WME|MY_FAE)))) die("Out of memory"); } v->str_val_len = new_val_len; @@ -3067,7 +3103,7 @@ void open_file(const char *name) if overlay-dir is specified, and the file is located somewhere under overlay-dir or under suite-dir, the search works as follows: - 0.let suffix be current file dirname relative to siute-dir or overlay-dir + 0.let suffix be current file dirname relative to suite-dir or overlay-dir 1.try in overlay-dir/suffix 2.try in suite-dir/suffix 3.try in overlay-dir @@ -3594,9 +3630,11 @@ void do_system(struct st_command *command) /* returns TRUE if path is inside a sandbox */ bool is_sub_path(const char *path, size_t plen, const char *sandbox) { - size_t len= strlen(sandbox); - if (!sandbox || !len || plen <= len || memcmp(path, sandbox, len - 1) - || path[len] != '/') + size_t len; + if (!sandbox) + return false; + len= strlen(sandbox); + if (plen <= len || memcmp(path, sandbox, len-1) || path[len] != '/') return false; return true; } @@ -3842,9 +3880,21 @@ void do_move_file(struct st_command *command) sizeof(move_file_args)/sizeof(struct command_arg), ' '); - if (bad_path(ds_to_file.str)) - DBUG_VOID_RETURN; + size_t from_plen = strlen(ds_from_file.str); + size_t to_plen = strlen(ds_to_file.str); + const char *vardir= getenv("MYSQLTEST_VARDIR"); + const char *tmpdir= getenv("MYSQL_TMP_DIR"); + if (!((is_sub_path(ds_from_file.str, from_plen, vardir) && + is_sub_path(ds_to_file.str, to_plen, vardir)) || + (is_sub_path(ds_from_file.str, from_plen, tmpdir) && + is_sub_path(ds_to_file.str, to_plen, tmpdir)))) { + report_or_die("Paths '%s' and '%s' are not both under MYSQLTEST_VARDIR '%s'" + "or both under MYSQL_TMP_DIR '%s'", + ds_from_file, ds_to_file, vardir, tmpdir); + DBUG_VOID_RETURN; + } + DBUG_PRINT("info", ("Move %s to %s", ds_from_file.str, ds_to_file.str)); error= (my_rename(ds_from_file.str, ds_to_file.str, MYF(disable_warnings ? 0 : MY_WME)) != 0); @@ -4804,7 +4854,8 @@ void do_sync_with_master(struct st_command *command) p++; while (*p && my_isspace(charset_info, *p)) p++; - start= buff= (char*)my_malloc(PSI_NOT_INSTRUMENTED, strlen(p)+1,MYF(MY_WME | MY_FAE)); + start= buff= (char*)my_malloc(PSI_NOT_INSTRUMENTED, strlen(p)+1, + MYF(MY_WME|MY_FAE)); get_string(&buff, &p, command); } command->last_argument= p; @@ -5211,6 +5262,7 @@ void do_shutdown_server(struct st_command *command) if (!timeout || wait_until_dead(pid, timeout < 5 ? 5 : timeout)) { (void) my_kill(pid, SIGKILL); + wait_until_dead(pid, 5); } } DBUG_VOID_RETURN; @@ -5631,7 +5683,7 @@ void do_close_connection(struct st_command *command) con->stmt= 0; #ifdef EMBEDDED_LIBRARY /* - As query could be still executed in a separate theread + As query could be still executed in a separate thread we need to check if the query's thread was finished and probably wait (embedded-server specific) */ @@ -5930,7 +5982,7 @@ void do_connect(struct st_command *command) { "connection name", ARG_STRING, TRUE, &ds_connection_name, "Name of the connection" }, { "host", ARG_STRING, TRUE, &ds_host, "Host to connect to" }, { "user", ARG_STRING, FALSE, &ds_user, "User to connect as" }, - { "passsword", ARG_STRING, FALSE, &ds_password, "Password used when connecting" }, + { "password", ARG_STRING, FALSE, &ds_password, "Password used when connecting" }, { "database", ARG_STRING, FALSE, &ds_database, "Database to select after connect" }, { "port", ARG_STRING, FALSE, &ds_port, "Port to connect to" }, { "socket", ARG_STRING, FALSE, &ds_sock, "Socket to connect with" }, @@ -6195,7 +6247,9 @@ int do_done(struct st_command *command) if (*cur_block->delim) { /* Restore "old" delimiter after false if block */ - strcpy (delimiter, cur_block->delim); + if (safe_strcpy(delimiter, sizeof(delimiter), cur_block->delim)) + die("Delimiter too long, truncated"); + delimiter_length= strlen(delimiter); } /* Pop block from stack, goto next line */ @@ -6422,7 +6476,7 @@ void do_block(enum block_cmd cmd, struct st_command* command) } else { if (*expr_start != '`' && ! my_isdigit(charset_info, *expr_start)) - die("Expression in if/while must beging with $, ` or a number"); + die("Expression in if/while must begin with $, ` or a number"); eval_expr(&v, expr_start, &expr_end); } @@ -6450,10 +6504,12 @@ void do_block(enum block_cmd cmd, struct st_command* command) if (cur_block->ok) { cur_block->delim[0]= '\0'; - } else + } + else { /* Remember "old" delimiter if entering a false if block */ - strcpy (cur_block->delim, delimiter); + if (safe_strcpy(cur_block->delim, sizeof(cur_block->delim), delimiter)) + die("Delimiter too long, truncated"); } DBUG_PRINT("info", ("OK: %d", cur_block->ok)); @@ -6944,7 +7000,7 @@ int read_command(struct st_command** command_ptr) } if (!(*command_ptr= command= (struct st_command*) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(*command), - MYF(MY_WME|MY_ZEROFILL))) || + MYF(MY_WME|MY_FAE|MY_ZEROFILL))) || insert_dynamic(&q_lines, &command)) die("Out of memory"); command->type= Q_UNKNOWN; @@ -7652,18 +7708,19 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt, /* Allocate array with bind structs, lengths and NULL flags */ my_bind= (MYSQL_BIND*) my_malloc(PSI_NOT_INSTRUMENTED, num_fields * sizeof(MYSQL_BIND), - MYF(MY_WME | MY_FAE | MY_ZEROFILL)); + MYF(MY_WME|MY_FAE|MY_ZEROFILL)); length= (ulong*) my_malloc(PSI_NOT_INSTRUMENTED, num_fields * sizeof(ulong), - MYF(MY_WME | MY_FAE)); + MYF(MY_WME|MY_FAE)); is_null= (my_bool*) my_malloc(PSI_NOT_INSTRUMENTED, num_fields * sizeof(my_bool), - MYF(MY_WME | MY_FAE)); + MYF(MY_WME|MY_FAE)); /* Allocate data for the result of each field */ for (i= 0; i < num_fields; i++) { uint max_length= fields[i].max_length + 1; my_bind[i].buffer_type= MYSQL_TYPE_STRING; - my_bind[i].buffer= my_malloc(PSI_NOT_INSTRUMENTED, max_length, MYF(MY_WME | MY_FAE)); + my_bind[i].buffer= my_malloc(PSI_NOT_INSTRUMENTED, max_length, + MYF(MY_WME|MY_FAE)); my_bind[i].buffer_length= max_length; my_bind[i].is_null= &is_null[i]; my_bind[i].length= &length[i]; @@ -7943,6 +8000,15 @@ static void handle_no_active_connection(struct st_command *command, var_set_errno(2006); } +/* handler functions to execute prepared statement calls in client C API */ +void run_prepare_stmt(struct st_connection *cn, struct st_command *command, const char *query, + size_t query_len, DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_warnings); +void run_bind_stmt(struct st_connection *cn, struct st_command *command, const char *query, + size_t query_len, DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_warnings); +void run_execute_stmt(struct st_connection *cn, struct st_command *command, const char *query, + size_t query_len, DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_warnings); +void run_close_stmt(struct st_connection *cn, struct st_command *command, const char *query, + size_t query_len, DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_warnings); /* Run query using MySQL C API @@ -7974,6 +8040,32 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, DBUG_VOID_RETURN; } + /* handle prepared statement commands */ + switch (command->type) { + case Q_PS_PREPARE: + run_prepare_stmt(cn, command, query, query_len, ds, ds_warnings); + flags &= ~QUERY_SEND_FLAG; + goto end; + break; + case Q_PS_BIND: + run_bind_stmt(cn, command, query, query_len, ds, ds_warnings); + flags &= ~QUERY_SEND_FLAG; + goto end; + break; + case Q_PS_EXECUTE: + run_execute_stmt(cn, command, query, query_len, ds, ds_warnings); + flags &= ~QUERY_SEND_FLAG; + goto end; + break; + case Q_PS_CLOSE: + run_close_stmt(cn, command, query, query_len, ds, ds_warnings); + flags &= ~QUERY_SEND_FLAG; + goto end; + break; + default: /* not a prepared statement command */ + break; + } + if (flags & QUERY_SEND_FLAG) { /* @@ -8301,7 +8393,7 @@ void handle_no_error(struct st_command *command) /* Run query using prepared statement C API - SYNPOSIS + SYNOPSIS run_query_stmt mysql - mysql handle command - current command pointer @@ -8544,6 +8636,417 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command, } } + + DBUG_VOID_RETURN; +} + +/* + prepare query using prepared statement C API + + SYNPOSIS + run_prepare_stmt + mysql - mysql handle + command - current command pointer + query - query string to execute + query_len - length query string to execute + ds - output buffer where to store result form query + + RETURN VALUE + error - function will not return +*/ + +void run_prepare_stmt(struct st_connection *cn, struct st_command *command, const char *query, size_t query_len, DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_warnings) +{ + + MYSQL *mysql= cn->mysql; + MYSQL_STMT *stmt; + DYNAMIC_STRING ds_prepare_warnings; + DBUG_ENTER("run_prepare_stmt"); + DBUG_PRINT("query", ("'%-.60s'", query)); + + /* + Init a new stmt if it's not already one created for this connection + */ + if(!(stmt= cn->stmt)) + { + if (!(stmt= mysql_stmt_init(mysql))) + die("unable to init stmt structure"); + cn->stmt= stmt; + } + + /* Init dynamic strings for warnings */ + if (!disable_warnings) + { + init_dynamic_string(&ds_prepare_warnings, NULL, 0, 256); + } + + /* + Prepare the query + */ + char* PS_query= command->first_argument; + size_t PS_query_len= command->end - command->first_argument; + if (do_stmt_prepare(cn, PS_query, PS_query_len)) + { + handle_error(command, mysql_stmt_errno(stmt), + mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds); + goto end; + } + + /* + Get the warnings from mysql_stmt_prepare and keep them in a + separate string + */ + if (!disable_warnings) + { + append_warnings(&ds_prepare_warnings, mysql); + dynstr_free(&ds_prepare_warnings); + } + end: + DBUG_VOID_RETURN; +} + +/* + bind parameters for a prepared statement C API + + SYNPOSIS + run_bind_stmt + mysql - mysql handle + command - current command pointer + query - query string to execute + query_len - length query string to execute + ds - output buffer where to store result form query + + RETURN VALUE + error - function will not return +*/ + +void run_bind_stmt(struct st_connection *cn, struct st_command *command, + const char *query, size_t query_len, DYNAMIC_STRING *ds, + DYNAMIC_STRING *ds_warnings + ) +{ + MYSQL_STMT *stmt= cn->stmt; + DBUG_ENTER("run_bind_stmt"); + DBUG_PRINT("query", ("'%-.60s'", query)); + MYSQL_BIND *ps_params= cn->ps_params; + if (ps_params) + { + for (size_t i=0; iparam_count; i++) + { + my_free(ps_params[i].buffer); + ps_params[i].buffer= NULL; + } + my_free(ps_params); + ps_params= NULL; + } + + /* Init PS-parameters. */ + cn->ps_params= ps_params = (MYSQL_BIND*)my_malloc(PSI_NOT_INSTRUMENTED, + sizeof(MYSQL_BIND) * + stmt->param_count, + MYF(MY_WME|MY_FAE)); + bzero((char *) ps_params, sizeof(MYSQL_BIND) * stmt->param_count); + + int i=0; + char *c; + long *l; + double *d; + + char *p= strtok((char*)command->first_argument, " "); + while (p != nullptr) + { + (void)strtol(p, &c, 10); + if (!*c) + { + ps_params[i].buffer_type= MYSQL_TYPE_LONG; + l= (long*)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(long), + MYF(MY_WME|MY_FAE)); + *l= strtol(p, &c, 10); + ps_params[i].buffer= (void*)l; + ps_params[i].buffer_length= 8; + } + else + { + (void)strtod(p, &c); + if (!*c) + { + ps_params[i].buffer_type= MYSQL_TYPE_DECIMAL; + d= (double*)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(double), + MYF(MY_WME|MY_FAE)); + *d= strtod(p, &c); + ps_params[i].buffer= (void*)d; + ps_params[i].buffer_length= 8; + } + else + { + ps_params[i].buffer_type= MYSQL_TYPE_STRING; + ps_params[i].buffer= my_strdup(PSI_NOT_INSTRUMENTED, p, + MYF(MY_WME|MY_FAE)); + ps_params[i].buffer_length= (unsigned long)strlen(p); + } + } + + p= strtok(nullptr, " "); + i++; + } + + int rc= mysql_stmt_bind_param(stmt, ps_params); + if (rc) + { + die("mysql_stmt_bind_param() failed': %d %s", + mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); + } + + DBUG_VOID_RETURN; +} + +/* + execute query using prepared statement C API + + SYNPOSIS + run_axecute_stmt + mysql - mysql handle + command - current command pointer + query - query string to execute + query_len - length query string to execute + ds - output buffer where to store result form query + + RETURN VALUE + error - function will not return +*/ + +void run_execute_stmt(struct st_connection *cn, struct st_command *command, + const char *query, size_t query_len, DYNAMIC_STRING *ds, + DYNAMIC_STRING *ds_warnings + ) +{ + MYSQL_RES *res= NULL; /* Note that here 'res' is meta data result set */ + MYSQL *mysql= cn->mysql; + MYSQL_STMT *stmt= cn->stmt; + DYNAMIC_STRING ds_execute_warnings; + DBUG_ENTER("run_execute_stmt"); + DBUG_PRINT("query", ("'%-.60s'", query)); + + /* Init dynamic strings for warnings */ + if (!disable_warnings) + { + init_dynamic_string(&ds_execute_warnings, NULL, 0, 256); + } + +#if MYSQL_VERSION_ID >= 50000 + if (cursor_protocol_enabled) + { + /* + Use cursor when retrieving result + */ + ulong type= CURSOR_TYPE_READ_ONLY; + if (mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type)) + die("mysql_stmt_attr_set(STMT_ATTR_CURSOR_TYPE) failed': %d %s", + mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); + } +#endif + + /* + Execute the query + */ + if (do_stmt_execute(cn)) + { + handle_error(command, mysql_stmt_errno(stmt), + mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds); + goto end; + } + + /* + When running in cursor_protocol get the warnings from execute here + and keep them in a separate string for later. + */ + if (cursor_protocol_enabled && !disable_warnings) + append_warnings(&ds_execute_warnings, mysql); + + /* + We instruct that we want to update the "max_length" field in + mysql_stmt_store_result(), this is our only way to know how much + buffer to allocate for result data + */ + { + my_bool one= 1; + if (mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void*) &one)) + die("mysql_stmt_attr_set(STMT_ATTR_UPDATE_MAX_LENGTH) failed': %d %s", + mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); + } + + /* + If we got here the statement succeeded and was expected to do so, + get data. Note that this can still give errors found during execution! + Store the result of the query if if will return any fields + */ + if (mysql_stmt_field_count(stmt) && mysql_stmt_store_result(stmt)) + { + handle_error(command, mysql_stmt_errno(stmt), + mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds); + goto end; + } + + /* If we got here the statement was both executed and read successfully */ + handle_no_error(command); + if (!disable_result_log) + { + /* + Not all statements creates a result set. If there is one we can + now create another normal result set that contains the meta + data. This set can be handled almost like any other non prepared + statement result set. + */ + if ((res= mysql_stmt_result_metadata(stmt)) != NULL) + { + /* Take the column count from meta info */ + MYSQL_FIELD *fields= mysql_fetch_fields(res); + uint num_fields= mysql_num_fields(res); + + if (display_metadata) + append_metadata(ds, fields, num_fields); + + if (!display_result_vertically) + append_table_headings(ds, fields, num_fields); + + append_stmt_result(ds, stmt, fields, num_fields); + + mysql_free_result(res); /* Free normal result set with meta data */ + + /* + Normally, if there is a result set, we do not show warnings from the + prepare phase. This is because some warnings are generated both during + prepare and execute; this would generate different warning output + between normal and ps-protocol test runs. + + The --enable_prepare_warnings command can be used to change this so + that warnings from both the prepare and execute phase are shown. + */ + } + else + { + /* + This is a query without resultset + */ + } + + /* + Fetch info before fetching warnings, since it will be reset + otherwise. + */ + if (!disable_info) + append_info(ds, mysql_stmt_affected_rows(stmt), mysql_info(mysql)); + + if (display_session_track_info) + append_session_track_info(ds, mysql); + + + if (!disable_warnings) + { + /* Get the warnings from execute */ + + /* Append warnings to ds - if there are any */ + if (append_warnings(&ds_execute_warnings, mysql) || + ds_execute_warnings.length || + ds_warnings->length) + { + dynstr_append_mem(ds, "Warnings:\n", 10); + if (ds_warnings->length) + dynstr_append_mem(ds, ds_warnings->str, + ds_warnings->length); + if (ds_execute_warnings.length) + dynstr_append_mem(ds, ds_execute_warnings.str, + ds_execute_warnings.length); + } + } + } + +end: + if (!disable_warnings) + { + dynstr_free(&ds_execute_warnings); + } + + /* + We save the return code (mysql_stmt_errno(stmt)) from the last call sent + to the server into the mysqltest builtin variable $mysql_errno. This + variable then can be used from the test case itself. + */ + + var_set_errno(mysql_stmt_errno(stmt)); + + revert_properties(); + + /* Close the statement if reconnect, need new prepare */ + { +#ifndef EMBEDDED_LIBRARY + my_bool reconnect; + mysql_get_option(mysql, MYSQL_OPT_RECONNECT, &reconnect); + if (reconnect) +#else + if (mysql->reconnect) +#endif + { + if (cn->ps_params) + { + for (size_t i=0; iparam_count; i++) + { + my_free(cn->ps_params[i].buffer); + cn->ps_params[i].buffer= NULL; + } + my_free(cn->ps_params); + } + mysql_stmt_close(stmt); + cn->stmt= NULL; + cn->ps_params= NULL; + } + } + DBUG_VOID_RETURN; +} + +/* + close a prepared statement C API + + SYNPOSIS + run_close_stmt + mysql - mysql handle + command - current command pointer + query - query string to execute + query_len - length query string to execute + ds - output buffer where to store result form query + + RETURN VALUE + error - function will not return +*/ + +void run_close_stmt(struct st_connection *cn, struct st_command *command, + const char *query, size_t query_len, DYNAMIC_STRING *ds, + DYNAMIC_STRING *ds_warnings + ) +{ + MYSQL_STMT *stmt= cn->stmt; + DBUG_ENTER("run_close_stmt"); + DBUG_PRINT("query", ("'%-.60s'", query)); + + if (cn->ps_params) + { + + for (size_t i=0; iparam_count; i++) + { + my_free(cn->ps_params[i].buffer); + cn->ps_params[i].buffer= NULL; + } + my_free(cn->ps_params); + } + + /* Close the statement */ + if (stmt) + { + mysql_stmt_close(stmt); + cn->stmt= NULL; + } + cn->ps_params= NULL; + DBUG_VOID_RETURN; } @@ -8561,25 +9064,30 @@ int util_query(MYSQL* org_mysql, const char* query){ MYSQL* mysql; DBUG_ENTER("util_query"); - if(!(mysql= cur_con->util_mysql)) + if (service_connection_enabled) { - DBUG_PRINT("info", ("Creating util_mysql")); - if (!(mysql= mysql_init(mysql))) - die("Failed in mysql_init()"); + if(!(mysql= cur_con->util_mysql)) + { + DBUG_PRINT("info", ("Creating util_mysql")); + if (!(mysql= mysql_init(mysql))) + die("Failed in mysql_init()"); - if (opt_connect_timeout) - mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, - (void *) &opt_connect_timeout); + if (opt_connect_timeout) + mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, + (void *) &opt_connect_timeout); - /* enable local infile, in non-binary builds often disabled by default */ - mysql_options(mysql, MYSQL_OPT_LOCAL_INFILE, 0); - mysql_options(mysql, MYSQL_OPT_NONBLOCK, 0); - safe_connect(mysql, "util", org_mysql->host, org_mysql->user, - org_mysql->passwd, org_mysql->db, org_mysql->port, - org_mysql->unix_socket); + /* enable local infile, in non-binary builds often disabled by default */ + mysql_options(mysql, MYSQL_OPT_LOCAL_INFILE, 0); + mysql_options(mysql, MYSQL_OPT_NONBLOCK, 0); + safe_connect(mysql, "util", org_mysql->host, org_mysql->user, + org_mysql->passwd, org_mysql->db, org_mysql->port, + org_mysql->unix_socket); - cur_con->util_mysql= mysql; + cur_con->util_mysql= mysql; + } } + else + mysql= org_mysql; int ret= mysql_query(mysql, query); DBUG_RETURN(ret); @@ -8590,7 +9098,7 @@ int util_query(MYSQL* org_mysql, const char* query){ /* Run query - SYNPOSIS + SYNOPSIS run_query() mysql mysql handle command current command pointer @@ -8728,7 +9236,10 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) Collect warnings from create of the view that should otherwise have been produced when the SELECT was executed */ - append_warnings(&ds_warnings, cur_con->util_mysql); + append_warnings(&ds_warnings, + service_connection_enabled ? + cur_con->util_mysql : + mysql); } dynstr_free(&query_str); @@ -9308,7 +9819,7 @@ int main(int argc, char **argv) /* Init connections, allocate 1 extra as buffer + 1 for default */ connections= (struct st_connection*) my_malloc(PSI_NOT_INSTRUMENTED, (opt_max_connections+2) * sizeof(struct st_connection), - MYF(MY_WME | MY_ZEROFILL)); + MYF(MY_WME|MY_FAE|MY_ZEROFILL)); connections_end= connections + opt_max_connections +1; next_con= connections + 1; @@ -9382,6 +9893,7 @@ int main(int argc, char **argv) opt_ssl_capath, opt_ssl_cipher); mysql_options(con->mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); mysql_options(con->mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + mysql_options(con->mysql, MARIADB_OPT_TLS_VERSION, opt_tls_version); #if MYSQL_VERSION_ID >= 50000 /* Turn on ssl_verify_server_cert only if host is "localhost" */ opt_ssl_verify_server_cert= opt_host && !strcmp(opt_host, "localhost"); @@ -9607,6 +10119,10 @@ int main(int argc, char **argv) /* fall through */ case Q_QUERY: case Q_REAP: + case Q_PS_PREPARE: + case Q_PS_BIND: + case Q_PS_EXECUTE: + case Q_PS_CLOSE: { my_bool old_display_result_vertically= display_result_vertically; /* Default is full query, both reap and send */ @@ -9770,6 +10286,22 @@ int main(int argc, char **argv) case Q_ENABLE_PS_PROTOCOL: set_property(command, P_PS, ps_protocol); break; + case Q_DISABLE_VIEW_PROTOCOL: + set_property(command, P_VIEW, 0); + /* Close only util connections */ + close_util_connections(); + break; + case Q_ENABLE_VIEW_PROTOCOL: + set_property(command, P_VIEW, view_protocol); + break; + case Q_DISABLE_SERVICE_CONNECTION: + set_property(command, P_CONN, 0); + /* Close only util connections */ + close_util_connections(); + break; + case Q_ENABLE_SERVICE_CONNECTION: + set_property(command, P_CONN, view_protocol); + break; case Q_DISABLE_NON_BLOCKING_API: non_blocking_api_enabled= 0; break; @@ -10010,7 +10542,8 @@ void do_get_replace_column(struct st_command *command) die("Missing argument in %s", command->query); /* Allocate a buffer for results */ - start= buff= (char*)my_malloc(PSI_NOT_INSTRUMENTED, strlen(from)+1,MYF(MY_WME | MY_FAE)); + start= buff= (char*)my_malloc(PSI_NOT_INSTRUMENTED, strlen(from)+1, + MYF(MY_WME|MY_FAE)); while (*from) { char *to; @@ -10023,7 +10556,8 @@ void do_get_replace_column(struct st_command *command) command->query); to= get_string(&buff, &from, command); my_free(replace_column[column_number-1]); - replace_column[column_number-1]= my_strdup(PSI_NOT_INSTRUMENTED, to, MYF(MY_WME | MY_FAE)); + replace_column[column_number-1]= my_strdup(PSI_NOT_INSTRUMENTED, to, + MYF(MY_WME|MY_FAE)); set_if_bigger(max_replace_column, column_number); } my_free(start); @@ -10090,7 +10624,8 @@ void do_get_replace(struct st_command *command) bzero(&from_array,sizeof(from_array)); if (!*from) die("Missing argument in %s", command->query); - start= buff= (char*)my_malloc(PSI_NOT_INSTRUMENTED, strlen(from)+1,MYF(MY_WME | MY_FAE)); + start= buff= (char*)my_malloc(PSI_NOT_INSTRUMENTED, strlen(from)+1, + MYF(MY_WME|MY_FAE)); while (*from) { char *to= buff; @@ -10346,7 +10881,7 @@ void append_replace_regex(char* expr, char *expr_end, struct st_replace_regex* r /* Execute all substitutions on val. - Returns: true if substituition was made, false otherwise + Returns: true if substitution was made, false otherwise Side-effect: Sets r->buf to be the buffer with all substitutions done. IN: @@ -10440,7 +10975,7 @@ void free_replace_regex() /* - auxiluary macro used by reg_replace + auxiliary macro used by reg_replace makes sure the result buffer has sufficient length */ #define SECURE_REG_BUF if (buf_len < need_buf_len) \ @@ -10748,7 +11283,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count, DBUG_RETURN(0); found_sets=0; if (!(found_set= (FOUND_SET*) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(FOUND_SET)*max_length*count, - MYF(MY_WME)))) + MYF(MY_WME|MY_FAE)))) { free_sets(&sets); DBUG_RETURN(0); @@ -10758,7 +11293,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count, used_sets=-1; word_states=make_new_set(&sets); /* Start of new word */ start_states=make_new_set(&sets); /* This is first state */ - if (!(follow=(FOLLOWS*) my_malloc(PSI_NOT_INSTRUMENTED, (states+2)*sizeof(FOLLOWS),MYF(MY_WME)))) + if (!(follow=(FOLLOWS*) my_malloc(PSI_NOT_INSTRUMENTED, (states+2)*sizeof(FOLLOWS),MYF(MY_WME|MY_FAE)))) { free_sets(&sets); my_free(found_set); @@ -10925,7 +11460,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count, if ((replace=(REPLACE*) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(REPLACE)*(sets.count)+ sizeof(REPLACE_STRING)*(found_sets+1)+ sizeof(char *)*count+result_len, - MYF(MY_WME | MY_ZEROFILL)))) + MYF(MY_WME|MY_FAE|MY_ZEROFILL)))) { rep_str=(REPLACE_STRING*) (replace+sets.count); to_array= (char **) (rep_str+found_sets+1); @@ -10968,10 +11503,10 @@ int init_sets(REP_SETS *sets,uint states) bzero(sets, sizeof(*sets)); sets->size_of_bits=((states+7)/8); if (!(sets->set_buffer=(REP_SET*) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(REP_SET)*SET_MALLOC_HUNC, - MYF(MY_WME)))) + MYF(MY_WME|MY_FAE)))) return 1; if (!(sets->bit_buffer=(uint*) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(uint)*sets->size_of_bits* - SET_MALLOC_HUNC,MYF(MY_WME)))) + SET_MALLOC_HUNC,MYF(MY_WME|MY_FAE)))) { my_free(sets->set); return 1; @@ -10979,7 +11514,7 @@ int init_sets(REP_SETS *sets,uint states) return 0; } -/* Make help sets invisible for nicer codeing */ +/* Make help sets invisible for nicer coding */ void make_sets_invisible(REP_SETS *sets) { @@ -11167,10 +11702,10 @@ int insert_pointer_name(POINTER_ARRAY *pa,char * name) if (!(pa->typelib.type_names=(const char **) my_malloc(PSI_NOT_INSTRUMENTED, ((PC_MALLOC-MALLOC_OVERHEAD)/ (sizeof(char *)+sizeof(*pa->flag))* - (sizeof(char *)+sizeof(*pa->flag))),MYF(MY_WME)))) + (sizeof(char *)+sizeof(*pa->flag))),MYF(MY_WME|MY_FAE)))) DBUG_RETURN(-1); if (!(pa->str= (uchar*) my_malloc(PSI_NOT_INSTRUMENTED, PS_MALLOC - MALLOC_OVERHEAD, - MYF(MY_WME)))) + MYF(MY_WME|MY_FAE)))) { my_free(pa->typelib.type_names); DBUG_RETURN (-1); @@ -11359,7 +11894,7 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input, /* Sort array */ qsort(lines.buffer, lines.elements, - sizeof(char**), (qsort_cmp)comp_lines); + sizeof(uchar *), (qsort_cmp)comp_lines); /* Create new result */ for (i= 0; i < lines.elements ; i++) @@ -11380,9 +11915,8 @@ static int setenv(const char *name, const char *value, int overwrite) char *envvar= (char *)malloc(buflen); if(!envvar) return ENOMEM; - strcpy(envvar, name); - strcat(envvar, "="); - strcat(envvar, value); + + snprintf(envvar, buflen, "%s=%s", name, value); putenv(envvar); return 0; } diff --git a/cmake/abi_check.cmake b/cmake/abi_check.cmake index 98877be93518e..e4a783f3de5ed 100644 --- a/cmake/abi_check.cmake +++ b/cmake/abi_check.cmake @@ -38,7 +38,6 @@ IF(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND RUN_ABI_CHECK) SET(API_PREPROCESSOR_HEADER ${CMAKE_SOURCE_DIR}/include/mysql/plugin_audit.h ${CMAKE_SOURCE_DIR}/include/mysql/plugin_ftparser.h - ${CMAKE_SOURCE_DIR}/include/mysql.h ${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v1.h ${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v2.h ${CMAKE_SOURCE_DIR}/include/mysql/client_plugin.h diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 531352d03388d..961db1b13b073 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2011, 2021, MariaDB Corporation. +# Copyright (c) 2011, 2022, 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 @@ -106,10 +106,11 @@ ELSEIF(RPM) SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "") SET(WITH_EMBEDDED_SERVER ON CACHE BOOL "") SET(WITH_PCRE system CACHE STRING "") - IF(RPM MATCHES "fedora|centos|rhel") + SET(CLIENT_PLUGIN_ZSTD OFF) + IF(RPM MATCHES "fedora|centos|rhel|rocky|alma") SET(WITH_ROCKSDB_BZip2 OFF CACHE STRING "") ENDIF() - IF(RPM MATCHES "opensuse|sles|centos|rhel") + IF(RPM MATCHES "opensuse|sles|centos|rhel|rocky|alma") SET(WITH_ROCKSDB_LZ4 OFF CACHE STRING "") ENDIF() ELSEIF(DEB) @@ -120,6 +121,7 @@ ELSEIF(DEB) SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "") SET(WITH_EMBEDDED_SERVER ON CACHE BOOL "") SET(WITH_PCRE system CACHE STRING "") + SET(CLIENT_PLUGIN_ZSTD OFF) SET(WITH_ROCKSDB_BZip2 OFF CACHE STRING "") ELSE() SET(WITH_SSL bundled CACHE STRING "") diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index 172f65ab17c3e..34e97773c42c6 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -29,7 +29,7 @@ SET(CPACK_COMPONENT_BACKUP_GROUP "backup") SET(CPACK_COMPONENTS_ALL Server ManPagesServer IniFiles Server_Scripts SupportFiles Development ManPagesDevelopment - ManPagesTest Readme ManPagesClient Test + ManPagesTest Readme ManPagesClient Test Common Client SharedLibraries ClientPlugins backup ) @@ -155,6 +155,7 @@ SET(ignored "%ignore ${CMAKE_INSTALL_PREFIX}/share/doc" "%ignore ${CMAKE_INSTALL_PREFIX}/share/man" "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man1" + "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man3" "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man8" "%ignore ${CMAKE_INSTALL_PREFIX}/share/pkgconfig" ) @@ -197,6 +198,8 @@ SETA(CPACK_RPM_devel_PACKAGE_OBSOLETES "MySQL-devel") SETA(CPACK_RPM_devel_PACKAGE_PROVIDES "MySQL-devel") +SETA(CPACK_RPM_devel_PACKAGE_REQUIRES + "MariaDB-shared >= 10.2.42") SETA(CPACK_RPM_server_PACKAGE_OBSOLETES "MariaDB" @@ -268,7 +271,7 @@ 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") +ELSEIF(RPM MATCHES "(rhel|centos|rocky)[89]") SET(epoch 3:) ALTERNATIVE_NAME("backup" "mariadb-backup") ALTERNATIVE_NAME("client" "mariadb") @@ -338,7 +341,7 @@ IF(compat53 AND compat101) # RHEL6/CentOS6 install Postfix by default, and it requires # libmysqlclient.so.16 that pulls in mysql-libs-5.1.x # And the latter conflicts with our rpms. - # Make sure that for these distribuions all our rpms require + # Make sure that for these distributions all our rpms require # MariaDB-compat, that will replace mysql-libs-5.1 IF(RPM MATCHES "(rhel|centos)[67]") SET(CPACK_RPM_common_PACKAGE_REQUIRES "MariaDB-compat") @@ -358,9 +361,11 @@ MACRO(ADDIF var) ENDIF() ENDMACRO() +ADDIF(MYSQL_MAINTAINER_MODE) ADDIF(CMAKE_BUILD_TYPE) ADDIF(BUILD_CONFIG) ADDIF(WITH_SSL) +ADDIF(WITH_JEMALLOC) ENDIF() ENDIF(RPM) diff --git a/cmake/cpack_tgz.cmake b/cmake/cpack_tgz.cmake new file mode 100644 index 0000000000000..7dd9f397189cc --- /dev/null +++ b/cmake/cpack_tgz.cmake @@ -0,0 +1,10 @@ +IF(NOT RPM AND NOT DEB) + # + # use -DEXTRA_FILES='/path/to/file=where/to/install;/bin/dd=bin;...' + # + FOREACH(f ${EXTRA_FILES}) + STRING(REGEX REPLACE "=.*$" "" from ${f}) + STRING(REGEX REPLACE "^.*=" "" to ${f}) + INSTALL(PROGRAMS ${from} DESTINATION ${to}) + ENDFOREACH() +ENDIF() diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index 765f3be23e0f9..344f0b8ecbbeb 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -179,8 +179,8 @@ IF(WIN32) OPTION(SIGNCODE "Sign executables and dlls with digital certificate" OFF) MARK_AS_ADVANCED(SIGNCODE) IF(SIGNCODE) - SET(SIGNTOOL_PARAMETERS - /a /t http://timestamp.globalsign.com/?signature=sha2 + SET(SIGNTOOL_PARAMETERS + /a /fd SHA256 /t http://timestamp.globalsign.com/?signature=sha2 CACHE STRING "parameters for signtool (list)") IF(NOT SIGNTOOL_EXECUTABLE) FILE(GLOB path_list @@ -265,6 +265,11 @@ SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug FUNCTION(INSTALL_MYSQL_TEST from to) IF(INSTALL_MYSQLTESTDIR) + IF(NOT WITH_WSREP) + SET(EXCL_GALERA "(suite/(galera|wsrep|sys_vars/[rt]/(sysvars_)?wsrep).*|std_data/(galera|wsrep).*)") + ELSE() + SET(EXCL_GALERA "^DOES_NOT_EXIST$") + ENDIF() INSTALL( DIRECTORY ${from} DESTINATION "${INSTALL_MYSQLTESTDIR}/${to}" @@ -286,6 +291,7 @@ FUNCTION(INSTALL_MYSQL_TEST from to) PATTERN "*.vcxproj.user" EXCLUDE PATTERN "CTest*" EXCLUDE PATTERN "*~" EXCLUDE + REGEX "${EXCL_GALERA}" EXCLUDE ) ENDIF() ENDFUNCTION() diff --git a/cmake/libfmt.cmake b/cmake/libfmt.cmake index 6a26056956de7..7eaa0dfa0128e 100644 --- a/cmake/libfmt.cmake +++ b/cmake/libfmt.cmake @@ -26,6 +26,7 @@ ENDMACRO() MACRO (CHECK_LIBFMT) IF(WITH_LIBFMT STREQUAL "system" OR WITH_LIBFMT STREQUAL "auto") + SET(CMAKE_REQUIRED_INCLUDES ${LIBFMT_INCLUDE_DIR}) CHECK_CXX_SOURCE_COMPILES( "#define FMT_STATIC_THOUSANDS_SEPARATOR ',' #define FMT_HEADER_ONLY 1 @@ -37,6 +38,7 @@ MACRO (CHECK_LIBFMT) std::cout << fmt::vformat(\"The answer is {}.\", fmt::format_args(&arg, 1)); }" HAVE_SYSTEM_LIBFMT) + SET(CMAKE_REQUIRED_INCLUDES) ENDIF() IF(NOT HAVE_SYSTEM_LIBFMT OR WITH_LIBFMT STREQUAL "bundled") IF (WITH_LIBFMT STREQUAL "system") diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake index f8eaf082448d7..74853c36a74b4 100644 --- a/cmake/libutils.cmake +++ b/cmake/libutils.cmake @@ -154,7 +154,11 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE) # (can be a static or shared lib) IF(LIB_TYPE STREQUAL "STATIC_LIBRARY") SET(STATIC_TGTS ${STATIC_TGTS} ${LIB}) - SET(STATIC_LIBS ${STATIC_LIBS} $) + IF(MSVC) + TARGET_LINK_LIBRARIES(${TARGET} PRIVATE ${LIB}) + ELSE() + SET(STATIC_LIBS ${STATIC_LIBS} $) + ENDIF() ADD_DEPENDENCIES(${TARGET} ${LIB}) # Extract dependent OS libraries GET_DEPENDEND_OS_LIBS(${LIB} LIB_OSLIBS) diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake index 038251c40e23c..dfc725c36b918 100644 --- a/cmake/maintainer.cmake +++ b/cmake/maintainer.cmake @@ -23,8 +23,11 @@ ENDIF() SET(MY_WARNING_FLAGS -Wall -Wdeclaration-after-statement + -Wenum-compare + -Wenum-conversion -Wextra -Wformat-security + -Wmissing-braces -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare diff --git a/cmake/mysql_add_executable.cmake b/cmake/mysql_add_executable.cmake index 426bdaf18968e..06bdfce14de46 100644 --- a/cmake/mysql_add_executable.cmake +++ b/cmake/mysql_add_executable.cmake @@ -22,7 +22,7 @@ # - instruct CPack to install executable under ${CMAKE_INSTALL_PREFIX}/bin directory # On Windows : # - add version resource -# - instruct CPack to do autenticode signing if SIGNCODE is set +# - instruct CPack to do authenticode signing if SIGNCODE is set INCLUDE(CMakeParseArguments) diff --git a/cmake/os/Darwin.cmake b/cmake/os/Darwin.cmake deleted file mode 100644 index 21e18360dfe98..0000000000000 --- a/cmake/os/Darwin.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2010, 2014, 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA - -# This file includes OSX specific options and quirks, related to system checks diff --git a/cmake/os/FreeBSD.cmake b/cmake/os/FreeBSD.cmake index 9d3673aae865e..e1c764692bc53 100644 --- a/cmake/os/FreeBSD.cmake +++ b/cmake/os/FreeBSD.cmake @@ -28,7 +28,3 @@ SET(EXECINFO_ROOT /usr/local CACHE INTERNAL "Where to find execinfo library and INCLUDE_DIRECTORIES(${EXECINFO_ROOT}/include) SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${EXECINFO_ROOT}/include) SET(ENV{LIB} "$ENV{LIB}:${EXECINFO_ROOT}/lib") -FIND_LIBRARY(EXECINFO NAMES execinfo) -IF(EXECINFO) - SET(LIBEXECINFO ${EXECINFO}) -ENDIF() diff --git a/cmake/os/OpenBSD.cmake b/cmake/os/OpenBSD.cmake deleted file mode 100644 index c8b91944275a0..0000000000000 --- a/cmake/os/OpenBSD.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2012 Monty Program Ab, 2021 Brad Smith -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA - -# This file includes OpenBSD specific options and quirks, related to system checks - -# Find libexecinfo (library that contains backtrace_symbols etc) -FIND_LIBRARY(EXECINFO NAMES execinfo) -IF(EXECINFO) - SET(LIBEXECINFO ${EXECINFO}) -ENDIF() diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index da75c73d585b7..f951eed765148 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -177,8 +177,20 @@ IF(MSVC) IF((NOT "${${flag}}" MATCHES "/Zi") AND (NOT "${${flag}}" MATCHES "/Z7")) STRING(APPEND ${flag} " /Zi") ENDIF() + # Remove inlining flags, added by CMake, if any. + # Compiler default is fine. + STRING(REGEX REPLACE "/Ob[0-3]" "" "${flag}" "${${flag}}" ) ENDFOREACH() + # Allow to overwrite the inlining flag + SET(MSVC_INLINE "" CACHE STRING + "MSVC Inlining option, either empty, or one of /Ob0,/Ob1,/Ob2,/Ob3") + IF(MSVC_INLINE MATCHES "/Ob[0-3]") + ADD_COMPILE_OPTIONS(${MSVC_INLINE}) + ELSEIF(NOT(MSVC_INLINE STREQUAL "")) + MESSAGE(FATAL_ERROR "Invalid option for MSVC_INLINE") + ENDIF() + IF(WITH_ASAN OR WITH_UBSAN) # Workaround something Linux specific SET(SECURITY_HARDENED 0 CACHE INTERNAL "" FORCE) diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index 9b855dbb42b8a..6cd19262a3c76 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -63,6 +63,10 @@ SET(HAVE_GETHOSTBYADDR_R CACHE INTERNAL "") SET(HAVE_GETHRTIME CACHE INTERNAL "") SET(HAVE_GETPAGESIZE CACHE INTERNAL "") SET(HAVE_GETPASS CACHE INTERNAL "") +SET(HAVE_GETMNTENT CACHE INTERNAL "") +SET(HAVE_GETMNTENT_IN_SYS_MNTAB CACHE INTERNAL "") +SET(HAVE_GETMNTINFO CACHE INTERNAL "") +SET(HAVE_GETMNTINFO64 CACHE INTERNAL "") SET(HAVE_GETPASSPHRASE CACHE INTERNAL "") SET(HAVE_GETPWNAM CACHE INTERNAL "") SET(HAVE_GETPWUID CACHE INTERNAL "") @@ -93,7 +97,6 @@ SET(HAVE_MALLINFO CACHE INTERNAL "") SET(HAVE_MALLINFO2 CACHE INTERNAL "") SET(HAVE_MALLOC_H 1 CACHE INTERNAL "") SET(HAVE_MALLOC_ZONE CACHE INTERNAL "") -SET(HAVE_MEMALIGN CACHE INTERNAL "") SET(HAVE_MEMCPY 1 CACHE INTERNAL "") SET(HAVE_MEMMOVE 1 CACHE INTERNAL "") SET(HAVE_MEMORY_H 1 CACHE INTERNAL "") @@ -146,6 +149,7 @@ SET(HAVE_SELECT 1 CACHE INTERNAL "") SET(HAVE_SELECT_H CACHE INTERNAL "") SET(HAVE_SETENV CACHE INTERNAL "") SET(HAVE_SETLOCALE 1 CACHE INTERNAL "") +SET(HAVE_SETMNTENT CACHE INTERNAL "") SET(HAVE_SIGACTION CACHE INTERNAL "") SET(HAVE_SIGINT 1 CACHE INTERNAL "") SET(HAVE_SIGPIPE CACHE INTERNAL "") @@ -296,6 +300,11 @@ SET(HAVE_SOCKPEERCRED CACHE INTERNAL "") SET(HAVE_ABI_CXA_DEMANGLE CACHE INTERNAL "") SET(HAVE_GCC_C11_ATOMICS CACHE INTERNAL "") SET(HAVE_VISIBILITY_HIDDEN CACHE INTERNAL "") +SET(HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC CACHE INTERNAL "") +SET(HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC CACHE INTERNAL "") +SET(HAVE_MPROTECT CACHE INTERNAL "") +SET(HAVE_C__Werror CACHE INTERNAL "") +SET(HAVE_NANOSLEEP CACHE INTERNAL "") SET(HAVE_ACCEPT4 CACHE INTERNAL "") SET(HAVE_LINK_H CACHE INTERNAL "") SET(HAVE_DLADDR CACHE INTERNAL "") diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake index 678556c9a5975..65dc2ae28f67d 100644 --- a/cmake/pcre.cmake +++ b/cmake/pcre.cmake @@ -19,12 +19,21 @@ MACRO(BUNDLE_PCRE2) SET(intdir) ENDIF() - SET(file ${dir}/src/pcre2-build/${intdir}${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}) + # PCRE names static libraries differently depending on platform. + # On Windows, but not elsewhere, it adds "-static" to the library name, + # or "-staticd". + IF(WIN32) + SET(PCRE_STATIC "-static") + ELSE() + SET(PCRE_STATIC "") + ENDIF() + + SET(file ${dir}/src/pcre2-build/${intdir}${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${PCRE_STATIC}${CMAKE_STATIC_LIBRARY_SUFFIX}) IF(WIN32) # Debug libary name. # Same condition as in pcre2 CMakeLists.txt that adds "d" - SET(file_d ${dir}/src/pcre2-build/${intdir}${CMAKE_STATIC_LIBRARY_PREFIX}${lib}d${CMAKE_STATIC_LIBRARY_SUFFIX}) + SET(file_d ${dir}/src/pcre2-build/${intdir}${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${PCRE_STATIC}d${CMAKE_STATIC_LIBRARY_SUFFIX}) SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LOCATION_DEBUG ${file_d}) ELSE() SET(file_d) @@ -34,6 +43,7 @@ MACRO(BUNDLE_PCRE2) ENDFOREACH() FOREACH(v "" "_DEBUG" "_RELWITHDEBINFO" "_RELEASE" "_MINSIZEREL") STRING(REPLACE "/WX" "" pcre2_flags${v} "${CMAKE_C_FLAGS${v}}") + SET(pcre2_flags${v} "${pcre2_flags${v}} -std=c99 ") IF(MSVC) # Suppress a warning STRING(APPEND pcre2_flags${v} " /wd4244 " ) @@ -44,8 +54,8 @@ MACRO(BUNDLE_PCRE2) ExternalProject_Add( pcre2 PREFIX "${dir}" - URL "https://github.com/PhilipHazel/pcre2/releases/download/pcre2-10.37/pcre2-10.37.zip" - URL_MD5 8c1699a725d4b28410adf4b964ebbcb7 + URL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.zip" + URL_MD5 fe90992fbfb03f854bd9f344074f49eb INSTALL_COMMAND "" CMAKE_ARGS "-DCMAKE_WARN_DEPRECATED=FALSE" diff --git a/cmake/readline.cmake b/cmake/readline.cmake index c8bbc7fc259c2..9c35d8c7d2258 100644 --- a/cmake/readline.cmake +++ b/cmake/readline.cmake @@ -59,7 +59,7 @@ MACRO (FIND_CURSES) remove CMakeCache.txt and rerun cmake.") IF(CMAKE_SYSTEM_NAME MATCHES "Linux") SET(ERRORMSG ${ERRORMSG} - "On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates " + "On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivatives " "it is ncurses-devel.") ENDIF() MESSAGE(FATAL_ERROR ${ERRORMSG}) diff --git a/cmake/sign.cmake.in b/cmake/sign.cmake.in index 50768a3dcc919..6b0fa8b128fe8 100644 --- a/cmake/sign.cmake.in +++ b/cmake/sign.cmake.in @@ -1,6 +1,6 @@ # If timestamping is used, it can (rarely) fail, when public timestamping service has issues. # -# To handle the error gracefully and tranparently, we'll retry the signtool command, +# To handle the error gracefully and transparently, we'll retry the signtool command, # second time without "/t URL" parameter SET(SIGNTOOL_PARAMETERS_NO_TIMESTAMP "@SIGNTOOL_PARAMETERS@") LIST(FIND SIGNTOOL_PARAMETERS_NO_TIMESTAMP /t idx) diff --git a/cmake/submodules.cmake b/cmake/submodules.cmake index 91f9f9e487a59..34dcfbea77ae5 100644 --- a/cmake/submodules.cmake +++ b/cmake/submodules.cmake @@ -17,20 +17,29 @@ IF(GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git") ${GIT_EXECUTABLE} config cmake.update-submodules yes") ELSEIF(git_config_get_result EQUAL 128) SET(update_result 0) - ELSEIF (cmake_update_submodules MATCHES force) - MESSAGE(STATUS "Updating submodules (forced)") - EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --force --recursive --depth=1 - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" - RESULT_VARIABLE update_result) - ELSEIF (cmake_update_submodules MATCHES yes) - EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --recursive --depth=1 - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" - RESULT_VARIABLE update_result) ELSE() - MESSAGE(STATUS "Updating submodules") - EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --recursive --depth=1 - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" - RESULT_VARIABLE update_result) + SET(UPDATE_SUBMODULES_COMMAND + "${GIT_EXECUTABLE}" submodule update --init --recursive) + # Old Git may not work with "--depth 1". + # See also: https://github.com/git/git/commit/fb43e31f2b43076e7a30c9cd00d0241cb8cf97eb + IF(NOT GIT_VERSION_STRING VERSION_LESS "2.8.0") + SET(UPDATE_SUBMODULES_COMMAND ${UPDATE_SUBMODULES_COMMAND} --depth 1) + ENDIF() + IF(cmake_update_submodules MATCHES force) + MESSAGE(STATUS "Updating submodules (forced)") + EXECUTE_PROCESS(COMMAND ${UPDATE_SUBMODULES_COMMAND} --force + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE update_result) + ELSEIF(cmake_update_submodules MATCHES yes) + EXECUTE_PROCESS(COMMAND ${UPDATE_SUBMODULES_COMMAND} + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE update_result) + ELSE() + MESSAGE(STATUS "Updating submodules") + EXECUTE_PROCESS(COMMAND ${UPDATE_SUBMODULES_COMMAND} + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE update_result) + ENDIF() ENDIF() ENDIF() diff --git a/cmake/systemd.cmake b/cmake/systemd.cmake index 303b3a25aa98c..0f37acd2afe47 100644 --- a/cmake/systemd.cmake +++ b/cmake/systemd.cmake @@ -17,7 +17,7 @@ MACRO(CHECK_SYSTEMD) IF(UNIX) INCLUDE(FindPkgConfig) # http://www.cmake.org/cmake/help/v3.0/module/FindPkgConfig.html - SET(WITH_SYSTEMD "auto" CACHE STRING "Enable systemd scripts and notification support") + SET(WITH_SYSTEMD "auto" CACHE STRING "Enable systemd scripts and notification support. Allowed values yes/no/auto.") IF(WITH_SYSTEMD STREQUAL "yes" OR WITH_SYSTEMD STREQUAL "auto") IF(PKG_CONFIG_FOUND) IF (NOT DEFINED LIBSYSTEMD_FOUND) @@ -45,7 +45,10 @@ MACRO(CHECK_SYSTEMD) IF(HAVE_SYSTEMD_SD_DAEMON_H AND HAVE_SYSTEMD_SD_LISTEN_FDS AND HAVE_SYSTEMD_SD_NOTIFY AND HAVE_SYSTEMD_SD_NOTIFYF) SET(HAVE_SYSTEMD TRUE) - SET(SYSTEMD_SCRIPTS mariadb-service-convert galera_new_cluster galera_recovery) + SET(SYSTEMD_SCRIPTS mariadb-service-convert) + IF(WITH_WSREP) + SET(SYSTEMD_SCRIPTS ${SYSTEMD_SCRIPTS} galera_new_cluster galera_recovery) + ENDIF() IF(DEB) SET(SYSTEMD_EXECSTARTPRE "ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld") SET(SYSTEMD_EXECSTARTPOST "ExecStartPost=/etc/mysql/debian-start") @@ -54,6 +57,13 @@ MACRO(CHECK_SYSTEMD) SET(SYSTEMD_LIMIT "# For liburing and io_uring_setup() LimitMEMLOCK=524288") ENDIF() + + IF(NOT DEB AND NOT RPM) + SET(SYSTEMD_READWRITEPATH "# Database dir: '${MYSQL_DATADIR}' should be writable even +# ProtectSystem=full prevents it +ReadWritePaths=-${MYSQL_DATADIR}\n") + ENDIF() + MESSAGE_ONCE(systemd "Systemd features enabled") ELSE() UNSET(LIBSYSTEMD) diff --git a/cmake/zlib.cmake b/cmake/zlib.cmake index 628bbf15f6732..9e085189e4f58 100644 --- a/cmake/zlib.cmake +++ b/cmake/zlib.cmake @@ -26,7 +26,7 @@ ENDMACRO() # # Provides the following configure options: # WITH_ZLIB_BUNDLED -# If this is set,we use bindled zlib +# If this is set,we use bundled zlib # If this is not set,search for system zlib. # if system zlib is not found, use bundled copy # ZLIB_LIBRARIES, ZLIB_INCLUDE_DIR and ZLIB_SOURCES diff --git a/config.h.cmake b/config.h.cmake index 44ae067daadb0..e8712d16ba6a6 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -34,6 +34,11 @@ #cmakedefine HAVE_FLOAT_H 1 #cmakedefine HAVE_FNMATCH_H 1 #cmakedefine HAVE_FPU_CONTROL_H 1 +#cmakedefine HAVE_GETMNTENT 1 +#cmakedefine HAVE_GETMNTENT_IN_SYS_MNTAB 1 +#cmakedefine HAVE_GETMNTINFO 1 +#cmakedefine HAVE_GETMNTINFO64 1 +#cmakedefine HAVE_GETMNTINFO_TAKES_statvfs 1 #cmakedefine HAVE_GRP_H 1 #cmakedefine HAVE_IA64INTRIN_H 1 #cmakedefine HAVE_IEEEFP_H 1 @@ -163,7 +168,6 @@ #cmakedefine HAVE_LRAND48 1 #cmakedefine HAVE_LOCALTIME_R 1 #cmakedefine HAVE_LSTAT 1 -#cmakedefine HAVE_MEMALIGN 1 /* #cmakedefine HAVE_MLOCK 1 see Bug#54662 */ #cmakedefine HAVE_NL_LANGINFO 1 #cmakedefine HAVE_MADVISE 1 @@ -210,6 +214,7 @@ #cmakedefine HAVE_SELECT 1 #cmakedefine HAVE_SETENV 1 #cmakedefine HAVE_SETLOCALE 1 +#cmakedefine HAVE_SETMNTENT 1 #cmakedefine HAVE_SETUPTERM 1 #cmakedefine HAVE_SIGSET 1 #cmakedefine HAVE_SIGACTION 1 @@ -217,7 +222,6 @@ #cmakedefine HAVE_SIGWAIT 1 #cmakedefine HAVE_SIGWAITINFO 1 #cmakedefine HAVE_SLEEP 1 -#cmakedefine HAVE_SNPRINTF 1 #cmakedefine HAVE_STPCPY 1 #cmakedefine HAVE_STRERROR 1 #cmakedefine HAVE_STRCOLL 1 @@ -252,9 +256,6 @@ #cmakedefine STRUCT_TIMESPEC_HAS_TV_SEC 1 #cmakedefine STRUCT_TIMESPEC_HAS_TV_NSEC 1 -#define USE_MB 1 -#define USE_MB_IDENT 1 - /* this means that valgrind headers and macros are available */ #cmakedefine HAVE_VALGRIND_MEMCHECK_H 1 @@ -450,8 +451,8 @@ #cmakedefine MYSQL_DEFAULT_CHARSET_NAME "@MYSQL_DEFAULT_CHARSET_NAME@" #cmakedefine MYSQL_DEFAULT_COLLATION_NAME "@MYSQL_DEFAULT_COLLATION_NAME@" -#cmakedefine USE_MB 1 -#cmakedefine USE_MB_IDENT 1 +#cmakedefine USE_MB +#cmakedefine USE_MB_IDENT /* This should mean case insensitive file system */ #cmakedefine FN_NO_CASE_SENSE 1 @@ -561,3 +562,5 @@ #endif // !defined(__STDC_FORMAT_MACROS) #endif + +#cmakedefine HAVE_VFORK 1 diff --git a/configure.cmake b/configure.cmake index 3b6717da35859..b13d527742bc9 100644 --- a/configure.cmake +++ b/configure.cmake @@ -134,6 +134,8 @@ IF(UNIX) IF(NOT LIBRT) MY_SEARCH_LIBS(clock_gettime rt LIBRT) ENDIF() + MY_SEARCH_LIBS(backtrace_symbols_fd execinfo LIBEXECINFO) + set(THREADS_PREFER_PTHREAD_FLAG ON) FIND_PACKAGE(Threads) @@ -405,7 +407,6 @@ 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) CHECK_FUNCTION_EXISTS (stpcpy HAVE_STPCPY) CHECK_FUNCTION_EXISTS (strcoll HAVE_STRCOLL) CHECK_FUNCTION_EXISTS (strerror HAVE_STRERROR) @@ -421,7 +422,6 @@ CHECK_FUNCTION_EXISTS (thr_setconcurrency HAVE_THR_SETCONCURRENCY) CHECK_FUNCTION_EXISTS (thr_yield HAVE_THR_YIELD) CHECK_FUNCTION_EXISTS (vasprintf HAVE_VASPRINTF) CHECK_FUNCTION_EXISTS (vsnprintf HAVE_VSNPRINTF) -CHECK_FUNCTION_EXISTS (memalign HAVE_MEMALIGN) CHECK_FUNCTION_EXISTS (nl_langinfo HAVE_NL_LANGINFO) IF(HAVE_SYS_EVENT_H) @@ -863,9 +863,16 @@ MARK_AS_ADVANCED(NO_ALARM) CHECK_CXX_SOURCE_COMPILES(" int main() { - long long int var= 1; - long long int *ptr= &var; - return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST); + char x=1; + short y=1; + int z=1; + long w = 1; + long long s = 1; + x = __atomic_add_fetch(&x, 1, __ATOMIC_SEQ_CST); + y = __atomic_add_fetch(&y, 1, __ATOMIC_SEQ_CST); + z = __atomic_add_fetch(&z, 1, __ATOMIC_SEQ_CST); + w = __atomic_add_fetch(&w, 1, __ATOMIC_SEQ_CST); + return (int)__atomic_load_n(&s, __ATOMIC_SEQ_CST); }" HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC) IF (HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC) @@ -876,9 +883,16 @@ ELSE() CHECK_CXX_SOURCE_COMPILES(" int main() { - long long int var= 1; - long long int *ptr= &var; - return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST); + char x=1; + short y=1; + int z=1; + long w = 1; + long long s = 1; + x = __atomic_add_fetch(&x, 1, __ATOMIC_SEQ_CST); + y = __atomic_add_fetch(&y, 1, __ATOMIC_SEQ_CST); + z = __atomic_add_fetch(&z, 1, __ATOMIC_SEQ_CST); + w = __atomic_add_fetch(&w, 1, __ATOMIC_SEQ_CST); + return (int)__atomic_load_n(&s, __ATOMIC_SEQ_CST); }" HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC) IF(HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC) @@ -969,3 +983,19 @@ IF(NOT MSVC) HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE ) ENDIF() + +MY_CHECK_C_COMPILER_FLAG("-Werror") +IF(have_C__Werror) + SET(SAVE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") + CHECK_C_SOURCE_COMPILES(" + #include + int main() + { + pid_t pid=vfork(); + return (int)pid; + }" + HAVE_VFORK + ) + SET(CMAKE_REQUIRED_FLAGS ${SAVE_CMAKE_REQUIRED_FLAGS}) +ENDIF() diff --git a/dbug/dbug.c b/dbug/dbug.c index 548d82d03e673..ac645c6445408 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -55,7 +55,7 @@ * * Michael Widenius: * DBUG_DUMP - To dump a block of memory. - * PUSH_FLAG "O" - To be used insted of "o" if we + * PUSH_FLAG "O" - To be used instead of "o" if we * want flushing after each write * PUSH_FLAG "A" - as 'O', but we will append to the out file instead * of creating a new one. @@ -86,7 +86,7 @@ #include #include #ifdef HAVE_gcov -extern void __gcov_flush(); +#include #endif #ifndef DBUG_OFF @@ -511,7 +511,7 @@ static int DbugParse(CODE_STATE *cs, const char *control) stack->delay= stack->next->delay; stack->maxdepth= stack->next->maxdepth; stack->sub_level= stack->next->sub_level; - strcpy(stack->name, stack->next->name); + safe_strcpy(stack->name, sizeof(stack->name), stack->next->name); stack->out_file= stack->next->out_file; stack->out_file->used++; if (stack->next == &init_settings) @@ -1997,11 +1997,10 @@ static void DBUGOpenFile(CODE_STATE *cs, static void DBUGCloseFile(CODE_STATE *cs, sFILE *new_value) { sFILE *fp; - if (!cs || !cs->stack || !cs->stack->out_file) + if (!cs || !cs->stack || !(fp= cs->stack->out_file)) return; - fp= cs->stack->out_file; - if (--fp->used == 0) + if (fp != sstdout && fp != sstderr && --fp->used == 0) { if (fclose(fp->file) == EOF) { @@ -2213,7 +2212,7 @@ void _db_suicide_() fprintf(stderr, "SIGKILL myself\n"); fflush(stderr); #ifdef HAVE_gcov - __gcov_flush(); + __gcov_dump(); #endif retval= kill(getpid(), SIGKILL); @@ -2263,7 +2262,7 @@ my_bool _db_my_assert(const char *file, int line, const char *msg) fprintf(stderr, "%s:%d: assert: %s\n", file, line, msg); fflush(stderr); #ifdef HAVE_gcov - __gcov_flush(); + __gcov_dump(); #endif } return a; diff --git a/dbug/my_main.c b/dbug/my_main.c index 2b3e92b53cc2e..80db4d82e06cb 100644 --- a/dbug/my_main.c +++ b/dbug/my_main.c @@ -7,9 +7,7 @@ #include #include -int main (argc, argv) -int argc; -char *argv[]; +int main (int argc, char **argv) { register int result, ix; extern int factorial(int); diff --git a/dbug/user.r b/dbug/user.r index c9a9126069ab9..bd0cfe381b179 100644 --- a/dbug/user.r +++ b/dbug/user.r @@ -835,7 +835,7 @@ EX:\fC Unlocks DBUG_FILE stream, that was locked with a DBUG_LOCK_FILE. .LI DBUG_ASSERT\ This macro just does a regular assert(). The difference is that it will be -disabled by DBUG_OFF togeher with the +disabled by DBUG_OFF together with the .I dbug library. So there will be no need to disable asserts separately with NDEBUG. .SP 1 @@ -1103,7 +1103,7 @@ will usually have problems using the standard package. The most common problem is multiply allocated memory. .SP 2 -.\" .DE nroff dident like this. davida 900108 +.\" .DE nroff didn't like this. davida 900108 .CS .\" vim:filetype=nroff diff --git a/debian/additions/debian-start b/debian/additions/debian-start index ffe635dc8836a..2a8b61ddaff09 100755 --- a/debian/additions/debian-start +++ b/debian/additions/debian-start @@ -17,12 +17,12 @@ if [ -f /etc/default/mariadb ]; then . /etc/default/mariadb fi -MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf" -MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" -# Don't run full mysql_upgrade on every server restart, use --version-check to do it only once -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" +MARIADB="/usr/bin/mariadb --defaults-file=/etc/mysql/debian.cnf" +MYADMIN="/usr/bin/mariadb-admin --defaults-file=/etc/mysql/debian.cnf" +# Don't run full mariadb-upgrade on every server restart, use --version-check to do it only once +MYUPGRADE="/usr/bin/mariadb-upgrade --defaults-extra-file=/etc/mysql/debian.cnf --version-check --silent" +MYCHECK="/usr/bin/mariadb-check --defaults-file=/etc/mysql/debian.cnf" +MYCHECK_SUBJECT="WARNING: mariadb-check has found corrupt tables" MYCHECK_PARAMS="--all-databases --fast --silent" MYCHECK_RCPT="${MYCHECK_RCPT:-root}" diff --git a/debian/additions/debian-start.inc.sh b/debian/additions/debian-start.inc.sh index 005aa290866b3..74340e7848007 100755 --- a/debian/additions/debian-start.inc.sh +++ b/debian/additions/debian-start.inc.sh @@ -11,7 +11,7 @@ function check_for_crashed_tables() { set -u # But do it in the background to not stall the boot process. - logger -p daemon.info -i -t$0 "Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables" + logger -p daemon.info -i -t"$0" "Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables" # Checking for $? is unreliable so the size of the output is checked. # Some table handlers like HEAP do not support CHECK TABLE. @@ -20,15 +20,15 @@ function check_for_crashed_tables() { # We have to use xargs in this case, because a for loop barfs on the # spaces in the thing to be looped over. - # If a crashed table is encountered, the "mysql" command will return with a status different from 0 + # If a crashed table is encountered, the "mariadb" command will return with a status different from 0 set +e - LC_ALL=C $MYSQL --skip-column-names --batch -e ' + LC_ALL=C $MARIADB --skip-column-names --batch -e ' select concat('\''select count(*) into @discard from `'\'', TABLE_SCHEMA, '\''`.`'\'', TABLE_NAME, '\''`'\'') from information_schema.TABLES where TABLE_SCHEMA<>'\''INFORMATION_SCHEMA'\'' and TABLE_SCHEMA<>'\''PERFORMANCE_SCHEMA'\'' and ( ENGINE='\''MyISAM'\'' or ENGINE='\''Aria'\'' )' | \ - xargs -i $MYSQL --skip-column-names --silent --batch \ - --force -e "{}" &>$tempfile + xargs -i ${MARIADB} --skip-column-names --silent --batch \ + --force -e "{}" &>"${tempfile}" set -e if [ -s "$tempfile" ]; then @@ -37,14 +37,14 @@ function check_for_crashed_tables() { "Improperly closed tables are also reported if clients are accessing\n" \ "the tables *now*. A list of current connections is below.\n"; $MYADMIN processlist status - ) >> $tempfile + ) >> "${tempfile}" # Check for presence as a dependency on mailx would require an MTA. if [ -x /usr/bin/mailx ]; then - mailx -e -s"$MYCHECK_SUBJECT" $MYCHECK_RCPT < $tempfile + mailx -e -s"$MYCHECK_SUBJECT" $MYCHECK_RCPT < "$tempfile" fi - (echo "$MYCHECK_SUBJECT"; cat $tempfile) | logger -p daemon.warn -i -t$0 + (echo "$MYCHECK_SUBJECT"; cat "${tempfile}") | logger -p daemon.warn -i -t"$0" fi - rm $tempfile + rm "${tempfile}" } ## Check for tables needing an upgrade. @@ -54,14 +54,14 @@ function upgrade_system_tables_if_necessary() { set -e set -u - logger -p daemon.info -i -t$0 "Upgrading MySQL tables if necessary." + logger -p daemon.info -i -t"$0" "Upgrading MySQL tables if necessary." # Filter all "duplicate column", "duplicate key" and "unknown column" # errors as the script is designed to be idempotent. LC_ALL=C $MYUPGRADE \ 2>&1 \ | egrep -v '^(1|@had|ERROR (1051|1054|1060|1061|1146|1347|1348))' \ - | logger -p daemon.warn -i -t$0 + | logger -p daemon.warn -i -t"$0" } ## Check for the presence of both, root accounts with and without password. @@ -70,10 +70,10 @@ function check_root_accounts() { set -e set -u - logger -p daemon.info -i -t$0 "Checking for insecure root accounts." + logger -p daemon.info -i -t"$0" "Checking for insecure root accounts." - ret=$( echo "SELECT count(*) FROM mysql.user WHERE user='root' and password='' and plugin in ('', 'mysql_native_password', 'mysql_old_password');" | $MYSQL --skip-column-names ) + ret=$( echo "SELECT count(*) FROM mysql.user WHERE user='root' and password='' and plugin in ('', 'mysql_native_password', 'mysql_old_password');" | $MARIADB --skip-column-names ) if [ "$ret" -ne "0" ]; then - logger -p daemon.warn -i -t$0 "WARNING: mysql.user contains $ret root accounts without password!" + logger -p daemon.warn -i -t"$0" "WARNING: mysql.user contains $ret root accounts without password!" fi } diff --git a/debian/additions/innotop/innotop b/debian/additions/innotop/innotop index 5d81980341dec..2bc090917fe1b 100644 --- a/debian/additions/innotop/innotop +++ b/debian/additions/innotop/innotop @@ -4933,7 +4933,7 @@ sub noecho_password { }; if ( $EVAL_ERROR ) { - die "Cannot read respose; is Term::ReadKey installed? $EVAL_ERROR"; + die "Cannot read response; is Term::ReadKey installed? $EVAL_ERROR"; } return $response; } diff --git a/debian/additions/mariadb-report b/debian/additions/mariadb-report index 5c9761e071097..b95f226b73798 100755 --- a/debian/additions/mariadb-report +++ b/debian/additions/mariadb-report @@ -239,26 +239,56 @@ sub get_user_mycnf sub connect_to_MySQL { - print "connect_to_MySQL\n" if $op{debug}; - - my $dsn; - - if($mycnf{'socket'} && -S $mycnf{'socket'}) - { - $dsn = "DBI:MariaDB:mariadb_socket=$mycnf{socket}"; - } - elsif($mycnf{'host'}) - { - $dsn = "DBI:MariaDB:host=$mycnf{host}" . ($mycnf{port} ? ";port=$mycnf{port}" : ""); - } - else - { - $dsn = "DBI:MariaDB:host=localhost"; - } - - print "connect_to_MySQL: DBI DSN: $dsn\n" if $op{debug}; - - $dbh = DBI->connect($dsn, $mycnf{'user'}, $mycnf{'pass'}) or die; + print "connect_to_MySQL\n" if $op{debug}; + + if(my @driverList = grep {/mariadb|mysql/i} DBI->available_drivers()) { + my $dsn; + my $driver = undef; + + if(grep {/mariadb/i} @driverList) + { + $driver = "DBI:MariaDB"; + } + elsif(grep {/mysql/i} @driverList) + { + $driver = "DBI:mysql"; + } + + if($mycnf{'socket'} && -S $mycnf{'socket'}) + { + if(grep {/mariadb/i} @driverList) + { + $dsn = $driver . ":mariadb_socket=$mycnf{socket}"; + } + elsif(grep {/mysql/i} @driverList) + { + $dsn = $driver . ":mysql_socket=$mycnf{socket}"; + } + } + elsif($mycnf{'host'}) + { + $dsn = $driver . ":host=$mycnf{host}" . ($mycnf{port} ? ";port=$mycnf{port}" : ""); + } + else + { + $dsn = $driver . ":host=localhost"; + } + + print "connect_to_MySQL: DBI DSN: " . $dsn . "\n" if $op{debug}; + + $dbh = DBI->connect($dsn, $mycnf{'user'}, $mycnf{'pass'}) or die; + } + else + { + print STDERR "Install Perl 5.x driver: DBD:mysql or DBD:MariaDB\n"; + print STDERR "currently installed Perl DBD drivers:\n"; + foreach my $driver (DBI->available_drivers()) + { + print STDERR " * " . $driver . "\n"; + } + print STDERR "\n"; + die("Exit as no MariaDB DBI driver found!\n"); + } } sub collect_reports @@ -696,7 +726,7 @@ sub set_myisam_vals { print "set_myisam_vals\n" if $op{debug}; -# should be moved elsewere +# should be moved elsewhere $questions = $stats{'Questions'}; $key_read_ratio = sprintf "%.2f", @@ -1346,7 +1376,7 @@ format QCACHE = __ Query Cache _________________________________________________________ Memory usage @>>>>>> of @>>>>>> %Usage: @>>>>> make_short($qc_mem_used, 1), make_short($vars{'query_cache_size'}, 1), perc($qc_mem_used, $vars{'query_cache_size'}) -Block Fragmnt @>>>>>% +Block Fragment @>>>>>% perc($stats{'Qcache_free_blocks'}, $stats{'Qcache_total_blocks'}) Hits @>>>>>> @>>>>>/s make_short($stats{'Qcache_hits'}), t($stats{'Qcache_hits'}) diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh index 093f412618720..5c223c076487f 100755 --- a/debian/autobake-deb.sh +++ b/debian/autobake-deb.sh @@ -11,92 +11,158 @@ # Exit immediately on any error set -e -source ./VERSION - -# This file is invoked from Buildbot and Travis-CI to build deb packages. -# As both of those CI systems have many parallel jobs that include different -# parts of the test suite, we don't need to run the mysql-test-run at all when -# building the deb packages here. +# On Buildbot, don't run the mysql-test-run test suite as part of build. +# It takes a lot of time, and we will do a better test anyway in +# Buildbot, running the test suite from installed .debs on a clean VM. export DEB_BUILD_OPTIONS="nocheck $DEB_BUILD_OPTIONS" +# shellcheck source=/dev/null +source ./VERSION + # General CI optimizations to keep build output smaller -if [[ $TRAVIS ]] || [[ $GITLAB_CI ]] +if [[ $GITLAB_CI ]] then - # On both Travis and Gitlab the output log must stay under 4MB so make the + # On Gitlab the output log must stay under 4MB so make the # build less verbose sed '/Add support for verbose builds/,/^$/d' -i debian/rules elif [ -d storage/columnstore/columnstore/debian ] then - # ColumnStore is explicitly disabled in the native Debian build, so allow it + # ColumnStore is explicitly disabled in the native Debian build. Enable it # now when build is triggered by autobake-deb.sh (MariaDB.org) and when the - # build is not running on Travis or Gitlab-CI + # build is not running on Gitlab-CI. sed '/-DPLUGIN_COLUMNSTORE=NO/d' -i debian/rules # Take the files and part of control from MCS directory - cp -v storage/columnstore/columnstore/debian/mariadb-plugin-columnstore.* debian/ - echo >> debian/control - sed "s/10.7/${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}/" > debian/control + if [ ! -f debian/mariadb-plugin-columnstore.install ] + then + cp -v storage/columnstore/columnstore/debian/mariadb-plugin-columnstore.* debian/ + echo >> debian/control + sed "s/10.6/${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}/" > debian/control + fi fi -# Don't build or try to put files in a package for selected plugins and components on Travis-CI -# in order to keep build small (in both duration and disk space) -if [[ $TRAVIS ]] -then - # Test suite package not relevant on Travis-CI - sed 's|DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test|DINSTALL_MYSQLTESTDIR=false|' -i debian/rules - sed '/Package: mariadb-test-data/,/^$/d' -i debian/control - sed '/Package: mariadb-test$/,/^$/d' -i debian/control - - # Extra plugins such as Mroonga, Spider, OQgraph, Sphinx and the embedded build can safely be skipped - sed 's|-DDEB|-DPLUGIN_MROONGA=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_SPIDER=NO -DPLUGIN_OQGRAPH=NO -DPLUGIN_PERFSCHEMA=NO -DPLUGIN_SPHINX=NO -DWITH_EMBEDDED_SERVER=OFF -DDEB|' -i debian/rules - sed "/Package: mariadb-plugin-mroonga/,/^$/d" -i debian/control - sed "/Package: mariadb-plugin-rocksdb/,/^$/d" -i debian/control - sed "/Package: mariadb-plugin-spider/,/^$/d" -i debian/control - sed "/Package: mariadb-plugin-oqgraph/,/^$/d" -i debian/control - sed "/ha_sphinx.so/d" -i debian/mariadb-server-${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.install - sed "/Package: libmariadbd19/,/^$/d" -i debian/control - sed "/Package: libmariadbd-dev/,/^$/d" -i debian/control -fi +# Look up distro-version specific stuff +# +# Always keep the actual packaging as up-to-date as possible following the latest +# Debian policy and targeting Debian Sid. Then case-by-case run in autobake-deb.sh +# tests for backwards compatibility and strip away parts on older builders. -# If rocksdb-tools is not available (before Debian Buster and Ubuntu Disco) -# remove the dependency from the RocksDB plugin so it can install properly -# and instead ship the one built from MariaDB sources -if ! apt-cache madison rocksdb-tools | grep 'rocksdb-tools' >/dev/null 2>&1 -then +remove_rocksdb_tools() +{ sed '/rocksdb-tools/d' -i debian/control sed '/sst_dump/d' -i debian/not-installed - echo "usr/bin/sst_dump" >> debian/mariadb-plugin-rocksdb.install -fi - -# If libcurl4 is not available (before Debian Buster and Ubuntu Bionic) -# use older libcurl3 instead -if ! apt-cache madison libcurl4 | grep 'libcurl4' >/dev/null 2>&1 -then - sed 's/libcurl4/libcurl3/g' -i debian/control -fi + if ! grep -q sst_dump debian/mariadb-plugin-rocksdb.install + then + echo "usr/bin/sst_dump" >> debian/mariadb-plugin-rocksdb.install + fi +} + +replace_uring_with_aio() +{ + sed 's/liburing-dev/libaio-dev/g' -i debian/control + sed -e '/-DIGNORE_AIO_CHECK=ON/d' \ + -e '/-DWITH_URING=ON/d' -i debian/rules +} -# From Debian Bullseye/Ubuntu Groovy, liburing replaces libaio -if ! apt-cache madison liburing-dev | grep 'liburing-dev' >/dev/null 2>&1 +disable_pmem() +{ + sed '/libpmem-dev/d' -i debian/control + sed '/-DWITH_PMEM=ON/d' -i debian/rules +} + +disable_libfmt() +{ + # 0.7+ required + sed '/libfmt-dev/d' -i debian/control +} + +architecture=$(dpkg-architecture -q DEB_BUILD_ARCH) + +# Parse release name and number from Linux standard base release +# Example: +# $ lsb_release -a +# No LSB modules are available. +# Distributor ID: Debian +# Description: Debian GNU/Linux bookworm/sid +# Release: n/a +# Codename: n/a +LSBID="$(lsb_release -si | tr '[:upper:]' '[:lower:]')" +LSBVERSION="$(lsb_release -sr | sed -e "s#\.##g")" +LSBNAME="$(lsb_release -sc)" + +# If 'n/a', assume 'sid' +if [ "${LSBVERSION}" == "n/a" ] || [ "${LSBNAME}" == "n/a" ] then - sed 's/liburing-dev/libaio-dev/g' -i debian/control - sed '/-DIGNORE_AIO_CHECK=YES/d' -i debian/rules - sed '/-DWITH_URING=yes/d' -i debian/rules + LSBVERSION="sid" + LSBNAME="sid" fi -# From Debian Buster/Ubuntu Focal onwards libpmem-dev is available -# Don't reference it when built in distro releases that lack it -if ! apt-cache madison libpmem-dev | grep 'libpmem-dev' >/dev/null 2>&1 +# If not known, use 'unknown' in .deb version identifier +if [ -z "${LSBID}" ] then - sed '/libpmem-dev/d' -i debian/control - sed '/-DWITH_PMEM=yes/d' -i debian/rules + LSBID="unknown" fi -# Debian stretch doesn't support the zstd version 1.1.3 required -# for RocksDB. zstd isn't enabled in Mroonga even though code exists -# for it. If someone happens to have a non-default zstd installed -# (not 1.1.2), assume its a backport and build with it. -if [ "$(lsb_release -sc)" = stretch ] && [ "$(apt-cache madison 'libzstd-dev' | grep -v 1.1.2)" = '' ] +case "${LSBNAME}" +in + # Debian + "buster") + disable_libfmt + replace_uring_with_aio + if [ ! "$architecture" = amd64 ] + then + disable_pmem + fi + ;& + "bullseye"|"bookworm") + # mariadb-plugin-rocksdb in control is 4 arches covered by the distro rocksdb-tools + # so no removal is necessary. + if [[ ! "$architecture" =~ amd64|arm64|ppc64el ]] + then + disable_pmem + fi + if [[ ! "$architecture" =~ amd64|arm64|armel|armhf|i386|mips64el|mipsel|ppc64el|s390x ]] + then + replace_uring_with_aio + fi + ;& + "sid") + # The default packaging should always target Debian Sid, so in this case + # there is intentionally no customizations whatsoever. + ;; + # Ubuntu + "bionic") + remove_rocksdb_tools + [ "$architecture" != amd64 ] && disable_pmem + ;& + "focal") + replace_uring_with_aio + disable_libfmt + ;& + "impish"|"jammy"|"kinetic") + # mariadb-plugin-rocksdb s390x not supported by us (yet) + # ubuntu doesn't support mips64el yet, so keep this just + # in case something changes. + if [[ ! "$architecture" =~ amd64|arm64|ppc64el|s390x ]] + then + remove_rocksdb_tools + fi + if [[ ! "$architecture" =~ amd64|arm64|ppc64el ]] + then + disable_pmem + fi + if [[ ! "$architecture" =~ amd64|arm64|armhf|ppc64el|s390x ]] + then + replace_uring_with_aio + fi + ;; + *) + echo "Error: Unknown release '$LSBNAME'" >&2 + exit 1 +esac + +if [ -n "${AUTOBAKE_PREP_CONTROL_RULES_ONLY:-}" ] then - sed '/libzstd-dev/d' -i debian/control + exit 0 fi # Adjust changelog, add new version @@ -106,45 +172,63 @@ echo "Incrementing changelog and starting build scripts" UPSTREAM="${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_PATCH}${MYSQL_VERSION_EXTRA}" PATCHLEVEL="+maria" LOGSTRING="MariaDB build" -CODENAME="$(lsb_release -sc)" EPOCH="1:" -VERSION="${EPOCH}${UPSTREAM}${PATCHLEVEL}~${CODENAME}" +VERSION="${EPOCH}${UPSTREAM}${PATCHLEVEL}~${LSBID:0:3}${LSBVERSION}" -dch -b -D "${CODENAME}" -v "${VERSION}" "Automatic build with ${LOGSTRING}." --controlmaint +dch -b -D "${LSBNAME}" -v "${VERSION}" "Automatic build with ${LOGSTRING}." --controlmaint echo "Creating package version ${VERSION} ... " -# On Travis CI and Gitlab-CI, use -b to build binary only packages as there is -# no need to waste time on generating the source package. -if [[ $TRAVIS ]] -then - BUILDPACKAGE_FLAGS="-b" +BUILDPACKAGE_DPKGCMD=() + +# Fakeroot test +if fakeroot true; then + BUILDPACKAGE_DPKGCMD+=( "fakeroot" "--" ) fi # Use eatmydata is available to build faster with less I/O, skipping fsync() # during the entire build process (safe because a build can always be restarted) if which eatmydata > /dev/null then - BUILDPACKAGE_PREPEND=eatmydata + BUILDPACKAGE_DPKGCMD+=("eatmydata") +fi + +BUILDPACKAGE_DPKGCMD+=("dpkg-buildpackage") + +# Using dpkg-buildpackage args +# -us Allow unsigned sources +# -uc Allow unsigned changes +# -I Tar ignore +BUILDPACKAGE_DPKGCMD+=(-us -uc -I) + +# There can be also extra flags that are appended to args +if [ -n "$BUILDPACKAGE_FLAGS" ] +then + read -ra BUILDPACKAGE_TMP_ARGS <<< "$BUILDPACKAGE_FLAGS" + BUILDPACKAGE_DPKGCMD+=( "${BUILDPACKAGE_TMP_ARGS[@]}" ) fi # Build the package # Pass -I so that .git and other unnecessary temporary and source control files # will be ignored by dpkg-source when creating the tar.gz source package. -fakeroot $BUILDPACKAGE_PREPEND dpkg-buildpackage -us -uc -I $BUILDPACKAGE_FLAGS +"${BUILDPACKAGE_DPKGCMD[@]}" # If the step above fails due to missing dependencies, you can manually run # sudo mk-build-deps debian/control -r -i -# Don't log package contents on Travis-CI or Gitlab-CI to save time and log size -if [[ ! $TRAVIS ]] && [[ ! $GITLAB_CI ]] +# Don't log package contents on Gitlab-CI to save time and log size +if [[ ! $GITLAB_CI ]] then echo "List package contents ..." cd .. for package in *.deb do echo "$package" | cut -d '_' -f 1 - dpkg-deb -c "$package" | awk '{print $1 " " $2 " " $6 " " $7 " " $8}' | sort -k 3 + # shellcheck disable=SC2034 + dpkg-deb -c "$package" | while IFS=" " read -r col1 col2 col3 col4 col5 col6 col7 col8 + do + echo "$col1 $col2 $col6 $col7 $col8" | sort -k 3 + done echo "------------------------------------------------" done fi diff --git a/debian/control b/debian/control index 21ce120b7ac94..5c5c89f256f87 100644 --- a/debian/control +++ b/debian/control @@ -5,7 +5,7 @@ Maintainer: MariaDB Developers Build-Depends: bison, cmake, cracklib-runtime , - debhelper (>= 9.20160709~), + debhelper (>= 10), dh-exec, flex [amd64], gdb , @@ -23,6 +23,7 @@ Build-Depends: bison, libcurl4-openssl-dev | libcurl4-dev, libedit-dev, libedit-dev:native, + libfmt-dev (>= 7.0.0), libjemalloc-dev [linux-any], libjudy-dev, libkrb5-dev, @@ -34,7 +35,7 @@ Build-Depends: bison, libnuma-dev [linux-any], libpam0g-dev, libpcre2-dev, - libpmem-dev [amd64 arm64 ppc64el], + libpmem-dev [amd64 arm64 ppc64el riscv64], libsnappy-dev, libssl-dev, libssl-dev:native, @@ -288,6 +289,7 @@ Conflicts: mariadb-client-10.0, mariadb-client-core-10.4, mariadb-client-core-10.5, mariadb-client-core-10.6, + mariadb-client-core-10.7, mariadb-client-core-5.1, mariadb-client-core-5.2, mariadb-client-core-5.3, @@ -313,13 +315,17 @@ Breaks: mariadb-server-10.0, mariadb-server-core-10.6, mariadb-server-core-10.7, mariadb-server-core-10.8 (<< ${source:Version}), + mysql-cluster-community-client-plugins, mysql-server-core-5.5, mysql-server-core-5.6, mysql-server-core-5.7, mysql-server-core-8.0, percona-server-server-5.6, + percona-server-server-5.7, + percona-server-server-8.0, percona-xtradb-cluster-server-5.6, - percona-xtradb-cluster-server-5.7 + percona-xtradb-cluster-server-5.7, + percona-xtradb-cluster-server-8.0 Replaces: mariadb-client-10.0, mariadb-client-10.1, mariadb-client-10.2, @@ -340,6 +346,7 @@ Replaces: mariadb-client-10.0, mariadb-client-core-10.4, mariadb-client-core-10.5, mariadb-client-core-10.6, + mariadb-client-core-10.7, mariadb-client-core-5.1, mariadb-client-core-5.2, mariadb-client-core-5.3, @@ -364,13 +371,17 @@ Replaces: mariadb-client-10.0, mysql-client-core-5.6, mysql-client-core-5.7, mysql-client-core-8.0, + mysql-cluster-community-client-plugins, mysql-server-core-5.5, mysql-server-core-5.6, mysql-server-core-5.7, mysql-server-core-8.0, percona-server-server-5.6, + percona-server-server-5.7, + percona-server-server-8.0, percona-xtradb-cluster-server-5.6, percona-xtradb-cluster-server-5.7, + percona-xtradb-cluster-server-8.0, virtual-mysql-client-core Provides: default-mysql-client-core, virtual-mysql-client-core @@ -466,6 +477,7 @@ Replaces: mariadb-client (<< ${source:Version}), mariadb-client-10.4, mariadb-client-10.5, mariadb-client-10.6, + mariadb-client-10.7, mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3, @@ -548,6 +560,8 @@ Conflicts: mariadb-server-core-10.0, mariadb-server-core-10.3, mariadb-server-core-10.4, mariadb-server-core-10.5, + mariadb-server-core-10.6, + mariadb-server-core-10.7, mariadb-server-core-5.1, mariadb-server-core-5.2, mariadb-server-core-5.3, @@ -571,6 +585,7 @@ Breaks: mariadb-client-10.0, mariadb-client-10.8 (<< ${source:Version}), mariadb-server-10.0, mariadb-server-10.1, + mariadb-server-10.2, mariadb-server-10.3, mariadb-server-10.4, mariadb-server-10.5, @@ -596,6 +611,7 @@ Replaces: mariadb-client-10.0, mariadb-client-10.8 (<< ${source:Version}), mariadb-server-10.0, mariadb-server-10.1, + mariadb-server-10.2, mariadb-server-10.3, mariadb-server-10.4, mariadb-server-10.5, @@ -671,6 +687,8 @@ Conflicts: mariadb-server (<< ${source:Version}), mariadb-server-10.3, mariadb-server-10.4, mariadb-server-10.5, + mariadb-server-10.6, + mariadb-server-10.7, mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3, @@ -711,6 +729,8 @@ Replaces: handlersocket-mysql-5.5, mariadb-server-10.3, mariadb-server-10.4, mariadb-server-10.5, + mariadb-server-10.6, + mariadb-server-10.7, mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3, @@ -772,9 +792,11 @@ Package: mariadb-backup Architecture: any Breaks: mariadb-backup-10.1, mariadb-backup-10.2, + mariadb-backup-10.3, mariadb-client-10.1 Replaces: mariadb-backup-10.1, mariadb-backup-10.2, + mariadb-backup-10.3, mariadb-client-10.1 Depends: mariadb-client-core-10.8 (= ${binary:Version}), ${misc:Depends}, @@ -793,16 +815,21 @@ Depends: libxml2, unixodbc, ${misc:Depends}, ${shlibs:Depends} +Recommends: curl Breaks: mariadb-connect-engine-10.0, mariadb-connect-engine-10.1, mariadb-connect-engine-10.2, mariadb-connect-engine-10.3, - mariadb-connect-engine-10.4 + mariadb-connect-engine-10.4, + mariadb-server-10.0, + mariadb-server-10.1 Replaces: mariadb-connect-engine-10.0, mariadb-connect-engine-10.1, mariadb-connect-engine-10.2, mariadb-connect-engine-10.3, - mariadb-connect-engine-10.4 + mariadb-connect-engine-10.4, + mariadb-server-10.0, + mariadb-server-10.1 Description: Connect storage engine for MariaDB Connect engine supports a number of file formats (dbf, xml, txt, bin, etc), connections to ODBC tables and remote MySQL tables, as well as a number of @@ -823,7 +850,7 @@ Description: Amazon S3 archival storage engine for MariaDB Package: mariadb-plugin-rocksdb Architecture: amd64 arm64 mips64el ppc64el Depends: mariadb-server-10.8 (= ${server:Version}), - python3, + python3:any, rocksdb-tools, ${misc:Depends}, ${shlibs:Depends} @@ -849,12 +876,16 @@ Breaks: mariadb-oqgraph-engine-10.0, mariadb-oqgraph-engine-10.1, mariadb-oqgraph-engine-10.2, mariadb-oqgraph-engine-10.3, - mariadb-oqgraph-engine-10.4 + mariadb-oqgraph-engine-10.4, + mariadb-server-10.0, + mariadb-server-10.1 Replaces: mariadb-oqgraph-engine-10.0, mariadb-oqgraph-engine-10.1, mariadb-oqgraph-engine-10.2, mariadb-oqgraph-engine-10.3, - mariadb-oqgraph-engine-10.4 + mariadb-oqgraph-engine-10.4, + mariadb-server-10.0, + mariadb-server-10.1 Description: OQGraph storage engine for MariaDB The OQGraph engine is a computation engine plugin for handling hierarchies (trees) and graphs (friend-of-a-friend, etc) cleanly through standard SQL. @@ -910,11 +941,15 @@ Depends: libgssapi-krb5-2, Breaks: mariadb-gssapi-server-10.1, mariadb-gssapi-server-10.2, mariadb-gssapi-server-10.3, - mariadb-gssapi-server-10.4 + mariadb-gssapi-server-10.4, + mariadb-server-10.0, + mariadb-server-10.1 Replaces: mariadb-gssapi-server-10.1, mariadb-gssapi-server-10.2, mariadb-gssapi-server-10.3, - mariadb-gssapi-server-10.4 + mariadb-gssapi-server-10.4, + mariadb-server-10.0, + mariadb-server-10.1 Description: GSSAPI authentication plugin for MariaDB server This plugin includes support for Kerberos on Unix, but can also be used for Windows authentication with or without domain environment. @@ -960,6 +995,13 @@ Depends: mariadb-server-10.8, ${misc:Depends}, ${shlibs:Depends} Description: BZip2 compression support in the server and storage engines + The various MariaDB storage engines, such as InnoDB, RocksDB, Mroonga, + can use different compression libraries. + . + Plugin provides BZip2 (https://sourceware.org/bzip2/) compression + . + Note that these affect InnoDB and Mroonga only; + RocksDB still uses the compression algorithms from its own library Package: mariadb-plugin-provider-lz4 Architecture: any @@ -967,6 +1009,13 @@ Depends: mariadb-server-10.8, ${misc:Depends}, ${shlibs:Depends} Description: LZ4 compression support in the server and storage engines + The various MariaDB storage engines, such as InnoDB, RocksDB, Mroonga, + can use different compression libraries. + . + Plugin provides LZ4 (http://lz4.github.io/lz4/) compression + . + Note that these affect InnoDB and Mroonga only; + RocksDB still uses the compression algorithms from its own library Package: mariadb-plugin-provider-lzma Architecture: any @@ -974,6 +1023,13 @@ Depends: mariadb-server-10.8, ${misc:Depends}, ${shlibs:Depends} Description: LZMA compression support in the server and storage engines + The various MariaDB storage engines, such as InnoDB, RocksDB, Mroonga, + can use different compression libraries. + . + Plugin provides LZMA (https://tukaani.org/lzma/) compression + . + Note that these affect InnoDB and Mroonga only; + RocksDB still uses the compression algorithms from its own library Package: mariadb-plugin-provider-lzo Architecture: any @@ -981,6 +1037,13 @@ Depends: mariadb-server-10.8, ${misc:Depends}, ${shlibs:Depends} Description: LZO compression support in the server and storage engines + The various MariaDB storage engines, such as InnoDB, RocksDB, Mroonga, + can use different compression libraries. + . + Plugin provides LZO (http://www.oberhumer.com/opensource/lzo/) compression + . + Note that these affect InnoDB and Mroonga only; + RocksDB still uses the compression algorithms from its own library Package: mariadb-plugin-provider-snappy Architecture: any @@ -988,6 +1051,13 @@ Depends: mariadb-server-10.8, ${misc:Depends}, ${shlibs:Depends} Description: Snappy compression support in the server and storage engines + The various MariaDB storage engines, such as InnoDB, RocksDB, Mroonga, + can use different compression libraries. + . + Plugin provides Snappy (https://github.com/google/snappy) compression + . + Note that these affect InnoDB and Mroonga only; + RocksDB still uses the compression algorithms from its own library Package: mariadb-test Architecture: any @@ -1028,6 +1098,8 @@ Replaces: mariadb-test-10.0, mariadb-test-5.5, mysql-client-5.5, mysql-server-5.5, + mysql-server-5.7, + mysql-server-core-8.0, mysql-testsuite, mysql-testsuite-5.5, mysql-testsuite-5.6, diff --git a/debian/libmariadb-dev.install b/debian/libmariadb-dev.install index 1e52e2acfdca4..08be370ca6d45 100644 --- a/debian/libmariadb-dev.install +++ b/debian/libmariadb-dev.install @@ -11,6 +11,7 @@ usr/include/mariadb/mariadb_dyncol.h usr/include/mariadb/mariadb_rpl.h usr/include/mariadb/mariadb_stmt.h usr/include/mariadb/mariadb_version.h +usr/include/mariadb/my_alloca.h usr/include/mariadb/my_config.h usr/include/mariadb/my_global.h usr/include/mariadb/my_sys.h diff --git a/debian/libmariadb-dev.lintian-overrides b/debian/libmariadb-dev.lintian-overrides index 345b537a52171..6a162120f2427 100644 --- a/debian/libmariadb-dev.lintian-overrides +++ b/debian/libmariadb-dev.lintian-overrides @@ -1 +1,2 @@ +# This is how upstream does it, wont' fix arch-dependent-file-not-in-arch-specific-directory usr/bin/mariadb_config diff --git a/debian/mariadb-common.postinst b/debian/mariadb-common.postinst index 12f65bd3d9257..53d131a392954 100644 --- a/debian/mariadb-common.postinst +++ b/debian/mariadb-common.postinst @@ -35,7 +35,7 @@ case "$1" in then update-alternatives --install /etc/mysql/my.cnf my.cnf "/etc/mysql/mariadb.cnf" 500 || true fi - ;; + ;; esac #DEBHELPER# diff --git a/debian/mariadb-common.postrm b/debian/mariadb-common.postrm index d0bfa266b7d4d..2548733a1b9e4 100644 --- a/debian/mariadb-common.postrm +++ b/debian/mariadb-common.postrm @@ -10,7 +10,7 @@ case "$1" in then /usr/share/mysql-common/configure-symlinks remove mariadb "/etc/mysql/mariadb.cnf" fi - ;; + ;; esac #DEBHELPER# diff --git a/debian/mariadb-plugin-provider-bzip2.lintian-overrides b/debian/mariadb-plugin-provider-bzip2.lintian-overrides new file mode 100644 index 0000000000000..563c05a3a6b05 --- /dev/null +++ b/debian/mariadb-plugin-provider-bzip2.lintian-overrides @@ -0,0 +1,3 @@ +# It's intentional that bzip2 compression plugin doesn't have symbols from libc +# More info https://jira.mariadb.org/browse/MDEV-28120 +library-not-linked-against-libc usr/lib/mysql/plugin/provider_bzip2.so \ No newline at end of file diff --git a/debian/mariadb-plugin-provider-lz4.lintian-overrides b/debian/mariadb-plugin-provider-lz4.lintian-overrides new file mode 100644 index 0000000000000..3f7d7e9ecfbb8 --- /dev/null +++ b/debian/mariadb-plugin-provider-lz4.lintian-overrides @@ -0,0 +1,3 @@ +# It's intentional that LZ4 compression plugin doesn't have symbols from libc +# More info https://jira.mariadb.org/browse/MDEV-28120 +library-not-linked-against-libc usr/lib/mysql/plugin/provider_lz4.so \ No newline at end of file diff --git a/debian/mariadb-plugin-provider-lzma.lintian-overrides b/debian/mariadb-plugin-provider-lzma.lintian-overrides new file mode 100644 index 0000000000000..94eafa766a408 --- /dev/null +++ b/debian/mariadb-plugin-provider-lzma.lintian-overrides @@ -0,0 +1,3 @@ +# It's intentional that LZMA compression plugin doesn't have symbols from libc +# More info https://jira.mariadb.org/browse/MDEV-28120 +library-not-linked-against-libc usr/lib/mysql/plugin/provider_lzma.so \ No newline at end of file diff --git a/debian/mariadb-plugin-provider-lzo.lintian-overrides b/debian/mariadb-plugin-provider-lzo.lintian-overrides new file mode 100644 index 0000000000000..8184923cf9a15 --- /dev/null +++ b/debian/mariadb-plugin-provider-lzo.lintian-overrides @@ -0,0 +1,3 @@ +# It's intentional that LZO compression plugin doesn't have symbols from libc +# More info https://jira.mariadb.org/browse/MDEV-28120 +library-not-linked-against-libc usr/lib/mysql/plugin/provider_lzo.so \ No newline at end of file diff --git a/debian/mariadb-plugin-provider-snappy.lintian-overrides b/debian/mariadb-plugin-provider-snappy.lintian-overrides new file mode 100644 index 0000000000000..6c76162573d74 --- /dev/null +++ b/debian/mariadb-plugin-provider-snappy.lintian-overrides @@ -0,0 +1,3 @@ +# It's intentional that Snappy compression plugin doesn't have symbols from libc +# More info https://jira.mariadb.org/browse/MDEV-28120 +library-not-linked-against-libc usr/lib/mysql/plugin/provider_snappy.so \ No newline at end of file diff --git a/debian/mariadb-server-10.8.install b/debian/mariadb-server-10.8.install index e1a05261ef2f9..71fe6bc77d5bd 100644 --- a/debian/mariadb-server-10.8.install +++ b/debian/mariadb-server-10.8.install @@ -78,5 +78,6 @@ usr/share/man/man1/wsrep_sst_mysqldump.1 usr/share/man/man1/wsrep_sst_rsync.1 usr/share/man/man1/wsrep_sst_rsync_wan.1 usr/share/mysql/errmsg-utf8.txt +usr/share/mysql/mini-benchmark usr/share/mysql/wsrep.cnf usr/share/mysql/wsrep_notify diff --git a/debian/mariadb-server-10.8.mariadb.init b/debian/mariadb-server-10.8.mariadb.init index 90a99cca873c9..9dc8ebdfa07f4 100644 --- a/debian/mariadb-server-10.8.mariadb.init +++ b/debian/mariadb-server-10.8.mariadb.init @@ -21,9 +21,24 @@ test -x /usr/sbin/mariadbd || exit 0 . /lib/lsb/init-functions -SELF=$(cd $(dirname $0); pwd -P)/$(basename $0) +SELF=$(cd "$(dirname $0)"; pwd -P)/$(basename $0) + +if [ -f /usr/bin/mariadb-admin ] +then + MYADMIN="/usr/bin/mariadb-admin --defaults-file=/etc/mysql/debian.cnf" +elif [ -f /usr/bin/mysqladmin ] +then + MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" +else + log_failure_msg "Command mariadb-admin/mysqladmin not found! This SysV init script depends on it." + exit -1 +fi -MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" +if [ ! -x /usr/bin/mariadbd-safe ] +then + log_failure_msg "/usr/bin/mariadbd-safe not found or executable! This SysV init script depends on it." + exit -1 +fi # priority can be overridden and "-s" adds output to stderr ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mariadb -i" @@ -69,7 +84,10 @@ sanity_checks() { # check for diskspace shortage datadir=`mariadbd_get_param datadir` - if LC_ALL=C BLOCKSIZE= df --portability $datadir/. | tail -n 1 | awk '{ exit ($4>4096) }'; then + # As preset blocksize of GNU df is 1024 then available bytes is $df_available_blocks * 1024 + # 4096 blocks is then lower than 4 MB + df_available_blocks=`LC_ALL=C BLOCKSIZE= df --output=avail "$datadir" | tail -n 1` + if [ "$df_available_blocks" -lt "4096" ]; then log_failure_msg "$0: ERROR: The partition with $datadir is too full!" echo "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER exit 1 @@ -118,7 +136,7 @@ case "${1:-''}" in test -e /run/mysqld || install -m 755 -o mysql -g root -d /run/mysqld # Start MariaDB! - /usr/bin/mysqld_safe "${@:2}" 2>&1 >/dev/null | $ERR_LOGGER & + /usr/bin/mariadbd-safe "${@:2}" 2>&1 >/dev/null | $ERR_LOGGER & for i in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-30}"); do sleep 1 diff --git a/debian/mariadb-server-10.8.postinst b/debian/mariadb-server-10.8.postinst index 13800b7bce275..b87ce856313b5 100644 --- a/debian/mariadb-server-10.8.postinst +++ b/debian/mariadb-server-10.8.postinst @@ -1,12 +1,18 @@ #!/bin/bash set -e +# shellcheck source=/dev/null . /usr/share/debconf/confmodule # Automatically set version to ease maintenance of this file MAJOR_VER="${DPKG_MAINTSCRIPT_PACKAGE#mariadb-server-}" -if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi +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 @@ -20,11 +26,13 @@ set -o pipefail case "$1" in configure) - # This is needed because mysql_install_db removes the pid file in /run + # This is needed because mariadb-install-db removes the pid file in /run # and because changed configuration options should take effect immediately. # In case the server wasn't running at all it should be ok if the stop # script fails. I can't tell at this point because of the cleaned /run. - set +e; invoke-rc.d mariadb stop; set -e + set +e + invoke-rc.d mariadb stop + set -e # An existing /etc/init.d/mysql might be on the system if there was a # previous MySQL or MariaDB installation, since /etc/init.d files are @@ -64,21 +72,26 @@ case "$1" in # If the following symlink exists, it is a preserved copy the old data dir # created by the preinst script during a upgrade that would have otherwise # been replaced by an empty mysql dir. This should restore it. - for dir in DATADIR LOGDIR; do + for dir in DATADIR LOGDIR + do - if [ "$dir" = "DATADIR" ]; then + if [ "$dir" = "DATADIR" ] + then targetdir=$mysql_datadir else targetdir=$mysql_logdir fi savelink="$mysql_upgradedir/$dir.link" - if [ -L "$savelink" ]; then + if [ -L "$savelink" ] + then # If the targetdir was a symlink before we upgraded it is supposed # to be either still be present or not existing anymore now. - if [ -L "$targetdir" ]; then + if [ -L "$targetdir" ] + then rm "$savelink" - elif [ ! -d "$targetdir" ]; then + elif [ ! -d "$targetdir" ] + then mv "$savelink" "$targetdir" else # this should never even happen, but just in case... @@ -100,7 +113,7 @@ this all away. EOF fi fi - rmdir $mysql_upgradedir 2>/dev/null || true + rmdir $mysql_upgradedir 2>/dev/null || true done @@ -112,17 +125,29 @@ EOF # This direct update is needed to enable an authentication mechanism to # perform mariadb-upgrade, (MDEV-22678). To keep the impact minimal, we # skip innodb and set key-buffer-size to 0 as it isn't reused. - if [ -f "$mysql_datadir"/auto.cnf ] && [ -f "$mysql_datadir"/mysql/user.MYD ] && - [ ! lsof -nt "$mysql_datadir"/mysql/user.MYD > /dev/null ] && [ ! -f "$mysql_datadir"/undo_001 ]; then - echo "UPDATE mysql.user SET plugin='unix_socket' WHERE plugin='auth_socket';" | - /usr/sbin/mariadbd --skip-innodb --key_buffer_size=0 --default-storage-engine=MyISAM --bootstrap 2> /dev/null + if [ -f "$mysql_datadir/auto.cnf" ] && + [ -f "$mysql_datadir/mysql/user.MYD" ] && + ! lsof -nt "$mysql_datadir"/mysql/user.MYD > /dev/null && + [ ! -f "$mysql_datadir/undo_001" ] + then + echo "UPDATE mysql.user SET plugin='unix_socket' WHERE plugin='auth_socket';" | + mariadbd --skip-innodb --key_buffer_size=0 --default-storage-engine=MyISAM --bootstrap 2> /dev/null fi # Ensure the existence and right permissions for the database and # log files. Use mkdir option 'Z' to create with correct SELinux context. - if [ ! -d "$mysql_statedir" ] && [ ! -L "$mysql_statedir" ]; then mkdir -Z "$mysql_statedir"; fi - if [ ! -d "$mysql_datadir" ] && [ ! -L "$mysql_datadir" ]; then mkdir -Z "$mysql_datadir" ; fi - if [ ! -d "$mysql_logdir" ] && [ ! -L "$mysql_logdir" ]; then mkdir -Z "$mysql_logdir" ; fi + if [ ! -d "$mysql_statedir" ] && [ ! -L "$mysql_statedir" ] + then + mkdir -Z "$mysql_statedir" + fi + if [ ! -d "$mysql_datadir" ] && [ ! -L "$mysql_datadir" ] + then + mkdir -Z "$mysql_datadir" + fi + if [ ! -d "$mysql_logdir" ] && [ ! -L "$mysql_logdir" ] + then + mkdir -Z "$mysql_logdir" + fi # When creating an ext3 jounal on an already mounted filesystem like e.g. # /var/lib/mysql, you get a .journal file that is not modifiable by chown. # The mysql_statedir must not be writable by the mysql user under any @@ -155,7 +180,7 @@ EOF # This is important to avoid dataloss when there is a removed # mysql-server version from Woody lying around which used the same - # data directory and then somewhen gets purged by the admin. + # data directory and then somehow gets purged by the admin. db_set mariadb-server/postrm_remove_database false || true # Clean up old flags before setting new one @@ -165,14 +190,14 @@ EOF # initiate databases. Output is not allowed by debconf :-( # This will fail if we are upgrading an existing database; in this case - # mysql_upgrade, called from the /etc/init.d/mariadb start script, will + # mariadb-upgrade, called from the /etc/mysql/debian-start script, will # handle things. # Debian: beware of the bashisms... # Debian: can safely run on upgrades with existing databases set +e - bash /usr/bin/mysql_install_db --rpm --cross-bootstrap --user=mysql \ - --disable-log-bin --skip-test-db 2>&1 | \ - $ERR_LOGGER + bash /usr/bin/mariadb-install-db --rpm --cross-bootstrap --user=mysql \ + --disable-log-bin --skip-test-db 2>&1 | \ + $ERR_LOGGER set -e # On new installations root user can connect via unix_socket. @@ -183,26 +208,30 @@ EOF # --defaults-file option for tools (for the sake of upgrades) # and thus need /etc/mysql/debian.cnf to exist, even if it's empty. # In the long run the goal is to obsolete this file. - dc=$mysql_cfgdir/debian.cnf; - if [ ! -d "$mysql_cfgdir" ]; then + dc="$mysql_cfgdir/debian.cnf" + if [ ! -d "$mysql_cfgdir" ] + then install -o 0 -g 0 -m 0755 -d $mysql_cfgdir fi - if [ ! -e "$dc" ]; then - cat /dev/null > $dc - echo "# THIS FILE IS OBSOLETE. STOP USING IT IF POSSIBLE." >>$dc - echo "# This file exists only for backwards compatibility for" >>$dc - echo "# tools that run '--defaults-file=/etc/mysql/debian.cnf'" >>$dc - echo "# and have root level access to the local filesystem." >>$dc - echo "# With those permissions one can run 'mariadb' directly" >>$dc - echo "# anyway thanks to unix socket authentication and hence" >>$dc - echo "# this file is useless. See package README for more info." >>$dc - echo "[client]" >>$dc - echo "host = localhost" >>$dc - echo "user = root" >>$dc - echo "[mysql_upgrade]" >>$dc - echo "host = localhost" >>$dc - echo "user = root" >>$dc - echo "# THIS FILE WILL BE REMOVED IN A FUTURE DEBIAN RELEASE." >>$dc + if [ ! -e "$dc" ] + then + cat /dev/null > $dc + { + echo "# THIS FILE IS OBSOLETE. STOP USING IT IF POSSIBLE."; + echo "# This file exists only for backwards compatibility for"; + echo "# tools that run '--defaults-file=/etc/mysql/debian.cnf'"; + echo "# and have root level access to the local filesystem."; + echo "# With those permissions one can run 'mariadb' directly"; + echo "# anyway thanks to unix socket authentication and hence"; + echo "# this file is useless. See package README for more info."; + echo "[client]"; + echo "host = localhost"; + echo "user = root"; + echo "[mysql_upgrade]"; + echo "host = localhost"; + echo "user = root"; + echo "# THIS FILE WILL BE REMOVED IN A FUTURE DEBIAN RELEASE."; + } >> $dc fi # Keep it only root-readable, as it always was chown 0:0 $dc @@ -215,8 +244,10 @@ EOF # on by default) to work both to disable a default profile, and to keep # any profile installed and maintained by users themselves. profile="/etc/apparmor.d/usr.sbin.mariadbd" - if [ -f "$profile" ] && aa-status --enabled 2>/dev/null; then - if grep -q /usr/sbin/mariadbd "$profile" 2>/dev/null ; then + if [ -f "$profile" ] && aa-status --enabled 2>/dev/null + then + if grep -q /usr/sbin/mariadbd "$profile" 2>/dev/null + then apparmor_parser -r "$profile" || true else echo "/usr/sbin/mariadbd { }" | apparmor_parser --remove 2>/dev/null || true @@ -228,24 +259,24 @@ EOF # Note that file cannot be empty, otherwise systemd version in Ubuntu Bionic # will think the service is masked echo "# empty placeholder" > /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf - - ;; + ;; abort-upgrade|abort-remove|abort-configure) - ;; + ;; triggered) - if [ -d /run/systemd/system ]; then + if [ -d /run/systemd/system ] + then systemctl --system daemon-reload else invoke-rc.d mariadb restart fi - ;; + ;; *) echo "postinst called with unknown argument '$1'" 1>&2 exit 1 - ;; + ;; esac db_stop # in case invoke fails @@ -255,19 +286,23 @@ db_stop # in case invoke fails # systemctl. If we upgrade from MySQL mysql.service may be masked, which also # means init.d script is disabled. Unmask mysql service explicitly. # Check first that the command exists, to avoid emitting any warning messages. -if [ -x "$(command -v deb-systemd-helper)" ]; then +if [ -x "$(command -v deb-systemd-helper)" ] +then deb-systemd-helper unmask mysql.service > /dev/null fi #DEBHELPER# # Modified dh_systemd_start snippet that's not added automatically -if [ -d /run/systemd/system ]; then - systemctl --system daemon-reload >/dev/null || true - deb-systemd-invoke start mariadb.service >/dev/null || true -# Modified dh_installinit snippet to only run with sysvinit -elif [ -x "/etc/init.d/mariadb" ]; then - if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then - invoke-rc.d mariadb start || exit $? - fi +if [ -d /run/systemd/system ] +then + systemctl --system daemon-reload >/dev/null || true + deb-systemd-invoke start mariadb.service >/dev/null || true + # Modified dh_installinit snippet to only run with sysvinit +elif [ -x "/etc/init.d/mariadb" ] +then + if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] + then + invoke-rc.d mariadb start || exit $? + fi fi diff --git a/debian/mariadb-server-10.8.postrm b/debian/mariadb-server-10.8.postrm index 97789a038df38..41ed3ffe97902 100644 --- a/debian/mariadb-server-10.8.postrm +++ b/debian/mariadb-server-10.8.postrm @@ -1,12 +1,18 @@ #!/bin/bash set -e +# shellcheck source=/dev/null . /usr/share/debconf/confmodule # Automatically set version to ease maintenance of this file MAJOR_VER="${DPKG_MAINTSCRIPT_PACKAGE#mariadb-server-}" -if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi +if [ -n "$DEBIAN_SCRIPT_DEBUG" ] +then + set -v -x + DEBIAN_SCRIPT_TRACE=1 +fi + ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" @@ -15,40 +21,43 @@ MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" # do it himself. No database directories should be removed while the server # is running! Another mariadbd in e.g. a different chroot is fine for us. stop_server() { - # Return immediately if there are no mysql processes running - # as there is no point in trying to shutdown in that case. - if ! pgrep -x mariadbd > /dev/null; then return; fi - # Compatibility with versions that ran 'mysqld' - if ! pgrep -x mysqld > /dev/null; then return; fi - - set +e - invoke-rc.d mariadb stop - invoke-rc.d mysql stop # Backwards compatibility - errno=$? - set -e - - # systemctl could emit exit code 100=no init script (fresh install) - if [ "$errno" != 0 -a "$errno" != 100 ]; then - echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2 - echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2 - echo "Stop it yourself and try again!" 1>&2 - db_stop - exit 1 - fi + # Return immediately if there are no mysqld processes running + # as there is no point in trying to shutdown in that case. + if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null + then + return + fi + + set +e + invoke-rc.d mariadb stop + invoke-rc.d mysql stop # Backwards compatibility + errno=$? + set -e + + # systemctl could emit exit code 100=no init script (fresh install) + if [ "$errno" != 0 ] && [ "$errno" != 100 ] + then + echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2 + echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2 + echo "Stop it yourself and try again!" 1>&2 + db_stop + exit 1 + fi } case "$1" in purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - if [ -n "`$MYADMIN ping 2>/dev/null`" ]; then + if [ -n "$($MYADMIN ping 2>/dev/null)" ] + then stop_server sleep 2 fi - ;; + ;; *) echo "postrm called with unknown argument '$1'" 1>&2 exit 1 - ;; + ;; esac # @@ -56,7 +65,8 @@ esac # - Remove the mysql user only after all his owned files are purged. # - Cleanup the initscripts only if this was the last provider of them # -if [ "$1" = "purge" ] && [ -f "/var/lib/mysql/debian-$MAJOR_VER.flag" ]; then +if [ "$1" = "purge" ] && [ -f "/var/lib/mysql/debian-$MAJOR_VER.flag" ] +then # we remove the mysql user only after all his owned files are purged rm -f /var/log/mysql.{log,err}{,.0,.[1234567].gz} rm -rf /var/log/mysql @@ -64,7 +74,8 @@ if [ "$1" = "purge" ] && [ -f "/var/lib/mysql/debian-$MAJOR_VER.flag" ]; then db_input high "mariadb-server-$MAJOR_VER/postrm_remove_databases" || true db_go || true db_get "mariadb-server-$MAJOR_VER/postrm_remove_databases" || true - if [ "$RET" = "true" ]; then + if [ "$RET" = "true" ] + then # never remove the debian.cnf when the databases are still existing # else we ran into big trouble on the next install! rm -f /etc/mysql/debian.cnf @@ -77,9 +88,9 @@ if [ "$1" = "purge" ] && [ -f "/var/lib/mysql/debian-$MAJOR_VER.flag" ]; then if [ -d /var/lib/mysql ] then find /var/lib/mysql -mindepth 1 \ - -not -path '*/lost+found/*' -not -name 'lost+found' \ - -not -path '*/lost@002bfound/*' -not -name 'lost@002bfound' \ - -delete + -not -path '*/lost+found/*' -not -name 'lost+found' \ + -not -path '*/lost@002bfound/*' -not -name 'lost@002bfound' \ + -delete # "|| true" still needed as rmdir still exits with non-zero if # /var/lib/mysql is a mount point @@ -94,6 +105,7 @@ fi #DEBHELPER# # Modified dh_systemd_start snippet that's not added automatically -if [ -d /run/systemd/system ]; then - systemctl --system daemon-reload >/dev/null || true +if [ -d /run/systemd/system ] +then + systemctl --system daemon-reload >/dev/null || true fi diff --git a/debian/mariadb-server-10.8.preinst b/debian/mariadb-server-10.8.preinst index 919031066c9ba..9a31b5c636ee0 100644 --- a/debian/mariadb-server-10.8.preinst +++ b/debian/mariadb-server-10.8.preinst @@ -7,17 +7,23 @@ # * abort-upgrade # +# shellcheck source=/dev/null . /usr/share/debconf/confmodule # Automatically set version to ease maintenance of this file MAJOR_VER="${DPKG_MAINTSCRIPT_PACKAGE#mariadb-server-}" # Just kill the invalid insserv.conf.d directory without fallback -if [ -d "/etc/insserv.conf.d/mariadb/" ]; then - rm -rf "/etc/insserv.conf.d/mariadb/" +if [ -d "/etc/insserv.conf.d/mariadb/" ] +then + rm -rf "/etc/insserv.conf.d/mariadb/" fi -if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi +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 @@ -28,26 +34,29 @@ mysql_upgradedir=/var/lib/mysql-upgrade # do it himself. No database directories should be removed while the server # is running! Another mariadbd in e.g. a different chroot is fine for us. stop_server() { - # Return immediately if there are no mysql processes running - # as there is no point in trying to shutdown in that case. - if ! pgrep -x --ns $$ mariadbd > /dev/null; then return; fi - # Compatibility with versions that ran 'mysqld' - if ! pgrep -x --ns $$ mysqld > /dev/null; then return; fi - - set +e - invoke-rc.d mariadb stop - invoke-rc.d mysql stop # Backwards compatibility - errno=$? - set -e - - # systemctl could emit exit code 100=no init script (fresh install) - if [ "$errno" != 0 -a "$errno" != 100 ]; then - echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2 - echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2 - echo "Stop it yourself and try again!" 1>&2 - db_stop - exit 1 - fi + # Return immediately if there are no mysqld processes running on a host + # (leave containerized processes with the same name in other namespaces) + # as there is no point in trying to shutdown in that case. + if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null + then + return + fi + + set +e + invoke-rc.d mariadb stop + invoke-rc.d mysql stop # Backwards compatibility + errno=$? + set -e + + # systemctl could emit exit code 100=no init script (fresh install) + if [ "$errno" != 0 ] && [ "$errno" != 100 ] + then + echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2 + echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2 + echo "Stop it yourself and try again!" 1>&2 + db_stop + exit 1 + fi } ################################ main() ########################## @@ -58,7 +67,7 @@ max_upgradeable_version=5.7 # Check if a flag file is found that indicates a previous MariaDB or MySQL # version was installed. If multiple flags are found, check which one was # the biggest version number. -for flag in $mysql_datadir/debian-*.flag +for flag in "$mysql_datadir"/debian-*.flag do # The for loop leaves $flag as the query string if there are no results, @@ -93,7 +102,7 @@ done # Downgrade is detected if the flag version is bigger than $this_version # (e.g. 10.1 > 10.0) or the flag version is smaller than 10.0 but bigger # than $max_upgradeable_version. -if [ ! -z "$found_version" ] +if [ -n "$found_version" ] then # MySQL 8.0 in Ubuntu has a bug in packaging and the file is name wrongly @@ -113,17 +122,29 @@ then fi if dpkg --compare-versions "$found_version" '>>' "$max_upgradeable_version" \ - && dpkg --compare-versions "$found_version" '<<' "10.0" + && dpkg --compare-versions "$found_version" '<<' "10.0" then downgrade_detected=true fi fi +# If there is no debian-*.flag, and no version was detected, but a file that +# indicated MySQL 8.0 is found (undo_001 is created by default in MySQL 8.0+ +# installs), then that file is enough of additional indication to trigger the +# move of the data directory. +if [ -z "$found_version" ] && + [ -z "$(find $mysql_datadir/debian-*.flag 2> /dev/null)" ] && + [ -f "$mysql_datadir/undo_001" ] +then + echo "$mysql_datadir: no server version flag found, assuming MySQL 8.0 data encountered" + downgrade_detected=true + found_version="previous" # Just use dummy name as we don't know real version +fi # Don't abort dpkg if downgrade is detected (as was done previously). # Instead simply move the old datadir and create a new for this_version. -if [ ! -z "$downgrade_detected" ] +if [ -n "$downgrade_detected" ] then db_input critical "mariadb-server-$MAJOR_VER/old_data_directory_saved" || true db_go @@ -134,8 +155,8 @@ then echo "Please manually export/import your data (e.g. with mysqldump) if needed." 1>&2 mv -f "$mysql_datadir" "$mysql_datadir-$found_version" # Also move away the old debian.cnf file that included credentials that are - # no longer valid - mv -f /etc/mysql/debian.cnf "/etc/mysql/debian.cnf-$found_version" + # no longer valid. If none existed, ignore error and let dpkg continue. + mv -f /etc/mysql/debian.cnf "/etc/mysql/debian.cnf-$found_version" || true fi # to be sure @@ -144,7 +165,8 @@ stop_server # If we use NIS then errors should be tolerated. It's up to the # user to ensure that the mysql user is correctly setup. # Beware that there are two ypwhich one of them needs the 2>/dev/null! -if test -n "$(which ypwhich 2>/dev/null)" && ypwhich >/dev/null 2>&1; then +if test -n "$(which ypwhich 2>/dev/null)" && ypwhich >/dev/null 2>&1 +then set +e fi @@ -159,23 +181,25 @@ fi # # creating mysql group if he isn't already there -if ! getent group mysql >/dev/null; then - # Adding system group: mysql. - addgroup --system mysql >/dev/null +if ! getent group mysql >/dev/null +then + # Adding system group: mysql. + addgroup --system mysql >/dev/null fi # creating mysql user if he isn't already there -if ! getent passwd mysql >/dev/null; then - # Adding system user: mysql. - adduser \ - --system \ - --disabled-login \ - --ingroup mysql \ - --no-create-home \ - --home /nonexistent \ - --gecos "MySQL Server" \ - --shell /bin/false \ - mysql >/dev/null +if ! getent passwd mysql >/dev/null +then + # Adding system user: mysql. + adduser \ + --system \ + --disabled-login \ + --ingroup mysql \ + --no-create-home \ + --home /nonexistent \ + --gecos "MySQL Server" \ + --shell /bin/false \ + mysql >/dev/null fi # end of NIS tolerance zone @@ -183,7 +207,8 @@ set -e # if there's a symlink, let's store where it's pointing, because otherwise # it's going to be lost in some situations -for dir in DATADIR LOGDIR; do +for dir in DATADIR LOGDIR +do checkdir=$(eval echo "$"$dir) if [ -L "$checkdir" ]; then # Use mkdir option 'Z' to create with correct SELinux context. @@ -193,13 +218,17 @@ for dir in DATADIR LOGDIR; do done # creating mysql home directory -if [ ! -d $mysql_datadir ] && [ ! -L $mysql_datadir ]; then - # Use mkdir option 'Z' to create with correct SELinux context. +if [ ! -d $mysql_datadir ] && [ ! -L $mysql_datadir ] +then + # Use mkdir option 'Z' to create with correct SELinux context. mkdir -Z $mysql_datadir fi -# checking disc space -if LC_ALL=C BLOCKSIZE= df --portability $mysql_datadir/. | tail -n 1 | awk '{ exit ($4>1000) }'; then +# As preset blocksize of GNU df is 1024 then available bytes is $df_available_blocks * 1024 +# 4096 blocks is then lower than 4 MB +df_available_blocks=`LC_ALL=C BLOCKSIZE= df --output=avail "$datadir" | tail -n 1` +if [ "$df_available_blocks" -lt "4096" ] +then echo "ERROR: There's not enough space in $mysql_datadir/" 1>&2 db_stop exit 1 @@ -218,7 +247,6 @@ find $mysql_datadir -follow -not -group mysql -print0 2>/dev/null \ | xargs -0 --no-run-if-empty chgrp mysql set -e - db_stop #DEBHELPER# diff --git a/debian/mariadb-server-10.8.prerm b/debian/mariadb-server-10.8.prerm index 8fd172da9d28c..2701fa5fc3622 100644 --- a/debian/mariadb-server-10.8.prerm +++ b/debian/mariadb-server-10.8.prerm @@ -4,9 +4,11 @@ set -e #DEBHELPER# # Modified dh_systemd_start snippet that's not added automatically -if [ -d /run/systemd/system ]; then - deb-systemd-invoke stop mariadb.service >/dev/null -# Modified dh_installinit snippet to only run with sysvinit -elif [ -x "/etc/init.d/mariadb" ]; then - invoke-rc.d mariadb stop || exit $? +if [ -d /run/systemd/system ] +then + deb-systemd-invoke stop mariadb.service >/dev/null + # Modified dh_installinit snippet to only run with sysvinit +elif [ -x "/etc/init.d/mariadb" ] +then + invoke-rc.d mariadb stop || exit $? fi diff --git a/debian/mariadb-server-core-10.8.install b/debian/mariadb-server-core-10.8.install index f760f34e3f7e0..6d159ba4c6a1d 100644 --- a/debian/mariadb-server-core-10.8.install +++ b/debian/mariadb-server-core-10.8.install @@ -11,7 +11,9 @@ usr/share/man/man1/mysql_upgrade.1 usr/share/man/man1/resolveip.1 usr/share/man/man8/mariadbd.8 usr/share/man/man8/mysqld.8 +usr/share/mysql/bulgarian usr/share/mysql/charsets +usr/share/mysql/chinese usr/share/mysql/czech usr/share/mysql/danish usr/share/mysql/dutch diff --git a/debian/mariadb-test-data.lintian-overrides b/debian/mariadb-test-data.lintian-overrides index 4ff05a3be2af6..85e40a8b429bd 100644 --- a/debian/mariadb-test-data.lintian-overrides +++ b/debian/mariadb-test-data.lintian-overrides @@ -1,3 +1,34 @@ # These should be moved, see https://jira.mariadb.org/browse/MDEV-21654 arch-dependent-file-in-usr-share usr/share/mysql/mysql-test/suite/plugins/pam/pam_mariadb_mtr.so +arch-dependent-file-in-usr-share [usr/share/mysql/mysql-test/suite/plugins/pam/pam_mariadb_mtr.so] arch-independent-package-contains-binary-or-object usr/share/mysql/mysql-test/suite/plugins/pam/pam_mariadb_mtr.so +arch-independent-package-contains-binary-or-object [usr/share/mysql/mysql-test/suite/plugins/pam/pam_mariadb_mtr.so] +# Mainly for support for *BSD family. Not right way to do but this is test package and not for production +incorrect-path-for-interpreter /usr/bin/env perl != /usr/bin/perl [usr/share/mysql/mysql-test/std_data/checkDBI_DBD-MariaDB.pl] +incorrect-path-for-interpreter /usr/bin/env perl != /usr/bin/perl [usr/share/mysql/mysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl] +incorrect-path-for-interpreter /usr/bin/env perl != /usr/bin/perl [usr/share/mysql/mysql-test/suite/funcs_1/lib/DataGen_local.pl] +incorrect-path-for-interpreter /usr/bin/env perl != /usr/bin/perl [usr/share/mysql/mysql-test/suite/funcs_1/lib/DataGen_modify.pl] +incorrect-path-for-interpreter /usr/bin/env perl != /usr/bin/perl [usr/share/mysql/mysql-test/suite/funcs_2/lib/gen_charset_utf8.pl] +incorrect-path-for-interpreter /usr/bin/env perl != /usr/bin/perl [usr/share/mysql/mysql-test/suite/rpl/extension/checksum.pl] +# Intentional for test files +national-encoding usr/share/mysql/mysql-test/* +# Extra test documentation files that really need to be kept in context in test directory +package-contains-documentation-outside-usr-share-doc usr/share/mysql/mysql-test/* +# Intentional directory structure +repeated-path-segment auth_gssapi usr/share/mysql/mysql-test/plugin/auth_gssapi/auth_gssapi/ +repeated-path-segment connect usr/share/mysql/mysql-test/plugin/connect/connect/ +repeated-path-segment disks usr/share/mysql/mysql-test/plugin/disks/disks/ +repeated-path-segment func_test usr/share/mysql/mysql-test/plugin/func_test/func_test/ +repeated-path-segment metadata_lock_info usr/share/mysql/mysql-test/plugin/metadata_lock_info/metadata_lock_info/ +repeated-path-segment mroonga usr/share/mysql/mysql-test/plugin/mroonga/mroonga/ +repeated-path-segment mroonga usr/share/mysql/mysql-test/plugin/mroonga/mroonga/include/mroonga/ +repeated-path-segment oqgraph usr/share/mysql/mysql-test/plugin/oqgraph/oqgraph/ +repeated-path-segment query_response_time usr/share/mysql/mysql-test/plugin/query_response_time/query_response_time/ +repeated-path-segment rocksdb usr/share/mysql/mysql-test/plugin/rocksdb/rocksdb/ +repeated-path-segment sequence usr/share/mysql/mysql-test/plugin/sequence/sequence/ +repeated-path-segment sphinx usr/share/mysql/mysql-test/plugin/sphinx/sphinx/ +repeated-path-segment spider usr/share/mysql/mysql-test/plugin/spider/spider/ +repeated-path-segment type_inet usr/share/mysql/mysql-test/plugin/type_inet/type_inet/ +repeated-path-segment type_test usr/share/mysql/mysql-test/plugin/type_test/type_test/ +repeated-path-segment user_variables usr/share/mysql/mysql-test/plugin/user_variables/user_variables/ +repeated-path-segment wsrep_info usr/share/mysql/mysql-test/plugin/wsrep_info/wsrep_info/ diff --git a/debian/mariadb-test.install b/debian/mariadb-test.install index 36b49bdab975a..e587a3bf73df0 100644 --- a/debian/mariadb-test.install +++ b/debian/mariadb-test.install @@ -37,8 +37,8 @@ usr/share/mysql/mysql-test/README.stress usr/share/mysql/mysql-test/dgcov.pl usr/share/mysql/mysql-test/lib usr/share/mysql/mysql-test/mariadb-stress-test.pl -usr/share/mysql/mysql-test/mysql-test-run.pl usr/share/mysql/mysql-test/mariadb-test-run.pl +usr/share/mysql/mysql-test/mysql-test-run.pl usr/share/mysql/mysql-test/purify.supp usr/share/mysql/mysql-test/suite.pm usr/share/mysql/mysql-test/valgrind.supp diff --git a/debian/mariadb-test.links b/debian/mariadb-test.links index 3c45bb955c41f..c7e4ae10063bb 100644 --- a/debian/mariadb-test.links +++ b/debian/mariadb-test.links @@ -2,7 +2,7 @@ usr/bin/mariadb-client-test usr/bin/mysql_client_test usr/bin/mariadb-client-test-embedded usr/bin/mysql_client_test_embedded usr/bin/mariadb-test usr/bin/mysqltest usr/bin/mariadb-test-embedded usr/bin/mysqltest_embedded -usr/share/mysql/mysql-test/mariadb-test-run.pl usr/share/mysql/mysql-test/mysql-test-run.pl -usr/share/mysql/mysql-test/mariadb-test-run.pl usr/share/mysql/mysql-test/mysql-test-run -usr/share/mysql/mysql-test/mariadb-test-run.pl usr/share/mysql/mysql-test/mtr usr/share/mysql/mysql-test/mariadb-test-run.pl usr/share/mysql/mysql-test/mariadb-test-run +usr/share/mysql/mysql-test/mariadb-test-run.pl usr/share/mysql/mysql-test/mtr +usr/share/mysql/mysql-test/mariadb-test-run.pl usr/share/mysql/mysql-test/mysql-test-run +usr/share/mysql/mysql-test/mariadb-test-run.pl usr/share/mysql/mysql-test/mysql-test-run.pl diff --git a/debian/mariadb-test.lintian-overrides b/debian/mariadb-test.lintian-overrides index 9de1b3784ff26..5bac3d60cacf4 100644 --- a/debian/mariadb-test.lintian-overrides +++ b/debian/mariadb-test.lintian-overrides @@ -1,3 +1,10 @@ # These should be moved, see https://jira.mariadb.org/browse/MDEV-21653 arch-dependent-file-in-usr-share usr/share/mysql/mysql-test/lib/My/SafeProcess/my_safe_process arch-dependent-file-in-usr-share usr/share/mysql/mysql-test/lib/My/SafeProcess/wsrep_check_version +arch-dependent-file-in-usr-share [usr/share/mysql/mysql-test/lib/My/SafeProcess/my_safe_process] +arch-dependent-file-in-usr-share [usr/share/mysql/mysql-test/lib/My/SafeProcess/wsrep_check_version] +# Mainly for support for *BSD family. Not right way to do but this is test package and not for production +incorrect-path-for-interpreter /usr/bin/env perl != /usr/bin/perl [usr/share/mysql/mysql-test/lib/process-purecov-annotations.pl] +incorrect-path-for-interpreter /usr/bin/env perl != /usr/bin/perl [usr/share/mysql/mysql-test/lib/v1/mysql-test-run.pl] +incorrect-path-for-interpreter /usr/bin/env perl != /usr/bin/perl [usr/share/mysql/mysql-test/mysql-stress-test.pl] +incorrect-path-for-interpreter /usr/bin/env perl != /usr/bin/perl [usr/share/mysql/mysql-test/mysql-test-run.pl] diff --git a/debian/rules b/debian/rules index 7428807707561..fb28b4fc7ce1a 100755 --- a/debian/rules +++ b/debian/rules @@ -3,6 +3,12 @@ # Enable Debian Hardening # https://wiki.debian.org/Hardening export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# Disable LTO on Ubuntu, see LP: #1970634 and https://jira.mariadb.org/browse/MDEV-25633 +ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes), yes) + export DEB_BUILD_MAINT_OPTIONS += optimize=-lto +endif + DPKG_EXPORT_BUILDFLAGS = 1 # Include all defaults, including buildflags.mk include /usr/share/dpkg/default.mk @@ -43,11 +49,6 @@ ifeq (32,$(DEB_HOST_ARCH_BITS)) CMAKEFLAGS += -DPLUGIN_ROCKSDB=NO endif -# ColumnStore can build only on amd64 and arm64 -ifneq (,$(filter $(DEB_HOST_ARCH_CPU),amd64 arm64)) - CMAKEFLAGS += -DPLUGIN_COLUMNSTORE=NO -endif - # Cross building requires stack direction instruction ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) ifneq (,$(filter $(DEB_HOST_ARCH_CPU),alpha amd64 arm arm64 i386 ia64 m68k mips64el mipsel powerpc ppc64 ppc64el riscv64 s390x sh4 sparc64)) @@ -60,8 +61,8 @@ endif # Only attempt to build with PMEM on archs that have package libpmem-dev available # See https://packages.debian.org/search?searchon=names&keywords=libpmem-dev -ifneq (,$(filter $(DEB_HOST_ARCH_CPU),amd64 arm64 ppc64el)) - CMAKEFLAGS += -DWITH_PMEM=yes +ifneq (,$(filter $(DEB_HOST_ARCH),amd64 arm64 ppc64el riscv64)) + CMAKEFLAGS += -DWITH_PMEM=ON endif # Add support for verbose builds @@ -89,6 +90,9 @@ endif # quality standards in Debian. Also building it requires an extra 4 GB of disk # space which makes native Debian builds fail as the total disk space needed # for MariaDB becomes over 10 GB. Only build CS via autobake-deb.sh. + # + # Note: Don't use '-DWITH_URING=ON' as some Buildbot builders are missing it + # and would fail permanently. PATH=$${MYSQL_BUILD_PATH:-"/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin"} \ NO_UPDATE_BUILD_VERSION=1 \ dh_auto_configure --builddirectory=$(BUILDDIR) -- \ @@ -102,9 +106,8 @@ endif -DBUILD_CONFIG=mysql_release \ -DCONC_DEFAULT_CHARSET=utf8mb4 \ -DPLUGIN_AWS_KEY_MANAGEMENT=NO \ - -DPLUGIN_COLUMNSTORE=NO \ - -DIGNORE_AIO_CHECK=YES \ - -DWITH_URING=yes \ + -DPLUGIN_COLUMNSTORE=NO \ + -DIGNORE_AIO_CHECK=ON \ -DDEB=$(DEB_VENDOR) # This is needed, otherwise 'make test' will run before binaries have been built @@ -112,12 +115,14 @@ override_dh_auto_build: @echo "RULES.$@" # Print build env info to help debug builds on different platforms dpkg-architecture - cd $(BUILDDIR) && $(MAKE) + cd $(BUILDDIR) && $(MAKE) --output-sync=target override_dh_auto_test: @echo "RULES.$@" dh_testdir + # Ensure at least an empty file exists touch mysql-test/unstable-tests + # Skip unstable tests if such are defined for arch [ ! -f debian/unstable-tests.$(DEB_HOST_ARCH) ] || cat debian/unstable-tests.$(DEB_HOST_ARCH) >> mysql-test/unstable-tests # Run testsuite ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) @@ -200,6 +205,7 @@ override_dh_installinit-arch: dh_installinit --name=mariadb --no-start -- defaults 19 21 dh_systemd_start --restart-after-upgrade +# Use custom server version string variable override_dh_gencontrol: dh_gencontrol -- -Tdebian/substvars diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml index 53b90650e8ac4..162186b938658 100644 --- a/debian/salsa-ci.yml +++ b/debian/salsa-ci.yml @@ -7,7 +7,7 @@ include: # Override Salsa-CI with MariaDB specific variations variables: DEB_BUILD_OPTIONS: "nocheck noautodbgsym" - RELEASE: sid + RELEASE: bullseye SALSA_CI_DISABLE_REPROTEST: 1 SALSA_CI_DISABLE_MISSING_BREAKS: 0 SALSA_CI_DISABLE_RC_BUGS: 1 @@ -16,12 +16,17 @@ variables: GIT_SUBMODULE_STRATEGY: recursive SALSA_CI_GBP_BUILDPACKAGE_ARGS: "--git-submodules" # did not apply to extract-sources +# Extend Salsa-CI build jobs to have longer timeout as the default GitLab +# timeout (1h) is often not enough +.build-package: + timeout: 3h + stages: - provisioning - build - test - - upgrade in Sid - - upgrade from Bullseye/Buster/Stretch + - upgrade in Bullseye + - upgrade from Buster - upgrade extras - test extras - publish # Stage referenced by Salsa-CI template aptly stanza, so must exist even though not used @@ -34,7 +39,7 @@ build: - mv ${CCACHE_WORK_DIR} ${CCACHE_TMP_DIR} # Run Salsa-CI .build-script equivalent, with extra devscripts so autobake-deb.sh can run 'dch' - export CCACHE_DIR=${CCACHE_TMP_DIR} - - apt-get update && eatmydata apt-get install --no-install-recommends -y ccache fakeroot build-essential devscripts + - apt-get update && eatmydata apt-get install --no-install-recommends -y ccache fakeroot build-essential devscripts lsb-release - cd ${WORKING_DIR}/${SOURCE_DIR} - eatmydata apt-get build-dep --no-install-recommends -y . - update-ccache-symlinks; ccache -z # Zero out ccache counters @@ -46,31 +51,46 @@ build: - ccache -s # Show ccache stats to validate it worked - mv ${CCACHE_TMP_DIR} ${CCACHE_WORK_DIR} -build bullseye-backports: - extends: .build-package - variables: - RELEASE: bullseye-backports +build i386: + extends: .build-package-i386 + script: + - *autobake-deb-steps -build buster-backports: +build sid: extends: .build-package script: - *autobake-deb-steps variables: - RELEASE: buster-backports + RELEASE: sid -# base image missing git -build i386: +build buster-backports: extends: .build-package script: - - apt-get update && apt-get install -y --no-install-recommends git + # Increase default backports priority policy from '100' to '500' so it can actually be used + - | + cat << EOF > /etc/apt/preferences.d/enable-backports-to-satisfy-dependencies + Package: * + Pin: release n=buster-* + Pin-Priority: 500 + EOF - *autobake-deb-steps - image: $SALSA_CI_IMAGES_BASE_I386 variables: - ARCH: 'i386' + RELEASE: buster-backports -build native deb: +# Build native deb without using autobake-deb.sh. This way we will detect +# if the debian/control file and other packaging is correct as-is for Debian Sid. +build native deb amd64: extends: .build-package +build native deb i386: + extends: .build-package-i386 + +autopkgtest: + extends: .test-autopkgtest + artifacts: + reports: + junit: ${WORKING_DIR}/debci/artifacts/mysql-test-run-junit.xml + piuparts: extends: .test-piuparts stage: test extras @@ -78,8 +98,9 @@ piuparts: blhc: extends: .test-blhc stage: test extras + # Build log checker needs a .build file and thus only works on native build needs: - - job: build native deb + - job: build native deb amd64 # In addition to Salsa-CI, also run these fully MariaDB specific build jobs @@ -94,30 +115,52 @@ blhc: # Avoid the warnings of "debconf: unable to initialize frontend: Dialog" echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections # Prime the apt cache so later apt commands can run - apt-get update + apt-get update -qq .test-verify-initial: &test-verify-initial | dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed service mysql status || service mariadb status # Early MariaDB 10.5 only had 'mariadb' mysql --skip-column-names -e "select @@version, @@version_comment" # Show version - mysql --table -e 'SHOW DATABASES;' # List databases before upgrade + mysql --table -e "SHOW DATABASES;" # List databases before upgrade mysql --table -e "SELECT host,user,plugin,authentication_string FROM user;" mysql mysql --table -e "SELECT * FROM plugin;" mysql mysql --table -e "SHOW PLUGINS;" mysql -.test-enable-sid-repos: &test-enable-sid-repos | +.test-enable-bullseye-repos: &test-enable-bullseye-repos # Replace any old repos with just Sid - echo 'deb http://deb.debian.org/debian sid main' > /etc/apt/sources.list + - echo 'deb http://deb.debian.org/debian bullseye main' > /etc/apt/sources.list # Upgrade minimal stack first - apt-get update - apt-get install -y apt - -.test-install: &test-install | + - apt-get update -qq + - apt-get install -y apt + +.test-enable-bullseye-backports-repos: &test-enable-bullseye-backports-repos | + # Enable bullseye-backports (assumes environment already Debian Bullseye) + echo 'deb http://deb.debian.org/debian bullseye-backports main' > /etc/apt/sources.list.d/bullseye-backports.list + # Increase default backports priority policy from '100' to '500' so it can actually be used + cat << EOF > /etc/apt/preferences.d/enable-backports-to-satisfy-dependencies + Package: * + Pin: release n=bullseye-* + Pin-Priority: 500 + EOF + apt-get update -qq + +.test-enable-buster-backports-repos: &test-enable-buster-backports-repos | + # Enable buster-backports (assumes environment already Debian Buster) + echo 'deb http://deb.debian.org/debian buster-backports main' > /etc/apt/sources.list.d/buster-backports.list + # Increase default backports priority policy from '100' to '500' so it can actually be used + cat << EOF > /etc/apt/preferences.d/enable-backports-to-satisfy-dependencies + Package: * + Pin: release n=buster-* + Pin-Priority: 500 + EOF + apt-get update -qq + +.test-install: &test-install # Install MariaDB built in this commit - apt-get install -y ./*.deb + - apt-get install -y ./*.deb # Verify installation of MariaDB built in this commit - dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed - mariadb --version # Client version + - dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed + - mariadb --version # Client version .test-verify-final: &test-verify-final | mkdir -p debug # Ensure dir exists before using it @@ -125,7 +168,7 @@ blhc: cp -ra /etc/mysql debug/etc-mysql cp -ra /var/log/mysql debug/var-log-mysql mariadb --skip-column-names -e "select @@version, @@version_comment" # Show version - mariadb --table -e 'SHOW DATABASES;' # List databases + mariadb --table -e "SHOW DATABASES;" # List databases mariadb --table -e "SELECT host,user,plugin,authentication_string FROM user;" mysql mariadb --table -e "SELECT * FROM plugin;" mysql mariadb --table -e "SHOW PLUGINS;" mysql @@ -191,7 +234,7 @@ fresh install: script: - *test-prepare-container - *test-install - - service mariadb status # There is no init.d/mysql in MariaDB 10.8 + - service mariadb status # There is no init.d/mysql in MariaDB 10.5+ - *test-verify-final variables: GIT_STRATEGY: none @@ -199,8 +242,8 @@ fresh install: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ -mariadb-10.8 Sid upgrade: - stage: upgrade in Sid +mariadb-10.5 Bullseye upgrade: + stage: upgrade in Bullseye needs: - job: build image: debian:${RELEASE} @@ -211,34 +254,11 @@ mariadb-10.8 Sid upgrade: - ${WORKING_DIR}/debug script: - *test-prepare-container - - *test-install - - service mariadb status # There is no init.d/mysql in MariaDB 10.8 - - *test-verify-final - variables: - GIT_STRATEGY: none - except: - variables: - - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ - -mariadb-10.5 Bullseye to mariadb-10.8 upgrade: - stage: upgrade from Bullseye/Buster/Stretch - needs: - - job: build - image: debian:bullseye - artifacts: - when: always - name: "$CI_BUILD_NAME" - paths: - - ${WORKING_DIR}/debug - script: - - *test-prepare-container - # Install everything MariaDB currently in Debian Bullseye + # Install everything MariaDB 10.5 currently in Debian Bullseye - apt-get install -y 'default-mysql*' 'mariadb-*' 'libmariadb*' - # Verify installation of MariaDB from Bullseye - *test-verify-initial - - *test-enable-sid-repos - *test-install - - service mariadb status + - service mariadb status # There is no init.d/mysql in MariaDB 10.5+ - *test-verify-final variables: GIT_STRATEGY: none @@ -246,10 +266,10 @@ mariadb-10.5 Bullseye to mariadb-10.8 upgrade: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ -mariadb-10.3 Buster to mariadb-10.8 upgrade: - stage: upgrade from Bullseye/Buster/Stretch +mariadb-10.3 with Buster backports upgrade: + stage: upgrade extras needs: - - job: build + - job: build buster-backports image: debian:buster artifacts: when: always @@ -258,13 +278,16 @@ mariadb-10.3 Buster to mariadb-10.8 upgrade: - ${WORKING_DIR}/debug script: - *test-prepare-container - # Install everything MariaDB currently in Debian Buster + # Install everything MariaDB 10.3 currently in Debian Buster - apt-get install -y 'default-mysql*' 'mariadb-*' 'libmariadb*' # Verify installation of MariaDB from Buster - *test-verify-initial - - *test-enable-sid-repos + # Buster backports is needed for liburing1 (>= 0.7) and galera-4 (>= 26.4) + - *test-enable-buster-backports-repos - *test-install + # mariadb-10.3 in Buster ships a /etc/init.d/mysql so it should continue to work - service mysql status + - service mariadb status - *test-verify-final variables: GIT_STRATEGY: none @@ -272,11 +295,11 @@ mariadb-10.3 Buster to mariadb-10.8 upgrade: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ -mariadb-10.1 Stretch to mariadb-10.8 upgrade: - stage: upgrade from Bullseye/Buster/Stretch +mariadb-10.3 Buster upgrade: + stage: upgrade from Buster needs: - job: build - image: debian:stretch + image: debian:buster artifacts: when: always name: "$CI_BUILD_NAME" @@ -284,15 +307,15 @@ mariadb-10.1 Stretch to mariadb-10.8 upgrade: - ${WORKING_DIR}/debug script: - *test-prepare-container - # Install almost everything currently in Debian Stretch, - # omitting libmariadbclient-dev-compat as it would conflict - - apt-get install -y 'default-mysql*' 'mariadb-*' 'libmariadbd*' 'libmariadbclient*' - # Verify installation of MariaDB from Stretch + # Install everything MariaDB 10.3 currently in Debian Buster + - apt-get install -y 'default-mysql*' 'mariadb-*' 'libmariadb*' + # Verify installation of MariaDB from Buster - *test-verify-initial - - apt-get remove -y manpages # Workaround for Bug#99375 - - *test-enable-sid-repos + - *test-enable-bullseye-repos - *test-install + # mariadb-10.3 in Buster ships a /etc/init.d/mysql so it should continue to work - service mysql status + - service mariadb status - *test-verify-final variables: GIT_STRATEGY: none @@ -313,7 +336,7 @@ test basic features: script: - *test-prepare-container - *test-install - - service mariadb status # There is no init.d/mysql in MariaDB 10.8 + - service mariadb status # There is no init.d/mysql in MariaDB 10.5+ - *test-verify-final - | # Print info about server @@ -390,7 +413,7 @@ build mariadbclient consumer Python-MySQLdb: image: debian:${RELEASE} script: - *test-prepare-container - # Run each step separately to avoitda 800+ lines chunk that lacks the + # Run each step separately to avoid an 800+ line chunk that lacks the # commands themselves printed and Gitlab-CI cutting off the output - apt-get install -y pkg-config ./libmariadb-dev*.deb ./libmariadb3_*.deb ./mariadb-common*.deb - pkg-config --cflags --libs mysqlclient # See what MySQLdb builds with @@ -404,41 +427,8 @@ build mariadbclient consumer Python-MySQLdb: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ -libmysql* to libmariadb* upgrade: - stage: upgrade in Sid - needs: - - job: build - image: debian:${RELEASE} - artifacts: - when: always - name: "$CI_BUILD_NAME" - paths: - - ${WORKING_DIR}/debug - script: - - *test-prepare-container - # Install all libmysql* available in Debian unstable - - apt-get install -y pkg-config libmysqlclient-dev - - pkg-config --list-all - - pkg-config --cflags mysqlclient # mysqlclient.pc from original package - - apt-get install -y ./libmariadb3_*.deb ./mariadb-common_*.deb - - pkg-config --list-all - - apt-get install -y ./libmariadb-dev_*.deb - - pkg-config --list-all - - apt-get install -y ./libmariadb-dev-compat_*.deb - - pkg-config --cflags mysqlclient # mysqlclient.pc from compat package - - pkg-config --list-all - - apt-get install -y ./libmariadbd19_*.deb - - pkg-config --list-all - - apt-get install -y ./libmariadbd-dev_*.deb - - pkg-config --list-all - - apt-get install -y default-libmysqlclient-dev default-libmysqld-dev - - *test-verify-libs - except: - variables: - - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ - -default-libmysqlclient-dev Sid upgrade: - stage: upgrade in Sid +default-libmysqlclient-dev Bullseye upgrade: + stage: upgrade in Bullseye needs: - job: build image: debian:${RELEASE} @@ -458,7 +448,7 @@ default-libmysqlclient-dev Sid upgrade: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ default-libmysqlclient-dev Buster upgrade: - stage: upgrade from Bullseye/Buster/Stretch + stage: upgrade from Buster needs: - job: build image: debian:buster @@ -471,18 +461,18 @@ default-libmysqlclient-dev Buster upgrade: - *test-prepare-container - apt-get install -y pkg-config default-libmysqlclient-dev - pkg-config --list-all - - *test-enable-sid-repos + - *test-enable-bullseye-repos - *test-install-all-libs - *test-verify-libs except: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ -default-libmysqlclient-dev Stretch upgrade: - stage: upgrade from Bullseye/Buster/Stretch +default-libmysqlclient-dev with Buster backports upgrade: + stage: upgrade extras needs: - - job: build - image: debian:stretch + - job: build buster-backports + image: debian:buster artifacts: when: always name: "$CI_BUILD_NAME" @@ -492,19 +482,23 @@ default-libmysqlclient-dev Stretch upgrade: - *test-prepare-container - apt-get install -y pkg-config default-libmysqlclient-dev - pkg-config --list-all - - apt-get remove -y manpages # Workaround for Bug#99375 - - *test-enable-sid-repos + - *test-enable-buster-backports-repos - *test-install-all-libs - *test-verify-libs except: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ -mariadb-connector-c Stretch upgrade: - stage: upgrade from Bullseye/Buster/Stretch +# Upgrading from MySQL 8.0 with datadir in place is not possible. Users need to do a data dump. +# The Debian maintainer scripts detect this situation and simply moves old datadir aside and start fresh. +# +# Testing on Focal binaries on Buster works. Using Jammy binaries on Bullseye +# does not work as libc in Jammy is too new. +mysql-8.0 from Ubuntu 22.04 upgrade: + stage: upgrade extras needs: - job: build - image: debian:stretch + image: debian:${RELEASE} artifacts: when: always name: "$CI_BUILD_NAME" @@ -512,25 +506,32 @@ mariadb-connector-c Stretch upgrade: - ${WORKING_DIR}/debug script: - *test-prepare-container - - apt-get install -y pkg-config libmariadb2 libmariadb-dev libmariadb-dev-compat - - pkg-config --list-all - - apt-get remove -y manpages # Workaround for Bug#99375 - - *test-enable-sid-repos - - *test-install-all-libs - - *test-verify-libs + # Add Ubuntu Focal archive keys and repository + - apt-get install --no-install-recommends --yes gpg gpg-agent dirmngr ca-certificates # Bare minimal (<4MB) for apt-key to work + - apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com:443 871920D1991BC93C 3B4FE6ACC0B21F32 + - echo "deb http://archive.ubuntu.com/ubuntu/ focal main restricted" > /etc/apt/sources.list.d/ubuntu.list + - apt-get update -qq + # First install often fail due to bug in mysql-8.0 + - apt-get install -y mysql-server 'libmysqlc*' || true + - sleep 10 && apt-get install -f + - *test-verify-initial + - *test-install + - service mysql status + - sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server + - *test-verify-final + variables: + GIT_STRATEGY: none except: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ - allow_failure: true - # Upgrading libc from Stretch to Bookworm is not possible due to Bug#993755 # Upgrading from MySQL 8.0 with datadir in place is not possible. Users need to do a data dump. # The Debian maintainer scripts detect this situation and simply moves old datadir aside and start fresh. -mysql-8.0 Sid to mariadb-10.8 upgrade: - stage: upgrade in Sid +mysql-community-cluster-8.0 from MySQL.com upgrade: + stage: upgrade extras needs: - job: build - image: debian:sid + image: debian:${RELEASE} artifacts: when: always name: "$CI_BUILD_NAME" @@ -538,11 +539,21 @@ mysql-8.0 Sid to mariadb-10.8 upgrade: - ${WORKING_DIR}/debug script: - *test-prepare-container - # The postinst fails often if 'ps' is missing from system, so install procps - - apt-get install -y procps mysql-server 'libmysqlc*' - - *test-verify-initial + - apt-get install --no-install-recommends --yes ca-certificates curl systemctl + - curl -sS "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x859be8d7c586f538430b19c2467b942d3a79bd29" -o /etc/apt/trusted.gpg.d/mysql.asc + - echo "deb https://repo.mysql.com/apt/debian/ bullseye mysql-cluster-8.0" > /etc/apt/sources.list.d/mysql.list + - apt-get update -qq + - apt-get install -y mysql-cluster-community-server + - sed 's/ExecStartPre=+/ExecStartPre=/' -i /lib/systemd/system/mysql.service # Hack to make file compatible with systemctl shim + - systemctl start mysql + - dpkg -l | grep -iE 'maria|mysql|galera' + - systemctl status mysql; mysql -e 'SELECT VERSION()' + - systemctl stop mysql # Stop manually as maintainer scripts don't handle this with systemctl shim - *test-install - - service mysql status + # Ignore systemctl shim result as MariaDB systemd file is incompatible with it and yields: + # ERROR:systemctl:the ExecStartPre control process exited with error code + - systemctl status mysql || true + - mysql -e 'SELECT VERSION()' || true - sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server - *test-verify-final variables: @@ -551,13 +562,11 @@ mysql-8.0 Sid to mariadb-10.8 upgrade: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ -# Upgrading from MySQL 8.0 with datadir in place is not possible. Users need to do a data dump. -# The Debian maintainer scripts detect this situation and simply moves old datadir aside and start fresh. -mysql-8.0 Focal to mariadb-10.8 upgrade: +mariadb.org-10.7 to mariadb-10.8 upgrade: stage: upgrade extras needs: - - job: build buster-backports - image: debian:buster + - job: build + image: debian:${RELEASE} artifacts: when: always name: "$CI_BUILD_NAME" @@ -565,33 +574,39 @@ mysql-8.0 Focal to mariadb-10.8 upgrade: - ${WORKING_DIR}/debug script: - *test-prepare-container - # Add Ubuntu Focal archive keys and repository - - apt-get install --no-install-recommends --yes gpg gpg-agent dirmngr ca-certificates # Bare minimal (<4MB) for apt-key to work - - apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com:443 871920D1991BC93C 3B4FE6ACC0B21F32 - - echo 'deb http://archive.ubuntu.com/ubuntu/ focal main restricted' > /etc/apt/sources.list.d/ubuntu.list + - apt install -y curl + - curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc + - echo "deb https://deb.mariadb.org/10.7/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list - apt-get update - # First install often fail due to bug in mysql-8.0 - - apt-get install -y mysql-server 'libmysqlc*' || true - - sleep 10 && apt-get install -f + # Package libmariadbclient-dev from mariadb.org conflicts with libmariadb-dev in Sid, so cannot use wildcard that would include it + # Enable this line when there is a way to install them only from the mariadb.org repo + # - apt-get install -y 'mariadb*' libmariadb3 'libmariadb-*' 'libmariadbd*' + - apt-get install -y mariadb-server-10.7 - *test-verify-initial - # Enable backports to make galera-4 available - - echo 'deb http://deb.debian.org/debian buster-backports main' > /etc/apt/sources.list.d/backports.list && apt-get update - - *test-install - - service mysql status - - sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server + # Install MariaDB built in this commit + # Force downgrades so our version installs on top of upstream revision, e.g. 1:10.5.5-1 vs 1:10.5.5+mariadb~sid + - apt-get install -y --allow-downgrades ./*.deb + # Verify installation of MariaDB built in this commit + - dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed + - mariadb --version # Client version + - service mariadb status # There is no init.d/mysql in MariaDB 10.8 - *test-verify-final variables: GIT_STRATEGY: none except: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ + allow_failure: true + # Installation on Sid fails on missing liburing1 because upstream 10.8 + # MariaDB.org buildbot has not run 'apt upgrade' for a long time. + # Remove this allow_failure once buildbot has built a new 10.8 + # release using latest liburing-dev in Debian Sid. - -mariadb.org-10.5 to mariadb-10.8 upgrade: +mariadb.org-10.6 to mariadb-10.8 upgrade: stage: upgrade extras needs: - job: build - image: debian:sid + image: debian:${RELEASE} artifacts: when: always name: "$CI_BUILD_NAME" @@ -599,17 +614,14 @@ mariadb.org-10.5 to mariadb-10.8 upgrade: - ${WORKING_DIR}/debug script: - *test-prepare-container - - apt install -y curl + - apt-get -qq install --no-install-recommends --yes ca-certificates curl - curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc - - echo 'deb http://mirror.one.com/mariadb/repo/10.5/debian sid main' > /etc/apt/sources.list.d/mariadb.list - - apt-get update - # The 10.5.9 release is missing mariadb-plugin-columnstore, define all other packages but it to avoid hitting the error: - # The following packages have unmet dependencies: - # mariadb-plugin-columnstore : Depends: mariadb-server-10.5 (= 1:10.5.8+maria~sid) but 1:10.5.9+maria~sid is to be installed - - apt-get install -y libmariadb3 'libmariadb-*' 'libmariadbd*' 'mariadb-c*' 'mariadb-b*' 'mariadb-s*' 'mariadb-t*' 'mariadb-plugin-con*' 'mariadb-plugin-cr*' 'mariadb-plugin-g*' 'mariadb-plugin-m*' 'mariadb-plugin-o*' 'mariadb-plugin-s*' - # Once 10.5.10 is out, revert back to: + - echo "deb https://deb.mariadb.org/10.6/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list + - apt-get update -qq # Package libmariadbclient-dev from mariadb.org conflicts with libmariadb-dev in Sid, so cannot use wildcard that would include it - #- apt-get install -y 'mariadb*' libmariadb3 'libmariadb-*' 'libmariadbd*' + # Enable this line when there is a way to install them only from the mariadb.org repo + # - apt-get install -y 'mariadb*' libmariadb3 'libmariadb-*' 'libmariadbd*' + - apt-get install -y mariadb-server-10.6 - *test-verify-initial # Install MariaDB built in this commit # Force downgrades so our version installs on top of upstream revision, e.g. 1:10.5.5-1 vs 1:10.5.5+mariadb~sid @@ -617,7 +629,7 @@ mariadb.org-10.5 to mariadb-10.8 upgrade: # Verify installation of MariaDB built in this commit - dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed - mariadb --version # Client version - - service mariadb status # There is no init.d/mysql in MariaDB 10.5 + - service mariadb status # There is no init.d/mysql in MariaDB 10.5+ - *test-verify-final variables: GIT_STRATEGY: none @@ -625,11 +637,11 @@ mariadb.org-10.5 to mariadb-10.8 upgrade: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ -mariadb.org-10.4 to mariadb-10.8 upgrade: +mariadb.org-10.5 to mariadb-10.8 upgrade: stage: upgrade extras needs: - job: build - image: debian:sid + image: debian:${RELEASE} artifacts: when: always name: "$CI_BUILD_NAME" @@ -637,19 +649,14 @@ mariadb.org-10.4 to mariadb-10.8 upgrade: - ${WORKING_DIR}/debug script: - *test-prepare-container - - apt install -y curl systemctl # systemctl shim needed on platforms that don't have systemd + - apt-get -qq install --no-install-recommends --yes ca-certificates curl - curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc - - echo 'deb http://mirror.one.com/mariadb/repo/10.4/debian sid main' > /etc/apt/sources.list.d/mariadb.list - - apt-get update - - apt-get install -y mariadb-server-10.4 - # MariaDB.org version of 10.4 and early 10.5 do not install an init file, so - # it must be installed here manually - - cp /usr/share/mysql/mysql.init /etc/init.d/mysql; chmod +x /etc/init.d/mysql; service mysql start; sleep 5 + - echo "deb https://archive.mariadb.org/mariadb-10.5/repo/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list + - apt-get update -qq + - apt-get install -y mariadb-server-10.5 - *test-verify-initial - *test-install - - sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server - - service mysql status - - service mariadb status + - service mariadb status # There is no init.d/mysql in MariaDB 10.5+ - *test-verify-final variables: GIT_STRATEGY: none @@ -657,11 +664,11 @@ mariadb.org-10.4 to mariadb-10.8 upgrade: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ -mariadb.org-10.3 to mariadb-10.8 upgrade: +mariadb.org-10.4 to mariadb-10.8 with Buster backports upgrade: stage: upgrade extras needs: - - job: build - image: debian:sid + - job: build buster-backports + image: debian:buster artifacts: when: always name: "$CI_BUILD_NAME" @@ -669,22 +676,21 @@ mariadb.org-10.3 to mariadb-10.8 upgrade: - ${WORKING_DIR}/debug script: - *test-prepare-container - - apt install -y curl + - apt-get -qq install --no-install-recommends --yes ca-certificates curl - curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc - - echo 'deb http://mirror.one.com/mariadb/repo/10.3/debian sid main' > /etc/apt/sources.list.d/mariadb.list - - apt-get update - - apt-get install -y mariadb-server-10.3 - # Verify initial state before upgrade - - dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed - - service mysql status - # prepending with --defaults-file=/etc/mysql/debian.cnf is needed in upstream 5.5–10.3 - - mysql --defaults-file=/etc/mysql/debian.cnf --skip-column-names -e "SELECT @@version, @@version_comment" - - echo 'SHOW DATABASES;' | mysql --defaults-file=/etc/mysql/debian.cnf - - mysql --defaults-file=/etc/mysql/debian.cnf -e "SELECT Host,User,plugin,authentication_string FROM user;" mysql - - mysql --defaults-file=/etc/mysql/debian.cnf -e "SELECT * FROM plugin;" mysql + - echo "deb https://archive.mariadb.org/mariadb-10.4/repo/debian buster main" > /etc/apt/sources.list.d/mariadb.list + - apt-get update -qq + - apt-get install -y mariadb-server-10.4 + # MariaDB.org version of 10.4 and early 10.5 do not install an init file, so + # it must be installed here manually + - cp /usr/share/mysql/mysql.init /etc/init.d/mysql; chmod +x /etc/init.d/mysql; service mysql start; sleep 5 + - *test-verify-initial + # Buster backports is needed for liburing1 (>= 0.7) and galera-4 (>= 26.4) + - *test-enable-buster-backports-repos - *test-install - - service mysql status - sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server + - service mysql status + - service mariadb status - *test-verify-final variables: GIT_STRATEGY: none @@ -692,11 +698,11 @@ mariadb.org-10.3 to mariadb-10.8 upgrade: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ -mariadb.org-10.2 to mariadb-10.8 upgrade: +mariadb.org-10.3 to mariadb-10.8 with Buster backports upgrade: stage: upgrade extras needs: - - job: build - image: debian:sid + - job: build buster-backports + image: debian:buster artifacts: when: always name: "$CI_BUILD_NAME" @@ -704,22 +710,19 @@ mariadb.org-10.2 to mariadb-10.8 upgrade: - ${WORKING_DIR}/debug script: - *test-prepare-container - - apt install -y curl + - apt-get -qq install --no-install-recommends --yes ca-certificates curl - curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc - - echo 'deb http://mirror.one.com/mariadb/repo/10.2/debian sid main' > /etc/apt/sources.list.d/mariadb.list - - apt-get update - - apt-get install -y mariadb-server-10.2 - # Verify initial state before upgrade - - dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed - - service mysql status - # prepending with --defaults-file=/etc/mysql/debian.cnf is needed in upstream 5.5–10.3 - - mysql --defaults-file=/etc/mysql/debian.cnf --skip-column-names -e "SELECT @@version, @@version_comment" - - echo 'SHOW DATABASES;' | mysql --defaults-file=/etc/mysql/debian.cnf - - mysql --defaults-file=/etc/mysql/debian.cnf -e "SELECT * FROM mysql.user; SHOW CREATE USER root@localhost" - - mysql --defaults-file=/etc/mysql/debian.cnf -e "SELECT * FROM mysql.plugin; SHOW PLUGINS" + - echo "deb https://archive.mariadb.org/mariadb-10.3/repo/debian buster main" > /etc/apt/sources.list.d/mariadb.list + - apt-get update -qq + - apt-get install -y mariadb-server-10.3 + - *test-verify-initial + # Buster backports is needed for liburing1 (>= 0.7) and galera-4 (>= 26.4) + - *test-enable-buster-backports-repos - *test-install - service mysql status - - sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server + # Give the mariadb-upgrade plenty of time to complete, otherwise next commands + # fail on non-existing mariadb.sys user + - sleep 15 - *test-verify-final variables: GIT_STRATEGY: none @@ -727,11 +730,14 @@ mariadb.org-10.2 to mariadb-10.8 upgrade: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ -mysql.com-5.7 to mariadb-10.8 upgrade: +# archive.mariadb.org has for 10.2 only Stretch, so we can't test upgrades to +# 10.6 with only Buster and Bullseye builds + +mysql.com-5.7 upgrade: stage: upgrade extras needs: - - job: build buster-backports - image: debian:buster + - job: build + image: debian:${RELEASE} artifacts: when: always name: "$CI_BUILD_NAME" @@ -741,16 +747,23 @@ mysql.com-5.7 to mariadb-10.8 upgrade: - *test-prepare-container - | apt-get install --no-install-recommends --yes gpg gpg-agent dirmngr ca-certificates # Bare minimal (<4MB) for apt-key to work - apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com:443 8C718D3B5072E1F5 - echo 'deb https://repo.mysql.com/apt/debian/ buster mysql-5.7' > /etc/apt/sources.list.d/mysql.list - apt-get update + apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com:443 467B942D3A79BD29 + echo "deb https://repo.mysql.com/apt/debian/ bullseye mysql-5.7" > /etc/apt/sources.list.d/mysql.list + apt-get update -qq apt-get install -y 'mysql*' 'libmysqlc*' - *test-verify-initial - # Enable backports to make galera-4 available - - echo 'deb http://deb.debian.org/debian buster-backports main' >> /etc/apt/sources.list.d/backports.list && apt-get update - *test-install - - service mysql status + # Due to some (currently unknown) changes in MySQL 5.7 packaging or apt + # behaviour changes, a system with a previous installation of MySQL will + # on upgrades to MariaDB first fully remove MySQL, including the + # /etc/init.d/mysql file, so previous techniques in + # mariadb-server-10.6.postinst to maintain backwards compatibility with + # 'service mysql status' after installing MariaDB on top MySQL no longer + # works. Thus the step to test it now intentionally has a fallback to use + # the service name 'mariadb' instead, and the fallback is always used. - sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server + - service mysql status || service mariadb status + - sleep 15 # Give the mysql_upgrade a bit of extra time to complete with MySQL 5.7 before querying the server - *test-verify-final variables: GIT_STRATEGY: none @@ -758,11 +771,11 @@ mysql.com-5.7 to mariadb-10.8 upgrade: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ -percona-xtradb-5.7 to mariadb-10.8 upgrade (MDEV-22679): +percona-xtradb-5.7 upgrade: stage: upgrade extras needs: - - job: build buster-backports - image: debian:buster + - job: build + image: debian:${RELEASE} artifacts: when: always name: "$CI_BUILD_NAME" @@ -773,16 +786,14 @@ percona-xtradb-5.7 to mariadb-10.8 upgrade (MDEV-22679): - | apt-get install --no-install-recommends --yes gpg gpg-agent dirmngr ca-certificates # Bare minimal (<4MB) for apt-key to work apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com:443 9334A25F8507EFA5 - echo 'deb https://repo.percona.com/apt/ buster main' > /etc/apt/sources.list.d/mysql.list - apt-get update + echo "deb https://repo.percona.com/apt/ ${RELEASE} main" > /etc/apt/sources.list.d/mysql.list + apt-get update -qq apt-get install -y percona-xtradb-cluster-full-57 percona-xtrabackup-24 percona-toolkit pmm2-client - service mysql status - *test-verify-initial - # Enable backports to make galera-4 available - - echo 'deb http://deb.debian.org/debian buster-backports main' >> /etc/apt/sources.list.d/backports.list && apt-get update - *test-install - service mysql status - - sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server + - sleep 15 # Give the mysql_upgrade a bit of extra time to complete with MySQL 5.7 before querying the server - *test-verify-final variables: GIT_STRATEGY: none diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides index be738a7d5b25e..a3f95200f5d21 100644 --- a/debian/source/lintian-overrides +++ b/debian/source/lintian-overrides @@ -2,29 +2,92 @@ # since package breaks/replaces these but at the same time also provides them version-substvar-for-external-package mariadb-client-core-10.8 -> mysql-client-5.5 version-substvar-for-external-package mariadb-server-10.8 -> mysql-server -version-substvar-for-external-package mariadb-server-10.8 -> mysql-server version-substvar-for-external-package libmariadb-dev -> libmysqlclient-dev version-substvar-for-external-package libmariadb-dev -> libmysqld-dev -version-substvar-for-external-package mariadb-server-10.8 -> mysql-client-5.5 -version-substvar-for-external-package mariadb-server-10.8 -> mysql-client-5.6 -version-substvar-for-external-package mariadb-server-10.8 -> mysql-client-5.7 -version-substvar-for-external-package mariadb-server-10.8 -> mysql-client-8.0 -version-substvar-for-external-package mariadb-client-10.8 -> mysql-client-core-5.1 -version-substvar-for-external-package mariadb-client-10.8 -> mysql-client-core-5.1 -version-substvar-for-external-package mariadb-client-10.8 -> mysql-client-core-5.5 -version-substvar-for-external-package mariadb-client-10.8 -> mysql-client-core-5.5 -version-substvar-for-external-package mariadb-client-10.8 -> mysql-client-core-5.6 -version-substvar-for-external-package mariadb-client-10.8 -> mysql-client-core-5.6 -version-substvar-for-external-package mariadb-client-10.8 -> mysql-client-core-5.7 -version-substvar-for-external-package mariadb-client-10.8 -> mysql-client-core-5.7 -version-substvar-for-external-package mariadb-client-10.8 -> mysql-client-core-8.0 -version-substvar-for-external-package mariadb-client-10.8 -> mysql-client-core-8.0 +version-substvar-for-external-package mariadb-server-10.8 -> mysql-client-5.* +version-substvar-for-external-package mariadb-server-10.8 -> mysql-client-8.* +version-substvar-for-external-package mariadb-client-10.8 -> mysql-client-core-5.* +version-substvar-for-external-package mariadb-client-10.8 -> mysql-client-core-8.* version-substvar-for-external-package libmariadbd-dev -> libmariadbclient-dev # ColumnStore not used in Debian, safe to ignore. Reported upstream in https://jira.mariadb.org/browse/MDEV-24124 source-is-missing storage/columnstore/columnstore/utils/jemalloc/libjemalloc.so.2 +source-is-missing [storage/columnstore/columnstore/utils/jemalloc/libjemalloc.so.2] # Must be fixed upstream -source-is-missing storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-ui-1.8.18.custom.js line 58 is 273 characters long (>256) +source-is-missing storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-ui-*.custom.js +# New Lintian syntax (from version 2.115) +source-is-missing [sql/share/charsets/languages.html] +source-is-missing [storage/rocksdb/rocksdb/docs/_includes/footer.html] # Intentional control relationships -version-substvar-for-external-package Replaces (line 216) ${source:Version} libmariadbd-dev -> libmariadbclient-dev -version-substvar-for-external-package Replaces (line 66) ${source:Version} libmariadb-dev -> libmysqlclient-dev -version-substvar-for-external-package Replaces (line 66) ${source:Version} libmariadb-dev -> libmysqld-dev +version-substvar-for-external-package Replaces * libmariadbd-dev -> libmariadbclient-dev +version-substvar-for-external-package Replaces * libmariadb-dev -> libmysqlclient-dev +version-substvar-for-external-package Replaces * libmariadb-dev -> libmysqld-dev +# New Lintian syntax (from version 2.115) +version-substvar-for-external-package Replaces * libmariadb-dev -> libmysqlclient-dev [debian/control:*] +version-substvar-for-external-package Replaces * libmariadb-dev -> libmysqld-dev [debian/control:*] +version-substvar-for-external-package Replaces * libmariadbd-dev -> libmariadbclient-dev [debian/control:*] +# We can't change build dependencies on a stable branch (10.5..10.8) so just override this +missing-build-dependency-for-dh-addon systemd * +# Data or test files where long lines are justified +very-long-line-length-in-source-file *.test * +very-long-line-length-in-source-file *.result * +very-long-line-length-in-source-file BUILD/compile-* +very-long-line-length-in-source-file *COPYING.rtf * +# These are mainly found under extra/wolfssl +very-long-line-length-in-source-file *.cproject * +very-long-line-length-in-source-file *.md * +very-long-line-length-in-source-file *.scfg * +very-long-line-length-in-source-file *.launch * +very-long-line-length-in-source-file extra/wolfssl/wolfssl/IDE/Espressif/ESP-IDF/test/test_wolfssl.c * +very-long-line-length-in-source-file extra/wolfssl/wolfssl/configure.ac * +very-long-line-length-in-source-file extra/wolfssl/wolfssl/doc/formats/html/html_changes/tabs.css * +# Preprocessed C files which have long lines +very-long-line-length-in-source-file extra/wolfssl/wolfssl/wolfcrypt/src/*.i * +# These are all results for test cases and similar so they can be +# especially formatted to be too long +very-long-line-length-in-source-file mysql-test/*.dump * +very-long-line-length-in-source-file mysql-test/*.inc * +very-long-line-length-in-source-file mysql-test/*.rdiff * +very-long-line-length-in-source-file mysql-test/*.txt * +very-long-line-length-in-source-file mysql-test/*.weekly * +# Test file +very-long-line-length-in-source-file plugin/handler_socket/regtest/test_01_lib/test19.expected * +# SQL source file that has very long inserts/selects +very-long-line-length-in-source-file mysql-test/std_data/init_file_longline_3816.sql * +very-long-line-length-in-source-file scripts/fill_help_tables.sql * +very-long-line-length-in-source-file scripts/mysql_system_tables.sql * +very-long-line-length-in-source-file scripts/mysql_test_data_timezone.sql * +# Machine formatted HTML +very-long-line-length-in-source-file sql/share/charsets/languages.html * +very-long-line-length-in-source-file sql/share/errmsg-utf8.txt * +# Very long test string +very-long-line-length-in-source-file storage/archive/archive_test.c line 30 is 1051 characters long (>512) +# autogenerated thrift file +very-long-line-length-in-source-file storage/cassandra/gen-cpp/cassandra_types.h * +# ColumnStore ignores +# In Directory mysql-test are some long test includes +very-long-line-length-in-source-file storage/columnstore/columnstore/.drone.jsonnet * +very-long-line-length-in-source-file storage/columnstore/columnstore/CMakeLists.txt * +very-long-line-length-in-source-file storage/columnstore/columnstore/mysql-test/columnstore/csinternal/include/autopilot_create_datatypetestm_tables.inc * +very-long-line-length-in-source-file storage/columnstore/columnstore/mysql-test/columnstore/csinternal/include/autopilot_create_datatypeupdate_table.inc * +very-long-line-length-in-source-file storage/columnstore/columnstore/*.xmi * +very-long-line-length-in-source-file storage/columnstore/columnstore/dbcon/doc/q19_plan.txt * +very-long-line-length-in-source-file storage/columnstore/columnstore/utils/udfsdk/docs/source/reference/mcsv1Context.rst * +very-long-line-length-in-source-file storage/columnstore/columnstore/utils/winport/win_setup_mysql_part1.sql * +# Minified CSS files. These appear in several places +very-long-line-length-in-source-file *badge_only.css * +very-long-line-length-in-source-file *theme.css line * +# General storage ignores +very-long-line-length-in-source-file storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/jquery-ui-1.8.12.custom.css * +very-long-line-length-in-source-file storage/rocksdb/mysql-test/rocksdb/t/bypass_select_basic_bloom-master.opt * +very-long-line-length-in-source-file storage/rocksdb/mysql-test/rocksdb/t/type_enum.inc * +very-long-line-length-in-source-file storage/rocksdb/mysql-test/rocksdb/t/type_set.inc * +very-long-line-length-in-source-file storage/rocksdb/rocksdb/docs/_includes/footer.html * +very-long-line-length-in-source-file storage/rocksdb/rocksdb/docs/_posts/*.markdown line * +very-long-line-length-in-source-file storage/spider/mysql-test/spider/bugfix/include/sql_mode_init.inc * +very-long-line-length-in-source-file storage/tokudb/PerconaFT/cmake_modules/TokuBuildTagDatabases.cmake * +very-long-line-length-in-source-file storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/m4/po.m4 * +# These are generated files which should not make any harm +source-contains-autogenerated-visual-c++-file storage/columnstore/columnstore/*.rc +source-contains-autogenerated-visual-c++-file storage/columnstore/columnstore/*.h +source-contains-autogenerated-visual-c++-file win/upgrade_wizard/resource.h +source-contains-autogenerated-visual-c++-file win/upgrade_wizard/upgrade.rc diff --git a/debian/tests/control b/debian/tests/control index 2e495f90f3f87..743f649770253 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -3,7 +3,12 @@ Tests: smoke # for its existence (see the list in debian/control), install it if available # and check in the test if it's functional when it should be. # The plugin package also already depends on the other one. -Depends: mariadb-plugin-rocksdb | mariadb-server-10.8 +Depends: mariadb-plugin-rocksdb | mariadb-server-10.8, + mariadb-plugin-provider-bzip2, + mariadb-plugin-provider-lz4, + mariadb-plugin-provider-lzma, + mariadb-plugin-provider-lzo, + mariadb-plugin-provider-snappy Restrictions: allow-stderr needs-root isolation-container Tests: upstream diff --git a/debian/tests/smoke b/debian/tests/smoke index 8897acbd015ad..9e001f9692f88 100644 --- a/debian/tests/smoke +++ b/debian/tests/smoke @@ -38,30 +38,35 @@ else # If systemd (and systemctl) is available, but the service did not start, then # this smoke test is supposed to fail if next commands don't work. echo "Found systemctl, continuing smoke test.." + # Compression plugins are separated from main server package + # to own packages (for example LZ4 package mariadb-plugin-provider-lz4) + # and they are installed after mariadb-server. + # which means that they don't exist if MariaDB is not restarted + systemctl restart mariadb fi -mysql <&2 exit 1 fi -mysql --user=testuser --password=testpassword testdatabase <> $SKIP_TEST_LST -done +# Also use the arch specific skiplists if exist +if [ -f /usr/share/mysql/mysql-test/unstable-tests.$ARCH ] +then + cat /usr/share/mysql/mysql-test/unstable-tests.$ARCH >> $SKIP_TEST_LST +fi # Skip tests that cannot run properly on ci.debian.net / autopkgtests.ubuntu.com cat >> $SKIP_TEST_LST << EOF @@ -48,7 +49,6 @@ main.mysqld--help : For unknown reason table-cache is 4000 instead of default 42 EOF fi -ARCH=$(dpkg --print-architecture) if [ "$ARCH" = "s390x" ] then echo "main.func_regexp_pcre : recursion fails on s390x https://bugs.launchpad.net/ubuntu/+source/mariadb-10.1/+bug/1723947" >> $SKIP_TEST_LST @@ -57,6 +57,10 @@ then echo "main.failed_auth_unixsocket : Test returns wrong exit code on armhf and i386 (but only in debci) https://jira.mariadb.org/browse/MDEV-23933" >> $SKIP_TEST_LST fi +# Store skipped test list in artifacts so it can be viewed while debugging +# failed autopkgtest runs +cp -v $SKIP_TEST_LST $AUTOPKGTEST_ARTIFACTS + cd /usr/share/mysql/mysql-test echo "starting mysql-test-tun.pl..." eatmydata perl -I. ./mysql-test-run.pl --suite=main \ diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index 27431af3cacc4..7b8ffa92d3bb0 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -52,6 +52,12 @@ The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */ #include +#ifdef UNIV_NONINL +# include "fsp0fsp.inl" +# include "mach0data.inl" +# include "ut0rnd.inl" +#endif + #ifndef PRIuMAX #define PRIuMAX "llu" #endif @@ -765,7 +771,7 @@ parse_page( { unsigned long long id; uint16_t undo_page_type; - char str[20]={'\0'}; + const char *str; ulint n_recs; uint32_t page_no, left_page_no, right_page_no; ulint data_bytes; @@ -773,11 +779,7 @@ parse_page( ulint size_range_id; /* Check whether page is doublewrite buffer. */ - if(skip_page) { - strcpy(str, "Double_write_buffer"); - } else { - strcpy(str, "-"); - } + str = skip_page ? "Double_write_buffer" : "-"; switch (fil_page_get_type(page)) { @@ -805,7 +807,7 @@ parse_page( is_leaf = (!*(const uint16*) (page + (PAGE_HEADER + PAGE_LEVEL))); - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tIndex page\t\t\t|" "\tindex id=%llu,", cur_page_num, id); @@ -857,7 +859,7 @@ parse_page( index.total_data_bytes += data_bytes; index.pages_in_size_range[size_range_id] ++; } - } else { + } else if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tEncrypted Index page\t\t\t|" "\tkey_version " UINT32PF ",%s\n", cur_page_num, key_version, str); } @@ -868,7 +870,7 @@ parse_page( page_type.n_fil_page_undo_log++; undo_page_type = mach_read_from_2(page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE); - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tUndo log page\t\t\t|", cur_page_num); } @@ -878,7 +880,7 @@ parse_page( switch (undo_page_type) { case TRX_UNDO_ACTIVE: page_type.n_undo_state_active++; - if (page_type_dump) { + if (file) { fprintf(file, ", %s", "Undo log of " "an active transaction"); } @@ -886,7 +888,7 @@ parse_page( case TRX_UNDO_CACHED: page_type.n_undo_state_cached++; - if (page_type_dump) { + if (file) { fprintf(file, ", %s", "Page is " "cached for quick reuse"); } @@ -894,7 +896,7 @@ parse_page( case TRX_UNDO_TO_PURGE: page_type.n_undo_state_to_purge++; - if (page_type_dump) { + if (file) { fprintf(file, ", %s", "Will be " "freed in purge when all undo" "data in it is removed"); @@ -903,7 +905,7 @@ parse_page( case TRX_UNDO_PREPARED: page_type.n_undo_state_prepared++; - if (page_type_dump) { + if (file) { fprintf(file, ", %s", "Undo log of " "an prepared transaction"); } @@ -913,14 +915,14 @@ parse_page( page_type.n_undo_state_other++; break; } - if(page_type_dump) { + if(file) { fprintf(file, ", %s\n", str); } break; case FIL_PAGE_INODE: page_type.n_fil_page_inode++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tInode page\t\t\t|" "\t%s\n",cur_page_num, str); } @@ -928,7 +930,7 @@ parse_page( case FIL_PAGE_IBUF_FREE_LIST: page_type.n_fil_page_ibuf_free_list++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tInsert buffer free list" " page\t|\t%s\n", cur_page_num, str); } @@ -936,7 +938,7 @@ parse_page( case FIL_PAGE_TYPE_ALLOCATED: page_type.n_fil_page_type_allocated++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tFreshly allocated " "page\t\t|\t%s\n", cur_page_num, str); } @@ -944,7 +946,7 @@ parse_page( case FIL_PAGE_IBUF_BITMAP: page_type.n_fil_page_ibuf_bitmap++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tInsert Buffer " "Bitmap\t\t|\t%s\n", cur_page_num, str); } @@ -952,7 +954,7 @@ parse_page( case FIL_PAGE_TYPE_SYS: page_type.n_fil_page_type_sys++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tSystem page\t\t\t|" "\t%s\n", cur_page_num, str); } @@ -960,7 +962,7 @@ parse_page( case FIL_PAGE_TYPE_TRX_SYS: page_type.n_fil_page_type_trx_sys++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tTransaction system " "page\t\t|\t%s\n", cur_page_num, str); } @@ -968,7 +970,7 @@ parse_page( case FIL_PAGE_TYPE_FSP_HDR: page_type.n_fil_page_type_fsp_hdr++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tFile Space " "Header\t\t|\t%s\n", cur_page_num, str); } @@ -976,7 +978,7 @@ parse_page( case FIL_PAGE_TYPE_XDES: page_type.n_fil_page_type_xdes++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tExtent descriptor " "page\t\t|\t%s\n", cur_page_num, str); } @@ -984,7 +986,7 @@ parse_page( case FIL_PAGE_TYPE_BLOB: page_type.n_fil_page_type_blob++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tBLOB page\t\t\t|\t%s\n", cur_page_num, str); } @@ -992,7 +994,7 @@ parse_page( case FIL_PAGE_TYPE_ZBLOB: page_type.n_fil_page_type_zblob++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tCompressed BLOB " "page\t\t|\t%s\n", cur_page_num, str); } @@ -1000,7 +1002,7 @@ parse_page( case FIL_PAGE_TYPE_ZBLOB2: page_type.n_fil_page_type_zblob2++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tSubsequent Compressed " "BLOB page\t|\t%s\n", cur_page_num, str); } @@ -1008,7 +1010,7 @@ parse_page( case FIL_PAGE_PAGE_COMPRESSED: page_type.n_fil_page_type_page_compressed++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tPage compressed " "page\t|\t%s\n", cur_page_num, str); } @@ -1016,7 +1018,7 @@ parse_page( case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED: page_type.n_fil_page_type_page_compressed_encrypted++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tPage compressed encrypted " "page\t|\t%s\n", cur_page_num, str); } @@ -1182,6 +1184,8 @@ static struct my_option innochecksum_options[] = { {"allow-mismatches", 'a', "Maximum checksum mismatch allowed.", &allow_mismatches, &allow_mismatches, 0, GET_ULL, REQUIRED_ARG, 0, 0, ULLONG_MAX, 0, 1, 0}, + {"write", 'w', "Rewrite the checksum.", + &do_write, &do_write, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"page-type-summary", 'S', "Display a count of each page type " "in a tablespace.", &page_type_summary, &page_type_summary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -1776,6 +1780,18 @@ int main( } if (ferror(fil_in)) { +#ifdef _AIX + /* + AIX fseeko can go past eof without error. + the error occurs on read, hence output the + same error here as would show up on other + platforms. This shows up in the mtr test + innodb_zip.innochecksum_3-4k,crc32,innodb + */ + if (errno == EFBIG) { + goto unexpected_eof; + } +#endif fprintf(stderr, "Error reading " ULINTPF " bytes", physical_page_size); perror(" "); diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index ea2a5b3532a0e..661d2eafad1cd 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -55,8 +55,12 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #include "xtrabackup.h" #include "common.h" #include "backup_copy.h" +#include "backup_debug.h" #include "backup_mysql.h" #include +#ifdef _WIN32 +#include /* rmdir */ +#endif #ifdef _WIN32 #include @@ -75,9 +79,8 @@ bool binlog_locked; static void rocksdb_create_checkpoint(); static bool has_rocksdb_plugin(); -static void copy_or_move_dir(const char *from, const char *to, bool copy, bool allow_hardlinks); -static void rocksdb_backup_checkpoint(); -static void rocksdb_copy_back(); +static void rocksdb_backup_checkpoint(ds_ctxt *ds_data); +static void rocksdb_copy_back(ds_ctxt *ds_data); static bool is_abs_path(const char *path) { @@ -132,7 +135,9 @@ struct datadir_thread_ctxt_t { bool ret; }; -static bool backup_files_from_datadir(const char *dir_path); +static bool backup_files_from_datadir(ds_ctxt_t *ds_data, + const char *dir_path, + const char *prefix); /************************************************************************ Retirn true if character if file separator */ @@ -560,8 +565,8 @@ datafile_read(datafile_cur_t *cursor) } if (os_file_read(IORequestRead, - cursor->file, cursor->buf, cursor->buf_offset, - to_read) != DB_SUCCESS) { + cursor->file, cursor->buf, cursor->buf_offset, + to_read, nullptr) != DB_SUCCESS) { return(XB_FIL_CUR_ERROR); } @@ -803,7 +808,7 @@ if passes the rules for partial backup. @return true if file backed up or skipped successfully. */ static bool -datafile_copy_backup(const char *filepath, uint thread_n) +datafile_copy_backup(ds_ctxt *ds_data, const char *filepath, uint thread_n) { const char *ext_list[] = {"frm", "isl", "MYD", "MYI", "MAD", "MAI", "MRG", "TRG", "TRN", "ARM", "ARZ", "CSM", "CSV", "opt", "par", @@ -824,7 +829,7 @@ datafile_copy_backup(const char *filepath, uint thread_n) } if (filename_matches(filepath, ext_list)) { - return copy_file(ds_data, filepath, filepath, thread_n); + return ds_data->copy_file(filepath, filepath, thread_n); } return(true); @@ -865,7 +870,8 @@ datafile_rsync_backup(const char *filepath, bool save_to_list, FILE *f) return(true); } -bool backup_file_print_buf(const char *filename, const char *buf, int buf_len) +bool ds_ctxt_t::backup_file_print_buf(const char *filename, + const char *buf, int buf_len) { ds_file_t *dstfile = NULL; MY_STAT stat; /* unused for now */ @@ -876,7 +882,7 @@ bool backup_file_print_buf(const char *filename, const char *buf, int buf_len) stat.st_size = buf_len; stat.st_mtime = my_time(0); - dstfile = ds_open(ds_data, filename, &stat); + dstfile = ds_open(this, filename, &stat); if (dstfile == NULL) { msg("error: Can't open the destination stream for %s", filename); @@ -915,9 +921,9 @@ bool backup_file_print_buf(const char *filename, const char *buf, int buf_len) return true; }; -static bool -backup_file_vprintf(const char *filename, const char *fmt, va_list ap) +ds_ctxt_t::backup_file_vprintf(const char *filename, + const char *fmt, va_list ap) { char *buf = 0; int buf_len; @@ -928,7 +934,7 @@ backup_file_vprintf(const char *filename, const char *fmt, va_list ap) } bool -backup_file_printf(const char *filename, const char *fmt, ...) +ds_ctxt_t::backup_file_printf(const char *filename, const char *fmt, ...) { bool result; va_list ap; @@ -996,16 +1002,15 @@ run_data_threads(datadir_iter_t *it, void (*func)(datadir_thread_ctxt_t *ctxt), Copy file for backup/restore. @return true in case of success. */ bool -copy_file(ds_ctxt_t *datasink, - const char *src_file_path, - const char *dst_file_path, - uint thread_n) +ds_ctxt_t::copy_file(const char *src_file_path, + const char *dst_file_path, + uint thread_n) { char dst_name[FN_REFLEN]; ds_file_t *dstfile = NULL; datafile_cur_t cursor; xb_fil_cur_result_t res; - DBUG_ASSERT(datasink->datasink->remove); + DBUG_ASSERT(datasink->remove); const char *dst_path = (xtrabackup_copy_back || xtrabackup_move_back)? dst_file_path : trim_dotslash(dst_file_path); @@ -1016,7 +1021,7 @@ copy_file(ds_ctxt_t *datasink, strncpy(dst_name, cursor.rel_path, sizeof(dst_name)); - dstfile = ds_open(datasink, dst_path, &cursor.statinfo); + dstfile = ds_open(this, dst_path, &cursor.statinfo); if (dstfile == NULL) { msg(thread_n,"error: " "cannot open the destination stream for %s", dst_name); @@ -1049,7 +1054,7 @@ copy_file(ds_ctxt_t *datasink, error: datafile_close(&cursor); if (dstfile != NULL) { - datasink->datasink->remove(dstfile->path); + datasink->remove(dstfile->path); ds_close(dstfile); } @@ -1063,12 +1068,10 @@ copy_file(ds_ctxt_t *datasink, Try to move file by renaming it. If source and destination are on different devices fall back to copy and unlink. @return true in case of success. */ -static bool -move_file(ds_ctxt_t *datasink, - const char *src_file_path, - const char *dst_file_path, - const char *dst_dir, uint thread_n) +ds_ctxt_t::move_file(const char *src_file_path, + const char *dst_file_path, + const char *dst_dir, uint thread_n) { char errbuf[MYSYS_STRERROR_SIZE]; char dst_file_path_abs[FN_REFLEN]; @@ -1095,7 +1098,7 @@ move_file(ds_ctxt_t *datasink, if (my_rename(src_file_path, dst_file_path_abs, MYF(0)) != 0) { if (my_errno == EXDEV) { /* Fallback to copy/unlink */ - if(!copy_file(datasink, src_file_path, + if(!copy_file(src_file_path, dst_file_path, thread_n)) return false; msg(thread_n,"Removing %s", src_file_path); @@ -1174,13 +1177,13 @@ Copy or move file depending on current mode. @return true in case of success. */ static bool -copy_or_move_file(const char *src_file_path, +copy_or_move_file(ds_ctxt *datasink0, const char *src_file_path, const char *dst_file_path, const char *dst_dir, uint thread_n, bool copy = xtrabackup_copy_back) { - ds_ctxt_t *datasink = ds_data; /* copy to datadir by default */ + ds_ctxt_t *datasink = datasink0; /* copy to datadir by default */ char filedir[FN_REFLEN]; size_t filedir_len; bool ret; @@ -1228,13 +1231,13 @@ copy_or_move_file(const char *src_file_path, } ret = (copy ? - copy_file(datasink, src_file_path, dst_file_path, thread_n) : - move_file(datasink, src_file_path, dst_file_path, + datasink->copy_file(src_file_path, dst_file_path, thread_n) : + datasink->move_file(src_file_path, dst_file_path, dst_dir, thread_n)); cleanup: - if (datasink != ds_data) { + if (datasink != datasink0) { ds_destroy(datasink); } @@ -1246,7 +1249,7 @@ copy_or_move_file(const char *src_file_path, static bool -backup_files(const char *from, bool prep_mode) +backup_files(ds_ctxt *ds_data, const char *from, bool prep_mode) { char rsync_tmpfile_name[FN_REFLEN]; FILE *rsync_tmpfile = NULL; @@ -1284,7 +1287,7 @@ backup_files(const char *from, bool prep_mode) ret = datafile_rsync_backup(node.filepath, !prep_mode, rsync_tmpfile); } else { - ret = datafile_copy_backup(node.filepath, 1); + ret = datafile_copy_backup(ds_data, node.filepath, 1); } if (!ret) { msg("Failed to copy file %s", node.filepath); @@ -1295,7 +1298,7 @@ backup_files(const char *from, bool prep_mode) char path[FN_REFLEN]; snprintf(path, sizeof(path), "%s/db.opt", node.filepath); - if (!(ret = backup_file_printf( + if (!(ret = ds_data->backup_file_printf( trim_dotslash(path), "%s", ""))) { msg("Failed to create file %s", path); goto out; @@ -1384,7 +1387,6 @@ backup_files(const char *from, bool prep_mode) return(ret); } -void backup_fix_ddl(CorruptedPages &); lsn_t get_current_lsn(MYSQL *connection) { @@ -1409,7 +1411,8 @@ lsn_t get_current_lsn(MYSQL *connection) lsn_t server_lsn_after_lock; extern void backup_wait_for_lsn(lsn_t lsn); /** Start --backup */ -bool backup_start(CorruptedPages &corrupted_pages) +bool backup_start(ds_ctxt *ds_data, ds_ctxt *ds_meta, + CorruptedPages &corrupted_pages) { if (!opt_no_lock) { if (opt_safe_slave_backup) { @@ -1418,7 +1421,7 @@ bool backup_start(CorruptedPages &corrupted_pages) } } - if (!backup_files(fil_path_to_mysql_datadir, true)) { + if (!backup_files(ds_data, fil_path_to_mysql_datadir, true)) { return(false); } @@ -1430,11 +1433,15 @@ bool backup_start(CorruptedPages &corrupted_pages) server_lsn_after_lock = get_current_lsn(mysql_connection); } - if (!backup_files(fil_path_to_mysql_datadir, false)) { + if (!backup_files(ds_data, fil_path_to_mysql_datadir, false)) { return(false); } - if (!backup_files_from_datadir(fil_path_to_mysql_datadir)) { + if (!backup_files_from_datadir(ds_data, fil_path_to_mysql_datadir, + "aws-kms-key") || + !backup_files_from_datadir(ds_data, + aria_log_dir_path, + "aria_log")) { return false; } @@ -1444,7 +1451,14 @@ bool backup_start(CorruptedPages &corrupted_pages) 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(corrupted_pages); + DBUG_EXECUTE_FOR_KEY("sleep_after_waiting_for_lsn", {}, + { + ulong milliseconds = strtoul(dbug_val, NULL, 10); + msg("sleep_after_waiting_for_lsn"); + my_sleep(milliseconds*1000UL); + }); + + corrupted_pages.backup_fix_ddl(ds_data, ds_meta); // There is no need to stop slave thread before coping non-Innodb data when // --no-lock option is used because --no-lock option requires that no DDL or @@ -1460,7 +1474,7 @@ bool backup_start(CorruptedPages &corrupted_pages) if (opt_slave_info) { lock_binlog_maybe(mysql_connection); - if (!write_slave_info(mysql_connection)) { + if (!write_slave_info(ds_data, mysql_connection)) { return(false); } } @@ -1472,16 +1486,15 @@ bool backup_start(CorruptedPages &corrupted_pages) avoid that is to have a single process, i.e. merge innobackupex and xtrabackup. */ if (opt_galera_info) { - if (!write_galera_info(mysql_connection)) { + if (!write_galera_info(ds_data, mysql_connection)) { return(false); } - write_current_binlog_file(mysql_connection); } if (opt_binlog_info == BINLOG_INFO_ON) { lock_binlog_maybe(mysql_connection); - write_binlog_info(mysql_connection); + write_binlog_info(ds_data, mysql_connection); } if (have_flush_engine_logs && !opt_no_lock) { @@ -1515,24 +1528,23 @@ void backup_release() } } +static const char *default_buffer_pool_file = "ib_buffer_pool"; + /** Finish after backup_start() and backup_release() */ -bool backup_finish() +bool backup_finish(ds_ctxt *ds_data) { /* Copy buffer pool dump or LRU dump */ - if (!opt_rsync) { + if (!opt_rsync && opt_galera_info) { if (buffer_pool_filename && file_exists(buffer_pool_filename)) { - const char *dst_name; - - dst_name = trim_dotslash(buffer_pool_filename); - copy_file(ds_data, buffer_pool_filename, dst_name, 0); + ds_data->copy_file(buffer_pool_filename, default_buffer_pool_file, 0); } if (file_exists("ib_lru_dump")) { - copy_file(ds_data, "ib_lru_dump", "ib_lru_dump", 0); + ds_data->copy_file("ib_lru_dump", "ib_lru_dump", 0); } } if (has_rocksdb_plugin()) { - rocksdb_backup_checkpoint(); + rocksdb_backup_checkpoint(ds_data); } msg("Backup created in directory '%s'", xtrabackup_target_dir); @@ -1544,11 +1556,11 @@ bool backup_finish() mysql_slave_position); } - if (!write_backup_config_file()) { + if (!write_backup_config_file(ds_data)) { return(false); } - if (!write_xtrabackup_info(mysql_connection, XTRABACKUP_INFO, + if (!write_xtrabackup_info(ds_data, mysql_connection, XTRABACKUP_INFO, opt_history != 0, true)) { return(false); } @@ -1556,7 +1568,49 @@ bool backup_finish() return(true); } -bool + +/* + Drop all empty database directories in the base backup + that do not exists in the icremental backup. + + This effectively re-plays all DROP DATABASE statements happened + in between base backup and incremental backup creation time. + + Note, only checking if base_dir/db/ is empty is not enough, + because inc_dir/db/db.opt might have been dropped for some reasons, + which may also result into empty base_dir/db/. + + Only the fact that at the same time: + - base_dir/db/ exists + - inc_dir/db/ does not exist + means that DROP DATABASE happened. +*/ +static void +ibx_incremental_drop_databases(const char *base_dir, + const char *inc_dir) +{ + datadir_node_t node; + datadir_node_init(&node); + datadir_iter_t *it = datadir_iter_new(base_dir); + + while (datadir_iter_next(it, &node)) { + if (node.is_empty_dir) { + char path[FN_REFLEN]; + snprintf(path, sizeof(path), "%s/%s", + inc_dir, node.filepath_rel); + if (!directory_exists(path, false)) { + msg("Removing %s", node.filepath); + rmdir(node.filepath); + } + } + + } + datadir_iter_free(it); + datadir_node_free(&node); +} + + +static bool ibx_copy_incremental_over_full() { const char *ext_list[] = {"frm", "isl", "MYD", "MYI", "MAD", "MAI", @@ -1573,7 +1627,9 @@ ibx_copy_incremental_over_full() bool ret = true; char path[FN_REFLEN]; int i; + ds_ctxt *ds_data= NULL; + DBUG_ASSERT(!opt_galera_info); datadir_node_init(&node); /* If we were applying an incremental change set, we need to make @@ -1599,33 +1655,22 @@ ibx_copy_incremental_over_full() unlink(node.filepath_rel); } - if (!(ret = copy_file(ds_data, node.filepath, - node.filepath_rel, 1))) { + if (!(ret = ds_data->copy_file(node.filepath, + node.filepath_rel, 1))) { msg("Failed to copy file %s", node.filepath); goto cleanup; } } - if (!(ret = backup_files_from_datadir(xtrabackup_incremental_dir))) + if (!(ret = backup_files_from_datadir(ds_data, + xtrabackup_incremental_dir, + "aws-kms-key")) || + !(ret = backup_files_from_datadir(ds_data, + xtrabackup_incremental_dir, + "aria_log"))) goto cleanup; - /* copy buffer pool dump */ - if (innobase_buffer_pool_filename) { - const char *src_name; - - src_name = trim_dotslash(innobase_buffer_pool_filename); - - snprintf(path, sizeof(path), "%s/%s", - xtrabackup_incremental_dir, - src_name); - - if (file_exists(path)) { - copy_file(ds_data, path, - innobase_buffer_pool_filename, 0); - } - } - /* copy supplementary files */ for (i = 0; sup_files[i]; i++) { @@ -1638,7 +1683,7 @@ ibx_copy_incremental_over_full() if (file_exists(sup_files[i])) { unlink(sup_files[i]); } - copy_file(ds_data, path, sup_files[i], 0); + ds_data->copy_file(path, sup_files[i], 0); } } @@ -1652,8 +1697,10 @@ ibx_copy_incremental_over_full() if (my_mkdir(ROCKSDB_BACKUP_DIR, 0777, MYF(0))) { die("my_mkdir failed for " ROCKSDB_BACKUP_DIR); } - copy_or_move_dir(path, ROCKSDB_BACKUP_DIR, true, true); + ds_data->copy_or_move_dir(path, ROCKSDB_BACKUP_DIR, true, true); } + ibx_incremental_drop_databases(xtrabackup_target_dir, + xtrabackup_incremental_dir); } @@ -1721,6 +1768,53 @@ apply_log_finish() return(true); } +class Copy_back_dst_dir +{ + std::string buf; + +public: + const char *make(const char *path) + { + if (!path || !path[0]) + return mysql_data_home; + if (is_absolute_path(path)) + return path; + return buf.assign(mysql_data_home).append(path).c_str(); + } +}; + + +static inline bool +is_aria_log_dir_file(const datadir_node_t &node) +{ + return starts_with(node.filepath_rel, "aria_log"); +} + + +bool +copy_back_aria_logs(const char *dstdir) +{ + std::unique_ptr + ds_ctxt_aria_log_dir_path(ds_create(dstdir, DS_TYPE_LOCAL), ds_destroy); + + datadir_node_t node; + datadir_node_init(&node); + datadir_iter_t *it = datadir_iter_new(".", false); + + while (datadir_iter_next(it, &node)) + { + if (!is_aria_log_dir_file(node)) + continue; + if (!copy_or_move_file(ds_ctxt_aria_log_dir_path.get(), + node.filepath, node.filepath_rel, + dstdir, 1)) + return false; + } + datadir_node_free(&node); + datadir_iter_free(it); + return true; +} + bool copy_back() @@ -1728,7 +1822,7 @@ copy_back() bool ret = false; datadir_iter_t *it = NULL; datadir_node_t node; - char *dst_dir; + const char *dst_dir; memset(&node, 0, sizeof(node)); @@ -1768,6 +1862,13 @@ copy_back() return(false); } + Copy_back_dst_dir aria_log_dir_path_dst; + const char *aria_log_dir_path_abs= aria_log_dir_path_dst.make(aria_log_dir_path); + if (aria_log_dir_path && *aria_log_dir_path + && !directory_exists(aria_log_dir_path_abs, true)) { + return false; + } + /* cd to backup directory */ if (my_setwd(xtrabackup_target_dir, MYF(MY_WME))) { @@ -1775,6 +1876,9 @@ copy_back() return(false); } + if (!copy_back_aria_logs(aria_log_dir_path_abs)) + return false; + /* parse data file path */ if (!innobase_data_file_path) { @@ -1792,11 +1896,11 @@ copy_back() /* copy undo tablespaces */ + Copy_back_dst_dir dst_dir_buf; - dst_dir = (srv_undo_dir && *srv_undo_dir) - ? srv_undo_dir : mysql_data_home; + dst_dir = dst_dir_buf.make(srv_undo_dir); - ds_data = ds_create(dst_dir, DS_TYPE_LOCAL); + ds_ctxt *ds_tmp = ds_create(dst_dir, DS_TYPE_LOCAL); for (uint i = 1; i <= TRX_SYS_MAX_UNDO_SPACES; i++) { char filename[20]; @@ -1804,51 +1908,49 @@ copy_back() if (!file_exists(filename)) { break; } - if (!(ret = copy_or_move_file(filename, filename, + if (!(ret = copy_or_move_file(ds_tmp, filename, filename, dst_dir, 1))) { goto cleanup; } } - ds_destroy(ds_data); - ds_data = NULL; + ds_destroy(ds_tmp); + ds_tmp = NULL; /* copy redo logs */ - dst_dir = (srv_log_group_home_dir && *srv_log_group_home_dir) - ? srv_log_group_home_dir : mysql_data_home; + dst_dir = dst_dir_buf.make(srv_log_group_home_dir); /* --backup generates a single ib_logfile0, which we must copy. */ - ds_data = ds_create(dst_dir, DS_TYPE_LOCAL); - if (!(ret = copy_or_move_file(LOG_FILE_NAME, LOG_FILE_NAME, + ds_tmp = ds_create(dst_dir, DS_TYPE_LOCAL); + if (!(ret = copy_or_move_file(ds_tmp, LOG_FILE_NAME, LOG_FILE_NAME, dst_dir, 1))) { goto cleanup; } - ds_destroy(ds_data); + ds_destroy(ds_tmp); /* copy innodb system tablespace(s) */ - dst_dir = (innobase_data_home_dir && *innobase_data_home_dir) - ? innobase_data_home_dir : mysql_data_home; + dst_dir = dst_dir_buf.make(innobase_data_home_dir); - ds_data = ds_create(dst_dir, DS_TYPE_LOCAL); + ds_tmp = ds_create(dst_dir, DS_TYPE_LOCAL); for (Tablespace::const_iterator iter(srv_sys_space.begin()), end(srv_sys_space.end()); iter != end; ++iter) { const char *filepath = iter->filepath(); - if (!(ret = copy_or_move_file(base_name(filepath), filepath, - dst_dir, 1))) { + if (!(ret = copy_or_move_file(ds_tmp, base_name(filepath), + filepath, dst_dir, 1))) { goto cleanup; } } - ds_destroy(ds_data); + ds_destroy(ds_tmp); /* copy the rest of tablespaces */ - ds_data = ds_create(mysql_data_home, DS_TYPE_LOCAL); + ds_tmp = ds_create(mysql_data_home, DS_TYPE_LOCAL); it = datadir_iter_new(".", false); @@ -1863,6 +1965,10 @@ copy_back() char c_tmp; int i_tmp; + /* Skip aria log files */ + if (is_aria_log_dir_file(node)) + continue; + if (strstr(node.filepath,"/" ROCKSDB_BACKUP_DIR "/") #ifdef _WIN32 || strstr(node.filepath,"\\" ROCKSDB_BACKUP_DIR "\\") @@ -1915,6 +2021,11 @@ copy_back() continue; } + /* skip buffer pool dump */ + if (!strcmp(filename, default_buffer_pool_file)) { + continue; + } + /* skip innodb data files */ for (Tablespace::const_iterator iter(srv_sys_space.begin()), end(srv_sys_space.end()); iter != end; ++iter) { @@ -1923,7 +2034,7 @@ copy_back() } } - if (!(ret = copy_or_move_file(node.filepath, node.filepath_rel, + if (!(ret = copy_or_move_file(ds_tmp, node.filepath, node.filepath_rel, mysql_data_home, 1))) { goto cleanup; } @@ -1933,27 +2044,14 @@ copy_back() /* copy buffer pool dump */ - if (innobase_buffer_pool_filename) { - const char *src_name; - char path[FN_REFLEN]; - - src_name = trim_dotslash(innobase_buffer_pool_filename); - - snprintf(path, sizeof(path), "%s/%s", - mysql_data_home, - src_name); - - /* could be already copied with other files - from data directory */ - if (file_exists(src_name) && - !file_exists(innobase_buffer_pool_filename)) { - copy_or_move_file(src_name, - innobase_buffer_pool_filename, - mysql_data_home, 0); - } + if (file_exists(default_buffer_pool_file) && + innobase_buffer_pool_filename) { + copy_or_move_file(ds_tmp, default_buffer_pool_file, + innobase_buffer_pool_filename, + mysql_data_home, 0); } - rocksdb_copy_back(); + rocksdb_copy_back(ds_tmp); cleanup: if (it != NULL) { @@ -1962,11 +2060,11 @@ copy_back() datadir_node_free(&node); - if (ds_data != NULL) { - ds_destroy(ds_data); + if (ds_tmp != NULL) { + ds_destroy(ds_tmp); } - ds_data = NULL; + ds_tmp = NULL; return(ret); } @@ -2066,7 +2164,7 @@ decrypt_decompress() } /* copy the rest of tablespaces */ - ds_data = ds_create(".", DS_TYPE_LOCAL); + ds_ctxt *ds_tmp = ds_create(".", DS_TYPE_LOCAL); it = datadir_iter_new(".", false); @@ -2079,11 +2177,11 @@ decrypt_decompress() datadir_iter_free(it); } - if (ds_data != NULL) { - ds_destroy(ds_data); + if (ds_tmp != NULL) { + ds_destroy(ds_tmp); } - ds_data = NULL; + ds_tmp = NULL; return(ret); } @@ -2093,7 +2191,9 @@ decrypt_decompress() Do not copy the Innodb files (ibdata1, redo log files), as this is done in a separate step. */ -static bool backup_files_from_datadir(const char *dir_path) +static bool backup_files_from_datadir(ds_ctxt_t *ds_data, + const char *dir_path, + const char *prefix) { os_file_dir_t dir = os_file_opendir(dir_path); if (dir == IF_WIN(INVALID_HANDLE_VALUE, nullptr)) return false; @@ -2116,8 +2216,7 @@ static bool backup_files_from_datadir(const char *dir_path) if (!pname) pname = info.name; - if (!starts_with(pname, "aws-kms-key") && - !starts_with(pname, "aria_log")) + if (!starts_with(pname, prefix)) /* For ES exchange the above line with the following code: (!xtrabackup_prepare || !xtrabackup_incremental_dir || !starts_with(pname, "aria_log"))) @@ -2130,7 +2229,7 @@ static bool backup_files_from_datadir(const char *dir_path) std::string full_path(dir_path); full_path.append(1, '/').append(info.name); - if (!(ret = copy_file(ds_data, full_path.c_str() , info.name, 1))) + if (!(ret = ds_data->copy_file(full_path.c_str() , info.name, 1))) break; } os_file_closedir(dir); @@ -2180,13 +2279,14 @@ static char *trim_trailing_dir_sep(char *path) Create a file hardlink. @return true on success, false on error. */ -static bool make_hardlink(const char *from_path, const char *to_path) +bool +ds_ctxt_t::make_hardlink(const char *from_path, const char *to_path) { DBUG_EXECUTE_IF("no_hardlinks", return false;); char to_path_full[FN_REFLEN]; if (!is_abs_path(to_path)) { - fn_format(to_path_full, to_path, ds_data->root, "", MYF(MY_RELATIVE_PATH)); + fn_format(to_path_full, to_path, root, "", MYF(MY_RELATIVE_PATH)); } else { @@ -2207,7 +2307,9 @@ static bool make_hardlink(const char *from_path, const char *to_path) Has optimization that allows to use hardlinks when possible (source and destination are directories on the same device) */ -static void copy_or_move_dir(const char *from, const char *to, bool do_copy, bool allow_hardlinks) +void +ds_ctxt_t::copy_or_move_dir(const char *from, const char *to, + bool do_copy, bool allow_hardlinks) { datadir_node_t node; datadir_node_init(&node); @@ -2235,8 +2337,8 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo if (!rc) { rc = (do_copy ? - copy_file(ds_data, from_path, to_path, 1) : - move_file(ds_data, from_path, node.filepath_rel, + copy_file(from_path, to_path, 1) : + move_file(from_path, node.filepath_rel, to, 1)); } if (!rc) @@ -2333,7 +2435,7 @@ static void rocksdb_create_checkpoint() remove temp.checkpoint directory (in server's datadir) and release user level lock acquired inside rocksdb_create_checkpoint(). */ -static void rocksdb_backup_checkpoint() +static void rocksdb_backup_checkpoint(ds_ctxt *ds_data) { msg("Backing up rocksdb files."); char rocksdb_backup_dir[FN_REFLEN]; @@ -2345,7 +2447,7 @@ static void rocksdb_backup_checkpoint() 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); + ds_data->copy_or_move_dir(rocksdb_checkpoint_dir, ROCKSDB_BACKUP_DIR, true, backup_to_directory); rocksdb_remove_checkpoint_directory(); rocksdb_unlock_checkpoint(); } @@ -2353,7 +2455,7 @@ static void rocksdb_backup_checkpoint() /* Copies #rocksdb directory to the $rockdb_data_dir, on copy-back */ -static void rocksdb_copy_back() { +static void rocksdb_copy_back(ds_ctxt *ds_data) { if (access(ROCKSDB_BACKUP_DIR, 0)) return; char rocksdb_home_dir[FN_REFLEN]; @@ -2365,5 +2467,5 @@ static void rocksdb_copy_back() { xb_rocksdb_datadir?trim_dotslash(xb_rocksdb_datadir): ROCKSDB_BACKUP_DIR); } mkdirp(rocksdb_home_dir, 0777, MYF(0)); - copy_or_move_dir(ROCKSDB_BACKUP_DIR, rocksdb_home_dir, xtrabackup_copy_back, xtrabackup_copy_back); + ds_data->copy_or_move_dir(ROCKSDB_BACKUP_DIR, rocksdb_home_dir, xtrabackup_copy_back, xtrabackup_copy_back); } diff --git a/extra/mariabackup/backup_copy.h b/extra/mariabackup/backup_copy.h index 62b2b1bc232c4..b4a323f2e89af 100644 --- a/extra/mariabackup/backup_copy.h +++ b/extra/mariabackup/backup_copy.h @@ -14,30 +14,18 @@ extern bool binlog_locked; -bool -backup_file_printf(const char *filename, const char *fmt, ...) - ATTRIBUTE_FORMAT(printf, 2, 0); - /************************************************************************ Return true if first and second arguments are the same path. */ bool equal_paths(const char *first, const char *second); -/************************************************************************ -Copy file for backup/restore. -@return true in case of success. */ -bool -copy_file(ds_ctxt_t *datasink, - const char *src_file_path, - const char *dst_file_path, - uint thread_n); - /** Start --backup */ -bool backup_start(CorruptedPages &corrupted_pages); +bool backup_start(ds_ctxt *ds_data, ds_ctxt *ds_meta, + CorruptedPages &corrupted_pages); /** Release resources after backup_start() */ void backup_release(); /** Finish after backup_start() and backup_release() */ -bool backup_finish(); +bool backup_finish(ds_ctxt *ds_data); bool apply_log_finish(); bool @@ -51,6 +39,5 @@ directory_exists(const char *dir, bool create); lsn_t get_current_lsn(MYSQL *connection); -bool backup_file_print_buf(const char *filename, const char *buf, int buf_len); #endif diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index ba6e9e4818a14..669635f728c7b 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -267,7 +267,8 @@ free_mysql_variables(mysql_variable *vars) static char * -read_mysql_one_value(MYSQL *connection, const char *query) +read_mysql_one_value(MYSQL *connection, const char *query, + uint column, uint expect_columns) { MYSQL_RES *mysql_result; MYSQL_ROW row; @@ -275,10 +276,10 @@ read_mysql_one_value(MYSQL *connection, const char *query) mysql_result = xb_mysql_query(connection, query, true); - ut_ad(mysql_num_fields(mysql_result) == 1); + ut_ad(mysql_num_fields(mysql_result) == expect_columns); if ((row = mysql_fetch_row(mysql_result))) { - result = strdup(row[0]); + result = strdup(row[column]); } mysql_free_result(mysql_result); @@ -286,6 +287,15 @@ read_mysql_one_value(MYSQL *connection, const char *query) return(result); } + +static +char * +read_mysql_one_value(MYSQL *mysql, const char *query) +{ + return read_mysql_one_value(mysql, query, 0/*offset*/, 1/*total columns*/); +} + + static bool check_server_version(unsigned long version_number, @@ -333,7 +343,7 @@ check_server_version(unsigned long version_number, } /*********************************************************************//** -Receive options important for XtraBackup from MySQL server. +Receive options important for XtraBackup from server. @return true on success. */ bool get_mysql_vars(MYSQL *connection) { @@ -357,6 +367,7 @@ bool get_mysql_vars(MYSQL *connection) char *innodb_undo_directory_var= NULL; char *innodb_page_size_var= NULL; char *innodb_undo_tablespaces_var= NULL; + char *aria_log_dir_path_var= NULL; char *page_zip_level_var= NULL; char *ignore_db_dirs= NULL; char *endptr; @@ -387,6 +398,7 @@ bool get_mysql_vars(MYSQL *connection) {"innodb_undo_tablespaces", &innodb_undo_tablespaces_var}, {"innodb_compression_level", &page_zip_level_var}, {"ignore_db_dirs", &ignore_db_dirs}, + {"aria_log_dir_path", &aria_log_dir_path_var}, {NULL, NULL}}; read_mysql_variables(connection, "SHOW VARIABLES", mysql_vars, true); @@ -519,6 +531,12 @@ bool get_mysql_vars(MYSQL *connection) ut_ad(*endptr == 0); } + if (aria_log_dir_path_var) + { + aria_log_dir_path= my_strdup(PSI_NOT_INSTRUMENTED, + aria_log_dir_path_var, MYF(MY_FAE)); + } + if (page_zip_level_var != NULL) { page_zip_level= static_cast(strtoul(page_zip_level_var, &endptr, @@ -1079,92 +1097,328 @@ wait_for_safe_slave(MYSQL *connection) } -/*********************************************************************//** -Retrieves MySQL binlog position of the master server in a replication -setup and saves it in a file. It also saves it in mysql_slave_position -variable. */ -bool -write_slave_info(MYSQL *connection) +class Var { - char *master = NULL; - char *filename = NULL; - char *gtid_executed = NULL; - char *using_gtid = NULL; - char *position = NULL; - char *gtid_slave_pos = NULL; - char *ptr; - bool result = false; + const char *m_name; + char *m_value; + /* + Disable copying constructors for safety, as the default binary copying + which would be wrong. If we ever want them, the m_value + member should be copied using an strdup()-alike function. + */ + Var(const Var &); // Disabled + Var(Var &); // Disabled +public: + ~Var() + { + free(m_value); + } + Var(const char *name) + :m_name(name), + m_value(NULL) + { } + // Init using a SHOW VARIABLES LIKE 'name' query + Var(const char *name, MYSQL *mysql) + :m_name(name) + { + char buf[128]; + my_snprintf(buf, sizeof(buf), "SHOW VARIABLES LIKE '%s'", m_name); + m_value= read_mysql_one_value(mysql, buf, 1/*offset*/, 2/*total columns*/); + } + /* + Init by name from a result set. + If the variable name is not found in the result set metadata field names, + it's value stays untouched. + */ + bool init(MYSQL_RES *mysql_result, MYSQL_ROW row) + { + MYSQL_FIELD *field= mysql_fetch_fields(mysql_result); + for (uint i= 0; i < mysql_num_fields(mysql_result); i++) + { + if (!strcmp(field[i].name, m_name)) + { + free(m_value); // In case it was initialized earlier + m_value= row[i] ? strdup(row[i]) : NULL; + return false; + } + } + return true; + } + void replace(char from, char to) + { + ut_ad(m_value); + for (char *ptr= strchr(m_value, from); ptr; ptr= strchr(ptr, from)) + *ptr= to; + } - mysql_variable status[] = { - {"Master_Host", &master}, - {"Relay_Master_Log_File", &filename}, - {"Exec_Master_Log_Pos", &position}, - {"Executed_Gtid_Set", >id_executed}, - {"Using_Gtid", &using_gtid}, - {NULL, NULL} - }; + const char *value() const { return m_value; } + bool eq_value(const char *str, size_t length) const + { + return m_value && !strncmp(m_value, str, length) && m_value[length] == '\0'; + } + bool is_null_or_empty() const { return !m_value || !m_value[0]; } + bool print(String *to) const + { + ut_ad(m_value); + return to->append(m_value, strlen(m_value)); + } + bool print_quoted(String *to) const + { + ut_ad(m_value); + return to->append('\'') || to->append(m_value, strlen(m_value)) || + to->append('\''); + } + bool print_set_global(String *to) const + { + ut_ad(m_value); + return + to->append(STRING_WITH_LEN("SET GLOBAL ")) || + to->append(m_name, strlen(m_name)) || + to->append(STRING_WITH_LEN(" = '")) || + to->append(m_value, strlen(m_value)) || + to->append(STRING_WITH_LEN("';\n")); + } +}; - mysql_variable variables[] = { - {"gtid_slave_pos", >id_slave_pos}, - {NULL, NULL} - }; - read_mysql_variables(connection, "SHOW SLAVE STATUS", status, false); - read_mysql_variables(connection, "SHOW VARIABLES", variables, true); +class Show_slave_status +{ + Var m_mariadb_connection_name; // MariaDB: e.g. 'master1' + Var m_master; // e.g. 'localhost' + Var m_filename; // e.g. 'source-bin.000002' + Var m_position; // a number + Var m_mysql_gtid_executed; // MySQL56: e.g. single ':1-5" or multiline + // ':1-10,\n:1-20\n:1-30' + Var m_mariadb_using_gtid; // MariaDB: 'No','Slave_Pos','Current_Pos' + +public: + + Show_slave_status() + :m_mariadb_connection_name("Connection_name"), + m_master("Master_Host"), + m_filename("Relay_Master_Log_File"), + m_position("Exec_Master_Log_Pos"), + m_mysql_gtid_executed("Executed_Gtid_Set"), + m_mariadb_using_gtid("Using_Gtid") + { } + + void init(MYSQL_RES *res, MYSQL_ROW row) + { + m_mariadb_connection_name.init(res, row); + m_master.init(res, row); + m_filename.init(res, row); + m_position.init(res, row); + m_mysql_gtid_executed.init(res, row); + m_mariadb_using_gtid.init(res, row); + // Normalize + if (m_mysql_gtid_executed.value()) + m_mysql_gtid_executed.replace('\n', ' '); + } - if (master == NULL || filename == NULL || position == NULL) { - msg("Failed to get master binlog coordinates " - "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; - } + static void msg_is_not_slave() + { + msg("Failed to get master binlog coordinates " + "from SHOW SLAVE STATUS.This means that the server is not a " + "replication slave. Ignoring the --slave-info option"); + } - /* Print slave status to a file. - If GTID mode is used, construct a CHANGE MASTER statement with - MASTER_AUTO_POSITION and correct a gtid_purged value. */ - if (gtid_executed != NULL && *gtid_executed) { - /* MySQL >= 5.6 with GTID enabled */ + bool is_mariadb_using_gtid() const + { + return !m_mariadb_using_gtid.eq_value("No", 2); + } - for (ptr = strchr(gtid_executed, '\n'); - ptr; - ptr = strchr(ptr, '\n')) { - *ptr = ' '; - } + static bool start_comment_chunk(String *to) + { + return to->length() ? to->append(STRING_WITH_LEN("; ")) : false; + } - result = backup_file_printf(XTRABACKUP_SLAVE_INFO, - "SET GLOBAL gtid_purged='%s';\n" - "CHANGE MASTER TO MASTER_AUTO_POSITION=1\n", - gtid_executed); - - ut_a(asprintf(&mysql_slave_position, - "master host '%s', purge list '%s'", - master, gtid_executed) != -1); - } else if (gtid_slave_pos && *gtid_slave_pos && - !(using_gtid && !strncmp(using_gtid, "No", 2))) { - /* MariaDB >= 10.0 with GTID enabled */ - result = backup_file_printf(XTRABACKUP_SLAVE_INFO, - "SET GLOBAL gtid_slave_pos = '%s';\n" - "CHANGE MASTER TO master_use_gtid = slave_pos\n", - gtid_slave_pos); - ut_a(asprintf(&mysql_slave_position, - "master host '%s', gtid_slave_pos %s", - master, gtid_slave_pos) != -1); - } else { - result = backup_file_printf(XTRABACKUP_SLAVE_INFO, - "CHANGE MASTER TO MASTER_LOG_FILE='%s', " - "MASTER_LOG_POS=%s\n", filename, position); - ut_a(asprintf(&mysql_slave_position, - "master host '%s', filename '%s', position '%s'", - master, filename, position) != -1); - } + bool print_connection_name_if_set(String *to) const + { + if (!m_mariadb_connection_name.is_null_or_empty()) + return m_mariadb_connection_name.print_quoted(to) || to->append(' '); + return false; + } -cleanup: - free_mysql_variables(status); - free_mysql_variables(variables); + bool print_comment_master_identity(String *comment) const + { + if (comment->append(STRING_WITH_LEN("master "))) + return true; + if (!m_mariadb_connection_name.is_null_or_empty()) + return m_mariadb_connection_name.print_quoted(comment); + return comment->append(STRING_WITH_LEN("''")); // Default not named master + } - return(result); + bool print_using_master_log_pos(String *sql, String *comment) const + { + return + sql->append(STRING_WITH_LEN("CHANGE MASTER ")) || + print_connection_name_if_set(sql) || + sql->append(STRING_WITH_LEN("TO MASTER_LOG_FILE=")) || + m_filename.print_quoted(sql) || + sql->append(STRING_WITH_LEN(", MASTER_LOG_POS=")) || + m_position.print(sql) || + sql->append(STRING_WITH_LEN(";\n")) || + print_comment_master_identity(comment) || + comment->append(STRING_WITH_LEN(" filename ")) || + m_filename.print_quoted(comment) || + comment->append(STRING_WITH_LEN(" position ")) || + m_position.print_quoted(comment); + } + + bool print_mysql56(String *sql, String *comment) const + { + /* + SET @@GLOBAL.gtid_purged = '2174B383-5441-11E8-B90A-C80AA9429562:1-1029, ' + '224DA167-0C0C-11E8-8442-00059A3C7B00:1-2695'; + CHANGE MASTER TO MASTER_AUTO_POSITION=1; + */ + return + sql->append(STRING_WITH_LEN("SET GLOBAL gtid_purged=")) || + m_mysql_gtid_executed.print_quoted(sql) || + sql->append(STRING_WITH_LEN(";\n")) || + sql->append(STRING_WITH_LEN("CHANGE MASTER TO MASTER_AUTO_POSITION=1;\n")) || + print_comment_master_identity(comment) || + comment->append(STRING_WITH_LEN(" purge list ")) || + m_mysql_gtid_executed.print_quoted(comment); + } + + bool print_mariadb10_using_gtid(String *sql, String *comment) const + { + return + sql->append(STRING_WITH_LEN("CHANGE MASTER ")) || + print_connection_name_if_set(sql) || + sql->append(STRING_WITH_LEN("TO master_use_gtid = slave_pos;\n")) || + print_comment_master_identity(comment) || + comment->append(STRING_WITH_LEN(" master_use_gtid = slave_pos")); + } + + bool print(String *sql, String *comment, const Var >id_slave_pos) const + { + if (!m_mysql_gtid_executed.is_null_or_empty()) + { + /* MySQL >= 5.6 with GTID enabled */ + return print_mysql56(sql, comment); + } + + if (!gtid_slave_pos.is_null_or_empty() && is_mariadb_using_gtid()) + { + /* MariaDB >= 10.0 with GTID enabled */ + return print_mariadb10_using_gtid(sql, comment); + } + + return print_using_master_log_pos(sql, comment); + } + + /* + Get master info into strings "sql" and "comment" from a MYSQL_RES. + @return false on success + @return true on error + */ + static bool get_slave_info(MYSQL_RES *show_slave_info_result, + const Var >id_slave_pos, + String *sql, String *comment) + { + if (!gtid_slave_pos.is_null_or_empty()) + { + // Print gtid_slave_pos if any of the masters really needs it. + while (MYSQL_ROW row= mysql_fetch_row(show_slave_info_result)) + { + Show_slave_status status; + status.init(show_slave_info_result, row); + if (status.is_mariadb_using_gtid()) + { + if (gtid_slave_pos.print_set_global(sql) || + comment->append(STRING_WITH_LEN("gtid_slave_pos ")) || + gtid_slave_pos.print_quoted(comment)) + return true; // Error + break; + } + } + } + + // Print the list of masters + mysql_data_seek(show_slave_info_result, 0); + while (MYSQL_ROW row= mysql_fetch_row(show_slave_info_result)) + { + Show_slave_status status; + status.init(show_slave_info_result, row); + if (start_comment_chunk(comment) || + status.print(sql, comment, gtid_slave_pos)) + return true; // Error + } + return false; // Success + } + + /* + Get master info into strings "sql" and "comment". + @return false on success + @return true on error + */ + static bool get_slave_info(MYSQL *mysql, bool show_all_slave_status, + String *sql, String *comment) + { + bool rc= false; // Success + // gtid_slave_pos - MariaDB variable : e.g. "0-1-1" or "1-10-100,2-20-500" + Var gtid_slave_pos("gtid_slave_pos", mysql); + const char *query= show_all_slave_status ? "SHOW ALL SLAVES STATUS" : + "SHOW SLAVE STATUS"; + MYSQL_RES *mysql_result= xb_mysql_query(mysql, query, true); + if (!mysql_num_rows(mysql_result)) + { + msg_is_not_slave(); + // Don't change rc, we still want to continue the backup + } + else + { + rc= get_slave_info(mysql_result, gtid_slave_pos, sql, comment); + } + mysql_free_result(mysql_result); + return rc; + } +}; + + + +/*********************************************************************//** +Retrieves MySQL binlog position of the master server in a replication +setup and saves it in a file. It also saves it in mysql_slave_position +variable. +@returns false on error +@returns true on success +*/ +bool +write_slave_info(ds_ctxt *datasink, MYSQL *connection) +{ + String sql, comment; + bool show_all_slaves_status= false; + + switch (server_flavor) + { + case FLAVOR_MARIADB: + show_all_slaves_status= mysql_server_version >= 100000; + break; + case FLAVOR_UNKNOWN: + case FLAVOR_MYSQL: + case FLAVOR_PERCONA_SERVER: + break; + } + + if (Show_slave_status::get_slave_info(connection, show_all_slaves_status, + &sql, &comment)) + return false; // Error + + if (!sql.length()) + { + /* + SHOW [ALL] SLAVE STATUS returned no rows. + Don't create the file, but return success to continue the backup. + */ + return true; // Success + } + + mysql_slave_position= strdup(comment.c_ptr()); + return datasink->backup_file_print_buf(XTRABACKUP_SLAVE_INFO, + sql.ptr(), sql.length()); } @@ -1172,7 +1426,7 @@ write_slave_info(MYSQL *connection) Retrieves MySQL Galera and saves it in a file. It also prints it to stdout. */ bool -write_galera_info(MYSQL *connection) +write_galera_info(ds_ctxt *datasink, MYSQL *connection) { char *state_uuid = NULL, *state_uuid55 = NULL; char *last_committed = NULL, *last_committed55 = NULL; @@ -1199,14 +1453,18 @@ 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."); - result = false; + msg("Warning: failed to get master wsrep state from SHOW STATUS."); + result = true; goto cleanup; } - result = backup_file_printf(XTRABACKUP_GALERA_INFO, + result = datasink->backup_file_printf(XTRABACKUP_GALERA_INFO, "%s:%s\n", state_uuid ? state_uuid : state_uuid55, last_committed ? last_committed : last_committed55); + if (result) + { + write_current_binlog_file(datasink, connection); + } cleanup: free_mysql_variables(status); @@ -1219,7 +1477,7 @@ write_galera_info(MYSQL *connection) Flush and copy the current binary log file into the backup, if GTID is enabled */ bool -write_current_binlog_file(MYSQL *connection) +write_current_binlog_file(ds_ctxt *datasink, MYSQL *connection) { char *executed_gtid_set = NULL; char *gtid_binlog_state = NULL; @@ -1289,7 +1547,7 @@ write_current_binlog_file(MYSQL *connection) snprintf(filepath, sizeof(filepath), "%s%c%s", log_bin_dir, FN_LIBCHAR, log_bin_file); - result = copy_file(ds_data, filepath, log_bin_file, 0); + result = datasink->copy_file(filepath, log_bin_file, 0); } cleanup: @@ -1305,7 +1563,7 @@ write_current_binlog_file(MYSQL *connection) Retrieves MySQL binlog position and saves it in a file. It also prints it to stdout. */ bool -write_binlog_info(MYSQL *connection) +write_binlog_info(ds_ctxt *datasink, MYSQL *connection) { char *filename = NULL; char *position = NULL; @@ -1350,14 +1608,14 @@ write_binlog_info(MYSQL *connection) "filename '%s', position '%s', " "GTID of the last change '%s'", filename, position, gtid) != -1); - result = backup_file_printf(XTRABACKUP_BINLOG_INFO, + result = datasink->backup_file_printf(XTRABACKUP_BINLOG_INFO, "%s\t%s\t%s\n", filename, position, gtid); } else { ut_a(asprintf(&mysql_binlog_position, "filename '%s', position '%s'", filename, position) != -1); - result = backup_file_printf(XTRABACKUP_BINLOG_INFO, + result = datasink->backup_file_printf(XTRABACKUP_BINLOG_INFO, "%s\t%s\n", filename, position); } @@ -1397,8 +1655,9 @@ PERCONA_SCHEMA.xtrabackup_history and writes a new history record to the table containing all the history info particular to the just completed backup. */ bool -write_xtrabackup_info(MYSQL *connection, const char * filename, bool history, - bool stream) +write_xtrabackup_info(ds_ctxt *datasink, + MYSQL *connection, const char * filename, bool history, + bool stream) { bool result = true; @@ -1474,7 +1733,7 @@ write_xtrabackup_info(MYSQL *connection, const char * filename, bool history, } if (stream) { - backup_file_printf(filename, "%s", buf); + datasink->backup_file_printf(filename, "%s", buf); } else { fp = fopen(filename, "w"); if (!fp) { @@ -1595,11 +1854,11 @@ static std::string make_local_paths(const char *data_file_path) return buf.str(); } -bool write_backup_config_file() +bool write_backup_config_file(ds_ctxt *datasink) { - int rc= backup_file_printf("backup-my.cnf", - "# This MySQL options file was generated by innobackupex.\n\n" - "# The MySQL server\n" + int rc= datasink->backup_file_printf("backup-my.cnf", + "# This options file was generated by innobackupex.\n\n" + "# The server\n" "[mysqld]\n" "innodb_checksum_algorithm=%s\n" "innodb_data_file_path=%s\n" @@ -1684,7 +1943,7 @@ flush_changed_page_bitmaps() /*********************************************************************//** -Deallocate memory, disconnect from MySQL server, etc. +Deallocate memory, disconnect from server, etc. @return true on success. */ void backup_cleanup() diff --git a/extra/mariabackup/backup_mysql.h b/extra/mariabackup/backup_mysql.h index b61fa2362c60b..d80f3bb7bc167 100644 --- a/extra/mariabackup/backup_mysql.h +++ b/extra/mariabackup/backup_mysql.h @@ -62,17 +62,18 @@ void unlock_all(MYSQL *connection); bool -write_current_binlog_file(MYSQL *connection); +write_current_binlog_file(ds_ctxt *datasink, MYSQL *connection); bool -write_binlog_info(MYSQL *connection); +write_binlog_info(ds_ctxt *datasink, MYSQL *connection); bool -write_xtrabackup_info(MYSQL *connection, const char * filename, bool history, - bool stream); +write_xtrabackup_info(ds_ctxt *datasink, + MYSQL *connection, const char * filename, bool history, + bool stream); bool -write_backup_config_file(); +write_backup_config_file(ds_ctxt *datasink); bool lock_binlog_maybe(MYSQL *connection); @@ -84,10 +85,10 @@ bool wait_for_safe_slave(MYSQL *connection); bool -write_galera_info(MYSQL *connection); +write_galera_info(ds_ctxt *datasink, MYSQL *connection); bool -write_slave_info(MYSQL *connection); +write_slave_info(ds_ctxt *datasink, MYSQL *connection); #endif diff --git a/extra/mariabackup/changed_page_bitmap.cc b/extra/mariabackup/changed_page_bitmap.cc index 993288b79e1c1..39a07a2522472 100644 --- a/extra/mariabackup/changed_page_bitmap.cc +++ b/extra/mariabackup/changed_page_bitmap.cc @@ -188,18 +188,15 @@ log_online_read_bitmap_page( { ulint checksum; ulint actual_checksum; - ibool success; ut_a(bitmap_file->size >= MODIFIED_PAGE_BLOCK_SIZE); ut_a(bitmap_file->offset <= bitmap_file->size - MODIFIED_PAGE_BLOCK_SIZE); ut_a(bitmap_file->offset % MODIFIED_PAGE_BLOCK_SIZE == 0); - success = os_file_read(IORequestRead, - bitmap_file->file, page, bitmap_file->offset, - MODIFIED_PAGE_BLOCK_SIZE) == DB_SUCCESS; - - if (UNIV_UNLIKELY(!success)) { - + if (DB_SUCCESS != + os_file_read(IORequestRead, bitmap_file->file, page, + bitmap_file->offset, MODIFIED_PAGE_BLOCK_SIZE, + nullptr)) { /* The following call prints an error message */ os_file_get_last_error(TRUE); msg("InnoDB: Warning: failed reading changed page bitmap " @@ -455,7 +452,7 @@ log_online_open_bitmap_file_read_only( bitmap_file->size = os_file_get_size(bitmap_file->file); bitmap_file->offset = 0; -#ifdef UNIV_LINUX +#ifdef __linux__ posix_fadvise(bitmap_file->file, 0, 0, POSIX_FADV_SEQUENTIAL); posix_fadvise(bitmap_file->file, 0, 0, POSIX_FADV_NOREUSE); #endif diff --git a/extra/mariabackup/datasink.h b/extra/mariabackup/datasink.h index 4bede4ec9e78a..57468e0c9c739 100644 --- a/extra/mariabackup/datasink.h +++ b/extra/mariabackup/datasink.h @@ -37,6 +37,35 @@ typedef struct ds_ctxt { char *root; void *ptr; struct ds_ctxt *pipe_ctxt; + /* + Copy file for backup/restore. + @return true in case of success. + */ + bool copy_file(const char *src_file_path, + const char *dst_file_path, + uint thread_n); + + bool move_file(const char *src_file_path, + const char *dst_file_path, + const char *dst_dir, + uint thread_n); + + bool make_hardlink(const char *from_path, const char *to_path); + + void copy_or_move_dir(const char *from, const char *to, + bool do_copy, bool allow_hardlinks); + + bool backup_file_vprintf(const char *filename, + const char *fmt, va_list ap); + + bool backup_file_print_buf(const char *filename, + const char *buf, + int buf_len); + + bool backup_file_printf(const char *filename, + const char *fmt, ...) + ATTRIBUTE_FORMAT(printf, 2, 0); + } ds_ctxt_t; typedef struct { diff --git a/extra/mariabackup/ds_compress.cc b/extra/mariabackup/ds_compress.cc index 40566a1a8b17c..f7a9b7a1fbd65 100644 --- a/extra/mariabackup/ds_compress.cc +++ b/extra/mariabackup/ds_compress.cc @@ -1,5 +1,6 @@ /****************************************************** Copyright (c) 2011-2013 Percona LLC and/or its affiliates. +Copyright (c) 2022, MariaDB Corporation. Compressing datasink implementation for XtraBackup. @@ -32,12 +33,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA typedef struct { pthread_t id; uint num; - pthread_mutex_t ctrl_mutex; - pthread_cond_t ctrl_cond; pthread_mutex_t data_mutex; + pthread_cond_t avail_cond; pthread_cond_t data_cond; - my_bool started; - my_bool data_avail; + pthread_cond_t done_cond; + pthread_t data_avail; my_bool cancelled; const char *from; size_t from_len; @@ -196,9 +196,13 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len) threads = comp_ctxt->threads; nthreads = comp_ctxt->nthreads; + const pthread_t self = pthread_self(); + ptr = (const char *) buf; while (len > 0) { - uint max_thread; + bool wait = nthreads == 1; +retry: + bool submitted = false; /* Send data to worker threads for compression */ for (i = 0; i < nthreads; i++) { @@ -206,18 +210,34 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len) thd = threads + i; - pthread_mutex_lock(&thd->ctrl_mutex); + pthread_mutex_lock(&thd->data_mutex); + if (thd->data_avail == pthread_t(~0UL)) { + } else if (!wait) { +skip: + pthread_mutex_unlock(&thd->data_mutex); + continue; + } else { + for (;;) { + pthread_cond_wait(&thd->avail_cond, + &thd->data_mutex); + if (thd->data_avail + == pthread_t(~0UL)) { + break; + } + goto skip; + } + } chunk_len = (len > COMPRESS_CHUNK_SIZE) ? COMPRESS_CHUNK_SIZE : len; thd->from = ptr; thd->from_len = chunk_len; - pthread_mutex_lock(&thd->data_mutex); - thd->data_avail = TRUE; + thd->data_avail = self; pthread_cond_signal(&thd->data_cond); pthread_mutex_unlock(&thd->data_mutex); + submitted = true; len -= chunk_len; if (len == 0) { break; @@ -225,40 +245,46 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len) ptr += chunk_len; } - max_thread = (i < nthreads) ? i : nthreads - 1; + if (!submitted) { + wait = true; + goto retry; + } - /* Reap and stream the compressed data */ - for (i = 0; i <= max_thread; i++) { + for (i = 0; i < nthreads; i++) { thd = threads + i; pthread_mutex_lock(&thd->data_mutex); - while (thd->data_avail == TRUE) { - pthread_cond_wait(&thd->data_cond, + if (thd->data_avail != self) { + pthread_mutex_unlock(&thd->data_mutex); + continue; + } + + while (!thd->to_len) { + pthread_cond_wait(&thd->done_cond, &thd->data_mutex); } - xb_a(threads[i].to_len > 0); + bool fail = ds_write(dest_file, "NEWBNEWB", 8) || + write_uint64_le(dest_file, + comp_file->bytes_processed); + comp_file->bytes_processed += thd->from_len; - if (ds_write(dest_file, "NEWBNEWB", 8) || - write_uint64_le(dest_file, - comp_file->bytes_processed)) { - msg("compress: write to the destination stream " - "failed."); - return 1; + if (!fail) { + fail = write_uint32_le(dest_file, thd->adler) || + ds_write(dest_file, thd->to, + thd->to_len); } - comp_file->bytes_processed += threads[i].from_len; + thd->to_len = 0; + thd->data_avail = pthread_t(~0UL); + pthread_cond_signal(&thd->avail_cond); + pthread_mutex_unlock(&thd->data_mutex); - if (write_uint32_le(dest_file, threads[i].adler) || - ds_write(dest_file, threads[i].to, - threads[i].to_len)) { + if (fail) { msg("compress: write to the destination stream " "failed."); return 1; } - - pthread_mutex_unlock(&threads[i].data_mutex); - pthread_mutex_unlock(&threads[i].ctrl_mutex); } } @@ -328,6 +354,25 @@ write_uint64_le(ds_file_t *file, ulonglong n) return ds_write(file, tmp, sizeof(tmp)); } +static +void +destroy_worker_thread(comp_thread_ctxt_t *thd) +{ + pthread_mutex_lock(&thd->data_mutex); + thd->cancelled = TRUE; + pthread_cond_signal(&thd->data_cond); + pthread_mutex_unlock(&thd->data_mutex); + + pthread_join(thd->id, NULL); + + pthread_cond_destroy(&thd->avail_cond); + pthread_cond_destroy(&thd->data_cond); + pthread_cond_destroy(&thd->done_cond); + pthread_mutex_destroy(&thd->data_mutex); + + my_free(thd->to); +} + static comp_thread_ctxt_t * create_worker_threads(uint n) @@ -335,60 +380,43 @@ create_worker_threads(uint n) comp_thread_ctxt_t *threads; uint i; - threads = (comp_thread_ctxt_t *) my_malloc(PSI_NOT_INSTRUMENTED, - sizeof(comp_thread_ctxt_t) * n, MYF(MY_FAE)); + threads = static_cast + (my_malloc(PSI_NOT_INSTRUMENTED, n * sizeof *threads, + MYF(MY_ZEROFILL|MY_FAE))); for (i = 0; i < n; i++) { comp_thread_ctxt_t *thd = threads + i; thd->num = i + 1; - thd->started = FALSE; - thd->cancelled = FALSE; - thd->data_avail = FALSE; - - thd->to = (char *) my_malloc(PSI_NOT_INSTRUMENTED, - COMPRESS_CHUNK_SIZE + MY_QLZ_COMPRESS_OVERHEAD, MYF(MY_FAE)); - - /* Initialize the control mutex and condition var */ - if (pthread_mutex_init(&thd->ctrl_mutex, NULL) || - pthread_cond_init(&thd->ctrl_cond, NULL)) { - goto err; - } + thd->to = static_cast + (my_malloc(PSI_NOT_INSTRUMENTED, + COMPRESS_CHUNK_SIZE + + MY_QLZ_COMPRESS_OVERHEAD, + MYF(MY_FAE))); /* Initialize and data mutex and condition var */ if (pthread_mutex_init(&thd->data_mutex, NULL) || - pthread_cond_init(&thd->data_cond, NULL)) { + pthread_cond_init(&thd->avail_cond, NULL) || + pthread_cond_init(&thd->data_cond, NULL) || + pthread_cond_init(&thd->done_cond, NULL)) { goto err; } - pthread_mutex_lock(&thd->ctrl_mutex); + thd->data_avail = pthread_t(~0UL); if (pthread_create(&thd->id, NULL, compress_worker_thread_func, thd)) { msg("compress: pthread_create() failed: " "errno = %d", errno); - pthread_mutex_unlock(&thd->ctrl_mutex); goto err; } } - /* Wait for the threads to start */ - for (i = 0; i < n; i++) { - comp_thread_ctxt_t *thd = threads + i; - - while (thd->started == FALSE) - pthread_cond_wait(&thd->ctrl_cond, &thd->ctrl_mutex); - pthread_mutex_unlock(&thd->ctrl_mutex); - } - return threads; err: - while (i > 0) { - comp_thread_ctxt_t *thd; - i--; - thd = threads + i; - pthread_mutex_unlock(&thd->ctrl_mutex); + for (; i; i--) { + destroy_worker_thread(threads + i); } my_free(threads); @@ -402,21 +430,7 @@ destroy_worker_threads(comp_thread_ctxt_t *threads, uint n) uint i; for (i = 0; i < n; i++) { - comp_thread_ctxt_t *thd = threads + i; - - pthread_mutex_lock(&thd->data_mutex); - threads[i].cancelled = TRUE; - pthread_cond_signal(&thd->data_cond); - pthread_mutex_unlock(&thd->data_mutex); - - pthread_join(thd->id, NULL); - - pthread_cond_destroy(&thd->data_cond); - pthread_mutex_destroy(&thd->data_mutex); - pthread_cond_destroy(&thd->ctrl_cond); - pthread_mutex_destroy(&thd->ctrl_mutex); - - my_free(thd->to); + destroy_worker_thread(threads + i); } my_free(threads); @@ -428,26 +442,16 @@ compress_worker_thread_func(void *arg) { comp_thread_ctxt_t *thd = (comp_thread_ctxt_t *) arg; - pthread_mutex_lock(&thd->ctrl_mutex); - pthread_mutex_lock(&thd->data_mutex); - thd->started = TRUE; - pthread_cond_signal(&thd->ctrl_cond); - - pthread_mutex_unlock(&thd->ctrl_mutex); - while (1) { - thd->data_avail = FALSE; - pthread_cond_signal(&thd->data_cond); - - while (!thd->data_avail && !thd->cancelled) { + while (!thd->cancelled + && (thd->to_len || thd->data_avail == pthread_t(~0UL))) { pthread_cond_wait(&thd->data_cond, &thd->data_mutex); } if (thd->cancelled) break; - thd->to_len = qlz_compress(thd->from, thd->to, thd->from_len, &thd->state); @@ -462,6 +466,7 @@ compress_worker_thread_func(void *arg) thd->adler = adler32(0x00000001, (uchar *) thd->to, (uInt)thd->to_len); + pthread_cond_signal(&thd->done_cond); } pthread_mutex_unlock(&thd->data_mutex); diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index 37d2fc5972d1f..e0a4711a2aac5 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -129,6 +129,7 @@ xb_fil_cur_open( in case of error */ cursor->buf = NULL; cursor->node = NULL; + cursor->n_process_batch = 0; cursor->space_id = node->space->id; @@ -223,7 +224,7 @@ xb_fil_cur_open( if (!node->space->crypt_data && os_file_read(IORequestRead, node->handle, cursor->buf, 0, - cursor->page_size) == DB_SUCCESS) { + cursor->page_size, nullptr) == DB_SUCCESS) { mysql_mutex_lock(&fil_system.mutex); if (!node->space->crypt_data) { node->space->crypt_data = fil_space_read_crypt_data( @@ -374,6 +375,8 @@ xb_fil_cur_result_t xb_fil_cur_read(xb_fil_cur_t* cursor, return(XB_FIL_CUR_EOF); } +reinit_buf: + cursor->n_process_batch++; if (to_read > (ib_int64_t) cursor->buf_size) { to_read = (ib_int64_t) cursor->buf_size; } @@ -415,12 +418,30 @@ xb_fil_cur_result_t xb_fil_cur_read(xb_fil_cur_t* cursor, cursor->buf_page_no = static_cast(offset / page_size); if (os_file_read(IORequestRead, cursor->file, cursor->buf, offset, - (ulint) to_read) != DB_SUCCESS) { - ret = XB_FIL_CUR_ERROR; - goto func_exit; + (ulint) to_read, nullptr) != DB_SUCCESS) { + if (!srv_is_undo_tablespace(cursor->space_id)) { + ret = XB_FIL_CUR_ERROR; + goto func_exit; + } + + if (cursor->buf_page_no + >= SRV_UNDO_TABLESPACE_SIZE_IN_PAGES) { + ret = XB_FIL_CUR_SKIP; + goto func_exit; + } + + to_read = SRV_UNDO_TABLESPACE_SIZE_IN_PAGES * page_size; + + if (cursor->n_process_batch > 1) { + ret = XB_FIL_CUR_ERROR; + goto func_exit; + } + + space->release(); + goto reinit_buf; } - defer = space->is_deferred(); + defer = UT_LIST_GET_FIRST(space->chain)->deferred; /* 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; diff --git a/extra/mariabackup/fil_cur.h b/extra/mariabackup/fil_cur.h index 6b868bf3eddf7..b7812f6589e42 100644 --- a/extra/mariabackup/fil_cur.h +++ b/extra/mariabackup/fil_cur.h @@ -58,6 +58,7 @@ struct xb_fil_cur_t { uint thread_n; /*!< thread number for diagnostics */ uint32_t space_id; /*!< ID of tablespace */ uint32_t space_size; /*!< space size in pages */ + uint32_t n_process_batch;/*!< Number of batch processed */ /** @return whether this is not a file-per-table tablespace */ bool is_system() const diff --git a/extra/mariabackup/write_filt.cc b/extra/mariabackup/write_filt.cc index 01e4d83e344aa..a4dd5d28b0f72 100644 --- a/extra/mariabackup/write_filt.cc +++ b/extra/mariabackup/write_filt.cc @@ -31,7 +31,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA /************************************************************************ Write-through page write filter. */ -static my_bool wf_wt_init(xb_write_filt_ctxt_t *ctxt, char *dst_name, +static my_bool wf_wt_init(ds_ctxt *ds_meta, + xb_write_filt_ctxt_t *ctxt, char *dst_name, xb_fil_cur_t *cursor, CorruptedPages *corrupted_pages); static my_bool wf_wt_process(xb_write_filt_ctxt_t *ctxt, ds_file_t *dstfile); @@ -44,7 +45,8 @@ xb_write_filt_t wf_write_through = { /************************************************************************ Incremental page write filter. */ -static my_bool wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name, +static my_bool wf_incremental_init(ds_ctxt *ds_meta, + xb_write_filt_ctxt_t *ctxt, char *dst_name, xb_fil_cur_t *cursor, CorruptedPages *corrupted_pages); static my_bool wf_incremental_process(xb_write_filt_ctxt_t *ctxt, ds_file_t *dstfile); @@ -64,7 +66,8 @@ Initialize incremental page write filter. @return TRUE on success, FALSE on error. */ static my_bool -wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name, +wf_incremental_init(ds_ctxt *ds_meta, + xb_write_filt_ctxt_t *ctxt, char *dst_name, xb_fil_cur_t *cursor, CorruptedPages *corrupted_pages) { char meta_name[FN_REFLEN]; @@ -88,7 +91,7 @@ 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->zip_size, cursor->space_id); - if (!xb_write_delta_metadata(meta_name, &info)) { + if (!xb_write_delta_metadata(ds_meta, meta_name, &info)) { msg(cursor->thread_n,"Error: " "failed to write meta info for %s", cursor->rel_path); @@ -195,7 +198,8 @@ Initialize the write-through page write filter. @return TRUE on success, FALSE on error. */ static my_bool -wf_wt_init(xb_write_filt_ctxt_t *ctxt, char *dst_name __attribute__((unused)), +wf_wt_init(ds_ctxt *ds_meta __attribute__((unused)), + xb_write_filt_ctxt_t *ctxt, char *dst_name __attribute__((unused)), xb_fil_cur_t *cursor, CorruptedPages *) { ctxt->cursor = cursor; diff --git a/extra/mariabackup/write_filt.h b/extra/mariabackup/write_filt.h index 6c3ef24291f91..a0ce0778a7f6f 100644 --- a/extra/mariabackup/write_filt.h +++ b/extra/mariabackup/write_filt.h @@ -45,7 +45,8 @@ typedef struct { typedef struct { - my_bool (*init)(xb_write_filt_ctxt_t *ctxt, char *dst_name, + my_bool (*init)(ds_ctxt *ds_meta, + xb_write_filt_ctxt_t *ctxt, char *dst_name, xb_fil_cur_t *cursor, CorruptedPages *corrupted_pages); my_bool (*process)(xb_write_filt_ctxt_t *ctxt, ds_file_t *dstfile); my_bool (*finalize)(xb_write_filt_ctxt_t *, ds_file_t *dstfile); diff --git a/extra/mariabackup/xbcloud.cc b/extra/mariabackup/xbcloud.cc index fed937be834d5..588a15eb791dd 100644 --- a/extra/mariabackup/xbcloud.cc +++ b/extra/mariabackup/xbcloud.cc @@ -1676,8 +1676,11 @@ container_list_add_object(container_list *list, const char *name, list->object_count += object_count_step; } assert(list->idx <= list->object_count); - strcpy(list->objects[list->idx].name, name); - strcpy(list->objects[list->idx].hash, hash); + safe_strcpy(list->objects[list->idx].name, + sizeof(list->objects[list->idx].name), name); + safe_strcpy(list->objects[list->idx].hash, + sizeof(list->objects[list->idx].hash), hash); + list->objects[list->idx].bytes = bytes; ++list->idx; } @@ -2531,7 +2534,7 @@ swift_keystone_auth_v3(const char *auth_url, swift_auth_info *info) } else if (opt_swift_project != NULL) { snprintf(scope, sizeof(scope), ",\"scope\":{\"project\":{\"name\":\"%s\"%s}}", - opt_swift_project_id, domain); + opt_swift_project, domain); } snprintf(payload, sizeof(payload), "{\"auth\":{\"identity\":" diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index a96fdf36132f4..6f42a9be05a46 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -4,7 +4,7 @@ MariaBackup: hot backup tool for InnoDB Originally Created 3/3/2009 Yasufumi Kinoshita Written by Alexey Kopytov, Aleksandr Kuzminsky, Stewart Smith, Vadim Tkachenko, Yasufumi Kinoshita, Ignacio Nin and Baron Schwartz. -(c) 2017, 2021, MariaDB Corporation. +(c) 2017, 2022, MariaDB Corporation. Portions written by Marko Mäkelä. This program is free software; you can redistribute it and/or modify @@ -51,6 +51,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #include #include #include +#include #include #include @@ -116,6 +117,12 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #define MB_CORRUPTED_PAGES_FILE "innodb_corrupted_pages" +// disable server's systemd notification code +extern "C" { +int sd_notify() { return 0; } +int sd_notifyf() { return 0; } +} + int sys_var_init(); /* === xtrabackup specific options === */ @@ -186,6 +193,7 @@ struct xb_filter_entry_t{ xb_filter_entry_t *name_hash; }; +/** whether log_copying_thread() is active; protected by recv_sys.mutex */ static bool log_copying_running; int xtrabackup_parallel; @@ -240,6 +248,10 @@ long innobase_file_io_threads = 4; ulong innobase_read_io_threads = 4; ulong innobase_write_io_threads = 4; +/** Store the failed read of undo tablespace ids. Protected by +recv_sys.mutex. */ +static std::set fail_undo_ids; + longlong innobase_page_size = (1LL << 14); /* 16KB */ char* innobase_buffer_pool_filename = NULL; @@ -250,6 +262,7 @@ static char* innobase_ignored_opt; char* innobase_data_home_dir; char* innobase_data_file_path; +char *aria_log_dir_path; my_bool xtrabackup_incremental_force_scan = FALSE; @@ -267,10 +280,66 @@ char *xb_plugin_dir; char *xb_plugin_load; my_bool xb_close_files; -/* Datasinks */ -ds_ctxt_t *ds_data = NULL; -ds_ctxt_t *ds_meta = NULL; -ds_ctxt_t *ds_redo = NULL; + +class Datasink_free_list +{ +protected: + /* + Simple datasink creation tracking... + add datasinks in the reverse order you want them destroyed. + */ +#define XTRABACKUP_MAX_DATASINKS 10 + ds_ctxt_t *m_datasinks_to_destroy[XTRABACKUP_MAX_DATASINKS]; + uint m_actual_datasinks_to_destroy; +public: + Datasink_free_list() + :m_actual_datasinks_to_destroy(0) + { } + + void add_datasink_to_destroy(ds_ctxt_t *ds) + { + xb_ad(m_actual_datasinks_to_destroy < XTRABACKUP_MAX_DATASINKS); + m_datasinks_to_destroy[m_actual_datasinks_to_destroy] = ds; + m_actual_datasinks_to_destroy++; + } + + /* + Destroy datasinks. + Destruction is done in the specific order to not violate their order in the + pipeline so that each datasink is able to flush data down the pipeline. + */ + void destroy() + { + for (uint i= m_actual_datasinks_to_destroy; i > 0; i--) + { + ds_destroy(m_datasinks_to_destroy[i - 1]); + m_datasinks_to_destroy[i - 1] = NULL; + } + } +}; + + +class Backup_datasinks: public Datasink_free_list +{ +public: + ds_ctxt_t *m_data; + ds_ctxt_t *m_meta; + ds_ctxt_t *m_redo; + + Backup_datasinks() + :m_data(NULL), + m_meta(NULL), + m_redo(NULL) + { } + void init(); + void destroy() + { + Datasink_free_list::destroy(); + *this= Backup_datasinks(); + } + bool backup_low(); +}; + static bool innobackupex_mode = false; @@ -345,6 +414,9 @@ char orig_argv1[FN_REFLEN]; pthread_cond_t scanned_lsn_cond; +/** Store the deferred tablespace name during --backup */ +static std::set defer_space_names; + typedef std::map space_id_to_name_t; struct ddl_tracker_t { @@ -354,10 +426,58 @@ struct ddl_tracker_t { std::set drops; /* For DDL operation found in redo log, */ space_id_to_name_t id_to_name; + /** Deferred tablespaces with their ID and name which was + found in redo log of DDL operations */ + space_id_to_name_t deferred_tables; + + /** Insert the deferred tablespace id with the name */ + void insert_defer_id(space_id_t space_id, std::string name) + { + auto it= defer_space_names.find(name); + if (it != defer_space_names.end()) + { + deferred_tables[space_id]= name; + defer_space_names.erase(it); + } + } + + /** Rename the deferred tablespace with new name */ + void rename_defer(space_id_t space_id, std::string old_name, + std::string new_name) + { + if (deferred_tables.find(space_id) != deferred_tables.end()) + deferred_tables[space_id] = new_name; + auto defer_end= defer_space_names.end(); + auto defer= defer_space_names.find(old_name); + if (defer == defer_end) + defer= defer_space_names.find(new_name); + + if (defer != defer_end) + { + deferred_tables[space_id]= new_name; + defer_space_names.erase(defer); + } + } + + /** Delete the deferred tablespace */ + void delete_defer(space_id_t space_id, std::string name) + { + deferred_tables.erase(space_id); + defer_space_names.erase(name); + } }; static ddl_tracker_t ddl_tracker; +/** Store the space ids of truncated undo log tablespaces. Protected +by recv_sys.mutex */ +static std::set undo_trunc_ids; + +/** Stores the space ids of page0 INIT_PAGE redo records. It is +used to indicate whether the given deferred tablespace can +be reconstructed. */ +static std::set first_page_init_ids; + // Convert non-null terminated filename to space name static std::string filename_to_spacename(const void *filename, size_t len); @@ -412,7 +532,8 @@ void CorruptedPages::rename_space(uint32_t space_id, ut_a(!pthread_mutex_unlock(&m_mutex)); } -bool CorruptedPages::print_to_file(const char *filename) const +bool CorruptedPages::print_to_file(ds_ctxt *ds_data, + const char *filename) const { std::ostringstream out; ut_a(!pthread_mutex_lock(&m_mutex)); @@ -440,8 +561,8 @@ bool CorruptedPages::print_to_file(const char *filename) const out << "\n"; } ut_a(!pthread_mutex_unlock(&m_mutex)); - if (xtrabackup_backup) - return backup_file_print_buf(filename, out.str().c_str(), + if (ds_data) + return ds_data->backup_file_print_buf(filename, out.str().c_str(), static_cast(out.str().size())); std::ofstream outfile; outfile.open(filename); @@ -530,8 +651,8 @@ void CorruptedPages::zero_out_free_pages() space_it->second.pages.begin(); page_it != space_it->second.pages.end(); ++page_it) { - bool is_free= fseg_page_is_free(space, *page_it); - if (!is_free) { + if (fseg_page_is_allocated(space, *page_it)) + { space_info_t &space_info = non_free_pages[space_id]; space_info.pages.insert(*page_it); if (space_info.space_name.empty()) @@ -551,7 +672,7 @@ void CorruptedPages::zero_out_free_pages() die("Can't zero out corrupted page " UINT32PF " of tablespace %s", *page_it, space_name.c_str()); msg("Corrupted page " UINT32PF - " of tablespace %s was successfuly fixed.", + " of tablespace %s was successfully fixed.", *page_it, space_name.c_str()); } } @@ -563,19 +684,6 @@ void CorruptedPages::zero_out_free_pages() aligned_free(zero_page); } -/* Simple datasink creation tracking...add datasinks in the reverse order you -want them destroyed. */ -#define XTRABACKUP_MAX_DATASINKS 10 -static ds_ctxt_t *datasinks[XTRABACKUP_MAX_DATASINKS]; -static uint actual_datasinks = 0; -static inline -void -xtrabackup_add_datasink(ds_ctxt_t *ds) -{ - xb_ad(actual_datasinks < XTRABACKUP_MAX_DATASINKS); - datasinks[actual_datasinks] = ds; actual_datasinks++; -} - typedef void (*process_single_tablespace_func_t)(const char *dirname, const char *filname, bool is_remote, @@ -756,42 +864,64 @@ static std::string filename_to_spacename(const void *filename, size_t len) ut_a(table); *table = 0; char *db = strrchr(f, '/'); - ut_a(db); *table = '/'; - std::string s(db+1); + std::string s(db ? db+1 : f); free(f); return s; } /** Report an operation to create, delete, or rename a file during backup. @param[in] space_id tablespace identifier -@param[in] create whether the file is being created +@param[in] type redo log file operation type @param[in] name file name (not NUL-terminated) @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) */ -static void backup_file_op(uint32_t space_id, bool create, +static void backup_file_op(uint32_t space_id, int type, const byte* name, ulint len, const byte* new_name, ulint new_len) { - ut_ad(!create || !new_name); ut_ad(name); ut_ad(len); ut_ad(!new_name == !new_len); mysql_mutex_assert_owner(&recv_sys.mutex); - if (create) { - ddl_tracker.id_to_name[space_id] = filename_to_spacename(name, len); + switch(type) { + case FILE_CREATE: + { + std::string space_name = filename_to_spacename(name, len); + ddl_tracker.id_to_name[space_id] = space_name; + ddl_tracker.delete_defer(space_id, space_name); msg("DDL tracking : create %u \"%.*s\"", space_id, int(len), name); } - else if (new_name) { - ddl_tracker.id_to_name[space_id] = filename_to_spacename(new_name, new_len); + break; + case FILE_MODIFY: + ddl_tracker.insert_defer_id( + space_id, filename_to_spacename(name, len)); + break; + case FILE_RENAME: + { + std::string new_space_name = filename_to_spacename( + new_name, new_len); + std::string old_space_name = filename_to_spacename( + name, len); + ddl_tracker.id_to_name[space_id] = new_space_name; + ddl_tracker.rename_defer(space_id, old_space_name, + new_space_name); msg("DDL tracking : rename %u \"%.*s\",\"%.*s\"", space_id, int(len), name, int(new_len), new_name); - } else { + } + break; + case FILE_DELETE: ddl_tracker.drops.insert(space_id); + ddl_tracker.delete_defer( + space_id, filename_to_spacename(name, len)); msg("DDL tracking : delete %u \"%.*s\"", space_id, int(len), name); + break; + default: + ut_ad(0); + break; } } @@ -805,29 +935,37 @@ static void backup_file_op(uint32_t space_id, bool create, We will abort backup in this case. */ -static void backup_file_op_fail(uint32_t space_id, bool create, +static void backup_file_op_fail(uint32_t space_id, int type, const byte* name, ulint len, const byte* new_name, ulint new_len) { - bool fail; - if (create) { - msg("DDL tracking : create %u \"%.*s\"", - space_id, int(len), name); - std::string spacename = filename_to_spacename(name, len); - fail = !check_if_skip_table(spacename.c_str()); - } - else if (new_name) { + bool fail = false; + switch(type) { + case FILE_CREATE: + msg("DDL tracking : create %u \"%.*s\"", space_id, int(len), name); + fail = !check_if_skip_table( + filename_to_spacename(name, len).c_str()); + break; + case FILE_MODIFY: + break; + case FILE_RENAME: msg("DDL tracking : rename %u \"%.*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()); + fail = !check_if_skip_table( + filename_to_spacename(name, len).c_str()) + || !check_if_skip_table( + filename_to_spacename(new_name, new_len).c_str()); + break; + case FILE_DELETE: + fail = !check_if_skip_table( + filename_to_spacename(name, len).c_str()); msg("DDL tracking : delete %u \"%.*s\"", space_id, int(len), name); + break; + default: + ut_ad(0); + break; } + if (fail) { ut_a(opt_no_lock); die("DDL operation detected in the late phase of backup." @@ -835,6 +973,17 @@ static void backup_file_op_fail(uint32_t space_id, bool create, } } +static void backup_undo_trunc(uint32_t space_id) +{ + undo_trunc_ids.insert(space_id); +} + +/* Function to store the space id of page0 INIT_PAGE +@param space_id space id which has page0 init page */ +static void backup_first_page_op(space_id_t space_id) +{ + first_page_init_ids.insert(space_id); +} /* Retrieve default data directory, to be used with --copy-back. @@ -875,6 +1024,7 @@ typedef struct { uint *count; pthread_mutex_t* count_mutex; CorruptedPages *corrupted_pages; + Backup_datasinks *datasinks; } data_thread_ctxt_t; /* ======== for option and variables ======== */ @@ -931,8 +1081,10 @@ enum options_xtrabackup OPT_INNODB_BUFFER_POOL_FILENAME, OPT_INNODB_LOCK_WAIT_TIMEOUT, OPT_INNODB_LOG_BUFFER_SIZE, +#if defined __linux__ || defined _WIN32 + OPT_INNODB_LOG_FILE_BUFFERING, +#endif OPT_INNODB_LOG_FILE_SIZE, - OPT_INNODB_LOG_FILES_IN_GROUP, OPT_INNODB_OPEN_FILES, OPT_XTRA_DEBUG_SYNC, OPT_INNODB_CHECKSUM_ALGORITHM, @@ -978,7 +1130,8 @@ enum options_xtrabackup OPT_XTRA_CHECK_PRIVILEGES, OPT_XTRA_MYSQLD_ARGS, OPT_XB_IGNORE_INNODB_PAGE_CORRUPTION, - OPT_INNODB_FORCE_RECOVERY + OPT_INNODB_FORCE_RECOVERY, + OPT_ARIA_LOG_DIR_PATH }; struct my_option xb_client_options[]= { @@ -1006,7 +1159,8 @@ struct my_option xb_client_options[]= { (G_PTR *) &xtrabackup_print_param, (G_PTR *) &xtrabackup_print_param, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"use-memory", OPT_XTRA_USE_MEMORY, - "The value is used instead of buffer_pool_size", + "The value is used in place of innodb_buffer_pool_size. " + "This option is only relevant when the --prepare option is specified.", (G_PTR *) &xtrabackup_use_memory, (G_PTR *) &xtrabackup_use_memory, 0, GET_LL, REQUIRED_ARG, 100 * 1024 * 1024L, 1024 * 1024L, LONGLONG_MAX, 0, 1024 * 1024L, 0}, @@ -1190,7 +1344,7 @@ struct my_option xb_client_options[]= { {"rsync", OPT_RSYNC, "Uses the rsync utility to optimize local file " - "transfers. When this option is specified, innobackupex uses rsync " + "transfers. When this option is specified, " XB_TOOL_NAME " uses rsync " "to copy all non-InnoDB files instead of spawning a separate cp for " "each file, which can be much faster for servers with a large number " "of databases or tables. This option cannot be used together with " @@ -1298,7 +1452,7 @@ struct my_option xb_client_options[]= { {"ftwrl-wait-query-type", OPT_LOCK_WAIT_QUERY_TYPE, "This option specifies which types of queries are allowed to complete " - "before innobackupex will issue the global lock. Default is all.", + "before " XB_TOOL_NAME " will issue the global lock. Default is all.", (uchar *) &opt_lock_wait_query_type, (uchar *) &opt_lock_wait_query_type, &query_type_typelib, GET_ENUM, REQUIRED_ARG, QUERY_TYPE_ALL, 0, 0, 0, 0, 0}, @@ -1318,26 +1472,26 @@ struct my_option xb_client_options[]= { NULL, NULL, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"kill-long-queries-timeout", OPT_KILL_LONG_QUERIES_TIMEOUT, - "This option specifies the number of seconds innobackupex waits " + "This option specifies the number of seconds " XB_TOOL_NAME " waits " "between starting FLUSH TABLES WITH READ LOCK and killing those " "queries that block it. Default is 0 seconds, which means " - "innobackupex will not attempt to kill any queries.", + XB_TOOL_NAME " will not attempt to kill any queries.", (uchar *) &opt_kill_long_queries_timeout, (uchar *) &opt_kill_long_queries_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ftwrl-wait-timeout", OPT_LOCK_WAIT_TIMEOUT, - "This option specifies time in seconds that innobackupex should wait " + "This option specifies time in seconds that " XB_TOOL_NAME " should wait " "for queries that would block FTWRL before running it. If there are " - "still such queries when the timeout expires, innobackupex terminates " - "with an error. Default is 0, in which case innobackupex does not " + "still such queries when the timeout expires, " XB_TOOL_NAME " terminates " + "with an error. Default is 0, in which case " XB_TOOL_NAME " does not " "wait for queries to complete and starts FTWRL immediately.", (uchar *) &opt_lock_wait_timeout, (uchar *) &opt_lock_wait_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ftwrl-wait-threshold", OPT_LOCK_WAIT_THRESHOLD, "This option specifies the query run time threshold which is used by " - "innobackupex to detect long-running queries with a non-zero value " + XB_TOOL_NAME " to detect long-running queries with a non-zero value " "of --ftwrl-wait-timeout. FTWRL is not started until such " "long-running queries exist. This option has no effect if " "--ftwrl-wait-timeout is 0. Default value is 60 seconds.", @@ -1428,14 +1582,14 @@ struct my_option xb_server_options[] = (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", + {"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}, - {"log_bin", OPT_LOG, "Base name for the log sequence", + {"log_bin", OPT_LOG, "Base name for the log sequence", &opt_log_bin, &opt_log_bin, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"innodb", OPT_INNODB, "Ignored option for MySQL option compatibility", + {"innodb", OPT_INNODB, "Ignored option for MySQL option compatibility", (G_PTR*) &innobase_ignored_opt, (G_PTR*) &innobase_ignored_opt, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #ifdef BTR_CUR_HASH_ADAPT @@ -1493,12 +1647,18 @@ struct my_option xb_server_options[] = (G_PTR*) &log_sys.buf_size, (G_PTR*) &log_sys.buf_size, 0, IF_WIN(GET_ULL,GET_ULONG), REQUIRED_ARG, 2U << 20, 2U << 20, SIZE_T_MAX, 0, 4096, 0}, +#if defined __linux__ || defined _WIN32 + {"innodb_log_file_buffering", OPT_INNODB_LOG_FILE_BUFFERING, + "Whether the file system cache for ib_logfile0 is enabled during --backup", + (G_PTR*) &log_sys.log_buffered, + (G_PTR*) &log_sys.log_buffered, 0, GET_BOOL, NO_ARG, + TRUE, 0, 0, 0, 0, 0}, +#endif {"innodb_log_file_size", OPT_INNODB_LOG_FILE_SIZE, "Ignored for mysqld option compatibility", (G_PTR*) &srv_log_file_size, (G_PTR*) &srv_log_file_size, 0, - GET_ULL, REQUIRED_ARG, 48 << 20, 1 << 20, - std::numeric_limits::max(), 0, - UNIV_PAGE_SIZE_MAX, 0}, + GET_ULL, REQUIRED_ARG, 96 << 20, 4 << 20, + std::numeric_limits::max(), 0, 4096, 0}, {"innodb_log_group_home_dir", OPT_INNODB_LOG_GROUP_HOME_DIR, "Path to InnoDB log files.", &srv_log_group_home_dir, &srv_log_group_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1564,6 +1724,11 @@ struct my_option xb_server_options[] = &xb_plugin_dir, &xb_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, + {"aria_log_dir_path", OPT_ARIA_LOG_DIR_PATH, + "Path to individual files and their sizes.", + &aria_log_dir_path, &aria_log_dir_path, + 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"open_files_limit", OPT_OPEN_FILES_LIMIT, "the maximum number of file " "descriptors to reserve with setrlimit().", (G_PTR*) &xb_open_files_limit, (G_PTR*) &xb_open_files_limit, 0, GET_ULONG, @@ -1579,12 +1744,12 @@ struct my_option xb_server_options[] = &xb_rocksdb_datadir, &xb_rocksdb_datadir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - { "rocksdb-backup", OPT_BACKUP_ROCKSDB, "Backup rocksdb data, if rocksdb plugin is installed." + {"rocksdb-backup", OPT_BACKUP_ROCKSDB, "Backup rocksdb data, if rocksdb plugin is installed." "Used only with --backup option. Can be useful for partial backups, to exclude all rocksdb data", &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 " + {"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 }, @@ -1737,6 +1902,12 @@ static void print_version(void) my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); } +static void concatenate_default_groups(std::vector &backup_load_groups, const char **default_groups) +{ + for ( ; *default_groups ; default_groups++) + backup_load_groups.push_back(*default_groups); +} + static void usage(void) { puts("Open source backup tool for InnoDB and XtraDB\n\ @@ -1757,7 +1928,11 @@ GNU General Public License for more details.\n\ You can download full text of the license on http://www.gnu.org/licenses/gpl-2.0.txt\n"); printf("Usage: %s [--defaults-file=#] [--backup | --prepare | --copy-back | --move-back] [OPTIONS]\n",my_progname); - print_defaults("my", load_default_groups); + std::vector backup_load_default_groups; + concatenate_default_groups(backup_load_default_groups, backup_default_groups); + concatenate_default_groups(backup_load_default_groups, load_default_groups); + backup_load_default_groups.push_back(nullptr); + print_defaults("my", &backup_load_default_groups[0]); my_print_help(xb_client_options); my_print_help(xb_server_options); my_print_variables(xb_server_options); @@ -1811,11 +1986,18 @@ xb_get_one_option(const struct my_option *opt, ADD_PRINT_PARAM_OPT(srv_log_group_home_dir); break; - case OPT_INNODB_LOG_FILES_IN_GROUP: - case OPT_INNODB_LOG_FILE_SIZE: - break; - case OPT_INNODB_FLUSH_METHOD: +#ifdef _WIN32 + /* From: storage/innobase/handler/ha_innodb.cc:innodb_init_params */ + switch (srv_file_flush_method) { + case SRV_ALL_O_DIRECT_FSYNC + 1 /* "async_unbuffered"="unbuffered" */: + srv_file_flush_method= SRV_ALL_O_DIRECT_FSYNC; + break; + case SRV_ALL_O_DIRECT_FSYNC + 2 /* "normal"="fsync" */: + srv_file_flush_method= SRV_FSYNC; + break; + } +#endif ut_a(srv_file_flush_method <= IF_WIN(SRV_ALL_O_DIRECT_FSYNC, SRV_O_DIRECT_NO_FSYNC)); ADD_PRINT_PARAM_OPT(innodb_flush_method_names[srv_file_flush_method]); @@ -1859,6 +2041,10 @@ xb_get_one_option(const struct my_option *opt, } break; + case OPT_ARIA_LOG_DIR_PATH: + ADD_PRINT_PARAM_OPT(aria_log_dir_path); + break; + case OPT_XTRA_TARGET_DIR: strmake(xtrabackup_real_target_dir,argument, sizeof(xtrabackup_real_target_dir)-1); xtrabackup_target_dir= xtrabackup_real_target_dir; @@ -2052,7 +2238,6 @@ static bool innodb_init_param() srv_buf_pool_size = (ulint) xtrabackup_use_memory; srv_buf_pool_chunk_unit = srv_buf_pool_size; - srv_n_file_io_threads = (uint) innobase_file_io_threads; srv_n_read_io_threads = (uint) innobase_read_io_threads; srv_n_write_io_threads = (uint) innobase_write_io_threads; @@ -2168,8 +2353,14 @@ static bool innodb_init() /* Check if the data files exist or not. */ dberr_t err= srv_sys_space.check_file_spec(&create_new_db, 5U << 20); + if (create_new_db) + { + msg("mariadb-backup: InnoDB files do not exist"); + return true; + } + if (err == DB_SUCCESS) - err= srv_start(create_new_db); + err= srv_start(false); if (err != DB_SUCCESS) { @@ -2180,7 +2371,12 @@ static bool innodb_init() ut_ad(srv_force_recovery <= SRV_FORCE_IGNORE_CORRUPT); ut_ad(recv_no_log_write); buf_flush_sync(); - DBUG_ASSERT(!buf_pool.any_io_pending()); + recv_sys.debug_free(); + ut_ad(!os_aio_pending_reads()); + ut_ad(!os_aio_pending_writes()); + ut_d(mysql_mutex_lock(&buf_pool.flush_list_mutex)); + ut_ad(!buf_pool.get_oldest_modification(0)); + ut_d(mysql_mutex_unlock(&buf_pool.flush_list_mutex)); log_sys.close_file(); if (xtrabackup_incremental) @@ -2189,10 +2385,10 @@ static bool innodb_init() bool ret; const std::string ib_logfile0{get_log_file_path()}; - os_file_delete_if_exists(innodb_log_file_key, ib_logfile0.c_str(), nullptr); - pfs_os_file_t file= os_file_create(innodb_log_file_key, ib_logfile0.c_str(), - OS_FILE_CREATE, OS_FILE_NORMAL, - OS_DATA_FILE_NO_O_DIRECT, false, &ret); + os_file_delete_if_exists_func(ib_logfile0.c_str(), nullptr); + os_file_t file= os_file_create_func(ib_logfile0.c_str(), + OS_FILE_CREATE, OS_FILE_NORMAL, + OS_DATA_FILE_NO_O_DIRECT, false, &ret); if (!ret) { invalid_log: @@ -2213,13 +2409,12 @@ static bool innodb_init() #ifdef _WIN32 DWORD len; - ret= WriteFile(os_file_t{file}, log_hdr_buf, sizeof log_hdr_buf, + ret= WriteFile(file, log_hdr_buf, sizeof log_hdr_buf, &len, nullptr) && len == sizeof log_hdr_buf; #else - ret= sizeof log_hdr_buf == write(os_file_t{file}, log_hdr_buf, - sizeof log_hdr_buf); + ret= sizeof log_hdr_buf == write(file, log_hdr_buf, sizeof log_hdr_buf); #endif - if (!os_file_close(file) || !ret) + if (!os_file_close_func(file) || !ret) goto invalid_log; return false; } @@ -2397,7 +2592,8 @@ xb_read_delta_metadata(const char *filepath, xb_delta_info_t *info) msg("page_size is required in %s", filepath); r = FALSE; } else { - info->page_size = zip_size ? zip_size : page_size; + info->page_size = page_size; + info->zip_size = zip_size; } if (info->space_id == UINT32_MAX) { @@ -2413,7 +2609,8 @@ xb_read_delta_metadata(const char *filepath, xb_delta_info_t *info) Write meta info for an incremental delta. @return TRUE on success, FALSE on failure. */ my_bool -xb_write_delta_metadata(const char *filename, const xb_delta_info_t *info) +xb_write_delta_metadata(ds_ctxt *ds_meta, + const char *filename, const xb_delta_info_t *info) { ds_file_t *f; char buf[64]; @@ -2451,13 +2648,13 @@ xb_write_delta_metadata(const char *filename, const xb_delta_info_t *info) /* ================= backup ================= */ void xtrabackup_io_throttling() { - if (!xtrabackup_backup) + if (!xtrabackup_backup || !xtrabackup_throttle) return; - mysql_mutex_lock(&log_sys.mutex); - if (xtrabackup_throttle && (io_ticket--) < 0) - mysql_cond_wait(&wait_throttle, &log_sys.mutex); - mysql_mutex_unlock(&log_sys.mutex); + mysql_mutex_lock(&recv_sys.mutex); + if (io_ticket-- < 0) + mysql_cond_wait(&wait_throttle, &recv_sys.mutex); + mysql_mutex_unlock(&recv_sys.mutex); } static @@ -2744,7 +2941,9 @@ xb_get_copy_action(const char *dflt) for full backup, pages filter for incremental backup, etc. @return FALSE on success and TRUE on error */ -static my_bool xtrabackup_copy_datafile(fil_node_t *node, uint thread_n, +static my_bool xtrabackup_copy_datafile(ds_ctxt *ds_data, + ds_ctxt *ds_meta, + fil_node_t *node, uint thread_n, const char *dest_name, const xb_write_filt_t &write_filter, CorruptedPages &corrupted_pages) @@ -2802,7 +3001,7 @@ static my_bool xtrabackup_copy_datafile(fil_node_t *node, uint thread_n, ut_a(write_filter.process != NULL); if (write_filter.init != NULL && - !write_filter.init(&write_filt_ctxt, dst_name, &cursor, + !write_filter.init(ds_meta, &write_filt_ctxt, dst_name, &cursor, opt_log_innodb_page_corruption ? &corrupted_pages : NULL)) { msg (thread_n, "mariabackup: error: failed to initialize page write filter."); goto error; @@ -2824,15 +3023,27 @@ static my_bool xtrabackup_copy_datafile(fil_node_t *node, uint thread_n, } /* The main copy loop */ - while ((res = xb_fil_cur_read(&cursor, corrupted_pages)) == - XB_FIL_CUR_SUCCESS) { + while (1) { + res = xb_fil_cur_read(&cursor, corrupted_pages); + if (res == XB_FIL_CUR_ERROR) { + goto error; + } + + if (res == XB_FIL_CUR_EOF) { + break; + } + if (!write_filter.process(&write_filt_ctxt, dstfile)) { goto error; } - } - if (res == XB_FIL_CUR_ERROR) { - goto error; + if (res == XB_FIL_CUR_SKIP) { + mysql_mutex_lock(&recv_sys.mutex); + fail_undo_ids.insert( + static_cast(cursor.space_id)); + mysql_mutex_unlock(&recv_sys.mutex); + break; + } } if (write_filter.finalize @@ -2886,7 +3097,7 @@ static my_bool xtrabackup_copy_datafile(fil_node_t *node, uint thread_n, @return whether the operation failed */ static bool xtrabackup_copy_logfile() { - mysql_mutex_assert_owner(&log_sys.mutex); + mysql_mutex_assert_owner(&recv_sys.mutex); DBUG_EXECUTE_IF("log_checksum_mismatch", return false;); ut_a(dst_log_file); @@ -2894,15 +3105,8 @@ static bool xtrabackup_copy_logfile() const size_t sequence_offset{log_sys.is_encrypted() ? 8U + 5U : 5U}; const size_t block_size_1{log_sys.get_block_size() - 1}; - mysql_mutex_lock(&recv_sys.mutex); -#ifdef HAVE_PMEM - if (log_sys.is_pmem()) - { - recv_sys.offset= size_t(log_sys.calc_lsn_offset(recv_sys.lsn)); - recv_sys.len= size_t(log_sys.file_size); - } - else -#endif + ut_ad(!log_sys.is_pmem()); + { recv_sys.offset= size_t(recv_sys.lsn - log_sys.get_first_lsn()) & block_size_1; @@ -2914,87 +3118,6 @@ static bool xtrabackup_copy_logfile() recv_sys_t::parse_mtr_result r; size_t start_offset{recv_sys.offset}; -#ifdef HAVE_PMEM - if (log_sys.is_pmem()) - { - if ((ut_d(r=) recv_sys.parse_pmem(STORE_IF_EXISTS)) != recv_sys_t::OK) - { - ut_ad(r == recv_sys_t::GOT_EOF); - goto retry; - } - - retry_count= 0; - - do - { - const byte seq{log_sys.get_sequence_bit(recv_sys.lsn - - sequence_offset)}; - ut_ad(recv_sys.offset >= log_sys.START_OFFSET); - ut_ad(recv_sys.offset < recv_sys.len); - ut_ad(log_sys.buf[recv_sys.offset - >= log_sys.START_OFFSET + sequence_offset - ? recv_sys.offset - sequence_offset - : recv_sys.len - sequence_offset + - recv_sys.offset - log_sys.START_OFFSET] == - seq); - static const byte seq_1{1}; - if (UNIV_UNLIKELY(start_offset > recv_sys.offset)) - { - const ssize_t so(recv_sys.offset - (log_sys.START_OFFSET + - sequence_offset)); - if (so <= 0) - { - if (ds_write(dst_log_file, log_sys.buf + start_offset, - recv_sys.len - start_offset + so) || - ds_write(dst_log_file, &seq_1, 1)) - goto write_error; - if (so < -1 && - ds_write(dst_log_file, log_sys.buf + recv_sys.len - (1 - so), - 1 - so)) - goto write_error; - if (ds_write(dst_log_file, log_sys.buf + log_sys.START_OFFSET, - recv_sys.offset - log_sys.START_OFFSET)) - goto write_error; - } - else - { - if (ds_write(dst_log_file, log_sys.buf + start_offset, - recv_sys.len - start_offset)) - goto write_error; - if (ds_write(dst_log_file, log_sys.buf + log_sys.START_OFFSET, so)) - goto write_error; - if (ds_write(dst_log_file, &seq_1, 1)) - goto write_error; - if (so > 1 && - ds_write(dst_log_file, log_sys.buf + recv_sys.offset - - (so - 1), so - 1)) - goto write_error; - } - } - else if (seq == 1) - { - if (ds_write(dst_log_file, log_sys.buf + start_offset, - recv_sys.offset - start_offset)) - goto write_error; - } - else if (ds_write(dst_log_file, log_sys.buf + start_offset, - recv_sys.offset - start_offset - sequence_offset) || - ds_write(dst_log_file, &seq_1, 1) || - ds_write(dst_log_file, log_sys.buf + - recv_sys.offset - sequence_offset + 1, - sequence_offset - 1)) - goto write_error; - - start_offset= recv_sys.offset; - } - while ((ut_d(r=)recv_sys.parse_pmem(STORE_IF_EXISTS)) == recv_sys_t::OK); - - ut_ad(r == recv_sys_t::GOT_EOF); - pthread_cond_broadcast(&scanned_lsn_cond); - break; - } - else -#endif { { auto source_offset= @@ -3002,17 +3125,28 @@ static bool xtrabackup_copy_logfile() recv_sys.offset); source_offset&= ~block_size_1; size_t size{log_sys.buf_size - recv_sys.len}; - if (source_offset + size > log_sys.file_size) - size= static_cast(log_sys.file_size - source_offset); - ut_ad(size <= log_sys.buf_size); - log_sys.log.read(source_offset, {log_sys.buf, size}); + if (UNIV_UNLIKELY(source_offset + size > log_sys.file_size)) + { + const size_t first{size_t(log_sys.file_size - source_offset)}; + ut_ad(first <= log_sys.buf_size); + log_sys.log.read(source_offset, {log_sys.buf, first}); + size-= first; + if (log_sys.START_OFFSET + size > source_offset) + size= size_t(source_offset - log_sys.START_OFFSET); + if (size) + log_sys.log.read(log_sys.START_OFFSET, + {log_sys.buf + first, size}); + size+= first; + } + else + log_sys.log.read(source_offset, {log_sys.buf, size}); recv_sys.len= size; } if (log_sys.buf[recv_sys.offset] <= 1) break; - if (recv_sys.parse_mtr(STORE_IF_EXISTS) == recv_sys_t::OK) + if (recv_sys.parse_mtr(STORE_NO) == recv_sys_t::OK) { do { @@ -3022,15 +3156,11 @@ static bool xtrabackup_copy_logfile() sequence_offset)); *seq= 1; } - while ((r= recv_sys.parse_mtr(STORE_IF_EXISTS)) == recv_sys_t::OK); + while ((r= recv_sys.parse_mtr(STORE_NO)) == recv_sys_t::OK); if (ds_write(dst_log_file, log_sys.buf + start_offset, recv_sys.offset - start_offset)) { -#ifdef HAVE_PMEM - write_error: -#endif - mysql_mutex_unlock(&recv_sys.mutex); msg("Error: write to ib_logfile0 failed"); return true; } @@ -3051,19 +3181,15 @@ static bool xtrabackup_copy_logfile() if (recv_sys.offset < log_sys.get_block_size()) break; - mysql_mutex_unlock(&recv_sys.mutex); - if (xtrabackup_throttle && io_ticket-- < 0) - mysql_cond_wait(&wait_throttle, &log_sys.mutex); + mysql_cond_wait(&wait_throttle, &recv_sys.mutex); retry_count= 0; + continue; } else { recv_sys.len= recv_sys.offset & ~block_size_1; -#ifdef HAVE_PMEM - retry: -#endif if (retry_count == 100) break; @@ -3076,8 +3202,8 @@ static bool xtrabackup_copy_logfile() mysql_mutex_lock(&recv_sys.mutex); } - mysql_mutex_unlock(&recv_sys.mutex); - msg(">> log scanned up to (" LSN_PF ")", recv_sys.lsn); + if (verbose) + msg(">> log scanned up to (" LSN_PF ")", recv_sys.lsn); return false; } @@ -3107,44 +3233,47 @@ extern lsn_t server_lsn_after_lock; static void log_copying_thread() { my_thread_init(); - mysql_mutex_lock(&log_sys.mutex); + mysql_mutex_lock(&recv_sys.mutex); while (!xtrabackup_copy_logfile() && (!metadata_to_lsn || metadata_to_lsn > recv_sys.lsn)) { timespec abstime; - set_timespec_nsec(abstime, 1000ULL * xtrabackup_log_copy_interval); - mysql_cond_timedwait(&log_copying_stop, &log_sys.mutex, &abstime); + set_timespec_nsec(abstime, 1000000ULL * xtrabackup_log_copy_interval); + mysql_cond_timedwait(&log_copying_stop, &recv_sys.mutex, &abstime); } log_copying_running= false; - mysql_mutex_unlock(&log_sys.mutex); + mysql_mutex_unlock(&recv_sys.mutex); my_thread_end(); } +/** whether io_watching_thread() is active; protected by recv_sys.mutex */ static bool have_io_watching_thread; -static pthread_t io_watching_thread_id; /* io throttle watching (rough) */ -static void *io_watching_thread(void*) +static void io_watching_thread() { + my_thread_init(); /* currently, for --backup only */ - ut_a(xtrabackup_backup); + ut_ad(xtrabackup_backup); - mysql_mutex_lock(&log_sys.mutex); + mysql_mutex_lock(&recv_sys.mutex); + ut_ad(have_io_watching_thread); while (log_copying_running && !metadata_to_lsn) { timespec abstime; set_timespec(abstime, 1); - mysql_cond_timedwait(&log_copying_stop, &log_sys.mutex, &abstime); + mysql_cond_timedwait(&log_copying_stop, &recv_sys.mutex, &abstime); io_ticket= xtrabackup_throttle; mysql_cond_broadcast(&wait_throttle); } /* stop io throttle */ xtrabackup_throttle= 0; + have_io_watching_thread= false; mysql_cond_broadcast(&wait_throttle); - mysql_mutex_unlock(&log_sys.mutex); - return nullptr; + mysql_mutex_unlock(&recv_sys.mutex); + my_thread_end(); } #ifndef DBUG_OFF @@ -3209,7 +3338,8 @@ static void data_copy_thread_func(data_thread_ctxt_t *ctxt) /* thread context */ node->space->name(), backup_wait_for_lsn(get_current_lsn(mysql_connection));); /* copy the datafile */ - if (xtrabackup_copy_datafile(node, num, NULL, + if (xtrabackup_copy_datafile(ctxt->datasinks->m_data, + ctxt->datasinks->m_meta, node, num, NULL, xtrabackup_incremental ? wf_incremental : wf_write_through, *ctxt->corrupted_pages)) die("failed to copy datafile."); @@ -3232,22 +3362,21 @@ Otherwise (i.e. when streaming in the 'tar' format) we need 2 separate datasinks for the data stream (and don't allow parallel data copying) and for metainfo files (including ib_logfile0). The second datasink writes to temporary files first, and then streams them in a serialized way when closed. */ -static void -xtrabackup_init_datasinks(void) +void Backup_datasinks::init() { /* Start building out the pipelines from the terminus back */ if (xtrabackup_stream) { /* All streaming goes to stdout */ - ds_data = ds_meta = ds_redo = ds_create(xtrabackup_target_dir, - DS_TYPE_STDOUT); + m_data = m_meta = m_redo = ds_create(xtrabackup_target_dir, + DS_TYPE_STDOUT); } else { /* Local filesystem */ - ds_data = ds_meta = ds_redo = ds_create(xtrabackup_target_dir, - DS_TYPE_LOCAL); + m_data = m_meta = m_redo = ds_create(xtrabackup_target_dir, + DS_TYPE_LOCAL); } /* Track it for destruction */ - xtrabackup_add_datasink(ds_data); + add_datasink_to_destroy(m_data); /* Stream formatting */ if (xtrabackup_stream) { @@ -3256,66 +3385,50 @@ xtrabackup_init_datasinks(void) ut_a(xtrabackup_stream_fmt == XB_STREAM_FMT_XBSTREAM); ds = ds_create(xtrabackup_target_dir, DS_TYPE_XBSTREAM); - xtrabackup_add_datasink(ds); + add_datasink_to_destroy(ds); - ds_set_pipe(ds, ds_data); - ds_data = ds; + ds_set_pipe(ds, m_data); + m_data = ds; - ds_redo = ds_meta = ds_data; + m_redo = m_meta = m_data; } - /* Compression for ds_data and ds_redo */ + /* Compression for m_data and m_redo */ if (xtrabackup_compress) { ds_ctxt_t *ds; /* Use a 1 MB buffer for compressed output stream */ ds = ds_create(xtrabackup_target_dir, DS_TYPE_BUFFER); ds_buffer_set_size(ds, 1024 * 1024); - xtrabackup_add_datasink(ds); - ds_set_pipe(ds, ds_data); - if (ds_data != ds_redo) { - ds_data = ds; + add_datasink_to_destroy(ds); + ds_set_pipe(ds, m_data); + if (m_data != m_redo) { + m_data = ds; ds = ds_create(xtrabackup_target_dir, DS_TYPE_BUFFER); ds_buffer_set_size(ds, 1024 * 1024); - xtrabackup_add_datasink(ds); - ds_set_pipe(ds, ds_redo); - ds_redo = ds; + add_datasink_to_destroy(ds); + ds_set_pipe(ds, m_redo); + m_redo = ds; } else { - ds_redo = ds_data = ds; + m_redo = m_data = ds; } ds = ds_create(xtrabackup_target_dir, DS_TYPE_COMPRESS); - xtrabackup_add_datasink(ds); - ds_set_pipe(ds, ds_data); - if (ds_data != ds_redo) { - ds_data = ds; + add_datasink_to_destroy(ds); + ds_set_pipe(ds, m_data); + if (m_data != m_redo) { + m_data = ds; ds = ds_create(xtrabackup_target_dir, DS_TYPE_COMPRESS); - xtrabackup_add_datasink(ds); - ds_set_pipe(ds, ds_redo); - ds_redo = ds; + add_datasink_to_destroy(ds); + ds_set_pipe(ds, m_redo); + m_redo = ds; } else { - ds_redo = ds_data = ds; + m_redo = m_data = ds; } } } -/************************************************************************ -Destroy datasinks. - -Destruction is done in the specific order to not violate their order in the -pipeline so that each datasink is able to flush data down the pipeline. */ -static void xtrabackup_destroy_datasinks(void) -{ - for (uint i = actual_datasinks; i > 0; i--) { - ds_destroy(datasinks[i-1]); - datasinks[i-1] = NULL; - } - ds_data = NULL; - ds_meta = NULL; - ds_redo = NULL; -} - #define SRV_MAX_N_PENDING_SYNC_IOS 100 /** Initialize the tablespace cache subsystem. */ @@ -3348,7 +3461,8 @@ static void xb_load_single_table_tablespace(const char *dirname, { ut_ad(srv_operation == SRV_OPERATION_BACKUP || srv_operation == SRV_OPERATION_RESTORE_DELTA - || srv_operation == SRV_OPERATION_RESTORE); + || srv_operation == SRV_OPERATION_RESTORE + || srv_operation == SRV_OPERATION_BACKUP_NO_DEFER); /* Ignore .isl files on XtraBackup recovery. All tablespaces must be local. */ if (is_remote && srv_operation == SRV_OPERATION_RESTORE_DELTA) { @@ -3416,6 +3530,10 @@ static void xb_load_single_table_tablespace(const char *dirname, } if (!defer && file->m_defer) { + const char *file_path = file->filepath(); + defer_space_names.insert( + filename_to_spacename( + file_path, strlen(file_path))); delete file; ut_free(name); return; @@ -3424,19 +3542,20 @@ static void xb_load_single_table_tablespace(const char *dirname, bool is_empty_file = file->exists() && file->is_empty_file(); if (err == DB_SUCCESS && file->space_id() != SRV_TMP_SPACE_ID) { + mysql_mutex_lock(&fil_system.mutex); space = fil_space_t::create( file->space_id(), file->flags(), - FIL_TYPE_TABLESPACE, NULL/* TODO: crypt_data */); - - ut_a(space != NULL); + FIL_TYPE_TABLESPACE, nullptr/* TODO: crypt_data */, + FIL_ENCRYPTION_DEFAULT, + file->handle() != OS_FILE_CLOSED); + ut_ad(space); fil_node_t* node= space->add( file->filepath(), skip_node_page0 ? file->detach() : pfs_os_file_t(), 0, false, false); node->deferred= defer; - mysql_mutex_lock(&fil_system.mutex); if (!space->read_page0()) - err= DB_CANNOT_OPEN_FILE; + err = DB_CANNOT_OPEN_FILE; mysql_mutex_unlock(&fil_system.mutex); if (srv_operation == SRV_OPERATION_RESTORE_DELTA @@ -3839,10 +3958,6 @@ static dberr_t xb_assign_undo_space_start() uint32_t fsp_flags; int n_retries = 5; - if (srv_undo_tablespaces == 0) { - return error; - } - file = os_file_create(0, srv_sys_space.first_datafile()->filepath(), OS_FILE_OPEN, OS_FILE_NORMAL, OS_DATA_FILE, true, &ret); @@ -3854,7 +3969,7 @@ static dberr_t xb_assign_undo_space_start() byte* page = static_cast (aligned_malloc(srv_page_size, srv_page_size)); - if (os_file_read(IORequestRead, file, page, 0, srv_page_size) + if (os_file_read(IORequestRead, file, page, 0, srv_page_size, nullptr) != DB_SUCCESS) { msg("Reading first page failed.\n"); error = DB_ERROR; @@ -3866,7 +3981,7 @@ static dberr_t xb_assign_undo_space_start() retry: if (os_file_read(IORequestRead, file, page, TRX_SYS_PAGE_NO << srv_page_size_shift, - srv_page_size) != DB_SUCCESS) { + srv_page_size, nullptr) != DB_SUCCESS) { msg("Reading TRX_SYS page failed."); error = DB_ERROR; goto func_exit; @@ -3907,6 +4022,21 @@ static dberr_t xb_assign_undo_space_start() return error; } +/** Close all undo tablespaces while applying incremental delta */ +static void xb_close_undo_tablespaces() +{ + if (srv_undo_space_id_start == 0) + return; + for (uint32_t space_id= srv_undo_space_id_start; + space_id < srv_undo_space_id_start + srv_undo_tablespaces_open; + space_id++) + { + fil_space_t *space= fil_space_get(space_id); + ut_ad(space); + space->close(); + } +} + /**************************************************************************** Populates the tablespace memory cache by scanning for and opening data files. @returns DB_SUCCESS or error code.*/ @@ -3968,6 +4098,10 @@ xb_load_tablespaces() return(err); } + if (srv_operation == SRV_OPERATION_RESTORE_DELTA) { + xb_close_undo_tablespaces(); + } + DBUG_MARIABACKUP_EVENT("after_load_tablespaces", {}); return(DB_SUCCESS); } @@ -4383,34 +4517,36 @@ static ulong xb_set_max_open_files(rlim_t max_file_limit) # define xb_set_max_open_files(x) 0UL #endif -static void stop_backup_threads(bool running) +static void stop_backup_threads() { - if (running) + mysql_cond_broadcast(&log_copying_stop); + + if (log_copying_running || have_io_watching_thread) { + mysql_mutex_unlock(&recv_sys.mutex); fputs("mariabackup: Stopping log copying thread", stderr); fflush(stderr); - while (log_copying_running) + mysql_mutex_lock(&recv_sys.mutex); + while (log_copying_running || have_io_watching_thread) { + mysql_cond_broadcast(&log_copying_stop); + mysql_mutex_unlock(&recv_sys.mutex); putc('.', stderr); fflush(stderr); std::this_thread::sleep_for(std::chrono::milliseconds(200)); + mysql_mutex_lock(&recv_sys.mutex); } putc('\n', stderr); - mysql_cond_destroy(&log_copying_stop); } - if (have_io_watching_thread) - { - pthread_join(io_watching_thread_id, nullptr); - mysql_cond_destroy(&wait_throttle); - } + mysql_cond_destroy(&log_copying_stop); } /** Implement the core of --backup @return whether the operation succeeded */ -static bool xtrabackup_backup_low() +bool Backup_datasinks::backup_low() { - mysql_mutex_lock(&log_sys.mutex); + mysql_mutex_lock(&recv_sys.mutex); ut_ad(!metadata_to_lsn); /* read the latest checkpoint lsn */ @@ -4427,21 +4563,17 @@ static bool xtrabackup_backup_low() } recv_sys.lsn = lsn; - mysql_cond_broadcast(&log_copying_stop); - const bool running= log_copying_running; - mysql_mutex_unlock(&log_sys.mutex); - stop_backup_threads(running); - mysql_mutex_lock(&log_sys.mutex); + stop_backup_threads(); } if (metadata_to_lsn && xtrabackup_copy_logfile()) { - mysql_mutex_unlock(&log_sys.mutex); + mysql_mutex_unlock(&recv_sys.mutex); ds_close(dst_log_file); dst_log_file = NULL; return false; } - mysql_mutex_unlock(&log_sys.mutex); + mysql_mutex_unlock(&recv_sys.mutex); if (ds_close(dst_log_file) || !metadata_to_lsn) { dst_log_file = NULL; @@ -4450,16 +4582,35 @@ static bool xtrabackup_backup_low() dst_log_file = NULL; - if(!xtrabackup_incremental) { - strcpy(metadata_type, "full-backuped"); + std::vector failed_ids; + std::set_difference( + fail_undo_ids.begin(), fail_undo_ids.end(), + undo_trunc_ids.begin(), undo_trunc_ids.end(), + std::inserter(failed_ids, failed_ids.begin())); + + for (uint32_t id : failed_ids) { + msg("mariabackup: Failed to read undo log " + "tablespace space id %d and there is no undo " + "tablespace truncation redo record.", + id); + } + + if (failed_ids.size() > 0) { + return false; + } + + if (!xtrabackup_incremental) { + safe_strcpy(metadata_type, sizeof(metadata_type), + "full-backuped"); metadata_from_lsn = 0; } else { - strcpy(metadata_type, "incremental"); + safe_strcpy(metadata_type, sizeof(metadata_type), + "incremental"); metadata_from_lsn = incremental_lsn; } metadata_last_lsn = recv_sys.lsn; - if (!xtrabackup_stream_metadata(ds_meta)) { + if (!xtrabackup_stream_metadata(m_meta)) { msg("Error: failed to stream metadata."); return false; } @@ -4475,7 +4626,8 @@ static bool xtrabackup_backup_low() } sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, XTRABACKUP_INFO); - if (!write_xtrabackup_info(mysql_connection, filename, false, false)) { + if (!write_xtrabackup_info(m_data, + mysql_connection, filename, false, false)) { msg("Error: failed to write info " "to '%s'.", filename); return false; @@ -4495,6 +4647,7 @@ static bool xtrabackup_backup_func() pthread_mutex_t count_mutex; CorruptedPages corrupted_pages; data_thread_ctxt_t *data_threads; + Backup_datasinks backup_datasinks; pthread_cond_init(&scanned_lsn_cond, NULL); #ifdef USE_POSIX_FADVISE @@ -4523,20 +4676,23 @@ static bool xtrabackup_backup_func() srv_operation = SRV_OPERATION_BACKUP; log_file_op = backup_file_op; + undo_space_trunc = backup_undo_trunc; + first_page_init = backup_first_page_op; metadata_to_lsn = 0; /* initialize components */ if(innodb_init_param()) { fail: if (log_copying_running) { - mysql_mutex_lock(&log_sys.mutex); + mysql_mutex_lock(&recv_sys.mutex); metadata_to_lsn = 1; - mysql_cond_broadcast(&log_copying_stop); - mysql_mutex_unlock(&log_sys.mutex); - stop_backup_threads(true); + stop_backup_threads(); + mysql_mutex_unlock(&recv_sys.mutex); } log_file_op = NULL; + undo_space_trunc = NULL; + first_page_init = NULL; if (dst_log_file) { ds_close(dst_log_file); dst_log_file = NULL; @@ -4571,50 +4727,42 @@ static bool xtrabackup_backup_func() xb_filters_init(); xb_fil_io_init(); - srv_n_file_io_threads = srv_n_read_io_threads; if (os_aio_init()) { msg("Error: cannot initialize AIO subsystem"); goto fail; } - if (auto b = aligned_malloc(UNIV_PAGE_SIZE_MAX, 4096)) { - field_ref_zero = static_cast( - memset_aligned<4096>(b, 0, UNIV_PAGE_SIZE_MAX)); - } else { - goto fail; - } - log_sys.create(); /* get current checkpoint_lsn */ + { + mysql_mutex_lock(&recv_sys.mutex); - mysql_mutex_lock(&log_sys.mutex); + dberr_t err = recv_sys.find_checkpoint(); - if (recv_sys.find_checkpoint() != DB_SUCCESS) { - msg("Error: cannot read redo log header"); -unlock_and_fail: - mysql_mutex_unlock(&log_sys.mutex); -free_and_fail: - aligned_free(const_cast(field_ref_zero)); - field_ref_zero = nullptr; - goto fail; - } + if (err != DB_SUCCESS) { + msg("Error: cannot read redo log header"); + } else if (!log_sys.is_latest()) { + msg("Error: cannot process redo log before " + "MariaDB 10.8"); + err = DB_ERROR; + } else { + recv_needed_recovery = true; + } + mysql_mutex_unlock(&recv_sys.mutex); - if (!log_sys.is_latest()) { - msg("Error: cannot process redo log before MariaDB 10.8"); - goto unlock_and_fail; + if (err != DB_SUCCESS) { + goto fail; + } } - recv_needed_recovery = true; - mysql_mutex_unlock(&log_sys.mutex); - /* 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("Error: cannot mkdir %d: %s\n", my_errno, xtrabackup_extra_lsndir); - goto free_and_fail; + goto fail; } /* create target dir if not exist */ @@ -4622,22 +4770,22 @@ static bool xtrabackup_backup_func() && (my_mkdir(xtrabackup_target_dir,0777,MYF(0)) < 0)){ msg("Error: cannot mkdir %d: %s\n", my_errno, xtrabackup_target_dir); - goto free_and_fail; + goto fail; } - xtrabackup_init_datasinks(); + backup_datasinks.init(); if (!select_history()) { - goto free_and_fail; + goto fail; } /* open the log file */ memset(&stat_info, 0, sizeof(MY_STAT)); - dst_log_file = ds_open(ds_redo, LOG_FILE_NAME, &stat_info); + dst_log_file = ds_open(backup_datasinks.m_redo, LOG_FILE_NAME, &stat_info); if (dst_log_file == NULL) { msg("Error: failed to open the target stream for '%s'.", LOG_FILE_NAME); - goto free_and_fail; + goto fail; } /* label it */ @@ -4646,16 +4794,18 @@ static bool xtrabackup_backup_func() /* Write log header*/ if (ds_write(dst_log_file, log_hdr_buf, 12288)) { msg("error: write to logfile failed"); - goto free_and_fail; + goto fail; } log_copying_running = true; + + mysql_cond_init(0, &log_copying_stop, nullptr); + /* start io throttle */ - if(xtrabackup_throttle) { + if (xtrabackup_throttle) { io_ticket = xtrabackup_throttle; have_io_watching_thread = true; mysql_cond_init(0, &wait_throttle, nullptr); - mysql_thread_create(0, &io_watching_thread_id, nullptr, - io_watching_thread, nullptr); + std::thread(io_watching_thread).detach(); } /* Populate fil_system with tablespaces to copy */ @@ -4663,31 +4813,30 @@ static bool xtrabackup_backup_func() msg("merror: xb_load_tablespaces() failed with" " error %s.", ut_strerr(err)); log_copying_running = false; - goto free_and_fail; + goto fail; } /* copy log file by current position */ - mysql_mutex_lock(&log_sys.mutex); + mysql_mutex_lock(&recv_sys.mutex); recv_sys.lsn = log_sys.next_checkpoint_lsn; const bool log_copy_failed = xtrabackup_copy_logfile(); - mysql_mutex_unlock(&log_sys.mutex); + mysql_mutex_unlock(&recv_sys.mutex); if (log_copy_failed) { log_copying_running = false; - goto free_and_fail; + goto fail; } DBUG_MARIABACKUP_EVENT("before_innodb_log_copy_thread_started", {}); - mysql_cond_init(0, &log_copying_stop, nullptr); std::thread(log_copying_thread).detach(); /* FLUSH CHANGED_PAGE_BITMAPS call */ if (!flush_changed_page_bitmaps()) { - goto free_and_fail; + goto fail; } ut_a(xtrabackup_parallel > 0); @@ -4719,6 +4868,7 @@ static bool xtrabackup_backup_func() data_threads[i].count = &count; data_threads[i].count_mutex = &count_mutex; data_threads[i].corrupted_pages = &corrupted_pages; + data_threads[i].datasinks= &backup_datasinks; std::thread(data_copy_thread_func, data_threads + i).detach(); } @@ -4736,10 +4886,13 @@ static bool xtrabackup_backup_func() pthread_mutex_destroy(&count_mutex); free(data_threads); - bool ok = backup_start(corrupted_pages); + DBUG_ASSERT(backup_datasinks.m_data); + DBUG_ASSERT(backup_datasinks.m_meta); + bool ok = backup_start(backup_datasinks.m_data, + backup_datasinks.m_meta, corrupted_pages); if (ok) { - ok = xtrabackup_backup_low(); + ok = backup_datasinks.backup_low(); backup_release(); @@ -4747,15 +4900,13 @@ static bool xtrabackup_backup_func() pthread_join(dbug_alter_thread, nullptr);); if (ok) { - backup_finish(); + backup_finish(backup_datasinks.m_data); } } if (opt_log_innodb_page_corruption) - ok = corrupted_pages.print_to_file(MB_CORRUPTED_PAGES_FILE); - - aligned_free(const_cast(field_ref_zero)); - field_ref_zero = nullptr; + ok = corrupted_pages.print_to_file(backup_datasinks.m_data, + MB_CORRUPTED_PAGES_FILE); if (!ok) { goto fail; @@ -4764,7 +4915,7 @@ static bool xtrabackup_backup_func() if (changed_page_bitmap) { xb_page_bitmap_deinit(changed_page_bitmap); } - xtrabackup_destroy_datasinks(); + backup_datasinks.destroy(); msg("Redo log (from LSN " LSN_PF " to " LSN_PF ") was copied.", log_sys.next_checkpoint_lsn, recv_sys.lsn); @@ -4782,6 +4933,8 @@ static bool xtrabackup_backup_func() innodb_shutdown(); log_file_op = NULL; + undo_space_trunc = NULL; + first_page_init = NULL; pthread_cond_destroy(&scanned_lsn_cond); if (!corrupted_pages.empty()) { ut_ad(opt_log_innodb_page_corruption); @@ -4810,7 +4963,7 @@ FTWRL. This ensures consistent backup in presence of DDL. It is the responsibility of the prepare phase to deal with .new, .ren, and .del files. */ -void backup_fix_ddl(CorruptedPages &corrupted_pages) +void CorruptedPages::backup_fix_ddl(ds_ctxt *ds_data, ds_ctxt *ds_meta) { std::set dropped_tables; std::map renamed_tables; @@ -4832,7 +4985,7 @@ void backup_fix_ddl(CorruptedPages &corrupted_pages) if (ddl_tracker.drops.find(id) != ddl_tracker.drops.end()) { dropped_tables.insert(name); - corrupted_pages.drop_space(id); + drop_space(id); continue; } @@ -4845,7 +4998,7 @@ void backup_fix_ddl(CorruptedPages &corrupted_pages) if (new_name != name) { renamed_tables[name] = new_name; if (opt_log_innodb_page_corruption) - corrupted_pages.rename_space(id, new_name); + rename_space(id, new_name); } } @@ -4862,11 +5015,13 @@ void backup_fix_ddl(CorruptedPages &corrupted_pages) continue; } - if (ddl_tracker.drops.find(id) == ddl_tracker.drops.end()) { + if (ddl_tracker.drops.find(id) == ddl_tracker.drops.end() + && ddl_tracker.deferred_tables.find(id) + == ddl_tracker.deferred_tables.end()) { dropped_tables.erase(name); new_tables[id] = name; if (opt_log_innodb_page_corruption) - corrupted_pages.drop_space(id); + drop_space(id); } } @@ -4875,7 +5030,8 @@ void backup_fix_ddl(CorruptedPages &corrupted_pages) iter != renamed_tables.end(); ++iter) { const std::string old_name = iter->first; std::string new_name = iter->second; - backup_file_printf((old_name + ".ren").c_str(), "%s", new_name.c_str()); + DBUG_ASSERT(ds_data); + ds_data->backup_file_printf((old_name + ".ren").c_str(), "%s", new_name.c_str()); } // Mark tablespaces for drop @@ -4883,7 +5039,7 @@ void backup_fix_ddl(CorruptedPages &corrupted_pages) iter != dropped_tables.end(); iter++) { const std::string name(*iter); - backup_file_printf((name + ".del").c_str(), "%s", ""); + ds_data->backup_file_printf((name + ".del").c_str(), "%s", ""); } // Load and copy new tables. @@ -4907,6 +5063,41 @@ void backup_fix_ddl(CorruptedPages &corrupted_pages) DBUG_EXECUTE_IF("check_mdl_lock_works", DBUG_ASSERT(new_tables.size() == 0);); + srv_operation = SRV_OPERATION_BACKUP_NO_DEFER; + + /* Mariabackup detected the FILE_MODIFY or FILE_RENAME + for the deferred tablespace. So it needs to read the + tablespace again if innodb doesn't have page0 initialization + redo log for it */ + for (space_id_to_name_t::iterator iter = + ddl_tracker.deferred_tables.begin(); + iter != ddl_tracker.deferred_tables.end(); + iter++) { + if (check_if_skip_table(iter->second.c_str())) { + continue; + } + + if (first_page_init_ids.find(iter->first) + != first_page_init_ids.end()) { + new_tables[iter->first] = iter->second.c_str(); + continue; + } + + xb_load_single_table_tablespace(iter->second, false); + } + + /* Mariabackup doesn't detect any FILE_OP for the deferred + tablespace. There is a possiblity that page0 could've + been corrupted persistently in the disk */ + for (auto space_name: defer_space_names) { + if (!check_if_skip_table(space_name.c_str())) { + xb_load_single_table_tablespace( + space_name, false); + } + } + + srv_operation = SRV_OPERATION_BACKUP; + for (const auto &t : new_tables) { if (!check_if_skip_table(t.second.c_str())) { xb_load_single_table_tablespace(t.second, false, @@ -4923,8 +5114,9 @@ void backup_fix_ddl(CorruptedPages &corrupted_pages) node->name, strlen(node->name)); dest_name.append(".new"); - xtrabackup_copy_datafile(node, 0, dest_name.c_str(), wf_write_through, - corrupted_pages); + xtrabackup_copy_datafile(ds_data, ds_meta, + node, 0, dest_name.c_str(), + wf_write_through, *this); } } @@ -5070,7 +5262,7 @@ xb_delta_open_matching_space( return OS_FILE_CLOSED; } - mysql_mutex_lock(&log_sys.mutex); + mysql_mutex_lock(&recv_sys.mutex); if (!fil_is_user_tablespace_id(info.space_id)) { found: /* open the file and return its handle */ @@ -5083,7 +5275,7 @@ xb_delta_open_matching_space( msg("mariabackup: Cannot open file %s\n", real_name); } exit: - mysql_mutex_unlock(&log_sys.mutex); + mysql_mutex_unlock(&recv_sys.mutex); return file; } @@ -5167,8 +5359,12 @@ xb_delta_open_matching_space( ut_ad(fil_space_t::zip_size(flags) == info.zip_size); ut_ad(fil_space_t::physical_size(flags) == info.page_size); - if (fil_space_t::create(info.space_id, flags, - FIL_TYPE_TABLESPACE, 0)) { + mysql_mutex_lock(&fil_system.mutex); + fil_space_t* space = fil_space_t::create(info.space_id, flags, + FIL_TYPE_TABLESPACE, 0, + FIL_ENCRYPTION_DEFAULT, true); + mysql_mutex_unlock(&fil_system.mutex); + if (space) { *success = xb_space_create_file(real_name, info.space_id, flags, &file); } else { @@ -5282,7 +5478,8 @@ xtrabackup_apply_delta( offset = ((incremental_buffers * (page_size / 4)) << page_size_shift); if (os_file_read(IORequestRead, src_file, - incremental_buffer, offset, page_size) + incremental_buffer, offset, page_size, + nullptr) != DB_SUCCESS) { goto error; } @@ -5315,7 +5512,7 @@ xtrabackup_apply_delta( /* read whole of the cluster */ if (os_file_read(IORequestRead, src_file, incremental_buffer, - offset, page_in_buffer * page_size) + offset, page_in_buffer * page_size, nullptr) != DB_SUCCESS) { goto error; } @@ -5462,11 +5659,23 @@ static ibool prepare_handle_new_files(const char *data_home_dir, const char *file_name, void *arg) { const char *dest_dir = static_cast(arg); - std::string src_path = std::string(data_home_dir) + '/' + std::string(db_name) + '/' + file_name; + std::string src_path = std::string(data_home_dir) + '/' + std::string(db_name) + '/'; /* Copy "*.new" files from incremental to base dir for incremental backup */ std::string dest_path= dest_dir ? std::string(dest_dir) + '/' + std::string(db_name) + - '/' + file_name : src_path; + '/' : src_path; + + /* + A CREATE DATABASE could have happened during the base mariabackup run. + In case if the current table file (e.g. `t1.new`) is from such + a new database, the database directory may not exist yet in + the base backup directory. Let's make sure to check if the directory + exists (and create if needed). + */ + if (!directory_exists(dest_path.c_str(), true/*create if not exists*/)) + return FALSE; + src_path+= file_name; + dest_path+= file_name; size_t index = dest_path.find(".new"); DBUG_ASSERT(index != std::string::npos); @@ -5933,12 +6142,6 @@ static bool xtrabackup_prepare_func(char** argv) fil_system.freeze_space_list = 0; - /* increase IO threads */ - if (srv_n_file_io_threads < 10) { - srv_n_read_io_threads = 4; - srv_n_write_io_threads = 4; - } - msg("Starting InnoDB instance for recovery."); msg("mariabackup: Using %lld bytes for buffer pool " @@ -5978,7 +6181,7 @@ static bool xtrabackup_prepare_func(char** argv) } } else - corrupted_pages.print_to_file(MB_CORRUPTED_PAGES_FILE); + corrupted_pages.print_to_file(NULL, MB_CORRUPTED_PAGES_FILE); if (ok) { msg("Last binlog file %s, position %lld", @@ -6005,7 +6208,8 @@ static bool xtrabackup_prepare_func(char** argv) if (ok) { char filename[FN_REFLEN]; - strcpy(metadata_type, "log-applied"); + safe_strcpy(metadata_type, sizeof(metadata_type), + "log-applied"); if(xtrabackup_incremental && metadata_to_lsn < incremental_to_lsn) @@ -6184,22 +6388,28 @@ static bool check_all_privileges() } /* 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) { + if (!opt_no_lock && (opt_kill_long_queries_timeout || opt_kill_long_query_type)) { + check_result |= check_privilege( + granted_privileges, + "CONNECTION ADMIN", "*", "*", + PRIVILEGE_WARNING); + } + + /* START SLAVE SQL_THREAD */ + /* STOP SLAVE SQL_THREAD */ + if (opt_safe_slave_backup) { check_result |= check_privilege( granted_privileges, - "SUPER", "*", "*", + "REPLICATION SLAVE ADMIN", "*", "*", PRIVILEGE_WARNING); } /* SHOW MASTER STATUS */ /* SHOW SLAVE STATUS */ if (opt_galera_info || opt_slave_info - || (opt_no_lock && opt_safe_slave_backup)) { + || opt_safe_slave_backup) { check_result |= check_privilege(granted_privileges, - "REPLICATION CLIENT", "*", "*", + "SLAVE MONITOR", "*", "*", PRIVILEGE_WARNING); } @@ -6281,11 +6491,11 @@ xb_init() if (!get_mysql_vars(mysql_connection)) { return(false); } + if (opt_check_privileges && !check_all_privileges()) { return(false); } history_start_time = time(NULL); - } return(true); @@ -6605,6 +6815,7 @@ int main(int argc, char **argv) */ if (strcmp(argv[1], "--mysqld") == 0) { + srv_operation= SRV_OPERATION_EXPORT_RESTORED; extern int mysqld_main(int argc, char **argv); argc--; argv++; @@ -6638,7 +6849,7 @@ int main(int argc, char **argv) key_map_full.set_all(); logger.init_base(); - logger.set_handlers(LOG_FILE, LOG_NONE, LOG_NONE); + logger.set_handlers(LOG_NONE, LOG_NONE); mysql_mutex_init(key_LOCK_error_log, &LOCK_error_log, MY_MUTEX_INIT_FAST); @@ -6849,6 +7060,20 @@ static int main_low(char** argv) } } + ut_ad(!field_ref_zero); + if (auto b = aligned_malloc(UNIV_PAGE_SIZE_MAX, 4096)) { + field_ref_zero = static_cast( + memset_aligned<4096>(b, 0, UNIV_PAGE_SIZE_MAX)); + } else { + msg("Can't allocate memory for field_ref_zero"); + return EXIT_FAILURE; + } + + auto _ = make_scope_exit([]() { + aligned_free(const_cast(field_ref_zero)); + field_ref_zero = nullptr; + }); + /* --backup */ if (xtrabackup_backup && !xtrabackup_backup_func()) { return(EXIT_FAILURE); diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h index 11de9eeaf489d..27933f70a823a 100644 --- a/extra/mariabackup/xtrabackup.h +++ b/extra/mariabackup/xtrabackup.h @@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA #include "changed_page_bitmap.h" #include +#define XB_TOOL_NAME "mariadb-backup" + struct xb_delta_info_t { xb_delta_info_t(ulint page_size, ulint zip_size, uint32_t space_id) @@ -46,11 +48,13 @@ class CorruptedPages bool contains(page_id_t page_id) const; void drop_space(uint32_t space_id); void rename_space(uint32_t space_id, const std::string &new_name); - bool print_to_file(const char *file_name) const; + bool print_to_file(ds_ctxt *ds_data, const char *file_name) const; void read_from_file(const char *file_name); bool empty() const; void zero_out_free_pages(); + void backup_fix_ddl(ds_ctxt *ds_data, ds_ctxt *ds_meta); + private: void add_page_no_lock(const char *space_name, page_id_t page_id, bool convert_space_name); @@ -63,6 +67,7 @@ class CorruptedPages container_t m_spaces; }; + /* value of the --incremental option */ extern lsn_t incremental_lsn; @@ -71,13 +76,12 @@ extern char *xtrabackup_incremental_dir; extern char *xtrabackup_incremental_basedir; extern char *innobase_data_home_dir; extern char *innobase_buffer_pool_filename; +extern char *aria_log_dir_path; extern char *xb_plugin_dir; extern char *xb_rocksdb_datadir; extern my_bool xb_backup_rocksdb; extern uint opt_protocol; -extern ds_ctxt_t *ds_meta; -extern ds_ctxt_t *ds_data; extern xb_page_bitmap *changed_page_bitmap; @@ -174,7 +178,8 @@ extern ulong opt_binlog_info; extern ulong xtrabackup_innodb_force_recovery; void xtrabackup_io_throttling(void); -my_bool xb_write_delta_metadata(const char *filename, +my_bool xb_write_delta_metadata(ds_ctxt *ds_meta, + const char *filename, const xb_delta_info_t *info); /************************************************************************ diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index b7f523827217a..ef2f483556aea 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -48,20 +48,6 @@ 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', - "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}, - {"defaults-extra-file", 'e', - "Read this file after the global config file and before the config " - "file in the users home directory; should be the first option", - (void *)&my_defaults_extra_file, (void *)&my_defaults_extra_file, 0, - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"defaults-group-suffix", 'g', - "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}, {"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).", @@ -109,9 +95,6 @@ get_one_option(const struct my_option *opt __attribute__((unused)), const char *filename __attribute__((unused))) { switch (opt->id) { - case 'c': - opt_defaults_file_used= 1; - break; case 'n': cleanup_and_exit(0); case 'I': @@ -141,50 +124,35 @@ static int get_options(int *argc,char ***argv) return 0; } -static char *make_args(const char *s1, const char *s2) -{ - char *s= malloc(strlen(s1) + strlen(s2) + 1); - strmov(strmov(s, s1), s2); - return s; -} - int main(int argc, char **argv) { - int count= 0, error, no_defaults= 0; + int count, error, args_used; char **load_default_groups= 0, *tmp_arguments[6]; char **argument, **arguments, **org_argv; int nargs, i= 0; MY_INIT(argv[0]); org_argv= argv; - if (*argv && !strcmp(*argv, "--no-defaults")) - { - argv++; - ++count; - no_defaults= 1; - } - /* Copy program name and --no-defaults if present*/ + args_used= get_defaults_options(argv); + + /* Copy defaults-xxx arguments & program name */ + count= args_used; arguments= tmp_arguments; - memcpy((char*) arguments, (char*) org_argv, (++count)*sizeof(*org_argv)); + memcpy((char*) arguments, (char*) org_argv, count*sizeof(*org_argv)); arguments[count]= 0; + /* + We already process --defaults* options at the beginning in + get_defaults_options(). So skip --defaults* options and + pass remaining options to handle_options(). + */ + org_argv+=args_used-1; + argc-=args_used-1; + /* Check out the args */ - if (get_options(&argc,&argv)) + if (get_options(&argc,&org_argv)) cleanup_and_exit(1); - if (!no_defaults) - { - if (opt_defaults_file_used) - arguments[count++]= make_args("--defaults-file=", config_file); - if (my_defaults_extra_file) - arguments[count++]= make_args("--defaults-extra-file=", - my_defaults_extra_file); - if (my_defaults_group_suffix) - arguments[count++]= make_args("--defaults-group-suffix=", - my_defaults_group_suffix); - arguments[count]= 0; - } - nargs= argc + 1; if (opt_mysqld) nargs+= array_elements(mysqld_groups); @@ -201,7 +169,7 @@ int main(int argc, char **argv) for (; mysqld_groups[i]; i++) load_default_groups[i]= (char*) mysqld_groups[i]; } - memcpy(load_default_groups + i, argv, (argc + 1) * sizeof(*argv)); + memcpy(load_default_groups + i, org_argv, (argc + 1) * sizeof(*org_argv)); if ((error= load_defaults(config_file, (const char **) load_default_groups, &count, &arguments))) { diff --git a/extra/replace.c b/extra/replace.c index 7e94bfc36c382..8b20f812be005 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -148,9 +148,7 @@ int main(int argc, char *argv[]) /* reads options */ /* Initiates DEBUG - but no debugging here ! */ -static int static_get_options(argc,argv) -register int *argc; -register char **argv[]; +static int static_get_options(int *argc, char***argv) { int help,version; char *pos; @@ -218,10 +216,9 @@ register char **argv[]; } /* static_get_options */ -static int get_replace_strings(argc,argv,from_array,to_array) -register int *argc; -register char **argv[]; -POINTER_ARRAY *from_array,*to_array; +static int get_replace_strings(int *argc, char ***argv, + POINTER_ARRAY *from_array, + POINTER_ARRAY *to_array) { char *pos; @@ -974,9 +971,7 @@ static void free_buffer() bytes read from disk. */ -static int fill_buffer_retaining(fd,n) -File fd; -int n; +static int fill_buffer_retaining(File fd, int n) { int i; @@ -1019,9 +1014,7 @@ int n; /* Return 0 if convert is ok */ /* Global variable update is set if something was changed */ -static int convert_pipe(rep,in,out) -REPLACE *rep; -FILE *in,*out; +static int convert_pipe(REPLACE *rep, FILE *in, FILE *out) { int retain,error; uint length; diff --git a/extra/wolfssl/CMakeLists.txt b/extra/wolfssl/CMakeLists.txt index b38d57d371094..390a618ac91a0 100644 --- a/extra/wolfssl/CMakeLists.txt +++ b/extra/wolfssl/CMakeLists.txt @@ -12,6 +12,9 @@ IF(MSVC_INTEL) SET(WOLFSSL_X86_64_BUILD 1) SET(HAVE_INTEL_RDSEED 1) SET(HAVE_INTEL_RDRAND 1) +ELSEIF(CMAKE_ASM_COMPILER_ID MATCHES "Clang" AND CMAKE_VERSION VERSION_LESS 3.16) + + # WolfSSL 5.5.4 bug workaround below does not work, due to some CMake bug ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64") SET(WOLFSSL_X86_64_BUILD 1) IF(CMAKE_C_COMPILER_ID MATCHES GNU AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) @@ -94,7 +97,6 @@ ${WOLFCRYPT_SRCDIR}/md5.c ${WOLFCRYPT_SRCDIR}/memory.c ${WOLFCRYPT_SRCDIR}/pkcs12.c ${WOLFCRYPT_SRCDIR}/pwdbased.c -${WOLFCRYPT_SRCDIR}/rabbit.c ${WOLFCRYPT_SRCDIR}/random.c ${WOLFCRYPT_SRCDIR}/rsa.c ${WOLFCRYPT_SRCDIR}/sha.c @@ -104,6 +106,7 @@ ${WOLFCRYPT_SRCDIR}/wc_port.c ${WOLFCRYPT_SRCDIR}/wc_encrypt.c ${WOLFCRYPT_SRCDIR}/hash.c ${WOLFCRYPT_SRCDIR}/wolfmath.c +${WOLFCRYPT_SRCDIR}/kdf.c ) # Use fastmath large number math library. @@ -136,7 +139,8 @@ IF(WOLFSSL_FASTMATH) PROPERTIES COMPILE_FLAGS ${TFM_COMPILE_FLAGS}) ENDIF() ELSE() - SET(WOLFCRYPT_SOURCES ${WOLFCRYPT_SOURCES} ${WOLFCRYPT_SRCDIR}/integer.c) + SET(WOLFSSL_SP_MATH_ALL 1) + SET(WOLFCRYPT_SOURCES ${WOLFCRYPT_SOURCES} ${WOLFCRYPT_SRCDIR}/sp_int.c) ENDIF() IF(WOLFSSL_X86_64_BUILD) @@ -156,6 +160,8 @@ IF(WOLFSSL_X86_64_BUILD) ${WOLFCRYPT_SRCDIR}/sha512_asm.S ${WOLFCRYPT_SRCDIR}/sha256_asm.S) ADD_DEFINITIONS(-maes -msse4.2 -mpclmul) + # WolfSSL 5.5.4 bug - user_settings.h not included into aes_asm.S + SET_PROPERTY(SOURCE ${WOLFCRYPT_SRCDIR}/aes_asm.S APPEND PROPERTY COMPILE_OPTIONS "-DWOLFSSL_X86_64_BUILD") ENDIF() ENDIF() diff --git a/extra/wolfssl/user_settings.h.in b/extra/wolfssl/user_settings.h.in index 55b43655659e9..2355fd1691ca6 100644 --- a/extra/wolfssl/user_settings.h.in +++ b/extra/wolfssl/user_settings.h.in @@ -2,6 +2,7 @@ #define WOLFSSL_USER_SETTINGS_H #define HAVE_CRL +#define WOLFSSL_HAVE_ERROR_QUEUE #define WOLFSSL_MYSQL_COMPATIBLE #define HAVE_ECC #define ECC_TIMING_RESISTANT @@ -46,6 +47,7 @@ WolfSSL will use more stack space with it, with fastmath */ #cmakedefine FP_MAX_BITS 16384 +#define RSA_MAX_SIZE 8192 #cmakedefine WOLFSSL_AESNI #cmakedefine USE_FAST_MATH #cmakedefine TFM_TIMING_RESISTANT @@ -54,5 +56,6 @@ #cmakedefine USE_INTEL_SPEEDUP #cmakedefine USE_FAST_MATH #cmakedefine WOLFSSL_X86_64_BUILD +#cmakedefine WOLFSSL_SP_MATH_ALL #endif /* WOLFSSL_USER_SETTINGS_H */ diff --git a/extra/wolfssl/wolfssl b/extra/wolfssl/wolfssl index 723ed009ae5dc..4fbd4fd36a21e 160000 --- a/extra/wolfssl/wolfssl +++ b/extra/wolfssl/wolfssl @@ -1 +1 @@ -Subproject commit 723ed009ae5dc68acc14cd7664f93503d64cd51d +Subproject commit 4fbd4fd36a21efd9d1a7e17aba390e91c78693b1 diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index a7b98a1105021..a82d114364957 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -25,6 +25,7 @@ SET(HEADERS mysql.h mysql_com.h mysql_com_server.h + mariadb_capi_rename.h pack.h my_byteorder.h byte_order_generic.h @@ -36,6 +37,7 @@ SET(HEADERS ma_dyncol.h my_list.h my_alloc.h + my_alloca.h typelib.h my_dbug.h m_string.h @@ -74,7 +76,14 @@ FOREACH(f ${HEADERS_GEN_CONFIGURE}) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${f} DESTINATION ${INSTALL_INCLUDEDIR}/server COMPONENT Development) ENDFOREACH(f) -INSTALL(DIRECTORY mysql/ DESTINATION ${INSTALL_INCLUDEDIR}/server/mysql COMPONENT Development FILES_MATCHING PATTERN "*.h") +IF(NOT WITH_WSREP) + SET(EXCL_SERVICE_WSREP "service_wsrep.h") +ENDIF() +INSTALL(DIRECTORY mysql/ + DESTINATION ${INSTALL_INCLUDEDIR}/server/mysql COMPONENT Development + FILES_MATCHING PATTERN "*.h" + PATTERN "${EXCL_SERVICE_WSREP}" EXCLUDE +) STRING(REPLACE "." "\\." EXCL_RE "${HEADERS};${HEADERS_GEN_CONFIGURE}") STRING(REPLACE ";" "|" EXCL_RE "${EXCL_RE}") @@ -103,7 +112,9 @@ ${footer} ENDMACRO() INSTALL_COMPAT_HEADER(my_global.h "") +INSTALL_COMPAT_HEADER(my_alloca.h "") INSTALL_COMPAT_HEADER(my_config.h "") +INSTALL_COMPAT_HEADER(my_alloca.h "") INSTALL_COMPAT_HEADER(my_sys.h "") INSTALL_COMPAT_HEADER(mysql_version.h " #include diff --git a/include/aligned.h b/include/aligned.h new file mode 100644 index 0000000000000..81bd5d3f6f7e5 --- /dev/null +++ b/include/aligned.h @@ -0,0 +1,38 @@ +/* + Copyright (c) 2022, 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 02110-1335 USA */ + +#if defined __linux__ +# include +#endif + +inline void *aligned_malloc(size_t size, size_t alignment) +{ +#ifdef _WIN32 + return _aligned_malloc(size, alignment); +#elif defined __linux__ + return memalign(alignment, size); +#else + void *result; + if (posix_memalign(&result, alignment, size)) + result= NULL; + return result; +#endif +} + +inline void aligned_free(void *ptr) +{ + IF_WIN(_aligned_free,free)(ptr); +} diff --git a/include/errmsg.h b/include/errmsg.h index c0c4cfc58be18..bd086bba05bb9 100644 --- a/include/errmsg.h +++ b/include/errmsg.h @@ -36,8 +36,9 @@ extern const char *client_errors[]; /* Error messages */ #define CR_MIN_ERROR 2000 /* For easier client code */ #define CR_MAX_ERROR 2999 #if !defined(ER) -#define ER(X) (((X) >= CR_ERROR_FIRST && (X) <= CR_ERROR_LAST)? \ - client_errors[(X)-CR_ERROR_FIRST]: client_errors[CR_UNKNOWN_ERROR]) +#define ER(X) (((X) >= CR_ERROR_FIRST && (X) <= CR_ERROR_LAST) \ + ? client_errors[(X)-CR_ERROR_FIRST] \ + : client_errors[CR_UNKNOWN_ERROR-CR_ERROR_FIRST]) #endif #define CLIENT_ERRMAP 2 /* Errormap used by my_error() */ diff --git a/include/heap.h b/include/heap.h index f0ac527976c60..2e0e9357a3b18 100644 --- a/include/heap.h +++ b/include/heap.h @@ -33,12 +33,12 @@ extern "C" { #include "my_compare.h" #include "my_tree.h" - /* defines used by heap-funktions */ + /* defines used by heap-functions */ #define HP_MAX_LEVELS 4 /* 128^5 records is enough */ #define HP_PTRS_IN_NOD 128 - /* struct used with heap_funktions */ + /* struct used with heap_functions */ typedef struct st_heapinfo /* Struct from heap_info */ { @@ -107,7 +107,7 @@ typedef struct st_heap_block ulong last_allocated; /* number of records there is allocated space for */ } HP_BLOCK; -struct st_heap_info; /* For referense */ +struct st_heap_info; /* For reference */ typedef struct st_hp_keydef /* Key definition with open */ { diff --git a/include/ilist.h b/include/ilist.h index 265f0e2d57e9d..3349959e17e0e 100644 --- a/include/ilist.h +++ b/include/ilist.h @@ -27,12 +27,11 @@ // Derive your class from this struct to insert to a linked list. template struct ilist_node { - ilist_node() noexcept #ifndef DBUG_OFF - : next(NULL), prev(NULL) + ilist_node() noexcept : next(NULL), prev(NULL) {} +#else + ilist_node() = default; #endif - { - } ilist_node(ilist_node *next, ilist_node *prev) noexcept : next(next), prev(prev) diff --git a/include/json_lib.h b/include/json_lib.h index 853c4a6f7fa33..dfb76cadfad40 100644 --- a/include/json_lib.h +++ b/include/json_lib.h @@ -224,6 +224,7 @@ typedef struct st_json_engine_t int stack[JSON_DEPTH_LIMIT]; /* Keeps the stack of nested JSON structures. */ int stack_p; /* The 'stack' pointer. */ + volatile uchar *killed_ptr; } json_engine_t; @@ -377,7 +378,7 @@ int json_find_paths_next(json_engine_t *je, json_find_paths_t *state); #define JSON_ERROR_ILLEGAL_SYMBOL (-2) /* - Converst JSON string constant into ordinary string constant + Convert JSON string constant into ordinary string constant which can involve unpacking json escapes and changing character set. Returns negative integer in the case of an error, the length of the result otherwise. diff --git a/include/m_ctype.h b/include/m_ctype.h index 8db70bc4c92ad..872a9e16b79af 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -15,7 +15,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ /* - A better inplementation of the UNIX ctype(3) library. + A better implementation of the UNIX ctype(3) library. */ #ifndef _m_ctype_h @@ -139,7 +139,7 @@ const uint16 *my_uca_contraction2_weight(const MY_CONTRACTIONS *c, my_wc_t wc1, my_wc_t wc2); -/* Collation weights on a single level (e.g. primary, secondary, tertiarty) */ +/* Collation weights on a single level (e.g. primary, secondary, tertiary) */ typedef struct my_uca_level_info_st { my_wc_t maxchar; @@ -269,6 +269,28 @@ typedef enum enum_repertoire_t #define MY_STRXFRM_REVERSE_LEVEL6 0x00200000 /* if reverse order for level6 */ #define MY_STRXFRM_REVERSE_SHIFT 16 +/* Flags to strnncollsp_nchars */ +/* + MY_STRNNCOLLSP_NCHARS_EMULATE_TRIMMED_TRAILING_SPACES - + defines if inside strnncollsp_nchars() + short strings should be virtually extended to "nchars" + characters by emulating trimmed trailing spaces. + + This flag is needed when comparing packed strings of the CHAR + data type, when trailing spaces are trimmed on storage (like in InnoDB), + however the actual values (after unpacking) will have those trailing + spaces. + + If this flag is passed, strnncollsp_nchars() performs both + truncating longer strings and extending shorter strings + to exactly "nchars". + + If this flag is not passed, strnncollsp_nchars() only truncates longer + strings to "nchars", but does not extend shorter strings to "nchars". +*/ +#define MY_STRNNCOLLSP_NCHARS_EMULATE_TRIMMED_TRAILING_SPACES 1 + + /* Collation IDs for MariaDB that should not conflict with MySQL. We reserve 256..511, because MySQL will most likely use this range @@ -351,6 +373,61 @@ struct my_collation_handler_st const uchar *, size_t, const uchar *, size_t, my_bool); int (*strnncollsp)(CHARSET_INFO *, const uchar *, size_t, const uchar *, size_t); + /* + strnncollsp_nchars() - similar to strnncollsp() but assumes that both + strings were originally CHAR(N) values with the + same N, then were optionally space-padded, + or optionally space-trimmed. + + In other words, this function compares in the way + if we insert both values into a CHAR(N) column + and then compare the two column values. + + It compares the same amount of characters from the two strings. + This is especially important for NOPAD collations. + + If CHAR_LENGTH of the two strings are different, + the shorter string is virtually padded with trailing spaces + up to CHAR_LENGTH of the longer string, to guarantee that the + same amount of characters are compared. + This is important if the two CHAR(N) strings are space-trimmed + (e.g. like in InnoDB compact format for CHAR). + + The function compares not more than "nchars" characters only. + This can be useful to compare CHAR(N) space-padded strings + (when the exact N is known) without having to truncate them before + the comparison. + + For example, Field_string stores a "CHAR(3) CHARACTER SET utf8mb4" value + of "aaa" as 12 bytes in a record buffer: + - 3 bytes of the actual data, followed by + - 9 bytes of spaces (just fillers, not real data) + The caller can pass nchars=3 to compare CHAR(3) record values. + In such case, the comparator won't go inside the 9 bytes of the fillers. + + If N is not known, the caller can pass max(len1,len2) as the "nchars" value + (i.e. the maximum of the OCTET_LENGTH of the two strings). + + Notes on complex collations. + + This function counts contraction parts as individual characters. + For example, the Czech letter 'ch' (in Czech collations) + is ordinarily counted by the "nchars" limit as TWO characters + (although it is only one letter). + This corresponds to what CHAR(N) does in INSERT. + + If the "nchars" limit tears apart a contraction, only the part fitting + into "nchars" characters is used. For example, in case of a Czech collation, + the string "ach" with nchars=2 is compared as 'ac': the contraction + 'ch' is torn apart and the letter 'c' acts as an individual character. + This emulates the same comparison result with the scenario when we insert + 'ach' into a CHAR(2) column and then compare it. + */ + int (*strnncollsp_nchars)(CHARSET_INFO *, + const uchar *str1, size_t len1, + const uchar *str2, size_t len2, + size_t nchars, + uint flags); size_t (*strnxfrm)(CHARSET_INFO *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags); @@ -1498,7 +1575,7 @@ uint32 my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, An extended version of my_convert(), to pass non-default mb_wc() and wc_mb(). For example, String::copy_printable() which is used in Protocol::store_warning() uses this to escape control - and non-convertable characters. + and non-convertible characters. */ uint32 my_convert_using_func(char *to, size_t to_length, CHARSET_INFO *to_cs, my_charset_conv_wc_mb mb_wc, @@ -1579,7 +1656,7 @@ size_t my_convert_fix(CHARSET_INFO *dstcs, char *dst, size_t dst_length, @param str - the beginning of the string @param end - the string end (the next byte after the string) @return >0, for a multi-byte character - @rerurn 0, for a single byte character, broken sequence, empty string. + @return 0, for a single byte character, broken sequence, empty string. */ static inline uint my_ismbchar(CHARSET_INFO *cs, const char *str, const char *end) diff --git a/include/m_string.h b/include/m_string.h index 7130a41438fec..046dc39d13ab5 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -199,9 +199,22 @@ extern ulonglong strtoull(const char *str, char **ptr, int base); #include -#define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1)) -#define USTRING_WITH_LEN(X) ((uchar*) X), ((size_t) (sizeof(X) - 1)) -#define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1)) +#ifdef __cplusplus +#include +template inline const char *_swl_check(T s) +{ + static_assert(std::is_same::value + || std::is_same::value, + "Wrong argument for STRING_WITH_LEN()"); + return s; +} +#define STRING_WITH_LEN(X) _swl_check(X), ((size_t) (sizeof(X) - 1)) +#else +#define STRING_WITH_LEN(X) (X ""), ((size_t) (sizeof(X) - 1)) +#endif + +#define USTRING_WITH_LEN(X) (uchar*) STRING_WITH_LEN(X) +#define C_STRING_WITH_LEN(X) (char *) STRING_WITH_LEN(X) #define LEX_STRING_WITH_LEN(X) (X).str, (X).length typedef struct st_mysql_const_lex_string LEX_CSTRING; @@ -226,6 +239,44 @@ static inline void lex_string_set3(LEX_CSTRING *lex_str, const char *c_str, lex_str->length= len; } +/* + Copies src into dst and ensures dst is a NULL terminated C string. + + Returns 1 if the src string was truncated due to too small size of dst. + Returns 0 if src completely fit within dst. Pads the remaining dst with '\0' + + Note: dst_size must be > 0 +*/ +static inline int safe_strcpy(char *dst, size_t dst_size, const char *src) +{ + memset(dst, '\0', dst_size); + strncpy(dst, src, dst_size - 1); + /* + If the first condition is true, we are guaranteed to have src length + >= (dst_size - 1), hence safe to access src[dst_size - 1]. + */ + if (dst[dst_size - 2] != '\0' && src[dst_size - 1] != '\0') + return 1; /* Truncation of src. */ + return 0; +} + +/* + Appends src to dst and ensures dst is a NULL terminated C string. + + Returns 1 if the src string was truncated due to too small size of dst. + Returns 0 if src completely fit within the remaining dst space. Pads the + remaining dst with '\0'. + + Note: dst_size must be > 0 +*/ +static inline int safe_strcat(char *dst, size_t dst_size, const char *src) +{ + size_t init_len= strlen(dst); + if (init_len >= dst_size - 1) + return 1; + return safe_strcpy(dst + init_len, dst_size - init_len, src); +} + #ifdef __cplusplus static inline char *safe_str(char *str) { return str ? str : const_cast(""); } diff --git a/include/ma_dyncol.h b/include/ma_dyncol.h index 833a25b937ebf..f697c90707ffe 100644 --- a/include/ma_dyncol.h +++ b/include/ma_dyncol.h @@ -78,7 +78,7 @@ enum enum_dyncol_func_result ER_DYNCOL_YES= 1, /* For functions returning 0/1 */ ER_DYNCOL_FORMAT= -1, /* Wrong format of the encoded string */ ER_DYNCOL_LIMIT= -2, /* Some limit reached */ - ER_DYNCOL_RESOURCE= -3, /* Out of resourses */ + ER_DYNCOL_RESOURCE= -3, /* Out of resources */ ER_DYNCOL_DATA= -4, /* Incorrect input data */ ER_DYNCOL_UNKNOWN_CHARSET= -5, /* Unknown character set */ ER_DYNCOL_TRUNCATED= 2 /* OK, but data was truncated */ diff --git a/include/mariadb_capi_rename.h b/include/mariadb_capi_rename.h new file mode 100644 index 0000000000000..58e16fdc0c079 --- /dev/null +++ b/include/mariadb_capi_rename.h @@ -0,0 +1,57 @@ +/* Copyright (c) 2022, 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 + 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 02110-1335 USA */ + +/* Renaming C API symbols inside server + * client.c defines a number of functions from the C API, that are used in replication, in number of storage engine plugins, mariadb-backup. + * That can cause a problem if a plugin loads libmariadb/libmysql or a library, that has dependency on them. The known case is ODBC driver. + * Thus the header re-names those functions for internal use. + */ + +#ifndef MARIADB_CAPI_RENAME_INCLUDED +#define MARIADB_CAPI_RENAME_INCLUDED + +#if !defined(EMBEDDED_LIBRARY) && !defined(MYSQL_DYNAMIC_PLUGIN) + +#define MARIADB_ADD_PREFIX(_SYMBOL) server_##_SYMBOL +#define mysql_real_connect MARIADB_ADD_PREFIX(mysql_real_connect) +#define mysql_init MARIADB_ADD_PREFIX(mysql_init) +#define mysql_close MARIADB_ADD_PREFIX(mysql_close) +#define mysql_options MARIADB_ADD_PREFIX(mysql_options) +#define mysql_load_plugin MARIADB_ADD_PREFIX(mysql_load_plugin) +#define mysql_load_plugin_v MARIADB_ADD_PREFIX(mysql_load_plugin_v) +#define mysql_client_find_plugin MARIADB_ADD_PREFIX(mysql_client_find_plugin) +#define mysql_real_query MARIADB_ADD_PREFIX(mysql_real_query) +#define mysql_send_query MARIADB_ADD_PREFIX(mysql_send_query) +#define mysql_free_result MARIADB_ADD_PREFIX(mysql_free_result) +#define mysql_get_socket MARIADB_ADD_PREFIX(mysql_get_socket) +#define mysql_set_character_set MARIADB_ADD_PREFIX(mysql_set_character_set) +#define mysql_get_server_version MARIADB_ADD_PREFIX(mysql_get_server_version) +#define mysql_error MARIADB_ADD_PREFIX(mysql_error) +#define mysql_errno MARIADB_ADD_PREFIX(mysql_errno) +#define mysql_num_fields MARIADB_ADD_PREFIX(mysql_num_fields) +#define mysql_num_rows MARIADB_ADD_PREFIX(mysql_num_rows) +#define mysql_options4 MARIADB_ADD_PREFIX(mysql_options4) +#define mysql_fetch_lengths MARIADB_ADD_PREFIX(mysql_fetch_lengths) +#define mysql_fetch_row MARIADB_ADD_PREFIX(mysql_fetch_row) +#define mysql_affected_rows MARIADB_ADD_PREFIX(mysql_affected_rows) +#define mysql_store_result MARIADB_ADD_PREFIX(mysql_store_result) +#define mysql_select_db MARIADB_ADD_PREFIX(mysql_select_db) +#define mysql_get_ssl_cipher MARIADB_ADD_PREFIX(mysql_get_ssl_cipher) +#define mysql_ssl_set MARIADB_ADD_PREFIX(mysql_ssl_set) +#define mysql_client_register_plugin MARIADB_ADD_PREFIX(mysql_client_register_plugin) + +#endif // !EMBEDDED_LIBRARY && !MYSQL_DYNAMIC_PLUGIN + +#endif // !MARIADB_CAPI_RENAME_INCLUDED diff --git a/include/my_alarm.h b/include/my_alarm.h index 14a81c1ef1749..652b460cba354 100644 --- a/include/my_alarm.h +++ b/include/my_alarm.h @@ -31,7 +31,10 @@ extern ulong my_time_to_wait_for_lock; #include #ifdef HAVE_SIGHANDLER_T #define sig_return sighandler_t -#elif defined(SOLARIS) || defined(__sun) || defined(__APPLE__) || defined(__FreeBSD__) +#elif defined(SOLARIS) || defined(__sun) || defined(__APPLE__) || \ + defined(_AIX) || \ + defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \ + defined(__DragonFly__) typedef void (*sig_return)(int); /* Returns type from signal */ #else typedef void (*sig_return)(void); /* Returns type from signal */ diff --git a/include/my_alloc.h b/include/my_alloc.h index 659cc16ea1422..944dcb6e1bdc5 100644 --- a/include/my_alloc.h +++ b/include/my_alloc.h @@ -20,7 +20,7 @@ #ifndef _my_alloc_h #define _my_alloc_h -typedef unsigned int PSI_memory_key; +#include "mysql/psi/psi_base.h" #define ALLOC_MAX_BLOCK_TO_DROP 4096 #define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10 diff --git a/include/my_alloca.h b/include/my_alloca.h new file mode 100644 index 0000000000000..85fa64e9558a3 --- /dev/null +++ b/include/my_alloca.h @@ -0,0 +1,47 @@ +/* Copyright (c) 2023, 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 02110-1335 USA */ + +#ifndef MY_ALLOCA_INCLUDED +#define MY_ALLOCA_INCLUDED + +#ifdef _WIN32 +#include /*for alloca*/ +/* + MSVC may define "alloca" when compiling in /Ze mode + (with extensions from Microsoft), but otherwise only + the _alloca function is defined: +*/ +#ifndef alloca +#define alloca _alloca +#endif +#else +#ifdef HAVE_ALLOCA_H +#include +#endif +#endif + +#if defined(_AIX) && !defined(__GNUC__) && !defined(_AIX43) +#pragma alloca +#endif /* _AIX */ + +/* + If the GCC/LLVM compiler from the MinGW is used, + alloca may not be defined when using the MSVC CRT: +*/ +#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && !defined(alloca) +#define alloca __builtin_alloca +#endif /* GNUC */ + +#endif /* MY_ALLOCA_INCLUDED */ diff --git a/include/my_atomic.h b/include/my_atomic.h index 81da9e35cf992..270134a6caf8c 100644 --- a/include/my_atomic.h +++ b/include/my_atomic.h @@ -2,7 +2,7 @@ #define MY_ATOMIC_INCLUDED /* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2018, 2020, MariaDB + Copyright (c) 2018, 2022, 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 @@ -115,22 +115,6 @@ #include "atomic/gcc_builtins.h" #endif -#if SIZEOF_LONG == 4 -#define my_atomic_addlong(A,B) my_atomic_add32((int32*) (A), (B)) -#define my_atomic_loadlong(A) my_atomic_load32((int32*) (A)) -#define my_atomic_loadlong_explicit(A,O) my_atomic_load32_explicit((int32*) (A), (O)) -#define my_atomic_storelong(A,B) my_atomic_store32((int32*) (A), (B)) -#define my_atomic_faslong(A,B) my_atomic_fas32((int32*) (A), (B)) -#define my_atomic_caslong(A,B,C) my_atomic_cas32((int32*) (A), (int32*) (B), (C)) -#else -#define my_atomic_addlong(A,B) my_atomic_add64((int64*) (A), (B)) -#define my_atomic_loadlong(A) my_atomic_load64((int64*) (A)) -#define my_atomic_loadlong_explicit(A,O) my_atomic_load64_explicit((int64*) (A), (O)) -#define my_atomic_storelong(A,B) my_atomic_store64((int64*) (A), (B)) -#define my_atomic_faslong(A,B) my_atomic_fas64((int64*) (A), (B)) -#define my_atomic_caslong(A,B,C) my_atomic_cas64((int64*) (A), (int64*) (B), (C)) -#endif - #ifndef MY_MEMORY_ORDER_SEQ_CST #define MY_MEMORY_ORDER_RELAXED #define MY_MEMORY_ORDER_CONSUME diff --git a/include/my_atomic_wrapper.h b/include/my_atomic_wrapper.h index e45aba9d22b7c..7b35b14d3b79a 100644 --- a/include/my_atomic_wrapper.h +++ b/include/my_atomic_wrapper.h @@ -39,7 +39,7 @@ template class Atomic_relaxed Atomic_relaxed(const Atomic_relaxed &rhs) { m.store(rhs, std::memory_order_relaxed); } Atomic_relaxed(Type val) : m(val) {} - Atomic_relaxed() {} + Atomic_relaxed() = default; Type load(std::memory_order o= std::memory_order_relaxed) const { return m.load(o); } diff --git a/include/my_base.h b/include/my_base.h index 80ee527ccf007..026e4bf347b55 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -130,7 +130,7 @@ enum ha_extra_function { HA_EXTRA_NO_USER_CHANGE=9, /* No user is allowed to write */ HA_EXTRA_KEY_CACHE=10, HA_EXTRA_NO_KEY_CACHE=11, - HA_EXTRA_WAIT_LOCK=12, /* Wait until file is avalably (def) */ + HA_EXTRA_WAIT_LOCK=12, /* Wait until file is available (def) */ HA_EXTRA_NO_WAIT_LOCK=13, /* If file is locked, return quickly */ HA_EXTRA_WRITE_CACHE=14, /* Use write cache in ha_write() */ HA_EXTRA_FLUSH_CACHE=15, /* flush write_record_cache */ @@ -278,8 +278,8 @@ enum ha_base_keytype { #define HA_GENERATED_KEY 8192U /* Automatically generated key */ /* The combination of the above can be used for key type comparison. */ -#define HA_KEYFLAG_MASK (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | \ - HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \ +#define HA_KEYFLAG_MASK (HA_NOSAME | HA_AUTO_KEY | \ + HA_FULLTEXT | HA_UNIQUE_CHECK | \ HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY) /* @@ -293,7 +293,7 @@ enum ha_base_keytype { This flag can be calculated -- it's based on key lengths comparison. */ #define HA_KEY_HAS_PART_KEY_SEG 65536 -/* Internal Flag Can be calcaluted */ +/* Internal Flag Can be calculated */ #define HA_INVISIBLE_KEY 2<<18 /* Automatic bits in key-flag */ @@ -440,9 +440,9 @@ enum ha_base_keytype { #define HA_ERR_FIRST 120 /* Copy of first error nr.*/ #define HA_ERR_KEY_NOT_FOUND 120 /* Didn't find key on read or update */ -#define HA_ERR_FOUND_DUPP_KEY 121 /* Dupplicate key on write */ +#define HA_ERR_FOUND_DUPP_KEY 121 /* Duplicate key on write */ #define HA_ERR_INTERNAL_ERROR 122 /* Internal error */ -#define HA_ERR_RECORD_CHANGED 123 /* Uppdate with is recoverable */ +#define HA_ERR_RECORD_CHANGED 123 /* Update with is recoverable */ #define HA_ERR_WRONG_INDEX 124 /* Wrong index given to function */ #define HA_ERR_CRASHED 126 /* Indexfile is crashed */ #define HA_ERR_WRONG_IN_RECORD 127 /* Record-file is crashed */ @@ -458,7 +458,7 @@ enum ha_base_keytype { #define HA_ERR_UNSUPPORTED 138 /* unsupported extension used */ #define HA_ERR_TO_BIG_ROW 139 /* Too big row */ #define HA_WRONG_CREATE_OPTION 140 /* Wrong create option */ -#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Dupplicate unique on write */ +#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Duplicate unique on write */ #define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */ #define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting tables in MERGE */ #define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */ @@ -502,7 +502,7 @@ enum ha_base_keytype { illegal data being read */ #define HA_ERR_NEW_FILE 172 /* New file format */ #define HA_ERR_ROWS_EVENT_APPLY 173 /* The event could not be processed - no other hanlder error happened */ + no other handler error happened */ #define HA_ERR_INITIALIZATION 174 /* Error during initialization */ #define HA_ERR_FILE_TOO_SHORT 175 /* File too short */ #define HA_ERR_WRONG_CRC 176 /* Wrong CRC on page */ @@ -528,7 +528,8 @@ enum ha_base_keytype { #define HA_ERR_SEQUENCE_INVALID_DATA 195 #define HA_ERR_SEQUENCE_RUN_OUT 196 #define HA_ERR_COMMIT_ERROR 197 -#define HA_ERR_LAST 197 /* Copy of last error nr * */ +#define HA_ERR_PARTITION_LIST 198 +#define HA_ERR_LAST 198 /* Copy of last error nr * */ /* Number of different errors */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) diff --git a/include/my_compare.h b/include/my_compare.h index f936bbe6b0c93..c2cb9ae46b92e 100644 --- a/include/my_compare.h +++ b/include/my_compare.h @@ -132,7 +132,7 @@ extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, const uchar *a); 0=CHECK_NEG - The filter is not satisfied. The engine should discard this index tuple and continue the scan. - 1=CHECK_POS - The filter is statisfied. Current index tuple should be + 1=CHECK_POS - The filter is satisfied. Current index tuple should be returned to the SQL layer. 2=CHECK_OUT_OF_RANGE - the index tuple is outside of the range that we're scanning. (Example: if we're scanning "t.key BETWEEN 10 AND diff --git a/include/my_compiler.h b/include/my_compiler.h index d35a9104c50cf..ff049f3d8a6c1 100644 --- a/include/my_compiler.h +++ b/include/my_compiler.h @@ -2,7 +2,7 @@ #define MY_COMPILER_INCLUDED /* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2017, 2020, MariaDB Corporation. + Copyright (c) 2017, 2022, 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 @@ -39,15 +39,8 @@ /* GNU C/C++ */ #if defined __GNUC__ -/* Convenience macro to test the minimum required GCC version. */ -# define MY_GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -/* Any after 2.95... */ # define MY_ALIGN_EXT -/* Comunicate to the compiler the unreachability of the code. */ -# if MY_GNUC_PREREQ(4,5) -# define MY_ASSERT_UNREACHABLE() __builtin_unreachable() -# endif +# define MY_ASSERT_UNREACHABLE() __builtin_unreachable() /* Microsoft Visual C++ */ #elif defined _MSC_VER @@ -84,10 +77,6 @@ Generic (compiler-independent) features. */ -#ifndef MY_GNUC_PREREQ -# define MY_GNUC_PREREQ(maj, min) (0) -#endif - #ifndef MY_ALIGNOF # ifdef __cplusplus template struct my_alignof_helper { char m1; type m2; }; @@ -158,7 +147,6 @@ struct my_aligned_storage #ifdef __GNUC__ # define ATTRIBUTE_NORETURN __attribute__((noreturn)) # define ATTRIBUTE_NOINLINE __attribute__((noinline)) -# if MY_GNUC_PREREQ(4,3) /** Starting with GCC 4.3, the "cold" attribute is used to inform the compiler that a function is unlikely executed. The function is optimized for size rather than speed and on many targets it is placed @@ -167,8 +155,7 @@ appears close together improving code locality of non-cold parts of program. The paths leading to call of cold functions within code are marked as unlikely by the branch prediction mechanism. optimize a rarely invoked function for size instead for speed. */ -# define ATTRIBUTE_COLD __attribute__((cold)) -# endif +# define ATTRIBUTE_COLD __attribute__((cold)) #elif defined _MSC_VER # define ATTRIBUTE_NORETURN __declspec(noreturn) # define ATTRIBUTE_NOINLINE __declspec(noinline) diff --git a/include/my_counter.h b/include/my_counter.h index c5cbe296df034..f85b8e80bd7c9 100644 --- a/include/my_counter.h +++ b/include/my_counter.h @@ -31,7 +31,7 @@ template class Atomic_counter Atomic_counter(const Atomic_counter &rhs) { m_counter.store(rhs, std::memory_order_relaxed); } Atomic_counter(Type val): m_counter(val) {} - Atomic_counter() {} + Atomic_counter() = default; Type operator++(int) { return add(1); } Type operator--(int) { return sub(1); } diff --git a/include/my_dbug.h b/include/my_dbug.h index eb4536559f1ce..02caadbff4817 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -77,6 +77,9 @@ extern int (*dbug_sanity)(void); _db_stack_frame_.line= 0; \ } while(0) +#define DBUG_PRINT(keyword,arglist) \ + do if (_db_pargs_(__LINE__,keyword)) _db_doprnt_ arglist; while(0) + #ifdef HAVE_ATTRIBUTE_CLEANUP #define DBUG_ENTER(a) struct _db_stack_frame_ _db_stack_frame_ __attribute__((cleanup(_db_return_))); \ _db_enter_ (a,__FILE__,__LINE__,&_db_stack_frame_) @@ -94,15 +97,15 @@ extern int (*dbug_sanity)(void); #define DBUG_ENTER(a) #define DBUG_RETURN(a1) return(a1) #define DBUG_VOID_RETURN return +#define DBUG_PRINT(keyword,arglist) do{} while(0) #endif #define DBUG_EXECUTE(keyword,a1) \ do {if (_db_keyword_(0, (keyword), 0)) { a1 }} while(0) #define DBUG_EXECUTE_IF(keyword,a1) \ do {if (_db_keyword_(0, (keyword), 1)) { a1 }} while(0) + #define DBUG_IF(keyword) _db_keyword_(0, (keyword), 1) -#define DBUG_PRINT(keyword,arglist) \ - do if (_db_pargs_(__LINE__,keyword)) _db_doprnt_ arglist; while(0) #define DBUG_PUSH_EMPTY if (_dbug_on_) { DBUG_PUSH(""); } #define DBUG_POP_EMPTY if (_dbug_on_) { DBUG_POP(); } @@ -167,6 +170,7 @@ extern void _db_suicide_(void); #define DBUG_LEAVE #define DBUG_RETURN(a1) do { return(a1); } while(0) #define DBUG_VOID_RETURN do { return; } while(0) +#define DBUG_PRINT(keyword, arglist) do { } while(0) #define DBUG_EXECUTE(keyword,a1) do { } while(0) #define DBUG_EXECUTE_IF(keyword,a1) do { } while(0) #define DBUG_IF(keyword) 0 diff --git a/include/my_decimal_limits.h b/include/my_decimal_limits.h index ac1df83bb62ba..5bfd54d6748fb 100644 --- a/include/my_decimal_limits.h +++ b/include/my_decimal_limits.h @@ -32,7 +32,7 @@ digits in one our big digit decreased by 1 (because we always put decimal point on the border of our big digits)) - With normal precession we can handle 65 digits. MariaDB can store in + With normal precision we can handle 65 digits. MariaDB can store in the .frm up to 63 digits. By default we use DECIMAL_NOT_SPECIFIED digits when converting strings to decimal, so we don't want to set this too high. To not use up all digits for the scale we limit the number of decimals to diff --git a/include/my_dir.h b/include/my_dir.h index 12cf5db149d6c..ecd37b2925b30 100644 --- a/include/my_dir.h +++ b/include/my_dir.h @@ -70,7 +70,7 @@ typedef struct my_stat dev_t st_rdev; /* more major & minor device numbers (???) */ off_t st_size; /* size of file */ time_t st_atime; /* time for last read */ - time_t st_mtime; /* time for last contens modify */ + time_t st_mtime; /* time for last contents modify */ time_t st_ctime; /* time for last inode or contents modify */ } MY_STAT; diff --git a/include/my_global.h b/include/my_global.h index ed213e69f859f..962f739600853 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1,6 +1,6 @@ /* Copyright (c) 2001, 2013, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB Corporation. + Copyright (c) 2009, 2022, 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 @@ -29,7 +29,7 @@ #pragma GCC poison __WIN__ #endif -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(__clang__) /* Following functions have bugs, when used with UTF-8 active codepage. #include will use the non-buggy wrappers @@ -330,13 +330,6 @@ C_MODE_END #ifdef HAVE_UNISTD_H #include #endif -#if defined(__cplusplus) && defined(NO_CPLUSPLUS_ALLOCA) -#undef HAVE_ALLOCA -#undef HAVE_ALLOCA_H -#endif -#ifdef HAVE_ALLOCA_H -#include -#endif #include /* Recommended by debian */ /* We need the following to go around a problem with openssl on solaris */ @@ -493,6 +486,7 @@ typedef unsigned short ushort; #endif #include +#include /* Wen using the embedded library, users might run into link problems, @@ -642,7 +636,7 @@ typedef SOCKET_SIZE_TYPE size_socket; the mismatch of CRT and mysys file IO usage on Windows at runtime. CRT file descriptors can be in the range 0-2047, whereas descriptors returned by my_open() will start with 2048. If a file descriptor with value less then - MY_FILE_MIN is passed to mysys IO function, chances are it stemms from + MY_FILE_MIN is passed to mysys IO function, chances are it stems from open()/fileno() and not my_open()/my_fileno. For Posix, mysys functions are light wrappers around libc, and MY_FILE_MIN @@ -865,7 +859,7 @@ typedef long long my_ptrdiff_t; #define STDCALL #endif -/* Typdefs for easyier portability */ +/* Typdefs for easier portability */ #ifndef HAVE_UCHAR typedef unsigned char uchar; /* Short for unsigned char */ @@ -1061,10 +1055,12 @@ typedef ulong myf; /* Type of MyFlags in my_funcs */ static inline char *dlerror(void) { static char win_errormsg[2048]; - FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_IGNORE_INSERTS - | FORMAT_MESSAGE_MAX_WIDTH_MASK, - 0, GetLastError(), 0, win_errormsg, 2048, NULL); + FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS | + FORMAT_MESSAGE_MAX_WIDTH_MASK, + 0, GetLastError(), + MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), + win_errormsg, 2048, NULL); return win_errormsg; } #define HAVE_DLOPEN 1 diff --git a/include/my_handler_errors.h b/include/my_handler_errors.h index 69b1566557da9..96632629775d8 100644 --- a/include/my_handler_errors.h +++ b/include/my_handler_errors.h @@ -108,7 +108,8 @@ static const char *handler_error_messages[]= "Tablespace is missing for a table", "Sequence has been run out", "Sequence values are conflicting", - "Error during commit" + "Error during commit", + "Cannot select partitions" }; #endif /* MYSYS_MY_HANDLER_ERRORS_INCLUDED */ diff --git a/include/my_pthread.h b/include/my_pthread.h index c81f3ec7d405c..3e68538b42423 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -436,6 +436,7 @@ void safe_mutex_free_deadlock_data(safe_mutex_t *mp); #define my_cond_wait(A,B) safe_cond_wait((A), (B), __FILE__, __LINE__) #else +#define safe_mutex_is_owner(mp) (1) #define safe_mutex_assert_owner(mp) do {} while (0) #define safe_mutex_assert_not_owner(mp) do {} while (0) #define safe_mutex_setflags(mp, F) do {} while (0) diff --git a/include/my_rdtsc.h b/include/my_rdtsc.h index fb0ef0ef5b903..b2d30fa3151c5 100644 --- a/include/my_rdtsc.h +++ b/include/my_rdtsc.h @@ -90,7 +90,7 @@ C_MODE_START how to ensure that it can be accessed. On AARCH64, we use the generic timer base register. We override clang implementation for aarch64 as it access a PMU register which is not - guarenteed to be active. + guaranteed to be active. On RISC-V, we use the rdcycle instruction to read from mcycle register. Sadly, we have nothing for the Digital Alpha, MIPS, Motorola m68k, diff --git a/include/my_service_manager.h b/include/my_service_manager.h index 3eff1253f20e9..498fc762048e4 100644 --- a/include/my_service_manager.h +++ b/include/my_service_manager.h @@ -43,7 +43,12 @@ #define SD_LISTEN_FDS_START (0) #define sd_notify(X, Y) #define sd_notifyf(E, F, ...) -#define service_manager_extend_timeout(I, FMTSTR, ...) +#ifdef _WIN32 + #define service_manager_extend_timeout(I, F, ...) \ + mysqld_win_extend_service_timeout(I) +#else + #define service_manager_extend_timeout(I, FMTSTR, ...) +#endif #endif #endif /* MY_SERVICE_MANAGER_INCLUDED */ diff --git a/include/my_sys.h b/include/my_sys.h index 58d036c6fc378..cac9f4ad889e6 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2021, MariaDB Corporation. + Copyright (c) 2010, 2022, 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 @@ -28,9 +28,7 @@ C_MODE_START #include /* for CHARSET_INFO */ #include #include -#ifdef _WIN32 -#include /*for alloca*/ -#endif +#include #include #include @@ -195,16 +193,6 @@ my_bool my_test_if_thinly_provisioned(File handle); extern my_bool my_may_have_atomic_write; #if defined(HAVE_ALLOCA) && !defined(HAVE_valgrind) -#if defined(_AIX) && !defined(__GNUC__) && !defined(_AIX43) -#pragma alloca -#endif /* _AIX */ -#if defined(__MWERKS__) -#undef alloca -#define alloca _alloca -#endif /* __MWERKS__ */ -#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && ! defined(alloca) -#define alloca __builtin_alloca -#endif /* GNUC */ #define my_alloca(SZ) alloca((size_t) (SZ)) #define my_afree(PTR) ((void)0) #define MAX_ALLOCA_SZ 4096 @@ -277,7 +265,7 @@ extern int my_umask_dir, extern SECURITY_ATTRIBUTES my_dir_security_attributes; LPSECURITY_ATTRIBUTES my_win_file_secattr(); #endif -extern my_bool my_use_symdir; +extern MYSQL_PLUGIN_IMPORT my_bool my_use_symdir; extern ulong my_default_record_cache_size; extern MYSQL_PLUGIN_IMPORT my_bool my_disable_locking; @@ -438,7 +426,7 @@ typedef struct st_io_cache /* Used when caching files */ /* A caller will use my_b_read() macro to read from the cache if the data is already in cache, it will be simply copied with - memcpy() and internal variables will be accordinging updated with + memcpy() and internal variables will be accordingly updated with no functions invoked. However, if the data is not fully in the cache, my_b_read() will call read_function to fetch the data. read_function must never be invoked directly. @@ -482,7 +470,7 @@ typedef struct st_io_cache /* Used when caching files */ myf myflags; /* Flags used to my_read/my_write */ /* alloced_buffer is set to the size of the buffer allocated for the IO_CACHE. - Includes the overhead(storing key to ecnrypt and decrypt) for encryption. + Includes the overhead(storing key to encrypt and decrypt) for encryption. Set to 0 if nothing is allocated. Currently READ_NET is the only one that will use a buffer allocated somewhere else @@ -958,6 +946,17 @@ extern ulonglong my_getcputime(void); #define hrtime_sec_part(X) ((ulong)((X).val % HRTIME_RESOLUTION)) #define my_time(X) hrtime_to_time(my_hrtime_coarse()) +/** + Make high resolution time from two parts. +*/ + +static inline my_hrtime_t make_hr_time(my_time_t time, ulong time_sec_part) +{ + my_hrtime_t res= {((ulonglong) time)*1000000 + time_sec_part}; + return res; +} + + #if STACK_DIRECTION < 0 #define available_stack_size(CUR,END) (long) ((char*)(CUR) - (char*)(END)) #else @@ -987,7 +986,7 @@ extern ulonglong my_getcputime(void); #define my_munmap(a,b) munmap((a),(b)) #else -/* not a complete set of mmap() flags, but only those that nesessary */ +/* not a complete set of mmap() flags, but only those that necessary */ #define PROT_READ 1 #define PROT_WRITE 2 #define MAP_NORESERVE 0 diff --git a/include/my_time.h b/include/my_time.h index b7b54db558646..9f3e61b944fdb 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -244,9 +244,12 @@ static inline void my_time_trunc(MYSQL_TIME *ltime, uint decimals) !ltime->hour && !ltime->minute && !ltime->second) ltime->neg= FALSE; } +#ifdef _WIN32 +#define suseconds_t long +#endif static inline void my_timeval_trunc(struct timeval *tv, uint decimals) { - tv->tv_usec-= my_time_fraction_remainder(tv->tv_usec, decimals); + tv->tv_usec-= (suseconds_t) my_time_fraction_remainder(tv->tv_usec, decimals); } diff --git a/include/my_valgrind.h b/include/my_valgrind.h index 260521d4d4b9a..dfe2c3db7b38b 100644 --- a/include/my_valgrind.h +++ b/include/my_valgrind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010, 2020, MariaDB Corporation. +/* Copyright (C) 2010, 2022, 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 @@ -37,6 +37,11 @@ # define MEM_GET_VBITS(a,b,len) __msan_copy_shadow(b,a,len) # define MEM_SET_VBITS(a,b,len) __msan_copy_shadow(a,b,len) # define REDZONE_SIZE 8 +# ifdef __linux__ +# define MSAN_STAT_WORKAROUND(st) MEM_MAKE_DEFINED(st, sizeof(*st)) +# else +# define MSAN_STAT_WORKAROUND(st) ((void) 0) +# endif #elif defined(HAVE_VALGRIND_MEMCHECK_H) && defined(HAVE_valgrind) # include # define HAVE_MEM_CHECK @@ -49,6 +54,7 @@ # define MEM_GET_VBITS(a,b,len) VALGRIND_GET_VBITS(a,b,len) # define MEM_SET_VBITS(a,b,len) VALGRIND_SET_VBITS(a,b,len) # define REDZONE_SIZE 8 +# define MSAN_STAT_WORKAROUND(st) ((void) 0) #elif defined(__SANITIZE_ADDRESS__) && (!defined(_MSC_VER) || defined (__clang__)) # include /* How to do manual poisoning: @@ -62,6 +68,7 @@ # define MEM_CHECK_DEFINED(a,len) ((void) 0) # define MEM_GET_VBITS(a,b,len) ((void) 0) # define MEM_SET_VBITS(a,b,len) ((void) 0) +# define MSAN_STAT_WORKAROUND(st) ((void) 0) # define REDZONE_SIZE 8 #else # define MEM_UNDEFINED(a,len) ((void) 0) @@ -73,14 +80,9 @@ # define MEM_GET_VBITS(a,b,len) ((void) 0) # define MEM_SET_VBITS(a,b,len) ((void) 0) # define REDZONE_SIZE 0 +# define MSAN_STAT_WORKAROUND(st) ((void) 0) #endif /* __has_feature(memory_sanitizer) */ -#ifdef HAVE_valgrind -#define IF_VALGRIND(A,B) A -#else -#define IF_VALGRIND(A,B) B -#endif - #ifdef TRASH_FREED_MEMORY /* _TRASH_FILL() has to call MEM_MAKE_ADDRESSABLE() to cancel any effect of diff --git a/include/myisam.h b/include/myisam.h index 0942584e87429..c90026bfc7a15 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ -/* This file should be included when using myisam_funktions */ +/* This file should be included when using myisam_functions */ #ifndef _myisam_h #define _myisam_h @@ -159,7 +159,7 @@ typedef struct st_mi_create_info my_bool with_auto_increment; } MI_CREATE_INFO; -struct st_myisam_info; /* For referense */ +struct st_myisam_info; /* For reference */ struct st_mi_isam_share; typedef struct st_myisam_info MI_INFO; struct st_mi_s_param; diff --git a/include/myisammrg.h b/include/myisammrg.h index 78e7ac00e8fd2..1d7efbe74d6ba 100644 --- a/include/myisammrg.h +++ b/include/myisammrg.h @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ -/* This file should be included when using merge_isam_funktions */ +/* This file should be included when using merge_isam_functions */ #ifndef _myisammrg_h #define _myisammrg_h @@ -51,7 +51,7 @@ typedef struct st_mymerge_info /* Struct from h_info */ ulonglong data_file_length; ulonglong dupp_key_pos; /* Offset of the Duplicate key in the merge table */ uint reclength; /* Recordlength */ - int errkey; /* With key was dupplicated on err */ + int errkey; /* With key was duplicated on err */ uint options; /* HA_OPTION_... used */ ulong *rec_per_key; /* for sql optimizing */ } MYMERGE_INFO; diff --git a/include/mysql.h b/include/mysql.h index a42ae085e0cf0..a66dcc7bd0208 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -63,6 +63,7 @@ typedef int my_socket; #endif /* my_socket_defined */ #endif /* MY_GLOBAL_INCLUDED */ +#include "mariadb_capi_rename.h" #include "mysql_version.h" #include "mysql_com.h" #include "mysql_time.h" @@ -665,7 +666,7 @@ enum enum_mysql_stmt_state length - On input: in case when lengths of input values are different for each execute, you can set this to - point at a variable containining value length. This + point at a variable containing value length. This way the value length can be different in each execute. If length is not NULL, buffer_length is not used. Note, length can even point at buffer_length if diff --git a/include/mysql.h.pp b/include/mysql.h.pp deleted file mode 100644 index 7ae47ac836e10..0000000000000 --- a/include/mysql.h.pp +++ /dev/null @@ -1,793 +0,0 @@ -extern "C" { -typedef char my_bool; -typedef int my_socket; -enum enum_server_command -{ - COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST, - COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS, - COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING, - COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP, - COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE, - COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE, - COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON, - COM_UNIMPLEMENTED, - COM_RESET_CONNECTION, - COM_MDB_GAP_BEG, - COM_MDB_GAP_END=249, - COM_STMT_BULK_EXECUTE=250, - COM_SLAVE_WORKER=251, - COM_SLAVE_IO=252, - COM_SLAVE_SQL=253, - COM_RESERVED_1=254, - COM_END=255 -}; -enum enum_indicator_type -{ - STMT_INDICATOR_NONE= 0, - STMT_INDICATOR_NULL, - STMT_INDICATOR_DEFAULT, - STMT_INDICATOR_IGNORE -}; -enum mariadb_field_attr_t -{ - MARIADB_FIELD_ATTR_DATA_TYPE_NAME= 0, - MARIADB_FIELD_ATTR_FORMAT_NAME= 1 -}; -struct st_vio; -typedef struct st_vio Vio; -typedef struct st_net { - Vio *vio; - unsigned char *buff,*buff_end,*write_pos,*read_pos; - my_socket fd; - unsigned long remain_in_buf,length, buf_length, where_b; - unsigned long max_packet,max_packet_size; - unsigned int pkt_nr,compress_pkt_nr; - unsigned int write_timeout, read_timeout, retry_count; - int fcntl; - unsigned int *return_status; - unsigned char reading_or_writing; - char save_char; - char net_skip_rest_factor; - my_bool thread_specific_malloc; - unsigned char compress; - my_bool unused3; - void *thd; - unsigned int last_errno; - unsigned char error; - my_bool unused4; - my_bool unused5; - char last_error[512]; - char sqlstate[5 +1]; - void *extension; -} NET; -enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, - MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG, - MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE, - MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP, - MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24, - MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, - MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR, - MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR, - MYSQL_TYPE_BIT, - MYSQL_TYPE_TIMESTAMP2, - MYSQL_TYPE_DATETIME2, - MYSQL_TYPE_TIME2, - MYSQL_TYPE_BLOB_COMPRESSED= 140, - MYSQL_TYPE_VARCHAR_COMPRESSED= 141, - MYSQL_TYPE_NEWDECIMAL=246, - MYSQL_TYPE_ENUM=247, - MYSQL_TYPE_SET=248, - MYSQL_TYPE_TINY_BLOB=249, - MYSQL_TYPE_MEDIUM_BLOB=250, - MYSQL_TYPE_LONG_BLOB=251, - MYSQL_TYPE_BLOB=252, - MYSQL_TYPE_VAR_STRING=253, - MYSQL_TYPE_STRING=254, - MYSQL_TYPE_GEOMETRY=255 -}; -enum mysql_enum_shutdown_level { - SHUTDOWN_DEFAULT = 0, - SHUTDOWN_WAIT_CONNECTIONS= (unsigned char)(1 << 0), - SHUTDOWN_WAIT_TRANSACTIONS= (unsigned char)(1 << 1), - SHUTDOWN_WAIT_UPDATES= (unsigned char)(1 << 3), - SHUTDOWN_WAIT_ALL_BUFFERS= ((unsigned char)(1 << 3) << 1), - SHUTDOWN_WAIT_CRITICAL_BUFFERS= ((unsigned char)(1 << 3) << 1) + 1 -}; -enum enum_cursor_type -{ - CURSOR_TYPE_NO_CURSOR= 0, - CURSOR_TYPE_READ_ONLY= 1, - CURSOR_TYPE_FOR_UPDATE= 2, - CURSOR_TYPE_SCROLLABLE= 4 -}; -enum enum_mysql_set_option -{ - MYSQL_OPTION_MULTI_STATEMENTS_ON, - MYSQL_OPTION_MULTI_STATEMENTS_OFF -}; -enum enum_session_state_type -{ - SESSION_TRACK_SYSTEM_VARIABLES, - SESSION_TRACK_SCHEMA, - SESSION_TRACK_STATE_CHANGE, - SESSION_TRACK_GTIDS, - SESSION_TRACK_TRANSACTION_CHARACTERISTICS, - SESSION_TRACK_TRANSACTION_STATE, - SESSION_TRACK_always_at_the_end -}; -extern "C" { -my_bool my_net_init(NET *net, Vio* vio, void *thd, unsigned int my_flags); -void my_net_local_init(NET *net); -void net_end(NET *net); -void net_clear(NET *net, my_bool clear_buffer); -my_bool net_realloc(NET *net, size_t length); -my_bool net_flush(NET *net); -my_bool my_net_write(NET *net,const unsigned char *packet, size_t len); -my_bool net_write_command(NET *net,unsigned char command, - const unsigned char *header, size_t head_len, - const unsigned char *packet, size_t len); -int net_real_write(NET *net,const unsigned char *packet, size_t len); -unsigned long my_net_read_packet(NET *net, my_bool read_from_server); -unsigned long my_net_read_packet_reallen(NET *net, my_bool read_from_server, - unsigned long* reallen); -struct sockaddr; -int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen, - unsigned int timeout); -struct my_rnd_struct; -} -enum Item_result -{ - STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, DECIMAL_RESULT, - TIME_RESULT -}; -typedef struct st_udf_args -{ - unsigned int arg_count; - enum Item_result *arg_type; - char **args; - unsigned long *lengths; - char *maybe_null; - const char **attributes; - unsigned long *attribute_lengths; - void *extension; -} UDF_ARGS; -typedef struct st_udf_init -{ - my_bool maybe_null; - unsigned int decimals; - unsigned long max_length; - char *ptr; - my_bool const_item; - void *extension; -} UDF_INIT; -extern "C" { -void create_random_string(char *to, unsigned int length, - struct my_rnd_struct *rand_st); -void hash_password(unsigned long *to, const char *password, unsigned int password_len); -void make_scrambled_password_323(char *to, const char *password); -void scramble_323(char *to, const char *message, const char *password); -my_bool check_scramble_323(const unsigned char *reply, const char *message, - unsigned long *salt); -void get_salt_from_password_323(unsigned long *res, const char *password); -void make_scrambled_password(char *to, const char *password); -void scramble(char *to, const char *message, const char *password); -my_bool check_scramble(const unsigned char *reply, const char *message, - const unsigned char *hash_stage2); -void get_salt_from_password(unsigned char *res, const char *password); -char *octet2hex(char *to, const char *str, size_t len); -char *get_tty_password(const char *opt_message); -void get_tty_password_buff(const char *opt_message, char *to, size_t length); -const char *mysql_errno_to_sqlstate(unsigned int mysql_errno); -my_bool my_thread_init(void); -void my_thread_end(void); -} -typedef long my_time_t; -enum enum_mysql_timestamp_type -{ - MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1, - MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2 -}; -typedef struct st_mysql_time -{ - unsigned int year, month, day, hour, minute, second; - unsigned long second_part; - my_bool neg; - enum enum_mysql_timestamp_type time_type; -} MYSQL_TIME; -extern "C" { -typedef struct st_list { - struct st_list *prev,*next; - void *data; -} LIST; -typedef int (*list_walk_action)(void *,void *); -extern LIST *list_add(LIST *root,LIST *element); -extern LIST *list_delete(LIST *root,LIST *element); -extern LIST *list_cons(void *data,LIST *root); -extern LIST *list_reverse(LIST *root); -extern void list_free(LIST *root,unsigned int free_data); -extern unsigned int list_length(LIST *); -extern int list_walk(LIST *,list_walk_action action,unsigned char * argument); -} -extern unsigned int mariadb_deinitialize_ssl; -extern unsigned int mysql_port; -extern char *mysql_unix_port; -typedef struct st_mysql_const_lex_string MARIADB_CONST_STRING; -typedef struct st_mysql_field { - char *name; - char *org_name; - char *table; - char *org_table; - char *db; - char *catalog; - char *def; - unsigned long length; - unsigned long max_length; - unsigned int name_length; - unsigned int org_name_length; - unsigned int table_length; - unsigned int org_table_length; - unsigned int db_length; - unsigned int catalog_length; - unsigned int def_length; - unsigned int flags; - unsigned int decimals; - unsigned int charsetnr; - enum enum_field_types type; - void *extension; -} MYSQL_FIELD; -typedef char **MYSQL_ROW; -typedef unsigned int MYSQL_FIELD_OFFSET; -typedef unsigned long long my_ulonglong; -typedef unsigned int PSI_memory_key; -extern "C" { -typedef struct st_used_mem -{ - struct st_used_mem *next; - size_t left; - size_t size; -} USED_MEM; -typedef struct st_mem_root -{ - USED_MEM *free; - USED_MEM *used; - USED_MEM *pre_alloc; - size_t min_malloc; - size_t block_size; - unsigned int block_num; - unsigned short first_block_usage; - unsigned short flags; - void (*error_handler)(void); - PSI_memory_key psi_key; -} MEM_ROOT; -} -typedef struct st_typelib { - unsigned int count; - const char *name; - const char **type_names; - unsigned int *type_lengths; -} TYPELIB; -extern my_ulonglong find_typeset(const char *x, TYPELIB *typelib, - int *error_position); -extern int find_type_with_warning(const char *x, TYPELIB *typelib, - const char *option); -extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags); -extern void make_type(char *to,unsigned int nr,TYPELIB *typelib); -extern const char *get_type(TYPELIB *typelib,unsigned int nr); -extern TYPELIB *copy_typelib(MEM_ROOT *root, const TYPELIB *from); -extern TYPELIB sql_protocol_typelib; -my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name, - my_ulonglong cur_set, my_ulonglong default_set, - const char *str, unsigned int length, - char **err_pos, unsigned int *err_len); -typedef struct st_mysql_rows { - struct st_mysql_rows *next; - MYSQL_ROW data; - unsigned long length; -} MYSQL_ROWS; -typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; -typedef struct embedded_query_result EMBEDDED_QUERY_RESULT; -typedef struct st_mysql_data { - MYSQL_ROWS *data; - struct embedded_query_result *embedded_info; - MEM_ROOT alloc; - my_ulonglong rows; - unsigned int fields; - void *extension; -} MYSQL_DATA; -enum mysql_option -{ - MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, - MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, - MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE, - MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT, - MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT, - MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION, - MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH, - MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT, - MYSQL_OPT_SSL_VERIFY_SERVER_CERT, MYSQL_PLUGIN_DIR, MYSQL_DEFAULT_AUTH, - MYSQL_OPT_BIND, - MYSQL_OPT_SSL_KEY, MYSQL_OPT_SSL_CERT, - MYSQL_OPT_SSL_CA, MYSQL_OPT_SSL_CAPATH, MYSQL_OPT_SSL_CIPHER, - MYSQL_OPT_SSL_CRL, MYSQL_OPT_SSL_CRLPATH, - MYSQL_OPT_CONNECT_ATTR_RESET, MYSQL_OPT_CONNECT_ATTR_ADD, - MYSQL_OPT_CONNECT_ATTR_DELETE, - MYSQL_SERVER_PUBLIC_KEY, - MYSQL_ENABLE_CLEARTEXT_PLUGIN, - MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, - MYSQL_PROGRESS_CALLBACK=5999, - MYSQL_OPT_NONBLOCK, - MYSQL_OPT_USE_THREAD_SPECIFIC_MEMORY -}; -struct st_mysql_options_extention; -struct st_mysql_options { - unsigned int connect_timeout, read_timeout, write_timeout; - unsigned int port, protocol; - unsigned long client_flag; - char *host,*user,*password,*unix_socket,*db; - struct st_dynamic_array *init_commands; - char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name; - char *ssl_key; - char *ssl_cert; - char *ssl_ca; - char *ssl_capath; - char *ssl_cipher; - char *shared_memory_base_name; - unsigned long max_allowed_packet; - my_bool use_ssl; - my_bool compress,named_pipe; - my_bool use_thread_specific_memory; - my_bool unused2; - my_bool unused3; - my_bool unused4; - enum mysql_option methods_to_use; - char *client_ip; - my_bool secure_auth; - my_bool report_data_truncation; - int (*local_infile_init)(void **, const char *, void *); - int (*local_infile_read)(void *, char *, unsigned int); - void (*local_infile_end)(void *); - int (*local_infile_error)(void *, char *, unsigned int); - void *local_infile_userdata; - struct st_mysql_options_extention *extension; -}; -enum mysql_status -{ - MYSQL_STATUS_READY, MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT, - MYSQL_STATUS_STATEMENT_GET_RESULT -}; -enum mysql_protocol_type -{ - MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, - MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY -}; -typedef struct character_set -{ - unsigned int number; - unsigned int state; - const char *csname; - const char *name; - const char *comment; - const char *dir; - unsigned int mbminlen; - unsigned int mbmaxlen; -} MY_CHARSET_INFO; -struct st_mysql_methods; -struct st_mysql_stmt; -typedef struct st_mysql -{ - NET net; - unsigned char *connector_fd; - char *host,*user,*passwd,*unix_socket,*server_version,*host_info; - char *info, *db; - const struct charset_info_st *charset; - MYSQL_FIELD *fields; - MEM_ROOT field_alloc; - my_ulonglong affected_rows; - my_ulonglong insert_id; - my_ulonglong extra_info; - unsigned long thread_id; - unsigned long packet_length; - unsigned int port; - unsigned long client_flag,server_capabilities; - unsigned int protocol_version; - unsigned int field_count; - unsigned int server_status; - unsigned int server_language; - unsigned int warning_count; - struct st_mysql_options options; - enum mysql_status status; - my_bool free_me; - my_bool reconnect; - char scramble[20 +1]; - my_bool auto_local_infile; - void *unused2, *unused3, *unused4, *unused5; - LIST *stmts; - const struct st_mysql_methods *methods; - void *thd; - my_bool *unbuffered_fetch_owner; - char *info_buffer; - void *extension; -} MYSQL; -typedef struct st_mysql_res { - my_ulonglong row_count; - MYSQL_FIELD *fields; - MYSQL_DATA *data; - MYSQL_ROWS *data_cursor; - unsigned long *lengths; - MYSQL *handle; - const struct st_mysql_methods *methods; - MYSQL_ROW row; - MYSQL_ROW current_row; - MEM_ROOT field_alloc; - unsigned int field_count, current_field; - my_bool eof; - my_bool unbuffered_fetch_cancelled; - void *extension; -} MYSQL_RES; -typedef struct st_mysql_parameters -{ - unsigned long *p_max_allowed_packet; - unsigned long *p_net_buffer_length; - void *extension; -} MYSQL_PARAMETERS; -int mysql_server_init(int argc, char **argv, char **groups); -void mysql_server_end(void); -MYSQL_PARAMETERS * mysql_get_parameters(void); -my_bool mysql_thread_init(void); -void mysql_thread_end(void); -my_ulonglong mysql_num_rows(MYSQL_RES *res); -unsigned int mysql_num_fields(MYSQL_RES *res); -my_bool mysql_eof(MYSQL_RES *res); -MYSQL_FIELD * mysql_fetch_field_direct(MYSQL_RES *res, - unsigned int fieldnr); -MYSQL_FIELD * mysql_fetch_fields(MYSQL_RES *res); -MYSQL_ROW_OFFSET mysql_row_tell(MYSQL_RES *res); -MYSQL_FIELD_OFFSET mysql_field_tell(MYSQL_RES *res); -int mariadb_field_attr(MARIADB_CONST_STRING *attr, - const MYSQL_FIELD *field, - enum mariadb_field_attr_t type); -unsigned int mysql_field_count(MYSQL *mysql); -my_ulonglong mysql_affected_rows(MYSQL *mysql); -my_ulonglong mysql_insert_id(MYSQL *mysql); -unsigned int mysql_errno(MYSQL *mysql); -const char * mysql_error(MYSQL *mysql); -const char * mysql_sqlstate(MYSQL *mysql); -unsigned int mysql_warning_count(MYSQL *mysql); -const char * mysql_info(MYSQL *mysql); -unsigned long mysql_thread_id(MYSQL *mysql); -const char * mysql_character_set_name(MYSQL *mysql); -int mysql_set_character_set(MYSQL *mysql, const char *csname); -int mysql_set_character_set_start(int *ret, MYSQL *mysql, - const char *csname); -int mysql_set_character_set_cont(int *ret, MYSQL *mysql, - int status); -MYSQL * mysql_init(MYSQL *mysql); -my_bool mysql_ssl_set(MYSQL *mysql, const char *key, - const char *cert, const char *ca, - const char *capath, const char *cipher); -const char * mysql_get_ssl_cipher(MYSQL *mysql); -my_bool mysql_change_user(MYSQL *mysql, const char *user, - const char *passwd, const char *db); -int mysql_change_user_start(my_bool *ret, MYSQL *mysql, - const char *user, - const char *passwd, - const char *db); -int mysql_change_user_cont(my_bool *ret, MYSQL *mysql, - int status); -MYSQL * mysql_real_connect(MYSQL *mysql, const char *host, - const char *user, - const char *passwd, - const char *db, - unsigned int port, - const char *unix_socket, - unsigned long clientflag); -int mysql_real_connect_start(MYSQL **ret, MYSQL *mysql, - const char *host, - const char *user, - const char *passwd, - const char *db, - unsigned int port, - const char *unix_socket, - unsigned long clientflag); -int mysql_real_connect_cont(MYSQL **ret, MYSQL *mysql, - int status); -int mysql_select_db(MYSQL *mysql, const char *db); -int mysql_select_db_start(int *ret, MYSQL *mysql, - const char *db); -int mysql_select_db_cont(int *ret, MYSQL *mysql, - int status); -int mysql_query(MYSQL *mysql, const char *q); -int mysql_query_start(int *ret, MYSQL *mysql, - const char *q); -int mysql_query_cont(int *ret, MYSQL *mysql, - int status); -int mysql_send_query(MYSQL *mysql, const char *q, - unsigned long length); -int mysql_send_query_start(int *ret, MYSQL *mysql, - const char *q, - unsigned long length); -int mysql_send_query_cont(int *ret, MYSQL *mysql, - int status); -int mysql_real_query(MYSQL *mysql, const char *q, - unsigned long length); -int mysql_real_query_start(int *ret, MYSQL *mysql, - const char *q, - unsigned long length); -int mysql_real_query_cont(int *ret, MYSQL *mysql, - int status); -MYSQL_RES * mysql_store_result(MYSQL *mysql); -int mysql_store_result_start(MYSQL_RES **ret, MYSQL *mysql); -int mysql_store_result_cont(MYSQL_RES **ret, MYSQL *mysql, - int status); -MYSQL_RES * mysql_use_result(MYSQL *mysql); -void mysql_get_character_set_info(MYSQL *mysql, - MY_CHARSET_INFO *charset); -void -mysql_set_local_infile_handler(MYSQL *mysql, - int (*local_infile_init)(void **, const char *, - void *), - int (*local_infile_read)(void *, char *, - unsigned int), - void (*local_infile_end)(void *), - int (*local_infile_error)(void *, char*, - unsigned int), - void *); -void -mysql_set_local_infile_default(MYSQL *mysql); -int mysql_shutdown(MYSQL *mysql, - enum mysql_enum_shutdown_level - shutdown_level); -int mysql_shutdown_start(int *ret, MYSQL *mysql, - enum mysql_enum_shutdown_level - shutdown_level); -int mysql_shutdown_cont(int *ret, MYSQL *mysql, - int status); -int mysql_dump_debug_info(MYSQL *mysql); -int mysql_dump_debug_info_start(int *ret, MYSQL *mysql); -int mysql_dump_debug_info_cont(int *ret, MYSQL *mysql, - int status); -int mysql_refresh(MYSQL *mysql, - unsigned int refresh_options); -int mysql_refresh_start(int *ret, MYSQL *mysql, - unsigned int refresh_options); -int mysql_refresh_cont(int *ret, MYSQL *mysql, int status); -int mysql_kill(MYSQL *mysql,unsigned long pid); -int mysql_kill_start(int *ret, MYSQL *mysql, - unsigned long pid); -int mysql_kill_cont(int *ret, MYSQL *mysql, int status); -int mysql_set_server_option(MYSQL *mysql, - enum enum_mysql_set_option - option); -int mysql_set_server_option_start(int *ret, MYSQL *mysql, - enum enum_mysql_set_option - option); -int mysql_set_server_option_cont(int *ret, MYSQL *mysql, - int status); -int mysql_ping(MYSQL *mysql); -int mysql_ping_start(int *ret, MYSQL *mysql); -int mysql_ping_cont(int *ret, MYSQL *mysql, int status); -const char * mysql_stat(MYSQL *mysql); -int mysql_stat_start(const char **ret, MYSQL *mysql); -int mysql_stat_cont(const char **ret, MYSQL *mysql, - int status); -const char * mysql_get_server_info(MYSQL *mysql); -const char * mysql_get_server_name(MYSQL *mysql); -const char * mysql_get_client_info(void); -unsigned long mysql_get_client_version(void); -const char * mysql_get_host_info(MYSQL *mysql); -unsigned long mysql_get_server_version(MYSQL *mysql); -unsigned int mysql_get_proto_info(MYSQL *mysql); -MYSQL_RES * mysql_list_dbs(MYSQL *mysql,const char *wild); -int mysql_list_dbs_start(MYSQL_RES **ret, MYSQL *mysql, - const char *wild); -int mysql_list_dbs_cont(MYSQL_RES **ret, MYSQL *mysql, - int status); -MYSQL_RES * mysql_list_tables(MYSQL *mysql,const char *wild); -int mysql_list_tables_start(MYSQL_RES **ret, MYSQL *mysql, - const char *wild); -int mysql_list_tables_cont(MYSQL_RES **ret, MYSQL *mysql, - int status); -MYSQL_RES * mysql_list_processes(MYSQL *mysql); -int mysql_list_processes_start(MYSQL_RES **ret, - MYSQL *mysql); -int mysql_list_processes_cont(MYSQL_RES **ret, MYSQL *mysql, - int status); -int mysql_options(MYSQL *mysql,enum mysql_option option, - const void *arg); -int mysql_options4(MYSQL *mysql,enum mysql_option option, - const void *arg1, const void *arg2); -void mysql_free_result(MYSQL_RES *result); -int mysql_free_result_start(MYSQL_RES *result); -int mysql_free_result_cont(MYSQL_RES *result, int status); -void mysql_data_seek(MYSQL_RES *result, - my_ulonglong offset); -MYSQL_ROW_OFFSET mysql_row_seek(MYSQL_RES *result, - MYSQL_ROW_OFFSET offset); -MYSQL_FIELD_OFFSET mysql_field_seek(MYSQL_RES *result, - MYSQL_FIELD_OFFSET offset); -MYSQL_ROW mysql_fetch_row(MYSQL_RES *result); -int mysql_fetch_row_start(MYSQL_ROW *ret, - MYSQL_RES *result); -int mysql_fetch_row_cont(MYSQL_ROW *ret, MYSQL_RES *result, - int status); -unsigned long * mysql_fetch_lengths(MYSQL_RES *result); -MYSQL_FIELD * mysql_fetch_field(MYSQL_RES *result); -MYSQL_RES * mysql_list_fields(MYSQL *mysql, const char *table, - const char *wild); -int mysql_list_fields_start(MYSQL_RES **ret, MYSQL *mysql, - const char *table, - const char *wild); -int mysql_list_fields_cont(MYSQL_RES **ret, MYSQL *mysql, - int status); -unsigned long mysql_escape_string(char *to,const char *from, - unsigned long from_length); -unsigned long mysql_hex_string(char *to,const char *from, - unsigned long from_length); -unsigned long mysql_real_escape_string(MYSQL *mysql, - char *to,const char *from, - unsigned long length); -void mysql_debug(const char *debug); -void myodbc_remove_escape(MYSQL *mysql,char *name); -unsigned int mysql_thread_safe(void); -my_bool mysql_embedded(void); -my_bool mariadb_connection(MYSQL *mysql); -my_bool mysql_read_query_result(MYSQL *mysql); -int mysql_read_query_result_start(my_bool *ret, - MYSQL *mysql); -int mysql_read_query_result_cont(my_bool *ret, - MYSQL *mysql, int status); -enum enum_mysql_stmt_state -{ - MYSQL_STMT_INIT_DONE= 1, MYSQL_STMT_PREPARE_DONE, MYSQL_STMT_EXECUTE_DONE, - MYSQL_STMT_FETCH_DONE -}; -typedef struct st_mysql_bind -{ - unsigned long *length; - my_bool *is_null; - void *buffer; - my_bool *error; - unsigned char *row_ptr; - void (*store_param_func)(NET *net, struct st_mysql_bind *param); - void (*fetch_result)(struct st_mysql_bind *, MYSQL_FIELD *, - unsigned char **row); - void (*skip_result)(struct st_mysql_bind *, MYSQL_FIELD *, - unsigned char **row); - unsigned long buffer_length; - unsigned long offset; - unsigned long length_value; - unsigned int param_number; - unsigned int pack_length; - enum enum_field_types buffer_type; - my_bool error_value; - my_bool is_unsigned; - my_bool long_data_used; - my_bool is_null_value; - void *extension; -} MYSQL_BIND; -struct st_mysql_stmt_extension; -typedef struct st_mysql_stmt -{ - MEM_ROOT mem_root; - LIST list; - MYSQL *mysql; - MYSQL_BIND *params; - MYSQL_BIND *bind; - MYSQL_FIELD *fields; - MYSQL_DATA result; - MYSQL_ROWS *data_cursor; - int (*read_row_func)(struct st_mysql_stmt *stmt, - unsigned char **row); - my_ulonglong affected_rows; - my_ulonglong insert_id; - unsigned long stmt_id; - unsigned long flags; - unsigned long prefetch_rows; - unsigned int server_status; - unsigned int last_errno; - unsigned int param_count; - unsigned int field_count; - enum enum_mysql_stmt_state state; - char last_error[512]; - char sqlstate[5 +1]; - my_bool send_types_to_server; - my_bool bind_param_done; - unsigned char bind_result_done; - my_bool unbuffered_fetch_cancelled; - my_bool update_max_length; - struct st_mysql_stmt_extension *extension; -} MYSQL_STMT; -enum enum_stmt_attr_type -{ - STMT_ATTR_UPDATE_MAX_LENGTH, - STMT_ATTR_CURSOR_TYPE, - STMT_ATTR_PREFETCH_ROWS -}; -MYSQL_STMT * mysql_stmt_init(MYSQL *mysql); -int mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, - unsigned long length); -int mysql_stmt_prepare_start(int *ret, MYSQL_STMT *stmt, - const char *query, unsigned long length); -int mysql_stmt_prepare_cont(int *ret, MYSQL_STMT *stmt, int status); -int mysql_stmt_execute(MYSQL_STMT *stmt); -int mysql_stmt_execute_start(int *ret, MYSQL_STMT *stmt); -int mysql_stmt_execute_cont(int *ret, MYSQL_STMT *stmt, int status); -int mysql_stmt_fetch(MYSQL_STMT *stmt); -int mysql_stmt_fetch_start(int *ret, MYSQL_STMT *stmt); -int mysql_stmt_fetch_cont(int *ret, MYSQL_STMT *stmt, int status); -int mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg, - unsigned int column, - unsigned long offset); -int mysql_stmt_store_result(MYSQL_STMT *stmt); -int mysql_stmt_store_result_start(int *ret, MYSQL_STMT *stmt); -int mysql_stmt_store_result_cont(int *ret, MYSQL_STMT *stmt, - int status); -unsigned long mysql_stmt_param_count(MYSQL_STMT * stmt); -my_bool mysql_stmt_attr_set(MYSQL_STMT *stmt, - enum enum_stmt_attr_type attr_type, - const void *attr); -my_bool mysql_stmt_attr_get(MYSQL_STMT *stmt, - enum enum_stmt_attr_type attr_type, - void *attr); -my_bool mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd); -my_bool mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd); -my_bool mysql_stmt_close(MYSQL_STMT * stmt); -int mysql_stmt_close_start(my_bool *ret, MYSQL_STMT *stmt); -int mysql_stmt_close_cont(my_bool *ret, MYSQL_STMT * stmt, int status); -my_bool mysql_stmt_reset(MYSQL_STMT * stmt); -int mysql_stmt_reset_start(my_bool *ret, MYSQL_STMT * stmt); -int mysql_stmt_reset_cont(my_bool *ret, MYSQL_STMT *stmt, int status); -my_bool mysql_stmt_free_result(MYSQL_STMT *stmt); -int mysql_stmt_free_result_start(my_bool *ret, MYSQL_STMT *stmt); -int mysql_stmt_free_result_cont(my_bool *ret, MYSQL_STMT *stmt, - int status); -my_bool mysql_stmt_send_long_data(MYSQL_STMT *stmt, - unsigned int param_number, - const char *data, - unsigned long length); -int mysql_stmt_send_long_data_start(my_bool *ret, MYSQL_STMT *stmt, - unsigned int param_number, - const char *data, - unsigned long len); -int mysql_stmt_send_long_data_cont(my_bool *ret, MYSQL_STMT *stmt, - int status); -MYSQL_RES * mysql_stmt_result_metadata(MYSQL_STMT *stmt); -MYSQL_RES * mysql_stmt_param_metadata(MYSQL_STMT *stmt); -unsigned int mysql_stmt_errno(MYSQL_STMT * stmt); -const char * mysql_stmt_error(MYSQL_STMT * stmt); -const char * mysql_stmt_sqlstate(MYSQL_STMT * stmt); -MYSQL_ROW_OFFSET mysql_stmt_row_seek(MYSQL_STMT *stmt, - MYSQL_ROW_OFFSET offset); -MYSQL_ROW_OFFSET mysql_stmt_row_tell(MYSQL_STMT *stmt); -void mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset); -my_ulonglong mysql_stmt_num_rows(MYSQL_STMT *stmt); -my_ulonglong mysql_stmt_affected_rows(MYSQL_STMT *stmt); -my_ulonglong mysql_stmt_insert_id(MYSQL_STMT *stmt); -unsigned int mysql_stmt_field_count(MYSQL_STMT *stmt); -my_bool mysql_commit(MYSQL * mysql); -int mysql_commit_start(my_bool *ret, MYSQL * mysql); -int mysql_commit_cont(my_bool *ret, MYSQL * mysql, int status); -my_bool mysql_rollback(MYSQL * mysql); -int mysql_rollback_start(my_bool *ret, MYSQL * mysql); -int mysql_rollback_cont(my_bool *ret, MYSQL * mysql, int status); -my_bool mysql_autocommit(MYSQL * mysql, my_bool auto_mode); -int mysql_autocommit_start(my_bool *ret, MYSQL * mysql, - my_bool auto_mode); -int mysql_autocommit_cont(my_bool *ret, MYSQL * mysql, int status); -my_bool mysql_more_results(MYSQL *mysql); -int mysql_next_result(MYSQL *mysql); -int mysql_next_result_start(int *ret, MYSQL *mysql); -int mysql_next_result_cont(int *ret, MYSQL *mysql, int status); -int mysql_stmt_next_result(MYSQL_STMT *stmt); -int mysql_stmt_next_result_start(int *ret, MYSQL_STMT *stmt); -int mysql_stmt_next_result_cont(int *ret, MYSQL_STMT *stmt, int status); -void mysql_close_slow_part(MYSQL *mysql); -void mysql_close(MYSQL *sock); -int mysql_close_start(MYSQL *sock); -int mysql_close_cont(MYSQL *sock, int status); -my_socket mysql_get_socket(const MYSQL *mysql); -unsigned int mysql_get_timeout_value(const MYSQL *mysql); -unsigned int mysql_get_timeout_value_ms(const MYSQL *mysql); -unsigned long mysql_net_read_packet(MYSQL *mysql); -unsigned long mysql_net_field_length(unsigned char **packet); -} diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index 6bb8e5233cf14..14c752511c702 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -204,6 +204,18 @@ struct system_status_var; typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type); +static inline +struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name, + mysql_show_var_func func_arg) +{ + struct st_mysql_show_var tmp; + tmp.name= name; + tmp.value= (void*) func_arg; + tmp.type= SHOW_FUNC; + return tmp; +}; + + /* Constants for plugin flags. */ @@ -233,6 +245,7 @@ typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, void *, #define PLUGIN_VAR_NOCMDARG 0x1000 /* No argument for cmd line */ #define PLUGIN_VAR_RQCMDARG 0x0000 /* Argument required for cmd line */ #define PLUGIN_VAR_OPCMDARG 0x2000 /* Argument optional for cmd line */ +#define PLUGIN_VAR_DEPRECATED 0x4000 /* Server variable is deprecated */ #define PLUGIN_VAR_MEMALLOC 0x8000 /* String needs memory allocated */ struct st_mysql_sys_var; @@ -286,7 +299,8 @@ typedef void (*mysql_var_update_func)(MYSQL_THD thd, #define PLUGIN_VAR_MASK \ (PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | \ PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \ - PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC) + PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | \ + PLUGIN_VAR_DEPRECATED | PLUGIN_VAR_MEMALLOC) #define MYSQL_PLUGIN_VAR_HEADER \ int flags; \ diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index fedfb5862b4da..a01e4ff8c17f0 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -481,6 +481,12 @@ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result); MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result); void (STDCALL *mysql_close_func)(MYSQL *mysql); + int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option, + const void *arg); + unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res); + int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name); + unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res); + int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db); } *sql_service; MYSQL *mysql_real_connect_local(MYSQL *mysql); } @@ -511,6 +517,16 @@ }; struct system_status_var; typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type); +static inline +struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name, + mysql_show_var_func func_arg) +{ + struct st_mysql_show_var tmp; + tmp.name= name; + tmp.value= (void*) func_arg; + tmp.type= SHOW_FUNC; + return tmp; +}; struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(THD* thd, diff --git a/include/mysql/plugin_auth.h b/include/mysql/plugin_auth.h index ae9c9368f1551..3827db3343106 100644 --- a/include/mysql/plugin_auth.h +++ b/include/mysql/plugin_auth.h @@ -147,7 +147,8 @@ struct st_mysql_auth @return 0 for ok, 1 for error - Can be NULL. + Can be NULL, in this case one will not be able to use SET PASSWORD or + PASSWORD('...') in GRANT, CREATE USER, ALTER USER. */ int (*hash_password)(const char *password, size_t password_length, char *hash, size_t *hash_length); diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index f4adae35ffdc1..1844f7b7248b2 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -481,6 +481,12 @@ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result); MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result); void (STDCALL *mysql_close_func)(MYSQL *mysql); + int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option, + const void *arg); + unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res); + int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name); + unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res); + int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db); } *sql_service; MYSQL *mysql_real_connect_local(MYSQL *mysql); } @@ -511,6 +517,16 @@ }; struct system_status_var; typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type); +static inline +struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name, + mysql_show_var_func func_arg) +{ + struct st_mysql_show_var tmp; + tmp.name= name; + tmp.value= (void*) func_arg; + tmp.type= SHOW_FUNC; + return tmp; +}; struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(THD* thd, diff --git a/include/mysql/plugin_data_type.h.pp b/include/mysql/plugin_data_type.h.pp index 68333230b0072..80b5a863fa51d 100644 --- a/include/mysql/plugin_data_type.h.pp +++ b/include/mysql/plugin_data_type.h.pp @@ -481,6 +481,12 @@ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result); MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result); void (STDCALL *mysql_close_func)(MYSQL *mysql); + int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option, + const void *arg); + unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res); + int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name); + unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res); + int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db); } *sql_service; MYSQL *mysql_real_connect_local(MYSQL *mysql); } @@ -511,6 +517,16 @@ }; struct system_status_var; typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type); +static inline +struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name, + mysql_show_var_func func_arg) +{ + struct st_mysql_show_var tmp; + tmp.name= name; + tmp.value= (void*) func_arg; + tmp.type= SHOW_FUNC; + return tmp; +}; struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(THD* thd, diff --git a/include/mysql/plugin_encryption.h.pp b/include/mysql/plugin_encryption.h.pp index a7dca09334d5f..ac5798b1323d7 100644 --- a/include/mysql/plugin_encryption.h.pp +++ b/include/mysql/plugin_encryption.h.pp @@ -481,6 +481,12 @@ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result); MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result); void (STDCALL *mysql_close_func)(MYSQL *mysql); + int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option, + const void *arg); + unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res); + int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name); + unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res); + int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db); } *sql_service; MYSQL *mysql_real_connect_local(MYSQL *mysql); } @@ -511,6 +517,16 @@ }; struct system_status_var; typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type); +static inline +struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name, + mysql_show_var_func func_arg) +{ + struct st_mysql_show_var tmp; + tmp.name= name; + tmp.value= (void*) func_arg; + tmp.type= SHOW_FUNC; + return tmp; +}; struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(THD* thd, diff --git a/include/mysql/plugin_ftparser.h b/include/mysql/plugin_ftparser.h index 8db8712926f7c..511b34bb234dd 100644 --- a/include/mysql/plugin_ftparser.h +++ b/include/mysql/plugin_ftparser.h @@ -101,7 +101,7 @@ enum enum_ft_token_type <0 Must not be present 0 Neither; the word is optional but its presence increases the relevance With the default settings of the ft_boolean_syntax system variable, - >0 corresponds to the '+' operator, <0 corrresponds to the '-' operator, + >0 corresponds to the '+' operator, <0 corresponds to the '-' operator, and 0 means neither operator was used. weight_adjust: A weighting factor that determines how much a match diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp index 3270f88defdc4..919c9aaef7003 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -481,6 +481,12 @@ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result); MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result); void (STDCALL *mysql_close_func)(MYSQL *mysql); + int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option, + const void *arg); + unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res); + int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name); + unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res); + int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db); } *sql_service; MYSQL *mysql_real_connect_local(MYSQL *mysql); } @@ -511,6 +517,16 @@ }; struct system_status_var; typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type); +static inline +struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name, + mysql_show_var_func func_arg) +{ + struct st_mysql_show_var tmp; + tmp.name= name; + tmp.value= (void*) func_arg; + tmp.type= SHOW_FUNC; + return tmp; +}; struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(THD* thd, diff --git a/include/mysql/plugin_function.h.pp b/include/mysql/plugin_function.h.pp index 4f0c15e74eb2d..f5b22dbd826aa 100644 --- a/include/mysql/plugin_function.h.pp +++ b/include/mysql/plugin_function.h.pp @@ -481,6 +481,12 @@ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result); MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result); void (STDCALL *mysql_close_func)(MYSQL *mysql); + int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option, + const void *arg); + unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res); + int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name); + unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res); + int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db); } *sql_service; MYSQL *mysql_real_connect_local(MYSQL *mysql); } @@ -511,6 +517,16 @@ }; struct system_status_var; typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type); +static inline +struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name, + mysql_show_var_func func_arg) +{ + struct st_mysql_show_var tmp; + tmp.name= name; + tmp.value= (void*) func_arg; + tmp.type= SHOW_FUNC; + return tmp; +}; struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(THD* thd, diff --git a/include/mysql/plugin_password_validation.h.pp b/include/mysql/plugin_password_validation.h.pp index d8dbd8b0dfe74..115cbf2636ecf 100644 --- a/include/mysql/plugin_password_validation.h.pp +++ b/include/mysql/plugin_password_validation.h.pp @@ -481,6 +481,12 @@ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result); MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result); void (STDCALL *mysql_close_func)(MYSQL *mysql); + int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option, + const void *arg); + unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res); + int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name); + unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res); + int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db); } *sql_service; MYSQL *mysql_real_connect_local(MYSQL *mysql); } @@ -511,6 +517,16 @@ }; struct system_status_var; typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type); +static inline +struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name, + mysql_show_var_func func_arg) +{ + struct st_mysql_show_var tmp; + tmp.name= name; + tmp.value= (void*) func_arg; + tmp.type= SHOW_FUNC; + return tmp; +}; struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(THD* thd, diff --git a/include/mysql/psi/mysql_file.h b/include/mysql/psi/mysql_file.h index 761482d01653c..fd3b29cc5c9c1 100644 --- a/include/mysql/psi/mysql_file.h +++ b/include/mysql/psi/mysql_file.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2008, 2023, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, @@ -216,7 +216,7 @@ With the instrumentation, mysql_fclose(NULL, ...) will safely return 0, which is an extension compared to my_fclose and is therefore compliant. mysql_fclose is on purpose *not* implementing - @code DBUG_ASSERT(file != NULL) @endcode, + @code assert(file != NULL) @endcode, since doing so could introduce regressions. */ #ifdef HAVE_PSI_FILE_INTERFACE diff --git a/include/mysql/psi/mysql_idle.h b/include/mysql/psi/mysql_idle.h index f8085073af61e..dc7f5180285eb 100644 --- a/include/mysql/psi/mysql_idle.h +++ b/include/mysql/psi/mysql_idle.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2011, 2023, Oracle and/or its affiliates Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify diff --git a/include/mysql/psi/mysql_mdl.h b/include/mysql/psi/mysql_mdl.h index 20d6c94c57cb2..8721a191cd8bf 100644 --- a/include/mysql/psi/mysql_mdl.h +++ b/include/mysql/psi/mysql_mdl.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2012, 2023, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, diff --git a/include/mysql/psi/mysql_memory.h b/include/mysql/psi/mysql_memory.h index a79579c2e56cf..7f54b00d6fe73 100644 --- a/include/mysql/psi/mysql_memory.h +++ b/include/mysql/psi/mysql_memory.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2012, 2023, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, diff --git a/include/mysql/psi/mysql_ps.h b/include/mysql/psi/mysql_ps.h index f0b2733297a86..89f34ef63f7a1 100644 --- a/include/mysql/psi/mysql_ps.h +++ b/include/mysql/psi/mysql_ps.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2014, 2023, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, diff --git a/include/mysql/psi/mysql_socket.h b/include/mysql/psi/mysql_socket.h index d70e1c8fc5a74..95cb02a5f6c42 100644 --- a/include/mysql/psi/mysql_socket.h +++ b/include/mysql/psi/mysql_socket.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2010, 2023, Oracle and/or its affiliates. Copyright (c) 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify diff --git a/include/mysql/psi/mysql_sp.h b/include/mysql/psi/mysql_sp.h index 5eeea37f4c48e..c25247459ae81 100644 --- a/include/mysql/psi/mysql_sp.h +++ b/include/mysql/psi/mysql_sp.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2013, 2023, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, diff --git a/include/mysql/psi/mysql_stage.h b/include/mysql/psi/mysql_stage.h index 732df6bd357cf..b6bc5ce370653 100644 --- a/include/mysql/psi/mysql_stage.h +++ b/include/mysql/psi/mysql_stage.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2010, 2023, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, diff --git a/include/mysql/psi/mysql_statement.h b/include/mysql/psi/mysql_statement.h index fab23d2c5c284..544bba678857f 100644 --- a/include/mysql/psi/mysql_statement.h +++ b/include/mysql/psi/mysql_statement.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2010, 2023, Oracle and/or its affiliates. Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify diff --git a/include/mysql/psi/mysql_table.h b/include/mysql/psi/mysql_table.h index a212406451080..317627a63ff2c 100644 --- a/include/mysql/psi/mysql_table.h +++ b/include/mysql/psi/mysql_table.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2010, 2023, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify diff --git a/include/mysql/psi/mysql_thread.h b/include/mysql/psi/mysql_thread.h index 87f36d9257345..11cf3548e8c2d 100644 --- a/include/mysql/psi/mysql_thread.h +++ b/include/mysql/psi/mysql_thread.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. +/* Copyright (c) 2008, 2023, Oracle and/or its affiliates. Copyright (c) 2020, 2021, MariaDB Corporation. This program is free software; you can redistribute it and/or modify @@ -625,7 +625,7 @@ typedef struct st_mysql_cond mysql_cond_t; This function creates both the thread instrumentation and a thread. @c mysql_thread_create is a replacement for @c pthread_create. The parameter P4 (or, if it is NULL, P1) will be used as the - instrumented thread "indentity". + instrumented thread "identity". Providing a P1 / P4 parameter with a different value for each call will on average improve performances, since this thread identity value is used internally to randomize access to data and prevent contention. @@ -1155,6 +1155,13 @@ static inline void inline_mysql_thread_set_psi_THD(THD *thd) } #endif /* __cplusplus */ +static inline void mysql_thread_set_peer_port(uint port __attribute__ ((unused))) { +#ifdef HAVE_PSI_THREAD_INTERFACE + struct PSI_thread *psi = PSI_THREAD_CALL(get_thread)(); + PSI_THREAD_CALL(set_thread_peer_port)(psi, port); +#endif +} + #endif #endif /* DISABLE_MYSQL_THREAD_H */ diff --git a/include/mysql/psi/mysql_transaction.h b/include/mysql/psi/mysql_transaction.h index 6de794d95bbeb..a4444804f5ce4 100644 --- a/include/mysql/psi/mysql_transaction.h +++ b/include/mysql/psi/mysql_transaction.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2013, 2023, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, diff --git a/include/mysql/psi/psi.h b/include/mysql/psi/psi.h index 2d669070e5445..702d31fa01e7c 100644 --- a/include/mysql/psi/psi.h +++ b/include/mysql/psi/psi.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2008, 2023, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, @@ -1692,6 +1692,15 @@ typedef void (*set_thread_info_v1_t)(const char* info, uint info_len); */ typedef void (*set_thread_v1_t)(struct PSI_thread *thread); +/** + Assign the remote (peer) port to the instrumented thread. + + @param thread pointer to the thread instrumentation + @param port the remote port +*/ +typedef void (*set_thread_peer_port_v1_t)(PSI_thread *thread, + unsigned int port); + /** Delete the current thread instrumentation. */ typedef void (*delete_current_thread_v1_t)(void); @@ -2375,7 +2384,7 @@ typedef void (*execute_prepared_stmt_v1_t) (PSI_statement_locker *locker, PSI_prepared_stmt* prepared_stmt); /** - Set the statement text for a prepared statment event. + Set the statement text for a prepared statement event. @param prepared_stmt prepared statement. @param text the prepared statement text @param text_len the prepared statement text length @@ -2737,6 +2746,8 @@ struct PSI_v1 start_metadata_wait_v1_t start_metadata_wait; end_metadata_wait_v1_t end_metadata_wait; + + set_thread_peer_port_v1_t set_thread_peer_port; }; /** @} (end of group Group_PSI_v1) */ diff --git a/include/mysql/psi/psi_abi_v0.h b/include/mysql/psi/psi_abi_v0.h index 5c879fb853613..c75a51f7fbfea 100644 --- a/include/mysql/psi/psi_abi_v0.h +++ b/include/mysql/psi/psi_abi_v0.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2011, 2023, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, diff --git a/include/mysql/psi/psi_abi_v1.h b/include/mysql/psi/psi_abi_v1.h index 488e832c3edff..e195ea5ba8d00 100644 --- a/include/mysql/psi/psi_abi_v1.h +++ b/include/mysql/psi/psi_abi_v1.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2008, 2023, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp index a1845ac62f64c..ca0d0206cb909 100644 --- a/include/mysql/psi/psi_abi_v1.h.pp +++ b/include/mysql/psi/psi_abi_v1.h.pp @@ -1,8 +1,8 @@ extern "C" { +typedef unsigned int PSI_memory_key; } extern "C" { struct PSI_thread; -typedef unsigned int PSI_memory_key; struct PSI_memory_info_v1 { PSI_memory_key *m_key; @@ -459,6 +459,8 @@ typedef void (*set_thread_state_v1_t)(const char* state); typedef void (*set_thread_info_v1_t)(const char* info, uint info_len); typedef void (*set_thread_v1_t)(struct PSI_thread *thread); +typedef void (*set_thread_peer_port_v1_t)(PSI_thread *thread, + unsigned int port); typedef void (*delete_current_thread_v1_t)(void); typedef void (*delete_thread_v1_t)(struct PSI_thread *thread); typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t) @@ -829,6 +831,7 @@ destroy_metadata_lock_v1_t destroy_metadata_lock; start_metadata_wait_v1_t start_metadata_wait; end_metadata_wait_v1_t end_metadata_wait; + set_thread_peer_port_v1_t set_thread_peer_port; }; typedef struct PSI_v1 PSI; typedef struct PSI_mutex_info_v1 PSI_mutex_info; diff --git a/include/mysql/psi/psi_abi_v2.h b/include/mysql/psi/psi_abi_v2.h index 3495d618b05b1..fdbd36f2259c9 100644 --- a/include/mysql/psi/psi_abi_v2.h +++ b/include/mysql/psi/psi_abi_v2.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2008, 2023, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, diff --git a/include/mysql/psi/psi_abi_v2.h.pp b/include/mysql/psi/psi_abi_v2.h.pp index a670e53a8b71f..9188954885f61 100644 --- a/include/mysql/psi/psi_abi_v2.h.pp +++ b/include/mysql/psi/psi_abi_v2.h.pp @@ -1,8 +1,8 @@ extern "C" { +typedef unsigned int PSI_memory_key; } extern "C" { struct PSI_thread; -typedef unsigned int PSI_memory_key; struct PSI_memory_info_v2 { int placeholder; diff --git a/include/mysql/psi/psi_base.h b/include/mysql/psi/psi_base.h index f365e2625ee74..6cf531950f0e0 100644 --- a/include/mysql/psi/psi_base.h +++ b/include/mysql/psi/psi_base.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2008, 2023, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, @@ -94,6 +94,12 @@ extern "C" { */ #define PSI_FLAG_VOLATILITY_SESSION (1 << 6) +/** + System thread flag. + Indicates that the instrumented object exists on a system thread. +*/ +#define PSI_FLAG_THREAD_SYSTEM (1 << 9) + #ifdef HAVE_PSI_INTERFACE /** @@ -164,6 +170,13 @@ extern "C" { /** @} */ +/** + Instrumented memory key. + To instrument memory, a memory key must be obtained using @c register_memory. + Using a zero key always disable the instrumentation. +*/ +typedef unsigned int PSI_memory_key; + #ifdef __cplusplus } #endif diff --git a/include/mysql/psi/psi_memory.h b/include/mysql/psi/psi_memory.h index c019c9cd410dc..f06ec525e08cc 100644 --- a/include/mysql/psi/psi_memory.h +++ b/include/mysql/psi/psi_memory.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2013, 2023, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, @@ -53,13 +53,6 @@ extern "C" { struct PSI_thread; -/** - Instrumented memory key. - To instrument memory, a memory key must be obtained using @c register_memory. - Using a zero key always disable the instrumentation. -*/ -typedef unsigned int PSI_memory_key; - #ifdef HAVE_PSI_1 /** diff --git a/include/mysql/service_base64.h b/include/mysql/service_base64.h index 43b5ba323ba94..fa54b4923d4fb 100644 --- a/include/mysql/service_base64.h +++ b/include/mysql/service_base64.h @@ -29,7 +29,7 @@ extern "C" { #include #endif -/* Allow multuple chunks 'AAA= AA== AA==', binlog uses this */ +/* Allow multiple chunks 'AAA= AA== AA==', binlog uses this */ #define MY_BASE64_DECODE_ALLOW_MULTIPLE_CHUNKS 1 extern struct base64_service_st { diff --git a/include/mysql/service_encryption.h b/include/mysql/service_encryption.h index a4e908f9aff71..4963940758c53 100644 --- a/include/mysql/service_encryption.h +++ b/include/mysql/service_encryption.h @@ -24,23 +24,19 @@ *provider* (encryption plugin). */ -#ifdef __cplusplus -extern "C" { -#endif - #ifndef MYSQL_ABI_CHECK +#include #ifdef _WIN32 -#include #ifndef __cplusplus #define inline __inline #endif -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) -#include -#else -#include #endif #endif +#ifdef __cplusplus +extern "C" { +#endif + /* returned from encryption_key_get_latest_version() */ #define ENCRYPTION_KEY_VERSION_INVALID (~(unsigned int)0) #define ENCRYPTION_KEY_NOT_ENCRYPTED (0) diff --git a/include/mysql/service_my_snprintf.h b/include/mysql/service_my_snprintf.h index 6757a658fb6f0..fcc832fc1f1d5 100644 --- a/include/mysql/service_my_snprintf.h +++ b/include/mysql/service_my_snprintf.h @@ -40,7 +40,7 @@ @post The syntax of a format string is generally the same: % - where everithing but the format is optional. + where everything but the format is optional. Three one-character flags are recognized: '0' has the standard zero-padding semantics; diff --git a/include/mysql/service_sql.h b/include/mysql/service_sql.h index ef6de8b34ef8b..2fee56ca2c7b9 100644 --- a/include/mysql/service_sql.h +++ b/include/mysql/service_sql.h @@ -62,6 +62,12 @@ extern struct sql_service_st { void (STDCALL *mysql_free_result_func)(MYSQL_RES *result); MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result); void (STDCALL *mysql_close_func)(MYSQL *mysql); + int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option, + const void *arg); + unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res); + int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name); + unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res); + int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db); } *sql_service; #ifdef MYSQL_DYNAMIC_PLUGIN @@ -78,6 +84,11 @@ extern struct sql_service_st { #define mysql_free_result(R) sql_service->mysql_free_result_func(R) #define mysql_fetch_row(R) sql_service->mysql_fetch_row_func(R) #define mysql_close(M) sql_service->mysql_close_func(M) +#define mysql_options(M,O,V) sql_service->mysql_options_func(M,O,V) +#define mysql_fetch_lengths(R) sql_service->mysql_fetch_lengths_func(R) +#define mysql_set_character_set(M,C) sql_service->mysql_set_character_set_func(M,C) +#define mysql_num_fields(R) sql_service->mysql_num_fields_func(R) +#define mysql_select_db(M,D) sql_service->mysql_select_db_func(M,D) #else @@ -90,7 +101,7 @@ extern struct sql_service_st { */ MYSQL *mysql_real_connect_local(MYSQL *mysql); -/* The rest of the function declarations mest be taken from the mysql.h */ +/* The rest of the function declarations must be taken from the mysql.h */ #endif /*MYSQL_DYNAMIC_PLUGIN*/ diff --git a/include/mysql/service_thd_timezone.h b/include/mysql/service_thd_timezone.h index 89e75274cf0a8..667137745f4c9 100644 --- a/include/mysql/service_thd_timezone.h +++ b/include/mysql/service_thd_timezone.h @@ -16,7 +16,7 @@ /** @file - This service provdes functions to convert between my_time_t and + This service provides functions to convert between my_time_t and MYSQL_TIME taking into account the current value of the time_zone session variable. diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h index 42b758c03f3bf..8541b348ae463 100644 --- a/include/mysql/service_wsrep.h +++ b/include/mysql/service_wsrep.h @@ -69,6 +69,9 @@ extern struct wsrep_service_st { 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); + int (*wsrep_thd_append_table_key_func)(MYSQL_THD thd, const char* db, + const char* table, enum Wsrep_service_key_type); + my_bool (*wsrep_thd_is_local_transaction)(const MYSQL_THD thd); 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); @@ -121,6 +124,8 @@ extern struct wsrep_service_st { #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_append_table_key(T,D,B,K) wsrep_service->wsrep_thd_append_table_key_func(T,D,B,K) +#define wsrep_thd_is_local_transaction(T) wsrep_service->wsrep_thd_is_local_transaction_func(T) #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) @@ -226,6 +231,13 @@ extern "C" int wsrep_thd_append_key(MYSQL_THD thd, int n_keys, enum Wsrep_service_key_type); +extern "C" int wsrep_thd_append_table_key(MYSQL_THD thd, + const char* db, + const char* table, + enum Wsrep_service_key_type); + +extern "C" my_bool wsrep_thd_is_local_transaction(const MYSQL_THD thd); + extern const char* wsrep_sr_table_name_full; extern "C" const char* wsrep_get_sr_table_name(); diff --git a/include/pfs_thread_provider.h b/include/pfs_thread_provider.h index 3c43f8e3d7722..6b5633722f513 100644 --- a/include/pfs_thread_provider.h +++ b/include/pfs_thread_provider.h @@ -99,6 +99,8 @@ void pfs_set_thread_info_v1(const char* info, uint info_len); void pfs_set_thread_v1(PSI_thread* thread); +void pfs_set_thread_peer_port_v1(PSI_thread *thread, uint port); + void pfs_delete_current_thread_v1(void); void pfs_delete_thread_v1(PSI_thread *thread); diff --git a/include/providers/lzma.h b/include/providers/lzma.h index 0ba04ede47270..8125bb8cb04ea 100644 --- a/include/providers/lzma.h +++ b/include/providers/lzma.h @@ -52,12 +52,18 @@ typedef enum #define lzma_stream_buffer_decode(...) provider_service_lzma->lzma_stream_buffer_decode_ptr (__VA_ARGS__) #define lzma_easy_buffer_encode(...) provider_service_lzma->lzma_easy_buffer_encode_ptr (__VA_ARGS__) +#elif LZMA_VERSION < 50010030 +#define lzma_maybe_const +#endif + +#ifndef lzma_maybe_const +#define lzma_maybe_const const #endif #define DEFINE_lzma_stream_buffer_decode(NAME) NAME( \ uint64_t *memlimit, \ uint32_t flags, \ - const lzma_allocator *allocator, \ + lzma_maybe_const lzma_allocator *allocator, \ const uint8_t *in, \ size_t *in_pos, \ size_t in_size, \ @@ -69,7 +75,7 @@ typedef enum #define DEFINE_lzma_easy_buffer_encode(NAME) NAME( \ uint32_t preset, \ lzma_check check, \ - const lzma_allocator *allocator, \ + lzma_maybe_const lzma_allocator *allocator, \ const uint8_t *in, \ size_t in_size, \ uint8_t *out, \ diff --git a/include/queues.h b/include/queues.h index e9948857dde0e..9cc7c15a98083 100644 --- a/include/queues.h +++ b/include/queues.h @@ -24,7 +24,7 @@ */ /* - Code for generell handling of priority Queues. + Code for general handling of priority Queues. Implementation of queues from "Algorithms in C" by Robert Sedgewick. */ diff --git a/include/service_versions.h b/include/service_versions.h index acc50e73cc6c5..9abae740a7b43 100644 --- a/include/service_versions.h +++ b/include/service_versions.h @@ -44,7 +44,7 @@ #define VERSION_wsrep 0x0500 #define VERSION_json 0x0100 #define VERSION_thd_mdl 0x0100 -#define VERSION_sql_service 0x0100 +#define VERSION_sql_service 0x0101 #define VERSION_provider_bzip2 0x0100 #define VERSION_provider_lz4 0x0100 diff --git a/include/span.h b/include/span.h index 0e8516933c6b1..4ea200f5494e0 100644 --- a/include/span.h +++ b/include/span.h @@ -81,7 +81,7 @@ template class span span(const span &other) : data_(other.data_), size_(other.size_) {} - ~span(){}; + ~span() = default; span &operator=(const span &other) { diff --git a/include/ssl_compat.h b/include/ssl_compat.h index affa9f2a44857..3678e5fa08481 100644 --- a/include/ssl_compat.h +++ b/include/ssl_compat.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2016, 2021, MariaDB Corporation. + Copyright (c) 2016, 2022, 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 @@ -19,7 +19,8 @@ /* OpenSSL version specific definitions */ #if defined(OPENSSL_VERSION_NUMBER) -#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) +#if OPENSSL_VERSION_NUMBER >= 0x10100000L && \ + !(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x30500000L) #define HAVE_OPENSSL11 1 #define SSL_LIBRARY OpenSSL_version(OPENSSL_VERSION) #define ERR_remove_state(X) ERR_clear_error() @@ -73,7 +74,10 @@ #define EVP_MD_CTX_SIZE sizeof(EVP_MD_CTX) #endif +#ifndef DH_set0_pqg #define DH_set0_pqg(D,P,Q,G) ((D)->p= (P), (D)->g= (G)) +#endif + #define EVP_CIPHER_CTX_encrypting(ctx) ((ctx)->encrypt) #define EVP_CIPHER_CTX_SIZE sizeof(EVP_CIPHER_CTX) diff --git a/include/sslopt-longopts.h b/include/sslopt-longopts.h index d0278a1645d91..ee90d17fb64ff 100644 --- a/include/sslopt-longopts.h +++ b/include/sslopt-longopts.h @@ -39,10 +39,10 @@ {"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl).", &opt_ssl_key, &opt_ssl_key, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"ssl-crl", OPT_SSL_KEY, "Certificate revocation list (implies --ssl).", + {"ssl-crl", OPT_SSL_CRL, "Certificate revocation list (implies --ssl).", &opt_ssl_crl, &opt_ssl_crl, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"ssl-crlpath", OPT_SSL_KEY, + {"ssl-crlpath", OPT_SSL_CRLPATH, "Certificate revocation list path (implies --ssl).", &opt_ssl_crlpath, &opt_ssl_crlpath, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/include/waiting_threads.h b/include/waiting_threads.h index f785cc8988b13..5f708f42f966b 100644 --- a/include/waiting_threads.h +++ b/include/waiting_threads.h @@ -81,7 +81,7 @@ typedef struct st_wt_thd { 1. Latest Keep all weights equal. 2. Random - Assight weights at random. + Assign weights at random. (variant: modify a weight randomly before every lock request) 3. Youngest Set weight to -NOW() diff --git a/include/wsrep.h b/include/wsrep.h index e68b14f4a176f..e4535deabfe5c 100644 --- a/include/wsrep.h +++ b/include/wsrep.h @@ -17,44 +17,46 @@ #define WSREP_INCLUDED #include +#include "log.h" #ifdef WITH_WSREP - #define IF_WSREP(A,B) A - #define DBUG_ASSERT_IF_WSREP(A) DBUG_ASSERT(A) -#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 wsrep_error_label; - -#define WSREP_TO_ISOLATION_BEGIN_CREATE(db_, table_, table_list_, create_info_) \ - if (WSREP_ON && WSREP(thd) && \ - wsrep_to_isolation_begin(thd, db_, table_, \ - table_list_, nullptr, nullptr, create_info_)) \ - goto wsrep_error_label; - -#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_, fk_tables_, create_info_) \ - if (WSREP(thd) && \ - wsrep_to_isolation_begin(thd, db_, table_, \ - table_list_, alter_info_, \ - fk_tables_, create_info_)) - -/* - Checks if lex->no_write_to_binlog is set for statements that use LOCAL or - NO_WRITE_TO_BINLOG. -*/ -#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 wsrep_error_label; +extern ulong wsrep_debug; // wsrep_mysqld.cc +extern void WSREP_LOG(void (*fun)(const char* fmt, ...), const char* fmt, ...); + +#define WSREP_DEBUG(...) \ + if (wsrep_debug) WSREP_LOG(sql_print_information, ##__VA_ARGS__) +#define WSREP_INFO(...) WSREP_LOG(sql_print_information, ##__VA_ARGS__) +#define WSREP_WARN(...) WSREP_LOG(sql_print_warning, ##__VA_ARGS__) +#define WSREP_ERROR(...) WSREP_LOG(sql_print_error, ##__VA_ARGS__) +#define WSREP_UNKNOWN(fmt, ...) WSREP_ERROR("UNKNOWN: " fmt, ##__VA_ARGS__) + +#define WSREP_LOG_CONFLICT_THD(thd, role) \ + WSREP_INFO("%s: \n " \ + " THD: %lu, mode: %s, state: %s, conflict: %s, seqno: %lld\n " \ + " SQL: %s", \ + role, \ + thd_get_thread_id(thd), \ + wsrep_thd_client_mode_str(thd), \ + wsrep_thd_client_state_str(thd), \ + wsrep_thd_transaction_state_str(thd), \ + wsrep_thd_trx_seqno(thd), \ + wsrep_thd_query(thd) \ + ); + +#define WSREP_LOG_CONFLICT(bf_thd, victim_thd, bf_abort) \ + if (wsrep_debug || wsrep_log_conflicts) \ + { \ + WSREP_INFO("cluster conflict due to %s for threads:", \ + (bf_abort) ? "high priority abort" : "certification failure" \ + ); \ + if (bf_thd) WSREP_LOG_CONFLICT_THD(bf_thd, "Winning thread"); \ + if (victim_thd) WSREP_LOG_CONFLICT_THD(victim_thd, "Victim thread"); \ + WSREP_INFO("context: %s:%d", __FILE__, __LINE__); \ + } -#define WSREP_SYNC_WAIT(thd_, before_) \ - { if (WSREP_CLIENT(thd_) && \ - wsrep_sync_wait(thd_, before_)) goto wsrep_error_label; } #else /* !WITH_WSREP */ @@ -62,13 +64,11 @@ * (e.g. embedded) */ #define IF_WSREP(A,B) B +//#define DBUG_ASSERT_IF_WSREP(A) #define WSREP_DEBUG(...) +//#define WSREP_INFO(...) +//#define WSREP_WARN(...) #define WSREP_ERROR(...) -#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) do { } while(0) -#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_, fk_tables_, create_info_) -#define WSREP_TO_ISOLATION_BEGIN_CREATE(db_, table_, table_list_, create_info_) -#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 ddb031b6a1d8b..c2b322d2ca27e 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit ddb031b6a1d8b6e26a0f10f454dc1453a48a6ca8 +Subproject commit c2b322d2ca27ef66385d9938b98541c7cf14ac74 diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index cacaaae9a6d73..490c2ed41b51d 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) 2006, 2011, Oracle and/or its affiliates. -# Copyright (c) 2009, 2020, MariaDB Corporation +# Copyright (c) 2009, 2022, 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 @@ -31,15 +31,23 @@ ${SSL_INTERNAL_INCLUDE_DIRS} ) SET(GEN_SOURCES -${CMAKE_BINARY_DIR}/sql/sql_yacc.hh +${CMAKE_BINARY_DIR}/sql/sql_yacc.hh ${CMAKE_BINARY_DIR}/sql/yy_mariadb.cc ${CMAKE_BINARY_DIR}/sql/yy_oracle.hh ${CMAKE_BINARY_DIR}/sql/yy_oracle.cc -${CMAKE_BINARY_DIR}/sql/lex_hash.h +${CMAKE_BINARY_DIR}/sql/lex_hash.h ) SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES} PROPERTIES GENERATED TRUE) +IF(CMAKE_C_COMPILER_ID MATCHES "Clang" AND + NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.0.0") + ADD_COMPILE_FLAGS( + ${CMAKE_BINARY_DIR}/sql/yy_mariadb.cc + ${CMAKE_BINARY_DIR}/sql/yy_oracle.cc + COMPILE_FLAGS "-Wno-unused-but-set-variable") +ENDIF() + SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc libmysql.c ../sql-common/errmsg.c ../sql-common/client.c @@ -153,6 +161,7 @@ ENDIF() IF(TARGET libfmt) ADD_DEPENDENCIES(sql_embedded libfmt) ENDIF() +TARGET_LINK_LIBRARIES(sql_embedded LINK_PRIVATE tpool ${CRC32_LIBRARY}) # On Windows, static embedded server library is called mysqlserver.lib # On Unix, it is libmysqld.a diff --git a/libmysqld/embedded_priv.h b/libmysqld/embedded_priv.h index af80f5bc6a905..2262706217ecf 100644 --- a/libmysqld/embedded_priv.h +++ b/libmysqld/embedded_priv.h @@ -19,8 +19,8 @@ C_MODE_START void lib_connection_phase(NET *net, int phase); -void init_embedded_mysql(MYSQL *mysql, int client_flag); -void *create_embedded_thd(int client_flag); +void init_embedded_mysql(MYSQL *mysql, ulong client_flag); +void *create_embedded_thd(ulong client_flag); int check_embedded_connection(MYSQL *mysql, const char *db); void free_old_query(MYSQL *mysql); extern MYSQL_METHODS embedded_methods; diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index db4e7e6cfa9d9..4b9d1b1cd4885 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -496,7 +496,7 @@ MYSQL_METHODS embedded_methods= char **copy_arguments(int argc, char **argv) { - uint length= 0; + size_t length= 0; char **from, **res, **end= argv+argc; for (from=argv ; from != end ; from++) @@ -526,7 +526,6 @@ int init_embedded_server(int argc, char **argv, char **groups) */ int *argcp; char ***argvp; - int fake_argc = 1; char *fake_argv[] = { (char *)"", 0 }; const char *fake_groups[] = { "server", "embedded", 0 }; my_bool acl_error; @@ -539,16 +538,14 @@ int init_embedded_server(int argc, char **argv, char **groups) if (init_early_variables()) return 1; - if (argc) + if (!argc) { - argcp= &argc; - argvp= (char***) &argv; - } - else - { - argcp= &fake_argc; - argvp= (char ***) &fake_argv; + argc= 1; + argv= fake_argv; } + argcp= &argc; + argvp= &argv; + if (!groups) groups= (char**) fake_groups; @@ -578,6 +575,8 @@ int init_embedded_server(int argc, char **argv, char **groups) if (ho_error != 0) return 1; + my_timer_init(&sys_timer_info); + if (init_common_variables()) { mysql_server_end(); @@ -674,7 +673,7 @@ void end_embedded_server() } -void init_embedded_mysql(MYSQL *mysql, int client_flag) +void init_embedded_mysql(MYSQL *mysql, ulong client_flag) { THD *thd = (THD *)mysql->thd; thd->mysql= mysql; @@ -694,7 +693,7 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag) create_new_thread(), and prepare_new_connection_state(). This should be refactored to avoid code duplication. */ -void *create_embedded_thd(int client_flag) +void *create_embedded_thd(ulong client_flag) { THD * thd= new THD(next_thread_id()); @@ -710,7 +709,7 @@ void *create_embedded_thd(int client_flag) thd->set_command(COM_SLEEP); thd->set_time(); thd->init_for_queries(); - thd->client_capabilities= client_flag; + thd->client_capabilities= client_flag | MARIADB_CLIENT_EXTENDED_METADATA; thd->real_id= pthread_self(); thd->db= null_clex_str; @@ -841,7 +840,7 @@ int check_embedded_connection(MYSQL *mysql, const char *db) /* acl_authenticate() takes the data from thd->net->read_pos */ thd->net.read_pos= (uchar*)buf; - if (acl_authenticate(thd, 0, end - buf)) + if (acl_authenticate(thd, (uint) (end - buf))) { my_free(thd->security_ctx->user); goto err; @@ -1111,11 +1110,11 @@ bool Protocol_text::store_field_metadata(const THD * thd, client_field->flags= (uint16) server_field.flags; client_field->decimals= server_field.decimals; - client_field->db_length= strlen(client_field->db); - client_field->table_length= strlen(client_field->table); - client_field->name_length= strlen(client_field->name); - client_field->org_name_length= strlen(client_field->org_name); - client_field->org_table_length= strlen(client_field->org_table); + client_field->db_length= (uint)strlen(client_field->db); + client_field->table_length= (uint)strlen(client_field->table); + client_field->name_length= (uint)strlen(client_field->name); + client_field->org_name_length= (uint)strlen(client_field->org_name); + client_field->org_table_length= (uint)strlen(client_field->org_table); client_field->catalog= dup_str_aux(field_alloc, "def", 3, cs, thd_cs); client_field->catalog_length= 3; @@ -1389,12 +1388,12 @@ bool Protocol::net_store_data(const uchar *from, size_t length) if (!(field_buf= (char*) alloc_root(alloc, length + sizeof(uint) + 1))) return TRUE; - *(uint *)field_buf= length; + *(uint *)field_buf= (uint)length; *next_field= field_buf + sizeof(uint); memcpy((uchar*) *next_field, from, length); (*next_field)[length]= 0; if (next_mysql_field->max_length < length) - next_mysql_field->max_length=length; + next_mysql_field->max_length=(ulong)length; ++next_field; ++next_mysql_field; return FALSE; @@ -1404,7 +1403,7 @@ bool Protocol::net_store_data(const uchar *from, size_t length) bool Protocol::net_store_data_cs(const uchar *from, size_t length, CHARSET_INFO *from_cs, CHARSET_INFO *to_cs) { - uint conv_length= to_cs->mbmaxlen * length / from_cs->mbminlen; + size_t conv_length= length * to_cs->mbmaxlen / from_cs->mbminlen; uint dummy_error; char *field_buf; if (!thd->mysql) // bootstrap file handling @@ -1415,10 +1414,10 @@ bool Protocol::net_store_data_cs(const uchar *from, size_t length, *next_field= field_buf + sizeof(uint); length= copy_and_convert(*next_field, conv_length, to_cs, (const char*) from, length, from_cs, &dummy_error); - *(uint *) field_buf= length; + *(uint *) field_buf= (uint)length; (*next_field)[length]= 0; if (next_mysql_field->max_length < length) - next_mysql_field->max_length= length; + next_mysql_field->max_length= (ulong)length; ++next_field; ++next_mysql_field; return false; diff --git a/libmysqld/libmysql.c b/libmysqld/libmysql.c index 6c7e0b3b8124b..7f55b0c2726b9 100644 --- a/libmysqld/libmysql.c +++ b/libmysqld/libmysql.c @@ -2953,7 +2953,8 @@ my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *my_bind) break; default: strmov(stmt->sqlstate, unknown_sqlstate); - sprintf(stmt->last_error, + snprintf(stmt->last_error, + sizeof(stmt->last_error), ER(stmt->last_errno= CR_UNSUPPORTED_PARAM_TYPE), param->buffer_type, count); DBUG_RETURN(1); @@ -3040,7 +3041,9 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number, { /* Long data handling should be used only for string/binary types */ strmov(stmt->sqlstate, unknown_sqlstate); - sprintf(stmt->last_error, ER(stmt->last_errno= CR_INVALID_BUFFER_USE), + snprintf(stmt->last_error, + sizeof(stmt->last_error), + ER(stmt->last_errno= CR_INVALID_BUFFER_USE), param->param_number); DBUG_RETURN(1); } @@ -4171,7 +4174,8 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *my_bind) if (setup_one_fetch_function(param, field)) { strmov(stmt->sqlstate, unknown_sqlstate); - sprintf(stmt->last_error, + snprintf(stmt->last_error, + sizeof(stmt->last_error), ER(stmt->last_errno= CR_UNSUPPORTED_PARAM_TYPE), field->type, param_count); DBUG_RETURN(1); diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt index e9df857d6bfbf..e6d7ab32e884c 100644 --- a/man/CMakeLists.txt +++ b/man/CMakeLists.txt @@ -12,8 +12,9 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA + SET(MAN1_WSREP wsrep_sst_rsync.1 wsrep_sst_common.1 wsrep_sst_mariabackup.1 - wsrep_sst_rsync_wan.1) + wsrep_sst_mysqldump.1 wsrep_sst_rsync_wan.1 galera_recovery.1 galera_new_cluster.1) SET(MAN1_SERVER innochecksum.1 myisam_ftdump.1 myisamchk.1 aria_chk.1 aria_dump_log.1 aria_ftdump.1 aria_pack.1 aria_read_log.1 aria_s3_copy.1 @@ -24,10 +25,11 @@ SET(MAN1_SERVER innochecksum.1 myisam_ftdump.1 myisamchk.1 mysqld_multi.1 mysqld_safe.1 resolveip.1 mariadb-service-convert.1 mysqld_safe_helper.1 - wsrep_sst_mysqldump.1 - galera_recovery.1 galera_new_cluster.1 mysql_ldb.1 myrocks_hotbackup.1 - mbstream.1 mariabackup.1 ${MAN1_WSREP}) + mbstream.1 mariabackup.1) +IF(WITH_WSREP) + SET(MAN1_SERVER ${MAN1_SERVER} ${MAN1_WSREP}) +ENDIF() SET(MAN8_SERVER mysqld.8) SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1 mysqldumpslow.1 diff --git a/man/comp_err.1 b/man/comp_err.1 index 7e401867906c4..260295d56abe6 100644 --- a/man/comp_err.1 +++ b/man/comp_err.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBCOMP_ERR\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBCOMP_ERR\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/galera_new_cluster.1 b/man/galera_new_cluster.1 index def5faeb935a1..271f743c06877 100644 --- a/man/galera_new_cluster.1 +++ b/man/galera_new_cluster.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBGALERA_NEW_CLUSTER\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBGALERA_NEW_CLUSTER\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/galera_recovery.1 b/man/galera_recovery.1 index 6ada4367d83a1..90b90282d78cc 100644 --- a/man/galera_recovery.1 +++ b/man/galera_recovery.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBGALERA_RECOVERY\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBGALERA_RECOVERY\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/innochecksum.1 b/man/innochecksum.1 index 5a56dada9857d..94aad5ca0a1c7 100644 --- a/man/innochecksum.1 +++ b/man/innochecksum.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBINNOCHECKSUM\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBINNOCHECKSUM\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariabackup.1 b/man/mariabackup.1 index af72f29348804..b6828f22f92e5 100644 --- a/man/mariabackup.1 +++ b/man/mariabackup.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIABACKUP\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIABACKUP\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-conv.1 b/man/mariadb-conv.1 index 1e0385f4fd385..16fb112f7f243 100644 --- a/man/mariadb-conv.1 +++ b/man/mariadb-conv.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-CONV" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-CONV" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-service-convert.1 b/man/mariadb-service-convert.1 index 7c5291c3afde2..5132ae9c03f11 100644 --- a/man/mariadb-service-convert.1 +++ b/man/mariadb-service-convert.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-SERVICE-CONVERT\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-SERVICE-CONVERT\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mbstream.1 b/man/mbstream.1 index 16cf5b180f2ce..955768122dc4e 100644 --- a/man/mbstream.1 +++ b/man/mbstream.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMBSTREAM\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMBSTREAM\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/msql2mysql.1 b/man/msql2mysql.1 index 503b8b194ab5c..870d73558fd17 100644 --- a/man/msql2mysql.1 +++ b/man/msql2mysql.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMSQL2MYSQL\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMSQL2MYSQL\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/my_print_defaults.1 b/man/my_print_defaults.1 index d7b81cc73b201..cb3c6f3ad1272 100644 --- a/man/my_print_defaults.1 +++ b/man/my_print_defaults.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMY_PRINT_DEFAULTS" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMY_PRINT_DEFAULTS" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/my_safe_process.1 b/man/my_safe_process.1 index b265352fb869c..bc31526214b3c 100644 --- a/man/my_safe_process.1 +++ b/man/my_safe_process.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMY_SAFE_PROCESS\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMY_SAFE_PROCESS\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/myisam_ftdump.1 b/man/myisam_ftdump.1 index 4af8280d2d8a1..480935bb71321 100644 --- a/man/myisam_ftdump.1 +++ b/man/myisam_ftdump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYISAM_FTDUMP\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMYISAM_FTDUMP\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/myisamchk.1 b/man/myisamchk.1 index e059cf11036d1..3c930bedcf15e 100644 --- a/man/myisamchk.1 +++ b/man/myisamchk.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYISAMCHK\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMYISAMCHK\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/myisamlog.1 b/man/myisamlog.1 index 0d063e0a046b4..ce8f8c6011b5b 100644 --- a/man/myisamlog.1 +++ b/man/myisamlog.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYISAMLOG\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMYISAMLOG\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/myisampack.1 b/man/myisampack.1 index b46fef85f3838..551c4a6088a02 100644 --- a/man/myisampack.1 +++ b/man/myisampack.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYISAMPACK\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMYISAMPACK\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/myrocks_hotbackup.1 b/man/myrocks_hotbackup.1 index b5f07a3a91384..7e6384ea2c19d 100644 --- a/man/myrocks_hotbackup.1 +++ b/man/myrocks_hotbackup.1 @@ -1,4 +1,4 @@ -.TH MYROCKS_HOTBACKUP "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH MYROCKS_HOTBACKUP "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .SH NAME myrocks_hotbackup \- streaming backup for MariaDB MyRocks .SH DESCRIPTION diff --git a/man/mysql-stress-test.pl.1 b/man/mysql-stress-test.pl.1 index d69f61234889b..f36b65f352e47 100644 --- a/man/mysql-stress-test.pl.1 +++ b/man/mysql-stress-test.pl.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL\-STRESS\-TE" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMYSQL\-STRESS\-TE" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql-test-run.pl.1 b/man/mysql-test-run.pl.1 index b13727c329848..1e45e65190f2f 100644 --- a/man/mysql-test-run.pl.1 +++ b/man/mysql-test-run.pl.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL\-TEST\-RUN\" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMYSQL\-TEST\-RUN\" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql.1 b/man/mysql.1 index 4bc35938f6cde..80a7c8cd36052 100644 --- a/man/mysql.1 +++ b/man/mysql.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -18,7 +18,7 @@ .\" SQL scripts .\" batch SQL files .SH "NAME" -mysql \- the MariaDB command\-line tool +mariadb \- the MariaDB command\-line tool (mysql is now a symlink to mariadb) .SH "SYNOPSIS" .HP \w'\fBmysql\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\ 'u \fBmysql [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR @@ -507,6 +507,21 @@ the section called \(lqMYSQL COMMANDS\(rq\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysql: enable cleartext plugin option +.\" enable cleartext plugin option: mysql +\fB\-\-enable\-cleartext\-plugin\fR +.sp +Obsolete option\&. Exists only for MySQL compatibility\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql: execute option .\" execute option: mysql \fB\-\-execute=\fR\fB\fIstatement\fR\fR, diff --git a/man/mysql.server.1 b/man/mysql.server.1 index 4b99aadb0b326..1b2582052f032 100644 --- a/man/mysql.server.1 +++ b/man/mysql.server.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL\&.SERVER\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMYSQL\&.SERVER\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql_client_test.1 b/man/mysql_client_test.1 index 70ce1f720b7b2..2ed454a19a331 100644 --- a/man/mysql_client_test.1 +++ b/man/mysql_client_test.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_CLIENT_TEST" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-CLIENT-TEST" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -14,9 +14,9 @@ .\" mysql_client_test .\" mysql_client_test_embedded .SH "NAME" -mysql_client_test \- test client API +mariadb-client-test \- test client API (mysql_client_test is now a symlink to mariadb-client-test) .br -mysql_client_test_embedded \- test client API for embedded server +mariadb-client-test-embedded \- test client API for embedded server (mysql_client_test_embedded is now a symlink to mariadb-client-test-embedded) .SH "SYNOPSIS" .HP \w'\fBmysql_client_test\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fItest_name\fR\fR\fB]\ \&.\&.\&.\fR\ 'u \fBmysql_client_test [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fItest_name\fR\fR\fB] \&.\&.\&.\fR diff --git a/man/mysql_config.1 b/man/mysql_config.1 index 90b09cb5d4b45..579acdd7a8470 100644 --- a/man/mysql_config.1 +++ b/man/mysql_config.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_CONFIG\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMYSQL_CONFIG\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql_convert_table_format.1 b/man/mysql_convert_table_format.1 index 2d31bdcb0fb51..df811abe02d00 100644 --- a/man/mysql_convert_table_format.1 +++ b/man/mysql_convert_table_format.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_CONVERT_TAB" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-CONVERT-TAB" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -13,7 +13,7 @@ .\" ----------------------------------------------------------------- .\" mysql_convert_table_format .SH "NAME" -mysql_convert_table_format \- convert tables to use a given storage engine +mariadb-convert-table-format \- convert tables to use a given storage engine (mysql_convert_table_format is now a symlink to mariadb-convert-table-format) .SH "SYNOPSIS" .HP \w'\fBmysql_convert_table_format\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\ 'u \fBmysql_convert_table_format [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR diff --git a/man/mysql_find_rows.1 b/man/mysql_find_rows.1 index b69322e4abbaf..b711460102e7d 100644 --- a/man/mysql_find_rows.1 +++ b/man/mysql_find_rows.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_FIND_ROWS\F" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-FIND-ROWS\F" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -13,7 +13,7 @@ .\" ----------------------------------------------------------------- .\" mysql_find_rows .SH "NAME" -mysql_find_rows \- extract SQL statements from files +mariadb-find-rows \- extract SQL statements from files (mysql_find_rows is now a symlink to mariadb-find-rows) .SH "SYNOPSIS" .HP \w'\fBmysql_find_rows\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIfile_name\fR\fR\fB\ \&.\&.\&.]\fR\ 'u \fBmysql_find_rows [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIfile_name\fR\fR\fB \&.\&.\&.]\fR diff --git a/man/mysql_fix_extensions.1 b/man/mysql_fix_extensions.1 index bad341ab694af..d19bc82123262 100644 --- a/man/mysql_fix_extensions.1 +++ b/man/mysql_fix_extensions.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_FIX_EXTENSI" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-FIX-EXTENSI" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -13,7 +13,7 @@ .\" ----------------------------------------------------------------- .\" mysql_fix_extensions .SH "NAME" -mysql_fix_extensions \- normalize table file name extensions +mariadb-fix-extensions \- normalize table file name extensions (mysql_fix_extensions is now a symlink to mariadb-fix-extensions) .SH "SYNOPSIS" .HP \w'\fBmysql_fix_extensions\ \fR\fB\fIdata_dir\fR\fR\ 'u \fBmysql_fix_extensions \fR\fB\fIdata_dir\fR\fR diff --git a/man/mysql_install_db.1 b/man/mysql_install_db.1 index 237efaef9df8e..27369057a8d19 100644 --- a/man/mysql_install_db.1 +++ b/man/mysql_install_db.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_INSTALL_DB\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-INSTALL-DB\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -13,7 +13,7 @@ .\" ----------------------------------------------------------------- .\" mysql_install_db .SH "NAME" -mysql_install_db \- initialize MariaDB data directory +mariadb-install-db \- initialize MariaDB data directory (mysql_install_db is now a symlink to mariadb-install-db) .SH "SYNOPSIS" .HP \w'\fBmysql_install_db\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u \fBmysql_install_db [\fR\fB\fIoptions\fR\fR\fB]\fR diff --git a/man/mysql_ldb.1 b/man/mysql_ldb.1 index 8595ab5e3195d..783c49eb0529e 100644 --- a/man/mysql_ldb.1 +++ b/man/mysql_ldb.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_LDB\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-LDB\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -9,7 +9,7 @@ .\" disable justification (adjust text to left margin only) .ad l .SH NAME -mysql_ldb \- RocksDB tool +mariadb-ldb \- RocksDB tool (mysql_ldb is now a symlink to mariadb-ldb) .SH DESCRIPTION Use \fBmysql_ldb \-\-help\fR for details on usage\. .PP diff --git a/man/mysql_plugin.1 b/man/mysql_plugin.1 index 6e002f2021db8..0e60671478bd8 100644 --- a/man/mysql_plugin.1 +++ b/man/mysql_plugin.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_PLUGIN\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-PLUGIN\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -22,7 +22,7 @@ .\" ----------------------------------------------------------------- .\" mysql_plugin .SH "NAME" -mysql_plugin \- configure MariaDB server plugins +mariadb-plugin \- configure MariaDB server plugins (mysql_plugin is now a symlink to mariadb-plugin) .SH "SYNOPSIS" .HP \w'\fBmysql_plugin\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIplugin\fR\fR\fB\ {ENABLE|DISABLE}\fR\ 'u \fBmysql_plugin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIplugin\fR\fR\fB {ENABLE|DISABLE}\fR diff --git a/man/mysql_secure_installation.1 b/man/mysql_secure_installation.1 index ca7f52cd30e4a..32540c56209d0 100644 --- a/man/mysql_secure_installation.1 +++ b/man/mysql_secure_installation.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_SECURE_INST" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-SECURE-INST" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -13,7 +13,7 @@ .\" ----------------------------------------------------------------- .\" mysql_secure_installation .SH "NAME" -mysql_secure_installation \- improve MariaDB installation security +mariadb-secure-installation \- improve MariaDB installation security (mysql_secure_installation is now a symlink to mariadb-secure-installation) .SH "SYNOPSIS" .HP \w'\fBmysql_secure_installation\fR\ 'u \fBmysql_secure_installation\fR diff --git a/man/mysql_setpermission.1 b/man/mysql_setpermission.1 index 4ab0ba5ff1e74..b23ac9f715615 100644 --- a/man/mysql_setpermission.1 +++ b/man/mysql_setpermission.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_SETPERMISSI" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-SETPERMISSI" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -13,7 +13,7 @@ .\" ----------------------------------------------------------------- .\" mysql_setpermission .SH "NAME" -mysql_setpermission \- interactively set permissions in grant tables +mariadb-setpermission \- interactively set permissions in grant tables (mysql_setpermission is now a symlink to mariadb-setpermission) .SH "SYNOPSIS" .HP \w'\fBmysql_setpermission\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u \fBmysql_setpermission [\fR\fB\fIoptions\fR\fR\fB]\fR diff --git a/man/mysql_tzinfo_to_sql.1 b/man/mysql_tzinfo_to_sql.1 index 544180a42ecdc..e07442e30b1b9 100644 --- a/man/mysql_tzinfo_to_sql.1 +++ b/man/mysql_tzinfo_to_sql.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_TZINFO_TO_S" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-TZINFO-TO-S" "1" "22 April 2022" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -14,7 +14,7 @@ .\" mysql_tzinfo_to_sql .\" time zone tables .SH "NAME" -mysql_tzinfo_to_sql \- load the time zone tables +mariadb-tzinfo-to-sql \- load the time zone tables (mysql_tzinfo_to_sql is now a symlink to mariadb-tzinfo-to-sql) .SH "SYNOPSIS" .HP \w'\fBmysql_tzinfo_to_sql\ \fR\fB\fIarguments\fR\fR\ 'u \fBmysql_tzinfo_to_sql \fR\fB\fIarguments\fR\fR @@ -41,6 +41,7 @@ can be invoked several ways: shell> \fBmysql_tzinfo_to_sql \fR\fB\fItz_dir\fR\fR shell> \fBmysql_tzinfo_to_sql \fR\fB\fItz_file tz_name\fR\fR shell> \fBmysql_tzinfo_to_sql \-\-leap \fR\fB\fItz_file\fR\fR +shell> \fBmysql_tzinfo_to_sql \-\-skip\-write\-binlog \fR\fB\fItz_dir\fR\fR .fi .if n \{\ .RE @@ -100,6 +101,9 @@ shell> \fBmysql_tzinfo_to_sql \-\-leap \fR\fB\fItz_file\fR\fR\fB | mysql \-u roo .RE .\} .PP +Using the \-\-skip\-write\-binlog option prevents writing of changes to the binary log or to other Galera +cluster members. This can be used with any form of running \fBmysql_tzinfo_to_sql\fR. +.PP After running \fBmysql_tzinfo_to_sql\fR, it is best to restart the server so that it does not continue to use any previously cached time zone data\&. .SH "COPYRIGHT" diff --git a/man/mysql_upgrade.1 b/man/mysql_upgrade.1 index c60c0a208bfbf..0b48f0394840c 100644 --- a/man/mysql_upgrade.1 +++ b/man/mysql_upgrade.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_UPGRADE\FR" "1" "20 July 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-UPGRADE\FR" "1" "20 July 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -15,7 +15,7 @@ .\" upgrading MySQL .\" MySQL: upgrading .SH "NAME" -mysql_upgrade \- check tables for MariaDB upgrade +mariadb-upgrade \- check tables for MariaDB upgrade (mysql_upgrade is now a symlink to mariadb-upgrade) .SH "SYNOPSIS" .HP \w'\fBmysql_upgrade\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u \fBmysql_upgrade [\fR\fB\fIoptions\fR\fR\fB]\fR @@ -239,6 +239,21 @@ Old option accepted for backward compatibility but ignored\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysql_upgrade: check-if-upgrade-is-needed option +.\" check-if-upgrade-is-needed option: mysql_upgrade +\fB\-\-check\-if\-upgrade\-is\-needed\fR +.sp +Exit with a status code indicating if an upgrade is needed\&. Returns 0 if upgrade needed or current version couldn't be determined, 1 when no action required\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql_upgrade: datadir option .\" datadir option: mysql_upgrade \fB\-\-datadir=\fR\fB\fIpath\fR\fR @@ -641,7 +656,8 @@ The MariaDB user name to use when connecting to the server and not using the cur Display more output about the process\&. Using it twice will print connection arguments; using it 3 times will print out all CHECK, RENAME and ALTER TABLE commands used during the check phase; using it 4 times (added in MariaDB 10.0.14) -will also write out all mysqlcheck commands used\&. +will also write out all mariadb-check commands used; using it 5 times will print all +the mariadb commands used and their results while running mysql_fix_privilege_tables script\&. .RE .sp .RS 4 diff --git a/man/mysql_waitpid.1 b/man/mysql_waitpid.1 index 330687ea3e4ea..2502d66c5a757 100644 --- a/man/mysql_waitpid.1 +++ b/man/mysql_waitpid.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_WAITPID\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-WAITPID\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -13,7 +13,7 @@ .\" ----------------------------------------------------------------- .\" mysql_waitpid .SH "NAME" -mysql_waitpid \- kill process and wait for its termination +mariadb-waitpid \- kill process and wait for its termination (mysql_waitpid is now a symlink to mariadb-waitpid) .SH "SYNOPSIS" .HP \w'\fBmysql_waitpid\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIpid\fR\fR\fB\ \fR\fB\fIwait_time\fR\fR\ 'u \fBmysql_waitpid [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIpid\fR\fR\fB \fR\fB\fIwait_time\fR\fR diff --git a/man/mysqlaccess.1 b/man/mysqlaccess.1 index e14de4791e287..c77ee4276dd9c 100644 --- a/man/mysqlaccess.1 +++ b/man/mysqlaccess.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLACCESS\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-ACCESS\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -13,7 +13,7 @@ .\" ----------------------------------------------------------------- .\" mysqlaccess .SH "NAME" -mysqlaccess \- client for checking access privileges +mariadb-access \- client for checking access privileges (mysqlaccess is now a symlink to mariadb-access) .SH "SYNOPSIS" .HP \w'\fBmysqlaccess\ [\fR\fB\fIhost_name\fR\fR\fB\ [\fR\fB\fIuser_name\fR\fR\fB\ [\fR\fB\fIdb_name\fR\fR\fB]]]\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u \fBmysqlaccess [\fR\fB\fIhost_name\fR\fR\fB [\fR\fB\fIuser_name\fR\fR\fB [\fR\fB\fIdb_name\fR\fR\fB]]] [\fR\fB\fIoptions\fR\fR\fB]\fR diff --git a/man/mysqladmin.1 b/man/mysqladmin.1 index aa77cd989fc87..f5af906596152 100644 --- a/man/mysqladmin.1 +++ b/man/mysqladmin.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLADMIN\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-ADMIN\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -15,7 +15,7 @@ .\" administration: server .\" server administration .SH "NAME" -mysqladmin \- client for administering a MariaB server +mariadb-admin \- client for administering a MariaDB server (mysqladmin is now a symlink to mariadb-admin) .SH "SYNOPSIS" .HP \w'\fBmysqladmin\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-arg\fR\fR\fB]\ [\fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-arg\fR\fR\fB]]\ \&.\&.\&.\fR\ 'u \fBmysqladmin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB] [\fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB]] \&.\&.\&.\fR diff --git a/man/mysqlbinlog.1 b/man/mysqlbinlog.1 index 633300bb7c52b..6efd08d10b149 100644 --- a/man/mysqlbinlog.1 +++ b/man/mysqlbinlog.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLBINLOG\FR" "1" "14 April 2021" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-BINLOG\FR" "1" "14 April 2021" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -13,7 +13,7 @@ .\" ----------------------------------------------------------------- .\" mysqlbinlog .SH "NAME" -mysqlbinlog \- utility for processing binary log files +mariadb-binlog \- utility for processing binary log files (mysqlbinlog is now a symlink to mariadb-binlog) .SH "SYNOPSIS" .HP \w'\fBmysqlbinlog\ [\fR\fBoptions\fR\fB]\ \fR\fB\fIlog_file\fR\fR\fB\ \&.\&.\&.\fR\ 'u \fBmysqlbinlog [\fR\fBoptions\fR\fB] \fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.\fR @@ -992,8 +992,15 @@ This option is useful for point\-in\-time recovery\&. \fB\-\-start\-position=\fR\fB\fIN\fR\fR, \fB\-j \fR\fB\fIN\fR\fR .sp -Start reading the binary log at the first event having a position equal to or greater than -\fIN\fR\&. This option applies to the first log file named on the command line\&. +Start reading the binary log at \fIN\fR\&. Type can either be a positive +integer or a GTID\& list\&. When using a positive integer, the value only +applies to the first binlog passed on the command line, and the first event +that has a position equal to or greater than \fIN\fR is printed\&. In GTID mode, +multiple GTIDs can be passed as a comma separated list, where each must have a +unique domain id\&. The list represents the gtid binlog state that the client +(another "replica" server) is aware of\&. Therefore, each GTID is exclusive; only +events after a given sequence number will be printed to allow users to receive +events after their current state\&. .sp This option is useful for point\-in\-time recovery\&. .RE @@ -1006,6 +1013,23 @@ This option is useful for point\-in\-time recovery\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlbinlog: gtid-strict-mode +.\" gtid-strict-mode option: mysqlbinlog +\fB\-\-gtid\-strict\-mode +.sp +Process binlog according to gtid-strict-mode specification\&. The start, stop +positions are verified to satisfy start < stop comparison condition\&. Sequence +numbers of any gtid domain must comprise monotically growing sequence\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlbinlog: stop-datetime option .\" stop-datetime option: mysqlbinlog \fB\-\-stop\-datetime=\fR\fB\fIdatetime\fR\fR @@ -1063,8 +1087,13 @@ The slave server_id used for \fB--read-from-remote-server --stop-never\fR\&. .\" stop-position option: mysqlbinlog \fB\-\-stop\-position=\fR\fB\fIN\fR\fR .sp -Stop reading the binary log at the first event having a position equal to or greater than -\fIN\fR\&. This option applies to the last log file named on the command line\&. +Stop reading the binary log at the first event having a position equal to or +greater than \fIN\fR\&. Type can either be a positive integer or a GTID +list\&. When using a positive integer, the value only applies to the last log +file named on the command line\&. When in GTID mode, multiple GTIDs can be +passed as a comma separated list, where each must have a unique domain id\&. +Each GTID is inclusive; only events up to the given sequence numbers are +printed. .sp This option is useful for point\-in\-time recovery\&. .RE @@ -1133,6 +1162,7 @@ The MariaDB username to use when connecting to a remote server\&. \fB\-v\fR .sp Reconstruct row events and display them as commented SQL statements\&. If this option is given twice, the output includes comments to indicate column data types and some metadata\&. +If this option is given three times, the output includes diagnostic warnings about event integrity before program exit\&. .sp For examples that show the effect of \fB\-\-base64\-output\fR diff --git a/man/mysqlcheck.1 b/man/mysqlcheck.1 index b8f102a27a48f..250fe0017a79b 100644 --- a/man/mysqlcheck.1 +++ b/man/mysqlcheck.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLCHECK\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-CHECK\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -17,7 +17,7 @@ .\" tables: maintenance .\" tables: repair .SH "NAME" -mysqlcheck \- a table maintenance program +mariadb-check \- a table maintenance program (mysqlcheck is now a symlink to mariadb-check) .SH "SYNOPSIS" .HP \w'\fBmysqlcheck\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ \&.\&.\&.]]\fR\ 'u \fBmysqlcheck [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]]\fR diff --git a/man/mysqld.8 b/man/mysqld.8 index ffa746edd64b6..b04271ab4d6a8 100644 --- a/man/mysqld.8 +++ b/man/mysqld.8 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLD\FR" "8" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADBD\FR" "8" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -14,7 +14,7 @@ .\" mysqld: MariaDB server .\" MariaDB server: mysqld .SH "NAME" -mysqld \- the MariaDB server +mariadbd \- the MariaDB server (mysqld is now a symlink to mariadbd) .SH "SYNOPSIS" .HP \w'\fBmysqld\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u \fBmysqld [\fR\fB\fIoptions\fR\fR\fB]\fR diff --git a/man/mysqld_multi.1 b/man/mysqld_multi.1 index d4e5e08efa913..c88ce6e492488 100644 --- a/man/mysqld_multi.1 +++ b/man/mysqld_multi.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLD_MULTI\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADBD-MULTI\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -16,7 +16,7 @@ .\" scripts .\" multi mysqld .SH "NAME" -mysqld_multi \- manage multiple MariaDB servers +mariadbd-multi \- manage multiple MariaDB servers (mysqld_multi is now a symlink to mariadbd-multi) .SH "SYNOPSIS" .HP \w'\fBmysqld_multi\ [\fR\fB\fIoptions\fR\fR\fB]\ {start|stop|report}\ [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB]\ \&.\&.\&.]\fR\ 'u \fBmysqld_multi [\fR\fB\fIoptions\fR\fR\fB] {start|stop|report} [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB] \&.\&.\&.]\fR diff --git a/man/mysqld_safe.1 b/man/mysqld_safe.1 index ff3b835609566..1fdf23a097032 100644 --- a/man/mysqld_safe.1 +++ b/man/mysqld_safe.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLD_SAFE\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADBD-SAFE\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -15,7 +15,7 @@ .\" tools: mysqld_safe .\" scripts .SH "NAME" -mysqld_safe \- MariaDB server startup script +mariadbd-safe \- MariaDB server startup script (mysqld_safe is now a symlink to mariadbd-safe) .SH "SYNOPSIS" .HP \w'\fBmysqld_safe\ \fR\fB\fIoptions\fR\fR\ 'u \fBmysqld_safe \fR\fB\fIoptions\fR\fR @@ -340,7 +340,9 @@ program to set the server\'s scheduling priority to the given value\&. .\} .\" mysqld_safe: no-auto-restart option .\" no-auto-restart option: mysqld_safe -\fB\-\-no\-auto\-restart\fR +\fB\-\-no\-auto\-restart\fR, +\fB\-\-nowatch\fR, +\fB\-\-no\-watch\fR .sp Exit after starting mysqld\&. .RE @@ -368,21 +370,6 @@ Do not read any option files\&. This must be the first option on the command lin .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: no-watch option -.\" no-watch option: mysqld_safe -\fB\-\-no\-auto\-restart\fR -.sp -Exit after starting mysqld\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} .\" mysqld_safe: numa-interleave option .\" numa-interleave option: mysqld_safe \fB\-\-numa\-interleave\fR diff --git a/man/mysqld_safe_helper.1 b/man/mysqld_safe_helper.1 index f8fc0fc46683d..b24ccde8b8897 100644 --- a/man/mysqld_safe_helper.1 +++ b/man/mysqld_safe_helper.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLD_SAFE_HELPER\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADBD-SAFE-HELPER\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -9,7 +9,7 @@ .\" disable justification (adjust text to left margin only) .ad l .SH NAME -mysqld_safe_helper \- helper script +mariadbd-safe-helper \- helper script (mysqld_safe_helper is now a symlink to mariadbd-safe-helper) .SH DESCRIPTION Use: Helper script\. .PP diff --git a/man/mysqldump.1 b/man/mysqldump.1 index ad4b167c7b895..21203f9d7cb65 100644 --- a/man/mysqldump.1 +++ b/man/mysqldump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLDUMP\FR" "1" "24 October 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-DUMP\FR" "1" "24 October 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -17,7 +17,7 @@ .\" databases: dumping .\" tables: dumping .SH "NAME" -mysqldump \- a database backup program +mariadb-dump \- a database backup program (mysqldump is now a symlink to mariadb-dump) .SH "SYNOPSIS" .HP \w'\fBmysqldump\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ \&.\&.\&.]]\fR\ 'u \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]]\fR @@ -1377,6 +1377,21 @@ Sets the maximum packet length to send to or receive from server\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqldump: max-statement-time option +.\" max-statement-time option: mysqldump +\fB\-\-max\-statement\-time=\fR\fB\fIseconds\fR\fR +.sp +Sets the maximum time any statement can run before being timed out by the server. (Default value is 0 (no limit))\& +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqldump: net-buffer-length option .\" net-buffer-length option: mysqldump \fB\-\-net\-buffer\-length=\fR\fB\fIlength\fR\fR @@ -2637,6 +2652,21 @@ The maximum size of the buffer for client/server communication\&. The maximum is .sp -1 .IP \(bu 2.3 .\} +max_statement_time +.sp +A query that has taken more than max_statement_time seconds will be aborted and the backup will +fail\&. The argument will be treated as a decimal value with microsecond precision\&. A value +of 0 (default) means no timeout\&. The maximum timeout is 31536000 seconds\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} net_buffer_length .sp The initial size of the buffer for client/server communication\&. When creating multiple\-row diff --git a/man/mysqldumpslow.1 b/man/mysqldumpslow.1 index d5da746a2935d..164209db3004b 100644 --- a/man/mysqldumpslow.1 +++ b/man/mysqldumpslow.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLDUMPSLOW\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-DUMPSLOW\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -13,7 +13,7 @@ .\" ----------------------------------------------------------------- .\" mysqldumpslow .SH "NAME" -mysqldumpslow \- Summarize slow query log files +mariadb-dumpslow \- Summarize slow query log files (mysqldumpslow is now a symlink to mariadb-dumpslow) .SH "SYNOPSIS" .HP \w'\fBmysqldumpslow\ [\fR\fBoptions\fR\fB]\ [\fR\fB\fIlog_file\fR\fR\fB\ \&.\&.\&.]\fR\ 'u \fBmysqldumpslow [\fR\fBoptions\fR\fB] [\fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.]\fR diff --git a/man/mysqlhotcopy.1 b/man/mysqlhotcopy.1 index 462e2f970624c..5193abc3e87ee 100644 --- a/man/mysqlhotcopy.1 +++ b/man/mysqlhotcopy.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLHOTCOPY\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-HOTCOPY\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -17,7 +17,7 @@ .\" databases: dumping .\" tables: dumping .SH "NAME" -mysqlhotcopy \- a database backup program +mariadb-hotcopy \- a database backup program (mysqlhotcopy is now a symlink to mariadb-hotcopy) .SH "SYNOPSIS" .HP \w'\fBmysqlhotcopy\ \fR\fB\fIarguments\fR\fR\ 'u \fBmysqlhotcopy \fR\fB\fIarguments\fR\fR diff --git a/man/mysqlimport.1 b/man/mysqlimport.1 index b7999166d328f..32ab3c01574fa 100644 --- a/man/mysqlimport.1 +++ b/man/mysqlimport.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLIMPORT\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-IMPORT\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -17,7 +17,7 @@ .\" files: text .\" text files: importing .SH "NAME" -mysqlimport \- a data import program +mariadb-import \- a data import program (mysqlimport is now a symlink to mariadb-import) .SH "SYNOPSIS" .HP \w'\fBmysqlimport\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\fB\ \fR\fB\fItextfile1\fR\fR\fB\ \&.\&.\&.\fR\ 'u \fBmysqlimport [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB \fR\fB\fItextfile1\fR\fR\fB \&.\&.\&.\fR diff --git a/man/mysqlshow.1 b/man/mysqlshow.1 index f20ac9fed6340..fdea9f5842dd0 100644 --- a/man/mysqlshow.1 +++ b/man/mysqlshow.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLSHOW\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-SHOW\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -18,7 +18,7 @@ .\" columns: displaying .\" showing: database information .SH "NAME" -mysqlshow \- display database, table, and column information +mariadb-show \- display database, table, and column information (mysqlshow is now a symlink to mariadb-show) .SH "SYNOPSIS" .HP \w'\fBmysqlshow\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ [\fR\fB\fIcol_name\fR\fR\fB]]]\fR\ 'u \fBmysqlshow [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB [\fR\fB\fIcol_name\fR\fR\fB]]]\fR diff --git a/man/mysqlslap.1 b/man/mysqlslap.1 index 4f31489dead14..a3c7191bc2203 100644 --- a/man/mysqlslap.1 +++ b/man/mysqlslap.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLSLAP\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-SLAP\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -14,7 +14,7 @@ .\" mysqlslap .\" load emulation .SH "NAME" -mysqlslap \- load emulation client +mariadb-slap \- load emulation client (mysqlslap is now a symlink to mariadb-slap) .SH "SYNOPSIS" .HP \w'\fBmysqlslap\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u \fBmysqlslap [\fR\fB\fIoptions\fR\fR\fB]\fR diff --git a/man/mysqltest.1 b/man/mysqltest.1 index 57a05521498ec..56bb1996e6963 100644 --- a/man/mysqltest.1 +++ b/man/mysqltest.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLTEST\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMARIADB-TEST\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -14,7 +14,7 @@ .\" mysqltest .\" mysqltest_embedded .SH "NAME" -mysqltest \- program to run test cases +mariadb-test \- program to run test cases (mysqltest is now a symlink to mariadb-test) .br mysqltest_embedded \- program to run embedded test cases .SH "SYNOPSIS" diff --git a/man/mytop.1 b/man/mytop.1 index a68413b5af06a..32c7639975b0a 100644 --- a/man/mytop.1 +++ b/man/mytop.1 @@ -1,4 +1,4 @@ -.TH MYTOP "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH MYTOP "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .SH NAME mytop \- display MariaDB server performance info like 'top' .SH "SEE ALSO" diff --git a/man/perror.1 b/man/perror.1 index 2094608d0a210..4f80aad3b6a81 100644 --- a/man/perror.1 +++ b/man/perror.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBPERROR\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBPERROR\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/replace.1 b/man/replace.1 index 701a72ac36043..c9ffd89881534 100644 --- a/man/replace.1 +++ b/man/replace.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBREPLACE\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBREPLACE\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/resolve_stack_dump.1 b/man/resolve_stack_dump.1 index ad61f45fd096e..e36090727c45e 100644 --- a/man/resolve_stack_dump.1 +++ b/man/resolve_stack_dump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBRESOLVE_STACK_DUM" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBRESOLVE_STACK_DUM" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/resolveip.1 b/man/resolveip.1 index cc13e58b70fc2..eedee2434ce84 100644 --- a/man/resolveip.1 +++ b/man/resolveip.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBRESOLVEIP\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBRESOLVEIP\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_common.1 b/man/wsrep_sst_common.1 index 8323011aaa1c8..c2e071fd429f4 100644 --- a/man/wsrep_sst_common.1 +++ b/man/wsrep_sst_common.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBWSREP_SST_COMMON\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBWSREP_SST_COMMON\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_mariabackup.1 b/man/wsrep_sst_mariabackup.1 index 83e4e43907ea7..0c15ddb82fe3d 100644 --- a/man/wsrep_sst_mariabackup.1 +++ b/man/wsrep_sst_mariabackup.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBWSREP_SST_MARIABACKUP\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBWSREP_SST_MARIABACKUP\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_mysqldump.1 b/man/wsrep_sst_mysqldump.1 index 78eef3bd0f36d..2ea657cbc2fae 100644 --- a/man/wsrep_sst_mysqldump.1 +++ b/man/wsrep_sst_mysqldump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBWSREP_SST_MYSQLDUMP\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBWSREP_SST_MYSQLDUMP\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_rsync.1 b/man/wsrep_sst_rsync.1 index c3225d58d9f2f..709885aa3999c 100644 --- a/man/wsrep_sst_rsync.1 +++ b/man/wsrep_sst_rsync.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBWSREP_SST_RSYNC\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBWSREP_SST_RSYNC\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_rsync_wan.1 b/man/wsrep_sst_rsync_wan.1 index a81933449ea9e..98e93a77b6586 100644 --- a/man/wsrep_sst_rsync_wan.1 +++ b/man/wsrep_sst_rsync_wan.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBWSREP_SST_RSYNC_WAN\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBWSREP_SST_RSYNC_WAN\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/mysql-test/README b/mysql-test/README index 14e9b3647ac31..ae1d6d564337a 100644 --- a/mysql-test/README +++ b/mysql-test/README @@ -90,7 +90,7 @@ https://mariadb.org/jira/. If the test case is really big or if it contains 'not public' data, then put your .test file and .result file(s) into a tar.gz archive, add a README that explains the problem, ftp the archive to -ftp://ftp.askmonty.org/private and submit a report to +ftp://ftp.mariadb.org/private and submit a report to https://mariadb.org/jira about it. The latest information about mysql-test-run can be found at: diff --git a/mysql-test/README-gcov b/mysql-test/README-gcov index ba22a7964234d..64a97ce47e2d8 100644 --- a/mysql-test/README-gcov +++ b/mysql-test/README-gcov @@ -2,14 +2,7 @@ To be able to see the level of coverage with the current test suite, do the following: - Make sure gcov is installed - - Compile the MySQL distribution with BUILD/compile-pentium64-gcov (if your - machine does not have a pentium CPU, hack this script, or just live with - the pentium-specific stuff) - - In the mysql-test directory, run this command: ./mysql-test-run -gcov - - To see the level of coverage for a given source file: - grep -1 source_file_name ../mysql-test-gcov.msg - - To see which lines are not yet covered, look at source_file_name.gcov in - the source tree. You can find this by doing something like: - find source-directory -name "mysqld.cc.gcov" - Then think hard about a test case that will cover those lines, and write - one! + - Compile the MariaDB distribution with -DENABLE_GCOV=1 + - In the mysql-test directory, run this command: `./mysql-test-run --gcov` + - see var/last_changes.dgcov for the coverage of uncommitted code + - see `./dgcov -h` for more options diff --git a/mysql-test/collections/buildbot_suites.bat b/mysql-test/collections/buildbot_suites.bat index 0ec8e4b99392f..d4a6e66584003 100644 --- a/mysql-test/collections/buildbot_suites.bat +++ b/mysql-test/collections/buildbot_suites.bat @@ -1,4 +1,5 @@ -perl mysql-test-run.pl --verbose-restart --force --suite-timeout=120 --max-test-fail=10 --retry=3 --parallel=4 --suite=^ +if "%MTR_PARALLEL%"=="" set MTR_PARALLEL=%NUMBER_OF_PROCESSORS% +perl mysql-test-run.pl --verbose-restart --force --suite-timeout=120 --max-test-fail=10 --retry=3 --suite=^ vcol,gcol,perfschema,^ main,^ innodb,^ diff --git a/mysql-test/collections/skip_list_ubsan.txt b/mysql-test/collections/skip_list_ubsan.txt new file mode 100644 index 0000000000000..dc17857429338 --- /dev/null +++ b/mysql-test/collections/skip_list_ubsan.txt @@ -0,0 +1,3 @@ +binlog.binlog_truncate_active_log : MDEV-26919 - undefined value +main.json_normalize : MDEV-27415 - out of bounds +main.json_equals : MDEV-27415 - out of bounds diff --git a/mysql-test/dgcov.pl b/mysql-test/dgcov.pl index 639f3a5b72a10..679529d9abef9 100755 --- a/mysql-test/dgcov.pl +++ b/mysql-test/dgcov.pl @@ -36,6 +36,7 @@ my %cov; my $file_no=0; +Getopt::Long::Configure ("bundling"); GetOptions ("v|verbose+" => \$opt_verbose, "h|help" => \$opt_help, @@ -62,13 +63,16 @@ my $cmd; if ($opt_purge) { - $cmd= "find . -name '*.da' -o -name '*.gcda' -o -name '*.gcov' -o ". + $cmd= "find . -name '*.da' -o -name '*.gcda*' -o -name '*.gcov' -o ". "-name '*.dgcov' | xargs rm -f ''"; logv "Running: $cmd"; system($cmd)==0 or die "system($cmd): $? $!"; exit 0; } +my $gcc_version= `gcc -dumpversion`; +$gcc_version=~ s/^(\d+).*$/$1/ or die "Cannot parse gcc -dumpversion: $gcc_version"; + find(\&gcov_one_file, $root); find(\&write_coverage, $root) if $opt_generate; exit 0 if $opt_only_gcov; @@ -167,26 +171,43 @@ sub gcov_one_file { { return; } - for my $gcov_file (<$_*.gcov>) { - open FH, '<', "$gcov_file_path" or die "open(<$gcov_file_path): $!"; - my $fname; - while () { - chomp; - if (/^function:/) { - next; - } - if (/^file:/) { - $fname=realpath(-f $' ? $' : $root.$'); - next; + # now, read the generated file + if ($gcc_version <9){ + for my $gcov_file (<$_*.gcov>) { + open FH, '<', "$gcov_file_path" or die "open(<$gcov_file_path): $!"; + my $fname; + while () { + chomp; + if (/^function:/) { + next; + } + if (/^file:/) { + $fname=realpath(-f $' ? $' : $root.$'); + next; + } + next if /^lcount:\d+,-\d+/; # whatever that means + unless (/^lcount:(\d+),(\d+)/ and $fname) { + warn "unknown line '$_' in $gcov_file_path"; + next; + } + $cov{$fname}->{$1}+=$2; } - next if /^lcount:\d+,-\d+/; # whatever that means - unless (/^lcount:(\d+),(\d+)/ and $fname) { - warn "unknown line '$_' in $gcov_file"; - next; + close(FH); + } + } else { + require IO::Uncompress::Gunzip; + require JSON::PP; + no warnings 'once'; + my $gcov_file_json; + s/\.gcda$// if $gcc_version >= 11; + IO::Uncompress::Gunzip::gunzip("$_.gcov.json.gz", \$gcov_file_json) + or die "gunzip($_.gcov.json.gz): $IO::Uncompress::Gunzip::GunzipError"; + my $obj= JSON::PP::decode_json $gcov_file_json; + for my $file (@{$obj->{files}}) { + for my $line (@{$file->{lines}}){ + $cov{$file->{file}}->{$line->{line_number}}+= $line->{count}; } - $cov{$fname}->{$1}+=$2; } - close(FH); } } diff --git a/mysql-test/include/analyze-format.inc b/mysql-test/include/analyze-format.inc index 7e18524e44eef..330be82ef9633 100644 --- a/mysql-test/include/analyze-format.inc +++ b/mysql-test/include/analyze-format.inc @@ -1,3 +1,3 @@ # The time on ANALYSE FORMAT=JSON is rather variable ---replace_regex /("(r_total_time_ms|r_table_time_ms|r_other_time_ms|r_buffer_size|r_filling_time_ms)": )[^, \n]*/\1"REPLACED"/ +--replace_regex /("(r_[a-z_]*_time_ms|r_buffer_size)": )[^, \n]*/\1"REPLACED"/ diff --git a/mysql-test/include/concurrent.inc b/mysql-test/include/concurrent.inc index 5425f144d1dbd..0a49ae13d4b41 100644 --- a/mysql-test/include/concurrent.inc +++ b/mysql-test/include/concurrent.inc @@ -55,6 +55,7 @@ GRANT USAGE ON test.* TO mysqltest@localhost; --echo ** --echo ** two UPDATE's running and both changing distinct result sets --echo ** +--disable_view_protocol connect (thread1, localhost, mysqltest,,); connection thread1; --echo ** Set up table @@ -140,7 +141,6 @@ GRANT USAGE ON test.* TO mysqltest@localhost; connection default; drop table t1; - --echo --echo ** --echo ** two UPDATE's running and one changing result set @@ -228,7 +228,7 @@ drop table t1; connection default; drop table t1; - +--enable_view_protocol --echo --echo ** @@ -306,8 +306,9 @@ drop table t1; --echo ** Begin a new transaction on thread 2 begin; --echo ** Select a range for update. + --disable_view_protocol select * from t1 where tipo=2 FOR UPDATE; - + --enable_view_protocol connection thread1; --echo ** Begin a new transaction on thread 1 begin; @@ -346,6 +347,7 @@ drop table t1; --echo ** --echo ** one UPDATE not changing result set and SELECT ... FOR UPDATE --echo ** +--disable_view_protocol #connect (thread1, localhost, mysqltest,,); connection thread1; --echo ** Set up table @@ -369,7 +371,6 @@ drop table t1; begin; --echo ** Starting SELECT .. FOR UPDATE select * from t1 where tipo=2 FOR UPDATE; - connection thread1; --echo --echo ** Starting new transaction on thread 1 @@ -439,14 +440,15 @@ drop table t1; --echo ** Begin a new transaction on thread 2 begin; select * from t1 where tipo=2 FOR UPDATE; - connection thread1; --echo ** Begin a new transaction on thread 1 begin; --echo ** Selecting a range for update by table scan will be blocked --echo ** because of on-going transaction on thread 2. + --disable_view_protocol --error ER_LOCK_WAIT_TIMEOUT - select * from t1 where tipo=1 FOR UPDATE; + select * from t1 where tipo=1 FOR UPDATE; + --enable_view_protocol connection thread2; --echo ** Table will be unchanged and the select command will not be @@ -469,7 +471,7 @@ drop table t1; connection default; drop table t1; - +--enable_view_protocol --echo --echo ** @@ -555,7 +557,7 @@ drop table t1; # succeding update in the following thread. Also the used status variables '%lock%' and # 'innodb_deleted_rows' and infos in processlist where not sucessful. sleep 1; - + --disable_view_protocol connection thread1; begin; --echo ** Update on t1 will cause a table scan which will be blocked because @@ -578,7 +580,7 @@ drop table t1; reap; select * from t1; send commit; - +--enable_view_protocol connection thread1; commit; diff --git a/mysql-test/include/count_sessions.inc b/mysql-test/include/count_sessions.inc index 4728e39ce74ea..65098e2731a94 100644 --- a/mysql-test/include/count_sessions.inc +++ b/mysql-test/include/count_sessions.inc @@ -18,4 +18,8 @@ # Created: 2009-01-14 mleich # +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + let $count_sessions= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); diff --git a/mysql-test/include/ctype_E05C.inc b/mysql-test/include/ctype_E05C.inc index 9ef35a989346f..7186104466472 100644 --- a/mysql-test/include/ctype_E05C.inc +++ b/mysql-test/include/ctype_E05C.inc @@ -81,6 +81,8 @@ DROP TABLE t1; # even if character_set_connection is big5/cp932/gbk/sjis. # Note, the other 0x5C which is before 0xE05C is also treated as escape. # +#check after fix MDEV-29290 +--disable_view_protocol SET character_set_client=binary, character_set_results=binary; SELECT @@character_set_client, @@character_set_connection, @@character_set_results; SELECT HEX('�\['), HEX('\�\['); @@ -105,7 +107,7 @@ SHOW CREATE TABLE t1; INSERT INTO t1 VALUES ('�\['),('\�\['); SELECT HEX(a) FROM t1; DROP TABLE t1; - +--enable_view_protocol --echo # Start of ctype_E05C.inc diff --git a/mysql-test/include/ctype_casefolding.inc b/mysql-test/include/ctype_casefolding.inc new file mode 100644 index 0000000000000..4ee402c95adf4 --- /dev/null +++ b/mysql-test/include/ctype_casefolding.inc @@ -0,0 +1,18 @@ +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +# Uncode code points that have a variable length case mapping in utf8 +# (e.g. LOWER('2-byte-character') -> '3-byte-character' +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +DROP TABLE case_folding; diff --git a/mysql-test/include/ctype_common.inc b/mysql-test/include/ctype_common.inc index 2b407fcb31a45..410e8824b21e2 100644 --- a/mysql-test/include/ctype_common.inc +++ b/mysql-test/include/ctype_common.inc @@ -67,10 +67,12 @@ drop table t1; --echo # --echo # MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found --echo # +--disable_service_connection SET character_set_client=latin1; SET character_set_connection= @test_character_set; SET collation_connection= @test_collation; SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1; +--enable_service_connection # # Bug#27580 SPACE() function collation bug? diff --git a/mysql-test/include/ctype_datetime.inc b/mysql-test/include/ctype_datetime.inc index f4ec2e81ea359..7fab2b18c1893 100644 --- a/mysql-test/include/ctype_datetime.inc +++ b/mysql-test/include/ctype_datetime.inc @@ -18,6 +18,8 @@ SET time_zone=default; # TODO: remove "--disable_ps_protocol" when MDEV-5444 is fixed --disable_ps_protocol +#remove "--disable_view_protocol" in 10.6 version +--disable_view_protocol SELECT CHARSET('2013-11-15 00:41:28' - INTERVAL 7 DAY); SELECT COERCIBILITY('2013-11-15 00:41:28' - INTERVAL 7 DAY); SELECT CHARSET(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY); @@ -55,3 +57,4 @@ SELECT * FROM t1 WHERE t = CONCAT('2001-01-08 00:00:00',LEFT(RAND(),0)) - INTERV SELECT * FROM t1 WHERE t < TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY; SELECT * FROM t1 WHERE t = TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY; DROP TABLE t1; +--enable_view_protocol diff --git a/mysql-test/include/ctype_german.inc b/mysql-test/include/ctype_german.inc index 0f8c995a4722f..3985216a8b4a2 100644 --- a/mysql-test/include/ctype_german.inc +++ b/mysql-test/include/ctype_german.inc @@ -46,6 +46,8 @@ INSERT INTO t1 VALUES (_latin1 0x9C), (_latin1 0x8C); # # Check order # +#enable after fix MDEV-29290 +--disable_view_protocol select s1, hex(s1) from t1 order by s1, binary s1; select group_concat(s1 order by binary s1) from t1 group by s1; @@ -53,7 +55,7 @@ SELECT s1, hex(s1), hex(weight_string(s1)) FROM t1 ORDER BY s1, BINARY(s1); SELECT s1, hex(s1) FROM t1 WHERE s1='ae' ORDER BY s1, BINARY(s1); drop table t1; - +--enable_view_protocol # # Check filesort for 'S' and "U+00DF SHARP S", diff --git a/mysql-test/include/ctype_like_range_f1f2.inc b/mysql-test/include/ctype_like_range_f1f2.inc index 54ea1b4c66589..def341e8d5ed0 100644 --- a/mysql-test/include/ctype_like_range_f1f2.inc +++ b/mysql-test/include/ctype_like_range_f1f2.inc @@ -17,9 +17,12 @@ INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +#check after fix MDEV-29290 +--disable_view_protocol # Check pattern (important for ucs2, utf16, utf32) SELECT hex(concat(repeat(0xF1F2, 10), '%')); --echo 3 rows expected SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); DROP TABLE t1; +--enable_view_protocol diff --git a/mysql-test/include/ctype_myanmar.inc b/mysql-test/include/ctype_myanmar.inc index 82dce1335a05f..a305430835ff1 100644 --- a/mysql-test/include/ctype_myanmar.inc +++ b/mysql-test/include/ctype_myanmar.inc @@ -1293,7 +1293,11 @@ INSERT INTO t1 (s1) VALUES (_ucs2 0x101C1000103A10181000103A), (_ucs2 0x101C103910181000103A /* tea */); +# enable view-protocol after fix MDEV-27871 +--disable_view_protocol + SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) FROM t1 ORDER BY id; +--enable_view_protocol DROP TABLE t1; diff --git a/mysql-test/include/ctype_nopad_prefix_unique.inc b/mysql-test/include/ctype_nopad_prefix_unique.inc new file mode 100644 index 0000000000000..b25128e9fef17 --- /dev/null +++ b/mysql-test/include/ctype_nopad_prefix_unique.inc @@ -0,0 +1,85 @@ +--echo # +--echo # MDEV-30034 UNIQUE USING HASH accepts duplicate entries for tricky collations +--echo # + +# TEXT + +if (`SELECT UPPER(@@storage_engine) != 'MEMORY'`) +{ +EXECUTE IMMEDIATE REPLACE( + 'CREATE TABLE t1 ( ' + ' a TEXT COLLATE ,' + 'UNIQUE(a(3)))', + '', @@collation_connection); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('ss '); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; + + +EXECUTE IMMEDIATE REPLACE( + 'CREATE TABLE t1 ( ' + ' a TEXT COLLATE ,' + 'UNIQUE(a(3)) USING HASH)', + '', @@collation_connection); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('ss '); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; +} + + +# VARCHAR + +EXECUTE IMMEDIATE REPLACE( + 'CREATE TABLE t1 ( ' + ' a VARCHAR(2000) COLLATE ,' + 'UNIQUE(a(3)))', + '', @@collation_connection); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('ss '); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; + + +EXECUTE IMMEDIATE REPLACE( + 'CREATE TABLE t1 ( ' + ' a VARCHAR(2000) COLLATE ,' + 'UNIQUE(a(3)) USING HASH)', + '', @@collation_connection); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('ss '); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; + +# CHAR + +# MyISAM is buggy on CHAR+BTREE+UNIQUE+PREFIX (see MDEV-30048), disable for now +# Other engines work fine + +if (`SELECT UPPER(@@storage_engine) != 'MYISAM'`) +{ +EXECUTE IMMEDIATE REPLACE( + 'CREATE TABLE t1 ( ' + ' a CHAR(20) COLLATE ,' + 'UNIQUE(a(3)))', + '', @@collation_connection); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; +} + +EXECUTE IMMEDIATE REPLACE( + 'CREATE TABLE t1 ( ' + ' a CHAR(20) COLLATE ,' + 'UNIQUE(a(3)) USING HASH)', + '', @@collation_connection); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; diff --git a/mysql-test/include/ctype_numconv.inc b/mysql-test/include/ctype_numconv.inc index d99942c5d5fdf..6c7ac3b69fe1e 100644 --- a/mysql-test/include/ctype_numconv.inc +++ b/mysql-test/include/ctype_numconv.inc @@ -1,3 +1,7 @@ +#remove this include after fix MDEV-27871 +# maybe some tests need to be excluded separately after fix +--source include/no_view_protocol.inc + SET TIME_ZONE = _latin1 '+03:00'; --echo # @@ -1631,6 +1635,7 @@ SELECT charset(@x), collation(@x); --echo # --echo # Bug#54916 GROUP_CONCAT + IFNULL truncates output --echo # + SELECT @@collation_connection; # ENGINE=MYISAM is very important to make sure "SYSTEM" join type # is in use, which will create instances of Item_copy. diff --git a/mysql-test/include/ctype_pad.inc b/mysql-test/include/ctype_pad.inc index 4cefc575cdd0c..a18876145df82 100644 --- a/mysql-test/include/ctype_pad.inc +++ b/mysql-test/include/ctype_pad.inc @@ -52,13 +52,14 @@ DROP TABLE t1; --echo # --echo # IF, CASE, LEAST --echo # - +#enable after fix MDEV-27871 +--disable_view_protocol eval SELECT IF('abc' COLLATE $coll = 'abc ', 'pad', 'nopad'); eval SELECT CASE 'abc' COLLATE $coll WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; eval SELECT CASE WHEN 'abc' COLLATE $coll = 'abc ' THEN 'pad' ELSE 'nopad' END; eval SELECT HEX(LEAST('abc ' COLLATE $coll, 'abc ')); eval SELECT HEX(GREATEST('abc ' COLLATE $coll, 'abc ')); - +--enable_view_protocol --echo # --echo # Collation mix --echo # diff --git a/mysql-test/include/ctype_str_to_date.inc b/mysql-test/include/ctype_str_to_date.inc index 62adb05b094cb..fc7d6801adf85 100644 --- a/mysql-test/include/ctype_str_to_date.inc +++ b/mysql-test/include/ctype_str_to_date.inc @@ -3,7 +3,10 @@ --echo # SELECT @@character_set_connection, HEX(CAST(_utf8'÷' AS CHAR)); +# enable view-protocol after fix MDEV-27871 +--disable_view_protocol SELECT STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)); +--enable_view_protocol CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0; SHOW COLUMNS FROM t1; INSERT INTO t1 VALUES (_utf8'2001÷01÷01',_utf8'%Y÷%m÷%d'); diff --git a/mysql-test/include/ctype_unescape.inc b/mysql-test/include/ctype_unescape.inc index 171843ff66a16..d7a8a27509a44 100644 --- a/mysql-test/include/ctype_unescape.inc +++ b/mysql-test/include/ctype_unescape.inc @@ -309,12 +309,15 @@ CALL p2(); --disable_warnings # All records marked with '[BAD]' mean that the string was unescaped # in a unexpected way, that means there is a bug in UNESCAPE() above. +#check after fix MDEV-29290 +--disable_view_protocol SELECT HEX(a),HEX(b), CONCAT(unescape_type(a,b), wellformedness(a,b), mysql_real_escape_string_generated(a), IF(UNESCAPE(a)<>b,CONCAT('[BAD',HEX(UNESCAPE(a)),']'),'')) AS comment FROM t1 ORDER BY LENGTH(a),a; +--enable_view_protocol --enable_warnings DROP TABLE t1; DROP PROCEDURE p1; diff --git a/mysql-test/include/ctype_unicode_casefold_bmp.inc b/mysql-test/include/ctype_unicode_casefold_bmp.inc new file mode 100644 index 0000000000000..e5b16b9334e7c --- /dev/null +++ b/mysql-test/include/ctype_unicode_casefold_bmp.inc @@ -0,0 +1,23 @@ +--source include/have_utf32.inc +--source include/have_ucs2.inc +--source include/have_sequence.inc + +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); + +SELECT COLLATION(c) FROM v_bmp LIMIT 1; + +SELECT + codepoint_hex4, + HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)), + HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +FROM v_bmp +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); + +DROP VIEW v_bmp; diff --git a/mysql-test/include/ctype_unicode_casefold_supplementary.inc b/mysql-test/include/ctype_unicode_casefold_supplementary.inc new file mode 100644 index 0000000000000..bb603118db6f6 --- /dev/null +++ b/mysql-test/include/ctype_unicode_casefold_supplementary.inc @@ -0,0 +1,22 @@ +--source include/have_utf32.inc +--source include/have_sequence.inc + +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_supplementary AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),8,''0'') AS codepoint_hex8, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_65536_to_1114111', @@character_set_connection, @@collation_connection); + +SELECT COLLATION(c) FROM v_supplementary LIMIT 1; + +SELECT + codepoint_hex8, + HEX(CAST(LOWER(c) AS CHAR CHARACTER SET utf32)), + HEX(CAST(UPPER(c) AS CHAR CHARACTER SET utf32)) +FROM v_supplementary +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); + +DROP VIEW v_supplementary; diff --git a/mysql-test/include/ctype_unicode_ws_bmp.inc b/mysql-test/include/ctype_unicode_ws_bmp.inc new file mode 100644 index 0000000000000..31166b5d31af7 --- /dev/null +++ b/mysql-test/include/ctype_unicode_ws_bmp.inc @@ -0,0 +1,26 @@ +--source include/have_utf32.inc +--source include/have_sequence.inc + +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); + +SELECT COLLATION(c) FROM v_bmp LIMIT 1; + +SELECT HEX(codepoint) FROM v_bmp WHERE HEX(WEIGHT_STRING(c))='FFFD'; + +SELECT + SUM(codepoint_hex4=HEX(WEIGHT_STRING(c))) AS count_bmp_weight_is_codepoint, + SUM(codepoint_hex4<>HEX(WEIGHT_STRING(c))) AS count_bmp_weight_is_not_codepoint +FROM v_bmp; + +SELECT codepoint_hex4,HEX(WEIGHT_STRING(c)) +FROM v_bmp +WHERE codepoint_hex4<>HEX(WEIGHT_STRING(c)); + +DROP VIEW v_bmp; diff --git a/mysql-test/include/ctype_unicode_ws_supplementary.inc b/mysql-test/include/ctype_unicode_ws_supplementary.inc new file mode 100644 index 0000000000000..82273e8fb6a28 --- /dev/null +++ b/mysql-test/include/ctype_unicode_ws_supplementary.inc @@ -0,0 +1,19 @@ +--source include/have_utf32.inc +--source include/have_sequence.inc + +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_supplementary AS +SELECT + seq AS codepoint, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_65536_to_1114111', @@character_set_connection, @@collation_connection); + +SELECT COLLATION(c) FROM v_supplementary LIMIT 1; + +SELECT + SUM(HEX(WEIGHT_STRING(c))<>'FFFD'), + SUM(HEX(WEIGHT_STRING(c))='FFFD') +FROM v_supplementary; + +DROP VIEW v_supplementary; diff --git a/mysql-test/include/ctype_utf8mb4.inc b/mysql-test/include/ctype_utf8mb4.inc index d24ee2fafeba8..436b0f2782fea 100644 --- a/mysql-test/include/ctype_utf8mb4.inc +++ b/mysql-test/include/ctype_utf8mb4.inc @@ -1,6 +1,12 @@ # # Tests with the utf8mb4 character set # + +# Tests will be skipped for the view protocol because the view protocol uses +# an additional util connection and don't use for this nessesary configurations +# Also need to resolve MDEV-27871 +-- source include/no_view_protocol.inc + --source include/default_optimizer_switch.inc --disable_warnings drop table if exists t1,t2; diff --git a/mysql-test/include/deadlock.inc b/mysql-test/include/deadlock.inc index b5ffd5f1cb5e2..abf217aea7503 100644 --- a/mysql-test/include/deadlock.inc +++ b/mysql-test/include/deadlock.inc @@ -9,7 +9,7 @@ # old name was t/innodb-deadlock.test # main code went into include/deadlock.inc # - +--disable_service_connection connect (con1,localhost,root,,); connect (con2,localhost,root,,); @@ -20,7 +20,7 @@ drop table if exists t1,t2; # # Testing of FOR UPDATE # - +--disable_view_protocol connection con1; eval create table t1 (id integer, x integer) engine = $engine_type; insert into t1 values(0, 0); @@ -49,10 +49,11 @@ select * from t1; commit; drop table t1; +--enable_view_protocol # # Testing of FOR UPDATE # - +--disable_view_protocol connection con1; eval create table t1 (id integer, x integer) engine = $engine_type; eval create table t2 (b integer, a integer) engine = $engine_type; @@ -125,7 +126,7 @@ connection default; disconnect con1; disconnect con2; drop table t1, t2; - +--enable_view_protocol --echo End of 4.1 tests # @@ -152,3 +153,4 @@ drop table if exists a; set default_storage_engine=default; --echo End of 5.0 tests. +--enable_service_connection diff --git a/mysql-test/include/default_my.cnf b/mysql-test/include/default_my.cnf index d102c9020cca4..a1c427fe12c1f 100644 --- a/mysql-test/include/default_my.cnf +++ b/mysql-test/include/default_my.cnf @@ -33,3 +33,4 @@ disable-force-if-open [ENV] MASTER_MYPORT= @mysqld.1.port MASTER_MYSOCK= @mysqld.1.socket +OPENSSL_ENABLE_SHA1_SIGNATURES= 1 diff --git a/mysql-test/include/empty_string_literal.inc b/mysql-test/include/empty_string_literal.inc index f02b626a48446..9ccedde6dce98 100644 --- a/mysql-test/include/empty_string_literal.inc +++ b/mysql-test/include/empty_string_literal.inc @@ -4,6 +4,12 @@ SET SESSION character_set_client=cp1250; --echo # --echo # Test litteral --echo # + +#enable view protocol after fix MDEV-27871 and +# it is necessary that the view protocol uses the same connection, +# not util connection +--disable_view_protocol + SET sql_mode=@mode; select @@sql_mode; SELECT '',CHARSET(''), null, CHARSET(null), CAST(null as char(10)), CHARSET(CAST(null as char(10))), 'x', CHARSET('x'); @@ -12,6 +18,8 @@ SET sql_mode=default; SELECT '',CHARSET(''), null, CHARSET(null), CAST(null as char(10)), CHARSET(CAST(null as char(10))), 'x', CHARSET('x'); SELECT CHARSET(NULLIF('','')),NULLIF('',''); + + --echo # --echo # Test NCHAR litteral --echo # @@ -22,6 +30,8 @@ SET sql_mode=default; SELECT N'',CHARSET(N''), N'x', CHARSET(N'x'); SELECT CHARSET(NULLIF(N'',N'')),NULLIF(N'',N''); + + --echo # --echo # Test CHARSET prefix litteral --echo # @@ -52,6 +62,8 @@ SELECT '' '' '',CHARSET('' '' ''); SELECT _latin1'' '' '',CHARSET(_latin1'' '' ''); SELECT N'' '' '',CHARSET(N'' '' ''); +--enable_view_protocol + --echo # --echo # UNION - implicit group by --echo # @@ -70,10 +82,16 @@ UNION SELECT 1 , _cp1250 '' ORDER BY 1; +# it is necessary that the view protocol uses the same connection, +# not util connection +--disable_view_protocol + SELECT NULLIF(_cp1250 '',_cp1250 '') UNION SELECT NULLIF(N'',N''); +--enable_view_protocol + --error ER_CANT_AGGREGATE_2COLLATIONS SELECT 1 , _latin2 '' UNION diff --git a/mysql-test/include/ensure_binlog_row_event_columns.inc b/mysql-test/include/ensure_binlog_row_event_columns.inc new file mode 100644 index 0000000000000..0dab9cc273581 --- /dev/null +++ b/mysql-test/include/ensure_binlog_row_event_columns.inc @@ -0,0 +1,72 @@ +# +# Helper file to ensure that a binary log file properly writes the expected +# fields based on the binlog_row_image value. +# +# ==== Usage ==== +# +# --let $expected_columns= (COLUMN_IDS) +# --let $binlog_filename= FILENAME +# --source include/count_binlog_row_event_columns.inc +# +# Parameters: +# expected_columns (list, in) : A list of positive integers which +# correspond to the column numbers that should be output in a binary +# log's write_rows event +# binlog_filename (string, in) : Name of the binary log file to analyze +# + +if (!$expected_columns) +{ + --die expected_columns parameter is required but was not set +} + +if (!$binlog_filename) +{ + --die binlog_filename parameter is required but was not set +} + +--let $include_filename= ensure_binlog_row_event_columns.inc [$expected_columns] +--source include/begin_include_file.inc + +--let $assert_file=$MYSQLTEST_VARDIR/tmp/binlog_decoded.out +--let mysqld_datadir=`select @@datadir` + +--echo # MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +--exec $MYSQL_BINLOG $mysqld_datadir/$binlog_filename -vv > $assert_file + +--echo # Verifying all expected column ids appear in binlog event output.. +--let num_cols_found=0 +--let last_expected_col= `SELECT GREATEST $expected_columns` +--let i= 1 +while($i <= $last_expected_col) +{ + # By default, assume the column is not expected to be in the binary log. + # If the column id is set in expected_columns, then override assertion + # parameters. + --let assert_count= 0 + --let assert_text= Column @$i should not be in binary log + + if (`SELECT $i IN $expected_columns`) + { + --let assert_count= 1 + --let assert_text= Column @$i should be in binary log + + --inc $num_cols_found + } + + --let assert_select= @$i + --source include/assert_grep.inc + + --inc $i +} +--echo # ..success + +--echo # Verifying only expected column ids appear in binlog event output.. +--let assert_count= $num_cols_found +--let assert_text= The binlog event should only have $num_cols_found columns +--let assert_select= @[\d]+ +--source include/assert_grep.inc +--echo # ..success + +--let $include_filename= ensure_binlog_row_event_columns.inc [$expected_columns] +--source include/end_include_file.inc diff --git a/mysql-test/include/expect_crash.inc b/mysql-test/include/expect_crash.inc index af8b090810415..b4bd9828a089f 100644 --- a/mysql-test/include/expect_crash.inc +++ b/mysql-test/include/expect_crash.inc @@ -1,5 +1,5 @@ ---let $_server_id= `SELECT @@server_id` ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect # There should be a debug crash after using this .inc file --exec echo "wait" > $_expect_file_name diff --git a/mysql-test/include/explain_non_select.inc b/mysql-test/include/explain_non_select.inc index d22310c98133c..bd0962d387640 100644 --- a/mysql-test/include/explain_non_select.inc +++ b/mysql-test/include/explain_non_select.inc @@ -788,6 +788,22 @@ INSERT INTO t1 VALUES (1), (2), (3), (4), (5); DROP TABLE t1; +--echo #75 + +CREATE TABLE t1 (id INT PRIMARY KEY, i INT); +--let $query = INSERT INTO t1 VALUES (3,10), (7,11), (3,11) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id); +--source include/explain_utils.inc +DROP TABLE t1; + +--echo #76 + +CREATE TABLE t1 (id INT PRIMARY KEY, i INT); +CREATE TABLE t2 (a INT, b INT); +INSERT INTO t2 VALUES (1,10), (3,10), (7,11), (3,11); +--let $query = INSERT INTO t1 SELECT * FROM t2 ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id); +--source include/explain_utils.inc +DROP TABLE t1,t2; + --echo # --echo # Bug #12949629: CLIENT LOSES CONNECTION AFTER EXECUTING A PROCEDURE WITH --echo # EXPLAIN UPDATE/DEL/INS diff --git a/mysql-test/include/explain_utils.inc b/mysql-test/include/explain_utils.inc index 15376b7661071..bdea240773956 100644 --- a/mysql-test/include/explain_utils.inc +++ b/mysql-test/include/explain_utils.inc @@ -26,7 +26,7 @@ --echo # query: $query --echo # select: $select --echo # - +--disable_view_protocol if ($select) { --enable_prepare_warnings --disable_query_log @@ -163,3 +163,4 @@ SHOW STATUS WHERE (Variable_name LIKE 'Sort%' OR --enable_query_log --echo +--enable_view_protocol diff --git a/mysql-test/include/func_hybrid_type.inc b/mysql-test/include/func_hybrid_type.inc index 0eed936db3824..f4da357a5fa89 100644 --- a/mysql-test/include/func_hybrid_type.inc +++ b/mysql-test/include/func_hybrid_type.inc @@ -1,5 +1,7 @@ # "mtr --ps" returns different values in "Max length" --disable_ps_protocol +# view protocol createincorrect table name +--disable_view_protocol --enable_metadata --vertical_results SELECT @@ -39,6 +41,7 @@ FROM t1; --horizontal_results --disable_metadata --enable_ps_protocol +--enable_view_protocol CREATE TABLE t2 AS SELECT a AS ___________a, diff --git a/mysql-test/include/gis_debug.inc b/mysql-test/include/gis_debug.inc index c81932ef90c3c..813ae252070b0 100644 --- a/mysql-test/include/gis_debug.inc +++ b/mysql-test/include/gis_debug.inc @@ -119,6 +119,8 @@ CALL p1(-1, 'GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8, --enable_query_log +#enable after fix MDEV-27871 +--disable_view_protocol SELECT ST_CONTAINS( GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), GeomFromText('POINT(5 10)')); @@ -138,6 +140,7 @@ SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 --echo # SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1)); +--enable_view_protocol --echo # --echo # Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER @@ -145,6 +148,9 @@ SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),''); +#enable after fix MDEV-27871 +--disable_view_protocol + SELECT ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '), @@ -159,3 +165,5 @@ SELECT ST_NUMINTERIORRINGS( SELECT ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'), SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))); + +--enable_view_protocol diff --git a/mysql-test/include/gis_generic.inc b/mysql-test/include/gis_generic.inc index 8209240614e30..c693b86b896b0 100644 --- a/mysql-test/include/gis_generic.inc +++ b/mysql-test/include/gis_generic.inc @@ -180,9 +180,9 @@ insert IGNORE into t1 (a) values ('Garbage'); drop table t1; create table t1 (pk integer primary key auto_increment, fl geometry not null); ---error 1416 +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION insert into t1 (fl) values (1); ---error 1416 +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION insert into t1 (fl) values (1.11); --error 1416 insert into t1 (fl) values ("qwerty"); diff --git a/mysql-test/include/grep.inc b/mysql-test/include/grep.inc new file mode 100644 index 0000000000000..9ce7cddb7b77c --- /dev/null +++ b/mysql-test/include/grep.inc @@ -0,0 +1,16 @@ +# Grep file for regular expression and output to STDOUT +# +# Usage: +# --let $grep_file= /path/to/your/file +# --let $grep_regex= your_regex_string +# --source include/grep.inc + +--perl + open (my $fh, "<", "$ENV{grep_file}") or die $!; + while (<$fh>) + { + /$ENV{grep_regex}/ && + print; + } + close $fh; +EOF diff --git a/mysql-test/include/have_crypt.inc b/mysql-test/include/have_crypt.inc index 422f8922edca8..ae94121980cf7 100644 --- a/mysql-test/include/have_crypt.inc +++ b/mysql-test/include/have_crypt.inc @@ -1,3 +1,5 @@ +# MDEV-27964 The function ENCRYPT() causes SIGSEGV in WITH_MSAN builds +-- source include/not_msan.inc # encrypt('a') is NULL if crypt(3) is not available # encrypt('a') is "*0" in fips mode if (`select length(encrypt('a')) > 3 IS NOT TRUE`) { diff --git a/mysql-test/include/have_csv.inc b/mysql-test/include/have_csv.inc index 4b43d41f22f73..fef2d6fa2c50d 100644 --- a/mysql-test/include/have_csv.inc +++ b/mysql-test/include/have_csv.inc @@ -1,3 +1,5 @@ +-- source include/no_view_protocol.inc + disable_query_log; --require include/true.require select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'csv'; diff --git a/mysql-test/include/have_file_key_management.inc b/mysql-test/include/have_file_key_management.inc index 06fbb510d6b18..68ef49a42d943 100644 --- a/mysql-test/include/have_file_key_management.inc +++ b/mysql-test/include/have_file_key_management.inc @@ -2,3 +2,9 @@ if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'file { --skip Test requires file_key_management plugin } + +# +# This file is only included when using encryption. As all encryption test are +# very slow with valgrind, lets disable these if not run with --big +# +--source include/no_valgrind_without_big.inc diff --git a/mysql-test/include/have_gzip.inc b/mysql-test/include/have_gzip.inc new file mode 100644 index 0000000000000..09f282b73de04 --- /dev/null +++ b/mysql-test/include/have_gzip.inc @@ -0,0 +1,6 @@ +--error 0,1,127 +--exec gzip --version > /dev/null 2> /dev/null +if ($sys_errno) +{ + --skip Requires gzip executable +} diff --git a/mysql-test/include/have_innodb.inc b/mysql-test/include/have_innodb.inc index 69ffdb5b28449..0de070e1994dc 100644 --- a/mysql-test/include/have_innodb.inc +++ b/mysql-test/include/have_innodb.inc @@ -2,3 +2,15 @@ # suite.pm will make sure that all tests including this file # will be skipped unless innodb is enabled # +--disable_query_log +if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "MSAN%"`) +{ +SET STATEMENT sql_log_bin=0 FOR +call mtr.add_suppression("InnoDB: Trying to delete tablespace.*pending operations"); +} +if ($VALGRIND_TEST) +{ +SET STATEMENT sql_log_bin=0 FOR +call mtr.add_suppression("InnoDB: Trying to delete tablespace.*pending operations"); +} +--enable_query_log diff --git a/mysql-test/include/have_innodb_disallow_writes.inc b/mysql-test/include/have_innodb_disallow_writes.inc deleted file mode 100644 index 83b516b7a345e..0000000000000 --- a/mysql-test/include/have_innodb_disallow_writes.inc +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_innodb.inc - -if (`SELECT COUNT(*) = 0 from INFORMATION_SCHEMA.GLOBAL_VARIABLES - WHERE VARIABLE_NAME = 'INNODB_DISALLOW_WRITES'`) { - --skip Test requires 'innodb_disallow_writes' -} diff --git a/mysql-test/include/have_log_bin.inc b/mysql-test/include/have_log_bin.inc index eb2529dae3b43..f8733aa7876a3 100644 --- a/mysql-test/include/have_log_bin.inc +++ b/mysql-test/include/have_log_bin.inc @@ -7,8 +7,8 @@ # source include/have_log_bin.inc; source include/not_embedded.inc; +-- source include/no_view_protocol.inc --- require include/have_log_bin.require -disable_query_log; -show variables like 'log_bin'; -enable_query_log; +if (`select not @@log_bin`) { + skip Test requires: 'have_log_bin'; +} diff --git a/mysql-test/include/have_log_bin.require b/mysql-test/include/have_log_bin.require deleted file mode 100644 index d4fd77e4f8db4..0000000000000 --- a/mysql-test/include/have_log_bin.require +++ /dev/null @@ -1,2 +0,0 @@ -Variable_name Value -log_bin ON diff --git a/mysql-test/include/have_query_cache_disabled.inc b/mysql-test/include/have_query_cache_disabled.inc new file mode 100644 index 0000000000000..9087fa392e173 --- /dev/null +++ b/mysql-test/include/have_query_cache_disabled.inc @@ -0,0 +1,36 @@ +# Skip the test if 'query cache' is disabled. +# Note : There are 2 techniques to disable query cache : +# (1) Set query_cache_type to 0 or OFF +# (2) Set query_cache_size to 0 + +disable_query_log; + +let $do_skip=0; + +let $qc_var_1= query_get_value("SELECT COUNT(*) AS var1 FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME = 'have_query_cache' AND variable_value = 'YES'", var1, 1); +if ($qc_var_1 == 1) +{ + let $do_skip=1; +} + +# Check if 'query_cache_type' is OFF +let $qc_var_2= query_get_value("SELECT COUNT(*) AS var2 FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME = 'query_cache_type' AND VARIABLE_VALUE = 'OFF'", var2, 1); +if ($qc_var_2 == 1) +{ + let $do_skip=0; +} + +# Check if 'query_cache_size' is 0 +let $qc_var_3= query_get_value("SELECT COUNT(*) AS var3 FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME = 'query_cache_size' AND VARIABLE_VALUE = 0", var3, 1); + +if ($qc_var_3 == 1) +{ + let $do_skip=0; +} + +if ($do_skip) +{ + skip Query Cache enabled, skipping test; +} + +enable_query_log; diff --git a/mysql-test/include/have_view_protocol.inc b/mysql-test/include/have_view_protocol.inc new file mode 100644 index 0000000000000..6b1436a7a7a3f --- /dev/null +++ b/mysql-test/include/have_view_protocol.inc @@ -0,0 +1,6 @@ +# The file with expected results fits only to a run with +# view-protocol. +if (`SELECT $VIEW_PROTOCOL = 0`) +{ + --skip Test requires view-protocol +} \ No newline at end of file diff --git a/mysql-test/include/index_merge1.inc b/mysql-test/include/index_merge1.inc index a1366af2c2805..91609f628ca91 100644 --- a/mysql-test/include/index_merge1.inc +++ b/mysql-test/include/index_merge1.inc @@ -153,12 +153,22 @@ explain select * from t0 where (((key3 <7 and key7 < 6) or key5 < 2) and (key5 < 5 or key6 < 6)); explain select * from t0 where - ((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4)) + ((key3 < 4 or key5 < 4) and (key1 < 4 or key2 < 4)) or ((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6)); explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where - ((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4)) + ((key3 < 4 or key5 < 4) and (key1 < 4 or key2 < 4)) + or + ((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6)); + +explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where + ((key3 < 5 or key5 < 4) and (key1 < 4 or key2 < 4)) + or + ((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6)); + +explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where + ((key3 < 10 or key5 < 4) and (key1 < 4 or key2 < 4)) or ((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6)); @@ -290,6 +300,10 @@ select * from t0 where key1 < 3 or key2 < 4; select count(*) from t0; # Test for BUG#4177 + +# enable view-protocol after fix MDEV-27871 +--disable_view_protocol + drop table t4; create table t4 (a int); insert into t4 values (1),(4),(3); @@ -339,6 +353,8 @@ set join_buffer_size= @save_join_buffer_size; drop table t0, t1, t2, t3, t4; +--enable_view_protocol + # BUG#16166 CREATE TABLE t1 ( cola char(3) not null, colb char(3) not null, filler char(200), @@ -402,6 +418,7 @@ drop table t1, t2, t3; # # BUG#20256 - LOCK WRITE - MyISAM # +--disable_service_connection CREATE TABLE t1(a INT); INSERT INTO t1 VALUES(1); CREATE TABLE t2(a INT, b INT, dummy CHAR(16) DEFAULT '', KEY(a), KEY(b)); @@ -430,6 +447,7 @@ INSERT INTO t2(a,b) VALUES(1,2); SELECT t2.a FROM t1,t2 WHERE t2.b=2 AND t2.a=1; UNLOCK TABLES; DROP TABLE t1, t2; +--enable_service_connection # # BUG#29740: HA_KEY_SCAN_NOT_ROR wasn't set for HEAP engine diff --git a/mysql-test/include/ipv6.inc b/mysql-test/include/ipv6.inc index 3d8fdcfbc3c33..05c65d7817a44 100644 --- a/mysql-test/include/ipv6.inc +++ b/mysql-test/include/ipv6.inc @@ -22,4 +22,3 @@ eval SET PASSWORD FOR testuser1@'$IPv6' = PASSWORD ('9876'); --replace_result ::1 localhost SELECT USER(); eval DROP USER testuser1@'$IPv6'; - diff --git a/mysql-test/include/is_embedded.inc b/mysql-test/include/is_embedded.inc index b20f21953f013..a440406edd420 100644 --- a/mysql-test/include/is_embedded.inc +++ b/mysql-test/include/is_embedded.inc @@ -1,5 +1,7 @@ +# +# Check if the current used server is an embedded server# +# if (`SELECT VERSION() NOT LIKE '%embedded%'`) { --skip Test requires: embedded server } - diff --git a/mysql-test/include/is_embedded_no_privileges.inc b/mysql-test/include/is_embedded_no_privileges.inc new file mode 100644 index 0000000000000..364c697c5a8f6 --- /dev/null +++ b/mysql-test/include/is_embedded_no_privileges.inc @@ -0,0 +1,16 @@ +# +# Test that we do not have an embedded server compiled with privileges. +# This is not a regular setup, but we are running this in buildbot for +# testing of embedded + privileges. +# Some funcs_1 test cannot handle this combination, which is why we have this +# file to disable them +# + +--source include/is_embedded.inc + +let priv=`SELECT privileges FROM information_schema.columns limit 1`; + +if (`SELECT "$priv" <> ""`) +{ + --skip Embedded server is compiled with privileges; Test disabled. +} diff --git a/mysql-test/include/kill_galera.inc b/mysql-test/include/kill_galera.inc index d7f665df6c750..aba672d8a8928 100644 --- a/mysql-test/include/kill_galera.inc +++ b/mysql-test/include/kill_galera.inc @@ -1,8 +1,8 @@ --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 +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --exec echo "wait" > $_expect_file_name # Kill the connected server diff --git a/mysql-test/include/kill_mysqld.inc b/mysql-test/include/kill_mysqld.inc index 86ee048a0f18c..01ee7f82bdc13 100644 --- a/mysql-test/include/kill_mysqld.inc +++ b/mysql-test/include/kill_mysqld.inc @@ -1,5 +1,5 @@ ---let $_server_id= `SELECT @@server_id` ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --echo # Kill the server --exec echo "wait" > $_expect_file_name diff --git a/mysql-test/include/long_test.inc b/mysql-test/include/long_test.inc index d9a3b33822963..765f88b8037e7 100644 --- a/mysql-test/include/long_test.inc +++ b/mysql-test/include/long_test.inc @@ -2,3 +2,5 @@ # We can use this to schedule such test early (to not be left with # only one or two long tests running, and rests of works idle), or to # run a quick test skipping long-running test cases. + +--source include/no_valgrind_without_big.inc diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc index 9ed206b2c22ac..17c8dd3ed4efa 100644 --- a/mysql-test/include/master-slave.inc +++ b/mysql-test/include/master-slave.inc @@ -11,6 +11,7 @@ # [--let $rpl_skip_start_slave= 1] # [--let $rpl_debug= 1] # [--let $slave_timeout= NUMBER] +# [--let $rpl_server_skip_log_bin= 1] # --source include/master-slave.inc # # Parameters: diff --git a/mysql-test/include/maybe_versioning.combinations b/mysql-test/include/maybe_versioning.combinations new file mode 100644 index 0000000000000..246ad30ce7ed4 --- /dev/null +++ b/mysql-test/include/maybe_versioning.combinations @@ -0,0 +1,7 @@ +[orig] + +[vers] +system_versioning_alter_history=keep + +[vers_trx] +system_versioning_alter_history=keep diff --git a/mysql-test/include/maybe_versioning.inc b/mysql-test/include/maybe_versioning.inc new file mode 100644 index 0000000000000..8a7d7dad44f55 --- /dev/null +++ b/mysql-test/include/maybe_versioning.inc @@ -0,0 +1,47 @@ +# include file for test files that can be run with and without debug +# having debug and non-debug tests. + +# If $modify_create_table is true CREATE statement must be evaluated with +# $create_options that adds WITH SYSTEM VERSIONING to the statement. Otherwise +# system versioning is added implicitly via debug options. The second variant +# can easily be added to any test but works only for debug builds. + +if ($modify_create_table) +{ + if ($MTR_COMBINATION_VERS) + { + let $create_options= `select ' WITH SYSTEM VERSIONING'`; + } + + if ($MTR_COMBINATION_VERS_TRX) + { + --skip Not tested + } +} + +if (!$modify_create_table) +{ + let $have_debug=`select version() like '%debug%'`; + + if ($MTR_COMBINATION_VERS) + { + if (!$have_debug) + { + --skip Requires debug + } + --disable_query_log + set debug_dbug="d,sysvers_force_trx,sysvers_hide"; + --enable_query_log + } + + if ($MTR_COMBINATION_VERS_TRX) + { + if (!$have_debug) + { + --skip Requires debug + } + --disable_query_log + set debug_dbug="d,sysvers_force,sysvers_hide"; + --enable_query_log + } +} diff --git a/mysql-test/include/mix2.inc b/mysql-test/include/mix2.inc index 5d7598694a6e0..6a6fbcbc2ae72 100644 --- a/mysql-test/include/mix2.inc +++ b/mysql-test/include/mix2.inc @@ -157,7 +157,7 @@ drop table t1; # Test of reading on secondary key with may be null - +--disable_view_protocol eval create table t1 (a int,b varchar(20),key(a)) engine=$engine_type; insert into t1 values (1,""), (2,"testing"); select * from t1 where a = 1; @@ -289,7 +289,7 @@ drop table t1; rename table t2 to t1; drop table t1; set autocommit=1; - +--enable_view_protocol # # The following simple tests failed at some point # diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 0584bb934e299..d02f504a32dfe 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -105,7 +105,6 @@ INSERT INTO global_suppressions VALUES */ ("Got error [0-9]* when reading table"), - ("Incorrect definition of table"), ("Incorrect information in file"), ("InnoDB: Warning: we did not need to do crash recovery"), /*("Invalid \\(old\\?\\) table or database name"),*/ @@ -157,6 +156,10 @@ INSERT INTO global_suppressions VALUES ("InnoDB: Error: table `test`.`t[123]` .*does not exist in the InnoDB internal"), ("InnoDB: Warning: semaphore wait:"), + /* MDEV-28976: Tests that kill the server do not ensure that the + old process has terminated before starting a new one */ + ("InnoDB: Unable to lock"), + /* BUG#32080 - Excessive warnings on Solaris: setrlimit could not change the size of core files @@ -170,7 +173,7 @@ INSERT INTO global_suppressions VALUES /* Added 2009-08-XX after fixing Bug #42408 */ - ("Although a path was specified for the .* option, log tables are used"), + ("Although a .* file was specified, log tables are used. To enable logging to files "), ("Backup: Operation aborted"), ("Restore: Operation aborted"), ("Restore: The grant .* was skipped because the user does not exist"), diff --git a/mysql-test/include/mysqlhotcopy.inc b/mysql-test/include/mysqlhotcopy.inc index 306f0acc2084d..31635af2bfeaa 100644 --- a/mysql-test/include/mysqlhotcopy.inc +++ b/mysql-test/include/mysqlhotcopy.inc @@ -23,7 +23,7 @@ if (!$MYSQLHOTCOPY) # be skipped if Perl modules required by the mysqlhotcopy tool are not # found when the script is run this way. - +--disable_service_connection let $MYSQLD_DATADIR= `SELECT @@datadir`; --disable_warnings DROP DATABASE IF EXISTS hotcopy_test; @@ -134,4 +134,4 @@ DROP DATABASE hotcopy_test_cpy; DROP DATABASE hotcopy_test; DROP DATABASE hotcopy_save; DROP DATABASE hotcopy_save_old; - +--enable_service_connection diff --git a/mysql-test/include/no_view_protocol.inc b/mysql-test/include/no_view_protocol.inc new file mode 100644 index 0000000000000..9e5797835df23 --- /dev/null +++ b/mysql-test/include/no_view_protocol.inc @@ -0,0 +1,6 @@ +# The file with expected results fits only to a run without +# view-protocol. +if (`SELECT $VIEW_PROTOCOL > 0`) +{ + --skip Test requires: view-protocol disabled +} \ No newline at end of file diff --git a/mysql-test/include/not_asan.inc b/mysql-test/include/not_asan.inc index 9fc86a8525a9b..38fcac15ce74b 100644 --- a/mysql-test/include/not_asan.inc +++ b/mysql-test/include/not_asan.inc @@ -2,7 +2,7 @@ # be overcome. In normal cases one should fix the bug server/test case or in # the worst case add a (temporary?) suppression in asan.supp or lsan.supp -if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value="ASAN"`) +if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "ASAN%"`) { --skip Can't be run with ASan } diff --git a/mysql-test/include/not_msan.inc b/mysql-test/include/not_msan.inc new file mode 100644 index 0000000000000..ca1e2c1d7bd4b --- /dev/null +++ b/mysql-test/include/not_msan.inc @@ -0,0 +1,6 @@ +# This file should only be used with tests that are too big or slow for MSAN. + +if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "MSAN%"`) +{ +--skip Can't be run WITH_MSAN +} diff --git a/mysql-test/include/not_ubsan.inc b/mysql-test/include/not_ubsan.inc index 809f505507edd..237adcb4896b2 100644 --- a/mysql-test/include/not_ubsan.inc +++ b/mysql-test/include/not_ubsan.inc @@ -2,7 +2,7 @@ # be overcome. In normal cases one should fix the bug server/test case or in # the worst case add a (temporary?) suppression in asan.supp or lsan.supp -if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value="UBSAN"`) +if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value LIKE "%UBSAN"`) { --skip Can't be run with UBSAN } diff --git a/mysql-test/include/not_valgrind.inc b/mysql-test/include/not_valgrind.inc index 8bda3497878a4..a2372db4c4fe3 100644 --- a/mysql-test/include/not_valgrind.inc +++ b/mysql-test/include/not_valgrind.inc @@ -1,4 +1,4 @@ --require include/not_valgrind.require --disable_query_log -eval select $VALGRIND_TEST as using_valgrind; +eval select $VALGRIND_TEST+0 as using_valgrind; --enable_query_log diff --git a/mysql-test/include/not_valgrind_build.inc b/mysql-test/include/not_valgrind_build.inc index 2b60f11bfc703..b62a1bc953b45 100644 --- a/mysql-test/include/not_valgrind_build.inc +++ b/mysql-test/include/not_valgrind_build.inc @@ -1,4 +1,4 @@ -if (`select version() like '%valgrind%'`) +if (`select version() like '%valgrind%' || version() like '%asan%'`) { - skip Does not run with binaries built with valgrind; + skip Does not run with binaries built with valgrind or asan; } diff --git a/mysql-test/include/not_windows_embedded.inc b/mysql-test/include/not_windows_embedded.inc index 46f5e0ccfceb7..50ff0f80c7dbb 100644 --- a/mysql-test/include/not_windows_embedded.inc +++ b/mysql-test/include/not_windows_embedded.inc @@ -1,10 +1,8 @@ let $is_win = `select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows")`; -let $is_embedded = `select version() like '%embedded%'`; #echo is_win: $is_win; -#echo is_embedded: $is_embedded; if ($is_win) { - if ($is_embedded) + if(!$MYSQL_EMBEDDED) { skip Not supported with embedded on windows; } diff --git a/mysql-test/include/ps_conv.inc b/mysql-test/include/ps_conv.inc index fd69741773f47..2b7af82907cb3 100644 --- a/mysql-test/include/ps_conv.inc +++ b/mysql-test/include/ps_conv.inc @@ -77,7 +77,9 @@ show create table t5 ; --vertical_results --enable_metadata --disable_ps_protocol +--disable_view_protocol select * from t5 ; +--enable_view_protocol --enable_ps_protocol --disable_metadata --horizontal_results diff --git a/mysql-test/include/query_cache.inc b/mysql-test/include/query_cache.inc index d41bc21b14398..a1ad20dbd1523 100644 --- a/mysql-test/include/query_cache.inc +++ b/mysql-test/include/query_cache.inc @@ -14,7 +14,7 @@ # old name was innodb_cache.test # main code went into include/query_cache.inc # - +--disable_view_protocol SET global query_cache_type=ON; SET local query_cache_type=ON; eval SET SESSION DEFAULT_STORAGE_ENGINE = $engine_type; @@ -191,3 +191,4 @@ set @@global.query_cache_size = @save_query_cache_size; drop table t2; SET global query_cache_type=default; +--enable_view_protocol diff --git a/mysql-test/include/query_cache_partitions.inc b/mysql-test/include/query_cache_partitions.inc index e06b161e03bf1..bfbaa87c25771 100644 --- a/mysql-test/include/query_cache_partitions.inc +++ b/mysql-test/include/query_cache_partitions.inc @@ -4,6 +4,10 @@ # $engine_type -- storage engine to be tested # have to be set before sourcing this script. +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + SET global query_cache_type=ON; SET local query_cache_type=ON; eval SET SESSION DEFAULT_STORAGE_ENGINE = $engine_type; diff --git a/mysql-test/include/rowid_filter_debug_kill.inc b/mysql-test/include/rowid_filter_debug_kill.inc index 6a8c5d3f70d2e..513efed8a4c16 100644 --- a/mysql-test/include/rowid_filter_debug_kill.inc +++ b/mysql-test/include/rowid_filter_debug_kill.inc @@ -1,20 +1,14 @@ --source include/have_debug.inc --source include/have_debug_sync.inc +--source include/have_sequence.inc --source include/count_sessions.inc --echo # --echo # MDEV-22761 KILL QUERY during rowid_filter, crashes --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; - -# 100 rows create table t2(a int); -insert into t2 select A.a + B.a* 10 from t0 A, t0 B; +insert into t2 select * from seq_0_to_99; # 10K rows CREATE TABLE t3 ( @@ -29,11 +23,10 @@ where table_schema=database() and table_name='t3'; insert into t3 select - A.a, - A.a, + A.seq, + B.seq, 'filler-data-filler-data' -from - t0 A, t1 B; +from seq_0_to_99 A, seq_0_to_99 B; analyze table t2,t3; @@ -51,7 +44,6 @@ where t3.key1=t2.a and t3.key2 in (2,3); connect (con1, localhost, root,,); -connection con1; set debug_sync='now WAIT_FOR at_rowid_filter_check'; evalp kill query $target_id; set debug_sync='now SIGNAL go'; @@ -63,6 +55,5 @@ disconnect con1; reap; set debug_sync='RESET'; -drop table t0,t1,t2,t3; +drop table t2,t3; --source include/wait_until_count_sessions.inc - diff --git a/mysql-test/include/rpl_init.inc b/mysql-test/include/rpl_init.inc index 4ee4cccdc204d..acb9104ae6f40 100644 --- a/mysql-test/include/rpl_init.inc +++ b/mysql-test/include/rpl_init.inc @@ -73,6 +73,7 @@ # before CHANGE MASTER and START SLAVE. RESET MASTER and RESET # SLAVE are suppressed if $rpl_skip_reset_master_and_slave is # set. +# Also see $rpl_server_skip_log_bin. # # $rpl_skip_change_master # By default, this script issues CHANGE MASTER so that all slaves @@ -94,6 +95,10 @@ # Timeout used when waiting for the slave threads to start. # See include/wait_for_slave_param.inc # +# $rpl_server_skip_log_bin +# When $rpl_skip_reset_master_and_slave is not set +# RESET MASTER does not report ER_FLUSH_MASTER_BINLOG_CLOSED +# on any server. # # ==== Side effects ==== # @@ -161,7 +166,16 @@ while ($_rpl_server) USE test; if (!$rpl_skip_reset_master_and_slave) { - RESET MASTER; + if (!$rpl_server_skip_log_bin) + { + --error 0 + RESET MASTER; + } + if ($rpl_server_skip_log_bin) + { + --error 0,ER_FLUSH_MASTER_BINLOG_CLOSED + RESET MASTER; + } SET GLOBAL gtid_slave_pos= ""; RESET SLAVE; } diff --git a/mysql-test/include/rpl_stop_server.inc b/mysql-test/include/rpl_stop_server.inc index 049c3d5bbd22f..470e86a139d69 100644 --- a/mysql-test/include/rpl_stop_server.inc +++ b/mysql-test/include/rpl_stop_server.inc @@ -48,7 +48,9 @@ if ($rpl_debug) # Send shutdown to the connected server and give # it 60 seconds (of mysqltest's default) to die before zapping it -shutdown_server; +let $rpl_shutdown_timeout= `select 60*(1+9*count(*)) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "MSAN%"`; + +shutdown_server $rpl_shutdown_timeout; --source include/wait_until_disconnected.inc diff --git a/mysql-test/include/show_binlog_events2.inc b/mysql-test/include/show_binlog_events2.inc index 84c62cced6641..69391ff8fa2f0 100644 --- a/mysql-test/include/show_binlog_events2.inc +++ b/mysql-test/include/show_binlog_events2.inc @@ -1,3 +1,25 @@ +# ==== Purpose ==== +# +# A lighter version of show_binlog_event.inc, with the same purpose +# to execute SHOW BINLOG EVENTS and mask non-deterministic output. +# +# +# Parameters: +# +# $binlog_file +# Filename for the 'IN' clause of SHOW BINLOG EVENTS. If none +# given, no argument is given to SHOW BINLOG EVENTS, meaning that +# it uses the first binlog. If you set this to "LAST", it prints +# the last binlog (according to SHOW MASTER STATUS). +# +# $binlog_start +# Position for the 'FROM' clause of SHOW BINLOG EVENTS. If none +# given, starts right after the Binlog_checkpoint_log_even. +# +# $regexp_replace +# A user's custom addon to standard preexisting list. +# + if ($binlog_start) { --let $_binlog_start=$binlog_start @@ -13,5 +35,5 @@ if ($binlog_file) --let $_from_binlog_start=from $_binlog_start --replace_result "$_from_binlog_start" "from " $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ $replace_regexp --eval show binlog events $_in_binlog_file from $_binlog_start diff --git a/mysql-test/include/show_events.inc b/mysql-test/include/show_events.inc index 7f35fc6c433c9..9df12b2304b6d 100644 --- a/mysql-test/include/show_events.inc +++ b/mysql-test/include/show_events.inc @@ -107,6 +107,8 @@ let $script= s{block_len=[0-9]+}{block_len=#}; s{Server ver:.*DOLLAR}{SERVER_VERSION, BINLOG_VERSION}; s{GTID [0-9]+-[0-9]+-[0-9]+}{GTID #-#-#}; + s{COMMIT ALTER id=[0-9]+}{COMMIT ALTER id=#}; + s{ROLLBACK ALTER id=[0-9]+}{ROLLBACK ALTER id=#}; s{\[([0-9]-[0-9]-[0-9]+,?)+\]}{[#-#-#]}; s{cid=[0-9]+}{cid=#}; s{SQL_LOAD-[a-z,0-9,-]*.[a-z]*}{SQL_LOAD---.}; diff --git a/mysql-test/include/shutdown_mysqld.inc b/mysql-test/include/shutdown_mysqld.inc index db0cfb82c68a9..fc2972560c37a 100644 --- a/mysql-test/include/shutdown_mysqld.inc +++ b/mysql-test/include/shutdown_mysqld.inc @@ -22,8 +22,8 @@ if ($rpl_inited) } # 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 +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --exec echo "wait" > $_expect_file_name # Avoid warnings from connection threads that does not have time to exit diff --git a/mysql-test/include/sql_mode_pad_char_to_full_length.inc b/mysql-test/include/sql_mode_pad_char_to_full_length.inc new file mode 100644 index 0000000000000..df03c4dbc2868 --- /dev/null +++ b/mysql-test/include/sql_mode_pad_char_to_full_length.inc @@ -0,0 +1,31 @@ +--echo # +--echo # MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic +--echo # + +CREATE TABLE t1 (a INT,b CHAR(20)); +SHOW CREATE TABLE t1; +CREATE UNIQUE INDEX bi USING HASH ON t1 (b); +INSERT INTO t1 VALUES (0,0); +SET sql_mode='pad_char_to_full_length'; +DELETE FROM t1; +DROP TABLE t1; + + +SET sql_mode=''; +CREATE TABLE t1 (a INT,b CHAR(20)); +SHOW CREATE TABLE t1; +CREATE UNIQUE INDEX bi USING HASH ON t1 (b); +SET sql_mode='pad_char_to_full_length'; +INSERT INTO t1 VALUES (0,0); +DELETE FROM t1; +DROP TABLE t1; + + +SET sql_mode=''; +CREATE OR REPLACE TABLE t1 (a CHAR(20),b CHAR(20)); +SHOW CREATE TABLE t1; +CREATE UNIQUE INDEX bi USING HASH ON t1 (b); +INSERT INTO t1 VALUES (0,0); +SET sql_mode='pad_char_to_full_length'; +DELETE FROM t1; +DROP TABLE t1; diff --git a/mysql-test/include/start_mysqld.inc b/mysql-test/include/start_mysqld.inc index b4fe116fe86c8..6e448cb2efd8f 100644 --- a/mysql-test/include/start_mysqld.inc +++ b/mysql-test/include/start_mysqld.inc @@ -12,25 +12,32 @@ if (!$restart_noprint) --let $restart_noprint=0 } +--let $restart_cmd= restart + +if ($restart_bindir) +{ + --let $restart_cmd= restart_bindir $restart_bindir +} + if ($restart_parameters) { - --exec echo "restart: $restart_parameters" > $_expect_file_name + --exec echo "$restart_cmd: $restart_parameters" > $_expect_file_name if (!$restart_noprint) { - --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR - --exec echo "# restart: $restart_parameters" + --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR + --exec echo "# $restart_cmd: $restart_parameters" } if ($restart_noprint == 1) { - --exec echo "# restart: with restart_parameters" + --exec echo "# $restart_cmd: with restart_parameters" } } if (!$restart_parameters) { - --exec echo "restart" > $_expect_file_name + --exec echo "$restart_cmd" > $_expect_file_name if ($restart_noprint < 2) { - --exec echo "# restart" + --exec echo "# $restart_cmd" } } diff --git a/mysql-test/include/type_mix_incompatible.inc b/mysql-test/include/type_mix_incompatible.inc new file mode 100644 index 0000000000000..92a75be6e8110 --- /dev/null +++ b/mysql-test/include/type_mix_incompatible.inc @@ -0,0 +1,252 @@ +--echo # Start of type_store_assignment_incompatible.inc + +--disable_abort_on_error + +SET @sql_mode_save= @@sql_mode; + +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS + WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); + +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS + WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); + +# 'IGNORE' -> ' IGNORE' +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) + ELSE @ignore + END; + +let $source_type= `(SELECT @source_type)`; +let $target_type= `(SELECT @target_type)`; +let $ignore=`(SELECT @ignore)`; + +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; + +# +# Single row INSERT..VALUES +# + +CREATE TABLE t3 LIKE t2; +eval INSERT$ignore INTO t3 VALUES + (1, + (SELECT source FROM t2 ORDER BY id LIMIT 1), + (SELECT source FROM t2 ORDER BY id LIMIT 1)); +DROP TABLE t3; + +# +# Multi-row INSERT..VALUES +# + +# INSERT .. VALUES checks assignment compatibility for the first row only. +# Here the first row is compatible, so no error happens. +# The second row is not compatible. It works according to the +# current sql_mode and the table transaction ability, so it can: +# (a) either raise a warning +# (b) or escalate a warning to an error and abort on the current row +# (c) or escalate a warning to an error and rollback +# Here we test (a) and (b). + +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE + CONCAT('CREATE VIEW v3 AS SELECT id,', + IF(@target_type='geometry','AsText(target)','target'), ' AS target,', + IF(@source_type='geometry','AsText(source)','source'), ' AS source ', + ' FROM t3'); + +eval INSERT$ignore INTO t3 VALUES + (1, + (SELECT target FROM t2 ORDER BY id LIMIT 1), + (SELECT source FROM t2 ORDER BY id LIMIT 1)), + (2, + (SELECT source FROM t2 ORDER BY id LIMIT 1), + (SELECT source FROM t2 ORDER BY id LIMIT 1)); +SELECT * FROM v3; +TRUNCATE TABLE t3; + +SET sql_mode=STRICT_ALL_TABLES; +eval INSERT$ignore INTO t3 VALUES + (1, + (SELECT target FROM t2 ORDER BY id LIMIT 1), + (SELECT source FROM t2 ORDER BY id LIMIT 1)), + (2, + (SELECT source FROM t2 ORDER BY id LIMIT 1), + (SELECT source FROM t2 ORDER BY id LIMIT 1)); +SELECT * FROM v3; +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; + +# +# INSERT .. SELECT +# + +CREATE TABLE t3 LIKE t2; +eval INSERT$ignore INTO t3 SELECT id,source,source FROM t2; + +eval INSERT$ignore INTO t3 (id,target,source) SELECT id,source,source FROM t2; + +# +# INSERT .. VALUES .. ON DUPLICATE KEY UPDATE target=source +# + +eval INSERT$ignore INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; + +eval INSERT$ignore INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; + +# +# INSERT .. SELECT .. ON DUPLICATE KEY UPDATE target=source +# + +eval INSERT$ignore INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; + +eval INSERT$ignore INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; + + +# +# UPDATE +# +eval UPDATE$ignore t3 SET target=source; + + +# +# UPDATE, multi-table +# + +eval UPDATE$ignore t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; + + +# +# ALTER +# + +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +EXECUTE IMMEDIATE @alter; + + +DROP TABLE t3; +DROP TABLE t2; + +# +# MDEV-28963 Incompatible data type assignment through SP vars is not consistent with columns +# + +# +# SP local variables +# +DELIMITER $$; +eval CREATE PROCEDURE p1() +BEGIN + DECLARE src $source_type DEFAULT NULL; + DECLARE dst $target_type DEFAULT NULL; + SET dst=src; +END; +$$ +DELIMITER ;$$ +CALL p1; +DROP PROCEDURE p1; + +# +# SP IN parameters +# + +--eval CREATE FUNCTION f1(a $target_type) RETURNS INT RETURN NULL; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +DROP FUNCTION f1; + +--eval CREATE PROCEDURE p1(a $target_type) BEGIN END; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +DROP PROCEDURE p1; + +# +# SP OUT parameters +# + +DELIMITER $$; +eval CREATE PROCEDURE p1(OUT dst $target_type) +BEGIN + DECLARE src $source_type DEFAULT NULL; + SET dst=src; +END; +$$ +eval CREATE PROCEDURE p2() +BEGIN + DECLARE dst $target_type DEFAULT NULL; + CALL p1(dst); +END; +$$ +DELIMITER ;$$ +CALL p2(); +SHOW WARNINGS; +DROP PROCEDURE p2; +DROP PROCEDURE p1; + + +# +# SF RETURN +# + +DELIMITER $$; +eval CREATE FUNCTION f1() RETURNS $target_type +BEGIN + DECLARE rc $source_type DEFAULT NULL; + RETURN rc; +END; +$$ +DELIMITER ;$$ +SELECT f1(); +DROP FUNCTION f1; + +# +# Cursor IN parameters +# + +DELIMITER $$; +eval CREATE PROCEDURE p1() +BEGIN + DECLARE src $source_type DEFAULT NULL; + DECLARE cur1 CURSOR(t $target_type) FOR SELECT * FROM t1 WHERE target=t; + OPEN cur1(src); + CLOSE cur1; +END; +$$ +DELIMITER ;$$ +CALL p1(); +DROP PROCEDURE p1; + +# +# FETCH +# + +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); + +DELIMITER $$; +eval CREATE PROCEDURE p1() +BEGIN + DECLARE dst $target_type DEFAULT NULL; + DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; + OPEN cur2; + FETCH cur2 INTO dst; + CLOSE cur2; +END; +$$ +DELIMITER ;$$ +CALL p1(); +DROP PROCEDURE p1; + +DROP TABLE t2; + +--enable_abort_on_error + +--echo # End of type_store_assignment_incompatible.inc diff --git a/mysql-test/include/unsafe_binlog.inc b/mysql-test/include/unsafe_binlog.inc index 824ee2a61d724..1fd1f0e01b64d 100644 --- a/mysql-test/include/unsafe_binlog.inc +++ b/mysql-test/include/unsafe_binlog.inc @@ -21,7 +21,7 @@ # Test cases for bug#15650 # DELETE with LEFT JOIN crashes server with innodb_locks_unsafe_for_binlog # - +--disable_service_connection --disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; --enable_warnings @@ -52,15 +52,19 @@ eval create table t1(a int not null, b int, primary key(a)) engine = $engine_typ insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); commit; set autocommit = 0; +--disable_view_protocol select * from t1 lock in share mode; +--enable_view_protocol update t1 set b = 5 where b = 1; connection b; set autocommit = 0; # # S-lock to records (2,2),(4,2), and (6,2) should not be released in a update # +--disable_view_protocol --error ER_LOCK_WAIT_TIMEOUT select * from t1 where a = 2 and b = 2 for update; +--enable_view_protocol connection a; commit; connection b; @@ -113,7 +117,9 @@ eval create table t2(d int not null, e int, primary key(d)) engine = $engine_typ insert into t2 values (8,6),(12,1),(3,1); commit; set autocommit = 0; +--disable_view_protocol select * from t2 for update; +--enable_view_protocol connection b; set autocommit = 0; insert into t1 select * from t2; @@ -171,7 +177,9 @@ eval create table t9(d int not null, e int, primary key(d)) engine = $engine_typ insert into t9 values (8,6),(12,1),(3,1); commit; set autocommit = 0; +--disable_view_protocol select * from t2 for update; +--enable_view_protocol connection b; set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; @@ -263,3 +271,4 @@ disconnect h; disconnect i; disconnect j; drop table t1, t2, t3, t5, t6, t8, t9; +--enable_service_connection diff --git a/mysql-test/include/update_use_source.inc b/mysql-test/include/update_use_source.inc index 864b58e5d7f3a..3c487704233c1 100644 --- a/mysql-test/include/update_use_source.inc +++ b/mysql-test/include/update_use_source.inc @@ -4,6 +4,8 @@ --echo # Update a with value from subquery on the same table, no search clause. ALL access --echo # +#Enable view protocol after fix MDEV-29207 +--disable_view_protocol start transaction; --enable_info ONCE update t1 @@ -145,3 +147,4 @@ update t1 order by c3 desc limit 2; select concat(old_c1,'->',c1),c3, case when c1 != old_c1 then '*' else ' ' end "Changed" from t1 ; rollback; +--enable_view_protocol diff --git a/mysql-test/include/wait_until_disconnected.inc b/mysql-test/include/wait_until_disconnected.inc index 93ada7f11cefd..3854369bb6057 100644 --- a/mysql-test/include/wait_until_disconnected.inc +++ b/mysql-test/include/wait_until_disconnected.inc @@ -9,7 +9,7 @@ let $counter= 600; let $mysql_errno= 0; while (!$mysql_errno) { - --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013 + --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2026,2013,5014 show status; dec $counter; diff --git a/mysql-test/include/weight_string.inc b/mysql-test/include/weight_string.inc index 1ae8801c56049..78c013d7d0218 100644 --- a/mysql-test/include/weight_string.inc +++ b/mysql-test/include/weight_string.inc @@ -33,7 +33,8 @@ DROP TABLE t1; # # End of MDEV-5180 # - +#enable after fix MDEV-29290 +--disable_view_protocol select hex(weight_string('a')); select hex(weight_string('A')); select hex(weight_string('abc')); @@ -64,3 +65,4 @@ select hex(weight_string('abc', 3, 4, 0xC0)); select hex(weight_string('abc', 4, 4, 0xC0)); select hex(weight_string('abc', 5, 4, 0xC0)); select hex(weight_string('abc',25, 4, 0xC0)); +--enable_view_protocol diff --git a/mysql-test/include/weight_string_8140.inc b/mysql-test/include/weight_string_8140.inc index f91d40a1381e1..5e1351e368005 100644 --- a/mysql-test/include/weight_string_8140.inc +++ b/mysql-test/include/weight_string_8140.inc @@ -1,3 +1,5 @@ +#enable after fix MDEV-29290 +--disable_view_protocol select collation(cast(0x8140 as char)); select hex(weight_string(cast(0x6141 as char))); select hex(weight_string(cast(0x8140 as char))); @@ -33,4 +35,4 @@ select hex(weight_string(cast(0x814081408140 as char), 3, 4, 0xC0)); select hex(weight_string(cast(0x814081408140 as char), 4, 4, 0xC0)); select hex(weight_string(cast(0x814081408140 as char), 5, 4, 0xC0)); select hex(weight_string(cast(0x814081408140 as char),25, 4, 0xC0)); - +--enable_view_protocol diff --git a/mysql-test/include/weight_string_8EA1.inc b/mysql-test/include/weight_string_8EA1.inc index 0396fc9d808fb..95a502932fdf6 100644 --- a/mysql-test/include/weight_string_8EA1.inc +++ b/mysql-test/include/weight_string_8EA1.inc @@ -1,3 +1,5 @@ +#enable after fix MDEV-29290 +--disable_view_protocol select collation(cast(0xA1A1 as char)); select hex(weight_string(cast(0x6141 as char))); select hex(weight_string(cast(0x8EA1 as char))); @@ -33,4 +35,4 @@ select hex(weight_string(cast(0x8EA18EA18EA1 as char), 3, 4, 0xC0)); select hex(weight_string(cast(0x8EA18EA18EA1 as char), 4, 4, 0xC0)); select hex(weight_string(cast(0x8EA18EA18EA1 as char), 5, 4, 0xC0)); select hex(weight_string(cast(0x8EA18EA18EA1 as char),25, 4, 0xC0)); - +--enable_view_protocol diff --git a/mysql-test/include/weight_string_8FA2C3.inc b/mysql-test/include/weight_string_8FA2C3.inc index 936b2e6c5e095..bce5c81640652 100644 --- a/mysql-test/include/weight_string_8FA2C3.inc +++ b/mysql-test/include/weight_string_8FA2C3.inc @@ -1,3 +1,5 @@ +#enable after fix MDEV-29290 +--disable_view_protocol select collation(cast(0x8FA2C3 as char)); select hex(weight_string(cast(0x6141 as char))); select hex(weight_string(cast(0x8FA2C3 as char))); @@ -33,4 +35,4 @@ select hex(weight_string(cast(0x8FA2C38FA2C38FA2C3 as char), 3, 4, 0xC0)); select hex(weight_string(cast(0x8FA2C38FA2C38FA2C3 as char), 4, 4, 0xC0)); select hex(weight_string(cast(0x8FA2C38FA2C38FA2C3 as char), 5, 4, 0xC0)); select hex(weight_string(cast(0x8FA2C38FA2C38FA2C3 as char),25, 4, 0xC0)); - +--enable_view_protocol diff --git a/mysql-test/include/weight_string_A1A1.inc b/mysql-test/include/weight_string_A1A1.inc index 34ace06d203c5..8a5111065ba82 100644 --- a/mysql-test/include/weight_string_A1A1.inc +++ b/mysql-test/include/weight_string_A1A1.inc @@ -1,3 +1,5 @@ +#enable after fix MDEV-29290 +--disable_view_protocol select collation(cast(0xA1A1 as char)); select hex(weight_string(cast(0x6141 as char))); select hex(weight_string(cast(0xA1A1 as char))); @@ -33,4 +35,4 @@ select hex(weight_string(cast(0xA1A1A1A1A1A1 as char), 3, 4, 0xC0)); select hex(weight_string(cast(0xA1A1A1A1A1A1 as char), 4, 4, 0xC0)); select hex(weight_string(cast(0xA1A1A1A1A1A1 as char), 5, 4, 0xC0)); select hex(weight_string(cast(0xA1A1A1A1A1A1 as char),25, 4, 0xC0)); - +--enable_view_protocol diff --git a/mysql-test/include/weight_string_chde.inc b/mysql-test/include/weight_string_chde.inc index 97c929605f9b2..54852a8c203d2 100644 --- a/mysql-test/include/weight_string_chde.inc +++ b/mysql-test/include/weight_string_chde.inc @@ -1,3 +1,5 @@ +#enable after fix MDEV-29290 +--disable_view_protocol select @@collation_connection; select collation(cast(_latin1 0xDF as char)); select hex(weight_string('s')); @@ -57,3 +59,4 @@ select hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 4,0xC0)); select hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 4,0xC0)); select hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 4,0xC0)); select hex(weight_string(cast(_latin1 0xDF6368 as char),25, 4,0xC0)); +--enable_view_protocol diff --git a/mysql-test/include/weight_string_euro.inc b/mysql-test/include/weight_string_euro.inc index e888bdc3df0c2..835c515b6be45 100644 --- a/mysql-test/include/weight_string_euro.inc +++ b/mysql-test/include/weight_string_euro.inc @@ -1,3 +1,5 @@ +#enable after fix MDEV-29290 +--disable_view_protocol select @@collation_connection; select hex(weight_string(cast(_latin1 0x80 as char))); select hex(weight_string(cast(_latin1 0x808080 as char))); @@ -28,3 +30,4 @@ select hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)); select hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)); select hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)); select hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)); +--enable_view_protocol diff --git a/mysql-test/include/weight_string_l1.inc b/mysql-test/include/weight_string_l1.inc index f5ad279e563f3..20b353c72bfe5 100644 --- a/mysql-test/include/weight_string_l1.inc +++ b/mysql-test/include/weight_string_l1.inc @@ -1,3 +1,5 @@ +#enable after fix MDEV-29290 +--disable_view_protocol select @@collation_connection; select hex(weight_string('a' LEVEL 1)); select hex(weight_string('A' LEVEL 1)); @@ -8,3 +10,4 @@ select hex(weight_string('abc' as char(5) LEVEL 1)); select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)); select hex(weight_string('abc' as char(5) LEVEL 1 DESC)); select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)); +--enable_view_protocol diff --git a/mysql-test/include/weight_string_l2.inc b/mysql-test/include/weight_string_l2.inc index 1802fcc9c7947..28f90aa5789f9 100644 --- a/mysql-test/include/weight_string_l2.inc +++ b/mysql-test/include/weight_string_l2.inc @@ -1,3 +1,5 @@ +#enable after fix MDEV-29290 +--disable_view_protocol select @@collation_connection; select hex(weight_string('a' LEVEL 2)); select hex(weight_string('A' LEVEL 2)); @@ -5,3 +7,4 @@ select hex(weight_string('abc' LEVEL 2)); select hex(weight_string('abc' as char(2) LEVEL 2)); select hex(weight_string('abc' as char(3) LEVEL 2)); select hex(weight_string('abc' as char(5) LEVEL 2)); +--disable_view_protocol diff --git a/mysql-test/lib/My/CoreDump.pm b/mysql-test/lib/My/CoreDump.pm index ae30f4f607472..be6d21146d147 100644 --- a/mysql-test/lib/My/CoreDump.pm +++ b/mysql-test/lib/My/CoreDump.pm @@ -19,9 +19,143 @@ package My::CoreDump; use strict; use Carp; use My::Platform; +use Text::Wrap; +use Data::Dumper; use File::Temp qw/ tempfile tempdir /; +use File::Find; +use File::Basename; use mtr_results; +use mtr_report; + +my %opts; +my %config; +my $help = "\n\nOptions for printing core dumps\n\n"; + +sub register_opt($$$) { + my ($name, $format, $msg)= @_; + my @names= split(/\|/, $name); + my $option_name= $names[0]; + $option_name=~ s/-/_/; + $opts{$name. $format}= \$config{$option_name}; + $help.= wrap(sprintf(" %-23s", join(', ', @names)), ' 'x25, "$msg\n"); +} + +# To preserve order we use array instead of hash +my @print_formats= ( + short => { + description => "Failing stack trace", + codes => {} + }, + medium => { + description => "All stack traces", + codes => {} + }, + detailed => { + description => "All stack traces with debug context", + codes => {} + }, + custom => { + description => "Custom debugger script for printing stack" + }, + # 'no' must be last (check generated help) + no => { + description => "Skip stack trace printing" + } +); + +# TODO: make class for each {method, get_code} +my @print_methods= (IS_WINDOWS) ? (cdb => { method => \&_cdb }) : ( + gdb => { + method => \&_gdb, + get_code => \&_gdb_format, + }, + dbx => { + method => \&_dbx + }, + lldb => { + method => \&_lldb + }, + # 'auto' must be last (check generated help) + auto => { + method => \&_auto + } +); + +# But we also use hash +my %print_formats= @print_formats; +my %print_methods= @print_methods; + +# and scalar +my $x= 0; +my $print_formats= join(', ', grep { ++$x % 2 } @print_formats); +$x= 0; +my $print_methods= join(', ', grep { ++$x % 2 } @print_methods); + +# Fill 'short' and 'detailed' formats per each print_method +# that has interface for that +for my $f (keys %print_formats) +{ + next unless exists $print_formats{$f}->{codes}; + for my $m (keys %print_methods) + { + next unless exists $print_methods{$m}->{get_code}; + # That calls f.ex. _gdb_format('short') + # and assigns { gdb => value-of-_gdb_format } into $print_formats{short}->{format}: + $print_formats{$f}->{codes}->{$m}= $print_methods{$m}->{get_code}->($f); + } +} + +register_opt('print-core|C', ':s', + "Print core dump format: ". $print_formats. " (for not printing cores). ". + "Defaults to value of MTR_PRINT_CORE or 'medium'"); +if (!IS_WINDOWS) +{ + register_opt('print-method', '=s', + "Print core method: ". join(', ', $print_methods). " (try each method until success). ". + "Defaults to 'auto'"); +} + +sub options() { %opts } +sub help() { $help } + + +sub env_or_default($$) { + my ($default, $env)= @_; + if (exists $ENV{$env}) { + my $f= $ENV{$env}; + $f= 'custom' + if $f =~ m/^custom:/; + return $ENV{$env} + if exists $print_formats{$f}; + mtr_verbose("$env value ignored: $ENV{$env}"); + } + return $default; +} + +sub pre_setup() { + $config{print_core}= env_or_default('medium', 'MTR_PRINT_CORE') + if not defined $config{print_core}; + $config{print_method}= (IS_WINDOWS) ? 'cdb' : 'auto' + if not defined $config{print_method}; + # If the user has specified 'custom' we fill appropriate print_format + # and that will be used automatically + # Note: this can assign 'custom' to method 'auto'. + if ($config{print_core} =~ m/^custom:(.+)$/) { + $config{print_core}= 'custom'; + $print_formats{'custom'}= { + $config{print_method} => $1 + } + } + mtr_error "Wrong value for --print-core: $config{print_core}" + if not exists $print_formats{$config{print_core}}; + mtr_error "Wrong value for --print-method: $config{print_method}" + if not exists $print_methods{$config{print_method}}; + + mtr_debug(Data::Dumper->Dump( + [\%config, \%print_formats, \%print_methods], + [qw(config print_formats print_methods)])); +} my $hint_mysqld; # Last resort guess for executable path @@ -50,8 +184,38 @@ sub _verify_binpath { return $binpath; } + +# Returns GDB code according to specified format + +# Note: this is like simple hash, separate interface was made +# in advance for implementing below TODO + +# TODO: _gdb_format() and _gdb() should be separate class +# (like the other printing methods) + +sub _gdb_format($) { + my ($format)= @_; + my %formats= ( + short => "bt\n", + medium => "thread apply all bt\n", + detailed => + "bt\n". + "set print sevenbit on\n". + "set print static-members off\n". + "set print frame-arguments all\n". + "thread apply all bt full\n". + "quit\n" + ); + confess "Unknown format: ". $format + unless exists $formats{$format}; + return $formats{$format}; +} + + sub _gdb { - my ($core_name)= @_; + my ($core_name, $code)= @_; + confess "Undefined format" + unless defined $code; # Check that gdb exists `gdb --version`; @@ -61,7 +225,7 @@ sub _gdb { } if (-f $core_name) { - print "\nTrying 'gdb' to get a backtrace from coredump $core_name\n"; + mtr_verbose("Trying 'gdb' to get a backtrace from coredump $core_name"); } else { print "\nCoredump $core_name does not exist, cannot run 'gdb'\n"; return; @@ -76,10 +240,7 @@ sub _gdb { # Create tempfile containing gdb commands my ($tmp, $tmp_name) = tempfile(); - print $tmp - "bt\n", - "thread apply all bt\n", - "quit\n"; + print $tmp $code; close $tmp or die "Error closing $tmp_name: $!"; # Run gdb @@ -102,7 +263,7 @@ EOF sub _dbx { - my ($core_name)= @_; + my ($core_name, $format)= @_; print "\nTrying 'dbx' to get a backtrace\n"; @@ -149,43 +310,16 @@ sub cdb_check { `cdb -? 2>&1`; if ($? >> 8) { - print "Cannot find cdb. Please Install Debugging tools for Windows\n"; - print "from http://www.microsoft.com/whdc/devtools/debugging/"; - if($ENV{'ProgramW6432'}) - { - print "install64bit.mspx (native x64 version)\n"; - } - else - { - print "installx86.mspx\n"; - } + print "Cannot find the cdb debugger. Please install Debugging tools for Windows\n"; + print "and set PATH environment variable to include location of cdb.exe"; } } sub _cdb { - my ($core_name)= @_; + my ($core_name, $format)= @_; print "\nTrying 'cdb' to get a backtrace\n"; return unless -f $core_name; - - # Try to set environment for debugging tools for Windows - if ($ENV{'PATH'} !~ /Debugging Tools/) - { - if ($ENV{'ProgramW6432'}) - { - # On x64 computer - $ENV{'PATH'}.= ";".$ENV{'ProgramW6432'}."\\Debugging Tools For Windows (x64)"; - } - else - { - # On x86 computer. Newest versions of Debugging tools are installed in the - # directory with (x86) suffix, older versions did not have this suffix. - $ENV{'PATH'}.= ";".$ENV{'ProgramFiles'}."\\Debugging Tools For Windows (x86)"; - $ENV{'PATH'}.= ";".$ENV{'ProgramFiles'}."\\Debugging Tools For Windows"; - } - } - - # Read module list, find out the name of executable and # build symbol path (required by cdb if executable was built on # different machine) @@ -223,7 +357,7 @@ sub _cdb { if (!$ENV{'_NT_SYMBOL_PATH'}) { my $windir= $ENV{'windir'}; - my $symbol_cache= substr($windir ,0, index($windir,'\\'))."\\cdb_symbols"; + my $symbol_cache= substr($windir ,0, index($windir,'\\'))."\\symbols"; print "OS debug symbols will be downloaded and stored in $symbol_cache.\n"; print "You can control the location of symbol cache with _NT_SYMBOL_PATH\n"; @@ -301,37 +435,81 @@ EOF } +sub _auto +{ + my ($core_name, $code, $rest)= @_; + # We use ordered array @print_methods and omit auto itself + my @valid_methods= @print_methods[0 .. $#print_methods - 2]; + my $x= 0; + my @methods= grep { ++$x % 2} @valid_methods; + my $f= $config{print_core}; + foreach my $m (@methods) + { + my $debugger= $print_methods{$m}; + confess "Broken @print_methods" + if $debugger->{method} == \&_auto; + # If we didn't find format for 'auto' (that is only possible for 'custom') + # we get format for specific debugger + if (not defined $code && defined $print_formats{$f} and + exists $print_formats{$f}->{codes}->{$m}) + { + $code= $print_formats{$f}->{codes}->{$m}; + } + mtr_verbose2("Trying to print with method ${m}:${f}"); + if ($debugger->{method}->($core_name, $code)) { + return; + } + } +} -sub show { - my ($class, $core_name, $exe_mysqld, $parallel)= @_; - $hint_mysqld= $exe_mysqld; - # On Windows, rely on cdb to be there... - if (IS_WINDOWS) - { - _cdb($core_name); - return; +sub show { + my ($core_name, $exe_mysqld, $parallel)= @_; + if ($config{print_core} ne 'no') { + my $f= $config{print_core}; + my $m= $config{print_method}; + my $code= undef; + if (exists $print_formats{$f}->{codes} and + exists $print_formats{$f}->{codes}->{$m}) { + $code= $print_formats{$f}->{codes}->{$m}; + } + mtr_verbose2("Printing core with method ${m}:${f}"); + mtr_debug("code: ${code}"); + $print_methods{$m}->{method}->($core_name, $code); } - - # We try dbx first; gdb itself may coredump if run on a Sun Studio - # compiled binary on Solaris. + return; +} - my @debuggers = - ( - \&_dbx, - \&_gdb, - \&_lldb, - # TODO... - ); - # Try debuggers until one succeeds +sub core_wanted($$$$$) { + my ($num_saved_cores, $opt_max_save_core, $compress, + $exe_mysqld, $opt_parallel)= @_; + my $core_file= $File::Find::name; + my $core_name= basename($core_file); - foreach my $debugger (@debuggers){ - if ($debugger->($core_name)){ - return; + # Name beginning with core, not ending in .gz + if (($core_name =~ /^core/ and $core_name !~ /\.gz$/) + or (IS_WINDOWS and $core_name =~ /\.dmp$/)) + { + # Ending with .dmp + mtr_report(" - found '$core_name'", + "($$num_saved_cores/$opt_max_save_core)"); + + show($core_file, $exe_mysqld, $opt_parallel); + + # Limit number of core files saved + if ($$num_saved_cores >= $opt_max_save_core) + { + mtr_report(" - deleting it, already saved", + "$opt_max_save_core"); + unlink("$core_file"); + } + else + { + main::mtr_compress_file($core_file) if $compress; + ++$$num_saved_cores; } } - return; } diff --git a/mysql-test/lib/My/Debugger.pm b/mysql-test/lib/My/Debugger.pm index 4235abd788707..c2062c2eaba13 100644 --- a/mysql-test/lib/My/Debugger.pm +++ b/mysql-test/lib/My/Debugger.pm @@ -5,6 +5,7 @@ use warnings; use Text::Wrap; use Cwd; use My::Platform; +use mtr_report; # 1. options to support: # --xxx[=ARGS] @@ -108,6 +109,10 @@ EEE my %opts; my %opt_vals; +my $debugger; +my $boot_debugger; +my $client_debugger; + my $help = "\n\nOptions for running debuggers\n\n"; for my $k (sort keys %debuggers) { @@ -142,7 +147,7 @@ sub do_args($$$$$) { my $v = $debuggers{$k}; # on windows mtr args are quoted (for system), otherwise not (for exec) - sub quote($) { $_[0] =~ /[; ]/ ? "\"$_[0]\"" : $_[0] } + sub quote($) { $_[0] =~ /[; >]/ ? "\"$_[0]\"" : $_[0] } sub unquote($) { $_[0] =~ s/^"(.*)"$/$1/; $_[0] } sub quote_from_mtr($) { IS_WINDOWS() ? $_[0] : quote($_[0]) } sub unquote_for_mtr($) { IS_WINDOWS() ? $_[0] : unquote($_[0]) } @@ -164,7 +169,7 @@ sub do_args($$$$$) { if ($v->{script}) { ::mtr_tonewfile($vars{script}, subst($v->{script}, %vars)."\n".$script); } elsif ($script) { - die "$k is not using a script file, nowhere to write the script \n---\n$script\n---\n"; + mtr_error "$k is not using a script file, nowhere to write the script \n---\n$script\n---"; } my $options = subst($v->{options}, %vars); @@ -189,16 +194,23 @@ sub help() { $help } sub fix_options(@) { my $re=join '|', keys %opts; $re =~ s/=s//g; + # FIXME: what is '=;'? What about ':s' to denote optional argument in register_opt() map { $_ . (/^--($re)$/ and '=;') } @_; } sub pre_setup() { my $used; my $interactive; + my %options; + my %client_options; + my %boot_options; + + my $embedded= $::opt_embedded_server ? ' with --embedded' : ''; + for my $k (keys %debuggers) { for my $opt ($k, "manual-$k", "boot-$k", "client-$k") { - if ($opt_vals{$opt}) - { + my $val= $opt_vals{$opt}; + if ($val) { $used = 1; $interactive ||= ($debuggers{$k}->{interactive} || $debuggers{$k}->{term} || @@ -207,10 +219,40 @@ sub pre_setup() { $debuggers{$k}->{pre}->(); delete $debuggers{$k}->{pre}; } + if ($opt eq $k) { + $options{$opt}= $val; + $client_options{$opt}= $val + if $embedded; + } elsif ($opt eq "manual-$k") { + $options{$opt}= $val; + } elsif ($opt eq "boot-$k") { + $boot_options{$opt}= $val; + } elsif ($opt eq "client-$k") { + $client_options{$opt}= $val; + } } } } + if ((keys %options) > 1) { + mtr_error "Multiple debuggers specified: ", + join (" ", map { "--$_" } keys %options); + } + + if ((keys %boot_options) > 1) { + mtr_error "Multiple boot debuggers specified: ", + join (" ", map { "--$_" } keys %boot_options); + } + + if ((keys %client_options) > 1) { + mtr_error "Multiple client debuggers specified: ", + join (" ", map { "--$_" } keys %client_options); + } + + $debugger= (keys %options)[0]; + $boot_debugger= (keys %boot_options)[0]; + $client_debugger= (keys %client_options)[0]; + if ($used) { $ENV{ASAN_OPTIONS}= 'abort_on_error=1:'.($ENV{ASAN_OPTIONS} || ''); ::mtr_error("Can't use --extern when using debugger") if $ENV{USE_RUNNING_SERVER}; @@ -226,49 +268,20 @@ sub pre_setup() { sub setup_boot_args($$$) { my ($args, $exe, $input) = @_; - my $found; - - for my $k (keys %debuggers) { - if ($opt_vals{"boot-$k"}) { - die "--boot-$k and --$found cannot be used at the same time\n" if $found; - - $found="boot-$k"; - do_args($args, $exe, $input, 'bootstrap', $found); - } - } + do_args($args, $exe, $input, 'bootstrap', $boot_debugger) + if defined $boot_debugger; } sub setup_client_args($$) { my ($args, $exe) = @_; - my $found; - my $embedded = $::opt_embedded_server ? ' with --embedded' : ''; - - for my $k (keys %debuggers) { - my @opt_names=("client-$k"); - push @opt_names, $k if $embedded; - for my $opt (@opt_names) { - if ($opt_vals{$opt}) { - die "--$opt and --$found cannot be used at the same time$embedded\n" if $found; - $found=$opt; - do_args($args, $exe, IS_WINDOWS() ? 'NUL' : '/dev/null', 'client', $found); - } - } - } + do_args($args, $exe, IS_WINDOWS() ? 'NUL' : '/dev/null', 'client', $client_debugger) + if defined $client_debugger; } sub setup_args($$$) { my ($args, $exe, $type) = @_; - my $found; - - for my $k (keys %debuggers) { - for my $opt ($k, "manual-$k") { - if ($opt_vals{$opt}) { - die "--$opt and --$found cannot be used at the same time\n" if $found; - $found=$opt; - do_args($args, $exe, IS_WINDOWS() ? 'NUL' : '/dev/null', $type, $found); - } - } - } + do_args($args, $exe, IS_WINDOWS() ? 'NUL' : '/dev/null', $type, $debugger) + if defined $debugger; } 1; diff --git a/mysql-test/lib/My/Options.pm b/mysql-test/lib/My/Options.pm index 5827e0666a662..b3ae64cb4c209 100644 --- a/mysql-test/lib/My/Options.pm +++ b/mysql-test/lib/My/Options.pm @@ -142,11 +142,11 @@ sub diff { sub is_subset { my ($set, $subset)= @_; - my %cache = map { _split_option($_) } @$set; + my %cache = map { join('=', _split_option($_)), 1 } @$set; for (@$subset){ my ($name, $value)= _split_option($_); - return 0 unless exists $cache{$name} and $cache{$name} eq $value; + return 0 unless $cache{"$name=$value"}; } return 1; diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc index 4d0d1e2a3a019..dcf9491d2d60b 100644 --- a/mysql-test/lib/My/SafeProcess/safe_process.cc +++ b/mysql-test/lib/My/SafeProcess/safe_process.cc @@ -140,13 +140,20 @@ void handle_core(pid_t pid __attribute__((unused))) {} static int kill_child(bool was_killed) { int status= 0; + pid_t ret_pid= 0; message("Killing child: %d", child_pid); // Terminate whole process group if (! was_killed) - kill(-child_pid, SIGKILL); + { + kill(-child_pid, SIGTERM); + sleep(10); // will be interrupted by SIGCHLD + if (!(ret_pid= waitpid(child_pid, &status, WNOHANG))) + kill(-child_pid, SIGKILL); + } - pid_t ret_pid= waitpid(child_pid, &status, 0); + if (!ret_pid) + ret_pid= waitpid(child_pid, &status, 0); if (ret_pid == child_pid) { int exit_code= 1; diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index adc911ba93757..fe202279ac756 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -87,7 +87,7 @@ sub init_pattern { # separator betwen suite and testname), make the pattern match # beginning of string $from= "^$from"; - mtr_verbose("$what='$from'"); + mtr_verbose2("$what='$from'"); } # Check that pattern is a valid regex eval { "" =~/$from/; 1 } or @@ -293,7 +293,7 @@ sub combinations_from_file($$) 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"); + mtr_verbose2("Read combinations file $filename"); my $config= My::Config->new($filename); foreach my $group ($config->option_groups()) { my $comb= { name => $group->name(), comb_opt => [] }; @@ -427,9 +427,9 @@ sub collect_suite_name($$) sub collect_one_suite { my ($opt_cases, $suitename, $over, $suitedir, @overlays) = @_; - mtr_verbose("Collecting: $suitename"); - mtr_verbose("suitedir: $suitedir"); - mtr_verbose("overlays: @overlays") if @overlays; + mtr_verbose2("Collecting: $suitename"); + mtr_verbose2("suitedir: $suitedir"); + mtr_verbose2("overlays: @overlays") if @overlays; # we always need to process the parent suite, even if we won't use any # test from it. @@ -501,8 +501,8 @@ sub process_suite { $suite->{rdir} = -d $rdir ? $rdir : $suite->{tdir}; } - mtr_verbose("testdir: " . $suite->{tdir}); - mtr_verbose( "resdir: " . $suite->{rdir}); + mtr_verbose2("testdir: " . $suite->{tdir}); + mtr_verbose2( "resdir: " . $suite->{rdir}); # disabled.def parse_disabled($suite->{dir} .'/disabled.def', $suitename); @@ -512,7 +512,7 @@ sub process_suite { if (@::opt_combinations) { # take the combination from command-line - mtr_verbose("Take the combination from command line"); + mtr_verbose2("Take the combination from command line"); foreach my $combination (@::opt_combinations) { my $comb= {}; $comb->{name}= $combination; @@ -1037,7 +1037,7 @@ sub get_tags_from_file($$) { } # Check for a sourced include file. - if ($line =~ /^(--)?[[:space:]]*source[[:space:]]+([^;[:space:]]+)/) + if ($line =~ /^[[:space:]]*(--)?[[:space:]]*source[[:space:]]+([^;[:space:]]+)/) { my $include= $2; # The rules below must match open_file() function of mysqltest.cc diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index 42254bd29b79e..6e2ada467920f 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -46,7 +46,7 @@ BEGIN sub mtr_ping_port ($) { my $port= shift; - mtr_verbose("mtr_ping_port: $port"); + mtr_verbose2("mtr_ping_port: $port"); if (IS_WINDOWS && USE_NETPING) { @@ -56,12 +56,12 @@ ($) $ping->port_number($port); if ($ping->ping("localhost",0.1)) { - mtr_verbose("USED"); + mtr_verbose2("USED"); return 1; } else { - mtr_verbose("FREE"); + mtr_verbose2("FREE"); return 0; } } @@ -84,12 +84,12 @@ ($) if ( connect(SOCK, $paddr) ) { close(SOCK); # FIXME check error? - mtr_verbose("USED"); + mtr_verbose2("USED"); return 1; } else { - mtr_verbose("FREE"); + mtr_verbose2("FREE"); return 0; } } diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index 8144a6ef02e9e..2a8ed65eb2c19 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -27,7 +27,7 @@ use Sys::Hostname; use base qw(Exporter); our @EXPORT= qw(report_option mtr_print_line mtr_print_thick_line mtr_print_header mtr_report mtr_report_stats - mtr_warning mtr_error mtr_debug mtr_verbose + mtr_warning mtr_error mtr_debug mtr_verbose mtr_verbose2 mtr_verbose_restart mtr_report_test_passed mtr_report_test_skipped mtr_print mtr_report_test isotime); @@ -716,6 +716,15 @@ sub mtr_verbose (@) { } +sub mtr_verbose2 (@) { + if ( $verbose > 1 ) + { + print STDERR _name(). _timestamp(). + "> ".join(" ", @_)."\n"; + } +} + + sub mtr_verbose_restart (@) { my ($server, @args)= @_; my $proc= $server->{proc}; diff --git a/mysql-test/lib/v1/mtr_cases.pl b/mysql-test/lib/v1/mtr_cases.pl index faa673a930432..cc190cb39f792 100644 --- a/mysql-test/lib/v1/mtr_cases.pl +++ b/mysql-test/lib/v1/mtr_cases.pl @@ -126,19 +126,19 @@ ($) { my $base_name= $1; my $idx= $2; - mtr_verbose("$test_name => $base_name idx=$idx"); + mtr_verbose2("$test_name => $base_name idx=$idx"); if ( $idx > 1 ) { $idx-= 1; $base_name= "$base_name$idx"; - mtr_verbose("New basename $base_name"); + mtr_verbose2("New basename $base_name"); } foreach my $tinfo2 (@$cases) { if ( $tinfo2->{'name'} eq $base_name ) { - mtr_verbose("found dependent test $tinfo2->{'name'}"); + mtr_verbose2("found dependent test $tinfo2->{'name'}"); $depend_on_test_name=$base_name; } } @@ -146,7 +146,7 @@ ($) if ( defined $depend_on_test_name ) { - mtr_verbose("Giving $test_name same critera as $depend_on_test_name"); + mtr_verbose2("Giving $test_name same critera as $depend_on_test_name"); $sort_criteria{$test_name} = $sort_criteria{$depend_on_test_name}; } else @@ -224,14 +224,14 @@ ($) my $suite= shift; # Test suite name my @cases; # Array of hash - mtr_verbose("Collecting: $suite"); + mtr_verbose2("Collecting: $suite"); my $suitedir= "$::glob_mysql_test_dir"; # Default if ( $suite ne "main" ) { $suitedir= mtr_path_exists("$suitedir/suite/$suite", "$suitedir/$suite"); - mtr_verbose("suitedir: $suitedir"); + mtr_verbose2("suitedir: $suitedir"); } my $testdir= "$suitedir/t"; @@ -363,7 +363,7 @@ ($) if (@::opt_combinations) { # take the combination from command-line - mtr_verbose("Take the combination from command line"); + mtr_verbose2("Take the combination from command line"); foreach my $combination (@::opt_combinations) { my $comb= {}; $comb->{name}= $combination; @@ -374,7 +374,7 @@ ($) elsif (-f $combination_file ) { # Read combinations file in my.cnf format - mtr_verbose("Read combinations file"); + mtr_verbose2("Read combinations file"); my $config= My::Config->new($combination_file); foreach my $group ($config->groups()) { @@ -605,7 +605,7 @@ ($$$$$$$$$) # Add suite opts foreach my $opt ( @$suite_opts ) { - mtr_verbose($opt); + mtr_verbose2($opt); push(@{$tinfo->{'master_opt'}}, $opt); push(@{$tinfo->{'slave_opt'}}, $opt); } diff --git a/mysql-test/lib/v1/mtr_timer.pl b/mysql-test/lib/v1/mtr_timer.pl index 630a93ca7dc50..98dc27b3f0f79 100644 --- a/mysql-test/lib/v1/mtr_timer.pl +++ b/mysql-test/lib/v1/mtr_timer.pl @@ -80,7 +80,7 @@ ($$$) if ( $tpid ) { # Parent, record the information - mtr_verbose("Starting timer for '$name',", + mtr_verbose2("Starting timer for '$name',", "duration: $duration, pid: $tpid"); $timers->{'timers'}->{$name}->{'pid'}= $tpid; $timers->{'timers'}->{$name}->{'duration'}= $duration; @@ -96,13 +96,13 @@ ($$$) $SIG{INT}= 'DEFAULT'; $SIG{TERM}= sub { - mtr_verbose("timer $$ woke up, exiting!"); + mtr_verbose2("timer $$ woke up, exiting!"); exit(0); }; $0= "mtr_timer(timers,$name,$duration)"; sleep($duration); - mtr_verbose("timer $$ expired after $duration seconds"); + mtr_verbose2("timer $$ expired after $duration seconds"); exit(0); } } diff --git a/mysql-test/main/alias.result b/mysql-test/main/alias.result index 78a1eead1db7e..e6387de50a71a 100644 --- a/mysql-test/main/alias.result +++ b/mysql-test/main/alias.result @@ -257,7 +257,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x'FF32'` varbinary(2) NOT NULL, `CONCAT(x'FF32')` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CALL test_inject(x'FF32'); �2 CONCAT('�2') @@ -265,7 +265,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `�2` varchar(2) NOT NULL, `CONCAT('�2')` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT x'32FF', CONCAT(x'32FF') LIMIT 0; x'32FF' CONCAT(x'32FF') CREATE TABLE t1 AS SELECT x'32FF', CONCAT(x'32FF'); @@ -274,7 +274,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x'32FF'` varbinary(2) NOT NULL, `CONCAT(x'32FF')` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CALL test_inject(x'32FF'); 2� CONCAT('2�') @@ -282,7 +282,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `2�` varchar(2) NOT NULL, `CONCAT('2�')` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT x'0032', CONCAT(x'0032') LIMIT 0; x'0032' CONCAT(x'0032') CREATE TABLE t1 AS SELECT x'0032', CONCAT(x'0032'); @@ -291,7 +291,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x'0032'` varbinary(2) NOT NULL, `CONCAT(x'0032')` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CALL test_inject(x'0032'); 2 CONCAT('\x002') @@ -299,7 +299,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `2` varchar(2) NOT NULL, `CONCAT('\x002')` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT x'3200', CONCAT(x'3200') LIMIT 0; x'3200' CONCAT(x'3200') CREATE TABLE t1 AS SELECT x'3200', CONCAT(x'3200'); @@ -308,7 +308,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x'3200'` varbinary(2) NOT NULL, `CONCAT(x'3200')` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CALL test_inject(x'3200'); 2\x00 CONCAT('2\x00') @@ -316,7 +316,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `2\x00` varchar(2) NOT NULL, `CONCAT('2\x00')` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT '0\a', CONCAT('0\a') LIMIT 0; 0a CONCAT('0\a') CREATE TABLE t1 AS SELECT '0\a', CONCAT('0\a'); @@ -325,7 +325,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `0a` varchar(2) NOT NULL, `CONCAT('0\a')` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CALL test_inject('0\a'); 0a CONCAT('0a') @@ -333,7 +333,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `0a` varchar(2) NOT NULL, `CONCAT('0a')` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT 'a\0', CONCAT('a\0') LIMIT 0; a\x00 CONCAT('a\0') CREATE TABLE t1 AS SELECT 'a\0', CONCAT('a\0'); @@ -342,7 +342,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a\x00` varchar(2) NOT NULL, `CONCAT('a\0')` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CALL test_inject('a\0'); a\x00 CONCAT('a\x00') @@ -350,7 +350,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a\x00` varchar(2) NOT NULL, `CONCAT('a\x00')` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT 'a\0b', CONCAT('a\0b') LIMIT 0; a\x00b CONCAT('a\0b') CREATE TABLE t1 AS SELECT 'a\0b', CONCAT('a\0b'); @@ -359,7 +359,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a\x00b` varchar(3) NOT NULL, `CONCAT('a\0b')` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CALL test_inject('a\0b'); a\x00b CONCAT('a\x00b') @@ -367,7 +367,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a\x00b` varchar(3) NOT NULL, `CONCAT('a\x00b')` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP PROCEDURE test_inject; # # MDEV-23519 diff --git a/mysql-test/main/alias.test b/mysql-test/main/alias.test index a0c9377d6dda5..bc429656b7ea1 100644 --- a/mysql-test/main/alias.test +++ b/mysql-test/main/alias.test @@ -1,3 +1,6 @@ +#remove this include after fix MDEV-27871 +--source include/no_view_protocol.inc + --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings diff --git a/mysql-test/main/alter_table,aria.rdiff b/mysql-test/main/alter_table,aria.rdiff deleted file mode 100644 index 40bbf95494cc9..0000000000000 --- a/mysql-test/main/alter_table,aria.rdiff +++ /dev/null @@ -1,22 +0,0 @@ ---- ./mysql-test/main/alter_table.result 2020-02-27 19:35:41.279992329 +0300 -+++ ./mysql-test/main/alter_table,aria.reject 2020-02-27 19:37:13.251994491 +0300 -@@ -2716,8 +2716,7 @@ - t3 CREATE TABLE `t3` ( - `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT NULL, -- KEY `b` (`b`), -- CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`bb`) -+ KEY `b` (`b`) - ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 - ALTER TABLE t1 RENAME COLUMN bb TO b; - SHOW CREATE TABLE t1; -@@ -2733,8 +2732,7 @@ - t3 CREATE TABLE `t3` ( - `a` int(11) DEFAULT NULL, - `c` int(11) DEFAULT NULL, -- KEY `b` (`c`), -- CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t1` (`b`) -+ KEY `b` (`c`) - ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 - CREATE TABLE t4(a int); - ALTER TABLE t4 RENAME COLUMN a TO aa, ALGORITHM = INPLACE; diff --git a/mysql-test/main/alter_table,heap.rdiff b/mysql-test/main/alter_table,heap.rdiff deleted file mode 100644 index ad6fd194cc9a8..0000000000000 --- a/mysql-test/main/alter_table,heap.rdiff +++ /dev/null @@ -1,59 +0,0 @@ ---- ./mysql-test/main/alter_table.result 2020-02-27 19:35:41.279992329 +0300 -+++ ./mysql-test/main/alter_table,heap.reject 2020-02-27 19:39:44.175998039 +0300 -@@ -2716,8 +2716,7 @@ - t3 CREATE TABLE `t3` ( - `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT NULL, -- KEY `b` (`b`), -- CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`bb`) -+ KEY `b` (`b`) - ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 - ALTER TABLE t1 RENAME COLUMN bb TO b; - SHOW CREATE TABLE t1; -@@ -2733,8 +2732,7 @@ - t3 CREATE TABLE `t3` ( - `a` int(11) DEFAULT NULL, - `c` int(11) DEFAULT NULL, -- KEY `b` (`c`), -- CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t1` (`b`) -+ KEY `b` (`c`) - ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 - CREATE TABLE t4(a int); - ALTER TABLE t4 RENAME COLUMN a TO aa, ALGORITHM = INPLACE; -@@ -2774,36 +2772,6 @@ - ERROR 42S22: Unknown column 'd' in 'field list' - DROP TRIGGER trg1; - DROP PROCEDURE sp1; --CREATE TABLE t_gen(a INT, b DOUBLE GENERATED ALWAYS AS (SQRT(a))); --INSERT INTO t_gen(a) VALUES(4); --SELECT * FROM t_gen; --a b --4 2 --SHOW CREATE TABLE t_gen; --Table Create Table --t_gen CREATE TABLE `t_gen` ( -- `a` int(11) DEFAULT NULL, -- `b` double GENERATED ALWAYS AS (sqrt(`a`)) VIRTUAL --) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 --ALTER TABLE t_gen RENAME COLUMN a TO c, CHANGE COLUMN b b DOUBLE GENERATED ALWAYS AS (SQRT(c)); --SELECT * FROM t_gen; --c b --4 2 --SHOW CREATE TABLE t_gen; --Table Create Table --t_gen CREATE TABLE `t_gen` ( -- `c` int(11) DEFAULT NULL, -- `b` double GENERATED ALWAYS AS (sqrt(`c`)) VIRTUAL --) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 --ALTER TABLE t_gen CHANGE COLUMN c x INT; --show create table t_gen; --Table Create Table --t_gen CREATE TABLE `t_gen` ( -- `x` int(11) DEFAULT NULL, -- `b` double GENERATED ALWAYS AS (sqrt(`x`)) VIRTUAL --) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 --ALTER TABLE t_gen RENAME COLUMN x TO a; --DROP TABLE t_gen; - SHOW CREATE TABLE t1; - Table Create Table - t1 CREATE TABLE `t1` ( diff --git a/mysql-test/main/alter_table-big.test b/mysql-test/main/alter_table-big.test index b010815955f33..66f9593810703 100644 --- a/mysql-test/main/alter_table-big.test +++ b/mysql-test/main/alter_table-big.test @@ -5,6 +5,7 @@ --source include/big_test.inc # We are using some debug-only features in this test --source include/have_debug.inc +--source include/have_debug_sync.inc # Also we are using SBR to check that statements are executed # in proper order. --source include/have_binlog_format_mixed_or_statement.inc diff --git a/mysql-test/main/alter_table.combinations b/mysql-test/main/alter_table.combinations deleted file mode 100644 index 824e0a3be0469..0000000000000 --- a/mysql-test/main/alter_table.combinations +++ /dev/null @@ -1,5 +0,0 @@ -[innodb] - -[aria] - -[heap] diff --git a/mysql-test/main/alter_table.result b/mysql-test/main/alter_table.result index 7183f1efe0e24..879bc0edfec98 100644 --- a/mysql-test/main/alter_table.result +++ b/mysql-test/main/alter_table.result @@ -1,5 +1,3 @@ -drop table if exists t1,t2; -drop database if exists mysqltest; set @save_max_allowed_packet=@@global.max_allowed_packet; create table t1 ( col1 int not null auto_increment primary key, @@ -282,7 +280,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`t1`) flush tables; alter table t1 modify a varchar(10) not null; show create table t2; @@ -290,7 +288,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`t1`) drop table if exists t1, t2; create table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM; insert ignore into t1 (a) values(1); @@ -368,26 +366,26 @@ delete from t1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(10) CHARACTER SET koi8r DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` char(10) CHARACTER SET koi8r COLLATE koi8r_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 DEFAULT CHARACTER SET latin1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(10) CHARACTER SET koi8r DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` char(10) CHARACTER SET koi8r COLLATE koi8r_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 CONVERT TO CHARACTER SET latin1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 DEFAULT CHARACTER SET cp1251; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(10) CHARACTER SET latin1 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=cp1251 + `a` char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_ci drop table t1; create table t1 (myblob longblob,mytext longtext) default charset latin1 collate latin1_general_cs; @@ -395,7 +393,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `myblob` longblob DEFAULT NULL, - `mytext` longtext COLLATE latin1_general_cs DEFAULT NULL + `mytext` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs alter table t1 character set latin2; show create table t1; @@ -403,7 +401,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `myblob` longblob DEFAULT NULL, `mytext` longtext CHARACTER SET latin1 COLLATE latin1_general_cs DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin2 +) ENGINE=MyISAM DEFAULT CHARSET=latin2 COLLATE=latin2_general_ci drop table t1; CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE); ALTER TABLE t1 DROP PRIMARY KEY; @@ -413,7 +411,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL, UNIQUE KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 DROP PRIMARY KEY; ERROR 42000: Can't DROP INDEX `PRIMARY`; check that it exists DROP TABLE t1; @@ -584,13 +582,13 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, KEY `i1` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=FIXED DROP INDEX i1 ON t1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=FIXED DROP TABLE t1; DROP TABLE IF EXISTS bug24219; DROP TABLE IF EXISTS bug24219_2; @@ -832,7 +830,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(500) DEFAULT NULL, `b` geometry NOT NULL, SPATIAL KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 ADD KEY(b(50)); SHOW CREATE TABLE t1; Table Create Table @@ -841,7 +839,7 @@ t1 CREATE TABLE `t1` ( `b` geometry NOT NULL, SPATIAL KEY `b` (`b`), KEY `b_2` (`b`(50)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 ADD c POINT; SHOW CREATE TABLE t1; Table Create Table @@ -851,7 +849,7 @@ t1 CREATE TABLE `t1` ( `c` point DEFAULT NULL, SPATIAL KEY `b` (`b`), KEY `b_2` (`b`(50)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 (a INT, KEY (a(20))); ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys ALTER TABLE t1 ADD d INT; @@ -902,7 +900,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci drop table t1; create table t1 (a mediumtext character set latin1); alter table t1 convert to character set utf8; @@ -910,7 +908,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci drop table t1; End of 5.0 tests drop table if exists t1, t2, t3; @@ -983,12 +981,12 @@ SHOW CREATE TABLE `tt+1`; Table Create Table tt+1 CREATE TEMPORARY TABLE `tt+1` ( `c1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE `tt+2`; Table Create Table tt+2 CREATE TEMPORARY TABLE `tt+2` ( `c1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE `tt+1`, `tt+2`; CREATE TABLE `#sql1` (c1 INT); CREATE TABLE `@0023sql2` (c1 INT); @@ -1025,12 +1023,12 @@ SHOW CREATE TABLE `#sql2`; Table Create Table #sql2 CREATE TEMPORARY TABLE `#sql2` ( `c1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE `@0023sql1`; Table Create Table @0023sql1 CREATE TEMPORARY TABLE `@0023sql1` ( `c1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE `#sql2`, `@0023sql1`; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; @@ -1373,7 +1371,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `consultant_id` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE t1; CREATE TABLE t1 ( `a` int(11) DEFAULT NULL @@ -1385,7 +1383,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `consultant_id` int(11) NOT NULL DEFAULT 2 -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE t1; CREATE TABLE t1 ( `a` int(11) DEFAULT NULL @@ -1397,7 +1395,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `consultant_id` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE t1; CREATE TABLE t1 ( `a` int(11) DEFAULT NULL @@ -1410,7 +1408,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `consultant_id` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE t1; # # BUG#27788685: NO WARNING WHEN TRUNCATING A STRING WITH DATA LOSS @@ -1503,7 +1501,7 @@ t1 CREATE TABLE `t1` ( `x_param` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `x_param1` (`x_param`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( id INT(11) NOT NULL, @@ -1545,7 +1543,7 @@ t1 CREATE TABLE `t1` ( `x_param` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `x_param1` (`x_param`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t2 ADD FOREIGN KEY IF NOT EXISTS fk(id) REFERENCES t1(id); ALTER TABLE t2 ADD FOREIGN KEY IF NOT EXISTS fk(id) REFERENCES t1(id); Warnings: @@ -1559,7 +1557,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `id` int(11) NOT NULL, KEY `fk` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t2 ADD FOREIGN KEY (id) REFERENCES t1(id); ALTER TABLE t2 ADD FOREIGN KEY IF NOT EXISTS t2_ibfk_1(id) REFERENCES t1(id); Warnings: @@ -1573,7 +1571,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `id` int(11) NOT NULL, KEY `id` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 ( id INT(11) NOT NULL); @@ -1589,7 +1587,7 @@ t2 CREATE TABLE `t2` ( `id` int(11) NOT NULL, `a` int(11) DEFAULT NULL, KEY `k_id` (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t2 DROP KEY k_id, DROP KEY IF EXISTS k_id; Warnings: Note 1091 Can't DROP INDEX `k_id`; check that it exists @@ -1600,7 +1598,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `id` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 ( @@ -1612,7 +1610,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `transaction_id` int(11) NOT NULL DEFAULT 0, PRIMARY KEY (`transaction_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # Bug#11748057 (formerly known as 34972): ALTER TABLE statement doesn't # identify correct column name. @@ -1626,7 +1624,7 @@ t1 CREATE TABLE `t1` ( `c1` int(10) unsigned DEFAULT NULL, `c2` char(100) NOT NULL DEFAULT '', `c3` char(16) NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # WL#5534 Online ALTER, Phase 1 @@ -2118,7 +2116,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `b` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; create table t1 (i int); alter table t1 add unique index if not exists idx(i); @@ -2130,7 +2128,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, UNIQUE KEY `idx` (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( `event_id` bigint(20) unsigned NOT NULL DEFAULT '0', @@ -2176,7 +2174,7 @@ tab1 CREATE TABLE `tab1` ( `field11` enum('option1','option2','option3') NOT NULL DEFAULT 'option1', `v_col` varchar(128) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE `tab1` CHANGE COLUMN v_col `v_col` varchar(128) AS (IF(field11='option1',CONCAT_WS(":","field1",field2,field3,field4,field5,field6,field7,field8,field9,field10), CONCAT_WS(":","field1",field11,field2,field3,field4,field5,field6,field7,field8,field9,field10))) PERSISTENT; SHOW CREATE TABLE `tab1`; Table Create Table @@ -2194,7 +2192,7 @@ tab1 CREATE TABLE `tab1` ( `field11` enum('option1','option2','option3') NOT NULL DEFAULT 'option1', `v_col` varchar(128) GENERATED ALWAYS AS (if(`field11` = 'option1',concat_ws(':','field1',`field2`,`field3`,`field4`,`field5`,`field6`,`field7`,`field8`,`field9`,`field10`),concat_ws(':','field1',`field11`,`field2`,`field3`,`field4`,`field5`,`field6`,`field7`,`field8`,`field9`,`field10`))) STORED, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE `tab1`; # # MDEV-11548 Reproducible server crash after the 2nd ALTER TABLE ADD FOREIGN KEY IF NOT EXISTS @@ -2222,7 +2220,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 CONVERT TO CHARACTER SET utf8; SHOW CREATE TABLE t1; Table Create Table @@ -2230,7 +2228,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE t1; # # MDEV-15308 @@ -2245,7 +2243,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB; ALTER TABLE t1 DROP INDEX IF EXISTS fk, DROP COLUMN b; @@ -2255,7 +2253,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a INT, b INT, c INT, KEY(c)) ENGINE=InnoDB; ALTER TABLE t1 DROP FOREIGN KEY IF EXISTS fk, DROP COLUMN c; @@ -2266,7 +2264,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a INT, b INT, c INT, KEY c1(c)) ENGINE=InnoDB; ALTER TABLE t1 DROP FOREIGN KEY IF EXISTS fk, DROP INDEX c1; @@ -2278,7 +2276,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB; ALTER TABLE t1 DROP INDEX IF EXISTS fk, DROP COLUMN IF EXISTS c; @@ -2290,7 +2288,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-14668 ADD PRIMARY KEY IF NOT EXISTS on composite key @@ -2310,7 +2308,7 @@ t1 CREATE TABLE `t1` ( `CHECK_POINT` bigint(20) NOT NULL, PRIMARY KEY (`ID`,`CHECK_POINT`), UNIQUE KEY `HORIZON_UIDX01` (`ID`,`RANK`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 ADD PRIMARY KEY IF NOT EXISTS (`ID`, `CHECK_POINT`); Warnings: Note 1061 Multiple primary key defined @@ -2337,7 +2335,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, KEY `i1` (`a`) COMMENT 'comment2' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # End of 10.1 tests @@ -2360,7 +2358,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, CONSTRAINT `min` CHECK (`a` + `b` > 100), CONSTRAINT `mini` CHECK (`a` + `b` > 100) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(a INT, b INT, CONSTRAINT min check (a>5), CONSTRAINT min check (b>5)); @@ -2375,7 +2373,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int, b int, check(a>0)); alter table t1 drop column a; @@ -2383,7 +2381,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int, b int, check(a>0)); alter table t1 drop column a, add column a bigint first; @@ -2392,7 +2390,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int, b int, c int, unique(a)); alter table t1 drop column a; @@ -2401,7 +2399,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int, b int, c int, unique(a,b)); alter table t1 drop column a; @@ -2412,7 +2410,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (i int); alter table t1 alter column if exists a set default 1; @@ -2425,7 +2423,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # # MDEV-13508 Check that rename of columns changes defaults, virtual @@ -2439,7 +2437,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL, CONSTRAINT `CONSTRAINT_1` CHECK (`b` > `a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int primary key, b int, c int default (a+b) check (a+b>0), d int as (a+b), @@ -2458,7 +2456,7 @@ t1 CREATE TABLE `t1` ( KEY `b` (`new_b`), CONSTRAINT `test` CHECK (`a` + `new_b` > 1), CONSTRAINT `new` CHECK (octet_length(`b`) > 0) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # # MDEV-11071: Assertion `thd->transaction.stmt.is_empty()' failed @@ -2488,7 +2486,7 @@ t2 CREATE TABLE `t2` ( UNIQUE KEY `ui` (`c2`), KEY `sid` (`c1`), CONSTRAINT `sid` FOREIGN KEY (`c1`) REFERENCES `t1` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t2 DROP CONSTRAINT sid; SHOW CREATE TABLE t2; Table Create Table @@ -2499,7 +2497,7 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`id`), UNIQUE KEY `ui` (`c2`), KEY `sid` (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t2 DROP CONSTRAINT ui; SHOW CREATE TABLE t2; Table Create Table @@ -2509,7 +2507,7 @@ t2 CREATE TABLE `t2` ( `c2` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `sid` (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t2 DROP CONSTRAINT PRIMARY KEY; SHOW CREATE TABLE t2; Table Create Table @@ -2518,7 +2516,7 @@ t2 CREATE TABLE `t2` ( `c1` int(11) DEFAULT NULL, `c2` int(11) NOT NULL, KEY `sid` (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2, t1; # # MDEV-18163: Assertion `table_share->tmp_table != NO_TMP_TABLE || @@ -2544,7 +2542,7 @@ t1 CREATE TABLE `t1` ( `t` int(11) DEFAULT NULL, `d` date NOT NULL, `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 add x date not null; ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`x` at row 1 drop table t1; @@ -2588,22 +2586,6 @@ set max_statement_time= 0; drop table t1; drop view v1; # -# MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed -# -set @save_default_engine= @@default_storage_engine; -create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; -alter table t1 change x xx int, algorithm=inplace; -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); -alter table t1 change x xx int, algorithm=inplace; -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -drop table t1; -set @@default_storage_engine= @save_default_engine; -# # End of 10.3 tests # # @@ -2650,296 +2632,6 @@ DROP TABLE t1; # End of 10.4 tests # # -# MDEV-16290 ALTER TABLE ... RENAME COLUMN syntax -# -SET @save_default_engine= @@DEFAULT_STORAGE_ENGINE; -CREATE TABLE t1(a INT, b VARCHAR(30), c FLOAT); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL, - `b` varchar(30) DEFAULT NULL, - `c` float DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -INSERT INTO t1 VALUES(1,'abcd',1.234); -CREATE TABLE t2(a INT, b VARCHAR(30), c FLOAT) ENGINE=MyIsam; -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `a` int(11) DEFAULT NULL, - `b` varchar(30) DEFAULT NULL, - `c` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -INSERT INTO t2 VALUES(1,'abcd',1.234); -ALTER TABLE t1 RENAME COLUMN a TO a; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL, - `b` varchar(30) DEFAULT NULL, - `c` float DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 RENAME COLUMN a TO m; -ALTER TABLE t1 RENAME COLUMN a TO m; -ERROR 42S22: Unknown column 'a' in 't1' -ALTER TABLE t1 RENAME COLUMN IF EXISTS a TO m; -Warnings: -Note 1054 Unknown column 'a' in 't1' -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `m` int(11) DEFAULT NULL, - `b` varchar(30) DEFAULT NULL, - `c` float DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -SELECT * FROM t1; -m b c -1 abcd 1.234 -ALTER TABLE t1 RENAME COLUMN m TO x, -RENAME COLUMN b TO y, -RENAME COLUMN c TO z; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `x` int(11) DEFAULT NULL, - `y` varchar(30) DEFAULT NULL, - `z` float DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -SELECT * FROM t1; -x y z -1 abcd 1.234 -ALTER TABLE t2 RENAME COLUMN a TO d, RENAME COLUMN b TO e, RENAME COLUMN c to f; -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `d` int(11) DEFAULT NULL, - `e` varchar(30) DEFAULT NULL, - `f` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -SELECT * FROM t2; -d e f -1 abcd 1.234 -ALTER TABLE t1 CHANGE COLUMN x a INT, RENAME COLUMN y TO b; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL, - `b` varchar(30) DEFAULT NULL, - `z` float DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 CHANGE COLUMN z c DOUBLE, RENAME COLUMN b to b; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL, - `b` varchar(30) DEFAULT NULL, - `c` double DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 CHANGE COLUMN a b int, RENAME COLUMN b TO c, CHANGE COLUMN c d FLOAT; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `b` int(11) DEFAULT NULL, - `c` varchar(30) DEFAULT NULL, - `d` float DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 ADD COLUMN zz INT, RENAME COLUMN d TO f; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `b` int(11) DEFAULT NULL, - `c` varchar(30) DEFAULT NULL, - `f` float DEFAULT NULL, - `zz` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 DROP COLUMN zz, RENAME COLUMN c TO zz; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `b` int(11) DEFAULT NULL, - `zz` varchar(30) DEFAULT NULL, - `f` float DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 RENAME COLUMN zz to c, DROP COLUMN f; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `b` int(11) DEFAULT NULL, - `c` varchar(30) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 ADD COLUMN d INT DEFAULT 5, RENAME COLUMN c TO b, DROP COLUMN b; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `b` varchar(30) DEFAULT NULL, - `d` int(11) DEFAULT 5 -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 RENAME COLUMN b TO d, RENAME COLUMN d TO b; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `d` varchar(30) DEFAULT NULL, - `b` int(11) DEFAULT 5 -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 ADD KEY(b); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `d` varchar(30) DEFAULT NULL, - `b` int(11) DEFAULT 5, - KEY `b` (`b`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 RENAME COLUMN b TO bb; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `d` varchar(30) DEFAULT NULL, - `bb` int(11) DEFAULT 5, - KEY `b` (`bb`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -SELECT * FROM t1; -d bb -abcd 5 -CREATE TABLE t3(a int, b int, KEY(b)); -ALTER TABLE t3 ADD CONSTRAINT FOREIGN KEY(b) REFERENCES t1(bb); -SHOW CREATE TABLE t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT NULL, - KEY `b` (`b`), - CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`bb`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 RENAME COLUMN bb TO b; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `d` varchar(30) DEFAULT NULL, - `b` int(11) DEFAULT 5, - KEY `b` (`b`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t3 RENAME COLUMN b TO c; -SHOW CREATE TABLE t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `a` int(11) DEFAULT NULL, - `c` int(11) DEFAULT NULL, - KEY `b` (`c`), - CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t1` (`b`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -CREATE TABLE t4(a int); -ALTER TABLE t4 RENAME COLUMN a TO aa, ALGORITHM = INPLACE; -SHOW CREATE TABLE t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `aa` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t4 RENAME COLUMN aa TO a, ALGORITHM = COPY; -SHOW CREATE TABLE t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `a` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -DROP TABLE t4; -CREATE VIEW v1 AS SELECT d,e,f FROM t2; -CREATE TRIGGER trg1 BEFORE UPDATE on t2 FOR EACH ROW SET NEW.d=OLD.d + 10; -CREATE PROCEDURE sp1() INSERT INTO t2(d) VALUES(10); -ALTER TABLE t2 RENAME COLUMN d TO g; -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `g` int(11) DEFAULT NULL, - `e` varchar(30) DEFAULT NULL, - `f` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -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 `test`.`t2`.`d` AS `d`,`test`.`t2`.`e` AS `e`,`test`.`t2`.`f` AS `f` from `t2` koi8r koi8r_general_ci -Warnings: -Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them -SELECT * FROM v1; -ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them -UPDATE t2 SET f = f + 10; -ERROR 42S22: Unknown column 'd' in 'OLD' -CALL sp1(); -ERROR 42S22: Unknown column 'd' in 'field list' -DROP TRIGGER trg1; -DROP PROCEDURE sp1; -CREATE TABLE t_gen(a INT, b DOUBLE GENERATED ALWAYS AS (SQRT(a))); -INSERT INTO t_gen(a) VALUES(4); -SELECT * FROM t_gen; -a b -4 2 -SHOW CREATE TABLE t_gen; -Table Create Table -t_gen CREATE TABLE `t_gen` ( - `a` int(11) DEFAULT NULL, - `b` double GENERATED ALWAYS AS (sqrt(`a`)) VIRTUAL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t_gen RENAME COLUMN a TO c, CHANGE COLUMN b b DOUBLE GENERATED ALWAYS AS (SQRT(c)); -SELECT * FROM t_gen; -c b -4 2 -SHOW CREATE TABLE t_gen; -Table Create Table -t_gen CREATE TABLE `t_gen` ( - `c` int(11) DEFAULT NULL, - `b` double GENERATED ALWAYS AS (sqrt(`c`)) VIRTUAL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t_gen CHANGE COLUMN c x INT; -show create table t_gen; -Table Create Table -t_gen CREATE TABLE `t_gen` ( - `x` int(11) DEFAULT NULL, - `b` double GENERATED ALWAYS AS (sqrt(`x`)) VIRTUAL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t_gen RENAME COLUMN x TO a; -DROP TABLE t_gen; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `d` varchar(30) DEFAULT NULL, - `b` int(11) DEFAULT 5, - KEY `b` (`b`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 RENAME COLUMN b z; -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 'z' at line 1 -ALTER TABLE t1 RENAME COLUMN FROM b TO z; -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 'FROM b TO z' at line 1 -ALTER TABLE t1 RENAME COLUMN b TO 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 '1' at line 1 -ALTER TABLE t1 RENAME COLUMN b TO e, RENAME COLUMN c TO e; -ERROR 42S22: Unknown column 'c' in 't1' -ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN b TO z; -ERROR 42S21: Duplicate column name 'z' -ALTER TABLE t1 DROP COLUMN b, RENAME COLUMN b TO z; -ERROR 42S22: Unknown column 'b' in 't1' -ALTER TABLE t1 RENAME COLUMN b TO b, RENAME COLUMN b TO b; -ERROR 42S22: Unknown column 'b' in 't1' -ALTER TABLE t1 RENAME COLUMN b TO c3, DROP COLUMN c3; -ERROR 42000: Can't DROP COLUMN `c3`; check that it exists -ALTER TABLE t1 ADD COLUMN z INT, CHANGE COLUMN z y INT, DROP COLUMN y; -ERROR 42S22: Unknown column 'z' in 't1' -ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN z TO y, DROP COLUMN y; -ERROR 42S22: Unknown column 'z' in 't1' -ALTER TABLE t1 RENAME COLUMN b TO `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn`; -ERROR 42000: Incorrect column name 'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn' -ALTER TABLE t1 CHANGE b `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn` int; -ERROR 42000: Identifier name 'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn' is too long -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `d` varchar(30) DEFAULT NULL, - `b` int(11) DEFAULT 5, - KEY `b` (`b`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -SELECT * FROM t1; -d b -abcd 5 -DROP VIEW v1; -DROP TABLE t3,t1,t2; -SET DEFAULT_STORAGE_ENGINE= @save_default_engine; -# # MDEV-7318 RENAME INDEX # # @@ -2958,7 +2650,7 @@ t1 CREATE TABLE `t1` ( `j` int(11) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `b` (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 rename index b to c; show create table t1; Table Create Table @@ -2968,7 +2660,7 @@ t1 CREATE TABLE `t1` ( `j` int(11) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `c` (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # 1.b) It should be impossible to rename index that doesn't # exists, dropped or added within the same ALTER TABLE. alter table t1 rename key d to e; @@ -2984,7 +2676,7 @@ t1 CREATE TABLE `t1` ( `j` int(11) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `c` (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 drop key c, rename key c to d; ERROR 42000: Key 'c' doesn't exist in table 't1' show create table t1; @@ -2995,7 +2687,7 @@ t1 CREATE TABLE `t1` ( `j` int(11) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `c` (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 add key d(j), rename key d to e; ERROR 42000: Key 'd' doesn't exist in table 't1' show create table t1; @@ -3006,7 +2698,7 @@ t1 CREATE TABLE `t1` ( `j` int(11) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `c` (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # 1.c) It should be impossible to rename index to a name # which is already used by another index, or is used # by index which is added within the same ALTER TABLE. @@ -3022,7 +2714,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`pk`), KEY `c` (`i`), KEY `d` (`j`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 drop key d; alter table t1 add key d(j), rename key c to d; ERROR 42000: Duplicate key name 'd' @@ -3034,7 +2726,7 @@ t1 CREATE TABLE `t1` ( `j` int(11) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `c` (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # 1.d) It should be possible to rename index to a name # which belongs to index which is dropped within the # same ALTER TABLE. @@ -3048,7 +2740,7 @@ t1 CREATE TABLE `t1` ( `j` int(11) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `c` (`j`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # 1.e) We disallow renaming from/to PRIMARY as it might # lead to some other key becoming "primary" internally, # which will be interpreted as dropping/addition of @@ -3063,7 +2755,7 @@ t1 CREATE TABLE `t1` ( `j` int(11) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `c` (`j`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Even using 'funny' syntax. alter table t1 rename key `primary` to d; ERROR 42000: Incorrect index name 'primary' @@ -3075,7 +2767,7 @@ t1 CREATE TABLE `t1` ( `j` int(11) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `c` (`j`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 rename key c to primary; 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 'primary' at line 1 show create table t1; @@ -3086,7 +2778,7 @@ t1 CREATE TABLE `t1` ( `j` int(11) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `c` (`j`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 rename key c to `primary`; ERROR 42000: Incorrect index name 'primary' show create table t1; @@ -3097,7 +2789,7 @@ t1 CREATE TABLE `t1` ( `j` int(11) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `c` (`j`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # # 2) More complex tests for semantics of ALTER TABLE. @@ -3113,7 +2805,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, UNIQUE KEY `uu` (`a`), KEY `k` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 rename key k to kk; show create table t1; Table Create Table @@ -3122,7 +2814,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, UNIQUE KEY `uu` (`a`), KEY `kk` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # 2.b) Check how that this clause can be mixed with other # clauses which don't affect key or its columns. alter table t1 rename key kk to kkk, add column c int; @@ -3134,7 +2826,7 @@ t1 CREATE TABLE `t1` ( `c` int(11) DEFAULT NULL, UNIQUE KEY `uu` (`a`), KEY `kkk` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 rename key uu to uuu, add key c(c); show create table t1; Table Create Table @@ -3145,7 +2837,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `uuu` (`a`), KEY `kkk` (`b`), KEY `c` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 rename key kkk to k, drop key uuu; show create table t1; Table Create Table @@ -3155,7 +2847,7 @@ t1 CREATE TABLE `t1` ( `c` int(11) DEFAULT NULL, KEY `k` (`b`), KEY `c` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 rename key k to kk, rename to t2; show create table t2; Table Create Table @@ -3165,7 +2857,7 @@ t2 CREATE TABLE `t2` ( `c` int(11) DEFAULT NULL, KEY `kk` (`b`), KEY `c` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; # # 3) Test coverage for handling of RENAME INDEX clause in @@ -3185,13 +2877,13 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, KEY `kk` (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `i` int(11) DEFAULT NULL, KEY `kk` (`i`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # So by default in-place algorithm should be chosen. # (ALTER TABLE should report 0 rows affected). alter table t1 rename key kk to kkk; @@ -3205,13 +2897,13 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, KEY `kkk` (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `i` int(11) DEFAULT NULL, KEY `kkk` (`i`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Copy algorithm should work as well. alter table t1 algorithm=copy, rename key kkk to kkkk; alter table t2 algorithm=copy, rename key kkk to kkkk; @@ -3220,13 +2912,13 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, KEY `kkkk` (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `i` int(11) DEFAULT NULL, KEY `kkkk` (`i`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # When renaming is combined with other in-place operation # it still works as expected (i.e. works in-place). alter table t1 algorithm=inplace, rename key kkkk to k, alter column i set default 100; @@ -3236,13 +2928,13 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT 100, KEY `k` (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `i` int(11) DEFAULT 100, KEY `k` (`i`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Combining with non-inplace operation results in the whole ALTER # becoming non-inplace. alter table t1 algorithm=inplace, rename key k to kk, add column j int; @@ -3263,7 +2955,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, KEY `kk` (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # copy algorithm should work as well. alter table t1 algorithm=copy, rename key kk to kkk; affected rows: 1 @@ -3273,7 +2965,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, KEY `kkk` (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # # 4) Additional coverage for complex cases in which code @@ -3299,7 +2991,7 @@ t1 CREATE TABLE `t1` ( KEY `x` (`b`), KEY `i2` (`c`), KEY `i1` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select i.name as k, f.name as c from information_schema.innodb_sys_tables as t, information_schema.innodb_sys_indexes as i, information_schema.innodb_sys_fields as f @@ -3324,7 +3016,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`a`), KEY `i2` (`b`), KEY `i1` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select i.name as k, f.name as c from information_schema.innodb_sys_tables as t, information_schema.innodb_sys_indexes as i, information_schema.innodb_sys_fields as f @@ -3352,7 +3044,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; # # MDEV-22881 Unexpected errors, corrupt output, Valgrind / ASAN errors in Item_ident::print or append_identifier @@ -3374,37 +3066,21 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `Abc` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 rename column abc to ABc, algorithm=inplace; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `ABc` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 rename column abc to ABC; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `ABC` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # -# MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed -# -set @save_default_engine= @@default_storage_engine; -create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; -alter table t1 change x xx int, algorithm=inplace; -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); -alter table t1 change x xx int, algorithm=inplace; -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -drop table t1; -set @@default_storage_engine= @save_default_engine; -# # MDEV-25555 Server crashes in tree_record_pos after INPLACE-recreating index on HEAP table # create table t1 (a int, key idx1(a), key idx2 using btree(a)) engine=memory; @@ -3415,24 +3091,6 @@ ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITH delete from t1 where a = 11; drop table t1; # -# MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in -# Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK) -# -SET @max_session_mem_used_save= @@max_session_mem_used; -CREATE TABLE t1 (a INT); -SELECT * FROM t1; -a -ALTER TABLE x MODIFY xx INT; -ERROR 42S02: Table 'test.x' doesn't exist -SET SESSION max_session_mem_used= 8192; -LOCK TABLE t1 WRITE; -ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT; -Warnings: -Note 1054 Unknown column 'b' in 't1' -SET SESSION max_session_mem_used = @max_session_mem_used_save; -UNLOCK TABLES; -DROP TABLE t1; -# # End of 10.5 tests # # diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test index 5ce10dd2c2baf..f6e9bfe1126db 100644 --- a/mysql-test/main/alter_table.test +++ b/mysql-test/main/alter_table.test @@ -1,11 +1,8 @@ +--source include/no_valgrind_without_big.inc --source include/have_innodb.inc # # Test of alter table # ---disable_warnings -drop table if exists t1,t2; -drop database if exists mysqltest; ---enable_warnings set @save_max_allowed_packet=@@global.max_allowed_packet; create table t1 ( @@ -783,6 +780,8 @@ drop table t1; # Unix/Windows and transactional/non-transactional tables). # See also innodb_mysql.test # + +--disable_service_connection --disable_warnings drop table if exists t1, t2, t3; --enable_warnings @@ -825,7 +824,7 @@ unlock tables; insert into t1 values (); select * from t1; drop tables t1, t3; - +--enable_service_connection # # Bug#18775 - Temporary table from alter table visible to other threads @@ -2099,47 +2098,6 @@ set max_statement_time= 0; drop table t1; drop view v1; ---echo # ---echo # MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed ---echo # -set @save_default_engine= @@default_storage_engine; ---disable_query_log -if ($MTR_COMBINATION_INNODB) -{ - set default_storage_engine= innodb; -} -if ($MTR_COMBINATION_ARIA) -{ - set default_storage_engine= aria; -} ---enable_query_log - -if (!$MTR_COMBINATION_INNODB) -{ - --disable_query_log - --disable_result_log - # There is no inplace ADD INDEX for MyISAM/Aria: - create or replace table t1 (x int); - --error ER_ALTER_OPERATION_NOT_SUPPORTED - alter table t1 add unique (x), algorithm=inplace; - --error ER_ALTER_OPERATION_NOT_SUPPORTED - alter table t1 add primary key(x), algorithm=inplace; - --error ER_ALTER_OPERATION_NOT_SUPPORTED - alter table t1 add index(x), algorithm=inplace; - --enable_query_log - --enable_result_log -} - -create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; -alter table t1 change x xx int, algorithm=inplace; -check table t1; -create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); -alter table t1 change x xx int, algorithm=inplace; -check table t1; -# cleanup -drop table t1; -set @@default_storage_engine= @save_default_engine; - --echo # --echo # End of 10.3 tests --echo # @@ -2192,205 +2150,6 @@ DROP TABLE t1; --echo # End of 10.4 tests --echo # ---echo # ---echo # MDEV-16290 ALTER TABLE ... RENAME COLUMN syntax ---echo # -SET @save_default_engine= @@DEFAULT_STORAGE_ENGINE; ---disable_query_log -if ($MTR_COMBINATION_INNODB) -{ -SET DEFAULT_STORAGE_ENGINE= INNODB; -} -if ($MTR_COMBINATION_ARIA) -{ -SET DEFAULT_STORAGE_ENGINE= ARIA; -} -if ($MTR_COMBINATION_HEAP) -{ -SET DEFAULT_STORAGE_ENGINE= MEMORY; -} ---enable_query_log -let $default_engine= `select @@default_storage_engine`; - -CREATE TABLE t1(a INT, b VARCHAR(30), c FLOAT); ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES(1,'abcd',1.234); -CREATE TABLE t2(a INT, b VARCHAR(30), c FLOAT) ENGINE=MyIsam; -SHOW CREATE TABLE t2; -INSERT INTO t2 VALUES(1,'abcd',1.234); - -# Rename one column -ALTER TABLE t1 RENAME COLUMN a TO a; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t1 RENAME COLUMN a TO m; ---error ER_BAD_FIELD_ERROR -ALTER TABLE t1 RENAME COLUMN a TO m; -ALTER TABLE t1 RENAME COLUMN IF EXISTS a TO m; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -SELECT * FROM t1; - -# Rename multiple column -ALTER TABLE t1 RENAME COLUMN m TO x, - RENAME COLUMN b TO y, - RENAME COLUMN c TO z; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -SELECT * FROM t1; - -# Rename multiple columns with MyIsam Engine -ALTER TABLE t2 RENAME COLUMN a TO d, RENAME COLUMN b TO e, RENAME COLUMN c to f; -SHOW CREATE TABLE t2; -SELECT * FROM t2; - -# Mix different ALTER operations with RENAME COLUMN -ALTER TABLE t1 CHANGE COLUMN x a INT, RENAME COLUMN y TO b; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t1 CHANGE COLUMN z c DOUBLE, RENAME COLUMN b to b; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t1 CHANGE COLUMN a b int, RENAME COLUMN b TO c, CHANGE COLUMN c d FLOAT; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t1 ADD COLUMN zz INT, RENAME COLUMN d TO f; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t1 DROP COLUMN zz, RENAME COLUMN c TO zz; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t1 RENAME COLUMN zz to c, DROP COLUMN f; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t1 ADD COLUMN d INT DEFAULT 5, RENAME COLUMN c TO b, DROP COLUMN b; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; - -#Cyclic Rename -ALTER TABLE t1 RENAME COLUMN b TO d, RENAME COLUMN d TO b; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; - -# Rename with Indexes -ALTER TABLE t1 ADD KEY(b); ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t1 RENAME COLUMN b TO bb; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -SELECT * FROM t1; - -# Rename with Foreign keys. -CREATE TABLE t3(a int, b int, KEY(b)); -ALTER TABLE t3 ADD CONSTRAINT FOREIGN KEY(b) REFERENCES t1(bb); ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t3; -ALTER TABLE t1 RENAME COLUMN bb TO b; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t3 RENAME COLUMN b TO c; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t3; - -# Different Algorithm -CREATE TABLE t4(a int); -ALTER TABLE t4 RENAME COLUMN a TO aa, ALGORITHM = INPLACE; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t4; -ALTER TABLE t4 RENAME COLUMN aa TO a, ALGORITHM = COPY; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t4; -DROP TABLE t4; - -# View, Trigger and SP -CREATE VIEW v1 AS SELECT d,e,f FROM t2; -CREATE TRIGGER trg1 BEFORE UPDATE on t2 FOR EACH ROW SET NEW.d=OLD.d + 10; -CREATE PROCEDURE sp1() INSERT INTO t2(d) VALUES(10); -ALTER TABLE t2 RENAME COLUMN d TO g; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t2; -SHOW CREATE VIEW v1; ---error ER_VIEW_INVALID -SELECT * FROM v1; ---error ER_BAD_FIELD_ERROR -UPDATE t2 SET f = f + 10; ---error ER_BAD_FIELD_ERROR -CALL sp1(); -DROP TRIGGER trg1; -DROP PROCEDURE sp1; - -# Generated Columns -if (!$MTR_COMBINATION_HEAP) -{ -CREATE TABLE t_gen(a INT, b DOUBLE GENERATED ALWAYS AS (SQRT(a))); -INSERT INTO t_gen(a) VALUES(4); -SELECT * FROM t_gen; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t_gen; -ALTER TABLE t_gen RENAME COLUMN a TO c, CHANGE COLUMN b b DOUBLE GENERATED ALWAYS AS (SQRT(c)); -SELECT * FROM t_gen; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t_gen; -#--error ER_DEPENDENT_BY_GENERATED_COLUMN -ALTER TABLE t_gen CHANGE COLUMN c x INT; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -show create table t_gen; -#--error ER_DEPENDENT_BY_GENERATED_COLUMN -ALTER TABLE t_gen RENAME COLUMN x TO a; -DROP TABLE t_gen; -} - - -# -# Negative tests -# ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; - -# Invalid Syntax ---error ER_PARSE_ERROR -ALTER TABLE t1 RENAME COLUMN b z; ---error ER_PARSE_ERROR -ALTER TABLE t1 RENAME COLUMN FROM b TO z; ---error ER_PARSE_ERROR -ALTER TABLE t1 RENAME COLUMN b TO 1; - -# Duplicate column name ---error ER_BAD_FIELD_ERROR -ALTER TABLE t1 RENAME COLUMN b TO e, RENAME COLUMN c TO e; ---error ER_DUP_FIELDNAME -ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN b TO z; - -# Multiple operation on same column ---error ER_BAD_FIELD_ERROR -ALTER TABLE t1 DROP COLUMN b, RENAME COLUMN b TO z; ---error ER_BAD_FIELD_ERROR -ALTER TABLE t1 RENAME COLUMN b TO b, RENAME COLUMN b TO b; ---error ER_CANT_DROP_FIELD_OR_KEY -ALTER TABLE t1 RENAME COLUMN b TO c3, DROP COLUMN c3; ---error ER_BAD_FIELD_ERROR -ALTER TABLE t1 ADD COLUMN z INT, CHANGE COLUMN z y INT, DROP COLUMN y; ---error ER_BAD_FIELD_ERROR -ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN z TO y, DROP COLUMN y; - -# Invalid column name while renaming ---error ER_WRONG_COLUMN_NAME -ALTER TABLE t1 RENAME COLUMN b TO `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn`; -# This error is different compared to ALTER TABLE ... CHANGE command ---error ER_TOO_LONG_IDENT -ALTER TABLE t1 CHANGE b `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn` int; - ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -SELECT * FROM t1; - -# Cleanup -DROP VIEW v1; -DROP TABLE t3,t1,t2; -SET DEFAULT_STORAGE_ENGINE= @save_default_engine; - --echo # --echo # MDEV-7318 RENAME INDEX --echo # @@ -2608,47 +2367,6 @@ alter table t1 rename column abc to ABC; show create table t1; drop table t1; ---echo # ---echo # MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed ---echo # -set @save_default_engine= @@default_storage_engine; ---disable_query_log -if ($MTR_COMBINATION_INNODB) -{ - set default_storage_engine= innodb; -} -if ($MTR_COMBINATION_ARIA) -{ - set default_storage_engine= aria; -} ---enable_query_log - -if (!$MTR_COMBINATION_INNODB) -{ - --disable_query_log - --disable_result_log - # There is no inplace ADD INDEX for MyISAM/Aria: - create or replace table t1 (x int); - --error ER_ALTER_OPERATION_NOT_SUPPORTED - alter table t1 add unique (x), algorithm=inplace; - --error ER_ALTER_OPERATION_NOT_SUPPORTED - alter table t1 add primary key(x), algorithm=inplace; - --error ER_ALTER_OPERATION_NOT_SUPPORTED - alter table t1 add index(x), algorithm=inplace; - --enable_query_log - --enable_result_log -} - -create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; -alter table t1 change x xx int, algorithm=inplace; -check table t1; -create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); -alter table t1 change x xx int, algorithm=inplace; -check table t1; -# cleanup -drop table t1; -set @@default_storage_engine= @save_default_engine; - --echo # --echo # MDEV-25555 Server crashes in tree_record_pos after INPLACE-recreating index on HEAP table --echo # @@ -2661,28 +2379,6 @@ delete from t1 where a = 11; # cleanup drop table t1; ---echo # ---echo # MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in ---echo # Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK) ---echo # - -SET @max_session_mem_used_save= @@max_session_mem_used; - -CREATE TABLE t1 (a INT); -SELECT * FROM t1; - ---error ER_NO_SUCH_TABLE -ALTER TABLE x MODIFY xx INT; - -SET SESSION max_session_mem_used= 8192; -LOCK TABLE t1 WRITE; - -ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT; - -SET SESSION max_session_mem_used = @max_session_mem_used_save; -UNLOCK TABLES; -DROP TABLE t1; - --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/alter_table_combinations,aria.rdiff b/mysql-test/main/alter_table_combinations,aria.rdiff new file mode 100644 index 0000000000000..9ea3813590851 --- /dev/null +++ b/mysql-test/main/alter_table_combinations,aria.rdiff @@ -0,0 +1,22 @@ +--- main/alter_table_combinations.result 2022-05-24 17:16:56.769146869 +0200 ++++ main/alter_table_combinations.reject 2022-05-24 17:25:20.847126357 +0200 +@@ -173,8 +173,7 @@ + t3 CREATE TABLE `t3` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, +- KEY `b` (`b`), +- CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`bb`) ++ KEY `b` (`b`) + ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + ALTER TABLE t1 RENAME COLUMN bb TO b; + SHOW CREATE TABLE t1; +@@ -190,8 +189,7 @@ + t3 CREATE TABLE `t3` ( + `a` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, +- KEY `b` (`c`), +- CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t1` (`b`) ++ KEY `b` (`c`) + ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + CREATE TABLE t4(a int); + ALTER TABLE t4 RENAME COLUMN a TO aa, ALGORITHM = INPLACE; diff --git a/mysql-test/main/alter_table_combinations,heap.rdiff b/mysql-test/main/alter_table_combinations,heap.rdiff new file mode 100644 index 0000000000000..0ca6d3de88d4b --- /dev/null +++ b/mysql-test/main/alter_table_combinations,heap.rdiff @@ -0,0 +1,77 @@ +--- main/alter_table_combinations.result 2022-05-24 17:16:56.769146869 +0200 ++++ main/alter_table_combinations.reject 2022-05-24 17:25:01.216127156 +0200 +@@ -11,7 +11,7 @@ + alter table t1 change x xx int, algorithm=inplace; + check table t1; + Table Op Msg_type Msg_text +-test.t1 check status OK ++test.t1 check note The storage engine for the table doesn't support check + drop table t1; + # + # End of 10.3 tests +@@ -173,8 +173,7 @@ + t3 CREATE TABLE `t3` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, +- KEY `b` (`b`), +- CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`bb`) ++ KEY `b` (`b`) + ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + ALTER TABLE t1 RENAME COLUMN bb TO b; + SHOW CREATE TABLE t1; +@@ -190,8 +189,7 @@ + t3 CREATE TABLE `t3` ( + `a` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, +- KEY `b` (`c`), +- CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t1` (`b`) ++ KEY `b` (`c`) + ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + CREATE TABLE t4(a int); + ALTER TABLE t4 RENAME COLUMN a TO aa, ALGORITHM = INPLACE; +@@ -231,36 +229,6 @@ + ERROR 42S22: Unknown column 'd' in 'field list' + DROP TRIGGER trg1; + DROP PROCEDURE sp1; +-CREATE TABLE t_gen(a INT, b DOUBLE GENERATED ALWAYS AS (SQRT(a))); +-INSERT INTO t_gen(a) VALUES(4); +-SELECT * FROM t_gen; +-a b +-4 2 +-SHOW CREATE TABLE t_gen; +-Table Create Table +-t_gen CREATE TABLE `t_gen` ( +- `a` int(11) DEFAULT NULL, +- `b` double GENERATED ALWAYS AS (sqrt(`a`)) VIRTUAL +-) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +-ALTER TABLE t_gen RENAME COLUMN a TO c, CHANGE COLUMN b b DOUBLE GENERATED ALWAYS AS (SQRT(c)); +-SELECT * FROM t_gen; +-c b +-4 2 +-SHOW CREATE TABLE t_gen; +-Table Create Table +-t_gen CREATE TABLE `t_gen` ( +- `c` int(11) DEFAULT NULL, +- `b` double GENERATED ALWAYS AS (sqrt(`c`)) VIRTUAL +-) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +-ALTER TABLE t_gen CHANGE COLUMN c x INT; +-show create table t_gen; +-Table Create Table +-t_gen CREATE TABLE `t_gen` ( +- `x` int(11) DEFAULT NULL, +- `b` double GENERATED ALWAYS AS (sqrt(`x`)) VIRTUAL +-) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +-ALTER TABLE t_gen RENAME COLUMN x TO a; +-DROP TABLE t_gen; + SHOW CREATE TABLE t1; + Table Create Table + t1 CREATE TABLE `t1` ( +@@ -316,7 +284,7 @@ + alter table t1 change x xx int, algorithm=inplace; + check table t1; + Table Op Msg_type Msg_text +-test.t1 check status OK ++test.t1 check note The storage engine for the table doesn't support check + drop table t1; + # + # End of 10.5 tests diff --git a/mysql-test/main/alter_table_combinations.combinations b/mysql-test/main/alter_table_combinations.combinations new file mode 100644 index 0000000000000..01c0e4b31b2a2 --- /dev/null +++ b/mysql-test/main/alter_table_combinations.combinations @@ -0,0 +1,6 @@ +[innodb] +innodb + +[aria] + +[heap] diff --git a/mysql-test/main/alter_table_combinations.result b/mysql-test/main/alter_table_combinations.result new file mode 100644 index 0000000000000..cd47c78d40449 --- /dev/null +++ b/mysql-test/main/alter_table_combinations.result @@ -0,0 +1,324 @@ +set @save_default_engine= @@default_storage_engine; +# +# MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed +# +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; +alter table t1 change x xx int, algorithm=inplace; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); +alter table t1 change x xx int, algorithm=inplace; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +# +# End of 10.3 tests +# +# +# MDEV-16290 ALTER TABLE ... RENAME COLUMN syntax +# +CREATE TABLE t1(a INT, b VARCHAR(30), c FLOAT); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(30) DEFAULT NULL, + `c` float DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES(1,'abcd',1.234); +CREATE TABLE t2(a INT, b VARCHAR(30), c FLOAT) ENGINE=MyIsam; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `b` varchar(30) DEFAULT NULL, + `c` float DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t2 VALUES(1,'abcd',1.234); +ALTER TABLE t1 RENAME COLUMN a TO a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(30) DEFAULT NULL, + `c` float DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 RENAME COLUMN a TO m; +ALTER TABLE t1 RENAME COLUMN a TO m; +ERROR 42S22: Unknown column 'a' in 't1' +ALTER TABLE t1 RENAME COLUMN IF EXISTS a TO m; +Warnings: +Note 1054 Unknown column 'a' in 't1' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `m` int(11) DEFAULT NULL, + `b` varchar(30) DEFAULT NULL, + `c` float DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +m b c +1 abcd 1.234 +ALTER TABLE t1 RENAME COLUMN m TO x, +RENAME COLUMN b TO y, +RENAME COLUMN c TO z; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL, + `y` varchar(30) DEFAULT NULL, + `z` float DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +x y z +1 abcd 1.234 +ALTER TABLE t2 RENAME COLUMN a TO d, RENAME COLUMN b TO e, RENAME COLUMN c to f; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `d` int(11) DEFAULT NULL, + `e` varchar(30) DEFAULT NULL, + `f` float DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t2; +d e f +1 abcd 1.234 +ALTER TABLE t1 CHANGE COLUMN x a INT, RENAME COLUMN y TO b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(30) DEFAULT NULL, + `z` float DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 CHANGE COLUMN z c DOUBLE, RENAME COLUMN b to b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(30) DEFAULT NULL, + `c` double DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 CHANGE COLUMN a b int, RENAME COLUMN b TO c, CHANGE COLUMN c d FLOAT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `c` varchar(30) DEFAULT NULL, + `d` float DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 ADD COLUMN zz INT, RENAME COLUMN d TO f; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `c` varchar(30) DEFAULT NULL, + `f` float DEFAULT NULL, + `zz` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 DROP COLUMN zz, RENAME COLUMN c TO zz; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `zz` varchar(30) DEFAULT NULL, + `f` float DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 RENAME COLUMN zz to c, DROP COLUMN f; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `c` varchar(30) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 ADD COLUMN d INT DEFAULT 5, RENAME COLUMN c TO b, DROP COLUMN b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` varchar(30) DEFAULT NULL, + `d` int(11) DEFAULT 5 +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 RENAME COLUMN b TO d, RENAME COLUMN d TO b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` varchar(30) DEFAULT NULL, + `b` int(11) DEFAULT 5 +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 ADD KEY(b); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` varchar(30) DEFAULT NULL, + `b` int(11) DEFAULT 5, + KEY `b` (`b`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 RENAME COLUMN b TO bb; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` varchar(30) DEFAULT NULL, + `bb` int(11) DEFAULT 5, + KEY `b` (`bb`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +d bb +abcd 5 +CREATE TABLE t3(a int, b int, KEY(b)); +ALTER TABLE t3 ADD CONSTRAINT FOREIGN KEY(b) REFERENCES t1(bb); +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + KEY `b` (`b`), + CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`bb`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 RENAME COLUMN bb TO b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` varchar(30) DEFAULT NULL, + `b` int(11) DEFAULT 5, + KEY `b` (`b`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t3 RENAME COLUMN b TO c; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + KEY `b` (`c`), + CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t1` (`b`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t4(a int); +ALTER TABLE t4 RENAME COLUMN a TO aa, ALGORITHM = INPLACE; +SHOW CREATE TABLE t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `aa` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t4 RENAME COLUMN aa TO a, ALGORITHM = COPY; +SHOW CREATE TABLE t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `a` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t4; +CREATE VIEW v1 AS SELECT d,e,f FROM t2; +CREATE TRIGGER trg1 BEFORE UPDATE on t2 FOR EACH ROW SET NEW.d=OLD.d + 10; +CREATE PROCEDURE sp1() INSERT INTO t2(d) VALUES(10); +ALTER TABLE t2 RENAME COLUMN d TO g; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `g` int(11) DEFAULT NULL, + `e` varchar(30) DEFAULT NULL, + `f` float DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +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 `test`.`t2`.`d` AS `d`,`test`.`t2`.`e` AS `e`,`test`.`t2`.`f` AS `f` from `t2` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SELECT * FROM v1; +ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +UPDATE t2 SET f = f + 10; +ERROR 42S22: Unknown column 'd' in 'NEW' +CALL sp1(); +ERROR 42S22: Unknown column 'd' in 'field list' +DROP TRIGGER trg1; +DROP PROCEDURE sp1; +CREATE TABLE t_gen(a INT, b DOUBLE GENERATED ALWAYS AS (SQRT(a))); +INSERT INTO t_gen(a) VALUES(4); +SELECT * FROM t_gen; +a b +4 2 +SHOW CREATE TABLE t_gen; +Table Create Table +t_gen CREATE TABLE `t_gen` ( + `a` int(11) DEFAULT NULL, + `b` double GENERATED ALWAYS AS (sqrt(`a`)) VIRTUAL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t_gen RENAME COLUMN a TO c, CHANGE COLUMN b b DOUBLE GENERATED ALWAYS AS (SQRT(c)); +SELECT * FROM t_gen; +c b +4 2 +SHOW CREATE TABLE t_gen; +Table Create Table +t_gen CREATE TABLE `t_gen` ( + `c` int(11) DEFAULT NULL, + `b` double GENERATED ALWAYS AS (sqrt(`c`)) VIRTUAL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t_gen CHANGE COLUMN c x INT; +show create table t_gen; +Table Create Table +t_gen CREATE TABLE `t_gen` ( + `x` int(11) DEFAULT NULL, + `b` double GENERATED ALWAYS AS (sqrt(`x`)) VIRTUAL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t_gen RENAME COLUMN x TO a; +DROP TABLE t_gen; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` varchar(30) DEFAULT NULL, + `b` int(11) DEFAULT 5, + KEY `b` (`b`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 RENAME COLUMN b z; +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 'z' at line 1 +ALTER TABLE t1 RENAME COLUMN FROM b TO z; +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 'FROM b TO z' at line 1 +ALTER TABLE t1 RENAME COLUMN b TO 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 '1' at line 1 +ALTER TABLE t1 RENAME COLUMN b TO e, RENAME COLUMN c TO e; +ERROR 42S22: Unknown column 'c' in 't1' +ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN b TO z; +ERROR 42S21: Duplicate column name 'z' +ALTER TABLE t1 DROP COLUMN b, RENAME COLUMN b TO z; +ERROR 42S22: Unknown column 'b' in 't1' +ALTER TABLE t1 RENAME COLUMN b TO b, RENAME COLUMN b TO b; +ERROR 42S22: Unknown column 'b' in 't1' +ALTER TABLE t1 RENAME COLUMN b TO c3, DROP COLUMN c3; +ERROR 42000: Can't DROP COLUMN `c3`; check that it exists +ALTER TABLE t1 ADD COLUMN z INT, CHANGE COLUMN z y INT, DROP COLUMN y; +ERROR 42S22: Unknown column 'z' in 't1' +ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN z TO y, DROP COLUMN y; +ERROR 42S22: Unknown column 'z' in 't1' +ALTER TABLE t1 RENAME COLUMN b TO `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn`; +ERROR 42000: Incorrect column name 'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn' +ALTER TABLE t1 CHANGE b `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn` int; +ERROR 42000: Identifier name 'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn' is too long +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` varchar(30) DEFAULT NULL, + `b` int(11) DEFAULT 5, + KEY `b` (`b`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +d b +abcd 5 +DROP VIEW v1; +DROP TABLE t3,t1,t2; +# +# MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed +# +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; +alter table t1 change x xx int, algorithm=inplace; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); +alter table t1 change x xx int, algorithm=inplace; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +# +# End of 10.5 tests +# +set @@default_storage_engine= @save_default_engine; diff --git a/mysql-test/main/alter_table_combinations.test b/mysql-test/main/alter_table_combinations.test new file mode 100644 index 0000000000000..7c8d7f4209689 --- /dev/null +++ b/mysql-test/main/alter_table_combinations.test @@ -0,0 +1,263 @@ +set @save_default_engine= @@default_storage_engine; +--disable_query_log +if ($MTR_COMBINATION_INNODB) +{ +set default_storage_engine= innodb; +} +if ($MTR_COMBINATION_ARIA) +{ +set default_storage_engine= aria; +} +if ($MTR_COMBINATION_HEAP) +{ +set default_storage_engine= memory; +} +--enable_query_log +let $default_engine= `select @@default_storage_engine`; + +--echo # +--echo # MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed +--echo # + +if (!$MTR_COMBINATION_INNODB) +{ + --disable_query_log + --disable_result_log + # There is no inplace ADD INDEX for MyISAM/Aria: + create or replace table t1 (x int); + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add unique (x), algorithm=inplace; + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add primary key(x), algorithm=inplace; + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add index(x), algorithm=inplace; + --enable_query_log + --enable_result_log +} + +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; +alter table t1 change x xx int, algorithm=inplace; +check table t1; +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); +alter table t1 change x xx int, algorithm=inplace; +check table t1; +drop table t1; + +--echo # +--echo # End of 10.3 tests +--echo # + +--echo # +--echo # MDEV-16290 ALTER TABLE ... RENAME COLUMN syntax +--echo # + +CREATE TABLE t1(a INT, b VARCHAR(30), c FLOAT); +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES(1,'abcd',1.234); +CREATE TABLE t2(a INT, b VARCHAR(30), c FLOAT) ENGINE=MyIsam; +SHOW CREATE TABLE t2; +INSERT INTO t2 VALUES(1,'abcd',1.234); + +# Rename one column +ALTER TABLE t1 RENAME COLUMN a TO a; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t1 RENAME COLUMN a TO m; +--error ER_BAD_FIELD_ERROR +ALTER TABLE t1 RENAME COLUMN a TO m; +ALTER TABLE t1 RENAME COLUMN IF EXISTS a TO m; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +SELECT * FROM t1; + +# Rename multiple column +ALTER TABLE t1 RENAME COLUMN m TO x, + RENAME COLUMN b TO y, + RENAME COLUMN c TO z; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +SELECT * FROM t1; + +# Rename multiple columns with MyIsam Engine +ALTER TABLE t2 RENAME COLUMN a TO d, RENAME COLUMN b TO e, RENAME COLUMN c to f; +SHOW CREATE TABLE t2; +SELECT * FROM t2; + +# Mix different ALTER operations with RENAME COLUMN +ALTER TABLE t1 CHANGE COLUMN x a INT, RENAME COLUMN y TO b; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t1 CHANGE COLUMN z c DOUBLE, RENAME COLUMN b to b; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t1 CHANGE COLUMN a b int, RENAME COLUMN b TO c, CHANGE COLUMN c d FLOAT; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t1 ADD COLUMN zz INT, RENAME COLUMN d TO f; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t1 DROP COLUMN zz, RENAME COLUMN c TO zz; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t1 RENAME COLUMN zz to c, DROP COLUMN f; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t1 ADD COLUMN d INT DEFAULT 5, RENAME COLUMN c TO b, DROP COLUMN b; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; + +#Cyclic Rename +ALTER TABLE t1 RENAME COLUMN b TO d, RENAME COLUMN d TO b; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; + +# Rename with Indexes +ALTER TABLE t1 ADD KEY(b); +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t1 RENAME COLUMN b TO bb; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +SELECT * FROM t1; + +# Rename with Foreign keys. +CREATE TABLE t3(a int, b int, KEY(b)); +ALTER TABLE t3 ADD CONSTRAINT FOREIGN KEY(b) REFERENCES t1(bb); +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t3; +ALTER TABLE t1 RENAME COLUMN bb TO b; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t3 RENAME COLUMN b TO c; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t3; + +# Different Algorithm +CREATE TABLE t4(a int); +ALTER TABLE t4 RENAME COLUMN a TO aa, ALGORITHM = INPLACE; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t4; +ALTER TABLE t4 RENAME COLUMN aa TO a, ALGORITHM = COPY; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t4; +DROP TABLE t4; + +# View, Trigger and SP +CREATE VIEW v1 AS SELECT d,e,f FROM t2; +CREATE TRIGGER trg1 BEFORE UPDATE on t2 FOR EACH ROW SET NEW.d=OLD.d + 10; +CREATE PROCEDURE sp1() INSERT INTO t2(d) VALUES(10); +ALTER TABLE t2 RENAME COLUMN d TO g; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t2; +SHOW CREATE VIEW v1; +--error ER_VIEW_INVALID +SELECT * FROM v1; +--error ER_BAD_FIELD_ERROR +UPDATE t2 SET f = f + 10; +--error ER_BAD_FIELD_ERROR +CALL sp1(); +DROP TRIGGER trg1; +DROP PROCEDURE sp1; + +# Generated Columns +if (!$MTR_COMBINATION_HEAP) +{ +CREATE TABLE t_gen(a INT, b DOUBLE GENERATED ALWAYS AS (SQRT(a))); +INSERT INTO t_gen(a) VALUES(4); +SELECT * FROM t_gen; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t_gen; +ALTER TABLE t_gen RENAME COLUMN a TO c, CHANGE COLUMN b b DOUBLE GENERATED ALWAYS AS (SQRT(c)); +SELECT * FROM t_gen; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t_gen; +#--error ER_DEPENDENT_BY_GENERATED_COLUMN +ALTER TABLE t_gen CHANGE COLUMN c x INT; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +show create table t_gen; +#--error ER_DEPENDENT_BY_GENERATED_COLUMN +ALTER TABLE t_gen RENAME COLUMN x TO a; +DROP TABLE t_gen; +} + +# +# Negative tests +# +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; + +# Invalid Syntax +--error ER_PARSE_ERROR +ALTER TABLE t1 RENAME COLUMN b z; +--error ER_PARSE_ERROR +ALTER TABLE t1 RENAME COLUMN FROM b TO z; +--error ER_PARSE_ERROR +ALTER TABLE t1 RENAME COLUMN b TO 1; + +# Duplicate column name +--error ER_BAD_FIELD_ERROR +ALTER TABLE t1 RENAME COLUMN b TO e, RENAME COLUMN c TO e; +--error ER_DUP_FIELDNAME +ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN b TO z; + +# Multiple operation on same column +--error ER_BAD_FIELD_ERROR +ALTER TABLE t1 DROP COLUMN b, RENAME COLUMN b TO z; +--error ER_BAD_FIELD_ERROR +ALTER TABLE t1 RENAME COLUMN b TO b, RENAME COLUMN b TO b; +--error ER_CANT_DROP_FIELD_OR_KEY +ALTER TABLE t1 RENAME COLUMN b TO c3, DROP COLUMN c3; +--error ER_BAD_FIELD_ERROR +ALTER TABLE t1 ADD COLUMN z INT, CHANGE COLUMN z y INT, DROP COLUMN y; +--error ER_BAD_FIELD_ERROR +ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN z TO y, DROP COLUMN y; + +# Invalid column name while renaming +--error ER_WRONG_COLUMN_NAME +ALTER TABLE t1 RENAME COLUMN b TO `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn`; +# This error is different compared to ALTER TABLE ... CHANGE command +--error ER_TOO_LONG_IDENT +ALTER TABLE t1 CHANGE b `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn` int; + +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +SELECT * FROM t1; + +# Cleanup +DROP VIEW v1; +DROP TABLE t3,t1,t2; + +--echo # +--echo # MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed +--echo # + +if (!$MTR_COMBINATION_INNODB) +{ + --disable_query_log + --disable_result_log + # There is no inplace ADD INDEX for MyISAM/Aria: + create or replace table t1 (x int); + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add unique (x), algorithm=inplace; + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add primary key(x), algorithm=inplace; + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add index(x), algorithm=inplace; + --enable_query_log + --enable_result_log +} + +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; +alter table t1 change x xx int, algorithm=inplace; +check table t1; +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); +alter table t1 change x xx int, algorithm=inplace; +check table t1; +drop table t1; + +--echo # +--echo # End of 10.5 tests +--echo # + +set @@default_storage_engine= @save_default_engine; diff --git a/mysql-test/main/alter_table_errors.result b/mysql-test/main/alter_table_errors.result index 5a3ecb6727da9..806e97e48818f 100644 --- a/mysql-test/main/alter_table_errors.result +++ b/mysql-test/main/alter_table_errors.result @@ -6,7 +6,7 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL, `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t; create temporary table t1 (a int, v int as (a)); alter table t1 change column a b int, algorithm=inplace; @@ -16,7 +16,7 @@ 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 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create temporary table t2 (a int, v int as (a)); lock table t2 write; alter table t2 change column a b int, algorithm=inplace; @@ -26,7 +26,7 @@ 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 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop temporary table t1, t2; create temporary table t1 (a int); alter table t1 add column f text; diff --git a/mysql-test/main/alter_table_lock.result b/mysql-test/main/alter_table_lock.result new file mode 100644 index 0000000000000..620fca23315a9 --- /dev/null +++ b/mysql-test/main/alter_table_lock.result @@ -0,0 +1,17 @@ +# +# MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in +# Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK) +# +SET @max_session_mem_used_save= @@max_session_mem_used; +CREATE TABLE t1 (a INT); +SELECT * FROM t1; +a +ALTER TABLE x MODIFY xx INT; +ERROR 42S02: Table 'test.x' doesn't exist +SET SESSION max_session_mem_used= 8192; +LOCK TABLE t1 WRITE; +ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT; +SET SESSION max_session_mem_used = @max_session_mem_used_save; +UNLOCK TABLES; +DROP TABLE t1; +# End of 10.5 tests diff --git a/mysql-test/main/alter_table_lock.test b/mysql-test/main/alter_table_lock.test new file mode 100644 index 0000000000000..bd26c1ac7d04f --- /dev/null +++ b/mysql-test/main/alter_table_lock.test @@ -0,0 +1,29 @@ +--source include/not_msan.inc + +--echo # +--echo # MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in +--echo # Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK) +--echo # + +SET @max_session_mem_used_save= @@max_session_mem_used; + +CREATE TABLE t1 (a INT); +SELECT * FROM t1; + +--error ER_NO_SUCH_TABLE +ALTER TABLE x MODIFY xx INT; + +SET SESSION max_session_mem_used= 8192; +--error 0,ER_OPTION_PREVENTS_STATEMENT +LOCK TABLE t1 WRITE; + +--disable_warnings +--error 0,ER_OPTION_PREVENTS_STATEMENT +ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT; +--enable_warnings + +SET SESSION max_session_mem_used = @max_session_mem_used_save; +UNLOCK TABLES; +DROP TABLE t1; + +--echo # End of 10.5 tests diff --git a/mysql-test/main/alter_table_mdev539_maria.result b/mysql-test/main/alter_table_mdev539_maria.result index 01b2982edce08..b4aa2610ac962 100644 --- a/mysql-test/main/alter_table_mdev539_maria.result +++ b/mysql-test/main/alter_table_mdev539_maria.result @@ -35,7 +35,7 @@ lineitem CREATE TABLE `lineitem` ( KEY `i_l_orderkey` (`l_orderkey`), KEY `i_l_orderkey_quantity` (`l_orderkey`,`l_quantity`), KEY `i_l_commitdate` (`l_commitDATE`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 alter table lineitem add primary key (l_orderkey, l_linenumber); show create table lineitem; Table Create Table @@ -65,7 +65,7 @@ lineitem CREATE TABLE `lineitem` ( KEY `i_l_orderkey` (`l_orderkey`), KEY `i_l_orderkey_quantity` (`l_orderkey`,`l_quantity`), KEY `i_l_commitdate` (`l_commitDATE`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 drop index `primary` on lineitem; select * from lineitem where l_orderkey=1 and l_linenumber=2; l_orderkey l_partkey l_suppkey l_linenumber l_quantity l_extendedprice l_discount l_tax l_returnflag l_linestatus l_shipDATE l_commitDATE l_receiptDATE l_shipinstruct l_shipmode l_comment @@ -105,7 +105,7 @@ lineitem CREATE TABLE `lineitem` ( KEY `i_l_orderkey` (`l_orderkey`), KEY `i_l_orderkey_quantity` (`l_orderkey`,`l_quantity`), KEY `i_l_commitdate` (`l_commitDATE`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 select * from lineitem where l_orderkey=1 and l_linenumber=2; l_orderkey l_partkey l_suppkey l_linenumber l_quantity l_extendedprice l_discount l_tax l_returnflag l_linestatus l_shipDATE l_commitDATE l_receiptDATE l_shipinstruct l_shipmode l_comment 1 68 9 2 36 34850.16 0.09 0.06 N O 1996-04-12 1996-02-28 1996-04-20 TAKE BACK RETURN MAIL slyly bold pinto beans detect s @@ -140,7 +140,7 @@ lineitem CREATE TABLE `lineitem` ( KEY `i_l_orderkey` (`l_orderkey`), KEY `i_l_orderkey_quantity` (`l_orderkey`,`l_quantity`), KEY `i_l_commitdate` (`l_commitDATE`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 select * from lineitem where l_orderkey=1 and l_linenumber=2; l_orderkey l_partkey l_suppkey l_linenumber l_quantity l_extendedprice l_discount l_tax l_returnflag l_linestatus l_shipDATE l_commitDATE l_receiptDATE l_shipinstruct l_shipmode l_comment 1 68 9 2 36 34850.16 0.09 0.06 N O 1996-04-12 1996-02-28 1996-04-20 TAKE BACK RETURN MAIL slyly bold pinto beans detect s @@ -159,7 +159,7 @@ customer CREATE TABLE `customer` ( PRIMARY KEY (`c_custkey`), UNIQUE KEY `i_c_name` (`c_name`), KEY `i_c_nationkey` (`c_nationkey`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 select * from customer where c_name='Customer#000000003'; c_custkey c_name c_address c_nationkey c_phone c_acctbal c_mktsegment c_comment 3 Customer#000000003 MG9kdTD2WBHm 1 11-719-748-3364 7498.12 AUTOMOBILE special packages wake. slyly reg @@ -185,7 +185,7 @@ customer CREATE TABLE `customer` ( `c_comment` varchar(117) DEFAULT NULL, PRIMARY KEY (`c_custkey`), KEY `i_c_nationkey` (`c_nationkey`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 select * from customer where c_name='Customer#000000003'; c_custkey c_name c_address c_nationkey c_phone c_acctbal c_mktsegment c_comment 3 Customer#000000003 MG9kdTD2WBHm 1 11-719-748-3364 7498.12 AUTOMOBILE special packages wake. slyly reg @@ -209,7 +209,7 @@ customer CREATE TABLE `customer` ( PRIMARY KEY (`c_custkey`), UNIQUE KEY `i_c_name` (`c_name`), KEY `i_c_nationkey` (`c_nationkey`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 select * from customer where c_name='Customer#000000003'; c_custkey c_name c_address c_nationkey c_phone c_acctbal c_mktsegment c_comment 3 Customer#000000003 MG9kdTD2WBHm 1 11-719-748-3364 7498.12 AUTOMOBILE special packages wake. slyly reg @@ -227,7 +227,7 @@ customer CREATE TABLE `customer` ( `c_comment` varchar(117) DEFAULT NULL, UNIQUE KEY `i_c_name` (`c_name`), KEY `i_c_nationkey` (`c_nationkey`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 insert into customer values (3,'Customer#000000303','MG9kdTD2WBHm',1,'11-719-748-3364',7498.12,'AUTOMOBILE','special packages wake. slyly reg'); alter ignore table customer add primary key (c_custkey); @@ -245,7 +245,7 @@ customer CREATE TABLE `customer` ( PRIMARY KEY (`c_custkey`), UNIQUE KEY `i_c_name` (`c_name`), KEY `i_c_nationkey` (`c_nationkey`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 select * from customer where c_custkey=3; c_custkey c_name c_address c_nationkey c_phone c_acctbal c_mktsegment c_comment 3 Customer#000000003 MG9kdTD2WBHm 1 11-719-748-3364 7498.12 AUTOMOBILE special packages wake. slyly reg diff --git a/mysql-test/main/alter_table_mdev539_myisam.result b/mysql-test/main/alter_table_mdev539_myisam.result index 490e5a4073a31..f62afdda769a4 100644 --- a/mysql-test/main/alter_table_mdev539_myisam.result +++ b/mysql-test/main/alter_table_mdev539_myisam.result @@ -35,7 +35,7 @@ lineitem CREATE TABLE `lineitem` ( KEY `i_l_orderkey` (`l_orderkey`), KEY `i_l_orderkey_quantity` (`l_orderkey`,`l_quantity`), KEY `i_l_commitdate` (`l_commitDATE`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table lineitem add primary key (l_orderkey, l_linenumber); show create table lineitem; Table Create Table @@ -65,7 +65,7 @@ lineitem CREATE TABLE `lineitem` ( KEY `i_l_orderkey` (`l_orderkey`), KEY `i_l_orderkey_quantity` (`l_orderkey`,`l_quantity`), KEY `i_l_commitdate` (`l_commitDATE`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop index `primary` on lineitem; select * from lineitem where l_orderkey=1 and l_linenumber=2; l_orderkey l_partkey l_suppkey l_linenumber l_quantity l_extendedprice l_discount l_tax l_returnflag l_linestatus l_shipDATE l_commitDATE l_receiptDATE l_shipinstruct l_shipmode l_comment @@ -105,7 +105,7 @@ lineitem CREATE TABLE `lineitem` ( KEY `i_l_orderkey` (`l_orderkey`), KEY `i_l_orderkey_quantity` (`l_orderkey`,`l_quantity`), KEY `i_l_commitdate` (`l_commitDATE`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from lineitem where l_orderkey=1 and l_linenumber=2; l_orderkey l_partkey l_suppkey l_linenumber l_quantity l_extendedprice l_discount l_tax l_returnflag l_linestatus l_shipDATE l_commitDATE l_receiptDATE l_shipinstruct l_shipmode l_comment 1 68 9 2 36 34850.16 0.09 0.06 N O 1996-04-12 1996-02-28 1996-04-20 TAKE BACK RETURN MAIL slyly bold pinto beans detect s @@ -140,7 +140,7 @@ lineitem CREATE TABLE `lineitem` ( KEY `i_l_orderkey` (`l_orderkey`), KEY `i_l_orderkey_quantity` (`l_orderkey`,`l_quantity`), KEY `i_l_commitdate` (`l_commitDATE`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from lineitem where l_orderkey=1 and l_linenumber=2; l_orderkey l_partkey l_suppkey l_linenumber l_quantity l_extendedprice l_discount l_tax l_returnflag l_linestatus l_shipDATE l_commitDATE l_receiptDATE l_shipinstruct l_shipmode l_comment 1 68 9 2 36 34850.16 0.09 0.06 N O 1996-04-12 1996-02-28 1996-04-20 TAKE BACK RETURN MAIL slyly bold pinto beans detect s @@ -159,7 +159,7 @@ customer CREATE TABLE `customer` ( PRIMARY KEY (`c_custkey`), UNIQUE KEY `i_c_name` (`c_name`), KEY `i_c_nationkey` (`c_nationkey`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from customer where c_name='Customer#000000003'; c_custkey c_name c_address c_nationkey c_phone c_acctbal c_mktsegment c_comment 3 Customer#000000003 MG9kdTD2WBHm 1 11-719-748-3364 7498.12 AUTOMOBILE special packages wake. slyly reg @@ -185,7 +185,7 @@ customer CREATE TABLE `customer` ( `c_comment` varchar(117) DEFAULT NULL, PRIMARY KEY (`c_custkey`), KEY `i_c_nationkey` (`c_nationkey`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from customer where c_name='Customer#000000003'; c_custkey c_name c_address c_nationkey c_phone c_acctbal c_mktsegment c_comment 3 Customer#000000003 MG9kdTD2WBHm 1 11-719-748-3364 7498.12 AUTOMOBILE special packages wake. slyly reg @@ -209,7 +209,7 @@ customer CREATE TABLE `customer` ( PRIMARY KEY (`c_custkey`), UNIQUE KEY `i_c_name` (`c_name`), KEY `i_c_nationkey` (`c_nationkey`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from customer where c_name='Customer#000000003'; c_custkey c_name c_address c_nationkey c_phone c_acctbal c_mktsegment c_comment 3 Customer#000000003 MG9kdTD2WBHm 1 11-719-748-3364 7498.12 AUTOMOBILE special packages wake. slyly reg @@ -227,7 +227,7 @@ customer CREATE TABLE `customer` ( `c_comment` varchar(117) DEFAULT NULL, UNIQUE KEY `i_c_name` (`c_name`), KEY `i_c_nationkey` (`c_nationkey`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into customer values (3,'Customer#000000303','MG9kdTD2WBHm',1,'11-719-748-3364',7498.12,'AUTOMOBILE','special packages wake. slyly reg'); alter ignore table customer add primary key (c_custkey); @@ -245,7 +245,7 @@ customer CREATE TABLE `customer` ( PRIMARY KEY (`c_custkey`), UNIQUE KEY `i_c_name` (`c_name`), KEY `i_c_nationkey` (`c_nationkey`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from customer where c_custkey=3; c_custkey c_name c_address c_nationkey c_phone c_acctbal c_mktsegment c_comment 3 Customer#000000003 MG9kdTD2WBHm 1 11-719-748-3364 7498.12 AUTOMOBILE special packages wake. slyly reg diff --git a/mysql-test/main/alter_table_online.result b/mysql-test/main/alter_table_online.result index 719d6fe175198..4d0e0f09f7186 100644 --- a/mysql-test/main/alter_table_online.result +++ b/mysql-test/main/alter_table_online.result @@ -18,7 +18,7 @@ t1 CREATE TABLE `t1` ( `c` varchar(80) DEFAULT 'X', `e` enum('a','b','c') DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new comment' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='new comment' drop table t1; create temporary table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b')); insert into t1 (a) values (1),(2),(3); @@ -35,7 +35,7 @@ t2 CREATE TEMPORARY TABLE `t2` ( `c` varchar(80) DEFAULT 'X', `e` enum('a','b','c') DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new comment' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='new comment' drop table t2; create table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b')) engine=aria; insert into t1 (a) values (1),(2),(3); @@ -51,7 +51,7 @@ t1 CREATE TABLE `t1` ( `c` varchar(80) DEFAULT NULL, `e` enum('a','b','c') DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new comment' +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 COMMENT='new comment' alter online table t1 page_checksum=1; alter online table t1 page_checksum=0; ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED @@ -92,7 +92,7 @@ t1 CREATE TABLE `t1` ( `e` enum('a','b') DEFAULT NULL, PRIMARY KEY (`a`), KEY `c` (`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new comment' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='new comment' drop table t1; create temporary table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b')); insert into t1 (a) values (1),(2),(3); diff --git a/mysql-test/main/alter_table_upgrade_aria.result b/mysql-test/main/alter_table_upgrade_aria.result new file mode 100644 index 0000000000000..10afd12864990 --- /dev/null +++ b/mysql-test/main/alter_table_upgrade_aria.result @@ -0,0 +1,53 @@ +# +# Start of 10.4 tests +# +# +# MDEV-29481 mariadb-upgrade prints confusing statement +# +SET @debug_key_flags=NULL; +SET default_storage_engine=ARIA; +CREATE PROCEDURE debug_show_key_flags() +BEGIN +IF @debug_key_flags IS TRUE +THEN +FLUSH TABLES; +-- Wrap SET into EXECUTE IMMEDIATE to avoid +-- parse time "Unknown system variable" errors in release builds. +EXECUTE IMMEDIATE "SET debug_dbug='+d,key'"; +SELECT * FROM t1 LIMIT 0; +EXECUTE IMMEDIATE "SET debug_dbug=''"; +END IF; +END; +$$ +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` double(18,7) DEFAULT NULL, + KEY `d` (`d`) +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +CHECK TABLE t1 FOR UPGRADE; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CALL debug_show_key_flags(); +ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=INSTANT; +CALL debug_show_key_flags(); +DROP TABLE t1; +CALL debug_show_key_flags(); +ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=NOCOPY; +CALL debug_show_key_flags(); +DROP TABLE t1; +CALL debug_show_key_flags(); +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +CALL debug_show_key_flags(); +DROP TABLE t1; +CALL debug_show_key_flags(); +ALTER TABLE t1 FORCE; +CALL debug_show_key_flags(); +DROP TABLE t1; +DROP PROCEDURE debug_show_key_flags; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/alter_table_upgrade_aria.test b/mysql-test/main/alter_table_upgrade_aria.test new file mode 100644 index 0000000000000..5b87095f51577 --- /dev/null +++ b/mysql-test/main/alter_table_upgrade_aria.test @@ -0,0 +1,21 @@ +--source include/have_aria.inc + +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-29481 mariadb-upgrade prints confusing statement +--echo # + +let $table= std_data/mysql_upgrade/mdev29481_100104_aria; +let $EXT_DAT= MAD; +let $EXT_IDX= MAI; +SET @debug_key_flags=NULL; +SET default_storage_engine=ARIA; +--source alter_table_upgrade_mdev29481_myisam_aria.inc + + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/alter_table_upgrade_mdev29481_myisam_aria.inc b/mysql-test/main/alter_table_upgrade_mdev29481_myisam_aria.inc new file mode 100644 index 0000000000000..0a8759eccdd89 --- /dev/null +++ b/mysql-test/main/alter_table_upgrade_mdev29481_myisam_aria.inc @@ -0,0 +1,59 @@ +let $datadir=`select @@datadir`; + +DELIMITER $$; +CREATE PROCEDURE debug_show_key_flags() +BEGIN + IF @debug_key_flags IS TRUE + THEN + FLUSH TABLES; + -- Wrap SET into EXECUTE IMMEDIATE to avoid + -- parse time "Unknown system variable" errors in release builds. + EXECUTE IMMEDIATE "SET debug_dbug='+d,key'"; + SELECT * FROM t1 LIMIT 0; + EXECUTE IMMEDIATE "SET debug_dbug=''"; + END IF; +END; +$$ +DELIMITER ;$$ + + +copy_file $table.frm $datadir/test/t1.frm; +copy_file $table.$EXT_DAT $datadir/test/t1.$EXT_DAT; +copy_file $table.$EXT_IDX $datadir/test/t1.$EXT_IDX; +SHOW CREATE TABLE t1; +CHECK TABLE t1 FOR UPGRADE; +DROP TABLE t1; + +copy_file $table.frm $datadir/test/t1.frm; +copy_file $table.$EXT_DAT $datadir/test/t1.$EXT_DAT; +copy_file $table.$EXT_IDX $datadir/test/t1.$EXT_IDX; +CALL debug_show_key_flags(); +ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=INSTANT; +CALL debug_show_key_flags(); +DROP TABLE t1; + +copy_file $table.frm $datadir/test/t1.frm; +copy_file $table.$EXT_DAT $datadir/test/t1.$EXT_DAT; +copy_file $table.$EXT_IDX $datadir/test/t1.$EXT_IDX; +CALL debug_show_key_flags(); +ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=NOCOPY; +CALL debug_show_key_flags(); +DROP TABLE t1; + +copy_file $table.frm $datadir/test/t1.frm; +copy_file $table.$EXT_DAT $datadir/test/t1.$EXT_DAT; +copy_file $table.$EXT_IDX $datadir/test/t1.$EXT_IDX; +CALL debug_show_key_flags(); +REPAIR TABLE t1; +CALL debug_show_key_flags(); +DROP TABLE t1; + +copy_file $table.frm $datadir/test/t1.frm; +copy_file $table.$EXT_DAT $datadir/test/t1.$EXT_DAT; +copy_file $table.$EXT_IDX $datadir/test/t1.$EXT_IDX; +CALL debug_show_key_flags(); +ALTER TABLE t1 FORCE; +CALL debug_show_key_flags(); +DROP TABLE t1; + +DROP PROCEDURE debug_show_key_flags; diff --git a/mysql-test/main/alter_table_upgrade_myisam.result b/mysql-test/main/alter_table_upgrade_myisam.result new file mode 100644 index 0000000000000..06bd1b70a0afa --- /dev/null +++ b/mysql-test/main/alter_table_upgrade_myisam.result @@ -0,0 +1,52 @@ +# +# Start of 10.4 tests +# +# +# MDEV-29481 mariadb-upgrade prints confusing statement +# +SET @debug_key_flags=NULL; +CREATE PROCEDURE debug_show_key_flags() +BEGIN +IF @debug_key_flags IS TRUE +THEN +FLUSH TABLES; +-- Wrap SET into EXECUTE IMMEDIATE to avoid +-- parse time "Unknown system variable" errors in release builds. +EXECUTE IMMEDIATE "SET debug_dbug='+d,key'"; +SELECT * FROM t1 LIMIT 0; +EXECUTE IMMEDIATE "SET debug_dbug=''"; +END IF; +END; +$$ +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` double(18,7) DEFAULT NULL, + KEY `d` (`d`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CHECK TABLE t1 FOR UPGRADE; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CALL debug_show_key_flags(); +ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=INSTANT; +CALL debug_show_key_flags(); +DROP TABLE t1; +CALL debug_show_key_flags(); +ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=NOCOPY; +CALL debug_show_key_flags(); +DROP TABLE t1; +CALL debug_show_key_flags(); +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +CALL debug_show_key_flags(); +DROP TABLE t1; +CALL debug_show_key_flags(); +ALTER TABLE t1 FORCE; +CALL debug_show_key_flags(); +DROP TABLE t1; +DROP PROCEDURE debug_show_key_flags; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/alter_table_upgrade_myisam.test b/mysql-test/main/alter_table_upgrade_myisam.test new file mode 100644 index 0000000000000..251ca3e3555da --- /dev/null +++ b/mysql-test/main/alter_table_upgrade_myisam.test @@ -0,0 +1,17 @@ +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-29481 mariadb-upgrade prints confusing statement +--echo # + +let $table= std_data/mysql_upgrade/mdev29481_100104_myisam; +let $EXT_DAT= MYD; +let $EXT_IDX= MYI; +SET @debug_key_flags=NULL; +--source alter_table_upgrade_mdev29481_myisam_aria.inc + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/alter_table_upgrade_myisam_debug.result b/mysql-test/main/alter_table_upgrade_myisam_debug.result new file mode 100644 index 0000000000000..ed135585d9db7 --- /dev/null +++ b/mysql-test/main/alter_table_upgrade_myisam_debug.result @@ -0,0 +1,92 @@ +# +# Start of 10.4 tests +# +# +# MDEV-29481 mariadb-upgrade prints confusing statement +# +SET @debug_key_flags=TRUE; +CREATE PROCEDURE debug_show_key_flags() +BEGIN +IF @debug_key_flags IS TRUE +THEN +FLUSH TABLES; +-- Wrap SET into EXECUTE IMMEDIATE to avoid +-- parse time "Unknown system variable" errors in release builds. +EXECUTE IMMEDIATE "SET debug_dbug='+d,key'"; +SELECT * FROM t1 LIMIT 0; +EXECUTE IMMEDIATE "SET debug_dbug=''"; +END IF; +END; +$$ +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` double(18,7) DEFAULT NULL, + KEY `d` (`d`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CHECK TABLE t1 FOR UPGRADE; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CALL debug_show_key_flags(); +d +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART) +ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=INSTANT; +CALL debug_show_key_flags(); +d +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART) +DROP TABLE t1; +CALL debug_show_key_flags(); +d +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART) +ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=NOCOPY; +CALL debug_show_key_flags(); +d +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART) +DROP TABLE t1; +CALL debug_show_key_flags(); +d +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART) +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +CALL debug_show_key_flags(); +d +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART) +DROP TABLE t1; +CALL debug_show_key_flags(); +d +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART) +ALTER TABLE t1 FORCE; +CALL debug_show_key_flags(); +d +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000048 (HA_NULL_PART_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART) +DROP TABLE t1; +DROP PROCEDURE debug_show_key_flags; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/alter_table_upgrade_myisam_debug.test b/mysql-test/main/alter_table_upgrade_myisam_debug.test new file mode 100644 index 0000000000000..8e26bcd24536f --- /dev/null +++ b/mysql-test/main/alter_table_upgrade_myisam_debug.test @@ -0,0 +1,19 @@ +--source include/have_debug.inc + +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-29481 mariadb-upgrade prints confusing statement +--echo # + +let $table= std_data/mysql_upgrade/mdev29481_100104_myisam; +let $EXT_DAT= MYD; +let $EXT_IDX= MYI; +SET @debug_key_flags=TRUE; +--source alter_table_upgrade_mdev29481_myisam_aria.inc + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/alter_user.result b/mysql-test/main/alter_user.result index 0bbf0aa678890..7cca2db0e5efb 100644 --- a/mysql-test/main/alter_user.result +++ b/mysql-test/main/alter_user.result @@ -112,4 +112,14 @@ 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 N 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; +# +# Bug #29882299: ALTER USER ... IDENTIFIED WITH ... BY ... SHOULD BE A PRIVILEGED OPERATION +# +create user foo@localhost; +connect x,localhost,foo; +alter user current_user identified with 'something'; +ERROR 42000: Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation +connection default; +disconnect x; +drop user foo@localhost; 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 37f77c2649632..95e6d7329077e 100644 --- a/mysql-test/main/alter_user.test +++ b/mysql-test/main/alter_user.test @@ -106,4 +106,15 @@ alter user foo with MAX_QUERIES_PER_HOUR 10 select * from mysql.user where user = 'foo'; drop user foo; +--echo # +--echo # Bug #29882299: ALTER USER ... IDENTIFIED WITH ... BY ... SHOULD BE A PRIVILEGED OPERATION +--echo # +create user foo@localhost; +--connect x,localhost,foo +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +alter user current_user identified with 'something'; +--connection default +--disconnect x +drop user foo@localhost; + update mysql.global_priv set priv=@root_priv where user='root' and host='localhost'; diff --git a/mysql-test/main/analyze_format_json.result b/mysql-test/main/analyze_format_json.result index 6c9b8ce298293..619e00afb3edc 100644 --- a/mysql-test/main/analyze_format_json.result +++ b/mysql-test/main/analyze_format_json.result @@ -171,7 +171,11 @@ ANALYZE "buffer_type": "flat", "buffer_size": "1Kb", "join_type": "BNL", - "r_filtered": 100 + "r_loops": 20, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 60 } } ] @@ -218,7 +222,11 @@ ANALYZE "buffer_size": "1Kb", "join_type": "BNL", "attached_condition": "tbl1.c > tbl2.c", - "r_filtered": 15.83333333 + "r_loops": 20, + "r_filtered": 15.83333333, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 60 } } ] @@ -724,7 +732,11 @@ ANALYZE "buffer_size": "65", "join_type": "BNL", "attached_condition": "(t2.b,t2.b in (subquery#2))", - "r_filtered": null + "r_loops": 2, + "r_filtered": null, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 0 } } ], @@ -824,7 +836,11 @@ ANALYZE "buffer_type": "flat", "buffer_size": "1", "join_type": "BNL", - "r_filtered": null + "r_loops": 2, + "r_filtered": null, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 0 } } ], @@ -862,7 +878,11 @@ ANALYZE "buffer_size": "65", "join_type": "BNL", "attached_condition": "t2.f2 = t3.f3", - "r_filtered": null + "r_loops": 0, + "r_filtered": null, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": null } } ] @@ -947,3 +967,139 @@ ANALYZE } } drop table t0,t1,t2; +# +# MDEV-30806: ANALYZE FORMAT=JSON: better support for BNL and BNL-H joins +# +create table t10 ( +a int, +b int +); +insert into t10 select seq, seq/3 from seq_0_to_999; +create table t11 ( +a int, +b int +); +insert into t11 select seq, seq/5 from seq_0_to_999; +analyze table t10,t11 persistent for all; +Table Op Msg_type Msg_text +test.t10 analyze status Engine-independent statistics collected +test.t10 analyze status OK +test.t11 analyze status Engine-independent statistics collected +test.t11 analyze status OK +analyze format=json +select * from t10, t11 +where +t10.a < 700 and +t11.a < 100 +and t10.b=t11.b; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t11", + "access_type": "ALL", + "r_loops": 1, + "rows": 1000, + "r_rows": 1000, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 10, + "r_filtered": 10, + "attached_condition": "t11.a < 100" + } + }, + { + "block-nl-join": { + "table": { + "table_name": "t10", + "access_type": "ALL", + "r_loops": 1, + "rows": 1000, + "r_rows": 1000, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 70, + "r_filtered": 70, + "attached_condition": "t10.a < 700" + }, + "buffer_type": "flat", + "buffer_size": "1Kb", + "join_type": "BNL", + "attached_condition": "t10.b = t11.b", + "r_loops": 100, + "r_filtered": 0.424285714, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 700 + } + } + ] + } +} +set @tmp=@@join_cache_level, join_cache_level=6; +analyze format=json +select * from t10, t11 +where +t10.a < 700 and +t11.a < 100 +and t10.b=t11.b; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t11", + "access_type": "ALL", + "r_loops": 1, + "rows": 1000, + "r_rows": 1000, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 10, + "r_filtered": 10, + "attached_condition": "t11.a < 100 and t11.b is not null" + } + }, + { + "block-nl-join": { + "table": { + "table_name": "t10", + "access_type": "hash_ALL", + "key": "#hash#$hj", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t11.b"], + "r_loops": 1, + "rows": 1000, + "r_rows": 1000, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 70, + "r_filtered": 70, + "attached_condition": "t10.a < 700" + }, + "buffer_type": "flat", + "buffer_size": "3Kb", + "join_type": "BNLH", + "attached_condition": "t10.b = t11.b", + "r_loops": 100, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 2.97 + } + } + ] + } +} +set join_cache_level=@tmp; +drop table t10, t11; diff --git a/mysql-test/main/analyze_format_json.test b/mysql-test/main/analyze_format_json.test index 3f3324e9eec52..84f44869afe68 100644 --- a/mysql-test/main/analyze_format_json.test +++ b/mysql-test/main/analyze_format_json.test @@ -226,3 +226,45 @@ create table t2 as select * from t1; --source include/analyze-format.inc analyze format=json select a, (select t2.b from t2 where t2.a 0; +cast(json_extract(@out,'$[0]') as DOUBLE) > 0 +1 +drop table t1; diff --git a/mysql-test/main/analyze_format_json_emb.test b/mysql-test/main/analyze_format_json_emb.test new file mode 100644 index 0000000000000..dcf6f24dd8e83 --- /dev/null +++ b/mysql-test/main/analyze_format_json_emb.test @@ -0,0 +1,18 @@ +--source include/is_embedded.inc +--source include/big_test.inc + +--echo # +--echo # MDEV-31121: ANALYZE statement produces 0 for all timings in embedded serve +--echo # +create table t1 (a int); +insert into t1 values (0),(0); +let $out=` +analyze format=json select sleep(1+a) from t1 +`; + +evalp set @js='$out'; +set @out=(select json_extract(@js,'$**.query_block.r_total_time_ms')); +select cast(json_extract(@out,'$[0]') as DOUBLE) > 0; + +drop table t1; + diff --git a/mysql-test/main/analyze_format_json_timings.result b/mysql-test/main/analyze_format_json_timings.result new file mode 100644 index 0000000000000..5ffab08386e4d --- /dev/null +++ b/mysql-test/main/analyze_format_json_timings.result @@ -0,0 +1,183 @@ +# +# MDEV-30830: ANALYZE FORMAT=JSON: r_unpack_time_ms is empty for the hashed joins +# +# +# First, check a regular BNL-join +# +create table t1 ( +a int, +b int +); +insert into t1 select seq, seq/3 from seq_0_to_99; +create table t2 ( +a int, +b int +); +insert into t2 select seq, seq/5 from seq_0_to_99; +set @js='$out'; +set @out=(select json_extract(@js,'$**.block-nl-join.r_unpack_time_ms')); +select cast(json_extract(@out,'$[0]') as DOUBLE) > 0; +cast(json_extract(@out,'$[0]') as DOUBLE) > 0 +1 +drop table t1,t2; +# +# Now, check the hashed, BNL-H join +# +create table t1 ( +a int, +b int +); +insert into t1 select seq, seq/3 from seq_0_to_499; +create table t2 ( +a int, +b int +); +insert into t2 select seq, seq/5 from seq_0_to_499; +set @tmp=@@join_cache_level, join_cache_level=6; +select '$out' as X; +X +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 500, + "r_rows": 500, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "attached_condition": "t1.a < 700 and t1.b is not null" + } + }, + { + "block-nl-join": { + "table": { + "table_name": "t2", + "access_type": "hash_ALL", + "key": "#hash#$hj", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t1.b"], + "r_loops": 1, + "rows": 500, + "r_rows": 500, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 20, + "attached_condition": "t2.a < 100" + }, + "buffer_type": "flat", + "buffer_size": "18Kb", + "join_type": "BNLH", + "attached_condition": "t2.b = t1.b", + "r_loops": 500, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 0.594 + } + } + ] + } +} +set @out=(select json_extract(@js,'$**.block-nl-join.r_unpack_time_ms')); +select cast(json_extract(@out,'$[0]') as DOUBLE) > 0; +cast(json_extract(@out,'$[0]') as DOUBLE) > 0 +1 +set join_cache_level=@tmp; +drop table t1, t2; +# +# MDEV-30972: ANALYZE FORMAT=JSON: some time is unaccounted-for in BNL-H join +# +create table t1 ( +a int, +col1 varchar(100), +col2 varchar(100), +col3 varchar(100) +); +insert into t1 select +seq/100, +concat('col1-', seq), +concat('col1-', seq), +concat('col1-', seq) +from seq_1_to_1000; +create table t2 ( +a int, +col1 varchar(100), +col2 varchar(100), +col3 varchar(100) +); +insert into t2 select +seq/100, +concat('col1-', seq), +concat('col1-', seq), +concat('col1-', seq) +from seq_1_to_2000; +set @tmp=@@join_cache_level, join_cache_level=6; +select '$out' as X; +X +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 1000, + "r_rows": 1000, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "attached_condition": "t1.a is not null" + } + }, + { + "block-nl-join": { + "table": { + "table_name": "t2", + "access_type": "hash_ALL", + "key": "#hash#$hj", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t1.a"], + "r_loops": 1, + "rows": 2000, + "r_rows": 2000, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNLH", + "attached_condition": "t2.a = t1.a and concat(t1.col1,t1.col2,t1.col3) = concat(t2.col1,t2.col2,t2.col3)", + "r_loops": 1000, + "r_filtered": 1.025630506, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 97.501 + } + } + ] + } +} +set @out=(select json_extract(@js,'$**.block-nl-join.r_other_time_ms')); +select cast(json_extract(@out,'$[0]') as DOUBLE) > 0; +cast(json_extract(@out,'$[0]') as DOUBLE) > 0 +1 +set join_cache_level=@tmp; +drop table t1, t2; diff --git a/mysql-test/main/analyze_format_json_timings.test b/mysql-test/main/analyze_format_json_timings.test new file mode 100644 index 0000000000000..fe02c31838893 --- /dev/null +++ b/mysql-test/main/analyze_format_json_timings.test @@ -0,0 +1,127 @@ +# +# Tests to check that r_something_time_ms is non-zero in +# ANALYZE FORMAT=JSON +# +--source include/default_optimizer_switch.inc +--source include/have_sequence.inc + +# The tests here are large so that we get non-zero timings +--source include/big_test.inc + +--echo # +--echo # MDEV-30830: ANALYZE FORMAT=JSON: r_unpack_time_ms is empty for the hashed joins +--echo # + +--echo # +--echo # First, check a regular BNL-join +--echo # +create table t1 ( + a int, + b int +); +insert into t1 select seq, seq/3 from seq_0_to_99; + +create table t2 ( + a int, + b int +); +insert into t2 select seq, seq/5 from seq_0_to_99; + +let $out=` +analyze format=json +select * from t1, t2 +where + t1.a < 700 and + t2.a < 100 + and t1.b=t2.b +`; + +evalp set @js='$out'; +set @out=(select json_extract(@js,'$**.block-nl-join.r_unpack_time_ms')); +select cast(json_extract(@out,'$[0]') as DOUBLE) > 0; +drop table t1,t2; + +--echo # +--echo # Now, check the hashed, BNL-H join +--echo # +create table t1 ( + a int, + b int +); +insert into t1 select seq, seq/3 from seq_0_to_499; + +create table t2 ( + a int, + b int +); +insert into t2 select seq, seq/5 from seq_0_to_499; +set @tmp=@@join_cache_level, join_cache_level=6; + +let $out=` +analyze format=json +select * from t1, t2 +where + t1.a < 700 and + t2.a < 100 + and t1.b=t2.b +`; + +--source include/analyze-format.inc +evalp select '$out' as X; + +set @out=(select json_extract(@js,'$**.block-nl-join.r_unpack_time_ms')); +select cast(json_extract(@out,'$[0]') as DOUBLE) > 0; + +set join_cache_level=@tmp; +drop table t1, t2; + +--echo # +--echo # MDEV-30972: ANALYZE FORMAT=JSON: some time is unaccounted-for in BNL-H join +--echo # + +create table t1 ( + a int, + col1 varchar(100), + col2 varchar(100), + col3 varchar(100) +); + +insert into t1 select + seq/100, + concat('col1-', seq), + concat('col1-', seq), + concat('col1-', seq) +from seq_1_to_1000; + +create table t2 ( + a int, + col1 varchar(100), + col2 varchar(100), + col3 varchar(100) +); + +insert into t2 select + seq/100, + concat('col1-', seq), + concat('col1-', seq), + concat('col1-', seq) +from seq_1_to_2000; + +set @tmp=@@join_cache_level, join_cache_level=6; + +let $out=` +analyze format=json +select * from t1, t2 +where + t1.a=t2.a + and concat(t1.col1, t1.col2, t1.col3)= concat(t2.col1, t2.col2, t2.col3) +`; +--source include/analyze-format.inc +evalp select '$out' as X; + +set @out=(select json_extract(@js,'$**.block-nl-join.r_other_time_ms')); +select cast(json_extract(@out,'$[0]') as DOUBLE) > 0; + +set join_cache_level=@tmp; +drop table t1, t2; + diff --git a/mysql-test/main/analyze_stmt_orderby.result b/mysql-test/main/analyze_stmt_orderby.result index d4d0fe6b25b77..65be50bd0f6a8 100644 --- a/mysql-test/main/analyze_stmt_orderby.result +++ b/mysql-test/main/analyze_stmt_orderby.result @@ -473,7 +473,11 @@ ANALYZE "buffer_size": "65", "join_type": "BNL", "attached_condition": "t3.a = t0.a", - "r_filtered": 10 + "r_loops": 10, + "r_filtered": 10, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 10 } } ] @@ -554,7 +558,11 @@ ANALYZE "buffer_size": "119", "join_type": "BNL", "attached_condition": "t5.a = t6.a", - "r_filtered": 21.42857143 + "r_loops": 4, + "r_filtered": 21.42857143, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 7 } } ] diff --git a/mysql-test/main/analyze_stmt_privileges.result b/mysql-test/main/analyze_stmt_privileges.result index d54b5b378633e..092f577e1bd6b 100644 --- a/mysql-test/main/analyze_stmt_privileges.result +++ b/mysql-test/main/analyze_stmt_privileges.result @@ -11,11 +11,11 @@ CREATE USER u1@localhost; grant ALL on db.v1 to u1@localhost; connect con1,localhost,u1,,; select * from db.t1; -ERROR 42000: SELECT command denied to user 'u1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'u1'@'localhost' for table `db`.`t1` explain select * from db.t1; -ERROR 42000: SELECT command denied to user 'u1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'u1'@'localhost' for table `db`.`t1` analyze select * from db.t1; -ERROR 42000: SELECT command denied to user 'u1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'u1'@'localhost' for table `db`.`t1` select * from db.v1; i c 2 bar diff --git a/mysql-test/main/analyze_stmt_privileges2.result b/mysql-test/main/analyze_stmt_privileges2.result index f269aaf540be2..2b75f736a22ca 100644 --- a/mysql-test/main/analyze_stmt_privileges2.result +++ b/mysql-test/main/analyze_stmt_privileges2.result @@ -29,89 +29,89 @@ connection con1; # because the query itself cannot be executed #------------------------------------------------------------------------ INSERT INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN INSERT INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE INSERT INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE UPDATE t1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 USING t1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1 USING t1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1 USING t1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` SELECT * FROM t1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN SELECT * FROM t1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE SELECT * FROM t1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` #------------------------------------------------------------------------ # I/R/U/D/S on the inner view # Expectation: Can run the queries, but not EXPLAIN or ANALYZE @@ -283,71 +283,71 @@ connection con1; # Expectation: Can only run SELECT, EXPLAIN SELECT, ANALYZE SELECT #------------------------------------------------------------------------ INSERT INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN INSERT INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE INSERT INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE UPDATE t1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 USING t1, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1 USING t1, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1 USING t1, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` SELECT * FROM t1; a b 10 NULL @@ -634,77 +634,77 @@ ANALYZE INSERT INTO t1 SELECT * FROM t2; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE UPDATE t1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 USING t1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1 USING t1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1 USING t1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` SELECT * FROM t1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN SELECT * FROM t1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE SELECT * FROM t1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` #------------------------------------------------------------------------ # I/R/U/D/S on the inner view # Expectation: Can run the queries, but not EXPLAIN or ANALYZE @@ -879,29 +879,29 @@ connection con1; # read columns fail with ER_COLUMNACCESS_DENIED_ERROR #------------------------------------------------------------------------ INSERT INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN INSERT INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE INSERT INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1 SET a = 10; EXPLAIN UPDATE t1 SET a = 10; id select_type table type possible_keys key key_len ref rows Extra @@ -922,47 +922,47 @@ ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1' DELETE FROM t1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 USING t1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1 USING t1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1 USING t1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` SELECT * FROM t1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN SELECT * FROM t1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE SELECT * FROM t1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` #------------------------------------------------------------------------ # I/R/U/D/S on the inner view # Expectation: Can run the queries, but not EXPLAIN or ANALYZE @@ -1138,47 +1138,47 @@ connection con1; #------------------------------------------------------------------------ # Note: ANALYZE DELETE FROM t1 USING t1, t2 ... fails due to MDEV-7043 INSERT INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN INSERT INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE INSERT INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE UPDATE t1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1; EXPLAIN DELETE FROM t1; id select_type table type possible_keys key key_len ref rows Extra @@ -1193,35 +1193,35 @@ ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' ANALYZE DELETE FROM t1 WHERE a = 10; ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1' DELETE FROM t1 USING t1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1 USING t1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1 USING t1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` SELECT * FROM t1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN SELECT * FROM t1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE SELECT * FROM t1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` #------------------------------------------------------------------------ # I/R/U/D/S on the inner view # Expectation: Can run the queries, but not EXPLAIN or ANALYZE @@ -1394,47 +1394,47 @@ connection con1; # Expectation: Can run DELETE, EXPLAIN DELETE, ANALYZE DELETE #------------------------------------------------------------------------ INSERT INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN INSERT INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE INSERT INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE REPLACE INTO t1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE UPDATE t1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1; EXPLAIN DELETE FROM t1; id select_type table type possible_keys key key_len ref rows Extra @@ -1465,23 +1465,23 @@ ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` SELECT * FROM t1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN SELECT * FROM t1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE SELECT * FROM t1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` #------------------------------------------------------------------------ # I/R/U/D/S on the inner view # Expectation: Can run everything: SELECT access to the column `a` @@ -2077,89 +2077,89 @@ connection con1; # Expectation: Cannot run anything #------------------------------------------------------------------------ INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` #------------------------------------------------------------------------ # I/R/U/D/S on the outer view # Expectation: Can run the queries, but not EXPLAIN or ANALYZE @@ -2252,89 +2252,89 @@ connection con1; # Expectation: Cannot run anything #------------------------------------------------------------------------ INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` #------------------------------------------------------------------------ # I/R/U/D/S on the outer view # Expectation: Can run the queries, but not EXPLAIN or ANALYZE @@ -2430,71 +2430,71 @@ connection con1; # (it could have revealed the structure of the view) #------------------------------------------------------------------------ INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1; a b EXPLAIN SELECT * FROM v1; @@ -2612,71 +2612,71 @@ connection con1; # Expectation: Can run SELECT, EXPLAIN SELECT, ANALYZE SELECT #------------------------------------------------------------------------ INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1; a b EXPLAIN SELECT * FROM v1; @@ -2838,77 +2838,77 @@ ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for unde ANALYZE INSERT INTO v1 SELECT * FROM t2; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` #------------------------------------------------------------------------ # I/R/U/D/S on the outer view # Expectation: Can run the queries, but not EXPLAIN or ANALYZE @@ -3005,29 +3005,29 @@ connection con1; # (it could have revealed the structure of the view). #------------------------------------------------------------------------ INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = 10; EXPLAIN UPDATE v1 SET a = 10; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table @@ -3045,47 +3045,47 @@ ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for unde ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` #------------------------------------------------------------------------ # I/R/U/D/S on the outer view # Expectation: Can run the queries, but not EXPLAIN or ANALYZE @@ -3181,29 +3181,29 @@ connection con1; # (it could have revealed the structure of the view) #------------------------------------------------------------------------ INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = 10; EXPLAIN UPDATE v1 SET a = 10; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table @@ -3220,43 +3220,43 @@ ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for unde ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ANALYZE SELECT * FROM v1; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1 WHERE a = 10; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ANALYZE SELECT * FROM v1 WHERE a = 10; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); @@ -3356,29 +3356,29 @@ connection con1; # (it could have revealed the structure of the view) #------------------------------------------------------------------------ INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = 10; EXPLAIN UPDATE v1 SET a = 10; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table @@ -3395,29 +3395,29 @@ ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for unde ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1; a b EXPLAIN SELECT * FROM v1; @@ -3532,47 +3532,47 @@ connection con1; # (it could have revealed the structure of the view) #------------------------------------------------------------------------ INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1; EXPLAIN DELETE FROM v1; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table @@ -3585,35 +3585,35 @@ ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for unde ANALYZE DELETE FROM v1 WHERE a = 10; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` #------------------------------------------------------------------------ # I/R/U/D/S on the outer view # Expectation: Can run the queries, but not EXPLAIN or ANALYZE @@ -3708,47 +3708,47 @@ connection con1; # which don't read any columns #------------------------------------------------------------------------ INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE INSERT INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE REPLACE INTO v1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` DELETE FROM v1; EXPLAIN DELETE FROM v1; id select_type table type possible_keys key key_len ref rows Extra @@ -3763,35 +3763,35 @@ ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' ANALYZE DELETE FROM v1 WHERE a = 10; ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 'v1' DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v1` #------------------------------------------------------------------------ # I/R/U/D/S on the outer view # Expectation: Can run the queries, but not EXPLAIN or ANALYZE @@ -4123,89 +4123,89 @@ connection con1; # Expectation: Cannot run anything #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` #======================================================================== # Test: Grant SHOW VIEW on the outer view @@ -4219,89 +4219,89 @@ connection con1; # Expectation: Cannot run anything #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` #======================================================================== # Test: Grant SHOW VIEW, SELECT(a) on the outer view @@ -4317,71 +4317,71 @@ connection con1; # when only `a` column is involved #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT a FROM v2; a EXPLAIN SELECT a FROM v2; @@ -4391,17 +4391,17 @@ ANALYZE SELECT a FROM v2; 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 39 39.00 100.00 0.00 Using where SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT a FROM v2 WHERE a = 10; a EXPLAIN SELECT a FROM v2 WHERE a = 10; @@ -4411,11 +4411,11 @@ ANALYZE SELECT a FROM v2 WHERE a = 10; 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 39 39.00 100.00 0.00 Using where SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` #======================================================================== # Test: Grant SELECT on the outer view @@ -4432,71 +4432,71 @@ connection con1; # (it could have revealed the structure of the view) #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2; a b EXPLAIN SELECT * FROM v2; @@ -4529,71 +4529,71 @@ connection con1; # Expectation: Can run SELECT, EXPLAIN SELECT, ANALYZE SELECT #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2; a b EXPLAIN SELECT * FROM v2; @@ -4649,77 +4649,77 @@ ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for unde ANALYZE INSERT INTO v2 SELECT * FROM t2; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` #======================================================================== # Test: Grant UPDATE on the outer view @@ -4738,29 +4738,29 @@ connection con1; # (it could have revealed the structure of the view) #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = 10; EXPLAIN UPDATE v2 SET a = 10; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table @@ -4778,47 +4778,47 @@ ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for unde ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` #======================================================================== # Test: Grant UPDATE, SHOW VIEW on the outer view @@ -4834,29 +4834,29 @@ connection con1; # which do not read any columns #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = 10; EXPLAIN UPDATE v2 SET a = 10; id select_type table type possible_keys key key_len ref rows Extra @@ -4878,47 +4878,47 @@ ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 'v2' DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` #======================================================================== # Test: Grant DELETE on the outer view @@ -4936,47 +4936,47 @@ connection con1; # (it could have revealed the structure of the view) #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2; EXPLAIN DELETE FROM v2; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table @@ -4989,35 +4989,35 @@ ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for unde ANALYZE DELETE FROM v2 WHERE a = 10; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2 WHERE a = 10; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` #======================================================================== # Test: Grant DELETE, SELECT on the outer view @@ -5034,43 +5034,43 @@ connection con1; # (it could have revealed the structure of the view) #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE INSERT INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 (a) VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE REPLACE INTO v2 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2 SET a = 10; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` ANALYZE UPDATE v2 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`v2` EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; diff --git a/mysql-test/main/ansi.result b/mysql-test/main/ansi.result index 810168cc3bd4e..b1b41f52c1c22 100644 --- a/mysql-test/main/ansi.result +++ b/mysql-test/main/ansi.result @@ -23,7 +23,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET @@SQL_MODE="MYSQL323"; SHOW CREATE TABLE t1; Table Create Table @@ -44,7 +44,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-16186 Concatenation operator || returns wrong results in sql_mode=ORACLE diff --git a/mysql-test/main/ansi.test b/mysql-test/main/ansi.test index 0620465728bc6..19dc4ff07698d 100644 --- a/mysql-test/main/ansi.test +++ b/mysql-test/main/ansi.test @@ -5,7 +5,7 @@ --disable_warnings drop table if exists t1; --enable_warnings - +--disable_service_connection set sql_mode="MySQL40"; select @@sql_mode; set @@sql_mode="ANSI"; @@ -72,3 +72,4 @@ 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; +--enable_service_connection diff --git a/mysql-test/main/auto_increment.result b/mysql-test/main/auto_increment.result index bd61d73f08cc3..a1c7d500c1f5e 100644 --- a/mysql-test/main/auto_increment.result +++ b/mysql-test/main/auto_increment.result @@ -375,7 +375,7 @@ t1 CREATE TABLE `t1` ( `t1_id` int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`t1_id`), KEY `t1_name` (`t1_name`) -) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE `t1`; create table t1(a int not null auto_increment primary key); create table t2(a int not null auto_increment primary key, t1a int); @@ -554,7 +554,7 @@ t1 CREATE TABLE `t1` ( `id` tinyint(4) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (name) VALUES ('dog'); UPDATE t1 SET id=-1 WHERE id=1; INSERT INTO t1 (name) VALUES ('cat'); @@ -593,7 +593,7 @@ t1 CREATE TABLE `t1` ( `id` tinyint(4) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -607,7 +607,7 @@ t1 CREATE TABLE `t1` ( `id` smallint(6) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -621,7 +621,7 @@ t1 CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -635,7 +635,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -649,7 +649,7 @@ t1 CREATE TABLE `t1` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -663,7 +663,7 @@ t1 CREATE TABLE `t1` ( `id` float NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -677,7 +677,7 @@ t1 CREATE TABLE `t1` ( `id` double NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name diff --git a/mysql-test/main/auto_increment_ranges_innodb.test b/mysql-test/main/auto_increment_ranges_innodb.test index 92d377eb1476e..aaa64e2d6f96b 100644 --- a/mysql-test/main/auto_increment_ranges_innodb.test +++ b/mysql-test/main/auto_increment_ranges_innodb.test @@ -23,7 +23,7 @@ drop table t1; --echo # MDEV-21842: auto_increment does not increment with compound primary --echo # key on partitioned table --echo # - +--disable_service_connection create or replace table `t` ( `id` bigint(20) unsigned not null auto_increment, `a` int(10) not null , @@ -76,4 +76,4 @@ disconnect con2; --connection default select * from t; drop table t; - +--enable_service_connection diff --git a/mysql-test/main/backup_aria.test b/mysql-test/main/backup_aria.test index 7b741b829a104..7e8451ab795d7 100644 --- a/mysql-test/main/backup_aria.test +++ b/mysql-test/main/backup_aria.test @@ -8,6 +8,7 @@ # As non transactional engine we use Aria with TRANSACTIONAL = 0 --source include/have_aria.inc +--disable_service_connection # Following connections are used in a few of the following tests connect (con1,localhost,root,,); @@ -61,6 +62,7 @@ INSERT INTO t_permanent_aria SET col1 = 1; CREATE TABLE throw_away (col1 INT) ENGINE = Aria TRANSACTIONAL = 0; --error ER_BACKUP_LOCK_IS_ACTIVE RENAME TABLE t_permanent_aria To throw_away; +--disable_view_protocol --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. @@ -107,6 +109,7 @@ ALTER TABLE t_temporary_aria ADD KEY idx(col2); BACKUP STAGE END; DROP TABLE t_permanent_aria; +--enable_view_protocol --echo #----------------------------------------------------------------------- --echo # Show that non transactional tables locks with BACKUP STAGE FLUSH @@ -155,3 +158,4 @@ drop table t1; --echo # disconnect con1; +--enable_service_connection diff --git a/mysql-test/main/backup_interaction.test b/mysql-test/main/backup_interaction.test index a398a4a2d2dc6..c755bdf8f9549 100644 --- a/mysql-test/main/backup_interaction.test +++ b/mysql-test/main/backup_interaction.test @@ -50,6 +50,7 @@ unlock tables; --echo # --echo # Check lock tables under BACKUP STAGE --echo # +--disable_service_connection backup stage start; unlock tables; select lock_mode from information_schema.metadata_lock_info where thread_id>0; @@ -61,7 +62,7 @@ lock table t1 read; unlock tables; backup stage end; drop table t1; - +--enable_service_connection --echo # --echo # Check setting readonly under BACKUP STAGE @@ -118,6 +119,7 @@ drop table t1; --echo # --echo # BACKUP STAGE performs implicit commits --echo # +--disable_view_protocol create table t1(a int) engine=InnoDB; begin; insert into t1 values(1); @@ -128,12 +130,13 @@ backup stage block_commit; commit; backup stage end; drop table t1; +--enable_view_protocol --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. - +--disable_service_connection CREATE TABLE t1 (col1 INT) ENGINE = InnoDB; SET AUTOCOMMIT = 0; INSERT INTO t1 SET col1 = 1; @@ -217,7 +220,7 @@ drop table t1; --echo # CHECK: RO transaction under BACKUP STAGE is a potential deadlock --echo # OTOH we most probably allow them under FTWRL as well --echo # - +--disable_view_protocol CREATE TABLE t1 (col1 INT) ENGINE = InnoDB; insert into t1 values (1); backup stage start; @@ -228,6 +231,7 @@ select lock_mode from information_schema.metadata_lock_info where thread_id>0; backup stage end; select lock_mode from information_schema.metadata_lock_info where thread_id>0; drop table t1; +--enable_view_protocol --echo # --echo # Check that handler are closed by backup stage block_ddl @@ -347,6 +351,7 @@ SET SESSION sql_log_bin = 1; SET SESSION sql_log_bin = 0; BACKUP STAGE END; SET SESSION sql_log_bin = 1; +--enable_service_connection --echo #----------------------------------------------------------------------- --echo # BACKUP STAGE statements are not allowed in stored routines @@ -446,7 +451,7 @@ DROP TABLE t1_myisam; --echo # --echo # Creating and modifying TEMPORARY TABLES are allowed --echo # - +--disable_view_protocol BACKUP STAGE START; BACKUP STAGE BLOCK_DDL; CREATE TEMPORARY TABLE tmp (col1 INT); @@ -501,6 +506,7 @@ 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; +--enable_view_protocol # # MDEV-18067, MDEV-18068 and MDEV-18069 diff --git a/mysql-test/main/backup_lock.test b/mysql-test/main/backup_lock.test index 9fdc42b54ea40..5453e5b0e7dc6 100644 --- a/mysql-test/main/backup_lock.test +++ b/mysql-test/main/backup_lock.test @@ -5,6 +5,8 @@ --source include/have_innodb.inc --source include/have_metadata_lock_info.inc --source include/not_embedded.inc +--source include/no_view_protocol.inc + --echo # --echo # Testing which locks we get from all stages diff --git a/mysql-test/main/backup_locks.result b/mysql-test/main/backup_locks.result index 1505c39f166b2..31aed5f3cc868 100644 --- a/mysql-test/main/backup_locks.result +++ b/mysql-test/main/backup_locks.result @@ -2,19 +2,19 @@ # Test lock taken # BACKUP LOCK test.t1; -SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%"; 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; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%"; 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; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%"; 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; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%"; LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME MDL_SHARED_HIGH_PRIO Table metadata lock non_existing t1 BACKUP UNLOCK; @@ -32,13 +32,35 @@ a connection con1; drop table t1; connection default; -SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%"; 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; +# +# Check that BACKUP LOCK blocks some operations +# +create sequence seq1; +create sequence seq2; +backup lock seq1; +connection con1; +CREATE OR REPLACE SEQUENCE seq1 START -28; +ERROR HY000: Sequence 'test.seq1' has out of range value for options +SET STATEMENT max_statement_time=10 FOR CREATE OR REPLACE SEQUENCE seq1 START 50; +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +SET STATEMENT max_statement_time=10 FOR ALTER SEQUENCE IF EXISTS seq1 NOMAXVALUE; +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +SET STATEMENT max_statement_time=10 FOR ALTER SEQUENCE IF EXISTS seq1 MAXVALUE 1000; +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +SET STATEMENT max_statement_time=10 for rename table seq2 to seq3, seq3 to seq1; +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +connection default; +backup unlock; +drop table seq1,seq2; # # BACKUP LOCK and BACKUP UNLOCK are not allowed in procedures. # @@ -141,7 +163,6 @@ ERROR HY000: Can't execute the given command because you have active locked tabl SET STATEMENT max_statement_time=180 FOR BACKUP LOCK test.u; # restart # -connection con1; connection default; disconnect con1; show tables; diff --git a/mysql-test/main/backup_locks.test b/mysql-test/main/backup_locks.test index d2f3d95d703b4..2c2c226f847cb 100644 --- a/mysql-test/main/backup_locks.test +++ b/mysql-test/main/backup_locks.test @@ -5,20 +5,21 @@ --source include/have_innodb.inc --source include/have_metadata_lock_info.inc --source include/not_embedded.inc +--source include/no_view_protocol.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; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%"; BACKUP UNLOCK; -SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%"; BACKUP LOCK t1; -SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%"; BACKUP UNLOCK; BACKUP LOCK non_existing.t1; -SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%"; BACKUP UNLOCK; --echo # @@ -39,14 +40,43 @@ 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; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%"; --error ER_LOCK_DEADLOCK select * from t1; backup unlock; +connection con1; +--reap +connection default; + +--echo # +--echo # Check that BACKUP LOCK blocks some operations +--echo # + +# These test has to be done with timeouts as we want to ensure that the tables +# doesn't change + +create sequence seq1; +create sequence seq2; +backup lock seq1; +connection con1; +--error ER_SEQUENCE_INVALID_DATA +CREATE OR REPLACE SEQUENCE seq1 START -28; +--error ER_STATEMENT_TIMEOUT +SET STATEMENT max_statement_time=10 FOR CREATE OR REPLACE SEQUENCE seq1 START 50; +--error ER_STATEMENT_TIMEOUT +SET STATEMENT max_statement_time=10 FOR ALTER SEQUENCE IF EXISTS seq1 NOMAXVALUE; +--error ER_STATEMENT_TIMEOUT +SET STATEMENT max_statement_time=10 FOR ALTER SEQUENCE IF EXISTS seq1 MAXVALUE 1000; +--error ER_STATEMENT_TIMEOUT +SET STATEMENT max_statement_time=10 for rename table seq2 to seq3, seq3 to seq1; +connection default; +backup unlock; +drop table seq1,seq2; --echo # --echo # BACKUP LOCK and BACKUP UNLOCK are not allowed in procedures. --echo # + delimiter |; --error ER_SP_BADSTATEMENT CREATE PROCEDURE p_BACKUP_LOCK() @@ -162,8 +192,6 @@ SET STATEMENT max_statement_time=180 FOR BACKUP LOCK test.u; --echo # -connection con1; ---reap connection default; disconnect con1; show tables; diff --git a/mysql-test/main/backup_log.result b/mysql-test/main/backup_log.result index 94590a220d47d..cc8d098825d25 100644 --- a/mysql-test/main/backup_log.result +++ b/mysql-test/main/backup_log.result @@ -83,7 +83,7 @@ Table Create Table t42 CREATE TABLE `t42` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t40, t41, t42; # # Testing rename diff --git a/mysql-test/main/backup_priv.test b/mysql-test/main/backup_priv.test index 93b69af0b678a..c77075c239356 100644 --- a/mysql-test/main/backup_priv.test +++ b/mysql-test/main/backup_priv.test @@ -5,6 +5,7 @@ --echo # --echo # Test privileges for BACKUP STAGES --echo # +--disable_service_connection set sql_mode=""; @@ -50,3 +51,5 @@ DROP USER user1@localhost, user2@localhost; --error ER_SP_BADSTATEMENT create procedure foo42() BACKUP STAGE START; + +--enable_service_connection diff --git a/mysql-test/main/bad_frm_crash_5029.result b/mysql-test/main/bad_frm_crash_5029.result index 8aa0065f5ee4c..fdb42c2f528c9 100644 --- a/mysql-test/main/bad_frm_crash_5029.result +++ b/mysql-test/main/bad_frm_crash_5029.result @@ -9,5 +9,5 @@ t1 CREATE TABLE `t1` ( `c` int(11) DEFAULT NULL, KEY `a` (`a`), KEY `b` (`b`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 drop table t1; diff --git a/mysql-test/main/bad_startup_options.result b/mysql-test/main/bad_startup_options.result new file mode 100644 index 0000000000000..b1eed54e17281 --- /dev/null +++ b/mysql-test/main/bad_startup_options.result @@ -0,0 +1,2 @@ +FOUND 1 /\[ERROR\] SSL error: Unable to get certificate/ in errorlog.err +# restart diff --git a/mysql-test/main/bad_startup_options.test b/mysql-test/main/bad_startup_options.test new file mode 100644 index 0000000000000..e758d7860497e --- /dev/null +++ b/mysql-test/main/bad_startup_options.test @@ -0,0 +1,22 @@ +# mysqld refuses to run as root normally. +--source include/not_as_root.inc + +--source include/not_embedded.inc +--source include/have_ssl_communication.inc + +--source include/shutdown_mysqld.inc + +# Try to start the server, with bad values for some options. +# Make sure, the starts fails, and expected message is in the error log + +--let errorlog=$MYSQL_TMP_DIR/errorlog.err +--let SEARCH_FILE=$errorlog + +# Bad ssl-cert +--error 1 +--exec $MYSQLD --defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --ssl-cert=bad --log-error=$errorlog +--let SEARCH_PATTERN=\[ERROR\] SSL error: Unable to get certificate +--source include/search_pattern_in_file.inc +--remove_file $SEARCH_FILE + +--source include/start_mysqld.inc diff --git a/mysql-test/main/bigint.result b/mysql-test/main/bigint.result index 6e0384182fe5e..d1999d869beb6 100644 --- a/mysql-test/main/bigint.result +++ b/mysql-test/main/bigint.result @@ -183,14 +183,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 select 9223372036854775809 as 'a'; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(19) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; a 9223372036854775809 diff --git a/mysql-test/main/bigint.test b/mysql-test/main/bigint.test index 68ffcd9230ec0..fc7d6a3906046 100644 --- a/mysql-test/main/bigint.test +++ b/mysql-test/main/bigint.test @@ -311,6 +311,7 @@ select cast(-19999999999999999999 as signed); # # PS protocol gives different metadata for `Max length' column +--disable_view_protocol --disable_ps_protocol --enable_metadata select -9223372036854775808; @@ -319,6 +320,7 @@ select -((9223372036854775808)); select -(-(9223372036854775808)); --disable_metadata --enable_ps_protocol +--enable_view_protocol select --9223372036854775808, ---9223372036854775808, ----9223372036854775808; select -(-9223372036854775808), -(-(-9223372036854775808)); diff --git a/mysql-test/main/binary.result b/mysql-test/main/binary.result index be87c25e9328f..76e3ba0f05495 100644 --- a/mysql-test/main/binary.result +++ b/mysql-test/main/binary.result @@ -139,7 +139,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` binary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (col1 binary(4)); insert into t1 values ('a'),('a '); diff --git a/mysql-test/main/binary.test b/mysql-test/main/binary.test index 1cc6ae07675b8..ebb3d7ba3c842 100644 --- a/mysql-test/main/binary.test +++ b/mysql-test/main/binary.test @@ -18,9 +18,12 @@ select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) f select * from t2 order by name; select concat("*",name,"*") from t2 order by 1; select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t2; +#check after fix MDEV-29601 +--disable_service_connection select name from t1 where name between '�' and '�'; select name from t2 where name between '�' and '�'; select name from t2 where name between '�' and '�'; +--enable_service_connection drop table t1,t2; diff --git a/mysql-test/main/binary_to_hex.result b/mysql-test/main/binary_to_hex.result index 51ee5fa1c62ee..0438f89332b08 100644 --- a/mysql-test/main/binary_to_hex.result +++ b/mysql-test/main/binary_to_hex.result @@ -33,7 +33,7 @@ t2 CREATE TABLE `t2` ( `id` int(11) DEFAULT NULL, `col1` binary(10) DEFAULT NULL, `col2` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t2 VALUES (1, X'AB1234', X'123ABC'), (2, X'DE1234', X'123DEF'); #Print the table contents when binary-as-hex option is off. SELECT * FROM t1; diff --git a/mysql-test/main/bool.test b/mysql-test/main/bool.test index 34c51c648d38e..d79e3e3676258 100644 --- a/mysql-test/main/bool.test +++ b/mysql-test/main/bool.test @@ -21,10 +21,12 @@ SELECT * FROM t1 where (1 AND a)=1; SELECT * FROM t1 where (1 AND a) IS NULL; # WL#638 - Behaviour of NOT does not follow SQL specification +--disable_service_connection set sql_mode='high_not_precedence'; select * from t1 where not a between 2 and 3; set sql_mode=default; select * from t1 where not a between 2 and 3; +--enable_service_connection # SQL boolean tests select a, a is false, a is true, a is unknown from t1; diff --git a/mysql-test/main/bootstrap.result b/mysql-test/main/bootstrap.result index 96aec0140933b..cfff13136d66c 100644 --- a/mysql-test/main/bootstrap.result +++ b/mysql-test/main/bootstrap.result @@ -1,15 +1,28 @@ -drop table if exists t1; +# +# test mysqld in bootstrap mode +# +# +# Check that --bootstrap reads from stdin +# # Kill the server # restart drop table t1; +# +# Check that --bootstrap of file with SQL error returns error +# # Kill the server # restart drop table t1; ERROR 42S02: Unknown table 'test.t1' +# +# Bootstrap with a large thd->net.max_packet +# # Kill the server # restart drop table t1; -End of 5.1 tests +# +# End of 5.1 tests +# # # Bug #11766306: 59393: HAVE_INNODB=YES WHEN MYSQLD # STARTED WITH --SKIP-INNODB @@ -18,20 +31,52 @@ SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb' and SUPPORT='YES'; # Kill the server +# +# MDEV-13063 Server crashes in intern_plugin_lock or assertion `plugin_ptr->ref_count == 1' fails in plugin_init +# +# +# MDEV-19349 mysql_install_db: segfault at tmp_file_prefix check +# # restart -End of 5.5 tests +# +# End of 5.5 tests +# +# +# Check that --bootstrap can install and uninstall plugins +# # Kill the server +# +# Check that installed plugins are *not* automatically loaded in --bootstrap +# # restart flush tables; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select * from mysql.plugin; name dl EXAMPLE ha_example.so truncate table mysql.plugin; # Kill the server +# +# MDEV-9969 mysql_install_db error processing ignore_db_dirs. +# +# +# MDEV-13397 MariaDB upgrade fail when using default_time_zone +# +# +# MDEV-30818 invalid ssl prevents bootstrap +# +# +# End of 10.3 tests +# +# +# MDEV-28782 mariadb-tzinfo-to-sql to work in bootstrap mode +# +# +# End of 10.6 tests +# # restart diff --git a/mysql-test/main/bootstrap.test b/mysql-test/main/bootstrap.test index d75d3154064e4..d7cc8e36d5663 100644 --- a/mysql-test/main/bootstrap.test +++ b/mysql-test/main/bootstrap.test @@ -1,17 +1,20 @@ +--echo # +--echo # test mysqld in bootstrap mode +--echo # --source include/not_embedded.inc -# -# test mysqld in bootstrap mode -# ---disable_warnings -drop table if exists t1; ---enable_warnings +--source include/have_example_plugin.inc + +--let test_bootstrap=$MYSQLTEST_VARDIR/tmp/test_bootstrap.sql +--write_file $test_bootstrap +use test; +EOF # Add the datadir to the bootstrap command let $MYSQLD_DATADIR= `select @@datadir`; -let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --loose-skip-innodb --plugin-maturity=unknown; -# -# Check that --bootstrap reads from stdin -# +let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --tmpdir=$MYSQL_TMP_DIR --default-storage-engine=MyISAM --loose-skip-innodb --plugin-maturity=unknown; +--echo # +--echo # Check that --bootstrap reads from stdin +--echo # --write_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql use test; CREATE TABLE t1(a int); @@ -21,9 +24,9 @@ EOF --source include/start_mysqld.inc drop table t1; remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql; -# -# Check that --bootstrap of file with SQL error returns error -# +--echo # +--echo # Check that --bootstrap of file with SQL error returns error +--echo # --write_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql use test; CREATE TABLE t1; @@ -37,9 +40,9 @@ EOF drop table t1; remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql; -# -# Bootstrap with a large thd->net.max_packet -# +--echo # +--echo # Bootstrap with a large thd->net.max_packet +--echo # --disable_query_log create table t1 select 2 as a, concat(repeat('MySQL', @@max_allowed_packet/10), ';') as b; eval select * into outfile '$MYSQLTEST_VARDIR/tmp/long_query.sql' from t1; @@ -51,7 +54,9 @@ remove_file $MYSQLTEST_VARDIR/tmp/long_query.sql; --source include/start_mysqld.inc drop table t1; ---echo End of 5.1 tests +--echo # +--echo # End of 5.1 tests +--echo # --echo # --echo # Bug #11766306: 59393: HAVE_INNODB=YES WHEN MYSQLD @@ -63,29 +68,25 @@ SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb' and SUPPORT='YES'; --source include/kill_mysqld.inc -# -# MDEV-13063 Server crashes in intern_plugin_lock or assertion `plugin_ptr->ref_count == 1' fails in plugin_init -# +--echo # +--echo # MDEV-13063 Server crashes in intern_plugin_lock or assertion `plugin_ptr->ref_count == 1' fails in plugin_init +--echo # --error 1 --exec $MYSQLD_BOOTSTRAP_CMD --myisam_recover_options=NONE -# -# MDEV-19349 mysql_install_db: segfault at tmp_file_prefix check -# ---write_file $MYSQLTEST_VARDIR/tmp/1 -use test; -EOF ---exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/1 >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 ---remove_file $MYSQLTEST_VARDIR/tmp/1 +--echo # +--echo # MDEV-19349 mysql_install_db: segfault at tmp_file_prefix check +--echo # +--exec $MYSQLD_BOOTSTRAP_CMD < $test_bootstrap >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 --source include/start_mysqld.inc ---echo End of 5.5 tests +--echo # +--echo # End of 5.5 tests +--echo # ---source include/not_windows_embedded.inc ---source include/have_example_plugin.inc -# -# Check that --bootstrap can install and uninstall plugins -# +--echo # +--echo # Check that --bootstrap can install and uninstall plugins +--echo # let $PLUGIN_DIR=`select @@plugin_dir`; --source include/kill_mysqld.inc --write_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql @@ -95,9 +96,9 @@ EOF --exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$PLUGIN_DIR < $MYSQLTEST_VARDIR/tmp/install_plugin.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 --remove_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql -# -# Check that installed plugins are *not* automatically loaded in --bootstrap -# +--echo # +--echo # Check that installed plugins are *not* automatically loaded in --bootstrap +--echo # --write_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql SET SQL_MODE=""; use test; @@ -113,24 +114,51 @@ drop table t1; select * from mysql.plugin; truncate table mysql.plugin; - -# -# MDEV-9969 mysql_install_db error processing ignore_db_dirs. -# ---write_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql -use test; -EOF --source include/kill_mysqld.inc ---exec $MYSQLD_BOOTSTRAP_CMD --ignore-db-dirs='some_dir' --ignore-db-dirs='some_dir' < $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 ---remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql +--echo # +--echo # MDEV-9969 mysql_install_db error processing ignore_db_dirs. +--echo # +--exec $MYSQLD_BOOTSTRAP_CMD --ignore-db-dirs='some_dir' --ignore-db-dirs='some_dir' < $test_bootstrap >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 + +--echo # +--echo # MDEV-13397 MariaDB upgrade fail when using default_time_zone +--echo # +--exec $MYSQLD_BOOTSTRAP_CMD --default-time-zone=Europe/Moscow < $test_bootstrap >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 + +--echo # +--echo # MDEV-30818 invalid ssl prevents bootstrap +--echo # +--exec $MYSQLD_BOOTSTRAP_CMD --ssl-ca=/dev/nonexistent < $test_bootstrap >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 -# -# MDEV-13397 MariaDB upgrade fail when using default_time_zone -# ---write_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql +--echo # +--echo # End of 10.3 tests +--echo # + +--echo # +--echo # MDEV-28782 mariadb-tzinfo-to-sql to work in bootstrap mode +--echo # + +--write_file $MYSQLTEST_VARDIR/tmp/tz.sql use test; + +create table time_zone like mysql.time_zone; +create table time_zone_leap_second like mysql.time_zone_leap_second; +create table time_zone_name like mysql.time_zone_name; +create table time_zone_transition like mysql.time_zone_transition; +create table time_zone_transition_type like mysql.time_zone_transition_type; + +EOF +--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog std_data/zoneinfo/GMT GMT 2>/dev/null >> $MYSQLTEST_VARDIR/tmp/tz.sql +--append_file $MYSQLTEST_VARDIR/tmp/tz.sql +DROP TABLE time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type; EOF ---exec $MYSQLD_BOOTSTRAP_CMD --default-time-zone=Europe/Moscow < $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 ---remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql +--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/tz.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 +--remove_file $MYSQLTEST_VARDIR/tmp/tz.sql + +--echo # +--echo # End of 10.6 tests +--echo # +# restore --source include/start_mysqld.inc +--remove_file $test_bootstrap diff --git a/mysql-test/main/bootstrap_innodb.test b/mysql-test/main/bootstrap_innodb.test index ddaefb32155aa..eb3d09c0e74ed 100644 --- a/mysql-test/main/bootstrap_innodb.test +++ b/mysql-test/main/bootstrap_innodb.test @@ -19,7 +19,7 @@ rollback to savepoint s1; insert t1 values (5); commit; EOF -exec $MYSQLD_BOOTSTRAP_CMD --datadir=$datadir --innodb < $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1; +exec $MYSQLD_BOOTSTRAP_CMD --datadir=$datadir --tmpdir=$MYSQL_TMP_DIR --innodb < $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1; remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql; source include/start_mysqld.inc; diff --git a/mysql-test/main/brackets.result b/mysql-test/main/brackets.result index 88707cfb5df40..3fd19ef968a10 100644 --- a/mysql-test/main/brackets.result +++ b/mysql-test/main/brackets.result @@ -4163,7 +4163,7 @@ create view v1 as (select * from t2 order by a limit 2) order by b desc; 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 `__3`.`a` AS `a`,`__3`.`b` AS `b` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` order by `test`.`t2`.`a` limit 2) `__3` order by `__3`.`b` desc latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `__3`.`a` AS `a`,`__3`.`b` AS `b` from (select `t2`.`a` AS `a`,`t2`.`b` AS `b` from `t2` order by `t2`.`a` limit 2) `__3` order by `__3`.`b` desc latin1 latin1_swedish_ci select * from v1; a b 2 20 @@ -4262,7 +4262,7 @@ union select a from t1 where a=7; 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 `__5`.`a` AS `a` from (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` <= 3 except select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` >= 3) `__5` union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 7 latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `__5`.`a` AS `a` from (select `t1`.`a` AS `a` from `t1` where `t1`.`a` <= 3 except select `t1`.`a` AS `a` from `t1` where `t1`.`a` >= 3) `__5` union select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 7 latin1 latin1_swedish_ci select * from v1; a 1 @@ -4289,7 +4289,7 @@ union ( select a from t1 where a=4 ) ) ); 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 `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 union select `__7`.`a` AS `a` from (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 3 union select `__6`.`a` AS `a` from (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 union (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 4)) `__6`) `__7` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 1 union select `__7`.`a` AS `a` from (select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 3 union select `__6`.`a` AS `a` from (select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 2 union (select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 4)) `__6`) `__7` latin1 latin1_swedish_ci select * from v1; a 1 @@ -4307,7 +4307,7 @@ union select a from t1 where a=1; 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 `__7`.`a` AS `a` from (select `__5`.`a` AS `a` from (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` >= 2 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 order by `a` desc limit 2) `__5` union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 3 order by `a` limit 2) `__7` union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `__7`.`a` AS `a` from (select `__5`.`a` AS `a` from (select `t1`.`a` AS `a` from `t1` where `t1`.`a` >= 2 union select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 1 order by `a` desc limit 2) `__5` union select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 3 order by `a` limit 2) `__7` union select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 1 latin1 latin1_swedish_ci select * from v1; a 3 @@ -4416,7 +4416,7 @@ union select a from t1 where a=2 order by a desc limit 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 `__5`.`a` AS `a` from (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 union values (3),(4),(2) order by 1 desc) `__5` union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 order by `a` desc limit 3 latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `__5`.`a` AS `a` from (select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 1 union values (3),(4),(2) order by 1 desc) `__5` union select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 2 order by `a` desc limit 3 latin1 latin1_swedish_ci select * from v1; a 4 @@ -4429,7 +4429,7 @@ with t as (select * from t1 where a <=3) select * from t; 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 with t as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` <= 3)select `t`.`a` AS `a` from `t` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `t1`.`a` AS `a` from `t1` where `t1`.`a` <= 3)select `t`.`a` AS `a` from `t` latin1 latin1_swedish_ci select * from v1; a 3 @@ -4445,7 +4445,7 @@ order by a desc limit 3 ) select a from t1 where a=4 union select a from t where a=7; 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 with t as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 3 order by `a` desc limit 3)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 4 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `t1`.`a` AS `a` from `t1` where `t1`.`a` < 3 union select `t1`.`a` AS `a` from `t1` where `t1`.`a` > 3 order by `a` desc limit 3)select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 4 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 latin1 latin1_swedish_ci select * from v1; a 4 @@ -4461,7 +4461,7 @@ order by a desc limit 3 ) (select a from t1 where a=4 union select a from t where a=7 order by a desc); 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 with t as ((select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3) union (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 3) order by `a` desc limit 3)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 4 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as ((select `t1`.`a` AS `a` from `t1` where `t1`.`a` < 3) union (select `t1`.`a` AS `a` from `t1` where `t1`.`a` > 3) order by `a` desc limit 3)select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 4 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci select * from v1; a 7 @@ -4476,7 +4476,7 @@ order by a desc limit 3 ) (select a from t where a=4 union select a from t where a=7 order by a desc); 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 with t as ((select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3) union (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 3) order by `a` desc limit 3)select `t`.`a` AS `a` from `t` where `t`.`a` = 4 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as ((select `t1`.`a` AS `a` from `t1` where `t1`.`a` < 3) union (select `t1`.`a` AS `a` from `t1` where `t1`.`a` > 3) order by `a` desc limit 3)select `t`.`a` AS `a` from `t` where `t`.`a` = 4 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci select * from v1; a 7 @@ -4501,7 +4501,7 @@ order by 1 desc limit 3 ) select a from t1 where a=4 union select a from t where a=7 order by a desc; 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 with t(`a`) as (values (2),(1) union (values (4),(7)) order by 1 desc limit 3)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 4 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t(`a`) as (values (2),(1) union (values (4),(7)) order by 1 desc limit 3)select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 4 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci select * from v1; a 7 @@ -4516,7 +4516,7 @@ order by 1 desc limit 3 ) select a from t1 where a=1 union select a from t where a=7 order by a desc; 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 with t(`a`) as ((values (2),(1)) union (values (4),(7) order by 1 desc) order by 1 desc limit 3)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t(`a`) as ((values (2),(1)) union (values (4),(7) order by 1 desc) order by 1 desc limit 3)select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 1 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci select * from v1; a 7 @@ -4528,7 +4528,7 @@ s as (select * from t1 where a > 3) select a from t where a=1 union select a from s where a=7 order by a desc; 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 with t as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3), s as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 3)select `t`.`a` AS `a` from `t` where `t`.`a` = 1 union select `s`.`a` AS `a` from `s` where `s`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `t1`.`a` AS `a` from `t1` where `t1`.`a` < 3), s as (select `t1`.`a` AS `a` from `t1` where `t1`.`a` > 3)select `t`.`a` AS `a` from `t` where `t`.`a` = 1 union select `s`.`a` AS `a` from `s` where `s`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci select * from v1; a 7 @@ -4540,7 +4540,7 @@ s as (select * from t where a > 3) select a from t where a=1 union select a from s where a=7 order by a desc; 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 with t as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3), s as (select `t`.`a` AS `a` from `t` where `t`.`a` > 3)select `t`.`a` AS `a` from `t` where `t`.`a` = 1 union select `s`.`a` AS `a` from `s` where `s`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `t1`.`a` AS `a` from `t1` where `t1`.`a` < 3), s as (select `t`.`a` AS `a` from `t` where `t`.`a` > 3)select `t`.`a` AS `a` from `t` where `t`.`a` = 1 union select `s`.`a` AS `a` from `s` where `s`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci select * from v1; a 1 diff --git a/mysql-test/main/brackets.test b/mysql-test/main/brackets.test index b7bb616bd05c8..9a0c204e2712c 100644 --- a/mysql-test/main/brackets.test +++ b/mysql-test/main/brackets.test @@ -2246,6 +2246,8 @@ drop view v1; --echo 10.2. view as tailed simple select +#enable after fix MDEV-29554 +--disable_view_protocol create view v1 as select * from t1 order by a; show create view v1; @@ -2257,6 +2259,7 @@ create view v1 as show create view v1; select * from v1; drop view v1; +--enable_view_protocol --echo 10.3. view as union diff --git a/mysql-test/main/bug46760.result b/mysql-test/main/bug46760.result index f05d6c5ef9964..d9c13c2cd7d52 100644 --- a/mysql-test/main/bug46760.result +++ b/mysql-test/main/bug46760.result @@ -19,7 +19,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT 10 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MySQL Bug#39200: optimize table does not recognize @@ -30,7 +30,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status Table is already up to date @@ -38,6 +38,6 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/main/bug47671.test b/mysql-test/main/bug47671.test index c3f66a9f50237..db8d64c6f60f6 100644 --- a/mysql-test/main/bug47671.test +++ b/mysql-test/main/bug47671.test @@ -5,5 +5,5 @@ --echo # Bug#47671 - wrong character-set after upgrade from 5.1.34 to 5.1.39 --echo # --echo # Extract only charset information from 'status' command output using regex ---replace_regex /.*mysql.*// /Connection.*// /Current.*// /SSL.*// /Using.*// /Server version.*// /Protocol.*// /UNIX.*// /Uptime.*// /Threads.*// /TCP.*// +--replace_regex /.*mariadb.*// /Connection.*// /Current.*// /SSL.*// /Using.*// /Server version.*// /Protocol.*// /UNIX.*// /Uptime.*// /Threads.*// /TCP.*// --exec $MYSQL -e "status"; diff --git a/mysql-test/main/cache_innodb.test b/mysql-test/main/cache_innodb.test index f71026275065d..efd877dda24ae 100644 --- a/mysql-test/main/cache_innodb.test +++ b/mysql-test/main/cache_innodb.test @@ -19,6 +19,7 @@ let $test_foreign_keys= 1; # Bug#56452 Assertion failed: thd->transaction.stmt.is_empty() || # thd->in_sub_stmt # +--disable_view_protocol CREATE TABLE t1 (a INT) ENGINE=InnoDB; BEGIN; INSERT INTO t1 VALUES(1); @@ -28,4 +29,4 @@ ROLLBACK WORK AND CHAIN NO RELEASE; SELECT a FROM t1; ROLLBACK; DROP TABLE t1; - +--enable_view_protocol diff --git a/mysql-test/main/cache_temporal_4265.result b/mysql-test/main/cache_temporal_4265.result index 1cda7004a6fea..5c648c8de53ec 100644 --- a/mysql-test/main/cache_temporal_4265.result +++ b/mysql-test/main/cache_temporal_4265.result @@ -20,3 +20,21 @@ select (select max(m2.ut) from t1 m2 where m1.id <> 0) from t1 m1; 2001-01-01 00:00:00.200000 2001-01-01 00:00:00.200000 drop table t1; +# +# MDEV-30345 DML does not find rows it is supposed to +# +CREATE TABLE t1 (f timestamp); +INSERT INTO t1 VALUES ('2022-01-01 00:00:00'),('2022-12-12 12:12:12'); +CREATE TABLE t2 (f timestamp); +INSERT INTO t2 VALUES ('2022-01-01 00:00:00'),('2022-12-12 12:12:12'); +SELECT * FROM t2 WHERE f IN ( SELECT f FROM t1 ) ; +f +2022-01-01 00:00:00 +2022-12-12 12:12:12 +DELETE FROM t2 WHERE f IN ( SELECT f FROM t1 ) ; +SELECT * FROM t2 WHERE f IN ( SELECT f FROM t1 ) ; +f +DROP TABLE t1,t2; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/cache_temporal_4265.test b/mysql-test/main/cache_temporal_4265.test index 1af683c617b83..1dfd57b0c8da9 100644 --- a/mysql-test/main/cache_temporal_4265.test +++ b/mysql-test/main/cache_temporal_4265.test @@ -20,3 +20,21 @@ select * from t1; select (select max(m2.ut) from t1 m2 where m1.id <> 0) from t1 m1; drop table t1; +--echo # +--echo # MDEV-30345 DML does not find rows it is supposed to +--echo # + +CREATE TABLE t1 (f timestamp); +INSERT INTO t1 VALUES ('2022-01-01 00:00:00'),('2022-12-12 12:12:12'); + +CREATE TABLE t2 (f timestamp); +INSERT INTO t2 VALUES ('2022-01-01 00:00:00'),('2022-12-12 12:12:12'); + +SELECT * FROM t2 WHERE f IN ( SELECT f FROM t1 ) ; +DELETE FROM t2 WHERE f IN ( SELECT f FROM t1 ) ; +SELECT * FROM t2 WHERE f IN ( SELECT f FROM t1 ) ; +DROP TABLE t1,t2; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/case.result b/mysql-test/main/case.result index f4f02703c5e58..139267a103c44 100644 --- a/mysql-test/main/case.result +++ b/mysql-test/main/case.result @@ -119,7 +119,7 @@ t1 CREATE TABLE `t1` ( `c10` double NOT NULL, `c11` double NOT NULL, `c12` varchar(5) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SELECT CASE WHEN 1 @@ -166,7 +166,7 @@ t1 CREATE TABLE `t1` ( `COALESCE(1,'1')` varchar(1) NOT NULL, `COALESCE(1.1,'1')` varchar(4) NOT NULL, `COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 SELECT IFNULL('a' COLLATE latin1_swedish_ci, 'b' COLLATE latin1_bin); ERROR HY000: Illegal mix of collations (latin1_swedish_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'ifnull' diff --git a/mysql-test/main/case.test b/mysql-test/main/case.test index 78d5b3a595181..b80408f44d637 100644 --- a/mysql-test/main/case.test +++ b/mysql-test/main/case.test @@ -2,6 +2,9 @@ # Testing of CASE # +#remove this include after fix MDEV-27871 +--source include/no_view_protocol.inc + --disable_warnings drop table if exists t1, t2; --enable_warnings diff --git a/mysql-test/main/cast.result b/mysql-test/main/cast.result index 4e51882601706..cebfba188c7ff 100644 --- a/mysql-test/main/cast.result +++ b/mysql-test/main/cast.result @@ -408,8 +408,8 @@ create table t1 select cast(_koi8r' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t` varchar(4) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `t` varchar(4) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select cast(_latin1'ab' AS char) as c1, @@ -448,7 +448,7 @@ t1 CREATE TABLE `t1` ( `c3` varbinary(2) NOT NULL, `c4` varbinary(2) NOT NULL, `c5` varbinary(2) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select cast(_koi8r'��' AS nchar) as c1, @@ -477,12 +477,12 @@ c1 c2 c3 c4 c5 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 NOT NULL, - `c2` varchar(2) CHARACTER SET utf8mb3 NOT NULL, - `c3` varchar(2) CHARACTER SET utf8mb3 NOT NULL, - `c4` varchar(2) CHARACTER SET utf8mb3 NOT NULL, - `c5` varchar(2) CHARACTER SET utf8mb3 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `c2` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `c3` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `c4` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `c5` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a binary(4), b char(4) character set koi8r); insert into t1 values (_binary'����',_binary'����'); @@ -599,7 +599,7 @@ t1 CREATE TABLE `t1` ( `cast("2001-1-1" as DATE)` date DEFAULT NULL, `cast("2001-1-1" as DATETIME)` datetime DEFAULT NULL, `cast("1:2:3" as TIME)` time DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 (f1 double); INSERT INTO t1 SET f1 = -1.0e+30 ; @@ -766,7 +766,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `CONCAT(CAST(REPEAT('9', 1000) AS SIGNED))` varchar(21) NOT NULL, `CONCAT(CAST(REPEAT('9', 1000) AS UNSIGNED))` varchar(20) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # End of test for Bug#13581962, Bug#14096619 End of 5.1 tests @@ -815,7 +815,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` char(5) GENERATED ALWAYS AS (cast('a' as char(10) charset latin1) + `a`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select collation(cast("a" as char(10) binary)); collation(cast("a" as char(10) binary)) @@ -843,28 +843,28 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `IFNULL(CONVERT(NULL, UNSIGNED), NULL)` decimal(1,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT COALESCE(CONVERT(NULL, UNSIGNED), NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `COALESCE(CONVERT(NULL, UNSIGNED), NULL)` decimal(1,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT CASE WHEN TRUE THEN CONVERT(NULL, UNSIGNED) ELSE NULL END; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `CASE WHEN TRUE THEN CONVERT(NULL, UNSIGNED) ELSE NULL END` decimal(1,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT IFNULL(CONVERT(NULL,SIGNED),CONVERT(NULL,UNSIGNED)) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(1,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT -1, @@ -882,7 +882,7 @@ t1 CREATE TABLE `t1` ( `1` int(1) NOT NULL, `CONVERT(NULL,UNSIGNED)` int(1) unsigned DEFAULT NULL, `CONCAT(CONVERT(NULL,UNSIGNED))` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT CONVERT('',SIGNED), @@ -901,7 +901,7 @@ t1 CREATE TABLE `t1` ( `CONCAT(CONVERT('',SIGNED))` varchar(2) NOT NULL, `CONVERT('',UNSIGNED)` int(1) unsigned NOT NULL, `CONCAT(CONVERT('',UNSIGNED))` varchar(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-12849 Out-of-range errors when casting hex-hybrid to SIGNED and UNSIGNED @@ -1148,7 +1148,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `CAST(-1 AS UNSIGNED)` bigint(20) unsigned NOT NULL, `CAST(1-2 AS UNSIGNED)` bigint(20) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; CAST(-1 AS UNSIGNED) CAST(1-2 AS UNSIGNED) 18446744073709551615 18446744073709551615 @@ -1165,7 +1165,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `CAST('-1' AS UNSIGNED)` bigint(20) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; CAST('-1' AS UNSIGNED) 18446744073709551615 diff --git a/mysql-test/main/cast.test b/mysql-test/main/cast.test index a4b8712718752..025b5fa717d99 100644 --- a/mysql-test/main/cast.test +++ b/mysql-test/main/cast.test @@ -2,6 +2,10 @@ # Test of cast function # +#remove this include after fix MDEV-27871 +# discuss what to do with "set names binary" +--source include/no_view_protocol.inc + # For TIME->DATETIME conversion SET timestamp=unix_timestamp('2001-02-03 10:20:30'); diff --git a/mysql-test/main/change_user.test b/mysql-test/main/change_user.test index d191b1c3ca044..4073b79a9c6b3 100644 --- a/mysql-test/main/change_user.test +++ b/mysql-test/main/change_user.test @@ -1,4 +1,5 @@ # This test is checking that old password authentication works +--disable_service_connection set global secure_auth=0; # # functional change user tests @@ -149,3 +150,4 @@ select year(now()) > 2011; --echo change_user --change_user select year(now()) > 2011; +--enable_service_connection diff --git a/mysql-test/main/charset_client_win.test b/mysql-test/main/charset_client_win.test index c3f649cb7d4c2..8f3767c530f01 100644 --- a/mysql-test/main/charset_client_win.test +++ b/mysql-test/main/charset_client_win.test @@ -1,3 +1,7 @@ --source include/windows.inc --source include/no_utf8_cli.inc +if(!`select $MTR_PARALLEL = 1`) +{ + skip race condition with parallel builds; +} --exec chcp 1257 > NUL && $MYSQL --default-character-set=auto -e "select @@character_set_client" diff --git a/mysql-test/main/check.result b/mysql-test/main/check.result index 11ed734da0c12..d58c5044031f7 100644 --- a/mysql-test/main/check.result +++ b/mysql-test/main/check.result @@ -75,7 +75,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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; @@ -83,7 +83,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; create temporary table t1 ( id int not null auto_increment primary key, diff --git a/mysql-test/main/check_constraint.result b/mysql-test/main/check_constraint.result index f851b99e5c165..01a71bf36a525 100644 --- a/mysql-test/main/check_constraint.result +++ b/mysql-test/main/check_constraint.result @@ -7,7 +7,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL CHECK (`b` > 20), CONSTRAINT `min` CHECK (`a` + `b` > 100), CONSTRAINT `max` CHECK (`a` + `b` < 500) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (100,100); insert into t1 values (1,1); ERROR 23000: CONSTRAINT `t1.a` failed for `test`.`t1` @@ -58,7 +58,7 @@ t1 CREATE TABLE `t1` ( CONSTRAINT `min` CHECK (`a` + `b` > 100), CONSTRAINT `max` CHECK (`a` + `b` < 500), CONSTRAINT `CONSTRAINT_1` CHECK (`a` + `b` + `c` < 500) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values(105,105,105); ERROR 23000: CONSTRAINT `t1.c` failed for `test`.`t1` insert into t1 values(249,249,9); @@ -81,7 +81,7 @@ t2 CREATE TABLE `t2` ( CONSTRAINT `min` CHECK (`a` + `b` > 100), CONSTRAINT `max` CHECK (`a` + `b` < 500), CONSTRAINT `CONSTRAINT_1` CHECK (`a` + `b` + `c` < 500) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t2 drop constraint c; ERROR 42000: Can't DROP CONSTRAINT `c`; check that it exists alter table t2 drop constraint if exists c; @@ -96,7 +96,7 @@ t2 CREATE TABLE `t2` ( `c` int(11) DEFAULT 0 CHECK (`c` < 10), CONSTRAINT `max` CHECK (`a` + `b` < 500), CONSTRAINT `CONSTRAINT_1` CHECK (`a` + `b` + `c` < 500) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1,t2; create or replace table t1 (a int, b int, constraint check (a>b)); show create table t1; @@ -105,7 +105,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, CONSTRAINT `CONSTRAINT_1` CHECK (`a` > `b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 (a int, b int, constraint CONSTRAINT_1 check (a>1), constraint check (b>1)); @@ -116,7 +116,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, CONSTRAINT `CONSTRAINT_1` CHECK (`a` > 1), CONSTRAINT `CONSTRAINT_2` CHECK (`b` > 1) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 (a int, b int, constraint CONSTRAINT_1 check (a>1), constraint check (b>1), @@ -129,7 +129,7 @@ t1 CREATE TABLE `t1` ( CONSTRAINT `CONSTRAINT_1` CHECK (`a` > 1), CONSTRAINT `CONSTRAINT_3` CHECK (`b` > 1), CONSTRAINT `CONSTRAINT_2` CHECK (`a` > `b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(c1 int, c2 int as (c1 + 1), check (c2 > 2)); insert into t1(c1) values(1); @@ -161,32 +161,32 @@ EmployeeID SMALLINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, FirstName VARCHAR(30) NOT NULL CHECK (CHAR_LENGTH(FirstName > 2)) ); INSERT INTO t1 VALUES (NULL, 'Ken'); -ERROR 22007: Truncated incorrect DOUBLE value: 'Ken' +ERROR 22007: Truncated incorrect DECIMAL value: 'Ken' SHOW WARNINGS; Level Code Message -Error 1292 Truncated incorrect DOUBLE value: 'Ken' +Error 1292 Truncated incorrect DECIMAL value: 'Ken' Error 4025 CONSTRAINT `t1.FirstName` failed for `test`.`t1` INSERT INTO t1 VALUES (NULL, 'Ken'),(NULL, 'Brian'); -ERROR 22007: Truncated incorrect DOUBLE value: 'Ken' +ERROR 22007: Truncated incorrect DECIMAL value: 'Ken' SHOW WARNINGS; Level Code Message -Error 1292 Truncated incorrect DOUBLE value: 'Ken' +Error 1292 Truncated incorrect DECIMAL value: 'Ken' Error 4025 CONSTRAINT `t1.FirstName` failed for `test`.`t1` INSERT IGNORE INTO t1 VALUES (NULL, 'Ken'); Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'Ken' +Warning 1292 Truncated incorrect DECIMAL value: 'Ken' INSERT IGNORE INTO t1 VALUES (NULL, 'Ken'),(NULL, 'Brian'); Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'Ken' -Warning 1292 Truncated incorrect DOUBLE value: 'Brian' +Warning 1292 Truncated incorrect DECIMAL value: 'Ken' +Warning 1292 Truncated incorrect DECIMAL value: 'Brian' set sql_mode=""; INSERT INTO t1 VALUES (NULL, 'Ken'); Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'Ken' +Warning 1292 Truncated incorrect DECIMAL value: 'Ken' INSERT INTO t1 VALUES (NULL, 'Ken'),(NULL, 'Brian'); Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'Ken' -Warning 1292 Truncated incorrect DOUBLE value: 'Brian' +Warning 1292 Truncated incorrect DECIMAL value: 'Ken' +Warning 1292 Truncated incorrect DECIMAL value: 'Brian' set sql_mode=default; select * from t1; EmployeeID FirstName @@ -214,7 +214,7 @@ t CREATE TABLE `t` ( CONSTRAINT `b` CHECK (`a` < `b`), CONSTRAINT `a` CHECK (`a` > 0), CONSTRAINT `x` CHECK (`a` > 10) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Field constraint 'b' will fail insert into t values (-1, 0); ERROR 23000: CONSTRAINT `t.b` failed for `test`.`t` @@ -236,6 +236,66 @@ insert t1 (b) values (1); ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1` drop table t1; # +# MDEV-25638 Assertion `!result' failed in convert_const_to_int +# +create table t1 (v1 bigint check (v1 not in ('x' , 'x111'))) ; +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'x111' +select * from t1; +v1 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'x111' +select v1 from t1; +v1 +select * from t1; +v1 +prepare stmt from "select * from t1"; +execute stmt; +v1 +execute stmt; +v1 +flush tables; +select * from t1; +v1 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'x111' +select * from t1; +v1 +deallocate prepare stmt; +drop table t1; +# +# MDEV-26061 MariaDB server crash at Field::set_default +# +create table t1 (v2 date check (v1 like default (v1)), v1 date default (from_days ('x'))); +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'x' +insert ignore into t1 values ( 'x' , 'x' ) ; +Warnings: +Warning 1265 Data truncated for column 'v2' at row 1 +Warning 1265 Data truncated for column 'v1' at row 1 +Warning 1292 Truncated incorrect INTEGER value: 'x' +drop table t1; +# +# End of 10.2 tests +# +# +# MDEV-26061 MariaDB server crash at Field::set_default +# +create table t1 (d timestamp check (default (d) is true)) as select 1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() CHECK (default(`d`) is true), + `1` int(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +# +# End of 10.3 tests +# +# # MDEV-24274 ALTER TABLE with CHECK CONSTRAINTS gives "Out of Memory" error # create table t1 (id varchar(2), constraint id check (id regexp '[a-z]')); @@ -245,5 +305,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` varchar(2) DEFAULT NULL, CONSTRAINT `id` CHECK (`id` regexp '[a-z]') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/check_constraint.test b/mysql-test/main/check_constraint.test index 1258a9e3be69d..194fdc0439988 100644 --- a/mysql-test/main/check_constraint.test +++ b/mysql-test/main/check_constraint.test @@ -177,6 +177,49 @@ select * from t1 where a is null; insert t1 (b) values (1); drop table t1; +--echo # +--echo # MDEV-25638 Assertion `!result' failed in convert_const_to_int +--echo # + +--enable_prepare_warnings +create table t1 (v1 bigint check (v1 not in ('x' , 'x111'))) ; +select * from t1; +select v1 from t1; +select * from t1; +prepare stmt from "select * from t1"; +execute stmt; +execute stmt; +flush tables; +select * from t1; +select * from t1; +deallocate prepare stmt; +drop table t1; +--disable_prepare_warnings + +--echo # +--echo # MDEV-26061 MariaDB server crash at Field::set_default +--echo # + +create table t1 (v2 date check (v1 like default (v1)), v1 date default (from_days ('x'))); +insert ignore into t1 values ( 'x' , 'x' ) ; +drop table t1; + +--echo # +--echo # End of 10.2 tests +--echo # + +--echo # +--echo # MDEV-26061 MariaDB server crash at Field::set_default +--echo # + +create table t1 (d timestamp check (default (d) is true)) as select 1; +show create table t1; +drop table t1; + +--echo # +--echo # End of 10.3 tests +--echo # + --echo # --echo # MDEV-24274 ALTER TABLE with CHECK CONSTRAINTS gives "Out of Memory" error --echo # @@ -184,3 +227,7 @@ create table t1 (id varchar(2), constraint id check (id regexp '[a-z]')); alter table t1 force; show create table t1; drop table t1; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/check_constraint_show.result b/mysql-test/main/check_constraint_show.result index def1c48875801..2691beb1a97ba 100644 --- a/mysql-test/main/check_constraint_show.result +++ b/mysql-test/main/check_constraint_show.result @@ -7,7 +7,7 @@ t1 CREATE TABLE `t1` ( `c3` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), CONSTRAINT `range` CHECK (`c3` >= `c1` and `c3` <= `c2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from information_schema.table_constraints where table_name = 't1'; CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE def test PRIMARY test t1 PRIMARY KEY diff --git a/mysql-test/main/check_view_protocol.result b/mysql-test/main/check_view_protocol.result new file mode 100644 index 0000000000000..697bc759498a2 --- /dev/null +++ b/mysql-test/main/check_view_protocol.result @@ -0,0 +1,19 @@ +flush status; +create table t1 (a int); +insert into t1 (a) values (1); +create table t2 (b int); +insert into t2 (b) values (2); +select * from t1; +a +1 +show status like 'Opened_views'; +Variable_name Value +Opened_views 1 +flush status; +select * from t2; +b +2 +show status like 'Opened_views'; +Variable_name Value +Opened_views 0 +drop table t1, t2; diff --git a/mysql-test/main/check_view_protocol.test b/mysql-test/main/check_view_protocol.test new file mode 100644 index 0000000000000..c4d5670669c54 --- /dev/null +++ b/mysql-test/main/check_view_protocol.test @@ -0,0 +1,21 @@ +-- source include/have_view_protocol.inc + +flush status; + +create table t1 (a int); +insert into t1 (a) values (1); +create table t2 (b int); +insert into t2 (b) values (2); +select * from t1; +show status like 'Opened_views'; + +flush status; +--disable_view_protocol +select * from t2; +--enable_view_protocol + +show status like 'Opened_views'; + +drop table t1, t2; + + diff --git a/mysql-test/main/cli_options_force_protocol_not_win.result b/mysql-test/main/cli_options_force_protocol_not_win.result index 20b12eb2cc06d..46ee29dc50935 100644 --- a/mysql-test/main/cli_options_force_protocol_not_win.result +++ b/mysql-test/main/cli_options_force_protocol_not_win.result @@ -4,21 +4,19 @@ # # The following group of tests should produce no warnings # -# exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:\|WARNING:" +# exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:" Connection: Localhost via UNIX socket -# exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:\|WARNING:" +# exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:" Connection: localhost via TCP/IP -# exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:\|WARNING:" +# exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:" Connection: Localhost via UNIX socket -# exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:" +# exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:" Connection: 127.0.0.1 via TCP/IP -# exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:" +# exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:" +Connection: localhost via TCP/IP +# exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:" Connection: Localhost via UNIX socket -# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:\|WARNING:" +# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:" Connection: Localhost via UNIX socket -# -# The remaining tests should produce warnings -# -# exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:" -WARNING: Forcing protocol to TCP due to option specification. Please explicitly state intended protocol. +# exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:" Connection: localhost via TCP/IP diff --git a/mysql-test/main/cli_options_force_protocol_not_win.test b/mysql-test/main/cli_options_force_protocol_not_win.test index a3c495f26ee89..a92f6b93c4d95 100644 --- a/mysql-test/main/cli_options_force_protocol_not_win.test +++ b/mysql-test/main/cli_options_force_protocol_not_win.test @@ -10,28 +10,26 @@ --echo # The following group of tests should produce no warnings --echo # ---echo # exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:\|WARNING:" ---exec $MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:\|WARNING:" +--echo # exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:" +--exec $MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:" ---echo # exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:\|WARNING:" ---exec $MYSQL --port=$MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:\|WARNING:" +--echo # exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:" +--exec $MYSQL --port=$MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:" ---echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:\|WARNING:" ---exec $MYSQL --host=localhost --port=$MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:\|WARNING:" +--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:" +--exec $MYSQL --host=localhost --port=$MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:" ---echo # exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:" ---exec $MYSQL --host=127.0.0.1 --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:" +--echo # exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:" +--exec $MYSQL --host=127.0.0.1 --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:" ---echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:" ---exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:" +--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:" +--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:" ---echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:\|WARNING:" ---exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:\|WARNING:" +--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:" +--exec $MYSQL --host=localhost --port=MASTER_MYPORT --socket=$MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:" +--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:" +--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:" ---echo # ---echo # The remaining tests should produce warnings ---echo # - ---echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:" ---exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:" +--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:" +--exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:" diff --git a/mysql-test/main/cli_options_force_protocol_win.result b/mysql-test/main/cli_options_force_protocol_win.result index 4fffc2a483734..eedfde4f1def1 100644 --- a/mysql-test/main/cli_options_force_protocol_win.result +++ b/mysql-test/main/cli_options_force_protocol_win.result @@ -1,24 +1,17 @@ # # MDEV-14974: --port ignored for --host=localhost # -# -# The following group of tests should produce no warnings -# -# exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" +# exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" Connection: localhost via TCP/IP -# exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" +# exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" Connection: localhost via TCP/IP -# exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" +# exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" Connection: localhost via TCP/IP -# exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" -Connection: localhost via named pipe -# exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" -Connection: localhost via named pipe -# exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" +# exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" Connection: localhost via named pipe -# -# The remaining tests should produce warnings -# -# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" -WARNING: Forcing protocol to PIPE due to option specification. Please explicitly state intended protocol. +# exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" Connection: localhost via named pipe +# exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" +Connection: localhost via TCP/IP +# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" +Connection: localhost via TCP/IP diff --git a/mysql-test/main/cli_options_force_protocol_win.test b/mysql-test/main/cli_options_force_protocol_win.test index 54fbb78e5dc8e..63024f3b620c7 100644 --- a/mysql-test/main/cli_options_force_protocol_win.test +++ b/mysql-test/main/cli_options_force_protocol_win.test @@ -5,33 +5,23 @@ --source include/not_embedded.inc --source include/windows.inc +--echo # exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" +--exec $MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" ---echo # ---echo # The following group of tests should produce no warnings ---echo # - ---echo # exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" ---exec $MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" - ---echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" ---exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" +--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" +--exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" ---echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" ---exec $MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" +--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" +--exec $MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" ---echo # exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" ---exec $MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" +--echo # exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" +--exec $MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" ---echo # exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" ---exec $MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" +--echo # exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" +--exec $MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" ---echo # exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" ---exec $MYSQL --host=localhost -W --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" - - ---echo # ---echo # The remaining tests should produce warnings ---echo # +--echo # exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" +--exec $MYSQL --host=localhost -W --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" ---echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" ---exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" +--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" +--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" diff --git a/mysql-test/main/client_xml.test b/mysql-test/main/client_xml.test index 5230922e4b8bd..d39659a33357c 100644 --- a/mysql-test/main/client_xml.test +++ b/mysql-test/main/client_xml.test @@ -1,5 +1,6 @@ # Can't run with embedded server -- source include/not_embedded.inc +-- source include/no_view_protocol.inc # Disable concurrent inserts to avoid test failures when reading # data from concurrent connections (insert might return before diff --git a/mysql-test/main/column_compression.result b/mysql-test/main/column_compression.result index 88e558c4d3338..6e9722a661b93 100644 --- a/mysql-test/main/column_compression.result +++ b/mysql-test/main/column_compression.result @@ -9,7 +9,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Make sure column was actually compressed INSERT INTO t1 VALUES(REPEAT('a', 1000)); SELECT LEFT(a, 10), LENGTH(a) FROM t1; @@ -28,7 +28,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -45,7 +45,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -62,7 +62,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; # Make sure implicit CREATE TABLE ... SELECT inherits compression CREATE TABLE t2 SELECT * FROM t1; @@ -70,7 +70,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t2; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -88,7 +88,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t2; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -106,7 +106,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -224,7 +224,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Make sure column was actually compressed INSERT INTO t1 VALUES(REPEAT('a', 1000)); SELECT LEFT(a, 10), LENGTH(a) FROM t1; @@ -243,7 +243,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -260,7 +260,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -277,7 +277,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` text /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; # Make sure implicit CREATE TABLE ... SELECT inherits compression CREATE TABLE t2 SELECT * FROM t1; @@ -285,7 +285,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` text /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t2; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -303,7 +303,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t2; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -321,7 +321,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -439,7 +439,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(10000) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Make sure column was actually compressed INSERT INTO t1 VALUES(REPEAT('a', 1000)); SELECT LEFT(a, 10), LENGTH(a) FROM t1; @@ -458,7 +458,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(10000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -475,7 +475,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(10000) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -492,7 +492,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` varbinary(10000) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; # Make sure implicit CREATE TABLE ... SELECT inherits compression CREATE TABLE t2 SELECT * FROM t1; @@ -500,7 +500,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` varbinary(10000) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t2; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -518,7 +518,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` varbinary(10000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t2; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -536,7 +536,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(10000) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -654,7 +654,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10000) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Make sure column was actually compressed INSERT INTO t1 VALUES(REPEAT('a', 1000)); SELECT LEFT(a, 10), LENGTH(a) FROM t1; @@ -673,7 +673,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -690,7 +690,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10000) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -707,7 +707,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(10000) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; # Make sure implicit CREATE TABLE ... SELECT inherits compression CREATE TABLE t2 SELECT * FROM t1; @@ -715,7 +715,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(10000) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t2; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -733,7 +733,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(10000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t2; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -751,7 +751,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10000) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -868,8 +868,8 @@ ERROR HY000: Compressed column 'a' can't be used in key specification SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` text /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` text /*!100301 COMPRESSED*/ CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Make sure column was actually compressed INSERT INTO t1 VALUES(REPEAT('a', 1000)); SELECT LEFT(a, 10), LENGTH(a) FROM t1; @@ -888,7 +888,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -904,8 +904,8 @@ ALTER TABLE t1 MODIFY COLUMN a TEXT COMPRESSED CHARSET ucs2; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` text /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` text /*!100301 COMPRESSED*/ CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 2000 @@ -921,16 +921,16 @@ CREATE TABLE t2 LIKE t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` text /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` text /*!100301 COMPRESSED*/ CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; # Make sure implicit CREATE TABLE ... SELECT inherits compression CREATE TABLE t2 SELECT * FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` text /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` text /*!100301 COMPRESSED*/ CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t2; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 2000 @@ -948,7 +948,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t2; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -965,8 +965,8 @@ ALTER TABLE t1 ENGINE=InnoDB; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` text /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 + `a` text /*!100301 COMPRESSED*/ CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 2000 @@ -1085,7 +1085,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Make sure column was actually compressed INSERT INTO t1 VALUES(REPEAT('a', 1000)); SELECT LEFT(a, 10), LENGTH(a) FROM t1; @@ -1104,7 +1104,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -1121,7 +1121,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -1138,7 +1138,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; # Make sure implicit CREATE TABLE ... SELECT inherits compression CREATE TABLE t2 SELECT * FROM t1; @@ -1146,7 +1146,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t2; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -1164,7 +1164,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t2; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -1182,7 +1182,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT LEFT(a, 10), LENGTH(a) FROM t1; LEFT(a, 10) LENGTH(a) aaaaaaaaaa 1000 @@ -1324,7 +1324,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ NOT NULL DEFAULT '' -) ENGINE=CSV DEFAULT CHARSET=latin1 +) ENGINE=CSV DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" DROP TABLE t1; # Test fields that don't fit data @@ -1374,7 +1374,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(255) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET column_compression_threshold=300; INSERT INTO t1 VALUES(REPEAT('a', 255)); SET column_compression_threshold=DEFAULT; @@ -1483,8 +1483,8 @@ CREATE OR REPLACE TABLE t1 (a VARCHAR(1000) COMPRESSED CHARACTER SET utf8); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1000) /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1000) /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; COLUMN_TYPE @@ -1511,7 +1511,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(1000) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL, `c` varchar(1000) /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `d` tinytext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # VARCHAR and TEXT variants @@ -1525,49 +1525,49 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BINARY); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BINARY ASCII); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BYTE); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(10) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(10) COMPRESSED ASCII); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(10) COMPRESSED UNICODE); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(10) COMPRESSED CHARACTER SET utf8); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements run without warnings. @@ -1578,35 +1578,35 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(10) /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BINARY DEFAULT ''); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(10) COMPRESSED ASCII DEFAULT ''); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(10) COMPRESSED CHARACTER SET utf8 DEFAULT ''); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(10) COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements return deprecated syntax warnings @@ -1618,7 +1618,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(10) ASCII COMPRESSED); Warnings: @@ -1627,7 +1627,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(10) BYTE COMPRESSED); Warnings: @@ -1636,7 +1636,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(10) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements fail by the grammar, @@ -1676,49 +1676,49 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinytext /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TINYTEXT COMPRESSED BINARY); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TINYTEXT COMPRESSED BINARY ASCII); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TINYTEXT COMPRESSED BYTE); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinyblob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TINYTEXT COMPRESSED ASCII); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinytext /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TINYTEXT COMPRESSED UNICODE); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TINYTEXT COMPRESSED CHARACTER SET utf8); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements run without warnings. @@ -1729,35 +1729,35 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinyblob /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TINYTEXT COMPRESSED BINARY DEFAULT ''); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TINYTEXT COMPRESSED ASCII DEFAULT ''); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinytext /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TINYTEXT COMPRESSED CHARACTER SET utf8 DEFAULT ''); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TINYTEXT COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements return deprecated syntax warnings @@ -1769,7 +1769,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TINYTEXT ASCII COMPRESSED); Warnings: @@ -1778,7 +1778,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinytext /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TINYTEXT BYTE COMPRESSED); Warnings: @@ -1787,7 +1787,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinyblob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements fail by the grammar, @@ -1827,49 +1827,49 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEXT COMPRESSED BINARY); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEXT COMPRESSED BINARY ASCII); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEXT COMPRESSED BYTE); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEXT COMPRESSED ASCII); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEXT COMPRESSED UNICODE); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` text /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` text /*!100301 COMPRESSED*/ CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEXT COMPRESSED CHARACTER SET utf8); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` text /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` text /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements run without warnings. @@ -1880,35 +1880,35 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEXT COMPRESSED BINARY DEFAULT ''); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEXT COMPRESSED ASCII DEFAULT ''); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEXT COMPRESSED CHARACTER SET utf8 DEFAULT ''); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` text /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` text /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEXT COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` text /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` text /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements return deprecated syntax warnings @@ -1920,7 +1920,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEXT ASCII COMPRESSED); Warnings: @@ -1929,7 +1929,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEXT BYTE COMPRESSED); Warnings: @@ -1938,7 +1938,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements fail by the grammar, @@ -1978,49 +1978,49 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BINARY); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BINARY ASCII); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BYTE); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumblob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED ASCII); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED UNICODE); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED CHARACTER SET utf8); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements run without warnings. @@ -2031,35 +2031,35 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumblob /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BINARY DEFAULT ''); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED ASCII DEFAULT ''); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED CHARACTER SET utf8 DEFAULT ''); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements return deprecated syntax warnings @@ -2071,7 +2071,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a MEDIUMTEXT ASCII COMPRESSED); Warnings: @@ -2080,7 +2080,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a MEDIUMTEXT BYTE COMPRESSED); Warnings: @@ -2089,7 +2089,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumblob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements fail by the grammar, @@ -2129,49 +2129,49 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longtext /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a LONGTEXT COMPRESSED BINARY); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a LONGTEXT COMPRESSED BINARY ASCII); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a LONGTEXT COMPRESSED BYTE); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longblob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a LONGTEXT COMPRESSED ASCII); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longtext /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a LONGTEXT COMPRESSED UNICODE); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET utf8); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements run without warnings. @@ -2182,35 +2182,35 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longblob /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a LONGTEXT COMPRESSED BINARY DEFAULT ''); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a LONGTEXT COMPRESSED ASCII DEFAULT ''); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longtext /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET utf8 DEFAULT ''); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements return deprecated syntax warnings @@ -2222,7 +2222,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a LONGTEXT ASCII COMPRESSED); Warnings: @@ -2231,7 +2231,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longtext /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a LONGTEXT BYTE COMPRESSED); Warnings: @@ -2240,7 +2240,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longblob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements fail by the grammar, @@ -2282,7 +2282,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements run without warnings. @@ -2293,21 +2293,21 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(10) COMPRESSED NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(10) COMPRESSED GENERATED ALWAYS AS (REPEAT('a',10))); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) /*!100301 COMPRESSED*/ GENERATED ALWAYS AS (repeat('a',10)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements return deprecated syntax warnings @@ -2319,7 +2319,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(10) NULL COMPRESSED); Warnings: @@ -2328,7 +2328,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements fail by the grammar, @@ -2357,7 +2357,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinyblob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements run without warnings. @@ -2368,21 +2368,21 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinyblob /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TINYBLOB COMPRESSED NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinyblob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TINYBLOB COMPRESSED GENERATED ALWAYS AS (REPEAT('a',10))); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinyblob /*!100301 COMPRESSED*/ GENERATED ALWAYS AS (repeat('a',10)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements return deprecated syntax warnings @@ -2394,7 +2394,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinyblob /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TINYBLOB NULL COMPRESSED); Warnings: @@ -2403,7 +2403,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinyblob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements fail by the grammar, @@ -2432,7 +2432,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements run without warnings. @@ -2443,21 +2443,21 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a BLOB COMPRESSED NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a BLOB COMPRESSED GENERATED ALWAYS AS (REPEAT('a',10))); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ GENERATED ALWAYS AS (repeat('a',10)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements return deprecated syntax warnings @@ -2469,7 +2469,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a BLOB NULL COMPRESSED); Warnings: @@ -2478,7 +2478,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements fail by the grammar, @@ -2507,7 +2507,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumblob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements run without warnings. @@ -2518,21 +2518,21 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumblob /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a MEDIUMBLOB COMPRESSED NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumblob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a MEDIUMBLOB COMPRESSED GENERATED ALWAYS AS (REPEAT('a',10))); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumblob /*!100301 COMPRESSED*/ GENERATED ALWAYS AS (repeat('a',10)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements return deprecated syntax warnings @@ -2544,7 +2544,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumblob /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a MEDIUMBLOB NULL COMPRESSED); Warnings: @@ -2553,7 +2553,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumblob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements fail by the grammar, @@ -2582,7 +2582,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longblob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements run without warnings. @@ -2593,21 +2593,21 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longblob /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a LONGBLOB COMPRESSED NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longblob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a LONGBLOB COMPRESSED GENERATED ALWAYS AS (REPEAT('a',10))); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longblob /*!100301 COMPRESSED*/ GENERATED ALWAYS AS (repeat('a',10)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements return deprecated syntax warnings @@ -2619,7 +2619,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longblob /*!100301 COMPRESSED*/ DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a LONGBLOB NULL COMPRESSED); Warnings: @@ -2628,7 +2628,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longblob /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # The following statements fail by the grammar, @@ -2656,8 +2656,8 @@ CREATE TABLE t1 (a NVARCHAR(10) COMPRESSED); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a NVARCHAR(10) COMPRESSED BINARY COMPRESSED); 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 'COMPRESSED)' at line 1 diff --git a/mysql-test/main/column_compression_parts.result b/mysql-test/main/column_compression_parts.result index bc3028826ee82..fa12217ce22f5 100644 --- a/mysql-test/main/column_compression_parts.result +++ b/mysql-test/main/column_compression_parts.result @@ -66,7 +66,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, `a` varchar(1000) /*!100301 COMPRESSED*/ DEFAULT 'AAA' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE COLUMNS(`a`) (PARTITION `p1` VALUES LESS THAN ('m') ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN ('t') ENGINE = MyISAM, @@ -78,7 +78,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, `a` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE COLUMNS(`a`) (PARTITION `p1` VALUES LESS THAN ('m') ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN ('t') ENGINE = MyISAM, @@ -135,7 +135,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1000) /*!100301 COMPRESSED*/ DEFAULT NULL, `id` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE COLUMNS(`id`,`a`) (PARTITION `p0` VALUES LESS THAN (100,'sss') ENGINE = MyISAM) SELECT * from t1 ORDER BY id; @@ -167,7 +167,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1000) /*!100301 COMPRESSED*/ DEFAULT '10-12-2010' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 6 UPDATE t1 SET a="NEW" where length(a)<20; @@ -232,7 +232,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(200) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `p1` ENGINE = MyISAM, @@ -249,7 +249,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(200) /*!100301 COMPRESSED*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 EXCHANGE PARTITION pm WITH TABLE t2; DROP TABLE t1,t2; ------------------------------------------------------------------------------------------- @@ -268,7 +268,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` blob /*!100301 COMPRESSED*/ DEFAULT 5, `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`i`) PARTITIONS 8 ALTER TABLE t1 REMOVE PARTITIONING; @@ -285,7 +285,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(500) /*!100301 COMPRESSED*/ DEFAULT '5', `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE COLUMNS(`i`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN (100) ENGINE = MyISAM, diff --git a/mysql-test/main/comment_column.result b/mysql-test/main/comment_column.result index a270b30573f68..36e1f58a4e2d7 100644 --- a/mysql-test/main/comment_column.result +++ b/mysql-test/main/comment_column.result @@ -29,7 +29,7 @@ t1 CREATE TABLE `t1` ( `c7` int(11) DEFAULT NULL, KEY `i1` (`c1`) COMMENT 'i1 comment', KEY `i2` (`c2`) -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' ALTER TABLE t1 ADD COLUMN c8 INTEGER COMMENT 'ABCdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'; SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1'; table_comment char_length(table_comment) @@ -61,7 +61,7 @@ t1 CREATE TABLE `t1` ( `c8` int(11) DEFAULT NULL COMMENT 'ABCdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i1` (`c1`) COMMENT 'i1 comment', KEY `i2` (`c2`) -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' ALTER TABLE t1 ADD COLUMN c9 INTEGER COMMENT 'ABCDefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'; SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1'; table_comment char_length(table_comment) @@ -95,7 +95,7 @@ t1 CREATE TABLE `t1` ( `c9` int(11) DEFAULT NULL COMMENT 'ABCDefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i1` (`c1`) COMMENT 'i1 comment', KEY `i2` (`c2`) -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' ALTER TABLE t1 ADD COLUMN c10 INTEGER COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'; SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1'; table_comment char_length(table_comment) @@ -131,7 +131,7 @@ t1 CREATE TABLE `t1` ( `c10` int(11) DEFAULT NULL COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i1` (`c1`) COMMENT 'i1 comment', KEY `i2` (`c2`) -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' ALTER TABLE t1 MODIFY COLUMN c8 CHAR(10); SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1'; table_comment char_length(table_comment) @@ -167,7 +167,7 @@ t1 CREATE TABLE `t1` ( `c10` int(11) DEFAULT NULL COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i1` (`c1`) COMMENT 'i1 comment', KEY `i2` (`c2`) -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' ALTER TABLE t1 CHANGE COLUMN c9 c9_1 INTEGER COMMENT '1234567890'; SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1'; table_comment char_length(table_comment) @@ -203,7 +203,7 @@ t1 CREATE TABLE `t1` ( `c10` int(11) DEFAULT NULL COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i1` (`c1`) COMMENT 'i1 comment', KEY `i2` (`c2`) -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' ALTER TABLE t1 DROP COLUMN c1; SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1'; table_comment char_length(table_comment) @@ -235,7 +235,7 @@ t1 CREATE TABLE `t1` ( `c9_1` int(11) DEFAULT NULL COMMENT '1234567890', `c10` int(11) DEFAULT NULL COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i2` (`c2`) -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR ALTER TABLE t1 ADD COLUMN c11 INTEGER COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'; Warnings: @@ -272,7 +272,7 @@ t1 CREATE TABLE `t1` ( `c10` int(11) DEFAULT NULL COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', `c11` int(11) DEFAULT NULL COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i2` (`c2`) -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' set sql_mode='TRADITIONAL'; ALTER TABLE t1 ADD COLUMN c12 INTEGER COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'; ERROR HY000: Comment for field 'c12' is too long (max = 1024) @@ -308,7 +308,7 @@ t1 CREATE TABLE `t1` ( `c10` int(11) DEFAULT NULL COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', `c11` int(11) DEFAULT NULL COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i2` (`c2`) -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' set sql_mode=''; ALTER TABLE t1 ADD COLUMN c12 CHAR(100) COMMENT 'ABCDefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'; SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1'; @@ -345,7 +345,7 @@ t1 CREATE TABLE `t1` ( `c11` int(11) DEFAULT NULL COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', `c12` char(100) DEFAULT NULL COMMENT 'ABCDefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i2` (`c2`) -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' drop table t1; create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'Abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', c2 INTEGER COMMENT 'aBcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdaBcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd',c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2) ) COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'; @@ -379,7 +379,7 @@ t1 CREATE TABLE `t1` ( `c7` int(11) DEFAULT NULL, KEY `i1` (`c1`) COMMENT 'i1 comment', KEY `i2` (`c2`) -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' DROP TABLE t1; set sql_mode='TRADITIONAL'; create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'Abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', c2 INTEGER COMMENT 'aBcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdaBcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd',c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2) diff --git a/mysql-test/main/comment_database.result b/mysql-test/main/comment_database.result index fe9c9ff293184..8e3cf1c904ece 100644 --- a/mysql-test/main/comment_database.result +++ b/mysql-test/main/comment_database.result @@ -7,7 +7,7 @@ CREATE DATABASE db1 COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'; SHOW CREATE DATABASE db1; Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */ COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' SELECT schema_comment, char_length(schema_comment) FROM information_schema.schemata WHERE schema_name='db1'; @@ -21,7 +21,7 @@ Warnings: Warning 4160 Comment for database 'db1' is too long (max = 1024) SHOW CREATE DATABASE db1; Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */ COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' SELECT schema_comment, char_length(schema_comment) FROM information_schema.schemata WHERE schema_name='db1'; @@ -39,7 +39,7 @@ schema_comment char_length(schema_comment) CREATE DATABASE db1 COMMENT 'db1'; SHOW CREATE DATABASE db1; Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */ COMMENT 'db1' +db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ COMMENT 'db1' ALTER DATABASE db1 COMMENT = "db1 comment"; SELECT * FROM information_schema.schemata WHERE schema_name='db1'; @@ -51,24 +51,24 @@ USE db1; ALTER DATABASE COMMENT 'db1 comment' CHARACTER SET 'utf8'; SHOW CREATE DATABASE db1; Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 */ COMMENT 'db1 comment' +db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */ COMMENT 'db1 comment' ALTER DATABASE db1 COMMENT 'this is db1 comment'; SHOW CREATE DATABASE db1; Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 */ COMMENT 'this is db1 comment' +db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */ COMMENT 'this is db1 comment' ALTER DATABASE CHARACTER SET 'latin1'; SHOW CREATE DATABASE db1; Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */ COMMENT 'this is db1 comment' +db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ COMMENT 'this is db1 comment' DROP DATABASE db1; CREATE DATABASE comment COMMENT 'comment' CHARACTER SET 'latin2'; SHOW CREATE DATABASE comment; Database Create Database -comment CREATE DATABASE `comment` /*!40100 DEFAULT CHARACTER SET latin2 */ COMMENT 'comment' +comment CREATE DATABASE `comment` /*!40100 DEFAULT CHARACTER SET latin2 COLLATE latin2_general_ci */ COMMENT 'comment' ALTER DATABASE comment COMMENT 'comment comment'; SHOW CREATE DATABASE comment; Database Create Database -comment CREATE DATABASE `comment` /*!40100 DEFAULT CHARACTER SET latin2 */ COMMENT 'comment comment' +comment CREATE DATABASE `comment` /*!40100 DEFAULT CHARACTER SET latin2 COLLATE latin2_general_ci */ COMMENT 'comment comment' USE comment; ALTER DATABASE COMMENT 'comment'; SELECT * FROM information_schema.schemata diff --git a/mysql-test/main/comment_database.test b/mysql-test/main/comment_database.test index 3fe1c7b205c15..bf89a57c7b257 100644 --- a/mysql-test/main/comment_database.test +++ b/mysql-test/main/comment_database.test @@ -52,6 +52,7 @@ SHOW CREATE DATABASE db1; DROP DATABASE db1; # Test the case when the database is named 'comment' +--disable_service_connection CREATE DATABASE comment COMMENT 'comment' CHARACTER SET 'latin2'; SHOW CREATE DATABASE comment; ALTER DATABASE comment COMMENT 'comment comment'; @@ -61,3 +62,4 @@ ALTER DATABASE COMMENT 'comment'; SELECT * FROM information_schema.schemata WHERE schema_name='comment'; DROP DATABASE comment; +--enable_service_connection diff --git a/mysql-test/main/comment_index.result b/mysql-test/main/comment_index.result index 824128713775f..13dcd3c7099ca 100644 --- a/mysql-test/main/comment_index.result +++ b/mysql-test/main/comment_index.result @@ -41,7 +41,7 @@ t1 CREATE TABLE `t1` ( `c13` datetime DEFAULT NULL, KEY `i1` (`c1`) COMMENT 'i1 comment', KEY `i2` (`c2`) -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' CREATE INDEX i4 ON t1(c4) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'; SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1'; table_comment char_length(table_comment) @@ -85,7 +85,7 @@ t1 CREATE TABLE `t1` ( KEY `i1` (`c1`) COMMENT 'i1 comment', KEY `i2` (`c2`), KEY `i4` (`c4`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' ALTER TABLE t1 ADD INDEX (c6) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'; SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1'; table_comment char_length(table_comment) @@ -131,7 +131,7 @@ t1 CREATE TABLE `t1` ( KEY `i2` (`c2`), KEY `i4` (`c4`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `c6` (`c6`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' DROP INDEX i1 ON t1; ALTER TABLE t1 DROP INDEX i2, DROP INDEX i4; SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1'; @@ -172,7 +172,7 @@ t1 CREATE TABLE `t1` ( `c12` datetime DEFAULT NULL, `c13` datetime DEFAULT NULL, KEY `c6` (`c6`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' ALTER TABLE t1 ADD INDEX i8(c8) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', ADD INDEX i10(c10) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'; SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1'; table_comment char_length(table_comment) @@ -216,7 +216,7 @@ t1 CREATE TABLE `t1` ( KEY `c6` (`c6`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i8` (`c8`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i10` (`c10`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' CREATE INDEX i1_3 ON t1(c1,c2,c3) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'; SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1'; table_comment char_length(table_comment) @@ -264,7 +264,7 @@ t1 CREATE TABLE `t1` ( KEY `i8` (`c8`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i10` (`c10`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i1_3` (`c1`,`c2`,`c3`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE INDEX i11 ON t1(c11) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'; Warnings: @@ -317,7 +317,7 @@ t1 CREATE TABLE `t1` ( KEY `i10` (`c10`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i1_3` (`c1`,`c2`,`c3`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i11` (`c11`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR ALTER TABLE t1 ADD INDEX (c13) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'; Warnings: @@ -372,7 +372,7 @@ t1 CREATE TABLE `t1` ( KEY `i1_3` (`c1`,`c2`,`c3`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i11` (`c11`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `c13` (`c13`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' set sql_mode='TRADITIONAL'; ALTER TABLE t1 ADD INDEX i12 (c12) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'; ERROR HY000: Comment for index 'i12' is too long (max = 1024) @@ -426,7 +426,7 @@ t1 CREATE TABLE `t1` ( KEY `i1_3` (`c1`,`c2`,`c3`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i11` (`c11`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `c13` (`c13`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' set sql_mode='TRADITIONAL'; CREATE INDEX i12 ON t1(c12) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'; ERROR HY000: Comment for index 'i12' is too long (max = 1024) @@ -480,5 +480,5 @@ t1 CREATE TABLE `t1` ( KEY `i1_3` (`c1`,`c2`,`c3`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `i11` (`c11`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', KEY `c13` (`c13`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' drop table t1; diff --git a/mysql-test/main/comment_table.result b/mysql-test/main/comment_table.result index 1a18df8f66be7..eccc62ea7dd3c 100644 --- a/mysql-test/main/comment_table.result +++ b/mysql-test/main/comment_table.result @@ -24,7 +24,7 @@ t1 CREATE TABLE `t1` ( `c7` int(11) DEFAULT NULL, KEY `i1` (`c1`) COMMENT 'i1 comment', KEY `i2` (`c2`) -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' drop table t1; create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'c1 comment', c2 INTEGER,c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2) ) COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcde'; @@ -52,7 +52,7 @@ t1 CREATE TABLE `t1` ( `c7` int(11) DEFAULT NULL, KEY `i1` (`c1`) COMMENT 'i1 comment', KEY `i2` (`c2`) -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcde' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcde' drop table t1; set sql_mode='TRADITIONAL'; create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'c1 comment', c2 INTEGER,c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2) @@ -96,7 +96,7 @@ t1 CREATE TABLE `t1` ( `c7` int(11) DEFAULT NULL, KEY `i1` (`c1`) COMMENT 'i1 comment', KEY `i2` (`c2`) -) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd' drop table t1; SET SQL_MODE=''; create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'c1 comment', c2 INTEGER,c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2) diff --git a/mysql-test/main/commit.test b/mysql-test/main/commit.test index 9f5e077fd2dd3..a0d4ddee152aa 100644 --- a/mysql-test/main/commit.test +++ b/mysql-test/main/commit.test @@ -1,4 +1,5 @@ --source include/have_innodb.inc +--source include/no_view_protocol.inc connect (con1,localhost,root,,); diff --git a/mysql-test/main/compare.result b/mysql-test/main/compare.result index c465001432601..b8883784d21ae 100644 --- a/mysql-test/main/compare.result +++ b/mysql-test/main/compare.result @@ -47,11 +47,11 @@ insert into t1 values (0x01,0x01); select * from t1 where a=b; a b Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '\x01' +Warning 1292 Truncated incorrect DECIMAL value: '\x01' select * from t1 where a=b and b=0x01; a b Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '\x01' +Warning 1292 Truncated incorrect DECIMAL value: '\x01' drop table if exists t1; CREATE TABLE t1 (b int(2) zerofill, c int(2) zerofill); INSERT INTO t1 (b,c) VALUES (1,2), (1,1), (2,2); diff --git a/mysql-test/main/compress.test b/mysql-test/main/compress.test index 8fc21d9c9611b..daa133ebdc7cf 100644 --- a/mysql-test/main/compress.test +++ b/mysql-test/main/compress.test @@ -1,6 +1,8 @@ # Turn on compression between the client and server # and run a number of tests +# Too slow for valgrind +--source include/no_valgrind_without_big.inc # Can't test with embedded server -- source include/not_embedded.inc -- source include/have_compress.inc diff --git a/mysql-test/main/concurrent_innodb_safelog.test b/mysql-test/main/concurrent_innodb_safelog.test index 7f6b3c328f260..d590dfa6cfeb7 100644 --- a/mysql-test/main/concurrent_innodb_safelog.test +++ b/mysql-test/main/concurrent_innodb_safelog.test @@ -11,7 +11,6 @@ # t/concurrent_innodb_unsafelog.test # new wrapper t/concurrent_innodb_safelog.test # - --source include/have_innodb.inc let $engine_type= InnoDB; @@ -19,7 +18,7 @@ let $engine_type= InnoDB; SET @save_timeout = @@GLOBAL.innodb_lock_wait_timeout; SET GLOBAL innodb_lock_wait_timeout = 1; SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ; - +--disable_service_connection --source include/concurrent.inc - +--enable_service_connection SET GLOBAL innodb_lock_wait_timeout = @save_timeout; diff --git a/mysql-test/main/concurrent_innodb_unsafelog.test b/mysql-test/main/concurrent_innodb_unsafelog.test index eee2295211e18..d9e5effaaf644 100644 --- a/mysql-test/main/concurrent_innodb_unsafelog.test +++ b/mysql-test/main/concurrent_innodb_unsafelog.test @@ -20,8 +20,8 @@ SET @save_timeout = @@GLOBAL.innodb_lock_wait_timeout; SET GLOBAL innodb_lock_wait_timeout = 1; SET @save_isolation = @@GLOBAL.tx_isolation; SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; - +--disable_service_connection --source include/concurrent.inc - +--enable_service_connection SET GLOBAL innodb_lock_wait_timeout = @save_timeout; SET GLOBAL tx_isolation = @save_isolation; diff --git a/mysql-test/main/constraints.result b/mysql-test/main/constraints.result index 3702bff83ec8f..143c22321ab5c 100644 --- a/mysql-test/main/constraints.result +++ b/mysql-test/main/constraints.result @@ -3,7 +3,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL CHECK (`a` > 0) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1); insert into t1 values (0); ERROR 23000: CONSTRAINT `t1.a` failed for `test`.`t1` @@ -15,7 +15,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, CONSTRAINT `CONSTRAINT_1` CHECK (`a` > `b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,0); insert into t1 values (0,1); ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1` @@ -27,7 +27,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, CONSTRAINT `abc` CHECK (`a` > `b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,0); insert into t1 values (0,1); ERROR 23000: CONSTRAINT `abc` failed for `test`.`t1` @@ -37,7 +37,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1),(NULL); drop table t1; create table t1 (a int null); @@ -55,7 +55,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `constraint_1` (`a`), UNIQUE KEY `key_1` (`a`), UNIQUE KEY `key_2` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; drop table if exists t_illegal; create table t_illegal (a int, b int, check a>b); @@ -108,14 +108,14 @@ long_enough_name CREATE TABLE `long_enough_name` ( KEY `idx3` (`f2`), KEY `idx4` (`f3`), CONSTRAINT `constr` CHECK (`f6` >= 0) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE long_enough_name; CREATE TABLE test.t(t int COMMENT 't_comment' CHECK(t>0)); SHOW CREATE TABLE test.t; Table Create Table t CREATE TABLE `t` ( `t` int(11) DEFAULT NULL COMMENT 't_comment' CHECK (`t` > 0) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP table test.t; SET @OLD_SQL_MODE=@@SQL_MODE; SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS'; @@ -126,7 +126,7 @@ SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( `f` int(11) DEFAULT NULL `foo`=bar CHECK (`f` > 0) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP table test.t; SET @@SQL_MODE=@OLD_SQL_MODE; # @@ -146,7 +146,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 add column b int; CALL sp; show create table t1; @@ -155,7 +155,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, CONSTRAINT `CONSTRAINT_1` CHECK (`b` > 0) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CALL sp; show create table t1; Table Create Table @@ -164,7 +164,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, CONSTRAINT `CONSTRAINT_1` CHECK (`b` > 0), CONSTRAINT `CONSTRAINT_2` CHECK (`b` > 0) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP PROCEDURE sp; DROP TABLE t1; CREATE TABLE t1 (a INT); @@ -180,16 +180,18 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, CONSTRAINT `CONSTRAINT_1` CHECK (`b` < 10), CONSTRAINT `CONSTRAINT_2` CHECK (`b` > 0) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP PROCEDURE sp; DROP TABLE t1; +# # End of 10.2 tests +# create table t1 (a int check (a>10)) select 100 as 'a'; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL CHECK (`a` > 10) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a text default(length(now())) check (length(a) > 1)); insert into t1 values (); @@ -201,3 +203,35 @@ a 19 ccc drop table t1; +create table t1 (a int, b int); +create procedure sp() alter table t1 add constraint if not exists foo check (b > 0); +call sp; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + CONSTRAINT `foo` CHECK (`b` > 0) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +call sp; +Warnings: +Note 1826 Duplicate CHECK constraint name 'foo' +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + CONSTRAINT `foo` CHECK (`b` > 0) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +call sp; +Warnings: +Note 1826 Duplicate CHECK constraint name 'foo' +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + CONSTRAINT `foo` CHECK (`b` > 0) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop procedure sp; +drop table t1; diff --git a/mysql-test/main/constraints.test b/mysql-test/main/constraints.test index 2f4dadcee9d27..5c673f9be8143 100644 --- a/mysql-test/main/constraints.test +++ b/mysql-test/main/constraints.test @@ -151,7 +151,9 @@ show create table t1; DROP PROCEDURE sp; DROP TABLE t1; +--echo # --echo # End of 10.2 tests +--echo # # # Check that we don't lose constraints as part of CREATE ... SELECT @@ -172,3 +174,18 @@ insert into t1 values ("ccc"); insert into t1 values (""); select * from t1; drop table t1; + +# +# add if not exists in SP +# + +create table t1 (a int, b int); +create procedure sp() alter table t1 add constraint if not exists foo check (b > 0); +call sp; +show create table t1; +call sp; +show create table t1; +call sp; +show create table t1; +drop procedure sp; +drop table t1; diff --git a/mysql-test/main/contributors.result b/mysql-test/main/contributors.result index 0c7ca03a2c51f..8d72373696c9c 100644 --- a/mysql-test/main/contributors.result +++ b/mysql-test/main/contributors.result @@ -5,6 +5,8 @@ Tencent Cloud https://cloud.tencent.com Platinum Sponsor of the MariaDB Foundati Microsoft https://microsoft.com/ Platinum Sponsor of the MariaDB Foundation MariaDB Corporation https://mariadb.com Founding member, Platinum Sponsor of the MariaDB Foundation ServiceNow https://servicenow.com Platinum Sponsor of the MariaDB Foundation +Intel https://www.intel.com Platinum Sponsor of the MariaDB Foundation +SIT https://sit.org Platinum Sponsor of the MariaDB Foundation 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 diff --git a/mysql-test/main/crash_commit_before.result b/mysql-test/main/crash_commit_before.result index 55fea1909f0b0..359d5851d60c4 100644 --- a/mysql-test/main/crash_commit_before.result +++ b/mysql-test/main/crash_commit_before.result @@ -8,7 +8,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; a DROP TABLE t1; diff --git a/mysql-test/main/create-big.result b/mysql-test/main/create-big.result index fc29b08ffb889..bdc4668e8300b 100644 --- a/mysql-test/main/create-big.result +++ b/mysql-test/main/create-big.result @@ -19,7 +19,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; create table t1 select 1 as i;; @@ -36,7 +36,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t3 (j char(5)); set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; @@ -54,7 +54,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; create table t1 select 1 as i;; @@ -71,7 +71,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; create table t1 select 1 as i;; @@ -88,7 +88,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; create table t1 select 1 as i;; @@ -105,7 +105,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1,t3; set debug_sync='create_table_select_before_open SIGNAL parked WAIT_FOR go'; connection default; @@ -286,7 +286,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info diff --git a/mysql-test/main/create-uca.result b/mysql-test/main/create-uca.result index 29a2c0a9d1a94..a27e9d6dd1613 100644 --- a/mysql-test/main/create-uca.result +++ b/mysql-test/main/create-uca.result @@ -13,9 +13,9 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT 12 COMMENT 'column1', `c2` int(11) DEFAULT NULL COMMENT 'column2', `c3` int(11) NOT NULL COMMENT 'column3', - `c4` varchar(255) CHARACTER SET utf8mb3 NOT NULL DEFAULT 'a', + `c4` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'a', `c5` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT 'b', - `c6` varchar(255) COLLATE latin1_bin DEFAULT NULL + `c6` varchar(255) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin CREATE TABLE t2 AS SELECT * FROM t1; SHOW CREATE TABLE t2; @@ -24,8 +24,8 @@ t2 CREATE TABLE `t2` ( `c1` int(11) DEFAULT 12 COMMENT 'column1', `c2` int(11) DEFAULT NULL COMMENT 'column2', `c3` int(11) NOT NULL COMMENT 'column3', - `c4` varchar(255) CHARACTER SET utf8mb3 NOT NULL DEFAULT 'a', + `c4` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'a', `c5` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT 'b', `c6` varchar(255) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; diff --git a/mysql-test/main/create.result b/mysql-test/main/create.result index 299fdfc9b4149..9ab1db890294f 100644 --- a/mysql-test/main/create.result +++ b/mysql-test/main/create.result @@ -43,7 +43,7 @@ show create table `a/a`; Table Create Table a/a CREATE TABLE `a/a` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t1 like `a/a`; drop table `a/a`; drop table `t1`; @@ -245,7 +245,7 @@ t1 CREATE TABLE `t1` ( KEY `b_29` (`b`), KEY `b_30` (`b`), KEY `b_31` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 select if(1,'1','0'), month("2002-08-02"); drop table t1; @@ -263,7 +263,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; SET SESSION default_storage_engine="gemini"; ERROR 42000: Unknown storage engine 'gemini' @@ -275,7 +275,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET SESSION default_storage_engine=default; drop table t1; create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2)); @@ -350,7 +350,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `id` int(11) NOT NULL, `name` char(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t3; id name create table if not exists t3 like t1; @@ -364,7 +364,7 @@ show create table t3; Table Create Table t3 CREATE TEMPORARY TABLE `t3` ( `id` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t3; id drop table t3; @@ -373,7 +373,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `id` int(11) NOT NULL, `name` char(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t3; id name drop table t2, t3; @@ -385,14 +385,14 @@ Table Create Table t3 CREATE TEMPORARY TABLE `t3` ( `id` int(11) NOT NULL, `name` char(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t2 like t3; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `id` int(11) NOT NULL, `name` char(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t2; id name create table t3 like t1; @@ -427,7 +427,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; SET SESSION default_storage_engine="gemini"; ERROR 42000: Unknown storage engine 'gemini' @@ -439,7 +439,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET SESSION default_storage_engine=default; drop table t1; create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob); @@ -510,7 +510,7 @@ t2 CREATE TABLE `t2` ( `ifnull(c_text, CAST('yet another binary data' AS BINARY))` blob DEFAULT NULL, `ifnull(c_mediumtext, CAST('yet another binary data' AS BINARY))` mediumblob DEFAULT NULL, `ifnull(c_longtext, CAST('yet another binary data' AS BINARY))` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, l datetime, m enum('a','b'), n set('a','b'), o char(10)); @@ -533,7 +533,7 @@ t2 CREATE TABLE `t2` ( `ifnull(m,m)` varchar(1) DEFAULT NULL, `ifnull(n,n)` varchar(3) DEFAULT NULL, `ifnull(o,o)` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1,t2; create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14'); insert into t1 values ('','',0,0.0); @@ -607,14 +607,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `primary` int(11) DEFAULT NULL, KEY `primary_2` (`primary`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t2 (`PRIMARY` int, index(`PRIMARY`)); show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `PRIMARY` int(11) DEFAULT NULL, KEY `PRIMARY_2` (`PRIMARY`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t3 (a int); alter table t3 add index `primary` (a); ERROR 42000: Incorrect index name 'primary' @@ -627,7 +627,7 @@ Table Create Table t4 CREATE TABLE `t4` ( `primary` int(11) DEFAULT NULL, KEY `primary_2` (`primary`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t5 (`PRIMARY` int); alter table t5 add index(`PRIMARY`); show create table t5; @@ -635,7 +635,7 @@ Table Create Table t5 CREATE TABLE `t5` ( `PRIMARY` int(11) DEFAULT NULL, KEY `PRIMARY_2` (`PRIMARY`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2, t3, t4, t5; CREATE TABLE t1(id varchar(10) NOT NULL PRIMARY KEY, dsc longtext); INSERT INTO t1 VALUES ('5000000001', NULL),('5000000003', 'Test'),('5000000004', NULL); @@ -706,7 +706,7 @@ Warnings: Note 1007 Can't create database 'mysqltest'; database exists show create database mysqltest; Database Create Database -mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ +mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ drop database mysqltest; use test; create table t1 (a int); @@ -723,7 +723,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(112) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t2 ( a int(11) default NULL @@ -739,7 +739,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(12) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL, `b` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR create table t1 ( @@ -755,7 +755,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(12) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL, `c` int(1) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 ( a varchar(12) charset utf8 collate utf8_bin not null, @@ -768,7 +768,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(12) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL, `c` int(1) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 ( a varchar(12) charset utf8 collate utf8_bin not null, @@ -780,7 +780,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(12) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL, `b` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 ( a varchar(12) charset utf8 collate utf8_bin, @@ -792,7 +792,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(12) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL, `b` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 ( a1 int not null, @@ -829,7 +829,7 @@ t2 CREATE TABLE `t2` ( `b` int(11) DEFAULT 3, `a1` int(11) DEFAULT NULL, `a2` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1(a set("a,b","c,d") not null); ERROR 22007: Illegal set 'a,b' value found during parsing @@ -838,19 +838,19 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MAX_ROWS=4294967295 alter table t1 max_rows=100; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=100 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MAX_ROWS=100 alter table t1 max_rows=100000000000; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MAX_ROWS=4294967295 drop table t1; create table t1 select * from t2; ERROR 42S02: Table 'test.t2' doesn't exist @@ -1071,59 +1071,59 @@ create table t1 like information_schema.processlist; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `ID` bigint(4) NOT NULL DEFAULT 0, - `USER` varchar(128) NOT NULL DEFAULT '', - `HOST` varchar(64) NOT NULL DEFAULT '', - `DB` varchar(64) DEFAULT NULL, - `COMMAND` varchar(16) NOT NULL DEFAULT '', - `TIME` int(7) NOT NULL DEFAULT 0, - `STATE` varchar(64) DEFAULT NULL, - `INFO` longtext DEFAULT NULL, - `TIME_MS` decimal(22,3) NOT NULL DEFAULT 0.000, - `STAGE` tinyint(2) NOT NULL DEFAULT 0, - `MAX_STAGE` tinyint(2) NOT NULL DEFAULT 0, - `PROGRESS` decimal(7,3) NOT NULL DEFAULT 0.000, - `MEMORY_USED` bigint(7) NOT NULL DEFAULT 0, - `MAX_MEMORY_USED` bigint(7) NOT NULL DEFAULT 0, - `EXAMINED_ROWS` int(7) NOT NULL DEFAULT 0, - `QUERY_ID` bigint(4) NOT NULL DEFAULT 0, - `INFO_BINARY` blob DEFAULT NULL, - `TID` bigint(4) NOT NULL DEFAULT 0 -) DEFAULT CHARSET=utf8mb3 + `ID` bigint(4) NOT NULL, + `USER` varchar(128) NOT NULL, + `HOST` varchar(64) NOT NULL, + `DB` varchar(64), + `COMMAND` varchar(16) NOT NULL, + `TIME` int(7) NOT NULL, + `STATE` varchar(64), + `INFO` longtext, + `TIME_MS` decimal(22,3) NOT NULL, + `STAGE` tinyint(2) NOT NULL, + `MAX_STAGE` tinyint(2) NOT NULL, + `PROGRESS` decimal(7,3) NOT NULL, + `MEMORY_USED` bigint(7) NOT NULL, + `MAX_MEMORY_USED` bigint(7) NOT NULL, + `EXAMINED_ROWS` int(7) NOT NULL, + `QUERY_ID` bigint(4) NOT NULL, + `INFO_BINARY` blob, + `TID` bigint(4) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci drop table t1; create temporary table t1 like information_schema.processlist; show create table t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( - `ID` bigint(4) NOT NULL DEFAULT 0, - `USER` varchar(128) NOT NULL DEFAULT '', - `HOST` varchar(64) NOT NULL DEFAULT '', - `DB` varchar(64) DEFAULT NULL, - `COMMAND` varchar(16) NOT NULL DEFAULT '', - `TIME` int(7) NOT NULL DEFAULT 0, - `STATE` varchar(64) DEFAULT NULL, - `INFO` longtext DEFAULT NULL, - `TIME_MS` decimal(22,3) NOT NULL DEFAULT 0.000, - `STAGE` tinyint(2) NOT NULL DEFAULT 0, - `MAX_STAGE` tinyint(2) NOT NULL DEFAULT 0, - `PROGRESS` decimal(7,3) NOT NULL DEFAULT 0.000, - `MEMORY_USED` bigint(7) NOT NULL DEFAULT 0, - `MAX_MEMORY_USED` bigint(7) NOT NULL DEFAULT 0, - `EXAMINED_ROWS` int(7) NOT NULL DEFAULT 0, - `QUERY_ID` bigint(4) NOT NULL DEFAULT 0, - `INFO_BINARY` blob DEFAULT NULL, - `TID` bigint(4) NOT NULL DEFAULT 0 -) DEFAULT CHARSET=utf8mb3 + `ID` bigint(4) NOT NULL, + `USER` varchar(128) NOT NULL, + `HOST` varchar(64) NOT NULL, + `DB` varchar(64), + `COMMAND` varchar(16) NOT NULL, + `TIME` int(7) NOT NULL, + `STATE` varchar(64), + `INFO` longtext, + `TIME_MS` decimal(22,3) NOT NULL, + `STAGE` tinyint(2) NOT NULL, + `MAX_STAGE` tinyint(2) NOT NULL, + `PROGRESS` decimal(7,3) NOT NULL, + `MEMORY_USED` bigint(7) NOT NULL, + `MAX_MEMORY_USED` bigint(7) NOT NULL, + `EXAMINED_ROWS` int(7) NOT NULL, + `QUERY_ID` bigint(4) NOT NULL, + `INFO_BINARY` blob, + `TID` bigint(4) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci drop table t1; create table t1 like information_schema.character_sets; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '', - `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL DEFAULT '', - `DESCRIPTION` varchar(60) NOT NULL DEFAULT '', - `MAXLEN` bigint(3) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `CHARACTER_SET_NAME` varchar(32) NOT NULL, + `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL, + `DESCRIPTION` varchar(60) NOT NULL, + `MAXLEN` bigint(3) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci drop table t1; # -- @@ -1183,7 +1183,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` year(4) DEFAULT 2008, `c2` year(4) DEFAULT 0000 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES(); @@ -1198,7 +1198,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` year(4) DEFAULT 0000, `c2` year(4) DEFAULT 0000 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES(); @@ -1396,12 +1396,12 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `dt` datetime DEFAULT '2008-02-31 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `dt` datetime DEFAULT '2008-02-31 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci set @@sql_mode= @old_mode; drop tables t1, t2; CREATE TABLE t1 (id int); @@ -1811,7 +1811,7 @@ t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, `dynamic_cols` blob DEFAULT NULL, PRIMARY KEY (`item_name`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 ( n int, @@ -1828,7 +1828,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `n` int(11) DEFAULT NULL, `c` char(32) GENERATED ALWAYS AS (cast(cast(`n` as char charset latin1) as char charset latin1)) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @@session.collation_server=filename; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR @@ -2031,6 +2031,17 @@ Warnings: Warning 1280 Name 'foo' ignored for PRIMARY key. DROP TABLE t1; # +# MDEV-30342 Wrong "Truncated incorrect DECIMAL value" warning/error +# +create table t1(c1 varchar(1)); +insert into t1(c1) values('#'); +select @@sql_mode like '%strict_all_tables%'; +@@sql_mode like '%strict_all_tables%' +0 +create table t2 as select if(c1 = '#', c1 = 0, c1) as c1 from t1; +ERROR 22007: Truncated incorrect DECIMAL value: '#' +drop table t1; +# # End of 10.3 tests # # diff --git a/mysql-test/main/create.test b/mysql-test/main/create.test index a6364e5217ead..0b9e51e8545e7 100644 --- a/mysql-test/main/create.test +++ b/mysql-test/main/create.test @@ -106,6 +106,7 @@ create table t1 (i int, index `` (i)); # We don't allow creation of non-temporary tables under LOCK TABLES # as following meta-data locking protocol in this case can lead to # deadlock. +--disable_service_connection create table t1 (i int); lock tables t1 read; --error ER_TABLE_NOT_LOCKED @@ -115,6 +116,7 @@ create temporary table t2 (j int); drop temporary table t2; unlock tables; drop table t1; +--enable_service_connection # # Test of CREATE ... SELECT with indexes @@ -286,7 +288,7 @@ drop table if exists t2,t1; # # Test for CREATE TABLE .. LIKE .. # - +--disable_view_protocol create table t1(id int not null, name char(20)); insert into t1 values(10,'mysql'),(20,'monty- the creator'); create table t2(id int not null); @@ -325,13 +327,14 @@ create temporary table t3 like t1; drop table t1, t2, t3; drop table t3; drop database mysqltest; - +--enable_view_protocol # # CREATE TABLE LIKE under LOCK TABLES # # Similarly to ordinary CREATE TABLE we don't allow creation of # non-temporary tables under LOCK TABLES. Also we require source # table to be locked. +--disable_service_connection create table t1 (i int); create table t2 (j int); lock tables t1 read; @@ -345,6 +348,7 @@ drop temporary table t3; create temporary table t3 like t2; unlock tables; drop tables t1, t2; +--enable_service_connection # # Test default table type @@ -453,7 +457,7 @@ drop table t1, t2, t3; # # Bug #1209 # - +--disable_service_connection create database mysqltest; use mysqltest; select database(); @@ -469,6 +473,7 @@ connection default; disconnect user1; drop user mysqltest_1; use test; +--enable_service_connection # # Test for Bug 856 'Naming a key "Primary" causes trouble' @@ -530,6 +535,7 @@ drop table t1,t2; # This tests two additional possible errors and a hang if # an improper fix is present. # +--disable_service_connection create table t1 (a int); --error ER_TABLE_EXISTS_ERROR create table t1 select * from t1; @@ -538,6 +544,7 @@ create table t2 union = (t1) select * from t1; flush tables with read lock; unlock tables; drop table t1; +--enable_service_connection # # Bug#10413: Invalid column name is not rejected @@ -771,14 +778,14 @@ 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. - +--disable_view_protocol create temporary table t1 (j int); create table if not exists t1 select 1; select * from t1; drop temporary table t1; select * from t1; drop table t1; - +--enable_view_protocol # # CREATE TABLE ... SELECT and LOCK TABLES # @@ -787,7 +794,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". - +--disable_service_connection create table t1 (i int); insert into t1 values (1), (2); lock tables t1 read; @@ -832,7 +839,7 @@ create temporary table if not exists t2 select * from t1; select * from t2; unlock tables; drop table t1, t2; - +--enable_service_connection # # Bug#21772: can not name a column 'upgrade' when create a table @@ -1301,7 +1308,7 @@ DROP VIEW t2; --echo # Bug #49193 CREATE TABLE reacts differently depending --echo # on whether data is selected or not --echo # - +--disable_view_protocol CREATE TEMPORARY TABLE t2 (ID INT); INSERT INTO t2 VALUES (1),(2),(3); @@ -1337,7 +1344,7 @@ SELECT * FROM t1; DROP TABLE t1; DROP TEMPORARY TABLE t2; - +--enable_view_protocol --echo # --echo # Bug #22909 "Using CREATE ... LIKE is possible to create field @@ -1418,7 +1425,7 @@ drop table t1; --echo # --echo # 2. A temporary table. --echo # - +--disable_view_protocol create temporary table if not exists t1 (a int) select 1 as a; select * from t1; --error ER_TABLE_EXISTS_ERROR @@ -1571,6 +1578,7 @@ select * from t1; drop table t1; --error ER_NO_SUCH_TABLE create table if not exists t1 (a int) select * from t1; +--enable_view_protocol --echo # --echo # 7. Test of non-matching columns, REPLACE and IGNORE. @@ -1611,7 +1619,7 @@ drop table t1; --echo # --echo # Checking that CREATE IF NOT EXISTS is not blocked by running SELECT --echo # - +--disable_service_connection create table t1 (a int, b int) engine=myisam; create table t2 (a int, b int) engine=myisam; insert into t1 values (1,1); @@ -1634,6 +1642,7 @@ connection default; select * from t1; unlock tables; drop table t1,t2; +--enable_service_connection --echo # --echo # MDEV-6179: dynamic columns functions/cast()/convert() doesn't @@ -1883,6 +1892,19 @@ create table t1 (c int(10) unsigned) engine=memory transactional=0; CREATE TABLE t1 ( id1 INT, id2 INT, CONSTRAINT `foo` PRIMARY KEY (id1), CONSTRAINT `bar` UNIQUE KEY(id2)); DROP TABLE t1; +--echo # +--echo # MDEV-30342 Wrong "Truncated incorrect DECIMAL value" warning/error +--echo # + +create table t1(c1 varchar(1)); +insert into t1(c1) values('#'); + +select @@sql_mode like '%strict_all_tables%'; +--error ER_TRUNCATED_WRONG_VALUE +create table t2 as select if(c1 = '#', c1 = 0, c1) as c1 from t1; + +drop table t1; + --echo # --echo # End of 10.3 tests --echo # diff --git a/mysql-test/main/create_drop_binlog.result b/mysql-test/main/create_drop_binlog.result index 4a8c75a3daef8..20e3e98f73d5f 100644 --- a/mysql-test/main/create_drop_binlog.result +++ b/mysql-test/main/create_drop_binlog.result @@ -142,7 +142,7 @@ DROP SERVER s1; CREATE SERVER IF NOT EXISTS s1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test'); CREATE SERVER IF NOT EXISTS s1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test'); Warnings: -Note 1476 The foreign server, s1, you are trying to create already exists +Note 1476 Cannot create foreign server 's1' as it already exists DROP SERVER IF EXISTS s1; DROP SERVER IF EXISTS s1; SHOW BINLOG EVENTS; @@ -362,7 +362,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `i1` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP INDEX IF EXISTS i1 ON t1; DROP INDEX IF EXISTS i1 ON t1; Warnings: diff --git a/mysql-test/main/create_drop_event.test b/mysql-test/main/create_drop_event.test index d885a39e45321..a906ec33072fb 100644 --- a/mysql-test/main/create_drop_event.test +++ b/mysql-test/main/create_drop_event.test @@ -1,4 +1,5 @@ --source include/not_embedded.inc +--source include/no_view_protocol.inc SET timestamp=UNIX_TIMESTAMP('2014-11-01 10:20:30'); SET GLOBAL event_scheduler=off; diff --git a/mysql-test/main/create_drop_function.result b/mysql-test/main/create_drop_function.result index 7f23c954d7f76..7c293ef6cdf29 100644 --- a/mysql-test/main/create_drop_function.result +++ b/mysql-test/main/create_drop_function.result @@ -4,7 +4,7 @@ RETURNS CHAR(100) RETURN CONCAT('Hello, ', str, '!'); SELECT * FROM mysql.proc WHERE name like 'f1'; db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate -test f1 FUNCTION f1 SQL CONTAINS_SQL NO DEFINER str char(20) char(100) CHARSET latin1 RETURN CONCAT('Hello, ', str, '!') root@localhost 2014-09-30 08:00:00 2014-09-30 08:00:00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci RETURN CONCAT('Hello, ', str, '!') NONE +test f1 FUNCTION f1 SQL CONTAINS_SQL NO DEFINER str char(20) char(100) CHARSET latin1 COLLATE latin1_swedish_ci RETURN CONCAT('Hello, ', str, '!') root@localhost 2014-09-30 08:00:00 2014-09-30 08:00:00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci RETURN CONCAT('Hello, ', str, '!') NONE SELECT f1('world'); f1('world') Hello, world! diff --git a/mysql-test/main/create_drop_index.result b/mysql-test/main/create_drop_index.result index 7df6aeb583854..ff02442b99e70 100644 --- a/mysql-test/main/create_drop_index.result +++ b/mysql-test/main/create_drop_index.result @@ -6,14 +6,14 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `i1` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP INDEX IF EXISTS i1 ON t1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP INDEX IF EXISTS i1 ON t1; Warnings: Note 1091 Can't DROP INDEX `i1`; check that it exists @@ -22,7 +22,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE OR REPLACE INDEX i1 ON t1(a); SHOW CREATE TABLE t1; Table Create Table @@ -30,7 +30,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `i1` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE OR REPLACE INDEX i1 ON t1(a,b); SHOW CREATE TABLE t1; Table Create Table @@ -38,7 +38,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `i1` (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE OR REPLACE INDEX IF NOT EXISTS i1 ON t1(b,a); ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS diff --git a/mysql-test/main/create_drop_role.test b/mysql-test/main/create_drop_role.test index 11bc832c6e9b3..808461ed3441c 100644 --- a/mysql-test/main/create_drop_role.test +++ b/mysql-test/main/create_drop_role.test @@ -1,3 +1,4 @@ +--source include/no_view_protocol.inc --source include/not_embedded.inc CREATE ROLE IF NOT EXISTS role1 WITH ADMIN user1; diff --git a/mysql-test/main/create_drop_server.result b/mysql-test/main/create_drop_server.result index 4f5d13b354145..dc3c5eefbf8d8 100644 --- a/mysql-test/main/create_drop_server.result +++ b/mysql-test/main/create_drop_server.result @@ -7,7 +7,7 @@ server_name username db server1 user1 test0 CREATE SERVER IF NOT EXISTS server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user2', HOST 'localhost', DATABASE 'test1'); Warnings: -Note 1476 The foreign server, server1, you are trying to create already exists +Note 1476 Cannot create foreign server 'server1' as it already exists SELECT server_name, username, db FROM mysql.servers; server_name username db server1 user1 test0 @@ -21,10 +21,10 @@ server_name username db DROP SERVER IF EXISTS server1; CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test0'); CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test1'); -ERROR HY000: The foreign server, server_1, you are trying to create already exists +ERROR HY000: Cannot create foreign server 'server_1' as it already exists CREATE SERVER IF NOT EXISTS server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test2'); Warnings: -Note 1476 The foreign server, server_1, you are trying to create already exists +Note 1476 Cannot create foreign server 'server_1' as it already exists SELECT server_name, username, db FROM mysql.servers; server_name username db server_1 mysqltest_1 test0 diff --git a/mysql-test/main/create_not_windows.result b/mysql-test/main/create_not_windows.result index abe76fd3fbec4..8dacf2894eb57 100644 --- a/mysql-test/main/create_not_windows.result +++ b/mysql-test/main/create_not_windows.result @@ -10,7 +10,7 @@ about:text CREATE TABLE `about:text` ( `_id` int(11) NOT NULL AUTO_INCREMENT, `about:text` varchar(255) NOT NULL DEFAULT '', PRIMARY KEY (`_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table `about:text`; use test; drop table if exists t1; diff --git a/mysql-test/main/create_or_replace.result b/mysql-test/main/create_or_replace.result index e1670aff9ceee..e7170632fd60c 100644 --- a/mysql-test/main/create_or_replace.result +++ b/mysql-test/main/create_or_replace.result @@ -1,3 +1,5 @@ +SET @save_persistent=@@GLOBAL.innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent=OFF; CREATE TABLE t2 (a int); INSERT INTO t2 VALUES(1),(2),(3); # @@ -31,13 +33,13 @@ Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TEMPORARY TABLE t1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; create temporary table t1 (i int) engine=InnoDB; create or replace temporary table t1 (a int, b int) engine=InnoDB; @@ -46,7 +48,7 @@ show create table t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `j` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE OR REPLACE TABLE t1 (a int); LOCK TABLES t1 write; @@ -60,13 +62,13 @@ Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TEMPORARY TABLE t1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE OR REPLACE TABLE t2 (a int); ERROR HY000: Table 't2' was not locked with LOCK TABLES DROP TABLE t1; @@ -88,7 +90,7 @@ Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `b` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TEMPORARY TABLE t1 AS SELECT a FROM t2; CREATE TEMPORARY TABLE IF NOT EXISTS t1(a int, b int) SELECT 1,2 FROM t2; @@ -101,7 +103,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `1` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; create table t1 (a int); create or replace table t1 as select * from t1; @@ -121,7 +123,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a int) SELECT * from t2; SELECT * FROM t1; @@ -142,7 +144,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `1` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE OR REPLACE TABLE t1 (a int); LOCK TABLES t1 write,t2 write; @@ -218,7 +220,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `j` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (i int) engine=InnoDB; lock table t1 write, t2 write; @@ -258,8 +260,7 @@ Note 1051 Unknown table 'test.t1,mysqltest2.t2' 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 -where table_name not like 'innodb_%_stats'; +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_BACKUP_DML NULL Backup lock @@ -272,8 +273,7 @@ ERROR 42000: A table must have at least 1 column show tables; Tables_in_test t2 -select * from information_schema.metadata_lock_info -where table_name not like 'innodb_%_stats'; +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_BACKUP_DML NULL Backup lock @@ -282,16 +282,14 @@ THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 create or replace table mysqltest2.t2; ERROR 42000: A table must have at least 1 column -select * from information_schema.metadata_lock_info -where table_name not like 'innodb_%_stats'; +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); create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; -select * from information_schema.metadata_lock_info -where table_name not like 'innodb_%_stats'; +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_BACKUP_DML NULL Backup lock @@ -304,8 +302,7 @@ ERROR 42S21: Duplicate column name 'a' show tables; Tables_in_test t2 -select * from information_schema.metadata_lock_info -where table_name not like 'innodb_%_stats'; +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_BACKUP_DML NULL Backup lock @@ -314,16 +311,14 @@ THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 create or replace table mysqltest2.t2 (a int) select 1 as 'a', 2 as 'a'; ERROR 42S21: Duplicate column name 'a' -select * from information_schema.metadata_lock_info -where table_name not like 'innodb_%_stats'; +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 -where table_name not like 'innodb_%_stats'; +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 @@ -335,8 +330,7 @@ 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 -where table_name not like 'innodb_%_stats'; +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 @@ -377,7 +371,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (b int); lock tables t1 write, t2 read; @@ -392,7 +386,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create or replace table t1 like t2; create or replace table t1 like t1; @@ -452,8 +446,7 @@ drop view t1; # create table t1 (a int); lock table t1 write, t2 read; -select * from information_schema.metadata_lock_info -where table_name not like 'innodb_%_stats'; +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_BACKUP_DML NULL Backup lock @@ -461,8 +454,7 @@ THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # 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 -where table_name not like 'innodb_%_stats'; +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_BACKUP_DML NULL Backup lock @@ -470,8 +462,7 @@ THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # 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 -where table_name not like 'innodb_%_stats'; +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_BACKUP_DML NULL Backup lock @@ -479,8 +470,7 @@ THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # 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 -where table_name not like 'innodb_%_stats'; +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_BACKUP_DML NULL Backup lock @@ -577,4 +567,17 @@ SELECT * FROM t3; ERROR HY000: Table 't3' was not locked with LOCK TABLES UNLOCK TABLES; DROP TABLE t3; +# +# MDEV-29697 Assertion failure in Diagnostics_area::set_ok_status +# upon CREATE OR REPLACE causing ER_UPDATE_TABLE_USED +# +CREATE TABLE t (a INT) ENGINE=MyISAM; +CREATE TABLE tm (a INT) ENGINE=MERGE UNION(t); +CREATE OR REPLACE TABLE t LIKE tm; +ERROR HY000: Table 'tm' is specified twice, both as a target for 'CREATE' and as a separate source for data +DROP TABLE IF EXISTS tm, t; +# +# End of 10.3 tests +# # End of 10.4 tests +SET GLOBAL innodb_stats_persistent=@save_persistent; diff --git a/mysql-test/main/create_or_replace.test b/mysql-test/main/create_or_replace.test index 4b954263a8754..58221dde4fe88 100644 --- a/mysql-test/main/create_or_replace.test +++ b/mysql-test/main/create_or_replace.test @@ -5,6 +5,9 @@ --source include/have_innodb.inc --source include/have_metadata_lock_info.inc +SET @save_persistent=@@GLOBAL.innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent=OFF; + # # Create help table # @@ -41,7 +44,7 @@ DROP TEMPORARY TABLE t1; --echo # --echo # Testing with temporary tables --echo # - +--disable_view_protocol CREATE OR REPLACE TABLE t1 (a int); CREATE OR REPLACE TEMPORARY TABLE t1 (a int); CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int); @@ -101,6 +104,7 @@ create or replace table t1 as select a from (select a from t1) as t3; --error ER_UPDATE_TABLE_USED create or replace table t1 as select a from t2 where t2.a in (select a from t1); drop table t1; +--enable_view_protocol --echo # --echo # Testing with normal tables @@ -123,6 +127,7 @@ CREATE OR REPLACE TABLE t1 AS SELECT 1; SHOW CREATE TABLE t1; DROP TABLE t1; +--disable_service_connection # Using lock tables with CREATE OR REPLACE CREATE OR REPLACE TABLE t1 (a int); LOCK TABLES t1 write,t2 write; @@ -204,6 +209,7 @@ drop table t1,t3,t4; --echo # Test the meta data locks are freed properly --echo # +--disable_view_protocol create database mysqltest2; drop table if exists test.t1,mysqltest2.t2; @@ -212,21 +218,18 @@ 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 -where table_name not like 'innodb_%_stats'; +select * from information_schema.metadata_lock_info; --error ER_TABLE_MUST_HAVE_COLUMNS create or replace table test.t1; show tables; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info -where table_name not like 'innodb_%_stats'; +select * from information_schema.metadata_lock_info; --error ER_TABLE_MUST_HAVE_COLUMNS create or replace table mysqltest2.t2; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info -where table_name not like 'innodb_%_stats'; +select * from information_schema.metadata_lock_info; create table t1 (i int); drop table t1; @@ -235,21 +238,18 @@ 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 -where table_name not like 'innodb_%_stats'; +select * from information_schema.metadata_lock_info; --error ER_DUP_FIELDNAME create or replace table test.t1 (a int) select 1 as 'a', 2 as 'a'; show tables; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info -where table_name not like 'innodb_%_stats'; +select * from information_schema.metadata_lock_info; --error ER_DUP_FIELDNAME create or replace table mysqltest2.t2 (a int) select 1 as 'a', 2 as 'a'; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info -where table_name not like 'innodb_%_stats'; +select * from information_schema.metadata_lock_info; create table t1 (i int); drop table t1; @@ -258,8 +258,7 @@ 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 -where table_name not like 'innodb_%_stats'; +select * from information_schema.metadata_lock_info; unlock tables; drop table test.t1,mysqltest2.t2; @@ -268,8 +267,7 @@ 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 -where table_name not like 'innodb_%_stats'; +select * from information_schema.metadata_lock_info; unlock tables; drop table t1; @@ -294,7 +292,7 @@ show tables; select * from information_schema.metadata_lock_info; create table t1 (i int); drop table t1; - +--enable_view_protocol --echo # --echo # Testing CREATE .. LIKE @@ -369,24 +367,20 @@ create table t1 (a int); lock table t1 write, t2 read; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info -where table_name not like 'innodb_%_stats'; +select * from information_schema.metadata_lock_info; create or replace table t1 (i int); --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info -where table_name not like 'innodb_%_stats'; +select * from information_schema.metadata_lock_info; create or replace table t1 like t2; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info -where table_name not like 'innodb_%_stats'; +select * from information_schema.metadata_lock_info; create or replace table t1 select 1 as f1; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info -where table_name not like 'innodb_%_stats'; +select * from information_schema.metadata_lock_info; drop table t1; unlock tables; @@ -516,5 +510,24 @@ CREATE OR REPLACE TEMPORARY TABLE t2(c INT DEFAULT ''); SELECT * FROM t3; UNLOCK TABLES; DROP TABLE t3; +--enable_service_connection + +--echo # +--echo # MDEV-29697 Assertion failure in Diagnostics_area::set_ok_status +--echo # upon CREATE OR REPLACE causing ER_UPDATE_TABLE_USED +--echo # +CREATE TABLE t (a INT) ENGINE=MyISAM; +CREATE TABLE tm (a INT) ENGINE=MERGE UNION(t); +--error ER_UPDATE_TABLE_USED +CREATE OR REPLACE TABLE t LIKE tm; + +# Cleanup +DROP TABLE IF EXISTS tm, t; + +--echo # +--echo # End of 10.3 tests +--echo # --echo # End of 10.4 tests + +SET GLOBAL innodb_stats_persistent=@save_persistent; diff --git a/mysql-test/main/create_or_replace2.result b/mysql-test/main/create_or_replace2.result index 6be0d46bdc11b..c84d54004caa2 100644 --- a/mysql-test/main/create_or_replace2.result +++ b/mysql-test/main/create_or_replace2.result @@ -16,7 +16,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection slave; SHOW TABLES; Tables_in_test diff --git a/mysql-test/main/create_or_replace_permission.result b/mysql-test/main/create_or_replace_permission.result index b9938e4270ac3..1ea15d9621b16 100644 --- a/mysql-test/main/create_or_replace_permission.result +++ b/mysql-test/main/create_or_replace_permission.result @@ -32,7 +32,7 @@ CREATE OR REPLACE DATABASE db2; ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'db2' USE db1; CREATE OR REPLACE TABLE t1(id INT); -ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table `db1`.`t1` CREATE OR REPLACE PROCEDURE proc1 (OUT cnt INT) BEGIN END; ERROR 42000: alter routine command denied to user 'mysqltest_1'@'localhost' for routine 'db1.proc1' CREATE OR REPLACE FUNCTION lookup RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; diff --git a/mysql-test/main/create_select.result b/mysql-test/main/create_select.result new file mode 100644 index 0000000000000..bf879192736a9 --- /dev/null +++ b/mysql-test/main/create_select.result @@ -0,0 +1,61 @@ +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +# +# Testcase for BUG#4551 +# +CREATE TABLE t1 ( a int ); +INSERT INTO t1 VALUES (1),(2),(1); +CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +select * from t2; +ERROR 42S02: Table 'test.t2' doesn't exist +CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +select * from t2; +ERROR 42S02: Table 'test.t2' doesn't exist +CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +select * from t2; +ERROR 42S02: Table 'test.t2' doesn't exist +CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +select * from t2; +ERROR 42S02: Table 'test.t2' doesn't exist +drop table t1; +# +# End of 4.1 tests +# +# +# MDEV-28393 Server crashes in TABLE::mark_default_fields_for_write +# +create table t1 (a int, b text not null default ''); +alter table t1 character set = utf8; +create table t2 select * from t1; +insert into t1 values (1,''); +drop table t1, t2; +# +# End of 10.2 tests +# +set sql_mode='ignore_bad_table_options'; +create table t1 ( +f1 int invisible, +f2 int comment 'a comment', +f3 int foo="bar", +f4 int check(f4 < 10), +f5 int without system versioning +) with system versioning as select 1 as f1,2 as f2,3 as f3,4 as f4,5 as f5; +Warnings: +Warning 1911 Unknown option 'foo' +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) INVISIBLE DEFAULT NULL, + `f2` int(11) DEFAULT NULL COMMENT 'a comment', + `f3` int(11) DEFAULT NULL `foo`='bar', + `f4` int(11) DEFAULT NULL CHECK (`f4` < 10), + `f5` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING +drop table t1; +set sql_mode=default; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/create_select.test b/mysql-test/main/create_select.test new file mode 100644 index 0000000000000..d91f71133a0de --- /dev/null +++ b/mysql-test/main/create_select.test @@ -0,0 +1,68 @@ +# This does not work for RBR yet. +--source include/have_innodb.inc +--source include/have_binlog_format_mixed_or_statement.inc + +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); + +--echo # +--echo # Testcase for BUG#4551 +--echo # + +# The bug was that when the table was TEMPORARY, it was not deleted if +# the CREATE SELECT failed (the code intended too, but it actually +# didn't). And as the CREATE TEMPORARY TABLE was not written to the +# binlog if it was a transactional table, it resulted in an +# inconsistency between binlog and the internal list of temp tables. + +CREATE TABLE t1 ( a int ); +INSERT INTO t1 VALUES (1),(2),(1); +--error ER_DUP_ENTRY +CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1; +--error ER_NO_SUCH_TABLE +select * from t2; +--error ER_DUP_ENTRY +CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1; +--error ER_NO_SUCH_TABLE +select * from t2; +--error ER_DUP_ENTRY +CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1; +--error ER_NO_SUCH_TABLE +select * from t2; +--error ER_DUP_ENTRY +CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1; +--error ER_NO_SUCH_TABLE +select * from t2; +drop table t1; + +--echo # +--echo # End of 4.1 tests +--echo # + +--echo # +--echo # MDEV-28393 Server crashes in TABLE::mark_default_fields_for_write +--echo # +create table t1 (a int, b text not null default ''); +alter table t1 character set = utf8; +create table t2 select * from t1; +insert into t1 values (1,''); +drop table t1, t2; + +--echo # +--echo # End of 10.2 tests +--echo # + +set sql_mode='ignore_bad_table_options'; +create table t1 ( + f1 int invisible, + f2 int comment 'a comment', + f3 int foo="bar", + f4 int check(f4 < 10), + f5 int without system versioning +) with system versioning as select 1 as f1,2 as f2,3 as f3,4 as f4,5 as f5; +show create table t1; +drop table t1; +set sql_mode=default; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/create_select_tmp.result b/mysql-test/main/create_select_tmp.result deleted file mode 100644 index 2842ab26c4250..0000000000000 --- a/mysql-test/main/create_select_tmp.result +++ /dev/null @@ -1,41 +0,0 @@ -drop table if exists t1, t2; -CREATE TABLE t1 ( a int ); -INSERT INTO t1 VALUES (1),(2),(1); -CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1; -ERROR 23000: Duplicate entry '1' for key 'PRIMARY' -select * from t2; -ERROR 42S02: Table 'test.t2' doesn't exist -CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1; -ERROR 23000: Duplicate entry '1' for key 'PRIMARY' -select * from t2; -ERROR 42S02: Table 'test.t2' doesn't exist -CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1; -ERROR 23000: Duplicate entry '1' for key 'PRIMARY' -select * from t2; -ERROR 42S02: Table 'test.t2' doesn't exist -CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1; -ERROR 23000: Duplicate entry '1' for key 'PRIMARY' -select * from t2; -ERROR 42S02: Table 'test.t2' doesn't exist -drop table t1; -set sql_mode='ignore_bad_table_options'; -create table t1 ( -f1 int invisible, -f2 int comment 'a comment', -f3 int foo="bar", -f4 int check(f4 < 10), -f5 int without system versioning -) with system versioning as select 1 as f1,2 as f2,3 as f3,4 as f4,5 as f5; -Warnings: -Warning 1911 Unknown option 'foo' -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f1` int(11) INVISIBLE DEFAULT NULL, - `f2` int(11) DEFAULT NULL COMMENT 'a comment', - `f3` int(11) DEFAULT NULL `foo`='bar', - `f4` int(11) DEFAULT NULL CHECK (`f4` < 10), - `f5` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING -drop table t1; -set sql_mode=default; diff --git a/mysql-test/main/create_select_tmp.test b/mysql-test/main/create_select_tmp.test deleted file mode 100644 index 3ed885ea38226..0000000000000 --- a/mysql-test/main/create_select_tmp.test +++ /dev/null @@ -1,53 +0,0 @@ -# Testcase for BUG#4551 -# The bug was that when the table was TEMPORARY, it was not deleted if -# the CREATE SELECT failed (the code intended too, but it actually -# didn't). And as the CREATE TEMPORARY TABLE was not written to the -# binlog if it was a transactional table, it resulted in an -# inconsistency between binlog and the internal list of temp tables. - -# This does not work for RBR yet. ---source include/have_binlog_format_mixed_or_statement.inc - ---disable_query_log -CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); ---enable_query_log - --- source include/have_innodb.inc ---disable_warnings -drop table if exists t1, t2; ---enable_warnings -CREATE TABLE t1 ( a int ); -INSERT INTO t1 VALUES (1),(2),(1); ---error ER_DUP_ENTRY -CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1; ---error 1146 -select * from t2; ---error ER_DUP_ENTRY -CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1; ---error 1146 -select * from t2; ---error ER_DUP_ENTRY -CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1; ---error 1146 -select * from t2; ---error ER_DUP_ENTRY -CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1; ---error 1146 -select * from t2; -drop table t1; - -# End of 4.1 tests - -set sql_mode='ignore_bad_table_options'; -create table t1 ( - f1 int invisible, - f2 int comment 'a comment', - f3 int foo="bar", - f4 int check(f4 < 10), - f5 int without system versioning -) with system versioning as select 1 as f1,2 as f2,3 as f3,4 as f4,5 as f5; -show create table t1; -drop table t1; -set sql_mode=default; - -# End of 10.4 tests diff --git a/mysql-test/main/create_utf8.result b/mysql-test/main/create_utf8.result index 3d6651260ce4e..a986454bbeb7c 100644 --- a/mysql-test/main/create_utf8.result +++ b/mysql-test/main/create_utf8.result @@ -43,7 +43,7 @@ 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 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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` utf8mb3 utf8mb3_general_ci diff --git a/mysql-test/main/create_utf8.test b/mysql-test/main/create_utf8.test index 40e814834bc3b..a868b84767927 100644 --- a/mysql-test/main/create_utf8.test +++ b/mysql-test/main/create_utf8.test @@ -1,6 +1,7 @@ # # Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte # +--disable_service_connection set names utf8; create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45; @@ -25,6 +26,7 @@ from имя_таблицы_в_кодировке_утф8_длиной_больш # database, table, field, key, view select * from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; +--disable_view_protocol --sorted_result select TABLE_NAME from information_schema.tables where table_schema='test'; @@ -37,6 +39,7 @@ table_schema='test'; select TABLE_NAME from information_schema.views where table_schema='test'; +--enable_view_protocol show create table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; show create view имя_вью_кодировке_утф8_длиной_больше_чем_42; @@ -78,3 +81,4 @@ return 0; drop view имя_вью_кодировке_утф8_длиной_больше_чем_42; drop table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; set names default; +--enable_service_connection diff --git a/mysql-test/main/create_w_max_indexes_64.result b/mysql-test/main/create_w_max_indexes_64.result index c937f3af312a7..ecf7ee1e59424 100644 --- a/mysql-test/main/create_w_max_indexes_64.result +++ b/mysql-test/main/create_w_max_indexes_64.result @@ -277,7 +277,7 @@ t1 CREATE TABLE `t1` ( KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci flush tables; show create table t1; Table Create Table @@ -362,7 +362,7 @@ t1 CREATE TABLE `t1` ( KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int); @@ -642,7 +642,7 @@ t1 CREATE TABLE `t1` ( KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci flush tables; show create table t1; Table Create Table @@ -727,7 +727,7 @@ t1 CREATE TABLE `t1` ( KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 add key a065_long_123456789_123456789_123456789_123456789_123456789_1234 ( c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); @@ -778,6 +778,6 @@ t1 CREATE TABLE `t1` ( `c31` int(11) DEFAULT NULL, `c32` int(11) DEFAULT NULL, `c33` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; "End of tests" diff --git a/mysql-test/main/create_windows.result b/mysql-test/main/create_windows.result new file mode 100644 index 0000000000000..c064eb7c86fa0 --- /dev/null +++ b/mysql-test/main/create_windows.result @@ -0,0 +1,2 @@ +create table `...................................................`(i int); +ERROR HY000: Can't create table `test`.`...................................................` (errno: 38 "Filename too long") diff --git a/mysql-test/main/create_windows.test b/mysql-test/main/create_windows.test new file mode 100644 index 0000000000000..6fe99f6aeb62c --- /dev/null +++ b/mysql-test/main/create_windows.test @@ -0,0 +1,10 @@ +--source include/windows.inc + +# MDEV-28746 Wrong error code ER_BAD_DB_ERROR for long filenames + +# There are 51 dots in the table name below, with every dot encoded with 5 +# bytes in "mysql file name encoding", making the filename length 255 byte. +# Adding drive and extension makes it exceed MAX_PATH= 260 bytes +let $t = `SELECT(REPEAT('.',51))`; +--error ER_CANT_CREATE_TABLE +eval create table `$t`(i int); diff --git a/mysql-test/main/cte_cycle.result b/mysql-test/main/cte_cycle.result index e7e0cc5f8016b..e66d090b3c72f 100644 --- a/mysql-test/main/cte_cycle.result +++ b/mysql-test/main/cte_cycle.result @@ -67,7 +67,7 @@ FROM t1, cte WHERE t1.from_ = cte.to_ select * from cte; 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 with recursive cte(`depth`,`from_`,`to_`) as (select 0 AS `depth`,1 AS `from_`,1 AS `to_` union select `cte`.`depth` + 1 AS `depth+1`,`test`.`t1`.`from_` AS `from_`,`test`.`t1`.`to_` AS `to_` from (`test`.`t1` join `cte`) where `test`.`t1`.`from_` = `cte`.`to_`) CYCLE `from_`,`to_` RESTRICT select `cte`.`depth` AS `depth`,`cte`.`from_` AS `from_`,`cte`.`to_` AS `to_` from `cte` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with recursive cte(`depth`,`from_`,`to_`) as (select 0 AS `depth`,1 AS `from_`,1 AS `to_` union select `cte`.`depth` + 1 AS `depth+1`,`t1`.`from_` AS `from_`,`t1`.`to_` AS `to_` from (`t1` join `cte`) where `t1`.`from_` = `cte`.`to_`) CYCLE `from_`,`to_` RESTRICT select `cte`.`depth` AS `depth`,`cte`.`from_` AS `from_`,`cte`.`to_` AS `to_` from `cte` latin1 latin1_swedish_ci select * from v1; depth from_ to_ 0 1 1 diff --git a/mysql-test/main/cte_grant.result b/mysql-test/main/cte_grant.result index 2ee31be3435dd..96588d26b6cfa 100644 --- a/mysql-test/main/cte_grant.result +++ b/mysql-test/main/cte_grant.result @@ -51,7 +51,7 @@ c select d from mysqltest.v2; ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 'v2' select * from mysqltest.v3; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v3' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v3` connection root; grant select on mysqltest.v3 to mysqltest_1@localhost; connection user1; @@ -116,7 +116,7 @@ revoke SELECT on db.t1 from foo@localhost; connection con1; with cte as (select * from t1 where i < 4) select * from cte; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `db`.`t1` disconnect con1; connection default; drop database db; diff --git a/mysql-test/main/cte_nonrecursive.result b/mysql-test/main/cte_nonrecursive.result index f87f0f128dd71..f7871d4f92921 100644 --- a/mysql-test/main/cte_nonrecursive.result +++ b/mysql-test/main/cte_nonrecursive.result @@ -571,7 +571,7 @@ with t as (select a from t1 where b >= 'c') select * from t2,t where t2.c=t.a; 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 with t as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `test`.`t2`.`c` AS `c`,`t`.`a` AS `a` from (`test`.`t2` join `t`) where `test`.`t2`.`c` = `t`.`a` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `t1`.`a` AS `a` from `t1` where `t1`.`b` >= 'c')select `t2`.`c` AS `c`,`t`.`a` AS `a` from (`t2` join `t`) where `t2`.`c` = `t`.`a` latin1 latin1_swedish_ci select * from v1; c a 4 4 @@ -588,7 +588,7 @@ with t as (select a, count(*) from t1 where b >= 'c' group by a) select * from t2,t where t2.c=t.a; 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 with t as (select `test`.`t1`.`a` AS `a`,count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`b` >= 'c' group by `test`.`t1`.`a`)select `test`.`t2`.`c` AS `c`,`t`.`a` AS `a`,`t`.`count(*)` AS `count(*)` from (`test`.`t2` join `t`) where `test`.`t2`.`c` = `t`.`a` latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with t as (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` where `t1`.`b` >= 'c' group by `t1`.`a`)select `t2`.`c` AS `c`,`t`.`a` AS `a`,`t`.`count(*)` AS `count(*)` from (`t2` join `t`) where `t2`.`c` = `t`.`a` latin1 latin1_swedish_ci select * from v2; c a count(*) 4 4 2 @@ -606,7 +606,7 @@ with t(c) as (select a from t1 where b >= 'c') select * from t r1 where r1.c=4; 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 with t(`c`) as (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `r1`.`c` AS `c` from `t` `r1` where `r1`.`c` = 4 latin1 latin1_swedish_ci +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS with t(`c`) as (select `t1`.`a` AS `c` from `t1` where `t1`.`b` >= 'c')select `r1`.`c` AS `c` from `t` `r1` where `r1`.`c` = 4 latin1 latin1_swedish_ci select * from v3; c 4 @@ -618,7 +618,7 @@ with t(c) as (select a from t1 where b >= 'c') select * from t r1, t r2 where r1.c=r2.c and r2.c=4; show create view v4; View Create View character_set_client collation_connection -v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS with t(`c`) as (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `r1`.`c` AS `c`,`r2`.`c` AS `d` from (`t` `r1` join `t` `r2`) where `r1`.`c` = `r2`.`c` and `r2`.`c` = 4 latin1 latin1_swedish_ci +v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS with t(`c`) as (select `t1`.`a` AS `c` from `t1` where `t1`.`b` >= 'c')select `r1`.`c` AS `c`,`r2`.`c` AS `d` from (`t` `r1` join `t` `r2`) where `r1`.`c` = `r2`.`c` and `r2`.`c` = 4 latin1 latin1_swedish_ci select * from v4; c d 4 4 @@ -1021,10 +1021,10 @@ select a from t1; show table status; 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 with t as (select `s`.`a` AS `a` from (select `test`.`t1`.`a` AS `a` from `test`.`t1`) `s`), r as (select `t`.`a` AS `a` from (`test`.`t2` join `t`) where `test`.`t2`.`b` = `t`.`a`)select `r`.`a` AS `a` from `r` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `s`.`a` AS `a` from (select `t1`.`a` AS `a` from `t1`) `s`), r as (select `t`.`a` AS `a` from (`t2` join `t`) where `t2`.`b` = `t`.`a`)select `r`.`a` AS `a` from `r` latin1 latin1_swedish_ci 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 with t as (select `s`.`a` AS `a` from (select `test`.`t1`.`a` AS `a` from `test`.`t1`) `s`), r as (select `t`.`a` AS `a` from (`test`.`t2` join `t`) where `test`.`t2`.`b` = `t`.`a`)select `test`.`t1`.`a` AS `a` from `test`.`t1` latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with t as (select `s`.`a` AS `a` from (select `t1`.`a` AS `a` from `t1`) `s`), r as (select `t`.`a` AS `a` from (`t2` join `t`) where `t2`.`b` = `t`.`a`)select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci select * from v1; a 2 @@ -1349,7 +1349,7 @@ r.r_regionkey in select r_regionkey from t where r_name <> "ASIA"); show create view v; View Create View character_set_client collation_connection -v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `n`.`n_nationkey` AS `n_nationkey`,`n`.`n_name` AS `n_name`,`n`.`n_regionkey` AS `n_regionkey`,`r`.`r_regionkey` AS `r_regionkey`,`r`.`r_name` AS `r_name` from (`test`.`nation` `n` join `test`.`region` `r`) where `n`.`n_regionkey` = `r`.`r_regionkey` and `r`.`r_regionkey` in (with t as (select `test`.`region`.`r_regionkey` AS `r_regionkey`,`test`.`region`.`r_name` AS `r_name` from `test`.`region` where `test`.`region`.`r_regionkey` <= 3)select `t`.`r_regionkey` from `t` where `t`.`r_name` <> 'ASIA') latin1 latin1_swedish_ci +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `n`.`n_nationkey` AS `n_nationkey`,`n`.`n_name` AS `n_name`,`n`.`n_regionkey` AS `n_regionkey`,`r`.`r_regionkey` AS `r_regionkey`,`r`.`r_name` AS `r_name` from (`nation` `n` join `region` `r`) where `n`.`n_regionkey` = `r`.`r_regionkey` and `r`.`r_regionkey` in (with t as (select `region`.`r_regionkey` AS `r_regionkey`,`region`.`r_name` AS `r_name` from `region` where `region`.`r_regionkey` <= 3)select `t`.`r_regionkey` from `t` where `t`.`r_name` <> 'ASIA') latin1 latin1_swedish_ci select * from v; n_nationkey n_name n_regionkey r_regionkey r_name 0 ALGERIA 0 0 AFRICA @@ -2185,6 +2185,39 @@ select * from t1; a 7 drop table t1,t2; +# +# MDEV-25766: Unused CTE lead to a crash in +# find_field_in_tables/find_order_in_list +# +create table t1 (f1 INTEGER); +create view v1 as +select +subq_0.c4 as c2, +subq_0.c4 as c4 +from +(select +ref_0.f1 as c4 +from +t1 as ref_0 +where (select 1) +) as subq_0 +order by c2, c4 desc; +WITH +unused_with AS (select +subq_0.c4 as c6 +from +(select +11 as c4 +from +v1 as ref_0 +) as subq_0, +v1 as ref_2 +) +select 1 ; +1 +1 +drop view v1; +drop table t1; # End of 10.2 tests # # MDEV-21673: several references to CTE that uses diff --git a/mysql-test/main/cte_nonrecursive.test b/mysql-test/main/cte_nonrecursive.test index 0e58c4aa3e196..c420a5e0483e2 100644 --- a/mysql-test/main/cte_nonrecursive.test +++ b/mysql-test/main/cte_nonrecursive.test @@ -1048,6 +1048,8 @@ drop table t1; --echo # MDEV-16473: query with CTE when no database is set --echo # +# Enable view protocol after fix MDEV-27944 +--disable_view_protocol create database db_mdev_16473; use db_mdev_16473; drop database db_mdev_16473; @@ -1071,6 +1073,7 @@ select * from cte, db_mdev_16473.t1 as t where cte.a=t.a; drop database db_mdev_16473; use test; +--enable_view_protocol --echo # --echo # MDEV-17154: using parameter markers for PS within CTEs more than once @@ -1217,6 +1220,8 @@ DROP TABLE test.t; --echo # MDEV-22781: create view with CTE without default database --echo # +# Enable view protocol after fix MDEV-27944 +--disable_view_protocol create database db; use db; drop database db; @@ -1242,6 +1247,7 @@ drop table db1.t1; drop database db1; use test; +--enable_view_protocol --echo # --echo # MDEV-24597: CTE with union used multiple times in query @@ -1637,6 +1643,42 @@ select * from t1; drop table t1,t2; +--echo # +--echo # MDEV-25766: Unused CTE lead to a crash in +--echo # find_field_in_tables/find_order_in_list +--echo # + +create table t1 (f1 INTEGER); + +create view v1 as +select + subq_0.c4 as c2, + subq_0.c4 as c4 + from + (select + ref_0.f1 as c4 + from + t1 as ref_0 + where (select 1) + ) as subq_0 + order by c2, c4 desc; + +WITH +unused_with AS (select + subq_0.c4 as c6 + from + (select + 11 as c4 + from + v1 as ref_0 + ) as subq_0, + v1 as ref_2 +) +select 1 ; + +drop view v1; +drop table t1; + --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/cte_nonrecursive_not_embedded.result b/mysql-test/main/cte_nonrecursive_not_embedded.result index c96a1ec2849d6..fa4d97d7bc505 100644 --- a/mysql-test/main/cte_nonrecursive_not_embedded.result +++ b/mysql-test/main/cte_nonrecursive_not_embedded.result @@ -39,7 +39,7 @@ cte3 AS cte4 AS (SELECT cte2.a FROM t2,cte2 WHERE cte2.a = t2.a) SELECT * FROM cte4 as r; -ERROR 42000: SELECT command denied to user 'u1'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'u1'@'localhost' for table `db`.`t2` disconnect u1; connection default; DROP USER 'u1'@'localhost'; diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result index e2ca6d0b11867..de9a979dd94a3 100644 --- a/mysql-test/main/cte_recursive.result +++ b/mysql-test/main/cte_recursive.result @@ -818,7 +818,7 @@ where p.id = a.father or p.id = a.mother select * from ancestors; 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 with recursive ancestors as (select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' and `test`.`folks`.`dob` = '2000-01-01' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`test`.`folks` `p` join `ancestors` `a`) where `p`.`id` = `a`.`father` or `p`.`id` = `a`.`mother`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with recursive ancestors as (select `folks`.`id` AS `id`,`folks`.`name` AS `name`,`folks`.`dob` AS `dob`,`folks`.`father` AS `father`,`folks`.`mother` AS `mother` from `folks` where `folks`.`name` = 'Me' and `folks`.`dob` = '2000-01-01' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `a`) where `p`.`id` = `a`.`father` or `p`.`id` = `a`.`mother`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci select * from v1; id name dob father mother 100 Me 2000-01-01 20 30 @@ -849,7 +849,7 @@ where p.id = ma.mother select * from ancestors; 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 with recursive ancestors as (select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`test`.`folks` `p` join `ancestors` `fa`) where `p`.`id` = `fa`.`father` union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`test`.`folks` `p` join `ancestors` `ma`) where `p`.`id` = `ma`.`mother`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with recursive ancestors as (select `folks`.`id` AS `id`,`folks`.`name` AS `name`,`folks`.`dob` AS `dob`,`folks`.`father` AS `father`,`folks`.`mother` AS `mother` from `folks` where `folks`.`name` = 'Me' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `fa`) where `p`.`id` = `fa`.`father` union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `ma`) where `p`.`id` = `ma`.`mother`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci select * from v2; id name dob father mother 100 Me 2000-01-01 20 30 @@ -4122,10 +4122,6 @@ ANALYZE { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", - "r_loops": 0, - "r_rows": null, "query_specifications": [ { "query_block": { @@ -4334,7 +4330,9 @@ drop table t1; # # MDEV-24019: query with recursive CTE when no default database is set # -drop database test; +create database dummy; +use dummy; +drop database dummy; with recursive a as (select 1 from dual union select * from a as r) select * from a; @@ -4373,7 +4371,6 @@ a 1 deallocate prepare stmt; drop database db1; -create database test; use test; # # MDEV-23406: query with mutually recursive CTEs when big_tables=1 @@ -4976,8 +4973,911 @@ a 0 NULL DROP TABLE t1; +# +# MDEV-12325 Unexpected data type and truncation when using CTE +# +CREATE TABLE t1 +( +id INT, mid INT, name TEXT +); +INSERT INTO t1 VALUES (0,NULL,'Name'),(1,0,'Name1'),(2,0,'Name2'),(11,1,'Name11'),(12,1,'Name12'); +WITH RECURSIVE +cteReports (level, id, mid, name) AS +( +SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL +UNION ALL +SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e +INNER JOIN cteReports r ON e.mid = r.id +) +SELECT +level, id, mid, name, +(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid; +ERROR 22003: Out of range value for column 'mid' at row 2 +create table t2 as WITH RECURSIVE +cteReports (level, id, mid, name) AS +( +SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL +UNION ALL +SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e +INNER JOIN cteReports r ON e.mid = r.id +) +SELECT +level, id, mid, name, +(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid;; +ERROR 22003: Out of range value for column 'mid' at row 2 +create table t2 ignore as WITH RECURSIVE +cteReports (level, id, mid, name) AS +( +SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL +UNION ALL +SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e +INNER JOIN cteReports r ON e.mid = r.id +) +SELECT +level, id, mid, name, +(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid;; +Warnings: +Warning 1264 Out of range value for column 'mid' at row 2 +Warning 1264 Out of range value for column 'mid' at row 3 +Warning 1264 Out of range value for column 'mid' at row 4 +Warning 1264 Out of range value for column 'mid' at row 5 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `level` int(1) DEFAULT NULL, + `id` int(11) DEFAULT NULL, + `mid` int(11) DEFAULT NULL, + `name` text DEFAULT NULL, + `mname` text DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +insert into t2 WITH RECURSIVE +cteReports (level, id, mid, name) AS +( +SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL +UNION ALL +SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e +INNER JOIN cteReports r ON e.mid = r.id +) +SELECT +level, id, mid, name, +(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid;; +ERROR 22003: Out of range value for column 'mid' at row 2 +insert ignore into t2 WITH RECURSIVE +cteReports (level, id, mid, name) AS +( +SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL +UNION ALL +SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e +INNER JOIN cteReports r ON e.mid = r.id +) +SELECT +level, id, mid, name, +(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid;; +Warnings: +Warning 1264 Out of range value for column 'mid' at row 2 +Warning 1264 Out of range value for column 'mid' at row 3 +Warning 1264 Out of range value for column 'mid' at row 4 +Warning 1264 Out of range value for column 'mid' at row 5 +drop table t2; +set @@sql_mode=""; +WITH RECURSIVE +cteReports (level, id, mid, name) AS +( +SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL +UNION ALL +SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e +INNER JOIN cteReports r ON e.mid = r.id +) +SELECT +level, id, mid, name, +(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid; +level id mid name mname +1 0 NULL Name NULL +2 1 2147483647 Name1 NULL +2 2 2147483647 Name2 NULL +3 11 2147483647 Name11 NULL +3 12 2147483647 Name12 NULL +Warnings: +Warning 1264 Out of range value for column 'mid' at row 2 +Warning 1264 Out of range value for column 'mid' at row 3 +Warning 1264 Out of range value for column 'mid' at row 4 +Warning 1264 Out of range value for column 'mid' at row 5 +create table t2 as WITH RECURSIVE +cteReports (level, id, mid, name) AS +( +SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL +UNION ALL +SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e +INNER JOIN cteReports r ON e.mid = r.id +) +SELECT +level, id, mid, name, +(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid;; +Warnings: +Warning 1264 Out of range value for column 'mid' at row 2 +Warning 1264 Out of range value for column 'mid' at row 3 +Warning 1264 Out of range value for column 'mid' at row 4 +Warning 1264 Out of range value for column 'mid' at row 5 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `level` int(1) DEFAULT NULL, + `id` int(11) DEFAULT NULL, + `mid` int(11) DEFAULT NULL, + `name` text DEFAULT NULL, + `mname` text DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +set @@sql_mode=default; +drop table t1,t2; +# +# MDEV-29361: Embedded recursive / non-recursive CTE within +# the scope of another embedded CTE with the same name +# +create table t1 (a int); +insert into t1 values (4), (5); +create table t2 (a int); +insert into t2 values (6), (8); +create table t3 (a int); +insert into t3 values (1), (9); +with recursive +x as +( +select a from t1 union select a+1 from x as r1 where a < 7 +) +select * from x as s1; +a +4 +5 +6 +7 +with recursive +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2; +a +6 +8 +10 +with +cte as +( +with recursive +x as +( +select a from t1 union select a+1 from x as r1 where a < 7 +) +select * from x as s1 +where s1.a in ( +with recursive +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2 +) +) +select * from cte; +a +6 +with +cte as +( +with recursive +x(a) as +( +select a from t1 union select a+1 from x as r1 where a < 7 +) +select s1.a from x as s1, x +where s1.a = x.a and +x.a in ( +with recursive +x(a) as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2 +) +) +select * from cte; +a +6 +with +cte as +( +with +x as +( +select a from t1 union select a+1 from x as r1 where a < 7 +) +select * from x as s1 +where s1.a in ( +with recursive +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2 +) +) +select * from cte; +ERROR 42S02: Table 'test.x' doesn't exist +with +cte as +( +with recursive +x as +( +select a from t1 union select a+1 from x as r1 where a < 7 +) +select * from x as s1 +where s1.a in ( +with +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2 +) +) +select * from cte; +a +6 +7 +with +cte as +( +with +x as +( +select a from t1 union select a+1 from x as r1 where a < 7 +) +select * from x as s1 +where s1.a in ( +with +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2 +) +) +select * from cte; +ERROR 42S02: Table 'test.x' doesn't exist +with +cte as +( +with recursive +y as +( +select a from t1 union select a+1 from y as r1 where a < 7 +) +select * from y as s1 +where s1.a in ( +with +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2 +) +) +select * from cte; +ERROR 42S02: Table 'test.x' doesn't exist +with +cte as +( +with +y(a) as +( +select a+5 from t1 +) +select * from y as s1 +where s1.a in ( +with +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2 +) +) +select * from cte; +ERROR 42S02: Table 'test.x' doesn't exist +with +cte as +( +select ( +with +x as +( +select a from x as r1 +) +select * from x as s1 +where s1.a in ( +with recursive +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2 +) +) as r +from t3 +) +select * from cte; +ERROR 42S02: Table 'test.x' doesn't exist +with +cte as +( +select ( +with +x as +( +select a from x as r1 +) +select * from x as s1 +where s1.a < 5 and +s1.a in ( +with +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2 +) +) as r +from t3 +) +select * from cte; +ERROR 42S02: Table 'test.x' doesn't exist +with +cte as +( +select ( +with recursive +x(a) as +( +select a+3 from t1 union select a+1 from x as r1 where a < 7 +) +select * from x as s1 +where s1.a < 8 and +s1.a in ( +with recursive +x(a) as +( +select a-2 from t2 +union +select a+1 from x as r2 where a < 10 +) +select a from x as s2 +) +) as r +from t3 +) +select * from cte; +r +7 +7 +with +cte as +( +select ( +with recursive +x as +( +select a from t1 union select a+1 from x as r1 where a < 7 +) +select * from x as s1 +where s1.a in ( +with recursive +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2 +) +) as r +from t3 +) +select * from cte; +r +6 +6 +create table x (a int); +insert into x values (3), (7), (1), (5), (6); +with +cte as +( +select ( +with +x as +( +select ( select a from x as r1 ) as a from t1 +) +select * from x as s1 +where s1.a in ( +with recursive +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x s2 +) +) as r +from t3 +) +select * from cte; +ERROR 21000: Subquery returns more than 1 row +with +cte as +( +select ( +with +x as +( +select ( select a from x ) as a from t1 +) +select exists ( +with recursive +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x +) +) as r +from t3 +) +select * from cte; +r +1 +1 +with +cte_e as +( +with +cte as +( +select ( +with +x as +( +select ( select a from x ) from t1 +) +select exists ( +with recursive +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x +) +) as r +from t3 +) +select * from cte +) +select s1.*, s2.* from cte_e as s1, cte_e as s2; +r r +1 1 +1 1 +1 1 +1 1 +with +x as +( +select a from t1 union select a+1 from x as r1 where a < 7 +) +select * from x as s1; +a +4 +5 +2 +6 +7 +with +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2; +a +6 +8 +5 +9 +3 +7 +with recursive +x as +( +select a from t1 union select a+1 from x as r1 where a < 7 +) +select * from x as s1; +a +4 +5 +6 +7 +with recursive +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2; +a +6 +8 +10 +with +cte as +( +with +x as +( +select a from t1 union select a+1 from x as r1 where a < 7 +) +select * from x as s1 +where s1.a in ( +with recursive +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2 +) +) +select * from cte; +a +6 +with +cte as +( +with +x as +( +select a from t1 union select a+1 from x as r1 where a < 7 +) +select * from x as s1 +where s1.a in ( +with +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2 +) +) +select * from cte; +a +4 +6 +7 +with +cte as +( +with recursive +y as +( +select a from t1 union select a+1 from y as r1 where a < 7 +) +select * from y as s1 +where s1.a in ( +with +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2 +) +) +select * from cte; +a +5 +6 +7 +with +cte as +( +with +y(a) as +( +select a+5 from t1 +) +select * from y as s1 +where s1.a in ( +with +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2 +) +) +select * from cte; +a +9 +with +cte as +( +select ( +with +x as +( +select a from x as r1 +) +select * from x as s1 +where s1.a in ( +with +recursive x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2 +) +) as r +from t3 +) +select * from cte; +r +6 +6 +with +cte as +( +select ( +with +x as +( +select a from x as r1 +) +select * from x as s1 +where s1.a < 5 and +s1.a in ( +with +x as +( +select a from t2 +union +select a+2 from x as r2 where a < 10 +) +select a from x as s2 +) +) as r +from t3 +) +select * from cte; +r +3 +3 +drop table t1,t2,t3,x; +# +# MDEV-30248: Embedded non-recursive CTE referring to base table 'x' +# within a CTE with name 'x' used in a subquery from +# select list of another CTE +# +CREATE TABLE x (a int) ENGINE=MyISAM; +INSERT INTO x VALUES (3),(7),(1); +CREATE TABLE t1 (b int) ENGINE=MYISAM; +INSERT INTO t1 VALUES (1); +WITH cte AS +( +SELECT +( +WITH x AS +(WITH x AS (SELECT a FROM x AS t) SELECT 1 AS b) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +c +1 +WITH cte AS +( +SELECT +( +WITH x AS +(WITH x AS (SELECT a FROM x AS t) SELECT b FROM t1) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +c +1 +WITH cte AS +( +SELECT +( +WITH x AS +(WITH y AS (SELECT a FROM x AS t) SELECT b FROM t1) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +c +1 +WITH cte AS +( +SELECT +( +WITH x AS +(WITH y(b) AS (SELECT a FROM x AS t LIMIT 1) SELECT b FROM y) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +c +3 +WITH cte AS +( +SELECT +( +WITH x AS +(WITH x(b) AS (SELECT a FROM x AS t LIMIT 1) SELECT b FROM x) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +c +3 +WITH x AS +( +SELECT +( +WITH x AS +(WITH x AS (SELECT a FROM x AS t) SELECT 1 AS b) +SELECT b FROM x AS r +) AS c +) +SELECT x.c from x; +c +1 +WITH cte AS +( +SELECT +( +WITH x AS +(WITH x AS (SELECT a FROM x AS t) SELECT 2 AS b) +SELECT r1.b FROM x AS r1, x AS r2 WHERE r1.b=r2.b +) AS c +) +SELECT cte.c from cte; +c +2 +DROP TABLE x; +WITH cte AS +( +SELECT +( +WITH x AS +(WITH x AS (SELECT a FROM x AS t) SELECT 1 AS b) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +ERROR 42S02: Table 'test.x' doesn't exist +WITH cte AS +( +SELECT +( +WITH x AS +(WITH x AS (SELECT a FROM x AS t) SELECT b FROM t1) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +ERROR 42S02: Table 'test.x' doesn't exist +WITH cte AS +( +SELECT +( +WITH x AS +(WITH y AS (SELECT a FROM x AS t) SELECT b FROM t1) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +ERROR 42S02: Table 'test.x' doesn't exist +WITH cte AS +( +SELECT +( +WITH x AS +(WITH y(b) AS (SELECT a FROM x AS t LIMIT 1) SELECT b FROM y) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +ERROR 42S02: Table 'test.x' doesn't exist +WITH cte AS +( +SELECT +( +WITH x AS +(WITH x(b) AS (SELECT a FROM x AS t LIMIT 1) SELECT b FROM x) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +ERROR 42S02: Table 'test.x' doesn't exist +WITH x AS +( +SELECT +( +WITH x AS +(WITH x AS (SELECT a FROM x AS t) SELECT 1 AS b) +SELECT b FROM x AS r +) AS c +) +SELECT x.c from x; +ERROR 42S02: Table 'test.x' doesn't exist +WITH cte AS +( +SELECT +( +WITH x AS +(WITH x AS (SELECT a FROM x AS t) SELECT 2 AS b) +SELECT r1.b FROM x AS r1, x AS r2 WHERE r1.b=r2.b +) AS c +) +SELECT cte.c from cte; +ERROR 42S02: Table 'test.x' doesn't exist +DROP TABLE t1; +# # End of 10.3 tests # +# # MDEV-26108: Recursive CTE embedded into another CTE which is used twice # create table t1 (a int); diff --git a/mysql-test/main/cte_recursive.test b/mysql-test/main/cte_recursive.test index f8c41dbc3ea44..ebea3b96754c9 100644 --- a/mysql-test/main/cte_recursive.test +++ b/mysql-test/main/cte_recursive.test @@ -1,4 +1,7 @@ --source include/default_optimizer_switch.inc +# This is too slow on MSAN +--source include/not_msan.inc +--source include/not_valgrind.inc create table t1 (a int, b varchar(32)); insert into t1 values @@ -2729,7 +2732,9 @@ drop table t1; --echo # MDEV-24019: query with recursive CTE when no default database is set --echo # -drop database test; +create database dummy; +use dummy; +drop database dummy; let $q= with recursive a as @@ -2757,7 +2762,6 @@ deallocate prepare stmt; drop database db1; -create database test; use test; --echo # @@ -3165,7 +3169,837 @@ SELECT * FROM cte; DROP TABLE t1; +--echo # +--echo # MDEV-12325 Unexpected data type and truncation when using CTE +--echo # + +CREATE TABLE t1 +( + id INT, mid INT, name TEXT +); +INSERT INTO t1 VALUES (0,NULL,'Name'),(1,0,'Name1'),(2,0,'Name2'),(11,1,'Name11'),(12,1,'Name12'); + +let $query= +WITH RECURSIVE +cteReports (level, id, mid, name) AS +( + SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL + UNION ALL + SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e + INNER JOIN cteReports r ON e.mid = r.id +) +SELECT + level, id, mid, name, + (SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid; + +--error ER_WARN_DATA_OUT_OF_RANGE +--eval $query +--error ER_WARN_DATA_OUT_OF_RANGE +--eval create table t2 as $query; +--eval create table t2 ignore as $query; +show create table t2; +--error ER_WARN_DATA_OUT_OF_RANGE +--eval insert into t2 $query; +--eval insert ignore into t2 $query; +drop table t2; +set @@sql_mode=""; +--eval $query +--eval create table t2 as $query; +show create table t2; +set @@sql_mode=default; +drop table t1,t2; + +--echo # +--echo # MDEV-29361: Embedded recursive / non-recursive CTE within +--echo # the scope of another embedded CTE with the same name +--echo # + +create table t1 (a int); +insert into t1 values (4), (5); +create table t2 (a int); +insert into t2 values (6), (8); +create table t3 (a int); +insert into t3 values (1), (9); + + +with recursive +x as +( + select a from t1 union select a+1 from x as r1 where a < 7 +) +select * from x as s1; + +with recursive +x as +( + select a from t2 + union + select a+2 from x as r2 where a < 10 +) +select a from x as s2; + +# All recursive CTEs with name x are embedded in in the definition of 'cte', +# without this embedding CTE the bug could not be reproduced + +# two recursive CTEs with name x, the second CTE is in the scope +# of the first one, but does not use it +# before fix of this bug: wrong result set + +with +cte as +( + with recursive + x as + ( + select a from t1 union select a+1 from x as r1 where a < 7 + ) + select * from x as s1 + where s1.a in ( + with recursive + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x as s2 + ) +) +select * from cte; + + +# two recursive CTEs with name x, the second CTE is in the scope of the first +# one, but does not use it; there are two non-recursive references to the latter +# before fix of this bug: wrong result set + +with +cte as +( + with recursive + x(a) as + ( + select a from t1 union select a+1 from x as r1 where a < 7 + ) + select s1.a from x as s1, x + where s1.a = x.a and + x.a in ( + with recursive + x(a) as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x as s2 + ) +) +select * from cte; + + +# x as r1 belongs to the definition of CTE x from non-RECURSIVE with clause +# before fix of this bug: infinite sequence of recursive calls + +--error ER_NO_SUCH_TABLE +with +cte as +( + with + x as + ( + select a from t1 union select a+1 from x as r1 where a < 7 + ) + select * from x as s1 + where s1.a in ( + with recursive + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x as s2 + ) +) +select * from cte; + + +# x as r2 belongs to the definition of CTE x from non-RECURSIVE with clause +# yet it is in the scope of another CTE with the same name +# before fix of this bug: crash in With_element::get_name() + +with +cte as +( + with recursive + x as + ( + select a from t1 union select a+1 from x as r1 where a < 7 + ) + select * from x as s1 + where s1.a in ( + with + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x as s2 + ) +) +select * from cte; + + +# x as r1 is in the definition of CTE x from non-RECURSIVE with clause, thus +# although x as r2 is in the scope of the first CTE x an error is expected +# before fix of this bug: crash in With_element::get_name() + +--error ER_NO_SUCH_TABLE +with +cte as +( + with + x as + ( + select a from t1 union select a+1 from x as r1 where a < 7 + ) + select * from x as s1 + where s1.a in ( + with + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x as s2 + ) +) +select * from cte; + + +# x as r2 belongs to the definition of CTE x from non-RECURSIVE with clause +# and in the scope of recursive CTE y, but does not use the latter +# before fix of this bug: crash in With_element::get_name() + +--error ER_NO_SUCH_TABLE +with +cte as +( + with recursive + y as + ( + select a from t1 union select a+1 from y as r1 where a < 7 + ) + select * from y as s1 + where s1.a in ( + with + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x as s2 + ) +) +select * from cte; + + +# x as r2 belongs to the definition of CTE x from non-RECURSIVE with clause +# and in the scope of non-recursive CTE y, but does not use the latter +# before fix of this bug: crash in With_element::get_name() + +--error ER_NO_SUCH_TABLE +with +cte as +( + with + y(a) as + ( + select a+5 from t1 + ) + select * from y as s1 + where s1.a in ( + with + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x as s2 + ) +) +select * from cte; + + +# in the subquery of the embedding CTE cte: +# x as r1 is in the definition of CTE x from non-RECURSIVE with clause; +# x as t2 is in the definition of CTE x from RECURSIVE with clause; +# an error is expected to be reported for x as r1 +# before fix of this bug: infinite sequence of recursive calls + +--error ER_NO_SUCH_TABLE +with +cte as +( + select ( + with + x as + ( + select a from x as r1 + ) + select * from x as s1 + where s1.a in ( + with recursive + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x as s2 + ) + ) as r + from t3 +) +select * from cte; + + +# in the subquery of the embedding CTE cte: +# x as r1 is in the definition of CTE x from non-RECURSIVE with clause, thus +# although x as r2 is in the scope of the first CTE x an error is expected +# before fix of this bug: crash in With_element::get_name() + +--error ER_NO_SUCH_TABLE +with +cte as +( + select ( + with + x as + ( + select a from x as r1 + ) + select * from x as s1 + where s1.a < 5 and + s1.a in ( + with + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x as s2 + ) + ) as r + from t3 +) +select * from cte; + + +# in the subquery of the embedding CTE cte: +# two recursive CTEs with name x, the second CTE is in the scope +# of the first one, but does not use it +# before fix of this bug: wrong result set + +with +cte as +( + select ( + with recursive + x(a) as + ( + select a+3 from t1 union select a+1 from x as r1 where a < 7 + ) + select * from x as s1 + where s1.a < 8 and + s1.a in ( + with recursive + x(a) as + ( + select a-2 from t2 + union + select a+1 from x as r2 where a < 10 + ) + select a from x as s2 + ) + ) as r + from t3 +) +select * from cte; + + +# in the subquery of the embedding CTE cte: +# two recursive CTEs with name x, the second CTE is in the scope +# of the first one, but does not use it +# before fix of this bug: Subquery returns more than 1 row + +with +cte as +( + select ( + with recursive + x as + ( + select a from t1 union select a+1 from x as r1 where a < 7 + ) + select * from x as s1 + where s1.a in ( + with recursive + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x as s2 + ) + ) as r + from t3 +) +select * from cte; + + +create table x (a int); +insert into x values (3), (7), (1), (5), (6); + + +# in the subquery of the embedding CTE cte: +# one non-recursive CTEs with name x using table t in a subquery, the second +# CTE x is recursive and is in the scope of the first one, but does not use it; +# the query uses both CTE with name x. +# before fix of this bug: infinite sequence of recursive calls + +--error ER_SUBQUERY_NO_1_ROW +with +cte as +( + select ( + with + x as + ( + select ( select a from x as r1 ) as a from t1 + ) + select * from x as s1 + where s1.a in ( + with recursive + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x s2 + ) + ) as r + from t3 +) +select * from cte; + + +# in the subquery of the embedding CTE cte: +# one non-recursive CTEs with name x using table t, the second CTE x is +# recursive and is in the scope of the first one, but does not use it; +# the query uses only the second CTE with name x. +# before fix of this bug: Subquery returns more than 1 row + +with +cte as +( + select ( + with + x as + ( + select ( select a from x ) as a from t1 + ) + select exists ( + with recursive + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x + ) + ) as r + from t3 +) +select * from cte; + + +# in the subquery of the embedding CTE cte embedded in the CTE cte_e +# one non-recursive CTEs with name x uses table t1, the second CTE x is +# recursive and is in the scope of the first one, but does not use it; +# CTE cte uses only the second CTE with name x; +# the query has two refeences to cte_e +# before fix of this bug: infinite sequence of recursive calls + +with +cte_e as +( + with + cte as + ( + select ( + with + x as + ( + select ( select a from x ) from t1 + ) + select exists ( + with recursive + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x + ) + ) as r + from t3 + ) + select * from cte +) +select s1.*, s2.* from cte_e as s1, cte_e as s2; + + +# check : with base table x all queries abobe that returned error +# message ER_NO_SUCH_TABLE now return proper result sets + +with +x as +( + select a from t1 union select a+1 from x as r1 where a < 7 +) +select * from x as s1; + +with +x as +( + select a from t2 + union + select a+2 from x as r2 where a < 10 +) +select a from x as s2; + +with recursive +x as +( + select a from t1 union select a+1 from x as r1 where a < 7 +) +select * from x as s1; + +with recursive +x as +( + select a from t2 + union + select a+2 from x as r2 where a < 10 +) +select a from x as s2; + + +# x as r1 is bound to table x, x as s1 is bound to the first CTE x +# x as r2 and x as s2 are bound to the second CTE x +# before fix of this bug: infinite sequence of recursive calls + +with +cte as +( + with + x as + ( + select a from t1 union select a+1 from x as r1 where a < 7 + ) + select * from x as s1 + where s1.a in ( + with recursive + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x as s2 + ) +) +select * from cte; + + +# x as r1 is bound to table x, x as s1 is bound to the first CTE x +# x as r1 is bound to the first CTE x, x as s2 is bound to the second CTE x +# before fix of this bug: crash in With_element::get_name() + +with +cte as +( + with + x as + ( + select a from t1 union select a+1 from x as r1 where a < 7 + ) + select * from x as s1 + where s1.a in ( + with + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x as s2 + ) +) +select * from cte; + + +# x as r2 is bound to table x, x as s2 is bound to CTE x +# before fix of this bug: crash in With_element::get_name() + +with +cte as +( + with recursive + y as + ( + select a from t1 union select a+1 from y as r1 where a < 7 + ) + select * from y as s1 + where s1.a in ( + with + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x as s2 + ) +) +select * from cte; + + +# x as r2 is bound to table x, x as s2 is bound to CTE x +# before fix of this bug: crash in With_element::get_name() + +with +cte as +( + with + y(a) as + ( + select a+5 from t1 + ) + select * from y as s1 + where s1.a in ( + with + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x as s2 + ) +) +select * from cte; + + +# x as r1 is bound to table x, x as s1 is bound to the first CTE x +# x as r2 and x as s2 are bound to the second CTE x +# before fix of this bug: infinite sequence of recursive calls + +with +cte as +( + select ( + with + x as + ( + select a from x as r1 + ) + select * from x as s1 + where s1.a in ( + with + recursive x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x as s2 + ) + ) as r + from t3 +) +select * from cte; + + +# x as r1 is bound to table x, x as s1 is bound to the first CTE x +# x as r2 is bound to the first CTE x, x as s2 is bound to the second CTE x +# before fix of this bug: crash in With_element::get_name() + +with +cte as +( + select ( + with + x as + ( + select a from x as r1 + ) + select * from x as s1 + where s1.a < 5 and + s1.a in ( + with + x as + ( + select a from t2 + union + select a+2 from x as r2 where a < 10 + ) + select a from x as s2 + ) + ) as r + from t3 +) +select * from cte; + + +drop table t1,t2,t3,x; + +--echo # +--echo # MDEV-30248: Embedded non-recursive CTE referring to base table 'x' +--echo # within a CTE with name 'x' used in a subquery from +--echo # select list of another CTE +--echo # + +CREATE TABLE x (a int) ENGINE=MyISAM; +INSERT INTO x VALUES (3),(7),(1); +CREATE TABLE t1 (b int) ENGINE=MYISAM; +INSERT INTO t1 VALUES (1); + +let $q1= +WITH cte AS +( + SELECT + ( + WITH x AS + (WITH x AS (SELECT a FROM x AS t) SELECT 1 AS b) + SELECT b FROM x AS r + ) AS c +) +SELECT cte.c FROM cte; +eval $q1; + +let $q2= +WITH cte AS +( + SELECT + ( + WITH x AS + (WITH x AS (SELECT a FROM x AS t) SELECT b FROM t1) + SELECT b FROM x AS r + ) AS c +) +SELECT cte.c FROM cte; +eval $q2; + +let $q3= +WITH cte AS +( + SELECT + ( + WITH x AS + (WITH y AS (SELECT a FROM x AS t) SELECT b FROM t1) + SELECT b FROM x AS r + ) AS c +) +SELECT cte.c FROM cte; +eval $q3; + + +let $q4= +WITH cte AS +( + SELECT + ( + WITH x AS + (WITH y(b) AS (SELECT a FROM x AS t LIMIT 1) SELECT b FROM y) + SELECT b FROM x AS r + ) AS c +) +SELECT cte.c FROM cte; +eval $q4; + +let $q5= +WITH cte AS +( + SELECT + ( + WITH x AS + (WITH x(b) AS (SELECT a FROM x AS t LIMIT 1) SELECT b FROM x) + SELECT b FROM x AS r + ) AS c +) +SELECT cte.c FROM cte; +eval $q5; + +let $q6= +WITH x AS +( + SELECT + ( + WITH x AS + (WITH x AS (SELECT a FROM x AS t) SELECT 1 AS b) + SELECT b FROM x AS r + ) AS c +) +SELECT x.c from x; +eval $q6; + +let $q7= +WITH cte AS +( + SELECT + ( + WITH x AS + (WITH x AS (SELECT a FROM x AS t) SELECT 2 AS b) + SELECT r1.b FROM x AS r1, x AS r2 WHERE r1.b=r2.b + ) AS c +) +SELECT cte.c from cte; +eval $q7; + + +DROP TABLE x; + +--ERROR ER_NO_SUCH_TABLE +eval $q1; +--ERROR ER_NO_SUCH_TABLE +eval $q2; +--ERROR ER_NO_SUCH_TABLE +eval $q3; +--ERROR ER_NO_SUCH_TABLE +eval $q4; +--ERROR ER_NO_SUCH_TABLE +eval $q5; +--ERROR ER_NO_SUCH_TABLE +eval $q6; +--ERROR ER_NO_SUCH_TABLE +eval $q7; + +DROP TABLE t1; + +--echo # --echo # End of 10.3 tests +--echo # --echo # --echo # MDEV-26108: Recursive CTE embedded into another CTE which is used twice diff --git a/mysql-test/main/ctype_big5.result b/mysql-test/main/ctype_big5.result index 021ad6e76c0d9..b2abca5df7a47 100644 --- a/mysql-test/main/ctype_big5.result +++ b/mysql-test/main/ctype_big5.result @@ -89,7 +89,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `name` varchar(10) DEFAULT NULL, `level` smallint(5) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=big5 +) ENGINE=MyISAM DEFAULT CHARSET=big5 COLLATE=big5_chinese_ci insert into t1 values ('string',1); select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; concat(name,space(level)) concat(name, repeat(' ',level)) @@ -758,8 +758,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `code` varchar(8) DEFAULT NULL, - `a` varchar(1) CHARACTER SET big5 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET big5 COLLATE big5_chinese_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT COUNT(*) FROM t1; COUNT(*) 28672 @@ -1156,14 +1156,14 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET big5 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET big5 COLLATE big5_chinese_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 41 @@ -1176,14 +1176,14 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET big5 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET big5 COLLATE big5_chinese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 4141414141 @@ -1196,7 +1196,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 414141 @@ -1209,7 +1209,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 41414141412020202020 @@ -1416,13 +1416,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET big5 COLLATE big5_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 61 @@ -1436,13 +1436,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET big5 COLLATE big5_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 6161616161 @@ -1455,7 +1455,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 616161 @@ -1468,7 +1468,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 61616161612020202020 @@ -4780,8 +4780,8 @@ CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET big5 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET big5 COLLATE big5_chinese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('�\'),('�\t'); INSERT INTO t1 VALUES ('\\�\'),('\\�\t'),('\\�\t\t'); INSERT INTO t1 VALUES ('''�\'),('�\'''); @@ -4819,8 +4819,8 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET big5 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET big5 COLLATE big5_chinese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (BINARY('�\')),(BINARY('�\t')); INSERT INTO t1 VALUES (BINARY('\\�\')),(BINARY('\\�\t')),(BINARY('\\�\t\t')); INSERT INTO t1 VALUES (BINARY('''�\')),(BINARY('�\''')); @@ -4858,8 +4858,8 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET big5 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET big5 COLLATE big5_chinese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (_BINARY'�\'),(_BINARY'�\t'); INSERT INTO t1 VALUES (_BINARY'\\�\'),(_BINARY'\\�\t'),(_BINARY'\\�\t\t'); INSERT INTO t1 VALUES (_BINARY'''�\'),(_BINARY'�\'''); @@ -4904,8 +4904,8 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET big5 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET big5 COLLATE big5_chinese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('�\['),('\�\['); SELECT HEX(a) FROM t1; HEX(a) @@ -4925,7 +4925,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('�\['),('\�\['); SELECT HEX(a) FROM t1; HEX(a) @@ -4938,8 +4938,8 @@ CREATE TABLE t1 (a ENUM(' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('?') CHARACTER SET big5 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` enum('?') CHARACTER SET big5 COLLATE big5_chinese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('�@'); INSERT INTO t1 VALUES (_big5 0xC840); INSERT INTO t1 VALUES (0xC840); @@ -4954,8 +4954,8 @@ CREATE TABLE t1 (a ENUM(' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('?') CHARACTER SET big5 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` enum('?') CHARACTER SET big5 COLLATE big5_chinese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('�@'); INSERT INTO t1 VALUES (_big5 0xC840); INSERT INTO t1 VALUES (0xC840); @@ -5026,7 +5026,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_chinese_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE big5_chinese_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=big5 COLLATE=big5_chinese_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -5164,7 +5164,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_chinese_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE big5_chinese_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=big5 COLLATE=big5_chinese_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -5303,7 +5303,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE big5_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=big5 COLLATE=big5_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -5441,7 +5441,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE big5_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=big5 COLLATE=big5_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); diff --git a/mysql-test/main/ctype_big5.test b/mysql-test/main/ctype_big5.test index 385f1c21439b7..b7d33c4fcdef2 100644 --- a/mysql-test/main/ctype_big5.test +++ b/mysql-test/main/ctype_big5.test @@ -1,3 +1,4 @@ +-- source include/no_valgrind_without_big.inc -- source include/have_big5.inc # @@ -79,6 +80,8 @@ create table t1 (a blob); insert into t1 values (0xEE00); select * into outfile 'test/t1.txt' from t1; delete from t1; +#enable after fix MDEV-27871 +--disable_view_protocol let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --eval select hex(load_file('$MYSQLD_DATADIR/test/t1.txt')); @@ -86,7 +89,8 @@ load data infile 't1.txt' into table t1; select hex(a) from t1; --remove_file $MYSQLD_DATADIR/test/t1.txt drop table t1; - +#enable_view_protocol +# --echo End of 5.0 tests @@ -240,12 +244,14 @@ DROP TABLE t1; # # Checking binary->big5 conversion of an unassigned character 0xC840 in optimizer # +--disable_service_connection SET NAMES binary; CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET big5, KEY(a)); INSERT INTO t1 VALUES (0xC840),(0xC841),(0xC842); SELECT HEX(a) FROM t1 WHERE a='�@'; SELECT HEX(a) FROM t1 IGNORE KEY(a) WHERE a='�@'; DROP TABLE t1; +--enable_service_connection --echo # --echo # End of 10.0 tests diff --git a/mysql-test/main/ctype_binary.result b/mysql-test/main/ctype_binary.result index 05f31f13dc780..24fc961e17d2d 100644 --- a/mysql-test/main/ctype_binary.result +++ b/mysql-test/main/ctype_binary.result @@ -11,7 +11,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1; hex(c1) 31 @@ -24,7 +24,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1; hex(c1) 3138343436373434303733373039353531363135 @@ -37,7 +37,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1; hex(c1) 312E31 @@ -50,7 +50,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1-2)); hex(concat(1-2)) @@ -60,7 +60,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1*2)); hex(concat(1*2)) @@ -70,7 +70,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1/2)); hex(concat(1/2)) @@ -80,7 +80,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(7) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1 div 2)); hex(concat(1 div 2)) @@ -90,7 +90,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1 % 2)); hex(concat(1 % 2)) @@ -100,7 +100,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(-1)); hex(concat(-1)) @@ -110,7 +110,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(-(1+2))); hex(concat(-(1+2))) @@ -120,7 +120,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1|2)); hex(concat(1|2)) @@ -130,7 +130,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1&2)); hex(concat(1&2)) @@ -140,7 +140,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(bit_count(12))); hex(concat(bit_count(12))) @@ -150,7 +150,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(2<<1)); hex(concat(2<<1)) @@ -160,7 +160,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(2>>1)); hex(concat(2>>1)) @@ -170,7 +170,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(~0)); hex(concat(~0)) @@ -180,7 +180,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(3^2)); hex(concat(3^2)) @@ -190,7 +190,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(abs(-2))); hex(concat(abs(-2))) @@ -200,7 +200,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(exp(2)),1)); hex(left(concat(exp(2)),1)) @@ -210,7 +210,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(log(2)),1)); hex(left(concat(log(2)),1)) @@ -220,7 +220,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(log2(2)),1)); hex(left(concat(log2(2)),1)) @@ -230,7 +230,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(log10(2)),1)); hex(left(concat(log10(2)),1)) @@ -240,7 +240,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(sqrt(2)),1)); hex(left(concat(sqrt(2)),1)) @@ -250,7 +250,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(pow(2,2)),1)); hex(left(concat(pow(2,2)),1)) @@ -260,7 +260,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(acos(0.5)),1)); hex(left(concat(acos(0.5)),1)) @@ -270,7 +270,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(asin(0.5)),1)); hex(left(concat(asin(0.5)),1)) @@ -280,7 +280,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(atan(0.5)),1)); hex(left(concat(atan(0.5)),1)) @@ -290,7 +290,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(cos(0.5)),1)); hex(left(concat(cos(0.5)),1)) @@ -300,7 +300,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(sin(0.5)),1)); hex(left(concat(sin(0.5)),1)) @@ -310,7 +310,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(tan(0.5)),1)); hex(left(concat(tan(0.5)),1)) @@ -320,7 +320,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(degrees(0))); hex(concat(degrees(0))) @@ -330,7 +330,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(radians(0))); hex(concat(radians(0))) @@ -340,7 +340,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ceiling(0.5))); hex(concat(ceiling(0.5))) @@ -351,7 +351,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c0` int(3) NOT NULL, `c1` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(floor(0.5))); hex(concat(floor(0.5))) @@ -362,7 +362,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c0` int(3) NOT NULL, `c1` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(round(0.5))); hex(concat(round(0.5))) @@ -372,7 +372,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(sign(0.5))); hex(concat(sign(0.5))) @@ -382,14 +382,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(rand()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(length('a'))); hex(concat(length('a'))) @@ -399,7 +399,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(char_length('a'))); hex(concat(char_length('a'))) @@ -409,7 +409,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(bit_length('a'))); hex(concat(bit_length('a'))) @@ -419,7 +419,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(coercibility('a'))); hex(concat(coercibility('a'))) @@ -429,7 +429,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(locate('a','a'))); hex(concat(locate('a','a'))) @@ -439,7 +439,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(field('c','a','b','c'))); hex(concat(field('c','a','b','c'))) @@ -449,7 +449,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ascii(61))); hex(concat(ascii(61))) @@ -459,7 +459,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ord(61))); hex(concat(ord(61))) @@ -469,7 +469,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(7) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(find_in_set('b','a,b,c,d'))); hex(concat(find_in_set('b','a,b,c,d'))) @@ -479,7 +479,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select md5('a'), hex(md5('a')); md5('a') hex(md5('a')) @@ -489,7 +489,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(32) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select old_password('a'), hex(old_password('a')); old_password('a') hex(old_password('a')) @@ -499,7 +499,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(16) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select password('a'), hex(password('a')); password('a') hex(password('a')) @@ -509,7 +509,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(41) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select sha('a'), hex(sha('a')); sha('a') hex(sha('a')) @@ -519,7 +519,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(40) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select sha1('a'), hex(sha1('a')); sha1('a') hex(sha1('a')) @@ -529,7 +529,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(40) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast('-1' as signed))); hex(concat(cast('-1' as signed))) @@ -539,7 +539,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast('1' as unsigned))); hex(concat(cast('1' as unsigned))) @@ -549,7 +549,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast(1/2 as decimal(5,5)))); hex(concat(cast(1/2 as decimal(5,5)))) @@ -559,7 +559,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(7) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast('2001-01-02 03:04:05' as date))); hex(concat(cast('2001-01-02 03:04:05' as date))) @@ -569,7 +569,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2001-01-02 @@ -582,7 +582,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 03:04:05 @@ -595,7 +595,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2001-01-02 00:00:00 @@ -608,7 +608,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(greatest(1,2))); hex(concat(greatest(1,2))) @@ -618,7 +618,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(case when 11 then 22 else 33 end)); hex(concat(case when 11 then 22 else 33 end)) @@ -628,7 +628,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(coalesce(1,2))); hex(concat(coalesce(1,2))) @@ -638,7 +638,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat_ws(1,2,3)); hex(concat_ws(1,2,3)) @@ -648,7 +648,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(group_concat(1,2,3)); hex(group_concat(1,2,3)) @@ -658,14 +658,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` mediumblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select 1 as c1 union select 'a'; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1 order by c1; hex(c1) 31 @@ -676,7 +676,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(benchmark(0,0))); hex(concat(benchmark(0,0))) @@ -686,7 +686,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(sleep(0))); hex(concat(sleep(0))) @@ -696,7 +696,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(is_free_lock('xxxx'))); hex(concat(is_free_lock('xxxx'))) @@ -706,21 +706,21 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(is_used_lock('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(release_lock('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(crc32(''))); hex(concat(crc32(''))) @@ -730,7 +730,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(uncompressed_length(''))); hex(concat(uncompressed_length(''))) @@ -740,14 +740,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(connection_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(inet_aton('127.1.1.1'))); hex(concat(inet_aton('127.1.1.1'))) @@ -757,7 +757,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(inet_ntoa(2130772225))); hex(concat(inet_ntoa(2130772225))) @@ -770,7 +770,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(31) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select 1; 1 @@ -783,7 +783,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(found_rows())); hex(concat(found_rows())) @@ -793,21 +793,21 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(uuid_short()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(uuid()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(36) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); coercibility(uuid()) coercibility(cast('a' as char character set latin1)) @@ -820,14 +820,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(37) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@a1:=1)); hex(concat(@a1:=1)) @@ -841,7 +841,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL, `c2` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a2=1; select hex(concat(@a2)); @@ -856,7 +856,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(20) DEFAULT NULL, `c2` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@a1:=sqrt(1))); hex(concat(@a1:=sqrt(1))) @@ -870,7 +870,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL, `c2` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a2=sqrt(1); select hex(concat(@a2)); @@ -885,7 +885,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL, `c2` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@a1:=1.1)); hex(concat(@a1:=1.1)) @@ -899,7 +899,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(4) DEFAULT NULL, `c2` decimal(2,1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a2=1.1; select hex(concat(@a2)); @@ -914,7 +914,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(83) DEFAULT NULL, `c2` decimal(65,38) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@@ft_max_word_len)); hex(concat(@@ft_max_word_len)) @@ -927,7 +927,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a'='a' IS TRUE)); hex(concat('a'='a' IS TRUE)) @@ -937,7 +937,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a'='a' IS NOT TRUE)); hex(concat('a'='a' IS NOT TRUE)) @@ -947,7 +947,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NOT 'a'='a')); hex(concat(NOT 'a'='a')) @@ -957,7 +957,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' IS NULL)); hex(concat('a' IS NULL)) @@ -967,7 +967,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' IS NOT NULL)); hex(concat('a' IS NOT NULL)) @@ -977,7 +977,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' rlike 'a')); hex(concat('a' rlike 'a')) @@ -987,7 +987,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(strcmp('a','b'))); hex(concat(strcmp('a','b'))) @@ -997,7 +997,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' like 'a')); hex(concat('a' like 'a')) @@ -1007,7 +1007,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' between 'b' and 'c')); hex(concat('a' between 'b' and 'c')) @@ -1017,7 +1017,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' in ('a','b'))); hex(concat('a' in ('a','b'))) @@ -1027,7 +1027,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(interval(23, 1, 15, 17, 30, 44, 200))); hex(concat(interval(23, 1, 15, 17, 30, 44, 200))) @@ -1037,7 +1037,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a varchar(10), fulltext key(a)); insert into t1 values ('a'); @@ -1049,7 +1049,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; select hex(ifnull(1,'a')); hex(ifnull(1,'a')) @@ -1059,7 +1059,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ifnull(1,1))); hex(concat(ifnull(1,1))) @@ -1069,7 +1069,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ifnull(1.1,1.1))); hex(concat(ifnull(1.1,1.1))) @@ -1079,7 +1079,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(if(1,'b',1)); hex(if(1,'b',1)) @@ -1089,7 +1089,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(if(1,1,'b')); hex(if(1,1,'b')) @@ -1099,7 +1099,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(if(1,1,1))); hex(concat(if(1,1,1))) @@ -1109,7 +1109,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(nullif(1,2))); hex(concat(nullif(1,2))) @@ -1119,7 +1119,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)')))); hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)')))) @@ -1129,7 +1129,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) @@ -1139,7 +1139,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))); hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) @@ -1149,7 +1149,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) @@ -1159,7 +1159,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))); hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) @@ -1169,7 +1169,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))); hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) @@ -1179,7 +1179,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))); hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) @@ -1189,7 +1189,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) @@ -1199,7 +1199,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) @@ -1214,7 +1214,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(y(GeomFromText('Point(1 2)')))); hex(concat(y(GeomFromText('Point(1 2)')))) @@ -1224,7 +1224,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))); hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) @@ -1234,7 +1234,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))); hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) @@ -1244,7 +1244,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(GeometryType(GeomFromText('Point(1 2)')))); hex(concat(GeometryType(GeomFromText('Point(1 2)')))) @@ -1254,7 +1254,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(AsText(GeomFromText('Point(1 2)')))); hex(concat(AsText(GeomFromText('Point(1 2)')))) @@ -1264,7 +1264,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(period_add(200902, 2))); hex(concat(period_add(200902, 2))) @@ -1274,7 +1274,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(period_diff(200902, 200802))); hex(concat(period_diff(200902, 200802))) @@ -1287,7 +1287,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(to_days(20090224))); hex(concat(to_days(20090224))) @@ -1297,7 +1297,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(dayofmonth(20090224))); hex(concat(dayofmonth(20090224))) @@ -1307,7 +1307,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(dayofyear(20090224))); hex(concat(dayofyear(20090224))) @@ -1317,7 +1317,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(hour('10:11:12'))); hex(concat(hour('10:11:12'))) @@ -1327,7 +1327,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(minute('10:11:12'))); hex(concat(minute('10:11:12'))) @@ -1337,7 +1337,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(second('10:11:12'))); hex(concat(second('10:11:12'))) @@ -1347,7 +1347,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(quarter(20090224))); hex(concat(quarter(20090224))) @@ -1357,7 +1357,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(week(20090224))); hex(concat(week(20090224))) @@ -1367,7 +1367,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(yearweek(20090224))); hex(concat(yearweek(20090224))) @@ -1377,7 +1377,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(year(20090224))); hex(concat(year(20090224))) @@ -1387,7 +1387,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(weekday(20090224))); hex(concat(weekday(20090224))) @@ -1397,7 +1397,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(dayofweek(20090224))); hex(concat(dayofweek(20090224))) @@ -1407,7 +1407,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(unix_timestamp(20090224))); hex(concat(unix_timestamp(20090224))) @@ -1417,7 +1417,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(17) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(time_to_sec('10:11:12'))); hex(concat(time_to_sec('10:11:12'))) @@ -1427,7 +1427,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(17) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(extract(year from 20090702))); hex(concat(extract(year from 20090702))) @@ -1437,7 +1437,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(microsecond('12:00:00.123456'))); hex(concat(microsecond('12:00:00.123456'))) @@ -1447,7 +1447,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(month(20090224))); hex(concat(month(20090224))) @@ -1457,14 +1457,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(last_day('2003-02-05')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select c1, hex(c1) from t1; c1 hex(c1) 2003-02-28 323030332D30322D3238 @@ -1474,7 +1474,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select c1, hex(c1) from t1; c1 hex(c1) 2000-07-03 323030302D30372D3033 @@ -1484,21 +1484,21 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(utc_date()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(curtime()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select repeat('a',20) as c1 limit 0; set timestamp=1216359724; @@ -1514,7 +1514,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(sec_to_time(2378))); hex(concat(sec_to_time(2378))) @@ -1524,7 +1524,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))); hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) @@ -1534,7 +1534,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(maketime(10,11,12))); hex(concat(maketime(10,11,12))) @@ -1544,7 +1544,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(get_format(DATE,'USA')); hex(get_format(DATE,'USA')) @@ -1554,7 +1554,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(17) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(from_unixtime(1111885200)),4)); hex(left(concat(from_unixtime(1111885200)),4)) @@ -1564,7 +1564,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))); hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) @@ -1574,7 +1574,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) @@ -1584,7 +1584,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2004-01-02 12:00:00 @@ -1597,7 +1597,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2009-01-01 @@ -1607,21 +1607,21 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(utc_timestamp()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(sysdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(addtime('00:00:00','11:22:33'))); hex(concat(addtime('00:00:00','11:22:33'))) @@ -1631,7 +1631,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(26) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(subtime('23:59:59','11:22:33'))); hex(concat(subtime('23:59:59','11:22:33'))) @@ -1641,7 +1641,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(26) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(elt(1,2,3)); hex(elt(1,2,3)) @@ -1651,7 +1651,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(export_set(1,2,3,4,2)); hex(export_set(1,2,3,4,2)) @@ -1661,7 +1661,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(127) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(insert(1133,3,0,22)); hex(insert(1133,3,0,22)) @@ -1671,7 +1671,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(lcase(123)); hex(lcase(123)) @@ -1681,7 +1681,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(123,1)); hex(left(123,1)) @@ -1691,7 +1691,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(lower(123)); hex(lower(123)) @@ -1701,7 +1701,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(lpad(1,2,0)); hex(lpad(1,2,0)) @@ -1711,7 +1711,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(ltrim(1)); hex(ltrim(1)) @@ -1721,7 +1721,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(mid(1,1,1)); hex(mid(1,1,1)) @@ -1731,7 +1731,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(repeat(1,2)); hex(repeat(1,2)) @@ -1741,7 +1741,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(replace(1,1,2)); hex(replace(1,1,2)) @@ -1751,7 +1751,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(reverse(12)); hex(reverse(12)) @@ -1761,7 +1761,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(right(123,1)); hex(right(123,1)) @@ -1771,7 +1771,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(rpad(1,2,0)); hex(rpad(1,2,0)) @@ -1781,7 +1781,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(rtrim(1)); hex(rtrim(1)) @@ -1791,7 +1791,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(soundex(1)); hex(soundex(1)) @@ -1801,7 +1801,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(substring(1,1,1)); hex(substring(1,1,1)) @@ -1811,7 +1811,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(trim(1)); hex(trim(1)) @@ -1821,7 +1821,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(ucase(1)); hex(ucase(1)) @@ -1831,7 +1831,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(upper(1)); hex(upper(1)) @@ -1841,14 +1841,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select repeat(' ', 64) as a limit 0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ("1.1"), ("2.1"); select a, hex(a) from t1; a hex(a) @@ -1870,7 +1870,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a tinyint zerofill); insert into t1 values (1), (10), (100); @@ -1898,7 +1898,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a smallint); insert into t1 values (1); @@ -1910,7 +1910,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a smallint zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -1932,7 +1932,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a mediumint zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -1954,7 +1954,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a int zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -1976,7 +1976,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a bigint zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -2001,7 +2001,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a float zerofill); insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); @@ -2026,7 +2026,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(22) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a double zerofill); insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); @@ -2050,7 +2050,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a year); insert into t1 values (1); @@ -2062,7 +2062,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a bit(64)); insert into t1 values (1); @@ -2074,7 +2074,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (0); @@ -2098,7 +2098,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a date); insert into t1 values ('2001-02-03'); @@ -2112,7 +2112,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a time); insert into t1 values (1); @@ -2130,7 +2130,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a datetime); insert into t1 values ('2001-02-03 04:05:06'); @@ -2144,7 +2144,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a tinyint); insert into t1 values (1); @@ -2460,14 +2460,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(1)) as c1; show columns from v1; Field Type Null Key Default Extra @@ -2491,14 +2491,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` decimal(18,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(123.45)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(123.45)) as c1; show columns from v1; Field Type Null Key Default Extra @@ -2522,14 +2522,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(123.45)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(123.45)) as c1; show columns from v1; Field Type Null Key Default Extra @@ -2553,14 +2553,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(cast('2001-01-02' as date))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(cast('2001-01-02' as date))) as c1; show columns from v1; Field Type Null Key Default Extra @@ -2641,112 +2641,112 @@ t2 CREATE TABLE `t2` ( `IF(a,a,'')` varbinary(9) DEFAULT NULL, `CASE WHEN a THEN a ELSE '' END` varbinary(9) DEFAULT NULL, `COALESCE(a,'')` varbinary(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `CONCAT_WS(1,2,3)` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `INSERT(1133,3,0,22)` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LCASE(a) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `LCASE(a)` varbinary(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT UCASE(a) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `UCASE(a)` varbinary(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `REPEAT(1,2)` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `LEFT(123,2)` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `RIGHT(123,2)` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `LTRIM(123)` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `RTRIM(123)` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ELT(1,111,222,333)` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `REPLACE(111,2,3)` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `SUBSTRING_INDEX(111,111,1)` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `MAKE_SET(111,222,3)` varbinary(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `SOUNDEX(1)` varbinary(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8); SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `EXPORT_SET(1,'Y','N','',8)` varbinary(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -2797,7 +2797,7 @@ t1 CREATE TABLE `t1` ( `field1_str2` varbinary(19) DEFAULT NULL, `field_date` date DEFAULT NULL, `field_datetime` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SELECT DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1, @@ -2844,7 +2844,7 @@ t1 CREATE TABLE `t1` ( `addtime2` varbinary(26) DEFAULT NULL, `date_add1` varbinary(19) DEFAULT NULL, `date_add2` varbinary(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; addtime1 addtime2 date_add1 date_add2 20:01:01 20:01:01 2001-01-01 10:01:11 2001-01-01 10:01:11 @@ -2910,7 +2910,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `d` date DEFAULT NULL, `bad` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; SET NAMES latin1; SET sql_mode=''; @@ -2933,7 +2933,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; c1 @@ -2954,7 +2954,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); c1 @@ -2975,7 +2975,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); c1 @@ -2996,7 +2996,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); c1 @@ -3021,7 +3021,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; a LENGTH(a) @@ -3055,7 +3055,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `t` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI'); SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub; c2 @@ -3172,7 +3172,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` enum('a\0','b\0','c\0') CHARACTER SET binary DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1),(2),(3); SELECT HEX(a) FROM t1 ORDER BY a; HEX(a) @@ -3186,7 +3186,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` enum('a\0') DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1); SELECT HEX(a) FROM t1; HEX(a) @@ -3197,7 +3197,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` enum('a\0b') DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1); SELECT HEX(a) FROM t1; HEX(a) @@ -3209,7 +3209,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` enum('\0a') DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES(1); SELECT HEX(a) FROM t1; HEX(a) @@ -3221,7 +3221,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` enum('\0a') DEFAULT NULL, `b` enum('b') DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1,1); SELECT HEX(a), HEX(b) FROM t1; HEX(a) HEX(b) @@ -3233,7 +3233,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` enum('a','\0a') DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1),(2); SELECT HEX(a) FROM t1 ORDER BY a; HEX(a) @@ -3246,7 +3246,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` enum('a') DEFAULT NULL, `b` enum('b','\0a') DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1,1); INSERT INTO t1 VALUES (1,2); SELECT HEX(a), HEX(b) FROM t1 ORDER BY a, b; @@ -3271,7 +3271,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` enum('\0a') CHARACTER SET binary DEFAULT NULL, `d` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`d`)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (c) VALUES (1); SELECT HEX(c) FROM t1; HEX(c) @@ -3286,7 +3286,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` enum('\0a') CHARACTER SET binary DEFAULT NULL, `d` int(11) DEFAULT NULL CHECK (`d` > 0) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1,1); SELECT HEX(c), d FROM t1; HEX(c) d @@ -3297,7 +3297,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` enum('\0a') CHARACTER SET binary DEFAULT NULL CHECK (`c` > 0) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1); SELECT HEX(c) FROM t1; HEX(c) @@ -3307,6 +3307,50 @@ DROP TABLE t1; # End of 10.2 tests # # +# Start of 10.3 tests +# +# +# MDEV-29561 SHOW CREATE TABLE produces syntactically incorrect structure +# +CREATE TABLE t1 (a ENUM('x') CHARACTER SET BINARY); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` enum('x') CHARACTER SET binary DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE `t1` ( + `a` enum('x') CHARACTER SET binary DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; +DROP TABLE t1; +CREATE TABLE t1 (a INT ) CHARSET=binary; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=binary +DROP TABLE t1; +CREATE DATABASE db1 CHARACTER SET BINARY; +SHOW CREATE DATABASE db1; +Database Create Database +db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET binary */ +DROP DATABASE db1; +CREATE FUNCTION f1() RETURNS ENUM('a') CHARACTER SET binary RETURN NULL; +SHOW CREATE FUNCTION f1; +Function sql_mode Create Function character_set_client collation_connection Database Collation +f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS enum('a') CHARSET binary +RETURN NULL latin1 latin1_swedish_ci latin1_swedish_ci +DROP FUNCTION f1; +CREATE FUNCTION f1(a ENUM('a') CHARACTER SET binary) RETURNS INT RETURN NULL; +SHOW CREATE FUNCTION f1; +Function sql_mode Create Function character_set_client collation_connection Database Collation +f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(a ENUM('a') CHARACTER SET binary) RETURNS int(11) +RETURN NULL latin1 latin1_swedish_ci latin1_swedish_ci +DROP FUNCTION f1; +# +# End of 10.3 tests +# +# # Start of 10.5 tests # # diff --git a/mysql-test/main/ctype_binary.test b/mysql-test/main/ctype_binary.test index 3cf184576b499..31880df6352b1 100644 --- a/mysql-test/main/ctype_binary.test +++ b/mysql-test/main/ctype_binary.test @@ -1,4 +1,7 @@ +#remove this include after fix MDEV-27871 +--source include/no_view_protocol.inc + set names binary; --source include/ctype_numconv.inc @@ -157,6 +160,42 @@ DROP TABLE t1; --echo # End of 10.2 tests --echo # + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-29561 SHOW CREATE TABLE produces syntactically incorrect structure +--echo # + +CREATE TABLE t1 (a ENUM('x') CHARACTER SET BINARY); +SHOW CREATE TABLE t1; +let $def= query_get_value(show create table t1,'Create Table',1); +DROP TABLE t1; +eval $def; +DROP TABLE t1; + +CREATE TABLE t1 (a INT ) CHARSET=binary; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE DATABASE db1 CHARACTER SET BINARY; +SHOW CREATE DATABASE db1; +DROP DATABASE db1; + +CREATE FUNCTION f1() RETURNS ENUM('a') CHARACTER SET binary RETURN NULL; +SHOW CREATE FUNCTION f1; +DROP FUNCTION f1; + +CREATE FUNCTION f1(a ENUM('a') CHARACTER SET binary) RETURNS INT RETURN NULL; +SHOW CREATE FUNCTION f1; +DROP FUNCTION f1; + +--echo # +--echo # End of 10.3 tests +--echo # + --echo # --echo # Start of 10.5 tests --echo # diff --git a/mysql-test/main/ctype_collate.result b/mysql-test/main/ctype_collate.result index 93bf07908b59a..1ae9f29504299 100644 --- a/mysql-test/main/ctype_collate.result +++ b/mysql-test/main/ctype_collate.result @@ -485,7 +485,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `latin1_f` char(32) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW FIELDS FROM t1; Field Type Null Key Default Extra latin1_f char(32) NO NULL @@ -495,7 +495,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `latin1_f` char(32) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW FIELDS FROM t1; Field Type Null Key Default Extra latin1_f char(32) YES NULL @@ -503,7 +503,7 @@ ALTER TABLE t1 CHARACTER SET latin1 COLLATE latin1_bin; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `latin1_f` char(32) COLLATE latin1_bin DEFAULT NULL + `latin1_f` char(32) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin SHOW FIELDS FROM t1; Field Type Null Key Default Extra @@ -649,8 +649,8 @@ select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `f1` varchar(1) CHARACTER SET latin5 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `f1` varchar(1) CHARACTER SET latin5 COLLATE latin5_turkish_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate latin5_turkish_ci then 2 else 3 end; @@ -694,7 +694,7 @@ CREATE TABLE t1 AS SELECT ' - ' AS a UNION SELECT getText(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(20) COLLATE latin1_german2_ci DEFAULT NULL + `a` varchar(20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci DROP TABLE t1; DROP FUNCTION getText; @@ -712,7 +712,7 @@ CREATE TABLE t1 AS SELECT ' - ' AS a UNION SELECT getText(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(20) COLLATE latin1_german2_ci DEFAULT NULL + `a` varchar(20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci DROP TABLE t1; DROP FUNCTION getText; @@ -756,3 +756,20 @@ hex(b) 61 drop table t1; +# +# Start of 10.2 tests +# +# +# MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition +# +CREATE TABLE t1 (a CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT); +DROP TABLE t1; +SELECT CAST('a' AS CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT); +CAST('a' AS CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT) +a +SELECT COLUMN_GET(COLUMN_CREATE(0, 'string'),0 AS CHAR CHARACTER SET latin1 COLLATE DEFAULT) AS c1; +c1 +string +# +# End of 10.2 tests +# diff --git a/mysql-test/main/ctype_collate.test b/mysql-test/main/ctype_collate.test index 6704395a0a1d4..ab79a6cd51a42 100644 --- a/mysql-test/main/ctype_collate.test +++ b/mysql-test/main/ctype_collate.test @@ -1,3 +1,6 @@ +#remove this include after fix MDEV-27871 +--source include/no_view_protocol.inc + --disable_warnings DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; @@ -339,3 +342,20 @@ select hex(b) from t1 where b<'zzz' order by b; drop table t1; +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition +--echo # + +CREATE TABLE t1 (a CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT); +DROP TABLE t1; +SELECT CAST('a' AS CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT); +SELECT COLUMN_GET(COLUMN_CREATE(0, 'string'),0 AS CHAR CHARACTER SET latin1 COLLATE DEFAULT) AS c1; + + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/main/ctype_cp1250_ch.result b/mysql-test/main/ctype_cp1250_ch.result index b662b5c774056..6a0d1969fc541 100644 --- a/mysql-test/main/ctype_cp1250_ch.result +++ b/mysql-test/main/ctype_cp1250_ch.result @@ -93,7 +93,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `name` varchar(10) DEFAULT NULL, `level` smallint(5) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=cp1250 +) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_general_ci insert into t1 values ('string',1); select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; concat(name,space(level)) concat(name, repeat(' ',level)) @@ -112,8 +112,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; c1 @@ -135,8 +135,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); c1 @@ -158,8 +158,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); c1 @@ -181,8 +181,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); c1 @@ -207,8 +207,8 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; a LENGTH(a) @@ -313,7 +313,7 @@ level smallint unsigned); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `name` varchar(10) COLLATE cp1250_czech_cs DEFAULT NULL, + `name` varchar(10) DEFAULT NULL, `level` smallint(5) unsigned DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_czech_cs insert into t1 values ('string',1); @@ -491,13 +491,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET cp1250 COLLATE cp1250_czech_cs NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) A402 @@ -511,13 +511,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET cp1250 COLLATE cp1250_czech_cs DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) A4A4A4A4A40202020202 @@ -530,7 +530,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) A4A4A4A4A40202020202 @@ -543,7 +543,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) A4A4A4A4A40202020202 diff --git a/mysql-test/main/ctype_cp1251.result b/mysql-test/main/ctype_cp1251.result index 5d0bf3be6157b..a341d9ce471d4 100644 --- a/mysql-test/main/ctype_cp1251.result +++ b/mysql-test/main/ctype_cp1251.result @@ -79,7 +79,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `e1` enum('������') DEFAULT NULL, `e2` enum('�����') DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=cp1251 +) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_ci DROP TABLE t1; # # Start of 5.1 tests @@ -422,8 +422,8 @@ create table t1 as select concat(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1; hex(c1) 31 @@ -435,8 +435,8 @@ create table t1 as select concat(18446744073709551615) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(20) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(20) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1; hex(c1) 3138343436373434303733373039353531363135 @@ -448,8 +448,8 @@ create table t1 as select concat(1.1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1; hex(c1) 312E31 @@ -461,8 +461,8 @@ create table t1 as select concat(1+2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1-2)); hex(concat(1-2)) @@ -471,8 +471,8 @@ create table t1 as select concat(1-2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1*2)); hex(concat(1*2)) @@ -481,8 +481,8 @@ create table t1 as select concat(1*2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1/2)); hex(concat(1/2)) @@ -491,8 +491,8 @@ create table t1 as select concat(1/2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(7) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(7) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1 div 2)); hex(concat(1 div 2)) @@ -501,8 +501,8 @@ create table t1 as select concat(1 div 2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1 % 2)); hex(concat(1 % 2)) @@ -511,8 +511,8 @@ create table t1 as select concat(1 % 2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(-1)); hex(concat(-1)) @@ -521,8 +521,8 @@ create table t1 as select concat(-1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(-(1+2))); hex(concat(-(1+2))) @@ -531,8 +531,8 @@ create table t1 as select concat(-(1+2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1|2)); hex(concat(1|2)) @@ -541,8 +541,8 @@ create table t1 as select concat(1|2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1&2)); hex(concat(1&2)) @@ -551,8 +551,8 @@ create table t1 as select concat(1&2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(bit_count(12))); hex(concat(bit_count(12))) @@ -561,8 +561,8 @@ create table t1 as select concat(bit_count(12)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(2<<1)); hex(concat(2<<1)) @@ -571,8 +571,8 @@ create table t1 as select concat(2<<1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(2>>1)); hex(concat(2>>1)) @@ -581,8 +581,8 @@ create table t1 as select concat(2>>1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(~0)); hex(concat(~0)) @@ -591,8 +591,8 @@ create table t1 as select concat(~0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(3^2)); hex(concat(3^2)) @@ -601,8 +601,8 @@ create table t1 as select concat(3^2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(abs(-2))); hex(concat(abs(-2))) @@ -611,8 +611,8 @@ create table t1 as select concat(abs(-2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(exp(2)),1)); hex(left(concat(exp(2)),1)) @@ -621,8 +621,8 @@ create table t1 as select concat(exp(2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(log(2)),1)); hex(left(concat(log(2)),1)) @@ -631,8 +631,8 @@ create table t1 as select concat(log(2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(log2(2)),1)); hex(left(concat(log2(2)),1)) @@ -641,8 +641,8 @@ create table t1 as select concat(log2(2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(log10(2)),1)); hex(left(concat(log10(2)),1)) @@ -651,8 +651,8 @@ create table t1 as select concat(log10(2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(sqrt(2)),1)); hex(left(concat(sqrt(2)),1)) @@ -661,8 +661,8 @@ create table t1 as select concat(sqrt(2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(pow(2,2)),1)); hex(left(concat(pow(2,2)),1)) @@ -671,8 +671,8 @@ create table t1 as select concat(pow(2,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(acos(0.5)),1)); hex(left(concat(acos(0.5)),1)) @@ -681,8 +681,8 @@ create table t1 as select concat(acos(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(asin(0.5)),1)); hex(left(concat(asin(0.5)),1)) @@ -691,8 +691,8 @@ create table t1 as select concat(asin(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(atan(0.5)),1)); hex(left(concat(atan(0.5)),1)) @@ -701,8 +701,8 @@ create table t1 as select concat(atan(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(cos(0.5)),1)); hex(left(concat(cos(0.5)),1)) @@ -711,8 +711,8 @@ create table t1 as select concat(cos(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(sin(0.5)),1)); hex(left(concat(sin(0.5)),1)) @@ -721,8 +721,8 @@ create table t1 as select concat(sin(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(tan(0.5)),1)); hex(left(concat(tan(0.5)),1)) @@ -731,8 +731,8 @@ create table t1 as select concat(tan(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(degrees(0))); hex(concat(degrees(0))) @@ -741,8 +741,8 @@ create table t1 as select concat(degrees(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(radians(0))); hex(concat(radians(0))) @@ -751,8 +751,8 @@ create table t1 as select concat(radians(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ceiling(0.5))); hex(concat(ceiling(0.5))) @@ -762,8 +762,8 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c0` int(3) NOT NULL, - `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(floor(0.5))); hex(concat(floor(0.5))) @@ -773,8 +773,8 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c0` int(3) NOT NULL, - `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(round(0.5))); hex(concat(round(0.5))) @@ -783,8 +783,8 @@ create table t1 as select concat(round(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(sign(0.5))); hex(concat(sign(0.5))) @@ -793,15 +793,15 @@ create table t1 as select concat(sign(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(rand()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(length('a'))); hex(concat(length('a'))) @@ -810,8 +810,8 @@ create table t1 as select concat(length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(char_length('a'))); hex(concat(char_length('a'))) @@ -820,8 +820,8 @@ create table t1 as select concat(char_length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(bit_length('a'))); hex(concat(bit_length('a'))) @@ -830,8 +830,8 @@ create table t1 as select concat(bit_length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(11) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(11) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(coercibility('a'))); hex(concat(coercibility('a'))) @@ -840,8 +840,8 @@ create table t1 as select concat(coercibility('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(locate('a','a'))); hex(concat(locate('a','a'))) @@ -850,8 +850,8 @@ create table t1 as select concat(locate('a','a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(11) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(11) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(field('c','a','b','c'))); hex(concat(field('c','a','b','c'))) @@ -860,8 +860,8 @@ create table t1 as select concat(field('c','a','b','c')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ascii(61))); hex(concat(ascii(61))) @@ -870,8 +870,8 @@ create table t1 as select concat(ascii(61)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ord(61))); hex(concat(ord(61))) @@ -880,8 +880,8 @@ create table t1 as select concat(ord(61)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(7) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(7) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(find_in_set('b','a,b,c,d'))); hex(concat(find_in_set('b','a,b,c,d'))) @@ -890,8 +890,8 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select md5('a'), hex(md5('a')); md5('a') hex(md5('a')) @@ -900,8 +900,8 @@ create table t1 as select md5('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(32) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(32) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select old_password('a'), hex(old_password('a')); old_password('a') hex(old_password('a')) @@ -910,8 +910,8 @@ create table t1 as select old_password('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(16) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(16) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select password('a'), hex(password('a')); password('a') hex(password('a')) @@ -920,8 +920,8 @@ create table t1 as select password('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(41) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(41) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select sha('a'), hex(sha('a')); sha('a') hex(sha('a')) @@ -930,8 +930,8 @@ create table t1 as select sha('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(40) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(40) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select sha1('a'), hex(sha1('a')); sha1('a') hex(sha1('a')) @@ -940,8 +940,8 @@ create table t1 as select sha1('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(40) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(40) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast('-1' as signed))); hex(concat(cast('-1' as signed))) @@ -950,8 +950,8 @@ create table t1 as select concat(cast('-1' as signed)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast('1' as unsigned))); hex(concat(cast('1' as unsigned))) @@ -960,8 +960,8 @@ create table t1 as select concat(cast('1' as unsigned)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast(1/2 as decimal(5,5)))); hex(concat(cast(1/2 as decimal(5,5)))) @@ -970,8 +970,8 @@ create table t1 as select concat(cast(1/2 as decimal(5,5))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(7) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(7) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast('2001-01-02 03:04:05' as date))); hex(concat(cast('2001-01-02 03:04:05' as date))) @@ -980,8 +980,8 @@ create table t1 as select concat(cast('2001-01-02 03:04:05' as date)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2001-01-02 @@ -993,8 +993,8 @@ create table t1 as select concat(cast('2001-01-02 03:04:05' as time)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 03:04:05 @@ -1006,8 +1006,8 @@ create table t1 as select concat(cast('2001-01-02' as datetime)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2001-01-02 00:00:00 @@ -1019,8 +1019,8 @@ create table t1 as select concat(least(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(greatest(1,2))); hex(concat(greatest(1,2))) @@ -1029,8 +1029,8 @@ create table t1 as select concat(greatest(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(case when 11 then 22 else 33 end)); hex(concat(case when 11 then 22 else 33 end)) @@ -1039,8 +1039,8 @@ create table t1 as select concat(case when 11 then 22 else 33 end) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(coalesce(1,2))); hex(concat(coalesce(1,2))) @@ -1049,8 +1049,8 @@ create table t1 as select concat(coalesce(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat_ws(1,2,3)); hex(concat_ws(1,2,3)) @@ -1059,8 +1059,8 @@ create table t1 as select concat_ws(1,2,3) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(group_concat(1,2,3)); hex(group_concat(1,2,3)) @@ -1069,15 +1069,15 @@ create table t1 as select group_concat(1,2,3) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` mediumtext CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` mediumtext CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select 1 as c1 union select 'a'; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1 order by c1; hex(c1) 31 @@ -1087,8 +1087,8 @@ create table t1 as select concat(last_insert_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(benchmark(0,0))); hex(concat(benchmark(0,0))) @@ -1097,8 +1097,8 @@ create table t1 as select concat(benchmark(0,0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(sleep(0))); hex(concat(sleep(0))) @@ -1107,8 +1107,8 @@ create table t1 as select concat(sleep(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(is_free_lock('xxxx'))); hex(concat(is_free_lock('xxxx'))) @@ -1117,22 +1117,22 @@ create table t1 as select concat(is_free_lock('xxxx')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(is_used_lock('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(release_lock('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(crc32(''))); hex(concat(crc32(''))) @@ -1141,8 +1141,8 @@ create table t1 as select concat(crc32('')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(uncompressed_length(''))); hex(concat(uncompressed_length(''))) @@ -1151,15 +1151,15 @@ create table t1 as select concat(uncompressed_length('')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(connection_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(inet_aton('127.1.1.1'))); hex(concat(inet_aton('127.1.1.1'))) @@ -1168,8 +1168,8 @@ create table t1 as select concat(inet_aton('127.1.1.1')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(inet_ntoa(2130772225))); hex(concat(inet_ntoa(2130772225))) @@ -1181,8 +1181,8 @@ c1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(31) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(31) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select 1; 1 @@ -1194,8 +1194,8 @@ create table t1 as select concat(row_count()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(found_rows())); hex(concat(found_rows())) @@ -1204,22 +1204,22 @@ create table t1 as select concat(found_rows()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(uuid_short()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(uuid()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(36) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(36) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); coercibility(uuid()) coercibility(cast('a' as char character set latin1)) @@ -1232,14 +1232,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(37) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@a1:=1)); hex(concat(@a1:=1)) @@ -1251,9 +1251,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL, + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL, `c2` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a2=1; select hex(concat(@a2)); @@ -1266,9 +1266,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(20) CHARACTER SET cp1251 DEFAULT NULL, + `c1` varchar(20) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL, `c2` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@a1:=sqrt(1))); hex(concat(@a1:=sqrt(1))) @@ -1280,9 +1280,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL, + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL, `c2` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a2=sqrt(1); select hex(concat(@a2)); @@ -1295,9 +1295,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL, + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL, `c2` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@a1:=1.1)); hex(concat(@a1:=1.1)) @@ -1309,9 +1309,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL, + `c1` varchar(4) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL, `c2` decimal(2,1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a2=1.1; select hex(concat(@a2)); @@ -1324,9 +1324,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(83) CHARACTER SET cp1251 DEFAULT NULL, + `c1` varchar(83) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL, `c2` decimal(65,38) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@@ft_max_word_len)); hex(concat(@@ft_max_word_len)) @@ -1338,8 +1338,8 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a'='a' IS TRUE)); hex(concat('a'='a' IS TRUE)) @@ -1348,8 +1348,8 @@ create table t1 as select concat('a'='a' IS TRUE) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a'='a' IS NOT TRUE)); hex(concat('a'='a' IS NOT TRUE)) @@ -1358,8 +1358,8 @@ create table t1 as select concat('a'='a' IS NOT TRUE) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NOT 'a'='a')); hex(concat(NOT 'a'='a')) @@ -1368,8 +1368,8 @@ create table t1 as select concat(NOT 'a'='a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' IS NULL)); hex(concat('a' IS NULL)) @@ -1378,8 +1378,8 @@ create table t1 as select concat('a' IS NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' IS NOT NULL)); hex(concat('a' IS NOT NULL)) @@ -1388,8 +1388,8 @@ create table t1 as select concat('a' IS NOT NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' rlike 'a')); hex(concat('a' rlike 'a')) @@ -1398,8 +1398,8 @@ create table t1 as select concat('a' IS NOT NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(strcmp('a','b'))); hex(concat(strcmp('a','b'))) @@ -1408,8 +1408,8 @@ create table t1 as select concat(strcmp('a','b')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' like 'a')); hex(concat('a' like 'a')) @@ -1418,8 +1418,8 @@ create table t1 as select concat('a' like 'b') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' between 'b' and 'c')); hex(concat('a' between 'b' and 'c')) @@ -1428,8 +1428,8 @@ create table t1 as select concat('a' between 'b' and 'c') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' in ('a','b'))); hex(concat('a' in ('a','b'))) @@ -1438,8 +1438,8 @@ create table t1 as select concat('a' in ('a','b')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(interval(23, 1, 15, 17, 30, 44, 200))); hex(concat(interval(23, 1, 15, 17, 30, 44, 200))) @@ -1448,8 +1448,8 @@ create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a varchar(10), fulltext key(a)); insert into t1 values ('a'); @@ -1460,8 +1460,8 @@ create table t2 as select concat(match (a) against ('a')) as a from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; select hex(ifnull(1,'a')); hex(ifnull(1,'a')) @@ -1470,8 +1470,8 @@ create table t1 as select ifnull(1,'a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ifnull(1,1))); hex(concat(ifnull(1,1))) @@ -1480,8 +1480,8 @@ create table t1 as select concat(ifnull(1,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ifnull(1.1,1.1))); hex(concat(ifnull(1.1,1.1))) @@ -1490,8 +1490,8 @@ create table t1 as select concat(ifnull(1.1,1.1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(if(1,'b',1)); hex(if(1,'b',1)) @@ -1500,8 +1500,8 @@ create table t1 as select if(1,'b',1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(if(1,1,'b')); hex(if(1,1,'b')) @@ -1510,8 +1510,8 @@ create table t1 as select if(1,1,'b') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(if(1,1,1))); hex(concat(if(1,1,1))) @@ -1520,8 +1520,8 @@ create table t1 as select concat(if(1,1,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(nullif(1,2))); hex(concat(nullif(1,2))) @@ -1530,8 +1530,8 @@ create table t1 as select concat(nullif(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)')))); hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)')))) @@ -1540,8 +1540,8 @@ create table t1 as select concat(Dimension(GeomFromText('LINSTRING(0 0,10 10)')) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) @@ -1550,8 +1550,8 @@ create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))); hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) @@ -1560,8 +1560,8 @@ create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) @@ -1570,8 +1570,8 @@ create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))); hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) @@ -1580,8 +1580,8 @@ create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0, show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))); hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) @@ -1590,8 +1590,8 @@ create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))); hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) @@ -1600,8 +1600,8 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) @@ -1610,8 +1610,8 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) @@ -1625,8 +1625,8 @@ create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(y(GeomFromText('Point(1 2)')))); hex(concat(y(GeomFromText('Point(1 2)')))) @@ -1635,8 +1635,8 @@ create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))); hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) @@ -1645,8 +1645,8 @@ create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))); hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) @@ -1655,8 +1655,8 @@ create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(GeometryType(GeomFromText('Point(1 2)')))); hex(concat(GeometryType(GeomFromText('Point(1 2)')))) @@ -1665,8 +1665,8 @@ create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(20) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(20) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(AsText(GeomFromText('Point(1 2)')))); hex(concat(AsText(GeomFromText('Point(1 2)')))) @@ -1675,8 +1675,8 @@ create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` longtext CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` longtext CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(period_add(200902, 2))); hex(concat(period_add(200902, 2))) @@ -1685,8 +1685,8 @@ create table t1 as select concat(period_add(200902, 2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(period_diff(200902, 200802))); hex(concat(period_diff(200902, 200802))) @@ -1698,8 +1698,8 @@ Warning 1265 Data truncated for column 'c1' at row 1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET cp1251 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(to_days(20090224))); hex(concat(to_days(20090224))) @@ -1708,8 +1708,8 @@ create table t1 as select concat(to_days(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(dayofmonth(20090224))); hex(concat(dayofmonth(20090224))) @@ -1718,8 +1718,8 @@ create table t1 as select concat(dayofmonth(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(dayofyear(20090224))); hex(concat(dayofyear(20090224))) @@ -1728,8 +1728,8 @@ create table t1 as select concat(dayofyear(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(hour('10:11:12'))); hex(concat(hour('10:11:12'))) @@ -1738,8 +1738,8 @@ create table t1 as select concat(hour('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(minute('10:11:12'))); hex(concat(minute('10:11:12'))) @@ -1748,8 +1748,8 @@ create table t1 as select concat(minute('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(second('10:11:12'))); hex(concat(second('10:11:12'))) @@ -1758,8 +1758,8 @@ create table t1 as select concat(second('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(quarter(20090224))); hex(concat(quarter(20090224))) @@ -1768,8 +1768,8 @@ create table t1 as select concat(quarter(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(week(20090224))); hex(concat(week(20090224))) @@ -1778,8 +1778,8 @@ create table t1 as select concat(week(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(yearweek(20090224))); hex(concat(yearweek(20090224))) @@ -1788,8 +1788,8 @@ create table t1 as select concat(yearweek(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(year(20090224))); hex(concat(year(20090224))) @@ -1798,8 +1798,8 @@ create table t1 as select concat(year(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(weekday(20090224))); hex(concat(weekday(20090224))) @@ -1808,8 +1808,8 @@ create table t1 as select concat(weekday(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(dayofweek(20090224))); hex(concat(dayofweek(20090224))) @@ -1818,8 +1818,8 @@ create table t1 as select concat(dayofweek(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(unix_timestamp(20090224))); hex(concat(unix_timestamp(20090224))) @@ -1828,8 +1828,8 @@ create table t1 as select concat(unix_timestamp(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(17) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(17) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(time_to_sec('10:11:12'))); hex(concat(time_to_sec('10:11:12'))) @@ -1838,8 +1838,8 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(17) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(17) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(extract(year from 20090702))); hex(concat(extract(year from 20090702))) @@ -1848,8 +1848,8 @@ create table t1 as select concat(extract(year from 20090702)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(microsecond('12:00:00.123456'))); hex(concat(microsecond('12:00:00.123456'))) @@ -1858,8 +1858,8 @@ create table t1 as select concat(microsecond('12:00:00.123456')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(month(20090224))); hex(concat(month(20090224))) @@ -1868,15 +1868,15 @@ create table t1 as select concat(month(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(last_day('2003-02-05')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select c1, hex(c1) from t1; c1 hex(c1) 2003-02-28 323030332D30322D3238 @@ -1885,8 +1885,8 @@ create table t1 as select concat(from_days(730669)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select c1, hex(c1) from t1; c1 hex(c1) 2000-07-03 323030302D30372D3033 @@ -1895,22 +1895,22 @@ create table t1 as select concat(curdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(utc_date()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(curtime()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select repeat('a',20) as c1 limit 0; set timestamp=1216359724; @@ -1925,8 +1925,8 @@ create table t1 as select concat(utc_time()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(sec_to_time(2378))); hex(concat(sec_to_time(2378))) @@ -1935,8 +1935,8 @@ create table t1 as select concat(sec_to_time(2378)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))); hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) @@ -1945,8 +1945,8 @@ create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00: show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(maketime(10,11,12))); hex(concat(maketime(10,11,12))) @@ -1955,8 +1955,8 @@ create table t1 as select concat(maketime(10,11,12)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(get_format(DATE,'USA')); hex(get_format(DATE,'USA')) @@ -1965,8 +1965,8 @@ create table t1 as select get_format(DATE,'USA') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(17) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(17) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(from_unixtime(1111885200)),4)); hex(left(concat(from_unixtime(1111885200)),4)) @@ -1975,8 +1975,8 @@ create table t1 as select concat(from_unixtime(1111885200)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))); hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) @@ -1985,8 +1985,8 @@ create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:0 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) @@ -1995,8 +1995,8 @@ create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2004-01-02 12:00:00 @@ -2008,8 +2008,8 @@ create table t1 as select concat(makedate(2009,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2009-01-01 @@ -2018,22 +2018,22 @@ create table t1 as select concat(now()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(utc_timestamp()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(sysdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(addtime('00:00:00','11:22:33'))); hex(concat(addtime('00:00:00','11:22:33'))) @@ -2042,8 +2042,8 @@ create table t1 as select concat(addtime('00:00:00','11:22:33')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(26) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(26) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(subtime('23:59:59','11:22:33'))); hex(concat(subtime('23:59:59','11:22:33'))) @@ -2052,8 +2052,8 @@ create table t1 as select concat(subtime('23:59:59','11:22:33')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(26) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(26) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(elt(1,2,3)); hex(elt(1,2,3)) @@ -2062,8 +2062,8 @@ create table t1 as select elt(1,2,3) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(export_set(1,2,3,4,2)); hex(export_set(1,2,3,4,2)) @@ -2072,8 +2072,8 @@ create table t1 as select export_set(1,2,3,4,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(127) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(127) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(insert(1133,3,0,22)); hex(insert(1133,3,0,22)) @@ -2082,8 +2082,8 @@ create table t1 as select insert(1133,3,0,22) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(lcase(123)); hex(lcase(123)) @@ -2092,8 +2092,8 @@ create table t1 as select lcase(123) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(123,1)); hex(left(123,1)) @@ -2102,8 +2102,8 @@ create table t1 as select left(123,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(lower(123)); hex(lower(123)) @@ -2112,8 +2112,8 @@ create table t1 as select lower(123) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(lpad(1,2,0)); hex(lpad(1,2,0)) @@ -2122,8 +2122,8 @@ create table t1 as select lpad(1,2,0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(ltrim(1)); hex(ltrim(1)) @@ -2132,8 +2132,8 @@ create table t1 as select ltrim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(mid(1,1,1)); hex(mid(1,1,1)) @@ -2142,8 +2142,8 @@ create table t1 as select mid(1,1,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(repeat(1,2)); hex(repeat(1,2)) @@ -2152,8 +2152,8 @@ create table t1 as select repeat(1,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(replace(1,1,2)); hex(replace(1,1,2)) @@ -2162,8 +2162,8 @@ create table t1 as select replace(1,1,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(reverse(12)); hex(reverse(12)) @@ -2172,8 +2172,8 @@ create table t1 as select reverse(12) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(right(123,1)); hex(right(123,1)) @@ -2182,8 +2182,8 @@ create table t1 as select right(123,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(rpad(1,2,0)); hex(rpad(1,2,0)) @@ -2192,8 +2192,8 @@ create table t1 as select rpad(1,2,0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(rtrim(1)); hex(rtrim(1)) @@ -2202,8 +2202,8 @@ create table t1 as select rtrim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(soundex(1)); hex(soundex(1)) @@ -2212,8 +2212,8 @@ create table t1 as select soundex(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(substring(1,1,1)); hex(substring(1,1,1)) @@ -2222,8 +2222,8 @@ create table t1 as select substring(1,1,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(trim(1)); hex(trim(1)) @@ -2232,8 +2232,8 @@ create table t1 as select trim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(ucase(1)); hex(ucase(1)) @@ -2242,8 +2242,8 @@ create table t1 as select ucase(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(upper(1)); hex(upper(1)) @@ -2252,15 +2252,15 @@ create table t1 as select upper(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select repeat(' ', 64) as a limit 0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(64) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ("1.1"), ("2.1"); select a, hex(a) from t1; a hex(a) @@ -2281,8 +2281,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(4) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(4) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a tinyint zerofill); insert into t1 values (1), (10), (100); @@ -2309,8 +2309,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(12) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(12) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a smallint); insert into t1 values (1); @@ -2321,8 +2321,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(6) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(6) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a smallint zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -2343,8 +2343,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(9) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(9) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a mediumint zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -2365,8 +2365,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(11) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(11) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a int zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -2387,8 +2387,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(20) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(20) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a bigint zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -2412,8 +2412,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(12) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(12) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a float zerofill); insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); @@ -2437,8 +2437,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(22) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(22) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a double zerofill); insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); @@ -2461,8 +2461,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a year); insert into t1 values (1); @@ -2473,8 +2473,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(4) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(4) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a bit(64)); insert into t1 values (1); @@ -2486,7 +2486,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (0); @@ -2509,8 +2509,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(19) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(19) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a date); insert into t1 values ('2001-02-03'); @@ -2523,8 +2523,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a time); insert into t1 values (1); @@ -2541,8 +2541,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a datetime); insert into t1 values ('2001-02-03 04:05:06'); @@ -2555,8 +2555,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(19) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(19) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a tinyint); insert into t1 values (1); @@ -2872,14 +2872,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(1)) as c1; show columns from v1; Field Type Null Key Default Extra @@ -2903,14 +2903,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` decimal(18,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(123.45)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(123.45)) as c1; show columns from v1; Field Type Null Key Default Extra @@ -2934,14 +2934,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(123.45)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(123.45)) as c1; show columns from v1; Field Type Null Key Default Extra @@ -2965,14 +2965,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(cast('2001-01-02' as date))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(cast('2001-01-02' as date))) as c1; show columns from v1; Field Type Null Key Default Extra @@ -3048,117 +3048,117 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `CONCAT(a)` varchar(9) CHARACTER SET cp1251 DEFAULT NULL, - `IFNULL(a,'')` varchar(9) CHARACTER SET cp1251 NOT NULL, - `IF(a,a,'')` varchar(9) CHARACTER SET cp1251 DEFAULT NULL, - `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET cp1251 DEFAULT NULL, - `COALESCE(a,'')` varchar(9) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `CONCAT(a)` varchar(9) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL, + `IFNULL(a,'')` varchar(9) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL, + `IF(a,a,'')` varchar(9) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL, + `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL, + `COALESCE(a,'')` varchar(9) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LCASE(a) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LCASE(a)` varchar(9) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `LCASE(a)` varchar(9) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT UCASE(a) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `UCASE(a)` varchar(9) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `UCASE(a)` varchar(9) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `REPEAT(1,2)` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `REPEAT(1,2)` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LEFT(123,2)` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `LEFT(123,2)` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `RIGHT(123,2)` varchar(2) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `RIGHT(123,2)` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LTRIM(123)` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `LTRIM(123)` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `RTRIM(123)` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `RTRIM(123)` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `ELT(1,111,222,333)` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `ELT(1,111,222,333)` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `REPLACE(111,2,3)` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `REPLACE(111,2,3)` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `SOUNDEX(1)` varchar(4) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `SOUNDEX(1)` varchar(4) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8); SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -3205,11 +3205,11 @@ DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_da SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `field_str1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL, - `field1_str2` varchar(19) CHARACTER SET cp1251 DEFAULT NULL, + `field_str1` varchar(19) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL, + `field1_str2` varchar(19) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL, `field_date` date DEFAULT NULL, `field_datetime` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SELECT DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1, @@ -3252,11 +3252,11 @@ DATE_ADD('2001-01-01 10:01:01',interval 10 second) AS date_add2; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `addtime1` varchar(26) CHARACTER SET cp1251 DEFAULT NULL, - `addtime2` varchar(26) CHARACTER SET cp1251 DEFAULT NULL, - `date_add1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL, - `date_add2` varchar(19) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `addtime1` varchar(26) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL, + `addtime2` varchar(26) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL, + `date_add1` varchar(19) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL, + `date_add2` varchar(19) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; addtime1 addtime2 date_add1 date_add2 20:01:01 20:01:01 2001-01-01 10:01:11 2001-01-01 10:01:11 @@ -3322,7 +3322,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `d` date DEFAULT NULL, `bad` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; SET NAMES latin1; SET sql_mode=''; @@ -3342,7 +3342,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `test1` int(11) DEFAULT NULL, `test2` varchar(255) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT COALESCE(IF(test1=1, 1, NULL), test2) FROM t1; COALESCE(IF(test1=1, 1, NULL), test2) SELECT COALESCE(IF(test1=1, NULL, 1), test2) FROM t1; @@ -3373,17 +3373,17 @@ SELECT * FROM t1 WHERE a IN (1,2,3); a 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '`1' +Warning 1292 Truncated incorrect DECIMAL value: '`1' SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1'; a 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '`1' +Warning 1292 Truncated incorrect DECIMAL value: '`1' SELECT * FROM t1 WHERE a IN (1,2,3,'4') AND a=' 1'; a 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '`1' +Warning 1292 Truncated incorrect DECIMAL value: '`1' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1'; 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 diff --git a/mysql-test/main/ctype_cp932.result b/mysql-test/main/ctype_cp932.result index ff1dd814970af..47b3cbc12f8bc 100644 --- a/mysql-test/main/ctype_cp932.result +++ b/mysql-test/main/ctype_cp932.result @@ -51,7 +51,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp932_japanese_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp932_japanese_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=cp932 COLLATE=cp932_japanese_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -189,7 +189,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp932_japanese_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp932_japanese_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=cp932 COLLATE=cp932_japanese_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -328,7 +328,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp932_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp932_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=cp932 COLLATE=cp932_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -466,7 +466,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp932_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp932_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=cp932 COLLATE=cp932_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); diff --git a/mysql-test/main/ctype_cp932.test b/mysql-test/main/ctype_cp932.test index 2ccbe8f15829b..3d0306884df52 100644 --- a/mysql-test/main/ctype_cp932.test +++ b/mysql-test/main/ctype_cp932.test @@ -4,6 +4,9 @@ --echo # USED. --echo # +#remove this include in 10.6 version +--source include/no_view_protocol.inc + SET @old_character_set_client= @@character_set_client; SET @old_character_set_connection= @@character_set_connection; SET @old_character_set_results= @@character_set_results; diff --git a/mysql-test/main/ctype_cp932_binlog_stm.result b/mysql-test/main/ctype_cp932_binlog_stm.result index a42ec476b6db6..f80a8b22df960 100644 --- a/mysql-test/main/ctype_cp932_binlog_stm.result +++ b/mysql-test/main/ctype_cp932_binlog_stm.result @@ -94,8 +94,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `code` varchar(8) DEFAULT NULL, - `a` varchar(1) CHARACTER SET cp932 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET cp932 COLLATE cp932_japanese_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code; Warnings: Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1 @@ -19699,7 +19699,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (0x31); INSERT INTO t1 VALUES (X'31'); PREPARE stmt FROM 'INSERT INTO t1 (a) VALUES (?)'; @@ -19742,14 +19742,14 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET cp932 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET cp932 COLLATE cp932_japanese_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 41 @@ -19762,14 +19762,14 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET cp932 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET cp932 COLLATE cp932_japanese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 4141414141 @@ -19782,7 +19782,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 414141 @@ -19795,7 +19795,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 41414141412020202020 @@ -20002,13 +20002,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET cp932 COLLATE cp932_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 61 @@ -20022,13 +20022,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET cp932 COLLATE cp932_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 6161616161 @@ -20041,7 +20041,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 616161 @@ -20054,7 +20054,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 61616161612020202020 @@ -20300,8 +20300,8 @@ CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET cp932 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET cp932 COLLATE cp932_japanese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('�\'),('�\t'); INSERT INTO t1 VALUES ('\\�\'),('\\�\t'),('\\�\t\t'); INSERT INTO t1 VALUES ('''�\'),('�\'''); @@ -20339,8 +20339,8 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET cp932 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET cp932 COLLATE cp932_japanese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (BINARY('�\')),(BINARY('�\t')); INSERT INTO t1 VALUES (BINARY('\\�\')),(BINARY('\\�\t')),(BINARY('\\�\t\t')); INSERT INTO t1 VALUES (BINARY('''�\')),(BINARY('�\''')); @@ -20378,8 +20378,8 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET cp932 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET cp932 COLLATE cp932_japanese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (_BINARY'�\'),(_BINARY'�\t'); INSERT INTO t1 VALUES (_BINARY'\\�\'),(_BINARY'\\�\t'),(_BINARY'\\�\t\t'); INSERT INTO t1 VALUES (_BINARY'''�\'),(_BINARY'�\'''); @@ -20424,8 +20424,8 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET cp932 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET cp932 COLLATE cp932_japanese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('�\['),('\�\['); SELECT HEX(a) FROM t1; HEX(a) @@ -20445,7 +20445,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('�\['),('\�\['); SELECT HEX(a) FROM t1; HEX(a) diff --git a/mysql-test/main/ctype_create.result b/mysql-test/main/ctype_create.result index 4e8289a8ad690..e6f5e84cf61f1 100644 --- a/mysql-test/main/ctype_create.result +++ b/mysql-test/main/ctype_create.result @@ -4,16 +4,16 @@ USE mysqltest1; CREATE DATABASE mysqltest2; SHOW CREATE DATABASE mysqltest1; Database Create Database -mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp1251 */ +mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp1251 COLLATE cp1251_general_ci */ SHOW CREATE DATABASE mysqltest2; Database Create Database -mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin5 */ +mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin5 COLLATE latin5_turkish_ci */ CREATE TABLE mysqltest2.t1 (a char(10)); SHOW CREATE TABLE mysqltest2.t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin5 +) ENGINE=MyISAM DEFAULT CHARSET=latin5 COLLATE=latin5_turkish_ci DROP TABLE mysqltest2.t1; ALTER DATABASE mysqltest2 DEFAULT CHARACTER SET latin7; CREATE TABLE mysqltest2.t1 (a char(10)); @@ -21,7 +21,7 @@ SHOW CREATE TABLE mysqltest2.t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin7 +) ENGINE=MyISAM DEFAULT CHARSET=latin7 COLLATE=latin7_general_ci DROP DATABASE mysqltest2; CREATE DATABASE mysqltest2 CHARACTER SET latin2; CREATE TABLE mysqltest2.t1 (a char(10)); @@ -29,7 +29,7 @@ SHOW CREATE TABLE mysqltest2.t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin2 +) ENGINE=MyISAM DEFAULT CHARSET=latin2 COLLATE=latin2_general_ci DROP DATABASE mysqltest2; USE mysqltest1; CREATE TABLE t1 (a char(10)); @@ -37,21 +37,21 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=cp1251 +) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_ci DROP TABLE t1; CREATE TABLE t1 (a char(10)) DEFAULT CHARACTER SET latin1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a char(10)) DEFAULT CHARACTER SET latin1 COLLATE latin1_german1_ci; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(10) COLLATE latin1_german1_ci DEFAULT NULL + `a` char(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci DROP TABLE t1; create table t1 (a char) character set latin1 character set latin2; @@ -68,7 +68,7 @@ use mysqltest2; ALTER DATABASE DEFAULT CHARACTER SET latin2; show create database mysqltest2; Database Create Database -mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */ +mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 COLLATE latin2_general_ci */ drop database mysqltest2; ALTER DATABASE DEFAULT CHARACTER SET latin2; ERROR 3D000: No database selected diff --git a/mysql-test/main/ctype_eucjpms.result b/mysql-test/main/ctype_eucjpms.result index a7688be6ad060..ea8824584d8cc 100644 --- a/mysql-test/main/ctype_eucjpms.result +++ b/mysql-test/main/ctype_eucjpms.result @@ -10312,9 +10312,9 @@ DROP TEMPORARY TABLE head, tail; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `code` varchar(6) CHARACTER SET eucjpms NOT NULL, - `a` varchar(1) CHARACTER SET eucjpms NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `code` varchar(6) CHARACTER SET eucjpms COLLATE eucjpms_japanese_ci NOT NULL, + `a` varchar(1) CHARACTER SET eucjpms COLLATE eucjpms_japanese_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code; Warnings: Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1 @@ -33244,14 +33244,14 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET eucjpms NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET eucjpms COLLATE eucjpms_japanese_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 41 @@ -33264,14 +33264,14 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET eucjpms DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET eucjpms COLLATE eucjpms_japanese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(15) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 4141414141 @@ -33284,7 +33284,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 414141 @@ -33297,7 +33297,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 41414141412020202020 @@ -33678,13 +33678,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET eucjpms COLLATE eucjpms_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 61 @@ -33698,13 +33698,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET eucjpms COLLATE eucjpms_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(15) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 6161616161 @@ -33717,7 +33717,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 616161 @@ -33730,7 +33730,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 61616161612020202020 @@ -34129,8 +34129,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `t` varchar(10) CHARACTER SET eucjpms DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `t` varchar(10) CHARACTER SET eucjpms COLLATE eucjpms_japanese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI'); SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub; c2 @@ -34220,7 +34220,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'eucjpms_japanese_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE eucjpms_japanese_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=eucjpms COLLATE=eucjpms_japanese_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -34358,7 +34358,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'eucjpms_japanese_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE eucjpms_japanese_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=eucjpms COLLATE=eucjpms_japanese_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -34497,7 +34497,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'eucjpms_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE eucjpms_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=eucjpms COLLATE=eucjpms_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -34635,7 +34635,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'eucjpms_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE eucjpms_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=eucjpms COLLATE=eucjpms_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); diff --git a/mysql-test/main/ctype_eucjpms.test b/mysql-test/main/ctype_eucjpms.test index 393534182dc80..3b54d667ecbb2 100644 --- a/mysql-test/main/ctype_eucjpms.test +++ b/mysql-test/main/ctype_eucjpms.test @@ -1,3 +1,7 @@ +# remove this include in 10.6 version, +# if MDEV-27871 will be fix +--source include/no_view_protocol.inc + -- source include/have_eucjpms.inc diff --git a/mysql-test/main/ctype_euckr.result b/mysql-test/main/ctype_euckr.result index f349b9c25e068..9e030f9cc6d36 100644 --- a/mysql-test/main/ctype_euckr.result +++ b/mysql-test/main/ctype_euckr.result @@ -89,7 +89,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `name` varchar(10) DEFAULT NULL, `level` smallint(5) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=euckr +) ENGINE=MyISAM DEFAULT CHARSET=euckr COLLATE=euckr_korean_ci insert into t1 values ('string',1); select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; concat(name,space(level)) concat(name, repeat(' ',level)) @@ -24706,8 +24706,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `code` varchar(8) DEFAULT NULL, - `a` varchar(1) CHARACTER SET euckr NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET euckr COLLATE euckr_korean_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code; Warnings: Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1 @@ -25173,14 +25173,14 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET euckr NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET euckr COLLATE euckr_korean_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 41 @@ -25193,14 +25193,14 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET euckr DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET euckr COLLATE euckr_korean_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 4141414141 @@ -25213,7 +25213,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 414141 @@ -25226,7 +25226,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 41414141412020202020 @@ -25433,13 +25433,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET euckr COLLATE euckr_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 61 @@ -25453,13 +25453,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET euckr COLLATE euckr_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 6161616161 @@ -25472,7 +25472,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 616161 @@ -25485,7 +25485,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 61616161612020202020 @@ -25699,8 +25699,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `t` varchar(10) CHARACTER SET euckr DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `t` varchar(10) CHARACTER SET euckr COLLATE euckr_korean_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI'); SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub; c2 @@ -25733,7 +25733,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'euckr_korean_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE euckr_korean_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=euckr COLLATE=euckr_korean_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -25871,7 +25871,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'euckr_korean_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE euckr_korean_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=euckr COLLATE=euckr_korean_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -26010,7 +26010,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'euckr_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE euckr_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=euckr COLLATE=euckr_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -26148,7 +26148,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'euckr_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE euckr_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=euckr COLLATE=euckr_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); diff --git a/mysql-test/main/ctype_filename.test b/mysql-test/main/ctype_filename.test index ba42d1a28070e..bfafe4d437fa3 100644 --- a/mysql-test/main/ctype_filename.test +++ b/mysql-test/main/ctype_filename.test @@ -20,7 +20,10 @@ drop table com1; create table `clock$` (a int); drop table `clock$`; +# Enable after fix MDEV-29295 +--disable_view_protocol select convert(convert(',' using filename) using binary); +--enable_view_protocol --echo # --echo # MDEV-7677 my_charset_handler_filename has a wrong "ismbchar" member diff --git a/mysql-test/main/ctype_gb2312.result b/mysql-test/main/ctype_gb2312.result index cdfe637078459..163364d4bc450 100644 --- a/mysql-test/main/ctype_gb2312.result +++ b/mysql-test/main/ctype_gb2312.result @@ -89,7 +89,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `name` varchar(10) DEFAULT NULL, `level` smallint(5) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=gb2312 +) ENGINE=MyISAM DEFAULT CHARSET=gb2312 COLLATE=gb2312_chinese_ci insert into t1 values ('string',1); select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; concat(name,space(level)) concat(name, repeat(' ',level)) @@ -685,8 +685,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `code` varchar(8) DEFAULT NULL, - `a` varchar(1) CHARACTER SET gb2312 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code; Warnings: Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1 @@ -1118,14 +1118,14 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET gb2312 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 41 @@ -1138,14 +1138,14 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET gb2312 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 4141414141 @@ -1158,7 +1158,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 414141 @@ -1171,7 +1171,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 41414141412020202020 @@ -1378,13 +1378,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET gb2312 COLLATE gb2312_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 61 @@ -1398,13 +1398,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET gb2312 COLLATE gb2312_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 6161616161 @@ -1417,7 +1417,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 616161 @@ -1430,7 +1430,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 61616161612020202020 @@ -4721,7 +4721,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gb2312_chinese_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE gb2312_chinese_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=gb2312 COLLATE=gb2312_chinese_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -4859,7 +4859,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gb2312_chinese_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE gb2312_chinese_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=gb2312 COLLATE=gb2312_chinese_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -4998,7 +4998,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gb2312_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE gb2312_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=gb2312 COLLATE=gb2312_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -5136,7 +5136,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gb2312_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE gb2312_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=gb2312 COLLATE=gb2312_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); diff --git a/mysql-test/main/ctype_gb2312.test b/mysql-test/main/ctype_gb2312.test index 6224b8c1cf1dd..c2d513f1f5ac0 100644 --- a/mysql-test/main/ctype_gb2312.test +++ b/mysql-test/main/ctype_gb2312.test @@ -1,3 +1,4 @@ +-- source include/no_valgrind_without_big.inc -- source include/have_gb2312.inc # @@ -7,6 +8,8 @@ drop table if exists t1; --enable_warnings +--disable_service_connection + SET @test_character_set= 'gb2312'; SET @test_collation= 'gb2312_chinese_ci'; -- source include/ctype_common.inc @@ -178,6 +181,8 @@ let $coll='gb2312_nopad_bin'; let $coll_pad='gb2312_bin'; --source include/ctype_pad_all_engines.inc +--enable_service_connection + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/ctype_gbk.result b/mysql-test/main/ctype_gbk.result index 1c1fc4aef41f5..79dede6d0890e 100644 --- a/mysql-test/main/ctype_gbk.result +++ b/mysql-test/main/ctype_gbk.result @@ -89,7 +89,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `name` varchar(10) DEFAULT NULL, `level` smallint(5) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=gbk +) ENGINE=MyISAM DEFAULT CHARSET=gbk COLLATE=gbk_chinese_ci insert into t1 values ('string',1); select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; concat(name,space(level)) concat(name, repeat(' ',level)) @@ -673,7 +673,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` mediumtext NOT NULL, `c2` text NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=gbk +) ENGINE=MyISAM DEFAULT CHARSET=gbk COLLATE=gbk_chinese_ci drop table t1; CREATE TABLE t1(a MEDIUMTEXT CHARACTER SET gbk, b MEDIUMTEXT CHARACTER SET big5); @@ -711,8 +711,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `code` varchar(8) DEFAULT NULL, - `a` varchar(1) CHARACTER SET gbk NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET gbk COLLATE gbk_chinese_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code; Warnings: Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1 @@ -1156,14 +1156,14 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET gbk NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET gbk COLLATE gbk_chinese_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 41 @@ -1176,14 +1176,14 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET gbk DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 4141414141 @@ -1196,7 +1196,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 414141 @@ -1209,7 +1209,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 41414141412020202020 @@ -1590,13 +1590,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET gbk COLLATE gbk_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 61 @@ -1610,13 +1610,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET gbk COLLATE gbk_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 6161616161 @@ -1629,7 +1629,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 616161 @@ -1642,7 +1642,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 61616161612020202020 @@ -5128,8 +5128,8 @@ CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET gbk DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('�\'),('�\t'); INSERT INTO t1 VALUES ('\\�\'),('\\�\t'),('\\�\t\t'); INSERT INTO t1 VALUES ('''�\'),('�\'''); @@ -5167,8 +5167,8 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET gbk DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (BINARY('�\')),(BINARY('�\t')); INSERT INTO t1 VALUES (BINARY('\\�\')),(BINARY('\\�\t')),(BINARY('\\�\t\t')); INSERT INTO t1 VALUES (BINARY('''�\')),(BINARY('�\''')); @@ -5206,8 +5206,8 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET gbk DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (_BINARY'�\'),(_BINARY'�\t'); INSERT INTO t1 VALUES (_BINARY'\\�\'),(_BINARY'\\�\t'),(_BINARY'\\�\t\t'); INSERT INTO t1 VALUES (_BINARY'''�\'),(_BINARY'�\'''); @@ -5252,8 +5252,8 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET gbk DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('�\['),('\�\['); SELECT HEX(a) FROM t1; HEX(a) @@ -5273,7 +5273,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('�\['),('\�\['); SELECT HEX(a) FROM t1; HEX(a) @@ -5291,8 +5291,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `t` varchar(10) CHARACTER SET gbk DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `t` varchar(10) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI'); SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub; c2 @@ -6184,7 +6184,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gbk_chinese_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE gbk_chinese_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=gbk COLLATE=gbk_chinese_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6322,7 +6322,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gbk_chinese_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE gbk_chinese_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=gbk COLLATE=gbk_chinese_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6461,7 +6461,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gbk_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE gbk_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=gbk COLLATE=gbk_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6599,7 +6599,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gbk_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE gbk_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=gbk COLLATE=gbk_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); diff --git a/mysql-test/main/ctype_gbk.test b/mysql-test/main/ctype_gbk.test index 808bea53e42d9..0d9d1d8b30a17 100644 --- a/mysql-test/main/ctype_gbk.test +++ b/mysql-test/main/ctype_gbk.test @@ -1,3 +1,4 @@ +--source include/no_valgrind_without_big.inc -- source include/have_gbk.inc # @@ -448,11 +449,13 @@ DROP TABLE t1; --echo # --echo # MDEV-7661 Unexpected result for: CAST(0xHHHH AS CHAR CHARACTER SET xxx) for incorrect byte sequences --echo # +#enable after fix MDEV-27871 +--disable_view_protocol set sql_mode=''; SELECT HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312)); SELECT HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8)); set sql_mode=default; - +--enable_view_protocol --echo # --echo # End of 10.1 tests diff --git a/mysql-test/main/ctype_gbk_export_import.result b/mysql-test/main/ctype_gbk_export_import.result index 0ade48ec58a34..664f515b35c8e 100644 --- a/mysql-test/main/ctype_gbk_export_import.result +++ b/mysql-test/main/ctype_gbk_export_import.result @@ -49,10 +49,10 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `a1` text NOT NULL, - `a2` text CHARACTER SET utf8mb3 NOT NULL, + `a2` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `b1` blob NOT NULL, `eol` text NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=gbk +) ENGINE=MyISAM DEFAULT CHARSET=gbk COLLATE=gbk_chinese_ci # # Dump using SELECT INTO OUTFILE # diff --git a/mysql-test/main/ctype_latin1.result b/mysql-test/main/ctype_latin1.result index 0b16d1cf6f287..cf51e6796794f 100644 --- a/mysql-test/main/ctype_latin1.result +++ b/mysql-test/main/ctype_latin1.result @@ -398,7 +398,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `name` varchar(10) DEFAULT NULL, `level` smallint(5) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('string',1); select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; concat(name,space(level)) concat(name, repeat(' ',level)) @@ -732,7 +732,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1; hex(c1) 31 @@ -745,7 +745,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1; hex(c1) 3138343436373434303733373039353531363135 @@ -758,7 +758,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1; hex(c1) 312E31 @@ -771,7 +771,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1-2)); hex(concat(1-2)) @@ -781,7 +781,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1*2)); hex(concat(1*2)) @@ -791,7 +791,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1/2)); hex(concat(1/2)) @@ -801,7 +801,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(7) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1 div 2)); hex(concat(1 div 2)) @@ -811,7 +811,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1 % 2)); hex(concat(1 % 2)) @@ -821,7 +821,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(-1)); hex(concat(-1)) @@ -831,7 +831,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(-(1+2))); hex(concat(-(1+2))) @@ -841,7 +841,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1|2)); hex(concat(1|2)) @@ -851,7 +851,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1&2)); hex(concat(1&2)) @@ -861,7 +861,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(bit_count(12))); hex(concat(bit_count(12))) @@ -871,7 +871,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(2<<1)); hex(concat(2<<1)) @@ -881,7 +881,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(2>>1)); hex(concat(2>>1)) @@ -891,7 +891,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(~0)); hex(concat(~0)) @@ -901,7 +901,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(3^2)); hex(concat(3^2)) @@ -911,7 +911,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(abs(-2))); hex(concat(abs(-2))) @@ -921,7 +921,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(exp(2)),1)); hex(left(concat(exp(2)),1)) @@ -931,7 +931,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(log(2)),1)); hex(left(concat(log(2)),1)) @@ -941,7 +941,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(log2(2)),1)); hex(left(concat(log2(2)),1)) @@ -951,7 +951,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(log10(2)),1)); hex(left(concat(log10(2)),1)) @@ -961,7 +961,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(sqrt(2)),1)); hex(left(concat(sqrt(2)),1)) @@ -971,7 +971,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(pow(2,2)),1)); hex(left(concat(pow(2,2)),1)) @@ -981,7 +981,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(acos(0.5)),1)); hex(left(concat(acos(0.5)),1)) @@ -991,7 +991,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(asin(0.5)),1)); hex(left(concat(asin(0.5)),1)) @@ -1001,7 +1001,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(atan(0.5)),1)); hex(left(concat(atan(0.5)),1)) @@ -1011,7 +1011,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(cos(0.5)),1)); hex(left(concat(cos(0.5)),1)) @@ -1021,7 +1021,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(sin(0.5)),1)); hex(left(concat(sin(0.5)),1)) @@ -1031,7 +1031,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(tan(0.5)),1)); hex(left(concat(tan(0.5)),1)) @@ -1041,7 +1041,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(degrees(0))); hex(concat(degrees(0))) @@ -1051,7 +1051,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(radians(0))); hex(concat(radians(0))) @@ -1061,7 +1061,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ceiling(0.5))); hex(concat(ceiling(0.5))) @@ -1072,7 +1072,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c0` int(3) NOT NULL, `c1` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(floor(0.5))); hex(concat(floor(0.5))) @@ -1083,7 +1083,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c0` int(3) NOT NULL, `c1` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(round(0.5))); hex(concat(round(0.5))) @@ -1093,7 +1093,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(sign(0.5))); hex(concat(sign(0.5))) @@ -1103,14 +1103,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(rand()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(length('a'))); hex(concat(length('a'))) @@ -1120,7 +1120,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(char_length('a'))); hex(concat(char_length('a'))) @@ -1130,7 +1130,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(bit_length('a'))); hex(concat(bit_length('a'))) @@ -1140,7 +1140,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(coercibility('a'))); hex(concat(coercibility('a'))) @@ -1150,7 +1150,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(locate('a','a'))); hex(concat(locate('a','a'))) @@ -1160,7 +1160,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(field('c','a','b','c'))); hex(concat(field('c','a','b','c'))) @@ -1170,7 +1170,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ascii(61))); hex(concat(ascii(61))) @@ -1180,7 +1180,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ord(61))); hex(concat(ord(61))) @@ -1190,7 +1190,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(7) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(find_in_set('b','a,b,c,d'))); hex(concat(find_in_set('b','a,b,c,d'))) @@ -1200,7 +1200,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select md5('a'), hex(md5('a')); md5('a') hex(md5('a')) @@ -1210,7 +1210,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(32) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select old_password('a'), hex(old_password('a')); old_password('a') hex(old_password('a')) @@ -1220,7 +1220,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(16) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select password('a'), hex(password('a')); password('a') hex(password('a')) @@ -1230,7 +1230,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(41) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select sha('a'), hex(sha('a')); sha('a') hex(sha('a')) @@ -1240,7 +1240,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(40) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select sha1('a'), hex(sha1('a')); sha1('a') hex(sha1('a')) @@ -1250,7 +1250,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(40) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast('-1' as signed))); hex(concat(cast('-1' as signed))) @@ -1260,7 +1260,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast('1' as unsigned))); hex(concat(cast('1' as unsigned))) @@ -1270,7 +1270,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast(1/2 as decimal(5,5)))); hex(concat(cast(1/2 as decimal(5,5)))) @@ -1280,7 +1280,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(7) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast('2001-01-02 03:04:05' as date))); hex(concat(cast('2001-01-02 03:04:05' as date))) @@ -1290,7 +1290,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2001-01-02 @@ -1303,7 +1303,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 03:04:05 @@ -1316,7 +1316,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2001-01-02 00:00:00 @@ -1329,7 +1329,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(greatest(1,2))); hex(concat(greatest(1,2))) @@ -1339,7 +1339,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(case when 11 then 22 else 33 end)); hex(concat(case when 11 then 22 else 33 end)) @@ -1349,7 +1349,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(coalesce(1,2))); hex(concat(coalesce(1,2))) @@ -1359,7 +1359,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat_ws(1,2,3)); hex(concat_ws(1,2,3)) @@ -1369,7 +1369,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(group_concat(1,2,3)); hex(group_concat(1,2,3)) @@ -1379,14 +1379,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` mediumtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select 1 as c1 union select 'a'; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1 order by c1; hex(c1) 31 @@ -1397,7 +1397,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(benchmark(0,0))); hex(concat(benchmark(0,0))) @@ -1407,7 +1407,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(sleep(0))); hex(concat(sleep(0))) @@ -1417,7 +1417,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(is_free_lock('xxxx'))); hex(concat(is_free_lock('xxxx'))) @@ -1427,21 +1427,21 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(is_used_lock('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(release_lock('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(crc32(''))); hex(concat(crc32(''))) @@ -1451,7 +1451,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(uncompressed_length(''))); hex(concat(uncompressed_length(''))) @@ -1461,14 +1461,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(connection_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(inet_aton('127.1.1.1'))); hex(concat(inet_aton('127.1.1.1'))) @@ -1478,7 +1478,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(inet_ntoa(2130772225))); hex(concat(inet_ntoa(2130772225))) @@ -1491,7 +1491,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(31) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select 1; 1 @@ -1504,7 +1504,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(found_rows())); hex(concat(found_rows())) @@ -1514,21 +1514,21 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(uuid_short()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(uuid()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(36) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); coercibility(uuid()) coercibility(cast('a' as char character set latin1)) @@ -1541,14 +1541,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(37) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@a1:=1)); hex(concat(@a1:=1)) @@ -1562,7 +1562,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL, `c2` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a2=1; select hex(concat(@a2)); @@ -1577,7 +1577,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(20) DEFAULT NULL, `c2` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@a1:=sqrt(1))); hex(concat(@a1:=sqrt(1))) @@ -1591,7 +1591,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL, `c2` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a2=sqrt(1); select hex(concat(@a2)); @@ -1606,7 +1606,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL, `c2` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@a1:=1.1)); hex(concat(@a1:=1.1)) @@ -1620,7 +1620,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(4) DEFAULT NULL, `c2` decimal(2,1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a2=1.1; select hex(concat(@a2)); @@ -1635,7 +1635,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(83) DEFAULT NULL, `c2` decimal(65,38) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@@ft_max_word_len)); hex(concat(@@ft_max_word_len)) @@ -1648,7 +1648,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a'='a' IS TRUE)); hex(concat('a'='a' IS TRUE)) @@ -1658,7 +1658,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a'='a' IS NOT TRUE)); hex(concat('a'='a' IS NOT TRUE)) @@ -1668,7 +1668,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NOT 'a'='a')); hex(concat(NOT 'a'='a')) @@ -1678,7 +1678,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' IS NULL)); hex(concat('a' IS NULL)) @@ -1688,7 +1688,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' IS NOT NULL)); hex(concat('a' IS NOT NULL)) @@ -1698,7 +1698,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' rlike 'a')); hex(concat('a' rlike 'a')) @@ -1708,7 +1708,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(strcmp('a','b'))); hex(concat(strcmp('a','b'))) @@ -1718,7 +1718,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' like 'a')); hex(concat('a' like 'a')) @@ -1728,7 +1728,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' between 'b' and 'c')); hex(concat('a' between 'b' and 'c')) @@ -1738,7 +1738,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' in ('a','b'))); hex(concat('a' in ('a','b'))) @@ -1748,7 +1748,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(interval(23, 1, 15, 17, 30, 44, 200))); hex(concat(interval(23, 1, 15, 17, 30, 44, 200))) @@ -1758,7 +1758,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a varchar(10), fulltext key(a)); insert into t1 values ('a'); @@ -1770,7 +1770,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; select hex(ifnull(1,'a')); hex(ifnull(1,'a')) @@ -1780,7 +1780,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ifnull(1,1))); hex(concat(ifnull(1,1))) @@ -1790,7 +1790,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ifnull(1.1,1.1))); hex(concat(ifnull(1.1,1.1))) @@ -1800,7 +1800,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(if(1,'b',1)); hex(if(1,'b',1)) @@ -1810,7 +1810,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(if(1,1,'b')); hex(if(1,1,'b')) @@ -1820,7 +1820,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(if(1,1,1))); hex(concat(if(1,1,1))) @@ -1830,7 +1830,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(nullif(1,2))); hex(concat(nullif(1,2))) @@ -1840,7 +1840,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)')))); hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)')))) @@ -1850,7 +1850,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) @@ -1860,7 +1860,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))); hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) @@ -1870,7 +1870,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) @@ -1880,7 +1880,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))); hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) @@ -1890,7 +1890,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))); hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) @@ -1900,7 +1900,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))); hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) @@ -1910,7 +1910,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) @@ -1920,7 +1920,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) @@ -1935,7 +1935,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(y(GeomFromText('Point(1 2)')))); hex(concat(y(GeomFromText('Point(1 2)')))) @@ -1945,7 +1945,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))); hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) @@ -1955,7 +1955,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))); hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) @@ -1965,7 +1965,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(GeometryType(GeomFromText('Point(1 2)')))); hex(concat(GeometryType(GeomFromText('Point(1 2)')))) @@ -1975,7 +1975,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(AsText(GeomFromText('Point(1 2)')))); hex(concat(AsText(GeomFromText('Point(1 2)')))) @@ -1985,7 +1985,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(period_add(200902, 2))); hex(concat(period_add(200902, 2))) @@ -1995,7 +1995,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(period_diff(200902, 200802))); hex(concat(period_diff(200902, 200802))) @@ -2008,7 +2008,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(to_days(20090224))); hex(concat(to_days(20090224))) @@ -2018,7 +2018,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(dayofmonth(20090224))); hex(concat(dayofmonth(20090224))) @@ -2028,7 +2028,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(dayofyear(20090224))); hex(concat(dayofyear(20090224))) @@ -2038,7 +2038,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(hour('10:11:12'))); hex(concat(hour('10:11:12'))) @@ -2048,7 +2048,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(minute('10:11:12'))); hex(concat(minute('10:11:12'))) @@ -2058,7 +2058,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(second('10:11:12'))); hex(concat(second('10:11:12'))) @@ -2068,7 +2068,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(quarter(20090224))); hex(concat(quarter(20090224))) @@ -2078,7 +2078,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(week(20090224))); hex(concat(week(20090224))) @@ -2088,7 +2088,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(yearweek(20090224))); hex(concat(yearweek(20090224))) @@ -2098,7 +2098,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(year(20090224))); hex(concat(year(20090224))) @@ -2108,7 +2108,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(weekday(20090224))); hex(concat(weekday(20090224))) @@ -2118,7 +2118,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(dayofweek(20090224))); hex(concat(dayofweek(20090224))) @@ -2128,7 +2128,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(unix_timestamp(20090224))); hex(concat(unix_timestamp(20090224))) @@ -2138,7 +2138,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(17) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(time_to_sec('10:11:12'))); hex(concat(time_to_sec('10:11:12'))) @@ -2148,7 +2148,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(17) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(extract(year from 20090702))); hex(concat(extract(year from 20090702))) @@ -2158,7 +2158,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(microsecond('12:00:00.123456'))); hex(concat(microsecond('12:00:00.123456'))) @@ -2168,7 +2168,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(month(20090224))); hex(concat(month(20090224))) @@ -2178,14 +2178,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(last_day('2003-02-05')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select c1, hex(c1) from t1; c1 hex(c1) 2003-02-28 323030332D30322D3238 @@ -2195,7 +2195,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select c1, hex(c1) from t1; c1 hex(c1) 2000-07-03 323030302D30372D3033 @@ -2205,21 +2205,21 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(utc_date()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(curtime()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select repeat('a',20) as c1 limit 0; set timestamp=1216359724; @@ -2235,7 +2235,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(sec_to_time(2378))); hex(concat(sec_to_time(2378))) @@ -2245,7 +2245,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))); hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) @@ -2255,7 +2255,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(maketime(10,11,12))); hex(concat(maketime(10,11,12))) @@ -2265,7 +2265,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(get_format(DATE,'USA')); hex(get_format(DATE,'USA')) @@ -2275,7 +2275,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(17) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(from_unixtime(1111885200)),4)); hex(left(concat(from_unixtime(1111885200)),4)) @@ -2285,7 +2285,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))); hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) @@ -2295,7 +2295,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) @@ -2305,7 +2305,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2004-01-02 12:00:00 @@ -2318,7 +2318,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2009-01-01 @@ -2328,21 +2328,21 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(utc_timestamp()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(sysdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(addtime('00:00:00','11:22:33'))); hex(concat(addtime('00:00:00','11:22:33'))) @@ -2352,7 +2352,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(26) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(subtime('23:59:59','11:22:33'))); hex(concat(subtime('23:59:59','11:22:33'))) @@ -2362,7 +2362,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(26) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(elt(1,2,3)); hex(elt(1,2,3)) @@ -2372,7 +2372,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(export_set(1,2,3,4,2)); hex(export_set(1,2,3,4,2)) @@ -2382,7 +2382,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(127) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(insert(1133,3,0,22)); hex(insert(1133,3,0,22)) @@ -2392,7 +2392,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(lcase(123)); hex(lcase(123)) @@ -2402,7 +2402,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(123,1)); hex(left(123,1)) @@ -2412,7 +2412,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(lower(123)); hex(lower(123)) @@ -2422,7 +2422,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(lpad(1,2,0)); hex(lpad(1,2,0)) @@ -2432,7 +2432,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(ltrim(1)); hex(ltrim(1)) @@ -2442,7 +2442,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(mid(1,1,1)); hex(mid(1,1,1)) @@ -2452,7 +2452,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(repeat(1,2)); hex(repeat(1,2)) @@ -2462,7 +2462,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(replace(1,1,2)); hex(replace(1,1,2)) @@ -2472,7 +2472,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(reverse(12)); hex(reverse(12)) @@ -2482,7 +2482,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(right(123,1)); hex(right(123,1)) @@ -2492,7 +2492,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(rpad(1,2,0)); hex(rpad(1,2,0)) @@ -2502,7 +2502,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(rtrim(1)); hex(rtrim(1)) @@ -2512,7 +2512,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(soundex(1)); hex(soundex(1)) @@ -2522,7 +2522,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(substring(1,1,1)); hex(substring(1,1,1)) @@ -2532,7 +2532,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(trim(1)); hex(trim(1)) @@ -2542,7 +2542,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(ucase(1)); hex(ucase(1)) @@ -2552,7 +2552,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(upper(1)); hex(upper(1)) @@ -2562,14 +2562,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select repeat(' ', 64) as a limit 0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ("1.1"), ("2.1"); select a, hex(a) from t1; a hex(a) @@ -2591,7 +2591,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varchar(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a tinyint zerofill); insert into t1 values (1), (10), (100); @@ -2619,7 +2619,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varchar(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a smallint); insert into t1 values (1); @@ -2631,7 +2631,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varchar(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a smallint zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -2653,7 +2653,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varchar(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a mediumint zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -2675,7 +2675,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varchar(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a int zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -2697,7 +2697,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a bigint zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -2722,7 +2722,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varchar(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a float zerofill); insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); @@ -2747,7 +2747,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varchar(22) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a double zerofill); insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); @@ -2771,7 +2771,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a year); insert into t1 values (1); @@ -2783,7 +2783,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varchar(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a bit(64)); insert into t1 values (1); @@ -2795,7 +2795,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (0); @@ -2819,7 +2819,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varchar(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a date); insert into t1 values ('2001-02-03'); @@ -2833,7 +2833,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a time); insert into t1 values (1); @@ -2851,7 +2851,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a datetime); insert into t1 values ('2001-02-03 04:05:06'); @@ -2865,7 +2865,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varchar(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a tinyint); insert into t1 values (1); @@ -3181,14 +3181,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(1)) as c1; show columns from v1; Field Type Null Key Default Extra @@ -3212,14 +3212,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` decimal(18,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(123.45)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(123.45)) as c1; show columns from v1; Field Type Null Key Default Extra @@ -3243,14 +3243,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(123.45)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(123.45)) as c1; show columns from v1; Field Type Null Key Default Extra @@ -3274,14 +3274,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(cast('2001-01-02' as date))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(cast('2001-01-02' as date))) as c1; show columns from v1; Field Type Null Key Default Extra @@ -3362,112 +3362,112 @@ t2 CREATE TABLE `t2` ( `IF(a,a,'')` varchar(9) DEFAULT NULL, `CASE WHEN a THEN a ELSE '' END` varchar(9) DEFAULT NULL, `COALESCE(a,'')` varchar(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `CONCAT_WS(1,2,3)` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `INSERT(1133,3,0,22)` varchar(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LCASE(a) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `LCASE(a)` varchar(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT UCASE(a) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `UCASE(a)` varchar(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `REPEAT(1,2)` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `LEFT(123,2)` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `RIGHT(123,2)` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `LTRIM(123)` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `RTRIM(123)` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ELT(1,111,222,333)` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `REPLACE(111,2,3)` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `SUBSTRING_INDEX(111,111,1)` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `MAKE_SET(111,222,3)` varchar(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `SOUNDEX(1)` varchar(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8); SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `EXPORT_SET(1,'Y','N','',8)` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -3518,7 +3518,7 @@ t1 CREATE TABLE `t1` ( `field1_str2` varchar(19) DEFAULT NULL, `field_date` date DEFAULT NULL, `field_datetime` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SELECT DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1, @@ -3565,7 +3565,7 @@ t1 CREATE TABLE `t1` ( `addtime2` varchar(26) DEFAULT NULL, `date_add1` varchar(19) DEFAULT NULL, `date_add2` varchar(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; addtime1 addtime2 date_add1 date_add2 20:01:01 20:01:01 2001-01-01 10:01:11 2001-01-01 10:01:11 @@ -3631,7 +3631,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `d` date DEFAULT NULL, `bad` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; SET NAMES latin1; SET sql_mode=''; @@ -3675,13 +3675,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 41 @@ -3695,13 +3695,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 4141414141 @@ -3714,7 +3714,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 414141 @@ -3727,7 +3727,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 41414141412020202020 @@ -3919,13 +3919,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 61 @@ -3939,13 +3939,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 6161616161 @@ -3958,7 +3958,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 616161 @@ -3971,7 +3971,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 61616161612020202020 @@ -4163,13 +4163,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 42 @@ -4183,13 +4183,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET latin1 COLLATE latin1_general_cs DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 4242424242 @@ -4202,7 +4202,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 424242 @@ -4215,7 +4215,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 42424242422020202020 @@ -4407,13 +4407,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 61 @@ -4427,13 +4427,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 6161616161 @@ -4446,7 +4446,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 616161 @@ -4459,7 +4459,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 61616161610000000000 @@ -7724,7 +7724,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; c1 @@ -7747,7 +7747,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); c1 @@ -7770,7 +7770,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); c1 @@ -7793,7 +7793,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); c1 @@ -7819,7 +7819,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; a LENGTH(a) @@ -7845,7 +7845,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; c1 @@ -7868,7 +7868,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); c1 @@ -7891,7 +7891,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); c1 @@ -7914,7 +7914,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); c1 @@ -7940,7 +7940,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; a LENGTH(a) @@ -8047,7 +8047,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `t` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI'); SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub; c2 @@ -8320,7 +8320,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_swedish_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin1_swedish_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -8458,7 +8458,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_swedish_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin1_swedish_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -8597,7 +8597,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin1_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -8735,7 +8735,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin1_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -8876,7 +8876,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(50) DEFAULT NULL, KEY `a` (`a`), KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('111', '111'); INSERT INTO t1 VALUES ('222', '222'); INSERT INTO t1 VALUES ('333', '333'); @@ -8906,7 +8906,7 @@ t1 CREATE TABLE `t1` ( `CAST(1 AS BINARY)` varbinary(1) DEFAULT NULL, `CAST(@a AS BINARY)` varbinary(20) DEFAULT NULL, `CAST(@b:=3 AS BINARY)` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-8844 Unreadable control characters printed as is in warnings diff --git a/mysql-test/main/ctype_latin1_de.result b/mysql-test/main/ctype_latin1_de.result index 4fd366b2e8ece..a76e854a13f0e 100644 --- a/mysql-test/main/ctype_latin1_de.result +++ b/mysql-test/main/ctype_latin1_de.result @@ -226,8 +226,8 @@ create table t1 (word varchar(255) not null, word2 varchar(255) not null default show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `word` varchar(255) COLLATE latin1_german2_ci NOT NULL, - `word2` varchar(255) COLLATE latin1_german2_ci NOT NULL DEFAULT '', + `word` varchar(255) NOT NULL, + `word2` varchar(255) NOT NULL DEFAULT '', KEY `word` (`word`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae'); @@ -301,7 +301,7 @@ s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `s1` char(5) COLLATE latin1_german2_ci DEFAULT NULL + `s1` char(5) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci INSERT INTO t1 VALUES ('�'); INSERT INTO t1 VALUES ('ue'); @@ -492,7 +492,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) COLLATE latin1_german2_ci DEFAULT NULL, + `a` varchar(1) DEFAULT NULL, `b` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); @@ -547,7 +547,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) COLLATE latin1_german2_ci NOT NULL + `a` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -567,7 +567,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) COLLATE latin1_german2_ci DEFAULT NULL + `a` varchar(5) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; diff --git a/mysql-test/main/ctype_latin1_de.test b/mysql-test/main/ctype_latin1_de.test index dc261790f6c65..09cbcf0ad877c 100644 --- a/mysql-test/main/ctype_latin1_de.test +++ b/mysql-test/main/ctype_latin1_de.test @@ -1,6 +1,10 @@ # # Test latin_de character set # + +# Enable after fix MDEV-27904 and not earlier version 10.6 +-- source include/no_view_protocol.inc + create database latin1_german2_ci default character set latin1 collate latin1_german2_ci; use latin1_german2_ci; diff --git a/mysql-test/main/ctype_latin2.result b/mysql-test/main/ctype_latin2.result index d8fd22b53220d..9ab54f317c3f5 100644 --- a/mysql-test/main/ctype_latin2.result +++ b/mysql-test/main/ctype_latin2.result @@ -396,14 +396,14 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET latin2 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET latin2 COLLATE latin2_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 41 @@ -416,14 +416,14 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET latin2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 4141414141 @@ -436,7 +436,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 414141 @@ -449,7 +449,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 41414141412020202020 @@ -626,8 +626,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 64) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) CHARACTER SET latin2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(64) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (''); SELECT CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1; CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) @@ -678,13 +678,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET latin2 COLLATE latin2_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 61 @@ -698,13 +698,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET latin2 COLLATE latin2_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 6161616161 @@ -717,7 +717,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 616161 @@ -730,7 +730,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 61616161612020202020 diff --git a/mysql-test/main/ctype_latin2.test b/mysql-test/main/ctype_latin2.test index e80515993f279..e71a60a232465 100644 --- a/mysql-test/main/ctype_latin2.test +++ b/mysql-test/main/ctype_latin2.test @@ -1,4 +1,3 @@ - # Tests with the latin1 character set # --disable_warnings @@ -61,7 +60,7 @@ drop table t1; --echo # --echo # WL#3664 WEIGHT_STRING --echo # - +--disable_service_connection set names latin2; --source include/weight_string.inc --source include/weight_string_l1.inc @@ -70,6 +69,7 @@ set names latin2; set collation_connection=latin2_bin; --source include/weight_string.inc --source include/weight_string_l1.inc +--enable_service_connection --echo # --echo # End of 5.6 tests diff --git a/mysql-test/main/ctype_latin2_ch.result b/mysql-test/main/ctype_latin2_ch.result index 962c29f7ab4ca..0286cc1f17285 100644 --- a/mysql-test/main/ctype_latin2_ch.result +++ b/mysql-test/main/ctype_latin2_ch.result @@ -55,7 +55,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; c1 @@ -78,7 +78,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); c1 @@ -101,7 +101,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); c1 @@ -124,7 +124,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); c1 @@ -150,7 +150,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; a LENGTH(a) @@ -473,7 +473,7 @@ t1 CREATE TABLE `t1` ( `ID` smallint(5) unsigned zerofill NOT NULL AUTO_INCREMENT, `Post` enum('','B','O','Z','U') CHARACTER SET latin2 COLLATE latin2_czech_cs DEFAULT NULL, PRIMARY KEY (`ID`) -) ENGINE=MyISAM AUTO_INCREMENT=135 DEFAULT CHARSET=latin2 +) ENGINE=MyISAM AUTO_INCREMENT=135 DEFAULT CHARSET=latin2 COLLATE=latin2_general_ci INSERT INTO t1 (ID,Post) VALUES (00041,''); SELECT ID, Post, HEX(WEIGHT_STRING(Post)) FROM t1; ID Post HEX(WEIGHT_STRING(Post)) @@ -513,13 +513,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0301030103010300 @@ -533,13 +533,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET latin2 COLLATE latin2_czech_cs DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(24) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 030303030301030303030301030303030301030303030300 @@ -552,7 +552,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(24) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 030303030301030303030301030303030301030303030300 @@ -565,7 +565,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(24) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 030303030301030303030301030303030301030303030300 diff --git a/mysql-test/main/ctype_latin2_ch.test b/mysql-test/main/ctype_latin2_ch.test index 06ccd2c978284..6d3453ed1fb30 100644 --- a/mysql-test/main/ctype_latin2_ch.test +++ b/mysql-test/main/ctype_latin2_ch.test @@ -30,10 +30,11 @@ select * from t1 where tt like '%AA%'; drop table t1; # End of 4.1 tests - +--disable_service_connection set names latin2 collate latin2_czech_cs; --source include/ctype_pad_space.inc --source include/ctype_like_cond_propagation.inc +--enable_service_connection # We can not use ctype_filesort.inc because # order of SPACE and TAB is not strict @@ -219,9 +220,10 @@ DROP TABLE t1; --echo # --echo # WL#3664 WEIGHT_STRING --echo # - +--disable_service_connection set names latin2 collate latin2_czech_cs; --source include/ctype_pad_space.inc +--enable_service_connection # We can not use ctype_filesort.inc because # order of SPACE and TAB is not strict #--source include/ctype_filesort.inc @@ -230,6 +232,8 @@ set names latin2 collate latin2_czech_cs; --echo # Note: --echo # latin2_czech_cs does not support WEIGHT_STRING in full extent --echo # +#check after fix MDEV-29290 +--disable_view_protocol --source include/weight_string.inc --source include/weight_string_chde.inc --source include/weight_string_l1.inc @@ -238,6 +242,7 @@ set names latin2 collate latin2_czech_cs; --source include/weight_string_l4.inc --source include/weight_string_l12.inc --source include/weight_string_l14.inc +--enable_view_protocol --echo # --echo # End of 5.6 tests diff --git a/mysql-test/main/ctype_ldml.result b/mysql-test/main/ctype_ldml.result index d4b24ad9af357..001ac2f03483c 100644 --- a/mysql-test/main/ctype_ldml.result +++ b/mysql-test/main/ctype_ldml.result @@ -3039,6 +3039,51 @@ SELECT 'chž'< 'i'; SELECT 'a' COLLATE utf8_czech_test_bad_w2; ERROR HY000: Unknown collation: 'utf8_czech_test_bad_w2' # +# End of 10.2 tests +# +# +# Start of 10.3 tests +# +# +# MDEV-30556 UPPER() returns an empty string for U+0251 in Unicode-5.2.0+ collations for utf8 +# +SET NAMES utf8mb4 COLLATE utf8mb4_test_520_nopad_ci; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_test_520_nopad_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE ȿ +240 C980 E2B1BF ɀ +250 C990 E2B1AF ɐ +251 C991 E2B1AD ɑ +252 C992 E2B1B0 ɒ +26B C9AB E2B1A2 ɫ +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +# +# End of 10.3 tests +# +# # MDEV-7947 my_charset_same: strcmp() takes 0.37% in OLTP RO # SHOW COLLATION LIKE 'latin1_test_replace'; @@ -3046,6 +3091,9 @@ Collation Charset Id Default Compiled Sortlen SELECT 'foo' = 'foo ' COLLATE latin1_test_replace; ERROR HY000: Unknown collation: 'latin1_test_replace' # +# End of 10.5 tests +# +# # MDEV-27042 UCA: Resetting contractions to ignorable does not work well # CREATE TABLE t1 ( @@ -3079,3 +3127,6 @@ tèl.123 10020E8B0F2E025D0E2A0E2B0E2C ťèl.123 10020E8B0F2E025D0E2A0E2B0E2C tex.123 10020E8B105A025D0E2A0E2B0E2C DROP TABLE t1; +# +# End of 10.8 tests +# diff --git a/mysql-test/main/ctype_ldml.test b/mysql-test/main/ctype_ldml.test index 0fda35d278d0e..c9397d7312671 100644 --- a/mysql-test/main/ctype_ldml.test +++ b/mysql-test/main/ctype_ldml.test @@ -3,6 +3,9 @@ --source include/have_utf16.inc --source include/have_utf32.inc +#remove this include after fix MDEV-27871 +--source include/no_view_protocol.inc + --disable_query_log call mtr.add_suppression("Charset id.*trying to replace"); --enable_query_log @@ -608,6 +611,27 @@ SELECT 'chž'< 'i'; --error ER_UNKNOWN_COLLATION SELECT 'a' COLLATE utf8_czech_test_bad_w2; +--echo # +--echo # End of 10.2 tests +--echo # + + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-30556 UPPER() returns an empty string for U+0251 in Unicode-5.2.0+ collations for utf8 +--echo # + +SET NAMES utf8mb4 COLLATE utf8mb4_test_520_nopad_ci; +--source include/ctype_casefolding.inc + + +--echo # +--echo # End of 10.3 tests +--echo # + --echo # --echo # MDEV-7947 my_charset_same: strcmp() takes 0.37% in OLTP RO @@ -617,6 +641,9 @@ SHOW COLLATION LIKE 'latin1_test_replace'; --error ER_UNKNOWN_COLLATION SELECT 'foo' = 'foo ' COLLATE latin1_test_replace; +--echo # +--echo # End of 10.5 tests +--echo # --echo # --echo # MDEV-27042 UCA: Resetting contractions to ignorable does not work well @@ -636,3 +663,7 @@ SELECT * FROM t1 WHERE phone='123' ORDER BY BINARY phone; SELECT * FROM t1 WHERE phone<>'123' ORDER BY BINARY phone; SELECT phone, HEX(WEIGHT_STRING(phone)) FROM t1 ORDER BY phone, BINARY phone; DROP TABLE t1; + +--echo # +--echo # End of 10.8 tests +--echo # diff --git a/mysql-test/main/ctype_like_range.result b/mysql-test/main/ctype_like_range.result index d8e621fd056a9..e5e5e61126b11 100644 --- a/mysql-test/main/ctype_like_range.result +++ b/mysql-test/main/ctype_like_range.result @@ -4421,7 +4421,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `mn` varchar(10) DEFAULT like_range_min(`a`,10), `mx` varchar(10) DEFAULT like_range_max(`a`,10) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('a'),('a_'),('a%'); SELECT a, HEX(mn), HEX(mx) FROM t1; a HEX(mn) HEX(mx) diff --git a/mysql-test/main/ctype_many.result b/mysql-test/main/ctype_many.result index 74a870da239cc..e3706f9d63746 100644 --- a/mysql-test/main/ctype_many.result +++ b/mysql-test/main/ctype_many.result @@ -7,41 +7,41 @@ koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL default '' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `comment` char(32) CHARACTER SET latin1 NOT NULL, - `koi8_ru_f` char(32) CHARACTER SET koi8r NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin5 + `comment` char(32) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL, + `koi8_ru_f` char(32) CHARACTER SET koi8r COLLATE koi8r_general_ci NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin5 COLLATE=latin5_turkish_ci ALTER TABLE t1 CHANGE comment comment CHAR(32) CHARACTER SET latin2 NOT NULL; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `comment` char(32) CHARACTER SET latin2 NOT NULL, - `koi8_ru_f` char(32) CHARACTER SET koi8r NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin5 + `comment` char(32) CHARACTER SET latin2 COLLATE latin2_general_ci NOT NULL, + `koi8_ru_f` char(32) CHARACTER SET koi8r COLLATE koi8r_general_ci NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin5 COLLATE=latin5_turkish_ci ALTER TABLE t1 ADD latin5_f CHAR(32) NOT NULL; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `comment` char(32) CHARACTER SET latin2 NOT NULL, - `koi8_ru_f` char(32) CHARACTER SET koi8r NOT NULL DEFAULT '', + `comment` char(32) CHARACTER SET latin2 COLLATE latin2_general_ci NOT NULL, + `koi8_ru_f` char(32) CHARACTER SET koi8r COLLATE koi8r_general_ci NOT NULL DEFAULT '', `latin5_f` char(32) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin5 +) ENGINE=MyISAM DEFAULT CHARSET=latin5 COLLATE=latin5_turkish_ci ALTER TABLE t1 DEFAULT CHARSET=latin2; ALTER TABLE t1 ADD latin2_f CHAR(32) NOT NULL; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) NOT NULL, - `koi8_ru_f` char(32) CHARACTER SET koi8r NOT NULL DEFAULT '', - `latin5_f` char(32) CHARACTER SET latin5 NOT NULL, + `koi8_ru_f` char(32) CHARACTER SET koi8r COLLATE koi8r_general_ci NOT NULL DEFAULT '', + `latin5_f` char(32) CHARACTER SET latin5 COLLATE latin5_turkish_ci NOT NULL, `latin2_f` char(32) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin2 +) ENGINE=MyISAM DEFAULT CHARSET=latin2 COLLATE=latin2_general_ci ALTER TABLE t1 DROP latin2_f, DROP latin5_f; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) NOT NULL, - `koi8_ru_f` char(32) CHARACTER SET koi8r NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin2 + `koi8_ru_f` char(32) CHARACTER SET koi8r COLLATE koi8r_general_ci NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin2 COLLATE=latin2_general_ci INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A'); INSERT INTO t1 (koi8_ru_f,comment) VALUES ('b','LAT SMALL B'); INSERT INTO t1 (koi8_ru_f,comment) VALUES ('c','LAT SMALL C'); diff --git a/mysql-test/main/ctype_mb.result b/mysql-test/main/ctype_mb.result index 50f7d17fef46c..67aedbf209e76 100644 --- a/mysql-test/main/ctype_mb.result +++ b/mysql-test/main/ctype_mb.result @@ -3,18 +3,18 @@ CREATE TABLE t1 SELECT _utf8'test' as c1, _utf8'тест' as c2; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8mb3 NOT NULL, - `c2` varchar(4) CHARACTER SET utf8mb3 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `c2` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DELETE FROM t1; ALTER TABLE t1 ADD c3 CHAR(4) CHARACTER SET utf8; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8mb3 NOT NULL, - `c2` varchar(4) CHARACTER SET utf8mb3 NOT NULL, - `c3` char(4) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `c2` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `c3` char(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT IGNORE INTO t1 VALUES ('aaaabbbbccccdddd','aaaabbbbccccdddd','aaaabbbbccccdddd'); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 @@ -28,9 +28,9 @@ CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8, KEY key_a(a(3))); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(4) CHARACTER SET utf8mb3 DEFAULT NULL, + `a` char(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, KEY `key_a` (`a`(3)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 1 key_a 1 a A NULL 3 NULL YES BTREE NO @@ -40,7 +40,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(4) DEFAULT NULL, KEY `key_a` (`a`(3)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 1 key_a 1 a A NULL 3 NULL YES BTREE NO @@ -48,9 +48,9 @@ ALTER TABLE t1 CHANGE a a CHAR(4) CHARACTER SET utf8; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(4) CHARACTER SET utf8mb3 DEFAULT NULL, + `a` char(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, KEY `key_a` (`a`(3)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 1 key_a 1 a A NULL 3 NULL YES BTREE NO diff --git a/mysql-test/main/ctype_nopad_8bit.result b/mysql-test/main/ctype_nopad_8bit.result index 2b089ce299456..ddd1f3186c925 100644 --- a/mysql-test/main/ctype_nopad_8bit.result +++ b/mysql-test/main/ctype_nopad_8bit.result @@ -13,7 +13,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'dec8_swedish_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE dec8_swedish_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=dec8 COLLATE=dec8_swedish_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -151,7 +151,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'dec8_swedish_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE dec8_swedish_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=dec8 COLLATE=dec8_swedish_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -290,7 +290,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'dec8_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE dec8_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=dec8 COLLATE=dec8_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -428,7 +428,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'dec8_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE dec8_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=dec8 COLLATE=dec8_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -568,7 +568,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp850_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp850_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=cp850 COLLATE=cp850_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -706,7 +706,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp850_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp850_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=cp850 COLLATE=cp850_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -845,7 +845,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp850_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp850_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=cp850 COLLATE=cp850_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -983,7 +983,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp850_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp850_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=cp850 COLLATE=cp850_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -1123,7 +1123,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hp8_english_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE hp8_english_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=hp8 COLLATE=hp8_english_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -1261,7 +1261,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hp8_english_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE hp8_english_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=hp8 COLLATE=hp8_english_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -1400,7 +1400,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hp8_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE hp8_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=hp8 COLLATE=hp8_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -1538,7 +1538,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hp8_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE hp8_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=hp8 COLLATE=hp8_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -1678,7 +1678,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8r_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE koi8r_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=koi8r COLLATE=koi8r_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -1816,7 +1816,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8r_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE koi8r_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=koi8r COLLATE=koi8r_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -1955,7 +1955,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8r_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE koi8r_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=koi8r COLLATE=koi8r_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2093,7 +2093,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8r_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE koi8r_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=koi8r COLLATE=koi8r_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2233,7 +2233,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin2_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin2_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin2 COLLATE=latin2_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2371,7 +2371,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin2_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin2_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=latin2 COLLATE=latin2_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2510,7 +2510,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin2_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin2_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin2 COLLATE=latin2_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2648,7 +2648,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin2_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin2_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=latin2 COLLATE=latin2_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2788,7 +2788,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_swedish_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE swe7_swedish_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=swe7 COLLATE=swe7_swedish_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2926,7 +2926,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_swedish_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE swe7_swedish_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=swe7 COLLATE=swe7_swedish_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -3065,7 +3065,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE swe7_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=swe7 COLLATE=swe7_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -3203,7 +3203,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE swe7_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=swe7 COLLATE=swe7_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -3343,7 +3343,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ascii_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE ascii_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=ascii COLLATE=ascii_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -3481,7 +3481,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ascii_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE ascii_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=ascii COLLATE=ascii_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -3620,7 +3620,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ascii_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE ascii_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=ascii COLLATE=ascii_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -3758,7 +3758,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ascii_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE ascii_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=ascii COLLATE=ascii_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -3898,7 +3898,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hebrew_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE hebrew_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=hebrew COLLATE=hebrew_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -4036,7 +4036,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hebrew_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE hebrew_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=hebrew COLLATE=hebrew_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -4175,7 +4175,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hebrew_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE hebrew_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=hebrew COLLATE=hebrew_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -4313,7 +4313,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hebrew_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE hebrew_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=hebrew COLLATE=hebrew_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -4453,7 +4453,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8u_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE koi8u_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=koi8u COLLATE=koi8u_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -4591,7 +4591,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8u_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE koi8u_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=koi8u COLLATE=koi8u_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -4730,7 +4730,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8u_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE koi8u_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=koi8u COLLATE=koi8u_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -4868,7 +4868,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8u_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE koi8u_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=koi8u COLLATE=koi8u_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -5008,7 +5008,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'greek_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE greek_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=greek COLLATE=greek_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -5146,7 +5146,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'greek_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE greek_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=greek COLLATE=greek_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -5285,7 +5285,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'greek_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE greek_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=greek COLLATE=greek_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -5423,7 +5423,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'greek_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE greek_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=greek COLLATE=greek_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -5563,7 +5563,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1250_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp1250_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -5701,7 +5701,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1250_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp1250_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=cp1250 COLLATE=cp1250_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -5840,7 +5840,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1250_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp1250_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -5978,7 +5978,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1250_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp1250_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=cp1250 COLLATE=cp1250_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6118,7 +6118,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1257_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp1257_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=cp1257 COLLATE=cp1257_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6256,7 +6256,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1257_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp1257_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=cp1257 COLLATE=cp1257_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6395,7 +6395,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1257_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp1257_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=cp1257 COLLATE=cp1257_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6533,7 +6533,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1257_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp1257_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=cp1257 COLLATE=cp1257_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6673,7 +6673,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin5_turkish_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin5_turkish_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin5 COLLATE=latin5_turkish_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6811,7 +6811,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin5_turkish_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin5_turkish_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=latin5 COLLATE=latin5_turkish_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6950,7 +6950,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin5_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin5_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin5 COLLATE=latin5_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -7088,7 +7088,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin5_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin5_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=latin5 COLLATE=latin5_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -7228,7 +7228,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'armscii8_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE armscii8_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=armscii8 COLLATE=armscii8_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -7366,7 +7366,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'armscii8_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE armscii8_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=armscii8 COLLATE=armscii8_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -7505,7 +7505,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'armscii8_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE armscii8_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=armscii8 COLLATE=armscii8_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -7643,7 +7643,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'armscii8_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE armscii8_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=armscii8 COLLATE=armscii8_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -7783,7 +7783,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp866_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp866_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=cp866 COLLATE=cp866_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -7921,7 +7921,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp866_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp866_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=cp866 COLLATE=cp866_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -8060,7 +8060,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp866_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp866_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=cp866 COLLATE=cp866_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -8198,7 +8198,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp866_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp866_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=cp866 COLLATE=cp866_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -8338,7 +8338,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'keybcs2_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE keybcs2_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=keybcs2 COLLATE=keybcs2_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -8476,7 +8476,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'keybcs2_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE keybcs2_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=keybcs2 COLLATE=keybcs2_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -8615,7 +8615,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'keybcs2_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE keybcs2_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=keybcs2 COLLATE=keybcs2_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -8753,7 +8753,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'keybcs2_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE keybcs2_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=keybcs2 COLLATE=keybcs2_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -8893,7 +8893,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macce_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE macce_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=macce COLLATE=macce_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -9031,7 +9031,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macce_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE macce_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=macce COLLATE=macce_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -9170,7 +9170,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macce_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE macce_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=macce COLLATE=macce_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -9308,7 +9308,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macce_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE macce_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=macce COLLATE=macce_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -9448,7 +9448,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macroman_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE macroman_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=macroman COLLATE=macroman_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -9586,7 +9586,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macroman_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE macroman_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=macroman COLLATE=macroman_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -9725,7 +9725,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macroman_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE macroman_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=macroman COLLATE=macroman_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -9863,7 +9863,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macroman_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE macroman_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=macroman COLLATE=macroman_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -10003,7 +10003,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp852_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp852_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=cp852 COLLATE=cp852_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -10141,7 +10141,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp852_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp852_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=cp852 COLLATE=cp852_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -10280,7 +10280,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp852_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp852_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=cp852 COLLATE=cp852_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -10418,7 +10418,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp852_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp852_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=cp852 COLLATE=cp852_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -10558,7 +10558,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin7_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin7_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin7 COLLATE=latin7_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -10696,7 +10696,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin7_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin7_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=latin7 COLLATE=latin7_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -10835,7 +10835,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin7_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin7_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin7 COLLATE=latin7_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -10973,7 +10973,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin7_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin7_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=latin7 COLLATE=latin7_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -11113,7 +11113,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1251_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp1251_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -11251,7 +11251,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1251_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp1251_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -11390,7 +11390,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1251_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp1251_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -11528,7 +11528,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1251_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp1251_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COLLATE=cp1251_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -11668,7 +11668,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1256_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp1256_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=cp1256 COLLATE=cp1256_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -11806,7 +11806,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1256_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp1256_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=cp1256 COLLATE=cp1256_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -11945,7 +11945,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1256_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp1256_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=cp1256 COLLATE=cp1256_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -12083,7 +12083,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1256_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE cp1256_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=cp1256 COLLATE=cp1256_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -12223,7 +12223,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'geostd8_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE geostd8_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=geostd8 COLLATE=geostd8_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -12361,7 +12361,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'geostd8_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE geostd8_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=geostd8 COLLATE=geostd8_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -12500,7 +12500,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'geostd8_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE geostd8_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=geostd8 COLLATE=geostd8_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -12638,7 +12638,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'geostd8_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE geostd8_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=geostd8 COLLATE=geostd8_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); diff --git a/mysql-test/main/ctype_recoding.result b/mysql-test/main/ctype_recoding.result index 82e42f6278227..1de68d62b398c 100644 --- a/mysql-test/main/ctype_recoding.result +++ b/mysql-test/main/ctype_recoding.result @@ -6,8 +6,8 @@ CREATE TABLE t2 (a CHAR(10) CHARACTER SET utf8); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(10) CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` char(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT a FROM t1; a ����� @@ -30,8 +30,8 @@ CREATE TABLE t2 (a TEXT CHARACTER SET utf8); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` text CHARACTER SET cp1251 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` text CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(a) FROM t1; HEX(a) EFF0EEE1E0 @@ -50,8 +50,8 @@ Tables_in_test SHOW CREATE TABLE �������; Table Create Table ������� CREATE TABLE `�������` ( - `����` char(32) CHARACTER SET koi8r NOT NULL COMMENT '����������� ����' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='����������� �������' + `����` char(32) CHARACTER SET koi8r COLLATE koi8r_general_ci NOT NULL COMMENT '����������� ����' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='����������� �������' SHOW FIELDS FROM �������; Field Type Null Key Default Extra ���� char(32) NO NULL @@ -62,8 +62,8 @@ Tables_in_test SHOW CREATE TABLE �������; Table Create Table ������� CREATE TABLE `�������` ( - `����` char(32) CHARACTER SET koi8r NOT NULL COMMENT '����������� ����' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='����������� �������' + `����` char(32) CHARACTER SET koi8r COLLATE koi8r_general_ci NOT NULL COMMENT '����������� ����' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='����������� �������' SHOW FIELDS FROM �������; Field Type Null Key Default Extra ���� char(32) NO NULL @@ -74,8 +74,8 @@ Tables_in_test SHOW CREATE TABLE таблица; Table Create Table таблица CREATE TABLE `таблица` ( - `поле` char(32) CHARACTER SET koi8r NOT NULL COMMENT 'комментарий поля' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='комментарий таблицы' + `поле` char(32) CHARACTER SET koi8r COLLATE koi8r_general_ci NOT NULL COMMENT 'комментарий поля' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='комментарий таблицы' SHOW FIELDS FROM таблица; Field Type Null Key Default Extra поле char(32) NO NULL @@ -118,13 +118,13 @@ SHOW CREATE TABLE `тест`; Table Create Table тест CREATE TABLE `тест` ( `тест` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET NAMES utf8; SHOW CREATE TABLE `тест`; Table Create Table тест CREATE TABLE `тест` ( `тест` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE `тест`; SET NAMES binary; SET character_set_connection=utf8; @@ -143,7 +143,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `�` char(128) DEFAULT '�', `�1` enum('�1','�2') DEFAULT '�2' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW COLUMNS FROM t1; Field Type Null Key Default Extra � char(128) YES � @@ -154,7 +154,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `ä` char(128) DEFAULT 'ä', `ä1` enum('ä1','ä2') DEFAULT 'ä2' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW COLUMNS FROM t1; Field Type Null Key Default Extra ä char(128) YES ä @@ -261,8 +261,8 @@ create table t1(a char character set cp1251 default _koi8r 0xFF); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(1) CHARACTER SET cp1251 DEFAULT '�' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` char(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT '�' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(a char character set latin1 default _cp1251 0xFF); ERROR 42000: Invalid default value for 'a' diff --git a/mysql-test/main/ctype_recoding.test b/mysql-test/main/ctype_recoding.test index ba2e65b3626c4..cc58d4aeff99b 100644 --- a/mysql-test/main/ctype_recoding.test +++ b/mysql-test/main/ctype_recoding.test @@ -74,11 +74,13 @@ SHOW TABLES IN SET CHARACTER SET koi8r; DROP DATABASE ����; +# Enable view protocol after fix MDEV-27944 +--disable_view_protocol SET NAMES koi8r; SELECT hex('����'); SET character_set_connection=cp1251; SELECT hex('����'); - +--enable_view_protocol USE test; # Bug#4417 @@ -94,9 +96,12 @@ DROP TABLE `тест`; SET NAMES binary; SET character_set_connection=utf8; SELECT 'тест' as s; +# enable view-protocol in 10.6 version +--disable_view_protocol SET NAMES utf8; SET character_set_connection=binary; SELECT 'тест' as s; +--enable_view_protocol # Bug#4417, another aspect: # Check that both "SHOW CREATE TABLE" and "SHOW COLUMNS" @@ -173,6 +178,8 @@ drop table t1; # # Check more automatic conversion # +# Enable view protocol after fix MDEV-28017 +--disable_view_protocol set names koi8r; create table t1 (c1 char(10) character set cp1251); insert into t1 values ('�'); @@ -197,7 +204,8 @@ select rpad(c1,3,' #select case c1 when '�' then '�' when '�' then '�' else 'c' end from t1; #select export_set(5,c1,'�'), export_set(5,'�',c1) from t1; drop table t1; - +--enable_view_protocol + # # Bug 20695: problem with field default value's character set # diff --git a/mysql-test/main/ctype_sjis.result b/mysql-test/main/ctype_sjis.result index 3914bdaf17934..4606c4bd8f303 100644 --- a/mysql-test/main/ctype_sjis.result +++ b/mysql-test/main/ctype_sjis.result @@ -51,8 +51,8 @@ create table t1(c enum(0x9353,0x9373) character set sjis); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` enum('�S','�s') CHARACTER SET sjis DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c` enum('�S','�s') CHARACTER SET sjis COLLATE sjis_japanese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (0x9353); insert into t1 values (0x9373); select hex(c) from t1; @@ -690,8 +690,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `code` varchar(8) DEFAULT NULL, - `a` varchar(1) CHARACTER SET sjis NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET sjis COLLATE sjis_japanese_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code; Warnings: Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1 @@ -15210,14 +15210,14 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET sjis NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET sjis COLLATE sjis_japanese_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 41 @@ -15230,14 +15230,14 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET sjis DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET sjis COLLATE sjis_japanese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 4141414141 @@ -15250,7 +15250,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 414141 @@ -15263,7 +15263,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 41414141412020202020 @@ -15470,13 +15470,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET sjis COLLATE sjis_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 61 @@ -15490,13 +15490,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET sjis COLLATE sjis_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 6161616161 @@ -15509,7 +15509,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 616161 @@ -15522,7 +15522,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 61616161612020202020 @@ -18834,8 +18834,8 @@ CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET sjis DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET sjis COLLATE sjis_japanese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('�\'),('�\t'); INSERT INTO t1 VALUES ('\\�\'),('\\�\t'),('\\�\t\t'); INSERT INTO t1 VALUES ('''�\'),('�\'''); @@ -18873,8 +18873,8 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET sjis DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET sjis COLLATE sjis_japanese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (BINARY('�\')),(BINARY('�\t')); INSERT INTO t1 VALUES (BINARY('\\�\')),(BINARY('\\�\t')),(BINARY('\\�\t\t')); INSERT INTO t1 VALUES (BINARY('''�\')),(BINARY('�\''')); @@ -18912,8 +18912,8 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET sjis DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET sjis COLLATE sjis_japanese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (_BINARY'�\'),(_BINARY'�\t'); INSERT INTO t1 VALUES (_BINARY'\\�\'),(_BINARY'\\�\t'),(_BINARY'\\�\t\t'); INSERT INTO t1 VALUES (_BINARY'''�\'),(_BINARY'�\'''); @@ -18958,8 +18958,8 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET sjis DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET sjis COLLATE sjis_japanese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('�\['),('\�\['); SELECT HEX(a) FROM t1; HEX(a) @@ -18979,7 +18979,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('�\['),('\�\['); SELECT HEX(a) FROM t1; HEX(a) @@ -19020,7 +19020,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'sjis_japanese_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE sjis_japanese_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -19158,7 +19158,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'sjis_japanese_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE sjis_japanese_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -19297,7 +19297,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'sjis_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE sjis_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -19435,7 +19435,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'sjis_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE sjis_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -19567,6 +19567,22 @@ SET DEFAULT_STORAGE_ENGINE=Default; # End of 10.2 tests # # +# Start of 10.4 tests +# +# +# MDEV-26953 Assertion `!str || str != Ptr || !is_alloced()' failed in String::copy upon SELECT with sjis +# +SET NAMES sjis; +CREATE TABLE t (a VARCHAR(3)); +INSERT INTO t VALUES (''),(''); +SELECT GROUP_CONCAT(PASSWORD(a)) AS f FROM t; +f +, +DROP TABLE t; +# +# End of 10.4 tests +# +# # Start of 10.5 tests # # @@ -19586,12 +19602,6 @@ EXECUTE IMMEDIATE _cp1257 0xD182; 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 '�_0143�_201A' at line 1 SET NAMES sjis; # -# End of 10.5 tests -# -# -# Start of 10.5 tests -# -# # MDEV-22625 SIGSEGV in intern_find_sys_var (optimized builds) # SET NAMES sjis; diff --git a/mysql-test/main/ctype_sjis.test b/mysql-test/main/ctype_sjis.test index d255b6267fda4..c05cbbad01c2b 100644 --- a/mysql-test/main/ctype_sjis.test +++ b/mysql-test/main/ctype_sjis.test @@ -1,3 +1,4 @@ +-- source include/no_valgrind_without_big.inc -- source include/have_sjis.inc # @@ -64,6 +65,7 @@ select hex(c) from t1; drop table t1; +--disable_service_connection SET collation_connection='sjis_japanese_ci'; -- source include/ctype_filesort.inc -- source include/ctype_innodb_like.inc @@ -77,6 +79,7 @@ SET collation_connection='sjis_bin'; -- source include/ctype_like_escape.inc -- source include/ctype_like_range_f1f2.inc -- source include/ctype_ascii_order.inc +--enable_service_connection # Check parsing of string literals in SJIS with multibyte characters that # have an embedded \ in them. (Bug #8303) @@ -175,6 +178,8 @@ WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> --echo # WL#3090 Japanese Character Set adjustments --echo # Test sjis->Unicode conversion --echo # +# enable view-protocol in 10.6 version +--disable_view_protocol SELECT HEX(a), HEX(CONVERT(a USING utf8)) as b FROM t1 WHERE a<>'' HAVING b<>'3F' ORDER BY code; @@ -189,6 +194,7 @@ DROP TABLE t1; SELECT HEX(a), HEX(CONVERT(a using sjis)) as b FROM t1 HAVING b<>'3F' ORDER BY BINARY a; DROP TABLE t1; +--enable_view_protocol --echo # --echo # End of 5.5 tests @@ -203,6 +209,9 @@ DROP TABLE t1; --echo # WL#3664 WEIGHT_STRING --echo # +# enable view-protocol after fix MDEV-27871 +--disable_view_protocol + set names sjis; --source include/weight_string.inc --source include/weight_string_l1.inc @@ -214,6 +223,8 @@ set collation_connection=sjis_bin; --source include/weight_string_l1.inc --source include/weight_string_8140.inc +--enable_view_protocol + --echo # --echo # End of 5.6 tests --echo # @@ -222,13 +233,21 @@ set collation_connection=sjis_bin; --echo # Start of 10.0 tests --echo # +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +# (it is necessary to run the view-protocol not in util session ) +--disable_view_protocol + let $ctype_unescape_combinations=selected; --source include/ctype_unescape.inc + --character_set sjis SET NAMES sjis; --source include/ctype_E05C.inc +--enable_view_protocol + --echo # --echo # End of 10.0 tests @@ -263,6 +282,24 @@ let $coll_pad='sjis_bin'; --echo # End of 10.2 tests --echo # +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-26953 Assertion `!str || str != Ptr || !is_alloced()' failed in String::copy upon SELECT with sjis +--echo # + +SET NAMES sjis; +CREATE TABLE t (a VARCHAR(3)); +INSERT INTO t VALUES (''),(''); +SELECT GROUP_CONCAT(PASSWORD(a)) AS f FROM t; +DROP TABLE t; + +--echo # +--echo # End of 10.4 tests +--echo # + --echo # --echo # Start of 10.5 tests --echo # @@ -288,16 +325,6 @@ EXECUTE IMMEDIATE _cp1257 0xD182; SET NAMES sjis; - ---echo # ---echo # End of 10.5 tests ---echo # - - ---echo # ---echo # Start of 10.5 tests ---echo # - --echo # --echo # MDEV-22625 SIGSEGV in intern_find_sys_var (optimized builds) --echo # diff --git a/mysql-test/main/ctype_swe7.result b/mysql-test/main/ctype_swe7.result index db65b6b8a1a3b..8397db11a38ad 100644 --- a/mysql-test/main/ctype_swe7.result +++ b/mysql-test/main/ctype_swe7.result @@ -3089,7 +3089,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_swedish_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE ?t1? ( - ?a? varchar(10) COLLATE swe7_swedish_nopad_ci NOT NULL, + ?a? varchar(10) NOT NULL, PRIMARY KEY (?a?) ) ENGINE=MyISAM DEFAULT CHARSET=swe7 COLLATE=swe7_swedish_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -3227,7 +3227,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_swedish_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE ?t1? ( - ?a? varchar(10) COLLATE swe7_swedish_nopad_ci NOT NULL, + ?a? varchar(10) NOT NULL, PRIMARY KEY (?a?) ) ENGINE=MEMORY DEFAULT CHARSET=swe7 COLLATE=swe7_swedish_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -3366,7 +3366,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE ?t1? ( - ?a? varchar(10) COLLATE swe7_nopad_bin NOT NULL, + ?a? varchar(10) NOT NULL, PRIMARY KEY (?a?) ) ENGINE=MyISAM DEFAULT CHARSET=swe7 COLLATE=swe7_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -3504,7 +3504,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE ?t1? ( - ?a? varchar(10) COLLATE swe7_nopad_bin NOT NULL, + ?a? varchar(10) NOT NULL, PRIMARY KEY (?a?) ) ENGINE=MEMORY DEFAULT CHARSET=swe7 COLLATE=swe7_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); diff --git a/mysql-test/main/ctype_swe7.test b/mysql-test/main/ctype_swe7.test index a8d79935aa696..d2f59084342b0 100644 --- a/mysql-test/main/ctype_swe7.test +++ b/mysql-test/main/ctype_swe7.test @@ -11,9 +11,16 @@ SET NAMES swe7; # as uses stored functions actively. # +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +# (it is necessary to run the view-protocol not in util session ) +--disable_service_connection + let $ctype_unescape_combinations=selected; --source include/ctype_unescape.inc +--enable_service_connection + --echo # --echo # End of 10.0 tests --echo # diff --git a/mysql-test/main/ctype_tis620.result b/mysql-test/main/ctype_tis620.result index a6f2db383195e..10b7042f7095a 100644 --- a/mysql-test/main/ctype_tis620.result +++ b/mysql-test/main/ctype_tis620.result @@ -123,7 +123,7 @@ t1 CREATE TABLE `t1` ( `recid` int(11) NOT NULL AUTO_INCREMENT, `dyninfo` text DEFAULT NULL, PRIMARY KEY (`recid`) -) ENGINE=MyISAM DEFAULT CHARSET=tis620 +) ENGINE=MyISAM DEFAULT CHARSET=tis620 COLLATE=tis620_thai_ci INSERT INTO t1 VALUES (1,'color=\"STB,NPG\"\r\nengine=\"J30A13\"\r\nframe=\"MRHCG1640YP4\"\r\ngrade=\"V6\"\r\nmodel=\"ACCORD\"\r\nmodelcode=\"CG164YEN\"\r\ntype=\"VT6\"\r\n'); INSERT INTO t1 VALUES (2,'color=\"HTM,NPG,DEG,RGS\"\r\nengine=\"F23A5YP1\"\r\nframe=\"MRHCF8640YP3\"\r\ngrade=\"EXi AT\"\r\nmodel=\"ACCORD\"\r\nmodelcode=\"CF864YE\"\r\ntype=\"EXA\"\r\n'); SELECT DISTINCT @@ -3168,8 +3168,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET tis620 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_thai_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; c1 @@ -3191,8 +3191,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET tis620 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_thai_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); c1 @@ -3214,8 +3214,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET tis620 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_thai_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); c1 @@ -3237,8 +3237,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET tis620 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_thai_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); c1 @@ -3263,8 +3263,8 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET tis620 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET tis620 COLLATE tis620_thai_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; a LENGTH(a) @@ -3391,7 +3391,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; c1 @@ -3414,7 +3414,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); c1 @@ -3437,7 +3437,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); c1 @@ -3460,7 +3460,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); c1 @@ -3486,7 +3486,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; a LENGTH(a) @@ -3518,14 +3518,14 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET tis620 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET tis620 COLLATE tis620_thai_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 61 @@ -3538,14 +3538,14 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET tis620 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET tis620 COLLATE tis620_thai_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 6161616161 @@ -3558,7 +3558,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 616161 @@ -3571,7 +3571,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(40) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 61616161612020202020 @@ -3712,13 +3712,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 61 @@ -3732,13 +3732,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 6161616161 @@ -3751,7 +3751,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 616161 @@ -3764,7 +3764,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 61616161612020202020 @@ -3917,7 +3917,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'tis620_thai_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE tis620_thai_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=tis620 COLLATE=tis620_thai_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -4055,7 +4055,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'tis620_thai_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE tis620_thai_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=tis620 COLLATE=tis620_thai_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -4194,7 +4194,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'tis620_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE tis620_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=tis620 COLLATE=tis620_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -4332,7 +4332,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'tis620_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE tis620_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=tis620 COLLATE=tis620_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -4472,3 +4472,28 @@ HEX(WEIGHT_STRING(_tis620 'a\0b' COLLATE tis620_thai_nopad_ci)) # # End of 10.2 tests # +# +# Start of 10.4 tests +# +# +# MDEV-27670 Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit +# +CREATE OR REPLACE TABLE t1 +( +a VARCHAR(250) COLLATE tis620_thai_nopad_ci, +UNIQUE KEY(a(100)) USING HASH +) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('a'),('A'); +ERROR 23000: Duplicate entry 'A' for key 'a' +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 +( +a CHAR(250) COLLATE tis620_thai_nopad_ci, +UNIQUE KEY(a(100)) USING HASH +) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('a'),('A'); +ERROR 23000: Duplicate entry 'A' for key 'a' +DROP TABLE t1; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/ctype_tis620.test b/mysql-test/main/ctype_tis620.test index 7f6382fe7bc44..39908b995b252 100644 --- a/mysql-test/main/ctype_tis620.test +++ b/mysql-test/main/ctype_tis620.test @@ -169,7 +169,7 @@ SET collation_connection='tis620_bin'; --echo # --echo # Start of 5.6 tests --echo # - +--disable_service_connection --echo # --echo # WL#3664 WEIGHT_STRING --echo # @@ -186,8 +186,11 @@ set collation_connection=tis620_bin; --source include/weight_string.inc --source include/weight_string_l1.inc --source include/ctype_pad_space.inc +#enable after fix MDEV-29290 +--disable_view_protocol select hex(weight_string(cast(0xE0A1 as char))); select hex(weight_string(cast(0xE0A1 as char) as char(1))); +--enable_view_protocol --echo # --echo # End of 5.6 tests @@ -208,6 +211,7 @@ let $coll_pad='tis620_thai_ci'; let $coll='tis620_nopad_bin'; let $coll_pad='tis620_bin'; --source include/ctype_pad_all_engines.inc +--enable_service_connection --echo # --echo # MDEV-24901 SIGSEGV in fts_get_table_name, SIGSEGV in ib_vector_size, SIGSEGV in row_merge_fts_doc_tokenize, stack smashing @@ -219,3 +223,34 @@ SELECT HEX(WEIGHT_STRING(_tis620 'a\0b' COLLATE tis620_thai_nopad_ci)); --echo # --echo # End of 10.2 tests --echo # + +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-27670 Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit +--echo # + +CREATE OR REPLACE TABLE t1 +( + a VARCHAR(250) COLLATE tis620_thai_nopad_ci, + UNIQUE KEY(a(100)) USING HASH +) ENGINE=MyISAM; +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('a'),('A'); +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 + +( + a CHAR(250) COLLATE tis620_thai_nopad_ci, + UNIQUE KEY(a(100)) USING HASH +) ENGINE=MyISAM; +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('a'),('A'); +DROP TABLE t1; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/ctype_uca.result b/mysql-test/main/ctype_uca.result index 279a3cdcd5d9e..b567137df1eff 100644 --- a/mysql-test/main/ctype_uca.result +++ b/mysql-test/main/ctype_uca.result @@ -6112,7 +6112,7 @@ level smallint unsigned); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `name` varchar(10) COLLATE utf8mb3_swedish_ci DEFAULT NULL, + `name` varchar(10) DEFAULT NULL, `level` smallint(5) unsigned DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_swedish_ci insert into t1 values ('string',1); @@ -6334,7 +6334,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL, `b` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; a b @@ -6489,7 +6489,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `s1` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci DEFAULT NULL, `s2` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); @@ -6744,7 +6744,7 @@ t1 CREATE TABLE `t1` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `ch` (`ch`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch @@ -6963,7 +6963,7 @@ t1 CREATE TABLE `t1` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `ch` (`ch`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch @@ -7186,13 +7186,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(16) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0E33 @@ -7206,13 +7206,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(80) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0E330E330E330E330E33 @@ -7225,7 +7225,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(48) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 0E330E330E33 @@ -7238,7 +7238,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(160) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 0E330E330E330E330E3302090209020902090209 @@ -7430,13 +7430,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(16) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0E33 @@ -7450,13 +7450,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(80) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0E330E330E330E330E33 @@ -7469,7 +7469,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(48) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 0E330E330E33 @@ -7482,7 +7482,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(160) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 0E330E330E330E330E3302090209020902090209 @@ -8079,7 +8079,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_german2_ci DEFAULT NULL, `b` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; a b @@ -8108,7 +8108,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (_utf32 0x0180),(_utf32 0x023A); INSERT INTO t1 VALUES (_utf32 0x023B),(_utf32 0x023C); INSERT INTO t1 VALUES (_utf32 0x023D),(_utf32 0x023E); @@ -8204,7 +8204,7 @@ INSERT INTO t1 VALUES (_utf32 0x2CEE); SELECT hex(c), hex(lower(c)), hex(upper(c)), hex(weight_string(c)), c FROM t1 ORDER BY c, BINARY c; hex(c) hex(lower(c)) hex(upper(c)) hex(weight_string(c)) c -C8BA C8BA 1214 Ⱥ +C8BA E2B1A5 C8BA 1214 Ⱥ E2B1A5 E2B1A5 C8BA 1214 ⱥ C680 C680 C983 122D ƀ C983 C680 C983 122D Ƀ @@ -8229,7 +8229,7 @@ E2B1AA E2B1AA E2B1A9 1328 ⱪ C8BD C69A C8BD 133B Ƚ E2B1A0 E2B1A1 E2B1A0 133F Ⱡ E2B1A1 E2B1A1 E2B1A0 133F ⱡ -C9AB C9AB 1340 ɫ +C9AB C9AB E2B1A2 1340 ɫ E2B1A2 C9AB E2B1A2 1340 Ɫ E1B5BD E1B5BD E2B1A3 13B8 ᵽ E2B1A3 E1B5BD E2B1A3 13B8 Ᵽ @@ -8237,11 +8237,11 @@ C98A C98B C98A 13D2 Ɋ C98B C98B C98A 13D2 ɋ C98C C98D C98C 13E4 Ɍ C98D C98D C98C 13E4 ɍ -C9BD C9BD 13FC ɽ +C9BD C9BD E2B1A4 13FC ɽ E2B1A4 C9BD E2B1A4 13FC Ɽ EA9CA8 EA9CA9 EA9CA8 143314AD Ꜩ EA9CA9 EA9CA9 EA9CA8 143314AD ꜩ -C8BE C8BE 143C Ⱦ +C8BE E2B1A6 C8BE 143C Ⱦ E2B1A6 E2B1A6 C8BE 143C ⱦ C984 CA89 C984 145B Ʉ CA89 CA89 C984 145B ʉ @@ -8412,7 +8412,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; c1 @@ -8435,7 +8435,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); c1 @@ -8458,7 +8458,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); c1 @@ -8481,7 +8481,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); c1 @@ -8507,7 +8507,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; a LENGTH(a) @@ -8532,7 +8532,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('ae'),('ä'); SELECT * FROM t1 WHERE c1='ä'; c1 @@ -8570,7 +8570,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_german2_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; c1 @@ -8593,7 +8593,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_german2_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); c1 @@ -8616,7 +8616,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_german2_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); c1 @@ -8639,7 +8639,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_german2_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); c1 @@ -8665,7 +8665,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_german2_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; a LENGTH(a) @@ -8690,7 +8690,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_german2_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('ae'),('ä'); SELECT * FROM t1 WHERE c1='ä'; c1 @@ -8744,7 +8744,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `s1` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_myanmar_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (s1) VALUES (_ucs2 0x108C), (_ucs2 0x1037), @@ -11320,7 +11320,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `s1` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_myanmar_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (s1) VALUES (_ucs2 0x108C), (_ucs2 0x1037), @@ -13980,7 +13980,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (SPACE(0)),(SPACE(1)),(SPACE(2)); SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(8))) FROM t1; HEX(a) HEX(WEIGHT_STRING(a AS CHAR(8))) @@ -14013,7 +14013,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (_ucs2 0x3400); INSERT INTO t1 VALUES (_ucs2 0xF001); SELECT HEX(CONVERT(a USING ucs2)) AS ucs2, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1; @@ -14026,7 +14026,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('A'),('À'),('Á'),('Â'),('Ã'),('Ä'),('Å'); SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a; a HEX(WEIGHT_STRING(a LEVEL 2)) @@ -14060,7 +14060,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a; a HEX(WEIGHT_STRING(a LEVEL 2)) A 0020 @@ -14085,7 +14085,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('cota'),('cote'),('cotz'); INSERT INTO t1 VALUES ('coté'),('côte'),('côté'),('cotë'),('côtë'); SELECT * FROM t1 ORDER BY a; @@ -14232,7 +14232,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `a_id` (`a`,`id`) -) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # # Ascending sort, using filesort # @@ -14674,7 +14674,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (SPACE(0)),(SPACE(1)),(SPACE(2)); SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(8))) FROM t1; HEX(a) HEX(WEIGHT_STRING(a AS CHAR(8))) @@ -14707,7 +14707,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (_ucs2 0x3400); INSERT INTO t1 VALUES (_ucs2 0xF001); SELECT HEX(CONVERT(a USING ucs2)) AS ucs2, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1; @@ -14720,7 +14720,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('A'),('À'),('Á'),('Â'),('Ã'),('Ä'),('Å'); SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a; a HEX(WEIGHT_STRING(a LEVEL 2)) @@ -14754,7 +14754,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a; a HEX(WEIGHT_STRING(a LEVEL 2)) A 0020 @@ -14779,7 +14779,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('cota'),('cote'),('cotz'); INSERT INTO t1 VALUES ('coté'),('côte'),('côté'),('cotë'),('côtë'); SELECT * FROM t1 ORDER BY a; @@ -14926,7 +14926,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `a_id` (`a`,`id`) -) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # # Ascending sort, using filesort # diff --git a/mysql-test/main/ctype_uca.test b/mysql-test/main/ctype_uca.test index 67ef7d7aa96f9..bc08714367b9e 100644 --- a/mysql-test/main/ctype_uca.test +++ b/mysql-test/main/ctype_uca.test @@ -8,6 +8,7 @@ DROP TABLE IF EXISTS t1; # # Test Unicode collations. # +--disable_service_connection set names utf8; # @@ -72,6 +73,7 @@ select group_concat(c1 order by c1) from t1 group by c1 collate utf8_unicode_520 select group_concat(c1 order by c1) from t1 group by c1 collate utf8_vietnamese_ci; select group_concat(c1 order by c1) from t1 group by c1 collate utf8_thai_520_w2; +--disable_view_protocol ALTER TABLE t1 CONVERT TO CHARACTER SET ucs2 COLLATE ucs2_bin; SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_unicode_ci; SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_icelandic_ci; @@ -96,7 +98,7 @@ SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_croatian_ci SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_german2_ci; SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_unicode_520_ci; SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_vietnamese_ci; - +--enable_view_protocol drop table t1; # @@ -475,7 +477,7 @@ set collation_connection=ucs2_unicode_ci; -- source include/ctype_regex.inc -- source include/ctype_like_range_f1f2.inc set names utf8; - +--enable_service_connection -- echo End for 5.0 tests --echo End of 5.1 tests @@ -491,7 +493,7 @@ SET collation_connection=utf8_czech_ci; SET collation_connection=ucs2_czech_ci; --source include/ctype_czech.inc --source include/ctype_like_ignorable.inc - +--disable_service_connection create table t1 (a int, c1 varchar(200) collate utf8_croatian_mysql561_ci, key (c1)); insert into t1 values (1,'=> DZ'),(2,'=> Dz'),(3,'=> dz'),(4,'=> dZ'); insert into t1 values (5,'=> DŽ'),(6,'=> Dž'),(7,'=> dž'),(8,'=> dŽ'); @@ -508,7 +510,6 @@ select * from t1 where c1 = '=> dž'; select * from t1 where concat(c1) = '=> dž'; drop table t1; - --echo # --echo # MDEV-7649 wrong result when comparing utf8 column with an invalid literal --echo # @@ -551,7 +552,10 @@ set @@collation_connection=ucs2_czech_ci; --echo # --echo # Bug#33077 weight of supplementary characters is not 0xfffd --echo # +#enable_after_fix MDEV-27871 +--disable_view_protocol select hex(weight_string(_utf8mb4 0xF0908080 /* U+10000 */ collate utf8mb4_unicode_ci)); +--enable_view_protocol --echo # --echo # Bug#53064 garbled data when using utf8_german2_ci collation @@ -690,7 +694,7 @@ CREATE VIEW v1 AS SELECT group_concat('f') AS col1; SELECT col1 FROM v1 UNION SELECT col1 FROM t1; DROP VIEW v1; DROP TABLE t1; - +--enable_service_connection --echo # --echo # End of MariaDB-10.2 tests diff --git a/mysql-test/main/ctype_uca_innodb.result b/mysql-test/main/ctype_uca_innodb.result index 2f46a140c837a..65cca24f23321 100644 --- a/mysql-test/main/ctype_uca_innodb.result +++ b/mysql-test/main/ctype_uca_innodb.result @@ -19,7 +19,7 @@ t1 CREATE TABLE `t1` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `ch` (`ch`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch diff --git a/mysql-test/main/ctype_uca_innodb.test b/mysql-test/main/ctype_uca_innodb.test index 3582740d60e79..f51f40118e94f 100644 --- a/mysql-test/main/ctype_uca_innodb.test +++ b/mysql-test/main/ctype_uca_innodb.test @@ -1,7 +1,6 @@ # # Tests for UCA collations with InnoDB # - let collation=utf8mb3_unicode_ci; --source include/have_collation.inc --source include/have_innodb.inc @@ -15,10 +14,11 @@ let collation=utf8mb3_unicode_ci; --echo # --echo # MDEV-7649 wrong result when comparing utf8 column with an invalid literal --echo # - +--disable_service_connection SET NAMES utf8 COLLATE utf8_unicode_ci; --let ENGINE=InnoDB --source include/ctype_utf8_ilseq.inc +--enable_service_connection --echo # --echo # End of 5.5 tests diff --git a/mysql-test/main/ctype_uca_partitions.result b/mysql-test/main/ctype_uca_partitions.result index 36d102e3afd76..486e848e191db 100644 --- a/mysql-test/main/ctype_uca_partitions.result +++ b/mysql-test/main/ctype_uca_partitions.result @@ -5,7 +5,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`c1`) PARTITIONS 3 INSERT INTO t1 VALUES ('A'),('À'),('Á'),('Â'),('Ã'),('Ä'),('Å'); @@ -84,3 +84,43 @@ O P Y DROP TABLE t1; +# +# Start of 10.4 tests +# +# +# MDEV-30072 Wrong ORDER BY for a partitioned prefix key + NOPAD +# +SET NAMES utf8mb4; +CREATE TABLE t1 +( +id INT, +data VARCHAR(20), +KEY data_id (data,id) +) COLLATE utf8mb3_unicode_nopad_ci ENGINE=MyISAM +PARTITION BY RANGE COLUMNS (id) +( +PARTITION p10 VALUES LESS THAN (20), +PARTITION p20 VALUES LESS THAN MAXVALUE +); +INSERT INTO t1 VALUES (30, 'ss '), (10, 'ß '); +SELECT id FROM t1 WHERE data='ss ' ORDER BY id; +id +10 +30 +SELECT id FROM t1 WHERE data='ss ' ORDER BY id DESC; +id +30 +10 +ALTER TABLE t1 DROP KEY data_id, ADD KEY data_id2(data(10),id); +SELECT id FROM t1 WHERE data='ss ' ORDER BY id; +id +10 +30 +SELECT id FROM t1 WHERE data='ss ' ORDER BY id DESC; +id +30 +10 +DROP TABLE t1; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/ctype_uca_partitions.test b/mysql-test/main/ctype_uca_partitions.test index 5734bb520088b..81f1a091574ba 100644 --- a/mysql-test/main/ctype_uca_partitions.test +++ b/mysql-test/main/ctype_uca_partitions.test @@ -36,3 +36,35 @@ SELECT * FROM t1 PARTITION (p0) ORDER BY c1; SELECT * FROM t1 PARTITION (p1) ORDER BY c1; SELECT * FROM t1 PARTITION (p2) ORDER BY c1; DROP TABLE t1; + +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-30072 Wrong ORDER BY for a partitioned prefix key + NOPAD +--echo # + +SET NAMES utf8mb4; +CREATE TABLE t1 +( + id INT, + data VARCHAR(20), + KEY data_id (data,id) +) COLLATE utf8mb3_unicode_nopad_ci ENGINE=MyISAM +PARTITION BY RANGE COLUMNS (id) +( + PARTITION p10 VALUES LESS THAN (20), + PARTITION p20 VALUES LESS THAN MAXVALUE +); +INSERT INTO t1 VALUES (30, 'ss '), (10, 'ß '); +SELECT id FROM t1 WHERE data='ss ' ORDER BY id; +SELECT id FROM t1 WHERE data='ss ' ORDER BY id DESC; +ALTER TABLE t1 DROP KEY data_id, ADD KEY data_id2(data(10),id); +SELECT id FROM t1 WHERE data='ss ' ORDER BY id; +SELECT id FROM t1 WHERE data='ss ' ORDER BY id DESC; +DROP TABLE t1; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result index 6c14ca3ab6694..eb1220f9a5612 100644 --- a/mysql-test/main/ctype_ucs.result +++ b/mysql-test/main/ctype_ucs.result @@ -89,7 +89,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `name` varchar(10) DEFAULT NULL, `level` smallint(5) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci insert into t1 values ('string',1); select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; concat(name,space(level)) concat(name, repeat(' ',level)) @@ -196,9 +196,9 @@ RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `l` varchar(10) CHARACTER SET ucs2 DEFAULT NULL, - `r` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `l` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, + `r` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Bug #51876 : crash/memory underrun when loading data with ucs2 @@ -250,9 +250,9 @@ alter table t1 add key(a); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET ucs2 DEFAULT NULL, + `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); explain select * from t1 where a like 'abc%'; id select_type table type possible_keys key key_len ref rows Extra @@ -686,8 +686,8 @@ create table t1 (a enum('x','y','z') character set ucs2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('x','y','z') CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` enum('x','y','z') CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('x'); insert into t1 values ('y'); insert into t1 values ('z'); @@ -700,8 +700,8 @@ alter table t1 change a a enum('x','y','z','d','e',' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('x','y','z','d','e','�','�','�') CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` enum('x','y','z','d','e','�','�','�') CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('D'); insert into t1 values ('E '); insert into t1 values ('�'); @@ -722,8 +722,8 @@ create table t1 (a set ('x','y','z',' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` set('x','y','z','�','�','�') CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` set('x','y','z','�','�','�') CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('x'); insert into t1 values ('y'); insert into t1 values ('z'); @@ -944,9 +944,9 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET ucs2 DEFAULT NULL, + `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, `b` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; a b @@ -1267,7 +1267,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `status` enum('active','passive') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'passive' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 ADD a int NOT NULL AFTER status; CREATE TABLE t2 ( status enum('active','passive') collate ucs2_turkish_ci @@ -1277,7 +1277,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `status` enum('active','passive') CHARACTER SET ucs2 COLLATE ucs2_turkish_ci NOT NULL DEFAULT 'passive' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t2 ADD a int NOT NULL AFTER status; DROP TABLE t1,t2; select password(name) from bug20536; @@ -1438,9 +1438,9 @@ select null, null; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `s1` varchar(64) CHARACTER SET ucs2 DEFAULT NULL, - `s2` varchar(64) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `s1` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, + `s2` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); @@ -1615,8 +1615,8 @@ create table t1 as select concat(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1; hex(c1) 0031 @@ -1628,8 +1628,8 @@ create table t1 as select concat(18446744073709551615) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(20) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(20) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1; hex(c1) 00310038003400340036003700340034003000370033003700300039003500350031003600310035 @@ -1641,8 +1641,8 @@ create table t1 as select concat(1.1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1; hex(c1) 0031002E0031 @@ -1654,8 +1654,8 @@ create table t1 as select concat(1+2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1-2)); hex(concat(1-2)) @@ -1664,8 +1664,8 @@ create table t1 as select concat(1-2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1*2)); hex(concat(1*2)) @@ -1674,8 +1674,8 @@ create table t1 as select concat(1*2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1/2)); hex(concat(1/2)) @@ -1684,8 +1684,8 @@ create table t1 as select concat(1/2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(7) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(7) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1 div 2)); hex(concat(1 div 2)) @@ -1694,8 +1694,8 @@ create table t1 as select concat(1 div 2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1 % 2)); hex(concat(1 % 2)) @@ -1704,8 +1704,8 @@ create table t1 as select concat(1 % 2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(-1)); hex(concat(-1)) @@ -1714,8 +1714,8 @@ create table t1 as select concat(-1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(-(1+2))); hex(concat(-(1+2))) @@ -1724,8 +1724,8 @@ create table t1 as select concat(-(1+2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1|2)); hex(concat(1|2)) @@ -1734,8 +1734,8 @@ create table t1 as select concat(1|2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1&2)); hex(concat(1&2)) @@ -1744,8 +1744,8 @@ create table t1 as select concat(1&2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(bit_count(12))); hex(concat(bit_count(12))) @@ -1754,8 +1754,8 @@ create table t1 as select concat(bit_count(12)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(2<<1)); hex(concat(2<<1)) @@ -1764,8 +1764,8 @@ create table t1 as select concat(2<<1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(2>>1)); hex(concat(2>>1)) @@ -1774,8 +1774,8 @@ create table t1 as select concat(2>>1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(~0)); hex(concat(~0)) @@ -1784,8 +1784,8 @@ create table t1 as select concat(~0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(3^2)); hex(concat(3^2)) @@ -1794,8 +1794,8 @@ create table t1 as select concat(3^2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(abs(-2))); hex(concat(abs(-2))) @@ -1804,8 +1804,8 @@ create table t1 as select concat(abs(-2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(exp(2)),1)); hex(left(concat(exp(2)),1)) @@ -1814,8 +1814,8 @@ create table t1 as select concat(exp(2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(log(2)),1)); hex(left(concat(log(2)),1)) @@ -1824,8 +1824,8 @@ create table t1 as select concat(log(2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(log2(2)),1)); hex(left(concat(log2(2)),1)) @@ -1834,8 +1834,8 @@ create table t1 as select concat(log2(2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(log10(2)),1)); hex(left(concat(log10(2)),1)) @@ -1844,8 +1844,8 @@ create table t1 as select concat(log10(2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(sqrt(2)),1)); hex(left(concat(sqrt(2)),1)) @@ -1854,8 +1854,8 @@ create table t1 as select concat(sqrt(2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(pow(2,2)),1)); hex(left(concat(pow(2,2)),1)) @@ -1864,8 +1864,8 @@ create table t1 as select concat(pow(2,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(acos(0.5)),1)); hex(left(concat(acos(0.5)),1)) @@ -1874,8 +1874,8 @@ create table t1 as select concat(acos(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(asin(0.5)),1)); hex(left(concat(asin(0.5)),1)) @@ -1884,8 +1884,8 @@ create table t1 as select concat(asin(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(atan(0.5)),1)); hex(left(concat(atan(0.5)),1)) @@ -1894,8 +1894,8 @@ create table t1 as select concat(atan(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(cos(0.5)),1)); hex(left(concat(cos(0.5)),1)) @@ -1904,8 +1904,8 @@ create table t1 as select concat(cos(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(sin(0.5)),1)); hex(left(concat(sin(0.5)),1)) @@ -1914,8 +1914,8 @@ create table t1 as select concat(sin(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(tan(0.5)),1)); hex(left(concat(tan(0.5)),1)) @@ -1924,8 +1924,8 @@ create table t1 as select concat(tan(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(degrees(0))); hex(concat(degrees(0))) @@ -1934,8 +1934,8 @@ create table t1 as select concat(degrees(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(radians(0))); hex(concat(radians(0))) @@ -1944,8 +1944,8 @@ create table t1 as select concat(radians(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ceiling(0.5))); hex(concat(ceiling(0.5))) @@ -1955,8 +1955,8 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c0` int(3) NOT NULL, - `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(floor(0.5))); hex(concat(floor(0.5))) @@ -1966,8 +1966,8 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c0` int(3) NOT NULL, - `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(round(0.5))); hex(concat(round(0.5))) @@ -1976,8 +1976,8 @@ create table t1 as select concat(round(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(sign(0.5))); hex(concat(sign(0.5))) @@ -1986,15 +1986,15 @@ create table t1 as select concat(sign(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(rand()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(length('a'))); hex(concat(length('a'))) @@ -2003,8 +2003,8 @@ create table t1 as select concat(length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(char_length('a'))); hex(concat(char_length('a'))) @@ -2013,8 +2013,8 @@ create table t1 as select concat(char_length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(bit_length('a'))); hex(concat(bit_length('a'))) @@ -2023,8 +2023,8 @@ create table t1 as select concat(bit_length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(11) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(11) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(coercibility('a'))); hex(concat(coercibility('a'))) @@ -2033,8 +2033,8 @@ create table t1 as select concat(coercibility('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(locate('a','a'))); hex(concat(locate('a','a'))) @@ -2043,8 +2043,8 @@ create table t1 as select concat(locate('a','a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(11) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(11) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(field('c','a','b','c'))); hex(concat(field('c','a','b','c'))) @@ -2053,8 +2053,8 @@ create table t1 as select concat(field('c','a','b','c')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ascii(61))); hex(concat(ascii(61))) @@ -2063,8 +2063,8 @@ create table t1 as select concat(ascii(61)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ord(61))); hex(concat(ord(61))) @@ -2073,8 +2073,8 @@ create table t1 as select concat(ord(61)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(7) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(7) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(find_in_set('b','a,b,c,d'))); hex(concat(find_in_set('b','a,b,c,d'))) @@ -2083,8 +2083,8 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select md5('a'), hex(md5('a')); md5('a') hex(md5('a')) @@ -2093,8 +2093,8 @@ create table t1 as select md5('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(32) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(32) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select old_password('a'), hex(old_password('a')); old_password('a') hex(old_password('a')) @@ -2103,8 +2103,8 @@ create table t1 as select old_password('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(16) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(16) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select password('a'), hex(password('a')); password('a') hex(password('a')) @@ -2113,8 +2113,8 @@ create table t1 as select password('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(41) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(41) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select sha('a'), hex(sha('a')); sha('a') hex(sha('a')) @@ -2123,8 +2123,8 @@ create table t1 as select sha('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(40) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(40) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select sha1('a'), hex(sha1('a')); sha1('a') hex(sha1('a')) @@ -2133,8 +2133,8 @@ create table t1 as select sha1('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(40) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(40) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast('-1' as signed))); hex(concat(cast('-1' as signed))) @@ -2143,8 +2143,8 @@ create table t1 as select concat(cast('-1' as signed)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast('1' as unsigned))); hex(concat(cast('1' as unsigned))) @@ -2153,8 +2153,8 @@ create table t1 as select concat(cast('1' as unsigned)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast(1/2 as decimal(5,5)))); hex(concat(cast(1/2 as decimal(5,5)))) @@ -2163,8 +2163,8 @@ create table t1 as select concat(cast(1/2 as decimal(5,5))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(7) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(7) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast('2001-01-02 03:04:05' as date))); hex(concat(cast('2001-01-02 03:04:05' as date))) @@ -2173,8 +2173,8 @@ create table t1 as select concat(cast('2001-01-02 03:04:05' as date)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2001-01-02 @@ -2186,8 +2186,8 @@ create table t1 as select concat(cast('2001-01-02 03:04:05' as time)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 03:04:05 @@ -2199,8 +2199,8 @@ create table t1 as select concat(cast('2001-01-02' as datetime)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2001-01-02 00:00:00 @@ -2212,8 +2212,8 @@ create table t1 as select concat(least(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(greatest(1,2))); hex(concat(greatest(1,2))) @@ -2222,8 +2222,8 @@ create table t1 as select concat(greatest(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(case when 11 then 22 else 33 end)); hex(concat(case when 11 then 22 else 33 end)) @@ -2232,8 +2232,8 @@ create table t1 as select concat(case when 11 then 22 else 33 end) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(coalesce(1,2))); hex(concat(coalesce(1,2))) @@ -2242,8 +2242,8 @@ create table t1 as select concat(coalesce(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat_ws(1,2,3)); hex(concat_ws(1,2,3)) @@ -2252,8 +2252,8 @@ create table t1 as select concat_ws(1,2,3) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(group_concat(1,2,3)); hex(group_concat(1,2,3)) @@ -2262,15 +2262,15 @@ create table t1 as select group_concat(1,2,3) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` mediumtext CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` mediumtext CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select 1 as c1 union select 'a'; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1 order by c1; hex(c1) 0031 @@ -2280,8 +2280,8 @@ create table t1 as select concat(last_insert_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(benchmark(0,0))); hex(concat(benchmark(0,0))) @@ -2290,8 +2290,8 @@ create table t1 as select concat(benchmark(0,0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(sleep(0))); hex(concat(sleep(0))) @@ -2300,8 +2300,8 @@ create table t1 as select concat(sleep(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(is_free_lock('xxxx'))); hex(concat(is_free_lock('xxxx'))) @@ -2310,22 +2310,22 @@ create table t1 as select concat(is_free_lock('xxxx')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(is_used_lock('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(release_lock('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(crc32(''))); hex(concat(crc32(''))) @@ -2334,8 +2334,8 @@ create table t1 as select concat(crc32('')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(uncompressed_length(''))); hex(concat(uncompressed_length(''))) @@ -2344,15 +2344,15 @@ create table t1 as select concat(uncompressed_length('')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(connection_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(inet_aton('127.1.1.1'))); hex(concat(inet_aton('127.1.1.1'))) @@ -2361,8 +2361,8 @@ create table t1 as select concat(inet_aton('127.1.1.1')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(inet_ntoa(2130772225))); hex(concat(inet_ntoa(2130772225))) @@ -2374,8 +2374,8 @@ c1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(31) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(31) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select 1; 1 @@ -2387,8 +2387,8 @@ create table t1 as select concat(row_count()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(found_rows())); hex(concat(found_rows())) @@ -2397,22 +2397,22 @@ create table t1 as select concat(found_rows()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(uuid_short()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(uuid()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(36) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(36) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); coercibility(uuid()) coercibility(cast('a' as char character set latin1)) @@ -2425,14 +2425,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(37) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@a1:=1)); hex(concat(@a1:=1)) @@ -2444,9 +2444,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL, + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, `c2` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a2=1; select hex(concat(@a2)); @@ -2459,9 +2459,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(20) CHARACTER SET ucs2 DEFAULT NULL, + `c1` varchar(20) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, `c2` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@a1:=sqrt(1))); hex(concat(@a1:=sqrt(1))) @@ -2473,9 +2473,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL, + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, `c2` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a2=sqrt(1); select hex(concat(@a2)); @@ -2488,9 +2488,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL, + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, `c2` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@a1:=1.1)); hex(concat(@a1:=1.1)) @@ -2502,9 +2502,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL, + `c1` varchar(4) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, `c2` decimal(2,1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a2=1.1; select hex(concat(@a2)); @@ -2517,9 +2517,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(83) CHARACTER SET ucs2 DEFAULT NULL, + `c1` varchar(83) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, `c2` decimal(65,38) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@@ft_max_word_len)); hex(concat(@@ft_max_word_len)) @@ -2531,8 +2531,8 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a'='a' IS TRUE)); hex(concat('a'='a' IS TRUE)) @@ -2541,8 +2541,8 @@ create table t1 as select concat('a'='a' IS TRUE) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a'='a' IS NOT TRUE)); hex(concat('a'='a' IS NOT TRUE)) @@ -2551,8 +2551,8 @@ create table t1 as select concat('a'='a' IS NOT TRUE) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NOT 'a'='a')); hex(concat(NOT 'a'='a')) @@ -2561,8 +2561,8 @@ create table t1 as select concat(NOT 'a'='a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' IS NULL)); hex(concat('a' IS NULL)) @@ -2571,8 +2571,8 @@ create table t1 as select concat('a' IS NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' IS NOT NULL)); hex(concat('a' IS NOT NULL)) @@ -2581,8 +2581,8 @@ create table t1 as select concat('a' IS NOT NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' rlike 'a')); hex(concat('a' rlike 'a')) @@ -2591,8 +2591,8 @@ create table t1 as select concat('a' IS NOT NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(strcmp('a','b'))); hex(concat(strcmp('a','b'))) @@ -2601,8 +2601,8 @@ create table t1 as select concat(strcmp('a','b')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' like 'a')); hex(concat('a' like 'a')) @@ -2611,8 +2611,8 @@ create table t1 as select concat('a' like 'b') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' between 'b' and 'c')); hex(concat('a' between 'b' and 'c')) @@ -2621,8 +2621,8 @@ create table t1 as select concat('a' between 'b' and 'c') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' in ('a','b'))); hex(concat('a' in ('a','b'))) @@ -2631,8 +2631,8 @@ create table t1 as select concat('a' in ('a','b')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(interval(23, 1, 15, 17, 30, 44, 200))); hex(concat(interval(23, 1, 15, 17, 30, 44, 200))) @@ -2641,8 +2641,8 @@ create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a varchar(10), fulltext key(a)); insert into t1 values ('a'); @@ -2653,8 +2653,8 @@ create table t2 as select concat(match (a) against ('a')) as a from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; select hex(ifnull(1,'a')); hex(ifnull(1,'a')) @@ -2663,8 +2663,8 @@ create table t1 as select ifnull(1,'a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ifnull(1,1))); hex(concat(ifnull(1,1))) @@ -2673,8 +2673,8 @@ create table t1 as select concat(ifnull(1,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ifnull(1.1,1.1))); hex(concat(ifnull(1.1,1.1))) @@ -2683,8 +2683,8 @@ create table t1 as select concat(ifnull(1.1,1.1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(if(1,'b',1)); hex(if(1,'b',1)) @@ -2693,8 +2693,8 @@ create table t1 as select if(1,'b',1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(if(1,1,'b')); hex(if(1,1,'b')) @@ -2703,8 +2703,8 @@ create table t1 as select if(1,1,'b') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(if(1,1,1))); hex(concat(if(1,1,1))) @@ -2713,8 +2713,8 @@ create table t1 as select concat(if(1,1,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(nullif(1,2))); hex(concat(nullif(1,2))) @@ -2723,8 +2723,8 @@ create table t1 as select concat(nullif(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)')))); hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)')))) @@ -2733,8 +2733,8 @@ create table t1 as select concat(Dimension(GeomFromText('LINSTRING(0 0,10 10)')) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) @@ -2743,8 +2743,8 @@ create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))); hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) @@ -2753,8 +2753,8 @@ create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) @@ -2763,8 +2763,8 @@ create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))); hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) @@ -2773,8 +2773,8 @@ create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0, show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))); hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) @@ -2783,8 +2783,8 @@ create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))); hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) @@ -2793,8 +2793,8 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) @@ -2803,8 +2803,8 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) @@ -2818,8 +2818,8 @@ create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(y(GeomFromText('Point(1 2)')))); hex(concat(y(GeomFromText('Point(1 2)')))) @@ -2828,8 +2828,8 @@ create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))); hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) @@ -2838,8 +2838,8 @@ create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))); hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) @@ -2848,8 +2848,8 @@ create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(GeometryType(GeomFromText('Point(1 2)')))); hex(concat(GeometryType(GeomFromText('Point(1 2)')))) @@ -2858,8 +2858,8 @@ create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(20) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(20) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(AsText(GeomFromText('Point(1 2)')))); hex(concat(AsText(GeomFromText('Point(1 2)')))) @@ -2868,8 +2868,8 @@ create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` longtext CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` longtext CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(period_add(200902, 2))); hex(concat(period_add(200902, 2))) @@ -2878,8 +2878,8 @@ create table t1 as select concat(period_add(200902, 2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(period_diff(200902, 200802))); hex(concat(period_diff(200902, 200802))) @@ -2891,8 +2891,8 @@ Warning 1265 Data truncated for column 'c1' at row 1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET ucs2 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET ucs2 COLLATE ucs2_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(to_days(20090224))); hex(concat(to_days(20090224))) @@ -2901,8 +2901,8 @@ create table t1 as select concat(to_days(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(dayofmonth(20090224))); hex(concat(dayofmonth(20090224))) @@ -2911,8 +2911,8 @@ create table t1 as select concat(dayofmonth(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(dayofyear(20090224))); hex(concat(dayofyear(20090224))) @@ -2921,8 +2921,8 @@ create table t1 as select concat(dayofyear(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(hour('10:11:12'))); hex(concat(hour('10:11:12'))) @@ -2931,8 +2931,8 @@ create table t1 as select concat(hour('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(minute('10:11:12'))); hex(concat(minute('10:11:12'))) @@ -2941,8 +2941,8 @@ create table t1 as select concat(minute('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(second('10:11:12'))); hex(concat(second('10:11:12'))) @@ -2951,8 +2951,8 @@ create table t1 as select concat(second('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(quarter(20090224))); hex(concat(quarter(20090224))) @@ -2961,8 +2961,8 @@ create table t1 as select concat(quarter(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(week(20090224))); hex(concat(week(20090224))) @@ -2971,8 +2971,8 @@ create table t1 as select concat(week(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(yearweek(20090224))); hex(concat(yearweek(20090224))) @@ -2981,8 +2981,8 @@ create table t1 as select concat(yearweek(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(year(20090224))); hex(concat(year(20090224))) @@ -2991,8 +2991,8 @@ create table t1 as select concat(year(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(weekday(20090224))); hex(concat(weekday(20090224))) @@ -3001,8 +3001,8 @@ create table t1 as select concat(weekday(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(dayofweek(20090224))); hex(concat(dayofweek(20090224))) @@ -3011,8 +3011,8 @@ create table t1 as select concat(dayofweek(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(unix_timestamp(20090224))); hex(concat(unix_timestamp(20090224))) @@ -3021,8 +3021,8 @@ create table t1 as select concat(unix_timestamp(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(17) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(17) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(time_to_sec('10:11:12'))); hex(concat(time_to_sec('10:11:12'))) @@ -3031,8 +3031,8 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(17) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(17) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(extract(year from 20090702))); hex(concat(extract(year from 20090702))) @@ -3041,8 +3041,8 @@ create table t1 as select concat(extract(year from 20090702)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(microsecond('12:00:00.123456'))); hex(concat(microsecond('12:00:00.123456'))) @@ -3051,8 +3051,8 @@ create table t1 as select concat(microsecond('12:00:00.123456')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(month(20090224))); hex(concat(month(20090224))) @@ -3061,15 +3061,15 @@ create table t1 as select concat(month(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(last_day('2003-02-05')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select c1, hex(c1) from t1; c1 hex(c1) 2003-02-28 0032003000300033002D00300032002D00320038 @@ -3078,8 +3078,8 @@ create table t1 as select concat(from_days(730669)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select c1, hex(c1) from t1; c1 hex(c1) 2000-07-03 0032003000300030002D00300037002D00300033 @@ -3088,22 +3088,22 @@ create table t1 as select concat(curdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(utc_date()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(curtime()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select repeat('a',20) as c1 limit 0; set timestamp=1216359724; @@ -3118,8 +3118,8 @@ create table t1 as select concat(utc_time()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(sec_to_time(2378))); hex(concat(sec_to_time(2378))) @@ -3128,8 +3128,8 @@ create table t1 as select concat(sec_to_time(2378)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))); hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) @@ -3138,8 +3138,8 @@ create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00: show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(maketime(10,11,12))); hex(concat(maketime(10,11,12))) @@ -3148,8 +3148,8 @@ create table t1 as select concat(maketime(10,11,12)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(get_format(DATE,'USA')); hex(get_format(DATE,'USA')) @@ -3158,8 +3158,8 @@ create table t1 as select get_format(DATE,'USA') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(17) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(17) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(from_unixtime(1111885200)),4)); hex(left(concat(from_unixtime(1111885200)),4)) @@ -3168,8 +3168,8 @@ create table t1 as select concat(from_unixtime(1111885200)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))); hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) @@ -3178,8 +3178,8 @@ create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:0 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) @@ -3188,8 +3188,8 @@ create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2004-01-02 12:00:00 @@ -3201,8 +3201,8 @@ create table t1 as select concat(makedate(2009,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2009-01-01 @@ -3211,22 +3211,22 @@ create table t1 as select concat(now()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(utc_timestamp()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(sysdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(addtime('00:00:00','11:22:33'))); hex(concat(addtime('00:00:00','11:22:33'))) @@ -3235,8 +3235,8 @@ create table t1 as select concat(addtime('00:00:00','11:22:33')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(26) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(26) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(subtime('23:59:59','11:22:33'))); hex(concat(subtime('23:59:59','11:22:33'))) @@ -3245,8 +3245,8 @@ create table t1 as select concat(subtime('23:59:59','11:22:33')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(26) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(26) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(elt(1,2,3)); hex(elt(1,2,3)) @@ -3255,8 +3255,8 @@ create table t1 as select elt(1,2,3) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(export_set(1,2,3,4,2)); hex(export_set(1,2,3,4,2)) @@ -3265,8 +3265,8 @@ create table t1 as select export_set(1,2,3,4,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(127) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(127) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(insert(1133,3,0,22)); hex(insert(1133,3,0,22)) @@ -3275,8 +3275,8 @@ create table t1 as select insert(1133,3,0,22) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(lcase(123)); hex(lcase(123)) @@ -3285,8 +3285,8 @@ create table t1 as select lcase(123) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(123,1)); hex(left(123,1)) @@ -3295,8 +3295,8 @@ create table t1 as select left(123,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(lower(123)); hex(lower(123)) @@ -3305,8 +3305,8 @@ create table t1 as select lower(123) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(lpad(1,2,0)); hex(lpad(1,2,0)) @@ -3315,8 +3315,8 @@ create table t1 as select lpad(1,2,0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(ltrim(1)); hex(ltrim(1)) @@ -3325,8 +3325,8 @@ create table t1 as select ltrim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(mid(1,1,1)); hex(mid(1,1,1)) @@ -3335,8 +3335,8 @@ create table t1 as select mid(1,1,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(repeat(1,2)); hex(repeat(1,2)) @@ -3345,8 +3345,8 @@ create table t1 as select repeat(1,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(replace(1,1,2)); hex(replace(1,1,2)) @@ -3355,8 +3355,8 @@ create table t1 as select replace(1,1,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(reverse(12)); hex(reverse(12)) @@ -3365,8 +3365,8 @@ create table t1 as select reverse(12) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(right(123,1)); hex(right(123,1)) @@ -3375,8 +3375,8 @@ create table t1 as select right(123,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(rpad(1,2,0)); hex(rpad(1,2,0)) @@ -3385,8 +3385,8 @@ create table t1 as select rpad(1,2,0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(rtrim(1)); hex(rtrim(1)) @@ -3395,8 +3395,8 @@ create table t1 as select rtrim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(soundex(1)); hex(soundex(1)) @@ -3405,8 +3405,8 @@ create table t1 as select soundex(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(substring(1,1,1)); hex(substring(1,1,1)) @@ -3415,8 +3415,8 @@ create table t1 as select substring(1,1,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(trim(1)); hex(trim(1)) @@ -3425,8 +3425,8 @@ create table t1 as select trim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(ucase(1)); hex(ucase(1)) @@ -3435,8 +3435,8 @@ create table t1 as select ucase(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(upper(1)); hex(upper(1)) @@ -3445,15 +3445,15 @@ create table t1 as select upper(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select repeat(' ', 64) as a limit 0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ("1.1"), ("2.1"); select a, hex(a) from t1; a hex(a) @@ -3474,8 +3474,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(4) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(4) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a tinyint zerofill); insert into t1 values (1), (10), (100); @@ -3502,8 +3502,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(12) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(12) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a smallint); insert into t1 values (1); @@ -3514,8 +3514,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(6) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(6) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a smallint zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -3536,8 +3536,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(9) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(9) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a mediumint zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -3558,8 +3558,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(11) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(11) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a int zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -3580,8 +3580,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(20) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(20) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a bigint zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -3605,8 +3605,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(12) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(12) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a float zerofill); insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); @@ -3630,8 +3630,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(22) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(22) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a double zerofill); insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); @@ -3654,8 +3654,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a year); insert into t1 values (1); @@ -3666,8 +3666,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(4) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(4) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a bit(64)); insert into t1 values (1); @@ -3679,7 +3679,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (0); @@ -3702,8 +3702,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(19) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(19) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a date); insert into t1 values ('2001-02-03'); @@ -3716,8 +3716,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a time); insert into t1 values (1); @@ -3734,8 +3734,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a datetime); insert into t1 values ('2001-02-03 04:05:06'); @@ -3748,8 +3748,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(19) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(19) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a tinyint); insert into t1 values (1); @@ -4065,14 +4065,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(1)) as c1; show columns from v1; Field Type Null Key Default Extra @@ -4096,14 +4096,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` decimal(18,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(123.45)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(123.45)) as c1; show columns from v1; Field Type Null Key Default Extra @@ -4127,14 +4127,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(123.45)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(123.45)) as c1; show columns from v1; Field Type Null Key Default Extra @@ -4158,14 +4158,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(cast('2001-01-02' as date))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(cast('2001-01-02' as date))) as c1; show columns from v1; Field Type Null Key Default Extra @@ -4241,117 +4241,117 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `CONCAT(a)` varchar(9) CHARACTER SET ucs2 DEFAULT NULL, - `IFNULL(a,'')` varchar(9) CHARACTER SET ucs2 NOT NULL, - `IF(a,a,'')` varchar(9) CHARACTER SET ucs2 DEFAULT NULL, - `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET ucs2 DEFAULT NULL, - `COALESCE(a,'')` varchar(9) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `CONCAT(a)` varchar(9) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, + `IFNULL(a,'')` varchar(9) CHARACTER SET ucs2 COLLATE ucs2_general_ci NOT NULL, + `IF(a,a,'')` varchar(9) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, + `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, + `COALESCE(a,'')` varchar(9) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LCASE(a) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LCASE(a)` varchar(9) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `LCASE(a)` varchar(9) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT UCASE(a) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `UCASE(a)` varchar(9) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `UCASE(a)` varchar(9) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `REPEAT(1,2)` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `REPEAT(1,2)` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LEFT(123,2)` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `LEFT(123,2)` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `RIGHT(123,2)` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `RIGHT(123,2)` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LTRIM(123)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `LTRIM(123)` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `RTRIM(123)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `RTRIM(123)` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `ELT(1,111,222,333)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `ELT(1,111,222,333)` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `REPLACE(111,2,3)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `REPLACE(111,2,3)` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `SOUNDEX(1)` varchar(4) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `SOUNDEX(1)` varchar(4) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8); SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -4398,11 +4398,11 @@ DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_da SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `field_str1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL, - `field1_str2` varchar(19) CHARACTER SET ucs2 DEFAULT NULL, + `field_str1` varchar(19) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, + `field1_str2` varchar(19) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, `field_date` date DEFAULT NULL, `field_datetime` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SELECT DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1, @@ -4445,11 +4445,11 @@ DATE_ADD('2001-01-01 10:01:01',interval 10 second) AS date_add2; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `addtime1` varchar(26) CHARACTER SET ucs2 DEFAULT NULL, - `addtime2` varchar(26) CHARACTER SET ucs2 DEFAULT NULL, - `date_add1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL, - `date_add2` varchar(19) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `addtime1` varchar(26) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, + `addtime2` varchar(26) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, + `date_add1` varchar(19) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, + `date_add2` varchar(19) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; addtime1 addtime2 date_add1 date_add2 20:01:01 20:01:01 2001-01-01 10:01:11 2001-01-01 10:01:11 @@ -4515,7 +4515,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `d` date DEFAULT NULL, `bad` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; SET NAMES latin1; SET sql_mode=''; @@ -4662,14 +4662,14 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET ucs2 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0041 @@ -4682,14 +4682,14 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 00410041004100410041 @@ -4702,7 +4702,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 004100410041 @@ -4715,7 +4715,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 0041004100410041004100200020002000200020 @@ -4907,13 +4907,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0061 @@ -4927,13 +4927,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 00610061006100610061 @@ -4946,7 +4946,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 006100610061 @@ -4959,7 +4959,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 0061006100610061006100200020002000200020 @@ -5235,8 +5235,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 64) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (''); SELECT CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1; CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) @@ -5380,7 +5380,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_german2_ci DEFAULT NULL, `b` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; a b @@ -5440,7 +5440,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; c1 @@ -5463,7 +5463,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); c1 @@ -5486,7 +5486,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); c1 @@ -5509,7 +5509,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); c1 @@ -5535,7 +5535,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; a LENGTH(a) @@ -5560,8 +5560,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; c1 @@ -5583,8 +5583,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); c1 @@ -5606,8 +5606,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); c1 @@ -5629,8 +5629,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); c1 @@ -5655,8 +5655,8 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; a LENGTH(a) @@ -5714,8 +5714,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `t` varchar(10) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `t` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI'); SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub; c2 @@ -5788,7 +5788,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE ucs2_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -5926,7 +5926,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE ucs2_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6065,7 +6065,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE ucs2_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6203,7 +6203,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE ucs2_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6398,6 +6398,17 @@ DEALLOCATE PREPARE stmt; # End of 10.2 tests # # +# Start of 10.3 tests +# +# +# MDEV-14983 Wrong error message with SET sql_mode=sha2(ucs2_value) +# +SET sql_mode=sha2(CONVERT('a' USING ucs2),0); +ERROR 42000: Variable 'sql_mode' can't be set to the value of '022a6979e6dab7aa5ae4c3e5e45f7e977112a7e63593820dbec1ec738a24f93c' +# +# End of 10.3 tests +# +# # Start of 10.4 tests # # @@ -6431,6 +6442,23 @@ IS_IPV4('10.0.0.1') 1 SET NAMES utf8; # +# MDEV-30746 Regression in ucs2_general_mysql500_ci +# +SET NAMES utf8mb3; +CREATE TABLE t1 (a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_general_mysql500_ci); +INSERT INTO t1 VALUES ('s'),('z'),(_latin1 0xDF); +SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a ORDER BY a; +GROUP_CONCAT(a) +s +z +ß +SELECT a, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a; +a HEX(a) HEX(WEIGHT_STRING(a)) +s 0073 0053 +z 007A 005A +ß 00DF 00DF +DROP TABLE t1; +# # End of 10.4 tests # # diff --git a/mysql-test/main/ctype_ucs.test b/mysql-test/main/ctype_ucs.test index da970c124c2be..b77636507dd6f 100644 --- a/mysql-test/main/ctype_ucs.test +++ b/mysql-test/main/ctype_ucs.test @@ -1099,6 +1099,21 @@ DEALLOCATE PREPARE stmt; --echo # End of 10.2 tests --echo # +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-14983 Wrong error message with SET sql_mode=sha2(ucs2_value) +--echo # + +--error ER_WRONG_VALUE_FOR_VAR +SET sql_mode=sha2(CONVERT('a' USING ucs2),0); + +--echo # +--echo # End of 10.3 tests +--echo # + --echo # --echo # Start of 10.4 tests --echo # @@ -1125,6 +1140,18 @@ SELECT IS_IPV6('::'); SELECT IS_IPV4('10.0.0.1'); SET NAMES utf8; +--echo # +--echo # MDEV-30746 Regression in ucs2_general_mysql500_ci +--echo # + +SET NAMES utf8mb3; +CREATE TABLE t1 (a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_general_mysql500_ci); +INSERT INTO t1 VALUES ('s'),('z'),(_latin1 0xDF); +SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a ORDER BY a; +SELECT a, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a; +DROP TABLE t1; + + --echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/ctype_ucs2_general_ci_casefold.result b/mysql-test/main/ctype_ucs2_general_ci_casefold.result new file mode 100644 index 0000000000000..a2170c5ba793a --- /dev/null +++ b/mysql-test/main/ctype_ucs2_general_ci_casefold.result @@ -0,0 +1,1427 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET collation_connection=ucs2_general_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +ucs2_general_ci +SELECT +codepoint_hex4, +HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)), +HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +FROM v_bmp +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); +codepoint_hex4 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +0041 0061 0041 +0042 0062 0042 +0043 0063 0043 +0044 0064 0044 +0045 0065 0045 +0046 0066 0046 +0047 0067 0047 +0048 0068 0048 +0049 0069 0049 +004A 006A 004A +004B 006B 004B +004C 006C 004C +004D 006D 004D +004E 006E 004E +004F 006F 004F +0050 0070 0050 +0051 0071 0051 +0052 0072 0052 +0053 0073 0053 +0054 0074 0054 +0055 0075 0055 +0056 0076 0056 +0057 0077 0057 +0058 0078 0058 +0059 0079 0059 +005A 007A 005A +0061 0061 0041 +0062 0062 0042 +0063 0063 0043 +0064 0064 0044 +0065 0065 0045 +0066 0066 0046 +0067 0067 0047 +0068 0068 0048 +0069 0069 0049 +006A 006A 004A +006B 006B 004B +006C 006C 004C +006D 006D 004D +006E 006E 004E +006F 006F 004F +0070 0070 0050 +0071 0071 0051 +0072 0072 0052 +0073 0073 0053 +0074 0074 0054 +0075 0075 0055 +0076 0076 0056 +0077 0077 0057 +0078 0078 0058 +0079 0079 0059 +007A 007A 005A +00B5 00B5 039C +00C0 00E0 00C0 +00C1 00E1 00C1 +00C2 00E2 00C2 +00C3 00E3 00C3 +00C4 00E4 00C4 +00C5 00E5 00C5 +00C6 00E6 00C6 +00C7 00E7 00C7 +00C8 00E8 00C8 +00C9 00E9 00C9 +00CA 00EA 00CA +00CB 00EB 00CB +00CC 00EC 00CC +00CD 00ED 00CD +00CE 00EE 00CE +00CF 00EF 00CF +00D0 00F0 00D0 +00D1 00F1 00D1 +00D2 00F2 00D2 +00D3 00F3 00D3 +00D4 00F4 00D4 +00D5 00F5 00D5 +00D6 00F6 00D6 +00D8 00F8 00D8 +00D9 00F9 00D9 +00DA 00FA 00DA +00DB 00FB 00DB +00DC 00FC 00DC +00DD 00FD 00DD +00DE 00FE 00DE +00E0 00E0 00C0 +00E1 00E1 00C1 +00E2 00E2 00C2 +00E3 00E3 00C3 +00E4 00E4 00C4 +00E5 00E5 00C5 +00E6 00E6 00C6 +00E7 00E7 00C7 +00E8 00E8 00C8 +00E9 00E9 00C9 +00EA 00EA 00CA +00EB 00EB 00CB +00EC 00EC 00CC +00ED 00ED 00CD +00EE 00EE 00CE +00EF 00EF 00CF +00F0 00F0 00D0 +00F1 00F1 00D1 +00F2 00F2 00D2 +00F3 00F3 00D3 +00F4 00F4 00D4 +00F5 00F5 00D5 +00F6 00F6 00D6 +00F8 00F8 00D8 +00F9 00F9 00D9 +00FA 00FA 00DA +00FB 00FB 00DB +00FC 00FC 00DC +00FD 00FD 00DD +00FE 00FE 00DE +00FF 00FF 0178 +0100 0101 0100 +0101 0101 0100 +0102 0103 0102 +0103 0103 0102 +0104 0105 0104 +0105 0105 0104 +0106 0107 0106 +0107 0107 0106 +0108 0109 0108 +0109 0109 0108 +010A 010B 010A +010B 010B 010A +010C 010D 010C +010D 010D 010C +010E 010F 010E +010F 010F 010E +0110 0111 0110 +0111 0111 0110 +0112 0113 0112 +0113 0113 0112 +0114 0115 0114 +0115 0115 0114 +0116 0117 0116 +0117 0117 0116 +0118 0119 0118 +0119 0119 0118 +011A 011B 011A +011B 011B 011A +011C 011D 011C +011D 011D 011C +011E 011F 011E +011F 011F 011E +0120 0121 0120 +0121 0121 0120 +0122 0123 0122 +0123 0123 0122 +0124 0125 0124 +0125 0125 0124 +0126 0127 0126 +0127 0127 0126 +0128 0129 0128 +0129 0129 0128 +012A 012B 012A +012B 012B 012A +012C 012D 012C +012D 012D 012C +012E 012F 012E +012F 012F 012E +0130 0069 0130 +0131 0131 0049 +0132 0133 0132 +0133 0133 0132 +0134 0135 0134 +0135 0135 0134 +0136 0137 0136 +0137 0137 0136 +0139 013A 0139 +013A 013A 0139 +013B 013C 013B +013C 013C 013B +013D 013E 013D +013E 013E 013D +013F 0140 013F +0140 0140 013F +0141 0142 0141 +0142 0142 0141 +0143 0144 0143 +0144 0144 0143 +0145 0146 0145 +0146 0146 0145 +0147 0148 0147 +0148 0148 0147 +014A 014B 014A +014B 014B 014A +014C 014D 014C +014D 014D 014C +014E 014F 014E +014F 014F 014E +0150 0151 0150 +0151 0151 0150 +0152 0153 0152 +0153 0153 0152 +0154 0155 0154 +0155 0155 0154 +0156 0157 0156 +0157 0157 0156 +0158 0159 0158 +0159 0159 0158 +015A 015B 015A +015B 015B 015A +015C 015D 015C +015D 015D 015C +015E 015F 015E +015F 015F 015E +0160 0161 0160 +0161 0161 0160 +0162 0163 0162 +0163 0163 0162 +0164 0165 0164 +0165 0165 0164 +0166 0167 0166 +0167 0167 0166 +0168 0169 0168 +0169 0169 0168 +016A 016B 016A +016B 016B 016A +016C 016D 016C +016D 016D 016C +016E 016F 016E +016F 016F 016E +0170 0171 0170 +0171 0171 0170 +0172 0173 0172 +0173 0173 0172 +0174 0175 0174 +0175 0175 0174 +0176 0177 0176 +0177 0177 0176 +0178 00FF 0178 +0179 017A 0179 +017A 017A 0179 +017B 017C 017B +017C 017C 017B +017D 017E 017D +017E 017E 017D +017F 017F 0053 +0181 0253 0181 +0182 0183 0182 +0183 0183 0182 +0184 0185 0184 +0185 0185 0184 +0186 0254 0186 +0187 0188 0187 +0188 0188 0187 +0189 0256 0189 +018A 0257 018A +018B 018C 018B +018C 018C 018B +018E 01DD 018E +018F 0259 018F +0190 025B 0190 +0191 0192 0191 +0192 0192 0191 +0193 0260 0193 +0194 0263 0194 +0195 0195 01F6 +0196 0269 0196 +0197 0268 0197 +0198 0199 0198 +0199 0199 0198 +019C 026F 019C +019D 0272 019D +019F 0275 019F +01A0 01A1 01A0 +01A1 01A1 01A0 +01A2 01A3 01A2 +01A3 01A3 01A2 +01A4 01A5 01A4 +01A5 01A5 01A4 +01A6 0280 01A6 +01A7 01A8 01A7 +01A8 01A8 01A7 +01A9 0283 01A9 +01AC 01AD 01AC +01AD 01AD 01AC +01AE 0288 01AE +01AF 01B0 01AF +01B0 01B0 01AF +01B1 028A 01B1 +01B2 028B 01B2 +01B3 01B4 01B3 +01B4 01B4 01B3 +01B5 01B6 01B5 +01B6 01B6 01B5 +01B7 0292 01B7 +01B8 01B9 01B8 +01B9 01B9 01B8 +01BC 01BD 01BC +01BD 01BD 01BC +01BF 01BF 01F7 +01C4 01C6 01C4 +01C5 01C6 01C4 +01C6 01C6 01C4 +01C7 01C9 01C7 +01C8 01C9 01C7 +01C9 01C9 01C7 +01CA 01CC 01CA +01CB 01CC 01CA +01CC 01CC 01CA +01CD 01CE 01CD +01CE 01CE 01CD +01CF 01D0 01CF +01D0 01D0 01CF +01D1 01D2 01D1 +01D2 01D2 01D1 +01D3 01D4 01D3 +01D4 01D4 01D3 +01D5 01D6 01D5 +01D6 01D6 01D5 +01D7 01D8 01D7 +01D8 01D8 01D7 +01D9 01DA 01D9 +01DA 01DA 01D9 +01DB 01DC 01DB +01DC 01DC 01DB +01DD 01DD 018E +01DE 01DF 01DE +01DF 01DF 01DE +01E0 01E1 01E0 +01E1 01E1 01E0 +01E2 01E3 01E2 +01E3 01E3 01E2 +01E4 01E5 01E4 +01E5 01E5 01E4 +01E6 01E7 01E6 +01E7 01E7 01E6 +01E8 01E9 01E8 +01E9 01E9 01E8 +01EA 01EB 01EA +01EB 01EB 01EA +01EC 01ED 01EC +01ED 01ED 01EC +01EE 01EF 01EE +01EF 01EF 01EE +01F1 01F3 01F1 +01F2 01F3 01F1 +01F3 01F3 01F1 +01F4 01F5 01F4 +01F5 01F5 01F4 +01F6 0195 01F6 +01F7 01BF 01F7 +01F8 01F9 01F8 +01F9 01F9 01F8 +01FA 01FB 01FA +01FB 01FB 01FA +01FC 01FD 01FC +01FD 01FD 01FC +01FE 01FF 01FE +01FF 01FF 01FE +0200 0201 0200 +0201 0201 0200 +0202 0203 0202 +0203 0203 0202 +0204 0205 0204 +0205 0205 0204 +0206 0207 0206 +0207 0207 0206 +0208 0209 0208 +0209 0209 0208 +020A 020B 020A +020B 020B 020A +020C 020D 020C +020D 020D 020C +020E 020F 020E +020F 020F 020E +0210 0211 0210 +0211 0211 0210 +0212 0213 0212 +0213 0213 0212 +0214 0215 0214 +0215 0215 0214 +0216 0217 0216 +0217 0217 0216 +0218 0219 0218 +0219 0219 0218 +021A 021B 021A +021B 021B 021A +021C 021D 021C +021D 021D 021C +021E 021F 021E +021F 021F 021E +0222 0223 0222 +0223 0223 0222 +0224 0225 0224 +0225 0225 0224 +0226 0227 0226 +0227 0227 0226 +0228 0229 0228 +0229 0229 0228 +022A 022B 022A +022B 022B 022A +022C 022D 022C +022D 022D 022C +022E 022F 022E +022F 022F 022E +0230 0231 0230 +0231 0231 0230 +0232 0233 0232 +0233 0233 0232 +0253 0253 0181 +0254 0254 0186 +0256 0256 0189 +0257 0257 018A +0259 0259 018F +025B 025B 0190 +0260 0260 0193 +0263 0263 0194 +0268 0268 0197 +0269 0269 0196 +026F 026F 019C +0272 0272 019D +0275 0275 019F +0280 0280 01A6 +0283 0283 01A9 +0288 0288 01AE +028A 028A 01B1 +028B 028B 01B2 +0292 0292 01B7 +0345 0345 0399 +0386 03AC 0386 +0388 03AD 0388 +0389 03AE 0389 +038A 03AF 038A +038C 03CC 038C +038E 03CD 038E +038F 03CE 038F +0391 03B1 0391 +0392 03B2 0392 +0393 03B3 0393 +0394 03B4 0394 +0395 03B5 0395 +0396 03B6 0396 +0397 03B7 0397 +0398 03B8 0398 +0399 03B9 0399 +039A 03BA 039A +039B 03BB 039B +039C 03BC 039C +039D 03BD 039D +039E 03BE 039E +039F 03BF 039F +03A0 03C0 03A0 +03A1 03C1 03A1 +03A3 03C3 03A3 +03A4 03C4 03A4 +03A5 03C5 03A5 +03A6 03C6 03A6 +03A7 03C7 03A7 +03A8 03C8 03A8 +03A9 03C9 03A9 +03AA 03CA 03AA +03AB 03CB 03AB +03AC 03AC 0386 +03AD 03AD 0388 +03AE 03AE 0389 +03AF 03AF 038A +03B1 03B1 0391 +03B2 03B2 0392 +03B3 03B3 0393 +03B4 03B4 0394 +03B5 03B5 0395 +03B6 03B6 0396 +03B7 03B7 0397 +03B8 03B8 0398 +03B9 03B9 0399 +03BA 03BA 039A +03BB 03BB 039B +03BC 03BC 039C +03BD 03BD 039D +03BE 03BE 039E +03BF 03BF 039F +03C0 03C0 03A0 +03C1 03C1 03A1 +03C2 03C2 03A3 +03C3 03C3 03A3 +03C4 03C4 03A4 +03C5 03C5 03A5 +03C6 03C6 03A6 +03C7 03C7 03A7 +03C8 03C8 03A8 +03C9 03C9 03A9 +03CA 03CA 03AA +03CB 03CB 03AB +03CC 03CC 038C +03CD 03CD 038E +03CE 03CE 038F +03D0 03D0 0392 +03D1 03D1 0398 +03D5 03D5 03A6 +03D6 03D6 03A0 +03DA 03DB 03DA +03DB 03DB 03DA +03DC 03DD 03DC +03DD 03DD 03DC +03DE 03DF 03DE +03DF 03DF 03DE +03E0 03E1 03E0 +03E1 03E1 03E0 +03E2 03E3 03E2 +03E3 03E3 03E2 +03E4 03E5 03E4 +03E5 03E5 03E4 +03E6 03E7 03E6 +03E7 03E7 03E6 +03E8 03E9 03E8 +03E9 03E9 03E8 +03EA 03EB 03EA +03EB 03EB 03EA +03EC 03ED 03EC +03ED 03ED 03EC +03EE 03EF 03EE +03EF 03EF 03EE +03F0 03F0 039A +03F1 03F1 03A1 +03F2 03F2 03A3 +0400 0450 0400 +0401 0451 0401 +0402 0452 0402 +0403 0453 0403 +0404 0454 0404 +0405 0455 0405 +0406 0456 0406 +0407 0457 0407 +0408 0458 0408 +0409 0459 0409 +040A 045A 040A +040B 045B 040B +040C 045C 040C +040D 045D 040D +040E 045E 040E +040F 045F 040F +0410 0430 0410 +0411 0431 0411 +0412 0432 0412 +0413 0433 0413 +0414 0434 0414 +0415 0435 0415 +0416 0436 0416 +0417 0437 0417 +0418 0438 0418 +0419 0439 0419 +041A 043A 041A +041B 043B 041B +041C 043C 041C +041D 043D 041D +041E 043E 041E +041F 043F 041F +0420 0440 0420 +0421 0441 0421 +0422 0442 0422 +0423 0443 0423 +0424 0444 0424 +0425 0445 0425 +0426 0446 0426 +0427 0447 0427 +0428 0448 0428 +0429 0449 0429 +042A 044A 042A +042B 044B 042B +042C 044C 042C +042D 044D 042D +042E 044E 042E +042F 044F 042F +0430 0430 0410 +0431 0431 0411 +0432 0432 0412 +0433 0433 0413 +0434 0434 0414 +0435 0435 0415 +0436 0436 0416 +0437 0437 0417 +0438 0438 0418 +0439 0439 0419 +043A 043A 041A +043B 043B 041B +043C 043C 041C +043D 043D 041D +043E 043E 041E +043F 043F 041F +0440 0440 0420 +0441 0441 0421 +0442 0442 0422 +0443 0443 0423 +0444 0444 0424 +0445 0445 0425 +0446 0446 0426 +0447 0447 0427 +0448 0448 0428 +0449 0449 0429 +044A 044A 042A +044B 044B 042B +044C 044C 042C +044D 044D 042D +044E 044E 042E +044F 044F 042F +0450 0450 0400 +0451 0451 0401 +0452 0452 0402 +0453 0453 0403 +0454 0454 0404 +0455 0455 0405 +0456 0456 0406 +0457 0457 0407 +0458 0458 0408 +0459 0459 0409 +045A 045A 040A +045B 045B 040B +045C 045C 040C +045D 045D 040D +045E 045E 040E +045F 045F 040F +0460 0461 0460 +0461 0461 0460 +0462 0463 0462 +0463 0463 0462 +0464 0465 0464 +0465 0465 0464 +0466 0467 0466 +0467 0467 0466 +0468 0469 0468 +0469 0469 0468 +046A 046B 046A +046B 046B 046A +046C 046D 046C +046D 046D 046C +046E 046F 046E +046F 046F 046E +0470 0471 0470 +0471 0471 0470 +0472 0473 0472 +0473 0473 0472 +0474 0475 0474 +0475 0475 0474 +0476 0477 0476 +0477 0477 0476 +0478 0479 0478 +0479 0479 0478 +047A 047B 047A +047B 047B 047A +047C 047D 047C +047D 047D 047C +047E 047F 047E +047F 047F 047E +0480 0481 0480 +0481 0481 0480 +048C 048D 048C +048D 048D 048C +048E 048F 048E +048F 048F 048E +0490 0491 0490 +0491 0491 0490 +0492 0493 0492 +0493 0493 0492 +0494 0495 0494 +0495 0495 0494 +0496 0497 0496 +0497 0497 0496 +0498 0499 0498 +0499 0499 0498 +049A 049B 049A +049B 049B 049A +049C 049D 049C +049D 049D 049C +049E 049F 049E +049F 049F 049E +04A0 04A1 04A0 +04A1 04A1 04A0 +04A2 04A3 04A2 +04A3 04A3 04A2 +04A4 04A5 04A4 +04A5 04A5 04A4 +04A6 04A7 04A6 +04A7 04A7 04A6 +04A8 04A9 04A8 +04A9 04A9 04A8 +04AA 04AB 04AA +04AB 04AB 04AA +04AC 04AD 04AC +04AD 04AD 04AC +04AE 04AF 04AE +04AF 04AF 04AE +04B0 04B1 04B0 +04B1 04B1 04B0 +04B2 04B3 04B2 +04B3 04B3 04B2 +04B4 04B5 04B4 +04B5 04B5 04B4 +04B6 04B7 04B6 +04B7 04B7 04B6 +04B8 04B9 04B8 +04B9 04B9 04B8 +04BA 04BB 04BA +04BB 04BB 04BA +04BC 04BD 04BC +04BD 04BD 04BC +04BE 04BF 04BE +04BF 04BF 04BE +04C1 04C2 04C1 +04C2 04C2 04C1 +04C3 04C4 04C3 +04C4 04C4 04C3 +04C7 04C8 04C7 +04C8 04C8 04C7 +04CB 04CC 04CB +04CC 04CC 04CB +04D0 04D1 04D0 +04D1 04D1 04D0 +04D2 04D3 04D2 +04D3 04D3 04D2 +04D4 04D5 04D4 +04D5 04D5 04D4 +04D6 04D7 04D6 +04D7 04D7 04D6 +04D8 04D9 04D8 +04D9 04D9 04D8 +04DA 04DB 04DA +04DB 04DB 04DA +04DC 04DD 04DC +04DD 04DD 04DC +04DE 04DF 04DE +04DF 04DF 04DE +04E0 04E1 04E0 +04E1 04E1 04E0 +04E2 04E3 04E2 +04E3 04E3 04E2 +04E4 04E5 04E4 +04E5 04E5 04E4 +04E6 04E7 04E6 +04E7 04E7 04E6 +04E8 04E9 04E8 +04E9 04E9 04E8 +04EA 04EB 04EA +04EB 04EB 04EA +04EC 04ED 04EC +04ED 04ED 04EC +04EE 04EF 04EE +04EF 04EF 04EE +04F0 04F1 04F0 +04F1 04F1 04F0 +04F2 04F3 04F2 +04F3 04F3 04F2 +04F4 04F5 04F4 +04F5 04F5 04F4 +04F8 04F9 04F8 +04F9 04F9 04F8 +0531 0561 0531 +0532 0562 0532 +0533 0563 0533 +0534 0564 0534 +0535 0565 0535 +0536 0566 0536 +0537 0567 0537 +0538 0568 0538 +0539 0569 0539 +053A 056A 053A +053B 056B 053B +053C 056C 053C +053D 056D 053D +053E 056E 053E +053F 056F 053F +0540 0570 0540 +0541 0571 0541 +0542 0572 0542 +0543 0573 0543 +0544 0574 0544 +0545 0575 0545 +0546 0576 0546 +0547 0577 0547 +0548 0578 0548 +0549 0579 0549 +054A 057A 054A +054B 057B 054B +054C 057C 054C +054D 057D 054D +054E 057E 054E +054F 057F 054F +0550 0580 0550 +0551 0581 0551 +0552 0582 0552 +0553 0583 0553 +0554 0584 0554 +0555 0585 0555 +0556 0586 0556 +0561 0561 0531 +0562 0562 0532 +0563 0563 0533 +0564 0564 0534 +0565 0565 0535 +0566 0566 0536 +0567 0567 0537 +0568 0568 0538 +0569 0569 0539 +056A 056A 053A +056B 056B 053B +056C 056C 053C +056D 056D 053D +056E 056E 053E +056F 056F 053F +0570 0570 0540 +0571 0571 0541 +0572 0572 0542 +0573 0573 0543 +0574 0574 0544 +0575 0575 0545 +0576 0576 0546 +0577 0577 0547 +0578 0578 0548 +0579 0579 0549 +057A 057A 054A +057B 057B 054B +057C 057C 054C +057D 057D 054D +057E 057E 054E +057F 057F 054F +0580 0580 0550 +0581 0581 0551 +0582 0582 0552 +0583 0583 0553 +0584 0584 0554 +0585 0585 0555 +0586 0586 0556 +1E00 1E01 1E00 +1E01 1E01 1E00 +1E02 1E03 1E02 +1E03 1E03 1E02 +1E04 1E05 1E04 +1E05 1E05 1E04 +1E06 1E07 1E06 +1E07 1E07 1E06 +1E08 1E09 1E08 +1E09 1E09 1E08 +1E0A 1E0B 1E0A +1E0B 1E0B 1E0A +1E0C 1E0D 1E0C +1E0D 1E0D 1E0C +1E0E 1E0F 1E0E +1E0F 1E0F 1E0E +1E10 1E11 1E10 +1E11 1E11 1E10 +1E12 1E13 1E12 +1E13 1E13 1E12 +1E14 1E15 1E14 +1E15 1E15 1E14 +1E16 1E17 1E16 +1E17 1E17 1E16 +1E18 1E19 1E18 +1E19 1E19 1E18 +1E1A 1E1B 1E1A +1E1B 1E1B 1E1A +1E1C 1E1D 1E1C +1E1D 1E1D 1E1C +1E1E 1E1F 1E1E +1E1F 1E1F 1E1E +1E20 1E21 1E20 +1E21 1E21 1E20 +1E22 1E23 1E22 +1E23 1E23 1E22 +1E24 1E25 1E24 +1E25 1E25 1E24 +1E26 1E27 1E26 +1E27 1E27 1E26 +1E28 1E29 1E28 +1E29 1E29 1E28 +1E2A 1E2B 1E2A +1E2B 1E2B 1E2A +1E2C 1E2D 1E2C +1E2D 1E2D 1E2C +1E2E 1E2F 1E2E +1E2F 1E2F 1E2E +1E30 1E31 1E30 +1E31 1E31 1E30 +1E32 1E33 1E32 +1E33 1E33 1E32 +1E34 1E35 1E34 +1E35 1E35 1E34 +1E36 1E37 1E36 +1E37 1E37 1E36 +1E38 1E39 1E38 +1E39 1E39 1E38 +1E3A 1E3B 1E3A +1E3B 1E3B 1E3A +1E3C 1E3D 1E3C +1E3D 1E3D 1E3C +1E3E 1E3F 1E3E +1E3F 1E3F 1E3E +1E40 1E41 1E40 +1E41 1E41 1E40 +1E42 1E43 1E42 +1E43 1E43 1E42 +1E44 1E45 1E44 +1E45 1E45 1E44 +1E46 1E47 1E46 +1E47 1E47 1E46 +1E48 1E49 1E48 +1E49 1E49 1E48 +1E4A 1E4B 1E4A +1E4B 1E4B 1E4A +1E4C 1E4D 1E4C +1E4D 1E4D 1E4C +1E4E 1E4F 1E4E +1E4F 1E4F 1E4E +1E50 1E51 1E50 +1E51 1E51 1E50 +1E52 1E53 1E52 +1E53 1E53 1E52 +1E54 1E55 1E54 +1E55 1E55 1E54 +1E56 1E57 1E56 +1E57 1E57 1E56 +1E58 1E59 1E58 +1E59 1E59 1E58 +1E5A 1E5B 1E5A +1E5B 1E5B 1E5A +1E5C 1E5D 1E5C +1E5D 1E5D 1E5C +1E5E 1E5F 1E5E +1E5F 1E5F 1E5E +1E60 1E61 1E60 +1E61 1E61 1E60 +1E62 1E63 1E62 +1E63 1E63 1E62 +1E64 1E65 1E64 +1E65 1E65 1E64 +1E66 1E67 1E66 +1E67 1E67 1E66 +1E68 1E69 1E68 +1E69 1E69 1E68 +1E6A 1E6B 1E6A +1E6B 1E6B 1E6A +1E6C 1E6D 1E6C +1E6D 1E6D 1E6C +1E6E 1E6F 1E6E +1E6F 1E6F 1E6E +1E70 1E71 1E70 +1E71 1E71 1E70 +1E72 1E73 1E72 +1E73 1E73 1E72 +1E74 1E75 1E74 +1E75 1E75 1E74 +1E76 1E77 1E76 +1E77 1E77 1E76 +1E78 1E79 1E78 +1E79 1E79 1E78 +1E7A 1E7B 1E7A +1E7B 1E7B 1E7A +1E7C 1E7D 1E7C +1E7D 1E7D 1E7C +1E7E 1E7F 1E7E +1E7F 1E7F 1E7E +1E80 1E81 1E80 +1E81 1E81 1E80 +1E82 1E83 1E82 +1E83 1E83 1E82 +1E84 1E85 1E84 +1E85 1E85 1E84 +1E86 1E87 1E86 +1E87 1E87 1E86 +1E88 1E89 1E88 +1E89 1E89 1E88 +1E8A 1E8B 1E8A +1E8B 1E8B 1E8A +1E8C 1E8D 1E8C +1E8D 1E8D 1E8C +1E8E 1E8F 1E8E +1E8F 1E8F 1E8E +1E90 1E91 1E90 +1E91 1E91 1E90 +1E92 1E93 1E92 +1E93 1E93 1E92 +1E94 1E95 1E94 +1E95 1E95 1E94 +1E9B 1E9B 1E60 +1EA0 1EA1 1EA0 +1EA1 1EA1 1EA0 +1EA2 1EA3 1EA2 +1EA3 1EA3 1EA2 +1EA4 1EA5 1EA4 +1EA5 1EA5 1EA4 +1EA6 1EA7 1EA6 +1EA7 1EA7 1EA6 +1EA8 1EA9 1EA8 +1EA9 1EA9 1EA8 +1EAA 1EAB 1EAA +1EAB 1EAB 1EAA +1EAC 1EAD 1EAC +1EAD 1EAD 1EAC +1EAE 1EAF 1EAE +1EAF 1EAF 1EAE +1EB0 1EB1 1EB0 +1EB1 1EB1 1EB0 +1EB2 1EB3 1EB2 +1EB3 1EB3 1EB2 +1EB4 1EB5 1EB4 +1EB5 1EB5 1EB4 +1EB6 1EB7 1EB6 +1EB7 1EB7 1EB6 +1EB8 1EB9 1EB8 +1EB9 1EB9 1EB8 +1EBA 1EBB 1EBA +1EBB 1EBB 1EBA +1EBC 1EBD 1EBC +1EBD 1EBD 1EBC +1EBE 1EBF 1EBE +1EBF 1EBF 1EBE +1EC0 1EC1 1EC0 +1EC1 1EC1 1EC0 +1EC2 1EC3 1EC2 +1EC3 1EC3 1EC2 +1EC4 1EC5 1EC4 +1EC5 1EC5 1EC4 +1EC6 1EC7 1EC6 +1EC7 1EC7 1EC6 +1EC8 1EC9 1EC8 +1EC9 1EC9 1EC8 +1ECA 1ECB 1ECA +1ECB 1ECB 1ECA +1ECC 1ECD 1ECC +1ECD 1ECD 1ECC +1ECE 1ECF 1ECE +1ECF 1ECF 1ECE +1ED0 1ED1 1ED0 +1ED1 1ED1 1ED0 +1ED2 1ED3 1ED2 +1ED3 1ED3 1ED2 +1ED4 1ED5 1ED4 +1ED5 1ED5 1ED4 +1ED6 1ED7 1ED6 +1ED7 1ED7 1ED6 +1ED8 1ED9 1ED8 +1ED9 1ED9 1ED8 +1EDA 1EDB 1EDA +1EDB 1EDB 1EDA +1EDC 1EDD 1EDC +1EDD 1EDD 1EDC +1EDE 1EDF 1EDE +1EDF 1EDF 1EDE +1EE0 1EE1 1EE0 +1EE1 1EE1 1EE0 +1EE2 1EE3 1EE2 +1EE3 1EE3 1EE2 +1EE4 1EE5 1EE4 +1EE5 1EE5 1EE4 +1EE6 1EE7 1EE6 +1EE7 1EE7 1EE6 +1EE8 1EE9 1EE8 +1EE9 1EE9 1EE8 +1EEA 1EEB 1EEA +1EEB 1EEB 1EEA +1EEC 1EED 1EEC +1EED 1EED 1EEC +1EEE 1EEF 1EEE +1EEF 1EEF 1EEE +1EF0 1EF1 1EF0 +1EF1 1EF1 1EF0 +1EF2 1EF3 1EF2 +1EF3 1EF3 1EF2 +1EF4 1EF5 1EF4 +1EF5 1EF5 1EF4 +1EF6 1EF7 1EF6 +1EF7 1EF7 1EF6 +1EF8 1EF9 1EF8 +1EF9 1EF9 1EF8 +1F00 1F00 1F08 +1F01 1F01 1F09 +1F02 1F02 1F0A +1F03 1F03 1F0B +1F04 1F04 1F0C +1F05 1F05 1F0D +1F06 1F06 1F0E +1F07 1F07 1F0F +1F08 1F00 1F08 +1F09 1F01 1F09 +1F0A 1F02 1F0A +1F0B 1F03 1F0B +1F0C 1F04 1F0C +1F0D 1F05 1F0D +1F0E 1F06 1F0E +1F0F 1F07 1F0F +1F10 1F10 1F18 +1F11 1F11 1F19 +1F12 1F12 1F1A +1F13 1F13 1F1B +1F14 1F14 1F1C +1F15 1F15 1F1D +1F18 1F10 1F18 +1F19 1F11 1F19 +1F1A 1F12 1F1A +1F1B 1F13 1F1B +1F1C 1F14 1F1C +1F1D 1F15 1F1D +1F20 1F20 1F28 +1F21 1F21 1F29 +1F22 1F22 1F2A +1F23 1F23 1F2B +1F24 1F24 1F2C +1F25 1F25 1F2D +1F26 1F26 1F2E +1F27 1F27 1F2F +1F28 1F20 1F28 +1F29 1F21 1F29 +1F2A 1F22 1F2A +1F2B 1F23 1F2B +1F2C 1F24 1F2C +1F2D 1F25 1F2D +1F2E 1F26 1F2E +1F2F 1F27 1F2F +1F30 1F30 1F38 +1F31 1F31 1F39 +1F32 1F32 1F3A +1F33 1F33 1F3B +1F34 1F34 1F3C +1F35 1F35 1F3D +1F36 1F36 1F3E +1F37 1F37 1F3F +1F38 1F30 1F38 +1F39 1F31 1F39 +1F3A 1F32 1F3A +1F3B 1F33 1F3B +1F3C 1F34 1F3C +1F3D 1F35 1F3D +1F3E 1F36 1F3E +1F3F 1F37 1F3F +1F40 1F40 1F48 +1F41 1F41 1F49 +1F42 1F42 1F4A +1F43 1F43 1F4B +1F44 1F44 1F4C +1F45 1F45 1F4D +1F48 1F40 1F48 +1F49 1F41 1F49 +1F4A 1F42 1F4A +1F4B 1F43 1F4B +1F4C 1F44 1F4C +1F4D 1F45 1F4D +1F51 1F51 1F59 +1F53 1F53 1F5B +1F55 1F55 1F5D +1F57 1F57 1F5F +1F59 1F51 1F59 +1F5B 1F53 1F5B +1F5D 1F55 1F5D +1F5F 1F57 1F5F +1F60 1F60 1F68 +1F61 1F61 1F69 +1F62 1F62 1F6A +1F63 1F63 1F6B +1F64 1F64 1F6C +1F65 1F65 1F6D +1F66 1F66 1F6E +1F67 1F67 1F6F +1F68 1F60 1F68 +1F69 1F61 1F69 +1F6A 1F62 1F6A +1F6B 1F63 1F6B +1F6C 1F64 1F6C +1F6D 1F65 1F6D +1F6E 1F66 1F6E +1F6F 1F67 1F6F +1F70 1F70 1FBA +1F71 1F71 1FBB +1F72 1F72 1FC8 +1F73 1F73 1FC9 +1F74 1F74 1FCA +1F75 1F75 1FCB +1F76 1F76 1FDA +1F77 1F77 1FDB +1F78 1F78 1FF8 +1F79 1F79 1FF9 +1F7A 1F7A 1FEA +1F7B 1F7B 1FEB +1F7C 1F7C 1FFA +1F7D 1F7D 1FFB +1F80 1F80 1F88 +1F81 1F81 1F89 +1F82 1F82 1F8A +1F83 1F83 1F8B +1F84 1F84 1F8C +1F85 1F85 1F8D +1F86 1F86 1F8E +1F87 1F87 1F8F +1F88 1F80 1F88 +1F89 1F81 1F89 +1F8A 1F82 1F8A +1F8B 1F83 1F8B +1F8C 1F84 1F8C +1F8D 1F85 1F8D +1F8E 1F86 1F8E +1F8F 1F87 1F8F +1F90 1F90 1F98 +1F91 1F91 1F99 +1F92 1F92 1F9A +1F93 1F93 1F9B +1F94 1F94 1F9C +1F95 1F95 1F9D +1F96 1F96 1F9E +1F97 1F97 1F9F +1F98 1F90 1F98 +1F99 1F91 1F99 +1F9A 1F92 1F9A +1F9B 1F93 1F9B +1F9C 1F94 1F9C +1F9D 1F95 1F9D +1F9E 1F96 1F9E +1F9F 1F97 1F9F +1FA0 1FA0 1FA8 +1FA1 1FA1 1FA9 +1FA2 1FA2 1FAA +1FA3 1FA3 1FAB +1FA4 1FA4 1FAC +1FA5 1FA5 1FAD +1FA6 1FA6 1FAE +1FA7 1FA7 1FAF +1FA8 1FA0 1FA8 +1FA9 1FA1 1FA9 +1FAA 1FA2 1FAA +1FAB 1FA3 1FAB +1FAC 1FA4 1FAC +1FAD 1FA5 1FAD +1FAE 1FA6 1FAE +1FAF 1FA7 1FAF +1FB0 1FB0 1FB8 +1FB1 1FB1 1FB9 +1FB3 1FB3 1FBC +1FB8 1FB0 1FB8 +1FB9 1FB1 1FB9 +1FBA 1F70 1FBA +1FBB 1F71 1FBB +1FBC 1FB3 1FBC +1FBE 1FBE 0399 +1FC3 1FC3 1FCC +1FC8 1F72 1FC8 +1FC9 1F73 1FC9 +1FCA 1F74 1FCA +1FCB 1F75 1FCB +1FCC 1FC3 1FCC +1FD0 1FD0 1FD8 +1FD1 1FD1 1FD9 +1FD8 1FD0 1FD8 +1FD9 1FD1 1FD9 +1FDA 1F76 1FDA +1FDB 1F77 1FDB +1FE0 1FE0 1FE8 +1FE1 1FE1 1FE9 +1FE5 1FE5 1FEC +1FE8 1FE0 1FE8 +1FE9 1FE1 1FE9 +1FEA 1F7A 1FEA +1FEB 1F7B 1FEB +1FEC 1FE5 1FEC +1FF3 1FF3 1FFC +1FF8 1F78 1FF8 +1FF9 1F79 1FF9 +1FFA 1F7C 1FFA +1FFB 1F7D 1FFB +1FFC 1FF3 1FFC +2126 03C9 2126 +212A 006B 212A +212B 00E5 212B +2160 2170 2160 +2161 2171 2161 +2162 2172 2162 +2163 2173 2163 +2164 2174 2164 +2165 2175 2165 +2166 2176 2166 +2167 2177 2167 +2168 2178 2168 +2169 2179 2169 +216A 217A 216A +216B 217B 216B +216C 217C 216C +216D 217D 216D +216E 217E 216E +216F 217F 216F +2170 2170 2160 +2171 2171 2161 +2172 2172 2162 +2173 2173 2163 +2174 2174 2164 +2175 2175 2165 +2176 2176 2166 +2177 2177 2167 +2178 2178 2168 +2179 2179 2169 +217A 217A 216A +217B 217B 216B +217C 217C 216C +217D 217D 216D +217E 217E 216E +217F 217F 216F +24B6 24D0 24B6 +24B7 24D1 24B7 +24B8 24D2 24B8 +24B9 24D3 24B9 +24BA 24D4 24BA +24BB 24D5 24BB +24BC 24D6 24BC +24BD 24D7 24BD +24BE 24D8 24BE +24BF 24D9 24BF +24C0 24DA 24C0 +24C1 24DB 24C1 +24C2 24DC 24C2 +24C3 24DD 24C3 +24C4 24DE 24C4 +24C5 24DF 24C5 +24C6 24E0 24C6 +24C7 24E1 24C7 +24C8 24E2 24C8 +24C9 24E3 24C9 +24CA 24E4 24CA +24CB 24E5 24CB +24CC 24E6 24CC +24CD 24E7 24CD +24CE 24E8 24CE +24CF 24E9 24CF +24D0 24D0 24B6 +24D1 24D1 24B7 +24D2 24D2 24B8 +24D3 24D3 24B9 +24D4 24D4 24BA +24D5 24D5 24BB +24D6 24D6 24BC +24D7 24D7 24BD +24D8 24D8 24BE +24D9 24D9 24BF +24DA 24DA 24C0 +24DB 24DB 24C1 +24DC 24DC 24C2 +24DD 24DD 24C3 +24DE 24DE 24C4 +24DF 24DF 24C5 +24E0 24E0 24C6 +24E1 24E1 24C7 +24E2 24E2 24C8 +24E3 24E3 24C9 +24E4 24E4 24CA +24E5 24E5 24CB +24E6 24E6 24CC +24E7 24E7 24CD +24E8 24E8 24CE +24E9 24E9 24CF +FF21 FF41 FF21 +FF22 FF42 FF22 +FF23 FF43 FF23 +FF24 FF44 FF24 +FF25 FF45 FF25 +FF26 FF46 FF26 +FF27 FF47 FF27 +FF28 FF48 FF28 +FF29 FF49 FF29 +FF2A FF4A FF2A +FF2B FF4B FF2B +FF2C FF4C FF2C +FF2D FF4D FF2D +FF2E FF4E FF2E +FF2F FF4F FF2F +FF30 FF50 FF30 +FF31 FF51 FF31 +FF32 FF52 FF32 +FF33 FF53 FF33 +FF34 FF54 FF34 +FF35 FF55 FF35 +FF36 FF56 FF36 +FF37 FF57 FF37 +FF38 FF58 FF38 +FF39 FF59 FF39 +FF3A FF5A FF3A +FF41 FF41 FF21 +FF42 FF42 FF22 +FF43 FF43 FF23 +FF44 FF44 FF24 +FF45 FF45 FF25 +FF46 FF46 FF26 +FF47 FF47 FF27 +FF48 FF48 FF28 +FF49 FF49 FF29 +FF4A FF4A FF2A +FF4B FF4B FF2B +FF4C FF4C FF2C +FF4D FF4D FF2D +FF4E FF4E FF2E +FF4F FF4F FF2F +FF50 FF50 FF30 +FF51 FF51 FF31 +FF52 FF52 FF32 +FF53 FF53 FF33 +FF54 FF54 FF34 +FF55 FF55 FF35 +FF56 FF56 FF36 +FF57 FF57 FF37 +FF58 FF58 FF38 +FF59 FF59 FF39 +FF5A FF5A FF3A +DROP VIEW v_bmp; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_ucs2_general_ci_casefold.test b/mysql-test/main/ctype_ucs2_general_ci_casefold.test new file mode 100644 index 0000000000000..82b8add83744e --- /dev/null +++ b/mysql-test/main/ctype_ucs2_general_ci_casefold.test @@ -0,0 +1,14 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET collation_connection=ucs2_general_ci; +--source include/ctype_unicode_casefold_bmp.inc + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/ctype_ucs2_general_ci_ws.result b/mysql-test/main/ctype_ucs2_general_ci_ws.result new file mode 100644 index 0000000000000..eb1d18c3e108b --- /dev/null +++ b/mysql-test/main/ctype_ucs2_general_ci_ws.result @@ -0,0 +1,1143 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET @@collation_connection=ucs2_general_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +ucs2_general_ci +SELECT HEX(codepoint) FROM v_bmp WHERE HEX(WEIGHT_STRING(c))='FFFD'; +HEX(codepoint) +FFFD +SELECT +SUM(codepoint_hex4=HEX(WEIGHT_STRING(c))) AS count_bmp_weight_is_codepoint, +SUM(codepoint_hex4<>HEX(WEIGHT_STRING(c))) AS count_bmp_weight_is_not_codepoint +FROM v_bmp; +count_bmp_weight_is_codepoint count_bmp_weight_is_not_codepoint +64428 1108 +SELECT codepoint_hex4,HEX(WEIGHT_STRING(c)) +FROM v_bmp +WHERE codepoint_hex4<>HEX(WEIGHT_STRING(c)); +codepoint_hex4 HEX(WEIGHT_STRING(c)) +0061 0041 +0062 0042 +0063 0043 +0064 0044 +0065 0045 +0066 0046 +0067 0047 +0068 0048 +0069 0049 +006A 004A +006B 004B +006C 004C +006D 004D +006E 004E +006F 004F +0070 0050 +0071 0051 +0072 0052 +0073 0053 +0074 0054 +0075 0055 +0076 0056 +0077 0057 +0078 0058 +0079 0059 +007A 005A +00B5 039C +00C0 0041 +00C1 0041 +00C2 0041 +00C3 0041 +00C4 0041 +00C5 0041 +00C7 0043 +00C8 0045 +00C9 0045 +00CA 0045 +00CB 0045 +00CC 0049 +00CD 0049 +00CE 0049 +00CF 0049 +00D1 004E +00D2 004F +00D3 004F +00D4 004F +00D5 004F +00D6 004F +00D9 0055 +00DA 0055 +00DB 0055 +00DC 0055 +00DD 0059 +00DF 0053 +00E0 0041 +00E1 0041 +00E2 0041 +00E3 0041 +00E4 0041 +00E5 0041 +00E6 00C6 +00E7 0043 +00E8 0045 +00E9 0045 +00EA 0045 +00EB 0045 +00EC 0049 +00ED 0049 +00EE 0049 +00EF 0049 +00F0 00D0 +00F1 004E +00F2 004F +00F3 004F +00F4 004F +00F5 004F +00F6 004F +00F8 00D8 +00F9 0055 +00FA 0055 +00FB 0055 +00FC 0055 +00FD 0059 +00FE 00DE +00FF 0059 +0100 0041 +0101 0041 +0102 0041 +0103 0041 +0104 0041 +0105 0041 +0106 0043 +0107 0043 +0108 0043 +0109 0043 +010A 0043 +010B 0043 +010C 0043 +010D 0043 +010E 0044 +010F 0044 +0111 0110 +0112 0045 +0113 0045 +0114 0045 +0115 0045 +0116 0045 +0117 0045 +0118 0045 +0119 0045 +011A 0045 +011B 0045 +011C 0047 +011D 0047 +011E 0047 +011F 0047 +0120 0047 +0121 0047 +0122 0047 +0123 0047 +0124 0048 +0125 0048 +0127 0126 +0128 0049 +0129 0049 +012A 0049 +012B 0049 +012C 0049 +012D 0049 +012E 0049 +012F 0049 +0130 0049 +0131 0049 +0133 0132 +0134 004A +0135 004A +0136 004B +0137 004B +0139 004C +013A 004C +013B 004C +013C 004C +013D 004C +013E 004C +0140 013F +0142 0141 +0143 004E +0144 004E +0145 004E +0146 004E +0147 004E +0148 004E +014B 014A +014C 004F +014D 004F +014E 004F +014F 004F +0150 004F +0151 004F +0153 0152 +0154 0052 +0155 0052 +0156 0052 +0157 0052 +0158 0052 +0159 0052 +015A 0053 +015B 0053 +015C 0053 +015D 0053 +015E 0053 +015F 0053 +0160 0053 +0161 0053 +0162 0054 +0163 0054 +0164 0054 +0165 0054 +0167 0166 +0168 0055 +0169 0055 +016A 0055 +016B 0055 +016C 0055 +016D 0055 +016E 0055 +016F 0055 +0170 0055 +0171 0055 +0172 0055 +0173 0055 +0174 0057 +0175 0057 +0176 0059 +0177 0059 +0178 0059 +0179 005A +017A 005A +017B 005A +017C 005A +017D 005A +017E 005A +017F 0053 +0183 0182 +0185 0184 +0188 0187 +018C 018B +0192 0191 +0195 01F6 +0199 0198 +01A0 004F +01A1 004F +01A3 01A2 +01A5 01A4 +01A8 01A7 +01AD 01AC +01AF 0055 +01B0 0055 +01B4 01B3 +01B6 01B5 +01B9 01B8 +01BD 01BC +01BF 01F7 +01C5 01C4 +01C6 01C4 +01C8 01C7 +01C9 01C7 +01CB 01CA +01CC 01CA +01CD 0041 +01CE 0041 +01CF 0049 +01D0 0049 +01D1 004F +01D2 004F +01D3 0055 +01D4 0055 +01D5 0055 +01D6 0055 +01D7 0055 +01D8 0055 +01D9 0055 +01DA 0055 +01DB 0055 +01DC 0055 +01DD 018E +01DE 0041 +01DF 0041 +01E0 0041 +01E1 0041 +01E2 00C6 +01E3 00C6 +01E5 01E4 +01E6 0047 +01E7 0047 +01E8 004B +01E9 004B +01EA 004F +01EB 004F +01EC 004F +01ED 004F +01EE 01B7 +01EF 01B7 +01F0 004A +01F2 01F1 +01F3 01F1 +01F4 0047 +01F5 0047 +01F8 004E +01F9 004E +01FA 0041 +01FB 0041 +01FC 00C6 +01FD 00C6 +01FE 00D8 +01FF 00D8 +0200 0041 +0201 0041 +0202 0041 +0203 0041 +0204 0045 +0205 0045 +0206 0045 +0207 0045 +0208 0049 +0209 0049 +020A 0049 +020B 0049 +020C 004F +020D 004F +020E 004F +020F 004F +0210 0052 +0211 0052 +0212 0052 +0213 0052 +0214 0055 +0215 0055 +0216 0055 +0217 0055 +0218 0053 +0219 0053 +021A 0054 +021B 0054 +021D 021C +021E 0048 +021F 0048 +0223 0222 +0225 0224 +0226 0041 +0227 0041 +0228 0045 +0229 0045 +022A 004F +022B 004F +022C 004F +022D 004F +022E 004F +022F 004F +0230 004F +0231 004F +0232 0059 +0233 0059 +0253 0181 +0254 0186 +0256 0189 +0257 018A +0259 018F +025B 0190 +0260 0193 +0263 0194 +0268 0197 +0269 0196 +026F 019C +0272 019D +0275 019F +0280 01A6 +0283 01A9 +0288 01AE +028A 01B1 +028B 01B2 +0292 01B7 +0345 0399 +0386 0391 +0388 0395 +0389 0397 +038A 0399 +038C 039F +038E 03A5 +038F 03A9 +0390 0399 +03AA 0399 +03AB 03A5 +03AC 0391 +03AD 0395 +03AE 0397 +03AF 0399 +03B0 03A5 +03B1 0391 +03B2 0392 +03B3 0393 +03B4 0394 +03B5 0395 +03B6 0396 +03B7 0397 +03B8 0398 +03B9 0399 +03BA 039A +03BB 039B +03BC 039C +03BD 039D +03BE 039E +03BF 039F +03C0 03A0 +03C1 03A1 +03C2 03A3 +03C3 03A3 +03C4 03A4 +03C5 03A5 +03C6 03A6 +03C7 03A7 +03C8 03A8 +03C9 03A9 +03CA 0399 +03CB 03A5 +03CC 039F +03CD 03A5 +03CE 03A9 +03D0 0392 +03D1 0398 +03D3 03D2 +03D4 03D2 +03D5 03A6 +03D6 03A0 +03DB 03DA +03DD 03DC +03DF 03DE +03E1 03E0 +03E3 03E2 +03E5 03E4 +03E7 03E6 +03E9 03E8 +03EB 03EA +03ED 03EC +03EF 03EE +03F0 039A +03F1 03A1 +03F2 03A3 +0400 0415 +0401 0415 +0403 0413 +0407 0406 +040C 041A +040D 0418 +040E 0423 +0430 0410 +0431 0411 +0432 0412 +0433 0413 +0434 0414 +0435 0415 +0436 0416 +0437 0417 +0438 0418 +0439 0419 +043A 041A +043B 041B +043C 041C +043D 041D +043E 041E +043F 041F +0440 0420 +0441 0421 +0442 0422 +0443 0423 +0444 0424 +0445 0425 +0446 0426 +0447 0427 +0448 0428 +0449 0429 +044A 042A +044B 042B +044C 042C +044D 042D +044E 042E +044F 042F +0450 0415 +0451 0415 +0452 0402 +0453 0413 +0454 0404 +0455 0405 +0456 0406 +0457 0406 +0458 0408 +0459 0409 +045A 040A +045B 040B +045C 041A +045D 0418 +045E 0423 +045F 040F +0461 0460 +0463 0462 +0465 0464 +0467 0466 +0469 0468 +046B 046A +046D 046C +046F 046E +0471 0470 +0473 0472 +0475 0474 +0476 0474 +0477 0474 +0479 0478 +047B 047A +047D 047C +047F 047E +0481 0480 +048D 048C +048F 048E +0491 0490 +0493 0492 +0495 0494 +0497 0496 +0499 0498 +049B 049A +049D 049C +049F 049E +04A1 04A0 +04A3 04A2 +04A5 04A4 +04A7 04A6 +04A9 04A8 +04AB 04AA +04AD 04AC +04AF 04AE +04B1 04B0 +04B3 04B2 +04B5 04B4 +04B7 04B6 +04B9 04B8 +04BB 04BA +04BD 04BC +04BF 04BE +04C1 0416 +04C2 0416 +04C4 04C3 +04C8 04C7 +04CC 04CB +04D0 0410 +04D1 0410 +04D2 0410 +04D3 0410 +04D5 04D4 +04D6 0415 +04D7 0415 +04D9 04D8 +04DA 04D8 +04DB 04D8 +04DC 0416 +04DD 0416 +04DE 0417 +04DF 0417 +04E1 04E0 +04E2 0418 +04E3 0418 +04E4 0418 +04E5 0418 +04E6 041E +04E7 041E +04E9 04E8 +04EA 04E8 +04EB 04E8 +04EC 042D +04ED 042D +04EE 0423 +04EF 0423 +04F0 0423 +04F1 0423 +04F2 0423 +04F3 0423 +04F4 0427 +04F5 0427 +04F8 042B +04F9 042B +0561 0531 +0562 0532 +0563 0533 +0564 0534 +0565 0535 +0566 0536 +0567 0537 +0568 0538 +0569 0539 +056A 053A +056B 053B +056C 053C +056D 053D +056E 053E +056F 053F +0570 0540 +0571 0541 +0572 0542 +0573 0543 +0574 0544 +0575 0545 +0576 0546 +0577 0547 +0578 0548 +0579 0549 +057A 054A +057B 054B +057C 054C +057D 054D +057E 054E +057F 054F +0580 0550 +0581 0551 +0582 0552 +0583 0553 +0584 0554 +0585 0555 +0586 0556 +1E00 0041 +1E01 0041 +1E02 0042 +1E03 0042 +1E04 0042 +1E05 0042 +1E06 0042 +1E07 0042 +1E08 0043 +1E09 0043 +1E0A 0044 +1E0B 0044 +1E0C 0044 +1E0D 0044 +1E0E 0044 +1E0F 0044 +1E10 0044 +1E11 0044 +1E12 0044 +1E13 0044 +1E14 0045 +1E15 0045 +1E16 0045 +1E17 0045 +1E18 0045 +1E19 0045 +1E1A 0045 +1E1B 0045 +1E1C 0045 +1E1D 0045 +1E1E 0046 +1E1F 0046 +1E20 0047 +1E21 0047 +1E22 0048 +1E23 0048 +1E24 0048 +1E25 0048 +1E26 0048 +1E27 0048 +1E28 0048 +1E29 0048 +1E2A 0048 +1E2B 0048 +1E2C 0049 +1E2D 0049 +1E2E 0049 +1E2F 0049 +1E30 004B +1E31 004B +1E32 004B +1E33 004B +1E34 004B +1E35 004B +1E36 004C +1E37 004C +1E38 004C +1E39 004C +1E3A 004C +1E3B 004C +1E3C 004C +1E3D 004C +1E3E 004D +1E3F 004D +1E40 004D +1E41 004D +1E42 004D +1E43 004D +1E44 004E +1E45 004E +1E46 004E +1E47 004E +1E48 004E +1E49 004E +1E4A 004E +1E4B 004E +1E4C 004F +1E4D 004F +1E4E 004F +1E4F 004F +1E50 004F +1E51 004F +1E52 004F +1E53 004F +1E54 0050 +1E55 0050 +1E56 0050 +1E57 0050 +1E58 0052 +1E59 0052 +1E5A 0052 +1E5B 0052 +1E5C 0052 +1E5D 0052 +1E5E 0052 +1E5F 0052 +1E60 0053 +1E61 0053 +1E62 0053 +1E63 0053 +1E64 0053 +1E65 0053 +1E66 0053 +1E67 0053 +1E68 0053 +1E69 0053 +1E6A 0054 +1E6B 0054 +1E6C 0054 +1E6D 0054 +1E6E 0054 +1E6F 0054 +1E70 0054 +1E71 0054 +1E72 0055 +1E73 0055 +1E74 0055 +1E75 0055 +1E76 0055 +1E77 0055 +1E78 0055 +1E79 0055 +1E7A 0055 +1E7B 0055 +1E7C 0056 +1E7D 0056 +1E7E 0056 +1E7F 0056 +1E80 0057 +1E81 0057 +1E82 0057 +1E83 0057 +1E84 0057 +1E85 0057 +1E86 0057 +1E87 0057 +1E88 0057 +1E89 0057 +1E8A 0058 +1E8B 0058 +1E8C 0058 +1E8D 0058 +1E8E 0059 +1E8F 0059 +1E90 005A +1E91 005A +1E92 005A +1E93 005A +1E94 005A +1E95 005A +1E96 0048 +1E97 0054 +1E98 0057 +1E99 0059 +1E9B 0053 +1EA0 0041 +1EA1 0041 +1EA2 0041 +1EA3 0041 +1EA4 0041 +1EA5 0041 +1EA6 0041 +1EA7 0041 +1EA8 0041 +1EA9 0041 +1EAA 0041 +1EAB 0041 +1EAC 0041 +1EAD 0041 +1EAE 0041 +1EAF 0041 +1EB0 0041 +1EB1 0041 +1EB2 0041 +1EB3 0041 +1EB4 0041 +1EB5 0041 +1EB6 0041 +1EB7 0041 +1EB8 0045 +1EB9 0045 +1EBA 0045 +1EBB 0045 +1EBC 0045 +1EBD 0045 +1EBE 0045 +1EBF 0045 +1EC0 0045 +1EC1 0045 +1EC2 0045 +1EC3 0045 +1EC4 0045 +1EC5 0045 +1EC6 0045 +1EC7 0045 +1EC8 0049 +1EC9 0049 +1ECA 0049 +1ECB 0049 +1ECC 004F +1ECD 004F +1ECE 004F +1ECF 004F +1ED0 004F +1ED1 004F +1ED2 004F +1ED3 004F +1ED4 004F +1ED5 004F +1ED6 004F +1ED7 004F +1ED8 004F +1ED9 004F +1EDA 004F +1EDB 004F +1EDC 004F +1EDD 004F +1EDE 004F +1EDF 004F +1EE0 004F +1EE1 004F +1EE2 004F +1EE3 004F +1EE4 0055 +1EE5 0055 +1EE6 0055 +1EE7 0055 +1EE8 0055 +1EE9 0055 +1EEA 0055 +1EEB 0055 +1EEC 0055 +1EED 0055 +1EEE 0055 +1EEF 0055 +1EF0 0055 +1EF1 0055 +1EF2 0059 +1EF3 0059 +1EF4 0059 +1EF5 0059 +1EF6 0059 +1EF7 0059 +1EF8 0059 +1EF9 0059 +1F00 0391 +1F01 0391 +1F02 0391 +1F03 0391 +1F04 0391 +1F05 0391 +1F06 0391 +1F07 0391 +1F08 0391 +1F09 0391 +1F0A 0391 +1F0B 0391 +1F0C 0391 +1F0D 0391 +1F0E 0391 +1F0F 0391 +1F10 0395 +1F11 0395 +1F12 0395 +1F13 0395 +1F14 0395 +1F15 0395 +1F18 0395 +1F19 0395 +1F1A 0395 +1F1B 0395 +1F1C 0395 +1F1D 0395 +1F20 0397 +1F21 0397 +1F22 0397 +1F23 0397 +1F24 0397 +1F25 0397 +1F26 0397 +1F27 0397 +1F28 0397 +1F29 0397 +1F2A 0397 +1F2B 0397 +1F2C 0397 +1F2D 0397 +1F2E 0397 +1F2F 0397 +1F30 0399 +1F31 0399 +1F32 0399 +1F33 0399 +1F34 0399 +1F35 0399 +1F36 0399 +1F37 0399 +1F38 0399 +1F39 0399 +1F3A 0399 +1F3B 0399 +1F3C 0399 +1F3D 0399 +1F3E 0399 +1F3F 0399 +1F40 039F +1F41 039F +1F42 039F +1F43 039F +1F44 039F +1F45 039F +1F48 039F +1F49 039F +1F4A 039F +1F4B 039F +1F4C 039F +1F4D 039F +1F50 03A5 +1F51 03A5 +1F52 03A5 +1F53 03A5 +1F54 03A5 +1F55 03A5 +1F56 03A5 +1F57 03A5 +1F59 03A5 +1F5B 03A5 +1F5D 03A5 +1F5F 03A5 +1F60 03A9 +1F61 03A9 +1F62 03A9 +1F63 03A9 +1F64 03A9 +1F65 03A9 +1F66 03A9 +1F67 03A9 +1F68 03A9 +1F69 03A9 +1F6A 03A9 +1F6B 03A9 +1F6C 03A9 +1F6D 03A9 +1F6E 03A9 +1F6F 03A9 +1F70 0391 +1F71 1FBB +1F72 0395 +1F73 1FC9 +1F74 0397 +1F75 1FCB +1F76 0399 +1F77 1FDB +1F78 039F +1F79 1FF9 +1F7A 03A5 +1F7B 1FEB +1F7C 03A9 +1F7D 1FFB +1F80 0391 +1F81 0391 +1F82 0391 +1F83 0391 +1F84 0391 +1F85 0391 +1F86 0391 +1F87 0391 +1F88 0391 +1F89 0391 +1F8A 0391 +1F8B 0391 +1F8C 0391 +1F8D 0391 +1F8E 0391 +1F8F 0391 +1F90 0397 +1F91 0397 +1F92 0397 +1F93 0397 +1F94 0397 +1F95 0397 +1F96 0397 +1F97 0397 +1F98 0397 +1F99 0397 +1F9A 0397 +1F9B 0397 +1F9C 0397 +1F9D 0397 +1F9E 0397 +1F9F 0397 +1FA0 03A9 +1FA1 03A9 +1FA2 03A9 +1FA3 03A9 +1FA4 03A9 +1FA5 03A9 +1FA6 03A9 +1FA7 03A9 +1FA8 03A9 +1FA9 03A9 +1FAA 03A9 +1FAB 03A9 +1FAC 03A9 +1FAD 03A9 +1FAE 03A9 +1FAF 03A9 +1FB0 0391 +1FB1 0391 +1FB2 0391 +1FB3 0391 +1FB4 0391 +1FB6 0391 +1FB7 0391 +1FB8 0391 +1FB9 0391 +1FBA 0391 +1FBC 0391 +1FBE 0399 +1FC2 0397 +1FC3 0397 +1FC4 0397 +1FC6 0397 +1FC7 0397 +1FC8 0395 +1FCA 0397 +1FCC 0397 +1FD0 0399 +1FD1 0399 +1FD2 0399 +1FD6 0399 +1FD7 0399 +1FD8 0399 +1FD9 0399 +1FDA 0399 +1FE0 03A5 +1FE1 03A5 +1FE2 03A5 +1FE4 03A1 +1FE5 03A1 +1FE6 03A5 +1FE7 03A5 +1FE8 03A5 +1FE9 03A5 +1FEA 03A5 +1FEC 03A1 +1FF2 03A9 +1FF3 03A9 +1FF4 03A9 +1FF6 03A9 +1FF7 03A9 +1FF8 039F +1FFA 03A9 +1FFC 03A9 +2170 2160 +2171 2161 +2172 2162 +2173 2163 +2174 2164 +2175 2165 +2176 2166 +2177 2167 +2178 2168 +2179 2169 +217A 216A +217B 216B +217C 216C +217D 216D +217E 216E +217F 216F +24D0 24B6 +24D1 24B7 +24D2 24B8 +24D3 24B9 +24D4 24BA +24D5 24BB +24D6 24BC +24D7 24BD +24D8 24BE +24D9 24BF +24DA 24C0 +24DB 24C1 +24DC 24C2 +24DD 24C3 +24DE 24C4 +24DF 24C5 +24E0 24C6 +24E1 24C7 +24E2 24C8 +24E3 24C9 +24E4 24CA +24E5 24CB +24E6 24CC +24E7 24CD +24E8 24CE +24E9 24CF +FF41 FF21 +FF42 FF22 +FF43 FF23 +FF44 FF24 +FF45 FF25 +FF46 FF26 +FF47 FF27 +FF48 FF28 +FF49 FF29 +FF4A FF2A +FF4B FF2B +FF4C FF2C +FF4D FF2D +FF4E FF2E +FF4F FF2F +FF50 FF30 +FF51 FF31 +FF52 FF32 +FF53 FF33 +FF54 FF34 +FF55 FF35 +FF56 FF36 +FF57 FF37 +FF58 FF38 +FF59 FF39 +FF5A FF3A +DROP VIEW v_bmp; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_ucs2_general_ci_ws.test b/mysql-test/main/ctype_ucs2_general_ci_ws.test new file mode 100644 index 0000000000000..12606b049e5c4 --- /dev/null +++ b/mysql-test/main/ctype_ucs2_general_ci_ws.test @@ -0,0 +1,14 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET @@collation_connection=ucs2_general_ci; +--source include/ctype_unicode_ws_bmp.inc + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/ctype_ucs2_general_mysql500_ci_casefold.result b/mysql-test/main/ctype_ucs2_general_mysql500_ci_casefold.result new file mode 100644 index 0000000000000..f4b163429dc5b --- /dev/null +++ b/mysql-test/main/ctype_ucs2_general_mysql500_ci_casefold.result @@ -0,0 +1,1427 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET @@collation_connection=ucs2_general_mysql500_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +ucs2_general_mysql500_ci +SELECT +codepoint_hex4, +HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)), +HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +FROM v_bmp +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); +codepoint_hex4 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +0041 0061 0041 +0042 0062 0042 +0043 0063 0043 +0044 0064 0044 +0045 0065 0045 +0046 0066 0046 +0047 0067 0047 +0048 0068 0048 +0049 0069 0049 +004A 006A 004A +004B 006B 004B +004C 006C 004C +004D 006D 004D +004E 006E 004E +004F 006F 004F +0050 0070 0050 +0051 0071 0051 +0052 0072 0052 +0053 0073 0053 +0054 0074 0054 +0055 0075 0055 +0056 0076 0056 +0057 0077 0057 +0058 0078 0058 +0059 0079 0059 +005A 007A 005A +0061 0061 0041 +0062 0062 0042 +0063 0063 0043 +0064 0064 0044 +0065 0065 0045 +0066 0066 0046 +0067 0067 0047 +0068 0068 0048 +0069 0069 0049 +006A 006A 004A +006B 006B 004B +006C 006C 004C +006D 006D 004D +006E 006E 004E +006F 006F 004F +0070 0070 0050 +0071 0071 0051 +0072 0072 0052 +0073 0073 0053 +0074 0074 0054 +0075 0075 0055 +0076 0076 0056 +0077 0077 0057 +0078 0078 0058 +0079 0079 0059 +007A 007A 005A +00B5 00B5 039C +00C0 00E0 00C0 +00C1 00E1 00C1 +00C2 00E2 00C2 +00C3 00E3 00C3 +00C4 00E4 00C4 +00C5 00E5 00C5 +00C6 00E6 00C6 +00C7 00E7 00C7 +00C8 00E8 00C8 +00C9 00E9 00C9 +00CA 00EA 00CA +00CB 00EB 00CB +00CC 00EC 00CC +00CD 00ED 00CD +00CE 00EE 00CE +00CF 00EF 00CF +00D0 00F0 00D0 +00D1 00F1 00D1 +00D2 00F2 00D2 +00D3 00F3 00D3 +00D4 00F4 00D4 +00D5 00F5 00D5 +00D6 00F6 00D6 +00D8 00F8 00D8 +00D9 00F9 00D9 +00DA 00FA 00DA +00DB 00FB 00DB +00DC 00FC 00DC +00DD 00FD 00DD +00DE 00FE 00DE +00E0 00E0 00C0 +00E1 00E1 00C1 +00E2 00E2 00C2 +00E3 00E3 00C3 +00E4 00E4 00C4 +00E5 00E5 00C5 +00E6 00E6 00C6 +00E7 00E7 00C7 +00E8 00E8 00C8 +00E9 00E9 00C9 +00EA 00EA 00CA +00EB 00EB 00CB +00EC 00EC 00CC +00ED 00ED 00CD +00EE 00EE 00CE +00EF 00EF 00CF +00F0 00F0 00D0 +00F1 00F1 00D1 +00F2 00F2 00D2 +00F3 00F3 00D3 +00F4 00F4 00D4 +00F5 00F5 00D5 +00F6 00F6 00D6 +00F8 00F8 00D8 +00F9 00F9 00D9 +00FA 00FA 00DA +00FB 00FB 00DB +00FC 00FC 00DC +00FD 00FD 00DD +00FE 00FE 00DE +00FF 00FF 0178 +0100 0101 0100 +0101 0101 0100 +0102 0103 0102 +0103 0103 0102 +0104 0105 0104 +0105 0105 0104 +0106 0107 0106 +0107 0107 0106 +0108 0109 0108 +0109 0109 0108 +010A 010B 010A +010B 010B 010A +010C 010D 010C +010D 010D 010C +010E 010F 010E +010F 010F 010E +0110 0111 0110 +0111 0111 0110 +0112 0113 0112 +0113 0113 0112 +0114 0115 0114 +0115 0115 0114 +0116 0117 0116 +0117 0117 0116 +0118 0119 0118 +0119 0119 0118 +011A 011B 011A +011B 011B 011A +011C 011D 011C +011D 011D 011C +011E 011F 011E +011F 011F 011E +0120 0121 0120 +0121 0121 0120 +0122 0123 0122 +0123 0123 0122 +0124 0125 0124 +0125 0125 0124 +0126 0127 0126 +0127 0127 0126 +0128 0129 0128 +0129 0129 0128 +012A 012B 012A +012B 012B 012A +012C 012D 012C +012D 012D 012C +012E 012F 012E +012F 012F 012E +0130 0069 0130 +0131 0131 0049 +0132 0133 0132 +0133 0133 0132 +0134 0135 0134 +0135 0135 0134 +0136 0137 0136 +0137 0137 0136 +0139 013A 0139 +013A 013A 0139 +013B 013C 013B +013C 013C 013B +013D 013E 013D +013E 013E 013D +013F 0140 013F +0140 0140 013F +0141 0142 0141 +0142 0142 0141 +0143 0144 0143 +0144 0144 0143 +0145 0146 0145 +0146 0146 0145 +0147 0148 0147 +0148 0148 0147 +014A 014B 014A +014B 014B 014A +014C 014D 014C +014D 014D 014C +014E 014F 014E +014F 014F 014E +0150 0151 0150 +0151 0151 0150 +0152 0153 0152 +0153 0153 0152 +0154 0155 0154 +0155 0155 0154 +0156 0157 0156 +0157 0157 0156 +0158 0159 0158 +0159 0159 0158 +015A 015B 015A +015B 015B 015A +015C 015D 015C +015D 015D 015C +015E 015F 015E +015F 015F 015E +0160 0161 0160 +0161 0161 0160 +0162 0163 0162 +0163 0163 0162 +0164 0165 0164 +0165 0165 0164 +0166 0167 0166 +0167 0167 0166 +0168 0169 0168 +0169 0169 0168 +016A 016B 016A +016B 016B 016A +016C 016D 016C +016D 016D 016C +016E 016F 016E +016F 016F 016E +0170 0171 0170 +0171 0171 0170 +0172 0173 0172 +0173 0173 0172 +0174 0175 0174 +0175 0175 0174 +0176 0177 0176 +0177 0177 0176 +0178 00FF 0178 +0179 017A 0179 +017A 017A 0179 +017B 017C 017B +017C 017C 017B +017D 017E 017D +017E 017E 017D +017F 017F 0053 +0181 0253 0181 +0182 0183 0182 +0183 0183 0182 +0184 0185 0184 +0185 0185 0184 +0186 0254 0186 +0187 0188 0187 +0188 0188 0187 +0189 0256 0189 +018A 0257 018A +018B 018C 018B +018C 018C 018B +018E 01DD 018E +018F 0259 018F +0190 025B 0190 +0191 0192 0191 +0192 0192 0191 +0193 0260 0193 +0194 0263 0194 +0195 0195 01F6 +0196 0269 0196 +0197 0268 0197 +0198 0199 0198 +0199 0199 0198 +019C 026F 019C +019D 0272 019D +019F 0275 019F +01A0 01A1 01A0 +01A1 01A1 01A0 +01A2 01A3 01A2 +01A3 01A3 01A2 +01A4 01A5 01A4 +01A5 01A5 01A4 +01A6 0280 01A6 +01A7 01A8 01A7 +01A8 01A8 01A7 +01A9 0283 01A9 +01AC 01AD 01AC +01AD 01AD 01AC +01AE 0288 01AE +01AF 01B0 01AF +01B0 01B0 01AF +01B1 028A 01B1 +01B2 028B 01B2 +01B3 01B4 01B3 +01B4 01B4 01B3 +01B5 01B6 01B5 +01B6 01B6 01B5 +01B7 0292 01B7 +01B8 01B9 01B8 +01B9 01B9 01B8 +01BC 01BD 01BC +01BD 01BD 01BC +01BF 01BF 01F7 +01C4 01C6 01C4 +01C5 01C6 01C4 +01C6 01C6 01C4 +01C7 01C9 01C7 +01C8 01C9 01C7 +01C9 01C9 01C7 +01CA 01CC 01CA +01CB 01CC 01CA +01CC 01CC 01CA +01CD 01CE 01CD +01CE 01CE 01CD +01CF 01D0 01CF +01D0 01D0 01CF +01D1 01D2 01D1 +01D2 01D2 01D1 +01D3 01D4 01D3 +01D4 01D4 01D3 +01D5 01D6 01D5 +01D6 01D6 01D5 +01D7 01D8 01D7 +01D8 01D8 01D7 +01D9 01DA 01D9 +01DA 01DA 01D9 +01DB 01DC 01DB +01DC 01DC 01DB +01DD 01DD 018E +01DE 01DF 01DE +01DF 01DF 01DE +01E0 01E1 01E0 +01E1 01E1 01E0 +01E2 01E3 01E2 +01E3 01E3 01E2 +01E4 01E5 01E4 +01E5 01E5 01E4 +01E6 01E7 01E6 +01E7 01E7 01E6 +01E8 01E9 01E8 +01E9 01E9 01E8 +01EA 01EB 01EA +01EB 01EB 01EA +01EC 01ED 01EC +01ED 01ED 01EC +01EE 01EF 01EE +01EF 01EF 01EE +01F1 01F3 01F1 +01F2 01F3 01F1 +01F3 01F3 01F1 +01F4 01F5 01F4 +01F5 01F5 01F4 +01F6 0195 01F6 +01F7 01BF 01F7 +01F8 01F9 01F8 +01F9 01F9 01F8 +01FA 01FB 01FA +01FB 01FB 01FA +01FC 01FD 01FC +01FD 01FD 01FC +01FE 01FF 01FE +01FF 01FF 01FE +0200 0201 0200 +0201 0201 0200 +0202 0203 0202 +0203 0203 0202 +0204 0205 0204 +0205 0205 0204 +0206 0207 0206 +0207 0207 0206 +0208 0209 0208 +0209 0209 0208 +020A 020B 020A +020B 020B 020A +020C 020D 020C +020D 020D 020C +020E 020F 020E +020F 020F 020E +0210 0211 0210 +0211 0211 0210 +0212 0213 0212 +0213 0213 0212 +0214 0215 0214 +0215 0215 0214 +0216 0217 0216 +0217 0217 0216 +0218 0219 0218 +0219 0219 0218 +021A 021B 021A +021B 021B 021A +021C 021D 021C +021D 021D 021C +021E 021F 021E +021F 021F 021E +0222 0223 0222 +0223 0223 0222 +0224 0225 0224 +0225 0225 0224 +0226 0227 0226 +0227 0227 0226 +0228 0229 0228 +0229 0229 0228 +022A 022B 022A +022B 022B 022A +022C 022D 022C +022D 022D 022C +022E 022F 022E +022F 022F 022E +0230 0231 0230 +0231 0231 0230 +0232 0233 0232 +0233 0233 0232 +0253 0253 0181 +0254 0254 0186 +0256 0256 0189 +0257 0257 018A +0259 0259 018F +025B 025B 0190 +0260 0260 0193 +0263 0263 0194 +0268 0268 0197 +0269 0269 0196 +026F 026F 019C +0272 0272 019D +0275 0275 019F +0280 0280 01A6 +0283 0283 01A9 +0288 0288 01AE +028A 028A 01B1 +028B 028B 01B2 +0292 0292 01B7 +0345 0345 0399 +0386 03AC 0386 +0388 03AD 0388 +0389 03AE 0389 +038A 03AF 038A +038C 03CC 038C +038E 03CD 038E +038F 03CE 038F +0391 03B1 0391 +0392 03B2 0392 +0393 03B3 0393 +0394 03B4 0394 +0395 03B5 0395 +0396 03B6 0396 +0397 03B7 0397 +0398 03B8 0398 +0399 03B9 0399 +039A 03BA 039A +039B 03BB 039B +039C 03BC 039C +039D 03BD 039D +039E 03BE 039E +039F 03BF 039F +03A0 03C0 03A0 +03A1 03C1 03A1 +03A3 03C3 03A3 +03A4 03C4 03A4 +03A5 03C5 03A5 +03A6 03C6 03A6 +03A7 03C7 03A7 +03A8 03C8 03A8 +03A9 03C9 03A9 +03AA 03CA 03AA +03AB 03CB 03AB +03AC 03AC 0386 +03AD 03AD 0388 +03AE 03AE 0389 +03AF 03AF 038A +03B1 03B1 0391 +03B2 03B2 0392 +03B3 03B3 0393 +03B4 03B4 0394 +03B5 03B5 0395 +03B6 03B6 0396 +03B7 03B7 0397 +03B8 03B8 0398 +03B9 03B9 0399 +03BA 03BA 039A +03BB 03BB 039B +03BC 03BC 039C +03BD 03BD 039D +03BE 03BE 039E +03BF 03BF 039F +03C0 03C0 03A0 +03C1 03C1 03A1 +03C2 03C2 03A3 +03C3 03C3 03A3 +03C4 03C4 03A4 +03C5 03C5 03A5 +03C6 03C6 03A6 +03C7 03C7 03A7 +03C8 03C8 03A8 +03C9 03C9 03A9 +03CA 03CA 03AA +03CB 03CB 03AB +03CC 03CC 038C +03CD 03CD 038E +03CE 03CE 038F +03D0 03D0 0392 +03D1 03D1 0398 +03D5 03D5 03A6 +03D6 03D6 03A0 +03DA 03DB 03DA +03DB 03DB 03DA +03DC 03DD 03DC +03DD 03DD 03DC +03DE 03DF 03DE +03DF 03DF 03DE +03E0 03E1 03E0 +03E1 03E1 03E0 +03E2 03E3 03E2 +03E3 03E3 03E2 +03E4 03E5 03E4 +03E5 03E5 03E4 +03E6 03E7 03E6 +03E7 03E7 03E6 +03E8 03E9 03E8 +03E9 03E9 03E8 +03EA 03EB 03EA +03EB 03EB 03EA +03EC 03ED 03EC +03ED 03ED 03EC +03EE 03EF 03EE +03EF 03EF 03EE +03F0 03F0 039A +03F1 03F1 03A1 +03F2 03F2 03A3 +0400 0450 0400 +0401 0451 0401 +0402 0452 0402 +0403 0453 0403 +0404 0454 0404 +0405 0455 0405 +0406 0456 0406 +0407 0457 0407 +0408 0458 0408 +0409 0459 0409 +040A 045A 040A +040B 045B 040B +040C 045C 040C +040D 045D 040D +040E 045E 040E +040F 045F 040F +0410 0430 0410 +0411 0431 0411 +0412 0432 0412 +0413 0433 0413 +0414 0434 0414 +0415 0435 0415 +0416 0436 0416 +0417 0437 0417 +0418 0438 0418 +0419 0439 0419 +041A 043A 041A +041B 043B 041B +041C 043C 041C +041D 043D 041D +041E 043E 041E +041F 043F 041F +0420 0440 0420 +0421 0441 0421 +0422 0442 0422 +0423 0443 0423 +0424 0444 0424 +0425 0445 0425 +0426 0446 0426 +0427 0447 0427 +0428 0448 0428 +0429 0449 0429 +042A 044A 042A +042B 044B 042B +042C 044C 042C +042D 044D 042D +042E 044E 042E +042F 044F 042F +0430 0430 0410 +0431 0431 0411 +0432 0432 0412 +0433 0433 0413 +0434 0434 0414 +0435 0435 0415 +0436 0436 0416 +0437 0437 0417 +0438 0438 0418 +0439 0439 0419 +043A 043A 041A +043B 043B 041B +043C 043C 041C +043D 043D 041D +043E 043E 041E +043F 043F 041F +0440 0440 0420 +0441 0441 0421 +0442 0442 0422 +0443 0443 0423 +0444 0444 0424 +0445 0445 0425 +0446 0446 0426 +0447 0447 0427 +0448 0448 0428 +0449 0449 0429 +044A 044A 042A +044B 044B 042B +044C 044C 042C +044D 044D 042D +044E 044E 042E +044F 044F 042F +0450 0450 0400 +0451 0451 0401 +0452 0452 0402 +0453 0453 0403 +0454 0454 0404 +0455 0455 0405 +0456 0456 0406 +0457 0457 0407 +0458 0458 0408 +0459 0459 0409 +045A 045A 040A +045B 045B 040B +045C 045C 040C +045D 045D 040D +045E 045E 040E +045F 045F 040F +0460 0461 0460 +0461 0461 0460 +0462 0463 0462 +0463 0463 0462 +0464 0465 0464 +0465 0465 0464 +0466 0467 0466 +0467 0467 0466 +0468 0469 0468 +0469 0469 0468 +046A 046B 046A +046B 046B 046A +046C 046D 046C +046D 046D 046C +046E 046F 046E +046F 046F 046E +0470 0471 0470 +0471 0471 0470 +0472 0473 0472 +0473 0473 0472 +0474 0475 0474 +0475 0475 0474 +0476 0477 0476 +0477 0477 0476 +0478 0479 0478 +0479 0479 0478 +047A 047B 047A +047B 047B 047A +047C 047D 047C +047D 047D 047C +047E 047F 047E +047F 047F 047E +0480 0481 0480 +0481 0481 0480 +048C 048D 048C +048D 048D 048C +048E 048F 048E +048F 048F 048E +0490 0491 0490 +0491 0491 0490 +0492 0493 0492 +0493 0493 0492 +0494 0495 0494 +0495 0495 0494 +0496 0497 0496 +0497 0497 0496 +0498 0499 0498 +0499 0499 0498 +049A 049B 049A +049B 049B 049A +049C 049D 049C +049D 049D 049C +049E 049F 049E +049F 049F 049E +04A0 04A1 04A0 +04A1 04A1 04A0 +04A2 04A3 04A2 +04A3 04A3 04A2 +04A4 04A5 04A4 +04A5 04A5 04A4 +04A6 04A7 04A6 +04A7 04A7 04A6 +04A8 04A9 04A8 +04A9 04A9 04A8 +04AA 04AB 04AA +04AB 04AB 04AA +04AC 04AD 04AC +04AD 04AD 04AC +04AE 04AF 04AE +04AF 04AF 04AE +04B0 04B1 04B0 +04B1 04B1 04B0 +04B2 04B3 04B2 +04B3 04B3 04B2 +04B4 04B5 04B4 +04B5 04B5 04B4 +04B6 04B7 04B6 +04B7 04B7 04B6 +04B8 04B9 04B8 +04B9 04B9 04B8 +04BA 04BB 04BA +04BB 04BB 04BA +04BC 04BD 04BC +04BD 04BD 04BC +04BE 04BF 04BE +04BF 04BF 04BE +04C1 04C2 04C1 +04C2 04C2 04C1 +04C3 04C4 04C3 +04C4 04C4 04C3 +04C7 04C8 04C7 +04C8 04C8 04C7 +04CB 04CC 04CB +04CC 04CC 04CB +04D0 04D1 04D0 +04D1 04D1 04D0 +04D2 04D3 04D2 +04D3 04D3 04D2 +04D4 04D5 04D4 +04D5 04D5 04D4 +04D6 04D7 04D6 +04D7 04D7 04D6 +04D8 04D9 04D8 +04D9 04D9 04D8 +04DA 04DB 04DA +04DB 04DB 04DA +04DC 04DD 04DC +04DD 04DD 04DC +04DE 04DF 04DE +04DF 04DF 04DE +04E0 04E1 04E0 +04E1 04E1 04E0 +04E2 04E3 04E2 +04E3 04E3 04E2 +04E4 04E5 04E4 +04E5 04E5 04E4 +04E6 04E7 04E6 +04E7 04E7 04E6 +04E8 04E9 04E8 +04E9 04E9 04E8 +04EA 04EB 04EA +04EB 04EB 04EA +04EC 04ED 04EC +04ED 04ED 04EC +04EE 04EF 04EE +04EF 04EF 04EE +04F0 04F1 04F0 +04F1 04F1 04F0 +04F2 04F3 04F2 +04F3 04F3 04F2 +04F4 04F5 04F4 +04F5 04F5 04F4 +04F8 04F9 04F8 +04F9 04F9 04F8 +0531 0561 0531 +0532 0562 0532 +0533 0563 0533 +0534 0564 0534 +0535 0565 0535 +0536 0566 0536 +0537 0567 0537 +0538 0568 0538 +0539 0569 0539 +053A 056A 053A +053B 056B 053B +053C 056C 053C +053D 056D 053D +053E 056E 053E +053F 056F 053F +0540 0570 0540 +0541 0571 0541 +0542 0572 0542 +0543 0573 0543 +0544 0574 0544 +0545 0575 0545 +0546 0576 0546 +0547 0577 0547 +0548 0578 0548 +0549 0579 0549 +054A 057A 054A +054B 057B 054B +054C 057C 054C +054D 057D 054D +054E 057E 054E +054F 057F 054F +0550 0580 0550 +0551 0581 0551 +0552 0582 0552 +0553 0583 0553 +0554 0584 0554 +0555 0585 0555 +0556 0586 0556 +0561 0561 0531 +0562 0562 0532 +0563 0563 0533 +0564 0564 0534 +0565 0565 0535 +0566 0566 0536 +0567 0567 0537 +0568 0568 0538 +0569 0569 0539 +056A 056A 053A +056B 056B 053B +056C 056C 053C +056D 056D 053D +056E 056E 053E +056F 056F 053F +0570 0570 0540 +0571 0571 0541 +0572 0572 0542 +0573 0573 0543 +0574 0574 0544 +0575 0575 0545 +0576 0576 0546 +0577 0577 0547 +0578 0578 0548 +0579 0579 0549 +057A 057A 054A +057B 057B 054B +057C 057C 054C +057D 057D 054D +057E 057E 054E +057F 057F 054F +0580 0580 0550 +0581 0581 0551 +0582 0582 0552 +0583 0583 0553 +0584 0584 0554 +0585 0585 0555 +0586 0586 0556 +1E00 1E01 1E00 +1E01 1E01 1E00 +1E02 1E03 1E02 +1E03 1E03 1E02 +1E04 1E05 1E04 +1E05 1E05 1E04 +1E06 1E07 1E06 +1E07 1E07 1E06 +1E08 1E09 1E08 +1E09 1E09 1E08 +1E0A 1E0B 1E0A +1E0B 1E0B 1E0A +1E0C 1E0D 1E0C +1E0D 1E0D 1E0C +1E0E 1E0F 1E0E +1E0F 1E0F 1E0E +1E10 1E11 1E10 +1E11 1E11 1E10 +1E12 1E13 1E12 +1E13 1E13 1E12 +1E14 1E15 1E14 +1E15 1E15 1E14 +1E16 1E17 1E16 +1E17 1E17 1E16 +1E18 1E19 1E18 +1E19 1E19 1E18 +1E1A 1E1B 1E1A +1E1B 1E1B 1E1A +1E1C 1E1D 1E1C +1E1D 1E1D 1E1C +1E1E 1E1F 1E1E +1E1F 1E1F 1E1E +1E20 1E21 1E20 +1E21 1E21 1E20 +1E22 1E23 1E22 +1E23 1E23 1E22 +1E24 1E25 1E24 +1E25 1E25 1E24 +1E26 1E27 1E26 +1E27 1E27 1E26 +1E28 1E29 1E28 +1E29 1E29 1E28 +1E2A 1E2B 1E2A +1E2B 1E2B 1E2A +1E2C 1E2D 1E2C +1E2D 1E2D 1E2C +1E2E 1E2F 1E2E +1E2F 1E2F 1E2E +1E30 1E31 1E30 +1E31 1E31 1E30 +1E32 1E33 1E32 +1E33 1E33 1E32 +1E34 1E35 1E34 +1E35 1E35 1E34 +1E36 1E37 1E36 +1E37 1E37 1E36 +1E38 1E39 1E38 +1E39 1E39 1E38 +1E3A 1E3B 1E3A +1E3B 1E3B 1E3A +1E3C 1E3D 1E3C +1E3D 1E3D 1E3C +1E3E 1E3F 1E3E +1E3F 1E3F 1E3E +1E40 1E41 1E40 +1E41 1E41 1E40 +1E42 1E43 1E42 +1E43 1E43 1E42 +1E44 1E45 1E44 +1E45 1E45 1E44 +1E46 1E47 1E46 +1E47 1E47 1E46 +1E48 1E49 1E48 +1E49 1E49 1E48 +1E4A 1E4B 1E4A +1E4B 1E4B 1E4A +1E4C 1E4D 1E4C +1E4D 1E4D 1E4C +1E4E 1E4F 1E4E +1E4F 1E4F 1E4E +1E50 1E51 1E50 +1E51 1E51 1E50 +1E52 1E53 1E52 +1E53 1E53 1E52 +1E54 1E55 1E54 +1E55 1E55 1E54 +1E56 1E57 1E56 +1E57 1E57 1E56 +1E58 1E59 1E58 +1E59 1E59 1E58 +1E5A 1E5B 1E5A +1E5B 1E5B 1E5A +1E5C 1E5D 1E5C +1E5D 1E5D 1E5C +1E5E 1E5F 1E5E +1E5F 1E5F 1E5E +1E60 1E61 1E60 +1E61 1E61 1E60 +1E62 1E63 1E62 +1E63 1E63 1E62 +1E64 1E65 1E64 +1E65 1E65 1E64 +1E66 1E67 1E66 +1E67 1E67 1E66 +1E68 1E69 1E68 +1E69 1E69 1E68 +1E6A 1E6B 1E6A +1E6B 1E6B 1E6A +1E6C 1E6D 1E6C +1E6D 1E6D 1E6C +1E6E 1E6F 1E6E +1E6F 1E6F 1E6E +1E70 1E71 1E70 +1E71 1E71 1E70 +1E72 1E73 1E72 +1E73 1E73 1E72 +1E74 1E75 1E74 +1E75 1E75 1E74 +1E76 1E77 1E76 +1E77 1E77 1E76 +1E78 1E79 1E78 +1E79 1E79 1E78 +1E7A 1E7B 1E7A +1E7B 1E7B 1E7A +1E7C 1E7D 1E7C +1E7D 1E7D 1E7C +1E7E 1E7F 1E7E +1E7F 1E7F 1E7E +1E80 1E81 1E80 +1E81 1E81 1E80 +1E82 1E83 1E82 +1E83 1E83 1E82 +1E84 1E85 1E84 +1E85 1E85 1E84 +1E86 1E87 1E86 +1E87 1E87 1E86 +1E88 1E89 1E88 +1E89 1E89 1E88 +1E8A 1E8B 1E8A +1E8B 1E8B 1E8A +1E8C 1E8D 1E8C +1E8D 1E8D 1E8C +1E8E 1E8F 1E8E +1E8F 1E8F 1E8E +1E90 1E91 1E90 +1E91 1E91 1E90 +1E92 1E93 1E92 +1E93 1E93 1E92 +1E94 1E95 1E94 +1E95 1E95 1E94 +1E9B 1E9B 1E60 +1EA0 1EA1 1EA0 +1EA1 1EA1 1EA0 +1EA2 1EA3 1EA2 +1EA3 1EA3 1EA2 +1EA4 1EA5 1EA4 +1EA5 1EA5 1EA4 +1EA6 1EA7 1EA6 +1EA7 1EA7 1EA6 +1EA8 1EA9 1EA8 +1EA9 1EA9 1EA8 +1EAA 1EAB 1EAA +1EAB 1EAB 1EAA +1EAC 1EAD 1EAC +1EAD 1EAD 1EAC +1EAE 1EAF 1EAE +1EAF 1EAF 1EAE +1EB0 1EB1 1EB0 +1EB1 1EB1 1EB0 +1EB2 1EB3 1EB2 +1EB3 1EB3 1EB2 +1EB4 1EB5 1EB4 +1EB5 1EB5 1EB4 +1EB6 1EB7 1EB6 +1EB7 1EB7 1EB6 +1EB8 1EB9 1EB8 +1EB9 1EB9 1EB8 +1EBA 1EBB 1EBA +1EBB 1EBB 1EBA +1EBC 1EBD 1EBC +1EBD 1EBD 1EBC +1EBE 1EBF 1EBE +1EBF 1EBF 1EBE +1EC0 1EC1 1EC0 +1EC1 1EC1 1EC0 +1EC2 1EC3 1EC2 +1EC3 1EC3 1EC2 +1EC4 1EC5 1EC4 +1EC5 1EC5 1EC4 +1EC6 1EC7 1EC6 +1EC7 1EC7 1EC6 +1EC8 1EC9 1EC8 +1EC9 1EC9 1EC8 +1ECA 1ECB 1ECA +1ECB 1ECB 1ECA +1ECC 1ECD 1ECC +1ECD 1ECD 1ECC +1ECE 1ECF 1ECE +1ECF 1ECF 1ECE +1ED0 1ED1 1ED0 +1ED1 1ED1 1ED0 +1ED2 1ED3 1ED2 +1ED3 1ED3 1ED2 +1ED4 1ED5 1ED4 +1ED5 1ED5 1ED4 +1ED6 1ED7 1ED6 +1ED7 1ED7 1ED6 +1ED8 1ED9 1ED8 +1ED9 1ED9 1ED8 +1EDA 1EDB 1EDA +1EDB 1EDB 1EDA +1EDC 1EDD 1EDC +1EDD 1EDD 1EDC +1EDE 1EDF 1EDE +1EDF 1EDF 1EDE +1EE0 1EE1 1EE0 +1EE1 1EE1 1EE0 +1EE2 1EE3 1EE2 +1EE3 1EE3 1EE2 +1EE4 1EE5 1EE4 +1EE5 1EE5 1EE4 +1EE6 1EE7 1EE6 +1EE7 1EE7 1EE6 +1EE8 1EE9 1EE8 +1EE9 1EE9 1EE8 +1EEA 1EEB 1EEA +1EEB 1EEB 1EEA +1EEC 1EED 1EEC +1EED 1EED 1EEC +1EEE 1EEF 1EEE +1EEF 1EEF 1EEE +1EF0 1EF1 1EF0 +1EF1 1EF1 1EF0 +1EF2 1EF3 1EF2 +1EF3 1EF3 1EF2 +1EF4 1EF5 1EF4 +1EF5 1EF5 1EF4 +1EF6 1EF7 1EF6 +1EF7 1EF7 1EF6 +1EF8 1EF9 1EF8 +1EF9 1EF9 1EF8 +1F00 1F00 1F08 +1F01 1F01 1F09 +1F02 1F02 1F0A +1F03 1F03 1F0B +1F04 1F04 1F0C +1F05 1F05 1F0D +1F06 1F06 1F0E +1F07 1F07 1F0F +1F08 1F00 1F08 +1F09 1F01 1F09 +1F0A 1F02 1F0A +1F0B 1F03 1F0B +1F0C 1F04 1F0C +1F0D 1F05 1F0D +1F0E 1F06 1F0E +1F0F 1F07 1F0F +1F10 1F10 1F18 +1F11 1F11 1F19 +1F12 1F12 1F1A +1F13 1F13 1F1B +1F14 1F14 1F1C +1F15 1F15 1F1D +1F18 1F10 1F18 +1F19 1F11 1F19 +1F1A 1F12 1F1A +1F1B 1F13 1F1B +1F1C 1F14 1F1C +1F1D 1F15 1F1D +1F20 1F20 1F28 +1F21 1F21 1F29 +1F22 1F22 1F2A +1F23 1F23 1F2B +1F24 1F24 1F2C +1F25 1F25 1F2D +1F26 1F26 1F2E +1F27 1F27 1F2F +1F28 1F20 1F28 +1F29 1F21 1F29 +1F2A 1F22 1F2A +1F2B 1F23 1F2B +1F2C 1F24 1F2C +1F2D 1F25 1F2D +1F2E 1F26 1F2E +1F2F 1F27 1F2F +1F30 1F30 1F38 +1F31 1F31 1F39 +1F32 1F32 1F3A +1F33 1F33 1F3B +1F34 1F34 1F3C +1F35 1F35 1F3D +1F36 1F36 1F3E +1F37 1F37 1F3F +1F38 1F30 1F38 +1F39 1F31 1F39 +1F3A 1F32 1F3A +1F3B 1F33 1F3B +1F3C 1F34 1F3C +1F3D 1F35 1F3D +1F3E 1F36 1F3E +1F3F 1F37 1F3F +1F40 1F40 1F48 +1F41 1F41 1F49 +1F42 1F42 1F4A +1F43 1F43 1F4B +1F44 1F44 1F4C +1F45 1F45 1F4D +1F48 1F40 1F48 +1F49 1F41 1F49 +1F4A 1F42 1F4A +1F4B 1F43 1F4B +1F4C 1F44 1F4C +1F4D 1F45 1F4D +1F51 1F51 1F59 +1F53 1F53 1F5B +1F55 1F55 1F5D +1F57 1F57 1F5F +1F59 1F51 1F59 +1F5B 1F53 1F5B +1F5D 1F55 1F5D +1F5F 1F57 1F5F +1F60 1F60 1F68 +1F61 1F61 1F69 +1F62 1F62 1F6A +1F63 1F63 1F6B +1F64 1F64 1F6C +1F65 1F65 1F6D +1F66 1F66 1F6E +1F67 1F67 1F6F +1F68 1F60 1F68 +1F69 1F61 1F69 +1F6A 1F62 1F6A +1F6B 1F63 1F6B +1F6C 1F64 1F6C +1F6D 1F65 1F6D +1F6E 1F66 1F6E +1F6F 1F67 1F6F +1F70 1F70 1FBA +1F71 1F71 1FBB +1F72 1F72 1FC8 +1F73 1F73 1FC9 +1F74 1F74 1FCA +1F75 1F75 1FCB +1F76 1F76 1FDA +1F77 1F77 1FDB +1F78 1F78 1FF8 +1F79 1F79 1FF9 +1F7A 1F7A 1FEA +1F7B 1F7B 1FEB +1F7C 1F7C 1FFA +1F7D 1F7D 1FFB +1F80 1F80 1F88 +1F81 1F81 1F89 +1F82 1F82 1F8A +1F83 1F83 1F8B +1F84 1F84 1F8C +1F85 1F85 1F8D +1F86 1F86 1F8E +1F87 1F87 1F8F +1F88 1F80 1F88 +1F89 1F81 1F89 +1F8A 1F82 1F8A +1F8B 1F83 1F8B +1F8C 1F84 1F8C +1F8D 1F85 1F8D +1F8E 1F86 1F8E +1F8F 1F87 1F8F +1F90 1F90 1F98 +1F91 1F91 1F99 +1F92 1F92 1F9A +1F93 1F93 1F9B +1F94 1F94 1F9C +1F95 1F95 1F9D +1F96 1F96 1F9E +1F97 1F97 1F9F +1F98 1F90 1F98 +1F99 1F91 1F99 +1F9A 1F92 1F9A +1F9B 1F93 1F9B +1F9C 1F94 1F9C +1F9D 1F95 1F9D +1F9E 1F96 1F9E +1F9F 1F97 1F9F +1FA0 1FA0 1FA8 +1FA1 1FA1 1FA9 +1FA2 1FA2 1FAA +1FA3 1FA3 1FAB +1FA4 1FA4 1FAC +1FA5 1FA5 1FAD +1FA6 1FA6 1FAE +1FA7 1FA7 1FAF +1FA8 1FA0 1FA8 +1FA9 1FA1 1FA9 +1FAA 1FA2 1FAA +1FAB 1FA3 1FAB +1FAC 1FA4 1FAC +1FAD 1FA5 1FAD +1FAE 1FA6 1FAE +1FAF 1FA7 1FAF +1FB0 1FB0 1FB8 +1FB1 1FB1 1FB9 +1FB3 1FB3 1FBC +1FB8 1FB0 1FB8 +1FB9 1FB1 1FB9 +1FBA 1F70 1FBA +1FBB 1F71 1FBB +1FBC 1FB3 1FBC +1FBE 1FBE 0399 +1FC3 1FC3 1FCC +1FC8 1F72 1FC8 +1FC9 1F73 1FC9 +1FCA 1F74 1FCA +1FCB 1F75 1FCB +1FCC 1FC3 1FCC +1FD0 1FD0 1FD8 +1FD1 1FD1 1FD9 +1FD8 1FD0 1FD8 +1FD9 1FD1 1FD9 +1FDA 1F76 1FDA +1FDB 1F77 1FDB +1FE0 1FE0 1FE8 +1FE1 1FE1 1FE9 +1FE5 1FE5 1FEC +1FE8 1FE0 1FE8 +1FE9 1FE1 1FE9 +1FEA 1F7A 1FEA +1FEB 1F7B 1FEB +1FEC 1FE5 1FEC +1FF3 1FF3 1FFC +1FF8 1F78 1FF8 +1FF9 1F79 1FF9 +1FFA 1F7C 1FFA +1FFB 1F7D 1FFB +1FFC 1FF3 1FFC +2126 03C9 2126 +212A 006B 212A +212B 00E5 212B +2160 2170 2160 +2161 2171 2161 +2162 2172 2162 +2163 2173 2163 +2164 2174 2164 +2165 2175 2165 +2166 2176 2166 +2167 2177 2167 +2168 2178 2168 +2169 2179 2169 +216A 217A 216A +216B 217B 216B +216C 217C 216C +216D 217D 216D +216E 217E 216E +216F 217F 216F +2170 2170 2160 +2171 2171 2161 +2172 2172 2162 +2173 2173 2163 +2174 2174 2164 +2175 2175 2165 +2176 2176 2166 +2177 2177 2167 +2178 2178 2168 +2179 2179 2169 +217A 217A 216A +217B 217B 216B +217C 217C 216C +217D 217D 216D +217E 217E 216E +217F 217F 216F +24B6 24D0 24B6 +24B7 24D1 24B7 +24B8 24D2 24B8 +24B9 24D3 24B9 +24BA 24D4 24BA +24BB 24D5 24BB +24BC 24D6 24BC +24BD 24D7 24BD +24BE 24D8 24BE +24BF 24D9 24BF +24C0 24DA 24C0 +24C1 24DB 24C1 +24C2 24DC 24C2 +24C3 24DD 24C3 +24C4 24DE 24C4 +24C5 24DF 24C5 +24C6 24E0 24C6 +24C7 24E1 24C7 +24C8 24E2 24C8 +24C9 24E3 24C9 +24CA 24E4 24CA +24CB 24E5 24CB +24CC 24E6 24CC +24CD 24E7 24CD +24CE 24E8 24CE +24CF 24E9 24CF +24D0 24D0 24B6 +24D1 24D1 24B7 +24D2 24D2 24B8 +24D3 24D3 24B9 +24D4 24D4 24BA +24D5 24D5 24BB +24D6 24D6 24BC +24D7 24D7 24BD +24D8 24D8 24BE +24D9 24D9 24BF +24DA 24DA 24C0 +24DB 24DB 24C1 +24DC 24DC 24C2 +24DD 24DD 24C3 +24DE 24DE 24C4 +24DF 24DF 24C5 +24E0 24E0 24C6 +24E1 24E1 24C7 +24E2 24E2 24C8 +24E3 24E3 24C9 +24E4 24E4 24CA +24E5 24E5 24CB +24E6 24E6 24CC +24E7 24E7 24CD +24E8 24E8 24CE +24E9 24E9 24CF +FF21 FF41 FF21 +FF22 FF42 FF22 +FF23 FF43 FF23 +FF24 FF44 FF24 +FF25 FF45 FF25 +FF26 FF46 FF26 +FF27 FF47 FF27 +FF28 FF48 FF28 +FF29 FF49 FF29 +FF2A FF4A FF2A +FF2B FF4B FF2B +FF2C FF4C FF2C +FF2D FF4D FF2D +FF2E FF4E FF2E +FF2F FF4F FF2F +FF30 FF50 FF30 +FF31 FF51 FF31 +FF32 FF52 FF32 +FF33 FF53 FF33 +FF34 FF54 FF34 +FF35 FF55 FF35 +FF36 FF56 FF36 +FF37 FF57 FF37 +FF38 FF58 FF38 +FF39 FF59 FF39 +FF3A FF5A FF3A +FF41 FF41 FF21 +FF42 FF42 FF22 +FF43 FF43 FF23 +FF44 FF44 FF24 +FF45 FF45 FF25 +FF46 FF46 FF26 +FF47 FF47 FF27 +FF48 FF48 FF28 +FF49 FF49 FF29 +FF4A FF4A FF2A +FF4B FF4B FF2B +FF4C FF4C FF2C +FF4D FF4D FF2D +FF4E FF4E FF2E +FF4F FF4F FF2F +FF50 FF50 FF30 +FF51 FF51 FF31 +FF52 FF52 FF32 +FF53 FF53 FF33 +FF54 FF54 FF34 +FF55 FF55 FF35 +FF56 FF56 FF36 +FF57 FF57 FF37 +FF58 FF58 FF38 +FF59 FF59 FF39 +FF5A FF5A FF3A +DROP VIEW v_bmp; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_ucs2_general_mysql500_ci_casefold.test b/mysql-test/main/ctype_ucs2_general_mysql500_ci_casefold.test new file mode 100644 index 0000000000000..2c07e6ffac306 --- /dev/null +++ b/mysql-test/main/ctype_ucs2_general_mysql500_ci_casefold.test @@ -0,0 +1,15 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET @@collation_connection=ucs2_general_mysql500_ci; +--source include/ctype_unicode_casefold_bmp.inc + + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/ctype_ucs2_general_mysql500_ci_ws.result b/mysql-test/main/ctype_ucs2_general_mysql500_ci_ws.result new file mode 100644 index 0000000000000..40ba714560f0c --- /dev/null +++ b/mysql-test/main/ctype_ucs2_general_mysql500_ci_ws.result @@ -0,0 +1,1142 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET @@collation_connection=ucs2_general_mysql500_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +ucs2_general_mysql500_ci +SELECT HEX(codepoint) FROM v_bmp WHERE HEX(WEIGHT_STRING(c))='FFFD'; +HEX(codepoint) +FFFD +SELECT +SUM(codepoint_hex4=HEX(WEIGHT_STRING(c))) AS count_bmp_weight_is_codepoint, +SUM(codepoint_hex4<>HEX(WEIGHT_STRING(c))) AS count_bmp_weight_is_not_codepoint +FROM v_bmp; +count_bmp_weight_is_codepoint count_bmp_weight_is_not_codepoint +64429 1107 +SELECT codepoint_hex4,HEX(WEIGHT_STRING(c)) +FROM v_bmp +WHERE codepoint_hex4<>HEX(WEIGHT_STRING(c)); +codepoint_hex4 HEX(WEIGHT_STRING(c)) +0061 0041 +0062 0042 +0063 0043 +0064 0044 +0065 0045 +0066 0046 +0067 0047 +0068 0048 +0069 0049 +006A 004A +006B 004B +006C 004C +006D 004D +006E 004E +006F 004F +0070 0050 +0071 0051 +0072 0052 +0073 0053 +0074 0054 +0075 0055 +0076 0056 +0077 0057 +0078 0058 +0079 0059 +007A 005A +00B5 039C +00C0 0041 +00C1 0041 +00C2 0041 +00C3 0041 +00C4 0041 +00C5 0041 +00C7 0043 +00C8 0045 +00C9 0045 +00CA 0045 +00CB 0045 +00CC 0049 +00CD 0049 +00CE 0049 +00CF 0049 +00D1 004E +00D2 004F +00D3 004F +00D4 004F +00D5 004F +00D6 004F +00D9 0055 +00DA 0055 +00DB 0055 +00DC 0055 +00DD 0059 +00E0 0041 +00E1 0041 +00E2 0041 +00E3 0041 +00E4 0041 +00E5 0041 +00E6 00C6 +00E7 0043 +00E8 0045 +00E9 0045 +00EA 0045 +00EB 0045 +00EC 0049 +00ED 0049 +00EE 0049 +00EF 0049 +00F0 00D0 +00F1 004E +00F2 004F +00F3 004F +00F4 004F +00F5 004F +00F6 004F +00F8 00D8 +00F9 0055 +00FA 0055 +00FB 0055 +00FC 0055 +00FD 0059 +00FE 00DE +00FF 0059 +0100 0041 +0101 0041 +0102 0041 +0103 0041 +0104 0041 +0105 0041 +0106 0043 +0107 0043 +0108 0043 +0109 0043 +010A 0043 +010B 0043 +010C 0043 +010D 0043 +010E 0044 +010F 0044 +0111 0110 +0112 0045 +0113 0045 +0114 0045 +0115 0045 +0116 0045 +0117 0045 +0118 0045 +0119 0045 +011A 0045 +011B 0045 +011C 0047 +011D 0047 +011E 0047 +011F 0047 +0120 0047 +0121 0047 +0122 0047 +0123 0047 +0124 0048 +0125 0048 +0127 0126 +0128 0049 +0129 0049 +012A 0049 +012B 0049 +012C 0049 +012D 0049 +012E 0049 +012F 0049 +0130 0049 +0131 0049 +0133 0132 +0134 004A +0135 004A +0136 004B +0137 004B +0139 004C +013A 004C +013B 004C +013C 004C +013D 004C +013E 004C +0140 013F +0142 0141 +0143 004E +0144 004E +0145 004E +0146 004E +0147 004E +0148 004E +014B 014A +014C 004F +014D 004F +014E 004F +014F 004F +0150 004F +0151 004F +0153 0152 +0154 0052 +0155 0052 +0156 0052 +0157 0052 +0158 0052 +0159 0052 +015A 0053 +015B 0053 +015C 0053 +015D 0053 +015E 0053 +015F 0053 +0160 0053 +0161 0053 +0162 0054 +0163 0054 +0164 0054 +0165 0054 +0167 0166 +0168 0055 +0169 0055 +016A 0055 +016B 0055 +016C 0055 +016D 0055 +016E 0055 +016F 0055 +0170 0055 +0171 0055 +0172 0055 +0173 0055 +0174 0057 +0175 0057 +0176 0059 +0177 0059 +0178 0059 +0179 005A +017A 005A +017B 005A +017C 005A +017D 005A +017E 005A +017F 0053 +0183 0182 +0185 0184 +0188 0187 +018C 018B +0192 0191 +0195 01F6 +0199 0198 +01A0 004F +01A1 004F +01A3 01A2 +01A5 01A4 +01A8 01A7 +01AD 01AC +01AF 0055 +01B0 0055 +01B4 01B3 +01B6 01B5 +01B9 01B8 +01BD 01BC +01BF 01F7 +01C5 01C4 +01C6 01C4 +01C8 01C7 +01C9 01C7 +01CB 01CA +01CC 01CA +01CD 0041 +01CE 0041 +01CF 0049 +01D0 0049 +01D1 004F +01D2 004F +01D3 0055 +01D4 0055 +01D5 0055 +01D6 0055 +01D7 0055 +01D8 0055 +01D9 0055 +01DA 0055 +01DB 0055 +01DC 0055 +01DD 018E +01DE 0041 +01DF 0041 +01E0 0041 +01E1 0041 +01E2 00C6 +01E3 00C6 +01E5 01E4 +01E6 0047 +01E7 0047 +01E8 004B +01E9 004B +01EA 004F +01EB 004F +01EC 004F +01ED 004F +01EE 01B7 +01EF 01B7 +01F0 004A +01F2 01F1 +01F3 01F1 +01F4 0047 +01F5 0047 +01F8 004E +01F9 004E +01FA 0041 +01FB 0041 +01FC 00C6 +01FD 00C6 +01FE 00D8 +01FF 00D8 +0200 0041 +0201 0041 +0202 0041 +0203 0041 +0204 0045 +0205 0045 +0206 0045 +0207 0045 +0208 0049 +0209 0049 +020A 0049 +020B 0049 +020C 004F +020D 004F +020E 004F +020F 004F +0210 0052 +0211 0052 +0212 0052 +0213 0052 +0214 0055 +0215 0055 +0216 0055 +0217 0055 +0218 0053 +0219 0053 +021A 0054 +021B 0054 +021D 021C +021E 0048 +021F 0048 +0223 0222 +0225 0224 +0226 0041 +0227 0041 +0228 0045 +0229 0045 +022A 004F +022B 004F +022C 004F +022D 004F +022E 004F +022F 004F +0230 004F +0231 004F +0232 0059 +0233 0059 +0253 0181 +0254 0186 +0256 0189 +0257 018A +0259 018F +025B 0190 +0260 0193 +0263 0194 +0268 0197 +0269 0196 +026F 019C +0272 019D +0275 019F +0280 01A6 +0283 01A9 +0288 01AE +028A 01B1 +028B 01B2 +0292 01B7 +0345 0399 +0386 0391 +0388 0395 +0389 0397 +038A 0399 +038C 039F +038E 03A5 +038F 03A9 +0390 0399 +03AA 0399 +03AB 03A5 +03AC 0391 +03AD 0395 +03AE 0397 +03AF 0399 +03B0 03A5 +03B1 0391 +03B2 0392 +03B3 0393 +03B4 0394 +03B5 0395 +03B6 0396 +03B7 0397 +03B8 0398 +03B9 0399 +03BA 039A +03BB 039B +03BC 039C +03BD 039D +03BE 039E +03BF 039F +03C0 03A0 +03C1 03A1 +03C2 03A3 +03C3 03A3 +03C4 03A4 +03C5 03A5 +03C6 03A6 +03C7 03A7 +03C8 03A8 +03C9 03A9 +03CA 0399 +03CB 03A5 +03CC 039F +03CD 03A5 +03CE 03A9 +03D0 0392 +03D1 0398 +03D3 03D2 +03D4 03D2 +03D5 03A6 +03D6 03A0 +03DB 03DA +03DD 03DC +03DF 03DE +03E1 03E0 +03E3 03E2 +03E5 03E4 +03E7 03E6 +03E9 03E8 +03EB 03EA +03ED 03EC +03EF 03EE +03F0 039A +03F1 03A1 +03F2 03A3 +0400 0415 +0401 0415 +0403 0413 +0407 0406 +040C 041A +040D 0418 +040E 0423 +0430 0410 +0431 0411 +0432 0412 +0433 0413 +0434 0414 +0435 0415 +0436 0416 +0437 0417 +0438 0418 +0439 0419 +043A 041A +043B 041B +043C 041C +043D 041D +043E 041E +043F 041F +0440 0420 +0441 0421 +0442 0422 +0443 0423 +0444 0424 +0445 0425 +0446 0426 +0447 0427 +0448 0428 +0449 0429 +044A 042A +044B 042B +044C 042C +044D 042D +044E 042E +044F 042F +0450 0415 +0451 0415 +0452 0402 +0453 0413 +0454 0404 +0455 0405 +0456 0406 +0457 0406 +0458 0408 +0459 0409 +045A 040A +045B 040B +045C 041A +045D 0418 +045E 0423 +045F 040F +0461 0460 +0463 0462 +0465 0464 +0467 0466 +0469 0468 +046B 046A +046D 046C +046F 046E +0471 0470 +0473 0472 +0475 0474 +0476 0474 +0477 0474 +0479 0478 +047B 047A +047D 047C +047F 047E +0481 0480 +048D 048C +048F 048E +0491 0490 +0493 0492 +0495 0494 +0497 0496 +0499 0498 +049B 049A +049D 049C +049F 049E +04A1 04A0 +04A3 04A2 +04A5 04A4 +04A7 04A6 +04A9 04A8 +04AB 04AA +04AD 04AC +04AF 04AE +04B1 04B0 +04B3 04B2 +04B5 04B4 +04B7 04B6 +04B9 04B8 +04BB 04BA +04BD 04BC +04BF 04BE +04C1 0416 +04C2 0416 +04C4 04C3 +04C8 04C7 +04CC 04CB +04D0 0410 +04D1 0410 +04D2 0410 +04D3 0410 +04D5 04D4 +04D6 0415 +04D7 0415 +04D9 04D8 +04DA 04D8 +04DB 04D8 +04DC 0416 +04DD 0416 +04DE 0417 +04DF 0417 +04E1 04E0 +04E2 0418 +04E3 0418 +04E4 0418 +04E5 0418 +04E6 041E +04E7 041E +04E9 04E8 +04EA 04E8 +04EB 04E8 +04EC 042D +04ED 042D +04EE 0423 +04EF 0423 +04F0 0423 +04F1 0423 +04F2 0423 +04F3 0423 +04F4 0427 +04F5 0427 +04F8 042B +04F9 042B +0561 0531 +0562 0532 +0563 0533 +0564 0534 +0565 0535 +0566 0536 +0567 0537 +0568 0538 +0569 0539 +056A 053A +056B 053B +056C 053C +056D 053D +056E 053E +056F 053F +0570 0540 +0571 0541 +0572 0542 +0573 0543 +0574 0544 +0575 0545 +0576 0546 +0577 0547 +0578 0548 +0579 0549 +057A 054A +057B 054B +057C 054C +057D 054D +057E 054E +057F 054F +0580 0550 +0581 0551 +0582 0552 +0583 0553 +0584 0554 +0585 0555 +0586 0556 +1E00 0041 +1E01 0041 +1E02 0042 +1E03 0042 +1E04 0042 +1E05 0042 +1E06 0042 +1E07 0042 +1E08 0043 +1E09 0043 +1E0A 0044 +1E0B 0044 +1E0C 0044 +1E0D 0044 +1E0E 0044 +1E0F 0044 +1E10 0044 +1E11 0044 +1E12 0044 +1E13 0044 +1E14 0045 +1E15 0045 +1E16 0045 +1E17 0045 +1E18 0045 +1E19 0045 +1E1A 0045 +1E1B 0045 +1E1C 0045 +1E1D 0045 +1E1E 0046 +1E1F 0046 +1E20 0047 +1E21 0047 +1E22 0048 +1E23 0048 +1E24 0048 +1E25 0048 +1E26 0048 +1E27 0048 +1E28 0048 +1E29 0048 +1E2A 0048 +1E2B 0048 +1E2C 0049 +1E2D 0049 +1E2E 0049 +1E2F 0049 +1E30 004B +1E31 004B +1E32 004B +1E33 004B +1E34 004B +1E35 004B +1E36 004C +1E37 004C +1E38 004C +1E39 004C +1E3A 004C +1E3B 004C +1E3C 004C +1E3D 004C +1E3E 004D +1E3F 004D +1E40 004D +1E41 004D +1E42 004D +1E43 004D +1E44 004E +1E45 004E +1E46 004E +1E47 004E +1E48 004E +1E49 004E +1E4A 004E +1E4B 004E +1E4C 004F +1E4D 004F +1E4E 004F +1E4F 004F +1E50 004F +1E51 004F +1E52 004F +1E53 004F +1E54 0050 +1E55 0050 +1E56 0050 +1E57 0050 +1E58 0052 +1E59 0052 +1E5A 0052 +1E5B 0052 +1E5C 0052 +1E5D 0052 +1E5E 0052 +1E5F 0052 +1E60 0053 +1E61 0053 +1E62 0053 +1E63 0053 +1E64 0053 +1E65 0053 +1E66 0053 +1E67 0053 +1E68 0053 +1E69 0053 +1E6A 0054 +1E6B 0054 +1E6C 0054 +1E6D 0054 +1E6E 0054 +1E6F 0054 +1E70 0054 +1E71 0054 +1E72 0055 +1E73 0055 +1E74 0055 +1E75 0055 +1E76 0055 +1E77 0055 +1E78 0055 +1E79 0055 +1E7A 0055 +1E7B 0055 +1E7C 0056 +1E7D 0056 +1E7E 0056 +1E7F 0056 +1E80 0057 +1E81 0057 +1E82 0057 +1E83 0057 +1E84 0057 +1E85 0057 +1E86 0057 +1E87 0057 +1E88 0057 +1E89 0057 +1E8A 0058 +1E8B 0058 +1E8C 0058 +1E8D 0058 +1E8E 0059 +1E8F 0059 +1E90 005A +1E91 005A +1E92 005A +1E93 005A +1E94 005A +1E95 005A +1E96 0048 +1E97 0054 +1E98 0057 +1E99 0059 +1E9B 0053 +1EA0 0041 +1EA1 0041 +1EA2 0041 +1EA3 0041 +1EA4 0041 +1EA5 0041 +1EA6 0041 +1EA7 0041 +1EA8 0041 +1EA9 0041 +1EAA 0041 +1EAB 0041 +1EAC 0041 +1EAD 0041 +1EAE 0041 +1EAF 0041 +1EB0 0041 +1EB1 0041 +1EB2 0041 +1EB3 0041 +1EB4 0041 +1EB5 0041 +1EB6 0041 +1EB7 0041 +1EB8 0045 +1EB9 0045 +1EBA 0045 +1EBB 0045 +1EBC 0045 +1EBD 0045 +1EBE 0045 +1EBF 0045 +1EC0 0045 +1EC1 0045 +1EC2 0045 +1EC3 0045 +1EC4 0045 +1EC5 0045 +1EC6 0045 +1EC7 0045 +1EC8 0049 +1EC9 0049 +1ECA 0049 +1ECB 0049 +1ECC 004F +1ECD 004F +1ECE 004F +1ECF 004F +1ED0 004F +1ED1 004F +1ED2 004F +1ED3 004F +1ED4 004F +1ED5 004F +1ED6 004F +1ED7 004F +1ED8 004F +1ED9 004F +1EDA 004F +1EDB 004F +1EDC 004F +1EDD 004F +1EDE 004F +1EDF 004F +1EE0 004F +1EE1 004F +1EE2 004F +1EE3 004F +1EE4 0055 +1EE5 0055 +1EE6 0055 +1EE7 0055 +1EE8 0055 +1EE9 0055 +1EEA 0055 +1EEB 0055 +1EEC 0055 +1EED 0055 +1EEE 0055 +1EEF 0055 +1EF0 0055 +1EF1 0055 +1EF2 0059 +1EF3 0059 +1EF4 0059 +1EF5 0059 +1EF6 0059 +1EF7 0059 +1EF8 0059 +1EF9 0059 +1F00 0391 +1F01 0391 +1F02 0391 +1F03 0391 +1F04 0391 +1F05 0391 +1F06 0391 +1F07 0391 +1F08 0391 +1F09 0391 +1F0A 0391 +1F0B 0391 +1F0C 0391 +1F0D 0391 +1F0E 0391 +1F0F 0391 +1F10 0395 +1F11 0395 +1F12 0395 +1F13 0395 +1F14 0395 +1F15 0395 +1F18 0395 +1F19 0395 +1F1A 0395 +1F1B 0395 +1F1C 0395 +1F1D 0395 +1F20 0397 +1F21 0397 +1F22 0397 +1F23 0397 +1F24 0397 +1F25 0397 +1F26 0397 +1F27 0397 +1F28 0397 +1F29 0397 +1F2A 0397 +1F2B 0397 +1F2C 0397 +1F2D 0397 +1F2E 0397 +1F2F 0397 +1F30 0399 +1F31 0399 +1F32 0399 +1F33 0399 +1F34 0399 +1F35 0399 +1F36 0399 +1F37 0399 +1F38 0399 +1F39 0399 +1F3A 0399 +1F3B 0399 +1F3C 0399 +1F3D 0399 +1F3E 0399 +1F3F 0399 +1F40 039F +1F41 039F +1F42 039F +1F43 039F +1F44 039F +1F45 039F +1F48 039F +1F49 039F +1F4A 039F +1F4B 039F +1F4C 039F +1F4D 039F +1F50 03A5 +1F51 03A5 +1F52 03A5 +1F53 03A5 +1F54 03A5 +1F55 03A5 +1F56 03A5 +1F57 03A5 +1F59 03A5 +1F5B 03A5 +1F5D 03A5 +1F5F 03A5 +1F60 03A9 +1F61 03A9 +1F62 03A9 +1F63 03A9 +1F64 03A9 +1F65 03A9 +1F66 03A9 +1F67 03A9 +1F68 03A9 +1F69 03A9 +1F6A 03A9 +1F6B 03A9 +1F6C 03A9 +1F6D 03A9 +1F6E 03A9 +1F6F 03A9 +1F70 0391 +1F71 1FBB +1F72 0395 +1F73 1FC9 +1F74 0397 +1F75 1FCB +1F76 0399 +1F77 1FDB +1F78 039F +1F79 1FF9 +1F7A 03A5 +1F7B 1FEB +1F7C 03A9 +1F7D 1FFB +1F80 0391 +1F81 0391 +1F82 0391 +1F83 0391 +1F84 0391 +1F85 0391 +1F86 0391 +1F87 0391 +1F88 0391 +1F89 0391 +1F8A 0391 +1F8B 0391 +1F8C 0391 +1F8D 0391 +1F8E 0391 +1F8F 0391 +1F90 0397 +1F91 0397 +1F92 0397 +1F93 0397 +1F94 0397 +1F95 0397 +1F96 0397 +1F97 0397 +1F98 0397 +1F99 0397 +1F9A 0397 +1F9B 0397 +1F9C 0397 +1F9D 0397 +1F9E 0397 +1F9F 0397 +1FA0 03A9 +1FA1 03A9 +1FA2 03A9 +1FA3 03A9 +1FA4 03A9 +1FA5 03A9 +1FA6 03A9 +1FA7 03A9 +1FA8 03A9 +1FA9 03A9 +1FAA 03A9 +1FAB 03A9 +1FAC 03A9 +1FAD 03A9 +1FAE 03A9 +1FAF 03A9 +1FB0 0391 +1FB1 0391 +1FB2 0391 +1FB3 0391 +1FB4 0391 +1FB6 0391 +1FB7 0391 +1FB8 0391 +1FB9 0391 +1FBA 0391 +1FBC 0391 +1FBE 0399 +1FC2 0397 +1FC3 0397 +1FC4 0397 +1FC6 0397 +1FC7 0397 +1FC8 0395 +1FCA 0397 +1FCC 0397 +1FD0 0399 +1FD1 0399 +1FD2 0399 +1FD6 0399 +1FD7 0399 +1FD8 0399 +1FD9 0399 +1FDA 0399 +1FE0 03A5 +1FE1 03A5 +1FE2 03A5 +1FE4 03A1 +1FE5 03A1 +1FE6 03A5 +1FE7 03A5 +1FE8 03A5 +1FE9 03A5 +1FEA 03A5 +1FEC 03A1 +1FF2 03A9 +1FF3 03A9 +1FF4 03A9 +1FF6 03A9 +1FF7 03A9 +1FF8 039F +1FFA 03A9 +1FFC 03A9 +2170 2160 +2171 2161 +2172 2162 +2173 2163 +2174 2164 +2175 2165 +2176 2166 +2177 2167 +2178 2168 +2179 2169 +217A 216A +217B 216B +217C 216C +217D 216D +217E 216E +217F 216F +24D0 24B6 +24D1 24B7 +24D2 24B8 +24D3 24B9 +24D4 24BA +24D5 24BB +24D6 24BC +24D7 24BD +24D8 24BE +24D9 24BF +24DA 24C0 +24DB 24C1 +24DC 24C2 +24DD 24C3 +24DE 24C4 +24DF 24C5 +24E0 24C6 +24E1 24C7 +24E2 24C8 +24E3 24C9 +24E4 24CA +24E5 24CB +24E6 24CC +24E7 24CD +24E8 24CE +24E9 24CF +FF41 FF21 +FF42 FF22 +FF43 FF23 +FF44 FF24 +FF45 FF25 +FF46 FF26 +FF47 FF27 +FF48 FF28 +FF49 FF29 +FF4A FF2A +FF4B FF2B +FF4C FF2C +FF4D FF2D +FF4E FF2E +FF4F FF2F +FF50 FF30 +FF51 FF31 +FF52 FF32 +FF53 FF33 +FF54 FF34 +FF55 FF35 +FF56 FF36 +FF57 FF37 +FF58 FF38 +FF59 FF39 +FF5A FF3A +DROP VIEW v_bmp; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_ucs2_general_mysql500_ci_ws.test b/mysql-test/main/ctype_ucs2_general_mysql500_ci_ws.test new file mode 100644 index 0000000000000..3e3ff3726e83d --- /dev/null +++ b/mysql-test/main/ctype_ucs2_general_mysql500_ci_ws.test @@ -0,0 +1,15 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET @@collation_connection=ucs2_general_mysql500_ci; +--source include/ctype_unicode_ws_bmp.inc + + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/ctype_ucs2_turkish_ci_casefold.result b/mysql-test/main/ctype_ucs2_turkish_ci_casefold.result new file mode 100644 index 0000000000000..6feffa673b9ee --- /dev/null +++ b/mysql-test/main/ctype_ucs2_turkish_ci_casefold.result @@ -0,0 +1,1427 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET @@collation_connection=ucs2_turkish_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +ucs2_turkish_ci +SELECT +codepoint_hex4, +HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)), +HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +FROM v_bmp +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); +codepoint_hex4 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +0041 0061 0041 +0042 0062 0042 +0043 0063 0043 +0044 0064 0044 +0045 0065 0045 +0046 0066 0046 +0047 0067 0047 +0048 0068 0048 +0049 0131 0049 +004A 006A 004A +004B 006B 004B +004C 006C 004C +004D 006D 004D +004E 006E 004E +004F 006F 004F +0050 0070 0050 +0051 0071 0051 +0052 0072 0052 +0053 0073 0053 +0054 0074 0054 +0055 0075 0055 +0056 0076 0056 +0057 0077 0057 +0058 0078 0058 +0059 0079 0059 +005A 007A 005A +0061 0061 0041 +0062 0062 0042 +0063 0063 0043 +0064 0064 0044 +0065 0065 0045 +0066 0066 0046 +0067 0067 0047 +0068 0068 0048 +0069 0069 0130 +006A 006A 004A +006B 006B 004B +006C 006C 004C +006D 006D 004D +006E 006E 004E +006F 006F 004F +0070 0070 0050 +0071 0071 0051 +0072 0072 0052 +0073 0073 0053 +0074 0074 0054 +0075 0075 0055 +0076 0076 0056 +0077 0077 0057 +0078 0078 0058 +0079 0079 0059 +007A 007A 005A +00B5 00B5 039C +00C0 00E0 00C0 +00C1 00E1 00C1 +00C2 00E2 00C2 +00C3 00E3 00C3 +00C4 00E4 00C4 +00C5 00E5 00C5 +00C6 00E6 00C6 +00C7 00E7 00C7 +00C8 00E8 00C8 +00C9 00E9 00C9 +00CA 00EA 00CA +00CB 00EB 00CB +00CC 00EC 00CC +00CD 00ED 00CD +00CE 00EE 00CE +00CF 00EF 00CF +00D0 00F0 00D0 +00D1 00F1 00D1 +00D2 00F2 00D2 +00D3 00F3 00D3 +00D4 00F4 00D4 +00D5 00F5 00D5 +00D6 00F6 00D6 +00D8 00F8 00D8 +00D9 00F9 00D9 +00DA 00FA 00DA +00DB 00FB 00DB +00DC 00FC 00DC +00DD 00FD 00DD +00DE 00FE 00DE +00E0 00E0 00C0 +00E1 00E1 00C1 +00E2 00E2 00C2 +00E3 00E3 00C3 +00E4 00E4 00C4 +00E5 00E5 00C5 +00E6 00E6 00C6 +00E7 00E7 00C7 +00E8 00E8 00C8 +00E9 00E9 00C9 +00EA 00EA 00CA +00EB 00EB 00CB +00EC 00EC 00CC +00ED 00ED 00CD +00EE 00EE 00CE +00EF 00EF 00CF +00F0 00F0 00D0 +00F1 00F1 00D1 +00F2 00F2 00D2 +00F3 00F3 00D3 +00F4 00F4 00D4 +00F5 00F5 00D5 +00F6 00F6 00D6 +00F8 00F8 00D8 +00F9 00F9 00D9 +00FA 00FA 00DA +00FB 00FB 00DB +00FC 00FC 00DC +00FD 00FD 00DD +00FE 00FE 00DE +00FF 00FF 0178 +0100 0101 0100 +0101 0101 0100 +0102 0103 0102 +0103 0103 0102 +0104 0105 0104 +0105 0105 0104 +0106 0107 0106 +0107 0107 0106 +0108 0109 0108 +0109 0109 0108 +010A 010B 010A +010B 010B 010A +010C 010D 010C +010D 010D 010C +010E 010F 010E +010F 010F 010E +0110 0111 0110 +0111 0111 0110 +0112 0113 0112 +0113 0113 0112 +0114 0115 0114 +0115 0115 0114 +0116 0117 0116 +0117 0117 0116 +0118 0119 0118 +0119 0119 0118 +011A 011B 011A +011B 011B 011A +011C 011D 011C +011D 011D 011C +011E 011F 011E +011F 011F 011E +0120 0121 0120 +0121 0121 0120 +0122 0123 0122 +0123 0123 0122 +0124 0125 0124 +0125 0125 0124 +0126 0127 0126 +0127 0127 0126 +0128 0129 0128 +0129 0129 0128 +012A 012B 012A +012B 012B 012A +012C 012D 012C +012D 012D 012C +012E 012F 012E +012F 012F 012E +0130 0069 0130 +0131 0131 0049 +0132 0133 0132 +0133 0133 0132 +0134 0135 0134 +0135 0135 0134 +0136 0137 0136 +0137 0137 0136 +0139 013A 0139 +013A 013A 0139 +013B 013C 013B +013C 013C 013B +013D 013E 013D +013E 013E 013D +013F 0140 013F +0140 0140 013F +0141 0142 0141 +0142 0142 0141 +0143 0144 0143 +0144 0144 0143 +0145 0146 0145 +0146 0146 0145 +0147 0148 0147 +0148 0148 0147 +014A 014B 014A +014B 014B 014A +014C 014D 014C +014D 014D 014C +014E 014F 014E +014F 014F 014E +0150 0151 0150 +0151 0151 0150 +0152 0153 0152 +0153 0153 0152 +0154 0155 0154 +0155 0155 0154 +0156 0157 0156 +0157 0157 0156 +0158 0159 0158 +0159 0159 0158 +015A 015B 015A +015B 015B 015A +015C 015D 015C +015D 015D 015C +015E 015F 015E +015F 015F 015E +0160 0161 0160 +0161 0161 0160 +0162 0163 0162 +0163 0163 0162 +0164 0165 0164 +0165 0165 0164 +0166 0167 0166 +0167 0167 0166 +0168 0169 0168 +0169 0169 0168 +016A 016B 016A +016B 016B 016A +016C 016D 016C +016D 016D 016C +016E 016F 016E +016F 016F 016E +0170 0171 0170 +0171 0171 0170 +0172 0173 0172 +0173 0173 0172 +0174 0175 0174 +0175 0175 0174 +0176 0177 0176 +0177 0177 0176 +0178 00FF 0178 +0179 017A 0179 +017A 017A 0179 +017B 017C 017B +017C 017C 017B +017D 017E 017D +017E 017E 017D +017F 017F 0053 +0181 0253 0181 +0182 0183 0182 +0183 0183 0182 +0184 0185 0184 +0185 0185 0184 +0186 0254 0186 +0187 0188 0187 +0188 0188 0187 +0189 0256 0189 +018A 0257 018A +018B 018C 018B +018C 018C 018B +018E 01DD 018E +018F 0259 018F +0190 025B 0190 +0191 0192 0191 +0192 0192 0191 +0193 0260 0193 +0194 0263 0194 +0195 0195 01F6 +0196 0269 0196 +0197 0268 0197 +0198 0199 0198 +0199 0199 0198 +019C 026F 019C +019D 0272 019D +019F 0275 019F +01A0 01A1 01A0 +01A1 01A1 01A0 +01A2 01A3 01A2 +01A3 01A3 01A2 +01A4 01A5 01A4 +01A5 01A5 01A4 +01A6 0280 01A6 +01A7 01A8 01A7 +01A8 01A8 01A7 +01A9 0283 01A9 +01AC 01AD 01AC +01AD 01AD 01AC +01AE 0288 01AE +01AF 01B0 01AF +01B0 01B0 01AF +01B1 028A 01B1 +01B2 028B 01B2 +01B3 01B4 01B3 +01B4 01B4 01B3 +01B5 01B6 01B5 +01B6 01B6 01B5 +01B7 0292 01B7 +01B8 01B9 01B8 +01B9 01B9 01B8 +01BC 01BD 01BC +01BD 01BD 01BC +01BF 01BF 01F7 +01C4 01C6 01C4 +01C5 01C6 01C4 +01C6 01C6 01C4 +01C7 01C9 01C7 +01C8 01C9 01C7 +01C9 01C9 01C7 +01CA 01CC 01CA +01CB 01CC 01CA +01CC 01CC 01CA +01CD 01CE 01CD +01CE 01CE 01CD +01CF 01D0 01CF +01D0 01D0 01CF +01D1 01D2 01D1 +01D2 01D2 01D1 +01D3 01D4 01D3 +01D4 01D4 01D3 +01D5 01D6 01D5 +01D6 01D6 01D5 +01D7 01D8 01D7 +01D8 01D8 01D7 +01D9 01DA 01D9 +01DA 01DA 01D9 +01DB 01DC 01DB +01DC 01DC 01DB +01DD 01DD 018E +01DE 01DF 01DE +01DF 01DF 01DE +01E0 01E1 01E0 +01E1 01E1 01E0 +01E2 01E3 01E2 +01E3 01E3 01E2 +01E4 01E5 01E4 +01E5 01E5 01E4 +01E6 01E7 01E6 +01E7 01E7 01E6 +01E8 01E9 01E8 +01E9 01E9 01E8 +01EA 01EB 01EA +01EB 01EB 01EA +01EC 01ED 01EC +01ED 01ED 01EC +01EE 01EF 01EE +01EF 01EF 01EE +01F1 01F3 01F1 +01F2 01F3 01F1 +01F3 01F3 01F1 +01F4 01F5 01F4 +01F5 01F5 01F4 +01F6 0195 01F6 +01F7 01BF 01F7 +01F8 01F9 01F8 +01F9 01F9 01F8 +01FA 01FB 01FA +01FB 01FB 01FA +01FC 01FD 01FC +01FD 01FD 01FC +01FE 01FF 01FE +01FF 01FF 01FE +0200 0201 0200 +0201 0201 0200 +0202 0203 0202 +0203 0203 0202 +0204 0205 0204 +0205 0205 0204 +0206 0207 0206 +0207 0207 0206 +0208 0209 0208 +0209 0209 0208 +020A 020B 020A +020B 020B 020A +020C 020D 020C +020D 020D 020C +020E 020F 020E +020F 020F 020E +0210 0211 0210 +0211 0211 0210 +0212 0213 0212 +0213 0213 0212 +0214 0215 0214 +0215 0215 0214 +0216 0217 0216 +0217 0217 0216 +0218 0219 0218 +0219 0219 0218 +021A 021B 021A +021B 021B 021A +021C 021D 021C +021D 021D 021C +021E 021F 021E +021F 021F 021E +0222 0223 0222 +0223 0223 0222 +0224 0225 0224 +0225 0225 0224 +0226 0227 0226 +0227 0227 0226 +0228 0229 0228 +0229 0229 0228 +022A 022B 022A +022B 022B 022A +022C 022D 022C +022D 022D 022C +022E 022F 022E +022F 022F 022E +0230 0231 0230 +0231 0231 0230 +0232 0233 0232 +0233 0233 0232 +0253 0253 0181 +0254 0254 0186 +0256 0256 0189 +0257 0257 018A +0259 0259 018F +025B 025B 0190 +0260 0260 0193 +0263 0263 0194 +0268 0268 0197 +0269 0269 0196 +026F 026F 019C +0272 0272 019D +0275 0275 019F +0280 0280 01A6 +0283 0283 01A9 +0288 0288 01AE +028A 028A 01B1 +028B 028B 01B2 +0292 0292 01B7 +0345 0345 0399 +0386 03AC 0386 +0388 03AD 0388 +0389 03AE 0389 +038A 03AF 038A +038C 03CC 038C +038E 03CD 038E +038F 03CE 038F +0391 03B1 0391 +0392 03B2 0392 +0393 03B3 0393 +0394 03B4 0394 +0395 03B5 0395 +0396 03B6 0396 +0397 03B7 0397 +0398 03B8 0398 +0399 03B9 0399 +039A 03BA 039A +039B 03BB 039B +039C 03BC 039C +039D 03BD 039D +039E 03BE 039E +039F 03BF 039F +03A0 03C0 03A0 +03A1 03C1 03A1 +03A3 03C3 03A3 +03A4 03C4 03A4 +03A5 03C5 03A5 +03A6 03C6 03A6 +03A7 03C7 03A7 +03A8 03C8 03A8 +03A9 03C9 03A9 +03AA 03CA 03AA +03AB 03CB 03AB +03AC 03AC 0386 +03AD 03AD 0388 +03AE 03AE 0389 +03AF 03AF 038A +03B1 03B1 0391 +03B2 03B2 0392 +03B3 03B3 0393 +03B4 03B4 0394 +03B5 03B5 0395 +03B6 03B6 0396 +03B7 03B7 0397 +03B8 03B8 0398 +03B9 03B9 0399 +03BA 03BA 039A +03BB 03BB 039B +03BC 03BC 039C +03BD 03BD 039D +03BE 03BE 039E +03BF 03BF 039F +03C0 03C0 03A0 +03C1 03C1 03A1 +03C2 03C2 03A3 +03C3 03C3 03A3 +03C4 03C4 03A4 +03C5 03C5 03A5 +03C6 03C6 03A6 +03C7 03C7 03A7 +03C8 03C8 03A8 +03C9 03C9 03A9 +03CA 03CA 03AA +03CB 03CB 03AB +03CC 03CC 038C +03CD 03CD 038E +03CE 03CE 038F +03D0 03D0 0392 +03D1 03D1 0398 +03D5 03D5 03A6 +03D6 03D6 03A0 +03DA 03DB 03DA +03DB 03DB 03DA +03DC 03DD 03DC +03DD 03DD 03DC +03DE 03DF 03DE +03DF 03DF 03DE +03E0 03E1 03E0 +03E1 03E1 03E0 +03E2 03E3 03E2 +03E3 03E3 03E2 +03E4 03E5 03E4 +03E5 03E5 03E4 +03E6 03E7 03E6 +03E7 03E7 03E6 +03E8 03E9 03E8 +03E9 03E9 03E8 +03EA 03EB 03EA +03EB 03EB 03EA +03EC 03ED 03EC +03ED 03ED 03EC +03EE 03EF 03EE +03EF 03EF 03EE +03F0 03F0 039A +03F1 03F1 03A1 +03F2 03F2 03A3 +0400 0450 0400 +0401 0451 0401 +0402 0452 0402 +0403 0453 0403 +0404 0454 0404 +0405 0455 0405 +0406 0456 0406 +0407 0457 0407 +0408 0458 0408 +0409 0459 0409 +040A 045A 040A +040B 045B 040B +040C 045C 040C +040D 045D 040D +040E 045E 040E +040F 045F 040F +0410 0430 0410 +0411 0431 0411 +0412 0432 0412 +0413 0433 0413 +0414 0434 0414 +0415 0435 0415 +0416 0436 0416 +0417 0437 0417 +0418 0438 0418 +0419 0439 0419 +041A 043A 041A +041B 043B 041B +041C 043C 041C +041D 043D 041D +041E 043E 041E +041F 043F 041F +0420 0440 0420 +0421 0441 0421 +0422 0442 0422 +0423 0443 0423 +0424 0444 0424 +0425 0445 0425 +0426 0446 0426 +0427 0447 0427 +0428 0448 0428 +0429 0449 0429 +042A 044A 042A +042B 044B 042B +042C 044C 042C +042D 044D 042D +042E 044E 042E +042F 044F 042F +0430 0430 0410 +0431 0431 0411 +0432 0432 0412 +0433 0433 0413 +0434 0434 0414 +0435 0435 0415 +0436 0436 0416 +0437 0437 0417 +0438 0438 0418 +0439 0439 0419 +043A 043A 041A +043B 043B 041B +043C 043C 041C +043D 043D 041D +043E 043E 041E +043F 043F 041F +0440 0440 0420 +0441 0441 0421 +0442 0442 0422 +0443 0443 0423 +0444 0444 0424 +0445 0445 0425 +0446 0446 0426 +0447 0447 0427 +0448 0448 0428 +0449 0449 0429 +044A 044A 042A +044B 044B 042B +044C 044C 042C +044D 044D 042D +044E 044E 042E +044F 044F 042F +0450 0450 0400 +0451 0451 0401 +0452 0452 0402 +0453 0453 0403 +0454 0454 0404 +0455 0455 0405 +0456 0456 0406 +0457 0457 0407 +0458 0458 0408 +0459 0459 0409 +045A 045A 040A +045B 045B 040B +045C 045C 040C +045D 045D 040D +045E 045E 040E +045F 045F 040F +0460 0461 0460 +0461 0461 0460 +0462 0463 0462 +0463 0463 0462 +0464 0465 0464 +0465 0465 0464 +0466 0467 0466 +0467 0467 0466 +0468 0469 0468 +0469 0469 0468 +046A 046B 046A +046B 046B 046A +046C 046D 046C +046D 046D 046C +046E 046F 046E +046F 046F 046E +0470 0471 0470 +0471 0471 0470 +0472 0473 0472 +0473 0473 0472 +0474 0475 0474 +0475 0475 0474 +0476 0477 0476 +0477 0477 0476 +0478 0479 0478 +0479 0479 0478 +047A 047B 047A +047B 047B 047A +047C 047D 047C +047D 047D 047C +047E 047F 047E +047F 047F 047E +0480 0481 0480 +0481 0481 0480 +048C 048D 048C +048D 048D 048C +048E 048F 048E +048F 048F 048E +0490 0491 0490 +0491 0491 0490 +0492 0493 0492 +0493 0493 0492 +0494 0495 0494 +0495 0495 0494 +0496 0497 0496 +0497 0497 0496 +0498 0499 0498 +0499 0499 0498 +049A 049B 049A +049B 049B 049A +049C 049D 049C +049D 049D 049C +049E 049F 049E +049F 049F 049E +04A0 04A1 04A0 +04A1 04A1 04A0 +04A2 04A3 04A2 +04A3 04A3 04A2 +04A4 04A5 04A4 +04A5 04A5 04A4 +04A6 04A7 04A6 +04A7 04A7 04A6 +04A8 04A9 04A8 +04A9 04A9 04A8 +04AA 04AB 04AA +04AB 04AB 04AA +04AC 04AD 04AC +04AD 04AD 04AC +04AE 04AF 04AE +04AF 04AF 04AE +04B0 04B1 04B0 +04B1 04B1 04B0 +04B2 04B3 04B2 +04B3 04B3 04B2 +04B4 04B5 04B4 +04B5 04B5 04B4 +04B6 04B7 04B6 +04B7 04B7 04B6 +04B8 04B9 04B8 +04B9 04B9 04B8 +04BA 04BB 04BA +04BB 04BB 04BA +04BC 04BD 04BC +04BD 04BD 04BC +04BE 04BF 04BE +04BF 04BF 04BE +04C1 04C2 04C1 +04C2 04C2 04C1 +04C3 04C4 04C3 +04C4 04C4 04C3 +04C7 04C8 04C7 +04C8 04C8 04C7 +04CB 04CC 04CB +04CC 04CC 04CB +04D0 04D1 04D0 +04D1 04D1 04D0 +04D2 04D3 04D2 +04D3 04D3 04D2 +04D4 04D5 04D4 +04D5 04D5 04D4 +04D6 04D7 04D6 +04D7 04D7 04D6 +04D8 04D9 04D8 +04D9 04D9 04D8 +04DA 04DB 04DA +04DB 04DB 04DA +04DC 04DD 04DC +04DD 04DD 04DC +04DE 04DF 04DE +04DF 04DF 04DE +04E0 04E1 04E0 +04E1 04E1 04E0 +04E2 04E3 04E2 +04E3 04E3 04E2 +04E4 04E5 04E4 +04E5 04E5 04E4 +04E6 04E7 04E6 +04E7 04E7 04E6 +04E8 04E9 04E8 +04E9 04E9 04E8 +04EA 04EB 04EA +04EB 04EB 04EA +04EC 04ED 04EC +04ED 04ED 04EC +04EE 04EF 04EE +04EF 04EF 04EE +04F0 04F1 04F0 +04F1 04F1 04F0 +04F2 04F3 04F2 +04F3 04F3 04F2 +04F4 04F5 04F4 +04F5 04F5 04F4 +04F8 04F9 04F8 +04F9 04F9 04F8 +0531 0561 0531 +0532 0562 0532 +0533 0563 0533 +0534 0564 0534 +0535 0565 0535 +0536 0566 0536 +0537 0567 0537 +0538 0568 0538 +0539 0569 0539 +053A 056A 053A +053B 056B 053B +053C 056C 053C +053D 056D 053D +053E 056E 053E +053F 056F 053F +0540 0570 0540 +0541 0571 0541 +0542 0572 0542 +0543 0573 0543 +0544 0574 0544 +0545 0575 0545 +0546 0576 0546 +0547 0577 0547 +0548 0578 0548 +0549 0579 0549 +054A 057A 054A +054B 057B 054B +054C 057C 054C +054D 057D 054D +054E 057E 054E +054F 057F 054F +0550 0580 0550 +0551 0581 0551 +0552 0582 0552 +0553 0583 0553 +0554 0584 0554 +0555 0585 0555 +0556 0586 0556 +0561 0561 0531 +0562 0562 0532 +0563 0563 0533 +0564 0564 0534 +0565 0565 0535 +0566 0566 0536 +0567 0567 0537 +0568 0568 0538 +0569 0569 0539 +056A 056A 053A +056B 056B 053B +056C 056C 053C +056D 056D 053D +056E 056E 053E +056F 056F 053F +0570 0570 0540 +0571 0571 0541 +0572 0572 0542 +0573 0573 0543 +0574 0574 0544 +0575 0575 0545 +0576 0576 0546 +0577 0577 0547 +0578 0578 0548 +0579 0579 0549 +057A 057A 054A +057B 057B 054B +057C 057C 054C +057D 057D 054D +057E 057E 054E +057F 057F 054F +0580 0580 0550 +0581 0581 0551 +0582 0582 0552 +0583 0583 0553 +0584 0584 0554 +0585 0585 0555 +0586 0586 0556 +1E00 1E01 1E00 +1E01 1E01 1E00 +1E02 1E03 1E02 +1E03 1E03 1E02 +1E04 1E05 1E04 +1E05 1E05 1E04 +1E06 1E07 1E06 +1E07 1E07 1E06 +1E08 1E09 1E08 +1E09 1E09 1E08 +1E0A 1E0B 1E0A +1E0B 1E0B 1E0A +1E0C 1E0D 1E0C +1E0D 1E0D 1E0C +1E0E 1E0F 1E0E +1E0F 1E0F 1E0E +1E10 1E11 1E10 +1E11 1E11 1E10 +1E12 1E13 1E12 +1E13 1E13 1E12 +1E14 1E15 1E14 +1E15 1E15 1E14 +1E16 1E17 1E16 +1E17 1E17 1E16 +1E18 1E19 1E18 +1E19 1E19 1E18 +1E1A 1E1B 1E1A +1E1B 1E1B 1E1A +1E1C 1E1D 1E1C +1E1D 1E1D 1E1C +1E1E 1E1F 1E1E +1E1F 1E1F 1E1E +1E20 1E21 1E20 +1E21 1E21 1E20 +1E22 1E23 1E22 +1E23 1E23 1E22 +1E24 1E25 1E24 +1E25 1E25 1E24 +1E26 1E27 1E26 +1E27 1E27 1E26 +1E28 1E29 1E28 +1E29 1E29 1E28 +1E2A 1E2B 1E2A +1E2B 1E2B 1E2A +1E2C 1E2D 1E2C +1E2D 1E2D 1E2C +1E2E 1E2F 1E2E +1E2F 1E2F 1E2E +1E30 1E31 1E30 +1E31 1E31 1E30 +1E32 1E33 1E32 +1E33 1E33 1E32 +1E34 1E35 1E34 +1E35 1E35 1E34 +1E36 1E37 1E36 +1E37 1E37 1E36 +1E38 1E39 1E38 +1E39 1E39 1E38 +1E3A 1E3B 1E3A +1E3B 1E3B 1E3A +1E3C 1E3D 1E3C +1E3D 1E3D 1E3C +1E3E 1E3F 1E3E +1E3F 1E3F 1E3E +1E40 1E41 1E40 +1E41 1E41 1E40 +1E42 1E43 1E42 +1E43 1E43 1E42 +1E44 1E45 1E44 +1E45 1E45 1E44 +1E46 1E47 1E46 +1E47 1E47 1E46 +1E48 1E49 1E48 +1E49 1E49 1E48 +1E4A 1E4B 1E4A +1E4B 1E4B 1E4A +1E4C 1E4D 1E4C +1E4D 1E4D 1E4C +1E4E 1E4F 1E4E +1E4F 1E4F 1E4E +1E50 1E51 1E50 +1E51 1E51 1E50 +1E52 1E53 1E52 +1E53 1E53 1E52 +1E54 1E55 1E54 +1E55 1E55 1E54 +1E56 1E57 1E56 +1E57 1E57 1E56 +1E58 1E59 1E58 +1E59 1E59 1E58 +1E5A 1E5B 1E5A +1E5B 1E5B 1E5A +1E5C 1E5D 1E5C +1E5D 1E5D 1E5C +1E5E 1E5F 1E5E +1E5F 1E5F 1E5E +1E60 1E61 1E60 +1E61 1E61 1E60 +1E62 1E63 1E62 +1E63 1E63 1E62 +1E64 1E65 1E64 +1E65 1E65 1E64 +1E66 1E67 1E66 +1E67 1E67 1E66 +1E68 1E69 1E68 +1E69 1E69 1E68 +1E6A 1E6B 1E6A +1E6B 1E6B 1E6A +1E6C 1E6D 1E6C +1E6D 1E6D 1E6C +1E6E 1E6F 1E6E +1E6F 1E6F 1E6E +1E70 1E71 1E70 +1E71 1E71 1E70 +1E72 1E73 1E72 +1E73 1E73 1E72 +1E74 1E75 1E74 +1E75 1E75 1E74 +1E76 1E77 1E76 +1E77 1E77 1E76 +1E78 1E79 1E78 +1E79 1E79 1E78 +1E7A 1E7B 1E7A +1E7B 1E7B 1E7A +1E7C 1E7D 1E7C +1E7D 1E7D 1E7C +1E7E 1E7F 1E7E +1E7F 1E7F 1E7E +1E80 1E81 1E80 +1E81 1E81 1E80 +1E82 1E83 1E82 +1E83 1E83 1E82 +1E84 1E85 1E84 +1E85 1E85 1E84 +1E86 1E87 1E86 +1E87 1E87 1E86 +1E88 1E89 1E88 +1E89 1E89 1E88 +1E8A 1E8B 1E8A +1E8B 1E8B 1E8A +1E8C 1E8D 1E8C +1E8D 1E8D 1E8C +1E8E 1E8F 1E8E +1E8F 1E8F 1E8E +1E90 1E91 1E90 +1E91 1E91 1E90 +1E92 1E93 1E92 +1E93 1E93 1E92 +1E94 1E95 1E94 +1E95 1E95 1E94 +1E9B 1E9B 1E60 +1EA0 1EA1 1EA0 +1EA1 1EA1 1EA0 +1EA2 1EA3 1EA2 +1EA3 1EA3 1EA2 +1EA4 1EA5 1EA4 +1EA5 1EA5 1EA4 +1EA6 1EA7 1EA6 +1EA7 1EA7 1EA6 +1EA8 1EA9 1EA8 +1EA9 1EA9 1EA8 +1EAA 1EAB 1EAA +1EAB 1EAB 1EAA +1EAC 1EAD 1EAC +1EAD 1EAD 1EAC +1EAE 1EAF 1EAE +1EAF 1EAF 1EAE +1EB0 1EB1 1EB0 +1EB1 1EB1 1EB0 +1EB2 1EB3 1EB2 +1EB3 1EB3 1EB2 +1EB4 1EB5 1EB4 +1EB5 1EB5 1EB4 +1EB6 1EB7 1EB6 +1EB7 1EB7 1EB6 +1EB8 1EB9 1EB8 +1EB9 1EB9 1EB8 +1EBA 1EBB 1EBA +1EBB 1EBB 1EBA +1EBC 1EBD 1EBC +1EBD 1EBD 1EBC +1EBE 1EBF 1EBE +1EBF 1EBF 1EBE +1EC0 1EC1 1EC0 +1EC1 1EC1 1EC0 +1EC2 1EC3 1EC2 +1EC3 1EC3 1EC2 +1EC4 1EC5 1EC4 +1EC5 1EC5 1EC4 +1EC6 1EC7 1EC6 +1EC7 1EC7 1EC6 +1EC8 1EC9 1EC8 +1EC9 1EC9 1EC8 +1ECA 1ECB 1ECA +1ECB 1ECB 1ECA +1ECC 1ECD 1ECC +1ECD 1ECD 1ECC +1ECE 1ECF 1ECE +1ECF 1ECF 1ECE +1ED0 1ED1 1ED0 +1ED1 1ED1 1ED0 +1ED2 1ED3 1ED2 +1ED3 1ED3 1ED2 +1ED4 1ED5 1ED4 +1ED5 1ED5 1ED4 +1ED6 1ED7 1ED6 +1ED7 1ED7 1ED6 +1ED8 1ED9 1ED8 +1ED9 1ED9 1ED8 +1EDA 1EDB 1EDA +1EDB 1EDB 1EDA +1EDC 1EDD 1EDC +1EDD 1EDD 1EDC +1EDE 1EDF 1EDE +1EDF 1EDF 1EDE +1EE0 1EE1 1EE0 +1EE1 1EE1 1EE0 +1EE2 1EE3 1EE2 +1EE3 1EE3 1EE2 +1EE4 1EE5 1EE4 +1EE5 1EE5 1EE4 +1EE6 1EE7 1EE6 +1EE7 1EE7 1EE6 +1EE8 1EE9 1EE8 +1EE9 1EE9 1EE8 +1EEA 1EEB 1EEA +1EEB 1EEB 1EEA +1EEC 1EED 1EEC +1EED 1EED 1EEC +1EEE 1EEF 1EEE +1EEF 1EEF 1EEE +1EF0 1EF1 1EF0 +1EF1 1EF1 1EF0 +1EF2 1EF3 1EF2 +1EF3 1EF3 1EF2 +1EF4 1EF5 1EF4 +1EF5 1EF5 1EF4 +1EF6 1EF7 1EF6 +1EF7 1EF7 1EF6 +1EF8 1EF9 1EF8 +1EF9 1EF9 1EF8 +1F00 1F00 1F08 +1F01 1F01 1F09 +1F02 1F02 1F0A +1F03 1F03 1F0B +1F04 1F04 1F0C +1F05 1F05 1F0D +1F06 1F06 1F0E +1F07 1F07 1F0F +1F08 1F00 1F08 +1F09 1F01 1F09 +1F0A 1F02 1F0A +1F0B 1F03 1F0B +1F0C 1F04 1F0C +1F0D 1F05 1F0D +1F0E 1F06 1F0E +1F0F 1F07 1F0F +1F10 1F10 1F18 +1F11 1F11 1F19 +1F12 1F12 1F1A +1F13 1F13 1F1B +1F14 1F14 1F1C +1F15 1F15 1F1D +1F18 1F10 1F18 +1F19 1F11 1F19 +1F1A 1F12 1F1A +1F1B 1F13 1F1B +1F1C 1F14 1F1C +1F1D 1F15 1F1D +1F20 1F20 1F28 +1F21 1F21 1F29 +1F22 1F22 1F2A +1F23 1F23 1F2B +1F24 1F24 1F2C +1F25 1F25 1F2D +1F26 1F26 1F2E +1F27 1F27 1F2F +1F28 1F20 1F28 +1F29 1F21 1F29 +1F2A 1F22 1F2A +1F2B 1F23 1F2B +1F2C 1F24 1F2C +1F2D 1F25 1F2D +1F2E 1F26 1F2E +1F2F 1F27 1F2F +1F30 1F30 1F38 +1F31 1F31 1F39 +1F32 1F32 1F3A +1F33 1F33 1F3B +1F34 1F34 1F3C +1F35 1F35 1F3D +1F36 1F36 1F3E +1F37 1F37 1F3F +1F38 1F30 1F38 +1F39 1F31 1F39 +1F3A 1F32 1F3A +1F3B 1F33 1F3B +1F3C 1F34 1F3C +1F3D 1F35 1F3D +1F3E 1F36 1F3E +1F3F 1F37 1F3F +1F40 1F40 1F48 +1F41 1F41 1F49 +1F42 1F42 1F4A +1F43 1F43 1F4B +1F44 1F44 1F4C +1F45 1F45 1F4D +1F48 1F40 1F48 +1F49 1F41 1F49 +1F4A 1F42 1F4A +1F4B 1F43 1F4B +1F4C 1F44 1F4C +1F4D 1F45 1F4D +1F51 1F51 1F59 +1F53 1F53 1F5B +1F55 1F55 1F5D +1F57 1F57 1F5F +1F59 1F51 1F59 +1F5B 1F53 1F5B +1F5D 1F55 1F5D +1F5F 1F57 1F5F +1F60 1F60 1F68 +1F61 1F61 1F69 +1F62 1F62 1F6A +1F63 1F63 1F6B +1F64 1F64 1F6C +1F65 1F65 1F6D +1F66 1F66 1F6E +1F67 1F67 1F6F +1F68 1F60 1F68 +1F69 1F61 1F69 +1F6A 1F62 1F6A +1F6B 1F63 1F6B +1F6C 1F64 1F6C +1F6D 1F65 1F6D +1F6E 1F66 1F6E +1F6F 1F67 1F6F +1F70 1F70 1FBA +1F71 1F71 1FBB +1F72 1F72 1FC8 +1F73 1F73 1FC9 +1F74 1F74 1FCA +1F75 1F75 1FCB +1F76 1F76 1FDA +1F77 1F77 1FDB +1F78 1F78 1FF8 +1F79 1F79 1FF9 +1F7A 1F7A 1FEA +1F7B 1F7B 1FEB +1F7C 1F7C 1FFA +1F7D 1F7D 1FFB +1F80 1F80 1F88 +1F81 1F81 1F89 +1F82 1F82 1F8A +1F83 1F83 1F8B +1F84 1F84 1F8C +1F85 1F85 1F8D +1F86 1F86 1F8E +1F87 1F87 1F8F +1F88 1F80 1F88 +1F89 1F81 1F89 +1F8A 1F82 1F8A +1F8B 1F83 1F8B +1F8C 1F84 1F8C +1F8D 1F85 1F8D +1F8E 1F86 1F8E +1F8F 1F87 1F8F +1F90 1F90 1F98 +1F91 1F91 1F99 +1F92 1F92 1F9A +1F93 1F93 1F9B +1F94 1F94 1F9C +1F95 1F95 1F9D +1F96 1F96 1F9E +1F97 1F97 1F9F +1F98 1F90 1F98 +1F99 1F91 1F99 +1F9A 1F92 1F9A +1F9B 1F93 1F9B +1F9C 1F94 1F9C +1F9D 1F95 1F9D +1F9E 1F96 1F9E +1F9F 1F97 1F9F +1FA0 1FA0 1FA8 +1FA1 1FA1 1FA9 +1FA2 1FA2 1FAA +1FA3 1FA3 1FAB +1FA4 1FA4 1FAC +1FA5 1FA5 1FAD +1FA6 1FA6 1FAE +1FA7 1FA7 1FAF +1FA8 1FA0 1FA8 +1FA9 1FA1 1FA9 +1FAA 1FA2 1FAA +1FAB 1FA3 1FAB +1FAC 1FA4 1FAC +1FAD 1FA5 1FAD +1FAE 1FA6 1FAE +1FAF 1FA7 1FAF +1FB0 1FB0 1FB8 +1FB1 1FB1 1FB9 +1FB3 1FB3 1FBC +1FB8 1FB0 1FB8 +1FB9 1FB1 1FB9 +1FBA 1F70 1FBA +1FBB 1F71 1FBB +1FBC 1FB3 1FBC +1FBE 1FBE 0399 +1FC3 1FC3 1FCC +1FC8 1F72 1FC8 +1FC9 1F73 1FC9 +1FCA 1F74 1FCA +1FCB 1F75 1FCB +1FCC 1FC3 1FCC +1FD0 1FD0 1FD8 +1FD1 1FD1 1FD9 +1FD8 1FD0 1FD8 +1FD9 1FD1 1FD9 +1FDA 1F76 1FDA +1FDB 1F77 1FDB +1FE0 1FE0 1FE8 +1FE1 1FE1 1FE9 +1FE5 1FE5 1FEC +1FE8 1FE0 1FE8 +1FE9 1FE1 1FE9 +1FEA 1F7A 1FEA +1FEB 1F7B 1FEB +1FEC 1FE5 1FEC +1FF3 1FF3 1FFC +1FF8 1F78 1FF8 +1FF9 1F79 1FF9 +1FFA 1F7C 1FFA +1FFB 1F7D 1FFB +1FFC 1FF3 1FFC +2126 03C9 2126 +212A 006B 212A +212B 00E5 212B +2160 2170 2160 +2161 2171 2161 +2162 2172 2162 +2163 2173 2163 +2164 2174 2164 +2165 2175 2165 +2166 2176 2166 +2167 2177 2167 +2168 2178 2168 +2169 2179 2169 +216A 217A 216A +216B 217B 216B +216C 217C 216C +216D 217D 216D +216E 217E 216E +216F 217F 216F +2170 2170 2160 +2171 2171 2161 +2172 2172 2162 +2173 2173 2163 +2174 2174 2164 +2175 2175 2165 +2176 2176 2166 +2177 2177 2167 +2178 2178 2168 +2179 2179 2169 +217A 217A 216A +217B 217B 216B +217C 217C 216C +217D 217D 216D +217E 217E 216E +217F 217F 216F +24B6 24D0 24B6 +24B7 24D1 24B7 +24B8 24D2 24B8 +24B9 24D3 24B9 +24BA 24D4 24BA +24BB 24D5 24BB +24BC 24D6 24BC +24BD 24D7 24BD +24BE 24D8 24BE +24BF 24D9 24BF +24C0 24DA 24C0 +24C1 24DB 24C1 +24C2 24DC 24C2 +24C3 24DD 24C3 +24C4 24DE 24C4 +24C5 24DF 24C5 +24C6 24E0 24C6 +24C7 24E1 24C7 +24C8 24E2 24C8 +24C9 24E3 24C9 +24CA 24E4 24CA +24CB 24E5 24CB +24CC 24E6 24CC +24CD 24E7 24CD +24CE 24E8 24CE +24CF 24E9 24CF +24D0 24D0 24B6 +24D1 24D1 24B7 +24D2 24D2 24B8 +24D3 24D3 24B9 +24D4 24D4 24BA +24D5 24D5 24BB +24D6 24D6 24BC +24D7 24D7 24BD +24D8 24D8 24BE +24D9 24D9 24BF +24DA 24DA 24C0 +24DB 24DB 24C1 +24DC 24DC 24C2 +24DD 24DD 24C3 +24DE 24DE 24C4 +24DF 24DF 24C5 +24E0 24E0 24C6 +24E1 24E1 24C7 +24E2 24E2 24C8 +24E3 24E3 24C9 +24E4 24E4 24CA +24E5 24E5 24CB +24E6 24E6 24CC +24E7 24E7 24CD +24E8 24E8 24CE +24E9 24E9 24CF +FF21 FF41 FF21 +FF22 FF42 FF22 +FF23 FF43 FF23 +FF24 FF44 FF24 +FF25 FF45 FF25 +FF26 FF46 FF26 +FF27 FF47 FF27 +FF28 FF48 FF28 +FF29 FF49 FF29 +FF2A FF4A FF2A +FF2B FF4B FF2B +FF2C FF4C FF2C +FF2D FF4D FF2D +FF2E FF4E FF2E +FF2F FF4F FF2F +FF30 FF50 FF30 +FF31 FF51 FF31 +FF32 FF52 FF32 +FF33 FF53 FF33 +FF34 FF54 FF34 +FF35 FF55 FF35 +FF36 FF56 FF36 +FF37 FF57 FF37 +FF38 FF58 FF38 +FF39 FF59 FF39 +FF3A FF5A FF3A +FF41 FF41 FF21 +FF42 FF42 FF22 +FF43 FF43 FF23 +FF44 FF44 FF24 +FF45 FF45 FF25 +FF46 FF46 FF26 +FF47 FF47 FF27 +FF48 FF48 FF28 +FF49 FF49 FF29 +FF4A FF4A FF2A +FF4B FF4B FF2B +FF4C FF4C FF2C +FF4D FF4D FF2D +FF4E FF4E FF2E +FF4F FF4F FF2F +FF50 FF50 FF30 +FF51 FF51 FF31 +FF52 FF52 FF32 +FF53 FF53 FF33 +FF54 FF54 FF34 +FF55 FF55 FF35 +FF56 FF56 FF36 +FF57 FF57 FF37 +FF58 FF58 FF38 +FF59 FF59 FF39 +FF5A FF5A FF3A +DROP VIEW v_bmp; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_ucs2_turkish_ci_casefold.test b/mysql-test/main/ctype_ucs2_turkish_ci_casefold.test new file mode 100644 index 0000000000000..d944767961098 --- /dev/null +++ b/mysql-test/main/ctype_ucs2_turkish_ci_casefold.test @@ -0,0 +1,14 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET @@collation_connection=ucs2_turkish_ci; +--source include/ctype_unicode_casefold_bmp.inc + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/ctype_ucs2_uca.result b/mysql-test/main/ctype_ucs2_uca.result index 24667ff6949b5..430f0ec1c372f 100644 --- a/mysql-test/main/ctype_ucs2_uca.result +++ b/mysql-test/main/ctype_ucs2_uca.result @@ -16,7 +16,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_unicode_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE ucs2_unicode_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_unicode_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -154,7 +154,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_unicode_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE ucs2_unicode_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_unicode_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -293,7 +293,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_unicode_520_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE ucs2_unicode_520_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_unicode_520_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -431,7 +431,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_unicode_520_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE ucs2_unicode_520_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_unicode_520_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -572,7 +572,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(50) CHARACTER SET ucs2 COLLATE ucs2_unicode_520_nopad_ci DEFAULT NULL, KEY `a` (`a`), KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('111', '111'); INSERT INTO t1 VALUES ('222', '222'); INSERT INTO t1 VALUES ('333', '333'); diff --git a/mysql-test/main/ctype_ucs2_unicode_520_ci_casefold.result b/mysql-test/main/ctype_ucs2_unicode_520_ci_casefold.result new file mode 100644 index 0000000000000..ecac75b27eb08 --- /dev/null +++ b/mysql-test/main/ctype_ucs2_unicode_520_ci_casefold.result @@ -0,0 +1,2011 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET @@collation_connection=ucs2_unicode_520_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +ucs2_unicode_520_ci +SELECT +codepoint_hex4, +HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)), +HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +FROM v_bmp +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); +codepoint_hex4 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +0041 0061 0041 +0042 0062 0042 +0043 0063 0043 +0044 0064 0044 +0045 0065 0045 +0046 0066 0046 +0047 0067 0047 +0048 0068 0048 +0049 0069 0049 +004A 006A 004A +004B 006B 004B +004C 006C 004C +004D 006D 004D +004E 006E 004E +004F 006F 004F +0050 0070 0050 +0051 0071 0051 +0052 0072 0052 +0053 0073 0053 +0054 0074 0054 +0055 0075 0055 +0056 0076 0056 +0057 0077 0057 +0058 0078 0058 +0059 0079 0059 +005A 007A 005A +0061 0061 0041 +0062 0062 0042 +0063 0063 0043 +0064 0064 0044 +0065 0065 0045 +0066 0066 0046 +0067 0067 0047 +0068 0068 0048 +0069 0069 0049 +006A 006A 004A +006B 006B 004B +006C 006C 004C +006D 006D 004D +006E 006E 004E +006F 006F 004F +0070 0070 0050 +0071 0071 0051 +0072 0072 0052 +0073 0073 0053 +0074 0074 0054 +0075 0075 0055 +0076 0076 0056 +0077 0077 0057 +0078 0078 0058 +0079 0079 0059 +007A 007A 005A +00B5 00B5 039C +00C0 00E0 00C0 +00C1 00E1 00C1 +00C2 00E2 00C2 +00C3 00E3 00C3 +00C4 00E4 00C4 +00C5 00E5 00C5 +00C6 00E6 00C6 +00C7 00E7 00C7 +00C8 00E8 00C8 +00C9 00E9 00C9 +00CA 00EA 00CA +00CB 00EB 00CB +00CC 00EC 00CC +00CD 00ED 00CD +00CE 00EE 00CE +00CF 00EF 00CF +00D0 00F0 00D0 +00D1 00F1 00D1 +00D2 00F2 00D2 +00D3 00F3 00D3 +00D4 00F4 00D4 +00D5 00F5 00D5 +00D6 00F6 00D6 +00D8 00F8 00D8 +00D9 00F9 00D9 +00DA 00FA 00DA +00DB 00FB 00DB +00DC 00FC 00DC +00DD 00FD 00DD +00DE 00FE 00DE +00E0 00E0 00C0 +00E1 00E1 00C1 +00E2 00E2 00C2 +00E3 00E3 00C3 +00E4 00E4 00C4 +00E5 00E5 00C5 +00E6 00E6 00C6 +00E7 00E7 00C7 +00E8 00E8 00C8 +00E9 00E9 00C9 +00EA 00EA 00CA +00EB 00EB 00CB +00EC 00EC 00CC +00ED 00ED 00CD +00EE 00EE 00CE +00EF 00EF 00CF +00F0 00F0 00D0 +00F1 00F1 00D1 +00F2 00F2 00D2 +00F3 00F3 00D3 +00F4 00F4 00D4 +00F5 00F5 00D5 +00F6 00F6 00D6 +00F8 00F8 00D8 +00F9 00F9 00D9 +00FA 00FA 00DA +00FB 00FB 00DB +00FC 00FC 00DC +00FD 00FD 00DD +00FE 00FE 00DE +00FF 00FF 0178 +0100 0101 0100 +0101 0101 0100 +0102 0103 0102 +0103 0103 0102 +0104 0105 0104 +0105 0105 0104 +0106 0107 0106 +0107 0107 0106 +0108 0109 0108 +0109 0109 0108 +010A 010B 010A +010B 010B 010A +010C 010D 010C +010D 010D 010C +010E 010F 010E +010F 010F 010E +0110 0111 0110 +0111 0111 0110 +0112 0113 0112 +0113 0113 0112 +0114 0115 0114 +0115 0115 0114 +0116 0117 0116 +0117 0117 0116 +0118 0119 0118 +0119 0119 0118 +011A 011B 011A +011B 011B 011A +011C 011D 011C +011D 011D 011C +011E 011F 011E +011F 011F 011E +0120 0121 0120 +0121 0121 0120 +0122 0123 0122 +0123 0123 0122 +0124 0125 0124 +0125 0125 0124 +0126 0127 0126 +0127 0127 0126 +0128 0129 0128 +0129 0129 0128 +012A 012B 012A +012B 012B 012A +012C 012D 012C +012D 012D 012C +012E 012F 012E +012F 012F 012E +0130 0069 0130 +0131 0131 0049 +0132 0133 0132 +0133 0133 0132 +0134 0135 0134 +0135 0135 0134 +0136 0137 0136 +0137 0137 0136 +0139 013A 0139 +013A 013A 0139 +013B 013C 013B +013C 013C 013B +013D 013E 013D +013E 013E 013D +013F 0140 013F +0140 0140 013F +0141 0142 0141 +0142 0142 0141 +0143 0144 0143 +0144 0144 0143 +0145 0146 0145 +0146 0146 0145 +0147 0148 0147 +0148 0148 0147 +014A 014B 014A +014B 014B 014A +014C 014D 014C +014D 014D 014C +014E 014F 014E +014F 014F 014E +0150 0151 0150 +0151 0151 0150 +0152 0153 0152 +0153 0153 0152 +0154 0155 0154 +0155 0155 0154 +0156 0157 0156 +0157 0157 0156 +0158 0159 0158 +0159 0159 0158 +015A 015B 015A +015B 015B 015A +015C 015D 015C +015D 015D 015C +015E 015F 015E +015F 015F 015E +0160 0161 0160 +0161 0161 0160 +0162 0163 0162 +0163 0163 0162 +0164 0165 0164 +0165 0165 0164 +0166 0167 0166 +0167 0167 0166 +0168 0169 0168 +0169 0169 0168 +016A 016B 016A +016B 016B 016A +016C 016D 016C +016D 016D 016C +016E 016F 016E +016F 016F 016E +0170 0171 0170 +0171 0171 0170 +0172 0173 0172 +0173 0173 0172 +0174 0175 0174 +0175 0175 0174 +0176 0177 0176 +0177 0177 0176 +0178 00FF 0178 +0179 017A 0179 +017A 017A 0179 +017B 017C 017B +017C 017C 017B +017D 017E 017D +017E 017E 017D +017F 017F 0053 +0180 0180 0243 +0181 0253 0181 +0182 0183 0182 +0183 0183 0182 +0184 0185 0184 +0185 0185 0184 +0186 0254 0186 +0187 0188 0187 +0188 0188 0187 +0189 0256 0189 +018A 0257 018A +018B 018C 018B +018C 018C 018B +018E 01DD 018E +018F 0259 018F +0190 025B 0190 +0191 0192 0191 +0192 0192 0191 +0193 0260 0193 +0194 0263 0194 +0195 0195 01F6 +0196 0269 0196 +0197 0268 0197 +0198 0199 0198 +0199 0199 0198 +019A 019A 023D +019C 026F 019C +019D 0272 019D +019E 019E 0220 +019F 0275 019F +01A0 01A1 01A0 +01A1 01A1 01A0 +01A2 01A3 01A2 +01A3 01A3 01A2 +01A4 01A5 01A4 +01A5 01A5 01A4 +01A6 0280 01A6 +01A7 01A8 01A7 +01A8 01A8 01A7 +01A9 0283 01A9 +01AC 01AD 01AC +01AD 01AD 01AC +01AE 0288 01AE +01AF 01B0 01AF +01B0 01B0 01AF +01B1 028A 01B1 +01B2 028B 01B2 +01B3 01B4 01B3 +01B4 01B4 01B3 +01B5 01B6 01B5 +01B6 01B6 01B5 +01B7 0292 01B7 +01B8 01B9 01B8 +01B9 01B9 01B8 +01BC 01BD 01BC +01BD 01BD 01BC +01BF 01BF 01F7 +01C4 01C6 01C4 +01C5 01C6 01C4 +01C6 01C6 01C4 +01C7 01C9 01C7 +01C8 01C9 01C7 +01C9 01C9 01C7 +01CA 01CC 01CA +01CB 01CC 01CA +01CC 01CC 01CA +01CD 01CE 01CD +01CE 01CE 01CD +01CF 01D0 01CF +01D0 01D0 01CF +01D1 01D2 01D1 +01D2 01D2 01D1 +01D3 01D4 01D3 +01D4 01D4 01D3 +01D5 01D6 01D5 +01D6 01D6 01D5 +01D7 01D8 01D7 +01D8 01D8 01D7 +01D9 01DA 01D9 +01DA 01DA 01D9 +01DB 01DC 01DB +01DC 01DC 01DB +01DD 01DD 018E +01DE 01DF 01DE +01DF 01DF 01DE +01E0 01E1 01E0 +01E1 01E1 01E0 +01E2 01E3 01E2 +01E3 01E3 01E2 +01E4 01E5 01E4 +01E5 01E5 01E4 +01E6 01E7 01E6 +01E7 01E7 01E6 +01E8 01E9 01E8 +01E9 01E9 01E8 +01EA 01EB 01EA +01EB 01EB 01EA +01EC 01ED 01EC +01ED 01ED 01EC +01EE 01EF 01EE +01EF 01EF 01EE +01F1 01F3 01F1 +01F2 01F3 01F1 +01F3 01F3 01F1 +01F4 01F5 01F4 +01F5 01F5 01F4 +01F6 0195 01F6 +01F7 01BF 01F7 +01F8 01F9 01F8 +01F9 01F9 01F8 +01FA 01FB 01FA +01FB 01FB 01FA +01FC 01FD 01FC +01FD 01FD 01FC +01FE 01FF 01FE +01FF 01FF 01FE +0200 0201 0200 +0201 0201 0200 +0202 0203 0202 +0203 0203 0202 +0204 0205 0204 +0205 0205 0204 +0206 0207 0206 +0207 0207 0206 +0208 0209 0208 +0209 0209 0208 +020A 020B 020A +020B 020B 020A +020C 020D 020C +020D 020D 020C +020E 020F 020E +020F 020F 020E +0210 0211 0210 +0211 0211 0210 +0212 0213 0212 +0213 0213 0212 +0214 0215 0214 +0215 0215 0214 +0216 0217 0216 +0217 0217 0216 +0218 0219 0218 +0219 0219 0218 +021A 021B 021A +021B 021B 021A +021C 021D 021C +021D 021D 021C +021E 021F 021E +021F 021F 021E +0220 019E 0220 +0222 0223 0222 +0223 0223 0222 +0224 0225 0224 +0225 0225 0224 +0226 0227 0226 +0227 0227 0226 +0228 0229 0228 +0229 0229 0228 +022A 022B 022A +022B 022B 022A +022C 022D 022C +022D 022D 022C +022E 022F 022E +022F 022F 022E +0230 0231 0230 +0231 0231 0230 +0232 0233 0232 +0233 0233 0232 +023A 2C65 023A +023B 023C 023B +023C 023C 023B +023D 019A 023D +023E 2C66 023E +023F 023F 2C7E +0240 0240 2C7F +0241 0242 0241 +0242 0242 0241 +0243 0180 0243 +0244 0289 0244 +0245 028C 0245 +0246 0247 0246 +0247 0247 0246 +0248 0249 0248 +0249 0249 0248 +024A 024B 024A +024B 024B 024A +024C 024D 024C +024D 024D 024C +024E 024F 024E +024F 024F 024E +0250 0250 2C6F +0251 0251 2C6D +0252 0252 2C70 +0253 0253 0181 +0254 0254 0186 +0256 0256 0189 +0257 0257 018A +0259 0259 018F +025B 025B 0190 +0260 0260 0193 +0263 0263 0194 +0268 0268 0197 +0269 0269 0196 +026B 026B 2C62 +026F 026F 019C +0271 0271 2C6E +0272 0272 019D +0275 0275 019F +027D 027D 2C64 +0280 0280 01A6 +0283 0283 01A9 +0288 0288 01AE +0289 0289 0244 +028A 028A 01B1 +028B 028B 01B2 +028C 028C 0245 +0292 0292 01B7 +0345 0345 0399 +0370 0371 0370 +0371 0371 0370 +0372 0373 0372 +0373 0373 0372 +0376 0377 0376 +0377 0377 0376 +037B 037B 03FD +037C 037C 03FE +037D 037D 03FF +0386 03AC 0386 +0388 03AD 0388 +0389 03AE 0389 +038A 03AF 038A +038C 03CC 038C +038E 03CD 038E +038F 03CE 038F +0391 03B1 0391 +0392 03B2 0392 +0393 03B3 0393 +0394 03B4 0394 +0395 03B5 0395 +0396 03B6 0396 +0397 03B7 0397 +0398 03B8 0398 +0399 03B9 0399 +039A 03BA 039A +039B 03BB 039B +039C 03BC 039C +039D 03BD 039D +039E 03BE 039E +039F 03BF 039F +03A0 03C0 03A0 +03A1 03C1 03A1 +03A3 03C3 03A3 +03A4 03C4 03A4 +03A5 03C5 03A5 +03A6 03C6 03A6 +03A7 03C7 03A7 +03A8 03C8 03A8 +03A9 03C9 03A9 +03AA 03CA 03AA +03AB 03CB 03AB +03AC 03AC 0386 +03AD 03AD 0388 +03AE 03AE 0389 +03AF 03AF 038A +03B1 03B1 0391 +03B2 03B2 0392 +03B3 03B3 0393 +03B4 03B4 0394 +03B5 03B5 0395 +03B6 03B6 0396 +03B7 03B7 0397 +03B8 03B8 0398 +03B9 03B9 0399 +03BA 03BA 039A +03BB 03BB 039B +03BC 03BC 039C +03BD 03BD 039D +03BE 03BE 039E +03BF 03BF 039F +03C0 03C0 03A0 +03C1 03C1 03A1 +03C2 03C2 03A3 +03C3 03C3 03A3 +03C4 03C4 03A4 +03C5 03C5 03A5 +03C6 03C6 03A6 +03C7 03C7 03A7 +03C8 03C8 03A8 +03C9 03C9 03A9 +03CA 03CA 03AA +03CB 03CB 03AB +03CC 03CC 038C +03CD 03CD 038E +03CE 03CE 038F +03CF 03D7 03CF +03D0 03D0 0392 +03D1 03D1 0398 +03D5 03D5 03A6 +03D6 03D6 03A0 +03D7 03D7 03CF +03D8 03D9 03D8 +03D9 03D9 03D8 +03DA 03DB 03DA +03DB 03DB 03DA +03DC 03DD 03DC +03DD 03DD 03DC +03DE 03DF 03DE +03DF 03DF 03DE +03E0 03E1 03E0 +03E1 03E1 03E0 +03E2 03E3 03E2 +03E3 03E3 03E2 +03E4 03E5 03E4 +03E5 03E5 03E4 +03E6 03E7 03E6 +03E7 03E7 03E6 +03E8 03E9 03E8 +03E9 03E9 03E8 +03EA 03EB 03EA +03EB 03EB 03EA +03EC 03ED 03EC +03ED 03ED 03EC +03EE 03EF 03EE +03EF 03EF 03EE +03F0 03F0 039A +03F1 03F1 03A1 +03F2 03F2 03F9 +03F4 03B8 03F4 +03F5 03F5 0395 +03F7 03F8 03F7 +03F8 03F8 03F7 +03F9 03F2 03F9 +03FA 03FB 03FA +03FB 03FB 03FA +03FD 037B 03FD +03FE 037C 03FE +03FF 037D 03FF +0400 0450 0400 +0401 0451 0401 +0402 0452 0402 +0403 0453 0403 +0404 0454 0404 +0405 0455 0405 +0406 0456 0406 +0407 0457 0407 +0408 0458 0408 +0409 0459 0409 +040A 045A 040A +040B 045B 040B +040C 045C 040C +040D 045D 040D +040E 045E 040E +040F 045F 040F +0410 0430 0410 +0411 0431 0411 +0412 0432 0412 +0413 0433 0413 +0414 0434 0414 +0415 0435 0415 +0416 0436 0416 +0417 0437 0417 +0418 0438 0418 +0419 0439 0419 +041A 043A 041A +041B 043B 041B +041C 043C 041C +041D 043D 041D +041E 043E 041E +041F 043F 041F +0420 0440 0420 +0421 0441 0421 +0422 0442 0422 +0423 0443 0423 +0424 0444 0424 +0425 0445 0425 +0426 0446 0426 +0427 0447 0427 +0428 0448 0428 +0429 0449 0429 +042A 044A 042A +042B 044B 042B +042C 044C 042C +042D 044D 042D +042E 044E 042E +042F 044F 042F +0430 0430 0410 +0431 0431 0411 +0432 0432 0412 +0433 0433 0413 +0434 0434 0414 +0435 0435 0415 +0436 0436 0416 +0437 0437 0417 +0438 0438 0418 +0439 0439 0419 +043A 043A 041A +043B 043B 041B +043C 043C 041C +043D 043D 041D +043E 043E 041E +043F 043F 041F +0440 0440 0420 +0441 0441 0421 +0442 0442 0422 +0443 0443 0423 +0444 0444 0424 +0445 0445 0425 +0446 0446 0426 +0447 0447 0427 +0448 0448 0428 +0449 0449 0429 +044A 044A 042A +044B 044B 042B +044C 044C 042C +044D 044D 042D +044E 044E 042E +044F 044F 042F +0450 0450 0400 +0451 0451 0401 +0452 0452 0402 +0453 0453 0403 +0454 0454 0404 +0455 0455 0405 +0456 0456 0406 +0457 0457 0407 +0458 0458 0408 +0459 0459 0409 +045A 045A 040A +045B 045B 040B +045C 045C 040C +045D 045D 040D +045E 045E 040E +045F 045F 040F +0460 0461 0460 +0461 0461 0460 +0462 0463 0462 +0463 0463 0462 +0464 0465 0464 +0465 0465 0464 +0466 0467 0466 +0467 0467 0466 +0468 0469 0468 +0469 0469 0468 +046A 046B 046A +046B 046B 046A +046C 046D 046C +046D 046D 046C +046E 046F 046E +046F 046F 046E +0470 0471 0470 +0471 0471 0470 +0472 0473 0472 +0473 0473 0472 +0474 0475 0474 +0475 0475 0474 +0476 0477 0476 +0477 0477 0476 +0478 0479 0478 +0479 0479 0478 +047A 047B 047A +047B 047B 047A +047C 047D 047C +047D 047D 047C +047E 047F 047E +047F 047F 047E +0480 0481 0480 +0481 0481 0480 +048A 048B 048A +048B 048B 048A +048C 048D 048C +048D 048D 048C +048E 048F 048E +048F 048F 048E +0490 0491 0490 +0491 0491 0490 +0492 0493 0492 +0493 0493 0492 +0494 0495 0494 +0495 0495 0494 +0496 0497 0496 +0497 0497 0496 +0498 0499 0498 +0499 0499 0498 +049A 049B 049A +049B 049B 049A +049C 049D 049C +049D 049D 049C +049E 049F 049E +049F 049F 049E +04A0 04A1 04A0 +04A1 04A1 04A0 +04A2 04A3 04A2 +04A3 04A3 04A2 +04A4 04A5 04A4 +04A5 04A5 04A4 +04A6 04A7 04A6 +04A7 04A7 04A6 +04A8 04A9 04A8 +04A9 04A9 04A8 +04AA 04AB 04AA +04AB 04AB 04AA +04AC 04AD 04AC +04AD 04AD 04AC +04AE 04AF 04AE +04AF 04AF 04AE +04B0 04B1 04B0 +04B1 04B1 04B0 +04B2 04B3 04B2 +04B3 04B3 04B2 +04B4 04B5 04B4 +04B5 04B5 04B4 +04B6 04B7 04B6 +04B7 04B7 04B6 +04B8 04B9 04B8 +04B9 04B9 04B8 +04BA 04BB 04BA +04BB 04BB 04BA +04BC 04BD 04BC +04BD 04BD 04BC +04BE 04BF 04BE +04BF 04BF 04BE +04C0 04CF 04C0 +04C1 04C2 04C1 +04C2 04C2 04C1 +04C3 04C4 04C3 +04C4 04C4 04C3 +04C5 04C6 04C5 +04C6 04C6 04C5 +04C7 04C8 04C7 +04C8 04C8 04C7 +04C9 04CA 04C9 +04CA 04CA 04C9 +04CB 04CC 04CB +04CC 04CC 04CB +04CD 04CE 04CD +04CE 04CE 04CD +04CF 04CF 04C0 +04D0 04D1 04D0 +04D1 04D1 04D0 +04D2 04D3 04D2 +04D3 04D3 04D2 +04D4 04D5 04D4 +04D5 04D5 04D4 +04D6 04D7 04D6 +04D7 04D7 04D6 +04D8 04D9 04D8 +04D9 04D9 04D8 +04DA 04DB 04DA +04DB 04DB 04DA +04DC 04DD 04DC +04DD 04DD 04DC +04DE 04DF 04DE +04DF 04DF 04DE +04E0 04E1 04E0 +04E1 04E1 04E0 +04E2 04E3 04E2 +04E3 04E3 04E2 +04E4 04E5 04E4 +04E5 04E5 04E4 +04E6 04E7 04E6 +04E7 04E7 04E6 +04E8 04E9 04E8 +04E9 04E9 04E8 +04EA 04EB 04EA +04EB 04EB 04EA +04EC 04ED 04EC +04ED 04ED 04EC +04EE 04EF 04EE +04EF 04EF 04EE +04F0 04F1 04F0 +04F1 04F1 04F0 +04F2 04F3 04F2 +04F3 04F3 04F2 +04F4 04F5 04F4 +04F5 04F5 04F4 +04F6 04F7 04F6 +04F7 04F7 04F6 +04F8 04F9 04F8 +04F9 04F9 04F8 +04FA 04FB 04FA +04FB 04FB 04FA +04FC 04FD 04FC +04FD 04FD 04FC +04FE 04FF 04FE +04FF 04FF 04FE +0500 0501 0500 +0501 0501 0500 +0502 0503 0502 +0503 0503 0502 +0504 0505 0504 +0505 0505 0504 +0506 0507 0506 +0507 0507 0506 +0508 0509 0508 +0509 0509 0508 +050A 050B 050A +050B 050B 050A +050C 050D 050C +050D 050D 050C +050E 050F 050E +050F 050F 050E +0510 0511 0510 +0511 0511 0510 +0512 0513 0512 +0513 0513 0512 +0514 0515 0514 +0515 0515 0514 +0516 0517 0516 +0517 0517 0516 +0518 0519 0518 +0519 0519 0518 +051A 051B 051A +051B 051B 051A +051C 051D 051C +051D 051D 051C +051E 051F 051E +051F 051F 051E +0520 0521 0520 +0521 0521 0520 +0522 0523 0522 +0523 0523 0522 +0524 0525 0524 +0525 0525 0524 +0531 0561 0531 +0532 0562 0532 +0533 0563 0533 +0534 0564 0534 +0535 0565 0535 +0536 0566 0536 +0537 0567 0537 +0538 0568 0538 +0539 0569 0539 +053A 056A 053A +053B 056B 053B +053C 056C 053C +053D 056D 053D +053E 056E 053E +053F 056F 053F +0540 0570 0540 +0541 0571 0541 +0542 0572 0542 +0543 0573 0543 +0544 0574 0544 +0545 0575 0545 +0546 0576 0546 +0547 0577 0547 +0548 0578 0548 +0549 0579 0549 +054A 057A 054A +054B 057B 054B +054C 057C 054C +054D 057D 054D +054E 057E 054E +054F 057F 054F +0550 0580 0550 +0551 0581 0551 +0552 0582 0552 +0553 0583 0553 +0554 0584 0554 +0555 0585 0555 +0556 0586 0556 +0561 0561 0531 +0562 0562 0532 +0563 0563 0533 +0564 0564 0534 +0565 0565 0535 +0566 0566 0536 +0567 0567 0537 +0568 0568 0538 +0569 0569 0539 +056A 056A 053A +056B 056B 053B +056C 056C 053C +056D 056D 053D +056E 056E 053E +056F 056F 053F +0570 0570 0540 +0571 0571 0541 +0572 0572 0542 +0573 0573 0543 +0574 0574 0544 +0575 0575 0545 +0576 0576 0546 +0577 0577 0547 +0578 0578 0548 +0579 0579 0549 +057A 057A 054A +057B 057B 054B +057C 057C 054C +057D 057D 054D +057E 057E 054E +057F 057F 054F +0580 0580 0550 +0581 0581 0551 +0582 0582 0552 +0583 0583 0553 +0584 0584 0554 +0585 0585 0555 +0586 0586 0556 +10A0 2D00 10A0 +10A1 2D01 10A1 +10A2 2D02 10A2 +10A3 2D03 10A3 +10A4 2D04 10A4 +10A5 2D05 10A5 +10A6 2D06 10A6 +10A7 2D07 10A7 +10A8 2D08 10A8 +10A9 2D09 10A9 +10AA 2D0A 10AA +10AB 2D0B 10AB +10AC 2D0C 10AC +10AD 2D0D 10AD +10AE 2D0E 10AE +10AF 2D0F 10AF +10B0 2D10 10B0 +10B1 2D11 10B1 +10B2 2D12 10B2 +10B3 2D13 10B3 +10B4 2D14 10B4 +10B5 2D15 10B5 +10B6 2D16 10B6 +10B7 2D17 10B7 +10B8 2D18 10B8 +10B9 2D19 10B9 +10BA 2D1A 10BA +10BB 2D1B 10BB +10BC 2D1C 10BC +10BD 2D1D 10BD +10BE 2D1E 10BE +10BF 2D1F 10BF +10C0 2D20 10C0 +10C1 2D21 10C1 +10C2 2D22 10C2 +10C3 2D23 10C3 +10C4 2D24 10C4 +10C5 2D25 10C5 +1D79 1D79 A77D +1D7D 1D7D 2C63 +1E00 1E01 1E00 +1E01 1E01 1E00 +1E02 1E03 1E02 +1E03 1E03 1E02 +1E04 1E05 1E04 +1E05 1E05 1E04 +1E06 1E07 1E06 +1E07 1E07 1E06 +1E08 1E09 1E08 +1E09 1E09 1E08 +1E0A 1E0B 1E0A +1E0B 1E0B 1E0A +1E0C 1E0D 1E0C +1E0D 1E0D 1E0C +1E0E 1E0F 1E0E +1E0F 1E0F 1E0E +1E10 1E11 1E10 +1E11 1E11 1E10 +1E12 1E13 1E12 +1E13 1E13 1E12 +1E14 1E15 1E14 +1E15 1E15 1E14 +1E16 1E17 1E16 +1E17 1E17 1E16 +1E18 1E19 1E18 +1E19 1E19 1E18 +1E1A 1E1B 1E1A +1E1B 1E1B 1E1A +1E1C 1E1D 1E1C +1E1D 1E1D 1E1C +1E1E 1E1F 1E1E +1E1F 1E1F 1E1E +1E20 1E21 1E20 +1E21 1E21 1E20 +1E22 1E23 1E22 +1E23 1E23 1E22 +1E24 1E25 1E24 +1E25 1E25 1E24 +1E26 1E27 1E26 +1E27 1E27 1E26 +1E28 1E29 1E28 +1E29 1E29 1E28 +1E2A 1E2B 1E2A +1E2B 1E2B 1E2A +1E2C 1E2D 1E2C +1E2D 1E2D 1E2C +1E2E 1E2F 1E2E +1E2F 1E2F 1E2E +1E30 1E31 1E30 +1E31 1E31 1E30 +1E32 1E33 1E32 +1E33 1E33 1E32 +1E34 1E35 1E34 +1E35 1E35 1E34 +1E36 1E37 1E36 +1E37 1E37 1E36 +1E38 1E39 1E38 +1E39 1E39 1E38 +1E3A 1E3B 1E3A +1E3B 1E3B 1E3A +1E3C 1E3D 1E3C +1E3D 1E3D 1E3C +1E3E 1E3F 1E3E +1E3F 1E3F 1E3E +1E40 1E41 1E40 +1E41 1E41 1E40 +1E42 1E43 1E42 +1E43 1E43 1E42 +1E44 1E45 1E44 +1E45 1E45 1E44 +1E46 1E47 1E46 +1E47 1E47 1E46 +1E48 1E49 1E48 +1E49 1E49 1E48 +1E4A 1E4B 1E4A +1E4B 1E4B 1E4A +1E4C 1E4D 1E4C +1E4D 1E4D 1E4C +1E4E 1E4F 1E4E +1E4F 1E4F 1E4E +1E50 1E51 1E50 +1E51 1E51 1E50 +1E52 1E53 1E52 +1E53 1E53 1E52 +1E54 1E55 1E54 +1E55 1E55 1E54 +1E56 1E57 1E56 +1E57 1E57 1E56 +1E58 1E59 1E58 +1E59 1E59 1E58 +1E5A 1E5B 1E5A +1E5B 1E5B 1E5A +1E5C 1E5D 1E5C +1E5D 1E5D 1E5C +1E5E 1E5F 1E5E +1E5F 1E5F 1E5E +1E60 1E61 1E60 +1E61 1E61 1E60 +1E62 1E63 1E62 +1E63 1E63 1E62 +1E64 1E65 1E64 +1E65 1E65 1E64 +1E66 1E67 1E66 +1E67 1E67 1E66 +1E68 1E69 1E68 +1E69 1E69 1E68 +1E6A 1E6B 1E6A +1E6B 1E6B 1E6A +1E6C 1E6D 1E6C +1E6D 1E6D 1E6C +1E6E 1E6F 1E6E +1E6F 1E6F 1E6E +1E70 1E71 1E70 +1E71 1E71 1E70 +1E72 1E73 1E72 +1E73 1E73 1E72 +1E74 1E75 1E74 +1E75 1E75 1E74 +1E76 1E77 1E76 +1E77 1E77 1E76 +1E78 1E79 1E78 +1E79 1E79 1E78 +1E7A 1E7B 1E7A +1E7B 1E7B 1E7A +1E7C 1E7D 1E7C +1E7D 1E7D 1E7C +1E7E 1E7F 1E7E +1E7F 1E7F 1E7E +1E80 1E81 1E80 +1E81 1E81 1E80 +1E82 1E83 1E82 +1E83 1E83 1E82 +1E84 1E85 1E84 +1E85 1E85 1E84 +1E86 1E87 1E86 +1E87 1E87 1E86 +1E88 1E89 1E88 +1E89 1E89 1E88 +1E8A 1E8B 1E8A +1E8B 1E8B 1E8A +1E8C 1E8D 1E8C +1E8D 1E8D 1E8C +1E8E 1E8F 1E8E +1E8F 1E8F 1E8E +1E90 1E91 1E90 +1E91 1E91 1E90 +1E92 1E93 1E92 +1E93 1E93 1E92 +1E94 1E95 1E94 +1E95 1E95 1E94 +1E9B 1E9B 1E60 +1E9E 00DF 1E9E +1EA0 1EA1 1EA0 +1EA1 1EA1 1EA0 +1EA2 1EA3 1EA2 +1EA3 1EA3 1EA2 +1EA4 1EA5 1EA4 +1EA5 1EA5 1EA4 +1EA6 1EA7 1EA6 +1EA7 1EA7 1EA6 +1EA8 1EA9 1EA8 +1EA9 1EA9 1EA8 +1EAA 1EAB 1EAA +1EAB 1EAB 1EAA +1EAC 1EAD 1EAC +1EAD 1EAD 1EAC +1EAE 1EAF 1EAE +1EAF 1EAF 1EAE +1EB0 1EB1 1EB0 +1EB1 1EB1 1EB0 +1EB2 1EB3 1EB2 +1EB3 1EB3 1EB2 +1EB4 1EB5 1EB4 +1EB5 1EB5 1EB4 +1EB6 1EB7 1EB6 +1EB7 1EB7 1EB6 +1EB8 1EB9 1EB8 +1EB9 1EB9 1EB8 +1EBA 1EBB 1EBA +1EBB 1EBB 1EBA +1EBC 1EBD 1EBC +1EBD 1EBD 1EBC +1EBE 1EBF 1EBE +1EBF 1EBF 1EBE +1EC0 1EC1 1EC0 +1EC1 1EC1 1EC0 +1EC2 1EC3 1EC2 +1EC3 1EC3 1EC2 +1EC4 1EC5 1EC4 +1EC5 1EC5 1EC4 +1EC6 1EC7 1EC6 +1EC7 1EC7 1EC6 +1EC8 1EC9 1EC8 +1EC9 1EC9 1EC8 +1ECA 1ECB 1ECA +1ECB 1ECB 1ECA +1ECC 1ECD 1ECC +1ECD 1ECD 1ECC +1ECE 1ECF 1ECE +1ECF 1ECF 1ECE +1ED0 1ED1 1ED0 +1ED1 1ED1 1ED0 +1ED2 1ED3 1ED2 +1ED3 1ED3 1ED2 +1ED4 1ED5 1ED4 +1ED5 1ED5 1ED4 +1ED6 1ED7 1ED6 +1ED7 1ED7 1ED6 +1ED8 1ED9 1ED8 +1ED9 1ED9 1ED8 +1EDA 1EDB 1EDA +1EDB 1EDB 1EDA +1EDC 1EDD 1EDC +1EDD 1EDD 1EDC +1EDE 1EDF 1EDE +1EDF 1EDF 1EDE +1EE0 1EE1 1EE0 +1EE1 1EE1 1EE0 +1EE2 1EE3 1EE2 +1EE3 1EE3 1EE2 +1EE4 1EE5 1EE4 +1EE5 1EE5 1EE4 +1EE6 1EE7 1EE6 +1EE7 1EE7 1EE6 +1EE8 1EE9 1EE8 +1EE9 1EE9 1EE8 +1EEA 1EEB 1EEA +1EEB 1EEB 1EEA +1EEC 1EED 1EEC +1EED 1EED 1EEC +1EEE 1EEF 1EEE +1EEF 1EEF 1EEE +1EF0 1EF1 1EF0 +1EF1 1EF1 1EF0 +1EF2 1EF3 1EF2 +1EF3 1EF3 1EF2 +1EF4 1EF5 1EF4 +1EF5 1EF5 1EF4 +1EF6 1EF7 1EF6 +1EF7 1EF7 1EF6 +1EF8 1EF9 1EF8 +1EF9 1EF9 1EF8 +1EFA 1EFB 1EFA +1EFB 1EFB 1EFA +1EFC 1EFD 1EFC +1EFD 1EFD 1EFC +1EFE 1EFF 1EFE +1EFF 1EFF 1EFE +1F00 1F00 1F08 +1F01 1F01 1F09 +1F02 1F02 1F0A +1F03 1F03 1F0B +1F04 1F04 1F0C +1F05 1F05 1F0D +1F06 1F06 1F0E +1F07 1F07 1F0F +1F08 1F00 1F08 +1F09 1F01 1F09 +1F0A 1F02 1F0A +1F0B 1F03 1F0B +1F0C 1F04 1F0C +1F0D 1F05 1F0D +1F0E 1F06 1F0E +1F0F 1F07 1F0F +1F10 1F10 1F18 +1F11 1F11 1F19 +1F12 1F12 1F1A +1F13 1F13 1F1B +1F14 1F14 1F1C +1F15 1F15 1F1D +1F18 1F10 1F18 +1F19 1F11 1F19 +1F1A 1F12 1F1A +1F1B 1F13 1F1B +1F1C 1F14 1F1C +1F1D 1F15 1F1D +1F20 1F20 1F28 +1F21 1F21 1F29 +1F22 1F22 1F2A +1F23 1F23 1F2B +1F24 1F24 1F2C +1F25 1F25 1F2D +1F26 1F26 1F2E +1F27 1F27 1F2F +1F28 1F20 1F28 +1F29 1F21 1F29 +1F2A 1F22 1F2A +1F2B 1F23 1F2B +1F2C 1F24 1F2C +1F2D 1F25 1F2D +1F2E 1F26 1F2E +1F2F 1F27 1F2F +1F30 1F30 1F38 +1F31 1F31 1F39 +1F32 1F32 1F3A +1F33 1F33 1F3B +1F34 1F34 1F3C +1F35 1F35 1F3D +1F36 1F36 1F3E +1F37 1F37 1F3F +1F38 1F30 1F38 +1F39 1F31 1F39 +1F3A 1F32 1F3A +1F3B 1F33 1F3B +1F3C 1F34 1F3C +1F3D 1F35 1F3D +1F3E 1F36 1F3E +1F3F 1F37 1F3F +1F40 1F40 1F48 +1F41 1F41 1F49 +1F42 1F42 1F4A +1F43 1F43 1F4B +1F44 1F44 1F4C +1F45 1F45 1F4D +1F48 1F40 1F48 +1F49 1F41 1F49 +1F4A 1F42 1F4A +1F4B 1F43 1F4B +1F4C 1F44 1F4C +1F4D 1F45 1F4D +1F51 1F51 1F59 +1F53 1F53 1F5B +1F55 1F55 1F5D +1F57 1F57 1F5F +1F59 1F51 1F59 +1F5B 1F53 1F5B +1F5D 1F55 1F5D +1F5F 1F57 1F5F +1F60 1F60 1F68 +1F61 1F61 1F69 +1F62 1F62 1F6A +1F63 1F63 1F6B +1F64 1F64 1F6C +1F65 1F65 1F6D +1F66 1F66 1F6E +1F67 1F67 1F6F +1F68 1F60 1F68 +1F69 1F61 1F69 +1F6A 1F62 1F6A +1F6B 1F63 1F6B +1F6C 1F64 1F6C +1F6D 1F65 1F6D +1F6E 1F66 1F6E +1F6F 1F67 1F6F +1F70 1F70 1FBA +1F71 1F71 1FBB +1F72 1F72 1FC8 +1F73 1F73 1FC9 +1F74 1F74 1FCA +1F75 1F75 1FCB +1F76 1F76 1FDA +1F77 1F77 1FDB +1F78 1F78 1FF8 +1F79 1F79 1FF9 +1F7A 1F7A 1FEA +1F7B 1F7B 1FEB +1F7C 1F7C 1FFA +1F7D 1F7D 1FFB +1F80 1F80 1F88 +1F81 1F81 1F89 +1F82 1F82 1F8A +1F83 1F83 1F8B +1F84 1F84 1F8C +1F85 1F85 1F8D +1F86 1F86 1F8E +1F87 1F87 1F8F +1F88 1F80 1F88 +1F89 1F81 1F89 +1F8A 1F82 1F8A +1F8B 1F83 1F8B +1F8C 1F84 1F8C +1F8D 1F85 1F8D +1F8E 1F86 1F8E +1F8F 1F87 1F8F +1F90 1F90 1F98 +1F91 1F91 1F99 +1F92 1F92 1F9A +1F93 1F93 1F9B +1F94 1F94 1F9C +1F95 1F95 1F9D +1F96 1F96 1F9E +1F97 1F97 1F9F +1F98 1F90 1F98 +1F99 1F91 1F99 +1F9A 1F92 1F9A +1F9B 1F93 1F9B +1F9C 1F94 1F9C +1F9D 1F95 1F9D +1F9E 1F96 1F9E +1F9F 1F97 1F9F +1FA0 1FA0 1FA8 +1FA1 1FA1 1FA9 +1FA2 1FA2 1FAA +1FA3 1FA3 1FAB +1FA4 1FA4 1FAC +1FA5 1FA5 1FAD +1FA6 1FA6 1FAE +1FA7 1FA7 1FAF +1FA8 1FA0 1FA8 +1FA9 1FA1 1FA9 +1FAA 1FA2 1FAA +1FAB 1FA3 1FAB +1FAC 1FA4 1FAC +1FAD 1FA5 1FAD +1FAE 1FA6 1FAE +1FAF 1FA7 1FAF +1FB0 1FB0 1FB8 +1FB1 1FB1 1FB9 +1FB3 1FB3 1FBC +1FB8 1FB0 1FB8 +1FB9 1FB1 1FB9 +1FBA 1F70 1FBA +1FBB 1F71 1FBB +1FBC 1FB3 1FBC +1FBE 1FBE 0399 +1FC3 1FC3 1FCC +1FC8 1F72 1FC8 +1FC9 1F73 1FC9 +1FCA 1F74 1FCA +1FCB 1F75 1FCB +1FCC 1FC3 1FCC +1FD0 1FD0 1FD8 +1FD1 1FD1 1FD9 +1FD8 1FD0 1FD8 +1FD9 1FD1 1FD9 +1FDA 1F76 1FDA +1FDB 1F77 1FDB +1FE0 1FE0 1FE8 +1FE1 1FE1 1FE9 +1FE5 1FE5 1FEC +1FE8 1FE0 1FE8 +1FE9 1FE1 1FE9 +1FEA 1F7A 1FEA +1FEB 1F7B 1FEB +1FEC 1FE5 1FEC +1FF3 1FF3 1FFC +1FF8 1F78 1FF8 +1FF9 1F79 1FF9 +1FFA 1F7C 1FFA +1FFB 1F7D 1FFB +1FFC 1FF3 1FFC +2126 03C9 2126 +212A 006B 212A +212B 00E5 212B +2132 214E 2132 +214E 214E 2132 +2160 2170 2160 +2161 2171 2161 +2162 2172 2162 +2163 2173 2163 +2164 2174 2164 +2165 2175 2165 +2166 2176 2166 +2167 2177 2167 +2168 2178 2168 +2169 2179 2169 +216A 217A 216A +216B 217B 216B +216C 217C 216C +216D 217D 216D +216E 217E 216E +216F 217F 216F +2170 2170 2160 +2171 2171 2161 +2172 2172 2162 +2173 2173 2163 +2174 2174 2164 +2175 2175 2165 +2176 2176 2166 +2177 2177 2167 +2178 2178 2168 +2179 2179 2169 +217A 217A 216A +217B 217B 216B +217C 217C 216C +217D 217D 216D +217E 217E 216E +217F 217F 216F +2183 2184 2183 +2184 2184 2183 +24B6 24D0 24B6 +24B7 24D1 24B7 +24B8 24D2 24B8 +24B9 24D3 24B9 +24BA 24D4 24BA +24BB 24D5 24BB +24BC 24D6 24BC +24BD 24D7 24BD +24BE 24D8 24BE +24BF 24D9 24BF +24C0 24DA 24C0 +24C1 24DB 24C1 +24C2 24DC 24C2 +24C3 24DD 24C3 +24C4 24DE 24C4 +24C5 24DF 24C5 +24C6 24E0 24C6 +24C7 24E1 24C7 +24C8 24E2 24C8 +24C9 24E3 24C9 +24CA 24E4 24CA +24CB 24E5 24CB +24CC 24E6 24CC +24CD 24E7 24CD +24CE 24E8 24CE +24CF 24E9 24CF +24D0 24D0 24B6 +24D1 24D1 24B7 +24D2 24D2 24B8 +24D3 24D3 24B9 +24D4 24D4 24BA +24D5 24D5 24BB +24D6 24D6 24BC +24D7 24D7 24BD +24D8 24D8 24BE +24D9 24D9 24BF +24DA 24DA 24C0 +24DB 24DB 24C1 +24DC 24DC 24C2 +24DD 24DD 24C3 +24DE 24DE 24C4 +24DF 24DF 24C5 +24E0 24E0 24C6 +24E1 24E1 24C7 +24E2 24E2 24C8 +24E3 24E3 24C9 +24E4 24E4 24CA +24E5 24E5 24CB +24E6 24E6 24CC +24E7 24E7 24CD +24E8 24E8 24CE +24E9 24E9 24CF +2C00 2C30 2C00 +2C01 2C31 2C01 +2C02 2C32 2C02 +2C03 2C33 2C03 +2C04 2C34 2C04 +2C05 2C35 2C05 +2C06 2C36 2C06 +2C07 2C37 2C07 +2C08 2C38 2C08 +2C09 2C39 2C09 +2C0A 2C3A 2C0A +2C0B 2C3B 2C0B +2C0C 2C3C 2C0C +2C0D 2C3D 2C0D +2C0E 2C3E 2C0E +2C0F 2C3F 2C0F +2C10 2C40 2C10 +2C11 2C41 2C11 +2C12 2C42 2C12 +2C13 2C43 2C13 +2C14 2C44 2C14 +2C15 2C45 2C15 +2C16 2C46 2C16 +2C17 2C47 2C17 +2C18 2C48 2C18 +2C19 2C49 2C19 +2C1A 2C4A 2C1A +2C1B 2C4B 2C1B +2C1C 2C4C 2C1C +2C1D 2C4D 2C1D +2C1E 2C4E 2C1E +2C1F 2C4F 2C1F +2C20 2C50 2C20 +2C21 2C51 2C21 +2C22 2C52 2C22 +2C23 2C53 2C23 +2C24 2C54 2C24 +2C25 2C55 2C25 +2C26 2C56 2C26 +2C27 2C57 2C27 +2C28 2C58 2C28 +2C29 2C59 2C29 +2C2A 2C5A 2C2A +2C2B 2C5B 2C2B +2C2C 2C5C 2C2C +2C2D 2C5D 2C2D +2C2E 2C5E 2C2E +2C30 2C30 2C00 +2C31 2C31 2C01 +2C32 2C32 2C02 +2C33 2C33 2C03 +2C34 2C34 2C04 +2C35 2C35 2C05 +2C36 2C36 2C06 +2C37 2C37 2C07 +2C38 2C38 2C08 +2C39 2C39 2C09 +2C3A 2C3A 2C0A +2C3B 2C3B 2C0B +2C3C 2C3C 2C0C +2C3D 2C3D 2C0D +2C3E 2C3E 2C0E +2C3F 2C3F 2C0F +2C40 2C40 2C10 +2C41 2C41 2C11 +2C42 2C42 2C12 +2C43 2C43 2C13 +2C44 2C44 2C14 +2C45 2C45 2C15 +2C46 2C46 2C16 +2C47 2C47 2C17 +2C48 2C48 2C18 +2C49 2C49 2C19 +2C4A 2C4A 2C1A +2C4B 2C4B 2C1B +2C4C 2C4C 2C1C +2C4D 2C4D 2C1D +2C4E 2C4E 2C1E +2C4F 2C4F 2C1F +2C50 2C50 2C20 +2C51 2C51 2C21 +2C52 2C52 2C22 +2C53 2C53 2C23 +2C54 2C54 2C24 +2C55 2C55 2C25 +2C56 2C56 2C26 +2C57 2C57 2C27 +2C58 2C58 2C28 +2C59 2C59 2C29 +2C5A 2C5A 2C2A +2C5B 2C5B 2C2B +2C5C 2C5C 2C2C +2C5D 2C5D 2C2D +2C5E 2C5E 2C2E +2C60 2C61 2C60 +2C61 2C61 2C60 +2C62 026B 2C62 +2C63 1D7D 2C63 +2C64 027D 2C64 +2C65 2C65 023A +2C66 2C66 023E +2C67 2C68 2C67 +2C68 2C68 2C67 +2C69 2C6A 2C69 +2C6A 2C6A 2C69 +2C6B 2C6C 2C6B +2C6C 2C6C 2C6B +2C6D 0251 2C6D +2C6E 0271 2C6E +2C6F 0250 2C6F +2C70 0252 2C70 +2C72 2C73 2C72 +2C73 2C73 2C72 +2C75 2C76 2C75 +2C76 2C76 2C75 +2C7E 023F 2C7E +2C7F 0240 2C7F +2C80 2C81 2C80 +2C81 2C81 2C80 +2C82 2C83 2C82 +2C83 2C83 2C82 +2C84 2C85 2C84 +2C85 2C85 2C84 +2C86 2C87 2C86 +2C87 2C87 2C86 +2C88 2C89 2C88 +2C89 2C89 2C88 +2C8A 2C8B 2C8A +2C8B 2C8B 2C8A +2C8C 2C8D 2C8C +2C8D 2C8D 2C8C +2C8E 2C8F 2C8E +2C8F 2C8F 2C8E +2C90 2C91 2C90 +2C91 2C91 2C90 +2C92 2C93 2C92 +2C93 2C93 2C92 +2C94 2C95 2C94 +2C95 2C95 2C94 +2C96 2C97 2C96 +2C97 2C97 2C96 +2C98 2C99 2C98 +2C99 2C99 2C98 +2C9A 2C9B 2C9A +2C9B 2C9B 2C9A +2C9C 2C9D 2C9C +2C9D 2C9D 2C9C +2C9E 2C9F 2C9E +2C9F 2C9F 2C9E +2CA0 2CA1 2CA0 +2CA1 2CA1 2CA0 +2CA2 2CA3 2CA2 +2CA3 2CA3 2CA2 +2CA4 2CA5 2CA4 +2CA5 2CA5 2CA4 +2CA6 2CA7 2CA6 +2CA7 2CA7 2CA6 +2CA8 2CA9 2CA8 +2CA9 2CA9 2CA8 +2CAA 2CAB 2CAA +2CAB 2CAB 2CAA +2CAC 2CAD 2CAC +2CAD 2CAD 2CAC +2CAE 2CAF 2CAE +2CAF 2CAF 2CAE +2CB0 2CB1 2CB0 +2CB1 2CB1 2CB0 +2CB2 2CB3 2CB2 +2CB3 2CB3 2CB2 +2CB4 2CB5 2CB4 +2CB5 2CB5 2CB4 +2CB6 2CB7 2CB6 +2CB7 2CB7 2CB6 +2CB8 2CB9 2CB8 +2CB9 2CB9 2CB8 +2CBA 2CBB 2CBA +2CBB 2CBB 2CBA +2CBC 2CBD 2CBC +2CBD 2CBD 2CBC +2CBE 2CBF 2CBE +2CBF 2CBF 2CBE +2CC0 2CC1 2CC0 +2CC1 2CC1 2CC0 +2CC2 2CC3 2CC2 +2CC3 2CC3 2CC2 +2CC4 2CC5 2CC4 +2CC5 2CC5 2CC4 +2CC6 2CC7 2CC6 +2CC7 2CC7 2CC6 +2CC8 2CC9 2CC8 +2CC9 2CC9 2CC8 +2CCA 2CCB 2CCA +2CCB 2CCB 2CCA +2CCC 2CCD 2CCC +2CCD 2CCD 2CCC +2CCE 2CCF 2CCE +2CCF 2CCF 2CCE +2CD0 2CD1 2CD0 +2CD1 2CD1 2CD0 +2CD2 2CD3 2CD2 +2CD3 2CD3 2CD2 +2CD4 2CD5 2CD4 +2CD5 2CD5 2CD4 +2CD6 2CD7 2CD6 +2CD7 2CD7 2CD6 +2CD8 2CD9 2CD8 +2CD9 2CD9 2CD8 +2CDA 2CDB 2CDA +2CDB 2CDB 2CDA +2CDC 2CDD 2CDC +2CDD 2CDD 2CDC +2CDE 2CDF 2CDE +2CDF 2CDF 2CDE +2CE0 2CE1 2CE0 +2CE1 2CE1 2CE0 +2CE2 2CE3 2CE2 +2CE3 2CE3 2CE2 +2CEB 2CEC 2CEB +2CEC 2CEC 2CEB +2CED 2CEE 2CED +2CEE 2CEE 2CED +2D00 2D00 10A0 +2D01 2D01 10A1 +2D02 2D02 10A2 +2D03 2D03 10A3 +2D04 2D04 10A4 +2D05 2D05 10A5 +2D06 2D06 10A6 +2D07 2D07 10A7 +2D08 2D08 10A8 +2D09 2D09 10A9 +2D0A 2D0A 10AA +2D0B 2D0B 10AB +2D0C 2D0C 10AC +2D0D 2D0D 10AD +2D0E 2D0E 10AE +2D0F 2D0F 10AF +2D10 2D10 10B0 +2D11 2D11 10B1 +2D12 2D12 10B2 +2D13 2D13 10B3 +2D14 2D14 10B4 +2D15 2D15 10B5 +2D16 2D16 10B6 +2D17 2D17 10B7 +2D18 2D18 10B8 +2D19 2D19 10B9 +2D1A 2D1A 10BA +2D1B 2D1B 10BB +2D1C 2D1C 10BC +2D1D 2D1D 10BD +2D1E 2D1E 10BE +2D1F 2D1F 10BF +2D20 2D20 10C0 +2D21 2D21 10C1 +2D22 2D22 10C2 +2D23 2D23 10C3 +2D24 2D24 10C4 +2D25 2D25 10C5 +A640 A641 A640 +A641 A641 A640 +A642 A643 A642 +A643 A643 A642 +A644 A645 A644 +A645 A645 A644 +A646 A647 A646 +A647 A647 A646 +A648 A649 A648 +A649 A649 A648 +A64A A64B A64A +A64B A64B A64A +A64C A64D A64C +A64D A64D A64C +A64E A64F A64E +A64F A64F A64E +A650 A651 A650 +A651 A651 A650 +A652 A653 A652 +A653 A653 A652 +A654 A655 A654 +A655 A655 A654 +A656 A657 A656 +A657 A657 A656 +A658 A659 A658 +A659 A659 A658 +A65A A65B A65A +A65B A65B A65A +A65C A65D A65C +A65D A65D A65C +A65E A65F A65E +A65F A65F A65E +A662 A663 A662 +A663 A663 A662 +A664 A665 A664 +A665 A665 A664 +A666 A667 A666 +A667 A667 A666 +A668 A669 A668 +A669 A669 A668 +A66A A66B A66A +A66B A66B A66A +A66C A66D A66C +A66D A66D A66C +A680 A681 A680 +A681 A681 A680 +A682 A683 A682 +A683 A683 A682 +A684 A685 A684 +A685 A685 A684 +A686 A687 A686 +A687 A687 A686 +A688 A689 A688 +A689 A689 A688 +A68A A68B A68A +A68B A68B A68A +A68C A68D A68C +A68D A68D A68C +A68E A68F A68E +A68F A68F A68E +A690 A691 A690 +A691 A691 A690 +A692 A693 A692 +A693 A693 A692 +A694 A695 A694 +A695 A695 A694 +A696 A697 A696 +A697 A697 A696 +A722 A723 A722 +A723 A723 A722 +A724 A725 A724 +A725 A725 A724 +A726 A727 A726 +A727 A727 A726 +A728 A729 A728 +A729 A729 A728 +A72A A72B A72A +A72B A72B A72A +A72C A72D A72C +A72D A72D A72C +A72E A72F A72E +A72F A72F A72E +A732 A733 A732 +A733 A733 A732 +A734 A735 A734 +A735 A735 A734 +A736 A737 A736 +A737 A737 A736 +A738 A739 A738 +A739 A739 A738 +A73A A73B A73A +A73B A73B A73A +A73C A73D A73C +A73D A73D A73C +A73E A73F A73E +A73F A73F A73E +A740 A741 A740 +A741 A741 A740 +A742 A743 A742 +A743 A743 A742 +A744 A745 A744 +A745 A745 A744 +A746 A747 A746 +A747 A747 A746 +A748 A749 A748 +A749 A749 A748 +A74A A74B A74A +A74B A74B A74A +A74C A74D A74C +A74D A74D A74C +A74E A74F A74E +A74F A74F A74E +A750 A751 A750 +A751 A751 A750 +A752 A753 A752 +A753 A753 A752 +A754 A755 A754 +A755 A755 A754 +A756 A757 A756 +A757 A757 A756 +A758 A759 A758 +A759 A759 A758 +A75A A75B A75A +A75B A75B A75A +A75C A75D A75C +A75D A75D A75C +A75E A75F A75E +A75F A75F A75E +A760 A761 A760 +A761 A761 A760 +A762 A763 A762 +A763 A763 A762 +A764 A765 A764 +A765 A765 A764 +A766 A767 A766 +A767 A767 A766 +A768 A769 A768 +A769 A769 A768 +A76A A76B A76A +A76B A76B A76A +A76C A76D A76C +A76D A76D A76C +A76E A76F A76E +A76F A76F A76E +A779 A77A A779 +A77A A77A A779 +A77B A77C A77B +A77C A77C A77B +A77D 1D79 A77D +A77E A77F A77E +A77F A77F A77E +A780 A781 A780 +A781 A781 A780 +A782 A783 A782 +A783 A783 A782 +A784 A785 A784 +A785 A785 A784 +A786 A787 A786 +A787 A787 A786 +A78B A78C A78B +A78C A78C A78B +FF21 FF41 FF21 +FF22 FF42 FF22 +FF23 FF43 FF23 +FF24 FF44 FF24 +FF25 FF45 FF25 +FF26 FF46 FF26 +FF27 FF47 FF27 +FF28 FF48 FF28 +FF29 FF49 FF29 +FF2A FF4A FF2A +FF2B FF4B FF2B +FF2C FF4C FF2C +FF2D FF4D FF2D +FF2E FF4E FF2E +FF2F FF4F FF2F +FF30 FF50 FF30 +FF31 FF51 FF31 +FF32 FF52 FF32 +FF33 FF53 FF33 +FF34 FF54 FF34 +FF35 FF55 FF35 +FF36 FF56 FF36 +FF37 FF57 FF37 +FF38 FF58 FF38 +FF39 FF59 FF39 +FF3A FF5A FF3A +FF41 FF41 FF21 +FF42 FF42 FF22 +FF43 FF43 FF23 +FF44 FF44 FF24 +FF45 FF45 FF25 +FF46 FF46 FF26 +FF47 FF47 FF27 +FF48 FF48 FF28 +FF49 FF49 FF29 +FF4A FF4A FF2A +FF4B FF4B FF2B +FF4C FF4C FF2C +FF4D FF4D FF2D +FF4E FF4E FF2E +FF4F FF4F FF2F +FF50 FF50 FF30 +FF51 FF51 FF31 +FF52 FF52 FF32 +FF53 FF53 FF33 +FF54 FF54 FF34 +FF55 FF55 FF35 +FF56 FF56 FF36 +FF57 FF57 FF37 +FF58 FF58 FF38 +FF59 FF59 FF39 +FF5A FF5A FF3A +DROP VIEW v_bmp; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_ucs2_unicode_520_ci_casefold.test b/mysql-test/main/ctype_ucs2_unicode_520_ci_casefold.test new file mode 100644 index 0000000000000..a60bf66cfa706 --- /dev/null +++ b/mysql-test/main/ctype_ucs2_unicode_520_ci_casefold.test @@ -0,0 +1,14 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET @@collation_connection=ucs2_unicode_520_ci; +--source include/ctype_unicode_casefold_bmp.inc + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/ctype_ujis.result b/mysql-test/main/ctype_ujis.result index bebe962fca488..35bfce8eb5a16 100644 --- a/mysql-test/main/ctype_ujis.result +++ b/mysql-test/main/ctype_ujis.result @@ -396,7 +396,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(1) NOT NULL DEFAULT '', `b` enum('��','��') DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW COLUMNS FROM t1; Field Type Null Key Default Extra a char(1) NO @@ -2856,9 +2856,9 @@ DROP TEMPORARY TABLE head, tail; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `code` varchar(6) CHARACTER SET ujis NOT NULL, - `a` varchar(1) CHARACTER SET ujis NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `code` varchar(6) CHARACTER SET ujis COLLATE ujis_japanese_ci NOT NULL, + `a` varchar(1) CHARACTER SET ujis COLLATE ujis_japanese_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code; Warnings: Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1 @@ -25564,14 +25564,14 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET ujis NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET ujis COLLATE ujis_japanese_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 41 @@ -25584,14 +25584,14 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET ujis DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET ujis COLLATE ujis_japanese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(15) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 4141414141 @@ -25604,7 +25604,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 414141 @@ -25617,7 +25617,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 41414141412020202020 @@ -25998,13 +25998,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET ujis COLLATE ujis_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 61 @@ -26018,13 +26018,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET ujis COLLATE ujis_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(15) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 6161616161 @@ -26037,7 +26037,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 616161 @@ -26050,7 +26050,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 61616161612020202020 @@ -26449,8 +26449,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `t` varchar(10) CHARACTER SET ujis DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `t` varchar(10) CHARACTER SET ujis COLLATE ujis_japanese_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI'); SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub; c2 @@ -26540,7 +26540,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ujis_japanese_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE ujis_japanese_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -26678,7 +26678,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ujis_japanese_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE ujis_japanese_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -26817,7 +26817,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ujis_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE ujis_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -26955,7 +26955,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ujis_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE ujis_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); diff --git a/mysql-test/main/ctype_ujis.test b/mysql-test/main/ctype_ujis.test index 7b77232738b40..320231a97624b 100644 --- a/mysql-test/main/ctype_ujis.test +++ b/mysql-test/main/ctype_ujis.test @@ -47,7 +47,12 @@ select locate(_ujis 0xa1a3,_ujis 0xa1a2a1a3); select 0xa1a2a1a3 like concat(_binary'%',0xa2a1,_binary'%'); select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%'); + +# enable view-protocol after fix MDEV-27871 +--disable_view_protocol select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate ujis_bin; +--disable_view_protocol + select 'a' like 'a'; select 'A' like 'a'; select 'A' like 'a' collate ujis_bin; @@ -1226,9 +1231,11 @@ DROP TABLE t2; --echo # --echo # Bug#57257 Replace(ExtractValue(...)) causes MySQL crash --echo # +#enable after fix MDEV-27871 +--disable_view_protocol SET NAMES utf8; SELECT CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis); - +--enable_view_protocol set names default; set character_set_database=@save_character_set_server; @@ -1317,6 +1324,10 @@ WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> --echo # WL#3090 Japanese Character Set adjustments --echo # Test sjis->Unicode conversion --echo # + +# enable view-protocol in 10.6 version +--disable_view_protocol + SELECT HEX(a), HEX(CONVERT(a USING utf8)) as b FROM t1 WHERE a<>'' HAVING b<>'3F' ORDER BY code; @@ -1331,7 +1342,7 @@ DROP TABLE t1; SELECT HEX(a), HEX(CONVERT(a using sjis)) as b FROM t1 HAVING b<>'3F' ORDER BY BINARY a; DROP TABLE t1; - +--enable_view_protocol --echo # --echo # End of 5.5 tests @@ -1346,6 +1357,8 @@ DROP TABLE t1; --echo # WL#3664 WEIGHT_STRING --echo # +# enable view-protocol after fix MDEV-27871 +--disable_view_protocol set names ujis; --source include/weight_string.inc --source include/weight_string_l1.inc @@ -1359,6 +1372,7 @@ set collation_connection=ujis_bin; --source include/weight_string_A1A1.inc --source include/weight_string_8EA1.inc --source include/weight_string_8FA2C3.inc +--enable_view_protocol --echo # --echo # End of 5.6 tests diff --git a/mysql-test/main/ctype_upgrade.result b/mysql-test/main/ctype_upgrade.result index 6ed7f0d3ca56e..500b013a5a154 100644 --- a/mysql-test/main/ctype_upgrade.result +++ b/mysql-test/main/ctype_upgrade.result @@ -19,7 +19,7 @@ SHOW CREATE TABLE maria050313_utf8_croatian_ci; Table Create Table maria050313_utf8_croatian_ci CREATE TABLE `maria050313_utf8_croatian_ci` ( `a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_croatian_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT count(*) FROM maria050313_utf8_croatian_ci; count(*) 4 @@ -30,7 +30,7 @@ SHOW CREATE TABLE maria050313_utf8_croatian_ci; Table Create Table maria050313_utf8_croatian_ci CREATE TABLE `maria050313_utf8_croatian_ci` ( `a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_croatian_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM maria050313_utf8_croatian_ci GROUP BY a; GROUP_CONCAT(a ORDER BY BINARY a) nJ @@ -96,7 +96,7 @@ maria050533_xxx_croatian_ci CREATE TABLE `maria050533_xxx_croatian_ci` ( `c` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_croatian_ci DEFAULT NULL, `d` varchar(10) CHARACTER SET utf16 COLLATE utf16_croatian_ci DEFAULT NULL, `e` varchar(10) CHARACTER SET utf32 COLLATE utf32_croatian_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT count(*) FROM maria050533_xxx_croatian_ci; count(*) 4 @@ -111,7 +111,7 @@ maria050533_xxx_croatian_ci CREATE TABLE `maria050533_xxx_croatian_ci` ( `c` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_croatian_ci DEFAULT NULL, `d` varchar(10) CHARACTER SET utf16 COLLATE utf16_croatian_ci DEFAULT NULL, `e` varchar(10) CHARACTER SET utf32 COLLATE utf32_croatian_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM maria050533_xxx_croatian_ci GROUP BY a; GROUP_CONCAT(a ORDER BY BINARY a) nJ @@ -150,7 +150,7 @@ test.maria100004_xxx_croatian_ci repair status OK SHOW CREATE TABLE maria100004_xxx_croatian_ci; Table Create Table maria100004_xxx_croatian_ci CREATE TABLE `maria100004_xxx_croatian_ci` ( - `a` varchar(10) COLLATE utf8mb3_croatian_ci DEFAULT NULL, + `a` varchar(10) DEFAULT NULL, `b` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci DEFAULT NULL, `c` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_croatian_ci DEFAULT NULL, `d` varchar(10) CHARACTER SET utf16 COLLATE utf16_croatian_ci DEFAULT NULL, @@ -162,7 +162,7 @@ ALTER TABLE maria100004_xxx_croatian_ci FORCE; SHOW CREATE TABLE maria100004_xxx_croatian_ci; Table Create Table maria100004_xxx_croatian_ci CREATE TABLE `maria100004_xxx_croatian_ci` ( - `a` varchar(10) COLLATE utf8mb3_croatian_ci DEFAULT NULL, + `a` varchar(10) DEFAULT NULL, `b` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci DEFAULT NULL, `c` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_croatian_ci DEFAULT NULL, `d` varchar(10) CHARACTER SET utf16 COLLATE utf16_croatian_ci DEFAULT NULL, @@ -201,7 +201,7 @@ test.mysql050614_xxx_croatian_ci check status OK SHOW CREATE TABLE mysql050614_xxx_croatian_ci; Table Create Table mysql050614_xxx_croatian_ci CREATE TABLE `mysql050614_xxx_croatian_ci` ( - `a` varchar(10) COLLATE utf8mb3_croatian_mysql561_ci DEFAULT NULL, + `a` varchar(10) DEFAULT NULL, `b` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_mysql561_ci DEFAULT NULL, `c` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_croatian_mysql561_ci DEFAULT NULL, `d` varchar(10) CHARACTER SET utf16 COLLATE utf16_croatian_mysql561_ci DEFAULT NULL, @@ -555,7 +555,7 @@ SHOW CREATE TABLE maria050313_utf8_croatian_ci; Table Create Table maria050313_utf8_croatian_ci CREATE TABLE `maria050313_utf8_croatian_ci` ( `a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_croatian_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM maria050313_utf8_croatian_ci GROUP BY a; GROUP_CONCAT(a ORDER BY BINARY a) nJ @@ -568,7 +568,7 @@ maria050533_xxx_croatian_ci CREATE TABLE `maria050533_xxx_croatian_ci` ( `c` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_croatian_ci DEFAULT NULL, `d` varchar(10) CHARACTER SET utf16 COLLATE utf16_croatian_ci DEFAULT NULL, `e` varchar(10) CHARACTER SET utf32 COLLATE utf32_croatian_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM maria050533_xxx_croatian_ci GROUP BY a; GROUP_CONCAT(a ORDER BY BINARY a) nJ @@ -576,7 +576,7 @@ NJ,Nj,nj SHOW CREATE TABLE maria100004_xxx_croatian_ci; Table Create Table maria100004_xxx_croatian_ci CREATE TABLE `maria100004_xxx_croatian_ci` ( - `a` varchar(10) COLLATE utf8mb3_croatian_ci DEFAULT NULL, + `a` varchar(10) DEFAULT NULL, `b` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci DEFAULT NULL, `c` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_croatian_ci DEFAULT NULL, `d` varchar(10) CHARACTER SET utf16 COLLATE utf16_croatian_ci DEFAULT NULL, @@ -589,7 +589,7 @@ NJ,Nj,nj SHOW CREATE TABLE mysql050614_xxx_croatian_ci; Table Create Table mysql050614_xxx_croatian_ci CREATE TABLE `mysql050614_xxx_croatian_ci` ( - `a` varchar(10) COLLATE utf8mb3_croatian_mysql561_ci DEFAULT NULL, + `a` varchar(10) DEFAULT NULL, `b` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_mysql561_ci DEFAULT NULL, `c` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_croatian_mysql561_ci DEFAULT NULL, `d` varchar(10) CHARACTER SET utf16 COLLATE utf16_croatian_mysql561_ci DEFAULT NULL, @@ -603,3 +603,56 @@ DROP TABLE maria050313_utf8_croatian_ci; DROP TABLE maria050533_xxx_croatian_ci; DROP TABLE maria100004_xxx_croatian_ci; DROP TABLE mysql050614_xxx_croatian_ci; +# +# Start of 10.4 tests +# +# +# MDEV-30746 Regression in ucs2_general_mysql500_ci +# +SET NAMES utf8mb3; +SHOW CREATE TABLE t1; +ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.t1` FORCE" or dump/reload to fix it! +SELECT * FROM t1; +ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.t1` FORCE" or dump/reload to fix it! +SELECT * FROM t1 IGNORE KEY(a); +ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.t1` FORCE" or dump/reload to fix it! +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check error Upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it! +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +SELECT a, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a; +a HEX(a) HEX(WEIGHT_STRING(a)) +s 0073 0053 +z 007A 005A +ß 00DF 00DF +SELECT a, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 FORCE KEY(a) ORDER BY a; +a HEX(a) HEX(WEIGHT_STRING(a)) +s 0073 0053 +z 007A 005A +ß 00DF 00DF +SELECT a, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 IGNORE KEY(a) ORDER BY a; +a HEX(a) HEX(WEIGHT_STRING(a)) +s 0073 0053 +z 007A 005A +ß 00DF 00DF +SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a ORDER BY a; +GROUP_CONCAT(a) +s +z +ß +SELECT GROUP_CONCAT(a) FROM t1 IGNORE KEY(a) GROUP BY a ORDER BY a; +GROUP_CONCAT(a) +s +z +ß +SELECT GROUP_CONCAT(a) FROM t1 FORCE KEY(a) GROUP BY a ORDER BY a; +GROUP_CONCAT(a) +s +z +ß +DROP TABLE t1; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/ctype_upgrade.test b/mysql-test/main/ctype_upgrade.test index 62567c5afe466..7cb1ec9b69d60 100644 --- a/mysql-test/main/ctype_upgrade.test +++ b/mysql-test/main/ctype_upgrade.test @@ -85,13 +85,15 @@ DROP TABLE maria050533_xxx_croatian_ci; --copy_file std_data/ctype_upgrade/maria050533_xxx_croatian_ci.MYI $MYSQLD_DATADIR/test/maria050533_xxx_croatian_ci.MYI ALTER TABLE maria050533_xxx_croatian_ci FORCE; SHOW CREATE TABLE maria050533_xxx_croatian_ci; +# enable after fix MDEV-28571 +--disable_view_protocol SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM maria050533_xxx_croatian_ci GROUP BY a; SELECT GROUP_CONCAT(b ORDER BY BINARY b) FROM maria050533_xxx_croatian_ci GROUP BY b; SELECT GROUP_CONCAT(c ORDER BY BINARY c) FROM maria050533_xxx_croatian_ci GROUP BY c; SELECT GROUP_CONCAT(d ORDER BY BINARY d) FROM maria050533_xxx_croatian_ci GROUP BY d; SELECT GROUP_CONCAT(e ORDER BY BINARY e) FROM maria050533_xxx_croatian_ci GROUP BY e; DROP TABLE maria050533_xxx_croatian_ci; - +--enable_view_protocol --echo # --echo # Upgrade from Maria-10.0.4 @@ -116,13 +118,15 @@ DROP TABLE maria100004_xxx_croatian_ci; --copy_file std_data/ctype_upgrade/maria100004_xxx_croatian_ci.MYI $MYSQLD_DATADIR/test/maria100004_xxx_croatian_ci.MYI ALTER TABLE maria100004_xxx_croatian_ci FORCE; SHOW CREATE TABLE maria100004_xxx_croatian_ci; +# enable after fix MDEV-28571 +--disable_view_protocol SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM maria100004_xxx_croatian_ci GROUP BY a; SELECT GROUP_CONCAT(b ORDER BY BINARY b) FROM maria100004_xxx_croatian_ci GROUP BY b; SELECT GROUP_CONCAT(c ORDER BY BINARY c) FROM maria100004_xxx_croatian_ci GROUP BY c; SELECT GROUP_CONCAT(d ORDER BY BINARY d) FROM maria100004_xxx_croatian_ci GROUP BY d; SELECT GROUP_CONCAT(e ORDER BY BINARY e) FROM maria100004_xxx_croatian_ci GROUP BY e; DROP TABLE maria100004_xxx_croatian_ci; - +--enable_view_protocol --echo # @@ -137,13 +141,15 @@ DROP TABLE maria100004_xxx_croatian_ci; --copy_file std_data/ctype_upgrade/mysql050614_xxx_croatian_ci.MYI $MYSQLD_DATADIR/test/mysql050614_xxx_croatian_ci.MYI CHECK TABLE mysql050614_xxx_croatian_ci FOR UPGRADE; SHOW CREATE TABLE mysql050614_xxx_croatian_ci; +# enable after fix MDEV-28571 +--disable_view_protocol SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM mysql050614_xxx_croatian_ci GROUP BY a; SELECT GROUP_CONCAT(b ORDER BY BINARY b) FROM mysql050614_xxx_croatian_ci GROUP BY b; SELECT GROUP_CONCAT(c ORDER BY BINARY c) FROM mysql050614_xxx_croatian_ci GROUP BY c; SELECT GROUP_CONCAT(d ORDER BY BINARY d) FROM mysql050614_xxx_croatian_ci GROUP BY d; SELECT GROUP_CONCAT(e ORDER BY BINARY e) FROM mysql050614_xxx_croatian_ci GROUP BY e; DROP TABLE mysql050614_xxx_croatian_ci; - +--enable_view_protocol --echo # --echo # Checking mysql_upgrade @@ -197,3 +203,38 @@ DROP TABLE maria050313_utf8_croatian_ci; DROP TABLE maria050533_xxx_croatian_ci; DROP TABLE maria100004_xxx_croatian_ci; DROP TABLE mysql050614_xxx_croatian_ci; + + +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-30746 Regression in ucs2_general_mysql500_ci +--echo # + +SET NAMES utf8mb3; + +copy_file std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.frm $MYSQLD_DATADIR/test/t1.frm; +copy_file std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.MYD $MYSQLD_DATADIR/test/t1.MYD; +copy_file std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.MYI $MYSQLD_DATADIR/test/t1.MYI; + +--error ER_TABLE_NEEDS_REBUILD +SHOW CREATE TABLE t1; +--error ER_TABLE_NEEDS_REBUILD +SELECT * FROM t1; +--error ER_TABLE_NEEDS_REBUILD +SELECT * FROM t1 IGNORE KEY(a); +CHECK TABLE t1; +REPAIR TABLE t1; +SELECT a, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a; +SELECT a, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 FORCE KEY(a) ORDER BY a; +SELECT a, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 IGNORE KEY(a) ORDER BY a; +SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a ORDER BY a; +SELECT GROUP_CONCAT(a) FROM t1 IGNORE KEY(a) GROUP BY a ORDER BY a; +SELECT GROUP_CONCAT(a) FROM t1 FORCE KEY(a) GROUP BY a ORDER BY a; +DROP TABLE t1; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/ctype_utf16.result b/mysql-test/main/ctype_utf16.result index 36dedc8732165..eae7b268f93a2 100644 --- a/mysql-test/main/ctype_utf16.result +++ b/mysql-test/main/ctype_utf16.result @@ -101,9 +101,9 @@ RPAD(_utf16 X'0420',10,_utf16 X'0421') r; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `l` varchar(10) CHARACTER SET utf16 DEFAULT NULL, - `r` varchar(10) CHARACTER SET utf16 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `l` varchar(10) CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL, + `r` varchar(10) CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(l), hex(r) from t1; hex(l) hex(r) 0421042104210421042104210421042104210420 0420042104210421042104210421042104210421 @@ -127,9 +127,9 @@ alter table t1 add key(a); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET utf16 DEFAULT NULL, + `a` varchar(10) CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); explain select * from t1 where a like 'abc%'; id select_type table type possible_keys key key_len ref rows Extra @@ -510,8 +510,8 @@ create table t1 (a enum('x','y','z') character set utf16); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('x','y','z') CHARACTER SET utf16 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` enum('x','y','z') CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('x'); insert into t1 values ('y'); insert into t1 values ('z'); @@ -524,8 +524,8 @@ alter table t1 change a a enum('x','y','z','d','e','ä','ö','ü') character set show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('x','y','z','d','e','ä','ö','ü') CHARACTER SET utf16 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` enum('x','y','z','d','e','ä','ö','ü') CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('D'); insert into t1 values ('E '); insert into t1 values ('ä'); @@ -546,8 +546,8 @@ create table t1 (a set ('x','y','z','ä','ö','ü') character set utf16); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` set('x','y','z','ä','ö','ü') CHARACTER SET utf16 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` set('x','y','z','ä','ö','ü') CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('x'); insert into t1 values ('y'); insert into t1 values ('z'); @@ -762,7 +762,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84); INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; @@ -903,15 +903,15 @@ NOT NULL default 'passive' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `status` enum('active','passive') CHARACTER SET utf16 NOT NULL DEFAULT 'passive' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `status` enum('active','passive') CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL DEFAULT 'passive' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 ADD a int NOT NULL AFTER status; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `status` enum('active','passive') CHARACTER SET utf16 NOT NULL DEFAULT 'passive', + `status` enum('active','passive') CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL DEFAULT 'passive', `a` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; End of 4.1 tests CREATE TABLE t1 (a varchar(64) character set utf16, b decimal(10,3)); @@ -1294,16 +1294,16 @@ Note 1246 Converting column 'a' from VARCHAR to TEXT show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` mediumtext CHARACTER SET utf16 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` mediumtext CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a varchar(250) character set utf16 primary key); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(250) CHARACTER SET utf16 NOT NULL, + `a` varchar(250) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a varchar(334) character set utf16 primary key); ERROR 42000: Specified key was too long; max key length is 1000 bytes @@ -1330,9 +1330,9 @@ select null, null; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `s1` varchar(64) CHARACTER SET utf16 DEFAULT NULL, - `s2` varchar(64) CHARACTER SET utf16 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `s1` varchar(64) CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL, + `s2` varchar(64) CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); @@ -1433,8 +1433,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 64) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) CHARACTER SET utf16 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(64) CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (''); SELECT CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1; CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) @@ -1482,8 +1482,8 @@ CREATE TABLE t1 AS SELECT repeat('a',2) as s1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `s1` varchar(2) CHARACTER SET utf16 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `s1` varchar(2) CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE'); SELECT * FROM t1 ORDER BY s1; s1 @@ -1543,8 +1543,8 @@ CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `CONCAT(s1)` varchar(255) CHARACTER SET utf16 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `CONCAT(s1)` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; # # Bug#11753363 (Bug#44793) Character sets: case clause, ucs2 or utf32, failure @@ -1628,14 +1628,14 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf16 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0041 @@ -1648,14 +1648,14 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf16 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 00410041004100410041 @@ -1668,7 +1668,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 004100410041 @@ -1681,7 +1681,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 0041004100410041004100200020002000200020 @@ -1879,13 +1879,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 000061 @@ -1899,13 +1899,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET utf16 COLLATE utf16_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(15) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 000061000061000061000061000061 @@ -1918,7 +1918,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 000061000061000061 @@ -1931,7 +1931,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 000061000061000061000061000061000020000020000020000020000020 @@ -2166,8 +2166,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `t` varchar(10) CHARACTER SET utf16 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `t` varchar(10) CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI'); SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub; c2 @@ -2270,7 +2270,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf16_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf16 COLLATE=utf16_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2408,7 +2408,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf16_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf16 COLLATE=utf16_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2547,7 +2547,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf16_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf16 COLLATE=utf16_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2685,7 +2685,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf16_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf16 COLLATE=utf16_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); diff --git a/mysql-test/main/ctype_utf16.test b/mysql-test/main/ctype_utf16.test index c2807a192157c..d95bc2ed76ede 100644 --- a/mysql-test/main/ctype_utf16.test +++ b/mysql-test/main/ctype_utf16.test @@ -1,7 +1,6 @@ -- source include/have_utf16.inc -- source include/have_utf8mb4.inc - SET TIME_ZONE='+03:00'; --disable_warnings @@ -11,6 +10,7 @@ DROP TABLE IF EXISTS t1; --echo # --echo # Start of 5.5 tests --echo # +--disable_service_connection SET NAMES latin1; SET character_set_connection=utf16; @@ -52,6 +52,8 @@ DROP TABLE t1; # # Check LPAD/RPAD # +#enable after fix MDEV-29290 +--disable_view_protocol SELECT hex(LPAD(_utf16 X'0420',10,_utf16 X'0421')); SELECT hex(LPAD(_utf16 X'0420',10,_utf16 X'04210422')); SELECT hex(LPAD(_utf16 X'0420',10,_utf16 X'042104220423')); @@ -65,6 +67,7 @@ SELECT hex(RPAD(_utf16 X'0420',10,_utf16 X'042104220423')); SELECT hex(RPAD(_utf16 X'0420042104220423042404250426042704280429042A042B',10,_utf16 X'042104220423')); SELECT hex(RPAD(_utf16 X'D800DC00', 10, _utf16 X'0421')); SELECT hex(RPAD(_utf16 X'0421', 10, _utf16 X'D800DC00')); +--enable_view_protocol CREATE TABLE t1 SELECT LPAD(_utf16 X'0420',10,_utf16 X'0421') l, @@ -738,6 +741,7 @@ CREATE TABLE t1 ( s3 MEDIUMTEXT CHARACTER SET utf16, s4 LONGTEXT CHARACTER SET utf16 ); +--disable_view_protocol --enable_metadata SET NAMES utf8, @@character_set_results=NULL; SELECT *, HEX(s1) FROM t1; @@ -746,6 +750,7 @@ SELECT *, HEX(s1) FROM t1; SET NAMES utf8; SELECT *, HEX(s1) FROM t1; --disable_metadata +--enable_view_protocol CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; @@ -950,7 +955,7 @@ DROP TABLE t1; VALUES (1) UNION SELECT _utf16 0x0020; VALUES ('') UNION SELECT _utf16 0x0020 COLLATE utf16_bin; VALUES ('') UNION VALUES ( _utf16 0x0020 COLLATE utf16_bin); - +--enable_service_connection --echo # --echo # End of 10.3 tests diff --git a/mysql-test/main/ctype_utf16_uca.result b/mysql-test/main/ctype_utf16_uca.result index d1dbd498064d5..93a0748adc9b2 100644 --- a/mysql-test/main/ctype_utf16_uca.result +++ b/mysql-test/main/ctype_utf16_uca.result @@ -2842,7 +2842,7 @@ level smallint unsigned); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `name` varchar(10) COLLATE utf16_swedish_ci DEFAULT NULL, + `name` varchar(10) DEFAULT NULL, `level` smallint(5) unsigned DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf16 COLLATE=utf16_swedish_ci insert into t1 values ('string',1); @@ -3053,7 +3053,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_unicode_ci DEFAULT NULL, `b` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; a b @@ -3118,7 +3118,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `s1` varchar(64) CHARACTER SET utf16 COLLATE utf16_unicode_ci DEFAULT NULL, `s2` varchar(64) CHARACTER SET utf16 COLLATE utf16_unicode_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); @@ -3215,13 +3215,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(16) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0E33 @@ -3235,13 +3235,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET utf16 COLLATE utf16_unicode_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(80) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0E330E330E330E330E33 @@ -3254,7 +3254,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(48) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 0E330E330E33 @@ -3267,7 +3267,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(160) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 0E330E330E330E330E3302090209020902090209 @@ -3703,7 +3703,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_german2_ci DEFAULT NULL, `b` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; a b @@ -3733,7 +3733,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` varchar(10) CHARACTER SET utf16 COLLATE utf16_unicode_520_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (_utf32 0x0180),(_utf32 0x023A); INSERT INTO t1 VALUES (_utf32 0x023B),(_utf32 0x023C); INSERT INTO t1 VALUES (_utf32 0x023D),(_utf32 0x023E); @@ -4050,7 +4050,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `s1` varchar(64) CHARACTER SET utf16 COLLATE utf16_myanmar_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (s1) VALUES (_ucs2 0x108C), (_ucs2 0x1037), @@ -6635,7 +6635,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(3) CHARACTER SET utf16 COLLATE utf16_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (SPACE(0)),(SPACE(1)),(SPACE(2)); SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(8))) FROM t1; HEX(a) HEX(WEIGHT_STRING(a AS CHAR(8))) @@ -6668,7 +6668,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET utf16 COLLATE utf16_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (_ucs2 0x3400); INSERT INTO t1 VALUES (_ucs2 0xF001); SELECT HEX(CONVERT(a USING ucs2)) AS ucs2, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1; @@ -6681,7 +6681,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET utf16 COLLATE utf16_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('A'),('À'),('Á'),('Â'),('Ã'),('Ä'),('Å'); SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a; a HEX(WEIGHT_STRING(a LEVEL 2)) @@ -6715,7 +6715,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) CHARACTER SET utf16 COLLATE utf16_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a; a HEX(WEIGHT_STRING(a LEVEL 2)) A 0020 @@ -6740,7 +6740,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET utf16 COLLATE utf16_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('cota'),('cote'),('cotz'); INSERT INTO t1 VALUES ('coté'),('côte'),('côté'),('cotë'),('côtë'); SELECT * FROM t1 ORDER BY a; @@ -6887,7 +6887,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `a_id` (`a`,`id`) -) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # # Ascending sort, using filesort # @@ -7329,7 +7329,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_unicode_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf16_unicode_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf16 COLLATE=utf16_unicode_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -7467,7 +7467,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_unicode_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf16_unicode_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf16 COLLATE=utf16_unicode_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -7606,7 +7606,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_unicode_520_nopad_ci' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf16_unicode_520_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf16 COLLATE=utf16_unicode_520_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -7744,7 +7744,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_unicode_520_nopad_ci' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf16_unicode_520_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf16 COLLATE=utf16_unicode_520_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -7885,7 +7885,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(50) CHARACTER SET utf16 COLLATE utf16_unicode_520_nopad_ci DEFAULT NULL, KEY `a` (`a`), KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('111', '111'); INSERT INTO t1 VALUES ('222', '222'); INSERT INTO t1 VALUES ('333', '333'); @@ -7909,7 +7909,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` enum('\0a\0a\0a\0a\0a\0a\0a\0a') CHARACTER SET binary DEFAULT NULL, `d` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`d`)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (c) VALUES (1); SELECT HEX(c) FROM t1; HEX(c) @@ -7921,7 +7921,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` enum('\0a\0a\0a\0a\0a\0a\0a\0a\0a') CHARACTER SET binary DEFAULT NULL, `d` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`d`)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (c) VALUES (1); SELECT HEX(c) FROM t1; HEX(c) @@ -7933,7 +7933,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` enum('\0a\0a\0a\0a\0a\0a\0a\0a\0a\0a') CHARACTER SET binary DEFAULT NULL, `d` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`d`)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (c) VALUES (1); SELECT HEX(c) FROM t1; HEX(c) diff --git a/mysql-test/main/ctype_utf16_uca.test b/mysql-test/main/ctype_utf16_uca.test index cb00ccc0c6134..9dff7b10c16e7 100644 --- a/mysql-test/main/ctype_utf16_uca.test +++ b/mysql-test/main/ctype_utf16_uca.test @@ -9,6 +9,7 @@ DROP TABLE IF EXISTS t1; --echo # Start of 5.5 tests --echo # +--disable_service_connection set names utf8; set collation_connection=utf16_unicode_ci; select hex('a'), hex('a '); @@ -267,7 +268,7 @@ INSERT INTO t1 (c) VALUES (1); SELECT HEX(c) FROM t1; DROP TABLE t1; - +--enable_service_connection --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/ctype_utf16le.result b/mysql-test/main/ctype_utf16le.result index aff755d95ae0c..9bc53a1041dcb 100644 --- a/mysql-test/main/ctype_utf16le.result +++ b/mysql-test/main/ctype_utf16le.result @@ -102,9 +102,9 @@ RPAD(_utf16le X'2004',10,_utf16le X'2104') r; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `l` varchar(10) CHARACTER SET utf16le DEFAULT NULL, - `r` varchar(10) CHARACTER SET utf16le DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `l` varchar(10) CHARACTER SET utf16le COLLATE utf16le_general_ci DEFAULT NULL, + `r` varchar(10) CHARACTER SET utf16le COLLATE utf16le_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(l), HEX(r) FROM t1; HEX(l) HEX(r) 2104210421042104210421042104210421042004 2004210421042104210421042104210421042104 @@ -130,9 +130,9 @@ alter table t1 add key(a); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET utf16le DEFAULT NULL, + `a` varchar(10) CHARACTER SET utf16le COLLATE utf16le_general_ci DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); explain select * from t1 where a like 'abc%'; id select_type table type possible_keys key key_len ref rows Extra @@ -552,8 +552,8 @@ CREATE TABLE t1 (a ENUM('x','y','z') CHARACTER SET utf16le); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('x','y','z') CHARACTER SET utf16le DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` enum('x','y','z') CHARACTER SET utf16le COLLATE utf16le_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('x'); INSERT INTO t1 VALUES ('y'); INSERT INTO t1 VALUES ('z'); @@ -566,8 +566,8 @@ ALTER TABLE t1 CHANGE a a ENUM('x','y','z','d','e','ä','ö','ü') CHARACTER SET SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('x','y','z','d','e','ä','ö','ü') CHARACTER SET utf16le DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` enum('x','y','z','d','e','ä','ö','ü') CHARACTER SET utf16le COLLATE utf16le_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('D'); INSERT INTO t1 VALUES ('E '); INSERT INTO t1 VALUES ('ä'); @@ -588,8 +588,8 @@ CREATE TABLE t1 (a set ('x','y','z','ä','ö','ü') CHARACTER SET utf16le); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` set('x','y','z','ä','ö','ü') CHARACTER SET utf16le DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` set('x','y','z','ä','ö','ü') CHARACTER SET utf16le COLLATE utf16le_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('x'); INSERT INTO t1 VALUES ('y'); INSERT INTO t1 VALUES ('z'); @@ -805,7 +805,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf16le COLLATE utf16le_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84); INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; @@ -951,15 +951,15 @@ NOT NULL DEFAULT 'passive' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `status` enum('active','passive') CHARACTER SET utf16le NOT NULL DEFAULT 'passive' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `status` enum('active','passive') CHARACTER SET utf16le COLLATE utf16le_general_ci NOT NULL DEFAULT 'passive' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 ADD a int NOT NULL AFTER status; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `status` enum('active','passive') CHARACTER SET utf16le NOT NULL DEFAULT 'passive', + `status` enum('active','passive') CHARACTER SET utf16le COLLATE utf16le_general_ci NOT NULL DEFAULT 'passive', `a` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Conversion FROM an UTF16LE string to a decimal column @@ -1555,8 +1555,8 @@ Note 1246 Converting column 'a' from VARCHAR to TEXT SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` mediumtext CHARACTER SET utf16le DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` mediumtext CHARACTER SET utf16le COLLATE utf16le_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Testing that maximim possible key length is 1000 bytes @@ -1565,9 +1565,9 @@ CREATE TABLE t1 (a VARCHAR(250) CHARACTER SET utf16le PRIMARY KEY); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(250) CHARACTER SET utf16le NOT NULL, + `a` varchar(250) CHARACTER SET utf16le COLLATE utf16le_general_ci NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(334) CHARACTER SET utf16le PRIMARY KEY); ERROR 42000: Specified key was too long; max key length is 1000 bytes @@ -1600,9 +1600,9 @@ select null, null; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `s1` varchar(64) CHARACTER SET utf16le DEFAULT NULL, - `s2` varchar(64) CHARACTER SET utf16le DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `s1` varchar(64) CHARACTER SET utf16le COLLATE utf16le_general_ci DEFAULT NULL, + `s2` varchar(64) CHARACTER SET utf16le COLLATE utf16le_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); @@ -1704,8 +1704,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 64) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) CHARACTER SET utf16le DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(64) CHARACTER SET utf16le COLLATE utf16le_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (''); SELECT CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1; CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) @@ -1755,8 +1755,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a',2) as s1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `s1` varchar(2) CHARACTER SET utf16le DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `s1` varchar(2) CHARACTER SET utf16le COLLATE utf16le_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE'); SELECT * FROM t1 ORDER BY s1; s1 @@ -1815,8 +1815,8 @@ CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `CONCAT(s1)` varchar(255) CHARACTER SET utf16le DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `CONCAT(s1)` varchar(255) CHARACTER SET utf16le COLLATE utf16le_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; # # Problem found by Roy during review @@ -1831,7 +1831,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` varchar(10) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL, PRIMARY KEY (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('abc'),('zyx'),('acb'); SELECT UPPER(c) FROM t1 ORDER BY 1 DESC; UPPER(c) @@ -1850,14 +1850,14 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf16le NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET utf16le COLLATE utf16le_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0041 @@ -1870,14 +1870,14 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf16le DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET utf16le COLLATE utf16le_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 00410041004100410041 @@ -1890,7 +1890,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 004100410041 @@ -1903,7 +1903,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 0041004100410041004100200020002000200020 @@ -2101,13 +2101,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 000061 @@ -2121,13 +2121,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET utf16le COLLATE utf16le_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(15) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 000061000061000061000061000061 @@ -2140,7 +2140,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 000061000061000061 @@ -2153,7 +2153,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 000061000061000061000061000061000020000020000020000020000020 @@ -2352,8 +2352,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `t` varchar(10) CHARACTER SET utf16le DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `t` varchar(10) CHARACTER SET utf16le COLLATE utf16le_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI'); SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub; c2 @@ -2456,7 +2456,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16le_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf16le_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf16le COLLATE=utf16le_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2594,7 +2594,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16le_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf16le_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf16le COLLATE=utf16le_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2733,7 +2733,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16le_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf16le_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf16le COLLATE=utf16le_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2871,7 +2871,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16le_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf16le_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf16le COLLATE=utf16le_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); diff --git a/mysql-test/main/ctype_utf16le.test b/mysql-test/main/ctype_utf16le.test index e3163d2f73ea1..537a456f7dbb5 100644 --- a/mysql-test/main/ctype_utf16le.test +++ b/mysql-test/main/ctype_utf16le.test @@ -3,6 +3,8 @@ -- source include/have_utf32.inc -- source include/have_utf8mb4.inc +--disable_service_connection + let $MYSQLD_DATADIR= `select @@datadir`; SET TIME_ZONE='+03:00'; @@ -701,6 +703,7 @@ CREATE TABLE t1 ( s3 MEDIUMTEXT CHARACTER SET utf16le, s4 LONGTEXT CHARACTER SET utf16le ); +--disable_view_protocol --enable_metadata SET NAMES utf8, @@character_set_results=NULL; SELECT *, HEX(s1) FROM t1; @@ -709,6 +712,7 @@ SELECT *, HEX(s1) FROM t1; SET NAMES utf8; SELECT *, HEX(s1) FROM t1; --disable_metadata +--enable_view_protocol CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; @@ -846,6 +850,7 @@ SELECT TABLE_NAME, TABLE_SCHEMA, HEX(TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES DROP TABLE t; SET NAMES utf8; +--enable_service_connection --echo # --echo # End of 10.2 tests diff --git a/mysql-test/main/ctype_utf32.result b/mysql-test/main/ctype_utf32.result index d7717ece2104b..a84b4e0d5367c 100644 --- a/mysql-test/main/ctype_utf32.result +++ b/mysql-test/main/ctype_utf32.result @@ -100,9 +100,9 @@ RPAD(_utf32 X'0420',10,_utf32 X'0421') r; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `l` varchar(10) CHARACTER SET utf32 DEFAULT NULL, - `r` varchar(10) CHARACTER SET utf32 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `l` varchar(10) CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL, + `r` varchar(10) CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(l), hex(r) from t1; hex(l) hex(r) 00000421000004210000042100000421000004210000042100000421000004210000042100000420 00000420000004210000042100000421000004210000042100000421000004210000042100000421 @@ -126,9 +126,9 @@ alter table t1 add key(a); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET utf32 DEFAULT NULL, + `a` varchar(10) CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); explain select * from t1 where a like 'abc%'; id select_type table type possible_keys key key_len ref rows Extra @@ -509,8 +509,8 @@ create table t1 (a enum('x','y','z') character set utf32); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('x','y','z') CHARACTER SET utf32 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` enum('x','y','z') CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('x'); insert into t1 values ('y'); insert into t1 values ('z'); @@ -523,8 +523,8 @@ alter table t1 change a a enum('x','y','z','d','e','ä','ö','ü') character set show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('x','y','z','d','e','ä','ö','ü') CHARACTER SET utf32 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` enum('x','y','z','d','e','ä','ö','ü') CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('D'); insert into t1 values ('E '); insert into t1 values ('ä'); @@ -545,8 +545,8 @@ create table t1 (a set ('x','y','z','ä','ö','ü') character set utf32); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` set('x','y','z','ä','ö','ü') CHARACTER SET utf32 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` set('x','y','z','ä','ö','ü') CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('x'); insert into t1 values ('y'); insert into t1 values ('z'); @@ -761,7 +761,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84); INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; @@ -894,15 +894,15 @@ NOT NULL default 'passive' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `status` enum('active','passive') CHARACTER SET utf32 NOT NULL DEFAULT 'passive' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `status` enum('active','passive') CHARACTER SET utf32 COLLATE utf32_general_ci NOT NULL DEFAULT 'passive' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 ADD a int NOT NULL AFTER status; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `status` enum('active','passive') CHARACTER SET utf32 NOT NULL DEFAULT 'passive', + `status` enum('active','passive') CHARACTER SET utf32 COLLATE utf32_general_ci NOT NULL DEFAULT 'passive', `a` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; End of 4.1 tests CREATE TABLE t1 (a varchar(64) character set utf32, b decimal(10,3)); @@ -1291,16 +1291,16 @@ Note 1246 Converting column 'a' from VARCHAR to TEXT show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` mediumtext CHARACTER SET utf32 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` mediumtext CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a varchar(250) character set utf32 primary key); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(250) CHARACTER SET utf32 NOT NULL, + `a` varchar(250) CHARACTER SET utf32 COLLATE utf32_general_ci NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a varchar(334) character set utf32 primary key); ERROR 42000: Specified key was too long; max key length is 1000 bytes @@ -1380,8 +1380,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 64) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) CHARACTER SET utf32 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(64) CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (''); SELECT CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1; CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) @@ -1433,9 +1433,9 @@ select null, null; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `s1` varchar(64) CHARACTER SET utf32 DEFAULT NULL, - `s2` varchar(64) CHARACTER SET utf32 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `s1` varchar(64) CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL, + `s2` varchar(64) CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); @@ -1495,8 +1495,8 @@ CREATE TABLE t1 AS SELECT repeat('a',2) as s1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `s1` varchar(2) CHARACTER SET utf32 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `s1` varchar(2) CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE'); SELECT * FROM t1 ORDER BY s1; s1 @@ -1556,8 +1556,8 @@ CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `CONCAT(s1)` varchar(255) CHARACTER SET utf32 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `CONCAT(s1)` varchar(255) CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; # # Bug#45263 utf32_general_ci, bad effects around CREATE TABLE AS SELECT @@ -1590,8 +1590,8 @@ CREATE TABLE t1 AS SELECT format(123,2,'no_NO'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `format(123,2,'no_NO')` varchar(17) CHARACTER SET utf32 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `format(123,2,'no_NO')` varchar(17) CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; format(123,2,'no_NO') 123,00 @@ -1727,14 +1727,14 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf32 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0041 @@ -1747,14 +1747,14 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf32 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 00410041004100410041 @@ -1767,7 +1767,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 004100410041 @@ -1780,7 +1780,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 0041004100410041004100200020002000200020 @@ -1978,13 +1978,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 000061 @@ -1998,13 +1998,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET utf32 COLLATE utf32_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(15) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 000061000061000061000061000061 @@ -2017,7 +2017,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 000061000061000061 @@ -2030,7 +2030,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 000061000061000061000061000061000020000020000020000020000020 @@ -2265,8 +2265,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `t` varchar(10) CHARACTER SET utf32 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `t` varchar(10) CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI'); SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub; c2 @@ -2326,7 +2326,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf32_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf32 COLLATE=utf32_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2464,7 +2464,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf32_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf32 COLLATE=utf32_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2603,7 +2603,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf32_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf32 COLLATE=utf32_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2741,7 +2741,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf32_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf32 COLLATE=utf32_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -2881,7 +2881,7 @@ t1 CREATE TABLE `t1` ( `c1` enum('\0\0\0a','\0\0\0b','\0\0\0a\0\0\0c') CHARACTER SET binary DEFAULT NULL, `c2` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`c2`)), `c3` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (c1) VALUES (1),(2),(3); SELECT HEX(c1) FROM t1 ORDER BY c1; HEX(c1) @@ -2890,5 +2890,53 @@ HEX(c1) 0000006100000063 DROP TABLE t1; # +# MDEV-23210 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on ALTER TABLE, SELECT and INSERT +# +CREATE TABLE t1 (a CHAR(1)); +SET COLLATION_CONNECTION=utf32_general_ci, CHARACTER_SET_CLIENT=binary; +ALTER TABLE t1 CHANGE a a ENUM('a','a') CHARACTER SET utf32; +ERROR HY000: Column 'a' has duplicated value 'a' in ENUM +ALTER TABLE t1 CHANGE a a ENUM('aaa') CHARACTER SET utf32; +ERROR HY000: Invalid utf32 character string: '\x00aaa' +ALTER TABLE t1 CHANGE a a ENUM('aa') CHARACTER SET utf32; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` enum('慡') CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 CHANGE a a ENUM('a','b') CHARACTER SET utf32; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` enum('a','b') CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +SET NAMES utf8; +# +# MDEV-28078 Garbage on multiple equal ENUMs with tricky character sets +# +CREATE TABLE t1 ( +c1 ENUM ('a','b') CHARACTER SET utf32 DEFAULT 'a', +c2 ENUM ('a','b') CHARACTER SET utf32 DEFAULT 'a' +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` enum('a','b') CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT 'a', + `c2` enum('a','b') CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT 'a' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 ( +c1 ENUM ('00000061','00000062') DEFAULT '00000061' COLLATE latin1_bin, +c2 ENUM ('a','b') DEFAULT 'a' COLLATE utf32_general_ci +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` enum('00000061','00000062') CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '00000061', + `c2` enum('a','b') CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT 'a' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# # End of 10.2 tests # diff --git a/mysql-test/main/ctype_utf32.test b/mysql-test/main/ctype_utf32.test index 59cc13015af07..1ef1214d7565d 100644 --- a/mysql-test/main/ctype_utf32.test +++ b/mysql-test/main/ctype_utf32.test @@ -1,6 +1,7 @@ -- source include/have_utf32.inc -- source include/have_utf8mb4.inc +--disable_service_connection SET TIME_ZONE = '+03:00'; --disable_warnings @@ -62,12 +63,18 @@ DROP TABLE t1; SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'0421')); SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'0000042100000422')); SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'000004210000042200000423')); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT hex(LPAD(_utf32 X'000004200000042100000422000004230000042400000425000004260000042700000428000004290000042A0000042B',10,_utf32 X'000004210000042200000423')); +--enable_view_protocol SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'0421')); SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'0000042100000422')); SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'000004210000042200000423')); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT hex(RPAD(_utf32 X'000004200000042100000422000004230000042400000425000004260000042700000428000004290000042A0000042B',10,_utf32 X'000004210000042200000423')); +--enable_view_protocol CREATE TABLE t1 SELECT LPAD(_utf32 X'0420',10,_utf32 X'0421') l, @@ -117,8 +124,11 @@ DROP TABLE t1; # # Check that INSERT() works fine. # This invokes charpos() function. +#enable after fix MDEV-27871 +--disable_view_protocol select insert(_utf32 0x000000610000006200000063,10,2,_utf32 0x000000640000006500000066); select insert(_utf32 0x000000610000006200000063,1,2,_utf32 0x000000640000006500000066); +--enable_view_protocol ####################################################### @@ -794,6 +804,7 @@ CREATE TABLE t1 ( s3 MEDIUMTEXT CHARACTER SET utf32, s4 LONGTEXT CHARACTER SET utf32 ); +--disable_view_protocol --enable_metadata SET NAMES utf8mb4, @@character_set_results=NULL; SELECT *, HEX(s1) FROM t1; @@ -802,6 +813,7 @@ SELECT *, HEX(s1) FROM t1; SET NAMES utf8mb4; SELECT *, HEX(s1) FROM t1; --disable_metadata +--enable_view_protocol CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; @@ -872,8 +884,10 @@ ORDER BY l DESC; --echo # --echo # incorrect charset for val_str_ascii --echo # - +#enable after fix MDEV-27871 +--disable_view_protocol SELECT '2010-10-10 10:10:10' + INTERVAL GeometryType(GeomFromText('POINT(1 1)')) hour_second; +--enable_view_protocol --echo # --echo # MDEV-5745 analyze MySQL fix for bug#12368495 @@ -1048,6 +1062,44 @@ INSERT INTO t1 (c1) VALUES (1),(2),(3); SELECT HEX(c1) FROM t1 ORDER BY c1; DROP TABLE t1; + +--echo # +--echo # MDEV-23210 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on ALTER TABLE, SELECT and INSERT +--echo # + +CREATE TABLE t1 (a CHAR(1)); +SET COLLATION_CONNECTION=utf32_general_ci, CHARACTER_SET_CLIENT=binary; +--error ER_DUPLICATED_VALUE_IN_TYPE +ALTER TABLE t1 CHANGE a a ENUM('a','a') CHARACTER SET utf32; +--error ER_INVALID_CHARACTER_STRING +ALTER TABLE t1 CHANGE a a ENUM('aaa') CHARACTER SET utf32; +ALTER TABLE t1 CHANGE a a ENUM('aa') CHARACTER SET utf32; +SHOW CREATE TABLE t1; +ALTER TABLE t1 CHANGE a a ENUM('a','b') CHARACTER SET utf32; +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET NAMES utf8; + + +--echo # +--echo # MDEV-28078 Garbage on multiple equal ENUMs with tricky character sets +--echo # + +CREATE TABLE t1 ( + c1 ENUM ('a','b') CHARACTER SET utf32 DEFAULT 'a', + c2 ENUM ('a','b') CHARACTER SET utf32 DEFAULT 'a' +); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 ( + c1 ENUM ('00000061','00000062') DEFAULT '00000061' COLLATE latin1_bin, + c2 ENUM ('a','b') DEFAULT 'a' COLLATE utf32_general_ci +); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--enable_service_connection --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/ctype_utf32_innodb.result b/mysql-test/main/ctype_utf32_innodb.result new file mode 100644 index 0000000000000..82b7348cabb0a --- /dev/null +++ b/mysql-test/main/ctype_utf32_innodb.result @@ -0,0 +1,34 @@ +# +# Start of 10.3 tests +# +# +# MDEV-28062 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on INSERT..SELECT +# +SET sql_mode=''; +CREATE TABLE t1 ( +HOST CHAR DEFAULT '%', +USER CHAR DEFAULT '%', +ROLE CHAR DEFAULT '%', +ENABLED ENUM ('a','a') DEFAULT 'a', +HISTORY ENUM ('a','a') DEFAULT 'a' +) COLLATE=utf32_general_ci ENGINE=InnoDB; +Warnings: +Note 1291 Column 'ENABLED' has duplicated value 'a' in ENUM +Note 1291 Column 'HISTORY' has duplicated value 'a' in ENUM +INSERT INTO t1 SELECT * FROM t1; +DROP TABLE t1; +CREATE TABLE t1 ( +HOST CHAR DEFAULT '%', +USER CHAR DEFAULT '%', +ROLE CHAR DEFAULT '%', +ENABLED ENUM ('a','a') DEFAULT 'a', +HISTORY ENUM ('a','a') DEFAULT 'a' +) COLLATE=utf32_general_ci ENGINE=MyISAM; +Warnings: +Note 1291 Column 'ENABLED' has duplicated value 'a' in ENUM +Note 1291 Column 'HISTORY' has duplicated value 'a' in ENUM +INSERT INTO t1 SELECT * FROM t1; +DROP TABLE t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/ctype_utf32_innodb.test b/mysql-test/main/ctype_utf32_innodb.test new file mode 100644 index 0000000000000..1663b5adafbcf --- /dev/null +++ b/mysql-test/main/ctype_utf32_innodb.test @@ -0,0 +1,35 @@ +--source include/have_innodb.inc + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-28062 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on INSERT..SELECT +--echo # + +SET sql_mode=''; + +CREATE TABLE t1 ( + HOST CHAR DEFAULT '%', + USER CHAR DEFAULT '%', + ROLE CHAR DEFAULT '%', + ENABLED ENUM ('a','a') DEFAULT 'a', + HISTORY ENUM ('a','a') DEFAULT 'a' +) COLLATE=utf32_general_ci ENGINE=InnoDB; +INSERT INTO t1 SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 ( + HOST CHAR DEFAULT '%', + USER CHAR DEFAULT '%', + ROLE CHAR DEFAULT '%', + ENABLED ENUM ('a','a') DEFAULT 'a', + HISTORY ENUM ('a','a') DEFAULT 'a' +) COLLATE=utf32_general_ci ENGINE=MyISAM; +INSERT INTO t1 SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/ctype_utf32_uca.result b/mysql-test/main/ctype_utf32_uca.result index 32ecf49dc705c..a960325afe9de 100644 --- a/mysql-test/main/ctype_utf32_uca.result +++ b/mysql-test/main/ctype_utf32_uca.result @@ -2842,7 +2842,7 @@ level smallint unsigned); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `name` varchar(10) COLLATE utf32_swedish_ci DEFAULT NULL, + `name` varchar(10) DEFAULT NULL, `level` smallint(5) unsigned DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf32 COLLATE=utf32_swedish_ci insert into t1 values ('string',1); @@ -3053,7 +3053,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_unicode_ci DEFAULT NULL, `b` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; a b @@ -3118,7 +3118,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `s1` varchar(64) CHARACTER SET utf32 COLLATE utf32_unicode_ci DEFAULT NULL, `s2` varchar(64) CHARACTER SET utf32 COLLATE utf32_unicode_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); @@ -3235,13 +3235,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(16) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0E33 @@ -3255,13 +3255,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET utf32 COLLATE utf32_unicode_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(80) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0E330E330E330E330E33 @@ -3274,7 +3274,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(48) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 0E330E330E33 @@ -3287,7 +3287,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(160) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 0E330E330E330E330E3302090209020902090209 @@ -3723,7 +3723,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_german2_ci DEFAULT NULL, `b` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; a b @@ -3753,7 +3753,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` varchar(10) CHARACTER SET utf32 COLLATE utf32_unicode_520_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (_utf32 0x0180),(_utf32 0x023A); INSERT INTO t1 VALUES (_utf32 0x023B),(_utf32 0x023C); INSERT INTO t1 VALUES (_utf32 0x023D),(_utf32 0x023E); @@ -4070,7 +4070,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `s1` varchar(64) CHARACTER SET utf32 COLLATE utf32_myanmar_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (s1) VALUES (_ucs2 0x108C), (_ucs2 0x1037), @@ -6655,7 +6655,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(3) CHARACTER SET utf32 COLLATE utf32_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (SPACE(0)),(SPACE(1)),(SPACE(2)); SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(8))) FROM t1; HEX(a) HEX(WEIGHT_STRING(a AS CHAR(8))) @@ -6688,7 +6688,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET utf32 COLLATE utf32_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (_ucs2 0x3400); INSERT INTO t1 VALUES (_ucs2 0xF001); SELECT HEX(CONVERT(a USING ucs2)) AS ucs2, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1; @@ -6701,7 +6701,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET utf32 COLLATE utf32_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('A'),('À'),('Á'),('Â'),('Ã'),('Ä'),('Å'); SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a; a HEX(WEIGHT_STRING(a LEVEL 2)) @@ -6735,7 +6735,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) CHARACTER SET utf32 COLLATE utf32_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a; a HEX(WEIGHT_STRING(a LEVEL 2)) A 0020 @@ -6760,7 +6760,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET utf32 COLLATE utf32_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('cota'),('cote'),('cotz'); INSERT INTO t1 VALUES ('coté'),('côte'),('côté'),('cotë'),('côtë'); SELECT * FROM t1 ORDER BY a; @@ -6907,7 +6907,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `a_id` (`a`,`id`) -) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # # Ascending sort, using filesort # @@ -7349,7 +7349,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_unicode_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf32_unicode_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf32 COLLATE=utf32_unicode_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -7487,7 +7487,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_unicode_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf32_unicode_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf32 COLLATE=utf32_unicode_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -7626,7 +7626,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_unicode_520_nopad_ci' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf32_unicode_520_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf32 COLLATE=utf32_unicode_520_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -7764,7 +7764,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_unicode_520_nopad_ci' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf32_unicode_520_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf32 COLLATE=utf32_unicode_520_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -7905,7 +7905,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(50) CHARACTER SET utf32 COLLATE utf32_unicode_520_nopad_ci DEFAULT NULL, KEY `a` (`a`), KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('111', '111'); INSERT INTO t1 VALUES ('222', '222'); INSERT INTO t1 VALUES ('333', '333'); @@ -7941,6 +7941,21 @@ EXECUTE s; DEALLOCATE PREPARE s; SET NAMES utf8; # +# MDEV-23210 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on ALTER TABLE, SELECT and INSERT +# +CREATE TABLE t1 (a CHAR(1)); +SET COLLATION_CONNECTION=utf32_myanmar_ci, CHARACTER_SET_CLIENT=binary; +ALTER TABLE t1 CHANGE a a ENUM('a','a') CHARACTER SET utf32; +ERROR HY000: Column 'a' has duplicated value 'a' in ENUM +ALTER TABLE t1 CHANGE a a ENUM('a','b') CHARACTER SET utf32; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` enum('a','b') CHARACTER SET utf32 COLLATE utf32_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +SET NAMES utf8; +# # End of 10.2 tests # # @@ -7956,7 +7971,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` set('\0\0\0a') CHARACTER SET binary DEFAULT NULL, `c2` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`c2`)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # End of 10.4 tests diff --git a/mysql-test/main/ctype_utf32_uca.test b/mysql-test/main/ctype_utf32_uca.test index 0abc6a73fc852..658a03abacbff 100644 --- a/mysql-test/main/ctype_utf32_uca.test +++ b/mysql-test/main/ctype_utf32_uca.test @@ -8,6 +8,7 @@ DROP TABLE IF EXISTS t1; --echo # --echo # Start of 5.5 tests --echo # +--disable_service_connection set names utf8; set collation_connection=utf32_unicode_ci; @@ -290,6 +291,20 @@ EXECUTE s; DEALLOCATE PREPARE s; SET NAMES utf8; +--echo # +--echo # MDEV-23210 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on ALTER TABLE, SELECT and INSERT +--echo # + +CREATE TABLE t1 (a CHAR(1)); +SET COLLATION_CONNECTION=utf32_myanmar_ci, CHARACTER_SET_CLIENT=binary; +--error ER_DUPLICATED_VALUE_IN_TYPE +ALTER TABLE t1 CHANGE a a ENUM('a','a') CHARACTER SET utf32; +ALTER TABLE t1 CHANGE a a ENUM('a','b') CHARACTER SET utf32; +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET NAMES utf8; + +--enable_service_connection --echo # --echo # End of 10.2 tests diff --git a/mysql-test/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result index 6eebc8f4cf252..a10dbfea17902 100644 --- a/mysql-test/main/ctype_utf8.result +++ b/mysql-test/main/ctype_utf8.result @@ -127,8 +127,8 @@ create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d"); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; date_format("2004-01-19 10:10:10", "%Y-%m-%d") 2004-01-19 @@ -279,9 +279,9 @@ select null, null; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `s1` varchar(64) CHARACTER SET utf8mb3 DEFAULT NULL, - `s2` varchar(64) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `s1` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `s2` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); @@ -367,8 +367,8 @@ create table t1 (a enum('aaaa','проба') character set utf8); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('aaaa','проба') CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` enum('aaaa','проба') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('проба'); select * from t1; a @@ -377,8 +377,8 @@ create table t2 select ifnull(a,a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `ifnull(a,a)` varchar(5) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `ifnull(a,a)` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t2; ifnull(a,a) проба @@ -503,9 +503,9 @@ unique key a using hash (c(1)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` char(10) CHARACTER SET utf8mb3 DEFAULT NULL, + `c` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING HASH -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -539,9 +539,9 @@ unique key a using btree (c(1)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` char(10) CHARACTER SET utf8mb3 DEFAULT NULL, + `c` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING BTREE -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -663,7 +663,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING HASH -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -699,7 +699,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING BTREE -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -901,9 +901,9 @@ create table t2 select concat(a,_utf8'') as a, concat(b,_utf8'')as b from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(5) CHARACTER SET utf8mb3 DEFAULT NULL, - `b` varchar(15) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `b` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; drop table t1; select 'c' like '\_' as want0; @@ -1132,9 +1132,9 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL, + `a` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `b` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; a b @@ -2277,7 +2277,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SELECT _utf8mb3'test'; test @@ -2297,7 +2297,7 @@ t1 CREATE TABLE `t1` ( `Tape` tinytext DEFAULT NULL, PRIMARY KEY (`clipid`), KEY `tape` (`Tape`(255)) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE t1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( @@ -2467,8 +2467,8 @@ CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `CONCAT(s1)` varchar(255) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `CONCAT(s1)` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; SET NAMES utf8; SET TIME_ZONE = _latin1 '+03:00'; @@ -2482,8 +2482,8 @@ create table t1 as select concat(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1; hex(c1) 31 @@ -2495,8 +2495,8 @@ create table t1 as select concat(18446744073709551615) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(20) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1; hex(c1) 3138343436373434303733373039353531363135 @@ -2508,8 +2508,8 @@ create table t1 as select concat(1.1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1; hex(c1) 312E31 @@ -2521,8 +2521,8 @@ create table t1 as select concat(1+2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1-2)); hex(concat(1-2)) @@ -2531,8 +2531,8 @@ create table t1 as select concat(1-2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1*2)); hex(concat(1*2)) @@ -2541,8 +2541,8 @@ create table t1 as select concat(1*2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1/2)); hex(concat(1/2)) @@ -2551,8 +2551,8 @@ create table t1 as select concat(1/2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(7) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(7) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1 div 2)); hex(concat(1 div 2)) @@ -2561,8 +2561,8 @@ create table t1 as select concat(1 div 2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1 % 2)); hex(concat(1 % 2)) @@ -2571,8 +2571,8 @@ create table t1 as select concat(1 % 2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(-1)); hex(concat(-1)) @@ -2581,8 +2581,8 @@ create table t1 as select concat(-1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(-(1+2))); hex(concat(-(1+2))) @@ -2591,8 +2591,8 @@ create table t1 as select concat(-(1+2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1|2)); hex(concat(1|2)) @@ -2601,8 +2601,8 @@ create table t1 as select concat(1|2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(1&2)); hex(concat(1&2)) @@ -2611,8 +2611,8 @@ create table t1 as select concat(1&2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(bit_count(12))); hex(concat(bit_count(12))) @@ -2621,8 +2621,8 @@ create table t1 as select concat(bit_count(12)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(2<<1)); hex(concat(2<<1)) @@ -2631,8 +2631,8 @@ create table t1 as select concat(2<<1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(2>>1)); hex(concat(2>>1)) @@ -2641,8 +2641,8 @@ create table t1 as select concat(2>>1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(~0)); hex(concat(~0)) @@ -2651,8 +2651,8 @@ create table t1 as select concat(~0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(3^2)); hex(concat(3^2)) @@ -2661,8 +2661,8 @@ create table t1 as select concat(3^2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(abs(-2))); hex(concat(abs(-2))) @@ -2671,8 +2671,8 @@ create table t1 as select concat(abs(-2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(exp(2)),1)); hex(left(concat(exp(2)),1)) @@ -2681,8 +2681,8 @@ create table t1 as select concat(exp(2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(log(2)),1)); hex(left(concat(log(2)),1)) @@ -2691,8 +2691,8 @@ create table t1 as select concat(log(2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(log2(2)),1)); hex(left(concat(log2(2)),1)) @@ -2701,8 +2701,8 @@ create table t1 as select concat(log2(2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(log10(2)),1)); hex(left(concat(log10(2)),1)) @@ -2711,8 +2711,8 @@ create table t1 as select concat(log10(2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(sqrt(2)),1)); hex(left(concat(sqrt(2)),1)) @@ -2721,8 +2721,8 @@ create table t1 as select concat(sqrt(2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(pow(2,2)),1)); hex(left(concat(pow(2,2)),1)) @@ -2731,8 +2731,8 @@ create table t1 as select concat(pow(2,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(acos(0.5)),1)); hex(left(concat(acos(0.5)),1)) @@ -2741,8 +2741,8 @@ create table t1 as select concat(acos(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(asin(0.5)),1)); hex(left(concat(asin(0.5)),1)) @@ -2751,8 +2751,8 @@ create table t1 as select concat(asin(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(atan(0.5)),1)); hex(left(concat(atan(0.5)),1)) @@ -2761,8 +2761,8 @@ create table t1 as select concat(atan(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(cos(0.5)),1)); hex(left(concat(cos(0.5)),1)) @@ -2771,8 +2771,8 @@ create table t1 as select concat(cos(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(sin(0.5)),1)); hex(left(concat(sin(0.5)),1)) @@ -2781,8 +2781,8 @@ create table t1 as select concat(sin(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(tan(0.5)),1)); hex(left(concat(tan(0.5)),1)) @@ -2791,8 +2791,8 @@ create table t1 as select concat(tan(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(degrees(0))); hex(concat(degrees(0))) @@ -2801,8 +2801,8 @@ create table t1 as select concat(degrees(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(radians(0))); hex(concat(radians(0))) @@ -2811,8 +2811,8 @@ create table t1 as select concat(radians(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ceiling(0.5))); hex(concat(ceiling(0.5))) @@ -2822,8 +2822,8 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c0` int(3) NOT NULL, - `c1` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(floor(0.5))); hex(concat(floor(0.5))) @@ -2833,8 +2833,8 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c0` int(3) NOT NULL, - `c1` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(round(0.5))); hex(concat(round(0.5))) @@ -2843,8 +2843,8 @@ create table t1 as select concat(round(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(sign(0.5))); hex(concat(sign(0.5))) @@ -2853,15 +2853,15 @@ create table t1 as select concat(sign(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(rand()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(length('a'))); hex(concat(length('a'))) @@ -2870,8 +2870,8 @@ create table t1 as select concat(length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(char_length('a'))); hex(concat(char_length('a'))) @@ -2880,8 +2880,8 @@ create table t1 as select concat(char_length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(bit_length('a'))); hex(concat(bit_length('a'))) @@ -2890,8 +2890,8 @@ create table t1 as select concat(bit_length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(11) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(coercibility('a'))); hex(concat(coercibility('a'))) @@ -2900,8 +2900,8 @@ create table t1 as select concat(coercibility('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(locate('a','a'))); hex(concat(locate('a','a'))) @@ -2910,8 +2910,8 @@ create table t1 as select concat(locate('a','a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(11) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(field('c','a','b','c'))); hex(concat(field('c','a','b','c'))) @@ -2920,8 +2920,8 @@ create table t1 as select concat(field('c','a','b','c')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ascii(61))); hex(concat(ascii(61))) @@ -2930,8 +2930,8 @@ create table t1 as select concat(ascii(61)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ord(61))); hex(concat(ord(61))) @@ -2940,8 +2940,8 @@ create table t1 as select concat(ord(61)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(7) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(7) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(find_in_set('b','a,b,c,d'))); hex(concat(find_in_set('b','a,b,c,d'))) @@ -2950,8 +2950,8 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select md5('a'), hex(md5('a')); md5('a') hex(md5('a')) @@ -2960,8 +2960,8 @@ create table t1 as select md5('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(32) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select old_password('a'), hex(old_password('a')); old_password('a') hex(old_password('a')) @@ -2970,8 +2970,8 @@ create table t1 as select old_password('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(16) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(16) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select password('a'), hex(password('a')); password('a') hex(password('a')) @@ -2980,8 +2980,8 @@ create table t1 as select password('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(41) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(41) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select sha('a'), hex(sha('a')); sha('a') hex(sha('a')) @@ -2990,8 +2990,8 @@ create table t1 as select sha('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(40) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(40) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select sha1('a'), hex(sha1('a')); sha1('a') hex(sha1('a')) @@ -3000,8 +3000,8 @@ create table t1 as select sha1('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(40) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(40) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast('-1' as signed))); hex(concat(cast('-1' as signed))) @@ -3010,8 +3010,8 @@ create table t1 as select concat(cast('-1' as signed)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast('1' as unsigned))); hex(concat(cast('1' as unsigned))) @@ -3020,8 +3020,8 @@ create table t1 as select concat(cast('1' as unsigned)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast(1/2 as decimal(5,5)))); hex(concat(cast(1/2 as decimal(5,5)))) @@ -3030,8 +3030,8 @@ create table t1 as select concat(cast(1/2 as decimal(5,5))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(7) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(7) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(cast('2001-01-02 03:04:05' as date))); hex(concat(cast('2001-01-02 03:04:05' as date))) @@ -3040,8 +3040,8 @@ create table t1 as select concat(cast('2001-01-02 03:04:05' as date)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2001-01-02 @@ -3053,8 +3053,8 @@ create table t1 as select concat(cast('2001-01-02 03:04:05' as time)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 03:04:05 @@ -3066,8 +3066,8 @@ create table t1 as select concat(cast('2001-01-02' as datetime)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2001-01-02 00:00:00 @@ -3079,8 +3079,8 @@ create table t1 as select concat(least(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(greatest(1,2))); hex(concat(greatest(1,2))) @@ -3089,8 +3089,8 @@ create table t1 as select concat(greatest(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(case when 11 then 22 else 33 end)); hex(concat(case when 11 then 22 else 33 end)) @@ -3099,8 +3099,8 @@ create table t1 as select concat(case when 11 then 22 else 33 end) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(coalesce(1,2))); hex(concat(coalesce(1,2))) @@ -3109,8 +3109,8 @@ create table t1 as select concat(coalesce(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat_ws(1,2,3)); hex(concat_ws(1,2,3)) @@ -3119,8 +3119,8 @@ create table t1 as select concat_ws(1,2,3) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(group_concat(1,2,3)); hex(group_concat(1,2,3)) @@ -3129,15 +3129,15 @@ create table t1 as select group_concat(1,2,3) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` mediumtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select 1 as c1 union select 'a'; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select hex(c1) from t1 order by c1; hex(c1) 31 @@ -3147,8 +3147,8 @@ create table t1 as select concat(last_insert_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(benchmark(0,0))); hex(concat(benchmark(0,0))) @@ -3157,8 +3157,8 @@ create table t1 as select concat(benchmark(0,0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(sleep(0))); hex(concat(sleep(0))) @@ -3167,8 +3167,8 @@ create table t1 as select concat(sleep(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(is_free_lock('xxxx'))); hex(concat(is_free_lock('xxxx'))) @@ -3177,22 +3177,22 @@ create table t1 as select concat(is_free_lock('xxxx')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(is_used_lock('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(release_lock('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(crc32(''))); hex(concat(crc32(''))) @@ -3201,8 +3201,8 @@ create table t1 as select concat(crc32('')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(uncompressed_length(''))); hex(concat(uncompressed_length(''))) @@ -3211,15 +3211,15 @@ create table t1 as select concat(uncompressed_length('')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(connection_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(inet_aton('127.1.1.1'))); hex(concat(inet_aton('127.1.1.1'))) @@ -3228,8 +3228,8 @@ create table t1 as select concat(inet_aton('127.1.1.1')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(inet_ntoa(2130772225))); hex(concat(inet_ntoa(2130772225))) @@ -3241,8 +3241,8 @@ c1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(31) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(31) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select 1; 1 @@ -3254,8 +3254,8 @@ create table t1 as select concat(row_count()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(found_rows())); hex(concat(found_rows())) @@ -3264,22 +3264,22 @@ create table t1 as select concat(found_rows()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(uuid_short()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(uuid()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(36) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(36) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); coercibility(uuid()) coercibility(cast('a' as char character set latin1)) @@ -3292,14 +3292,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(37) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@a1:=1)); hex(concat(@a1:=1)) @@ -3311,9 +3311,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL, + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `c2` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a2=1; select hex(concat(@a2)); @@ -3326,9 +3326,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(20) CHARACTER SET utf8mb3 DEFAULT NULL, + `c1` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `c2` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@a1:=sqrt(1))); hex(concat(@a1:=sqrt(1))) @@ -3340,9 +3340,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL, + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `c2` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a2=sqrt(1); select hex(concat(@a2)); @@ -3355,9 +3355,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL, + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `c2` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@a1:=1.1)); hex(concat(@a1:=1.1)) @@ -3369,9 +3369,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8mb3 DEFAULT NULL, + `c1` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `c2` decimal(2,1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a2=1.1; select hex(concat(@a2)); @@ -3384,9 +3384,9 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(83) CHARACTER SET utf8mb3 DEFAULT NULL, + `c1` varchar(83) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `c2` decimal(65,38) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(@@ft_max_word_len)); hex(concat(@@ft_max_word_len)) @@ -3398,8 +3398,8 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a'='a' IS TRUE)); hex(concat('a'='a' IS TRUE)) @@ -3408,8 +3408,8 @@ create table t1 as select concat('a'='a' IS TRUE) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a'='a' IS NOT TRUE)); hex(concat('a'='a' IS NOT TRUE)) @@ -3418,8 +3418,8 @@ create table t1 as select concat('a'='a' IS NOT TRUE) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NOT 'a'='a')); hex(concat(NOT 'a'='a')) @@ -3428,8 +3428,8 @@ create table t1 as select concat(NOT 'a'='a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' IS NULL)); hex(concat('a' IS NULL)) @@ -3438,8 +3438,8 @@ create table t1 as select concat('a' IS NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' IS NOT NULL)); hex(concat('a' IS NOT NULL)) @@ -3448,8 +3448,8 @@ create table t1 as select concat('a' IS NOT NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' rlike 'a')); hex(concat('a' rlike 'a')) @@ -3458,8 +3458,8 @@ create table t1 as select concat('a' IS NOT NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(strcmp('a','b'))); hex(concat(strcmp('a','b'))) @@ -3468,8 +3468,8 @@ create table t1 as select concat(strcmp('a','b')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' like 'a')); hex(concat('a' like 'a')) @@ -3478,8 +3478,8 @@ create table t1 as select concat('a' like 'b') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' between 'b' and 'c')); hex(concat('a' between 'b' and 'c')) @@ -3488,8 +3488,8 @@ create table t1 as select concat('a' between 'b' and 'c') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat('a' in ('a','b'))); hex(concat('a' in ('a','b'))) @@ -3498,8 +3498,8 @@ create table t1 as select concat('a' in ('a','b')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(interval(23, 1, 15, 17, 30, 44, 200))); hex(concat(interval(23, 1, 15, 17, 30, 44, 200))) @@ -3508,8 +3508,8 @@ create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a varchar(10), fulltext key(a)); insert into t1 values ('a'); @@ -3520,8 +3520,8 @@ create table t2 as select concat(match (a) against ('a')) as a from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; select hex(ifnull(1,'a')); hex(ifnull(1,'a')) @@ -3530,8 +3530,8 @@ create table t1 as select ifnull(1,'a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ifnull(1,1))); hex(concat(ifnull(1,1))) @@ -3540,8 +3540,8 @@ create table t1 as select concat(ifnull(1,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(ifnull(1.1,1.1))); hex(concat(ifnull(1.1,1.1))) @@ -3550,8 +3550,8 @@ create table t1 as select concat(ifnull(1.1,1.1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(if(1,'b',1)); hex(if(1,'b',1)) @@ -3560,8 +3560,8 @@ create table t1 as select if(1,'b',1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(if(1,1,'b')); hex(if(1,1,'b')) @@ -3570,8 +3570,8 @@ create table t1 as select if(1,1,'b') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(if(1,1,1))); hex(concat(if(1,1,1))) @@ -3580,8 +3580,8 @@ create table t1 as select concat(if(1,1,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(nullif(1,2))); hex(concat(nullif(1,2))) @@ -3590,8 +3590,8 @@ create table t1 as select concat(nullif(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)')))); hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)')))) @@ -3600,8 +3600,8 @@ create table t1 as select concat(Dimension(GeomFromText('LINSTRING(0 0,10 10)')) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) @@ -3610,8 +3610,8 @@ create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))); hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) @@ -3620,8 +3620,8 @@ create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) @@ -3630,8 +3630,8 @@ create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))); hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) @@ -3640,8 +3640,8 @@ create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0, show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))); hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) @@ -3650,8 +3650,8 @@ create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(21) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))); hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) @@ -3660,8 +3660,8 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) @@ -3670,8 +3670,8 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) @@ -3685,8 +3685,8 @@ create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(y(GeomFromText('Point(1 2)')))); hex(concat(y(GeomFromText('Point(1 2)')))) @@ -3695,8 +3695,8 @@ create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))); hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) @@ -3705,8 +3705,8 @@ create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))); hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) @@ -3715,8 +3715,8 @@ create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(23) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(GeometryType(GeomFromText('Point(1 2)')))); hex(concat(GeometryType(GeomFromText('Point(1 2)')))) @@ -3725,8 +3725,8 @@ create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(20) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(AsText(GeomFromText('Point(1 2)')))); hex(concat(AsText(GeomFromText('Point(1 2)')))) @@ -3735,8 +3735,8 @@ create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` longtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(period_add(200902, 2))); hex(concat(period_add(200902, 2))) @@ -3745,8 +3745,8 @@ create table t1 as select concat(period_add(200902, 2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(period_diff(200902, 200802))); hex(concat(period_diff(200902, 200802))) @@ -3758,8 +3758,8 @@ Warning 1265 Data truncated for column 'c1' at row 1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET utf8mb3 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(to_days(20090224))); hex(concat(to_days(20090224))) @@ -3768,8 +3768,8 @@ create table t1 as select concat(to_days(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(dayofmonth(20090224))); hex(concat(dayofmonth(20090224))) @@ -3778,8 +3778,8 @@ create table t1 as select concat(dayofmonth(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(dayofyear(20090224))); hex(concat(dayofyear(20090224))) @@ -3788,8 +3788,8 @@ create table t1 as select concat(dayofyear(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(hour('10:11:12'))); hex(concat(hour('10:11:12'))) @@ -3798,8 +3798,8 @@ create table t1 as select concat(hour('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(minute('10:11:12'))); hex(concat(minute('10:11:12'))) @@ -3808,8 +3808,8 @@ create table t1 as select concat(minute('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(second('10:11:12'))); hex(concat(second('10:11:12'))) @@ -3818,8 +3818,8 @@ create table t1 as select concat(second('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(quarter(20090224))); hex(concat(quarter(20090224))) @@ -3828,8 +3828,8 @@ create table t1 as select concat(quarter(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(week(20090224))); hex(concat(week(20090224))) @@ -3838,8 +3838,8 @@ create table t1 as select concat(week(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(yearweek(20090224))); hex(concat(yearweek(20090224))) @@ -3848,8 +3848,8 @@ create table t1 as select concat(yearweek(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(year(20090224))); hex(concat(year(20090224))) @@ -3858,8 +3858,8 @@ create table t1 as select concat(year(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(weekday(20090224))); hex(concat(weekday(20090224))) @@ -3868,8 +3868,8 @@ create table t1 as select concat(weekday(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(dayofweek(20090224))); hex(concat(dayofweek(20090224))) @@ -3878,8 +3878,8 @@ create table t1 as select concat(dayofweek(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(unix_timestamp(20090224))); hex(concat(unix_timestamp(20090224))) @@ -3888,8 +3888,8 @@ create table t1 as select concat(unix_timestamp(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(17) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(17) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(time_to_sec('10:11:12'))); hex(concat(time_to_sec('10:11:12'))) @@ -3898,8 +3898,8 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(17) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(17) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(extract(year from 20090702))); hex(concat(extract(year from 20090702))) @@ -3908,8 +3908,8 @@ create table t1 as select concat(extract(year from 20090702)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(microsecond('12:00:00.123456'))); hex(concat(microsecond('12:00:00.123456'))) @@ -3918,8 +3918,8 @@ create table t1 as select concat(microsecond('12:00:00.123456')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(month(20090224))); hex(concat(month(20090224))) @@ -3928,15 +3928,15 @@ create table t1 as select concat(month(20090224)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(last_day('2003-02-05')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select c1, hex(c1) from t1; c1 hex(c1) 2003-02-28 323030332D30322D3238 @@ -3945,8 +3945,8 @@ create table t1 as select concat(from_days(730669)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select c1, hex(c1) from t1; c1 hex(c1) 2000-07-03 323030302D30372D3033 @@ -3955,22 +3955,22 @@ create table t1 as select concat(curdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(utc_date()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(curtime()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select repeat('a',20) as c1 limit 0; set timestamp=1216359724; @@ -3985,8 +3985,8 @@ create table t1 as select concat(utc_time()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(sec_to_time(2378))); hex(concat(sec_to_time(2378))) @@ -3995,8 +3995,8 @@ create table t1 as select concat(sec_to_time(2378)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))); hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) @@ -4005,8 +4005,8 @@ create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00: show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(maketime(10,11,12))); hex(concat(maketime(10,11,12))) @@ -4015,8 +4015,8 @@ create table t1 as select concat(maketime(10,11,12)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(get_format(DATE,'USA')); hex(get_format(DATE,'USA')) @@ -4025,8 +4025,8 @@ create table t1 as select get_format(DATE,'USA') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(17) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(17) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(concat(from_unixtime(1111885200)),4)); hex(left(concat(from_unixtime(1111885200)),4)) @@ -4035,8 +4035,8 @@ create table t1 as select concat(from_unixtime(1111885200)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))); hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) @@ -4045,8 +4045,8 @@ create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:0 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) @@ -4055,8 +4055,8 @@ create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2004-01-02 12:00:00 @@ -4068,8 +4068,8 @@ create table t1 as select concat(makedate(2009,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; c1 2009-01-01 @@ -4078,22 +4078,22 @@ create table t1 as select concat(now()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(utc_timestamp()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(sysdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(addtime('00:00:00','11:22:33'))); hex(concat(addtime('00:00:00','11:22:33'))) @@ -4102,8 +4102,8 @@ create table t1 as select concat(addtime('00:00:00','11:22:33')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(26) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(26) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(concat(subtime('23:59:59','11:22:33'))); hex(concat(subtime('23:59:59','11:22:33'))) @@ -4112,8 +4112,8 @@ create table t1 as select concat(subtime('23:59:59','11:22:33')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(26) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(26) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(elt(1,2,3)); hex(elt(1,2,3)) @@ -4122,8 +4122,8 @@ create table t1 as select elt(1,2,3) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(export_set(1,2,3,4,2)); hex(export_set(1,2,3,4,2)) @@ -4132,8 +4132,8 @@ create table t1 as select export_set(1,2,3,4,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(127) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(127) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(insert(1133,3,0,22)); hex(insert(1133,3,0,22)) @@ -4142,8 +4142,8 @@ create table t1 as select insert(1133,3,0,22) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(6) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(lcase(123)); hex(lcase(123)) @@ -4152,8 +4152,8 @@ create table t1 as select lcase(123) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(left(123,1)); hex(left(123,1)) @@ -4162,8 +4162,8 @@ create table t1 as select left(123,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(lower(123)); hex(lower(123)) @@ -4172,8 +4172,8 @@ create table t1 as select lower(123) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(lpad(1,2,0)); hex(lpad(1,2,0)) @@ -4182,8 +4182,8 @@ create table t1 as select lpad(1,2,0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(ltrim(1)); hex(ltrim(1)) @@ -4192,8 +4192,8 @@ create table t1 as select ltrim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(mid(1,1,1)); hex(mid(1,1,1)) @@ -4202,8 +4202,8 @@ create table t1 as select mid(1,1,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(repeat(1,2)); hex(repeat(1,2)) @@ -4212,8 +4212,8 @@ create table t1 as select repeat(1,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(replace(1,1,2)); hex(replace(1,1,2)) @@ -4222,8 +4222,8 @@ create table t1 as select replace(1,1,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(reverse(12)); hex(reverse(12)) @@ -4232,8 +4232,8 @@ create table t1 as select reverse(12) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(right(123,1)); hex(right(123,1)) @@ -4242,8 +4242,8 @@ create table t1 as select right(123,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(rpad(1,2,0)); hex(rpad(1,2,0)) @@ -4252,8 +4252,8 @@ create table t1 as select rpad(1,2,0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(rtrim(1)); hex(rtrim(1)) @@ -4262,8 +4262,8 @@ create table t1 as select rtrim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(soundex(1)); hex(soundex(1)) @@ -4272,8 +4272,8 @@ create table t1 as select soundex(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(substring(1,1,1)); hex(substring(1,1,1)) @@ -4282,8 +4282,8 @@ create table t1 as select substring(1,1,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(trim(1)); hex(trim(1)) @@ -4292,8 +4292,8 @@ create table t1 as select trim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(ucase(1)); hex(ucase(1)) @@ -4302,8 +4302,8 @@ create table t1 as select ucase(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select hex(upper(1)); hex(upper(1)) @@ -4312,15 +4312,15 @@ create table t1 as select upper(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select repeat(' ', 64) as a limit 0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ("1.1"), ("2.1"); select a, hex(a) from t1; a hex(a) @@ -4341,8 +4341,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(4) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a tinyint zerofill); insert into t1 values (1), (10), (100); @@ -4369,8 +4369,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(12) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(12) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a smallint); insert into t1 values (1); @@ -4381,8 +4381,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(6) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(6) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a smallint zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -4403,8 +4403,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(9) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(9) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a mediumint zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -4425,8 +4425,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(11) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a int zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -4447,8 +4447,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(20) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a bigint zerofill); insert into t1 values (1), (10), (100), (1000), (10000); @@ -4472,8 +4472,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(12) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(12) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a float zerofill); insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); @@ -4497,8 +4497,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(22) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(22) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a double zerofill); insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); @@ -4521,8 +4521,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a year); insert into t1 values (1); @@ -4533,8 +4533,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(4) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a bit(64)); insert into t1 values (1); @@ -4546,7 +4546,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `concat(a)` varbinary(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (0); @@ -4569,8 +4569,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(19) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a date); insert into t1 values ('2001-02-03'); @@ -4583,8 +4583,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a time); insert into t1 values (1); @@ -4601,8 +4601,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a datetime); insert into t1 values ('2001-02-03 04:05:06'); @@ -4615,8 +4615,8 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(19) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (a tinyint); insert into t1 values (1); @@ -4932,14 +4932,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(1)) as c1; show columns from v1; Field Type Null Key Default Extra @@ -4963,14 +4963,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` decimal(18,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(123.45)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(123.45)) as c1; show columns from v1; Field Type Null Key Default Extra @@ -4994,14 +4994,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(123.45)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(123.45)) as c1; show columns from v1; Field Type Null Key Default Extra @@ -5025,14 +5025,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as select concat(f1(cast('2001-01-02' as date))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create view v1 as select concat(f1(cast('2001-01-02' as date))) as c1; show columns from v1; Field Type Null Key Default Extra @@ -5108,117 +5108,117 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `CONCAT(a)` varchar(9) CHARACTER SET utf8mb3 DEFAULT NULL, - `IFNULL(a,'')` varchar(9) CHARACTER SET utf8mb3 NOT NULL, - `IF(a,a,'')` varchar(9) CHARACTER SET utf8mb3 DEFAULT NULL, - `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET utf8mb3 DEFAULT NULL, - `COALESCE(a,'')` varchar(9) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `CONCAT(a)` varchar(9) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `IFNULL(a,'')` varchar(9) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `IF(a,a,'')` varchar(9) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `COALESCE(a,'')` varchar(9) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LCASE(a) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LCASE(a)` varchar(9) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `LCASE(a)` varchar(9) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT UCASE(a) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `UCASE(a)` varchar(9) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `UCASE(a)` varchar(9) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `REPEAT(1,2)` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `REPEAT(1,2)` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LEFT(123,2)` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `LEFT(123,2)` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `RIGHT(123,2)` varchar(2) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `RIGHT(123,2)` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LTRIM(123)` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `LTRIM(123)` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `RTRIM(123)` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `RTRIM(123)` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `ELT(1,111,222,333)` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `ELT(1,111,222,333)` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `REPLACE(111,2,3)` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `REPLACE(111,2,3)` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `SOUNDEX(1)` varchar(4) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `SOUNDEX(1)` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8); SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -5265,11 +5265,11 @@ DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_da SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `field_str1` varchar(19) CHARACTER SET utf8mb3 DEFAULT NULL, - `field1_str2` varchar(19) CHARACTER SET utf8mb3 DEFAULT NULL, + `field_str1` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `field1_str2` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `field_date` date DEFAULT NULL, `field_datetime` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SELECT DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1, @@ -5312,11 +5312,11 @@ DATE_ADD('2001-01-01 10:01:01',interval 10 second) AS date_add2; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `addtime1` varchar(26) CHARACTER SET utf8mb3 DEFAULT NULL, - `addtime2` varchar(26) CHARACTER SET utf8mb3 DEFAULT NULL, - `date_add1` varchar(19) CHARACTER SET utf8mb3 DEFAULT NULL, - `date_add2` varchar(19) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `addtime1` varchar(26) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `addtime2` varchar(26) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `date_add1` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `date_add2` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; addtime1 addtime2 date_add1 date_add2 20:01:01 20:01:01 2001-01-01 10:01:11 2001-01-01 10:01:11 @@ -5382,7 +5382,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `d` date DEFAULT NULL, `bad` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; SET NAMES latin1; SET sql_mode=''; @@ -5464,11 +5464,11 @@ ADD KEY(ch); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `ch` varchar(60) CHARACTER SET utf8mb3 DEFAULT NULL, + `ch` varchar(60) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `ch` (`ch`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch @@ -5683,11 +5683,11 @@ ADD KEY(ch); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `ch` varchar(60) CHARACTER SET utf8mb3 DEFAULT NULL, + `ch` varchar(60) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `ch` (`ch`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch @@ -5902,11 +5902,11 @@ ADD KEY(ch); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `ch` varchar(60) CHARACTER SET utf8mb3 DEFAULT NULL, + `ch` varchar(60) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `ch` (`ch`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch @@ -6142,12 +6142,12 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `c0` varchar(19) CHARACTER SET utf8mb3 NOT NULL, - `c1` varchar(19) CHARACTER SET utf8mb3 NOT NULL, - `c2` varchar(19) CHARACTER SET utf8mb3 NOT NULL, - `c3` varchar(19) CHARACTER SET utf8mb3 NOT NULL, - `c4` varchar(19) CHARACTER SET utf8mb3 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c0` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `c1` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `c2` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `c3` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `c4` varchar(19) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; c0 c1 c2 c3 c4 2012-06-11 15:17:34 2012-06-11 15:17:34 2012-06-11 15:17:34 2012-06-11 15:17:34 2012-06-11 15:17:34 @@ -6276,14 +6276,14 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8mb3 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0041 @@ -6296,14 +6296,14 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 00410041004100410041 @@ -6316,7 +6316,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 004100410041 @@ -6329,7 +6329,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 0041004100410041004100200020002000200020 @@ -6521,13 +6521,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0061 @@ -6541,13 +6541,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 00610061006100610061 @@ -6560,7 +6560,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 006100610061 @@ -6573,7 +6573,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 0061006100610061006100200020002000200020 @@ -6795,7 +6795,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; c1 @@ -6818,7 +6818,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); c1 @@ -6841,7 +6841,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); c1 @@ -6864,7 +6864,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); c1 @@ -6890,7 +6890,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; a LENGTH(a) @@ -6915,8 +6915,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; c1 @@ -6938,8 +6938,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); c1 @@ -6961,8 +6961,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); c1 @@ -6984,8 +6984,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); c1 @@ -7010,8 +7010,8 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('a'),('a '); SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; a LENGTH(a) @@ -7035,8 +7035,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a',10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('ae'),('ä'); SELECT * FROM t1 WHERE c1='ä'; c1 @@ -10256,8 +10256,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `t` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `t` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI'); SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub; c2 @@ -10291,7 +10291,7 @@ SELECT * FROM t1 WHERE a=10; a 1e1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1é1' +Warning 1292 Truncated incorrect DECIMAL value: '1é1' SELECT * FROM t1 WHERE a='1e1'; a 1e1 @@ -10300,12 +10300,12 @@ SELECT * FROM t1 WHERE a=10 AND a='1e1'; a 1e1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1é1' +Warning 1292 Truncated incorrect DECIMAL value: '1é1' SELECT * FROM t1 WHERE (a,a)=(10,'1e1'); a 1e1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1é1' +Warning 1292 Truncated incorrect DECIMAL value: '1é1' EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,a)=(10,'1e1'); 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 @@ -10322,17 +10322,17 @@ SELECT * FROM t1 WHERE a IN (1,2); a 1ë1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1ë1' +Warning 1292 Truncated incorrect DECIMAL value: '1ë1' SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1'; a 1ë1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1ë1' +Warning 1292 Truncated incorrect DECIMAL value: '1ë1' SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1'; a 1ë1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1ë1' +Warning 1292 Truncated incorrect DECIMAL value: '1ë1' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1'; 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 @@ -10620,7 +10620,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT concat('ß') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); SELECT HEX(a),a FROM t1; HEX(a) a @@ -10635,7 +10635,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT concat('ß'), `b` varchar(30) DEFAULT concat('ß'), `c` varchar(30) DEFAULT concat('ß') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DELETE FROM t1; INSERT INTO t1 VALUES(); SELECT * FROM t1; @@ -10655,8 +10655,8 @@ SET NAMES utf8; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(30) CHARACTER SET utf8mb3 DEFAULT concat('ß') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT concat('ß') +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); SELECT HEX(a), a FROM t1; HEX(a) a @@ -10668,7 +10668,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT concat('ß') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); SELECT HEX(a) FROM t1; HEX(a) @@ -10679,8 +10679,8 @@ CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 DEFAULT CONCAT('ß')); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(30) CHARACTER SET utf8mb3 DEFAULT concat('ß') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT concat('ß') +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); SELECT HEX(a) FROM t1; HEX(a) @@ -10700,7 +10700,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb3_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -10838,7 +10838,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb3_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -10977,7 +10977,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb3_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -11115,7 +11115,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb3_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -11296,7 +11296,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `COALESCE('ßa',_binary 'a')` varbinary(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET sql_mode=DEFAULT; # @@ -11383,6 +11383,181 @@ a # End of 10.3 tests # # +# Start of 10.4 tests +# +# +# MDEV-27653 long uniques don't work with unicode collations +# +SET NAMES utf8mb3; +CREATE TABLE t1 ( +a CHAR(30) COLLATE utf8mb3_general_ci, +UNIQUE KEY(a) USING HASH +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('ä'); +ERROR 23000: Duplicate entry 'ä' for key 'a' +SELECT * FROM t1; +a +a +DROP TABLE t1; +CREATE TABLE t1 ( +a CHAR(30) COLLATE utf8mb3_general_ci, +UNIQUE KEY(a(10)) USING HASH +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(10)) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('ä'); +ERROR 23000: Duplicate entry 'ä' for key 'a' +SELECT * FROM t1; +a +a +DROP TABLE t1; +CREATE TABLE t1 ( +a VARCHAR(30) COLLATE utf8mb3_general_ci, +UNIQUE KEY(a) USING HASH +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('ä'); +ERROR 23000: Duplicate entry 'ä' for key 'a' +SELECT * FROM t1; +a +a +DROP TABLE t1; +CREATE TABLE t1 ( +a VARCHAR(30) COLLATE utf8mb3_general_ci, +UNIQUE KEY(a(10)) USING HASH +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(10)) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('ä'); +ERROR 23000: Duplicate entry 'ä' for key 'a' +SELECT * FROM t1; +a +a +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COLLATE utf8mb3_general_ci UNIQUE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('ä'); +ERROR 23000: Duplicate entry 'ä' for key 'a' +SELECT * FROM t1; +a +a +DROP TABLE t1; +CREATE TABLE t1 ( +a LONGTEXT COLLATE utf8mb3_general_ci, +UNIQUE KEY(a(10)) USING HASH +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(10)) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('ä'); +ERROR 23000: Duplicate entry 'ä' for key 'a' +SELECT * FROM t1; +a +a +DROP TABLE t1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +a OCTET_LENGTH(a) +a 1 +ä 2 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check error Upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it! +INSERT INTO t1 VALUES ('A'); +ERROR 23000: Duplicate entry 'A' for key 'a' +INSERT INTO t1 VALUES ('Ä'); +ERROR 23000: Duplicate entry 'Ä' for key 'a' +INSERT INTO t1 VALUES ('Ấ'); +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +a OCTET_LENGTH(a) +a 1 +ä 2 +Ấ 3 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check error Upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it! +ALTER TABLE t1 FORCE; +ERROR 23000: Duplicate entry 'ä' for key 'a' +DELETE FROM t1 WHERE OCTET_LENGTH(a)>1; +ALTER TABLE t1 FORCE; +INSERT INTO t1 VALUES ('ä'); +ERROR 23000: Duplicate entry 'ä' for key 'a' +DROP TABLE t1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +a OCTET_LENGTH(a) +a 1 +ä 2 +ALTER IGNORE TABLE t1 FORCE; +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +a OCTET_LENGTH(a) +a 1 +DROP TABLE t1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +a OCTET_LENGTH(a) +a 1 +ä 2 +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair Warning Number of rows changed from 2 to 1 +test.t1 repair status OK +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +a OCTET_LENGTH(a) +a 1 +DROP TABLE t1; +# +# End of 10.4 tests +# +# # Start of 10.5 tests # # @@ -11397,7 +11572,7 @@ t1 CREATE TABLE `t1` ( `CAST(1 AS BINARY)` varbinary(1) DEFAULT NULL, `CAST(@a AS BINARY)` varbinary(20) DEFAULT NULL, `CAST(@b:=3 AS BINARY)` varbinary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-20890 Illegal mix of collations with UUID() diff --git a/mysql-test/main/ctype_utf8.test b/mysql-test/main/ctype_utf8.test index 63b75d8e26361..99b952cdfb885 100644 --- a/mysql-test/main/ctype_utf8.test +++ b/mysql-test/main/ctype_utf8.test @@ -1,7 +1,11 @@ +--source include/no_valgrind_without_big.inc # # Tests with the utf8 character set # +# Enable after fix MDEV-27904 +-- source include/no_view_protocol.inc + let $MYSQLD_DATADIR= `select @@datadir`; let collation=utf8mb3_unicode_ci; @@ -2309,6 +2313,164 @@ VALUES (_latin1 0xDF) UNION VALUES(_utf8'a' COLLATE utf8_bin); --echo # +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-27653 long uniques don't work with unicode collations +--echo # + +SET NAMES utf8mb3; + +# CHAR + +CREATE TABLE t1 ( + a CHAR(30) COLLATE utf8mb3_general_ci, + UNIQUE KEY(a) USING HASH +); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('a'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('ä'); +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 ( + a CHAR(30) COLLATE utf8mb3_general_ci, + UNIQUE KEY(a(10)) USING HASH +); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('a'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('ä'); +SELECT * FROM t1; +DROP TABLE t1; + + +# VARCHAR + +CREATE TABLE t1 ( + a VARCHAR(30) COLLATE utf8mb3_general_ci, + UNIQUE KEY(a) USING HASH +); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('a'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('ä'); +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 ( + a VARCHAR(30) COLLATE utf8mb3_general_ci, + UNIQUE KEY(a(10)) USING HASH +); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('a'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('ä'); +SELECT * FROM t1; +DROP TABLE t1; + + +# TEXT + +CREATE TABLE t1 (a TEXT COLLATE utf8mb3_general_ci UNIQUE); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('a'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('ä'); +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 ( + a LONGTEXT COLLATE utf8mb3_general_ci, + UNIQUE KEY(a(10)) USING HASH +); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('a'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('ä'); +SELECT * FROM t1; +DROP TABLE t1; + + +# Testing upgrade: +# Prior to MDEV-27653, the UNIQUE HASH function errorneously +# took into account string octet length. +# Old tables should still open and work, but with wrong results. + +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.frm $MYSQLD_DATADIR/test/t1.frm; +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYD $MYSQLD_DATADIR/test/t1.MYD; +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYI $MYSQLD_DATADIR/test/t1.MYI; +SHOW CREATE TABLE t1; +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +CHECK TABLE t1; + +# There is already a one byte value 'a' in the table +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('A'); + +# There is already a two-byte value 'ä' in the table +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('Ä'); + +# There were no three-byte values in the table so far. +# The below value violates UNIQUE, but it gets inserted. +# This is wrong but expected for a pre-MDEV-27653 table. +INSERT INTO t1 VALUES ('Ấ'); +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +CHECK TABLE t1; + +# ALTER FORCE fails: it tries to rebuild the table +# with a correct UNIQUE HASH function, but there are duplicates! +--error ER_DUP_ENTRY +ALTER TABLE t1 FORCE; + +# Let's remove all duplicate values, so only the one-byte 'a' stays. +# ALTER..FORCE should work after that. +DELETE FROM t1 WHERE OCTET_LENGTH(a)>1; +ALTER TABLE t1 FORCE; + +# Make sure that 'a' and 'ä' cannot co-exists any more, +# because the table was recreated with a correct UNIQUE HASH function. +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('ä'); +DROP TABLE t1; + +# +# Testing an old table with ALTER IGNORE. +# The table is expected to rebuild with a new hash function, +# duplicates go away. +# +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.frm $MYSQLD_DATADIR/test/t1.frm; +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYD $MYSQLD_DATADIR/test/t1.MYD; +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYI $MYSQLD_DATADIR/test/t1.MYI; +SHOW CREATE TABLE t1; +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +ALTER IGNORE TABLE t1 FORCE; +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +DROP TABLE t1; + +# +# Testing an old table with REPAIR. +# The table is expected to rebuild with a new hash function, +# duplicates go away. +# +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.frm $MYSQLD_DATADIR/test/t1.frm; +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYD $MYSQLD_DATADIR/test/t1.MYD; +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYI $MYSQLD_DATADIR/test/t1.MYI; +SHOW CREATE TABLE t1; +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +REPAIR TABLE t1; +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +DROP TABLE t1; + +--echo # +--echo # End of 10.4 tests +--echo # + + --echo # --echo # Start of 10.5 tests --echo # diff --git a/mysql-test/main/ctype_utf8_def_upgrade.result b/mysql-test/main/ctype_utf8_def_upgrade.result index 29bcbe299ec47..d30f867053620 100644 --- a/mysql-test/main/ctype_utf8_def_upgrade.result +++ b/mysql-test/main/ctype_utf8_def_upgrade.result @@ -44,7 +44,7 @@ t1 CREATE TABLE `t1` ( `Index_priv` enum('N','Y') NOT NULL DEFAULT 'N', `Alter_priv` enum('N','Y') NOT NULL DEFAULT 'N', PRIMARY KEY (`Host`,`Db`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Host privileges; Merged with database privileges' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='Host privileges; Merged with database privileges' DROP TABLE t1; SET @@character_set_database=DEFAULT; # Now do the same, but doing 'ALTER DATABASE' to create the db.opt file, @@ -52,7 +52,7 @@ SET @@character_set_database=DEFAULT; # Emulate a pre-4.1 database without db.opt SHOW CREATE DATABASE db1; Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 */ +db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */ USE db1; SELECT @@character_set_database, 'taken from defaults' AS comment; @@character_set_database comment @@ -90,7 +90,7 @@ t1 CREATE TABLE `t1` ( `Index_priv` enum('N','Y') NOT NULL DEFAULT 'N', `Alter_priv` enum('N','Y') NOT NULL DEFAULT 'N', PRIMARY KEY (`Host`,`Db`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Host privileges; Merged with database privileges' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='Host privileges; Merged with database privileges' DROP TABLE t1; DROP DATABASE db1; USE test; diff --git a/mysql-test/main/ctype_utf8_uca.result b/mysql-test/main/ctype_utf8_uca.result index 930f71f36d709..1cc44e7fd265b 100644 --- a/mysql-test/main/ctype_utf8_uca.result +++ b/mysql-test/main/ctype_utf8_uca.result @@ -16,7 +16,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_unicode_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb3_unicode_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -154,7 +154,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_unicode_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb3_unicode_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -293,7 +293,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_unicode_520_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb3_unicode_520_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_520_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -431,7 +431,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_unicode_520_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb3_unicode_520_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_520_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -572,7 +572,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, KEY `a` (`a`), KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('111', '111'); INSERT INTO t1 VALUES ('222', '222'); INSERT INTO t1 VALUES ('333', '333'); @@ -587,3 +587,325 @@ DROP TABLE t1; # # End of 10.2 tests # +# +# Start of 10.3 tests +# +# +# MDEV-30556 UPPER() returns an empty string for U+0251 in Unicode-5.2.0+ collations for utf8 +# +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_ci /*Unicode-4.0 folding*/; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A C8BA C8BA Ⱥ +23E C8BE C8BE Ⱦ +23F C8BF C8BF ȿ +240 C980 C980 ɀ +250 C990 C990 ɐ +251 C991 C991 ɑ +252 C992 C992 ɒ +26B C9AB C9AB ɫ +271 C9B1 C9B1 ɱ +27D C9BD C9BD ɽ +DROP TABLE case_folding; +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_520_ci; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_520_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE ȿ +240 C980 E2B1BF ɀ +250 C990 E2B1AF ɐ +251 C991 E2B1AD ɑ +252 C992 E2B1B0 ɒ +26B C9AB E2B1A2 ɫ +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_520_nopad_ci; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_520_nopad_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE ȿ +240 C980 E2B1BF ɀ +250 C990 E2B1AF ɐ +251 C991 E2B1AD ɑ +252 C992 E2B1B0 ɒ +26B C9AB E2B1A2 ɫ +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +SET NAMES utf8mb3 COLLATE utf8mb3_myanmar_ci; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_myanmar_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE ȿ +240 C980 E2B1BF ɀ +250 C990 E2B1AF ɐ +251 C991 E2B1AD ɑ +252 C992 E2B1B0 ɒ +26B C9AB E2B1A2 ɫ +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +SET NAMES utf8mb3 COLLATE utf8mb3_thai_520_w2; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_thai_520_w2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE ȿ +240 C980 E2B1BF ɀ +250 C990 E2B1AF ɐ +251 C991 E2B1AD ɑ +252 C992 E2B1B0 ɒ +26B C9AB E2B1A2 ɫ +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +# +# End of 10.3 tests +# +# +# Start of 10.4 tests +# +SET DEFAULT_STORAGE_ENGINE=MyISAM; +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_nopad_ci; +# +# MDEV-30034 UNIQUE USING HASH accepts duplicate entries for tricky collations +# +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a TEXT COLLATE ,' + 'UNIQUE(a(3)))', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +ERROR 23000: Duplicate entry 'ß ' for key 'a' +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a TEXT COLLATE ,' + 'UNIQUE(a(3)) USING HASH)', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +ERROR 23000: Duplicate entry 'ß ' for key 'a' +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a VARCHAR(2000) COLLATE ,' + 'UNIQUE(a(3)))', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(2000) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +ERROR 23000: Duplicate entry 'ß ' for key 'a' +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a VARCHAR(2000) COLLATE ,' + 'UNIQUE(a(3)) USING HASH)', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(2000) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +ERROR 23000: Duplicate entry 'ß ' for key 'a' +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a CHAR(20) COLLATE ,' + 'UNIQUE(a(3)) USING HASH)', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; +SET DEFAULT_STORAGE_ENGINE=HEAP; +# +# MDEV-30034 UNIQUE USING HASH accepts duplicate entries for tricky collations +# +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a VARCHAR(2000) COLLATE ,' + 'UNIQUE(a(3)))', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(2000) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +ERROR 23000: Duplicate entry 'ß ' for key 'a' +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a VARCHAR(2000) COLLATE ,' + 'UNIQUE(a(3)) USING HASH)', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(2000) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) USING HASH +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +ERROR 23000: Duplicate entry 'ß ' for key 'a' +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a CHAR(20) COLLATE ,' + 'UNIQUE(a(3)))', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a CHAR(20) COLLATE ,' + 'UNIQUE(a(3)) USING HASH)', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) USING HASH +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; +SET DEFAULT_STORAGE_ENGINE=DEFAULT; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/ctype_utf8_uca.test b/mysql-test/main/ctype_utf8_uca.test index 0879b4d28105d..6361bd32a4a85 100644 --- a/mysql-test/main/ctype_utf8_uca.test +++ b/mysql-test/main/ctype_utf8_uca.test @@ -21,3 +21,50 @@ SET NAMES utf8 COLLATE utf8_unicode_nopad_ci; --echo # --echo # End of 10.2 tests --echo # + + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-30556 UPPER() returns an empty string for U+0251 in Unicode-5.2.0+ collations for utf8 +--echo # + +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_ci /*Unicode-4.0 folding*/; +--source include/ctype_casefolding.inc + +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_520_ci; +--source include/ctype_casefolding.inc + +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_520_nopad_ci; +--source include/ctype_casefolding.inc + +SET NAMES utf8mb3 COLLATE utf8mb3_myanmar_ci; +--source include/ctype_casefolding.inc + +SET NAMES utf8mb3 COLLATE utf8mb3_thai_520_w2; +--source include/ctype_casefolding.inc + + +--echo # +--echo # End of 10.3 tests +--echo # + + +--echo # +--echo # Start of 10.4 tests +--echo # + +SET DEFAULT_STORAGE_ENGINE=MyISAM; +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_nopad_ci; +--source include/ctype_nopad_prefix_unique.inc + +SET DEFAULT_STORAGE_ENGINE=HEAP; +--source include/ctype_nopad_prefix_unique.inc + +SET DEFAULT_STORAGE_ENGINE=DEFAULT; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/ctype_utf8mb3_general_ci_casefold.result b/mysql-test/main/ctype_utf8mb3_general_ci_casefold.result new file mode 100644 index 0000000000000..9911cb3ede7e9 --- /dev/null +++ b/mysql-test/main/ctype_utf8mb3_general_ci_casefold.result @@ -0,0 +1,1427 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET NAMES utf8mb3 COLLATE utf8mb3_general_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +utf8mb3_general_ci +SELECT +codepoint_hex4, +HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)), +HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +FROM v_bmp +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); +codepoint_hex4 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +0041 0061 0041 +0042 0062 0042 +0043 0063 0043 +0044 0064 0044 +0045 0065 0045 +0046 0066 0046 +0047 0067 0047 +0048 0068 0048 +0049 0069 0049 +004A 006A 004A +004B 006B 004B +004C 006C 004C +004D 006D 004D +004E 006E 004E +004F 006F 004F +0050 0070 0050 +0051 0071 0051 +0052 0072 0052 +0053 0073 0053 +0054 0074 0054 +0055 0075 0055 +0056 0076 0056 +0057 0077 0057 +0058 0078 0058 +0059 0079 0059 +005A 007A 005A +0061 0061 0041 +0062 0062 0042 +0063 0063 0043 +0064 0064 0044 +0065 0065 0045 +0066 0066 0046 +0067 0067 0047 +0068 0068 0048 +0069 0069 0049 +006A 006A 004A +006B 006B 004B +006C 006C 004C +006D 006D 004D +006E 006E 004E +006F 006F 004F +0070 0070 0050 +0071 0071 0051 +0072 0072 0052 +0073 0073 0053 +0074 0074 0054 +0075 0075 0055 +0076 0076 0056 +0077 0077 0057 +0078 0078 0058 +0079 0079 0059 +007A 007A 005A +00B5 00B5 039C +00C0 00E0 00C0 +00C1 00E1 00C1 +00C2 00E2 00C2 +00C3 00E3 00C3 +00C4 00E4 00C4 +00C5 00E5 00C5 +00C6 00E6 00C6 +00C7 00E7 00C7 +00C8 00E8 00C8 +00C9 00E9 00C9 +00CA 00EA 00CA +00CB 00EB 00CB +00CC 00EC 00CC +00CD 00ED 00CD +00CE 00EE 00CE +00CF 00EF 00CF +00D0 00F0 00D0 +00D1 00F1 00D1 +00D2 00F2 00D2 +00D3 00F3 00D3 +00D4 00F4 00D4 +00D5 00F5 00D5 +00D6 00F6 00D6 +00D8 00F8 00D8 +00D9 00F9 00D9 +00DA 00FA 00DA +00DB 00FB 00DB +00DC 00FC 00DC +00DD 00FD 00DD +00DE 00FE 00DE +00E0 00E0 00C0 +00E1 00E1 00C1 +00E2 00E2 00C2 +00E3 00E3 00C3 +00E4 00E4 00C4 +00E5 00E5 00C5 +00E6 00E6 00C6 +00E7 00E7 00C7 +00E8 00E8 00C8 +00E9 00E9 00C9 +00EA 00EA 00CA +00EB 00EB 00CB +00EC 00EC 00CC +00ED 00ED 00CD +00EE 00EE 00CE +00EF 00EF 00CF +00F0 00F0 00D0 +00F1 00F1 00D1 +00F2 00F2 00D2 +00F3 00F3 00D3 +00F4 00F4 00D4 +00F5 00F5 00D5 +00F6 00F6 00D6 +00F8 00F8 00D8 +00F9 00F9 00D9 +00FA 00FA 00DA +00FB 00FB 00DB +00FC 00FC 00DC +00FD 00FD 00DD +00FE 00FE 00DE +00FF 00FF 0178 +0100 0101 0100 +0101 0101 0100 +0102 0103 0102 +0103 0103 0102 +0104 0105 0104 +0105 0105 0104 +0106 0107 0106 +0107 0107 0106 +0108 0109 0108 +0109 0109 0108 +010A 010B 010A +010B 010B 010A +010C 010D 010C +010D 010D 010C +010E 010F 010E +010F 010F 010E +0110 0111 0110 +0111 0111 0110 +0112 0113 0112 +0113 0113 0112 +0114 0115 0114 +0115 0115 0114 +0116 0117 0116 +0117 0117 0116 +0118 0119 0118 +0119 0119 0118 +011A 011B 011A +011B 011B 011A +011C 011D 011C +011D 011D 011C +011E 011F 011E +011F 011F 011E +0120 0121 0120 +0121 0121 0120 +0122 0123 0122 +0123 0123 0122 +0124 0125 0124 +0125 0125 0124 +0126 0127 0126 +0127 0127 0126 +0128 0129 0128 +0129 0129 0128 +012A 012B 012A +012B 012B 012A +012C 012D 012C +012D 012D 012C +012E 012F 012E +012F 012F 012E +0130 0069 0130 +0131 0131 0049 +0132 0133 0132 +0133 0133 0132 +0134 0135 0134 +0135 0135 0134 +0136 0137 0136 +0137 0137 0136 +0139 013A 0139 +013A 013A 0139 +013B 013C 013B +013C 013C 013B +013D 013E 013D +013E 013E 013D +013F 0140 013F +0140 0140 013F +0141 0142 0141 +0142 0142 0141 +0143 0144 0143 +0144 0144 0143 +0145 0146 0145 +0146 0146 0145 +0147 0148 0147 +0148 0148 0147 +014A 014B 014A +014B 014B 014A +014C 014D 014C +014D 014D 014C +014E 014F 014E +014F 014F 014E +0150 0151 0150 +0151 0151 0150 +0152 0153 0152 +0153 0153 0152 +0154 0155 0154 +0155 0155 0154 +0156 0157 0156 +0157 0157 0156 +0158 0159 0158 +0159 0159 0158 +015A 015B 015A +015B 015B 015A +015C 015D 015C +015D 015D 015C +015E 015F 015E +015F 015F 015E +0160 0161 0160 +0161 0161 0160 +0162 0163 0162 +0163 0163 0162 +0164 0165 0164 +0165 0165 0164 +0166 0167 0166 +0167 0167 0166 +0168 0169 0168 +0169 0169 0168 +016A 016B 016A +016B 016B 016A +016C 016D 016C +016D 016D 016C +016E 016F 016E +016F 016F 016E +0170 0171 0170 +0171 0171 0170 +0172 0173 0172 +0173 0173 0172 +0174 0175 0174 +0175 0175 0174 +0176 0177 0176 +0177 0177 0176 +0178 00FF 0178 +0179 017A 0179 +017A 017A 0179 +017B 017C 017B +017C 017C 017B +017D 017E 017D +017E 017E 017D +017F 017F 0053 +0181 0253 0181 +0182 0183 0182 +0183 0183 0182 +0184 0185 0184 +0185 0185 0184 +0186 0254 0186 +0187 0188 0187 +0188 0188 0187 +0189 0256 0189 +018A 0257 018A +018B 018C 018B +018C 018C 018B +018E 01DD 018E +018F 0259 018F +0190 025B 0190 +0191 0192 0191 +0192 0192 0191 +0193 0260 0193 +0194 0263 0194 +0195 0195 01F6 +0196 0269 0196 +0197 0268 0197 +0198 0199 0198 +0199 0199 0198 +019C 026F 019C +019D 0272 019D +019F 0275 019F +01A0 01A1 01A0 +01A1 01A1 01A0 +01A2 01A3 01A2 +01A3 01A3 01A2 +01A4 01A5 01A4 +01A5 01A5 01A4 +01A6 0280 01A6 +01A7 01A8 01A7 +01A8 01A8 01A7 +01A9 0283 01A9 +01AC 01AD 01AC +01AD 01AD 01AC +01AE 0288 01AE +01AF 01B0 01AF +01B0 01B0 01AF +01B1 028A 01B1 +01B2 028B 01B2 +01B3 01B4 01B3 +01B4 01B4 01B3 +01B5 01B6 01B5 +01B6 01B6 01B5 +01B7 0292 01B7 +01B8 01B9 01B8 +01B9 01B9 01B8 +01BC 01BD 01BC +01BD 01BD 01BC +01BF 01BF 01F7 +01C4 01C6 01C4 +01C5 01C6 01C4 +01C6 01C6 01C4 +01C7 01C9 01C7 +01C8 01C9 01C7 +01C9 01C9 01C7 +01CA 01CC 01CA +01CB 01CC 01CA +01CC 01CC 01CA +01CD 01CE 01CD +01CE 01CE 01CD +01CF 01D0 01CF +01D0 01D0 01CF +01D1 01D2 01D1 +01D2 01D2 01D1 +01D3 01D4 01D3 +01D4 01D4 01D3 +01D5 01D6 01D5 +01D6 01D6 01D5 +01D7 01D8 01D7 +01D8 01D8 01D7 +01D9 01DA 01D9 +01DA 01DA 01D9 +01DB 01DC 01DB +01DC 01DC 01DB +01DD 01DD 018E +01DE 01DF 01DE +01DF 01DF 01DE +01E0 01E1 01E0 +01E1 01E1 01E0 +01E2 01E3 01E2 +01E3 01E3 01E2 +01E4 01E5 01E4 +01E5 01E5 01E4 +01E6 01E7 01E6 +01E7 01E7 01E6 +01E8 01E9 01E8 +01E9 01E9 01E8 +01EA 01EB 01EA +01EB 01EB 01EA +01EC 01ED 01EC +01ED 01ED 01EC +01EE 01EF 01EE +01EF 01EF 01EE +01F1 01F3 01F1 +01F2 01F3 01F1 +01F3 01F3 01F1 +01F4 01F5 01F4 +01F5 01F5 01F4 +01F6 0195 01F6 +01F7 01BF 01F7 +01F8 01F9 01F8 +01F9 01F9 01F8 +01FA 01FB 01FA +01FB 01FB 01FA +01FC 01FD 01FC +01FD 01FD 01FC +01FE 01FF 01FE +01FF 01FF 01FE +0200 0201 0200 +0201 0201 0200 +0202 0203 0202 +0203 0203 0202 +0204 0205 0204 +0205 0205 0204 +0206 0207 0206 +0207 0207 0206 +0208 0209 0208 +0209 0209 0208 +020A 020B 020A +020B 020B 020A +020C 020D 020C +020D 020D 020C +020E 020F 020E +020F 020F 020E +0210 0211 0210 +0211 0211 0210 +0212 0213 0212 +0213 0213 0212 +0214 0215 0214 +0215 0215 0214 +0216 0217 0216 +0217 0217 0216 +0218 0219 0218 +0219 0219 0218 +021A 021B 021A +021B 021B 021A +021C 021D 021C +021D 021D 021C +021E 021F 021E +021F 021F 021E +0222 0223 0222 +0223 0223 0222 +0224 0225 0224 +0225 0225 0224 +0226 0227 0226 +0227 0227 0226 +0228 0229 0228 +0229 0229 0228 +022A 022B 022A +022B 022B 022A +022C 022D 022C +022D 022D 022C +022E 022F 022E +022F 022F 022E +0230 0231 0230 +0231 0231 0230 +0232 0233 0232 +0233 0233 0232 +0253 0253 0181 +0254 0254 0186 +0256 0256 0189 +0257 0257 018A +0259 0259 018F +025B 025B 0190 +0260 0260 0193 +0263 0263 0194 +0268 0268 0197 +0269 0269 0196 +026F 026F 019C +0272 0272 019D +0275 0275 019F +0280 0280 01A6 +0283 0283 01A9 +0288 0288 01AE +028A 028A 01B1 +028B 028B 01B2 +0292 0292 01B7 +0345 0345 0399 +0386 03AC 0386 +0388 03AD 0388 +0389 03AE 0389 +038A 03AF 038A +038C 03CC 038C +038E 03CD 038E +038F 03CE 038F +0391 03B1 0391 +0392 03B2 0392 +0393 03B3 0393 +0394 03B4 0394 +0395 03B5 0395 +0396 03B6 0396 +0397 03B7 0397 +0398 03B8 0398 +0399 03B9 0399 +039A 03BA 039A +039B 03BB 039B +039C 03BC 039C +039D 03BD 039D +039E 03BE 039E +039F 03BF 039F +03A0 03C0 03A0 +03A1 03C1 03A1 +03A3 03C3 03A3 +03A4 03C4 03A4 +03A5 03C5 03A5 +03A6 03C6 03A6 +03A7 03C7 03A7 +03A8 03C8 03A8 +03A9 03C9 03A9 +03AA 03CA 03AA +03AB 03CB 03AB +03AC 03AC 0386 +03AD 03AD 0388 +03AE 03AE 0389 +03AF 03AF 038A +03B1 03B1 0391 +03B2 03B2 0392 +03B3 03B3 0393 +03B4 03B4 0394 +03B5 03B5 0395 +03B6 03B6 0396 +03B7 03B7 0397 +03B8 03B8 0398 +03B9 03B9 0399 +03BA 03BA 039A +03BB 03BB 039B +03BC 03BC 039C +03BD 03BD 039D +03BE 03BE 039E +03BF 03BF 039F +03C0 03C0 03A0 +03C1 03C1 03A1 +03C2 03C2 03A3 +03C3 03C3 03A3 +03C4 03C4 03A4 +03C5 03C5 03A5 +03C6 03C6 03A6 +03C7 03C7 03A7 +03C8 03C8 03A8 +03C9 03C9 03A9 +03CA 03CA 03AA +03CB 03CB 03AB +03CC 03CC 038C +03CD 03CD 038E +03CE 03CE 038F +03D0 03D0 0392 +03D1 03D1 0398 +03D5 03D5 03A6 +03D6 03D6 03A0 +03DA 03DB 03DA +03DB 03DB 03DA +03DC 03DD 03DC +03DD 03DD 03DC +03DE 03DF 03DE +03DF 03DF 03DE +03E0 03E1 03E0 +03E1 03E1 03E0 +03E2 03E3 03E2 +03E3 03E3 03E2 +03E4 03E5 03E4 +03E5 03E5 03E4 +03E6 03E7 03E6 +03E7 03E7 03E6 +03E8 03E9 03E8 +03E9 03E9 03E8 +03EA 03EB 03EA +03EB 03EB 03EA +03EC 03ED 03EC +03ED 03ED 03EC +03EE 03EF 03EE +03EF 03EF 03EE +03F0 03F0 039A +03F1 03F1 03A1 +03F2 03F2 03A3 +0400 0450 0400 +0401 0451 0401 +0402 0452 0402 +0403 0453 0403 +0404 0454 0404 +0405 0455 0405 +0406 0456 0406 +0407 0457 0407 +0408 0458 0408 +0409 0459 0409 +040A 045A 040A +040B 045B 040B +040C 045C 040C +040D 045D 040D +040E 045E 040E +040F 045F 040F +0410 0430 0410 +0411 0431 0411 +0412 0432 0412 +0413 0433 0413 +0414 0434 0414 +0415 0435 0415 +0416 0436 0416 +0417 0437 0417 +0418 0438 0418 +0419 0439 0419 +041A 043A 041A +041B 043B 041B +041C 043C 041C +041D 043D 041D +041E 043E 041E +041F 043F 041F +0420 0440 0420 +0421 0441 0421 +0422 0442 0422 +0423 0443 0423 +0424 0444 0424 +0425 0445 0425 +0426 0446 0426 +0427 0447 0427 +0428 0448 0428 +0429 0449 0429 +042A 044A 042A +042B 044B 042B +042C 044C 042C +042D 044D 042D +042E 044E 042E +042F 044F 042F +0430 0430 0410 +0431 0431 0411 +0432 0432 0412 +0433 0433 0413 +0434 0434 0414 +0435 0435 0415 +0436 0436 0416 +0437 0437 0417 +0438 0438 0418 +0439 0439 0419 +043A 043A 041A +043B 043B 041B +043C 043C 041C +043D 043D 041D +043E 043E 041E +043F 043F 041F +0440 0440 0420 +0441 0441 0421 +0442 0442 0422 +0443 0443 0423 +0444 0444 0424 +0445 0445 0425 +0446 0446 0426 +0447 0447 0427 +0448 0448 0428 +0449 0449 0429 +044A 044A 042A +044B 044B 042B +044C 044C 042C +044D 044D 042D +044E 044E 042E +044F 044F 042F +0450 0450 0400 +0451 0451 0401 +0452 0452 0402 +0453 0453 0403 +0454 0454 0404 +0455 0455 0405 +0456 0456 0406 +0457 0457 0407 +0458 0458 0408 +0459 0459 0409 +045A 045A 040A +045B 045B 040B +045C 045C 040C +045D 045D 040D +045E 045E 040E +045F 045F 040F +0460 0461 0460 +0461 0461 0460 +0462 0463 0462 +0463 0463 0462 +0464 0465 0464 +0465 0465 0464 +0466 0467 0466 +0467 0467 0466 +0468 0469 0468 +0469 0469 0468 +046A 046B 046A +046B 046B 046A +046C 046D 046C +046D 046D 046C +046E 046F 046E +046F 046F 046E +0470 0471 0470 +0471 0471 0470 +0472 0473 0472 +0473 0473 0472 +0474 0475 0474 +0475 0475 0474 +0476 0477 0476 +0477 0477 0476 +0478 0479 0478 +0479 0479 0478 +047A 047B 047A +047B 047B 047A +047C 047D 047C +047D 047D 047C +047E 047F 047E +047F 047F 047E +0480 0481 0480 +0481 0481 0480 +048C 048D 048C +048D 048D 048C +048E 048F 048E +048F 048F 048E +0490 0491 0490 +0491 0491 0490 +0492 0493 0492 +0493 0493 0492 +0494 0495 0494 +0495 0495 0494 +0496 0497 0496 +0497 0497 0496 +0498 0499 0498 +0499 0499 0498 +049A 049B 049A +049B 049B 049A +049C 049D 049C +049D 049D 049C +049E 049F 049E +049F 049F 049E +04A0 04A1 04A0 +04A1 04A1 04A0 +04A2 04A3 04A2 +04A3 04A3 04A2 +04A4 04A5 04A4 +04A5 04A5 04A4 +04A6 04A7 04A6 +04A7 04A7 04A6 +04A8 04A9 04A8 +04A9 04A9 04A8 +04AA 04AB 04AA +04AB 04AB 04AA +04AC 04AD 04AC +04AD 04AD 04AC +04AE 04AF 04AE +04AF 04AF 04AE +04B0 04B1 04B0 +04B1 04B1 04B0 +04B2 04B3 04B2 +04B3 04B3 04B2 +04B4 04B5 04B4 +04B5 04B5 04B4 +04B6 04B7 04B6 +04B7 04B7 04B6 +04B8 04B9 04B8 +04B9 04B9 04B8 +04BA 04BB 04BA +04BB 04BB 04BA +04BC 04BD 04BC +04BD 04BD 04BC +04BE 04BF 04BE +04BF 04BF 04BE +04C1 04C2 04C1 +04C2 04C2 04C1 +04C3 04C4 04C3 +04C4 04C4 04C3 +04C7 04C8 04C7 +04C8 04C8 04C7 +04CB 04CC 04CB +04CC 04CC 04CB +04D0 04D1 04D0 +04D1 04D1 04D0 +04D2 04D3 04D2 +04D3 04D3 04D2 +04D4 04D5 04D4 +04D5 04D5 04D4 +04D6 04D7 04D6 +04D7 04D7 04D6 +04D8 04D9 04D8 +04D9 04D9 04D8 +04DA 04DB 04DA +04DB 04DB 04DA +04DC 04DD 04DC +04DD 04DD 04DC +04DE 04DF 04DE +04DF 04DF 04DE +04E0 04E1 04E0 +04E1 04E1 04E0 +04E2 04E3 04E2 +04E3 04E3 04E2 +04E4 04E5 04E4 +04E5 04E5 04E4 +04E6 04E7 04E6 +04E7 04E7 04E6 +04E8 04E9 04E8 +04E9 04E9 04E8 +04EA 04EB 04EA +04EB 04EB 04EA +04EC 04ED 04EC +04ED 04ED 04EC +04EE 04EF 04EE +04EF 04EF 04EE +04F0 04F1 04F0 +04F1 04F1 04F0 +04F2 04F3 04F2 +04F3 04F3 04F2 +04F4 04F5 04F4 +04F5 04F5 04F4 +04F8 04F9 04F8 +04F9 04F9 04F8 +0531 0561 0531 +0532 0562 0532 +0533 0563 0533 +0534 0564 0534 +0535 0565 0535 +0536 0566 0536 +0537 0567 0537 +0538 0568 0538 +0539 0569 0539 +053A 056A 053A +053B 056B 053B +053C 056C 053C +053D 056D 053D +053E 056E 053E +053F 056F 053F +0540 0570 0540 +0541 0571 0541 +0542 0572 0542 +0543 0573 0543 +0544 0574 0544 +0545 0575 0545 +0546 0576 0546 +0547 0577 0547 +0548 0578 0548 +0549 0579 0549 +054A 057A 054A +054B 057B 054B +054C 057C 054C +054D 057D 054D +054E 057E 054E +054F 057F 054F +0550 0580 0550 +0551 0581 0551 +0552 0582 0552 +0553 0583 0553 +0554 0584 0554 +0555 0585 0555 +0556 0586 0556 +0561 0561 0531 +0562 0562 0532 +0563 0563 0533 +0564 0564 0534 +0565 0565 0535 +0566 0566 0536 +0567 0567 0537 +0568 0568 0538 +0569 0569 0539 +056A 056A 053A +056B 056B 053B +056C 056C 053C +056D 056D 053D +056E 056E 053E +056F 056F 053F +0570 0570 0540 +0571 0571 0541 +0572 0572 0542 +0573 0573 0543 +0574 0574 0544 +0575 0575 0545 +0576 0576 0546 +0577 0577 0547 +0578 0578 0548 +0579 0579 0549 +057A 057A 054A +057B 057B 054B +057C 057C 054C +057D 057D 054D +057E 057E 054E +057F 057F 054F +0580 0580 0550 +0581 0581 0551 +0582 0582 0552 +0583 0583 0553 +0584 0584 0554 +0585 0585 0555 +0586 0586 0556 +1E00 1E01 1E00 +1E01 1E01 1E00 +1E02 1E03 1E02 +1E03 1E03 1E02 +1E04 1E05 1E04 +1E05 1E05 1E04 +1E06 1E07 1E06 +1E07 1E07 1E06 +1E08 1E09 1E08 +1E09 1E09 1E08 +1E0A 1E0B 1E0A +1E0B 1E0B 1E0A +1E0C 1E0D 1E0C +1E0D 1E0D 1E0C +1E0E 1E0F 1E0E +1E0F 1E0F 1E0E +1E10 1E11 1E10 +1E11 1E11 1E10 +1E12 1E13 1E12 +1E13 1E13 1E12 +1E14 1E15 1E14 +1E15 1E15 1E14 +1E16 1E17 1E16 +1E17 1E17 1E16 +1E18 1E19 1E18 +1E19 1E19 1E18 +1E1A 1E1B 1E1A +1E1B 1E1B 1E1A +1E1C 1E1D 1E1C +1E1D 1E1D 1E1C +1E1E 1E1F 1E1E +1E1F 1E1F 1E1E +1E20 1E21 1E20 +1E21 1E21 1E20 +1E22 1E23 1E22 +1E23 1E23 1E22 +1E24 1E25 1E24 +1E25 1E25 1E24 +1E26 1E27 1E26 +1E27 1E27 1E26 +1E28 1E29 1E28 +1E29 1E29 1E28 +1E2A 1E2B 1E2A +1E2B 1E2B 1E2A +1E2C 1E2D 1E2C +1E2D 1E2D 1E2C +1E2E 1E2F 1E2E +1E2F 1E2F 1E2E +1E30 1E31 1E30 +1E31 1E31 1E30 +1E32 1E33 1E32 +1E33 1E33 1E32 +1E34 1E35 1E34 +1E35 1E35 1E34 +1E36 1E37 1E36 +1E37 1E37 1E36 +1E38 1E39 1E38 +1E39 1E39 1E38 +1E3A 1E3B 1E3A +1E3B 1E3B 1E3A +1E3C 1E3D 1E3C +1E3D 1E3D 1E3C +1E3E 1E3F 1E3E +1E3F 1E3F 1E3E +1E40 1E41 1E40 +1E41 1E41 1E40 +1E42 1E43 1E42 +1E43 1E43 1E42 +1E44 1E45 1E44 +1E45 1E45 1E44 +1E46 1E47 1E46 +1E47 1E47 1E46 +1E48 1E49 1E48 +1E49 1E49 1E48 +1E4A 1E4B 1E4A +1E4B 1E4B 1E4A +1E4C 1E4D 1E4C +1E4D 1E4D 1E4C +1E4E 1E4F 1E4E +1E4F 1E4F 1E4E +1E50 1E51 1E50 +1E51 1E51 1E50 +1E52 1E53 1E52 +1E53 1E53 1E52 +1E54 1E55 1E54 +1E55 1E55 1E54 +1E56 1E57 1E56 +1E57 1E57 1E56 +1E58 1E59 1E58 +1E59 1E59 1E58 +1E5A 1E5B 1E5A +1E5B 1E5B 1E5A +1E5C 1E5D 1E5C +1E5D 1E5D 1E5C +1E5E 1E5F 1E5E +1E5F 1E5F 1E5E +1E60 1E61 1E60 +1E61 1E61 1E60 +1E62 1E63 1E62 +1E63 1E63 1E62 +1E64 1E65 1E64 +1E65 1E65 1E64 +1E66 1E67 1E66 +1E67 1E67 1E66 +1E68 1E69 1E68 +1E69 1E69 1E68 +1E6A 1E6B 1E6A +1E6B 1E6B 1E6A +1E6C 1E6D 1E6C +1E6D 1E6D 1E6C +1E6E 1E6F 1E6E +1E6F 1E6F 1E6E +1E70 1E71 1E70 +1E71 1E71 1E70 +1E72 1E73 1E72 +1E73 1E73 1E72 +1E74 1E75 1E74 +1E75 1E75 1E74 +1E76 1E77 1E76 +1E77 1E77 1E76 +1E78 1E79 1E78 +1E79 1E79 1E78 +1E7A 1E7B 1E7A +1E7B 1E7B 1E7A +1E7C 1E7D 1E7C +1E7D 1E7D 1E7C +1E7E 1E7F 1E7E +1E7F 1E7F 1E7E +1E80 1E81 1E80 +1E81 1E81 1E80 +1E82 1E83 1E82 +1E83 1E83 1E82 +1E84 1E85 1E84 +1E85 1E85 1E84 +1E86 1E87 1E86 +1E87 1E87 1E86 +1E88 1E89 1E88 +1E89 1E89 1E88 +1E8A 1E8B 1E8A +1E8B 1E8B 1E8A +1E8C 1E8D 1E8C +1E8D 1E8D 1E8C +1E8E 1E8F 1E8E +1E8F 1E8F 1E8E +1E90 1E91 1E90 +1E91 1E91 1E90 +1E92 1E93 1E92 +1E93 1E93 1E92 +1E94 1E95 1E94 +1E95 1E95 1E94 +1E9B 1E9B 1E60 +1EA0 1EA1 1EA0 +1EA1 1EA1 1EA0 +1EA2 1EA3 1EA2 +1EA3 1EA3 1EA2 +1EA4 1EA5 1EA4 +1EA5 1EA5 1EA4 +1EA6 1EA7 1EA6 +1EA7 1EA7 1EA6 +1EA8 1EA9 1EA8 +1EA9 1EA9 1EA8 +1EAA 1EAB 1EAA +1EAB 1EAB 1EAA +1EAC 1EAD 1EAC +1EAD 1EAD 1EAC +1EAE 1EAF 1EAE +1EAF 1EAF 1EAE +1EB0 1EB1 1EB0 +1EB1 1EB1 1EB0 +1EB2 1EB3 1EB2 +1EB3 1EB3 1EB2 +1EB4 1EB5 1EB4 +1EB5 1EB5 1EB4 +1EB6 1EB7 1EB6 +1EB7 1EB7 1EB6 +1EB8 1EB9 1EB8 +1EB9 1EB9 1EB8 +1EBA 1EBB 1EBA +1EBB 1EBB 1EBA +1EBC 1EBD 1EBC +1EBD 1EBD 1EBC +1EBE 1EBF 1EBE +1EBF 1EBF 1EBE +1EC0 1EC1 1EC0 +1EC1 1EC1 1EC0 +1EC2 1EC3 1EC2 +1EC3 1EC3 1EC2 +1EC4 1EC5 1EC4 +1EC5 1EC5 1EC4 +1EC6 1EC7 1EC6 +1EC7 1EC7 1EC6 +1EC8 1EC9 1EC8 +1EC9 1EC9 1EC8 +1ECA 1ECB 1ECA +1ECB 1ECB 1ECA +1ECC 1ECD 1ECC +1ECD 1ECD 1ECC +1ECE 1ECF 1ECE +1ECF 1ECF 1ECE +1ED0 1ED1 1ED0 +1ED1 1ED1 1ED0 +1ED2 1ED3 1ED2 +1ED3 1ED3 1ED2 +1ED4 1ED5 1ED4 +1ED5 1ED5 1ED4 +1ED6 1ED7 1ED6 +1ED7 1ED7 1ED6 +1ED8 1ED9 1ED8 +1ED9 1ED9 1ED8 +1EDA 1EDB 1EDA +1EDB 1EDB 1EDA +1EDC 1EDD 1EDC +1EDD 1EDD 1EDC +1EDE 1EDF 1EDE +1EDF 1EDF 1EDE +1EE0 1EE1 1EE0 +1EE1 1EE1 1EE0 +1EE2 1EE3 1EE2 +1EE3 1EE3 1EE2 +1EE4 1EE5 1EE4 +1EE5 1EE5 1EE4 +1EE6 1EE7 1EE6 +1EE7 1EE7 1EE6 +1EE8 1EE9 1EE8 +1EE9 1EE9 1EE8 +1EEA 1EEB 1EEA +1EEB 1EEB 1EEA +1EEC 1EED 1EEC +1EED 1EED 1EEC +1EEE 1EEF 1EEE +1EEF 1EEF 1EEE +1EF0 1EF1 1EF0 +1EF1 1EF1 1EF0 +1EF2 1EF3 1EF2 +1EF3 1EF3 1EF2 +1EF4 1EF5 1EF4 +1EF5 1EF5 1EF4 +1EF6 1EF7 1EF6 +1EF7 1EF7 1EF6 +1EF8 1EF9 1EF8 +1EF9 1EF9 1EF8 +1F00 1F00 1F08 +1F01 1F01 1F09 +1F02 1F02 1F0A +1F03 1F03 1F0B +1F04 1F04 1F0C +1F05 1F05 1F0D +1F06 1F06 1F0E +1F07 1F07 1F0F +1F08 1F00 1F08 +1F09 1F01 1F09 +1F0A 1F02 1F0A +1F0B 1F03 1F0B +1F0C 1F04 1F0C +1F0D 1F05 1F0D +1F0E 1F06 1F0E +1F0F 1F07 1F0F +1F10 1F10 1F18 +1F11 1F11 1F19 +1F12 1F12 1F1A +1F13 1F13 1F1B +1F14 1F14 1F1C +1F15 1F15 1F1D +1F18 1F10 1F18 +1F19 1F11 1F19 +1F1A 1F12 1F1A +1F1B 1F13 1F1B +1F1C 1F14 1F1C +1F1D 1F15 1F1D +1F20 1F20 1F28 +1F21 1F21 1F29 +1F22 1F22 1F2A +1F23 1F23 1F2B +1F24 1F24 1F2C +1F25 1F25 1F2D +1F26 1F26 1F2E +1F27 1F27 1F2F +1F28 1F20 1F28 +1F29 1F21 1F29 +1F2A 1F22 1F2A +1F2B 1F23 1F2B +1F2C 1F24 1F2C +1F2D 1F25 1F2D +1F2E 1F26 1F2E +1F2F 1F27 1F2F +1F30 1F30 1F38 +1F31 1F31 1F39 +1F32 1F32 1F3A +1F33 1F33 1F3B +1F34 1F34 1F3C +1F35 1F35 1F3D +1F36 1F36 1F3E +1F37 1F37 1F3F +1F38 1F30 1F38 +1F39 1F31 1F39 +1F3A 1F32 1F3A +1F3B 1F33 1F3B +1F3C 1F34 1F3C +1F3D 1F35 1F3D +1F3E 1F36 1F3E +1F3F 1F37 1F3F +1F40 1F40 1F48 +1F41 1F41 1F49 +1F42 1F42 1F4A +1F43 1F43 1F4B +1F44 1F44 1F4C +1F45 1F45 1F4D +1F48 1F40 1F48 +1F49 1F41 1F49 +1F4A 1F42 1F4A +1F4B 1F43 1F4B +1F4C 1F44 1F4C +1F4D 1F45 1F4D +1F51 1F51 1F59 +1F53 1F53 1F5B +1F55 1F55 1F5D +1F57 1F57 1F5F +1F59 1F51 1F59 +1F5B 1F53 1F5B +1F5D 1F55 1F5D +1F5F 1F57 1F5F +1F60 1F60 1F68 +1F61 1F61 1F69 +1F62 1F62 1F6A +1F63 1F63 1F6B +1F64 1F64 1F6C +1F65 1F65 1F6D +1F66 1F66 1F6E +1F67 1F67 1F6F +1F68 1F60 1F68 +1F69 1F61 1F69 +1F6A 1F62 1F6A +1F6B 1F63 1F6B +1F6C 1F64 1F6C +1F6D 1F65 1F6D +1F6E 1F66 1F6E +1F6F 1F67 1F6F +1F70 1F70 1FBA +1F71 1F71 1FBB +1F72 1F72 1FC8 +1F73 1F73 1FC9 +1F74 1F74 1FCA +1F75 1F75 1FCB +1F76 1F76 1FDA +1F77 1F77 1FDB +1F78 1F78 1FF8 +1F79 1F79 1FF9 +1F7A 1F7A 1FEA +1F7B 1F7B 1FEB +1F7C 1F7C 1FFA +1F7D 1F7D 1FFB +1F80 1F80 1F88 +1F81 1F81 1F89 +1F82 1F82 1F8A +1F83 1F83 1F8B +1F84 1F84 1F8C +1F85 1F85 1F8D +1F86 1F86 1F8E +1F87 1F87 1F8F +1F88 1F80 1F88 +1F89 1F81 1F89 +1F8A 1F82 1F8A +1F8B 1F83 1F8B +1F8C 1F84 1F8C +1F8D 1F85 1F8D +1F8E 1F86 1F8E +1F8F 1F87 1F8F +1F90 1F90 1F98 +1F91 1F91 1F99 +1F92 1F92 1F9A +1F93 1F93 1F9B +1F94 1F94 1F9C +1F95 1F95 1F9D +1F96 1F96 1F9E +1F97 1F97 1F9F +1F98 1F90 1F98 +1F99 1F91 1F99 +1F9A 1F92 1F9A +1F9B 1F93 1F9B +1F9C 1F94 1F9C +1F9D 1F95 1F9D +1F9E 1F96 1F9E +1F9F 1F97 1F9F +1FA0 1FA0 1FA8 +1FA1 1FA1 1FA9 +1FA2 1FA2 1FAA +1FA3 1FA3 1FAB +1FA4 1FA4 1FAC +1FA5 1FA5 1FAD +1FA6 1FA6 1FAE +1FA7 1FA7 1FAF +1FA8 1FA0 1FA8 +1FA9 1FA1 1FA9 +1FAA 1FA2 1FAA +1FAB 1FA3 1FAB +1FAC 1FA4 1FAC +1FAD 1FA5 1FAD +1FAE 1FA6 1FAE +1FAF 1FA7 1FAF +1FB0 1FB0 1FB8 +1FB1 1FB1 1FB9 +1FB3 1FB3 1FBC +1FB8 1FB0 1FB8 +1FB9 1FB1 1FB9 +1FBA 1F70 1FBA +1FBB 1F71 1FBB +1FBC 1FB3 1FBC +1FBE 1FBE 0399 +1FC3 1FC3 1FCC +1FC8 1F72 1FC8 +1FC9 1F73 1FC9 +1FCA 1F74 1FCA +1FCB 1F75 1FCB +1FCC 1FC3 1FCC +1FD0 1FD0 1FD8 +1FD1 1FD1 1FD9 +1FD8 1FD0 1FD8 +1FD9 1FD1 1FD9 +1FDA 1F76 1FDA +1FDB 1F77 1FDB +1FE0 1FE0 1FE8 +1FE1 1FE1 1FE9 +1FE5 1FE5 1FEC +1FE8 1FE0 1FE8 +1FE9 1FE1 1FE9 +1FEA 1F7A 1FEA +1FEB 1F7B 1FEB +1FEC 1FE5 1FEC +1FF3 1FF3 1FFC +1FF8 1F78 1FF8 +1FF9 1F79 1FF9 +1FFA 1F7C 1FFA +1FFB 1F7D 1FFB +1FFC 1FF3 1FFC +2126 03C9 2126 +212A 006B 212A +212B 00E5 212B +2160 2170 2160 +2161 2171 2161 +2162 2172 2162 +2163 2173 2163 +2164 2174 2164 +2165 2175 2165 +2166 2176 2166 +2167 2177 2167 +2168 2178 2168 +2169 2179 2169 +216A 217A 216A +216B 217B 216B +216C 217C 216C +216D 217D 216D +216E 217E 216E +216F 217F 216F +2170 2170 2160 +2171 2171 2161 +2172 2172 2162 +2173 2173 2163 +2174 2174 2164 +2175 2175 2165 +2176 2176 2166 +2177 2177 2167 +2178 2178 2168 +2179 2179 2169 +217A 217A 216A +217B 217B 216B +217C 217C 216C +217D 217D 216D +217E 217E 216E +217F 217F 216F +24B6 24D0 24B6 +24B7 24D1 24B7 +24B8 24D2 24B8 +24B9 24D3 24B9 +24BA 24D4 24BA +24BB 24D5 24BB +24BC 24D6 24BC +24BD 24D7 24BD +24BE 24D8 24BE +24BF 24D9 24BF +24C0 24DA 24C0 +24C1 24DB 24C1 +24C2 24DC 24C2 +24C3 24DD 24C3 +24C4 24DE 24C4 +24C5 24DF 24C5 +24C6 24E0 24C6 +24C7 24E1 24C7 +24C8 24E2 24C8 +24C9 24E3 24C9 +24CA 24E4 24CA +24CB 24E5 24CB +24CC 24E6 24CC +24CD 24E7 24CD +24CE 24E8 24CE +24CF 24E9 24CF +24D0 24D0 24B6 +24D1 24D1 24B7 +24D2 24D2 24B8 +24D3 24D3 24B9 +24D4 24D4 24BA +24D5 24D5 24BB +24D6 24D6 24BC +24D7 24D7 24BD +24D8 24D8 24BE +24D9 24D9 24BF +24DA 24DA 24C0 +24DB 24DB 24C1 +24DC 24DC 24C2 +24DD 24DD 24C3 +24DE 24DE 24C4 +24DF 24DF 24C5 +24E0 24E0 24C6 +24E1 24E1 24C7 +24E2 24E2 24C8 +24E3 24E3 24C9 +24E4 24E4 24CA +24E5 24E5 24CB +24E6 24E6 24CC +24E7 24E7 24CD +24E8 24E8 24CE +24E9 24E9 24CF +FF21 FF41 FF21 +FF22 FF42 FF22 +FF23 FF43 FF23 +FF24 FF44 FF24 +FF25 FF45 FF25 +FF26 FF46 FF26 +FF27 FF47 FF27 +FF28 FF48 FF28 +FF29 FF49 FF29 +FF2A FF4A FF2A +FF2B FF4B FF2B +FF2C FF4C FF2C +FF2D FF4D FF2D +FF2E FF4E FF2E +FF2F FF4F FF2F +FF30 FF50 FF30 +FF31 FF51 FF31 +FF32 FF52 FF32 +FF33 FF53 FF33 +FF34 FF54 FF34 +FF35 FF55 FF35 +FF36 FF56 FF36 +FF37 FF57 FF37 +FF38 FF58 FF38 +FF39 FF59 FF39 +FF3A FF5A FF3A +FF41 FF41 FF21 +FF42 FF42 FF22 +FF43 FF43 FF23 +FF44 FF44 FF24 +FF45 FF45 FF25 +FF46 FF46 FF26 +FF47 FF47 FF27 +FF48 FF48 FF28 +FF49 FF49 FF29 +FF4A FF4A FF2A +FF4B FF4B FF2B +FF4C FF4C FF2C +FF4D FF4D FF2D +FF4E FF4E FF2E +FF4F FF4F FF2F +FF50 FF50 FF30 +FF51 FF51 FF31 +FF52 FF52 FF32 +FF53 FF53 FF33 +FF54 FF54 FF34 +FF55 FF55 FF35 +FF56 FF56 FF36 +FF57 FF57 FF37 +FF58 FF58 FF38 +FF59 FF59 FF39 +FF5A FF5A FF3A +DROP VIEW v_bmp; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_utf8mb3_general_ci_casefold.test b/mysql-test/main/ctype_utf8mb3_general_ci_casefold.test new file mode 100644 index 0000000000000..c2a77f12f012e --- /dev/null +++ b/mysql-test/main/ctype_utf8mb3_general_ci_casefold.test @@ -0,0 +1,14 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET NAMES utf8mb3 COLLATE utf8mb3_general_ci; +--source include/ctype_unicode_casefold_bmp.inc + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/ctype_utf8mb3_general_ci_ws.result b/mysql-test/main/ctype_utf8mb3_general_ci_ws.result new file mode 100644 index 0000000000000..dc3221b14fb92 --- /dev/null +++ b/mysql-test/main/ctype_utf8mb3_general_ci_ws.result @@ -0,0 +1,1143 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET NAMES utf8mb3 COLLATE utf8mb3_general_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +utf8mb3_general_ci +SELECT HEX(codepoint) FROM v_bmp WHERE HEX(WEIGHT_STRING(c))='FFFD'; +HEX(codepoint) +FFFD +SELECT +SUM(codepoint_hex4=HEX(WEIGHT_STRING(c))) AS count_bmp_weight_is_codepoint, +SUM(codepoint_hex4<>HEX(WEIGHT_STRING(c))) AS count_bmp_weight_is_not_codepoint +FROM v_bmp; +count_bmp_weight_is_codepoint count_bmp_weight_is_not_codepoint +64428 1108 +SELECT codepoint_hex4,HEX(WEIGHT_STRING(c)) +FROM v_bmp +WHERE codepoint_hex4<>HEX(WEIGHT_STRING(c)); +codepoint_hex4 HEX(WEIGHT_STRING(c)) +0061 0041 +0062 0042 +0063 0043 +0064 0044 +0065 0045 +0066 0046 +0067 0047 +0068 0048 +0069 0049 +006A 004A +006B 004B +006C 004C +006D 004D +006E 004E +006F 004F +0070 0050 +0071 0051 +0072 0052 +0073 0053 +0074 0054 +0075 0055 +0076 0056 +0077 0057 +0078 0058 +0079 0059 +007A 005A +00B5 039C +00C0 0041 +00C1 0041 +00C2 0041 +00C3 0041 +00C4 0041 +00C5 0041 +00C7 0043 +00C8 0045 +00C9 0045 +00CA 0045 +00CB 0045 +00CC 0049 +00CD 0049 +00CE 0049 +00CF 0049 +00D1 004E +00D2 004F +00D3 004F +00D4 004F +00D5 004F +00D6 004F +00D9 0055 +00DA 0055 +00DB 0055 +00DC 0055 +00DD 0059 +00DF 0053 +00E0 0041 +00E1 0041 +00E2 0041 +00E3 0041 +00E4 0041 +00E5 0041 +00E6 00C6 +00E7 0043 +00E8 0045 +00E9 0045 +00EA 0045 +00EB 0045 +00EC 0049 +00ED 0049 +00EE 0049 +00EF 0049 +00F0 00D0 +00F1 004E +00F2 004F +00F3 004F +00F4 004F +00F5 004F +00F6 004F +00F8 00D8 +00F9 0055 +00FA 0055 +00FB 0055 +00FC 0055 +00FD 0059 +00FE 00DE +00FF 0059 +0100 0041 +0101 0041 +0102 0041 +0103 0041 +0104 0041 +0105 0041 +0106 0043 +0107 0043 +0108 0043 +0109 0043 +010A 0043 +010B 0043 +010C 0043 +010D 0043 +010E 0044 +010F 0044 +0111 0110 +0112 0045 +0113 0045 +0114 0045 +0115 0045 +0116 0045 +0117 0045 +0118 0045 +0119 0045 +011A 0045 +011B 0045 +011C 0047 +011D 0047 +011E 0047 +011F 0047 +0120 0047 +0121 0047 +0122 0047 +0123 0047 +0124 0048 +0125 0048 +0127 0126 +0128 0049 +0129 0049 +012A 0049 +012B 0049 +012C 0049 +012D 0049 +012E 0049 +012F 0049 +0130 0049 +0131 0049 +0133 0132 +0134 004A +0135 004A +0136 004B +0137 004B +0139 004C +013A 004C +013B 004C +013C 004C +013D 004C +013E 004C +0140 013F +0142 0141 +0143 004E +0144 004E +0145 004E +0146 004E +0147 004E +0148 004E +014B 014A +014C 004F +014D 004F +014E 004F +014F 004F +0150 004F +0151 004F +0153 0152 +0154 0052 +0155 0052 +0156 0052 +0157 0052 +0158 0052 +0159 0052 +015A 0053 +015B 0053 +015C 0053 +015D 0053 +015E 0053 +015F 0053 +0160 0053 +0161 0053 +0162 0054 +0163 0054 +0164 0054 +0165 0054 +0167 0166 +0168 0055 +0169 0055 +016A 0055 +016B 0055 +016C 0055 +016D 0055 +016E 0055 +016F 0055 +0170 0055 +0171 0055 +0172 0055 +0173 0055 +0174 0057 +0175 0057 +0176 0059 +0177 0059 +0178 0059 +0179 005A +017A 005A +017B 005A +017C 005A +017D 005A +017E 005A +017F 0053 +0183 0182 +0185 0184 +0188 0187 +018C 018B +0192 0191 +0195 01F6 +0199 0198 +01A0 004F +01A1 004F +01A3 01A2 +01A5 01A4 +01A8 01A7 +01AD 01AC +01AF 0055 +01B0 0055 +01B4 01B3 +01B6 01B5 +01B9 01B8 +01BD 01BC +01BF 01F7 +01C5 01C4 +01C6 01C4 +01C8 01C7 +01C9 01C7 +01CB 01CA +01CC 01CA +01CD 0041 +01CE 0041 +01CF 0049 +01D0 0049 +01D1 004F +01D2 004F +01D3 0055 +01D4 0055 +01D5 0055 +01D6 0055 +01D7 0055 +01D8 0055 +01D9 0055 +01DA 0055 +01DB 0055 +01DC 0055 +01DD 018E +01DE 0041 +01DF 0041 +01E0 0041 +01E1 0041 +01E2 00C6 +01E3 00C6 +01E5 01E4 +01E6 0047 +01E7 0047 +01E8 004B +01E9 004B +01EA 004F +01EB 004F +01EC 004F +01ED 004F +01EE 01B7 +01EF 01B7 +01F0 004A +01F2 01F1 +01F3 01F1 +01F4 0047 +01F5 0047 +01F8 004E +01F9 004E +01FA 0041 +01FB 0041 +01FC 00C6 +01FD 00C6 +01FE 00D8 +01FF 00D8 +0200 0041 +0201 0041 +0202 0041 +0203 0041 +0204 0045 +0205 0045 +0206 0045 +0207 0045 +0208 0049 +0209 0049 +020A 0049 +020B 0049 +020C 004F +020D 004F +020E 004F +020F 004F +0210 0052 +0211 0052 +0212 0052 +0213 0052 +0214 0055 +0215 0055 +0216 0055 +0217 0055 +0218 0053 +0219 0053 +021A 0054 +021B 0054 +021D 021C +021E 0048 +021F 0048 +0223 0222 +0225 0224 +0226 0041 +0227 0041 +0228 0045 +0229 0045 +022A 004F +022B 004F +022C 004F +022D 004F +022E 004F +022F 004F +0230 004F +0231 004F +0232 0059 +0233 0059 +0253 0181 +0254 0186 +0256 0189 +0257 018A +0259 018F +025B 0190 +0260 0193 +0263 0194 +0268 0197 +0269 0196 +026F 019C +0272 019D +0275 019F +0280 01A6 +0283 01A9 +0288 01AE +028A 01B1 +028B 01B2 +0292 01B7 +0345 0399 +0386 0391 +0388 0395 +0389 0397 +038A 0399 +038C 039F +038E 03A5 +038F 03A9 +0390 0399 +03AA 0399 +03AB 03A5 +03AC 0391 +03AD 0395 +03AE 0397 +03AF 0399 +03B0 03A5 +03B1 0391 +03B2 0392 +03B3 0393 +03B4 0394 +03B5 0395 +03B6 0396 +03B7 0397 +03B8 0398 +03B9 0399 +03BA 039A +03BB 039B +03BC 039C +03BD 039D +03BE 039E +03BF 039F +03C0 03A0 +03C1 03A1 +03C2 03A3 +03C3 03A3 +03C4 03A4 +03C5 03A5 +03C6 03A6 +03C7 03A7 +03C8 03A8 +03C9 03A9 +03CA 0399 +03CB 03A5 +03CC 039F +03CD 03A5 +03CE 03A9 +03D0 0392 +03D1 0398 +03D3 03D2 +03D4 03D2 +03D5 03A6 +03D6 03A0 +03DB 03DA +03DD 03DC +03DF 03DE +03E1 03E0 +03E3 03E2 +03E5 03E4 +03E7 03E6 +03E9 03E8 +03EB 03EA +03ED 03EC +03EF 03EE +03F0 039A +03F1 03A1 +03F2 03A3 +0400 0415 +0401 0415 +0403 0413 +0407 0406 +040C 041A +040D 0418 +040E 0423 +0430 0410 +0431 0411 +0432 0412 +0433 0413 +0434 0414 +0435 0415 +0436 0416 +0437 0417 +0438 0418 +0439 0419 +043A 041A +043B 041B +043C 041C +043D 041D +043E 041E +043F 041F +0440 0420 +0441 0421 +0442 0422 +0443 0423 +0444 0424 +0445 0425 +0446 0426 +0447 0427 +0448 0428 +0449 0429 +044A 042A +044B 042B +044C 042C +044D 042D +044E 042E +044F 042F +0450 0415 +0451 0415 +0452 0402 +0453 0413 +0454 0404 +0455 0405 +0456 0406 +0457 0406 +0458 0408 +0459 0409 +045A 040A +045B 040B +045C 041A +045D 0418 +045E 0423 +045F 040F +0461 0460 +0463 0462 +0465 0464 +0467 0466 +0469 0468 +046B 046A +046D 046C +046F 046E +0471 0470 +0473 0472 +0475 0474 +0476 0474 +0477 0474 +0479 0478 +047B 047A +047D 047C +047F 047E +0481 0480 +048D 048C +048F 048E +0491 0490 +0493 0492 +0495 0494 +0497 0496 +0499 0498 +049B 049A +049D 049C +049F 049E +04A1 04A0 +04A3 04A2 +04A5 04A4 +04A7 04A6 +04A9 04A8 +04AB 04AA +04AD 04AC +04AF 04AE +04B1 04B0 +04B3 04B2 +04B5 04B4 +04B7 04B6 +04B9 04B8 +04BB 04BA +04BD 04BC +04BF 04BE +04C1 0416 +04C2 0416 +04C4 04C3 +04C8 04C7 +04CC 04CB +04D0 0410 +04D1 0410 +04D2 0410 +04D3 0410 +04D5 04D4 +04D6 0415 +04D7 0415 +04D9 04D8 +04DA 04D8 +04DB 04D8 +04DC 0416 +04DD 0416 +04DE 0417 +04DF 0417 +04E1 04E0 +04E2 0418 +04E3 0418 +04E4 0418 +04E5 0418 +04E6 041E +04E7 041E +04E9 04E8 +04EA 04E8 +04EB 04E8 +04EC 042D +04ED 042D +04EE 0423 +04EF 0423 +04F0 0423 +04F1 0423 +04F2 0423 +04F3 0423 +04F4 0427 +04F5 0427 +04F8 042B +04F9 042B +0561 0531 +0562 0532 +0563 0533 +0564 0534 +0565 0535 +0566 0536 +0567 0537 +0568 0538 +0569 0539 +056A 053A +056B 053B +056C 053C +056D 053D +056E 053E +056F 053F +0570 0540 +0571 0541 +0572 0542 +0573 0543 +0574 0544 +0575 0545 +0576 0546 +0577 0547 +0578 0548 +0579 0549 +057A 054A +057B 054B +057C 054C +057D 054D +057E 054E +057F 054F +0580 0550 +0581 0551 +0582 0552 +0583 0553 +0584 0554 +0585 0555 +0586 0556 +1E00 0041 +1E01 0041 +1E02 0042 +1E03 0042 +1E04 0042 +1E05 0042 +1E06 0042 +1E07 0042 +1E08 0043 +1E09 0043 +1E0A 0044 +1E0B 0044 +1E0C 0044 +1E0D 0044 +1E0E 0044 +1E0F 0044 +1E10 0044 +1E11 0044 +1E12 0044 +1E13 0044 +1E14 0045 +1E15 0045 +1E16 0045 +1E17 0045 +1E18 0045 +1E19 0045 +1E1A 0045 +1E1B 0045 +1E1C 0045 +1E1D 0045 +1E1E 0046 +1E1F 0046 +1E20 0047 +1E21 0047 +1E22 0048 +1E23 0048 +1E24 0048 +1E25 0048 +1E26 0048 +1E27 0048 +1E28 0048 +1E29 0048 +1E2A 0048 +1E2B 0048 +1E2C 0049 +1E2D 0049 +1E2E 0049 +1E2F 0049 +1E30 004B +1E31 004B +1E32 004B +1E33 004B +1E34 004B +1E35 004B +1E36 004C +1E37 004C +1E38 004C +1E39 004C +1E3A 004C +1E3B 004C +1E3C 004C +1E3D 004C +1E3E 004D +1E3F 004D +1E40 004D +1E41 004D +1E42 004D +1E43 004D +1E44 004E +1E45 004E +1E46 004E +1E47 004E +1E48 004E +1E49 004E +1E4A 004E +1E4B 004E +1E4C 004F +1E4D 004F +1E4E 004F +1E4F 004F +1E50 004F +1E51 004F +1E52 004F +1E53 004F +1E54 0050 +1E55 0050 +1E56 0050 +1E57 0050 +1E58 0052 +1E59 0052 +1E5A 0052 +1E5B 0052 +1E5C 0052 +1E5D 0052 +1E5E 0052 +1E5F 0052 +1E60 0053 +1E61 0053 +1E62 0053 +1E63 0053 +1E64 0053 +1E65 0053 +1E66 0053 +1E67 0053 +1E68 0053 +1E69 0053 +1E6A 0054 +1E6B 0054 +1E6C 0054 +1E6D 0054 +1E6E 0054 +1E6F 0054 +1E70 0054 +1E71 0054 +1E72 0055 +1E73 0055 +1E74 0055 +1E75 0055 +1E76 0055 +1E77 0055 +1E78 0055 +1E79 0055 +1E7A 0055 +1E7B 0055 +1E7C 0056 +1E7D 0056 +1E7E 0056 +1E7F 0056 +1E80 0057 +1E81 0057 +1E82 0057 +1E83 0057 +1E84 0057 +1E85 0057 +1E86 0057 +1E87 0057 +1E88 0057 +1E89 0057 +1E8A 0058 +1E8B 0058 +1E8C 0058 +1E8D 0058 +1E8E 0059 +1E8F 0059 +1E90 005A +1E91 005A +1E92 005A +1E93 005A +1E94 005A +1E95 005A +1E96 0048 +1E97 0054 +1E98 0057 +1E99 0059 +1E9B 0053 +1EA0 0041 +1EA1 0041 +1EA2 0041 +1EA3 0041 +1EA4 0041 +1EA5 0041 +1EA6 0041 +1EA7 0041 +1EA8 0041 +1EA9 0041 +1EAA 0041 +1EAB 0041 +1EAC 0041 +1EAD 0041 +1EAE 0041 +1EAF 0041 +1EB0 0041 +1EB1 0041 +1EB2 0041 +1EB3 0041 +1EB4 0041 +1EB5 0041 +1EB6 0041 +1EB7 0041 +1EB8 0045 +1EB9 0045 +1EBA 0045 +1EBB 0045 +1EBC 0045 +1EBD 0045 +1EBE 0045 +1EBF 0045 +1EC0 0045 +1EC1 0045 +1EC2 0045 +1EC3 0045 +1EC4 0045 +1EC5 0045 +1EC6 0045 +1EC7 0045 +1EC8 0049 +1EC9 0049 +1ECA 0049 +1ECB 0049 +1ECC 004F +1ECD 004F +1ECE 004F +1ECF 004F +1ED0 004F +1ED1 004F +1ED2 004F +1ED3 004F +1ED4 004F +1ED5 004F +1ED6 004F +1ED7 004F +1ED8 004F +1ED9 004F +1EDA 004F +1EDB 004F +1EDC 004F +1EDD 004F +1EDE 004F +1EDF 004F +1EE0 004F +1EE1 004F +1EE2 004F +1EE3 004F +1EE4 0055 +1EE5 0055 +1EE6 0055 +1EE7 0055 +1EE8 0055 +1EE9 0055 +1EEA 0055 +1EEB 0055 +1EEC 0055 +1EED 0055 +1EEE 0055 +1EEF 0055 +1EF0 0055 +1EF1 0055 +1EF2 0059 +1EF3 0059 +1EF4 0059 +1EF5 0059 +1EF6 0059 +1EF7 0059 +1EF8 0059 +1EF9 0059 +1F00 0391 +1F01 0391 +1F02 0391 +1F03 0391 +1F04 0391 +1F05 0391 +1F06 0391 +1F07 0391 +1F08 0391 +1F09 0391 +1F0A 0391 +1F0B 0391 +1F0C 0391 +1F0D 0391 +1F0E 0391 +1F0F 0391 +1F10 0395 +1F11 0395 +1F12 0395 +1F13 0395 +1F14 0395 +1F15 0395 +1F18 0395 +1F19 0395 +1F1A 0395 +1F1B 0395 +1F1C 0395 +1F1D 0395 +1F20 0397 +1F21 0397 +1F22 0397 +1F23 0397 +1F24 0397 +1F25 0397 +1F26 0397 +1F27 0397 +1F28 0397 +1F29 0397 +1F2A 0397 +1F2B 0397 +1F2C 0397 +1F2D 0397 +1F2E 0397 +1F2F 0397 +1F30 0399 +1F31 0399 +1F32 0399 +1F33 0399 +1F34 0399 +1F35 0399 +1F36 0399 +1F37 0399 +1F38 0399 +1F39 0399 +1F3A 0399 +1F3B 0399 +1F3C 0399 +1F3D 0399 +1F3E 0399 +1F3F 0399 +1F40 039F +1F41 039F +1F42 039F +1F43 039F +1F44 039F +1F45 039F +1F48 039F +1F49 039F +1F4A 039F +1F4B 039F +1F4C 039F +1F4D 039F +1F50 03A5 +1F51 03A5 +1F52 03A5 +1F53 03A5 +1F54 03A5 +1F55 03A5 +1F56 03A5 +1F57 03A5 +1F59 03A5 +1F5B 03A5 +1F5D 03A5 +1F5F 03A5 +1F60 03A9 +1F61 03A9 +1F62 03A9 +1F63 03A9 +1F64 03A9 +1F65 03A9 +1F66 03A9 +1F67 03A9 +1F68 03A9 +1F69 03A9 +1F6A 03A9 +1F6B 03A9 +1F6C 03A9 +1F6D 03A9 +1F6E 03A9 +1F6F 03A9 +1F70 0391 +1F71 1FBB +1F72 0395 +1F73 1FC9 +1F74 0397 +1F75 1FCB +1F76 0399 +1F77 1FDB +1F78 039F +1F79 1FF9 +1F7A 03A5 +1F7B 1FEB +1F7C 03A9 +1F7D 1FFB +1F80 0391 +1F81 0391 +1F82 0391 +1F83 0391 +1F84 0391 +1F85 0391 +1F86 0391 +1F87 0391 +1F88 0391 +1F89 0391 +1F8A 0391 +1F8B 0391 +1F8C 0391 +1F8D 0391 +1F8E 0391 +1F8F 0391 +1F90 0397 +1F91 0397 +1F92 0397 +1F93 0397 +1F94 0397 +1F95 0397 +1F96 0397 +1F97 0397 +1F98 0397 +1F99 0397 +1F9A 0397 +1F9B 0397 +1F9C 0397 +1F9D 0397 +1F9E 0397 +1F9F 0397 +1FA0 03A9 +1FA1 03A9 +1FA2 03A9 +1FA3 03A9 +1FA4 03A9 +1FA5 03A9 +1FA6 03A9 +1FA7 03A9 +1FA8 03A9 +1FA9 03A9 +1FAA 03A9 +1FAB 03A9 +1FAC 03A9 +1FAD 03A9 +1FAE 03A9 +1FAF 03A9 +1FB0 0391 +1FB1 0391 +1FB2 0391 +1FB3 0391 +1FB4 0391 +1FB6 0391 +1FB7 0391 +1FB8 0391 +1FB9 0391 +1FBA 0391 +1FBC 0391 +1FBE 0399 +1FC2 0397 +1FC3 0397 +1FC4 0397 +1FC6 0397 +1FC7 0397 +1FC8 0395 +1FCA 0397 +1FCC 0397 +1FD0 0399 +1FD1 0399 +1FD2 0399 +1FD6 0399 +1FD7 0399 +1FD8 0399 +1FD9 0399 +1FDA 0399 +1FE0 03A5 +1FE1 03A5 +1FE2 03A5 +1FE4 03A1 +1FE5 03A1 +1FE6 03A5 +1FE7 03A5 +1FE8 03A5 +1FE9 03A5 +1FEA 03A5 +1FEC 03A1 +1FF2 03A9 +1FF3 03A9 +1FF4 03A9 +1FF6 03A9 +1FF7 03A9 +1FF8 039F +1FFA 03A9 +1FFC 03A9 +2170 2160 +2171 2161 +2172 2162 +2173 2163 +2174 2164 +2175 2165 +2176 2166 +2177 2167 +2178 2168 +2179 2169 +217A 216A +217B 216B +217C 216C +217D 216D +217E 216E +217F 216F +24D0 24B6 +24D1 24B7 +24D2 24B8 +24D3 24B9 +24D4 24BA +24D5 24BB +24D6 24BC +24D7 24BD +24D8 24BE +24D9 24BF +24DA 24C0 +24DB 24C1 +24DC 24C2 +24DD 24C3 +24DE 24C4 +24DF 24C5 +24E0 24C6 +24E1 24C7 +24E2 24C8 +24E3 24C9 +24E4 24CA +24E5 24CB +24E6 24CC +24E7 24CD +24E8 24CE +24E9 24CF +FF41 FF21 +FF42 FF22 +FF43 FF23 +FF44 FF24 +FF45 FF25 +FF46 FF26 +FF47 FF27 +FF48 FF28 +FF49 FF29 +FF4A FF2A +FF4B FF2B +FF4C FF2C +FF4D FF2D +FF4E FF2E +FF4F FF2F +FF50 FF30 +FF51 FF31 +FF52 FF32 +FF53 FF33 +FF54 FF34 +FF55 FF35 +FF56 FF36 +FF57 FF37 +FF58 FF38 +FF59 FF39 +FF5A FF3A +DROP VIEW v_bmp; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_utf8mb3_general_ci_ws.test b/mysql-test/main/ctype_utf8mb3_general_ci_ws.test new file mode 100644 index 0000000000000..58430cc1a9fc3 --- /dev/null +++ b/mysql-test/main/ctype_utf8mb3_general_ci_ws.test @@ -0,0 +1,14 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET NAMES utf8mb3 COLLATE utf8mb3_general_ci; +--source include/ctype_unicode_ws_bmp.inc + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/ctype_utf8mb3_general_mysql500_ci_casefold.result b/mysql-test/main/ctype_utf8mb3_general_mysql500_ci_casefold.result new file mode 100644 index 0000000000000..b6a73e811ca2a --- /dev/null +++ b/mysql-test/main/ctype_utf8mb3_general_mysql500_ci_casefold.result @@ -0,0 +1,1427 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET NAMES utf8mb3 COLLATE utf8mb3_general_mysql500_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +utf8mb3_general_mysql500_ci +SELECT +codepoint_hex4, +HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)), +HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +FROM v_bmp +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); +codepoint_hex4 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +0041 0061 0041 +0042 0062 0042 +0043 0063 0043 +0044 0064 0044 +0045 0065 0045 +0046 0066 0046 +0047 0067 0047 +0048 0068 0048 +0049 0069 0049 +004A 006A 004A +004B 006B 004B +004C 006C 004C +004D 006D 004D +004E 006E 004E +004F 006F 004F +0050 0070 0050 +0051 0071 0051 +0052 0072 0052 +0053 0073 0053 +0054 0074 0054 +0055 0075 0055 +0056 0076 0056 +0057 0077 0057 +0058 0078 0058 +0059 0079 0059 +005A 007A 005A +0061 0061 0041 +0062 0062 0042 +0063 0063 0043 +0064 0064 0044 +0065 0065 0045 +0066 0066 0046 +0067 0067 0047 +0068 0068 0048 +0069 0069 0049 +006A 006A 004A +006B 006B 004B +006C 006C 004C +006D 006D 004D +006E 006E 004E +006F 006F 004F +0070 0070 0050 +0071 0071 0051 +0072 0072 0052 +0073 0073 0053 +0074 0074 0054 +0075 0075 0055 +0076 0076 0056 +0077 0077 0057 +0078 0078 0058 +0079 0079 0059 +007A 007A 005A +00B5 00B5 039C +00C0 00E0 00C0 +00C1 00E1 00C1 +00C2 00E2 00C2 +00C3 00E3 00C3 +00C4 00E4 00C4 +00C5 00E5 00C5 +00C6 00E6 00C6 +00C7 00E7 00C7 +00C8 00E8 00C8 +00C9 00E9 00C9 +00CA 00EA 00CA +00CB 00EB 00CB +00CC 00EC 00CC +00CD 00ED 00CD +00CE 00EE 00CE +00CF 00EF 00CF +00D0 00F0 00D0 +00D1 00F1 00D1 +00D2 00F2 00D2 +00D3 00F3 00D3 +00D4 00F4 00D4 +00D5 00F5 00D5 +00D6 00F6 00D6 +00D8 00F8 00D8 +00D9 00F9 00D9 +00DA 00FA 00DA +00DB 00FB 00DB +00DC 00FC 00DC +00DD 00FD 00DD +00DE 00FE 00DE +00E0 00E0 00C0 +00E1 00E1 00C1 +00E2 00E2 00C2 +00E3 00E3 00C3 +00E4 00E4 00C4 +00E5 00E5 00C5 +00E6 00E6 00C6 +00E7 00E7 00C7 +00E8 00E8 00C8 +00E9 00E9 00C9 +00EA 00EA 00CA +00EB 00EB 00CB +00EC 00EC 00CC +00ED 00ED 00CD +00EE 00EE 00CE +00EF 00EF 00CF +00F0 00F0 00D0 +00F1 00F1 00D1 +00F2 00F2 00D2 +00F3 00F3 00D3 +00F4 00F4 00D4 +00F5 00F5 00D5 +00F6 00F6 00D6 +00F8 00F8 00D8 +00F9 00F9 00D9 +00FA 00FA 00DA +00FB 00FB 00DB +00FC 00FC 00DC +00FD 00FD 00DD +00FE 00FE 00DE +00FF 00FF 0178 +0100 0101 0100 +0101 0101 0100 +0102 0103 0102 +0103 0103 0102 +0104 0105 0104 +0105 0105 0104 +0106 0107 0106 +0107 0107 0106 +0108 0109 0108 +0109 0109 0108 +010A 010B 010A +010B 010B 010A +010C 010D 010C +010D 010D 010C +010E 010F 010E +010F 010F 010E +0110 0111 0110 +0111 0111 0110 +0112 0113 0112 +0113 0113 0112 +0114 0115 0114 +0115 0115 0114 +0116 0117 0116 +0117 0117 0116 +0118 0119 0118 +0119 0119 0118 +011A 011B 011A +011B 011B 011A +011C 011D 011C +011D 011D 011C +011E 011F 011E +011F 011F 011E +0120 0121 0120 +0121 0121 0120 +0122 0123 0122 +0123 0123 0122 +0124 0125 0124 +0125 0125 0124 +0126 0127 0126 +0127 0127 0126 +0128 0129 0128 +0129 0129 0128 +012A 012B 012A +012B 012B 012A +012C 012D 012C +012D 012D 012C +012E 012F 012E +012F 012F 012E +0130 0069 0130 +0131 0131 0049 +0132 0133 0132 +0133 0133 0132 +0134 0135 0134 +0135 0135 0134 +0136 0137 0136 +0137 0137 0136 +0139 013A 0139 +013A 013A 0139 +013B 013C 013B +013C 013C 013B +013D 013E 013D +013E 013E 013D +013F 0140 013F +0140 0140 013F +0141 0142 0141 +0142 0142 0141 +0143 0144 0143 +0144 0144 0143 +0145 0146 0145 +0146 0146 0145 +0147 0148 0147 +0148 0148 0147 +014A 014B 014A +014B 014B 014A +014C 014D 014C +014D 014D 014C +014E 014F 014E +014F 014F 014E +0150 0151 0150 +0151 0151 0150 +0152 0153 0152 +0153 0153 0152 +0154 0155 0154 +0155 0155 0154 +0156 0157 0156 +0157 0157 0156 +0158 0159 0158 +0159 0159 0158 +015A 015B 015A +015B 015B 015A +015C 015D 015C +015D 015D 015C +015E 015F 015E +015F 015F 015E +0160 0161 0160 +0161 0161 0160 +0162 0163 0162 +0163 0163 0162 +0164 0165 0164 +0165 0165 0164 +0166 0167 0166 +0167 0167 0166 +0168 0169 0168 +0169 0169 0168 +016A 016B 016A +016B 016B 016A +016C 016D 016C +016D 016D 016C +016E 016F 016E +016F 016F 016E +0170 0171 0170 +0171 0171 0170 +0172 0173 0172 +0173 0173 0172 +0174 0175 0174 +0175 0175 0174 +0176 0177 0176 +0177 0177 0176 +0178 00FF 0178 +0179 017A 0179 +017A 017A 0179 +017B 017C 017B +017C 017C 017B +017D 017E 017D +017E 017E 017D +017F 017F 0053 +0181 0253 0181 +0182 0183 0182 +0183 0183 0182 +0184 0185 0184 +0185 0185 0184 +0186 0254 0186 +0187 0188 0187 +0188 0188 0187 +0189 0256 0189 +018A 0257 018A +018B 018C 018B +018C 018C 018B +018E 01DD 018E +018F 0259 018F +0190 025B 0190 +0191 0192 0191 +0192 0192 0191 +0193 0260 0193 +0194 0263 0194 +0195 0195 01F6 +0196 0269 0196 +0197 0268 0197 +0198 0199 0198 +0199 0199 0198 +019C 026F 019C +019D 0272 019D +019F 0275 019F +01A0 01A1 01A0 +01A1 01A1 01A0 +01A2 01A3 01A2 +01A3 01A3 01A2 +01A4 01A5 01A4 +01A5 01A5 01A4 +01A6 0280 01A6 +01A7 01A8 01A7 +01A8 01A8 01A7 +01A9 0283 01A9 +01AC 01AD 01AC +01AD 01AD 01AC +01AE 0288 01AE +01AF 01B0 01AF +01B0 01B0 01AF +01B1 028A 01B1 +01B2 028B 01B2 +01B3 01B4 01B3 +01B4 01B4 01B3 +01B5 01B6 01B5 +01B6 01B6 01B5 +01B7 0292 01B7 +01B8 01B9 01B8 +01B9 01B9 01B8 +01BC 01BD 01BC +01BD 01BD 01BC +01BF 01BF 01F7 +01C4 01C6 01C4 +01C5 01C6 01C4 +01C6 01C6 01C4 +01C7 01C9 01C7 +01C8 01C9 01C7 +01C9 01C9 01C7 +01CA 01CC 01CA +01CB 01CC 01CA +01CC 01CC 01CA +01CD 01CE 01CD +01CE 01CE 01CD +01CF 01D0 01CF +01D0 01D0 01CF +01D1 01D2 01D1 +01D2 01D2 01D1 +01D3 01D4 01D3 +01D4 01D4 01D3 +01D5 01D6 01D5 +01D6 01D6 01D5 +01D7 01D8 01D7 +01D8 01D8 01D7 +01D9 01DA 01D9 +01DA 01DA 01D9 +01DB 01DC 01DB +01DC 01DC 01DB +01DD 01DD 018E +01DE 01DF 01DE +01DF 01DF 01DE +01E0 01E1 01E0 +01E1 01E1 01E0 +01E2 01E3 01E2 +01E3 01E3 01E2 +01E4 01E5 01E4 +01E5 01E5 01E4 +01E6 01E7 01E6 +01E7 01E7 01E6 +01E8 01E9 01E8 +01E9 01E9 01E8 +01EA 01EB 01EA +01EB 01EB 01EA +01EC 01ED 01EC +01ED 01ED 01EC +01EE 01EF 01EE +01EF 01EF 01EE +01F1 01F3 01F1 +01F2 01F3 01F1 +01F3 01F3 01F1 +01F4 01F5 01F4 +01F5 01F5 01F4 +01F6 0195 01F6 +01F7 01BF 01F7 +01F8 01F9 01F8 +01F9 01F9 01F8 +01FA 01FB 01FA +01FB 01FB 01FA +01FC 01FD 01FC +01FD 01FD 01FC +01FE 01FF 01FE +01FF 01FF 01FE +0200 0201 0200 +0201 0201 0200 +0202 0203 0202 +0203 0203 0202 +0204 0205 0204 +0205 0205 0204 +0206 0207 0206 +0207 0207 0206 +0208 0209 0208 +0209 0209 0208 +020A 020B 020A +020B 020B 020A +020C 020D 020C +020D 020D 020C +020E 020F 020E +020F 020F 020E +0210 0211 0210 +0211 0211 0210 +0212 0213 0212 +0213 0213 0212 +0214 0215 0214 +0215 0215 0214 +0216 0217 0216 +0217 0217 0216 +0218 0219 0218 +0219 0219 0218 +021A 021B 021A +021B 021B 021A +021C 021D 021C +021D 021D 021C +021E 021F 021E +021F 021F 021E +0222 0223 0222 +0223 0223 0222 +0224 0225 0224 +0225 0225 0224 +0226 0227 0226 +0227 0227 0226 +0228 0229 0228 +0229 0229 0228 +022A 022B 022A +022B 022B 022A +022C 022D 022C +022D 022D 022C +022E 022F 022E +022F 022F 022E +0230 0231 0230 +0231 0231 0230 +0232 0233 0232 +0233 0233 0232 +0253 0253 0181 +0254 0254 0186 +0256 0256 0189 +0257 0257 018A +0259 0259 018F +025B 025B 0190 +0260 0260 0193 +0263 0263 0194 +0268 0268 0197 +0269 0269 0196 +026F 026F 019C +0272 0272 019D +0275 0275 019F +0280 0280 01A6 +0283 0283 01A9 +0288 0288 01AE +028A 028A 01B1 +028B 028B 01B2 +0292 0292 01B7 +0345 0345 0399 +0386 03AC 0386 +0388 03AD 0388 +0389 03AE 0389 +038A 03AF 038A +038C 03CC 038C +038E 03CD 038E +038F 03CE 038F +0391 03B1 0391 +0392 03B2 0392 +0393 03B3 0393 +0394 03B4 0394 +0395 03B5 0395 +0396 03B6 0396 +0397 03B7 0397 +0398 03B8 0398 +0399 03B9 0399 +039A 03BA 039A +039B 03BB 039B +039C 03BC 039C +039D 03BD 039D +039E 03BE 039E +039F 03BF 039F +03A0 03C0 03A0 +03A1 03C1 03A1 +03A3 03C3 03A3 +03A4 03C4 03A4 +03A5 03C5 03A5 +03A6 03C6 03A6 +03A7 03C7 03A7 +03A8 03C8 03A8 +03A9 03C9 03A9 +03AA 03CA 03AA +03AB 03CB 03AB +03AC 03AC 0386 +03AD 03AD 0388 +03AE 03AE 0389 +03AF 03AF 038A +03B1 03B1 0391 +03B2 03B2 0392 +03B3 03B3 0393 +03B4 03B4 0394 +03B5 03B5 0395 +03B6 03B6 0396 +03B7 03B7 0397 +03B8 03B8 0398 +03B9 03B9 0399 +03BA 03BA 039A +03BB 03BB 039B +03BC 03BC 039C +03BD 03BD 039D +03BE 03BE 039E +03BF 03BF 039F +03C0 03C0 03A0 +03C1 03C1 03A1 +03C2 03C2 03A3 +03C3 03C3 03A3 +03C4 03C4 03A4 +03C5 03C5 03A5 +03C6 03C6 03A6 +03C7 03C7 03A7 +03C8 03C8 03A8 +03C9 03C9 03A9 +03CA 03CA 03AA +03CB 03CB 03AB +03CC 03CC 038C +03CD 03CD 038E +03CE 03CE 038F +03D0 03D0 0392 +03D1 03D1 0398 +03D5 03D5 03A6 +03D6 03D6 03A0 +03DA 03DB 03DA +03DB 03DB 03DA +03DC 03DD 03DC +03DD 03DD 03DC +03DE 03DF 03DE +03DF 03DF 03DE +03E0 03E1 03E0 +03E1 03E1 03E0 +03E2 03E3 03E2 +03E3 03E3 03E2 +03E4 03E5 03E4 +03E5 03E5 03E4 +03E6 03E7 03E6 +03E7 03E7 03E6 +03E8 03E9 03E8 +03E9 03E9 03E8 +03EA 03EB 03EA +03EB 03EB 03EA +03EC 03ED 03EC +03ED 03ED 03EC +03EE 03EF 03EE +03EF 03EF 03EE +03F0 03F0 039A +03F1 03F1 03A1 +03F2 03F2 03A3 +0400 0450 0400 +0401 0451 0401 +0402 0452 0402 +0403 0453 0403 +0404 0454 0404 +0405 0455 0405 +0406 0456 0406 +0407 0457 0407 +0408 0458 0408 +0409 0459 0409 +040A 045A 040A +040B 045B 040B +040C 045C 040C +040D 045D 040D +040E 045E 040E +040F 045F 040F +0410 0430 0410 +0411 0431 0411 +0412 0432 0412 +0413 0433 0413 +0414 0434 0414 +0415 0435 0415 +0416 0436 0416 +0417 0437 0417 +0418 0438 0418 +0419 0439 0419 +041A 043A 041A +041B 043B 041B +041C 043C 041C +041D 043D 041D +041E 043E 041E +041F 043F 041F +0420 0440 0420 +0421 0441 0421 +0422 0442 0422 +0423 0443 0423 +0424 0444 0424 +0425 0445 0425 +0426 0446 0426 +0427 0447 0427 +0428 0448 0428 +0429 0449 0429 +042A 044A 042A +042B 044B 042B +042C 044C 042C +042D 044D 042D +042E 044E 042E +042F 044F 042F +0430 0430 0410 +0431 0431 0411 +0432 0432 0412 +0433 0433 0413 +0434 0434 0414 +0435 0435 0415 +0436 0436 0416 +0437 0437 0417 +0438 0438 0418 +0439 0439 0419 +043A 043A 041A +043B 043B 041B +043C 043C 041C +043D 043D 041D +043E 043E 041E +043F 043F 041F +0440 0440 0420 +0441 0441 0421 +0442 0442 0422 +0443 0443 0423 +0444 0444 0424 +0445 0445 0425 +0446 0446 0426 +0447 0447 0427 +0448 0448 0428 +0449 0449 0429 +044A 044A 042A +044B 044B 042B +044C 044C 042C +044D 044D 042D +044E 044E 042E +044F 044F 042F +0450 0450 0400 +0451 0451 0401 +0452 0452 0402 +0453 0453 0403 +0454 0454 0404 +0455 0455 0405 +0456 0456 0406 +0457 0457 0407 +0458 0458 0408 +0459 0459 0409 +045A 045A 040A +045B 045B 040B +045C 045C 040C +045D 045D 040D +045E 045E 040E +045F 045F 040F +0460 0461 0460 +0461 0461 0460 +0462 0463 0462 +0463 0463 0462 +0464 0465 0464 +0465 0465 0464 +0466 0467 0466 +0467 0467 0466 +0468 0469 0468 +0469 0469 0468 +046A 046B 046A +046B 046B 046A +046C 046D 046C +046D 046D 046C +046E 046F 046E +046F 046F 046E +0470 0471 0470 +0471 0471 0470 +0472 0473 0472 +0473 0473 0472 +0474 0475 0474 +0475 0475 0474 +0476 0477 0476 +0477 0477 0476 +0478 0479 0478 +0479 0479 0478 +047A 047B 047A +047B 047B 047A +047C 047D 047C +047D 047D 047C +047E 047F 047E +047F 047F 047E +0480 0481 0480 +0481 0481 0480 +048C 048D 048C +048D 048D 048C +048E 048F 048E +048F 048F 048E +0490 0491 0490 +0491 0491 0490 +0492 0493 0492 +0493 0493 0492 +0494 0495 0494 +0495 0495 0494 +0496 0497 0496 +0497 0497 0496 +0498 0499 0498 +0499 0499 0498 +049A 049B 049A +049B 049B 049A +049C 049D 049C +049D 049D 049C +049E 049F 049E +049F 049F 049E +04A0 04A1 04A0 +04A1 04A1 04A0 +04A2 04A3 04A2 +04A3 04A3 04A2 +04A4 04A5 04A4 +04A5 04A5 04A4 +04A6 04A7 04A6 +04A7 04A7 04A6 +04A8 04A9 04A8 +04A9 04A9 04A8 +04AA 04AB 04AA +04AB 04AB 04AA +04AC 04AD 04AC +04AD 04AD 04AC +04AE 04AF 04AE +04AF 04AF 04AE +04B0 04B1 04B0 +04B1 04B1 04B0 +04B2 04B3 04B2 +04B3 04B3 04B2 +04B4 04B5 04B4 +04B5 04B5 04B4 +04B6 04B7 04B6 +04B7 04B7 04B6 +04B8 04B9 04B8 +04B9 04B9 04B8 +04BA 04BB 04BA +04BB 04BB 04BA +04BC 04BD 04BC +04BD 04BD 04BC +04BE 04BF 04BE +04BF 04BF 04BE +04C1 04C2 04C1 +04C2 04C2 04C1 +04C3 04C4 04C3 +04C4 04C4 04C3 +04C7 04C8 04C7 +04C8 04C8 04C7 +04CB 04CC 04CB +04CC 04CC 04CB +04D0 04D1 04D0 +04D1 04D1 04D0 +04D2 04D3 04D2 +04D3 04D3 04D2 +04D4 04D5 04D4 +04D5 04D5 04D4 +04D6 04D7 04D6 +04D7 04D7 04D6 +04D8 04D9 04D8 +04D9 04D9 04D8 +04DA 04DB 04DA +04DB 04DB 04DA +04DC 04DD 04DC +04DD 04DD 04DC +04DE 04DF 04DE +04DF 04DF 04DE +04E0 04E1 04E0 +04E1 04E1 04E0 +04E2 04E3 04E2 +04E3 04E3 04E2 +04E4 04E5 04E4 +04E5 04E5 04E4 +04E6 04E7 04E6 +04E7 04E7 04E6 +04E8 04E9 04E8 +04E9 04E9 04E8 +04EA 04EB 04EA +04EB 04EB 04EA +04EC 04ED 04EC +04ED 04ED 04EC +04EE 04EF 04EE +04EF 04EF 04EE +04F0 04F1 04F0 +04F1 04F1 04F0 +04F2 04F3 04F2 +04F3 04F3 04F2 +04F4 04F5 04F4 +04F5 04F5 04F4 +04F8 04F9 04F8 +04F9 04F9 04F8 +0531 0561 0531 +0532 0562 0532 +0533 0563 0533 +0534 0564 0534 +0535 0565 0535 +0536 0566 0536 +0537 0567 0537 +0538 0568 0538 +0539 0569 0539 +053A 056A 053A +053B 056B 053B +053C 056C 053C +053D 056D 053D +053E 056E 053E +053F 056F 053F +0540 0570 0540 +0541 0571 0541 +0542 0572 0542 +0543 0573 0543 +0544 0574 0544 +0545 0575 0545 +0546 0576 0546 +0547 0577 0547 +0548 0578 0548 +0549 0579 0549 +054A 057A 054A +054B 057B 054B +054C 057C 054C +054D 057D 054D +054E 057E 054E +054F 057F 054F +0550 0580 0550 +0551 0581 0551 +0552 0582 0552 +0553 0583 0553 +0554 0584 0554 +0555 0585 0555 +0556 0586 0556 +0561 0561 0531 +0562 0562 0532 +0563 0563 0533 +0564 0564 0534 +0565 0565 0535 +0566 0566 0536 +0567 0567 0537 +0568 0568 0538 +0569 0569 0539 +056A 056A 053A +056B 056B 053B +056C 056C 053C +056D 056D 053D +056E 056E 053E +056F 056F 053F +0570 0570 0540 +0571 0571 0541 +0572 0572 0542 +0573 0573 0543 +0574 0574 0544 +0575 0575 0545 +0576 0576 0546 +0577 0577 0547 +0578 0578 0548 +0579 0579 0549 +057A 057A 054A +057B 057B 054B +057C 057C 054C +057D 057D 054D +057E 057E 054E +057F 057F 054F +0580 0580 0550 +0581 0581 0551 +0582 0582 0552 +0583 0583 0553 +0584 0584 0554 +0585 0585 0555 +0586 0586 0556 +1E00 1E01 1E00 +1E01 1E01 1E00 +1E02 1E03 1E02 +1E03 1E03 1E02 +1E04 1E05 1E04 +1E05 1E05 1E04 +1E06 1E07 1E06 +1E07 1E07 1E06 +1E08 1E09 1E08 +1E09 1E09 1E08 +1E0A 1E0B 1E0A +1E0B 1E0B 1E0A +1E0C 1E0D 1E0C +1E0D 1E0D 1E0C +1E0E 1E0F 1E0E +1E0F 1E0F 1E0E +1E10 1E11 1E10 +1E11 1E11 1E10 +1E12 1E13 1E12 +1E13 1E13 1E12 +1E14 1E15 1E14 +1E15 1E15 1E14 +1E16 1E17 1E16 +1E17 1E17 1E16 +1E18 1E19 1E18 +1E19 1E19 1E18 +1E1A 1E1B 1E1A +1E1B 1E1B 1E1A +1E1C 1E1D 1E1C +1E1D 1E1D 1E1C +1E1E 1E1F 1E1E +1E1F 1E1F 1E1E +1E20 1E21 1E20 +1E21 1E21 1E20 +1E22 1E23 1E22 +1E23 1E23 1E22 +1E24 1E25 1E24 +1E25 1E25 1E24 +1E26 1E27 1E26 +1E27 1E27 1E26 +1E28 1E29 1E28 +1E29 1E29 1E28 +1E2A 1E2B 1E2A +1E2B 1E2B 1E2A +1E2C 1E2D 1E2C +1E2D 1E2D 1E2C +1E2E 1E2F 1E2E +1E2F 1E2F 1E2E +1E30 1E31 1E30 +1E31 1E31 1E30 +1E32 1E33 1E32 +1E33 1E33 1E32 +1E34 1E35 1E34 +1E35 1E35 1E34 +1E36 1E37 1E36 +1E37 1E37 1E36 +1E38 1E39 1E38 +1E39 1E39 1E38 +1E3A 1E3B 1E3A +1E3B 1E3B 1E3A +1E3C 1E3D 1E3C +1E3D 1E3D 1E3C +1E3E 1E3F 1E3E +1E3F 1E3F 1E3E +1E40 1E41 1E40 +1E41 1E41 1E40 +1E42 1E43 1E42 +1E43 1E43 1E42 +1E44 1E45 1E44 +1E45 1E45 1E44 +1E46 1E47 1E46 +1E47 1E47 1E46 +1E48 1E49 1E48 +1E49 1E49 1E48 +1E4A 1E4B 1E4A +1E4B 1E4B 1E4A +1E4C 1E4D 1E4C +1E4D 1E4D 1E4C +1E4E 1E4F 1E4E +1E4F 1E4F 1E4E +1E50 1E51 1E50 +1E51 1E51 1E50 +1E52 1E53 1E52 +1E53 1E53 1E52 +1E54 1E55 1E54 +1E55 1E55 1E54 +1E56 1E57 1E56 +1E57 1E57 1E56 +1E58 1E59 1E58 +1E59 1E59 1E58 +1E5A 1E5B 1E5A +1E5B 1E5B 1E5A +1E5C 1E5D 1E5C +1E5D 1E5D 1E5C +1E5E 1E5F 1E5E +1E5F 1E5F 1E5E +1E60 1E61 1E60 +1E61 1E61 1E60 +1E62 1E63 1E62 +1E63 1E63 1E62 +1E64 1E65 1E64 +1E65 1E65 1E64 +1E66 1E67 1E66 +1E67 1E67 1E66 +1E68 1E69 1E68 +1E69 1E69 1E68 +1E6A 1E6B 1E6A +1E6B 1E6B 1E6A +1E6C 1E6D 1E6C +1E6D 1E6D 1E6C +1E6E 1E6F 1E6E +1E6F 1E6F 1E6E +1E70 1E71 1E70 +1E71 1E71 1E70 +1E72 1E73 1E72 +1E73 1E73 1E72 +1E74 1E75 1E74 +1E75 1E75 1E74 +1E76 1E77 1E76 +1E77 1E77 1E76 +1E78 1E79 1E78 +1E79 1E79 1E78 +1E7A 1E7B 1E7A +1E7B 1E7B 1E7A +1E7C 1E7D 1E7C +1E7D 1E7D 1E7C +1E7E 1E7F 1E7E +1E7F 1E7F 1E7E +1E80 1E81 1E80 +1E81 1E81 1E80 +1E82 1E83 1E82 +1E83 1E83 1E82 +1E84 1E85 1E84 +1E85 1E85 1E84 +1E86 1E87 1E86 +1E87 1E87 1E86 +1E88 1E89 1E88 +1E89 1E89 1E88 +1E8A 1E8B 1E8A +1E8B 1E8B 1E8A +1E8C 1E8D 1E8C +1E8D 1E8D 1E8C +1E8E 1E8F 1E8E +1E8F 1E8F 1E8E +1E90 1E91 1E90 +1E91 1E91 1E90 +1E92 1E93 1E92 +1E93 1E93 1E92 +1E94 1E95 1E94 +1E95 1E95 1E94 +1E9B 1E9B 1E60 +1EA0 1EA1 1EA0 +1EA1 1EA1 1EA0 +1EA2 1EA3 1EA2 +1EA3 1EA3 1EA2 +1EA4 1EA5 1EA4 +1EA5 1EA5 1EA4 +1EA6 1EA7 1EA6 +1EA7 1EA7 1EA6 +1EA8 1EA9 1EA8 +1EA9 1EA9 1EA8 +1EAA 1EAB 1EAA +1EAB 1EAB 1EAA +1EAC 1EAD 1EAC +1EAD 1EAD 1EAC +1EAE 1EAF 1EAE +1EAF 1EAF 1EAE +1EB0 1EB1 1EB0 +1EB1 1EB1 1EB0 +1EB2 1EB3 1EB2 +1EB3 1EB3 1EB2 +1EB4 1EB5 1EB4 +1EB5 1EB5 1EB4 +1EB6 1EB7 1EB6 +1EB7 1EB7 1EB6 +1EB8 1EB9 1EB8 +1EB9 1EB9 1EB8 +1EBA 1EBB 1EBA +1EBB 1EBB 1EBA +1EBC 1EBD 1EBC +1EBD 1EBD 1EBC +1EBE 1EBF 1EBE +1EBF 1EBF 1EBE +1EC0 1EC1 1EC0 +1EC1 1EC1 1EC0 +1EC2 1EC3 1EC2 +1EC3 1EC3 1EC2 +1EC4 1EC5 1EC4 +1EC5 1EC5 1EC4 +1EC6 1EC7 1EC6 +1EC7 1EC7 1EC6 +1EC8 1EC9 1EC8 +1EC9 1EC9 1EC8 +1ECA 1ECB 1ECA +1ECB 1ECB 1ECA +1ECC 1ECD 1ECC +1ECD 1ECD 1ECC +1ECE 1ECF 1ECE +1ECF 1ECF 1ECE +1ED0 1ED1 1ED0 +1ED1 1ED1 1ED0 +1ED2 1ED3 1ED2 +1ED3 1ED3 1ED2 +1ED4 1ED5 1ED4 +1ED5 1ED5 1ED4 +1ED6 1ED7 1ED6 +1ED7 1ED7 1ED6 +1ED8 1ED9 1ED8 +1ED9 1ED9 1ED8 +1EDA 1EDB 1EDA +1EDB 1EDB 1EDA +1EDC 1EDD 1EDC +1EDD 1EDD 1EDC +1EDE 1EDF 1EDE +1EDF 1EDF 1EDE +1EE0 1EE1 1EE0 +1EE1 1EE1 1EE0 +1EE2 1EE3 1EE2 +1EE3 1EE3 1EE2 +1EE4 1EE5 1EE4 +1EE5 1EE5 1EE4 +1EE6 1EE7 1EE6 +1EE7 1EE7 1EE6 +1EE8 1EE9 1EE8 +1EE9 1EE9 1EE8 +1EEA 1EEB 1EEA +1EEB 1EEB 1EEA +1EEC 1EED 1EEC +1EED 1EED 1EEC +1EEE 1EEF 1EEE +1EEF 1EEF 1EEE +1EF0 1EF1 1EF0 +1EF1 1EF1 1EF0 +1EF2 1EF3 1EF2 +1EF3 1EF3 1EF2 +1EF4 1EF5 1EF4 +1EF5 1EF5 1EF4 +1EF6 1EF7 1EF6 +1EF7 1EF7 1EF6 +1EF8 1EF9 1EF8 +1EF9 1EF9 1EF8 +1F00 1F00 1F08 +1F01 1F01 1F09 +1F02 1F02 1F0A +1F03 1F03 1F0B +1F04 1F04 1F0C +1F05 1F05 1F0D +1F06 1F06 1F0E +1F07 1F07 1F0F +1F08 1F00 1F08 +1F09 1F01 1F09 +1F0A 1F02 1F0A +1F0B 1F03 1F0B +1F0C 1F04 1F0C +1F0D 1F05 1F0D +1F0E 1F06 1F0E +1F0F 1F07 1F0F +1F10 1F10 1F18 +1F11 1F11 1F19 +1F12 1F12 1F1A +1F13 1F13 1F1B +1F14 1F14 1F1C +1F15 1F15 1F1D +1F18 1F10 1F18 +1F19 1F11 1F19 +1F1A 1F12 1F1A +1F1B 1F13 1F1B +1F1C 1F14 1F1C +1F1D 1F15 1F1D +1F20 1F20 1F28 +1F21 1F21 1F29 +1F22 1F22 1F2A +1F23 1F23 1F2B +1F24 1F24 1F2C +1F25 1F25 1F2D +1F26 1F26 1F2E +1F27 1F27 1F2F +1F28 1F20 1F28 +1F29 1F21 1F29 +1F2A 1F22 1F2A +1F2B 1F23 1F2B +1F2C 1F24 1F2C +1F2D 1F25 1F2D +1F2E 1F26 1F2E +1F2F 1F27 1F2F +1F30 1F30 1F38 +1F31 1F31 1F39 +1F32 1F32 1F3A +1F33 1F33 1F3B +1F34 1F34 1F3C +1F35 1F35 1F3D +1F36 1F36 1F3E +1F37 1F37 1F3F +1F38 1F30 1F38 +1F39 1F31 1F39 +1F3A 1F32 1F3A +1F3B 1F33 1F3B +1F3C 1F34 1F3C +1F3D 1F35 1F3D +1F3E 1F36 1F3E +1F3F 1F37 1F3F +1F40 1F40 1F48 +1F41 1F41 1F49 +1F42 1F42 1F4A +1F43 1F43 1F4B +1F44 1F44 1F4C +1F45 1F45 1F4D +1F48 1F40 1F48 +1F49 1F41 1F49 +1F4A 1F42 1F4A +1F4B 1F43 1F4B +1F4C 1F44 1F4C +1F4D 1F45 1F4D +1F51 1F51 1F59 +1F53 1F53 1F5B +1F55 1F55 1F5D +1F57 1F57 1F5F +1F59 1F51 1F59 +1F5B 1F53 1F5B +1F5D 1F55 1F5D +1F5F 1F57 1F5F +1F60 1F60 1F68 +1F61 1F61 1F69 +1F62 1F62 1F6A +1F63 1F63 1F6B +1F64 1F64 1F6C +1F65 1F65 1F6D +1F66 1F66 1F6E +1F67 1F67 1F6F +1F68 1F60 1F68 +1F69 1F61 1F69 +1F6A 1F62 1F6A +1F6B 1F63 1F6B +1F6C 1F64 1F6C +1F6D 1F65 1F6D +1F6E 1F66 1F6E +1F6F 1F67 1F6F +1F70 1F70 1FBA +1F71 1F71 1FBB +1F72 1F72 1FC8 +1F73 1F73 1FC9 +1F74 1F74 1FCA +1F75 1F75 1FCB +1F76 1F76 1FDA +1F77 1F77 1FDB +1F78 1F78 1FF8 +1F79 1F79 1FF9 +1F7A 1F7A 1FEA +1F7B 1F7B 1FEB +1F7C 1F7C 1FFA +1F7D 1F7D 1FFB +1F80 1F80 1F88 +1F81 1F81 1F89 +1F82 1F82 1F8A +1F83 1F83 1F8B +1F84 1F84 1F8C +1F85 1F85 1F8D +1F86 1F86 1F8E +1F87 1F87 1F8F +1F88 1F80 1F88 +1F89 1F81 1F89 +1F8A 1F82 1F8A +1F8B 1F83 1F8B +1F8C 1F84 1F8C +1F8D 1F85 1F8D +1F8E 1F86 1F8E +1F8F 1F87 1F8F +1F90 1F90 1F98 +1F91 1F91 1F99 +1F92 1F92 1F9A +1F93 1F93 1F9B +1F94 1F94 1F9C +1F95 1F95 1F9D +1F96 1F96 1F9E +1F97 1F97 1F9F +1F98 1F90 1F98 +1F99 1F91 1F99 +1F9A 1F92 1F9A +1F9B 1F93 1F9B +1F9C 1F94 1F9C +1F9D 1F95 1F9D +1F9E 1F96 1F9E +1F9F 1F97 1F9F +1FA0 1FA0 1FA8 +1FA1 1FA1 1FA9 +1FA2 1FA2 1FAA +1FA3 1FA3 1FAB +1FA4 1FA4 1FAC +1FA5 1FA5 1FAD +1FA6 1FA6 1FAE +1FA7 1FA7 1FAF +1FA8 1FA0 1FA8 +1FA9 1FA1 1FA9 +1FAA 1FA2 1FAA +1FAB 1FA3 1FAB +1FAC 1FA4 1FAC +1FAD 1FA5 1FAD +1FAE 1FA6 1FAE +1FAF 1FA7 1FAF +1FB0 1FB0 1FB8 +1FB1 1FB1 1FB9 +1FB3 1FB3 1FBC +1FB8 1FB0 1FB8 +1FB9 1FB1 1FB9 +1FBA 1F70 1FBA +1FBB 1F71 1FBB +1FBC 1FB3 1FBC +1FBE 1FBE 0399 +1FC3 1FC3 1FCC +1FC8 1F72 1FC8 +1FC9 1F73 1FC9 +1FCA 1F74 1FCA +1FCB 1F75 1FCB +1FCC 1FC3 1FCC +1FD0 1FD0 1FD8 +1FD1 1FD1 1FD9 +1FD8 1FD0 1FD8 +1FD9 1FD1 1FD9 +1FDA 1F76 1FDA +1FDB 1F77 1FDB +1FE0 1FE0 1FE8 +1FE1 1FE1 1FE9 +1FE5 1FE5 1FEC +1FE8 1FE0 1FE8 +1FE9 1FE1 1FE9 +1FEA 1F7A 1FEA +1FEB 1F7B 1FEB +1FEC 1FE5 1FEC +1FF3 1FF3 1FFC +1FF8 1F78 1FF8 +1FF9 1F79 1FF9 +1FFA 1F7C 1FFA +1FFB 1F7D 1FFB +1FFC 1FF3 1FFC +2126 03C9 2126 +212A 006B 212A +212B 00E5 212B +2160 2170 2160 +2161 2171 2161 +2162 2172 2162 +2163 2173 2163 +2164 2174 2164 +2165 2175 2165 +2166 2176 2166 +2167 2177 2167 +2168 2178 2168 +2169 2179 2169 +216A 217A 216A +216B 217B 216B +216C 217C 216C +216D 217D 216D +216E 217E 216E +216F 217F 216F +2170 2170 2160 +2171 2171 2161 +2172 2172 2162 +2173 2173 2163 +2174 2174 2164 +2175 2175 2165 +2176 2176 2166 +2177 2177 2167 +2178 2178 2168 +2179 2179 2169 +217A 217A 216A +217B 217B 216B +217C 217C 216C +217D 217D 216D +217E 217E 216E +217F 217F 216F +24B6 24D0 24B6 +24B7 24D1 24B7 +24B8 24D2 24B8 +24B9 24D3 24B9 +24BA 24D4 24BA +24BB 24D5 24BB +24BC 24D6 24BC +24BD 24D7 24BD +24BE 24D8 24BE +24BF 24D9 24BF +24C0 24DA 24C0 +24C1 24DB 24C1 +24C2 24DC 24C2 +24C3 24DD 24C3 +24C4 24DE 24C4 +24C5 24DF 24C5 +24C6 24E0 24C6 +24C7 24E1 24C7 +24C8 24E2 24C8 +24C9 24E3 24C9 +24CA 24E4 24CA +24CB 24E5 24CB +24CC 24E6 24CC +24CD 24E7 24CD +24CE 24E8 24CE +24CF 24E9 24CF +24D0 24D0 24B6 +24D1 24D1 24B7 +24D2 24D2 24B8 +24D3 24D3 24B9 +24D4 24D4 24BA +24D5 24D5 24BB +24D6 24D6 24BC +24D7 24D7 24BD +24D8 24D8 24BE +24D9 24D9 24BF +24DA 24DA 24C0 +24DB 24DB 24C1 +24DC 24DC 24C2 +24DD 24DD 24C3 +24DE 24DE 24C4 +24DF 24DF 24C5 +24E0 24E0 24C6 +24E1 24E1 24C7 +24E2 24E2 24C8 +24E3 24E3 24C9 +24E4 24E4 24CA +24E5 24E5 24CB +24E6 24E6 24CC +24E7 24E7 24CD +24E8 24E8 24CE +24E9 24E9 24CF +FF21 FF41 FF21 +FF22 FF42 FF22 +FF23 FF43 FF23 +FF24 FF44 FF24 +FF25 FF45 FF25 +FF26 FF46 FF26 +FF27 FF47 FF27 +FF28 FF48 FF28 +FF29 FF49 FF29 +FF2A FF4A FF2A +FF2B FF4B FF2B +FF2C FF4C FF2C +FF2D FF4D FF2D +FF2E FF4E FF2E +FF2F FF4F FF2F +FF30 FF50 FF30 +FF31 FF51 FF31 +FF32 FF52 FF32 +FF33 FF53 FF33 +FF34 FF54 FF34 +FF35 FF55 FF35 +FF36 FF56 FF36 +FF37 FF57 FF37 +FF38 FF58 FF38 +FF39 FF59 FF39 +FF3A FF5A FF3A +FF41 FF41 FF21 +FF42 FF42 FF22 +FF43 FF43 FF23 +FF44 FF44 FF24 +FF45 FF45 FF25 +FF46 FF46 FF26 +FF47 FF47 FF27 +FF48 FF48 FF28 +FF49 FF49 FF29 +FF4A FF4A FF2A +FF4B FF4B FF2B +FF4C FF4C FF2C +FF4D FF4D FF2D +FF4E FF4E FF2E +FF4F FF4F FF2F +FF50 FF50 FF30 +FF51 FF51 FF31 +FF52 FF52 FF32 +FF53 FF53 FF33 +FF54 FF54 FF34 +FF55 FF55 FF35 +FF56 FF56 FF36 +FF57 FF57 FF37 +FF58 FF58 FF38 +FF59 FF59 FF39 +FF5A FF5A FF3A +DROP VIEW v_bmp; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_utf8mb3_general_mysql500_ci_casefold.test b/mysql-test/main/ctype_utf8mb3_general_mysql500_ci_casefold.test new file mode 100644 index 0000000000000..610c0fc742808 --- /dev/null +++ b/mysql-test/main/ctype_utf8mb3_general_mysql500_ci_casefold.test @@ -0,0 +1,15 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET NAMES utf8mb3 COLLATE utf8mb3_general_mysql500_ci; +--source include/ctype_unicode_casefold_bmp.inc + + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/ctype_utf8mb3_general_mysql500_ci_ws.result b/mysql-test/main/ctype_utf8mb3_general_mysql500_ci_ws.result new file mode 100644 index 0000000000000..23076822e8f91 --- /dev/null +++ b/mysql-test/main/ctype_utf8mb3_general_mysql500_ci_ws.result @@ -0,0 +1,1142 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET NAMES utf8mb3 COLLATE utf8mb3_general_mysql500_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +utf8mb3_general_mysql500_ci +SELECT HEX(codepoint) FROM v_bmp WHERE HEX(WEIGHT_STRING(c))='FFFD'; +HEX(codepoint) +FFFD +SELECT +SUM(codepoint_hex4=HEX(WEIGHT_STRING(c))) AS count_bmp_weight_is_codepoint, +SUM(codepoint_hex4<>HEX(WEIGHT_STRING(c))) AS count_bmp_weight_is_not_codepoint +FROM v_bmp; +count_bmp_weight_is_codepoint count_bmp_weight_is_not_codepoint +64429 1107 +SELECT codepoint_hex4,HEX(WEIGHT_STRING(c)) +FROM v_bmp +WHERE codepoint_hex4<>HEX(WEIGHT_STRING(c)); +codepoint_hex4 HEX(WEIGHT_STRING(c)) +0061 0041 +0062 0042 +0063 0043 +0064 0044 +0065 0045 +0066 0046 +0067 0047 +0068 0048 +0069 0049 +006A 004A +006B 004B +006C 004C +006D 004D +006E 004E +006F 004F +0070 0050 +0071 0051 +0072 0052 +0073 0053 +0074 0054 +0075 0055 +0076 0056 +0077 0057 +0078 0058 +0079 0059 +007A 005A +00B5 039C +00C0 0041 +00C1 0041 +00C2 0041 +00C3 0041 +00C4 0041 +00C5 0041 +00C7 0043 +00C8 0045 +00C9 0045 +00CA 0045 +00CB 0045 +00CC 0049 +00CD 0049 +00CE 0049 +00CF 0049 +00D1 004E +00D2 004F +00D3 004F +00D4 004F +00D5 004F +00D6 004F +00D9 0055 +00DA 0055 +00DB 0055 +00DC 0055 +00DD 0059 +00E0 0041 +00E1 0041 +00E2 0041 +00E3 0041 +00E4 0041 +00E5 0041 +00E6 00C6 +00E7 0043 +00E8 0045 +00E9 0045 +00EA 0045 +00EB 0045 +00EC 0049 +00ED 0049 +00EE 0049 +00EF 0049 +00F0 00D0 +00F1 004E +00F2 004F +00F3 004F +00F4 004F +00F5 004F +00F6 004F +00F8 00D8 +00F9 0055 +00FA 0055 +00FB 0055 +00FC 0055 +00FD 0059 +00FE 00DE +00FF 0059 +0100 0041 +0101 0041 +0102 0041 +0103 0041 +0104 0041 +0105 0041 +0106 0043 +0107 0043 +0108 0043 +0109 0043 +010A 0043 +010B 0043 +010C 0043 +010D 0043 +010E 0044 +010F 0044 +0111 0110 +0112 0045 +0113 0045 +0114 0045 +0115 0045 +0116 0045 +0117 0045 +0118 0045 +0119 0045 +011A 0045 +011B 0045 +011C 0047 +011D 0047 +011E 0047 +011F 0047 +0120 0047 +0121 0047 +0122 0047 +0123 0047 +0124 0048 +0125 0048 +0127 0126 +0128 0049 +0129 0049 +012A 0049 +012B 0049 +012C 0049 +012D 0049 +012E 0049 +012F 0049 +0130 0049 +0131 0049 +0133 0132 +0134 004A +0135 004A +0136 004B +0137 004B +0139 004C +013A 004C +013B 004C +013C 004C +013D 004C +013E 004C +0140 013F +0142 0141 +0143 004E +0144 004E +0145 004E +0146 004E +0147 004E +0148 004E +014B 014A +014C 004F +014D 004F +014E 004F +014F 004F +0150 004F +0151 004F +0153 0152 +0154 0052 +0155 0052 +0156 0052 +0157 0052 +0158 0052 +0159 0052 +015A 0053 +015B 0053 +015C 0053 +015D 0053 +015E 0053 +015F 0053 +0160 0053 +0161 0053 +0162 0054 +0163 0054 +0164 0054 +0165 0054 +0167 0166 +0168 0055 +0169 0055 +016A 0055 +016B 0055 +016C 0055 +016D 0055 +016E 0055 +016F 0055 +0170 0055 +0171 0055 +0172 0055 +0173 0055 +0174 0057 +0175 0057 +0176 0059 +0177 0059 +0178 0059 +0179 005A +017A 005A +017B 005A +017C 005A +017D 005A +017E 005A +017F 0053 +0183 0182 +0185 0184 +0188 0187 +018C 018B +0192 0191 +0195 01F6 +0199 0198 +01A0 004F +01A1 004F +01A3 01A2 +01A5 01A4 +01A8 01A7 +01AD 01AC +01AF 0055 +01B0 0055 +01B4 01B3 +01B6 01B5 +01B9 01B8 +01BD 01BC +01BF 01F7 +01C5 01C4 +01C6 01C4 +01C8 01C7 +01C9 01C7 +01CB 01CA +01CC 01CA +01CD 0041 +01CE 0041 +01CF 0049 +01D0 0049 +01D1 004F +01D2 004F +01D3 0055 +01D4 0055 +01D5 0055 +01D6 0055 +01D7 0055 +01D8 0055 +01D9 0055 +01DA 0055 +01DB 0055 +01DC 0055 +01DD 018E +01DE 0041 +01DF 0041 +01E0 0041 +01E1 0041 +01E2 00C6 +01E3 00C6 +01E5 01E4 +01E6 0047 +01E7 0047 +01E8 004B +01E9 004B +01EA 004F +01EB 004F +01EC 004F +01ED 004F +01EE 01B7 +01EF 01B7 +01F0 004A +01F2 01F1 +01F3 01F1 +01F4 0047 +01F5 0047 +01F8 004E +01F9 004E +01FA 0041 +01FB 0041 +01FC 00C6 +01FD 00C6 +01FE 00D8 +01FF 00D8 +0200 0041 +0201 0041 +0202 0041 +0203 0041 +0204 0045 +0205 0045 +0206 0045 +0207 0045 +0208 0049 +0209 0049 +020A 0049 +020B 0049 +020C 004F +020D 004F +020E 004F +020F 004F +0210 0052 +0211 0052 +0212 0052 +0213 0052 +0214 0055 +0215 0055 +0216 0055 +0217 0055 +0218 0053 +0219 0053 +021A 0054 +021B 0054 +021D 021C +021E 0048 +021F 0048 +0223 0222 +0225 0224 +0226 0041 +0227 0041 +0228 0045 +0229 0045 +022A 004F +022B 004F +022C 004F +022D 004F +022E 004F +022F 004F +0230 004F +0231 004F +0232 0059 +0233 0059 +0253 0181 +0254 0186 +0256 0189 +0257 018A +0259 018F +025B 0190 +0260 0193 +0263 0194 +0268 0197 +0269 0196 +026F 019C +0272 019D +0275 019F +0280 01A6 +0283 01A9 +0288 01AE +028A 01B1 +028B 01B2 +0292 01B7 +0345 0399 +0386 0391 +0388 0395 +0389 0397 +038A 0399 +038C 039F +038E 03A5 +038F 03A9 +0390 0399 +03AA 0399 +03AB 03A5 +03AC 0391 +03AD 0395 +03AE 0397 +03AF 0399 +03B0 03A5 +03B1 0391 +03B2 0392 +03B3 0393 +03B4 0394 +03B5 0395 +03B6 0396 +03B7 0397 +03B8 0398 +03B9 0399 +03BA 039A +03BB 039B +03BC 039C +03BD 039D +03BE 039E +03BF 039F +03C0 03A0 +03C1 03A1 +03C2 03A3 +03C3 03A3 +03C4 03A4 +03C5 03A5 +03C6 03A6 +03C7 03A7 +03C8 03A8 +03C9 03A9 +03CA 0399 +03CB 03A5 +03CC 039F +03CD 03A5 +03CE 03A9 +03D0 0392 +03D1 0398 +03D3 03D2 +03D4 03D2 +03D5 03A6 +03D6 03A0 +03DB 03DA +03DD 03DC +03DF 03DE +03E1 03E0 +03E3 03E2 +03E5 03E4 +03E7 03E6 +03E9 03E8 +03EB 03EA +03ED 03EC +03EF 03EE +03F0 039A +03F1 03A1 +03F2 03A3 +0400 0415 +0401 0415 +0403 0413 +0407 0406 +040C 041A +040D 0418 +040E 0423 +0430 0410 +0431 0411 +0432 0412 +0433 0413 +0434 0414 +0435 0415 +0436 0416 +0437 0417 +0438 0418 +0439 0419 +043A 041A +043B 041B +043C 041C +043D 041D +043E 041E +043F 041F +0440 0420 +0441 0421 +0442 0422 +0443 0423 +0444 0424 +0445 0425 +0446 0426 +0447 0427 +0448 0428 +0449 0429 +044A 042A +044B 042B +044C 042C +044D 042D +044E 042E +044F 042F +0450 0415 +0451 0415 +0452 0402 +0453 0413 +0454 0404 +0455 0405 +0456 0406 +0457 0406 +0458 0408 +0459 0409 +045A 040A +045B 040B +045C 041A +045D 0418 +045E 0423 +045F 040F +0461 0460 +0463 0462 +0465 0464 +0467 0466 +0469 0468 +046B 046A +046D 046C +046F 046E +0471 0470 +0473 0472 +0475 0474 +0476 0474 +0477 0474 +0479 0478 +047B 047A +047D 047C +047F 047E +0481 0480 +048D 048C +048F 048E +0491 0490 +0493 0492 +0495 0494 +0497 0496 +0499 0498 +049B 049A +049D 049C +049F 049E +04A1 04A0 +04A3 04A2 +04A5 04A4 +04A7 04A6 +04A9 04A8 +04AB 04AA +04AD 04AC +04AF 04AE +04B1 04B0 +04B3 04B2 +04B5 04B4 +04B7 04B6 +04B9 04B8 +04BB 04BA +04BD 04BC +04BF 04BE +04C1 0416 +04C2 0416 +04C4 04C3 +04C8 04C7 +04CC 04CB +04D0 0410 +04D1 0410 +04D2 0410 +04D3 0410 +04D5 04D4 +04D6 0415 +04D7 0415 +04D9 04D8 +04DA 04D8 +04DB 04D8 +04DC 0416 +04DD 0416 +04DE 0417 +04DF 0417 +04E1 04E0 +04E2 0418 +04E3 0418 +04E4 0418 +04E5 0418 +04E6 041E +04E7 041E +04E9 04E8 +04EA 04E8 +04EB 04E8 +04EC 042D +04ED 042D +04EE 0423 +04EF 0423 +04F0 0423 +04F1 0423 +04F2 0423 +04F3 0423 +04F4 0427 +04F5 0427 +04F8 042B +04F9 042B +0561 0531 +0562 0532 +0563 0533 +0564 0534 +0565 0535 +0566 0536 +0567 0537 +0568 0538 +0569 0539 +056A 053A +056B 053B +056C 053C +056D 053D +056E 053E +056F 053F +0570 0540 +0571 0541 +0572 0542 +0573 0543 +0574 0544 +0575 0545 +0576 0546 +0577 0547 +0578 0548 +0579 0549 +057A 054A +057B 054B +057C 054C +057D 054D +057E 054E +057F 054F +0580 0550 +0581 0551 +0582 0552 +0583 0553 +0584 0554 +0585 0555 +0586 0556 +1E00 0041 +1E01 0041 +1E02 0042 +1E03 0042 +1E04 0042 +1E05 0042 +1E06 0042 +1E07 0042 +1E08 0043 +1E09 0043 +1E0A 0044 +1E0B 0044 +1E0C 0044 +1E0D 0044 +1E0E 0044 +1E0F 0044 +1E10 0044 +1E11 0044 +1E12 0044 +1E13 0044 +1E14 0045 +1E15 0045 +1E16 0045 +1E17 0045 +1E18 0045 +1E19 0045 +1E1A 0045 +1E1B 0045 +1E1C 0045 +1E1D 0045 +1E1E 0046 +1E1F 0046 +1E20 0047 +1E21 0047 +1E22 0048 +1E23 0048 +1E24 0048 +1E25 0048 +1E26 0048 +1E27 0048 +1E28 0048 +1E29 0048 +1E2A 0048 +1E2B 0048 +1E2C 0049 +1E2D 0049 +1E2E 0049 +1E2F 0049 +1E30 004B +1E31 004B +1E32 004B +1E33 004B +1E34 004B +1E35 004B +1E36 004C +1E37 004C +1E38 004C +1E39 004C +1E3A 004C +1E3B 004C +1E3C 004C +1E3D 004C +1E3E 004D +1E3F 004D +1E40 004D +1E41 004D +1E42 004D +1E43 004D +1E44 004E +1E45 004E +1E46 004E +1E47 004E +1E48 004E +1E49 004E +1E4A 004E +1E4B 004E +1E4C 004F +1E4D 004F +1E4E 004F +1E4F 004F +1E50 004F +1E51 004F +1E52 004F +1E53 004F +1E54 0050 +1E55 0050 +1E56 0050 +1E57 0050 +1E58 0052 +1E59 0052 +1E5A 0052 +1E5B 0052 +1E5C 0052 +1E5D 0052 +1E5E 0052 +1E5F 0052 +1E60 0053 +1E61 0053 +1E62 0053 +1E63 0053 +1E64 0053 +1E65 0053 +1E66 0053 +1E67 0053 +1E68 0053 +1E69 0053 +1E6A 0054 +1E6B 0054 +1E6C 0054 +1E6D 0054 +1E6E 0054 +1E6F 0054 +1E70 0054 +1E71 0054 +1E72 0055 +1E73 0055 +1E74 0055 +1E75 0055 +1E76 0055 +1E77 0055 +1E78 0055 +1E79 0055 +1E7A 0055 +1E7B 0055 +1E7C 0056 +1E7D 0056 +1E7E 0056 +1E7F 0056 +1E80 0057 +1E81 0057 +1E82 0057 +1E83 0057 +1E84 0057 +1E85 0057 +1E86 0057 +1E87 0057 +1E88 0057 +1E89 0057 +1E8A 0058 +1E8B 0058 +1E8C 0058 +1E8D 0058 +1E8E 0059 +1E8F 0059 +1E90 005A +1E91 005A +1E92 005A +1E93 005A +1E94 005A +1E95 005A +1E96 0048 +1E97 0054 +1E98 0057 +1E99 0059 +1E9B 0053 +1EA0 0041 +1EA1 0041 +1EA2 0041 +1EA3 0041 +1EA4 0041 +1EA5 0041 +1EA6 0041 +1EA7 0041 +1EA8 0041 +1EA9 0041 +1EAA 0041 +1EAB 0041 +1EAC 0041 +1EAD 0041 +1EAE 0041 +1EAF 0041 +1EB0 0041 +1EB1 0041 +1EB2 0041 +1EB3 0041 +1EB4 0041 +1EB5 0041 +1EB6 0041 +1EB7 0041 +1EB8 0045 +1EB9 0045 +1EBA 0045 +1EBB 0045 +1EBC 0045 +1EBD 0045 +1EBE 0045 +1EBF 0045 +1EC0 0045 +1EC1 0045 +1EC2 0045 +1EC3 0045 +1EC4 0045 +1EC5 0045 +1EC6 0045 +1EC7 0045 +1EC8 0049 +1EC9 0049 +1ECA 0049 +1ECB 0049 +1ECC 004F +1ECD 004F +1ECE 004F +1ECF 004F +1ED0 004F +1ED1 004F +1ED2 004F +1ED3 004F +1ED4 004F +1ED5 004F +1ED6 004F +1ED7 004F +1ED8 004F +1ED9 004F +1EDA 004F +1EDB 004F +1EDC 004F +1EDD 004F +1EDE 004F +1EDF 004F +1EE0 004F +1EE1 004F +1EE2 004F +1EE3 004F +1EE4 0055 +1EE5 0055 +1EE6 0055 +1EE7 0055 +1EE8 0055 +1EE9 0055 +1EEA 0055 +1EEB 0055 +1EEC 0055 +1EED 0055 +1EEE 0055 +1EEF 0055 +1EF0 0055 +1EF1 0055 +1EF2 0059 +1EF3 0059 +1EF4 0059 +1EF5 0059 +1EF6 0059 +1EF7 0059 +1EF8 0059 +1EF9 0059 +1F00 0391 +1F01 0391 +1F02 0391 +1F03 0391 +1F04 0391 +1F05 0391 +1F06 0391 +1F07 0391 +1F08 0391 +1F09 0391 +1F0A 0391 +1F0B 0391 +1F0C 0391 +1F0D 0391 +1F0E 0391 +1F0F 0391 +1F10 0395 +1F11 0395 +1F12 0395 +1F13 0395 +1F14 0395 +1F15 0395 +1F18 0395 +1F19 0395 +1F1A 0395 +1F1B 0395 +1F1C 0395 +1F1D 0395 +1F20 0397 +1F21 0397 +1F22 0397 +1F23 0397 +1F24 0397 +1F25 0397 +1F26 0397 +1F27 0397 +1F28 0397 +1F29 0397 +1F2A 0397 +1F2B 0397 +1F2C 0397 +1F2D 0397 +1F2E 0397 +1F2F 0397 +1F30 0399 +1F31 0399 +1F32 0399 +1F33 0399 +1F34 0399 +1F35 0399 +1F36 0399 +1F37 0399 +1F38 0399 +1F39 0399 +1F3A 0399 +1F3B 0399 +1F3C 0399 +1F3D 0399 +1F3E 0399 +1F3F 0399 +1F40 039F +1F41 039F +1F42 039F +1F43 039F +1F44 039F +1F45 039F +1F48 039F +1F49 039F +1F4A 039F +1F4B 039F +1F4C 039F +1F4D 039F +1F50 03A5 +1F51 03A5 +1F52 03A5 +1F53 03A5 +1F54 03A5 +1F55 03A5 +1F56 03A5 +1F57 03A5 +1F59 03A5 +1F5B 03A5 +1F5D 03A5 +1F5F 03A5 +1F60 03A9 +1F61 03A9 +1F62 03A9 +1F63 03A9 +1F64 03A9 +1F65 03A9 +1F66 03A9 +1F67 03A9 +1F68 03A9 +1F69 03A9 +1F6A 03A9 +1F6B 03A9 +1F6C 03A9 +1F6D 03A9 +1F6E 03A9 +1F6F 03A9 +1F70 0391 +1F71 1FBB +1F72 0395 +1F73 1FC9 +1F74 0397 +1F75 1FCB +1F76 0399 +1F77 1FDB +1F78 039F +1F79 1FF9 +1F7A 03A5 +1F7B 1FEB +1F7C 03A9 +1F7D 1FFB +1F80 0391 +1F81 0391 +1F82 0391 +1F83 0391 +1F84 0391 +1F85 0391 +1F86 0391 +1F87 0391 +1F88 0391 +1F89 0391 +1F8A 0391 +1F8B 0391 +1F8C 0391 +1F8D 0391 +1F8E 0391 +1F8F 0391 +1F90 0397 +1F91 0397 +1F92 0397 +1F93 0397 +1F94 0397 +1F95 0397 +1F96 0397 +1F97 0397 +1F98 0397 +1F99 0397 +1F9A 0397 +1F9B 0397 +1F9C 0397 +1F9D 0397 +1F9E 0397 +1F9F 0397 +1FA0 03A9 +1FA1 03A9 +1FA2 03A9 +1FA3 03A9 +1FA4 03A9 +1FA5 03A9 +1FA6 03A9 +1FA7 03A9 +1FA8 03A9 +1FA9 03A9 +1FAA 03A9 +1FAB 03A9 +1FAC 03A9 +1FAD 03A9 +1FAE 03A9 +1FAF 03A9 +1FB0 0391 +1FB1 0391 +1FB2 0391 +1FB3 0391 +1FB4 0391 +1FB6 0391 +1FB7 0391 +1FB8 0391 +1FB9 0391 +1FBA 0391 +1FBC 0391 +1FBE 0399 +1FC2 0397 +1FC3 0397 +1FC4 0397 +1FC6 0397 +1FC7 0397 +1FC8 0395 +1FCA 0397 +1FCC 0397 +1FD0 0399 +1FD1 0399 +1FD2 0399 +1FD6 0399 +1FD7 0399 +1FD8 0399 +1FD9 0399 +1FDA 0399 +1FE0 03A5 +1FE1 03A5 +1FE2 03A5 +1FE4 03A1 +1FE5 03A1 +1FE6 03A5 +1FE7 03A5 +1FE8 03A5 +1FE9 03A5 +1FEA 03A5 +1FEC 03A1 +1FF2 03A9 +1FF3 03A9 +1FF4 03A9 +1FF6 03A9 +1FF7 03A9 +1FF8 039F +1FFA 03A9 +1FFC 03A9 +2170 2160 +2171 2161 +2172 2162 +2173 2163 +2174 2164 +2175 2165 +2176 2166 +2177 2167 +2178 2168 +2179 2169 +217A 216A +217B 216B +217C 216C +217D 216D +217E 216E +217F 216F +24D0 24B6 +24D1 24B7 +24D2 24B8 +24D3 24B9 +24D4 24BA +24D5 24BB +24D6 24BC +24D7 24BD +24D8 24BE +24D9 24BF +24DA 24C0 +24DB 24C1 +24DC 24C2 +24DD 24C3 +24DE 24C4 +24DF 24C5 +24E0 24C6 +24E1 24C7 +24E2 24C8 +24E3 24C9 +24E4 24CA +24E5 24CB +24E6 24CC +24E7 24CD +24E8 24CE +24E9 24CF +FF41 FF21 +FF42 FF22 +FF43 FF23 +FF44 FF24 +FF45 FF25 +FF46 FF26 +FF47 FF27 +FF48 FF28 +FF49 FF29 +FF4A FF2A +FF4B FF2B +FF4C FF2C +FF4D FF2D +FF4E FF2E +FF4F FF2F +FF50 FF30 +FF51 FF31 +FF52 FF32 +FF53 FF33 +FF54 FF34 +FF55 FF35 +FF56 FF36 +FF57 FF37 +FF58 FF38 +FF59 FF39 +FF5A FF3A +DROP VIEW v_bmp; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_utf8mb3_general_mysql500_ci_ws.test b/mysql-test/main/ctype_utf8mb3_general_mysql500_ci_ws.test new file mode 100644 index 0000000000000..6b1ac7265e100 --- /dev/null +++ b/mysql-test/main/ctype_utf8mb3_general_mysql500_ci_ws.test @@ -0,0 +1,15 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET NAMES utf8mb3 COLLATE utf8mb3_general_mysql500_ci; +--source include/ctype_unicode_ws_bmp.inc + + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/ctype_utf8mb3_turkish_ci_casefold.result b/mysql-test/main/ctype_utf8mb3_turkish_ci_casefold.result new file mode 100644 index 0000000000000..4fa0bd75b8b7c --- /dev/null +++ b/mysql-test/main/ctype_utf8mb3_turkish_ci_casefold.result @@ -0,0 +1,1427 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET NAMES utf8mb3 COLLATE utf8mb3_turkish_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +utf8mb3_turkish_ci +SELECT +codepoint_hex4, +HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)), +HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +FROM v_bmp +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); +codepoint_hex4 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +0041 0061 0041 +0042 0062 0042 +0043 0063 0043 +0044 0064 0044 +0045 0065 0045 +0046 0066 0046 +0047 0067 0047 +0048 0068 0048 +0049 0131 0049 +004A 006A 004A +004B 006B 004B +004C 006C 004C +004D 006D 004D +004E 006E 004E +004F 006F 004F +0050 0070 0050 +0051 0071 0051 +0052 0072 0052 +0053 0073 0053 +0054 0074 0054 +0055 0075 0055 +0056 0076 0056 +0057 0077 0057 +0058 0078 0058 +0059 0079 0059 +005A 007A 005A +0061 0061 0041 +0062 0062 0042 +0063 0063 0043 +0064 0064 0044 +0065 0065 0045 +0066 0066 0046 +0067 0067 0047 +0068 0068 0048 +0069 0069 0130 +006A 006A 004A +006B 006B 004B +006C 006C 004C +006D 006D 004D +006E 006E 004E +006F 006F 004F +0070 0070 0050 +0071 0071 0051 +0072 0072 0052 +0073 0073 0053 +0074 0074 0054 +0075 0075 0055 +0076 0076 0056 +0077 0077 0057 +0078 0078 0058 +0079 0079 0059 +007A 007A 005A +00B5 00B5 039C +00C0 00E0 00C0 +00C1 00E1 00C1 +00C2 00E2 00C2 +00C3 00E3 00C3 +00C4 00E4 00C4 +00C5 00E5 00C5 +00C6 00E6 00C6 +00C7 00E7 00C7 +00C8 00E8 00C8 +00C9 00E9 00C9 +00CA 00EA 00CA +00CB 00EB 00CB +00CC 00EC 00CC +00CD 00ED 00CD +00CE 00EE 00CE +00CF 00EF 00CF +00D0 00F0 00D0 +00D1 00F1 00D1 +00D2 00F2 00D2 +00D3 00F3 00D3 +00D4 00F4 00D4 +00D5 00F5 00D5 +00D6 00F6 00D6 +00D8 00F8 00D8 +00D9 00F9 00D9 +00DA 00FA 00DA +00DB 00FB 00DB +00DC 00FC 00DC +00DD 00FD 00DD +00DE 00FE 00DE +00E0 00E0 00C0 +00E1 00E1 00C1 +00E2 00E2 00C2 +00E3 00E3 00C3 +00E4 00E4 00C4 +00E5 00E5 00C5 +00E6 00E6 00C6 +00E7 00E7 00C7 +00E8 00E8 00C8 +00E9 00E9 00C9 +00EA 00EA 00CA +00EB 00EB 00CB +00EC 00EC 00CC +00ED 00ED 00CD +00EE 00EE 00CE +00EF 00EF 00CF +00F0 00F0 00D0 +00F1 00F1 00D1 +00F2 00F2 00D2 +00F3 00F3 00D3 +00F4 00F4 00D4 +00F5 00F5 00D5 +00F6 00F6 00D6 +00F8 00F8 00D8 +00F9 00F9 00D9 +00FA 00FA 00DA +00FB 00FB 00DB +00FC 00FC 00DC +00FD 00FD 00DD +00FE 00FE 00DE +00FF 00FF 0178 +0100 0101 0100 +0101 0101 0100 +0102 0103 0102 +0103 0103 0102 +0104 0105 0104 +0105 0105 0104 +0106 0107 0106 +0107 0107 0106 +0108 0109 0108 +0109 0109 0108 +010A 010B 010A +010B 010B 010A +010C 010D 010C +010D 010D 010C +010E 010F 010E +010F 010F 010E +0110 0111 0110 +0111 0111 0110 +0112 0113 0112 +0113 0113 0112 +0114 0115 0114 +0115 0115 0114 +0116 0117 0116 +0117 0117 0116 +0118 0119 0118 +0119 0119 0118 +011A 011B 011A +011B 011B 011A +011C 011D 011C +011D 011D 011C +011E 011F 011E +011F 011F 011E +0120 0121 0120 +0121 0121 0120 +0122 0123 0122 +0123 0123 0122 +0124 0125 0124 +0125 0125 0124 +0126 0127 0126 +0127 0127 0126 +0128 0129 0128 +0129 0129 0128 +012A 012B 012A +012B 012B 012A +012C 012D 012C +012D 012D 012C +012E 012F 012E +012F 012F 012E +0130 0069 0130 +0131 0131 0049 +0132 0133 0132 +0133 0133 0132 +0134 0135 0134 +0135 0135 0134 +0136 0137 0136 +0137 0137 0136 +0139 013A 0139 +013A 013A 0139 +013B 013C 013B +013C 013C 013B +013D 013E 013D +013E 013E 013D +013F 0140 013F +0140 0140 013F +0141 0142 0141 +0142 0142 0141 +0143 0144 0143 +0144 0144 0143 +0145 0146 0145 +0146 0146 0145 +0147 0148 0147 +0148 0148 0147 +014A 014B 014A +014B 014B 014A +014C 014D 014C +014D 014D 014C +014E 014F 014E +014F 014F 014E +0150 0151 0150 +0151 0151 0150 +0152 0153 0152 +0153 0153 0152 +0154 0155 0154 +0155 0155 0154 +0156 0157 0156 +0157 0157 0156 +0158 0159 0158 +0159 0159 0158 +015A 015B 015A +015B 015B 015A +015C 015D 015C +015D 015D 015C +015E 015F 015E +015F 015F 015E +0160 0161 0160 +0161 0161 0160 +0162 0163 0162 +0163 0163 0162 +0164 0165 0164 +0165 0165 0164 +0166 0167 0166 +0167 0167 0166 +0168 0169 0168 +0169 0169 0168 +016A 016B 016A +016B 016B 016A +016C 016D 016C +016D 016D 016C +016E 016F 016E +016F 016F 016E +0170 0171 0170 +0171 0171 0170 +0172 0173 0172 +0173 0173 0172 +0174 0175 0174 +0175 0175 0174 +0176 0177 0176 +0177 0177 0176 +0178 00FF 0178 +0179 017A 0179 +017A 017A 0179 +017B 017C 017B +017C 017C 017B +017D 017E 017D +017E 017E 017D +017F 017F 0053 +0181 0253 0181 +0182 0183 0182 +0183 0183 0182 +0184 0185 0184 +0185 0185 0184 +0186 0254 0186 +0187 0188 0187 +0188 0188 0187 +0189 0256 0189 +018A 0257 018A +018B 018C 018B +018C 018C 018B +018E 01DD 018E +018F 0259 018F +0190 025B 0190 +0191 0192 0191 +0192 0192 0191 +0193 0260 0193 +0194 0263 0194 +0195 0195 01F6 +0196 0269 0196 +0197 0268 0197 +0198 0199 0198 +0199 0199 0198 +019C 026F 019C +019D 0272 019D +019F 0275 019F +01A0 01A1 01A0 +01A1 01A1 01A0 +01A2 01A3 01A2 +01A3 01A3 01A2 +01A4 01A5 01A4 +01A5 01A5 01A4 +01A6 0280 01A6 +01A7 01A8 01A7 +01A8 01A8 01A7 +01A9 0283 01A9 +01AC 01AD 01AC +01AD 01AD 01AC +01AE 0288 01AE +01AF 01B0 01AF +01B0 01B0 01AF +01B1 028A 01B1 +01B2 028B 01B2 +01B3 01B4 01B3 +01B4 01B4 01B3 +01B5 01B6 01B5 +01B6 01B6 01B5 +01B7 0292 01B7 +01B8 01B9 01B8 +01B9 01B9 01B8 +01BC 01BD 01BC +01BD 01BD 01BC +01BF 01BF 01F7 +01C4 01C6 01C4 +01C5 01C6 01C4 +01C6 01C6 01C4 +01C7 01C9 01C7 +01C8 01C9 01C7 +01C9 01C9 01C7 +01CA 01CC 01CA +01CB 01CC 01CA +01CC 01CC 01CA +01CD 01CE 01CD +01CE 01CE 01CD +01CF 01D0 01CF +01D0 01D0 01CF +01D1 01D2 01D1 +01D2 01D2 01D1 +01D3 01D4 01D3 +01D4 01D4 01D3 +01D5 01D6 01D5 +01D6 01D6 01D5 +01D7 01D8 01D7 +01D8 01D8 01D7 +01D9 01DA 01D9 +01DA 01DA 01D9 +01DB 01DC 01DB +01DC 01DC 01DB +01DD 01DD 018E +01DE 01DF 01DE +01DF 01DF 01DE +01E0 01E1 01E0 +01E1 01E1 01E0 +01E2 01E3 01E2 +01E3 01E3 01E2 +01E4 01E5 01E4 +01E5 01E5 01E4 +01E6 01E7 01E6 +01E7 01E7 01E6 +01E8 01E9 01E8 +01E9 01E9 01E8 +01EA 01EB 01EA +01EB 01EB 01EA +01EC 01ED 01EC +01ED 01ED 01EC +01EE 01EF 01EE +01EF 01EF 01EE +01F1 01F3 01F1 +01F2 01F3 01F1 +01F3 01F3 01F1 +01F4 01F5 01F4 +01F5 01F5 01F4 +01F6 0195 01F6 +01F7 01BF 01F7 +01F8 01F9 01F8 +01F9 01F9 01F8 +01FA 01FB 01FA +01FB 01FB 01FA +01FC 01FD 01FC +01FD 01FD 01FC +01FE 01FF 01FE +01FF 01FF 01FE +0200 0201 0200 +0201 0201 0200 +0202 0203 0202 +0203 0203 0202 +0204 0205 0204 +0205 0205 0204 +0206 0207 0206 +0207 0207 0206 +0208 0209 0208 +0209 0209 0208 +020A 020B 020A +020B 020B 020A +020C 020D 020C +020D 020D 020C +020E 020F 020E +020F 020F 020E +0210 0211 0210 +0211 0211 0210 +0212 0213 0212 +0213 0213 0212 +0214 0215 0214 +0215 0215 0214 +0216 0217 0216 +0217 0217 0216 +0218 0219 0218 +0219 0219 0218 +021A 021B 021A +021B 021B 021A +021C 021D 021C +021D 021D 021C +021E 021F 021E +021F 021F 021E +0222 0223 0222 +0223 0223 0222 +0224 0225 0224 +0225 0225 0224 +0226 0227 0226 +0227 0227 0226 +0228 0229 0228 +0229 0229 0228 +022A 022B 022A +022B 022B 022A +022C 022D 022C +022D 022D 022C +022E 022F 022E +022F 022F 022E +0230 0231 0230 +0231 0231 0230 +0232 0233 0232 +0233 0233 0232 +0253 0253 0181 +0254 0254 0186 +0256 0256 0189 +0257 0257 018A +0259 0259 018F +025B 025B 0190 +0260 0260 0193 +0263 0263 0194 +0268 0268 0197 +0269 0269 0196 +026F 026F 019C +0272 0272 019D +0275 0275 019F +0280 0280 01A6 +0283 0283 01A9 +0288 0288 01AE +028A 028A 01B1 +028B 028B 01B2 +0292 0292 01B7 +0345 0345 0399 +0386 03AC 0386 +0388 03AD 0388 +0389 03AE 0389 +038A 03AF 038A +038C 03CC 038C +038E 03CD 038E +038F 03CE 038F +0391 03B1 0391 +0392 03B2 0392 +0393 03B3 0393 +0394 03B4 0394 +0395 03B5 0395 +0396 03B6 0396 +0397 03B7 0397 +0398 03B8 0398 +0399 03B9 0399 +039A 03BA 039A +039B 03BB 039B +039C 03BC 039C +039D 03BD 039D +039E 03BE 039E +039F 03BF 039F +03A0 03C0 03A0 +03A1 03C1 03A1 +03A3 03C3 03A3 +03A4 03C4 03A4 +03A5 03C5 03A5 +03A6 03C6 03A6 +03A7 03C7 03A7 +03A8 03C8 03A8 +03A9 03C9 03A9 +03AA 03CA 03AA +03AB 03CB 03AB +03AC 03AC 0386 +03AD 03AD 0388 +03AE 03AE 0389 +03AF 03AF 038A +03B1 03B1 0391 +03B2 03B2 0392 +03B3 03B3 0393 +03B4 03B4 0394 +03B5 03B5 0395 +03B6 03B6 0396 +03B7 03B7 0397 +03B8 03B8 0398 +03B9 03B9 0399 +03BA 03BA 039A +03BB 03BB 039B +03BC 03BC 039C +03BD 03BD 039D +03BE 03BE 039E +03BF 03BF 039F +03C0 03C0 03A0 +03C1 03C1 03A1 +03C2 03C2 03A3 +03C3 03C3 03A3 +03C4 03C4 03A4 +03C5 03C5 03A5 +03C6 03C6 03A6 +03C7 03C7 03A7 +03C8 03C8 03A8 +03C9 03C9 03A9 +03CA 03CA 03AA +03CB 03CB 03AB +03CC 03CC 038C +03CD 03CD 038E +03CE 03CE 038F +03D0 03D0 0392 +03D1 03D1 0398 +03D5 03D5 03A6 +03D6 03D6 03A0 +03DA 03DB 03DA +03DB 03DB 03DA +03DC 03DD 03DC +03DD 03DD 03DC +03DE 03DF 03DE +03DF 03DF 03DE +03E0 03E1 03E0 +03E1 03E1 03E0 +03E2 03E3 03E2 +03E3 03E3 03E2 +03E4 03E5 03E4 +03E5 03E5 03E4 +03E6 03E7 03E6 +03E7 03E7 03E6 +03E8 03E9 03E8 +03E9 03E9 03E8 +03EA 03EB 03EA +03EB 03EB 03EA +03EC 03ED 03EC +03ED 03ED 03EC +03EE 03EF 03EE +03EF 03EF 03EE +03F0 03F0 039A +03F1 03F1 03A1 +03F2 03F2 03A3 +0400 0450 0400 +0401 0451 0401 +0402 0452 0402 +0403 0453 0403 +0404 0454 0404 +0405 0455 0405 +0406 0456 0406 +0407 0457 0407 +0408 0458 0408 +0409 0459 0409 +040A 045A 040A +040B 045B 040B +040C 045C 040C +040D 045D 040D +040E 045E 040E +040F 045F 040F +0410 0430 0410 +0411 0431 0411 +0412 0432 0412 +0413 0433 0413 +0414 0434 0414 +0415 0435 0415 +0416 0436 0416 +0417 0437 0417 +0418 0438 0418 +0419 0439 0419 +041A 043A 041A +041B 043B 041B +041C 043C 041C +041D 043D 041D +041E 043E 041E +041F 043F 041F +0420 0440 0420 +0421 0441 0421 +0422 0442 0422 +0423 0443 0423 +0424 0444 0424 +0425 0445 0425 +0426 0446 0426 +0427 0447 0427 +0428 0448 0428 +0429 0449 0429 +042A 044A 042A +042B 044B 042B +042C 044C 042C +042D 044D 042D +042E 044E 042E +042F 044F 042F +0430 0430 0410 +0431 0431 0411 +0432 0432 0412 +0433 0433 0413 +0434 0434 0414 +0435 0435 0415 +0436 0436 0416 +0437 0437 0417 +0438 0438 0418 +0439 0439 0419 +043A 043A 041A +043B 043B 041B +043C 043C 041C +043D 043D 041D +043E 043E 041E +043F 043F 041F +0440 0440 0420 +0441 0441 0421 +0442 0442 0422 +0443 0443 0423 +0444 0444 0424 +0445 0445 0425 +0446 0446 0426 +0447 0447 0427 +0448 0448 0428 +0449 0449 0429 +044A 044A 042A +044B 044B 042B +044C 044C 042C +044D 044D 042D +044E 044E 042E +044F 044F 042F +0450 0450 0400 +0451 0451 0401 +0452 0452 0402 +0453 0453 0403 +0454 0454 0404 +0455 0455 0405 +0456 0456 0406 +0457 0457 0407 +0458 0458 0408 +0459 0459 0409 +045A 045A 040A +045B 045B 040B +045C 045C 040C +045D 045D 040D +045E 045E 040E +045F 045F 040F +0460 0461 0460 +0461 0461 0460 +0462 0463 0462 +0463 0463 0462 +0464 0465 0464 +0465 0465 0464 +0466 0467 0466 +0467 0467 0466 +0468 0469 0468 +0469 0469 0468 +046A 046B 046A +046B 046B 046A +046C 046D 046C +046D 046D 046C +046E 046F 046E +046F 046F 046E +0470 0471 0470 +0471 0471 0470 +0472 0473 0472 +0473 0473 0472 +0474 0475 0474 +0475 0475 0474 +0476 0477 0476 +0477 0477 0476 +0478 0479 0478 +0479 0479 0478 +047A 047B 047A +047B 047B 047A +047C 047D 047C +047D 047D 047C +047E 047F 047E +047F 047F 047E +0480 0481 0480 +0481 0481 0480 +048C 048D 048C +048D 048D 048C +048E 048F 048E +048F 048F 048E +0490 0491 0490 +0491 0491 0490 +0492 0493 0492 +0493 0493 0492 +0494 0495 0494 +0495 0495 0494 +0496 0497 0496 +0497 0497 0496 +0498 0499 0498 +0499 0499 0498 +049A 049B 049A +049B 049B 049A +049C 049D 049C +049D 049D 049C +049E 049F 049E +049F 049F 049E +04A0 04A1 04A0 +04A1 04A1 04A0 +04A2 04A3 04A2 +04A3 04A3 04A2 +04A4 04A5 04A4 +04A5 04A5 04A4 +04A6 04A7 04A6 +04A7 04A7 04A6 +04A8 04A9 04A8 +04A9 04A9 04A8 +04AA 04AB 04AA +04AB 04AB 04AA +04AC 04AD 04AC +04AD 04AD 04AC +04AE 04AF 04AE +04AF 04AF 04AE +04B0 04B1 04B0 +04B1 04B1 04B0 +04B2 04B3 04B2 +04B3 04B3 04B2 +04B4 04B5 04B4 +04B5 04B5 04B4 +04B6 04B7 04B6 +04B7 04B7 04B6 +04B8 04B9 04B8 +04B9 04B9 04B8 +04BA 04BB 04BA +04BB 04BB 04BA +04BC 04BD 04BC +04BD 04BD 04BC +04BE 04BF 04BE +04BF 04BF 04BE +04C1 04C2 04C1 +04C2 04C2 04C1 +04C3 04C4 04C3 +04C4 04C4 04C3 +04C7 04C8 04C7 +04C8 04C8 04C7 +04CB 04CC 04CB +04CC 04CC 04CB +04D0 04D1 04D0 +04D1 04D1 04D0 +04D2 04D3 04D2 +04D3 04D3 04D2 +04D4 04D5 04D4 +04D5 04D5 04D4 +04D6 04D7 04D6 +04D7 04D7 04D6 +04D8 04D9 04D8 +04D9 04D9 04D8 +04DA 04DB 04DA +04DB 04DB 04DA +04DC 04DD 04DC +04DD 04DD 04DC +04DE 04DF 04DE +04DF 04DF 04DE +04E0 04E1 04E0 +04E1 04E1 04E0 +04E2 04E3 04E2 +04E3 04E3 04E2 +04E4 04E5 04E4 +04E5 04E5 04E4 +04E6 04E7 04E6 +04E7 04E7 04E6 +04E8 04E9 04E8 +04E9 04E9 04E8 +04EA 04EB 04EA +04EB 04EB 04EA +04EC 04ED 04EC +04ED 04ED 04EC +04EE 04EF 04EE +04EF 04EF 04EE +04F0 04F1 04F0 +04F1 04F1 04F0 +04F2 04F3 04F2 +04F3 04F3 04F2 +04F4 04F5 04F4 +04F5 04F5 04F4 +04F8 04F9 04F8 +04F9 04F9 04F8 +0531 0561 0531 +0532 0562 0532 +0533 0563 0533 +0534 0564 0534 +0535 0565 0535 +0536 0566 0536 +0537 0567 0537 +0538 0568 0538 +0539 0569 0539 +053A 056A 053A +053B 056B 053B +053C 056C 053C +053D 056D 053D +053E 056E 053E +053F 056F 053F +0540 0570 0540 +0541 0571 0541 +0542 0572 0542 +0543 0573 0543 +0544 0574 0544 +0545 0575 0545 +0546 0576 0546 +0547 0577 0547 +0548 0578 0548 +0549 0579 0549 +054A 057A 054A +054B 057B 054B +054C 057C 054C +054D 057D 054D +054E 057E 054E +054F 057F 054F +0550 0580 0550 +0551 0581 0551 +0552 0582 0552 +0553 0583 0553 +0554 0584 0554 +0555 0585 0555 +0556 0586 0556 +0561 0561 0531 +0562 0562 0532 +0563 0563 0533 +0564 0564 0534 +0565 0565 0535 +0566 0566 0536 +0567 0567 0537 +0568 0568 0538 +0569 0569 0539 +056A 056A 053A +056B 056B 053B +056C 056C 053C +056D 056D 053D +056E 056E 053E +056F 056F 053F +0570 0570 0540 +0571 0571 0541 +0572 0572 0542 +0573 0573 0543 +0574 0574 0544 +0575 0575 0545 +0576 0576 0546 +0577 0577 0547 +0578 0578 0548 +0579 0579 0549 +057A 057A 054A +057B 057B 054B +057C 057C 054C +057D 057D 054D +057E 057E 054E +057F 057F 054F +0580 0580 0550 +0581 0581 0551 +0582 0582 0552 +0583 0583 0553 +0584 0584 0554 +0585 0585 0555 +0586 0586 0556 +1E00 1E01 1E00 +1E01 1E01 1E00 +1E02 1E03 1E02 +1E03 1E03 1E02 +1E04 1E05 1E04 +1E05 1E05 1E04 +1E06 1E07 1E06 +1E07 1E07 1E06 +1E08 1E09 1E08 +1E09 1E09 1E08 +1E0A 1E0B 1E0A +1E0B 1E0B 1E0A +1E0C 1E0D 1E0C +1E0D 1E0D 1E0C +1E0E 1E0F 1E0E +1E0F 1E0F 1E0E +1E10 1E11 1E10 +1E11 1E11 1E10 +1E12 1E13 1E12 +1E13 1E13 1E12 +1E14 1E15 1E14 +1E15 1E15 1E14 +1E16 1E17 1E16 +1E17 1E17 1E16 +1E18 1E19 1E18 +1E19 1E19 1E18 +1E1A 1E1B 1E1A +1E1B 1E1B 1E1A +1E1C 1E1D 1E1C +1E1D 1E1D 1E1C +1E1E 1E1F 1E1E +1E1F 1E1F 1E1E +1E20 1E21 1E20 +1E21 1E21 1E20 +1E22 1E23 1E22 +1E23 1E23 1E22 +1E24 1E25 1E24 +1E25 1E25 1E24 +1E26 1E27 1E26 +1E27 1E27 1E26 +1E28 1E29 1E28 +1E29 1E29 1E28 +1E2A 1E2B 1E2A +1E2B 1E2B 1E2A +1E2C 1E2D 1E2C +1E2D 1E2D 1E2C +1E2E 1E2F 1E2E +1E2F 1E2F 1E2E +1E30 1E31 1E30 +1E31 1E31 1E30 +1E32 1E33 1E32 +1E33 1E33 1E32 +1E34 1E35 1E34 +1E35 1E35 1E34 +1E36 1E37 1E36 +1E37 1E37 1E36 +1E38 1E39 1E38 +1E39 1E39 1E38 +1E3A 1E3B 1E3A +1E3B 1E3B 1E3A +1E3C 1E3D 1E3C +1E3D 1E3D 1E3C +1E3E 1E3F 1E3E +1E3F 1E3F 1E3E +1E40 1E41 1E40 +1E41 1E41 1E40 +1E42 1E43 1E42 +1E43 1E43 1E42 +1E44 1E45 1E44 +1E45 1E45 1E44 +1E46 1E47 1E46 +1E47 1E47 1E46 +1E48 1E49 1E48 +1E49 1E49 1E48 +1E4A 1E4B 1E4A +1E4B 1E4B 1E4A +1E4C 1E4D 1E4C +1E4D 1E4D 1E4C +1E4E 1E4F 1E4E +1E4F 1E4F 1E4E +1E50 1E51 1E50 +1E51 1E51 1E50 +1E52 1E53 1E52 +1E53 1E53 1E52 +1E54 1E55 1E54 +1E55 1E55 1E54 +1E56 1E57 1E56 +1E57 1E57 1E56 +1E58 1E59 1E58 +1E59 1E59 1E58 +1E5A 1E5B 1E5A +1E5B 1E5B 1E5A +1E5C 1E5D 1E5C +1E5D 1E5D 1E5C +1E5E 1E5F 1E5E +1E5F 1E5F 1E5E +1E60 1E61 1E60 +1E61 1E61 1E60 +1E62 1E63 1E62 +1E63 1E63 1E62 +1E64 1E65 1E64 +1E65 1E65 1E64 +1E66 1E67 1E66 +1E67 1E67 1E66 +1E68 1E69 1E68 +1E69 1E69 1E68 +1E6A 1E6B 1E6A +1E6B 1E6B 1E6A +1E6C 1E6D 1E6C +1E6D 1E6D 1E6C +1E6E 1E6F 1E6E +1E6F 1E6F 1E6E +1E70 1E71 1E70 +1E71 1E71 1E70 +1E72 1E73 1E72 +1E73 1E73 1E72 +1E74 1E75 1E74 +1E75 1E75 1E74 +1E76 1E77 1E76 +1E77 1E77 1E76 +1E78 1E79 1E78 +1E79 1E79 1E78 +1E7A 1E7B 1E7A +1E7B 1E7B 1E7A +1E7C 1E7D 1E7C +1E7D 1E7D 1E7C +1E7E 1E7F 1E7E +1E7F 1E7F 1E7E +1E80 1E81 1E80 +1E81 1E81 1E80 +1E82 1E83 1E82 +1E83 1E83 1E82 +1E84 1E85 1E84 +1E85 1E85 1E84 +1E86 1E87 1E86 +1E87 1E87 1E86 +1E88 1E89 1E88 +1E89 1E89 1E88 +1E8A 1E8B 1E8A +1E8B 1E8B 1E8A +1E8C 1E8D 1E8C +1E8D 1E8D 1E8C +1E8E 1E8F 1E8E +1E8F 1E8F 1E8E +1E90 1E91 1E90 +1E91 1E91 1E90 +1E92 1E93 1E92 +1E93 1E93 1E92 +1E94 1E95 1E94 +1E95 1E95 1E94 +1E9B 1E9B 1E60 +1EA0 1EA1 1EA0 +1EA1 1EA1 1EA0 +1EA2 1EA3 1EA2 +1EA3 1EA3 1EA2 +1EA4 1EA5 1EA4 +1EA5 1EA5 1EA4 +1EA6 1EA7 1EA6 +1EA7 1EA7 1EA6 +1EA8 1EA9 1EA8 +1EA9 1EA9 1EA8 +1EAA 1EAB 1EAA +1EAB 1EAB 1EAA +1EAC 1EAD 1EAC +1EAD 1EAD 1EAC +1EAE 1EAF 1EAE +1EAF 1EAF 1EAE +1EB0 1EB1 1EB0 +1EB1 1EB1 1EB0 +1EB2 1EB3 1EB2 +1EB3 1EB3 1EB2 +1EB4 1EB5 1EB4 +1EB5 1EB5 1EB4 +1EB6 1EB7 1EB6 +1EB7 1EB7 1EB6 +1EB8 1EB9 1EB8 +1EB9 1EB9 1EB8 +1EBA 1EBB 1EBA +1EBB 1EBB 1EBA +1EBC 1EBD 1EBC +1EBD 1EBD 1EBC +1EBE 1EBF 1EBE +1EBF 1EBF 1EBE +1EC0 1EC1 1EC0 +1EC1 1EC1 1EC0 +1EC2 1EC3 1EC2 +1EC3 1EC3 1EC2 +1EC4 1EC5 1EC4 +1EC5 1EC5 1EC4 +1EC6 1EC7 1EC6 +1EC7 1EC7 1EC6 +1EC8 1EC9 1EC8 +1EC9 1EC9 1EC8 +1ECA 1ECB 1ECA +1ECB 1ECB 1ECA +1ECC 1ECD 1ECC +1ECD 1ECD 1ECC +1ECE 1ECF 1ECE +1ECF 1ECF 1ECE +1ED0 1ED1 1ED0 +1ED1 1ED1 1ED0 +1ED2 1ED3 1ED2 +1ED3 1ED3 1ED2 +1ED4 1ED5 1ED4 +1ED5 1ED5 1ED4 +1ED6 1ED7 1ED6 +1ED7 1ED7 1ED6 +1ED8 1ED9 1ED8 +1ED9 1ED9 1ED8 +1EDA 1EDB 1EDA +1EDB 1EDB 1EDA +1EDC 1EDD 1EDC +1EDD 1EDD 1EDC +1EDE 1EDF 1EDE +1EDF 1EDF 1EDE +1EE0 1EE1 1EE0 +1EE1 1EE1 1EE0 +1EE2 1EE3 1EE2 +1EE3 1EE3 1EE2 +1EE4 1EE5 1EE4 +1EE5 1EE5 1EE4 +1EE6 1EE7 1EE6 +1EE7 1EE7 1EE6 +1EE8 1EE9 1EE8 +1EE9 1EE9 1EE8 +1EEA 1EEB 1EEA +1EEB 1EEB 1EEA +1EEC 1EED 1EEC +1EED 1EED 1EEC +1EEE 1EEF 1EEE +1EEF 1EEF 1EEE +1EF0 1EF1 1EF0 +1EF1 1EF1 1EF0 +1EF2 1EF3 1EF2 +1EF3 1EF3 1EF2 +1EF4 1EF5 1EF4 +1EF5 1EF5 1EF4 +1EF6 1EF7 1EF6 +1EF7 1EF7 1EF6 +1EF8 1EF9 1EF8 +1EF9 1EF9 1EF8 +1F00 1F00 1F08 +1F01 1F01 1F09 +1F02 1F02 1F0A +1F03 1F03 1F0B +1F04 1F04 1F0C +1F05 1F05 1F0D +1F06 1F06 1F0E +1F07 1F07 1F0F +1F08 1F00 1F08 +1F09 1F01 1F09 +1F0A 1F02 1F0A +1F0B 1F03 1F0B +1F0C 1F04 1F0C +1F0D 1F05 1F0D +1F0E 1F06 1F0E +1F0F 1F07 1F0F +1F10 1F10 1F18 +1F11 1F11 1F19 +1F12 1F12 1F1A +1F13 1F13 1F1B +1F14 1F14 1F1C +1F15 1F15 1F1D +1F18 1F10 1F18 +1F19 1F11 1F19 +1F1A 1F12 1F1A +1F1B 1F13 1F1B +1F1C 1F14 1F1C +1F1D 1F15 1F1D +1F20 1F20 1F28 +1F21 1F21 1F29 +1F22 1F22 1F2A +1F23 1F23 1F2B +1F24 1F24 1F2C +1F25 1F25 1F2D +1F26 1F26 1F2E +1F27 1F27 1F2F +1F28 1F20 1F28 +1F29 1F21 1F29 +1F2A 1F22 1F2A +1F2B 1F23 1F2B +1F2C 1F24 1F2C +1F2D 1F25 1F2D +1F2E 1F26 1F2E +1F2F 1F27 1F2F +1F30 1F30 1F38 +1F31 1F31 1F39 +1F32 1F32 1F3A +1F33 1F33 1F3B +1F34 1F34 1F3C +1F35 1F35 1F3D +1F36 1F36 1F3E +1F37 1F37 1F3F +1F38 1F30 1F38 +1F39 1F31 1F39 +1F3A 1F32 1F3A +1F3B 1F33 1F3B +1F3C 1F34 1F3C +1F3D 1F35 1F3D +1F3E 1F36 1F3E +1F3F 1F37 1F3F +1F40 1F40 1F48 +1F41 1F41 1F49 +1F42 1F42 1F4A +1F43 1F43 1F4B +1F44 1F44 1F4C +1F45 1F45 1F4D +1F48 1F40 1F48 +1F49 1F41 1F49 +1F4A 1F42 1F4A +1F4B 1F43 1F4B +1F4C 1F44 1F4C +1F4D 1F45 1F4D +1F51 1F51 1F59 +1F53 1F53 1F5B +1F55 1F55 1F5D +1F57 1F57 1F5F +1F59 1F51 1F59 +1F5B 1F53 1F5B +1F5D 1F55 1F5D +1F5F 1F57 1F5F +1F60 1F60 1F68 +1F61 1F61 1F69 +1F62 1F62 1F6A +1F63 1F63 1F6B +1F64 1F64 1F6C +1F65 1F65 1F6D +1F66 1F66 1F6E +1F67 1F67 1F6F +1F68 1F60 1F68 +1F69 1F61 1F69 +1F6A 1F62 1F6A +1F6B 1F63 1F6B +1F6C 1F64 1F6C +1F6D 1F65 1F6D +1F6E 1F66 1F6E +1F6F 1F67 1F6F +1F70 1F70 1FBA +1F71 1F71 1FBB +1F72 1F72 1FC8 +1F73 1F73 1FC9 +1F74 1F74 1FCA +1F75 1F75 1FCB +1F76 1F76 1FDA +1F77 1F77 1FDB +1F78 1F78 1FF8 +1F79 1F79 1FF9 +1F7A 1F7A 1FEA +1F7B 1F7B 1FEB +1F7C 1F7C 1FFA +1F7D 1F7D 1FFB +1F80 1F80 1F88 +1F81 1F81 1F89 +1F82 1F82 1F8A +1F83 1F83 1F8B +1F84 1F84 1F8C +1F85 1F85 1F8D +1F86 1F86 1F8E +1F87 1F87 1F8F +1F88 1F80 1F88 +1F89 1F81 1F89 +1F8A 1F82 1F8A +1F8B 1F83 1F8B +1F8C 1F84 1F8C +1F8D 1F85 1F8D +1F8E 1F86 1F8E +1F8F 1F87 1F8F +1F90 1F90 1F98 +1F91 1F91 1F99 +1F92 1F92 1F9A +1F93 1F93 1F9B +1F94 1F94 1F9C +1F95 1F95 1F9D +1F96 1F96 1F9E +1F97 1F97 1F9F +1F98 1F90 1F98 +1F99 1F91 1F99 +1F9A 1F92 1F9A +1F9B 1F93 1F9B +1F9C 1F94 1F9C +1F9D 1F95 1F9D +1F9E 1F96 1F9E +1F9F 1F97 1F9F +1FA0 1FA0 1FA8 +1FA1 1FA1 1FA9 +1FA2 1FA2 1FAA +1FA3 1FA3 1FAB +1FA4 1FA4 1FAC +1FA5 1FA5 1FAD +1FA6 1FA6 1FAE +1FA7 1FA7 1FAF +1FA8 1FA0 1FA8 +1FA9 1FA1 1FA9 +1FAA 1FA2 1FAA +1FAB 1FA3 1FAB +1FAC 1FA4 1FAC +1FAD 1FA5 1FAD +1FAE 1FA6 1FAE +1FAF 1FA7 1FAF +1FB0 1FB0 1FB8 +1FB1 1FB1 1FB9 +1FB3 1FB3 1FBC +1FB8 1FB0 1FB8 +1FB9 1FB1 1FB9 +1FBA 1F70 1FBA +1FBB 1F71 1FBB +1FBC 1FB3 1FBC +1FBE 1FBE 0399 +1FC3 1FC3 1FCC +1FC8 1F72 1FC8 +1FC9 1F73 1FC9 +1FCA 1F74 1FCA +1FCB 1F75 1FCB +1FCC 1FC3 1FCC +1FD0 1FD0 1FD8 +1FD1 1FD1 1FD9 +1FD8 1FD0 1FD8 +1FD9 1FD1 1FD9 +1FDA 1F76 1FDA +1FDB 1F77 1FDB +1FE0 1FE0 1FE8 +1FE1 1FE1 1FE9 +1FE5 1FE5 1FEC +1FE8 1FE0 1FE8 +1FE9 1FE1 1FE9 +1FEA 1F7A 1FEA +1FEB 1F7B 1FEB +1FEC 1FE5 1FEC +1FF3 1FF3 1FFC +1FF8 1F78 1FF8 +1FF9 1F79 1FF9 +1FFA 1F7C 1FFA +1FFB 1F7D 1FFB +1FFC 1FF3 1FFC +2126 03C9 2126 +212A 006B 212A +212B 00E5 212B +2160 2170 2160 +2161 2171 2161 +2162 2172 2162 +2163 2173 2163 +2164 2174 2164 +2165 2175 2165 +2166 2176 2166 +2167 2177 2167 +2168 2178 2168 +2169 2179 2169 +216A 217A 216A +216B 217B 216B +216C 217C 216C +216D 217D 216D +216E 217E 216E +216F 217F 216F +2170 2170 2160 +2171 2171 2161 +2172 2172 2162 +2173 2173 2163 +2174 2174 2164 +2175 2175 2165 +2176 2176 2166 +2177 2177 2167 +2178 2178 2168 +2179 2179 2169 +217A 217A 216A +217B 217B 216B +217C 217C 216C +217D 217D 216D +217E 217E 216E +217F 217F 216F +24B6 24D0 24B6 +24B7 24D1 24B7 +24B8 24D2 24B8 +24B9 24D3 24B9 +24BA 24D4 24BA +24BB 24D5 24BB +24BC 24D6 24BC +24BD 24D7 24BD +24BE 24D8 24BE +24BF 24D9 24BF +24C0 24DA 24C0 +24C1 24DB 24C1 +24C2 24DC 24C2 +24C3 24DD 24C3 +24C4 24DE 24C4 +24C5 24DF 24C5 +24C6 24E0 24C6 +24C7 24E1 24C7 +24C8 24E2 24C8 +24C9 24E3 24C9 +24CA 24E4 24CA +24CB 24E5 24CB +24CC 24E6 24CC +24CD 24E7 24CD +24CE 24E8 24CE +24CF 24E9 24CF +24D0 24D0 24B6 +24D1 24D1 24B7 +24D2 24D2 24B8 +24D3 24D3 24B9 +24D4 24D4 24BA +24D5 24D5 24BB +24D6 24D6 24BC +24D7 24D7 24BD +24D8 24D8 24BE +24D9 24D9 24BF +24DA 24DA 24C0 +24DB 24DB 24C1 +24DC 24DC 24C2 +24DD 24DD 24C3 +24DE 24DE 24C4 +24DF 24DF 24C5 +24E0 24E0 24C6 +24E1 24E1 24C7 +24E2 24E2 24C8 +24E3 24E3 24C9 +24E4 24E4 24CA +24E5 24E5 24CB +24E6 24E6 24CC +24E7 24E7 24CD +24E8 24E8 24CE +24E9 24E9 24CF +FF21 FF41 FF21 +FF22 FF42 FF22 +FF23 FF43 FF23 +FF24 FF44 FF24 +FF25 FF45 FF25 +FF26 FF46 FF26 +FF27 FF47 FF27 +FF28 FF48 FF28 +FF29 FF49 FF29 +FF2A FF4A FF2A +FF2B FF4B FF2B +FF2C FF4C FF2C +FF2D FF4D FF2D +FF2E FF4E FF2E +FF2F FF4F FF2F +FF30 FF50 FF30 +FF31 FF51 FF31 +FF32 FF52 FF32 +FF33 FF53 FF33 +FF34 FF54 FF34 +FF35 FF55 FF35 +FF36 FF56 FF36 +FF37 FF57 FF37 +FF38 FF58 FF38 +FF39 FF59 FF39 +FF3A FF5A FF3A +FF41 FF41 FF21 +FF42 FF42 FF22 +FF43 FF43 FF23 +FF44 FF44 FF24 +FF45 FF45 FF25 +FF46 FF46 FF26 +FF47 FF47 FF27 +FF48 FF48 FF28 +FF49 FF49 FF29 +FF4A FF4A FF2A +FF4B FF4B FF2B +FF4C FF4C FF2C +FF4D FF4D FF2D +FF4E FF4E FF2E +FF4F FF4F FF2F +FF50 FF50 FF30 +FF51 FF51 FF31 +FF52 FF52 FF32 +FF53 FF53 FF33 +FF54 FF54 FF34 +FF55 FF55 FF35 +FF56 FF56 FF36 +FF57 FF57 FF37 +FF58 FF58 FF38 +FF59 FF59 FF39 +FF5A FF5A FF3A +DROP VIEW v_bmp; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_utf8mb3_turkish_ci_casefold.test b/mysql-test/main/ctype_utf8mb3_turkish_ci_casefold.test new file mode 100644 index 0000000000000..c807afb2a971b --- /dev/null +++ b/mysql-test/main/ctype_utf8mb3_turkish_ci_casefold.test @@ -0,0 +1,14 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET NAMES utf8mb3 COLLATE utf8mb3_turkish_ci; +--source include/ctype_unicode_casefold_bmp.inc + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/ctype_utf8mb3_unicode_520_ci_casefold.result b/mysql-test/main/ctype_utf8mb3_unicode_520_ci_casefold.result new file mode 100644 index 0000000000000..f84d6e2780230 --- /dev/null +++ b/mysql-test/main/ctype_utf8mb3_unicode_520_ci_casefold.result @@ -0,0 +1,2011 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_520_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +utf8mb3_unicode_520_ci +SELECT +codepoint_hex4, +HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)), +HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +FROM v_bmp +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); +codepoint_hex4 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +0041 0061 0041 +0042 0062 0042 +0043 0063 0043 +0044 0064 0044 +0045 0065 0045 +0046 0066 0046 +0047 0067 0047 +0048 0068 0048 +0049 0069 0049 +004A 006A 004A +004B 006B 004B +004C 006C 004C +004D 006D 004D +004E 006E 004E +004F 006F 004F +0050 0070 0050 +0051 0071 0051 +0052 0072 0052 +0053 0073 0053 +0054 0074 0054 +0055 0075 0055 +0056 0076 0056 +0057 0077 0057 +0058 0078 0058 +0059 0079 0059 +005A 007A 005A +0061 0061 0041 +0062 0062 0042 +0063 0063 0043 +0064 0064 0044 +0065 0065 0045 +0066 0066 0046 +0067 0067 0047 +0068 0068 0048 +0069 0069 0049 +006A 006A 004A +006B 006B 004B +006C 006C 004C +006D 006D 004D +006E 006E 004E +006F 006F 004F +0070 0070 0050 +0071 0071 0051 +0072 0072 0052 +0073 0073 0053 +0074 0074 0054 +0075 0075 0055 +0076 0076 0056 +0077 0077 0057 +0078 0078 0058 +0079 0079 0059 +007A 007A 005A +00B5 00B5 039C +00C0 00E0 00C0 +00C1 00E1 00C1 +00C2 00E2 00C2 +00C3 00E3 00C3 +00C4 00E4 00C4 +00C5 00E5 00C5 +00C6 00E6 00C6 +00C7 00E7 00C7 +00C8 00E8 00C8 +00C9 00E9 00C9 +00CA 00EA 00CA +00CB 00EB 00CB +00CC 00EC 00CC +00CD 00ED 00CD +00CE 00EE 00CE +00CF 00EF 00CF +00D0 00F0 00D0 +00D1 00F1 00D1 +00D2 00F2 00D2 +00D3 00F3 00D3 +00D4 00F4 00D4 +00D5 00F5 00D5 +00D6 00F6 00D6 +00D8 00F8 00D8 +00D9 00F9 00D9 +00DA 00FA 00DA +00DB 00FB 00DB +00DC 00FC 00DC +00DD 00FD 00DD +00DE 00FE 00DE +00E0 00E0 00C0 +00E1 00E1 00C1 +00E2 00E2 00C2 +00E3 00E3 00C3 +00E4 00E4 00C4 +00E5 00E5 00C5 +00E6 00E6 00C6 +00E7 00E7 00C7 +00E8 00E8 00C8 +00E9 00E9 00C9 +00EA 00EA 00CA +00EB 00EB 00CB +00EC 00EC 00CC +00ED 00ED 00CD +00EE 00EE 00CE +00EF 00EF 00CF +00F0 00F0 00D0 +00F1 00F1 00D1 +00F2 00F2 00D2 +00F3 00F3 00D3 +00F4 00F4 00D4 +00F5 00F5 00D5 +00F6 00F6 00D6 +00F8 00F8 00D8 +00F9 00F9 00D9 +00FA 00FA 00DA +00FB 00FB 00DB +00FC 00FC 00DC +00FD 00FD 00DD +00FE 00FE 00DE +00FF 00FF 0178 +0100 0101 0100 +0101 0101 0100 +0102 0103 0102 +0103 0103 0102 +0104 0105 0104 +0105 0105 0104 +0106 0107 0106 +0107 0107 0106 +0108 0109 0108 +0109 0109 0108 +010A 010B 010A +010B 010B 010A +010C 010D 010C +010D 010D 010C +010E 010F 010E +010F 010F 010E +0110 0111 0110 +0111 0111 0110 +0112 0113 0112 +0113 0113 0112 +0114 0115 0114 +0115 0115 0114 +0116 0117 0116 +0117 0117 0116 +0118 0119 0118 +0119 0119 0118 +011A 011B 011A +011B 011B 011A +011C 011D 011C +011D 011D 011C +011E 011F 011E +011F 011F 011E +0120 0121 0120 +0121 0121 0120 +0122 0123 0122 +0123 0123 0122 +0124 0125 0124 +0125 0125 0124 +0126 0127 0126 +0127 0127 0126 +0128 0129 0128 +0129 0129 0128 +012A 012B 012A +012B 012B 012A +012C 012D 012C +012D 012D 012C +012E 012F 012E +012F 012F 012E +0130 0069 0130 +0131 0131 0049 +0132 0133 0132 +0133 0133 0132 +0134 0135 0134 +0135 0135 0134 +0136 0137 0136 +0137 0137 0136 +0139 013A 0139 +013A 013A 0139 +013B 013C 013B +013C 013C 013B +013D 013E 013D +013E 013E 013D +013F 0140 013F +0140 0140 013F +0141 0142 0141 +0142 0142 0141 +0143 0144 0143 +0144 0144 0143 +0145 0146 0145 +0146 0146 0145 +0147 0148 0147 +0148 0148 0147 +014A 014B 014A +014B 014B 014A +014C 014D 014C +014D 014D 014C +014E 014F 014E +014F 014F 014E +0150 0151 0150 +0151 0151 0150 +0152 0153 0152 +0153 0153 0152 +0154 0155 0154 +0155 0155 0154 +0156 0157 0156 +0157 0157 0156 +0158 0159 0158 +0159 0159 0158 +015A 015B 015A +015B 015B 015A +015C 015D 015C +015D 015D 015C +015E 015F 015E +015F 015F 015E +0160 0161 0160 +0161 0161 0160 +0162 0163 0162 +0163 0163 0162 +0164 0165 0164 +0165 0165 0164 +0166 0167 0166 +0167 0167 0166 +0168 0169 0168 +0169 0169 0168 +016A 016B 016A +016B 016B 016A +016C 016D 016C +016D 016D 016C +016E 016F 016E +016F 016F 016E +0170 0171 0170 +0171 0171 0170 +0172 0173 0172 +0173 0173 0172 +0174 0175 0174 +0175 0175 0174 +0176 0177 0176 +0177 0177 0176 +0178 00FF 0178 +0179 017A 0179 +017A 017A 0179 +017B 017C 017B +017C 017C 017B +017D 017E 017D +017E 017E 017D +017F 017F 0053 +0180 0180 0243 +0181 0253 0181 +0182 0183 0182 +0183 0183 0182 +0184 0185 0184 +0185 0185 0184 +0186 0254 0186 +0187 0188 0187 +0188 0188 0187 +0189 0256 0189 +018A 0257 018A +018B 018C 018B +018C 018C 018B +018E 01DD 018E +018F 0259 018F +0190 025B 0190 +0191 0192 0191 +0192 0192 0191 +0193 0260 0193 +0194 0263 0194 +0195 0195 01F6 +0196 0269 0196 +0197 0268 0197 +0198 0199 0198 +0199 0199 0198 +019A 019A 023D +019C 026F 019C +019D 0272 019D +019E 019E 0220 +019F 0275 019F +01A0 01A1 01A0 +01A1 01A1 01A0 +01A2 01A3 01A2 +01A3 01A3 01A2 +01A4 01A5 01A4 +01A5 01A5 01A4 +01A6 0280 01A6 +01A7 01A8 01A7 +01A8 01A8 01A7 +01A9 0283 01A9 +01AC 01AD 01AC +01AD 01AD 01AC +01AE 0288 01AE +01AF 01B0 01AF +01B0 01B0 01AF +01B1 028A 01B1 +01B2 028B 01B2 +01B3 01B4 01B3 +01B4 01B4 01B3 +01B5 01B6 01B5 +01B6 01B6 01B5 +01B7 0292 01B7 +01B8 01B9 01B8 +01B9 01B9 01B8 +01BC 01BD 01BC +01BD 01BD 01BC +01BF 01BF 01F7 +01C4 01C6 01C4 +01C5 01C6 01C4 +01C6 01C6 01C4 +01C7 01C9 01C7 +01C8 01C9 01C7 +01C9 01C9 01C7 +01CA 01CC 01CA +01CB 01CC 01CA +01CC 01CC 01CA +01CD 01CE 01CD +01CE 01CE 01CD +01CF 01D0 01CF +01D0 01D0 01CF +01D1 01D2 01D1 +01D2 01D2 01D1 +01D3 01D4 01D3 +01D4 01D4 01D3 +01D5 01D6 01D5 +01D6 01D6 01D5 +01D7 01D8 01D7 +01D8 01D8 01D7 +01D9 01DA 01D9 +01DA 01DA 01D9 +01DB 01DC 01DB +01DC 01DC 01DB +01DD 01DD 018E +01DE 01DF 01DE +01DF 01DF 01DE +01E0 01E1 01E0 +01E1 01E1 01E0 +01E2 01E3 01E2 +01E3 01E3 01E2 +01E4 01E5 01E4 +01E5 01E5 01E4 +01E6 01E7 01E6 +01E7 01E7 01E6 +01E8 01E9 01E8 +01E9 01E9 01E8 +01EA 01EB 01EA +01EB 01EB 01EA +01EC 01ED 01EC +01ED 01ED 01EC +01EE 01EF 01EE +01EF 01EF 01EE +01F1 01F3 01F1 +01F2 01F3 01F1 +01F3 01F3 01F1 +01F4 01F5 01F4 +01F5 01F5 01F4 +01F6 0195 01F6 +01F7 01BF 01F7 +01F8 01F9 01F8 +01F9 01F9 01F8 +01FA 01FB 01FA +01FB 01FB 01FA +01FC 01FD 01FC +01FD 01FD 01FC +01FE 01FF 01FE +01FF 01FF 01FE +0200 0201 0200 +0201 0201 0200 +0202 0203 0202 +0203 0203 0202 +0204 0205 0204 +0205 0205 0204 +0206 0207 0206 +0207 0207 0206 +0208 0209 0208 +0209 0209 0208 +020A 020B 020A +020B 020B 020A +020C 020D 020C +020D 020D 020C +020E 020F 020E +020F 020F 020E +0210 0211 0210 +0211 0211 0210 +0212 0213 0212 +0213 0213 0212 +0214 0215 0214 +0215 0215 0214 +0216 0217 0216 +0217 0217 0216 +0218 0219 0218 +0219 0219 0218 +021A 021B 021A +021B 021B 021A +021C 021D 021C +021D 021D 021C +021E 021F 021E +021F 021F 021E +0220 019E 0220 +0222 0223 0222 +0223 0223 0222 +0224 0225 0224 +0225 0225 0224 +0226 0227 0226 +0227 0227 0226 +0228 0229 0228 +0229 0229 0228 +022A 022B 022A +022B 022B 022A +022C 022D 022C +022D 022D 022C +022E 022F 022E +022F 022F 022E +0230 0231 0230 +0231 0231 0230 +0232 0233 0232 +0233 0233 0232 +023A 2C65 023A +023B 023C 023B +023C 023C 023B +023D 019A 023D +023E 2C66 023E +023F 023F 2C7E +0240 0240 2C7F +0241 0242 0241 +0242 0242 0241 +0243 0180 0243 +0244 0289 0244 +0245 028C 0245 +0246 0247 0246 +0247 0247 0246 +0248 0249 0248 +0249 0249 0248 +024A 024B 024A +024B 024B 024A +024C 024D 024C +024D 024D 024C +024E 024F 024E +024F 024F 024E +0250 0250 2C6F +0251 0251 2C6D +0252 0252 2C70 +0253 0253 0181 +0254 0254 0186 +0256 0256 0189 +0257 0257 018A +0259 0259 018F +025B 025B 0190 +0260 0260 0193 +0263 0263 0194 +0268 0268 0197 +0269 0269 0196 +026B 026B 2C62 +026F 026F 019C +0271 0271 2C6E +0272 0272 019D +0275 0275 019F +027D 027D 2C64 +0280 0280 01A6 +0283 0283 01A9 +0288 0288 01AE +0289 0289 0244 +028A 028A 01B1 +028B 028B 01B2 +028C 028C 0245 +0292 0292 01B7 +0345 0345 0399 +0370 0371 0370 +0371 0371 0370 +0372 0373 0372 +0373 0373 0372 +0376 0377 0376 +0377 0377 0376 +037B 037B 03FD +037C 037C 03FE +037D 037D 03FF +0386 03AC 0386 +0388 03AD 0388 +0389 03AE 0389 +038A 03AF 038A +038C 03CC 038C +038E 03CD 038E +038F 03CE 038F +0391 03B1 0391 +0392 03B2 0392 +0393 03B3 0393 +0394 03B4 0394 +0395 03B5 0395 +0396 03B6 0396 +0397 03B7 0397 +0398 03B8 0398 +0399 03B9 0399 +039A 03BA 039A +039B 03BB 039B +039C 03BC 039C +039D 03BD 039D +039E 03BE 039E +039F 03BF 039F +03A0 03C0 03A0 +03A1 03C1 03A1 +03A3 03C3 03A3 +03A4 03C4 03A4 +03A5 03C5 03A5 +03A6 03C6 03A6 +03A7 03C7 03A7 +03A8 03C8 03A8 +03A9 03C9 03A9 +03AA 03CA 03AA +03AB 03CB 03AB +03AC 03AC 0386 +03AD 03AD 0388 +03AE 03AE 0389 +03AF 03AF 038A +03B1 03B1 0391 +03B2 03B2 0392 +03B3 03B3 0393 +03B4 03B4 0394 +03B5 03B5 0395 +03B6 03B6 0396 +03B7 03B7 0397 +03B8 03B8 0398 +03B9 03B9 0399 +03BA 03BA 039A +03BB 03BB 039B +03BC 03BC 039C +03BD 03BD 039D +03BE 03BE 039E +03BF 03BF 039F +03C0 03C0 03A0 +03C1 03C1 03A1 +03C2 03C2 03A3 +03C3 03C3 03A3 +03C4 03C4 03A4 +03C5 03C5 03A5 +03C6 03C6 03A6 +03C7 03C7 03A7 +03C8 03C8 03A8 +03C9 03C9 03A9 +03CA 03CA 03AA +03CB 03CB 03AB +03CC 03CC 038C +03CD 03CD 038E +03CE 03CE 038F +03CF 03D7 03CF +03D0 03D0 0392 +03D1 03D1 0398 +03D5 03D5 03A6 +03D6 03D6 03A0 +03D7 03D7 03CF +03D8 03D9 03D8 +03D9 03D9 03D8 +03DA 03DB 03DA +03DB 03DB 03DA +03DC 03DD 03DC +03DD 03DD 03DC +03DE 03DF 03DE +03DF 03DF 03DE +03E0 03E1 03E0 +03E1 03E1 03E0 +03E2 03E3 03E2 +03E3 03E3 03E2 +03E4 03E5 03E4 +03E5 03E5 03E4 +03E6 03E7 03E6 +03E7 03E7 03E6 +03E8 03E9 03E8 +03E9 03E9 03E8 +03EA 03EB 03EA +03EB 03EB 03EA +03EC 03ED 03EC +03ED 03ED 03EC +03EE 03EF 03EE +03EF 03EF 03EE +03F0 03F0 039A +03F1 03F1 03A1 +03F2 03F2 03F9 +03F4 03B8 03F4 +03F5 03F5 0395 +03F7 03F8 03F7 +03F8 03F8 03F7 +03F9 03F2 03F9 +03FA 03FB 03FA +03FB 03FB 03FA +03FD 037B 03FD +03FE 037C 03FE +03FF 037D 03FF +0400 0450 0400 +0401 0451 0401 +0402 0452 0402 +0403 0453 0403 +0404 0454 0404 +0405 0455 0405 +0406 0456 0406 +0407 0457 0407 +0408 0458 0408 +0409 0459 0409 +040A 045A 040A +040B 045B 040B +040C 045C 040C +040D 045D 040D +040E 045E 040E +040F 045F 040F +0410 0430 0410 +0411 0431 0411 +0412 0432 0412 +0413 0433 0413 +0414 0434 0414 +0415 0435 0415 +0416 0436 0416 +0417 0437 0417 +0418 0438 0418 +0419 0439 0419 +041A 043A 041A +041B 043B 041B +041C 043C 041C +041D 043D 041D +041E 043E 041E +041F 043F 041F +0420 0440 0420 +0421 0441 0421 +0422 0442 0422 +0423 0443 0423 +0424 0444 0424 +0425 0445 0425 +0426 0446 0426 +0427 0447 0427 +0428 0448 0428 +0429 0449 0429 +042A 044A 042A +042B 044B 042B +042C 044C 042C +042D 044D 042D +042E 044E 042E +042F 044F 042F +0430 0430 0410 +0431 0431 0411 +0432 0432 0412 +0433 0433 0413 +0434 0434 0414 +0435 0435 0415 +0436 0436 0416 +0437 0437 0417 +0438 0438 0418 +0439 0439 0419 +043A 043A 041A +043B 043B 041B +043C 043C 041C +043D 043D 041D +043E 043E 041E +043F 043F 041F +0440 0440 0420 +0441 0441 0421 +0442 0442 0422 +0443 0443 0423 +0444 0444 0424 +0445 0445 0425 +0446 0446 0426 +0447 0447 0427 +0448 0448 0428 +0449 0449 0429 +044A 044A 042A +044B 044B 042B +044C 044C 042C +044D 044D 042D +044E 044E 042E +044F 044F 042F +0450 0450 0400 +0451 0451 0401 +0452 0452 0402 +0453 0453 0403 +0454 0454 0404 +0455 0455 0405 +0456 0456 0406 +0457 0457 0407 +0458 0458 0408 +0459 0459 0409 +045A 045A 040A +045B 045B 040B +045C 045C 040C +045D 045D 040D +045E 045E 040E +045F 045F 040F +0460 0461 0460 +0461 0461 0460 +0462 0463 0462 +0463 0463 0462 +0464 0465 0464 +0465 0465 0464 +0466 0467 0466 +0467 0467 0466 +0468 0469 0468 +0469 0469 0468 +046A 046B 046A +046B 046B 046A +046C 046D 046C +046D 046D 046C +046E 046F 046E +046F 046F 046E +0470 0471 0470 +0471 0471 0470 +0472 0473 0472 +0473 0473 0472 +0474 0475 0474 +0475 0475 0474 +0476 0477 0476 +0477 0477 0476 +0478 0479 0478 +0479 0479 0478 +047A 047B 047A +047B 047B 047A +047C 047D 047C +047D 047D 047C +047E 047F 047E +047F 047F 047E +0480 0481 0480 +0481 0481 0480 +048A 048B 048A +048B 048B 048A +048C 048D 048C +048D 048D 048C +048E 048F 048E +048F 048F 048E +0490 0491 0490 +0491 0491 0490 +0492 0493 0492 +0493 0493 0492 +0494 0495 0494 +0495 0495 0494 +0496 0497 0496 +0497 0497 0496 +0498 0499 0498 +0499 0499 0498 +049A 049B 049A +049B 049B 049A +049C 049D 049C +049D 049D 049C +049E 049F 049E +049F 049F 049E +04A0 04A1 04A0 +04A1 04A1 04A0 +04A2 04A3 04A2 +04A3 04A3 04A2 +04A4 04A5 04A4 +04A5 04A5 04A4 +04A6 04A7 04A6 +04A7 04A7 04A6 +04A8 04A9 04A8 +04A9 04A9 04A8 +04AA 04AB 04AA +04AB 04AB 04AA +04AC 04AD 04AC +04AD 04AD 04AC +04AE 04AF 04AE +04AF 04AF 04AE +04B0 04B1 04B0 +04B1 04B1 04B0 +04B2 04B3 04B2 +04B3 04B3 04B2 +04B4 04B5 04B4 +04B5 04B5 04B4 +04B6 04B7 04B6 +04B7 04B7 04B6 +04B8 04B9 04B8 +04B9 04B9 04B8 +04BA 04BB 04BA +04BB 04BB 04BA +04BC 04BD 04BC +04BD 04BD 04BC +04BE 04BF 04BE +04BF 04BF 04BE +04C0 04CF 04C0 +04C1 04C2 04C1 +04C2 04C2 04C1 +04C3 04C4 04C3 +04C4 04C4 04C3 +04C5 04C6 04C5 +04C6 04C6 04C5 +04C7 04C8 04C7 +04C8 04C8 04C7 +04C9 04CA 04C9 +04CA 04CA 04C9 +04CB 04CC 04CB +04CC 04CC 04CB +04CD 04CE 04CD +04CE 04CE 04CD +04CF 04CF 04C0 +04D0 04D1 04D0 +04D1 04D1 04D0 +04D2 04D3 04D2 +04D3 04D3 04D2 +04D4 04D5 04D4 +04D5 04D5 04D4 +04D6 04D7 04D6 +04D7 04D7 04D6 +04D8 04D9 04D8 +04D9 04D9 04D8 +04DA 04DB 04DA +04DB 04DB 04DA +04DC 04DD 04DC +04DD 04DD 04DC +04DE 04DF 04DE +04DF 04DF 04DE +04E0 04E1 04E0 +04E1 04E1 04E0 +04E2 04E3 04E2 +04E3 04E3 04E2 +04E4 04E5 04E4 +04E5 04E5 04E4 +04E6 04E7 04E6 +04E7 04E7 04E6 +04E8 04E9 04E8 +04E9 04E9 04E8 +04EA 04EB 04EA +04EB 04EB 04EA +04EC 04ED 04EC +04ED 04ED 04EC +04EE 04EF 04EE +04EF 04EF 04EE +04F0 04F1 04F0 +04F1 04F1 04F0 +04F2 04F3 04F2 +04F3 04F3 04F2 +04F4 04F5 04F4 +04F5 04F5 04F4 +04F6 04F7 04F6 +04F7 04F7 04F6 +04F8 04F9 04F8 +04F9 04F9 04F8 +04FA 04FB 04FA +04FB 04FB 04FA +04FC 04FD 04FC +04FD 04FD 04FC +04FE 04FF 04FE +04FF 04FF 04FE +0500 0501 0500 +0501 0501 0500 +0502 0503 0502 +0503 0503 0502 +0504 0505 0504 +0505 0505 0504 +0506 0507 0506 +0507 0507 0506 +0508 0509 0508 +0509 0509 0508 +050A 050B 050A +050B 050B 050A +050C 050D 050C +050D 050D 050C +050E 050F 050E +050F 050F 050E +0510 0511 0510 +0511 0511 0510 +0512 0513 0512 +0513 0513 0512 +0514 0515 0514 +0515 0515 0514 +0516 0517 0516 +0517 0517 0516 +0518 0519 0518 +0519 0519 0518 +051A 051B 051A +051B 051B 051A +051C 051D 051C +051D 051D 051C +051E 051F 051E +051F 051F 051E +0520 0521 0520 +0521 0521 0520 +0522 0523 0522 +0523 0523 0522 +0524 0525 0524 +0525 0525 0524 +0531 0561 0531 +0532 0562 0532 +0533 0563 0533 +0534 0564 0534 +0535 0565 0535 +0536 0566 0536 +0537 0567 0537 +0538 0568 0538 +0539 0569 0539 +053A 056A 053A +053B 056B 053B +053C 056C 053C +053D 056D 053D +053E 056E 053E +053F 056F 053F +0540 0570 0540 +0541 0571 0541 +0542 0572 0542 +0543 0573 0543 +0544 0574 0544 +0545 0575 0545 +0546 0576 0546 +0547 0577 0547 +0548 0578 0548 +0549 0579 0549 +054A 057A 054A +054B 057B 054B +054C 057C 054C +054D 057D 054D +054E 057E 054E +054F 057F 054F +0550 0580 0550 +0551 0581 0551 +0552 0582 0552 +0553 0583 0553 +0554 0584 0554 +0555 0585 0555 +0556 0586 0556 +0561 0561 0531 +0562 0562 0532 +0563 0563 0533 +0564 0564 0534 +0565 0565 0535 +0566 0566 0536 +0567 0567 0537 +0568 0568 0538 +0569 0569 0539 +056A 056A 053A +056B 056B 053B +056C 056C 053C +056D 056D 053D +056E 056E 053E +056F 056F 053F +0570 0570 0540 +0571 0571 0541 +0572 0572 0542 +0573 0573 0543 +0574 0574 0544 +0575 0575 0545 +0576 0576 0546 +0577 0577 0547 +0578 0578 0548 +0579 0579 0549 +057A 057A 054A +057B 057B 054B +057C 057C 054C +057D 057D 054D +057E 057E 054E +057F 057F 054F +0580 0580 0550 +0581 0581 0551 +0582 0582 0552 +0583 0583 0553 +0584 0584 0554 +0585 0585 0555 +0586 0586 0556 +10A0 2D00 10A0 +10A1 2D01 10A1 +10A2 2D02 10A2 +10A3 2D03 10A3 +10A4 2D04 10A4 +10A5 2D05 10A5 +10A6 2D06 10A6 +10A7 2D07 10A7 +10A8 2D08 10A8 +10A9 2D09 10A9 +10AA 2D0A 10AA +10AB 2D0B 10AB +10AC 2D0C 10AC +10AD 2D0D 10AD +10AE 2D0E 10AE +10AF 2D0F 10AF +10B0 2D10 10B0 +10B1 2D11 10B1 +10B2 2D12 10B2 +10B3 2D13 10B3 +10B4 2D14 10B4 +10B5 2D15 10B5 +10B6 2D16 10B6 +10B7 2D17 10B7 +10B8 2D18 10B8 +10B9 2D19 10B9 +10BA 2D1A 10BA +10BB 2D1B 10BB +10BC 2D1C 10BC +10BD 2D1D 10BD +10BE 2D1E 10BE +10BF 2D1F 10BF +10C0 2D20 10C0 +10C1 2D21 10C1 +10C2 2D22 10C2 +10C3 2D23 10C3 +10C4 2D24 10C4 +10C5 2D25 10C5 +1D79 1D79 A77D +1D7D 1D7D 2C63 +1E00 1E01 1E00 +1E01 1E01 1E00 +1E02 1E03 1E02 +1E03 1E03 1E02 +1E04 1E05 1E04 +1E05 1E05 1E04 +1E06 1E07 1E06 +1E07 1E07 1E06 +1E08 1E09 1E08 +1E09 1E09 1E08 +1E0A 1E0B 1E0A +1E0B 1E0B 1E0A +1E0C 1E0D 1E0C +1E0D 1E0D 1E0C +1E0E 1E0F 1E0E +1E0F 1E0F 1E0E +1E10 1E11 1E10 +1E11 1E11 1E10 +1E12 1E13 1E12 +1E13 1E13 1E12 +1E14 1E15 1E14 +1E15 1E15 1E14 +1E16 1E17 1E16 +1E17 1E17 1E16 +1E18 1E19 1E18 +1E19 1E19 1E18 +1E1A 1E1B 1E1A +1E1B 1E1B 1E1A +1E1C 1E1D 1E1C +1E1D 1E1D 1E1C +1E1E 1E1F 1E1E +1E1F 1E1F 1E1E +1E20 1E21 1E20 +1E21 1E21 1E20 +1E22 1E23 1E22 +1E23 1E23 1E22 +1E24 1E25 1E24 +1E25 1E25 1E24 +1E26 1E27 1E26 +1E27 1E27 1E26 +1E28 1E29 1E28 +1E29 1E29 1E28 +1E2A 1E2B 1E2A +1E2B 1E2B 1E2A +1E2C 1E2D 1E2C +1E2D 1E2D 1E2C +1E2E 1E2F 1E2E +1E2F 1E2F 1E2E +1E30 1E31 1E30 +1E31 1E31 1E30 +1E32 1E33 1E32 +1E33 1E33 1E32 +1E34 1E35 1E34 +1E35 1E35 1E34 +1E36 1E37 1E36 +1E37 1E37 1E36 +1E38 1E39 1E38 +1E39 1E39 1E38 +1E3A 1E3B 1E3A +1E3B 1E3B 1E3A +1E3C 1E3D 1E3C +1E3D 1E3D 1E3C +1E3E 1E3F 1E3E +1E3F 1E3F 1E3E +1E40 1E41 1E40 +1E41 1E41 1E40 +1E42 1E43 1E42 +1E43 1E43 1E42 +1E44 1E45 1E44 +1E45 1E45 1E44 +1E46 1E47 1E46 +1E47 1E47 1E46 +1E48 1E49 1E48 +1E49 1E49 1E48 +1E4A 1E4B 1E4A +1E4B 1E4B 1E4A +1E4C 1E4D 1E4C +1E4D 1E4D 1E4C +1E4E 1E4F 1E4E +1E4F 1E4F 1E4E +1E50 1E51 1E50 +1E51 1E51 1E50 +1E52 1E53 1E52 +1E53 1E53 1E52 +1E54 1E55 1E54 +1E55 1E55 1E54 +1E56 1E57 1E56 +1E57 1E57 1E56 +1E58 1E59 1E58 +1E59 1E59 1E58 +1E5A 1E5B 1E5A +1E5B 1E5B 1E5A +1E5C 1E5D 1E5C +1E5D 1E5D 1E5C +1E5E 1E5F 1E5E +1E5F 1E5F 1E5E +1E60 1E61 1E60 +1E61 1E61 1E60 +1E62 1E63 1E62 +1E63 1E63 1E62 +1E64 1E65 1E64 +1E65 1E65 1E64 +1E66 1E67 1E66 +1E67 1E67 1E66 +1E68 1E69 1E68 +1E69 1E69 1E68 +1E6A 1E6B 1E6A +1E6B 1E6B 1E6A +1E6C 1E6D 1E6C +1E6D 1E6D 1E6C +1E6E 1E6F 1E6E +1E6F 1E6F 1E6E +1E70 1E71 1E70 +1E71 1E71 1E70 +1E72 1E73 1E72 +1E73 1E73 1E72 +1E74 1E75 1E74 +1E75 1E75 1E74 +1E76 1E77 1E76 +1E77 1E77 1E76 +1E78 1E79 1E78 +1E79 1E79 1E78 +1E7A 1E7B 1E7A +1E7B 1E7B 1E7A +1E7C 1E7D 1E7C +1E7D 1E7D 1E7C +1E7E 1E7F 1E7E +1E7F 1E7F 1E7E +1E80 1E81 1E80 +1E81 1E81 1E80 +1E82 1E83 1E82 +1E83 1E83 1E82 +1E84 1E85 1E84 +1E85 1E85 1E84 +1E86 1E87 1E86 +1E87 1E87 1E86 +1E88 1E89 1E88 +1E89 1E89 1E88 +1E8A 1E8B 1E8A +1E8B 1E8B 1E8A +1E8C 1E8D 1E8C +1E8D 1E8D 1E8C +1E8E 1E8F 1E8E +1E8F 1E8F 1E8E +1E90 1E91 1E90 +1E91 1E91 1E90 +1E92 1E93 1E92 +1E93 1E93 1E92 +1E94 1E95 1E94 +1E95 1E95 1E94 +1E9B 1E9B 1E60 +1E9E 00DF 1E9E +1EA0 1EA1 1EA0 +1EA1 1EA1 1EA0 +1EA2 1EA3 1EA2 +1EA3 1EA3 1EA2 +1EA4 1EA5 1EA4 +1EA5 1EA5 1EA4 +1EA6 1EA7 1EA6 +1EA7 1EA7 1EA6 +1EA8 1EA9 1EA8 +1EA9 1EA9 1EA8 +1EAA 1EAB 1EAA +1EAB 1EAB 1EAA +1EAC 1EAD 1EAC +1EAD 1EAD 1EAC +1EAE 1EAF 1EAE +1EAF 1EAF 1EAE +1EB0 1EB1 1EB0 +1EB1 1EB1 1EB0 +1EB2 1EB3 1EB2 +1EB3 1EB3 1EB2 +1EB4 1EB5 1EB4 +1EB5 1EB5 1EB4 +1EB6 1EB7 1EB6 +1EB7 1EB7 1EB6 +1EB8 1EB9 1EB8 +1EB9 1EB9 1EB8 +1EBA 1EBB 1EBA +1EBB 1EBB 1EBA +1EBC 1EBD 1EBC +1EBD 1EBD 1EBC +1EBE 1EBF 1EBE +1EBF 1EBF 1EBE +1EC0 1EC1 1EC0 +1EC1 1EC1 1EC0 +1EC2 1EC3 1EC2 +1EC3 1EC3 1EC2 +1EC4 1EC5 1EC4 +1EC5 1EC5 1EC4 +1EC6 1EC7 1EC6 +1EC7 1EC7 1EC6 +1EC8 1EC9 1EC8 +1EC9 1EC9 1EC8 +1ECA 1ECB 1ECA +1ECB 1ECB 1ECA +1ECC 1ECD 1ECC +1ECD 1ECD 1ECC +1ECE 1ECF 1ECE +1ECF 1ECF 1ECE +1ED0 1ED1 1ED0 +1ED1 1ED1 1ED0 +1ED2 1ED3 1ED2 +1ED3 1ED3 1ED2 +1ED4 1ED5 1ED4 +1ED5 1ED5 1ED4 +1ED6 1ED7 1ED6 +1ED7 1ED7 1ED6 +1ED8 1ED9 1ED8 +1ED9 1ED9 1ED8 +1EDA 1EDB 1EDA +1EDB 1EDB 1EDA +1EDC 1EDD 1EDC +1EDD 1EDD 1EDC +1EDE 1EDF 1EDE +1EDF 1EDF 1EDE +1EE0 1EE1 1EE0 +1EE1 1EE1 1EE0 +1EE2 1EE3 1EE2 +1EE3 1EE3 1EE2 +1EE4 1EE5 1EE4 +1EE5 1EE5 1EE4 +1EE6 1EE7 1EE6 +1EE7 1EE7 1EE6 +1EE8 1EE9 1EE8 +1EE9 1EE9 1EE8 +1EEA 1EEB 1EEA +1EEB 1EEB 1EEA +1EEC 1EED 1EEC +1EED 1EED 1EEC +1EEE 1EEF 1EEE +1EEF 1EEF 1EEE +1EF0 1EF1 1EF0 +1EF1 1EF1 1EF0 +1EF2 1EF3 1EF2 +1EF3 1EF3 1EF2 +1EF4 1EF5 1EF4 +1EF5 1EF5 1EF4 +1EF6 1EF7 1EF6 +1EF7 1EF7 1EF6 +1EF8 1EF9 1EF8 +1EF9 1EF9 1EF8 +1EFA 1EFB 1EFA +1EFB 1EFB 1EFA +1EFC 1EFD 1EFC +1EFD 1EFD 1EFC +1EFE 1EFF 1EFE +1EFF 1EFF 1EFE +1F00 1F00 1F08 +1F01 1F01 1F09 +1F02 1F02 1F0A +1F03 1F03 1F0B +1F04 1F04 1F0C +1F05 1F05 1F0D +1F06 1F06 1F0E +1F07 1F07 1F0F +1F08 1F00 1F08 +1F09 1F01 1F09 +1F0A 1F02 1F0A +1F0B 1F03 1F0B +1F0C 1F04 1F0C +1F0D 1F05 1F0D +1F0E 1F06 1F0E +1F0F 1F07 1F0F +1F10 1F10 1F18 +1F11 1F11 1F19 +1F12 1F12 1F1A +1F13 1F13 1F1B +1F14 1F14 1F1C +1F15 1F15 1F1D +1F18 1F10 1F18 +1F19 1F11 1F19 +1F1A 1F12 1F1A +1F1B 1F13 1F1B +1F1C 1F14 1F1C +1F1D 1F15 1F1D +1F20 1F20 1F28 +1F21 1F21 1F29 +1F22 1F22 1F2A +1F23 1F23 1F2B +1F24 1F24 1F2C +1F25 1F25 1F2D +1F26 1F26 1F2E +1F27 1F27 1F2F +1F28 1F20 1F28 +1F29 1F21 1F29 +1F2A 1F22 1F2A +1F2B 1F23 1F2B +1F2C 1F24 1F2C +1F2D 1F25 1F2D +1F2E 1F26 1F2E +1F2F 1F27 1F2F +1F30 1F30 1F38 +1F31 1F31 1F39 +1F32 1F32 1F3A +1F33 1F33 1F3B +1F34 1F34 1F3C +1F35 1F35 1F3D +1F36 1F36 1F3E +1F37 1F37 1F3F +1F38 1F30 1F38 +1F39 1F31 1F39 +1F3A 1F32 1F3A +1F3B 1F33 1F3B +1F3C 1F34 1F3C +1F3D 1F35 1F3D +1F3E 1F36 1F3E +1F3F 1F37 1F3F +1F40 1F40 1F48 +1F41 1F41 1F49 +1F42 1F42 1F4A +1F43 1F43 1F4B +1F44 1F44 1F4C +1F45 1F45 1F4D +1F48 1F40 1F48 +1F49 1F41 1F49 +1F4A 1F42 1F4A +1F4B 1F43 1F4B +1F4C 1F44 1F4C +1F4D 1F45 1F4D +1F51 1F51 1F59 +1F53 1F53 1F5B +1F55 1F55 1F5D +1F57 1F57 1F5F +1F59 1F51 1F59 +1F5B 1F53 1F5B +1F5D 1F55 1F5D +1F5F 1F57 1F5F +1F60 1F60 1F68 +1F61 1F61 1F69 +1F62 1F62 1F6A +1F63 1F63 1F6B +1F64 1F64 1F6C +1F65 1F65 1F6D +1F66 1F66 1F6E +1F67 1F67 1F6F +1F68 1F60 1F68 +1F69 1F61 1F69 +1F6A 1F62 1F6A +1F6B 1F63 1F6B +1F6C 1F64 1F6C +1F6D 1F65 1F6D +1F6E 1F66 1F6E +1F6F 1F67 1F6F +1F70 1F70 1FBA +1F71 1F71 1FBB +1F72 1F72 1FC8 +1F73 1F73 1FC9 +1F74 1F74 1FCA +1F75 1F75 1FCB +1F76 1F76 1FDA +1F77 1F77 1FDB +1F78 1F78 1FF8 +1F79 1F79 1FF9 +1F7A 1F7A 1FEA +1F7B 1F7B 1FEB +1F7C 1F7C 1FFA +1F7D 1F7D 1FFB +1F80 1F80 1F88 +1F81 1F81 1F89 +1F82 1F82 1F8A +1F83 1F83 1F8B +1F84 1F84 1F8C +1F85 1F85 1F8D +1F86 1F86 1F8E +1F87 1F87 1F8F +1F88 1F80 1F88 +1F89 1F81 1F89 +1F8A 1F82 1F8A +1F8B 1F83 1F8B +1F8C 1F84 1F8C +1F8D 1F85 1F8D +1F8E 1F86 1F8E +1F8F 1F87 1F8F +1F90 1F90 1F98 +1F91 1F91 1F99 +1F92 1F92 1F9A +1F93 1F93 1F9B +1F94 1F94 1F9C +1F95 1F95 1F9D +1F96 1F96 1F9E +1F97 1F97 1F9F +1F98 1F90 1F98 +1F99 1F91 1F99 +1F9A 1F92 1F9A +1F9B 1F93 1F9B +1F9C 1F94 1F9C +1F9D 1F95 1F9D +1F9E 1F96 1F9E +1F9F 1F97 1F9F +1FA0 1FA0 1FA8 +1FA1 1FA1 1FA9 +1FA2 1FA2 1FAA +1FA3 1FA3 1FAB +1FA4 1FA4 1FAC +1FA5 1FA5 1FAD +1FA6 1FA6 1FAE +1FA7 1FA7 1FAF +1FA8 1FA0 1FA8 +1FA9 1FA1 1FA9 +1FAA 1FA2 1FAA +1FAB 1FA3 1FAB +1FAC 1FA4 1FAC +1FAD 1FA5 1FAD +1FAE 1FA6 1FAE +1FAF 1FA7 1FAF +1FB0 1FB0 1FB8 +1FB1 1FB1 1FB9 +1FB3 1FB3 1FBC +1FB8 1FB0 1FB8 +1FB9 1FB1 1FB9 +1FBA 1F70 1FBA +1FBB 1F71 1FBB +1FBC 1FB3 1FBC +1FBE 1FBE 0399 +1FC3 1FC3 1FCC +1FC8 1F72 1FC8 +1FC9 1F73 1FC9 +1FCA 1F74 1FCA +1FCB 1F75 1FCB +1FCC 1FC3 1FCC +1FD0 1FD0 1FD8 +1FD1 1FD1 1FD9 +1FD8 1FD0 1FD8 +1FD9 1FD1 1FD9 +1FDA 1F76 1FDA +1FDB 1F77 1FDB +1FE0 1FE0 1FE8 +1FE1 1FE1 1FE9 +1FE5 1FE5 1FEC +1FE8 1FE0 1FE8 +1FE9 1FE1 1FE9 +1FEA 1F7A 1FEA +1FEB 1F7B 1FEB +1FEC 1FE5 1FEC +1FF3 1FF3 1FFC +1FF8 1F78 1FF8 +1FF9 1F79 1FF9 +1FFA 1F7C 1FFA +1FFB 1F7D 1FFB +1FFC 1FF3 1FFC +2126 03C9 2126 +212A 006B 212A +212B 00E5 212B +2132 214E 2132 +214E 214E 2132 +2160 2170 2160 +2161 2171 2161 +2162 2172 2162 +2163 2173 2163 +2164 2174 2164 +2165 2175 2165 +2166 2176 2166 +2167 2177 2167 +2168 2178 2168 +2169 2179 2169 +216A 217A 216A +216B 217B 216B +216C 217C 216C +216D 217D 216D +216E 217E 216E +216F 217F 216F +2170 2170 2160 +2171 2171 2161 +2172 2172 2162 +2173 2173 2163 +2174 2174 2164 +2175 2175 2165 +2176 2176 2166 +2177 2177 2167 +2178 2178 2168 +2179 2179 2169 +217A 217A 216A +217B 217B 216B +217C 217C 216C +217D 217D 216D +217E 217E 216E +217F 217F 216F +2183 2184 2183 +2184 2184 2183 +24B6 24D0 24B6 +24B7 24D1 24B7 +24B8 24D2 24B8 +24B9 24D3 24B9 +24BA 24D4 24BA +24BB 24D5 24BB +24BC 24D6 24BC +24BD 24D7 24BD +24BE 24D8 24BE +24BF 24D9 24BF +24C0 24DA 24C0 +24C1 24DB 24C1 +24C2 24DC 24C2 +24C3 24DD 24C3 +24C4 24DE 24C4 +24C5 24DF 24C5 +24C6 24E0 24C6 +24C7 24E1 24C7 +24C8 24E2 24C8 +24C9 24E3 24C9 +24CA 24E4 24CA +24CB 24E5 24CB +24CC 24E6 24CC +24CD 24E7 24CD +24CE 24E8 24CE +24CF 24E9 24CF +24D0 24D0 24B6 +24D1 24D1 24B7 +24D2 24D2 24B8 +24D3 24D3 24B9 +24D4 24D4 24BA +24D5 24D5 24BB +24D6 24D6 24BC +24D7 24D7 24BD +24D8 24D8 24BE +24D9 24D9 24BF +24DA 24DA 24C0 +24DB 24DB 24C1 +24DC 24DC 24C2 +24DD 24DD 24C3 +24DE 24DE 24C4 +24DF 24DF 24C5 +24E0 24E0 24C6 +24E1 24E1 24C7 +24E2 24E2 24C8 +24E3 24E3 24C9 +24E4 24E4 24CA +24E5 24E5 24CB +24E6 24E6 24CC +24E7 24E7 24CD +24E8 24E8 24CE +24E9 24E9 24CF +2C00 2C30 2C00 +2C01 2C31 2C01 +2C02 2C32 2C02 +2C03 2C33 2C03 +2C04 2C34 2C04 +2C05 2C35 2C05 +2C06 2C36 2C06 +2C07 2C37 2C07 +2C08 2C38 2C08 +2C09 2C39 2C09 +2C0A 2C3A 2C0A +2C0B 2C3B 2C0B +2C0C 2C3C 2C0C +2C0D 2C3D 2C0D +2C0E 2C3E 2C0E +2C0F 2C3F 2C0F +2C10 2C40 2C10 +2C11 2C41 2C11 +2C12 2C42 2C12 +2C13 2C43 2C13 +2C14 2C44 2C14 +2C15 2C45 2C15 +2C16 2C46 2C16 +2C17 2C47 2C17 +2C18 2C48 2C18 +2C19 2C49 2C19 +2C1A 2C4A 2C1A +2C1B 2C4B 2C1B +2C1C 2C4C 2C1C +2C1D 2C4D 2C1D +2C1E 2C4E 2C1E +2C1F 2C4F 2C1F +2C20 2C50 2C20 +2C21 2C51 2C21 +2C22 2C52 2C22 +2C23 2C53 2C23 +2C24 2C54 2C24 +2C25 2C55 2C25 +2C26 2C56 2C26 +2C27 2C57 2C27 +2C28 2C58 2C28 +2C29 2C59 2C29 +2C2A 2C5A 2C2A +2C2B 2C5B 2C2B +2C2C 2C5C 2C2C +2C2D 2C5D 2C2D +2C2E 2C5E 2C2E +2C30 2C30 2C00 +2C31 2C31 2C01 +2C32 2C32 2C02 +2C33 2C33 2C03 +2C34 2C34 2C04 +2C35 2C35 2C05 +2C36 2C36 2C06 +2C37 2C37 2C07 +2C38 2C38 2C08 +2C39 2C39 2C09 +2C3A 2C3A 2C0A +2C3B 2C3B 2C0B +2C3C 2C3C 2C0C +2C3D 2C3D 2C0D +2C3E 2C3E 2C0E +2C3F 2C3F 2C0F +2C40 2C40 2C10 +2C41 2C41 2C11 +2C42 2C42 2C12 +2C43 2C43 2C13 +2C44 2C44 2C14 +2C45 2C45 2C15 +2C46 2C46 2C16 +2C47 2C47 2C17 +2C48 2C48 2C18 +2C49 2C49 2C19 +2C4A 2C4A 2C1A +2C4B 2C4B 2C1B +2C4C 2C4C 2C1C +2C4D 2C4D 2C1D +2C4E 2C4E 2C1E +2C4F 2C4F 2C1F +2C50 2C50 2C20 +2C51 2C51 2C21 +2C52 2C52 2C22 +2C53 2C53 2C23 +2C54 2C54 2C24 +2C55 2C55 2C25 +2C56 2C56 2C26 +2C57 2C57 2C27 +2C58 2C58 2C28 +2C59 2C59 2C29 +2C5A 2C5A 2C2A +2C5B 2C5B 2C2B +2C5C 2C5C 2C2C +2C5D 2C5D 2C2D +2C5E 2C5E 2C2E +2C60 2C61 2C60 +2C61 2C61 2C60 +2C62 026B 2C62 +2C63 1D7D 2C63 +2C64 027D 2C64 +2C65 2C65 023A +2C66 2C66 023E +2C67 2C68 2C67 +2C68 2C68 2C67 +2C69 2C6A 2C69 +2C6A 2C6A 2C69 +2C6B 2C6C 2C6B +2C6C 2C6C 2C6B +2C6D 0251 2C6D +2C6E 0271 2C6E +2C6F 0250 2C6F +2C70 0252 2C70 +2C72 2C73 2C72 +2C73 2C73 2C72 +2C75 2C76 2C75 +2C76 2C76 2C75 +2C7E 023F 2C7E +2C7F 0240 2C7F +2C80 2C81 2C80 +2C81 2C81 2C80 +2C82 2C83 2C82 +2C83 2C83 2C82 +2C84 2C85 2C84 +2C85 2C85 2C84 +2C86 2C87 2C86 +2C87 2C87 2C86 +2C88 2C89 2C88 +2C89 2C89 2C88 +2C8A 2C8B 2C8A +2C8B 2C8B 2C8A +2C8C 2C8D 2C8C +2C8D 2C8D 2C8C +2C8E 2C8F 2C8E +2C8F 2C8F 2C8E +2C90 2C91 2C90 +2C91 2C91 2C90 +2C92 2C93 2C92 +2C93 2C93 2C92 +2C94 2C95 2C94 +2C95 2C95 2C94 +2C96 2C97 2C96 +2C97 2C97 2C96 +2C98 2C99 2C98 +2C99 2C99 2C98 +2C9A 2C9B 2C9A +2C9B 2C9B 2C9A +2C9C 2C9D 2C9C +2C9D 2C9D 2C9C +2C9E 2C9F 2C9E +2C9F 2C9F 2C9E +2CA0 2CA1 2CA0 +2CA1 2CA1 2CA0 +2CA2 2CA3 2CA2 +2CA3 2CA3 2CA2 +2CA4 2CA5 2CA4 +2CA5 2CA5 2CA4 +2CA6 2CA7 2CA6 +2CA7 2CA7 2CA6 +2CA8 2CA9 2CA8 +2CA9 2CA9 2CA8 +2CAA 2CAB 2CAA +2CAB 2CAB 2CAA +2CAC 2CAD 2CAC +2CAD 2CAD 2CAC +2CAE 2CAF 2CAE +2CAF 2CAF 2CAE +2CB0 2CB1 2CB0 +2CB1 2CB1 2CB0 +2CB2 2CB3 2CB2 +2CB3 2CB3 2CB2 +2CB4 2CB5 2CB4 +2CB5 2CB5 2CB4 +2CB6 2CB7 2CB6 +2CB7 2CB7 2CB6 +2CB8 2CB9 2CB8 +2CB9 2CB9 2CB8 +2CBA 2CBB 2CBA +2CBB 2CBB 2CBA +2CBC 2CBD 2CBC +2CBD 2CBD 2CBC +2CBE 2CBF 2CBE +2CBF 2CBF 2CBE +2CC0 2CC1 2CC0 +2CC1 2CC1 2CC0 +2CC2 2CC3 2CC2 +2CC3 2CC3 2CC2 +2CC4 2CC5 2CC4 +2CC5 2CC5 2CC4 +2CC6 2CC7 2CC6 +2CC7 2CC7 2CC6 +2CC8 2CC9 2CC8 +2CC9 2CC9 2CC8 +2CCA 2CCB 2CCA +2CCB 2CCB 2CCA +2CCC 2CCD 2CCC +2CCD 2CCD 2CCC +2CCE 2CCF 2CCE +2CCF 2CCF 2CCE +2CD0 2CD1 2CD0 +2CD1 2CD1 2CD0 +2CD2 2CD3 2CD2 +2CD3 2CD3 2CD2 +2CD4 2CD5 2CD4 +2CD5 2CD5 2CD4 +2CD6 2CD7 2CD6 +2CD7 2CD7 2CD6 +2CD8 2CD9 2CD8 +2CD9 2CD9 2CD8 +2CDA 2CDB 2CDA +2CDB 2CDB 2CDA +2CDC 2CDD 2CDC +2CDD 2CDD 2CDC +2CDE 2CDF 2CDE +2CDF 2CDF 2CDE +2CE0 2CE1 2CE0 +2CE1 2CE1 2CE0 +2CE2 2CE3 2CE2 +2CE3 2CE3 2CE2 +2CEB 2CEC 2CEB +2CEC 2CEC 2CEB +2CED 2CEE 2CED +2CEE 2CEE 2CED +2D00 2D00 10A0 +2D01 2D01 10A1 +2D02 2D02 10A2 +2D03 2D03 10A3 +2D04 2D04 10A4 +2D05 2D05 10A5 +2D06 2D06 10A6 +2D07 2D07 10A7 +2D08 2D08 10A8 +2D09 2D09 10A9 +2D0A 2D0A 10AA +2D0B 2D0B 10AB +2D0C 2D0C 10AC +2D0D 2D0D 10AD +2D0E 2D0E 10AE +2D0F 2D0F 10AF +2D10 2D10 10B0 +2D11 2D11 10B1 +2D12 2D12 10B2 +2D13 2D13 10B3 +2D14 2D14 10B4 +2D15 2D15 10B5 +2D16 2D16 10B6 +2D17 2D17 10B7 +2D18 2D18 10B8 +2D19 2D19 10B9 +2D1A 2D1A 10BA +2D1B 2D1B 10BB +2D1C 2D1C 10BC +2D1D 2D1D 10BD +2D1E 2D1E 10BE +2D1F 2D1F 10BF +2D20 2D20 10C0 +2D21 2D21 10C1 +2D22 2D22 10C2 +2D23 2D23 10C3 +2D24 2D24 10C4 +2D25 2D25 10C5 +A640 A641 A640 +A641 A641 A640 +A642 A643 A642 +A643 A643 A642 +A644 A645 A644 +A645 A645 A644 +A646 A647 A646 +A647 A647 A646 +A648 A649 A648 +A649 A649 A648 +A64A A64B A64A +A64B A64B A64A +A64C A64D A64C +A64D A64D A64C +A64E A64F A64E +A64F A64F A64E +A650 A651 A650 +A651 A651 A650 +A652 A653 A652 +A653 A653 A652 +A654 A655 A654 +A655 A655 A654 +A656 A657 A656 +A657 A657 A656 +A658 A659 A658 +A659 A659 A658 +A65A A65B A65A +A65B A65B A65A +A65C A65D A65C +A65D A65D A65C +A65E A65F A65E +A65F A65F A65E +A662 A663 A662 +A663 A663 A662 +A664 A665 A664 +A665 A665 A664 +A666 A667 A666 +A667 A667 A666 +A668 A669 A668 +A669 A669 A668 +A66A A66B A66A +A66B A66B A66A +A66C A66D A66C +A66D A66D A66C +A680 A681 A680 +A681 A681 A680 +A682 A683 A682 +A683 A683 A682 +A684 A685 A684 +A685 A685 A684 +A686 A687 A686 +A687 A687 A686 +A688 A689 A688 +A689 A689 A688 +A68A A68B A68A +A68B A68B A68A +A68C A68D A68C +A68D A68D A68C +A68E A68F A68E +A68F A68F A68E +A690 A691 A690 +A691 A691 A690 +A692 A693 A692 +A693 A693 A692 +A694 A695 A694 +A695 A695 A694 +A696 A697 A696 +A697 A697 A696 +A722 A723 A722 +A723 A723 A722 +A724 A725 A724 +A725 A725 A724 +A726 A727 A726 +A727 A727 A726 +A728 A729 A728 +A729 A729 A728 +A72A A72B A72A +A72B A72B A72A +A72C A72D A72C +A72D A72D A72C +A72E A72F A72E +A72F A72F A72E +A732 A733 A732 +A733 A733 A732 +A734 A735 A734 +A735 A735 A734 +A736 A737 A736 +A737 A737 A736 +A738 A739 A738 +A739 A739 A738 +A73A A73B A73A +A73B A73B A73A +A73C A73D A73C +A73D A73D A73C +A73E A73F A73E +A73F A73F A73E +A740 A741 A740 +A741 A741 A740 +A742 A743 A742 +A743 A743 A742 +A744 A745 A744 +A745 A745 A744 +A746 A747 A746 +A747 A747 A746 +A748 A749 A748 +A749 A749 A748 +A74A A74B A74A +A74B A74B A74A +A74C A74D A74C +A74D A74D A74C +A74E A74F A74E +A74F A74F A74E +A750 A751 A750 +A751 A751 A750 +A752 A753 A752 +A753 A753 A752 +A754 A755 A754 +A755 A755 A754 +A756 A757 A756 +A757 A757 A756 +A758 A759 A758 +A759 A759 A758 +A75A A75B A75A +A75B A75B A75A +A75C A75D A75C +A75D A75D A75C +A75E A75F A75E +A75F A75F A75E +A760 A761 A760 +A761 A761 A760 +A762 A763 A762 +A763 A763 A762 +A764 A765 A764 +A765 A765 A764 +A766 A767 A766 +A767 A767 A766 +A768 A769 A768 +A769 A769 A768 +A76A A76B A76A +A76B A76B A76A +A76C A76D A76C +A76D A76D A76C +A76E A76F A76E +A76F A76F A76E +A779 A77A A779 +A77A A77A A779 +A77B A77C A77B +A77C A77C A77B +A77D 1D79 A77D +A77E A77F A77E +A77F A77F A77E +A780 A781 A780 +A781 A781 A780 +A782 A783 A782 +A783 A783 A782 +A784 A785 A784 +A785 A785 A784 +A786 A787 A786 +A787 A787 A786 +A78B A78C A78B +A78C A78C A78B +FF21 FF41 FF21 +FF22 FF42 FF22 +FF23 FF43 FF23 +FF24 FF44 FF24 +FF25 FF45 FF25 +FF26 FF46 FF26 +FF27 FF47 FF27 +FF28 FF48 FF28 +FF29 FF49 FF29 +FF2A FF4A FF2A +FF2B FF4B FF2B +FF2C FF4C FF2C +FF2D FF4D FF2D +FF2E FF4E FF2E +FF2F FF4F FF2F +FF30 FF50 FF30 +FF31 FF51 FF31 +FF32 FF52 FF32 +FF33 FF53 FF33 +FF34 FF54 FF34 +FF35 FF55 FF35 +FF36 FF56 FF36 +FF37 FF57 FF37 +FF38 FF58 FF38 +FF39 FF59 FF39 +FF3A FF5A FF3A +FF41 FF41 FF21 +FF42 FF42 FF22 +FF43 FF43 FF23 +FF44 FF44 FF24 +FF45 FF45 FF25 +FF46 FF46 FF26 +FF47 FF47 FF27 +FF48 FF48 FF28 +FF49 FF49 FF29 +FF4A FF4A FF2A +FF4B FF4B FF2B +FF4C FF4C FF2C +FF4D FF4D FF2D +FF4E FF4E FF2E +FF4F FF4F FF2F +FF50 FF50 FF30 +FF51 FF51 FF31 +FF52 FF52 FF32 +FF53 FF53 FF33 +FF54 FF54 FF34 +FF55 FF55 FF35 +FF56 FF56 FF36 +FF57 FF57 FF37 +FF58 FF58 FF38 +FF59 FF59 FF39 +FF5A FF5A FF3A +DROP VIEW v_bmp; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_utf8mb3_unicode_520_ci_casefold.test b/mysql-test/main/ctype_utf8mb3_unicode_520_ci_casefold.test new file mode 100644 index 0000000000000..dc36bb41ab006 --- /dev/null +++ b/mysql-test/main/ctype_utf8mb3_unicode_520_ci_casefold.test @@ -0,0 +1,14 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_520_ci; +--source include/ctype_unicode_casefold_bmp.inc + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/ctype_utf8mb4.result b/mysql-test/main/ctype_utf8mb4.result index 97d28f6b7653c..834e1c8e859ea 100644 --- a/mysql-test/main/ctype_utf8mb4.result +++ b/mysql-test/main/ctype_utf8mb4.result @@ -127,8 +127,8 @@ create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d"); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; date_format("2004-01-19 10:10:10", "%Y-%m-%d") 2004-01-19 @@ -279,9 +279,9 @@ select null, null; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `s1` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL, - `s2` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `s1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `s2` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); @@ -367,8 +367,8 @@ create table t1 (a enum('aaaa','проба') character set utf8mb4); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('aaaa','проба') CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` enum('aaaa','проба') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('проба'); select * from t1; a @@ -377,8 +377,8 @@ create table t2 select ifnull(a,a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `ifnull(a,a)` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `ifnull(a,a)` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t2; ifnull(a,a) проба @@ -503,9 +503,9 @@ unique key a using hash (c(1)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` char(10) CHARACTER SET utf8mb4 DEFAULT NULL, + `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING HASH -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -539,9 +539,9 @@ unique key a using btree (c(1)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` char(10) CHARACTER SET utf8mb4 DEFAULT NULL, + `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING BTREE -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -663,7 +663,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING HASH -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -699,7 +699,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING BTREE -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -901,9 +901,9 @@ create table t2 select concat(a,_utf8mb4'') as a, concat(b,_utf8mb4'')as b from show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL, - `b` varchar(15) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `b` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; drop table t1; select 'c' like '\_' as want0; @@ -1132,9 +1132,9 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8mb4 DEFAULT NULL, + `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, `b` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; a b @@ -1240,7 +1240,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84); INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; @@ -2410,7 +2410,7 @@ t1 CREATE TABLE `t1` ( `Tape` tinytext DEFAULT NULL, PRIMARY KEY (`clipid`), KEY `tape` (`Tape`(250)) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci DROP TABLE t1; # # Testing 4-byte values. @@ -2553,7 +2553,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `u_decimal` int(11) NOT NULL, `utf8mb4_encoding` varchar(10) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb4_encoding),utf8mb4_encoding FROM t1; u_decimal hex(utf8mb4_encoding) utf8mb4_encoding 119040 3F ? @@ -2574,7 +2574,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `u_decimal` int(11) NOT NULL, `utf8mb3_encoding` varchar(10) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) 42856 EA9DA8 @@ -2586,7 +2586,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `u_decimal` int(11) NOT NULL, `utf8mb3_encoding` varchar(10) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) 42856 EA9DA8 @@ -2598,7 +2598,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `u_decimal` int(11) NOT NULL, `utf8mb4_encoding` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; u_decimal hex(utf8mb4_encoding) 119040 3F @@ -2618,8 +2618,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `u_decimal` int(11) NOT NULL, - `utf8mb4_encoding` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 + `utf8mb4_encoding` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; u_decimal hex(utf8mb4_encoding) 119040 3F @@ -2639,8 +2639,8 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `u_decimal` int(11) NOT NULL, - `utf8mb3_encoding` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 + `utf8mb3_encoding` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) 42856 EA9DA8 @@ -2685,10 +2685,10 @@ CREATE TEMPORARY TABLE t3 AS SELECT *, concat(utf8mb4,utf8mb3) FROM t1, t2; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TEMPORARY TABLE `t3` ( - `utf8mb4` varchar(10) CHARACTER SET utf8mb4 NOT NULL, - `utf8mb3` varchar(10) CHARACTER SET utf8mb3 NOT NULL, - `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `utf8mb4` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `utf8mb3` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TEMPORARY TABLE t3; SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3; utf8mb4 utf8mb3 @@ -2733,7 +2733,7 @@ t1 CREATE TABLE `t1` ( `subject` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `p` varchar(255) DEFAULT NULL, KEY `subject` (`subject`(250)) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci INSERT INTO t1(subject) VALUES ('abcd'); INSERT INTO t1(subject) VALUES(x'f0909080'); DROP TABLE t1; @@ -2754,8 +2754,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `subject` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `p` varchar(15) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `p` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 ORDER BY 1; subject p abc𐐀def NULL @@ -2809,8 +2809,8 @@ CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `CONCAT(s1)` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `CONCAT(s1)` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; # # Bug#13581962 HIGH MEMORY USAGE ATTEMPT, THEN CRASH WITH LONGTEXT, UNION, USER VARIABLE @@ -2917,14 +2917,14 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 0041 @@ -2937,14 +2937,14 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 00410041004100410041 @@ -2957,7 +2957,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 004100410041 @@ -2970,7 +2970,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 0041004100410041004100200020002000200020 @@ -3162,13 +3162,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 000061 @@ -3182,13 +3182,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(15) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a)) FROM t1; HEX(WEIGHT_STRING(a)) 000061000061000061000061000061 @@ -3201,7 +3201,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(3))) 000061000061000061 @@ -3214,7 +3214,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `ws` varbinary(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; HEX(WEIGHT_STRING(a AS CHAR(10))) 000061000061000061000061000061000020000020000020000020000020 @@ -3486,9 +3486,9 @@ COLUMN_JSON(COLUMN_CREATE('b',1)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `COLUMN_LIST(COLUMN_CREATE('a',1))` longtext CHARACTER SET utf8mb4 DEFAULT NULL, - `COLUMN_JSON(COLUMN_CREATE('b',1))` longtext CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `COLUMN_LIST(COLUMN_CREATE('a',1))` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `COLUMN_JSON(COLUMN_CREATE('b',1))` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET NAMES default; SET NAMES utf8mb4; @@ -3501,8 +3501,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `t` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `t` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI'); SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub; c2 @@ -3581,7 +3581,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb4_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -3719,7 +3719,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb4_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -3858,7 +3858,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb4_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -3996,7 +3996,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb4_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); diff --git a/mysql-test/main/ctype_utf8mb4.test b/mysql-test/main/ctype_utf8mb4.test index 5640bc45ed16a..c0c5568b3bd44 100644 --- a/mysql-test/main/ctype_utf8mb4.test +++ b/mysql-test/main/ctype_utf8mb4.test @@ -1,3 +1,6 @@ +# Enable after fix MDEV-27904 +-- source include/no_view_protocol.inc + --source include/have_utf8mb4.inc # diff --git a/mysql-test/main/ctype_utf8mb4_general_ci_casefold.result b/mysql-test/main/ctype_utf8mb4_general_ci_casefold.result new file mode 100644 index 0000000000000..56eaba7a709d5 --- /dev/null +++ b/mysql-test/main/ctype_utf8mb4_general_ci_casefold.result @@ -0,0 +1,1446 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET NAMES utf8mb4 COLLATE utf8mb4_general_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +utf8mb4_general_ci +SELECT +codepoint_hex4, +HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)), +HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +FROM v_bmp +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); +codepoint_hex4 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +0041 0061 0041 +0042 0062 0042 +0043 0063 0043 +0044 0064 0044 +0045 0065 0045 +0046 0066 0046 +0047 0067 0047 +0048 0068 0048 +0049 0069 0049 +004A 006A 004A +004B 006B 004B +004C 006C 004C +004D 006D 004D +004E 006E 004E +004F 006F 004F +0050 0070 0050 +0051 0071 0051 +0052 0072 0052 +0053 0073 0053 +0054 0074 0054 +0055 0075 0055 +0056 0076 0056 +0057 0077 0057 +0058 0078 0058 +0059 0079 0059 +005A 007A 005A +0061 0061 0041 +0062 0062 0042 +0063 0063 0043 +0064 0064 0044 +0065 0065 0045 +0066 0066 0046 +0067 0067 0047 +0068 0068 0048 +0069 0069 0049 +006A 006A 004A +006B 006B 004B +006C 006C 004C +006D 006D 004D +006E 006E 004E +006F 006F 004F +0070 0070 0050 +0071 0071 0051 +0072 0072 0052 +0073 0073 0053 +0074 0074 0054 +0075 0075 0055 +0076 0076 0056 +0077 0077 0057 +0078 0078 0058 +0079 0079 0059 +007A 007A 005A +00B5 00B5 039C +00C0 00E0 00C0 +00C1 00E1 00C1 +00C2 00E2 00C2 +00C3 00E3 00C3 +00C4 00E4 00C4 +00C5 00E5 00C5 +00C6 00E6 00C6 +00C7 00E7 00C7 +00C8 00E8 00C8 +00C9 00E9 00C9 +00CA 00EA 00CA +00CB 00EB 00CB +00CC 00EC 00CC +00CD 00ED 00CD +00CE 00EE 00CE +00CF 00EF 00CF +00D0 00F0 00D0 +00D1 00F1 00D1 +00D2 00F2 00D2 +00D3 00F3 00D3 +00D4 00F4 00D4 +00D5 00F5 00D5 +00D6 00F6 00D6 +00D8 00F8 00D8 +00D9 00F9 00D9 +00DA 00FA 00DA +00DB 00FB 00DB +00DC 00FC 00DC +00DD 00FD 00DD +00DE 00FE 00DE +00E0 00E0 00C0 +00E1 00E1 00C1 +00E2 00E2 00C2 +00E3 00E3 00C3 +00E4 00E4 00C4 +00E5 00E5 00C5 +00E6 00E6 00C6 +00E7 00E7 00C7 +00E8 00E8 00C8 +00E9 00E9 00C9 +00EA 00EA 00CA +00EB 00EB 00CB +00EC 00EC 00CC +00ED 00ED 00CD +00EE 00EE 00CE +00EF 00EF 00CF +00F0 00F0 00D0 +00F1 00F1 00D1 +00F2 00F2 00D2 +00F3 00F3 00D3 +00F4 00F4 00D4 +00F5 00F5 00D5 +00F6 00F6 00D6 +00F8 00F8 00D8 +00F9 00F9 00D9 +00FA 00FA 00DA +00FB 00FB 00DB +00FC 00FC 00DC +00FD 00FD 00DD +00FE 00FE 00DE +00FF 00FF 0178 +0100 0101 0100 +0101 0101 0100 +0102 0103 0102 +0103 0103 0102 +0104 0105 0104 +0105 0105 0104 +0106 0107 0106 +0107 0107 0106 +0108 0109 0108 +0109 0109 0108 +010A 010B 010A +010B 010B 010A +010C 010D 010C +010D 010D 010C +010E 010F 010E +010F 010F 010E +0110 0111 0110 +0111 0111 0110 +0112 0113 0112 +0113 0113 0112 +0114 0115 0114 +0115 0115 0114 +0116 0117 0116 +0117 0117 0116 +0118 0119 0118 +0119 0119 0118 +011A 011B 011A +011B 011B 011A +011C 011D 011C +011D 011D 011C +011E 011F 011E +011F 011F 011E +0120 0121 0120 +0121 0121 0120 +0122 0123 0122 +0123 0123 0122 +0124 0125 0124 +0125 0125 0124 +0126 0127 0126 +0127 0127 0126 +0128 0129 0128 +0129 0129 0128 +012A 012B 012A +012B 012B 012A +012C 012D 012C +012D 012D 012C +012E 012F 012E +012F 012F 012E +0130 0069 0130 +0131 0131 0049 +0132 0133 0132 +0133 0133 0132 +0134 0135 0134 +0135 0135 0134 +0136 0137 0136 +0137 0137 0136 +0139 013A 0139 +013A 013A 0139 +013B 013C 013B +013C 013C 013B +013D 013E 013D +013E 013E 013D +013F 0140 013F +0140 0140 013F +0141 0142 0141 +0142 0142 0141 +0143 0144 0143 +0144 0144 0143 +0145 0146 0145 +0146 0146 0145 +0147 0148 0147 +0148 0148 0147 +014A 014B 014A +014B 014B 014A +014C 014D 014C +014D 014D 014C +014E 014F 014E +014F 014F 014E +0150 0151 0150 +0151 0151 0150 +0152 0153 0152 +0153 0153 0152 +0154 0155 0154 +0155 0155 0154 +0156 0157 0156 +0157 0157 0156 +0158 0159 0158 +0159 0159 0158 +015A 015B 015A +015B 015B 015A +015C 015D 015C +015D 015D 015C +015E 015F 015E +015F 015F 015E +0160 0161 0160 +0161 0161 0160 +0162 0163 0162 +0163 0163 0162 +0164 0165 0164 +0165 0165 0164 +0166 0167 0166 +0167 0167 0166 +0168 0169 0168 +0169 0169 0168 +016A 016B 016A +016B 016B 016A +016C 016D 016C +016D 016D 016C +016E 016F 016E +016F 016F 016E +0170 0171 0170 +0171 0171 0170 +0172 0173 0172 +0173 0173 0172 +0174 0175 0174 +0175 0175 0174 +0176 0177 0176 +0177 0177 0176 +0178 00FF 0178 +0179 017A 0179 +017A 017A 0179 +017B 017C 017B +017C 017C 017B +017D 017E 017D +017E 017E 017D +017F 017F 0053 +0181 0253 0181 +0182 0183 0182 +0183 0183 0182 +0184 0185 0184 +0185 0185 0184 +0186 0254 0186 +0187 0188 0187 +0188 0188 0187 +0189 0256 0189 +018A 0257 018A +018B 018C 018B +018C 018C 018B +018E 01DD 018E +018F 0259 018F +0190 025B 0190 +0191 0192 0191 +0192 0192 0191 +0193 0260 0193 +0194 0263 0194 +0195 0195 01F6 +0196 0269 0196 +0197 0268 0197 +0198 0199 0198 +0199 0199 0198 +019C 026F 019C +019D 0272 019D +019F 0275 019F +01A0 01A1 01A0 +01A1 01A1 01A0 +01A2 01A3 01A2 +01A3 01A3 01A2 +01A4 01A5 01A4 +01A5 01A5 01A4 +01A6 0280 01A6 +01A7 01A8 01A7 +01A8 01A8 01A7 +01A9 0283 01A9 +01AC 01AD 01AC +01AD 01AD 01AC +01AE 0288 01AE +01AF 01B0 01AF +01B0 01B0 01AF +01B1 028A 01B1 +01B2 028B 01B2 +01B3 01B4 01B3 +01B4 01B4 01B3 +01B5 01B6 01B5 +01B6 01B6 01B5 +01B7 0292 01B7 +01B8 01B9 01B8 +01B9 01B9 01B8 +01BC 01BD 01BC +01BD 01BD 01BC +01BF 01BF 01F7 +01C4 01C6 01C4 +01C5 01C6 01C4 +01C6 01C6 01C4 +01C7 01C9 01C7 +01C8 01C9 01C7 +01C9 01C9 01C7 +01CA 01CC 01CA +01CB 01CC 01CA +01CC 01CC 01CA +01CD 01CE 01CD +01CE 01CE 01CD +01CF 01D0 01CF +01D0 01D0 01CF +01D1 01D2 01D1 +01D2 01D2 01D1 +01D3 01D4 01D3 +01D4 01D4 01D3 +01D5 01D6 01D5 +01D6 01D6 01D5 +01D7 01D8 01D7 +01D8 01D8 01D7 +01D9 01DA 01D9 +01DA 01DA 01D9 +01DB 01DC 01DB +01DC 01DC 01DB +01DD 01DD 018E +01DE 01DF 01DE +01DF 01DF 01DE +01E0 01E1 01E0 +01E1 01E1 01E0 +01E2 01E3 01E2 +01E3 01E3 01E2 +01E4 01E5 01E4 +01E5 01E5 01E4 +01E6 01E7 01E6 +01E7 01E7 01E6 +01E8 01E9 01E8 +01E9 01E9 01E8 +01EA 01EB 01EA +01EB 01EB 01EA +01EC 01ED 01EC +01ED 01ED 01EC +01EE 01EF 01EE +01EF 01EF 01EE +01F1 01F3 01F1 +01F2 01F3 01F1 +01F3 01F3 01F1 +01F4 01F5 01F4 +01F5 01F5 01F4 +01F6 0195 01F6 +01F7 01BF 01F7 +01F8 01F9 01F8 +01F9 01F9 01F8 +01FA 01FB 01FA +01FB 01FB 01FA +01FC 01FD 01FC +01FD 01FD 01FC +01FE 01FF 01FE +01FF 01FF 01FE +0200 0201 0200 +0201 0201 0200 +0202 0203 0202 +0203 0203 0202 +0204 0205 0204 +0205 0205 0204 +0206 0207 0206 +0207 0207 0206 +0208 0209 0208 +0209 0209 0208 +020A 020B 020A +020B 020B 020A +020C 020D 020C +020D 020D 020C +020E 020F 020E +020F 020F 020E +0210 0211 0210 +0211 0211 0210 +0212 0213 0212 +0213 0213 0212 +0214 0215 0214 +0215 0215 0214 +0216 0217 0216 +0217 0217 0216 +0218 0219 0218 +0219 0219 0218 +021A 021B 021A +021B 021B 021A +021C 021D 021C +021D 021D 021C +021E 021F 021E +021F 021F 021E +0222 0223 0222 +0223 0223 0222 +0224 0225 0224 +0225 0225 0224 +0226 0227 0226 +0227 0227 0226 +0228 0229 0228 +0229 0229 0228 +022A 022B 022A +022B 022B 022A +022C 022D 022C +022D 022D 022C +022E 022F 022E +022F 022F 022E +0230 0231 0230 +0231 0231 0230 +0232 0233 0232 +0233 0233 0232 +0253 0253 0181 +0254 0254 0186 +0256 0256 0189 +0257 0257 018A +0259 0259 018F +025B 025B 0190 +0260 0260 0193 +0263 0263 0194 +0268 0268 0197 +0269 0269 0196 +026F 026F 019C +0272 0272 019D +0275 0275 019F +0280 0280 01A6 +0283 0283 01A9 +0288 0288 01AE +028A 028A 01B1 +028B 028B 01B2 +0292 0292 01B7 +0345 0345 0399 +0386 03AC 0386 +0388 03AD 0388 +0389 03AE 0389 +038A 03AF 038A +038C 03CC 038C +038E 03CD 038E +038F 03CE 038F +0391 03B1 0391 +0392 03B2 0392 +0393 03B3 0393 +0394 03B4 0394 +0395 03B5 0395 +0396 03B6 0396 +0397 03B7 0397 +0398 03B8 0398 +0399 03B9 0399 +039A 03BA 039A +039B 03BB 039B +039C 03BC 039C +039D 03BD 039D +039E 03BE 039E +039F 03BF 039F +03A0 03C0 03A0 +03A1 03C1 03A1 +03A3 03C3 03A3 +03A4 03C4 03A4 +03A5 03C5 03A5 +03A6 03C6 03A6 +03A7 03C7 03A7 +03A8 03C8 03A8 +03A9 03C9 03A9 +03AA 03CA 03AA +03AB 03CB 03AB +03AC 03AC 0386 +03AD 03AD 0388 +03AE 03AE 0389 +03AF 03AF 038A +03B1 03B1 0391 +03B2 03B2 0392 +03B3 03B3 0393 +03B4 03B4 0394 +03B5 03B5 0395 +03B6 03B6 0396 +03B7 03B7 0397 +03B8 03B8 0398 +03B9 03B9 0399 +03BA 03BA 039A +03BB 03BB 039B +03BC 03BC 039C +03BD 03BD 039D +03BE 03BE 039E +03BF 03BF 039F +03C0 03C0 03A0 +03C1 03C1 03A1 +03C2 03C2 03A3 +03C3 03C3 03A3 +03C4 03C4 03A4 +03C5 03C5 03A5 +03C6 03C6 03A6 +03C7 03C7 03A7 +03C8 03C8 03A8 +03C9 03C9 03A9 +03CA 03CA 03AA +03CB 03CB 03AB +03CC 03CC 038C +03CD 03CD 038E +03CE 03CE 038F +03D0 03D0 0392 +03D1 03D1 0398 +03D5 03D5 03A6 +03D6 03D6 03A0 +03DA 03DB 03DA +03DB 03DB 03DA +03DC 03DD 03DC +03DD 03DD 03DC +03DE 03DF 03DE +03DF 03DF 03DE +03E0 03E1 03E0 +03E1 03E1 03E0 +03E2 03E3 03E2 +03E3 03E3 03E2 +03E4 03E5 03E4 +03E5 03E5 03E4 +03E6 03E7 03E6 +03E7 03E7 03E6 +03E8 03E9 03E8 +03E9 03E9 03E8 +03EA 03EB 03EA +03EB 03EB 03EA +03EC 03ED 03EC +03ED 03ED 03EC +03EE 03EF 03EE +03EF 03EF 03EE +03F0 03F0 039A +03F1 03F1 03A1 +03F2 03F2 03A3 +0400 0450 0400 +0401 0451 0401 +0402 0452 0402 +0403 0453 0403 +0404 0454 0404 +0405 0455 0405 +0406 0456 0406 +0407 0457 0407 +0408 0458 0408 +0409 0459 0409 +040A 045A 040A +040B 045B 040B +040C 045C 040C +040D 045D 040D +040E 045E 040E +040F 045F 040F +0410 0430 0410 +0411 0431 0411 +0412 0432 0412 +0413 0433 0413 +0414 0434 0414 +0415 0435 0415 +0416 0436 0416 +0417 0437 0417 +0418 0438 0418 +0419 0439 0419 +041A 043A 041A +041B 043B 041B +041C 043C 041C +041D 043D 041D +041E 043E 041E +041F 043F 041F +0420 0440 0420 +0421 0441 0421 +0422 0442 0422 +0423 0443 0423 +0424 0444 0424 +0425 0445 0425 +0426 0446 0426 +0427 0447 0427 +0428 0448 0428 +0429 0449 0429 +042A 044A 042A +042B 044B 042B +042C 044C 042C +042D 044D 042D +042E 044E 042E +042F 044F 042F +0430 0430 0410 +0431 0431 0411 +0432 0432 0412 +0433 0433 0413 +0434 0434 0414 +0435 0435 0415 +0436 0436 0416 +0437 0437 0417 +0438 0438 0418 +0439 0439 0419 +043A 043A 041A +043B 043B 041B +043C 043C 041C +043D 043D 041D +043E 043E 041E +043F 043F 041F +0440 0440 0420 +0441 0441 0421 +0442 0442 0422 +0443 0443 0423 +0444 0444 0424 +0445 0445 0425 +0446 0446 0426 +0447 0447 0427 +0448 0448 0428 +0449 0449 0429 +044A 044A 042A +044B 044B 042B +044C 044C 042C +044D 044D 042D +044E 044E 042E +044F 044F 042F +0450 0450 0400 +0451 0451 0401 +0452 0452 0402 +0453 0453 0403 +0454 0454 0404 +0455 0455 0405 +0456 0456 0406 +0457 0457 0407 +0458 0458 0408 +0459 0459 0409 +045A 045A 040A +045B 045B 040B +045C 045C 040C +045D 045D 040D +045E 045E 040E +045F 045F 040F +0460 0461 0460 +0461 0461 0460 +0462 0463 0462 +0463 0463 0462 +0464 0465 0464 +0465 0465 0464 +0466 0467 0466 +0467 0467 0466 +0468 0469 0468 +0469 0469 0468 +046A 046B 046A +046B 046B 046A +046C 046D 046C +046D 046D 046C +046E 046F 046E +046F 046F 046E +0470 0471 0470 +0471 0471 0470 +0472 0473 0472 +0473 0473 0472 +0474 0475 0474 +0475 0475 0474 +0476 0477 0476 +0477 0477 0476 +0478 0479 0478 +0479 0479 0478 +047A 047B 047A +047B 047B 047A +047C 047D 047C +047D 047D 047C +047E 047F 047E +047F 047F 047E +0480 0481 0480 +0481 0481 0480 +048C 048D 048C +048D 048D 048C +048E 048F 048E +048F 048F 048E +0490 0491 0490 +0491 0491 0490 +0492 0493 0492 +0493 0493 0492 +0494 0495 0494 +0495 0495 0494 +0496 0497 0496 +0497 0497 0496 +0498 0499 0498 +0499 0499 0498 +049A 049B 049A +049B 049B 049A +049C 049D 049C +049D 049D 049C +049E 049F 049E +049F 049F 049E +04A0 04A1 04A0 +04A1 04A1 04A0 +04A2 04A3 04A2 +04A3 04A3 04A2 +04A4 04A5 04A4 +04A5 04A5 04A4 +04A6 04A7 04A6 +04A7 04A7 04A6 +04A8 04A9 04A8 +04A9 04A9 04A8 +04AA 04AB 04AA +04AB 04AB 04AA +04AC 04AD 04AC +04AD 04AD 04AC +04AE 04AF 04AE +04AF 04AF 04AE +04B0 04B1 04B0 +04B1 04B1 04B0 +04B2 04B3 04B2 +04B3 04B3 04B2 +04B4 04B5 04B4 +04B5 04B5 04B4 +04B6 04B7 04B6 +04B7 04B7 04B6 +04B8 04B9 04B8 +04B9 04B9 04B8 +04BA 04BB 04BA +04BB 04BB 04BA +04BC 04BD 04BC +04BD 04BD 04BC +04BE 04BF 04BE +04BF 04BF 04BE +04C1 04C2 04C1 +04C2 04C2 04C1 +04C3 04C4 04C3 +04C4 04C4 04C3 +04C7 04C8 04C7 +04C8 04C8 04C7 +04CB 04CC 04CB +04CC 04CC 04CB +04D0 04D1 04D0 +04D1 04D1 04D0 +04D2 04D3 04D2 +04D3 04D3 04D2 +04D4 04D5 04D4 +04D5 04D5 04D4 +04D6 04D7 04D6 +04D7 04D7 04D6 +04D8 04D9 04D8 +04D9 04D9 04D8 +04DA 04DB 04DA +04DB 04DB 04DA +04DC 04DD 04DC +04DD 04DD 04DC +04DE 04DF 04DE +04DF 04DF 04DE +04E0 04E1 04E0 +04E1 04E1 04E0 +04E2 04E3 04E2 +04E3 04E3 04E2 +04E4 04E5 04E4 +04E5 04E5 04E4 +04E6 04E7 04E6 +04E7 04E7 04E6 +04E8 04E9 04E8 +04E9 04E9 04E8 +04EA 04EB 04EA +04EB 04EB 04EA +04EC 04ED 04EC +04ED 04ED 04EC +04EE 04EF 04EE +04EF 04EF 04EE +04F0 04F1 04F0 +04F1 04F1 04F0 +04F2 04F3 04F2 +04F3 04F3 04F2 +04F4 04F5 04F4 +04F5 04F5 04F4 +04F8 04F9 04F8 +04F9 04F9 04F8 +0531 0561 0531 +0532 0562 0532 +0533 0563 0533 +0534 0564 0534 +0535 0565 0535 +0536 0566 0536 +0537 0567 0537 +0538 0568 0538 +0539 0569 0539 +053A 056A 053A +053B 056B 053B +053C 056C 053C +053D 056D 053D +053E 056E 053E +053F 056F 053F +0540 0570 0540 +0541 0571 0541 +0542 0572 0542 +0543 0573 0543 +0544 0574 0544 +0545 0575 0545 +0546 0576 0546 +0547 0577 0547 +0548 0578 0548 +0549 0579 0549 +054A 057A 054A +054B 057B 054B +054C 057C 054C +054D 057D 054D +054E 057E 054E +054F 057F 054F +0550 0580 0550 +0551 0581 0551 +0552 0582 0552 +0553 0583 0553 +0554 0584 0554 +0555 0585 0555 +0556 0586 0556 +0561 0561 0531 +0562 0562 0532 +0563 0563 0533 +0564 0564 0534 +0565 0565 0535 +0566 0566 0536 +0567 0567 0537 +0568 0568 0538 +0569 0569 0539 +056A 056A 053A +056B 056B 053B +056C 056C 053C +056D 056D 053D +056E 056E 053E +056F 056F 053F +0570 0570 0540 +0571 0571 0541 +0572 0572 0542 +0573 0573 0543 +0574 0574 0544 +0575 0575 0545 +0576 0576 0546 +0577 0577 0547 +0578 0578 0548 +0579 0579 0549 +057A 057A 054A +057B 057B 054B +057C 057C 054C +057D 057D 054D +057E 057E 054E +057F 057F 054F +0580 0580 0550 +0581 0581 0551 +0582 0582 0552 +0583 0583 0553 +0584 0584 0554 +0585 0585 0555 +0586 0586 0556 +1E00 1E01 1E00 +1E01 1E01 1E00 +1E02 1E03 1E02 +1E03 1E03 1E02 +1E04 1E05 1E04 +1E05 1E05 1E04 +1E06 1E07 1E06 +1E07 1E07 1E06 +1E08 1E09 1E08 +1E09 1E09 1E08 +1E0A 1E0B 1E0A +1E0B 1E0B 1E0A +1E0C 1E0D 1E0C +1E0D 1E0D 1E0C +1E0E 1E0F 1E0E +1E0F 1E0F 1E0E +1E10 1E11 1E10 +1E11 1E11 1E10 +1E12 1E13 1E12 +1E13 1E13 1E12 +1E14 1E15 1E14 +1E15 1E15 1E14 +1E16 1E17 1E16 +1E17 1E17 1E16 +1E18 1E19 1E18 +1E19 1E19 1E18 +1E1A 1E1B 1E1A +1E1B 1E1B 1E1A +1E1C 1E1D 1E1C +1E1D 1E1D 1E1C +1E1E 1E1F 1E1E +1E1F 1E1F 1E1E +1E20 1E21 1E20 +1E21 1E21 1E20 +1E22 1E23 1E22 +1E23 1E23 1E22 +1E24 1E25 1E24 +1E25 1E25 1E24 +1E26 1E27 1E26 +1E27 1E27 1E26 +1E28 1E29 1E28 +1E29 1E29 1E28 +1E2A 1E2B 1E2A +1E2B 1E2B 1E2A +1E2C 1E2D 1E2C +1E2D 1E2D 1E2C +1E2E 1E2F 1E2E +1E2F 1E2F 1E2E +1E30 1E31 1E30 +1E31 1E31 1E30 +1E32 1E33 1E32 +1E33 1E33 1E32 +1E34 1E35 1E34 +1E35 1E35 1E34 +1E36 1E37 1E36 +1E37 1E37 1E36 +1E38 1E39 1E38 +1E39 1E39 1E38 +1E3A 1E3B 1E3A +1E3B 1E3B 1E3A +1E3C 1E3D 1E3C +1E3D 1E3D 1E3C +1E3E 1E3F 1E3E +1E3F 1E3F 1E3E +1E40 1E41 1E40 +1E41 1E41 1E40 +1E42 1E43 1E42 +1E43 1E43 1E42 +1E44 1E45 1E44 +1E45 1E45 1E44 +1E46 1E47 1E46 +1E47 1E47 1E46 +1E48 1E49 1E48 +1E49 1E49 1E48 +1E4A 1E4B 1E4A +1E4B 1E4B 1E4A +1E4C 1E4D 1E4C +1E4D 1E4D 1E4C +1E4E 1E4F 1E4E +1E4F 1E4F 1E4E +1E50 1E51 1E50 +1E51 1E51 1E50 +1E52 1E53 1E52 +1E53 1E53 1E52 +1E54 1E55 1E54 +1E55 1E55 1E54 +1E56 1E57 1E56 +1E57 1E57 1E56 +1E58 1E59 1E58 +1E59 1E59 1E58 +1E5A 1E5B 1E5A +1E5B 1E5B 1E5A +1E5C 1E5D 1E5C +1E5D 1E5D 1E5C +1E5E 1E5F 1E5E +1E5F 1E5F 1E5E +1E60 1E61 1E60 +1E61 1E61 1E60 +1E62 1E63 1E62 +1E63 1E63 1E62 +1E64 1E65 1E64 +1E65 1E65 1E64 +1E66 1E67 1E66 +1E67 1E67 1E66 +1E68 1E69 1E68 +1E69 1E69 1E68 +1E6A 1E6B 1E6A +1E6B 1E6B 1E6A +1E6C 1E6D 1E6C +1E6D 1E6D 1E6C +1E6E 1E6F 1E6E +1E6F 1E6F 1E6E +1E70 1E71 1E70 +1E71 1E71 1E70 +1E72 1E73 1E72 +1E73 1E73 1E72 +1E74 1E75 1E74 +1E75 1E75 1E74 +1E76 1E77 1E76 +1E77 1E77 1E76 +1E78 1E79 1E78 +1E79 1E79 1E78 +1E7A 1E7B 1E7A +1E7B 1E7B 1E7A +1E7C 1E7D 1E7C +1E7D 1E7D 1E7C +1E7E 1E7F 1E7E +1E7F 1E7F 1E7E +1E80 1E81 1E80 +1E81 1E81 1E80 +1E82 1E83 1E82 +1E83 1E83 1E82 +1E84 1E85 1E84 +1E85 1E85 1E84 +1E86 1E87 1E86 +1E87 1E87 1E86 +1E88 1E89 1E88 +1E89 1E89 1E88 +1E8A 1E8B 1E8A +1E8B 1E8B 1E8A +1E8C 1E8D 1E8C +1E8D 1E8D 1E8C +1E8E 1E8F 1E8E +1E8F 1E8F 1E8E +1E90 1E91 1E90 +1E91 1E91 1E90 +1E92 1E93 1E92 +1E93 1E93 1E92 +1E94 1E95 1E94 +1E95 1E95 1E94 +1E9B 1E9B 1E60 +1EA0 1EA1 1EA0 +1EA1 1EA1 1EA0 +1EA2 1EA3 1EA2 +1EA3 1EA3 1EA2 +1EA4 1EA5 1EA4 +1EA5 1EA5 1EA4 +1EA6 1EA7 1EA6 +1EA7 1EA7 1EA6 +1EA8 1EA9 1EA8 +1EA9 1EA9 1EA8 +1EAA 1EAB 1EAA +1EAB 1EAB 1EAA +1EAC 1EAD 1EAC +1EAD 1EAD 1EAC +1EAE 1EAF 1EAE +1EAF 1EAF 1EAE +1EB0 1EB1 1EB0 +1EB1 1EB1 1EB0 +1EB2 1EB3 1EB2 +1EB3 1EB3 1EB2 +1EB4 1EB5 1EB4 +1EB5 1EB5 1EB4 +1EB6 1EB7 1EB6 +1EB7 1EB7 1EB6 +1EB8 1EB9 1EB8 +1EB9 1EB9 1EB8 +1EBA 1EBB 1EBA +1EBB 1EBB 1EBA +1EBC 1EBD 1EBC +1EBD 1EBD 1EBC +1EBE 1EBF 1EBE +1EBF 1EBF 1EBE +1EC0 1EC1 1EC0 +1EC1 1EC1 1EC0 +1EC2 1EC3 1EC2 +1EC3 1EC3 1EC2 +1EC4 1EC5 1EC4 +1EC5 1EC5 1EC4 +1EC6 1EC7 1EC6 +1EC7 1EC7 1EC6 +1EC8 1EC9 1EC8 +1EC9 1EC9 1EC8 +1ECA 1ECB 1ECA +1ECB 1ECB 1ECA +1ECC 1ECD 1ECC +1ECD 1ECD 1ECC +1ECE 1ECF 1ECE +1ECF 1ECF 1ECE +1ED0 1ED1 1ED0 +1ED1 1ED1 1ED0 +1ED2 1ED3 1ED2 +1ED3 1ED3 1ED2 +1ED4 1ED5 1ED4 +1ED5 1ED5 1ED4 +1ED6 1ED7 1ED6 +1ED7 1ED7 1ED6 +1ED8 1ED9 1ED8 +1ED9 1ED9 1ED8 +1EDA 1EDB 1EDA +1EDB 1EDB 1EDA +1EDC 1EDD 1EDC +1EDD 1EDD 1EDC +1EDE 1EDF 1EDE +1EDF 1EDF 1EDE +1EE0 1EE1 1EE0 +1EE1 1EE1 1EE0 +1EE2 1EE3 1EE2 +1EE3 1EE3 1EE2 +1EE4 1EE5 1EE4 +1EE5 1EE5 1EE4 +1EE6 1EE7 1EE6 +1EE7 1EE7 1EE6 +1EE8 1EE9 1EE8 +1EE9 1EE9 1EE8 +1EEA 1EEB 1EEA +1EEB 1EEB 1EEA +1EEC 1EED 1EEC +1EED 1EED 1EEC +1EEE 1EEF 1EEE +1EEF 1EEF 1EEE +1EF0 1EF1 1EF0 +1EF1 1EF1 1EF0 +1EF2 1EF3 1EF2 +1EF3 1EF3 1EF2 +1EF4 1EF5 1EF4 +1EF5 1EF5 1EF4 +1EF6 1EF7 1EF6 +1EF7 1EF7 1EF6 +1EF8 1EF9 1EF8 +1EF9 1EF9 1EF8 +1F00 1F00 1F08 +1F01 1F01 1F09 +1F02 1F02 1F0A +1F03 1F03 1F0B +1F04 1F04 1F0C +1F05 1F05 1F0D +1F06 1F06 1F0E +1F07 1F07 1F0F +1F08 1F00 1F08 +1F09 1F01 1F09 +1F0A 1F02 1F0A +1F0B 1F03 1F0B +1F0C 1F04 1F0C +1F0D 1F05 1F0D +1F0E 1F06 1F0E +1F0F 1F07 1F0F +1F10 1F10 1F18 +1F11 1F11 1F19 +1F12 1F12 1F1A +1F13 1F13 1F1B +1F14 1F14 1F1C +1F15 1F15 1F1D +1F18 1F10 1F18 +1F19 1F11 1F19 +1F1A 1F12 1F1A +1F1B 1F13 1F1B +1F1C 1F14 1F1C +1F1D 1F15 1F1D +1F20 1F20 1F28 +1F21 1F21 1F29 +1F22 1F22 1F2A +1F23 1F23 1F2B +1F24 1F24 1F2C +1F25 1F25 1F2D +1F26 1F26 1F2E +1F27 1F27 1F2F +1F28 1F20 1F28 +1F29 1F21 1F29 +1F2A 1F22 1F2A +1F2B 1F23 1F2B +1F2C 1F24 1F2C +1F2D 1F25 1F2D +1F2E 1F26 1F2E +1F2F 1F27 1F2F +1F30 1F30 1F38 +1F31 1F31 1F39 +1F32 1F32 1F3A +1F33 1F33 1F3B +1F34 1F34 1F3C +1F35 1F35 1F3D +1F36 1F36 1F3E +1F37 1F37 1F3F +1F38 1F30 1F38 +1F39 1F31 1F39 +1F3A 1F32 1F3A +1F3B 1F33 1F3B +1F3C 1F34 1F3C +1F3D 1F35 1F3D +1F3E 1F36 1F3E +1F3F 1F37 1F3F +1F40 1F40 1F48 +1F41 1F41 1F49 +1F42 1F42 1F4A +1F43 1F43 1F4B +1F44 1F44 1F4C +1F45 1F45 1F4D +1F48 1F40 1F48 +1F49 1F41 1F49 +1F4A 1F42 1F4A +1F4B 1F43 1F4B +1F4C 1F44 1F4C +1F4D 1F45 1F4D +1F51 1F51 1F59 +1F53 1F53 1F5B +1F55 1F55 1F5D +1F57 1F57 1F5F +1F59 1F51 1F59 +1F5B 1F53 1F5B +1F5D 1F55 1F5D +1F5F 1F57 1F5F +1F60 1F60 1F68 +1F61 1F61 1F69 +1F62 1F62 1F6A +1F63 1F63 1F6B +1F64 1F64 1F6C +1F65 1F65 1F6D +1F66 1F66 1F6E +1F67 1F67 1F6F +1F68 1F60 1F68 +1F69 1F61 1F69 +1F6A 1F62 1F6A +1F6B 1F63 1F6B +1F6C 1F64 1F6C +1F6D 1F65 1F6D +1F6E 1F66 1F6E +1F6F 1F67 1F6F +1F70 1F70 1FBA +1F71 1F71 1FBB +1F72 1F72 1FC8 +1F73 1F73 1FC9 +1F74 1F74 1FCA +1F75 1F75 1FCB +1F76 1F76 1FDA +1F77 1F77 1FDB +1F78 1F78 1FF8 +1F79 1F79 1FF9 +1F7A 1F7A 1FEA +1F7B 1F7B 1FEB +1F7C 1F7C 1FFA +1F7D 1F7D 1FFB +1F80 1F80 1F88 +1F81 1F81 1F89 +1F82 1F82 1F8A +1F83 1F83 1F8B +1F84 1F84 1F8C +1F85 1F85 1F8D +1F86 1F86 1F8E +1F87 1F87 1F8F +1F88 1F80 1F88 +1F89 1F81 1F89 +1F8A 1F82 1F8A +1F8B 1F83 1F8B +1F8C 1F84 1F8C +1F8D 1F85 1F8D +1F8E 1F86 1F8E +1F8F 1F87 1F8F +1F90 1F90 1F98 +1F91 1F91 1F99 +1F92 1F92 1F9A +1F93 1F93 1F9B +1F94 1F94 1F9C +1F95 1F95 1F9D +1F96 1F96 1F9E +1F97 1F97 1F9F +1F98 1F90 1F98 +1F99 1F91 1F99 +1F9A 1F92 1F9A +1F9B 1F93 1F9B +1F9C 1F94 1F9C +1F9D 1F95 1F9D +1F9E 1F96 1F9E +1F9F 1F97 1F9F +1FA0 1FA0 1FA8 +1FA1 1FA1 1FA9 +1FA2 1FA2 1FAA +1FA3 1FA3 1FAB +1FA4 1FA4 1FAC +1FA5 1FA5 1FAD +1FA6 1FA6 1FAE +1FA7 1FA7 1FAF +1FA8 1FA0 1FA8 +1FA9 1FA1 1FA9 +1FAA 1FA2 1FAA +1FAB 1FA3 1FAB +1FAC 1FA4 1FAC +1FAD 1FA5 1FAD +1FAE 1FA6 1FAE +1FAF 1FA7 1FAF +1FB0 1FB0 1FB8 +1FB1 1FB1 1FB9 +1FB3 1FB3 1FBC +1FB8 1FB0 1FB8 +1FB9 1FB1 1FB9 +1FBA 1F70 1FBA +1FBB 1F71 1FBB +1FBC 1FB3 1FBC +1FBE 1FBE 0399 +1FC3 1FC3 1FCC +1FC8 1F72 1FC8 +1FC9 1F73 1FC9 +1FCA 1F74 1FCA +1FCB 1F75 1FCB +1FCC 1FC3 1FCC +1FD0 1FD0 1FD8 +1FD1 1FD1 1FD9 +1FD8 1FD0 1FD8 +1FD9 1FD1 1FD9 +1FDA 1F76 1FDA +1FDB 1F77 1FDB +1FE0 1FE0 1FE8 +1FE1 1FE1 1FE9 +1FE5 1FE5 1FEC +1FE8 1FE0 1FE8 +1FE9 1FE1 1FE9 +1FEA 1F7A 1FEA +1FEB 1F7B 1FEB +1FEC 1FE5 1FEC +1FF3 1FF3 1FFC +1FF8 1F78 1FF8 +1FF9 1F79 1FF9 +1FFA 1F7C 1FFA +1FFB 1F7D 1FFB +1FFC 1FF3 1FFC +2126 03C9 2126 +212A 006B 212A +212B 00E5 212B +2160 2170 2160 +2161 2171 2161 +2162 2172 2162 +2163 2173 2163 +2164 2174 2164 +2165 2175 2165 +2166 2176 2166 +2167 2177 2167 +2168 2178 2168 +2169 2179 2169 +216A 217A 216A +216B 217B 216B +216C 217C 216C +216D 217D 216D +216E 217E 216E +216F 217F 216F +2170 2170 2160 +2171 2171 2161 +2172 2172 2162 +2173 2173 2163 +2174 2174 2164 +2175 2175 2165 +2176 2176 2166 +2177 2177 2167 +2178 2178 2168 +2179 2179 2169 +217A 217A 216A +217B 217B 216B +217C 217C 216C +217D 217D 216D +217E 217E 216E +217F 217F 216F +24B6 24D0 24B6 +24B7 24D1 24B7 +24B8 24D2 24B8 +24B9 24D3 24B9 +24BA 24D4 24BA +24BB 24D5 24BB +24BC 24D6 24BC +24BD 24D7 24BD +24BE 24D8 24BE +24BF 24D9 24BF +24C0 24DA 24C0 +24C1 24DB 24C1 +24C2 24DC 24C2 +24C3 24DD 24C3 +24C4 24DE 24C4 +24C5 24DF 24C5 +24C6 24E0 24C6 +24C7 24E1 24C7 +24C8 24E2 24C8 +24C9 24E3 24C9 +24CA 24E4 24CA +24CB 24E5 24CB +24CC 24E6 24CC +24CD 24E7 24CD +24CE 24E8 24CE +24CF 24E9 24CF +24D0 24D0 24B6 +24D1 24D1 24B7 +24D2 24D2 24B8 +24D3 24D3 24B9 +24D4 24D4 24BA +24D5 24D5 24BB +24D6 24D6 24BC +24D7 24D7 24BD +24D8 24D8 24BE +24D9 24D9 24BF +24DA 24DA 24C0 +24DB 24DB 24C1 +24DC 24DC 24C2 +24DD 24DD 24C3 +24DE 24DE 24C4 +24DF 24DF 24C5 +24E0 24E0 24C6 +24E1 24E1 24C7 +24E2 24E2 24C8 +24E3 24E3 24C9 +24E4 24E4 24CA +24E5 24E5 24CB +24E6 24E6 24CC +24E7 24E7 24CD +24E8 24E8 24CE +24E9 24E9 24CF +FF21 FF41 FF21 +FF22 FF42 FF22 +FF23 FF43 FF23 +FF24 FF44 FF24 +FF25 FF45 FF25 +FF26 FF46 FF26 +FF27 FF47 FF27 +FF28 FF48 FF28 +FF29 FF49 FF29 +FF2A FF4A FF2A +FF2B FF4B FF2B +FF2C FF4C FF2C +FF2D FF4D FF2D +FF2E FF4E FF2E +FF2F FF4F FF2F +FF30 FF50 FF30 +FF31 FF51 FF31 +FF32 FF52 FF32 +FF33 FF53 FF33 +FF34 FF54 FF34 +FF35 FF55 FF35 +FF36 FF56 FF36 +FF37 FF57 FF37 +FF38 FF58 FF38 +FF39 FF59 FF39 +FF3A FF5A FF3A +FF41 FF41 FF21 +FF42 FF42 FF22 +FF43 FF43 FF23 +FF44 FF44 FF24 +FF45 FF45 FF25 +FF46 FF46 FF26 +FF47 FF47 FF27 +FF48 FF48 FF28 +FF49 FF49 FF29 +FF4A FF4A FF2A +FF4B FF4B FF2B +FF4C FF4C FF2C +FF4D FF4D FF2D +FF4E FF4E FF2E +FF4F FF4F FF2F +FF50 FF50 FF30 +FF51 FF51 FF31 +FF52 FF52 FF32 +FF53 FF53 FF33 +FF54 FF54 FF34 +FF55 FF55 FF35 +FF56 FF56 FF36 +FF57 FF57 FF37 +FF58 FF58 FF38 +FF59 FF59 FF39 +FF5A FF5A FF3A +DROP VIEW v_bmp; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_supplementary AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),8,''0'') AS codepoint_hex8, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_65536_to_1114111', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_supplementary LIMIT 1; +COLLATION(c) +utf8mb4_general_ci +SELECT +codepoint_hex8, +HEX(CAST(LOWER(c) AS CHAR CHARACTER SET utf32)), +HEX(CAST(UPPER(c) AS CHAR CHARACTER SET utf32)) +FROM v_supplementary +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); +codepoint_hex8 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET utf32)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET utf32)) +DROP VIEW v_supplementary; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_utf8mb4_general_ci_casefold.test b/mysql-test/main/ctype_utf8mb4_general_ci_casefold.test new file mode 100644 index 0000000000000..99bdd6a57171b --- /dev/null +++ b/mysql-test/main/ctype_utf8mb4_general_ci_casefold.test @@ -0,0 +1,15 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET NAMES utf8mb4 COLLATE utf8mb4_general_ci; +--source include/ctype_unicode_casefold_bmp.inc +--source include/ctype_unicode_casefold_supplementary.inc + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/ctype_utf8mb4_general_ci_ws.result b/mysql-test/main/ctype_utf8mb4_general_ci_ws.result new file mode 100644 index 0000000000000..57a4e5569593b --- /dev/null +++ b/mysql-test/main/ctype_utf8mb4_general_ci_ws.result @@ -0,0 +1,1160 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET NAMES utf8mb4 COLLATE utf8mb4_general_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +utf8mb4_general_ci +SELECT HEX(codepoint) FROM v_bmp WHERE HEX(WEIGHT_STRING(c))='FFFD'; +HEX(codepoint) +FFFD +SELECT +SUM(codepoint_hex4=HEX(WEIGHT_STRING(c))) AS count_bmp_weight_is_codepoint, +SUM(codepoint_hex4<>HEX(WEIGHT_STRING(c))) AS count_bmp_weight_is_not_codepoint +FROM v_bmp; +count_bmp_weight_is_codepoint count_bmp_weight_is_not_codepoint +64428 1108 +SELECT codepoint_hex4,HEX(WEIGHT_STRING(c)) +FROM v_bmp +WHERE codepoint_hex4<>HEX(WEIGHT_STRING(c)); +codepoint_hex4 HEX(WEIGHT_STRING(c)) +0061 0041 +0062 0042 +0063 0043 +0064 0044 +0065 0045 +0066 0046 +0067 0047 +0068 0048 +0069 0049 +006A 004A +006B 004B +006C 004C +006D 004D +006E 004E +006F 004F +0070 0050 +0071 0051 +0072 0052 +0073 0053 +0074 0054 +0075 0055 +0076 0056 +0077 0057 +0078 0058 +0079 0059 +007A 005A +00B5 039C +00C0 0041 +00C1 0041 +00C2 0041 +00C3 0041 +00C4 0041 +00C5 0041 +00C7 0043 +00C8 0045 +00C9 0045 +00CA 0045 +00CB 0045 +00CC 0049 +00CD 0049 +00CE 0049 +00CF 0049 +00D1 004E +00D2 004F +00D3 004F +00D4 004F +00D5 004F +00D6 004F +00D9 0055 +00DA 0055 +00DB 0055 +00DC 0055 +00DD 0059 +00DF 0053 +00E0 0041 +00E1 0041 +00E2 0041 +00E3 0041 +00E4 0041 +00E5 0041 +00E6 00C6 +00E7 0043 +00E8 0045 +00E9 0045 +00EA 0045 +00EB 0045 +00EC 0049 +00ED 0049 +00EE 0049 +00EF 0049 +00F0 00D0 +00F1 004E +00F2 004F +00F3 004F +00F4 004F +00F5 004F +00F6 004F +00F8 00D8 +00F9 0055 +00FA 0055 +00FB 0055 +00FC 0055 +00FD 0059 +00FE 00DE +00FF 0059 +0100 0041 +0101 0041 +0102 0041 +0103 0041 +0104 0041 +0105 0041 +0106 0043 +0107 0043 +0108 0043 +0109 0043 +010A 0043 +010B 0043 +010C 0043 +010D 0043 +010E 0044 +010F 0044 +0111 0110 +0112 0045 +0113 0045 +0114 0045 +0115 0045 +0116 0045 +0117 0045 +0118 0045 +0119 0045 +011A 0045 +011B 0045 +011C 0047 +011D 0047 +011E 0047 +011F 0047 +0120 0047 +0121 0047 +0122 0047 +0123 0047 +0124 0048 +0125 0048 +0127 0126 +0128 0049 +0129 0049 +012A 0049 +012B 0049 +012C 0049 +012D 0049 +012E 0049 +012F 0049 +0130 0049 +0131 0049 +0133 0132 +0134 004A +0135 004A +0136 004B +0137 004B +0139 004C +013A 004C +013B 004C +013C 004C +013D 004C +013E 004C +0140 013F +0142 0141 +0143 004E +0144 004E +0145 004E +0146 004E +0147 004E +0148 004E +014B 014A +014C 004F +014D 004F +014E 004F +014F 004F +0150 004F +0151 004F +0153 0152 +0154 0052 +0155 0052 +0156 0052 +0157 0052 +0158 0052 +0159 0052 +015A 0053 +015B 0053 +015C 0053 +015D 0053 +015E 0053 +015F 0053 +0160 0053 +0161 0053 +0162 0054 +0163 0054 +0164 0054 +0165 0054 +0167 0166 +0168 0055 +0169 0055 +016A 0055 +016B 0055 +016C 0055 +016D 0055 +016E 0055 +016F 0055 +0170 0055 +0171 0055 +0172 0055 +0173 0055 +0174 0057 +0175 0057 +0176 0059 +0177 0059 +0178 0059 +0179 005A +017A 005A +017B 005A +017C 005A +017D 005A +017E 005A +017F 0053 +0183 0182 +0185 0184 +0188 0187 +018C 018B +0192 0191 +0195 01F6 +0199 0198 +01A0 004F +01A1 004F +01A3 01A2 +01A5 01A4 +01A8 01A7 +01AD 01AC +01AF 0055 +01B0 0055 +01B4 01B3 +01B6 01B5 +01B9 01B8 +01BD 01BC +01BF 01F7 +01C5 01C4 +01C6 01C4 +01C8 01C7 +01C9 01C7 +01CB 01CA +01CC 01CA +01CD 0041 +01CE 0041 +01CF 0049 +01D0 0049 +01D1 004F +01D2 004F +01D3 0055 +01D4 0055 +01D5 0055 +01D6 0055 +01D7 0055 +01D8 0055 +01D9 0055 +01DA 0055 +01DB 0055 +01DC 0055 +01DD 018E +01DE 0041 +01DF 0041 +01E0 0041 +01E1 0041 +01E2 00C6 +01E3 00C6 +01E5 01E4 +01E6 0047 +01E7 0047 +01E8 004B +01E9 004B +01EA 004F +01EB 004F +01EC 004F +01ED 004F +01EE 01B7 +01EF 01B7 +01F0 004A +01F2 01F1 +01F3 01F1 +01F4 0047 +01F5 0047 +01F8 004E +01F9 004E +01FA 0041 +01FB 0041 +01FC 00C6 +01FD 00C6 +01FE 00D8 +01FF 00D8 +0200 0041 +0201 0041 +0202 0041 +0203 0041 +0204 0045 +0205 0045 +0206 0045 +0207 0045 +0208 0049 +0209 0049 +020A 0049 +020B 0049 +020C 004F +020D 004F +020E 004F +020F 004F +0210 0052 +0211 0052 +0212 0052 +0213 0052 +0214 0055 +0215 0055 +0216 0055 +0217 0055 +0218 0053 +0219 0053 +021A 0054 +021B 0054 +021D 021C +021E 0048 +021F 0048 +0223 0222 +0225 0224 +0226 0041 +0227 0041 +0228 0045 +0229 0045 +022A 004F +022B 004F +022C 004F +022D 004F +022E 004F +022F 004F +0230 004F +0231 004F +0232 0059 +0233 0059 +0253 0181 +0254 0186 +0256 0189 +0257 018A +0259 018F +025B 0190 +0260 0193 +0263 0194 +0268 0197 +0269 0196 +026F 019C +0272 019D +0275 019F +0280 01A6 +0283 01A9 +0288 01AE +028A 01B1 +028B 01B2 +0292 01B7 +0345 0399 +0386 0391 +0388 0395 +0389 0397 +038A 0399 +038C 039F +038E 03A5 +038F 03A9 +0390 0399 +03AA 0399 +03AB 03A5 +03AC 0391 +03AD 0395 +03AE 0397 +03AF 0399 +03B0 03A5 +03B1 0391 +03B2 0392 +03B3 0393 +03B4 0394 +03B5 0395 +03B6 0396 +03B7 0397 +03B8 0398 +03B9 0399 +03BA 039A +03BB 039B +03BC 039C +03BD 039D +03BE 039E +03BF 039F +03C0 03A0 +03C1 03A1 +03C2 03A3 +03C3 03A3 +03C4 03A4 +03C5 03A5 +03C6 03A6 +03C7 03A7 +03C8 03A8 +03C9 03A9 +03CA 0399 +03CB 03A5 +03CC 039F +03CD 03A5 +03CE 03A9 +03D0 0392 +03D1 0398 +03D3 03D2 +03D4 03D2 +03D5 03A6 +03D6 03A0 +03DB 03DA +03DD 03DC +03DF 03DE +03E1 03E0 +03E3 03E2 +03E5 03E4 +03E7 03E6 +03E9 03E8 +03EB 03EA +03ED 03EC +03EF 03EE +03F0 039A +03F1 03A1 +03F2 03A3 +0400 0415 +0401 0415 +0403 0413 +0407 0406 +040C 041A +040D 0418 +040E 0423 +0430 0410 +0431 0411 +0432 0412 +0433 0413 +0434 0414 +0435 0415 +0436 0416 +0437 0417 +0438 0418 +0439 0419 +043A 041A +043B 041B +043C 041C +043D 041D +043E 041E +043F 041F +0440 0420 +0441 0421 +0442 0422 +0443 0423 +0444 0424 +0445 0425 +0446 0426 +0447 0427 +0448 0428 +0449 0429 +044A 042A +044B 042B +044C 042C +044D 042D +044E 042E +044F 042F +0450 0415 +0451 0415 +0452 0402 +0453 0413 +0454 0404 +0455 0405 +0456 0406 +0457 0406 +0458 0408 +0459 0409 +045A 040A +045B 040B +045C 041A +045D 0418 +045E 0423 +045F 040F +0461 0460 +0463 0462 +0465 0464 +0467 0466 +0469 0468 +046B 046A +046D 046C +046F 046E +0471 0470 +0473 0472 +0475 0474 +0476 0474 +0477 0474 +0479 0478 +047B 047A +047D 047C +047F 047E +0481 0480 +048D 048C +048F 048E +0491 0490 +0493 0492 +0495 0494 +0497 0496 +0499 0498 +049B 049A +049D 049C +049F 049E +04A1 04A0 +04A3 04A2 +04A5 04A4 +04A7 04A6 +04A9 04A8 +04AB 04AA +04AD 04AC +04AF 04AE +04B1 04B0 +04B3 04B2 +04B5 04B4 +04B7 04B6 +04B9 04B8 +04BB 04BA +04BD 04BC +04BF 04BE +04C1 0416 +04C2 0416 +04C4 04C3 +04C8 04C7 +04CC 04CB +04D0 0410 +04D1 0410 +04D2 0410 +04D3 0410 +04D5 04D4 +04D6 0415 +04D7 0415 +04D9 04D8 +04DA 04D8 +04DB 04D8 +04DC 0416 +04DD 0416 +04DE 0417 +04DF 0417 +04E1 04E0 +04E2 0418 +04E3 0418 +04E4 0418 +04E5 0418 +04E6 041E +04E7 041E +04E9 04E8 +04EA 04E8 +04EB 04E8 +04EC 042D +04ED 042D +04EE 0423 +04EF 0423 +04F0 0423 +04F1 0423 +04F2 0423 +04F3 0423 +04F4 0427 +04F5 0427 +04F8 042B +04F9 042B +0561 0531 +0562 0532 +0563 0533 +0564 0534 +0565 0535 +0566 0536 +0567 0537 +0568 0538 +0569 0539 +056A 053A +056B 053B +056C 053C +056D 053D +056E 053E +056F 053F +0570 0540 +0571 0541 +0572 0542 +0573 0543 +0574 0544 +0575 0545 +0576 0546 +0577 0547 +0578 0548 +0579 0549 +057A 054A +057B 054B +057C 054C +057D 054D +057E 054E +057F 054F +0580 0550 +0581 0551 +0582 0552 +0583 0553 +0584 0554 +0585 0555 +0586 0556 +1E00 0041 +1E01 0041 +1E02 0042 +1E03 0042 +1E04 0042 +1E05 0042 +1E06 0042 +1E07 0042 +1E08 0043 +1E09 0043 +1E0A 0044 +1E0B 0044 +1E0C 0044 +1E0D 0044 +1E0E 0044 +1E0F 0044 +1E10 0044 +1E11 0044 +1E12 0044 +1E13 0044 +1E14 0045 +1E15 0045 +1E16 0045 +1E17 0045 +1E18 0045 +1E19 0045 +1E1A 0045 +1E1B 0045 +1E1C 0045 +1E1D 0045 +1E1E 0046 +1E1F 0046 +1E20 0047 +1E21 0047 +1E22 0048 +1E23 0048 +1E24 0048 +1E25 0048 +1E26 0048 +1E27 0048 +1E28 0048 +1E29 0048 +1E2A 0048 +1E2B 0048 +1E2C 0049 +1E2D 0049 +1E2E 0049 +1E2F 0049 +1E30 004B +1E31 004B +1E32 004B +1E33 004B +1E34 004B +1E35 004B +1E36 004C +1E37 004C +1E38 004C +1E39 004C +1E3A 004C +1E3B 004C +1E3C 004C +1E3D 004C +1E3E 004D +1E3F 004D +1E40 004D +1E41 004D +1E42 004D +1E43 004D +1E44 004E +1E45 004E +1E46 004E +1E47 004E +1E48 004E +1E49 004E +1E4A 004E +1E4B 004E +1E4C 004F +1E4D 004F +1E4E 004F +1E4F 004F +1E50 004F +1E51 004F +1E52 004F +1E53 004F +1E54 0050 +1E55 0050 +1E56 0050 +1E57 0050 +1E58 0052 +1E59 0052 +1E5A 0052 +1E5B 0052 +1E5C 0052 +1E5D 0052 +1E5E 0052 +1E5F 0052 +1E60 0053 +1E61 0053 +1E62 0053 +1E63 0053 +1E64 0053 +1E65 0053 +1E66 0053 +1E67 0053 +1E68 0053 +1E69 0053 +1E6A 0054 +1E6B 0054 +1E6C 0054 +1E6D 0054 +1E6E 0054 +1E6F 0054 +1E70 0054 +1E71 0054 +1E72 0055 +1E73 0055 +1E74 0055 +1E75 0055 +1E76 0055 +1E77 0055 +1E78 0055 +1E79 0055 +1E7A 0055 +1E7B 0055 +1E7C 0056 +1E7D 0056 +1E7E 0056 +1E7F 0056 +1E80 0057 +1E81 0057 +1E82 0057 +1E83 0057 +1E84 0057 +1E85 0057 +1E86 0057 +1E87 0057 +1E88 0057 +1E89 0057 +1E8A 0058 +1E8B 0058 +1E8C 0058 +1E8D 0058 +1E8E 0059 +1E8F 0059 +1E90 005A +1E91 005A +1E92 005A +1E93 005A +1E94 005A +1E95 005A +1E96 0048 +1E97 0054 +1E98 0057 +1E99 0059 +1E9B 0053 +1EA0 0041 +1EA1 0041 +1EA2 0041 +1EA3 0041 +1EA4 0041 +1EA5 0041 +1EA6 0041 +1EA7 0041 +1EA8 0041 +1EA9 0041 +1EAA 0041 +1EAB 0041 +1EAC 0041 +1EAD 0041 +1EAE 0041 +1EAF 0041 +1EB0 0041 +1EB1 0041 +1EB2 0041 +1EB3 0041 +1EB4 0041 +1EB5 0041 +1EB6 0041 +1EB7 0041 +1EB8 0045 +1EB9 0045 +1EBA 0045 +1EBB 0045 +1EBC 0045 +1EBD 0045 +1EBE 0045 +1EBF 0045 +1EC0 0045 +1EC1 0045 +1EC2 0045 +1EC3 0045 +1EC4 0045 +1EC5 0045 +1EC6 0045 +1EC7 0045 +1EC8 0049 +1EC9 0049 +1ECA 0049 +1ECB 0049 +1ECC 004F +1ECD 004F +1ECE 004F +1ECF 004F +1ED0 004F +1ED1 004F +1ED2 004F +1ED3 004F +1ED4 004F +1ED5 004F +1ED6 004F +1ED7 004F +1ED8 004F +1ED9 004F +1EDA 004F +1EDB 004F +1EDC 004F +1EDD 004F +1EDE 004F +1EDF 004F +1EE0 004F +1EE1 004F +1EE2 004F +1EE3 004F +1EE4 0055 +1EE5 0055 +1EE6 0055 +1EE7 0055 +1EE8 0055 +1EE9 0055 +1EEA 0055 +1EEB 0055 +1EEC 0055 +1EED 0055 +1EEE 0055 +1EEF 0055 +1EF0 0055 +1EF1 0055 +1EF2 0059 +1EF3 0059 +1EF4 0059 +1EF5 0059 +1EF6 0059 +1EF7 0059 +1EF8 0059 +1EF9 0059 +1F00 0391 +1F01 0391 +1F02 0391 +1F03 0391 +1F04 0391 +1F05 0391 +1F06 0391 +1F07 0391 +1F08 0391 +1F09 0391 +1F0A 0391 +1F0B 0391 +1F0C 0391 +1F0D 0391 +1F0E 0391 +1F0F 0391 +1F10 0395 +1F11 0395 +1F12 0395 +1F13 0395 +1F14 0395 +1F15 0395 +1F18 0395 +1F19 0395 +1F1A 0395 +1F1B 0395 +1F1C 0395 +1F1D 0395 +1F20 0397 +1F21 0397 +1F22 0397 +1F23 0397 +1F24 0397 +1F25 0397 +1F26 0397 +1F27 0397 +1F28 0397 +1F29 0397 +1F2A 0397 +1F2B 0397 +1F2C 0397 +1F2D 0397 +1F2E 0397 +1F2F 0397 +1F30 0399 +1F31 0399 +1F32 0399 +1F33 0399 +1F34 0399 +1F35 0399 +1F36 0399 +1F37 0399 +1F38 0399 +1F39 0399 +1F3A 0399 +1F3B 0399 +1F3C 0399 +1F3D 0399 +1F3E 0399 +1F3F 0399 +1F40 039F +1F41 039F +1F42 039F +1F43 039F +1F44 039F +1F45 039F +1F48 039F +1F49 039F +1F4A 039F +1F4B 039F +1F4C 039F +1F4D 039F +1F50 03A5 +1F51 03A5 +1F52 03A5 +1F53 03A5 +1F54 03A5 +1F55 03A5 +1F56 03A5 +1F57 03A5 +1F59 03A5 +1F5B 03A5 +1F5D 03A5 +1F5F 03A5 +1F60 03A9 +1F61 03A9 +1F62 03A9 +1F63 03A9 +1F64 03A9 +1F65 03A9 +1F66 03A9 +1F67 03A9 +1F68 03A9 +1F69 03A9 +1F6A 03A9 +1F6B 03A9 +1F6C 03A9 +1F6D 03A9 +1F6E 03A9 +1F6F 03A9 +1F70 0391 +1F71 1FBB +1F72 0395 +1F73 1FC9 +1F74 0397 +1F75 1FCB +1F76 0399 +1F77 1FDB +1F78 039F +1F79 1FF9 +1F7A 03A5 +1F7B 1FEB +1F7C 03A9 +1F7D 1FFB +1F80 0391 +1F81 0391 +1F82 0391 +1F83 0391 +1F84 0391 +1F85 0391 +1F86 0391 +1F87 0391 +1F88 0391 +1F89 0391 +1F8A 0391 +1F8B 0391 +1F8C 0391 +1F8D 0391 +1F8E 0391 +1F8F 0391 +1F90 0397 +1F91 0397 +1F92 0397 +1F93 0397 +1F94 0397 +1F95 0397 +1F96 0397 +1F97 0397 +1F98 0397 +1F99 0397 +1F9A 0397 +1F9B 0397 +1F9C 0397 +1F9D 0397 +1F9E 0397 +1F9F 0397 +1FA0 03A9 +1FA1 03A9 +1FA2 03A9 +1FA3 03A9 +1FA4 03A9 +1FA5 03A9 +1FA6 03A9 +1FA7 03A9 +1FA8 03A9 +1FA9 03A9 +1FAA 03A9 +1FAB 03A9 +1FAC 03A9 +1FAD 03A9 +1FAE 03A9 +1FAF 03A9 +1FB0 0391 +1FB1 0391 +1FB2 0391 +1FB3 0391 +1FB4 0391 +1FB6 0391 +1FB7 0391 +1FB8 0391 +1FB9 0391 +1FBA 0391 +1FBC 0391 +1FBE 0399 +1FC2 0397 +1FC3 0397 +1FC4 0397 +1FC6 0397 +1FC7 0397 +1FC8 0395 +1FCA 0397 +1FCC 0397 +1FD0 0399 +1FD1 0399 +1FD2 0399 +1FD6 0399 +1FD7 0399 +1FD8 0399 +1FD9 0399 +1FDA 0399 +1FE0 03A5 +1FE1 03A5 +1FE2 03A5 +1FE4 03A1 +1FE5 03A1 +1FE6 03A5 +1FE7 03A5 +1FE8 03A5 +1FE9 03A5 +1FEA 03A5 +1FEC 03A1 +1FF2 03A9 +1FF3 03A9 +1FF4 03A9 +1FF6 03A9 +1FF7 03A9 +1FF8 039F +1FFA 03A9 +1FFC 03A9 +2170 2160 +2171 2161 +2172 2162 +2173 2163 +2174 2164 +2175 2165 +2176 2166 +2177 2167 +2178 2168 +2179 2169 +217A 216A +217B 216B +217C 216C +217D 216D +217E 216E +217F 216F +24D0 24B6 +24D1 24B7 +24D2 24B8 +24D3 24B9 +24D4 24BA +24D5 24BB +24D6 24BC +24D7 24BD +24D8 24BE +24D9 24BF +24DA 24C0 +24DB 24C1 +24DC 24C2 +24DD 24C3 +24DE 24C4 +24DF 24C5 +24E0 24C6 +24E1 24C7 +24E2 24C8 +24E3 24C9 +24E4 24CA +24E5 24CB +24E6 24CC +24E7 24CD +24E8 24CE +24E9 24CF +FF41 FF21 +FF42 FF22 +FF43 FF23 +FF44 FF24 +FF45 FF25 +FF46 FF26 +FF47 FF27 +FF48 FF28 +FF49 FF29 +FF4A FF2A +FF4B FF2B +FF4C FF2C +FF4D FF2D +FF4E FF2E +FF4F FF2F +FF50 FF30 +FF51 FF31 +FF52 FF32 +FF53 FF33 +FF54 FF34 +FF55 FF35 +FF56 FF36 +FF57 FF37 +FF58 FF38 +FF59 FF39 +FF5A FF3A +DROP VIEW v_bmp; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_supplementary AS +SELECT + seq AS codepoint, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_65536_to_1114111', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_supplementary LIMIT 1; +COLLATION(c) +utf8mb4_general_ci +SELECT +SUM(HEX(WEIGHT_STRING(c))<>'FFFD'), +SUM(HEX(WEIGHT_STRING(c))='FFFD') +FROM v_supplementary; +SUM(HEX(WEIGHT_STRING(c))<>'FFFD') SUM(HEX(WEIGHT_STRING(c))='FFFD') +0 1048576 +DROP VIEW v_supplementary; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_utf8mb4_general_ci_ws.test b/mysql-test/main/ctype_utf8mb4_general_ci_ws.test new file mode 100644 index 0000000000000..5302becdd27ee --- /dev/null +++ b/mysql-test/main/ctype_utf8mb4_general_ci_ws.test @@ -0,0 +1,16 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET NAMES utf8mb4 COLLATE utf8mb4_general_ci; +--source include/ctype_unicode_ws_bmp.inc +--source include/ctype_unicode_ws_supplementary.inc + + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/ctype_utf8mb4_heap.result b/mysql-test/main/ctype_utf8mb4_heap.result index 83ae28929a617..657f06366e3e7 100644 --- a/mysql-test/main/ctype_utf8mb4_heap.result +++ b/mysql-test/main/ctype_utf8mb4_heap.result @@ -127,8 +127,8 @@ create table t1 ENGINE heap select date_format("2004-01-19 10:10:10", "%Y-%m-%d" show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 + `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; date_format("2004-01-19 10:10:10", "%Y-%m-%d") 2004-01-19 @@ -269,9 +269,9 @@ select null, null; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `s1` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL, - `s2` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `s1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `s2` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); @@ -357,8 +357,8 @@ create table t1 (a enum('aaaa','проба') character set utf8mb4) engine heap; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('aaaa','проба') CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 + `a` enum('aaaa','проба') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('проба'); select * from t1; a @@ -367,8 +367,8 @@ create table t2 engine heap select ifnull(a,a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `ifnull(a,a)` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 + `ifnull(a,a)` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t2; ifnull(a,a) проба @@ -493,9 +493,9 @@ unique key a using hash (c(1)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` char(10) CHARACTER SET utf8mb4 DEFAULT NULL, + `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING HASH -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -529,9 +529,9 @@ unique key a using btree (c(1)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` char(10) CHARACTER SET utf8mb4 DEFAULT NULL, + `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING BTREE -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -653,7 +653,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING HASH -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -689,7 +689,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING BTREE -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -840,9 +840,9 @@ create table t2 engine heap select concat(a,_utf8mb4'') as a, concat(b,_utf8mb4' show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL, - `b` varchar(15) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `b` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; drop table t1; select 'c' like '\_' as want0; @@ -1071,9 +1071,9 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8mb4 DEFAULT NULL, + `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, `b` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; a b @@ -2354,7 +2354,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `u_decimal` int(11) NOT NULL, `utf8mb4_encoding` varchar(10) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb4_encoding),utf8mb4_encoding FROM t1; u_decimal hex(utf8mb4_encoding) utf8mb4_encoding 1114111 3F ? @@ -2375,7 +2375,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `u_decimal` int(11) NOT NULL, `utf8mb3_encoding` varchar(10) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) 1114111 3F3F3F3F @@ -2387,7 +2387,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `u_decimal` int(11) NOT NULL, `utf8mb3_encoding` varchar(10) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) 1114111 3F3F3F3F @@ -2399,7 +2399,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `u_decimal` int(11) NOT NULL, `utf8mb4_encoding` varchar(10) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; u_decimal hex(utf8mb4_encoding) 1114111 3F @@ -2419,8 +2419,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `u_decimal` int(11) NOT NULL, - `utf8mb4_encoding` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `utf8mb4_encoding` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; u_decimal hex(utf8mb4_encoding) 1114111 3F @@ -2440,8 +2440,8 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `u_decimal` int(11) NOT NULL, - `utf8mb3_encoding` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `utf8mb3_encoding` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) 1114111 3F3F3F3F @@ -2486,10 +2486,10 @@ CREATE TEMPORARY TABLE t3 ENGINE heap AS SELECT *, concat(utf8mb4,utf8mb3) FROM SHOW CREATE TABLE t3; Table Create Table t3 CREATE TEMPORARY TABLE `t3` ( - `utf8mb4` varchar(10) CHARACTER SET utf8mb4 NOT NULL, - `utf8mb3` varchar(10) CHARACTER SET utf8mb3 NOT NULL, - `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 + `utf8mb4` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `utf8mb3` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TEMPORARY TABLE t3; SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3; utf8mb4 utf8mb3 diff --git a/mysql-test/main/ctype_utf8mb4_innodb.result b/mysql-test/main/ctype_utf8mb4_innodb.result index e7a64101cfc45..da6a465647e65 100644 --- a/mysql-test/main/ctype_utf8mb4_innodb.result +++ b/mysql-test/main/ctype_utf8mb4_innodb.result @@ -127,8 +127,8 @@ create table t1 ENGINE InnoDB select date_format("2004-01-19 10:10:10", "%Y-%m-% show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 + `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; date_format("2004-01-19 10:10:10", "%Y-%m-%d") 2004-01-19 @@ -281,9 +281,9 @@ select null, null; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `s1` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL, - `s2` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `s1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `s2` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); @@ -369,8 +369,8 @@ create table t1 (a enum('aaaa','проба') character set utf8mb4) engine InnoD show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('aaaa','проба') CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 + `a` enum('aaaa','проба') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('проба'); select * from t1; a @@ -379,8 +379,8 @@ create table t2 engine InnoDB select ifnull(a,a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `ifnull(a,a)` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 + `ifnull(a,a)` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t2; ifnull(a,a) проба @@ -505,9 +505,9 @@ unique key a using hash (c(1)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` char(10) CHARACTER SET utf8mb4 DEFAULT NULL, + `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING HASH -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -541,9 +541,9 @@ unique key a using btree (c(1)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` char(10) CHARACTER SET utf8mb4 DEFAULT NULL, + `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -665,7 +665,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING HASH -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -701,7 +701,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -903,9 +903,9 @@ create table t2 engine InnoDB select concat(a,_utf8mb4'') as a, concat(b,_utf8mb show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL, - `b` varchar(15) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `b` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; drop table t1; select 'c' like '\_' as want0; @@ -1134,9 +1134,9 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8mb4 DEFAULT NULL, + `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, `b` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; a b @@ -2366,7 +2366,7 @@ t1 CREATE TABLE `t1` ( `Tape` tinytext DEFAULT NULL, PRIMARY KEY (`clipid`), KEY `tape` (`Tape`(255)) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci DROP TABLE t1; # # Testing 4-byte values. @@ -2497,7 +2497,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `u_decimal` int(11) NOT NULL, `utf8mb4_encoding` varchar(10) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb4_encoding),utf8mb4_encoding FROM t1; u_decimal hex(utf8mb4_encoding) utf8mb4_encoding 1114111 3F ? @@ -2518,7 +2518,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `u_decimal` int(11) NOT NULL, `utf8mb3_encoding` varchar(10) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) 1114111 3F3F3F3F @@ -2530,7 +2530,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `u_decimal` int(11) NOT NULL, `utf8mb3_encoding` varchar(10) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) 1114111 3F3F3F3F @@ -2542,7 +2542,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `u_decimal` int(11) NOT NULL, `utf8mb4_encoding` varchar(10) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; u_decimal hex(utf8mb4_encoding) 1114111 3F @@ -2562,8 +2562,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `u_decimal` int(11) NOT NULL, - `utf8mb4_encoding` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 + `utf8mb4_encoding` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; u_decimal hex(utf8mb4_encoding) 1114111 3F @@ -2583,8 +2583,8 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `u_decimal` int(11) NOT NULL, - `utf8mb3_encoding` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 + `utf8mb3_encoding` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) 1114111 3F3F3F3F @@ -2629,10 +2629,10 @@ CREATE TEMPORARY TABLE t3 ENGINE InnoDB AS SELECT *, concat(utf8mb4,utf8mb3) FRO SHOW CREATE TABLE t3; Table Create Table t3 CREATE TEMPORARY TABLE `t3` ( - `utf8mb4` varchar(10) CHARACTER SET utf8mb4 NOT NULL, - `utf8mb3` varchar(10) CHARACTER SET utf8mb3 NOT NULL, - `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 + `utf8mb4` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `utf8mb3` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TEMPORARY TABLE t3; SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3; utf8mb4 utf8mb3 diff --git a/mysql-test/main/ctype_utf8mb4_innodb.test b/mysql-test/main/ctype_utf8mb4_innodb.test index 3bf0612a1ab6e..75667e04d5f99 100644 --- a/mysql-test/main/ctype_utf8mb4_innodb.test +++ b/mysql-test/main/ctype_utf8mb4_innodb.test @@ -1,3 +1,6 @@ +# Enable after fix MDEV-27904 +-- source include/no_view_protocol.inc + --source include/have_utf8mb4.inc --source include/have_innodb.inc diff --git a/mysql-test/main/ctype_utf8mb4_myisam.result b/mysql-test/main/ctype_utf8mb4_myisam.result index 2360b828b9a77..7e579e609b07e 100644 --- a/mysql-test/main/ctype_utf8mb4_myisam.result +++ b/mysql-test/main/ctype_utf8mb4_myisam.result @@ -127,8 +127,8 @@ create table t1 ENGINE MyISAM select date_format("2004-01-19 10:10:10", "%Y-%m-% show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; date_format("2004-01-19 10:10:10", "%Y-%m-%d") 2004-01-19 @@ -284,9 +284,9 @@ select null, null; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `s1` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL, - `s2` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `s1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `s2` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); @@ -372,8 +372,8 @@ create table t1 (a enum('aaaa','проба') character set utf8mb4) engine MyISA show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('aaaa','проба') CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` enum('aaaa','проба') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('проба'); select * from t1; a @@ -382,8 +382,8 @@ create table t2 engine MyISAM select ifnull(a,a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `ifnull(a,a)` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `ifnull(a,a)` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t2; ifnull(a,a) проба @@ -508,9 +508,9 @@ unique key a using hash (c(1)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` char(10) CHARACTER SET utf8mb4 DEFAULT NULL, + `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -544,9 +544,9 @@ unique key a using btree (c(1)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` char(10) CHARACTER SET utf8mb4 DEFAULT NULL, + `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING BTREE -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -668,7 +668,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -704,7 +704,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING BTREE -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'a' for key 'a' @@ -906,9 +906,9 @@ create table t2 engine MyISAM select concat(a,_utf8mb4'') as a, concat(b,_utf8mb show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL, - `b` varchar(15) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `b` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; drop table t1; select 'c' like '\_' as want0; @@ -1137,9 +1137,9 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8mb4 DEFAULT NULL, + `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, `b` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; a b @@ -2375,7 +2375,7 @@ t1 CREATE TABLE `t1` ( `Tape` tinytext DEFAULT NULL, PRIMARY KEY (`clipid`), KEY `tape` (`Tape`(250)) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci DROP TABLE t1; # # Testing 4-byte values. @@ -2506,7 +2506,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `u_decimal` int(11) NOT NULL, `utf8mb4_encoding` varchar(10) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb4_encoding),utf8mb4_encoding FROM t1; u_decimal hex(utf8mb4_encoding) utf8mb4_encoding 1114111 3F ? @@ -2527,7 +2527,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `u_decimal` int(11) NOT NULL, `utf8mb3_encoding` varchar(10) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) 1114111 3F3F3F3F @@ -2539,7 +2539,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `u_decimal` int(11) NOT NULL, `utf8mb3_encoding` varchar(10) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) 1114111 3F3F3F3F @@ -2551,7 +2551,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `u_decimal` int(11) NOT NULL, `utf8mb4_encoding` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; u_decimal hex(utf8mb4_encoding) 1114111 3F @@ -2571,8 +2571,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `u_decimal` int(11) NOT NULL, - `utf8mb4_encoding` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 + `utf8mb4_encoding` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; u_decimal hex(utf8mb4_encoding) 1114111 3F @@ -2592,8 +2592,8 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `u_decimal` int(11) NOT NULL, - `utf8mb3_encoding` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 + `utf8mb3_encoding` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) 1114111 3F3F3F3F @@ -2638,10 +2638,10 @@ CREATE TEMPORARY TABLE t3 ENGINE MyISAM AS SELECT *, concat(utf8mb4,utf8mb3) FRO SHOW CREATE TABLE t3; Table Create Table t3 CREATE TEMPORARY TABLE `t3` ( - `utf8mb4` varchar(10) CHARACTER SET utf8mb4 NOT NULL, - `utf8mb3` varchar(10) CHARACTER SET utf8mb3 NOT NULL, - `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `utf8mb4` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `utf8mb3` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TEMPORARY TABLE t3; SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3; utf8mb4 utf8mb3 diff --git a/mysql-test/main/ctype_utf8mb4_turkish_ci_casefold.result b/mysql-test/main/ctype_utf8mb4_turkish_ci_casefold.result new file mode 100644 index 0000000000000..d7db9b0bb2e9f --- /dev/null +++ b/mysql-test/main/ctype_utf8mb4_turkish_ci_casefold.result @@ -0,0 +1,1446 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET NAMES utf8mb4 COLLATE utf8mb4_turkish_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +utf8mb4_turkish_ci +SELECT +codepoint_hex4, +HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)), +HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +FROM v_bmp +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); +codepoint_hex4 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +0041 0061 0041 +0042 0062 0042 +0043 0063 0043 +0044 0064 0044 +0045 0065 0045 +0046 0066 0046 +0047 0067 0047 +0048 0068 0048 +0049 0131 0049 +004A 006A 004A +004B 006B 004B +004C 006C 004C +004D 006D 004D +004E 006E 004E +004F 006F 004F +0050 0070 0050 +0051 0071 0051 +0052 0072 0052 +0053 0073 0053 +0054 0074 0054 +0055 0075 0055 +0056 0076 0056 +0057 0077 0057 +0058 0078 0058 +0059 0079 0059 +005A 007A 005A +0061 0061 0041 +0062 0062 0042 +0063 0063 0043 +0064 0064 0044 +0065 0065 0045 +0066 0066 0046 +0067 0067 0047 +0068 0068 0048 +0069 0069 0130 +006A 006A 004A +006B 006B 004B +006C 006C 004C +006D 006D 004D +006E 006E 004E +006F 006F 004F +0070 0070 0050 +0071 0071 0051 +0072 0072 0052 +0073 0073 0053 +0074 0074 0054 +0075 0075 0055 +0076 0076 0056 +0077 0077 0057 +0078 0078 0058 +0079 0079 0059 +007A 007A 005A +00B5 00B5 039C +00C0 00E0 00C0 +00C1 00E1 00C1 +00C2 00E2 00C2 +00C3 00E3 00C3 +00C4 00E4 00C4 +00C5 00E5 00C5 +00C6 00E6 00C6 +00C7 00E7 00C7 +00C8 00E8 00C8 +00C9 00E9 00C9 +00CA 00EA 00CA +00CB 00EB 00CB +00CC 00EC 00CC +00CD 00ED 00CD +00CE 00EE 00CE +00CF 00EF 00CF +00D0 00F0 00D0 +00D1 00F1 00D1 +00D2 00F2 00D2 +00D3 00F3 00D3 +00D4 00F4 00D4 +00D5 00F5 00D5 +00D6 00F6 00D6 +00D8 00F8 00D8 +00D9 00F9 00D9 +00DA 00FA 00DA +00DB 00FB 00DB +00DC 00FC 00DC +00DD 00FD 00DD +00DE 00FE 00DE +00E0 00E0 00C0 +00E1 00E1 00C1 +00E2 00E2 00C2 +00E3 00E3 00C3 +00E4 00E4 00C4 +00E5 00E5 00C5 +00E6 00E6 00C6 +00E7 00E7 00C7 +00E8 00E8 00C8 +00E9 00E9 00C9 +00EA 00EA 00CA +00EB 00EB 00CB +00EC 00EC 00CC +00ED 00ED 00CD +00EE 00EE 00CE +00EF 00EF 00CF +00F0 00F0 00D0 +00F1 00F1 00D1 +00F2 00F2 00D2 +00F3 00F3 00D3 +00F4 00F4 00D4 +00F5 00F5 00D5 +00F6 00F6 00D6 +00F8 00F8 00D8 +00F9 00F9 00D9 +00FA 00FA 00DA +00FB 00FB 00DB +00FC 00FC 00DC +00FD 00FD 00DD +00FE 00FE 00DE +00FF 00FF 0178 +0100 0101 0100 +0101 0101 0100 +0102 0103 0102 +0103 0103 0102 +0104 0105 0104 +0105 0105 0104 +0106 0107 0106 +0107 0107 0106 +0108 0109 0108 +0109 0109 0108 +010A 010B 010A +010B 010B 010A +010C 010D 010C +010D 010D 010C +010E 010F 010E +010F 010F 010E +0110 0111 0110 +0111 0111 0110 +0112 0113 0112 +0113 0113 0112 +0114 0115 0114 +0115 0115 0114 +0116 0117 0116 +0117 0117 0116 +0118 0119 0118 +0119 0119 0118 +011A 011B 011A +011B 011B 011A +011C 011D 011C +011D 011D 011C +011E 011F 011E +011F 011F 011E +0120 0121 0120 +0121 0121 0120 +0122 0123 0122 +0123 0123 0122 +0124 0125 0124 +0125 0125 0124 +0126 0127 0126 +0127 0127 0126 +0128 0129 0128 +0129 0129 0128 +012A 012B 012A +012B 012B 012A +012C 012D 012C +012D 012D 012C +012E 012F 012E +012F 012F 012E +0130 0069 0130 +0131 0131 0049 +0132 0133 0132 +0133 0133 0132 +0134 0135 0134 +0135 0135 0134 +0136 0137 0136 +0137 0137 0136 +0139 013A 0139 +013A 013A 0139 +013B 013C 013B +013C 013C 013B +013D 013E 013D +013E 013E 013D +013F 0140 013F +0140 0140 013F +0141 0142 0141 +0142 0142 0141 +0143 0144 0143 +0144 0144 0143 +0145 0146 0145 +0146 0146 0145 +0147 0148 0147 +0148 0148 0147 +014A 014B 014A +014B 014B 014A +014C 014D 014C +014D 014D 014C +014E 014F 014E +014F 014F 014E +0150 0151 0150 +0151 0151 0150 +0152 0153 0152 +0153 0153 0152 +0154 0155 0154 +0155 0155 0154 +0156 0157 0156 +0157 0157 0156 +0158 0159 0158 +0159 0159 0158 +015A 015B 015A +015B 015B 015A +015C 015D 015C +015D 015D 015C +015E 015F 015E +015F 015F 015E +0160 0161 0160 +0161 0161 0160 +0162 0163 0162 +0163 0163 0162 +0164 0165 0164 +0165 0165 0164 +0166 0167 0166 +0167 0167 0166 +0168 0169 0168 +0169 0169 0168 +016A 016B 016A +016B 016B 016A +016C 016D 016C +016D 016D 016C +016E 016F 016E +016F 016F 016E +0170 0171 0170 +0171 0171 0170 +0172 0173 0172 +0173 0173 0172 +0174 0175 0174 +0175 0175 0174 +0176 0177 0176 +0177 0177 0176 +0178 00FF 0178 +0179 017A 0179 +017A 017A 0179 +017B 017C 017B +017C 017C 017B +017D 017E 017D +017E 017E 017D +017F 017F 0053 +0181 0253 0181 +0182 0183 0182 +0183 0183 0182 +0184 0185 0184 +0185 0185 0184 +0186 0254 0186 +0187 0188 0187 +0188 0188 0187 +0189 0256 0189 +018A 0257 018A +018B 018C 018B +018C 018C 018B +018E 01DD 018E +018F 0259 018F +0190 025B 0190 +0191 0192 0191 +0192 0192 0191 +0193 0260 0193 +0194 0263 0194 +0195 0195 01F6 +0196 0269 0196 +0197 0268 0197 +0198 0199 0198 +0199 0199 0198 +019C 026F 019C +019D 0272 019D +019F 0275 019F +01A0 01A1 01A0 +01A1 01A1 01A0 +01A2 01A3 01A2 +01A3 01A3 01A2 +01A4 01A5 01A4 +01A5 01A5 01A4 +01A6 0280 01A6 +01A7 01A8 01A7 +01A8 01A8 01A7 +01A9 0283 01A9 +01AC 01AD 01AC +01AD 01AD 01AC +01AE 0288 01AE +01AF 01B0 01AF +01B0 01B0 01AF +01B1 028A 01B1 +01B2 028B 01B2 +01B3 01B4 01B3 +01B4 01B4 01B3 +01B5 01B6 01B5 +01B6 01B6 01B5 +01B7 0292 01B7 +01B8 01B9 01B8 +01B9 01B9 01B8 +01BC 01BD 01BC +01BD 01BD 01BC +01BF 01BF 01F7 +01C4 01C6 01C4 +01C5 01C6 01C4 +01C6 01C6 01C4 +01C7 01C9 01C7 +01C8 01C9 01C7 +01C9 01C9 01C7 +01CA 01CC 01CA +01CB 01CC 01CA +01CC 01CC 01CA +01CD 01CE 01CD +01CE 01CE 01CD +01CF 01D0 01CF +01D0 01D0 01CF +01D1 01D2 01D1 +01D2 01D2 01D1 +01D3 01D4 01D3 +01D4 01D4 01D3 +01D5 01D6 01D5 +01D6 01D6 01D5 +01D7 01D8 01D7 +01D8 01D8 01D7 +01D9 01DA 01D9 +01DA 01DA 01D9 +01DB 01DC 01DB +01DC 01DC 01DB +01DD 01DD 018E +01DE 01DF 01DE +01DF 01DF 01DE +01E0 01E1 01E0 +01E1 01E1 01E0 +01E2 01E3 01E2 +01E3 01E3 01E2 +01E4 01E5 01E4 +01E5 01E5 01E4 +01E6 01E7 01E6 +01E7 01E7 01E6 +01E8 01E9 01E8 +01E9 01E9 01E8 +01EA 01EB 01EA +01EB 01EB 01EA +01EC 01ED 01EC +01ED 01ED 01EC +01EE 01EF 01EE +01EF 01EF 01EE +01F1 01F3 01F1 +01F2 01F3 01F1 +01F3 01F3 01F1 +01F4 01F5 01F4 +01F5 01F5 01F4 +01F6 0195 01F6 +01F7 01BF 01F7 +01F8 01F9 01F8 +01F9 01F9 01F8 +01FA 01FB 01FA +01FB 01FB 01FA +01FC 01FD 01FC +01FD 01FD 01FC +01FE 01FF 01FE +01FF 01FF 01FE +0200 0201 0200 +0201 0201 0200 +0202 0203 0202 +0203 0203 0202 +0204 0205 0204 +0205 0205 0204 +0206 0207 0206 +0207 0207 0206 +0208 0209 0208 +0209 0209 0208 +020A 020B 020A +020B 020B 020A +020C 020D 020C +020D 020D 020C +020E 020F 020E +020F 020F 020E +0210 0211 0210 +0211 0211 0210 +0212 0213 0212 +0213 0213 0212 +0214 0215 0214 +0215 0215 0214 +0216 0217 0216 +0217 0217 0216 +0218 0219 0218 +0219 0219 0218 +021A 021B 021A +021B 021B 021A +021C 021D 021C +021D 021D 021C +021E 021F 021E +021F 021F 021E +0222 0223 0222 +0223 0223 0222 +0224 0225 0224 +0225 0225 0224 +0226 0227 0226 +0227 0227 0226 +0228 0229 0228 +0229 0229 0228 +022A 022B 022A +022B 022B 022A +022C 022D 022C +022D 022D 022C +022E 022F 022E +022F 022F 022E +0230 0231 0230 +0231 0231 0230 +0232 0233 0232 +0233 0233 0232 +0253 0253 0181 +0254 0254 0186 +0256 0256 0189 +0257 0257 018A +0259 0259 018F +025B 025B 0190 +0260 0260 0193 +0263 0263 0194 +0268 0268 0197 +0269 0269 0196 +026F 026F 019C +0272 0272 019D +0275 0275 019F +0280 0280 01A6 +0283 0283 01A9 +0288 0288 01AE +028A 028A 01B1 +028B 028B 01B2 +0292 0292 01B7 +0345 0345 0399 +0386 03AC 0386 +0388 03AD 0388 +0389 03AE 0389 +038A 03AF 038A +038C 03CC 038C +038E 03CD 038E +038F 03CE 038F +0391 03B1 0391 +0392 03B2 0392 +0393 03B3 0393 +0394 03B4 0394 +0395 03B5 0395 +0396 03B6 0396 +0397 03B7 0397 +0398 03B8 0398 +0399 03B9 0399 +039A 03BA 039A +039B 03BB 039B +039C 03BC 039C +039D 03BD 039D +039E 03BE 039E +039F 03BF 039F +03A0 03C0 03A0 +03A1 03C1 03A1 +03A3 03C3 03A3 +03A4 03C4 03A4 +03A5 03C5 03A5 +03A6 03C6 03A6 +03A7 03C7 03A7 +03A8 03C8 03A8 +03A9 03C9 03A9 +03AA 03CA 03AA +03AB 03CB 03AB +03AC 03AC 0386 +03AD 03AD 0388 +03AE 03AE 0389 +03AF 03AF 038A +03B1 03B1 0391 +03B2 03B2 0392 +03B3 03B3 0393 +03B4 03B4 0394 +03B5 03B5 0395 +03B6 03B6 0396 +03B7 03B7 0397 +03B8 03B8 0398 +03B9 03B9 0399 +03BA 03BA 039A +03BB 03BB 039B +03BC 03BC 039C +03BD 03BD 039D +03BE 03BE 039E +03BF 03BF 039F +03C0 03C0 03A0 +03C1 03C1 03A1 +03C2 03C2 03A3 +03C3 03C3 03A3 +03C4 03C4 03A4 +03C5 03C5 03A5 +03C6 03C6 03A6 +03C7 03C7 03A7 +03C8 03C8 03A8 +03C9 03C9 03A9 +03CA 03CA 03AA +03CB 03CB 03AB +03CC 03CC 038C +03CD 03CD 038E +03CE 03CE 038F +03D0 03D0 0392 +03D1 03D1 0398 +03D5 03D5 03A6 +03D6 03D6 03A0 +03DA 03DB 03DA +03DB 03DB 03DA +03DC 03DD 03DC +03DD 03DD 03DC +03DE 03DF 03DE +03DF 03DF 03DE +03E0 03E1 03E0 +03E1 03E1 03E0 +03E2 03E3 03E2 +03E3 03E3 03E2 +03E4 03E5 03E4 +03E5 03E5 03E4 +03E6 03E7 03E6 +03E7 03E7 03E6 +03E8 03E9 03E8 +03E9 03E9 03E8 +03EA 03EB 03EA +03EB 03EB 03EA +03EC 03ED 03EC +03ED 03ED 03EC +03EE 03EF 03EE +03EF 03EF 03EE +03F0 03F0 039A +03F1 03F1 03A1 +03F2 03F2 03A3 +0400 0450 0400 +0401 0451 0401 +0402 0452 0402 +0403 0453 0403 +0404 0454 0404 +0405 0455 0405 +0406 0456 0406 +0407 0457 0407 +0408 0458 0408 +0409 0459 0409 +040A 045A 040A +040B 045B 040B +040C 045C 040C +040D 045D 040D +040E 045E 040E +040F 045F 040F +0410 0430 0410 +0411 0431 0411 +0412 0432 0412 +0413 0433 0413 +0414 0434 0414 +0415 0435 0415 +0416 0436 0416 +0417 0437 0417 +0418 0438 0418 +0419 0439 0419 +041A 043A 041A +041B 043B 041B +041C 043C 041C +041D 043D 041D +041E 043E 041E +041F 043F 041F +0420 0440 0420 +0421 0441 0421 +0422 0442 0422 +0423 0443 0423 +0424 0444 0424 +0425 0445 0425 +0426 0446 0426 +0427 0447 0427 +0428 0448 0428 +0429 0449 0429 +042A 044A 042A +042B 044B 042B +042C 044C 042C +042D 044D 042D +042E 044E 042E +042F 044F 042F +0430 0430 0410 +0431 0431 0411 +0432 0432 0412 +0433 0433 0413 +0434 0434 0414 +0435 0435 0415 +0436 0436 0416 +0437 0437 0417 +0438 0438 0418 +0439 0439 0419 +043A 043A 041A +043B 043B 041B +043C 043C 041C +043D 043D 041D +043E 043E 041E +043F 043F 041F +0440 0440 0420 +0441 0441 0421 +0442 0442 0422 +0443 0443 0423 +0444 0444 0424 +0445 0445 0425 +0446 0446 0426 +0447 0447 0427 +0448 0448 0428 +0449 0449 0429 +044A 044A 042A +044B 044B 042B +044C 044C 042C +044D 044D 042D +044E 044E 042E +044F 044F 042F +0450 0450 0400 +0451 0451 0401 +0452 0452 0402 +0453 0453 0403 +0454 0454 0404 +0455 0455 0405 +0456 0456 0406 +0457 0457 0407 +0458 0458 0408 +0459 0459 0409 +045A 045A 040A +045B 045B 040B +045C 045C 040C +045D 045D 040D +045E 045E 040E +045F 045F 040F +0460 0461 0460 +0461 0461 0460 +0462 0463 0462 +0463 0463 0462 +0464 0465 0464 +0465 0465 0464 +0466 0467 0466 +0467 0467 0466 +0468 0469 0468 +0469 0469 0468 +046A 046B 046A +046B 046B 046A +046C 046D 046C +046D 046D 046C +046E 046F 046E +046F 046F 046E +0470 0471 0470 +0471 0471 0470 +0472 0473 0472 +0473 0473 0472 +0474 0475 0474 +0475 0475 0474 +0476 0477 0476 +0477 0477 0476 +0478 0479 0478 +0479 0479 0478 +047A 047B 047A +047B 047B 047A +047C 047D 047C +047D 047D 047C +047E 047F 047E +047F 047F 047E +0480 0481 0480 +0481 0481 0480 +048C 048D 048C +048D 048D 048C +048E 048F 048E +048F 048F 048E +0490 0491 0490 +0491 0491 0490 +0492 0493 0492 +0493 0493 0492 +0494 0495 0494 +0495 0495 0494 +0496 0497 0496 +0497 0497 0496 +0498 0499 0498 +0499 0499 0498 +049A 049B 049A +049B 049B 049A +049C 049D 049C +049D 049D 049C +049E 049F 049E +049F 049F 049E +04A0 04A1 04A0 +04A1 04A1 04A0 +04A2 04A3 04A2 +04A3 04A3 04A2 +04A4 04A5 04A4 +04A5 04A5 04A4 +04A6 04A7 04A6 +04A7 04A7 04A6 +04A8 04A9 04A8 +04A9 04A9 04A8 +04AA 04AB 04AA +04AB 04AB 04AA +04AC 04AD 04AC +04AD 04AD 04AC +04AE 04AF 04AE +04AF 04AF 04AE +04B0 04B1 04B0 +04B1 04B1 04B0 +04B2 04B3 04B2 +04B3 04B3 04B2 +04B4 04B5 04B4 +04B5 04B5 04B4 +04B6 04B7 04B6 +04B7 04B7 04B6 +04B8 04B9 04B8 +04B9 04B9 04B8 +04BA 04BB 04BA +04BB 04BB 04BA +04BC 04BD 04BC +04BD 04BD 04BC +04BE 04BF 04BE +04BF 04BF 04BE +04C1 04C2 04C1 +04C2 04C2 04C1 +04C3 04C4 04C3 +04C4 04C4 04C3 +04C7 04C8 04C7 +04C8 04C8 04C7 +04CB 04CC 04CB +04CC 04CC 04CB +04D0 04D1 04D0 +04D1 04D1 04D0 +04D2 04D3 04D2 +04D3 04D3 04D2 +04D4 04D5 04D4 +04D5 04D5 04D4 +04D6 04D7 04D6 +04D7 04D7 04D6 +04D8 04D9 04D8 +04D9 04D9 04D8 +04DA 04DB 04DA +04DB 04DB 04DA +04DC 04DD 04DC +04DD 04DD 04DC +04DE 04DF 04DE +04DF 04DF 04DE +04E0 04E1 04E0 +04E1 04E1 04E0 +04E2 04E3 04E2 +04E3 04E3 04E2 +04E4 04E5 04E4 +04E5 04E5 04E4 +04E6 04E7 04E6 +04E7 04E7 04E6 +04E8 04E9 04E8 +04E9 04E9 04E8 +04EA 04EB 04EA +04EB 04EB 04EA +04EC 04ED 04EC +04ED 04ED 04EC +04EE 04EF 04EE +04EF 04EF 04EE +04F0 04F1 04F0 +04F1 04F1 04F0 +04F2 04F3 04F2 +04F3 04F3 04F2 +04F4 04F5 04F4 +04F5 04F5 04F4 +04F8 04F9 04F8 +04F9 04F9 04F8 +0531 0561 0531 +0532 0562 0532 +0533 0563 0533 +0534 0564 0534 +0535 0565 0535 +0536 0566 0536 +0537 0567 0537 +0538 0568 0538 +0539 0569 0539 +053A 056A 053A +053B 056B 053B +053C 056C 053C +053D 056D 053D +053E 056E 053E +053F 056F 053F +0540 0570 0540 +0541 0571 0541 +0542 0572 0542 +0543 0573 0543 +0544 0574 0544 +0545 0575 0545 +0546 0576 0546 +0547 0577 0547 +0548 0578 0548 +0549 0579 0549 +054A 057A 054A +054B 057B 054B +054C 057C 054C +054D 057D 054D +054E 057E 054E +054F 057F 054F +0550 0580 0550 +0551 0581 0551 +0552 0582 0552 +0553 0583 0553 +0554 0584 0554 +0555 0585 0555 +0556 0586 0556 +0561 0561 0531 +0562 0562 0532 +0563 0563 0533 +0564 0564 0534 +0565 0565 0535 +0566 0566 0536 +0567 0567 0537 +0568 0568 0538 +0569 0569 0539 +056A 056A 053A +056B 056B 053B +056C 056C 053C +056D 056D 053D +056E 056E 053E +056F 056F 053F +0570 0570 0540 +0571 0571 0541 +0572 0572 0542 +0573 0573 0543 +0574 0574 0544 +0575 0575 0545 +0576 0576 0546 +0577 0577 0547 +0578 0578 0548 +0579 0579 0549 +057A 057A 054A +057B 057B 054B +057C 057C 054C +057D 057D 054D +057E 057E 054E +057F 057F 054F +0580 0580 0550 +0581 0581 0551 +0582 0582 0552 +0583 0583 0553 +0584 0584 0554 +0585 0585 0555 +0586 0586 0556 +1E00 1E01 1E00 +1E01 1E01 1E00 +1E02 1E03 1E02 +1E03 1E03 1E02 +1E04 1E05 1E04 +1E05 1E05 1E04 +1E06 1E07 1E06 +1E07 1E07 1E06 +1E08 1E09 1E08 +1E09 1E09 1E08 +1E0A 1E0B 1E0A +1E0B 1E0B 1E0A +1E0C 1E0D 1E0C +1E0D 1E0D 1E0C +1E0E 1E0F 1E0E +1E0F 1E0F 1E0E +1E10 1E11 1E10 +1E11 1E11 1E10 +1E12 1E13 1E12 +1E13 1E13 1E12 +1E14 1E15 1E14 +1E15 1E15 1E14 +1E16 1E17 1E16 +1E17 1E17 1E16 +1E18 1E19 1E18 +1E19 1E19 1E18 +1E1A 1E1B 1E1A +1E1B 1E1B 1E1A +1E1C 1E1D 1E1C +1E1D 1E1D 1E1C +1E1E 1E1F 1E1E +1E1F 1E1F 1E1E +1E20 1E21 1E20 +1E21 1E21 1E20 +1E22 1E23 1E22 +1E23 1E23 1E22 +1E24 1E25 1E24 +1E25 1E25 1E24 +1E26 1E27 1E26 +1E27 1E27 1E26 +1E28 1E29 1E28 +1E29 1E29 1E28 +1E2A 1E2B 1E2A +1E2B 1E2B 1E2A +1E2C 1E2D 1E2C +1E2D 1E2D 1E2C +1E2E 1E2F 1E2E +1E2F 1E2F 1E2E +1E30 1E31 1E30 +1E31 1E31 1E30 +1E32 1E33 1E32 +1E33 1E33 1E32 +1E34 1E35 1E34 +1E35 1E35 1E34 +1E36 1E37 1E36 +1E37 1E37 1E36 +1E38 1E39 1E38 +1E39 1E39 1E38 +1E3A 1E3B 1E3A +1E3B 1E3B 1E3A +1E3C 1E3D 1E3C +1E3D 1E3D 1E3C +1E3E 1E3F 1E3E +1E3F 1E3F 1E3E +1E40 1E41 1E40 +1E41 1E41 1E40 +1E42 1E43 1E42 +1E43 1E43 1E42 +1E44 1E45 1E44 +1E45 1E45 1E44 +1E46 1E47 1E46 +1E47 1E47 1E46 +1E48 1E49 1E48 +1E49 1E49 1E48 +1E4A 1E4B 1E4A +1E4B 1E4B 1E4A +1E4C 1E4D 1E4C +1E4D 1E4D 1E4C +1E4E 1E4F 1E4E +1E4F 1E4F 1E4E +1E50 1E51 1E50 +1E51 1E51 1E50 +1E52 1E53 1E52 +1E53 1E53 1E52 +1E54 1E55 1E54 +1E55 1E55 1E54 +1E56 1E57 1E56 +1E57 1E57 1E56 +1E58 1E59 1E58 +1E59 1E59 1E58 +1E5A 1E5B 1E5A +1E5B 1E5B 1E5A +1E5C 1E5D 1E5C +1E5D 1E5D 1E5C +1E5E 1E5F 1E5E +1E5F 1E5F 1E5E +1E60 1E61 1E60 +1E61 1E61 1E60 +1E62 1E63 1E62 +1E63 1E63 1E62 +1E64 1E65 1E64 +1E65 1E65 1E64 +1E66 1E67 1E66 +1E67 1E67 1E66 +1E68 1E69 1E68 +1E69 1E69 1E68 +1E6A 1E6B 1E6A +1E6B 1E6B 1E6A +1E6C 1E6D 1E6C +1E6D 1E6D 1E6C +1E6E 1E6F 1E6E +1E6F 1E6F 1E6E +1E70 1E71 1E70 +1E71 1E71 1E70 +1E72 1E73 1E72 +1E73 1E73 1E72 +1E74 1E75 1E74 +1E75 1E75 1E74 +1E76 1E77 1E76 +1E77 1E77 1E76 +1E78 1E79 1E78 +1E79 1E79 1E78 +1E7A 1E7B 1E7A +1E7B 1E7B 1E7A +1E7C 1E7D 1E7C +1E7D 1E7D 1E7C +1E7E 1E7F 1E7E +1E7F 1E7F 1E7E +1E80 1E81 1E80 +1E81 1E81 1E80 +1E82 1E83 1E82 +1E83 1E83 1E82 +1E84 1E85 1E84 +1E85 1E85 1E84 +1E86 1E87 1E86 +1E87 1E87 1E86 +1E88 1E89 1E88 +1E89 1E89 1E88 +1E8A 1E8B 1E8A +1E8B 1E8B 1E8A +1E8C 1E8D 1E8C +1E8D 1E8D 1E8C +1E8E 1E8F 1E8E +1E8F 1E8F 1E8E +1E90 1E91 1E90 +1E91 1E91 1E90 +1E92 1E93 1E92 +1E93 1E93 1E92 +1E94 1E95 1E94 +1E95 1E95 1E94 +1E9B 1E9B 1E60 +1EA0 1EA1 1EA0 +1EA1 1EA1 1EA0 +1EA2 1EA3 1EA2 +1EA3 1EA3 1EA2 +1EA4 1EA5 1EA4 +1EA5 1EA5 1EA4 +1EA6 1EA7 1EA6 +1EA7 1EA7 1EA6 +1EA8 1EA9 1EA8 +1EA9 1EA9 1EA8 +1EAA 1EAB 1EAA +1EAB 1EAB 1EAA +1EAC 1EAD 1EAC +1EAD 1EAD 1EAC +1EAE 1EAF 1EAE +1EAF 1EAF 1EAE +1EB0 1EB1 1EB0 +1EB1 1EB1 1EB0 +1EB2 1EB3 1EB2 +1EB3 1EB3 1EB2 +1EB4 1EB5 1EB4 +1EB5 1EB5 1EB4 +1EB6 1EB7 1EB6 +1EB7 1EB7 1EB6 +1EB8 1EB9 1EB8 +1EB9 1EB9 1EB8 +1EBA 1EBB 1EBA +1EBB 1EBB 1EBA +1EBC 1EBD 1EBC +1EBD 1EBD 1EBC +1EBE 1EBF 1EBE +1EBF 1EBF 1EBE +1EC0 1EC1 1EC0 +1EC1 1EC1 1EC0 +1EC2 1EC3 1EC2 +1EC3 1EC3 1EC2 +1EC4 1EC5 1EC4 +1EC5 1EC5 1EC4 +1EC6 1EC7 1EC6 +1EC7 1EC7 1EC6 +1EC8 1EC9 1EC8 +1EC9 1EC9 1EC8 +1ECA 1ECB 1ECA +1ECB 1ECB 1ECA +1ECC 1ECD 1ECC +1ECD 1ECD 1ECC +1ECE 1ECF 1ECE +1ECF 1ECF 1ECE +1ED0 1ED1 1ED0 +1ED1 1ED1 1ED0 +1ED2 1ED3 1ED2 +1ED3 1ED3 1ED2 +1ED4 1ED5 1ED4 +1ED5 1ED5 1ED4 +1ED6 1ED7 1ED6 +1ED7 1ED7 1ED6 +1ED8 1ED9 1ED8 +1ED9 1ED9 1ED8 +1EDA 1EDB 1EDA +1EDB 1EDB 1EDA +1EDC 1EDD 1EDC +1EDD 1EDD 1EDC +1EDE 1EDF 1EDE +1EDF 1EDF 1EDE +1EE0 1EE1 1EE0 +1EE1 1EE1 1EE0 +1EE2 1EE3 1EE2 +1EE3 1EE3 1EE2 +1EE4 1EE5 1EE4 +1EE5 1EE5 1EE4 +1EE6 1EE7 1EE6 +1EE7 1EE7 1EE6 +1EE8 1EE9 1EE8 +1EE9 1EE9 1EE8 +1EEA 1EEB 1EEA +1EEB 1EEB 1EEA +1EEC 1EED 1EEC +1EED 1EED 1EEC +1EEE 1EEF 1EEE +1EEF 1EEF 1EEE +1EF0 1EF1 1EF0 +1EF1 1EF1 1EF0 +1EF2 1EF3 1EF2 +1EF3 1EF3 1EF2 +1EF4 1EF5 1EF4 +1EF5 1EF5 1EF4 +1EF6 1EF7 1EF6 +1EF7 1EF7 1EF6 +1EF8 1EF9 1EF8 +1EF9 1EF9 1EF8 +1F00 1F00 1F08 +1F01 1F01 1F09 +1F02 1F02 1F0A +1F03 1F03 1F0B +1F04 1F04 1F0C +1F05 1F05 1F0D +1F06 1F06 1F0E +1F07 1F07 1F0F +1F08 1F00 1F08 +1F09 1F01 1F09 +1F0A 1F02 1F0A +1F0B 1F03 1F0B +1F0C 1F04 1F0C +1F0D 1F05 1F0D +1F0E 1F06 1F0E +1F0F 1F07 1F0F +1F10 1F10 1F18 +1F11 1F11 1F19 +1F12 1F12 1F1A +1F13 1F13 1F1B +1F14 1F14 1F1C +1F15 1F15 1F1D +1F18 1F10 1F18 +1F19 1F11 1F19 +1F1A 1F12 1F1A +1F1B 1F13 1F1B +1F1C 1F14 1F1C +1F1D 1F15 1F1D +1F20 1F20 1F28 +1F21 1F21 1F29 +1F22 1F22 1F2A +1F23 1F23 1F2B +1F24 1F24 1F2C +1F25 1F25 1F2D +1F26 1F26 1F2E +1F27 1F27 1F2F +1F28 1F20 1F28 +1F29 1F21 1F29 +1F2A 1F22 1F2A +1F2B 1F23 1F2B +1F2C 1F24 1F2C +1F2D 1F25 1F2D +1F2E 1F26 1F2E +1F2F 1F27 1F2F +1F30 1F30 1F38 +1F31 1F31 1F39 +1F32 1F32 1F3A +1F33 1F33 1F3B +1F34 1F34 1F3C +1F35 1F35 1F3D +1F36 1F36 1F3E +1F37 1F37 1F3F +1F38 1F30 1F38 +1F39 1F31 1F39 +1F3A 1F32 1F3A +1F3B 1F33 1F3B +1F3C 1F34 1F3C +1F3D 1F35 1F3D +1F3E 1F36 1F3E +1F3F 1F37 1F3F +1F40 1F40 1F48 +1F41 1F41 1F49 +1F42 1F42 1F4A +1F43 1F43 1F4B +1F44 1F44 1F4C +1F45 1F45 1F4D +1F48 1F40 1F48 +1F49 1F41 1F49 +1F4A 1F42 1F4A +1F4B 1F43 1F4B +1F4C 1F44 1F4C +1F4D 1F45 1F4D +1F51 1F51 1F59 +1F53 1F53 1F5B +1F55 1F55 1F5D +1F57 1F57 1F5F +1F59 1F51 1F59 +1F5B 1F53 1F5B +1F5D 1F55 1F5D +1F5F 1F57 1F5F +1F60 1F60 1F68 +1F61 1F61 1F69 +1F62 1F62 1F6A +1F63 1F63 1F6B +1F64 1F64 1F6C +1F65 1F65 1F6D +1F66 1F66 1F6E +1F67 1F67 1F6F +1F68 1F60 1F68 +1F69 1F61 1F69 +1F6A 1F62 1F6A +1F6B 1F63 1F6B +1F6C 1F64 1F6C +1F6D 1F65 1F6D +1F6E 1F66 1F6E +1F6F 1F67 1F6F +1F70 1F70 1FBA +1F71 1F71 1FBB +1F72 1F72 1FC8 +1F73 1F73 1FC9 +1F74 1F74 1FCA +1F75 1F75 1FCB +1F76 1F76 1FDA +1F77 1F77 1FDB +1F78 1F78 1FF8 +1F79 1F79 1FF9 +1F7A 1F7A 1FEA +1F7B 1F7B 1FEB +1F7C 1F7C 1FFA +1F7D 1F7D 1FFB +1F80 1F80 1F88 +1F81 1F81 1F89 +1F82 1F82 1F8A +1F83 1F83 1F8B +1F84 1F84 1F8C +1F85 1F85 1F8D +1F86 1F86 1F8E +1F87 1F87 1F8F +1F88 1F80 1F88 +1F89 1F81 1F89 +1F8A 1F82 1F8A +1F8B 1F83 1F8B +1F8C 1F84 1F8C +1F8D 1F85 1F8D +1F8E 1F86 1F8E +1F8F 1F87 1F8F +1F90 1F90 1F98 +1F91 1F91 1F99 +1F92 1F92 1F9A +1F93 1F93 1F9B +1F94 1F94 1F9C +1F95 1F95 1F9D +1F96 1F96 1F9E +1F97 1F97 1F9F +1F98 1F90 1F98 +1F99 1F91 1F99 +1F9A 1F92 1F9A +1F9B 1F93 1F9B +1F9C 1F94 1F9C +1F9D 1F95 1F9D +1F9E 1F96 1F9E +1F9F 1F97 1F9F +1FA0 1FA0 1FA8 +1FA1 1FA1 1FA9 +1FA2 1FA2 1FAA +1FA3 1FA3 1FAB +1FA4 1FA4 1FAC +1FA5 1FA5 1FAD +1FA6 1FA6 1FAE +1FA7 1FA7 1FAF +1FA8 1FA0 1FA8 +1FA9 1FA1 1FA9 +1FAA 1FA2 1FAA +1FAB 1FA3 1FAB +1FAC 1FA4 1FAC +1FAD 1FA5 1FAD +1FAE 1FA6 1FAE +1FAF 1FA7 1FAF +1FB0 1FB0 1FB8 +1FB1 1FB1 1FB9 +1FB3 1FB3 1FBC +1FB8 1FB0 1FB8 +1FB9 1FB1 1FB9 +1FBA 1F70 1FBA +1FBB 1F71 1FBB +1FBC 1FB3 1FBC +1FBE 1FBE 0399 +1FC3 1FC3 1FCC +1FC8 1F72 1FC8 +1FC9 1F73 1FC9 +1FCA 1F74 1FCA +1FCB 1F75 1FCB +1FCC 1FC3 1FCC +1FD0 1FD0 1FD8 +1FD1 1FD1 1FD9 +1FD8 1FD0 1FD8 +1FD9 1FD1 1FD9 +1FDA 1F76 1FDA +1FDB 1F77 1FDB +1FE0 1FE0 1FE8 +1FE1 1FE1 1FE9 +1FE5 1FE5 1FEC +1FE8 1FE0 1FE8 +1FE9 1FE1 1FE9 +1FEA 1F7A 1FEA +1FEB 1F7B 1FEB +1FEC 1FE5 1FEC +1FF3 1FF3 1FFC +1FF8 1F78 1FF8 +1FF9 1F79 1FF9 +1FFA 1F7C 1FFA +1FFB 1F7D 1FFB +1FFC 1FF3 1FFC +2126 03C9 2126 +212A 006B 212A +212B 00E5 212B +2160 2170 2160 +2161 2171 2161 +2162 2172 2162 +2163 2173 2163 +2164 2174 2164 +2165 2175 2165 +2166 2176 2166 +2167 2177 2167 +2168 2178 2168 +2169 2179 2169 +216A 217A 216A +216B 217B 216B +216C 217C 216C +216D 217D 216D +216E 217E 216E +216F 217F 216F +2170 2170 2160 +2171 2171 2161 +2172 2172 2162 +2173 2173 2163 +2174 2174 2164 +2175 2175 2165 +2176 2176 2166 +2177 2177 2167 +2178 2178 2168 +2179 2179 2169 +217A 217A 216A +217B 217B 216B +217C 217C 216C +217D 217D 216D +217E 217E 216E +217F 217F 216F +24B6 24D0 24B6 +24B7 24D1 24B7 +24B8 24D2 24B8 +24B9 24D3 24B9 +24BA 24D4 24BA +24BB 24D5 24BB +24BC 24D6 24BC +24BD 24D7 24BD +24BE 24D8 24BE +24BF 24D9 24BF +24C0 24DA 24C0 +24C1 24DB 24C1 +24C2 24DC 24C2 +24C3 24DD 24C3 +24C4 24DE 24C4 +24C5 24DF 24C5 +24C6 24E0 24C6 +24C7 24E1 24C7 +24C8 24E2 24C8 +24C9 24E3 24C9 +24CA 24E4 24CA +24CB 24E5 24CB +24CC 24E6 24CC +24CD 24E7 24CD +24CE 24E8 24CE +24CF 24E9 24CF +24D0 24D0 24B6 +24D1 24D1 24B7 +24D2 24D2 24B8 +24D3 24D3 24B9 +24D4 24D4 24BA +24D5 24D5 24BB +24D6 24D6 24BC +24D7 24D7 24BD +24D8 24D8 24BE +24D9 24D9 24BF +24DA 24DA 24C0 +24DB 24DB 24C1 +24DC 24DC 24C2 +24DD 24DD 24C3 +24DE 24DE 24C4 +24DF 24DF 24C5 +24E0 24E0 24C6 +24E1 24E1 24C7 +24E2 24E2 24C8 +24E3 24E3 24C9 +24E4 24E4 24CA +24E5 24E5 24CB +24E6 24E6 24CC +24E7 24E7 24CD +24E8 24E8 24CE +24E9 24E9 24CF +FF21 FF41 FF21 +FF22 FF42 FF22 +FF23 FF43 FF23 +FF24 FF44 FF24 +FF25 FF45 FF25 +FF26 FF46 FF26 +FF27 FF47 FF27 +FF28 FF48 FF28 +FF29 FF49 FF29 +FF2A FF4A FF2A +FF2B FF4B FF2B +FF2C FF4C FF2C +FF2D FF4D FF2D +FF2E FF4E FF2E +FF2F FF4F FF2F +FF30 FF50 FF30 +FF31 FF51 FF31 +FF32 FF52 FF32 +FF33 FF53 FF33 +FF34 FF54 FF34 +FF35 FF55 FF35 +FF36 FF56 FF36 +FF37 FF57 FF37 +FF38 FF58 FF38 +FF39 FF59 FF39 +FF3A FF5A FF3A +FF41 FF41 FF21 +FF42 FF42 FF22 +FF43 FF43 FF23 +FF44 FF44 FF24 +FF45 FF45 FF25 +FF46 FF46 FF26 +FF47 FF47 FF27 +FF48 FF48 FF28 +FF49 FF49 FF29 +FF4A FF4A FF2A +FF4B FF4B FF2B +FF4C FF4C FF2C +FF4D FF4D FF2D +FF4E FF4E FF2E +FF4F FF4F FF2F +FF50 FF50 FF30 +FF51 FF51 FF31 +FF52 FF52 FF32 +FF53 FF53 FF33 +FF54 FF54 FF34 +FF55 FF55 FF35 +FF56 FF56 FF36 +FF57 FF57 FF37 +FF58 FF58 FF38 +FF59 FF59 FF39 +FF5A FF5A FF3A +DROP VIEW v_bmp; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_supplementary AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),8,''0'') AS codepoint_hex8, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_65536_to_1114111', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_supplementary LIMIT 1; +COLLATION(c) +utf8mb4_turkish_ci +SELECT +codepoint_hex8, +HEX(CAST(LOWER(c) AS CHAR CHARACTER SET utf32)), +HEX(CAST(UPPER(c) AS CHAR CHARACTER SET utf32)) +FROM v_supplementary +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); +codepoint_hex8 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET utf32)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET utf32)) +DROP VIEW v_supplementary; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_utf8mb4_turkish_ci_casefold.test b/mysql-test/main/ctype_utf8mb4_turkish_ci_casefold.test new file mode 100644 index 0000000000000..daf534a88ea54 --- /dev/null +++ b/mysql-test/main/ctype_utf8mb4_turkish_ci_casefold.test @@ -0,0 +1,15 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET NAMES utf8mb4 COLLATE utf8mb4_turkish_ci; +--source include/ctype_unicode_casefold_bmp.inc +--source include/ctype_unicode_casefold_supplementary.inc + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/ctype_utf8mb4_uca.result b/mysql-test/main/ctype_utf8mb4_uca.result index 34cc443e6f6f7..65d8a07a3f3ef 100644 --- a/mysql-test/main/ctype_utf8mb4_uca.result +++ b/mysql-test/main/ctype_utf8mb4_uca.result @@ -2754,7 +2754,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `s1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_myanmar_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (s1) VALUES (_ucs2 0x108C), (_ucs2 0x1037), @@ -5339,7 +5339,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (SPACE(0)),(SPACE(1)),(SPACE(2)); SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(8))) FROM t1; HEX(a) HEX(WEIGHT_STRING(a AS CHAR(8))) @@ -5372,7 +5372,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (_ucs2 0x3400); INSERT INTO t1 VALUES (_ucs2 0xF001); SELECT HEX(CONVERT(a USING ucs2)) AS ucs2, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1; @@ -5385,7 +5385,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('A'),('À'),('Á'),('Â'),('Ã'),('Ä'),('Å'); SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a; a HEX(WEIGHT_STRING(a LEVEL 2)) @@ -5419,7 +5419,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a; a HEX(WEIGHT_STRING(a LEVEL 2)) A 0020 @@ -5444,7 +5444,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('cota'),('cote'),('cotz'); INSERT INTO t1 VALUES ('coté'),('côte'),('côté'),('cotë'),('côtë'); SELECT * FROM t1 ORDER BY a; @@ -5591,7 +5591,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `a_id` (`a`,`id`) -) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # # Ascending sort, using filesort # @@ -6033,7 +6033,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_unicode_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6171,7 +6171,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_unicode_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6310,7 +6310,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_unicode_520_nopad_c SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb4_unicode_520_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6448,7 +6448,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_unicode_520_nopad_c SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb4_unicode_520_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -6589,7 +6589,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci DEFAULT NULL, KEY `a` (`a`), KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('111', '111'); INSERT INTO t1 VALUES ('222', '222'); INSERT INTO t1 VALUES ('333', '333'); @@ -6605,3 +6605,177 @@ SET NAMES utf8mb4; # # End of 10.2 tests # +# +# Start of 10.3 tests +# +# +# MDEV-30556 UPPER() returns an empty string for U+0251 in Unicode-5.2.0+ collations for utf8 +# +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci /*Unicode-4.0 folding*/; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A C8BA C8BA Ⱥ +23E C8BE C8BE Ⱦ +23F C8BF C8BF ȿ +240 C980 C980 ɀ +250 C990 C990 ɐ +251 C991 C991 ɑ +252 C992 C992 ɒ +26B C9AB C9AB ɫ +271 C9B1 C9B1 ɱ +27D C9BD C9BD ɽ +DROP TABLE case_folding; +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_ci; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE ȿ +240 C980 E2B1BF ɀ +250 C990 E2B1AF ɐ +251 C991 E2B1AD ɑ +252 C992 E2B1B0 ɒ +26B C9AB E2B1A2 ɫ +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE ȿ +240 C980 E2B1BF ɀ +250 C990 E2B1AF ɐ +251 C991 E2B1AD ɑ +252 C992 E2B1B0 ɒ +26B C9AB E2B1A2 ɫ +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +SET NAMES utf8mb4 COLLATE utf8mb4_myanmar_ci; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_myanmar_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE ȿ +240 C980 E2B1BF ɀ +250 C990 E2B1AF ɐ +251 C991 E2B1AD ɑ +252 C992 E2B1B0 ɒ +26B C9AB E2B1A2 ɫ +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +SET NAMES utf8mb4 COLLATE utf8mb4_thai_520_w2; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE ȿ +240 C980 E2B1BF ɀ +250 C990 E2B1AF ɐ +251 C991 E2B1AD ɑ +252 C992 E2B1B0 ɒ +26B C9AB E2B1A2 ɫ +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/ctype_utf8mb4_uca.test b/mysql-test/main/ctype_utf8mb4_uca.test index 7a95da8468c1b..81f07d7e03f8b 100644 --- a/mysql-test/main/ctype_utf8mb4_uca.test +++ b/mysql-test/main/ctype_utf8mb4_uca.test @@ -108,3 +108,32 @@ SET NAMES utf8mb4; --echo # --echo # End of 10.2 tests --echo # + + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-30556 UPPER() returns an empty string for U+0251 in Unicode-5.2.0+ collations for utf8 +--echo # + +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci /*Unicode-4.0 folding*/; +--source include/ctype_casefolding.inc + +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_ci; +--source include/ctype_casefolding.inc + +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci; +--source include/ctype_casefolding.inc + +SET NAMES utf8mb4 COLLATE utf8mb4_myanmar_ci; +--source include/ctype_casefolding.inc + +SET NAMES utf8mb4 COLLATE utf8mb4_thai_520_w2; +--source include/ctype_casefolding.inc + + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/ctype_utf8mb4_uca_allkeys400.result b/mysql-test/main/ctype_utf8mb4_uca_allkeys400.result index 5515701cce48c..77a180602e790 100644 --- a/mysql-test/main/ctype_utf8mb4_uca_allkeys400.result +++ b/mysql-test/main/ctype_utf8mb4_uca_allkeys400.result @@ -8,7 +8,7 @@ Table Create Table allchars CREATE TABLE `allchars` ( `code` int(1) NOT NULL, `str` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t1tmp (a INT NOT NULL); FOR i IN 0..0xFFF DO diff --git a/mysql-test/main/ctype_utf8mb4_uca_allkeys520.result b/mysql-test/main/ctype_utf8mb4_uca_allkeys520.result index 82d1c86423f61..04d788a4055ff 100644 --- a/mysql-test/main/ctype_utf8mb4_uca_allkeys520.result +++ b/mysql-test/main/ctype_utf8mb4_uca_allkeys520.result @@ -8,7 +8,7 @@ Table Create Table allchars CREATE TABLE `allchars` ( `code` int(1) NOT NULL, `str` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t1tmp (a INT NOT NULL); FOR i IN 0..0xFFF DO diff --git a/mysql-test/main/ctype_utf8mb4_unicode_520_ci_casefold.result b/mysql-test/main/ctype_utf8mb4_unicode_520_ci_casefold.result new file mode 100644 index 0000000000000..5ba5251fa0c61 --- /dev/null +++ b/mysql-test/main/ctype_utf8mb4_unicode_520_ci_casefold.result @@ -0,0 +1,2110 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +utf8mb4_unicode_520_ci +SELECT +codepoint_hex4, +HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)), +HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +FROM v_bmp +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); +codepoint_hex4 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +0041 0061 0041 +0042 0062 0042 +0043 0063 0043 +0044 0064 0044 +0045 0065 0045 +0046 0066 0046 +0047 0067 0047 +0048 0068 0048 +0049 0069 0049 +004A 006A 004A +004B 006B 004B +004C 006C 004C +004D 006D 004D +004E 006E 004E +004F 006F 004F +0050 0070 0050 +0051 0071 0051 +0052 0072 0052 +0053 0073 0053 +0054 0074 0054 +0055 0075 0055 +0056 0076 0056 +0057 0077 0057 +0058 0078 0058 +0059 0079 0059 +005A 007A 005A +0061 0061 0041 +0062 0062 0042 +0063 0063 0043 +0064 0064 0044 +0065 0065 0045 +0066 0066 0046 +0067 0067 0047 +0068 0068 0048 +0069 0069 0049 +006A 006A 004A +006B 006B 004B +006C 006C 004C +006D 006D 004D +006E 006E 004E +006F 006F 004F +0070 0070 0050 +0071 0071 0051 +0072 0072 0052 +0073 0073 0053 +0074 0074 0054 +0075 0075 0055 +0076 0076 0056 +0077 0077 0057 +0078 0078 0058 +0079 0079 0059 +007A 007A 005A +00B5 00B5 039C +00C0 00E0 00C0 +00C1 00E1 00C1 +00C2 00E2 00C2 +00C3 00E3 00C3 +00C4 00E4 00C4 +00C5 00E5 00C5 +00C6 00E6 00C6 +00C7 00E7 00C7 +00C8 00E8 00C8 +00C9 00E9 00C9 +00CA 00EA 00CA +00CB 00EB 00CB +00CC 00EC 00CC +00CD 00ED 00CD +00CE 00EE 00CE +00CF 00EF 00CF +00D0 00F0 00D0 +00D1 00F1 00D1 +00D2 00F2 00D2 +00D3 00F3 00D3 +00D4 00F4 00D4 +00D5 00F5 00D5 +00D6 00F6 00D6 +00D8 00F8 00D8 +00D9 00F9 00D9 +00DA 00FA 00DA +00DB 00FB 00DB +00DC 00FC 00DC +00DD 00FD 00DD +00DE 00FE 00DE +00E0 00E0 00C0 +00E1 00E1 00C1 +00E2 00E2 00C2 +00E3 00E3 00C3 +00E4 00E4 00C4 +00E5 00E5 00C5 +00E6 00E6 00C6 +00E7 00E7 00C7 +00E8 00E8 00C8 +00E9 00E9 00C9 +00EA 00EA 00CA +00EB 00EB 00CB +00EC 00EC 00CC +00ED 00ED 00CD +00EE 00EE 00CE +00EF 00EF 00CF +00F0 00F0 00D0 +00F1 00F1 00D1 +00F2 00F2 00D2 +00F3 00F3 00D3 +00F4 00F4 00D4 +00F5 00F5 00D5 +00F6 00F6 00D6 +00F8 00F8 00D8 +00F9 00F9 00D9 +00FA 00FA 00DA +00FB 00FB 00DB +00FC 00FC 00DC +00FD 00FD 00DD +00FE 00FE 00DE +00FF 00FF 0178 +0100 0101 0100 +0101 0101 0100 +0102 0103 0102 +0103 0103 0102 +0104 0105 0104 +0105 0105 0104 +0106 0107 0106 +0107 0107 0106 +0108 0109 0108 +0109 0109 0108 +010A 010B 010A +010B 010B 010A +010C 010D 010C +010D 010D 010C +010E 010F 010E +010F 010F 010E +0110 0111 0110 +0111 0111 0110 +0112 0113 0112 +0113 0113 0112 +0114 0115 0114 +0115 0115 0114 +0116 0117 0116 +0117 0117 0116 +0118 0119 0118 +0119 0119 0118 +011A 011B 011A +011B 011B 011A +011C 011D 011C +011D 011D 011C +011E 011F 011E +011F 011F 011E +0120 0121 0120 +0121 0121 0120 +0122 0123 0122 +0123 0123 0122 +0124 0125 0124 +0125 0125 0124 +0126 0127 0126 +0127 0127 0126 +0128 0129 0128 +0129 0129 0128 +012A 012B 012A +012B 012B 012A +012C 012D 012C +012D 012D 012C +012E 012F 012E +012F 012F 012E +0130 0069 0130 +0131 0131 0049 +0132 0133 0132 +0133 0133 0132 +0134 0135 0134 +0135 0135 0134 +0136 0137 0136 +0137 0137 0136 +0139 013A 0139 +013A 013A 0139 +013B 013C 013B +013C 013C 013B +013D 013E 013D +013E 013E 013D +013F 0140 013F +0140 0140 013F +0141 0142 0141 +0142 0142 0141 +0143 0144 0143 +0144 0144 0143 +0145 0146 0145 +0146 0146 0145 +0147 0148 0147 +0148 0148 0147 +014A 014B 014A +014B 014B 014A +014C 014D 014C +014D 014D 014C +014E 014F 014E +014F 014F 014E +0150 0151 0150 +0151 0151 0150 +0152 0153 0152 +0153 0153 0152 +0154 0155 0154 +0155 0155 0154 +0156 0157 0156 +0157 0157 0156 +0158 0159 0158 +0159 0159 0158 +015A 015B 015A +015B 015B 015A +015C 015D 015C +015D 015D 015C +015E 015F 015E +015F 015F 015E +0160 0161 0160 +0161 0161 0160 +0162 0163 0162 +0163 0163 0162 +0164 0165 0164 +0165 0165 0164 +0166 0167 0166 +0167 0167 0166 +0168 0169 0168 +0169 0169 0168 +016A 016B 016A +016B 016B 016A +016C 016D 016C +016D 016D 016C +016E 016F 016E +016F 016F 016E +0170 0171 0170 +0171 0171 0170 +0172 0173 0172 +0173 0173 0172 +0174 0175 0174 +0175 0175 0174 +0176 0177 0176 +0177 0177 0176 +0178 00FF 0178 +0179 017A 0179 +017A 017A 0179 +017B 017C 017B +017C 017C 017B +017D 017E 017D +017E 017E 017D +017F 017F 0053 +0180 0180 0243 +0181 0253 0181 +0182 0183 0182 +0183 0183 0182 +0184 0185 0184 +0185 0185 0184 +0186 0254 0186 +0187 0188 0187 +0188 0188 0187 +0189 0256 0189 +018A 0257 018A +018B 018C 018B +018C 018C 018B +018E 01DD 018E +018F 0259 018F +0190 025B 0190 +0191 0192 0191 +0192 0192 0191 +0193 0260 0193 +0194 0263 0194 +0195 0195 01F6 +0196 0269 0196 +0197 0268 0197 +0198 0199 0198 +0199 0199 0198 +019A 019A 023D +019C 026F 019C +019D 0272 019D +019E 019E 0220 +019F 0275 019F +01A0 01A1 01A0 +01A1 01A1 01A0 +01A2 01A3 01A2 +01A3 01A3 01A2 +01A4 01A5 01A4 +01A5 01A5 01A4 +01A6 0280 01A6 +01A7 01A8 01A7 +01A8 01A8 01A7 +01A9 0283 01A9 +01AC 01AD 01AC +01AD 01AD 01AC +01AE 0288 01AE +01AF 01B0 01AF +01B0 01B0 01AF +01B1 028A 01B1 +01B2 028B 01B2 +01B3 01B4 01B3 +01B4 01B4 01B3 +01B5 01B6 01B5 +01B6 01B6 01B5 +01B7 0292 01B7 +01B8 01B9 01B8 +01B9 01B9 01B8 +01BC 01BD 01BC +01BD 01BD 01BC +01BF 01BF 01F7 +01C4 01C6 01C4 +01C5 01C6 01C4 +01C6 01C6 01C4 +01C7 01C9 01C7 +01C8 01C9 01C7 +01C9 01C9 01C7 +01CA 01CC 01CA +01CB 01CC 01CA +01CC 01CC 01CA +01CD 01CE 01CD +01CE 01CE 01CD +01CF 01D0 01CF +01D0 01D0 01CF +01D1 01D2 01D1 +01D2 01D2 01D1 +01D3 01D4 01D3 +01D4 01D4 01D3 +01D5 01D6 01D5 +01D6 01D6 01D5 +01D7 01D8 01D7 +01D8 01D8 01D7 +01D9 01DA 01D9 +01DA 01DA 01D9 +01DB 01DC 01DB +01DC 01DC 01DB +01DD 01DD 018E +01DE 01DF 01DE +01DF 01DF 01DE +01E0 01E1 01E0 +01E1 01E1 01E0 +01E2 01E3 01E2 +01E3 01E3 01E2 +01E4 01E5 01E4 +01E5 01E5 01E4 +01E6 01E7 01E6 +01E7 01E7 01E6 +01E8 01E9 01E8 +01E9 01E9 01E8 +01EA 01EB 01EA +01EB 01EB 01EA +01EC 01ED 01EC +01ED 01ED 01EC +01EE 01EF 01EE +01EF 01EF 01EE +01F1 01F3 01F1 +01F2 01F3 01F1 +01F3 01F3 01F1 +01F4 01F5 01F4 +01F5 01F5 01F4 +01F6 0195 01F6 +01F7 01BF 01F7 +01F8 01F9 01F8 +01F9 01F9 01F8 +01FA 01FB 01FA +01FB 01FB 01FA +01FC 01FD 01FC +01FD 01FD 01FC +01FE 01FF 01FE +01FF 01FF 01FE +0200 0201 0200 +0201 0201 0200 +0202 0203 0202 +0203 0203 0202 +0204 0205 0204 +0205 0205 0204 +0206 0207 0206 +0207 0207 0206 +0208 0209 0208 +0209 0209 0208 +020A 020B 020A +020B 020B 020A +020C 020D 020C +020D 020D 020C +020E 020F 020E +020F 020F 020E +0210 0211 0210 +0211 0211 0210 +0212 0213 0212 +0213 0213 0212 +0214 0215 0214 +0215 0215 0214 +0216 0217 0216 +0217 0217 0216 +0218 0219 0218 +0219 0219 0218 +021A 021B 021A +021B 021B 021A +021C 021D 021C +021D 021D 021C +021E 021F 021E +021F 021F 021E +0220 019E 0220 +0222 0223 0222 +0223 0223 0222 +0224 0225 0224 +0225 0225 0224 +0226 0227 0226 +0227 0227 0226 +0228 0229 0228 +0229 0229 0228 +022A 022B 022A +022B 022B 022A +022C 022D 022C +022D 022D 022C +022E 022F 022E +022F 022F 022E +0230 0231 0230 +0231 0231 0230 +0232 0233 0232 +0233 0233 0232 +023A 2C65 023A +023B 023C 023B +023C 023C 023B +023D 019A 023D +023E 2C66 023E +023F 023F 2C7E +0240 0240 2C7F +0241 0242 0241 +0242 0242 0241 +0243 0180 0243 +0244 0289 0244 +0245 028C 0245 +0246 0247 0246 +0247 0247 0246 +0248 0249 0248 +0249 0249 0248 +024A 024B 024A +024B 024B 024A +024C 024D 024C +024D 024D 024C +024E 024F 024E +024F 024F 024E +0250 0250 2C6F +0251 0251 2C6D +0252 0252 2C70 +0253 0253 0181 +0254 0254 0186 +0256 0256 0189 +0257 0257 018A +0259 0259 018F +025B 025B 0190 +0260 0260 0193 +0263 0263 0194 +0268 0268 0197 +0269 0269 0196 +026B 026B 2C62 +026F 026F 019C +0271 0271 2C6E +0272 0272 019D +0275 0275 019F +027D 027D 2C64 +0280 0280 01A6 +0283 0283 01A9 +0288 0288 01AE +0289 0289 0244 +028A 028A 01B1 +028B 028B 01B2 +028C 028C 0245 +0292 0292 01B7 +0345 0345 0399 +0370 0371 0370 +0371 0371 0370 +0372 0373 0372 +0373 0373 0372 +0376 0377 0376 +0377 0377 0376 +037B 037B 03FD +037C 037C 03FE +037D 037D 03FF +0386 03AC 0386 +0388 03AD 0388 +0389 03AE 0389 +038A 03AF 038A +038C 03CC 038C +038E 03CD 038E +038F 03CE 038F +0391 03B1 0391 +0392 03B2 0392 +0393 03B3 0393 +0394 03B4 0394 +0395 03B5 0395 +0396 03B6 0396 +0397 03B7 0397 +0398 03B8 0398 +0399 03B9 0399 +039A 03BA 039A +039B 03BB 039B +039C 03BC 039C +039D 03BD 039D +039E 03BE 039E +039F 03BF 039F +03A0 03C0 03A0 +03A1 03C1 03A1 +03A3 03C3 03A3 +03A4 03C4 03A4 +03A5 03C5 03A5 +03A6 03C6 03A6 +03A7 03C7 03A7 +03A8 03C8 03A8 +03A9 03C9 03A9 +03AA 03CA 03AA +03AB 03CB 03AB +03AC 03AC 0386 +03AD 03AD 0388 +03AE 03AE 0389 +03AF 03AF 038A +03B1 03B1 0391 +03B2 03B2 0392 +03B3 03B3 0393 +03B4 03B4 0394 +03B5 03B5 0395 +03B6 03B6 0396 +03B7 03B7 0397 +03B8 03B8 0398 +03B9 03B9 0399 +03BA 03BA 039A +03BB 03BB 039B +03BC 03BC 039C +03BD 03BD 039D +03BE 03BE 039E +03BF 03BF 039F +03C0 03C0 03A0 +03C1 03C1 03A1 +03C2 03C2 03A3 +03C3 03C3 03A3 +03C4 03C4 03A4 +03C5 03C5 03A5 +03C6 03C6 03A6 +03C7 03C7 03A7 +03C8 03C8 03A8 +03C9 03C9 03A9 +03CA 03CA 03AA +03CB 03CB 03AB +03CC 03CC 038C +03CD 03CD 038E +03CE 03CE 038F +03CF 03D7 03CF +03D0 03D0 0392 +03D1 03D1 0398 +03D5 03D5 03A6 +03D6 03D6 03A0 +03D7 03D7 03CF +03D8 03D9 03D8 +03D9 03D9 03D8 +03DA 03DB 03DA +03DB 03DB 03DA +03DC 03DD 03DC +03DD 03DD 03DC +03DE 03DF 03DE +03DF 03DF 03DE +03E0 03E1 03E0 +03E1 03E1 03E0 +03E2 03E3 03E2 +03E3 03E3 03E2 +03E4 03E5 03E4 +03E5 03E5 03E4 +03E6 03E7 03E6 +03E7 03E7 03E6 +03E8 03E9 03E8 +03E9 03E9 03E8 +03EA 03EB 03EA +03EB 03EB 03EA +03EC 03ED 03EC +03ED 03ED 03EC +03EE 03EF 03EE +03EF 03EF 03EE +03F0 03F0 039A +03F1 03F1 03A1 +03F2 03F2 03F9 +03F4 03B8 03F4 +03F5 03F5 0395 +03F7 03F8 03F7 +03F8 03F8 03F7 +03F9 03F2 03F9 +03FA 03FB 03FA +03FB 03FB 03FA +03FD 037B 03FD +03FE 037C 03FE +03FF 037D 03FF +0400 0450 0400 +0401 0451 0401 +0402 0452 0402 +0403 0453 0403 +0404 0454 0404 +0405 0455 0405 +0406 0456 0406 +0407 0457 0407 +0408 0458 0408 +0409 0459 0409 +040A 045A 040A +040B 045B 040B +040C 045C 040C +040D 045D 040D +040E 045E 040E +040F 045F 040F +0410 0430 0410 +0411 0431 0411 +0412 0432 0412 +0413 0433 0413 +0414 0434 0414 +0415 0435 0415 +0416 0436 0416 +0417 0437 0417 +0418 0438 0418 +0419 0439 0419 +041A 043A 041A +041B 043B 041B +041C 043C 041C +041D 043D 041D +041E 043E 041E +041F 043F 041F +0420 0440 0420 +0421 0441 0421 +0422 0442 0422 +0423 0443 0423 +0424 0444 0424 +0425 0445 0425 +0426 0446 0426 +0427 0447 0427 +0428 0448 0428 +0429 0449 0429 +042A 044A 042A +042B 044B 042B +042C 044C 042C +042D 044D 042D +042E 044E 042E +042F 044F 042F +0430 0430 0410 +0431 0431 0411 +0432 0432 0412 +0433 0433 0413 +0434 0434 0414 +0435 0435 0415 +0436 0436 0416 +0437 0437 0417 +0438 0438 0418 +0439 0439 0419 +043A 043A 041A +043B 043B 041B +043C 043C 041C +043D 043D 041D +043E 043E 041E +043F 043F 041F +0440 0440 0420 +0441 0441 0421 +0442 0442 0422 +0443 0443 0423 +0444 0444 0424 +0445 0445 0425 +0446 0446 0426 +0447 0447 0427 +0448 0448 0428 +0449 0449 0429 +044A 044A 042A +044B 044B 042B +044C 044C 042C +044D 044D 042D +044E 044E 042E +044F 044F 042F +0450 0450 0400 +0451 0451 0401 +0452 0452 0402 +0453 0453 0403 +0454 0454 0404 +0455 0455 0405 +0456 0456 0406 +0457 0457 0407 +0458 0458 0408 +0459 0459 0409 +045A 045A 040A +045B 045B 040B +045C 045C 040C +045D 045D 040D +045E 045E 040E +045F 045F 040F +0460 0461 0460 +0461 0461 0460 +0462 0463 0462 +0463 0463 0462 +0464 0465 0464 +0465 0465 0464 +0466 0467 0466 +0467 0467 0466 +0468 0469 0468 +0469 0469 0468 +046A 046B 046A +046B 046B 046A +046C 046D 046C +046D 046D 046C +046E 046F 046E +046F 046F 046E +0470 0471 0470 +0471 0471 0470 +0472 0473 0472 +0473 0473 0472 +0474 0475 0474 +0475 0475 0474 +0476 0477 0476 +0477 0477 0476 +0478 0479 0478 +0479 0479 0478 +047A 047B 047A +047B 047B 047A +047C 047D 047C +047D 047D 047C +047E 047F 047E +047F 047F 047E +0480 0481 0480 +0481 0481 0480 +048A 048B 048A +048B 048B 048A +048C 048D 048C +048D 048D 048C +048E 048F 048E +048F 048F 048E +0490 0491 0490 +0491 0491 0490 +0492 0493 0492 +0493 0493 0492 +0494 0495 0494 +0495 0495 0494 +0496 0497 0496 +0497 0497 0496 +0498 0499 0498 +0499 0499 0498 +049A 049B 049A +049B 049B 049A +049C 049D 049C +049D 049D 049C +049E 049F 049E +049F 049F 049E +04A0 04A1 04A0 +04A1 04A1 04A0 +04A2 04A3 04A2 +04A3 04A3 04A2 +04A4 04A5 04A4 +04A5 04A5 04A4 +04A6 04A7 04A6 +04A7 04A7 04A6 +04A8 04A9 04A8 +04A9 04A9 04A8 +04AA 04AB 04AA +04AB 04AB 04AA +04AC 04AD 04AC +04AD 04AD 04AC +04AE 04AF 04AE +04AF 04AF 04AE +04B0 04B1 04B0 +04B1 04B1 04B0 +04B2 04B3 04B2 +04B3 04B3 04B2 +04B4 04B5 04B4 +04B5 04B5 04B4 +04B6 04B7 04B6 +04B7 04B7 04B6 +04B8 04B9 04B8 +04B9 04B9 04B8 +04BA 04BB 04BA +04BB 04BB 04BA +04BC 04BD 04BC +04BD 04BD 04BC +04BE 04BF 04BE +04BF 04BF 04BE +04C0 04CF 04C0 +04C1 04C2 04C1 +04C2 04C2 04C1 +04C3 04C4 04C3 +04C4 04C4 04C3 +04C5 04C6 04C5 +04C6 04C6 04C5 +04C7 04C8 04C7 +04C8 04C8 04C7 +04C9 04CA 04C9 +04CA 04CA 04C9 +04CB 04CC 04CB +04CC 04CC 04CB +04CD 04CE 04CD +04CE 04CE 04CD +04CF 04CF 04C0 +04D0 04D1 04D0 +04D1 04D1 04D0 +04D2 04D3 04D2 +04D3 04D3 04D2 +04D4 04D5 04D4 +04D5 04D5 04D4 +04D6 04D7 04D6 +04D7 04D7 04D6 +04D8 04D9 04D8 +04D9 04D9 04D8 +04DA 04DB 04DA +04DB 04DB 04DA +04DC 04DD 04DC +04DD 04DD 04DC +04DE 04DF 04DE +04DF 04DF 04DE +04E0 04E1 04E0 +04E1 04E1 04E0 +04E2 04E3 04E2 +04E3 04E3 04E2 +04E4 04E5 04E4 +04E5 04E5 04E4 +04E6 04E7 04E6 +04E7 04E7 04E6 +04E8 04E9 04E8 +04E9 04E9 04E8 +04EA 04EB 04EA +04EB 04EB 04EA +04EC 04ED 04EC +04ED 04ED 04EC +04EE 04EF 04EE +04EF 04EF 04EE +04F0 04F1 04F0 +04F1 04F1 04F0 +04F2 04F3 04F2 +04F3 04F3 04F2 +04F4 04F5 04F4 +04F5 04F5 04F4 +04F6 04F7 04F6 +04F7 04F7 04F6 +04F8 04F9 04F8 +04F9 04F9 04F8 +04FA 04FB 04FA +04FB 04FB 04FA +04FC 04FD 04FC +04FD 04FD 04FC +04FE 04FF 04FE +04FF 04FF 04FE +0500 0501 0500 +0501 0501 0500 +0502 0503 0502 +0503 0503 0502 +0504 0505 0504 +0505 0505 0504 +0506 0507 0506 +0507 0507 0506 +0508 0509 0508 +0509 0509 0508 +050A 050B 050A +050B 050B 050A +050C 050D 050C +050D 050D 050C +050E 050F 050E +050F 050F 050E +0510 0511 0510 +0511 0511 0510 +0512 0513 0512 +0513 0513 0512 +0514 0515 0514 +0515 0515 0514 +0516 0517 0516 +0517 0517 0516 +0518 0519 0518 +0519 0519 0518 +051A 051B 051A +051B 051B 051A +051C 051D 051C +051D 051D 051C +051E 051F 051E +051F 051F 051E +0520 0521 0520 +0521 0521 0520 +0522 0523 0522 +0523 0523 0522 +0524 0525 0524 +0525 0525 0524 +0531 0561 0531 +0532 0562 0532 +0533 0563 0533 +0534 0564 0534 +0535 0565 0535 +0536 0566 0536 +0537 0567 0537 +0538 0568 0538 +0539 0569 0539 +053A 056A 053A +053B 056B 053B +053C 056C 053C +053D 056D 053D +053E 056E 053E +053F 056F 053F +0540 0570 0540 +0541 0571 0541 +0542 0572 0542 +0543 0573 0543 +0544 0574 0544 +0545 0575 0545 +0546 0576 0546 +0547 0577 0547 +0548 0578 0548 +0549 0579 0549 +054A 057A 054A +054B 057B 054B +054C 057C 054C +054D 057D 054D +054E 057E 054E +054F 057F 054F +0550 0580 0550 +0551 0581 0551 +0552 0582 0552 +0553 0583 0553 +0554 0584 0554 +0555 0585 0555 +0556 0586 0556 +0561 0561 0531 +0562 0562 0532 +0563 0563 0533 +0564 0564 0534 +0565 0565 0535 +0566 0566 0536 +0567 0567 0537 +0568 0568 0538 +0569 0569 0539 +056A 056A 053A +056B 056B 053B +056C 056C 053C +056D 056D 053D +056E 056E 053E +056F 056F 053F +0570 0570 0540 +0571 0571 0541 +0572 0572 0542 +0573 0573 0543 +0574 0574 0544 +0575 0575 0545 +0576 0576 0546 +0577 0577 0547 +0578 0578 0548 +0579 0579 0549 +057A 057A 054A +057B 057B 054B +057C 057C 054C +057D 057D 054D +057E 057E 054E +057F 057F 054F +0580 0580 0550 +0581 0581 0551 +0582 0582 0552 +0583 0583 0553 +0584 0584 0554 +0585 0585 0555 +0586 0586 0556 +10A0 2D00 10A0 +10A1 2D01 10A1 +10A2 2D02 10A2 +10A3 2D03 10A3 +10A4 2D04 10A4 +10A5 2D05 10A5 +10A6 2D06 10A6 +10A7 2D07 10A7 +10A8 2D08 10A8 +10A9 2D09 10A9 +10AA 2D0A 10AA +10AB 2D0B 10AB +10AC 2D0C 10AC +10AD 2D0D 10AD +10AE 2D0E 10AE +10AF 2D0F 10AF +10B0 2D10 10B0 +10B1 2D11 10B1 +10B2 2D12 10B2 +10B3 2D13 10B3 +10B4 2D14 10B4 +10B5 2D15 10B5 +10B6 2D16 10B6 +10B7 2D17 10B7 +10B8 2D18 10B8 +10B9 2D19 10B9 +10BA 2D1A 10BA +10BB 2D1B 10BB +10BC 2D1C 10BC +10BD 2D1D 10BD +10BE 2D1E 10BE +10BF 2D1F 10BF +10C0 2D20 10C0 +10C1 2D21 10C1 +10C2 2D22 10C2 +10C3 2D23 10C3 +10C4 2D24 10C4 +10C5 2D25 10C5 +1D79 1D79 A77D +1D7D 1D7D 2C63 +1E00 1E01 1E00 +1E01 1E01 1E00 +1E02 1E03 1E02 +1E03 1E03 1E02 +1E04 1E05 1E04 +1E05 1E05 1E04 +1E06 1E07 1E06 +1E07 1E07 1E06 +1E08 1E09 1E08 +1E09 1E09 1E08 +1E0A 1E0B 1E0A +1E0B 1E0B 1E0A +1E0C 1E0D 1E0C +1E0D 1E0D 1E0C +1E0E 1E0F 1E0E +1E0F 1E0F 1E0E +1E10 1E11 1E10 +1E11 1E11 1E10 +1E12 1E13 1E12 +1E13 1E13 1E12 +1E14 1E15 1E14 +1E15 1E15 1E14 +1E16 1E17 1E16 +1E17 1E17 1E16 +1E18 1E19 1E18 +1E19 1E19 1E18 +1E1A 1E1B 1E1A +1E1B 1E1B 1E1A +1E1C 1E1D 1E1C +1E1D 1E1D 1E1C +1E1E 1E1F 1E1E +1E1F 1E1F 1E1E +1E20 1E21 1E20 +1E21 1E21 1E20 +1E22 1E23 1E22 +1E23 1E23 1E22 +1E24 1E25 1E24 +1E25 1E25 1E24 +1E26 1E27 1E26 +1E27 1E27 1E26 +1E28 1E29 1E28 +1E29 1E29 1E28 +1E2A 1E2B 1E2A +1E2B 1E2B 1E2A +1E2C 1E2D 1E2C +1E2D 1E2D 1E2C +1E2E 1E2F 1E2E +1E2F 1E2F 1E2E +1E30 1E31 1E30 +1E31 1E31 1E30 +1E32 1E33 1E32 +1E33 1E33 1E32 +1E34 1E35 1E34 +1E35 1E35 1E34 +1E36 1E37 1E36 +1E37 1E37 1E36 +1E38 1E39 1E38 +1E39 1E39 1E38 +1E3A 1E3B 1E3A +1E3B 1E3B 1E3A +1E3C 1E3D 1E3C +1E3D 1E3D 1E3C +1E3E 1E3F 1E3E +1E3F 1E3F 1E3E +1E40 1E41 1E40 +1E41 1E41 1E40 +1E42 1E43 1E42 +1E43 1E43 1E42 +1E44 1E45 1E44 +1E45 1E45 1E44 +1E46 1E47 1E46 +1E47 1E47 1E46 +1E48 1E49 1E48 +1E49 1E49 1E48 +1E4A 1E4B 1E4A +1E4B 1E4B 1E4A +1E4C 1E4D 1E4C +1E4D 1E4D 1E4C +1E4E 1E4F 1E4E +1E4F 1E4F 1E4E +1E50 1E51 1E50 +1E51 1E51 1E50 +1E52 1E53 1E52 +1E53 1E53 1E52 +1E54 1E55 1E54 +1E55 1E55 1E54 +1E56 1E57 1E56 +1E57 1E57 1E56 +1E58 1E59 1E58 +1E59 1E59 1E58 +1E5A 1E5B 1E5A +1E5B 1E5B 1E5A +1E5C 1E5D 1E5C +1E5D 1E5D 1E5C +1E5E 1E5F 1E5E +1E5F 1E5F 1E5E +1E60 1E61 1E60 +1E61 1E61 1E60 +1E62 1E63 1E62 +1E63 1E63 1E62 +1E64 1E65 1E64 +1E65 1E65 1E64 +1E66 1E67 1E66 +1E67 1E67 1E66 +1E68 1E69 1E68 +1E69 1E69 1E68 +1E6A 1E6B 1E6A +1E6B 1E6B 1E6A +1E6C 1E6D 1E6C +1E6D 1E6D 1E6C +1E6E 1E6F 1E6E +1E6F 1E6F 1E6E +1E70 1E71 1E70 +1E71 1E71 1E70 +1E72 1E73 1E72 +1E73 1E73 1E72 +1E74 1E75 1E74 +1E75 1E75 1E74 +1E76 1E77 1E76 +1E77 1E77 1E76 +1E78 1E79 1E78 +1E79 1E79 1E78 +1E7A 1E7B 1E7A +1E7B 1E7B 1E7A +1E7C 1E7D 1E7C +1E7D 1E7D 1E7C +1E7E 1E7F 1E7E +1E7F 1E7F 1E7E +1E80 1E81 1E80 +1E81 1E81 1E80 +1E82 1E83 1E82 +1E83 1E83 1E82 +1E84 1E85 1E84 +1E85 1E85 1E84 +1E86 1E87 1E86 +1E87 1E87 1E86 +1E88 1E89 1E88 +1E89 1E89 1E88 +1E8A 1E8B 1E8A +1E8B 1E8B 1E8A +1E8C 1E8D 1E8C +1E8D 1E8D 1E8C +1E8E 1E8F 1E8E +1E8F 1E8F 1E8E +1E90 1E91 1E90 +1E91 1E91 1E90 +1E92 1E93 1E92 +1E93 1E93 1E92 +1E94 1E95 1E94 +1E95 1E95 1E94 +1E9B 1E9B 1E60 +1E9E 00DF 1E9E +1EA0 1EA1 1EA0 +1EA1 1EA1 1EA0 +1EA2 1EA3 1EA2 +1EA3 1EA3 1EA2 +1EA4 1EA5 1EA4 +1EA5 1EA5 1EA4 +1EA6 1EA7 1EA6 +1EA7 1EA7 1EA6 +1EA8 1EA9 1EA8 +1EA9 1EA9 1EA8 +1EAA 1EAB 1EAA +1EAB 1EAB 1EAA +1EAC 1EAD 1EAC +1EAD 1EAD 1EAC +1EAE 1EAF 1EAE +1EAF 1EAF 1EAE +1EB0 1EB1 1EB0 +1EB1 1EB1 1EB0 +1EB2 1EB3 1EB2 +1EB3 1EB3 1EB2 +1EB4 1EB5 1EB4 +1EB5 1EB5 1EB4 +1EB6 1EB7 1EB6 +1EB7 1EB7 1EB6 +1EB8 1EB9 1EB8 +1EB9 1EB9 1EB8 +1EBA 1EBB 1EBA +1EBB 1EBB 1EBA +1EBC 1EBD 1EBC +1EBD 1EBD 1EBC +1EBE 1EBF 1EBE +1EBF 1EBF 1EBE +1EC0 1EC1 1EC0 +1EC1 1EC1 1EC0 +1EC2 1EC3 1EC2 +1EC3 1EC3 1EC2 +1EC4 1EC5 1EC4 +1EC5 1EC5 1EC4 +1EC6 1EC7 1EC6 +1EC7 1EC7 1EC6 +1EC8 1EC9 1EC8 +1EC9 1EC9 1EC8 +1ECA 1ECB 1ECA +1ECB 1ECB 1ECA +1ECC 1ECD 1ECC +1ECD 1ECD 1ECC +1ECE 1ECF 1ECE +1ECF 1ECF 1ECE +1ED0 1ED1 1ED0 +1ED1 1ED1 1ED0 +1ED2 1ED3 1ED2 +1ED3 1ED3 1ED2 +1ED4 1ED5 1ED4 +1ED5 1ED5 1ED4 +1ED6 1ED7 1ED6 +1ED7 1ED7 1ED6 +1ED8 1ED9 1ED8 +1ED9 1ED9 1ED8 +1EDA 1EDB 1EDA +1EDB 1EDB 1EDA +1EDC 1EDD 1EDC +1EDD 1EDD 1EDC +1EDE 1EDF 1EDE +1EDF 1EDF 1EDE +1EE0 1EE1 1EE0 +1EE1 1EE1 1EE0 +1EE2 1EE3 1EE2 +1EE3 1EE3 1EE2 +1EE4 1EE5 1EE4 +1EE5 1EE5 1EE4 +1EE6 1EE7 1EE6 +1EE7 1EE7 1EE6 +1EE8 1EE9 1EE8 +1EE9 1EE9 1EE8 +1EEA 1EEB 1EEA +1EEB 1EEB 1EEA +1EEC 1EED 1EEC +1EED 1EED 1EEC +1EEE 1EEF 1EEE +1EEF 1EEF 1EEE +1EF0 1EF1 1EF0 +1EF1 1EF1 1EF0 +1EF2 1EF3 1EF2 +1EF3 1EF3 1EF2 +1EF4 1EF5 1EF4 +1EF5 1EF5 1EF4 +1EF6 1EF7 1EF6 +1EF7 1EF7 1EF6 +1EF8 1EF9 1EF8 +1EF9 1EF9 1EF8 +1EFA 1EFB 1EFA +1EFB 1EFB 1EFA +1EFC 1EFD 1EFC +1EFD 1EFD 1EFC +1EFE 1EFF 1EFE +1EFF 1EFF 1EFE +1F00 1F00 1F08 +1F01 1F01 1F09 +1F02 1F02 1F0A +1F03 1F03 1F0B +1F04 1F04 1F0C +1F05 1F05 1F0D +1F06 1F06 1F0E +1F07 1F07 1F0F +1F08 1F00 1F08 +1F09 1F01 1F09 +1F0A 1F02 1F0A +1F0B 1F03 1F0B +1F0C 1F04 1F0C +1F0D 1F05 1F0D +1F0E 1F06 1F0E +1F0F 1F07 1F0F +1F10 1F10 1F18 +1F11 1F11 1F19 +1F12 1F12 1F1A +1F13 1F13 1F1B +1F14 1F14 1F1C +1F15 1F15 1F1D +1F18 1F10 1F18 +1F19 1F11 1F19 +1F1A 1F12 1F1A +1F1B 1F13 1F1B +1F1C 1F14 1F1C +1F1D 1F15 1F1D +1F20 1F20 1F28 +1F21 1F21 1F29 +1F22 1F22 1F2A +1F23 1F23 1F2B +1F24 1F24 1F2C +1F25 1F25 1F2D +1F26 1F26 1F2E +1F27 1F27 1F2F +1F28 1F20 1F28 +1F29 1F21 1F29 +1F2A 1F22 1F2A +1F2B 1F23 1F2B +1F2C 1F24 1F2C +1F2D 1F25 1F2D +1F2E 1F26 1F2E +1F2F 1F27 1F2F +1F30 1F30 1F38 +1F31 1F31 1F39 +1F32 1F32 1F3A +1F33 1F33 1F3B +1F34 1F34 1F3C +1F35 1F35 1F3D +1F36 1F36 1F3E +1F37 1F37 1F3F +1F38 1F30 1F38 +1F39 1F31 1F39 +1F3A 1F32 1F3A +1F3B 1F33 1F3B +1F3C 1F34 1F3C +1F3D 1F35 1F3D +1F3E 1F36 1F3E +1F3F 1F37 1F3F +1F40 1F40 1F48 +1F41 1F41 1F49 +1F42 1F42 1F4A +1F43 1F43 1F4B +1F44 1F44 1F4C +1F45 1F45 1F4D +1F48 1F40 1F48 +1F49 1F41 1F49 +1F4A 1F42 1F4A +1F4B 1F43 1F4B +1F4C 1F44 1F4C +1F4D 1F45 1F4D +1F51 1F51 1F59 +1F53 1F53 1F5B +1F55 1F55 1F5D +1F57 1F57 1F5F +1F59 1F51 1F59 +1F5B 1F53 1F5B +1F5D 1F55 1F5D +1F5F 1F57 1F5F +1F60 1F60 1F68 +1F61 1F61 1F69 +1F62 1F62 1F6A +1F63 1F63 1F6B +1F64 1F64 1F6C +1F65 1F65 1F6D +1F66 1F66 1F6E +1F67 1F67 1F6F +1F68 1F60 1F68 +1F69 1F61 1F69 +1F6A 1F62 1F6A +1F6B 1F63 1F6B +1F6C 1F64 1F6C +1F6D 1F65 1F6D +1F6E 1F66 1F6E +1F6F 1F67 1F6F +1F70 1F70 1FBA +1F71 1F71 1FBB +1F72 1F72 1FC8 +1F73 1F73 1FC9 +1F74 1F74 1FCA +1F75 1F75 1FCB +1F76 1F76 1FDA +1F77 1F77 1FDB +1F78 1F78 1FF8 +1F79 1F79 1FF9 +1F7A 1F7A 1FEA +1F7B 1F7B 1FEB +1F7C 1F7C 1FFA +1F7D 1F7D 1FFB +1F80 1F80 1F88 +1F81 1F81 1F89 +1F82 1F82 1F8A +1F83 1F83 1F8B +1F84 1F84 1F8C +1F85 1F85 1F8D +1F86 1F86 1F8E +1F87 1F87 1F8F +1F88 1F80 1F88 +1F89 1F81 1F89 +1F8A 1F82 1F8A +1F8B 1F83 1F8B +1F8C 1F84 1F8C +1F8D 1F85 1F8D +1F8E 1F86 1F8E +1F8F 1F87 1F8F +1F90 1F90 1F98 +1F91 1F91 1F99 +1F92 1F92 1F9A +1F93 1F93 1F9B +1F94 1F94 1F9C +1F95 1F95 1F9D +1F96 1F96 1F9E +1F97 1F97 1F9F +1F98 1F90 1F98 +1F99 1F91 1F99 +1F9A 1F92 1F9A +1F9B 1F93 1F9B +1F9C 1F94 1F9C +1F9D 1F95 1F9D +1F9E 1F96 1F9E +1F9F 1F97 1F9F +1FA0 1FA0 1FA8 +1FA1 1FA1 1FA9 +1FA2 1FA2 1FAA +1FA3 1FA3 1FAB +1FA4 1FA4 1FAC +1FA5 1FA5 1FAD +1FA6 1FA6 1FAE +1FA7 1FA7 1FAF +1FA8 1FA0 1FA8 +1FA9 1FA1 1FA9 +1FAA 1FA2 1FAA +1FAB 1FA3 1FAB +1FAC 1FA4 1FAC +1FAD 1FA5 1FAD +1FAE 1FA6 1FAE +1FAF 1FA7 1FAF +1FB0 1FB0 1FB8 +1FB1 1FB1 1FB9 +1FB3 1FB3 1FBC +1FB8 1FB0 1FB8 +1FB9 1FB1 1FB9 +1FBA 1F70 1FBA +1FBB 1F71 1FBB +1FBC 1FB3 1FBC +1FBE 1FBE 0399 +1FC3 1FC3 1FCC +1FC8 1F72 1FC8 +1FC9 1F73 1FC9 +1FCA 1F74 1FCA +1FCB 1F75 1FCB +1FCC 1FC3 1FCC +1FD0 1FD0 1FD8 +1FD1 1FD1 1FD9 +1FD8 1FD0 1FD8 +1FD9 1FD1 1FD9 +1FDA 1F76 1FDA +1FDB 1F77 1FDB +1FE0 1FE0 1FE8 +1FE1 1FE1 1FE9 +1FE5 1FE5 1FEC +1FE8 1FE0 1FE8 +1FE9 1FE1 1FE9 +1FEA 1F7A 1FEA +1FEB 1F7B 1FEB +1FEC 1FE5 1FEC +1FF3 1FF3 1FFC +1FF8 1F78 1FF8 +1FF9 1F79 1FF9 +1FFA 1F7C 1FFA +1FFB 1F7D 1FFB +1FFC 1FF3 1FFC +2126 03C9 2126 +212A 006B 212A +212B 00E5 212B +2132 214E 2132 +214E 214E 2132 +2160 2170 2160 +2161 2171 2161 +2162 2172 2162 +2163 2173 2163 +2164 2174 2164 +2165 2175 2165 +2166 2176 2166 +2167 2177 2167 +2168 2178 2168 +2169 2179 2169 +216A 217A 216A +216B 217B 216B +216C 217C 216C +216D 217D 216D +216E 217E 216E +216F 217F 216F +2170 2170 2160 +2171 2171 2161 +2172 2172 2162 +2173 2173 2163 +2174 2174 2164 +2175 2175 2165 +2176 2176 2166 +2177 2177 2167 +2178 2178 2168 +2179 2179 2169 +217A 217A 216A +217B 217B 216B +217C 217C 216C +217D 217D 216D +217E 217E 216E +217F 217F 216F +2183 2184 2183 +2184 2184 2183 +24B6 24D0 24B6 +24B7 24D1 24B7 +24B8 24D2 24B8 +24B9 24D3 24B9 +24BA 24D4 24BA +24BB 24D5 24BB +24BC 24D6 24BC +24BD 24D7 24BD +24BE 24D8 24BE +24BF 24D9 24BF +24C0 24DA 24C0 +24C1 24DB 24C1 +24C2 24DC 24C2 +24C3 24DD 24C3 +24C4 24DE 24C4 +24C5 24DF 24C5 +24C6 24E0 24C6 +24C7 24E1 24C7 +24C8 24E2 24C8 +24C9 24E3 24C9 +24CA 24E4 24CA +24CB 24E5 24CB +24CC 24E6 24CC +24CD 24E7 24CD +24CE 24E8 24CE +24CF 24E9 24CF +24D0 24D0 24B6 +24D1 24D1 24B7 +24D2 24D2 24B8 +24D3 24D3 24B9 +24D4 24D4 24BA +24D5 24D5 24BB +24D6 24D6 24BC +24D7 24D7 24BD +24D8 24D8 24BE +24D9 24D9 24BF +24DA 24DA 24C0 +24DB 24DB 24C1 +24DC 24DC 24C2 +24DD 24DD 24C3 +24DE 24DE 24C4 +24DF 24DF 24C5 +24E0 24E0 24C6 +24E1 24E1 24C7 +24E2 24E2 24C8 +24E3 24E3 24C9 +24E4 24E4 24CA +24E5 24E5 24CB +24E6 24E6 24CC +24E7 24E7 24CD +24E8 24E8 24CE +24E9 24E9 24CF +2C00 2C30 2C00 +2C01 2C31 2C01 +2C02 2C32 2C02 +2C03 2C33 2C03 +2C04 2C34 2C04 +2C05 2C35 2C05 +2C06 2C36 2C06 +2C07 2C37 2C07 +2C08 2C38 2C08 +2C09 2C39 2C09 +2C0A 2C3A 2C0A +2C0B 2C3B 2C0B +2C0C 2C3C 2C0C +2C0D 2C3D 2C0D +2C0E 2C3E 2C0E +2C0F 2C3F 2C0F +2C10 2C40 2C10 +2C11 2C41 2C11 +2C12 2C42 2C12 +2C13 2C43 2C13 +2C14 2C44 2C14 +2C15 2C45 2C15 +2C16 2C46 2C16 +2C17 2C47 2C17 +2C18 2C48 2C18 +2C19 2C49 2C19 +2C1A 2C4A 2C1A +2C1B 2C4B 2C1B +2C1C 2C4C 2C1C +2C1D 2C4D 2C1D +2C1E 2C4E 2C1E +2C1F 2C4F 2C1F +2C20 2C50 2C20 +2C21 2C51 2C21 +2C22 2C52 2C22 +2C23 2C53 2C23 +2C24 2C54 2C24 +2C25 2C55 2C25 +2C26 2C56 2C26 +2C27 2C57 2C27 +2C28 2C58 2C28 +2C29 2C59 2C29 +2C2A 2C5A 2C2A +2C2B 2C5B 2C2B +2C2C 2C5C 2C2C +2C2D 2C5D 2C2D +2C2E 2C5E 2C2E +2C30 2C30 2C00 +2C31 2C31 2C01 +2C32 2C32 2C02 +2C33 2C33 2C03 +2C34 2C34 2C04 +2C35 2C35 2C05 +2C36 2C36 2C06 +2C37 2C37 2C07 +2C38 2C38 2C08 +2C39 2C39 2C09 +2C3A 2C3A 2C0A +2C3B 2C3B 2C0B +2C3C 2C3C 2C0C +2C3D 2C3D 2C0D +2C3E 2C3E 2C0E +2C3F 2C3F 2C0F +2C40 2C40 2C10 +2C41 2C41 2C11 +2C42 2C42 2C12 +2C43 2C43 2C13 +2C44 2C44 2C14 +2C45 2C45 2C15 +2C46 2C46 2C16 +2C47 2C47 2C17 +2C48 2C48 2C18 +2C49 2C49 2C19 +2C4A 2C4A 2C1A +2C4B 2C4B 2C1B +2C4C 2C4C 2C1C +2C4D 2C4D 2C1D +2C4E 2C4E 2C1E +2C4F 2C4F 2C1F +2C50 2C50 2C20 +2C51 2C51 2C21 +2C52 2C52 2C22 +2C53 2C53 2C23 +2C54 2C54 2C24 +2C55 2C55 2C25 +2C56 2C56 2C26 +2C57 2C57 2C27 +2C58 2C58 2C28 +2C59 2C59 2C29 +2C5A 2C5A 2C2A +2C5B 2C5B 2C2B +2C5C 2C5C 2C2C +2C5D 2C5D 2C2D +2C5E 2C5E 2C2E +2C60 2C61 2C60 +2C61 2C61 2C60 +2C62 026B 2C62 +2C63 1D7D 2C63 +2C64 027D 2C64 +2C65 2C65 023A +2C66 2C66 023E +2C67 2C68 2C67 +2C68 2C68 2C67 +2C69 2C6A 2C69 +2C6A 2C6A 2C69 +2C6B 2C6C 2C6B +2C6C 2C6C 2C6B +2C6D 0251 2C6D +2C6E 0271 2C6E +2C6F 0250 2C6F +2C70 0252 2C70 +2C72 2C73 2C72 +2C73 2C73 2C72 +2C75 2C76 2C75 +2C76 2C76 2C75 +2C7E 023F 2C7E +2C7F 0240 2C7F +2C80 2C81 2C80 +2C81 2C81 2C80 +2C82 2C83 2C82 +2C83 2C83 2C82 +2C84 2C85 2C84 +2C85 2C85 2C84 +2C86 2C87 2C86 +2C87 2C87 2C86 +2C88 2C89 2C88 +2C89 2C89 2C88 +2C8A 2C8B 2C8A +2C8B 2C8B 2C8A +2C8C 2C8D 2C8C +2C8D 2C8D 2C8C +2C8E 2C8F 2C8E +2C8F 2C8F 2C8E +2C90 2C91 2C90 +2C91 2C91 2C90 +2C92 2C93 2C92 +2C93 2C93 2C92 +2C94 2C95 2C94 +2C95 2C95 2C94 +2C96 2C97 2C96 +2C97 2C97 2C96 +2C98 2C99 2C98 +2C99 2C99 2C98 +2C9A 2C9B 2C9A +2C9B 2C9B 2C9A +2C9C 2C9D 2C9C +2C9D 2C9D 2C9C +2C9E 2C9F 2C9E +2C9F 2C9F 2C9E +2CA0 2CA1 2CA0 +2CA1 2CA1 2CA0 +2CA2 2CA3 2CA2 +2CA3 2CA3 2CA2 +2CA4 2CA5 2CA4 +2CA5 2CA5 2CA4 +2CA6 2CA7 2CA6 +2CA7 2CA7 2CA6 +2CA8 2CA9 2CA8 +2CA9 2CA9 2CA8 +2CAA 2CAB 2CAA +2CAB 2CAB 2CAA +2CAC 2CAD 2CAC +2CAD 2CAD 2CAC +2CAE 2CAF 2CAE +2CAF 2CAF 2CAE +2CB0 2CB1 2CB0 +2CB1 2CB1 2CB0 +2CB2 2CB3 2CB2 +2CB3 2CB3 2CB2 +2CB4 2CB5 2CB4 +2CB5 2CB5 2CB4 +2CB6 2CB7 2CB6 +2CB7 2CB7 2CB6 +2CB8 2CB9 2CB8 +2CB9 2CB9 2CB8 +2CBA 2CBB 2CBA +2CBB 2CBB 2CBA +2CBC 2CBD 2CBC +2CBD 2CBD 2CBC +2CBE 2CBF 2CBE +2CBF 2CBF 2CBE +2CC0 2CC1 2CC0 +2CC1 2CC1 2CC0 +2CC2 2CC3 2CC2 +2CC3 2CC3 2CC2 +2CC4 2CC5 2CC4 +2CC5 2CC5 2CC4 +2CC6 2CC7 2CC6 +2CC7 2CC7 2CC6 +2CC8 2CC9 2CC8 +2CC9 2CC9 2CC8 +2CCA 2CCB 2CCA +2CCB 2CCB 2CCA +2CCC 2CCD 2CCC +2CCD 2CCD 2CCC +2CCE 2CCF 2CCE +2CCF 2CCF 2CCE +2CD0 2CD1 2CD0 +2CD1 2CD1 2CD0 +2CD2 2CD3 2CD2 +2CD3 2CD3 2CD2 +2CD4 2CD5 2CD4 +2CD5 2CD5 2CD4 +2CD6 2CD7 2CD6 +2CD7 2CD7 2CD6 +2CD8 2CD9 2CD8 +2CD9 2CD9 2CD8 +2CDA 2CDB 2CDA +2CDB 2CDB 2CDA +2CDC 2CDD 2CDC +2CDD 2CDD 2CDC +2CDE 2CDF 2CDE +2CDF 2CDF 2CDE +2CE0 2CE1 2CE0 +2CE1 2CE1 2CE0 +2CE2 2CE3 2CE2 +2CE3 2CE3 2CE2 +2CEB 2CEC 2CEB +2CEC 2CEC 2CEB +2CED 2CEE 2CED +2CEE 2CEE 2CED +2D00 2D00 10A0 +2D01 2D01 10A1 +2D02 2D02 10A2 +2D03 2D03 10A3 +2D04 2D04 10A4 +2D05 2D05 10A5 +2D06 2D06 10A6 +2D07 2D07 10A7 +2D08 2D08 10A8 +2D09 2D09 10A9 +2D0A 2D0A 10AA +2D0B 2D0B 10AB +2D0C 2D0C 10AC +2D0D 2D0D 10AD +2D0E 2D0E 10AE +2D0F 2D0F 10AF +2D10 2D10 10B0 +2D11 2D11 10B1 +2D12 2D12 10B2 +2D13 2D13 10B3 +2D14 2D14 10B4 +2D15 2D15 10B5 +2D16 2D16 10B6 +2D17 2D17 10B7 +2D18 2D18 10B8 +2D19 2D19 10B9 +2D1A 2D1A 10BA +2D1B 2D1B 10BB +2D1C 2D1C 10BC +2D1D 2D1D 10BD +2D1E 2D1E 10BE +2D1F 2D1F 10BF +2D20 2D20 10C0 +2D21 2D21 10C1 +2D22 2D22 10C2 +2D23 2D23 10C3 +2D24 2D24 10C4 +2D25 2D25 10C5 +A640 A641 A640 +A641 A641 A640 +A642 A643 A642 +A643 A643 A642 +A644 A645 A644 +A645 A645 A644 +A646 A647 A646 +A647 A647 A646 +A648 A649 A648 +A649 A649 A648 +A64A A64B A64A +A64B A64B A64A +A64C A64D A64C +A64D A64D A64C +A64E A64F A64E +A64F A64F A64E +A650 A651 A650 +A651 A651 A650 +A652 A653 A652 +A653 A653 A652 +A654 A655 A654 +A655 A655 A654 +A656 A657 A656 +A657 A657 A656 +A658 A659 A658 +A659 A659 A658 +A65A A65B A65A +A65B A65B A65A +A65C A65D A65C +A65D A65D A65C +A65E A65F A65E +A65F A65F A65E +A662 A663 A662 +A663 A663 A662 +A664 A665 A664 +A665 A665 A664 +A666 A667 A666 +A667 A667 A666 +A668 A669 A668 +A669 A669 A668 +A66A A66B A66A +A66B A66B A66A +A66C A66D A66C +A66D A66D A66C +A680 A681 A680 +A681 A681 A680 +A682 A683 A682 +A683 A683 A682 +A684 A685 A684 +A685 A685 A684 +A686 A687 A686 +A687 A687 A686 +A688 A689 A688 +A689 A689 A688 +A68A A68B A68A +A68B A68B A68A +A68C A68D A68C +A68D A68D A68C +A68E A68F A68E +A68F A68F A68E +A690 A691 A690 +A691 A691 A690 +A692 A693 A692 +A693 A693 A692 +A694 A695 A694 +A695 A695 A694 +A696 A697 A696 +A697 A697 A696 +A722 A723 A722 +A723 A723 A722 +A724 A725 A724 +A725 A725 A724 +A726 A727 A726 +A727 A727 A726 +A728 A729 A728 +A729 A729 A728 +A72A A72B A72A +A72B A72B A72A +A72C A72D A72C +A72D A72D A72C +A72E A72F A72E +A72F A72F A72E +A732 A733 A732 +A733 A733 A732 +A734 A735 A734 +A735 A735 A734 +A736 A737 A736 +A737 A737 A736 +A738 A739 A738 +A739 A739 A738 +A73A A73B A73A +A73B A73B A73A +A73C A73D A73C +A73D A73D A73C +A73E A73F A73E +A73F A73F A73E +A740 A741 A740 +A741 A741 A740 +A742 A743 A742 +A743 A743 A742 +A744 A745 A744 +A745 A745 A744 +A746 A747 A746 +A747 A747 A746 +A748 A749 A748 +A749 A749 A748 +A74A A74B A74A +A74B A74B A74A +A74C A74D A74C +A74D A74D A74C +A74E A74F A74E +A74F A74F A74E +A750 A751 A750 +A751 A751 A750 +A752 A753 A752 +A753 A753 A752 +A754 A755 A754 +A755 A755 A754 +A756 A757 A756 +A757 A757 A756 +A758 A759 A758 +A759 A759 A758 +A75A A75B A75A +A75B A75B A75A +A75C A75D A75C +A75D A75D A75C +A75E A75F A75E +A75F A75F A75E +A760 A761 A760 +A761 A761 A760 +A762 A763 A762 +A763 A763 A762 +A764 A765 A764 +A765 A765 A764 +A766 A767 A766 +A767 A767 A766 +A768 A769 A768 +A769 A769 A768 +A76A A76B A76A +A76B A76B A76A +A76C A76D A76C +A76D A76D A76C +A76E A76F A76E +A76F A76F A76E +A779 A77A A779 +A77A A77A A779 +A77B A77C A77B +A77C A77C A77B +A77D 1D79 A77D +A77E A77F A77E +A77F A77F A77E +A780 A781 A780 +A781 A781 A780 +A782 A783 A782 +A783 A783 A782 +A784 A785 A784 +A785 A785 A784 +A786 A787 A786 +A787 A787 A786 +A78B A78C A78B +A78C A78C A78B +FF21 FF41 FF21 +FF22 FF42 FF22 +FF23 FF43 FF23 +FF24 FF44 FF24 +FF25 FF45 FF25 +FF26 FF46 FF26 +FF27 FF47 FF27 +FF28 FF48 FF28 +FF29 FF49 FF29 +FF2A FF4A FF2A +FF2B FF4B FF2B +FF2C FF4C FF2C +FF2D FF4D FF2D +FF2E FF4E FF2E +FF2F FF4F FF2F +FF30 FF50 FF30 +FF31 FF51 FF31 +FF32 FF52 FF32 +FF33 FF53 FF33 +FF34 FF54 FF34 +FF35 FF55 FF35 +FF36 FF56 FF36 +FF37 FF57 FF37 +FF38 FF58 FF38 +FF39 FF59 FF39 +FF3A FF5A FF3A +FF41 FF41 FF21 +FF42 FF42 FF22 +FF43 FF43 FF23 +FF44 FF44 FF24 +FF45 FF45 FF25 +FF46 FF46 FF26 +FF47 FF47 FF27 +FF48 FF48 FF28 +FF49 FF49 FF29 +FF4A FF4A FF2A +FF4B FF4B FF2B +FF4C FF4C FF2C +FF4D FF4D FF2D +FF4E FF4E FF2E +FF4F FF4F FF2F +FF50 FF50 FF30 +FF51 FF51 FF31 +FF52 FF52 FF32 +FF53 FF53 FF33 +FF54 FF54 FF34 +FF55 FF55 FF35 +FF56 FF56 FF36 +FF57 FF57 FF37 +FF58 FF58 FF38 +FF59 FF59 FF39 +FF5A FF5A FF3A +DROP VIEW v_bmp; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_supplementary AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),8,''0'') AS codepoint_hex8, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_65536_to_1114111', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_supplementary LIMIT 1; +COLLATION(c) +utf8mb4_unicode_520_ci +SELECT +codepoint_hex8, +HEX(CAST(LOWER(c) AS CHAR CHARACTER SET utf32)), +HEX(CAST(UPPER(c) AS CHAR CHARACTER SET utf32)) +FROM v_supplementary +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); +codepoint_hex8 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET utf32)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET utf32)) +00010400 00010428 00010400 +00010401 00010429 00010401 +00010402 0001042A 00010402 +00010403 0001042B 00010403 +00010404 0001042C 00010404 +00010405 0001042D 00010405 +00010406 0001042E 00010406 +00010407 0001042F 00010407 +00010408 00010430 00010408 +00010409 00010431 00010409 +0001040A 00010432 0001040A +0001040B 00010433 0001040B +0001040C 00010434 0001040C +0001040D 00010435 0001040D +0001040E 00010436 0001040E +0001040F 00010437 0001040F +00010410 00010438 00010410 +00010411 00010439 00010411 +00010412 0001043A 00010412 +00010413 0001043B 00010413 +00010414 0001043C 00010414 +00010415 0001043D 00010415 +00010416 0001043E 00010416 +00010417 0001043F 00010417 +00010418 00010440 00010418 +00010419 00010441 00010419 +0001041A 00010442 0001041A +0001041B 00010443 0001041B +0001041C 00010444 0001041C +0001041D 00010445 0001041D +0001041E 00010446 0001041E +0001041F 00010447 0001041F +00010420 00010448 00010420 +00010421 00010449 00010421 +00010422 0001044A 00010422 +00010423 0001044B 00010423 +00010424 0001044C 00010424 +00010425 0001044D 00010425 +00010426 0001044E 00010426 +00010427 0001044F 00010427 +00010428 00010428 00010400 +00010429 00010429 00010401 +0001042A 0001042A 00010402 +0001042B 0001042B 00010403 +0001042C 0001042C 00010404 +0001042D 0001042D 00010405 +0001042E 0001042E 00010406 +0001042F 0001042F 00010407 +00010430 00010430 00010408 +00010431 00010431 00010409 +00010432 00010432 0001040A +00010433 00010433 0001040B +00010434 00010434 0001040C +00010435 00010435 0001040D +00010436 00010436 0001040E +00010437 00010437 0001040F +00010438 00010438 00010410 +00010439 00010439 00010411 +0001043A 0001043A 00010412 +0001043B 0001043B 00010413 +0001043C 0001043C 00010414 +0001043D 0001043D 00010415 +0001043E 0001043E 00010416 +0001043F 0001043F 00010417 +00010440 00010440 00010418 +00010441 00010441 00010419 +00010442 00010442 0001041A +00010443 00010443 0001041B +00010444 00010444 0001041C +00010445 00010445 0001041D +00010446 00010446 0001041E +00010447 00010447 0001041F +00010448 00010448 00010420 +00010449 00010449 00010421 +0001044A 0001044A 00010422 +0001044B 0001044B 00010423 +0001044C 0001044C 00010424 +0001044D 0001044D 00010425 +0001044E 0001044E 00010426 +0001044F 0001044F 00010427 +DROP VIEW v_supplementary; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_utf8mb4_unicode_520_ci_casefold.test b/mysql-test/main/ctype_utf8mb4_unicode_520_ci_casefold.test new file mode 100644 index 0000000000000..750e52843651d --- /dev/null +++ b/mysql-test/main/ctype_utf8mb4_unicode_520_ci_casefold.test @@ -0,0 +1,15 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_ci; +--source include/ctype_unicode_casefold_bmp.inc +--source include/ctype_unicode_casefold_supplementary.inc + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/ctype_utf8mb4_unicode_ci_casefold.result b/mysql-test/main/ctype_utf8mb4_unicode_ci_casefold.result new file mode 100644 index 0000000000000..155a8f3f44cf0 --- /dev/null +++ b/mysql-test/main/ctype_utf8mb4_unicode_ci_casefold.result @@ -0,0 +1,1446 @@ +# +# Start of 10.7 tests +# +# +# MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +# +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_bmp AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),4,''0'') AS codepoint_hex4, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_0_to_65535', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_bmp LIMIT 1; +COLLATION(c) +utf8mb4_unicode_ci +SELECT +codepoint_hex4, +HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)), +HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +FROM v_bmp +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); +codepoint_hex4 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2)) +0041 0061 0041 +0042 0062 0042 +0043 0063 0043 +0044 0064 0044 +0045 0065 0045 +0046 0066 0046 +0047 0067 0047 +0048 0068 0048 +0049 0069 0049 +004A 006A 004A +004B 006B 004B +004C 006C 004C +004D 006D 004D +004E 006E 004E +004F 006F 004F +0050 0070 0050 +0051 0071 0051 +0052 0072 0052 +0053 0073 0053 +0054 0074 0054 +0055 0075 0055 +0056 0076 0056 +0057 0077 0057 +0058 0078 0058 +0059 0079 0059 +005A 007A 005A +0061 0061 0041 +0062 0062 0042 +0063 0063 0043 +0064 0064 0044 +0065 0065 0045 +0066 0066 0046 +0067 0067 0047 +0068 0068 0048 +0069 0069 0049 +006A 006A 004A +006B 006B 004B +006C 006C 004C +006D 006D 004D +006E 006E 004E +006F 006F 004F +0070 0070 0050 +0071 0071 0051 +0072 0072 0052 +0073 0073 0053 +0074 0074 0054 +0075 0075 0055 +0076 0076 0056 +0077 0077 0057 +0078 0078 0058 +0079 0079 0059 +007A 007A 005A +00B5 00B5 039C +00C0 00E0 00C0 +00C1 00E1 00C1 +00C2 00E2 00C2 +00C3 00E3 00C3 +00C4 00E4 00C4 +00C5 00E5 00C5 +00C6 00E6 00C6 +00C7 00E7 00C7 +00C8 00E8 00C8 +00C9 00E9 00C9 +00CA 00EA 00CA +00CB 00EB 00CB +00CC 00EC 00CC +00CD 00ED 00CD +00CE 00EE 00CE +00CF 00EF 00CF +00D0 00F0 00D0 +00D1 00F1 00D1 +00D2 00F2 00D2 +00D3 00F3 00D3 +00D4 00F4 00D4 +00D5 00F5 00D5 +00D6 00F6 00D6 +00D8 00F8 00D8 +00D9 00F9 00D9 +00DA 00FA 00DA +00DB 00FB 00DB +00DC 00FC 00DC +00DD 00FD 00DD +00DE 00FE 00DE +00E0 00E0 00C0 +00E1 00E1 00C1 +00E2 00E2 00C2 +00E3 00E3 00C3 +00E4 00E4 00C4 +00E5 00E5 00C5 +00E6 00E6 00C6 +00E7 00E7 00C7 +00E8 00E8 00C8 +00E9 00E9 00C9 +00EA 00EA 00CA +00EB 00EB 00CB +00EC 00EC 00CC +00ED 00ED 00CD +00EE 00EE 00CE +00EF 00EF 00CF +00F0 00F0 00D0 +00F1 00F1 00D1 +00F2 00F2 00D2 +00F3 00F3 00D3 +00F4 00F4 00D4 +00F5 00F5 00D5 +00F6 00F6 00D6 +00F8 00F8 00D8 +00F9 00F9 00D9 +00FA 00FA 00DA +00FB 00FB 00DB +00FC 00FC 00DC +00FD 00FD 00DD +00FE 00FE 00DE +00FF 00FF 0178 +0100 0101 0100 +0101 0101 0100 +0102 0103 0102 +0103 0103 0102 +0104 0105 0104 +0105 0105 0104 +0106 0107 0106 +0107 0107 0106 +0108 0109 0108 +0109 0109 0108 +010A 010B 010A +010B 010B 010A +010C 010D 010C +010D 010D 010C +010E 010F 010E +010F 010F 010E +0110 0111 0110 +0111 0111 0110 +0112 0113 0112 +0113 0113 0112 +0114 0115 0114 +0115 0115 0114 +0116 0117 0116 +0117 0117 0116 +0118 0119 0118 +0119 0119 0118 +011A 011B 011A +011B 011B 011A +011C 011D 011C +011D 011D 011C +011E 011F 011E +011F 011F 011E +0120 0121 0120 +0121 0121 0120 +0122 0123 0122 +0123 0123 0122 +0124 0125 0124 +0125 0125 0124 +0126 0127 0126 +0127 0127 0126 +0128 0129 0128 +0129 0129 0128 +012A 012B 012A +012B 012B 012A +012C 012D 012C +012D 012D 012C +012E 012F 012E +012F 012F 012E +0130 0069 0130 +0131 0131 0049 +0132 0133 0132 +0133 0133 0132 +0134 0135 0134 +0135 0135 0134 +0136 0137 0136 +0137 0137 0136 +0139 013A 0139 +013A 013A 0139 +013B 013C 013B +013C 013C 013B +013D 013E 013D +013E 013E 013D +013F 0140 013F +0140 0140 013F +0141 0142 0141 +0142 0142 0141 +0143 0144 0143 +0144 0144 0143 +0145 0146 0145 +0146 0146 0145 +0147 0148 0147 +0148 0148 0147 +014A 014B 014A +014B 014B 014A +014C 014D 014C +014D 014D 014C +014E 014F 014E +014F 014F 014E +0150 0151 0150 +0151 0151 0150 +0152 0153 0152 +0153 0153 0152 +0154 0155 0154 +0155 0155 0154 +0156 0157 0156 +0157 0157 0156 +0158 0159 0158 +0159 0159 0158 +015A 015B 015A +015B 015B 015A +015C 015D 015C +015D 015D 015C +015E 015F 015E +015F 015F 015E +0160 0161 0160 +0161 0161 0160 +0162 0163 0162 +0163 0163 0162 +0164 0165 0164 +0165 0165 0164 +0166 0167 0166 +0167 0167 0166 +0168 0169 0168 +0169 0169 0168 +016A 016B 016A +016B 016B 016A +016C 016D 016C +016D 016D 016C +016E 016F 016E +016F 016F 016E +0170 0171 0170 +0171 0171 0170 +0172 0173 0172 +0173 0173 0172 +0174 0175 0174 +0175 0175 0174 +0176 0177 0176 +0177 0177 0176 +0178 00FF 0178 +0179 017A 0179 +017A 017A 0179 +017B 017C 017B +017C 017C 017B +017D 017E 017D +017E 017E 017D +017F 017F 0053 +0181 0253 0181 +0182 0183 0182 +0183 0183 0182 +0184 0185 0184 +0185 0185 0184 +0186 0254 0186 +0187 0188 0187 +0188 0188 0187 +0189 0256 0189 +018A 0257 018A +018B 018C 018B +018C 018C 018B +018E 01DD 018E +018F 0259 018F +0190 025B 0190 +0191 0192 0191 +0192 0192 0191 +0193 0260 0193 +0194 0263 0194 +0195 0195 01F6 +0196 0269 0196 +0197 0268 0197 +0198 0199 0198 +0199 0199 0198 +019C 026F 019C +019D 0272 019D +019F 0275 019F +01A0 01A1 01A0 +01A1 01A1 01A0 +01A2 01A3 01A2 +01A3 01A3 01A2 +01A4 01A5 01A4 +01A5 01A5 01A4 +01A6 0280 01A6 +01A7 01A8 01A7 +01A8 01A8 01A7 +01A9 0283 01A9 +01AC 01AD 01AC +01AD 01AD 01AC +01AE 0288 01AE +01AF 01B0 01AF +01B0 01B0 01AF +01B1 028A 01B1 +01B2 028B 01B2 +01B3 01B4 01B3 +01B4 01B4 01B3 +01B5 01B6 01B5 +01B6 01B6 01B5 +01B7 0292 01B7 +01B8 01B9 01B8 +01B9 01B9 01B8 +01BC 01BD 01BC +01BD 01BD 01BC +01BF 01BF 01F7 +01C4 01C6 01C4 +01C5 01C6 01C4 +01C6 01C6 01C4 +01C7 01C9 01C7 +01C8 01C9 01C7 +01C9 01C9 01C7 +01CA 01CC 01CA +01CB 01CC 01CA +01CC 01CC 01CA +01CD 01CE 01CD +01CE 01CE 01CD +01CF 01D0 01CF +01D0 01D0 01CF +01D1 01D2 01D1 +01D2 01D2 01D1 +01D3 01D4 01D3 +01D4 01D4 01D3 +01D5 01D6 01D5 +01D6 01D6 01D5 +01D7 01D8 01D7 +01D8 01D8 01D7 +01D9 01DA 01D9 +01DA 01DA 01D9 +01DB 01DC 01DB +01DC 01DC 01DB +01DD 01DD 018E +01DE 01DF 01DE +01DF 01DF 01DE +01E0 01E1 01E0 +01E1 01E1 01E0 +01E2 01E3 01E2 +01E3 01E3 01E2 +01E4 01E5 01E4 +01E5 01E5 01E4 +01E6 01E7 01E6 +01E7 01E7 01E6 +01E8 01E9 01E8 +01E9 01E9 01E8 +01EA 01EB 01EA +01EB 01EB 01EA +01EC 01ED 01EC +01ED 01ED 01EC +01EE 01EF 01EE +01EF 01EF 01EE +01F1 01F3 01F1 +01F2 01F3 01F1 +01F3 01F3 01F1 +01F4 01F5 01F4 +01F5 01F5 01F4 +01F6 0195 01F6 +01F7 01BF 01F7 +01F8 01F9 01F8 +01F9 01F9 01F8 +01FA 01FB 01FA +01FB 01FB 01FA +01FC 01FD 01FC +01FD 01FD 01FC +01FE 01FF 01FE +01FF 01FF 01FE +0200 0201 0200 +0201 0201 0200 +0202 0203 0202 +0203 0203 0202 +0204 0205 0204 +0205 0205 0204 +0206 0207 0206 +0207 0207 0206 +0208 0209 0208 +0209 0209 0208 +020A 020B 020A +020B 020B 020A +020C 020D 020C +020D 020D 020C +020E 020F 020E +020F 020F 020E +0210 0211 0210 +0211 0211 0210 +0212 0213 0212 +0213 0213 0212 +0214 0215 0214 +0215 0215 0214 +0216 0217 0216 +0217 0217 0216 +0218 0219 0218 +0219 0219 0218 +021A 021B 021A +021B 021B 021A +021C 021D 021C +021D 021D 021C +021E 021F 021E +021F 021F 021E +0222 0223 0222 +0223 0223 0222 +0224 0225 0224 +0225 0225 0224 +0226 0227 0226 +0227 0227 0226 +0228 0229 0228 +0229 0229 0228 +022A 022B 022A +022B 022B 022A +022C 022D 022C +022D 022D 022C +022E 022F 022E +022F 022F 022E +0230 0231 0230 +0231 0231 0230 +0232 0233 0232 +0233 0233 0232 +0253 0253 0181 +0254 0254 0186 +0256 0256 0189 +0257 0257 018A +0259 0259 018F +025B 025B 0190 +0260 0260 0193 +0263 0263 0194 +0268 0268 0197 +0269 0269 0196 +026F 026F 019C +0272 0272 019D +0275 0275 019F +0280 0280 01A6 +0283 0283 01A9 +0288 0288 01AE +028A 028A 01B1 +028B 028B 01B2 +0292 0292 01B7 +0345 0345 0399 +0386 03AC 0386 +0388 03AD 0388 +0389 03AE 0389 +038A 03AF 038A +038C 03CC 038C +038E 03CD 038E +038F 03CE 038F +0391 03B1 0391 +0392 03B2 0392 +0393 03B3 0393 +0394 03B4 0394 +0395 03B5 0395 +0396 03B6 0396 +0397 03B7 0397 +0398 03B8 0398 +0399 03B9 0399 +039A 03BA 039A +039B 03BB 039B +039C 03BC 039C +039D 03BD 039D +039E 03BE 039E +039F 03BF 039F +03A0 03C0 03A0 +03A1 03C1 03A1 +03A3 03C3 03A3 +03A4 03C4 03A4 +03A5 03C5 03A5 +03A6 03C6 03A6 +03A7 03C7 03A7 +03A8 03C8 03A8 +03A9 03C9 03A9 +03AA 03CA 03AA +03AB 03CB 03AB +03AC 03AC 0386 +03AD 03AD 0388 +03AE 03AE 0389 +03AF 03AF 038A +03B1 03B1 0391 +03B2 03B2 0392 +03B3 03B3 0393 +03B4 03B4 0394 +03B5 03B5 0395 +03B6 03B6 0396 +03B7 03B7 0397 +03B8 03B8 0398 +03B9 03B9 0399 +03BA 03BA 039A +03BB 03BB 039B +03BC 03BC 039C +03BD 03BD 039D +03BE 03BE 039E +03BF 03BF 039F +03C0 03C0 03A0 +03C1 03C1 03A1 +03C2 03C2 03A3 +03C3 03C3 03A3 +03C4 03C4 03A4 +03C5 03C5 03A5 +03C6 03C6 03A6 +03C7 03C7 03A7 +03C8 03C8 03A8 +03C9 03C9 03A9 +03CA 03CA 03AA +03CB 03CB 03AB +03CC 03CC 038C +03CD 03CD 038E +03CE 03CE 038F +03D0 03D0 0392 +03D1 03D1 0398 +03D5 03D5 03A6 +03D6 03D6 03A0 +03DA 03DB 03DA +03DB 03DB 03DA +03DC 03DD 03DC +03DD 03DD 03DC +03DE 03DF 03DE +03DF 03DF 03DE +03E0 03E1 03E0 +03E1 03E1 03E0 +03E2 03E3 03E2 +03E3 03E3 03E2 +03E4 03E5 03E4 +03E5 03E5 03E4 +03E6 03E7 03E6 +03E7 03E7 03E6 +03E8 03E9 03E8 +03E9 03E9 03E8 +03EA 03EB 03EA +03EB 03EB 03EA +03EC 03ED 03EC +03ED 03ED 03EC +03EE 03EF 03EE +03EF 03EF 03EE +03F0 03F0 039A +03F1 03F1 03A1 +03F2 03F2 03A3 +0400 0450 0400 +0401 0451 0401 +0402 0452 0402 +0403 0453 0403 +0404 0454 0404 +0405 0455 0405 +0406 0456 0406 +0407 0457 0407 +0408 0458 0408 +0409 0459 0409 +040A 045A 040A +040B 045B 040B +040C 045C 040C +040D 045D 040D +040E 045E 040E +040F 045F 040F +0410 0430 0410 +0411 0431 0411 +0412 0432 0412 +0413 0433 0413 +0414 0434 0414 +0415 0435 0415 +0416 0436 0416 +0417 0437 0417 +0418 0438 0418 +0419 0439 0419 +041A 043A 041A +041B 043B 041B +041C 043C 041C +041D 043D 041D +041E 043E 041E +041F 043F 041F +0420 0440 0420 +0421 0441 0421 +0422 0442 0422 +0423 0443 0423 +0424 0444 0424 +0425 0445 0425 +0426 0446 0426 +0427 0447 0427 +0428 0448 0428 +0429 0449 0429 +042A 044A 042A +042B 044B 042B +042C 044C 042C +042D 044D 042D +042E 044E 042E +042F 044F 042F +0430 0430 0410 +0431 0431 0411 +0432 0432 0412 +0433 0433 0413 +0434 0434 0414 +0435 0435 0415 +0436 0436 0416 +0437 0437 0417 +0438 0438 0418 +0439 0439 0419 +043A 043A 041A +043B 043B 041B +043C 043C 041C +043D 043D 041D +043E 043E 041E +043F 043F 041F +0440 0440 0420 +0441 0441 0421 +0442 0442 0422 +0443 0443 0423 +0444 0444 0424 +0445 0445 0425 +0446 0446 0426 +0447 0447 0427 +0448 0448 0428 +0449 0449 0429 +044A 044A 042A +044B 044B 042B +044C 044C 042C +044D 044D 042D +044E 044E 042E +044F 044F 042F +0450 0450 0400 +0451 0451 0401 +0452 0452 0402 +0453 0453 0403 +0454 0454 0404 +0455 0455 0405 +0456 0456 0406 +0457 0457 0407 +0458 0458 0408 +0459 0459 0409 +045A 045A 040A +045B 045B 040B +045C 045C 040C +045D 045D 040D +045E 045E 040E +045F 045F 040F +0460 0461 0460 +0461 0461 0460 +0462 0463 0462 +0463 0463 0462 +0464 0465 0464 +0465 0465 0464 +0466 0467 0466 +0467 0467 0466 +0468 0469 0468 +0469 0469 0468 +046A 046B 046A +046B 046B 046A +046C 046D 046C +046D 046D 046C +046E 046F 046E +046F 046F 046E +0470 0471 0470 +0471 0471 0470 +0472 0473 0472 +0473 0473 0472 +0474 0475 0474 +0475 0475 0474 +0476 0477 0476 +0477 0477 0476 +0478 0479 0478 +0479 0479 0478 +047A 047B 047A +047B 047B 047A +047C 047D 047C +047D 047D 047C +047E 047F 047E +047F 047F 047E +0480 0481 0480 +0481 0481 0480 +048C 048D 048C +048D 048D 048C +048E 048F 048E +048F 048F 048E +0490 0491 0490 +0491 0491 0490 +0492 0493 0492 +0493 0493 0492 +0494 0495 0494 +0495 0495 0494 +0496 0497 0496 +0497 0497 0496 +0498 0499 0498 +0499 0499 0498 +049A 049B 049A +049B 049B 049A +049C 049D 049C +049D 049D 049C +049E 049F 049E +049F 049F 049E +04A0 04A1 04A0 +04A1 04A1 04A0 +04A2 04A3 04A2 +04A3 04A3 04A2 +04A4 04A5 04A4 +04A5 04A5 04A4 +04A6 04A7 04A6 +04A7 04A7 04A6 +04A8 04A9 04A8 +04A9 04A9 04A8 +04AA 04AB 04AA +04AB 04AB 04AA +04AC 04AD 04AC +04AD 04AD 04AC +04AE 04AF 04AE +04AF 04AF 04AE +04B0 04B1 04B0 +04B1 04B1 04B0 +04B2 04B3 04B2 +04B3 04B3 04B2 +04B4 04B5 04B4 +04B5 04B5 04B4 +04B6 04B7 04B6 +04B7 04B7 04B6 +04B8 04B9 04B8 +04B9 04B9 04B8 +04BA 04BB 04BA +04BB 04BB 04BA +04BC 04BD 04BC +04BD 04BD 04BC +04BE 04BF 04BE +04BF 04BF 04BE +04C1 04C2 04C1 +04C2 04C2 04C1 +04C3 04C4 04C3 +04C4 04C4 04C3 +04C7 04C8 04C7 +04C8 04C8 04C7 +04CB 04CC 04CB +04CC 04CC 04CB +04D0 04D1 04D0 +04D1 04D1 04D0 +04D2 04D3 04D2 +04D3 04D3 04D2 +04D4 04D5 04D4 +04D5 04D5 04D4 +04D6 04D7 04D6 +04D7 04D7 04D6 +04D8 04D9 04D8 +04D9 04D9 04D8 +04DA 04DB 04DA +04DB 04DB 04DA +04DC 04DD 04DC +04DD 04DD 04DC +04DE 04DF 04DE +04DF 04DF 04DE +04E0 04E1 04E0 +04E1 04E1 04E0 +04E2 04E3 04E2 +04E3 04E3 04E2 +04E4 04E5 04E4 +04E5 04E5 04E4 +04E6 04E7 04E6 +04E7 04E7 04E6 +04E8 04E9 04E8 +04E9 04E9 04E8 +04EA 04EB 04EA +04EB 04EB 04EA +04EC 04ED 04EC +04ED 04ED 04EC +04EE 04EF 04EE +04EF 04EF 04EE +04F0 04F1 04F0 +04F1 04F1 04F0 +04F2 04F3 04F2 +04F3 04F3 04F2 +04F4 04F5 04F4 +04F5 04F5 04F4 +04F8 04F9 04F8 +04F9 04F9 04F8 +0531 0561 0531 +0532 0562 0532 +0533 0563 0533 +0534 0564 0534 +0535 0565 0535 +0536 0566 0536 +0537 0567 0537 +0538 0568 0538 +0539 0569 0539 +053A 056A 053A +053B 056B 053B +053C 056C 053C +053D 056D 053D +053E 056E 053E +053F 056F 053F +0540 0570 0540 +0541 0571 0541 +0542 0572 0542 +0543 0573 0543 +0544 0574 0544 +0545 0575 0545 +0546 0576 0546 +0547 0577 0547 +0548 0578 0548 +0549 0579 0549 +054A 057A 054A +054B 057B 054B +054C 057C 054C +054D 057D 054D +054E 057E 054E +054F 057F 054F +0550 0580 0550 +0551 0581 0551 +0552 0582 0552 +0553 0583 0553 +0554 0584 0554 +0555 0585 0555 +0556 0586 0556 +0561 0561 0531 +0562 0562 0532 +0563 0563 0533 +0564 0564 0534 +0565 0565 0535 +0566 0566 0536 +0567 0567 0537 +0568 0568 0538 +0569 0569 0539 +056A 056A 053A +056B 056B 053B +056C 056C 053C +056D 056D 053D +056E 056E 053E +056F 056F 053F +0570 0570 0540 +0571 0571 0541 +0572 0572 0542 +0573 0573 0543 +0574 0574 0544 +0575 0575 0545 +0576 0576 0546 +0577 0577 0547 +0578 0578 0548 +0579 0579 0549 +057A 057A 054A +057B 057B 054B +057C 057C 054C +057D 057D 054D +057E 057E 054E +057F 057F 054F +0580 0580 0550 +0581 0581 0551 +0582 0582 0552 +0583 0583 0553 +0584 0584 0554 +0585 0585 0555 +0586 0586 0556 +1E00 1E01 1E00 +1E01 1E01 1E00 +1E02 1E03 1E02 +1E03 1E03 1E02 +1E04 1E05 1E04 +1E05 1E05 1E04 +1E06 1E07 1E06 +1E07 1E07 1E06 +1E08 1E09 1E08 +1E09 1E09 1E08 +1E0A 1E0B 1E0A +1E0B 1E0B 1E0A +1E0C 1E0D 1E0C +1E0D 1E0D 1E0C +1E0E 1E0F 1E0E +1E0F 1E0F 1E0E +1E10 1E11 1E10 +1E11 1E11 1E10 +1E12 1E13 1E12 +1E13 1E13 1E12 +1E14 1E15 1E14 +1E15 1E15 1E14 +1E16 1E17 1E16 +1E17 1E17 1E16 +1E18 1E19 1E18 +1E19 1E19 1E18 +1E1A 1E1B 1E1A +1E1B 1E1B 1E1A +1E1C 1E1D 1E1C +1E1D 1E1D 1E1C +1E1E 1E1F 1E1E +1E1F 1E1F 1E1E +1E20 1E21 1E20 +1E21 1E21 1E20 +1E22 1E23 1E22 +1E23 1E23 1E22 +1E24 1E25 1E24 +1E25 1E25 1E24 +1E26 1E27 1E26 +1E27 1E27 1E26 +1E28 1E29 1E28 +1E29 1E29 1E28 +1E2A 1E2B 1E2A +1E2B 1E2B 1E2A +1E2C 1E2D 1E2C +1E2D 1E2D 1E2C +1E2E 1E2F 1E2E +1E2F 1E2F 1E2E +1E30 1E31 1E30 +1E31 1E31 1E30 +1E32 1E33 1E32 +1E33 1E33 1E32 +1E34 1E35 1E34 +1E35 1E35 1E34 +1E36 1E37 1E36 +1E37 1E37 1E36 +1E38 1E39 1E38 +1E39 1E39 1E38 +1E3A 1E3B 1E3A +1E3B 1E3B 1E3A +1E3C 1E3D 1E3C +1E3D 1E3D 1E3C +1E3E 1E3F 1E3E +1E3F 1E3F 1E3E +1E40 1E41 1E40 +1E41 1E41 1E40 +1E42 1E43 1E42 +1E43 1E43 1E42 +1E44 1E45 1E44 +1E45 1E45 1E44 +1E46 1E47 1E46 +1E47 1E47 1E46 +1E48 1E49 1E48 +1E49 1E49 1E48 +1E4A 1E4B 1E4A +1E4B 1E4B 1E4A +1E4C 1E4D 1E4C +1E4D 1E4D 1E4C +1E4E 1E4F 1E4E +1E4F 1E4F 1E4E +1E50 1E51 1E50 +1E51 1E51 1E50 +1E52 1E53 1E52 +1E53 1E53 1E52 +1E54 1E55 1E54 +1E55 1E55 1E54 +1E56 1E57 1E56 +1E57 1E57 1E56 +1E58 1E59 1E58 +1E59 1E59 1E58 +1E5A 1E5B 1E5A +1E5B 1E5B 1E5A +1E5C 1E5D 1E5C +1E5D 1E5D 1E5C +1E5E 1E5F 1E5E +1E5F 1E5F 1E5E +1E60 1E61 1E60 +1E61 1E61 1E60 +1E62 1E63 1E62 +1E63 1E63 1E62 +1E64 1E65 1E64 +1E65 1E65 1E64 +1E66 1E67 1E66 +1E67 1E67 1E66 +1E68 1E69 1E68 +1E69 1E69 1E68 +1E6A 1E6B 1E6A +1E6B 1E6B 1E6A +1E6C 1E6D 1E6C +1E6D 1E6D 1E6C +1E6E 1E6F 1E6E +1E6F 1E6F 1E6E +1E70 1E71 1E70 +1E71 1E71 1E70 +1E72 1E73 1E72 +1E73 1E73 1E72 +1E74 1E75 1E74 +1E75 1E75 1E74 +1E76 1E77 1E76 +1E77 1E77 1E76 +1E78 1E79 1E78 +1E79 1E79 1E78 +1E7A 1E7B 1E7A +1E7B 1E7B 1E7A +1E7C 1E7D 1E7C +1E7D 1E7D 1E7C +1E7E 1E7F 1E7E +1E7F 1E7F 1E7E +1E80 1E81 1E80 +1E81 1E81 1E80 +1E82 1E83 1E82 +1E83 1E83 1E82 +1E84 1E85 1E84 +1E85 1E85 1E84 +1E86 1E87 1E86 +1E87 1E87 1E86 +1E88 1E89 1E88 +1E89 1E89 1E88 +1E8A 1E8B 1E8A +1E8B 1E8B 1E8A +1E8C 1E8D 1E8C +1E8D 1E8D 1E8C +1E8E 1E8F 1E8E +1E8F 1E8F 1E8E +1E90 1E91 1E90 +1E91 1E91 1E90 +1E92 1E93 1E92 +1E93 1E93 1E92 +1E94 1E95 1E94 +1E95 1E95 1E94 +1E9B 1E9B 1E60 +1EA0 1EA1 1EA0 +1EA1 1EA1 1EA0 +1EA2 1EA3 1EA2 +1EA3 1EA3 1EA2 +1EA4 1EA5 1EA4 +1EA5 1EA5 1EA4 +1EA6 1EA7 1EA6 +1EA7 1EA7 1EA6 +1EA8 1EA9 1EA8 +1EA9 1EA9 1EA8 +1EAA 1EAB 1EAA +1EAB 1EAB 1EAA +1EAC 1EAD 1EAC +1EAD 1EAD 1EAC +1EAE 1EAF 1EAE +1EAF 1EAF 1EAE +1EB0 1EB1 1EB0 +1EB1 1EB1 1EB0 +1EB2 1EB3 1EB2 +1EB3 1EB3 1EB2 +1EB4 1EB5 1EB4 +1EB5 1EB5 1EB4 +1EB6 1EB7 1EB6 +1EB7 1EB7 1EB6 +1EB8 1EB9 1EB8 +1EB9 1EB9 1EB8 +1EBA 1EBB 1EBA +1EBB 1EBB 1EBA +1EBC 1EBD 1EBC +1EBD 1EBD 1EBC +1EBE 1EBF 1EBE +1EBF 1EBF 1EBE +1EC0 1EC1 1EC0 +1EC1 1EC1 1EC0 +1EC2 1EC3 1EC2 +1EC3 1EC3 1EC2 +1EC4 1EC5 1EC4 +1EC5 1EC5 1EC4 +1EC6 1EC7 1EC6 +1EC7 1EC7 1EC6 +1EC8 1EC9 1EC8 +1EC9 1EC9 1EC8 +1ECA 1ECB 1ECA +1ECB 1ECB 1ECA +1ECC 1ECD 1ECC +1ECD 1ECD 1ECC +1ECE 1ECF 1ECE +1ECF 1ECF 1ECE +1ED0 1ED1 1ED0 +1ED1 1ED1 1ED0 +1ED2 1ED3 1ED2 +1ED3 1ED3 1ED2 +1ED4 1ED5 1ED4 +1ED5 1ED5 1ED4 +1ED6 1ED7 1ED6 +1ED7 1ED7 1ED6 +1ED8 1ED9 1ED8 +1ED9 1ED9 1ED8 +1EDA 1EDB 1EDA +1EDB 1EDB 1EDA +1EDC 1EDD 1EDC +1EDD 1EDD 1EDC +1EDE 1EDF 1EDE +1EDF 1EDF 1EDE +1EE0 1EE1 1EE0 +1EE1 1EE1 1EE0 +1EE2 1EE3 1EE2 +1EE3 1EE3 1EE2 +1EE4 1EE5 1EE4 +1EE5 1EE5 1EE4 +1EE6 1EE7 1EE6 +1EE7 1EE7 1EE6 +1EE8 1EE9 1EE8 +1EE9 1EE9 1EE8 +1EEA 1EEB 1EEA +1EEB 1EEB 1EEA +1EEC 1EED 1EEC +1EED 1EED 1EEC +1EEE 1EEF 1EEE +1EEF 1EEF 1EEE +1EF0 1EF1 1EF0 +1EF1 1EF1 1EF0 +1EF2 1EF3 1EF2 +1EF3 1EF3 1EF2 +1EF4 1EF5 1EF4 +1EF5 1EF5 1EF4 +1EF6 1EF7 1EF6 +1EF7 1EF7 1EF6 +1EF8 1EF9 1EF8 +1EF9 1EF9 1EF8 +1F00 1F00 1F08 +1F01 1F01 1F09 +1F02 1F02 1F0A +1F03 1F03 1F0B +1F04 1F04 1F0C +1F05 1F05 1F0D +1F06 1F06 1F0E +1F07 1F07 1F0F +1F08 1F00 1F08 +1F09 1F01 1F09 +1F0A 1F02 1F0A +1F0B 1F03 1F0B +1F0C 1F04 1F0C +1F0D 1F05 1F0D +1F0E 1F06 1F0E +1F0F 1F07 1F0F +1F10 1F10 1F18 +1F11 1F11 1F19 +1F12 1F12 1F1A +1F13 1F13 1F1B +1F14 1F14 1F1C +1F15 1F15 1F1D +1F18 1F10 1F18 +1F19 1F11 1F19 +1F1A 1F12 1F1A +1F1B 1F13 1F1B +1F1C 1F14 1F1C +1F1D 1F15 1F1D +1F20 1F20 1F28 +1F21 1F21 1F29 +1F22 1F22 1F2A +1F23 1F23 1F2B +1F24 1F24 1F2C +1F25 1F25 1F2D +1F26 1F26 1F2E +1F27 1F27 1F2F +1F28 1F20 1F28 +1F29 1F21 1F29 +1F2A 1F22 1F2A +1F2B 1F23 1F2B +1F2C 1F24 1F2C +1F2D 1F25 1F2D +1F2E 1F26 1F2E +1F2F 1F27 1F2F +1F30 1F30 1F38 +1F31 1F31 1F39 +1F32 1F32 1F3A +1F33 1F33 1F3B +1F34 1F34 1F3C +1F35 1F35 1F3D +1F36 1F36 1F3E +1F37 1F37 1F3F +1F38 1F30 1F38 +1F39 1F31 1F39 +1F3A 1F32 1F3A +1F3B 1F33 1F3B +1F3C 1F34 1F3C +1F3D 1F35 1F3D +1F3E 1F36 1F3E +1F3F 1F37 1F3F +1F40 1F40 1F48 +1F41 1F41 1F49 +1F42 1F42 1F4A +1F43 1F43 1F4B +1F44 1F44 1F4C +1F45 1F45 1F4D +1F48 1F40 1F48 +1F49 1F41 1F49 +1F4A 1F42 1F4A +1F4B 1F43 1F4B +1F4C 1F44 1F4C +1F4D 1F45 1F4D +1F51 1F51 1F59 +1F53 1F53 1F5B +1F55 1F55 1F5D +1F57 1F57 1F5F +1F59 1F51 1F59 +1F5B 1F53 1F5B +1F5D 1F55 1F5D +1F5F 1F57 1F5F +1F60 1F60 1F68 +1F61 1F61 1F69 +1F62 1F62 1F6A +1F63 1F63 1F6B +1F64 1F64 1F6C +1F65 1F65 1F6D +1F66 1F66 1F6E +1F67 1F67 1F6F +1F68 1F60 1F68 +1F69 1F61 1F69 +1F6A 1F62 1F6A +1F6B 1F63 1F6B +1F6C 1F64 1F6C +1F6D 1F65 1F6D +1F6E 1F66 1F6E +1F6F 1F67 1F6F +1F70 1F70 1FBA +1F71 1F71 1FBB +1F72 1F72 1FC8 +1F73 1F73 1FC9 +1F74 1F74 1FCA +1F75 1F75 1FCB +1F76 1F76 1FDA +1F77 1F77 1FDB +1F78 1F78 1FF8 +1F79 1F79 1FF9 +1F7A 1F7A 1FEA +1F7B 1F7B 1FEB +1F7C 1F7C 1FFA +1F7D 1F7D 1FFB +1F80 1F80 1F88 +1F81 1F81 1F89 +1F82 1F82 1F8A +1F83 1F83 1F8B +1F84 1F84 1F8C +1F85 1F85 1F8D +1F86 1F86 1F8E +1F87 1F87 1F8F +1F88 1F80 1F88 +1F89 1F81 1F89 +1F8A 1F82 1F8A +1F8B 1F83 1F8B +1F8C 1F84 1F8C +1F8D 1F85 1F8D +1F8E 1F86 1F8E +1F8F 1F87 1F8F +1F90 1F90 1F98 +1F91 1F91 1F99 +1F92 1F92 1F9A +1F93 1F93 1F9B +1F94 1F94 1F9C +1F95 1F95 1F9D +1F96 1F96 1F9E +1F97 1F97 1F9F +1F98 1F90 1F98 +1F99 1F91 1F99 +1F9A 1F92 1F9A +1F9B 1F93 1F9B +1F9C 1F94 1F9C +1F9D 1F95 1F9D +1F9E 1F96 1F9E +1F9F 1F97 1F9F +1FA0 1FA0 1FA8 +1FA1 1FA1 1FA9 +1FA2 1FA2 1FAA +1FA3 1FA3 1FAB +1FA4 1FA4 1FAC +1FA5 1FA5 1FAD +1FA6 1FA6 1FAE +1FA7 1FA7 1FAF +1FA8 1FA0 1FA8 +1FA9 1FA1 1FA9 +1FAA 1FA2 1FAA +1FAB 1FA3 1FAB +1FAC 1FA4 1FAC +1FAD 1FA5 1FAD +1FAE 1FA6 1FAE +1FAF 1FA7 1FAF +1FB0 1FB0 1FB8 +1FB1 1FB1 1FB9 +1FB3 1FB3 1FBC +1FB8 1FB0 1FB8 +1FB9 1FB1 1FB9 +1FBA 1F70 1FBA +1FBB 1F71 1FBB +1FBC 1FB3 1FBC +1FBE 1FBE 0399 +1FC3 1FC3 1FCC +1FC8 1F72 1FC8 +1FC9 1F73 1FC9 +1FCA 1F74 1FCA +1FCB 1F75 1FCB +1FCC 1FC3 1FCC +1FD0 1FD0 1FD8 +1FD1 1FD1 1FD9 +1FD8 1FD0 1FD8 +1FD9 1FD1 1FD9 +1FDA 1F76 1FDA +1FDB 1F77 1FDB +1FE0 1FE0 1FE8 +1FE1 1FE1 1FE9 +1FE5 1FE5 1FEC +1FE8 1FE0 1FE8 +1FE9 1FE1 1FE9 +1FEA 1F7A 1FEA +1FEB 1F7B 1FEB +1FEC 1FE5 1FEC +1FF3 1FF3 1FFC +1FF8 1F78 1FF8 +1FF9 1F79 1FF9 +1FFA 1F7C 1FFA +1FFB 1F7D 1FFB +1FFC 1FF3 1FFC +2126 03C9 2126 +212A 006B 212A +212B 00E5 212B +2160 2170 2160 +2161 2171 2161 +2162 2172 2162 +2163 2173 2163 +2164 2174 2164 +2165 2175 2165 +2166 2176 2166 +2167 2177 2167 +2168 2178 2168 +2169 2179 2169 +216A 217A 216A +216B 217B 216B +216C 217C 216C +216D 217D 216D +216E 217E 216E +216F 217F 216F +2170 2170 2160 +2171 2171 2161 +2172 2172 2162 +2173 2173 2163 +2174 2174 2164 +2175 2175 2165 +2176 2176 2166 +2177 2177 2167 +2178 2178 2168 +2179 2179 2169 +217A 217A 216A +217B 217B 216B +217C 217C 216C +217D 217D 216D +217E 217E 216E +217F 217F 216F +24B6 24D0 24B6 +24B7 24D1 24B7 +24B8 24D2 24B8 +24B9 24D3 24B9 +24BA 24D4 24BA +24BB 24D5 24BB +24BC 24D6 24BC +24BD 24D7 24BD +24BE 24D8 24BE +24BF 24D9 24BF +24C0 24DA 24C0 +24C1 24DB 24C1 +24C2 24DC 24C2 +24C3 24DD 24C3 +24C4 24DE 24C4 +24C5 24DF 24C5 +24C6 24E0 24C6 +24C7 24E1 24C7 +24C8 24E2 24C8 +24C9 24E3 24C9 +24CA 24E4 24CA +24CB 24E5 24CB +24CC 24E6 24CC +24CD 24E7 24CD +24CE 24E8 24CE +24CF 24E9 24CF +24D0 24D0 24B6 +24D1 24D1 24B7 +24D2 24D2 24B8 +24D3 24D3 24B9 +24D4 24D4 24BA +24D5 24D5 24BB +24D6 24D6 24BC +24D7 24D7 24BD +24D8 24D8 24BE +24D9 24D9 24BF +24DA 24DA 24C0 +24DB 24DB 24C1 +24DC 24DC 24C2 +24DD 24DD 24C3 +24DE 24DE 24C4 +24DF 24DF 24C5 +24E0 24E0 24C6 +24E1 24E1 24C7 +24E2 24E2 24C8 +24E3 24E3 24C9 +24E4 24E4 24CA +24E5 24E5 24CB +24E6 24E6 24CC +24E7 24E7 24CD +24E8 24E8 24CE +24E9 24E9 24CF +FF21 FF41 FF21 +FF22 FF42 FF22 +FF23 FF43 FF23 +FF24 FF44 FF24 +FF25 FF45 FF25 +FF26 FF46 FF26 +FF27 FF47 FF27 +FF28 FF48 FF28 +FF29 FF49 FF29 +FF2A FF4A FF2A +FF2B FF4B FF2B +FF2C FF4C FF2C +FF2D FF4D FF2D +FF2E FF4E FF2E +FF2F FF4F FF2F +FF30 FF50 FF30 +FF31 FF51 FF31 +FF32 FF52 FF32 +FF33 FF53 FF33 +FF34 FF54 FF34 +FF35 FF55 FF35 +FF36 FF56 FF36 +FF37 FF57 FF37 +FF38 FF58 FF38 +FF39 FF59 FF39 +FF3A FF5A FF3A +FF41 FF41 FF21 +FF42 FF42 FF22 +FF43 FF43 FF23 +FF44 FF44 FF24 +FF45 FF45 FF25 +FF46 FF46 FF26 +FF47 FF47 FF27 +FF48 FF48 FF28 +FF49 FF49 FF29 +FF4A FF4A FF2A +FF4B FF4B FF2B +FF4C FF4C FF2C +FF4D FF4D FF2D +FF4E FF4E FF2E +FF4F FF4F FF2F +FF50 FF50 FF30 +FF51 FF51 FF31 +FF52 FF52 FF32 +FF53 FF53 FF33 +FF54 FF54 FF34 +FF55 FF55 FF35 +FF56 FF56 FF36 +FF57 FF57 FF37 +FF58 FF58 FF38 +FF59 FF59 FF39 +FF5A FF5A FF3A +DROP VIEW v_bmp; +EXECUTE IMMEDIATE SFORMAT(' +CREATE VIEW v_supplementary AS +SELECT + seq AS codepoint, + LPAD(HEX(seq),8,''0'') AS codepoint_hex8, + CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c +FROM + seq_65536_to_1114111', @@character_set_connection, @@collation_connection); +SELECT COLLATION(c) FROM v_supplementary LIMIT 1; +COLLATION(c) +utf8mb4_unicode_ci +SELECT +codepoint_hex8, +HEX(CAST(LOWER(c) AS CHAR CHARACTER SET utf32)), +HEX(CAST(UPPER(c) AS CHAR CHARACTER SET utf32)) +FROM v_supplementary +WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c)); +codepoint_hex8 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET utf32)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET utf32)) +DROP VIEW v_supplementary; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/ctype_utf8mb4_unicode_ci_casefold.test b/mysql-test/main/ctype_utf8mb4_unicode_ci_casefold.test new file mode 100644 index 0000000000000..da46e40bda69a --- /dev/null +++ b/mysql-test/main/ctype_utf8mb4_unicode_ci_casefold.test @@ -0,0 +1,15 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-30716 Wrong casefolding in xxx_unicode_520_ci for U+0700..U+07FF +--echo # + +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci; +--source include/ctype_unicode_casefold_bmp.inc +--source include/ctype_unicode_casefold_supplementary.inc + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/custom_aggregate_functions.result b/mysql-test/main/custom_aggregate_functions.result index eb1e94f0d1323..7f2cde1b6fe88 100644 --- a/mysql-test/main/custom_aggregate_functions.result +++ b/mysql-test/main/custom_aggregate_functions.result @@ -968,7 +968,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `CONCAT(f1(a))` varchar(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; DROP FUNCTION f1; CREATE AGGREGATE FUNCTION f1() RETURNS TINYTEXT CHARACTER SET latin1 @@ -987,7 +987,7 @@ t1 CREATE TABLE `t1` ( `c1` tinytext DEFAULT NULL, `c2` tinytext DEFAULT NULL, `c3` varchar(255) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION f1; CREATE AGGREGATE FUNCTION f1() RETURNS TEXT CHARACTER SET latin1 @@ -1006,7 +1006,7 @@ t1 CREATE TABLE `t1` ( `c1` text DEFAULT NULL, `c2` text DEFAULT NULL, `c3` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION f1; CREATE AGGREGATE FUNCTION f1() RETURNS MEDIUMTEXT CHARACTER SET latin1 @@ -1025,7 +1025,7 @@ t1 CREATE TABLE `t1` ( `c1` mediumtext DEFAULT NULL, `c2` mediumtext DEFAULT NULL, `c3` mediumtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION f1; CREATE AGGREGATE FUNCTION f1() RETURNS LONGTEXT CHARACTER SET latin1 @@ -1044,7 +1044,7 @@ t1 CREATE TABLE `t1` ( `c1` longtext DEFAULT NULL, `c2` longtext DEFAULT NULL, `c3` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION f1; CREATE AGGREGATE FUNCTION f1() RETURNS TINYTEXT CHARACTER SET utf8 @@ -1060,10 +1060,10 @@ CREATE TABLE t1 AS SELECT f1() AS c1, COALESCE(f1()) AS c2, CONCAT(f1()) AS c3; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` tinytext CHARACTER SET utf8mb3 DEFAULT NULL, - `c2` text CHARACTER SET utf8mb3 DEFAULT NULL, - `c3` varchar(255) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` tinytext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c2` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c3` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION f1; CREATE AGGREGATE FUNCTION f1() RETURNS TEXT CHARACTER SET utf8 @@ -1079,10 +1079,10 @@ CREATE TABLE t1 AS SELECT f1() AS c1, COALESCE(f1()) AS c2, CONCAT(f1()) AS c3; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` text CHARACTER SET utf8mb3 DEFAULT NULL, - `c2` mediumtext CHARACTER SET utf8mb3 DEFAULT NULL, - `c3` mediumtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c2` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c3` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION f1; CREATE AGGREGATE FUNCTION f1() RETURNS MEDIUMTEXT CHARACTER SET utf8 @@ -1098,10 +1098,10 @@ CREATE TABLE t1 AS SELECT f1() AS c1, COALESCE(f1()) AS c2, CONCAT(f1()) AS c3; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` mediumtext CHARACTER SET utf8mb3 DEFAULT NULL, - `c2` longtext CHARACTER SET utf8mb3 DEFAULT NULL, - `c3` longtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c2` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c3` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION f1; CREATE AGGREGATE FUNCTION f1() RETURNS LONGTEXT CHARACTER SET utf8 @@ -1117,10 +1117,10 @@ CREATE TABLE t1 AS SELECT f1() AS c1, COALESCE(f1()) AS c2, CONCAT(f1()) AS c3; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` longtext CHARACTER SET utf8mb3 DEFAULT NULL, - `c2` longtext CHARACTER SET utf8mb3 DEFAULT NULL, - `c3` longtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c2` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c3` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION f1; # diff --git a/mysql-test/main/custom_aggregate_functions.test b/mysql-test/main/custom_aggregate_functions.test index 4b6129b597445..783746842905d 100644 --- a/mysql-test/main/custom_aggregate_functions.test +++ b/mysql-test/main/custom_aggregate_functions.test @@ -1,3 +1,6 @@ +# Check tests after fix MDEV-28475 +-- source include/no_view_protocol.inc + create table t2 (sal int(10)); delimiter |; diff --git a/mysql-test/main/custom_aggregates_i_s.test b/mysql-test/main/custom_aggregates_i_s.test index 11ed26c59b0f1..c6b195f797425 100644 --- a/mysql-test/main/custom_aggregates_i_s.test +++ b/mysql-test/main/custom_aggregates_i_s.test @@ -1,3 +1,6 @@ +# enable view-protocol after fix MDEV-28475 +-- source include/no_view_protocol.inc + --source include/default_optimizer_switch.inc flush status; diff --git a/mysql-test/main/date_formats.test b/mysql-test/main/date_formats.test index 3bf6fabbf6d8e..4f252f29a6909 100644 --- a/mysql-test/main/date_formats.test +++ b/mysql-test/main/date_formats.test @@ -2,6 +2,9 @@ # Test of date format functions # +#remove this include after fix MDEV-27871 +-- source include/no_view_protocol.inc + --disable_warnings drop table if exists t1; --enable_warnings diff --git a/mysql-test/main/ddl_i18n_koi8r.result b/mysql-test/main/ddl_i18n_koi8r.result index 074fb4c6fd8e3..f588374a26fc9 100644 --- a/mysql-test/main/ddl_i18n_koi8r.result +++ b/mysql-test/main/ddl_i18n_koi8r.result @@ -720,9 +720,11 @@ utf8mb3_general_ci utf8mb3_general_ci ---> Dump of mysqltest1 -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; USE `mysqltest1`; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; ALTER DATABASE `mysqltest1` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -730,8 +732,6 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ; /*!50003 SET character_set_client = koi8r */ ; /*!50003 SET character_set_results = koi8r */ ; /*!50003 SET collation_connection = koi8r_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( INOUT �����1 CHAR(10), @@ -757,6 +757,8 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; ALTER DATABASE `mysqltest1` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -764,8 +766,6 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ; /*!50003 SET character_set_client = koi8r */ ; /*!50003 SET character_set_results = koi8r */ ; /*!50003 SET collation_connection = koi8r_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( INOUT �����1 CHAR(10) CHARACTER SET utf8, @@ -796,9 +796,11 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ; ---> Dump of mysqltest2 -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; USE `mysqltest2`; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; ALTER DATABASE `mysqltest2` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -806,8 +808,6 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ; /*!50003 SET character_set_client = koi8r */ ; /*!50003 SET character_set_results = koi8r */ ; /*!50003 SET collation_connection = koi8r_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( INOUT �����1 CHAR(10), @@ -833,6 +833,8 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; ALTER DATABASE `mysqltest2` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -840,8 +842,6 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ; /*!50003 SET character_set_client = koi8r */ ; /*!50003 SET character_set_results = koi8r */ ; /*!50003 SET collation_connection = koi8r_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( INOUT �����1 CHAR(10) CHARACTER SET utf8, @@ -1724,13 +1724,13 @@ DELETE FROM mysqltest2.log| ---> Dump of mysqltest1 -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; USE `mysqltest1`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `log` ( - `msg` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL + `msg` varchar(255) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -1806,13 +1806,13 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ; ---> Dump of mysqltest2 -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; USE `mysqltest2`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `log` ( - `msg` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL + `msg` varchar(255) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -2492,7 +2492,7 @@ END ONE TIME 1970-01-02 00:00:00 NULL NULL NULL NULL DISABLED PRESERVE CREATED ---> Dump of mysqltest1 -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; USE `mysqltest1`; /*!50106 SET @save_time_zone= @@TIME_ZONE */ ; @@ -2559,7 +2559,7 @@ DELIMITER ; ---> Dump of mysqltest2 -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; USE `mysqltest2`; /*!50106 SET @save_time_zone= @@TIME_ZONE */ ; @@ -2787,26 +2787,26 @@ END| CALL p1()| Table Create Table t1 CREATE TABLE `t1` ( - `col1` varchar(10) COLLATE utf8mb3_unicode_ci DEFAULT NULL + `col1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci SHOW CREATE TABLE t1| Table Create Table t1 CREATE TABLE `t1` ( - `col1` varchar(10) COLLATE utf8mb3_unicode_ci DEFAULT NULL + `col1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci CALL mysqltest2.p2()| Table Create Table t2 CREATE TABLE `t2` ( - `col1` varchar(10) COLLATE utf8mb3_unicode_ci DEFAULT NULL + `col1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci SHOW CREATE TABLE mysqltest2.t2| Table Create Table t2 CREATE TABLE `t2` ( - `col1` varchar(10) COLLATE utf8mb3_unicode_ci DEFAULT NULL + `col1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ALTER DATABASE mysqltest1 COLLATE cp1251_general_cs| @@ -2817,26 +2817,26 @@ DROP TABLE mysqltest2.t2| CALL p1()| Table Create Table t1 CREATE TABLE `t1` ( - `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL + `col1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs SHOW CREATE TABLE t1| Table Create Table t1 CREATE TABLE `t1` ( - `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL + `col1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs CALL mysqltest2.p2()| Table Create Table t2 CREATE TABLE `t2` ( - `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL + `col1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs SHOW CREATE TABLE mysqltest2.t2| Table Create Table t2 CREATE TABLE `t2` ( - `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL + `col1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs connection con2; disconnect con2; diff --git a/mysql-test/main/ddl_i18n_koi8r.test b/mysql-test/main/ddl_i18n_koi8r.test index 70e7e2e81ca54..4f16cbaba6b7e 100644 --- a/mysql-test/main/ddl_i18n_koi8r.test +++ b/mysql-test/main/ddl_i18n_koi8r.test @@ -42,6 +42,7 @@ let collation=utf8mb3_unicode_ci; --source include/have_collation.inc ########################################################################### +--disable_service_connection set names koi8r; delimiter |; @@ -1119,3 +1120,4 @@ delimiter ;| USE test; DROP DATABASE mysqltest1; DROP DATABASE mysqltest2; +--enable_service_connection diff --git a/mysql-test/main/ddl_i18n_utf8.result b/mysql-test/main/ddl_i18n_utf8.result index 53190dcc22e64..cb57bc5e9df95 100644 --- a/mysql-test/main/ddl_i18n_utf8.result +++ b/mysql-test/main/ddl_i18n_utf8.result @@ -720,9 +720,11 @@ utf8mb3_general_ci utf8mb3_general_ci ---> Dump of mysqltest1 -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; USE `mysqltest1`; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; ALTER DATABASE `mysqltest1` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -730,8 +732,6 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ; /*!50003 SET character_set_client = utf8mb3 */ ; /*!50003 SET character_set_results = utf8mb3 */ ; /*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( INOUT парам1 CHAR(10), @@ -757,6 +757,8 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; ALTER DATABASE `mysqltest1` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -764,8 +766,6 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ; /*!50003 SET character_set_client = utf8mb3 */ ; /*!50003 SET character_set_results = utf8mb3 */ ; /*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( INOUT парам1 CHAR(10) CHARACTER SET utf8, @@ -796,9 +796,11 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ; ---> Dump of mysqltest2 -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; USE `mysqltest2`; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; ALTER DATABASE `mysqltest2` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -806,8 +808,6 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ; /*!50003 SET character_set_client = utf8mb3 */ ; /*!50003 SET character_set_results = utf8mb3 */ ; /*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( INOUT парам1 CHAR(10), @@ -833,6 +833,8 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; ALTER DATABASE `mysqltest2` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -840,8 +842,6 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ; /*!50003 SET character_set_client = utf8mb3 */ ; /*!50003 SET character_set_results = utf8mb3 */ ; /*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( INOUT парам1 CHAR(10) CHARACTER SET utf8, @@ -1724,13 +1724,13 @@ DELETE FROM mysqltest2.log| ---> Dump of mysqltest1 -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; USE `mysqltest1`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `log` ( - `msg` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL + `msg` varchar(255) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -1806,13 +1806,13 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ; ---> Dump of mysqltest2 -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; USE `mysqltest2`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `log` ( - `msg` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL + `msg` varchar(255) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -2492,7 +2492,7 @@ END ONE TIME 1970-01-02 00:00:00 NULL NULL NULL NULL DISABLED PRESERVE CREATED ---> Dump of mysqltest1 -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; USE `mysqltest1`; /*!50106 SET @save_time_zone= @@TIME_ZONE */ ; @@ -2559,7 +2559,7 @@ DELIMITER ; ---> Dump of mysqltest2 -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; USE `mysqltest2`; /*!50106 SET @save_time_zone= @@TIME_ZONE */ ; @@ -2787,26 +2787,26 @@ END| CALL p1()| Table Create Table t1 CREATE TABLE `t1` ( - `col1` varchar(10) COLLATE utf8mb3_unicode_ci DEFAULT NULL + `col1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci SHOW CREATE TABLE t1| Table Create Table t1 CREATE TABLE `t1` ( - `col1` varchar(10) COLLATE utf8mb3_unicode_ci DEFAULT NULL + `col1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci CALL mysqltest2.p2()| Table Create Table t2 CREATE TABLE `t2` ( - `col1` varchar(10) COLLATE utf8mb3_unicode_ci DEFAULT NULL + `col1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci SHOW CREATE TABLE mysqltest2.t2| Table Create Table t2 CREATE TABLE `t2` ( - `col1` varchar(10) COLLATE utf8mb3_unicode_ci DEFAULT NULL + `col1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ALTER DATABASE mysqltest1 COLLATE cp1251_general_cs| @@ -2817,26 +2817,26 @@ DROP TABLE mysqltest2.t2| CALL p1()| Table Create Table t1 CREATE TABLE `t1` ( - `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL + `col1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs SHOW CREATE TABLE t1| Table Create Table t1 CREATE TABLE `t1` ( - `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL + `col1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs CALL mysqltest2.p2()| Table Create Table t2 CREATE TABLE `t2` ( - `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL + `col1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs SHOW CREATE TABLE mysqltest2.t2| Table Create Table t2 CREATE TABLE `t2` ( - `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL + `col1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs connection con2; disconnect con2; diff --git a/mysql-test/main/ddl_i18n_utf8.test b/mysql-test/main/ddl_i18n_utf8.test index 35b341ddc80d3..1f9690e7dacc7 100644 --- a/mysql-test/main/ddl_i18n_utf8.test +++ b/mysql-test/main/ddl_i18n_utf8.test @@ -42,6 +42,7 @@ let collation=utf8mb3_unicode_ci; --source include/have_collation.inc ########################################################################### +--disable_service_connection set names utf8; delimiter |; @@ -1122,3 +1123,4 @@ delimiter ;| USE test; DROP DATABASE mysqltest1; DROP DATABASE mysqltest2; +--enable_service_connection diff --git a/mysql-test/main/debug_sync.result b/mysql-test/main/debug_sync.result index bb9ae1a417d0b..4c1711a6d6b3b 100644 --- a/mysql-test/main/debug_sync.result +++ b/mysql-test/main/debug_sync.result @@ -2,7 +2,7 @@ SET DEBUG_SYNC= 'RESET'; DROP TABLE IF EXISTS t1; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: '' +debug_sync ON - current signals: '' SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3'; SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2'; SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 HIT_LIMIT 3'; @@ -150,34 +150,34 @@ SET @myvar= 'now SIGNAL from_myvar'; SET DEBUG_SYNC= @myvar; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 'from_myvar' +debug_sync ON - current signals: 'from_myvar' SET DEBUG_SYNC= LEFT('now SIGNAL from_function_cut_here', 24); SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 'from_function' +debug_sync ON - current signals: 'from_myvar,from_function' SET DEBUG_SYNC= 'now SIGNAL something'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 'something' +debug_sync ON - current signals: 'something,from_function,from_myvar' SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0'; Warnings: Warning #### debug sync point wait timed out SET DEBUG_SYNC= 'now SIGNAL nothing'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 'nothing' +debug_sync ON - current signals: 'something,from_function,nothing,from_myvar' SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0'; SET DEBUG_SYNC= 'now SIGNAL something EXECUTE 0'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 'nothing' +debug_sync ON - current signals: 'something,from_function,from_myvar' SET DEBUG_SYNC= 'now WAIT_FOR anotherthing TIMEOUT 0 EXECUTE 0'; SET DEBUG_SYNC= 'now HIT_LIMIT 1'; ERROR HY000: debug sync point hit limit reached SET DEBUG_SYNC= 'RESET'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: '' +debug_sync ON - current signals: '' SET DEBUG_SYNC= 'p1abcd SIGNAL s1 EXECUTE 2'; SET DEBUG_SYNC= 'p2abc SIGNAL s2 EXECUTE 2'; SET DEBUG_SYNC= 'p9abcdef SIGNAL s9 EXECUTE 2'; @@ -190,23 +190,30 @@ SET DEBUG_SYNC= 'p3abcdef SIGNAL s3 EXECUTE 2'; SET DEBUG_SYNC= 'p4a TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's4' +debug_sync ON - current signals: 's4' SET DEBUG_SYNC= 'p1abcd TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's1' +debug_sync ON - current signals: 's4,s1' SET DEBUG_SYNC= 'p7 TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's7' +debug_sync ON - current signals: 's1,s7,s4' SET DEBUG_SYNC= 'p9abcdef TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's9' +debug_sync ON - current signals: 's1,s7,s4,s9' SET DEBUG_SYNC= 'p3abcdef TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's3' +debug_sync ON - current signals: 's1,s3,s4,s9,s7' +SET DEBUG_SYNC= 'now WAIT_FOR s9'; +SET DEBUG_SYNC= 'now WAIT_FOR s1'; +SET DEBUG_SYNC= 'now WAIT_FOR s4'; +SET DEBUG_SYNC= 'now WAIT_FOR s7'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; +Variable_name Value +debug_sync ON - current signals: 's3' SET DEBUG_SYNC= 'p1abcd CLEAR'; SET DEBUG_SYNC= 'p2abc CLEAR'; SET DEBUG_SYNC= 'p5abcde CLEAR'; @@ -219,19 +226,19 @@ SET DEBUG_SYNC= 'p7 CLEAR'; SET DEBUG_SYNC= 'p1abcd TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's3' +debug_sync ON - current signals: 's3' SET DEBUG_SYNC= 'p7 TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's3' +debug_sync ON - current signals: 's3' SET DEBUG_SYNC= 'p9abcdef TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's3' +debug_sync ON - current signals: 's3' SET DEBUG_SYNC= 'RESET'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: '' +debug_sync ON - current signals: '' CREATE USER mysqltest_1@localhost; GRANT SUPER ON *.* TO mysqltest_1@localhost; connect con1,localhost,mysqltest_1,,; @@ -292,4 +299,24 @@ disconnect con1; disconnect con2; connection default; DROP TABLE t1; +# +# Test NO_CLEAR_EVENT flag. The signal should still be visible after +# the wait has completed succesfully. +# +SET DEBUG_SYNC= 'now SIGNAL s1'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; +Variable_name Value +debug_sync ON - current signals: 's1' +SET DEBUG_SYNC= 'now WAIT_FOR s1 NO_CLEAR_EVENT'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; +Variable_name Value +debug_sync ON - current signals: 's1' +SET DEBUG_SYNC= 'now WAIT_FOR s1'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; +Variable_name Value +debug_sync ON - current signals: '' +SET DEBUG_SYNC= 'now SIGNAL s1,s2,s5,s7'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; +Variable_name Value +debug_sync ON - current signals: 's2,s7,s1,s5' SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/main/debug_sync.test b/mysql-test/main/debug_sync.test index 89414939f5999..6e75ba9624c60 100644 --- a/mysql-test/main/debug_sync.test +++ b/mysql-test/main/debug_sync.test @@ -231,15 +231,12 @@ SHOW VARIABLES LIKE 'DEBUG_SYNC'; # immediately after setting of the DEBUG_SYNC variable. # So it is executed before the SET statement ends. # -# NOTE: There is only one global signal (say "signal post" or "flag mast"). -# A SIGNAL action writes its signal into it ("sets a flag"). -# The signal persists until explicitly overwritten. +# NOTE: There can be multiple active signals at the same time. +# A SIGNAL action appends its signal into signals set. +# The signal persists until waited on. # To avoid confusion for later tests, it is recommended to clear -# the signal by signalling "empty" ("setting the 'empty' flag"): -# SET DEBUG_SYNC= 'now SIGNAL empty'; -# Preferably you can reset the whole facility with: +# the signal set by running # SET DEBUG_SYNC= 'RESET'; -# The signal is then '' (really empty) which connot be done otherwise. # # @@ -298,6 +295,16 @@ SET DEBUG_SYNC= 'p9abcdef TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; SET DEBUG_SYNC= 'p3abcdef TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; + +# +# Wait for all signals currently active except s3. +# +SET DEBUG_SYNC= 'now WAIT_FOR s9'; +SET DEBUG_SYNC= 'now WAIT_FOR s1'; +SET DEBUG_SYNC= 'now WAIT_FOR s4'; +SET DEBUG_SYNC= 'now WAIT_FOR s7'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; + # # Clear the actions. # @@ -320,7 +327,7 @@ SHOW VARIABLES LIKE 'DEBUG_SYNC'; SET DEBUG_SYNC= 'p9abcdef TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; # -# Now cleanup. Actions are clear already, but signal needs to be cleared. +# Now cleanup. Actions are clear already, but s3 signal needs to be cleared. # SET DEBUG_SYNC= 'RESET'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; @@ -418,10 +425,24 @@ disconnect con2; connection default; DROP TABLE t1; +--echo # +--echo # Test NO_CLEAR_EVENT flag. The signal should still be visible after +--echo # the wait has completed succesfully. +--echo # +SET DEBUG_SYNC= 'now SIGNAL s1'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; +SET DEBUG_SYNC= 'now WAIT_FOR s1 NO_CLEAR_EVENT'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; +SET DEBUG_SYNC= 'now WAIT_FOR s1'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; + +SET DEBUG_SYNC= 'now SIGNAL s1,s2,s5,s7'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; + + # # Cleanup after test case. -# Otherwise signal would contain 'flushed' here, -# which could confuse the next test. +# Otherwise signal would confuse the next test. # SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/main/default.result b/mysql-test/main/default.result index 493101f10ee7d..150bc860106f9 100644 --- a/mysql-test/main/default.result +++ b/mysql-test/main/default.result @@ -1,5 +1,3 @@ -drop table if exists t1,t2,t3,t4,t5,t6; -drop database if exists mysqltest; set sql_mode=""; CREATE TABLE t1 (a varchar(30) binary NOT NULL DEFAULT ' ', b varchar(1) binary NOT NULL DEFAULT ' ', @@ -69,9 +67,9 @@ ENGINE=MyISAM DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ', - `b` varchar(1) COLLATE latin1_bin NOT NULL DEFAULT ' ', - `c` varchar(4) COLLATE latin1_bin NOT NULL DEFAULT '0000', + `a` varchar(30) NOT NULL DEFAULT ' ', + `b` varchar(1) NOT NULL DEFAULT ' ', + `c` varchar(4) NOT NULL DEFAULT '0000', `d` tinyblob DEFAULT NULL, `e` tinyblob DEFAULT NULL, `f` tinyblob DEFAULT NULL, @@ -85,17 +83,17 @@ t2 CREATE TABLE `t2` ( `n` tinyblob DEFAULT NULL, `o` tinyblob DEFAULT NULL, `p` tinyblob DEFAULT NULL, - `q` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ', - `r` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ', + `q` varchar(30) NOT NULL DEFAULT ' ', + `r` varchar(30) NOT NULL DEFAULT ' ', `s` tinyblob DEFAULT NULL, - `t` varchar(4) COLLATE latin1_bin NOT NULL DEFAULT ' ', - `u` varchar(1) COLLATE latin1_bin NOT NULL DEFAULT ' ', - `v` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ', - `w` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ', + `t` varchar(4) NOT NULL DEFAULT ' ', + `u` varchar(1) NOT NULL DEFAULT ' ', + `v` varchar(30) NOT NULL DEFAULT ' ', + `w` varchar(30) NOT NULL DEFAULT ' ', `x` tinyblob DEFAULT NULL, - `y` varchar(5) COLLATE latin1_bin NOT NULL DEFAULT ' ', - `z` varchar(20) COLLATE latin1_bin NOT NULL DEFAULT ' ', - `a1` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ', + `y` varchar(5) NOT NULL DEFAULT ' ', + `z` varchar(20) NOT NULL DEFAULT ' ', + `a1` varchar(30) NOT NULL DEFAULT ' ', `b1` tinyblob DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin INSERT into t2 (b) values ('1'); @@ -292,19 +290,19 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE or replace TABLE t1 (event_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(2) ON UPDATE CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(2) ON UPDATE current_timestamp(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE or replace TABLE t1 (event_time TIMESTAMP(6) NOT NULL DEFAULT SYSDATE(2) ON UPDATE CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `event_time` timestamp(6) NOT NULL DEFAULT sysdate(2) ON UPDATE current_timestamp(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # # Check default expressions @@ -316,7 +314,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT 1, `b` int(11) DEFAULT (`a` + 1), `c` int(11) DEFAULT (`a` + `b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (); insert into t1 (a) values (2); insert into t1 (a,b) values (10,20); @@ -347,7 +345,7 @@ t1 CREATE TABLE `t1` ( `b` blob DEFAULT 1, `c` blob DEFAULT 'hello', `t` text DEFAULT concat(`a`,`b`,`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 (a) values (2); insert into t1 (a,b) values (10,"test1"); insert into t1 (a,b,c) values (10,"test2","test3"); @@ -394,7 +392,7 @@ t1 CREATE TABLE `t1` ( `f` int(11) DEFAULT (1 + 1 + 1), `g` int(11) NOT NULL DEFAULT (1 + 1 + 1 + 1), `h` int(11) DEFAULT (2 + 2 + 2 + 2) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t2 like t1; show create table t2; Table Create Table @@ -407,7 +405,7 @@ t2 CREATE TABLE `t2` ( `f` int(11) DEFAULT (1 + 1 + 1), `g` int(11) NOT NULL DEFAULT (1 + 1 + 1 + 1), `h` int(11) DEFAULT (2 + 2 + 2 + 2) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t2 (a) values (100); select a,b,c,d,e,f,g,h from t2; a b c d e f g h @@ -421,7 +419,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT -1, `c` int(11) DEFAULT 1, `e` int(11) DEFAULT 1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values(); insert into t1 values(); select * from t1; @@ -564,7 +562,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT 1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a=-1; execute stmt using @a; @@ -572,7 +570,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT -1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; DEALLOCATE PREPARE stmt; PREPARE stmt FROM 'CREATE TABLE t1 (a INT DEFAULT(?), b INT DEFAULT(?))'; @@ -583,7 +581,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT 1, `b` int(11) DEFAULT 2 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; DEALLOCATE PREPARE stmt; prepare stmt from 'create table t1 (a int default(?+?))'; @@ -594,7 +592,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT (1 + 1) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # # Parenthesized Item_basic_constant @@ -632,7 +630,7 @@ t1 CREATE TABLE `t1` ( `d01` time DEFAULT '10:20:30', `d02` date DEFAULT '2001-01-01', `d03` datetime DEFAULT '2001-01-01 10:20:30' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (); SELECT * FROM t1; i01 1 @@ -686,7 +684,7 @@ t1 CREATE TABLE `t1` ( `d01` time DEFAULT coalesce(TIME'10:20:30'), `d02` date DEFAULT coalesce(DATE'2001-01-01'), `d03` datetime DEFAULT coalesce(TIMESTAMP'2001-01-01 10:20:30') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (); SELECT * FROM t1; i01 1 @@ -721,7 +719,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL DEFAULT 1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; a @@ -732,7 +730,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL DEFAULT coalesce(1) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; a @@ -746,7 +744,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL DEFAULT 1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; a @@ -757,7 +755,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL DEFAULT concat('1') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; a @@ -768,7 +766,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL DEFAULT coalesce('1') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; a @@ -804,7 +802,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT 1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; a @@ -817,7 +815,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT concat('1 ') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); Warnings: Note 1265 Data truncated for column 'a' at row 1 @@ -832,7 +830,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT coalesce('1 ') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); Warnings: Note 1265 Data truncated for column 'a' at row 1 @@ -848,7 +846,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL DEFAULT 97 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; a @@ -862,7 +860,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) NOT NULL DEFAULT 'xxx' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; a @@ -873,14 +871,14 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(2) NOT NULL DEFAULT 'A' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT(0x41) NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(2) NOT NULL DEFAULT concat(0x41) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; a @@ -891,7 +889,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(2) NOT NULL DEFAULT coalesce(0x41) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; a @@ -902,7 +900,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(2) NOT NULL DEFAULT concat(_utf8mb3'A') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; a @@ -913,7 +911,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(2) NOT NULL DEFAULT concat(_utf8mb3'A') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; a @@ -951,7 +949,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT `a` -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1, 1); INSERT INTO t1 VALUES (DEFAULT, DEFAULT); INSERT INTO t1 VALUES (1, DEFAULT); @@ -972,7 +970,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT default(`b`), `b` int(11) DEFAULT 1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT, DEFAULT); SELECT * FROM t1; a b @@ -984,7 +982,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT 1, `b` int(11) DEFAULT default(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT, DEFAULT); SELECT * FROM t1; a b @@ -998,21 +996,21 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIME DEFAULT CURRENT_TIME); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT curtime() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a DATE DEFAULT CURRENT_DATE); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT curdate() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # DECIMAL + CURRENT_TIMESTAMP, no truncation @@ -1022,7 +1020,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(30,6) DEFAULT current_timestamp(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (); SELECT * FROM t1; a @@ -1033,7 +1031,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(30,6) DEFAULT coalesce(current_timestamp(6)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES(); INSERT IGNORE INTO t1 VALUES(); SET sql_mode = 'STRICT_ALL_TABLES'; @@ -1048,7 +1046,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(30,6) DEFAULT coalesce(curtime(6)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT IGNORE INTO t1 VALUES(); DROP TABLE t1; # @@ -1059,7 +1057,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(30,6) DEFAULT coalesce(curdate()) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT IGNORE INTO t1 VALUES(); DROP TABLE t1; # @@ -1070,21 +1068,21 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT coalesce(current_timestamp()) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a DATE DEFAULT COALESCE(CURRENT_DATE)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT coalesce(curdate()) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIME DEFAULT COALESCE(CURRENT_TIME)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT coalesce(curtime()) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP DEFAULT CURRENT_TIMESTAMP(6), @@ -1095,7 +1093,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp(), `b` timestamp NOT NULL DEFAULT coalesce(current_timestamp(6)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (); SELECT CURRENT_TIMESTAMP(6); CURRENT_TIMESTAMP(6) @@ -1113,7 +1111,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(30,0) DEFAULT current_timestamp(6), `b` decimal(30,0) DEFAULT coalesce(current_timestamp(6)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT IGNORE INTO t1 VALUES (); Warnings: Note 1265 Data truncated for column 'a' at row 1 @@ -1131,7 +1129,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT (3 + 3), `b` int(11) DEFAULT 1000 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,1),(2,2); insert into t1 values (default,default); select * from t1; @@ -1159,7 +1157,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(10,1) DEFAULT NULL, `b` double DEFAULT (cast(`a` as double)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (10.1, DEFAULT); SELECT * FROM t1; a b @@ -1173,7 +1171,7 @@ t1 CREATE TABLE `t1` ( `b` double DEFAULT exp(`a`), `c` double DEFAULT log(`b`), `d` double DEFAULT log(4,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (2, DEFAULT, DEFAULT, DEFAULT); SELECT * FROM t1; a b c d @@ -1186,7 +1184,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` double DEFAULT log2(`a`), `c` double DEFAULT log10(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (4, DEFAULT, DEFAULT); INSERT INTO t1 VALUES (100, DEFAULT, DEFAULT); SELECT * FROM t1; @@ -1201,7 +1199,7 @@ t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT sqrt(`a`), `c` double DEFAULT pow(`a`,3) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (4, DEFAULT, DEFAULT); SELECT * FROM t1; a b c @@ -1215,7 +1213,7 @@ t1 CREATE TABLE `t1` ( `b` double DEFAULT acos(`a`), `c` double DEFAULT asin(`a`), `d` double DEFAULT atan(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1, DEFAULT, DEFAULT, DEFAULT); SELECT a, b/PI(), c/PI(), d/PI() FROM t1; a b/PI() c/PI() d/PI() @@ -1230,7 +1228,7 @@ t1 CREATE TABLE `t1` ( `c` double DEFAULT sin(`a`), `d` double DEFAULT tan(`a`), `e` double DEFAULT cot(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (PI()/3); SELECT ROUND(a,3), ROUND(b,3), ROUND(c,3), ROUND(d,3), ROUND(e,3) FROM t1; ROUND(a,3) ROUND(b,3) ROUND(c,3) ROUND(d,3) ROUND(e,3) @@ -1241,7 +1239,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT rand() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT); DROP TABLE t1; CREATE TABLE t1 (a DOUBLE, b DOUBLE DEFAULT DEGREES(a), c DOUBLE DEFAULT RADIANS(b)); @@ -1251,7 +1249,7 @@ t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT degrees(`a`), `c` double DEFAULT radians(`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (PI(), DEFAULT, DEFAULT); SELECT * FROM t1; a b c @@ -1266,7 +1264,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT interval(`a`,10,20,30,40) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (34); SELECT * FROM t1; a b @@ -1279,7 +1277,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT (`a` DIV `b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a, b) VALUES (13, 3); SELECT * FROM t1; a b c @@ -1291,7 +1289,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT sign(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (-10),(0), (10); SELECT * FROM t1; a b @@ -1305,7 +1303,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, `b` int(11) DEFAULT field(`a`,'Hej','ej','Heja','hej','foo') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('ej'); SELECT * FROM t1; a b @@ -1317,7 +1315,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, `b` int(11) DEFAULT find_in_set(`a`,'Hej,ej,Heja,hej,foo') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('ej'); SELECT * FROM t1; a b @@ -1330,7 +1328,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, `b` int(11) DEFAULT ascii(`a`), `c` int(11) DEFAULT ord(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('a'); SELECT * FROM t1; a b c @@ -1341,7 +1339,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text DEFAULT uuid_short() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (); SELECT a>0 FROM t1; a>0 @@ -1380,7 +1378,7 @@ t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` date DEFAULT (`a` + interval `b` day) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('2001-01-01', 30, DEFAULT); SELECT * FROM t1; a b c @@ -1393,7 +1391,7 @@ t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` time DEFAULT NULL, `c` datetime DEFAULT addtime(`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('2001-01-01', '10:20:30', DEFAULT); SELECT * FROM t1; a b c @@ -1406,7 +1404,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(32) DEFAULT NULL, `b` varchar(32) DEFAULT NULL, `c` date DEFAULT str_to_date(`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('01,5,2013','%d,%m,%Y', DEFAULT); SELECT * FROM t1; a b c @@ -1421,7 +1419,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT curdate(), `b` date DEFAULT utc_date() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (); SELECT * FROM t1; a b @@ -1434,7 +1432,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` date DEFAULT from_days(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (730669, DEFAULT); SELECT * FROM t1; a b @@ -1446,7 +1444,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` date DEFAULT last_day(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('2003-02-05', DEFAULT); SELECT * FROM t1; a b @@ -1459,7 +1457,7 @@ t1 CREATE TABLE `t1` ( `yy` int(11) DEFAULT NULL, `yd` int(11) DEFAULT NULL, `d` date DEFAULT makedate(`yy`,`yd`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (2011,32,DEFAULT); SELECT * FROM t1; yy yd d @@ -1474,7 +1472,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT curtime(), `b` time DEFAULT utc_time() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (); SELECT * FROM t1; a b @@ -1487,7 +1485,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` time DEFAULT sec_to_time(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (2378, DEFAULT); SELECT * FROM t1; a b @@ -1500,7 +1498,7 @@ t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime DEFAULT NULL, `c` time DEFAULT timediff(`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('2000:01:01 00:00:00', '2000:01:02 10:20:30', DEFAULT); SELECT * FROM t1; a b c @@ -1514,7 +1512,7 @@ t1 CREATE TABLE `t1` ( `mm` int(11) DEFAULT NULL, `ss` int(11) DEFAULT NULL, `t` time DEFAULT maketime(`hh`,`mm`,`ss`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (10,20,30,DEFAULT); SELECT * FROM t1; hh mm ss t @@ -1529,7 +1527,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp(), `b` timestamp NOT NULL DEFAULT utc_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (); SELECT * FROM t1; a b @@ -1543,7 +1541,7 @@ t1 CREATE TABLE `t1` ( `a` timestamp(6) NOT NULL DEFAULT sysdate(6), `s` int(11) DEFAULT NULL, `b` timestamp(6) NOT NULL DEFAULT sysdate(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (DEFAULT(a), SLEEP(0.1), DEFAULT(b)); SELECT b>a FROM t1; b>a @@ -1556,7 +1554,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` timestamp NOT NULL DEFAULT from_unixtime(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1447430881, DEFAULT); SELECT * FROM t1; a b @@ -1569,7 +1567,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NOT NULL DEFAULT convert_tz(`a`,'-10:00','+10:00') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('2001-01-01 10:20:30', DEFAULT); SELECT * FROM t1; a b @@ -1582,7 +1580,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` date DEFAULT cast(`a` as date) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (20010203, DEFAULT); SELECT * FROM t1; a b @@ -1594,7 +1592,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` time DEFAULT cast(`a` as time) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (102030, DEFAULT); SELECT * FROM t1; a b @@ -1606,7 +1604,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, `b` datetime DEFAULT cast(`a` as datetime) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (20010203102030, DEFAULT); SELECT * FROM t1; a b @@ -1622,7 +1620,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT period_add(`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES (200801, 2); SELECT * FROM t1; a b c @@ -1635,7 +1633,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT period_diff(`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES (200802, 200703); SELECT * FROM t1; a b c @@ -1647,7 +1645,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT to_days(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (950501); SELECT * FROM t1; a b @@ -1659,7 +1657,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` int(11) DEFAULT to_days(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('2007-10-07'); SELECT * FROM t1; a b @@ -1671,7 +1669,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` bigint(20) DEFAULT to_seconds(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (950501); SELECT * FROM t1; a b @@ -1683,7 +1681,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` bigint(20) DEFAULT to_seconds(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('2009-11-29'); SELECT * FROM t1; a b @@ -1695,7 +1693,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` bigint(20) DEFAULT to_seconds(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('2009-11-29 13:43:32'); SELECT * FROM t1; a b @@ -1707,7 +1705,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` bigint(20) DEFAULT dayofmonth(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('2007-02-03'); SELECT * FROM t1; a b @@ -1719,7 +1717,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` bigint(20) DEFAULT dayofweek(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('2007-02-03'); SELECT * FROM t1; a b @@ -1731,7 +1729,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` bigint(20) DEFAULT dayofyear(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('2007-02-03'); SELECT * FROM t1; a b @@ -1743,7 +1741,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, `b` int(11) DEFAULT hour(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('10:05:03'); SELECT * FROM t1; a b @@ -1755,7 +1753,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, `b` int(11) DEFAULT minute(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('10:05:03'); SELECT * FROM t1; a b @@ -1767,7 +1765,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, `b` int(11) DEFAULT second(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('10:05:03'); SELECT * FROM t1; a b @@ -1779,7 +1777,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime(6) DEFAULT NULL, `b` int(11) DEFAULT microsecond(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('2009-12-31 23:59:59.000010'); SELECT * FROM t1; a b @@ -1791,7 +1789,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` int(11) DEFAULT year(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('1987-01-01'); SELECT * FROM t1; a b @@ -1803,7 +1801,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` int(11) DEFAULT month(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('1987-01-01'); SELECT * FROM t1; a b @@ -1815,7 +1813,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` int(11) DEFAULT week(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('1987-02-01'); SELECT * FROM t1; a b @@ -1827,7 +1825,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` int(11) DEFAULT yearweek(`a`,0) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('2000-01-01'); SELECT * FROM t1; a b @@ -1839,7 +1837,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` int(11) DEFAULT quarter(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('2008-04-01'); SELECT * FROM t1; a b @@ -1851,7 +1849,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` int(11) DEFAULT extract(year from `a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('2009-07-02'); SELECT * FROM t1; a b @@ -1863,7 +1861,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) DEFAULT extract(year_month from `a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('2009-07-02 01:02:03'); SELECT * FROM t1; a b @@ -1875,7 +1873,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) DEFAULT extract(day_minute from `a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('2009-07-02 01:02:03'); SELECT * FROM t1; a b @@ -1887,7 +1885,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime(6) DEFAULT NULL, `b` int(11) DEFAULT extract(microsecond from `a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('2009-07-02 01:02:03.000123'); SELECT * FROM t1; a b @@ -1900,7 +1898,7 @@ t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` date DEFAULT NULL, `c` int(11) DEFAULT timestampdiff(MONTH,`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES ('2003-02-01','2003-05-01'); SELECT * FROM t1; a b c @@ -1913,7 +1911,7 @@ t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` date DEFAULT NULL, `c` int(11) DEFAULT timestampdiff(YEAR,`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES ('2002-05-01','2001-01-01'); SELECT * FROM t1; a b c @@ -1926,7 +1924,7 @@ t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` datetime DEFAULT NULL, `c` int(11) DEFAULT timestampdiff(MINUTE,`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES ('2003-02-01','2003-05-01 12:05:55'); SELECT * FROM t1; a b c @@ -1937,7 +1935,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `col` int(11) DEFAULT (1 like (current_timestamp() between '2000-01-01' and '2012-12-12')) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET timestamp = UNIX_TIMESTAMP( '2004-04-04' ); INSERT INTO t1 VALUES( DEFAULT ); SET timestamp = DEFAULT; @@ -1957,7 +1955,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT coalesce(`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (NULL, 1, DEFAULT); SELECT * FROM t1; a b c @@ -1970,7 +1968,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT ifnull(`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (NULL, 2, DEFAULT); INSERT INTO t1 VALUES (1, 2, DEFAULT); SELECT * FROM t1; @@ -1985,7 +1983,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT nullif(`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1, 1, DEFAULT); INSERT INTO t1 VALUES (1, 2, DEFAULT); SELECT * FROM t1; @@ -2000,7 +1998,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT if(`a`,`b`,2) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (0, 1, DEFAULT); INSERT INTO t1 VALUES (1, 1, DEFAULT); SELECT * FROM t1; @@ -2015,7 +2013,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT (case when `a` then `b` else 2 end) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (0, 1, DEFAULT); INSERT INTO t1 VALUES (1, 1, DEFAULT); SELECT * FROM t1; @@ -2029,13 +2027,13 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT (-`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT (-`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (10, DEFAULT); SELECT * FROM t1; a b @@ -2047,7 +2045,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT abs(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (-10, DEFAULT); SELECT * FROM t1; a b @@ -2061,7 +2059,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT ceiling(`a`), `c` int(11) DEFAULT floor(`a`), `d` int(11) DEFAULT round(`a`,0) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1.5, DEFAULT, DEFAULT, DEFAULT); INSERT INTO t1 VALUES (-1.5, DEFAULT, DEFAULT, DEFAULT); SELECT * FROM t1; @@ -2077,7 +2075,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT (`a` + `b`), `d` int(11) DEFAULT (`a` - `b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (2, 1, DEFAULT, DEFAULT); SELECT * FROM t1; a b c d @@ -2092,7 +2090,7 @@ t1 CREATE TABLE `t1` ( `c` int(11) DEFAULT (`a` * `b`), `d` int(11) DEFAULT (`a` / `b`), `e` int(11) DEFAULT (`a` MOD `b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -2101,7 +2099,7 @@ t1 CREATE TABLE `t1` ( `c` int(11) DEFAULT (`a` * `b`), `d` int(11) DEFAULT (`a` / `b`), `e` int(11) DEFAULT (`a` MOD `b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (7, 3, DEFAULT, DEFAULT, DEFAULT); SELECT * FROM t1; a b c d e @@ -2114,7 +2112,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) DEFAULT unix_timestamp(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('2001-01-01 10:20:30', DEFAULT); SELECT * FROM t1; a b @@ -2127,7 +2125,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, `b` int(11) DEFAULT time_to_sec(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES ('22:23:00', DEFAULT); SELECT * FROM t1; a b @@ -2141,7 +2139,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT least(`a`,`b`), `d` int(11) DEFAULT greatest(`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (0, 1, DEFAULT, DEFAULT); INSERT INTO t1 VALUES (1, 1, DEFAULT, DEFAULT); SELECT * FROM t1; @@ -2156,7 +2154,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT last_value(`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1, 2, DEFAULT); SELECT * FROM t1; a b c @@ -2171,7 +2169,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, `b` decimal(10,6) DEFAULT (cast(`a` as decimal(10,1))) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('123.456'); SELECT * FROM t1; a b @@ -2186,7 +2184,7 @@ t1 CREATE TABLE `t1` ( `a` decimal(10,3) DEFAULT NULL, `b` varchar(10) DEFAULT (cast(`a` as char(10) charset latin1)), `c` varchar(10) DEFAULT (cast(`a` as char(4) charset latin1)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT IGNORE INTO t1 (a) VALUES (123.456); Warnings: Warning 1292 Truncated incorrect CHAR(4) value: '123.456' @@ -2200,7 +2198,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(10) unsigned DEFAULT (cast(`a` as unsigned)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT IGNORE INTO t1 (a) VALUES (-1); Warnings: Note 1105 Cast to unsigned converted negative integer to it's positive complement @@ -2215,7 +2213,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned DEFAULT NULL, `b` bigint(20) DEFAULT (cast(`a` as signed)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (0xFFFFFFFFFFFFFFFF); SELECT * FROM t1; a b @@ -2232,9 +2230,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT `a`, - `c` varchar(10) CHARACTER SET utf8mb3 DEFAULT convert(`a` using utf8mb3), + `c` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT convert(`a` using utf8mb3), `d` varbinary(10) DEFAULT (cast(`a` as char charset binary)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('a'); SELECT * FROM t1; a b c d @@ -2249,7 +2247,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT bit_count(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (7); SELECT * FROM t1; a b @@ -2262,7 +2260,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT (`a` | `b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES (1,2); SELECT * FROM t1; a b c @@ -2275,7 +2273,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT (`a` & `b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES (5,4); SELECT * FROM t1; a b c @@ -2288,7 +2286,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT (`a` ^ `b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES (11,3); SELECT * FROM t1; a b c @@ -2301,7 +2299,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT (`a` & ~`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES (5,1); SELECT * FROM t1; a b c @@ -2315,7 +2313,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT (`a` << `b`), `d` int(11) DEFAULT (`a` >> `b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES (5,1); SELECT * FROM t1; a b c d @@ -2330,7 +2328,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(20) DEFAULT reverse(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('abcd'); SELECT * FROM t1; a b @@ -2343,7 +2341,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT ucase(`a`), `c` varchar(10) DEFAULT lcase(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('ABcd'); SELECT * FROM t1; a b c @@ -2357,7 +2355,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(10) DEFAULT left(`a`,1), `c` varchar(10) DEFAULT right(`a`,1), `d` varchar(10) DEFAULT substr(`a`,2,2) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('abcd'); SELECT * FROM t1; a b c d @@ -2369,7 +2367,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(20) DEFAULT NULL, `b` varchar(20) DEFAULT substring_index(`a`,'.',2) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('www.mariadb.org'); SELECT * FROM t1; a b @@ -2382,7 +2380,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` varchar(20) DEFAULT concat(`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES ('a','b'); SELECT * FROM t1; a b c @@ -2395,7 +2393,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` varchar(20) DEFAULT concat_ws(',',`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES ('a','b'); SELECT * FROM t1; a b c @@ -2407,7 +2405,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT replace(`a`,'a','A') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('abc'); SELECT * FROM t1; a b @@ -2419,7 +2417,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT regexp_replace(`a`,'[0-9]','.') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('a1b2c'); SELECT * FROM t1; a b @@ -2431,7 +2429,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT regexp_substr(`a`,'[0-9]+') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('ab12cd'); SELECT * FROM t1; a b @@ -2443,7 +2441,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(20) DEFAULT NULL, `b` varchar(20) DEFAULT soundex(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('tester'); SELECT * FROM t1; a b @@ -2455,7 +2453,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(20) DEFAULT NULL, `b` varchar(20) DEFAULT quote(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('a\'b'); SELECT * FROM t1; a b @@ -2468,7 +2466,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT lpad(`a`,10,'.'), `c` varchar(10) DEFAULT rpad(`a`,10,'.') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('ab'); SELECT * FROM t1; a b c @@ -2481,7 +2479,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT ltrim(`a`), `c` varchar(10) DEFAULT rtrim(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (' ab '); SELECT a, HEX(b), HEX(c) FROM t1; a HEX(b) HEX(c) @@ -2493,7 +2491,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT trim(both 'a' from `a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('abba'); SELECT a, b FROM t1; a b @@ -2505,7 +2503,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(10) DEFAULT space(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (3); SELECT a, HEX(b) FROM t1; a HEX(b) @@ -2518,7 +2516,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` varchar(10) DEFAULT repeat(`b`,`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES (3,'x'); SELECT a, b, c FROM t1; a b c @@ -2533,7 +2531,7 @@ t1 CREATE TABLE `t1` ( `len` int(11) DEFAULT NULL, `newstr` varchar(10) DEFAULT NULL, `result` varchar(10) DEFAULT insert(`str`,`pos`,`len`,`newstr`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (str,pos,len,newstr) VALUES ('Quadratic', 3, 4, 'What'); SELECT * FROM t1; str pos len newstr result @@ -2545,7 +2543,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `n` int(11) DEFAULT NULL, `res` varchar(10) DEFAULT elt(`n`,'ej','Heja','hej','foo') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (n) VALUES (1); SELECT * FROM t1; n res @@ -2557,7 +2555,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `bits` int(11) DEFAULT NULL, `res` varchar(10) DEFAULT make_set(`bits`,'a','b','c','d') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (bits) VALUES (1|4); SELECT * FROM t1; bits res @@ -2569,7 +2567,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(10) DEFAULT char(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (77); SELECT * FROM t1; a b @@ -2581,7 +2579,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(10) DEFAULT conv(`a`,10,16) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (64); SELECT * FROM t1; a b @@ -2594,7 +2592,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` varchar(30) DEFAULT format(`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES (10000,3); SELECT * FROM t1; a b c @@ -2608,7 +2606,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `l` varchar(10) DEFAULT NULL, `c` varchar(30) DEFAULT format(`a`,`b`,`l`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b,l) VALUES (10000,2,'no_NO'),(10000,2,'ru_RU'),(10000,2,'ar_BH'); SELECT * FROM t1; a b l c @@ -2622,7 +2620,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(20) DEFAULT get_format(DATE, `a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('EUR'),('USA'),('JIS'),('ISO'),('INTERNAL'); SELECT * FROM t1; a b @@ -2649,7 +2647,7 @@ t1 CREATE TABLE `t1` ( `v_separator` varchar(10) DEFAULT NULL, `number_of_bits` int(11) DEFAULT NULL, `x` varchar(30) DEFAULT export_set(`bits`,`v_on`,`v_off`,`v_separator`,`number_of_bits`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT IGNORE INTO t1 VALUES (0x50006,'Y','N','',64,DEFAULT); Warnings: Warning 1265 Data truncated for column 'x' at row 1 @@ -2668,7 +2666,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT (`a` = 0) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (NULL),(0),(1); SELECT * FROM t1; a b @@ -2683,7 +2681,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `x` int(11) DEFAULT (`a` xor `b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES (0,0),(0,1),(1,0),(1,1); SELECT * FROM t1; a b x @@ -2699,7 +2697,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT (`a` is true), `c` int(11) DEFAULT (`a` is not true) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (NULL),(0),(1); SELECT * FROM t1; a b c @@ -2714,7 +2712,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT (`a` is false), `c` int(11) DEFAULT (`a` is not false) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (NULL),(0),(1); SELECT * FROM t1; a b c @@ -2729,7 +2727,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT (`a` is null), `c` int(11) DEFAULT (`a` is not null) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (NULL),(0),(1); SELECT * FROM t1; a b c @@ -2744,7 +2742,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT (`a` is null), `c` int(11) DEFAULT (`a` is not null) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (NULL),(0),(1); SELECT * FROM t1; a b c @@ -2768,7 +2766,7 @@ t1 CREATE TABLE `t1` ( `le` int(11) DEFAULT (`a` <= 0), `gt` int(11) DEFAULT (`a` > 0), `ge` int(11) DEFAULT (`a` >= 0) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (NULL),(-1),(0),(1); SELECT * FROM t1; a eq equal ne lt le gt ge @@ -2783,7 +2781,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) DEFAULT (`a` like 'a%') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'); SELECT * FROM t1; a b @@ -2797,7 +2795,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) DEFAULT (`a` regexp 'a$') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'); SELECT * FROM t1; a b @@ -2811,7 +2809,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) DEFAULT (`a` in ('aaa','bbb')) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc'); SELECT * FROM t1; a b @@ -2826,7 +2824,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) DEFAULT (`a` not in ('aaa','bbb')) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc'); SELECT * FROM t1; a b @@ -2841,7 +2839,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) DEFAULT (`a` between 'aaa' and 'bbb') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc'); SELECT * FROM t1; a b @@ -2856,7 +2854,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) DEFAULT (`a` not between 'aaa' and 'bbb') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc'); SELECT * FROM t1; a b @@ -2870,7 +2868,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text DEFAULT uuid() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (); SELECT LENGTH(a)>0 FROM t1; LENGTH(a)>0 @@ -2885,7 +2883,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) DEFAULT strcmp(`a`,'b') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('A'),('a'),('B'),('b'),('C'),('c'); SELECT * FROM t1; a b @@ -2904,7 +2902,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT octet_length(`a`), `c` int(11) DEFAULT char_length(`a`), `d` int(11) DEFAULT bit_length(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('a'),('aa'),('aaa'); SELECT * FROM t1; a b c d @@ -2918,7 +2916,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) DEFAULT locate('a',`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('xa'),('xxa'),('xxxa'); SELECT * FROM t1; a b @@ -2932,7 +2930,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) DEFAULT regexp_instr(`a`,'a') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('xa'),('xxa'),('xxxa'); SELECT * FROM t1; a b @@ -2954,7 +2952,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT connection_id() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES(); SELECT a>0 FROM t1; a>0 @@ -2967,7 +2965,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) DEFAULT coercibility(`a`), `c` int(11) DEFAULT coercibility(`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('test'); SELECT * FROM t1; a b c @@ -2987,7 +2985,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(20) DEFAULT charset(`a`), `c` varchar(20) DEFAULT collation(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('test'); SELECT * FROM t1; a b c @@ -3003,7 +3001,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` bigint(20) DEFAULT crc32(`a`), `c` text DEFAULT md5(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('a'); SELECT * FROM t1; a b c @@ -3016,7 +3014,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` text DEFAULT to_base64(`a`), `c` text DEFAULT from_base64(`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('aaaabbbb'); SELECT * FROM t1; a b c @@ -3029,7 +3027,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` text DEFAULT hex(`a`), `c` text DEFAULT unhex(`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('aaaabbbb'); SELECT * FROM t1; a b c @@ -3042,7 +3040,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` text DEFAULT encode(`a`,'test'), `c` text DEFAULT decode(`b`,'test') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('aaaabbbb'); SELECT a, HEX(b), c FROM t1; a HEX(b) c @@ -3054,7 +3052,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, `b` text DEFAULT password(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('notagoodpwd'); SELECT * FROM t1; a b @@ -3071,7 +3069,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, `b` blob DEFAULT aes_encrypt(`a`,'passwd'), `c` text DEFAULT aes_decrypt(`b`,'passwd') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('test'); SELECT c FROM t1; c @@ -3087,7 +3085,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT concat('A') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; create table t1 (a int default 1, b int default (rand()*0+2), c int); insert t1 (c) values (a); @@ -3104,7 +3102,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT 1, `b` int(11) DEFAULT (1 + 1), `c` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 alter a set default (2+3), alter b set default 4, alter c set default (-a); alter table t1 alter a set default 1+2; @@ -3115,7 +3113,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT (2 + 3), `b` int(11) DEFAULT 4, `c` int(11) DEFAULT (-`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int default 5 check (a>10), b int default (5+5), c int as (a+b)); create table t2 as select a, b, c from t1; @@ -3126,16 +3124,18 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT 5 CHECK (`a` > 10), `b` int(11) DEFAULT (5 + 5), `c` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `max(a)` int(11) DEFAULT NULL, `max(b)` int(11) DEFAULT NULL, `max(c)` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2, t3; +# # MDEV-11359: Implement IGNORE for bulk operation +# create table t1 (a int primary key default 0, b int default 3); insert into t1 values (1, ignore); insert into t1 values (2, ignore); @@ -3296,7 +3296,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` char(8) DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET @a='A'; EXECUTE stmt USING @a; @@ -3305,7 +3305,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` char(8) DEFAULT 'A' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET @a=_utf8 0xC380; EXECUTE stmt USING @a; @@ -3314,7 +3314,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` char(8) DEFAULT 'À' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET @a=_utf8 0xD18F; EXECUTE stmt USING @a; @@ -3329,7 +3329,7 @@ Table Create Table t1 CREATE TABLE "t1" ( "a" int(11) DEFAULT NULL, "b" int(11) DEFAULT ("a" + 1) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert t1 (a) values (10); set sql_mode=''; show create table t1; @@ -3337,7 +3337,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT (`a` + 1) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert t1 (a) values (20); flush tables; show create table t1; @@ -3345,7 +3345,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT (`a` + 1) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert t1 (a) values (30); select * from t1; a b @@ -3354,6 +3354,9 @@ a b 30 31 drop table t1; set sql_mode=default; +# +# MDEV-10201 Bad results for CREATE TABLE t1 (a INT DEFAULT b, b INT DEFAULT 4) +# create table t1 (a int default b, b int default 4, t text); insert t1 (b, t) values (5, '1 column is omitted'); insert t1 values (default, 5, '2 column gets DEFAULT, keyword'); @@ -3376,8 +3379,14 @@ a b t 5 5 8 reversed, also expression DEFAULT(0)+0 5 5 9 reversed, the value of the DEFAULT(a), that is b drop table t1; +# +# MDEV-10352 Server crashes in Field::set_default on CREATE TABLE +# create table t1 (col1 int default(-(default(col1)))); ERROR 01000: Expression for field `col1` is referring to uninitialized field `col1` +# +# MDEV-10354 Assertion `! is_set()' failed in Diagnostics_area::set_ok_status on CREATE TABLE with invalid default +# create table t1 (col int default (yearweek((exp(710))))); ERROR 22003: DOUBLE value is out of range in 'exp(710)' # @@ -3395,7 +3404,37 @@ ERROR 01000: Expression for field `a` is referring to uninitialized field `a` show warnings; Level Code Message Error 4029 Expression for field `a` is referring to uninitialized field `a` -# end of 10.2 test +# +# MDEV-26423: MariaDB server crash in Create_tmp_table::finalize +# +CREATE TABLE t1 (pk varchar(36) DEFAULT uuid()); +INSERT INTO t1 VALUES (),(); +SELECT 1 FROM t1 GROUP BY DEFAULT(pk); +1 +1 +1 +DROP TABLE t1; +# +# MDEV-28402: ASAN heap-use-after-free in create_tmp_table, +# Assertion `l_offset >= 0 && table->s->rec_buff_length - l_offset > 0' +# +CREATE TABLE t (a INT, KEY (a)); +INSERT INTO t VALUES (1),(2); +SELECT DISTINCT DEFAULT(a), CASE a WHEN 0 THEN 1 ELSE 2 END FROM t GROUP BY a WITH ROLLUP; +DEFAULT(a) CASE a WHEN 0 THEN 1 ELSE 2 END +NULL 2 +DROP TABLE t; +CREATE TABLE t (a INT, KEY (a)); +INSERT INTO t VALUES (1),(2); +CREATE ALGORITHM=TEMPTABLE VIEW v AS SELECT * FROM t; +SELECT DISTINCT DEFAULT(a), CASE a WHEN 0 THEN 1 ELSE 2 END FROM v GROUP BY a WITH ROLLUP; +DEFAULT(a) CASE a WHEN 0 THEN 1 ELSE 2 END +NULL 2 +DROP TABLE t; +DROP VIEW v; +# +# End of 10.2 test +# # # MDEV-22703 DEFAULT() on a BLOB column can overwrite the default # record, which can cause crashes when accessing already released @@ -3411,4 +3450,39 @@ length(DEFAULT(h)) 25 INSERT INTO t1 () VALUES (); drop table t1; -# end of 10.3 test +# +# End of 10.3 test +# +# +# MDEV-26423: MariaDB server crash in Create_tmp_table::finalize +# +CREATE TABLE t1 (pk text DEFAULT length(uuid())); +INSERT INTO t1 VALUES (),(); +SELECT 1 FROM t1 GROUP BY DEFAULT(pk); +1 +1 +DROP TABLE t1; +# +# MDEV-29890 Update with inner join false row count result +# +create table t1 (a int not null); +select column_name, column_default, column_default is not null as 'has_default', is_nullable from information_schema.columns where table_schema='test' and table_name='t1'; +column_name column_default has_default is_nullable +a NULL 0 NO +create or replace view v1 as select * from t1; +select column_name, column_default, column_default is not null as 'has_default', is_nullable from information_schema.columns where table_schema='test' and table_name='v1'; +column_name column_default has_default is_nullable +a NULL 0 NO +create or replace view v1 as select * from t1 group by a; +select column_name, column_default, column_default is not null as 'has_default', is_nullable from information_schema.columns where table_schema='test' and table_name='v1'; +column_name column_default has_default is_nullable +a NULL 0 NO +create or replace view v1 as select * from t1 group by a with rollup; +select column_name, column_default, column_default is not null as 'has_default', is_nullable from information_schema.columns where table_schema='test' and table_name='v1'; +column_name column_default has_default is_nullable +a NULL 1 YES +drop view v1; +drop table t1; +# +# End of 10.4 test +# diff --git a/mysql-test/main/default.test b/mysql-test/main/default.test index bcd6ef7a9fb5b..13f611246c9aa 100644 --- a/mysql-test/main/default.test +++ b/mysql-test/main/default.test @@ -1,16 +1,10 @@ --source include/have_innodb.inc -# -# test of already fixed bugs -# ---disable_warnings -drop table if exists t1,t2,t3,t4,t5,t6; -drop database if exists mysqltest; - # # Bug 10838 # Insert causes warnings for no default values and corrupts tables # +--disable_warnings set sql_mode=""; CREATE TABLE t1 (a varchar(30) binary NOT NULL DEFAULT ' ', b varchar(1) binary NOT NULL DEFAULT ' ', @@ -1891,7 +1885,9 @@ show create table t2; show create table t3; drop table t1, t2, t3; +--echo # --echo # MDEV-11359: Implement IGNORE for bulk operation +--echo # create table t1 (a int primary key default 0, b int default 3); insert into t1 values (1, ignore); insert into t1 values (2, ignore); @@ -2071,9 +2067,9 @@ select * from t1; drop table t1; set sql_mode=default; -# -# MDEV-10201 Bad results for CREATE TABLE t1 (a INT DEFAULT b, b INT DEFAULT 4) -# +--echo # +--echo # MDEV-10201 Bad results for CREATE TABLE t1 (a INT DEFAULT b, b INT DEFAULT 4) +--echo # create table t1 (a int default b, b int default 4, t text); insert t1 (b, t) values (5, '1 column is omitted'); insert t1 values (default, 5, '2 column gets DEFAULT, keyword'); @@ -2088,15 +2084,15 @@ insert t1 (t,b,a) values ('9 reversed, the value of the DEFAULT(a), that is b', select * from t1 order by t; drop table t1; -# -# MDEV-10352 Server crashes in Field::set_default on CREATE TABLE -# +--echo # +--echo # MDEV-10352 Server crashes in Field::set_default on CREATE TABLE +--echo # --error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD create table t1 (col1 int default(-(default(col1)))); -# -# MDEV-10354 Assertion `! is_set()' failed in Diagnostics_area::set_ok_status on CREATE TABLE with invalid default -# +--echo # +--echo # MDEV-10354 Assertion `! is_set()' failed in Diagnostics_area::set_ok_status on CREATE TABLE with invalid default +--echo # --error ER_DATA_OUT_OF_RANGE create table t1 (col int default (yearweek((exp(710))))); @@ -2116,7 +2112,34 @@ DROP TABLE t1; create table t1 (a int as (a)); show warnings; ---echo # end of 10.2 test + +--echo # +--echo # MDEV-26423: MariaDB server crash in Create_tmp_table::finalize +--echo # + +CREATE TABLE t1 (pk varchar(36) DEFAULT uuid()); +INSERT INTO t1 VALUES (),(); +SELECT 1 FROM t1 GROUP BY DEFAULT(pk); +DROP TABLE t1; + +--echo # +--echo # MDEV-28402: ASAN heap-use-after-free in create_tmp_table, +--echo # Assertion `l_offset >= 0 && table->s->rec_buff_length - l_offset > 0' +--echo # +CREATE TABLE t (a INT, KEY (a)); +INSERT INTO t VALUES (1),(2); +SELECT DISTINCT DEFAULT(a), CASE a WHEN 0 THEN 1 ELSE 2 END FROM t GROUP BY a WITH ROLLUP; +DROP TABLE t; + +CREATE TABLE t (a INT, KEY (a)); +INSERT INTO t VALUES (1),(2); +CREATE ALGORITHM=TEMPTABLE VIEW v AS SELECT * FROM t; +SELECT DISTINCT DEFAULT(a), CASE a WHEN 0 THEN 1 ELSE 2 END FROM v GROUP BY a WITH ROLLUP; +DROP TABLE t; +DROP VIEW v; +--echo # +--echo # End of 10.2 test +--echo # --echo # --echo # MDEV-22703 DEFAULT() on a BLOB column can overwrite the default @@ -2134,4 +2157,32 @@ SELECT length(DEFAULT(h)) FROM t1; INSERT INTO t1 () VALUES (); drop table t1; ---echo # end of 10.3 test +--echo # +--echo # End of 10.3 test +--echo # + +--echo # +--echo # MDEV-26423: MariaDB server crash in Create_tmp_table::finalize +--echo # +CREATE TABLE t1 (pk text DEFAULT length(uuid())); +INSERT INTO t1 VALUES (),(); +SELECT 1 FROM t1 GROUP BY DEFAULT(pk); +DROP TABLE t1; + +--echo # +--echo # MDEV-29890 Update with inner join false row count result +--echo # +create table t1 (a int not null); +select column_name, column_default, column_default is not null as 'has_default', is_nullable from information_schema.columns where table_schema='test' and table_name='t1'; +create or replace view v1 as select * from t1; +select column_name, column_default, column_default is not null as 'has_default', is_nullable from information_schema.columns where table_schema='test' and table_name='v1'; +create or replace view v1 as select * from t1 group by a; +select column_name, column_default, column_default is not null as 'has_default', is_nullable from information_schema.columns where table_schema='test' and table_name='v1'; +create or replace view v1 as select * from t1 group by a with rollup; +select column_name, column_default, column_default is not null as 'has_default', is_nullable from information_schema.columns where table_schema='test' and table_name='v1'; +drop view v1; +drop table t1; + +--echo # +--echo # End of 10.4 test +--echo # diff --git a/mysql-test/main/default_innodb.result b/mysql-test/main/default_innodb.result new file mode 100644 index 0000000000000..81e9672df244c --- /dev/null +++ b/mysql-test/main/default_innodb.result @@ -0,0 +1,18 @@ +# +# MDEV-26423: MariaDB server crash in Create_tmp_table::finalize +# +CREATE TABLE v0 ( +v2 DATE DEFAULT ( v1 MOD 68321183.000000 ) , +v1 DATETIME NULL ) engine=innodb; +SHOW DATABASES LIKE 'x'; +Database (x) +SELECT DISTINCT v2 , v1 , DEFAULT ( v2 ) FROM v0; +v2 v1 DEFAULT ( v2 ) +DROP TABLE v0; +CREATE TABLE t1 (v1 DATE, v2 DATE DEFAULT(v1)) engine=innodb; +SELECT DISTINCT DEFAULT(v2) FROM t1 ; +DEFAULT(v2) +DROP TABLE t1; +# +# End of 10.2 tests +# diff --git a/mysql-test/main/default_innodb.test b/mysql-test/main/default_innodb.test new file mode 100644 index 0000000000000..2fc7495084524 --- /dev/null +++ b/mysql-test/main/default_innodb.test @@ -0,0 +1,22 @@ + +--source include/have_innodb.inc + +--echo # +--echo # MDEV-26423: MariaDB server crash in Create_tmp_table::finalize +--echo # + +CREATE TABLE v0 ( + v2 DATE DEFAULT ( v1 MOD 68321183.000000 ) , + v1 DATETIME NULL ) engine=innodb; +SHOW DATABASES LIKE 'x'; +SELECT DISTINCT v2 , v1 , DEFAULT ( v2 ) FROM v0; +DROP TABLE v0; + +CREATE TABLE t1 (v1 DATE, v2 DATE DEFAULT(v1)) engine=innodb; +SELECT DISTINCT DEFAULT(v2) FROM t1 ; +DROP TABLE t1; + + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/main/delayed.result b/mysql-test/main/delayed.result index 55f5ff6eb284a..4b482c8bb667e 100644 --- a/mysql-test/main/delayed.result +++ b/mysql-test/main/delayed.result @@ -510,3 +510,12 @@ a b 2 2 3 3 drop table t1; +# +# MDEV-26546 SIGSEGV's in spider_db_connect on SHOW TABLE and +# spider_db_mbase::connect (and SIGSEGV's in check_vcol_forward_refs +# and inline_mysql_mutex_lock) +# +CREATE TABLE t1 (c0 INT,UNIQUE (c0) USING HASH) ENGINE=MYISAM; +INSERT DELAYED INTO t1 VALUES (0); +INSERT DELAYED INTO t1 VALUES (0); +DROP TABLE t1; diff --git a/mysql-test/main/delayed.test b/mysql-test/main/delayed.test index 862d30fe79f73..a99af07232cbb 100644 --- a/mysql-test/main/delayed.test +++ b/mysql-test/main/delayed.test @@ -309,6 +309,7 @@ DROP TABLE t1,t2; # Bug#40536: SELECT is blocked by INSERT DELAYED waiting on upgrading lock, # even with low_priority_updates # +--disable_service_connection set @old_delayed_updates = @@global.low_priority_updates; set global low_priority_updates = 1; @@ -344,7 +345,7 @@ select * from t1; drop table t1; set global low_priority_updates = @old_delayed_updates; - +--enable_service_connection --echo # --echo # Bug #47682 strange behaviour of INSERT DELAYED @@ -414,6 +415,7 @@ DROP TABLE t1; --echo # This test is not supposed to work under --ps-protocol since --echo # INSERT DELAYED doesn't work under LOCK TABLES with this protocol. --disable_ps_protocol +--disable_view_protocol --disable_warnings DROP TABLE IF EXISTS t1, t2; @@ -563,11 +565,12 @@ disconnect con1; connection default; DROP TABLE t1, t2, t3; --enable_ps_protocol - +--enable_view_protocol --echo # --echo # Test for bug #56251 "Deadlock with INSERT DELAYED and MERGE tables". --echo # +--disable_view_protocol connect (con1,localhost,root,,); connection default; --disable_warnings @@ -608,6 +611,7 @@ disconnect con1; --source include/wait_until_disconnected.inc connection default; drop tables tm, t1, t2; +--enable_view_protocol --echo # --echo # MDEV-9621 INSERT DELAYED fails on insert for tables with many columns @@ -644,3 +648,15 @@ insert delayed into t1 values (3,3); flush tables t1; select * from t1; drop table t1; + +--echo # +--echo # MDEV-26546 SIGSEGV's in spider_db_connect on SHOW TABLE and +--echo # spider_db_mbase::connect (and SIGSEGV's in check_vcol_forward_refs +--echo # and inline_mysql_mutex_lock) +--echo # + +CREATE TABLE t1 (c0 INT,UNIQUE (c0) USING HASH) ENGINE=MYISAM; +INSERT DELAYED INTO t1 VALUES (0); +INSERT DELAYED INTO t1 VALUES (0); +DROP TABLE t1; + diff --git a/mysql-test/main/delete.result b/mysql-test/main/delete.result index ed3683d52f986..7a9963abc717e 100644 --- a/mysql-test/main/delete.result +++ b/mysql-test/main/delete.result @@ -525,3 +525,35 @@ DELETE v2 FROM v2; ERROR HY000: Can not delete from join view 'test.v2' DROP VIEW v2, v1; DROP TABLE t1, t2; +End of 5.5 tests +# +# MDEV-30586: DELETE with WHERE containing nested subquery +# with set function aggregated in outer subquery +# +create table t1 (a int); +insert into t1 values (3), (7), (1); +create table t2 (b int); +insert into t2 values (2), (1), (4), (7); +create table t3 (a int, b int); +insert into t3 values (2,10), (7,30), (2,30), (1,10), (7,40); +select * from t1 +where t1.a in (select t3.a from t3 group by t3.a +having t3.a > any (select t2.b from t2 +where t2.b*10 < sum(t3.b))); +a +7 +delete from t1 +where t1.a in (select t3.a from t3 group by t3.a +having t3.a > any (select t2.b from t2 +where t2.b*10 < sum(t3.b))); +select * from t1 +where t1.a in (select t3.a from t3 group by t3.a +having t3.a > any (select t2.b from t2 +where t2.b*10 < sum(t3.b))); +a +update t1 set t1.a=t1.a+10 +where t1.a in (select t3.a from t3 group by t3.a +having t3.a > any (select t2.b from t2 +where t2.b*10 < sum(t3.b))); +drop table t1,t2,t3; +End of 10.4 tests diff --git a/mysql-test/main/delete.test b/mysql-test/main/delete.test index c82420640c231..6d898ec769d2a 100644 --- a/mysql-test/main/delete.test +++ b/mysql-test/main/delete.test @@ -582,3 +582,44 @@ DELETE v2 FROM v2; DROP VIEW v2, v1; DROP TABLE t1, t2; + +--echo End of 5.5 tests + +--echo # +--echo # MDEV-30586: DELETE with WHERE containing nested subquery +--echo # with set function aggregated in outer subquery +--echo # + +create table t1 (a int); +insert into t1 values (3), (7), (1); + +create table t2 (b int); +insert into t2 values (2), (1), (4), (7); + +create table t3 (a int, b int); +insert into t3 values (2,10), (7,30), (2,30), (1,10), (7,40); + +let $c= + t1.a in (select t3.a from t3 group by t3.a + having t3.a > any (select t2.b from t2 + where t2.b*10 < sum(t3.b))); + +eval +select * from t1 + where $c; + +eval +delete from t1 + where $c; + +eval +select * from t1 + where $c; + +eval +update t1 set t1.a=t1.a+10 + where $c; + +drop table t1,t2,t3; + +--echo End of 10.4 tests diff --git a/mysql-test/main/derived.result b/mysql-test/main/derived.result index 006f41236f54e..cda21e275ae4d 100644 --- a/mysql-test/main/derived.result +++ b/mysql-test/main/derived.result @@ -1207,6 +1207,59 @@ REPLACE INTO v2 ( SELECT * FROM v4 ) UNION ( SELECT f FROM v2 ); drop view v1,v2,v3,v4; drop table t1,t2,t3; # +# MDEV-20325: Assertion `outer_context || !*from_field || *from_field == not_found_field' failed in Item_field::fix_outer_field | `!derived->is_excluded()' failed in TABLE_LIST::set_check_materialized | SIGEGV in st_select_lex::mark_as_dependent (optimized builds) +# +CREATE TABLE t1 (a INT); +# Check that re-execution of a stored routine containing +# a query with subquery in the FROM clause doesn't result in +# assert failure in case the 'derived_merge' optimizer option +# has been turned on/off +CREATE PROCEDURE sp() SELECT * FROM (SELECT a FROM t1) tb; +CALL sp(); +a +SET optimizer_switch='derived_merge=off'; +# Without the patch the following statement would result in assert +# failure +CALL sp(); +a +# Check the same test case for Prepared Statement +SET optimizer_switch='derived_merge=on'; +PREPARE stmt FROM "SELECT * FROM (SELECT a FROM t1) tb"; +EXECUTE stmt; +a +SET optimizer_switch='derived_merge=off'; +# Without the patch the following statement would result in assert +# failure +EXECUTE stmt; +a +DEALLOCATE PREPARE stmt; +# Here check the reverse test case - first turn off the 'derived_merge' +# optimizer option, run the stored routine containing a query with +# subquery in the FROM clause, then turn on the 'derived_merge' +# optimizer option and re-execute the same stored routine to check that +# the routine is finished successfully. +CREATE PROCEDURE sp1() SELECT * FROM (SELECT a FROM t1) tb; +SET optimizer_switch='derived_merge=off'; +CALL sp1(); +a +SET optimizer_switch='derived_merge=on'; +CALL sp1(); +a +# Check the same test case for Prepared Statement +SET optimizer_switch='derived_merge=off'; +PREPARE stmt FROM "SELECT * FROM (SELECT a FROM t1) tb"; +EXECUTE stmt; +a +SET optimizer_switch='derived_merge=on'; +# Without the patch the following statement would result in assert +# failure +EXECUTE stmt; +a +DEALLOCATE PREPARE stmt; +DROP PROCEDURE sp; +DROP PROCEDURE sp1; +DROP TABLE t1; +# # End of 10.2 tests # # @@ -1263,3 +1316,42 @@ a a 4 4 6 6 drop table t1,t2,t3; +# +# MDEV-16549: Server crashes in Item_field::fix_fields on query with +# view and subquery, Assertion `context' failed, Assertion `field' failed +# +CREATE TABLE t1 (a DECIMAL, b INT); +INSERT INTO t1 VALUES (1,1),(2,2); +CREATE VIEW v1 AS SELECT * FROM ( SELECT * FROM t1 WHERE a <> RAND() ) sq; +SELECT * FROM v1 WHERE b > 0; +a b +1 1 +2 2 +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-28616: derived table over union with order by clause that +# contains subquery with unresolvable column reference +# +SELECT 1 FROM ( +SELECT 1 UNION SELECT 2 ORDER BY (SELECT 1 FROM DUAL WHERE xxx = 0) +) dt; +ERROR 42S22: Unknown column 'xxx' in 'where clause' +create table t1 (a int, b int); +insert into t1 values (3,8), (7,2), (1,4), (5,9); +create table t2 (a int, b int); +insert into t2 values (9,1), (7,3), (2,6); +create table t3 (c int, d int); +insert into t3 values (7,8), (1,2), (3,8); +select * from +( +select a,b from t1 where t1.a > 3 +union +select a,b from t2 where t2.b < 6 +order by (a - b / (select a + max(c) from t3 where d = x)) +) dt; +ERROR 42S22: Unknown column 'x' in 'where clause' +drop table t1,t2,t3; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/derived.test b/mysql-test/main/derived.test index 0d2efca1a2685..f78266b95b0ae 100644 --- a/mysql-test/main/derived.test +++ b/mysql-test/main/derived.test @@ -1042,6 +1042,57 @@ REPLACE INTO v2 ( SELECT * FROM v4 ) UNION ( SELECT f FROM v2 ); drop view v1,v2,v3,v4; drop table t1,t2,t3; +--echo # +--echo # MDEV-20325: Assertion `outer_context || !*from_field || *from_field == not_found_field' failed in Item_field::fix_outer_field | `!derived->is_excluded()' failed in TABLE_LIST::set_check_materialized | SIGEGV in st_select_lex::mark_as_dependent (optimized builds) +--echo # +CREATE TABLE t1 (a INT); + +--echo # Check that re-execution of a stored routine containing +--echo # a query with subquery in the FROM clause doesn't result in +--echo # assert failure in case the 'derived_merge' optimizer option +--echo # has been turned on/off +CREATE PROCEDURE sp() SELECT * FROM (SELECT a FROM t1) tb; +CALL sp(); +SET optimizer_switch='derived_merge=off'; +--echo # Without the patch the following statement would result in assert +--echo # failure +CALL sp(); + +--echo # Check the same test case for Prepared Statement +SET optimizer_switch='derived_merge=on'; +PREPARE stmt FROM "SELECT * FROM (SELECT a FROM t1) tb"; +EXECUTE stmt; +SET optimizer_switch='derived_merge=off'; +--echo # Without the patch the following statement would result in assert +--echo # failure +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +--echo # Here check the reverse test case - first turn off the 'derived_merge' +--echo # optimizer option, run the stored routine containing a query with +--echo # subquery in the FROM clause, then turn on the 'derived_merge' +--echo # optimizer option and re-execute the same stored routine to check that +--echo # the routine is finished successfully. +CREATE PROCEDURE sp1() SELECT * FROM (SELECT a FROM t1) tb; +SET optimizer_switch='derived_merge=off'; +CALL sp1(); +SET optimizer_switch='derived_merge=on'; +CALL sp1(); + +--echo # Check the same test case for Prepared Statement +SET optimizer_switch='derived_merge=off'; +PREPARE stmt FROM "SELECT * FROM (SELECT a FROM t1) tb"; +EXECUTE stmt; +SET optimizer_switch='derived_merge=on'; +--echo # Without the patch the following statement would result in assert +--echo # failure +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +DROP PROCEDURE sp; +DROP PROCEDURE sp1; +DROP TABLE t1; + --echo # --echo # End of 10.2 tests --echo # @@ -1075,3 +1126,53 @@ analyze select * from t1 , ( (select t2.a from t2 order by c) union all (select select * from t1 , ( (select t2.a from t2 order by c) union all (select t2.a from t2 order by c) except(select t3.a from t3 order by b))q where t1.a=q.a; drop table t1,t2,t3; + + +--echo # +--echo # MDEV-16549: Server crashes in Item_field::fix_fields on query with +--echo # view and subquery, Assertion `context' failed, Assertion `field' failed +--echo # + +CREATE TABLE t1 (a DECIMAL, b INT); +INSERT INTO t1 VALUES (1,1),(2,2); # optional +CREATE VIEW v1 AS SELECT * FROM ( SELECT * FROM t1 WHERE a <> RAND() ) sq; + +SELECT * FROM v1 WHERE b > 0; + +# Cleanup +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-28616: derived table over union with order by clause that +--echo # contains subquery with unresolvable column reference +--echo # + +--error ER_BAD_FIELD_ERROR +SELECT 1 FROM ( + SELECT 1 UNION SELECT 2 ORDER BY (SELECT 1 FROM DUAL WHERE xxx = 0) +) dt; + +create table t1 (a int, b int); +insert into t1 values (3,8), (7,2), (1,4), (5,9); + +create table t2 (a int, b int); +insert into t2 values (9,1), (7,3), (2,6); + +create table t3 (c int, d int); +insert into t3 values (7,8), (1,2), (3,8); + +--error ER_BAD_FIELD_ERROR +select * from +( + select a,b from t1 where t1.a > 3 + union + select a,b from t2 where t2.b < 6 + order by (a - b / (select a + max(c) from t3 where d = x)) +) dt; + +drop table t1,t2,t3; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result index 88c82e25b7f6f..33afb47e4ddf3 100644 --- a/mysql-test/main/derived_cond_pushdown.result +++ b/mysql-test/main/derived_cond_pushdown.result @@ -3960,10 +3960,10 @@ 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 6 20 214 6 20 315 279 6 20 315 279.3333 6 20 315 279.3333 8 33 114 8 80 800 314 6 20 315 279.3333 6 20 315 279.3333 6 20 214 6 23 303 909 -6 20 315 279.3333 8 33 404 213.6667 6 20 214 6 20 315 279 -6 20 315 279.3333 8 33 404 213.6667 6 20 214 6 23 303 909 8 33 404 213.6667 6 20 315 279.3333 8 33 114 8 64 248 107 8 33 404 213.6667 6 20 315 279.3333 8 33 114 8 80 800 314 +6 20 315 279.3333 8 33 404 213.6667 6 20 214 6 20 315 279 +6 20 315 279.3333 8 33 404 213.6667 6 20 214 6 23 303 909 8 33 404 213.6667 8 33 404 213.6667 7 11 708 7 13 312 406 8 33 404 213.6667 8 33 404 213.6667 8 33 114 8 64 248 107 8 33 404 213.6667 8 33 404 213.6667 6 20 214 6 20 315 279 @@ -3978,10 +3978,10 @@ 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 6 20 214 6 20 315 279 6 20 315 279.3333 6 20 315 279.3333 8 33 114 8 80 800 314 6 20 315 279.3333 6 20 315 279.3333 6 20 214 6 23 303 909 -6 20 315 279.3333 8 33 404 213.6667 6 20 214 6 20 315 279 -6 20 315 279.3333 8 33 404 213.6667 6 20 214 6 23 303 909 8 33 404 213.6667 6 20 315 279.3333 8 33 114 8 64 248 107 8 33 404 213.6667 6 20 315 279.3333 8 33 114 8 80 800 314 +6 20 315 279.3333 8 33 404 213.6667 6 20 214 6 20 315 279 +6 20 315 279.3333 8 33 404 213.6667 6 20 214 6 23 303 909 8 33 404 213.6667 8 33 404 213.6667 7 11 708 7 13 312 406 8 33 404 213.6667 8 33 404 213.6667 8 33 114 8 64 248 107 8 33 404 213.6667 8 33 404 213.6667 6 20 214 6 20 315 279 @@ -3993,8 +3993,8 @@ 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 1 PRIMARY ref key0 key0 5 test.t2.a 2 Using where -1 PRIMARY ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -1 PRIMARY ALL NULL NULL NULL NULL 20 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY ALL NULL NULL NULL NULL 20 Using where; Using join buffer (incremental, BNL join) 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 @@ -4054,19 +4054,19 @@ EXPLAIN { "block-nl-join": { "table": { - "table_name": "", + "table_name": "", "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "v2.max_c > 300" + "attached_condition": "v1.max_c < 500" }, "buffer_type": "flat", "buffer_size": "715", "join_type": "BNL", "materialized": { "query_block": { - "select_id": 3, - "having_condition": "max_c < 707 and max_c > 300", + "select_id": 2, + "having_condition": "max_c < 707 and max_c < 500", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -4076,8 +4076,7 @@ EXPLAIN "table_name": "t1", "access_type": "ALL", "rows": 20, - "filtered": 100, - "attached_condition": "t1.a > 5" + "filtered": 100 } } ] @@ -4090,20 +4089,20 @@ EXPLAIN { "block-nl-join": { "table": { - "table_name": "", + "table_name": "", "access_type": "ALL", "rows": 20, "filtered": 100, - "attached_condition": "v1.max_c < 500" + "attached_condition": "v2.max_c > 300" }, "buffer_type": "incremental", "buffer_size": "9Kb", "join_type": "BNL", - "attached_condition": "v1.a = v2.a or v1.a = t2.a", + "attached_condition": "v2.a = v1.a or v1.a = t2.a", "materialized": { "query_block": { - "select_id": 2, - "having_condition": "max_c < 707 and max_c < 500", + "select_id": 3, + "having_condition": "max_c < 707 and max_c > 300", "filesort": { "sort_key": "t1.a, t1.b", "temporary_table": { @@ -4113,7 +4112,8 @@ EXPLAIN "table_name": "t1", "access_type": "ALL", "rows": 20, - "filtered": 100 + "filtered": 100, + "attached_condition": "t1.a > 5" } } ] @@ -11120,11 +11120,24 @@ EXPLAIN "nested_loop": [ { "table": { - "table_name": "", + "table_name": "t1", "access_type": "ALL", "rows": 2, "filtered": 100, - "attached_condition": "1 in (0,dt1.a)", + "attached_condition": "1 in (0,t1.a) and t1.a is not null" + } + }, + { + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100, "materialized": { "query_block": { "select_id": 2, @@ -11147,20 +11160,6 @@ EXPLAIN } } } - }, - { - "block-nl-join": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100 - }, - "buffer_type": "flat", - "buffer_size": "65", - "join_type": "BNL", - "attached_condition": "t1.a = dt1.a" - } } ] } @@ -11189,11 +11188,24 @@ EXPLAIN "nested_loop": [ { "table": { - "table_name": "", + "table_name": "t1", "access_type": "ALL", "rows": 2, "filtered": 100, - "attached_condition": "dt.a in (1,dt.a)", + "attached_condition": "t1.a in (1,t1.a) and t1.a is not null" + } + }, + { + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100, "materialized": { "query_block": { "select_id": 2, @@ -11216,20 +11228,6 @@ EXPLAIN } } } - }, - { - "block-nl-join": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100 - }, - "buffer_type": "flat", - "buffer_size": "119", - "join_type": "BNL", - "attached_condition": "t1.a = dt.a" - } } ] } @@ -11920,11 +11918,24 @@ EXPLAIN "nested_loop": [ { "table": { - "table_name": "", + "table_name": "t1", "access_type": "ALL", "rows": 2, "filtered": 100, - "attached_condition": "t.f2 < 2", + "attached_condition": "t1.f2 < 2 and t1.f2 is not null" + } + }, + { + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["f2"], + "ref": ["test.t1.f2"], + "rows": 2, + "filtered": 100, "materialized": { "query_block": { "select_id": 3, @@ -11942,15 +11953,6 @@ EXPLAIN } } } - }, - { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "t1.f2 = t.f2" - } } ] } @@ -11971,11 +11973,24 @@ EXPLAIN "nested_loop": [ { "table": { - "table_name": "", + "table_name": "t1", "access_type": "ALL", "rows": 2, "filtered": 100, - "attached_condition": "t.f2 < 2", + "attached_condition": "t1.f2 < 2 and t1.f2 is not null" + } + }, + { + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["f2"], + "ref": ["test.t1.f2"], + "rows": 1, + "filtered": 100, "materialized": { "query_block": { "select_id": 3, @@ -11995,20 +12010,6 @@ EXPLAIN } } } - }, - { - "block-nl-join": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100 - }, - "buffer_type": "flat", - "buffer_size": "65", - "join_type": "BNL", - "attached_condition": "t1.f2 = t.f2" - } } ] } @@ -12266,8 +12267,6 @@ EXPLAIN "materialized": { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", "query_specifications": [ { "query_block": { @@ -16486,8 +16485,8 @@ a b c a b c 3 21 500 3 21 231 explain select * from v1,t2 where (v1.b=t2.b) and (v1.a<4); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY ref key0 key0 5 test.t2.b 2 Using where 2 DERIVED t3 range i1 i1 5 NULL 2 Using index condition 3 UNION t3 range i1 i1 5 NULL 1 Using index condition NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -16499,9 +16498,23 @@ EXPLAIN "nested_loop": [ { "table": { - "table_name": "", + "table_name": "t2", "access_type": "ALL", - "rows": 3, + "rows": 9, + "filtered": 100, + "attached_condition": "t2.b is not null" + } + }, + { + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t2.b"], + "rows": 2, "filtered": 100, "attached_condition": "v1.a < 4", "materialized": { @@ -16556,20 +16569,6 @@ EXPLAIN } } } - }, - { - "block-nl-join": { - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 9, - "filtered": 100 - }, - "buffer_type": "flat", - "buffer_size": "173", - "join_type": "BNL", - "attached_condition": "t2.b = v1.b" - } } ] } @@ -16865,8 +16864,6 @@ EXPLAIN "materialized": { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", "query_specifications": [ { "query_block": { @@ -17115,8 +17112,6 @@ EXPLAIN "materialized": { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", "query_specifications": [ { "query_block": { @@ -19859,7 +19854,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 1 PRIMARY ref key0 key0 5 test.t3.id 2 3 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 -2 LATERAL DERIVED cp2 ref a a 5 test.t1.a 1 Using index +2 LATERAL DERIVED cp2 ref a a 5 test.t1.a 1 Using where; Using index explain format=json select * from t1, (select a from t1 cp2 group by a) dt, t3 where dt.a = t1.a and t1.a = t3.id and t1.a in (select a from t2); EXPLAIN @@ -19946,6 +19941,7 @@ EXPLAIN "ref": ["test.t1.a"], "rows": 1, "filtered": 100, + "attached_condition": "cp2.a = t3.`id`", "using_index": true } } @@ -19969,6 +19965,715 @@ id a a id 21 2 2 2 deallocate prepare stmt; drop table t1,t2,t3; +# +# MDEV-MDEV-27132: Splittable derived with equality in WHERE +# +CREATE TABLE t1 ( +id int PRIMARY KEY +) ENGINE=MyISAM; +INSERT INTO t1 VALUES +(-1),(2070),(4826),(4827),(4828),(4829),(4830),(4831),(4832),(4833),(4834), +(4835),(4836),(4837),(4838),(4839),(4840),(4841),(4842),(4843),(4844), +(4845),(4846),(4847),(4848),(4849),(4850),(4851),(4852),(4853),(4854), +(4855),(4856),(4857),(4858),(4859),(4860),(4861),(4862),(4863),(4864), +(4865),(4866),(4867),(4868),(4869),(4870),(4871),(4872),(4873),(4874), +(4875),(4876); +CREATE TABLE t2 ( +id int PRIMARY KEY AUTO_INCREMENT, +deleted int(1), +t1_id int, +email varchar(255), +reporting_person int(1), +KEY t1_id (t1_id) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES +(1,0,2064,'1test@test.ee',1),(2,1626095588,2066,'2test@test.ee',1), +(3,0,2066,'3test@test.ee',1),(4,0,2068,'4test@test.ee',1), +(5,0,2068,'5test@test.ee',1),(6,0,2069,'6test@test.ee',1),(7,0,2070,'',0), +(8,0,2070,'',0),(9,0,2071,'',0),(10,0,2071,'',0),(11,0,2072,'',0), +(12,0,2072,'',0),(13,0,2072,'13test@test.ee',1),(14,0,2073,'14test@test.ee',1), +(15,0,2074,'15test@test.ee',1),(16,0,2075,'16test@test.ee',1),(17,0,2075,'',0), +(18,0,2075,'',0),(19,0,2076,'19test@test.ee',1),(20,0,2077,'',0), +(21,0,2078,'21test@test.ee',1),(22,0,2078,'22test@test.ee',1); +INSERT INTO t2(deleted, t1_id, email, reporting_person) +SELECT deleted, t1_id, email, reporting_person FROM t2; +INSERT INTO t2(deleted, t1_id, email, reporting_person) +SELECT deleted, t1_id+10000, email, reporting_person FROM t2; +INSERT INTO t2(deleted, t1_id, email, reporting_person) +SELECT deleted, t1_id+20000, email, reporting_person FROM t2; +INSERT INTO t2(deleted, t1_id, email, reporting_person) +SELECT deleted, t1_id+40000, email, reporting_person FROM t2; +INSERT INTO t2(deleted, t1_id, email, reporting_person) +SELECT deleted, t1_id+80000, email, reporting_person FROM t2; +INSERT INTO t2(deleted, t1_id, email, reporting_person) +SELECT deleted, t1_id+160000, email, reporting_person FROM t2; +CREATE TABLE t3 ( +id int PRIMARY KEY, +deleted int, +t1_id int, +YEAR int(4), +quarter int(1), +KEY t1_id (t1_id,year,quarter) +) ENGINE=MyISAM; +INSERT INTO t3 VALUES +(1,0,3885,2020,1),(2,0,2064,2020,1),(3,1611670734,2225,2020,1), +(4,0,2070,2020,1),(5,1611055981,2095,2020,1),(6,1610970096,2102,2020,1), +(7,0,3974,2020,1),(153,1609851928,3892,2020,2),(154,0,3885,2020,2), +(155,0,2064,2020,2),(156,1611670717,2225,2020,2),(157,0,2070,2020,2), +(317,0,2257,2020,2),(318,0,3885,2020,3),(319,0,2064,2020,3), +(320,1611670709,2225,2020,3),(321,0,2070,2020,3),(322,0,2095,2020,3), +(323,0,2102,2020,3),(324,0,3974,2020,3),(325,0,3886,2020,3), +(326,1609939963,2104,2020,3),(327,0,3887,2020,3),(328,0,3888,2020,3), +(329,0,2148,2020,3),(330,0,3889,2020,3),(331,0,3890,2020,3), +(332,0,2179,2020,3),(333,0,2115,2020,3),(334,0,2193,2020,3), +(335,0,2213,2020,3),(336,0,3891,2020,3),(337,1609851955,3892,2020,3), +(338,1610447706,2232,2020,3),(339,0,2235,2020,3),(340,0,2237,2020,3), +(341,0,3972,2020,3),(342,1610449357,2242,2020,3),(343,0,3893,2020,3), +(344,0,2257,2020,3),(345,0,3951,2020,3),(346,0,3894,2020,3), +(347,0,3912,2020,3),(348,0,3895,2020,3),(349,0,2301,2020,3), +(350,0,2304,2020,3),(351,0,3896,2020,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 +set optimizer_switch='split_materialized=on'; +SELECT t1.id +FROM t1 +JOIN t3 +ON t3.t1_id = t1.id +JOIN (SELECT t1_id FROM t2 WHERE reporting_person = 1 GROUP BY t1_id) tx +ON tx.t1_id = t1.id +WHERE t1.id BETWEEN 200 AND 100000; +id +EXPLAIN SELECT t1.id +FROM t1 +JOIN t3 +ON t3.t1_id = t1.id +JOIN (SELECT t1_id FROM t2 WHERE reporting_person = 1 GROUP BY t1_id) tx +ON tx.t1_id = t1.id +WHERE t1.id BETWEEN 200 AND 100000; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t3 range t1_id t1_id 5 NULL 47 Using where; Using index +1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t3.t1_id 1 Using index +1 PRIMARY ref key0 key0 5 test.t3.t1_id 2 +2 LATERAL DERIVED t2 ref t1_id t1_id 5 test.t1.id 3 Using index condition; Using where +EXPLAIN FORMAT=JSON SELECT t1.id +FROM t1 +JOIN t3 +ON t3.t1_id = t1.id +JOIN (SELECT t1_id FROM t2 WHERE reporting_person = 1 GROUP BY t1_id) tx +ON tx.t1_id = t1.id +WHERE t1.id BETWEEN 200 AND 100000; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "nested_loop": [ + { + "table": { + "table_name": "t3", + "access_type": "range", + "possible_keys": ["t1_id"], + "key": "t1_id", + "key_length": "5", + "used_key_parts": ["t1_id"], + "rows": 47, + "filtered": 100, + "attached_condition": "t3.t1_id between 200 and 100000 and t3.t1_id is not null", + "using_index": true + } + }, + { + "table": { + "table_name": "t1", + "access_type": "eq_ref", + "possible_keys": ["PRIMARY"], + "key": "PRIMARY", + "key_length": "4", + "used_key_parts": ["id"], + "ref": ["test.t3.t1_id"], + "rows": 1, + "filtered": 100, + "using_index": true + } + }, + { + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["t1_id"], + "ref": ["test.t3.t1_id"], + "rows": 2, + "filtered": 100, + "materialized": { + "lateral": 1, + "query_block": { + "select_id": 2, + "nested_loop": [ + { + "table": { + "table_name": "t2", + "access_type": "ref", + "possible_keys": ["t1_id"], + "key": "t1_id", + "key_length": "5", + "used_key_parts": ["t1_id"], + "ref": ["test.t1.id"], + "rows": 3, + "filtered": 59.09090805, + "index_condition": "t2.t1_id between 200 and 100000 and t2.t1_id = t3.t1_id", + "attached_condition": "t2.reporting_person = 1" + } + } + ] + } + } + } + } + ] + } +} +set optimizer_switch='split_materialized=off'; +SELECT t1.id +FROM t1 +JOIN t3 +ON t3.t1_id = t1.id +JOIN (SELECT t1_id FROM t2 WHERE reporting_person = 1 GROUP BY t1_id) tx +ON tx.t1_id = t1.id +WHERE t1.id BETWEEN 200 AND 100000; +id +set optimizer_switch='split_materialized=default'; +DROP TABLE t1,t2,t3; +# +# MDEV-27510: Splittable derived with grouping over two tables +# +CREATE TABLE ledgers ( +id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +name VARCHAR(32) +) ENGINE=MyISAM; +CREATE TABLE charges ( +id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +from_ledger_id BIGINT UNSIGNED NOT NULL, +to_ledger_id BIGINT UNSIGNED NOT NULL, +amount INT NOT NULL, +KEY fk_charge_from_ledger (from_ledger_id), +KEY fk_charge_to_ledger (to_ledger_id) +) ENGINE=MyISAM; +CREATE TABLE transactions ( +id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +ledger_id BIGINT UNSIGNED NOT NULL, +KEY fk_transactions_ledger (ledger_id) +) ENGINE=MyISAM; +CREATE TABLE transaction_items ( +id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +transaction_id BIGINT UNSIGNED NOT NULL, +charge_id BIGINT UNSIGNED, +amount INT NOT NULL, +KEY fk_items_transaction (transaction_id), +KEY fk_items_charge (charge_id) +) ENGINE=MyISAM; +INSERT INTO ledgers (id, name) VALUES +(1, 'Anna'), (2, 'John'), (3, 'Fred'); +INSERT INTO charges (id, from_ledger_id, to_ledger_id, amount) VALUES +(1, 2, 1, 200), (2, 1, 2, 330), (3, 1, 2, 640), (4, 3, 1, 640), (5, 3, 2, 1000), +(6, 3, 1, 660), (7, 2, 3, 650), (8, 3, 2, 160), (9, 2, 1, 740), (10, 3, 2, 310), +(11, 2, 1, 640), (12, 3, 2, 240), (13, 3, 2, 340), (14, 2, 1, 720), +(15, 2, 3, 100), +(16, 2, 3, 980), (17, 2, 1, 80), (18, 1, 2, 760), (19, 2, 3, 740), +(20, 2, 1, 990); +INSERT INTO transactions (id, ledger_id) VALUES +(2, 1), (3, 1), (5, 1), (8, 1), (12, 1), (18, 1), (22, 1), (28, 1), +(34, 1), (35, 1), +(40, 1), (1, 2), (4, 2), (6, 2), (10, 2), (13, 2), (16, 2), (17, 2), +(20, 2), (21, 2), +(24, 2), (26, 2), (27, 2), (29, 2), (31, 2), (33, 2), (36, 2), (37, 2), +(39, 2), (7, 3), +(9, 3), (11, 3), (14, 3), (15, 3), (19, 3), (23, 3), (25, 3), (30, 3), +(32, 3), (38, 3); +INSERT INTO transaction_items (id, transaction_id, charge_id, amount) VALUES +(1, 1, 1, -200), (2, 2, 1, 200), (3, 3, 2, -330), (4, 4, 2, 330), +(5, 5, 3, -640), +(6, 6, 3, 640), (7, 7, 4, -640), (8, 8, 4, 640), (9, 9, 5, -1000), +(10, 10, 5, 1000), +(11, 11, 6, -660), (12, 12, 6, 660), (13, 13, 7, -650), (14, 14, 7, 650), +(15, 15, 8, -160), +(16, 16, 8, 160), (17, 17, 9, -740), (18, 18, 9, 740), (19, 19, 10, -310), +(20, 20, 10, 310), +(21, 21, 11, -640), (22, 22, 11, 640), (23, 23, 12, -240), (24, 24, 12, 240), +(25, 25, 13, -340), +(26, 26, 13, 340), (27, 27, 14, -720), (28, 28, 14, 720), (29, 29, 15, -100), +(30, 30, 15, 100), +(31, 31, 16, -980), (32, 32, 16, 980), (33, 33, 17, -80), (34, 34, 17, 80), +(35, 35, 18, -760), +(36, 36, 18, 760), (37, 37, 19, -740), (38, 38, 19, 740), (39, 39, 20, -990), +(40, 40, 20, 990); +ANALYZE TABLE ledgers, charges, transactions, transaction_items; +Table Op Msg_type Msg_text +test.ledgers analyze status Engine-independent statistics collected +test.ledgers analyze status OK +test.charges analyze status Engine-independent statistics collected +test.charges analyze status OK +test.transactions analyze status Engine-independent statistics collected +test.transactions analyze status OK +test.transaction_items analyze status Engine-independent statistics collected +test.transaction_items analyze status OK +set optimizer_switch='split_materialized=on'; +SELECT +charges.id, +charges.from_ledger_id, +charges.to_ledger_id, +from_agg_items.num_rows AS from_num_rows +FROM charges +INNER JOIN ( +SELECT +transactions.ledger_id, +transaction_items.charge_id, +count(*) as num_rows +FROM transaction_items +INNER JOIN transactions ON transaction_items.transaction_id = transactions.id +GROUP BY transactions.ledger_id, transaction_items.charge_id +) AS from_agg_items +ON from_agg_items.charge_id = charges.id AND +from_agg_items.ledger_id = charges.from_ledger_id +WHERE charges.to_ledger_id = 2; +id from_ledger_id to_ledger_id from_num_rows +2 1 2 1 +3 1 2 1 +5 3 2 1 +8 3 2 1 +10 3 2 1 +12 3 2 1 +13 3 2 1 +18 1 2 1 +EXPLAIN SELECT +charges.id, +charges.from_ledger_id, +charges.to_ledger_id, +from_agg_items.num_rows AS from_num_rows +FROM charges +INNER JOIN ( +SELECT +transactions.ledger_id, +transaction_items.charge_id, +count(*) as num_rows +FROM transaction_items +INNER JOIN transactions ON transaction_items.transaction_id = transactions.id +GROUP BY transactions.ledger_id, transaction_items.charge_id +) AS from_agg_items +ON from_agg_items.charge_id = charges.id AND +from_agg_items.ledger_id = charges.from_ledger_id +WHERE charges.to_ledger_id = 2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY charges ALL PRIMARY,fk_charge_from_ledger,fk_charge_to_ledger NULL NULL NULL 20 Using where +1 PRIMARY ref key0 key0 17 test.charges.from_ledger_id,test.charges.id 2 +2 LATERAL DERIVED transaction_items ref fk_items_transaction,fk_items_charge fk_items_charge 9 test.charges.id 2 +2 LATERAL DERIVED transactions eq_ref PRIMARY,fk_transactions_ledger PRIMARY 8 test.transaction_items.transaction_id 1 Using where +EXPLAIN FORMAT=JSON SELECT +charges.id, +charges.from_ledger_id, +charges.to_ledger_id, +from_agg_items.num_rows AS from_num_rows +FROM charges +INNER JOIN ( +SELECT +transactions.ledger_id, +transaction_items.charge_id, +count(*) as num_rows +FROM transaction_items +INNER JOIN transactions ON transaction_items.transaction_id = transactions.id +GROUP BY transactions.ledger_id, transaction_items.charge_id +) AS from_agg_items +ON from_agg_items.charge_id = charges.id AND +from_agg_items.ledger_id = charges.from_ledger_id +WHERE charges.to_ledger_id = 2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "nested_loop": [ + { + "table": { + "table_name": "charges", + "access_type": "ALL", + "possible_keys": [ + "PRIMARY", + "fk_charge_from_ledger", + "fk_charge_to_ledger" + ], + "rows": 20, + "filtered": 40, + "attached_condition": "charges.to_ledger_id = 2" + } + }, + { + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "17", + "used_key_parts": ["ledger_id", "charge_id"], + "ref": ["test.charges.from_ledger_id", "test.charges.id"], + "rows": 2, + "filtered": 100, + "materialized": { + "lateral": 1, + "query_block": { + "select_id": 2, + "nested_loop": [ + { + "table": { + "table_name": "transaction_items", + "access_type": "ref", + "possible_keys": ["fk_items_transaction", "fk_items_charge"], + "key": "fk_items_charge", + "key_length": "9", + "used_key_parts": ["charge_id"], + "ref": ["test.charges.id"], + "rows": 2, + "filtered": 100 + } + }, + { + "table": { + "table_name": "transactions", + "access_type": "eq_ref", + "possible_keys": ["PRIMARY", "fk_transactions_ledger"], + "key": "PRIMARY", + "key_length": "8", + "used_key_parts": ["id"], + "ref": ["test.transaction_items.transaction_id"], + "rows": 1, + "filtered": 100, + "attached_condition": "transactions.ledger_id = charges.from_ledger_id" + } + } + ] + } + } + } + } + ] + } +} +set optimizer_switch='split_materialized=off'; +SELECT +charges.id, +charges.from_ledger_id, +charges.to_ledger_id, +from_agg_items.num_rows AS from_num_rows +FROM charges +INNER JOIN ( +SELECT +transactions.ledger_id, +transaction_items.charge_id, +count(*) as num_rows +FROM transaction_items +INNER JOIN transactions ON transaction_items.transaction_id = transactions.id +GROUP BY transactions.ledger_id, transaction_items.charge_id +) AS from_agg_items +ON from_agg_items.charge_id = charges.id AND +from_agg_items.ledger_id = charges.from_ledger_id +WHERE charges.to_ledger_id = 2; +id from_ledger_id to_ledger_id from_num_rows +2 1 2 1 +3 1 2 1 +5 3 2 1 +8 3 2 1 +10 3 2 1 +12 3 2 1 +13 3 2 1 +18 1 2 1 +EXPLAIN SELECT +charges.id, +charges.from_ledger_id, +charges.to_ledger_id, +from_agg_items.num_rows AS from_num_rows +FROM charges +INNER JOIN ( +SELECT +transactions.ledger_id, +transaction_items.charge_id, +count(*) as num_rows +FROM transaction_items +INNER JOIN transactions ON transaction_items.transaction_id = transactions.id +GROUP BY transactions.ledger_id, transaction_items.charge_id +) AS from_agg_items +ON from_agg_items.charge_id = charges.id AND +from_agg_items.ledger_id = charges.from_ledger_id +WHERE charges.to_ledger_id = 2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY charges ALL PRIMARY,fk_charge_from_ledger,fk_charge_to_ledger NULL NULL NULL 20 Using where +1 PRIMARY ref key0 key0 17 test.charges.from_ledger_id,test.charges.id 4 +2 DERIVED transaction_items ALL fk_items_transaction NULL NULL NULL 40 Using temporary; Using filesort +2 DERIVED transactions eq_ref PRIMARY PRIMARY 8 test.transaction_items.transaction_id 1 +INSERT INTO charges (id, from_ledger_id, to_ledger_id, amount) VALUES +(101, 4, 2, 100), (102, 7, 2, 200); +set optimizer_switch='split_materialized=on'; +SELECT +charges.id, +charges.from_ledger_id, +charges.to_ledger_id, +from_agg_items.num_rows AS from_num_rows +FROM charges +LEFT JOIN ( +SELECT +transactions.ledger_id, +transaction_items.charge_id, +count(*) as num_rows +FROM transaction_items +INNER JOIN transactions ON transaction_items.transaction_id = transactions.id +GROUP BY transactions.ledger_id, transaction_items.charge_id +) AS from_agg_items +ON from_agg_items.charge_id = charges.id AND +from_agg_items.ledger_id = charges.from_ledger_id +WHERE charges.to_ledger_id = 2; +id from_ledger_id to_ledger_id from_num_rows +2 1 2 1 +3 1 2 1 +5 3 2 1 +8 3 2 1 +10 3 2 1 +12 3 2 1 +13 3 2 1 +18 1 2 1 +101 4 2 NULL +102 7 2 NULL +EXPLAIN SELECT +charges.id, +charges.from_ledger_id, +charges.to_ledger_id, +from_agg_items.num_rows AS from_num_rows +FROM charges +LEFT JOIN ( +SELECT +transactions.ledger_id, +transaction_items.charge_id, +count(*) as num_rows +FROM transaction_items +INNER JOIN transactions ON transaction_items.transaction_id = transactions.id +GROUP BY transactions.ledger_id, transaction_items.charge_id +) AS from_agg_items +ON from_agg_items.charge_id = charges.id AND +from_agg_items.ledger_id = charges.from_ledger_id +WHERE charges.to_ledger_id = 2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY charges ALL fk_charge_to_ledger NULL NULL NULL 20 Using where +1 PRIMARY ref key0 key0 18 test.charges.from_ledger_id,test.charges.id 2 +2 LATERAL DERIVED transaction_items ref fk_items_transaction,fk_items_charge fk_items_charge 9 test.charges.id 2 +2 LATERAL DERIVED transactions eq_ref PRIMARY,fk_transactions_ledger PRIMARY 8 test.transaction_items.transaction_id 1 Using where +EXPLAIN FORMAT=JSON SELECT +charges.id, +charges.from_ledger_id, +charges.to_ledger_id, +from_agg_items.num_rows AS from_num_rows +FROM charges +LEFT JOIN ( +SELECT +transactions.ledger_id, +transaction_items.charge_id, +count(*) as num_rows +FROM transaction_items +INNER JOIN transactions ON transaction_items.transaction_id = transactions.id +GROUP BY transactions.ledger_id, transaction_items.charge_id +) AS from_agg_items +ON from_agg_items.charge_id = charges.id AND +from_agg_items.ledger_id = charges.from_ledger_id +WHERE charges.to_ledger_id = 2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "nested_loop": [ + { + "table": { + "table_name": "charges", + "access_type": "ALL", + "possible_keys": ["fk_charge_to_ledger"], + "rows": 20, + "filtered": 50, + "attached_condition": "charges.to_ledger_id = 2" + } + }, + { + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "18", + "used_key_parts": ["ledger_id", "charge_id"], + "ref": ["test.charges.from_ledger_id", "test.charges.id"], + "rows": 2, + "filtered": 100, + "materialized": { + "lateral": 1, + "query_block": { + "select_id": 2, + "nested_loop": [ + { + "table": { + "table_name": "transaction_items", + "access_type": "ref", + "possible_keys": ["fk_items_transaction", "fk_items_charge"], + "key": "fk_items_charge", + "key_length": "9", + "used_key_parts": ["charge_id"], + "ref": ["test.charges.id"], + "rows": 2, + "filtered": 100 + } + }, + { + "table": { + "table_name": "transactions", + "access_type": "eq_ref", + "possible_keys": ["PRIMARY", "fk_transactions_ledger"], + "key": "PRIMARY", + "key_length": "8", + "used_key_parts": ["id"], + "ref": ["test.transaction_items.transaction_id"], + "rows": 1, + "filtered": 100, + "attached_condition": "transactions.ledger_id = charges.from_ledger_id" + } + } + ] + } + } + } + } + ] + } +} +set optimizer_switch='split_materialized=off'; +SELECT +charges.id, +charges.from_ledger_id, +charges.to_ledger_id, +from_agg_items.num_rows AS from_num_rows +FROM charges +LEFT JOIN ( +SELECT +transactions.ledger_id, +transaction_items.charge_id, +count(*) as num_rows +FROM transaction_items +INNER JOIN transactions ON transaction_items.transaction_id = transactions.id +GROUP BY transactions.ledger_id, transaction_items.charge_id +) AS from_agg_items +ON from_agg_items.charge_id = charges.id AND +from_agg_items.ledger_id = charges.from_ledger_id +WHERE charges.to_ledger_id = 2; +id from_ledger_id to_ledger_id from_num_rows +2 1 2 1 +3 1 2 1 +5 3 2 1 +8 3 2 1 +10 3 2 1 +12 3 2 1 +13 3 2 1 +18 1 2 1 +101 4 2 NULL +102 7 2 NULL +EXPLAIN SELECT +charges.id, +charges.from_ledger_id, +charges.to_ledger_id, +from_agg_items.num_rows AS from_num_rows +FROM charges +LEFT JOIN ( +SELECT +transactions.ledger_id, +transaction_items.charge_id, +count(*) as num_rows +FROM transaction_items +INNER JOIN transactions ON transaction_items.transaction_id = transactions.id +GROUP BY transactions.ledger_id, transaction_items.charge_id +) AS from_agg_items +ON from_agg_items.charge_id = charges.id AND +from_agg_items.ledger_id = charges.from_ledger_id +WHERE charges.to_ledger_id = 2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY charges ALL fk_charge_to_ledger NULL NULL NULL 20 Using where +1 PRIMARY ref key0 key0 18 test.charges.from_ledger_id,test.charges.id 4 +2 DERIVED transaction_items ALL fk_items_transaction NULL NULL NULL 40 Using temporary; Using filesort +2 DERIVED transactions eq_ref PRIMARY PRIMARY 8 test.transaction_items.transaction_id 1 +set optimizer_switch='split_materialized=default'; +DROP TABLE transaction_items; +DROP TABLE transactions; +DROP TABLE charges; +DROP TABLE ledgers; +# +# MDEV-30081: Splitting from a constant mergeable derived table +# used in inner part of an outer join. +# +CREATE TABLE t1 ( id int PRIMARY KEY ) ENGINE=MyISAM; +INSERT INTO t1 VALUES (3),(4),(7); +CREATE TABLE t2 ( +id int, id1 int, wid int, PRIMARY KEY (id), KEY (id1), KEY (wid) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (4,4,6),(7,7,7); +CREATE TABLE t3 ( +wid int, wtid int, otid int, oid int, +PRIMARY KEY (wid), KEY (wtid), KEY (otid), KEY (oid) +) ENGINE=MyISAM; +INSERT INTO t3 VALUES (6,30,6,6),(7,17,7,7); +CREATE TABLE t4 ( id int, a int, PRIMARY KEY (id), KEY (a) ) ENGINE=MyISAM; +INSERT INTO t4 VALUES (1,17),(2,15),(3,49),(4,3),(5,45),(6,38),(7,17); +CREATE TABLE t5 ( +id int, id1 int, PRIMARY KEY (id), KEY id1 (id1) +) ENGINE=MyISAM ; +INSERT INTO t5 VALUES (1,17),(2,15),(3,49),(4,3),(5,45),(6,38),(7,17); +ANALYZE TABLE t1,t2,t3,t4,t5; +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 +test.t5 analyze status Engine-independent statistics collected +test.t5 analyze status OK +CREATE VIEW v1 AS (SELECT id1 FROM t5 GROUP BY id1); +SELECT t3.*, t1.id AS t1_id, t2.id AS t2_id, dt.*, v1.* +FROM +t1, t2, t3 +LEFT JOIN +(SELECT t4.* FROM t4 WHERE t4.a=3) dt +ON t3.oid = dt.id AND t3.otid = 14 +LEFT JOIN v1 +ON (v1.id1 = dt.a) +WHERE t3.oid = t1.id AND t3.oid = t2.id AND t3.wid = 7; +wid wtid otid oid t1_id t2_id id a id1 +7 17 7 7 7 7 NULL NULL NULL +EXPLAIN SELECT t3.*, t1.id AS t1_id, t2.id AS t2_id, dt.*, v1.* +FROM +t1, t2, t3 +LEFT JOIN +(SELECT t4.* FROM t4 WHERE t4.a=3) dt +ON t3.oid = dt.id AND t3.otid = 14 +LEFT JOIN v1 +ON (v1.id1 = dt.a) +WHERE t3.oid = t1.id AND t3.oid = t2.id AND t3.wid = 7; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t3 const PRIMARY,oid PRIMARY 4 const 1 +1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 Using index +1 PRIMARY t2 const PRIMARY PRIMARY 4 const 1 Using index +1 PRIMARY t4 const PRIMARY,a NULL NULL NULL 1 Impossible ON condition +1 PRIMARY ref key0 key0 5 const 0 Using where +3 LATERAL DERIVED t5 ref id1 id1 5 const 0 Using index +DROP VIEW v1; +DROP TABLE t1,t2,t3,t4,t5; # End of 10.3 tests # # MDEV-18679: materialized view with SELECT S containing materialized @@ -19991,4 +20696,112 @@ id select_type table type possible_keys key key_len ref rows Extra 3 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary drop view v1; drop table t1; +# +# MDEV-31102: execution of PS for query where pushdown of condition +# into view defined as union is applied +# +create table t1 ( +n int, +lv varchar(31) charset latin1, +mv varchar(31) charset utf8mb3 +) engine=myisam; +insert into t1 values (1,'aa','xxx'), ('2','bb','yyy'), (3,'cc','zzz'); +create view v1 as +select case when n=1 then lv when n=2 then mv else NULL end as r from t1 +union +select 'a'; +select * from v1 where r < 'x'; +r +aa +a +explain extended select * from v1 where r < 'x'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ALL NULL NULL NULL NULL 3 100.00 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 Using where +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 /* select#1 */ select `v1`.`r` AS `r` from `test`.`v1` where `v1`.`r` < 'x' +explain format=json select * from v1 where r < 'x'; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "nested_loop": [ + { + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "v1.r < 'x'", + "materialized": { + "query_block": { + "union_result": { + "table_name": "", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "case when t1.n = 1 then convert(t1.lv using utf8mb3) when t1.n = 2 then t1.mv else NULL end < 'x'" + } + } + ] + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "table": { + "message": "No tables used" + } + } + } + ] + } + } + } + } + } + ] + } +} +prepare stmt from "select * from v1 where r < 'x'"; +execute stmt; +r +aa +a +execute stmt; +r +aa +a +deallocate prepare stmt; +drop view v1; +drop table t1; # End of 10.4 tests +# +# MDEV-28958: condition pushable into view after simplification +# contains constant TRUE/FALSE as subformula +# +create table t1 (c1 int); +insert into t1 values (3), (7), (1), (3), (1), (3); +create table t2 (c2 int); +insert into t2 values (3), (5), (7), (3); +create view v1 as select * from t1 group by c1; +create view v2 as select c1 as a, c2 as b from v1,t2 where c1=c2; +select * from v2 group by a,b having a=b or b > a+10; +a b +3 3 +7 7 +drop view v1,v2; +drop table t1,t2; +# End of 10.7 tests diff --git a/mysql-test/main/derived_cond_pushdown.test b/mysql-test/main/derived_cond_pushdown.test index d738ed3312851..06b15f75a0bab 100644 --- a/mysql-test/main/derived_cond_pushdown.test +++ b/mysql-test/main/derived_cond_pushdown.test @@ -3629,6 +3629,297 @@ deallocate prepare stmt; drop table t1,t2,t3; +--echo # +--echo # MDEV-MDEV-27132: Splittable derived with equality in WHERE +--echo # + +CREATE TABLE t1 ( + id int PRIMARY KEY +) ENGINE=MyISAM; + +INSERT INTO t1 VALUES +(-1),(2070),(4826),(4827),(4828),(4829),(4830),(4831),(4832),(4833),(4834), +(4835),(4836),(4837),(4838),(4839),(4840),(4841),(4842),(4843),(4844), +(4845),(4846),(4847),(4848),(4849),(4850),(4851),(4852),(4853),(4854), +(4855),(4856),(4857),(4858),(4859),(4860),(4861),(4862),(4863),(4864), +(4865),(4866),(4867),(4868),(4869),(4870),(4871),(4872),(4873),(4874), +(4875),(4876); + +CREATE TABLE t2 ( + id int PRIMARY KEY AUTO_INCREMENT, + deleted int(1), + t1_id int, + email varchar(255), + reporting_person int(1), + KEY t1_id (t1_id) +) ENGINE=MyISAM; + +INSERT INTO t2 VALUES +(1,0,2064,'1test@test.ee',1),(2,1626095588,2066,'2test@test.ee',1), +(3,0,2066,'3test@test.ee',1),(4,0,2068,'4test@test.ee',1), +(5,0,2068,'5test@test.ee',1),(6,0,2069,'6test@test.ee',1),(7,0,2070,'',0), +(8,0,2070,'',0),(9,0,2071,'',0),(10,0,2071,'',0),(11,0,2072,'',0), +(12,0,2072,'',0),(13,0,2072,'13test@test.ee',1),(14,0,2073,'14test@test.ee',1), +(15,0,2074,'15test@test.ee',1),(16,0,2075,'16test@test.ee',1),(17,0,2075,'',0), +(18,0,2075,'',0),(19,0,2076,'19test@test.ee',1),(20,0,2077,'',0), +(21,0,2078,'21test@test.ee',1),(22,0,2078,'22test@test.ee',1); + +INSERT INTO t2(deleted, t1_id, email, reporting_person) + SELECT deleted, t1_id, email, reporting_person FROM t2; +INSERT INTO t2(deleted, t1_id, email, reporting_person) + SELECT deleted, t1_id+10000, email, reporting_person FROM t2; +INSERT INTO t2(deleted, t1_id, email, reporting_person) + SELECT deleted, t1_id+20000, email, reporting_person FROM t2; +INSERT INTO t2(deleted, t1_id, email, reporting_person) + SELECT deleted, t1_id+40000, email, reporting_person FROM t2; +INSERT INTO t2(deleted, t1_id, email, reporting_person) + SELECT deleted, t1_id+80000, email, reporting_person FROM t2; +INSERT INTO t2(deleted, t1_id, email, reporting_person) + SELECT deleted, t1_id+160000, email, reporting_person FROM t2; + +CREATE TABLE t3 ( + id int PRIMARY KEY, + deleted int, + t1_id int, + YEAR int(4), + quarter int(1), + KEY t1_id (t1_id,year,quarter) +) ENGINE=MyISAM; + +INSERT INTO t3 VALUES +(1,0,3885,2020,1),(2,0,2064,2020,1),(3,1611670734,2225,2020,1), +(4,0,2070,2020,1),(5,1611055981,2095,2020,1),(6,1610970096,2102,2020,1), +(7,0,3974,2020,1),(153,1609851928,3892,2020,2),(154,0,3885,2020,2), +(155,0,2064,2020,2),(156,1611670717,2225,2020,2),(157,0,2070,2020,2), +(317,0,2257,2020,2),(318,0,3885,2020,3),(319,0,2064,2020,3), +(320,1611670709,2225,2020,3),(321,0,2070,2020,3),(322,0,2095,2020,3), +(323,0,2102,2020,3),(324,0,3974,2020,3),(325,0,3886,2020,3), +(326,1609939963,2104,2020,3),(327,0,3887,2020,3),(328,0,3888,2020,3), +(329,0,2148,2020,3),(330,0,3889,2020,3),(331,0,3890,2020,3), +(332,0,2179,2020,3),(333,0,2115,2020,3),(334,0,2193,2020,3), +(335,0,2213,2020,3),(336,0,3891,2020,3),(337,1609851955,3892,2020,3), +(338,1610447706,2232,2020,3),(339,0,2235,2020,3),(340,0,2237,2020,3), +(341,0,3972,2020,3),(342,1610449357,2242,2020,3),(343,0,3893,2020,3), +(344,0,2257,2020,3),(345,0,3951,2020,3),(346,0,3894,2020,3), +(347,0,3912,2020,3),(348,0,3895,2020,3),(349,0,2301,2020,3), +(350,0,2304,2020,3),(351,0,3896,2020,3); + +ANALYZE TABLE t1,t2,t3; + +let $q= +SELECT t1.id +FROM t1 + JOIN t3 + ON t3.t1_id = t1.id + JOIN (SELECT t1_id FROM t2 WHERE reporting_person = 1 GROUP BY t1_id) tx + ON tx.t1_id = t1.id +WHERE t1.id BETWEEN 200 AND 100000; + +set optimizer_switch='split_materialized=on'; + +eval $q; +eval EXPLAIN $q; +eval EXPLAIN FORMAT=JSON $q; + +set optimizer_switch='split_materialized=off'; + +eval $q; + +set optimizer_switch='split_materialized=default'; + +DROP TABLE t1,t2,t3; + +--echo # +--echo # MDEV-27510: Splittable derived with grouping over two tables +--echo # + +CREATE TABLE ledgers ( + id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(32) +) ENGINE=MyISAM; + +CREATE TABLE charges ( + id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + from_ledger_id BIGINT UNSIGNED NOT NULL, + to_ledger_id BIGINT UNSIGNED NOT NULL, + amount INT NOT NULL, + KEY fk_charge_from_ledger (from_ledger_id), + KEY fk_charge_to_ledger (to_ledger_id) +) ENGINE=MyISAM; + +CREATE TABLE transactions ( + id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + ledger_id BIGINT UNSIGNED NOT NULL, + KEY fk_transactions_ledger (ledger_id) +) ENGINE=MyISAM; + +CREATE TABLE transaction_items ( + id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + transaction_id BIGINT UNSIGNED NOT NULL, + charge_id BIGINT UNSIGNED, + amount INT NOT NULL, + KEY fk_items_transaction (transaction_id), + KEY fk_items_charge (charge_id) +) ENGINE=MyISAM; + +INSERT INTO ledgers (id, name) VALUES +(1, 'Anna'), (2, 'John'), (3, 'Fred'); + +INSERT INTO charges (id, from_ledger_id, to_ledger_id, amount) VALUES +(1, 2, 1, 200), (2, 1, 2, 330), (3, 1, 2, 640), (4, 3, 1, 640), (5, 3, 2, 1000), +(6, 3, 1, 660), (7, 2, 3, 650), (8, 3, 2, 160), (9, 2, 1, 740), (10, 3, 2, 310), +(11, 2, 1, 640), (12, 3, 2, 240), (13, 3, 2, 340), (14, 2, 1, 720), +(15, 2, 3, 100), +(16, 2, 3, 980), (17, 2, 1, 80), (18, 1, 2, 760), (19, 2, 3, 740), +(20, 2, 1, 990); + +INSERT INTO transactions (id, ledger_id) VALUES +(2, 1), (3, 1), (5, 1), (8, 1), (12, 1), (18, 1), (22, 1), (28, 1), +(34, 1), (35, 1), +(40, 1), (1, 2), (4, 2), (6, 2), (10, 2), (13, 2), (16, 2), (17, 2), +(20, 2), (21, 2), +(24, 2), (26, 2), (27, 2), (29, 2), (31, 2), (33, 2), (36, 2), (37, 2), +(39, 2), (7, 3), +(9, 3), (11, 3), (14, 3), (15, 3), (19, 3), (23, 3), (25, 3), (30, 3), +(32, 3), (38, 3); + +INSERT INTO transaction_items (id, transaction_id, charge_id, amount) VALUES +(1, 1, 1, -200), (2, 2, 1, 200), (3, 3, 2, -330), (4, 4, 2, 330), +(5, 5, 3, -640), +(6, 6, 3, 640), (7, 7, 4, -640), (8, 8, 4, 640), (9, 9, 5, -1000), +(10, 10, 5, 1000), +(11, 11, 6, -660), (12, 12, 6, 660), (13, 13, 7, -650), (14, 14, 7, 650), +(15, 15, 8, -160), +(16, 16, 8, 160), (17, 17, 9, -740), (18, 18, 9, 740), (19, 19, 10, -310), +(20, 20, 10, 310), +(21, 21, 11, -640), (22, 22, 11, 640), (23, 23, 12, -240), (24, 24, 12, 240), +(25, 25, 13, -340), +(26, 26, 13, 340), (27, 27, 14, -720), (28, 28, 14, 720), (29, 29, 15, -100), +(30, 30, 15, 100), +(31, 31, 16, -980), (32, 32, 16, 980), (33, 33, 17, -80), (34, 34, 17, 80), +(35, 35, 18, -760), +(36, 36, 18, 760), (37, 37, 19, -740), (38, 38, 19, 740), (39, 39, 20, -990), +(40, 40, 20, 990); + +ANALYZE TABLE ledgers, charges, transactions, transaction_items; + +let $q= +SELECT + charges.id, + charges.from_ledger_id, + charges.to_ledger_id, + from_agg_items.num_rows AS from_num_rows +FROM charges +INNER JOIN ( + SELECT + transactions.ledger_id, + transaction_items.charge_id, + count(*) as num_rows + FROM transaction_items + INNER JOIN transactions ON transaction_items.transaction_id = transactions.id + GROUP BY transactions.ledger_id, transaction_items.charge_id +) AS from_agg_items +ON from_agg_items.charge_id = charges.id AND + from_agg_items.ledger_id = charges.from_ledger_id +WHERE charges.to_ledger_id = 2; + +set optimizer_switch='split_materialized=on'; +eval $q; +eval EXPLAIN $q; +eval EXPLAIN FORMAT=JSON $q; + +set optimizer_switch='split_materialized=off'; +eval $q; +eval EXPLAIN $q; + +INSERT INTO charges (id, from_ledger_id, to_ledger_id, amount) VALUES +(101, 4, 2, 100), (102, 7, 2, 200); + +let $q1= +SELECT + charges.id, + charges.from_ledger_id, + charges.to_ledger_id, + from_agg_items.num_rows AS from_num_rows +FROM charges +LEFT JOIN ( + SELECT + transactions.ledger_id, + transaction_items.charge_id, + count(*) as num_rows + FROM transaction_items + INNER JOIN transactions ON transaction_items.transaction_id = transactions.id + GROUP BY transactions.ledger_id, transaction_items.charge_id +) AS from_agg_items +ON from_agg_items.charge_id = charges.id AND + from_agg_items.ledger_id = charges.from_ledger_id +WHERE charges.to_ledger_id = 2; + +set optimizer_switch='split_materialized=on'; +eval $q1; +eval EXPLAIN $q1; +eval EXPLAIN FORMAT=JSON $q1; + +set optimizer_switch='split_materialized=off'; +eval $q1; +eval EXPLAIN $q1; + +set optimizer_switch='split_materialized=default'; + +DROP TABLE transaction_items; +DROP TABLE transactions; +DROP TABLE charges; +DROP TABLE ledgers; + + +--echo # +--echo # MDEV-30081: Splitting from a constant mergeable derived table +--echo # used in inner part of an outer join. +--echo # + + CREATE TABLE t1 ( id int PRIMARY KEY ) ENGINE=MyISAM; +INSERT INTO t1 VALUES (3),(4),(7); + +CREATE TABLE t2 ( + id int, id1 int, wid int, PRIMARY KEY (id), KEY (id1), KEY (wid) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (4,4,6),(7,7,7); + +CREATE TABLE t3 ( + wid int, wtid int, otid int, oid int, + PRIMARY KEY (wid), KEY (wtid), KEY (otid), KEY (oid) +) ENGINE=MyISAM; +INSERT INTO t3 VALUES (6,30,6,6),(7,17,7,7); + +CREATE TABLE t4 ( id int, a int, PRIMARY KEY (id), KEY (a) ) ENGINE=MyISAM; +INSERT INTO t4 VALUES (1,17),(2,15),(3,49),(4,3),(5,45),(6,38),(7,17); + +CREATE TABLE t5 ( + id int, id1 int, PRIMARY KEY (id), KEY id1 (id1) +) ENGINE=MyISAM ; +INSERT INTO t5 VALUES (1,17),(2,15),(3,49),(4,3),(5,45),(6,38),(7,17); + +ANALYZE TABLE t1,t2,t3,t4,t5; + +CREATE VIEW v1 AS (SELECT id1 FROM t5 GROUP BY id1); + +let $q= +SELECT t3.*, t1.id AS t1_id, t2.id AS t2_id, dt.*, v1.* +FROM + t1, t2, t3 + LEFT JOIN + (SELECT t4.* FROM t4 WHERE t4.a=3) dt + ON t3.oid = dt.id AND t3.otid = 14 + LEFT JOIN v1 + ON (v1.id1 = dt.a) +WHERE t3.oid = t1.id AND t3.oid = t2.id AND t3.wid = 7; + +eval $q; +eval EXPLAIN $q; + +DROP VIEW v1; +DROP TABLE t1,t2,t3,t4,t5; + --echo # End of 10.3 tests --echo # @@ -3652,4 +3943,55 @@ explain select * from v1; drop view v1; drop table t1; +--echo # +--echo # MDEV-31102: execution of PS for query where pushdown of condition +--echo # into view defined as union is applied +--echo # + +create table t1 ( + n int, + lv varchar(31) charset latin1, + mv varchar(31) charset utf8mb3 +) engine=myisam; +insert into t1 values (1,'aa','xxx'), ('2','bb','yyy'), (3,'cc','zzz'); +create view v1 as +select case when n=1 then lv when n=2 then mv else NULL end as r from t1 +union +select 'a'; + +let $q= +select * from v1 where r < 'x'; + +eval $q; +eval explain extended $q; +eval explain format=json $q; +eval prepare stmt from "$q"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +drop view v1; +drop table t1; + --echo # End of 10.4 tests + +--echo # +--echo # MDEV-28958: condition pushable into view after simplification +--echo # contains constant TRUE/FALSE as subformula +--echo # + +create table t1 (c1 int); +insert into t1 values (3), (7), (1), (3), (1), (3); + +create table t2 (c2 int); +insert into t2 values (3), (5), (7), (3); + +create view v1 as select * from t1 group by c1; +create view v2 as select c1 as a, c2 as b from v1,t2 where c1=c2; + +select * from v2 group by a,b having a=b or b > a+10; + +drop view v1,v2; +drop table t1,t2; + +--echo # End of 10.7 tests diff --git a/mysql-test/main/derived_split_innodb.result b/mysql-test/main/derived_split_innodb.result index 21921d86dab53..aba4f88493c27 100644 --- a/mysql-test/main/derived_split_innodb.result +++ b/mysql-test/main/derived_split_innodb.result @@ -242,5 +242,602 @@ drop table t1,t2,t3; set optimizer_switch='split_materialized=default'; set use_stat_tables=default; set optimizer_use_condition_selectivity=default; +# +# MDEV-26337: subquery with groupby and ROLLUP returns incorrect results +# (The testcase is taken from testcase for MDEV-13389 due to it being +# much smaller) +# +create table t3 (a int, b int, c char(127), index idx_b(b)) engine=myisam; +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'), +(4,71,'xx'), (3,15,'aa'), (7,82,'aa'), (8,12,'dd'), (4,15,'aa'), +(11,33,'yy'), (10,42,'zz'), (4,53,'xx'), (10,17,'yy'), (7,12,'cc'), +(8,20,'dd'), (7,32,'bb'), (1,50,'aa'), (3,40,'bb'), (3,77,'aa'); +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 +# This should use a plan with LATERAL DERIVED: +explain select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by a,c) t +on t3.a=t.a and t3.c=t.c +where t3.b > 15; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t3 range idx_b idx_b 5 NULL 2 Using index condition; Using where +1 PRIMARY ref key0 key0 133 test.t3.a,test.t3.c 2 +2 LATERAL DERIVED t4 ref idx idx 133 test.t3.a,test.t3.c 1 +# ... and if one adds WITH ROLLUP, then LATERAL DERIVED is no longer used: +explain select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by a,c with rollup) t +on t3.a=t.a and t3.c=t.c +where t3.b > 15; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t3 range idx_b idx_b 5 NULL 2 Using index condition; Using where +1 PRIMARY ref key0 key0 133 test.t3.a,test.t3.c 4 +2 DERIVED t4 ALL NULL NULL NULL NULL 40 Using filesort +drop table t3, t4; # End of 10.3 tests +# +# MDEV-26301: Split optimization refills temporary table too many times +# +create table t1(a int, b int); +insert into t1 select seq,seq from seq_1_to_5; +create table t2(a int, b int, key(a)); +insert into t2 +select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B; +create table t3(a int, b int, key(a)); +insert into t3 +select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B; +analyze table t1,t2,t3 persistent for all; +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 +test.t3 analyze status Engine-independent statistics collected +test.t3 analyze status Table is already up to date +explain +select * from +(t1 left join t2 on t2.a=t1.b) left join t3 on t3.a=t1.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 ref a a 5 test.t1.b 2 Using where +1 SIMPLE t3 ref a a 5 test.t1.b 3 Using where +create table t10 ( +grp_id int, +col1 int, +key(grp_id) +); +insert into t10 +select +A.seq, +B.seq +from +seq_1_to_100 A, +seq_1_to_100 B; +create table t11 ( +col1 int, +col2 int +); +insert into t11 +select A.seq, A.seq from seq_1_to_10 A; +analyze table t10,t11 persistent for all; +Table Op Msg_type Msg_text +test.t10 analyze status Engine-independent statistics collected +test.t10 analyze status Table is already up to date +test.t11 analyze status Engine-independent statistics collected +test.t11 analyze status OK +explain select * from +( +(t1 left join t2 on t2.a=t1.b) +left join t3 on t3.a=t1.b +) left join (select grp_id, count(*) +from t10 left join t11 on t11.col1=t10.col1 +group by grp_id) T on T.grp_id=t1.b; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 +1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where +1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where +1 PRIMARY ref key0 key0 5 test.t1.b 10 Using where +2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100 +2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +# The important part in the below output is: +# "lateral": 1, +# "query_block": { +# "select_id": 2, +# "r_loops": 5, <-- must be 5, not 30. +analyze format=json select * from +( +(t1 left join t2 on t2.a=t1.b) +left join t3 on t3.a=t1.b +) left join (select grp_id, count(*) +from t10 left join t11 on t11.col1=t10.col1 +group by grp_id) T on T.grp_id=t1.b; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "const_condition": "1", + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 5, + "r_rows": 5, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + } + }, + { + "table": { + "table_name": "t2", + "access_type": "ref", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t1.b"], + "r_loops": 5, + "rows": 2, + "r_rows": 2, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "attached_condition": "trigcond(trigcond(t1.b is not null))" + } + }, + { + "table": { + "table_name": "t3", + "access_type": "ref", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t1.b"], + "r_loops": 10, + "rows": 3, + "r_rows": 3, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "attached_condition": "trigcond(trigcond(t1.b is not null))" + } + }, + { + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["grp_id"], + "ref": ["test.t1.b"], + "r_loops": 30, + "rows": 10, + "r_rows": 1, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "attached_condition": "trigcond(trigcond(t1.b is not null))", + "materialized": { + "lateral": 1, + "query_block": { + "select_id": 2, + "r_loops": 5, + "r_total_time_ms": "REPLACED", + "outer_ref_condition": "t1.b is not null", + "nested_loop": [ + { + "table": { + "table_name": "t10", + "access_type": "ref", + "possible_keys": ["grp_id"], + "key": "grp_id", + "key_length": "5", + "used_key_parts": ["grp_id"], + "ref": ["test.t1.b"], + "r_loops": 5, + "rows": 100, + "r_rows": 100, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + } + }, + { + "block-nl-join": { + "table": { + "table_name": "t11", + "access_type": "ALL", + "r_loops": 5, + "rows": 10, + "r_rows": 10, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "1Kb", + "join_type": "BNL", + "attached_condition": "trigcond(t11.col1 = t10.col1)", + "r_loops": 500, + "r_filtered": 10, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 10 + } + } + ] + } + } + } + } + ] + } +} +create table t21 (pk int primary key); +insert into t21 values (1),(2),(3); +create table t22 (pk int primary key); +insert into t22 values (1),(2),(3); +explain +select * from +t21, t22, +( +(t1 left join t2 on t2.a=t1.b) +left join t3 on t3.a=t1.b +) left join (select grp_id, count(*) +from t10 left join t11 on t11.col1=t10.col1 +group by grp_id) T on T.grp_id=t1.b +where +t21.pk=1 and t22.pk=2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t21 const PRIMARY PRIMARY 4 const 1 Using index +1 PRIMARY t22 const PRIMARY PRIMARY 4 const 1 Using index +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 +1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where +1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where +1 PRIMARY ref key0 key0 5 test.t1.b 10 Using where +2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100 +2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +explain +select * from +t21, +( +(t1 left join t2 on t2.a=t1.b) +left join t3 on t3.a=t1.b +) left join (select grp_id, count(*) +from +t22 join t10 left join t11 on t11.col1=t10.col1 +where +t22.pk=1 +group by grp_id) T on T.grp_id=t1.b +where +t21.pk=1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t21 const PRIMARY PRIMARY 4 const 1 Using index +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 +1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where +1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where +1 PRIMARY ref key0 key0 5 test.t1.b 10 Using where +2 LATERAL DERIVED t22 const PRIMARY PRIMARY 4 const 1 Using index +2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100 +2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +create table t5 ( +pk int primary key +); +insert into t5 select seq from seq_1_to_1000; +explain +select * from +t21, +( +(((t1 join t5 on t5.pk=t1.b)) left join t2 on t2.a=t1.b) +left join t3 on t3.a=t1.b +) left join (select grp_id, count(*) +from +t22 join t10 left join t11 on t11.col1=t10.col1 +where +t22.pk=1 +group by grp_id) T on T.grp_id=t1.b +where +t21.pk=1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t21 const PRIMARY PRIMARY 4 const 1 Using index +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY t5 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using index +1 PRIMARY t2 ref a a 5 test.t1.b 2 +1 PRIMARY t3 ref a a 5 test.t1.b 3 +1 PRIMARY ref key0 key0 5 test.t1.b 10 Using where +2 LATERAL DERIVED t22 const PRIMARY PRIMARY 4 const 1 Using index +2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t5.pk 100 Using index condition +2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +drop table t1,t2,t3,t5, t10, t11, t21, t22; +create table t1(a int, b int); +insert into t1 select seq,seq from seq_1_to_5; +create table t2(a int, b int, key(a)); +insert into t2 +select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B; +create table t3(a int, b int, key(a)); +insert into t3 +select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B; +analyze table t1,t2,t3 persistent for all; +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 +test.t3 analyze status Engine-independent statistics collected +test.t3 analyze status Table is already up to date +create table t10 ( +grp_id int, +col1 int, +key(grp_id) +); +insert into t10 +select +A.seq, +B.seq +from +seq_1_to_100 A, +seq_1_to_100 B; +create table t11 ( +col1 int, +col2 int +); +insert into t11 +select A.seq, A.seq from seq_1_to_10 A; +analyze table t10,t11 persistent for all; +Table Op Msg_type Msg_text +test.t10 analyze status Engine-independent statistics collected +test.t10 analyze status Table is already up to date +test.t11 analyze status Engine-independent statistics collected +test.t11 analyze status OK +explain select * +from +( +(t1 left join t2 on t2.a=t1.b) +left join +t3 +on t3.a=t1.b +) +left join +( +select grp_id, count(*) +from t10 left join t11 on t11.col1=t10.col1 +group by grp_id +)dt +on dt.grp_id=t1.b; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 +1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where +1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where +1 PRIMARY ref key0 key0 5 test.t1.b 10 Using where +2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100 +2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +select * +from +( +(t1 left join t2 on t2.a=t1.b) +left join +t3 +on t3.a=t1.b +) +left join +( +select grp_id, count(*) +from t10 left join t11 on t11.col1=t10.col1 +group by grp_id +)dt +on dt.grp_id=t1.b; +a b a b a b grp_id count(*) +1 1 1 1 1 1 1 100 +1 1 1 1 1 2 1 100 +1 1 1 1 1 3 1 100 +1 1 1 2 1 1 1 100 +1 1 1 2 1 2 1 100 +1 1 1 2 1 3 1 100 +2 2 2 1 2 1 2 100 +2 2 2 1 2 2 2 100 +2 2 2 1 2 3 2 100 +2 2 2 2 2 1 2 100 +2 2 2 2 2 2 2 100 +2 2 2 2 2 3 2 100 +3 3 3 1 3 1 3 100 +3 3 3 1 3 2 3 100 +3 3 3 1 3 3 3 100 +3 3 3 2 3 1 3 100 +3 3 3 2 3 2 3 100 +3 3 3 2 3 3 3 100 +4 4 4 1 4 1 4 100 +4 4 4 1 4 2 4 100 +4 4 4 1 4 3 4 100 +4 4 4 2 4 1 4 100 +4 4 4 2 4 2 4 100 +4 4 4 2 4 3 4 100 +5 5 5 1 5 1 5 100 +5 5 5 1 5 2 5 100 +5 5 5 1 5 3 5 100 +5 5 5 2 5 1 5 100 +5 5 5 2 5 2 5 100 +5 5 5 2 5 3 5 100 +set join_cache_level=4; +explain select * +from +( +(t1 left join t2 on t2.a=t1.b) +left join +t3 +on t3.a=t1.b +) +left join +( +select grp_id, count(*) +from t10 left join t11 on t11.col1=t10.col1 +group by grp_id +)dt +on dt.grp_id=t1.b; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 +1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where +1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where +1 PRIMARY ref key0 key0 5 test.t1.b 10 Using where +2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100 +2 LATERAL DERIVED t11 hash_ALL NULL #hash#$hj 5 test.t10.col1 10 Using where; Using join buffer (flat, BNLH join) +select * +from +( +(t1 left join t2 on t2.a=t1.b) +left join +t3 +on t3.a=t1.b +) +left join +( +select grp_id, count(*) +from t10 left join t11 on t11.col1=t10.col1 +group by grp_id +)dt +on dt.grp_id=t1.b; +a b a b a b grp_id count(*) +1 1 1 1 1 1 1 100 +1 1 1 1 1 2 1 100 +1 1 1 1 1 3 1 100 +1 1 1 2 1 1 1 100 +1 1 1 2 1 2 1 100 +1 1 1 2 1 3 1 100 +2 2 2 1 2 1 2 100 +2 2 2 1 2 2 2 100 +2 2 2 1 2 3 2 100 +2 2 2 2 2 1 2 100 +2 2 2 2 2 2 2 100 +2 2 2 2 2 3 2 100 +3 3 3 1 3 1 3 100 +3 3 3 1 3 2 3 100 +3 3 3 1 3 3 3 100 +3 3 3 2 3 1 3 100 +3 3 3 2 3 2 3 100 +3 3 3 2 3 3 3 100 +4 4 4 1 4 1 4 100 +4 4 4 1 4 2 4 100 +4 4 4 1 4 3 4 100 +4 4 4 2 4 1 4 100 +4 4 4 2 4 2 4 100 +4 4 4 2 4 3 4 100 +5 5 5 1 5 1 5 100 +5 5 5 1 5 2 5 100 +5 5 5 1 5 3 5 100 +5 5 5 2 5 1 5 100 +5 5 5 2 5 2 5 100 +5 5 5 2 5 3 5 100 +set join_cache_level=default; +drop index a on t2; +drop index a on t3; +explain select * +from +( +(t1 left join t2 on t2.a=t1.b) +left join +t3 +on t3.a=t1.b +) +left join +( +select grp_id, count(*) +from t10 left join t11 on t11.col1=t10.col1 +group by grp_id +)dt +on dt.grp_id=t1.b; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 +1 PRIMARY t2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY ref key0 key0 5 test.t1.b 1000 Using where +2 DERIVED t10 ALL grp_id NULL NULL NULL 10000 Using temporary; Using filesort +2 DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +select * +from +( +(t1 left join t2 on t2.a=t1.b) +left join +t3 +on t3.a=t1.b +) +left join +( +select grp_id, count(*) +from t10 left join t11 on t11.col1=t10.col1 +group by grp_id +)dt +on dt.grp_id=t1.b; +a b a b a b grp_id count(*) +1 1 1 1 1 1 1 100 +1 1 1 2 1 1 1 100 +1 1 1 1 1 2 1 100 +1 1 1 2 1 2 1 100 +1 1 1 1 1 3 1 100 +1 1 1 2 1 3 1 100 +2 2 2 1 2 1 2 100 +2 2 2 2 2 1 2 100 +2 2 2 1 2 2 2 100 +2 2 2 2 2 2 2 100 +2 2 2 1 2 3 2 100 +2 2 2 2 2 3 2 100 +3 3 3 1 3 1 3 100 +3 3 3 2 3 1 3 100 +3 3 3 1 3 2 3 100 +3 3 3 2 3 2 3 100 +3 3 3 1 3 3 3 100 +3 3 3 2 3 3 3 100 +4 4 4 1 4 1 4 100 +4 4 4 2 4 1 4 100 +4 4 4 1 4 2 4 100 +4 4 4 2 4 2 4 100 +4 4 4 1 4 3 4 100 +4 4 4 2 4 3 4 100 +5 5 5 1 5 1 5 100 +5 5 5 2 5 1 5 100 +5 5 5 1 5 2 5 100 +5 5 5 2 5 2 5 100 +5 5 5 1 5 3 5 100 +5 5 5 2 5 3 5 100 +drop table t1,t2,t3; +drop table t10, t11; +# +# MDEV-31194: Server crash or assertion failure with join_cache_level=4 +# (a followup to the above bug, MDEV-26301) +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (3),(4); +CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=Aria; +INSERT INTO t2 VALUES (1),(2); +set @tmp1= @@optimizer_switch, @tmp2= @@join_cache_level; +set +optimizer_switch= 'derived_with_keys=off', +join_cache_level= 4; +SELECT t1.* FROM t1 JOIN (SELECT id, COUNT(*) FROM t2 GROUP BY id) sq ON sq.id= t1.a; +a +set optimizer_switch= @tmp1, join_cache_level= @tmp2; +DROP TABLE t1, t2; +# End of 10.4 tests SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent; diff --git a/mysql-test/main/derived_split_innodb.test b/mysql-test/main/derived_split_innodb.test index de25fd8e3d3d5..6ccbc31d88659 100644 --- a/mysql-test/main/derived_split_innodb.test +++ b/mysql-test/main/derived_split_innodb.test @@ -195,6 +195,277 @@ set optimizer_switch='split_materialized=default'; set use_stat_tables=default; set optimizer_use_condition_selectivity=default; +--echo # +--echo # MDEV-26337: subquery with groupby and ROLLUP returns incorrect results +--echo # (The testcase is taken from testcase for MDEV-13389 due to it being +--echo # much smaller) +--echo # + +create table t3 (a int, b int, c char(127), index idx_b(b)) engine=myisam; +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'), +(4,71,'xx'), (3,15,'aa'), (7,82,'aa'), (8,12,'dd'), (4,15,'aa'), +(11,33,'yy'), (10,42,'zz'), (4,53,'xx'), (10,17,'yy'), (7,12,'cc'), +(8,20,'dd'), (7,32,'bb'), (1,50,'aa'), (3,40,'bb'), (3,77,'aa'); +insert into t4 select a+10, b+10, concat(c,'f') from t4; +analyze table t3,t4; + +--echo # This should use a plan with LATERAL DERIVED: +explain select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by a,c) t +on t3.a=t.a and t3.c=t.c +where t3.b > 15; + +--echo # ... and if one adds WITH ROLLUP, then LATERAL DERIVED is no longer used: +explain select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by a,c with rollup) t +on t3.a=t.a and t3.c=t.c +where t3.b > 15; + +drop table t3, t4; + --echo # End of 10.3 tests + +--echo # +--echo # MDEV-26301: Split optimization refills temporary table too many times +--echo # + +# 5 values +create table t1(a int, b int); +insert into t1 select seq,seq from seq_1_to_5; + +# 5 value groups of size 2 each +create table t2(a int, b int, key(a)); +insert into t2 +select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B; + +# 5 value groups of size 3 each +create table t3(a int, b int, key(a)); +insert into t3 +select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B; + +analyze table t1,t2,t3 persistent for all; + +explain +select * from + (t1 left join t2 on t2.a=t1.b) left join t3 on t3.a=t1.b; + +# Now, create tables for Groups. + +create table t10 ( + grp_id int, + col1 int, + key(grp_id) +); + +# 100 groups of 100 values each +insert into t10 +select + A.seq, + B.seq +from + seq_1_to_100 A, + seq_1_to_100 B; + +# and X10 multiplier + +create table t11 ( + col1 int, + col2 int +); +insert into t11 +select A.seq, A.seq from seq_1_to_10 A; + +analyze table t10,t11 persistent for all; + +let $q1= +select * from + ( + (t1 left join t2 on t2.a=t1.b) + left join t3 on t3.a=t1.b + ) left join (select grp_id, count(*) + from t10 left join t11 on t11.col1=t10.col1 + group by grp_id) T on T.grp_id=t1.b; + +eval +explain $q1; + +--echo # The important part in the below output is: +--echo # "lateral": 1, +--echo # "query_block": { +--echo # "select_id": 2, +--echo # "r_loops": 5, <-- must be 5, not 30. +--source include/analyze-format.inc + +eval +analyze format=json $q1; + +create table t21 (pk int primary key); +insert into t21 values (1),(2),(3); + +create table t22 (pk int primary key); +insert into t22 values (1),(2),(3); + +# Same as above but throw in a couple of const tables. +explain +select * from + t21, t22, + ( + (t1 left join t2 on t2.a=t1.b) + left join t3 on t3.a=t1.b + ) left join (select grp_id, count(*) + from t10 left join t11 on t11.col1=t10.col1 + group by grp_id) T on T.grp_id=t1.b +where + t21.pk=1 and t22.pk=2; + +explain +select * from + t21, + ( + (t1 left join t2 on t2.a=t1.b) + left join t3 on t3.a=t1.b + ) left join (select grp_id, count(*) + from + t22 join t10 left join t11 on t11.col1=t10.col1 + where + t22.pk=1 + group by grp_id) T on T.grp_id=t1.b +where + t21.pk=1; + +# And also add a non-const table + +create table t5 ( + pk int primary key + ); +insert into t5 select seq from seq_1_to_1000; + +explain +select * from + t21, + ( + (((t1 join t5 on t5.pk=t1.b)) left join t2 on t2.a=t1.b) + left join t3 on t3.a=t1.b + ) left join (select grp_id, count(*) + from + t22 join t10 left join t11 on t11.col1=t10.col1 + where + t22.pk=1 + group by grp_id) T on T.grp_id=t1.b +where + t21.pk=1; + +drop table t1,t2,t3,t5, t10, t11, t21, t22; + +# 5 values +create table t1(a int, b int); +insert into t1 select seq,seq from seq_1_to_5; + +# 5 value groups of size 2 each +create table t2(a int, b int, key(a)); +insert into t2 +select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B; + +# 5 value groups of size 3 each +create table t3(a int, b int, key(a)); +insert into t3 +select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B; + +analyze table t1,t2,t3 persistent for all; + +create table t10 ( + grp_id int, + col1 int, + key(grp_id) +); + +# 100 groups of 100 values each +insert into t10 +select + A.seq, + B.seq +from + seq_1_to_100 A, + seq_1_to_100 B; + +# and X10 multiplier + +create table t11 ( + col1 int, + col2 int +); +insert into t11 +select A.seq, A.seq from seq_1_to_10 A; + +analyze table t10,t11 persistent for all; + +let $q= +select * +from + ( + (t1 left join t2 on t2.a=t1.b) + left join + t3 + on t3.a=t1.b + ) + left join + ( + select grp_id, count(*) + from t10 left join t11 on t11.col1=t10.col1 + group by grp_id + )dt + on dt.grp_id=t1.b; + +eval explain $q; +eval $q; + +set join_cache_level=4; +eval explain $q; +eval $q; + +set join_cache_level=default; + +drop index a on t2; +drop index a on t3; + +eval explain $q; +eval $q; + +drop table t1,t2,t3; +drop table t10, t11; + + +--echo # +--echo # MDEV-31194: Server crash or assertion failure with join_cache_level=4 +--echo # (a followup to the above bug, MDEV-26301) +--echo # +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (3),(4); + +CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=Aria; +INSERT INTO t2 VALUES (1),(2); + +set @tmp1= @@optimizer_switch, @tmp2= @@join_cache_level; +set + optimizer_switch= 'derived_with_keys=off', + join_cache_level= 4; + +SELECT t1.* FROM t1 JOIN (SELECT id, COUNT(*) FROM t2 GROUP BY id) sq ON sq.id= t1.a; + +set optimizer_switch= @tmp1, join_cache_level= @tmp2; + +# Cleanup +DROP TABLE t1, t2; + +--echo # End of 10.4 tests + SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent; diff --git a/mysql-test/main/derived_view.result b/mysql-test/main/derived_view.result index 09e9fd6d55c6e..6bc9b4246f0ca 100644 --- a/mysql-test/main/derived_view.result +++ b/mysql-test/main/derived_view.result @@ -2459,8 +2459,6 @@ SELECT * FROM t1; a 1 1 -1 -1 drop table t1,t2; set optimizer_switch=@save968720_optimizer_switch; # @@ -2774,7 +2772,7 @@ ON p.id = g.p_random ORDER BY gallery_name ASC ; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +1 PRIMARY ALL NULL NULL NULL NULL 10 Using filesort 1 PRIMARY p eq_ref PRIMARY PRIMARY 4 g.p_random 1 Using where 2 DERIVED gal ALL NULL NULL NULL NULL 10 3 DEPENDENT SUBQUERY pi ref gallery_id gallery_id 4 test.gal.id 4 Using temporary; Using filesort @@ -3576,4 +3574,744 @@ a 7 drop view v1; drop table t1; +# +# MDEV-24454 Second execution of SELECT containing set function +# MDEV-25086: whose only argument is an outer reference to a column +# of mergeable view/derived/table/CTE +# +create table t1 (a int); +create table t2 (b int); +insert into t1 values (3), (1), (3); +insert into t2 values (70), (30), (70); +create view v1 as select * from t2; +prepare stmt from " +select (select sum(b) from t1 where a=1) as r from v1; +"; +execute stmt; +r +170 +execute stmt; +r +170 +deallocate prepare stmt; +prepare stmt from " +select (select sum(b) from t1 where a=1) as r from (select * from t2) dt; +"; +execute stmt; +r +170 +execute stmt; +r +170 +deallocate prepare stmt; +prepare stmt from " +with cte as (select * from t2) +select (select sum(b) from t1 where a=1) as r from cte; +"; +execute stmt; +r +170 +execute stmt; +r +170 +deallocate prepare stmt; +prepare stmt from " +select (select sum(b) from t1 where a=1) as r +from (select * from v1 where b > 50) dt; +"; +execute stmt; +r +140 +execute stmt; +r +140 +deallocate prepare stmt; +prepare stmt from " +select (select sum(b) from t1 where a=1) as r +from (select * from (select * from t2) dt1 where b > 50) dt; +"; +execute stmt; +r +140 +execute stmt; +r +140 +deallocate prepare stmt; +prepare stmt from " +with cte as (select * from (select * from t2) dt1 where b > 50) +select (select sum(b) from t1 where a=1) as r from cte; +"; +execute stmt; +r +140 +execute stmt; +r +140 +deallocate prepare stmt; +create procedure sp1() +begin +select (select sum(b) from t1 where a=1) as r from v1; +end | +call sp1(); +r +170 +call sp1(); +r +170 +drop procedure sp1; +create procedure sp1() +begin +select (select sum(b) from t1 where a=1) as r from (select * from t2) dt; +end | +call sp1(); +r +170 +call sp1(); +r +170 +drop procedure sp1; +create procedure sp1() +begin +with cte as (select * from t2) +select (select sum(b) from t1 where a=1) as r from cte; +end | +call sp1(); +r +170 +call sp1(); +r +170 +drop procedure sp1; +drop view v1; +drop table t1,t2; +CREATE TABLE t1(f0 INT); +INSERT INTO t1 VALUES (3); +CREATE VIEW v1 AS SELECT f0 AS f1 FROM t1; +CREATE VIEW v2 AS +SELECT +(SELECT GROUP_CONCAT(v1.f1 SEPARATOR ', ') FROM v1 n) AS f2, +GROUP_CONCAT('aa' SEPARATOR ', ') AS f3 +FROM v1; +CREATE VIEW v3 AS SELECT * FROM v2; +CREATE PROCEDURE p1() +SELECT * FROM v3; +CALL p1(); +f2 f3 +3 aa +CALL p1(); +f2 f3 +3 aa +DROP PROCEDURE p1; +DROP VIEW v1,v2,v3; +DROP TABLE t1; +# +# MDEV-27212: 2-nd execution of PS for select with embedded derived tables +# and correlated subquery in select list of outer derived +# +create table t1 ( id int, id2 int ) engine=myisam; +create table t2 ( x3 int , x1 int , x2 int, a1 int) engine=myisam; +insert into t1 values (3, 2), (4, 2), (3, 4); +insert into t2 values (1, 2, 2, 1), (1, 3, 3, 2), (2, 3, 3, 1); +prepare stmt from "select id from t1 +join +( select dt2.x1, +( select sum(a1) from t2 where t2.x1 = dt2.x1 ) m +from ( select x1 from t2 u where x3 = 1 ) dt2 +) dt +on t1.id = dt.x1 +where t1.id2 < dt.m"; +execute stmt; +id +3 +execute stmt; +id +3 +deallocate prepare stmt; +create procedure sp1() select id from t1 +join +( select dt2.x1, +( select sum(a1) from t2 where t2.x1 = dt2.x1 ) m +from ( select x1 from t2 u where x3 = 1 ) dt2 +) dt +on t1.id = dt.x1 +where t1.id2 < dt.m; +call sp1(); +id +3 +call sp1(); +id +3 +create view v2 as select x1 from t2 u where x3 = 1; +create view v as +select v2.x1, +( select sum(a1) from t2 where t2.x1 = v2.x1 ) m from v2; +prepare stmt from "select id from t1 join v on t1.id = v.x1 where t1.id2 < v.m"; +execute stmt; +id +3 +execute stmt; +id +3 +deallocate prepare stmt; +create procedure sp2() select id from t1 join v on t1.id = v.x1 where t1.id2 < v.m; +call sp2(); +id +3 +call sp2(); +id +3 +drop procedure sp1; +drop procedure sp2; +drop view v, v2; +drop table t1,t2; # End of 10.2 tests +# +# MDEV-30706: view defined as select with implicit grouping and +# a set function used in a subquery +# +CREATE TABLE t1 (a INT PRIMARY KEY, b INT); +INSERT INTO t1 VALUES (1,1), (2,2); +CREATE TABLE t2 (a INT PRIMARY KEY, b INT); +INSERT INTO t2 VALUES (1,1), (3,3); +CREATE TABLE t3 (a INT PRIMARY KEY, b INT); +INSERT INTO t3 VALUES (2,2), (4,4), (7,7); +CREATE TABLE t4 (a INT PRIMARY KEY, b INT); +INSERT INTO t4 VALUES (2,2), (5,5), (7,7); +CREATE VIEW v AS SELECT +(SELECT SUM(t4.b) FROM t1, t2 WHERE t1.a = t2.b GROUP BY t1.a) AS m +FROM t3, t4 +WHERE t3.a = t4.b; +SELECT +(SELECT SUM(t4.b) FROM t1, t2 WHERE t1.a = t2.b GROUP BY t1.a) AS m +FROM t3, t4 +WHERE t3.a = t4.b; +m +9 +SELECT * FROM v; +m +9 +WITH cte AS ( SELECT +(SELECT SUM(t4.b) FROM t1, t2 WHERE t1.a = t2.b GROUP BY t1.a) AS m +FROM t3, t4 +WHERE t3.a = t4.b ) SELECT * FROM cte; +m +9 +EXPLAIN SELECT +(SELECT SUM(t4.b) FROM t1, t2 WHERE t1.a = t2.b GROUP BY t1.a) AS m +FROM t3, t4 +WHERE t3.a = t4.b; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t4 ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t4.b 1 Using index +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort +2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 Using index +EXPLAIN SELECT * FROM v; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 3 +2 SUBQUERY t4 ALL NULL NULL NULL NULL 3 Using where +2 SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t4.b 1 Using index +3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort +3 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 Using index +EXPLAIN WITH cte AS ( SELECT +(SELECT SUM(t4.b) FROM t1, t2 WHERE t1.a = t2.b GROUP BY t1.a) AS m +FROM t3, t4 +WHERE t3.a = t4.b ) SELECT * FROM cte; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 3 +2 DERIVED t4 ALL NULL NULL NULL NULL 3 Using where +2 DERIVED t3 eq_ref PRIMARY PRIMARY 4 test.t4.b 1 Using index +3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort +3 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 Using index +PREPARE stmt FROM "SELECT +(SELECT SUM(t4.b) FROM t1, t2 WHERE t1.a = t2.b GROUP BY t1.a) AS m +FROM t3, t4 +WHERE t3.a = t4.b"; +execute stmt; +m +9 +execute stmt; +m +9 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM "SELECT * FROM v"; +execute stmt; +m +9 +execute stmt; +m +9 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM "WITH cte AS ( SELECT +(SELECT SUM(t4.b) FROM t1, t2 WHERE t1.a = t2.b GROUP BY t1.a) AS m +FROM t3, t4 +WHERE t3.a = t4.b ) SELECT * FROM cte"; +execute stmt; +m +9 +execute stmt; +m +9 +DEALLOCATE PREPARE stmt; +DROP VIEW v; +DROP TABLE t1,t2,t3,t4; +# +# MDEV-29224: view defined as select with implicit grouping and +# a set function used in a subquery +# +CREATE TABLE t1 (f1 INT); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (f2 int); +INSERT INTO t2 VALUES (3); +CREATE VIEW v AS SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1; +SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1; +( SELECT MAX(f1) FROM t2 ) +2 +SELECT * FROM v; +( SELECT MAX(f1) FROM t2 ) +2 +WITH cte AS ( SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1 ) SELECT * FROM cte; +( SELECT MAX(f1) FROM t2 ) +2 +EXPLAIN SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 +EXPLAIN SELECT * FROM v; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 +2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +3 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 +EXPLAIN WITH cte AS ( SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1 ) SELECT * FROM cte; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 2 +3 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 +PREPARE stmt FROM "SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1"; +execute stmt; +( SELECT MAX(f1) FROM t2 ) +2 +execute stmt; +( SELECT MAX(f1) FROM t2 ) +2 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM "SELECT * FROM v"; +execute stmt; +( SELECT MAX(f1) FROM t2 ) +2 +execute stmt; +( SELECT MAX(f1) FROM t2 ) +2 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM "WITH cte AS ( SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1 ) SELECT * FROM cte"; +execute stmt; +( SELECT MAX(f1) FROM t2 ) +2 +execute stmt; +( SELECT MAX(f1) FROM t2 ) +2 +DEALLOCATE PREPARE stmt; +DROP VIEW v; +DROP TABLE t1,t2; +# +# MDEV-28573: view defined as select with implicit grouping and +# a set function used in a subquery +# +CREATE TABLE t1 (a INTEGER, b INTEGER); +CREATE TABLE t2 (c INTEGER); +INSERT INTO t1 VALUES (1,11), (2,22), (2,22); +INSERT INTO t2 VALUES (1), (2); +CREATE VIEW v1 AS SELECT (SELECT COUNT(b) FROM t2) FROM t1; +CREATE VIEW v2 AS SELECT (SELECT COUNT(b) FROM t2 WHERE c > 1) FROM t1; +SELECT (SELECT COUNT(b) FROM t2) FROM t1; +ERROR 21000: Subquery returns more than 1 row +SELECT * FROM v1; +ERROR 21000: Subquery returns more than 1 row +WITH cte AS ( SELECT (SELECT COUNT(b) FROM t2) FROM t1 ) SELECT * FROM cte; +ERROR 21000: Subquery returns more than 1 row +SELECT (SELECT COUNT(b) FROM t2 WHERE c > 1) FROM t1; +(SELECT COUNT(b) FROM t2 WHERE c > 1) +3 +SELECT * FROM v2; +(SELECT COUNT(b) FROM t2 WHERE c > 1) +3 +WITH cte AS ( SELECT (SELECT COUNT(b) FROM t2 WHERE c > 1) FROM t1 ) SELECT * FROM cte; +(SELECT COUNT(b) FROM t2 WHERE c > 1) +3 +EXPLAIN SELECT (SELECT COUNT(b) FROM t2) FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 +EXPLAIN SELECT * FROM v1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 3 +2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 +3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 +EXPLAIN WITH cte AS ( SELECT (SELECT COUNT(b) FROM t2) FROM t1 ) SELECT * FROM cte; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 3 +2 DERIVED t1 ALL NULL NULL NULL NULL 3 +3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 +PREPARE stmt FROM "SELECT (SELECT COUNT(b) FROM t2) FROM t1"; +execute stmt; +ERROR 21000: Subquery returns more than 1 row +execute stmt; +ERROR 21000: Subquery returns more than 1 row +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM "SELECT * FROM v1"; +execute stmt; +ERROR 21000: Subquery returns more than 1 row +execute stmt; +ERROR 21000: Subquery returns more than 1 row +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM "WITH cte AS ( SELECT (SELECT COUNT(b) FROM t2) FROM t1 ) SELECT * FROM cte"; +execute stmt; +ERROR 21000: Subquery returns more than 1 row +execute stmt; +ERROR 21000: Subquery returns more than 1 row +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM "SELECT (SELECT COUNT(b) FROM t2 WHERE c > 1) FROM t1"; +execute stmt; +(SELECT COUNT(b) FROM t2 WHERE c > 1) +3 +execute stmt; +(SELECT COUNT(b) FROM t2 WHERE c > 1) +3 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM "SELECT * FROM v2"; +execute stmt; +(SELECT COUNT(b) FROM t2 WHERE c > 1) +3 +execute stmt; +(SELECT COUNT(b) FROM t2 WHERE c > 1) +3 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM "WITH cte AS ( SELECT (SELECT COUNT(b) FROM t2 WHERE c > 1) FROM t1 ) SELECT * FROM cte"; +execute stmt; +(SELECT COUNT(b) FROM t2 WHERE c > 1) +3 +execute stmt; +(SELECT COUNT(b) FROM t2 WHERE c > 1) +3 +DEALLOCATE PREPARE stmt; +DROP VIEW v1,v2; +DROP TABLE t1,t2; +# +# MDEV-28570: VIEW with WHERE containing subquery +# with set function aggregated in query +# +CREATE TABLE t1 (a int, b int); +CREATE TABLE t2 (c int, d int); +INSERT INTO t1 VALUES +(1,10), (2,10), (1,20), (2,20), (3,20), (2,30), (4,40); +INSERT INTO t2 VALUES +(2,10), (2,20), (4,10), (5,10), (3,20), (2,40); +CREATE VIEW v AS SELECT a FROM t1 GROUP BY a +HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20); +SELECT a FROM t1 GROUP BY a +HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20); +a +2 +4 +SELECT * FROM v; +a +2 +4 +WITH cte AS ( SELECT a FROM t1 GROUP BY a +HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20) ) SELECT * FROM cte; +a +2 +4 +EXPLAIN SELECT a FROM t1 GROUP BY a +HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using temporary; Using filesort +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 +EXPLAIN SELECT * FROM v; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 7 +2 DERIVED t1 ALL NULL NULL NULL NULL 7 Using temporary; Using filesort +3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 +EXPLAIN WITH cte AS ( SELECT a FROM t1 GROUP BY a +HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20) ) SELECT * FROM cte; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 7 +2 DERIVED t1 ALL NULL NULL NULL NULL 7 Using temporary; Using filesort +3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 +PREPARE stmt FROM "SELECT a FROM t1 GROUP BY a +HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20)"; +execute stmt; +a +2 +4 +execute stmt; +a +2 +4 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM "SELECT * FROM v"; +execute stmt; +a +2 +4 +execute stmt; +a +2 +4 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM "WITH cte AS ( SELECT a FROM t1 GROUP BY a +HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20) ) SELECT * FROM cte"; +execute stmt; +a +2 +4 +execute stmt; +a +2 +4 +DEALLOCATE PREPARE stmt; +DROP VIEW v; +DROP TABLE t1,t2; +# +# MDEV-28571: VIEW with select list containing subquery +# with set function aggregated in query +# +CREATE TABLE t1 (a int, b int); +CREATE TABLE t2 (m int, n int); +INSERT INTO t1 VALUES (2,2), (2,2), (3,3), (3,3), (3,3), (4,4); +INSERT INTO t2 VALUES (1,11), (2,22), (3,32), (4,44), (4,44); +CREATE VIEW v AS SELECT (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a) AS c +FROM t1 +GROUP BY a; +SELECT (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a) AS c +FROM t1 +GROUP BY a; +c +2 +3 +1,1 +SELECT * FROM v; +c +2 +3 +1,1 +WITH cte AS ( SELECT (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a) AS c +FROM t1 +GROUP BY a ) SELECT * FROM cte; +c +2 +3 +1,1 +EXPLAIN SELECT (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a) AS c +FROM t1 +GROUP BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 Using where +EXPLAIN SELECT * FROM v; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 6 +2 DERIVED t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort +3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 Using where +EXPLAIN WITH cte AS ( SELECT (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a) AS c +FROM t1 +GROUP BY a ) SELECT * FROM cte; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 6 +2 DERIVED t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort +3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 Using where +PREPARE stmt FROM "SELECT (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a) AS c +FROM t1 +GROUP BY a"; +execute stmt; +c +2 +3 +1,1 +execute stmt; +c +2 +3 +1,1 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM "SELECT * FROM v"; +execute stmt; +c +2 +3 +1,1 +execute stmt; +c +2 +3 +1,1 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM "WITH cte AS ( SELECT (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a) AS c +FROM t1 +GROUP BY a ) SELECT * FROM cte"; +execute stmt; +c +2 +3 +1,1 +execute stmt; +c +2 +3 +1,1 +DEALLOCATE PREPARE stmt; +DROP VIEW v; +DROP TABLE t1,t2; +# +# MDEV-30668: VIEW with WHERE containing nested subquery +# with set function aggregated in outer subquery +# +create table t1 (a int); +insert into t1 values (3), (7), (1); +create table t2 (b int); +insert into t2 values (2), (1), (4), (7); +create table t3 (a int, b int); +insert into t3 values (2,10), (7,30), (2,30), (1,10), (7,40); +create view v as select * from t1 +where t1.a in (select t3.a from t3 group by t3.a +having t3.a > any (select t2.b from t2 +where t2.b*10 < sum(t3.b))); +select * from t1 +where t1.a in (select t3.a from t3 group by t3.a +having t3.a > any (select t2.b from t2 +where t2.b*10 < sum(t3.b))); +a +7 +select * from v; +a +7 +with cte as ( select * from t1 +where t1.a in (select t3.a from t3 group by t3.a +having t3.a > any (select t2.b from t2 +where t2.b*10 < sum(t3.b))) ) select * from cte; +a +7 +explain select * from t1 +where t1.a in (select t3.a from t3 group by t3.a +having t3.a > any (select t2.b from t2 +where t2.b*10 < sum(t3.b))); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY eq_ref distinct_key distinct_key 4 test.t1.a 1 +2 MATERIALIZED t3 ALL NULL NULL NULL NULL 5 Using temporary +3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using where +explain select * from v; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY eq_ref distinct_key distinct_key 4 test.t1.a 1 +3 MATERIALIZED t3 ALL NULL NULL NULL NULL 5 Using temporary +4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using where +explain with cte as ( select * from t1 +where t1.a in (select t3.a from t3 group by t3.a +having t3.a > any (select t2.b from t2 +where t2.b*10 < sum(t3.b))) ) select * from cte; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY eq_ref distinct_key distinct_key 4 test.t1.a 1 +3 MATERIALIZED t3 ALL NULL NULL NULL NULL 5 Using temporary +4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using where +prepare stmt from "select * from t1 +where t1.a in (select t3.a from t3 group by t3.a +having t3.a > any (select t2.b from t2 +where t2.b*10 < sum(t3.b)))"; +execute stmt; +a +7 +execute stmt; +a +7 +deallocate prepare stmt; +prepare stmt from "select * from v"; +execute stmt; +a +7 +execute stmt; +a +7 +deallocate prepare stmt; +prepare stmt from "with cte as ( select * from t1 +where t1.a in (select t3.a from t3 group by t3.a +having t3.a > any (select t2.b from t2 +where t2.b*10 < sum(t3.b))) ) select * from cte"; +execute stmt; +a +7 +execute stmt; +a +7 +deallocate prepare stmt; +drop view v; +drop table t1,t2,t3; +# End of 10.4 tests +# +# MDEV-31143: view with ORDER BY used in query with rownum() in WHERE +# +create table t1 (id int primary key); +insert into t1 values (3), (7), (1); +create table t2 (a int); +insert into t2 values (2), (4); +create view v as select a from t2 order by a; +set big_tables= 1; +Warnings: +Warning 1287 '@@big_tables' is deprecated and will be removed in a future release +select t1.id from v, t1 where rownum() = 1 group by t1.id; +id +1 +set big_tables=default; +Warnings: +Warning 1287 '@@big_tables' is deprecated and will be removed in a future release +drop view v; +drop table t1, t2; +# +# MDEV-31162: multi-table mergeable view with ORDER BY used +# in query with rownum() in WHERE +# +create table t1 (a INT) engine=MyISAM; +insert into t1 values (1),(2); +create table t2 (b INT) engine=MyISAM; +insert into t2 values (3),(4); +create view v1 AS select * from t1 join t2 order by b; +explain select * from v1 where rownum() <= 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +select * from v1 where rownum() <= 2; +a b +1 3 +2 3 +prepare stmt from "select * from v1 where rownum() <= 2"; +execute stmt; +a b +1 3 +2 3 +execute stmt; +a b +1 3 +2 3 +deallocate prepare stmt; +create view v2 AS select * from t1 join t2 order by b/a; +explain select * from v2 where rownum() <= 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +select * from v2 where rownum() <= 2; +a b +2 3 +1 3 +prepare stmt from "select * from v2 where rownum() <= 2"; +execute stmt; +a b +2 3 +1 3 +execute stmt; +a b +2 3 +1 3 +deallocate prepare stmt; +drop view v1,v2; +drop table t1,t2; +# End of 10.6 tests diff --git a/mysql-test/main/derived_view.test b/mysql-test/main/derived_view.test index 9ab1ddd3a765c..777389a984430 100644 --- a/mysql-test/main/derived_view.test +++ b/mysql-test/main/derived_view.test @@ -1,3 +1,5 @@ +--source include/no_view_protocol.inc + --source include/default_optimizer_switch.inc --disable_warnings @@ -2289,4 +2291,526 @@ select * from ((select a from t1 limit 2) order by a desc) dt; drop view v1; drop table t1; +--echo # +--echo # MDEV-24454 Second execution of SELECT containing set function +--echo # MDEV-25086: whose only argument is an outer reference to a column +--echo # of mergeable view/derived/table/CTE +--echo # + +create table t1 (a int); +create table t2 (b int); +insert into t1 values (3), (1), (3); +insert into t2 values (70), (30), (70); +create view v1 as select * from t2; + +prepare stmt from " +select (select sum(b) from t1 where a=1) as r from v1; +"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +prepare stmt from " +select (select sum(b) from t1 where a=1) as r from (select * from t2) dt; +"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +prepare stmt from " +with cte as (select * from t2) +select (select sum(b) from t1 where a=1) as r from cte; +"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +prepare stmt from " +select (select sum(b) from t1 where a=1) as r +from (select * from v1 where b > 50) dt; +"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +prepare stmt from " +select (select sum(b) from t1 where a=1) as r +from (select * from (select * from t2) dt1 where b > 50) dt; +"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +prepare stmt from " +with cte as (select * from (select * from t2) dt1 where b > 50) +select (select sum(b) from t1 where a=1) as r from cte; +"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +--delimiter | +create procedure sp1() +begin +select (select sum(b) from t1 where a=1) as r from v1; +end | +--delimiter ; +call sp1(); +call sp1(); +drop procedure sp1; + +--delimiter | +create procedure sp1() +begin +select (select sum(b) from t1 where a=1) as r from (select * from t2) dt; +end | +--delimiter ; +call sp1(); +call sp1(); +drop procedure sp1; + +--delimiter | +create procedure sp1() +begin +with cte as (select * from t2) +select (select sum(b) from t1 where a=1) as r from cte; +end | +--delimiter ; +call sp1(); +call sp1(); +drop procedure sp1; + +drop view v1; +drop table t1,t2; + +CREATE TABLE t1(f0 INT); +INSERT INTO t1 VALUES (3); +CREATE VIEW v1 AS SELECT f0 AS f1 FROM t1; +CREATE VIEW v2 AS +SELECT + (SELECT GROUP_CONCAT(v1.f1 SEPARATOR ', ') FROM v1 n) AS f2, + GROUP_CONCAT('aa' SEPARATOR ', ') AS f3 +FROM v1; +CREATE VIEW v3 AS SELECT * FROM v2; + +CREATE PROCEDURE p1() + SELECT * FROM v3; +CALL p1(); +CALL p1(); + +DROP PROCEDURE p1; +DROP VIEW v1,v2,v3; +DROP TABLE t1; + +--echo # +--echo # MDEV-27212: 2-nd execution of PS for select with embedded derived tables +--echo # and correlated subquery in select list of outer derived +--echo # +create table t1 ( id int, id2 int ) engine=myisam; +create table t2 ( x3 int , x1 int , x2 int, a1 int) engine=myisam; +insert into t1 values (3, 2), (4, 2), (3, 4); +insert into t2 values (1, 2, 2, 1), (1, 3, 3, 2), (2, 3, 3, 1); + +let $q= +select id from t1 + join + ( select dt2.x1, + ( select sum(a1) from t2 where t2.x1 = dt2.x1 ) m + from ( select x1 from t2 u where x3 = 1 ) dt2 + ) dt + on t1.id = dt.x1 +where t1.id2 < dt.m; + +eval prepare stmt from "$q"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +eval create procedure sp1() $q; +call sp1(); +call sp1(); + +create view v2 as select x1 from t2 u where x3 = 1; +create view v as +select v2.x1, + ( select sum(a1) from t2 where t2.x1 = v2.x1 ) m from v2; + +let $q= +select id from t1 join v on t1.id = v.x1 where t1.id2 < v.m; + +eval prepare stmt from "$q"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +eval create procedure sp2() $q; +call sp2(); +call sp2(); + +drop procedure sp1; +drop procedure sp2; + +drop view v, v2; + +drop table t1,t2; + --echo # End of 10.2 tests + +--echo # +--echo # MDEV-30706: view defined as select with implicit grouping and +--echo # a set function used in a subquery +--echo # + +CREATE TABLE t1 (a INT PRIMARY KEY, b INT); +INSERT INTO t1 VALUES (1,1), (2,2); +CREATE TABLE t2 (a INT PRIMARY KEY, b INT); +INSERT INTO t2 VALUES (1,1), (3,3); +CREATE TABLE t3 (a INT PRIMARY KEY, b INT); +INSERT INTO t3 VALUES (2,2), (4,4), (7,7); +CREATE TABLE t4 (a INT PRIMARY KEY, b INT); +INSERT INTO t4 VALUES (2,2), (5,5), (7,7); + +let $q= +SELECT + (SELECT SUM(t4.b) FROM t1, t2 WHERE t1.a = t2.b GROUP BY t1.a) AS m +FROM t3, t4 + WHERE t3.a = t4.b; + +eval CREATE VIEW v AS $q; + +eval $q; +SELECT * FROM v; +eval WITH cte AS ( $q ) SELECT * FROM cte; + +eval EXPLAIN $q; +EXPLAIN SELECT * FROM v; +eval EXPLAIN WITH cte AS ( $q ) SELECT * FROM cte; + +eval PREPARE stmt FROM "$q"; +execute stmt; +execute stmt; +DEALLOCATE PREPARE stmt; + +eval PREPARE stmt FROM "SELECT * FROM v"; +execute stmt; +execute stmt; +DEALLOCATE PREPARE stmt; + +eval PREPARE stmt FROM "WITH cte AS ( $q ) SELECT * FROM cte"; +execute stmt; +execute stmt; +DEALLOCATE PREPARE stmt; + +DROP VIEW v; +DROP TABLE t1,t2,t3,t4; + +--echo # +--echo # MDEV-29224: view defined as select with implicit grouping and +--echo # a set function used in a subquery +--echo # + +CREATE TABLE t1 (f1 INT); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (f2 int); +INSERT INTO t2 VALUES (3); + +let $q= +SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1; + +eval CREATE VIEW v AS $q; + +eval $q; +SELECT * FROM v; +eval WITH cte AS ( $q ) SELECT * FROM cte; + +eval EXPLAIN $q; +EXPLAIN SELECT * FROM v; +eval EXPLAIN WITH cte AS ( $q ) SELECT * FROM cte; + +eval PREPARE stmt FROM "$q"; +execute stmt; +execute stmt; +DEALLOCATE PREPARE stmt; + +eval PREPARE stmt FROM "SELECT * FROM v"; +execute stmt; +execute stmt; +DEALLOCATE PREPARE stmt; + +eval PREPARE stmt FROM "WITH cte AS ( $q ) SELECT * FROM cte"; +execute stmt; +execute stmt; +DEALLOCATE PREPARE stmt; + +DROP VIEW v; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-28573: view defined as select with implicit grouping and +--echo # a set function used in a subquery +--echo # + +CREATE TABLE t1 (a INTEGER, b INTEGER); +CREATE TABLE t2 (c INTEGER); +INSERT INTO t1 VALUES (1,11), (2,22), (2,22); +INSERT INTO t2 VALUES (1), (2); + +let $q1= +SELECT (SELECT COUNT(b) FROM t2) FROM t1; +let $q2= +SELECT (SELECT COUNT(b) FROM t2 WHERE c > 1) FROM t1; + +eval CREATE VIEW v1 AS $q1; +eval CREATE VIEW v2 AS $q2; + +--error ER_SUBQUERY_NO_1_ROW +eval $q1; +--error ER_SUBQUERY_NO_1_ROW +SELECT * FROM v1; +--error ER_SUBQUERY_NO_1_ROW +eval WITH cte AS ( $q1 ) SELECT * FROM cte; +eval $q2; +SELECT * FROM v2; +eval WITH cte AS ( $q2 ) SELECT * FROM cte; + +eval EXPLAIN $q1; +EXPLAIN SELECT * FROM v1; +eval EXPLAIN WITH cte AS ( $q1 ) SELECT * FROM cte; + +eval PREPARE stmt FROM "$q1"; +--error ER_SUBQUERY_NO_1_ROW +execute stmt; +--error ER_SUBQUERY_NO_1_ROW +execute stmt; +DEALLOCATE PREPARE stmt; + +eval PREPARE stmt FROM "SELECT * FROM v1"; +--error ER_SUBQUERY_NO_1_ROW +execute stmt; +--error ER_SUBQUERY_NO_1_ROW +execute stmt; +DEALLOCATE PREPARE stmt; + +eval PREPARE stmt FROM "WITH cte AS ( $q1 ) SELECT * FROM cte"; +--error ER_SUBQUERY_NO_1_ROW +execute stmt; +--error ER_SUBQUERY_NO_1_ROW +execute stmt; +DEALLOCATE PREPARE stmt; + +eval PREPARE stmt FROM "$q2"; +execute stmt; +execute stmt; +DEALLOCATE PREPARE stmt; + +eval PREPARE stmt FROM "SELECT * FROM v2"; +execute stmt; +execute stmt; +DEALLOCATE PREPARE stmt; + +eval PREPARE stmt FROM "WITH cte AS ( $q2 ) SELECT * FROM cte"; +execute stmt; +execute stmt; +DEALLOCATE PREPARE stmt; + +DROP VIEW v1,v2; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-28570: VIEW with WHERE containing subquery +--echo # with set function aggregated in query +--echo # + +CREATE TABLE t1 (a int, b int); +CREATE TABLE t2 (c int, d int); + +INSERT INTO t1 VALUES + (1,10), (2,10), (1,20), (2,20), (3,20), (2,30), (4,40); +INSERT INTO t2 VALUES + (2,10), (2,20), (4,10), (5,10), (3,20), (2,40); + +let $q= +SELECT a FROM t1 GROUP BY a + HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20); + +eval CREATE VIEW v AS $q; + +eval $q; +SELECT * FROM v; +eval WITH cte AS ( $q ) SELECT * FROM cte; + +eval EXPLAIN $q; +EXPLAIN SELECT * FROM v; +eval EXPLAIN WITH cte AS ( $q ) SELECT * FROM cte; + +eval PREPARE stmt FROM "$q"; +execute stmt; +execute stmt; +DEALLOCATE PREPARE stmt; + +eval PREPARE stmt FROM "SELECT * FROM v"; +execute stmt; +execute stmt; +DEALLOCATE PREPARE stmt; + +eval PREPARE stmt FROM "WITH cte AS ( $q ) SELECT * FROM cte"; +execute stmt; +execute stmt; +DEALLOCATE PREPARE stmt; + +DROP VIEW v; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-28571: VIEW with select list containing subquery +--echo # with set function aggregated in query +--echo # + +CREATE TABLE t1 (a int, b int); +CREATE TABLE t2 (m int, n int); +INSERT INTO t1 VALUES (2,2), (2,2), (3,3), (3,3), (3,3), (4,4); +INSERT INTO t2 VALUES (1,11), (2,22), (3,32), (4,44), (4,44); + +let $q= +SELECT (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a) AS c +FROM t1 +GROUP BY a; + +eval CREATE VIEW v AS $q; + +eval $q; +SELECT * FROM v; +eval WITH cte AS ( $q ) SELECT * FROM cte; + +eval EXPLAIN $q; +EXPLAIN SELECT * FROM v; +eval EXPLAIN WITH cte AS ( $q ) SELECT * FROM cte; + +eval PREPARE stmt FROM "$q"; +execute stmt; +execute stmt; +DEALLOCATE PREPARE stmt; + +eval PREPARE stmt FROM "SELECT * FROM v"; +execute stmt; +execute stmt; +DEALLOCATE PREPARE stmt; + +eval PREPARE stmt FROM "WITH cte AS ( $q ) SELECT * FROM cte"; +execute stmt; +execute stmt; +DEALLOCATE PREPARE stmt; + +DROP VIEW v; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-30668: VIEW with WHERE containing nested subquery +--echo # with set function aggregated in outer subquery +--echo # + +create table t1 (a int); +insert into t1 values (3), (7), (1); + +create table t2 (b int); +insert into t2 values (2), (1), (4), (7); + +create table t3 (a int, b int); +insert into t3 values (2,10), (7,30), (2,30), (1,10), (7,40); + +let $q= +select * from t1 + where t1.a in (select t3.a from t3 group by t3.a + having t3.a > any (select t2.b from t2 + where t2.b*10 < sum(t3.b))); +eval create view v as $q; + +eval $q; +eval select * from v; +eval with cte as ( $q ) select * from cte; + +eval explain $q; +eval explain select * from v; +eval explain with cte as ( $q ) select * from cte; + +eval prepare stmt from "$q"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +eval prepare stmt from "select * from v"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +eval prepare stmt from "with cte as ( $q ) select * from cte"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +drop view v; +drop table t1,t2,t3; + +--echo # End of 10.4 tests + +--echo # +--echo # MDEV-31143: view with ORDER BY used in query with rownum() in WHERE +--echo # + +create table t1 (id int primary key); +insert into t1 values (3), (7), (1); + +create table t2 (a int); +insert into t2 values (2), (4); + +create view v as select a from t2 order by a; + +set big_tables= 1; +select t1.id from v, t1 where rownum() = 1 group by t1.id; + +set big_tables=default; + +drop view v; +drop table t1, t2; + +--echo # +--echo # MDEV-31162: multi-table mergeable view with ORDER BY used +--echo # in query with rownum() in WHERE +--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 (3),(4); + +create view v1 AS select * from t1 join t2 order by b; +let $q1= +select * from v1 where rownum() <= 2; + +eval explain $q1; +--sorted_result +eval $q1; + +eval prepare stmt from "$q1"; +--sorted_result +execute stmt; +--sorted_result +execute stmt; +deallocate prepare stmt; + +create view v2 AS select * from t1 join t2 order by b/a; +let $q2= +select * from v2 where rownum() <= 2; + +eval explain $q2; +eval $q2; +eval prepare stmt from "$q2"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +drop view v1,v2; +drop table t1,t2; + +--echo # End of 10.6 tests diff --git a/mysql-test/main/desc_index_range.result b/mysql-test/main/desc_index_range.result new file mode 100644 index 0000000000000..6b1f2e31c31d1 --- /dev/null +++ b/mysql-test/main/desc_index_range.result @@ -0,0 +1,201 @@ +create table t1 ( +a int, +key (a desc) +); +insert into t1 select seq from seq_1_to_1000; +set optimizer_trace=1; +explain select * from t1 force index(a) where a in (2, 4, 6); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 5 NULL 3 Using where; Using index +select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +from information_schema.optimizer_trace; +json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +[ + [ + "(6) <= (a DESC) <= (6)", + "(4) <= (a DESC) <= (4)", + "(2) <= (a DESC) <= (2)" + ] +] +set optimizer_trace=default; +# These should go in reverse order: +select * from t1 force index(a) where a in (2, 4, 6); +a +6 +4 +2 +drop table t1; +# +# Multi-part key tests +# +create table t1 ( +a int not null, +b int not null, +key ab(a, b desc) +); +insert into t1 select A.seq, B.seq*10 from seq_1_to_10 A, seq_1_to_10 B; +set optimizer_trace=1; +explain select * from t1 force index(ab) where a>=8 and b>=50; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range ab ab 4 NULL 51 Using where; Using index +select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +from information_schema.optimizer_trace; +json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +[ + ["(8) <= (a)"] +] +explain select * from t1 force index(ab) where a>=8 and b<=50; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range ab ab 8 NULL 46 Using where; Using index +select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +from information_schema.optimizer_trace; +json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +[ + ["(8,50) <= (a,b DESC)"] +] +select * from t1 force index(ab) where a>=8 and b<=50; +a b +8 50 +8 40 +8 30 +8 20 +8 10 +9 50 +9 40 +9 30 +9 20 +9 10 +10 50 +10 40 +10 30 +10 20 +10 10 +select * from t1 ignore index(ab) where a>=8 and b<=50 order by a, b desc; +a b +8 50 +8 40 +8 30 +8 20 +8 10 +9 50 +9 40 +9 30 +9 20 +9 10 +10 50 +10 40 +10 30 +10 20 +10 10 +explain +select * from t1 where a between 2 and 4 and b between 50 and 80; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range ab ab 8 NULL 17 Using where; Using index +select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +from information_schema.optimizer_trace; +json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +[ + ["(2,80) <= (a,b DESC) <= (4,50)"] +] +select * from t1 where a between 2 and 4 and b between 50 and 80; +a b +2 80 +2 70 +2 60 +2 50 +3 80 +3 70 +3 60 +3 50 +4 80 +4 70 +4 60 +4 50 +drop table t1; +create table t2 ( +a int not null, +b int not null, +key ab(a desc, b desc) +); +insert into t2 select A.seq, B.seq*10 from seq_1_to_10 A, seq_1_to_10 B; +explain +select * from t2 where a between 2 and 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range ab ab 4 NULL 40 Using where; Using index +select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +from information_schema.optimizer_trace; +json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +[ + ["(4) <= (a DESC) <= (2)"] +] +explain +select * from t2 where a between 2 and 4 and b between 50 and 80; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range ab ab 8 NULL 31 Using where; Using index +select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +from information_schema.optimizer_trace; +json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +[ + ["(4,80) <= (a DESC,b DESC) <= (2,50)"] +] +drop table t2; +# +# Check that "Using index for group-by" is disabled (it's not supported, yet) +# +CREATE TABLE t1 (p int NOT NULL, a int NOT NULL, PRIMARY KEY (p,a desc)); +insert into t1 select 2,seq from seq_0_to_1000; +EXPLAIN select MIN(a) from t1 where p = 2 group by p; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref PRIMARY PRIMARY 4 const 1000 Using index +select json_detailed(json_extract(trace, '$**.potential_group_range_indexes')) +from information_schema.optimizer_trace; +json_detailed(json_extract(trace, '$**.potential_group_range_indexes')) +[ + [ + { + "index": "PRIMARY", + "usable": false, + "cause": "Reverse-ordered (not supported yet)" + } + ] +] +drop table t1; +set optimizer_trace=default; +# +# MDEV-27426: Wrong result upon query using index_merge with DESC key +# +CREATE TABLE t1 (pk INT, a INT, b int, KEY(a), PRIMARY KEY(pk DESC)) +ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,4,5),(2,9,6),(3,NULL,7),(4,NULL,8); +SELECT * FROM t1 WHERE pk > 10 OR a > 0; +pk a b +2 9 6 +1 4 5 +DROP TABLE t1; +# +# MDEV-27529: Wrong result upon query using index_merge with DESC key (#2) +# +create table t1 ( +pk int, +a int, +b int, +primary key(pk desc), +key(a), +key(b) +) engine=innodb; +insert into t1 values (0, 111111, 255); +insert into t1 select seq+50000, NULL, seq+1000 from seq_1_to_260; +insert into t1 values (10000, NULL, 255); +insert into t1 select seq+20000, seq+20000, seq+20000 from seq_1_to_1500; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +# Must use ROR-intersect: +explain select * from t1 where b = 255 AND a IS NULL; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b b,a 5,5 NULL 1 Using intersect(b,a); Using where; Using index +select * from t1 where b = 255 AND a IS NULL; +pk a b +10000 NULL 255 +drop table t1; diff --git a/mysql-test/main/desc_index_range.test b/mysql-test/main/desc_index_range.test new file mode 100644 index 0000000000000..ec52e254fe797 --- /dev/null +++ b/mysql-test/main/desc_index_range.test @@ -0,0 +1,143 @@ +# +# Tests for range access and descending indexes +# +--source include/have_sequence.inc +--source include/have_innodb.inc + +# The test uses optimizer trace: +--source include/not_embedded.inc + +create table t1 ( + a int, + key (a desc) +); +insert into t1 select seq from seq_1_to_1000; + +set optimizer_trace=1; +explain select * from t1 force index(a) where a in (2, 4, 6); + +#enable after fix MDEV-27871 +--disable_view_protocol +select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +from information_schema.optimizer_trace; +--enable_view_protocol +set optimizer_trace=default; + +--echo # These should go in reverse order: +select * from t1 force index(a) where a in (2, 4, 6); +drop table t1; + +--echo # +--echo # Multi-part key tests +--echo # +create table t1 ( + a int not null, + b int not null, + key ab(a, b desc) +); + +insert into t1 select A.seq, B.seq*10 from seq_1_to_10 A, seq_1_to_10 B; + +#enable after fix MDEV-27871 +--disable_view_protocol +set optimizer_trace=1; +explain select * from t1 force index(ab) where a>=8 and b>=50; +select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +from information_schema.optimizer_trace; + +explain select * from t1 force index(ab) where a>=8 and b<=50; +select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +from information_schema.optimizer_trace; +--enable_view_protocol + +select * from t1 force index(ab) where a>=8 and b<=50; +select * from t1 ignore index(ab) where a>=8 and b<=50 order by a, b desc; + +#enable after fix MDEV-27871 +--disable_view_protocol +explain +select * from t1 where a between 2 and 4 and b between 50 and 80; +select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +from information_schema.optimizer_trace; +--enable_view_protocol + +select * from t1 where a between 2 and 4 and b between 50 and 80; + +drop table t1; + +create table t2 ( + a int not null, + b int not null, + key ab(a desc, b desc) +); +insert into t2 select A.seq, B.seq*10 from seq_1_to_10 A, seq_1_to_10 B; + +#enable after fix MDEV-27871 +--disable_view_protocol +explain +select * from t2 where a between 2 and 4; +select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +from information_schema.optimizer_trace; + +explain +select * from t2 where a between 2 and 4 and b between 50 and 80; +select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) +from information_schema.optimizer_trace; +--enable_view_protocol + +drop table t2; + +--echo # +--echo # Check that "Using index for group-by" is disabled (it's not supported, yet) +--echo # +CREATE TABLE t1 (p int NOT NULL, a int NOT NULL, PRIMARY KEY (p,a desc)); +insert into t1 select 2,seq from seq_0_to_1000; +EXPLAIN select MIN(a) from t1 where p = 2 group by p; +#enable after fix MDEV-27871 +--disable_view_protocol +select json_detailed(json_extract(trace, '$**.potential_group_range_indexes')) +from information_schema.optimizer_trace; +--enable_view_protocol +drop table t1; + +set optimizer_trace=default; + +--echo # +--echo # MDEV-27426: Wrong result upon query using index_merge with DESC key +--echo # + +CREATE TABLE t1 (pk INT, a INT, b int, KEY(a), PRIMARY KEY(pk DESC)) +ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,4,5),(2,9,6),(3,NULL,7),(4,NULL,8); + +SELECT * FROM t1 WHERE pk > 10 OR a > 0; +DROP TABLE t1; + + +--echo # +--echo # MDEV-27529: Wrong result upon query using index_merge with DESC key (#2) +--echo # + +create table t1 ( + pk int, + a int, + b int, + primary key(pk desc), + key(a), + key(b) +) engine=innodb; + +insert into t1 values (0, 111111, 255); + +insert into t1 select seq+50000, NULL, seq+1000 from seq_1_to_260; + +insert into t1 values (10000, NULL, 255); +insert into t1 select seq+20000, seq+20000, seq+20000 from seq_1_to_1500; + +analyze table t1; + +--echo # Must use ROR-intersect: +explain select * from t1 where b = 255 AND a IS NULL; +select * from t1 where b = 255 AND a IS NULL; + +drop table t1; diff --git a/mysql-test/main/disabled.def b/mysql-test/main/disabled.def index d3366587ee562..02104f6a68010 100644 --- a/mysql-test/main/disabled.def +++ b/mysql-test/main/disabled.def @@ -18,5 +18,3 @@ file_contents : MDEV-6526 these files are not installed anymore max_statement_time : cannot possibly work, depends on timing partition_open_files_limit : open_files_limit check broken by MDEV-18360 partition_innodb : Waiting for fix MDEV-20169 -type_enum : Waiting for fix MDEV-6978 -type_set : Waiting for fix MDEV-6978 diff --git a/mysql-test/main/distinct.result b/mysql-test/main/distinct.result index 0e31a174be72c..fa9f0259a0fa5 100644 --- a/mysql-test/main/distinct.result +++ b/mysql-test/main/distinct.result @@ -677,13 +677,13 @@ a A 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'A' +Warning 1292 Truncated incorrect DECIMAL value: 'A' SELECT DISTINCT a FROM t1 WHERE a=0; a A 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'A' +Warning 1292 Truncated incorrect DECIMAL value: 'A' DROP TABLE t1; CREATE TABLE t1 (a DATE); INSERT INTO t1 VALUES ('1972-07-29'), ('1972-02-06'); @@ -1071,6 +1071,57 @@ UNION drop table t1; End of 5.5 tests # +# MDEV-20057 Distinct SUM on CROSS JOIN and grouped returns wrong result +# +create table t1 (c int, d int); +insert into t1 values (5, 1), (0, 3); +select distinct sum(distinct 1), sum(t1.d) > 2 from (t1 e join t1) group by t1.c; +sum(distinct 1) sum(t1.d) > 2 +1 1 +1 0 +select distinct sum(distinct 1), sum(t1.d) > 2, t1.c from (t1 e join t1) group by t1.c; +sum(distinct 1) sum(t1.d) > 2 c +1 1 0 +1 0 5 +insert into t1 values (6,6); +select distinct sum(distinct 1), sum(t1.d) > 5 from (t1 e join t1) group by t1.c; +sum(distinct 1) sum(t1.d) > 5 +1 1 +1 0 +select distinct sum(distinct 1), sum(t1.d) > 5, t1.c from (t1 e join t1) group by t1.c; +sum(distinct 1) sum(t1.d) > 5 c +1 1 0 +1 0 5 +1 1 6 +SET @sort_buffer_size_save= @@sort_buffer_size; +set @@sort_buffer_size=1024; +insert into t1 select -seq,-seq from seq_1_to_100; +select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000 from (t1 e join t1) group by t1.c having t1.c > -2 ; +sum(distinct 1) sum(t1.d) > 2 length(group_concat(t1.d)) > 1000 +1 0 0 +1 1 0 +select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000,t1.c from (t1 e join t1) group by t1.c having t1.c > -2; +sum(distinct 1) sum(t1.d) > 2 length(group_concat(t1.d)) > 1000 c +1 0 0 -1 +1 1 0 0 +1 1 0 5 +1 1 0 6 +drop table t1; +set @@sort_buffer_size=@sort_buffer_size_save; +# +# MDEV-31113 Server crashes in store_length / Type_handler_string_result::make_sort_key +# with DISTINCT and group function +# +CREATE TABLE t (f INT); +INSERT INTO t VALUES (1),(2); +SELECT DISTINCT CONVERT(STDDEV(f), CHAR(16)) AS f1, UUID() AS f2 FROM t GROUP BY f2 WITH ROLLUP; +f1 f2 +0.0000 # +0.0000 # +0.5000 # +DROP TABLE t; +# End of 10.4 tests +# # MDEV-27382: OFFSET is ignored when it is combined with the DISTINCT, IN() and JOIN # CREATE TABLE t1 ( diff --git a/mysql-test/main/distinct.test b/mysql-test/main/distinct.test index 32e189da98aaf..893e2dcc9a789 100644 --- a/mysql-test/main/distinct.test +++ b/mysql-test/main/distinct.test @@ -4,6 +4,7 @@ # --source include/default_optimizer_switch.inc +--source include/have_sequence.inc --disable_warnings drop table if exists t1,t2,t3; --enable_warnings @@ -819,6 +820,41 @@ drop table t1; --echo End of 5.5 tests +--echo # +--echo # MDEV-20057 Distinct SUM on CROSS JOIN and grouped returns wrong result +--echo # + +create table t1 (c int, d int); +insert into t1 values (5, 1), (0, 3); +select distinct sum(distinct 1), sum(t1.d) > 2 from (t1 e join t1) group by t1.c; +select distinct sum(distinct 1), sum(t1.d) > 2, t1.c from (t1 e join t1) group by t1.c; + +insert into t1 values (6,6); +select distinct sum(distinct 1), sum(t1.d) > 5 from (t1 e join t1) group by t1.c; +select distinct sum(distinct 1), sum(t1.d) > 5, t1.c from (t1 e join t1) group by t1.c; + +# Force usage of remove_dup_with_compare() algorithm +SET @sort_buffer_size_save= @@sort_buffer_size; +set @@sort_buffer_size=1024; +insert into t1 select -seq,-seq from seq_1_to_100; +select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000 from (t1 e join t1) group by t1.c having t1.c > -2 ; +select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000,t1.c from (t1 e join t1) group by t1.c having t1.c > -2; +drop table t1; +set @@sort_buffer_size=@sort_buffer_size_save; + +--echo # +--echo # MDEV-31113 Server crashes in store_length / Type_handler_string_result::make_sort_key +--echo # with DISTINCT and group function +--echo # + +CREATE TABLE t (f INT); +INSERT INTO t VALUES (1),(2); +--replace_column 2 # +SELECT DISTINCT CONVERT(STDDEV(f), CHAR(16)) AS f1, UUID() AS f2 FROM t GROUP BY f2 WITH ROLLUP; +DROP TABLE t; + +--echo # End of 10.4 tests + --echo # --echo # MDEV-27382: OFFSET is ignored when it is combined with the DISTINCT, IN() and JOIN --echo # diff --git a/mysql-test/main/drop.test b/mysql-test/main/drop.test index 45ff7f364f492..5185ce30db0cf 100644 --- a/mysql-test/main/drop.test +++ b/mysql-test/main/drop.test @@ -98,7 +98,8 @@ drop table t1; # removing of database name from cache" reappeared in 5.1 as bug#19403 # In its case crash happened when one concurrently executed DROP DATABASE # and one of name-locking command. -# +# +--disable_service_connection --disable_warnings drop database if exists mysqltest; drop table if exists t1; @@ -127,6 +128,7 @@ connection addconroot1; disconnect addconroot1; --source include/wait_until_disconnected.inc connection default; +--enable_service_connection # # Bug#25858 Some DROP TABLE under LOCK TABLES can cause deadlocks diff --git a/mysql-test/main/drop_bad_db_type.result b/mysql-test/main/drop_bad_db_type.result index ae6fe708e604a..8da5bd07be41d 100644 --- a/mysql-test/main/drop_bad_db_type.result +++ b/mysql-test/main/drop_bad_db_type.result @@ -3,34 +3,50 @@ SET debug_dbug='+d,unstable_db_type'; install soname 'ha_archive'; create table t1 (a int) engine=archive; insert t1 values (1),(2),(3); +create table t2 (a int) engine=archive partition by hash(a) partitions 3; flush tables; uninstall soname 'ha_archive'; -select table_schema, table_name from information_schema.tables where table_name like 't1'; -table_schema test -table_name t1 -select table_schema, table_name, engine, version from information_schema.tables where table_name like 't1'; -table_schema test -table_name t1 -engine ARCHIVE -version NULL +select table_schema, table_name from information_schema.tables where table_name like 't_' order by 1,2; +table_schema table_name +test t1 +test t2 +select table_schema, table_name, engine, version from information_schema.tables where table_name like 't_' order by 1,2; +table_schema table_name engine version +test t1 ARCHIVE NULL +test t2 NULL NULL Warnings: -Level Warning -Code 1286 -Message Unknown storage engine 'ARCHIVE' -select table_schema, table_name, engine, row_format from information_schema.tables where table_name like 't1'; -table_schema test -table_name t1 -engine ARCHIVE -row_format NULL +Warning 1033 Incorrect information in file: './test/t2.frm' +Warning 1286 Unknown storage engine 'ARCHIVE' +select table_schema, table_name, engine, row_format from information_schema.tables where table_name like 't_' order by 1,2; +table_schema table_name engine row_format +test t1 ARCHIVE NULL +test t2 NULL NULL Warnings: -Level Warning -Code 1286 -Message Unknown storage engine 'ARCHIVE' +Warning 1033 Incorrect information in file: './test/t2.frm' +Warning 1286 Unknown storage engine 'ARCHIVE' install soname 'ha_archive'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL +) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY HASH (`a`) +PARTITIONS 3 db.opt t1.ARZ t1.frm +t2#P#p0.ARZ +t2#P#p1.ARZ +t2#P#p2.ARZ +t2.frm +t2.par drop table t1; +drop table t2; db.opt uninstall soname 'ha_archive'; SET debug_dbug=@saved_dbug; diff --git a/mysql-test/main/drop_bad_db_type.test b/mysql-test/main/drop_bad_db_type.test index ebc732104d3c8..0fb5fe5edf4a6 100644 --- a/mysql-test/main/drop_bad_db_type.test +++ b/mysql-test/main/drop_bad_db_type.test @@ -1,4 +1,4 @@ - +--source include/have_partition.inc --source include/have_debug.inc if (!$HA_ARCHIVE_SO) { @@ -13,18 +13,25 @@ SET debug_dbug='+d,unstable_db_type'; install soname 'ha_archive'; create table t1 (a int) engine=archive; insert t1 values (1),(2),(3); + +create table t2 (a int) engine=archive partition by hash(a) partitions 3; + flush tables; uninstall soname 'ha_archive'; ---vertical_results -select table_schema, table_name from information_schema.tables where table_name like 't1'; -select table_schema, table_name, engine, version from information_schema.tables where table_name like 't1'; -select table_schema, table_name, engine, row_format from information_schema.tables where table_name like 't1'; ---horizontal_results +select table_schema, table_name from information_schema.tables where table_name like 't_' order by 1,2; +--replace_result $mysqld_datadir ./ +select table_schema, table_name, engine, version from information_schema.tables where table_name like 't_' order by 1,2; +--replace_result $mysqld_datadir ./ +select table_schema, table_name, engine, row_format from information_schema.tables where table_name like 't_' order by 1,2; install soname 'ha_archive'; +show create table t1; +show create table t2; + --list_files $mysqld_datadir/test drop table t1; +drop table t2; --list_files $mysqld_datadir/test uninstall soname 'ha_archive'; diff --git a/mysql-test/main/dyncol.result b/mysql-test/main/dyncol.result index 7bc011ece87cd..08f22ffb3b40e 100644 --- a/mysql-test/main/dyncol.result +++ b/mysql-test/main/dyncol.result @@ -1508,7 +1508,7 @@ select column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int); column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int) NULL set names latin1; -# column existance test (names) +# column existence test (names) set names utf8; select column_exists(column_create("адын", 1212), "адын"); column_exists(column_create("адын", 1212), "адын") @@ -1938,7 +1938,7 @@ t1 CREATE TABLE `t1` ( `dyncol2_check` int(11) DEFAULT column_check(`dyncol2`), `dyncol1_list` text DEFAULT column_list(`dyncol1`), `dyncol1_json` text DEFAULT column_json(`dyncol1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (name,value) VALUES ('name0', 'value0'); SELECT value_dyncol0_name0, value_dyncol1_name1 FROM t1; value_dyncol0_name0 value_dyncol1_name1 diff --git a/mysql-test/main/dyncol.test b/mysql-test/main/dyncol.test index c0835de8c442d..493e9b3842ddb 100644 --- a/mysql-test/main/dyncol.test +++ b/mysql-test/main/dyncol.test @@ -1,6 +1,8 @@ # # Dynamic column function test # +# enable view-protocol after fix MDEV-27871 +-- source include/no_view_protocol.inc --source include/default_charset.inc @@ -689,7 +691,7 @@ select column_get(column_create("1212", 2, "адын", 1, 3, 3), 4 as int); select column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int); set names latin1; ---echo # column existance test (names) +--echo # column existence test (names) set names utf8; select column_exists(column_create("адын", 1212), "адын"); select column_exists(column_create("адын", 1212), "aады"); diff --git a/mysql-test/main/empty_string_literal.result b/mysql-test/main/empty_string_literal.result index bf9f30665f2b4..732e8e6d557c3 100644 --- a/mysql-test/main/empty_string_literal.result +++ b/mysql-test/main/empty_string_literal.result @@ -193,7 +193,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` binary(1) GENERATED ALWAYS AS (NULL) VIRTUAL, KEY `a` (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int, b binary(1) generated always as (''), key(a,b)); insert into t1 (a) values (1); @@ -206,5 +206,5 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` binary(1) GENERATED ALWAYS AS ('') VIRTUAL, KEY `a` (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; diff --git a/mysql-test/main/empty_table.result b/mysql-test/main/empty_table.result index 2bca3e792fa2e..90aec2eda3b77 100644 --- a/mysql-test/main/empty_table.result +++ b/mysql-test/main/empty_table.result @@ -16,3 +16,61 @@ ERROR 42S02: Table 'test.t2' doesn't exist show status like "Empty_queries"; Variable_name Value Empty_queries 2 +# End of 4.1 tests +# +# MDEV-30333 Wrong result with not_null_range_scan and LEFT JOIN with empty table +# +set @save_optimizer_switch=@@optimizer_switch; +CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 (b) VALUES (1),(2); +CREATE TABLE t2 (c INT) ENGINE=MyISAM; +SET optimizer_switch= 'not_null_range_scan=off'; +explain extended SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using filesort +Warnings: +Note 1003 select `test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` is null order by `test`.`t1`.`b` +SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +b +1 +2 +SET optimizer_switch = 'not_null_range_scan=on'; +explain extended SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using filesort +Warnings: +Note 1003 select `test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` is null order by `test`.`t1`.`b` +SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +b +1 +2 +flush tables; +SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +b +1 +2 +drop table t1,t2; +# Second test in MDEV-30333 +CREATE TABLE t1 (a int, b varchar(10)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (69,'foo'),(71,'bar'); +CREATE TABLE t2 (c int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(2); +CREATE TABLE t3 (d int, e int, KEY(e)) ENGINE=MyISAM; +SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t3.e = t3.d ON 1; +a b c d e +69 foo 1 NULL NULL +71 bar 1 NULL NULL +69 foo 2 NULL NULL +71 bar 2 NULL NULL +SET optimizer_switch = 'not_null_range_scan=on'; +SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t3.e = t3.d ON 1; +a b c d e +69 foo 1 NULL NULL +71 bar 1 NULL NULL +69 foo 2 NULL NULL +71 bar 2 NULL NULL +DROP TABLE t1, t2, t3; +set @@optimizer_switch=@save_optimizer_switch; +End of 10.5 tests diff --git a/mysql-test/main/empty_table.test b/mysql-test/main/empty_table.test index 754671868ba51..a17b0c897d5db 100644 --- a/mysql-test/main/empty_table.test +++ b/mysql-test/main/empty_table.test @@ -21,4 +21,38 @@ drop table t1; select * from t2; show status like "Empty_queries"; -# End of 4.1 tests +--echo # End of 4.1 tests + +--echo # +--echo # MDEV-30333 Wrong result with not_null_range_scan and LEFT JOIN with empty table +--echo # + +set @save_optimizer_switch=@@optimizer_switch; +CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 (b) VALUES (1),(2); +CREATE TABLE t2 (c INT) ENGINE=MyISAM; +SET optimizer_switch= 'not_null_range_scan=off'; # Default +explain extended SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +SET optimizer_switch = 'not_null_range_scan=on'; +explain extended SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +flush tables; +SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +drop table t1,t2; + +--echo # Second test in MDEV-30333 + +CREATE TABLE t1 (a int, b varchar(10)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (69,'foo'),(71,'bar'); +CREATE TABLE t2 (c int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(2); +CREATE TABLE t3 (d int, e int, KEY(e)) ENGINE=MyISAM; +SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t3.e = t3.d ON 1; +SET optimizer_switch = 'not_null_range_scan=on'; +SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t3.e = t3.d ON 1; +DROP TABLE t1, t2, t3; +set @@optimizer_switch=@save_optimizer_switch; + +--echo End of 10.5 tests + diff --git a/mysql-test/main/enforce_storage_engine.result b/mysql-test/main/enforce_storage_engine.result index 296ed405a729e..c761277a5b062 100644 --- a/mysql-test/main/enforce_storage_engine.result +++ b/mysql-test/main/enforce_storage_engine.result @@ -14,7 +14,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM; SHOW CREATE TABLE t1; @@ -23,7 +23,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)); SHOW CREATE TABLE t1; @@ -32,7 +32,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION'; CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM; @@ -42,7 +42,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 values (1,'abba'); CREATE TABLE t2 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory; ERROR 42000: Unknown storage engine 'MEMORY' @@ -62,7 +62,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET SESSION enforce_storage_engine=FooBar; ERROR 42000: Unknown storage engine 'FooBar' @@ -84,7 +84,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM; SHOW CREATE TABLE t1; @@ -93,7 +93,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)); SHOW CREATE TABLE t1; @@ -102,7 +102,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET GLOBAL enforce_storage_engine=Memory; SET SESSION sql_mode=''; @@ -123,7 +123,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; connection default; disconnect con1; @@ -142,7 +142,7 @@ t3 CREATE TABLE `t3` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t3; SET SESSION enforce_storage_engine=NULL; CREATE TABLE t3 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM; @@ -156,7 +156,7 @@ t3 CREATE TABLE `t3` ( `c2` varchar(10) DEFAULT NULL, `c3` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t3; SET SESSION enforce_storage_engine=NULL; SET GLOBAL enforce_storage_engine=NULL; diff --git a/mysql-test/main/enforce_storage_engine_opt.result b/mysql-test/main/enforce_storage_engine_opt.result index 1b03aa281d98a..5f709427457b1 100644 --- a/mysql-test/main/enforce_storage_engine_opt.result +++ b/mysql-test/main/enforce_storage_engine_opt.result @@ -8,7 +8,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci set session sql_mode='no_engine_substitution'; create table t2 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory; ERROR 42000: Unknown storage engine 'MEMORY' diff --git a/mysql-test/main/error_simulation.result b/mysql-test/main/error_simulation.result index 457e5c8ec9c65..3b41e0bc5a41f 100644 --- a/mysql-test/main/error_simulation.result +++ b/mysql-test/main/error_simulation.result @@ -29,7 +29,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(100) NOT NULL, KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; a 0 @@ -128,3 +128,13 @@ SELECT f1(1); Got one of the listed errors DROP FUNCTION f1; SET debug_dbug= @saved_dbug; +# +# MDEV-27978 wrong option name in error when exceeding max_session_mem_used +# +SET SESSION max_session_mem_used = 8192; +SELECT * FROM information_schema.processlist; +ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement +SET SESSION max_session_mem_used = DEFAULT; +# +# End of 10.2 tests +# diff --git a/mysql-test/main/error_simulation.test b/mysql-test/main/error_simulation.test index f713e2da6baf5..2c155bc9a2271 100644 --- a/mysql-test/main/error_simulation.test +++ b/mysql-test/main/error_simulation.test @@ -158,3 +158,16 @@ SET SESSION debug_dbug="+d,simulate_create_virtual_tmp_table_out_of_memory"; SELECT f1(1); DROP FUNCTION f1; SET debug_dbug= @saved_dbug; + +--echo # +--echo # MDEV-27978 wrong option name in error when exceeding max_session_mem_used +--echo # +SET SESSION max_session_mem_used = 8192; +--error ER_OPTION_PREVENTS_STATEMENT +SELECT * FROM information_schema.processlist; +SET SESSION max_session_mem_used = DEFAULT; + + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/main/events_1.result b/mysql-test/main/events_1.result index c425f88eab26d..2f2a951158c16 100644 --- a/mysql-test/main/events_1.result +++ b/mysql-test/main/events_1.result @@ -1,5 +1,6 @@ set sql_mode=""; call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted"); +call mtr.add_suppression("Incorrect definition of table mysql.event:.*"); drop database if exists events_test; drop database if exists db_x; drop database if exists mysqltest_db2; diff --git a/mysql-test/main/events_1.test b/mysql-test/main/events_1.test index 33b82730783a0..ba8a2059e2d95 100644 --- a/mysql-test/main/events_1.test +++ b/mysql-test/main/events_1.test @@ -8,6 +8,7 @@ set sql_mode=""; --source include/default_charset.inc call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted"); +call mtr.add_suppression("Incorrect definition of table mysql.event:.*"); --disable_warnings drop database if exists events_test; diff --git a/mysql-test/main/events_2.test b/mysql-test/main/events_2.test index 2012f94e9f2c7..cd0d908b8703c 100644 --- a/mysql-test/main/events_2.test +++ b/mysql-test/main/events_2.test @@ -3,6 +3,8 @@ # Can't test with embedded server that doesn't support grants -- source include/not_embedded.inc +--disable_service_connection + set sql_mode=""; --source include/default_charset.inc @@ -523,3 +525,4 @@ let $wait_condition= --source include/wait_condition.inc drop database events_test; +--enable_service_connection diff --git a/mysql-test/main/events_bugs.test b/mysql-test/main/events_bugs.test index ab45446667e87..fe744de86c9f9 100644 --- a/mysql-test/main/events_bugs.test +++ b/mysql-test/main/events_bugs.test @@ -1,3 +1,7 @@ +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + #### t/events_bugs.test # # Last change: diff --git a/mysql-test/main/events_embedded.test b/mysql-test/main/events_embedded.test index 9922ea6dfee61..f6921f302bfe9 100644 --- a/mysql-test/main/events_embedded.test +++ b/mysql-test/main/events_embedded.test @@ -2,4 +2,3 @@ --error 1193 set global event_scheduler=ON; - diff --git a/mysql-test/main/events_grant.test b/mysql-test/main/events_grant.test index 0c89e9d1f6c7c..cd5b691154226 100644 --- a/mysql-test/main/events_grant.test +++ b/mysql-test/main/events_grant.test @@ -2,7 +2,7 @@ -- source include/not_embedded.inc --source include/default_charset.inc - +--disable_service_connection CREATE DATABASE IF NOT EXISTS events_test; use events_test; # @@ -113,3 +113,4 @@ DROP DATABASE events_test2; --source include/check_events_off.inc DROP DATABASE events_test; +--enable_service_connection diff --git a/mysql-test/main/events_logs_tests.test b/mysql-test/main/events_logs_tests.test index 7cd664b30df27..f74453520795f 100644 --- a/mysql-test/main/events_logs_tests.test +++ b/mysql-test/main/events_logs_tests.test @@ -1,5 +1,6 @@ # Can't test with embedded server that doesn't support grants -- source include/not_embedded.inc +-- source include/no_view_protocol.inc set @save_long_query_time=@@long_query_time; --disable_warnings diff --git a/mysql-test/main/events_restart.result b/mysql-test/main/events_restart.result index 47092beed0e48..58401c7be800e 100644 --- a/mysql-test/main/events_restart.result +++ b/mysql-test/main/events_restart.result @@ -21,6 +21,7 @@ insert into event_like select * from mysql.event; alter table mysql.event change column body body longtext character set utf8 collate utf8_bin; "Now we restart the server" +call mtr.add_suppression("Incorrect definition of table mysql.event:.*"); # restart use events_test; select @@event_scheduler; diff --git a/mysql-test/main/events_restart.test b/mysql-test/main/events_restart.test index 624c4188f9a47..6f7c01d81c227 100644 --- a/mysql-test/main/events_restart.test +++ b/mysql-test/main/events_restart.test @@ -45,6 +45,7 @@ alter table mysql.event change column body body longtext character set utf8 collate utf8_bin; --echo "Now we restart the server" +call mtr.add_suppression("Incorrect definition of table mysql.event:.*"); --source include/restart_mysqld.inc use events_test; diff --git a/mysql-test/main/events_trans.test b/mysql-test/main/events_trans.test index eea24f195777f..cc83fa6e578e7 100644 --- a/mysql-test/main/events_trans.test +++ b/mysql-test/main/events_trans.test @@ -3,6 +3,7 @@ # -- source include/have_innodb.inc -- source include/not_embedded.inc +-- source include/no_view_protocol.inc set sql_mode=""; diff --git a/mysql-test/main/except.result b/mysql-test/main/except.result index c88b91991f2f8..698f33d87095f 100644 --- a/mysql-test/main/except.result +++ b/mysql-test/main/except.result @@ -378,7 +378,11 @@ ANALYZE "buffer_type": "flat", "buffer_size": "119", "join_type": "BNL", - "r_filtered": 100 + "r_loops": 2, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 2 } } ] @@ -420,7 +424,11 @@ ANALYZE "buffer_type": "flat", "buffer_size": "119", "join_type": "BNL", - "r_filtered": 100 + "r_loops": 2, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 2 } } ] @@ -493,7 +501,11 @@ ANALYZE "buffer_type": "flat", "buffer_size": "119", "join_type": "BNL", - "r_filtered": 100 + "r_loops": 2, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 2 } } ] @@ -535,7 +547,11 @@ ANALYZE "buffer_type": "flat", "buffer_size": "119", "join_type": "BNL", - "r_filtered": 100 + "r_loops": 2, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 2 } } ] @@ -604,7 +620,7 @@ t3 CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL, `b` blob DEFAULT NULL, `b1` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop tables t1,t2,t3; # # MDEV-13723: Server crashes in ha_heap::find_unique_row or diff --git a/mysql-test/main/except_all.result b/mysql-test/main/except_all.result index f74aeda5ab2cf..a014425431257 100644 --- a/mysql-test/main/except_all.result +++ b/mysql-test/main/except_all.result @@ -505,7 +505,11 @@ ANALYZE "buffer_type": "flat", "buffer_size": "119", "join_type": "BNL", - "r_filtered": 100 + "r_loops": 3, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 3 } } ] @@ -547,7 +551,11 @@ ANALYZE "buffer_type": "flat", "buffer_size": "119", "join_type": "BNL", - "r_filtered": 100 + "r_loops": 2, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 3 } } ] @@ -619,7 +627,11 @@ ANALYZE "buffer_type": "flat", "buffer_size": "119", "join_type": "BNL", - "r_filtered": 100 + "r_loops": 3, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 3 } } ] @@ -661,7 +673,11 @@ ANALYZE "buffer_type": "flat", "buffer_size": "119", "join_type": "BNL", - "r_filtered": 100 + "r_loops": 2, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 3 } } ] @@ -742,7 +758,7 @@ t3 CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL, `b` blob DEFAULT NULL, `b1` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop tables t1,t2,t3; CREATE TABLE t (i INT); INSERT INTO t VALUES (1),(2); diff --git a/mysql-test/main/explain.result b/mysql-test/main/explain.result index bc3c53d01d32d..8db5e9f51ac9d 100644 --- a/mysql-test/main/explain.result +++ b/mysql-test/main/explain.result @@ -413,3 +413,48 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t1 system NULL NULL NULL NULL 1 drop table t1, t2; # End of 10.1 tests +# +# End of 10.2 test +# +# +# MDEV-25564: Server crashed on running some EXPLAIN statements +# +EXPLAIN (SELECT 1,3) UNION (SELECT 2,1) ORDER BY (SELECT 2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT ALL NULL NULL NULL NULL NULL Using filesort +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +# +# MDEV-23160: SIGSEGV in Explain_node::print_explain_for_children on UNION SELECT +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +EXPLAIN +SELECT * +FROM t1 +WHERE +a IN (SELECT a FROM t1 +UNION +SELECT a FROM t1 ORDER BY (SELECT a)) +UNION +SELECT * FROM t1 ORDER BY (SELECT a); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where +3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 3 Using where +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +5 UNION t1 ALL NULL NULL NULL NULL 3 +NULL UNION RESULT ALL NULL NULL NULL NULL NULL Using filesort +6 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +drop table t1; +explain +VALUES ( (VALUES (2))) UNION VALUES ( (SELECT 3)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +5 SUBQUERY ALL NULL NULL NULL NULL 2 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +Warnings: +Note 1249 Select 4 was reduced during optimization diff --git a/mysql-test/main/explain.test b/mysql-test/main/explain.test index 0fa4a5af215ec..36595ba727c58 100644 --- a/mysql-test/main/explain.test +++ b/mysql-test/main/explain.test @@ -339,3 +339,36 @@ explain replace into t2 select 100, (select a from t1); drop table t1, t2; --echo # End of 10.1 tests + +--echo # +--echo # End of 10.2 test +--echo # + +--echo # +--echo # MDEV-25564: Server crashed on running some EXPLAIN statements +--echo # + +EXPLAIN (SELECT 1,3) UNION (SELECT 2,1) ORDER BY (SELECT 2); + +--echo # +--echo # MDEV-23160: SIGSEGV in Explain_node::print_explain_for_children on UNION SELECT +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); + +EXPLAIN +SELECT * +FROM t1 +WHERE + a IN (SELECT a FROM t1 + UNION + SELECT a FROM t1 ORDER BY (SELECT a)) +UNION + SELECT * FROM t1 ORDER BY (SELECT a); +drop table t1; + +--disable_ps_protocol +explain +VALUES ( (VALUES (2))) UNION VALUES ( (SELECT 3)); +--enable_ps_protocol diff --git a/mysql-test/main/explain_innodb.result b/mysql-test/main/explain_innodb.result new file mode 100644 index 0000000000000..c44d7baadeae0 --- /dev/null +++ b/mysql-test/main/explain_innodb.result @@ -0,0 +1,38 @@ +# +# MDEV-26249: Crash in in Explain_node::print_explain_for_children while writing to the slow query log +# +set @sql_tmp=@@slow_query_log; +SET GLOBAL slow_query_log = 1; +SET long_query_time = 0.000000; +SET log_slow_verbosity = 'explain'; +CREATE TABLE t1 ( id varchar(50), KEY (id)) engine=innodb; +SELECT * FROM (SELECT id FROM t1 GROUP BY id) dt WHERE 1=0; +id +select 1; +1 +1 +explain +SELECT * FROM (SELECT id FROM t1 GROUP BY id) dt WHERE 1=0; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 DERIVED t1 range NULL id 53 NULL 2 Using index for group-by +SET GLOBAL slow_query_log = @sql_tmp; +drop table t1; +# +# MDEV-31181: Server crash in subselect_uniquesubquery_engine::print +# upon EXPLAIN EXTENDED DELETE +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (pk INT PRIMARY KEY); +INSERT INTO t2 VALUES (1),(2); +EXPLAIN EXTENDED DELETE FROM t1 WHERE a IN (SELECT pk FROM t2); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index +Warnings: +Note 1003 /* select#1 */ delete from `test`.`t1` where (`test`.`t1`.`a`,(((`test`.`t1`.`a`)))) +drop table t1, t2; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/explain_innodb.test b/mysql-test/main/explain_innodb.test new file mode 100644 index 0000000000000..3dcad4c2d496a --- /dev/null +++ b/mysql-test/main/explain_innodb.test @@ -0,0 +1,39 @@ +--echo # +--echo # MDEV-26249: Crash in in Explain_node::print_explain_for_children while writing to the slow query log +--echo # + +--source include/have_innodb.inc + +set @sql_tmp=@@slow_query_log; +SET GLOBAL slow_query_log = 1; +SET long_query_time = 0.000000; +SET log_slow_verbosity = 'explain'; + +CREATE TABLE t1 ( id varchar(50), KEY (id)) engine=innodb; +SELECT * FROM (SELECT id FROM t1 GROUP BY id) dt WHERE 1=0; +select 1; + +explain +SELECT * FROM (SELECT id FROM t1 GROUP BY id) dt WHERE 1=0; + +SET GLOBAL slow_query_log = @sql_tmp; +drop table t1; + + +--echo # +--echo # MDEV-31181: Server crash in subselect_uniquesubquery_engine::print +--echo # upon EXPLAIN EXTENDED DELETE +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (pk INT PRIMARY KEY); +INSERT INTO t2 VALUES (1),(2); + +EXPLAIN EXTENDED DELETE FROM t1 WHERE a IN (SELECT pk FROM t2); + +drop table t1, t2; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/explain_json.result b/mysql-test/main/explain_json.result index a107fa3a6ff1b..5821a6abd86f5 100644 --- a/mysql-test/main/explain_json.result +++ b/mysql-test/main/explain_json.result @@ -303,8 +303,6 @@ EXPLAIN { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", "query_specifications": [ { "query_block": { @@ -1814,7 +1812,11 @@ ANALYZE "buffer_size": "400", "join_type": "BKA", "mrr_type": "Rowid-ordered scan", - "r_filtered": 100 + "r_loops": 10, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 1 } } ] diff --git a/mysql-test/main/explain_non_select.result b/mysql-test/main/explain_non_select.result index d1e7af6afdedc..03259fff62bde 100644 --- a/mysql-test/main/explain_non_select.result +++ b/mysql-test/main/explain_non_select.result @@ -157,9 +157,13 @@ id select_type table partitions type possible_keys key key_len ref rows Extra explain extended update t2 set b=3 where a in (3,4); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 update `test`.`t2` set `test`.`t2`.`b` = 3 where `test`.`t2`.`a` in (3,4) explain extended delete from t2 where a in (3,4); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 delete from `test`.`t2` where `test`.`t2`.`a` in (3,4) drop table t1,t2; # # Check the special case where partition pruning removed all partitions diff --git a/mysql-test/main/fast_prefix_index_fetch_innodb.test b/mysql-test/main/fast_prefix_index_fetch_innodb.test index cb7ec642fe340..52066e961174b 100644 --- a/mysql-test/main/fast_prefix_index_fetch_innodb.test +++ b/mysql-test/main/fast_prefix_index_fetch_innodb.test @@ -1,4 +1,5 @@ -- source include/have_innodb.inc +--disable_service_connection SET @save_opt= @@GLOBAL.innodb_prefix_index_cluster_optimization; set global innodb_prefix_index_cluster_optimization = ON; @@ -721,3 +722,4 @@ DROP TABLE wp_blogs; SET GLOBAL innodb_prefix_index_cluster_optimization = @save_opt; SET GLOBAL innodb_stats_persistent = @save_innodb_stats_persistent; +--enable_service_connection diff --git a/mysql-test/main/fetch_first.result b/mysql-test/main/fetch_first.result index 69a0336d722b9..df182381d1c60 100644 --- a/mysql-test/main/fetch_first.result +++ b/mysql-test/main/fetch_first.result @@ -1378,3 +1378,31 @@ a bar foo DROP TABLE t; +# +# MDEV-30324: Wrong result upon SELECT DISTINCT .. WITH TIES using index +# +CREATE TABLE t1 (a int, b char(3), KEY (a)); +INSERT INTO t1 VALUES (2,'foo'),(3,'bar'),(3,'bar'),(3,'zzz'); +EXPLAIN SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 1 ROWS WITH TIES; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a 5 NULL 1 Using temporary +SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 1 ROWS WITH TIES; +a b +2 foo +EXPLAIN SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 2 ROWS WITH TIES; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a 5 NULL 2 Using temporary +SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 2 ROWS WITH TIES; +a b +2 foo +3 bar +3 zzz +EXPLAIN SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 3 ROWS WITH TIES; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 3 ROWS WITH TIES; +a b +2 foo +3 bar +3 zzz +DROP TABLE t1; diff --git a/mysql-test/main/fetch_first.test b/mysql-test/main/fetch_first.test index 7c41b922978f9..98bbf1ca06bc5 100644 --- a/mysql-test/main/fetch_first.test +++ b/mysql-test/main/fetch_first.test @@ -16,6 +16,8 @@ insert into t_keyword values (1), (1), (2), (3), (2); --echo # Make sure the FETCH clause addition didn't introduce problems with --echo # the offset keyword. --echo # +#enable after fix MDEV-29645 +--disable_view_protocol select * from t1 order by a offset 2 rows; @@ -24,7 +26,7 @@ offset 2 rows; --sorted_result select * from t1 offset 2 rows; - +--enable_view_protocol --echo # --echo # Offset is now a reserved keyword. Column names can not have that name @@ -682,7 +684,8 @@ order by first_name offset 1 rows fetch first 2 rows with ties; - +#enable after fix MDEV-29645 +--disable_view_protocol select first_name, row_number() over () rn from t1 order by rn @@ -694,6 +697,7 @@ from t1 order by rn desc offset 1 rows fetch first 2 rows with ties; +--enable_view_protocol select first_name, score, rank() over (ORDER BY score) from t1 @@ -811,6 +815,8 @@ drop table t2; create table t1 (a int, b int, index (a,b)); insert into t1 values (1,1), (1,2), (1,3), (2,1), (2,2), (3,1); +#enable after fix MDEV-29645 +--disable_view_protocol select SQL_CALC_FOUND_ROWS a, b, count(*) from t1 group by a, b @@ -824,6 +830,7 @@ from t1 order by a fetch first 1 rows with ties; SELECT FOUND_ROWS(); +--enable_view_protocol --echo # --echo # Test index read optimization with ORDER BY as sub part of GROUP BY @@ -1052,3 +1059,22 @@ SELECT a FROM t ORDER BY a FETCH FIRST 2 ROWS WITH TIES; # Cleanup DROP TABLE t; + +--echo # +--echo # MDEV-30324: Wrong result upon SELECT DISTINCT .. WITH TIES using index +--echo # +CREATE TABLE t1 (a int, b char(3), KEY (a)); +INSERT INTO t1 VALUES (2,'foo'),(3,'bar'),(3,'bar'),(3,'zzz'); + +EXPLAIN SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 1 ROWS WITH TIES; +--sorted_result +SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 1 ROWS WITH TIES; +EXPLAIN SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 2 ROWS WITH TIES; +--sorted_result +SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 2 ROWS WITH TIES; +EXPLAIN SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 3 ROWS WITH TIES; +--sorted_result +SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 3 ROWS WITH TIES; + +# Cleanup +DROP TABLE t1; diff --git a/mysql-test/main/fix_priv_tables.result b/mysql-test/main/fix_priv_tables.result index 3f1830aadbc79..c39ebfb922722 100644 --- a/mysql-test/main/fix_priv_tables.result +++ b/mysql-test/main/fix_priv_tables.result @@ -17,7 +17,7 @@ GRANT SELECT(c1) on testdb.v1 to 'select_only_c1'@localhost; SHOW GRANTS FOR 'select_only_c1'@'localhost'; Grants for select_only_c1@localhost GRANT USAGE ON *.* TO `select_only_c1`@`localhost` -GRANT SELECT (c1) ON `testdb`.`v1` TO `select_only_c1`@`localhost` +GRANT SELECT (`c1`) ON `testdb`.`v1` TO `select_only_c1`@`localhost` "after fix privs" SHOW GRANTS FOR 'show_view_tbl'@'localhost'; @@ -28,7 +28,7 @@ GRANT CREATE VIEW, SHOW VIEW ON `testdb`.`v1` TO `show_view_tbl`@`localhost` SHOW GRANTS FOR 'select_only_c1'@'localhost'; Grants for select_only_c1@localhost GRANT USAGE ON *.* TO `select_only_c1`@`localhost` -GRANT SELECT (c1) ON `testdb`.`v1` TO `select_only_c1`@`localhost` +GRANT SELECT (`c1`) ON `testdb`.`v1` TO `select_only_c1`@`localhost` DROP USER 'show_view_tbl'@'localhost'; DROP USER 'select_only_c1'@'localhost'; diff --git a/mysql-test/main/fix_priv_tables.test b/mysql-test/main/fix_priv_tables.test index 293d3915a0529..382417a6b1010 100644 --- a/mysql-test/main/fix_priv_tables.test +++ b/mysql-test/main/fix_priv_tables.test @@ -1,5 +1,6 @@ # Embedded server doesn't support external clients --source include/not_embedded.inc +--source include/no_view_protocol.inc # Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set # to the location of mysql_fix_privilege_tables.sql diff --git a/mysql-test/main/flush-innodb-notembedded.result b/mysql-test/main/flush-innodb-notembedded.result index 0b63a7b3519dd..279e52ae1cf9a 100644 --- a/mysql-test/main/flush-innodb-notembedded.result +++ b/mysql-test/main/flush-innodb-notembedded.result @@ -30,7 +30,7 @@ disconnect con1; connection default; connect con1, localhost, user5; FLUSH TABLE db1.t1 FOR EXPORT; -ERROR 42000: SELECT command denied to user 'user5'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user5'@'localhost' for table `db1`.`t1` disconnect con1; connection default; DROP USER user1@localhost, user2@localhost, user3@localhost, diff --git a/mysql-test/main/flush-innodb.test b/mysql-test/main/flush-innodb.test index 309ec5de014a0..7665ae5e07726 100644 --- a/mysql-test/main/flush-innodb.test +++ b/mysql-test/main/flush-innodb.test @@ -1,5 +1,9 @@ --source include/have_innodb.inc +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + # MDEV-254: Server hang with FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT; UNLOCK TABLES; diff --git a/mysql-test/main/flush.test b/mysql-test/main/flush.test index d31c7591cbfd6..887c48ef018e0 100644 --- a/mysql-test/main/flush.test +++ b/mysql-test/main/flush.test @@ -1,3 +1,5 @@ +--disable_service_connection + connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con1; @@ -420,6 +422,7 @@ drop table t1; --echo # Bug#52117 Pending FLUSH TALBES aborts --echo # transactions unnecessarily. --echo # +--disable_view_protocol --disable_warnings drop table if exists t1; --enable_warnings @@ -495,7 +498,7 @@ disconnect con2; --source include/wait_until_disconnected.inc connection default; drop table t1; - +--enable_view_protocol --echo # --echo # Test for bug #55273 "FLUSH TABLE tm WITH READ LOCK for Merge table @@ -533,6 +536,7 @@ drop tables tm, t1, t2; --echo # Test for bug #57006 "Deadlock between HANDLER and --echo # FLUSH TABLES WITH READ LOCK". --echo # +--disable_view_protocol --disable_warnings drop table if exists t1, t2; --enable_warnings @@ -575,7 +579,7 @@ disconnect con2; --source include/wait_until_disconnected.inc connection default; drop tables t1, t2; - +--enable_view_protocol --echo # --echo # Bug#57649 FLUSH TABLES under FLUSH TABLES WITH READ LOCK leads @@ -783,3 +787,5 @@ DROP VIEW v2, v1, v0; --echo # --echo # End of 10.6 tests --echo # + +--enable_service_connection diff --git a/mysql-test/main/flush_block_commit.result b/mysql-test/main/flush_block_commit.result index e9684e5aa4694..187ca145e78cd 100644 --- a/mysql-test/main/flush_block_commit.result +++ b/mysql-test/main/flush_block_commit.result @@ -54,7 +54,7 @@ a 10 SHOW CREATE DATABASE test; Database Create Database -test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ +test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ COMMIT; # Cleanup connection default; diff --git a/mysql-test/main/flush_block_commit_notembedded.test b/mysql-test/main/flush_block_commit_notembedded.test index 5be9e50e58b8e..024640893d9c0 100644 --- a/mysql-test/main/flush_block_commit_notembedded.test +++ b/mysql-test/main/flush_block_commit_notembedded.test @@ -12,6 +12,10 @@ --echo # Save the initial number of concurrent sessions --source include/count_sessions.inc +--disable_query_log +# This may be triggered on a slow system or one that lacks native AIO. +call mtr.add_suppression("InnoDB: Trying to delete tablespace.*pending operations"); +--enable_query_log connect (con1,localhost,root,,); connect (con2,localhost,root,,); diff --git a/mysql-test/main/flush_logs_not_windows.test b/mysql-test/main/flush_logs_not_windows.test index af50e4bb9e80f..ff30062b3a361 100644 --- a/mysql-test/main/flush_logs_not_windows.test +++ b/mysql-test/main/flush_logs_not_windows.test @@ -1,3 +1,7 @@ +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + source include/not_windows.inc; source include/not_embedded.inc; # diff --git a/mysql-test/main/flush_notembedded.result b/mysql-test/main/flush_notembedded.result index f4c83ff2361ee..25ddeba17d34a 100644 --- a/mysql-test/main/flush_notembedded.result +++ b/mysql-test/main/flush_notembedded.result @@ -38,13 +38,13 @@ CREATE VIEW v2 AS SELECT * FROM performance_schema.accounts; FLUSH TABLE information_schema.collations WITH READ LOCK; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' FLUSH TABLE performance_schema.accounts WITH READ LOCK; -ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'accounts' +ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table `performance_schema`.`accounts` FLUSH TABLE information_schema.colums WITH READ LOCK; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' FLUSH TABLE information_schema.collations FOR EXPORT; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' FLUSH TABLE performance_schema.accounts FOR EXPORT; -ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'accounts' +ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table `performance_schema`.`accounts` FLUSH TABLE information_schema.colums FOR EXPORT; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' # diff --git a/mysql-test/main/flush_table.test b/mysql-test/main/flush_table.test index e4fc1b0c39f46..91047c2d9d39c 100644 --- a/mysql-test/main/flush_table.test +++ b/mysql-test/main/flush_table.test @@ -6,6 +6,9 @@ # Should work in embedded server after mysqltest is fixed -- source include/not_embedded.inc + +--disable_service_connection + --disable_warnings drop table if exists t1,t2; --enable_warnings @@ -59,6 +62,7 @@ select * from t1; connection default; drop table t1; disconnect locker; +--enable_service_connection # # In the following test FLUSH TABLES produces a deadlock diff --git a/mysql-test/main/foreign_key.result b/mysql-test/main/foreign_key.result index 46c8d3b7feea3..d673b77d613c2 100644 --- a/mysql-test/main/foreign_key.result +++ b/mysql-test/main/foreign_key.result @@ -101,7 +101,7 @@ tfk CREATE TABLE `tfk` ( `c2` int(11) DEFAULT NULL, KEY `sid` (`c1`), CONSTRAINT `sid` FOREIGN KEY (`c1`) REFERENCES `tpk` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE tfk ADD CONSTRAINT sid CHECK (c2>15); ERROR HY000: Duplicate CHECK constraint name 'sid' ALTER TABLE tfk ADD CONSTRAINT sid UNIQUE(c2); diff --git a/mysql-test/main/frm_bad_row_type-7333.result b/mysql-test/main/frm_bad_row_type-7333.result index f1ce23bc457ee..91974bfa863db 100644 --- a/mysql-test/main/frm_bad_row_type-7333.result +++ b/mysql-test/main/frm_bad_row_type-7333.result @@ -7,7 +7,7 @@ bad_row_type CREATE TABLE `bad_row_type` ( `category_id` int(11) NOT NULL AUTO_INCREMENT, `category_name` varchar(255) DEFAULT NULL, PRIMARY KEY (`category_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 /* `compression`='tokudb_zlib' */ +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci /* `compression`='tokudb_zlib' */ show table status like 'bad_row_type'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary bad_row_type MyISAM 10 Dynamic 0 0 0 281474976710655 1024 0 1 x x NULL utf8mb3_general_ci NULL `compression`='tokudb_zlib' x N diff --git a/mysql-test/main/fulltext.result b/mysql-test/main/fulltext.result index 6f294eb463113..3acde6121ecd2 100644 --- a/mysql-test/main/fulltext.result +++ b/mysql-test/main/fulltext.result @@ -252,7 +252,7 @@ t2 CREATE TABLE `t2` ( `inhalt` text DEFAULT NULL, KEY `tig` (`ticket`), FULLTEXT KEY `tix` (`inhalt`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t2 where MATCH inhalt AGAINST (NULL); ticket inhalt select * from t2 where MATCH inhalt AGAINST ('foobar'); @@ -457,7 +457,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10000) DEFAULT NULL, FULLTEXT KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a)); INSERT INTO t1 VALUES('test'),('test1'),('test'); diff --git a/mysql-test/main/fulltext.test b/mysql-test/main/fulltext.test index c7aeae3fa31de..8b90c9cd81d7d 100644 --- a/mysql-test/main/fulltext.test +++ b/mysql-test/main/fulltext.test @@ -278,6 +278,7 @@ drop table t1; # # UTF8 # +--disable_service_connection SET NAMES latin1; CREATE TABLE t1 (t text character set utf8 not null, fulltext(t)); INSERT t1 VALUES ('Mit freundlichem Gr��'), ('aus Osnabr�ck'); @@ -298,7 +299,7 @@ alter table t1 modify t varchar(200) collate latin1_german2_ci not null; SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabr�ck'); SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck'); DROP TABLE t1; - +--enable_service_connection # # bug#3964 # @@ -346,7 +347,9 @@ drop table t1, t2; CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t)); SET NAMES latin1; INSERT INTO t1 VALUES('Mit freundlichem Gr�� aus Osnabr�ck'); +--disable_service_connection SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabr�ck"' IN BOOLEAN MODE); +--enable_service_connection DROP TABLE t1; # @@ -655,6 +658,7 @@ DROP TABLE t1; --echo # --echo # MDEV-6146 Can't mix (latin1_swedish_ci,NUMERIC) and (utf8_unicode_ci,IMPLICIT) for MATCH --echo # +--disable_service_connection SET NAMES utf8; CREATE TABLE t1 ( @@ -682,7 +686,7 @@ INSERT INTO t1 VALUES ('nnn5 x5 y5 ööö5','mmm5 '); SELECT * FROM t1 WHERE MATCH (txt1,txt2) AGAINST ('ööö1' IN BOOLEAN MODE); SELECT * FROM t1 WHERE MATCH (txt1,txt2) AGAINST ('ùùù2' IN BOOLEAN MODE); DROP TABLE t1; - +--enable_service_connection --echo # --echo # MDEV-14743: Server crashes in Item_func_match::init_search @@ -691,7 +695,10 @@ DROP TABLE t1; CREATE TABLE t1 (f VARCHAR(8)); INSERT INTO t1 VALUES ('foo'),('bar'); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) ); +--enable_view_protocol SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ; explain extended SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ; diff --git a/mysql-test/main/fulltext2.test b/mysql-test/main/fulltext2.test index dc7af398bb641..e8b613bcb031e 100644 --- a/mysql-test/main/fulltext2.test +++ b/mysql-test/main/fulltext2.test @@ -232,9 +232,12 @@ set names latin1; # # BUG#19580 - FULLTEXT search produces wrong results on UTF-8 columns # +--disable_service_connection SET NAMES utf8; CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO t1 VALUES('„MySQL“'); SELECT a FROM t1 WHERE MATCH a AGAINST('“MySQL„' IN BOOLEAN MODE); DROP TABLE t1; SET NAMES latin1; +--enable_service_connection + diff --git a/mysql-test/main/fulltext_left_join.test b/mysql-test/main/fulltext_left_join.test index 3a81c1a5d1ba3..8d08fba430113 100644 --- a/mysql-test/main/fulltext_left_join.test +++ b/mysql-test/main/fulltext_left_join.test @@ -26,8 +26,11 @@ INSERT INTO t2 VALUES('456', 'lui'); select round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5) from t1 left join t2 on t2.id=t1.id; +#enable after fix MDEV-27871 +--disable_view_protocol select match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE) from t1 left join t2 on t2.id=t1.id; +--enable_view_protocol drop table t1, t2; diff --git a/mysql-test/main/func_bit.result b/mysql-test/main/func_bit.result index 4eb44f76ef3a8..d8bfe80dda534 100644 --- a/mysql-test/main/func_bit.result +++ b/mysql-test/main/func_bit.result @@ -30,7 +30,7 @@ CALL p1('BIGINT UNSIGNED', 18446744073709551615); Table t1 Create Table CREATE TABLE `t1` ( `a` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 18446744073709551615 ~a 0 a & 18446744073709551615 18446744073709551615 @@ -46,7 +46,7 @@ CALL p1('DOUBLE', 18446744073709551615); Table t1 Create Table CREATE TABLE `t1` ( `a` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 1.8446744073709552e19 ~a 0 a & 18446744073709551615 18446744073709551615 @@ -92,7 +92,7 @@ CALL p1('DECIMAL(30,0)', 18446744073709551615); Table t1 Create Table CREATE TABLE `t1` ( `a` decimal(30,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 18446744073709551615 ~a 0 a & 18446744073709551615 18446744073709551615 @@ -108,7 +108,7 @@ CALL p1('BIGINT', -1); Table t1 Create Table CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -1 ~a 0 a & 18446744073709551615 18446744073709551615 @@ -124,7 +124,7 @@ CALL p1('DOUBLE', -1); Table t1 Create Table CREATE TABLE `t1` ( `a` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -1 ~a 0 a & 18446744073709551615 18446744073709551615 @@ -140,7 +140,7 @@ CALL p1('DECIMAL(30,0)', -1); Table t1 Create Table CREATE TABLE `t1` ( `a` decimal(30,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -1 ~a 0 a & 18446744073709551615 18446744073709551615 @@ -156,7 +156,7 @@ CALL p1('BIGINT', -9223372036854775808); Table t1 Create Table CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9223372036854775808 ~a 9223372036854775807 a & 18446744073709551615 9223372036854775808 @@ -172,7 +172,7 @@ CALL p1('DOUBLE', -9223372036854775808); Table t1 Create Table CREATE TABLE `t1` ( `a` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9.223372036854776e18 ~a 9223372036854775807 a & 18446744073709551615 9223372036854775808 @@ -218,7 +218,7 @@ CALL p1('DECIMAL(30,0)', -9223372036854775808); Table t1 Create Table CREATE TABLE `t1` ( `a` decimal(30,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9223372036854775808 ~a 9223372036854775807 a & 18446744073709551615 9223372036854775808 diff --git a/mysql-test/main/func_compress.result b/mysql-test/main/func_compress.result index 065b68b4979ef..78706ac03687d 100644 --- a/mysql-test/main/func_compress.result +++ b/mysql-test/main/func_compress.result @@ -193,9 +193,6 @@ DROP TABLE t1; # End of 10.1 tests # # -# Start of 10.2 tests -# -# # MDEV-10134 Add full support for DEFAULT # CREATE TABLE t1 (a TEXT, b BLOB DEFAULT COMPRESS(a), bl INT DEFAULT UNCOMPRESSED_LENGTH(b), a1 TEXT DEFAULT UNCOMPRESS(b)); @@ -206,12 +203,20 @@ t1 CREATE TABLE `t1` ( `b` blob DEFAULT compress(`a`), `bl` int(11) DEFAULT uncompressed_length(`b`), `a1` text DEFAULT uncompress(`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (REPEAT('a',100)); SELECT bl, a1 FROM t1; bl a1 100 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa DROP TABLE t1; # +# MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn +# +select 'foo' in (cast(compress('bar') as char(4)), 'qux'); +'foo' in (cast(compress('bar') as char(4)), 'qux') +0 +Warnings: +Warning 1292 Truncated incorrect CHAR(4) value: '\x03\x00\x00\x00x\x9CKJ,\x02\x00\x02]\x016' +# # End of 10.2 tests # diff --git a/mysql-test/main/func_compress.test b/mysql-test/main/func_compress.test index 983b792f4c404..f41a58981548a 100644 --- a/mysql-test/main/func_compress.test +++ b/mysql-test/main/func_compress.test @@ -48,6 +48,9 @@ drop table t1; # note that when LOW_MEMORY is set the "test" below is meaningless # +#view protocol generates additional warning +--disable_view_protocol + set @@global.max_allowed_packet=1048576*100; --replace_result "''" XXX "'1'" XXX @@ -59,6 +62,8 @@ disconnect newconn; connection default; set @@global.max_allowed_packet=@save_max_allowed_packet; +--enable_view_protocol + # # Bug #18643: problem with null values # @@ -173,10 +178,6 @@ DROP TABLE t1; --echo # End of 10.1 tests --echo # ---echo # ---echo # Start of 10.2 tests ---echo # - --echo # --echo # MDEV-10134 Add full support for DEFAULT --echo # @@ -186,6 +187,13 @@ INSERT INTO t1 (a) VALUES (REPEAT('a',100)); SELECT bl, a1 FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn +--echo # +--disable_view_protocol +select 'foo' in (cast(compress('bar') as char(4)), 'qux'); +--enable_view_protocol + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/func_concat.test b/mysql-test/main/func_concat.test index e1bda4be29e6b..070d341cb2d10 100644 --- a/mysql-test/main/func_concat.test +++ b/mysql-test/main/func_concat.test @@ -56,10 +56,16 @@ select 'a' union select concat('a', -0.0000); # # Bug#16716: subselect in concat() may lead to a wrong result # + +#enable after fix MDEV-27871 +--disable_view_protocol + select concat((select x from (select 'a' as x) as t1 ), (select y from (select 'b' as y) as t2 )) from (select 1 union select 2 ) as t3; +--enable_view_protocol + # End of 4.1 tests # diff --git a/mysql-test/main/func_crypt.result b/mysql-test/main/func_crypt.result index 2c42d3dc845d9..4d2bddb7e5fc5 100644 --- a/mysql-test/main/func_crypt.result +++ b/mysql-test/main/func_crypt.result @@ -92,6 +92,14 @@ 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 password('idkfa ') AS `password('idkfa ')`,old_password('idkfa') AS `old_password('idkfa')` +CREATE VIEW v1 AS SELECT ENCRYPT("dhgdhgd"); +SELECT * FROM v1; +drop view v1; +CREATE VIEW v1 AS SELECT SUBSTRING_INDEX("dkjhgd:kjhdjh", ":", 1); +SELECT * FROM v1; +SUBSTRING_INDEX("dkjhgd:kjhdjh", ":", 1) +dkjhgd +drop view v1; select encrypt('1234','_.'); encrypt('1234','_.') # @@ -105,6 +113,13 @@ SELECT OLD_PASSWORD(c1), PASSWORD(c1) FROM t1; OLD_PASSWORD(c1) PASSWORD(c1) 77023ffe214c04ff *82E58A2C08AAFE72C8EB523069CD8ADB33F78F58 DROP TABLE t1; +drop table if exists t1; +create table t1 (f1 smallint(6) default null, f2 mediumtext character set utf8) +engine=myisam default charset=latin1; +insert into t1 values (null,'contraction\'s'); +insert into t1 values (-15818,'requirement\'s'); +select encrypt(f1,f2) as a from t1,(select encrypt(f1,f2) as b from t1) a; +drop table t1; # End of 5.0 tests # # Start of 10.0 tests @@ -208,10 +223,20 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(30) DEFAULT encrypt(`a`,123) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('hello'); SELECT * FROM t1; a b hello 12NKz5XM5JeKI DROP TABLE t1; # End of 10.2 tests +# +# MDEV-25778 Overrun buffer in to_string_native() +# +CREATE TABLE t1 (a DECIMAL(15,11) ZEROFILL); +INSERT INTO t1 (a) VALUES (0.1),(0.2); +SELECT length(ENCRYPT(a)) AS f, COUNT(*) FROM t1 GROUP BY f; +f COUNT(*) +13 2 +DROP TABLE t1; +# End of 10.6 tests diff --git a/mysql-test/main/func_crypt.test b/mysql-test/main/func_crypt.test index 118a7023669d5..cf6a6371e5027 100644 --- a/mysql-test/main/func_crypt.test +++ b/mysql-test/main/func_crypt.test @@ -51,6 +51,18 @@ select old_password(' i d k f a '); explain extended select password('idkfa '), old_password('idkfa'); +# +# using encrypt & substring_index in view (Bug#7024) +# +CREATE VIEW v1 AS SELECT ENCRYPT("dhgdhgd"); +disable_result_log; +SELECT * FROM v1; +enable_result_log; +drop view v1; +CREATE VIEW v1 AS SELECT SUBSTRING_INDEX("dkjhgd:kjhdjh", ":", 1); +SELECT * FROM v1; +drop view v1; + # # Bug #13619: Crash on FreeBSD with salt like '_.' # @@ -69,6 +81,21 @@ INSERT INTO t1 VALUES (REPEAT('a', 1024)); SELECT OLD_PASSWORD(c1), PASSWORD(c1) FROM t1; DROP TABLE t1; +# +# Bug#44365 valgrind warnings with encrypt() function +# +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (f1 smallint(6) default null, f2 mediumtext character set utf8) +engine=myisam default charset=latin1; +insert into t1 values (null,'contraction\'s'); +insert into t1 values (-15818,'requirement\'s'); +--disable_result_log +select encrypt(f1,f2) as a from t1,(select encrypt(f1,f2) as b from t1) a; +--enable_result_log +drop table t1; + --echo # End of 5.0 tests --echo # --echo # Start of 10.0 tests @@ -122,3 +149,14 @@ SELECT * FROM t1; DROP TABLE t1; --echo # End of 10.2 tests + +--echo # +--echo # MDEV-25778 Overrun buffer in to_string_native() +--echo # + +CREATE TABLE t1 (a DECIMAL(15,11) ZEROFILL); +INSERT INTO t1 (a) VALUES (0.1),(0.2); +SELECT length(ENCRYPT(a)) AS f, COUNT(*) FROM t1 GROUP BY f; +DROP TABLE t1; + +--echo # End of 10.6 tests diff --git a/mysql-test/main/func_debug.result b/mysql-test/main/func_debug.result index 08650fdd3c30b..c8efcf09d41ef 100644 --- a/mysql-test/main/func_debug.result +++ b/mysql-test/main/func_debug.result @@ -774,28 +774,28 @@ SELECT 'a' IN ('a',2); 1 Warnings: Note 1105 DBUG: [0] arg=1 handler=0 (longblob) -Note 1105 DBUG: [1] arg=2 handler=1 (double) +Note 1105 DBUG: [1] arg=2 handler=1 (decimal) Note 1105 DBUG: types_compatible=no bisect=no SELECT 'a' IN ('a',2,NULL); 'a' IN ('a',2,NULL) 1 Warnings: Note 1105 DBUG: [0] arg=1 handler=0 (longblob) -Note 1105 DBUG: [1] arg=2 handler=1 (double) +Note 1105 DBUG: [1] arg=2 handler=1 (decimal) Note 1105 DBUG: types_compatible=no bisect=no SELECT 'a' NOT IN ('a',2); 'a' NOT IN ('a',2) 0 Warnings: Note 1105 DBUG: [0] arg=1 handler=0 (longblob) -Note 1105 DBUG: [1] arg=2 handler=1 (double) +Note 1105 DBUG: [1] arg=2 handler=1 (decimal) Note 1105 DBUG: types_compatible=no bisect=no SELECT 'a' NOT IN ('a',2,NULL); 'a' NOT IN ('a',2,NULL) 0 Warnings: Note 1105 DBUG: [0] arg=1 handler=0 (longblob) -Note 1105 DBUG: [1] arg=2 handler=1 (double) +Note 1105 DBUG: [1] arg=2 handler=1 (decimal) Note 1105 DBUG: types_compatible=no bisect=no SELECT TIME'10:20:30' IN (1,TIME'10:20:30'); TIME'10:20:30' IN (1,TIME'10:20:30') @@ -999,25 +999,25 @@ SELECT a IN (1,'1') FROM t1; a IN (1,'1') Warnings: Note 1105 DBUG: [0] arg=1 handler=0 (bigint) -Note 1105 DBUG: [1] arg=2 handler=1 (double) +Note 1105 DBUG: [1] arg=2 handler=1 (decimal) Note 1105 DBUG: types_compatible=no bisect=no SELECT a IN (1,'1',NULL) FROM t1; a IN (1,'1',NULL) Warnings: Note 1105 DBUG: [0] arg=1 handler=0 (bigint) -Note 1105 DBUG: [1] arg=2 handler=1 (double) +Note 1105 DBUG: [1] arg=2 handler=1 (decimal) Note 1105 DBUG: types_compatible=no bisect=no SELECT a NOT IN (1,'1') FROM t1; a NOT IN (1,'1') Warnings: Note 1105 DBUG: [0] arg=1 handler=0 (bigint) -Note 1105 DBUG: [1] arg=2 handler=1 (double) +Note 1105 DBUG: [1] arg=2 handler=1 (decimal) Note 1105 DBUG: types_compatible=no bisect=no SELECT a NOT IN (1,'1',NULL) FROM t1; a NOT IN (1,'1',NULL) Warnings: Note 1105 DBUG: [0] arg=1 handler=0 (bigint) -Note 1105 DBUG: [1] arg=2 handler=1 (double) +Note 1105 DBUG: [1] arg=2 handler=1 (decimal) Note 1105 DBUG: types_compatible=no bisect=no SELECT a IN (1,TIME'10:20:30') FROM t1; a IN (1,TIME'10:20:30') @@ -1197,7 +1197,7 @@ SELECT a IN ('a',1) FROM t1; a IN ('a',1) Warnings: Note 1105 DBUG: [0] arg=1 handler=0 (longblob) -Note 1105 DBUG: [1] arg=2 handler=1 (double) +Note 1105 DBUG: [1] arg=2 handler=1 (decimal) Note 1105 DBUG: types_compatible=no bisect=no SELECT a IN ('a',TIME'10:20:30') FROM t1; a IN ('a',TIME'10:20:30') @@ -1209,7 +1209,7 @@ SELECT a NOT IN ('a',1) FROM t1; a NOT IN ('a',1) Warnings: Note 1105 DBUG: [0] arg=1 handler=0 (longblob) -Note 1105 DBUG: [1] arg=2 handler=1 (double) +Note 1105 DBUG: [1] arg=2 handler=1 (decimal) Note 1105 DBUG: types_compatible=no bisect=no SELECT a NOT IN ('a',TIME'10:20:30') FROM t1; a NOT IN ('a',TIME'10:20:30') @@ -1581,7 +1581,7 @@ A NULL B NULL Warnings: Note 1105 DBUG: [0] arg=2 handler=0 (longblob) -Note 1105 DBUG: [1] arg=3 handler=1 (double) +Note 1105 DBUG: [1] arg=3 handler=1 (decimal) Note 1105 DBUG: types_compatible=no bisect=no SELECT a,NULL AS b FROM t1 GROUP BY a HAVING 'A' IN ('A',b,10); a b @@ -1589,30 +1589,30 @@ A NULL B NULL Warnings: Note 1105 DBUG: [0] arg=1 handler=0 (longblob) -Note 1105 DBUG: [1] arg=3 handler=1 (double) +Note 1105 DBUG: [1] arg=3 handler=1 (decimal) Note 1105 DBUG: types_compatible=no bisect=no SELECT a,NULL AS b FROM t1 GROUP BY a HAVING 'A' IN (b,a,10); a b A NULL Warnings: Note 1105 DBUG: [0] arg=2 handler=0 (longblob) -Note 1105 DBUG: [1] arg=3 handler=1 (double) +Note 1105 DBUG: [1] arg=3 handler=1 (decimal) Note 1105 DBUG: types_compatible=no bisect=no Note 1105 DBUG: [0] arg=2 handler=0 (longblob) -Note 1105 DBUG: [1] arg=3 handler=1 (double) +Note 1105 DBUG: [1] arg=3 handler=1 (decimal) Note 1105 DBUG: types_compatible=no bisect=no -Warning 1292 Truncated incorrect DOUBLE value: 'A' +Warning 1292 Truncated incorrect DECIMAL value: 'A' SELECT a,NULL AS b FROM t1 GROUP BY a HAVING 'A' IN (a,b,10); a b A NULL Warnings: Note 1105 DBUG: [0] arg=1 handler=0 (longblob) -Note 1105 DBUG: [1] arg=3 handler=1 (double) +Note 1105 DBUG: [1] arg=3 handler=1 (decimal) Note 1105 DBUG: types_compatible=no bisect=no Note 1105 DBUG: [0] arg=1 handler=0 (longblob) -Note 1105 DBUG: [1] arg=3 handler=1 (double) +Note 1105 DBUG: [1] arg=3 handler=1 (decimal) Note 1105 DBUG: types_compatible=no bisect=no -Warning 1292 Truncated incorrect DOUBLE value: 'A' +Warning 1292 Truncated incorrect DECIMAL value: 'A' DROP TABLE t1; # # MDEV-11497 Wrong result for (int_expr IN (mixture of signed and unsigned expressions)) @@ -1930,20 +1930,20 @@ SELECT '0x' IN (0); '0x' IN (0) 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '0x' +Warning 1292 Truncated incorrect DECIMAL value: '0x' SELECT '0x' IN (0,1); '0x' IN (0,1) 1 Warnings: -Note 1105 DBUG: [0] arg=1 handler=0 (double) -Note 1105 DBUG: [1] arg=2 handler=0 (double) +Note 1105 DBUG: [0] arg=1 handler=0 (decimal) +Note 1105 DBUG: [1] arg=2 handler=0 (decimal) Note 1105 DBUG: types_compatible=yes bisect=yes -Warning 1292 Truncated incorrect DOUBLE value: '0x' +Warning 1292 Truncated incorrect DECIMAL value: '0x' SELECT ('0x',1) IN ((0,1)); ('0x',1) IN ((0,1)) 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '0x' +Warning 1292 Truncated incorrect DECIMAL value: '0x' SELECT ('0x',1) IN ((0,1),(1,1)); ('0x',1) IN ((0,1),(1,1)) 1 @@ -1954,13 +1954,13 @@ Note 1105 DBUG: ROW(3 args) level=0 Note 1105 DBUG: [0,0] handler=varchar Note 1105 DBUG: [0,1] handler=int Note 1105 DBUG: [0,2] handler=int -Note 1105 DBUG: => handler=double +Note 1105 DBUG: => handler=decimal Note 1105 DBUG: [1,0] handler=int Note 1105 DBUG: [1,1] handler=int Note 1105 DBUG: [1,2] handler=int Note 1105 DBUG: => handler=bigint Note 1105 DBUG: types_compatible=yes bisect=yes -Warning 1292 Truncated incorrect DOUBLE value: '0x' +Warning 1292 Truncated incorrect DECIMAL value: '0x' SET SESSION debug_dbug="-d,Predicant_to_list_comparator"; SET SESSION debug_dbug="-d,Item_func_in"; SET SESSION debug_dbug="-d,cmp_item"; diff --git a/mysql-test/main/func_debug.test b/mysql-test/main/func_debug.test index 9ae24035e205d..1fbc652bb486e 100644 --- a/mysql-test/main/func_debug.test +++ b/mysql-test/main/func_debug.test @@ -24,11 +24,16 @@ SELECT 'a' IN ('a','b',NULL); SELECT 'a' NOT IN ('a','b'); SELECT 'a' NOT IN ('a','b',NULL); +#enable after fix MDEV-27871 +--disable_view_protocol + SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30'); SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL); SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30'); SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL); +--enable_view_protocol + SELECT TIME'10:20:30' IN ('10:20:30','10:20:30'); SELECT TIME'10:20:30' IN ('10:20:30','10:20:30',NULL); SELECT TIME'10:20:30' NOT IN ('10:20:30','10:20:30'); @@ -81,6 +86,9 @@ SELECT a NOT IN ('a','b','c') FROM t1; SELECT a NOT IN ('a','b','c',NULL) FROM t1; DROP TABLE t1; +#enable after fix MDEV-27871 +--disable_view_protocol + CREATE TABLE t1 (a DATE); SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) FROM t1; SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) FROM t1; @@ -102,6 +110,8 @@ SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TI SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) FROM t1; DROP TABLE t1; +--enable_view_protocol + --echo # Constant predicant, compatible types, no bisect --echo # Bisect is not used because of non-constant expressions in the list CREATE TABLE t1 (a INT); @@ -146,6 +156,9 @@ SELECT TIME'10:20:30' NOT IN (a,'10:20:30') FROM t1; SELECT TIME'10:20:30' NOT IN (a,'10:20:30',NULL) FROM t1; DROP TABLE t1; +#enable after fix MDEV-27871 +--disable_view_protocol + CREATE TABLE t1 (a DATETIME); SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30') FROM t1; SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) FROM t1; @@ -153,6 +166,7 @@ SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30') SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) FROM t1; DROP TABLE t1; +--enable_view_protocol --echo # Constant predicant, incompatible types, no bisect SELECT 1 IN (1,2e0); @@ -175,6 +189,9 @@ SELECT 'a' IN ('a',2,NULL); SELECT 'a' NOT IN ('a',2); SELECT 'a' NOT IN ('a',2,NULL); +#enable after fix MDEV-27871 +--disable_view_protocol + SELECT TIME'10:20:30' IN (1,TIME'10:20:30'); SELECT TIME'10:20:30' IN (1,TIME'10:20:30',NULL); SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32'); @@ -203,6 +220,8 @@ SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1; SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1; SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1; +--enable_view_protocol + SELECT a IN (1,1.0) FROM t1; SELECT a IN (1,1.0,NULL) FROM t1; SELECT a NOT IN (1,1.0) FROM t1; @@ -260,6 +279,9 @@ SELECT a NOT IN ('a',1) FROM t1; SELECT a NOT IN ('a',TIME'10:20:30') FROM t1; DROP TABLE t1; +#enable after fix MDEV-27871 +--disable_view_protocol + CREATE TABLE t1 (a TIME); SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1; SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1; @@ -271,6 +293,8 @@ SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1; DROP TABLE t1; +--enable_view_protocol + # # ROW tests # @@ -413,9 +437,13 @@ DROP TABLE t1; --echo # --echo # MDEV-11514 IN with a mixture of TIME and DATETIME returns a wrong result --echo # +#enable after fix MDEV-27871 +--disable_view_protocol SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32'); +--enable_view_protocol + PREPARE stmt FROM "SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32')"; EXECUTE stmt; @@ -502,7 +530,10 @@ SELECT * FROM t1 WHERE a BETWEEN 1 AND 1; SELECT * FROM t1 WHERE a BETWEEN 0 AND 1; SELECT * FROM t1 WHERE a BETWEEN 0 AND -1; SELECT * FROM t1 WHERE a BETWEEN -1 AND -1; +#enable after fix MDEV-29524 +--disable_view_protocol SELECT * FROM t1 WHERE a BETWEEN -0000000000000001 AND -1; +--enable_view_protocol SELECT * FROM t1 WHERE a BETWEEN -1 AND 18446744073709551615; SELECT * FROM t1 WHERE a BETWEEN -1 AND 18446744073709551616; SELECT * FROM t1 WHERE a BETWEEN 1e2 AND 100e0; diff --git a/mysql-test/main/func_default.result b/mysql-test/main/func_default.result index 9699f0795e3e1..8330b3a39fe8a 100644 --- a/mysql-test/main/func_default.result +++ b/mysql-test/main/func_default.result @@ -29,6 +29,9 @@ INSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three'); SELECT s, 32 AS mi FROM t1 GROUP BY s HAVING DEFAULT(mi) IS NULL; ERROR HY000: Field 'mi' doesn't have a default value DROP TABLE t1; +# +# Start of 10.2 tests +# set timestamp=unix_timestamp('2001-01-01 10:20:30.123456'); create table t1 (a int default 1, b int default (a+1), c varchar(100) default 'foo', d text default 'bar', @@ -40,3 +43,173 @@ default(a) default(b) default(c) default(d) default(e) default(f) 1 2 foo bar 2001-01-01 10:20:30 2001-01-01 10:20:30.120000 1 11 foo bar 2001-01-01 10:20:30 2001-01-01 10:20:30.120000 drop table t1; +# +# MDEV-21639 DEFAULT(col) evaluates to a bad value in WHERE clause +# +CREATE TABLE t1 (a BIGINT NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),10))); +INSERT INTO t1 VALUES (10000); +SELECT +a, +DEFAULT(a), +CASE WHEN a THEN DEFAULT(a) END AS c, +CASE WHEN a THEN DEFAULT(a) END = 10 AS ce +FROM t1; +a DEFAULT(a) c ce +10000 10 10 1 +SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END=10; +a +10000 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),10))); +INSERT INTO t1 VALUES (10000); +SELECT +a, +DEFAULT(a), +CASE WHEN a THEN DEFAULT(a) END AS c, +CASE WHEN a THEN DEFAULT(a) END = 10 AS ce +FROM t1; +a DEFAULT(a) c ce +10000 10 10 1 +SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END=10; +a +10000 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(10,0) NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),10))); +INSERT INTO t1 VALUES (10000); +SELECT +a, +DEFAULT(a), +CASE WHEN a THEN DEFAULT(a) END AS c, +CASE WHEN a THEN DEFAULT(a) END = 10 AS ce +FROM t1; +a DEFAULT(a) c ce +10000 10 10 1 +SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END=10; +a +10000 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(32) NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),10))); +INSERT INTO t1 VALUES (10000); +SELECT +a, +DEFAULT(a), +CASE WHEN a THEN DEFAULT(a) END AS c, +CASE WHEN a THEN DEFAULT(a) END = '10' AS ce +FROM t1; +a DEFAULT(a) c ce +10000 10 10 1 +SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END='10'; +a +10000 +DROP TABLE t1; +CREATE TABLE t1 (a DATE NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP()%10,DATE'2001-01-01'))); +INSERT INTO t1 VALUES ('2000-01-01'); +SELECT +a, +DEFAULT(a), +CASE WHEN a THEN DEFAULT(a) END AS c, +CASE WHEN a THEN DEFAULT(a) END = '2001-01-01' AS ce +FROM t1; +a DEFAULT(a) c ce +2000-01-01 2001-01-01 2001-01-01 1 +SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END='2001-01-01'; +a +2000-01-01 +DROP TABLE t1; +CREATE TABLE t1 (a TIME NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP()%10,TIME'10:20:30'))); +INSERT INTO t1 VALUES ('10:00:00'); +SELECT +a, +DEFAULT(a), +CASE WHEN a THEN DEFAULT(a) END AS c, +CASE WHEN a THEN DEFAULT(a) END = '10:20:30' AS ce +FROM t1; +a DEFAULT(a) c ce +10:00:00 10:20:30 10:20:30 1 +SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END='10:20:30'; +a +10:00:00 +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),TIMESTAMP'2001-01-01 10:20:30'))); +INSERT INTO t1 VALUES ('2000-01-01 10:00:00'); +SELECT +a, +DEFAULT(a), +CASE WHEN a THEN DEFAULT(a) END AS c, +CASE WHEN a THEN DEFAULT(a) END = '2001-01-01 10:20:30' AS ce +FROM t1; +a DEFAULT(a) c ce +2000-01-01 10:00:00 2001-01-01 10:20:30 2001-01-01 10:20:30 1 +SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END='2001-01-01 10:20:30'; +a +2000-01-01 10:00:00 +DROP TABLE t1; +CREATE TABLE t1 (a INT NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),FALSE))); +INSERT INTO t1 VALUES (10); +SELECT +a, +DEFAULT(a), +CASE WHEN a THEN DEFAULT(a) END AS c, +CASE WHEN a THEN DEFAULT(a) END IS FALSE AS ce +FROM t1; +a DEFAULT(a) c ce +10 0 0 1 +SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END IS FALSE; +a +10 +DROP TABLE t1; +# +# MDEV-21028 Server crashes in Query_arena::set_query_arena upon SELECT from view +# +create table t1 (a datetime default current_timestamp); +insert into t1 () values (),(); +create algorithm=temptable view v1 as select * from t1; +create algorithm=merge view v2 as select * from t1; +select default(a) = now() from v1; +default(a) = now() +1 +1 +select default(a) = now() from v2; +default(a) = now() +1 +1 +drop view v1, v2; +drop table t1; +create table t1 (v1 timestamp) select 'x'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `v1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `x` varchar(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +select default(v1) from (select v1 from t1) dt; +default(v1) +2001-01-01 10:20:30 +select default(v1) from (select v1 from t1 group by v1) dt; +default(v1) +2001-01-01 10:20:30 +drop table t1; +create table t1 (a text default ''); +create algorithm=temptable view v1 as select * from t1; +insert into t1 values ('a'); +select default(a) from v1; +default(a) + +drop view v1; +drop table t1; +# +# MDEV-28403 ASAN heap-use-after-free in String::copy / get_field_default_value +# +create table t (a blob default 'x'); +create view v as select * from t; +insert into t () values (); +update t set a = default; +select table_name,column_name,column_default from information_schema.columns where table_name = 'v'; +table_name v +column_name a +column_default 'x' +drop view v; +drop table t; +# +# End of 10.2 tests +# diff --git a/mysql-test/main/func_default.test b/mysql-test/main/func_default.test index 332bfca021f30..1125ac32e8135 100644 --- a/mysql-test/main/func_default.test +++ b/mysql-test/main/func_default.test @@ -34,9 +34,9 @@ INSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three'); SELECT s, 32 AS mi FROM t1 GROUP BY s HAVING DEFAULT(mi) IS NULL; DROP TABLE t1; -# -# 10.2 tests -# +--echo # +--echo # Start of 10.2 tests +--echo # set timestamp=unix_timestamp('2001-01-01 10:20:30.123456'); create table t1 (a int default 1, b int default (a+1), @@ -46,3 +46,140 @@ insert t1 () values (); insert t1 (a) values (10); select default(a),default(b),default(c),default(d),default(e),default(f) from t1; drop table t1; + +--echo # +--echo # MDEV-21639 DEFAULT(col) evaluates to a bad value in WHERE clause +--echo # + +CREATE TABLE t1 (a BIGINT NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),10))); +INSERT INTO t1 VALUES (10000); +SELECT + a, + DEFAULT(a), + CASE WHEN a THEN DEFAULT(a) END AS c, + CASE WHEN a THEN DEFAULT(a) END = 10 AS ce +FROM t1; +SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END=10; +DROP TABLE t1; + +CREATE TABLE t1 (a DOUBLE NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),10))); +INSERT INTO t1 VALUES (10000); +SELECT + a, + DEFAULT(a), + CASE WHEN a THEN DEFAULT(a) END AS c, + CASE WHEN a THEN DEFAULT(a) END = 10 AS ce +FROM t1; +SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END=10; +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(10,0) NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),10))); +INSERT INTO t1 VALUES (10000); +SELECT + a, + DEFAULT(a), + CASE WHEN a THEN DEFAULT(a) END AS c, + CASE WHEN a THEN DEFAULT(a) END = 10 AS ce +FROM t1; +SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END=10; +DROP TABLE t1; + +CREATE TABLE t1 (a VARCHAR(32) NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),10))); +INSERT INTO t1 VALUES (10000); +SELECT + a, + DEFAULT(a), + CASE WHEN a THEN DEFAULT(a) END AS c, + CASE WHEN a THEN DEFAULT(a) END = '10' AS ce +FROM t1; +SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END='10'; +DROP TABLE t1; + +CREATE TABLE t1 (a DATE NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP()%10,DATE'2001-01-01'))); +INSERT INTO t1 VALUES ('2000-01-01'); +SELECT + a, + DEFAULT(a), + CASE WHEN a THEN DEFAULT(a) END AS c, + CASE WHEN a THEN DEFAULT(a) END = '2001-01-01' AS ce +FROM t1; +SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END='2001-01-01'; +DROP TABLE t1; + +CREATE TABLE t1 (a TIME NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP()%10,TIME'10:20:30'))); +INSERT INTO t1 VALUES ('10:00:00'); +SELECT + a, + DEFAULT(a), + CASE WHEN a THEN DEFAULT(a) END AS c, + CASE WHEN a THEN DEFAULT(a) END = '10:20:30' AS ce +FROM t1; +SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END='10:20:30'; +DROP TABLE t1; + +CREATE TABLE t1 (a DATETIME NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),TIMESTAMP'2001-01-01 10:20:30'))); +INSERT INTO t1 VALUES ('2000-01-01 10:00:00'); +SELECT + a, + DEFAULT(a), + CASE WHEN a THEN DEFAULT(a) END AS c, + CASE WHEN a THEN DEFAULT(a) END = '2001-01-01 10:20:30' AS ce +FROM t1; +SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END='2001-01-01 10:20:30'; +DROP TABLE t1; + +CREATE TABLE t1 (a INT NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),FALSE))); +INSERT INTO t1 VALUES (10); +SELECT + a, + DEFAULT(a), + CASE WHEN a THEN DEFAULT(a) END AS c, + CASE WHEN a THEN DEFAULT(a) END IS FALSE AS ce +FROM t1; +SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END IS FALSE; +DROP TABLE t1; + +--echo # +--echo # MDEV-21028 Server crashes in Query_arena::set_query_arena upon SELECT from view +--echo # +#view protocol generates additional statistics +--disable_view_protocol + +create table t1 (a datetime default current_timestamp); +insert into t1 () values (),(); +create algorithm=temptable view v1 as select * from t1; +create algorithm=merge view v2 as select * from t1; +select default(a) = now() from v1; +select default(a) = now() from v2; +drop view v1, v2; +drop table t1; + +--enable_view_protocol + +create table t1 (v1 timestamp) select 'x'; +show create table t1; +select default(v1) from (select v1 from t1) dt; +select default(v1) from (select v1 from t1 group by v1) dt; +drop table t1; + +create table t1 (a text default ''); +create algorithm=temptable view v1 as select * from t1; +insert into t1 values ('a'); +select default(a) from v1; +drop view v1; +drop table t1; + +--echo # +--echo # MDEV-28403 ASAN heap-use-after-free in String::copy / get_field_default_value +--echo # +create table t (a blob default 'x'); +create view v as select * from t; +insert into t () values (); +update t set a = default; +query_vertical select table_name,column_name,column_default from information_schema.columns where table_name = 'v'; +drop view v; +drop table t; + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/main/func_digest.result b/mysql-test/main/func_digest.result index 374d16ac68765..0d3b80bd6c8bd 100644 --- a/mysql-test/main/func_digest.result +++ b/mysql-test/main/func_digest.result @@ -1472,7 +1472,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, `b` text DEFAULT sha(`a`), `c` text DEFAULT sha2(`a`,224) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('abc'); SELECT * FROM t1; a b c diff --git a/mysql-test/main/func_digest.test b/mysql-test/main/func_digest.test index e7d73b4f36878..afc3941e1b3cf 100644 --- a/mysql-test/main/func_digest.test +++ b/mysql-test/main/func_digest.test @@ -458,6 +458,8 @@ SELECT SHA2( x'f4259473bfd39877bfe9597353d7ce8dd520c66d1fc7884e4e03b655c63a77217 SELECT SHA2( x'd60da691585b7c0c3714905411ae8e3515e8490dbbaf07d1b2431f501a96c7bcf4f52766d7e9b2c9e460b5cafc08303e30fce6ad78a2b055a8d31672a13d20bdc4066a33adb277171d47473a37af2c7af05dd989c134bcf09ea48e532c1628f62f8a9880417e74ffca126e2d2c6b29f23e554b29fc2cd4a77dfcae7925e784', 512 ) = 'ec83376ff6f633ee2d898d87a6a91efb0788bce188fac7d3c4c35f81ba6015640dbfad1f8584557ec210478a0cb566f1490643ce602aa5abfab63d46f7f1d4ee' as NIST_SHA512_test_vector; SELECT SHA2( x'b7d5d5f8955d1ad349b9e618c7987814f6dc7bdc6c4ee59a79902026685468d601cc74965361583bb0a8aa14f892e3c21be3094ad9e58b69cc5d6d28a9bea4afc39dc45ed065d81af04c91e5eb85a4b2bab76d774aafd8837c52811270d51a1f03300e7996cf6319128be5b328da818bde42ef8a471494919156a60d460191cc', 512 ) = '6e7fb797dfca7577432c0b339fe9003b36942a549b112d32016b257c9a866e4385e01d4e757d4378b8e61f5a8a29aa73f2daafdaab23dfe4e0b93df21374e594' as NIST_SHA512_test_vector; +#view protocol generates additional warnings +--disable_view_protocol ## Test some unusual parameters items. ## First, the ones that must return NULL. SELECT SHA2( x'ff', 1 ); @@ -467,6 +469,7 @@ SELECT SHA2( x'ff', 511 ); SELECT SHA2( x'ff', least(123, 42) ); SELECT SHA2( x'ff', 10000000000000 ); SELECT SHA2( SHA2( NULL, 224), 224 ); +--enable_view_protocol ## Second, things that mustn't return NULL; SELECT SHA2( SHA2( x'ff', 224), 224 ) is not NULL; SELECT SHA2( SHA2( x'ff', NULL), 224 ) is not NULL; @@ -485,6 +488,8 @@ SELECT LENGTH(SHA2( 'computed', 512 )) / 2 * 8 = 512; --echo # --echo # Bug#54661 sha2() returns BINARY result --echo # + +--disable_view_protocol --enable_metadata SET NAMES binary; SELECT sha2('1',224); @@ -493,6 +498,7 @@ SELECT sha2('1',224); SET NAMES latin1; SELECT sha2('1',224); --disable_metadata +--disable_view_protocol --echo # --echo # Start of 10.1 tests diff --git a/mysql-test/main/func_encrypt.result b/mysql-test/main/func_encrypt.result index 68c44231e4393..97aaed336debc 100644 --- a/mysql-test/main/func_encrypt.result +++ b/mysql-test/main/func_encrypt.result @@ -183,13 +183,6 @@ 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 des_decrypt(des_encrypt('hello',4),'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt('hello','hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))` -drop table if exists t1; -create table t1 (f1 smallint(6) default null, f2 mediumtext character set utf8) -engine=myisam default charset=latin1; -insert into t1 values (null,'contraction\'s'); -insert into t1 values (-15818,'requirement\'s'); -select encrypt(f1,f2) as a from t1,(select encrypt(f1,f2) as b from t1) a; -drop table t1; # # Start of 10.1 tests # @@ -225,7 +218,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, `b` blob DEFAULT des_encrypt(`a`,'passwd'), `c` text DEFAULT des_decrypt(`b`,'passwd') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('test'); SELECT c FROM t1; c diff --git a/mysql-test/main/func_encrypt.test b/mysql-test/main/func_encrypt.test index e27a2bd46d358..4a8c20e3dbc31 100644 --- a/mysql-test/main/func_encrypt.test +++ b/mysql-test/main/func_encrypt.test @@ -89,21 +89,6 @@ explain extended select des_decrypt(des_encrypt("hello",4),'password2'), des_dec # End of 4.1 tests -# -# Bug#44365 valgrind warnings with encrypt() function -# ---disable_warnings -drop table if exists t1; ---enable_warnings -create table t1 (f1 smallint(6) default null, f2 mediumtext character set utf8) -engine=myisam default charset=latin1; -insert into t1 values (null,'contraction\'s'); -insert into t1 values (-15818,'requirement\'s'); ---disable_result_log -select encrypt(f1,f2) as a from t1,(select encrypt(f1,f2) as b from t1) a; ---enable_result_log -drop table t1; - --echo # --echo # Start of 10.1 tests --echo # diff --git a/mysql-test/main/func_encrypt_ucs2.result b/mysql-test/main/func_encrypt_ucs2.result index 5ab3b08fb5dea..989d593da8ff1 100644 --- a/mysql-test/main/func_encrypt_ucs2.result +++ b/mysql-test/main/func_encrypt_ucs2.result @@ -9,11 +9,11 @@ CONVERT(DES_ENCRYPT(0, CHAR('1' USING ucs2)),UNSIGNED) 0 Warnings: Warning 1292 Truncated incorrect INTEGER value: '\xFFT\xDCiK\x92j\xE6\xFC' -SELECT CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2))); -CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2))) +SELECT CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2))) as a; +a 4 -SELECT CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED); -CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED) +SELECT CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED) as a; +a 0 Warnings: Warning 1292 Truncated incorrect INTEGER value: 'test' diff --git a/mysql-test/main/func_encrypt_ucs2.test b/mysql-test/main/func_encrypt_ucs2.test index 1242c3b9e6ade..088af7ffee7d3 100644 --- a/mysql-test/main/func_encrypt_ucs2.test +++ b/mysql-test/main/func_encrypt_ucs2.test @@ -8,5 +8,7 @@ SELECT CHAR_LENGTH(DES_ENCRYPT(0, CHAR('1' USING ucs2))); SELECT CONVERT(DES_ENCRYPT(0, CHAR('1' USING ucs2)),UNSIGNED); -SELECT CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2))); -SELECT CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED); +--disable_view_protocol +SELECT CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2))) as a; +SELECT CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED) as a; +--enable_view_protocol diff --git a/mysql-test/main/func_extract.result b/mysql-test/main/func_extract.result index 30ec0460d61bb..bebb8c717f60f 100644 --- a/mysql-test/main/func_extract.result +++ b/mysql-test/main/func_extract.result @@ -47,7 +47,7 @@ t2 CREATE TABLE `t2` ( `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 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(64), b DECIMAL(32,9)); diff --git a/mysql-test/main/func_extract.test b/mysql-test/main/func_extract.test index edc99b9c00c93..97920f1872f9a 100644 --- a/mysql-test/main/func_extract.test +++ b/mysql-test/main/func_extract.test @@ -62,6 +62,8 @@ SELECT a, b, EXTRACT(SECOND FROM a), EXTRACT(SECOND FROM b) FROM t1 WHERE NOT (E 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 +#enable after fix MDEV-29525 +--disable_view_protocol --echo # Detailed results SELECT a, @@ -86,6 +88,7 @@ SELECT EXTRACT(MICROSECOND FROM b) FROM t1; DROP TABLE t1; +--enable_view_protocol --echo # Special case: DAY + TIME CREATE TABLE t1 (a VARCHAR(64)); @@ -103,6 +106,8 @@ SELECT a, FROM t1; DROP TABLE t1; +#enable after fix MDEV-29525 +--disable_view_protocol --echo # Bad values CREATE TABLE t1 (a VARCHAR(64)); INSERT INTO t1 VALUES (''); @@ -119,7 +124,7 @@ SELECT a, EXTRACT(MICROSECOND FROM a) FROM t1; DROP TABLE t1; - +--enable_view_protocol --echo # Backward compatibility @@ -249,9 +254,12 @@ INSERT INTO t1 VALUES ('01:02:03/'), ('20 10:20:30'); +#enable after fix MDEV-29525 +--disable_view_protocol 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; +--enable_view_protocol diff --git a/mysql-test/main/func_gconcat.result b/mysql-test/main/func_gconcat.result index 328bbc953abee..fea25124941ad 100644 --- a/mysql-test/main/func_gconcat.result +++ b/mysql-test/main/func_gconcat.result @@ -466,8 +466,8 @@ create table t2 select group_concat(a) as a from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(400) CHARACTER SET cp1250 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(400) CHARACTER SET cp1250 COLLATE cp1250_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select collation(group_concat(a,_koi8r'test')) from t1; collation(group_concat(a,_koi8r'test')) cp1250_general_ci @@ -1154,14 +1154,14 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `GROUP_CONCAT(f1 order by f2)` mediumtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 SELECT GROUP_CONCAT(UPPER(f1) ORDER BY f2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `GROUP_CONCAT(UPPER(f1) ORDER BY f2)` mediumtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET group_concat_max_len= 1024; SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1; diff --git a/mysql-test/main/func_gconcat.test b/mysql-test/main/func_gconcat.test index 3c21aa04ffc0e..e24dba5d04f76 100644 --- a/mysql-test/main/func_gconcat.test +++ b/mysql-test/main/func_gconcat.test @@ -1,6 +1,7 @@ # # simple test of group_concat function # + source include/have_sequence.inc; create table t1 (grp int, a bigint unsigned, c char(10) not null, d char(10) not null); @@ -403,7 +404,9 @@ drop table t1; create table t1 (f1 int unsigned, f2 varchar(255)); insert into t1 values (1,repeat('a',255)),(2,repeat('b',255)); --enable_metadata +--disable_view_protocol select f2,group_concat(f1) from t1 group by f2; +--enable_view_protocol --disable_metadata drop table t1; @@ -491,7 +494,9 @@ set names latin1; create table t1 (f1 int unsigned, f2 varchar(255)); insert into t1 values (1,repeat('a',255)),(2,repeat('b',255)); --enable_metadata +--disable_view_protocol select f2,group_concat(f1) from t1 group by f2; +--enable_view_protocol --disable_metadata drop table t1; @@ -931,7 +936,10 @@ SELECT * FROM (SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLU SELECT * FROM v1; DROP VIEW v1; +#enable after fix MDEV-27871 +--disable_view_protocol SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30'); +--enable_view_protocol CREATE VIEW v1 AS SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30'); SELECT * FROM v1; diff --git a/mysql-test/main/func_group.result b/mysql-test/main/func_group.result index 177f0950a77c8..27845af71646d 100644 --- a/mysql-test/main/func_group.result +++ b/mysql-test/main/func_group.result @@ -1,4 +1,3 @@ -drop table if exists t1,t2,t3,t4,t5,t6; set @sav_dpi= @@div_precision_increment; set div_precision_increment= 5; show variables like 'div_precision_increment'; @@ -318,7 +317,7 @@ a3 char(3), a4 real, a5 date, key k1(a2,a3), -key k2(a4 desc,a1), +key k2(a4 /*desc*/,a1), key k3(a5,a1) ); create table t2( @@ -604,7 +603,7 @@ AME AME explain select min(a1) from t1 where a1 > 'KKK' or a1 < 'XXX'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 0 NULL 15 Using where; Using index +1 SIMPLE t1 index PRIMARY PRIMARY 3 NULL 15 Using where; Using index explain select min(a1) from t1 where (a1 < 'KKK' or a1 > 'KKK'); id select_type table type possible_keys key key_len ref rows Extra @@ -671,22 +670,22 @@ latin2 2 latin2 2 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(1) CHARACTER SET latin2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` char(1) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t2 select max(a),min(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `max(a)` char(1) CHARACTER SET latin2 DEFAULT NULL, - `min(a)` char(1) CHARACTER SET latin2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `max(a)` char(1) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `min(a)` char(1) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; create table t2 select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(1) CHARACTER SET latin2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `concat(a)` varchar(1) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2,t1; create table t1 (a int); insert into t1 values (1); @@ -775,7 +774,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `MAX(b)` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1(f1 datetime); insert into t1 values (now()); @@ -1014,14 +1013,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `variance(0)` double(8,4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 select stddev(0); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `stddev(0)` double(8,4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table bug22555 (i smallint primary key auto_increment, s1 smallint, s2 smallint, e decimal(30,10), o double); insert into bug22555 (s1, s2, e, o) values (53, 78, 11.4276528, 6.828112), (17, 78, 5.916793, 1.8502951), (18, 76, 2.679231, 9.17975591), (31, 62, 6.07831, 0.1), (19, 41, 5.37463, 15.1), (83, 73, 14.567426, 7.959222), (92, 53, 6.10151, 13.1856852), (7, 12, 13.92272, 3.442007), (92, 35, 11.95358909, 6.01376678), (38, 84, 2.572, 7.904571); @@ -1444,16 +1443,11 @@ FROM derived1 AS X WHERE X.int_nokey < 61 GROUP BY pk -LIMIT 1) +LIMIT 1) AS m FROM D AS X WHERE X.int_key < 13 GROUP BY int_nokey LIMIT 1; -(SELECT COUNT( int_nokey ) -FROM derived1 AS X -WHERE -X.int_nokey < 61 -GROUP BY pk -LIMIT 1) +m 1 DROP TABLE derived1; DROP TABLE D; @@ -2510,7 +2504,7 @@ t2 CREATE TABLE `t2` ( `code` int(11) DEFAULT NULL, `COUNT(DISTINCT country)` bigint(21) NOT NULL, `MAX(id)` int(11) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT code, COUNT(DISTINCT country), MAX(id) FROM v1 GROUP BY code ORDER BY MAX(id); SHOW CREATE TABLE t2; @@ -2519,10 +2513,63 @@ t2 CREATE TABLE `t2` ( `code` int(11) DEFAULT NULL, `COUNT(DISTINCT country)` bigint(21) NOT NULL, `MAX(id)` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP VIEW v1; DROP TABLE t1; # +# MDEV-23809: Server crash in JOIN_CACHE::free or ... +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT DISTINCT CASE CONVERT(EXPORT_SET(0, COLLATION(BENCHMARK(1, BIT_OR(0))),0),TIME) WHEN a THEN 1 END AS f FROM t1; +f +NULL +Warnings: +Warning 1292 Truncated incorrect time value: '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0' +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(8) NULL, b BIGINT); +INSERT INTO t1 (a,b) VALUES (NULL,NULL),('foo',NULL); +SELECT DISTINCT STRCMP((b > COLLATION(STDDEV_SAMP(15750))), a) AS f FROM t1; +f +NULL +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT) AS SELECT 1 AS v3 UNION SELECT FALSE ; +SELECT DISTINCT a IN ( COLLATION (AVG ('x'))) FROM t1 ; +a IN ( COLLATION (AVG ('x'))) +NULL +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'x' +Warning 1292 Truncated incorrect DOUBLE value: 'x' +DROP TABLE t1; +# +# MDEV-29678 Valgrind/MSAN uninitialised value errors upon PS with ALTER under ONLY_FULL_GROUP_BY +# +SET STATEMENT sql_mode=ONLY_FULL_GROUP_BY FOR EXECUTE IMMEDIATE 'ALTER TABLE mysql.time_zone_transition ORDER BY Time_zone_id, Transition_time'; +# +# MDEV-19071 Wrong results when using STDDEV_SAMP() and view +# +create table t1(i int); +insert into t1 values (1),(2),(3),(4),(5); +create view v1 as select stddev_samp(i),stddev_pop(i),stddev(i),std(i) from t1; +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 stddev_samp(`t1`.`i`) AS `stddev_samp(i)`,std(`t1`.`i`) AS `stddev_pop(i)`,std(`t1`.`i`) AS `stddev(i)`,std(`t1`.`i`) AS `std(i)` from `t1` latin1 latin1_swedish_ci +select * from v1; +stddev_samp(i) stddev_pop(i) stddev(i) std(i) +1.5811 1.4142 1.4142 1.4142 +drop view v1; +drop table t1; +# +# MDEV-29988: Major performance regression with 10.6.11 +# +create table t1 (a varchar(10) charset utf8mb4, b int, c int); +insert t1 values (1,2,3),(4,5,6),(1,7,8); +select concat(a,":",group_concat(b)) from t1 group by a; +concat(a,":",group_concat(b)) +1:2,7 +4:5 +drop table t1; +# # End of 10.3 tests # diff --git a/mysql-test/main/func_group.test b/mysql-test/main/func_group.test index 2d26861c71099..05946908fcfc5 100644 --- a/mysql-test/main/func_group.test +++ b/mysql-test/main/func_group.test @@ -6,10 +6,6 @@ if (`SELECT $PS_PROTOCOL != 0`) --skip Test temporarily disabled for ps-protocol } ---disable_warnings -drop table if exists t1,t2,t3,t4,t5,t6; ---enable_warnings - set @sav_dpi= @@div_precision_increment; set div_precision_increment= 5; show variables like 'div_precision_increment'; @@ -206,7 +202,7 @@ create table t1( a4 real, a5 date, key k1(a2,a3), - key k2(a4 desc,a1), + key k2(a4 /*desc*/,a1), key k3(a5,a1) ); create table t2( @@ -628,7 +624,6 @@ drop table t1, t2, t3; # # BUG#3190, WL#1639: Standard Deviation STDDEV - 2 different calculations # - CREATE TABLE t1 (id int(11),value1 float(10,2)); INSERT INTO t1 VALUES (1,0.00),(1,1.00), (1,2.00), (2,10.00), (2,11.00), (2,12.00), (2,13.00); select id, stddev_pop(value1), var_pop(value1), stddev_samp(value1), var_samp(value1) from t1 group by id; @@ -975,7 +970,7 @@ SELECT WHERE X.int_nokey < 61 GROUP BY pk - LIMIT 1) + LIMIT 1) AS m FROM D AS X WHERE X.int_key < 13 GROUP BY int_nokey LIMIT 1; @@ -1763,6 +1758,50 @@ DROP TABLE t2; DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # MDEV-23809: Server crash in JOIN_CACHE::free or ... +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT DISTINCT CASE CONVERT(EXPORT_SET(0, COLLATION(BENCHMARK(1, BIT_OR(0))),0),TIME) WHEN a THEN 1 END AS f FROM t1; +DROP TABLE t1; + + +CREATE TABLE t1 (a VARCHAR(8) NULL, b BIGINT); +INSERT INTO t1 (a,b) VALUES (NULL,NULL),('foo',NULL); +SELECT DISTINCT STRCMP((b > COLLATION(STDDEV_SAMP(15750))), a) AS f FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a BIGINT) AS SELECT 1 AS v3 UNION SELECT FALSE ; +SELECT DISTINCT a IN ( COLLATION (AVG ('x'))) FROM t1 ; +DROP TABLE t1; + +--echo # +--echo # MDEV-29678 Valgrind/MSAN uninitialised value errors upon PS with ALTER under ONLY_FULL_GROUP_BY +--echo # + +SET STATEMENT sql_mode=ONLY_FULL_GROUP_BY FOR EXECUTE IMMEDIATE 'ALTER TABLE mysql.time_zone_transition ORDER BY Time_zone_id, Transition_time'; + +--echo # +--echo # MDEV-19071 Wrong results when using STDDEV_SAMP() and view +--echo # +create table t1(i int); +insert into t1 values (1),(2),(3),(4),(5); +create view v1 as select stddev_samp(i),stddev_pop(i),stddev(i),std(i) from t1; +show create view v1; +select * from v1; +drop view v1; +drop table t1; + +--echo # +--echo # MDEV-29988: Major performance regression with 10.6.11 +--echo # +create table t1 (a varchar(10) charset utf8mb4, b int, c int); +insert t1 values (1,2,3),(4,5,6),(1,7,8); +select concat(a,":",group_concat(b)) from t1 group by a; +drop table t1; + --echo # --echo # End of 10.3 tests --echo # diff --git a/mysql-test/main/func_group_innodb.test b/mysql-test/main/func_group_innodb.test index 748c64a43c61c..b1f9a28b190cc 100644 --- a/mysql-test/main/func_group_innodb.test +++ b/mysql-test/main/func_group_innodb.test @@ -15,7 +15,10 @@ set global innodb_stats_persistent_sample_pages=100; create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB; --enable_warnings insert into t1 values (1, 3); +#enable after fix MDEV-27871 +--disable_view_protocol select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ; +--enable_view_protocol select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ; drop table t1; diff --git a/mysql-test/main/func_hybrid_type.result b/mysql-test/main/func_hybrid_type.result index 16bd0359da252..dde6cfa4ed835 100644 --- a/mysql-test/main/func_hybrid_type.result +++ b/mysql-test/main/func_hybrid_type.result @@ -207,7 +207,7 @@ t2 CREATE TABLE `t2` ( `ifnull___b_b` int(10) unsigned DEFAULT NULL, `least____b_b` int(10) unsigned DEFAULT NULL, `greatest_b_b` int(10) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS @@ -240,7 +240,7 @@ t2 CREATE TABLE `t2` ( `least____b_a` decimal(10,0) DEFAULT NULL, `greatest_a_b` decimal(10,0) DEFAULT NULL, `greatest_b_a` decimal(10,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -415,7 +415,7 @@ t2 CREATE TABLE `t2` ( `ifnull___b_b` int(11) DEFAULT NULL, `least____b_b` int(11) DEFAULT NULL, `greatest_b_b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS @@ -448,7 +448,7 @@ t2 CREATE TABLE `t2` ( `least____b_a` int(11) DEFAULT NULL, `greatest_a_b` int(11) DEFAULT NULL, `greatest_b_a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -623,7 +623,7 @@ t2 CREATE TABLE `t2` ( `ifnull___b_b` bigint(20) unsigned DEFAULT NULL, `least____b_b` bigint(20) unsigned DEFAULT NULL, `greatest_b_b` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS @@ -656,7 +656,7 @@ t2 CREATE TABLE `t2` ( `least____b_a` decimal(20,0) DEFAULT NULL, `greatest_a_b` decimal(20,0) DEFAULT NULL, `greatest_b_a` decimal(20,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -831,7 +831,7 @@ t2 CREATE TABLE `t2` ( `ifnull___b_b` bigint(20) DEFAULT NULL, `least____b_b` bigint(20) DEFAULT NULL, `greatest_b_b` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS @@ -864,7 +864,7 @@ t2 CREATE TABLE `t2` ( `least____b_a` bigint(20) DEFAULT NULL, `greatest_a_b` bigint(20) DEFAULT NULL, `greatest_b_a` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -1008,7 +1008,7 @@ t2 CREATE TABLE `t2` ( `ifnull___b_b` bit(8) DEFAULT NULL, `least____b_b` bit(8) DEFAULT NULL, `greatest_b_b` bit(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS @@ -1041,7 +1041,7 @@ t2 CREATE TABLE `t2` ( `least____b_a` decimal(10,0) DEFAULT NULL, `greatest_a_b` decimal(10,0) DEFAULT NULL, `greatest_b_a` decimal(10,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -1185,7 +1185,7 @@ t2 CREATE TABLE `t2` ( `ifnull___b_b` bit(8) DEFAULT NULL, `least____b_b` bit(8) DEFAULT NULL, `greatest_b_b` bit(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS @@ -1218,7 +1218,7 @@ t2 CREATE TABLE `t2` ( `least____b_a` int(10) unsigned DEFAULT NULL, `greatest_a_b` int(10) unsigned DEFAULT NULL, `greatest_b_a` int(10) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -1362,7 +1362,7 @@ t2 CREATE TABLE `t2` ( `ifnull___b_b` bit(8) DEFAULT NULL, `least____b_b` bit(8) DEFAULT NULL, `greatest_b_b` bit(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS @@ -1395,7 +1395,7 @@ t2 CREATE TABLE `t2` ( `least____b_a` bit(8) DEFAULT NULL, `greatest_a_b` bit(8) DEFAULT NULL, `greatest_b_a` bit(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -1539,7 +1539,7 @@ t2 CREATE TABLE `t2` ( `ifnull___b_b` smallint(6) DEFAULT NULL, `least____b_b` smallint(6) DEFAULT NULL, `greatest_b_b` smallint(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS @@ -1572,7 +1572,7 @@ t2 CREATE TABLE `t2` ( `least____b_a` double DEFAULT NULL, `greatest_a_b` double DEFAULT NULL, `greatest_b_a` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -1609,14 +1609,14 @@ def ifnull___a_a 253 10 1 Y 0 39 8 def least____a_a 253 10 1 Y 0 39 8 def greatest_a_a 253 10 1 Y 0 39 8 def test t1 t1 b ___________b 254 1 1 Y 256 0 8 -def case_______b 254 1 1 Y 0 39 8 -def case_____b_b 254 1 1 Y 0 39 8 -def coalesce___b 254 1 1 Y 0 39 8 -def coalesce_b_b 254 1 1 Y 0 39 8 -def if_______b_b 254 1 1 Y 0 39 8 -def ifnull___b_b 254 1 1 Y 0 39 8 -def least____b_b 254 1 1 Y 0 39 8 -def greatest_b_b 254 1 1 Y 0 39 8 +def case_______b 253 1 1 Y 0 39 8 +def case_____b_b 253 1 1 Y 0 39 8 +def coalesce___b 253 1 1 Y 0 39 8 +def coalesce_b_b 253 1 1 Y 0 39 8 +def if_______b_b 253 1 1 Y 0 39 8 +def ifnull___b_b 253 1 1 Y 0 39 8 +def least____b_b 253 1 1 Y 0 39 8 +def greatest_b_b 253 1 1 Y 0 39 8 ___________a a case_______a a case_____a_a a @@ -1716,7 +1716,7 @@ t2 CREATE TABLE `t2` ( `ifnull___b_b` varchar(1) DEFAULT NULL, `least____b_b` varchar(1) DEFAULT NULL, `greatest_b_b` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS @@ -1749,7 +1749,7 @@ t2 CREATE TABLE `t2` ( `least____b_a` varchar(10) DEFAULT NULL, `greatest_a_b` varchar(10) DEFAULT NULL, `greatest_b_a` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -1893,7 +1893,7 @@ t2 CREATE TABLE `t2` ( `ifnull___b_b` year(4) DEFAULT NULL, `least____b_b` year(4) DEFAULT NULL, `greatest_b_b` year(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS @@ -1926,7 +1926,7 @@ t2 CREATE TABLE `t2` ( `least____b_a` decimal(10,0) DEFAULT NULL, `greatest_a_b` decimal(10,0) DEFAULT NULL, `greatest_b_a` decimal(10,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -2070,7 +2070,7 @@ t2 CREATE TABLE `t2` ( `ifnull___b_b` year(4) DEFAULT NULL, `least____b_b` year(4) DEFAULT NULL, `greatest_b_b` year(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS @@ -2103,7 +2103,7 @@ t2 CREATE TABLE `t2` ( `least____b_a` int(10) unsigned DEFAULT NULL, `greatest_a_b` int(10) unsigned DEFAULT NULL, `greatest_b_a` int(10) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -2248,7 +2248,7 @@ t2 CREATE TABLE `t2` ( `ifnull___b_b` time DEFAULT NULL, `least____b_b` time DEFAULT NULL, `greatest_b_b` time DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS @@ -2281,7 +2281,7 @@ t2 CREATE TABLE `t2` ( `least____b_a` datetime DEFAULT NULL, `greatest_a_b` datetime DEFAULT NULL, `greatest_b_a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; SET timestamp=DEFAULT; @@ -2427,7 +2427,7 @@ t2 CREATE TABLE `t2` ( `ifnull___b_b` time DEFAULT NULL, `least____b_b` time DEFAULT NULL, `greatest_b_b` time DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS @@ -2460,7 +2460,7 @@ t2 CREATE TABLE `t2` ( `least____b_a` datetime DEFAULT NULL, `greatest_a_b` datetime DEFAULT NULL, `greatest_b_a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; SET timestamp=DEFAULT; @@ -2606,7 +2606,7 @@ t2 CREATE TABLE `t2` ( `ifnull___b_b` time DEFAULT NULL, `least____b_b` time DEFAULT NULL, `greatest_b_b` time DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS @@ -2639,7 +2639,7 @@ t2 CREATE TABLE `t2` ( `least____b_a` datetime DEFAULT NULL, `greatest_a_b` datetime DEFAULT NULL, `greatest_b_a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; SET timestamp=DEFAULT; @@ -2785,7 +2785,7 @@ t2 CREATE TABLE `t2` ( `ifnull___b_b` date DEFAULT NULL, `least____b_b` date DEFAULT NULL, `greatest_b_b` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS @@ -2818,7 +2818,7 @@ t2 CREATE TABLE `t2` ( `least____b_a` datetime DEFAULT NULL, `greatest_a_b` datetime DEFAULT NULL, `greatest_b_a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; SET timestamp=DEFAULT; @@ -2978,7 +2978,7 @@ t2 CREATE TABLE `t2` ( `ifnull___b_b` varchar(10) DEFAULT NULL, `least____b_b` varchar(10) DEFAULT NULL, `greatest_b_b` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS @@ -3016,7 +3016,7 @@ t2 CREATE TABLE `t2` ( `least____b_a` double DEFAULT NULL, `greatest_a_b` double DEFAULT NULL, `greatest_b_a` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -3032,7 +3032,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `LEAST(1.0,'10')` double NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-657 LP:873142 - GREATEST() does not always return same signness of argument types @@ -3075,7 +3075,7 @@ t2 CREATE TABLE `t2` ( `LEAST(a,a)` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `LEAST(b,b)` datetime DEFAULT NULL, `LEAST(a,b)` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; SET timestamp=DEFAULT; @@ -3097,7 +3097,7 @@ t2 CREATE TABLE `t2` ( `c2` mediumblob DEFAULT NULL, `c3` blob DEFAULT NULL, `c4` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT MAX(COALESCE(c1)) AS c1, MAX(COALESCE(c2)) AS c2, @@ -3124,7 +3124,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(1) DEFAULT NULL, `c2` varchar(255) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT MAX(COALESCE(c1)) AS c1, MAX(COALESCE(c2)) AS c2 @@ -3145,9 +3145,9 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL, - `c2` varchar(255) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c2` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT MAX(COALESCE(c1)) AS c1, MAX(COALESCE(c2)) AS c2 @@ -3172,7 +3172,7 @@ t2 CREATE TABLE `t2` ( `c1` varchar(1) DEFAULT NULL, `c2` varchar(255) DEFAULT NULL, `c3` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT MAX(COALESCE(c1)) AS c1, MAX(COALESCE(c2)) AS c2, @@ -3196,10 +3196,10 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL, - `c2` varchar(255) CHARACTER SET utf8mb3 DEFAULT NULL, - `c3` text CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c2` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c3` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT MAX(COALESCE(c1)) AS c1, MAX(COALESCE(c2)) AS c2, @@ -3222,7 +3222,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT MAX(COALESCE(c1)) AS c1 FROM t1; @@ -3240,8 +3240,8 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT MAX(COALESCE(c1)) AS c1 FROM t1; @@ -3269,7 +3269,7 @@ t2 CREATE TABLE `t2` ( `c2` blob DEFAULT NULL, `c3` mediumblob DEFAULT NULL, `c4` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @c1:=c1 AS c1, @c2:=c2 AS c2, @@ -3295,7 +3295,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(1) DEFAULT NULL, `c2` varchar(255) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @c1:=c1 AS c1, @c2:=c2 AS c2 @@ -3315,9 +3315,9 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL, - `c2` varchar(255) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c2` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @c1:=c1 AS c1, @c2:=c2 AS c2 @@ -3341,7 +3341,7 @@ t2 CREATE TABLE `t2` ( `c1` varchar(1) DEFAULT NULL, `c2` varchar(255) DEFAULT NULL, `c3` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @c:=c1 AS c1, @c:=c2 AS c2, @@ -3364,10 +3364,10 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL, - `c2` varchar(255) CHARACTER SET utf8mb3 DEFAULT NULL, - `c3` text CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c2` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c3` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @c:=c1 AS c1, @c:=c2 AS c2, @@ -3389,7 +3389,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @c:=c1 AS c1 FROM t1; @@ -3406,8 +3406,8 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `c1` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @c:=c1 AS c1 FROM t1; @@ -3445,7 +3445,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(20) DEFAULT NULL, `b` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-11015 Assertion failed: precision > 0 in decimal_bin_size upon SELECT with DISTINCT, CAST and other functions @@ -3492,9 +3492,9 @@ COALESCE(_latin1'aaa',_utf8 0xC39F) AS c2; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8mb3 NOT NULL, - `c2` varchar(3) CHARACTER SET utf8mb3 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `c2` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 aaa aaa @@ -3526,7 +3526,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a,b)` decimal(64,0) DEFAULT NULL, `GREATEST(a,b)` decimal(64,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -3538,7 +3538,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a,b)` double(255,4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -3550,7 +3550,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a)` float(10,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2, t1; CREATE TABLE t1 (a FLOAT(10,2)); CREATE TABLE t2 AS SELECT LEAST(a,a) FROM t1; @@ -3558,7 +3558,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `LEAST(a,a)` float(19,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2, t1; CREATE TABLE t1 (a TINYINT(1)); CREATE TABLE t2 AS SELECT COALESCE(a) FROM t1; @@ -3566,7 +3566,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a)` tinyint(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2, t1; CREATE TABLE t1 (a TINYINT(1)); CREATE TABLE t2 AS SELECT LEAST(a,a) FROM t1; @@ -3574,7 +3574,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `LEAST(a,a)` tinyint(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2, t1; # # MDEV-12875 Wrong VIEW column data type for COALESCE(int_column) @@ -3598,7 +3598,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` bigint(11) NOT NULL, `c2` bigint(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT 9 AS i1, COALESCE(9) AS c1, @@ -3688,7 +3688,7 @@ t1 CREATE TABLE `t1` ( `c21` decimal(21,0) NOT NULL, `i22` decimal(22,0) NOT NULL, `c22` decimal(22,0) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; i1 9 c1 9 @@ -3764,7 +3764,7 @@ t2 CREATE TABLE `t2` ( `c2` smallint(6) DEFAULT NULL, `c3` smallint(6) DEFAULT NULL, `c4` smallint(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2,t1; CREATE TABLE t1 AS SELECT connection_id() AS c0, @@ -3780,7 +3780,7 @@ t1 CREATE TABLE `t1` ( `c2` int(10) unsigned NOT NULL, `c3` int(10) unsigned NOT NULL, `c4` int(10) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT @@ -3797,7 +3797,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `f0` decimal(1,0) DEFAULT NULL, `f1` decimal(1,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; SET sql_mode=DEFAULT; # @@ -3866,7 +3866,7 @@ t1 CREATE TABLE `t1` ( `i2` date DEFAULT NULL, `i3` datetime DEFAULT NULL, `i4` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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; @@ -3877,7 +3877,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` datetime NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET old_mode=ZERO_DATE_TIME_CAST; CREATE TABLE t1 AS SELECT LEAST(CURRENT_DATE,CURRENT_TIME) AS c1; @@ -3890,7 +3890,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET old_mode=DEFAULT; SET timestamp=DEFAULT; @@ -3911,7 +3911,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` time DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET sql_mode=DEFAULT; # @@ -3998,7 +3998,7 @@ t1 CREATE TABLE `t1` ( `i2` date DEFAULT NULL, `i3` datetime DEFAULT NULL, `i4` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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; @@ -4009,7 +4009,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` datetime NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET old_mode=ZERO_DATE_TIME_CAST; CREATE TABLE t1 AS SELECT LEAST(CURRENT_DATE,CURRENT_TIME) AS c1; @@ -4022,7 +4022,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET old_mode=DEFAULT; SET timestamp=DEFAULT; @@ -4043,7 +4043,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` time DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET sql_mode=DEFAULT; # @@ -4107,7 +4107,7 @@ t1 CREATE TABLE `t1` ( `dbl` double DEFAULT NULL, `sint` bigint(10) DEFAULT NULL, `uint` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET sql_mode=DEFAULT; # diff --git a/mysql-test/main/func_hybrid_type.test b/mysql-test/main/func_hybrid_type.test index cf41d92b01fbb..1b903f78b3fef 100644 --- a/mysql-test/main/func_hybrid_type.test +++ b/mysql-test/main/func_hybrid_type.test @@ -126,10 +126,12 @@ DROP TABLE t1; --echo # MDEV-4848 Wrong metadata or column type for LEAST(1.0,'10') --echo # --disable_ps_protocol +--disable_view_protocol --enable_metadata SELECT LEAST(1.0,'10'); --disable_metadata --enable_ps_protocol +--enable_view_protocol CREATE TABLE t1 AS SELECT LEAST(1.0,'10'); SHOW CREATE TABLE t1; DROP TABLE t1; @@ -148,6 +150,7 @@ DROP TABLE t1; --echo # SET timestamp=UNIX_TIMESTAMP('2010-01-01 01:02:03'); --disable_ps_protocol +--disable_view_protocol --enable_metadata # Expect DATETIME type (12) in metadata SELECT GREATEST(CURRENT_TIME, CURRENT_DATE), COALESCE(CURRENT_TIME, CURRENT_DATE); @@ -160,6 +163,7 @@ SELECT COALESCE(a,a) FROM t1; DROP TABLE t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol CREATE TABLE t1 (a TIMESTAMP, b DATETIME); CREATE TABLE t2 AS SELECT LEAST(a,a),LEAST(b,b),LEAST(a,b) FROM t1; SHOW CREATE TABLE t2; @@ -179,6 +183,7 @@ SELECT MAX(COALESCE(c4)) AS c4 FROM t1; SHOW CREATE TABLE t2; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT @@ -189,6 +194,7 @@ SELECT FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t2; DROP TABLE t1; @@ -199,6 +205,7 @@ SELECT MAX(COALESCE(c2)) AS c2 FROM t1; SHOW CREATE TABLE t2; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT @@ -207,6 +214,7 @@ SELECT FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t2; DROP TABLE t1; @@ -217,6 +225,7 @@ SELECT MAX(COALESCE(c2)) AS c2 FROM t1; SHOW CREATE TABLE t2; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT @@ -225,6 +234,7 @@ SELECT FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t2; DROP TABLE t1; @@ -236,6 +246,7 @@ SELECT MAX(COALESCE(c3)) AS c3 FROM t1; SHOW CREATE TABLE t2; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT @@ -245,6 +256,7 @@ SELECT FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t2; DROP TABLE t1; @@ -256,6 +268,7 @@ SELECT MAX(COALESCE(c3)) AS c3 FROM t1; SHOW CREATE TABLE t2; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT @@ -265,6 +278,7 @@ SELECT FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t2; DROP TABLE t1; @@ -274,6 +288,7 @@ SELECT MAX(COALESCE(c1)) AS c1 FROM t1; SHOW CREATE TABLE t2; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT @@ -281,6 +296,7 @@ SELECT FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t2; DROP TABLE t1; @@ -290,6 +306,7 @@ SELECT MAX(COALESCE(c1)) AS c1 FROM t1; SHOW CREATE TABLE t2; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT @@ -297,6 +314,7 @@ SELECT FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t2; DROP TABLE t1; @@ -313,6 +331,7 @@ SELECT @c4:=c4 AS c4 FROM t1; SHOW CREATE TABLE t2; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT @@ -323,6 +342,7 @@ SELECT FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t2; DROP TABLE t1; @@ -333,6 +353,7 @@ SELECT @c2:=c2 AS c2 FROM t1; SHOW CREATE TABLE t2; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT @@ -341,6 +362,7 @@ SELECT FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t2; DROP TABLE t1; @@ -351,6 +373,7 @@ SELECT @c2:=c2 AS c2 FROM t1; SHOW CREATE TABLE t2; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT @@ -359,6 +382,7 @@ SELECT FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t2; DROP TABLE t1; @@ -370,6 +394,7 @@ SELECT @c:=c3 AS c3 FROM t1; SHOW CREATE TABLE t2; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT @@ -379,6 +404,7 @@ SELECT FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t2; DROP TABLE t1; @@ -390,6 +416,7 @@ SELECT @c:=c3 AS c3 FROM t1; SHOW CREATE TABLE t2; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT @@ -399,6 +426,7 @@ SELECT FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t2; DROP TABLE t1; @@ -408,6 +436,7 @@ SELECT @c:=c1 AS c1 FROM t1; SHOW CREATE TABLE t2; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT @@ -415,6 +444,7 @@ SELECT FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t2; DROP TABLE t1; @@ -424,6 +454,7 @@ SELECT @c:=c1 AS c1 FROM t1; SHOW CREATE TABLE t2; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT @@ -431,6 +462,7 @@ SELECT FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t2; DROP TABLE t1; @@ -438,15 +470,20 @@ DROP TABLE t1; --echo # --echo # MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool) --echo # +#enable after fix MDEV-27871 +--disable_view_protocol SELECT CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END; +--enable_view_protocol SELECT CASE 0 WHEN 1 THEN (COALESCE(NULL)) WHEN 4 THEN 5 END; SELECT CASE WHEN TRUE THEN COALESCE(NULL) ELSE 4 END; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT COALESCE(COALESCE(NULL), 1.1) AS c0, IF(0, COALESCE(NULL), 1.1) AS c1; --disable_metadata --enable_ps_protocol +--enable_view_protocol --echo # @@ -653,6 +690,7 @@ SET sql_mode=DEFAULT; SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT @@ -666,6 +704,7 @@ SELECT LEAST(20010001,TIMESTAMP'2001-01-01 00:00:00') AS i4; --disable_metadata --enable_ps_protocol +--enable_view_protocol SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; CREATE TABLE t1 AS SELECT @@ -730,6 +769,7 @@ DROP TABLE t1; SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT @@ -743,6 +783,7 @@ SELECT LEAST(20010001,TIMESTAMP'2001-01-01 00:00:00') AS i4; --disable_metadata --enable_ps_protocol +--enable_view_protocol SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; CREATE TABLE t1 AS SELECT @@ -836,11 +877,13 @@ SELECT 0 + LEAST(TIME'-10:00:00',TIME'10:00:00') AS c; --echo # CREATE TABLE t1 (a INT UNSIGNED, b TIMESTAMP); +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT COALESCE(a,b) FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t1; --echo # diff --git a/mysql-test/main/func_if.result b/mysql-test/main/func_if.result index 09eb85d9fb6f6..6a8e578767e2c 100644 --- a/mysql-test/main/func_if.result +++ b/mysql-test/main/func_if.result @@ -63,7 +63,7 @@ select nullif(1,'test'); nullif(1,'test') 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'test' +Warning 1292 Truncated incorrect DECIMAL value: 'test' select NULLIF(NULL,NULL), NULLIF(NULL,1), NULLIF(NULL,1.0), NULLIF(NULL,"test"); NULLIF(NULL,NULL) NULLIF(NULL,1) NULLIF(NULL,1.0) NULLIF(NULL,"test") NULL NULL NULL NULL diff --git a/mysql-test/main/func_if.test b/mysql-test/main/func_if.test index dc6749da26fc4..d18bdc3070e2a 100644 --- a/mysql-test/main/func_if.test +++ b/mysql-test/main/func_if.test @@ -119,6 +119,8 @@ select if(0, 18446744073709551610, 18446744073709551610); CREATE TABLE t1(a DECIMAL(10,3)); +#enable after fix MDEV-27871 +--disable_view_protocol # check : should be fast. more than few secs means failure. SELECT t1.a, IF((ROUND(t1.a,2)=1), 2, @@ -152,7 +154,7 @@ SELECT t1.a, IF((ROUND(t1.a,2)=1), 2, IF((ROUND(t1.a,2)=1), 2,0)))))))))))))))))))))))))))))) + 1 FROM t1; - +--enable_view_protocol DROP TABLE t1; # diff --git a/mysql-test/main/func_in.result b/mysql-test/main/func_in.result index 569fdfe4cbf0d..175e23ec65f27 100644 --- a/mysql-test/main/func_in.result +++ b/mysql-test/main/func_in.result @@ -1,4 +1,3 @@ -drop table if exists t1, t2; select 1 in (1,2,3); 1 in (1,2,3) 1 @@ -470,7 +469,7 @@ HEX(a) 7FFFFFFFFFFFFFFE 7FFFFFFFFFFFFFFF Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'abc' +Warning 1292 Truncated incorrect DECIMAL value: 'abc' CREATE TABLE t3 (a BIGINT UNSIGNED); INSERT INTO t3 VALUES (9223372036854775551); SELECT HEX(a) FROM t3 WHERE a IN (9223372036854775807, 42); @@ -498,21 +497,21 @@ f1 a 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'b' select f1, case f1 when 'a' then '+' when 1 then '-' end from t1; f1 case f1 when 'a' then '+' when 1 then '-' end a + b NULL 1 - Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'b' create index t1f1_idx on t1(f1); select f1 from t1 where f1 in ('a',1); f1 1 a Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'b' explain select f1 from t1 where f1 in ('a',1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index t1f1_idx t1f1_idx 2 NULL 3 Using where; Using index @@ -527,8 +526,8 @@ select f1 from t1 where f1 in (2,1); f1 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' explain select f1 from t1 where f1 in (2,1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index t1f1_idx t1f1_idx 2 NULL 3 Using where; Using index @@ -539,9 +538,9 @@ f2 0 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' explain select f2 from t2 where f2 in ('a',2); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index t2f2 t2f2 5 NULL 3 Using where; Using index @@ -549,21 +548,21 @@ select f2 from t2 where f2 in ('a','b'); f2 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' explain select f2 from t2 where f2 in ('a','b'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range t2f2 t2f2 5 NULL 1 Using where; Using index +1 SIMPLE t2 ref t2f2 t2f2 5 const 1 Using index Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' select f2 from t2 where f2 in (1,'b'); f2 0 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'b' explain select f2 from t2 where f2 in (1,'b'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index t2f2 t2f2 5 NULL 3 Using where; Using index @@ -916,22 +915,247 @@ SELECT '0x' IN (0); '0x' IN (0) 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '0x' +Warning 1292 Truncated incorrect DECIMAL value: '0x' SELECT '0x' IN (0,1); '0x' IN (0,1) 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '0x' +Warning 1292 Truncated incorrect DECIMAL value: '0x' SELECT ('0x',1) IN ((0,1)); ('0x',1) IN ((0,1)) 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '0x' +Warning 1292 Truncated incorrect DECIMAL value: '0x' SELECT ('0x',1) IN ((0,1),(1,1)); ('0x',1) IN ((0,1),(1,1)) 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '0x' +Warning 1292 Truncated incorrect DECIMAL value: '0x' # # End of 10.4 tests # +# +# MDEV-29662 same values in `IN` set vs equal comparison produces +# the different performance +# +CREATE TABLE t1 (a INT, PRIMARY KEY(a)); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT * FROM t1 WHERE a IN (1,1); +a +1 +# 'const' access since 'a IN (1,1)' is converted to equality 'a=1' +EXPLAIN SELECT * FROM t1 WHERE a IN (1,1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index +EXPLAIN SELECT * FROM t1 WHERE a = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index +SELECT * FROM t1 WHERE a IN (1,1,2); +a +1 +2 +# Conversion to equality is impossible due to different values +EXPLAIN SELECT * FROM t1 WHERE a IN (1,1,2); +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 index +SELECT * FROM t1 WHERE a IN (1,NULL,1); +a +1 +# Conversion to equality is impossible due to NULL in the IN list +EXPLAIN SELECT * FROM t1 WHERE a IN (1,NULL,1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using where; Using index +SELECT * FROM t1 WHERE a NOT IN (2,2,2,2,2,2); +a +1 +3 +EXPLAIN SELECT * FROM t1 WHERE a NOT IN (2,2,2,2,2,2); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 3 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a != 3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 3 Using where; Using index +SELECT * FROM t1 WHERE a NOT IN (3,3,1,1); +a +2 +EXPLAIN SELECT * FROM t1 WHERE a NOT IN (3,3,1,1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 3 Using where; Using index +SELECT * FROM t1 WHERE a NOT IN (1,2,NULL,NULL); +a +# No conversion is possible since elements are not constant +SELECT * FROM t1 WHERE a IN ((SELECT MAX(a) FROM t1), (SELECT MAX(a) FROM t1)); +a +3 +EXPLAIN SELECT * FROM t1 WHERE a IN +((SELECT MAX(a) FROM t1), (SELECT MAX(a) FROM t1)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 1 Using where; Using index +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +# There must be no conversion here: +SELECT * FROM t1 WHERE a IN (3,2,3,3,1,2,3); +a +1 +2 +3 +# Prepared statement +PREPARE stmt FROM "SELECT * FROM t1 WHERE a IN (3,3,3)"; +EXECUTE stmt; +a +3 +EXECUTE stmt; +a +3 +DEALLOCATE PREPARE stmt; +# Conversion to equality since SELECT 2 is evaluated as const +SELECT * FROM t1 WHERE a IN ((SELECT 2), (SELECT 2)); +a +2 +EXPLAIN SELECT * FROM t1 WHERE a IN ((SELECT 2), (SELECT 2)); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index +CREATE TABLE t2 (a INT, b VARCHAR(10), PRIMARY KEY(a,b)); +INSERT INTO t2 VALUES (1,'abc'),(2,'def'),(3,'ghi'); +SELECT * FROM t2 WHERE (a,b) IN ((1,'abc'),(1,'abc')); +a b +1 abc +# 'const' access due to conversion to equality +EXPLAIN SELECT * FROM t2 WHERE (a,b) IN ((1,'abc'),(1,'abc')); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 const PRIMARY PRIMARY 16 const,const 1 Using index +SELECT * FROM t2 WHERE (a,b) IN ((2,'def'),(2,'def'),(2,'XYZ')); +a b +2 def +# No conversion due to different values +EXPLAIN SELECT * FROM t2 WHERE (a,b) IN ((2,'def'),(2,'def'),(2,'XYZ')); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range PRIMARY PRIMARY 16 NULL 2 Using where; Using index +SELECT * FROM t2 WHERE (a,b) IN ((2,'def'),(2,'def'),(2,NULL)); +a b +2 def +# No conversion due to NULL +EXPLAIN SELECT * FROM t2 WHERE (a,b) IN ((2,'def'),(2,'def'),(2,NULL)); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range PRIMARY PRIMARY 16 NULL 1 Using where; Using index +SELECT * FROM t2 WHERE (a,b) NOT IN ((2,'def'),(2,'def'),(2,NULL)); +a b +1 abc +3 ghi +SELECT * FROM t2 WHERE a IN (1,1,1,1); +a b +1 abc +EXPLAIN SELECT * FROM t2 WHERE a IN (1,1,1,1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using index +EXPLAIN SELECT * FROM t2 WHERE a = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using index +SELECT * FROM t2 WHERE b NOT IN ('abc','abc'); +a b +2 def +3 ghi +EXPLAIN SELECT * FROM t2 WHERE b NOT IN ('abc','abc'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index NULL PRIMARY 16 NULL 3 Using where; Using index +EXPLAIN SELECT * FROM t2 WHERE b != 'abc'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index NULL PRIMARY 16 NULL 3 Using where; Using index +# Prepared statements +PREPARE stmt FROM "EXPLAIN SELECT * FROM t2 WHERE (a,b) IN ((1,'abc'),(1,'abc'))"; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 const PRIMARY PRIMARY 16 const,const 1 Using index +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 const PRIMARY PRIMARY 16 const,const 1 Using index +DEALLOCATE PREPARE stmt; +CREATE TABLE t3(a INT, PRIMARY KEY(a)); +INSERT INTO t3 VALUES (1),(2),(3); +PREPARE stmt FROM "EXPLAIN SELECT * FROM t3 WHERE a IN (?,?,?)"; +EXECUTE stmt USING 1,1,1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 Using index +EXECUTE stmt USING 2,3,4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2, t3; +# Nested joins +CREATE TABLE t1 (a INT, b VARCHAR(10), PRIMARY KEY(a)); +INSERT INTO t1 VALUES (1,'abc'),(2,'def'),(3,'ghi'); +CREATE TABLE t2 (a INT, b VARCHAR(20), PRIMARY KEY(a)); +INSERT INTO t2 (a) VALUES (2),(3); +CREATE TABLE t3 (a INT, PRIMARY KEY(a)); +INSERT INTO t3 VALUES (1),(2),(3),(4); +CREATE TABLE t4 (a INT); +INSERT INTO t4 VALUES (2),(3); +# Conversion to equalities +EXPLAIN SELECT * FROM (t1,t2) LEFT JOIN (t3,t4) ON t1.a IN (2,2,2) +AND t3.a IN (1,1,1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 Using where; Using index +1 SIMPLE t4 ALL NULL NULL NULL NULL 2 +# No conversion to equalities due to different values in IN() +EXPLAIN SELECT * FROM (t1,t2) LEFT JOIN (t3,t4) ON t1.a IN (2,3) +AND t3.a IN (1,2); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index; Using join buffer (incremental, BNL join) +1 SIMPLE t4 ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join) +# Conversion to equalities +EXPLAIN SELECT * FROM t1 LEFT JOIN ((t2, t3) LEFT JOIN t4 ON t2.a = t4.a) +ON t1.a = t2.a WHERE t1.a IN (2,2,2); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t4 ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t3 index NULL PRIMARY 4 NULL 4 Using index +# No conversion to equalities due to different values in IN() +EXPLAIN SELECT * FROM t1 LEFT JOIN ((t2, t3) LEFT JOIN t4 ON t2.a = t4.a) +ON t1.a = t2.a WHERE t1.a IN (1,3); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using index condition +1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 +1 SIMPLE t4 ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t3 index NULL PRIMARY 4 NULL 4 Using index +# View +CREATE VIEW v1 AS SELECT t1.*, t2.b AS t2_b FROM t1 LEFT JOIN t2 +ON t1.a = t2.a; +EXPLAIN SELECT * FROM v1 WHERE a IN (2,2,2); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 +EXPLAIN SELECT * FROM v1 WHERE a IN (1,2,3); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using index condition +1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 +# Stored procedures +CREATE PROCEDURE p1(pa INT, pb INT) +EXPLAIN SELECT * FROM t1 WHERE a IN (pa, pb); +CALL p1(1,1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 +CALL p1(2,1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using index condition +DROP TABLE t1, t2, t3, t4; +DROP VIEW v1; +DROP PROCEDURE p1; +# +# MDEV-29895 prepared view crash server (unit.conc_view) +# +create table t1 (username varchar(12) not null, id int(11) not null); +create view v1 as select username from t1 where id = 0; +prepare stmt from "select username from v1 where username in (?, ?)"; +execute stmt using "1", "1"; +username +deallocate prepare stmt; +drop view v1; +drop table t1; +# +# End of 10.6 tests +# diff --git a/mysql-test/main/func_in.test b/mysql-test/main/func_in.test index 86a54535a8b77..847c48d31a94c 100644 --- a/mysql-test/main/func_in.test +++ b/mysql-test/main/func_in.test @@ -1,7 +1,3 @@ -# Initialise ---disable_warnings -drop table if exists t1, t2; ---enable_warnings # # test of IN (NULL) # @@ -354,6 +350,8 @@ SELECT HEX(a) FROM t2 WHERE a IN SELECT HEX(a) FROM t2 WHERE a IN (CAST(0x7ffffffffffffffe AS UNSIGNED), CAST(0x7fffffffffffffff AS UNSIGNED)); +#view protocol generates additional warning +--disable_view_protocol SELECT HEX(a) FROM t2 WHERE a IN (0x7ffffffffffffffe, 0x7fffffffffffffff, @@ -368,6 +366,8 @@ CREATE TABLE t4 (a DATE); INSERT INTO t4 VALUES ('1972-02-06'), ('1972-07-29'); SELECT * FROM t4 WHERE a IN ('1972-02-06','19772-07-29'); +--enable_view_protocol + DROP TABLE t1,t2,t3,t4; # @@ -402,8 +402,11 @@ create table t2(f2 int, index t2f2(f2)); insert into t2 values(0),(1),(2); select f2 from t2 where f2 in ('a',2); explain select f2 from t2 where f2 in ('a',2); +#view protocol generates additional warning +--disable_view_protocol select f2 from t2 where f2 in ('a','b'); explain select f2 from t2 where f2 in ('a','b'); +--enable_view_protocol select f2 from t2 where f2 in (1,'b'); explain select f2 from t2 where f2 in (1,'b'); drop table t1, t2; @@ -649,12 +652,14 @@ DROP TABLE t1; --echo # --echo # MDEV-11514 IN with a mixture of TIME and DATETIME returns a wrong result --echo # - +#enable after fix MDEV-27871 +--disable_view_protocol SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32'); PREPARE stmt FROM "SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32')"; EXECUTE stmt; EXECUTE stmt; DEALLOCATE PREPARE stmt; +--enable_view_protocol --echo # --echo # MDEV-11497 Wrong result for (int_expr IN (mixture of signed and unsigned expressions)) @@ -677,11 +682,13 @@ DROP TABLE t1; # when using Arg_comparator (e.g. in binary comparison operators), and # when not using it (e.g. in IN predicate). +#view protocol generates additional warning +--disable_view_protocol SELECT TIME'00:00:00'='' AS c1_true, TIME'00:00:00' IN ('', TIME'10:20:30') AS c2_true, TIME'00:00:00' NOT IN ('', TIME'10:20:30') AS c3_false; - +--enable_view_protocol --echo # --echo # End of 10.3 tests @@ -701,7 +708,141 @@ SELECT '0x' IN (0,1); SELECT ('0x',1) IN ((0,1)); SELECT ('0x',1) IN ((0,1),(1,1)); - --echo # --echo # End of 10.4 tests --echo # + +--echo # +--echo # MDEV-29662 same values in `IN` set vs equal comparison produces +--echo # the different performance +--echo # +CREATE TABLE t1 (a INT, PRIMARY KEY(a)); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT * FROM t1 WHERE a IN (1,1); +--echo # 'const' access since 'a IN (1,1)' is converted to equality 'a=1' +EXPLAIN SELECT * FROM t1 WHERE a IN (1,1); +EXPLAIN SELECT * FROM t1 WHERE a = 1; +SELECT * FROM t1 WHERE a IN (1,1,2); +--echo # Conversion to equality is impossible due to different values +EXPLAIN SELECT * FROM t1 WHERE a IN (1,1,2); +SELECT * FROM t1 WHERE a IN (1,NULL,1); +--echo # Conversion to equality is impossible due to NULL in the IN list +EXPLAIN SELECT * FROM t1 WHERE a IN (1,NULL,1); + +SELECT * FROM t1 WHERE a NOT IN (2,2,2,2,2,2); +EXPLAIN SELECT * FROM t1 WHERE a NOT IN (2,2,2,2,2,2); +EXPLAIN SELECT * FROM t1 WHERE a != 3; +SELECT * FROM t1 WHERE a NOT IN (3,3,1,1); +EXPLAIN SELECT * FROM t1 WHERE a NOT IN (3,3,1,1); +SELECT * FROM t1 WHERE a NOT IN (1,2,NULL,NULL); + +--echo # No conversion is possible since elements are not constant +SELECT * FROM t1 WHERE a IN ((SELECT MAX(a) FROM t1), (SELECT MAX(a) FROM t1)); +EXPLAIN SELECT * FROM t1 WHERE a IN + ((SELECT MAX(a) FROM t1), (SELECT MAX(a) FROM t1)); + +--echo # There must be no conversion here: +SELECT * FROM t1 WHERE a IN (3,2,3,3,1,2,3); + +--echo # Prepared statement +PREPARE stmt FROM "SELECT * FROM t1 WHERE a IN (3,3,3)"; +EXECUTE stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +--echo # Conversion to equality since SELECT 2 is evaluated as const +--disable_warnings +SELECT * FROM t1 WHERE a IN ((SELECT 2), (SELECT 2)); +EXPLAIN SELECT * FROM t1 WHERE a IN ((SELECT 2), (SELECT 2)); +--enable_warnings + +CREATE TABLE t2 (a INT, b VARCHAR(10), PRIMARY KEY(a,b)); +INSERT INTO t2 VALUES (1,'abc'),(2,'def'),(3,'ghi'); +SELECT * FROM t2 WHERE (a,b) IN ((1,'abc'),(1,'abc')); +--echo # 'const' access due to conversion to equality +EXPLAIN SELECT * FROM t2 WHERE (a,b) IN ((1,'abc'),(1,'abc')); +SELECT * FROM t2 WHERE (a,b) IN ((2,'def'),(2,'def'),(2,'XYZ')); +--echo # No conversion due to different values +EXPLAIN SELECT * FROM t2 WHERE (a,b) IN ((2,'def'),(2,'def'),(2,'XYZ')); +SELECT * FROM t2 WHERE (a,b) IN ((2,'def'),(2,'def'),(2,NULL)); +--echo # No conversion due to NULL +EXPLAIN SELECT * FROM t2 WHERE (a,b) IN ((2,'def'),(2,'def'),(2,NULL)); + +SELECT * FROM t2 WHERE (a,b) NOT IN ((2,'def'),(2,'def'),(2,NULL)); + +SELECT * FROM t2 WHERE a IN (1,1,1,1); +EXPLAIN SELECT * FROM t2 WHERE a IN (1,1,1,1); +EXPLAIN SELECT * FROM t2 WHERE a = 1; + +SELECT * FROM t2 WHERE b NOT IN ('abc','abc'); +EXPLAIN SELECT * FROM t2 WHERE b NOT IN ('abc','abc'); +EXPLAIN SELECT * FROM t2 WHERE b != 'abc'; + +--echo # Prepared statements +PREPARE stmt FROM "EXPLAIN SELECT * FROM t2 WHERE (a,b) IN ((1,'abc'),(1,'abc'))"; +EXECUTE stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +CREATE TABLE t3(a INT, PRIMARY KEY(a)); +INSERT INTO t3 VALUES (1),(2),(3); +PREPARE stmt FROM "EXPLAIN SELECT * FROM t3 WHERE a IN (?,?,?)"; +EXECUTE stmt USING 1,1,1; +EXECUTE stmt USING 2,3,4; +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2, t3; + +--echo # Nested joins +CREATE TABLE t1 (a INT, b VARCHAR(10), PRIMARY KEY(a)); +INSERT INTO t1 VALUES (1,'abc'),(2,'def'),(3,'ghi'); +CREATE TABLE t2 (a INT, b VARCHAR(20), PRIMARY KEY(a)); +INSERT INTO t2 (a) VALUES (2),(3); +CREATE TABLE t3 (a INT, PRIMARY KEY(a)); +INSERT INTO t3 VALUES (1),(2),(3),(4); +CREATE TABLE t4 (a INT); +INSERT INTO t4 VALUES (2),(3); +--echo # Conversion to equalities +EXPLAIN SELECT * FROM (t1,t2) LEFT JOIN (t3,t4) ON t1.a IN (2,2,2) + AND t3.a IN (1,1,1); +--echo # No conversion to equalities due to different values in IN() +EXPLAIN SELECT * FROM (t1,t2) LEFT JOIN (t3,t4) ON t1.a IN (2,3) + AND t3.a IN (1,2); +--echo # Conversion to equalities +EXPLAIN SELECT * FROM t1 LEFT JOIN ((t2, t3) LEFT JOIN t4 ON t2.a = t4.a) + ON t1.a = t2.a WHERE t1.a IN (2,2,2); +--echo # No conversion to equalities due to different values in IN() +EXPLAIN SELECT * FROM t1 LEFT JOIN ((t2, t3) LEFT JOIN t4 ON t2.a = t4.a) + ON t1.a = t2.a WHERE t1.a IN (1,3); + +--echo # View +CREATE VIEW v1 AS SELECT t1.*, t2.b AS t2_b FROM t1 LEFT JOIN t2 + ON t1.a = t2.a; +EXPLAIN SELECT * FROM v1 WHERE a IN (2,2,2); +EXPLAIN SELECT * FROM v1 WHERE a IN (1,2,3); + +--echo # Stored procedures +CREATE PROCEDURE p1(pa INT, pb INT) + EXPLAIN SELECT * FROM t1 WHERE a IN (pa, pb); +CALL p1(1,1); +CALL p1(2,1); + +DROP TABLE t1, t2, t3, t4; +DROP VIEW v1; +DROP PROCEDURE p1; + +--echo # +--echo # MDEV-29895 prepared view crash server (unit.conc_view) +--echo # + +create table t1 (username varchar(12) not null, id int(11) not null); +create view v1 as select username from t1 where id = 0; +prepare stmt from "select username from v1 where username in (?, ?)"; +execute stmt using "1", "1"; +deallocate prepare stmt; +drop view v1; +drop table t1; + +--echo # +--echo # End of 10.6 tests +--echo # + diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 29b996f30664d..73cc64d95aa71 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -273,7 +273,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f` varchar(32) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; f {"id": 87, "name": "carrot"} @@ -298,7 +298,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `json_quote('foo')` varchar(38) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select json_merge('string'); ERROR 42000: Incorrect parameter count in the call to native function 'json_merge' @@ -466,7 +466,7 @@ show create table json; Table Create Table json CREATE TABLE `json` ( `j` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table json; select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' ); json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' ) @@ -760,7 +760,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(38) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, `c2` varchar(38) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-16054 simple json functions flatline cpu on garbage input. @@ -822,8 +822,8 @@ 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 + `JSON_ARRAY_INSERT(fld, '$.[0]', '0')` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; SET sql_mode=default; # @@ -940,6 +940,24 @@ SELECT JSON_REPLACE( JSON_DETAILED('["x"]'), '$.a', 'xx' ); JSON_REPLACE( JSON_DETAILED('["x"]'), '$.a', 'xx' ) ["x"] # +# MDEV-18284 JSON casting using JSON_COMPACT doesn't always work +# with values from subqueries +# +CREATE TABLE json_test(a JSON, b JSON); +INSERT INTO json_test VALUES ("[1,2,3]", '{"a":"foo"}'); +SELECT * FROM json_test; +a b +[1,2,3] {"a":"foo"} +SELECT json_object("a", json_compact(a), "b", b) +FROM (SELECT * FROM json_test) AS json_test_values; +json_object("a", json_compact(a), "b", b) +{"a": [1,2,3], "b": {"a":"foo"}} +SELECT json_object("a", json_compact(a), "b", json_compact(b)) +FROM (SELECT * FROM json_test) AS json_test_values; +json_object("a", json_compact(a), "b", json_compact(b)) +{"a": [1,2,3], "b": {"a":"foo"}} +DROP TABLE json_test; +# # End of 10.2 tests # # @@ -987,6 +1005,44 @@ JSON_VALID('{"admin\\"": null}') {"admin\"": null} 1 {"\"admin": null} 1 {"\"": null} # +# MDEV-29188: Crash in JSON_EXTRACT +# +CREATE TABLE t1 (j JSON); +INSERT INTO t1 VALUES +('{"ID": "4", "Name": "Betty", "Age": 19}'), +('[10, 20, [30, 40]]'); +SELECT * FROM t1 WHERE JSON_EXTRACT(j, '$.Age')=19; +j +{"ID": "4", "Name": "Betty", "Age": 19} +drop table t1; +# +# MDEV-27151: JSON_VALUE() does not parse NULL properties properly +# +# +# It is correct for JSON_EXTRACT() to give null instead of "NULL" because +# it returns the json literal that is put inside json. +# Hence it should return null as in 'null' string and not SQL NULL. +# JSON_VALUE() returns the "VALUE" so it is correct for it to return SQl NULL +# +SELECT NULL; +NULL +NULL +SELECT JSON_VALUE('{"nulltest": null}', '$.nulltest'); +JSON_VALUE('{"nulltest": null}', '$.nulltest') +NULL +SELECT 1 + NULL; +1 + NULL +NULL +SELECT 1 + JSON_VALUE('{"nulltest": null}', '$.nulltest'); +1 + JSON_VALUE('{"nulltest": null}', '$.nulltest') +NULL +SELECT NULL; +NULL +NULL +SELECT JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a'); +JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a') +null +# # End of 10.3 tests # # @@ -1235,6 +1291,171 @@ SELECT JSON_OBJECTAGG(a) 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 ') FROM t1' at line 1 DROP TABLE t1; # +# MDEV-19160 JSON_DETAILED output unnecessarily verbose +# +create table t200 (a text); +insert into t200 values +('{ + "steps": [ + { + "join_optimization": { + "select_id": 1, + "steps": [ + { + "rows_estimation": [ + { + "table": "t1", + "range_analysis": { + "table_scan": { + "rows": 1000, + "cost": 2e308 + }, + "potential_range_indexes": [ + { + "index": "a_b", + "usable": true, + "key_parts": ["a", "b"] + } + ], + "best_covering_index_scan": { + "index": "a_b", + "cost": 52.195, + "chosen": true + }, + "setup_range_conditions": [], + "group_index_range": { + "chosen": false, + "cause": "no group by or distinct" + }, + "analyzing_range_alternatives": { + "range_scan_alternatives": [ + { + "index": "a_b", + "ranges": ["2 <= a <= 2 AND 4 <= b <= 4", "123"], + "rowid_ordered": true, + "using_mrr": false, + "index_only": true, + "rows": 1, + "cost": 1.1752, + "chosen": true + } + ], + "analyzing_roworder_intersect": { + "cause": "too few roworder scans" + }, + "analyzing_index_merge_union": [], + "test_one_line_array":["123"] + }, + "chosen_range_access_summary": { + "range_access_plan": { + "type": "range_scan", + "index": "a_b", + "rows": 1, + "ranges": ["2 <= a <= 2 AND 4 <= b <= 4"] + }, + "rows_for_plan": 1, + "cost_for_plan": 1.1752, + "chosen": true + } + } + }, + { + "selectivity_for_indexes": [ + { + "index_name": "a_b", + "selectivity_from_index": 0.001 + } + ], + "selectivity_for_columns": [], + "cond_selectivity": 0.001 + } + ] + } + ] + } + }, + { + "join_execution": { + "select_id": 1, + "steps": [] + } + } + ] +}'); +select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200; +JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) +[ + { + "range_scan_alternatives": + [ + { + "index": "a_b", + "ranges": + [ + "2 <= a <= 2 AND 4 <= b <= 4", + "123" + ], + "rowid_ordered": true, + "using_mrr": false, + "index_only": true, + "rows": 1, + "cost": 1.1752, + "chosen": true + } + ], + "analyzing_roworder_intersect": + { + "cause": "too few roworder scans" + }, + "analyzing_index_merge_union": + [], + "test_one_line_array": + ["123"] + } +] +select JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200; +JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) +[ + { + "range_scan_alternatives": + [ + { + "index": "a_b", + "ranges": + [ + "2 <= a <= 2 AND 4 <= b <= 4", + "123" + ], + "rowid_ordered": true, + "using_mrr": false, + "index_only": true, + "rows": 1, + "cost": 1.1752, + "chosen": true + } + ], + "analyzing_roworder_intersect": + { + "cause": "too few roworder scans" + }, + "analyzing_index_merge_union": + [], + "test_one_line_array": + ["123"] + } +] +select JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200; +JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) +[{"range_scan_alternatives": [{"index": "a_b", "ranges": ["2 <= a <= 2 AND 4 <= b <= 4", "123"], "rowid_ordered": true, "using_mrr": false, "index_only": true, "rows": 1, "cost": 1.1752, "chosen": true}], "analyzing_roworder_intersect": {"cause": "too few roworder scans"}, "analyzing_index_merge_union": [], "test_one_line_array": ["123"]}] +drop table t200; +# +# MDEV-24538: JSON_LENGTH does not return error upon wrong number of parameters +# +SELECT JSON_LENGTH('{"a":"b"}','$','$', 'foo'); +ERROR 42000: Incorrect parameter count in the call to native function 'json_length' +SELECT JSON_LENGTH(); +ERROR 42000: Incorrect parameter count in the call to native function 'JSON_LENGTH' +# # End of 10.4 tests # # @@ -1388,6 +1609,42 @@ id materials DROP TABLE t1; DROP TABLE t2; # +# MDEV-27018 IF and COALESCE lose "json" property +# +SELECT json_object('a', if(1, json_object('b', 'c'), json_object('e', 'f'))); +json_object('a', if(1, json_object('b', 'c'), json_object('e', 'f'))) +{"a": {"b": "c"}} +SELECT json_object('a', coalesce(json_object('b', 'c'))); +json_object('a', coalesce(json_object('b', 'c'))) +{"a": {"b": "c"}} +# +# MDEV-26392: Crash with json_get_path_next and 10.5.12 +# +CREATE TABLE arrNestTest ( +id VARCHAR(80) AS (JSON_COMPACT(JSON_EXTRACT(doc, "$._id"))) UNIQUE KEY, +doc JSON, +CONSTRAINT id_not_null CHECK(id IS NOT NULL)); +INSERT INTO test.arrNestTest (doc) VALUES ('{ "_id" : { "$oid" : "611c0a463b150154132f6636" }, "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : 1.0 } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] }'); +SELECT * FROM arrNestTest; +id doc +{"$oid":"611c0a463b150154132f6636"} { "_id" : { "$oid" : "611c0a463b150154132f6636" }, "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : 1.0 } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } +DROP TABLE arrNestTest; +# +# MDEV-30412 JSON_OBJECTAGG doesn't escape double quote in key +# +SELECT JSON_OBJECTAGG('"', 1); +JSON_OBJECTAGG('"', 1) +{"\"":1} +SELECT JSON_OBJECTAGG('\"', 1); +JSON_OBJECTAGG('\"', 1) +{"\"":1} +SELECT JSON_OBJECTAGG('\\', 1); +JSON_OBJECTAGG('\\', 1) +{"\\":1} +# +# End of 10.5 tests +# +# # MDEV-26054 Server crashes in Item_func_json_arrayagg::get_str_from_field # CREATE TABLE t (a VARCHAR(8)); @@ -1399,5 +1656,33 @@ f DROP VIEW v; DROP TABLE t; # -# End of 10.5 tests +# MDEV-29264 JSON functions overflow error based ON LONGTEXT field +# +CREATE TABLE t(l1 LONGTEXT, l2 LONGTEXT, l3 LONGTEXT, l4 LONGTEXT); +INSERT INTO t VALUES('k1', 'v1', 'k2', 'v2'); +SELECT JSON_ARRAY(l1, l2, l3, l4), JSON_OBJECT(l1, l2, l3, l4) from t; +JSON_ARRAY(l1, l2, l3, l4) JSON_OBJECT(l1, l2, l3, l4) +["k1", "v1", "k2", "v2"] {"k1": "v1", "k2": "v2"} +SELECT JSON_ARRAY_APPEND(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3'), JSON_ARRAY_INSERT(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3') from t; +JSON_ARRAY_APPEND(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3') JSON_ARRAY_INSERT(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3') +[["k1", "k3"], "v1", "k2", "v2"] ["k3", "k1", "v1", "k2", "v2"] +SELECT JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3'),JSON_SET(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2'),JSON_REPLACE(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2') from t; +JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3') JSON_SET(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2') JSON_REPLACE(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2') +{"k1": "v1", "k2": "v2", "k3": "v3"} {"k1": "v1", "k2": "new v2"} {"k1": "v1", "k2": "new v2"} +DROP TABLE t; +# +# End of 10.6 tests +# +# +# MDEV-31147 json_normalize does not work correctly with MSAN build +# +CREATE TABLE t1 (val JSON); +ALTER TABLE t1 ADD COLUMN normalized_json JSON AS (JSON_NORMALIZE(val)); +INSERT INTO t1 (val) VALUES ('15'); +SELECT * FROM t1; +val normalized_json +15 1.5E1 +DROP TABLE t1; +# +# End of 10.8 tests # diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index eb84d6074300c..1f61f9abd133d 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -9,19 +9,29 @@ select json_value('{"key1":123}', '$.key2'); select json_value('{"key1":123}', '$.key1'); select json_value('{"key1":[1,2,3]}', '$.key1'); select json_value('{"key1": [1,2,3], "key1":123}', '$.key1'); + +#enable after fix MDEV-27871 +--disable_view_protocol select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z'); +--enable_view_protocol select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2'); select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key1'); select json_query('{"key1": 1}', '$.key1'); select json_query('{"key1":123, "key1": [1,2,3]}', '$.key1'); +#enable after fix MDEV-27871 +--disable_view_protocol select json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000))); +--enable_view_protocol select json_array(); select json_array(1); +#enable after fix MDEV-28649 +--disable_view_protocol select json_array(1, "text", false, null); select json_array_append('["a", "b"]', '$', FALSE); +--enable_view_protocol select json_array_append('{"k1":1, "k2":["a", "b"]}', '$.k2', 2); select json_array_append('["a", ["b", "c"], "d"]', '$[0]', 2); @@ -29,9 +39,15 @@ select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1]', 'x'); select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2]', 'x'); select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[3]', 'x'); select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[4]', 'x'); +#enable after fix MDEV-27871 +--disable_view_protocol select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x'); +--enable_view_protocol select json_array_insert('true', '$', 1); +#enable after fix MDEV-27871 +--disable_view_protocol select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y'); +--enable_view_protocol select json_contains('{"k1":123, "k2":345}', '123', '$.k1'); select json_contains('"you"', '"you"'); @@ -56,7 +72,10 @@ select json_contains('{"a":1}', '{}'); select json_contains('[1, {"a":1}]', '{}'); select json_contains('[1, {"a":1}]', '{"a":1}'); select json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]'); +#enable after fix MDEV-27871 +--disable_view_protocol select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]'); +--disable_view_protocol select json_contains('[{"a":"b"},{"c":"d"}]','{"c":"d"}'); select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]"); @@ -557,6 +576,21 @@ SELECT SELECT JSON_REPLACE( JSON_DETAILED('["x"]'), '$.a', 'xx' ); +--echo # +--echo # MDEV-18284 JSON casting using JSON_COMPACT doesn't always work +--echo # with values from subqueries +--echo # + +CREATE TABLE json_test(a JSON, b JSON); +INSERT INTO json_test VALUES ("[1,2,3]", '{"a":"foo"}'); +SELECT * FROM json_test; + +SELECT json_object("a", json_compact(a), "b", b) + FROM (SELECT * FROM json_test) AS json_test_values; +SELECT json_object("a", json_compact(a), "b", json_compact(b)) + FROM (SELECT * FROM json_test) AS json_test_values; +DROP TABLE json_test; + --echo # --echo # End of 10.2 tests --echo # @@ -598,6 +632,40 @@ SELECT JSON_VALID('{"admin\\"": null}'), '{"admin\\"": null}' UNION SELECT JSON_VALID('{"\\"": null}'), '{"\\"": null}'; +--echo # +--echo # MDEV-29188: Crash in JSON_EXTRACT +--echo # + +CREATE TABLE t1 (j JSON); + +INSERT INTO t1 VALUES + ('{"ID": "4", "Name": "Betty", "Age": 19}'), + ('[10, 20, [30, 40]]'); + +SELECT * FROM t1 WHERE JSON_EXTRACT(j, '$.Age')=19; + +drop table t1; + +--echo # +--echo # MDEV-27151: JSON_VALUE() does not parse NULL properties properly +--echo # +--echo # +--echo # It is correct for JSON_EXTRACT() to give null instead of "NULL" because +--echo # it returns the json literal that is put inside json. +--echo # Hence it should return null as in 'null' string and not SQL NULL. +--echo # JSON_VALUE() returns the "VALUE" so it is correct for it to return SQl NULL +--echo # + +SELECT NULL; +SELECT JSON_VALUE('{"nulltest": null}', '$.nulltest'); +SELECT 1 + NULL; +SELECT 1 + JSON_VALUE('{"nulltest": null}', '$.nulltest'); + + +SELECT NULL; +SELECT JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a'); + + --echo # --echo # End of 10.3 tests --echo # @@ -749,6 +817,115 @@ SELECT JSON_OBJECTAGG(a) FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-19160 JSON_DETAILED output unnecessarily verbose +--echo # + +create table t200 (a text); + +insert into t200 values +('{ + "steps": [ + { + "join_optimization": { + "select_id": 1, + "steps": [ + { + "rows_estimation": [ + { + "table": "t1", + "range_analysis": { + "table_scan": { + "rows": 1000, + "cost": 2e308 + }, + "potential_range_indexes": [ + { + "index": "a_b", + "usable": true, + "key_parts": ["a", "b"] + } + ], + "best_covering_index_scan": { + "index": "a_b", + "cost": 52.195, + "chosen": true + }, + "setup_range_conditions": [], + "group_index_range": { + "chosen": false, + "cause": "no group by or distinct" + }, + "analyzing_range_alternatives": { + "range_scan_alternatives": [ + { + "index": "a_b", + "ranges": ["2 <= a <= 2 AND 4 <= b <= 4", "123"], + "rowid_ordered": true, + "using_mrr": false, + "index_only": true, + "rows": 1, + "cost": 1.1752, + "chosen": true + } + ], + "analyzing_roworder_intersect": { + "cause": "too few roworder scans" + }, + "analyzing_index_merge_union": [], + "test_one_line_array":["123"] + }, + "chosen_range_access_summary": { + "range_access_plan": { + "type": "range_scan", + "index": "a_b", + "rows": 1, + "ranges": ["2 <= a <= 2 AND 4 <= b <= 4"] + }, + "rows_for_plan": 1, + "cost_for_plan": 1.1752, + "chosen": true + } + } + }, + { + "selectivity_for_indexes": [ + { + "index_name": "a_b", + "selectivity_from_index": 0.001 + } + ], + "selectivity_for_columns": [], + "cond_selectivity": 0.001 + } + ] + } + ] + } + }, + { + "join_execution": { + "select_id": 1, + "steps": [] + } + } + ] +}'); + + +select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200; +select JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200; +select JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200; +drop table t200; + +--echo # +--echo # MDEV-24538: JSON_LENGTH does not return error upon wrong number of parameters +--echo # +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +SELECT JSON_LENGTH('{"a":"b"}','$','$', 'foo'); +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +SELECT JSON_LENGTH(); + --echo # --echo # End of 10.4 tests --echo # @@ -879,6 +1056,38 @@ SELECT t1.id, JSON_ARRAYAGG(JSON_OBJECT('id',t2.id) ORDER BY t2.id) as materials DROP TABLE t1; DROP TABLE t2; +--echo # +--echo # MDEV-27018 IF and COALESCE lose "json" property +--echo # + +SELECT json_object('a', if(1, json_object('b', 'c'), json_object('e', 'f'))); +SELECT json_object('a', coalesce(json_object('b', 'c'))); + +--echo # +--echo # MDEV-26392: Crash with json_get_path_next and 10.5.12 +--echo # + +CREATE TABLE arrNestTest ( + id VARCHAR(80) AS (JSON_COMPACT(JSON_EXTRACT(doc, "$._id"))) UNIQUE KEY, + doc JSON, + CONSTRAINT id_not_null CHECK(id IS NOT NULL)); + +INSERT INTO test.arrNestTest (doc) VALUES ('{ "_id" : { "$oid" : "611c0a463b150154132f6636" }, "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : 1.0 } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] }'); +SELECT * FROM arrNestTest; +DROP TABLE arrNestTest; + +--echo # +--echo # MDEV-30412 JSON_OBJECTAGG doesn't escape double quote in key +--echo # + +SELECT JSON_OBJECTAGG('"', 1); +SELECT JSON_OBJECTAGG('\"', 1); +SELECT JSON_OBJECTAGG('\\', 1); + +--echo # +--echo # End of 10.5 tests +--echo # + --echo # --echo # MDEV-26054 Server crashes in Item_func_json_arrayagg::get_str_from_field --echo # @@ -891,6 +1100,28 @@ DROP VIEW v; DROP TABLE t; --echo # ---echo # End of 10.5 tests +--echo # MDEV-29264 JSON functions overflow error based ON LONGTEXT field --echo # +CREATE TABLE t(l1 LONGTEXT, l2 LONGTEXT, l3 LONGTEXT, l4 LONGTEXT); +INSERT INTO t VALUES('k1', 'v1', 'k2', 'v2'); +SELECT JSON_ARRAY(l1, l2, l3, l4), JSON_OBJECT(l1, l2, l3, l4) from t; +SELECT JSON_ARRAY_APPEND(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3'), JSON_ARRAY_INSERT(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3') from t; +SELECT JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3'),JSON_SET(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2'),JSON_REPLACE(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2') from t; +DROP TABLE t; +--echo # +--echo # End of 10.6 tests +--echo # + +--echo # +--echo # MDEV-31147 json_normalize does not work correctly with MSAN build +--echo # +CREATE TABLE t1 (val JSON); +ALTER TABLE t1 ADD COLUMN normalized_json JSON AS (JSON_NORMALIZE(val)); +INSERT INTO t1 (val) VALUES ('15'); +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of 10.8 tests +--echo # diff --git a/mysql-test/main/func_json_notembedded.result b/mysql-test/main/func_json_notembedded.result new file mode 100644 index 0000000000000..756d2e85f7c34 --- /dev/null +++ b/mysql-test/main/func_json_notembedded.result @@ -0,0 +1,42 @@ +set global max_allowed_packet=1073741824; +connect u,localhost,root; +# +# MDEV-24909 JSON functions don't respect KILL QUERY / max_statement_time limit +# +set group_concat_max_len= 4294967295; +set @obj=concat_ws('','{', repeat('"a":"b",', 1250000/2), '"c":"d"}'); +set @arr=concat_ws('','[', repeat('1234567,', 1250000/2), '2345678]'); +select length(@obj), length(@arr); +length(@obj) length(@arr) +5000009 5000009 +set max_statement_time=0.0001; +select json_array_append(@arr, '$[0]', 1); +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +select json_array_insert(@arr, '$[0]', 1); +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +select json_insert(@obj, '$.meta', 1); +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +select json_compact(@arr); +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +select json_detailed(@arr); +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +select json_loose(@arr); +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +select json_merge(@obj, @arr); +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +select json_merge_patch(@obj, @obj); +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +select json_merge_preserve(@obj, @arr); +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +select json_remove(@obj,'$.foo'); +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +select json_replace(@obj,'$.foo',1); +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +select json_set(@arr,'$[1000]',1); +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +disconnect u; +connection default; +set global max_allowed_packet=default; +# +# End of 10.6 tests +# diff --git a/mysql-test/main/func_json_notembedded.test b/mysql-test/main/func_json_notembedded.test new file mode 100644 index 0000000000000..893b248301c19 --- /dev/null +++ b/mysql-test/main/func_json_notembedded.test @@ -0,0 +1,38 @@ +source include/have_profiling.inc; +source include/not_embedded.inc; +source include/no_valgrind_without_big.inc; + +set global max_allowed_packet=1073741824; +connect u,localhost,root; + +--echo # +--echo # MDEV-24909 JSON functions don't respect KILL QUERY / max_statement_time limit +--echo # +set group_concat_max_len= 4294967295; + +set @obj=concat_ws('','{', repeat('"a":"b",', 1250000/2), '"c":"d"}'); +set @arr=concat_ws('','[', repeat('1234567,', 1250000/2), '2345678]'); +select length(@obj), length(@arr); + +set max_statement_time=0.0001; +disable_abort_on_error; +select json_array_append(@arr, '$[0]', 1); +select json_array_insert(@arr, '$[0]', 1); +select json_insert(@obj, '$.meta', 1); +select json_compact(@arr); +select json_detailed(@arr); +select json_loose(@arr); +select json_merge(@obj, @arr); +select json_merge_patch(@obj, @obj); +select json_merge_preserve(@obj, @arr); +select json_remove(@obj,'$.foo'); +select json_replace(@obj,'$.foo',1); +select json_set(@arr,'$[1000]',1); +enable_abort_on_error; +disconnect u; +connection default; +set global max_allowed_packet=default; + +--echo # +--echo # End of 10.6 tests +--echo # diff --git a/mysql-test/main/func_like.result b/mysql-test/main/func_like.result index 200cb20c4de03..ba053eac8775a 100644 --- a/mysql-test/main/func_like.result +++ b/mysql-test/main/func_like.result @@ -273,7 +273,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT (`a` like '%f\\_'), `c` int(11) DEFAULT (`a` like '%f\\_' escape ''), `d` int(11) DEFAULT (`a` like '%f\\_' escape '\\') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert t1 (a) values ('1 f_'), ('1 f\\_'); set sql_mode=no_backslash_escapes; insert t1 (a) values ('2 f_'), ('2 f\_'); diff --git a/mysql-test/main/func_like.test b/mysql-test/main/func_like.test index ef13d46c2686e..7339743afe4a2 100644 --- a/mysql-test/main/func_like.test +++ b/mysql-test/main/func_like.test @@ -57,6 +57,7 @@ drop table t1; # Test like with non-default character set # +--disable_service_connection SET NAMES koi8r; CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET koi8r); @@ -71,6 +72,7 @@ SELECT * FROM t1 WHERE a LIKE '% SELECT * FROM t1 WHERE a LIKE '����%'; DROP TABLE t1; +--enable_service_connection # Bug #2547 Strange "like" behaviour in tables with default charset=cp1250 # Test like with non-default character set using TurboBM @@ -99,6 +101,7 @@ select _cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin; # # Check 8bit escape character # +--disable_service_connection set names koi8r; select 'andre%' like 'andre�%' escape '�'; @@ -112,6 +115,7 @@ select 'andre%' like 'andre # select _cp1251'andre%' like convert('andre�%' using cp1251) escape '�'; +--enable_service_connection --echo End of 4.1 tests diff --git a/mysql-test/main/func_math.result b/mysql-test/main/func_math.result index 0c6fcb082390f..746dd9169cab8 100644 --- a/mysql-test/main/func_math.result +++ b/mysql-test/main/func_math.result @@ -179,7 +179,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `round(1, 6)` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; round(1, 6) 1 @@ -425,9 +425,7 @@ SELECT b DIV 900 y FROM t1 GROUP BY y; y 0 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'str1' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'str2' SELECT c DIV 900 y FROM t1 GROUP BY y; y @@ -559,7 +557,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `C` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Bug#11764994 57900: CREATE TABLE .. SELECT ASSERTS SCALE >= 0 && PRECISION > 0 && SCALE <= PR @@ -845,7 +843,7 @@ t1 CREATE TABLE `t1` ( `CONCAT(-1+2.0)` varchar(5) DEFAULT NULL, `CONCAT(+1-2.0)` varchar(5) DEFAULT NULL, `CONCAT(-1-2.0)` varchar(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT CONCAT(+1%2), @@ -871,7 +869,7 @@ t1 CREATE TABLE `t1` ( `CONCAT(-1+2)` varchar(3) DEFAULT NULL, `CONCAT(+1-2)` varchar(3) DEFAULT NULL, `CONCAT(-1-2)` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Bug #29723340: MYSQL SERVER CRASH AFTER SQL QUERY WITH DATA ?AST @@ -1029,7 +1027,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `TRUNCATE(d,0)` decimal(1,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; # # MDEV-22503 MDB limits DECIMAL column precision to 16 doing CTAS with floor/ceil over DECIMAL(X,Y) where X > 16 @@ -1047,7 +1045,7 @@ SHOW CREATE TABLE t45; Table Create Table t45 CREATE TABLE `t45` ( `FLOOR(d1)` decimal(38,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t44, t45; CREATE PROCEDURE p1(prec INT, scale INT) BEGIN @@ -1081,7 +1079,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,0) unsigned DEFAULT NULL, `fa` decimal(38,0) DEFAULT NULL, `fb` decimal(38,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999999999999999999999999999999 b 99999999999999999999999999999999999999 fa 99999999999999999999999999999999999999 @@ -1092,7 +1090,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,1) unsigned DEFAULT NULL, `fa` decimal(38,0) DEFAULT NULL, `fb` decimal(37,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999999999999999999999999999999.9 b 9999999999999999999999999999999999999.9 fa 9999999999999999999999999999999999999 @@ -1103,7 +1101,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,2) unsigned DEFAULT NULL, `fa` decimal(37,0) DEFAULT NULL, `fb` decimal(36,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999999999999999999999999999999.99 b 999999999999999999999999999999999999.99 fa 999999999999999999999999999999999999 @@ -1114,7 +1112,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,3) unsigned DEFAULT NULL, `fa` decimal(36,0) DEFAULT NULL, `fb` decimal(35,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999999999999999999999999999.999 b 99999999999999999999999999999999999.999 fa 99999999999999999999999999999999999 @@ -1125,7 +1123,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,4) unsigned DEFAULT NULL, `fa` decimal(35,0) DEFAULT NULL, `fb` decimal(34,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999999999999999999999999999.9999 b 9999999999999999999999999999999999.9999 fa 9999999999999999999999999999999999 @@ -1136,7 +1134,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,5) unsigned DEFAULT NULL, `fa` decimal(34,0) DEFAULT NULL, `fb` decimal(33,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999999999999999999999999999.99999 b 999999999999999999999999999999999.99999 fa 999999999999999999999999999999999 @@ -1147,7 +1145,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,6) unsigned DEFAULT NULL, `fa` decimal(33,0) DEFAULT NULL, `fb` decimal(32,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999999999999999999999999.999999 b 99999999999999999999999999999999.999999 fa 99999999999999999999999999999999 @@ -1158,7 +1156,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,7) unsigned DEFAULT NULL, `fa` decimal(32,0) DEFAULT NULL, `fb` decimal(31,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999999999999999999999999.9999999 b 9999999999999999999999999999999.9999999 fa 9999999999999999999999999999999 @@ -1169,7 +1167,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,8) unsigned DEFAULT NULL, `fa` decimal(31,0) DEFAULT NULL, `fb` decimal(30,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999999999999999999999999.99999999 b 999999999999999999999999999999.99999999 fa 999999999999999999999999999999 @@ -1180,7 +1178,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,9) unsigned DEFAULT NULL, `fa` decimal(30,0) DEFAULT NULL, `fb` decimal(29,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999999999999999999999.999999999 b 99999999999999999999999999999.999999999 fa 99999999999999999999999999999 @@ -1191,7 +1189,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,10) unsigned DEFAULT NULL, `fa` decimal(29,0) DEFAULT NULL, `fb` decimal(28,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999999999999999999999.9999999999 b 9999999999999999999999999999.9999999999 fa 9999999999999999999999999999 @@ -1202,7 +1200,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,11) unsigned DEFAULT NULL, `fa` decimal(28,0) DEFAULT NULL, `fb` decimal(27,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999999999999999999999.99999999999 b 999999999999999999999999999.99999999999 fa 999999999999999999999999999 @@ -1213,7 +1211,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,12) unsigned DEFAULT NULL, `fa` decimal(27,0) DEFAULT NULL, `fb` decimal(26,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999999999999999999.999999999999 b 99999999999999999999999999.999999999999 fa 99999999999999999999999999 @@ -1224,7 +1222,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,13) unsigned DEFAULT NULL, `fa` decimal(26,0) DEFAULT NULL, `fb` decimal(25,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999999999999999999.9999999999999 b 9999999999999999999999999.9999999999999 fa 9999999999999999999999999 @@ -1235,7 +1233,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,14) unsigned DEFAULT NULL, `fa` decimal(25,0) DEFAULT NULL, `fb` decimal(24,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999999999999999999.99999999999999 b 999999999999999999999999.99999999999999 fa 999999999999999999999999 @@ -1246,7 +1244,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,15) unsigned DEFAULT NULL, `fa` decimal(24,0) DEFAULT NULL, `fb` decimal(23,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999999999999999.999999999999999 b 99999999999999999999999.999999999999999 fa 99999999999999999999999 @@ -1257,7 +1255,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,16) unsigned DEFAULT NULL, `fa` decimal(23,0) DEFAULT NULL, `fb` decimal(22,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999999999999999.9999999999999999 b 9999999999999999999999.9999999999999999 fa 9999999999999999999999 @@ -1268,7 +1266,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,17) unsigned DEFAULT NULL, `fa` decimal(22,0) DEFAULT NULL, `fb` decimal(21,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999999999999999.99999999999999999 b 999999999999999999999.99999999999999999 fa 999999999999999999999 @@ -1279,7 +1277,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,18) unsigned DEFAULT NULL, `fa` decimal(21,0) DEFAULT NULL, `fb` decimal(20,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999999999999.999999999999999999 b 99999999999999999999.999999999999999999 fa 99999999999999999999 @@ -1290,7 +1288,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,19) unsigned DEFAULT NULL, `fa` decimal(20,0) DEFAULT NULL, `fb` decimal(19,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999999999999.9999999999999999999 b 9999999999999999999.9999999999999999999 fa 9999999999999999999 @@ -1301,7 +1299,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,20) unsigned DEFAULT NULL, `fa` decimal(19,0) DEFAULT NULL, `fb` bigint(18) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999999999999.99999999999999999999 b 999999999999999999.99999999999999999999 fa 999999999999999999 @@ -1312,7 +1310,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,21) unsigned DEFAULT NULL, `fa` bigint(19) DEFAULT NULL, `fb` bigint(17) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999999999.999999999999999999999 b 99999999999999999.999999999999999999999 fa 99999999999999999 @@ -1323,7 +1321,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,22) unsigned DEFAULT NULL, `fa` bigint(18) DEFAULT NULL, `fb` bigint(16) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999999999.9999999999999999999999 b 9999999999999999.9999999999999999999999 fa 9999999999999999 @@ -1334,7 +1332,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,23) unsigned DEFAULT NULL, `fa` bigint(17) DEFAULT NULL, `fb` bigint(15) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999999999.99999999999999999999999 b 999999999999999.99999999999999999999999 fa 999999999999999 @@ -1345,7 +1343,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,24) unsigned DEFAULT NULL, `fa` bigint(16) DEFAULT NULL, `fb` bigint(14) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999999.999999999999999999999999 b 99999999999999.999999999999999999999999 fa 99999999999999 @@ -1356,7 +1354,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,25) unsigned DEFAULT NULL, `fa` bigint(15) DEFAULT NULL, `fb` bigint(13) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999999.9999999999999999999999999 b 9999999999999.9999999999999999999999999 fa 9999999999999 @@ -1367,7 +1365,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,26) unsigned DEFAULT NULL, `fa` bigint(14) DEFAULT NULL, `fb` bigint(12) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999999.99999999999999999999999999 b 999999999999.99999999999999999999999999 fa 999999999999 @@ -1378,7 +1376,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,27) unsigned DEFAULT NULL, `fa` bigint(13) DEFAULT NULL, `fb` bigint(11) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999.999999999999999999999999999 b 99999999999.999999999999999999999999999 fa 99999999999 @@ -1389,7 +1387,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,28) unsigned DEFAULT NULL, `fa` bigint(12) DEFAULT NULL, `fb` bigint(10) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999.9999999999999999999999999999 b 9999999999.9999999999999999999999999999 fa 9999999999 @@ -1400,7 +1398,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,29) unsigned DEFAULT NULL, `fa` bigint(11) DEFAULT NULL, `fb` int(9) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999.99999999999999999999999999999 b 999999999.99999999999999999999999999999 fa 999999999 @@ -1411,7 +1409,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(38,30) unsigned DEFAULT NULL, `fa` int(10) DEFAULT NULL, `fb` int(8) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999.999999999999999999999999999999 b 99999999.999999999999999999999999999999 fa 99999999 @@ -1423,7 +1421,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,0) unsigned DEFAULT NULL, `fa` decimal(30,0) DEFAULT NULL, `fb` decimal(30,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999999999999999999999999 b 999999999999999999999999999999 fa 999999999999999999999999999999 @@ -1434,7 +1432,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,1) unsigned DEFAULT NULL, `fa` decimal(30,0) DEFAULT NULL, `fb` decimal(29,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999999999999999999999.9 b 99999999999999999999999999999.9 fa 99999999999999999999999999999 @@ -1445,7 +1443,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,2) unsigned DEFAULT NULL, `fa` decimal(29,0) DEFAULT NULL, `fb` decimal(28,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999999999999999999999.99 b 9999999999999999999999999999.99 fa 9999999999999999999999999999 @@ -1456,7 +1454,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,3) unsigned DEFAULT NULL, `fa` decimal(28,0) DEFAULT NULL, `fb` decimal(27,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999999999999999999999.999 b 999999999999999999999999999.999 fa 999999999999999999999999999 @@ -1467,7 +1465,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,4) unsigned DEFAULT NULL, `fa` decimal(27,0) DEFAULT NULL, `fb` decimal(26,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999999999999999999.9999 b 99999999999999999999999999.9999 fa 99999999999999999999999999 @@ -1478,7 +1476,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,5) unsigned DEFAULT NULL, `fa` decimal(26,0) DEFAULT NULL, `fb` decimal(25,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999999999999999999.99999 b 9999999999999999999999999.99999 fa 9999999999999999999999999 @@ -1489,7 +1487,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,6) unsigned DEFAULT NULL, `fa` decimal(25,0) DEFAULT NULL, `fb` decimal(24,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999999999999999999.999999 b 999999999999999999999999.999999 fa 999999999999999999999999 @@ -1500,7 +1498,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,7) unsigned DEFAULT NULL, `fa` decimal(24,0) DEFAULT NULL, `fb` decimal(23,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999999999999999.9999999 b 99999999999999999999999.9999999 fa 99999999999999999999999 @@ -1511,7 +1509,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,8) unsigned DEFAULT NULL, `fa` decimal(23,0) DEFAULT NULL, `fb` decimal(22,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999999999999999.99999999 b 9999999999999999999999.99999999 fa 9999999999999999999999 @@ -1522,7 +1520,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,9) unsigned DEFAULT NULL, `fa` decimal(22,0) DEFAULT NULL, `fb` decimal(21,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999999999999999.999999999 b 999999999999999999999.999999999 fa 999999999999999999999 @@ -1533,7 +1531,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,10) unsigned DEFAULT NULL, `fa` decimal(21,0) DEFAULT NULL, `fb` decimal(20,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999999999999.9999999999 b 99999999999999999999.9999999999 fa 99999999999999999999 @@ -1544,7 +1542,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,11) unsigned DEFAULT NULL, `fa` decimal(20,0) DEFAULT NULL, `fb` decimal(19,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999999999999.99999999999 b 9999999999999999999.99999999999 fa 9999999999999999999 @@ -1555,7 +1553,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,12) unsigned DEFAULT NULL, `fa` decimal(19,0) DEFAULT NULL, `fb` bigint(18) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999999999999.999999999999 b 999999999999999999.999999999999 fa 999999999999999999 @@ -1566,7 +1564,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,13) unsigned DEFAULT NULL, `fa` bigint(19) DEFAULT NULL, `fb` bigint(17) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999999999.9999999999999 b 99999999999999999.9999999999999 fa 99999999999999999 @@ -1577,7 +1575,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,14) unsigned DEFAULT NULL, `fa` bigint(18) DEFAULT NULL, `fb` bigint(16) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999999999.99999999999999 b 9999999999999999.99999999999999 fa 9999999999999999 @@ -1588,7 +1586,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,15) unsigned DEFAULT NULL, `fa` bigint(17) DEFAULT NULL, `fb` bigint(15) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999999999.999999999999999 b 999999999999999.999999999999999 fa 999999999999999 @@ -1599,7 +1597,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,16) unsigned DEFAULT NULL, `fa` bigint(16) DEFAULT NULL, `fb` bigint(14) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999999.9999999999999999 b 99999999999999.9999999999999999 fa 99999999999999 @@ -1610,7 +1608,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,17) unsigned DEFAULT NULL, `fa` bigint(15) DEFAULT NULL, `fb` bigint(13) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999999.99999999999999999 b 9999999999999.99999999999999999 fa 9999999999999 @@ -1621,7 +1619,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,18) unsigned DEFAULT NULL, `fa` bigint(14) DEFAULT NULL, `fb` bigint(12) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999999.999999999999999999 b 999999999999.999999999999999999 fa 999999999999 @@ -1632,7 +1630,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,19) unsigned DEFAULT NULL, `fa` bigint(13) DEFAULT NULL, `fb` bigint(11) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999999.9999999999999999999 b 99999999999.9999999999999999999 fa 99999999999 @@ -1643,7 +1641,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,20) unsigned DEFAULT NULL, `fa` bigint(12) DEFAULT NULL, `fb` bigint(10) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999999.99999999999999999999 b 9999999999.99999999999999999999 fa 9999999999 @@ -1654,7 +1652,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,21) unsigned DEFAULT NULL, `fa` bigint(11) DEFAULT NULL, `fb` int(9) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999999.999999999999999999999 b 999999999.999999999999999999999 fa 999999999 @@ -1665,7 +1663,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,22) unsigned DEFAULT NULL, `fa` int(10) DEFAULT NULL, `fb` int(8) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999999.9999999999999999999999 b 99999999.9999999999999999999999 fa 99999999 @@ -1676,7 +1674,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,23) unsigned DEFAULT NULL, `fa` int(9) DEFAULT NULL, `fb` int(7) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999999.99999999999999999999999 b 9999999.99999999999999999999999 fa 9999999 @@ -1687,7 +1685,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,24) unsigned DEFAULT NULL, `fa` int(8) DEFAULT NULL, `fb` int(6) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999999.999999999999999999999999 b 999999.999999999999999999999999 fa 999999 @@ -1698,7 +1696,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,25) unsigned DEFAULT NULL, `fa` int(7) DEFAULT NULL, `fb` int(5) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99999.9999999999999999999999999 b 99999.9999999999999999999999999 fa 99999 @@ -1709,7 +1707,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,26) unsigned DEFAULT NULL, `fa` int(6) DEFAULT NULL, `fb` int(4) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9999.99999999999999999999999999 b 9999.99999999999999999999999999 fa 9999 @@ -1720,7 +1718,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,27) unsigned DEFAULT NULL, `fa` int(5) DEFAULT NULL, `fb` int(3) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 999.999999999999999999999999999 b 999.999999999999999999999999999 fa 999 @@ -1731,7 +1729,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,28) unsigned DEFAULT NULL, `fa` int(4) DEFAULT NULL, `fb` int(2) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 99.9999999999999999999999999999 b 99.9999999999999999999999999999 fa 99 @@ -1742,7 +1740,7 @@ Create Table CREATE TABLE `t2` ( `b` decimal(30,29) unsigned DEFAULT NULL, `fa` int(3) DEFAULT NULL, `fb` int(1) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9.99999999999999999999999999999 b 9.99999999999999999999999999999 fa 9 @@ -1781,7 +1779,7 @@ t1 CREATE TABLE `t1` ( `c1` int(2) DEFAULT NULL, `c2` double DEFAULT NULL, `c3` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-12857 Out-of-range errors on CREATE..SELECT 2222222222 DIV 1 @@ -1797,7 +1795,7 @@ t1 CREATE TABLE `t1` ( `d01` int(1) DEFAULT NULL, `d09` int(9) DEFAULT NULL, `d10` bigint(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; d01 2 d09 222222222 @@ -1815,7 +1813,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` bigint(11) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT a, HEX(a) FROM t2; a HEX(a) 4294967296 100000000 @@ -1931,6 +1929,9 @@ x Warnings: Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated Warning 1916 Got overflow when converting '99999999999999999999999999999999999999999999999999999999999999999' to INT. Value truncated +select crc32(429496729656755555555555555555555555555555555555555555555555555555555555555555555555555,'a') as x; +x +3310005809 DROP TABLE IF EXISTS t; Warnings: Note 1051 Unknown table 'test.t' @@ -2325,7 +2326,7 @@ t2 CREATE TABLE `t2` ( `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 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; SET sql_mode=DEFAULT; # @@ -2359,7 +2360,7 @@ t1 CREATE TABLE `t1` ( `c1` decimal(7,0) DEFAULT NULL, `c3` decimal(14,0) DEFAULT NULL, `c4` decimal(7,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SELECT(-0 * MOD((UTC_TIME / -0)MOD (ATAN('') MOD COT(0)),-0)) MOD (0 DIV 0); ERROR 22003: DOUBLE value is out of range in 'cot(0)' @@ -2382,7 +2383,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `FORMAT(-1e308,2)` varchar(417) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE OR REPLACE TABLE t1 AS SELECT FORMAT('-1e308',2); SELECT * FROM t1; @@ -2392,7 +2393,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `FORMAT('-1e308',2)` varchar(417) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE OR REPLACE TABLE t1 AS SELECT FORMAT(DATE'20191231',0),FORMAT(TIME'99:05:00',0),FORMAT(TIMESTAMP'2019-12-31 23:59:59.123456',0); SELECT * FROM t1; @@ -2404,7 +2405,7 @@ t1 CREATE TABLE `t1` ( `FORMAT(DATE'20191231',0)` varchar(11) DEFAULT NULL, `FORMAT(TIME'99:05:00',0)` varchar(10) DEFAULT NULL, `FORMAT(TIMESTAMP'2019-12-31 23:59:59.123456',0)` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE OR REPLACE TABLE t1 (y YEAR); INSERT INTO t1 VALUES ('2099'),('99'); @@ -2417,7 +2418,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `FORMAT(y,0)` varchar(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; CREATE OR REPLACE TABLE t1 (bi BIGINT UNSIGNED, bis BIGINT); INSERT INTO t1 VALUES (18446744073709551615,-9223372036854775808),(0,0); @@ -2431,7 +2432,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `FORMAT(bi,0)` varchar(27) DEFAULT NULL, `FORMAT(bis,0)` varchar(26) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (d DECIMAL(65,0)); INSERT INTO t1 VALUES (99999999999999999999999999999999999999999999999999999999999999999),(-99999999999999999999999999999999999999999999999999999999999999999),(0); @@ -2445,7 +2446,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `FORMAT(d,0)` varchar(87) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 AS SELECT -99999999999999999999999999999999999999999999999999999999999999999 as c1; SELECT * FROM t1; @@ -2455,7 +2456,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` decimal(65,0) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE OR REPLACE TABLE t1 (b1 BIT(1), b2 BIT(2), @@ -2675,7 +2676,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(2)); INSERT INTO t1 VALUES (b'11'); @@ -2690,7 +2691,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(3)); INSERT INTO t1 VALUES (b'111'); @@ -2705,7 +2706,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(4)); INSERT INTO t1 VALUES (b'1111'); @@ -2720,7 +2721,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(5)); INSERT INTO t1 VALUES (b'11111'); @@ -2735,7 +2736,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(6)); INSERT INTO t1 VALUES (b'111111'); @@ -2750,7 +2751,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(7)); INSERT INTO t1 VALUES (b'1111111'); @@ -2765,7 +2766,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(8)); INSERT INTO t1 VALUES (b'11111111'); @@ -2780,7 +2781,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(9)); INSERT INTO t1 VALUES (b'111111111'); @@ -2795,7 +2796,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(10)); INSERT INTO t1 VALUES (b'1111111111'); @@ -2810,7 +2811,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(11)); INSERT INTO t1 VALUES (b'11111111111'); @@ -2825,7 +2826,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(12)); INSERT INTO t1 VALUES (b'111111111111'); @@ -2840,7 +2841,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(13)); INSERT INTO t1 VALUES (b'1111111111111'); @@ -2855,7 +2856,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(14)); INSERT INTO t1 VALUES (b'11111111111111'); @@ -2870,7 +2871,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(7) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(15)); INSERT INTO t1 VALUES (b'111111111111111'); @@ -2885,7 +2886,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(7) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(16)); INSERT INTO t1 VALUES (b'1111111111111111'); @@ -2900,7 +2901,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(7) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(17)); INSERT INTO t1 VALUES (b'11111111111111111'); @@ -2915,7 +2916,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(18)); INSERT INTO t1 VALUES (b'111111111111111111'); @@ -2930,7 +2931,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(19)); INSERT INTO t1 VALUES (b'1111111111111111111'); @@ -2945,7 +2946,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(20)); INSERT INTO t1 VALUES (b'11111111111111111111'); @@ -2960,7 +2961,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(21)); INSERT INTO t1 VALUES (b'111111111111111111111'); @@ -2975,7 +2976,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(22)); INSERT INTO t1 VALUES (b'1111111111111111111111'); @@ -2990,7 +2991,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(23)); INSERT INTO t1 VALUES (b'11111111111111111111111'); @@ -3005,7 +3006,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(24)); INSERT INTO t1 VALUES (b'111111111111111111111111'); @@ -3020,7 +3021,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(25)); INSERT INTO t1 VALUES (b'1111111111111111111111111'); @@ -3035,7 +3036,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(26)); INSERT INTO t1 VALUES (b'11111111111111111111111111'); @@ -3050,7 +3051,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(27)); INSERT INTO t1 VALUES (b'111111111111111111111111111'); @@ -3065,7 +3066,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(13) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(28)); INSERT INTO t1 VALUES (b'1111111111111111111111111111'); @@ -3080,7 +3081,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(13) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(29)); INSERT INTO t1 VALUES (b'11111111111111111111111111111'); @@ -3095,7 +3096,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(13) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(30)); INSERT INTO t1 VALUES (b'111111111111111111111111111111'); @@ -3110,7 +3111,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(14) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(31)); INSERT INTO t1 VALUES (b'1111111111111111111111111111111'); @@ -3125,7 +3126,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(14) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(32)); INSERT INTO t1 VALUES (b'11111111111111111111111111111111'); @@ -3140,7 +3141,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(14) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(33)); INSERT INTO t1 VALUES (b'111111111111111111111111111111111'); @@ -3155,7 +3156,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(14) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(34)); INSERT INTO t1 VALUES (b'1111111111111111111111111111111111'); @@ -3170,7 +3171,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(15) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(35)); INSERT INTO t1 VALUES (b'11111111111111111111111111111111111'); @@ -3185,7 +3186,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(15) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(36)); INSERT INTO t1 VALUES (b'111111111111111111111111111111111111'); @@ -3200,7 +3201,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(15) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(37)); INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111'); @@ -3215,7 +3216,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(17) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(38)); INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111'); @@ -3230,7 +3231,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(17) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(39)); INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111'); @@ -3245,7 +3246,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(17) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(40)); INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111'); @@ -3260,7 +3261,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(18) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(41)); INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111'); @@ -3275,7 +3276,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(18) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(42)); INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111'); @@ -3290,7 +3291,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(18) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(43)); INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111'); @@ -3305,7 +3306,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(18) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(44)); INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111'); @@ -3320,7 +3321,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(45)); INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111'); @@ -3335,7 +3336,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(46)); INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111'); @@ -3350,7 +3351,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(47)); INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111'); @@ -3365,7 +3366,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(48)); INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111'); @@ -3380,7 +3381,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(49)); INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111'); @@ -3395,7 +3396,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(50)); INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111111'); @@ -3410,7 +3411,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(22) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(51)); INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111111'); @@ -3425,7 +3426,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(22) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(52)); INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111'); @@ -3440,7 +3441,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(22) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(53)); INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111111111'); @@ -3455,7 +3456,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(22) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(54)); INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111111111'); @@ -3470,7 +3471,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(55)); INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111'); @@ -3485,7 +3486,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(56)); INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111111111111'); @@ -3500,7 +3501,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(57)); INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111111111111'); @@ -3515,7 +3516,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(25) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(58)); INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111'); @@ -3530,7 +3531,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(25) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(59)); INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111111111111111'); @@ -3545,7 +3546,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(25) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(60)); INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111111111111111'); @@ -3560,7 +3561,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(26) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(61)); INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111111'); @@ -3575,7 +3576,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(26) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(62)); INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111111111111111111'); @@ -3590,7 +3591,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(26) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(63)); INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111111111111111111'); @@ -3605,7 +3606,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(26) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (c1 BIT(64)); INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111111111'); @@ -3620,7 +3621,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(27) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE OR REPLACE TABLE t1 (f float); INSERT INTO t1 VALUES (3e38), (-3e38), (0), (12.34), (-12.34); @@ -3636,7 +3637,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `FORMAT(f,0)` varchar(54) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; # # End of 10.4 tests @@ -3659,7 +3660,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `UUID_SHORT() - a` bigint(22) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2, t1; SET sql_mode=DEFAULT; CREATE TABLE t1 (a TIMESTAMP); @@ -3674,7 +3675,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `UUID_SHORT() - a` bigint(22) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2, t1; # # MDEV-23680 Assertion `data' failed in crcr32_calc_pclmulqdq diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test index df83d13789c59..02c5b872ea5d3 100644 --- a/mysql-test/main/func_math.test +++ b/mysql-test/main/func_math.test @@ -206,9 +206,15 @@ select floor(cast(-2 as unsigned)), floor(18446744073709551614), floor(-2); select format(cast(-2 as unsigned), 2), format(18446744073709551614, 2), format(-2, 2); select sqrt(cast(-2 as unsigned)), sqrt(18446744073709551614), sqrt(-2); select round(cast(-2 as unsigned), 1), round(18446744073709551614, 1), round(-2, 1); +#view protocol generates additional warning +--disable_view_protocol select round(4, cast(-2 as unsigned)), round(4, 18446744073709551614), round(4, -2); +--enable_view_protocol select truncate(cast(-2 as unsigned), 1), truncate(18446744073709551614, 1), truncate(-2, 1); +#view protocol generates additional warning +--disable_view_protocol select truncate(4, cast(-2 as unsigned)), truncate(4, 18446744073709551614), truncate(4, -2); +--enable_view_protocol select round(10000000000000000000, -19), truncate(10000000000000000000, -19); select round(1e0, -309), truncate(1e0, -309); select round(1e1,308), truncate(1e1, 308); @@ -516,7 +522,10 @@ SELECT @a / 0.5; SELECT COT(1/0); SELECT -1 + 9223372036854775808; SELECT 2 DIV -2; +#view protocol generates additional warning +--disable_view_protocol SELECT -(1 DIV 0); +--enable_view_protocol # Crashed the server with SIGFPE before the bugfix SELECT -9223372036854775808 MOD -1; @@ -556,8 +565,11 @@ select (1.175494351E-37 div 1.7976931348623157E+308); select round(999999999, -9); select round(999999999.0, -9); +#enable after fix MDEV-29526 +--disable_view_protocol select round(999999999999999999, -18); select round(999999999999999999.0, -18); +--enable_view_protocol --echo # --echo # Bug#12537160 ASSERTION FAILED: @@ -671,7 +683,10 @@ SELECT STDDEV_POP(ROUND(0,@A:=2009)) FROM (SELECT 1 UNION SELECT 2) fake_table; CREATE TABLE t1 ( pk int NOT NULL, i1 int NOT NULL, d1 date NOT NULL, t1 time); INSERT INTO t1 VALUES (7,9,'2007-08-15','03:55:02'),(8,7,'1993-06-05','04:17:51'),(9,7,'2034-07-01','17:31:12'),(10,0,'1998-08-24','08:09:27'); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT DISTINCT STDDEV_SAMP(EXPORT_SET(t1, -1379790335835635712, (i1 + 'o'), (MD5(d1)))) FROM t1; +--enable_view_protocol DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(128)); @@ -791,7 +806,10 @@ select 0=0, 0=-0, 0.0= -0.0, 0.0 = -(0.0), 0.0E1=-0.0E1, 0.0E1=-(0.0E1); --echo # CRC32 tests --echo # +#enable after fix MDEV-28535 +--disable_view_protocol select CRC32(NULL), CRC32(''), CRC32('MySQL'), CRC32('mysql'), CRC32('01234567'), CRC32('012345678'), CRC32(REPEAT('ABCDEfghij', 20)), CRC32(REPEAT('0123456789', 200)); +--enable_view_protocol --echo # --echo # Start of 10.3 tests @@ -844,12 +862,18 @@ SET sql_mode=DEFAULT; --echo # Bug#26495791 - EXPAND TEST SUITE TO INCLUDE CRC32 TESTS --echo # +#enable after fix MDEV-28535 +--disable_view_protocol SELECT CRC32(NULL), CRC32(''), CRC32('MySQL'), CRC32('mysql'); +--enable_view_protocol SELECT CRC32('01234567'), CRC32('012345678'); SELECT CRC32('~!@$%^*'), CRC32('-0.0001'); SELECT CRC32(99999999999999999999999999999999); SELECT CRC32(-99999999999999999999999999999999); +#enable_after fix MDEV-28535 +--disable_view_protocol SELECT CRC32C(NULL), CRC32C(''), CRC32C('MariaDB'), CRC32C('mariadb'); +--enable_view_protocol SELECT CRC32(NULL,1),CRC32C(NULL,1), CRC32(1,''), CRC32C(1,''); SELECT CRC32(42,''),CRC32C(42,''),CRC32('42',''),CRC32C('42',''); SELECT CRC32(42,NULL),CRC32C(42,NULL); @@ -891,7 +915,12 @@ select crc32(1e100,''), hex(char(1e100)); select crc32(10.11,''), hex(char(10.11)); select crc32(-1,''), hex(char(-1)); select crc32('',''), hex(char('')); +--disable_ps_protocol select crc32(429496729656755555555555555555555555555555555555555555555555555555555555555555555555555,'a') as x; +--enable_ps_protocol +--disable_warnings +select crc32(429496729656755555555555555555555555555555555555555555555555555555555555555555555555555,'a') as x; +--enable_warnings # Test cases for using the function in aggregate functions, group-by, having # and order-by clauses diff --git a/mysql-test/main/func_misc.result b/mysql-test/main/func_misc.result index 7597da95f3d01..8ae2cf4ad6b05 100644 --- a/mysql-test/main/func_misc.result +++ b/mysql-test/main/func_misc.result @@ -120,7 +120,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `uuid()` uuid DEFAULT NULL, `length(uuid())` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select length(`uuid()`) from t1; length(`uuid()`) 36 @@ -130,7 +130,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(21) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; drop table if exists table_26093; drop function if exists func_26093_a; @@ -317,7 +317,7 @@ SELECT COALESCE(a) = COALESCE(b) FROM t1; COALESCE(a) = COALESCE(b) 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' DROP TABLE t1; # # Bug #54461: crash with longblob and union or update with subquery @@ -1541,7 +1541,7 @@ t1 CREATE TABLE `t1` ( `a1` varchar(30) DEFAULT inet_ntoa(`b`), `c` int(11) DEFAULT is_ipv4(`a`), `d` int(11) DEFAULT is_ipv6(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('192.168.001.001'),('::1'),('xxx'); SELECT * FROM t1; a b a1 c d @@ -1564,7 +1564,7 @@ t1 CREATE TABLE `t1` ( `str1` varchar(128) DEFAULT inet6_ntoa(`addr`), `b` int(11) DEFAULT is_ipv4_compat(`addr`), `c` int(11) DEFAULT is_ipv4_mapped(`addr`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (str) VALUES ('::FFFF:192.168.0.1'),('::10.0.5.9'); SELECT str, str1, b,c FROM t1; str str1 b c @@ -1624,7 +1624,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` bigint(20) unsigned NOT NULL, `c2` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 18446744073709551615 18446744073709551615 diff --git a/mysql-test/main/func_misc.test b/mysql-test/main/func_misc.test index 5e8118d4cefae..6a199a45b2708 100644 --- a/mysql-test/main/func_misc.test +++ b/mysql-test/main/func_misc.test @@ -159,7 +159,10 @@ select benchmark(100, (select avg(func_26093_a(a)) from table_26093)); select @invoked; set @invoked := 0; +#enable after fix MDEV-27871 +--disable_view_protocol select benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093)); +--enable_view_protocol # Returns 1000, due to rand() preventing caching. select @invoked; @@ -268,10 +271,12 @@ set @@session.time_zone=@save_tz; # # Bug#42014: Crash, name_const with collate # +--disable_view_protocol CREATE TABLE t1 (a DATE); SELECT * FROM t1 WHERE a = NAME_CONST('reportDate', _binary'2009-01-09' COLLATE 'binary'); DROP TABLE t1; +--enable_view_protocol # # Bug#35515: Aliases of variables in binary log are ignored with NAME_CONST @@ -632,6 +637,8 @@ DROP TABLE t1; --echo # GET_LOCK, RELEASE_LOCK, IS_USED_LOCK functions test --echo # +--disable_service_connection + --echo # IS_USED_LOCK, IS_FREE_LOCK: the lock is not acquired --echo # Note: IS_USED_LOCK returns NULL if the lock is unused select is_used_lock('test'); @@ -792,6 +799,7 @@ select is_free_lock(repeat('a', 193)); --error ER_TOO_LONG_IDENT select release_lock(repeat('a', 193)); +--enable_service_connection --echo --echo # -- @@ -942,8 +950,11 @@ SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5::7:8')); SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5:6::8')); SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5:6:7::')); SELECT INET6_NTOA(INET6_ATON('0000:0000::0000:0001')); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT INET6_NTOA(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed')); SELECT INET6_NTOA(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001')); +--enable_view_protocol SELECT INET6_NTOA(INET6_ATON('::C0A8:0102')); SELECT INET6_NTOA(INET6_ATON('::c0a8:0102')); SELECT INET6_NTOA(INET6_ATON('::192.168.1.2')); @@ -1114,12 +1125,14 @@ select release_lock('test'); --echo # --echo # MDEV-13685 Can not replay binary log due to Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat' --echo # +--disable_service_connection SET NAMES utf8; SELECT COERCIBILITY(NAME_CONST('name','test')); SELECT COERCIBILITY(NAME_CONST('name',TIME'00:00:00')); SELECT COERCIBILITY(NAME_CONST('name',15)); SELECT CONCAT(NAME_CONST('name',15),'오'); SET NAMES latin1; +--enable_service_connection --echo # --echo # MDEV-14116 INET6_NTOA output is set as null to varchar(39) variable @@ -1234,9 +1247,11 @@ SELECT RELEASE_LOCK('foo'); --enable_metadata --disable_ps_protocol +--disable_view_protocol SELECT INET_ATON("255.255.255.255.255.255.255.255"); +--enable_view_protocol --enable_ps_protocol --disable_metadata @@ -1246,7 +1261,9 @@ SELECT INET_ATON("255.255.255.255.255.255.255.255"); --enable_metadata --disable_ps_protocol +--disable_view_protocol SELECT 18446744073709551615 AS c1, name_const('a',18446744073709551615) AS c2; +--enable_view_protocol --enable_ps_protocol --disable_metadata @@ -1288,6 +1305,7 @@ DROP TABLE t1; --echo # --echo # MDEV-10569 Add RELEASE_ALL_LOCKS SQL-function --echo # +--disable_view_protocol --echo # Test function without any locks SELECT RELEASE_ALL_LOCKS(); @@ -1341,3 +1359,5 @@ FROM information_schema.metadata_lock_info WHERE thread_id>0 ORDER BY TABLE_SCHE SELECT RELEASE_ALL_LOCKS(); SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA FROM information_schema.metadata_lock_info WHERE thread_id>0 ORDER BY TABLE_SCHEMA; + +--enable_view_protocol diff --git a/mysql-test/main/func_regexp.result b/mysql-test/main/func_regexp.result index 187df785f69d6..b883c8188df11 100644 --- a/mysql-test/main/func_regexp.result +++ b/mysql-test/main/func_regexp.result @@ -10,7 +10,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `s1` varchar(64) DEFAULT NULL, `s2` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); diff --git a/mysql-test/main/func_regexp_pcre.result b/mysql-test/main/func_regexp_pcre.result index 4544a1df71cc8..9e51ced961ccf 100644 --- a/mysql-test/main/func_regexp_pcre.result +++ b/mysql-test/main/func_regexp_pcre.result @@ -436,8 +436,8 @@ CREATE TABLE t1 AS SELECT REGEXP_REPLACE('abc','b','x'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `REGEXP_REPLACE('abc','b','x')` longtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `REGEXP_REPLACE('abc','b','x')` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXPLAIN EXTENDED SELECT REGEXP_REPLACE('abc','b','x'); id select_type table type possible_keys key key_len ref rows filtered Extra @@ -452,7 +452,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `REGEXP_REPLACE('abc','b','x')+0` double NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SELECT REGEXP_REPLACE(NULL,'b','c'); REGEXP_REPLACE(NULL,'b','c') @@ -739,8 +739,8 @@ CREATE TABLE t1 AS SELECT REGEXP_SUBSTR('abc','b'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `REGEXP_SUBSTR('abc','b')` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `REGEXP_SUBSTR('abc','b')` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXPLAIN EXTENDED SELECT REGEXP_SUBSTR('abc','b'); id select_type table type possible_keys key key_len ref rows filtered Extra @@ -755,7 +755,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `REGEXP_SUBSTR('abc','b')+0` double NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SELECT REGEXP_SUBSTR('See https://mariadb.org/en/foundation/ for details', 'https?://[^/]*'); REGEXP_SUBSTR('See https://mariadb.org/en/foundation/ for details', 'https?://[^/]*') diff --git a/mysql-test/main/func_regexp_pcre.test b/mysql-test/main/func_regexp_pcre.test index 3851caf89173f..e6e356f4a8c76 100644 --- a/mysql-test/main/func_regexp_pcre.test +++ b/mysql-test/main/func_regexp_pcre.test @@ -1,4 +1,4 @@ - +--disable_service_connection SET NAMES utf8; --echo # @@ -325,11 +325,13 @@ SELECT REGEXP_INSTR('вася','в'); SELECT REGEXP_INSTR('вася','а'); SELECT REGEXP_INSTR('вася','с'); SELECT REGEXP_INSTR('вася','я'); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT REGEXP_INSTR(CONVERT('вася' USING koi8r), CONVERT('в' USING koi8r)); SELECT REGEXP_INSTR(CONVERT('вася' USING koi8r), CONVERT('а' USING koi8r)); SELECT REGEXP_INSTR(CONVERT('вася' USING koi8r), CONVERT('с' USING koi8r)); SELECT REGEXP_INSTR(CONVERT('вася' USING koi8r), CONVERT('я' USING koi8r)); - +--enable_view_protocol --echo # --echo # Checking REGEXP_SUBSTR @@ -349,9 +351,10 @@ CREATE TABLE t1 AS SELECT REGEXP_SUBSTR('abc','b')+0; SHOW CREATE TABLE t1; DROP TABLE t1; - +#enable after fix MDEV-27871 +--disable_view_protocol SELECT REGEXP_SUBSTR('See https://mariadb.org/en/foundation/ for details', 'https?://[^/]*'); - +--enable_view_protocol --echo # --echo # MDEV-6027 RLIKE: "." no longer matching new line @@ -368,6 +371,8 @@ SELECT 'a\nb' RLIKE 'a.b'; SELECT 'a\nb' RLIKE '(?-s)a.b'; SET default_regex_flags=DEFAULT; +#enable after fix MDEV-27871 +--disable_view_protocol # note that old pcre2 reports a different offset --replace_result 29 30 --error ER_REGEXP_ERROR @@ -375,6 +380,7 @@ SELECT REGEXP_SUBSTR('Monday Mon','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P= SET default_regex_flags='DUPNAMES'; SELECT REGEXP_SUBSTR('Monday Mon','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P=DN)$'); SELECT REGEXP_SUBSTR('Tuesday Tue','^((?Mon|Fri|Sun)day|(?Tue)sday).*(?P=DN)$'); +--enable_view_protocol SET default_regex_flags=DEFAULT; SELECT 'AB' RLIKE 'A B'; @@ -387,8 +393,11 @@ SET default_regex_flags=DEFAULT; --error ER_REGEXP_ERROR SELECT 'Aq' RLIKE 'A\\q'; +#double warning for view protocol +--disable_view_protocol SET default_regex_flags='EXTRA'; SELECT 'A' RLIKE 'B'; +--enable_view_protocol SET default_regex_flags=DEFAULT; @@ -407,7 +416,10 @@ SET default_regex_flags=DEFAULT; --echo # --echo # MDEV-6965 non-captured group \2 in regexp_replace --echo # +#enable after fix MDEV-27871 +--disable_view_protocol SELECT REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that'); +--enable_view_protocol --echo # --echo # MDEV-8102 REGEXP function fails to match hex values when expression is stored as a variable @@ -442,6 +454,9 @@ SELECT CAST(0xE001 AS BINARY) REGEXP @regCheck; SELECT 1 FROM dual WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral,Golf,Hotel,India,Juliet,Kilo,Lima,Mike,StrataL3,November,Oscar,StrataL2,Sand,P3,P4SwitchTest,Arsys,Poppa,ExtensionMgr,Arp,Quebec,Romeo,StrataApiV2,PtReyes,Sierra,SandAcl,Arrow,Artools,BridgeTest,Tango,SandT,PAlaska,Namespace,Agent,Qos,PatchPanel,ProjectReport,Ark,Gimp,Agent,SliceAgent,Arnet,Bgp,Ale,Tommy,Central,AsicPktTestLib,Hsc,SandL3,Abuild,Pca9555,Standby,ControllerDut,CalSys,SandLib,Sb820,PointV2,BfnLib,Evpn,BfnSdk,Sflow,ManagementActive,AutoTest,GatedTest,Bgp,Sand,xinetd,BfnAgentLib,bf-utils,Hello,BfnState,Eos,Artest,Qos,Scd,ThermoMgr,Uniform,EosUtils,Eb,FanController,Central,BfnL3,BfnL2,tcp_wrappers,Victor,Environment,Route,Failover,Whiskey,Xray,Gimp,BfnFixed,Strata,SoCal,XApi,Msrp,XpProfile,tcpdump,PatchPanel,ArosTest,FhTest,Arbus,XpAcl,MacConc,XpApi,telnet,QosTest,Alpha2,BfnVlan,Stp,VxlanControllerTest,MplsAgent,Bravo2,Lanz,BfnMbb,Intf,XCtrl,Unicast,SandTunnel,L3Unicast,Ipsec,MplsTest,Rsvp,EthIntf,StageMgr,Sol,MplsUtils,Nat,Ira,P4NamespaceDut,Counters,Charlie2,Aqlc,Mlag,Power,OpenFlow,Lag,RestApi,BfdTest,strongs,Sfa,CEosUtils,Adt746,MaintenanceMode,MlagDut,EosImage,IpEth,MultiProtocol,Launcher,Max3179,Snmp,Acl,IpEthTest,PhyEee,bf-syslibs,tacc,XpL2,p4-ar-switch,p4-bf-switch,LdpTest,BfnPhy,Mirroring,Phy6,Ptp' REGEXP '^((?!\b(Strata|StrataApi|StrataApiV2)\b).)*$'); --enable_result_log --enable_warnings +#enable after fix MDEV-27871 +--disable_view_protocol +--enable_view_protocol # # MDEV-12942 REGEXP_INSTR returns 1 when using brackets @@ -454,3 +469,4 @@ SELECT REGEXP_INSTR('a_kollision', 'o([lm])\\1'); # MDEV-12939 A query crashes MariaDB in Item_func_regex::cleanup # SELECT a FROM (SELECT "aa" a) t WHERE a REGEXP '[0-9]'; +--enable_service_connection diff --git a/mysql-test/main/func_rollback.test b/mysql-test/main/func_rollback.test index 87930909f91b8..e8af4ef2eff56 100644 --- a/mysql-test/main/func_rollback.test +++ b/mysql-test/main/func_rollback.test @@ -38,6 +38,7 @@ # Created: # 2008-04-09 mleich # +-- source include/no_view_protocol.inc let $fixed_bug_35877 = 0; diff --git a/mysql-test/main/func_sapdb.test b/mysql-test/main/func_sapdb.test index 51bdebbec6d2e..7ded1cece7377 100644 --- a/mysql-test/main/func_sapdb.test +++ b/mysql-test/main/func_sapdb.test @@ -13,6 +13,8 @@ select extract(SECOND_MICROSECOND FROM "1999-01-02 10:11:12.000123"); select extract(MICROSECOND FROM "1999-01-02 10:11:12.000123"); select date_format("1997-12-31 23:59:59.000002", "%f"); +#enable after fix MDEV-27871 +--disable_view_protocol select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND); select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND); select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND); @@ -24,6 +26,7 @@ select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROS select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND); select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND); select date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND); +--enable_view_protocol #Date functions select adddate("1997-12-31 23:59:59.000001", 10); @@ -53,16 +56,22 @@ select makedate(100,1); select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002"); select subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002"); +#enable after fix MDEV-27871 +--disable_view_protocol select addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999"); select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999"); +--enable_view_protocol select subtime("01:00:00.999999", "02:00:00.999998"); select subtime("02:01:01.999999", "01:01:01.999999"); # PS doesn't support fractional seconds --disable_ps_protocol +#enable after fix MDEV-27871 +--disable_view_protocol select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002"); select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002"); select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002"); +--enable_view_protocol select timediff("1997-12-31 23:59:59.000001","23:59:59.000001"); select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001"); select timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50"); @@ -143,9 +152,12 @@ select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f"); # # calculations involving negative time values ignored sign +#enable after fix MDEV-27871 +--disable_view_protocol select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00'); select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00'); select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10') {}]', 10, '{}'), ('[{:20} <- {}]', 1, '{:30}'); +select sformat(a,b,c) from t1; +sformat(a,b,c) +[10 -> {}] +[ 1 <- {:30}] +drop table t1; diff --git a/mysql-test/main/func_sformat.test b/mysql-test/main/func_sformat.test index 7c850fc264452..65e4b639179b9 100644 --- a/mysql-test/main/func_sformat.test +++ b/mysql-test/main/func_sformat.test @@ -14,11 +14,14 @@ select sformat(0); select sformat('C'); select sformat(-4.2); select sformat(5, 5, 5); +#enable after fix MDEV-27871 +--disable_view_protocol select sformat('{} {}', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +--enable_view_protocol select sformat('{{{}}}', 0); select sformat('{{{}{{', 0); select sformat('{{{{{}{{', 'param1'); @@ -26,13 +29,18 @@ select sformat(' {{ {{ {} {{ ', 'param1'); select sformat(' {{ {} {}', 'param1', 'param2'); select sformat('A{}C{}E{}', 'B', 'D', 'F'); select sformat('{} {}', FALSE, TRUE); +#enable after fix MDEV-29601 +--disable_service_connection select sformat('Add € != {} != {}?', '$', '£'); select sformat('Check {} != {} != {}?', '€', '$', '£'); +--enable_service_connection select sformat('{}{}{}', 1, 2, 3); select sformat('Float {} Boolean {} Number {}', 3.14159, True, -50); select sformat('SUM {} + {} = {}', 2, 3, 2+3); select sformat('Numbers {} {} {}', 1, 1.11, 1.111); select sformat('what {} is {}?', 'time', 'it'); +#enable after fix MDEV-27871 +--disable_view_protocol select sformat('{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} @@ -54,6 +62,7 @@ select sformat('{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} { '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100', '101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114', '115', '116', '117', '118', '119', '120'); +--enable_view_protocol echo #; echo # Error Test Cases; @@ -83,7 +92,10 @@ insert into t2 values (0.0025, 25, 'A', DATE('2020-06-29')), (0.0005, 5, 'B', DATE('2020-6-29')), (5.5555, -5, 'C', DATE('200629')), (-9, -9, 'D', DATE('20*06*29')); +#enable after fix MDEV-27871 +--disable_view_protocol select sformat('p1 {:.4f} p2 {} p3 {} p4 {}', param1, param2, param3, param4) from t2; +--enable_view_protocol drop table t2; set names utf8; @@ -115,7 +127,10 @@ echo #; echo # Format Test Cases; echo #; select sformat('Num {:L}', 13800000000); +#enable after fix MDEV-29646 +--disable_view_protocol select sformat('Num [{:20}]', 42); +--enable_view_protocol select sformat('Number: {:*^{}}', 4, 5); select sformat('{:02} - {:02} - {:02}', 1, 2, 3); select sformat('Character {:c}', 104); @@ -126,7 +141,10 @@ select sformat('Float {:.2f}', 42.0); select sformat('Float {:f}', 42.0); select sformat('Number {:d}', 42); select sformat('Number {:{}}', 5, 5); +#enable after fix MDEV-29646 +--disable_view_protocol select sformat('Number [{:10}]', 9999); +--enable_view_protocol select sformat('Number {:.3}', 3.1416); select sformat('int: {0:d}; hex: {0:x}; oct: {0:o}', 42); select sformat('int: {0:d}; hex: {0:#x}; oct: {0:#o}', 42); @@ -137,10 +155,16 @@ select sformat('The binary version of {0} is {0:b}', 5); select sformat('{:+f}; {:+f}', 3.14, -3.14); select sformat('{: f}; {: f}', 3.14, -3.14); select sformat('{:-f}; {:-f}', 3.14, -3.14); +#enable after fix MDEV-27871 +--disable_view_protocol select sformat('The temperature is between {: } and {: } degrees celsius.', -3, 7); select sformat('The temperature is between {:-} and {:-} degrees celsius.', -3, 7); select sformat('The temperature is between {:+} and {:+} degrees celsius.', -3, 7); +--enable_view_protocol +#check after fix MDEV-29646 +--disable_view_protocol select sformat('We have {:<8} chickens.', 49); +--enable_view_protocol select sformat('Center alimgn [{:*^10}]', 'data'); select sformat('Center aling [{:^10}].', 'data'); select sformat('Right aling [{:>10}].', 'data'); @@ -195,7 +219,10 @@ echo #; select sformat('={}=', _ucs2 x'006100620063'); set names utf8; select sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442'); +#enable after fix MDEV-27871 +--disable_view_protocol select hex(sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442')); +--enable_view_protocol create table t1 as select sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442') as x; show create table t1; drop table t1; @@ -226,3 +253,24 @@ set names latin1; echo #; echo # End of 10.7 tests; echo #; + +echo #; +echo # Start of 10.8 tests; +echo #; + +echo #; +echo # MDEV-29646 sformat('Num [{:20}]', 42) gives incorrect result in view; +echo #; + +create view v1 as select sformat('Num [{:20}]', 42); +select * from v1; +drop view v1; + +create view v1 as SELECT sformat('Square root of [{:d}] is [{:.20}]', 2, sqrt(2)); +select * from v1; +drop view v1; + +create table t1 (a text, b int, c text); +insert t1 values ('[{} -> {}]', 10, '{}'), ('[{:20} <- {}]', 1, '{:30}'); +select sformat(a,b,c) from t1; +drop table t1; diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index ce54d3e85a106..58914338aa691 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -377,7 +377,7 @@ select position("0" in "baaa" in (1)),position("0" in "1" in (1,2,3)),position(" position("0" in "baaa" in (1)) position("0" in "1" in (1,2,3)) position("sql" in ("mysql")) 1 0 3 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'baaa' +Warning 1292 Truncated incorrect DECIMAL value: 'baaa' select position(("1" in (1,2,3)) in "01"); position(("1" in (1,2,3)) in "01") 2 @@ -751,34 +751,34 @@ t1 CREATE TABLE `t1` ( `hex(130)` varchar(6) DEFAULT NULL, `char(130)` varbinary(4) DEFAULT NULL, `format(130,10)` varchar(25) DEFAULT NULL, - `left(_latin2'a',1)` varchar(1) CHARACTER SET latin2 DEFAULT NULL, - `right(_latin2'a',1)` varchar(1) CHARACTER SET latin2 DEFAULT NULL, - `lcase(_latin2'a')` varchar(1) CHARACTER SET latin2 DEFAULT NULL, - `ucase(_latin2'a')` varchar(1) CHARACTER SET latin2 DEFAULT NULL, - `substring(_latin2'a',1,1)` varchar(1) CHARACTER SET latin2 DEFAULT NULL, - `concat(_latin2'a',_latin2'b')` varchar(2) CHARACTER SET latin2 DEFAULT NULL, - `lpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 DEFAULT NULL, - `rpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 DEFAULT NULL, - `lpad(_latin2'a',4)` varchar(4) CHARACTER SET latin2 DEFAULT NULL, - `rpad(_latin2'a',4)` varchar(4) CHARACTER SET latin2 DEFAULT NULL, - `concat_ws(_latin2'a',_latin2'b')` varchar(1) CHARACTER SET latin2 DEFAULT NULL, - `make_set(255,_latin2'a',_latin2'b',_latin2'c')` varchar(5) CHARACTER SET latin2 DEFAULT NULL, - `export_set(255,_latin2'y',_latin2'n',_latin2' ')` varchar(127) CHARACTER SET latin2 DEFAULT NULL, - `trim(_latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL, - `ltrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL, - `rtrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL, - `trim(LEADING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL, - `trim(TRAILING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL, - `trim(BOTH _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL, - `repeat(_latin2'a',10)` varchar(10) CHARACTER SET latin2 DEFAULT NULL, - `reverse(_latin2'ab')` varchar(2) CHARACTER SET latin2 DEFAULT NULL, - `quote(_latin2'ab')` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `soundex(_latin2'ab')` varchar(4) CHARACTER SET latin2 DEFAULT NULL, - `substring(_latin2'ab',1)` varchar(2) CHARACTER SET latin2 DEFAULT NULL, - `insert(_latin2'abcd',2,3,_latin2'ef')` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `replace(_latin2'abcd',_latin2'b',_latin2'B')` varchar(4) CHARACTER SET latin2 DEFAULT NULL, + `left(_latin2'a',1)` varchar(1) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `right(_latin2'a',1)` varchar(1) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `lcase(_latin2'a')` varchar(1) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `ucase(_latin2'a')` varchar(1) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `substring(_latin2'a',1,1)` varchar(1) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `concat(_latin2'a',_latin2'b')` varchar(2) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `lpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `rpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `lpad(_latin2'a',4)` varchar(4) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `rpad(_latin2'a',4)` varchar(4) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `concat_ws(_latin2'a',_latin2'b')` varchar(1) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `make_set(255,_latin2'a',_latin2'b',_latin2'c')` varchar(5) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `export_set(255,_latin2'y',_latin2'n',_latin2' ')` varchar(127) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `trim(_latin2' a ')` varchar(3) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `ltrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `rtrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `trim(LEADING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `trim(TRAILING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `trim(BOTH _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `repeat(_latin2'a',10)` varchar(10) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `reverse(_latin2'ab')` varchar(2) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `quote(_latin2'ab')` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `soundex(_latin2'ab')` varchar(4) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `substring(_latin2'ab',1)` varchar(2) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `insert(_latin2'abcd',2,3,_latin2'ef')` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `replace(_latin2'abcd',_latin2'b',_latin2'B')` varchar(4) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, `encode('abcd','ab')` varbinary(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a char character set latin2); insert into t1 values (null); @@ -1189,12 +1189,12 @@ SELECT * FROM t1, t2 WHERE num=str; str num notnumber 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'notnumber' +Warning 1292 Truncated incorrect DECIMAL value: 'notnumber' SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6); str num notnumber 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'notnum' +Warning 1292 Truncated incorrect DECIMAL value: 'notnum' DROP TABLE t1,t2; CREATE TABLE t1( id int(11) NOT NULL auto_increment, @@ -3048,7 +3048,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `format(123,2,'no_NO')` varchar(17) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; format(123,2,'no_NO') 123,00 @@ -3211,7 +3211,7 @@ t1 CREATE TABLE `t1` ( `RPAD('a',10,'')` varchar(10) DEFAULT NULL, `LPAD('a',10,RAND())` varchar(10) DEFAULT NULL, `RPAD('a',10,RAND())` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET SESSION SQL_MODE= ''; CREATE TABLE t1 AS SELECT @@ -3238,7 +3238,7 @@ t1 CREATE TABLE `t1` ( `RPAD('a',10,'')` varchar(10) DEFAULT NULL, `LPAD('a',10,RAND())` varchar(10) DEFAULT NULL, `RPAD('a',10,RAND())` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET SESSION SQL_MODE=DEFAULT; # @@ -3255,7 +3255,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(85) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh @@ -3265,7 +3265,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(66) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 63 @@ -3277,7 +3277,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(85) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh @@ -3287,7 +3287,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(66) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 62 @@ -3299,7 +3299,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(85) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh @@ -3309,7 +3309,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(66) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 61 @@ -3321,7 +3321,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(81) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh @@ -3331,7 +3331,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(63) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 60 @@ -3343,7 +3343,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(81) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh @@ -3353,7 +3353,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(63) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 59 @@ -3365,7 +3365,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(81) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh @@ -3375,7 +3375,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(63) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 58 @@ -3387,7 +3387,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(76) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 76 @@ -3396,7 +3396,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(57) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 57 @@ -3408,7 +3408,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(76) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 76 @@ -3417,7 +3417,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(57) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 56 @@ -3429,7 +3429,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(76) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 76 @@ -3438,7 +3438,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(57) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 55 @@ -3450,7 +3450,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(72) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 72 @@ -3459,7 +3459,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(54) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 54 @@ -3471,7 +3471,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(72) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 72 @@ -3480,7 +3480,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(54) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 53 @@ -3492,7 +3492,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(72) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 72 @@ -3501,7 +3501,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(54) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 52 @@ -3513,7 +3513,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(68) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 68 @@ -3522,7 +3522,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(51) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 51 @@ -3534,7 +3534,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(68) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 68 @@ -3543,7 +3543,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(51) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 50 @@ -3555,7 +3555,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(68) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 68 @@ -3564,7 +3564,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(51) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 49 @@ -3576,7 +3576,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 64 @@ -3585,7 +3585,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(48) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 48 @@ -3597,7 +3597,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 64 @@ -3606,7 +3606,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(48) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 47 @@ -3618,7 +3618,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 64 @@ -3627,7 +3627,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(48) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 46 @@ -3639,7 +3639,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(60) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 60 @@ -3648,7 +3648,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(45) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 45 @@ -3660,7 +3660,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(60) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 60 @@ -3669,7 +3669,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(45) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 44 @@ -3681,7 +3681,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(60) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 60 @@ -3690,7 +3690,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(45) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 43 @@ -3702,7 +3702,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(56) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 56 @@ -3711,7 +3711,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(42) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 42 @@ -3723,7 +3723,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(56) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 56 @@ -3732,7 +3732,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(42) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 41 @@ -3744,7 +3744,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(56) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 56 @@ -3753,7 +3753,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(42) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 40 @@ -3765,7 +3765,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(52) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 52 @@ -3774,7 +3774,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(39) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 39 @@ -3786,7 +3786,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(52) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 52 @@ -3795,7 +3795,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(39) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 38 @@ -3807,7 +3807,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(52) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 52 @@ -3816,7 +3816,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(39) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 37 @@ -3828,7 +3828,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(48) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 48 @@ -3837,7 +3837,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(36) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 36 @@ -3849,7 +3849,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(48) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 48 @@ -3858,7 +3858,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(36) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 35 @@ -3870,7 +3870,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(48) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 48 @@ -3879,7 +3879,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(36) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 34 @@ -3891,7 +3891,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(44) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 44 @@ -3900,7 +3900,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(33) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 33 @@ -3912,7 +3912,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(44) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 44 @@ -3921,7 +3921,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(33) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 32 @@ -3933,7 +3933,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(44) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 44 @@ -3942,7 +3942,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(33) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 31 @@ -3954,7 +3954,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(40) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 40 @@ -3963,7 +3963,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 30 @@ -3975,7 +3975,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(40) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 40 @@ -3984,7 +3984,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaaa 29 @@ -3996,7 +3996,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(40) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 40 @@ -4005,7 +4005,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaaa 28 @@ -4017,7 +4017,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(36) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 36 @@ -4026,7 +4026,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(27) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaaa 27 @@ -4038,7 +4038,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(36) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 36 @@ -4047,7 +4047,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(27) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaaa 26 @@ -4059,7 +4059,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(36) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 36 @@ -4068,7 +4068,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(27) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaaa 25 @@ -4080,7 +4080,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(32) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 32 @@ -4089,7 +4089,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(24) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaaa 24 @@ -4101,7 +4101,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(32) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 32 @@ -4110,7 +4110,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(24) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaaa 23 @@ -4122,7 +4122,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(32) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 32 @@ -4131,7 +4131,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(24) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaaa 22 @@ -4143,7 +4143,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(28) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWFh 28 @@ -4152,7 +4152,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaaa 21 @@ -4164,7 +4164,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(28) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYWE= 28 @@ -4173,7 +4173,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaaa 20 @@ -4185,7 +4185,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(28) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFhYQ== 28 @@ -4194,7 +4194,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaaa 19 @@ -4206,7 +4206,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(24) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWFh 24 @@ -4215,7 +4215,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(18) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaaa 18 @@ -4227,7 +4227,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(24) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYWE= 24 @@ -4236,7 +4236,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(18) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaaa 17 @@ -4248,7 +4248,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(24) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFhYQ== 24 @@ -4257,7 +4257,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(18) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaaa 16 @@ -4269,7 +4269,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWFh 20 @@ -4278,7 +4278,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(15) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaaa 15 @@ -4290,7 +4290,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYWE= 20 @@ -4299,7 +4299,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(15) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaaa 14 @@ -4311,7 +4311,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFhYQ== 20 @@ -4320,7 +4320,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(15) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaaa 13 @@ -4332,7 +4332,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(16) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWFh 16 @@ -4341,7 +4341,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaaa 12 @@ -4353,7 +4353,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(16) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYWE= 16 @@ -4362,7 +4362,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaaa 11 @@ -4374,7 +4374,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(16) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFhYQ== 16 @@ -4383,7 +4383,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaaa 10 @@ -4395,7 +4395,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWFh 12 @@ -4404,7 +4404,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaaa 9 @@ -4416,7 +4416,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYWE= 12 @@ -4425,7 +4425,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaaa 8 @@ -4437,7 +4437,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFhYQ== 12 @@ -4446,7 +4446,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaaa 7 @@ -4458,7 +4458,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWFh 8 @@ -4467,7 +4467,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaaa 6 @@ -4479,7 +4479,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYWE= 8 @@ -4488,7 +4488,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaaa 5 @@ -4500,7 +4500,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFhYQ== 8 @@ -4509,7 +4509,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaaa 4 @@ -4521,7 +4521,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWFh 4 @@ -4530,7 +4530,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aaa 3 @@ -4542,7 +4542,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YWE= 4 @@ -4551,7 +4551,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) aa 2 @@ -4563,7 +4563,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` varchar(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) YQ== 4 @@ -4572,7 +4572,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` varbinary(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) a 1 @@ -4584,7 +4584,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `to_base64` char(0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) 0 @@ -4593,7 +4593,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `from_base64` binary(0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT from_base64, LENGTH(from_base64) FROM t2; from_base64 LENGTH(from_base64) 0 @@ -5028,6 +5028,59 @@ SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux'); NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux') NULL # +# Bug#31374305 - FORMAT() NOT DISPLAYING WHOLE NUMBER SIDE CORRECTLY +# FOR ES_MX AND ES_ES LOCALES +# +CREATE PROCEDURE load_locale_format_table() +BEGIN +DECLARE locale_list VARCHAR(1000) DEFAULT ' + es_AR,es_BO,es_CL,es_CO,es_CR,es_DO,es_EC,es_ES,es_GT,es_HN, + es_MX,es_NI,es_PA,es_PE,es_PR,es_PY,es_SV,es_US,es_UY,es_VE'; +SET @fmt_stmt = 'INSERT INTO locale_format VALUES + (?, FORMAT(12131254123412541,2,?));'; +PREPARE stmt FROM @fmt_stmt; +WHILE locale_list != '' DO +/* get the first locale from the list */ +SET @locale = +TRIM(REPLACE((SUBSTRING_INDEX(locale_list, ',', 1)), '\n','')); +EXECUTE stmt USING @locale, @locale; +/* remove the first locale from the list */ +IF LOCATE(',', locale_list) > 0 THEN +SET locale_list = +SUBSTRING(locale_list, LOCATE(',', locale_list) + 1); +ELSE +SET locale_list = ''; +END IF; +END WHILE; +DEALLOCATE PREPARE stmt; +END| +CREATE TABLE locale_format(locale VARCHAR(10), formatted_string VARCHAR(100)); +CALL load_locale_format_table(); +SELECT * FROM locale_format; +locale formatted_string +es_AR 12.131.254.123.412.541,00 +es_BO 12.131.254.123.412.541,00 +es_CL 12.131.254.123.412.541,00 +es_CO 12.131.254.123.412.541,00 +es_CR 12 131 254 123 412 541,00 +es_DO 12,131,254,123,412,541.00 +es_EC 12.131.254.123.412.541,00 +es_ES 12.131.254.123.412.541,00 +es_GT 12,131,254,123,412,541.00 +es_HN 12,131,254,123,412,541.00 +es_MX 12,131,254,123,412,541.00 +es_NI 12,131,254,123,412,541.00 +es_PA 12,131,254,123,412,541.00 +es_PE 12,131,254,123,412,541.00 +es_PR 12,131,254,123,412,541.00 +es_PY 12.131.254.123.412.541,00 +es_SV 12,131,254,123,412,541.00 +es_US 12,131,254,123,412,541.00 +es_UY 12.131.254.123.412.541,00 +es_VE 12.131.254.123.412.541,00 +DROP PROCEDURE load_locale_format_table; +DROP TABLE locale_format; +# # End of 10.2 tests # # @@ -5098,10 +5151,10 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `cn` char(0) CHARACTER SET utf8mb3 DEFAULT NULL, - `c0` char(0) CHARACTER SET utf8mb3 DEFAULT NULL, - `c1` char(0) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `cn` char(0) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c0` char(0) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c1` char(0) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; # # MDEV-20303 SPACE(-1) returns a wrong data type @@ -5116,10 +5169,10 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `cn` char(0) CHARACTER SET utf8mb3 DEFAULT NULL, - `c0` char(0) CHARACTER SET utf8mb3 DEFAULT NULL, - `c1` char(0) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `cn` char(0) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c0` char(0) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c1` char(0) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; CREATE TABLE t1 (i BIGINT); INSERT INTO t1 VALUES (42); @@ -5131,10 +5184,10 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `cn` char(0) CHARACTER SET utf8mb3 DEFAULT NULL, - `c0` char(0) CHARACTER SET utf8mb3 DEFAULT NULL, - `c1` char(0) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `cn` char(0) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c0` char(0) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c1` char(0) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; CREATE TABLE t1 (i BIGINT); INSERT INTO t1 VALUES (42); @@ -5146,10 +5199,10 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `cn` char(0) CHARACTER SET utf8mb3 DEFAULT NULL, - `c0` char(0) CHARACTER SET utf8mb3 DEFAULT NULL, - `c1` char(0) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `cn` char(0) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c0` char(0) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c1` char(0) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; CREATE TABLE t1 (i BIGINT); INSERT INTO t1 VALUES (42); @@ -5161,10 +5214,10 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `cn` char(0) CHARACTER SET utf8mb3 DEFAULT NULL, - `c0` char(0) CHARACTER SET utf8mb3 DEFAULT NULL, - `c1` varchar(20) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `cn` char(0) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c0` char(0) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c1` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT c1 FROM t2; c1 42 @@ -5189,6 +5242,15 @@ DROP TABLE t1; # Start of 10.4 tests # # +# MDEV-30351 crash in Item_func_left::val_str +# +SELECT WEIGHT_STRING('aa') IN (LEFT(WEIGHT_STRING('aaa'),4),'bbb') as expect_1; +expect_1 +1 +SELECT UNHEX('0032') in (LEFT(UNHEX('003200'), 2),'dog') as expect_1; +expect_1 +1 +# # MDEV-21841 CONV() function truncates the result type to 21 symbol. # CREATE TABLE t1(i BIGINT); @@ -5200,8 +5262,8 @@ conv(i,16,2) SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `conv(i,16,2)` varchar(64) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `conv(i,16,2)` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; # # MDEV-18205 Assertion `str_length < len' failed in Binary_string::realloc_raw diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test index 432bc64f76904..e3a9855896734 100644 --- a/mysql-test/main/func_str.test +++ b/mysql-test/main/func_str.test @@ -32,10 +32,13 @@ select position(binary 'll' in 'hello'),position('a' in binary 'hello'); # select left('hello',null), right('hello',null); select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ; +#enable after fix MDEV-27871 +--disable_view_protocol select concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) ; select substring_index('www.tcx.se','.',-2),substring_index('www.tcx.se','.',1); select substring_index('www.tcx.se','tcx',1),substring_index('www.tcx.se','tcx',-1); select substring_index('.tcx.se','.',-2),substring_index('.tcx.se','.tcx',-1); +--enable_view_protocol select substring_index('aaaaaaaaa1','a',1); select substring_index('aaaaaaaaa1','aa',1); select substring_index('aaaaaaaaa1','aa',2); @@ -50,11 +53,14 @@ select substring_index('aaaaaaaaa1','aaaa',1); select substring_index('aaaaaaaaa1','aaaa',2); select substring_index('aaaaaaaaa1','1',1); select substring_index('aaaaaaaaa1','a',-1); +#enable after fix MDEV-29601 +--disable_service_connection select substring_index('aaaaaaaaa1','aa',-1); select substring_index('aaaaaaaaa1','aa',-2); select substring_index('aaaaaaaaa1','aa',-3); select substring_index('aaaaaaaaa1','aa',-4); select substring_index('aaaaaaaaa1','aa',-5); +--enable_service_connection select substring_index('aaaaaaaaa1','aaa',-1); select substring_index('aaaaaaaaa1','aaa',-2); select substring_index('aaaaaaaaa1','aaa',-3); @@ -77,16 +83,21 @@ select substring_index('the king of the the hill','the',2); select substring_index('the king of the the hill','the',3); select concat(':',ltrim(' left '),':',rtrim(' right '),':'); +#enable after fix MDEV-27871 +--disable_view_protocol select concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':'); select concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':'); select concat(':',trim(' m '),':',trim(BOTH FROM ' y '),':',trim('*' FROM '*s*'),':'); select concat(':',trim(BOTH 'ab' FROM 'ababmyabab'),':',trim(BOTH '*' FROM '***sql'),':'); select concat(':',trim(LEADING '.*' FROM '.*my'),':',trim(TRAILING '.*' FROM 'sql.*.*'),':'); select TRIM("foo" FROM "foo"), TRIM("foo" FROM "foook"), TRIM("foo" FROM "okfoo"); +--enable_view_protocol select concat_ws(', ','monty','was here','again'); select concat_ws(NULL,'a'),concat_ws(',',NULL,''); select concat_ws(',','',NULL,'a'); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"'); select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es'); @@ -96,6 +107,7 @@ select replace('aaaa','a','bbbb'); --disable_metadata select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') ; select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb'); +--enable_view_protocol select 'mood' sounds like 'mud'; select 'Glazgo' sounds like 'Liverpool'; select null sounds like 'null'; @@ -128,15 +140,21 @@ select rpad('abcd',7),lpad('abcd',7); select LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'),GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'); select least(1,2,3) | greatest(16,32,8), least(5,4)*1,greatest(-1.0,1.0)*1,least(3,2,1)*1.0,greatest(1,1.1,1.0),least("10",9),greatest("A","B","0"); +#enable after fix MDEV-27871 +--disable_view_protocol select decode(encode(repeat("a",100000),"monty"),"monty")=repeat("a",100000); +--enable_view_protocol select decode(encode("abcdef","monty"),"monty")="abcdef"; select quote('\'\"\\test'); select quote(concat('abc\'', '\\cba')); select quote(1/0), quote('\0\Z'); select length(quote(concat(char(0),"test"))); +#enable after fix MDEV-27871 +--disable_view_protocol select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235)))); select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), unhex(NULL); +--enable_view_protocol select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")), hex(unhex("12345")), hex(unhex("123456")); select length(unhex(md5("abrakadabra"))); @@ -144,7 +162,10 @@ select length(unhex(md5("abrakadabra"))); # Bug #6564: QUOTE(NULL # +#enable after fix MDEV-28651 +--disable_view_protocol select concat('a', quote(NULL)); +--enable_view_protocol # # Wrong usage of functions @@ -161,7 +182,10 @@ select length(repeat("a",100000000)),length(repeat("a",1000*64)); select position("0" in "baaa" in (1)),position("0" in "1" in (1,2,3)),position("sql" in ("mysql")); select position(("1" in (1,2,3)) in "01"); select length(repeat("a",65500)),length(concat(repeat("a",32000),repeat("a",32000))),length(replace("aaaaa","a",concat(repeat("a",10000)))),length(insert(repeat("a",40000),1,30000,repeat("b",50000))); +#enable after fix MDEV-28535 +--disable_view_protocol select length(repeat("a",1000000)),length(concat(repeat("a",32000),repeat("a",32000),repeat("a",32000))),length(replace("aaaaa","a",concat(repeat("a",32000)))),length(insert(repeat("a",48000),1,1000,repeat("a",48000))); +--enable_view_protocol # # Problem med concat @@ -190,11 +214,14 @@ CREATE TABLE t1 ( submitter int(10) unsigned default NULL ) ENGINE=MyISAM; +#enable after fix MDEV-27871 +--disable_view_protocol INSERT INTO t1 VALUES (1,'Link',1,1,1,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa','2001-02-28 08:40:16',20010228084016,0,4); SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter), '"') FROM t1; SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"') FROM t1; SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter) FROM t1; SELECT bugdesc, REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') from t1 group by bugdesc; +--enable_view_protocol drop table t1; # @@ -297,10 +324,13 @@ select FIELD('b','A','B'); select FIELD('B','A','B'); select FIELD('b' COLLATE latin1_bin,'A','B'); select FIELD('b','A' COLLATE latin1_bin,'B'); +#enable after fix MDEV-29601 +--disable_service_connection --error 1270 select FIELD(_latin2'b','A','B'); --error 1270 select FIELD('b',_latin2'A','B'); +--enable_service_connection select FIELD('1',_latin2'3','2',1); select POSITION(_latin1'B' IN _latin1'abcd'); @@ -736,8 +766,10 @@ select hex(29223372036854775809), hex(-29223372036854775809); create table t1 (i int); insert into t1 values (1000000000),(1); --enable_metadata +--disable_view_protocol select lpad(i, 7, ' ') as t from t1; select rpad(i, 7, ' ') as t from t1; +--enable_view_protocol --disable_metadata drop table t1; @@ -887,18 +919,23 @@ select format(NULL, NULL); select format(pi(), NULL); select format(NULL, 2); +#enable after fix MDEV-28585 +--disable_view_protocol select benchmark(NULL, NULL); select benchmark(0, NULL); select benchmark(100, NULL); select benchmark(NULL, 1+1); +--enable_view_protocol # # Bug #20752: BENCHMARK with many iterations returns too quickly # # not a string, but belongs with the above Bug#22684 +#enable after fix MDEV-28585 +--disable_view_protocol select benchmark(-1, 1); - +--enable_view_protocol # # Please note: # 1) The collation of the password is irrelevant, the encryption uses @@ -964,33 +1001,57 @@ select left('hello', 10); select left('hello', 0); select left('hello', -1); select left('hello', -4294967295); +#enable after fix MDEV-29552 +--disable_view_protocol select left('hello', 4294967295); +--enable_view_protocol select left('hello', -4294967296); +#enable after fix MDEV-29552 +--disable_view_protocol select left('hello', 4294967296); +--enable_view_protocol select left('hello', -4294967297); +#enable after fix MDEV-29552 +--disable_view_protocol select left('hello', 4294967297); +--enable_view_protocol +#view protocol generates additional warning +--disable_view_protocol select left('hello', -18446744073709551615); select left('hello', 18446744073709551615); select left('hello', -18446744073709551616); select left('hello', 18446744073709551616); select left('hello', -18446744073709551617); select left('hello', 18446744073709551617); +--enable_view_protocol select right('hello', 10); select right('hello', 0); select right('hello', -1); select right('hello', -4294967295); +#enable after fix MDEV-29552 +--disable_view_protocol select right('hello', 4294967295); +--enable_view_protocol select right('hello', -4294967296); +#enable after fix MDEV-29552 +--disable_view_protocol select right('hello', 4294967296); +--enable_view_protocol select right('hello', -4294967297); +#enable after fix MDEV-29552 +--disable_view_protocol select right('hello', 4294967297); +--enable_view_protocol +#view protocol generates additional warning +--disable_view_protocol select right('hello', -18446744073709551615); select right('hello', 18446744073709551615); select right('hello', -18446744073709551616); select right('hello', 18446744073709551616); select right('hello', -18446744073709551617); select right('hello', 18446744073709551617); +--enable_view_protocol select substring('hello', 2, -1); @@ -1002,12 +1063,17 @@ select substring('hello', -4294967296, 1); select substring('hello', 4294967296, 1); select substring('hello', -4294967297, 1); select substring('hello', 4294967297, 1); +#view protocol generates additional warning +--disable_view_protocol select substring('hello', -18446744073709551615, 1); select substring('hello', 18446744073709551615, 1); select substring('hello', -18446744073709551616, 1); select substring('hello', 18446744073709551616, 1); select substring('hello', -18446744073709551617, 1); select substring('hello', 18446744073709551617, 1); +--enable_view_protocol +#enable after fix MDEV-28652 +--disable_view_protocol select substring('hello', 1, -1); select substring('hello', 1, -4294967295); select substring('hello', 1, 4294967295); @@ -1015,12 +1081,16 @@ select substring('hello', 1, -4294967296); select substring('hello', 1, 4294967296); select substring('hello', 1, -4294967297); select substring('hello', 1, 4294967297); +--enable_view_protocol +#view protocol generates additional warning +--disable_view_protocol select substring('hello', 1, -18446744073709551615); select substring('hello', 1, 18446744073709551615); select substring('hello', 1, -18446744073709551616); select substring('hello', 1, 18446744073709551616); select substring('hello', 1, -18446744073709551617); select substring('hello', 1, 18446744073709551617); +--enable_view_protocol select substring('hello', -1, -1); select substring('hello', -4294967295, -4294967295); select substring('hello', 4294967295, 4294967295); @@ -1028,12 +1098,15 @@ select substring('hello', -4294967296, -4294967296); select substring('hello', 4294967296, 4294967296); select substring('hello', -4294967297, -4294967297); select substring('hello', 4294967297, 4294967297); +#view protocol generates additional warning +--disable_view_protocol select substring('hello', -18446744073709551615, -18446744073709551615); select substring('hello', 18446744073709551615, 18446744073709551615); select substring('hello', -18446744073709551616, -18446744073709551616); select substring('hello', 18446744073709551616, 18446744073709551616); select substring('hello', -18446744073709551617, -18446744073709551617); select substring('hello', 18446744073709551617, 18446744073709551617); +--enable_view_protocol select insert('hello', -1, 1, 'hi'); select insert('hello', -4294967295, 1, 'hi'); @@ -1068,12 +1141,15 @@ select insert('hello', -4294967296, -4294967296, 'hi'); select insert('hello', 4294967296, 4294967296, 'hi'); select insert('hello', -4294967297, -4294967297, 'hi'); select insert('hello', 4294967297, 4294967297, 'hi'); +#enable after fix MDEV-27871 +--disable_view_protocol select insert('hello', -18446744073709551615, -18446744073709551615, 'hi'); select insert('hello', 18446744073709551615, 18446744073709551615, 'hi'); select insert('hello', -18446744073709551616, -18446744073709551616, 'hi'); select insert('hello', 18446744073709551616, 18446744073709551616, 'hi'); select insert('hello', -18446744073709551617, -18446744073709551617, 'hi'); select insert('hello', 18446744073709551617, 18446744073709551617, 'hi'); +--enable_view_protocol select repeat('hello', -1); select repeat('hello', -4294967295); @@ -1082,12 +1158,15 @@ select repeat('hello', -4294967296); select repeat('hello', 4294967296); select repeat('hello', -4294967297); select repeat('hello', 4294967297); +#view protocol generates additional warning +--disable_view_protocol select repeat('hello', -18446744073709551615); select repeat('hello', 18446744073709551615); select repeat('hello', -18446744073709551616); select repeat('hello', 18446744073709551616); select repeat('hello', -18446744073709551617); select repeat('hello', 18446744073709551617); +--enable_view_protocol select space(-1); select space(-4294967295); @@ -1096,12 +1175,15 @@ select space(-4294967296); select space(4294967296); select space(-4294967297); select space(4294967297); +#view protocol generates additional warning +--disable_view_protocol select space(-18446744073709551615); select space(18446744073709551615); select space(-18446744073709551616); select space(18446744073709551616); select space(-18446744073709551617); select space(18446744073709551617); +--enable_view_protocol select rpad('hello', -1, '1'); select rpad('hello', -4294967295, '1'); @@ -1110,12 +1192,15 @@ select rpad('hello', -4294967296, '1'); select rpad('hello', 4294967296, '1'); select rpad('hello', -4294967297, '1'); select rpad('hello', 4294967297, '1'); +#view protocol generates additional warning +--disable_view_protocol select rpad('hello', -18446744073709551615, '1'); select rpad('hello', 18446744073709551615, '1'); select rpad('hello', -18446744073709551616, '1'); select rpad('hello', 18446744073709551616, '1'); select rpad('hello', -18446744073709551617, '1'); select rpad('hello', 18446744073709551617, '1'); +--enable_view_protocol select rpad('hello', -1); select rpad('hello', -4294967295); select rpad('hello', 4294967295); @@ -1123,12 +1208,15 @@ select rpad('hello', -4294967296); select rpad('hello', 4294967296); select rpad('hello', -4294967297); select rpad('hello', 4294967297); +#view protocol generates additional warning +--disable_view_protocol select rpad('hello', -18446744073709551615); select rpad('hello', 18446744073709551615); select rpad('hello', -18446744073709551616); select rpad('hello', 18446744073709551616); select rpad('hello', -18446744073709551617); select rpad('hello', 18446744073709551617); +--enable_view_protocol select rpad('hello', 0, 'x'); select rpad('hello', 0); @@ -1139,12 +1227,15 @@ select lpad('hello', -4294967296, '1'); select lpad('hello', 4294967296, '1'); select lpad('hello', -4294967297, '1'); select lpad('hello', 4294967297, '1'); +#view protocol generates additional warning +--disable_view_protocol select lpad('hello', -18446744073709551615, '1'); select lpad('hello', 18446744073709551615, '1'); select lpad('hello', -18446744073709551616, '1'); select lpad('hello', 18446744073709551616, '1'); select lpad('hello', -18446744073709551617, '1'); select lpad('hello', 18446744073709551617, '1'); +--enable_view_protocol select lpad('hello', -1); select lpad('hello', -4294967295); select lpad('hello', 4294967295); @@ -1152,12 +1243,15 @@ select lpad('hello', -4294967296); select lpad('hello', 4294967296); select lpad('hello', -4294967297); select lpad('hello', 4294967297); +#view protocol generates additional warning +--disable_view_protocol select lpad('hello', -18446744073709551615); select lpad('hello', 18446744073709551615); select lpad('hello', -18446744073709551616); select lpad('hello', 18446744073709551616); select lpad('hello', -18446744073709551617); select lpad('hello', 18446744073709551617); +--enable_view_protocol select lpad('hello', 0, 'x'); select lpad('hello', 0); @@ -1329,7 +1423,9 @@ DROP VIEW v1; create table t1(a float); insert into t1 values (1.33); --enable_metadata +--disable_view_protocol select format(a, 2) from t1; +--enable_view_protocol --disable_metadata drop table t1; @@ -1398,6 +1494,8 @@ CREATE TABLE t2 (a VARCHAR(20), b INT); INSERT INTO t1 VALUES ('ABC', 1); INSERT INTO t2 VALUES ('ABC', 1); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; @@ -1406,6 +1504,7 @@ SELECT DECODE((SELECT ENCODE('secret', 'ABC') FROM t1,t2 WHERE t1.a = t2.a GROUP SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), 'ABC') FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; +--enable_view_protocol TRUNCATE TABLE t1; TRUNCATE TABLE t2; @@ -1413,8 +1512,11 @@ TRUNCATE TABLE t2; INSERT INTO t1 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1); INSERT INTO t2 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b LIMIT 1), t2.a) FROM t2 WHERE t2.b = 1 GROUP BY t2.b; +--enable_view_protocol DROP TABLE t1, t2; @@ -1432,7 +1534,10 @@ DROP TABLE t1; --echo # Bug#57810 case/when/then : Assertion failed: length || !scale --echo # SELECT '1' IN ('1', SUBSTRING(-9223372036854775809, 1)); +#view protocol generates additional warning +--disable_view_protocol SELECT CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3)); +--enable_view_protocol --echo # --echo # Bug#58165: "my_empty_string" gets modified and causes LOAD DATA to fail @@ -1514,7 +1619,10 @@ DROP TABLE t; # WL#4584 Internationalized number format # SELECT format(12345678901234567890.123, 3); +#view protocol generates additional warning +--disable_view_protocol SELECT format(12345678901234567890.123, 3, NULL); +--disable_view_protocol SELECT format(12345678901234567890.123, 3, 'ar_AE'); SELECT format(12345678901234567890.123, 3, 'ar_SA'); SELECT format(12345678901234567890.123, 3, 'be_BY'); @@ -1571,17 +1679,23 @@ SELECT CONV(1,-2147483648,-2147483648); --echo # Bug#12985030 SIMPLE QUERY WITH DECIMAL NUMBERS LEAKS MEMORY --echo # +#enable after fix MDEV-27871 +--disable_view_protocol SELECT (rpad(1.0,2048,1)) IS NOT FALSE; SELECT ((+0) IN ((0b111111111111111111111111111111111111111111111111111),(rpad(1.0,2048,1)), (32767.1))); SELECT ((rpad(1.0,2048,1)) = ('4(') ^ (0.1)); +--enable_view_protocol --error 1690 SELECT pow((rpad(10.0,2048,1)),(b'1111111111111111111111111111111111111111111')); SELECT ((rpad(1.0,2048,1)) + (0) ^ ('../')); +#enable after fix MDEV-28585 +--disable_view_protocol SELECT stddev_samp(rpad(1.0,2048,1)); +--enable_view_protocol SELECT ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1))); SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc)); @@ -1979,11 +2093,13 @@ DROP TABLE t1; --echo # MDEV-19359 ASAN heap-use-after-free in copy_if_not_alloced / make_sortkey --echo # +#check and enable after fix MDEV-28536 +--disable_view_protocol CREATE TABLE t1 (a INT, b TIME, c TIME); INSERT INTO t1 VALUES (NULL,'22:56:45','22:56:45'),(4,'12:51:42','12:51:42'); SELECT REPLACE( BINARY c, a, b ) f FROM t1 GROUP BY f WITH ROLLUP; DROP TABLE t1; - +--enable_view_protocol --echo # --echo # End of 10.1 tests @@ -1998,8 +2114,47 @@ DROP TABLE t1; --echo # MDEV-24742 Server crashes in Charset::numchars / String::numchars --echo # +#enable after fix MDEV-27871 +--disable_view_protocol SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux'); - +--enable_view_protocol + +--echo # +--echo # Bug#31374305 - FORMAT() NOT DISPLAYING WHOLE NUMBER SIDE CORRECTLY +--echo # FOR ES_MX AND ES_ES LOCALES +--echo # + +DELIMITER |; +CREATE PROCEDURE load_locale_format_table() +BEGIN + DECLARE locale_list VARCHAR(1000) DEFAULT ' + es_AR,es_BO,es_CL,es_CO,es_CR,es_DO,es_EC,es_ES,es_GT,es_HN, + es_MX,es_NI,es_PA,es_PE,es_PR,es_PY,es_SV,es_US,es_UY,es_VE'; + SET @fmt_stmt = 'INSERT INTO locale_format VALUES + (?, FORMAT(12131254123412541,2,?));'; + PREPARE stmt FROM @fmt_stmt; + WHILE locale_list != '' DO + /* get the first locale from the list */ + SET @locale = + TRIM(REPLACE((SUBSTRING_INDEX(locale_list, ',', 1)), '\n','')); + EXECUTE stmt USING @locale, @locale; + /* remove the first locale from the list */ + IF LOCATE(',', locale_list) > 0 THEN + SET locale_list = + SUBSTRING(locale_list, LOCATE(',', locale_list) + 1); + ELSE + SET locale_list = ''; + END IF; + END WHILE; + DEALLOCATE PREPARE stmt; +END| +DELIMITER ;| + +CREATE TABLE locale_format(locale VARCHAR(10), formatted_string VARCHAR(100)); +CALL load_locale_format_table(); +SELECT * FROM locale_format; +DROP PROCEDURE load_locale_format_table; +DROP TABLE locale_format; --echo # --echo # End of 10.2 tests @@ -2013,6 +2168,7 @@ SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux'); --echo # --echo # MDEV-12685 Oracle-compatible function CHR() --echo # +--disable_service_connection select chr(65); create database mysqltest1 CHARACTER SET = 'utf8' COLLATE = 'utf8_bin'; use mysqltest1; @@ -2020,6 +2176,7 @@ select charset(chr(65)), length(chr(65)),char_length(chr(65)); select charset(chr(14844588)), length(chr(14844588)),char_length(chr(14844588)); drop database mysqltest1; use test; +--enable_service_connection --echo # --echo # MDEV-12592 Illegal mix of collations with the HEX function @@ -2126,16 +2283,22 @@ CREATE TABLE crash_test_2 ( --echo # Cleanup DROP TABLE t1; - --echo # --echo # End of 10.3 tests --echo # - --echo # --echo # Start of 10.4 tests --echo # +--echo # +--echo # MDEV-30351 crash in Item_func_left::val_str +--echo # + +SELECT WEIGHT_STRING('aa') IN (LEFT(WEIGHT_STRING('aaa'),4),'bbb') as expect_1; + +SELECT UNHEX('0032') in (LEFT(UNHEX('003200'), 2),'dog') as expect_1; + --echo # --echo # MDEV-21841 CONV() function truncates the result type to 21 symbol. --echo # diff --git a/mysql-test/main/func_system.result b/mysql-test/main/func_system.result index 6d80a43903038..fd99c81aaf2ef 100644 --- a/mysql-test/main/func_system.result +++ b/mysql-test/main/func_system.result @@ -46,10 +46,10 @@ create table t1 (version char(60)) select database(), user(), version() as 'vers show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `database()` varchar(34) CHARACTER SET utf8mb3 DEFAULT NULL, - `user()` varchar(384) CHARACTER SET utf8mb3 DEFAULT NULL, + `database()` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `user()` varchar(384) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `version` char(60) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select charset(charset(_utf8'a')), charset(collation(_utf8'a')); charset(charset(_utf8'a')) charset(collation(_utf8'a')) @@ -61,9 +61,9 @@ create table t1 select charset(_utf8'a'), collation(_utf8'a'); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `charset(_utf8'a')` varchar(64) CHARACTER SET utf8mb3 DEFAULT NULL, - `collation(_utf8'a')` varchar(64) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `charset(_utf8'a')` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `collation(_utf8'a')` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select TRUE,FALSE,NULL; TRUE FALSE NULL @@ -95,3 +95,21 @@ select left(concat(a,version()),1) from t1; left(concat(a,version()),1) a drop table t1; +# +# Start of 10.2 tests +# + +MDEV-27544 database() function under UNION ALL truncates results to 34 characters + + +SET NAMES utf8; +create database betäubungsmittelverschreibungsverordnung; +use betäubungsmittelverschreibungsverordnung; +select database() as "database" union all select database(); +database +betäubungsmittelverschreibungsverordnung +betäubungsmittelverschreibungsverordnung +drop database betäubungsmittelverschreibungsverordnung; +# +# End of 10.2 tests +# diff --git a/mysql-test/main/func_system.test b/mysql-test/main/func_system.test index fa09e81a30068..7b88b6f36eed9 100644 --- a/mysql-test/main/func_system.test +++ b/mysql-test/main/func_system.test @@ -55,3 +55,24 @@ select left(concat(a,version()),1) from t1; drop table t1; # End of 4.1 tests + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo +--echo MDEV-27544 database() function under UNION ALL truncates results to 34 characters +--echo +--echo + +--disable_service_connection +SET NAMES utf8; +create database betäubungsmittelverschreibungsverordnung; +use betäubungsmittelverschreibungsverordnung; +select database() as "database" union all select database(); +drop database betäubungsmittelverschreibungsverordnung; +--enable_service_connection + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/main/func_test.result b/mysql-test/main/func_test.result index 04aee8b5522cb..fca977c5eaae8 100644 --- a/mysql-test/main/func_test.result +++ b/mysql-test/main/func_test.result @@ -403,7 +403,7 @@ t2 CREATE TABLE `t2` ( `LEAST(b,a)` decimal(10,0) DEFAULT NULL, `GREATEST(a,b)` decimal(10,0) DEFAULT NULL, `GREATEST(b,a)` decimal(10,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a -2147483648 b 4294967295 diff --git a/mysql-test/main/func_test.test b/mysql-test/main/func_test.test index 570fd0ae87aa2..c8206d34a12c1 100644 --- a/mysql-test/main/func_test.test +++ b/mysql-test/main/func_test.test @@ -6,16 +6,25 @@ drop table if exists t1,t2; # select 0=0,1>0,1>=1,1<0,1<=0,1!=0,strcmp("abc","abcd"),strcmp("b","a"),strcmp("a","a") ; select "a"<"b","a"<="b","b">="a","b">"a","a"="A","a"<>"b"; -select "a "="A", "A "="a", "a " <= "A b"; +#enable after fix MDEV-28535 +--disable_view_protocol +select "a "="A", "A "="a", "a " <= "A b"; +--enable_view_protocol select "abc" like "a%", "abc" not like "%d%", "a%" like "a\%","abc%" like "a%\%","abcd" like "a%b_%d", "a" like "%%a","abcde" like "a%_e","abc" like "abc%"; select "a" like "%%b","a" like "%%ab","ab" like "a\%", "ab" like "_", "ab" like "ab_", "abc" like "%_d", "abc" like "abc%d"; select '?' like '|%', '?' like '|%' ESCAPE '|', '%' like '|%', '%' like '|%' ESCAPE '|', '%' like '%'; select 'abc' like '%c','abcabc' like '%c', "ab" like "", "ab" like "a", "ab" like "ab"; +#enable after fix MDEV-29601 +--disable_service_connection select "Det h�r �r svenska" regexp "h[[:alpha:]]+r", "aba" regexp "^(a|b)*$"; +--enable_service_connection select "aba" regexp concat("^","a"); select !0,NOT 0=1,!(0=0),1 AND 1,1 && 0,0 OR 1,1 || NULL, 1=1 or 1=1 and 1=0; select 2 between 1 and 3, "monty" between "max" and "my",2=2 and "monty" between "max" and "my" and 3=3; +#enable after fix MDEV-28535 +--disable_view_protocol select 'b' between 'a' and 'c', 'B' between 'a' and 'c'; +--enable_view_protocol select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,1.0); select -1.49 or -1.49,0.6 or 0.6; select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1; diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result index 7bca4158d702d..27d5810d5f6dd 100644 --- a/mysql-test/main/func_time.result +++ b/mysql-test/main/func_time.result @@ -958,7 +958,7 @@ t1 CREATE TABLE `t1` ( `curtime() - curtime()` int(9) NOT NULL, `sec_to_time(1) + 0` int(9) DEFAULT NULL, `from_unixtime(1) + 0` bigint(16) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; SELECT SEC_TO_TIME(3300000); SEC_TO_TIME(3300000) @@ -991,6 +991,12 @@ ADDTIME('916:40:00', '416:40:00') Warnings: Warning 1292 Truncated incorrect time value: '916:40:00' Warning 1292 Truncated incorrect time value: '1255:39:59.999999' +SELECT ADDTIME(20010101,1e0), ADDTIME(20010101,1.1e0); +ADDTIME(20010101,1e0) ADDTIME(20010101,1.1e0) +2001-01-01 00:00:01.000000 2001-01-01 00:00:01.100000 +SELECT ADDTIME(ADDTIME(20010101,1e0), 0); +ADDTIME(ADDTIME(20010101,1e0), 0) +2001-01-01 00:00:01.000000 SELECT SUBTIME('916:40:00', '416:40:00'); SUBTIME('916:40:00', '416:40:00') 422:19:59.999999 @@ -2161,7 +2167,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `f2` varchar(22) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; f2 0.000000 @@ -2282,7 +2288,7 @@ t1 CREATE TABLE `t1` ( `c2` varchar(10) DEFAULT NULL, `c3` varchar(10) DEFAULT NULL, `c4` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-4870 Wrong values of CASE, COALESCE, IFNULL on a combination of different temporal types @@ -3243,7 +3249,7 @@ t2 CREATE TABLE `t2` ( `EXTRACT(HOUR_MICROSECOND FROM a)` bigint(13) DEFAULT NULL, `EXTRACT(MINUTE_MICROSECOND FROM a)` bigint(11) DEFAULT NULL, `EXTRACT(SECOND_MICROSECOND FROM a)` int(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE TABLE t1 (a TIME(6)); INSERT INTO t1 VALUES ('-838:59:59.999999'),('838:59:59.999999'); @@ -3424,7 +3430,7 @@ t2 CREATE TABLE `t2` ( `EXTRACT(HOUR_MICROSECOND FROM a)` bigint(13) DEFAULT NULL, `EXTRACT(MINUTE_MICROSECOND FROM a)` bigint(11) DEFAULT NULL, `EXTRACT(SECOND_MICROSECOND FROM a)` int(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; # # MDEV-14926 AddressSanitizer: heap-use-after-free in make_date_time on weird combination of functions @@ -3541,7 +3547,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(19) DEFAULT NULL, `c2` varchar(26) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 2001-01-02 10:20:31 @@ -3607,7 +3613,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `TO_SECONDS('9999-12-31 23:59:59')` bigint(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET sql_mode=DEFAULT; # @@ -3733,7 +3739,7 @@ t1 CREATE TABLE `t1` ( `c3` varchar(4) DEFAULT NULL, `c4` varchar(2) DEFAULT NULL, `c5` varchar(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXECUTE IMMEDIATE "CREATE TABLE t1 AS SELECT @@ -3753,7 +3759,7 @@ t1 CREATE TABLE `t1` ( `c3` varchar(4) DEFAULT NULL, `c4` varchar(2) DEFAULT NULL, `c5` varchar(100) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-16152 Expressions with INTERVAL return bad results in some cases @@ -6239,7 +6245,7 @@ t2 CREATE TABLE `t2` ( `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 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # diff --git a/mysql-test/main/func_time.test b/mysql-test/main/func_time.test index 359b1ac869800..b0b9eb5c63cb9 100644 --- a/mysql-test/main/func_time.test +++ b/mysql-test/main/func_time.test @@ -12,7 +12,10 @@ select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days( select period_add("9602",-12),period_diff(199505,"9404") ; select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now()); +#enable after fix MDEV-27871 +--disable_view_protocol select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0; +--enable_view_protocol select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"), sec_to_time(time_to_sec("0:30:47")/6.21); select sec_to_time(9001.1), time_to_sec('15:12:22.123456'), time_to_sec(15.5566778899); @@ -24,11 +27,14 @@ select sec_to_time(-9001.1), sec_to_time(-9001.1) / 1, select sec_to_time(90011e-1), sec_to_time(1234567890123e30); select sec_to_time(1234567890123), sec_to_time('99999999999999999999999999999'); select now()-curdate()*1000000-curtime(); +#enable after fix MDEV-27871 +--disable_view_protocol select strcmp(current_timestamp(),concat(current_date()," ",current_time())); select strcmp(localtime(),concat(current_date()," ",current_time())); select strcmp(localtimestamp(),concat(current_date()," ",current_time())); select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"); select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w")); +--enable_view_protocol select dayofmonth("1997-01-02"),dayofmonth(19970323); select month("1997-01-02"),year("98-02-03"),dayofyear("1997-12-31"); select month("2001-02-00"),year("2001-00-00"); @@ -78,8 +84,11 @@ select time_format(000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(199801310000 select time_format(010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T'); select time_format(131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T'); select time_format(010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T'); +#enable after fix MDEV-27871 +--disable_view_protocol select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w'); select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w'); +--enable_view_protocol select date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND); select date_add("1997-12-31 23:59:59",INTERVAL 1 MINUTE); select date_add("1997-12-31 23:59:59",INTERVAL 1 HOUR); @@ -118,9 +127,12 @@ select date_add("1997-12-31 23:59:59",INTERVAL "10000:1" MINUTE_SECOND); select date_add("1997-12-31 23:59:59",INTERVAL "-10000:1" HOUR_MINUTE); select date_add("1997-12-31 23:59:59",INTERVAL "10000:1" DAY_HOUR); select date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH); +#enable after fix MDEV-27871 +--disable_view_protocol select date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND); select date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE); select date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND); +--enable_view_protocol select "1997-12-31 23:59:59" + INTERVAL 1 SECOND; select INTERVAL 1 DAY + "1997-12-31"; select "1998-01-01 00:00:00" - INTERVAL 1 SECOND; @@ -169,15 +181,22 @@ SELECT EXTRACT(QUARTER FROM '2004-12-15') AS quarter; # # MySQL Bugs: #12356: DATE_SUB or DATE_ADD incorrectly returns null # +#enable after fix MDEV-27871 +--disable_view_protocol SELECT DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE); SELECT DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE); +--enable_view_protocol # # Test big intervals (Bug #3498) # SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND; SELECT "1900-01-01 00:00:00" + INTERVAL "1:2147483647" MINUTE_SECOND; -SELECT "1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND;SELECT "1900-01-01 00:00:00" + INTERVAL 1<<37 SECOND; +#enable after fix MDEV-27871 +--disable_view_protocol +SELECT "1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND; +--disable_view_protocol +SELECT "1900-01-01 00:00:00" + INTERVAL 1<<37 SECOND; SELECT "1900-01-01 00:00:00" + INTERVAL 1<<31 MINUTE; SELECT "1900-01-01 00:00:00" + INTERVAL 1<<20 HOUR; @@ -426,9 +445,12 @@ select last_day("1997-12-1")+0.0; # Test SAPDB UTC_% functions. This part is TZ dependant (It is supposed that # TZ variable set to GMT-3 +#enable after fix MDEV-27871 +--disable_view_protocol select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0; select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0; select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0; +--enable_view_protocol select strcmp(date_format(utc_timestamp(),"%T"), utc_time())=0; select strcmp(date_format(utc_timestamp(),"%Y-%m-%d"), utc_date())=0; select strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0; @@ -455,8 +477,11 @@ select last_day('2005-01-00'); # Bug #18501: monthname and NULLs # +#enable after fix MDEV-28535 +--disable_view_protocol select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')), monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m')); +--enable_view_protocol # # Bug #16327: problem with timestamp < 1970 @@ -513,6 +538,10 @@ SELECT TIME_TO_SEC('916:40:00'); SELECT ADDTIME('500:00:00', '416:40:00'); SELECT ADDTIME('916:40:00', '416:40:00'); +# check if ADDTIME() handles NOT_FIXED_DEC correctly +SELECT ADDTIME(20010101,1e0), ADDTIME(20010101,1.1e0); +SELECT ADDTIME(ADDTIME(20010101,1e0), 0); + # check if SUBTIME() handles out-of-range values correctly SELECT SUBTIME('916:40:00', '416:40:00'); SELECT SUBTIME('-916:40:00', '416:40:00'); @@ -726,7 +755,10 @@ set time_zone= @@global.time_zone; # select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE; +#enable after fix MDEV-27871 +--disable_view_protocol select str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute; +--enable_view_protocol # # Bug #21103: DATE column not compared as DATE @@ -763,6 +795,7 @@ SELECT TIME_FORMAT(SEC_TO_TIME(a),"%H:%i:%s") FROM (SELECT 3020399 AS a UNION SE # # Bug#28875 Conversion between ASCII and LATIN1 charsets does not function # +--disable_service_connection set names latin1; create table t1 (a varchar(15) character set ascii not null); insert into t1 values ('070514-000000'); @@ -783,6 +816,7 @@ set lc_time_names=fr_FR; select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1; set lc_time_names=en_US; drop table t1; +--enable_service_connection # # Bug#32180: DATE_ADD treats datetime numeric argument as DATE @@ -814,7 +848,10 @@ select LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND; # show that we treat fractions of seconds correctly (zerofill from right to # six places) even if we left out fields on the left. +#enable after fix MDEV-27871 +--disable_view_protocol select date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond); +--enable_view_protocol select date_add('1000-01-01 00:00:00', interval '1.02' day_microsecond); @@ -1055,14 +1092,19 @@ SET timestamp=DEFAULT; SELECT UNIX_TIMESTAMP(STR_TO_DATE('201506', "%Y%m")); SELECT UNIX_TIMESTAMP('2015-06-00'); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s')); - +--enable_view_protocol set sql_mode= 'TRADITIONAL'; SELECT @@sql_mode; SELECT UNIX_TIMESTAMP(STR_TO_DATE('201506', "%Y%m")); SELECT UNIX_TIMESTAMP('2015-06-00'); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s')); +--enable_view_protocol set sql_mode= default; @@ -1091,7 +1133,10 @@ select time('10 02:03:04') + interval 1 year; # specially constructed queries to reach obscure places in the code # not touched by the more "normal" queries (and to increase the coverage) select cast('131415.123e0' as time); +#enable after fix MDEV-27871 +--disable_view_protocol select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04'; +--enable_view_protocol select least(time('1:2:3'), '01:02:04', null) div 1; select truncate(least(time('1:2:3'), '01:02:04', null), 6); select cast(least(time('1:2:3'), '01:02:04', null) as decimal(3,1)); @@ -1128,9 +1173,12 @@ drop table t1; # # lp:731815 Crash/valgrind warning Item::send with 5.1-micro # +#enable after fix MDEV-27871 +--disable_view_protocol SET timestamp=unix_timestamp('2001-02-03 10:20:30'); select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow'); SET timestamp=DEFAULT; +--enable_view_protocol # # lp:736370 Datetime functions in subquery context cause wrong result and bogus warnings in mysql-5.1-micr @@ -1201,10 +1249,13 @@ drop table t1; SET timestamp=UNIX_TIMESTAMP('2014-06-01 10:20:30'); select greatest(cast("0-0-0" as date), cast("10:20:05" as time)); +#enable after fix MDEV-27871 +--disable_view_protocol select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00'; select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01'; select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01 10:20:05'; select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6)); +--enable_view_protocol SET timestamp=DEFAULT; select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010'); @@ -1599,7 +1650,9 @@ SELECT DATE_ADD('2001-01-01 10:20:30',INTERVAL 250000000000.0 SECOND) AS c1, DAT --echo # MDEV-4838 Wrong metadata for DATE_ADD('string', INVERVAL) --echo # --enable_metadata +--disable_view_protocol SELECT DATE_ADD('2011-01-02 12:13:14', INTERVAL 1 MINUTE); +--enable_view_protocol --disable_metadata --echo # @@ -1801,6 +1854,8 @@ SELECT --echo # --echo # MDEV-10787 Assertion `ltime->neg == 0' failed in void date_to_datetime(MYSQL_TIME*) --echo # +#enable after fix MDEV-27871 +--disable_view_protocol CREATE TABLE t1 (d DATE); INSERT INTO t1 VALUES ('2005-07-20'),('2012-12-21'); SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) FROM t1; @@ -1820,6 +1875,7 @@ SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND); SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND); SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND); SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND); +--disable_view_protocol --echo # --echo # MDEV-13202 Assertion `ltime->neg == 0' failed in date_to_datetime @@ -1882,7 +1938,9 @@ INSERT INTO t1 VALUES ('1999-12-31 23:59:59.999999'); --vertical_results --enable_metadata --disable_ps_protocol +--disable_view_protocol --eval $query +--enable_view_protocol --enable_ps_protocol --disable_metadata --horizontal_results @@ -1900,7 +1958,9 @@ INSERT INTO t1 VALUES ('-838:59:59.999999'),('838:59:59.999999'); --vertical_results --enable_metadata --disable_ps_protocol +--disable_view_protocol --eval $query +--enable_view_protocol --enable_ps_protocol --disable_metadata --horizontal_results @@ -3156,7 +3216,10 @@ SELECT TIME('0001:01:01-'), TIME('0001:01:01--'); SELECT TIME('-xxx'), TIME('-xxxxxxxxxxxxxxxxxxxx'); SELECT TIME('- '), TIME('- '); +#enable after fix MDEV-28535 +--disable_view_protocol SELECT TIME('-'), TIME('-'); +--enable_view_protocol 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'); @@ -3171,11 +3234,12 @@ 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 # - +#enable after fix MDEV-29534 +--disable_view_protocol SET time_zone='+00:00'; SELECT NULLIF(FROM_UNIXTIME('foo'), '2012-12-12 21:10:14'); SET time_zone=DEFAULT; - +--enable_view_protocol --echo # --echo # MDEV-18402 Assertion `sec.sec() <= 59' failed in Item_func_maketime::get_date diff --git a/mysql-test/main/func_time_hires.result b/mysql-test/main/func_time_hires.result index a76571a67b514..c6fcec736969e 100644 --- a/mysql-test/main/func_time_hires.result +++ b/mysql-test/main/func_time_hires.result @@ -49,7 +49,7 @@ t1 CREATE TABLE `t1` ( `localtimestamp(6)` datetime(6) NOT NULL, `time_to_sec(123456)` bigint(17) DEFAULT NULL, `time_to_sec('12:34:56.789')` decimal(19,3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; sec_to_time(12345) 03:25:45 sec_to_time(12345.6789) 03:25:45.6789 @@ -133,7 +133,7 @@ t1 CREATE TABLE `t1` ( `t4` time(4) DEFAULT NULL, `t5` time(5) DEFAULT NULL, `t6` time(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; dauto 2011-01-02 12:13:14 d0 2011-01-02 12:13:14 diff --git a/mysql-test/main/func_time_hires.test b/mysql-test/main/func_time_hires.test index 35fd36b84561f..dca8d458f8a2c 100644 --- a/mysql-test/main/func_time_hires.test +++ b/mysql-test/main/func_time_hires.test @@ -30,8 +30,11 @@ show create table t1; --query_vertical select * from t1 drop table t1; +#enable after fix MDEV-28535 +--disable_view_protocol --query_vertical select unix_timestamp('2011-01-01 01:01:01'), unix_timestamp('2011-01-01 01:01:01.123456'), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(0))), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4))); --query_vertical select from_unixtime(unix_timestamp('2011/1/1 1:1:1')), from_unixtime(unix_timestamp('2011/1/1 1:1:1.123456')), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(0)))), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(4)))); +--enable_view_protocol select sec_to_time(3020399.99999), sec_to_time(3020399.999999), sec_to_time(3020399.9999999); select sec_to_time(-3020399.99999), sec_to_time(-3020399.999999), sec_to_time(-3020399.9999999); @@ -80,7 +83,10 @@ select CAST(@a AS DATETIME(7)); SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00'); SELECT CONVERT_TZ('2011-01-02 12:00:00.123', '+00:00', '+03:00'); SELECT CONVERT_TZ('2011-01-02 12:00:00.123456', '+00:00', '+03:00'); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT CONVERT_TZ(CAST('2010-10-10 10:10:10.123456' AS DATETIME(4)), '+00:00', '+03:00'); +--enable_view_protocol # # Field::store_time() diff --git a/mysql-test/main/func_time_round.test b/mysql-test/main/func_time_round.test index 12d3a50a10f1c..79f9ec289a020 100644 --- a/mysql-test/main/func_time_round.test +++ b/mysql-test/main/func_time_round.test @@ -126,6 +126,8 @@ SELECT TIME_TO_SEC(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER B --echo # Functions with a single TIME interval input, conversion from TIME-interval-in-VARCHAR --echo # +#enable after fix MDEV-29525 +--disable_view_protocol SELECT EXTRACT(DAY FROM a), EXTRACT(HOUR FROM a), @@ -135,6 +137,7 @@ SELECT CAST(a AS INTERVAL DAY_SECOND(6)), a FROM t1_time_in_varchar ORDER BY id; +--enable_view_protocol SELECT TIME_TO_SEC(a), @@ -146,6 +149,8 @@ FROM t1_time_in_varchar ORDER BY id; --echo # Functions with a single TIME interval input, conversion from TIME-interval-in-DECIMAL --echo # +#enable after fix MDEV-29525 +--disable_view_protocol SELECT EXTRACT(DAY FROM a), EXTRACT(HOUR FROM a), @@ -155,6 +160,7 @@ SELECT CAST(a AS INTERVAL DAY_SECOND(6)), a FROM t1_time_in_decimal ORDER BY id; +--enable_view_protocol SELECT TIME_TO_SEC(a), diff --git a/mysql-test/main/func_weight_string.result b/mysql-test/main/func_weight_string.result index 3b72cdafa3214..b2649ed33216d 100644 --- a/mysql-test/main/func_weight_string.result +++ b/mysql-test/main/func_weight_string.result @@ -52,14 +52,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `w` varbinary(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 select weight_string(repeat('t',66000)) as w; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `w` mediumblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select weight_string(NULL); weight_string(NULL) @@ -157,7 +157,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varbinary(10) DEFAULT weight_string(`a`,0,10,65) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('a'); SELECT a, HEX(b) FROM t1; a HEX(b) diff --git a/mysql-test/main/func_weight_string.test b/mysql-test/main/func_weight_string.test index 528aa5d4f0fb9..e2043e8657fd9 100644 --- a/mysql-test/main/func_weight_string.test +++ b/mysql-test/main/func_weight_string.test @@ -2,6 +2,9 @@ drop table if exists t1; --enable_warnings +#check after fix MDEV-29601 +--disable_service_connection + set @save_max_allowed_packet=@@max_allowed_packet; set global max_allowed_packet=1048576; connect (conn1,localhost,root,,); @@ -120,6 +123,8 @@ disconnect conn1; connection default; set global max_allowed_packet=@save_max_allowed_packet; +--enable_service_connection + --echo # --echo # Start of 10.1 tests --echo # diff --git a/mysql-test/main/function_defaults.result b/mysql-test/main/function_defaults.result index 1f9b324e30caf..d53e929c12824 100644 --- a/mysql-test/main/function_defaults.result +++ b/mysql-test/main/function_defaults.result @@ -484,7 +484,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c TIMESTAMP NULL ); ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP FIRST; @@ -494,7 +494,7 @@ t1 CREATE TABLE `t1` ( `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a INT, b TIMESTAMP NULL ); ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP FIRST; @@ -503,7 +503,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b TIMESTAMP NULL ); ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER b; @@ -512,7 +512,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` timestamp NULL DEFAULT NULL, `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b TIMESTAMP NULL ); ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER b; @@ -521,7 +521,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` timestamp NULL DEFAULT NULL, `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(), b INT, c TIMESTAMP NULL ); SHOW CREATE TABLE t1; @@ -530,7 +530,7 @@ t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER b; SHOW CREATE TABLE t1; Table Create Table @@ -538,7 +538,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(), b INT, c TIMESTAMP NULL ); ALTER TABLE t1 MODIFY c TIMESTAMP NULL FIRST; @@ -548,7 +548,7 @@ t1 CREATE TABLE `t1` ( `c` timestamp NULL DEFAULT NULL, `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP, b INT, c TIMESTAMP NULL ); SHOW CREATE TABLE t1; @@ -557,7 +557,7 @@ t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP AFTER b; SHOW CREATE TABLE t1; Table Create Table @@ -565,7 +565,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP, b INT, c TIMESTAMP NULL ); ALTER TABLE t1 MODIFY c TIMESTAMP NULL FIRST; @@ -575,7 +575,7 @@ t1 CREATE TABLE `t1` ( `c` timestamp NULL DEFAULT NULL, `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Test of ALTER TABLE, adding columns. @@ -587,7 +587,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Test of INSERT SELECT. @@ -651,7 +651,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a 1970-04-11 20:13:57 @@ -660,7 +660,7 @@ SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `b` timestamp NOT NULL DEFAULT current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t3; b 1970-04-11 20:13:57 @@ -669,7 +669,7 @@ SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t4; c 0000-00-00 00:00:00 @@ -678,7 +678,7 @@ SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( `d` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t5; d 1986-09-27 03:00:00 @@ -687,7 +687,7 @@ SHOW CREATE TABLE t6; Table Create Table t6 CREATE TABLE `t6` ( `e` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t6; e NULL @@ -696,7 +696,7 @@ SHOW CREATE TABLE t7; Table Create Table t7 CREATE TABLE `t7` ( `f` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t7; f 1970-04-11 20:13:57 @@ -705,7 +705,7 @@ SHOW CREATE TABLE t8; Table Create Table t8 CREATE TABLE `t8` ( `g` datetime DEFAULT current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t8; g 1970-04-11 20:13:57 @@ -714,7 +714,7 @@ SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( `h` datetime DEFAULT NULL ON UPDATE current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t9; h NULL @@ -723,7 +723,7 @@ SHOW CREATE TABLE t10; Table Create Table t10 CREATE TABLE `t10` ( `i` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t10; i NULL @@ -732,7 +732,7 @@ SHOW CREATE TABLE t11; Table Create Table t11 CREATE TABLE `t11` ( `j` datetime DEFAULT '1986-09-27 03:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t11; j 1986-09-27 03:00:00 @@ -774,7 +774,7 @@ t12 CREATE TABLE `t12` ( `h` datetime DEFAULT NULL ON UPDATE current_timestamp(), `i` datetime DEFAULT NULL, `j` datetime DEFAULT '1986-09-27 03:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12; # 1970-04-11 20:13:57 UTC SET TIMESTAMP = 8712837.164953; @@ -793,7 +793,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a 1970-04-11 20:13:57 @@ -802,7 +802,7 @@ SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `b` datetime DEFAULT current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t3; b 1970-04-11 20:13:57 @@ -811,7 +811,7 @@ SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `c` datetime DEFAULT NULL ON UPDATE current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t4; c NULL @@ -820,7 +820,7 @@ SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( `d` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t5; d NULL @@ -829,7 +829,7 @@ SHOW CREATE TABLE t6; Table Create Table t6 CREATE TABLE `t6` ( `e` datetime DEFAULT '1986-09-27 03:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t6; e 1986-09-27 03:00:00 @@ -849,7 +849,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET TIMESTAMP = 2000.876543; INSERT INTO t2( a ) VALUES ( 3 ); SELECT * FROM t2; @@ -1233,7 +1233,7 @@ t1 CREATE TABLE `t1` ( `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOAD DATA INFILE "file1.dat" IGNORE INTO table t1; Warnings: Warning 1261 Row 1 doesn't contain data for all columns @@ -1285,7 +1285,7 @@ t1 CREATE TABLE `t1` ( `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOAD DATA INFILE "file1.dat" IGNORE INTO table t1; Warnings: Warning 1261 Row 1 doesn't contain data for all columns @@ -1352,7 +1352,7 @@ t1 CREATE TABLE `t1` ( `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOAD DATA INFILE "file2.dat" IGNORE INTO table t1; Warnings: Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 @@ -1390,7 +1390,7 @@ t1 CREATE TABLE `t1` ( `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOAD DATA INFILE "file2.dat" IGNORE INTO table t1; Warnings: Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 @@ -1430,7 +1430,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 ( a ) VALUES ( 1 ); SELECT * FROM t1; a b @@ -2030,7 +2030,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), c TIMESTAMP(6) NULL ); ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) FIRST; @@ -2040,7 +2040,7 @@ t1 CREATE TABLE `t1` ( `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NULL ); ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) FIRST; @@ -2049,7 +2049,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), b TIMESTAMP(6) NULL ); ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER b; @@ -2058,7 +2058,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` timestamp(6) NULL DEFAULT NULL, `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), b TIMESTAMP(6) NULL ); ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER b; @@ -2067,7 +2067,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` timestamp(6) NULL DEFAULT NULL, `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(6), b INT, c TIMESTAMP(6) NULL ); SHOW CREATE TABLE t1; @@ -2076,7 +2076,7 @@ t1 CREATE TABLE `t1` ( `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) AFTER b; SHOW CREATE TABLE t1; Table Create Table @@ -2084,7 +2084,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `c` timestamp(6) NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(6), b INT, c TIMESTAMP(6) NULL ); ALTER TABLE t1 MODIFY c TIMESTAMP(6) NULL FIRST; @@ -2094,7 +2094,7 @@ t1 CREATE TABLE `t1` ( `c` timestamp(6) NULL DEFAULT NULL, `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMESTAMP(6), b INT, c TIMESTAMP(6) NULL ); SHOW CREATE TABLE t1; @@ -2103,7 +2103,7 @@ t1 CREATE TABLE `t1` ( `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMESTAMP(6) AFTER b; SHOW CREATE TABLE t1; Table Create Table @@ -2111,7 +2111,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `c` timestamp(6) NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMESTAMP(6), b INT, c TIMESTAMP(6) NULL ); ALTER TABLE t1 MODIFY c TIMESTAMP(6) NULL FIRST; @@ -2121,7 +2121,7 @@ t1 CREATE TABLE `t1` ( `c` timestamp(6) NULL DEFAULT NULL, `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Test of ALTER TABLE, adding columns. @@ -2133,7 +2133,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Test of INSERT SELECT. @@ -2197,7 +2197,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a 1970-04-11 20:13:57.657897 @@ -2206,7 +2206,7 @@ SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t3; b 1970-04-11 20:13:57.657897 @@ -2215,7 +2215,7 @@ SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t4; c 0000-00-00 00:00:00.000000 @@ -2224,7 +2224,7 @@ SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( `d` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t5; d 1986-09-27 03:00:00.098765 @@ -2233,7 +2233,7 @@ SHOW CREATE TABLE t6; Table Create Table t6 CREATE TABLE `t6` ( `e` timestamp(6) NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t6; e NULL @@ -2242,7 +2242,7 @@ SHOW CREATE TABLE t7; Table Create Table t7 CREATE TABLE `t7` ( `f` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t7; f 1970-04-11 20:13:57.657897 @@ -2251,7 +2251,7 @@ SHOW CREATE TABLE t8; Table Create Table t8 CREATE TABLE `t8` ( `g` datetime(6) DEFAULT current_timestamp(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t8; g 1970-04-11 20:13:57.657897 @@ -2260,7 +2260,7 @@ SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( `h` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t9; h NULL @@ -2269,7 +2269,7 @@ SHOW CREATE TABLE t10; Table Create Table t10 CREATE TABLE `t10` ( `i` datetime(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t10; i NULL @@ -2278,7 +2278,7 @@ SHOW CREATE TABLE t11; Table Create Table t11 CREATE TABLE `t11` ( `j` datetime(6) DEFAULT '1986-09-27 03:00:00.098765' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t11; j 1986-09-27 03:00:00.098765 @@ -2320,7 +2320,7 @@ t12 CREATE TABLE `t12` ( `h` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6), `i` datetime(6) DEFAULT NULL, `j` datetime(6) DEFAULT '1986-09-27 03:00:00.098765' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12; # 1970-04-11 20:13:57 UTC SET TIMESTAMP = 8712837.164953; @@ -2339,7 +2339,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a 1970-04-11 20:13:57.164953 @@ -2348,7 +2348,7 @@ SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `b` datetime(6) DEFAULT current_timestamp(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t3; b 1970-04-11 20:13:57.164953 @@ -2357,7 +2357,7 @@ SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `c` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t4; c NULL @@ -2366,7 +2366,7 @@ SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( `d` datetime(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t5; d NULL @@ -2375,7 +2375,7 @@ SHOW CREATE TABLE t6; Table Create Table t6 CREATE TABLE `t6` ( `e` datetime(6) DEFAULT '1986-09-27 03:00:00.098765' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t6; e 1986-09-27 03:00:00.098765 @@ -2395,7 +2395,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET TIMESTAMP = 2000.876543; INSERT INTO t2( a ) VALUES ( 3 ); SELECT * FROM t2; @@ -2779,7 +2779,7 @@ t1 CREATE TABLE `t1` ( `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOAD DATA INFILE "file1.dat" IGNORE INTO table t1; Warnings: Warning 1261 Row 1 doesn't contain data for all columns @@ -2831,7 +2831,7 @@ t1 CREATE TABLE `t1` ( `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOAD DATA INFILE "file1.dat" IGNORE INTO table t1; Warnings: Warning 1261 Row 1 doesn't contain data for all columns @@ -2898,7 +2898,7 @@ t1 CREATE TABLE `t1` ( `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOAD DATA INFILE "file2.dat" IGNORE INTO table t1; Warnings: Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 @@ -2936,7 +2936,7 @@ t1 CREATE TABLE `t1` ( `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOAD DATA INFILE "file2.dat" IGNORE INTO table t1; Warnings: Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 @@ -2976,7 +2976,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 ( a ) VALUES ( 1 ); SELECT * FROM t1; a b diff --git a/mysql-test/main/function_defaults_innodb.result b/mysql-test/main/function_defaults_innodb.result index c73dda735d5bc..e037ee3e985b9 100644 --- a/mysql-test/main/function_defaults_innodb.result +++ b/mysql-test/main/function_defaults_innodb.result @@ -485,7 +485,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c TIMESTAMP NULL ); ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP FIRST; @@ -495,7 +495,7 @@ t1 CREATE TABLE `t1` ( `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a INT, b TIMESTAMP NULL ); ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP FIRST; @@ -504,7 +504,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b TIMESTAMP NULL ); ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER b; @@ -513,7 +513,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` timestamp NULL DEFAULT NULL, `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b TIMESTAMP NULL ); ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER b; @@ -522,7 +522,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` timestamp NULL DEFAULT NULL, `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(), b INT, c TIMESTAMP NULL ); SHOW CREATE TABLE t1; @@ -531,7 +531,7 @@ t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER b; SHOW CREATE TABLE t1; Table Create Table @@ -539,7 +539,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(), b INT, c TIMESTAMP NULL ); ALTER TABLE t1 MODIFY c TIMESTAMP NULL FIRST; @@ -549,7 +549,7 @@ t1 CREATE TABLE `t1` ( `c` timestamp NULL DEFAULT NULL, `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP, b INT, c TIMESTAMP NULL ); SHOW CREATE TABLE t1; @@ -558,7 +558,7 @@ t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP AFTER b; SHOW CREATE TABLE t1; Table Create Table @@ -566,7 +566,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP, b INT, c TIMESTAMP NULL ); ALTER TABLE t1 MODIFY c TIMESTAMP NULL FIRST; @@ -576,7 +576,7 @@ t1 CREATE TABLE `t1` ( `c` timestamp NULL DEFAULT NULL, `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Test of ALTER TABLE, adding columns. @@ -588,7 +588,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Test of INSERT SELECT. @@ -652,7 +652,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a 1970-04-11 20:13:57 @@ -661,7 +661,7 @@ SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `b` timestamp NOT NULL DEFAULT current_timestamp() -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t3; b 1970-04-11 20:13:57 @@ -670,7 +670,7 @@ SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp() -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t4; c 0000-00-00 00:00:00 @@ -679,7 +679,7 @@ SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( `d` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t5; d 1986-09-27 03:00:00 @@ -688,7 +688,7 @@ SHOW CREATE TABLE t6; Table Create Table t6 CREATE TABLE `t6` ( `e` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t6; e NULL @@ -697,7 +697,7 @@ SHOW CREATE TABLE t7; Table Create Table t7 CREATE TABLE `t7` ( `f` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t7; f 1970-04-11 20:13:57 @@ -706,7 +706,7 @@ SHOW CREATE TABLE t8; Table Create Table t8 CREATE TABLE `t8` ( `g` datetime DEFAULT current_timestamp() -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t8; g 1970-04-11 20:13:57 @@ -715,7 +715,7 @@ SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( `h` datetime DEFAULT NULL ON UPDATE current_timestamp() -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t9; h NULL @@ -724,7 +724,7 @@ SHOW CREATE TABLE t10; Table Create Table t10 CREATE TABLE `t10` ( `i` datetime DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t10; i NULL @@ -733,7 +733,7 @@ SHOW CREATE TABLE t11; Table Create Table t11 CREATE TABLE `t11` ( `j` datetime DEFAULT '1986-09-27 03:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t11; j 1986-09-27 03:00:00 @@ -775,7 +775,7 @@ t12 CREATE TABLE `t12` ( `h` datetime DEFAULT NULL ON UPDATE current_timestamp(), `i` datetime DEFAULT NULL, `j` datetime DEFAULT '1986-09-27 03:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12; # 1970-04-11 20:13:57 UTC SET TIMESTAMP = 8712837.164953; @@ -794,7 +794,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a 1970-04-11 20:13:57 @@ -803,7 +803,7 @@ SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `b` datetime DEFAULT current_timestamp() -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t3; b 1970-04-11 20:13:57 @@ -812,7 +812,7 @@ SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `c` datetime DEFAULT NULL ON UPDATE current_timestamp() -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t4; c NULL @@ -821,7 +821,7 @@ SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( `d` datetime DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t5; d NULL @@ -830,7 +830,7 @@ SHOW CREATE TABLE t6; Table Create Table t6 CREATE TABLE `t6` ( `e` datetime DEFAULT '1986-09-27 03:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t6; e 1986-09-27 03:00:00 @@ -850,7 +850,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET TIMESTAMP = 2000.876543; INSERT INTO t2( a ) VALUES ( 3 ); SELECT * FROM t2; @@ -1234,7 +1234,7 @@ t1 CREATE TABLE `t1` ( `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOAD DATA INFILE "file1.dat" IGNORE INTO table t1; Warnings: Warning 1261 Row 1 doesn't contain data for all columns @@ -1286,7 +1286,7 @@ t1 CREATE TABLE `t1` ( `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOAD DATA INFILE "file1.dat" IGNORE INTO table t1; Warnings: Warning 1261 Row 1 doesn't contain data for all columns @@ -1353,7 +1353,7 @@ t1 CREATE TABLE `t1` ( `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOAD DATA INFILE "file2.dat" IGNORE INTO table t1; Warnings: Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 @@ -1391,7 +1391,7 @@ t1 CREATE TABLE `t1` ( `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOAD DATA INFILE "file2.dat" IGNORE INTO table t1; Warnings: Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 @@ -1431,7 +1431,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 ( a ) VALUES ( 1 ); SELECT * FROM t1; a b @@ -2031,7 +2031,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), c TIMESTAMP(6) NULL ); ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) FIRST; @@ -2041,7 +2041,7 @@ t1 CREATE TABLE `t1` ( `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NULL ); ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) FIRST; @@ -2050,7 +2050,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), b TIMESTAMP(6) NULL ); ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER b; @@ -2059,7 +2059,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` timestamp(6) NULL DEFAULT NULL, `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), b TIMESTAMP(6) NULL ); ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER b; @@ -2068,7 +2068,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` timestamp(6) NULL DEFAULT NULL, `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(6), b INT, c TIMESTAMP(6) NULL ); SHOW CREATE TABLE t1; @@ -2077,7 +2077,7 @@ t1 CREATE TABLE `t1` ( `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) AFTER b; SHOW CREATE TABLE t1; Table Create Table @@ -2085,7 +2085,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `c` timestamp(6) NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(6), b INT, c TIMESTAMP(6) NULL ); ALTER TABLE t1 MODIFY c TIMESTAMP(6) NULL FIRST; @@ -2095,7 +2095,7 @@ t1 CREATE TABLE `t1` ( `c` timestamp(6) NULL DEFAULT NULL, `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMESTAMP(6), b INT, c TIMESTAMP(6) NULL ); SHOW CREATE TABLE t1; @@ -2104,7 +2104,7 @@ t1 CREATE TABLE `t1` ( `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMESTAMP(6) AFTER b; SHOW CREATE TABLE t1; Table Create Table @@ -2112,7 +2112,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `c` timestamp(6) NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMESTAMP(6), b INT, c TIMESTAMP(6) NULL ); ALTER TABLE t1 MODIFY c TIMESTAMP(6) NULL FIRST; @@ -2122,7 +2122,7 @@ t1 CREATE TABLE `t1` ( `c` timestamp(6) NULL DEFAULT NULL, `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Test of ALTER TABLE, adding columns. @@ -2134,7 +2134,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Test of INSERT SELECT. @@ -2198,7 +2198,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a 1970-04-11 20:13:57.657897 @@ -2207,7 +2207,7 @@ SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t3; b 1970-04-11 20:13:57.657897 @@ -2216,7 +2216,7 @@ SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t4; c 0000-00-00 00:00:00.000000 @@ -2225,7 +2225,7 @@ SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( `d` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t5; d 1986-09-27 03:00:00.098765 @@ -2234,7 +2234,7 @@ SHOW CREATE TABLE t6; Table Create Table t6 CREATE TABLE `t6` ( `e` timestamp(6) NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t6; e NULL @@ -2243,7 +2243,7 @@ SHOW CREATE TABLE t7; Table Create Table t7 CREATE TABLE `t7` ( `f` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t7; f 1970-04-11 20:13:57.657897 @@ -2252,7 +2252,7 @@ SHOW CREATE TABLE t8; Table Create Table t8 CREATE TABLE `t8` ( `g` datetime(6) DEFAULT current_timestamp(6) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t8; g 1970-04-11 20:13:57.657897 @@ -2261,7 +2261,7 @@ SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( `h` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t9; h NULL @@ -2270,7 +2270,7 @@ SHOW CREATE TABLE t10; Table Create Table t10 CREATE TABLE `t10` ( `i` datetime(6) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t10; i NULL @@ -2279,7 +2279,7 @@ SHOW CREATE TABLE t11; Table Create Table t11 CREATE TABLE `t11` ( `j` datetime(6) DEFAULT '1986-09-27 03:00:00.098765' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t11; j 1986-09-27 03:00:00.098765 @@ -2321,7 +2321,7 @@ t12 CREATE TABLE `t12` ( `h` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6), `i` datetime(6) DEFAULT NULL, `j` datetime(6) DEFAULT '1986-09-27 03:00:00.098765' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12; # 1970-04-11 20:13:57 UTC SET TIMESTAMP = 8712837.164953; @@ -2340,7 +2340,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a 1970-04-11 20:13:57.164953 @@ -2349,7 +2349,7 @@ SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `b` datetime(6) DEFAULT current_timestamp(6) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t3; b 1970-04-11 20:13:57.164953 @@ -2358,7 +2358,7 @@ SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `c` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t4; c NULL @@ -2367,7 +2367,7 @@ SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( `d` datetime(6) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t5; d NULL @@ -2376,7 +2376,7 @@ SHOW CREATE TABLE t6; Table Create Table t6 CREATE TABLE `t6` ( `e` datetime(6) DEFAULT '1986-09-27 03:00:00.098765' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t6; e 1986-09-27 03:00:00.098765 @@ -2396,7 +2396,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET TIMESTAMP = 2000.876543; INSERT INTO t2( a ) VALUES ( 3 ); SELECT * FROM t2; @@ -2780,7 +2780,7 @@ t1 CREATE TABLE `t1` ( `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOAD DATA INFILE "file1.dat" IGNORE INTO table t1; Warnings: Warning 1261 Row 1 doesn't contain data for all columns @@ -2832,7 +2832,7 @@ t1 CREATE TABLE `t1` ( `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOAD DATA INFILE "file1.dat" IGNORE INTO table t1; Warnings: Warning 1261 Row 1 doesn't contain data for all columns @@ -2899,7 +2899,7 @@ t1 CREATE TABLE `t1` ( `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOAD DATA INFILE "file2.dat" IGNORE INTO table t1; Warnings: Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 @@ -2937,7 +2937,7 @@ t1 CREATE TABLE `t1` ( `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOAD DATA INFILE "file2.dat" IGNORE INTO table t1; Warnings: Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 @@ -2977,7 +2977,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 ( a ) VALUES ( 1 ); SELECT * FROM t1; a b diff --git a/mysql-test/main/get_diagnostics.result b/mysql-test/main/get_diagnostics.result index 2e749fa21d78c..48eab8e07341d 100644 --- a/mysql-test/main/get_diagnostics.result +++ b/mysql-test/main/get_diagnostics.result @@ -790,6 +790,19 @@ SHOW STATUS LIKE 'Com%get_diagnostics'; Variable_name Value Com_get_diagnostics 1 # +# MDEV-26695: Number of an invalid row is not calculated for table value constructor +# +CREATE TABLE t1 (a CHAR(1)) VALUES ('a'),('b'),('foo'); +Warnings: +Warning 1406 Data too long for column 'a' at row 3 +CREATE TABLE t2 (a char(1)) VALUES ('a'),('b') UNION VALUES ('foo'); +Warnings: +Warning 1406 Data too long for column 'a' at row 3 +DROP TABLE t1, t2; +# +# End of 10.6 tests +# +# # MDEV-10075: Provide index of error causing error in array INSERT # # @@ -1139,11 +1152,11 @@ SELECT @var62, @var63; @var62 @var63 1 NULL INSERT INTO t1 SELECT id2, val2, p2 from t2; -ERROR 22007: Incorrect double value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x004@\x00\x00\x00\x00\x00\x00$@' for column `test`.`t1`.`d1` at row 1 +ERROR HY000: Cannot cast 'point' as 'double' in assignment of `test`.`t1`.`d1` GET DIAGNOSTICS CONDITION 1 @var64= ROW_NUMBER; GET DIAGNOSTICS CONDITION 2 @var65= ROW_NUMBER; Warnings: -Error 1366 Incorrect double value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x004@\x00\x00\x00\x00\x00\x00$@' for column `test`.`t1`.`d1` at row 1 +Error 4078 Cannot cast 'point' as 'double' in assignment of `test`.`t1`.`d1` Error 1758 Invalid condition number SELECT @var64, @var65; @var64 @var65 @@ -1383,11 +1396,11 @@ SELECT @var103, @var104; @var103 @var104 1 NULL INSERT INTO t1 SELECT id2, val2, p2 from t2; -ERROR 22007: Incorrect double value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x004@\x00\x00\x00\x00\x00\x00$@' for column `test`.`t1`.`d1` at row 1 +ERROR HY000: Cannot cast 'point' as 'double' in assignment of `test`.`t1`.`d1` GET DIAGNOSTICS CONDITION 1 @var105= ROW_NUMBER; GET DIAGNOSTICS CONDITION 2 @var106= ROW_NUMBER; Warnings: -Error 1366 Incorrect double value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x004@\x00\x00\x00\x00\x00\x00$@' for column `test`.`t1`.`d1` at row 1 +Error 4078 Cannot cast 'point' as 'double' in assignment of `test`.`t1`.`d1` Error 1758 Invalid condition number SELECT @var105, @var106; @var105 @var106 @@ -1798,16 +1811,54 @@ val2 val4 DELETE FROM t WHERE a = 100; Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'val1' -Warning 1292 Truncated incorrect DOUBLE value: 'val2' -Warning 1292 Truncated incorrect DOUBLE value: 'val4' +Warning 1292 Truncated incorrect DECIMAL value: 'val1' +Warning 1292 Truncated incorrect DECIMAL value: 'val2' +Warning 1292 Truncated incorrect DECIMAL value: 'val4' SHOW WARNINGS; Level Code Message -Warning 1292 Truncated incorrect DOUBLE value: 'val1' -Warning 1292 Truncated incorrect DOUBLE value: 'val2' -Warning 1292 Truncated incorrect DOUBLE value: 'val4' +Warning 1292 Truncated incorrect DECIMAL value: 'val1' +Warning 1292 Truncated incorrect DECIMAL value: 'val2' +Warning 1292 Truncated incorrect DECIMAL value: 'val4' GET DIAGNOSTICS CONDITION 3 @n = ROW_NUMBER; SELECT @n; @n 4 DROP TABLE t; +# +# MDEV-26695: Number of an invalid row is not calculated for table value constructor +# +CREATE TABLE t1 (a CHAR(1)) VALUES ('a'),('b'),('foo'); +Warnings: +Warning 1406 Data too long for column 'a' at row 3 +GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER; +SELECT @n; +@n +3 +CREATE TABLE t2 (a CHAR(1)) VALUES ('a'),('b') UNION VALUES ('foo'); +Warnings: +Warning 1406 Data too long for column 'a' at row 3 +GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER; +SELECT @n; +@n +3 +DROP TABLE t1, t2; +# Checking that CREATE ... SELECT works +CREATE TABLE t1 (val1 CHAR(5)); +INSERT INTO t1 VALUES ('A'),('B'),('C'),('DEF'); +CREATE TABLE t2 (val2 CHAR(1)) SELECT val1 as val2 FROM t1; +Warnings: +Warning 1406 Data too long for column 'val2' at row 4 +GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER; +SELECT @n; +@n +4 +SELECT * FROM t2; +val2 +A +B +C +D +DROP TABLE t1,t2; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/get_diagnostics.test b/mysql-test/main/get_diagnostics.test index e8d81dca1e6b0..27c980693848e 100644 --- a/mysql-test/main/get_diagnostics.test +++ b/mysql-test/main/get_diagnostics.test @@ -359,10 +359,13 @@ SHOW WARNINGS; --echo # Statement information runtime --echo +#enable after fix MDEV-28535 +--disable_view_protocol SELECT CAST(-19999999999999999999 AS SIGNED), CAST(-19999999999999999999 AS SIGNED); GET DIAGNOSTICS @var = NUMBER; SELECT @var; +--enable_view_protocol SELECT COUNT(max_questions) INTO @var FROM mysql.user; GET DIAGNOSTICS @var = NUMBER; @@ -854,6 +857,19 @@ SHOW STATUS LIKE 'Com%get_diagnostics'; GET DIAGNOSTICS @var1 = NUMBER; SHOW STATUS LIKE 'Com%get_diagnostics'; +--echo # +--echo # MDEV-26695: Number of an invalid row is not calculated for table value constructor +--echo # + +CREATE TABLE t1 (a CHAR(1)) VALUES ('a'),('b'),('foo'); +CREATE TABLE t2 (a char(1)) VALUES ('a'),('b') UNION VALUES ('foo'); + +DROP TABLE t1, t2; + +--echo # +--echo # End of 10.6 tests +--echo # + --echo # --echo # MDEV-10075: Provide index of error causing error in array INSERT --echo # @@ -1078,7 +1094,7 @@ GET DIAGNOSTICS CONDITION 1 @var62= ROW_NUMBER; GET DIAGNOSTICS CONDITION 2 @var63= ROW_NUMBER; SELECT @var62, @var63; ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 SELECT id2, val2, p2 from t2; GET DIAGNOSTICS CONDITION 1 @var64= ROW_NUMBER; GET DIAGNOSTICS CONDITION 2 @var65= ROW_NUMBER; @@ -1264,7 +1280,7 @@ GET DIAGNOSTICS CONDITION 1 @var103= ROW_NUMBER; GET DIAGNOSTICS CONDITION 2 @var104= ROW_NUMBER; SELECT @var103, @var104; ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 SELECT id2, val2, p2 from t2; GET DIAGNOSTICS CONDITION 1 @var105= ROW_NUMBER; GET DIAGNOSTICS CONDITION 2 @var106= ROW_NUMBER; @@ -1687,3 +1703,32 @@ GET DIAGNOSTICS CONDITION 3 @n = ROW_NUMBER; SELECT @n; DROP TABLE t; + +--echo # +--echo # MDEV-26695: Number of an invalid row is not calculated for table value constructor +--echo # + +CREATE TABLE t1 (a CHAR(1)) VALUES ('a'),('b'),('foo'); +GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER; +SELECT @n; +CREATE TABLE t2 (a CHAR(1)) VALUES ('a'),('b') UNION VALUES ('foo'); +GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER; +SELECT @n; + +DROP TABLE t1, t2; + +--echo # Checking that CREATE ... SELECT works + +CREATE TABLE t1 (val1 CHAR(5)); +INSERT INTO t1 VALUES ('A'),('B'),('C'),('DEF'); +CREATE TABLE t2 (val2 CHAR(1)) SELECT val1 as val2 FROM t1; +GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER; +SELECT @n; +SELECT * FROM t2; + +DROP TABLE t1,t2; + +--echo # +--echo # End of 10.7 tests +--echo # + diff --git a/mysql-test/main/gis-debug.result b/mysql-test/main/gis-debug.result index f490a720ecf25..7d143ad3f4507 100644 --- a/mysql-test/main/gis-debug.result +++ b/mysql-test/main/gis-debug.result @@ -380,7 +380,7 @@ t1 CREATE TABLE `t1` ( `POINT(0,0)*'0'` tinytext DEFAULT NULL, `POINT(0,0)/'0'` tinytext DEFAULT NULL, `POINT(0,0) MOD '0'` tinytext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT '0'+POINT(0,0), @@ -390,7 +390,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `'0'+POINT(0,0)` tinytext DEFAULT NULL, `'0'*POINT(0,0)` tinytext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT '0'-POINT(0,0) LIMIT 0; ERROR HY000: Illegal parameter data types varchar and point for operation '-' diff --git a/mysql-test/main/gis-debug.test b/mysql-test/main/gis-debug.test index 0e11c11e5b5d5..1c6bf5fcb1977 100644 --- a/mysql-test/main/gis-debug.test +++ b/mysql-test/main/gis-debug.test @@ -161,12 +161,14 @@ SET SESSION debug_dbug="-d,cmp_item"; --echo # MDEV-19994 Add class Function_collection --echo # +--disable_service_connection SET SESSION debug_dbug="+d,make_item_func_call_native_simulate_not_found"; --error ER_PARSE_ERROR SELECT CONTAINS(POINT(1,1),POINT(1,1)); --error ER_PARSE_ERROR SELECT WITHIN(POINT(1,1),POINT(1,1)); SET SESSION debug_dbug="-d,make_item_func_call_native_simulate_not_found"; +--enable_service_connection --echo # --echo # MDEV-20009 Add CAST(expr AS pluggable_type) diff --git a/mysql-test/main/gis-json.result b/mysql-test/main/gis-json.result index ace9e9e9ae2a6..644684f5a73e6 100644 --- a/mysql-test/main/gis-json.result +++ b/mysql-test/main/gis-json.result @@ -58,6 +58,9 @@ Warning 4038 Syntax error in JSON text in argument 1 to function 'st_geomfromgeo SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }')); st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }')) POINT(102 0.5) +SELECT st_astext(st_geomfromgeojson('{ "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "type": "Feature" }')); +st_astext(st_geomfromgeojson('{ "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "type": "Feature" }')) +POINT(102 0.5) SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}')); st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}')) GEOMETRYCOLLECTION(POINT(102 0.5)) diff --git a/mysql-test/main/gis-json.test b/mysql-test/main/gis-json.test index ff6298c50a671..cda395acab52b 100644 --- a/mysql-test/main/gis-json.test +++ b/mysql-test/main/gis-json.test @@ -1,5 +1,7 @@ -- source include/have_geometry.inc +#enable after fix MDEV-27871 +--disable_view_protocol select st_asgeojson(geomfromtext('POINT(1 1)')); select st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)')); select st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))')); @@ -15,14 +17,19 @@ SELECT st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[ SELECT st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}')); SELECT st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}')); SELECT st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}')); +--enable_view_protocol SELECT st_astext(st_geomfromgeojson('{"type":"point"}')); SELECT st_astext(st_geomfromgeojson('{"type":"point"')); SELECT st_astext(st_geomfromgeojson('{"type""point"}')); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }')); +SELECT st_astext(st_geomfromgeojson('{ "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "type": "Feature" }')); SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}')); + --error ER_WRONG_VALUE_FOR_TYPE SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',5)); @@ -33,6 +40,8 @@ SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15. SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3)); SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4)); +--enable_view_protocol + SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2); SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),1); SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10); @@ -44,6 +53,8 @@ SELECT st_astext(st_geomfromgeojson('{"type": "MultiLineString","coordinates": [ SELECT st_astext(st_geomfromgeojson('{"type": "Polygon","coordinates": []}')) as a; SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}')) as a; +#enable after fix MDEV-27871 +--disable_view_protocol SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }"); # @@ -53,6 +64,9 @@ SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }"); SELECT ST_ASTEXT (ST_GEOMFROMGEOJSON ('{ "type": "GEOMETRYCOLLECTION", "coordinates": [102.0, 0.0]}')); SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type": ["POINT"], "coINates": [0,0] }')); + +--enable_view_protocol + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/gis-precise.test b/mysql-test/main/gis-precise.test index da72a0c4d8a57..ceaf1f1b89adc 100644 --- a/mysql-test/main/gis-precise.test +++ b/mysql-test/main/gis-precise.test @@ -1,5 +1,5 @@ --- source include/have_geometry.inc - +--source include/no_valgrind_without_big.inc +--source include/have_geometry.inc # # Spatial objects @@ -9,13 +9,15 @@ DROP TABLE IF EXISTS t1; --enable_warnings +#enable after fix MDEV-27871 +--disable_view_protocol select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'), GeomFromText('POLYGON((10 10,30 10,30 30,10 30,10 10))')); select 0, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 40, 40 50, 20 70, 10 40))')); select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POINT(10 10)')); select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); select 0, ST_Within(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); select 1, ST_Within(GeomFromText('POLYGON((1 1,20 10,10 30, 1 1))'), GeomFromText('POLYGON((0 0,30 5,10 40, 0 0))')); - +--enable_view_protocol create table t1 (g point); insert into t1 values @@ -36,6 +38,8 @@ select astext(g) from t1 where ST_Contains(GeomFromText('POLYGON((5 1, 7 1, 7 7, DROP TABLE t1; +#enable after fix MDEV-27871 +--disable_view_protocol select 0, ST_Within(GeomFromText('LINESTRING(15 15, 50 50, 60 60)'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); select 1, ST_Within(GeomFromText('LINESTRING(15 15, 16 16)'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); @@ -80,6 +84,8 @@ select astext(ST_symdifference(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), ge --replace_result 7.999999999999999 8 select astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))); +--enable_view_protocol + # Buffer() tests --replace_result 0012045437948276 00120454379482759 select astext(ST_buffer(geometryfromtext('point(1 1)'), 1)); @@ -97,6 +103,9 @@ select ST_NUMPOINTS(ST_EXTERIORRING(@buff)); # cleanup DROP TABLE t1; +#enable after fix MDEV-27871 +--disable_view_protocol + #Touches tests select st_touches(geomfromtext('point(0 0)'), geomfromtext('point(1 1)')); select st_touches(geomfromtext('point(1 1)'), geomfromtext('point(1 1)')); @@ -111,6 +120,7 @@ SELECT ST_Equals(PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13 SELECT ST_Equals(PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),PolyFromText('POLYGON((67 13, 67 18, 59 18, 59 13, 59 13, 67 13) )')) as result; SELECT ST_Equals(PointFromText('POINT (12 13)'),PointFromText('POINT (12 13)')) as result; +--enable_view_protocol --echo # --echo # BUG#11755628/47429: INTERSECTION FUNCTION CRASHED MYSQLD @@ -140,19 +150,30 @@ SELECT ASTEXT(TOUCHES(@a, GEOMFROMTEXT('point(0 0)'))) t; # bug #801243 Assertion `(0)' failed in Gis_geometry_collection::init_from_opresult on ST_UNION +#enable after fix MDEV-27871 +--disable_view_protocol + SELECT astext(ST_UNION ( PolyFromText('POLYGON(( 2 2 ,3 2,2 7,2 2),( 0 0,8 2,1 9,0 0))'), ExteriorRing( Envelope( MultiLineStringFromText('MULTILINESTRING((3 4,5 3),(3 0,0 5))'))))); +--enable_view_protocol + #bug 801189 ST_BUFFER asserts if radius = 0 SELECT astext(ST_BUFFER(LineStringFromText('LINESTRING(0 0,1 1)'),0)); +#enable after fix MDEV-27871 +--disable_view_protocol #bug 801199 Infinite recursion in Gcalc_function::count_internal with ST_BUFFER over MULTIPOINT SELECT Round(ST_Area(ST_BUFFER(MultipointFromText('MULTIPOINT(7 7,3 7,7 2,7 4 ,7 7)'), 3)), 5); +--enable_view_protocol #bug 801212 Assertion with ST_INTERSECTION on NULL values SELECT ST_INTERSECTION(NULL, NULL); +#enable after fix MDEV-27871 +--disable_view_protocol + #bug 804305 Crash in wkb_get_double with ST_INTERSECTION SELECT ASTEXT(ST_INTERSECTION( MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)), @@ -382,6 +403,8 @@ SELECT ST_RELATE( 'F*FFFF**F' ) as relate_res; +--enable_view_protocol + # MDEV-18920 Prepared statements with st_convexhull hang and eat 100% cpu. prepare s from 'do st_convexhull(st_aswkb(multipoint(point(-11702,15179),point(-5031,27960),point(-30557,11158),point(-27804,30314))))'; execute s; @@ -421,6 +444,8 @@ SELECT ST_DISTANCE_SPHERE(1, 1, NULL); --error ER_INTERNAL_ERROR SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)')); +#enable after fix MDEV-27871 +--disable_view_protocol --echo # Test Points and radius SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)')); # make bb x86 happy @@ -455,6 +480,8 @@ SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_G --error ER_INTERNAL_ERROR SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0); +--enable_view_protocol + # Longitude out of range [-180,180] set @pt1 = ST_GeomFromText('POINT(190 -30)'); set @pt2 = ST_GeomFromText('POINT(-30 50)'); diff --git a/mysql-test/main/gis-rt-precise.result b/mysql-test/main/gis-rt-precise.result index d3308ed90bab8..d591fa5524554 100644 --- a/mysql-test/main/gis-rt-precise.result +++ b/mysql-test/main/gis-rt-precise.result @@ -11,7 +11,7 @@ t1 CREATE TABLE `t1` ( `g` geometry NOT NULL, PRIMARY KEY (`fid`), SPATIAL KEY `g` (`g`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT count(*) FROM t1; count(*) 150 @@ -44,7 +44,7 @@ t1 CREATE TABLE `t1` ( `g` geometry NOT NULL, PRIMARY KEY (`fid`), SPATIAL KEY `g` (`g`) -) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT count(*) FROM t1; count(*) 100 diff --git a/mysql-test/main/gis-rtree.result b/mysql-test/main/gis-rtree.result index 5f0187eaa30c5..4ca50fcfd9ab6 100644 --- a/mysql-test/main/gis-rtree.result +++ b/mysql-test/main/gis-rtree.result @@ -10,7 +10,7 @@ t1 CREATE TABLE `t1` ( `g` geometry NOT NULL, PRIMARY KEY (`fid`), SPATIAL KEY `g` (`g`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (g) VALUES (GeomFromText('LineString(150 150, 150 150)')); INSERT INTO t1 (g) VALUES (GeomFromText('LineString(149 149, 151 151)')); INSERT INTO t1 (g) VALUES (GeomFromText('LineString(148 148, 152 152)')); @@ -293,7 +293,7 @@ t2 CREATE TABLE `t2` ( `g` geometry NOT NULL, PRIMARY KEY (`fid`), SPATIAL KEY `g` (`g`) -) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT count(*) FROM t2; count(*) 100 diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result index 2756dffff1741..5b323bb598c8c 100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@ -610,7 +610,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `GeomFromWKB(POINT(1,3))` geometry DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo` geometry NOT NULL default '') ENGINE=MyISAM ; @@ -688,9 +688,9 @@ object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo)) drop table t1; create table t1 (fl geometry not null); insert into t1 values (1); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t1`.`fl` insert into t1 values (1.11); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Cannot cast 'decimal' as 'geometry' in assignment of `test`.`t1`.`fl` insert into t1 values ("qwerty"); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 values (pointfromtext('point(1,1)')); @@ -1654,8 +1654,8 @@ SELECT 1 FROM g1 WHERE a >= ANY (SELECT 1 FROM g1 WHERE a = geomfromtext('') OR a) ; 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' DROP TABLE g1; # # Bug#16451878 GEOMETRY QUERY CRASHES SERVER @@ -1746,28 +1746,28 @@ drop table t1; SHOW CREATE TABLE information_schema.geometry_columns; Table Create Table GEOMETRY_COLUMNS CREATE TEMPORARY TABLE `GEOMETRY_COLUMNS` ( - `F_TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `F_TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `F_TABLE_NAME` varchar(64) NOT NULL DEFAULT '', - `F_GEOMETRY_COLUMN` varchar(64) NOT NULL DEFAULT '', - `G_TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `G_TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `G_TABLE_NAME` varchar(64) NOT NULL DEFAULT '', - `G_GEOMETRY_COLUMN` varchar(64) NOT NULL DEFAULT '', - `STORAGE_TYPE` tinyint(2) NOT NULL DEFAULT 0, - `GEOMETRY_TYPE` int(7) NOT NULL DEFAULT 0, - `COORD_DIMENSION` tinyint(2) NOT NULL DEFAULT 0, - `MAX_PPR` tinyint(2) NOT NULL DEFAULT 0, - `SRID` smallint(5) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `F_TABLE_CATALOG` varchar(512) NOT NULL, + `F_TABLE_SCHEMA` varchar(64) NOT NULL, + `F_TABLE_NAME` varchar(64) NOT NULL, + `F_GEOMETRY_COLUMN` varchar(64) NOT NULL, + `G_TABLE_CATALOG` varchar(512) NOT NULL, + `G_TABLE_SCHEMA` varchar(64) NOT NULL, + `G_TABLE_NAME` varchar(64) NOT NULL, + `G_GEOMETRY_COLUMN` varchar(64) NOT NULL, + `STORAGE_TYPE` tinyint(2) NOT NULL, + `GEOMETRY_TYPE` int(7) NOT NULL, + `COORD_DIMENSION` tinyint(2) NOT NULL, + `MAX_PPR` tinyint(2) NOT NULL, + `SRID` smallint(5) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE information_schema.spatial_ref_sys; Table Create Table SPATIAL_REF_SYS CREATE TEMPORARY TABLE `SPATIAL_REF_SYS` ( - `SRID` smallint(5) NOT NULL DEFAULT 0, - `AUTH_NAME` varchar(512) NOT NULL DEFAULT '', - `AUTH_SRID` int(5) NOT NULL DEFAULT 0, - `SRTEXT` varchar(2048) NOT NULL DEFAULT '' -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `SRID` smallint(5) NOT NULL, + `AUTH_NAME` varchar(512) NOT NULL, + `AUTH_SRID` int(5) NOT NULL, + `SRTEXT` varchar(2048) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci create table t1(g GEOMETRY, pt POINT); create table t2(g LINESTRING, pl POLYGON); select * from information_schema.geometry_columns where f_table_schema='test'; @@ -1791,7 +1791,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `CONTAINS(NULL, NULL)` int(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-7334 valgrind warning "unitialized bytes" in 10.1. @@ -1867,7 +1867,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `w1` int(1) DEFAULT NULL, `w2` int(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE TABLE t1 ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, @@ -1904,7 +1904,7 @@ t1 CREATE TABLE `t1` ( `a` point DEFAULT NULL, `x` double DEFAULT st_x(`a`), `y` double DEFAULT st_y(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (Point(1,2)); SELECT x,y FROM t1; x y @@ -1916,7 +1916,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `g` geometry DEFAULT NULL, `area` double DEFAULT st_area(`g`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (g) VALUES (GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))')); SELECT area FROM t1; area @@ -1928,7 +1928,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `g` geometry DEFAULT NULL, `length` double DEFAULT st_length(`g`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (g) VALUES (GeomFromText('LINESTRING(0 0,20 0,20 20,0 20,0 0)')); SELECT length FROM t1; length @@ -1940,7 +1940,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `g` point DEFAULT NULL, `distance` double DEFAULT st_distance(`g`,point(0,0)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (g) VALUES (Point(1,0)); SELECT distance FROM t1; distance @@ -1952,7 +1952,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` text DEFAULT NULL, `g` geometry DEFAULT st_geometryfromtext(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('point(1 1)'); SELECT AsText(g) FROM t1; AsText(g) @@ -1965,7 +1965,7 @@ t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL, `y` int(11) DEFAULT NULL, `g` geometry DEFAULT point(`x`,`y`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (x,y) VALUES (10,20); SELECT AsText(g) FROM t1; AsText(g) @@ -1977,7 +1977,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT st_pointn(`a`,2) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)')); SELECT AsText(b) FROM t1; AsText(b) @@ -1989,7 +1989,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT st_startpoint(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)')); SELECT AsText(b) FROM t1; AsText(b) @@ -2002,7 +2002,7 @@ t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT NULL, `c` geometry DEFAULT geometrycollection(`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES (Point(1,1), Point(2,2)); SELECT AsText(c) FROM t1; AsText(c) @@ -2014,7 +2014,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT st_geometryfromwkb(st_aswkb(`a`),20) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (GeomFromText('POINT(1 1)', 10)); SELECT AsText(a), SRID(a), AsText(b), SRID(b) FROM t1; AsText(a) SRID(a) AsText(b) SRID(b) @@ -2026,7 +2026,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT st_boundary(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); SELECT AsText(b) FROM t1; AsText(b) @@ -2038,7 +2038,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT st_buffer(`a`,10) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); SELECT GeometryType(b) FROM t1; GeometryType(b) @@ -2050,7 +2050,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT st_centroid(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); SELECT AsText(b) FROM t1; AsText(b) @@ -2062,7 +2062,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT st_envelope(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,4 4)')); SELECT AsText(b) FROM t1; AsText(b) @@ -2074,7 +2074,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT st_pointonsurface(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); SELECT GeometryType(b) FROM t1; GeometryType(b) @@ -2087,7 +2087,7 @@ t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT point(1,1), `c` geometry DEFAULT st_union(`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (Point(0,0)); SELECT AsText(c) FROM t1; AsText(c) @@ -2099,7 +2099,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` varchar(20) DEFAULT st_geometrytype(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (Point(0, 0)); SELECT b FROM t1; b @@ -2111,7 +2111,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` int(11) DEFAULT st_issimple(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (Point(0, 0)); SELECT b FROM t1; b @@ -2123,7 +2123,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` int(11) DEFAULT st_isempty(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (Point(0, 0)); SELECT b FROM t1; b @@ -2135,7 +2135,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` int(11) DEFAULT st_isring(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)')); SELECT b FROM t1; b @@ -2147,7 +2147,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` int(11) DEFAULT st_isclosed(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)')); SELECT b FROM t1; b @@ -2159,7 +2159,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` int(11) DEFAULT st_dimension(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (Buffer(Point(1,1),1)); SELECT b FROM t1; b @@ -2171,7 +2171,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` int(11) DEFAULT st_numgeometries(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (ST_UNION(Point(1,1),Point(0,0))); SELECT b FROM t1; b @@ -2183,7 +2183,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` int(11) DEFAULT st_numinteriorrings(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))')); SELECT b FROM t1; b @@ -2195,7 +2195,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` int(11) DEFAULT st_numpoints(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (LineString(Point(1,1),Point(0,0))); SELECT b FROM t1; b @@ -2207,7 +2207,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` int(11) DEFAULT srid(`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (GeomFromText('Point(1 1)', 100)); SELECT b FROM t1; b @@ -2220,7 +2220,7 @@ t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT NULL, `c` int(11) DEFAULT mbrdisjoint(`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); SELECT c FROM t1; c @@ -2233,7 +2233,7 @@ t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT NULL, `c` int(11) DEFAULT st_disjoint(`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); SELECT c FROM t1; c @@ -2246,7 +2246,7 @@ t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT NULL, `c` int(11) DEFAULT st_relate(`a`,`b`,'T*F**FFF*') -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); SELECT c FROM t1; c @@ -2315,31 +2315,31 @@ CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `IF(TRUE,a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `IFNULL(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `a` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ------------------------------------- CREATE TABLE t1 (a VARCHAR(10), b Point) @@ -2347,31 +2347,31 @@ CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `IF(TRUE,a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `IFNULL(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `a` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ------------------------------------- CREATE TABLE t1 (a TINYTEXT, b Point) @@ -2379,31 +2379,31 @@ CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `IF(TRUE,a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `IFNULL(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `a` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ------------------------------------- CREATE TABLE t1 (a TEXT, b Point) @@ -2411,31 +2411,31 @@ CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `IF(TRUE,a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `IFNULL(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `a` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ------------------------------------- CREATE TABLE t1 (a MEDIUMTEXT, b Point) @@ -2443,31 +2443,31 @@ CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `IF(TRUE,a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `IFNULL(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `a` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ------------------------------------- CREATE TABLE t1 (a LONGTEXT, b Point) @@ -2475,31 +2475,31 @@ CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `IF(TRUE,a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `IFNULL(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `a` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ------------------------------------- CREATE TABLE t1 (a TINYINT, b Point) @@ -2816,25 +2816,25 @@ CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `IF(TRUE,a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `IFNULL(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 ERROR: @@ -2846,25 +2846,25 @@ CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `IF(TRUE,a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `IFNULL(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 ERROR: @@ -2874,14 +2874,14 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `COALESCE(NULL, Point(1,1))` point DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT NULL UNION SELECT Point(1,1); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `NULL` point DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; DROP PROCEDURE p2; @@ -3823,7 +3823,7 @@ CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `LEAST(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ------------------------------------- CREATE TABLE t1 (a VARCHAR(10), b Point) @@ -3831,7 +3831,7 @@ CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `LEAST(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ------------------------------------- CREATE TABLE t1 (a TINYTEXT, b Point) @@ -3839,7 +3839,7 @@ CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `LEAST(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ------------------------------------- CREATE TABLE t1 (a TEXT, b Point) @@ -3847,7 +3847,7 @@ CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `LEAST(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ------------------------------------- CREATE TABLE t1 (a MEDIUMTEXT, b Point) @@ -3855,7 +3855,7 @@ CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `LEAST(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ------------------------------------- CREATE TABLE t1 (a LONGTEXT, b Point) @@ -3863,7 +3863,7 @@ CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `LEAST(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ------------------------------------- CREATE TABLE t1 (a TINYINT, b Point) @@ -3956,7 +3956,7 @@ CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `LEAST(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ------------------------------------- CREATE TABLE t1 (a SET(0x61), b Point) @@ -3964,13 +3964,13 @@ CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 Table Create Table t2 CREATE TABLE `t2` ( `LEAST(a,b)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t1 AS SELECT LEAST(NULL, Point(1,1)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `LEAST(NULL, Point(1,1))` point DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; DROP PROCEDURE p2; @@ -4215,14 +4215,14 @@ t1 CREATE TABLE `t1` ( `p0` point DEFAULT NULL, `p1` point DEFAULT NULL, `p2` point DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT LEAST(Point(0,0),Point(0,0)) AS p1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `p1` point DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( c_geometry GEOMETRY, @@ -4255,7 +4255,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(NULL, c_multilinestring)` multilinestring DEFAULT NULL, `COALESCE(NULL, c_multipolygon)` multipolygon DEFAULT NULL, `COALESCE(NULL, c_geometrycollection)` geometrycollection DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT COALESCE(c_geometry, NULL), @@ -4278,7 +4278,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(c_multilinestring, NULL)` multilinestring DEFAULT NULL, `COALESCE(c_multipolygon, NULL)` multipolygon DEFAULT NULL, `COALESCE(c_geometrycollection, NULL)` geometrycollection DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT COALESCE(c_geometry, c_geometry), @@ -4301,7 +4301,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(c_multilinestring, c_multilinestring)` multilinestring DEFAULT NULL, `COALESCE(c_multipolygon, c_multipolygon)` multipolygon DEFAULT NULL, `COALESCE(c_geometrycollection, c_geometrycollection)` geometrycollection DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -4312,7 +4312,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` point DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE PROCEDURE p1(name TEXT) BEGIN @@ -4331,56 +4331,56 @@ t2 CREATE TABLE `t2` ( `a1` geometry DEFAULT NULL, `a2` geometry DEFAULT NULL, `a3` geometry DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CALL p1('point'); Table Create Table t2 CREATE TABLE `t2` ( `a1` point DEFAULT NULL, `a2` point DEFAULT NULL, `a3` point DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CALL p1('linestring'); Table Create Table t2 CREATE TABLE `t2` ( `a1` linestring DEFAULT NULL, `a2` linestring DEFAULT NULL, `a3` linestring DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CALL p1('polygon'); Table Create Table t2 CREATE TABLE `t2` ( `a1` polygon DEFAULT NULL, `a2` polygon DEFAULT NULL, `a3` polygon DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CALL p1('multipoint'); Table Create Table t2 CREATE TABLE `t2` ( `a1` multipoint DEFAULT NULL, `a2` multipoint DEFAULT NULL, `a3` multipoint DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CALL p1('multilinestring'); Table Create Table t2 CREATE TABLE `t2` ( `a1` multilinestring DEFAULT NULL, `a2` multilinestring DEFAULT NULL, `a3` multilinestring DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CALL p1('multipolygon'); Table Create Table t2 CREATE TABLE `t2` ( `a1` multipolygon DEFAULT NULL, `a2` multipolygon DEFAULT NULL, `a3` multipolygon DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CALL p1('geometrycollection'); Table Create Table t2 CREATE TABLE `t2` ( `a1` geometrycollection DEFAULT NULL, `a2` geometrycollection DEFAULT NULL, `a3` geometrycollection DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP PROCEDURE p1; # # MDEV-12798 Item_param does not preserve exact field type in EXECUTE IMMEDIATE 'CREATE TABLE AS SELECT ?' USING POINT(1,1) @@ -4390,7 +4390,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `?` point NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; PREPARE stmt FROM 'CREATE OR REPLACE TABLE t1 AS SELECT ?'; EXECUTE stmt USING POINT(1,1); @@ -4398,7 +4398,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `?` point NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions @@ -4455,7 +4455,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `g` polygon DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT ST_ASTEXT(g) FROM t1; ST_ASTEXT(g) POLYGON((1 1,1 1,1 1,1 1,1 1)) @@ -4471,7 +4471,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `g` geometry DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT ST_GEOMETRYTYPE(g) FROM t1; ST_GEOMETRYTYPE(g) POINT @@ -4522,7 +4522,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `g` geometry DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT ST_ASTEXT(g), SRID(g) FROM t1; ST_ASTEXT(g) SRID(g) POINT(1 1) 1 @@ -4977,6 +4977,15 @@ ERROR HY000: Illegal parameter data type point for operation 'is_free_lock' SELECT IS_USED_LOCK(POINT(1,1)); ERROR HY000: Illegal parameter data type point for operation 'is_used_lock' # +# MDEV-26161 crash in Gis_point::calculate_haversine +# +select st_distance_sphere(x'01030000000400000004000000000000', multipoint(point(124,204)), 10); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +select st_distance_sphere(x'010300000004000000040000', multipoint(point(124,204)), 10); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +select st_distance_sphere(x'010300000001000000040000', multipoint(point(124,204)), 10); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +# # End of 10.3 tests # # @@ -5016,7 +5025,7 @@ t1 CREATE TABLE `t1` ( `COALESCE(POINT(1,1),0x60)` longblob DEFAULT NULL, `LEAST(0x60,POINT(1,1))` longblob DEFAULT NULL, `LEAST(POINT(1,1),0x60)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SELECT 0x60+POINT(1,1); ERROR HY000: Illegal parameter data types bigint unsigned and point for operation '+' diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test index 17a93291b77d3..17151b1bc866b 100644 --- a/mysql-test/main/gis.test +++ b/mysql-test/main/gis.test @@ -122,6 +122,8 @@ SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection; SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection; explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point; +#query plan for view protocol doesn't contain database name +--disable_view_protocol SELECT g1.fid as first, g2.fid as second, Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, @@ -132,6 +134,7 @@ Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; +--enable_view_protocol DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; @@ -366,9 +369,9 @@ t1 where object_id=85984; drop table t1; create table t1 (fl geometry not null); ---error 1416 +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION insert into t1 values (1); ---error 1416 +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION insert into t1 values (1.11); --error 1416 insert into t1 values ("qwerty"); @@ -377,13 +380,18 @@ insert into t1 values (pointfromtext('point(1,1)')); drop table t1; +#enable after fix MDEV-27871 +--disable_view_protocol select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000)))); select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440)))); +--enable_view_protocol --enable_metadata +--disable_view_protocol create table t1 (g GEOMETRY); select * from t1; select asbinary(g) from t1; +--enable_view_protocol --disable_metadata drop table t1; @@ -750,12 +758,15 @@ SET @a=POLYFROMWKB(@a); # Bug #57321 crashes and valgrind errors from spatial types # +#The SELECT statement cannot contain a subquery in the FROM clause +#fore --view-protocol +--disable_view_protocol create table t1(a geometry NOT NULL)engine=myisam; insert into t1 values (geomfromtext("point(0 1)")); insert into t1 values (geomfromtext("point(1 0)")); select * from (select polygon(t1.a) as p from t1 order by t1.a) d; drop table t1; - +--enable_view_protocol --echo # --echo # Test for bug #59888 "debug assertion when attempt to create spatial index @@ -835,6 +846,8 @@ select astext(0x0100000000030000000100000000000010); select astext(st_centroid(0x0100000000030000000100000000000010)); select astext(st_exteriorring(0x0100000000030000000100000000000010)); select envelope(0x0100000000030000000100000000000010); +#enable after fix MDEV-27871 +--disable_view_protocol select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1); select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1); @@ -856,6 +869,7 @@ select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 1 #bug 855336 ST_LENGTH does not work on GEOMETRYCOLLECTIONs select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))')); +--enable_view_protocol # Conformance tests # @@ -1164,6 +1178,9 @@ SELECT AsText(EndPoint(centerline)) FROM road_segments WHERE fid = 102; +#enable after fix MDEV-27871 +--disable_view_protocol + SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) FROM named_places WHERE name = 'Goose Island'; @@ -1173,6 +1190,8 @@ SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) FROM named_places WHERE name = 'Goose Island'; +--enable_view_protocol + --echo # Conformance Item T21 SELECT GLength(centerline) FROM road_segments @@ -1253,11 +1272,15 @@ SELECT Area(shores) FROM ponds WHERE fid = 120; +#enable after fix MDEV-27871 +--disable_view_protocol + --echo # Conformance Item T37 SELECT ST_Equals(boundary, PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) FROM named_places WHERE name = 'Goose Island'; +--enable_view_protocol --echo # Conformance Item T38 SELECT ST_Disjoint(centerlines, boundary) @@ -1289,12 +1312,17 @@ FROM road_segments, divided_routes WHERE road_segments.fid = 102 AND divided_routes.name = 'Route 75'; +#enable after fix MDEV-27871 +--disable_view_protocol + --echo # Conformance Item T43 SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) FROM road_segments, divided_routes WHERE road_segments.fid = 102 AND divided_routes.name = 'Route 75'; +--enable_view_protocol + --echo # Conformance Item T44 SELECT ST_Contains(forests.boundary, named_places.boundary) FROM forests, named_places @@ -1354,6 +1382,8 @@ USE test; --echo # BUG #1043845 st_distance() results are incorrect depending on variable order --echo # +#enable after fix MDEV-27871 +--disable_view_protocol select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461, -95.9673057475387 36.1344478941074, -95.9673063519371 36.134484524621, @@ -1365,6 +1395,8 @@ select st_distance(geomfromtext('point(-95.96269500000000000000 36.1418183333333 -95.9673063519371 36.134484524621, -95.9673049102515 36.1343976584193) ')) ; +--enable_view_protocol + --echo # --echo # MDEV-4310 geometry function equals hangs forever. --echo # @@ -1425,6 +1457,8 @@ SELECT ASTEXT(0x0100000000030000000100000000000010); --echo #should not crash SELECT ENVELOPE(0x0100000000030000000100000000000010); +#enable after fix MDEV-27871 +--disable_view_protocol --echo #should not crash SELECT GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1); @@ -1432,6 +1466,7 @@ SELECT --echo #should not crash SELECT GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1); +--enable_view_protocol --echo # --echo # MDEV-3819 missing constraints for spatial column types @@ -1445,7 +1480,10 @@ drop table t1; # # MDEV-7516 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int) # +#enable after fix MDEV-27871 +--disable_view_protocol SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)); +--enable_view_protocol # # MDEV-7779 View definition changes upon creation @@ -1541,12 +1579,15 @@ drop table t1; --echo # MDEV-7510 GIS: IsRing returns false for a primitive triangle. --echo # select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)')); +#enable after fix MDEV-27871 +--disable_view_protocol select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)')); --echo # --echo # MDEV-7514 GIS: PointOnSurface returns NULL instead of the point. --echo # SELECT ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))'))); +--enable_view_protocol --echo # --echo # MDEV-7529 GIS: ST_Relate returns unexpected results for POINT relations @@ -2402,6 +2443,7 @@ DROP TABLE t1; --enable_metadata --disable_ps_protocol +--disable_view_protocol SELECT ST_ISSIMPLE(POINT(1,1)), ST_ISRING(POINT(1,1)), @@ -2411,6 +2453,7 @@ SELECT ST_NUMINTERIORRINGS(POINT(1,1)), ST_NUMPOINTS(POINT(1,1)), ST_SRID(POINT(1,1)); + --enable_view_protocol --enable_ps_protocol --disable_metadata @@ -3046,6 +3089,18 @@ SELECT IS_FREE_LOCK(POINT(1,1)); --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION SELECT IS_USED_LOCK(POINT(1,1)); +--echo # +--echo # MDEV-26161 crash in Gis_point::calculate_haversine +--echo # +#enable after fix MDEV-30229 +--disable_view_protocol +--error ER_CANT_CREATE_GEOMETRY_OBJECT +select st_distance_sphere(x'01030000000400000004000000000000', multipoint(point(124,204)), 10); +--error ER_CANT_CREATE_GEOMETRY_OBJECT +select st_distance_sphere(x'010300000004000000040000', multipoint(point(124,204)), 10); +--error ER_CANT_CREATE_GEOMETRY_OBJECT +select st_distance_sphere(x'010300000001000000040000', multipoint(point(124,204)), 10); +--enable_view_protocol --echo # --echo # End of 10.3 tests @@ -3204,6 +3259,7 @@ CREATE TABLE t1 ( g GEOMETRY ) CHARACTER SET utf8; +--disable_view_protocol --enable_metadata SELECT * FROM t1; @@ -3307,6 +3363,7 @@ SELECT FROM t1; --disable_metadata +--enable_view_protocol DROP TABLE t1; --echo # diff --git a/mysql-test/main/gis_notembedded.result b/mysql-test/main/gis_notembedded.result index 99fe8d656a15a..0c469e3a72eee 100644 --- a/mysql-test/main/gis_notembedded.result +++ b/mysql-test/main/gis_notembedded.result @@ -20,26 +20,26 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` geometry DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci call mysql.DropGeometryColumn('', 'test', 't1', 'c'); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci call mysql.DropGeometryColumn('', 'test', 't1', 'b'); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create user foo@localhost; grant execute on mysql.* to foo@localhost; connect foo, localhost, foo; call mysql.AddGeometryColumn('', 'mysql', 'proc', 'c', 10); -ERROR 42000: ALTER command denied to user 'foo'@'localhost' for table 'proc' +ERROR 42000: ALTER command denied to user 'foo'@'localhost' for table `mysql`.`proc` disconnect foo; connection default; drop user foo@localhost; diff --git a/mysql-test/main/grant.result b/mysql-test/main/grant.result index 17a1a1145751e..585e927a0d49f 100644 --- a/mysql-test/main/grant.result +++ b/mysql-test/main/grant.result @@ -3,8 +3,6 @@ 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,,; connection master; SET NAMES binary; @@ -250,7 +248,7 @@ GRANT select (a), update (a),insert(a), references(a) on t1 to mysqltest_1@local show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` -GRANT SELECT, SELECT (a), INSERT, INSERT (a), UPDATE, UPDATE (a), REFERENCES (a) ON `test`.`t1` TO `mysqltest_1`@`localhost` +GRANT SELECT, SELECT (`a`), INSERT, INSERT (`a`), UPDATE, UPDATE (`a`), REFERENCES (`a`) ON `test`.`t1` TO `mysqltest_1`@`localhost` select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1"; table_priv column_priv Select,Insert,Update Select,Insert,Update,References @@ -258,12 +256,12 @@ REVOKE select (a), update on t1 from mysqltest_1@localhost; show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` -GRANT SELECT, INSERT, INSERT (a), REFERENCES (a) ON `test`.`t1` TO `mysqltest_1`@`localhost` +GRANT SELECT, INSERT, INSERT (`a`), REFERENCES (`a`) ON `test`.`t1` TO `mysqltest_1`@`localhost` REVOKE select,update,insert,insert (a) on t1 from mysqltest_1@localhost; show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` -GRANT REFERENCES (a) ON `test`.`t1` TO `mysqltest_1`@`localhost` +GRANT REFERENCES (`a`) ON `test`.`t1` TO `mysqltest_1`@`localhost` GRANT select,references on t1 to mysqltest_1@localhost; select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1"; table_priv column_priv @@ -338,13 +336,13 @@ show grants for drop_user@localhost; Grants for drop_user@localhost GRANT ALL PRIVILEGES ON *.* TO `drop_user`@`localhost` WITH GRANT OPTION GRANT ALL PRIVILEGES ON `test`.* TO `drop_user`@`localhost` WITH GRANT OPTION -GRANT SELECT (a) ON `test`.`t1` TO `drop_user`@`localhost` +GRANT SELECT (`a`) ON `test`.`t1` TO `drop_user`@`localhost` set sql_mode=ansi_quotes; show grants for drop_user@localhost; Grants for drop_user@localhost GRANT ALL PRIVILEGES ON *.* TO "drop_user"@"localhost" WITH GRANT OPTION GRANT ALL PRIVILEGES ON "test".* TO "drop_user"@"localhost" WITH GRANT OPTION -GRANT SELECT (a) ON "test"."t1" TO "drop_user"@"localhost" +GRANT SELECT ("a") ON "test"."t1" TO "drop_user"@"localhost" set sql_mode=default; set sql_quote_show_create=0; show grants for drop_user@localhost; @@ -363,13 +361,13 @@ show grants for drop_user@localhost; Grants for drop_user@localhost GRANT ALL PRIVILEGES ON *.* TO "drop_user"@"localhost" WITH GRANT OPTION GRANT ALL PRIVILEGES ON "test".* TO "drop_user"@"localhost" WITH GRANT OPTION -GRANT SELECT (a) ON "test"."t1" TO "drop_user"@"localhost" +GRANT SELECT ("a") ON "test"."t1" TO "drop_user"@"localhost" set sql_mode=""; show grants for drop_user@localhost; Grants for drop_user@localhost GRANT ALL PRIVILEGES ON *.* TO `drop_user`@`localhost` WITH GRANT OPTION GRANT ALL PRIVILEGES ON `test`.* TO `drop_user`@`localhost` WITH GRANT OPTION -GRANT SELECT (a) ON `test`.`t1` TO `drop_user`@`localhost` +GRANT SELECT (`a`) ON `test`.`t1` TO `drop_user`@`localhost` revoke all privileges, grant option from drop_user@localhost; show grants for drop_user@localhost; Grants for drop_user@localhost @@ -417,7 +415,7 @@ GRANT SELECT ( SHOW GRANTS FOR ����@localhost; Grants for ����@localhost GRANT USAGE ON *.* TO `����`@`localhost` -GRANT SELECT (���) ON `��`.`���` TO `����`@`localhost` +GRANT SELECT (`���`) ON `��`.`���` TO `����`@`localhost` REVOKE SELECT (���) ON ��.��� FROM ����@localhost; DROP USER ����@localhost; DROP DATABASE ��; @@ -494,7 +492,7 @@ grant insert(b), insert(c), insert(d), insert(a) on t1 to grant_user@localhost; show grants for grant_user@localhost; Grants for grant_user@localhost GRANT USAGE ON *.* TO `grant_user`@`localhost` -GRANT INSERT (a, d, c, b) ON `test`.`t1` TO `grant_user`@`localhost` +GRANT INSERT (`a`, `d`, `c`, `b`) ON `test`.`t1` TO `grant_user`@`localhost` select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv order by Column_name; Host Db User Table_name Column_name Column_priv localhost test grant_user t1 a Insert @@ -547,9 +545,9 @@ ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column update mysqltest_1.t2, mysqltest_2.t2 set d=20 where d=1; ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'd' in table 't2' update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1; -ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table `mysqltest_1`.`t1` update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1; -ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table `mysqltest_2`.`t1` update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2; ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 's' in table 't1' update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10; @@ -575,14 +573,14 @@ connection conn2; use mysqltest_1; update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600; update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; -ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table `mysqltest_1`.`t1` use mysqltest_2; update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; -ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table `mysqltest_1`.`t1` update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200; -ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't2' +ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table `mysqltest_1`.`t2` update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200; -ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table `mysqltest_1`.`t1` connection master; select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2; a q b r @@ -649,7 +647,7 @@ grant all on mysqltest.t1 to mysqltest_1@localhost; connect user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK; connection user1; alter table t1 rename t2; -ERROR 42000: INSERT, CREATE command denied to user 'mysqltest_1'@'localhost' for table 't2' +ERROR 42000: INSERT, CREATE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`t2` disconnect user1; connection root; revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; @@ -838,7 +836,7 @@ grant insert, create on db27515.t2 to user27515@localhost; connect conn27515, localhost, user27515, , db27515; connection conn27515; rename table t1 to t2; -ERROR 42000: DROP command denied to user 'user27515'@'localhost' for table 't1' +ERROR 42000: DROP command denied to user 'user27515'@'localhost' for table `db27515`.`t1` disconnect conn27515; connection master; revoke all privileges, grant option from user27515@localhost; @@ -915,20 +913,20 @@ grant update (a) on t1 to mysqltest_8; show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` -GRANT UPDATE (a) ON `test`.`t1` TO `mysqltest_8`@`%` +GRANT UPDATE (`a`) ON `test`.`t1` TO `mysqltest_8`@`%` show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` -GRANT UPDATE (a) ON `test`.`t1` TO `mysqltest_8`@`%` +GRANT UPDATE (`a`) ON `test`.`t1` TO `mysqltest_8`@`%` flush privileges; show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` -GRANT UPDATE (a) ON `test`.`t1` TO `mysqltest_8`@`%` +GRANT UPDATE (`a`) ON `test`.`t1` TO `mysqltest_8`@`%` show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` -GRANT UPDATE (a) ON `test`.`t1` TO `mysqltest_8`@`%` +GRANT UPDATE (`a`) ON `test`.`t1` TO `mysqltest_8`@`%` select * from information_schema.column_privileges; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE 'mysqltest_8'@'%' def test t1 a UPDATE NO @@ -1011,12 +1009,12 @@ show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` GRANT ALL PRIVILEGES ON `mysqltest`.* TO `mysqltest_8`@`%` -GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO `mysqltest_8`@`%` +GRANT UPDATE, UPDATE (`a`) ON `test`.`t1` TO `mysqltest_8`@`%` show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` GRANT ALL PRIVILEGES ON `mysqltest`.* TO `mysqltest_8`@`%` -GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO `mysqltest_8`@`%` +GRANT UPDATE, UPDATE (`a`) ON `test`.`t1` TO `mysqltest_8`@`%` select * from information_schema.user_privileges where grantee like "'mysqltest_8'%"; GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE @@ -1032,12 +1030,12 @@ show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` GRANT ALL PRIVILEGES ON `mysqltest`.* TO `mysqltest_8`@`%` -GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO `mysqltest_8`@`%` +GRANT UPDATE, UPDATE (`a`) ON `test`.`t1` TO `mysqltest_8`@`%` show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` GRANT ALL PRIVILEGES ON `mysqltest`.* TO `mysqltest_8`@`%` -GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO `mysqltest_8`@`%` +GRANT UPDATE, UPDATE (`a`) ON `test`.`t1` TO `mysqltest_8`@`%` drop user mysqltest_8@''; show grants for mysqltest_8@''; ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host '%' @@ -1070,13 +1068,13 @@ GRANT SELECT ON mysqltest2.* TO 'mysqltest_1'@'localhost' IDENTIFIE GRANT SHOW VIEW,SELECT ON mysqltest2.v_yy TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; connect mysqltest_1, localhost, mysqltest_1, mysqltest_1,; SHOW CREATE VIEW mysqltest2.v_nn; -ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_nn' +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest2`.`v_nn` SHOW CREATE TABLE mysqltest2.v_nn; -ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_nn' +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest2`.`v_nn` SHOW CREATE VIEW mysqltest2.v_yn; -ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_yn' +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest2`.`v_yn` SHOW CREATE TABLE mysqltest2.v_yn; -ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_yn' +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest2`.`v_yn` SHOW CREATE TABLE mysqltest2.v_ny; View Create View character_set_client collation_connection v_ny CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` latin1 latin1_swedish_ci @@ -1084,18 +1082,18 @@ SHOW CREATE VIEW mysqltest2.v_ny; View Create View character_set_client collation_connection v_ny CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` latin1 latin1_swedish_ci SHOW CREATE TABLE mysqltest3.t_nn; -ERROR 42000: SHOW command denied to user 'mysqltest_1'@'localhost' for table 't_nn' +ERROR 42000: SHOW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest3`.`t_nn` SHOW CREATE VIEW mysqltest3.t_nn; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't_nn' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `mysqltest3`.`t_nn` SHOW CREATE VIEW mysqltest3.v_nn; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v_nn' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `mysqltest3`.`v_nn` SHOW CREATE TABLE mysqltest3.v_nn; -ERROR 42000: SHOW command denied to user 'mysqltest_1'@'localhost' for table 'v_nn' +ERROR 42000: SHOW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest3`.`v_nn` SHOW CREATE TABLE mysqltest2.t_nn; Table Create Table t_nn CREATE TABLE `t_nn` ( `c1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE VIEW mysqltest2.t_nn; ERROR HY000: 'mysqltest2.t_nn' is not of type 'VIEW' SHOW CREATE VIEW mysqltest2.v_yy; @@ -1115,7 +1113,7 @@ SHOW CREATE TABLE mysqltest2.t_nn; Table Create Table t_nn CREATE TABLE `t_nn` ( `c1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE VIEW mysqltest2.t_nn; ERROR HY000: 'mysqltest2.t_nn' is not of type 'VIEW' DROP VIEW mysqltest2.v_nn; @@ -1155,17 +1153,17 @@ Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` GRANT SELECT ON `mysqltest1`.`t1` TO `mysqltest_1`@`localhost` RENAME TABLE t1 TO t2; -ERROR 42000: DROP, ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: DROP, ALTER command denied to user 'mysqltest_1'@'localhost' for table `mysqltest1`.`t1` ALTER TABLE t1 RENAME TO t2; -ERROR 42000: DROP, ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: DROP, ALTER command denied to user 'mysqltest_1'@'localhost' for table `mysqltest1`.`t1` disconnect conn42; connection default; GRANT DROP ON mysqltest1.t1 TO mysqltest_1@localhost; connect conn42,localhost,mysqltest_1,,mysqltest1; RENAME TABLE t1 TO t2; -ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table `mysqltest1`.`t1` ALTER TABLE t1 RENAME TO t2; -ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table `mysqltest1`.`t1` disconnect conn42; connection default; GRANT ALTER ON mysqltest1.t1 TO mysqltest_1@localhost; @@ -1175,9 +1173,9 @@ Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` GRANT SELECT, DROP, ALTER ON `mysqltest1`.`t1` TO `mysqltest_1`@`localhost` RENAME TABLE t1 TO t2; -ERROR 42000: INSERT, CREATE command denied to user 'mysqltest_1'@'localhost' for table 't2' +ERROR 42000: INSERT, CREATE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest1`.`t2` ALTER TABLE t1 RENAME TO t2; -ERROR 42000: INSERT, CREATE command denied to user 'mysqltest_1'@'localhost' for table 't2' +ERROR 42000: INSERT, CREATE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest1`.`t2` disconnect conn42; connection default; GRANT INSERT, CREATE ON mysqltest1.t1 TO mysqltest_1@localhost; @@ -1211,9 +1209,9 @@ GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t1` TO `mysqltest_1`@`localhost` GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t2` TO `mysqltest_1`@`localhost` RENAME TABLE t1 TO t2; -ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table `mysqltest1`.`t1` ALTER TABLE t1 RENAME TO t2; -ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table `mysqltest1`.`t1` disconnect conn42; connection default; DROP USER mysqltest_1@localhost; @@ -1255,7 +1253,7 @@ GRANT DELETE ON t1 TO bug23556@localhost; connection bug23556; USE bug23556; TRUNCATE t1; -ERROR 42000: DROP command denied to user 'bug23556'@'localhost' for table 't1' +ERROR 42000: DROP command denied to user 'bug23556'@'localhost' for table `bug23556`.`t1` connection default; USE bug23556; REVOKE DELETE ON t1 FROM bug23556@localhost; @@ -1333,16 +1331,16 @@ CREATE PROCEDURE mysqltest1.p1() SQL SECURITY INVOKER SELECT 1; connect bug27337_con1,localhost,mysqltest_1,,mysqltest2; CREATE TABLE t1(c INT); -ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest2`.`t1` CALL mysqltest1.p1(); 1 1 CREATE TABLE t1(c INT); -ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest2`.`t1` disconnect bug27337_con1; connect bug27337_con2,localhost,mysqltest_1,,mysqltest2; CREATE TABLE t1(c INT); -ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest2`.`t1` SHOW TABLES; Tables_in_mysqltest2 connection default; @@ -1384,9 +1382,9 @@ EXECUTE stmt1; ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest1' connection bug27337_con2; SHOW COLUMNS FROM mysqltest2.t2; -ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table `mysqltest2`.`t2` EXECUTE stmt2; -ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table `mysqltest2`.`t2` connection default; disconnect bug27337_con1; disconnect bug27337_con2; @@ -1508,11 +1506,11 @@ CALL p1; ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for column 'b' in table 't1' # - Check table-level privileges... SELECT a FROM t2; -ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table `mysqltest1`.`t2` EXECUTE s2; -ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table `mysqltest1`.`t2` CALL p2; -ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table `mysqltest1`.`t2` # - Check database-level privileges... SHOW TABLES FROM mysqltest2; ERROR 42000: Access denied for user 'testuser'@'localhost' to database 'mysqltest2' @@ -1647,9 +1645,9 @@ ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine select mysqltest1.f1(); ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.f1' select * from mysqltest1.t11; -ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't11' +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table `mysqltest1`.`t11` select * from mysqltest1.t22; -ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't22' +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table `mysqltest1`.`t22` disconnect bug36544_con2; connection default; # @@ -1671,9 +1669,9 @@ ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine select mysqltest1.f1(); ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.f1' select * from mysqltest1.t11; -ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't11' +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table `mysqltest1`.`t11` select * from mysqltest1.t22; -ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't22' +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table `mysqltest1`.`t22` disconnect bug36544_con3; connection default; # @@ -1724,7 +1722,7 @@ create table t1 (i INT); connect user1,localhost,mysqltest,,mysqltest; connection user1; insert into t1 values (1); -ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table `mysqltest`.`t1` create table t2 (i INT); create table t4 (i INT); connection default; @@ -1736,20 +1734,20 @@ flush privileges; connection user1; insert into t2 values (1); create table if not exists t1 select * from t2; -ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table `mysqltest`.`t1` create table if not exists t3 select * from t2; -ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't3' +ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table `mysqltest`.`t3` create table if not exists t4 select * from t2; Warnings: Note 1050 Table 't4' already exists create table if not exists t5 select * from t2; create table t6 select * from t2; create table t7 select * from t2; -ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't7' +ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table `mysqltest`.`t7` create table t4 select * from t2; ERROR 42S01: Table 't4' already exists create table t1 select * from t2; -ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table `mysqltest`.`t1` connection default; drop table t1,t2,t4,t5,t6; revoke create on mysqltest.* from mysqltest@localhost; @@ -1912,7 +1910,7 @@ connect con1,localhost,testbug,,db1; SELECT * FROM `../db2/tb2`; ERROR 42S02: Table 'db1.../db2/tb2' doesn't exist SELECT * FROM `../db2`.tb2; -ERROR 42000: SELECT command denied to user 'testbug'@'localhost' for table 'tb2' +ERROR 42000: SELECT command denied to user 'testbug'@'localhost' for table `../db2`.`tb2` SELECT * FROM `#mysql50#/../db2/tb2`; ERROR 42000: Incorrect table name '#mysql50#/../db2/tb2' connection default; @@ -1978,7 +1976,7 @@ connect con1,localhost,mysqltest_u1,,mysqltest_db1; connection con1; SHOW CREATE TABLE t1; -ERROR 42000: SHOW command denied to user 'mysqltest_u1'@'localhost' for table 't1' +ERROR 42000: SHOW command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`t1` connection default; disconnect con1; @@ -2004,7 +2002,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2030,7 +2028,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2056,7 +2054,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2082,7 +2080,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2108,7 +2106,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2134,7 +2132,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2160,7 +2158,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2186,7 +2184,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2212,7 +2210,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2238,7 +2236,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2264,7 +2262,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2290,7 +2288,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2316,7 +2314,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2342,7 +2340,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2368,7 +2366,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2394,7 +2392,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2420,7 +2418,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2446,7 +2444,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2472,7 +2470,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2498,7 +2496,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2524,7 +2522,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2550,7 +2548,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2576,7 +2574,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2602,7 +2600,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; @@ -2759,7 +2757,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT user() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (); GRANT ALL PRIVILEGES ON test.* TO dummy@localhost IDENTIFIED BY 'pwd'; connect conn1,localhost,dummy,pwd,test; @@ -2784,16 +2782,24 @@ CREATE DATABASE db; CREATE TABLE db.t (a INT); connect con1,localhost,foo,,; GRANT ALL ON db.t TO foo; -ERROR 42000: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, GRANT, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW ... command denied to user 'foo'@'localhost' for table 't' +ERROR 42000: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, GRANT, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW ... command denied to user 'foo'@'localhost' for table `db`.`t` GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, GRANT OPTION, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON db.t TO foo; -ERROR 42000: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, GRANT, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW ... command denied to user 'foo'@'localhost' for table 't' +ERROR 42000: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, GRANT, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW ... command denied to user 'foo'@'localhost' for table `db`.`t` connection default; disconnect con1; DROP USER foo; DROP TABLE db.t; DROP DATABASE db; # +# Bug#33578113: DROP privilege on performance_schema.* can't be revoked +# +connection default; +CREATE USER bug33578113; +GRANT DROP ON performance_schema.* TO bug33578113; +REVOKE DROP ON performance_schema.* FROM bug33578113; +DROP USER bug33578113; +# # End of 10.2 tests # # diff --git a/mysql-test/main/grant.test b/mysql-test/main/grant.test index c8ca440b3e8bb..a243967a9c7be 100644 --- a/mysql-test/main/grant.test +++ b/mysql-test/main/grant.test @@ -1,7 +1,7 @@ # Test of GRANT commands # Grant tests not performed with embedded server --- source include/not_embedded.inc +--source include/not_embedded.inc # Save the initial number of concurrent sessions --source include/count_sessions.inc @@ -12,12 +12,6 @@ SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creato 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 -drop table if exists t1; -drop database if exists mysqltest; ---enable_warnings - connect (master,localhost,root,,); connection master; SET NAMES binary; @@ -2287,6 +2281,16 @@ DROP USER foo; DROP TABLE db.t; DROP DATABASE db; +--echo # +--echo # Bug#33578113: DROP privilege on performance_schema.* can't be revoked +--echo # +connection default; +CREATE USER bug33578113; +GRANT DROP ON performance_schema.* TO bug33578113; +REVOKE DROP ON performance_schema.* FROM bug33578113; +DROP USER bug33578113; +--source include/wait_until_count_sessions.inc + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/grant2.result b/mysql-test/main/grant2.result index 7bb8aeb9d239d..b0ad299819859 100644 --- a/mysql-test/main/grant2.result +++ b/mysql-test/main/grant2.result @@ -108,9 +108,9 @@ GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` GRANT SELECT, INSERT ON `mysqltest`.* TO `mysqltest_1`@`localhost` insert into t1 values (1, 'I can''t change it!'); update t1 set data='I can change it!' where id = 1; -ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`t1` insert into t1 values (1, 'XXX') on duplicate key update data= 'I can change it!'; -ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`t1` select * from t1; id data 1 I can't change it! @@ -127,7 +127,7 @@ connection mrugly; grant select (a,b) on t1 to mysqltest_2@localhost; ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't1' grant select on t1 to mysqltest_3@localhost; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`t1` disconnect mrugly; connection default; drop table t1; @@ -204,7 +204,7 @@ show grants for 'mysqltest_2'; Grants for mysqltest_2@% GRANT SELECT ON *.* TO "mysqltest_2"@"%" IDENTIFIED BY PASSWORD '*BD447CBA355AF58578D3AE33BA2E2CD388BA08D1' GRANT INSERT ON "test".* TO "mysqltest_2"@"%" -GRANT UPDATE (c2) ON "test"."t2" 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,plugin,authentication_string from mysql.user where user like 'mysqltest_%'; @@ -242,7 +242,7 @@ show grants for 'mysqltest_1'; Grants for mysqltest_1@% GRANT SELECT ON *.* TO "mysqltest_1"@"%" IDENTIFIED BY PASSWORD '*BD447CBA355AF58578D3AE33BA2E2CD388BA08D1' GRANT INSERT ON "test".* TO "mysqltest_1"@"%" -GRANT UPDATE (c2) ON "test"."t2" TO "mysqltest_1"@"%" +GRANT UPDATE ("c2") ON "test"."t2" TO "mysqltest_1"@"%" GRANT UPDATE ON "test"."t1" TO "mysqltest_1"@"%" drop user 'mysqltest_1', 'mysqltest_3'; drop user 'mysqltest_1'; @@ -312,7 +312,7 @@ grant create user on *.* to mysqltest_2@localhost; connect user3,localhost,mysqltest_2,,; connection user3; 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' +ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table `mysql`.`user` create user mysqltest_A@'%'; rename user mysqltest_A@'%' to mysqltest_B@'%'; drop user mysqltest_B@'%'; @@ -328,7 +328,7 @@ 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,plugin,authentication_string from mysql.user where user like 'mysqltest_%' ; -ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 'user' +ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table `mysql`.`user` insert into mysql.global_priv set host='%', user='mysqltest_B'; create user mysqltest_A@'%'; rename user mysqltest_B@'%' to mysqltest_C@'%'; @@ -476,9 +476,9 @@ create table t1 (i int); connect user1,localhost,mysqltest_u1,,mysqltest_1; connection user1; show create table mysqltest_2.t1; -ERROR 42000: SHOW command denied to user 'mysqltest_u1'@'localhost' for table 't1' +ERROR 42000: SHOW command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_2`.`t1` create table t1 like mysqltest_2.t1; -ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_2`.`t1` connection default; grant select on mysqltest_2.t1 to mysqltest_u1@localhost; connection user1; @@ -486,7 +486,7 @@ show create table mysqltest_2.t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t1 like mysqltest_2.t1; connection default; disconnect user1; @@ -533,7 +533,7 @@ USE db1; SELECT c FROM t2; ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2' SELECT * FROM t2; -ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for table `db1`.`t2` SELECT * FROM t1 JOIN t2 USING (b); ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2' connection default; @@ -629,7 +629,7 @@ CREATE TEMPORARY TABLE t4 SELECT * FROM t1; # temporary table without additional privileges. CREATE TEMPORARY TABLE t5(a INT) ENGINE = MyISAM; CREATE TEMPORARY TABLE t6(a INT) ENGINE = MERGE UNION = (t5); -ERROR 42000: SELECT, UPDATE, DELETE command denied to user 'mysqltest_u1'@'localhost' for table 't5' +ERROR 42000: SELECT, UPDATE, DELETE command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`t5` # Check that we allow creation of MERGE table with no underlying table # without additional privileges. CREATE TEMPORARY TABLE t6(a INT) ENGINE = MERGE UNION = (); @@ -657,7 +657,7 @@ ALTER TABLE t6 UNION = (); # Check that we do *not* allow altering of MERGE table with underlying # temporary table without additional privileges. ALTER TABLE t6 UNION = (t5); -ERROR 42000: SELECT, UPDATE, DELETE command denied to user 'mysqltest_u1'@'localhost' for table 't5' +ERROR 42000: SELECT, UPDATE, DELETE command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`t5` # # Simple INSERT and INSERT ... SELECT. # @@ -707,6 +707,7 @@ a # SHOW COLUMNS FROM t1; Field Type Null Key Default Extra +a int(11) YES NULL SHOW KEYS FROM t3; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored t3 0 PRIMARY 1 a A 0 NULL NULL BTREE NO @@ -717,7 +718,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # # LOAD DATA INFILE (also SELECT INTO OUTFILE). # @@ -902,7 +903,7 @@ CREATE TEMPORARY TABLE t9(a INT); CREATE TEMPORARY TABLE t10(a INT) ENGINE = MERGE UNION = (t7, t8); ALTER TABLE t10 UNION = (t9); ALTER TABLE t10 UNION = (mysqltest_db2.t2_1); -ERROR 42000: SELECT, UPDATE, DELETE command denied to user 'mysqltest_u5'@'localhost' for table 't2_1' +ERROR 42000: SELECT, UPDATE, DELETE command denied to user 'mysqltest_u5'@'localhost' for table `mysqltest_db2`.`t2_1` CREATE TEMPORARY TABLE mysqltest_db2.t2_2(a INT) ENGINE = MERGE UNION = (t7, t8); ALTER TABLE mysqltest_db2.t2_2 UNION = (t9); ALTER TABLE mysqltest_db2.t2_2 UNION = (); diff --git a/mysql-test/main/grant3.result b/mysql-test/main/grant3.result index 63e343aaf4def..3d0af8a436948 100644 --- a/mysql-test/main/grant3.result +++ b/mysql-test/main/grant3.result @@ -172,14 +172,14 @@ GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%'; SHOW GRANTS FOR 'user2'@'%'; Grants for user2@% GRANT USAGE ON *.* TO `user2`@`%` -GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO `user2`@`%` +GRANT SELECT (`a`), INSERT (`b`) ON `temp`.`t1` TO `user2`@`%` # Connect as the renamed user connect conn1, localhost, user2,,; connection conn1; SHOW GRANTS; Grants for user2@% GRANT USAGE ON *.* TO `user2`@`%` -GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO `user2`@`%` +GRANT SELECT (`a`), INSERT (`b`) ON `temp`.`t1` TO `user2`@`%` SELECT a FROM temp.t1; a 1 @@ -195,4 +195,29 @@ connection default; DROP USER 'user2'@'%'; DROP DATABASE temp; set global sql_mode=default; -End of 5.0 tests +# +# End of 5.0 tests +# +create database db1; +create user foo@localhost; +grant create on db1.* to foo@localhost; +connect foo,localhost,foo; +create temporary table t as values (1),(2),(3); +use db1; +create table t1 as select * from test.t; +ERROR 42000: INSERT command denied to user 'foo'@'localhost' for table `db1`.`t1` +create table t1 as values (1),(2),(3); +ERROR 42000: INSERT command denied to user 'foo'@'localhost' for table `db1`.`t1` +create table t1 (a int); +disconnect foo; +connection default; +revoke create on db1.* from foo@localhost; +grant insert on db1.* to foo@localhost; +connect foo,localhost,foo; +use db1; +create table t2 as values (1),(2),(3); +ERROR 42000: CREATE command denied to user 'foo'@'localhost' for table `db1`.`t2` +disconnect foo; +connection default; +drop user foo@localhost; +drop database db1; diff --git a/mysql-test/main/grant3.test b/mysql-test/main/grant3.test index 27f565916f75a..5337d59efd863 100644 --- a/mysql-test/main/grant3.test +++ b/mysql-test/main/grant3.test @@ -207,7 +207,35 @@ DROP USER 'user2'@'%'; DROP DATABASE temp; set global sql_mode=default; ---echo End of 5.0 tests +--echo # +--echo # End of 5.0 tests +--echo # + +create database db1; +create user foo@localhost; +grant create on db1.* to foo@localhost; +connect foo,localhost,foo; +create temporary table t as values (1),(2),(3); +use db1; +--error ER_TABLEACCESS_DENIED_ERROR +create table t1 as select * from test.t; +--error ER_TABLEACCESS_DENIED_ERROR +create table t1 as values (1),(2),(3); +create table t1 (a int); +disconnect foo; +connection default; + +revoke create on db1.* from foo@localhost; +grant insert on db1.* to foo@localhost; +connect foo,localhost,foo; +use db1; +--error ER_TABLEACCESS_DENIED_ERROR +create table t2 as values (1),(2),(3); +disconnect foo; + +connection default; +drop user foo@localhost; +drop database db1; # Wait till we reached the initial number of concurrent sessions --source include/wait_until_count_sessions.inc diff --git a/mysql-test/main/grant4.result b/mysql-test/main/grant4.result index 889c42310a048..bc38f281e8ec3 100644 --- a/mysql-test/main/grant4.result +++ b/mysql-test/main/grant4.result @@ -30,23 +30,23 @@ a int(11) YES NULL ** SHOW COLUMNS ** Should fail because there are no privileges on any column combination. show columns from mysqltest_db1.t_no_priv; -ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't_no_priv' +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`t_no_priv` ** However, select from I_S.COLUMNS will succeed but not show anything: select column_name as 'Field',column_type as 'Type',is_nullable as 'Null',column_key as 'Key',column_default as 'Default',extra as 'Extra' from information_schema.columns where table_schema='mysqltest_db1' and table_name='t_no_priv'; Field Type Null Key Default Extra ** CREATE TABLE ... LIKE ... require SELECT privleges and will fail. create table test.t_no_priv like mysqltest_db1.column_priv_only; -ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 'column_priv_only' +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`column_priv_only` ** Just to be sure... SELECT also fails. select * from mysqltest_db1.t_column_priv_only; -ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't_column_priv_only' +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`t_column_priv_only` ** SHOW CREATE TABLE ... require any privileges on all columns (the entire table). ** First we try and fail on a table with only one column privilege. show create table mysqltest_db1.t_column_priv_only; -ERROR 42000: SHOW command denied to user 'mysqltest_u1'@'localhost' for table 't_column_priv_only' +ERROR 42000: SHOW command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`t_column_priv_only` ** Now we do the same on a table with SELECT privileges. @@ -68,11 +68,11 @@ Table Create Table t_select_priv CREATE TABLE `t_select_priv` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ** SHOW CREATE TABLE will fail if there is no grants at all: show create table mysqltest_db1.t_no_priv; -ERROR 42000: SHOW command denied to user 'mysqltest_u1'@'localhost' for table 't_no_priv' +ERROR 42000: SHOW command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`t_no_priv` connection default; use mysqltest_db1; @@ -97,7 +97,7 @@ SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name='t5'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT IGNORED ** SHOW INDEX FROM t5 will fail because we don't have any privileges on any column combination. SHOW INDEX FROM t5; -ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't5' +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`t5` ** SHOW INDEX FROM t6 will succeed because there exist a privilege on a column combination on t6. SHOW INDEX FROM t6; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored @@ -108,20 +108,20 @@ Table Op Msg_type Msg_text mysqltest_db1.t6 check status OK ** With no privileges access is naturally denied: CHECK TABLE t5; -ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't5' +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`t5` ** CHECKSUM TABLE requires SELECT privileges on the table. The following should fail: CHECKSUM TABLE t6; -ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't6' +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`t6` ** And this should work: CHECKSUM TABLE t_select_priv; Table Checksum mysqltest_db1.t_select_priv 0 SHOW CREATE VIEW v5; -ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 'v5' +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`v5` SHOW CREATE VIEW v6; -ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 'v6' +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`v6` SHOW CREATE VIEW v2; -ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`v2` 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 `t_select_priv`.`a` AS `a`,`t_select_priv`.`b` AS `b` from `t_select_priv` latin1 latin1_swedish_ci @@ -193,10 +193,10 @@ mysqltest_db1.t1 check error Corrupt # The below statement should fail before repairing t1. # Otherwise info about such repair will be missing from its result-set. repair table mysqltest_db1.t1, mysqltest_db1.t2; -ERROR 42000: SELECT, INSERT command denied to user 'mysqltest_u1'@'localhost' for table 't2' +ERROR 42000: SELECT, INSERT command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`t2` # The same is true for CHECK TABLE statement. check table mysqltest_db1.t1, mysqltest_db1.t2; -ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`t2` check table mysqltest_db1.t1; Table Op Msg_type Msg_text mysqltest_db1.t1 check warning Table is marked as crashed diff --git a/mysql-test/main/grant4.test b/mysql-test/main/grant4.test index 65e8f78b467fa..cda1c5fb28125 100644 --- a/mysql-test/main/grant4.test +++ b/mysql-test/main/grant4.test @@ -1,5 +1,7 @@ --source include/not_embedded.inc +--disable_service_connection + # Setup database, tables and user accounts --disable_warnings drop database if exists mysqltest_db1; @@ -268,3 +270,5 @@ create user foo4 identified via mysql_old_password using '1111111111111111111111 set GLOBAL sql_mode=default; --echo End of 10.1 tests + +--enable_service_connection diff --git a/mysql-test/main/grant5.result b/mysql-test/main/grant5.result index fa5a952a9c165..76a5f5375e905 100644 --- a/mysql-test/main/grant5.result +++ b/mysql-test/main/grant5.result @@ -185,6 +185,145 @@ GRANT USAGE ON *.* TO `test-user`@`%` SET DEFAULT ROLE `r``o'l"e` FOR `test-user`@`%` DROP ROLE `r``o'l"e`; DROP USER 'test-user'; +# +# MDEV-28548: ER_TABLEACCESS_DENIED_ERROR is missing information about DB +# +create database db1; +create user foo@localhost; +grant create on db1.* to foo@localhost; +connect con1,localhost,foo,,db1; +create table t(t int); +show columns in t; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `db1`.`t` +show columns in db1.t; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `db1`.`t` +create view t_v as select * from t; +ERROR 42000: CREATE VIEW command denied to user 'foo'@'localhost' for table `db1`.`t_v` +show create view t_v; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `db1`.`t_v` +create table t2(id int primary key, b int); +create table t3(a int, b int, CONSTRAINT `fk_db2_db1_t1` + FOREIGN KEY (a) +REFERENCES `db1 `.t1 (a) +ON DELETE CASCADE +ON UPDATE RESTRICT); +ERROR 42000: Incorrect database name 'db1 ' +create table t3(a int, b int, CONSTRAINT `fk_db2_db3_t1` + FOREIGN KEY (a) +REFERENCES db3.t1 (a) +ON DELETE CASCADE +ON UPDATE RESTRICT); +ERROR 42000: REFERENCES command denied to user 'foo'@'localhost' for table `db3`.`t1` +create table t1(a int, b int, CONSTRAINT `fk_db2_db3_t1` + FOREIGN KEY (a) +REFERENCES t2 (id) +ON DELETE CASCADE +ON UPDATE RESTRICT); +ERROR 42000: REFERENCES command denied to user 'foo'@'localhost' for table `db1`.`t2` +connection default; +disconnect con1; +grant create view, select on db1.* to foo@localhost; +connect con1,localhost,foo,,db1; +create view t_v as select * from t; +show grants; +Grants for foo@localhost +GRANT USAGE ON *.* TO `foo`@`localhost` +GRANT SELECT, CREATE, CREATE VIEW ON `db1`.* TO `foo`@`localhost` +show create view t_v; +ERROR 42000: SHOW VIEW command denied to user 'foo'@'localhost' for table `db1`.`t_v` +connection default; +disconnect con1; +grant show view on db1.* to foo@localhost; +connect con1,localhost,foo,,db1; +show grants; +Grants for foo@localhost +GRANT USAGE ON *.* TO `foo`@`localhost` +GRANT SELECT, CREATE, CREATE VIEW, SHOW VIEW ON `db1`.* TO `foo`@`localhost` +show create view t_v; +View Create View character_set_client collation_connection +t_v CREATE ALGORITHM=UNDEFINED DEFINER=`foo`@`localhost` SQL SECURITY DEFINER VIEW `t_v` AS select `t`.`t` AS `t` from `t` latin1 latin1_swedish_ci +connection default; +disconnect con1; +drop database db1; +drop user foo@localhost; +# +# MDEV-28455: CREATE TEMPORARY TABLES privilege +# is insufficient for SHOW COLUMNS +# +create database db; +create user foo@localhost; +create user bar@localhost; +create user buz@localhost; +grant create temporary tables on db.* to foo@localhost; +grant create temporary tables on db.* to bar@localhost; +connect con1,localhost,foo,,db; +create temporary table tmp (a int, key(a)); +show tables; +Tables_in_db +show full tables; +Tables_in_db Table_type +show table status; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +show index in tmp; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored +tmp 1 a 1 a A NULL NULL NULL YES BTREE NO +show columns in tmp; +Field Type Null Key Default Extra +a int(11) YES MUL NULL +show full columns in tmp; +Field Type Collation Null Key Default Extra Privileges Comment +a int(11) NULL YES MUL NULL select,insert,update,references +# we don't expect to show temporary tables in information_schema.columns +select * from information_schema.columns where table_schema='db'; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION +disconnect con1; +connect con1,localhost,bar,,db; +show full columns in tmp; +ERROR 42000: SELECT command denied to user 'bar'@'localhost' for table `db`.`tmp` +disconnect con1; +connection default; +grant select on db.* to bar@localhost; +connect con1,localhost,bar,,db; +show grants for current_user; +Grants for bar@localhost +GRANT USAGE ON *.* TO `bar`@`localhost` +GRANT SELECT, CREATE TEMPORARY TABLES ON `db`.* TO `bar`@`localhost` +show full columns in tmp; +ERROR 42S02: Table 'db.tmp' doesn't exist +disconnect con1; +connect con1,localhost,buz,,; +show columns in db.tmp; +ERROR 42000: SELECT command denied to user 'buz'@'localhost' for table `db`.`tmp` +disconnect con1; +connection default; +drop database db; +drop user foo@localhost; +drop user bar@localhost; +drop user buz@localhost; +CREATE USER foo; +CREATE DATABASE db; +CREATE TABLE db.test_getcolpriv(col1 INT, col2 INT); +GRANT SELECT (col1,col2) ON db.test_getcolpriv TO foo; +GRANT INSERT (col1) ON db.test_getcolpriv TO foo; +SHOW GRANTS FOR foo; +Grants for foo@% +GRANT USAGE ON *.* TO `foo`@`%` +GRANT SELECT (`col2`, `col1`), INSERT (`col1`) ON `db`.`test_getcolpriv` TO `foo`@`%` +REVOKE SELECT (col1,col2) ON db.test_getcolpriv FROM foo; +SHOW GRANTS FOR foo; +Grants for foo@% +GRANT USAGE ON *.* TO `foo`@`%` +GRANT INSERT (`col1`) ON `db`.`test_getcolpriv` TO `foo`@`%` +REVOKE INSERT (col1) ON db.test_getcolpriv FROM foo; +SHOW GRANTS FOR foo; +Grants for foo@% +GRANT USAGE ON *.* TO `foo`@`%` +FLUSH PRIVILEGES; +SHOW GRANTS FOR foo; +Grants for foo@% +GRANT USAGE ON *.* TO `foo`@`%` +DROP USER foo; +DROP DATABASE db; # End of 10.3 tests create user u1@h identified with 'mysql_native_password' using 'pwd'; ERROR HY000: Password hash should be a 41-digit hexadecimal number @@ -301,7 +440,7 @@ show create table db.t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci delete from db.t1 returning *; ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'a' in table 't1' disconnect con1; @@ -314,4 +453,13 @@ insert mysql.host values (1); flush privileges; ERROR HY000: Fatal error: mysql.host table is damaged or in unsupported 3.20 format drop table mysql.host; +# +# MDEV-30826 Invalid data on mysql.host segfaults the server after an upgrade to 10.4 +# +create table mysql.host (host char(60) binary default '' not null, db char(64) binary 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, 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, 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, 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, execute_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, primary key /*host*/ (host,db)) engine=myisam character set utf8 collate utf8_bin comment='host privileges; merged with database privileges'; +insert mysql.host values('10.5.0.0/255.255.0.0','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','N'); +flush privileges; +drop table mysql.host; +# # End of 10.4 tests +# diff --git a/mysql-test/main/grant5.test b/mysql-test/main/grant5.test index 0b4a63ab075a7..49e0ab1abf16c 100644 --- a/mysql-test/main/grant5.test +++ b/mysql-test/main/grant5.test @@ -138,6 +138,149 @@ SHOW GRANTS FOR 'test-user'; DROP ROLE `r``o'l"e`; DROP USER 'test-user'; +--echo # +--echo # MDEV-28548: ER_TABLEACCESS_DENIED_ERROR is missing information about DB +--echo # + +create database db1; +create user foo@localhost; +grant create on db1.* to foo@localhost; + +--connect (con1,localhost,foo,,db1) +create table t(t int); +--error ER_TABLEACCESS_DENIED_ERROR +show columns in t; +--error ER_TABLEACCESS_DENIED_ERROR +show columns in db1.t; +# CREATE_VIEW_ACL needed +--error ER_TABLEACCESS_DENIED_ERROR +create view t_v as select * from t; +# show create view needs to have SELECT_ACL and SHOW_VIEW_ACL +--error ER_TABLEACCESS_DENIED_ERROR +show create view t_v; + +create table t2(id int primary key, b int); + +# Reference non existing DB with wrong DB name +--error ER_WRONG_DB_NAME +create table t3(a int, b int, CONSTRAINT `fk_db2_db1_t1` + FOREIGN KEY (a) + REFERENCES `db1 `.t1 (a) + ON DELETE CASCADE + ON UPDATE RESTRICT); + +# Reference non-existing DB (with qualified DB name) +--error ER_TABLEACCESS_DENIED_ERROR +create table t3(a int, b int, CONSTRAINT `fk_db2_db3_t1` + FOREIGN KEY (a) + REFERENCES db3.t1 (a) + ON DELETE CASCADE + ON UPDATE RESTRICT); + +# Reference DB (with not qualified DB name) +--error ER_TABLEACCESS_DENIED_ERROR +create table t1(a int, b int, CONSTRAINT `fk_db2_db3_t1` + FOREIGN KEY (a) + REFERENCES t2 (id) + ON DELETE CASCADE + ON UPDATE RESTRICT); + +--connection default +--disconnect con1 +# Add CREATE_VIEW_ACL and SELECT_ACL +grant create view, select on db1.* to foo@localhost; + +--connect (con1,localhost,foo,,db1) +create view t_v as select * from t; +show grants; +--error ER_TABLEACCESS_DENIED_ERROR +show create view t_v; + +--connection default +--disconnect con1 +# Add SHOW_VIEW_ACL +grant show view on db1.* to foo@localhost; + +--connect (con1,localhost,foo,,db1) +show grants; +show create view t_v; + +--connection default +--disconnect con1 +drop database db1; +drop user foo@localhost; +--echo # +--echo # MDEV-28455: CREATE TEMPORARY TABLES privilege +--echo # is insufficient for SHOW COLUMNS +--echo # + +create database db; +create user foo@localhost; +create user bar@localhost; +create user buz@localhost; +grant create temporary tables on db.* to foo@localhost; +grant create temporary tables on db.* to bar@localhost; + +--connect (con1,localhost,foo,,db) +create temporary table tmp (a int, key(a)); +show tables; +show full tables; +show table status; +show index in tmp; +show columns in tmp; +show full columns in tmp; +--echo # we don't expect to show temporary tables in information_schema.columns +select * from information_schema.columns where table_schema='db'; +--disconnect con1 + +--connect (con1,localhost,bar,,db) +# User doesn't have `select` privilege on table +--error ER_TABLEACCESS_DENIED_ERROR +show full columns in tmp; + +--disconnect con1 + +--connection default +grant select on db.* to bar@localhost; + +--connect (con1,localhost,bar,,db) +# Table doesn't exist for this session +show grants for current_user; +--error ER_NO_SUCH_TABLE +show full columns in tmp; +--disconnect con1 + +--connect (con1,localhost,buz,,) +--error ER_TABLEACCESS_DENIED_ERROR +show columns in db.tmp; +--disconnect con1 + +--connection default +# Cleanup +drop database db; +drop user foo@localhost; +drop user bar@localhost; +drop user buz@localhost; + +CREATE USER foo; +CREATE DATABASE db; +CREATE TABLE db.test_getcolpriv(col1 INT, col2 INT); + +GRANT SELECT (col1,col2) ON db.test_getcolpriv TO foo; +GRANT INSERT (col1) ON db.test_getcolpriv TO foo; + +SHOW GRANTS FOR foo; +REVOKE SELECT (col1,col2) ON db.test_getcolpriv FROM foo; +SHOW GRANTS FOR foo; +REVOKE INSERT (col1) ON db.test_getcolpriv FROM foo; + +SHOW GRANTS FOR foo; +FLUSH PRIVILEGES; +SHOW GRANTS FOR foo; + +DROP USER foo; +DROP DATABASE db; + --echo # End of 10.3 tests # @@ -265,4 +408,16 @@ insert mysql.host values (1); flush privileges; drop table mysql.host; +--echo # +--echo # MDEV-30826 Invalid data on mysql.host segfaults the server after an upgrade to 10.4 +--echo # + +# from mysql_system_tables.sql in 10.3: +create table mysql.host (host char(60) binary default '' not null, db char(64) binary 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, 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, 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, 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, execute_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, primary key /*host*/ (host,db)) engine=myisam character set utf8 collate utf8_bin comment='host privileges; merged with database privileges'; +insert mysql.host values('10.5.0.0/255.255.0.0','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','N'); +flush privileges; +drop table mysql.host; + +--echo # --echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/grant_4332.test b/mysql-test/main/grant_4332.test index 2e46e90d81723..8ee42e0f6e028 100644 --- a/mysql-test/main/grant_4332.test +++ b/mysql-test/main/grant_4332.test @@ -20,7 +20,9 @@ alter table mysql.event modify definer char(77) collate utf8_bin not null defaul flush privileges; --enable_metadata +--disable_view_protocol select user(); +--enable_view_protocol --disable_metadata --error ER_WRONG_STRING_LENGTH @@ -40,7 +42,9 @@ alter table mysql.event modify definer varchar(384) collate utf8_bin not null de flush privileges; --enable_metadata +--disable_view_protocol select user(); +--enable_view_protocol --disable_metadata set global sql_mode=default; diff --git a/mysql-test/main/grant_cache_no_prot.result b/mysql-test/main/grant_cache_no_prot.result index 780fb254b7640..1ecfc3084225a 100644 --- a/mysql-test/main/grant_cache_no_prot.result +++ b/mysql-test/main/grant_cache_no_prot.result @@ -154,7 +154,7 @@ a b c a 1 1 1 test.t1 2 2 2 test.t1 select * from t2; -ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table `mysqltest`.`t2` show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 6 @@ -170,7 +170,7 @@ select "user3"; user3 user3 select * from t1; -ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table `mysqltest`.`t1` select a from t1; a 1 @@ -178,7 +178,7 @@ a select c from t1; ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1' select * from t2; -ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table `mysqltest`.`t2` select mysqltest.t1.c from test.t1,mysqltest.t1; ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1' show status like "Qcache_queries_in_cache"; diff --git a/mysql-test/main/grant_cache_ps_prot.result b/mysql-test/main/grant_cache_ps_prot.result index 9dcf8c4aa8f8e..d6f343d64597b 100644 --- a/mysql-test/main/grant_cache_ps_prot.result +++ b/mysql-test/main/grant_cache_ps_prot.result @@ -154,7 +154,7 @@ a b c a 1 1 1 test.t1 2 2 2 test.t1 select * from t2; -ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table `mysqltest`.`t2` show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 6 @@ -170,7 +170,7 @@ select "user3"; user3 user3 select * from t1; -ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table `mysqltest`.`t1` select a from t1; a 1 @@ -178,7 +178,7 @@ a select c from t1; ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1' select * from t2; -ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table `mysqltest`.`t2` select mysqltest.t1.c from test.t1,mysqltest.t1; ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1' show status like "Qcache_queries_in_cache"; diff --git a/mysql-test/main/grant_explain_non_select.result b/mysql-test/main/grant_explain_non_select.result index 53b7d687d6c95..8400b03ce9f26 100644 --- a/mysql-test/main/grant_explain_non_select.result +++ b/mysql-test/main/grant_explain_non_select.result @@ -10,13 +10,13 @@ connect con1,localhost,privtest,,; connection con1; USE privtest_db; EXPLAIN INSERT INTO t1 VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` INSERT INTO t1 VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` INSERT INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` connection default; GRANT INSERT ON privtest_db.t1 TO 'privtest'@'localhost'; connection con1; @@ -32,36 +32,36 @@ connection default; REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost'; connection con1; EXPLAIN REPLACE INTO t1 VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 VALUES (10); -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` connection default; GRANT INSERT ON privtest_db.t1 TO 'privtest'@'localhost'; connection con1; EXPLAIN REPLACE INTO t1 VALUES (10); -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 VALUES (10); -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` connection default; REVOKE INSERT ON privtest_db.t1 FROM 'privtest'@'localhost'; GRANT DELETE ON privtest_db.t1 TO 'privtest'@'localhost'; connection con1; EXPLAIN REPLACE INTO t1 VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 VALUES (10); -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` REPLACE INTO t1 SELECT * FROM t2; -ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` connection default; GRANT INSERT, DELETE ON privtest_db.t1 TO 'privtest'@'localhost'; connection con1; @@ -77,13 +77,13 @@ connection default; REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost'; connection con1; EXPLAIN UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` connection default; GRANT UPDATE ON privtest_db.t1 TO 'privtest'@'localhost'; connection con1; @@ -100,13 +100,13 @@ REVOKE UPDATE ON privtest_db.t1 FROM 'privtest'@'localhost'; GRANT SELECT ON privtest_db.t1 TO 'privtest'@'localhost'; connection con1; EXPLAIN UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1 SET a = a + 1; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` connection default; GRANT UPDATE, SELECT ON privtest_db.t1 TO 'privtest'@'localhost'; connection con1; @@ -123,13 +123,13 @@ connection default; REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost'; connection con1; EXPLAIN DELETE FROM t1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` connection default; GRANT DELETE ON privtest_db.t1 TO 'privtest'@'localhost'; connection con1; @@ -138,21 +138,21 @@ ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' DELETE FROM t1 WHERE a = 10; ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1' EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` connection default; REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost'; GRANT SELECT ON privtest_db.t1 TO 'privtest'@'localhost'; connection con1; EXPLAIN DELETE FROM t1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 WHERE a = 10; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table `privtest_db`.`t1` connection default; REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost'; GRANT DELETE, SELECT ON privtest_db.t1 TO 'privtest'@'localhost'; diff --git a/mysql-test/main/grant_kill.test b/mysql-test/main/grant_kill.test index b29dfb329171a..75a25743dc9bc 100644 --- a/mysql-test/main/grant_kill.test +++ b/mysql-test/main/grant_kill.test @@ -7,6 +7,7 @@ --echo # --echo # MDEV-21743 Split up SUPER privilege to smaller privileges --echo # +--disable_service_connection --let $count_sessions=1 @@ -83,6 +84,8 @@ let $wait_condition= DROP USER foo@localhost; DROP USER bar@localhost; +--enable_service_connection + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/grant_lowercase_fs.result b/mysql-test/main/grant_lowercase_fs.result index e883067eca034..413c3f482a6a0 100644 --- a/mysql-test/main/grant_lowercase_fs.result +++ b/mysql-test/main/grant_lowercase_fs.result @@ -6,12 +6,12 @@ GRANT SELECT ON db1.* to USER_1@localhost; connect con1,localhost,user_1,,db1; CREATE TABLE t1(f1 int); SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db1`.`t1` connect con2,localhost,USER_1,,db1; SELECT * FROM t1; f1 CREATE TABLE t2(f1 int); -ERROR 42000: CREATE command denied to user 'USER_1'@'localhost' for table 't2' +ERROR 42000: CREATE command denied to user 'USER_1'@'localhost' for table `db1`.`t2` connection default; disconnect con1; disconnect con2; diff --git a/mysql-test/main/grant_repair.result b/mysql-test/main/grant_repair.result index d97bcc38a0861..6ebe043e4d4e9 100644 --- a/mysql-test/main/grant_repair.result +++ b/mysql-test/main/grant_repair.result @@ -3,7 +3,7 @@ call mtr.add_suppression("mysql.user"); flush tables; flush privileges; Warnings: -Error 145 Table './mysql/user' is marked as crashed and should be repaired +Error 145 Got error '145 "Table was marked as crashed and should be repaired"' for './mysql/user' Warning 1034 12544 clients are using or haven't closed the table properly Note 1034 Table is fixed # switching back from mysql.user to mysql.global_priv diff --git a/mysql-test/main/group_by.result b/mysql-test/main/group_by.result index 8c1ba102e8f9f..b7bbab6dd47af 100644 --- a/mysql-test/main/group_by.result +++ b/mysql-test/main/group_by.result @@ -829,11 +829,11 @@ set sql_mode=''; SELECT a FROM t1 HAVING 'a' > 1; a Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' SELECT a FROM t1 HAVING "a" > 1; a Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' SELECT a FROM t1 HAVING `a` > 1; a 2 @@ -1036,8 +1036,9 @@ FROM t1 AS t1_outer GROUP BY t1_outer.b; 21 21 SELECT (SELECT SUM(t1_inner.a) FROM t1 AS t1_inner GROUP BY t1_inner.b LIMIT 1) +AS m FROM t1 AS t1_outer; -(SELECT SUM(t1_inner.a) FROM t1 AS t1_inner GROUP BY t1_inner.b LIMIT 1) +m 3 3 3 @@ -1277,12 +1278,9 @@ a select avg ( (select (select sum(outr.a + innr.a) from t1 as innr limit 1) as tt -from t1 as outr order by outr.a limit 1)) +from t1 as outr order by outr.a limit 1)) as m from t1 as most_outer; -avg ( -(select -(select sum(outr.a + innr.a) from t1 as innr limit 1) as tt -from t1 as outr order by outr.a limit 1)) +m 29.0000 select avg ( (select ( @@ -2334,17 +2332,17 @@ field1 field2 2004-10-11 18:13:00 1 2009-02-19 02:05:00 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'g' -Warning 1292 Truncated incorrect DOUBLE value: 'o' -Warning 1292 Truncated incorrect DOUBLE value: 'v' +Warning 1292 Truncated incorrect DECIMAL value: 'g' +Warning 1292 Truncated incorrect DECIMAL value: 'o' +Warning 1292 Truncated incorrect DECIMAL value: 'v' SELECT alias2.f3 AS field1 , alias2.f1 AS field2 FROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f1 = alias1.f2 AND alias2.f1 != alias1.f4 GROUP BY field1 , field2 ; field1 field2 2004-10-11 18:13:00 1 2009-02-19 02:05:00 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'g' -Warning 1292 Truncated incorrect DOUBLE value: 'o' -Warning 1292 Truncated incorrect DOUBLE value: 'v' +Warning 1292 Truncated incorrect DECIMAL value: 'g' +Warning 1292 Truncated incorrect DECIMAL value: 'o' +Warning 1292 Truncated incorrect DECIMAL value: 'v' SET SESSION SQL_MODE=default; drop table t1; # diff --git a/mysql-test/main/group_by.test b/mysql-test/main/group_by.test index 97209b50cda88..7f81c787c36c9 100644 --- a/mysql-test/main/group_by.test +++ b/mysql-test/main/group_by.test @@ -90,6 +90,7 @@ drop table t1; # Problem with GROUP BY + ORDER BY when no match # Tested with locking # +--disable_service_connection CREATE TABLE t1 ( cid mediumint(9) NOT NULL auto_increment, @@ -123,6 +124,7 @@ drop table t2; unlock tables; drop table t1; +--enable_service_connection # # Test of group by bug in bugzilla # @@ -278,6 +280,7 @@ drop table t1; # Compare with hash keys +--disable_view_protocol CREATE TABLE t1 (a char(1)); INSERT INTO t1 VALUES ('A'),('B'),('A'),('B'),('A'),('B'),(NULL),('a'),('b'),(NULL),('A'),('B'),(NULL); flush status; @@ -303,6 +306,7 @@ show status like 'Created%tables'; --enable_ps_protocol set tmp_memory_table_size=default; drop table t1; +--enable_view_protocol # # Test of key >= 256 bytes @@ -637,12 +641,16 @@ SELECT a FROM t1 GROUP BY 'a'; SELECT a FROM t1 GROUP BY "a"; SELECT a FROM t1 GROUP BY `a`; +--disable_service_connection + set sql_mode=ANSI_QUOTES; SELECT a FROM t1 GROUP BY "a"; SELECT a FROM t1 GROUP BY 'a'; SELECT a FROM t1 GROUP BY `a`; set sql_mode=''; +--enable_service_connection + SELECT a FROM t1 HAVING 'a' > 1; SELECT a FROM t1 HAVING "a" > 1; SELECT a FROM t1 HAVING `a` > 1; @@ -680,6 +688,9 @@ DROP TABLE t1, t2; # Bug#11211: Ambiguous column reference in GROUP BY. # +#disable --view-prototcol because warnings are dropped +--disable_view_protocol + create table t1 (c1 char(3), c2 char(3)); create table t2 (c3 char(3), c4 char(3)); insert into t1 values ('aaa', 'bb1'), ('aaa', 'bb2'); @@ -697,6 +708,8 @@ group by t1.c1; show warnings; drop table t1, t2; +--enable_view_protocol + # # Bug #20466: a view is mixing data when there's a trigger on the table # @@ -769,8 +782,11 @@ SELECT 1 FROM t1 as t1_outer GROUP BY a HAVING (SELECT t1_outer.b FROM t1 AS t1_inner LIMIT 1); SELECT (SELECT SUM(t1_inner.a) FROM t1 AS t1_inner LIMIT 1) FROM t1 AS t1_outer GROUP BY t1_outer.b; + SELECT (SELECT SUM(t1_inner.a) FROM t1 AS t1_inner GROUP BY t1_inner.b LIMIT 1) +AS m FROM t1 AS t1_outer; + --error ER_WRONG_FIELD_WITH_GROUP SELECT (SELECT SUM(t1_outer.a) FROM t1 AS t1_inner LIMIT 1) FROM t1 AS t1_outer GROUP BY t1_outer.b; @@ -845,6 +861,7 @@ DROP TABLE t1; --echo # --echo # Bug#27219: Aggregate functions in ORDER BY. --echo # + SET @save_sql_mode=@@sql_mode; SET @@sql_mode='ONLY_FULL_GROUP_BY'; @@ -866,6 +883,8 @@ SELECT 1 FROM t1 ORDER BY SUM(a) + 1; --error 1140 SELECT 1 FROM t1 ORDER BY SUM(a), b; +--disable_service_connection + --error 1140 SELECT a FROM t1 ORDER BY COUNT(b); @@ -915,6 +934,8 @@ SELECT 1 FROM t1 GROUP BY t1.a SELECT 1 FROM t1 GROUP BY t1.a HAVING (SELECT AVG(t1.b + t2.b) FROM t2 ORDER BY t2.a LIMIT 1); +--enable_service_connection + # Both SUMs are aggregated in the subquery, no mixture: SELECT t1.a FROM t1 WHERE t1.a = (SELECT t2.a FROM t2 GROUP BY t2.a @@ -944,9 +965,11 @@ SELECT t1.a FROM t1 GROUP BY t1.a select avg ( (select (select sum(outr.a + innr.a) from t1 as innr limit 1) as tt - from t1 as outr order by outr.a limit 1)) + from t1 as outr order by outr.a limit 1)) as m from t1 as most_outer; +--disable_service_connection + --error 1140 select avg ( (select ( @@ -954,6 +977,8 @@ select avg ( from t1 as outr order by count(outr.a) limit 1)) as tt from t1 as most_outer; +--enable_service_connection + select (select sum(outr.a + t1.a) from t1 limit 1) as tt from t1 as outr order by outr.a; SET sql_mode=@save_sql_mode; @@ -1350,6 +1375,8 @@ DROP TABLE t1; --echo # Bug#11765254 (58200): Assertion failed: param.sort_length when grouping --echo # by functions --echo # +#creating view adds one new warning +--disable_view_protocol set tmp_memory_table_size=0; CREATE TABLE t1(a INT); @@ -1361,6 +1388,8 @@ SELECT 1 FROM t1 GROUP BY SUBSTRING(SYSDATE() FROM 'K' FOR 'jxW<'); DROP TABLE t1; set tmp_memory_table_size=default; +--enable_view_protocol + --echo # --echo # MDEV-641 LP:1002108 - Wrong result (or crash) from a query with duplicated field in the group list and a limit clause --echo # Bug#11761078: 53534: INCORRECT 'SELECT SQL_BIG_RESULT...' @@ -1621,6 +1650,10 @@ DROP TABLE t1, t2; # MDEV-736 LP:1004615 - Unexpected warnings "Encountered illegal value '' when converting to DECIMAL" on a query with aggregate functions and GROUP BY # +#the view protocol creates +# an additional util connection and other statistics data +--disable_view_protocol + FLUSH STATUS; # this test case *must* use Aria temp tables CREATE TABLE t1 (f1 INT, f2 decimal(20,1), f3 blob); @@ -1630,6 +1663,7 @@ DROP TABLE t1; --echo the value below *must* be 1 show status like 'Created_tmp_disk_tables'; +--enable_view_protocol --echo # --echo # Bug #1002146: Unneeded filesort if usage of join buffer is not allowed diff --git a/mysql-test/main/group_min_max.result b/mysql-test/main/group_min_max.result index 3195ec79c2de1..706a4132614c2 100644 --- a/mysql-test/main/group_min_max.result +++ b/mysql-test/main/group_min_max.result @@ -2080,19 +2080,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 276 98.44 Using where; Using index +1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 276 96.30 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 512 26.95 Using where; Using temporary; Using filesort +1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 512 26.37 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 512 26.95 Using where; Using temporary; Using filesort +1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 512 26.37 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; @@ -2100,7 +2100,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index NULL idx_t2_1 163 NULL 548 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 276 98.44 Using where; Using index +1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 276 96.30 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; @@ -3309,11 +3309,11 @@ b min(a) d 7 f 7 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'c' -Warning 1292 Truncated incorrect DOUBLE value: 'd' -Warning 1292 Truncated incorrect DOUBLE value: 'd' -Warning 1292 Truncated incorrect DOUBLE value: 'f' -Warning 1292 Truncated incorrect DOUBLE value: 'g' +Warning 1292 Truncated incorrect DECIMAL value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'd' +Warning 1292 Truncated incorrect DECIMAL value: 'd' +Warning 1292 Truncated incorrect DECIMAL value: 'f' +Warning 1292 Truncated incorrect DECIMAL value: 'g' explain SELECT b, min(a) FROM t1 WHERE (a > '0' AND (a > '1' OR b = 'd')) GROUP BY b; id select_type table type possible_keys key key_len ref rows Extra @@ -4028,6 +4028,76 @@ drop table t1; # End of 10.1 tests # # +# MDEV-27442 Wrong result upon query with DISTINCT and EXISTS subquery +# +CREATE TABLE t1 (a int, b int, KEY b (b,a)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (0,100),(2,100),(2,101),(3,102); +# Must not use Using index for group-by +explain SELECT DISTINCT b FROM t1 WHERE EXISTS ( SELECT 1 FROM DUAL WHERE a > 1 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 index NULL b 10 NULL 4 Using where; Using index +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +SELECT DISTINCT b FROM t1 WHERE EXISTS ( SELECT 1 FROM DUAL WHERE a > 1 ); +b +100 +101 +102 +DROP TABLE t1; +# +# MDEV-26585 Wrong query results when `using index for group-by` +# +CREATE TABLE `t1` ( +`id` int(11) NOT NULL AUTO_INCREMENT, +`owner_id` int(11) DEFAULT NULL, +`foo` tinyint(1) DEFAULT 0, +`whatever` varchar(255) DEFAULT NULL, +PRIMARY KEY (`id`), +KEY `index_t1_on_owner_id_and_foo` (`owner_id`,`foo`) +) engine=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO t1 (owner_id, foo, whatever) +VALUES (1, TRUE, "yello"), (1, FALSE, "yello"), (2, TRUE, "yello"), +(2, TRUE, "yello"), (2, FALSE, "yello"); +EXPLAIN +SELECT DISTINCT owner_id FROM t1 WHERE foo = true GROUP BY owner_id HAVING (COUNT(*) = 1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL index_t1_on_owner_id_and_foo 7 NULL # Using where; Using index +SELECT DISTINCT owner_id FROM t1 WHERE foo = true GROUP BY owner_id HAVING (COUNT(*) = 1); +owner_id +1 +DROP TABLE t1; +# +# MDEV-30240 Wrong result upon aggregate function with SQL_BUFFER_RESULT +# +drop table if exists t1,t2; +Warnings: +Note 1051 Unknown table 'test.t1,test.t2' +CREATE TABLE t1 (pk INT PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (a INT); +INSERT INTO t2 VALUES (1),(2); +SELECT SQL_BUFFER_RESULT MIN(pk) FROM t1, t2; +MIN(pk) +1 +SELECT MIN(pk) FROM t1, t2; +MIN(pk) +1 +DROP TABLE t1, t2; +# +# MDEV-30605 Wrong result while using index for group-by +# +CREATE TABLE t1 (pk INT primary key, a int, key(a)) engine=innodb; +INSERT INTO t1 VALUES (1,-1),(2,8),(3,5),(4,-1),(5,10), (6,-1); +SELECT MIN(pk), a FROM t1 WHERE pk <> 1 GROUP BY a; +MIN(pk) a +4 -1 +3 5 +2 8 +5 10 +DROP TABLE t1; +# +# End of 10.5 tests +# +# # MDEV-24353: Adding GROUP BY slows down a query # CREATE TABLE t1 (p int NOT NULL, a int NOT NULL, PRIMARY KEY (p,a)); diff --git a/mysql-test/main/group_min_max.test b/mysql-test/main/group_min_max.test index 1db479b1c7432..1bc334dd3da7c 100644 --- a/mysql-test/main/group_min_max.test +++ b/mysql-test/main/group_min_max.test @@ -3,9 +3,10 @@ # The queries in this file test query execution via QUICK_GROUP_MIN_MAX_SELECT. # +--source include/no_valgrind_without_big.inc --source include/default_optimizer_switch.inc --source include/have_sequence.inc - +--source include/have_innodb.inc # # TODO: # Add queries with: @@ -1691,6 +1692,67 @@ drop table t1; --echo # End of 10.1 tests --echo # +--echo # +--echo # MDEV-27442 Wrong result upon query with DISTINCT and EXISTS subquery +--echo # + +CREATE TABLE t1 (a int, b int, KEY b (b,a)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (0,100),(2,100),(2,101),(3,102); +--echo # Must not use Using index for group-by +explain SELECT DISTINCT b FROM t1 WHERE EXISTS ( SELECT 1 FROM DUAL WHERE a > 1 ); +SELECT DISTINCT b FROM t1 WHERE EXISTS ( SELECT 1 FROM DUAL WHERE a > 1 ); +DROP TABLE t1; + +--echo # +--echo # MDEV-26585 Wrong query results when `using index for group-by` +--echo # + +CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `owner_id` int(11) DEFAULT NULL, + `foo` tinyint(1) DEFAULT 0, + `whatever` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `index_t1_on_owner_id_and_foo` (`owner_id`,`foo`) +) engine=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO t1 (owner_id, foo, whatever) +VALUES (1, TRUE, "yello"), (1, FALSE, "yello"), (2, TRUE, "yello"), + (2, TRUE, "yello"), (2, FALSE, "yello"); +--replace_column 9 # +EXPLAIN +SELECT DISTINCT owner_id FROM t1 WHERE foo = true GROUP BY owner_id HAVING (COUNT(*) = 1); +SELECT DISTINCT owner_id FROM t1 WHERE foo = true GROUP BY owner_id HAVING (COUNT(*) = 1); +DROP TABLE t1; + +--echo # +--echo # MDEV-30240 Wrong result upon aggregate function with SQL_BUFFER_RESULT +--echo # + +drop table if exists t1,t2; +CREATE TABLE t1 (pk INT PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (a INT); +INSERT INTO t2 VALUES (1),(2); +SELECT SQL_BUFFER_RESULT MIN(pk) FROM t1, t2; +SELECT MIN(pk) FROM t1, t2; +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-30605 Wrong result while using index for group-by +--echo # + +CREATE TABLE t1 (pk INT primary key, a int, key(a)) engine=innodb; +INSERT INTO t1 VALUES (1,-1),(2,8),(3,5),(4,-1),(5,10), (6,-1); + +SELECT MIN(pk), a FROM t1 WHERE pk <> 1 GROUP BY a; + +DROP TABLE t1; + +--echo # +--echo # End of 10.5 tests +--echo # + --echo # --echo # MDEV-24353: Adding GROUP BY slows down a query --echo # diff --git a/mysql-test/main/handler_read_last.test b/mysql-test/main/handler_read_last.test index 9104be7895230..2f18e302fa091 100644 --- a/mysql-test/main/handler_read_last.test +++ b/mysql-test/main/handler_read_last.test @@ -1,3 +1,7 @@ +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings diff --git a/mysql-test/main/having.result b/mysql-test/main/having.result index 7106b42fc8dc4..d7cbadd5e7598 100644 --- a/mysql-test/main/having.result +++ b/mysql-test/main/having.result @@ -1,4 +1,3 @@ -drop table if exists t1,t2,t3; create table t1 (a int); select count(a) as b from t1 where a=0 having b > 0; b @@ -280,11 +279,7 @@ select t1.col1 as tmp_col from t1 where t1.col2 in (select t2.col2 from t2 group by t2.col1, t2.col2 having tmp_col <= 10); -tmp_col -10 -10 -10 -10 +ERROR 42S22: Unknown column 'tmp_col' in 'having clause' select t1.col1 from t1 where t1.col2 in (select t2.col2 from t2 @@ -529,7 +524,7 @@ ORDER BY t1.f2; MAX(t2.f2) NULL Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'd' +Warning 1292 Truncated incorrect DECIMAL value: 'd' DROP TABLE t1,t2; End of 5.0 tests # @@ -839,13 +834,13 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain SELECT t, next_seq_value() r FROM t1 FORCE INDEX(t) GROUP BY t HAVING r = 1 ORDER BY t1.u; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort +1 SIMPLE t1 index NULL t 5 NULL 8 Using temporary; Using filesort SELECT t, next_seq_value() r FROM t1 FORCE INDEX(t) GROUP BY t HAVING r = 1 ORDER BY t1.u; t r 10 1 12 1 -14 1 -16 1 +15 1 +17 1 DROP TABLE t1; DROP FUNCTION next_seq_value; DROP TABLE series; @@ -865,13 +860,13 @@ bar SELECT DEFAULT(f) AS h FROM t1 HAVING h > 5; h Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'A' +Warning 1292 Truncated incorrect DECIMAL value: 'A' SELECT DEFAULT(f) AS h FROM t1 HAVING h >= 0; h A A Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'A' +Warning 1292 Truncated incorrect DECIMAL value: 'A' SELECT DEFAULT(f) AS h FROM t1 HAVING h >= 'A'; h A @@ -882,8 +877,10 @@ h # # drop table t1; +# # End of 10.3 tests # +# # MDEV-18681: AND formula in HAVING with several occurances # of the same field f in different conjuncts + f=constant # @@ -897,7 +894,7 @@ HAVING t.f != 112 AND t.f = 'x' AND t.f != 'a'; f x Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'x' DROP TABLE t1,t2; # # MDEV-20200: AddressSanitizer: use-after-poison in @@ -908,4 +905,6 @@ INSERT INTO t VALUES ('a'),('b'); SELECT * FROM t HAVING f = 'foo'; f DROP TABLE t; +# # End of 10.4 tests +# diff --git a/mysql-test/main/having.test b/mysql-test/main/having.test index 5e091afec1ea8..ce86c99865ae9 100644 --- a/mysql-test/main/having.test +++ b/mysql-test/main/having.test @@ -1,10 +1,6 @@ # test of problems with having (Reported by Mark Rogers) # ---disable_warnings -drop table if exists t1,t2,t3; ---enable_warnings - create table t1 (a int); select count(a) as b from t1 where a=0 having b > 0; insert into t1 values (null); @@ -207,7 +203,7 @@ select count(*) from t1 group by col1 having col1 = 10; select count(*) as count_col1 from t1 group by col1 having col1 = 10; select count(*) as count_col1 from t1 as tmp1 group by col1 having col1 = 10; select count(*) from t1 group by col2 having col2 = 'hello'; ---error 1054 +--error ER_BAD_FIELD_ERROR select count(*) from t1 group by col2 having col1 = 10; select col1 as count_col1 from t1 as tmp1 group by col1 having col1 = 10; select col1 as count_col1 from t1 as tmp1 group by col1 having count_col1 = 10; @@ -221,10 +217,10 @@ select col1 as count_col1,col2 from t1 as tmp1 group by col1,col2 having col1 = select col1 as count_col1,col2 from t1 as tmp1 group by col1,col2 having count_col1 = 10; select col1 as count_col1,col2 from t1 as tmp1 group by col1,col2 having col2 = 'hello'; select col1 as count_col1,col2 as group_col2 from t1 as tmp1 group by col1,col2 having group_col2 = 'hello'; ---error 1064 +--error ER_PARSE_ERROR select sum(col1) as co12 from t1 group by col2 having col2 10; select sum(col1) as co2, count(col2) as cc from t1 group by col1 having col1 =10; ---error 1054 +--error ER_BAD_FIELD_ERROR select t2.col2 from t2 group by t2.col1, t2.col2 having t1.col1 <= 10; @@ -253,7 +249,8 @@ where t1.col2 in group by t2.col1, t2.col2 having t1.col1 <= 10); # the having column is resolved in the SELECT clause of the outer query - -# error in ANSI, works with MySQL extension +# error in ANSI +--error ER_BAD_FIELD_ERROR select t1.col1 as tmp_col from t1 where t1.col2 in (select t2.col2 from t2 @@ -273,7 +270,7 @@ having (select col_t1 from t2 where col_t1 = col_t2 order by col_t2 limit 1); # nested queries with HAVING, inner having column resolved in outer FROM clause # the outer having column is not referenced in GROUP BY which results in an error ---error 1054 +--error ER_BAD_FIELD_ERROR select t1.col1 from t1 where t1.col2 in (select t2.col2 from t2 @@ -302,7 +299,7 @@ having col_t1 > 10 and # correlated subqueries - inner having column 't1.col2' resolves to # the outer FROM clause, which cannot be used because the outer query # is grouped ---error 1054 +--error ER_BAD_FIELD_ERROR select sum(col1) from t1 group by col_t1 having col_t1 in (select sum(t2.col1) from t2 @@ -318,11 +315,11 @@ having col_t1 in (select sum(t2.col1) from t2 # # queries with joins and ambiguous column names # ---error 1052 +--error ER_NON_UNIQ_ERROR select t1.col1, t2.col1 from t1, t2 where t1.col1 = t2.col1 group by t1.col1, t2.col1 having col1 = 2; ---error 1052 +--error ER_NON_UNIQ_ERROR select t1.col1*10+t2.col1 from t1,t2 where t1.col1=t2.col1 group by t1.col1, t2.col1 having col1 = 2; @@ -336,7 +333,9 @@ select count(*) from t1 group by s1 having s1 is null; # prepared statements prints warnings too early --disable_ps_protocol +--disable_view_protocol select s1*0 as s1 from t1 group by s1 having s1 <> 0; +--enable_view_protocol --enable_ps_protocol # ANSI requires: 3 rows @@ -352,7 +351,7 @@ select count(s1) from t1 group by s1 having count(1+1)=2; select count(s1) from t1 group by s1 having s1*0=0; --- error 1052 +-- error ER_NON_UNIQ_ERROR select * from t1 a, t1 b group by a.s1 having s1 is null; # ANSI requires: 0 rows # MySQL returns: @@ -379,6 +378,7 @@ drop table t1; # Bug #15917: unexpected complain for a name in having clause # when the server is run on Windows or with --lower-case-table-names=1 # +--disable_service_connection --disable_warnings DROP SCHEMA IF EXISTS HU; @@ -420,6 +420,9 @@ SELECT EMPNUM, GRADE*1000 DROP SCHEMA HU; USE test; + +--enable_service_connection + # # Bug#18739: non-standard HAVING extension was allowed in strict ANSI sql mode. # @@ -470,6 +473,9 @@ DROP TABLE t1; --echo # --echo # Bug#48916 Server incorrectly processing HAVING clauses with an ORDER BY clause --echo # + +--disable_view_protocol + CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT, f3 INT); INSERT INTO t1 VALUES (2,7,9), (4,7,9), (6,2,9), (17,0,9); @@ -498,6 +504,8 @@ HAVING (table2.f2 = 8); DROP TABLE t1; +--enable_view_protocol + --echo # --echo # Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355 --echo # @@ -912,7 +920,9 @@ alter table t1 add column b int default (rand()+1+3); select default(b) AS h FROM t1 HAVING h > "2"; drop table t1; +--echo # --echo # End of 10.3 tests +--echo # --echo # --echo # MDEV-18681: AND formula in HAVING with several occurances @@ -930,7 +940,6 @@ HAVING t.f != 112 AND t.f = 'x' AND t.f != 'a'; DROP TABLE t1,t2; - --echo # --echo # MDEV-20200: AddressSanitizer: use-after-poison in --echo # Item_direct_view_ref::get_null_ref_table @@ -943,4 +952,6 @@ SELECT * FROM t HAVING f = 'foo'; # Cleanup DROP TABLE t; +--echo # --echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/having_cond_pushdown.result b/mysql-test/main/having_cond_pushdown.result index 443745db643d3..59388aa7ca072 100644 --- a/mysql-test/main/having_cond_pushdown.result +++ b/mysql-test/main/having_cond_pushdown.result @@ -5524,3 +5524,49 @@ SELECT a FROM t1 GROUP BY a HAVING a = ( SELECT MIN(c) FROM t2 ); a 2 DROP TABLE t1,t2; +# +# MDEV-26402: A SEGV in Item_field::used_tables/update_depend_map_for_order or Assertion `fixed == 1' +# +CREATE TABLE t1 (i int NOT NULL); +SELECT * FROM t1 GROUP BY i HAVING i IN ( i IS NULL); +i +SELECT * FROM t1 GROUP BY i HAVING i IN ( i IS NULL AND 'x' = 0); +i +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: 'x' +SELECT * FROM t1 GROUP BY i HAVING i='1' IN ( i IS NULL AND 'x' = 0); +i +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: 'x' +DROP TABLE t1; +# +# MDEV-28080: HAVING with NOT EXIST predicate in an equality +# (fixed by the patch for MDEV-26402) +# +CREATE TABLE t1 (a int); +CREATE TABLE t2 (b int); +INSERT INTO t1 VALUES (0), (1), (1), (0); +INSERT INTO t2 VALUES (3), (7); +SELECT a FROM t1 +GROUP BY a HAVING a= (NOT EXISTS (SELECT b FROM t2 WHERE b = 1)); +a +1 +SELECT a FROM t1 +GROUP BY a HAVING a= (NOT EXISTS (SELECT b FROM t2 WHERE b = 7)); +a +0 +DROP TABLE t1, t2; +# +# MDEV-28082: HAVING with IS NULL predicate in an equality +# (fixed by the patch for MDEV-26402) +# +CREATE TABLE t1 (a int, b int NOT NULL) ; +INSERT INTO t1 VALUES (1,10), (0,11), (0,11), (1,10); +SELECT a,b FROM t1 GROUP BY a HAVING a = (b IS NULL); +a b +0 11 +SELECT a,b FROM t1 GROUP BY a,b HAVING a = (b IS NULL); +a b +0 11 +DROP TABLE t1; +End of 10.4 tests diff --git a/mysql-test/main/having_cond_pushdown.test b/mysql-test/main/having_cond_pushdown.test index 60ed7ebb6603b..99e4a597f22f3 100644 --- a/mysql-test/main/having_cond_pushdown.test +++ b/mysql-test/main/having_cond_pushdown.test @@ -1444,3 +1444,49 @@ eval EXPLAIN FORMAT=JSON $q; eval $q; DROP TABLE t1,t2; + +--echo # +--echo # MDEV-26402: A SEGV in Item_field::used_tables/update_depend_map_for_order or Assertion `fixed == 1' +--echo # + +CREATE TABLE t1 (i int NOT NULL); +SELECT * FROM t1 GROUP BY i HAVING i IN ( i IS NULL); +#dublicate warning +--disable_view_protocol +SELECT * FROM t1 GROUP BY i HAVING i IN ( i IS NULL AND 'x' = 0); +SELECT * FROM t1 GROUP BY i HAVING i='1' IN ( i IS NULL AND 'x' = 0); +--enable_view_protocol +DROP TABLE t1; + +--echo # +--echo # MDEV-28080: HAVING with NOT EXIST predicate in an equality +--echo # (fixed by the patch for MDEV-26402) +--echo # + +CREATE TABLE t1 (a int); +CREATE TABLE t2 (b int); +INSERT INTO t1 VALUES (0), (1), (1), (0); +INSERT INTO t2 VALUES (3), (7); + +SELECT a FROM t1 + GROUP BY a HAVING a= (NOT EXISTS (SELECT b FROM t2 WHERE b = 1)); +SELECT a FROM t1 + GROUP BY a HAVING a= (NOT EXISTS (SELECT b FROM t2 WHERE b = 7)); + +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-28082: HAVING with IS NULL predicate in an equality +--echo # (fixed by the patch for MDEV-26402) +--echo # + +CREATE TABLE t1 (a int, b int NOT NULL) ; +INSERT INTO t1 VALUES (1,10), (0,11), (0,11), (1,10); + +SELECT a,b FROM t1 GROUP BY a HAVING a = (b IS NULL); + +SELECT a,b FROM t1 GROUP BY a,b HAVING a = (b IS NULL); + +DROP TABLE t1; + +--echo End of 10.4 tests diff --git a/mysql-test/main/help.result b/mysql-test/main/help.result index 130aacf6644da..2e5fcff2edca0 100644 --- a/mysql-test/main/help.result +++ b/mysql-test/main/help.result @@ -274,12 +274,16 @@ delete from mysql.help_relation where help_keyword_id=@keyword1_id and help_topi delete from mysql.help_relation where help_keyword_id=@keyword2_id and help_topic_id=@topic1_id; delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic3_id; delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic4_id; -End of 4.1 tests. -DROP TABLE IF EXISTS t1; +flush tables; +# +# End of 4.1 tests. +# CREATE TABLE t1 (i INT); LOCK TABLES t1 WRITE; HELP no_such_topic; name is_it_category UNLOCK TABLES; DROP TABLE t1; -End of 5.1 tests. +# +# End of 5.1 tests. +# diff --git a/mysql-test/main/help.test b/mysql-test/main/help.test index 725eec2771f8f..c464e4812bc4d 100644 --- a/mysql-test/main/help.test +++ b/mysql-test/main/help.test @@ -122,25 +122,22 @@ delete from mysql.help_relation where help_keyword_id=@keyword2_id and help_topi delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic3_id; delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic4_id; ---echo End of 4.1 tests. +flush tables; +--echo # +--echo # End of 4.1 tests. +--echo # # # Test that we can use HELP even under LOCK TABLES. See bug#9953: # CONVERT_TZ requires mysql.time_zone_name to be locked. # ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings CREATE TABLE t1 (i INT); - LOCK TABLES t1 WRITE; - HELP no_such_topic; - UNLOCK TABLES; - DROP TABLE t1; - ---echo End of 5.1 tests. +--echo # +--echo # End of 5.1 tests. +--echo # diff --git a/mysql-test/main/ignored_index.result b/mysql-test/main/ignored_index.result index 84263dddd4d96..03748d480987c 100644 --- a/mysql-test/main/ignored_index.result +++ b/mysql-test/main/ignored_index.result @@ -99,7 +99,7 @@ t1 CREATE TABLE `t1` ( KEY `a` (`a`), KEY `b` (`b`) IGNORED, KEY `c` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # Test that primary key indexes can't be made ignorable. CREATE TABLE t1 ( a INT, PRIMARY KEY (a) IGNORED ); @@ -393,7 +393,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, KEY `k1` (`a`) IGNORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci EXPLAIN SELECT * FROM t1 FORCE INDEX(k1); ERROR 42000: Key 'k1' doesn't exist in table 't1' DROP TABLE t1; @@ -407,7 +407,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, KEY `a` (`a`) IGNORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a INT, KEY (a) IGNORED); show create table t1; @@ -415,7 +415,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, KEY `a` (`a`) IGNORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Tests to check usage of IGNORED keyword @@ -468,7 +468,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, KEY `a` (`a`) IGNORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a INT, KEY (a)); ALTER TABLE t1 ALTER KEY a IGNORED; @@ -477,7 +477,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, KEY `a` (`a`) IGNORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-25078, part #2: allow IF EXISTS @@ -496,7 +496,7 @@ t1 CREATE TABLE `t1` ( KEY `a` (`a`) IGNORED, KEY `b` (`b`), KEY `c` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 alter key if exists no_such_key ignored, alter key if exists c ignored ; @@ -511,7 +511,7 @@ t1 CREATE TABLE `t1` ( KEY `a` (`a`) IGNORED, KEY `b` (`b`), KEY `c` (`c`) IGNORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 alter key if exists no_such_key not ignored, alter key if exists c not ignored ; @@ -526,5 +526,5 @@ t1 CREATE TABLE `t1` ( KEY `a` (`a`) IGNORED, KEY `b` (`b`), KEY `c` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; diff --git a/mysql-test/main/implicit_commit.test b/mysql-test/main/implicit_commit.test index 09f2e2e921e52..1b59d65a8467b 100644 --- a/mysql-test/main/implicit_commit.test +++ b/mysql-test/main/implicit_commit.test @@ -1,3 +1,7 @@ +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + source include/have_innodb.inc; source include/not_embedded.inc; source include/have_profiling.inc; diff --git a/mysql-test/main/index_merge_innodb.result b/mysql-test/main/index_merge_innodb.result index ada2abdc0d6a3..d9be08a0540ad 100644 --- a/mysql-test/main/index_merge_innodb.result +++ b/mysql-test/main/index_merge_innodb.result @@ -263,7 +263,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`t_cpac`,`t_vers`,`t_rele`,`t_cust`), UNIQUE KEY `IX_4` (`t_cust`,`t_cpac`,`t_vers`,`t_rele`), KEY `IX_5` (`t_vers`,`t_rele`,`t_cust`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6'; t_vers t_rele t_cust filler1 7.6 a diff --git a/mysql-test/main/index_merge_innodb.test b/mysql-test/main/index_merge_innodb.test index e8ebb6b2a6439..82f3c756da41b 100644 --- a/mysql-test/main/index_merge_innodb.test +++ b/mysql-test/main/index_merge_innodb.test @@ -11,6 +11,7 @@ # # Slow test, don't run during staging part +--source include/long_test.inc --source include/not_staging.inc --source include/have_innodb.inc diff --git a/mysql-test/main/index_merge_myisam.result b/mysql-test/main/index_merge_myisam.result index 053239b7fb199..1ecc1ded83a8a 100644 --- a/mysql-test/main/index_merge_myisam.result +++ b/mysql-test/main/index_merge_myisam.result @@ -180,17 +180,29 @@ or id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 index_merge i1,i2,i3,i5,i6,i7 i3,i5 4,4 NULL 9 Using sort_union(i3,i5); Using where explain select * from t0 where -((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4)) +((key3 < 4 or key5 < 4) and (key1 < 4 or key2 < 4)) or ((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6)); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 Using where explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where -((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4)) +((key3 < 4 or key5 < 4) and (key1 < 4 or key2 < 4)) +or +((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6)); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 index_merge i1,i2,i3,i5,i6 i3,i5 4,4 NULL 1024 Using sort_union(i3,i5); Using where +explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where +((key3 < 5 or key5 < 4) and (key1 < 4 or key2 < 4)) or ((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6)); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2,i3,i5,i6 i3,i5 0,4 NULL 1024 Using sort_union(i3,i5); Using where +1 SIMPLE t0 ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 Using where +explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where +((key3 < 10 or key5 < 4) and (key1 < 4 or key2 < 4)) +or +((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6)); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 Using where select * from t0 where key1 < 5 or key8 < 4 order by key1; key1 key2 key3 key4 key5 key6 key7 key8 1 1 1 1 1 1 1 1023 @@ -1083,7 +1095,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`t_cpac`,`t_vers`,`t_rele`,`t_cust`), UNIQUE KEY `IX_4` (`t_cust`,`t_cpac`,`t_vers`,`t_rele`), KEY `IX_5` (`t_vers`,`t_rele`,`t_cust`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6'; t_vers t_rele t_cust filler1 7.6 a @@ -1690,7 +1702,7 @@ SELECT * FROM t1 FORCE KEY (PRIMARY , i , c1 , c2) WHERE pk = 255 OR i = 22 OR (pk IN (1 , 136) AND c2 IN ('c' , 'w') AND (c1 NOT BETWEEN 'e' AND 'i' OR c2 > 'g')) OR (pk is not null and (pk <1 or pk>1)) ; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,c1,i,c2 PRIMARY,i 0,5 NULL 69 Using sort_union(PRIMARY,i); Using where +1 SIMPLE t1 ALL PRIMARY,c1,i,c2 NULL NULL NULL 69 Using where DROP TABLE t1; set optimizer_switch= @optimizer_switch_save; # diff --git a/mysql-test/main/index_merge_myisam.test b/mysql-test/main/index_merge_myisam.test index 10ddbee36b296..0437f9138cb21 100644 --- a/mysql-test/main/index_merge_myisam.test +++ b/mysql-test/main/index_merge_myisam.test @@ -9,6 +9,7 @@ # wrapper t/index_merge_innodb.test sources now several # include/index_merge*.inc files # +--source include/no_valgrind_without_big.inc SET DEFAULT_STORAGE_ENGINE = MyISAM; # MyISAM supports Merge tables diff --git a/mysql-test/main/information_schema.result b/mysql-test/main/information_schema.result index c497112f2abfc..156a7a1157866 100644 --- a/mysql-test/main/information_schema.result +++ b/mysql-test/main/information_schema.result @@ -230,7 +230,7 @@ Field Type Collation Null Key Default Extra Privileges Comment Insert_priv enum('N','Y') utf8mb3_general_ci NO N select,insert,update,references show full columns from v1; Field Type Collation Null Key Default Extra Privileges Comment -c varchar(64) utf8mb3_general_ci NO select,insert,update,references +c varchar(64) utf8mb3_general_ci NO NULL select,insert,update,references select * from information_schema.COLUMNS where table_name="t1" and column_name= "a"; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION @@ -533,7 +533,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `constraint_1` (`a`), UNIQUE KEY `key_1` (`a`), UNIQUE KEY `key_2` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from information_schema.TABLE_CONSTRAINTS where TABLE_SCHEMA= "test"; CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE @@ -609,20 +609,20 @@ drop table t1; SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets; Table Create Table CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` ( - `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '', - `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL DEFAULT '', - `DESCRIPTION` varchar(60) NOT NULL DEFAULT '', - `MAXLEN` bigint(3) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `CHARACTER_SET_NAME` varchar(32) NOT NULL, + `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL, + `DESCRIPTION` varchar(60) NOT NULL, + `MAXLEN` bigint(3) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci set names latin2; SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets; Table Create Table CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` ( - `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '', - `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL DEFAULT '', - `DESCRIPTION` varchar(60) NOT NULL DEFAULT '', - `MAXLEN` bigint(3) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `CHARACTER_SET_NAME` varchar(32) NOT NULL, + `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL, + `DESCRIPTION` varchar(60) NOT NULL, + `MAXLEN` bigint(3) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci set names latin1; create table t1 select * from information_schema.CHARACTER_SETS where CHARACTER_SET_NAME like "latin1"; @@ -633,11 +633,11 @@ alter table t1 default character set utf8; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '', - `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL DEFAULT '', - `DESCRIPTION` varchar(60) NOT NULL DEFAULT '', - `MAXLEN` bigint(3) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 + `CHARACTER_SET_NAME` varchar(32) NOT NULL, + `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL, + `DESCRIPTION` varchar(60) NOT NULL, + `MAXLEN` bigint(3) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci drop table t1; create view v1 as select * from information_schema.TABLES; drop view v1; @@ -1090,7 +1090,7 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE show grants; Grants for user1@localhost GRANT USAGE ON *.* TO `user1`@`localhost` -GRANT SELECT (f1) ON `mysqltest`.`t1` TO `user1`@`localhost` +GRANT SELECT (`f1`) ON `mysqltest`.`t1` TO `user1`@`localhost` connection con2; select * from information_schema.column_privileges order by grantee; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE @@ -1165,7 +1165,7 @@ drop procedure p1; drop procedure p2; show create database information_schema; Database Create Database -information_schema CREATE DATABASE `information_schema` /*!40100 DEFAULT CHARACTER SET utf8mb3 */ +information_schema CREATE DATABASE `information_schema` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */ create table t1(f1 LONGBLOB, f2 LONGTEXT); select column_name,data_type,CHARACTER_OCTET_LENGTH, CHARACTER_MAXIMUM_LENGTH @@ -2366,8 +2366,9 @@ Warning 1931 Query execution was interrupted. The query examined at least ### ro # m_status == DA_OK_BULK' failed in Diagnostics_area::message() # call mtr.add_suppression("Sort aborted.*"); -DROP DATABASE test; -CREATE DATABASE test; +create database dummy; +use dummy; +drop database dummy; USE test; CREATE VIEW v AS SELECT table_schema AS object_schema, table_name AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema; SELECT * FROM v LIMIT ROWS EXAMINED 9; @@ -2499,5 +2500,57 @@ select * from t1 where (name, len) in (select name, len from information_schema name len drop table t1; # +# MDEV-20254 Problems with EMPTY_STRING_IS_NULL and I_S tables +# +SET SQL_MODE= 'EMPTY_STRING_IS_NULL'; +CREATE OR REPLACE TABLE t1 AS SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE 1 = 0; +SHOW returned: CREATE TABLE `t1` ( + `TABLE_NAME` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE `t1` ( + `TABLE_NAME` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `TABLE_NAME` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +SET SQL_MODE=DEFAULT; +SET SQL_MODE= 'EMPTY_STRING_IS_NULL'; +CREATE OR REPLACE TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE 1 = 0; +DROP TABLE t1; +# Executing the statement returned from SHOW CREATE TABLE +DROP TABLE t1; +SET SQL_MODE=DEFAULT; +# +# MDEV-27673 Warning after "select progress from information_schema.processlist" +# +select progress from information_schema.processlist limit 1; +progress +0.000 +# # End of 10.3 tests # +# +# Start of 10.5 tests +# +# +# MDEV-26507 Assertion `tmp != ((long long) 0x8000000000000000LL)' failed in TIME_from_longlong_datetime_packed +# +CREATE TABLE t1 (a int); +CREATE ALGORITHM=TEMPTABLE VIEW i AS +SELECT a.created +FROM t1 w JOIN INFORMATION_SCHEMA.routines a +WHERE a.routine_name='not existing' + ORDER BY a.last_altered; +SET SESSION sql_mode='ALLOW_INVALID_DATES'; +SELECT * FROM i; +created +SET SESSION sql_mode=DEFAULT; +DROP VIEW i; +DROP TABLE t1; +# +# End of 10.5 tests +# diff --git a/mysql-test/main/information_schema.test b/mysql-test/main/information_schema.test index 59f657f440364..7ef536c2a54f6 100644 --- a/mysql-test/main/information_schema.test +++ b/mysql-test/main/information_schema.test @@ -1939,8 +1939,9 @@ SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10; call mtr.add_suppression("Sort aborted.*"); -DROP DATABASE test; -CREATE DATABASE test; +create database dummy; +use dummy; +drop database dummy; USE test; CREATE VIEW v AS SELECT table_schema AS object_schema, table_name AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema; @@ -2072,6 +2073,66 @@ create table t1 ( name varchar(64) character set utf8, len int); select * from t1 where (name, len) in (select name, len from information_schema.innodb_sys_columns having len = 8); drop table t1; +--echo # +--echo # MDEV-20254 Problems with EMPTY_STRING_IS_NULL and I_S tables +--echo # + +# Test one column with detailed output + +SET SQL_MODE= 'EMPTY_STRING_IS_NULL'; +CREATE OR REPLACE TABLE t1 AS SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE 1 = 0; +--let $myvar= query_get_value(SHOW CREATE TABLE test.t1, Create Table, 1) +--echo SHOW returned: $myvar +DROP TABLE t1; +--eval $myvar +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET SQL_MODE=DEFAULT; + +# Test all columns without detailed output. +# Just make sure the SHOW CREATE TABLE result +# can be passed back to the server without errors. + +SET SQL_MODE= 'EMPTY_STRING_IS_NULL'; +CREATE OR REPLACE TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE 1 = 0; +--let $myvar= query_get_value(SHOW CREATE TABLE test.t1, Create Table, 1) +DROP TABLE t1; +--disable_query_log +--echo # Executing the statement returned from SHOW CREATE TABLE +--eval $myvar +--enable_query_log +DROP TABLE t1; +SET SQL_MODE=DEFAULT; + +--echo # +--echo # MDEV-27673 Warning after "select progress from information_schema.processlist" +--echo # +select progress from information_schema.processlist limit 1; + --echo # --echo # End of 10.3 tests --echo # + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-26507 Assertion `tmp != ((long long) 0x8000000000000000LL)' failed in TIME_from_longlong_datetime_packed +--echo # + +CREATE TABLE t1 (a int); +CREATE ALGORITHM=TEMPTABLE VIEW i AS + SELECT a.created + FROM t1 w JOIN INFORMATION_SCHEMA.routines a + WHERE a.routine_name='not existing' + ORDER BY a.last_altered; +SET SESSION sql_mode='ALLOW_INVALID_DATES'; +SELECT * FROM i; +SET SESSION sql_mode=DEFAULT; +DROP VIEW i; +DROP TABLE t1; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/main/information_schema_all_engines.test b/mysql-test/main/information_schema_all_engines.test index f8d685d25605c..f354532904a8c 100644 --- a/mysql-test/main/information_schema_all_engines.test +++ b/mysql-test/main/information_schema_all_engines.test @@ -2,6 +2,11 @@ # information_schema_db.test whose results depends on which engines are # available (since these engines inject tables into INFORMATION_SCHEMA). +--source include/no_valgrind_without_big.inc +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + --source include/not_embedded.inc --source include/have_innodb.inc --source include/have_perfschema.inc diff --git a/mysql-test/main/information_schema_columns.result b/mysql-test/main/information_schema_columns.result new file mode 100644 index 0000000000000..3624a6db36880 --- /dev/null +++ b/mysql-test/main/information_schema_columns.result @@ -0,0 +1,47 @@ +# +# Start of 10.2 tests +# +# +# MDEV-25243 ASAN heap-use-after-free in Item_func_sp::execute_impl upon concurrent view DDL and I_S query with view and function +# +CREATE FUNCTION f1() RETURNS INT RETURN 1; +CREATE VIEW v01 AS SELECT f1(); +CREATE VIEW v02 AS SELECT f1(); +connect con1,localhost,root,,; +SELECT GET_LOCK('v01',30); +GET_LOCK('v01',30) +1 +SELECT GET_LOCK('v02',30); +GET_LOCK('v02',30) +1 +connection default; +SELECT * FROM INFORMATION_SCHEMA.COLUMNS +WHERE TABLE_SCHEMA='test' + AND TABLE_NAME LIKE 'v0%' + AND GET_LOCK(TABLE_NAME,30) +AND RELEASE_LOCK(TABLE_NAME) +AND f1()=1 +ORDER BY TABLE_NAME; +connection con1; +connection con1; +SELECT RELEASE_LOCK('v01') /* Let the first row evaluate f1 */; +RELEASE_LOCK('v01') +1 +CREATE FUNCTION f2() RETURNS INT RETURN 1 /* Invalidate SP cache*/; +SELECT RELEASE_LOCK('v02') /* Let the second row evaluate f1() */; +RELEASE_LOCK('v02') +1 +DROP FUNCTION f2; +disconnect con1; +connection default; +SELECT RELEASE_LOCK('v01'); +RELEASE_LOCK('v01') +NULL +SELECT RELEASE_LOCK('v02'); +RELEASE_LOCK('v02') +NULL +DROP VIEW v01, v02; +DROP FUNCTION f1; +# +# End of 10.2 tests +# diff --git a/mysql-test/main/information_schema_columns.test b/mysql-test/main/information_schema_columns.test new file mode 100644 index 0000000000000..0171b221110be --- /dev/null +++ b/mysql-test/main/information_schema_columns.test @@ -0,0 +1,48 @@ +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-25243 ASAN heap-use-after-free in Item_func_sp::execute_impl upon concurrent view DDL and I_S query with view and function +--echo # + + +CREATE FUNCTION f1() RETURNS INT RETURN 1; +CREATE VIEW v01 AS SELECT f1(); +CREATE VIEW v02 AS SELECT f1(); + +--connect(con1,localhost,root,,) +SELECT GET_LOCK('v01',30); +SELECT GET_LOCK('v02',30); +--connection default + +--send + SELECT * FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_SCHEMA='test' + AND TABLE_NAME LIKE 'v0%' + AND GET_LOCK(TABLE_NAME,30) + AND RELEASE_LOCK(TABLE_NAME) + AND f1()=1 + ORDER BY TABLE_NAME; + +--connection con1 +--connection con1 +SELECT RELEASE_LOCK('v01') /* Let the first row evaluate f1 */; +CREATE FUNCTION f2() RETURNS INT RETURN 1 /* Invalidate SP cache*/; +SELECT RELEASE_LOCK('v02') /* Let the second row evaluate f1() */; +DROP FUNCTION f2; +--disconnect con1 + +--connection default +--disable_result_log +--reap +--enable_result_log +SELECT RELEASE_LOCK('v01'); +SELECT RELEASE_LOCK('v02'); + +DROP VIEW v01, v02; +DROP FUNCTION f1; + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/main/information_schema_db.result b/mysql-test/main/information_schema_db.result index b8a18179e75c0..6a6e5c498515d 100644 --- a/mysql-test/main/information_schema_db.result +++ b/mysql-test/main/information_schema_db.result @@ -163,17 +163,17 @@ use testdb_1; revoke select,show view on v6 from testdb_2@localhost; connection testdb_2; show fields from testdb_1.v5; -ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v5' +ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table `testdb_1`.`v5` show create view testdb_1.v5; -ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v5' +ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table `testdb_1`.`v5` show fields from testdb_1.v6; -ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v6' +ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table `testdb_1`.`v6` show create view testdb_1.v6; -ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v6' +ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table `testdb_1`.`v6` show fields from testdb_1.v7; -ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v7' +ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table `testdb_1`.`v7` show create view testdb_1.v7; -ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v7' +ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table `testdb_1`.`v7` show create view v4; View Create View character_set_client collation_connection v4 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `v3`.`f1` AS `f1`,`v3`.`f2` AS `f2` from `testdb_1`.`v3` latin1 latin1_swedish_ci @@ -191,7 +191,7 @@ show create view v2; View Create View character_set_client collation_connection v2 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1` latin1 latin1_swedish_ci show create view testdb_1.v1; -ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table `testdb_1`.`v1` select table_name from information_schema.columns a where a.table_name = 'v2'; table_name @@ -238,7 +238,7 @@ where table_name='v1'; table_schema table_name view_definition testdb_1 v1 show create view testdb_1.v1; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `testdb_1`.`v1` connection default; drop user mysqltest_1@localhost; drop database testdb_1; diff --git a/mysql-test/main/information_schema_db.test b/mysql-test/main/information_schema_db.test index 1dd0f84bc09aa..e60557a9526c1 100644 --- a/mysql-test/main/information_schema_db.test +++ b/mysql-test/main/information_schema_db.test @@ -31,6 +31,7 @@ show tables; # database-level privileges (e.g. had only table-level or had no # privileges at all). # +--disable_view_protocol grant all privileges on `inf%`.* to 'mysqltest_1'@'localhost'; grant all privileges on `mbase`.* to 'mysqltest_1'@'localhost'; create table t1 (f1 int); @@ -106,12 +107,14 @@ where table_schema='test' order by table_name; drop function f1; drop function f2; drop view v1, v2; +--enable_view_protocol # # Bug#20543 select on information_schema strange warnings, view, different # schemas/users # # +--disable_service_connection create database testdb_1; create user testdb_1@localhost; grant all on testdb_1.* to testdb_1@localhost with grant option; @@ -298,3 +301,4 @@ disconnect foo; drop view v1d, v1i, v2d, v2i, v3d, v3i, v4d, v4i, v5d, v5i; drop user foo@localhost; drop procedure rootonly; +--enable_service_connection diff --git a/mysql-test/main/information_schema_inno.result b/mysql-test/main/information_schema_inno.result index d952e4372ca30..c81631728f03a 100644 --- a/mysql-test/main/information_schema_inno.result +++ b/mysql-test/main/information_schema_inno.result @@ -1,4 +1,3 @@ -DROP TABLE IF EXISTS t1,t2,t3; CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id, id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE, diff --git a/mysql-test/main/information_schema_inno.test b/mysql-test/main/information_schema_inno.test index 3cdbb8111d945..6c50ff3ece03a 100644 --- a/mysql-test/main/information_schema_inno.test +++ b/mysql-test/main/information_schema_inno.test @@ -1,8 +1,6 @@ -- source include/testdb_only.inc -- source include/have_innodb.inc ---disable_warnings -DROP TABLE IF EXISTS t1,t2,t3; ---enable_warnings +-- source include/have_symlink.inc # # Test for KEY_COLUMN_USAGE & TABLE_CONSTRAINTS tables diff --git a/mysql-test/main/information_schema_parameters.result b/mysql-test/main/information_schema_parameters.result index fd2be07326cfd..7c73c312bd7df 100644 --- a/mysql-test/main/information_schema_parameters.result +++ b/mysql-test/main/information_schema_parameters.result @@ -3,23 +3,23 @@ USE INFORMATION_SCHEMA; SHOW CREATE TABLE INFORMATION_SCHEMA.PARAMETERS; Table Create Table PARAMETERS CREATE TEMPORARY TABLE `PARAMETERS` ( - `SPECIFIC_CATALOG` varchar(512) NOT NULL DEFAULT '', - `SPECIFIC_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `SPECIFIC_NAME` varchar(64) NOT NULL DEFAULT '', - `ORDINAL_POSITION` int(21) NOT NULL DEFAULT 0, - `PARAMETER_MODE` varchar(5) DEFAULT NULL, - `PARAMETER_NAME` varchar(64) DEFAULT NULL, - `DATA_TYPE` varchar(64) NOT NULL DEFAULT '', - `CHARACTER_MAXIMUM_LENGTH` int(21) DEFAULT NULL, - `CHARACTER_OCTET_LENGTH` int(21) DEFAULT NULL, - `NUMERIC_PRECISION` int(21) DEFAULT NULL, - `NUMERIC_SCALE` int(21) DEFAULT NULL, - `DATETIME_PRECISION` bigint(21) unsigned DEFAULT NULL, - `CHARACTER_SET_NAME` varchar(64) DEFAULT NULL, - `COLLATION_NAME` varchar(64) DEFAULT NULL, - `DTD_IDENTIFIER` longtext NOT NULL DEFAULT '', - `ROUTINE_TYPE` varchar(9) NOT NULL DEFAULT '' -) DEFAULT CHARSET=utf8mb3 + `SPECIFIC_CATALOG` varchar(512) NOT NULL, + `SPECIFIC_SCHEMA` varchar(64) NOT NULL, + `SPECIFIC_NAME` varchar(64) NOT NULL, + `ORDINAL_POSITION` int(21) NOT NULL, + `PARAMETER_MODE` varchar(5), + `PARAMETER_NAME` varchar(64), + `DATA_TYPE` varchar(64) NOT NULL, + `CHARACTER_MAXIMUM_LENGTH` int(21), + `CHARACTER_OCTET_LENGTH` int(21), + `NUMERIC_PRECISION` int(21), + `NUMERIC_SCALE` int(21), + `DATETIME_PRECISION` bigint(21) unsigned, + `CHARACTER_SET_NAME` varchar(64), + `COLLATION_NAME` varchar(64), + `DTD_IDENTIFIER` longtext NOT NULL, + `ROUTINE_TYPE` varchar(9) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT * FROM information_schema.columns WHERE table_schema = 'information_schema' AND table_name = 'parameters' @@ -29,7 +29,7 @@ TABLE_SCHEMA information_schema TABLE_NAME PARAMETERS COLUMN_NAME SPECIFIC_CATALOG ORDINAL_POSITION 1 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 512 @@ -51,7 +51,7 @@ TABLE_SCHEMA information_schema TABLE_NAME PARAMETERS COLUMN_NAME SPECIFIC_SCHEMA ORDINAL_POSITION 2 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 64 @@ -73,7 +73,7 @@ TABLE_SCHEMA information_schema TABLE_NAME PARAMETERS COLUMN_NAME SPECIFIC_NAME ORDINAL_POSITION 3 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 64 @@ -95,7 +95,7 @@ TABLE_SCHEMA information_schema TABLE_NAME PARAMETERS COLUMN_NAME ORDINAL_POSITION ORDINAL_POSITION 4 -COLUMN_DEFAULT 0 +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE int CHARACTER_MAXIMUM_LENGTH NULL @@ -161,7 +161,7 @@ TABLE_SCHEMA information_schema TABLE_NAME PARAMETERS COLUMN_NAME DATA_TYPE ORDINAL_POSITION 7 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 64 @@ -337,7 +337,7 @@ TABLE_SCHEMA information_schema TABLE_NAME PARAMETERS COLUMN_NAME DTD_IDENTIFIER ORDINAL_POSITION 15 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE longtext CHARACTER_MAXIMUM_LENGTH 4294967295 @@ -359,7 +359,7 @@ TABLE_SCHEMA information_schema TABLE_NAME PARAMETERS COLUMN_NAME ROUTINE_TYPE ORDINAL_POSITION 16 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 9 @@ -378,13 +378,13 @@ IS_GENERATED NEVER GENERATION_EXPRESSION NULL DESCRIBE INFORMATION_SCHEMA.PARAMETERS; Field Type Null Key Default Extra -SPECIFIC_CATALOG varchar(512) NO -SPECIFIC_SCHEMA varchar(64) NO -SPECIFIC_NAME varchar(64) NO -ORDINAL_POSITION int(21) NO 0 +SPECIFIC_CATALOG varchar(512) NO NULL +SPECIFIC_SCHEMA varchar(64) NO NULL +SPECIFIC_NAME varchar(64) NO NULL +ORDINAL_POSITION int(21) NO NULL PARAMETER_MODE varchar(5) YES NULL PARAMETER_NAME varchar(64) YES NULL -DATA_TYPE varchar(64) NO +DATA_TYPE varchar(64) NO NULL CHARACTER_MAXIMUM_LENGTH int(21) YES NULL CHARACTER_OCTET_LENGTH int(21) YES NULL NUMERIC_PRECISION int(21) YES NULL @@ -392,8 +392,8 @@ NUMERIC_SCALE int(21) YES NULL DATETIME_PRECISION bigint(21) unsigned YES NULL CHARACTER_SET_NAME varchar(64) YES NULL COLLATION_NAME varchar(64) YES NULL -DTD_IDENTIFIER longtext NO -ROUTINE_TYPE varchar(9) NO +DTD_IDENTIFIER longtext NO NULL +ROUTINE_TYPE varchar(9) NO NULL # ========== parameters.2 ========== DROP DATABASE IF EXISTS i_s_parameters_test; CREATE DATABASE i_s_parameters_test; diff --git a/mysql-test/main/information_schema_part.result b/mysql-test/main/information_schema_part.result index 374c679789eee..1c5b9333550ef 100644 --- a/mysql-test/main/information_schema_part.result +++ b/mysql-test/main/information_schema_part.result @@ -119,7 +119,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY LINEAR HASH (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM) @@ -137,7 +137,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53) ENGINE = MyISAM) SELECT PARTITION_DESCRIPTION FROM information_schema.partitions WHERE diff --git a/mysql-test/main/information_schema_part.test b/mysql-test/main/information_schema_part.test index 62fba4f53d806..3741de611505a 100644 --- a/mysql-test/main/information_schema_part.test +++ b/mysql-test/main/information_schema_part.test @@ -129,7 +129,9 @@ drop table t1; drop table if exists t1; --enable_warnings create table t1 (f1 int key) partition by key(f1) partitions 2; +--disable_view_protocol select create_options from information_schema.tables where table_schema="test"; +--enable_view_protocol drop table t1; --echo # diff --git a/mysql-test/main/information_schema_routines.result b/mysql-test/main/information_schema_routines.result index 9f1f1f16bcfc8..907687658838b 100644 --- a/mysql-test/main/information_schema_routines.result +++ b/mysql-test/main/information_schema_routines.result @@ -5,38 +5,38 @@ USE INFORMATION_SCHEMA; SHOW CREATE TABLE INFORMATION_SCHEMA.ROUTINES; Table Create Table ROUTINES CREATE TEMPORARY TABLE `ROUTINES` ( - `SPECIFIC_NAME` varchar(64) NOT NULL DEFAULT '', - `ROUTINE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `ROUTINE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `ROUTINE_NAME` varchar(64) NOT NULL DEFAULT '', - `ROUTINE_TYPE` varchar(13) NOT NULL DEFAULT '', - `DATA_TYPE` varchar(64) NOT NULL DEFAULT '', - `CHARACTER_MAXIMUM_LENGTH` int(21) DEFAULT NULL, - `CHARACTER_OCTET_LENGTH` int(21) DEFAULT NULL, - `NUMERIC_PRECISION` int(21) DEFAULT NULL, - `NUMERIC_SCALE` int(21) DEFAULT NULL, - `DATETIME_PRECISION` bigint(21) unsigned DEFAULT NULL, - `CHARACTER_SET_NAME` varchar(64) DEFAULT NULL, - `COLLATION_NAME` varchar(64) DEFAULT NULL, - `DTD_IDENTIFIER` longtext DEFAULT NULL, - `ROUTINE_BODY` varchar(8) NOT NULL DEFAULT '', - `ROUTINE_DEFINITION` longtext DEFAULT NULL, - `EXTERNAL_NAME` varchar(64) DEFAULT NULL, - `EXTERNAL_LANGUAGE` varchar(64) DEFAULT NULL, - `PARAMETER_STYLE` varchar(8) NOT NULL DEFAULT '', - `IS_DETERMINISTIC` varchar(3) NOT NULL DEFAULT '', - `SQL_DATA_ACCESS` varchar(64) NOT NULL DEFAULT '', - `SQL_PATH` varchar(64) DEFAULT NULL, - `SECURITY_TYPE` varchar(7) NOT NULL DEFAULT '', - `CREATED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `LAST_ALTERED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `SQL_MODE` varchar(8192) NOT NULL DEFAULT '', - `ROUTINE_COMMENT` longtext NOT NULL DEFAULT '', - `DEFINER` varchar(384) NOT NULL DEFAULT '', - `CHARACTER_SET_CLIENT` varchar(32) NOT NULL DEFAULT '', - `COLLATION_CONNECTION` varchar(32) NOT NULL DEFAULT '', - `DATABASE_COLLATION` varchar(32) NOT NULL DEFAULT '' -) DEFAULT CHARSET=utf8mb3 + `SPECIFIC_NAME` varchar(64) NOT NULL, + `ROUTINE_CATALOG` varchar(512) NOT NULL, + `ROUTINE_SCHEMA` varchar(64) NOT NULL, + `ROUTINE_NAME` varchar(64) NOT NULL, + `ROUTINE_TYPE` varchar(13) NOT NULL, + `DATA_TYPE` varchar(64) NOT NULL, + `CHARACTER_MAXIMUM_LENGTH` int(21), + `CHARACTER_OCTET_LENGTH` int(21), + `NUMERIC_PRECISION` int(21), + `NUMERIC_SCALE` int(21), + `DATETIME_PRECISION` bigint(21) unsigned, + `CHARACTER_SET_NAME` varchar(64), + `COLLATION_NAME` varchar(64), + `DTD_IDENTIFIER` longtext, + `ROUTINE_BODY` varchar(8) NOT NULL, + `ROUTINE_DEFINITION` longtext, + `EXTERNAL_NAME` varchar(64), + `EXTERNAL_LANGUAGE` varchar(64), + `PARAMETER_STYLE` varchar(8) NOT NULL, + `IS_DETERMINISTIC` varchar(3) NOT NULL, + `SQL_DATA_ACCESS` varchar(64) NOT NULL, + `SQL_PATH` varchar(64), + `SECURITY_TYPE` varchar(7) NOT NULL, + `CREATED` datetime NOT NULL, + `LAST_ALTERED` datetime NOT NULL, + `SQL_MODE` varchar(8192) NOT NULL, + `ROUTINE_COMMENT` longtext NOT NULL, + `DEFINER` varchar(384) NOT NULL, + `CHARACTER_SET_CLIENT` varchar(32) NOT NULL, + `COLLATION_CONNECTION` varchar(32) NOT NULL, + `DATABASE_COLLATION` varchar(32) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT * FROM information_schema.columns WHERE table_schema = 'information_schema' AND table_name = 'routines' @@ -46,7 +46,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME SPECIFIC_NAME ORDINAL_POSITION 1 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 64 @@ -68,7 +68,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_CATALOG ORDINAL_POSITION 2 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 512 @@ -90,7 +90,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_SCHEMA ORDINAL_POSITION 3 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 64 @@ -112,7 +112,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_NAME ORDINAL_POSITION 4 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 64 @@ -134,7 +134,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_TYPE ORDINAL_POSITION 5 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 13 @@ -156,7 +156,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME DATA_TYPE ORDINAL_POSITION 6 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 64 @@ -354,7 +354,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_BODY ORDINAL_POSITION 15 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 8 @@ -442,7 +442,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME PARAMETER_STYLE ORDINAL_POSITION 19 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 8 @@ -464,7 +464,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME IS_DETERMINISTIC ORDINAL_POSITION 20 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 3 @@ -486,7 +486,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME SQL_DATA_ACCESS ORDINAL_POSITION 21 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 64 @@ -530,7 +530,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME SECURITY_TYPE ORDINAL_POSITION 23 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 7 @@ -552,7 +552,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME CREATED ORDINAL_POSITION 24 -COLUMN_DEFAULT '0000-00-00 00:00:00' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE datetime CHARACTER_MAXIMUM_LENGTH NULL @@ -574,7 +574,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME LAST_ALTERED ORDINAL_POSITION 25 -COLUMN_DEFAULT '0000-00-00 00:00:00' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE datetime CHARACTER_MAXIMUM_LENGTH NULL @@ -596,7 +596,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME SQL_MODE ORDINAL_POSITION 26 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 8192 @@ -618,7 +618,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_COMMENT ORDINAL_POSITION 27 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE longtext CHARACTER_MAXIMUM_LENGTH 4294967295 @@ -640,7 +640,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME DEFINER ORDINAL_POSITION 28 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 384 @@ -662,7 +662,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME CHARACTER_SET_CLIENT ORDINAL_POSITION 29 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 32 @@ -684,7 +684,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME COLLATION_CONNECTION ORDINAL_POSITION 30 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 32 @@ -706,7 +706,7 @@ TABLE_SCHEMA information_schema TABLE_NAME ROUTINES COLUMN_NAME DATABASE_COLLATION ORDINAL_POSITION 31 -COLUMN_DEFAULT '' +COLUMN_DEFAULT NULL IS_NULLABLE NO DATA_TYPE varchar CHARACTER_MAXIMUM_LENGTH 32 @@ -725,12 +725,12 @@ IS_GENERATED NEVER GENERATION_EXPRESSION NULL DESCRIBE INFORMATION_SCHEMA.ROUTINES; Field Type Null Key Default Extra -SPECIFIC_NAME varchar(64) NO -ROUTINE_CATALOG varchar(512) NO -ROUTINE_SCHEMA varchar(64) NO -ROUTINE_NAME varchar(64) NO -ROUTINE_TYPE varchar(13) NO -DATA_TYPE varchar(64) NO +SPECIFIC_NAME varchar(64) NO NULL +ROUTINE_CATALOG varchar(512) NO NULL +ROUTINE_SCHEMA varchar(64) NO NULL +ROUTINE_NAME varchar(64) NO NULL +ROUTINE_TYPE varchar(13) NO NULL +DATA_TYPE varchar(64) NO NULL CHARACTER_MAXIMUM_LENGTH int(21) YES NULL CHARACTER_OCTET_LENGTH int(21) YES NULL NUMERIC_PRECISION int(21) YES NULL @@ -739,23 +739,23 @@ DATETIME_PRECISION bigint(21) unsigned YES NULL CHARACTER_SET_NAME varchar(64) YES NULL COLLATION_NAME varchar(64) YES NULL DTD_IDENTIFIER longtext YES NULL -ROUTINE_BODY varchar(8) NO +ROUTINE_BODY varchar(8) NO NULL ROUTINE_DEFINITION longtext YES NULL EXTERNAL_NAME varchar(64) YES NULL EXTERNAL_LANGUAGE varchar(64) YES NULL -PARAMETER_STYLE varchar(8) NO -IS_DETERMINISTIC varchar(3) NO -SQL_DATA_ACCESS varchar(64) NO +PARAMETER_STYLE varchar(8) NO NULL +IS_DETERMINISTIC varchar(3) NO NULL +SQL_DATA_ACCESS varchar(64) NO NULL SQL_PATH varchar(64) YES NULL -SECURITY_TYPE varchar(7) NO -CREATED datetime NO 0000-00-00 00:00:00 -LAST_ALTERED datetime NO 0000-00-00 00:00:00 -SQL_MODE varchar(8192) NO -ROUTINE_COMMENT longtext NO -DEFINER varchar(384) NO -CHARACTER_SET_CLIENT varchar(32) NO -COLLATION_CONNECTION varchar(32) NO -DATABASE_COLLATION varchar(32) NO +SECURITY_TYPE varchar(7) NO NULL +CREATED datetime NO NULL +LAST_ALTERED datetime NO NULL +SQL_MODE varchar(8192) NO NULL +ROUTINE_COMMENT longtext NO NULL +DEFINER varchar(384) NO NULL +CHARACTER_SET_CLIENT varchar(32) NO NULL +COLLATION_CONNECTION varchar(32) NO NULL +DATABASE_COLLATION varchar(32) NO NULL # ========== routines.2 ========== DROP DATABASE IF EXISTS i_s_routines_test; CREATE DATABASE i_s_routines_test; diff --git a/mysql-test/main/information_schema_tables.result b/mysql-test/main/information_schema_tables.result new file mode 100644 index 0000000000000..a3dd068831ccb --- /dev/null +++ b/mysql-test/main/information_schema_tables.result @@ -0,0 +1,77 @@ +# +# Start of 10.2 tests +# +# +# MDEV-25243 ASAN heap-use-after-free in Item_func_sp::execute_impl upon concurrent view DDL and I_S query with view and function +# +# The originally reported non-deterministic test. +# It did not fail reliably on every run. +CREATE TABLE t (a INT); +INSERT INTO t VALUES (1),(2); +CREATE FUNCTION f(b INT) RETURNS INT RETURN 1; +CREATE VIEW v AS SELECT f(SUM(a)) FROM t; +connect con1,localhost,root,,test; +LOOP +CREATE OR REPLACE VIEW vv AS SELECT 1; +END LOOP $ +connection default; +SELECT v.* FROM v JOIN INFORMATION_SCHEMA.TABLES WHERE DATA_LENGTH = -1; +f(SUM(a)) +KILL CONID; +disconnect con1; +connection default; +DROP VIEW IF EXISTS vv; +DROP VIEW v; +DROP FUNCTION f; +DROP TABLE t; +# The second test version from the MDEV. +# It failed more reliably, but still was not deterministic. +CREATE FUNCTION f() RETURNS INT RETURN 1; +CREATE VIEW v AS SELECT f() FROM seq_1_to_10; +SELECT * FROM INFORMATION_SCHEMA.TABLES, v;; +connect con1,localhost,root,,; +CREATE VIEW v2 AS SELECT 1; +connection default; +disconnect con1; +DROP VIEW v; +DROP VIEW v2; +DROP FUNCTION f; +# The third test version from the MDEV. +# It failed reliably, and should be deterninistic. +CREATE FUNCTION f1() RETURNS INT RETURN 1; +CREATE VIEW v01 AS SELECT f1(); +CREATE VIEW v02 AS SELECT f1(); +connect con1,localhost,root,,; +SELECT GET_LOCK('v01',30); +GET_LOCK('v01',30) +1 +SELECT GET_LOCK('v02',30); +GET_LOCK('v02',30) +1 +connection default; +SELECT * FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA='test' + AND TABLE_NAME LIKE 'v0%' + AND GET_LOCK(TABLE_NAME,30) +AND RELEASE_LOCK(TABLE_NAME) +AND f1()=1 +ORDER BY TABLE_NAME; +connection con1; +SELECT RELEASE_LOCK('v01') /* Let the first row evaluate f1 */; +RELEASE_LOCK('v01') +1 +CREATE FUNCTION f2() RETURNS INT RETURN 1 /* Invalidate SP cache*/; +SELECT RELEASE_LOCK('v02') /* Let the second row evaluate f1() */; +RELEASE_LOCK('v02') +1 +DROP FUNCTION f2; +disconnect con1; +connection default; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY +def test v01 VIEW NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW NULL NULL +def test v02 VIEW NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW NULL NULL +DROP VIEW v01, v02; +DROP FUNCTION f1; +# +# End of 10.2 tests +# diff --git a/mysql-test/main/information_schema_tables.test b/mysql-test/main/information_schema_tables.test new file mode 100644 index 0000000000000..ee277276b52a7 --- /dev/null +++ b/mysql-test/main/information_schema_tables.test @@ -0,0 +1,102 @@ +--source include/have_sequence.inc + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-25243 ASAN heap-use-after-free in Item_func_sp::execute_impl upon concurrent view DDL and I_S query with view and function +--echo # + +--echo # The originally reported non-deterministic test. +--echo # It did not fail reliably on every run. + +CREATE TABLE t (a INT); +INSERT INTO t VALUES (1),(2); +CREATE FUNCTION f(b INT) RETURNS INT RETURN 1; +CREATE VIEW v AS SELECT f(SUM(a)) FROM t; +--connect (con1,localhost,root,,test) +--let $conid= `SELECT CONNECTION_ID()` +--delimiter $ +--send +LOOP + CREATE OR REPLACE VIEW vv AS SELECT 1; +END LOOP $ +--delimiter ; +--connection default +# Avoid "Prepared statement needs to be re-prepared" +# Note, the code could probably eventually fixed to avoid forcing re-pepare if +# the *temporary* instance of Sp_caches (not the permanent one) was invalidated. +--disable_ps_protocol +--disable_warnings +SELECT v.* FROM v JOIN INFORMATION_SCHEMA.TABLES WHERE DATA_LENGTH = -1; +--enable_warnings +--enable_ps_protocol +# Cleanup +--replace_result $conid CONID +--eval KILL $conid +--disconnect con1 +--connection default +--disable_warnings +DROP VIEW IF EXISTS vv; +--enable_warnings +DROP VIEW v; +DROP FUNCTION f; +DROP TABLE t; + + +--echo # The second test version from the MDEV. +--echo # It failed more reliably, but still was not deterministic. + + +CREATE FUNCTION f() RETURNS INT RETURN 1; +CREATE VIEW v AS SELECT f() FROM seq_1_to_10; +--send SELECT * FROM INFORMATION_SCHEMA.TABLES, v; +--connect(con1,localhost,root,,) +CREATE VIEW v2 AS SELECT 1; +--connection default +--disable_result_log +--reap +--enable_result_log +--disconnect con1 +DROP VIEW v; +DROP VIEW v2; +DROP FUNCTION f; + +--echo # The third test version from the MDEV. +--echo # It failed reliably, and should be deterninistic. + +CREATE FUNCTION f1() RETURNS INT RETURN 1; +CREATE VIEW v01 AS SELECT f1(); +CREATE VIEW v02 AS SELECT f1(); + +--connect(con1,localhost,root,,) +SELECT GET_LOCK('v01',30); +SELECT GET_LOCK('v02',30); +--connection default + +--send + SELECT * FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA='test' + AND TABLE_NAME LIKE 'v0%' + AND GET_LOCK(TABLE_NAME,30) + AND RELEASE_LOCK(TABLE_NAME) + AND f1()=1 + ORDER BY TABLE_NAME; + +--connection con1 +SELECT RELEASE_LOCK('v01') /* Let the first row evaluate f1 */; +CREATE FUNCTION f2() RETURNS INT RETURN 1 /* Invalidate SP cache*/; +SELECT RELEASE_LOCK('v02') /* Let the second row evaluate f1() */; +DROP FUNCTION f2; +--disconnect con1 +--connection default +--reap + + +DROP VIEW v01, v02; +DROP FUNCTION f1; + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/main/init_file_longline_3816.result b/mysql-test/main/init_file_longline_3816.result index f670f67ccb8e5..0155f764592b0 100644 --- a/mysql-test/main/init_file_longline_3816.result +++ b/mysql-test/main/init_file_longline_3816.result @@ -1,3 +1,3 @@ select count(*) from t4; count(*) -193 +0 diff --git a/mysql-test/main/init_file_set_password-7656.test b/mysql-test/main/init_file_set_password-7656.test index 5e7a24fcf7fec..7bca34a0fcfb2 100644 --- a/mysql-test/main/init_file_set_password-7656.test +++ b/mysql-test/main/init_file_set_password-7656.test @@ -2,6 +2,8 @@ # MDEV-7656 init_file option does not allow changing passwords # --source include/not_embedded.inc +#enable view protocol after fix MDEV-29542 +--source include/no_view_protocol.inc create user foo@localhost; diff --git a/mysql-test/main/innodb_ext_key.test b/mysql-test/main/innodb_ext_key.test index f1cf6658f0b09..41a5523200142 100644 --- a/mysql-test/main/innodb_ext_key.test +++ b/mysql-test/main/innodb_ext_key.test @@ -1,4 +1,9 @@ +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + --source include/innodb_prefix_index_cluster_optimization.inc +--source include/no_valgrind_without_big.inc SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB'; diff --git a/mysql-test/main/innodb_mrr_cpk.result b/mysql-test/main/innodb_mrr_cpk.result index 8b9260f45968a..912bc263aa25a 100644 --- a/mysql-test/main/innodb_mrr_cpk.result +++ b/mysql-test/main/innodb_mrr_cpk.result @@ -15,7 +15,7 @@ t1 CREATE TABLE `t1` ( `b` char(8) DEFAULT NULL, `filler` char(100) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 select concat('a-', 1000 + A.a + B.a*10 + C.a*100, '=A'), concat('b-', 1000 + A.a + B.a*10 + C.a*100, '=B'), diff --git a/mysql-test/main/innodb_mysql_sync.result b/mysql-test/main/innodb_mysql_sync.result index 46ed7d438307f..7fe3bdbba18de 100644 --- a/mysql-test/main/innodb_mysql_sync.result +++ b/mysql-test/main/innodb_mysql_sync.result @@ -131,6 +131,7 @@ connection default; DROP DATABASE db1; # Test 2: Primary index (implicit), should block writes. CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb; +INSERT INTO t1 VALUES(1, 2); SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query"; # Sending: ALTER TABLE t1 ADD UNIQUE INDEX(a), LOCK=SHARED; @@ -139,15 +140,16 @@ SET DEBUG_SYNC= "now WAIT_FOR manage"; USE test; SELECT * FROM t1; a b +1 2 # Sending: -UPDATE t1 SET a=NULL; +UPDATE t1 SET a=3; connection con2; # Waiting for SELECT to be blocked by the metadata lock on t1 SET DEBUG_SYNC= "now SIGNAL query"; connection default; # Reaping: ALTER TABLE t1 ADD UNIQUE INDEX(a) connection con1; -# Reaping: UPDATE t1 SET a=NULL +# Reaping: UPDATE t1 SET a=3 # Test 3: Primary index (explicit), should block writes. connection default; ALTER TABLE t1 DROP INDEX a; @@ -158,15 +160,16 @@ connection con1; SET DEBUG_SYNC= "now WAIT_FOR manage"; SELECT * FROM t1; a b +3 2 # Sending: -UPDATE t1 SET a=NULL; +UPDATE t1 SET a=4; connection con2; # Waiting for SELECT to be blocked by the metadata lock on t1 SET DEBUG_SYNC= "now SIGNAL query"; connection default; # Reaping: ALTER TABLE t1 ADD PRIMARY KEY (a) connection con1; -# Reaping: UPDATE t1 SET a=NULL +# Reaping: UPDATE t1 SET a=4 # Test 4: Secondary unique index, should not block reads. connection default; SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query"; @@ -176,6 +179,7 @@ connection con1; SET DEBUG_SYNC= "now WAIT_FOR manage"; SELECT * FROM t1; a b +4 2 SET DEBUG_SYNC= "now SIGNAL query"; connection default; # Reaping: ALTER TABLE t1 ADD UNIQUE (b) diff --git a/mysql-test/main/innodb_mysql_sync.test b/mysql-test/main/innodb_mysql_sync.test index 4026080c4b415..466bcb360c58d 100644 --- a/mysql-test/main/innodb_mysql_sync.test +++ b/mysql-test/main/innodb_mysql_sync.test @@ -176,6 +176,7 @@ DROP DATABASE db1; --echo # Test 2: Primary index (implicit), should block writes. CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb; +INSERT INTO t1 VALUES(1, 2); SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query"; --echo # Sending: --send ALTER TABLE t1 ADD UNIQUE INDEX(a), LOCK=SHARED @@ -185,13 +186,13 @@ SET DEBUG_SYNC= "now WAIT_FOR manage"; USE test; SELECT * FROM t1; --echo # Sending: ---send UPDATE t1 SET a=NULL +--send UPDATE t1 SET a=3 connection con2; --echo # Waiting for SELECT to be blocked by the metadata lock on t1 let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist WHERE state= 'Waiting for table metadata lock' - AND info='UPDATE t1 SET a=NULL'; + AND info='UPDATE t1 SET a=3'; --source include/wait_condition.inc SET DEBUG_SYNC= "now SIGNAL query"; @@ -200,7 +201,7 @@ connection default; --reap connection con1; ---echo # Reaping: UPDATE t1 SET a=NULL +--echo # Reaping: UPDATE t1 SET a=3 --reap --echo # Test 3: Primary index (explicit), should block writes. @@ -215,13 +216,13 @@ connection con1; SET DEBUG_SYNC= "now WAIT_FOR manage"; SELECT * FROM t1; --echo # Sending: ---send UPDATE t1 SET a=NULL +--send UPDATE t1 SET a=4 connection con2; --echo # Waiting for SELECT to be blocked by the metadata lock on t1 let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist WHERE state= 'Waiting for table metadata lock' - AND info='UPDATE t1 SET a=NULL'; + AND info='UPDATE t1 SET a=4'; --source include/wait_condition.inc SET DEBUG_SYNC= "now SIGNAL query"; @@ -230,7 +231,7 @@ connection default; --reap connection con1; ---echo # Reaping: UPDATE t1 SET a=NULL +--echo # Reaping: UPDATE t1 SET a=4 --reap --echo # Test 4: Secondary unique index, should not block reads. diff --git a/mysql-test/main/insert.result b/mysql-test/main/insert.result index d8f40b7383a46..586dbbff1533c 100644 --- a/mysql-test/main/insert.result +++ b/mysql-test/main/insert.result @@ -726,7 +726,7 @@ SET sql_mode= 'STRICT_ALL_TABLES'; CREATE TABLE t1 (f1 INT DEFAULT 0, f2 INT); CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION; REPLACE INTO v1 SET f2 = 1; -ERROR 22007: Truncated incorrect DOUBLE value: 'x' +ERROR 22007: Truncated incorrect DECIMAL value: 'x' SELECT * from t1; f1 f2 drop view v1; @@ -739,18 +739,56 @@ drop view v1; SELECT 0,0 INTO OUTFILE 't1.txt'; CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION; LOAD DATA INFILE 't1.txt' INTO TABLE v1; -ERROR 22007: Truncated incorrect DOUBLE value: 'x' +ERROR 22007: Truncated incorrect DECIMAL value: 'x' SELECT * from t1; f1 f2 drop view v1; drop table t1; SET @@sql_mode= @save_mode; +# +# MDEV-13861 Assertion `0' failed in Protocol::end_statement +# CREATE TABLE t1 (f INT); CREATE VIEW v1 AS SELECT * FROM t1 WHERE f <=> 'foo' WITH CHECK OPTION; REPLACE INTO v1 SET f = NULL; -ERROR 22007: Truncated incorrect DOUBLE value: 'foo' +ERROR 22007: Truncated incorrect DECIMAL value: 'foo' DROP VIEW v1; DROP TABLE t1; +# +# End of 10.0 tests +# +# +# MDEV-26412: INSERT CREATE with subquery in ON expression +# +create table t1 (a int); +create table t2 (b int); +create table t3 (c int); +create table t4 (d1 int, d2 int); +insert into t4 +select * from t1 left join t2 on (select t1.i from t3); +ERROR 42S22: Unknown column 't1.i' in 'field list' +replace t4 +select * from t1 left join t2 on (select t1.i from t3); +ERROR 42S22: Unknown column 't1.i' in 'field list' +drop table t1,t2,t3,t4; +create table t (a int); +select 1 in (select count(*) from t t1 join (t t2 join t t3 on (t1.a != 0))); +ERROR 42S22: Unknown column 't1.a' in 'on clause' +drop table t; +# +# MDEV-28578 Server crashes in Item_field::fix_outer_field after CREATE SELECT +# +create table t1 (i int) ; +create table t2 (j int) ; +create table t4 select * from t1 join t2 on (select t3.i); +ERROR 42S22: Unknown column 't3.i' in 'field list' +drop table t1, t2; +# +# End of 10.4 tests +# +# +# outer references in subqueries in INSERT +# create table t1 (a int default 5); insert t1 values (1); insert t1 values (a); @@ -767,3 +805,6 @@ a 7 8 drop table t1; +# +# End of 10.5 tests +# diff --git a/mysql-test/main/insert.test b/mysql-test/main/insert.test index 4ccaa20ece89a..e5cb2bac6f8a3 100644 --- a/mysql-test/main/insert.test +++ b/mysql-test/main/insert.test @@ -603,9 +603,9 @@ drop view v1; drop table t1; SET @@sql_mode= @save_mode; -# -# MDEV-13861 Assertion `0' failed in Protocol::end_statement -# +--echo # +--echo # MDEV-13861 Assertion `0' failed in Protocol::end_statement +--echo # CREATE TABLE t1 (f INT); CREATE VIEW v1 AS SELECT * FROM t1 WHERE f <=> 'foo' WITH CHECK OPTION; --error ER_TRUNCATED_WRONG_VALUE @@ -613,9 +613,49 @@ REPLACE INTO v1 SET f = NULL; DROP VIEW v1; DROP TABLE t1; -# -# outer referencesin subqueries in INSERT -# +--echo # +--echo # End of 10.0 tests +--echo # + +--echo # +--echo # MDEV-26412: INSERT CREATE with subquery in ON expression +--echo # + +create table t1 (a int); +create table t2 (b int); +create table t3 (c int); +create table t4 (d1 int, d2 int); + +--error ER_BAD_FIELD_ERROR +insert into t4 + select * from t1 left join t2 on (select t1.i from t3); +--error ER_BAD_FIELD_ERROR +replace t4 + select * from t1 left join t2 on (select t1.i from t3); + +drop table t1,t2,t3,t4; + +create table t (a int); +--error ER_BAD_FIELD_ERROR +select 1 in (select count(*) from t t1 join (t t2 join t t3 on (t1.a != 0))); +drop table t; + +--echo # +--echo # MDEV-28578 Server crashes in Item_field::fix_outer_field after CREATE SELECT +--echo # +create table t1 (i int) ; +create table t2 (j int) ; +--error ER_BAD_FIELD_ERROR +create table t4 select * from t1 join t2 on (select t3.i); +drop table t1, t2; + +--echo # +--echo # End of 10.4 tests +--echo # + +--echo # +--echo # outer references in subqueries in INSERT +--echo # create table t1 (a int default 5); insert t1 values (1); insert t1 values (a); @@ -625,3 +665,7 @@ insert t1 set a=a+2; insert t1 set a=(select a+3); select * from t1; drop table t1; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/main/insert_innodb.result b/mysql-test/main/insert_innodb.result index e5e2b4b8623a0..b8f3979d2ba5e 100644 --- a/mysql-test/main/insert_innodb.result +++ b/mysql-test/main/insert_innodb.result @@ -43,3 +43,15 @@ INSERT IGNORE INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def'; Warnings: Warning 1452 Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)) DROP TABLE t2, t1; +# +# MDEV-26433: assertion: table->get_ref_count() == 0 in dict0dict.cc +# line 1915 +# +CREATE TEMPORARY TABLE v0 ( v1 TEXT ( 15 ) CHAR SET BINARY NOT NULL NOT NULL UNIQUE CHECK ( v1 ) ) REPLACE SELECT NULL AS v3 , 74 AS v2 ; +ERROR HY000: Field 'v1' doesn't have a default value +CREATE TEMPORARY TABLE t1 (i TEXT(15) NOT NULL DEFAULT '' UNIQUE CHECK (i)) engine=innodb +REPLACE SELECT NULL AS a; +ERROR 23000: CONSTRAINT `t1.i` failed for `test`.`t1` +# +# End of 10.5 tests +# diff --git a/mysql-test/main/insert_innodb.test b/mysql-test/main/insert_innodb.test index 68b6ca4e315f5..56ddb2eafbfc7 100644 --- a/mysql-test/main/insert_innodb.test +++ b/mysql-test/main/insert_innodb.test @@ -62,3 +62,20 @@ INSERT IGNORE INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def'; --disable_warnings DROP TABLE t2, t1; + +--echo # +--echo # MDEV-26433: assertion: table->get_ref_count() == 0 in dict0dict.cc +--echo # line 1915 +--echo # + +--error ER_NO_DEFAULT_FOR_FIELD +CREATE TEMPORARY TABLE v0 ( v1 TEXT ( 15 ) CHAR SET BINARY NOT NULL NOT NULL UNIQUE CHECK ( v1 ) ) REPLACE SELECT NULL AS v3 , 74 AS v2 ; + +--error ER_CONSTRAINT_FAILED +CREATE TEMPORARY TABLE t1 (i TEXT(15) NOT NULL DEFAULT '' UNIQUE CHECK (i)) engine=innodb + REPLACE SELECT NULL AS a; + + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/main/insert_notembedded.result b/mysql-test/main/insert_notembedded.result index 8dd4aa7d71ea0..5df69cc8ffedb 100644 --- a/mysql-test/main/insert_notembedded.result +++ b/mysql-test/main/insert_notembedded.result @@ -38,7 +38,7 @@ INNER JOIN view_stations AS stations ON table_source.id = stations.icao LEFT JOIN table_target AS old USING (mexs_id); -ERROR 42000: INSERT, DELETE command denied to user 'user20989'@'localhost' for table 'table_target' +ERROR 42000: INSERT, DELETE command denied to user 'user20989'@'localhost' for table `meow`.`table_target` REPLACE INTO view_target2 SELECT stations.mexs_id AS mexs_id, datetime AS messzeit FROM table_source @@ -46,7 +46,7 @@ INNER JOIN view_stations AS stations ON table_source.id = stations.icao LEFT JOIN view_target2 AS old USING (mexs_id); -ERROR 42000: INSERT, DELETE command denied to user 'user20989'@'localhost' for table 'view_target2' +ERROR 42000: INSERT, DELETE command denied to user 'user20989'@'localhost' for table `meow`.`view_target2` REPLACE INTO view_target3 SELECT stations.mexs_id AS mexs_id, datetime AS messzeit FROM table_source @@ -70,7 +70,7 @@ ON table_source.id = stations.icao LEFT JOIN table_target AS old USING (mexs_id); REPLACE INTO table_target2 VALUES ('00X45Y78','2006-07-12 07:50:00'); -ERROR 42000: INSERT, DELETE command denied to user 'user20989'@'localhost' for table 'table_target2' +ERROR 42000: INSERT, DELETE command denied to user 'user20989'@'localhost' for table `meow`.`table_target2` REPLACE INTO view_target2 VALUES ('12X45Y78','2006-07-12 07:50:00'); SELECT stations.mexs_id AS mexs_id, datetime AS messzeit FROM table_source diff --git a/mysql-test/main/insert_returning.result b/mysql-test/main/insert_returning.result index a3cde7b12708f..b2ed9c90e51ee 100644 --- a/mysql-test/main/insert_returning.result +++ b/mysql-test/main/insert_returning.result @@ -63,6 +63,8 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN EXTENDED INSERT INTO t1(id1,val1) VALUES(9,'j') RETURNING id1; 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 +Warnings: +Note 1003 insert into `test`.`t1`(id1,val1) values (9,'j') EXPLAIN FORMAT="json" INSERT INTO t1(id1,val1) VALUES (10,'k') RETURNING id1; EXPLAIN { @@ -151,6 +153,8 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN EXTENDED INSERT INTO t1 VALUES (17,'s'),(18,'t') RETURNING *; 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 +Warnings: +Note 1003 insert into `test`.`t1` values (17,'s'),(18,'t') EXPLAIN FORMAT="json" INSERT INTO t1 VALUES(19,'u'),(20,'v') RETURNING id1; EXPLAIN { @@ -236,6 +240,8 @@ EXPLAIN EXTENDED INSERT INTO ins_duplicate(id,val) VALUES (2,'b') ON DUPLICATE KEY UPDATE val='i' RETURNING val; id select_type table type possible_keys key key_len ref rows filtered Extra 1 INSERT ins_duplicate ALL NULL NULL NULL NULL NULL 100.00 NULL +Warnings: +Note 1003 insert into `test`.`ins_duplicate`(id,val) values (2,'b') on duplicate key update `test`.`ins_duplicate`.`val` = 'i' EXPLAIN FORMAT="json" INSERT INTO ins_duplicate(id,val) VALUES (2,'b') ON DUPLICATE KEY UPDATE val='j' RETURNING val; EXPLAIN @@ -320,6 +326,8 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN EXTENDED INSERT INTO t1 SET id1=10, val1='j' RETURNING val1; 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 +Warnings: +Note 1003 insert into `test`.`t1`(id1,val1) values (10,'j') EXPLAIN FORMAT="json" INSERT INTO t1 SET id1=11, val1='k' RETURNING val1; EXPLAIN { @@ -400,10 +408,12 @@ f(id2) 14 EXPLAIN INSERT INTO t2 SELECT * FROM t1 WHERE id1=8 RETURNING id2; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 EXPLAIN EXTENDED INSERT INTO t1 SELECT * FROM t1 WHERE id1=9 RETURNING val1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Note 1003 insert into `test`.`t1` select sql_buffer_result NULL AS `id1`,NULL AS `val1` from `test`.`t1` where 0 EXPLAIN FORMAT="json" INSERT INTO t1 SELECT * FROM t1 WHERE id1=10 RETURNING val1; EXPLAIN { @@ -433,7 +443,7 @@ Warning 1062 Duplicate entry '7' for key 'PRIMARY' Warning 1062 Duplicate entry '8' for key 'PRIMARY' ANALYZE INSERT INTO t2 SELECT * FROM t1 WHERE id1=11 RETURNING *; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t2; id2 val2 1 a @@ -615,3 +625,61 @@ DROP TABLE ins_duplicate; DROP VIEW v1; DROP VIEW v2; DROP FUNCTION f; +# +# MDEV-25028: ASAN use-after-poison in base_list_iterator::next or +# Assertion `sl->join == 0' upon INSERT .. RETURNING via PS +# +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +PREPARE stmt1 FROM "INSERT INTO t1 SELECT * FROM t1 WHERE a IN (SELECT b FROM t2) RETURNING a"; +EXECUTE stmt1; +a +PREPARE stmt2 FROM "INSERT INTO t1 SELECT * FROM t1 WHERE a IN (SELECT b FROM t2) RETURNING (SELECT b FROM t2)"; +EXECUTE stmt2; +(SELECT b FROM t2) +DROP TABLE t1, t2; +# +# MDEV-25187: Assertion `inited == NONE || table->open_by_handler' +# failed or Direct leak in init_dynamic_array2 upon INSERT .. RETURNING +# and memory leak in init_dynamic_array2 +# +CREATE TABLE t (a INT, KEY (a)); +CREATE TABLE t1 (f INT); +INSERT INTO t VALUES (1),(2); +INSERT INTO t1 SELECT a FROM t WHERE 1 NOT IN (SELECT a FROM t) RETURNING f; +f +DROP TABLE t, t1; +# +# MDEV-28740: crash in INSERT RETURNING subquery in prepared statements +# +CREATE TABLE t1 ( +id INTEGER NOT NULL, +data VARCHAR(30), +PRIMARY KEY (id) +)ENGINE=MyISAM; +EXECUTE IMMEDIATE 'INSERT INTO t1 (id, data) VALUES ((SELECT CAST(1 AS SIGNED INTEGER) AS anon_1), ?) RETURNING t1.id' using 'hi'; +id +1 +DROP TABLE t1; +# +# MDEV-27165: crash in base_list_iterator::next +# +CREATE TABLE t1 ( id int, a int); +CREATE TABLE t2 ( id int); +INSERT INTO t1 VALUES (( SELECT 1 from t2),999999999999) RETURNING id; +ERROR 22003: Out of range value for column 'a' at row 1 +EXECUTE immediate "INSERT INTO t1 VALUES (( SELECT 1 from t2),999999999999) RETURNING id "; +ERROR 22003: Out of range value for column 'a' at row 1 +EXECUTE immediate "INSERT INTO t1 VALUES (( SELECT 1 from t2),9) RETURNING id "; +id +NULL +DROP TABLE t1, t2; +# +# MDEV-29686: Assertion `slave == 0' failed in +# st_select_lex_node::attach_single +# +CREATE TABLE t (a INT); +INSERT t WITH cte AS (SELECT 1) SELECT * FROM cte RETURNING *; +a +1 +DROP TABLE t; diff --git a/mysql-test/main/insert_returning.test b/mysql-test/main/insert_returning.test index 6c8e71a4617e3..837d61d2c160e 100644 --- a/mysql-test/main/insert_returning.test +++ b/mysql-test/main/insert_returning.test @@ -326,3 +326,73 @@ DROP TABLE ins_duplicate; DROP VIEW v1; DROP VIEW v2; DROP FUNCTION f; + +--echo # +--echo # MDEV-25028: ASAN use-after-poison in base_list_iterator::next or +--echo # Assertion `sl->join == 0' upon INSERT .. RETURNING via PS +--echo # +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); + +PREPARE stmt1 FROM "INSERT INTO t1 SELECT * FROM t1 WHERE a IN (SELECT b FROM t2) RETURNING a"; +EXECUTE stmt1; + +PREPARE stmt2 FROM "INSERT INTO t1 SELECT * FROM t1 WHERE a IN (SELECT b FROM t2) RETURNING (SELECT b FROM t2)"; +EXECUTE stmt2; + +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-25187: Assertion `inited == NONE || table->open_by_handler' +--echo # failed or Direct leak in init_dynamic_array2 upon INSERT .. RETURNING +--echo # and memory leak in init_dynamic_array2 +--echo # +CREATE TABLE t (a INT, KEY (a)); +CREATE TABLE t1 (f INT); + +INSERT INTO t VALUES (1),(2); + +INSERT INTO t1 SELECT a FROM t WHERE 1 NOT IN (SELECT a FROM t) RETURNING f; + +# Cleanup +DROP TABLE t, t1; + +--echo # +--echo # MDEV-28740: crash in INSERT RETURNING subquery in prepared statements +--echo # + +CREATE TABLE t1 ( + id INTEGER NOT NULL, + data VARCHAR(30), + PRIMARY KEY (id) + )ENGINE=MyISAM; + +EXECUTE IMMEDIATE 'INSERT INTO t1 (id, data) VALUES ((SELECT CAST(1 AS SIGNED INTEGER) AS anon_1), ?) RETURNING t1.id' using 'hi'; + +DROP TABLE t1; + +--echo # +--echo # MDEV-27165: crash in base_list_iterator::next +--echo # + +CREATE TABLE t1 ( id int, a int); +CREATE TABLE t2 ( id int); + +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO t1 VALUES (( SELECT 1 from t2),999999999999) RETURNING id; +--error ER_WARN_DATA_OUT_OF_RANGE +EXECUTE immediate "INSERT INTO t1 VALUES (( SELECT 1 from t2),999999999999) RETURNING id "; + +EXECUTE immediate "INSERT INTO t1 VALUES (( SELECT 1 from t2),9) RETURNING id "; + +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-29686: Assertion `slave == 0' failed in +--echo # st_select_lex_node::attach_single +--echo # + +CREATE TABLE t (a INT); +INSERT t WITH cte AS (SELECT 1) SELECT * FROM cte RETURNING *; + +DROP TABLE t; diff --git a/mysql-test/main/insert_select.result b/mysql-test/main/insert_select.result index 5094638c92bd6..29618c6ddd467 100644 --- a/mysql-test/main/insert_select.result +++ b/mysql-test/main/insert_select.result @@ -862,6 +862,197 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` binary(0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; End of 5.5 tests +# +# Beginning of 10.2 test +# +# MDEV-26698: Incorrect row number upon INSERT .. SELECT from the same +# table: rows are counted twice +# +CREATE TABLE t1(a TINYINT); +INSERT INTO t1 VALUES (1), (100); +INSERT INTO t1 SELECT a*2 FROM t1; +Warnings: +Warning 1264 Out of range value for column 'a' at row 2 +TRUNCATE TABLE t1; +# using ORDER BY +INSERT INTO t1 VALUES(1), (2), (100), (3); +INSERT INTO t1 SELECT a*2 FROM t1 ORDER BY a; +Warnings: +Warning 1264 Out of range value for column 'a' at row 4 +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 (a) SELECT SUM(1); +INSERT INTO t1 (a, b) SELECT AVG(2), MIN(3); +INSERT INTO t1 (b) SELECT AVG('x') OVER (); +ERROR 22007: Truncated incorrect DOUBLE value: 'x' +INSERT INTO t1 SELECT MIN(7) OVER (), MAX(8) OVER(); +SELECT * FROM t1; +a b +1 NULL +2 3 +7 8 +PREPARE stmt FROM 'INSERT INTO t1 (a) SELECT AVG(?)'; +EXECUTE stmt USING 9; +EXECUTE stmt USING 10; +PREPARE stmt FROM 'INSERT INTO t1 SELECT MIN(?), MAX(?)'; +EXECUTE stmt USING 11, 12; +EXECUTE stmt USING 13, 14; +DEALLOCATE PREPARE stmt; +SELECT * FROM t1; +a b +1 NULL +2 3 +7 8 +9 NULL +10 NULL +11 12 +13 14 +CREATE PROCEDURE p1(param_a INT, param_b INT) +BEGIN +INSERT INTO t1 SELECT MIN(param_a) OVER (), MAX(param_b); +END// +CALL p1(21, 22); +CALL p1(23, 24); +SELECT * FROM t1; +a b +1 NULL +2 3 +7 8 +9 NULL +10 NULL +11 12 +13 14 +21 22 +23 24 +CREATE TABLE t2 ( +a DECIMAL UNIQUE CHECK (CASE 0 * 27302337.000000 WHEN 34 THEN ++ 'x' LIKE 'x' OR a NOT IN (-1 / TRUE ^ 2) ELSE 7105743.000000 END)); +INSERT INTO t2 VALUES (90),( -1),(31152443.000000),(-32768),(NULL),(NULL); +INSERT INTO t2 SELECT AVG('x') OVER ( +PARTITION BY ((NOT AVG(76698761.000000))) IS NOT NULL); +ERROR 22007: Truncated incorrect DOUBLE value: 'x' +INSERT IGNORE INTO t2 () VALUES (0),('x'),(3751286.000000), +('x'),((a = 'x' AND 0 AND 0)); +Warnings: +Warning 1366 Incorrect decimal value: 'x' for column `test`.`t2`.`a` at row 2 +Warning 1062 Duplicate entry '0' for key 'a' +Warning 1366 Incorrect decimal value: 'x' for column `test`.`t2`.`a` at row 4 +Warning 1062 Duplicate entry '0' for key 'a' +Warning 1062 Duplicate entry '0' for key 'a' +INSERT INTO t2 VALUES (127); +INSERT INTO t2 SELECT -2147483648 END FROM t2 AS TEXT JOIN t2 JOIN t2 TABLES; +ERROR 23000: Duplicate entry '-2147483648' for key 'a' +ALTER TABLE t2 ADD ( +b INT UNIQUE CHECK ((a = 'x' AND ((-(+(BINARY 49730460.000000)))) = 'x' +BETWEEN 'x' AND 'x'))); +ERROR 22007: Truncated incorrect DECIMAL value: 'x' +UPDATE t2 SET a = -128 WHERE a IS NULL ORDER BY 78 IN ('x','x'),a; +ERROR 23000: Duplicate entry '-128' for key 'a' +DROP TABLE t1, t2; +DROP PROCEDURE p1; +# End of 10.2 test +# +# MDEV-28617: INSERT ... SELECT with redundant IN subquery in GROUP BY +# list that uses mergeable derived table containing +# reference to target table +# +create table t1 (a int); +create table t2 (b int); +create table t3 (c int); +insert into t1 values (3), (1); +insert into t2 values (3), (2); +insert into t3 values (4), (2); +insert into t1 +select b from t2 +where b in (select c from t3 +group by (select * from (select a from t1) dt where a = 1)); +select * from t1; +a +3 +1 +2 +delete from t1; +insert into t1 values (3), (1); +insert into t1 +select b from t2 +where b >= any (select c from t3 +group by (select * from (select a from t1) dt where a = 1)); +select * from t1; +a +3 +1 +3 +2 +delete from t1; +insert into t1 values (3), (1); +insert into t1 +select b from t2 +where b <= all (select c from t3 +group by (select * from (select a from t1) dt where a = 1)); +select * from t1; +a +3 +1 +2 +delete from t1; +insert into t1 values (3), (1); +insert into t1 +select b from t2 +where exists (select c from t3 +group by (select * from (select a from t1) dt where a = 1)); +select * from t1; +a +3 +1 +3 +2 +delete from t1; +insert into t1 values (3), (1); +prepare stmt from " +insert into t1 +select b from t2 + where b in (select c from t3 + group by (select * from (select a from t1) dt where a = 1)); +"; +execute stmt; +select * from t1; +a +3 +1 +2 +delete from t1; +insert into t1 values (3), (1); +execute stmt; +select * from t1; +a +3 +1 +2 +delete from t1; +insert into t1 values (3), (1); +delete from t1 +where exists (select b from t2 +where b in (select c from t3 +group by (select * from (select a from t1) dt +where a = 1))); +select * from t1; +a +deallocate prepare stmt; +drop table t1,t2,t3; +# +# MDEV-30342 Wrong "Truncated incorrect DECIMAL value" warning/error +# +create table t1(c1 varchar(1)); +create table t2(c1 varchar(1)); +insert into t1(c1) values('#'); +select @@sql_mode like '%strict_all_tables%'; +@@sql_mode like '%strict_all_tables%' +0 +insert into t2(c1) select if(c1 = '#', c1 = 0, c1) as c1 from t1; +drop table t1, t2; +# +# End of 10.3 test +# diff --git a/mysql-test/main/insert_select.test b/mysql-test/main/insert_select.test index 0b5cdf95daf5d..a3604e38f34ae 100644 --- a/mysql-test/main/insert_select.test +++ b/mysql-test/main/insert_select.test @@ -435,3 +435,181 @@ show create table t2; drop table t1, t2; --echo End of 5.5 tests + +--echo # +--echo # Beginning of 10.2 test +--echo # +--echo # MDEV-26698: Incorrect row number upon INSERT .. SELECT from the same +--echo # table: rows are counted twice +--echo # + +CREATE TABLE t1(a TINYINT); + +INSERT INTO t1 VALUES (1), (100); + +INSERT INTO t1 SELECT a*2 FROM t1; + +TRUNCATE TABLE t1; + +--echo # using ORDER BY + +INSERT INTO t1 VALUES(1), (2), (100), (3); + +INSERT INTO t1 SELECT a*2 FROM t1 ORDER BY a; + +DROP TABLE t1; + +# +# MDEV-26427 MariaDB Server SEGV on INSERT .. SELECT +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 (a) SELECT SUM(1); +INSERT INTO t1 (a, b) SELECT AVG(2), MIN(3); + +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 (b) SELECT AVG('x') OVER (); +INSERT INTO t1 SELECT MIN(7) OVER (), MAX(8) OVER(); +SELECT * FROM t1; + +PREPARE stmt FROM 'INSERT INTO t1 (a) SELECT AVG(?)'; +EXECUTE stmt USING 9; +EXECUTE stmt USING 10; + +PREPARE stmt FROM 'INSERT INTO t1 SELECT MIN(?), MAX(?)'; +EXECUTE stmt USING 11, 12; +EXECUTE stmt USING 13, 14; +DEALLOCATE PREPARE stmt; +SELECT * FROM t1; + +DELIMITER //; +CREATE PROCEDURE p1(param_a INT, param_b INT) +BEGIN +INSERT INTO t1 SELECT MIN(param_a) OVER (), MAX(param_b); +END// +DELIMITER ;// +CALL p1(21, 22); +CALL p1(23, 24); +SELECT * FROM t1; + +CREATE TABLE t2 ( + a DECIMAL UNIQUE CHECK (CASE 0 * 27302337.000000 WHEN 34 THEN + + 'x' LIKE 'x' OR a NOT IN (-1 / TRUE ^ 2) ELSE 7105743.000000 END)); +INSERT INTO t2 VALUES (90),( -1),(31152443.000000),(-32768),(NULL),(NULL); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t2 SELECT AVG('x') OVER ( + PARTITION BY ((NOT AVG(76698761.000000))) IS NOT NULL); +INSERT IGNORE INTO t2 () VALUES (0),('x'),(3751286.000000), + ('x'),((a = 'x' AND 0 AND 0)); +INSERT INTO t2 VALUES (127); +--error ER_DUP_ENTRY +INSERT INTO t2 SELECT -2147483648 END FROM t2 AS TEXT JOIN t2 JOIN t2 TABLES; +--error ER_TRUNCATED_WRONG_VALUE +ALTER TABLE t2 ADD ( + b INT UNIQUE CHECK ((a = 'x' AND ((-(+(BINARY 49730460.000000)))) = 'x' + BETWEEN 'x' AND 'x'))); +--error ER_DUP_ENTRY +UPDATE t2 SET a = -128 WHERE a IS NULL ORDER BY 78 IN ('x','x'),a; + +DROP TABLE t1, t2; +DROP PROCEDURE p1; + +--echo # End of 10.2 test + +--echo # +--echo # MDEV-28617: INSERT ... SELECT with redundant IN subquery in GROUP BY +--echo # list that uses mergeable derived table containing +--echo # reference to target table +--echo # + +create table t1 (a int); +create table t2 (b int); +create table t3 (c int); + +insert into t1 values (3), (1); +insert into t2 values (3), (2); +insert into t3 values (4), (2); + +insert into t1 +select b from t2 + where b in (select c from t3 + group by (select * from (select a from t1) dt where a = 1)); +select * from t1; + +delete from t1; +insert into t1 values (3), (1); + +insert into t1 +select b from t2 + where b >= any (select c from t3 + group by (select * from (select a from t1) dt where a = 1)); +select * from t1; + +delete from t1; +insert into t1 values (3), (1); + +insert into t1 +select b from t2 + where b <= all (select c from t3 + group by (select * from (select a from t1) dt where a = 1)); +select * from t1; + +delete from t1; +insert into t1 values (3), (1); + +insert into t1 +select b from t2 + where exists (select c from t3 + group by (select * from (select a from t1) dt where a = 1)); +select * from t1; + +delete from t1; +insert into t1 values (3), (1); + +prepare stmt from " +insert into t1 +select b from t2 + where b in (select c from t3 + group by (select * from (select a from t1) dt where a = 1)); +"; + +execute stmt; +select * from t1; + +delete from t1; +insert into t1 values (3), (1); + +execute stmt; +select * from t1; + +delete from t1; +insert into t1 values (3), (1); + +delete from t1 + where exists (select b from t2 + where b in (select c from t3 + group by (select * from (select a from t1) dt + where a = 1))); +select * from t1; + +deallocate prepare stmt; + +drop table t1,t2,t3; + + +--echo # +--echo # MDEV-30342 Wrong "Truncated incorrect DECIMAL value" warning/error +--echo # + +create table t1(c1 varchar(1)); +create table t2(c1 varchar(1)); + +insert into t1(c1) values('#'); + +select @@sql_mode like '%strict_all_tables%'; +insert into t2(c1) select if(c1 = '#', c1 = 0, c1) as c1 from t1; + +drop table t1, t2; + +--echo # +--echo # End of 10.3 test +--echo # diff --git a/mysql-test/main/insert_update.result b/mysql-test/main/insert_update.result index 68a1003ad851b..83344971c5944 100644 --- a/mysql-test/main/insert_update.result +++ b/mysql-test/main/insert_update.result @@ -412,3 +412,44 @@ select if( @stamp1 = @stamp2, "correct", "wrong"); if( @stamp1 = @stamp2, "correct", "wrong") correct drop table t1; +# +# MDEV-31164 default current_timestamp() not working when used INSERT ON DUPLICATE KEY in some cases +# +set timestamp=unix_timestamp('2000-10-20 0:0:0'); +create table t1 (pk integer primary key, val varchar(20) not null, ts timestamp); +insert t1 (pk, val) values(1, 'val1'); +select * from t1; +pk val ts +1 val1 2000-10-20 00:00:00 +set timestamp=unix_timestamp('2000-10-20 1:0:0'); +insert t1 (pk, val) select 2, 'val3' union select 3, 'val4' + on duplicate key update ts=now(); +select * from t1; +pk val ts +1 val1 2000-10-20 00:00:00 +2 val3 2000-10-20 01:00:00 +3 val4 2000-10-20 01:00:00 +set timestamp=unix_timestamp('2000-10-20 2:0:0'); +insert t1 (pk, val) select 1, 'val1' union select 4, 'val2' + on duplicate key update ts=now(); +select * from t1; +pk val ts +1 val1 2000-10-20 02:00:00 +2 val3 2000-10-20 01:00:00 +3 val4 2000-10-20 01:00:00 +4 val2 2000-10-20 02:00:00 +set timestamp=unix_timestamp('2000-10-20 3:0:0'); +insert t1 (pk, val) select 5, 'val1' union select 1, 'val2' + on duplicate key update ts=now(); +select * from t1; +pk val ts +1 val1 2000-10-20 03:00:00 +2 val3 2000-10-20 01:00:00 +3 val4 2000-10-20 01:00:00 +4 val2 2000-10-20 02:00:00 +5 val1 2000-10-20 03:00:00 +drop table t1; +set timestamp=default; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/insert_update.test b/mysql-test/main/insert_update.test index 06e16be84d796..25953938ad142 100644 --- a/mysql-test/main/insert_update.test +++ b/mysql-test/main/insert_update.test @@ -311,3 +311,29 @@ insert into t1(f1) values(1) on duplicate key update f1=1; select @stamp2:=f2 from t1; select if( @stamp1 = @stamp2, "correct", "wrong"); drop table t1; + +--echo # +--echo # MDEV-31164 default current_timestamp() not working when used INSERT ON DUPLICATE KEY in some cases +--echo # +set timestamp=unix_timestamp('2000-10-20 0:0:0'); +create table t1 (pk integer primary key, val varchar(20) not null, ts timestamp); +insert t1 (pk, val) values(1, 'val1'); +select * from t1; +set timestamp=unix_timestamp('2000-10-20 1:0:0'); +insert t1 (pk, val) select 2, 'val3' union select 3, 'val4' + on duplicate key update ts=now(); +select * from t1; +set timestamp=unix_timestamp('2000-10-20 2:0:0'); +insert t1 (pk, val) select 1, 'val1' union select 4, 'val2' + on duplicate key update ts=now(); +select * from t1; +set timestamp=unix_timestamp('2000-10-20 3:0:0'); +insert t1 (pk, val) select 5, 'val1' union select 1, 'val2' + on duplicate key update ts=now(); +select * from t1; +drop table t1; +set timestamp=default; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/intersect.result b/mysql-test/main/intersect.result index aa6d48553f18b..4e14ec33c608c 100644 --- a/mysql-test/main/intersect.result +++ b/mysql-test/main/intersect.result @@ -453,7 +453,11 @@ ANALYZE "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "r_filtered": 100 + "r_loops": 3, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 3 } } ] @@ -548,7 +552,11 @@ ANALYZE "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "r_filtered": 100 + "r_loops": 3, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 3 } } ] @@ -636,7 +644,7 @@ Table Create Table t4 CREATE TABLE `t4` ( `a` int(11) DEFAULT NULL, `b` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop tables t1,t2,t3,t4; create table t1 (a int, b blob) engine=MyISAM; create table t2 (c int, d blob) engine=MyISAM; @@ -776,7 +784,7 @@ a b drop procedure p1; 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 `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union select `__6`.`c` AS `c`,`__6`.`d` AS `d` from ((select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__6` union (select 4 AS `4`,4 AS `4`) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1`) union select `__6`.`c` AS `c`,`__6`.`d` AS `d` from ((select `t2`.`c` AS `c`,`t2`.`d` AS `d` from `t2`) intersect (select `t3`.`e` AS `e`,`t3`.`f` AS `f` from `t3`)) `__6` union (select 4 AS `4`,4 AS `4`) latin1 latin1_swedish_ci drop view v1; drop tables t1,t2,t3; # diff --git a/mysql-test/main/intersect_all.result b/mysql-test/main/intersect_all.result index 243497ffc4f3c..11ee34b7390fe 100644 --- a/mysql-test/main/intersect_all.result +++ b/mysql-test/main/intersect_all.result @@ -484,7 +484,11 @@ ANALYZE "buffer_type": "flat", "buffer_size": "65", "join_type": "BNL", - "r_filtered": 100 + "r_loops": 5, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 7 } } ] @@ -579,7 +583,11 @@ ANALYZE "buffer_type": "flat", "buffer_size": "65", "join_type": "BNL", - "r_filtered": 100 + "r_loops": 5, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 7 } } ] @@ -682,7 +690,7 @@ Table Create Table t4 CREATE TABLE `t4` ( `a` int(11) DEFAULT NULL, `b` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop tables t4; (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4); a b @@ -829,7 +837,7 @@ a b drop procedure p1; 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 `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union all select `__6`.`c` AS `c`,`__6`.`d` AS `d` from ((select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect all (select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__6` union all (select 4 AS `4`,4 AS `4`) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1`) union all select `__6`.`c` AS `c`,`__6`.`d` AS `d` from ((select `t2`.`c` AS `c`,`t2`.`d` AS `d` from `t2`) intersect all (select `t3`.`e` AS `e`,`t3`.`f` AS `f` from `t3`)) `__6` union all (select 4 AS `4`,4 AS `4`) latin1 latin1_swedish_ci drop view v1; drop tables t1,t2,t3; CREATE TABLE t (i INT); diff --git a/mysql-test/main/invisible_binlog.result b/mysql-test/main/invisible_binlog.result index 088bc858e28a4..ed9661833eb17 100644 --- a/mysql-test/main/invisible_binlog.result +++ b/mysql-test/main/invisible_binlog.result @@ -41,7 +41,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) INVISIBLE DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t2; a 1 @@ -59,7 +59,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) INVISIBLE DEFAULT 5 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; drop table t1,t2; include/rpl_end.inc diff --git a/mysql-test/main/invisible_binlog.test b/mysql-test/main/invisible_binlog.test index 654afcc39c36c..11b4be3ab8743 100644 --- a/mysql-test/main/invisible_binlog.test +++ b/mysql-test/main/invisible_binlog.test @@ -1,5 +1,6 @@ --source include/master-slave.inc +--disable_service_connection --connection master create table t1(a int , b int invisible); insert into t1 values(1); @@ -30,3 +31,4 @@ show create table t2; drop table t1,t2; --source include/rpl_end.inc +--enable_service_connection diff --git a/mysql-test/main/invisible_field.result b/mysql-test/main/invisible_field.result index 081c1ada1ee88..7aa88e7787eb4 100644 --- a/mysql-test/main/invisible_field.result +++ b/mysql-test/main/invisible_field.result @@ -13,7 +13,7 @@ t1 CREATE TABLE `t1` ( `abc` int(11) NOT NULL, `xyz` int(11) INVISIBLE DEFAULT NULL, PRIMARY KEY (`abc`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select TABLE_CATALOG,TABLE_SCHEMA,TABLE_NAME,COLUMN_NAME,EXTRA from INFORMATION_SCHEMA.COLUMNS where TABLE_SCHEMA='test' and TABLE_NAME='t1'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME EXTRA def test t1 abc @@ -150,7 +150,7 @@ t1 CREATE TABLE `t1` ( `abc` int(11) NOT NULL INVISIBLE AUTO_INCREMENT, `a` int(11) DEFAULT NULL, PRIMARY KEY (`abc`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values(1); insert into t1 values(2); insert into t1 values(3); @@ -423,7 +423,7 @@ t1 CREATE TABLE `t1` ( `c` int(11) INVISIBLE DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `c` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci desc t1; Field Type Null Key Default Extra a int(11) NO PRI NULL diff --git a/mysql-test/main/invisible_field_debug.result b/mysql-test/main/invisible_field_debug.result index 4cbdb31e155d4..344a0b860fc6b 100644 --- a/mysql-test/main/invisible_field_debug.result +++ b/mysql-test/main/invisible_field_debug.result @@ -11,7 +11,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select a , invisible from t1; a invisible 1 9 @@ -94,7 +94,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values(1); select * from t1; a @@ -326,7 +326,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL, KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values(1,1,1); insert into t1 values(2,2,2); insert into t1 values(3,3,3); @@ -395,5 +395,5 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, `v` int(11) GENERATED ALWAYS AS (1) VIRTUAL INVISIBLE -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; diff --git a/mysql-test/main/invisible_field_grant_completely.result b/mysql-test/main/invisible_field_grant_completely.result index aa0a768c51ccc..b1b313072b2b3 100644 --- a/mysql-test/main/invisible_field_grant_completely.result +++ b/mysql-test/main/invisible_field_grant_completely.result @@ -51,9 +51,9 @@ connection default; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1; connection con1; select * from t1; -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `d`.`t1` select invisible from t1; -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `d`.`t1` disconnect con1; #Final Cleanup diff --git a/mysql-test/main/invisible_field_grant_system.result b/mysql-test/main/invisible_field_grant_system.result index b69478c58b370..d2e40c391c42f 100644 --- a/mysql-test/main/invisible_field_grant_system.result +++ b/mysql-test/main/invisible_field_grant_system.result @@ -57,9 +57,9 @@ connection default; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1; connection con1; select * from t1; -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `d`.`t1` select count(row_start) from t1; -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `d`.`t1` disconnect con1; #Cleanup diff --git a/mysql-test/main/join.result b/mysql-test/main/join.result index 11b7ecad3ee04..942ee96fc32f0 100644 --- a/mysql-test/main/join.result +++ b/mysql-test/main/join.result @@ -3407,3 +3407,20 @@ id select_type table type possible_keys key key_len ref rows Extra drop table t1,t2,t3; drop table t1000,t10,t03; # End of 10.3 tests +# +# MDEV-30080 Wrong result with LEFT JOINs involving constant tables +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(1); +CREATE TABLE t3 (c INT PRIMARY KEY) ENGINE=MyISAM; +SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t2.b = t3.c) ON t1.a = t2.b; +a b c +1 1 NULL +1 1 NULL +SELECT COUNT(*) FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t2.b = t3.c) ON t1.a = t2.b; +COUNT(*) +2 +DROP TABLE t1, t2, t3; +# End of 10.5 tests diff --git a/mysql-test/main/join.test b/mysql-test/main/join.test index b99f05f7c8838..c8bd2886b3020 100644 --- a/mysql-test/main/join.test +++ b/mysql-test/main/join.test @@ -1820,3 +1820,18 @@ drop table t1,t2,t3; drop table t1000,t10,t03; --echo # End of 10.3 tests + +--echo # +--echo # MDEV-30080 Wrong result with LEFT JOINs involving constant tables +--echo # + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(1); +CREATE TABLE t3 (c INT PRIMARY KEY) ENGINE=MyISAM; +SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t2.b = t3.c) ON t1.a = t2.b; +SELECT COUNT(*) FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t2.b = t3.c) ON t1.a = t2.b; +DROP TABLE t1, t2, t3; + +--echo # End of 10.5 tests diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result index 359739fecf85c..10ed8960b6447 100644 --- a/mysql-test/main/join_cache.result +++ b/mysql-test/main/join_cache.result @@ -3887,8 +3887,8 @@ ORDER BY t2.v; MAX(t1.i) NULL Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'x' -Warning 1292 Truncated incorrect DOUBLE value: 'y' +Warning 1292 Truncated incorrect DECIMAL value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'y' EXPLAIN SELECT MAX(t1.i) diff --git a/mysql-test/main/join_cache.test b/mysql-test/main/join_cache.test index 4b659345db468..f09f28c273ab3 100644 --- a/mysql-test/main/join_cache.test +++ b/mysql-test/main/join_cache.test @@ -1,9 +1,11 @@ +--source include/no_valgrind_without_big.inc +--source include/default_optimizer_switch.inc +--source include/default_charset.inc + --disable_warnings DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11; DROP DATABASE IF EXISTS world; --enable_warnings ---source include/default_optimizer_switch.inc ---source include/default_charset.inc set @org_optimizer_switch=@@optimizer_switch; set @save_join_cache_level=@@join_cache_level; @@ -409,6 +411,9 @@ SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; +#enable after fix MDEV-27871 +--disable_view_protocol + EXPLAIN SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) FROM Country LEFT JOIN CountryLanguage ON @@ -422,6 +427,8 @@ SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.P WHERE Country.Population > 10000000; +--enable_view_protocol + show variables like 'join_buffer_size'; set join_cache_level=4; show variables like 'join_cache_level'; @@ -463,6 +470,9 @@ SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; +#enable after fix MDEV-27871 +--disable_view_protocol + EXPLAIN SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) FROM Country LEFT JOIN CountryLanguage ON @@ -476,6 +486,7 @@ SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.P WHERE Country.Population > 10000000; +--enable_view_protocol --replace_column 9 # EXPLAIN @@ -547,6 +558,9 @@ SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; +#enable after fix MDEV-27871 +--disable_view_protocol + EXPLAIN SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) FROM Country LEFT JOIN CountryLanguage ON @@ -560,6 +574,8 @@ SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.P WHERE Country.Population > 10000000; +--enable_view_protocol + set join_cache_level=6; show variables like 'join_cache_level'; @@ -600,6 +616,9 @@ SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; +#enable after fix MDEV-27871 +--disable_view_protocol + EXPLAIN SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) FROM Country LEFT JOIN CountryLanguage ON @@ -613,6 +632,8 @@ SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.P WHERE Country.Population > 10000000; +--enable_view_protocol + set join_cache_level=7; show variables like 'join_cache_level'; @@ -653,6 +674,9 @@ SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; +#enable after fix MDEV-27871 +--disable_view_protocol + EXPLAIN SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) FROM Country LEFT JOIN CountryLanguage ON @@ -666,6 +690,8 @@ SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.P WHERE Country.Population > 10000000; +--enable_view_protocol + set join_cache_level=8; show variables like 'join_cache_level'; @@ -706,6 +732,9 @@ SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; +#enable after fix MDEV-27871 +--disable_view_protocol + EXPLAIN SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) FROM Country LEFT JOIN CountryLanguage ON @@ -719,6 +748,8 @@ SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.P WHERE Country.Population > 10000000; +--enable_view_protocol + set join_buffer_size=256; show variables like 'join_buffer_size'; diff --git a/mysql-test/main/join_cache_cardinality.result b/mysql-test/main/join_cache_cardinality.result new file mode 100644 index 0000000000000..df7f29d775370 --- /dev/null +++ b/mysql-test/main/join_cache_cardinality.result @@ -0,0 +1,105 @@ +create table t1 (a int, b int, c int); +insert into t1 select seq,seq/2, seq/4 from seq_1_to_100; +create table t2 (a int, b int, c int); +insert into t2 select seq, seq/2, seq/4 from seq_1_to_200; +analyze table t1,t2 persistent for all; +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 optimizer_trace=1; +set join_cache_level=6; +set optimizer_switch='hash_join_cardinality=on'; +explain select * +from t1, t2 +where t1.a=t2.a and t1.a=t2.b and t1.c=t2.c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 100 Using where +1 SIMPLE t2 hash_ALL NULL #hash#$hj 15 test.t1.a,test.t1.a,test.t1.c 200 Using where; Using join buffer (flat, BNLH join) +set @json= (select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@json, '$**.hash_join_cardinality')) as JS; +JS +[ + { + "hash_join_columns": + [ + { + "field": "a", + "avg_frequency": 1 + }, + { + "field": "b", + "avg_frequency": 2 + }, + { + "field": "c", + "avg_frequency": 3.9216 + } + ], + "rows": 1 + } +] +select json_detailed(json_extract(@json, '$**.rest_of_plan[*].rows_for_plan')) +as ROWS_FOR_PLAN; +ROWS_FOR_PLAN +[100] +explain select * +from t1, t2 where t1.c=t2.c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 100 Using where +1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.c 200 Using where; Using join buffer (flat, BNLH join) +set @json= (select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@json, '$**.hash_join_cardinality')) as JS; +JS +[ + { + "hash_join_columns": + [ + { + "field": "c", + "avg_frequency": 3.9216 + } + ], + "rows": 3.9216 + } +] +select json_detailed(json_extract(@json, '$**.rest_of_plan[*].rows_for_plan')) +as ROWS_FOR_PLAN; +ROWS_FOR_PLAN +[392.16] +explain select * +from t1 straight_join t2 where t1.c=t2.c and t2.a<30; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 100 Using where +1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.c 200 Using where; Using join buffer (flat, BNLH join) +set @json= (select trace from information_schema.optimizer_trace); +# Note that rows is the same: +select json_detailed(json_extract(@json, '$**.hash_join_cardinality')) as JS; +JS +[ + { + "hash_join_columns": + [ + { + "field": "c", + "avg_frequency": 3.9216 + } + ], + "rows": 3.9216 + } +] +# Despite available selectivity: +select json_detailed(json_extract(@json, '$**.selectivity_for_columns')) as JS; +JS +[ + [ + { + "column_name": "a", + "ranges": + ["NULL < a < 30"], + "selectivity_from_histogram": 0.145 + } + ] +] +drop table t1,t2; diff --git a/mysql-test/main/join_cache_cardinality.test b/mysql-test/main/join_cache_cardinality.test new file mode 100644 index 0000000000000..b178810b80764 --- /dev/null +++ b/mysql-test/main/join_cache_cardinality.test @@ -0,0 +1,41 @@ +--source include/have_sequence.inc + +# Embedded doesn't have optimizer trace: +--source include/not_embedded.inc + +create table t1 (a int, b int, c int); +insert into t1 select seq,seq/2, seq/4 from seq_1_to_100; + +create table t2 (a int, b int, c int); +insert into t2 select seq, seq/2, seq/4 from seq_1_to_200; + +analyze table t1,t2 persistent for all; + +set optimizer_trace=1; +set join_cache_level=6; +set optimizer_switch='hash_join_cardinality=on'; +explain select * +from t1, t2 +where t1.a=t2.a and t1.a=t2.b and t1.c=t2.c; + +set @json= (select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@json, '$**.hash_join_cardinality')) as JS; +select json_detailed(json_extract(@json, '$**.rest_of_plan[*].rows_for_plan')) +as ROWS_FOR_PLAN; + +explain select * +from t1, t2 where t1.c=t2.c; +set @json= (select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@json, '$**.hash_join_cardinality')) as JS; +select json_detailed(json_extract(@json, '$**.rest_of_plan[*].rows_for_plan')) +as ROWS_FOR_PLAN; + +explain select * +from t1 straight_join t2 where t1.c=t2.c and t2.a<30; +set @json= (select trace from information_schema.optimizer_trace); +--echo # Note that rows is the same: +select json_detailed(json_extract(@json, '$**.hash_join_cardinality')) as JS; + +--echo # Despite available selectivity: +select json_detailed(json_extract(@json, '$**.selectivity_for_columns')) as JS; +drop table t1,t2; diff --git a/mysql-test/main/join_nested.result b/mysql-test/main/join_nested.result index b323190d8d5ef..4db15f2f5a8a7 100644 --- a/mysql-test/main/join_nested.result +++ b/mysql-test/main/join_nested.result @@ -916,11 +916,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t3`.`b` = `test`.`t4`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null) INSERT INTO t4 VALUES (-3,12,0), (-4,13,0), (-1,11,0), (-3,11,0), (-5,15,0); INSERT INTO t5 VALUES (-3,11,0), (-2,12,0), (-3,13,0), (-4,12,0); CREATE INDEX idx_b ON t4(b); @@ -1476,9 +1476,9 @@ join t5 on t5.a=t3.b) on t3.a=t2.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL X 1 SIMPLE t3 ref a a 5 test.t2.b X Using where -1 SIMPLE t5 ref a a 5 test.t3.b X -1 SIMPLE t4 ref a a 5 test.t5.a X Using where +1 SIMPLE t4 ref a a 5 test.t3.b X Using where 1 SIMPLE t6 ref a a 5 test.t4.b X +1 SIMPLE t5 ref a a 5 test.t3.b X drop table t0, t1, t2, t3, t4, t5, t6, t7; create table t1 (a int); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -1999,3 +1999,55 @@ Note 1003 select `test`.`t3`.`pk` AS `pk`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.` DROP TABLE t1,t2,t3; set join_cache_level= @save_join_cache_level; set optimizer_switch=@save_optimizer_switch; +# +# MDEV-27624: Nested left joins with not_exists optimization +# for most inner left join +# +set @save_join_cache_level= @@join_cache_level; +CREATE TABLE t1 (a INT NOT NULL, b INT, c INT); +INSERT INTO t1 VALUES (1,1,1), (1,2,1), (1,3,1); +CREATE TABLE t2(a INT NOT NULL); +INSERT INTO t2 VALUES (1), (2); +CREATE TABLE t3(a INT not null, b INT); +INSERT INTO t3 VALUES (1, 1), (2, 1), (3, 1); +set join_cache_level = 0; +EXPLAIN SELECT * +FROM t1 +LEFT JOIN +( t2 LEFT JOIN t3 ON t2.a = t3.b ) +ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL) +WHERE t1.c = 1 AND t3.a is NULL; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Not exists +SELECT * +FROM t1 +LEFT JOIN +( t2 LEFT JOIN t3 ON t2.a = t3.b ) +ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL) +WHERE t1.c = 1 AND t3.a is NULL; +a b c a a b +1 3 1 NULL NULL NULL +set join_cache_level = 2; +EXPLAIN SELECT * +FROM t1 +LEFT JOIN +( t2 LEFT JOIN t3 ON t2.a = t3.b ) +ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL) +WHERE t1.c = 1 AND t3.a is NULL; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Not exists; Using join buffer (incremental, BNL join) +SELECT * +FROM t1 +LEFT JOIN +( t2 LEFT JOIN t3 ON t2.a = t3.b ) +ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL) +WHERE t1.c = 1 AND t3.a is NULL; +a b c a a b +1 3 1 NULL NULL NULL +DROP TABLE t1, t2, t3; +set join_cache_level= @save_join_cache_level; +# end of 10.3 tests diff --git a/mysql-test/main/join_nested.test b/mysql-test/main/join_nested.test index 864218371f4ae..8ac6b5a1d6ba1 100644 --- a/mysql-test/main/join_nested.test +++ b/mysql-test/main/join_nested.test @@ -1314,6 +1314,9 @@ DROP TABLE t1,t2,t3,t4,t5; --echo # MDEV-7992: Nested left joins + 'not exists' optimization --echo # +#view protocol gives different query plan (it doesnt' contain database name) +--disable_view_protocol + CREATE TABLE t1( K1 INT PRIMARY KEY, Name VARCHAR(15) @@ -1379,6 +1382,8 @@ eval EXPLAIN EXTENDED $q2; DROP VIEW v1; DROP TABLE t1,t2; +--enable_view_protocol + set optimizer_search_depth= @tmp_mdev621; --echo # @@ -1414,3 +1419,41 @@ DROP TABLE t1,t2,t3; set join_cache_level= @save_join_cache_level; set optimizer_switch=@save_optimizer_switch; + +--echo # +--echo # MDEV-27624: Nested left joins with not_exists optimization +--echo # for most inner left join +--echo # + +set @save_join_cache_level= @@join_cache_level; + +CREATE TABLE t1 (a INT NOT NULL, b INT, c INT); +INSERT INTO t1 VALUES (1,1,1), (1,2,1), (1,3,1); + +CREATE TABLE t2(a INT NOT NULL); +INSERT INTO t2 VALUES (1), (2); + +CREATE TABLE t3(a INT not null, b INT); +INSERT INTO t3 VALUES (1, 1), (2, 1), (3, 1); + +let $q= +SELECT * +FROM t1 + LEFT JOIN + ( t2 LEFT JOIN t3 ON t2.a = t3.b ) + ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL) +WHERE t1.c = 1 AND t3.a is NULL; + +set join_cache_level = 0; +eval EXPLAIN $q; +eval $q; + +set join_cache_level = 2; +eval EXPLAIN $q; +eval $q; + +DROP TABLE t1, t2, t3; + +set join_cache_level= @save_join_cache_level; + +--echo # end of 10.3 tests diff --git a/mysql-test/main/join_nested_jcl6.result b/mysql-test/main/join_nested_jcl6.result index f7d0242244dfe..260813823682b 100644 --- a/mysql-test/main/join_nested_jcl6.result +++ b/mysql-test/main/join_nested_jcl6.result @@ -925,11 +925,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) 1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: -Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t3`.`b` = `test`.`t4`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null) +Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null) INSERT INTO t4 VALUES (-3,12,0), (-4,13,0), (-1,11,0), (-3,11,0), (-5,15,0); INSERT INTO t5 VALUES (-3,11,0), (-2,12,0), (-3,13,0), (-4,12,0); CREATE INDEX idx_b ON t4(b); @@ -1027,8 +1027,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan 1 SIMPLE t5 ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t4`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t8`.`a` >= 0 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`a` > 0 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null) @@ -1485,9 +1485,9 @@ join t5 on t5.a=t3.b) on t3.a=t2.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL X 1 SIMPLE t3 ref a a 5 test.t2.b X Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t5 ref a a 5 test.t3.b X Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t4 ref a a 5 test.t5.a X Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t4 ref a a 5 test.t3.b X Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan 1 SIMPLE t6 ref a a 5 test.t4.b X Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t5 ref a a 5 test.t3.b X Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan drop table t0, t1, t2, t3, t4, t5, t6, t7; create table t1 (a int); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -2008,6 +2008,58 @@ Note 1003 select `test`.`t3`.`pk` AS `pk`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.` DROP TABLE t1,t2,t3; set join_cache_level= @save_join_cache_level; set optimizer_switch=@save_optimizer_switch; +# +# MDEV-27624: Nested left joins with not_exists optimization +# for most inner left join +# +set @save_join_cache_level= @@join_cache_level; +CREATE TABLE t1 (a INT NOT NULL, b INT, c INT); +INSERT INTO t1 VALUES (1,1,1), (1,2,1), (1,3,1); +CREATE TABLE t2(a INT NOT NULL); +INSERT INTO t2 VALUES (1), (2); +CREATE TABLE t3(a INT not null, b INT); +INSERT INTO t3 VALUES (1, 1), (2, 1), (3, 1); +set join_cache_level = 0; +EXPLAIN SELECT * +FROM t1 +LEFT JOIN +( t2 LEFT JOIN t3 ON t2.a = t3.b ) +ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL) +WHERE t1.c = 1 AND t3.a is NULL; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Not exists +SELECT * +FROM t1 +LEFT JOIN +( t2 LEFT JOIN t3 ON t2.a = t3.b ) +ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL) +WHERE t1.c = 1 AND t3.a is NULL; +a b c a a b +1 3 1 NULL NULL NULL +set join_cache_level = 2; +EXPLAIN SELECT * +FROM t1 +LEFT JOIN +( t2 LEFT JOIN t3 ON t2.a = t3.b ) +ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL) +WHERE t1.c = 1 AND t3.a is NULL; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Not exists; Using join buffer (incremental, BNL join) +SELECT * +FROM t1 +LEFT JOIN +( t2 LEFT JOIN t3 ON t2.a = t3.b ) +ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL) +WHERE t1.c = 1 AND t3.a is NULL; +a b c a a b +1 3 1 NULL NULL NULL +DROP TABLE t1, t2, t3; +set join_cache_level= @save_join_cache_level; +# end of 10.3 tests CREATE TABLE t5 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b)); CREATE TABLE t6 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b)); CREATE TABLE t7 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b)); @@ -2033,7 +2085,7 @@ ON t6.b >= 2 AND t5.b=t7.b AND (t8.a > 0 OR t8.c IS NULL) AND t6.a>0 AND t7.a>0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t5 ALL NULL NULL NULL NULL 3 -1 SIMPLE t7 ref|filter PRIMARY,b_i b_i|PRIMARY 5|4 test.t5.b 2 (29%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter +1 SIMPLE t7 range PRIMARY,b_i PRIMARY 4 NULL 2 Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) 1 SIMPLE t6 range|filter PRIMARY,b_i PRIMARY|b_i 4|5 NULL 3 (86%) Using where; Rowid-ordered scan; Using join buffer (incremental, BNL join); Using rowid filter 1 SIMPLE t8 ref b_i b_i 5 test.t5.b 2 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b diff --git a/mysql-test/main/join_outer.result b/mysql-test/main/join_outer.result index 522b668e07b14..fde7689b1428d 100644 --- a/mysql-test/main/join_outer.result +++ b/mysql-test/main/join_outer.result @@ -1,4 +1,5 @@ drop table if exists t0,t1,t2,t3,t4,t5; +drop view if exists v0,v1,v2,v3; SET @org_optimizer_switch=@@optimizer_switch; SET optimizer_switch=ifnull(@optimizer_switch_for_join_outer_test,'outer_join_with_cache=off'); set join_cache_level=1; @@ -2825,5 +2826,89 @@ WHERE t3.pk IN (2); 1 drop view v4; drop table t1,t2,t3,t4; +# +# MDEV-28602 Wrong result with outer join, merged derived table and view +# +create table t1 ( +Election int(10) unsigned NOT NULL +); +insert into t1 (Election) values (1); +create table t2 ( +VoteID int(10), +ElectionID int(10), +UserID int(10) +); +insert into t2 (ElectionID, UserID) values (2, 30), (3, 30); +create view v1 as select * from t1 +left join ( select 'Y' AS Voted, ElectionID from t2 ) AS T +on T.ElectionID = t1.Election +limit 9; +select * from v1; +Election Voted ElectionID +1 NULL NULL +drop table t1, t2; +drop view v1; +# +# and another contrived example showing a bit of heirarchy +# +create table t10 (a int); +create table t20 (b int); +insert into t10 values (1),(2); +insert into t20 values (1),(3); +create view v10 as select *, 'U' as u from t10 left join (select 'Y' as y, t20.b from t20) dt1 on t10.a= dt1.b limit 3; +create table t30 (c int); +insert into t30 values (1),(3); +create view v20 as select * from t30 left join (select 'X' as x, v10.u, v10.y, v10.b from v10) dt2 on t30.c=dt2.b limit 6; +select * from v20 limit 9; +c x u y b +1 X U Y 1 +3 NULL NULL NULL NULL +drop view v10, v20; +drop table t10, t20, t30; +# +# More complex testcase +# +create table t2 (b int); +insert into t2 values (3),(7),(1); +create table t3 (c int); +insert into t3 values (3),(1); +create table t1 (a int); +insert into t1 values (1),(2),(7),(1); +select * from +( +select * from +(select 'Z' as z, t1.a from t1) dt1 +left join +(select 'Y' as y, t2.b from t2) dt2 +left join +(select 'X' as x, t3.c from t3) dt3 +on dt2.b=dt3.c +on dt1.a=dt2.b +limit 9 +) dt; +z a y b x c +Z 1 Y 1 X 1 +Z 2 NULL NULL NULL NULL +Z 7 Y 7 NULL NULL +Z 1 Y 1 X 1 +create view v3(x,c) as select * from (select 'X' as x, t3.c from t3) dt3; +create view v2(y,b) as select * from (select 'Y' as y, t2.b from t2) dt2; +create view v0(y,b,x,c) as select * from v2 left join v3 on v2.b=v3.c; +create view v1 as select 'Z' as z, t1.a, v0.* from t1 left join v0 on t1.a=v0.b limit 9; +select * from v1; +z a y b x c +Z 1 Y 1 X 1 +Z 2 NULL NULL NULL NULL +Z 7 Y 7 NULL NULL +Z 1 Y 1 X 1 +set statement join_cache_level=0 for +select * from v1; +z a y b x c +Z 1 Y 1 X 1 +Z 2 NULL NULL NULL NULL +Z 7 Y 7 NULL NULL +Z 1 Y 1 X 1 +drop view v0, v1, v2, v3; +drop table t1, t2, t3; # end of 10.3 tests SET optimizer_switch=@org_optimizer_switch; diff --git a/mysql-test/main/join_outer.test b/mysql-test/main/join_outer.test index 82c7b265b562e..5e1e83e404953 100644 --- a/mysql-test/main/join_outer.test +++ b/mysql-test/main/join_outer.test @@ -6,6 +6,7 @@ --disable_warnings drop table if exists t0,t1,t2,t3,t4,t5; +drop view if exists v0,v1,v2,v3; --enable_warnings SET @org_optimizer_switch=@@optimizer_switch; @@ -1368,7 +1369,7 @@ drop table t1,t2,t3,t4; --echo # Bug#57024: Poor performance when conjunctive condition over the outer --echo # table is used in the on condition of an outer join --echo # - +--disable_view_protocol create table t1 (a int); insert into t1 values (NULL), (NULL), (NULL), (NULL); insert into t1 select * from t1; @@ -1409,6 +1410,7 @@ select sum(t3.b) from t2 left join t3 on t3.a=t2.a and t2.a <> 10; show status like "handler_read%"; drop table t1,t2,t3; +--enable_view_protocol --echo # --echo # Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field @@ -1887,6 +1889,9 @@ drop table t1,t2,t3; --echo # MDEV-11958: LEFT JOIN with stored routine produces incorrect result --echo # +#view cannot contains duplicate column name +--disable_view_protocol + CREATE TABLE t (x INT); INSERT INTO t VALUES(1),(NULL); CREATE FUNCTION f (val INT, ret INT) RETURNS INT DETERMINISTIC RETURN IFNULL(val, ret); @@ -1909,6 +1914,7 @@ SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0) FROM t t1 LEFT JOIN t t2 ON t1.x = t2.x WHERE f(t2.x,0)=0; +--enable_view_protocol drop function f; drop table t; @@ -2336,6 +2342,90 @@ WHERE t3.pk IN (2); drop view v4; drop table t1,t2,t3,t4; +--echo # +--echo # MDEV-28602 Wrong result with outer join, merged derived table and view +--echo # + +create table t1 ( + Election int(10) unsigned NOT NULL +); + +insert into t1 (Election) values (1); + +create table t2 ( + VoteID int(10), + ElectionID int(10), + UserID int(10) +); + +insert into t2 (ElectionID, UserID) values (2, 30), (3, 30); +create view v1 as select * from t1 + left join ( select 'Y' AS Voted, ElectionID from t2 ) AS T + on T.ElectionID = t1.Election +limit 9; +# limit X causes merge algorithm select as opposed to temp table +select * from v1; +drop table t1, t2; +drop view v1; + +--echo # +--echo # and another contrived example showing a bit of heirarchy +--echo # +create table t10 (a int); +create table t20 (b int); +insert into t10 values (1),(2); +insert into t20 values (1),(3); +create view v10 as select *, 'U' as u from t10 left join (select 'Y' as y, t20.b from t20) dt1 on t10.a= dt1.b limit 3; +create table t30 (c int); +insert into t30 values (1),(3); +create view v20 as select * from t30 left join (select 'X' as x, v10.u, v10.y, v10.b from v10) dt2 on t30.c=dt2.b limit 6; +select * from v20 limit 9; +drop view v10, v20; +drop table t10, t20, t30; + +--echo # +--echo # More complex testcase +--echo # +create table t2 (b int); +insert into t2 values (3),(7),(1); +create table t3 (c int); +insert into t3 values (3),(1); +create table t1 (a int); +insert into t1 values (1),(2),(7),(1); + +select * from +( + select * from + (select 'Z' as z, t1.a from t1) dt1 + left join + (select 'Y' as y, t2.b from t2) dt2 + left join + (select 'X' as x, t3.c from t3) dt3 + on dt2.b=dt3.c + on dt1.a=dt2.b + limit 9 +) dt; + +## Same as dt3 above +create view v3(x,c) as select * from (select 'X' as x, t3.c from t3) dt3; + +## Same as dt2 above +create view v2(y,b) as select * from (select 'Y' as y, t2.b from t2) dt2; + +## Same as (...) in the "... dt1 left join (...)" above +create view v0(y,b,x,c) as select * from v2 left join v3 on v2.b=v3.c; + +# Same as above select statement +create view v1 as select 'Z' as z, t1.a, v0.* from t1 left join v0 on t1.a=v0.b limit 9; + +select * from v1; + +set statement join_cache_level=0 for +select * from v1; + +drop view v0, v1, v2, v3; +drop table t1, t2, t3; + --echo # end of 10.3 tests SET optimizer_switch=@org_optimizer_switch; diff --git a/mysql-test/main/join_outer_jcl6.result b/mysql-test/main/join_outer_jcl6.result index b579cfc6ac07d..cd13a4c48a675 100644 --- a/mysql-test/main/join_outer_jcl6.result +++ b/mysql-test/main/join_outer_jcl6.result @@ -6,6 +6,7 @@ set @@join_cache_level=6; set @optimizer_switch_for_join_outer_test=@@optimizer_switch; set @join_cache_level_for_join_outer_test=@@join_cache_level; drop table if exists t0,t1,t2,t3,t4,t5; +drop view if exists v0,v1,v2,v3; SET @org_optimizer_switch=@@optimizer_switch; SET optimizer_switch=ifnull(@optimizer_switch_for_join_outer_test,'outer_join_with_cache=off'); set join_cache_level=@join_cache_level_for_join_outer_test; @@ -2832,5 +2833,89 @@ WHERE t3.pk IN (2); 1 drop view v4; drop table t1,t2,t3,t4; +# +# MDEV-28602 Wrong result with outer join, merged derived table and view +# +create table t1 ( +Election int(10) unsigned NOT NULL +); +insert into t1 (Election) values (1); +create table t2 ( +VoteID int(10), +ElectionID int(10), +UserID int(10) +); +insert into t2 (ElectionID, UserID) values (2, 30), (3, 30); +create view v1 as select * from t1 +left join ( select 'Y' AS Voted, ElectionID from t2 ) AS T +on T.ElectionID = t1.Election +limit 9; +select * from v1; +Election Voted ElectionID +1 NULL NULL +drop table t1, t2; +drop view v1; +# +# and another contrived example showing a bit of heirarchy +# +create table t10 (a int); +create table t20 (b int); +insert into t10 values (1),(2); +insert into t20 values (1),(3); +create view v10 as select *, 'U' as u from t10 left join (select 'Y' as y, t20.b from t20) dt1 on t10.a= dt1.b limit 3; +create table t30 (c int); +insert into t30 values (1),(3); +create view v20 as select * from t30 left join (select 'X' as x, v10.u, v10.y, v10.b from v10) dt2 on t30.c=dt2.b limit 6; +select * from v20 limit 9; +c x u y b +1 X U Y 1 +3 NULL NULL NULL NULL +drop view v10, v20; +drop table t10, t20, t30; +# +# More complex testcase +# +create table t2 (b int); +insert into t2 values (3),(7),(1); +create table t3 (c int); +insert into t3 values (3),(1); +create table t1 (a int); +insert into t1 values (1),(2),(7),(1); +select * from +( +select * from +(select 'Z' as z, t1.a from t1) dt1 +left join +(select 'Y' as y, t2.b from t2) dt2 +left join +(select 'X' as x, t3.c from t3) dt3 +on dt2.b=dt3.c +on dt1.a=dt2.b +limit 9 +) dt; +z a y b x c +Z 1 Y 1 X 1 +Z 1 Y 1 X 1 +Z 7 Y 7 NULL NULL +Z 2 NULL NULL NULL NULL +create view v3(x,c) as select * from (select 'X' as x, t3.c from t3) dt3; +create view v2(y,b) as select * from (select 'Y' as y, t2.b from t2) dt2; +create view v0(y,b,x,c) as select * from v2 left join v3 on v2.b=v3.c; +create view v1 as select 'Z' as z, t1.a, v0.* from t1 left join v0 on t1.a=v0.b limit 9; +select * from v1; +z a y b x c +Z 1 Y 1 X 1 +Z 1 Y 1 X 1 +Z 7 Y 7 NULL NULL +Z 2 NULL NULL NULL NULL +set statement join_cache_level=0 for +select * from v1; +z a y b x c +Z 1 Y 1 X 1 +Z 2 NULL NULL NULL NULL +Z 7 Y 7 NULL NULL +Z 1 Y 1 X 1 +drop view v0, v1, v2, v3; +drop table t1, t2, t3; # end of 10.3 tests SET optimizer_switch=@org_optimizer_switch; diff --git a/mysql-test/main/json_debug_nonembedded.result b/mysql-test/main/json_debug_nonembedded.result new file mode 100644 index 0000000000000..6af88191d974d --- /dev/null +++ b/mysql-test/main/json_debug_nonembedded.result @@ -0,0 +1,13 @@ +# +# Beginning of 10.6 test +# +# MDEV-28762: recursive call of some json functions without stack control +# +SET @saved_debug= @@debug_dbug; +SET @@debug_dbug='+d,json_check_min_stack_requirement'; +SELECT * from JSON_TABLE('[{"a": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}]', '$[*]' COLUMNS( a INT PATH '$.a')) as tt; +ERROR HY000: Thread stack overrun: 'used bytes' used of a 'available' byte stack, and 'X' bytes needed. Consider increasing the thread_stack system variable. +SET @@debug_dbug= @saved_debug; +# +# End of 10.6 tests +# diff --git a/mysql-test/main/json_debug_nonembedded.test b/mysql-test/main/json_debug_nonembedded.test new file mode 100644 index 0000000000000..cecb9f1f6ed5c --- /dev/null +++ b/mysql-test/main/json_debug_nonembedded.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +--source include/have_debug.inc + +--echo # +--echo # Beginning of 10.6 test +--echo # +--echo # MDEV-28762: recursive call of some json functions without stack control +--echo # + +SET @saved_debug= @@debug_dbug; + +SET @@debug_dbug='+d,json_check_min_stack_requirement'; + +--replace_regex /overrun: [0-9]* bytes used of a [0-9]* byte stack, and [0-9]* bytes needed/overrun: 'used bytes' used of a 'available' byte stack, and 'X' bytes needed/ +--error ER_STACK_OVERRUN_NEED_MORE +SELECT * from JSON_TABLE('[{"a": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}]', '$[*]' COLUMNS( a INT PATH '$.a')) as tt; + +SET @@debug_dbug= @saved_debug; + +--echo # +--echo # End of 10.6 tests +--echo # diff --git a/mysql-test/main/json_equals.test b/mysql-test/main/json_equals.test index 904d8a3f67dda..943906e6f0122 100644 --- a/mysql-test/main/json_equals.test +++ b/mysql-test/main/json_equals.test @@ -15,11 +15,14 @@ select json_equals('{"a":[1, 2, 3]}', '{"a":[1, 2, 3, 4]}'); select json_equals('{"a":[1, 2, 3]}', '{"a":[1, 2, 3]}'); +#enable after fix MDEV-27871 +--disable_view_protocol select json_equals('{"țanțoș":[1, 2, "ț", {"some uâ߀":"uâßr"}]}', '{"țanțoș":[1, 2, "ț", {"some uâ߀":"uâßr"}]}'); select json_equals('{"a" : [0.123456789123456789], "b" : [1, 2, 3]}', '{"b" : [1, 2, 3], "a" : [0.123456789123456789]}'); +--enable_view_protocol --echo # --echo # Test max json depth for json_equals. diff --git a/mysql-test/main/json_normalize.result b/mysql-test/main/json_normalize.result index f88cadad18923..b1363ea909959 100644 --- a/mysql-test/main/json_normalize.result +++ b/mysql-test/main/json_normalize.result @@ -4,7 +4,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`json`)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('{ }'), ('[ ]'), diff --git a/mysql-test/main/key.result b/mysql-test/main/key.result index 5d84068d8af9f..2e2c8d894f0fc 100644 --- a/mysql-test/main/key.result +++ b/mysql-test/main/key.result @@ -1,4 +1,3 @@ -drop table if exists t1,t2,t3; SET SQL_WARNINGS=1; CREATE TABLE t1 ( ID CHAR(32) NOT NULL, @@ -242,11 +241,11 @@ create table t1 (c varchar(30) character set utf8, t text character set utf8, un show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` varchar(30) CHARACTER SET utf8mb3 DEFAULT NULL, - `t` text CHARACTER SET utf8mb3 DEFAULT NULL, + `c` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `t` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, UNIQUE KEY `c` (`c`(2)), UNIQUE KEY `t` (`t`(3)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert t1 values ('cccc', 'tttt'), (0xD0B1212223D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1212223D0B1D0B1D0B1D0B1), (0xD0B1222123D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1222123D0B1D0B1D0B1D0B1); @@ -345,7 +344,7 @@ t1 CREATE TABLE `t1` ( `i2` int(11) NOT NULL, UNIQUE KEY `i1idx` (`i1`), UNIQUE KEY `i2idx` (`i2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 ( c1 int, @@ -371,7 +370,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, KEY `a` (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify b varchar(20); show create table t1; Table Create Table @@ -379,7 +378,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(20) DEFAULT NULL, KEY `a` (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify a varchar(20); show create table t1; Table Create Table @@ -387,7 +386,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(20) DEFAULT NULL, `b` varchar(20) DEFAULT NULL, KEY `a` (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int not null primary key, b varchar(20) not null unique); desc t1; @@ -444,7 +443,7 @@ t1 CREATE TABLE `t1` ( KEY `i3` (`c3`), KEY `i5` (`c1`,`c2`,`c3`,`c4`), KEY `c2` (`c2`,`c4`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 drop index c1; alter table t1 add index (c1); Warnings: @@ -483,7 +482,7 @@ t1 CREATE TABLE `t1` ( KEY `i2` (`c2`), KEY `i4` (`c4`), KEY `c2` (`c2`(4),`c3`(7)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values(1, 'a', 'a', NULL); insert into t1 values(1, 'b', 'b', NULL); alter table t1 drop index i3, drop index i2, drop index i1; @@ -555,7 +554,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `cc` (`c`), UNIQUE KEY `bb` (`b`(1)), KEY `aa` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(a int not null, key aa(a), b char(10) not null, unique key bb(b(1)), @@ -580,7 +579,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `cc` (`c`), UNIQUE KEY `bb` (`b`(1)), KEY `aa` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; End of 5.0 tests DROP TABLE IF EXISTS t1; @@ -685,3 +684,8 @@ c c 9 10 10 11 drop table t1,t2; +# +# MDEV-13756 Implement descending index: KEY (a DESC, b ASC) +# +create table t1 (a int, b int, key(a), key(a desc)); +drop table t1; diff --git a/mysql-test/main/key.test b/mysql-test/main/key.test index 4e3e02c8adda4..29e08b8834a0e 100644 --- a/mysql-test/main/key.test +++ b/mysql-test/main/key.test @@ -1,6 +1,3 @@ ---disable_warnings -drop table if exists t1,t2,t3; ---enable_warnings --source include/have_sequence.inc SET SQL_WARNINGS=1; @@ -238,7 +235,8 @@ drop table t1; # # UNIQUE prefix keys and multi-byte charsets # - +#enable view protocol after fix MDEV-27945 +--disable_view_protocol create table t1 (c varchar(30) character set utf8, t text character set utf8, unique (c(2)), unique (t(3))) engine=myisam; show create table t1; insert t1 values ('cccc', 'tttt'), @@ -257,6 +255,7 @@ select t from t1 where t='tttt'; select c from t1 where c=0xD0B1212223D0B1D0B1D0B1D0B1D0B1; select t from t1 where t=0xD0B1D0B1212223D0B1D0B1D0B1D0B1; drop table t1; +--enable_view_protocol # # BUG#6151 - myisam index corruption @@ -603,3 +602,9 @@ EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; drop table t1,t2; + +--echo # +--echo # MDEV-13756 Implement descending index: KEY (a DESC, b ASC) +--echo # +create table t1 (a int, b int, key(a), key(a desc)); +drop table t1; diff --git a/mysql-test/main/key_cache.result b/mysql-test/main/key_cache.result index c8bdc97938756..4a5df2da65dd3 100644 --- a/mysql-test/main/key_cache.result +++ b/mysql-test/main/key_cache.result @@ -834,3 +834,25 @@ set global keycache2.key_buffer_size=0; set global key_buffer_size=@save_key_buffer_size; set global key_cache_segments=@save_key_cache_segments; set global key_cache_file_hash_size=@save_key_cache_file_hash_size; +# +# SIGSEGV in flush_all_key_blocks when changing +# key_buffer_size / ASAN: heap-use-after-free in flush_all_key_blocks +# +SET GLOBAL keycache1.key_cache_segments=7; +SET GLOBAL keycache1.key_buffer_size=1*1024*1024; +SET GLOBAL keycache1.key_buffer_size=0; +SET GLOBAL keycache1.key_buffer_size=128*1024; +create table t1 (p int primary key, a char(10)) delay_key_write=1; +cache index t1 key (`primary`) in keycache1; +Table Op Msg_type Msg_text +test.t1 assign_to_keycache status OK +insert into t1 values (1, 'qqqq'), (11, 'yyyy'); +select * from t1; +p a +1 qqqq +11 yyyy +drop table t1; +SET GLOBAL keycache1.key_buffer_size=0; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/key_cache.test b/mysql-test/main/key_cache.test index 50305d499b3d9..9bd57f017f07a 100644 --- a/mysql-test/main/key_cache.test +++ b/mysql-test/main/key_cache.test @@ -538,3 +538,24 @@ set global key_cache_segments=@save_key_cache_segments; set global key_cache_file_hash_size=@save_key_cache_file_hash_size; # End of 5.2 tests + +--echo # +--echo # SIGSEGV in flush_all_key_blocks when changing +--echo # key_buffer_size / ASAN: heap-use-after-free in flush_all_key_blocks +--echo # + +SET GLOBAL keycache1.key_cache_segments=7; +SET GLOBAL keycache1.key_buffer_size=1*1024*1024; +SET GLOBAL keycache1.key_buffer_size=0; +SET GLOBAL keycache1.key_buffer_size=128*1024; +create table t1 (p int primary key, a char(10)) delay_key_write=1; +cache index t1 key (`primary`) in keycache1; +insert into t1 values (1, 'qqqq'), (11, 'yyyy'); +select * from t1; +drop table t1; +SET GLOBAL keycache1.key_buffer_size=0; + + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/keywords.result b/mysql-test/main/keywords.result index 2765c05b3cbe7..483a8f7e7e88e 100644 --- a/mysql-test/main/keywords.result +++ b/mysql-test/main/keywords.result @@ -391,3 +391,424 @@ END $$ compressed 1 +# +# Testing various keywords in various contexts +# +CREATE PROCEDURE p1(query TEXT, var TEXT) +BEGIN +DECLARE errmsg TEXT DEFAULT ''; +DECLARE CONTINUE HANDLER +FOR SQLEXCEPTION +BEGIN +GET DIAGNOSTICS CONDITION 1 errmsg = MESSAGE_TEXT; +SET errmsg= REPLACE(errmsg, 'You have an error in your SQL ', '..'); +SET errmsg= REPLACE(errmsg, '; check the manual that corresponds to your MariaDB server version for the right syntax to use', '..'); +END; +SET query=REPLACE(query, '$(VAR)', var); +EXECUTE IMMEDIATE query; +SELECT CONCAT(query, '; -- ', LEFT(COALESCE(errmsg,''),40)) AS `--------`; +END; +$$ +CREATE PROCEDURE p2(query TEXT) +BEGIN +FOR row IN (SELECT word FROM t1 ORDER BY category, word) +DO +CALL p1(query, row.word); +END FOR; +END; +$$ +CREATE TABLE t1 (word TEXT, category TEXT); +INSERT INTO t1 VALUES ('non_keyword', '00 Simple identifier'); +INSERT INTO t1 VALUES ('lpad', '01 Built-in native function'); +INSERT INTO t1 VALUES ('rpad', '01 Built-in native function'); +INSERT INTO t1 VALUES ('adddate', '02 function_call_nonkeyword'); +INSERT INTO t1 VALUES ('substr', '02 function_call_nonkeyword'); +INSERT INTO t1 VALUES ('substring', '02 function_call_nonkeyword'); +INSERT INTO t1 VALUES ('trim_oracle', '02 function_call_nonkeyword'); +INSERT INTO t1 VALUES ('ascii', '03 function_call_conflict'); +INSERT INTO t1 VALUES ('replace', '03 function_call_conflict'); +INSERT INTO t1 VALUES ('weight_string', '03 function_call_conflict'); +INSERT INTO t1 VALUES ('char', '04 function_call_keyword'); +INSERT INTO t1 VALUES ('trim', '04 function_call_keyword'); +INSERT INTO t1 VALUES ('year', '04 function_call_keyword'); +INSERT INTO t1 VALUES ('create', '05 Reserved keyword'); +CALL p2('SELECT @@$(VAR)'); +-------- +SELECT @@non_keyword; -- Unknown system variable 'non_keyword' +-------- +SELECT @@lpad; -- Unknown system variable 'lpad' +-------- +SELECT @@rpad; -- Unknown system variable 'rpad' +-------- +SELECT @@adddate; -- Unknown system variable 'adddate' +-------- +SELECT @@substr; -- Unknown system variable 'substr' +-------- +SELECT @@substring; -- Unknown system variable 'substring' +-------- +SELECT @@trim_oracle; -- Unknown system variable 'trim_oracle' +-------- +SELECT @@ascii; -- Unknown system variable 'ascii' +-------- +SELECT @@replace; -- ..syntax.. near 'replace' at line 1 +-------- +SELECT @@weight_string; -- Unknown system variable 'weight_string' +-------- +SELECT @@char; -- ..syntax.. near 'char' at line 1 +-------- +SELECT @@trim; -- Unknown system variable 'trim' +-------- +SELECT @@year; -- Unknown system variable 'year' +-------- +SELECT @@create; -- ..syntax.. near 'create' at line 1 +CALL p2('SELECT @@global.$(VAR)'); +-------- +SELECT @@global.non_keyword; -- Unknown system variable 'non_keyword' +-------- +SELECT @@global.lpad; -- Unknown system variable 'lpad' +-------- +SELECT @@global.rpad; -- Unknown system variable 'rpad' +-------- +SELECT @@global.adddate; -- Unknown system variable 'adddate' +-------- +SELECT @@global.substr; -- Unknown system variable 'substr' +-------- +SELECT @@global.substring; -- Unknown system variable 'substring' +-------- +SELECT @@global.trim_oracle; -- Unknown system variable 'trim_oracle' +-------- +SELECT @@global.ascii; -- Unknown system variable 'ascii' +-------- +SELECT @@global.replace; -- Unknown system variable 'replace' +-------- +SELECT @@global.weight_string; -- Unknown system variable 'weight_string' +-------- +SELECT @@global.char; -- Unknown system variable 'char' +-------- +SELECT @@global.trim; -- Unknown system variable 'trim' +-------- +SELECT @@global.year; -- Unknown system variable 'year' +-------- +SELECT @@global.create; -- Unknown system variable 'create' +CALL p2('SELECT @@global.$(VAR)()'); +-------- +SELECT @@global.non_keyword(); -- Unknown system variable 'non_keyword' +-------- +SELECT @@global.lpad(); -- Unknown system variable 'lpad' +-------- +SELECT @@global.rpad(); -- Unknown system variable 'rpad' +-------- +SELECT @@global.adddate(); -- Unknown system variable 'adddate' +-------- +SELECT @@global.substr(); -- Unknown system variable 'substr' +-------- +SELECT @@global.substring(); -- Unknown system variable 'substring' +-------- +SELECT @@global.trim_oracle(); -- Unknown system variable 'trim_oracle' +-------- +SELECT @@global.ascii(); -- Unknown system variable 'ascii' +-------- +SELECT @@global.replace(); -- Unknown system variable 'replace' +-------- +SELECT @@global.weight_string(); -- Unknown system variable 'weight_string' +-------- +SELECT @@global.char(); -- Unknown system variable 'char' +-------- +SELECT @@global.trim(); -- Unknown system variable 'trim' +-------- +SELECT @@global.year(); -- Unknown system variable 'year' +-------- +SELECT @@global.create(); -- Unknown system variable 'create' +CALL p2('SELECT $(VAR)()'); +-------- +SELECT non_keyword(); -- FUNCTION test.non_keyword does not exist +-------- +SELECT lpad(); -- Incorrect parameter count in the call to +-------- +SELECT rpad(); -- Incorrect parameter count in the call to +-------- +SELECT adddate(); -- ..syntax.. near ')' at line 1 +-------- +SELECT substr(); -- ..syntax.. near ')' at line 1 +-------- +SELECT substring(); -- ..syntax.. near ')' at line 1 +-------- +SELECT trim_oracle(); -- ..syntax.. near ')' at line 1 +-------- +SELECT ascii(); -- ..syntax.. near ')' at line 1 +-------- +SELECT replace(); -- ..syntax.. near ')' at line 1 +-------- +SELECT weight_string(); -- ..syntax.. near ')' at line 1 +-------- +SELECT char(); -- ..syntax.. near ')' at line 1 +-------- +SELECT trim(); -- ..syntax.. near ')' at line 1 +-------- +SELECT year(); -- ..syntax.. near ')' at line 1 +-------- +SELECT create(); -- ..syntax.. near 'create()' at line 1 +CALL p2('SELECT test.$(VAR)()'); +-------- +SELECT test.non_keyword(); -- FUNCTION test.non_keyword does not exist +-------- +SELECT test.lpad(); -- FUNCTION test.lpad does not exist +-------- +SELECT test.rpad(); -- FUNCTION test.rpad does not exist +-------- +SELECT test.adddate(); -- FUNCTION test.adddate does not exist. Ch +-------- +SELECT test.substr(); -- FUNCTION test.substr does not exist. Che +-------- +SELECT test.substring(); -- FUNCTION test.substring does not exist. +-------- +SELECT test.trim_oracle(); -- FUNCTION test.trim_oracle does not exist +-------- +SELECT test.ascii(); -- FUNCTION test.ascii does not exist. Chec +-------- +SELECT test.replace(); -- FUNCTION test.replace does not exist. Ch +-------- +SELECT test.weight_string(); -- FUNCTION test.weight_string does not exi +-------- +SELECT test.char(); -- FUNCTION test.char does not exist. Check +-------- +SELECT test.trim(); -- FUNCTION test.trim does not exist. Check +-------- +SELECT test.year(); -- FUNCTION test.year does not exist. Check +-------- +SELECT test.create(); -- FUNCTION test.create does not exist. Che +CALL p2('SELECT $(VAR) FROM t1'); +-------- +SELECT non_keyword FROM t1; -- Unknown column 'non_keyword' in 'field l +-------- +SELECT lpad FROM t1; -- Unknown column 'lpad' in 'field list' +-------- +SELECT rpad FROM t1; -- Unknown column 'rpad' in 'field list' +-------- +SELECT adddate FROM t1; -- Unknown column 'adddate' in 'field list' +-------- +SELECT substr FROM t1; -- Unknown column 'substr' in 'field list' +-------- +SELECT substring FROM t1; -- Unknown column 'substring' in 'field lis +-------- +SELECT trim_oracle FROM t1; -- Unknown column 'trim_oracle' in 'field l +-------- +SELECT ascii FROM t1; -- Unknown column 'ascii' in 'field list' +-------- +SELECT replace FROM t1; -- ..syntax.. near 'FROM t1' at line 1 +-------- +SELECT weight_string FROM t1; -- Unknown column 'weight_string' in 'field +-------- +SELECT char FROM t1; -- ..syntax.. near 'FROM t1' at line 1 +-------- +SELECT trim FROM t1; -- Unknown column 'trim' in 'field list' +-------- +SELECT year FROM t1; -- Unknown column 'year' in 'field list' +-------- +SELECT create FROM t1; -- ..syntax.. near 'create FROM t1' at line +CALL p2('SELECT t1.$(VAR) FROM t1'); +-------- +SELECT t1.non_keyword FROM t1; -- Unknown column 't1.non_keyword' in 'fiel +-------- +SELECT t1.lpad FROM t1; -- Unknown column 't1.lpad' in 'field list' +-------- +SELECT t1.rpad FROM t1; -- Unknown column 't1.rpad' in 'field list' +-------- +SELECT t1.adddate FROM t1; -- Unknown column 't1.adddate' in 'field li +-------- +SELECT t1.substr FROM t1; -- Unknown column 't1.substr' in 'field lis +-------- +SELECT t1.substring FROM t1; -- Unknown column 't1.substring' in 'field +-------- +SELECT t1.trim_oracle FROM t1; -- Unknown column 't1.trim_oracle' in 'fiel +-------- +SELECT t1.ascii FROM t1; -- Unknown column 't1.ascii' in 'field list +-------- +SELECT t1.replace FROM t1; -- Unknown column 't1.replace' in 'field li +-------- +SELECT t1.weight_string FROM t1; -- Unknown column 't1.weight_string' in 'fi +-------- +SELECT t1.char FROM t1; -- Unknown column 't1.char' in 'field list' +-------- +SELECT t1.trim FROM t1; -- Unknown column 't1.trim' in 'field list' +-------- +SELECT t1.year FROM t1; -- Unknown column 't1.year' in 'field list' +-------- +SELECT t1.create FROM t1; -- Unknown column 't1.create' in 'field lis +CALL p2('DROP TABLE $(VAR)'); +-------- +DROP TABLE non_keyword; -- Unknown table 'test.non_keyword' +-------- +DROP TABLE lpad; -- Unknown table 'test.lpad' +-------- +DROP TABLE rpad; -- Unknown table 'test.rpad' +-------- +DROP TABLE adddate; -- Unknown table 'test.adddate' +-------- +DROP TABLE substr; -- Unknown table 'test.substr' +-------- +DROP TABLE substring; -- Unknown table 'test.substring' +-------- +DROP TABLE trim_oracle; -- Unknown table 'test.trim_oracle' +-------- +DROP TABLE ascii; -- Unknown table 'test.ascii' +-------- +DROP TABLE replace; -- ..syntax.. near 'replace' at line 1 +-------- +DROP TABLE weight_string; -- Unknown table 'test.weight_string' +-------- +DROP TABLE char; -- ..syntax.. near 'char' at line 1 +-------- +DROP TABLE trim; -- Unknown table 'test.trim' +-------- +DROP TABLE year; -- Unknown table 'test.year' +-------- +DROP TABLE create; -- ..syntax.. near 'create' at line 1 +CALL p2('DROP TABLE test.$(VAR)'); +-------- +DROP TABLE test.non_keyword; -- Unknown table 'test.non_keyword' +-------- +DROP TABLE test.lpad; -- Unknown table 'test.lpad' +-------- +DROP TABLE test.rpad; -- Unknown table 'test.rpad' +-------- +DROP TABLE test.adddate; -- Unknown table 'test.adddate' +-------- +DROP TABLE test.substr; -- Unknown table 'test.substr' +-------- +DROP TABLE test.substring; -- Unknown table 'test.substring' +-------- +DROP TABLE test.trim_oracle; -- Unknown table 'test.trim_oracle' +-------- +DROP TABLE test.ascii; -- Unknown table 'test.ascii' +-------- +DROP TABLE test.replace; -- Unknown table 'test.replace' +-------- +DROP TABLE test.weight_string; -- Unknown table 'test.weight_string' +-------- +DROP TABLE test.char; -- Unknown table 'test.char' +-------- +DROP TABLE test.trim; -- Unknown table 'test.trim' +-------- +DROP TABLE test.year; -- Unknown table 'test.year' +-------- +DROP TABLE test.create; -- Unknown table 'test.create' +CALL p2('CREATE FUNCTION $(VAR)() RETURNS OOPS'); +-------- +CREATE FUNCTION non_keyword() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION lpad() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION rpad() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION adddate() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION substr() RETURNS OOPS; -- ..syntax.. near 'substr() RETURNS OOPS' +-------- +CREATE FUNCTION substring() RETURNS OOPS; -- ..syntax.. near 'substring() RETURNS OOP +-------- +CREATE FUNCTION trim_oracle() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION ascii() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION replace() RETURNS OOPS; -- ..syntax.. near 'replace() RETURNS OOPS' +-------- +CREATE FUNCTION weight_string() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION char() RETURNS OOPS; -- ..syntax.. near 'char() RETURNS OOPS' at +-------- +CREATE FUNCTION trim() RETURNS OOPS; -- ..syntax.. near 'trim() RETURNS OOPS' at +-------- +CREATE FUNCTION year() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION create() RETURNS OOPS; -- ..syntax.. near 'create() RETURNS OOPS' +CALL p2('CREATE FUNCTION test.$(VAR)() RETURNS OOPS'); +-------- +CREATE FUNCTION test.non_keyword() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION test.lpad() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION test.rpad() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION test.adddate() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION test.substr() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION test.substring() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION test.trim_oracle() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION test.ascii() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION test.replace() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION test.weight_string() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION test.char() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION test.trim() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION test.year() RETURNS OOPS; -- Unknown data type: 'OOPS' +-------- +CREATE FUNCTION test.create() RETURNS OOPS; -- Unknown data type: 'OOPS' +CALL p2('DROP FUNCTION $(VAR)'); +-------- +DROP FUNCTION non_keyword; -- FUNCTION test.non_keyword does not exist +-------- +DROP FUNCTION lpad; -- FUNCTION test.lpad does not exist +-------- +DROP FUNCTION rpad; -- FUNCTION test.rpad does not exist +-------- +DROP FUNCTION adddate; -- FUNCTION test.adddate does not exist +-------- +DROP FUNCTION substr; -- FUNCTION test.substr does not exist +-------- +DROP FUNCTION substring; -- FUNCTION test.substring does not exist +-------- +DROP FUNCTION trim_oracle; -- FUNCTION test.trim_oracle does not exist +-------- +DROP FUNCTION ascii; -- FUNCTION test.ascii does not exist +-------- +DROP FUNCTION replace; -- ..syntax.. near 'replace' at line 1 +-------- +DROP FUNCTION weight_string; -- FUNCTION test.weight_string does not exi +-------- +DROP FUNCTION char; -- ..syntax.. near 'char' at line 1 +-------- +DROP FUNCTION trim; -- FUNCTION test.trim does not exist +-------- +DROP FUNCTION year; -- FUNCTION test.year does not exist +-------- +DROP FUNCTION create; -- ..syntax.. near 'create' at line 1 +CALL p2('DROP FUNCTION test.$(VAR)'); +-------- +DROP FUNCTION test.non_keyword; -- FUNCTION test.non_keyword does not exist +-------- +DROP FUNCTION test.lpad; -- FUNCTION test.lpad does not exist +-------- +DROP FUNCTION test.rpad; -- FUNCTION test.rpad does not exist +-------- +DROP FUNCTION test.adddate; -- FUNCTION test.adddate does not exist +-------- +DROP FUNCTION test.substr; -- FUNCTION test.substr does not exist +-------- +DROP FUNCTION test.substring; -- FUNCTION test.substring does not exist +-------- +DROP FUNCTION test.trim_oracle; -- FUNCTION test.trim_oracle does not exist +-------- +DROP FUNCTION test.ascii; -- FUNCTION test.ascii does not exist +-------- +DROP FUNCTION test.replace; -- FUNCTION test.replace does not exist +-------- +DROP FUNCTION test.weight_string; -- FUNCTION test.weight_string does not exi +-------- +DROP FUNCTION test.char; -- FUNCTION test.char does not exist +-------- +DROP FUNCTION test.trim; -- FUNCTION test.trim does not exist +-------- +DROP FUNCTION test.year; -- FUNCTION test.year does not exist +-------- +DROP FUNCTION test.create; -- FUNCTION test.create does not exist +DROP TABLE t1; +DROP PROCEDURE p1; +DROP PROCEDURE p2; diff --git a/mysql-test/main/keywords.test b/mysql-test/main/keywords.test index a745aada1065f..e6a3fc4953d13 100644 --- a/mysql-test/main/keywords.test +++ b/mysql-test/main/keywords.test @@ -295,3 +295,80 @@ BEGIN NOT ATOMIC END $$ DELIMITER ;$$ + + +--echo # +--echo # Testing various keywords in various contexts +--echo # + +DELIMITER $$; +CREATE PROCEDURE p1(query TEXT, var TEXT) +BEGIN + DECLARE errmsg TEXT DEFAULT ''; + DECLARE CONTINUE HANDLER + FOR SQLEXCEPTION + BEGIN + GET DIAGNOSTICS CONDITION 1 errmsg = MESSAGE_TEXT; + SET errmsg= REPLACE(errmsg, 'You have an error in your SQL ', '..'); + SET errmsg= REPLACE(errmsg, '; check the manual that corresponds to your MariaDB server version for the right syntax to use', '..'); + END; + SET query=REPLACE(query, '$(VAR)', var); + EXECUTE IMMEDIATE query; + SELECT CONCAT(query, '; -- ', LEFT(COALESCE(errmsg,''),40)) AS `--------`; +END; +$$ +CREATE PROCEDURE p2(query TEXT) +BEGIN + FOR row IN (SELECT word FROM t1 ORDER BY category, word) + DO + CALL p1(query, row.word); + END FOR; +END; +$$ +DELIMITER ;$$ + +CREATE TABLE t1 (word TEXT, category TEXT); + +INSERT INTO t1 VALUES ('non_keyword', '00 Simple identifier'); + +INSERT INTO t1 VALUES ('lpad', '01 Built-in native function'); +INSERT INTO t1 VALUES ('rpad', '01 Built-in native function'); + +INSERT INTO t1 VALUES ('adddate', '02 function_call_nonkeyword'); +INSERT INTO t1 VALUES ('substr', '02 function_call_nonkeyword'); +INSERT INTO t1 VALUES ('substring', '02 function_call_nonkeyword'); +INSERT INTO t1 VALUES ('trim_oracle', '02 function_call_nonkeyword'); + +INSERT INTO t1 VALUES ('ascii', '03 function_call_conflict'); +INSERT INTO t1 VALUES ('replace', '03 function_call_conflict'); +INSERT INTO t1 VALUES ('weight_string', '03 function_call_conflict'); + +INSERT INTO t1 VALUES ('char', '04 function_call_keyword'); +INSERT INTO t1 VALUES ('trim', '04 function_call_keyword'); +INSERT INTO t1 VALUES ('year', '04 function_call_keyword'); + +INSERT INTO t1 VALUES ('create', '05 Reserved keyword'); + +CALL p2('SELECT @@$(VAR)'); +CALL p2('SELECT @@global.$(VAR)'); +CALL p2('SELECT @@global.$(VAR)()'); + +CALL p2('SELECT $(VAR)()'); +CALL p2('SELECT test.$(VAR)()'); + +CALL p2('SELECT $(VAR) FROM t1'); +CALL p2('SELECT t1.$(VAR) FROM t1'); + +CALL p2('DROP TABLE $(VAR)'); +CALL p2('DROP TABLE test.$(VAR)'); + +CALL p2('CREATE FUNCTION $(VAR)() RETURNS OOPS'); +CALL p2('CREATE FUNCTION test.$(VAR)() RETURNS OOPS'); + +CALL p2('DROP FUNCTION $(VAR)'); +CALL p2('DROP FUNCTION test.$(VAR)'); + +DROP TABLE t1; + +DROP PROCEDURE p1; +DROP PROCEDURE p2; diff --git a/mysql-test/main/kill-2.result b/mysql-test/main/kill-2.result index daaba2c092a9b..d735d412eeb98 100644 --- a/mysql-test/main/kill-2.result +++ b/mysql-test/main/kill-2.result @@ -10,3 +10,34 @@ foo root kill user foo@'127.0.0.1'; drop user foo@'127.0.0.1'; +# +# KILL USER and missing privileges +# +create user a@'127.0.0.1'; +create user b@'127.0.0.1'; +grant process on *.* to a@'127.0.0.1'; +grant select on *.* to b@'127.0.0.1'; +connect a,127.0.0.1,a; +show grants; +Grants for a@127.0.0.1 +GRANT PROCESS ON *.* TO `a`@`127.0.0.1` +connect b,127.0.0.1,b; +show processlist; +Id User Host db Command Time State Info Progress +# b # test # # starting show processlist # +kill user a; +kill user x; +connection a; +show processlist; +Id User Host db Command Time State Info Progress +# root # test # # # # # +# a # test # # # # # +# b # test # # # # # +kill user b; +ERROR HY000: Operation KILL USER failed for b@% +connection default; +drop user a@'127.0.0.1'; +drop user b@'127.0.0.1'; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/kill-2.test b/mysql-test/main/kill-2.test index 3412e75b8d5dd..9bc4fe03346c0 100644 --- a/mysql-test/main/kill-2.test +++ b/mysql-test/main/kill-2.test @@ -6,12 +6,12 @@ # connection does not read() from a socket, but returns control to the # application. 'mysqltest' does not handle the kill request. # - -- source include/not_embedded.inc --echo # --echo # MDEV-6896 kill user command cause MariaDB crash! --echo # +--disable_service_connection create user foo@'127.0.0.1'; @@ -26,3 +26,31 @@ let $wait_condition= where user = "foo"; --source include/wait_condition.inc drop user foo@'127.0.0.1'; +--enable_service_connection + +--echo # +--echo # KILL USER and missing privileges +--echo # +create user a@'127.0.0.1'; +create user b@'127.0.0.1'; +grant process on *.* to a@'127.0.0.1'; +grant select on *.* to b@'127.0.0.1'; +--connect a,127.0.0.1,a +show grants; +--connect b,127.0.0.1,b +--replace_column 1 # 3 # 5 # 6 # 9 # +show processlist; +kill user a; # existing connection, but not visible to current_user +kill user x; # not existing connection +--connection a +--replace_column 1 # 3 # 5 # 6 # 7 # 8 # 9 # +show processlist; +--error ER_KILL_DENIED_ERROR +kill user b; +--connection default +drop user a@'127.0.0.1'; +drop user b@'127.0.0.1'; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/kill.result b/mysql-test/main/kill.result index cbb0598485fdc..797052710e86c 100644 --- a/mysql-test/main/kill.result +++ b/mysql-test/main/kill.result @@ -1,239 +1,7 @@ set local sql_mode=""; set global sql_mode=""; -SET DEBUG_SYNC = 'RESET'; -DROP TABLE IF EXISTS t1, t2, t3; -DROP FUNCTION IF EXISTS MY_KILL; -CREATE FUNCTION MY_KILL(tid INT) RETURNS INT -BEGIN -DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; -KILL tid; -RETURN (SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID = tid); -END| -connect con1, localhost, root,,; -connect con2, localhost, root,,; -connection con1; -connection con2; -connection con1; -SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; -SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read'; -connection con2; -SET DEBUG_SYNC='now WAIT_FOR con1_read'; -SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; -SET DEBUG_SYNC = 'RESET'; -connection con1; -SELECT 1; -Got one of the listed errors -SELECT 1; -1 -1 -SELECT @id != CONNECTION_ID(); -@id != CONNECTION_ID() -1 -connection con2; -SELECT 4; -4 -4 -connection default; -KILL (SELECT COUNT(*) FROM mysql.user); -ERROR 42000: KILL does not support subqueries or stored functions -connection con1; -connection con2; -connection con1; -SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; -SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read WAIT_FOR kill'; -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR con1_read'; -SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; -SET DEBUG_SYNC = 'RESET'; -connection con1; -SELECT 1; -Got one of the listed errors -SELECT 1; -1 -1 -SELECT @id != CONNECTION_ID(); -@id != CONNECTION_ID() -1 -connection con2; -SELECT 4; -4 -4 -connection default; -CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT); -CREATE TABLE t2 (id INT UNSIGNED NOT NULL); -INSERT INTO t1 VALUES -(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0), -(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0), -(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0), -(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0); -INSERT t1 SELECT 0 FROM t1 AS a1, t1 AS a2 LIMIT 4032; -INSERT INTO t2 SELECT id FROM t1; -connection con1; -connection con2; -connection con1; -SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; -SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync'; -SELECT id FROM t1 WHERE id IN -(SELECT DISTINCT a.id FROM t2 a, t2 b, t2 c, t2 d -GROUP BY ACOS(1/a.id), b.id, c.id, d.id -HAVING a.id BETWEEN 10 AND 20); -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL @id; -SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; -connection con1; -Got one of the listed errors -SELECT 1; -1 -1 -connection default; -SET DEBUG_SYNC = 'RESET'; -DROP TABLE t1, t2; -connection con1; -connection con2; -connection con1; -SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync WAIT_FOR kill'; -SELECT ACOS(0); -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL QUERY @id; -connection con1; -ACOS(0) -1.5707963267948966 -SELECT 1; -1 -1 -SELECT @id = CONNECTION_ID(); -@id = CONNECTION_ID() -1 -connection default; -SET DEBUG_SYNC = 'RESET'; -CREATE TABLE t1 (f1 INT); -CREATE FUNCTION bug27563() RETURNS INT(11) -DETERMINISTIC -BEGIN -DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed'; -DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception'; -SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill'; -RETURN 1; -END| -connection con1; -connection con2; -connection con1; -INSERT INTO t1 VALUES (bug27563()); -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL QUERY @id; -connection con1; -ERROR 70100: Query execution was interrupted -SELECT * FROM t1; -f1 -connection default; -SET DEBUG_SYNC = 'RESET'; -INSERT INTO t1 VALUES(0); -connection con1; -UPDATE t1 SET f1= bug27563(); -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL QUERY @id; -connection con1; -ERROR 70100: Query execution was interrupted -SELECT * FROM t1; -f1 -0 -connection default; -SET DEBUG_SYNC = 'RESET'; -INSERT INTO t1 VALUES(1); -connection con1; -DELETE FROM t1 WHERE bug27563() IS NULL; -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL QUERY @id; -connection con1; -ERROR 70100: Query execution was interrupted -SELECT * FROM t1; -f1 -0 -1 -connection default; -SET DEBUG_SYNC = 'RESET'; -connection con1; -SELECT * FROM t1 WHERE f1= bug27563(); -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL QUERY @id; -connection con1; -ERROR 70100: Query execution was interrupted -SELECT * FROM t1; -f1 -0 -1 -connection default; -SET DEBUG_SYNC = 'RESET'; -DROP FUNCTION bug27563; -CREATE TABLE t2 (f2 INT); -CREATE TRIGGER trg27563 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed'; -DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception'; -INSERT INTO t2 VALUES(0); -SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill'; -INSERT INTO t2 VALUES(1); -END| -connection con1; -INSERT INTO t1 VALUES(2),(3); -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL QUERY @id; -connection con1; -ERROR 70100: Query execution was interrupted -SELECT * FROM t1; -f1 -0 -1 -SELECT * FROM t2; -f2 -0 -connection default; -SET DEBUG_SYNC = 'RESET'; -DROP TABLE t1, t2; -connection con1; -connection con2; -connection con1; -SET SESSION optimizer_search_depth=0; -SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync'; -PREPARE stmt FROM 'EXPLAIN SELECT * FROM t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40 WHERE a1=a2 AND a2=a3 AND a3=a4 AND a4=a5 AND a5=a6 AND a6=a7 AND a7=a8 AND a8=a9 AND a9=a10 AND a10=a11 AND a11=a12 AND a12=a13 AND a13=a14 AND a14=a15 AND a15=a16 AND a16=a17 AND a17=a18 AND a18=a19 AND a19=a20 AND a20=a21 AND a21=a22 AND a22=a23 AND a23=a24 AND a24=a25 AND a25=a26 AND a26=a27 AND a27=a28 AND a28=a29 AND a29=a30 AND a30=a31 AND a31=a32 AND a32=a33 AND a33=a34 AND a34=a35 AND a35=a36 AND a36=a37 AND a37=a38 AND a38=a39 AND a39=a40 '; -EXECUTE stmt; -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL QUERY @id; -connection con1; -ERROR 70100: Query execution was interrupted -connection default; -SET DEBUG_SYNC = 'RESET'; -# -# Bug#19723: kill of active connection yields different error code -# depending on platform. -# -connection con1; -SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; -KILL @id; -ERROR 70100: Connection was killed -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; -connection con1; -# ER_SERVER_SHUTDOWN, CR_SERVER_GONE_ERROR, CR_SERVER_LOST, -# depending on the timing of close of the connection socket -SELECT 1; -Got one of the listed errors -SELECT 1; -1 -1 -SELECT @id != CONNECTION_ID(); -@id != CONNECTION_ID() -1 -connection default; -SET DEBUG_SYNC = 'RESET'; +connect con1, localhost, root; +connect con2, localhost, root; # # Additional test for WL#3726 "DDL locking for all metadata objects" # Check that DDL and DML statements waiting for metadata locks can @@ -241,7 +9,6 @@ SET DEBUG_SYNC = 'RESET'; # can be tricky to write test case for some of them (e.g. REPAIR or # ALTER and other statements under LOCK TABLES). # -drop tables if exists t1, t2, t3; create table t1 (i int primary key); connect blocker, localhost, root, , ; connect dml, localhost, root, , ; @@ -394,9 +161,9 @@ connection default; ERROR 70100: Query execution was interrupted disconnect con5; DROP USER u1@localhost; -SET DEBUG_SYNC = 'RESET'; -DROP FUNCTION MY_KILL; set global sql_mode=default; +disconnect con1; +disconnect con2; # # MDEV-17998 # Deadlock and eventual Assertion `!table->pos_in_locked_tables' failed diff --git a/mysql-test/main/kill.test b/mysql-test/main/kill.test index 1bb31bc665da5..e89bdb22cd1ef 100644 --- a/mysql-test/main/kill.test +++ b/mysql-test/main/kill.test @@ -7,363 +7,16 @@ # application. 'mysqltest' does not handle the kill request. # +-- source include/count_sessions.inc -- source include/not_embedded.inc --- source include/have_debug_sync.inc -set local sql_mode=""; -set global sql_mode=""; - ---disable_warnings -SET DEBUG_SYNC = 'RESET'; -DROP TABLE IF EXISTS t1, t2, t3; -DROP FUNCTION IF EXISTS MY_KILL; ---enable_warnings - -delimiter |; -# Helper function used to repeatedly kill a session. -CREATE FUNCTION MY_KILL(tid INT) RETURNS INT -BEGIN - DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; - KILL tid; - RETURN (SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID = tid); -END| -delimiter ;| - -connect (con1, localhost, root,,); -connect (con2, localhost, root,,); - -# Save id of con1 -connection con1; ---disable_reconnect -let $ID= `SELECT @id := CONNECTION_ID()`; -connection con2; -let $ignore= `SELECT @id := $ID`; -connection con1; -# Signal when this connection is terminating. -SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; -# See if we can kill read(). -# Run into read() immediately after hitting 'before_do_command_net_read'. -SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read'; - -# Kill con1 -connection con2; -SET DEBUG_SYNC='now WAIT_FOR con1_read'; -# At this point we have no way to figure out, when con1 is blocked in -# reading from the socket. Sending KILL to early would not terminate -# con1. So we repeat KILL until con1 terminates. -let $wait_condition= SELECT MY_KILL(@id); ---source include/wait_condition.inc -# If KILL missed the read(), sync point wait will time out. -SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; -SET DEBUG_SYNC = 'RESET'; - -connection con1; ---error 1053,2006,2013 -SELECT 1; - ---enable_reconnect -# this should work, and we should have a new connection_id() -SELECT 1; -let $ignore= `SELECT @id := $ID`; -SELECT @id != CONNECTION_ID(); - -#make sure the server is still alive -connection con2; -SELECT 4; -connection default; - ---error ER_SUBQUERIES_NOT_SUPPORTED -KILL (SELECT COUNT(*) FROM mysql.user); - -connection con1; -let $ID= `SELECT @id := CONNECTION_ID()`; -connection con2; -let $ignore= `SELECT @id := $ID`; -connection con1; -disable_reconnect; -# Signal when this connection is terminating. -SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; -# See if we can kill the sync point itself. -# Wait in 'before_do_command_net_read' until killed. -# It doesn't wait for a signal 'kill' but for to be killed. -# The signal name doesn't matter here. -SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read WAIT_FOR kill'; -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR con1_read'; -# Repeat KILL until con1 terminates. -let $wait_condition= SELECT MY_KILL(@id); ---source include/wait_condition.inc -SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; -SET DEBUG_SYNC = 'RESET'; - -connection con1; ---error 1053,2006,2013 -SELECT 1; -enable_reconnect; -SELECT 1; -let $ignore= `SELECT @id := $ID`; -SELECT @id != CONNECTION_ID(); -connection con2; -SELECT 4; -connection default; - -# -# BUG#14851: killing long running subquery processed via a temporary table. -# - -CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT); -CREATE TABLE t2 (id INT UNSIGNED NOT NULL); - -INSERT INTO t1 VALUES -(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0), -(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0), -(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0), -(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0); -INSERT t1 SELECT 0 FROM t1 AS a1, t1 AS a2 LIMIT 4032; - -INSERT INTO t2 SELECT id FROM t1; -connection con1; -let $ID= `SELECT @id := CONNECTION_ID()`; -connection con2; -let $ignore= `SELECT @id := $ID`; - -connection con1; -SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; -SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync'; -# This is a very long running query. If this test start failing, -# it may be necessary to change to an even longer query. -send SELECT id FROM t1 WHERE id IN - (SELECT DISTINCT a.id FROM t2 a, t2 b, t2 c, t2 d - GROUP BY ACOS(1/a.id), b.id, c.id, d.id - HAVING a.id BETWEEN 10 AND 20); +--disable_service_connection -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL @id; -SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; - -connection con1; ---error 1317,1053,2006,2013 -reap; -SELECT 1; - -connection default; -SET DEBUG_SYNC = 'RESET'; -DROP TABLE t1, t2; - -# -# Test of blocking of sending ERROR after OK or EOF -# -connection con1; -let $ID= `SELECT @id := CONNECTION_ID()`; -connection con2; -let $ignore= `SELECT @id := $ID`; -connection con1; -SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync WAIT_FOR kill'; -send SELECT ACOS(0); -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL QUERY @id; -connection con1; -reap; -SELECT 1; -SELECT @id = CONNECTION_ID(); -connection default; -SET DEBUG_SYNC = 'RESET'; - -# -# Bug#27563: Stored functions and triggers wasn't throwing an error when killed. -# -CREATE TABLE t1 (f1 INT); -delimiter |; -CREATE FUNCTION bug27563() RETURNS INT(11) -DETERMINISTIC -BEGIN - DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed'; - DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception'; - SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill'; - RETURN 1; -END| -delimiter ;| -# Test stored functions -# Test INSERT -connection con1; -let $ID= `SELECT @id := CONNECTION_ID()`; -connection con2; -let $ignore= `SELECT @id := $ID`; -connection con1; -send INSERT INTO t1 VALUES (bug27563()); -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL QUERY @id; -connection con1; ---error 1317 -reap; -SELECT * FROM t1; -connection default; -SET DEBUG_SYNC = 'RESET'; - -# Test UPDATE -INSERT INTO t1 VALUES(0); -connection con1; -send UPDATE t1 SET f1= bug27563(); -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL QUERY @id; -connection con1; ---error 1317 -reap; -SELECT * FROM t1; -connection default; -SET DEBUG_SYNC = 'RESET'; - -# Test DELETE -INSERT INTO t1 VALUES(1); -connection con1; -send DELETE FROM t1 WHERE bug27563() IS NULL; -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL QUERY @id; -connection con1; ---error 1317 -reap; -SELECT * FROM t1; -connection default; -SET DEBUG_SYNC = 'RESET'; - -# Test SELECT -connection con1; -send SELECT * FROM t1 WHERE f1= bug27563(); -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL QUERY @id; -connection con1; ---error 1317 -reap; -SELECT * FROM t1; -connection default; -SET DEBUG_SYNC = 'RESET'; -DROP FUNCTION bug27563; - -# Test TRIGGERS -CREATE TABLE t2 (f2 INT); -delimiter |; -CREATE TRIGGER trg27563 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN - DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed'; - DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception'; - INSERT INTO t2 VALUES(0); - SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill'; - INSERT INTO t2 VALUES(1); -END| -delimiter ;| -connection con1; -send INSERT INTO t1 VALUES(2),(3); -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL QUERY @id; -connection con1; ---error 1317 -reap; -SELECT * FROM t1; -SELECT * FROM t2; -connection default; -SET DEBUG_SYNC = 'RESET'; -DROP TABLE t1, t2; - -# -# Bug#28598: mysqld crash when killing a long-running explain query. -# -connection con1; -let $ID= `SELECT @id := CONNECTION_ID()`; -connection con2; -let $ignore= `SELECT @id := $ID`; -connection con1; ---disable_query_log -let $tab_count= 40; - ---disable_query_log -begin; -let $i= $tab_count; -while ($i) -{ - eval CREATE TABLE t$i (a$i INT, KEY(a$i)); - eval INSERT INTO t$i VALUES (1),(2),(3),(4),(5),(6),(7); - dec $i ; -} - -commit; ---enable_query_log - -SET SESSION optimizer_search_depth=0; - -let $i=$tab_count; -while ($i) -{ - let $a= a$i; - let $t= t$i; - dec $i; - if ($i) - { - let $comma=,; - let $from=$comma$t$from; - let $where=a$i=$a $and $where; - } - if (!$i) - { - let $from=FROM $t$from; - let $where=WHERE $where; - } - let $and=AND; -} - ---enable_query_log -SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync'; -eval PREPARE stmt FROM 'EXPLAIN SELECT * $from $where'; -send EXECUTE stmt; - -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL QUERY @id; -connection con1; ---error 1317 -reap; ---disable_query_log -let $i= $tab_count; -while ($i) -{ - eval DROP TABLE t$i; - dec $i ; -} ---enable_query_log -connection default; -SET DEBUG_SYNC = 'RESET'; - ---echo # ---echo # Bug#19723: kill of active connection yields different error code ---echo # depending on platform. ---echo # - ---connection con1 -let $ID= `SELECT @id := CONNECTION_ID()`; -SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; ---disable_reconnect ---error ER_CONNECTION_KILLED -KILL @id; +set local sql_mode=""; +set global sql_mode=""; -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; -connection con1; ---echo # ER_SERVER_SHUTDOWN, CR_SERVER_GONE_ERROR, CR_SERVER_LOST, ---echo # depending on the timing of close of the connection socket ---error 1053,2006,2013 -SELECT 1; ---enable_reconnect -SELECT 1; -let $ignore= `SELECT @id := $ID`; -SELECT @id != CONNECTION_ID(); -connection default; -SET DEBUG_SYNC = 'RESET'; +connect con1, localhost, root; +connect con2, localhost, root; --echo # --echo # Additional test for WL#3726 "DDL locking for all metadata objects" @@ -372,9 +25,6 @@ SET DEBUG_SYNC = 'RESET'; --echo # can be tricky to write test case for some of them (e.g. REPAIR or --echo # ALTER and other statements under LOCK TABLES). --echo # ---disable_warnings -drop tables if exists t1, t2, t3; ---enable_warnings create table t1 (i int primary key); connect (blocker, localhost, root, , ); @@ -571,6 +221,7 @@ drop table t2; --echo # --echo # Test kill USER --echo # +--source include/count_sessions.inc grant ALL on test.* to test@localhost; grant ALL on test.* to test2@localhost; connect (con3, localhost, test,,); @@ -589,12 +240,13 @@ drop user test@localhost; drop user test2@localhost; connection con3; ---error 2013,2006 +--error 2013,2006,5014 select 1; connection con4; ---error 2013,2006 +--error 2013,2006,5014 select 1; connection default; +--source include/wait_until_count_sessions.inc --echo # --echo # MDEV-4911 - add KILL query id, and add query id information to @@ -602,7 +254,7 @@ connection default; --echo # send SELECT SLEEP(1000); connection con1; -let $wait_condition= SELECT @id:=QUERY_ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO='SELECT SLEEP(1000)'; +let $wait_condition= SELECT @id:=QUERY_ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO='SELECT SLEEP(1000)' AND STATE='User sleep'; source include/wait_condition.inc; KILL QUERY ID @id; connection default; @@ -620,7 +272,7 @@ CREATE USER u1@localhost; send SELECT SLEEP(1000); connection con1; -let $wait_condition= SELECT @id:=QUERY_ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO='SELECT SLEEP(1000)'; +let $wait_condition= SELECT @id:=QUERY_ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO='SELECT SLEEP(1000)' AND STATE='User sleep'; source include/wait_condition.inc; let $id= `SELECT @id`; @@ -638,11 +290,9 @@ reap; disconnect con5; DROP USER u1@localhost; - -SET DEBUG_SYNC = 'RESET'; -DROP FUNCTION MY_KILL; - set global sql_mode=default; +disconnect con1; +disconnect con2; --echo # --echo # MDEV-17998 @@ -669,3 +319,4 @@ DROP TABLE t1, t2; --echo # --error ER_BAD_FIELD_ERROR kill query id user 'foo'; +--enable_service_connection diff --git a/mysql-test/main/kill_debug.result b/mysql-test/main/kill_debug.result new file mode 100644 index 0000000000000..061e760238396 --- /dev/null +++ b/mysql-test/main/kill_debug.result @@ -0,0 +1,239 @@ +set local sql_mode=""; +set global sql_mode=""; +CREATE FUNCTION MY_KILL(tid INT) RETURNS INT +BEGIN +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; +KILL tid; +RETURN (SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID = tid); +END| +connect con1, localhost, root; +connect con2, localhost, root; +connection con1; +connection con2; +connection con1; +SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; +SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read'; +connection con2; +SET DEBUG_SYNC='now WAIT_FOR con1_read'; +SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; +SET DEBUG_SYNC = 'RESET'; +connection con1; +SELECT 1; +Got one of the listed errors +SELECT 1; +1 +1 +SELECT @id != CONNECTION_ID(); +@id != CONNECTION_ID() +1 +connection con2; +SELECT 4; +4 +4 +connection default; +KILL (SELECT COUNT(*) FROM mysql.user); +ERROR 42000: KILL does not support subqueries or stored functions +connection con1; +connection con2; +connection con1; +SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; +SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read WAIT_FOR kill'; +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR con1_read'; +SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; +SET DEBUG_SYNC = 'RESET'; +connection con1; +SELECT 1; +Got one of the listed errors +SELECT 1; +1 +1 +SELECT @id != CONNECTION_ID(); +@id != CONNECTION_ID() +1 +connection con2; +SELECT 4; +4 +4 +connection default; +CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT); +CREATE TABLE t2 (id INT UNSIGNED NOT NULL); +INSERT INTO t1 VALUES +(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0), +(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0), +(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0), +(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0); +INSERT t1 SELECT 0 FROM t1 AS a1, t1 AS a2 LIMIT 4032; +INSERT INTO t2 SELECT id FROM t1; +connection con1; +connection con2; +connection con1; +SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; +SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync'; +SELECT id FROM t1 WHERE id IN +(SELECT DISTINCT a.id FROM t2 a, t2 b, t2 c, t2 d +GROUP BY ACOS(1/a.id), b.id, c.id, d.id +HAVING a.id BETWEEN 10 AND 20); +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +KILL @id; +SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; +connection con1; +Got one of the listed errors +SELECT 1; +1 +1 +connection default; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1, t2; +connection con1; +connection con2; +connection con1; +SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync WAIT_FOR kill'; +SELECT ACOS(0); +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +KILL QUERY @id; +connection con1; +ACOS(0) +1.5707963267948966 +SELECT 1; +1 +1 +SELECT @id = CONNECTION_ID(); +@id = CONNECTION_ID() +1 +connection default; +SET DEBUG_SYNC = 'RESET'; +CREATE TABLE t1 (f1 INT); +CREATE FUNCTION bug27563() RETURNS INT(11) +DETERMINISTIC +BEGIN +DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed'; +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception'; +SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill'; +RETURN 1; +END| +connection con1; +connection con2; +connection con1; +INSERT INTO t1 VALUES (bug27563()); +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +KILL QUERY @id; +connection con1; +ERROR 70100: Query execution was interrupted +SELECT * FROM t1; +f1 +connection default; +SET DEBUG_SYNC = 'RESET'; +INSERT INTO t1 VALUES(0); +connection con1; +UPDATE t1 SET f1= bug27563(); +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +KILL QUERY @id; +connection con1; +ERROR 70100: Query execution was interrupted +SELECT * FROM t1; +f1 +0 +connection default; +SET DEBUG_SYNC = 'RESET'; +INSERT INTO t1 VALUES(1); +connection con1; +DELETE FROM t1 WHERE bug27563() IS NULL; +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +KILL QUERY @id; +connection con1; +ERROR 70100: Query execution was interrupted +SELECT * FROM t1; +f1 +0 +1 +connection default; +SET DEBUG_SYNC = 'RESET'; +connection con1; +SELECT * FROM t1 WHERE f1= bug27563(); +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +KILL QUERY @id; +connection con1; +ERROR 70100: Query execution was interrupted +SELECT * FROM t1; +f1 +0 +1 +connection default; +SET DEBUG_SYNC = 'RESET'; +DROP FUNCTION bug27563; +CREATE TABLE t2 (f2 INT); +CREATE TRIGGER trg27563 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed'; +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception'; +INSERT INTO t2 VALUES(0); +SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill'; +INSERT INTO t2 VALUES(1); +END| +connection con1; +INSERT INTO t1 VALUES(2),(3); +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +KILL QUERY @id; +connection con1; +ERROR 70100: Query execution was interrupted +SELECT * FROM t1; +f1 +0 +1 +SELECT * FROM t2; +f2 +0 +connection default; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1, t2; +# +# Bug#19723: kill of active connection yields different error code +# depending on platform. +# +connection con1; +SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; +KILL @id; +ERROR 70100: Connection was killed +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; +connection con1; +# ER_SERVER_SHUTDOWN, CR_SERVER_GONE_ERROR, CR_SERVER_LOST, +# depending on the timing of close of the connection socket +SELECT 1; +Got one of the listed errors +SELECT 1; +1 +1 +SELECT @id != CONNECTION_ID(); +@id != CONNECTION_ID() +1 +connection default; +SET DEBUG_SYNC = 'RESET'; +DROP FUNCTION MY_KILL; +set global sql_mode=default; +disconnect con1; +disconnect con2; +# +# MDEV-29368 Assertion `trx->mysql_thd == thd' failed in innobase_kill_query from process_timers/timer_handler and use-after-poison in innobase_kill_query +# +connect foo,localhost,root; +create table t1 (a int) engine=innodb; +insert t1 values (1); +set debug_sync='THD_cleanup_after_set_killed SIGNAL go0 WAIT_FOR go1'; +set debug_sync='innobase_connection_closed SIGNAL go2 WAIT_FOR go3'; +disconnect foo; +connection default; +set debug_sync='now WAIT_FOR go0'; +set debug_sync='found_killee SIGNAL go1 WAIT_FOR go2'; +kill $id; +set debug_sync='now SIGNAL go3'; +drop table t1; +set debug_sync='reset'; diff --git a/mysql-test/main/kill_debug.test b/mysql-test/main/kill_debug.test new file mode 100644 index 0000000000000..32a764004e3eb --- /dev/null +++ b/mysql-test/main/kill_debug.test @@ -0,0 +1,318 @@ +# +# Test KILL and KILL QUERY statements. +# +# Killing a connection in an embedded server does not work like in a normal +# server, if it is waiting for a new statement. In an embedded server, the +# connection does not read() from a socket, but returns control to the +# application. 'mysqltest' does not handle the kill request. +# + +-- source include/not_embedded.inc +-- source include/have_debug_sync.inc +-- source include/have_innodb.inc +set local sql_mode=""; +set global sql_mode=""; + +delimiter |; +# Helper function used to repeatedly kill a session. +CREATE FUNCTION MY_KILL(tid INT) RETURNS INT +BEGIN + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; + KILL tid; + RETURN (SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID = tid); +END| +delimiter ;| + +connect con1, localhost, root; +connect con2, localhost, root; + +# Save id of con1 +connection con1; +--disable_reconnect +let $ID= `SELECT @id := CONNECTION_ID()`; +connection con2; +let $ignore= `SELECT @id := $ID`; +connection con1; +# Signal when this connection is terminating. +SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; +# See if we can kill read(). +# Run into read() immediately after hitting 'before_do_command_net_read'. +SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read'; + +# Kill con1 +connection con2; +SET DEBUG_SYNC='now WAIT_FOR con1_read'; +# At this point we have no way to figure out, when con1 is blocked in +# reading from the socket. Sending KILL to early would not terminate +# con1. So we repeat KILL until con1 terminates. +let $wait_condition= SELECT MY_KILL(@id); +--source include/wait_condition.inc +# If KILL missed the read(), sync point wait will time out. +SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; +SET DEBUG_SYNC = 'RESET'; + +connection con1; +--error 1053,2006,2013,5014 +SELECT 1; + +--enable_reconnect +# this should work, and we should have a new connection_id() +SELECT 1; +let $ignore= `SELECT @id := $ID`; +SELECT @id != CONNECTION_ID(); + +#make sure the server is still alive +connection con2; +SELECT 4; +connection default; + +--error ER_SUBQUERIES_NOT_SUPPORTED +KILL (SELECT COUNT(*) FROM mysql.user); + +connection con1; +let $ID= `SELECT @id := CONNECTION_ID()`; +connection con2; +let $ignore= `SELECT @id := $ID`; +connection con1; +disable_reconnect; +# Signal when this connection is terminating. +SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; +# See if we can kill the sync point itself. +# Wait in 'before_do_command_net_read' until killed. +# It doesn't wait for a signal 'kill' but for to be killed. +# The signal name doesn't matter here. +SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read WAIT_FOR kill'; +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR con1_read'; +# Repeat KILL until con1 terminates. +let $wait_condition= SELECT MY_KILL(@id); +--source include/wait_condition.inc +SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; +SET DEBUG_SYNC = 'RESET'; + +connection con1; +--error 1053,2006,2013,5014 +SELECT 1; +enable_reconnect; +SELECT 1; +let $ignore= `SELECT @id := $ID`; +SELECT @id != CONNECTION_ID(); +connection con2; +SELECT 4; +connection default; + +# +# BUG#14851: killing long running subquery processed via a temporary table. +# + +CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT); +CREATE TABLE t2 (id INT UNSIGNED NOT NULL); + +INSERT INTO t1 VALUES +(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0), +(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0), +(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0), +(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0); +INSERT t1 SELECT 0 FROM t1 AS a1, t1 AS a2 LIMIT 4032; + +INSERT INTO t2 SELECT id FROM t1; + +connection con1; +let $ID= `SELECT @id := CONNECTION_ID()`; +connection con2; +let $ignore= `SELECT @id := $ID`; + +connection con1; +SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; +SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync'; +# This is a very long running query. If this test start failing, +# it may be necessary to change to an even longer query. +send SELECT id FROM t1 WHERE id IN + (SELECT DISTINCT a.id FROM t2 a, t2 b, t2 c, t2 d + GROUP BY ACOS(1/a.id), b.id, c.id, d.id + HAVING a.id BETWEEN 10 AND 20); + +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +KILL @id; +SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; + +connection con1; +--error 1317,1053,2006,2013,5014 +reap; +SELECT 1; + +connection default; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1, t2; + +# +# Test of blocking of sending ERROR after OK or EOF +# +connection con1; +let $ID= `SELECT @id := CONNECTION_ID()`; +connection con2; +let $ignore= `SELECT @id := $ID`; +connection con1; +SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync WAIT_FOR kill'; +send SELECT ACOS(0); +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +KILL QUERY @id; +connection con1; +reap; +SELECT 1; +SELECT @id = CONNECTION_ID(); +connection default; +SET DEBUG_SYNC = 'RESET'; + +# +# Bug#27563: Stored functions and triggers wasn't throwing an error when killed. +# +CREATE TABLE t1 (f1 INT); +delimiter |; +CREATE FUNCTION bug27563() RETURNS INT(11) +DETERMINISTIC +BEGIN + DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed'; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception'; + SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill'; + RETURN 1; +END| +delimiter ;| +# Test stored functions +# Test INSERT +connection con1; +let $ID= `SELECT @id := CONNECTION_ID()`; +connection con2; +let $ignore= `SELECT @id := $ID`; +connection con1; +send INSERT INTO t1 VALUES (bug27563()); +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +KILL QUERY @id; +connection con1; +--error 1317 +reap; +SELECT * FROM t1; +connection default; +SET DEBUG_SYNC = 'RESET'; + +# Test UPDATE +INSERT INTO t1 VALUES(0); +connection con1; +send UPDATE t1 SET f1= bug27563(); +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +KILL QUERY @id; +connection con1; +--error 1317 +reap; +SELECT * FROM t1; +connection default; +SET DEBUG_SYNC = 'RESET'; + +# Test DELETE +INSERT INTO t1 VALUES(1); +connection con1; +send DELETE FROM t1 WHERE bug27563() IS NULL; +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +KILL QUERY @id; +connection con1; +--error 1317 +reap; +SELECT * FROM t1; +connection default; +SET DEBUG_SYNC = 'RESET'; + +# Test SELECT +connection con1; +send SELECT * FROM t1 WHERE f1= bug27563(); +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +KILL QUERY @id; +connection con1; +--error 1317 +reap; +SELECT * FROM t1; +connection default; +SET DEBUG_SYNC = 'RESET'; +DROP FUNCTION bug27563; + +# Test TRIGGERS +CREATE TABLE t2 (f2 INT); +delimiter |; +CREATE TRIGGER trg27563 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN + DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed'; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception'; + INSERT INTO t2 VALUES(0); + SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill'; + INSERT INTO t2 VALUES(1); +END| +delimiter ;| +connection con1; +send INSERT INTO t1 VALUES(2),(3); +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +KILL QUERY @id; +connection con1; +--error 1317 +reap; +SELECT * FROM t1; +SELECT * FROM t2; +connection default; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1, t2; + +--echo # +--echo # Bug#19723: kill of active connection yields different error code +--echo # depending on platform. +--echo # + +--connection con1 +let $ID= `SELECT @id := CONNECTION_ID()`; +SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; +--disable_reconnect +--error ER_CONNECTION_KILLED +KILL @id; + +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; +connection con1; +--echo # ER_SERVER_SHUTDOWN, CR_SERVER_GONE_ERROR, CR_SERVER_LOST, +--echo # depending on the timing of close of the connection socket +--error 1053,2006,2013,5014 +SELECT 1; +--enable_reconnect +SELECT 1; +let $ignore= `SELECT @id := $ID`; +SELECT @id != CONNECTION_ID(); +connection default; + +SET DEBUG_SYNC = 'RESET'; +DROP FUNCTION MY_KILL; + +set global sql_mode=default; +disconnect con1; +disconnect con2; + +--echo # +--echo # MDEV-29368 Assertion `trx->mysql_thd == thd' failed in innobase_kill_query from process_timers/timer_handler and use-after-poison in innobase_kill_query +--echo # +connect foo,localhost,root; +let $id=`select connection_id()`; +create table t1 (a int) engine=innodb; +insert t1 values (1); +set debug_sync='THD_cleanup_after_set_killed SIGNAL go0 WAIT_FOR go1'; +set debug_sync='innobase_connection_closed SIGNAL go2 WAIT_FOR go3'; +disconnect foo; + +connection default; +set debug_sync='now WAIT_FOR go0'; +set debug_sync='found_killee SIGNAL go1 WAIT_FOR go2'; +evalp kill $id; +set debug_sync='now SIGNAL go3'; +drop table t1; +set debug_sync='reset'; diff --git a/mysql-test/main/loaddata.test b/mysql-test/main/loaddata.test index 8fb1877bbc5db..b1a7b323b8b9a 100644 --- a/mysql-test/main/loaddata.test +++ b/mysql-test/main/loaddata.test @@ -155,6 +155,8 @@ select * from t1; # # It should not be possible to load from a file outside of vardir +#enable after fix MDEV-27871 +--disable_view_protocol --error 1238 set @@secure_file_priv= 0; @@ -171,6 +173,7 @@ eval select load_file("$MYSQL_TEST_DIR/t/loaddata.test"); # cleanup drop table t1, t2; +--enable_view_protocol # # Bug#27586: Wrong autoinc value assigned by LOAD DATA in the @@ -424,11 +427,14 @@ SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION TRUNCATE t2; +#enable after fix MDEV-27871 +--disable_view_protocol + --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval SELECT LOAD_FILE("$file"); --remove_file $file - +--enable_view_protocol --echo 1.2 NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY @@ -443,11 +449,14 @@ SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION TRUNCATE t2; +#enable after fix MDEV-27871 +--disable_view_protocol + --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval SELECT LOAD_FILE("$file"); --remove_file $file - +--enable_view_protocol # 2. with NO_BACKSLASH_ESCAPES off @@ -468,10 +477,15 @@ TRUNCATE t2; SET sql_mode = 'NO_BACKSLASH_ESCAPES'; +#enable after fix MDEV-27871 +--disable_view_protocol + --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval SELECT LOAD_FILE("$file"); --remove_file $file +--enable_view_protocol + SET sql_mode = ''; @@ -491,10 +505,15 @@ TRUNCATE t2; SET sql_mode = 'NO_BACKSLASH_ESCAPES'; +#enable after fix MDEV-27871 +--disable_view_protocol + --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval SELECT LOAD_FILE("$file"); --remove_file $file +--enable_view_protocol + # clean up set session sql_mode=@OLD_SQL_MODE; DROP TABLE t1,t2; @@ -505,8 +524,12 @@ DROP TABLE t1,t2; --echo # function on windows --echo # +#enable after fix MDEV-27871 +--disable_view_protocol + select load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D1428AAB5CCA72E75AA2EF325E196A5A02E2E8278873C64375845994B0F39BE2FF7B478332A7B0AA5E48877C47B6F513E997848AF8CCB8A899F3393AB35333CF0871E36698193862D486B4B9078B70C0A0A507B8A250F3F876F5A067632D5E65193E4445A1EC3A2C9B4C6F07AC334F0F62BC33357CB502E9B1C19D2398B6972AEC2EF21630F8C9134C4F7DD662D8AD7BDC9E19C46720F334B66C22D4BF32ED275144E20E7669FFCF6FC143667C9F02A577F32960FA9F2371BE1FA90E49CBC69C01531F140556854D588DD0E55E1307D78CA38E975CD999F9AEA604266329EE62BFB5ADDA67F549E211ECFBA906C60063696352ABB82AA782D25B17E872EA587871F450446DB1BAE0123D20404A8F2D2698B371002E986C8FCB969A99FF0E150A2709E2ED7633D02ADA87D5B3C9487D27B2BD9D21E2EC3215DCC3CDCD884371281B95A2E9987AAF82EB499C058D9C3E7DC1B66635F60DB121C72F929622DD47B6B2E69F59FF2AE6B63CC2EC60FFBA20EA50569DBAB5DAEFAEB4F03966C9637AB55662EDD28439155A82D053A5299448EDB2E7BEB0F62889E2F84E6C7F34B3212C9AAC32D521D5AB8480993F1906D5450FAB342A0FA6ED223E178BAC036B81E15783604C32A961EA1EF20BE2EBB93D34ED37BC03142B7583303E4557E48551E4BD7CBDDEA146D5485A5D212C35189F0BD6497E66912D2780A59A53B532E12C0A5ED1EC0445D96E8F2DD825221CFE4A65A87AA21DC8750481B9849DD81694C3357A0ED9B78D608D8EDDE28FAFBEC17844DE5709F41E121838DB55639D77E32A259A416D7013B2EB1259FDE1B498CBB9CAEE1D601DF3C915EA91C69B44E6B72062F5F4B3C73F06F2D5AD185E1692E2E0A01E7DD5133693681C52EE13B2BE42D03BDCF48E4E133CF06662339B778E1C3034F9939A433E157449172F7969ACCE1F5D2F65A4E09E4A5D5611EBEDDDBDB0C0C0A); +--enable_view_protocol --echo End of 5.0 tests diff --git a/mysql-test/main/locale.result b/mysql-test/main/locale.result index d29482ceffa9c..3e632aaead5a7 100644 --- a/mysql-test/main/locale.result +++ b/mysql-test/main/locale.result @@ -306,3 +306,13 @@ date_format('2001-01-06', '%w %a %W', 'de_CH') select date_format('2001-09-01', '%c %b %M', 'de_CH'); date_format('2001-09-01', '%c %b %M', 'de_CH') 9 Sep September +# +# MDEV-30630 locale: Chinese error message for ZH_CN +# +SET lc_messages=ZH_CN; +SELECT x; +ERROR 42S22: 未知列'x'在'field list' +SET lc_messages=DEFAULT; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/locale.test b/mysql-test/main/locale.test index a9a507bc38798..7d9a07178eed3 100644 --- a/mysql-test/main/locale.test +++ b/mysql-test/main/locale.test @@ -181,3 +181,17 @@ select date_format('2001-10-01', '%c %b %M', 'rm_CH'); select date_format('2001-12-01', '%c %b %M', 'rm_CH'); select date_format('2001-01-06', '%w %a %W', 'de_CH'); select date_format('2001-09-01', '%c %b %M', 'de_CH'); + +--echo # +--echo # MDEV-30630 locale: Chinese error message for ZH_CN +--echo # + +SET lc_messages=ZH_CN; +--error ER_BAD_FIELD_ERROR +SELECT x; + +SET lc_messages=DEFAULT; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/lock_view.result b/mysql-test/main/lock_view.result index 364c2cddf603d..47a7e58ea0d46 100644 --- a/mysql-test/main/lock_view.result +++ b/mysql-test/main/lock_view.result @@ -17,64 +17,58 @@ create definer=definer@localhost view mysqltest3.v3ps as select user from perfor create definer=definer@localhost view mysqltest3.v3nt as select 1; create definer=definer@localhost sql security invoker view mysqltest3.v3i as select * from mysqltest1.t1; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `mysqltest1`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `mysqltest2`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v2` ( - `a` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v2` AS SELECT + 1 AS `a` */; SET character_set_client = @saved_cs_client; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `mysqltest3`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v3` ( - `a` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v3` AS SELECT + 1 AS `a` */; SET character_set_client = @saved_cs_client; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v3i` ( - `a` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v3i` AS SELECT + 1 AS `a` */; SET character_set_client = @saved_cs_client; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v3is` ( - `schema_name` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v3is` AS SELECT + 1 AS `schema_name` */; SET character_set_client = @saved_cs_client; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v3nt` ( - `1` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v3nt` AS SELECT + 1 AS `1` */; SET character_set_client = @saved_cs_client; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v3ps` ( - `user` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v3ps` AS SELECT + 1 AS `user` */; SET character_set_client = @saved_cs_client; USE `mysqltest1`; USE `mysqltest2`; -/*!50001 DROP TABLE IF EXISTS `v2`*/; +/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -89,7 +83,7 @@ USE `mysqltest2`; /*!50001 SET collation_connection = @saved_col_connection */; USE `mysqltest3`; -/*!50001 DROP TABLE IF EXISTS `v3`*/; +/*!50001 DROP VIEW IF EXISTS `v3`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -102,7 +96,7 @@ USE `mysqltest3`; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -/*!50001 DROP TABLE IF EXISTS `v3i`*/; +/*!50001 DROP VIEW IF EXISTS `v3i`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -115,7 +109,7 @@ USE `mysqltest3`; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -/*!50001 DROP TABLE IF EXISTS `v3is`*/; +/*!50001 DROP VIEW IF EXISTS `v3is`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -128,7 +122,7 @@ USE `mysqltest3`; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -/*!50001 DROP TABLE IF EXISTS `v3nt`*/; +/*!50001 DROP VIEW IF EXISTS `v3nt`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -141,7 +135,7 @@ USE `mysqltest3`; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -/*!50001 DROP TABLE IF EXISTS `v3ps`*/; +/*!50001 DROP VIEW IF EXISTS `v3ps`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -243,11 +237,10 @@ disconnect con1; connection default; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v1` ( - `id` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v1` AS SELECT + 1 AS `id` */; SET character_set_client = @saved_cs_client; -/*!50001 DROP TABLE IF EXISTS `v1`*/; +/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -256,7 +249,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`u1`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v1` AS select `dt`.`id` AS `id` from (select `test`.`t1`.`id` AS `id` from `test`.`t1`) `dt` */; +/*!50001 VIEW `v1` AS select `dt`.`id` AS `id` from (select `t1`.`id` AS `id` from `t1`) `dt` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; diff --git a/mysql-test/main/lock_view.test b/mysql-test/main/lock_view.test index abb8d317946cb..ba86f1c4e6805 100644 --- a/mysql-test/main/lock_view.test +++ b/mysql-test/main/lock_view.test @@ -1,5 +1,8 @@ source include/not_embedded.inc; source include/have_perfschema.inc; + +--disable_service_connection + # # LOCK TABLES and privileges on views # @@ -92,3 +95,4 @@ exec $MYSQL_DUMP test v1 -uu1 --compact; drop view v1; drop table t1; drop user u1@localhost; +--enable_service_connection diff --git a/mysql-test/main/locking_clause.test b/mysql-test/main/locking_clause.test index acba190b29f09..ccf51103e492e 100644 --- a/mysql-test/main/locking_clause.test +++ b/mysql-test/main/locking_clause.test @@ -115,6 +115,7 @@ DROP TABLE t1, t2; --echo # --echo # Bug#25972285: UNCLEAR ERROR MESSAGE FOR NOWAIT --echo # +--disable_view_protocol CREATE USER test@localhost; GRANT CREATE, SELECT, UPDATE on *.* to test@localhost; @@ -144,6 +145,7 @@ disconnect con2; DROP TABLE t1; DROP USER test@localhost; DROP USER test2@localhost; +--enable_view_protocol --echo # --echo # Bug#30237291: "SELECT ... INTO VAR_NAME FOR UPDATE" NOT WORKING IN diff --git a/mysql-test/main/log_slow.result b/mysql-test/main/log_slow.result index 31d52ff032379..6b9fddb7fb63e 100644 --- a/mysql-test/main/log_slow.result +++ b/mysql-test/main/log_slow.result @@ -64,7 +64,7 @@ rows_affected int(11) NO NULL flush slow logs; set long_query_time=0.1; set log_slow_filter=''; -set global slow_query_log=1; +set slow_query_log=1; set global log_output='TABLE'; select sleep(0.5); sleep(0.5) @@ -73,7 +73,7 @@ select count(*) FROM mysql.slow_log; count(*) 1 set @@long_query_time=default; -set global slow_query_log= @org_slow_query_log; +set @@slow_query_log=default; set @@log_slow_filter=default; set @@log_slow_verbosity=default; set global log_output= default; @@ -115,3 +115,21 @@ Slow_queries_increment SET log_slow_filter=DEFAULT; SET @@long_query_time=default; SET GLOBAL slow_query_log= @org_slow_query_log; +# +# MDEV-21187: log_slow_filter="" logs queries not using indexes +# +flush status; +create table t (id int); +insert into t values (1),(4); +set log_slow_filter=''; +select * from t; +id +1 +4 +show session status like 'Slow_queries'; +Variable_name Value +Slow_queries 0 +drop table t; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/log_slow.test b/mysql-test/main/log_slow.test index 64fd820298564..d2e314cf66723 100644 --- a/mysql-test/main/log_slow.test +++ b/mysql-test/main/log_slow.test @@ -1,3 +1,5 @@ +--source include/no_valgrind_without_big.inc + # # Testing of slow log query options # @@ -48,14 +50,14 @@ flush slow logs; # MDEV-4206 (empty filter should be no filter) set long_query_time=0.1; set log_slow_filter=''; -set global slow_query_log=1; +set slow_query_log=1; set global log_output='TABLE'; select sleep(0.5); select count(*) FROM mysql.slow_log; # Reset used variables set @@long_query_time=default; -set global slow_query_log= @org_slow_query_log; +set @@slow_query_log=default; set @@log_slow_filter=default; set @@log_slow_verbosity=default; set global log_output= default; @@ -100,3 +102,20 @@ SET log_slow_filter=DEFAULT; SET @@long_query_time=default; SET GLOBAL slow_query_log= @org_slow_query_log; + +--echo # +--echo # MDEV-21187: log_slow_filter="" logs queries not using indexes +--echo # + +flush status; +create table t (id int); +insert into t values (1),(4); +set log_slow_filter=''; +select * from t; +show session status like 'Slow_queries'; + +drop table t; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/log_tables.result b/mysql-test/main/log_tables.result index e20d3db2dafb4..d4f1f59ec1c91 100644 --- a/mysql-test/main/log_tables.result +++ b/mysql-test/main/log_tables.result @@ -57,7 +57,7 @@ general_log CREATE TABLE `general_log` ( `server_id` int(10) unsigned NOT NULL, `command_type` varchar(64) NOT NULL, `argument` mediumtext NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='General log' +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='General log' show fields from mysql.general_log; Field Type Null Key Default Extra event_time timestamp(6) NO current_timestamp(6) on update current_timestamp(6) @@ -82,7 +82,7 @@ slow_log CREATE TABLE `slow_log` ( `sql_text` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `rows_affected` int(11) NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='Slow log' +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log' show fields from mysql.slow_log; Field Type Null Key Default Extra start_time timestamp(6) NO current_timestamp(6) on update current_timestamp(6) @@ -172,7 +172,7 @@ general_log CREATE TABLE `general_log` ( `server_id` int(10) unsigned NOT NULL, `command_type` varchar(64) NOT NULL, `argument` mediumtext NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='General log' +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='General log' show create table mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( @@ -189,7 +189,7 @@ slow_log CREATE TABLE `slow_log` ( `sql_text` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `rows_affected` int(11) NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='Slow log' +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log' alter table mysql.general_log engine=myisam; alter table mysql.slow_log engine=myisam; show create table mysql.general_log; @@ -201,7 +201,7 @@ general_log CREATE TABLE `general_log` ( `server_id` int(10) unsigned NOT NULL, `command_type` varchar(64) NOT NULL, `argument` mediumtext NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COMMENT='General log' +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='General log' show create table mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( @@ -218,7 +218,7 @@ slow_log CREATE TABLE `slow_log` ( `sql_text` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `rows_affected` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COMMENT='Slow log' +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log' set global general_log='ON'; set global slow_query_log='ON'; select * from mysql.general_log; diff --git a/mysql-test/main/long_host.result b/mysql-test/main/long_host.result index 4c479e36fa95c..57b637de5874f 100644 --- a/mysql-test/main/long_host.result +++ b/mysql-test/main/long_host.result @@ -27,9 +27,9 @@ current_user() user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345 # check global privileges select * from mariadbtestdb.t1; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't1' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t1` select * from mariadbtestdb2.t2; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't2' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb2`.`t2` connection default; grant SELECT ON *.* TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; disconnect con1; @@ -46,9 +46,9 @@ disconnect con1; connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,; connection con1; select * from mariadbtestdb.t1; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't1' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t1` select * from mariadbtestdb2.t2; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't2' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb2`.`t2` # check data base privileges connection default; grant SELECT ON mariadbtestdb.* TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; @@ -58,7 +58,7 @@ connection con1; select * from mariadbtestdb.t1; a b select * from mariadbtestdb2.t2; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't2' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb2`.`t2` select * from mariadbtestdb.t3; a # check table privileges @@ -71,9 +71,9 @@ connection con1; select * from mariadbtestdb.t1; a b select * from mariadbtestdb2.t2; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't2' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb2`.`t2` select * from mariadbtestdb.t3; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't3' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t3` # check column privileges connection default; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; @@ -82,11 +82,11 @@ disconnect con1; connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,; connection con1; select * from mariadbtestdb.t1; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't1' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t1` select * from mariadbtestdb2.t2; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't2' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb2`.`t2` select * from mariadbtestdb.t3; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't3' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t3` select a from mariadbtestdb.t1; a # check role @@ -101,13 +101,13 @@ disconnect con1; connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,; connection con1; select * from mariadbtestdb.t1; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't1' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t1` select * from mariadbtestdb2.t2; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't2' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb2`.`t2` select * from mariadbtestdb.t3; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't3' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t3` select a from mariadbtestdb.t1; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't1' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t1` SELECT CURRENT_ROLE; CURRENT_ROLE NULL @@ -116,11 +116,11 @@ SELECT CURRENT_ROLE; CURRENT_ROLE role5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678 select * from mariadbtestdb.t1; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't1' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t1` select * from mariadbtestdb2.t2; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't2' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb2`.`t2` select * from mariadbtestdb.t3; -ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table 't3' +ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t3` select a from mariadbtestdb.t1; a # check procedure diff --git a/mysql-test/main/long_host.test b/mysql-test/main/long_host.test index f176279749af6..0c082bf6fb41b 100644 --- a/mysql-test/main/long_host.test +++ b/mysql-test/main/long_host.test @@ -1,6 +1,8 @@ --source include/have_debug_sync.inc --source include/not_embedded.inc +#enable view protocol after fix MDEV-29542 +--source include/no_view_protocol.inc --echo # check user diff --git a/mysql-test/main/long_unique.result b/mysql-test/main/long_unique.result index a2484f59202a2..7f8110a283efb 100644 --- a/mysql-test/main/long_unique.result +++ b/mysql-test/main/long_unique.result @@ -22,7 +22,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` blob DEFAULT NULL, UNIQUE KEY `a` (`a`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show keys from t1; Table t1 Non_unique 0 @@ -148,7 +148,7 @@ t1 CREATE TABLE `t1` ( `a` blob DEFAULT NULL, `b` int(11) DEFAULT NULL, UNIQUE KEY `a` (`a`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values(1,2); ERROR 23000: Duplicate entry '1' for key 'a' insert into t1 values(2,2); @@ -175,7 +175,7 @@ t1 CREATE TABLE `t1` ( `a` blob DEFAULT NULL, `c` int(11) DEFAULT NULL, UNIQUE KEY `a` (`a`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci #now add some column with name db_row_hash; alter table t1 add column db_row_hash_1 int unique; show create table t1; @@ -186,7 +186,7 @@ t1 CREATE TABLE `t1` ( `db_row_hash_1` int(11) DEFAULT NULL, UNIQUE KEY `db_row_hash_1` (`db_row_hash_1`), UNIQUE KEY `a` (`a`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values(45,1,55),(46,1,55); ERROR 23000: Duplicate entry '55' for key 'db_row_hash_1' insert into t1 values(45,1,55),(45,1,55); @@ -209,7 +209,7 @@ t1 CREATE TABLE `t1` ( `db_row_hash_2` int(11) DEFAULT NULL, `db_row_hash_3` int(11) DEFAULT NULL, UNIQUE KEY `db_row_hash_1` (`db_row_hash_1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE NO @@ -225,7 +225,7 @@ t1 CREATE TABLE `t1` ( `a` blob DEFAULT NULL, UNIQUE KEY `db_row_hash_1` (`db_row_hash_1`), UNIQUE KEY `a` (`a`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # try to change the blob unique name; alter table t1 change column a aa blob ; show create table t1; @@ -238,7 +238,7 @@ t1 CREATE TABLE `t1` ( `aa` blob DEFAULT NULL, UNIQUE KEY `db_row_hash_1` (`db_row_hash_1`), UNIQUE KEY `a` (`aa`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE NO @@ -256,7 +256,7 @@ t1 CREATE TABLE `t1` ( `aa` int(11) DEFAULT NULL, UNIQUE KEY `db_row_hash_1` (`db_row_hash_1`), UNIQUE KEY `a` (`aa`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE NO @@ -276,7 +276,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `db_row_hash_1` (`db_row_hash_1`), UNIQUE KEY `a` (`aa`), UNIQUE KEY `clm` (`clm_changed`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE NO @@ -295,7 +295,7 @@ t1 CREATE TABLE `t1` ( `clm_changed` blob DEFAULT NULL, UNIQUE KEY `db_row_hash_1` (`db_row_hash_1`), UNIQUE KEY `a` (`aa`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE NO @@ -354,7 +354,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c` (`c`) USING HASH, UNIQUE KEY `d` (`d`) USING HASH, UNIQUE KEY `e` (`e`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 a 1 a A NULL NULL NULL YES HASH NO @@ -457,7 +457,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c` (`c`) USING HASH, UNIQUE KEY `d` (`d`) USING HASH, UNIQUE KEY `e` (`e`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci #unique key should not break; insert into t1 values(1,2,3,4,5,6); ERROR 23000: Duplicate entry '1' for key 'a' @@ -490,7 +490,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c` (`c`) USING HASH, UNIQUE KEY `d` (`d`) USING HASH, UNIQUE KEY `e` (`e`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci #now add some column with name db_row_hash; alter table t1 add column db_row_hash_1 int unique; alter table t1 add column db_row_hash_2 int unique; @@ -514,7 +514,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c` (`c`) USING HASH, UNIQUE KEY `d` (`d`) USING HASH, UNIQUE KEY `e` (`e`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 add column db_row_hash_7 int, add column db_row_hash_5 int , add column db_row_hash_4 int ; alter table t1 drop column db_row_hash_7,drop column db_row_hash_3, drop column db_row_hash_4; desc t1; @@ -547,7 +547,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `db_row_hash_2` (`db_row_hash_2`), UNIQUE KEY `d` (`d`) USING HASH, UNIQUE KEY `e` (`e`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE NO @@ -572,7 +572,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `d` (`d`) USING HASH, UNIQUE KEY `e` (`e`) USING HASH, UNIQUE KEY `a` (`a`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE NO @@ -599,7 +599,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `d` (`d`) USING HASH, UNIQUE KEY `e` (`e`), UNIQUE KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE NO @@ -630,7 +630,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `d` (`d`) USING HASH, UNIQUE KEY `clm1` (`clm_changed1`) USING HASH, UNIQUE KEY `clm2` (`clm_changed2`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE NO @@ -660,7 +660,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `e` (`e`), UNIQUE KEY `a` (`a`), UNIQUE KEY `d` (`d`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE NO @@ -701,7 +701,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c` (`c`,`d`,`e`) USING HASH, UNIQUE KEY `e` (`e`,`f`,`g`,`h`) USING HASH, UNIQUE KEY `b` (`b`,`d`,`g`,`h`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 a 1 a A NULL NULL NULL YES HASH NO @@ -834,7 +834,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c` (`c`,`d`,`e`) USING HASH, UNIQUE KEY `e` (`e`,`f`,`g`,`h`) USING HASH, UNIQUE KEY `b` (`b`,`d`,`g`,`h`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # add column named db_row_hash_*; alter table t1 add column db_row_hash_7 int , add column db_row_hash_5 int, add column db_row_hash_1 int, add column db_row_hash_2 int; @@ -857,7 +857,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c` (`c`,`d`,`e`) USING HASH, UNIQUE KEY `e` (`e`,`f`,`g`,`h`) USING HASH, UNIQUE KEY `b` (`b`,`d`,`g`,`h`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 a 1 a A NULL NULL NULL YES HASH NO @@ -891,7 +891,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c` (`c`,`d`,`e`) USING HASH, UNIQUE KEY `e` (`e`,`f`,`g`,`h`) USING HASH, UNIQUE KEY `b` (`b`,`d`,`g`,`h`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 a 1 a A NULL NULL NULL YES HASH NO @@ -925,7 +925,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c` (`c`,`dd`,`e`) USING HASH, UNIQUE KEY `e` (`e`,`f`,`g`,`h`) USING HASH, UNIQUE KEY `b` (`bb`,`dd`,`g`,`h`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 a 1 aa A NULL NULL NULL YES HASH NO @@ -958,7 +958,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c` (`c`,`d`,`e`) USING HASH, UNIQUE KEY `e` (`e`,`f`,`g`,`h`) USING HASH, UNIQUE KEY `b` (`b`,`d`,`g`,`h`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 a 1 a A NULL NULL NULL YES HASH NO @@ -993,7 +993,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c` (`c`,`d`,`e`) USING HASH, UNIQUE KEY `e` (`e`,`f`,`g`,`h`) USING HASH, UNIQUE KEY `b` (`b`,`d`,`g`,`h`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 a 1 a A NULL NULL NULL YES BTREE NO @@ -1027,7 +1027,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c` (`c`,`d`,`e`) USING HASH, UNIQUE KEY `e` (`e`,`f`,`g`,`h`) USING HASH, UNIQUE KEY `b` (`b`,`d`,`g`,`h`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 a 1 a A NULL NULL NULL YES HASH NO @@ -1061,7 +1061,7 @@ t1 CREATE TABLE `t1` ( `h` text DEFAULT NULL, UNIQUE KEY `a` (`a`,`b`,`c`) USING HASH, UNIQUE KEY `b` (`b`,`d`,`g`,`h`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 a 1 a A NULL NULL NULL YES HASH NO @@ -1095,7 +1095,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` blob DEFAULT NULL, UNIQUE KEY `a` (`a`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 a 1 a A NULL NULL NULL YES HASH NO @@ -1133,7 +1133,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `e` (`e`), UNIQUE KEY `a` (`a`,`c`) USING HASH, UNIQUE KEY `b` (`b`,`d`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 e 1 e A NULL NULL NULL YES BTREE NO @@ -1238,7 +1238,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` blob DEFAULT NULL, UNIQUE KEY `a` (`a`(3000)) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 value(concat(repeat('s',3000),'1')); insert into t1 value(concat(repeat('s',3000),'2')); ERROR 23000: Duplicate entry 'sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss...' for key 'a' @@ -1261,7 +1261,7 @@ t1 CREATE TABLE `t1` ( `d` longblob DEFAULT NULL, UNIQUE KEY `a` (`a`(3500),`b`) USING HASH, UNIQUE KEY `c` (`c`(4500),`d`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 a 1 a A NULL 3500 NULL YES HASH NO @@ -1281,7 +1281,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`) USING HASH, KEY `c` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values(1,23,1,33); insert into t1 values(2,23,1,33); ERROR 23000: Duplicate entry '23' for key 'b' @@ -1294,7 +1294,7 @@ t2 CREATE TABLE `t2` ( `c` int(11) DEFAULT NULL, UNIQUE KEY `a` (`a`) USING HASH, KEY `c` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t2 values(1,1); insert into t2 values(2,1); drop table t2; @@ -1308,7 +1308,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` blob NOT NULL, UNIQUE KEY `a` (`a`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values(1); insert into t1 values(3); insert into t1 values(1); @@ -1335,7 +1335,7 @@ t1 CREATE TABLE `t1` ( `c` blob NOT NULL, UNIQUE KEY `a` (`a`) USING HASH, UNIQUE KEY `b` (`b`,`c`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1, 2, 3); insert into t1 values (2, 1, 3); insert into t1 values (2, 1, 3); @@ -1353,7 +1353,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` blob DEFAULT NULL, UNIQUE KEY `a` (`a`(65535)) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; #64 indexes create table t1 ( a63 blob unique, a62 blob unique, a61 blob unique, a60 blob unique, a59 blob unique, a58 blob unique, a57 blob unique, a56 blob unique, a55 blob unique, a54 blob unique, a53 blob unique, a52 blob unique, a51 blob unique, a50 blob unique, a49 blob unique, a48 blob unique, a47 blob unique, a46 blob unique, a45 blob unique, a44 blob unique, a43 blob unique, a42 blob unique, a41 blob unique, a40 blob unique, a39 blob unique, a38 blob unique, a37 blob unique, a36 blob unique, a35 blob unique, a34 blob unique, a33 blob unique, a32 blob unique, a31 blob unique, a30 blob unique, a29 blob unique, a28 blob unique, a27 blob unique, a26 blob unique, a25 blob unique, a24 blob unique, a23 blob unique, a22 blob unique, a21 blob unique, a20 blob unique, a19 blob unique, a18 blob unique, a17 blob unique, a16 blob unique, a15 blob unique, a14 blob unique, a13 blob unique, a12 blob unique, a11 blob unique, a10 blob unique, a9 blob unique, a8 blob unique, a7 blob unique, a6 blob unique, a5 blob unique, a4 blob unique, a3 blob unique, a2 blob unique, a1 blob unique, a blob unique);; @@ -1372,7 +1372,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` blob DEFAULT NULL, KEY `a` (`a`(1000)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(a blob); alter table t1 add index(a); @@ -1383,7 +1383,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` blob DEFAULT NULL, KEY `a` (`a`(1000)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(a text, key(a)); Warnings: @@ -1393,7 +1393,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` text DEFAULT NULL, KEY `a` (`a`(1000)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(a varchar(4000)); alter table t1 add index(a); @@ -1404,7 +1404,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(4000) DEFAULT NULL, KEY `a` (`a`(1000)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (pk int, a int, b int, primary key(pk), key(pk,a)); alter table t1 modify a text; @@ -1419,7 +1419,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `pk` (`pk`,`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # # MDEV-19705: Assertion `tmp >= 0' failed in best_access_path diff --git a/mysql-test/main/long_unique_big.result b/mysql-test/main/long_unique_big.result index 541b5759e9d8a..25b036945bbe7 100644 --- a/mysql-test/main/long_unique_big.result +++ b/mysql-test/main/long_unique_big.result @@ -15,7 +15,7 @@ t1 CREATE TABLE `t1` ( `c` longblob DEFAULT NULL, UNIQUE KEY `a` (`a`) USING HASH, UNIQUE KEY `b` (`b`,`c`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 a 1 a A NULL NULL NULL YES HASH NO diff --git a/mysql-test/main/long_unique_bugs.result b/mysql-test/main/long_unique_bugs.result index ae736d625b2d3..ed13c668ec3a8 100644 --- a/mysql-test/main/long_unique_bugs.result +++ b/mysql-test/main/long_unique_bugs.result @@ -1,3 +1,6 @@ +# +# MDEV-18707 Server crash in my_hash_sort_bin, ASAN heap-use-after-free in Field::is_null, server hang, corrupted double-linked list +# create table t1 (a int, b int, c int, d int, e int); insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(), @@ -11,6 +14,9 @@ load data infile 'load.data' into table tmp; delete from tmp; drop table t1; drop table tmp; +# +# MDEV-18712 InnoDB indexes are inconsistent with what defined in .frm for table after rebuilding table with index on blob +# create table t1 (b blob) engine=innodb; alter table t1 add unique (b); alter table t1 force; @@ -19,14 +25,20 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` blob DEFAULT NULL, UNIQUE KEY `b` (`b`) USING HASH -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; +# +# MDEV-18713 Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed in test_if_reopen upon REPLACE into table with key on blob +# create table t1 (pk int, b blob, primary key(pk), unique(b)) engine=myisam; insert into t1 values (1,'foo'); replace into t1 (pk) values (1); alter table t1 force; replace into t1 (pk) values (1); drop table t1; +# +# MDEV-18722 Assertion `templ->mysql_null_bit_mask' failed in row_sel_store_mysql_rec upon modifying indexed column into blob +# create table t1 (t time, unique(t)) engine=innodb; insert into t1 values (null),(null); alter ignore table t1 modify t text not null default ''; @@ -34,6 +46,9 @@ Warnings: Warning 1265 Data truncated for column 't' at row 1 Warning 1265 Data truncated for column 't' at row 2 drop table t1; +# +# MDEV-18720 Assertion `inited==NONE' failed in ha_index_init upon update on versioned table with key on blob +# create table t1 ( pk int, f text, primary key (pk), unique(f)) with system versioning; insert into t1 values (1,'foo'); update t1 set f = 'bar'; @@ -50,20 +65,32 @@ pk f row_end > DATE'2030-01-01' 1 foo 0 1 bar 0 drop table t1; +# +# MDEV-18747 InnoDB: Failing assertion: table->get_ref_count() == 0 upon dropping temporary table with unique blob +# create temporary table t1 (f blob, unique(f)) engine=innodb; insert into t1 values (1); replace into t1 values (1); drop table t1; +# +# MDEV-18748 REPLACE doesn't work with unique blobs on MyISAM table +# create table t (b blob, unique(b)) engine=myisam; insert into t values ('foo'); replace into t values ('foo'); drop table t; +# +# MDEV-18790 Server crash in fields_in_hash_keyinfo after unsuccessful attempt to drop BLOB with long index +# CREATE TABLE t1 (f INT, x BLOB, UNIQUE (x)); INSERT INTO t1 VALUES (1,'foo'); ALTER TABLE t1 DROP x, ALGORITHM=INPLACE; ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY UPDATE t1 SET x = 'bar'; DROP TABLE t1; +# +# MDEV-18799 Long unique does not work after failed alter table +# create table t1(a blob unique , b blob); insert into t1 values(1,1),(2,1); alter table t1 add unique(b); @@ -86,16 +113,26 @@ Ignored NO insert into t1 values(1,1); ERROR 23000: Duplicate entry '1' for key 'a' DROP TABLE t1; +# +# MDEV-18792 ASAN unknown-crash in _mi_pack_key upon UPDATE after failed ALTER on a table with long BLOB key +# CREATE TABLE t1 (a TEXT, b INT, UNIQUE(a)) ENGINE=MyISAM; ALTER TABLE t1 DROP x; ERROR 42000: Can't DROP COLUMN `x`; check that it exists UPDATE t1 SET b = 0 WHERE a = 'foo'; DROP TABLE t1; +# +# MDEV-18793 Assertion `0' failed in row_sel_convert_mysql_key_to_innobase, ASAN unknown-crash in +# row_mysql_store_col_in_innobase_format, warning " InnoDB: Using a partial-field key prefix in search" +# CREATE TABLE t1 (a TEXT, b INT, UNIQUE(a)) ENGINE=InnoDB; ALTER TABLE t1 DROP x; ERROR 42000: Can't DROP COLUMN `x`; check that it exists UPDATE t1 SET b = 0 WHERE a = 'foo'; DROP TABLE t1; +# +# MDEV-18795 InnoDB: Failing assertion: field->prefix_len > 0 upon DML on table with BLOB index +# CREATE TEMPORARY TABLE t1 (f BLOB, UNIQUE(f)) ENGINE=InnoDB ROW_FORMAT=COMPACT; ALTER TABLE t1 ADD KEY (f); ERROR HY000: Index column size too large. The maximum column size is 767 bytes @@ -103,17 +140,29 @@ TRUNCATE TABLE t1; SELECT * FROM t1 WHERE f LIKE 'foo'; f DROP TABLE t1; +# +# MDEV-18798 InnoDB: No matching column for `DB_ROW_HASH_1`and server crash in +# ha_innobase::commit_inplace_alter_table upon ALTER on table with UNIQUE key +# CREATE TABLE t1 (a INT, UNIQUE ind USING HASH (a)) ENGINE=InnoDB; ALTER TABLE t1 CHANGE COLUMN IF EXISTS b a INT; Warnings: Note 1054 Unknown column 'b' in 't1' DROP TABLE t1; +# +# MDEV-18801 InnoDB: Failing assertion: field->col->mtype == type or ASAN heap-buffer-overflow +# in row_sel_convert_mysql_key_to_innobase upon SELECT on table with long index +# CREATE TABLE t1 (f VARCHAR(4096), UNIQUE(f)) ENGINE=InnoDB; ALTER TABLE t1 DROP x; ERROR 42000: Can't DROP COLUMN `x`; check that it exists SELECT * FROM t1 WHERE f LIKE 'foo'; f DROP TABLE t1; +# +# MDEV-18800 Server crash in instant_alter_column_possible or +# Assertion `!pk->has_virtual()' failed in instant_alter_column_possible upon adding key +# CREATE TABLE t1 (pk INT, PRIMARY KEY USING HASH (pk)) ENGINE=InnoDB; show keys from t1;; Table t1 @@ -132,6 +181,9 @@ Index_comment Ignored NO ALTER TABLE t1 ADD INDEX (pk); DROP TABLE t1; +# +# MDEV-18922 Alter on long unique varchar column makes result null +# CREATE TABLE t1 (b int, a varchar(4000)); INSERT INTO t1 VALUES (1, 2),(2,3),(3,4); ALTER TABLE t1 ADD UNIQUE INDEX (a); @@ -146,6 +198,10 @@ a 3 4 drop table t1; +# +# MDEV-18809 Server crash in fields_in_hash_keyinfo or Assertion `key_info->key_part->field->flags +# & (1<< 30)' failed in setup_keyinfo_hash +# CREATE TABLE t1 (f VARCHAR(4096), UNIQUE(f)) ENGINE=InnoDB; ALTER TABLE t1 DROP KEY f, ADD INDEX idx1(f), ALGORITHM=INSTANT; ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY @@ -161,6 +217,9 @@ insert into t1 values(1,1); ERROR 23000: Duplicate entry '1-1' for key 'a' alter table t1 add column c int; drop table t1; +# +# MDEV-18889 Long unique on virtual fields crashes server +# create table t1(a blob , b blob as (a) unique); insert into t1 values(1, default); insert into t1 values(1, default); @@ -174,6 +233,9 @@ insert into t1(a,b) values(2,2); insert into t1(a,b) values(2,3); insert into t1(a,b) values(3,2); drop table t1; +# +# MDEV-18888 Server crashes in Item_field::register_field_in_read_map upon MODIFY COLUMN +# CREATE TABLE t1 ( a CHAR(128), b CHAR(128) AS (a), @@ -189,6 +251,9 @@ c varchar(5000), UNIQUE(c,b(64)) ) ENGINE=InnoDB; drop table t1; +# +# MDEV-18967 Load data in system version with long unique does not work +# CREATE TABLE t1 (data VARCHAR(4), unique(data) using hash) with system versioning; INSERT INTO t1 VALUES ('A'); SELECT * INTO OUTFILE 'load.data' from t1; @@ -198,6 +263,9 @@ select * from t1; data A DROP TABLE t1; +# +# MDEV-18901 Wrong results after ADD UNIQUE INDEX(blob_column) +# CREATE TABLE t1 (data VARCHAR(7961)) ENGINE=InnoDB; INSERT INTO t1 VALUES ('f'), ('o'), ('o'); SELECT * INTO OUTFILE 'load.data' from t1; @@ -216,12 +284,16 @@ SELECT * FROM t1; data f o +# This should be equivalent to the REPLACE above LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1; SELECT * FROM t1; data f o DROP TABLE t1; +# +# MDEV-18953 Hash index on partial char field not working +# create table t1 ( c char(10) character set utf8mb4, unique key a using hash (c(1)) @@ -229,19 +301,25 @@ unique key a using hash (c(1)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` char(10) CHARACTER SET utf8mb4 DEFAULT NULL, + `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, UNIQUE KEY `a` (`c`(1)) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('б'); insert into t1 values ('бб'); ERROR 23000: Duplicate entry '�' for key 'a' insert into t1 values ('ббб'); ERROR 23000: Duplicate entry '�' for key 'a' drop table t1; +# +# MDEV-18904 Assertion `m_part_spec.start_part >= m_part_spec.end_part' failed in ha_partition::index_read_idx_map +# CREATE TABLE t1 (a INT, UNIQUE USING HASH (a)) PARTITION BY HASH (a) PARTITIONS 2; INSERT INTO t1 VALUES (2); REPLACE INTO t1 VALUES (2); DROP TABLE t1; +# +# MDEV-18820 Assertion `lock_table_has(trx, index->table, LOCK_IX)' failed in lock_rec_insert_check_and_lock upon INSERT into table with blob key' +# set innodb_lock_wait_timeout= 10; CREATE TABLE t1 ( id int primary key, @@ -268,11 +346,20 @@ ERROR 40001: Deadlock found when trying to get lock; try restarting transaction disconnect con1; connection default; DROP TABLE t1, t2; +# +# MDEV-18791 Wrong error upon creating Aria table with long index on BLOB +# CREATE TABLE t1 (a TEXT, UNIQUE(a)) ENGINE=Aria; ERROR 42000: Specified key was too long; max key length is 2300 bytes +# +# MDEV-20001 Potential dangerous regression: INSERT INTO >=100 rows fail for myisam table with HASH indexes +# create table t1(a int, unique(a) using hash); #BULK insert > 100 rows (MI_MIN_ROWS_TO_DISABLE_INDEXES) drop table t1; +# +# MDEV-21804 Assertion `marked_for_read()' failed upon INSERT into table with long unique blob under binlog_row_image=NOBLOB +# SET binlog_row_image= NOBLOB; CREATE TABLE t1 (pk INT PRIMARY KEY, a text ,UNIQUE(a) using hash); INSERT INTO t1 VALUES (1,'foo'); @@ -280,6 +367,9 @@ create table t2(id int primary key, a blob, b varchar(20) as (LEFT(a,2))); INSERT INTO t2 VALUES (1, 'foo', default); DROP TABLE t1, t2; SET binlog_row_image= FULL; +# +# MDEV-22719 Long unique keys are not created when individual key_part->length < max_key_length but SUM(key_parts->length) > max_key_length +# CREATE TABLE t1 (a int, b VARCHAR(1000), UNIQUE (a,b)) ENGINE=MyISAM; 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 Ignored @@ -305,7 +395,73 @@ c 1 DELETE FROM t; DROP TABLE t; +# +# MDEV-28098 incorrect key in "dup value" error after long unique +# +create table t1 (v3 int primary key, v2 text(100) unique not null, v1 int unique) engine=innodb; +insert into t1 values ( -32768 , -128 , 58 ) , ( -1 , 44 , -128 ); +create table t2 (v6 int primary key, v5 text, a int not null) engine=innodb; +insert into t2 values ( 50 , 61 , -1 ) , ( -2147483648 , -128 , 0 ); +update t1 set v2 = 1, v3 = -128; +ERROR 23000: Duplicate entry '1' for key 'v2' +update t1,t2 set v1 = v2 , v5 = 0; +ERROR 23000: Duplicate entry '-128' for key 'v1' +drop table t1, t2; +# +# MDEV-23264 Unique blobs allow duplicate values upon UPDATE +# +CREATE TABLE t1 (f TEXT UNIQUE); +INSERT INTO t1 VALUES (NULL),(NULL); +UPDATE t1 SET f = ''; +ERROR 23000: Duplicate entry '' for key 'f' +SELECT * FROM t1; +f + +NULL +DROP TABLE t1; +# +# MDEV-21540 Initialization of already inited long unique index on reorganize partition +# +create table t1 (x int, a blob) +partition by range (x) ( +partition p1 values less than (50), +partition pn values less than maxvalue); +insert into t1 values (1, 1), (100, 1); +alter table t1 add unique key (a); +ERROR 23000: Duplicate entry '1' for key 'a' +update t1 set a= x; +alter table t1 add unique key (a); +update t1 set a= 1; +ERROR 23000: Duplicate entry '1' for key 'a' +update t1 set a= x + 1; +alter table t1 reorganize partition p1 into ( +partition n0 values less than (10), +partition n1 values less than (50)); +drop table t1; +# +# MDEV-29199 Unique hash key is ignored upon INSERT ... SELECT into non-empty MyISAM table +# +create table t1 (a int, b text, unique(b)) engine=MyISAM; +insert into t1 values (0,'aa'); +insert into t1 (a,b) select 1,'xxx' from seq_1_to_5; +ERROR 23000: Duplicate entry 'xxx' for key 'b' +select * from t1; +a b +0 aa +1 xxx +drop table t1; +# +# MDEV-22756 SQL Error (1364): Field 'DB_ROW_HASH_1' doesn't have a default value +# +create table t1 (f text not null, unique (f)); +insert into t1 (f) select 'f'; +drop table t1; +# # End of 10.4 tests +# +# +# MDEV-22113 SIGSEGV, ASAN use-after-poison, Assertion `next_insert_id == 0' in handler::ha_external_lock +# create temporary table tmp ( a int, b int, c blob not null, d int, e int default 0, f int, unique key (c)) engine=innodb; create table t2 (x int); lock table t2 write; @@ -314,6 +470,9 @@ start transaction; alter table tmp alter column a set default 8; unlock tables; drop table t2; +# +# MDEV-22218 InnoDB: Failing assertion: node->pcur->rel_pos == BTR_PCUR_ON upon LOAD DATA with NO_BACKSLASH_ESCAPES in SQL_MODE and unique blob in table +# create table t1 (pk int primary key, f blob, unique(f)) engine=innodb; insert t1 values (1, null); select * into outfile 't1.data' from t1; @@ -372,8 +531,13 @@ a b 1 foo 3 bar drop table if exists t1, t2; +# +# MDEV-22185 Failing assertion: node->pcur->rel_pos == BTR_PCUR_ON or ER_KEY_NOT_FOUND or Assertion `inited==NONE' failed in handler::ha_index_init +# create table t1 (a int, b int, unique (b) using hash) engine=innodb partition by key (a) partitions 2; insert into t1 values (1,10),(2,20); update t1 set b = 30 limit 1; drop table t1; +# # End of 10.5 tests +# diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test index 18bad7deac9b9..6fc29e1d2dd2d 100644 --- a/mysql-test/main/long_unique_bugs.test +++ b/mysql-test/main/long_unique_bugs.test @@ -1,9 +1,10 @@ --source include/have_innodb.inc --source include/have_partition.inc +--source include/have_sequence.inc -# -# MDEV-18707 Server crash in my_hash_sort_bin, ASAN heap-use-after-free in Field::is_null, server hang, corrupted double-linked list -# +--echo # +--echo # MDEV-18707 Server crash in my_hash_sort_bin, ASAN heap-use-after-free in Field::is_null, server hang, corrupted double-linked list +--echo # create table t1 (a int, b int, c int, d int, e int); insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(), @@ -20,18 +21,18 @@ drop table t1; --remove_file $datadir/test/load.data drop table tmp; -# -# MDEV-18712 InnoDB indexes are inconsistent with what defined in .frm for table after rebuilding table with index on blob -# +--echo # +--echo # MDEV-18712 InnoDB indexes are inconsistent with what defined in .frm for table after rebuilding table with index on blob +--echo # create table t1 (b blob) engine=innodb; alter table t1 add unique (b); alter table t1 force; show create table t1; drop table t1; -# -# MDEV-18713 Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed in test_if_reopen upon REPLACE into table with key on blob -# +--echo # +--echo # MDEV-18713 Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed in test_if_reopen upon REPLACE into table with key on blob +--echo # create table t1 (pk int, b blob, primary key(pk), unique(b)) engine=myisam; insert into t1 values (1,'foo'); replace into t1 (pk) values (1); @@ -39,17 +40,17 @@ alter table t1 force; replace into t1 (pk) values (1); drop table t1; -# -# MDEV-18722 Assertion `templ->mysql_null_bit_mask' failed in row_sel_store_mysql_rec upon modifying indexed column into blob -# +--echo # +--echo # MDEV-18722 Assertion `templ->mysql_null_bit_mask' failed in row_sel_store_mysql_rec upon modifying indexed column into blob +--echo # create table t1 (t time, unique(t)) engine=innodb; insert into t1 values (null),(null); alter ignore table t1 modify t text not null default ''; drop table t1; -# -# MDEV-18720 Assertion `inited==NONE' failed in ha_index_init upon update on versioned table with key on blob -# +--echo # +--echo # MDEV-18720 Assertion `inited==NONE' failed in ha_index_init upon update on versioned table with key on blob +--echo # create table t1 ( pk int, f text, primary key (pk), unique(f)) with system versioning; insert into t1 values (1,'foo'); update t1 set f = 'bar'; @@ -59,25 +60,25 @@ select * from t1; select pk, f, row_end > DATE'2030-01-01' from t1 for system_time all; drop table t1; -# -# MDEV-18747 InnoDB: Failing assertion: table->get_ref_count() == 0 upon dropping temporary table with unique blob -# +--echo # +--echo # MDEV-18747 InnoDB: Failing assertion: table->get_ref_count() == 0 upon dropping temporary table with unique blob +--echo # create temporary table t1 (f blob, unique(f)) engine=innodb; insert into t1 values (1); replace into t1 values (1); drop table t1; -# -# MDEV-18748 REPLACE doesn't work with unique blobs on MyISAM table -# +--echo # +--echo # MDEV-18748 REPLACE doesn't work with unique blobs on MyISAM table +--echo # create table t (b blob, unique(b)) engine=myisam; insert into t values ('foo'); replace into t values ('foo'); drop table t; -# -# MDEV-18790 Server crash in fields_in_hash_keyinfo after unsuccessful attempt to drop BLOB with long index -# +--echo # +--echo # MDEV-18790 Server crash in fields_in_hash_keyinfo after unsuccessful attempt to drop BLOB with long index +--echo # CREATE TABLE t1 (f INT, x BLOB, UNIQUE (x)); INSERT INTO t1 VALUES (1,'foo'); --error ER_ALTER_OPERATION_NOT_SUPPORTED @@ -85,9 +86,9 @@ ALTER TABLE t1 DROP x, ALGORITHM=INPLACE; UPDATE t1 SET x = 'bar'; DROP TABLE t1; -# -# MDEV-18799 Long unique does not work after failed alter table -# +--echo # +--echo # MDEV-18799 Long unique does not work after failed alter table +--echo # create table t1(a blob unique , b blob); insert into t1 values(1,1),(2,1); --error ER_DUP_ENTRY @@ -97,28 +98,28 @@ alter table t1 add unique(b); insert into t1 values(1,1); DROP TABLE t1; -# -# MDEV-18792 ASAN unknown-crash in _mi_pack_key upon UPDATE after failed ALTER on a table with long BLOB key -# +--echo # +--echo # MDEV-18792 ASAN unknown-crash in _mi_pack_key upon UPDATE after failed ALTER on a table with long BLOB key +--echo # CREATE TABLE t1 (a TEXT, b INT, UNIQUE(a)) ENGINE=MyISAM; --error ER_CANT_DROP_FIELD_OR_KEY ALTER TABLE t1 DROP x; UPDATE t1 SET b = 0 WHERE a = 'foo'; DROP TABLE t1; -# -# MDEV-18793 Assertion `0' failed in row_sel_convert_mysql_key_to_innobase, ASAN unknown-crash in -# row_mysql_store_col_in_innobase_format, warning " InnoDB: Using a partial-field key prefix in search" -# +--echo # +--echo # MDEV-18793 Assertion `0' failed in row_sel_convert_mysql_key_to_innobase, ASAN unknown-crash in +--echo # row_mysql_store_col_in_innobase_format, warning " InnoDB: Using a partial-field key prefix in search" +--echo # CREATE TABLE t1 (a TEXT, b INT, UNIQUE(a)) ENGINE=InnoDB; --error ER_CANT_DROP_FIELD_OR_KEY ALTER TABLE t1 DROP x; UPDATE t1 SET b = 0 WHERE a = 'foo'; DROP TABLE t1; -# -# MDEV-18795 InnoDB: Failing assertion: field->prefix_len > 0 upon DML on table with BLOB index -# +--echo # +--echo # MDEV-18795 InnoDB: Failing assertion: field->prefix_len > 0 upon DML on table with BLOB index +--echo # CREATE TEMPORARY TABLE t1 (f BLOB, UNIQUE(f)) ENGINE=InnoDB ROW_FORMAT=COMPACT; --error ER_INDEX_COLUMN_TOO_LONG ALTER TABLE t1 ADD KEY (f); @@ -126,36 +127,36 @@ TRUNCATE TABLE t1; SELECT * FROM t1 WHERE f LIKE 'foo'; DROP TABLE t1; -# -# MDEV-18798 InnoDB: No matching column for `DB_ROW_HASH_1`and server crash in -# ha_innobase::commit_inplace_alter_table upon ALTER on table with UNIQUE key -# +--echo # +--echo # MDEV-18798 InnoDB: No matching column for `DB_ROW_HASH_1`and server crash in +--echo # ha_innobase::commit_inplace_alter_table upon ALTER on table with UNIQUE key +--echo # CREATE TABLE t1 (a INT, UNIQUE ind USING HASH (a)) ENGINE=InnoDB; ALTER TABLE t1 CHANGE COLUMN IF EXISTS b a INT; DROP TABLE t1; -# -# MDEV-18801 InnoDB: Failing assertion: field->col->mtype == type or ASAN heap-buffer-overflow -# in row_sel_convert_mysql_key_to_innobase upon SELECT on table with long index -# +--echo # +--echo # MDEV-18801 InnoDB: Failing assertion: field->col->mtype == type or ASAN heap-buffer-overflow +--echo # in row_sel_convert_mysql_key_to_innobase upon SELECT on table with long index +--echo # CREATE TABLE t1 (f VARCHAR(4096), UNIQUE(f)) ENGINE=InnoDB; --error ER_CANT_DROP_FIELD_OR_KEY ALTER TABLE t1 DROP x; SELECT * FROM t1 WHERE f LIKE 'foo'; DROP TABLE t1; -# -# MDEV-18800 Server crash in instant_alter_column_possible or -# Assertion `!pk->has_virtual()' failed in instant_alter_column_possible upon adding key -# +--echo # +--echo # MDEV-18800 Server crash in instant_alter_column_possible or +--echo # Assertion `!pk->has_virtual()' failed in instant_alter_column_possible upon adding key +--echo # CREATE TABLE t1 (pk INT, PRIMARY KEY USING HASH (pk)) ENGINE=InnoDB; --query_vertical show keys from t1; ALTER TABLE t1 ADD INDEX (pk); DROP TABLE t1; -# -# MDEV-18922 Alter on long unique varchar column makes result null -# +--echo # +--echo # MDEV-18922 Alter on long unique varchar column makes result null +--echo # CREATE TABLE t1 (b int, a varchar(4000)); INSERT INTO t1 VALUES (1, 2),(2,3),(3,4); ALTER TABLE t1 ADD UNIQUE INDEX (a); @@ -163,10 +164,10 @@ SELECT * FROM t1; SELECT a FROM t1; drop table t1; -# -# MDEV-18809 Server crash in fields_in_hash_keyinfo or Assertion `key_info->key_part->field->flags -# & (1<< 30)' failed in setup_keyinfo_hash -# +--echo # +--echo # MDEV-18809 Server crash in fields_in_hash_keyinfo or Assertion `key_info->key_part->field->flags +--echo # & (1<< 30)' failed in setup_keyinfo_hash +--echo # CREATE TABLE t1 (f VARCHAR(4096), UNIQUE(f)) ENGINE=InnoDB; --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON ALTER TABLE t1 DROP KEY f, ADD INDEX idx1(f), ALGORITHM=INSTANT; @@ -181,9 +182,9 @@ insert into t1 values(1,1); alter table t1 add column c int; drop table t1; -# -# MDEV-18889 Long unique on virtual fields crashes server -# +--echo # +--echo # MDEV-18889 Long unique on virtual fields crashes server +--echo # create table t1(a blob , b blob as (a) unique); insert into t1 values(1, default); --error ER_DUP_ENTRY @@ -199,9 +200,9 @@ insert into t1(a,b) values(2,3); insert into t1(a,b) values(3,2); drop table t1; -# -# MDEV-18888 Server crashes in Item_field::register_field_in_read_map upon MODIFY COLUMN -# +--echo # +--echo # MDEV-18888 Server crashes in Item_field::register_field_in_read_map upon MODIFY COLUMN +--echo # CREATE TABLE t1 ( a CHAR(128), b CHAR(128) AS (a), @@ -218,9 +219,9 @@ CREATE TABLE t1 ( ) ENGINE=InnoDB; drop table t1; -# -# MDEV-18967 Load data in system version with long unique does not work -# +--echo # +--echo # MDEV-18967 Load data in system version with long unique does not work +--echo # CREATE TABLE t1 (data VARCHAR(4), unique(data) using hash) with system versioning; INSERT INTO t1 VALUES ('A'); SELECT * INTO OUTFILE 'load.data' from t1; @@ -231,10 +232,9 @@ DROP TABLE t1; --let $datadir= `select @@datadir` --remove_file $datadir/test/load.data -# -# MDEV-18901 Wrong results after ADD UNIQUE INDEX(blob_column) -# ---source include/have_innodb.inc +--echo # +--echo # MDEV-18901 Wrong results after ADD UNIQUE INDEX(blob_column) +--echo # CREATE TABLE t1 (data VARCHAR(7961)) ENGINE=InnoDB; INSERT INTO t1 VALUES ('f'), ('o'), ('o'); @@ -246,16 +246,16 @@ ALTER TABLE t1 ADD SYSTEM VERSIONING ; SELECT * FROM t1; REPLACE INTO t1 VALUES ('f'), ('o'), ('o'); SELECT * FROM t1; -# This should be equivalent to the REPLACE above +--echo # This should be equivalent to the REPLACE above LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1; SELECT * FROM t1; DROP TABLE t1; --let $datadir= `select @@datadir` --remove_file $datadir/test/load.data -# -# MDEV-18953 Hash index on partial char field not working -# +--echo # +--echo # MDEV-18953 Hash index on partial char field not working +--echo # create table t1 ( c char(10) character set utf8mb4, unique key a using hash (c(1)) @@ -268,19 +268,18 @@ insert into t1 values ('бб'); insert into t1 values ('ббб'); drop table t1; -# -# MDEV-18904 Assertion `m_part_spec.start_part >= m_part_spec.end_part' failed in ha_partition::index_read_idx_map -# +--echo # +--echo # MDEV-18904 Assertion `m_part_spec.start_part >= m_part_spec.end_part' failed in ha_partition::index_read_idx_map +--echo # CREATE TABLE t1 (a INT, UNIQUE USING HASH (a)) PARTITION BY HASH (a) PARTITIONS 2; INSERT INTO t1 VALUES (2); REPLACE INTO t1 VALUES (2); DROP TABLE t1; -# -# MDEV-18820 Assertion `lock_table_has(trx, index->table, LOCK_IX)' failed in lock_rec_insert_check_and_lock upon INSERT into table with blob key' -# +--echo # +--echo # MDEV-18820 Assertion `lock_table_has(trx, index->table, LOCK_IX)' failed in lock_rec_insert_check_and_lock upon INSERT into table with blob key' +--echo # ---source include/have_innodb.inc set innodb_lock_wait_timeout= 10; CREATE TABLE t1 ( @@ -319,15 +318,15 @@ INSERT IGNORE INTO t1 VALUES (4, 1)/*4*/; --connection default DROP TABLE t1, t2; -# -# MDEV-18791 Wrong error upon creating Aria table with long index on BLOB -# +--echo # +--echo # MDEV-18791 Wrong error upon creating Aria table with long index on BLOB +--echo # --error ER_TOO_LONG_KEY CREATE TABLE t1 (a TEXT, UNIQUE(a)) ENGINE=Aria; -# -# MDEV-20001 Potential dangerous regression: INSERT INTO >=100 rows fail for myisam table with HASH indexes -# +--echo # +--echo # MDEV-20001 Potential dangerous regression: INSERT INTO >=100 rows fail for myisam table with HASH indexes +--echo # create table t1(a int, unique(a) using hash); --let $count=150 --let insert_stmt= insert into t1 values(200) @@ -342,9 +341,9 @@ while ($count) --enable_query_log drop table t1; -# -# MDEV-21804 Assertion `marked_for_read()' failed upon INSERT into table with long unique blob under binlog_row_image=NOBLOB -# +--echo # +--echo # MDEV-21804 Assertion `marked_for_read()' failed upon INSERT into table with long unique blob under binlog_row_image=NOBLOB +--echo # --source include/have_binlog_format_row.inc SET binlog_row_image= NOBLOB; @@ -354,20 +353,17 @@ INSERT INTO t1 VALUES (1,'foo'); create table t2(id int primary key, a blob, b varchar(20) as (LEFT(a,2))); INSERT INTO t2 VALUES (1, 'foo', default); -# Cleanup DROP TABLE t1, t2; SET binlog_row_image= FULL; -# -# MDEV-22719 Long unique keys are not created when individual key_part->length < max_key_length but SUM(key_parts->length) > max_key_length -# +--echo # +--echo # MDEV-22719 Long unique keys are not created when individual key_part->length < max_key_length but SUM(key_parts->length) > max_key_length +--echo # CREATE TABLE t1 (a int, b VARCHAR(1000), UNIQUE (a,b)) ENGINE=MyISAM; show index from t1; CREATE TABLE t2 (a varchar(900), b VARCHAR(900), UNIQUE (a,b)) ENGINE=MyISAM; show index from t2; - -# Cleanup DROP TABLE t1,t2; --echo # @@ -386,11 +382,81 @@ DELETE FROM t; DROP TABLE t; +--echo # +--echo # MDEV-28098 incorrect key in "dup value" error after long unique +--echo # +create table t1 (v3 int primary key, v2 text(100) unique not null, v1 int unique) engine=innodb; +insert into t1 values ( -32768 , -128 , 58 ) , ( -1 , 44 , -128 ); +create table t2 (v6 int primary key, v5 text, a int not null) engine=innodb; +insert into t2 values ( 50 , 61 , -1 ) , ( -2147483648 , -128 , 0 ); +--error ER_DUP_ENTRY +update t1 set v2 = 1, v3 = -128; +--error ER_DUP_ENTRY +update t1,t2 set v1 = v2 , v5 = 0; +drop table t1, t2; + +--echo # +--echo # MDEV-23264 Unique blobs allow duplicate values upon UPDATE +--echo # + +CREATE TABLE t1 (f TEXT UNIQUE); +INSERT INTO t1 VALUES (NULL),(NULL); +--error ER_DUP_ENTRY +UPDATE t1 SET f = ''; +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-21540 Initialization of already inited long unique index on reorganize partition +--echo # +create table t1 (x int, a blob) +partition by range (x) ( + partition p1 values less than (50), + partition pn values less than maxvalue); + +insert into t1 values (1, 1), (100, 1); + +# a little bit of additional checks +--error ER_DUP_ENTRY +alter table t1 add unique key (a); + +update t1 set a= x; +alter table t1 add unique key (a); +--error ER_DUP_ENTRY +update t1 set a= 1; +update t1 set a= x + 1; + +# bug failure +alter table t1 reorganize partition p1 into ( + partition n0 values less than (10), + partition n1 values less than (50)); + +drop table t1; + +--echo # +--echo # MDEV-29199 Unique hash key is ignored upon INSERT ... SELECT into non-empty MyISAM table +--echo # +create table t1 (a int, b text, unique(b)) engine=MyISAM; +insert into t1 values (0,'aa'); +--error ER_DUP_ENTRY +insert into t1 (a,b) select 1,'xxx' from seq_1_to_5; +select * from t1; +drop table t1; + +--echo # +--echo # MDEV-22756 SQL Error (1364): Field 'DB_ROW_HASH_1' doesn't have a default value +--echo # +create table t1 (f text not null, unique (f)); +insert into t1 (f) select 'f'; +drop table t1; + +--echo # --echo # End of 10.4 tests +--echo # -# -# MDEV-22113 SIGSEGV, ASAN use-after-poison, Assertion `next_insert_id == 0' in handler::ha_external_lock -# +--echo # +--echo # MDEV-22113 SIGSEGV, ASAN use-after-poison, Assertion `next_insert_id == 0' in handler::ha_external_lock +--echo # create temporary table tmp ( a int, b int, c blob not null, d int, e int default 0, f int, unique key (c)) engine=innodb; create table t2 (x int); lock table t2 write; @@ -401,9 +467,9 @@ unlock tables; drop table t2; --source include/have_innodb.inc -# -# MDEV-22218 InnoDB: Failing assertion: node->pcur->rel_pos == BTR_PCUR_ON upon LOAD DATA with NO_BACKSLASH_ESCAPES in SQL_MODE and unique blob in table -# +--echo # +--echo # MDEV-22218 InnoDB: Failing assertion: node->pcur->rel_pos == BTR_PCUR_ON upon LOAD DATA with NO_BACKSLASH_ESCAPES in SQL_MODE and unique blob in table +--echo # create table t1 (pk int primary key, f blob, unique(f)) engine=innodb; insert t1 values (1, null); select * into outfile 't1.data' from t1; @@ -449,12 +515,14 @@ create or replace table t2 (a int, b blob, unique(b)) replace as select * from t drop table if exists t1, t2; -# -# MDEV-22185 Failing assertion: node->pcur->rel_pos == BTR_PCUR_ON or ER_KEY_NOT_FOUND or Assertion `inited==NONE' failed in handler::ha_index_init -# +--echo # +--echo # MDEV-22185 Failing assertion: node->pcur->rel_pos == BTR_PCUR_ON or ER_KEY_NOT_FOUND or Assertion `inited==NONE' failed in handler::ha_index_init +--echo # create table t1 (a int, b int, unique (b) using hash) engine=innodb partition by key (a) partitions 2; insert into t1 values (1,10),(2,20); update t1 set b = 30 limit 1; drop table t1; +--echo # --echo # End of 10.5 tests +--echo # diff --git a/mysql-test/main/long_unique_innodb.result b/mysql-test/main/long_unique_innodb.result index 96e5fac7310a8..8ed45ce6b103d 100644 --- a/mysql-test/main/long_unique_innodb.result +++ b/mysql-test/main/long_unique_innodb.result @@ -11,7 +11,7 @@ t1 CREATE TABLE `t1` ( `c` int(11) DEFAULT NULL, UNIQUE KEY `c` (`c`), UNIQUE KEY `a` (`a`) USING HASH -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; #test for concurrent insert of long unique in innodb create table t1(a blob unique) engine= InnoDB; @@ -20,7 +20,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` blob DEFAULT NULL, UNIQUE KEY `a` (`a`) USING HASH -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connect 'con1', localhost, root,,; connect 'con2', localhost, root,,; connection con1; diff --git a/mysql-test/main/long_unique_update.result b/mysql-test/main/long_unique_update.result index 1741ec5310a57..acc872305aa6f 100644 --- a/mysql-test/main/long_unique_update.result +++ b/mysql-test/main/long_unique_update.result @@ -225,7 +225,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `b` (`b`,`c`) USING HASH, UNIQUE KEY `e` (`e`,`g`) USING HASH, UNIQUE KEY `a` (`a`,`b`,`c`,`d`,`e`,`f`,`g`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 0 PRIMARY 1 a A 0 NULL NULL BTREE NO diff --git a/mysql-test/main/lowercase_fs_off.result b/mysql-test/main/lowercase_fs_off.result index 0d79db02fc7c2..98b7a8c7c3838 100644 --- a/mysql-test/main/lowercase_fs_off.result +++ b/mysql-test/main/lowercase_fs_off.result @@ -27,7 +27,7 @@ CREATE TABLE t1(f1 INT); GRANT SELECT ON T1 to user_1@localhost; connect con1,localhost,user_1,,d1; select * from t1; -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `d1`.`t1` select * from T1; f1 connection default; diff --git a/mysql-test/main/lowercase_table.result b/mysql-test/main/lowercase_table.result index 3d840445bf292..49468793d0253 100644 --- a/mysql-test/main/lowercase_table.result +++ b/mysql-test/main/lowercase_table.result @@ -95,7 +95,7 @@ show create table İ; Table Create Table İ CREATE TABLE `i` ( `s1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show tables; Tables_in_test i @@ -105,7 +105,7 @@ show create table İİ; Table Create Table İİ CREATE TABLE `ii` ( `s1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show tables; Tables_in_test ii @@ -121,12 +121,12 @@ create database mysql_TEST character set latin2; create table mysql_TEST.T1 (a int); show create database mysql_TEST; Database Create Database -mysql_TEST CREATE DATABASE `mysql_test` /*!40100 DEFAULT CHARACTER SET latin2 */ +mysql_TEST CREATE DATABASE `mysql_test` /*!40100 DEFAULT CHARACTER SET latin2 COLLATE latin2_general_ci */ show create table mysql_TEST.T1; Table Create Table T1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin2 +) ENGINE=MyISAM DEFAULT CHARSET=latin2 COLLATE=latin2_general_ci show databases like "mysql%"; Database (mysql%) mysql diff --git a/mysql-test/main/lowercase_table.test b/mysql-test/main/lowercase_table.test index 4f92e43f5f7f0..8d493fff5cdc0 100644 --- a/mysql-test/main/lowercase_table.test +++ b/mysql-test/main/lowercase_table.test @@ -2,6 +2,9 @@ # Test of --lower-case-table-names # +#remove this include after fix MDEV-27944 +--source include/no_view_protocol.inc + create table T1 (id int primary key, Word varchar(40) not null, Index(Word)); create table t4 (id int primary key, Word varchar(40) not null); INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c'); diff --git a/mysql-test/main/lowercase_table5.result b/mysql-test/main/lowercase_table5.result index de46db3593bf5..f2b5bb0cf2b4d 100644 --- a/mysql-test/main/lowercase_table5.result +++ b/mysql-test/main/lowercase_table5.result @@ -1,13 +1,13 @@ CREATE DATABASE mysql_TEST CHARACTER SET utf8; SHOW CREATE DATABASE mysql_TEST; Database Create Database -mysql_TEST CREATE DATABASE `mysql_TEST` /*!40100 DEFAULT CHARACTER SET utf8mb3 */ +mysql_TEST CREATE DATABASE `mysql_TEST` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */ CREATE DATABASE mysql_test CHARACTER SET latin2; SHOW CREATE DATABASE mysql_test; Database Create Database -mysql_test CREATE DATABASE `mysql_test` /*!40100 DEFAULT CHARACTER SET latin2 */ +mysql_test CREATE DATABASE `mysql_test` /*!40100 DEFAULT CHARACTER SET latin2 COLLATE latin2_general_ci */ SHOW CREATE DATABASE mysql_TEST; Database Create Database -mysql_TEST CREATE DATABASE `mysql_TEST` /*!40100 DEFAULT CHARACTER SET utf8mb3 */ +mysql_TEST CREATE DATABASE `mysql_TEST` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */ DROP DATABASE mysql_test; DROP DATABASE mysql_TEST; diff --git a/mysql-test/main/lowercase_table_qcache.test b/mysql-test/main/lowercase_table_qcache.test index bf24c8e9a1c0f..b6047a98c748a 100644 --- a/mysql-test/main/lowercase_table_qcache.test +++ b/mysql-test/main/lowercase_table_qcache.test @@ -2,6 +2,8 @@ # # Test of query cache with --lower-case-table-names # +-- source include/no_view_protocol.inc + set @save_query_cache_size=@@query_cache_size; set GLOBAL query_cache_size=1355776; set GLOBAL query_cache_type=ON; diff --git a/mysql-test/main/mdev-25830.result b/mysql-test/main/mdev-25830.result new file mode 100644 index 0000000000000..e62d1ff3f551d --- /dev/null +++ b/mysql-test/main/mdev-25830.result @@ -0,0 +1,56 @@ +SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB'; +set @innodb_stats_persistent_save= @@innodb_stats_persistent; +set @innodb_stats_persistent_sample_pages_save= +@@innodb_stats_persistent_sample_pages; +set global innodb_stats_persistent= 1; +set global innodb_stats_persistent_sample_pages=100; +set optimizer_use_condition_selectivity=1; +analyze SELECT sysapproval_approver0.`sys_id` +FROM ((sysapproval_approver sysapproval_approver0 +INNER JOIN task task1 +ON sysapproval_approver0.`sysapproval` = task1.`sys_id` + AND (( task1.`sys_domain_path` = '/' + OR task1.`sys_domain_path` LIKE '!!!/!!#/!!$/%' + OR task1.`sys_domain_path` LIKE '!!!/!!!/%' ))) +INNER JOIN task task2 +ON task1.`parent` = task2.`sys_id` + AND (( task2.`sys_domain_path` = '/' + OR task2.`sys_domain_path` LIKE '!!!/!!#/!!$/%' + OR task2.`sys_domain_path` LIKE '!!!/!!!/%' ))) +WHERE task2.`sys_id` LIKE '8e7792a7dbfffb00fff8a345ca961934%' + AND ( sysapproval_approver0.`sys_domain_path` = '/' + OR sysapproval_approver0.`sys_domain_path` LIKE '!!!/!!#/!!$/%' + OR sysapproval_approver0.`sys_domain_path` LIKE '!!!/!!!/%' ) +ORDER BY sysapproval_approver0.`order` +LIMIT 0, 50 ; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE task2 range PRIMARY,sys_class_name_2,sys_domain_path PRIMARY 96 NULL 1 0.00 100.00 100.00 Using where; Using temporary; Using filesort +1 SIMPLE task1 ref PRIMARY,task_parent,sys_class_name_2,sys_domain_path task_parent 99 test.task2.sys_id 1 NULL 100.00 NULL Using index condition; Using where +1 SIMPLE sysapproval_approver0 ref sysapproval_approver_ref5,sys_domain_path,sysapproval_approver_CHG1975376 sysapproval_approver_ref5 99 test.task1.sys_id 1 NULL 100.00 NULL Using index condition; Using where +set optimizer_use_condition_selectivity=4; +analyze SELECT sysapproval_approver0.`sys_id` +FROM ((sysapproval_approver sysapproval_approver0 +INNER JOIN task task1 +ON sysapproval_approver0.`sysapproval` = task1.`sys_id` + AND (( task1.`sys_domain_path` = '/' + OR task1.`sys_domain_path` LIKE '!!!/!!#/!!$/%' + OR task1.`sys_domain_path` LIKE '!!!/!!!/%' ))) +INNER JOIN task task2 +ON task1.`parent` = task2.`sys_id` + AND (( task2.`sys_domain_path` = '/' + OR task2.`sys_domain_path` LIKE '!!!/!!#/!!$/%' + OR task2.`sys_domain_path` LIKE '!!!/!!!/%' ))) +WHERE task2.`sys_id` LIKE '8e7792a7dbfffb00fff8a345ca961934%' + AND ( sysapproval_approver0.`sys_domain_path` = '/' + OR sysapproval_approver0.`sys_domain_path` LIKE '!!!/!!#/!!$/%' + OR sysapproval_approver0.`sys_domain_path` LIKE '!!!/!!!/%' ) +ORDER BY sysapproval_approver0.`order` +LIMIT 0, 50 ; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE task2 range PRIMARY,sys_class_name_2,sys_domain_path PRIMARY 96 NULL 1 0.00 98.00 100.00 Using where; Using temporary; Using filesort +1 SIMPLE task1 ref PRIMARY,task_parent,sys_class_name_2,sys_domain_path task_parent 99 test.task2.sys_id 1 NULL 100.00 NULL Using index condition; Using where +1 SIMPLE sysapproval_approver0 ref sysapproval_approver_ref5,sys_domain_path,sysapproval_approver_CHG1975376 sysapproval_approver_ref5 99 test.task1.sys_id 1 NULL 100.00 NULL Using index condition; Using where +drop table sysapproval_approver,task; +set global innodb_stats_persistent= @innodb_stats_persistent_save; +set global innodb_stats_persistent_sample_pages= +@innodb_stats_persistent_sample_pages_save; diff --git a/mysql-test/main/mdev-25830.test b/mysql-test/main/mdev-25830.test new file mode 100644 index 0000000000000..5521d1fad85be --- /dev/null +++ b/mysql-test/main/mdev-25830.test @@ -0,0 +1,104 @@ +# +# MDEV-25830: optimizer_use_condition_selectivity=4 sometimes produces worse plan than optimizer_use_condition_selectivity=1 +# https://jira.mariadb.org/browse/MDEV-25830 +# +--source include/innodb_prefix_index_cluster_optimization.inc + +SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB'; + +set @innodb_stats_persistent_save= @@innodb_stats_persistent; +set @innodb_stats_persistent_sample_pages_save= + @@innodb_stats_persistent_sample_pages; + +set global innodb_stats_persistent= 1; +set global innodb_stats_persistent_sample_pages=100; + +--disable_query_log +--disable_result_log +--disable_warnings + +DROP TABLE IF EXISTS `sysapproval_approver`; +CREATE TABLE `sysapproval_approver` ( + `order` int(11) DEFAULT NULL, + `sysapproval` varchar(32) DEFAULT NULL, + `sys_id` char(32) NOT NULL DEFAULT '', + `sys_domain_path` varchar(255) DEFAULT NULL, + PRIMARY KEY (`sys_id`), + KEY `sysapproval_approver_ref5` (`sysapproval`), + KEY `sys_domain_path` (`sys_domain_path`), + KEY `sysapproval_approver_CHG1975376` (`sys_domain_path`,`sysapproval`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO `sysapproval_approver` VALUES (NULL,'c00004d787a8a5003fff83bdff434dea','000004d787a8a5003fff83bdff434dee','!!!/!!#/!!$/'),(NULL,NULL,'00000741db8bfb480be6a345ca96198e','!!!/!!#/!!$/'),(NULL,NULL,'00001605dbce48d0f7fca851ca961967','!!!/!!#/!!$/'),(NULL,'23b53105db2f324c5a4af85e0f96194e','000016c1db6ffa445d2f7aa31f9619a0','!!!/!!#/!!$/'),(NULL,NULL,'00001730dbe24890f7fca851ca9619aa','!!!/!!#/!!$/'),(NULL,NULL,'000017a01b127b00ada243f6fe4bcb8c','!!!/!!#/!!$/'),(NULL,'7f660139db6088185ed4a851ca961986','00001ab1dbecc8185ed4a851ca961970','!!!/!!#/!!$/'),(NULL,'6226cd801b19dc10a59033f2cd4bcb22','00001d84db9918505ed4a851ca96193f','!!!/!!!/(8]/'),(NULL,NULL,'00002246db83874002f17c541f961999','!!!/!!#/!!$/'),(NULL,NULL,'000026e01b9eb700ada243f6fe4bcbc5','!!!/!!#/!!$/'),(NULL,NULL,'000028e16f064e807b658e4c2c3ee4ae','!!!/!!#/!!$/'),(NULL,NULL,'00002914dba8670c54250b55ca961928','!!!/!!#/!!$/'),(NULL,NULL,'00002914dba8670c54250b55ca961931','!!!/!!#/!!$/'),(NULL,NULL,'00002914dba8670c54250b55ca96193a','!!!/!!#/!!$/'),(NULL,NULL,'00002914dba8670c54250b55ca961943','!!!/!!#/!!$/'),(NULL,NULL,'000030a4dbb90b40002af47e0f9619b1','!!!/!!#/!!$/'),(NULL,NULL,'000033fedb41fb041cd8a345ca9619fa','!!!/!!#/!!$/'),(NULL,NULL,'0000341ddb4ce3804ac3a851ca961916','!!!/!!#/!!$/'),(NULL,NULL,'0000393ddb709b002b6dfb651f961908','!!!/!!#/!!$/'),(NULL,'a81ca740db5cdc9416d2a345ca9619b3','00003b00dbdcdc9416d2a345ca961907','!!!/!!#/!!$/'),(NULL,'04003c88db5e3304d6a102d5ca961913','00003c88db5e3304d6a102d5ca96192a','!!!/!!#/!!$/'),(NULL,'4affb00cdbbf0f800e3dfb651f9619a0','0000450cdbbf0f800e3dfb651f961973','!!!/!!#/!!$/'),(NULL,NULL,'00005634dbd11fc4e9737a9e0f961988','!!!/!!#/!!$/'),(NULL,NULL,'00005634dbd11fc4e9737a9e0f9619ce','!!!/!!#/!!$/'),(NULL,NULL,'00005634dbd11fc4e9737a9e0f9619d7','!!!/!!#/!!$/'),(NULL,NULL,'00005784dbc49b00852c7a9e0f96198a','!!!/!!#/!!$/'),(NULL,NULL,'00005bc1dbcdd7042d1efb651f961978','!!!/!!#/!!$/'),(NULL,NULL,'0000637b6f37c24013568e4c2c3ee4d6','!!!/!!#/!!$/'),(NULL,'080069db0f858240a2c9982be1050eae','000069db0f858240a2c9982be1050eb2','!!!/!!#/!!$/'),(NULL,'f98e3bb21b155c10a59033f2cd4bcbef','00006c47db5d9010d82ffb24399619d8','!!!/!!!/#YZ/'),(NULL,NULL,'00006c50db6a0450d58ea345ca961972','!!!/!!#/!!$/'),(NULL,NULL,'00006e38dbc19304032a7a9e0f9619e4','!!!/!!#/!!$/'),(NULL,NULL,'00006edddbec8c5813b5fb24399619b9','!!!/!!#/!!$/'),(NULL,NULL,'000073fedb41fb041cd8a345ca961934','!!!/!!#/!!$/'),(NULL,NULL,'000073fedb41fb041cd8a345ca96195c','!!!/!!#/!!$/'),(NULL,'d03c6ee61b774410a59033f2cd4bcbf5','000076bfdbb74c981cd8a345ca9619ee','!!!/!!!/!;B/'),(NULL,NULL,'000076ecdbde48502be0a851ca9619dd','!!!/!!#/!!$/'),(NULL,NULL,'000076ecdbde48502be0a851ca9619fe','!!!/!!#/!!$/'),(NULL,NULL,'0000778d6fd01a4000270bae9f3ee4ff','!!!/!!#/!!$/'),(NULL,NULL,'000077c21b3fbb0cada243f6fe4bcba7','!!!/!!#/!!$/'),(NULL,NULL,'000077c21b3fbb0cada243f6fe4bcbcb','!!!/!!#/!!$/'),(NULL,'f6c5f2110f75de401c7e938172050e1b','000077e10f7d5e00e59b982be1050e62','!!!/!!#/!!$/'),(NULL,NULL,'00007fa76ff70a0000270bae9f3ee4b1','!!!/!!#/!!$/'),(NULL,'73ff6fe76f4761007ceff7307f3ee478','00007fe76f4761007ceff7307f3ee47c','!!!/!!#/!!$/'),(NULL,'a4d63f4bdb8fbf00414ed0c5ca96191d','0000881b1b8f7f00fff162c4bd4bcbe7','!!!/!!!/$)(/'),(NULL,'a4d63f4bdb8fbf00414ed0c5ca96191d','0000881b1b8f7f00fff162c4bd4bcbec','!!!/!!!/$)(/'),(NULL,NULL,'000094eb6f781a0099c5409e9f3ee48e','!!!/!!#/!!$/'),(NULL,NULL,'000094eb6f781a0099c5409e9f3ee493','!!!/!!#/!!$/'),(NULL,'401fb78cdb18d8dc1cd8a345ca9619c8','00009c10dbdc98dcfeb1a851ca96192f','!!!/!!!/$$8/'),(NULL,'9dd30a24db5c1cdc23f4a345ca96192b','00009e2cdb1c589c4819fb243996195c','!!!/!!#/!!$/'); + +DROP TABLE IF EXISTS `task`; +CREATE TABLE `task` ( + `parent` varchar(32) DEFAULT NULL, + `sys_id` char(32) NOT NULL DEFAULT '', + `sys_domain_path` varchar(255) DEFAULT NULL, + PRIMARY KEY (`sys_id`), + KEY `task_parent` (`parent`), + KEY `sys_class_name_2` (`sys_domain_path`), + KEY `sys_domain_path` (`sys_domain_path`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO `task` VALUES (NULL,'-1','!!!/!!#/!!$/'),(NULL,'00000195dbe7f30413b5fb2439961936','!!!/!!#/!!$/'),(NULL,'0000032edb160f04d7e37aa31f961964','!!!/!!#/!!$/'),('a6fe0637dbddfb8c1cd8a345ca96196f','000003dcdb31f3c0a39a0b55ca961916','!!!/!!#/!!$/'),('2f1df65d6fca3100e7f68e4c2c3ee4e6','000004466f127d40e7f68e4c2c3ee4ce','!!!/!!#/!!$/'),('50dfb42edbbdd3403eb27a9e0f96199e','0000056edbbdd3403eb27a9e0f961995','!!!/!!!/+0{/'),('5f5af922dbb804d03bf6a851ca961999','000006eedb7c04d03bf6a851ca96190c','!!!/!!!/$9;/'),(NULL,'00000904db1dd45014d6fb24399619b7','!!!/!!#/!!$/'),('33c6e522db2c10104ac3a851ca9619f3','00000a06dbf0181416d2a345ca96197b','!!!/!!#/!!$/'),(NULL,'00000ccd6f9196041501f7307f3ee406','!!!/!!#/!!$/'),(NULL,'00000ee2dbb9bf4014d6fb24399619a7','!!!/!!#/!!$/'),(NULL,'00000f065bba40000a4de1945e425441','!!!/!!#/!!$/'),(NULL,'000013dedbc0bf00bbc40b55ca961959','!!!/!!!/,*7/'),(NULL,'000016bcdb29009cf7fca851ca961927','!!!/!!#/!!$/'),(NULL,'0000171bdbdb770066e0a345ca96195a','!!!/!!!/+N?/'),('8eb9317f1b895450d01143f6fe4bcb26','00001c80db5d509022e0fb24399619ed','!!!/!!!/0RG/'),(NULL,'00001d84dbf6f2405a4af85e0f9619f9','!!!/!!#/!!$/'),(NULL,'00001e31db25d4105ed4a851ca96195c','!!!/!!#/!!$/'),(NULL,'00001ea3db73c89823f4a345ca9619b5','!!!/!!#/!!$/'),('c3baf3fadb234c54d82ffb24399619e0','00001f4fdbab4c542be0a851ca96190c','!!!/!!#/!!$/'),(NULL,'0000221bdbb4b3c466e0a345ca9619f0','!!!/!!!/$^{/'),(NULL,'000022bcdb9c04d022e0fb24399619e1','!!!/!!#/!!$/'),('9b7152434f995a80f347524e0210c7e0','0000234b6f59de00fbd4409e9f3ee446','/'),('c64ed870145461009a1c80cd6740d192','00002434145461009a1c80cd6740d1e5','!!!/!!#/!!$/'),(NULL,'0000247edb84d7040e3dfb651f9619b2','!!!/!!#/!!$/'),(NULL,'000025f8dbb6ba007fc27c541f96195b','!!!/!!#/!!$/'),('9b691033485d95c0c5abf6bd15eef576','0000287348dd95c0c5abf6bd15eef572','!!!/!!#/!!$/'),('3c4f591edb7ce2406015f47e0f96191b','00002952dbbce2406015f47e0f961999','!!!/!!!/#MU/'),(NULL,'000029b0db6d5c104819fb24399619a8','!!!/!!#/!!$/'),(NULL,'00002a3d1b5f0010a59033f2cd4bcb90','!!!/!!!/&<#/'),(NULL,'00002a9fdb5787840e3dfb651f9619a6','!!!/!!#/!!$/'),(NULL,'00002c5adb5a0fc0d7e37aa31f9619ba','!!!/!!#/!!$/'),('fa753886dbd8181014d6fb2439961989','00002d5edbdc949466e0a345ca9619e4','!!!/!!!/$44/'),('56ff56bfdb469c503fa35583ca961987','00002e73db0a9c50364a5583ca961922','!!!/!!#/!!$/'),(NULL,'000031f6dba76b40c9c302d5ca9619c4','!!!/!!#/!!$/'),(NULL,'000036fadb1a0344d7e37aa31f96196d','!!!/!!#/!!$/'),(NULL,'000036ffdb046744d58ea345ca961937','!!!/!!#/!!$/'),(NULL,'000037c2dbaae700fb115583ca961926','!!!/!!#/!!$/'),(NULL,'000038eedbe32380b1b102d5ca9619c9','!!!/!!!/#2J/'),(NULL,'00003925dbb1c300225d7aa31f961993','!!!/!!#/!!$/'),('58c865acdb2944184ac3a851ca961901','0000392cdbe944184ac3a851ca9619ea','!!!/!!!/(*S/'),(NULL,'00003966db307a800e58fb651f9619a7','!!!/!!!/&C[/'),('bdeae17bdbfed3045ed4a851ca961933','0000397bdbb217045ed4a851ca96192e','!!!/!!#/!!$/'),('1b951202dbbe7b8014d6fb2439961926','00003a02db767f80fec4fb243996198f','!!!/!!!/#*L/'),(NULL,'00003e5bdbe33b8416d2a345ca961919','!!!/!!#/!!$/'),(NULL,'00003eef1b0a4410fff162c4bd4bcb0e','!!!/!!#/!!$/'),(NULL,'000040b6dbcfcb000e58fb651f9619d2','!!!/!!#/!!$/'),(NULL,'000040e5db0a185011762183ca9619c5','!!!/!!#/!!$/'),('101abff70ff99200a2c9982be1050ee7','000044c86f4a120000270bae9f3ee475','/'),('15d6f3c8dbb3ab0023f4a345ca9619ee','000045f2db5f2700f2eb02d5ca9619c6','!!!/!!!/#*./'); + +ANALYZE TABLE sysapproval_approver PERSISTENT FOR COLUMNS() INDEXES(); +ANALYZE TABLE task PERSISTENT FOR COLUMNS() INDEXES(); + +--enable_warnings +--enable_result_log +--enable_query_log + +# The following explain is left here from the original bug report. +# Can be useful if one gets this issue again in a future MariaDB version + +#explain format= json SELECT sysapproval_approver0.`sys_id` FROM ((sysapproval_approver sysapproval_approver0 INNER JOIN task task1 ON sysapproval_approver0.`sysapproval` = task1.`sys_id` AND ((task1.`sys_domain_path` = '/' OR task1.`sys_domain_path` LIKE '!!!/!!#/!!$/%' OR task1.`sys_domain_path` LIKE '!!!/!!!/%'))) INNER JOIN task task2 ON task1.`parent` = task2.`sys_id` AND ((task2.`sys_domain_path` = '/' OR task2.`sys_domain_path` LIKE '!!!/!!#/!!$/%' OR task2.`sys_domain_path` LIKE '!!!/!!!/%'))) WHERE task2.`sys_id` LIKE '8e7792a7dbfffb00fff8a345ca961934%' AND (sysapproval_approver0.`sys_domain_path` = '/' OR sysapproval_approver0.`sys_domain_path` LIKE '!!!/!!#/!!$/%' OR sysapproval_approver0.`sys_domain_path` LIKE '!!!/!!!/%') ORDER BY sysapproval_approver0.`order` LIMIT 0, 50; + + +set optimizer_use_condition_selectivity=1; +analyze SELECT sysapproval_approver0.`sys_id` +FROM ((sysapproval_approver sysapproval_approver0 + INNER JOIN task task1 + ON sysapproval_approver0.`sysapproval` = task1.`sys_id` + AND (( task1.`sys_domain_path` = '/' + OR task1.`sys_domain_path` LIKE '!!!/!!#/!!$/%' + OR task1.`sys_domain_path` LIKE '!!!/!!!/%' ))) + INNER JOIN task task2 + ON task1.`parent` = task2.`sys_id` + AND (( task2.`sys_domain_path` = '/' + OR task2.`sys_domain_path` LIKE '!!!/!!#/!!$/%' + OR task2.`sys_domain_path` LIKE '!!!/!!!/%' ))) +WHERE task2.`sys_id` LIKE '8e7792a7dbfffb00fff8a345ca961934%' + AND ( sysapproval_approver0.`sys_domain_path` = '/' + OR sysapproval_approver0.`sys_domain_path` LIKE '!!!/!!#/!!$/%' + OR sysapproval_approver0.`sys_domain_path` LIKE '!!!/!!!/%' ) +ORDER BY sysapproval_approver0.`order` +LIMIT 0, 50 ; + +set optimizer_use_condition_selectivity=4; +analyze SELECT sysapproval_approver0.`sys_id` +FROM ((sysapproval_approver sysapproval_approver0 + INNER JOIN task task1 + ON sysapproval_approver0.`sysapproval` = task1.`sys_id` + AND (( task1.`sys_domain_path` = '/' + OR task1.`sys_domain_path` LIKE '!!!/!!#/!!$/%' + OR task1.`sys_domain_path` LIKE '!!!/!!!/%' ))) + INNER JOIN task task2 + ON task1.`parent` = task2.`sys_id` + AND (( task2.`sys_domain_path` = '/' + OR task2.`sys_domain_path` LIKE '!!!/!!#/!!$/%' + OR task2.`sys_domain_path` LIKE '!!!/!!!/%' ))) +WHERE task2.`sys_id` LIKE '8e7792a7dbfffb00fff8a345ca961934%' + AND ( sysapproval_approver0.`sys_domain_path` = '/' + OR sysapproval_approver0.`sys_domain_path` LIKE '!!!/!!#/!!$/%' + OR sysapproval_approver0.`sys_domain_path` LIKE '!!!/!!!/%' ) +ORDER BY sysapproval_approver0.`order` +LIMIT 0, 50 ; + +drop table sysapproval_approver,task; + +set global innodb_stats_persistent= @innodb_stats_persistent_save; +set global innodb_stats_persistent_sample_pages= + @innodb_stats_persistent_sample_pages_save; diff --git a/mysql-test/main/mdev375.test b/mysql-test/main/mdev375.test index 6fdb35016ca37..f489d232be8a5 100644 --- a/mysql-test/main/mdev375.test +++ b/mysql-test/main/mdev375.test @@ -3,6 +3,7 @@ # --source include/not_embedded.inc +--disable_service_connection set @save_log_warnings=@@log_warnings, @save_max_connections=@@max_connections; SET GLOBAL log_warnings=4; SET GLOBAL max_connections=10; @@ -33,3 +34,4 @@ show status like "Threads_connected"; SET GLOBAL log_warnings=@save_log_warnings; SET GLOBAL max_connections=@save_max_connections; +--enable_service_connection diff --git a/mysql-test/main/mdl.test b/mysql-test/main/mdl.test index f7fac0a062dd3..13c2caf097e84 100644 --- a/mysql-test/main/mdl.test +++ b/mysql-test/main/mdl.test @@ -8,7 +8,7 @@ --echo # mdl_ticket->m_type == MDL_SHARED_READ' --echo # failed in MDL_context::upgrade_shared_lock --echo # - +--disable_service_connection CREATE TABLE t1(a INT) ENGINE=InnoDB; CREATE TABLE t3(a INT) ENGINE=myisam; LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ; @@ -89,3 +89,4 @@ connection default; disconnect locker; DROP TABLE t1,t3; +--enable_service_connection diff --git a/mysql-test/main/merge.result b/mysql-test/main/merge.result index d1950d03939f0..230fcf48e9d76 100644 --- a/mysql-test/main/merge.result +++ b/mysql-test/main/merge.result @@ -1,8 +1,6 @@ set @save_default_storage_engine=@@global.default_storage_engine; set global default_storage_engine=myisam; set session default_storage_engine=myisam; -drop table if exists t1,t2,t3,t4,t5,t6; -drop database if exists mysqltest; create table t1 (a int not null primary key auto_increment, message char(20)); create table t2 (a int not null primary key auto_increment, message char(20)); INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1"); @@ -178,7 +176,7 @@ t3 CREATE TABLE `t3` ( `a` int(11) NOT NULL, `b` char(20) DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`t1`,`t2`) create table t4 (a int not null, b char(10), key(a)) engine=MERGE UNION=(t1,t2); select * from t4; ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist @@ -196,7 +194,7 @@ t5 CREATE TABLE `t5` ( `a` int(11) NOT NULL, `b` char(20) DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`mysqltest`.`t6`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`t1`,`mysqltest`.`t6`) alter table t5 engine=myisam; drop table t5, mysqltest.t6; drop database mysqltest; @@ -269,14 +267,14 @@ t3 CREATE TABLE `t3` ( `incr` int(11) NOT NULL, `othr` int(11) NOT NULL, PRIMARY KEY (`incr`) -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`t1`,`t2`) alter table t3 drop primary key; show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `incr` int(11) NOT NULL, `othr` int(11) NOT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`t1`,`t2`) drop table t3,t2,t1; create table t1 (a int not null, key(a)) engine=merge; select * from t1; @@ -305,28 +303,28 @@ t3 CREATE TABLE `t3` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL, KEY `a` (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t4; Table Create Table t4 CREATE TABLE `t4` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL, KEY `a` (`a`,`b`) -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`t1`,`t2`) show create table t5; Table Create Table t5 CREATE TABLE `t5` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`,`b`) -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=FIRST UNION=(`t1`,`t2`) show create table t6; Table Create Table t6 CREATE TABLE `t6` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`,`b`) -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t1`,`t2`) insert into t1 values (1,NULL),(1,NULL),(1,NULL),(1,NULL); insert into t2 values (2,NULL),(2,NULL),(2,NULL),(2,NULL); select * from t3 order by b,a limit 3; @@ -391,7 +389,7 @@ t4 CREATE TABLE `t4` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL, KEY `a` (`a`,`b`) -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`,`t3`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`t1`,`t2`,`t3`) select * from t4 order by a,b; a b 1 1 @@ -417,7 +415,7 @@ t4 CREATE TABLE `t4` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL, KEY `a` (`a`,`b`) -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`,`t3`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=FIRST UNION=(`t1`,`t2`,`t3`) insert into t4 values (4,1),(4,2); select * from t1 order by a,b; a b @@ -981,21 +979,21 @@ SHOW CREATE TABLE m1; Table Create Table m1 CREATE TABLE `m1` ( `a` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE m1; CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(); SHOW CREATE TABLE m1; Table Create Table m1 CREATE TABLE `m1` ( `a` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE m1 UNION=(t1); ALTER TABLE m1 UNION=(); SHOW CREATE TABLE m1; Table Create Table m1 CREATE TABLE `m1` ( `a` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, m1; CREATE TABLE t1(a INT); CREATE TABLE t2(a VARCHAR(10)); @@ -1198,7 +1196,7 @@ SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `c1` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t1`,`t2`) INSERT INTO t4 VALUES (4); DROP TABLE t4; # @@ -1218,7 +1216,7 @@ SHOW CREATE TABLE t4; Table Create Table t4 CREATE TEMPORARY TABLE `t4` ( `c1` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t1`,`t2`) INSERT INTO t4 VALUES (4); UNLOCK TABLES; INSERT INTO t4 VALUES (4); @@ -1424,7 +1422,7 @@ Table Create Table t4 CREATE TABLE `t4` ( `c1` int(11) DEFAULT NULL, KEY `c1` (`c1`) -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t3`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t3`) SELECT * FROM t4 ORDER BY c1; c1 3 @@ -1435,7 +1433,7 @@ Table Create Table t4 CREATE TABLE `t4` ( `c1` int(11) DEFAULT NULL, KEY `c1` (`c1`) -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t3`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t3`,`t2`) SELECT * FROM t4 ORDER BY c1; c1 2 @@ -1458,7 +1456,7 @@ Table Create Table t4 CREATE TABLE `t4` ( `c1` int(11) DEFAULT NULL, KEY `c1` (`c1`) -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t3`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t3`,`t2`) SELECT * FROM t4 ORDER BY c1; c1 2 @@ -2266,7 +2264,6 @@ DROP TABLE t1; # Bug45781 infinite hang/crash in "opening tables" after handler tries to # open merge table # -DROP TABLE IF EXISTS m1,t1; CREATE TABLE t1(a int)engine=myisam; CREATE TABLE t2(a int)engine=myisam; CREATE TABLE t3(a int)engine=myisam; @@ -2306,7 +2303,7 @@ SHOW CREATE TABLE m1; Table Create Table m1 CREATE TABLE `m1` ( `a` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`test/1`.`t/1`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`test/1`.`t/1`) DROP TABLE m1; CREATE TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`); SELECT * FROM `test/1`.m1; @@ -2315,7 +2312,7 @@ SHOW CREATE TABLE `test/1`.m1; Table Create Table m1 CREATE TABLE `m1` ( `a` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t/1`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`t/1`) DROP TABLE `test/1`.m1; DROP TABLE `test/1`.`t/1`; CREATE TEMPORARY TABLE `test/1`.`t/1`(a INT); @@ -2326,7 +2323,7 @@ SHOW CREATE TABLE m1; Table Create Table m1 CREATE TEMPORARY TABLE `m1` ( `a` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`test/1`.`t/1`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`test/1`.`t/1`) DROP TABLE m1; CREATE TEMPORARY TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`); SELECT * FROM `test/1`.m1; @@ -2335,7 +2332,7 @@ SHOW CREATE TABLE `test/1`.m1; Table Create Table m1 CREATE TEMPORARY TABLE `m1` ( `a` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t/1`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`t/1`) DROP TABLE `test/1`.m1; DROP TABLE `test/1`.`t/1`; DROP DATABASE `test/1`; @@ -2346,7 +2343,7 @@ SHOW CREATE TABLE m1; Table Create Table m1 CREATE TABLE `m1` ( `a` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t@1`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`t@1`) DROP TABLE `t@1`; CREATE DATABASE `test@1`; CREATE TABLE `test@1`.`t@1`(a INT); @@ -2357,7 +2354,7 @@ SHOW CREATE TABLE m1; Table Create Table m1 CREATE TABLE `m1` ( `a` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`test@1`.`t@1`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`test@1`.`t@1`) DROP TABLE m1; DROP TABLE `test@1`.`t@1`; DROP DATABASE `test@1`; @@ -2376,7 +2373,6 @@ DROP TABLE t2, t1; # # Bug#46339 - crash on REPAIR TABLE merge table USE_FRM # -DROP TABLE IF EXISTS m1, t1; CREATE TABLE t1 (c1 INT) ENGINE=MYISAM; CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1) INSERT_METHOD=LAST; LOCK TABLE m1 READ; @@ -2565,7 +2561,6 @@ DROP TABLE t1; # # Test merge table with too many merge children. # -drop table if exists t_parent; set @save_table_open_cache=@@global.table_open_cache; # # Set @@global.table_open_cache to minimum @@ -2595,7 +2590,6 @@ deallocate prepare stmt; # drop table t_parent; set @@global.table_open_cache=@save_table_open_cache; -DROP DATABASE IF EXISTS mysql_test1; CREATE DATABASE mysql_test1; CREATE TABLE t1 ... DATA DIRECTORY=... INDEX DIRECTORY=... CREATE TABLE mysql_test1.t2 ... DATA DIRECTORY=... INDEX DIRECTORY=... @@ -2881,7 +2875,6 @@ DROP TABLE t1; # More tests with TEMPORARY MERGE table and permanent children. # First without locked tables. # -DROP TABLE IF EXISTS t1, t2, t3, t4, m1, m2; # CREATE TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM; CREATE TABLE t2 (c1 INT, c2 INT) ENGINE=MyISAM; @@ -2892,13 +2885,13 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE m1; Table Create Table m1 CREATE TEMPORARY TABLE `m1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t1`,`t2`) SELECT * FROM m1; c1 c2 INSERT INTO t1 VALUES (111, 121); @@ -2920,7 +2913,7 @@ Table Create Table m2 CREATE TEMPORARY TABLE `m2` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t1`,`t2`) SELECT * FROM m2; c1 c2 111 121 @@ -2937,7 +2930,7 @@ Table Create Table m1 CREATE TEMPORARY TABLE `m1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t1`,`t2`) SELECT * FROM m1; c1 c2 111 121 @@ -3026,7 +3019,7 @@ Table Create Table m1 CREATE TEMPORARY TABLE `m1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO m1 VALUES (511, 521); SELECT * FROM m1; c1 c2 @@ -3077,7 +3070,7 @@ Table Create Table m1 CREATE TEMPORARY TABLE `m1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t1`,`t2`) # CREATE TABLE m2 SELECT * FROM m1; SHOW CREATE TABLE m2; @@ -3085,7 +3078,7 @@ Table Create Table m2 CREATE TABLE `m2` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM m2; c1 c2 111 121 @@ -3100,7 +3093,7 @@ Table Create Table m2 CREATE TEMPORARY TABLE `m2` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM m2; c1 c2 111 121 @@ -3129,7 +3122,7 @@ Table Create Table m2 CREATE TABLE `m2` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t1`,`t2`) SELECT * FROM m2; c1 c2 111 121 @@ -3155,7 +3148,7 @@ Table Create Table m2 CREATE TEMPORARY TABLE `m2` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t1`,`t2`) SELECT * FROM m2; c1 c2 111 121 @@ -3295,13 +3288,13 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE m1; Table Create Table m1 CREATE TEMPORARY TABLE `m1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t1`,`t2`) SELECT * FROM m1; c1 c2 INSERT INTO t1 VALUES (111, 121); @@ -3325,7 +3318,7 @@ Table Create Table m2 CREATE TEMPORARY TABLE `m2` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t1`,`t2`) SELECT * FROM m2; c1 c2 111 121 @@ -3342,7 +3335,7 @@ Table Create Table m1 CREATE TEMPORARY TABLE `m1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t1`,`t2`) SELECT * FROM m1; c1 c2 111 121 @@ -3433,7 +3426,7 @@ Table Create Table m1 CREATE TEMPORARY TABLE `m1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO m1 VALUES (511, 521); SELECT * FROM m1; c1 c2 @@ -3484,7 +3477,7 @@ Table Create Table m1 CREATE TEMPORARY TABLE `m1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t1`,`t2`) CREATE TABLE m2 SELECT * FROM m1; ERROR HY000: Table 'm2' was not locked with LOCK TABLES # @@ -3494,7 +3487,7 @@ Table Create Table m2 CREATE TEMPORARY TABLE `m2` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM m2; c1 c2 111 121 @@ -3529,14 +3522,14 @@ Table Create Table m2 CREATE TEMPORARY TABLE `m2` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t1`,`t2`) LOCK TABLE m1 WRITE, m2 WRITE; SHOW CREATE TABLE m2; Table Create Table m2 CREATE TEMPORARY TABLE `m2` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=LAST UNION=(`t1`,`t2`) SELECT * FROM m2; c1 c2 111 121 @@ -3582,7 +3575,6 @@ DROP TABLE t1, t2, t3, t4, m1, m2; # Test that merge tables are closed correctly when opened using # HANDLER ... OPEN. # The general case. -DROP TABLE IF EXISTS t1, t2, t3; connect con1,localhost,root,,; CREATE TABLE t1 (c1 int); CREATE TABLE t2 (c1 int); @@ -3635,7 +3627,6 @@ drop table t4, t3, t2, t1; # # Bug#51240 ALTER TABLE of a locked MERGE table fails # -DROP TABLE IF EXISTS m1, t1; CREATE TABLE t1 (c1 INT); CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1); LOCK TABLE m1 WRITE; @@ -3657,7 +3648,6 @@ DROP TABLE m1, t1; # # Test for bug #37371 "CREATE TABLE LIKE merge loses UNION parameter" # -drop tables if exists t1, m1, m2; create table t1 (i int) engine=myisam; create table m1 (i int) engine=mrg_myisam union=(t1) insert_method=first; create table m2 like m1; @@ -3666,18 +3656,17 @@ show create table m1; Table Create Table m1 CREATE TABLE `m1` ( `i` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=FIRST UNION=(`t1`) show create table m2; Table Create Table m2 CREATE TABLE `m2` ( `i` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT_METHOD=FIRST UNION=(`t1`) drop tables m1, m2, t1; # # Test case for Bug#54811 "Assert in mysql_lock_have_duplicate()" # Check that unique_table() works correctly for merge tables. # -drop table if exists t1, t2, t3, m1, m2; create table t1 (a int); create table t2 (a int); create table t3 (b int); @@ -3723,7 +3712,6 @@ drop table t1, t2, t3, m1, m2; # Bug#56494 Segfault in upgrade_shared_lock_to_exclusive() for # REPAIR of merge table # -DROP TABLE IF EXISTS t1, t2, t_not_exists; CREATE TABLE t1(a INT); ALTER TABLE t1 engine= MERGE UNION (t_not_exists); ANALYZE TABLE t1; @@ -3767,7 +3755,6 @@ DROP TABLE t1, t2; # Bug#57002 Assert in upgrade_shared_lock_to_exclusive() # for ALTER TABLE + MERGE tables # -DROP TABLE IF EXISTS t1, m1; CREATE TABLE t1(a INT) engine=myisam; CREATE TABLE m1(a INT) engine=merge UNION(t1); LOCK TABLES t1 READ, m1 WRITE; @@ -3779,7 +3766,6 @@ DROP TABLE m1, t1; # Test for bug #11754210 - "45777: CHECK TABLE DOESN'T SHOW ALL # PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1" # -drop tables if exists t1, t2, t3, t4, m1; create table t1(id int) engine=myisam; create view t3 as select 1 as id; create table t4(id int) engine=memory; @@ -3809,8 +3795,7 @@ test.m1 repair error Corrupt drop tables m1, t1, t4; drop view t3; # -# MDEV-10424 - Assertion `ticket == __null' failed in -# MDL_request::set_type +# MDEV-10424 Assertion `ticket == __null' failed in MDL_request::set_type # CREATE TABLE t1 (f1 INT) ENGINE=MyISAM; CREATE TABLE tmerge (f1 INT) ENGINE=MERGE UNION=(t1); @@ -3829,7 +3814,9 @@ 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; -End of 5.5 tests +# +# End of 5.5 tests +# # # Additional coverage for refactoring which is made as part # of fix for bug #27480 "Extend CREATE TEMPORARY TABLES privilege @@ -3837,8 +3824,7 @@ End of 5.5 tests # # Check that prelocking works correctly for various variants of # merge tables. -drop table if exists t1, t2, m1; -drop function if exists f1; +# create table t1 (j int); insert into t1 values (1); create function f1() returns int return (select count(*) from m1); @@ -3904,11 +3890,6 @@ checksum table m1; Table Checksum test.m1 3459908756 drop tables t1, m1; -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS m1; -DROP TRIGGER IF EXISTS trg1; -DROP TABLE IF EXISTS q1; -DROP TABLE IF EXISTS q2; CREATE TABLE t1(a INT); CREATE TABLE m1(a INT) ENGINE = MERGE UNION (q1, q2); CREATE TRIGGER trg1 BEFORE DELETE ON t1 @@ -3919,3 +3900,32 @@ ERROR HY000: Unable to open underlying table which is differently defined or of DROP TRIGGER trg1; DROP TABLE t1; DROP TABLE m1; +set global default_storage_engine=@save_default_storage_engine; +# +# End of 10.0 tests +# +# +# MDEV-27407 Different ASC/DESC index attributes on MERGE and underlying table can cause wrong results +# +create table t (a int, key(a desc)) engine=myisam; +create table tm (a int, key(a)) engine=merge union(t); +select * from tm; +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +drop table tm, t; +# +# MDEV-27586 Auto-increment does not work with DESC on MERGE table +# +create table t (a int not null, primary key(a desc)) engine=myisam; +create table tm (a int not null auto_increment, primary key(a desc)) engine=merge union=(t) insert_method=first; +insert into tm () values (); +insert into tm () values (); +insert into tm () values (); +select * from tm; +a +3 +2 +1 +drop table tm, t; +# +# End of 10.8 tests +# diff --git a/mysql-test/main/merge.test b/mysql-test/main/merge.test index 99cce370bebe7..0485f3ed1c387 100644 --- a/mysql-test/main/merge.test +++ b/mysql-test/main/merge.test @@ -13,12 +13,6 @@ set session default_storage_engine=myisam; # This test assumes a stable character set --source include/default_charset.inc -# Clean up resources used in this test case. ---disable_warnings -drop table if exists t1,t2,t3,t4,t5,t6; -drop database if exists mysqltest; ---enable_warnings - let $MYSQLD_DATADIR= `select @@datadir`; create table t1 (a int not null primary key auto_increment, message char(20)); create table t2 (a int not null primary key auto_increment, message char(20)); @@ -1652,10 +1646,6 @@ DROP TABLE t1; --echo # open merge table --echo # ---disable_warnings -DROP TABLE IF EXISTS m1,t1; ---enable_warnings - CREATE TABLE t1(a int)engine=myisam; CREATE TABLE t2(a int)engine=myisam; CREATE TABLE t3(a int)engine=myisam; @@ -1756,9 +1746,6 @@ DROP TABLE t2, t1; --echo # --echo # Bug#46339 - crash on REPAIR TABLE merge table USE_FRM --echo # ---disable_warnings -DROP TABLE IF EXISTS m1, t1; ---enable_warnings # # Test derived from a proposal of Shane Bester. # @@ -1893,9 +1880,6 @@ DROP TABLE t1; --echo # --echo # Test merge table with too many merge children. --echo # ---disable_warnings -drop table if exists t_parent; ---enable_warnings set @save_table_open_cache=@@global.table_open_cache; --echo # --echo # Set @@global.table_open_cache to minimum @@ -1910,9 +1894,6 @@ let $1 = `select @@table_open_cache;`; --disable_query_log while ($1) { ---disable_warnings - eval drop table if exists t$1; ---enable_warnings eval create table t$1 (a int) engine=myisam; eval set @a=ifnull(concat(@a, ", ", "t$1"), "t$1"); dec $1; @@ -1956,9 +1937,6 @@ set @@global.table_open_cache=@save_table_open_cache; # # Test DATA/INDEX DIRECTORY # ---disable_warnings -DROP DATABASE IF EXISTS mysql_test1; ---enable_warnings CREATE DATABASE mysql_test1; --disable_query_log # data/index directory don't work in HAVE_purify builds. Disable @@ -2269,9 +2247,6 @@ DROP TABLE t1; --echo # More tests with TEMPORARY MERGE table and permanent children. --echo # First without locked tables. --echo # ---disable_warnings -DROP TABLE IF EXISTS t1, t2, t3, t4, m1, m2; ---enable_warnings # --echo # CREATE TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM; @@ -2590,9 +2565,6 @@ DROP TABLE t1, t2, t3, t4, m1, m2; --echo # Test that merge tables are closed correctly when opened using --echo # HANDLER ... OPEN. --echo # The general case. ---disable_warnings -DROP TABLE IF EXISTS t1, t2, t3; ---enable_warnings connect (con1,localhost,root,,); CREATE TABLE t1 (c1 int); CREATE TABLE t2 (c1 int); @@ -2648,10 +2620,6 @@ drop table t4, t3, t2, t1; --echo # Bug#51240 ALTER TABLE of a locked MERGE table fails --echo # ---disable_warnings -DROP TABLE IF EXISTS m1, t1; ---enable_warnings - CREATE TABLE t1 (c1 INT); CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1); LOCK TABLE m1 WRITE; @@ -2677,9 +2645,6 @@ DROP TABLE m1, t1; --echo # --echo # Test for bug #37371 "CREATE TABLE LIKE merge loses UNION parameter" --echo # ---disable_warnings -drop tables if exists t1, m1, m2; ---enable_warnings create table t1 (i int) engine=myisam; create table m1 (i int) engine=mrg_myisam union=(t1) insert_method=first; create table m2 like m1; @@ -2692,9 +2657,6 @@ drop tables m1, m2, t1; --echo # Test case for Bug#54811 "Assert in mysql_lock_have_duplicate()" --echo # Check that unique_table() works correctly for merge tables. --echo # ---disable_warnings -drop table if exists t1, t2, t3, m1, m2; ---enable_warnings create table t1 (a int); create table t2 (a int); create table t3 (b int); @@ -2749,10 +2711,6 @@ drop table t1, t2, t3, m1, m2; --echo # REPAIR of merge table --echo # ---disable_warnings -DROP TABLE IF EXISTS t1, t2, t_not_exists; ---enable_warnings - CREATE TABLE t1(a INT); ALTER TABLE t1 engine= MERGE UNION (t_not_exists); # This caused the segfault @@ -2779,10 +2737,6 @@ DROP TABLE t1, t2; --echo # for ALTER TABLE + MERGE tables --echo # ---disable_warnings -DROP TABLE IF EXISTS t1, m1; ---enable_warnings - CREATE TABLE t1(a INT) engine=myisam; CREATE TABLE m1(a INT) engine=merge UNION(t1); LOCK TABLES t1 READ, m1 WRITE; @@ -2799,9 +2753,6 @@ DROP TABLE m1, t1; --echo # Test for bug #11754210 - "45777: CHECK TABLE DOESN'T SHOW ALL --echo # PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1" --echo # ---disable_warnings -drop tables if exists t1, t2, t3, t4, m1; ---enable_warnings create table t1(id int) engine=myisam; create view t3 as select 1 as id; create table t4(id int) engine=memory; @@ -2821,8 +2772,7 @@ drop view t3; --echo # ---echo # MDEV-10424 - Assertion `ticket == __null' failed in ---echo # MDL_request::set_type +--echo # MDEV-10424 Assertion `ticket == __null' failed in MDL_request::set_type --echo # CREATE TABLE t1 (f1 INT) ENGINE=MyISAM; CREATE TABLE tmerge (f1 INT) ENGINE=MERGE UNION=(t1); @@ -2832,9 +2782,9 @@ EXECUTE stmt; DEALLOCATE PREPARE stmt; DROP TABLE t1, tmerge; - ---echo End of 5.5 tests - +--echo # +--echo # End of 5.5 tests +--echo # --echo # --echo # Additional coverage for refactoring which is made as part @@ -2843,10 +2793,7 @@ DROP TABLE t1, tmerge; --echo # --echo # Check that prelocking works correctly for various variants of --echo # merge tables. ---disable_warnings -drop table if exists t1, t2, m1; -drop function if exists f1; ---enable_warnings +--echo # create table t1 (j int); insert into t1 values (1); create function f1() returns int return (select count(*) from m1); @@ -2892,14 +2839,6 @@ drop tables t1, m1; # Check effect of Bug#27480-preliminary patch: # a merge-table with non-existing children, opened from a prelocked list. ---disable_warnings -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS m1; -DROP TRIGGER IF EXISTS trg1; -DROP TABLE IF EXISTS q1; -DROP TABLE IF EXISTS q2; ---enable_warnings - CREATE TABLE t1(a INT); CREATE TABLE m1(a INT) ENGINE = MERGE UNION (q1, q2); @@ -2914,12 +2853,36 @@ DROP TRIGGER trg1; DROP TABLE t1; DROP TABLE m1; ---disable_result_log ---disable_query_log set global default_storage_engine=@save_default_storage_engine; ---enable_result_log ---enable_query_log # 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 # End of 10.0 tests +--echo # + +--echo # +--echo # MDEV-27407 Different ASC/DESC index attributes on MERGE and underlying table can cause wrong results +--echo # +create table t (a int, key(a desc)) engine=myisam; +create table tm (a int, key(a)) engine=merge union(t); +--error ER_WRONG_MRG_TABLE +select * from tm; +drop table tm, t; + +--echo # +--echo # MDEV-27586 Auto-increment does not work with DESC on MERGE table +--echo # +create table t (a int not null, primary key(a desc)) engine=myisam; +create table tm (a int not null auto_increment, primary key(a desc)) engine=merge union=(t) insert_method=first; +insert into tm () values (); +insert into tm () values (); +insert into tm () values (); +select * from tm; +drop table tm, t; + +--echo # +--echo # End of 10.8 tests +--echo # diff --git a/mysql-test/main/merge_mmap.test b/mysql-test/main/merge_mmap.test index f3fce257f06c0..01c3896bd02fc 100644 --- a/mysql-test/main/merge_mmap.test +++ b/mysql-test/main/merge_mmap.test @@ -79,6 +79,7 @@ DROP TABLE m2, m1, t2, t1; # # INSERT-SELECT with no TEMPORARY table. # +--disable_service_connection CREATE TABLE t1 (c1 INT); CREATE TABLE t2 (c1 INT); CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2) @@ -141,6 +142,7 @@ INSERT INTO m2 SELECT * FROM m1; SELECT * FROM m2; UNLOCK TABLES; DROP TABLE m2, m1, t2, t1; +--enable_service_connection --echo End of 6.0 tests diff --git a/mysql-test/main/metadata.result b/mysql-test/main/metadata.result index 1d229643ade12..5786e2fd46159 100644 --- a/mysql-test/main/metadata.result +++ b/mysql-test/main/metadata.result @@ -786,7 +786,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `@a` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SELECT @b1:=10, @b2:=@b2:=111111111111; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -800,5 +800,5 @@ Table Create Table t1 CREATE TABLE `t1` ( `@b1:=10` int(2) NOT NULL, `@b2:=111111111111` bigint(12) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; diff --git a/mysql-test/main/metadata.test b/mysql-test/main/metadata.test index 6a03bc8154618..6cbf99d16b79b 100644 --- a/mysql-test/main/metadata.test +++ b/mysql-test/main/metadata.test @@ -1,6 +1,8 @@ # # Test metadata # +#View protocol gives slightly different metadata +--source include/no_view_protocol.inc --disable_warnings drop table if exists t1,t2; diff --git a/mysql-test/main/mix2_myisam.result b/mysql-test/main/mix2_myisam.result index 5534511255dc7..842d5bcfb949a 100644 --- a/mysql-test/main/mix2_myisam.result +++ b/mysql-test/main/mix2_myisam.result @@ -726,7 +726,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(20) DEFAULT NULL, KEY `a` (`a`(5)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create temporary table t1 (a int not null auto_increment, primary key(a)) engine=MyISAM; insert into t1 values (NULL),(NULL),(NULL); @@ -1290,7 +1290,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1,t2; flush status; show status like "binlog_cache_use"; @@ -1431,7 +1431,7 @@ t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t2 like t1; show create table t2; Table Create Table @@ -1439,7 +1439,7 @@ t2 CREATE TABLE `t2` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t3 select * from t1; show create table t3; Table Create Table @@ -1447,7 +1447,7 @@ t3 CREATE TABLE `t3` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify c varchar(10); show create table t1; Table Create Table @@ -1455,7 +1455,7 @@ t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify v char(10); show create table t1; Table Create Table @@ -1463,7 +1463,7 @@ t1 CREATE TABLE `t1` ( `v` char(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify t varchar(10); Warnings: Note 1265 Data truncated for column 't' at row 2 @@ -1473,7 +1473,7 @@ t1 CREATE TABLE `t1` ( `v` char(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+*+*+ * @@ -1489,7 +1489,7 @@ t1 CREATE TABLE `t1` ( KEY `v` (`v`), KEY `c` (`c`), KEY `t` (`t`(10)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1; count(*) 270 @@ -1713,7 +1713,7 @@ t1 CREATE TABLE `t1` ( KEY `c` (`c`), KEY `t` (`t`(10)), KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1 where v='a'; count(*) 10 @@ -1793,7 +1793,7 @@ t1 CREATE TABLE `t1` ( KEY `c` (`c`), KEY `t` (`t`(10)), KEY `v` (`v`(30)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1 where v='a'; count(*) 10 @@ -1873,7 +1873,7 @@ t1 CREATE TABLE `t1` ( KEY `c` (`c`), KEY `t` (`t`(10)), KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -1951,14 +1951,14 @@ t1 CREATE TABLE `t1` ( KEY `v` (`v`(5)), KEY `c` (`c`(5)), KEY `t` (`t`(5)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (v char(10) character set utf8); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` char(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `v` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (v varchar(10), c char(10)) row_format=fixed; show create table t1; @@ -1966,7 +1966,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=FIXED insert into t1 values('a','a'),('a ','a '); select concat('*',v,'*',c,'*') from t1; concat('*',v,'*',c,'*') @@ -2000,7 +2000,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `v` mediumtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR create table t1 (v varchar(65530) character set utf8); @@ -2009,8 +2009,8 @@ Note 1246 Converting column 'v' from VARCHAR to TEXT show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` mediumtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `v` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set default_storage_engine=MEMORY; create table t1 (v varchar(16384)) engine=MyISAM; diff --git a/mysql-test/main/mrr_icp_extra.result b/mysql-test/main/mrr_icp_extra.result index a8c9bfc201a81..8f6ee88acc62b 100644 --- a/mysql-test/main/mrr_icp_extra.result +++ b/mysql-test/main/mrr_icp_extra.result @@ -232,7 +232,7 @@ t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t2 like t1; show create table t2; Table Create Table @@ -240,7 +240,7 @@ t2 CREATE TABLE `t2` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t3 select * from t1; show create table t3; Table Create Table @@ -248,7 +248,7 @@ t3 CREATE TABLE `t3` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify c varchar(10); show create table t1; Table Create Table @@ -256,7 +256,7 @@ t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify v char(10); show create table t1; Table Create Table @@ -264,7 +264,7 @@ t1 CREATE TABLE `t1` ( `v` char(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify t varchar(10); Warnings: Note 1265 Data truncated for column 't' at row 2 @@ -274,7 +274,7 @@ t1 CREATE TABLE `t1` ( `v` char(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+*+*+ * @@ -290,7 +290,7 @@ t1 CREATE TABLE `t1` ( KEY `v` (`v`), KEY `c` (`c`), KEY `t` (`t`(10)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1; count(*) 270 @@ -514,7 +514,7 @@ t1 CREATE TABLE `t1` ( KEY `c` (`c`), KEY `t` (`t`(10)), KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1 where v='a'; count(*) 10 @@ -594,7 +594,7 @@ t1 CREATE TABLE `t1` ( KEY `c` (`c`), KEY `t` (`t`(10)), KEY `v` (`v`(30)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1 where v='a'; count(*) 10 @@ -674,7 +674,7 @@ t1 CREATE TABLE `t1` ( KEY `c` (`c`), KEY `t` (`t`(10)), KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -752,14 +752,14 @@ t1 CREATE TABLE `t1` ( KEY `v` (`v`(5)), KEY `c` (`c`(5)), KEY `t` (`t`(5)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (v char(10) character set utf8); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` char(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `v` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (v varchar(10), c char(10)) row_format=fixed; show create table t1; @@ -767,7 +767,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=FIXED insert into t1 values('a','a'),('a ','a '); select concat('*',v,'*',c,'*') from t1; concat('*',v,'*',c,'*') diff --git a/mysql-test/main/multi_statement.test b/mysql-test/main/multi_statement.test index 785aa749f5eca..40be11930e912 100644 --- a/mysql-test/main/multi_statement.test +++ b/mysql-test/main/multi_statement.test @@ -1,3 +1,6 @@ +# view-protocol doesn't support multi-statements +-- source include/no_view_protocol.inc + # PS doesn't support multi-statements --disable_ps_protocol diff --git a/mysql-test/main/multi_update.result b/mysql-test/main/multi_update.result index 3ec9ea0caa5e2..5d62e153ac0c7 100644 --- a/mysql-test/main/multi_update.result +++ b/mysql-test/main/multi_update.result @@ -1161,3 +1161,231 @@ ERROR 21000: Subquery returns more than 1 row update t1 set a= (select 2 from t1 having (a = 3)); ERROR 21000: Subquery returns more than 1 row drop tables t1; +# +# MDEV-28246 Optimizer uses all partitions during an update in MariaDB 10.6.x but not in 10.2.x +# +CREATE TABLE t1 ( +part INT(1), +a INT(1), +b INT(1), +PRIMARY KEY (a,part), +INDEX b (b,part) +) PARTITION BY LIST (part) ( +PARTITION Current VALUES IN (0), +PARTITION Relevant VALUES IN (1), +PARTITION Archive VALUES IN (2) +); +CREATE TABLE t2 LIKE t1; +INSERT INTO t1 (part,a,b) VALUES (0,0,0),(1,1,1),(2,2,2); +INSERT INTO t2 (part,a,b) VALUES (0,0,0),(1,1,1),(2,2,2); +# Expecting partition "Current" +EXPLAIN FORMAT=JSON UPDATE t2 JOIN t1 USING(a) SET t2.part=3 WHERE t2.part=0 AND t1.part=0; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "nested_loop": [ + { + "table": { + "table_name": "t2", + "partitions": ["Current"], + "access_type": "system", + "possible_keys": ["PRIMARY"], + "rows": 1, + "filtered": 100 + } + }, + { + "table": { + "table_name": "t1", + "partitions": ["Current"], + "access_type": "system", + "possible_keys": ["PRIMARY"], + "rows": 1, + "filtered": 100 + } + } + ] + } +} +# Expecting partition "Relevant" +EXPLAIN FORMAT=JSON UPDATE t2 JOIN t1 USING(a) SET t2.part=2 WHERE t2.part=1 AND t1.part=1; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "nested_loop": [ + { + "table": { + "table_name": "t2", + "partitions": ["Relevant"], + "access_type": "system", + "possible_keys": ["PRIMARY"], + "rows": 1, + "filtered": 100 + } + }, + { + "table": { + "table_name": "t1", + "partitions": ["Relevant"], + "access_type": "system", + "possible_keys": ["PRIMARY"], + "rows": 1, + "filtered": 100 + } + } + ] + } +} +# Expecting partition "Archive" +EXPLAIN FORMAT=JSON UPDATE t2 JOIN t1 USING(a) SET t2.part=3 WHERE t2.part=2 AND t1.part=2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "nested_loop": [ + { + "table": { + "table_name": "t2", + "partitions": ["Archive"], + "access_type": "system", + "possible_keys": ["PRIMARY"], + "rows": 1, + "filtered": 100 + } + }, + { + "table": { + "table_name": "t1", + "partitions": ["Archive"], + "access_type": "system", + "possible_keys": ["PRIMARY"], + "rows": 1, + "filtered": 100 + } + } + ] + } +} +DROP TABLES t1, t2; +# End of 10.3 tests +# +# MDEV-30538: multi-table UPDATE/DELETE with possible exists-to-in +# +create table t1 (c1 int, c2 int, c3 int, index idx(c2)); +insert into t1 values +(1,1,1),(3,2,2),(1,3,3), +(2,1,4),(2,2,5),(4,3,6), +(2,4,7),(2,5,8); +create table t2 (c1 int, c2 int, c3 int, index idx(c2)); +insert into t2 values +(1,7,1),(1,8,2),(1,3,3), +(2,1,4),(2,2,5),(2,3,6), +(2,4,7),(2,5,8); +create table t3 (c1 int, c2 int, c3 int, index idx(c2)); +insert into t3 values +(1,1,1),(1,2,2),(1,3,3), +(2,1,4),(2,2,5),(2,3,6), +(2,4,7),(2,5,8); +insert into t3 select c1+1, c2+2, c3 from t3; +insert into t3 select c1, c2+2, c3 from t3; +analyze table t1,t2,t3 persistent for all; +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 t1,t3 +where t1.c2 = t3.c2 and +t1.c1 > 1 and +exists (select 'X' from t2 where t2.c1 = t1.c1 and t2.c2 > 4); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL idx NULL NULL NULL 8 Using where +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t3 ref idx idx 5 test.t1.c2 3 +2 MATERIALIZED t2 range idx idx 5 NULL 3 Using index condition; Using where +explain delete from t1 using t1,t3 +where t1.c2 = t3.c2 and +t1.c1 > 1 and +exists (select 'X' from t2 where t2.c1 = t1.c1 and t2.c2 > 4); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL idx NULL NULL NULL 8 Using where +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t3 ref idx idx 5 test.t1.c2 3 Using index +2 MATERIALIZED t2 range idx idx 5 NULL 3 Using where +explain update t1,t3 set t1.c1 = t1.c1+10 +where t1.c2 = t3.c2 and +t1.c1 > 1 and +exists (select 'X' from t2 where t2.c1 = t1.c1 and t2.c2 > 4); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL idx NULL NULL NULL 8 Using where +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t3 ref idx idx 5 test.t1.c2 3 Using index +2 MATERIALIZED t2 range idx idx 5 NULL 3 Using where +create table t as select * from t1; +select * from t1,t3 +where t1.c2 = t3.c2 and +t1.c1 > 1 and +exists (select 'X' from t2 where t2.c1 = t1.c1 and t2.c2 > 4); +c1 c2 c3 c1 c2 c3 +2 1 4 1 1 1 +2 1 4 2 1 4 +2 2 5 1 2 2 +2 2 5 2 2 5 +2 4 7 2 4 7 +2 4 7 2 4 2 +2 4 7 3 4 5 +2 4 7 1 4 2 +2 4 7 2 4 5 +2 5 8 2 5 8 +2 5 8 2 5 3 +2 5 8 3 5 6 +2 5 8 1 5 3 +2 5 8 2 5 6 +2 5 8 2 5 1 +2 5 8 3 5 4 +select * from t1; +c1 c2 c3 +1 1 1 +3 2 2 +1 3 3 +2 1 4 +2 2 5 +4 3 6 +2 4 7 +2 5 8 +delete from t1 using t1,t3 +where t1.c2 = t3.c2 and +t1.c1 > 1 and +exists (select 'X' from t2 where t2.c1 = t1.c1 and t2.c2 > 4); +select * from t1; +c1 c2 c3 +1 1 1 +3 2 2 +1 3 3 +4 3 6 +truncate table t1; +insert into t1 select * from t; +analyze table t1 persistent for all; +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,t3 set t1.c1 = t1.c1+10 +where t1.c2 = t3.c2 and +t1.c1 > 1 and +exists (select 'X' from t2 where t2.c1 = t1.c1 and t2.c2 > 4); +select * from t1; +c1 c2 c3 +1 1 1 +3 2 2 +1 3 3 +12 1 4 +12 2 5 +4 3 6 +12 4 7 +12 5 8 +drop table t1,t2,t3,t; +# End of 10.4 tests diff --git a/mysql-test/main/multi_update.test b/mysql-test/main/multi_update.test index 3ee36f97fc5c9..329394e8468d9 100644 --- a/mysql-test/main/multi_update.test +++ b/mysql-test/main/multi_update.test @@ -144,7 +144,7 @@ drop table t1,t2 ; # # Test with locking # - +--disable_service_connection create table t1 (n int(10) not null primary key, d int(10)); create table t2 (n int(10) not null primary key, d int(10)); insert into t1 values(1,1); @@ -164,6 +164,7 @@ select * from t1; select * from t2; unlock tables; drop table t1,t2; +--enable_service_connection # # Test safe updates and timestamps @@ -1098,3 +1099,104 @@ select a from t1 where a= (select 2 from t1 having (a = 3)); --error ER_SUBQUERY_NO_1_ROW update t1 set a= (select 2 from t1 having (a = 3)); drop tables t1; + +--echo # +--echo # MDEV-28246 Optimizer uses all partitions during an update in MariaDB 10.6.x but not in 10.2.x +--echo # +--source include/have_partition.inc +CREATE TABLE t1 ( + part INT(1), + a INT(1), + b INT(1), + PRIMARY KEY (a,part), + INDEX b (b,part) +) PARTITION BY LIST (part) ( + PARTITION Current VALUES IN (0), + PARTITION Relevant VALUES IN (1), + PARTITION Archive VALUES IN (2) +); + +CREATE TABLE t2 LIKE t1; +INSERT INTO t1 (part,a,b) VALUES (0,0,0),(1,1,1),(2,2,2); +INSERT INTO t2 (part,a,b) VALUES (0,0,0),(1,1,1),(2,2,2); + +--echo # Expecting partition "Current" +EXPLAIN FORMAT=JSON UPDATE t2 JOIN t1 USING(a) SET t2.part=3 WHERE t2.part=0 AND t1.part=0; + +--echo # Expecting partition "Relevant" +EXPLAIN FORMAT=JSON UPDATE t2 JOIN t1 USING(a) SET t2.part=2 WHERE t2.part=1 AND t1.part=1; + +--echo # Expecting partition "Archive" +EXPLAIN FORMAT=JSON UPDATE t2 JOIN t1 USING(a) SET t2.part=3 WHERE t2.part=2 AND t1.part=2; + +DROP TABLES t1, t2; + +--echo # End of 10.3 tests + +--echo # +--echo # MDEV-30538: multi-table UPDATE/DELETE with possible exists-to-in +--echo # + +create table t1 (c1 int, c2 int, c3 int, index idx(c2)); +insert into t1 values +(1,1,1),(3,2,2),(1,3,3), +(2,1,4),(2,2,5),(4,3,6), +(2,4,7),(2,5,8); + +create table t2 (c1 int, c2 int, c3 int, index idx(c2)); +insert into t2 values +(1,7,1),(1,8,2),(1,3,3), +(2,1,4),(2,2,5),(2,3,6), +(2,4,7),(2,5,8); + +create table t3 (c1 int, c2 int, c3 int, index idx(c2)); +insert into t3 values +(1,1,1),(1,2,2),(1,3,3), +(2,1,4),(2,2,5),(2,3,6), +(2,4,7),(2,5,8); +insert into t3 select c1+1, c2+2, c3 from t3; +insert into t3 select c1, c2+2, c3 from t3; + +analyze table t1,t2,t3 persistent for all; + +let $c= + t1.c2 = t3.c2 and + t1.c1 > 1 and + exists (select 'X' from t2 where t2.c1 = t1.c1 and t2.c2 > 4); + +let $q1= +select * from t1,t3 +where $c; + +eval explain $q1; + +let $q2= +delete from t1 using t1,t3 +where $c; + +eval explain $q2; + +let $q3= +update t1,t3 set t1.c1 = t1.c1+10 +where $c; + +eval explain $q3; + +create table t as select * from t1; + +eval $q1; +select * from t1; + +eval $q2; +select * from t1; + +truncate table t1; +insert into t1 select * from t; +analyze table t1 persistent for all; + +eval $q3; +select * from t1; + +drop table t1,t2,t3,t; + +--echo # End of 10.4 tests diff --git a/mysql-test/main/multi_update_innodb.result b/mysql-test/main/multi_update_innodb.result index 2ec7eb3065e42..52bbece4fa053 100644 --- a/mysql-test/main/multi_update_innodb.result +++ b/mysql-test/main/multi_update_innodb.result @@ -207,4 +207,19 @@ ERROR 23000: Duplicate entry '0000-00-00 00:00:00' for key 'f2k' DROP VIEW v1; DROP TABLE t3,t4; SET @@sql_mode=@save_sql_mode; +# # End of 10.2 tests +# +# +# MDEV-28095 crash in multi-update and implicit grouping +# +CREATE TABLE t1 (a int) engine=innodb; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b int); +INSERT INTO t2 VALUES (1),(2); +UPDATE t1 NATURAL JOIN t2 SET a = 1 ORDER BY AVG (a) ; +ERROR HY000: Invalid use of group function +DROP TABLE t1, t2; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/multi_update_innodb.test b/mysql-test/main/multi_update_innodb.test index 04736482011de..02f6a7a33163b 100644 --- a/mysql-test/main/multi_update_innodb.test +++ b/mysql-test/main/multi_update_innodb.test @@ -243,4 +243,23 @@ DROP VIEW v1; DROP TABLE t3,t4; SET @@sql_mode=@save_sql_mode; +--echo # --echo # End of 10.2 tests +--echo # + +--echo # +--echo # MDEV-28095 crash in multi-update and implicit grouping +--echo # +CREATE TABLE t1 (a int) engine=innodb; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b int); +INSERT INTO t2 VALUES (1),(2); +--error ER_INVALID_GROUP_FUNC_USE +UPDATE t1 NATURAL JOIN t2 SET a = 1 ORDER BY AVG (a) ; +DROP TABLE t1, t2; + + +--echo # +--echo # End of 10.3 tests +--echo # + diff --git a/mysql-test/main/my_print_defaults.result b/mysql-test/main/my_print_defaults.result index 64aa7b45ca806..45765de0a1aa6 100644 --- a/mysql-test/main/my_print_defaults.result +++ b/mysql-test/main/my_print_defaults.result @@ -14,10 +14,6 @@ # # MDEV-25908: -e does not work for my_print_defaults # -# Testing -e ---key_buffer_size=20M ---max_allowed_packet=250M ---table_open_cache=1000 #Testing --defaults-extra-file --key_buffer_size=20M --max_allowed_packet=250M @@ -25,27 +21,38 @@ # # Testing other options # -# Testing -c option ---key_buffer_size=20M ---max_allowed_packet=250M ---table_open_cache=1000 # Testing --defaults-file --key_buffer_size=20M --max_allowed_packet=250M --table_open_cache=1000 -# Testing -g option +# Testing --defaults-group-suffix --key_buffer_size=20M --max_allowed_packet=250M --table_open_cache=1000 --table_definition_cache=2000 --read_buffer_size=1M --thread_cache_size=8 -# Testing --defaults-group-suffix +# Testing --no-defaults +# End of 10.5 Test +# Beginning of 10.7 test +# +# MDEV-26238: Remove inconsistent behaviour of --default-* options in +# my_print_defaults +# +# checking that --defaults* option only works when mentioned at beginning +# Testing --defaults-file at beginning only +--key_buffer_size=20M +--max_allowed_packet=250M +--table_open_cache=1000 +# Testing --defaults-extra-file works at beginning only +--key_buffer_size=20M +--max_allowed_packet=250M +--table_open_cache=1000 +# Testing --defaults-group-suffix works at beginning only --key_buffer_size=20M --max_allowed_packet=250M --table_open_cache=1000 --table_definition_cache=2000 --read_buffer_size=1M --thread_cache_size=8 -# Testing --no-defaults -# End of 10.5 Test +# End of 10.7 test diff --git a/mysql-test/main/my_print_defaults.test b/mysql-test/main/my_print_defaults.test index bfd4e56382632..bb650f49e83bf 100644 --- a/mysql-test/main/my_print_defaults.test +++ b/mysql-test/main/my_print_defaults.test @@ -30,7 +30,7 @@ long_query_time=60 slow_query_log=1 EOF ---exec $MYSQL_MY_PRINT_DEFAULTS --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/tmp1.cnf -c $MYSQLTEST_VARDIR/tmp/tmp2.cnf --mysqld mysql.server +--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/tmp1.cnf --defaults-file=$MYSQLTEST_VARDIR/tmp/tmp2.cnf --mysqld mysql.server --remove_file $MYSQLTEST_VARDIR/tmp/tmp1.cnf --remove_file $MYSQLTEST_VARDIR/tmp/tmp2.cnf @@ -55,10 +55,8 @@ max_allowed_packet=250M table_open_cache=1000 EOF ---echo # Testing -e ---exec $MYSQL_MY_PRINT_DEFAULTS -e $MYSQLTEST_VARDIR/tmp/tmp1.cnf -c $MYSQLTEST_VARDIR/tmp/tmp2.cnf --mysqld mysql.server --echo #Testing --defaults-extra-file ---exec $MYSQL_MY_PRINT_DEFAULTS --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/tmp1.cnf -c $MYSQLTEST_VARDIR/tmp/tmp2.cnf --mysqld mysql.server +--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/tmp1.cnf --defaults-file=$MYSQLTEST_VARDIR/tmp/tmp2.cnf --mysqld mysql.server --remove_file $MYSQLTEST_VARDIR/tmp/tmp1.cnf --remove_file $MYSQLTEST_VARDIR/tmp/tmp2.cnf @@ -87,20 +85,80 @@ read_buffer_size=1M thread_cache_size=8 EOF ---echo # Testing -c option ---exec $MYSQL_MY_PRINT_DEFAULTS -c $MYSQLTEST_VARDIR/tmp/tmp2.cnf --mysqld mysql.server --echo # Testing --defaults-file --exec $MYSQL_MY_PRINT_DEFAULTS --defaults-file=$MYSQLTEST_VARDIR/tmp/tmp2.cnf --mysqld mysql.server ---echo # Testing -g option ---exec $MYSQL_MY_PRINT_DEFAULTS -c $MYSQLTEST_VARDIR/tmp/tmp3.cnf --mysqld mysql.server -g .1 --echo # Testing --defaults-group-suffix ---exec $MYSQL_MY_PRINT_DEFAULTS -c $MYSQLTEST_VARDIR/tmp/tmp3.cnf --mysqld mysql.server --defaults-group-suffix=.1 +--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-file=$MYSQLTEST_VARDIR/tmp/tmp3.cnf --defaults-group-suffix=.1 --mysqld mysql.server --echo # Testing --no-defaults ---exec $MYSQL_MY_PRINT_DEFAULTS --no-defaults +--exec $MYSQL_MY_PRINT_DEFAULTS --no-defaults --mysqld --remove_file $MYSQLTEST_VARDIR/tmp/tmp2.cnf --remove_file $MYSQLTEST_VARDIR/tmp/tmp3.cnf --echo # End of 10.5 Test + +--echo # Beginning of 10.7 test + +--echo # +--echo # MDEV-26238: Remove inconsistent behaviour of --default-* options in +--echo # my_print_defaults +--echo # + +--write_file $MYSQLTEST_VARDIR/tmp/tmp1.cnf +[mariadb] +key_buffer_size=20M +max_allowed_packet=250M +table_open_cache=1000 +EOF + +--write_file $MYSQLTEST_VARDIR/tmp/tmp2.cnf +[mariadb] +key_buffer_size=10M +max_allowed_packet=250M +table_open_cache=1000 +EOF + +--write_file $MYSQLTEST_VARDIR/tmp/tmp3.cnf +[mariadb] +key_buffer_size=30M +max_allowed_packet=250M +table_open_cache=1000 +EOF + +--echo # checking that --defaults* option only works when mentioned at beginning + +--echo # Testing --defaults-file at beginning only +--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-file=$MYSQLTEST_VARDIR/tmp/tmp1.cnf --mysqld +--error 7 +--exec $MYSQL_MY_PRINT_DEFAULTS --mysqld --defaults-file=$MYSQLTEST_VARDIR/tmp/tmp1.cnf +--remove_file $MYSQLTEST_VARDIR/tmp/tmp3.cnf + +--echo # Testing --defaults-extra-file works at beginning only +--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-file=$MYSQLTEST_VARDIR/tmp/tmp1.cnf --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/tmp2.cnf --mysqld +--error 7 +--exec $MYSQL_MY_PRINT_DEFAULTS --mysqld --defaults-file=$MYSQLTEST_VARDIR/tmp/tmp1.cnf --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/tmp2.cnf + +--write_file $MYSQLTEST_VARDIR/tmp/tmp3.cnf +[mariadb] +key_buffer_size=20M +max_allowed_packet=250M +table_open_cache=1000 + +[mariadb.1] +table_definition_cache=2000 +read_buffer_size=1M +thread_cache_size=8 +EOF + +--echo # Testing --defaults-group-suffix works at beginning only +--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-file=$MYSQLTEST_VARDIR/tmp/tmp3.cnf --defaults-group-suffix=.1 --mysqld +--error 7 +--exec $MYSQL_MY_PRINT_DEFAULTS --mysqld --defaults-file=$MYSQLTEST_VARDIR/tmp/tmp3.cnf --defaults-group-suffix=.1 + +--remove_file $MYSQLTEST_VARDIR/tmp/tmp1.cnf +--remove_file $MYSQLTEST_VARDIR/tmp/tmp2.cnf +--remove_file $MYSQLTEST_VARDIR/tmp/tmp3.cnf + +--echo # End of 10.7 test diff --git a/mysql-test/main/myisam-optimize.result b/mysql-test/main/myisam-optimize.result deleted file mode 100644 index 9de3c24301fb3..0000000000000 --- a/mysql-test/main/myisam-optimize.result +++ /dev/null @@ -1,83 +0,0 @@ -# -# MDEV-8475 stale .TMM file causes Aria engine to stop serving the table -# -create table t1 (pk int primary key, i int) engine=MyISAM; -insert into t1 values (1,1),(2,2); -connect con1,localhost,root,,; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `pk` int(11) NOT NULL, - `i` int(11) DEFAULT NULL, - PRIMARY KEY (`pk`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -disconnect con1; -connect con1,localhost,root,,; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `pk` int(11) NOT NULL, - `i` int(11) DEFAULT NULL, - PRIMARY KEY (`pk`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status Table is already up to date -disconnect con1; -connect con1,localhost,root,,; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `pk` int(11) NOT NULL, - `i` int(11) DEFAULT NULL, - PRIMARY KEY (`pk`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status Table is already up to date -disconnect con1; -connection default; -DROP TABLE t1; -create table t1 (pk int primary key, i int) engine=aria; -insert into t1 values (1,1),(2,2); -connect con1,localhost,root,,; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `pk` int(11) NOT NULL, - `i` int(11) DEFAULT NULL, - PRIMARY KEY (`pk`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -disconnect con1; -connect con1,localhost,root,,; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `pk` int(11) NOT NULL, - `i` int(11) DEFAULT NULL, - PRIMARY KEY (`pk`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status Table is already up to date -disconnect con1; -connect con1,localhost,root,,; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `pk` int(11) NOT NULL, - `i` int(11) DEFAULT NULL, - PRIMARY KEY (`pk`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status Table is already up to date -disconnect con1; -connection default; -DROP TABLE t1; diff --git a/mysql-test/main/myisam-optimize.test b/mysql-test/main/myisam-optimize.test deleted file mode 100644 index 7c1fe4ec1c899..0000000000000 --- a/mysql-test/main/myisam-optimize.test +++ /dev/null @@ -1,58 +0,0 @@ ---echo # ---echo # MDEV-8475 stale .TMM file causes Aria engine to stop serving the table ---echo # -create table t1 (pk int primary key, i int) engine=MyISAM; -insert into t1 values (1,1),(2,2); ---let $datadir=`SELECT @@datadir` - ---write_file $datadir/test/t1.TMM -EOF - ---connect (con1,localhost,root,,) -SHOW CREATE TABLE t1; -OPTIMIZE TABLE t1; ---disconnect con1 - ---connect (con1,localhost,root,,) -SHOW CREATE TABLE t1; -OPTIMIZE TABLE t1; ---disconnect con1 - ---connect (con1,localhost,root,,) -SHOW CREATE TABLE t1; -OPTIMIZE TABLE t1; ---disconnect con1 - -# Cleanup ---connection default -DROP TABLE t1; - -# -# Test also Aria -# - -create table t1 (pk int primary key, i int) engine=aria; -insert into t1 values (1,1),(2,2); ---let $datadir=`SELECT @@datadir` - ---write_file $datadir/test/t1.TMM -EOF - ---connect (con1,localhost,root,,) -SHOW CREATE TABLE t1; -OPTIMIZE TABLE t1; ---disconnect con1 - ---connect (con1,localhost,root,,) -SHOW CREATE TABLE t1; -OPTIMIZE TABLE t1; ---disconnect con1 - ---connect (con1,localhost,root,,) -SHOW CREATE TABLE t1; -OPTIMIZE TABLE t1; ---disconnect con1 - -# Cleanup ---connection default -DROP TABLE t1; diff --git a/mysql-test/main/myisam.result b/mysql-test/main/myisam.result index 5c551a25afa9a..0b0099d7b8429 100644 --- a/mysql-test/main/myisam.result +++ b/mysql-test/main/myisam.result @@ -1,6 +1,5 @@ call mtr.add_suppression("Can't find record in '.*'"); call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); -drop table if exists t1,t2,t3; SET SQL_WARNINGS=1; CREATE TABLE t1 ( STRING_DATA char(255) default NULL, @@ -1147,7 +1146,7 @@ t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t2 like t1; show create table t2; Table Create Table @@ -1155,7 +1154,7 @@ t2 CREATE TABLE `t2` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t3 select * from t1; show create table t3; Table Create Table @@ -1163,7 +1162,7 @@ t3 CREATE TABLE `t3` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify c varchar(10); show create table t1; Table Create Table @@ -1171,7 +1170,7 @@ t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify v char(10); show create table t1; Table Create Table @@ -1179,7 +1178,7 @@ t1 CREATE TABLE `t1` ( `v` char(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify t varchar(10); Warnings: Note 1265 Data truncated for column 't' at row 2 @@ -1189,7 +1188,7 @@ t1 CREATE TABLE `t1` ( `v` char(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+*+*+ * @@ -1205,7 +1204,7 @@ t1 CREATE TABLE `t1` ( KEY `v` (`v`), KEY `c` (`c`), KEY `t` (`t`(10)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1; count(*) 270 @@ -1429,7 +1428,7 @@ t1 CREATE TABLE `t1` ( KEY `c` (`c`), KEY `t` (`t`(10)), KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1 where v='a'; count(*) 10 @@ -1509,7 +1508,7 @@ t1 CREATE TABLE `t1` ( KEY `c` (`c`), KEY `t` (`t`(10)), KEY `v` (`v`(30)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1 where v='a'; count(*) 10 @@ -1589,7 +1588,7 @@ t1 CREATE TABLE `t1` ( KEY `c` (`c`), KEY `t` (`t`(10)), KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -1667,14 +1666,14 @@ t1 CREATE TABLE `t1` ( KEY `v` (`v`(5)), KEY `c` (`c`(5)), KEY `t` (`t`(5)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (v char(10) character set utf8); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` char(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `v` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (v varchar(10), c char(10)) row_format=fixed; show create table t1; @@ -1682,7 +1681,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=FIXED insert into t1 values('a','a'),('a ','a '); select concat('*',v,'*',c,'*') from t1; concat('*',v,'*',c,'*') @@ -1716,7 +1715,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `v` mediumtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set statement sql_mode = 'NO_ENGINE_SUBSTITUTION' for create table t1 (v varchar(65530) character set utf8); @@ -1725,8 +1724,8 @@ Note 1246 Converting column 'v' from VARCHAR to TEXT show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` mediumtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `v` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set statement sql_mode='' for create table t1 (v varchar(65535)); @@ -1736,7 +1735,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `v` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set default_storage_engine=MyISAM; set @save_concurrent_insert=@@concurrent_insert; @@ -1968,7 +1967,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=1024 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int not null, key `a` (a) key_block_size=2048); show create table t1; @@ -1976,7 +1975,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=2048 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a varchar(2048), key `a` (a)); Warnings: @@ -1986,7 +1985,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(2048) DEFAULT NULL, KEY `a` (`a`(1000)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a varchar(2048), key `a` (a) key_block_size=1024); Warnings: @@ -1996,7 +1995,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(2048) DEFAULT NULL, KEY `a` (`a`(1000)) KEY_BLOCK_SIZE=4096 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=1024; Warnings: @@ -2008,7 +2007,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(2048) DEFAULT NULL, KEY `a` (`a`), KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=4096 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1024 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=1024 alter table t1 key_block_size=2048; show create table t1; Table Create Table @@ -2017,7 +2016,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(2048) DEFAULT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=1024, KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=4096 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2048 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=2048 alter table t1 add c int, add key (c); show create table t1; Table Create Table @@ -2028,7 +2027,7 @@ t1 CREATE TABLE `t1` ( KEY `a` (`a`) KEY_BLOCK_SIZE=1024, KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=4096, KEY `c` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2048 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=2048 alter table t1 key_block_size=0; alter table t1 add d int, add key (d); show create table t1; @@ -2042,7 +2041,7 @@ t1 CREATE TABLE `t1` ( KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=4096, KEY `c` (`c`) KEY_BLOCK_SIZE=2048, KEY `d` (`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=8192; Warnings: @@ -2054,7 +2053,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(2048) DEFAULT NULL, KEY `a` (`a`), KEY `b` (`b`(1000)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8192 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=8192 drop table t1; create table t1 (a int not null, b varchar(512), key (a), key(b)); show create table t1; @@ -2064,7 +2063,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(512) DEFAULT NULL, KEY `a` (`a`), KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 key_block_size=2048; show create table t1; Table Create Table @@ -2073,7 +2072,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(512) DEFAULT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=1024, KEY `b` (`b`) KEY_BLOCK_SIZE=3072 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2048 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=2048 alter table t1 add c int, add key (c); show create table t1; Table Create Table @@ -2084,7 +2083,7 @@ t1 CREATE TABLE `t1` ( KEY `a` (`a`) KEY_BLOCK_SIZE=1024, KEY `b` (`b`) KEY_BLOCK_SIZE=4096, KEY `c` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2048 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=2048 alter table t1 key_block_size=4096; show create table t1; Table Create Table @@ -2095,7 +2094,7 @@ t1 CREATE TABLE `t1` ( KEY `a` (`a`) KEY_BLOCK_SIZE=1024, KEY `b` (`b`), KEY `c` (`c`) KEY_BLOCK_SIZE=2048 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4096 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=4096 alter table t1 key_block_size=0; show create table t1; Table Create Table @@ -2106,7 +2105,7 @@ t1 CREATE TABLE `t1` ( KEY `a` (`a`) KEY_BLOCK_SIZE=1024, KEY `b` (`b`) KEY_BLOCK_SIZE=4096, KEY `c` (`c`) KEY_BLOCK_SIZE=2048 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 add d int, add key (d); show create table t1; Table Create Table @@ -2119,7 +2118,7 @@ t1 CREATE TABLE `t1` ( KEY `b` (`b`) KEY_BLOCK_SIZE=4096, KEY `c` (`c`) KEY_BLOCK_SIZE=2048, KEY `d` (`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 key_block_size=8192; show create table t1; Table Create Table @@ -2132,7 +2131,7 @@ t1 CREATE TABLE `t1` ( KEY `b` (`b`) KEY_BLOCK_SIZE=4096, KEY `c` (`c`) KEY_BLOCK_SIZE=2048, KEY `d` (`d`) KEY_BLOCK_SIZE=1024 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8192 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=8192 drop table t1; create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) key_block_size=8192; Warnings: @@ -2144,7 +2143,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(2048) DEFAULT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=1024, KEY `b` (`b`(1000)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8192 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=8192 drop table t1; create table t1 (a int not null, b int, key (a) key_block_size=1024, key(b) key_block_size=8192) key_block_size=16384; show create table t1; @@ -2154,7 +2153,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=1024, KEY `b` (`b`) KEY_BLOCK_SIZE=8192 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=16384 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=16384 drop table t1; create table t1 (a int not null, key `a` (a) key_block_size=512); show create table t1; @@ -2162,7 +2161,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=1024 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000); Warnings: @@ -2172,7 +2171,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(2048) DEFAULT NULL, KEY `a` (`a`(1000)) KEY_BLOCK_SIZE=4096 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int not null, key `a` (a) key_block_size=1025); show create table t1; @@ -2180,7 +2179,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=2048 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int not null, key key_block_size=1024 (a)); 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 '=1024 (a))' at line 1 @@ -2421,7 +2420,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `n` int(11) NOT NULL, `c` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 TRANSACTIONAL=1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci TRANSACTIONAL=1 drop table t1; CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam; INSERT INTO t1 VALUES (GeomFromText("LINESTRING(0 0)")); @@ -2706,3 +2705,108 @@ DROP TABLE t1; # # End of 5.5 tests # +# +# MDEV-27303 Table corruption after insert into a non-InnoDB table with DESC index +# +create table t1 ( +a bigint default 0, +b bigint default 0, +c binary(128) not null, +d datetime default '0000-00-00 00:00:00', +key (c desc,b,d,a) +) engine=aria; +insert into t1 (c) values +('xx'),('bb'),('tt'),('pp'),('mm'),('yy'),('rr'),('bb'),('yy'),('gg'), +('dd'),('fx'),('wi'),('ix'),('ox'),('mu'),('ux'),('pm'),('mx'),('xu'), +('ul'),('lp'),('px'),('lp'),('xx'),('pq'),('qs'),('se'),('ee'),('xx'), +('rv'),('ff'),('vj'),('jy'),('yn'),('nc'),('nx'),('hj'),('ji'),('ik'), +('kk'),('ww'),('xx'),('yd'),('dw'),('wk'),('kr'),('dd'),('rj'),('jf'), +('bx'),('fc'),('cp'),('pm'),('mw'),('wy'),('yl'),('li'),('ic'),('he'), +('ci'),('il'),('lz'),('zd'),('gz'),('xd'),('ze'),('dm'),('ms'),('xd'), +('sw'),('we'),('nb'),('tx'),('vr'),('xw'),('aa'),('ah'),('hd'),('jl'), +('lf'),('fw'),('wx'),('xh'),('hr'),('zx'),('vw'),('rm'),('mx'),('xt'), +('tp'),('ps'),('sh'),('ga'),('df'),('as'),('gz'),('xd'),('yy'),('xr'); +check table t1 extended; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +# +# MDEV-27309 Server crash or ASAN memcpy-param-overlap upon INSERT into Aria/MyISAM table with DESC key +# +CREATE TABLE t1 (id INT, c BINARY(80), PRIMARY KEY(id)); +ALTER TABLE t1 ADD KEY(c DESC, id); +INSERT INTO t1 VALUES (1,NULL),(2,''),(3,''); +DROP TABLE t1; +# +# MDEV-27330 Wrong sorting order with DESC index and empty strings in MyISAM/Aria table +# +create table t (id int, c char(128) not null, key (c desc)); +insert into t values (1,''),(2,'foo'),(3,''),(4,'bar'); +select c from t order by c; +c + + +bar +foo +drop table t; +# +# MDEV-27340 NULL gets lost (becomes empty string), SELECT hangs with DESC index on MyISAM/Aria table +# +create table t (c char(8), key(c desc)) character set utf8mb4; +insert into t values (''),('foo'),(null),(''),('bar'); +check table t; +Table Op Msg_type Msg_text +test.t check status OK +check table t extended; +Table Op Msg_type Msg_text +test.t check status OK +select distinct c from t; +c +NULL + +bar +foo +select c from t; +c +foo +bar + + +NULL +drop table t; +# +# MDEV-27434 DESC attribute does not work with auto-increment on secondary column of multi-part index +# +create table t (a int auto_increment, b int, unique(b,a desc)) engine=myisam; +insert ignore into t (b) values (10),(10),(10); +select * from t; +a b +3 10 +2 10 +1 10 +drop table t; +# +# MDEV-27585 Auto-increment on secondary column increments unexpectedly with DESC key +# +create table t (c char(16), i int auto_increment, index (c,i desc)) engine=myisam collate latin1_swedish_ci; +insert into t (c) values ('ä'),('a'); +select hex(c),c,i from t order by c, i; +hex(c) c i +61 a 1 +C3A4 ä 1 +drop table t; +# +# MDEV-27617 HANDLER KEY > (x) does not work with DESC keys, Spider is affected and returns wrong results +# +create table t (a int, b char(1), primary key(a desc)) engine=myisam; +insert into t VALUES (1,'f'),(2,'g'),(3,'j'), (4,'i'),(5,'h'); +handler t open; +# MUST return 2,'g'. '>' always means READ_AFTER_KEY. desc or not. +handler t read `primary` > (3); +a b +2 g +handler t close; +drop table t; +# +# End of 10.8 tests +# diff --git a/mysql-test/main/myisam.test b/mysql-test/main/myisam.test index 2ae4da671e66e..ec49e71bc2d2a 100644 --- a/mysql-test/main/myisam.test +++ b/mysql-test/main/myisam.test @@ -8,9 +8,6 @@ call mtr.add_suppression("Can't find record in '.*'"); call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); # Initialise ---disable_warnings -drop table if exists t1,t2,t3; ---enable_warnings SET SQL_WARNINGS=1; # @@ -508,6 +505,7 @@ drop table t1; # Bug #14400 Join could miss concurrently inserted row # # Partial key. +--disable_service_connection create table t1 (a int not null, primary key(a)); create table t2 (a int not null, b int not null, primary key(a,b)); insert into t1 values (1),(2),(3),(4),(5),(6); @@ -539,7 +537,7 @@ SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2 WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1; UNLOCK TABLES; DROP TABLE t1,t2; - +--enable_service_connection # End of 4.0 tests # @@ -1830,3 +1828,85 @@ DROP TABLE t1; --echo # --echo # End of 5.5 tests --echo # + +--echo # +--echo # MDEV-27303 Table corruption after insert into a non-InnoDB table with DESC index +--echo # +create table t1 ( + a bigint default 0, + b bigint default 0, + c binary(128) not null, + d datetime default '0000-00-00 00:00:00', + key (c desc,b,d,a) +) engine=aria; +insert into t1 (c) values + ('xx'),('bb'),('tt'),('pp'),('mm'),('yy'),('rr'),('bb'),('yy'),('gg'), + ('dd'),('fx'),('wi'),('ix'),('ox'),('mu'),('ux'),('pm'),('mx'),('xu'), + ('ul'),('lp'),('px'),('lp'),('xx'),('pq'),('qs'),('se'),('ee'),('xx'), + ('rv'),('ff'),('vj'),('jy'),('yn'),('nc'),('nx'),('hj'),('ji'),('ik'), + ('kk'),('ww'),('xx'),('yd'),('dw'),('wk'),('kr'),('dd'),('rj'),('jf'), + ('bx'),('fc'),('cp'),('pm'),('mw'),('wy'),('yl'),('li'),('ic'),('he'), + ('ci'),('il'),('lz'),('zd'),('gz'),('xd'),('ze'),('dm'),('ms'),('xd'), + ('sw'),('we'),('nb'),('tx'),('vr'),('xw'),('aa'),('ah'),('hd'),('jl'), + ('lf'),('fw'),('wx'),('xh'),('hr'),('zx'),('vw'),('rm'),('mx'),('xt'), + ('tp'),('ps'),('sh'),('ga'),('df'),('as'),('gz'),('xd'),('yy'),('xr'); +check table t1 extended; +drop table t1; + +--echo # +--echo # MDEV-27309 Server crash or ASAN memcpy-param-overlap upon INSERT into Aria/MyISAM table with DESC key +--echo # +CREATE TABLE t1 (id INT, c BINARY(80), PRIMARY KEY(id)); +ALTER TABLE t1 ADD KEY(c DESC, id); +INSERT INTO t1 VALUES (1,NULL),(2,''),(3,''); +DROP TABLE t1; + +--echo # +--echo # MDEV-27330 Wrong sorting order with DESC index and empty strings in MyISAM/Aria table +--echo # +create table t (id int, c char(128) not null, key (c desc)); +insert into t values (1,''),(2,'foo'),(3,''),(4,'bar'); +select c from t order by c; +drop table t; + +--echo # +--echo # MDEV-27340 NULL gets lost (becomes empty string), SELECT hangs with DESC index on MyISAM/Aria table +--echo # +create table t (c char(8), key(c desc)) character set utf8mb4; +insert into t values (''),('foo'),(null),(''),('bar'); +check table t; +check table t extended; +select distinct c from t; +select c from t; +drop table t; + +--echo # +--echo # MDEV-27434 DESC attribute does not work with auto-increment on secondary column of multi-part index +--echo # +create table t (a int auto_increment, b int, unique(b,a desc)) engine=myisam; +insert ignore into t (b) values (10),(10),(10); +select * from t; +drop table t; + +--echo # +--echo # MDEV-27585 Auto-increment on secondary column increments unexpectedly with DESC key +--echo # +create table t (c char(16), i int auto_increment, index (c,i desc)) engine=myisam collate latin1_swedish_ci; +insert into t (c) values ('ä'),('a'); +select hex(c),c,i from t order by c, i; +drop table t; + +--echo # +--echo # MDEV-27617 HANDLER KEY > (x) does not work with DESC keys, Spider is affected and returns wrong results +--echo # +create table t (a int, b char(1), primary key(a desc)) engine=myisam; +insert into t VALUES (1,'f'),(2,'g'),(3,'j'), (4,'i'),(5,'h'); +handler t open; +--echo # MUST return 2,'g'. '>' always means READ_AFTER_KEY. desc or not. +handler t read `primary` > (3); +handler t close; +drop table t; + +--echo # +--echo # End of 10.8 tests +--echo # diff --git a/mysql-test/main/myisam_debug_keys.result b/mysql-test/main/myisam_debug_keys.result new file mode 100644 index 0000000000000..f6964ff412484 --- /dev/null +++ b/mysql-test/main/myisam_debug_keys.result @@ -0,0 +1,7198 @@ +# +# MDEV-29672 Add MTR tests covering key and key segment flags and types +# +SET debug_dbug='+d,key'; +CREATE TABLE types ( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +type TEXT NOT NULL, +prefix_length INT NOT NULL +); +Warnings: +Note 1105 DBUG: prep_create_table: name=`PRIMARY` flags=00000001 (HA_NOSAME) +Note 1105 DBUG: ha_myisam::create: name=`PRIMARY` flags=00000011 (HA_AUTO_KEY|HA_NOSAME) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +INSERT INTO types (type, prefix_length) VALUES +('INT', 0), +('BIGINT', 0), +('DOUBLE', 0), +('DECIMAL(20,10)', 0), +('CHAR(4)', 0), +('CHAR(10)', 0), +('VARCHAR(4)', 0), +('VARCHAR(6)', 0), +('VARCHAR(8)', 0), +('VARCHAR(12)', 0), +('VARCHAR(16)', 0), +('VARCHAR(100)', 0), +('TEXT', 4), +('TEXT', 6), +('TEXT', 8), +('TEXT', 12), +('TEXT', 16), +('TEXT', 100); +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`PRIMARY` flags=00000011 (HA_AUTO_KEY|HA_NOSAME) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +BEGIN NOT ATOMIC +DECLARE create2_template TEXT +DEFAULT 'CREATE TABLE t1 (a TYPE1 NOT NULL, b TYPE2 NOT NULL, KEY(SEG1,SEG2))'; +DECLARE cur2 CURSOR FOR +SELECT t1.type AS type1, +t2.type AS type2, +t1.prefix_length AS prefix_length1, +t2.prefix_length AS prefix_length2 +FROM types AS t1, types AS t2 +ORDER BY t1.id, t2.id; +FOR rec IN cur2 DO +BEGIN +DECLARE tabledef TEXT DEFAULT REPLACE(create2_template,'TYPE1', rec.type1); +SET tabledef=REPLACE(tabledef, 'TYPE2', rec.type2); +SET tabledef=REPLACE(tabledef, 'SEG1', +IF(rec.prefix_length1, +CONCAT('a(',rec.prefix_length1,')'), 'a')); +SET tabledef=REPLACE(tabledef, 'SEG2', +IF(rec.prefix_length2, +CONCAT('b(',rec.prefix_length2,')'), 'b')); +SELECT tabledef AS ``; +EXECUTE IMMEDIATE tabledef; +SHOW WARNINGS; +SELECT * FROM t1; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +DROP TABLE t1; +END; +END FOR; +END; +$$ + +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b BIGINT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b DOUBLE NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b CHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b CHAR(10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b VARCHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b VARCHAR(6) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b VARCHAR(8) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b VARCHAR(12) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b VARCHAR(16) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b VARCHAR(100) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b TEXT NOT NULL, KEY(a,b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b TEXT NOT NULL, KEY(a,b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b TEXT NOT NULL, KEY(a,b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b TEXT NOT NULL, KEY(a,b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b TEXT NOT NULL, KEY(a,b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a INT NOT NULL, b TEXT NOT NULL, KEY(a,b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=4 LONG_INT +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b INT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b BIGINT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b DOUBLE NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b CHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b CHAR(10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b VARCHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b VARCHAR(6) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b VARCHAR(8) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b VARCHAR(12) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b VARCHAR(16) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b VARCHAR(100) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b TEXT NOT NULL, KEY(a,b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b TEXT NOT NULL, KEY(a,b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b TEXT NOT NULL, KEY(a,b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b TEXT NOT NULL, KEY(a,b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b TEXT NOT NULL, KEY(a,b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a BIGINT NOT NULL, b TEXT NOT NULL, KEY(a,b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=10 LONGLONG +Note 1105 DBUG: seg[0].flag=00000040 (HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b INT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b BIGINT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b DOUBLE NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b CHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b CHAR(10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b VARCHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b VARCHAR(6) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b VARCHAR(8) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b VARCHAR(12) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b VARCHAR(16) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b VARCHAR(100) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b TEXT NOT NULL, KEY(a,b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b TEXT NOT NULL, KEY(a,b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b TEXT NOT NULL, KEY(a,b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b TEXT NOT NULL, KEY(a,b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b TEXT NOT NULL, KEY(a,b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DOUBLE NOT NULL, b TEXT NOT NULL, KEY(a,b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000800 (HA_CAN_MEMCMP) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` double NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b INT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b BIGINT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b DOUBLE NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b CHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b CHAR(10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b VARCHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b VARCHAR(6) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b VARCHAR(8) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b VARCHAR(12) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b VARCHAR(16) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b VARCHAR(100) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b TEXT NOT NULL, KEY(a,b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b TEXT NOT NULL, KEY(a,b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b TEXT NOT NULL, KEY(a,b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b TEXT NOT NULL, KEY(a,b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b TEXT NOT NULL, KEY(a,b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a DECIMAL(20,10) NOT NULL, b TEXT NOT NULL, KEY(a,b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=2 BINARY +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(20,10) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b INT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b BIGINT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b DOUBLE NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b CHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b CHAR(10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b VARCHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b VARCHAR(6) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b VARCHAR(8) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b VARCHAR(12) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b VARCHAR(16) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b VARCHAR(100) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b TEXT NOT NULL, KEY(a,b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b TEXT NOT NULL, KEY(a,b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b TEXT NOT NULL, KEY(a,b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b TEXT NOT NULL, KEY(a,b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b TEXT NOT NULL, KEY(a,b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(4) NOT NULL, b TEXT NOT NULL, KEY(a,b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000000 +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(4) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b INT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b BIGINT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b DOUBLE NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b CHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b CHAR(10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b VARCHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b VARCHAR(6) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b VARCHAR(8) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b VARCHAR(12) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b VARCHAR(16) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b VARCHAR(100) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b TEXT NOT NULL, KEY(a,b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b TEXT NOT NULL, KEY(a,b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b TEXT NOT NULL, KEY(a,b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b TEXT NOT NULL, KEY(a,b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b TEXT NOT NULL, KEY(a,b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a CHAR(10) NOT NULL, b TEXT NOT NULL, KEY(a,b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000001 (HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000000E (HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED|HA_PACK_KEY) +Note 1105 DBUG: seg[0].type=1 TEXT +Note 1105 DBUG: seg[0].flag=00000003 (HA_PACK_KEY|HA_SPACE_PACK) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b INT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b BIGINT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b DOUBLE NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b CHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b CHAR(10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b VARCHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b VARCHAR(6) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b VARCHAR(8) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b VARCHAR(12) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b VARCHAR(16) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b VARCHAR(100) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b TEXT NOT NULL, KEY(a,b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b TEXT NOT NULL, KEY(a,b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b TEXT NOT NULL, KEY(a,b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b TEXT NOT NULL, KEY(a,b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b TEXT NOT NULL, KEY(a,b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(4) NOT NULL, b TEXT NOT NULL, KEY(a,b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(4) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b INT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b BIGINT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b DOUBLE NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b CHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b CHAR(10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b VARCHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b VARCHAR(6) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000000 +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b VARCHAR(8) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b VARCHAR(12) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b VARCHAR(16) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b VARCHAR(100) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b TEXT NOT NULL, KEY(a,b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b TEXT NOT NULL, KEY(a,b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b TEXT NOT NULL, KEY(a,b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b TEXT NOT NULL, KEY(a,b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b TEXT NOT NULL, KEY(a,b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(6) NOT NULL, b TEXT NOT NULL, KEY(a,b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(6) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b INT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b BIGINT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b DOUBLE NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b CHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b CHAR(10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b VARCHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b VARCHAR(6) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b VARCHAR(8) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b VARCHAR(12) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b VARCHAR(16) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b VARCHAR(100) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b TEXT NOT NULL, KEY(a,b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b TEXT NOT NULL, KEY(a,b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b TEXT NOT NULL, KEY(a,b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b TEXT NOT NULL, KEY(a,b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b TEXT NOT NULL, KEY(a,b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL, b TEXT NOT NULL, KEY(a,b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(8) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b INT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b BIGINT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b DOUBLE NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b CHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b CHAR(10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b VARCHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b VARCHAR(6) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b VARCHAR(8) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b VARCHAR(12) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b VARCHAR(16) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b VARCHAR(100) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b TEXT NOT NULL, KEY(a,b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b TEXT NOT NULL, KEY(a,b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b TEXT NOT NULL, KEY(a,b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b TEXT NOT NULL, KEY(a,b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b TEXT NOT NULL, KEY(a,b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(12) NOT NULL, b TEXT NOT NULL, KEY(a,b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(12) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b INT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b BIGINT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b DOUBLE NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b CHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b CHAR(10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b VARCHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b VARCHAR(6) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b VARCHAR(8) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b VARCHAR(12) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b VARCHAR(16) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b VARCHAR(100) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b TEXT NOT NULL, KEY(a,b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b TEXT NOT NULL, KEY(a,b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b TEXT NOT NULL, KEY(a,b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b TEXT NOT NULL, KEY(a,b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b TEXT NOT NULL, KEY(a,b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(16) NOT NULL, b TEXT NOT NULL, KEY(a,b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(16) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b INT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b BIGINT NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b DOUBLE NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b CHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b CHAR(10) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b VARCHAR(4) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b VARCHAR(6) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b VARCHAR(8) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b VARCHAR(12) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b VARCHAR(16) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b VARCHAR(100) NOT NULL, KEY(a,b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0000002A (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b TEXT NOT NULL, KEY(a,b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b TEXT NOT NULL, KEY(a,b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b TEXT NOT NULL, KEY(a,b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b TEXT NOT NULL, KEY(a,b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b TEXT NOT NULL, KEY(a,b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a VARCHAR(100) NOT NULL, b TEXT NOT NULL, KEY(a,b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=15 VARTEXT1 +Note 1105 DBUG: seg[0].flag=00000008 (HA_VAR_LENGTH_PART) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(100) NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`,`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b INT NOT NULL, KEY(a(4),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`(4),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b BIGINT NOT NULL, KEY(a(4),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`(4),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b DOUBLE NOT NULL, KEY(a(4),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`(4),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a(4),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`(4),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b CHAR(4) NOT NULL, KEY(a(4),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`(4),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b CHAR(10) NOT NULL, KEY(a(4),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`(4),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(4) NOT NULL, KEY(a(4),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`(4),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(6) NOT NULL, KEY(a(4),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`(4),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(8) NOT NULL, KEY(a(4),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`(4),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(12) NOT NULL, KEY(a(4),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`(4),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(16) NOT NULL, KEY(a(4),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`(4),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(100) NOT NULL, KEY(a(4),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`(4),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(4),b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(4),`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(4),b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(4),`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(4),b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(4),`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(4),b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(4),`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(4),b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(4),`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(4),b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(4),`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b INT NOT NULL, KEY(a(6),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`(6),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b BIGINT NOT NULL, KEY(a(6),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`(6),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b DOUBLE NOT NULL, KEY(a(6),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`(6),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a(6),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`(6),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b CHAR(4) NOT NULL, KEY(a(6),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`(6),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b CHAR(10) NOT NULL, KEY(a(6),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`(6),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(4) NOT NULL, KEY(a(6),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`(6),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(6) NOT NULL, KEY(a(6),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`(6),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(8) NOT NULL, KEY(a(6),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`(6),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(12) NOT NULL, KEY(a(6),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`(6),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(16) NOT NULL, KEY(a(6),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`(6),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(100) NOT NULL, KEY(a(6),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`(6),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(6),b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(6),`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(6),b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010000 (HA_KEY_HAS_PART_KEY_SEG) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000000 +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000008 (HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(6),`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(6),b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(6),`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(6),b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(6),`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(6),b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(6),`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(6),b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010002 (HA_KEY_HAS_PART_KEY_SEG|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(6),`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b INT NOT NULL, KEY(a(8),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`(8),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b BIGINT NOT NULL, KEY(a(8),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`(8),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b DOUBLE NOT NULL, KEY(a(8),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`(8),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a(8),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`(8),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b CHAR(4) NOT NULL, KEY(a(8),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`(8),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b CHAR(10) NOT NULL, KEY(a(8),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`(8),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(4) NOT NULL, KEY(a(8),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`(8),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(6) NOT NULL, KEY(a(8),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`(8),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(8) NOT NULL, KEY(a(8),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`(8),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(12) NOT NULL, KEY(a(8),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`(8),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(16) NOT NULL, KEY(a(8),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`(8),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(100) NOT NULL, KEY(a(8),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`(8),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(8),b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(8),`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(8),b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(8),`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(8),b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(8),`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(8),b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(8),`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(8),b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(8),`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(8),b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(8),`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b INT NOT NULL, KEY(a(12),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`(12),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b BIGINT NOT NULL, KEY(a(12),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`(12),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b DOUBLE NOT NULL, KEY(a(12),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`(12),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a(12),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`(12),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b CHAR(4) NOT NULL, KEY(a(12),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`(12),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b CHAR(10) NOT NULL, KEY(a(12),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`(12),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(4) NOT NULL, KEY(a(12),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`(12),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(6) NOT NULL, KEY(a(12),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`(12),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(8) NOT NULL, KEY(a(12),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`(12),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(12) NOT NULL, KEY(a(12),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`(12),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(16) NOT NULL, KEY(a(12),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`(12),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(100) NOT NULL, KEY(a(12),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`(12),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(12),b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(12),`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(12),b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(12),`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(12),b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(12),`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(12),b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(12),`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(12),b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(12),`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(12),b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(12),`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b INT NOT NULL, KEY(a(16),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`(16),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b BIGINT NOT NULL, KEY(a(16),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`(16),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b DOUBLE NOT NULL, KEY(a(16),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`(16),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a(16),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`(16),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b CHAR(4) NOT NULL, KEY(a(16),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`(16),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b CHAR(10) NOT NULL, KEY(a(16),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`(16),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(4) NOT NULL, KEY(a(16),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`(16),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(6) NOT NULL, KEY(a(16),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`(16),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(8) NOT NULL, KEY(a(16),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`(16),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(12) NOT NULL, KEY(a(16),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`(16),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(16) NOT NULL, KEY(a(16),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`(16),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(100) NOT NULL, KEY(a(16),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`(16),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(16),b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(16),`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(16),b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(16),`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(16),b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(16),`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(16),b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(16),`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(16),b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(16),`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(16),b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(16),`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b INT NOT NULL, KEY(a(100),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=4 LONG_INT +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`(100),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b BIGINT NOT NULL, KEY(a(100),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=10 LONGLONG +Note 1105 DBUG: seg[1].flag=00000040 (HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` bigint(20) NOT NULL, + KEY `a` (`a`(100),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b DOUBLE NOT NULL, KEY(a(100),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000800 (HA_CAN_MEMCMP) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=6 DOUBLE +Note 1105 DBUG: seg[1].flag=00000840 (HA_CAN_MEMCMP|HA_SWAP_KEY) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` double NOT NULL, + KEY `a` (`a`(100),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b DECIMAL(20,10) NOT NULL, KEY(a(100),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=2 BINARY +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` decimal(20,10) NOT NULL, + KEY `a` (`a`(100),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b CHAR(4) NOT NULL, KEY(a(100),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000000 +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` char(4) NOT NULL, + KEY `a` (`a`(100),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b CHAR(10) NOT NULL, KEY(a(100),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=0000002C (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_SPACE_PACK_USED) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=1 TEXT +Note 1105 DBUG: seg[1].flag=00000001 (HA_SPACE_PACK) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` char(10) NOT NULL, + KEY `a` (`a`(100),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(4) NOT NULL, KEY(a(100),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(4) NOT NULL, + KEY `a` (`a`(100),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(6) NOT NULL, KEY(a(100),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(6) NOT NULL, + KEY `a` (`a`(100),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(8) NOT NULL, KEY(a(100),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(8) NOT NULL, + KEY `a` (`a`(100),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(12) NOT NULL, KEY(a(100),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(12) NOT NULL, + KEY `a` (`a`(100),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(16) NOT NULL, KEY(a(100),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(16) NOT NULL, + KEY `a` (`a`(100),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b VARCHAR(100) NOT NULL, KEY(a(100),b)) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=15 VARTEXT1 +Note 1105 DBUG: seg[1].flag=00000008 (HA_VAR_LENGTH_PART) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` varchar(100) NOT NULL, + KEY `a` (`a`(100),`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(100),b(4))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(100),`b`(4)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(100),b(6))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=00010028 (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(100),`b`(6)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(100),b(8))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(100),`b`(8)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(100),b(12))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(100),`b`(12)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(100),b(16))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(100),`b`(16)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + +CREATE TABLE t1 (a TEXT NOT NULL, b TEXT NOT NULL, KEY(a(100),b(100))) +Level Code Message +Note 1105 DBUG: prep_create_table: name=`a` flags=0001002A (HA_KEY_HAS_PART_KEY_SEG|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY|HA_PACK_KEY) +Note 1105 DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +a b +Level Code Message +Note 1105 DBUG: ha_myisam::open: name=`a` flags=00000028 (HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=17 VARTEXT2 +Note 1105 DBUG: seg[0].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Note 1105 DBUG: seg[1].type=17 VARTEXT2 +Note 1105 DBUG: seg[1].flag=00000024 (HA_BLOB_PART|HA_PART_KEY_SEG) +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + `b` text NOT NULL, + KEY `a` (`a`(100),`b`(100)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE types; +SET debug_dbug=''; diff --git a/mysql-test/main/myisam_debug_keys.test b/mysql-test/main/myisam_debug_keys.test new file mode 100644 index 0000000000000..73d68637b2905 --- /dev/null +++ b/mysql-test/main/myisam_debug_keys.test @@ -0,0 +1,68 @@ +--source include/have_debug.inc + +--echo # +--echo # MDEV-29672 Add MTR tests covering key and key segment flags and types +--echo # + +SET debug_dbug='+d,key'; +CREATE TABLE types ( + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + type TEXT NOT NULL, + prefix_length INT NOT NULL +); +--disable_ps_protocol +INSERT INTO types (type, prefix_length) VALUES +('INT', 0), +('BIGINT', 0), +('DOUBLE', 0), +('DECIMAL(20,10)', 0), +('CHAR(4)', 0), +('CHAR(10)', 0), +('VARCHAR(4)', 0), +('VARCHAR(6)', 0), +('VARCHAR(8)', 0), +('VARCHAR(12)', 0), +('VARCHAR(16)', 0), +('VARCHAR(100)', 0), +('TEXT', 4), +('TEXT', 6), +('TEXT', 8), +('TEXT', 12), +('TEXT', 16), +('TEXT', 100); +--enable_ps_protocol +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE create2_template TEXT + DEFAULT 'CREATE TABLE t1 (a TYPE1 NOT NULL, b TYPE2 NOT NULL, KEY(SEG1,SEG2))'; + DECLARE cur2 CURSOR FOR + SELECT t1.type AS type1, + t2.type AS type2, + t1.prefix_length AS prefix_length1, + t2.prefix_length AS prefix_length2 + FROM types AS t1, types AS t2 + ORDER BY t1.id, t2.id; + FOR rec IN cur2 DO + BEGIN + DECLARE tabledef TEXT DEFAULT REPLACE(create2_template,'TYPE1', rec.type1); + SET tabledef=REPLACE(tabledef, 'TYPE2', rec.type2); + SET tabledef=REPLACE(tabledef, 'SEG1', + IF(rec.prefix_length1, + CONCAT('a(',rec.prefix_length1,')'), 'a')); + SET tabledef=REPLACE(tabledef, 'SEG2', + IF(rec.prefix_length2, + CONCAT('b(',rec.prefix_length2,')'), 'b')); + SELECT tabledef AS ``; + EXECUTE IMMEDIATE tabledef; + SHOW WARNINGS; + SELECT * FROM t1; + SHOW WARNINGS; + SHOW CREATE TABLE t1; + DROP TABLE t1; + END; + END FOR; +END; +$$ +DELIMITER ;$$ +DROP TABLE types; +SET debug_dbug=''; diff --git a/mysql-test/main/myisam_explain_non_select_all.result b/mysql-test/main/myisam_explain_non_select_all.result index 2ff966fdfd359..210679ba29ee8 100644 --- a/mysql-test/main/myisam_explain_non_select_all.result +++ b/mysql-test/main/myisam_explain_non_select_all.result @@ -17,6 +17,8 @@ FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a < 10; 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 update `test`.`t1` set `test`.`t1`.`a` = 10 where `test`.`t1`.`a` < 10 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 @@ -60,6 +62,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE a < 10; 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 delete from `test`.`t1` where `test`.`t1`.`a` < 10 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 @@ -103,6 +107,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 USING t1 WHERE a = 1; 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 delete from `test`.`t1` using `test`.`t1` where `test`.`t1`.`a` = 1 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 @@ -150,6 +156,8 @@ EXPLAIN EXTENDED UPDATE t1, t2 SET t1.a = 10 WHERE t1.a = 1; 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 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 update `test`.`t1` join `test`.`t2` set `test`.`t1`.`a` = 10 where `test`.`t1`.`a` = 1 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -200,6 +208,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t11 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY ALL NULL NULL NULL NULL 3 100.00 2 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 /* select#1 */ update `test`.`t1` `t11` join (/* select#2 */ select `test`.`t2`.`b` AS `b` from `test`.`t2`) `t12` set `test`.`t11`.`a` = 10 where `test`.`t11`.`a` = 1 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -248,6 +258,8 @@ EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE 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 2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 /* select#1 */ update `test`.`t1` set `test`.`t1`.`a` = 10 where (1,(/* select#2 */ select 1 from `test`.`t2` where `test`.`t2`.`b` < 3 and 1)) # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -300,6 +312,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 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 */ update `test`.`t1` set `test`.`t1`.`a` = 10 where (`test`.`t1`.`a`,(/* select#2 */ select `test`.`t2`.`b` from `test`.`t2` where `test`.`t1`.`a` < 3 and (`test`.`t1`.`a`) = `test`.`t2`.`b`)) # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -353,6 +366,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 100.00 1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 update `test`.`t1` semi join (`test`.`t2`) join `test`.`t2` set `test`.`t1`.`a` = 10 where `test`.`t2`.`b` < 3 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -405,6 +420,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t11 ALL NULL NULL NULL NULL 3 100.00 1 PRIMARY ALL NULL NULL NULL NULL 3 100.00 2 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 /* select#1 */ update `test`.`t1` `t11` join (/* select#2 */ select `test`.`t2`.`b` AS `b` from `test`.`t2`) `t12` set `test`.`t11`.`a` = `test`.`t11`.`a` + 10 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -457,6 +474,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY system NULL NULL NULL NULL 1 100.00 1 PRIMARY t11 ALL NULL NULL NULL NULL 3 100.00 2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 /* select#1 */ update `test`.`t1` `t11` set `test`.`t11`.`a` = `test`.`t11`.`a` + 10 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 @@ -511,6 +530,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t11 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY ALL NULL NULL NULL NULL 3 100.00 2 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 /* select#1 */ update `test`.`t1` `t11` join (/* select#2 */ select `test`.`t2`.`b` AS `b` from `test`.`t2`) `t12` set `test`.`t11`.`a` = 10 where `test`.`t11`.`a` > 1 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -555,6 +576,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE a > 1 LIMIT 1; 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 delete from `test`.`t1` where `test`.`t1`.`a` > 1 limit 1 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 @@ -598,6 +621,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE 0; 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 +Warnings: +Note 1003 delete from `test`.`t1` where 0 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 @@ -638,6 +663,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 USING t1 WHERE 0; 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 +Warnings: +Note 1003 delete from `test`.`t1` using `test`.`t1` where 0 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 @@ -678,6 +705,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE a = 3; 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 +Warnings: +Note 1003 delete from `test`.`t1` where `test`.`t1`.`a` = 3 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 5 @@ -719,6 +748,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE a < 3; 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 +Warnings: +Note 1003 delete from `test`.`t1` where `test`.`t1`.`a` < 3 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 5 @@ -758,6 +789,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.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 Impossible WHERE +Warnings: +Note 1003 delete from `test`.`t1` where `test`.`t1`.`a` > 0 order by `test`.`t1`.`a` # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 @@ -797,6 +830,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a; 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 +Warnings: +Note 1003 delete from `test`.`t1` where `test`.`t1`.`a` > 0 order by `test`.`t1`.`a` # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 @@ -840,6 +875,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE (@a:= a) ORDER BY a LIMIT 1; 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 +Warnings: +Note 1003 delete from `test`.`t1` where @a:=`test`.`t1`.`a` order by `test`.`t1`.`a` limit 1 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 @@ -884,6 +921,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 ORDER BY a ASC, b ASC LIMIT 1; 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 +Warnings: +Note 1003 delete from `test`.`t1` order by `test`.`t1`.`a`,`test`.`t1`.`b` limit 1 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 7 @@ -941,6 +980,8 @@ 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 1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 100.00 1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.b2,test.t1.b1 1 100.00 +Warnings: +Note 1003 delete from `test`.`t1`,`test`.`t2`,`test`.`t3` using `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 query Variable_name Value Handler_read_key 13 @@ -993,6 +1034,8 @@ EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2); 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 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 /* select#1 */ update `test`.`t1` set `test`.`t1`.`a` = 10 where (`test`.`t1`.`a`,(/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` where (`test`.`t1`.`a`) = `test`.`t2`.`a`)) # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -1043,6 +1086,8 @@ EXPLAIN EXTENDED DELETE FROM t1 WHERE a1 IN (SELECT a2 FROM t2 WHERE a2 > 2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using where 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where +Warnings: +Note 1003 /* select#1 */ delete from `test`.`t1` where (`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 query Variable_name Value Handler_read_key 4 @@ -1088,6 +1133,8 @@ EXPLAIN EXTENDED DELETE FROM t1 WHERE a1 IN (SELECT a2 FROM t2 WHERE a2 > 2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using where 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where +Warnings: +Note 1003 /* select#1 */ delete from `test`.`t1` where (`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 query Variable_name Value Handler_read_key 4 @@ -1132,6 +1179,8 @@ FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET i = 10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 +Warnings: +Note 1003 update `test`.`t1` set `test`.`t1`.`i` = 10 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 @@ -1175,6 +1224,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1; 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 +Warnings: +Note 1003 delete from `test`.`t1` # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 @@ -1221,6 +1272,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; 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 +Warnings: +Note 1003 delete from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 @@ -1267,6 +1320,8 @@ FLUSH TABLES; EXPLAIN EXTENDED INSERT INTO t2 SELECT * FROM t1; 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 +Warnings: +Note 1003 insert into `test`.`t2` select `test`.`t1`.`i` AS `i` from `test`.`t1` # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -1311,6 +1366,8 @@ FLUSH TABLES; EXPLAIN EXTENDED REPLACE INTO t2 SELECT * FROM t1; 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 +Warnings: +Note 1003 replace into `test`.`t2` select `test`.`t1`.`i` AS `i` from `test`.`t1` # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -1351,6 +1408,8 @@ FLUSH TABLES; EXPLAIN EXTENDED INSERT INTO t1 SET i = 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 +Warnings: +Note 1003 insert into `test`.`t1`(i) values (10) # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 @@ -1374,6 +1433,8 @@ FLUSH TABLES; EXPLAIN EXTENDED REPLACE INTO t1 SET i = 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 +Warnings: +Note 1003 replace into `test`.`t1`(i) values (10) # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 @@ -1402,6 +1463,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; 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 +Warnings: +Note 1003 delete from `test`.`t1` where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -1447,6 +1510,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; 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 +Warnings: +Note 1003 delete from `test`.`t1` where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -1500,6 +1565,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; 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 +Warnings: +Note 1003 delete from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 @@ -1554,6 +1621,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; 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 +Warnings: +Note 1003 delete from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 @@ -1603,6 +1672,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; 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 +Warnings: +Note 1003 delete from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 @@ -1657,6 +1728,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; 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 +Warnings: +Note 1003 delete from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 @@ -1712,6 +1785,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; 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 +Warnings: +Note 1003 delete from `test`.`t2` where `test`.`t2`.`key1` < 13 or `test`.`t2`.`key2` < 14 order by `test`.`t2`.`key1` # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 @@ -1765,6 +1840,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; 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 +Warnings: +Note 1003 delete 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 query Variable_name Value Handler_read_key 4 @@ -1812,6 +1889,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 ORDER BY a, b DESC LIMIT 5; 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 +Warnings: +Note 1003 delete from `test`.`t2` order by `test`.`t2`.`a`,`test`.`t2`.`b` desc limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 @@ -1866,6 +1945,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 ORDER BY a DESC, b DESC LIMIT 5; 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 +Warnings: +Note 1003 delete from `test`.`t2` order by `test`.`t2`.`a` desc,`test`.`t2`.`b` desc limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 @@ -1915,6 +1996,8 @@ FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; 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; Using buffer +Warnings: +Note 1003 update `test`.`t2` set `test`.`t2`.`a` = 10 where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -1963,6 +2046,8 @@ FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; 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 +Warnings: +Note 1003 update `test`.`t2` set `test`.`t2`.`a` = 10 where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -2017,6 +2102,8 @@ FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; 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 +Warnings: +Note 1003 update `test`.`t2` set `test`.`t2`.`d` = 10 where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 @@ -2072,6 +2159,8 @@ FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; 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; Using buffer +Warnings: +Note 1003 update `test`.`t2` set `test`.`t2`.`d` = 10 where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 @@ -2122,6 +2211,8 @@ FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; 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 +Warnings: +Note 1003 update `test`.`t2` set `test`.`t2`.`d` = 10 where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 @@ -2176,6 +2267,8 @@ FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; 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 +Warnings: +Note 1003 update `test`.`t2` set `test`.`t2`.`d` = 10 where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 @@ -2231,6 +2324,8 @@ FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET i = 123 WHERE key1 < 13 or key2 < 14 ORDER BY key1; 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 +Warnings: +Note 1003 update `test`.`t2` set `test`.`t2`.`i` = 123 where `test`.`t2`.`key1` < 13 or `test`.`t2`.`key2` < 14 order by `test`.`t2`.`key1` # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 @@ -2284,6 +2379,8 @@ FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; 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; Using buffer +Warnings: +Note 1003 update `test`.`t2` set `test`.`t2`.`a` = 10 where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` desc limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -2332,6 +2429,8 @@ FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5; 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 +Warnings: +Note 1003 update `test`.`t2` set `test`.`t2`.`c` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`b` desc limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 @@ -2387,6 +2486,8 @@ FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET c = 10 ORDER BY a DESC, b DESC LIMIT 5; 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 Using buffer +Warnings: +Note 1003 update `test`.`t2` set `test`.`t2`.`c` = 10 order by `test`.`t2`.`a` desc,`test`.`t2`.`b` desc limit 5 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 @@ -2439,6 +2540,8 @@ FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET c2 = 0 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; 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 +Warnings: +Note 1003 update `test`.`t1` set `test`.`t1`.`c2` = 0 where `test`.`t1`.`c1_idx` = 'y' order by `test`.`t1`.`pk` desc limit 2 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 @@ -2485,6 +2588,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; 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 +Warnings: +Note 1003 delete from `test`.`t1` where `test`.`t1`.`c1_idx` = 'y' order by `test`.`t1`.`pk` desc limit 2 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 @@ -2534,6 +2639,8 @@ FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a=a+10 WHERE a > 34; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using buffer +Warnings: +Note 1003 update `test`.`t1` set `test`.`t1`.`a` = `test`.`t1`.`a` + 10 where `test`.`t1`.`a` > 34 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 @@ -2581,6 +2688,8 @@ EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 update `test`.`t1` set NULL = 10 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 7 @@ -2624,6 +2733,8 @@ EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10 W id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 update `test`.`t1` set NULL = 10 where `test`.`t1`.`c3` = 10 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 7 @@ -2676,6 +2787,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ALL IDX NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1 +Note 1003 /* select#1 */ update `test`.`t1` set `test`.`t1`.`f2` = (/* select#2 */ select max(`test`.`t2`.`f4`) from `test`.`t2` where `test`.`t2`.`f3` = `test`.`t1`.`f1`) # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 7 @@ -2747,6 +2859,8 @@ EXPLAIN EXTENDED UPDATE v1 SET a = 1 WHERE a > 0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t11 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t12 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 update `test`.`t1` `t11` join `test`.`t1` `t12` set `test`.`t11`.`a` = 1 where `test`.`t11`.`a` > 0 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 @@ -2792,6 +2906,8 @@ 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 1 SIMPLE t11 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t12 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 update `test`.`t1` join `test`.`t1` `t11` join `test`.`t1` `t12` set `test`.`t11`.`a` = 1 where `test`.`t11`.`a` = `test`.`t1`.`a` # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 @@ -2841,6 +2957,8 @@ FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM v1 WHERE a < 4; 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 +Warnings: +Note 1003 /* select#1 */ delete from `test`.`t1` where `test`.`t1`.`a` < 4 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 @@ -2892,6 +3010,8 @@ EXPLAIN EXTENDED DELETE v1 FROM t2, v1 WHERE t2.x = v1.a; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using where 1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00 +Warnings: +Note 1003 delete from `test`.`t1` using `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`x` # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 @@ -2943,6 +3063,8 @@ EXPLAIN EXTENDED DELETE v1 FROM t2, v1 WHERE t2.x = v1.a; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using where 1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00 +Warnings: +Note 1003 delete from `test`.`t1` using `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`x` # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 @@ -2987,6 +3109,8 @@ FLUSH TABLES; EXPLAIN EXTENDED INSERT INTO v1 VALUES (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 +Warnings: +Note 1003 insert into `test`.`t1`(x) values (10) # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 @@ -3027,6 +3151,8 @@ FLUSH TABLES; EXPLAIN EXTENDED INSERT INTO v1 SELECT * FROM t1; 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 +Warnings: +Note 1003 insert into `test`.`t2`(x) /* select#1 */ select NULL AS `a` from `test`.`t1` # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -3084,6 +3210,8 @@ 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 2 DEPENDENT SUBQUERY index_subquery key0 key0 5 func 2 100.00 3 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using filesort +Warnings: +Note 1003 /* select#1 */ update `test`.`t1` set `test`.`t1`.`a` = 10 where (`test`.`t1`.`a`,(((`test`.`t1`.`a`) in (temporary) on key0))) # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -3137,6 +3265,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ref key0 key0 5 test.t1.a 2 100.00 FirstMatch(t1) 1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 3 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using filesort +Warnings: +Note 1003 /* select#1 */ update `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` set `test`.`t1`.`a` = 10 where `x`.`b` = `test`.`t1`.`a` # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -3192,6 +3322,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ALL NULL NULL NULL NULL 3 100.00 4 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using filesort 2 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 /* select#1 */ update `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 (/* select#2 */ select `test`.`t2`.`b` AS `b` from `test`.`t2`) `y` set `test`.`t1`.`a` = 10 where `x`.`b` = `test`.`t1`.`a` # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -3241,6 +3373,8 @@ JOIN t1 AS a12 ON a12.c1 = a11.c1 id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 0 100.00 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Note 1003 /* select#1 */ update `test`.`t3` set `test`.`t3`.`c3` = (/* select#2 */ select count(NULL) from `test`.`t1` `a11` straight_join `test`.`t2` `a21` join `test`.`t1` `a12` where 0) DROP TABLE t1, t2, t3; #73 CREATE TABLE t1 (id INT); @@ -3269,6 +3403,8 @@ FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a=a+1 WHERE a>10; 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; Using buffer +Warnings: +Note 1003 update `test`.`t1` set `test`.`t1`.`a` = `test`.`t1`.`a` + 1 where `test`.`t1`.`a` > 10 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 @@ -3306,6 +3442,8 @@ FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a=a+1 WHERE a>10 ORDER BY a+20; 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; Using filesort +Warnings: +Note 1003 update `test`.`t1` set `test`.`t1`.`a` = `test`.`t1`.`a` + 1 where `test`.`t1`.`a` > 10 order by `test`.`t1`.`a` + 20 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 @@ -3331,6 +3469,61 @@ Handler_read_key 4 Sort_range 1 DROP TABLE t1; +#75 +CREATE TABLE t1 (id INT PRIMARY KEY, i INT); +# +# query: INSERT INTO t1 VALUES (3,10), (7,11), (3,11) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id); +# select: +# +EXPLAIN INSERT INTO t1 VALUES (3,10), (7,11), (3,11) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);; +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +FLUSH STATUS; +FLUSH TABLES; +EXPLAIN EXTENDED INSERT INTO t1 VALUES (3,10), (7,11), (3,11) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);; +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 +Warnings: +Note 1003 insert into `test`.`t1` values (3,10),(7,11),(3,11) on duplicate key update `test`.`t1`.`id` = last_insert_id(`test`.`t1`.`id`) +# Status of EXPLAIN EXTENDED query +Variable_name Value +Handler_read_key 4 +# Status of testing query execution: +Variable_name Value +Handler_read_key 4 +Handler_read_rnd 1 +Handler_write 3 + +DROP TABLE t1; +#76 +CREATE TABLE t1 (id INT PRIMARY KEY, i INT); +CREATE TABLE t2 (a INT, b INT); +INSERT INTO t2 VALUES (1,10), (3,10), (7,11), (3,11); +# +# query: INSERT INTO t1 SELECT * FROM t2 ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id); +# select: +# +EXPLAIN INSERT INTO t1 SELECT * FROM t2 ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 4 +FLUSH STATUS; +FLUSH TABLES; +EXPLAIN EXTENDED INSERT INTO t1 SELECT * FROM t2 ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 +Warnings: +Note 1003 insert into `test`.`t1` select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` on duplicate key update `test`.`t1`.`id` = last_insert_id(`test`.`t1`.`id`) +# Status of EXPLAIN EXTENDED query +Variable_name Value +Handler_read_key 7 +# Status of testing query execution: +Variable_name Value +Handler_read_key 7 +Handler_read_rnd 1 +Handler_read_rnd_next 5 +Handler_write 4 + +DROP TABLE t1,t2; # # Bug #12949629: CLIENT LOSES CONNECTION AFTER EXECUTING A PROCEDURE WITH # EXPLAIN UPDATE/DEL/INS diff --git a/mysql-test/main/myisam_icp.result b/mysql-test/main/myisam_icp.result index d06149134804b..2bd9ac9ba958a 100644 --- a/mysql-test/main/myisam_icp.result +++ b/mysql-test/main/myisam_icp.result @@ -972,10 +972,10 @@ c c b c NULL NULL c NULL NULL Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'c' -Warning 1292 Truncated incorrect DOUBLE value: 'c' -Warning 1292 Truncated incorrect DOUBLE value: 'c' -Warning 1292 Truncated incorrect DOUBLE value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'c' SET optimizer_switch=@save_optimizer_switch; DROP TABLE t1,t2,t3,t4; # diff --git a/mysql-test/main/myisam_mrr.result b/mysql-test/main/myisam_mrr.result index 0cd2873c28216..b758b2b325829 100644 --- a/mysql-test/main/myisam_mrr.result +++ b/mysql-test/main/myisam_mrr.result @@ -11,7 +11,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 + 10*(B.a + 10*C.a) from t1 A, t1 B, t1 C; diff --git a/mysql-test/main/myisam_optimize.result b/mysql-test/main/myisam_optimize.result index f71d524fadbc9..28c9caa83b29e 100644 --- a/mysql-test/main/myisam_optimize.result +++ b/mysql-test/main/myisam_optimize.result @@ -43,3 +43,86 @@ i UNLOCK TABLES; DROP TABLE t1; # End of 10.0 tests +# +# MDEV-8475 stale .TMM file causes Aria engine to stop serving the table +# +create table t1 (pk int primary key, i int) engine=MyISAM; +insert into t1 values (1,1),(2,2); +connect con1,localhost,root,,; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL, + `i` int(11) DEFAULT NULL, + PRIMARY KEY (`pk`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +disconnect con1; +connect con1,localhost,root,,; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL, + `i` int(11) DEFAULT NULL, + PRIMARY KEY (`pk`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +disconnect con1; +connect con1,localhost,root,,; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL, + `i` int(11) DEFAULT NULL, + PRIMARY KEY (`pk`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +disconnect con1; +connection default; +DROP TABLE t1; +create table t1 (pk int primary key, i int) engine=aria; +insert into t1 values (1,1),(2,2); +connect con1,localhost,root,,; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL, + `i` int(11) DEFAULT NULL, + PRIMARY KEY (`pk`) +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +disconnect con1; +connect con1,localhost,root,,; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL, + `i` int(11) DEFAULT NULL, + PRIMARY KEY (`pk`) +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +disconnect con1; +connect con1,localhost,root,,; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL, + `i` int(11) DEFAULT NULL, + PRIMARY KEY (`pk`) +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +disconnect con1; +connection default; +DROP TABLE t1; diff --git a/mysql-test/main/myisam_optimize.test b/mysql-test/main/myisam_optimize.test index 5e133aea85329..44215fd2848ab 100644 --- a/mysql-test/main/myisam_optimize.test +++ b/mysql-test/main/myisam_optimize.test @@ -2,6 +2,7 @@ # test OPTIMIZE and a concurrent SELECT of a MyISAM table # source include/have_debug_sync.inc; +--disable_service_connection call mtr.add_suppression(" marked as crashed and should be repaired"); @@ -63,3 +64,64 @@ UNLOCK TABLES; DROP TABLE t1; --echo # End of 10.0 tests +--echo # +--echo # MDEV-8475 stale .TMM file causes Aria engine to stop serving the table +--echo # +create table t1 (pk int primary key, i int) engine=MyISAM; +insert into t1 values (1,1),(2,2); +--let $datadir=`SELECT @@datadir` + +--write_file $datadir/test/t1.TMM +EOF + +--connect (con1,localhost,root,,) +SHOW CREATE TABLE t1; +OPTIMIZE TABLE t1; +--disconnect con1 + +--connect (con1,localhost,root,,) +SHOW CREATE TABLE t1; +OPTIMIZE TABLE t1; +--disconnect con1 + +--connect (con1,localhost,root,,) +SHOW CREATE TABLE t1; +OPTIMIZE TABLE t1; +--disconnect con1 + +# Cleanup +--connection default +DROP TABLE t1; + +# +# Test also Aria +# + +create table t1 (pk int primary key, i int) engine=aria; +insert into t1 values (1,1),(2,2); +--let $datadir=`SELECT @@datadir` + +--write_file $datadir/test/t1.TMM +EOF + +--connect (con1,localhost,root,,) +SHOW CREATE TABLE t1; +OPTIMIZE TABLE t1; +--disconnect con1 + +--connect (con1,localhost,root,,) +SHOW CREATE TABLE t1; +OPTIMIZE TABLE t1; +--disconnect con1 + +--connect (con1,localhost,root,,) +SHOW CREATE TABLE t1; +OPTIMIZE TABLE t1; +--disconnect con1 + +# Cleanup +--connection default +DROP TABLE t1; + +--enable_service_connection + diff --git a/mysql-test/main/mysql.result b/mysql-test/main/mysql.result index 70dde06600e81..0b91b513b1753 100644 --- a/mysql-test/main/mysql.result +++ b/mysql-test/main/mysql.result @@ -551,12 +551,12 @@ show create table `a1\``b1`; Table Create Table a1\`b1 CREATE TABLE `a1\``b1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `a1\``b1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `a1\``b1` VALUES (1), @@ -566,7 +566,7 @@ show create table `a1\``b1`; Table Create Table a1\`b1 CREATE TABLE `a1\``b1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from `a1\``b1`; a 1 @@ -582,7 +582,7 @@ show create table "a1\""b1"; Table Create Table a1\"b1 CREATE TABLE "a1\""b1" ( "a" int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE "a1\""b1" ( @@ -597,7 +597,7 @@ show create table "a1\""b1"; Table Create Table a1\"b1 CREATE TABLE "a1\""b1" ( "a" int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from "a1\""b1"; a 1 @@ -633,4 +633,7 @@ drop table t1; # # MDEV-15538 '-N' Produce html output wrong # -
1
\ No newline at end of file +
1
+WARNING: option '--enable-cleartext-plugin' is obsolete. +1 +1 diff --git a/mysql-test/main/mysql.test b/mysql-test/main/mysql.test index 1cb4977a32de8..0f41add821ad2 100644 --- a/mysql-test/main/mysql.test +++ b/mysql-test/main/mysql.test @@ -708,3 +708,11 @@ drop table t1; --echo # MDEV-15538 '-N' Produce html output wrong --echo # --exec $MYSQL -NHe "select 1 as a" + + +# +# Test obsolete option --enable-cleartext-plugin +# This should proceed with a warning +# +--echo +--exec $MYSQL test --enable-cleartext-plugin -e "select 1" diff --git a/mysql-test/main/mysql5613mysql.result b/mysql-test/main/mysql5613mysql.result index 7f4b358cdd019..1a306d8dd869a 100644 --- a/mysql-test/main/mysql5613mysql.result +++ b/mysql-test/main/mysql5613mysql.result @@ -5,13 +5,13 @@ SHOW CREATE TABLE columns_priv; Table Create Table columns_priv CREATE TABLE `columns_priv` ( - `Host` char(60) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(16) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Table_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Column_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(60) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(16) NOT NULL DEFAULT '', + `Table_name` char(64) NOT NULL DEFAULT '', + `Column_name` char(64) NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Column privileges' SELECT * FROM columns_priv LIMIT 0; @@ -20,28 +20,28 @@ DROP TABLE columns_priv; SHOW CREATE TABLE db; Table Create Table db CREATE TABLE `db` ( - `Host` char(60) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(16) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `References_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', + `Host` char(60) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(16) NOT NULL DEFAULT '', + `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `References_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', PRIMARY KEY (`Host`,`Db`,`User`), KEY `User` (`User`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Database privileges' @@ -68,23 +68,23 @@ event CREATE TABLE `event` ( `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','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') NOT NULL DEFAULT '', `comment` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', `originator` int(10) unsigned NOT NULL, - `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', + `time_zone` char(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'SYSTEM', `character_set_client` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `collation_connection` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `db_collation` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `body_utf8` longblob DEFAULT NULL, PRIMARY KEY (`db`,`name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COMMENT='Events' +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Events' SELECT * FROM event LIMIT 0; db name body definer execute_at interval_value interval_field created modified last_executed starts ends status on_completion sql_mode comment originator time_zone character_set_client collation_connection db_collation body_utf8 DROP TABLE event; SHOW CREATE TABLE func; Table Create Table func CREATE TABLE `func` ( - `name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `name` char(64) NOT NULL DEFAULT '', `ret` tinyint(1) NOT NULL DEFAULT 0, - `dl` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `type` enum('function','aggregate') CHARACTER SET utf8mb3 NOT NULL, + `dl` char(128) NOT NULL DEFAULT '', + `type` enum('function','aggregate') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='User defined functions' SELECT * FROM func LIMIT 0; @@ -96,7 +96,7 @@ plugin CREATE TABLE `plugin` ( `name` varchar(64) NOT NULL DEFAULT '', `dl` varchar(128) NOT NULL DEFAULT '', PRIMARY KEY (`name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COMMENT='MySQL plugins' +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='MySQL plugins' SELECT * FROM plugin LIMIT 0; name dl DROP TABLE plugin; @@ -124,20 +124,20 @@ proc CREATE TABLE `proc` ( `db_collation` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `body_utf8` longblob DEFAULT NULL, PRIMARY KEY (`db`,`name`,`type`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COMMENT='Stored Procedures' +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Stored Procedures' SELECT * FROM proc LIMIT 0; db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 DROP TABLE proc; SHOW CREATE TABLE procs_priv; Table Create Table procs_priv CREATE TABLE `procs_priv` ( - `Host` char(60) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(16) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Routine_name` char(64) CHARACTER SET utf8mb3 NOT NULL DEFAULT '', - `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8mb3_bin NOT NULL, - `Grantor` char(77) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Host` char(60) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(16) NOT NULL DEFAULT '', + `Routine_name` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', + `Routine_type` enum('FUNCTION','PROCEDURE') NOT NULL, + `Grantor` char(77) NOT NULL DEFAULT '', + `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), KEY `Grantor` (`Grantor`) @@ -148,12 +148,12 @@ DROP TABLE procs_priv; SHOW CREATE TABLE proxies_priv; Table Create Table proxies_priv CREATE TABLE `proxies_priv` ( - `Host` char(60) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(16) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Proxied_host` char(60) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Proxied_user` char(16) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(60) NOT NULL DEFAULT '', + `User` char(16) NOT NULL DEFAULT '', + `Proxied_host` char(60) NOT NULL DEFAULT '', + `Proxied_user` char(16) NOT NULL DEFAULT '', `With_grant` tinyint(1) NOT NULL DEFAULT 0, - `Grantor` char(77) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Grantor` char(77) NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`), KEY `Grantor` (`Grantor`) @@ -174,21 +174,21 @@ servers CREATE TABLE `servers` ( `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` char(64) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COMMENT='MySQL Foreign Servers table' +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='MySQL Foreign Servers table' SELECT * FROM servers LIMIT 0; Server_name Host Db Username Password Port Socket Wrapper Owner DROP TABLE servers; SHOW CREATE TABLE tables_priv; Table Create Table tables_priv CREATE TABLE `tables_priv` ( - `Host` char(60) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(16) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Table_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Grantor` char(77) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(60) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(16) NOT NULL DEFAULT '', + `Table_name` char(64) NOT NULL DEFAULT '', + `Grantor` char(77) NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', - `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', + `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), KEY `Grantor` (`Grantor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Table privileges' @@ -201,7 +201,7 @@ time_zone_leap_second CREATE TABLE `time_zone_leap_second` ( `Transition_time` bigint(20) NOT NULL, `Correction` int(11) NOT NULL, PRIMARY KEY (`Transition_time`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COMMENT='Leap seconds information for time zones' +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Leap seconds information for time zones' SELECT * FROM time_zone_leap_second LIMIT 0; Transition_time Correction DROP TABLE time_zone_leap_second; @@ -211,7 +211,7 @@ time_zone CREATE TABLE `time_zone` ( `Time_zone_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `Use_leap_seconds` enum('Y','N') NOT NULL DEFAULT 'N', PRIMARY KEY (`Time_zone_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COMMENT='Time zones' +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Time zones' SELECT * FROM time_zone LIMIT 0; Time_zone_id Use_leap_seconds DROP TABLE time_zone; @@ -221,7 +221,7 @@ time_zone_name CREATE TABLE `time_zone_name` ( `Name` char(64) NOT NULL, `Time_zone_id` int(10) unsigned NOT NULL, PRIMARY KEY (`Name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COMMENT='Time zone names' +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Time zone names' SELECT * FROM time_zone_name LIMIT 0; Name Time_zone_id DROP TABLE time_zone_name; @@ -232,7 +232,7 @@ time_zone_transition CREATE TABLE `time_zone_transition` ( `Transition_time` bigint(20) NOT NULL, `Transition_type_id` int(10) unsigned NOT NULL, PRIMARY KEY (`Time_zone_id`,`Transition_time`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COMMENT='Time zone transitions' +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Time zone transitions' SELECT * FROM time_zone_transition LIMIT 0; Time_zone_id Transition_time Transition_type_id DROP TABLE time_zone_transition; @@ -245,46 +245,46 @@ time_zone_transition_type CREATE TABLE `time_zone_transition_type` ( `Is_DST` tinyint(3) unsigned NOT NULL DEFAULT 0, `Abbreviation` char(8) NOT NULL DEFAULT '', PRIMARY KEY (`Time_zone_id`,`Transition_type_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COMMENT='Time zone transition types' +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Time zone transition types' SELECT * FROM time_zone_transition_type LIMIT 0; Time_zone_id Transition_type_id Offset Is_DST Abbreviation DROP TABLE time_zone_transition_type; SHOW CREATE TABLE user; Table Create Table user CREATE TABLE `user` ( - `Host` char(60) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(16) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(60) NOT NULL DEFAULT '', + `User` char(16) NOT NULL DEFAULT '', `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '', - `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Reload_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Shutdown_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Process_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `File_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `References_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Show_db_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Super_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Repl_client_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_user_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Reload_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Shutdown_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Process_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `File_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `References_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Show_db_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Super_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Repl_client_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_user_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', `ssl_cipher` blob NOT NULL, `x509_issuer` blob NOT NULL, `x509_subject` blob NOT NULL, @@ -292,9 +292,9 @@ user CREATE TABLE `user` ( `max_updates` int(11) unsigned NOT NULL DEFAULT 0, `max_connections` int(11) unsigned NOT NULL DEFAULT 0, `max_user_connections` int(11) unsigned NOT NULL DEFAULT 0, - `plugin` char(64) COLLATE utf8mb3_bin DEFAULT '', - `authentication_string` text COLLATE utf8mb3_bin DEFAULT NULL, - `password_expired` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', + `plugin` char(64) DEFAULT '', + `authentication_string` text DEFAULT NULL, + `password_expired` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', PRIMARY KEY (`Host`,`User`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Users and global privileges' SELECT * FROM user LIMIT 0; diff --git a/mysql-test/main/mysql57_virtual.result b/mysql-test/main/mysql57_virtual.result index 8186aa7cdec8f..16dd7d55719dd 100644 --- a/mysql-test/main/mysql57_virtual.result +++ b/mysql-test/main/mysql57_virtual.result @@ -7,7 +7,7 @@ mysql57_virtual CREATE TABLE `mysql57_virtual` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL, `c` int(11) GENERATED ALWAYS AS (`a` + 3) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into mysql57_virtual (a) values (1),(2); select * from mysql57_virtual; a b c @@ -22,7 +22,7 @@ mysql57_virtual CREATE TABLE `mysql57_virtual` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL, `c` int(11) GENERATED ALWAYS AS (`a` + 3) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='I am now a MariaDB table' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='I am now a MariaDB table' DROP TABLE mysql57_virtual; # # Check MySQL 5.7 syntax @@ -34,5 +34,5 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` + 1) STORED, `c` int(11) GENERATED ALWAYS AS (`a` + 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; diff --git a/mysql-test/main/mysql_client_test-master.opt b/mysql-test/main/mysql_client_test-master.opt index 8d49abf6a100b..e3d42121b45cc 100644 --- a/mysql-test/main/mysql_client_test-master.opt +++ b/mysql-test/main/mysql_client_test-master.opt @@ -3,3 +3,4 @@ --log-output=FILE,TABLE --max-allowed-packet=32000000 --proxy-protocol-networks=* +--sequence=on diff --git a/mysql-test/main/mysql_client_test_comp-master.opt b/mysql-test/main/mysql_client_test_comp-master.opt index 6c4a5e4c782a1..ccaa4a8ee6ea8 100644 --- a/mysql-test/main/mysql_client_test_comp-master.opt +++ b/mysql-test/main/mysql_client_test_comp-master.opt @@ -1,3 +1,4 @@ --loose-enable-performance-schema --max-allowed-packet=32000000 --proxy-protocol-networks=::1/32,127.0.0.0/8,localhost +--sequence=on diff --git a/mysql-test/main/mysql_client_test_comp.test b/mysql-test/main/mysql_client_test_comp.test index 13a9d4944a47d..36a12b6691e58 100644 --- a/mysql-test/main/mysql_client_test_comp.test +++ b/mysql-test/main/mysql_client_test_comp.test @@ -1,7 +1,9 @@ # run mysql_client_test with performance schema # No need to run this with embedded server --- source include/not_embedded.inc +--source include/not_embedded.inc +--source include/check_ipv6.inc +--source include/no_valgrind_without_big.inc # need to have the dynamic loading turned on for the client plugin tests --source include/have_plugin_auth.inc diff --git a/mysql-test/main/mysql_client_test_nonblock-master.opt b/mysql-test/main/mysql_client_test_nonblock-master.opt index a39d0089562a3..f306d27feac7c 100644 --- a/mysql-test/main/mysql_client_test_nonblock-master.opt +++ b/mysql-test/main/mysql_client_test_nonblock-master.opt @@ -1,3 +1,4 @@ --general-log --general-log-file=$MYSQLTEST_VARDIR/log/master.log --log-output=FILE,TABLE --max-allowed-packet=32000000 --proxy-protocol-networks=::1,::ffff:127.0.0.1/97,localhost +--sequence=on diff --git a/mysql-test/main/mysql_client_test_nonblock.test b/mysql-test/main/mysql_client_test_nonblock.test index 19489bf9e0e83..73e7a6d378dbf 100644 --- a/mysql-test/main/mysql_client_test_nonblock.test +++ b/mysql-test/main/mysql_client_test_nonblock.test @@ -2,7 +2,8 @@ # This runs the mysql_client_test using the non-blocking API. # The non-blocking API is not supported in the embedded server. --- source include/not_embedded.inc +--source include/not_embedded.inc +--source include/check_ipv6.inc # This test is slow on buildbot. --source include/big_test.inc diff --git a/mysql-test/main/mysql_comments.result b/mysql-test/main/mysql_comments.result index 9ba8dff3d55eb..6bb2d37f6d058 100644 --- a/mysql-test/main/mysql_comments.result +++ b/mysql-test/main/mysql_comments.result @@ -14,11 +14,11 @@ drop trigger if exists t1_bi; foofct("call 1") call 1 Function sql_mode Create Function character_set_client collation_connection Database Collation -foofct CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1\nreturn\n\n\n\nx latin1 latin1_swedish_ci latin1_swedish_ci +foofct CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1 COLLATE latin1_swedish_ci\nreturn\n\n\n\nx latin1 latin1_swedish_ci latin1_swedish_ci foofct("call 2") call 2 Function sql_mode Create Function character_set_client collation_connection Database Collation -foofct CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1\nbegin\n \n \n \n\n \n\n \n return x;\nend latin1 latin1_swedish_ci latin1_swedish_ci +foofct CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1 COLLATE latin1_swedish_ci\nbegin\n \n \n \n\n \n\n \n return x;\nend latin1 latin1_swedish_ci latin1_swedish_ci Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation empty CREATE DEFINER=`root`@`localhost` PROCEDURE `empty`()\nbegin\nend latin1 latin1_swedish_ci latin1_swedish_ci id data @@ -41,11 +41,11 @@ trig 12 foofct("call 1") call 1 Function sql_mode Create Function character_set_client collation_connection Database Collation -foofct CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1\nreturn\n-- comment 1a\n# comment 1b\n/* comment 1c */\nx # after body, on same line latin1 latin1_swedish_ci latin1_swedish_ci +foofct CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1 COLLATE latin1_swedish_ci\nreturn\n-- comment 1a\n# comment 1b\n/* comment 1c */\nx # after body, on same line latin1 latin1_swedish_ci latin1_swedish_ci foofct("call 2") call 2 Function sql_mode Create Function character_set_client collation_connection Database Collation -foofct CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1\nbegin\n -- comment 1a\n # comment 1b\n /*\n comment 1c\n */\n\n -- empty line below\n\n -- empty line above\n return x;\nend latin1 latin1_swedish_ci latin1_swedish_ci +foofct CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1 COLLATE latin1_swedish_ci\nbegin\n -- comment 1a\n # comment 1b\n /*\n comment 1c\n */\n\n -- empty line below\n\n -- empty line above\n return x;\nend latin1 latin1_swedish_ci latin1_swedish_ci Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation empty CREATE DEFINER=`root`@`localhost` PROCEDURE `empty`()\nbegin\nend latin1 latin1_swedish_ci latin1_swedish_ci id data diff --git a/mysql-test/main/mysql_install_db_win.test b/mysql-test/main/mysql_install_db_win.test index ceb7293f61186..c400dbf3fb9fd 100644 --- a/mysql-test/main/mysql_install_db_win.test +++ b/mysql-test/main/mysql_install_db_win.test @@ -42,6 +42,13 @@ remove_file $log; rmdir $ddir; +# MDEV-28471 - mysql_install_db.exe fails with --innodb-page-size=64K +--disable_result_log +exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R --innodb-page-size=64K --verbose +--enable_result_log +rmdir $ddir; + +# Tests with config file let $restart_parameters=; connection default; diff --git a/mysql-test/main/mysql_json_mysql_upgrade.result b/mysql-test/main/mysql_json_mysql_upgrade.result index 768f730146377..4c4a86f88ee06 100644 --- a/mysql-test/main/mysql_json_mysql_upgrade.result +++ b/mysql-test/main/mysql_json_mysql_upgrade.result @@ -181,8 +181,8 @@ OK show create table mysql_json_test; Table Create Table mysql_json_test CREATE TABLE `mysql_json_test` ( - `description` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `expected` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `description` varchar(100) DEFAULT NULL, + `expected` longtext DEFAULT NULL, `actual` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci select * from mysql_json_test; @@ -290,8 +290,8 @@ Array LITERALS: ["prefix", true, "suffix", 1] ["prefix", true, "suffix", 1] show create table mysql_json_test_big; Table Create Table mysql_json_test_big CREATE TABLE `mysql_json_test_big` ( - `description` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `expected` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `description` varchar(100) DEFAULT NULL, + `expected` longtext DEFAULT NULL, `actual` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci select * from mysql.plugin; diff --git a/mysql-test/main/mysql_json_mysql_upgrade_with_plugin_loaded.result b/mysql-test/main/mysql_json_mysql_upgrade_with_plugin_loaded.result index 0a24147bdea02..33205e60aeab3 100644 --- a/mysql-test/main/mysql_json_mysql_upgrade_with_plugin_loaded.result +++ b/mysql-test/main/mysql_json_mysql_upgrade_with_plugin_loaded.result @@ -180,15 +180,15 @@ OK show create table mysql_json_test; Table Create Table mysql_json_test CREATE TABLE `mysql_json_test` ( - `description` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `expected` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `description` varchar(100) DEFAULT NULL, + `expected` longtext DEFAULT NULL, `actual` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci show create table mysql_json_test_big; Table Create Table mysql_json_test_big CREATE TABLE `mysql_json_test_big` ( - `description` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `expected` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `description` varchar(100) DEFAULT NULL, + `expected` longtext DEFAULT NULL, `actual` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci select * from mysql.plugin; diff --git a/mysql-test/main/mysql_json_table_recreate.result b/mysql-test/main/mysql_json_table_recreate.result index 3dfc6d7a259da..207dde9d8ad2c 100644 --- a/mysql-test/main/mysql_json_table_recreate.result +++ b/mysql-test/main/mysql_json_table_recreate.result @@ -25,7 +25,7 @@ show create table tempty; Table Create Table tempty CREATE TABLE `tempty` ( `t` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table mysql_json_test; ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.mysql_json_test` FORCE" or dump/reload to fix it! select * from mysql_json_test; @@ -146,8 +146,8 @@ Total_Number_of_Tests Succesful_Tests show create table mysql_json_test; Table Create Table mysql_json_test CREATE TABLE `mysql_json_test` ( - `description` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `expected` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `description` varchar(100) DEFAULT NULL, + `expected` longtext DEFAULT NULL, `actual` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci show create table mysql_json_test_big; diff --git a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result index f4694cbedae0c..97548768a2dec 100644 --- a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result +++ b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result @@ -1,21 +1,32 @@ +CREATE TABLE time_zone LIKE mysql.time_zone; +CREATE TABLE time_zone_name LIKE mysql.time_zone_name; +CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition; +CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type; +CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second; # # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above # # Verbose run -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=InnoDB; -ALTER TABLE time_zone_name ENGINE=InnoDB; -ALTER TABLE time_zone_transition ENGINE=InnoDB; -ALTER TABLE time_zone_transition_type ENGINE=InnoDB; -END IF| -\d ; +set @wsrep_is_on=(select coalesce(sum(SESSION_VALUE='ON'), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on'); +SET STATEMENT SQL_MODE='' FOR SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC; +set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select coalesce(sum(GLOBAL_VALUE NOT LIKE @replicate_opt), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_name''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition_type''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0'); TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition_type; -START TRANSACTION; +/*M!100602 execute immediate if(@wsrep_cannot_replicate_tz, 'start transaction', 'LOCK TABLES time_zone WRITE, + time_zone_leap_second WRITE, + time_zone_name WRITE, + time_zone_transition WRITE, + time_zone_transition_type WRITE')*/; INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); SET @time_zone_id= LAST_INSERT_ID(); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); @@ -33,33 +44,94 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it. Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion. +UNLOCK TABLES; COMMIT; -ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; -ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=Aria; -ALTER TABLE time_zone_name ENGINE=Aria; -ALTER TABLE time_zone_transition ENGINE=Aria; -ALTER TABLE time_zone_transition_type ENGINE=Aria; -END IF| -\d ; -# Silent run -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=InnoDB; -ALTER TABLE time_zone_name ENGINE=InnoDB; -ALTER TABLE time_zone_transition ENGINE=InnoDB; -ALTER TABLE time_zone_transition_type ENGINE=InnoDB; -END IF| -\d ; +execute immediate if(@wsrep_cannot_replicate_tz, 'do 0','ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time'); +execute immediate if(@wsrep_cannot_replicate_tz, 'do 0','ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone ENGINE=', @time_zone_engine), 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_name ENGINE=', @time_zone_name_engine), 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition ENGINE=', @time_zone_transition_engine, ', ORDER BY Time_zone_id, Transition_time'), 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition_type ENGINE=', @time_zone_transition_type_engine, ', ORDER BY Time_zone_id, Transition_type_id'), 'do 0'); +# +# MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases +# +# Run on zoneinfo directory +set @wsrep_is_on=(select coalesce(sum(SESSION_VALUE='ON'), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on'); +SET STATEMENT SQL_MODE='' FOR SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC; +set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select coalesce(sum(GLOBAL_VALUE NOT LIKE @replicate_opt), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_name''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition_type''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0'); +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +/*M!100602 execute immediate if(@wsrep_cannot_replicate_tz, 'start transaction', 'LOCK TABLES time_zone WRITE, + time_zone_leap_second WRITE, + time_zone_name WRITE, + time_zone_transition WRITE, + time_zone_transition_type WRITE')*/; +INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); +SET @time_zone_id= LAST_INSERT_ID(); +INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); +INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset`, Is_DST, Abbreviation) VALUES + (@time_zone_id, 0, 0, 0, 'GMT') +; +Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it. +INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); +SET @time_zone_id= LAST_INSERT_ID(); +INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id); +INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset`, Is_DST, Abbreviation) VALUES + (@time_zone_id, 0, 0, 0, 'GMT') +; +Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. +UNLOCK TABLES; +COMMIT; +execute immediate if(@wsrep_cannot_replicate_tz, 'do 0','ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time'); +execute immediate if(@wsrep_cannot_replicate_tz, 'do 0','ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone ENGINE=', @time_zone_engine), 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_name ENGINE=', @time_zone_name_engine), 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition ENGINE=', @time_zone_transition_engine, ', ORDER BY Time_zone_id, Transition_time'), 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition_type ENGINE=', @time_zone_transition_type_engine, ', ORDER BY Time_zone_id, Transition_type_id'), 'do 0'); +SELECT COUNT(*) FROM time_zone; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 +# +# Run on zoneinfo directory --skip-write-binlog +# +set @wsrep_is_on=(select coalesce(sum(SESSION_VALUE='ON'), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on'); +SET STATEMENT SQL_MODE='' FOR SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC; +set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select coalesce(sum(GLOBAL_VALUE NOT LIKE @replicate_opt), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode'); +execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF', 'do 0'); +SET @save_sql_log_bin=@@SQL_LOG_BIN; +SET SESSION SQL_LOG_BIN=0; +SET @wsrep_cannot_replicate_tz=0; TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition_type; -START TRANSACTION; +LOCK TABLES time_zone WRITE, + time_zone_leap_second WRITE, + time_zone_name WRITE, + time_zone_transition WRITE, + time_zone_transition_type WRITE; INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); SET @time_zone_id= LAST_INSERT_ID(); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); @@ -74,106 +146,388 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset (@time_zone_id, 0, 0, 0, 'GMT') ; Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. +UNLOCK TABLES; COMMIT; -ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; -ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=Aria; -ALTER TABLE time_zone_name ENGINE=Aria; -ALTER TABLE time_zone_transition ENGINE=Aria; -ALTER TABLE time_zone_transition_type ENGINE=Aria; -END IF| -\d ; +execute immediate if(@wsrep_cannot_replicate_tz, 'do 0','ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time'); +execute immediate if(@wsrep_cannot_replicate_tz, 'do 0','ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id'); +SET SESSION SQL_LOG_BIN=@save_sql_log_bin; +execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0'); +SELECT COUNT(*) FROM time_zone; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN; +@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@SQL_LOG_BIN +0 0 NULL 1 1 +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff +FROM information_schema.global_status g +JOIN baseline b USING (VARIABLE_NAME) +ORDER BY g.VARIABLE_NAME; +VARIABLE_NAME diff +COM_ALTER_TABLE 2 +COM_BEGIN 0 +COM_INSERT 6 +COM_LOCK_TABLES 1 +COM_TRUNCATE 4 +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +TRUNCATE TABLE time_zone_leap_second; # # Testing with explicit timezonefile # -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=InnoDB; -ALTER TABLE time_zone_name ENGINE=InnoDB; -ALTER TABLE time_zone_transition ENGINE=InnoDB; -ALTER TABLE time_zone_transition_type ENGINE=InnoDB; -END IF| -\d ; +set @wsrep_is_on=(select coalesce(sum(SESSION_VALUE='ON'), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on'); +SET STATEMENT SQL_MODE='' FOR SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC; +set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select coalesce(sum(GLOBAL_VALUE NOT LIKE @replicate_opt), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_name''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition_type''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0'); +/*M!100602 execute immediate if(@wsrep_cannot_replicate_tz, 'start transaction', 'LOCK TABLES time_zone WRITE, + time_zone_leap_second WRITE, + time_zone_name WRITE, + time_zone_transition WRITE, + time_zone_transition_type WRITE')*/; INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); SET @time_zone_id= LAST_INSERT_ID(); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id); INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset`, Is_DST, Abbreviation) VALUES (@time_zone_id, 0, 0, 0, 'GMT') ; -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=Aria; -ALTER TABLE time_zone_name ENGINE=Aria; -ALTER TABLE time_zone_transition ENGINE=Aria; -ALTER TABLE time_zone_transition_type ENGINE=Aria; -END IF| -\d ; +UNLOCK TABLES; +COMMIT; +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone ENGINE=', @time_zone_engine), 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_name ENGINE=', @time_zone_name_engine), 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition ENGINE=', @time_zone_transition_engine, ', ORDER BY Time_zone_id, Transition_time'), 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition_type ENGINE=', @time_zone_transition_type_engine, ', ORDER BY Time_zone_id, Transition_type_id'), 'do 0'); +SELECT COUNT(*) FROM time_zone; +COUNT(*) +1 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +1 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +1 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN; +@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@SQL_LOG_BIN +0 0 NULL 1 1 +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff +FROM information_schema.global_status g +JOIN baseline b USING (VARIABLE_NAME) +ORDER BY g.VARIABLE_NAME; +VARIABLE_NAME diff +COM_ALTER_TABLE 0 +COM_BEGIN 0 +COM_INSERT 3 +COM_LOCK_TABLES 1 +COM_TRUNCATE 0 +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +TRUNCATE TABLE time_zone_leap_second; +# +# Testing with explicit timezonefile --skip-write-binlog +# +set @wsrep_is_on=(select coalesce(sum(SESSION_VALUE='ON'), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on'); +SET STATEMENT SQL_MODE='' FOR SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC; +set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select coalesce(sum(GLOBAL_VALUE NOT LIKE @replicate_opt), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode'); +execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF', 'do 0'); +SET @save_sql_log_bin=@@SQL_LOG_BIN; +SET SESSION SQL_LOG_BIN=0; +SET @wsrep_cannot_replicate_tz=0; +LOCK TABLES time_zone WRITE, + time_zone_leap_second WRITE, + time_zone_name WRITE, + time_zone_transition WRITE, + time_zone_transition_type WRITE; +INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); +SET @time_zone_id= LAST_INSERT_ID(); +INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id); +INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset`, Is_DST, Abbreviation) VALUES + (@time_zone_id, 0, 0, 0, 'GMT') +; +UNLOCK TABLES; +COMMIT; +SET SESSION SQL_LOG_BIN=@save_sql_log_bin; +execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0'); +SELECT COUNT(*) FROM time_zone; +COUNT(*) +1 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +1 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +1 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN; +@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@SQL_LOG_BIN +0 0 NULL 1 1 +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff +FROM information_schema.global_status g +JOIN baseline b USING (VARIABLE_NAME) +ORDER BY g.VARIABLE_NAME; +VARIABLE_NAME diff +COM_ALTER_TABLE 0 +COM_BEGIN 0 +COM_INSERT 3 +COM_LOCK_TABLES 1 +COM_TRUNCATE 0 +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +TRUNCATE TABLE time_zone_leap_second; # # Testing --leap # -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=InnoDB; -ALTER TABLE time_zone_name ENGINE=InnoDB; -ALTER TABLE time_zone_transition ENGINE=InnoDB; -ALTER TABLE time_zone_transition_type ENGINE=InnoDB; -END IF| -\d ; -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone_leap_second ENGINE=InnoDB; -END IF| -\d ; +set @wsrep_is_on=(select coalesce(sum(SESSION_VALUE='ON'), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on'); +SET STATEMENT SQL_MODE='' FOR SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC; +set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select coalesce(sum(GLOBAL_VALUE NOT LIKE @replicate_opt), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_name''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition_type''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0'); +/*M!100602 execute immediate if(@wsrep_cannot_replicate_tz, 'start transaction', 'LOCK TABLES time_zone WRITE, + time_zone_leap_second WRITE, + time_zone_name WRITE, + time_zone_transition WRITE, + time_zone_transition_type WRITE')*/; +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_leap_second_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_leap_second''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_leap_second ENGINE=InnoDB', 'do 0'); +TRUNCATE TABLE time_zone_leap_second; +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_leap_second ENGINE=', @time_zone_leap_second_engine), 'do 0'); +ALTER TABLE time_zone_leap_second ORDER BY Transition_time; +UNLOCK TABLES; +COMMIT; +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone ENGINE=', @time_zone_engine), 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_name ENGINE=', @time_zone_name_engine), 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition ENGINE=', @time_zone_transition_engine, ', ORDER BY Time_zone_id, Transition_time'), 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition_type ENGINE=', @time_zone_transition_type_engine, ', ORDER BY Time_zone_id, Transition_type_id'), 'do 0'); +SELECT COUNT(*) FROM time_zone; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN; +@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@SQL_LOG_BIN +0 0 NULL 1 1 +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff +FROM information_schema.global_status g +JOIN baseline b USING (VARIABLE_NAME) +ORDER BY g.VARIABLE_NAME; +VARIABLE_NAME diff +COM_ALTER_TABLE 1 +COM_BEGIN 0 +COM_INSERT 0 +COM_LOCK_TABLES 1 +COM_TRUNCATE 1 +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +TRUNCATE TABLE time_zone_leap_second; +# +# Testing --skip-write-binlog --leap +# +set @wsrep_is_on=(select coalesce(sum(SESSION_VALUE='ON'), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on'); +SET STATEMENT SQL_MODE='' FOR SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC; +set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select coalesce(sum(GLOBAL_VALUE NOT LIKE @replicate_opt), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode'); +execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF', 'do 0'); +SET @save_sql_log_bin=@@SQL_LOG_BIN; +SET SESSION SQL_LOG_BIN=0; +SET @wsrep_cannot_replicate_tz=0; +LOCK TABLES time_zone WRITE, + time_zone_leap_second WRITE, + time_zone_name WRITE, + time_zone_transition WRITE, + time_zone_transition_type WRITE; TRUNCATE TABLE time_zone_leap_second; -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone_leap_second ENGINE=Aria; -END IF| -\d ; ALTER TABLE time_zone_leap_second ORDER BY Transition_time; -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=Aria; -ALTER TABLE time_zone_name ENGINE=Aria; -ALTER TABLE time_zone_transition ENGINE=Aria; -ALTER TABLE time_zone_transition_type ENGINE=Aria; -END IF| -\d ; +UNLOCK TABLES; +COMMIT; +SET SESSION SQL_LOG_BIN=@save_sql_log_bin; +execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0'); +SELECT COUNT(*) FROM time_zone; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN; +@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@SQL_LOG_BIN +0 0 NULL 1 1 +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff +FROM information_schema.global_status g +JOIN baseline b USING (VARIABLE_NAME) +ORDER BY g.VARIABLE_NAME; +VARIABLE_NAME diff +COM_ALTER_TABLE 1 +COM_BEGIN 0 +COM_INSERT 0 +COM_LOCK_TABLES 1 +COM_TRUNCATE 1 +# +# MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases +# +# +# Testing --skip-write-binlog +# +set @wsrep_is_on=(select coalesce(sum(SESSION_VALUE='ON'), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on'); +SET STATEMENT SQL_MODE='' FOR SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC; +set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select coalesce(sum(GLOBAL_VALUE NOT LIKE @replicate_opt), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode'); +execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF', 'do 0'); +SET @save_sql_log_bin=@@SQL_LOG_BIN; +SET SESSION SQL_LOG_BIN=0; +SET @wsrep_cannot_replicate_tz=0; +LOCK TABLES time_zone WRITE, + time_zone_leap_second WRITE, + time_zone_name WRITE, + time_zone_transition WRITE, + time_zone_transition_type WRITE; +INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); +SET @time_zone_id= LAST_INSERT_ID(); +INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id); +INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset`, Is_DST, Abbreviation) VALUES + (@time_zone_id, 0, 0, 0, 'GMT') +; +UNLOCK TABLES; +COMMIT; +SET SESSION SQL_LOG_BIN=@save_sql_log_bin; +execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0'); +set @wsrep_is_on=(select coalesce(sum(SESSION_VALUE='ON'), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on'); +SET STATEMENT SQL_MODE='' FOR SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC; +set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select coalesce(sum(GLOBAL_VALUE NOT LIKE @replicate_opt), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode'); +execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF', 'do 0'); +SET @save_sql_log_bin=@@SQL_LOG_BIN; +SET SESSION SQL_LOG_BIN=0; +SET @wsrep_cannot_replicate_tz=0; +LOCK TABLES time_zone WRITE, + time_zone_leap_second WRITE, + time_zone_name WRITE, + time_zone_transition WRITE, + time_zone_transition_type WRITE; +TRUNCATE TABLE time_zone_leap_second; +ALTER TABLE time_zone_leap_second ORDER BY Transition_time; +UNLOCK TABLES; +COMMIT; +SET SESSION SQL_LOG_BIN=@save_sql_log_bin; +execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0'); +# +# End of 10.2 tests +# +# +# MDEV-29347 MariaDB 10.6.8 fails to start when ONLY_FULL_GROUP_BY gets provided +# +set sql_mode=only_full_group_by; +SELECT COUNT(*) FROM time_zone; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 +select @@sql_mode; +@@sql_mode +ONLY_FULL_GROUP_BY +set sql_mode=default; # # MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL # -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=InnoDB; -ALTER TABLE time_zone_name ENGINE=InnoDB; -ALTER TABLE time_zone_transition ENGINE=InnoDB; -ALTER TABLE time_zone_transition_type ENGINE=InnoDB; -END IF| -\d ; +set @wsrep_is_on=(select coalesce(sum(SESSION_VALUE='ON'), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on'); +SET STATEMENT SQL_MODE='' FOR SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC; +set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select coalesce(sum(GLOBAL_VALUE NOT LIKE @replicate_opt), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_name''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition_type''', 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0'); TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition_type; -START TRANSACTION; +/*M!100602 execute immediate if(@wsrep_cannot_replicate_tz, 'start transaction', 'LOCK TABLES time_zone WRITE, + time_zone_leap_second WRITE, + time_zone_name WRITE, + time_zone_transition WRITE, + time_zone_transition_type WRITE')*/; +UNLOCK TABLES; COMMIT; -ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; -ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=Aria; -ALTER TABLE time_zone_name ENGINE=Aria; -ALTER TABLE time_zone_transition ENGINE=Aria; -ALTER TABLE time_zone_transition_type ENGINE=Aria; -END IF| -\d ; +execute immediate if(@wsrep_cannot_replicate_tz, 'do 0','ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time'); +execute immediate if(@wsrep_cannot_replicate_tz, 'do 0','ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone ENGINE=', @time_zone_engine), 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_name ENGINE=', @time_zone_name_engine), 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition ENGINE=', @time_zone_transition_engine, ', ORDER BY Time_zone_id, Transition_time'), 'do 0'); +execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition_type ENGINE=', @time_zone_transition_type_engine, ', ORDER BY Time_zone_id, Transition_type_id'), 'do 0'); +DROP TABLE baseline; +DROP TABLE time_zone; +DROP TABLE time_zone_name; +DROP TABLE time_zone_transition; +DROP TABLE time_zone_transition_type; +DROP TABLE time_zone_leap_second; +# +# End of 10.6 tests +# diff --git a/mysql-test/main/mysql_tzinfo_to_sql_symlink.test b/mysql-test/main/mysql_tzinfo_to_sql_symlink.test index 8ca82b87e30ad..5ccf74c256549 100644 --- a/mysql-test/main/mysql_tzinfo_to_sql_symlink.test +++ b/mysql-test/main/mysql_tzinfo_to_sql_symlink.test @@ -1,5 +1,13 @@ +--source include/have_innodb.inc --source include/have_symlink.inc --source include/not_windows.inc +--source include/no_protocol.inc + +CREATE TABLE time_zone LIKE mysql.time_zone; +CREATE TABLE time_zone_name LIKE mysql.time_zone_name; +CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition; +CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type; +CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second; --echo # --echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above @@ -15,9 +23,56 @@ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --exec $MYSQL_TZINFO_TO_SQL --verbose $MYSQLTEST_VARDIR/zoneinfo 2>&1 ---echo # Silent run +--echo # +--echo # MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases +--echo # + +--echo # Run on zoneinfo directory --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1 +--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo > $MYSQL_TMP_DIR/tz.sql +--disable_query_log +--source $MYSQL_TMP_DIR/tz.sql +--enable_query_log +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +--echo # +--echo # Run on zoneinfo directory --skip-write-binlog +--echo # + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>&1 +--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>/dev/null > $MYSQL_TMP_DIR/tz.sql +--disable_query_log +CREATE TEMPORARY TABLE baseline AS + SELECT VARIABLE_NAME,VARIABLE_VALUE + FROM information_schema.global_status + WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE'); +--source $MYSQL_TMP_DIR/tz.sql +--enable_query_log + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN; +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff + FROM information_schema.global_status g + JOIN baseline b USING (VARIABLE_NAME) + ORDER BY g.VARIABLE_NAME; + +# Below tests don't include TRUNCATE TABLE so clear them. +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +TRUNCATE TABLE time_zone_leap_second; --echo # --echo # Testing with explicit timezonefile @@ -25,26 +80,180 @@ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1 +--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>/dev/null > $MYSQL_TMP_DIR/tz.sql +--disable_query_log +CREATE OR REPLACE TEMPORARY TABLE baseline AS + SELECT VARIABLE_NAME,VARIABLE_VALUE + FROM information_schema.global_status + WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE'); +--source $MYSQL_TMP_DIR/tz.sql +--enable_query_log + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN; +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff + FROM information_schema.global_status g + JOIN baseline b USING (VARIABLE_NAME) + ORDER BY g.VARIABLE_NAME; + +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +TRUNCATE TABLE time_zone_leap_second; + +--echo # +--echo # Testing with explicit timezonefile --skip-write-binlog +--echo # + +--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1 +--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>/dev/null > $MYSQL_TMP_DIR/tz.sql +--disable_query_log +CREATE OR REPLACE TEMPORARY TABLE baseline AS + SELECT VARIABLE_NAME,VARIABLE_VALUE + FROM information_schema.global_status + WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE'); +--source $MYSQL_TMP_DIR/tz.sql +--enable_query_log + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN; +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff + FROM information_schema.global_status g + JOIN baseline b USING (VARIABLE_NAME) + ORDER BY g.VARIABLE_NAME; + +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +TRUNCATE TABLE time_zone_leap_second; --echo # --echo # Testing --leap --echo # --exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1 +--exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>/dev/null > $MYSQL_TMP_DIR/tz.sql +--disable_query_log +CREATE OR REPLACE TEMPORARY TABLE baseline AS + SELECT VARIABLE_NAME,VARIABLE_VALUE + FROM information_schema.global_status + WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE'); +--source $MYSQL_TMP_DIR/tz.sql +--enable_query_log -# -# Cleanup -# +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; ---exec rm -rf $MYSQLTEST_VARDIR/zoneinfo +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN; +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff + FROM information_schema.global_status g + JOIN baseline b USING (VARIABLE_NAME) + ORDER BY g.VARIABLE_NAME; + +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +TRUNCATE TABLE time_zone_leap_second; + +--echo # +--echo # Testing --skip-write-binlog --leap +--echo # + +--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1 +--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog --leap $MYSQLTEST_VARDIR/zoneinfo/GMT > $MYSQL_TMP_DIR/tz.sql +--disable_query_log +CREATE OR REPLACE TEMPORARY TABLE baseline AS + SELECT VARIABLE_NAME,VARIABLE_VALUE + FROM information_schema.global_status + WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE'); +--source $MYSQL_TMP_DIR/tz.sql +--enable_query_log + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN; +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff + FROM information_schema.global_status g + JOIN baseline b USING (VARIABLE_NAME) + ORDER BY g.VARIABLE_NAME; + +--echo # +--echo # MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases +--echo # + +--echo # +--echo # Testing --skip-write-binlog +--echo # + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1 + +--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1 + +--echo # +--echo # End of 10.2 tests +--echo # + +--echo # +--echo # MDEV-29347 MariaDB 10.6.8 fails to start when ONLY_FULL_GROUP_BY gets provided +--echo # + +--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo > $MYSQL_TMP_DIR/tz.sql +set sql_mode=only_full_group_by; +--disable_query_log +--source $MYSQL_TMP_DIR/tz.sql +--enable_query_log +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; +select @@sql_mode; +set sql_mode=default; --echo # --echo # MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL --echo # +--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo --exec mkdir $MYSQLTEST_VARDIR/zoneinfo --copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/Factory --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1 +# +# Cleanup +# + +--remove_file $MYSQL_TMP_DIR/tz.sql --exec rm -rf $MYSQLTEST_VARDIR/zoneinfo +DROP TABLE baseline; +DROP TABLE time_zone; +DROP TABLE time_zone_name; +DROP TABLE time_zone_transition; +DROP TABLE time_zone_transition_type; +DROP TABLE time_zone_leap_second; + +--echo # +--echo # End of 10.6 tests +--echo # diff --git a/mysql-test/main/mysql_upgrade-6984.test b/mysql-test/main/mysql_upgrade-6984.test index 4c5c44493e27b..48a06bbd542f8 100644 --- a/mysql-test/main/mysql_upgrade-6984.test +++ b/mysql-test/main/mysql_upgrade-6984.test @@ -14,6 +14,7 @@ update mysql.global_priv set priv=json_set(priv, '$.plugin', 'mysql_native_password', '$.authentication_string', password('foo')) where user='root'; +--replace_regex /[^ ]*mysql_upgrade_info/...mysql_upgrade_info/ --exec $MYSQL_UPGRADE connect(con1,localhost,root,foo,,,); @@ -22,3 +23,6 @@ update mysql.global_priv set priv=json_compact(json_remove(priv, '$.plugin', '$. flush privileges; # Load event table set global event_scheduler=OFF; + +let MYSQLD_DATADIR= `select @@datadir`; +--remove_file $MYSQLD_DATADIR/mysql_upgrade_info diff --git a/mysql-test/main/mysql_upgrade.result b/mysql-test/main/mysql_upgrade.result index 317622a391c8c..f119937bf5941 100644 --- a/mysql-test/main/mysql_upgrade.result +++ b/mysql-test/main/mysql_upgrade.result @@ -1,4 +1,5 @@ set sql_mode=""; +call mtr.add_suppression("Incorrect definition of table mysql.column_stats:.*"); Run mysql_upgrade once Phase 1/7: Checking and upgrading mysql database Processing databases @@ -149,7 +150,8 @@ test Phase 7/7: Running 'FLUSH PRIVILEGES' OK Run it again - should say already completed -This installation of MariaDB is already upgraded to VERSION, use --force if you still need to run mysql_upgrade +This installation of MariaDB is already upgraded to VERSION.There is no need to run mysql_upgrade again for VERSION. +You can use --force if you still want 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 @@ -451,11 +453,12 @@ test Phase 7/7: Running 'FLUSH PRIVILEGES' OK DROP USER mysqltest1@'%'; -Version check failed. Got the following error when calling the 'mysql' command line client +Reading datadir from the MariaDB server failed. Got the following error when executing the 'mysql' command line client ERROR 1045 (28000): Access denied for user 'mysqltest1'@'localhost' (using password: YES) FATAL ERROR: Upgrade failed Run mysql_upgrade with a non existing server socket -mysqlcheck: Got error: 2005: Unknown server host 'not_existing_host' (errno) when trying to connect +Reading datadir from the MariaDB server failed. Got the following error when executing the 'mysql' command line client +ERROR 2005 (HY000): Unknown server host 'not_existing_host' (errno) FATAL ERROR: Upgrade failed set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE'; Phase 1/7: Checking and upgrading mysql database @@ -1126,9 +1129,12 @@ OK # Bug #21489398: MYSQL_UPGRADE: FATAL ERROR: UPGRADE FAILED - IMPROVE ERROR # Run mysql_upgrade with unauthorized access -Version check failed. Got the following error when calling the 'mysql' command line client +Reading datadir from the MariaDB server failed. Got the following error when executing the 'mysql' command line client ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) FATAL ERROR: Upgrade failed +Reading datadir from the MariaDB server failed. Got the following error when executing the 'mysql' command line client +ERROR 1045 (errno): Access denied for user 'root'@'localhost' (using password: YES) +FATAL ERROR: Upgrade failed # # MDEV-4332 Increase username length from 16 characters # MDEV-6068, MDEV-6178 mysql_upgrade breaks databases with long user names @@ -1314,10 +1320,6 @@ partition p2008 values less than (2009) ); select length(table_name) from mysql.innodb_table_stats; length(table_name) -79 -79 -79 -79 drop table extralongname_extralongname_extralongname_extralongname_ext; # End of 10.0 tests set sql_mode=default; @@ -1482,7 +1484,7 @@ SHOW CREATE TABLE test.t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE test.t1; SET GLOBAL enforce_storage_engine=NULL; # End of 10.1 tests @@ -1496,38 +1498,38 @@ FLUSH PRIVILEGES; SHOW CREATE TABLE mysql.user; Table Create Table user CREATE TABLE `user` ( - `Host` char(60) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(32) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Reload_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Shutdown_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Process_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `File_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `References_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Show_db_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Super_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Repl_client_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_user_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Host` char(60) NOT NULL DEFAULT '', + `User` char(32) NOT NULL DEFAULT '', + `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Reload_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Shutdown_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Process_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `File_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `References_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Show_db_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Super_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Repl_client_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_user_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', `ssl_cipher` blob NOT NULL, `x509_issuer` blob NOT NULL, `x509_subject` blob NOT NULL, @@ -1535,12 +1537,12 @@ user CREATE TABLE `user` ( `max_updates` int(11) unsigned NOT NULL DEFAULT 0, `max_connections` int(11) unsigned NOT NULL DEFAULT 0, `max_user_connections` int(11) unsigned NOT NULL DEFAULT 0, - `plugin` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT 'mysql_native_password', - `authentication_string` text COLLATE utf8mb3_bin DEFAULT NULL, - `password_expired` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', + `plugin` char(64) NOT NULL DEFAULT 'mysql_native_password', + `authentication_string` text DEFAULT NULL, + `password_expired` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', `password_last_changed` timestamp NULL DEFAULT NULL, `password_lifetime` smallint(5) unsigned DEFAULT NULL, - `account_locked` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', + `account_locked` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', PRIMARY KEY (`Host`,`User`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Users and global privileges' Phase 1/7: Checking and upgrading mysql database @@ -1890,6 +1892,34 @@ GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION GRANT USAGE ON *.* TO `aRole` DROP ROLE `aRole`; FLUSH PRIVILEGES; +# +# MDEV-27279: mariadb_upgrade add --check-if-upgrade-is-needed +# +This installation of MariaDB is already upgraded to MariaDB . +There is no need to run mysql_upgrade again for MariaDB . +Looking for 'mariadb' as: mariadb +This installation of MariaDB is already upgraded to MariaDB . +There is no need to run mysql_upgrade again for MariaDB . +# +# MDEV-27279: mariadb_upgrade check-if-upgrade absence is do it +# +Looking for 'mariadb' as: mariadb +Empty or non existent ...mysql_upgrade_info. Assuming mysql_upgrade has to be run! +# +# MDEV-27279: mariadb_upgrade check-if-upgrade with minor version change +# +Looking for 'mariadb' as: mariadb +This installation of MariaDB is already upgraded to MariaDB . +There is no need to run mysql_upgrade again for MariaDB . +This installation of MariaDB is already upgraded to MariaDB . +There is no need to run mysql_upgrade again for MariaDB . +You can use --force if you still want to run mysql_upgrade +# +# MDEV-27279: mariadb_upgrade check-if-upgrade with major version change +# +Major version upgrade detected from MariaDB to MariaDB . Check required! +Looking for 'mysql' as: mysql +Major version upgrade detected from MariaDB to MariaDB . Check required! drop table mysql.global_priv; rename table mysql.global_priv_bak to mysql.global_priv; # End of 10.2 tests @@ -1915,7 +1945,168 @@ 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 +# +# MDEV-16735 Upgrades only work if 'alter_algorithm' is 'DEFAULT' +# or 'COPY'. Test that the session value 'DEFAULT' in mysql_upgrade +# properly overrides the potentially incompatible global value. +# +SET GLOBAL alter_algorithm='INPLACE'; +SHOW GLOBAL VARIABLES LIKE 'alter_algorithm'; +Variable_name Value +alter_algorithm INPLACE +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 OK +mysql.innodb_table_stats OK +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 OK +Phase 2/7: Installing used storage engines... Skipped +Phase 3/7: Fixing views +mysql.user OK +sys.host_summary OK +sys.host_summary_by_file_io OK +sys.host_summary_by_file_io_type OK +sys.host_summary_by_stages OK +sys.host_summary_by_statement_latency OK +sys.host_summary_by_statement_type OK +sys.innodb_buffer_stats_by_schema OK +sys.innodb_buffer_stats_by_table OK +sys.innodb_lock_waits OK +sys.io_by_thread_by_latency OK +sys.io_global_by_file_by_bytes OK +sys.io_global_by_file_by_latency OK +sys.io_global_by_wait_by_bytes OK +sys.io_global_by_wait_by_latency OK +sys.latest_file_io OK +sys.memory_by_host_by_current_bytes OK +sys.memory_by_thread_by_current_bytes OK +sys.memory_by_user_by_current_bytes OK +sys.memory_global_by_current_bytes OK +sys.memory_global_total OK +sys.metrics OK +sys.processlist OK +sys.ps_check_lost_instrumentation OK +sys.schema_auto_increment_columns OK +sys.schema_index_statistics OK +sys.schema_object_overview OK +sys.schema_redundant_indexes OK +sys.schema_table_lock_waits OK +sys.schema_table_statistics OK +sys.schema_table_statistics_with_buffer OK +sys.schema_tables_with_full_table_scans OK +sys.schema_unused_indexes OK +sys.session OK +sys.session_ssl_status OK +sys.statement_analysis OK +sys.statements_with_errors_or_warnings OK +sys.statements_with_full_table_scans OK +sys.statements_with_runtimes_in_95th_percentile OK +sys.statements_with_sorting OK +sys.statements_with_temp_tables OK +sys.user_summary OK +sys.user_summary_by_file_io OK +sys.user_summary_by_file_io_type OK +sys.user_summary_by_stages OK +sys.user_summary_by_statement_latency OK +sys.user_summary_by_statement_type OK +sys.version OK +sys.wait_classes_global_by_avg_latency OK +sys.wait_classes_global_by_latency OK +sys.waits_by_host_by_latency OK +sys.waits_by_user_by_latency OK +sys.waits_global_by_latency OK +sys.x$host_summary OK +sys.x$host_summary_by_file_io OK +sys.x$host_summary_by_file_io_type OK +sys.x$host_summary_by_stages OK +sys.x$host_summary_by_statement_latency OK +sys.x$host_summary_by_statement_type OK +sys.x$innodb_buffer_stats_by_schema OK +sys.x$innodb_buffer_stats_by_table OK +sys.x$innodb_lock_waits OK +sys.x$io_by_thread_by_latency OK +sys.x$io_global_by_file_by_bytes OK +sys.x$io_global_by_file_by_latency OK +sys.x$io_global_by_wait_by_bytes OK +sys.x$io_global_by_wait_by_latency OK +sys.x$latest_file_io OK +sys.x$memory_by_host_by_current_bytes OK +sys.x$memory_by_thread_by_current_bytes OK +sys.x$memory_by_user_by_current_bytes OK +sys.x$memory_global_by_current_bytes OK +sys.x$memory_global_total OK +sys.x$processlist OK +sys.x$ps_digest_95th_percentile_by_avg_us OK +sys.x$ps_digest_avg_latency_distribution OK +sys.x$ps_schema_table_statistics_io OK +sys.x$schema_flattened_keys OK +sys.x$schema_index_statistics OK +sys.x$schema_table_lock_waits OK +sys.x$schema_table_statistics OK +sys.x$schema_table_statistics_with_buffer OK +sys.x$schema_tables_with_full_table_scans OK +sys.x$session OK +sys.x$statement_analysis OK +sys.x$statements_with_errors_or_warnings OK +sys.x$statements_with_full_table_scans OK +sys.x$statements_with_runtimes_in_95th_percentile OK +sys.x$statements_with_sorting OK +sys.x$statements_with_temp_tables OK +sys.x$user_summary OK +sys.x$user_summary_by_file_io OK +sys.x$user_summary_by_file_io_type OK +sys.x$user_summary_by_stages OK +sys.x$user_summary_by_statement_latency OK +sys.x$user_summary_by_statement_type OK +sys.x$wait_classes_global_by_avg_latency OK +sys.x$wait_classes_global_by_latency OK +sys.x$waits_by_host_by_latency OK +sys.x$waits_by_user_by_latency OK +sys.x$waits_global_by_latency 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 +information_schema +mtr +mtr.global_suppressions OK +mtr.test_suppressions OK +performance_schema +sys +sys.sys_config OK +test +Phase 7/7: Running 'FLUSH PRIVILEGES' +OK +SET GLOBAL alter_algorithm=DEFAULT; +SHOW GLOBAL VARIABLES LIKE 'alter_algorithm'; +Variable_name Value +alter_algorithm DEFAULT +End of 10.3 tests # switching from mysql.global_priv to mysql.user drop view mysql.user_bak; create user 'user3'@'localhost' identified with mysql_native_password as password('a_password'); diff --git a/mysql-test/main/mysql_upgrade.test b/mysql-test/main/mysql_upgrade.test index e81666585d3a4..b9ff05401f712 100644 --- a/mysql-test/main/mysql_upgrade.test +++ b/mysql-test/main/mysql_upgrade.test @@ -2,9 +2,11 @@ -- source include/have_working_dns.inc -- source include/have_innodb.inc -- source include/have_partition.inc +-- source include/no_valgrind_without_big.inc set sql_mode=""; +call mtr.add_suppression("Incorrect definition of table mysql.column_stats:.*"); # # Basic test that we can run mysql_upgrde and that it finds the # expected binaries it uses. @@ -17,7 +19,7 @@ let $MYSQLD_DATADIR= `select @@datadir`; file_exists $MYSQLD_DATADIR/mysql_upgrade_info; --echo Run it again - should say already completed ---replace_regex /upgraded to .*, use/upgraded to VERSION, use/ +--replace_regex /upgraded to [^\n].*/upgraded to VERSION./ /again for [^\n]*/again for VERSION./ --exec $MYSQL_UPGRADE 2>&1 # It should have created a file in the MySQL Servers datadir @@ -55,7 +57,7 @@ DROP USER mysqltest1@'%'; --echo Run mysql_upgrade with a non existing server socket --replace_result $MYSQLTEST_VARDIR var ---replace_regex /.*mysqlcheck.*: Got/mysqlcheck: Got/ /\([0-9|-]*\)/(errno)/ +--replace_regex /.*mariadb-check.*: Got/mariadb-check: Got/ /\([0-9|-]*\)/(errno)/ --error 1 # NC: Added --skip-version-check, as the version check would fail when # mysql_upgrade tries to get the server version. @@ -125,7 +127,7 @@ let $MYSQLD_DATADIR= `select @@datadir`; --remove_file $MYSQLD_DATADIR/mysql_upgrade_info --echo # Running mysql_upgrade with --skip-write-binlog.. ---replace_result $MYSQLTEST_VARDIR var +--replace_regex /[^ ]*mysql_upgrade_info/...mysql_upgrade_info/ --exec $MYSQL_UPGRADE --skip-write-binlog # mysql_upgrade must have created mysql_upgrade_info file, @@ -139,12 +141,15 @@ let $MYSQLD_DATADIR= `select @@datadir`; --echo Run mysql_upgrade with unauthorized access --error 1 --exec $MYSQL_UPGRADE --skip-verbose --user=root --password=wrong_password 2>&1 +--replace_regex /.*mariadb-check.*: Got/mariadb-check: Got/ /\([0-9|-]*\)/(errno)/ +--error 1 +--exec $MYSQL_UPGRADE --skip-verbose --skip-version-check --user=root --password=wrong_password 2>&1 --echo # --echo # MDEV-4332 Increase username length from 16 characters --echo # MDEV-6068, MDEV-6178 mysql_upgrade breaks databases with long user names --echo # - +--disable_service_connection connection default; GRANT SELECT ON mysql.* TO very_long_user_name_number_1; GRANT SELECT ON mysql.* TO very_long_user_name_number_2; @@ -167,7 +172,7 @@ SELECT definer FROM mysql.proc WHERE db = 'test' AND name = 'pr'; SELECT grantor FROM mysql.tables_priv WHERE db = 'mysql' AND table_name = 'user'; DROP USER very_long_user_name_number_1, very_long_user_name_number_2, even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost; DROP PROCEDURE test.pr; - +--enable_service_connection # # MDEV-13274 mysql_upgrade fails if dbname+tablename+partioname > 64 chars # @@ -232,6 +237,7 @@ FLUSH TABLES mysql.user; FLUSH PRIVILEGES; SHOW CREATE TABLE mysql.user; +--replace_result $MYSQLTEST_VARDIR var --exec $MYSQL_UPGRADE --force 2>&1 SHOW CREATE TABLE mysql.user; @@ -276,6 +282,79 @@ SHOW GRANTS; DROP ROLE `aRole`; --exec $MYSQL mysql < $MYSQLTEST_VARDIR/tmp/user.sql FLUSH PRIVILEGES; + +--echo # +--echo # MDEV-27279: mariadb_upgrade add --check-if-upgrade-is-needed +--echo # + +--error 1 +--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent +--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / +--error 1 +--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed +--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/ +--error 1 +--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose + +--echo # +--echo # MDEV-27279: mariadb_upgrade check-if-upgrade absence is do it +--echo # + +--remove_file $MYSQLD_DATADIR/mysql_upgrade_info +--replace_regex /[^ ]*mysql_upgrade_info/...mysql_upgrade_info/ +--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed + +--replace_regex /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/ /open .* Assuming/open XXX. Assuming/ /[^ ]*mysql_upgrade_info/...mysql_upgrade_info/ +--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose + +--echo # +--echo # MDEV-27279: mariadb_upgrade check-if-upgrade with minor version change +--echo # + +# take 3rd number of version and change to 0 + +let DATADIR= $MYSQLD_DATADIR; + +perl; + my $ver= $ENV{'MYSQL_SERVER_VERSION'} or die "MYSQL_SERVER_VERSION not set"; + my $file= $ENV{'DATADIR'} or die "MYSQLD_DATADIR not set"; + $ver =~ s/^(\d*)\.(\d*).(\d*)(.*)/$1.$2.0$4/; + open(FILE, ">$file/mysql_upgrade_info") or die "Failed to open $file"; + print FILE "$ver\n"; + close(FILE); +EOF + +--error 1 +--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent +--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/ +--error 1 +--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose +--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / +--exec $MYSQL_UPGRADE +--remove_file $MYSQLD_DATADIR/mysql_upgrade_info + +--echo # +--echo # MDEV-27279: mariadb_upgrade check-if-upgrade with major version change +--echo # + +# take 2rd number of version and change to 0 + +let DATADIR= $MYSQLD_DATADIR; + +perl; + my $ver= $ENV{'MYSQL_SERVER_VERSION'} or die "MYSQL_SERVER_VERSION not set"; + my $file= $ENV{'DATADIR'} or die "MYSQLD_DATADIR not set"; + $ver =~ s/^(\d*)\.(\d*).(\d*)(.*)/$1.0.$3$4/; + open(FILE, ">$file/mysql_upgrade_info") or die "Failed to open $file"; + print FILE "$ver\n"; + close(FILE); +EOF + +--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent +--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / +--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed +--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mariadb.* as:[^\n]*/'mysql' as: mysql/ +--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose --remove_file $MYSQLD_DATADIR/mysql_upgrade_info drop table mysql.global_priv; rename table mysql.global_priv_bak to mysql.global_priv; @@ -305,7 +384,20 @@ 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 +--echo # +--echo # MDEV-16735 Upgrades only work if 'alter_algorithm' is 'DEFAULT' +--echo # or 'COPY'. Test that the session value 'DEFAULT' in mysql_upgrade +--echo # properly overrides the potentially incompatible global value. +--echo # + +SET GLOBAL alter_algorithm='INPLACE'; +SHOW GLOBAL VARIABLES LIKE 'alter_algorithm'; +--exec $MYSQL_UPGRADE --force 2>&1 +SET GLOBAL alter_algorithm=DEFAULT; +SHOW GLOBAL VARIABLES LIKE 'alter_algorithm'; +--remove_file $MYSQLD_DATADIR/mysql_upgrade_info + +--echo End of 10.3 tests --source include/switch_to_mysql_user.inc drop view mysql.user_bak; diff --git a/mysql-test/main/mysql_upgrade_mysql_json_datatype.result b/mysql-test/main/mysql_upgrade_mysql_json_datatype.result index cbf2b17175ae9..c58adb829ac46 100644 --- a/mysql-test/main/mysql_upgrade_mysql_json_datatype.result +++ b/mysql-test/main/mysql_upgrade_mysql_json_datatype.result @@ -174,19 +174,19 @@ show create table tempty; Table Create Table tempty CREATE TABLE `tempty` ( `t` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table mysql_json_test; Table Create Table mysql_json_test CREATE TABLE `mysql_json_test` ( - `description` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `expected` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `description` varchar(100) DEFAULT NULL, + `expected` longtext DEFAULT NULL, `actual` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci show create table mysql_json_test_big; Table Create Table mysql_json_test_big CREATE TABLE `mysql_json_test_big` ( - `description` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `expected` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `description` varchar(100) DEFAULT NULL, + `expected` longtext DEFAULT NULL, `actual` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci select count(*) as 'Total_Number_of_Tests', diff --git a/mysql-test/main/mysql_upgrade_noengine.result b/mysql-test/main/mysql_upgrade_noengine.result index 7d2bbca7c43d7..459a1a6ce3426 100644 --- a/mysql-test/main/mysql_upgrade_noengine.result +++ b/mysql-test/main/mysql_upgrade_noengine.result @@ -55,6 +55,7 @@ Warnings: Level Warning Code 1286 Message Unknown storage engine 'ARCHIVE' +# upgrade from 10.1 - engines aren't enabled Phase 1/7: Checking and upgrading mysql database Processing databases mysql @@ -250,6 +251,8 @@ rename table mysql.global_priv_bak to mysql.global_priv; # switching from mysql.global_priv to mysql.user drop view mysql.user_bak; alter table mysql.user drop column default_role, drop column max_statement_time; +# still upgrade from 10.1 +Major version upgrade detected from MariaDB to MariaDB . Check required! Phase 1/7: Checking and upgrading mysql database Processing databases mysql @@ -445,6 +448,7 @@ rename table mysql.global_priv_bak to mysql.global_priv; # switching from mysql.global_priv to mysql.user drop view mysql.user_bak; alter table mysql.user drop column default_role, drop column max_statement_time; +# upgrade from 10.0 - engines are enabled Phase 1/7: Checking and upgrading mysql database Processing databases mysql diff --git a/mysql-test/main/mysql_upgrade_noengine.test b/mysql-test/main/mysql_upgrade_noengine.test index efe36c355abd5..a2d229dc9be68 100644 --- a/mysql-test/main/mysql_upgrade_noengine.test +++ b/mysql-test/main/mysql_upgrade_noengine.test @@ -32,7 +32,8 @@ uninstall plugin archive; 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'; -# upgrade from 10.1 - engines aren't enabled +--echo # upgrade from 10.1 - engines aren't enabled +--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / 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'; @@ -51,7 +52,8 @@ write_file $datadir/mysql_upgrade_info; 10.1.10-MariaDB EOF -# still upgrade from 10.1 +--echo # still upgrade from 10.1 +--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / 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'; @@ -64,7 +66,8 @@ drop view mysql.user_bak; alter table mysql.user drop column default_role, drop column max_statement_time; remove_file $datadir/mysql_upgrade_info; -# upgrade from 10.0 - engines are enabled +--echo # upgrade from 10.0 - engines are enabled +--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / 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'; diff --git a/mysql-test/main/mysql_upgrade_view.result b/mysql-test/main/mysql_upgrade_view.result index a7f13c185a8c2..ca879b9255960 100644 --- a/mysql-test/main/mysql_upgrade_view.result +++ b/mysql-test/main/mysql_upgrade_view.result @@ -1,3 +1,4 @@ +reset master; set sql_log_bin=0; drop table if exists t1,v1,v2,v3,v4,v1badcheck; drop view if exists t1,v1,v2,v3,v4,v1badcheck; diff --git a/mysql-test/main/mysql_upgrade_view.test b/mysql-test/main/mysql_upgrade_view.test index 3de7284c40ce2..d3d955e7caea7 100644 --- a/mysql-test/main/mysql_upgrade_view.test +++ b/mysql-test/main/mysql_upgrade_view.test @@ -1,6 +1,7 @@ -- source include/have_log_bin.inc -- source include/have_perfschema.inc +reset master; # clear binlogs set sql_log_bin=0; --disable_warnings drop table if exists t1,v1,v2,v3,v4,v1badcheck; diff --git a/mysql-test/main/mysqladmin.result b/mysql-test/main/mysqladmin.result index 99615f60e1b5a..8c28a5aabaef5 100644 --- a/mysql-test/main/mysqladmin.result +++ b/mysql-test/main/mysqladmin.result @@ -1,6 +1,6 @@ mysqld is alive -mysqladmin: unknown variable 'database=db1' -Warning: mysqladmin: unknown variable 'loose-database=db2' +mariadb-admin: unknown variable 'database=db1' +Warning: mariadb-admin: unknown variable 'loose-database=db2' mysqld is alive # # Bug#58221 : mysqladmin --sleep=x --count=x keeps looping @@ -17,7 +17,6 @@ mysqld is alive # Creating an empty file 'cnf_file' # Using --defaults-extra-file option with 'cnf_file'. mysqld is alive -# Kill the server # restart: --ssl-key=MYSQLTEST_VARDIR/tmp/ssl_key.pem --ssl-cert=MYSQLTEST_VARDIR/tmp/ssl_cert.pem 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'; @@ -26,5 +25,4 @@ SELECT VARIABLE_VALUE INTO @ssl_not_after FROM INFORMATION_SCHEMA.SESSION_STATUS Result OK # Cleanup -# Kill the server # restart diff --git a/mysql-test/main/mysqladmin.test b/mysql-test/main/mysqladmin.test index 97e805ecf7319..07e23cfe25cf7 100644 --- a/mysql-test/main/mysqladmin.test +++ b/mysql-test/main/mysqladmin.test @@ -11,13 +11,13 @@ # Bug#10608 mysqladmin breaks on "database" variable in my.cnf # ---replace_regex /.*mysqladmin.*: unknown/mysqladmin: unknown/ +--replace_regex /.*mariadb-admin.*: unknown/mariadb-admin: unknown/ --error 7 --exec $MYSQLADMIN --database=db1 --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1 # When mysqladmin finds "loose-database" it shall print # a warning and continue ---replace_regex /Warning: .*mysqladmin.*: unknown/Warning: mysqladmin: unknown/ +--replace_regex /Warning: .*mariadb-admin.*: unknown/Warning: mariadb-admin: unknown/ --exec $MYSQLADMIN --loose-database=db2 --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1 --echo # @@ -56,7 +56,7 @@ EOF # MDEV-19168 Reload SSL certificate # This test reloads server SSL certs ./mysqladmin flush-ssl, and checks that new SSL # connection use new certificate. -# SWtatus variable Ssl_server_not_after is used to tell the old certificate from new. +# Status variable Ssl_server_not_after is used to tell the old certificate from new. # source include/have_ssl_communication.inc; @@ -72,8 +72,7 @@ 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 +--source include/restart_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'; @@ -94,7 +93,6 @@ exec $MYSQL --ssl -e "SELECT IF(VARIABLE_VALUE <> '$ssl_not_after', 'OK', 'FAI --echo # Cleanup remove_file $ssl_cert; remove_file $ssl_key; -# restart with usuall SSL +# restart with usual SSL let $restart_parameters=; ---source include/kill_mysqld.inc ---source include/start_mysqld.inc +--source include/restart_mysqld.inc diff --git a/mysql-test/main/mysqlbinlog-innodb.result b/mysql-test/main/mysqlbinlog-innodb.result index 8428e4cd74b6a..566563bff76d1 100644 --- a/mysql-test/main/mysqlbinlog-innodb.result +++ b/mysql-test/main/mysqlbinlog-innodb.result @@ -29,11 +29,11 @@ START TRANSACTION use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; INSERT INTO t1 VALUES (1) @@ -60,11 +60,11 @@ START TRANSACTION use `foo`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; INSERT INTO t1 VALUES (1) diff --git a/mysql-test/main/mysqlbinlog.result b/mysql-test/main/mysqlbinlog.result index b9f7f5b61b912..1ca22f42277fc 100644 --- a/mysql-test/main/mysqlbinlog.result +++ b/mysql-test/main/mysqlbinlog.result @@ -22,11 +22,11 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; DROP TABLE IF EXISTS `t1`,`t2`,`t3`,`t4`,`t5`,`t03`,`t04` /* generated by server */ @@ -102,11 +102,11 @@ START TRANSACTION use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`) @@ -138,11 +138,11 @@ START TRANSACTION /*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; COMMIT @@ -189,11 +189,11 @@ START TRANSACTION use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values ("Alas") @@ -216,11 +216,11 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; DROP TABLE IF EXISTS `t1`,`t2`,`t3`,`t4`,`t5`,`t03`,`t04` /* generated by server */ @@ -296,11 +296,11 @@ START TRANSACTION use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`) @@ -332,11 +332,11 @@ START TRANSACTION /*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; COMMIT @@ -383,11 +383,11 @@ START TRANSACTION use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values ("Alas") @@ -492,11 +492,11 @@ DELIMITER /*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() @@ -544,11 +544,11 @@ DELIMITER /*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a varchar(64) character set utf8) @@ -666,7 +666,7 @@ connect unsecure,localhost,untrusted,,mysqltest1; mysql mysqltest1 -uuntrusted < var/tmp/bug31611.sql connection unsecure; INSERT INTO t1 VALUES (1,USER()); -ERROR 42000: INSERT command denied to user 'untrusted'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'untrusted'@'localhost' for table `mysqltest1`.`t1` SELECT * FROM t1; a b 1 root@localhost @@ -724,11 +724,11 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1253783037/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table t1(a int) engine= innodb @@ -778,11 +778,11 @@ DELIMITER /*!*/; ROLLBACK/*!*/; SET TIMESTAMP=1253783037/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; BEGIN @@ -813,11 +813,11 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; SET TIMESTAMP=1266652094/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; BEGIN @@ -855,11 +855,11 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; SET TIMESTAMP=1266652094/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; BEGIN @@ -886,7 +886,7 @@ Alternatives are: 'NEVER','AUTO','UNSPEC','DECODE-ROWS' # # Expect error for incomplete --base64-output argument. # MYSQL_BINLOG std_data/master-bin.000001 --base64-output 2>&1 -mysqlbinlog: option '--base64-output' requires an argument +mariadb-binlog: option '--base64-output' requires an argument # # Ensure --base64-output=auto outputs the same result as unspecified # MYSQL_BINLOG -v MYSQLD_DATADIR/master-bin.000001 > MYSQLTEST_VARDIR/tmp/mysqlbinlog_nob64spec.out @@ -973,11 +973,11 @@ AAAAAAAAAAAAAAAAAAAgrgJSFzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC # Event: Query thread_id=1 exec_time=0 error_code=0 xid=0 SET TIMESTAMP=1375907364/*!*/; SET @@session.pseudo_thread_id=1/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table test.t1 (id int not null) @@ -1056,11 +1056,11 @@ AAAAAAAAAAAAAAAAAAA/rQJSGzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC # Event: Query thread_id=1 exec_time=1 error_code=0 xid=0 SET TIMESTAMP=1375907141/*!*/; SET @@session.pseudo_thread_id=1/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table test.t1 (id int not null) @@ -1139,11 +1139,11 @@ AAAAAAAAAAAAAAAAAAAnrAJSHzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC # Event: Query thread_id=1 exec_time=0 error_code=0 xid=0 SET TIMESTAMP=1375906879/*!*/; SET @@session.pseudo_thread_id=1/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table test.t1 (id int not null) @@ -1222,11 +1222,11 @@ AAAAAAAAAAAAAAAAAABbsAJSEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC # Event: Query thread_id=1 exec_time=0 error_code=0 xid=0 SET TIMESTAMP=1375907933/*!*/; SET @@session.pseudo_thread_id=1/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table test.t1 (id int not null) @@ -1267,7 +1267,7 @@ DELIMITER ; ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; -mysqlbinlog Ver VER for OS at ARCH +mariadb-binlog Ver VER for OS at ARCH # # Test --rewrite-db # diff --git a/mysql-test/main/mysqlbinlog.test b/mysql-test/main/mysqlbinlog.test index c8a141404d022..22a85393a356d 100644 --- a/mysql-test/main/mysqlbinlog.test +++ b/mysql-test/main/mysqlbinlog.test @@ -533,8 +533,8 @@ remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn; --echo # Expect error for incomplete --base64-output argument. --echo # MYSQL_BINLOG std_data/master-bin.000001 --base64-output 2>&1 # The error produces the absolute path of the mysqlbinlog executable, remove it. ---replace_regex /.*mysqlbinlog.*:/mysqlbinlog:/i ---error 1 +--replace_regex /.*mariadb-binlog.*:/mariadb-binlog:/i +--error 5 --exec $MYSQL_BINLOG std_data/master-bin.000001 --base64-output 2>&1 --echo # @@ -608,7 +608,7 @@ eval SET GLOBAL SERVER_ID = $old_server_id; # # MDEV-12372 mysqlbinlog --version output is the same on 10.x as on 5.5.x, and contains not only version # -replace_regex /.*mysqlbinlog(\.exe)? Ver .* for .* at [-_a-zA-Z0-9]+/mysqlbinlog Ver VER for OS at ARCH/; +replace_regex /.*mariadb-binlog(\.exe)? Ver .* for .* at [-_a-zA-Z0-9]+/mariadb-binlog Ver VER for OS at ARCH/; exec $MYSQL_BINLOG --version; --echo # diff --git a/mysql-test/main/mysqlbinlog_row_compressed.result b/mysql-test/main/mysqlbinlog_row_compressed.result index 210f39ffa2206..9ea11c7a6d38f 100644 --- a/mysql-test/main/mysqlbinlog_row_compressed.result +++ b/mysql-test/main/mysqlbinlog_row_compressed.result @@ -33,11 +33,11 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=X/*!*/; SET @@session.pseudo_thread_id=5/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) diff --git a/mysql-test/main/mysqlbinlog_row_minimal.result b/mysql-test/main/mysqlbinlog_row_minimal.result index adefdde9d04c6..cd59d24f0072a 100644 --- a/mysql-test/main/mysqlbinlog_row_minimal.result +++ b/mysql-test/main/mysqlbinlog_row_minimal.result @@ -31,11 +31,11 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=X/*!*/; SET @@session.pseudo_thread_id=5/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) @@ -397,11 +397,11 @@ START TRANSACTION # server id 1 end_log_pos END_LOG_POS CRC32 XXX Query thread_id=TID exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; SET @@session.pseudo_thread_id=TID/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; COMMIT diff --git a/mysql-test/main/mysqlbinlog_stmt_compressed.result b/mysql-test/main/mysqlbinlog_stmt_compressed.result index e922978b47dcc..bb1894099a1d0 100644 --- a/mysql-test/main/mysqlbinlog_stmt_compressed.result +++ b/mysql-test/main/mysqlbinlog_stmt_compressed.result @@ -33,11 +33,11 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=X/*!*/; SET @@session.pseudo_thread_id=5/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) diff --git a/mysql-test/main/mysqlcheck.test b/mysql-test/main/mysqlcheck.test index 502c90b0d89c6..ce4ac7d3be289 100644 --- a/mysql-test/main/mysqlcheck.test +++ b/mysql-test/main/mysqlcheck.test @@ -5,6 +5,9 @@ call mtr.add_suppression("Invalid .old.. table or database name"); --source include/have_innodb.inc --source include/default_charset.inc +#remove this include after fix MDEV-27873 +--source include/no_view_protocol.inc + set @save_character_set_client=@@character_set_client; set @save_collation_connection=@@collation_connection; diff --git a/mysql-test/main/mysqld--help,win.rdiff b/mysql-test/main/mysqld--help,win.rdiff index 337755252ba5d..bcfefbab1a886 100644 --- a/mysql-test/main/mysqld--help,win.rdiff +++ b/mysql-test/main/mysqld--help,win.rdiff @@ -1,6 +1,12 @@ ---- a/mysql-test/r/mysqld--help.result -+++ b/mysql-test/r/mysqld--help.result -@@ -647,6 +646,7 @@ +@@ -180,6 +180,7 @@ + --console Write error output on screen; don't remove the console + window on windows. + --core-file Write core on crashes ++ (Defaults to on; use --skip-core-file to disable.) + -h, --datadir=name Path to the database root directory + --date-format=name The DATE format (ignored) + --datetime-format=name +@@ -650,6 +651,7 @@ Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME, DATETIME, TIMESTAMP columns. (Defaults to on; use --skip-mysql56-temporal-format to disable.) @@ -8,7 +14,7 @@ --net-buffer-length=# Buffer length for TCP/IP and socket communication --net-read-timeout=# -@@ -1236,6 +1236,10 @@ +@@ -1281,6 +1283,10 @@ Log slow queries to given log file. Defaults logging to 'hostname'-slow.log. Must be enabled to activate other slow log options @@ -19,7 +25,7 @@ --socket=name Socket file to use for connection --sort-buffer-size=# Each thread that needs to do a sort allocates a buffer of -@@ -1260,6 +1264,7 @@ +@@ -1305,6 +1311,7 @@ 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.) @@ -27,7 +33,7 @@ --standard-compliant-cte Allow only CTEs compliant to SQL standard (Defaults to on; use --skip-standard-compliant-cte to disable.) -@@ -1330,6 +1335,11 @@ +@@ -1380,6 +1387,11 @@ --thread-pool-max-threads=# Maximum allowed number of worker threads in the thread pool @@ -39,7 +45,7 @@ --thread-pool-oversubscribe=# How many additional active worker threads in a group are allowed. -@@ -1370,8 +1380,8 @@ +@@ -1418,8 +1430,8 @@ automatically convert it to an on-disk MyISAM or Aria table. -t, --tmpdir=name Path for temporary files. Several paths may be specified, @@ -50,7 +56,7 @@ --transaction-alloc-block-size=# Allocation block size for transactions to be stored in binary log -@@ -1587,6 +1596,7 @@ +@@ -1634,6 +1646,7 @@ myisam-stats-method NULLS_UNEQUAL myisam-use-mmap FALSE mysql56-temporal-format TRUE @@ -58,7 +64,7 @@ net-buffer-length 16384 net-read-timeout 30 net-retry-count 10 -@@ -1726,6 +1736,7 @@ +@@ -1788,6 +1801,7 @@ slave-type-conversions slow-launch-time 2 slow-query-log FALSE @@ -66,8 +72,8 @@ 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 -@@ -1753,6 +1764,8 @@ - thread-cache-size 151 +@@ -1814,6 +1828,8 @@ + thread-pool-exact-stats FALSE thread-pool-idle-timeout 60 thread-pool-max-threads 65536 +thread-pool-min-threads 1 diff --git a/mysql-test/main/mysqld--help-aria.result b/mysql-test/main/mysqld--help-aria.result index fb44c3ea3eeff..3e72f0aaff490 100644 --- a/mysql-test/main/mysqld--help-aria.result +++ b/mysql-test/main/mysqld--help-aria.result @@ -1,3 +1,4 @@ +flush tables; # # Check that we don't write any data to wrong or not existing datadir # diff --git a/mysql-test/main/mysqld--help-aria.test b/mysql-test/main/mysqld--help-aria.test index 55131e9e4eb51..2bd332c1484c8 100644 --- a/mysql-test/main/mysqld--help-aria.test +++ b/mysql-test/main/mysqld--help-aria.test @@ -1,6 +1,7 @@ # # Check errors from mysqld--help when providing different datadir # +flush tables; --let $args=--table-cache=5 --max-connections=10 --log-warnings=1 --silent-startup --lower-case-table-names=1 --help --verbose diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index d2799d6e009a3..42946fecda90a 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -42,6 +42,9 @@ The following specify which files/extra groups are read (specified before remain full' errors. No longer needed, as the server now handles this automatically. --bind-address=name IP address to bind to. + --binlog-alter-two-phase + When set, split ALTER at binary logging into 2 + statements: START ALTER and COMMIT/ROLLBACK ALTER --binlog-annotate-row-events Tells the master to annotate RBR events with the statement that caused these events @@ -185,7 +188,7 @@ The following specify which files/extra groups are read (specified before remain ALWAYS --console Write error output on screen; don't remove the console window on windows. - --core-file Write core on errors. + --core-file Write core on crashes -h, --datadir=name Path to the database root directory --date-format=name The DATE format (ignored) --datetime-format=name @@ -360,7 +363,9 @@ The following specify which files/extra groups are read (specified before remain --gtid-strict-mode Enforce strict seq_no ordering of events in the binary log. Slave stops with an error if it encounters an event that would cause it to generate an out-of-order binlog if - executed. + executed. When ON the same server-id semisync-replicated + transactions that duplicate exising ones in binlog are + ignored without error and slave interruption. -?, --help Display this help and exit. --histogram-size=# Number of bytes used for a histogram. If set to 0, no histograms are created by ANALYZE. @@ -503,6 +508,7 @@ The following specify which files/extra groups are read (specified before remain administrative statements to the slow log if it is open. Resets or sets the option 'admin' in log_slow_disabled_statements + (Defaults to on; use --skip-log-slow-admin-statements to disable.) --log-slow-disabled-statements=name Don't log certain types of statements to slow log. Any combination of: admin, call, slave, sp @@ -523,6 +529,7 @@ The following specify which files/extra groups are read (specified before remain Log slow statements executed by slave thread to the slow log if it is open. Resets or sets the option 'slave' in log_slow_disabled_statements + (Defaults to on; use --skip-log-slow-slave-statements to disable.) --log-slow-verbosity=name Verbosity level for the slow log. Any combination of: innodb, query_plan, explain @@ -731,7 +738,8 @@ The following specify which files/extra groups are read (specified before remain extended_keys, exists_to_in, orderby_uses_equalities, condition_pushdown_for_derived, split_materialized, condition_pushdown_for_subquery, rowid_filter, - condition_pushdown_from_having, not_null_range_scan + condition_pushdown_from_having, not_null_range_scan, + hash_join_cardinality --optimizer-trace=name Controls tracing of the Optimizer: optimizer_trace=option=val[,option=val...], where option @@ -1476,6 +1484,7 @@ automatic-sp-privileges TRUE back-log 80 big-tables FALSE bind-address (No default value) +binlog-alter-two-phase FALSE binlog-annotate-row-events TRUE binlog-cache-size 32768 binlog-checksum CRC32 @@ -1502,6 +1511,7 @@ column-compression-zlib-wrap FALSE completion-type NO_CHAIN concurrent-insert AUTO console TRUE +core-file TRUE date-format %Y-%m-%d datetime-format %Y-%m-%d %H:%i:%s deadlock-search-depth-long 15 diff --git a/mysql-test/main/mysqld--help.test b/mysql-test/main/mysqld--help.test index 95ae49b5c8998..42f551974d970 100644 --- a/mysql-test/main/mysqld--help.test +++ b/mysql-test/main/mysqld--help.test @@ -38,6 +38,7 @@ perl; test-sql-discovery query-cache-info password-reuse-check query-response-time metadata-lock-info locales unix-socket wsrep file-key-management cracklib-password-check user-variables + provider-bzip2 provider-lzma provider-lzo thread-pool-groups thread-pool-queues thread-pool-stats thread-pool-waits/; # And substitute the content some environment variables with their diff --git a/mysql-test/main/mysqldump-compat-102.result b/mysql-test/main/mysqldump-compat-102.result index aa8fe5a4de3e6..86a2ebc47e09e 100644 --- a/mysql-test/main/mysqldump-compat-102.result +++ b/mysql-test/main/mysqldump-compat-102.result @@ -77,6 +77,8 @@ $$ -- -- Dumping routines for database 'db1_mdev17429' -- +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT' */ ; /*!50003 DROP PROCEDURE IF EXISTS `p1` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -84,8 +86,6 @@ $$ /*!50003 SET character_set_client = latin1 */ ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT' */ ; DELIMITER ;; CREATE DEFINER="root"@"localhost" PROCEDURE "p1"(a INT) AS BEGIN diff --git a/mysql-test/main/mysqldump-max.result b/mysql-test/main/mysqldump-max.result index 2e131d46f9b9b..7dd1030eac1e2 100644 --- a/mysql-test/main/mysqldump-max.result +++ b/mysql-test/main/mysqldump-max.result @@ -89,7 +89,7 @@ id name /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `test`; DROP TABLE IF EXISTS `t1`; @@ -98,7 +98,7 @@ DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `id` int(8) DEFAULT NULL, `name` varchar(32) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -115,7 +115,7 @@ DROP TABLE IF EXISTS `t2`; CREATE TABLE `t2` ( `id` int(8) DEFAULT NULL, `name` varchar(32) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t2` DISABLE KEYS */; @@ -132,7 +132,7 @@ DROP TABLE IF EXISTS `t3`; CREATE TABLE `t3` ( `id` int(8) DEFAULT NULL, `name` varchar(32) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1; +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t3` DISABLE KEYS */; @@ -149,7 +149,7 @@ DROP TABLE IF EXISTS `t4`; CREATE TABLE `t4` ( `id` int(8) DEFAULT NULL, `name` varchar(32) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1; +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t4` DISABLE KEYS */; @@ -166,7 +166,7 @@ DROP TABLE IF EXISTS `t5`; CREATE TABLE `t5` ( `id` int(8) DEFAULT NULL, `name` varchar(32) DEFAULT NULL -) ENGINE=ARCHIVE DEFAULT CHARSET=latin1; +) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t5` DISABLE KEYS */; @@ -183,7 +183,7 @@ DROP TABLE IF EXISTS `t6`; CREATE TABLE `t6` ( `id` int(8) DEFAULT NULL, `name` varchar(32) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t6` DISABLE KEYS */; @@ -216,7 +216,7 @@ INSERT IGNORE INTO `t6` VALUES /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `test`; DROP TABLE IF EXISTS `t1`; @@ -225,7 +225,7 @@ DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `id` int(8) DEFAULT NULL, `name` varchar(32) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -242,7 +242,7 @@ DROP TABLE IF EXISTS `t2`; CREATE TABLE `t2` ( `id` int(8) DEFAULT NULL, `name` varchar(32) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t2` DISABLE KEYS */; @@ -259,7 +259,7 @@ DROP TABLE IF EXISTS `t3`; CREATE TABLE `t3` ( `id` int(8) DEFAULT NULL, `name` varchar(32) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1; +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t3` DISABLE KEYS */; @@ -276,7 +276,7 @@ DROP TABLE IF EXISTS `t4`; CREATE TABLE `t4` ( `id` int(8) DEFAULT NULL, `name` varchar(32) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1; +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t4` DISABLE KEYS */; @@ -293,7 +293,7 @@ DROP TABLE IF EXISTS `t5`; CREATE TABLE `t5` ( `id` int(8) DEFAULT NULL, `name` varchar(32) DEFAULT NULL -) ENGINE=ARCHIVE DEFAULT CHARSET=latin1; +) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t5` DISABLE KEYS */; @@ -310,7 +310,7 @@ DROP TABLE IF EXISTS `t6`; CREATE TABLE `t6` ( `id` int(8) DEFAULT NULL, `name` varchar(32) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t6` DISABLE KEYS */; diff --git a/mysql-test/main/mysqldump-nl.result b/mysql-test/main/mysqldump-nl.result index d2d0e09546b1e..66902492934c9 100644 --- a/mysql-test/main/mysqldump-nl.result +++ b/mysql-test/main/mysqldump-nl.result @@ -22,7 +22,7 @@ use test; 1tsetlqsym`*/; CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1 -1tsetlqsym` /*!40100 DEFAULT CHARACTER SET latin1 */; +1tsetlqsym` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `mysqltest1 1tsetlqsym`; @@ -38,7 +38,7 @@ CREATE TABLE `t1 1t` ( `foobar raboof` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -53,25 +53,24 @@ raboof` int(11) DEFAULT NULL SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v1 -1v` ( - `foobar -raboof` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v1 +1v` AS SELECT + 1 AS `foobar +raboof` */; SET character_set_client = @saved_cs_client; -- -- Dumping routines for database 'mysqltest1 -- 1tsetlqsym' -- +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = latin1 */ ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sp`() select * from `v1 @@ -95,7 +94,7 @@ USE `mysqltest1 -- 1v` -- -/*!50001 DROP TABLE IF EXISTS `v1 +/*!50001 DROP VIEW IF EXISTS `v1 1v`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -142,7 +141,7 @@ test` /*!40000 DROP DATABASE IF EXISTS `test```*/; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test``` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test``` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `test```; @@ -158,7 +157,7 @@ USE `test```; CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test\`` \! ls -#` /*!40100 DEFAULT CHARACTER SET latin1 */; +#` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `test\`` \! ls diff --git a/mysql-test/main/mysqldump-no-binlog.result b/mysql-test/main/mysqldump-no-binlog.result index 78bc19b7cba66..223034d84017f 100644 --- a/mysql-test/main/mysqldump-no-binlog.result +++ b/mysql-test/main/mysqldump-no-binlog.result @@ -1 +1 @@ -mysqldump: Error: Binlogging on server not active +mariadb-dump: Error: Binlogging on server not active diff --git a/mysql-test/main/mysqldump-no-binlog.test b/mysql-test/main/mysqldump-no-binlog.test index 5f934bc440f7a..0d2b2e49ded8d 100644 --- a/mysql-test/main/mysqldump-no-binlog.test +++ b/mysql-test/main/mysqldump-no-binlog.test @@ -2,6 +2,6 @@ --source include/not_embedded.inc --replace_regex /MASTER_LOG_POS=[0-9]+/XX/ ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 2 --exec $MYSQL_DUMP --compact --master-data=2 test 2>&1 diff --git a/mysql-test/main/mysqldump-system,win.rdiff b/mysql-test/main/mysqldump-system,win.rdiff index a46b422e95fd8..57ce772a4523d 100644 --- a/mysql-test/main/mysqldump-system,win.rdiff +++ b/mysql-test/main/mysqldump-system,win.rdiff @@ -1,21 +1,26 @@ --- mysqldump-system.result +++ mysqldump-system,win.result -@@ -442,7 +442,7 @@ +@@ -449,9 +449,9 @@ + Table Checksum + mysql.roles_mapping 2510045525 mysql.time_zone_transition 3895294076 - mysql.plugin 0 - mysql.servers 2783974349 +-mysql.plugin 1587119305 ++mysql.plugin 2184891911 + mysql.servers 2079085450 -mysql.func 3241572444 +mysql.func 310494789 mysql.innodb_table_stats 347867921 mysql.table_stats 664320059 # Opps.... -@@ -477,7 +477,7 @@ +@@ -484,9 +484,9 @@ + Table Checksum + mysql.roles_mapping 2510045525 mysql.time_zone_transition 3895294076 - mysql.plugin 0 - mysql.servers 2783974349 +-mysql.plugin 1587119305 ++mysql.plugin 2184891911 + mysql.servers 2079085450 -mysql.func 3241572444 +mysql.func 310494789 mysql.innodb_table_stats 347867921 mysql.table_stats 664320059 DROP FUNCTION IF EXISTS metaphon; - diff --git a/mysql-test/main/mysqldump-system.result b/mysql-test/main/mysqldump-system.result index 3beaced5793df..559f6f29f44aa 100644 --- a/mysql-test/main/mysqldump-system.result +++ b/mysql-test/main/mysqldump-system.result @@ -1,3 +1,4 @@ +install soname 'auth_test_plugin'; # # MDEV-23630: mysqldump to logically dump system tables # @@ -9,28 +10,30 @@ insert into tables_priv select * from mysql.tables_priv; delete from mysql.global_priv where host not in ('localhost'); flush privileges; alter user 'mariadb.sys'@'localhost' ACCOUNT UNLOCK; -create user USER; +create user foobar IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; CREATE ROLE role_1; CREATE ROLE role_2 WITH ADMIN role_1; GRANT SHOW DATABASES ON *.* TO role_1; -GRANT role_1 TO USER; -GRANT role_2 TO USER; -SET DEFAULT ROLE role_2 FOR USER; +GRANT role_1 TO foobar; +GRANT role_2 TO foobar; +SET DEFAULT ROLE role_2 FOR foobar; ALTER TABLE mysql.roles_mapping ORDER BY Host, User, Role; set @save_innodb_stats_persistent= @@innodb_stats_persistent; create table mysql.tz like mysql.time_zone_transition; alter table mysql.tz engine=innodb; insert into mysql.tz select * from mysql.time_zone_transition; set global innodb_stats_persistent=1; +set time_zone="+03:00"; +SET TIMESTAMP= UNIX_TIMESTAMP('2022-01-07 07:07:00'); ANALYZE TABLE mysql.tz PERSISTENT FOR ALL; Table Op Msg_type Msg_text mysql.tz analyze status Engine-independent statistics collected mysql.tz analyze status OK delete from mysql.index_stats where prefix_arity!=1; delete from mysql.column_stats where column_name!='Time_zone_id'; -set time_zone="+03:00"; update mysql.innodb_index_stats set last_update="2020-01-01" where database_name="mysql" and table_name="tz"; update mysql.innodb_table_stats set last_update="2020-01-01" where database_name="mysql" and table_name="tz"; +update mysql.column_stats set histogram=json_replace(histogram, '$.collected_by', replace(json_value(histogram, '$.collected_by'), @@version, 'version')); set global innodb_stats_persistent= @save_innodb_stats_persistent; alter table mysql.time_zone_name ORDER BY Name; CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(Host 'localhost'); @@ -49,9 +52,11 @@ CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; /*!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 */; +INSTALL PLUGIN test_plugin_server SONAME 'AUTH_TEST_PLUGIN_LIB'; +INSTALL PLUGIN cleartext_plugin_server SONAME 'AUTH_TEST_PLUGIN_LIB'; CREATE USER `mariadb.sys`@`localhost` PASSWORD EXPIRE; CREATE USER `root`@`localhost`; -CREATE USER `USER`@`%`; +CREATE USER `foobar`@`%` IDENTIFIED VIA test_plugin_server USING 'plug_dest'; SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role; CREATE ROLE IF NOT EXISTS mariadb_dump_import_role; GRANT mariadb_dump_import_role TO CURRENT_USER(); @@ -71,11 +76,11 @@ GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION; GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION; /*M!100005 SET DEFAULT ROLE NONE FOR 'root'@'localhost' */; /*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */; -GRANT `role_1` TO `USER`@`%`; -GRANT `role_2` TO `USER`@`%`; -GRANT USAGE ON *.* TO `USER`@`%`; -/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */; -/*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */; +GRANT `role_1` TO `foobar`@`%`; +GRANT `role_2` TO `foobar`@`%`; +GRANT USAGE ON *.* TO `foobar`@`%` IDENTIFIED VIA test_plugin_server USING 'plug_dest'; +/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'foobar'@'%' */; +/*!80001 ALTER USER 'foobar'@'%' DEFAULT ROLE 'role_2' */; GRANT `role_2` TO `role_1` WITH ADMIN OPTION; GRANT SHOW DATABASES ON *.* TO `role_1`; GRANT USAGE ON *.* TO `role_2`; @@ -90,31 +95,39 @@ USE mysql; LOCK TABLES `column_stats` WRITE; /*!40000 ALTER TABLE `column_stats` DISABLE KEYS */; -REPLACE INTO `column_stats` VALUES ('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,254,'DOUBLE_PREC_HB','\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0������������������������������������������������������������������������������������������������������������������������������'); +REPLACE INTO `column_stats` VALUES +('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,4,'JSON_HB','{\"target_histogram_size\": 254, \"collected_at\": \"2022-01-07 07:07:00\", \"collected_by\": \"version\", \"histogram_hb\": [{\"start\": \"1\", \"size\": 0.340966921, \"ndv\": 1}, {\"start\": \"3\", \"size\": 0.328244275, \"ndv\": 1}, {\"start\": \"4\", \"size\": 0.328244275, \"ndv\": 1}, {\"start\": \"5\", \"end\": \"5\", \"size\": 0.002544529, \"ndv\": 1}]}'); /*!40000 ALTER TABLE `column_stats` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `index_stats` WRITE; /*!40000 ALTER TABLE `index_stats` DISABLE KEYS */; -REPLACE INTO `index_stats` VALUES ('mysql','tz','PRIMARY',1,98.2500); +REPLACE INTO `index_stats` VALUES +('mysql','tz','PRIMARY',1,98.2500); /*!40000 ALTER TABLE `index_stats` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `table_stats` WRITE; /*!40000 ALTER TABLE `table_stats` DISABLE KEYS */; -REPLACE INTO `table_stats` VALUES ('mysql','tz',393); +REPLACE INTO `table_stats` VALUES +('mysql','tz',393); /*!40000 ALTER TABLE `table_stats` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `innodb_index_stats` WRITE; /*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */; -REPLACE INTO `innodb_index_stats` VALUES ('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index'); +REPLACE INTO `innodb_index_stats` VALUES +('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'), +('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'), +('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'), +('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index'); /*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `innodb_table_stats` WRITE; /*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */; -REPLACE INTO `innodb_table_stats` VALUES ('mysql','tz','2019-12-31 21:00:00',393,1,0); +REPLACE INTO `innodb_table_stats` VALUES +('mysql','tz','2019-12-31 21:00:00',393,1,0); /*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */; UNLOCK TABLES; @@ -122,31 +135,488 @@ USE mysql; LOCK TABLES `time_zone` WRITE; /*!40000 ALTER TABLE `time_zone` DISABLE KEYS */; -REPLACE INTO `time_zone` VALUES (1,'N'),(2,'N'),(3,'N'),(4,'Y'),(5,'N'); +REPLACE INTO `time_zone` VALUES +(1,'N'), +(2,'N'), +(3,'N'), +(4,'Y'), +(5,'N'); /*!40000 ALTER TABLE `time_zone` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `time_zone_name` WRITE; /*!40000 ALTER TABLE `time_zone_name` DISABLE KEYS */; -REPLACE INTO `time_zone_name` VALUES ('Europe/Moscow',3),('Japan',5),('leap/Europe/Moscow',4),('MET',1),('Universal',2),('UTC',2); +REPLACE INTO `time_zone_name` VALUES +('Europe/Moscow',3), +('Japan',5), +('leap/Europe/Moscow',4), +('MET',1), +('Universal',2), +('UTC',2); /*!40000 ALTER TABLE `time_zone_name` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `time_zone_leap_second` WRITE; /*!40000 ALTER TABLE `time_zone_leap_second` DISABLE KEYS */; -REPLACE INTO `time_zone_leap_second` VALUES (78796800,1),(94694401,2),(126230402,3),(157766403,4),(189302404,5),(220924805,6),(252460806,7),(283996807,8),(315532808,9),(362793609,10),(394329610,11),(425865611,12),(489024012,13),(567993613,14),(631152014,15),(662688015,16),(709948816,17),(741484817,18),(773020818,19),(820454419,20),(867715220,21),(915148821,22); +REPLACE INTO `time_zone_leap_second` VALUES +(78796800,1), +(94694401,2), +(126230402,3), +(157766403,4), +(189302404,5), +(220924805,6), +(252460806,7), +(283996807,8), +(315532808,9), +(362793609,10), +(394329610,11), +(425865611,12), +(489024012,13), +(567993613,14), +(631152014,15), +(662688015,16), +(709948816,17), +(741484817,18), +(773020818,19), +(820454419,20), +(867715220,21), +(915148821,22); /*!40000 ALTER TABLE `time_zone_leap_second` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `time_zone_transition` WRITE; /*!40000 ALTER TABLE `time_zone_transition` DISABLE KEYS */; -REPLACE INTO `time_zone_transition` VALUES (1,-1693706400,0),(1,-1680483600,1),(1,-1663455600,2),(1,-1650150000,3),(1,-1632006000,2),(1,-1618700400,3),(1,-938905200,2),(1,-857257200,3),(1,-844556400,2),(1,-828226800,3),(1,-812502000,2),(1,-796777200,3),(1,228877200,2),(1,243997200,3),(1,260326800,2),(1,276051600,3),(1,291776400,2),(1,307501200,3),(1,323830800,2),(1,338950800,3),(1,354675600,2),(1,370400400,3),(1,386125200,2),(1,401850000,3),(1,417574800,2),(1,433299600,3),(1,449024400,2),(1,465354000,3),(1,481078800,2),(1,496803600,3),(1,512528400,2),(1,528253200,3),(1,543978000,2),(1,559702800,3),(1,575427600,2),(1,591152400,3),(1,606877200,2),(1,622602000,3),(1,638326800,2),(1,654656400,3),(1,670381200,2),(1,686106000,3),(1,701830800,2),(1,717555600,3),(1,733280400,2),(1,749005200,3),(1,764730000,2),(1,780454800,3),(1,796179600,2),(1,811904400,3),(1,828234000,2),(1,846378000,3),(1,859683600,2),(1,877827600,3),(1,891133200,2),(1,909277200,3),(1,922582800,2),(1,941331600,3),(1,954032400,2),(1,972781200,3),(1,985482000,2),(1,1004230800,3),(1,1017536400,2),(1,1035680400,3),(1,1048986000,2),(1,1067130000,3),(1,1080435600,2),(1,1099184400,3),(1,1111885200,2),(1,1130634000,3),(1,1143334800,2),(1,1162083600,3),(1,1174784400,2),(1,1193533200,3),(1,1206838800,2),(1,1224982800,3),(1,1238288400,2),(1,1256432400,3),(1,1269738000,2),(1,1288486800,3),(1,1301187600,2),(1,1319936400,3),(1,1332637200,2),(1,1351386000,3),(1,1364691600,2),(1,1382835600,3),(1,1396141200,2),(1,1414285200,3),(1,1427590800,2),(1,1445734800,3),(1,1459040400,2),(1,1477789200,3),(1,1490490000,2),(1,1509238800,3),(1,1521939600,2),(1,1540688400,3),(1,1553994000,2),(1,1572138000,3),(1,1585443600,2),(1,1603587600,3),(1,1616893200,2),(1,1635642000,3),(1,1648342800,2),(1,1667091600,3),(1,1679792400,2),(1,1698541200,3),(1,1711846800,2),(1,1729990800,3),(1,1743296400,2),(1,1761440400,3),(1,1774746000,2),(1,1792890000,3),(1,1806195600,2),(1,1824944400,3),(1,1837645200,2),(1,1856394000,3),(1,1869094800,2),(1,1887843600,3),(1,1901149200,2),(1,1919293200,3),(1,1932598800,2),(1,1950742800,3),(1,1964048400,2),(1,1982797200,3),(1,1995498000,2),(1,2014246800,3),(1,2026947600,2),(1,2045696400,3),(1,2058397200,2),(1,2077146000,3),(1,2090451600,2),(1,2108595600,3),(1,2121901200,2),(1,2140045200,3),(3,-1688265000,2),(3,-1656819048,1),(3,-1641353448,2),(3,-1627965048,3),(3,-1618716648,1),(3,-1596429048,3),(3,-1593829848,5),(3,-1589860800,4),(3,-1542427200,5),(3,-1539493200,6),(3,-1525323600,5),(3,-1522728000,4),(3,-1491188400,7),(3,-1247536800,4),(3,354920400,5),(3,370728000,4),(3,386456400,5),(3,402264000,4),(3,417992400,5),(3,433800000,4),(3,449614800,5),(3,465346800,8),(3,481071600,9),(3,496796400,8),(3,512521200,9),(3,528246000,8),(3,543970800,9),(3,559695600,8),(3,575420400,9),(3,591145200,8),(3,606870000,9),(3,622594800,8),(3,638319600,9),(3,654649200,8),(3,670374000,10),(3,686102400,11),(3,695779200,8),(3,701812800,5),(3,717534000,4),(3,733273200,9),(3,748998000,8),(3,764722800,9),(3,780447600,8),(3,796172400,9),(3,811897200,8),(3,828226800,9),(3,846370800,8),(3,859676400,9),(3,877820400,8),(3,891126000,9),(3,909270000,8),(3,922575600,9),(3,941324400,8),(3,954025200,9),(3,972774000,8),(3,985474800,9),(3,1004223600,8),(3,1017529200,9),(3,1035673200,8),(3,1048978800,9),(3,1067122800,8),(3,1080428400,9),(3,1099177200,8),(3,1111878000,9),(3,1130626800,8),(3,1143327600,9),(3,1162076400,8),(3,1174777200,9),(3,1193526000,8),(3,1206831600,9),(3,1224975600,8),(3,1238281200,9),(3,1256425200,8),(3,1269730800,9),(3,1288479600,8),(3,1301180400,9),(3,1319929200,8),(3,1332630000,9),(3,1351378800,8),(3,1364684400,9),(3,1382828400,8),(3,1396134000,9),(3,1414278000,8),(3,1427583600,9),(3,1445727600,8),(3,1459033200,9),(3,1477782000,8),(3,1490482800,9),(3,1509231600,8),(3,1521932400,9),(3,1540681200,8),(3,1553986800,9),(3,1572130800,8),(3,1585436400,9),(3,1603580400,8),(3,1616886000,9),(3,1635634800,8),(3,1648335600,9),(3,1667084400,8),(3,1679785200,9),(3,1698534000,8),(3,1711839600,9),(3,1729983600,8),(3,1743289200,9),(3,1761433200,8),(3,1774738800,9),(3,1792882800,8),(3,1806188400,9),(3,1824937200,8),(3,1837638000,9),(3,1856386800,8),(3,1869087600,9),(3,1887836400,8),(3,1901142000,9),(3,1919286000,8),(3,1932591600,9),(3,1950735600,8),(3,1964041200,9),(3,1982790000,8),(3,1995490800,9),(3,2014239600,8),(3,2026940400,9),(3,2045689200,8),(3,2058390000,9),(3,2077138800,8),(3,2090444400,9),(3,2108588400,8),(3,2121894000,9),(3,2140038000,8),(4,-1688265000,2),(4,-1656819048,1),(4,-1641353448,2),(4,-1627965048,3),(4,-1618716648,1),(4,-1596429048,3),(4,-1593829848,5),(4,-1589860800,4),(4,-1542427200,5),(4,-1539493200,6),(4,-1525323600,5),(4,-1522728000,4),(4,-1491188400,7),(4,-1247536800,4),(4,354920409,5),(4,370728010,4),(4,386456410,5),(4,402264011,4),(4,417992411,5),(4,433800012,4),(4,449614812,5),(4,465346812,8),(4,481071612,9),(4,496796413,8),(4,512521213,9),(4,528246013,8),(4,543970813,9),(4,559695613,8),(4,575420414,9),(4,591145214,8),(4,606870014,9),(4,622594814,8),(4,638319615,9),(4,654649215,8),(4,670374016,10),(4,686102416,11),(4,695779216,8),(4,701812816,5),(4,717534017,4),(4,733273217,9),(4,748998018,8),(4,764722818,9),(4,780447619,8),(4,796172419,9),(4,811897219,8),(4,828226820,9),(4,846370820,8),(4,859676420,9),(4,877820421,8),(4,891126021,9),(4,909270021,8),(4,922575622,9),(4,941324422,8),(4,954025222,9),(4,972774022,8),(4,985474822,9),(4,1004223622,8),(4,1017529222,9),(4,1035673222,8),(4,1048978822,9),(4,1067122822,8),(4,1080428422,9),(4,1099177222,8),(4,1111878022,9),(4,1130626822,8),(4,1143327622,9),(4,1162076422,8),(4,1174777222,9),(4,1193526022,8),(4,1206831622,9),(4,1224975622,8),(4,1238281222,9),(4,1256425222,8),(4,1269730822,9),(4,1288479622,8),(4,1301180422,9),(4,1319929222,8),(4,1332630022,9),(4,1351378822,8),(4,1364684422,9),(4,1382828422,8),(4,1396134022,9),(4,1414278022,8),(4,1427583622,9),(4,1445727622,8),(4,1459033222,9),(4,1477782022,8),(4,1490482822,9),(4,1509231622,8),(4,1521932422,9),(4,1540681222,8),(4,1553986822,9),(4,1572130822,8),(4,1585436422,9),(4,1603580422,8),(4,1616886022,9),(4,1635634822,8),(4,1648335622,9),(4,1667084422,8),(4,1679785222,9),(4,1698534022,8),(4,1711839622,9),(4,1729983622,8),(4,1743289222,9),(4,1761433222,8),(4,1774738822,9),(4,1792882822,8),(4,1806188422,9),(4,1824937222,8),(4,1837638022,9),(4,1856386822,8),(4,1869087622,9),(4,1887836422,8),(4,1901142022,9),(4,1919286022,8),(4,1932591622,9),(4,1950735622,8),(4,1964041222,9),(4,1982790022,8),(4,1995490822,9),(4,2014239622,8),(4,2026940422,9),(4,2045689222,8),(4,2058390022,9),(4,2077138822,8),(4,2090444422,9),(4,2108588422,8),(4,2121894022,9),(4,2140038022,8),(5,-1009875600,1); +REPLACE INTO `time_zone_transition` VALUES +(1,-1693706400,0), +(1,-1680483600,1), +(1,-1663455600,2), +(1,-1650150000,3), +(1,-1632006000,2), +(1,-1618700400,3), +(1,-938905200,2), +(1,-857257200,3), +(1,-844556400,2), +(1,-828226800,3), +(1,-812502000,2), +(1,-796777200,3), +(1,228877200,2), +(1,243997200,3), +(1,260326800,2), +(1,276051600,3), +(1,291776400,2), +(1,307501200,3), +(1,323830800,2), +(1,338950800,3), +(1,354675600,2), +(1,370400400,3), +(1,386125200,2), +(1,401850000,3), +(1,417574800,2), +(1,433299600,3), +(1,449024400,2), +(1,465354000,3), +(1,481078800,2), +(1,496803600,3), +(1,512528400,2), +(1,528253200,3), +(1,543978000,2), +(1,559702800,3), +(1,575427600,2), +(1,591152400,3), +(1,606877200,2), +(1,622602000,3), +(1,638326800,2), +(1,654656400,3), +(1,670381200,2), +(1,686106000,3), +(1,701830800,2), +(1,717555600,3), +(1,733280400,2), +(1,749005200,3), +(1,764730000,2), +(1,780454800,3), +(1,796179600,2), +(1,811904400,3), +(1,828234000,2), +(1,846378000,3), +(1,859683600,2), +(1,877827600,3), +(1,891133200,2), +(1,909277200,3), +(1,922582800,2), +(1,941331600,3), +(1,954032400,2), +(1,972781200,3), +(1,985482000,2), +(1,1004230800,3), +(1,1017536400,2), +(1,1035680400,3), +(1,1048986000,2), +(1,1067130000,3), +(1,1080435600,2), +(1,1099184400,3), +(1,1111885200,2), +(1,1130634000,3), +(1,1143334800,2), +(1,1162083600,3), +(1,1174784400,2), +(1,1193533200,3), +(1,1206838800,2), +(1,1224982800,3), +(1,1238288400,2), +(1,1256432400,3), +(1,1269738000,2), +(1,1288486800,3), +(1,1301187600,2), +(1,1319936400,3), +(1,1332637200,2), +(1,1351386000,3), +(1,1364691600,2), +(1,1382835600,3), +(1,1396141200,2), +(1,1414285200,3), +(1,1427590800,2), +(1,1445734800,3), +(1,1459040400,2), +(1,1477789200,3), +(1,1490490000,2), +(1,1509238800,3), +(1,1521939600,2), +(1,1540688400,3), +(1,1553994000,2), +(1,1572138000,3), +(1,1585443600,2), +(1,1603587600,3), +(1,1616893200,2), +(1,1635642000,3), +(1,1648342800,2), +(1,1667091600,3), +(1,1679792400,2), +(1,1698541200,3), +(1,1711846800,2), +(1,1729990800,3), +(1,1743296400,2), +(1,1761440400,3), +(1,1774746000,2), +(1,1792890000,3), +(1,1806195600,2), +(1,1824944400,3), +(1,1837645200,2), +(1,1856394000,3), +(1,1869094800,2), +(1,1887843600,3), +(1,1901149200,2), +(1,1919293200,3), +(1,1932598800,2), +(1,1950742800,3), +(1,1964048400,2), +(1,1982797200,3), +(1,1995498000,2), +(1,2014246800,3), +(1,2026947600,2), +(1,2045696400,3), +(1,2058397200,2), +(1,2077146000,3), +(1,2090451600,2), +(1,2108595600,3), +(1,2121901200,2), +(1,2140045200,3), +(3,-1688265000,2), +(3,-1656819048,1), +(3,-1641353448,2), +(3,-1627965048,3), +(3,-1618716648,1), +(3,-1596429048,3), +(3,-1593829848,5), +(3,-1589860800,4), +(3,-1542427200,5), +(3,-1539493200,6), +(3,-1525323600,5), +(3,-1522728000,4), +(3,-1491188400,7), +(3,-1247536800,4), +(3,354920400,5), +(3,370728000,4), +(3,386456400,5), +(3,402264000,4), +(3,417992400,5), +(3,433800000,4), +(3,449614800,5), +(3,465346800,8), +(3,481071600,9), +(3,496796400,8), +(3,512521200,9), +(3,528246000,8), +(3,543970800,9), +(3,559695600,8), +(3,575420400,9), +(3,591145200,8), +(3,606870000,9), +(3,622594800,8), +(3,638319600,9), +(3,654649200,8), +(3,670374000,10), +(3,686102400,11), +(3,695779200,8), +(3,701812800,5), +(3,717534000,4), +(3,733273200,9), +(3,748998000,8), +(3,764722800,9), +(3,780447600,8), +(3,796172400,9), +(3,811897200,8), +(3,828226800,9), +(3,846370800,8), +(3,859676400,9), +(3,877820400,8), +(3,891126000,9), +(3,909270000,8), +(3,922575600,9), +(3,941324400,8), +(3,954025200,9), +(3,972774000,8), +(3,985474800,9), +(3,1004223600,8), +(3,1017529200,9), +(3,1035673200,8), +(3,1048978800,9), +(3,1067122800,8), +(3,1080428400,9), +(3,1099177200,8), +(3,1111878000,9), +(3,1130626800,8), +(3,1143327600,9), +(3,1162076400,8), +(3,1174777200,9), +(3,1193526000,8), +(3,1206831600,9), +(3,1224975600,8), +(3,1238281200,9), +(3,1256425200,8), +(3,1269730800,9), +(3,1288479600,8), +(3,1301180400,9), +(3,1319929200,8), +(3,1332630000,9), +(3,1351378800,8), +(3,1364684400,9), +(3,1382828400,8), +(3,1396134000,9), +(3,1414278000,8), +(3,1427583600,9), +(3,1445727600,8), +(3,1459033200,9), +(3,1477782000,8), +(3,1490482800,9), +(3,1509231600,8), +(3,1521932400,9), +(3,1540681200,8), +(3,1553986800,9), +(3,1572130800,8), +(3,1585436400,9), +(3,1603580400,8), +(3,1616886000,9), +(3,1635634800,8), +(3,1648335600,9), +(3,1667084400,8), +(3,1679785200,9), +(3,1698534000,8), +(3,1711839600,9), +(3,1729983600,8), +(3,1743289200,9), +(3,1761433200,8), +(3,1774738800,9), +(3,1792882800,8), +(3,1806188400,9), +(3,1824937200,8), +(3,1837638000,9), +(3,1856386800,8), +(3,1869087600,9), +(3,1887836400,8), +(3,1901142000,9), +(3,1919286000,8), +(3,1932591600,9), +(3,1950735600,8), +(3,1964041200,9), +(3,1982790000,8), +(3,1995490800,9), +(3,2014239600,8), +(3,2026940400,9), +(3,2045689200,8), +(3,2058390000,9), +(3,2077138800,8), +(3,2090444400,9), +(3,2108588400,8), +(3,2121894000,9), +(3,2140038000,8), +(4,-1688265000,2), +(4,-1656819048,1), +(4,-1641353448,2), +(4,-1627965048,3), +(4,-1618716648,1), +(4,-1596429048,3), +(4,-1593829848,5), +(4,-1589860800,4), +(4,-1542427200,5), +(4,-1539493200,6), +(4,-1525323600,5), +(4,-1522728000,4), +(4,-1491188400,7), +(4,-1247536800,4), +(4,354920409,5), +(4,370728010,4), +(4,386456410,5), +(4,402264011,4), +(4,417992411,5), +(4,433800012,4), +(4,449614812,5), +(4,465346812,8), +(4,481071612,9), +(4,496796413,8), +(4,512521213,9), +(4,528246013,8), +(4,543970813,9), +(4,559695613,8), +(4,575420414,9), +(4,591145214,8), +(4,606870014,9), +(4,622594814,8), +(4,638319615,9), +(4,654649215,8), +(4,670374016,10), +(4,686102416,11), +(4,695779216,8), +(4,701812816,5), +(4,717534017,4), +(4,733273217,9), +(4,748998018,8), +(4,764722818,9), +(4,780447619,8), +(4,796172419,9), +(4,811897219,8), +(4,828226820,9), +(4,846370820,8), +(4,859676420,9), +(4,877820421,8), +(4,891126021,9), +(4,909270021,8), +(4,922575622,9), +(4,941324422,8), +(4,954025222,9), +(4,972774022,8), +(4,985474822,9), +(4,1004223622,8), +(4,1017529222,9), +(4,1035673222,8), +(4,1048978822,9), +(4,1067122822,8), +(4,1080428422,9), +(4,1099177222,8), +(4,1111878022,9), +(4,1130626822,8), +(4,1143327622,9), +(4,1162076422,8), +(4,1174777222,9), +(4,1193526022,8), +(4,1206831622,9), +(4,1224975622,8), +(4,1238281222,9), +(4,1256425222,8), +(4,1269730822,9), +(4,1288479622,8), +(4,1301180422,9), +(4,1319929222,8), +(4,1332630022,9), +(4,1351378822,8), +(4,1364684422,9), +(4,1382828422,8), +(4,1396134022,9), +(4,1414278022,8), +(4,1427583622,9), +(4,1445727622,8), +(4,1459033222,9), +(4,1477782022,8), +(4,1490482822,9), +(4,1509231622,8), +(4,1521932422,9), +(4,1540681222,8), +(4,1553986822,9), +(4,1572130822,8), +(4,1585436422,9), +(4,1603580422,8), +(4,1616886022,9), +(4,1635634822,8), +(4,1648335622,9), +(4,1667084422,8), +(4,1679785222,9), +(4,1698534022,8), +(4,1711839622,9), +(4,1729983622,8), +(4,1743289222,9), +(4,1761433222,8), +(4,1774738822,9), +(4,1792882822,8), +(4,1806188422,9), +(4,1824937222,8), +(4,1837638022,9), +(4,1856386822,8), +(4,1869087622,9), +(4,1887836422,8), +(4,1901142022,9), +(4,1919286022,8), +(4,1932591622,9), +(4,1950735622,8), +(4,1964041222,9), +(4,1982790022,8), +(4,1995490822,9), +(4,2014239622,8), +(4,2026940422,9), +(4,2045689222,8), +(4,2058390022,9), +(4,2077138822,8), +(4,2090444422,9), +(4,2108588422,8), +(4,2121894022,9), +(4,2140038022,8), +(5,-1009875600,1); /*!40000 ALTER TABLE `time_zone_transition` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `time_zone_transition_type` WRITE; /*!40000 ALTER TABLE `time_zone_transition_type` DISABLE KEYS */; -REPLACE INTO `time_zone_transition_type` VALUES (1,0,7200,1,'MEST'),(1,1,3600,0,'MET'),(1,2,7200,1,'MEST'),(1,3,3600,0,'MET'),(2,0,0,0,'UTC'),(3,0,9000,0,'MMT'),(3,1,12648,1,'MST'),(3,2,9048,0,'MMT'),(3,3,16248,1,'MDST'),(3,4,10800,0,'MSK'),(3,5,14400,1,'MSD'),(3,6,18000,1,'MSD'),(3,7,7200,0,'EET'),(3,8,10800,0,'MSK'),(3,9,14400,1,'MSD'),(3,10,10800,1,'EEST'),(3,11,7200,0,'EET'),(4,0,9000,0,'MMT'),(4,1,12648,1,'MST'),(4,2,9048,0,'MMT'),(4,3,16248,1,'MDST'),(4,4,10800,0,'MSK'),(4,5,14400,1,'MSD'),(4,6,18000,1,'MSD'),(4,7,7200,0,'EET'),(4,8,10800,0,'MSK'),(4,9,14400,1,'MSD'),(4,10,10800,1,'EEST'),(4,11,7200,0,'EET'),(5,0,32400,0,'CJT'),(5,1,32400,0,'JST'); +REPLACE INTO `time_zone_transition_type` VALUES +(1,0,7200,1,'MEST'), +(1,1,3600,0,'MET'), +(1,2,7200,1,'MEST'), +(1,3,3600,0,'MET'), +(2,0,0,0,'UTC'), +(3,0,9000,0,'MMT'), +(3,1,12648,1,'MST'), +(3,2,9048,0,'MMT'), +(3,3,16248,1,'MDST'), +(3,4,10800,0,'MSK'), +(3,5,14400,1,'MSD'), +(3,6,18000,1,'MSD'), +(3,7,7200,0,'EET'), +(3,8,10800,0,'MSK'), +(3,9,14400,1,'MSD'), +(3,10,10800,1,'EEST'), +(3,11,7200,0,'EET'), +(4,0,9000,0,'MMT'), +(4,1,12648,1,'MST'), +(4,2,9048,0,'MMT'), +(4,3,16248,1,'MDST'), +(4,4,10800,0,'MSK'), +(4,5,14400,1,'MSD'), +(4,6,18000,1,'MSD'), +(4,7,7200,0,'EET'), +(4,8,10800,0,'MSK'), +(4,9,14400,1,'MSD'), +(4,10,10800,1,'EEST'), +(4,11,7200,0,'EET'), +(5,0,32400,0,'CJT'), +(5,1,32400,0,'JST'); /*!40000 ALTER TABLE `time_zone_transition_type` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -173,6 +643,10 @@ UNLOCK TABLES; /*!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 */; +/*M!100401 UNINSTALL PLUGIN IF EXIST test_plugin_server */; +INSTALL PLUGIN test_plugin_server SONAME 'AUTH_TEST_PLUGIN_LIB'; +/*M!100401 UNINSTALL PLUGIN IF EXIST cleartext_plugin_server */; +INSTALL PLUGIN cleartext_plugin_server SONAME 'AUTH_TEST_PLUGIN_LIB'; DELIMITER | /*M!100101 IF current_user()="'mariadb.sys'@'localhost'" THEN SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'mariadb.sys'@'localhost''"; @@ -188,12 +662,12 @@ DELIMITER ; /*!50701 DROP USER IF EXISTS 'root'@'localhost' */; CREATE /*M!100103 OR REPLACE */ USER `root`@`localhost`; DELIMITER | -/*M!100101 IF current_user()="'USER'@'%'" THEN - SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'USER'@'%''"; +/*M!100101 IF current_user()="'foobar'@'%'" THEN + SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'foobar'@'%''"; END IF */| DELIMITER ; -/*!50701 DROP USER IF EXISTS 'USER'@'%' */; -CREATE /*M!100103 OR REPLACE */ USER `USER`@`%`; +/*!50701 DROP USER IF EXISTS 'foobar'@'%' */; +CREATE /*M!100103 OR REPLACE */ USER `foobar`@`%` IDENTIFIED VIA test_plugin_server USING 'plug_dest'; SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role; CREATE ROLE IF NOT EXISTS mariadb_dump_import_role; GRANT mariadb_dump_import_role TO CURRENT_USER(); @@ -215,11 +689,11 @@ GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION; GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION; /*M!100005 SET DEFAULT ROLE NONE FOR 'root'@'localhost' */; /*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */; -GRANT `role_1` TO `USER`@`%`; -GRANT `role_2` TO `USER`@`%`; -GRANT USAGE ON *.* TO `USER`@`%`; -/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */; -/*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */; +GRANT `role_1` TO `foobar`@`%`; +GRANT `role_2` TO `foobar`@`%`; +GRANT USAGE ON *.* TO `foobar`@`%` IDENTIFIED VIA test_plugin_server USING 'plug_dest'; +/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'foobar'@'%' */; +/*!80001 ALTER USER 'foobar'@'%' DEFAULT ROLE 'role_2' */; GRANT `role_2` TO `role_1` WITH ADMIN OPTION; GRANT SHOW DATABASES ON *.* TO `role_1`; GRANT USAGE ON *.* TO `role_2`; @@ -235,31 +709,39 @@ USE mysql; LOCK TABLES `column_stats` WRITE; /*!40000 ALTER TABLE `column_stats` DISABLE KEYS */; -REPLACE INTO `column_stats` VALUES ('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,254,'DOUBLE_PREC_HB','\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0������������������������������������������������������������������������������������������������������������������������������'); +REPLACE INTO `column_stats` VALUES +('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,4,'JSON_HB','{\"target_histogram_size\": 254, \"collected_at\": \"2022-01-07 07:07:00\", \"collected_by\": \"version\", \"histogram_hb\": [{\"start\": \"1\", \"size\": 0.340966921, \"ndv\": 1}, {\"start\": \"3\", \"size\": 0.328244275, \"ndv\": 1}, {\"start\": \"4\", \"size\": 0.328244275, \"ndv\": 1}, {\"start\": \"5\", \"end\": \"5\", \"size\": 0.002544529, \"ndv\": 1}]}'); /*!40000 ALTER TABLE `column_stats` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `index_stats` WRITE; /*!40000 ALTER TABLE `index_stats` DISABLE KEYS */; -REPLACE INTO `index_stats` VALUES ('mysql','tz','PRIMARY',1,98.2500); +REPLACE INTO `index_stats` VALUES +('mysql','tz','PRIMARY',1,98.2500); /*!40000 ALTER TABLE `index_stats` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `table_stats` WRITE; /*!40000 ALTER TABLE `table_stats` DISABLE KEYS */; -REPLACE INTO `table_stats` VALUES ('mysql','tz',393); +REPLACE INTO `table_stats` VALUES +('mysql','tz',393); /*!40000 ALTER TABLE `table_stats` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `innodb_index_stats` WRITE; /*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */; -REPLACE INTO `innodb_index_stats` VALUES ('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index'); +REPLACE INTO `innodb_index_stats` VALUES +('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'), +('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'), +('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'), +('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index'); /*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `innodb_table_stats` WRITE; /*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */; -REPLACE INTO `innodb_table_stats` VALUES ('mysql','tz','2019-12-31 21:00:00',393,1,0); +REPLACE INTO `innodb_table_stats` VALUES +('mysql','tz','2019-12-31 21:00:00',393,1,0); /*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */; UNLOCK TABLES; @@ -267,31 +749,488 @@ USE mysql; LOCK TABLES `time_zone` WRITE; /*!40000 ALTER TABLE `time_zone` DISABLE KEYS */; -REPLACE INTO `time_zone` VALUES (1,'N'),(2,'N'),(3,'N'),(4,'Y'),(5,'N'); +REPLACE INTO `time_zone` VALUES +(1,'N'), +(2,'N'), +(3,'N'), +(4,'Y'), +(5,'N'); /*!40000 ALTER TABLE `time_zone` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `time_zone_name` WRITE; /*!40000 ALTER TABLE `time_zone_name` DISABLE KEYS */; -REPLACE INTO `time_zone_name` VALUES ('Europe/Moscow',3),('Japan',5),('leap/Europe/Moscow',4),('MET',1),('Universal',2),('UTC',2); +REPLACE INTO `time_zone_name` VALUES +('Europe/Moscow',3), +('Japan',5), +('leap/Europe/Moscow',4), +('MET',1), +('Universal',2), +('UTC',2); /*!40000 ALTER TABLE `time_zone_name` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `time_zone_leap_second` WRITE; /*!40000 ALTER TABLE `time_zone_leap_second` DISABLE KEYS */; -REPLACE INTO `time_zone_leap_second` VALUES (78796800,1),(94694401,2),(126230402,3),(157766403,4),(189302404,5),(220924805,6),(252460806,7),(283996807,8),(315532808,9),(362793609,10),(394329610,11),(425865611,12),(489024012,13),(567993613,14),(631152014,15),(662688015,16),(709948816,17),(741484817,18),(773020818,19),(820454419,20),(867715220,21),(915148821,22); +REPLACE INTO `time_zone_leap_second` VALUES +(78796800,1), +(94694401,2), +(126230402,3), +(157766403,4), +(189302404,5), +(220924805,6), +(252460806,7), +(283996807,8), +(315532808,9), +(362793609,10), +(394329610,11), +(425865611,12), +(489024012,13), +(567993613,14), +(631152014,15), +(662688015,16), +(709948816,17), +(741484817,18), +(773020818,19), +(820454419,20), +(867715220,21), +(915148821,22); /*!40000 ALTER TABLE `time_zone_leap_second` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `time_zone_transition` WRITE; /*!40000 ALTER TABLE `time_zone_transition` DISABLE KEYS */; -REPLACE INTO `time_zone_transition` VALUES (1,-1693706400,0),(1,-1680483600,1),(1,-1663455600,2),(1,-1650150000,3),(1,-1632006000,2),(1,-1618700400,3),(1,-938905200,2),(1,-857257200,3),(1,-844556400,2),(1,-828226800,3),(1,-812502000,2),(1,-796777200,3),(1,228877200,2),(1,243997200,3),(1,260326800,2),(1,276051600,3),(1,291776400,2),(1,307501200,3),(1,323830800,2),(1,338950800,3),(1,354675600,2),(1,370400400,3),(1,386125200,2),(1,401850000,3),(1,417574800,2),(1,433299600,3),(1,449024400,2),(1,465354000,3),(1,481078800,2),(1,496803600,3),(1,512528400,2),(1,528253200,3),(1,543978000,2),(1,559702800,3),(1,575427600,2),(1,591152400,3),(1,606877200,2),(1,622602000,3),(1,638326800,2),(1,654656400,3),(1,670381200,2),(1,686106000,3),(1,701830800,2),(1,717555600,3),(1,733280400,2),(1,749005200,3),(1,764730000,2),(1,780454800,3),(1,796179600,2),(1,811904400,3),(1,828234000,2),(1,846378000,3),(1,859683600,2),(1,877827600,3),(1,891133200,2),(1,909277200,3),(1,922582800,2),(1,941331600,3),(1,954032400,2),(1,972781200,3),(1,985482000,2),(1,1004230800,3),(1,1017536400,2),(1,1035680400,3),(1,1048986000,2),(1,1067130000,3),(1,1080435600,2),(1,1099184400,3),(1,1111885200,2),(1,1130634000,3),(1,1143334800,2),(1,1162083600,3),(1,1174784400,2),(1,1193533200,3),(1,1206838800,2),(1,1224982800,3),(1,1238288400,2),(1,1256432400,3),(1,1269738000,2),(1,1288486800,3),(1,1301187600,2),(1,1319936400,3),(1,1332637200,2),(1,1351386000,3),(1,1364691600,2),(1,1382835600,3),(1,1396141200,2),(1,1414285200,3),(1,1427590800,2),(1,1445734800,3),(1,1459040400,2),(1,1477789200,3),(1,1490490000,2),(1,1509238800,3),(1,1521939600,2),(1,1540688400,3),(1,1553994000,2),(1,1572138000,3),(1,1585443600,2),(1,1603587600,3),(1,1616893200,2),(1,1635642000,3),(1,1648342800,2),(1,1667091600,3),(1,1679792400,2),(1,1698541200,3),(1,1711846800,2),(1,1729990800,3),(1,1743296400,2),(1,1761440400,3),(1,1774746000,2),(1,1792890000,3),(1,1806195600,2),(1,1824944400,3),(1,1837645200,2),(1,1856394000,3),(1,1869094800,2),(1,1887843600,3),(1,1901149200,2),(1,1919293200,3),(1,1932598800,2),(1,1950742800,3),(1,1964048400,2),(1,1982797200,3),(1,1995498000,2),(1,2014246800,3),(1,2026947600,2),(1,2045696400,3),(1,2058397200,2),(1,2077146000,3),(1,2090451600,2),(1,2108595600,3),(1,2121901200,2),(1,2140045200,3),(3,-1688265000,2),(3,-1656819048,1),(3,-1641353448,2),(3,-1627965048,3),(3,-1618716648,1),(3,-1596429048,3),(3,-1593829848,5),(3,-1589860800,4),(3,-1542427200,5),(3,-1539493200,6),(3,-1525323600,5),(3,-1522728000,4),(3,-1491188400,7),(3,-1247536800,4),(3,354920400,5),(3,370728000,4),(3,386456400,5),(3,402264000,4),(3,417992400,5),(3,433800000,4),(3,449614800,5),(3,465346800,8),(3,481071600,9),(3,496796400,8),(3,512521200,9),(3,528246000,8),(3,543970800,9),(3,559695600,8),(3,575420400,9),(3,591145200,8),(3,606870000,9),(3,622594800,8),(3,638319600,9),(3,654649200,8),(3,670374000,10),(3,686102400,11),(3,695779200,8),(3,701812800,5),(3,717534000,4),(3,733273200,9),(3,748998000,8),(3,764722800,9),(3,780447600,8),(3,796172400,9),(3,811897200,8),(3,828226800,9),(3,846370800,8),(3,859676400,9),(3,877820400,8),(3,891126000,9),(3,909270000,8),(3,922575600,9),(3,941324400,8),(3,954025200,9),(3,972774000,8),(3,985474800,9),(3,1004223600,8),(3,1017529200,9),(3,1035673200,8),(3,1048978800,9),(3,1067122800,8),(3,1080428400,9),(3,1099177200,8),(3,1111878000,9),(3,1130626800,8),(3,1143327600,9),(3,1162076400,8),(3,1174777200,9),(3,1193526000,8),(3,1206831600,9),(3,1224975600,8),(3,1238281200,9),(3,1256425200,8),(3,1269730800,9),(3,1288479600,8),(3,1301180400,9),(3,1319929200,8),(3,1332630000,9),(3,1351378800,8),(3,1364684400,9),(3,1382828400,8),(3,1396134000,9),(3,1414278000,8),(3,1427583600,9),(3,1445727600,8),(3,1459033200,9),(3,1477782000,8),(3,1490482800,9),(3,1509231600,8),(3,1521932400,9),(3,1540681200,8),(3,1553986800,9),(3,1572130800,8),(3,1585436400,9),(3,1603580400,8),(3,1616886000,9),(3,1635634800,8),(3,1648335600,9),(3,1667084400,8),(3,1679785200,9),(3,1698534000,8),(3,1711839600,9),(3,1729983600,8),(3,1743289200,9),(3,1761433200,8),(3,1774738800,9),(3,1792882800,8),(3,1806188400,9),(3,1824937200,8),(3,1837638000,9),(3,1856386800,8),(3,1869087600,9),(3,1887836400,8),(3,1901142000,9),(3,1919286000,8),(3,1932591600,9),(3,1950735600,8),(3,1964041200,9),(3,1982790000,8),(3,1995490800,9),(3,2014239600,8),(3,2026940400,9),(3,2045689200,8),(3,2058390000,9),(3,2077138800,8),(3,2090444400,9),(3,2108588400,8),(3,2121894000,9),(3,2140038000,8),(4,-1688265000,2),(4,-1656819048,1),(4,-1641353448,2),(4,-1627965048,3),(4,-1618716648,1),(4,-1596429048,3),(4,-1593829848,5),(4,-1589860800,4),(4,-1542427200,5),(4,-1539493200,6),(4,-1525323600,5),(4,-1522728000,4),(4,-1491188400,7),(4,-1247536800,4),(4,354920409,5),(4,370728010,4),(4,386456410,5),(4,402264011,4),(4,417992411,5),(4,433800012,4),(4,449614812,5),(4,465346812,8),(4,481071612,9),(4,496796413,8),(4,512521213,9),(4,528246013,8),(4,543970813,9),(4,559695613,8),(4,575420414,9),(4,591145214,8),(4,606870014,9),(4,622594814,8),(4,638319615,9),(4,654649215,8),(4,670374016,10),(4,686102416,11),(4,695779216,8),(4,701812816,5),(4,717534017,4),(4,733273217,9),(4,748998018,8),(4,764722818,9),(4,780447619,8),(4,796172419,9),(4,811897219,8),(4,828226820,9),(4,846370820,8),(4,859676420,9),(4,877820421,8),(4,891126021,9),(4,909270021,8),(4,922575622,9),(4,941324422,8),(4,954025222,9),(4,972774022,8),(4,985474822,9),(4,1004223622,8),(4,1017529222,9),(4,1035673222,8),(4,1048978822,9),(4,1067122822,8),(4,1080428422,9),(4,1099177222,8),(4,1111878022,9),(4,1130626822,8),(4,1143327622,9),(4,1162076422,8),(4,1174777222,9),(4,1193526022,8),(4,1206831622,9),(4,1224975622,8),(4,1238281222,9),(4,1256425222,8),(4,1269730822,9),(4,1288479622,8),(4,1301180422,9),(4,1319929222,8),(4,1332630022,9),(4,1351378822,8),(4,1364684422,9),(4,1382828422,8),(4,1396134022,9),(4,1414278022,8),(4,1427583622,9),(4,1445727622,8),(4,1459033222,9),(4,1477782022,8),(4,1490482822,9),(4,1509231622,8),(4,1521932422,9),(4,1540681222,8),(4,1553986822,9),(4,1572130822,8),(4,1585436422,9),(4,1603580422,8),(4,1616886022,9),(4,1635634822,8),(4,1648335622,9),(4,1667084422,8),(4,1679785222,9),(4,1698534022,8),(4,1711839622,9),(4,1729983622,8),(4,1743289222,9),(4,1761433222,8),(4,1774738822,9),(4,1792882822,8),(4,1806188422,9),(4,1824937222,8),(4,1837638022,9),(4,1856386822,8),(4,1869087622,9),(4,1887836422,8),(4,1901142022,9),(4,1919286022,8),(4,1932591622,9),(4,1950735622,8),(4,1964041222,9),(4,1982790022,8),(4,1995490822,9),(4,2014239622,8),(4,2026940422,9),(4,2045689222,8),(4,2058390022,9),(4,2077138822,8),(4,2090444422,9),(4,2108588422,8),(4,2121894022,9),(4,2140038022,8),(5,-1009875600,1); +REPLACE INTO `time_zone_transition` VALUES +(1,-1693706400,0), +(1,-1680483600,1), +(1,-1663455600,2), +(1,-1650150000,3), +(1,-1632006000,2), +(1,-1618700400,3), +(1,-938905200,2), +(1,-857257200,3), +(1,-844556400,2), +(1,-828226800,3), +(1,-812502000,2), +(1,-796777200,3), +(1,228877200,2), +(1,243997200,3), +(1,260326800,2), +(1,276051600,3), +(1,291776400,2), +(1,307501200,3), +(1,323830800,2), +(1,338950800,3), +(1,354675600,2), +(1,370400400,3), +(1,386125200,2), +(1,401850000,3), +(1,417574800,2), +(1,433299600,3), +(1,449024400,2), +(1,465354000,3), +(1,481078800,2), +(1,496803600,3), +(1,512528400,2), +(1,528253200,3), +(1,543978000,2), +(1,559702800,3), +(1,575427600,2), +(1,591152400,3), +(1,606877200,2), +(1,622602000,3), +(1,638326800,2), +(1,654656400,3), +(1,670381200,2), +(1,686106000,3), +(1,701830800,2), +(1,717555600,3), +(1,733280400,2), +(1,749005200,3), +(1,764730000,2), +(1,780454800,3), +(1,796179600,2), +(1,811904400,3), +(1,828234000,2), +(1,846378000,3), +(1,859683600,2), +(1,877827600,3), +(1,891133200,2), +(1,909277200,3), +(1,922582800,2), +(1,941331600,3), +(1,954032400,2), +(1,972781200,3), +(1,985482000,2), +(1,1004230800,3), +(1,1017536400,2), +(1,1035680400,3), +(1,1048986000,2), +(1,1067130000,3), +(1,1080435600,2), +(1,1099184400,3), +(1,1111885200,2), +(1,1130634000,3), +(1,1143334800,2), +(1,1162083600,3), +(1,1174784400,2), +(1,1193533200,3), +(1,1206838800,2), +(1,1224982800,3), +(1,1238288400,2), +(1,1256432400,3), +(1,1269738000,2), +(1,1288486800,3), +(1,1301187600,2), +(1,1319936400,3), +(1,1332637200,2), +(1,1351386000,3), +(1,1364691600,2), +(1,1382835600,3), +(1,1396141200,2), +(1,1414285200,3), +(1,1427590800,2), +(1,1445734800,3), +(1,1459040400,2), +(1,1477789200,3), +(1,1490490000,2), +(1,1509238800,3), +(1,1521939600,2), +(1,1540688400,3), +(1,1553994000,2), +(1,1572138000,3), +(1,1585443600,2), +(1,1603587600,3), +(1,1616893200,2), +(1,1635642000,3), +(1,1648342800,2), +(1,1667091600,3), +(1,1679792400,2), +(1,1698541200,3), +(1,1711846800,2), +(1,1729990800,3), +(1,1743296400,2), +(1,1761440400,3), +(1,1774746000,2), +(1,1792890000,3), +(1,1806195600,2), +(1,1824944400,3), +(1,1837645200,2), +(1,1856394000,3), +(1,1869094800,2), +(1,1887843600,3), +(1,1901149200,2), +(1,1919293200,3), +(1,1932598800,2), +(1,1950742800,3), +(1,1964048400,2), +(1,1982797200,3), +(1,1995498000,2), +(1,2014246800,3), +(1,2026947600,2), +(1,2045696400,3), +(1,2058397200,2), +(1,2077146000,3), +(1,2090451600,2), +(1,2108595600,3), +(1,2121901200,2), +(1,2140045200,3), +(3,-1688265000,2), +(3,-1656819048,1), +(3,-1641353448,2), +(3,-1627965048,3), +(3,-1618716648,1), +(3,-1596429048,3), +(3,-1593829848,5), +(3,-1589860800,4), +(3,-1542427200,5), +(3,-1539493200,6), +(3,-1525323600,5), +(3,-1522728000,4), +(3,-1491188400,7), +(3,-1247536800,4), +(3,354920400,5), +(3,370728000,4), +(3,386456400,5), +(3,402264000,4), +(3,417992400,5), +(3,433800000,4), +(3,449614800,5), +(3,465346800,8), +(3,481071600,9), +(3,496796400,8), +(3,512521200,9), +(3,528246000,8), +(3,543970800,9), +(3,559695600,8), +(3,575420400,9), +(3,591145200,8), +(3,606870000,9), +(3,622594800,8), +(3,638319600,9), +(3,654649200,8), +(3,670374000,10), +(3,686102400,11), +(3,695779200,8), +(3,701812800,5), +(3,717534000,4), +(3,733273200,9), +(3,748998000,8), +(3,764722800,9), +(3,780447600,8), +(3,796172400,9), +(3,811897200,8), +(3,828226800,9), +(3,846370800,8), +(3,859676400,9), +(3,877820400,8), +(3,891126000,9), +(3,909270000,8), +(3,922575600,9), +(3,941324400,8), +(3,954025200,9), +(3,972774000,8), +(3,985474800,9), +(3,1004223600,8), +(3,1017529200,9), +(3,1035673200,8), +(3,1048978800,9), +(3,1067122800,8), +(3,1080428400,9), +(3,1099177200,8), +(3,1111878000,9), +(3,1130626800,8), +(3,1143327600,9), +(3,1162076400,8), +(3,1174777200,9), +(3,1193526000,8), +(3,1206831600,9), +(3,1224975600,8), +(3,1238281200,9), +(3,1256425200,8), +(3,1269730800,9), +(3,1288479600,8), +(3,1301180400,9), +(3,1319929200,8), +(3,1332630000,9), +(3,1351378800,8), +(3,1364684400,9), +(3,1382828400,8), +(3,1396134000,9), +(3,1414278000,8), +(3,1427583600,9), +(3,1445727600,8), +(3,1459033200,9), +(3,1477782000,8), +(3,1490482800,9), +(3,1509231600,8), +(3,1521932400,9), +(3,1540681200,8), +(3,1553986800,9), +(3,1572130800,8), +(3,1585436400,9), +(3,1603580400,8), +(3,1616886000,9), +(3,1635634800,8), +(3,1648335600,9), +(3,1667084400,8), +(3,1679785200,9), +(3,1698534000,8), +(3,1711839600,9), +(3,1729983600,8), +(3,1743289200,9), +(3,1761433200,8), +(3,1774738800,9), +(3,1792882800,8), +(3,1806188400,9), +(3,1824937200,8), +(3,1837638000,9), +(3,1856386800,8), +(3,1869087600,9), +(3,1887836400,8), +(3,1901142000,9), +(3,1919286000,8), +(3,1932591600,9), +(3,1950735600,8), +(3,1964041200,9), +(3,1982790000,8), +(3,1995490800,9), +(3,2014239600,8), +(3,2026940400,9), +(3,2045689200,8), +(3,2058390000,9), +(3,2077138800,8), +(3,2090444400,9), +(3,2108588400,8), +(3,2121894000,9), +(3,2140038000,8), +(4,-1688265000,2), +(4,-1656819048,1), +(4,-1641353448,2), +(4,-1627965048,3), +(4,-1618716648,1), +(4,-1596429048,3), +(4,-1593829848,5), +(4,-1589860800,4), +(4,-1542427200,5), +(4,-1539493200,6), +(4,-1525323600,5), +(4,-1522728000,4), +(4,-1491188400,7), +(4,-1247536800,4), +(4,354920409,5), +(4,370728010,4), +(4,386456410,5), +(4,402264011,4), +(4,417992411,5), +(4,433800012,4), +(4,449614812,5), +(4,465346812,8), +(4,481071612,9), +(4,496796413,8), +(4,512521213,9), +(4,528246013,8), +(4,543970813,9), +(4,559695613,8), +(4,575420414,9), +(4,591145214,8), +(4,606870014,9), +(4,622594814,8), +(4,638319615,9), +(4,654649215,8), +(4,670374016,10), +(4,686102416,11), +(4,695779216,8), +(4,701812816,5), +(4,717534017,4), +(4,733273217,9), +(4,748998018,8), +(4,764722818,9), +(4,780447619,8), +(4,796172419,9), +(4,811897219,8), +(4,828226820,9), +(4,846370820,8), +(4,859676420,9), +(4,877820421,8), +(4,891126021,9), +(4,909270021,8), +(4,922575622,9), +(4,941324422,8), +(4,954025222,9), +(4,972774022,8), +(4,985474822,9), +(4,1004223622,8), +(4,1017529222,9), +(4,1035673222,8), +(4,1048978822,9), +(4,1067122822,8), +(4,1080428422,9), +(4,1099177222,8), +(4,1111878022,9), +(4,1130626822,8), +(4,1143327622,9), +(4,1162076422,8), +(4,1174777222,9), +(4,1193526022,8), +(4,1206831622,9), +(4,1224975622,8), +(4,1238281222,9), +(4,1256425222,8), +(4,1269730822,9), +(4,1288479622,8), +(4,1301180422,9), +(4,1319929222,8), +(4,1332630022,9), +(4,1351378822,8), +(4,1364684422,9), +(4,1382828422,8), +(4,1396134022,9), +(4,1414278022,8), +(4,1427583622,9), +(4,1445727622,8), +(4,1459033222,9), +(4,1477782022,8), +(4,1490482822,9), +(4,1509231622,8), +(4,1521932422,9), +(4,1540681222,8), +(4,1553986822,9), +(4,1572130822,8), +(4,1585436422,9), +(4,1603580422,8), +(4,1616886022,9), +(4,1635634822,8), +(4,1648335622,9), +(4,1667084422,8), +(4,1679785222,9), +(4,1698534022,8), +(4,1711839622,9), +(4,1729983622,8), +(4,1743289222,9), +(4,1761433222,8), +(4,1774738822,9), +(4,1792882822,8), +(4,1806188422,9), +(4,1824937222,8), +(4,1837638022,9), +(4,1856386822,8), +(4,1869087622,9), +(4,1887836422,8), +(4,1901142022,9), +(4,1919286022,8), +(4,1932591622,9), +(4,1950735622,8), +(4,1964041222,9), +(4,1982790022,8), +(4,1995490822,9), +(4,2014239622,8), +(4,2026940422,9), +(4,2045689222,8), +(4,2058390022,9), +(4,2077138822,8), +(4,2090444422,9), +(4,2108588422,8), +(4,2121894022,9), +(4,2140038022,8), +(5,-1009875600,1); /*!40000 ALTER TABLE `time_zone_transition` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `time_zone_transition_type` WRITE; /*!40000 ALTER TABLE `time_zone_transition_type` DISABLE KEYS */; -REPLACE INTO `time_zone_transition_type` VALUES (1,0,7200,1,'MEST'),(1,1,3600,0,'MET'),(1,2,7200,1,'MEST'),(1,3,3600,0,'MET'),(2,0,0,0,'UTC'),(3,0,9000,0,'MMT'),(3,1,12648,1,'MST'),(3,2,9048,0,'MMT'),(3,3,16248,1,'MDST'),(3,4,10800,0,'MSK'),(3,5,14400,1,'MSD'),(3,6,18000,1,'MSD'),(3,7,7200,0,'EET'),(3,8,10800,0,'MSK'),(3,9,14400,1,'MSD'),(3,10,10800,1,'EEST'),(3,11,7200,0,'EET'),(4,0,9000,0,'MMT'),(4,1,12648,1,'MST'),(4,2,9048,0,'MMT'),(4,3,16248,1,'MDST'),(4,4,10800,0,'MSK'),(4,5,14400,1,'MSD'),(4,6,18000,1,'MSD'),(4,7,7200,0,'EET'),(4,8,10800,0,'MSK'),(4,9,14400,1,'MSD'),(4,10,10800,1,'EEST'),(4,11,7200,0,'EET'),(5,0,32400,0,'CJT'),(5,1,32400,0,'JST'); +REPLACE INTO `time_zone_transition_type` VALUES +(1,0,7200,1,'MEST'), +(1,1,3600,0,'MET'), +(1,2,7200,1,'MEST'), +(1,3,3600,0,'MET'), +(2,0,0,0,'UTC'), +(3,0,9000,0,'MMT'), +(3,1,12648,1,'MST'), +(3,2,9048,0,'MMT'), +(3,3,16248,1,'MDST'), +(3,4,10800,0,'MSK'), +(3,5,14400,1,'MSD'), +(3,6,18000,1,'MSD'), +(3,7,7200,0,'EET'), +(3,8,10800,0,'MSK'), +(3,9,14400,1,'MSD'), +(3,10,10800,1,'EEST'), +(3,11,7200,0,'EET'), +(4,0,9000,0,'MMT'), +(4,1,12648,1,'MST'), +(4,2,9048,0,'MMT'), +(4,3,16248,1,'MDST'), +(4,4,10800,0,'MSK'), +(4,5,14400,1,'MSD'), +(4,6,18000,1,'MSD'), +(4,7,7200,0,'EET'), +(4,8,10800,0,'MSK'), +(4,9,14400,1,'MSD'), +(4,10,10800,1,'EEST'), +(4,11,7200,0,'EET'), +(5,0,32400,0,'CJT'), +(5,1,32400,0,'JST'); /*!40000 ALTER TABLE `time_zone_transition_type` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -318,9 +1257,11 @@ UNLOCK TABLES; /*!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 */; +INSTALL PLUGIN test_plugin_server /*M!100401 IF NOT EXISTS */ SONAME 'AUTH_TEST_PLUGIN_LIB'; +INSTALL PLUGIN cleartext_plugin_server /*M!100401 IF NOT EXISTS */ SONAME 'AUTH_TEST_PLUGIN_LIB'; CREATE USER IF NOT EXISTS `mariadb.sys`@`localhost` PASSWORD EXPIRE; CREATE USER IF NOT EXISTS `root`@`localhost`; -CREATE USER IF NOT EXISTS `USER`@`%`; +CREATE USER IF NOT EXISTS `foobar`@`%` IDENTIFIED VIA test_plugin_server USING 'plug_dest'; SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role; CREATE ROLE IF NOT EXISTS mariadb_dump_import_role; GRANT mariadb_dump_import_role TO CURRENT_USER(); @@ -340,11 +1281,11 @@ GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION; GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION; /*M!100005 SET DEFAULT ROLE NONE FOR 'root'@'localhost' */; /*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */; -GRANT `role_1` TO `USER`@`%`; -GRANT `role_2` TO `USER`@`%`; -GRANT USAGE ON *.* TO `USER`@`%`; -/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */; -/*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */; +GRANT `role_1` TO `foobar`@`%`; +GRANT `role_2` TO `foobar`@`%`; +GRANT USAGE ON *.* TO `foobar`@`%` IDENTIFIED VIA test_plugin_server USING 'plug_dest'; +/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'foobar'@'%' */; +/*!80001 ALTER USER 'foobar'@'%' DEFAULT ROLE 'role_2' */; GRANT `role_2` TO `role_1` WITH ADMIN OPTION; GRANT SHOW DATABASES ON *.* TO `role_1`; GRANT USAGE ON *.* TO `role_2`; @@ -359,31 +1300,39 @@ USE mysql; LOCK TABLES `column_stats` WRITE; /*!40000 ALTER TABLE `column_stats` DISABLE KEYS */; -INSERT IGNORE INTO `column_stats` VALUES ('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,254,'DOUBLE_PREC_HB','\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0������������������������������������������������������������������������������������������������������������������������������'); +INSERT IGNORE INTO `column_stats` VALUES +('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,4,'JSON_HB','{\"target_histogram_size\": 254, \"collected_at\": \"2022-01-07 07:07:00\", \"collected_by\": \"version\", \"histogram_hb\": [{\"start\": \"1\", \"size\": 0.340966921, \"ndv\": 1}, {\"start\": \"3\", \"size\": 0.328244275, \"ndv\": 1}, {\"start\": \"4\", \"size\": 0.328244275, \"ndv\": 1}, {\"start\": \"5\", \"end\": \"5\", \"size\": 0.002544529, \"ndv\": 1}]}'); /*!40000 ALTER TABLE `column_stats` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `index_stats` WRITE; /*!40000 ALTER TABLE `index_stats` DISABLE KEYS */; -INSERT IGNORE INTO `index_stats` VALUES ('mysql','tz','PRIMARY',1,98.2500); +INSERT IGNORE INTO `index_stats` VALUES +('mysql','tz','PRIMARY',1,98.2500); /*!40000 ALTER TABLE `index_stats` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `table_stats` WRITE; /*!40000 ALTER TABLE `table_stats` DISABLE KEYS */; -INSERT IGNORE INTO `table_stats` VALUES ('mysql','tz',393); +INSERT IGNORE INTO `table_stats` VALUES +('mysql','tz',393); /*!40000 ALTER TABLE `table_stats` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `innodb_index_stats` WRITE; /*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */; -INSERT IGNORE INTO `innodb_index_stats` VALUES ('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index'); +INSERT IGNORE INTO `innodb_index_stats` VALUES +('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'), +('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'), +('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'), +('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index'); /*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `innodb_table_stats` WRITE; /*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */; -INSERT IGNORE INTO `innodb_table_stats` VALUES ('mysql','tz','2019-12-31 21:00:00',393,1,0); +INSERT IGNORE INTO `innodb_table_stats` VALUES +('mysql','tz','2019-12-31 21:00:00',393,1,0); /*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */; UNLOCK TABLES; @@ -391,31 +1340,488 @@ USE mysql; LOCK TABLES `time_zone` WRITE; /*!40000 ALTER TABLE `time_zone` DISABLE KEYS */; -INSERT IGNORE INTO `time_zone` VALUES (1,'N'),(2,'N'),(3,'N'),(4,'Y'),(5,'N'); +INSERT IGNORE INTO `time_zone` VALUES +(1,'N'), +(2,'N'), +(3,'N'), +(4,'Y'), +(5,'N'); /*!40000 ALTER TABLE `time_zone` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `time_zone_name` WRITE; /*!40000 ALTER TABLE `time_zone_name` DISABLE KEYS */; -INSERT IGNORE INTO `time_zone_name` VALUES ('Europe/Moscow',3),('Japan',5),('leap/Europe/Moscow',4),('MET',1),('Universal',2),('UTC',2); +INSERT IGNORE INTO `time_zone_name` VALUES +('Europe/Moscow',3), +('Japan',5), +('leap/Europe/Moscow',4), +('MET',1), +('Universal',2), +('UTC',2); /*!40000 ALTER TABLE `time_zone_name` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `time_zone_leap_second` WRITE; /*!40000 ALTER TABLE `time_zone_leap_second` DISABLE KEYS */; -INSERT IGNORE INTO `time_zone_leap_second` VALUES (78796800,1),(94694401,2),(126230402,3),(157766403,4),(189302404,5),(220924805,6),(252460806,7),(283996807,8),(315532808,9),(362793609,10),(394329610,11),(425865611,12),(489024012,13),(567993613,14),(631152014,15),(662688015,16),(709948816,17),(741484817,18),(773020818,19),(820454419,20),(867715220,21),(915148821,22); +INSERT IGNORE INTO `time_zone_leap_second` VALUES +(78796800,1), +(94694401,2), +(126230402,3), +(157766403,4), +(189302404,5), +(220924805,6), +(252460806,7), +(283996807,8), +(315532808,9), +(362793609,10), +(394329610,11), +(425865611,12), +(489024012,13), +(567993613,14), +(631152014,15), +(662688015,16), +(709948816,17), +(741484817,18), +(773020818,19), +(820454419,20), +(867715220,21), +(915148821,22); /*!40000 ALTER TABLE `time_zone_leap_second` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `time_zone_transition` WRITE; /*!40000 ALTER TABLE `time_zone_transition` DISABLE KEYS */; -INSERT IGNORE INTO `time_zone_transition` VALUES (1,-1693706400,0),(1,-1680483600,1),(1,-1663455600,2),(1,-1650150000,3),(1,-1632006000,2),(1,-1618700400,3),(1,-938905200,2),(1,-857257200,3),(1,-844556400,2),(1,-828226800,3),(1,-812502000,2),(1,-796777200,3),(1,228877200,2),(1,243997200,3),(1,260326800,2),(1,276051600,3),(1,291776400,2),(1,307501200,3),(1,323830800,2),(1,338950800,3),(1,354675600,2),(1,370400400,3),(1,386125200,2),(1,401850000,3),(1,417574800,2),(1,433299600,3),(1,449024400,2),(1,465354000,3),(1,481078800,2),(1,496803600,3),(1,512528400,2),(1,528253200,3),(1,543978000,2),(1,559702800,3),(1,575427600,2),(1,591152400,3),(1,606877200,2),(1,622602000,3),(1,638326800,2),(1,654656400,3),(1,670381200,2),(1,686106000,3),(1,701830800,2),(1,717555600,3),(1,733280400,2),(1,749005200,3),(1,764730000,2),(1,780454800,3),(1,796179600,2),(1,811904400,3),(1,828234000,2),(1,846378000,3),(1,859683600,2),(1,877827600,3),(1,891133200,2),(1,909277200,3),(1,922582800,2),(1,941331600,3),(1,954032400,2),(1,972781200,3),(1,985482000,2),(1,1004230800,3),(1,1017536400,2),(1,1035680400,3),(1,1048986000,2),(1,1067130000,3),(1,1080435600,2),(1,1099184400,3),(1,1111885200,2),(1,1130634000,3),(1,1143334800,2),(1,1162083600,3),(1,1174784400,2),(1,1193533200,3),(1,1206838800,2),(1,1224982800,3),(1,1238288400,2),(1,1256432400,3),(1,1269738000,2),(1,1288486800,3),(1,1301187600,2),(1,1319936400,3),(1,1332637200,2),(1,1351386000,3),(1,1364691600,2),(1,1382835600,3),(1,1396141200,2),(1,1414285200,3),(1,1427590800,2),(1,1445734800,3),(1,1459040400,2),(1,1477789200,3),(1,1490490000,2),(1,1509238800,3),(1,1521939600,2),(1,1540688400,3),(1,1553994000,2),(1,1572138000,3),(1,1585443600,2),(1,1603587600,3),(1,1616893200,2),(1,1635642000,3),(1,1648342800,2),(1,1667091600,3),(1,1679792400,2),(1,1698541200,3),(1,1711846800,2),(1,1729990800,3),(1,1743296400,2),(1,1761440400,3),(1,1774746000,2),(1,1792890000,3),(1,1806195600,2),(1,1824944400,3),(1,1837645200,2),(1,1856394000,3),(1,1869094800,2),(1,1887843600,3),(1,1901149200,2),(1,1919293200,3),(1,1932598800,2),(1,1950742800,3),(1,1964048400,2),(1,1982797200,3),(1,1995498000,2),(1,2014246800,3),(1,2026947600,2),(1,2045696400,3),(1,2058397200,2),(1,2077146000,3),(1,2090451600,2),(1,2108595600,3),(1,2121901200,2),(1,2140045200,3),(3,-1688265000,2),(3,-1656819048,1),(3,-1641353448,2),(3,-1627965048,3),(3,-1618716648,1),(3,-1596429048,3),(3,-1593829848,5),(3,-1589860800,4),(3,-1542427200,5),(3,-1539493200,6),(3,-1525323600,5),(3,-1522728000,4),(3,-1491188400,7),(3,-1247536800,4),(3,354920400,5),(3,370728000,4),(3,386456400,5),(3,402264000,4),(3,417992400,5),(3,433800000,4),(3,449614800,5),(3,465346800,8),(3,481071600,9),(3,496796400,8),(3,512521200,9),(3,528246000,8),(3,543970800,9),(3,559695600,8),(3,575420400,9),(3,591145200,8),(3,606870000,9),(3,622594800,8),(3,638319600,9),(3,654649200,8),(3,670374000,10),(3,686102400,11),(3,695779200,8),(3,701812800,5),(3,717534000,4),(3,733273200,9),(3,748998000,8),(3,764722800,9),(3,780447600,8),(3,796172400,9),(3,811897200,8),(3,828226800,9),(3,846370800,8),(3,859676400,9),(3,877820400,8),(3,891126000,9),(3,909270000,8),(3,922575600,9),(3,941324400,8),(3,954025200,9),(3,972774000,8),(3,985474800,9),(3,1004223600,8),(3,1017529200,9),(3,1035673200,8),(3,1048978800,9),(3,1067122800,8),(3,1080428400,9),(3,1099177200,8),(3,1111878000,9),(3,1130626800,8),(3,1143327600,9),(3,1162076400,8),(3,1174777200,9),(3,1193526000,8),(3,1206831600,9),(3,1224975600,8),(3,1238281200,9),(3,1256425200,8),(3,1269730800,9),(3,1288479600,8),(3,1301180400,9),(3,1319929200,8),(3,1332630000,9),(3,1351378800,8),(3,1364684400,9),(3,1382828400,8),(3,1396134000,9),(3,1414278000,8),(3,1427583600,9),(3,1445727600,8),(3,1459033200,9),(3,1477782000,8),(3,1490482800,9),(3,1509231600,8),(3,1521932400,9),(3,1540681200,8),(3,1553986800,9),(3,1572130800,8),(3,1585436400,9),(3,1603580400,8),(3,1616886000,9),(3,1635634800,8),(3,1648335600,9),(3,1667084400,8),(3,1679785200,9),(3,1698534000,8),(3,1711839600,9),(3,1729983600,8),(3,1743289200,9),(3,1761433200,8),(3,1774738800,9),(3,1792882800,8),(3,1806188400,9),(3,1824937200,8),(3,1837638000,9),(3,1856386800,8),(3,1869087600,9),(3,1887836400,8),(3,1901142000,9),(3,1919286000,8),(3,1932591600,9),(3,1950735600,8),(3,1964041200,9),(3,1982790000,8),(3,1995490800,9),(3,2014239600,8),(3,2026940400,9),(3,2045689200,8),(3,2058390000,9),(3,2077138800,8),(3,2090444400,9),(3,2108588400,8),(3,2121894000,9),(3,2140038000,8),(4,-1688265000,2),(4,-1656819048,1),(4,-1641353448,2),(4,-1627965048,3),(4,-1618716648,1),(4,-1596429048,3),(4,-1593829848,5),(4,-1589860800,4),(4,-1542427200,5),(4,-1539493200,6),(4,-1525323600,5),(4,-1522728000,4),(4,-1491188400,7),(4,-1247536800,4),(4,354920409,5),(4,370728010,4),(4,386456410,5),(4,402264011,4),(4,417992411,5),(4,433800012,4),(4,449614812,5),(4,465346812,8),(4,481071612,9),(4,496796413,8),(4,512521213,9),(4,528246013,8),(4,543970813,9),(4,559695613,8),(4,575420414,9),(4,591145214,8),(4,606870014,9),(4,622594814,8),(4,638319615,9),(4,654649215,8),(4,670374016,10),(4,686102416,11),(4,695779216,8),(4,701812816,5),(4,717534017,4),(4,733273217,9),(4,748998018,8),(4,764722818,9),(4,780447619,8),(4,796172419,9),(4,811897219,8),(4,828226820,9),(4,846370820,8),(4,859676420,9),(4,877820421,8),(4,891126021,9),(4,909270021,8),(4,922575622,9),(4,941324422,8),(4,954025222,9),(4,972774022,8),(4,985474822,9),(4,1004223622,8),(4,1017529222,9),(4,1035673222,8),(4,1048978822,9),(4,1067122822,8),(4,1080428422,9),(4,1099177222,8),(4,1111878022,9),(4,1130626822,8),(4,1143327622,9),(4,1162076422,8),(4,1174777222,9),(4,1193526022,8),(4,1206831622,9),(4,1224975622,8),(4,1238281222,9),(4,1256425222,8),(4,1269730822,9),(4,1288479622,8),(4,1301180422,9),(4,1319929222,8),(4,1332630022,9),(4,1351378822,8),(4,1364684422,9),(4,1382828422,8),(4,1396134022,9),(4,1414278022,8),(4,1427583622,9),(4,1445727622,8),(4,1459033222,9),(4,1477782022,8),(4,1490482822,9),(4,1509231622,8),(4,1521932422,9),(4,1540681222,8),(4,1553986822,9),(4,1572130822,8),(4,1585436422,9),(4,1603580422,8),(4,1616886022,9),(4,1635634822,8),(4,1648335622,9),(4,1667084422,8),(4,1679785222,9),(4,1698534022,8),(4,1711839622,9),(4,1729983622,8),(4,1743289222,9),(4,1761433222,8),(4,1774738822,9),(4,1792882822,8),(4,1806188422,9),(4,1824937222,8),(4,1837638022,9),(4,1856386822,8),(4,1869087622,9),(4,1887836422,8),(4,1901142022,9),(4,1919286022,8),(4,1932591622,9),(4,1950735622,8),(4,1964041222,9),(4,1982790022,8),(4,1995490822,9),(4,2014239622,8),(4,2026940422,9),(4,2045689222,8),(4,2058390022,9),(4,2077138822,8),(4,2090444422,9),(4,2108588422,8),(4,2121894022,9),(4,2140038022,8),(5,-1009875600,1); +INSERT IGNORE INTO `time_zone_transition` VALUES +(1,-1693706400,0), +(1,-1680483600,1), +(1,-1663455600,2), +(1,-1650150000,3), +(1,-1632006000,2), +(1,-1618700400,3), +(1,-938905200,2), +(1,-857257200,3), +(1,-844556400,2), +(1,-828226800,3), +(1,-812502000,2), +(1,-796777200,3), +(1,228877200,2), +(1,243997200,3), +(1,260326800,2), +(1,276051600,3), +(1,291776400,2), +(1,307501200,3), +(1,323830800,2), +(1,338950800,3), +(1,354675600,2), +(1,370400400,3), +(1,386125200,2), +(1,401850000,3), +(1,417574800,2), +(1,433299600,3), +(1,449024400,2), +(1,465354000,3), +(1,481078800,2), +(1,496803600,3), +(1,512528400,2), +(1,528253200,3), +(1,543978000,2), +(1,559702800,3), +(1,575427600,2), +(1,591152400,3), +(1,606877200,2), +(1,622602000,3), +(1,638326800,2), +(1,654656400,3), +(1,670381200,2), +(1,686106000,3), +(1,701830800,2), +(1,717555600,3), +(1,733280400,2), +(1,749005200,3), +(1,764730000,2), +(1,780454800,3), +(1,796179600,2), +(1,811904400,3), +(1,828234000,2), +(1,846378000,3), +(1,859683600,2), +(1,877827600,3), +(1,891133200,2), +(1,909277200,3), +(1,922582800,2), +(1,941331600,3), +(1,954032400,2), +(1,972781200,3), +(1,985482000,2), +(1,1004230800,3), +(1,1017536400,2), +(1,1035680400,3), +(1,1048986000,2), +(1,1067130000,3), +(1,1080435600,2), +(1,1099184400,3), +(1,1111885200,2), +(1,1130634000,3), +(1,1143334800,2), +(1,1162083600,3), +(1,1174784400,2), +(1,1193533200,3), +(1,1206838800,2), +(1,1224982800,3), +(1,1238288400,2), +(1,1256432400,3), +(1,1269738000,2), +(1,1288486800,3), +(1,1301187600,2), +(1,1319936400,3), +(1,1332637200,2), +(1,1351386000,3), +(1,1364691600,2), +(1,1382835600,3), +(1,1396141200,2), +(1,1414285200,3), +(1,1427590800,2), +(1,1445734800,3), +(1,1459040400,2), +(1,1477789200,3), +(1,1490490000,2), +(1,1509238800,3), +(1,1521939600,2), +(1,1540688400,3), +(1,1553994000,2), +(1,1572138000,3), +(1,1585443600,2), +(1,1603587600,3), +(1,1616893200,2), +(1,1635642000,3), +(1,1648342800,2), +(1,1667091600,3), +(1,1679792400,2), +(1,1698541200,3), +(1,1711846800,2), +(1,1729990800,3), +(1,1743296400,2), +(1,1761440400,3), +(1,1774746000,2), +(1,1792890000,3), +(1,1806195600,2), +(1,1824944400,3), +(1,1837645200,2), +(1,1856394000,3), +(1,1869094800,2), +(1,1887843600,3), +(1,1901149200,2), +(1,1919293200,3), +(1,1932598800,2), +(1,1950742800,3), +(1,1964048400,2), +(1,1982797200,3), +(1,1995498000,2), +(1,2014246800,3), +(1,2026947600,2), +(1,2045696400,3), +(1,2058397200,2), +(1,2077146000,3), +(1,2090451600,2), +(1,2108595600,3), +(1,2121901200,2), +(1,2140045200,3), +(3,-1688265000,2), +(3,-1656819048,1), +(3,-1641353448,2), +(3,-1627965048,3), +(3,-1618716648,1), +(3,-1596429048,3), +(3,-1593829848,5), +(3,-1589860800,4), +(3,-1542427200,5), +(3,-1539493200,6), +(3,-1525323600,5), +(3,-1522728000,4), +(3,-1491188400,7), +(3,-1247536800,4), +(3,354920400,5), +(3,370728000,4), +(3,386456400,5), +(3,402264000,4), +(3,417992400,5), +(3,433800000,4), +(3,449614800,5), +(3,465346800,8), +(3,481071600,9), +(3,496796400,8), +(3,512521200,9), +(3,528246000,8), +(3,543970800,9), +(3,559695600,8), +(3,575420400,9), +(3,591145200,8), +(3,606870000,9), +(3,622594800,8), +(3,638319600,9), +(3,654649200,8), +(3,670374000,10), +(3,686102400,11), +(3,695779200,8), +(3,701812800,5), +(3,717534000,4), +(3,733273200,9), +(3,748998000,8), +(3,764722800,9), +(3,780447600,8), +(3,796172400,9), +(3,811897200,8), +(3,828226800,9), +(3,846370800,8), +(3,859676400,9), +(3,877820400,8), +(3,891126000,9), +(3,909270000,8), +(3,922575600,9), +(3,941324400,8), +(3,954025200,9), +(3,972774000,8), +(3,985474800,9), +(3,1004223600,8), +(3,1017529200,9), +(3,1035673200,8), +(3,1048978800,9), +(3,1067122800,8), +(3,1080428400,9), +(3,1099177200,8), +(3,1111878000,9), +(3,1130626800,8), +(3,1143327600,9), +(3,1162076400,8), +(3,1174777200,9), +(3,1193526000,8), +(3,1206831600,9), +(3,1224975600,8), +(3,1238281200,9), +(3,1256425200,8), +(3,1269730800,9), +(3,1288479600,8), +(3,1301180400,9), +(3,1319929200,8), +(3,1332630000,9), +(3,1351378800,8), +(3,1364684400,9), +(3,1382828400,8), +(3,1396134000,9), +(3,1414278000,8), +(3,1427583600,9), +(3,1445727600,8), +(3,1459033200,9), +(3,1477782000,8), +(3,1490482800,9), +(3,1509231600,8), +(3,1521932400,9), +(3,1540681200,8), +(3,1553986800,9), +(3,1572130800,8), +(3,1585436400,9), +(3,1603580400,8), +(3,1616886000,9), +(3,1635634800,8), +(3,1648335600,9), +(3,1667084400,8), +(3,1679785200,9), +(3,1698534000,8), +(3,1711839600,9), +(3,1729983600,8), +(3,1743289200,9), +(3,1761433200,8), +(3,1774738800,9), +(3,1792882800,8), +(3,1806188400,9), +(3,1824937200,8), +(3,1837638000,9), +(3,1856386800,8), +(3,1869087600,9), +(3,1887836400,8), +(3,1901142000,9), +(3,1919286000,8), +(3,1932591600,9), +(3,1950735600,8), +(3,1964041200,9), +(3,1982790000,8), +(3,1995490800,9), +(3,2014239600,8), +(3,2026940400,9), +(3,2045689200,8), +(3,2058390000,9), +(3,2077138800,8), +(3,2090444400,9), +(3,2108588400,8), +(3,2121894000,9), +(3,2140038000,8), +(4,-1688265000,2), +(4,-1656819048,1), +(4,-1641353448,2), +(4,-1627965048,3), +(4,-1618716648,1), +(4,-1596429048,3), +(4,-1593829848,5), +(4,-1589860800,4), +(4,-1542427200,5), +(4,-1539493200,6), +(4,-1525323600,5), +(4,-1522728000,4), +(4,-1491188400,7), +(4,-1247536800,4), +(4,354920409,5), +(4,370728010,4), +(4,386456410,5), +(4,402264011,4), +(4,417992411,5), +(4,433800012,4), +(4,449614812,5), +(4,465346812,8), +(4,481071612,9), +(4,496796413,8), +(4,512521213,9), +(4,528246013,8), +(4,543970813,9), +(4,559695613,8), +(4,575420414,9), +(4,591145214,8), +(4,606870014,9), +(4,622594814,8), +(4,638319615,9), +(4,654649215,8), +(4,670374016,10), +(4,686102416,11), +(4,695779216,8), +(4,701812816,5), +(4,717534017,4), +(4,733273217,9), +(4,748998018,8), +(4,764722818,9), +(4,780447619,8), +(4,796172419,9), +(4,811897219,8), +(4,828226820,9), +(4,846370820,8), +(4,859676420,9), +(4,877820421,8), +(4,891126021,9), +(4,909270021,8), +(4,922575622,9), +(4,941324422,8), +(4,954025222,9), +(4,972774022,8), +(4,985474822,9), +(4,1004223622,8), +(4,1017529222,9), +(4,1035673222,8), +(4,1048978822,9), +(4,1067122822,8), +(4,1080428422,9), +(4,1099177222,8), +(4,1111878022,9), +(4,1130626822,8), +(4,1143327622,9), +(4,1162076422,8), +(4,1174777222,9), +(4,1193526022,8), +(4,1206831622,9), +(4,1224975622,8), +(4,1238281222,9), +(4,1256425222,8), +(4,1269730822,9), +(4,1288479622,8), +(4,1301180422,9), +(4,1319929222,8), +(4,1332630022,9), +(4,1351378822,8), +(4,1364684422,9), +(4,1382828422,8), +(4,1396134022,9), +(4,1414278022,8), +(4,1427583622,9), +(4,1445727622,8), +(4,1459033222,9), +(4,1477782022,8), +(4,1490482822,9), +(4,1509231622,8), +(4,1521932422,9), +(4,1540681222,8), +(4,1553986822,9), +(4,1572130822,8), +(4,1585436422,9), +(4,1603580422,8), +(4,1616886022,9), +(4,1635634822,8), +(4,1648335622,9), +(4,1667084422,8), +(4,1679785222,9), +(4,1698534022,8), +(4,1711839622,9), +(4,1729983622,8), +(4,1743289222,9), +(4,1761433222,8), +(4,1774738822,9), +(4,1792882822,8), +(4,1806188422,9), +(4,1824937222,8), +(4,1837638022,9), +(4,1856386822,8), +(4,1869087622,9), +(4,1887836422,8), +(4,1901142022,9), +(4,1919286022,8), +(4,1932591622,9), +(4,1950735622,8), +(4,1964041222,9), +(4,1982790022,8), +(4,1995490822,9), +(4,2014239622,8), +(4,2026940422,9), +(4,2045689222,8), +(4,2058390022,9), +(4,2077138822,8), +(4,2090444422,9), +(4,2108588422,8), +(4,2121894022,9), +(4,2140038022,8), +(5,-1009875600,1); /*!40000 ALTER TABLE `time_zone_transition` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `time_zone_transition_type` WRITE; /*!40000 ALTER TABLE `time_zone_transition_type` DISABLE KEYS */; -INSERT IGNORE INTO `time_zone_transition_type` VALUES (1,0,7200,1,'MEST'),(1,1,3600,0,'MET'),(1,2,7200,1,'MEST'),(1,3,3600,0,'MET'),(2,0,0,0,'UTC'),(3,0,9000,0,'MMT'),(3,1,12648,1,'MST'),(3,2,9048,0,'MMT'),(3,3,16248,1,'MDST'),(3,4,10800,0,'MSK'),(3,5,14400,1,'MSD'),(3,6,18000,1,'MSD'),(3,7,7200,0,'EET'),(3,8,10800,0,'MSK'),(3,9,14400,1,'MSD'),(3,10,10800,1,'EEST'),(3,11,7200,0,'EET'),(4,0,9000,0,'MMT'),(4,1,12648,1,'MST'),(4,2,9048,0,'MMT'),(4,3,16248,1,'MDST'),(4,4,10800,0,'MSK'),(4,5,14400,1,'MSD'),(4,6,18000,1,'MSD'),(4,7,7200,0,'EET'),(4,8,10800,0,'MSK'),(4,9,14400,1,'MSD'),(4,10,10800,1,'EEST'),(4,11,7200,0,'EET'),(5,0,32400,0,'CJT'),(5,1,32400,0,'JST'); +INSERT IGNORE INTO `time_zone_transition_type` VALUES +(1,0,7200,1,'MEST'), +(1,1,3600,0,'MET'), +(1,2,7200,1,'MEST'), +(1,3,3600,0,'MET'), +(2,0,0,0,'UTC'), +(3,0,9000,0,'MMT'), +(3,1,12648,1,'MST'), +(3,2,9048,0,'MMT'), +(3,3,16248,1,'MDST'), +(3,4,10800,0,'MSK'), +(3,5,14400,1,'MSD'), +(3,6,18000,1,'MSD'), +(3,7,7200,0,'EET'), +(3,8,10800,0,'MSK'), +(3,9,14400,1,'MSD'), +(3,10,10800,1,'EEST'), +(3,11,7200,0,'EET'), +(4,0,9000,0,'MMT'), +(4,1,12648,1,'MST'), +(4,2,9048,0,'MMT'), +(4,3,16248,1,'MDST'), +(4,4,10800,0,'MSK'), +(4,5,14400,1,'MSD'), +(4,6,18000,1,'MSD'), +(4,7,7200,0,'EET'), +(4,8,10800,0,'MSK'), +(4,9,14400,1,'MSD'), +(4,10,10800,1,'EEST'), +(4,11,7200,0,'EET'), +(5,0,32400,0,'CJT'), +(5,1,32400,0,'JST'); /*!40000 ALTER TABLE `time_zone_transition_type` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -430,7 +1836,7 @@ UNLOCK TABLES; SELECT * FROM mysql.global_priv ORDER BY User,Host; Host User Priv -% USER {"access":0,"version_id":VERSION,"plugin":"mysql_native_password","authentication_string":"","password_last_changed":NOW,"default_role":"role_2"} +% foobar {"access":0,"version_id":VERSION,"plugin":"test_plugin_server","authentication_string":"plug_dest","password_last_changed":NOW,"default_role":"role_2"} localhost mariadb.sys {"access":0,"plugin":"mysql_native_password","authentication_string":"","account_locked":false,"password_last_changed":NOW,"version_id":VERSION} role_1 {"access":16384,"version_id":VERSION,"is_role":true} role_2 {"access":0,"version_id":VERSION,"is_role":true} @@ -438,9 +1844,9 @@ localhost root {"access":18446744073709551615} CHECKSUM TABLE mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin, mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats; Table Checksum -mysql.roles_mapping 4108206491 +mysql.roles_mapping 2510045525 mysql.time_zone_transition 3895294076 -mysql.plugin 0 +mysql.plugin 1587119305 mysql.servers 2079085450 mysql.func 3241572444 mysql.innodb_table_stats 347867921 @@ -450,7 +1856,7 @@ CREATE USER mariadb_test_restore IDENTIFIED BY 'getitback'; GRANT ALL ON *.* TO mariadb_test_restore WITH GRANT OPTION; GRANT PROXY ON ''@'%' TO mariadb_test_restore WITH GRANT OPTION; GRANT SUPER, CREATE USER /*M!100502 ,FEDERATED ADMIN */ ON *.* TO mariadb_test_restore WITH GRANT OPTION; -drop user USER; +drop user foobar; delete from mysql.table_stats; delete from mysql.innodb_table_stats; delete from mysql.time_zone_transition; @@ -465,7 +1871,7 @@ set time_zone= @@global.time_zone; DROP USER mariadb_test_restore; SELECT * FROM mysql.global_priv ORDER BY User,Host; Host User Priv -% USER {"access":0,"version_id":VERSION,"plugin":"mysql_native_password","authentication_string":"","password_last_changed":NOW,"default_role":"role_2"} +% foobar {"access":0,"version_id":VERSION,"plugin":"test_plugin_server","authentication_string":"plug_dest","password_last_changed":NOW,"default_role":"role_2"} localhost mariadb.sys {"access":0,"version_id":VERSION,"plugin":"mysql_native_password","authentication_string":"","password_last_changed":NOW,"password_lifetime":-1,"default_role":""} role_1 {"access":16384,"version_id":VERSION,"is_role":true} role_2 {"access":0,"version_id":VERSION,"is_role":true} @@ -473,9 +1879,9 @@ localhost root {"access":549755813887,"version_id":VERSION,"plugin":"mysql_nativ CHECKSUM TABLE mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin, mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats; Table Checksum -mysql.roles_mapping 4108206491 +mysql.roles_mapping 2510045525 mysql.time_zone_transition 3895294076 -mysql.plugin 0 +mysql.plugin 1587119305 mysql.servers 2079085450 mysql.func 3241572444 mysql.innodb_table_stats 347867921 @@ -490,8 +1896,9 @@ DELETE FROM mysql.innodb_table_stats WHERE database_name='mysql' and table_name drop table mysql.tz; DROP ROLE role_2; DROP ROLE role_1; -drop user USER; +drop user foobar; replace into mysql.global_priv select * from backup_users; replace into mysql.tables_priv select * from tables_priv; flush privileges; drop table backup_users, tables_priv; +uninstall soname 'auth_test_plugin'; diff --git a/mysql-test/main/mysqldump-system.test b/mysql-test/main/mysqldump-system.test index c1965410167b7..85ad44211a877 100644 --- a/mysql-test/main/mysqldump-system.test +++ b/mysql-test/main/mysqldump-system.test @@ -3,9 +3,10 @@ --source include/have_udf.inc --source include/platform.inc -if (!$AUTH_SOCKET_SO) { - --skip Need auth socket plugin +if (!$AUTH_TEST_PLUGIN_SO) { + --skip Need auth test plugin } +install soname 'auth_test_plugin'; --echo # --echo # MDEV-23630: mysqldump to logically dump system tables @@ -21,7 +22,7 @@ flush privileges; # mariadb.sys because of MDEV-24098 alter user 'mariadb.sys'@'localhost' ACCOUNT UNLOCK; -create user USER; +create user foobar IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; # time zone data already loaded @@ -29,9 +30,9 @@ CREATE ROLE role_1; CREATE ROLE role_2 WITH ADMIN role_1; GRANT SHOW DATABASES ON *.* TO role_1; -GRANT role_1 TO USER; -GRANT role_2 TO USER; -SET DEFAULT ROLE role_2 FOR USER; +GRANT role_1 TO foobar; +GRANT role_2 TO foobar; +SET DEFAULT ROLE role_2 FOR foobar; ALTER TABLE mysql.roles_mapping ORDER BY Host, User, Role; @@ -42,13 +43,15 @@ create table mysql.tz like mysql.time_zone_transition; alter table mysql.tz engine=innodb; insert into mysql.tz select * from mysql.time_zone_transition; set global innodb_stats_persistent=1; +set time_zone="+03:00"; +SET TIMESTAMP= UNIX_TIMESTAMP('2022-01-07 07:07:00'); ANALYZE TABLE mysql.tz PERSISTENT FOR ALL; # for predictable output in tests delete from mysql.index_stats where prefix_arity!=1; delete from mysql.column_stats where column_name!='Time_zone_id'; -set time_zone="+03:00"; update mysql.innodb_index_stats set last_update="2020-01-01" where database_name="mysql" and table_name="tz"; update mysql.innodb_table_stats set last_update="2020-01-01" where database_name="mysql" and table_name="tz"; +update mysql.column_stats set histogram=json_replace(histogram, '$.collected_by', replace(json_value(histogram, '$.collected_by'), @@version, 'version')); set global innodb_stats_persistent= @save_innodb_stats_persistent; alter table mysql.time_zone_name ORDER BY Name; @@ -66,7 +69,7 @@ eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; --echo # mysqldump of system tables with --system=all --echo # ---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB $AUTH_TEST_PLUGIN_SO AUTH_TEST_PLUGIN_LIB --exec $MYSQL_DUMP --skip-comments --system=all @@ -74,7 +77,7 @@ eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; --echo # mysqldump of system tables with --system=all --replace --echo # ---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB $AUTH_TEST_PLUGIN_SO AUTH_TEST_PLUGIN_LIB --exec $MYSQL_DUMP --skip-comments --system=all --replace @@ -85,7 +88,7 @@ eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; --echo # mysqldump of system tables with --system=all --insert-ignore --echo # ---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB $AUTH_TEST_PLUGIN_SO AUTH_TEST_PLUGIN_LIB --exec $MYSQL_DUMP --skip-comments --system=all --insert-ignore @@ -107,7 +110,7 @@ GRANT ALL ON *.* TO mariadb_test_restore WITH GRANT OPTION; GRANT PROXY ON ''@'%' TO mariadb_test_restore WITH GRANT OPTION; GRANT SUPER, CREATE USER /*M!100502 ,FEDERATED ADMIN */ ON *.* TO mariadb_test_restore WITH GRANT OPTION; -drop user USER; +drop user foobar; delete from mysql.table_stats; delete from mysql.innodb_table_stats; delete from mysql.time_zone_transition; @@ -151,9 +154,10 @@ drop table mysql.tz; DROP ROLE role_2; DROP ROLE role_1; -drop user USER; +drop user foobar; replace into mysql.global_priv select * from backup_users; replace into mysql.tables_priv select * from tables_priv; flush privileges; drop table backup_users, tables_priv; +uninstall soname 'auth_test_plugin'; diff --git a/mysql-test/main/mysqldump-timing.result b/mysql-test/main/mysqldump-timing.result new file mode 100644 index 0000000000000..7fa1189327431 --- /dev/null +++ b/mysql-test/main/mysqldump-timing.result @@ -0,0 +1,72 @@ +# +# MDEV-18702 mysqldump should use max_statement_time=0 and/or allow setting one +# +CREATE DATABASE test1; +USE test1; +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (0); +LOCK TABLE t1 WRITE; +timeout without t1 contents expected + +/*!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` ( + `i` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +SET @save_max_statement_time=@@max_statement_time; +SET GLOBAL max_statement_time=0.1; +UNLOCK TABLES;; +This would be a race condition otherwise, but default max_statement_time=0 makes it succeed + +/*!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` ( + `i` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES +(0); +/*!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 */; + +SET GLOBAL max_statement_time=@save_max_statement_time; +DROP DATABASE test1; +# +# End of 10.3 test +# diff --git a/mysql-test/main/mysqldump-timing.test b/mysql-test/main/mysqldump-timing.test new file mode 100644 index 0000000000000..07305b73a7289 --- /dev/null +++ b/mysql-test/main/mysqldump-timing.test @@ -0,0 +1,26 @@ +--source include/not_embedded.inc + +--echo # +--echo # MDEV-18702 mysqldump should use max_statement_time=0 and/or allow setting one +--echo # + +CREATE DATABASE test1; +USE test1; +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (0); +LOCK TABLE t1 WRITE; +--echo timeout without t1 contents expected +--error 2 +--exec $MYSQL_DUMP --max-statement-time=1 --skip-lock-tables --skip-comments test1 t1 +SET @save_max_statement_time=@@max_statement_time; +SET GLOBAL max_statement_time=0.1; +--send UNLOCK TABLES; +--echo This would be a race condition otherwise, but default max_statement_time=0 makes it succeed +--exec $MYSQL_DUMP --skip-lock-tables --skip-comments test1 t1 +--reap +SET GLOBAL max_statement_time=@save_max_statement_time; +DROP DATABASE test1; + +--echo # +--echo # End of 10.3 test +--echo # diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result index eae0e1b03c68a..0a84b89b68726 100644 --- a/mysql-test/main/mysqldump.result +++ b/mysql-test/main/mysqldump.result @@ -35,7 +35,7 @@ INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` decimal(64,20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` VALUES (1234567890123456789012345678901234567890.00000000000000000000), @@ -52,7 +52,7 @@ Warning 1264 Out of range value for column 'a' at row 1 /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` VALUES (-1.7976931348623157e308); @@ -75,7 +75,7 @@ SET SQL_MODE=@OLD_SQL_MODE; CREATE TABLE `t1` ( `a` decimal(10,5) DEFAULT NULL, `b` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` VALUES (1.23450,2.3456), @@ -233,7 +233,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` varchar(255) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=koi8r; +) ENGINE=MyISAM DEFAULT CHARSET=koi8r COLLATE=koi8r_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -317,7 +317,7 @@ create table ```a` (i int); /*!40101 SET character_set_client = utf8 */; CREATE TABLE ```a` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; drop table ```a`; # @@ -340,7 +340,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -399,7 +399,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -462,7 +462,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -492,7 +492,7 @@ drop table t1; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `test`; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -556,7 +556,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` char(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -678,7 +678,7 @@ DROP TABLE IF EXISTS `t2`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t2` WRITE; @@ -722,7 +722,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `b` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -763,7 +763,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -803,7 +803,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -1507,7 +1507,7 @@ CREATE TABLE `t1` ( `F_cd00692c3bfe59267d5ecfac5310286c` int(11) DEFAULT NULL, `F_6faa8040da20ef399b63a72d0e4ab575` int(11) DEFAULT NULL, `F_fe73f687e5bc5280214e0486b273a5f9` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -1545,7 +1545,7 @@ INSERT INTO t1 VALUES (1),(2),(3); /*!40000 DROP DATABASE IF EXISTS `test`*/; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `test`; DROP TABLE IF EXISTS `t1`; @@ -1553,7 +1553,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -1600,14 +1600,14 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `t2`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -1635,14 +1635,14 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `t2`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -1690,22 +1690,22 @@ create table t2(a varchar(30) primary key, b int not null); create table t3(a varchar(30) primary key, b int not null); test_sequence ------ Testing with illegal table names ------ -mysqldump: Couldn't find table: "\d-2-1.sql" -mysqldump: Couldn't find table: "\t1" -mysqldump: Couldn't find table: "\t1" -mysqldump: Couldn't find table: "\\t1" -mysqldump: Couldn't find table: "t\1" -mysqldump: Couldn't find table: "t\1" -mysqldump: Couldn't find table: "t/1" -mysqldump: Couldn't find table: "T_1" -mysqldump: Couldn't find table: "T%1" -mysqldump: Couldn't find table: "T'1" -mysqldump: Couldn't find table: "T_1" -mysqldump: Couldn't find table: "T_" +mariadb-dump: Couldn't find table: "\d-2-1.sql" +mariadb-dump: Couldn't find table: "\t1" +mariadb-dump: Couldn't find table: "\t1" +mariadb-dump: Couldn't find table: "\\t1" +mariadb-dump: Couldn't find table: "t\1" +mariadb-dump: Couldn't find table: "t\1" +mariadb-dump: Couldn't find table: "t/1" +mariadb-dump: Couldn't find table: "T_1" +mariadb-dump: Couldn't find table: "T%1" +mariadb-dump: Couldn't find table: "T'1" +mariadb-dump: Couldn't find table: "T_1" +mariadb-dump: Couldn't find table: "T_" test_sequence ------ Testing with illegal database names ------ -mysqldump: Got error: 1049: "Unknown database 'mysqldump_test_d'" when selecting the database -mysqldump: Got error: 1049: "Unknown database 'mysqld\ump_test_db'" when selecting the database +mariadb-dump: Got error: 1049: "Unknown database 'mysqldump_test_d'" when selecting the database +mariadb-dump: Got error: 1049: "Unknown database 'mysqld\ump_test_db'" when selecting the database drop table t1, t2, t3; drop database mysqldump_test_db; use test; @@ -1821,7 +1821,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -1843,7 +1843,7 @@ CREATE TABLE `t2` ( `d` blob DEFAULT NULL, `e` text DEFAULT NULL, PRIMARY KEY (`pk`) -) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t2` WRITE; @@ -1907,7 +1907,7 @@ t1 CREATE TABLE `t1` ( `t1_id` int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`t1_id`), KEY `t1_name` (`t1_name`) -) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE `t1`; select * from t1; t1_name t1_id @@ -1921,7 +1921,7 @@ t1 CREATE TABLE `t1` ( `t1_id` int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`t1_id`), KEY `t1_name` (`t1_name`) -) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table `t1`; # # Bug#18536 wrong table order @@ -1929,6 +1929,7 @@ drop table `t1`; create table t1(a int); create table t2(a int); create table t3(a int); +mariadb-dump: Couldn't find table: "non_existing" /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1945,21 +1946,21 @@ DROP TABLE IF EXISTS `t3`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `t1`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `t2`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -1976,8 +1977,8 @@ drop table t1, t2, t3; # Bug#21288 mysqldump segmentation fault when using --where # create table t1 (a int); -mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ `a` FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': 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 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064) -mysqldump: Got error: 1064: "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 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1" when retrieving data from server +mariadb-dump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ `a` FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': 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 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064) +mariadb-dump: Got error: 1064: "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 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1" when retrieving data from server /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1994,7 +1995,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -2068,7 +2069,7 @@ CREATE TABLE `t1` ( `c"d` int(11) NOT NULL, `e``f` int(11) NOT NULL, PRIMARY KEY (`a b`,`c"d`,`e``f`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -2121,7 +2122,7 @@ DROP TABLE IF EXISTS `t2`; CREATE TABLE `t2` ( `a` varchar(30) DEFAULT NULL, KEY `a` (`a`(5)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t2` WRITE; @@ -2138,11 +2139,9 @@ DROP TABLE IF EXISTS `v2`; /*!50001 DROP VIEW IF EXISTS `v2`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v2` ( - `a` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v2` AS SELECT + 1 AS `a` */; SET character_set_client = @saved_cs_client; -/*!50001 DROP TABLE IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -2221,7 +2220,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -2232,11 +2231,9 @@ DROP TABLE IF EXISTS `v1`; /*!50001 DROP VIEW IF EXISTS `v1`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v1` ( - `a` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v1` AS SELECT + 1 AS `a` */; SET character_set_client = @saved_cs_client; -/*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -2294,7 +2291,7 @@ DROP TABLE IF EXISTS `t2`; CREATE TABLE `t2` ( `a` varchar(30) DEFAULT NULL, KEY `a` (`a`(5)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t2` WRITE; @@ -2311,11 +2308,9 @@ DROP TABLE IF EXISTS `v2`; /*!50001 DROP VIEW IF EXISTS `v2`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v2` ( - `a` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v2` AS SELECT + 1 AS `a` */; SET character_set_client = @saved_cs_client; -/*!50001 DROP TABLE IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -2365,7 +2360,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` char(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -2414,7 +2409,7 @@ CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -2429,31 +2424,27 @@ DROP TABLE IF EXISTS `v1`; /*!50001 DROP VIEW IF EXISTS `v1`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v1` ( - `a` tinyint NOT NULL, - `b` tinyint NOT NULL, - `c` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v1` AS SELECT + 1 AS `a`, + 1 AS `b`, + 1 AS `c` */; SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `v2`; /*!50001 DROP VIEW IF EXISTS `v2`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v2` ( - `a` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v2` AS SELECT + 1 AS `a` */; SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `v3`; /*!50001 DROP VIEW IF EXISTS `v3`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v3` ( - `a` tinyint NOT NULL, - `b` tinyint NOT NULL, - `c` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v3` AS SELECT + 1 AS `a`, + 1 AS `b`, + 1 AS `c` */; SET character_set_client = @saved_cs_client; -/*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -2467,7 +2458,6 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -/*!50001 DROP TABLE IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -2481,7 +2471,6 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -/*!50001 DROP TABLE IF EXISTS `v3`*/; /*!50001 DROP VIEW IF EXISTS `v3`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -2566,7 +2555,7 @@ update t1 set a = 4 where a=3; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `test`; DROP TABLE IF EXISTS `t1`; @@ -2575,7 +2564,7 @@ DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -2650,7 +2639,7 @@ DROP TABLE IF EXISTS `t2`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t2` WRITE; @@ -2699,7 +2688,7 @@ DELIMITER ; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `test`; DROP TABLE IF EXISTS `t1`; @@ -2708,7 +2697,7 @@ DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -2725,7 +2714,7 @@ DROP TABLE IF EXISTS `t2`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t2` WRITE; @@ -2850,7 +2839,7 @@ set sql_mode=''; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `test`; DROP TABLE IF EXISTS `t1`; @@ -2858,7 +2847,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -2871,6 +2860,8 @@ INSERT INTO `t1` VALUES (5); /*!40000 ALTER TABLE `t1` ENABLE KEYS */; UNLOCK TABLES; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `bug9056_func1` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2878,8 +2869,6 @@ UNLOCK TABLES; /*!50003 SET character_set_client = latin1 */ ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11) RETURN a+b ;; @@ -2888,6 +2877,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `bug9056_func2` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2895,10 +2886,8 @@ DELIMITER ; /*!50003 SET character_set_client = latin1 */ ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1) CHARSET latin1 +CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1) CHARSET latin1 COLLATE latin1_swedish_ci begin set f1= concat( 'hello', f1 ); return f1; @@ -2908,6 +2897,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI' */ ; /*!50003 DROP PROCEDURE IF EXISTS `a'b` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2915,8 +2906,6 @@ DELIMITER ; /*!50003 SET character_set_client = latin1 */ ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI' */ ; DELIMITER ;; CREATE DEFINER="root"@"localhost" PROCEDURE "a'b"() select 1 ;; @@ -2925,6 +2914,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc1` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2932,8 +2923,6 @@ DELIMITER ; /*!50003 SET character_set_client = latin1 */ ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT) BEGIN SELECT a+b INTO c; end ;; @@ -2942,6 +2931,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc2` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2949,8 +2940,6 @@ DELIMITER ; /*!50003 SET character_set_client = latin1 */ ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc2`(OUT a INT) BEGIN @@ -3006,7 +2995,7 @@ set global time_zone='Europe/Moscow'; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `test`; DROP TABLE IF EXISTS `t1`; @@ -3015,7 +3004,7 @@ DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `d` (`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -3045,7 +3034,7 @@ UNLOCK TABLES; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `test`; DROP TABLE IF EXISTS `t1`; @@ -3054,7 +3043,7 @@ DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `d` (`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -3189,7 +3178,7 @@ a b c /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `test`; DROP TABLE IF EXISTS `t1`; @@ -3199,7 +3188,7 @@ CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(32) DEFAULT NULL, `c` varchar(32) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -3214,35 +3203,31 @@ DROP TABLE IF EXISTS `v0`; /*!50001 DROP VIEW IF EXISTS `v0`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v0` ( - `a` tinyint NOT NULL, - `b` tinyint NOT NULL, - `c` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v0` AS SELECT + 1 AS `a`, + 1 AS `b`, + 1 AS `c` */; SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `v1`; /*!50001 DROP VIEW IF EXISTS `v1`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v1` ( - `a` tinyint NOT NULL, - `b` tinyint NOT NULL, - `c` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v1` AS SELECT + 1 AS `a`, + 1 AS `b`, + 1 AS `c` */; SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `v2`; /*!50001 DROP VIEW IF EXISTS `v2`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v2` ( - `a` tinyint NOT NULL, - `b` tinyint NOT NULL, - `c` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v2` AS SELECT + 1 AS `a`, + 1 AS `b`, + 1 AS `c` */; SET character_set_client = @saved_cs_client; USE `test`; -/*!50001 DROP TABLE IF EXISTS `v0`*/; /*!50001 DROP VIEW IF EXISTS `v0`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -3256,7 +3241,6 @@ USE `test`; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -/*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -3270,7 +3254,6 @@ USE `test`; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -/*!50001 DROP TABLE IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -3323,7 +3306,7 @@ SET SQL_MODE = @old_sql_mode; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `test`; DROP TABLE IF EXISTS `t1`; @@ -3331,7 +3314,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -3391,7 +3374,7 @@ DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` binary(1) DEFAULT NULL, `b` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -3426,7 +3409,7 @@ DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` binary(1) DEFAULT NULL, `b` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -3509,7 +3492,7 @@ insert into t values(5, 51); create view v1 as select qty, price, qty*price as value from t; create view v2 as select qty from v1; mysqldump { -/*!50001 DROP TABLE IF EXISTS `v1`*/; +/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -3524,7 +3507,7 @@ mysqldump { /*!50001 SET collation_connection = @saved_col_connection */; } mysqldump { -/*!50001 DROP TABLE IF EXISTS `v2`*/; +/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -3567,6 +3550,8 @@ create table t1 ( id serial ); create view v1 as select * from t1; drop table t1; mysqldump { +mariadb-dump: Got error: 1356: "View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them" when using LOCK TABLES +mariadb-dump: Couldn't execute 'SHOW FIELDS FROM `v1`': View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356) -- failed on view `v1`: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`id` AS `id` from `t1` @@ -3597,7 +3582,7 @@ insert into t1 values (0815); /*!40000 DROP DATABASE IF EXISTS `mysqldump_test_db`*/; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `mysqldump_test_db`; DROP TABLE IF EXISTS `t1`; @@ -3605,7 +3590,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -3621,13 +3606,11 @@ DROP TABLE IF EXISTS `v1`; /*!50001 DROP VIEW IF EXISTS `v1`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v1` ( - `id` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v1` AS SELECT + 1 AS `id` */; SET character_set_client = @saved_cs_client; USE `mysqldump_test_db`; -/*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -3664,7 +3647,7 @@ create database mysqldump_views; use mysqldump_views; create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_tables.basetable; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_tables` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_tables` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `mysqldump_tables`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -3673,23 +3656,22 @@ CREATE TABLE `basetable` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `tag` varchar(64) DEFAULT NULL, UNIQUE KEY `id` (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `mysqldump_views`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `nasishnasifu` ( - `id` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `nasishnasifu` AS SELECT + 1 AS `id` */; SET character_set_client = @saved_cs_client; USE `mysqldump_tables`; USE `mysqldump_views`; -/*!50001 DROP TABLE IF EXISTS `nasishnasifu`*/; +/*!50001 DROP VIEW IF EXISTS `nasishnasifu`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -3747,11 +3729,11 @@ use test; create user mysqltest_1@localhost; create table t1(a int, b varchar(34)); reset master; -mysqldump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need (at least one of) the RELOAD privilege(s) for this operation (1227) -mysqldump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need (at least one of) the RELOAD privilege(s) for this operation (1227) +mariadb-dump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need (at least one of) the RELOAD privilege(s) for this operation (1227) +mariadb-dump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need (at least one of) the RELOAD privilege(s) for this operation (1227) grant RELOAD on *.* to mysqltest_1@localhost; -mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need (at least one of) the SUPER, BINLOG MONITOR privilege(s) for this operation (1227) -mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need (at least one of) the SUPER, BINLOG MONITOR privilege(s) for this operation (1227) +mariadb-dump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need (at least one of) the SUPER, BINLOG MONITOR privilege(s) for this operation (1227) +mariadb-dump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need (at least one of) the SUPER, BINLOG MONITOR privilege(s) for this operation (1227) grant REPLICATION CLIENT on *.* to mysqltest_1@localhost; drop table t1; drop user mysqltest_1@localhost; @@ -3814,30 +3796,30 @@ DROP TABLE IF EXISTS `TABLES`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TEMPORARY TABLE `TABLES` ( - `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', - `TABLE_TYPE` varchar(64) NOT NULL DEFAULT '', - `ENGINE` varchar(64) DEFAULT NULL, - `VERSION` bigint(21) unsigned DEFAULT NULL, - `ROW_FORMAT` varchar(10) DEFAULT NULL, - `TABLE_ROWS` bigint(21) unsigned DEFAULT NULL, - `AVG_ROW_LENGTH` bigint(21) unsigned DEFAULT NULL, - `DATA_LENGTH` bigint(21) unsigned DEFAULT NULL, - `MAX_DATA_LENGTH` bigint(21) unsigned DEFAULT NULL, - `INDEX_LENGTH` bigint(21) unsigned DEFAULT NULL, - `DATA_FREE` bigint(21) unsigned DEFAULT NULL, - `AUTO_INCREMENT` bigint(21) unsigned DEFAULT NULL, - `CREATE_TIME` datetime DEFAULT NULL, - `UPDATE_TIME` datetime DEFAULT NULL, - `CHECK_TIME` datetime DEFAULT NULL, - `TABLE_COLLATION` varchar(32) DEFAULT NULL, - `CHECKSUM` bigint(21) unsigned DEFAULT NULL, - `CREATE_OPTIONS` varchar(2048) DEFAULT NULL, - `TABLE_COMMENT` varchar(2048) NOT NULL DEFAULT '', - `MAX_INDEX_LENGTH` bigint(21) unsigned DEFAULT NULL, - `TEMPORARY` varchar(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3; + `TABLE_CATALOG` varchar(512) NOT NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL, + `TABLE_NAME` varchar(64) NOT NULL, + `TABLE_TYPE` varchar(64) NOT NULL, + `ENGINE` varchar(64), + `VERSION` bigint(21) unsigned, + `ROW_FORMAT` varchar(10), + `TABLE_ROWS` bigint(21) unsigned, + `AVG_ROW_LENGTH` bigint(21) unsigned, + `DATA_LENGTH` bigint(21) unsigned, + `MAX_DATA_LENGTH` bigint(21) unsigned, + `INDEX_LENGTH` bigint(21) unsigned, + `DATA_FREE` bigint(21) unsigned, + `AUTO_INCREMENT` bigint(21) unsigned, + `CREATE_TIME` datetime, + `UPDATE_TIME` datetime, + `CHECK_TIME` datetime, + `TABLE_COLLATION` varchar(32), + `CHECKSUM` bigint(21) unsigned, + `CREATE_OPTIONS` varchar(2048), + `TABLE_COMMENT` varchar(2048) NOT NULL, + `MAX_INDEX_LENGTH` bigint(21) unsigned, + `TEMPORARY` varchar(1) +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; # # Bug#19745 mysqldump --xml produces invalid xml @@ -3866,7 +3848,10 @@ DROP TABLE t1; # CREATE TABLE t1(a int); INSERT INTO t1 VALUES (1), (2); -mysqldump: Input filename too long: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +mariadb-dump: Input filename too long: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +mariadb-dump: Got error: 1083: "Field separator argument is not what is expected; check the manual" when executing 'SELECT INTO OUTFILE' +mariadb-dump: Got error: 1083: "Field separator argument is not what is expected; check the manual" when executing 'SELECT INTO OUTFILE' +mariadb-dump: Got error: 1083: "Field separator argument is not what is expected; check the manual" when executing 'SELECT INTO OUTFILE' DROP TABLE t1; CREATE TABLE t2 (a INT) ENGINE=MyISAM; CREATE TABLE t3 (a INT) ENGINE=MyISAM; @@ -3887,14 +3872,14 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t2`,`t3`); +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`t2`,`t3`); /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `t2`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t2` WRITE; @@ -3906,7 +3891,7 @@ DROP TABLE IF EXISTS `t3`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t3` WRITE; @@ -3960,18 +3945,19 @@ grant all privileges on mysqldump_test_db.* to user2; connect user27293,localhost,user1,,mysqldump_test_db,$MASTER_MYPORT,$MASTER_MYSOCK; connection user27293; create procedure mysqldump_test_db.sp1() select 'hello'; +mariadb-dump: user2 has insufficient privileges to SHOW CREATE PROCEDURE `sp1`! -- insufficient privileges to SHOW CREATE PROCEDURE `sp1` -- does user2 have permissions on mysql.proc? +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = latin1 */ ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`user1`@`%` PROCEDURE `sp1`() select 'hello' ;; @@ -4080,7 +4066,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -4091,11 +4077,9 @@ DROP TABLE IF EXISTS `v2`; /*!50001 DROP VIEW IF EXISTS `v2`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v2` ( - `c` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v2` AS SELECT + 1 AS `c` */; SET character_set_client = @saved_cs_client; -/*!50001 DROP TABLE IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -4194,6 +4178,7 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +mariadb-dump: Got error: 1146: "Table 'test.???????????????????????' doesn't exist" when using LOCK TABLES /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -4227,7 +4212,7 @@ DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -4421,6 +4406,7 @@ Abernathy aberrant aberration drop table words; +mariadb-import: Error: 1146, Table 'test.words' doesn't exist, when using table: words drop table t1; drop table t2; drop table words2; @@ -4497,7 +4483,7 @@ insert into t1 values (0815); /*!40000 DROP DATABASE IF EXISTS `mysqldump_test_db`*/; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `mysqldump_test_db`; DROP TABLE IF EXISTS `t1`; @@ -4505,7 +4491,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `t1` WRITE; @@ -4521,13 +4507,11 @@ DROP TABLE IF EXISTS `v1`; /*!50001 DROP VIEW IF EXISTS `v1`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v1` ( - `id` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v1` AS SELECT + 1 AS `id` */; SET character_set_client = @saved_cs_client; USE `mysqldump_test_db`; -/*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -4606,6 +4590,7 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E # MDEV-13336: add ignore-database option # with --all-databases # +SET GLOBAL innodb_max_purge_lag_wait=0; DROP DATABASE test; SHOW DATABASES LIKE 'test'; Database (test) @@ -4621,7 +4606,7 @@ DROP TABLE IF EXISTS `test`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `test` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `test` WRITE; /*!40000 ALTER TABLE `test` DISABLE KEYS */; @@ -4747,6 +4732,8 @@ CREATE TABLE t1 (a INT, b CHAR(10) CHARSET koi8r, c CHAR(10) CHARSET latin1); CREATE TABLE t2 LIKE t1; INSERT INTO t1 VALUES (1, 'ABC-АБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL); # error on multi-character ENCLOSED/ESCAPED BY +mariadb-dump: Got error: 1083: "Field separator argument is not what is expected; check the manual" when executing 'SELECT INTO OUTFILE' +mariadb-dump: Got error: 1083: "Field separator argument is not what is expected; check the manual" when executing 'SELECT INTO OUTFILE' # default '--default-charset' (binary): ################################################## 1 ABC-��� DEF-��� @@ -4839,7 +4826,7 @@ ALTER DATABASE `test-database` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `test` ( - `c1` varchar(10) COLLATE utf8mb3_unicode_ci DEFAULT NULL + `c1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; ALTER DATABASE `test-database` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; @@ -4997,14 +4984,14 @@ CREATE DEFINER=`root`@`localhost` EVENT `e2` ON SCHEDULE EVERY 1 SECOND STARTS ' , ' , s ,'!') ]]> @@ -5158,14 +5145,14 @@ CREATE DEFINER=`root`@`localhost` EVENT `e2` ON SCHEDULE EVERY 1 SECOND STARTS ' , ' , s ,'!') ]]> @@ -5233,6 +5220,7 @@ connection conn_1; 3 +mariadb-dump: user1 has insufficient privileges to SHOW CREATE FUNCTION `hello1`! , ', c1, '!'); , ', c1, '!') ]]> @@ -5404,7 +5392,7 @@ general_log CREATE TABLE `general_log` ( `server_id` int(10) unsigned NOT NULL, `command_type` varchar(64) NOT NULL, `argument` mediumtext NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='General log' +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='General log' SHOW CREATE TABLE mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( @@ -5421,7 +5409,7 @@ slow_log CREATE TABLE `slow_log` ( `sql_text` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `rows_affected` int(11) NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='Slow log' +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log' SET @@global.log_output= @old_log_output_state; SET @@global.slow_query_log= @old_slow_query_log_state; SET @@global.general_log= @old_general_log_state; @@ -5536,11 +5524,13 @@ ROUTINE_NAME proc one DROP DATABASE bug25717383; -Usage: mysqldump [OPTIONS] database [tables] -OR mysqldump [OPTIONS] --databases DB1 [DB2 DB3...] -OR mysqldump [OPTIONS] --all-databases -OR mysqldump [OPTIONS] --system=[SYSTEMOPTIONS]] -For more options, use mysqldump --help +mariadb-dump: Got error: 2005: "Unknown server host 'unknownhost'" when trying to connect +mariadb-dump: Couldn't execute 'SHOW SLAVE STATUS': Server has gone away (2006) +Usage: mariadb-dump [OPTIONS] database [tables] +OR mariadb-dump [OPTIONS] --databases DB1 [DB2 DB3...] +OR mariadb-dump [OPTIONS] --all-databases +OR mariadb-dump [OPTIONS] --system=[SYSTEMOPTIONS]] +For more options, use mariadb-dump --help # # MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine # @@ -5548,6 +5538,8 @@ CREATE DATABASE `a\"'``b`; USE `a\"'``b`; CREATE PROCEDURE p1() BEGIN END; ALTER DATABASE `a\"'``b` COLLATE utf8_general_ci; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; ALTER DATABASE `a\"'``b` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5555,8 +5547,6 @@ ALTER DATABASE `a\"'``b` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; /*!50003 SET character_set_client = utf8mb3 */ ; /*!50003 SET character_set_results = utf8mb3 */ ; /*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() BEGIN END ;; @@ -5597,14 +5587,14 @@ CREATE VIEW nonunique_table_view_name AS SELECT 1; ################################################## # --compact --databases db1 db2 -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */; USE `db1`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `basetable` ( `id` smallint(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `basetable` VALUES (5), @@ -5613,16 +5603,15 @@ INSERT INTO `basetable` VALUES /*!40101 SET character_set_client = utf8 */; CREATE TABLE `nonunique_table_name` ( `i3` smallint(6) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8mb3 INSERT_METHOD=LAST UNION=(`basetable`); +) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci INSERT_METHOD=LAST UNION=(`basetable`); /*!40101 SET character_set_client = @saved_cs_client */; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `nonunique_table_view_name` ( - `1` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `nonunique_table_view_name` AS SELECT + 1 AS `1` */; SET character_set_client = @saved_cs_client; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db2` /*!40100 DEFAULT CHARACTER SET utf8mb3 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db2` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */; USE `db2`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -5630,7 +5619,7 @@ USE `db2`; CREATE TABLE `nonunique_table_name` ( `i1` bigint(20) unsigned NOT NULL AUTO_INCREMENT, UNIQUE KEY `i1` (`i1`) -) ENGINE=MEMORY AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3; +) ENGINE=MEMORY AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `nonunique_table_name` VALUES (1), @@ -5639,14 +5628,14 @@ INSERT INTO `nonunique_table_name` VALUES /*!40101 SET character_set_client = utf8 */; CREATE TABLE `nonunique_table_view_name` ( `i2` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `nonunique_table_view_name` VALUES (3), (4); USE `db1`; -/*!50001 DROP TABLE IF EXISTS `nonunique_table_view_name`*/; +/*!50001 DROP VIEW IF EXISTS `nonunique_table_view_name`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -5670,7 +5659,7 @@ USE `db2`; CREATE TABLE `nonunique_table_name` ( `i1` bigint(20) unsigned NOT NULL AUTO_INCREMENT, UNIQUE KEY `i1` (`i1`) -) ENGINE=MEMORY AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3; +) ENGINE=MEMORY AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `nonunique_table_name` VALUES (1), @@ -5679,7 +5668,7 @@ INSERT INTO `nonunique_table_name` VALUES /*!40101 SET character_set_client = utf8 */; CREATE TABLE `nonunique_table_view_name` ( `i2` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `nonunique_table_view_name` VALUES (3), @@ -5688,7 +5677,7 @@ INSERT INTO `nonunique_table_view_name` VALUES ################################################## # --compact --delayed-insert --no-data-med=0 --databases db2 db1 -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db2` /*!40100 DEFAULT CHARACTER SET utf8mb3 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db2` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */; USE `db2`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -5696,7 +5685,7 @@ USE `db2`; CREATE TABLE `nonunique_table_name` ( `i1` bigint(20) unsigned NOT NULL AUTO_INCREMENT, UNIQUE KEY `i1` (`i1`) -) ENGINE=MEMORY AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3; +) ENGINE=MEMORY AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT DELAYED INTO `nonunique_table_name` VALUES (1), @@ -5705,20 +5694,20 @@ INSERT DELAYED INTO `nonunique_table_name` VALUES /*!40101 SET character_set_client = utf8 */; CREATE TABLE `nonunique_table_view_name` ( `i2` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `nonunique_table_view_name` VALUES (3), (4); -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */; USE `db1`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `basetable` ( `id` smallint(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT DELAYED INTO `basetable` VALUES (5), @@ -5727,22 +5716,21 @@ INSERT DELAYED INTO `basetable` VALUES /*!40101 SET character_set_client = utf8 */; CREATE TABLE `nonunique_table_name` ( `i3` smallint(6) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8mb3 INSERT_METHOD=LAST UNION=(`basetable`); +) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci INSERT_METHOD=LAST UNION=(`basetable`); /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `nonunique_table_name` VALUES (5), (6); SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `nonunique_table_view_name` ( - `1` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `nonunique_table_view_name` AS SELECT + 1 AS `1` */; SET character_set_client = @saved_cs_client; USE `db2`; USE `db1`; -/*!50001 DROP TABLE IF EXISTS `nonunique_table_view_name`*/; +/*!50001 DROP VIEW IF EXISTS `nonunique_table_view_name`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -5785,6 +5773,7 @@ t1_id int, CONSTRAINT fk FOREIGN KEY (t1_id) REFERENCES t1 (id) ) ENGINE = InnoDB; +mariadb-import: Error: 1452, Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`)), when using table: t2 select count(*) from t2; count(*) 1 @@ -5829,7 +5818,7 @@ INSERT INTO t1 (a) VALUES (1),(2),(3); /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `test`; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -5877,34 +5866,6 @@ DROP TABLE t1; /*!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 `innodb_index_stats`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `innodb_index_stats` ( - `database_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(199) COLLATE utf8mb3_bin NOT NULL, - `index_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `stat_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `stat_value` bigint(20) unsigned NOT NULL, - `sample_size` bigint(20) unsigned DEFAULT NULL, - `stat_description` varchar(1024) COLLATE utf8mb3_bin NOT NULL, - PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0; -/*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `innodb_table_stats`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `innodb_table_stats` ( - `database_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(199) COLLATE utf8mb3_bin NOT NULL, - `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `n_rows` bigint(20) unsigned NOT NULL, - `clustered_index_size` bigint(20) unsigned NOT NULL, - `sum_of_other_index_sizes` bigint(20) unsigned NOT NULL, - PRIMARY KEY (`database_name`,`table_name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0; -/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE IF NOT EXISTS `general_log` ( @@ -5914,7 +5875,7 @@ CREATE TABLE IF NOT EXISTS `general_log` ( `server_id` int(10) unsigned NOT NULL, `command_type` varchar(64) NOT NULL, `argument` mediumtext NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='General log'; +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='General log'; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -5932,7 +5893,35 @@ CREATE TABLE IF NOT EXISTS `slow_log` ( `sql_text` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `rows_affected` int(11) NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='Slow log'; +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log'; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `innodb_index_stats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `innodb_index_stats` ( + `database_name` varchar(64) NOT NULL, + `table_name` varchar(199) NOT NULL, + `index_name` varchar(64) NOT NULL, + `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `stat_name` varchar(64) NOT NULL, + `stat_value` bigint(20) unsigned NOT NULL, + `sample_size` bigint(20) unsigned DEFAULT NULL, + `stat_description` varchar(1024) NOT NULL, + PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `innodb_table_stats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `innodb_table_stats` ( + `database_name` varchar(64) NOT NULL, + `table_name` varchar(199) NOT NULL, + `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `n_rows` bigint(20) unsigned NOT NULL, + `clustered_index_size` bigint(20) unsigned NOT NULL, + `sum_of_other_index_sizes` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`database_name`,`table_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -5941,7 +5930,7 @@ CREATE TABLE IF NOT EXISTS `transaction_registry` ( `commit_id` bigint(20) unsigned NOT NULL, `begin_timestamp` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', `commit_timestamp` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', - `isolation_level` enum('READ-UNCOMMITTED','READ-COMMITTED','REPEATABLE-READ','SERIALIZABLE') COLLATE utf8mb3_bin NOT NULL, + `isolation_level` enum('READ-UNCOMMITTED','READ-COMMITTED','REPEATABLE-READ','SERIALIZABLE') NOT NULL, PRIMARY KEY (`transaction_id`), UNIQUE KEY `commit_id` (`commit_id`), KEY `begin_timestamp` (`begin_timestamp`), @@ -5972,18 +5961,47 @@ CREATE TABLE IF NOT EXISTS `transaction_registry` ( /*!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 */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE IF NOT EXISTS `general_log` ( + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `user_host` mediumtext NOT NULL, + `thread_id` bigint(21) unsigned NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `command_type` varchar(64) NOT NULL, + `argument` mediumtext NOT NULL +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='General log'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE IF NOT EXISTS `slow_log` ( + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `user_host` mediumtext NOT NULL, + `query_time` time(6) NOT NULL, + `lock_time` time(6) NOT NULL, + `rows_sent` int(11) NOT NULL, + `rows_examined` int(11) NOT NULL, + `db` varchar(512) NOT NULL, + `last_insert_id` int(11) NOT NULL, + `insert_id` int(11) NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `sql_text` mediumtext NOT NULL, + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log'; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `innodb_index_stats`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `innodb_index_stats` ( - `database_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(199) COLLATE utf8mb3_bin NOT NULL, - `index_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `database_name` varchar(64) NOT NULL, + `table_name` varchar(199) NOT NULL, + `index_name` varchar(64) NOT NULL, `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `stat_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `stat_name` varchar(64) NOT NULL, `stat_value` bigint(20) unsigned NOT NULL, `sample_size` bigint(20) unsigned DEFAULT NULL, - `stat_description` varchar(1024) COLLATE utf8mb3_bin NOT NULL, + `stat_description` varchar(1024) NOT NULL, PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0; /*!40101 SET character_set_client = @saved_cs_client */; @@ -5996,8 +6014,8 @@ DROP TABLE IF EXISTS `innodb_table_stats`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `innodb_table_stats` ( - `database_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(199) COLLATE utf8mb3_bin NOT NULL, + `database_name` varchar(64) NOT NULL, + `table_name` varchar(199) NOT NULL, `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `n_rows` bigint(20) unsigned NOT NULL, `clustered_index_size` bigint(20) unsigned NOT NULL, @@ -6012,41 +6030,12 @@ LOCK TABLES `innodb_table_stats` WRITE; UNLOCK TABLES; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - `user_host` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL, - `server_id` int(10) unsigned NOT NULL, - `command_type` varchar(64) NOT NULL, - `argument` mediumtext NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='General log'; -/*!40101 SET character_set_client = @saved_cs_client */; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - `user_host` mediumtext NOT NULL, - `query_time` time(6) NOT NULL, - `lock_time` time(6) NOT NULL, - `rows_sent` int(11) NOT NULL, - `rows_examined` int(11) NOT NULL, - `db` varchar(512) NOT NULL, - `last_insert_id` int(11) NOT NULL, - `insert_id` int(11) NOT NULL, - `server_id` int(10) unsigned NOT NULL, - `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL, - `rows_affected` int(11) NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='Slow log'; -/*!40101 SET character_set_client = @saved_cs_client */; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; CREATE TABLE IF NOT EXISTS `transaction_registry` ( `transaction_id` bigint(20) unsigned NOT NULL, `commit_id` bigint(20) unsigned NOT NULL, `begin_timestamp` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', `commit_timestamp` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', - `isolation_level` enum('READ-UNCOMMITTED','READ-COMMITTED','REPEATABLE-READ','SERIALIZABLE') COLLATE utf8mb3_bin NOT NULL, + `isolation_level` enum('READ-UNCOMMITTED','READ-COMMITTED','REPEATABLE-READ','SERIALIZABLE') NOT NULL, PRIMARY KEY (`transaction_id`), UNIQUE KEY `commit_id` (`commit_id`), KEY `begin_timestamp` (`begin_timestamp`), @@ -6077,18 +6066,47 @@ CREATE TABLE IF NOT EXISTS `transaction_registry` ( /*!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 */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE IF NOT EXISTS `general_log` ( + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `user_host` mediumtext NOT NULL, + `thread_id` bigint(21) unsigned NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `command_type` varchar(64) NOT NULL, + `argument` mediumtext NOT NULL +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='General log'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE IF NOT EXISTS `slow_log` ( + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `user_host` mediumtext NOT NULL, + `query_time` time(6) NOT NULL, + `lock_time` time(6) NOT NULL, + `rows_sent` int(11) NOT NULL, + `rows_examined` int(11) NOT NULL, + `db` varchar(512) NOT NULL, + `last_insert_id` int(11) NOT NULL, + `insert_id` int(11) NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `sql_text` mediumtext NOT NULL, + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log'; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `innodb_index_stats`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `innodb_index_stats` ( - `database_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(199) COLLATE utf8mb3_bin NOT NULL, - `index_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `database_name` varchar(64) NOT NULL, + `table_name` varchar(199) NOT NULL, + `index_name` varchar(64) NOT NULL, `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `stat_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `stat_name` varchar(64) NOT NULL, `stat_value` bigint(20) unsigned NOT NULL, `sample_size` bigint(20) unsigned DEFAULT NULL, - `stat_description` varchar(1024) COLLATE utf8mb3_bin NOT NULL, + `stat_description` varchar(1024) NOT NULL, PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0; /*!40101 SET character_set_client = @saved_cs_client */; @@ -6101,8 +6119,8 @@ DROP TABLE IF EXISTS `innodb_table_stats`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `innodb_table_stats` ( - `database_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(199) COLLATE utf8mb3_bin NOT NULL, + `database_name` varchar(64) NOT NULL, + `table_name` varchar(199) NOT NULL, `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `n_rows` bigint(20) unsigned NOT NULL, `clustered_index_size` bigint(20) unsigned NOT NULL, @@ -6117,41 +6135,12 @@ LOCK TABLES `innodb_table_stats` WRITE; UNLOCK TABLES; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - `user_host` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL, - `server_id` int(10) unsigned NOT NULL, - `command_type` varchar(64) NOT NULL, - `argument` mediumtext NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='General log'; -/*!40101 SET character_set_client = @saved_cs_client */; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - `user_host` mediumtext NOT NULL, - `query_time` time(6) NOT NULL, - `lock_time` time(6) NOT NULL, - `rows_sent` int(11) NOT NULL, - `rows_examined` int(11) NOT NULL, - `db` varchar(512) NOT NULL, - `last_insert_id` int(11) NOT NULL, - `insert_id` int(11) NOT NULL, - `server_id` int(10) unsigned NOT NULL, - `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL, - `rows_affected` int(11) NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='Slow log'; -/*!40101 SET character_set_client = @saved_cs_client */; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; CREATE TABLE IF NOT EXISTS `transaction_registry` ( `transaction_id` bigint(20) unsigned NOT NULL, `commit_id` bigint(20) unsigned NOT NULL, `begin_timestamp` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', `commit_timestamp` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', - `isolation_level` enum('READ-UNCOMMITTED','READ-COMMITTED','REPEATABLE-READ','SERIALIZABLE') COLLATE utf8mb3_bin NOT NULL, + `isolation_level` enum('READ-UNCOMMITTED','READ-COMMITTED','REPEATABLE-READ','SERIALIZABLE') NOT NULL, PRIMARY KEY (`transaction_id`), UNIQUE KEY `commit_id` (`commit_id`), KEY `begin_timestamp` (`begin_timestamp`), @@ -6195,7 +6184,7 @@ insert into t4 values(1); CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) INVISIBLE DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` (`a`, `b`) VALUES (1,NULL), (1,2); @@ -6204,7 +6193,7 @@ INSERT INTO `t1` (`a`, `b`) VALUES (1,NULL), CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t2` VALUES (1,2), @@ -6215,7 +6204,7 @@ CREATE TABLE `t3` ( `invisible` int(11) DEFAULT NULL, `a b c & $!@#$%^&*( )` int(11) INVISIBLE DEFAULT 4, `ds=~!@ \# $% ^ & * ( ) _ - = +` int(11) INVISIBLE DEFAULT 5 -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t3` (`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) _ - = +`) VALUES (1,4,5), (5,4,5), @@ -6225,7 +6214,7 @@ INSERT INTO `t3` (`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t4` ( `ËÏÌÏÎËÁ1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t4` VALUES (1); @@ -6235,7 +6224,7 @@ INSERT INTO `t4` VALUES CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) INVISIBLE DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` (`a`, `b`) VALUES (1,NULL), (1,2); @@ -6244,7 +6233,7 @@ INSERT INTO `t1` (`a`, `b`) VALUES (1,NULL), CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t2` (`a`, `b`) VALUES (1,2), (1,2); @@ -6254,7 +6243,7 @@ CREATE TABLE `t3` ( `invisible` int(11) DEFAULT NULL, `a b c & $!@#$%^&*( )` int(11) INVISIBLE DEFAULT 4, `ds=~!@ \# $% ^ & * ( ) _ - = +` int(11) INVISIBLE DEFAULT 5 -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t3` (`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) _ - = +`) VALUES (1,4,5), (5,4,5), @@ -6264,7 +6253,7 @@ INSERT INTO `t3` (`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t4` ( `ËÏÌÏÎËÁ1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t4` (`ËÏÌÏÎËÁ1`) VALUES (1); #Check xml @@ -6475,8 +6464,124 @@ j integer INSERT INTO t VALUES (1,1),(2,2),(3,3),(4,4); # Dump database 1 # Restore from database 1 to database 2 +ERROR 1100 (HY000) at line 45: Table 'seq_t_i' was not locked with LOCK TABLES SETVAL(`seq_t_i`, 1, 0) 1 DROP DATABASE IF EXISTS test1; DROP DATABASE IF EXISTS test2; +# +# MDEV-27186 Server fails to load a dump, taken on the same version +# Oracle mode with packages +# +CREATE DATABASE test1; +CREATE DATABASE test2; +USE test1; +SET @save_sql_mode=@@sql_mode; +SET sql_mode=ORACLE; +CREATE OR REPLACE PACKAGE pkg AS +END; +$$ +# Dump database 1 +# Restore from database 1 to database 2 +use test2; +SHOW CREATE PACKAGE pkg; +Package sql_mode Create Package character_set_client collation_connection Database Collation +pkg PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT CREATE DEFINER="root"@"localhost" PACKAGE "pkg" AS +END utf8mb3 utf8mb3_general_ci latin1_swedish_ci +DROP DATABASE test1; +DROP DATABASE test2; +SET sql_mode=@save_sql_mode; +# +# MDEV-4875 Can't restore a mysqldump if --add-drop-database meets general_log +# +CREATE DATABASE test1; +# Dump mysql database +DROP VIEW IF EXISTS mysql.user; +DROP TABLE IF EXISTS mysql.global_priv; +DROP TABLE IF EXISTS mysql.user; +DROP TABLE IF EXISTS mysql.time_zone_transition_type; +DROP TABLE IF EXISTS mysql.time_zone_transition; +DROP TABLE IF EXISTS mysql.time_zone_name; +DROP TABLE IF EXISTS mysql.time_zone_leap_second; +DROP TABLE IF EXISTS mysql.time_zone; +DROP TABLE IF EXISTS mysql.tables_priv; +DROP TABLE IF EXISTS mysql.table_stats; +DROP TABLE IF EXISTS mysql.servers; +DROP TABLE IF EXISTS mysql.roles_mapping; +DROP TABLE IF EXISTS mysql.proxies_priv; +DROP TABLE IF EXISTS mysql.procs_priv; +DROP TABLE IF EXISTS mysql.proc; +DROP TABLE IF EXISTS mysql.plugin; +DROP TABLE IF EXISTS mysql.innodb_table_stats; +DROP TABLE IF EXISTS mysql.innodb_index_stats; +DROP TABLE IF EXISTS mysql.index_stats; +DROP TABLE IF EXISTS mysql.help_topic; +DROP TABLE IF EXISTS mysql.help_relation; +DROP TABLE IF EXISTS mysql.help_keyword; +DROP TABLE IF EXISTS mysql.help_category; +DROP TABLE IF EXISTS mysql.gtid_slave_pos; +DROP TABLE IF EXISTS mysql.func; +DROP TABLE IF EXISTS mysql.event; +DROP TABLE IF EXISTS mysql.db; +DROP TABLE IF EXISTS mysql.columns_priv; +DROP TABLE IF EXISTS mysql.column_stats; +# Abbreviated contents + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/*!50106 SET GLOBAL LOG_OUTPUT=@save_log_output*/; + + + + + + + + + + + + + + + + + + +SET @save_general_log=@@GENERAL_LOG; +SET GLOBAL LOG_OUTPUT='TABLE', GLOBAL GENERAL_LOG=1; +# Restore mysql database while general log is active +# No failure at this stage is the object of the test +SELECT @@GLOBAL.LOG_OUTPUT, @@GLOBAL.GENERAL_LOG; +@@GLOBAL.LOG_OUTPUT @@GLOBAL.GENERAL_LOG +TABLE 1 +SET GLOBAL LOG_OUTPUT=DEFAULT, GLOBAL GENERAL_LOG=@save_general_log; +TRUNCATE TABLE mysql.general_log; +DROP DATABASE test1; # End of 10.3 tests diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test index 3b8130be5f86a..238d90e4cdc21 100644 --- a/mysql-test/main/mysqldump.test +++ b/mysql-test/main/mysqldump.test @@ -1,3 +1,4 @@ +--source include/no_valgrind_without_big.inc --source include/have_utf8mb4.inc call mtr.add_suppression("@003f.frm' \\(errno: 22\\)"); @@ -596,62 +597,62 @@ create table t3(a varchar(30) primary key, b int not null); --disable_query_log select '------ Testing with illegal table names ------' as test_sequence ; --enable_query_log ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 6 --exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\d-2-1.sql" 2>&1 ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 6 --exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\t1" 2>&1 ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 6 --exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\t1" 2>&1 ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 6 --exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\\\t1" 2>&1 ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 6 --exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "t\1" 2>&1 ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 6 --exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "t\\1" 2>&1 ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 6 --exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "t/1" 2>&1 ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 6 --exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T_1" 2>&1 ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 6 --exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T%1" 2>&1 ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 6 --exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T'1" 2>&1 ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 6 --exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T_1" 2>&1 ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 6 --exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T_" 2>&1 --disable_query_log select '------ Testing with illegal database names ------' as test_sequence ; --enable_query_log ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 2 --exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_d 2>&1 ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 2 --exec $MYSQL_DUMP --compact --skip-comments "mysqld\ump_test_db" 2>&1 @@ -737,9 +738,9 @@ drop table `t1`; create table t1(a int); create table t2(a int); create table t3(a int); ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 6 ---exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --force --no-data test t3 t1 non_existing t2 +--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --force --no-data test t3 t1 non_existing t2 2>&1 drop table t1, t2, t3; @@ -748,7 +749,7 @@ drop table t1, t2, t3; --echo # create table t1 (a int); ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 2 --exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --force test t1 --where="xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 2>&1 drop table t1; @@ -964,8 +965,8 @@ DROP TABLE t1, t2; [mysqltest1] port=1234 EOF ---exec $MYSQL_MY_PRINT_DEFAULTS -c $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 ---exec $MYSQL_MY_PRINT_DEFAULTS -e $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 mysqltest1 +--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-file=$MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 +--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 mysqltest1 --remove_file $MYSQLTEST_VARDIR/tmp/tmp.cnf --echo # @@ -1288,9 +1289,9 @@ create view v1 as select * from t1; drop table t1; # mysqldump gets 1356 from server, but gives us 2 --echo mysqldump { ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 2 ---exec $MYSQL_DUMP --default-character-set=utf8mb4 --force -N --compact --skip-comments test +--exec $MYSQL_DUMP --default-character-set=utf8mb4 --force -N --compact --skip-comments test 2>&1 --echo } mysqldump drop view v1; @@ -1386,13 +1387,13 @@ create table t1(a int, b varchar(34)); reset master; # Execute mysqldump, will fail on FLUSH TABLES ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 2 --exec $MYSQL_DUMP --default-character-set=utf8mb4 --compact --master-data -u mysqltest_1 test 2>&1 # Execute mysqldump, will fail on FLUSH TABLES # use --force, should no affect behaviour ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 2 --exec $MYSQL_DUMP --default-character-set=utf8mb4 --compact --force --master-data -u mysqltest_1 test 2>&1 @@ -1400,13 +1401,13 @@ reset master; grant RELOAD on *.* to mysqltest_1@localhost; # Execute mysqldump, will fail on SHOW MASTER STATUS ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 2 --exec $MYSQL_DUMP --default-character-set=utf8mb4 --compact --master-data -u mysqltest_1 test 2>&1 # Execute mysqldump, will fail on SHOW MASTER STATUS. # use --force, should not alter behaviour ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 2 --exec $MYSQL_DUMP --default-character-set=utf8mb4 --compact --force --master-data -u mysqltest_1 test 2>&1 @@ -1521,20 +1522,20 @@ CREATE TABLE t1(a int); INSERT INTO t1 VALUES (1), (2); # too long a file path causes an error ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 1 --exec $MYSQL_DUMP --default-character-set=utf8mb4 --tab=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test 2>&1 --exec $MYSQL_DUMP --default-character-set=utf8mb4 --tab=$MYSQLTEST_VARDIR/tmp/ --fields-terminated-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 2 ---exec $MYSQL_DUMP --default-character-set=utf8mb4 --tab=$MYSQLTEST_VARDIR/tmp/ --fields-enclosed-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test ---replace_result mysqldump.exe mysqldump +--exec $MYSQL_DUMP --default-character-set=utf8mb4 --tab=$MYSQLTEST_VARDIR/tmp/ --fields-enclosed-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test 2>&1 +--replace_result mariadb-dump.exe mariadb-dump --error 2 ---exec $MYSQL_DUMP --default-character-set=utf8mb4 --tab=$MYSQLTEST_VARDIR/tmp/ --fields-optionally-enclosed-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test ---replace_result mysqldump.exe mysqldump +--exec $MYSQL_DUMP --default-character-set=utf8mb4 --tab=$MYSQLTEST_VARDIR/tmp/ --fields-optionally-enclosed-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test 2>&1 +--replace_result mariadb-dump.exe mariadb-dump --error 2 ---exec $MYSQL_DUMP --default-character-set=utf8mb4 --tab=$MYSQLTEST_VARDIR/tmp/ --fields-escaped-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test +--exec $MYSQL_DUMP --default-character-set=utf8mb4 --tab=$MYSQLTEST_VARDIR/tmp/ --fields-escaped-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test 2>&1 --exec $MYSQL_DUMP --default-character-set=utf8mb4 --tab=$MYSQLTEST_VARDIR/tmp/ --lines-terminated-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test --remove_file $MYSQLTEST_VARDIR/tmp/t1.sql @@ -1606,9 +1607,9 @@ connection user27293; create procedure mysqldump_test_db.sp1() select 'hello'; ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 2 ---exec $MYSQL_DUMP -f --compact --user=user2 --password= -h 127.0.0.1 -P $MASTER_MYPORT --routines mysqldump_test_db +--exec $MYSQL_DUMP -f --compact --user=user2 --password= -h 127.0.0.1 -P $MASTER_MYPORT --routines mysqldump_test_db 2>&1 --exec $MYSQL_DUMP -f --compact --user=user1 --password= -h 127.0.0.1 -P $MASTER_MYPORT --routines mysqldump_test_db @@ -1712,9 +1713,9 @@ DROP TABLE `straße`; CREATE TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` ( f1 INT ); --exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --default-character-set=utf8 --compatible=mysql323 test ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 2 ---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --default-character-set=latin1 --compatible=mysql323 test +--exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --default-character-set=latin1 --compatible=mysql323 test 2>&1 DROP TABLE `כדשגכחךלדגכחשךדגחכךלדגכ`; SET NAMES latin1; @@ -1767,10 +1768,9 @@ select * from words2; # Drop table "words" and run with threads, should fail drop table words; ---replace_regex /.*mysqlimport(\.exe)*/mysqlimport/ ---replace_result mysqldump.exe mysqldump +--replace_regex /.*mariadb-import(\.exe)*/mariadb-import/ --error 1 ---exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data/words.dat $MYSQLTEST_VARDIR/std_data/words2.dat +--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data/words.dat $MYSQLTEST_VARDIR/std_data/words2.dat 2>&1 drop table t1; drop table t2; @@ -1924,6 +1924,8 @@ SHOW EVENTS; --echo # with --all-databases --echo # --exec $MYSQL_DUMP --default-character-set=utf8mb4 --ignore-database test --all-databases > $MYSQLTEST_VARDIR/tmp/mysqldump-MDEV-13336.sql +# Starting with MariaDB 10.6, ensure that DDL recovery will have completed. +SET GLOBAL innodb_max_purge_lag_wait=0; DROP DATABASE test; --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqldump-MDEV-13336.sql SHOW DATABASES LIKE 'test'; @@ -2119,14 +2121,14 @@ INSERT INTO t1 VALUES (1, 'ABC-АБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL); --echo # error on multi-character ENCLOSED/ESCAPED BY ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 2 ---exec $MYSQL_DUMP --disable-default-character-set --tab=$MYSQLTEST_VARDIR/tmp/ --fields-enclosed-by='12345' test t1 +--exec $MYSQL_DUMP --disable-default-character-set --tab=$MYSQLTEST_VARDIR/tmp/ --fields-enclosed-by='12345' test t1 2>&1 --remove_file $file ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 2 ---exec $MYSQL_DUMP --disable-default-character-set --tab=$MYSQLTEST_VARDIR/tmp/ --fields-escaped-by='12345' test t1 +--exec $MYSQL_DUMP --disable-default-character-set --tab=$MYSQLTEST_VARDIR/tmp/ --fields-escaped-by='12345' test t1 2>&1 --remove_file $file --echo # default '--default-charset' (binary): @@ -2338,9 +2340,9 @@ connection conn_1; --echo # Running 'replace_regex on timestamp' --replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]{2})*/--TIME--/ ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 2 ---exec $MYSQL_DUMP --user=user1 -R -E --triggers -X BUG52792 +--exec $MYSQL_DUMP --user=user1 -R -E --triggers -X BUG52792 2>&1 connection default; disconnect conn_1; @@ -2531,6 +2533,7 @@ SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE' ORDER BY ROUTINE_NAME; +--replace_result mariadb-dump.exe mariadb-dump --exec $MYSQL_DUMP --default-character-set=utf8mb4 --triggers --events --routines --add-drop-database --databases bug25717383 > $MYSQLTEST_VARDIR/tmp/bug25717383.sql SHOW TABLES FROM bug25717383; @@ -2548,16 +2551,17 @@ DROP DATABASE bug25717383; # # MDEV-6091 mysqldump goes in a loop and segfaults if --dump-slave is specified and it cannot connect to the server # +--replace_regex /mariadb-dump\.exe/mariadb-dump/ /'unknownhost' \(.*\)/'unknownhost'/ --error 2 ---exec $MYSQL_DUMP --default-character-set=utf8mb4 -hunknownhost --dump-slave nulldb +--exec $MYSQL_DUMP --default-character-set=utf8mb4 -hunknownhost --dump-slave nulldb 2>&1 # # MDEV-6056 [PATCH] mysqldump writes usage to stdout even when not explicitly requested # ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 1 ---exec $MYSQL_DUMP --default-character-set=utf8mb4 --user=foo 2>&1 > $MYSQLTEST_VARDIR/tmp/bug6056.out ---exec $MYSQL_DUMP --help > $MYSQLTEST_VARDIR/tmp/bug6056.out +--exec $MYSQL_DUMP --default-character-set=utf8mb4 --user=foo 2>&1 +--exec $MYSQL_DUMP --help 2>&1 > $MYSQLTEST_VARDIR/tmp/bug6056.out --echo # --echo # MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine @@ -2677,8 +2681,9 @@ create table t2 ( 0 EOF +--replace_regex /.*mariadb-import(\.exe)*/mariadb-import/ --error 1 ---exec $MYSQL_IMPORT --silent test $MYSQLTEST_VARDIR/tmp/t2.txt +--exec $MYSQL_IMPORT --silent test $MYSQLTEST_VARDIR/tmp/t2.txt 2>&1 --exec $MYSQL_IMPORT --silent -k test $MYSQLTEST_VARDIR/tmp/t2.txt select count(*) from t2; @@ -2881,10 +2886,100 @@ INSERT INTO t VALUES (1,1),(2,2),(3,3),(4,4); --echo # Restore from database 1 to database 2 --error 1 ---exec $MYSQL test2 < $MYSQLTEST_VARDIR/tmp/dumptest1.sql +--exec $MYSQL test2 < $MYSQLTEST_VARDIR/tmp/dumptest1.sql 2>&1 --remove_file $MYSQLTEST_VARDIR/tmp/dumptest1.sql DROP DATABASE IF EXISTS test1; DROP DATABASE IF EXISTS test2; +--echo # +--echo # MDEV-27186 Server fails to load a dump, taken on the same version +--echo # Oracle mode with packages +--echo # + +CREATE DATABASE test1; +CREATE DATABASE test2; +USE test1; +SET @save_sql_mode=@@sql_mode; +SET sql_mode=ORACLE; + +DELIMITER $$; +CREATE OR REPLACE PACKAGE pkg AS +END; +$$ + +DELIMITER ;$$ + +--echo # Dump database 1 +--exec $MYSQL_DUMP --routines test1 > $MYSQLTEST_VARDIR/tmp/dumptest1.sql +--echo # Restore from database 1 to database 2 + +--exec $MYSQL test2 < $MYSQLTEST_VARDIR/tmp/dumptest1.sql +use test2; +SHOW CREATE PACKAGE pkg; + +DROP DATABASE test1; +DROP DATABASE test2; +SET sql_mode=@save_sql_mode; +--remove_file $MYSQLTEST_VARDIR/tmp/dumptest1.sql + +--echo # +--echo # MDEV-4875 Can't restore a mysqldump if --add-drop-database meets general_log +--echo # + +CREATE DATABASE test1; +--echo # Dump mysql database +--exec $MYSQL_DUMP --add-drop-database --databases mysql test1 > $MYSQLTEST_VARDIR/tmp/dumptest1.sql + +--disable_warnings +DROP VIEW IF EXISTS mysql.user; +DROP TABLE IF EXISTS mysql.global_priv; +DROP TABLE IF EXISTS mysql.user; +--enable_warnings +#DROP TABLE IF EXISTS mysql.transaction_registry; +#DROP TABLE IF EXISTS mysql.slow_log; +#DROP TABLE IF EXISTS mysql.general_log; +DROP TABLE IF EXISTS mysql.time_zone_transition_type; +DROP TABLE IF EXISTS mysql.time_zone_transition; +DROP TABLE IF EXISTS mysql.time_zone_name; +DROP TABLE IF EXISTS mysql.time_zone_leap_second; +DROP TABLE IF EXISTS mysql.time_zone; +DROP TABLE IF EXISTS mysql.tables_priv; +DROP TABLE IF EXISTS mysql.table_stats; +DROP TABLE IF EXISTS mysql.servers; +DROP TABLE IF EXISTS mysql.roles_mapping; +DROP TABLE IF EXISTS mysql.proxies_priv; +DROP TABLE IF EXISTS mysql.procs_priv; +DROP TABLE IF EXISTS mysql.proc; +DROP TABLE IF EXISTS mysql.plugin; +DROP TABLE IF EXISTS mysql.innodb_table_stats; +DROP TABLE IF EXISTS mysql.innodb_index_stats; +DROP TABLE IF EXISTS mysql.index_stats; +DROP TABLE IF EXISTS mysql.help_topic; +DROP TABLE IF EXISTS mysql.help_relation; +DROP TABLE IF EXISTS mysql.help_keyword; +DROP TABLE IF EXISTS mysql.help_category; +DROP TABLE IF EXISTS mysql.gtid_slave_pos; +DROP TABLE IF EXISTS mysql.func; +DROP TABLE IF EXISTS mysql.event; +DROP TABLE IF EXISTS mysql.db; +DROP TABLE IF EXISTS mysql.columns_priv; +DROP TABLE IF EXISTS mysql.column_stats; + +--echo # Abbreviated contents +--replace_regex /Create_time="[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}"/Create_time="TIMESTAMP"/ +--exec $MYSQL_DUMP --xml --skip-comments --no-data --add-drop-database --databases mysql test1 + +SET @save_general_log=@@GENERAL_LOG; +SET GLOBAL LOG_OUTPUT='TABLE', GLOBAL GENERAL_LOG=1; + +--echo # Restore mysql database while general log is active +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/dumptest1.sql +--echo # No failure at this stage is the object of the test +SELECT @@GLOBAL.LOG_OUTPUT, @@GLOBAL.GENERAL_LOG; +SET GLOBAL LOG_OUTPUT=DEFAULT, GLOBAL GENERAL_LOG=@save_general_log; +TRUNCATE TABLE mysql.general_log; +DROP DATABASE test1; +--remove_file $MYSQLTEST_VARDIR/tmp/dumptest1.sql + --echo # End of 10.3 tests diff --git a/mysql-test/main/mysqltest.result b/mysql-test/main/mysqltest.result index c8fe81c4d7761..73f2c8851f913 100644 --- a/mysql-test/main/mysqltest.result +++ b/mysql-test/main/mysqltest.result @@ -500,7 +500,7 @@ anything goes 0 != string mysqltest: At line 2: Only == and != are supported for string values mysqltest: At line 2: Found junk '~= 6' after $variable in condition -mysqltest: At line 2: Expression in if/while must beging with $, ` or a number +mysqltest: At line 2: Expression in if/while must begin with $, ` or a number mysqltest: At line 1: Missing right operand in comparison mysqltest: At line 1: Missing right operand in comparison counter is 2 diff --git a/mysql-test/main/mysqltest_tracking_info.result b/mysql-test/main/mysqltest_tracking_info.result index 61bb3f2d1e29a..791f2a2b4a4ce 100644 --- a/mysql-test/main/mysqltest_tracking_info.result +++ b/mysql-test/main/mysqltest_tracking_info.result @@ -38,7 +38,7 @@ SET @@session.session_track_system_variables='optimizer_switch'; set optimizer_switch='index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=on,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off'; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- optimizer_switch --- index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=on,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off +-- index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=on,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=off Warnings: Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release diff --git a/mysql-test/main/name_resolution_cache_debug.result b/mysql-test/main/name_resolution_cache_debug.result new file mode 100644 index 0000000000000..7030176c5fe8e --- /dev/null +++ b/mysql-test/main/name_resolution_cache_debug.result @@ -0,0 +1,25 @@ +connect con1,localhost,root; +create table t1 (a int, b int); +create table t2 (c int, d int); +create view v1 as select c+1 as e, d+1 as f from t2; +SET DEBUG_SYNC= 'table_field_cached SIGNAL in_sync WAIT_FOR go'; +prepare stmt1 from "select a from t1"; +execute stmt1; +connection default; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +SET DEBUG_SYNC= 'now SIGNAL go'; +connection con1; +a +SET DEBUG_SYNC= 'table_field_cached SIGNAL in_sync WAIT_FOR go'; +prepare stmt1 from "select e from v1"; +execute stmt1; +connection default; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +SET DEBUG_SYNC= 'now SIGNAL go'; +connection con1; +e +connection default; +disconnect con1; +SET DEBUG_SYNC = 'RESET'; +drop view v1; +drop table t1,t2; diff --git a/mysql-test/main/name_resolution_cache_debug.test b/mysql-test/main/name_resolution_cache_debug.test new file mode 100644 index 0000000000000..362d883cbd1d7 --- /dev/null +++ b/mysql-test/main/name_resolution_cache_debug.test @@ -0,0 +1,36 @@ + +source include/have_debug_sync.inc; + +connect con1,localhost,root; +create table t1 (a int, b int); +create table t2 (c int, d int); +create view v1 as select c+1 as e, d+1 as f from t2; + +SET DEBUG_SYNC= 'table_field_cached SIGNAL in_sync WAIT_FOR go'; +prepare stmt1 from "select a from t1"; +--send execute stmt1 + +connection default; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +SET DEBUG_SYNC= 'now SIGNAL go'; + +connection con1; +--reap + +SET DEBUG_SYNC= 'table_field_cached SIGNAL in_sync WAIT_FOR go'; +prepare stmt1 from "select e from v1"; +--send execute stmt1 + +connection default; +SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; +SET DEBUG_SYNC= 'now SIGNAL go'; + +connection con1; +--reap + +connection default; +disconnect con1; + +SET DEBUG_SYNC = 'RESET'; +drop view v1; +drop table t1,t2; diff --git a/mysql-test/main/natural_sort_key.result b/mysql-test/main/natural_sort_key.result index 2b45addd1c6c2..218a3e2cd9cb0 100644 --- a/mysql-test/main/natural_sort_key.result +++ b/mysql-test/main/natural_sort_key.result @@ -58,7 +58,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `c` varchar(30) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL, `NATURAL_SORT_KEY(c)` varchar(45) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE TABLE t1(c VARCHAR(1), k VARCHAR(2) AS (NATURAL_SORT_KEY(c)) STORED); ERROR HY000: Function or expression 'natural_sort_key()' cannot be used in the GENERATED ALWAYS AS clause of `k` diff --git a/mysql-test/main/no-threads.test b/mysql-test/main/no-threads.test index a2936abf7840c..c1a608a57e682 100644 --- a/mysql-test/main/no-threads.test +++ b/mysql-test/main/no-threads.test @@ -1,3 +1,7 @@ +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + --source include/one_thread_per_connection.inc # # Test the --thread-handler=no-threads option diff --git a/mysql-test/main/null.result b/mysql-test/main/null.result index 16a51d2d931ac..755108be267b6 100644 --- a/mysql-test/main/null.result +++ b/mysql-test/main/null.result @@ -236,44 +236,44 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c00` binary(0) DEFAULT NULL, - `c01` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c02` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c03` varchar(6) CHARACTER SET latin2 NOT NULL, - `c04` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c05` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c06` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c07` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c08` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c09` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c10` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c11` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c12` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c13` varchar(6) CHARACTER SET latin2 DEFAULT NULL, + `c01` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c02` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c03` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci NOT NULL, + `c04` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c05` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c06` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c07` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c08` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c09` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c10` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c11` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c12` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c13` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, `c14` binary(0) DEFAULT NULL, - `c15` char(0) CHARACTER SET latin2 DEFAULT NULL, - `c16` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c17` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c18` char(0) CHARACTER SET latin2 DEFAULT NULL, - `c19` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c20` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c21` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c22` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c23` varchar(9) CHARACTER SET latin2 DEFAULT NULL, - `c24` varchar(9) CHARACTER SET latin2 DEFAULT NULL, - `c25` varchar(12) CHARACTER SET latin2 DEFAULT NULL, - `c26` varchar(7) CHARACTER SET latin2 DEFAULT NULL, - `c27` varchar(7) CHARACTER SET latin2 DEFAULT NULL, - `c29` varchar(381) CHARACTER SET latin2 DEFAULT NULL, - `c30` varchar(317) CHARACTER SET latin2 DEFAULT NULL, - `c31` varchar(192) CHARACTER SET latin2 DEFAULT NULL, - `c32` char(0) CHARACTER SET latin2 DEFAULT NULL, - `c33` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c34` varchar(3) CHARACTER SET latin2 DEFAULT NULL, - `c35` varchar(3) CHARACTER SET latin2 DEFAULT NULL, - `c36` varchar(3) CHARACTER SET latin2 DEFAULT NULL, - `c37` varchar(10) CHARACTER SET latin2 DEFAULT NULL, - `c38` varchar(10) CHARACTER SET latin2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c15` char(0) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c16` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c17` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c18` char(0) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c19` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c20` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c21` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c22` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c23` varchar(9) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c24` varchar(9) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c25` varchar(12) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c26` varchar(7) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c27` varchar(7) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c29` varchar(381) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c30` varchar(317) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c31` varchar(192) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c32` char(0) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c33` varchar(6) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c34` varchar(3) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c35` varchar(3) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c36` varchar(3) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c37` varchar(10) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL, + `c38` varchar(10) CHARACTER SET latin2 COLLATE latin2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select case 'str' when 'STR' then 'str' when null then 'null' end as c01, @@ -310,21 +310,21 @@ bug19145a CREATE TABLE `bug19145a` ( `e` enum('a','b','c') DEFAULT NULL, `s` set('x','y','z') DEFAULT NULL, `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table bug19145b; Table Create Table bug19145b CREATE TABLE `bug19145b` ( `e` enum('a','b','c') DEFAULT NULL, `s` set('x','y','z') DEFAULT NULL, `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table bug19145c; Table Create Table bug19145c CREATE TABLE `bug19145c` ( `e` enum('a','b','c') NOT NULL DEFAULT 'b', `s` set('x','y','z') NOT NULL DEFAULT 'y', `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table bug19145a; drop table bug19145b; drop table bug19145c; @@ -430,7 +430,7 @@ t2 CREATE TABLE `t2` ( `a` time DEFAULT NULL, `NULLIF(a,a)` time DEFAULT NULL, `CASE WHEN a=a THEN NULL ELSE a END` time DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; SELECT NULLIF(_latin1'a' COLLATE latin1_general_ci, _latin1'a' COLLATE latin1_bin); ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'nullif' @@ -442,7 +442,7 @@ NULLIF(1,1e0), NULLIF(1,'2001-01-01'), NULLIF(1,TIME'00:00:00'); Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '2001-01-01' +Warning 1292 Truncated incorrect DECIMAL value: '2001-01-01' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -451,7 +451,7 @@ t1 CREATE TABLE `t1` ( `NULLIF(1,1e0)` int(1) DEFAULT NULL, `NULLIF(1,'2001-01-01')` int(1) DEFAULT NULL, `NULLIF(1,TIME'00:00:00')` int(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT @@ -470,7 +470,7 @@ t1 CREATE TABLE `t1` ( `NULLIF(1.0,1e0)` decimal(2,1) DEFAULT NULL, `NULLIF(1.0,'2001-01-01')` decimal(2,1) DEFAULT NULL, `NULLIF(1.0,TIME'00:00:00')` decimal(2,1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT @@ -489,7 +489,7 @@ t1 CREATE TABLE `t1` ( `NULLIF(1e0,1e0)` double DEFAULT NULL, `NULLIF(1e0,'2001-01-01')` double DEFAULT NULL, `NULLIF(1e0,TIME'00:00:00')` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT NULLIF('1',1), @@ -505,7 +505,7 @@ t1 CREATE TABLE `t1` ( `NULLIF('1',1e0)` varchar(1) DEFAULT NULL, `NULLIF('1','2001-01-01')` varchar(1) DEFAULT NULL, `NULLIF('1',TIME'00:00:00')` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT @@ -526,7 +526,7 @@ t1 CREATE TABLE `t1` ( `NULLIF(TIMESTAMP'2001-01-01 00:00:00',1e0)` datetime DEFAULT NULL, `NULLIF(TIMESTAMP'2001-01-01 00:00:00','2001-01-01')` datetime DEFAULT NULL, `NULLIF(TIMESTAMP'2001-01-01 00:00:00',TIME'00:00:00')` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT @@ -547,7 +547,7 @@ t1 CREATE TABLE `t1` ( `NULLIF(DATE'2001-01-01',1e0)` date DEFAULT NULL, `NULLIF(DATE'2001-01-01','2001-01-01')` date DEFAULT NULL, `NULLIF(DATE'2001-01-01',TIME'00:00:00')` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT NULLIF(TIME'00:00:01',1), @@ -563,7 +563,7 @@ t1 CREATE TABLE `t1` ( `NULLIF(TIME'00:00:01',1e0)` time DEFAULT NULL, `NULLIF(TIME'00:00:01','00:00:00')` time DEFAULT NULL, `NULLIF(TIME'00:00:01',DATE'2001-01-01')` time DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( @@ -629,7 +629,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_tinyint, c_timestamp3)` tinyint(4) DEFAULT NULL, `NULLIF(c_tinyint, c_date)` tinyint(4) DEFAULT NULL, `NULLIF(c_tinyint, c_time)` tinyint(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_smallint, 1), @@ -668,7 +668,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_smallint, c_timestamp3)` smallint(6) DEFAULT NULL, `NULLIF(c_smallint, c_date)` smallint(6) DEFAULT NULL, `NULLIF(c_smallint, c_time)` smallint(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_int, 1), @@ -707,7 +707,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_int, c_timestamp3)` int(11) DEFAULT NULL, `NULLIF(c_int, c_date)` int(11) DEFAULT NULL, `NULLIF(c_int, c_time)` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_bigint, 1), @@ -746,7 +746,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_bigint, c_timestamp3)` bigint(20) DEFAULT NULL, `NULLIF(c_bigint, c_date)` bigint(20) DEFAULT NULL, `NULLIF(c_bigint, c_time)` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_float, 1), @@ -785,7 +785,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_float, c_timestamp3)` float DEFAULT NULL, `NULLIF(c_float, c_date)` float DEFAULT NULL, `NULLIF(c_float, c_time)` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_double, 1), @@ -824,7 +824,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_double, c_timestamp3)` double DEFAULT NULL, `NULLIF(c_double, c_date)` double DEFAULT NULL, `NULLIF(c_double, c_time)` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_decimal103, 1), @@ -863,7 +863,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_decimal103, c_timestamp3)` decimal(10,3) DEFAULT NULL, `NULLIF(c_decimal103, c_date)` decimal(10,3) DEFAULT NULL, `NULLIF(c_decimal103, c_time)` decimal(10,3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_varchar10, 1), @@ -902,7 +902,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_varchar10, c_timestamp3)` varchar(10) DEFAULT NULL, `NULLIF(c_varchar10, c_date)` varchar(10) DEFAULT NULL, `NULLIF(c_varchar10, c_time)` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_tinytext, 1), @@ -941,7 +941,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_tinytext, c_timestamp3)` tinytext DEFAULT NULL, `NULLIF(c_tinytext, c_date)` tinytext DEFAULT NULL, `NULLIF(c_tinytext, c_time)` tinytext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_text, 1), @@ -980,7 +980,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_text, c_timestamp3)` text DEFAULT NULL, `NULLIF(c_text, c_date)` text DEFAULT NULL, `NULLIF(c_text, c_time)` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_mediumtext, 1), @@ -1019,7 +1019,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_mediumtext, c_timestamp3)` mediumtext DEFAULT NULL, `NULLIF(c_mediumtext, c_date)` mediumtext DEFAULT NULL, `NULLIF(c_mediumtext, c_time)` mediumtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_longtext, 1), @@ -1058,7 +1058,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_longtext, c_timestamp3)` longtext DEFAULT NULL, `NULLIF(c_longtext, c_date)` longtext DEFAULT NULL, `NULLIF(c_longtext, c_time)` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_tinyblob, 1), @@ -1097,7 +1097,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_tinyblob, c_timestamp3)` tinyblob DEFAULT NULL, `NULLIF(c_tinyblob, c_date)` tinyblob DEFAULT NULL, `NULLIF(c_tinyblob, c_time)` tinyblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_blob, 1), @@ -1136,7 +1136,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_blob, c_timestamp3)` blob DEFAULT NULL, `NULLIF(c_blob, c_date)` blob DEFAULT NULL, `NULLIF(c_blob, c_time)` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_mediumblob, 1), @@ -1175,7 +1175,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_mediumblob, c_timestamp3)` mediumblob DEFAULT NULL, `NULLIF(c_mediumblob, c_date)` mediumblob DEFAULT NULL, `NULLIF(c_mediumblob, c_time)` mediumblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_longblob, 1), @@ -1214,7 +1214,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_longblob, c_timestamp3)` longblob DEFAULT NULL, `NULLIF(c_longblob, c_date)` longblob DEFAULT NULL, `NULLIF(c_longblob, c_time)` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_enum, 1), @@ -1253,7 +1253,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_enum, c_timestamp3)` varchar(4) DEFAULT NULL, `NULLIF(c_enum, c_date)` varchar(4) DEFAULT NULL, `NULLIF(c_enum, c_time)` varchar(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_datetime3, 1), @@ -1292,7 +1292,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_datetime3, c_timestamp3)` datetime(3) DEFAULT NULL, `NULLIF(c_datetime3, c_date)` datetime(3) DEFAULT NULL, `NULLIF(c_datetime3, c_time)` datetime(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_timestamp3, 1), @@ -1331,7 +1331,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_timestamp3, c_timestamp3)` timestamp(3) NULL DEFAULT NULL, `NULLIF(c_timestamp3, c_date)` timestamp(3) NULL DEFAULT NULL, `NULLIF(c_timestamp3, c_time)` timestamp(3) NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_date, 1), @@ -1370,7 +1370,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_date, c_timestamp3)` date DEFAULT NULL, `NULLIF(c_date, c_date)` date DEFAULT NULL, `NULLIF(c_date, c_time)` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(c_time, 1), @@ -1409,7 +1409,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(c_time, c_timestamp3)` time DEFAULT NULL, `NULLIF(c_time, c_date)` time DEFAULT NULL, `NULLIF(c_time, c_time)` time DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; # # Checking that the return type depends only on args[0], even if compared to a field @@ -1451,7 +1451,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(1, c_timestamp3)` int(1) DEFAULT NULL, `NULLIF(1, c_date)` int(1) DEFAULT NULL, `NULLIF(1, c_time)` int(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(1.0, 1), @@ -1490,7 +1490,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(1.0, c_timestamp3)` decimal(2,1) DEFAULT NULL, `NULLIF(1.0, c_date)` decimal(2,1) DEFAULT NULL, `NULLIF(1.0, c_time)` decimal(2,1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(1e0, 1), @@ -1529,7 +1529,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(1e0, c_timestamp3)` double DEFAULT NULL, `NULLIF(1e0, c_date)` double DEFAULT NULL, `NULLIF(1e0, c_time)` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF('1', 1), @@ -1568,7 +1568,7 @@ t2 CREATE TABLE `t2` ( `NULLIF('1', c_timestamp3)` varchar(1) DEFAULT NULL, `NULLIF('1', c_date)` varchar(1) DEFAULT NULL, `NULLIF('1', c_time)` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT NULLIF(TIME'10:10:10', 1), @@ -1607,7 +1607,7 @@ t2 CREATE TABLE `t2` ( `NULLIF(TIME'10:10:10', c_timestamp3)` time DEFAULT NULL, `NULLIF(TIME'10:10:10', c_date)` time DEFAULT NULL, `NULLIF(TIME'10:10:10', c_time)` time DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # diff --git a/mysql-test/main/null.test b/mysql-test/main/null.test index 4e230f72543a9..3741ec0f8ea47 100644 --- a/mysql-test/main/null.test +++ b/mysql-test/main/null.test @@ -7,6 +7,9 @@ drop table if exists t1, t2; # Testing of NULL in a lot of different places # +#enable view protocol after fix MDEV-28535 +--disable_view_protocol + select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null; explain extended select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null; select 1 | NULL,1 & NULL,1+NULL,1-NULL; @@ -24,6 +27,8 @@ select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226." explain extended select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton(""); select not null is true, not null or true, not null and false, not null <=> null; +--enable_view_protocol + create table t1 (x int); insert into t1 values (null); select * from t1 where x != 0; @@ -1061,7 +1066,14 @@ SELECT NULLIF(COUNT(c1),0) FROM t1; SELECT CASE WHEN COUNT(c1)=0 THEN NULL ELSE COUNT(c1) END FROM t1; SELECT NULLIF(COUNT(c1)+0,0) AS c1,NULLIF(CAST(COUNT(c1) AS SIGNED),0) AS c2,NULLIF(CONCAT(COUNT(c1)),0) AS c3 FROM t1; SELECT NULLIF(COUNT(DISTINCT c1),0) FROM t1; + +#enable view protocol after fix MDEV-27871 +--disable_view_protocol + SELECT CASE WHEN COUNT(DISTINCT c1)=0 THEN NULL ELSE COUNT(DISTINCT c1) END FROM t1; + +--enable_view_protocol + DROP TABLE t1; CREATE TABLE t1 ( @@ -1124,12 +1136,17 @@ drop table t1; # # MDEV-9641 Assertion `args[0] == args[2] || _current_thd()->lex->context_analysis_only' failed in Item_func_nullif::print(String*, enum_query_type) # + +#it is necessary that the view protocol uses the same connection, +# not util connection +--disable_service_connection set names utf8; create table t1 (f1 varchar(10)); insert into t1 values ('2015-12-31'); --error ER_DATA_OUT_OF_RANGE select power( timestamp( nullif( '2002-09-08', f1 ) ), 24 ) from t1; drop table t1; +--enable_service_connection # # MDEV-9682 Assertion `0' failed in Item_cache_row::illegal_method_call on 2nd execution of PS with NULLIF diff --git a/mysql-test/main/null_key.test b/mysql-test/main/null_key.test index a5781cc8524ef..7eabd6d5dc33b 100644 --- a/mysql-test/main/null_key.test +++ b/mysql-test/main/null_key.test @@ -235,8 +235,11 @@ EXPLAIN SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a FLUSH STATUS ; SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b; + +--disable_view_protocol SELECT FOUND_ROWS(); SHOW STATUS LIKE "handler_read%"; +--enable_view_protocol DROP TABLE t1,t2,t3,t4; # End of 4.1 tests diff --git a/mysql-test/main/olap.result b/mysql-test/main/olap.result index 93eda747d839d..b837aeaf1dbc9 100644 --- a/mysql-test/main/olap.result +++ b/mysql-test/main/olap.result @@ -1,4 +1,3 @@ -drop table if exists t1,t2; set @sav_dpi= @@div_precision_increment; set div_precision_increment= 5; show variables like 'div_precision_increment'; @@ -696,7 +695,7 @@ CREATE VIEW v1 AS SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP; DESC v1; Field Type Null Key Default Extra -a int(11) YES 0 +a int(11) YES NULL LENGTH(a) int(10) YES NULL COUNT(*) bigint(21) NO 0 SELECT * FROM v1; @@ -859,7 +858,7 @@ INSERT INTO t1 VALUES (1),(2); CREATE OR REPLACE VIEW v1 AS SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP; DESCRIBE v1; Field Type Null Key Default Extra -a int(11) YES 0 +a int(11) YES NULL LENGTH(a) int(10) YES NULL COUNT(*) bigint(21) NO 0 DROP VIEW v1; @@ -869,7 +868,7 @@ INSERT INTO t1 VALUES (1),(2); CREATE OR REPLACE VIEW v1 AS SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP; DESCRIBE v1; Field Type Null Key Default Extra -a bigint(20) YES 0 +a bigint(20) YES NULL LENGTH(a) int(10) YES NULL COUNT(*) bigint(21) NO 0 DROP VIEW v1; @@ -894,8 +893,8 @@ DROP VIEW v1; CREATE VIEW v1 AS SELECT a, b FROM t1 GROUP BY a,b WITH ROLLUP; DESC v1; Field Type Null Key Default Extra -a int(11) YES 0 -b int(20) YES 0 +a int(11) YES NULL +b int(20) YES NULL DROP VIEW v1; DROP TABLE t1; # diff --git a/mysql-test/main/olap.test b/mysql-test/main/olap.test index 078eacb851b8b..59c30da52ca8f 100644 --- a/mysql-test/main/olap.test +++ b/mysql-test/main/olap.test @@ -1,7 +1,3 @@ ---disable_warnings -drop table if exists t1,t2; ---enable_warnings - set @sav_dpi= @@div_precision_increment; set div_precision_increment= 5; show variables like 'div_precision_increment'; @@ -55,7 +51,10 @@ select product, country_id , year, sum(profit) from t1 group by product, country select concat(product,':',country_id) as 'prod', concat(":",year,":") as 'year',1+1, sum(profit)/count(*) from t1 group by 1,2 with rollup; select product, sum(profit)/count(*) from t1 group by product with rollup; select left(product,4) as prod, sum(profit)/count(*) from t1 group by prod with rollup; +#check after fix MDEV-29601 +--disable_service_connection select concat(product,':',country_id), 1+1, sum(profit)/count(*) from t1 group by concat(product,':',country_id) with rollup; +--enable_service_connection # Joins select product, country , year, sum(profit) from t1,t2 where t1.country_id=t2.country_id group by product, country, year with rollup; @@ -214,10 +213,15 @@ SELECT a, SUM(a), SUM(a)+1 FROM (SELECT 1 a UNION select 2) d SELECT a, SUM(a), SUM(a)+1 FROM (SELECT 1 a UNION select 2) d GROUP BY a WITH ROLLUP; +#enable view protocol after fix MDEV-28535 +--disable_view_protocol + SELECT a, SUM(a), SUM(a)+1, CONCAT(SUM(a),'x'), SUM(a)+SUM(a), SUM(a) FROM (SELECT 1 a, 2 b UNION SELECT 2,3 UNION SELECT 5,6 ) d GROUP BY a WITH ROLLUP; +--enable_view_protocol + DROP TABLE t1; # @@ -254,6 +258,9 @@ DROP TABLE t1,t2; # Test for bug #11543: ROLLUP query with a repeated column in GROUP BY # +#enable view protocol after fix MDEV-28536 +--disable_view_protocol + CREATE TABLE t1 (a INT(10) NOT NULL, b INT(10) NOT NULL); INSERT INTO t1 VALUES (1, 1); INSERT INTO t1 VALUES (1, 2); @@ -262,6 +269,8 @@ SELECT a, b, a AS c, COUNT(*) AS count FROM t1 GROUP BY a, b, c WITH ROLLUP; DROP TABLE t1; +--enable_view_protocol + # Bug #12885(1): derived table specified by a subquery with # ROLLUP over expressions on not nullable group by attributes # @@ -444,12 +453,17 @@ DROP TABLE t; --echo # MDEV-14041 Server crashes in String::length on queries with functions and ROLLUP --echo # +#enable view protocol after fix MDEV-28538 +--disable_view_protocol + CREATE TABLE t1 (i INT); INSERT INTO t1 VALUES (1),(2); SELECT GET_LOCK( 'foo', 0 ); SELECT HEX( RELEASE_LOCK( 'foo' ) ) AS f FROM t1 GROUP BY f WITH ROLLUP; DROP TABLE t1; +--enable_view_protocol + CREATE TABLE t1 (i INT); INSERT INTO t1 VALUES (1),(2); SELECT i FROM t1 GROUP BY i WITH ROLLUP diff --git a/mysql-test/main/old-mode.result b/mysql-test/main/old-mode.result index e0a3412bbdf29..bb65acd54ce8c 100644 --- a/mysql-test/main/old-mode.result +++ b/mysql-test/main/old-mode.result @@ -221,3 +221,39 @@ a UNIX_TIMESTAMP(t1.a) a UNIX_TIMESTAMP(t2.a) DROP TABLE t1; SET time_zone=DEFAULT; SET global mysql56_temporal_format=true; +# +# MDEV-26765 UNIX_TIMESTAMP(CURRENT_TIME()) return null ?!? +# +SET old_mode=zero_date_time_cast; +SET @@time_zone='+00:00'; +SET timestamp=1234567; +SELECT CURRENT_TIMESTAMP; +CURRENT_TIMESTAMP +1970-01-15 06:56:07 +SELECT UNIX_TIMESTAMP(CURRENT_TIME()); +UNIX_TIMESTAMP(CURRENT_TIME()) +NULL +Warnings: +Warning 1292 Truncated incorrect datetime value: '06:56:07' +SELECT UNIX_TIMESTAMP(TIME'06:56:07'); +UNIX_TIMESTAMP(TIME'06:56:07') +NULL +Warnings: +Warning 1292 Truncated incorrect datetime value: '06:56:07' +SELECT UNIX_TIMESTAMP(TIME'10:20:30'); +UNIX_TIMESTAMP(TIME'10:20:30') +NULL +Warnings: +Warning 1292 Truncated incorrect datetime value: '10:20:30' +CREATE OR REPLACE TABLE t1 (a TIME); +INSERT INTO t1 VALUES (TIME'06:56:07'),('10:20:30'); +SELECT UNIX_TIMESTAMP(a) FROM t1 ORDER BY a; +UNIX_TIMESTAMP(a) +NULL +NULL +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +DROP TABLE t1; +SET @@time_zone=DEFAULT; +SET TIMESTAMP=DEFAULT; diff --git a/mysql-test/main/old-mode.test b/mysql-test/main/old-mode.test index a09de1cf87d04..d3fc254110d90 100644 --- a/mysql-test/main/old-mode.test +++ b/mysql-test/main/old-mode.test @@ -149,3 +149,23 @@ SELECT t1.a, UNIX_TIMESTAMP(t1.a), t2.a, UNIX_TIMESTAMP(t2.a) FROM t1 t1, t1 t2 DROP TABLE t1; SET time_zone=DEFAULT; SET global mysql56_temporal_format=true; + + +--echo # +--echo # MDEV-26765 UNIX_TIMESTAMP(CURRENT_TIME()) return null ?!? +--echo # + +SET old_mode=zero_date_time_cast; +SET @@time_zone='+00:00'; +SET timestamp=1234567; +SELECT CURRENT_TIMESTAMP; +SELECT UNIX_TIMESTAMP(CURRENT_TIME()); +SELECT UNIX_TIMESTAMP(TIME'06:56:07'); +SELECT UNIX_TIMESTAMP(TIME'10:20:30'); +CREATE OR REPLACE TABLE t1 (a TIME); +INSERT INTO t1 VALUES (TIME'06:56:07'),('10:20:30'); +SELECT UNIX_TIMESTAMP(a) FROM t1 ORDER BY a; +DROP TABLE t1; + +SET @@time_zone=DEFAULT; +SET TIMESTAMP=DEFAULT; diff --git a/mysql-test/main/openssl_1.result b/mysql-test/main/openssl_1.result index a9264b3ed2cfb..a5ac8956b2f65 100644 --- a/mysql-test/main/openssl_1.result +++ b/mysql-test/main/openssl_1.result @@ -22,7 +22,7 @@ select * from t1; f1 5 delete from t1; -ERROR 42000: DELETE command denied to user 'ssl_user1'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'ssl_user1'@'localhost' for table `test`.`t1` connection con3; SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; have_ssl @@ -31,7 +31,7 @@ select * from t1; f1 5 delete from t1; -ERROR 42000: DELETE command denied to user 'ssl_user3'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'ssl_user3'@'localhost' for table `test`.`t1` connection con4; SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; have_ssl @@ -40,18 +40,18 @@ select * from t1; f1 5 delete from t1; -ERROR 42000: DELETE command denied to user 'ssl_user4'@'localhost' for table 't1' +ERROR 42000: DELETE command denied to user 'ssl_user4'@'localhost' for table `test`.`t1` connection default; disconnect con1; disconnect con3; disconnect con4; 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 +mysqltest: Could not open connection 'default': 2026 TLS/SSL error: xxxx +mysqltest: Could not open connection 'default': 2026 TLS/SSL error: xxxx +mysqltest: Could not open connection 'default': 2026 TLS/SSL error: xxxx +mysqltest: Could not open connection 'default': 2026 TLS/SSL error: xxxx +mysqltest: Could not open connection 'default': 2026 TLS/SSL error: xxxx have_ssl 1 End of 5.0 tests @@ -185,7 +185,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -mysqldump: Got error: 2026: "SSL connection error: xxxx +mariadb-dump: Got error: 2026: "TLS/SSL error: xxxx DROP TABLE t1; GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509; FLUSH PRIVILEGES; @@ -202,4 +202,4 @@ End of 5.1 tests /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -ERROR: Failed on connect: SSL connection error \ No newline at end of file +ERROR: Failed on connect: TLS/SSL error \ No newline at end of file diff --git a/mysql-test/main/openssl_1.test b/mysql-test/main/openssl_1.test index fff65624b12a7..639fd0a294d3a 100644 --- a/mysql-test/main/openssl_1.test +++ b/mysql-test/main/openssl_1.test @@ -70,7 +70,7 @@ drop table t1; # --exec echo "this query should not execute;" > $MYSQLTEST_VARDIR/tmp/test.sql # Handle that openssl gives different error messages from YaSSL. ---replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/ +--replace_regex /2026 TLS\/SSL error.*/2026 TLS\/SSL error: xxxx/ --error 1 --exec $MYSQL_TEST --ssl-ca=$MYSQL_TEST_DIR/std_data/untrusted-cacert.pem --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 --echo @@ -79,7 +79,7 @@ drop table t1; # Test that we can't open connection to server if we are using # a blank ca # ---replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/ +--replace_regex /2026 TLS\/SSL error.*/2026 TLS\/SSL error: xxxx/ --error 1 --exec $MYSQL_TEST --ssl-ca= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 --echo @@ -88,7 +88,7 @@ drop table t1; # Test that we can't open connection to server if we are using # a nonexistent ca file # ---replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/ +--replace_regex /2026 TLS\/SSL error.*/2026 TLS\/SSL error: xxxx/ --error 1 --exec $MYSQL_TEST --ssl-ca=nonexisting_file.pem --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 --echo @@ -97,7 +97,7 @@ drop table t1; # Test that we can't open connection to server if we are using # a blank client-key # ---replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/ +--replace_regex /2026 TLS\/SSL error.*/2026 TLS\/SSL error: xxxx/ --error 1 --exec $MYSQL_TEST --ssl-key= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 --echo @@ -106,7 +106,7 @@ drop table t1; # Test that we can't open connection to server if we are using # a blank client-cert # ---replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/ +--replace_regex /2026 TLS\/SSL error.*/2026 TLS\/SSL error: xxxx/ --error 1 --exec $MYSQL_TEST --ssl-cert= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 --echo @@ -174,8 +174,8 @@ INSERT INTO t1 VALUES (1), (2); --exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-create-options --skip-comments --ssl --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 # With wrong parameters ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR mysqldump.exe mysqldump ---replace_regex /SSL connection error.*/SSL connection error: xxxx/ +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MYSQL_DUMP mariadb-dump .\exe '' +--replace_regex /TLS\/SSL error.*/TLS\/SSL error: xxxx/ --error 2 --exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-create-options --skip-comments --ssl --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test 2>&1 --echo @@ -201,7 +201,7 @@ set global sql_mode=default; # MDEV-9605 mysqlbinlog does not accept ssl-ca option as expected. # ---replace_regex /SSL connection error:.*/SSL connection error/ +--replace_regex /TLS\/SSL error:.*/TLS\/SSL error/ --error 1 --exec $MYSQL_BINLOG --read-from-remote-server --ssl-ca --user=root --host=localhost nobinlog.111111 2>&1 diff --git a/mysql-test/main/openssl_6975,tlsv10.result b/mysql-test/main/openssl_6975,tlsv10.result index b76a91bd13497..f848b9a2ccc7c 100644 --- a/mysql-test/main/openssl_6975,tlsv10.result +++ b/mysql-test/main/openssl_6975,tlsv10.result @@ -3,14 +3,14 @@ grant select on test.* to ssl_sslv3@localhost require cipher "AES128-SHA"; create user ssl_tls12@localhost; grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256"; TLS1.2 ciphers: user is ok with any cipher -ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure -ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure +ERROR 2026 (HY000): TLS/SSL error: sslv3 alert handshake failure +ERROR 2026 (HY000): TLS/SSL error: sslv3 alert handshake failure TLS1.2 ciphers: user requires SSLv3 cipher AES128-SHA -ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure -ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure +ERROR 2026 (HY000): TLS/SSL error: sslv3 alert handshake failure +ERROR 2026 (HY000): TLS/SSL error: sslv3 alert handshake failure TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256 -ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure -ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure +ERROR 2026 (HY000): TLS/SSL error: sslv3 alert handshake failure +ERROR 2026 (HY000): TLS/SSL error: sslv3 alert handshake failure SSLv3 ciphers: user is ok with any cipher Variable_name Value Ssl_cipher AES256-SHA diff --git a/mysql-test/main/openssl_6975,tlsv12.result b/mysql-test/main/openssl_6975,tlsv12.result index c16e503c339cd..7bc92aec74f74 100644 --- a/mysql-test/main/openssl_6975,tlsv12.result +++ b/mysql-test/main/openssl_6975,tlsv12.result @@ -15,13 +15,13 @@ Variable_name Value Ssl_cipher AES128-SHA256 ERROR 1045 (28000): Access denied for user 'ssl_tls12'@'localhost' (using password: NO) SSLv3 ciphers: user is ok with any cipher -ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure -ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure +ERROR 2026 (HY000): TLS/SSL error: sslv3 alert handshake failure +ERROR 2026 (HY000): TLS/SSL error: sslv3 alert handshake failure SSLv3 ciphers: user requires SSLv3 cipher AES128-SHA -ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure -ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure +ERROR 2026 (HY000): TLS/SSL error: sslv3 alert handshake failure +ERROR 2026 (HY000): TLS/SSL error: sslv3 alert handshake failure SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256 -ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure -ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure +ERROR 2026 (HY000): TLS/SSL error: sslv3 alert handshake failure +ERROR 2026 (HY000): TLS/SSL error: sslv3 alert handshake failure drop user ssl_sslv3@localhost; drop user ssl_tls12@localhost; diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result index 0d16f47dc8fab..36295c7dee224 100644 --- a/mysql-test/main/opt_trace.result +++ b/mysql-test/main/opt_trace.result @@ -145,8 +145,7 @@ select * from v1 { } }, "rows_for_plan": 1, - "cost_for_plan": 2.404394531, - "estimated_join_cardinality": 1 + "cost_for_plan": 2.404394531 } ] }, @@ -296,8 +295,7 @@ select * from (select * from t1 where t1.a=1)q { } }, "rows_for_plan": 1, - "cost_for_plan": 2.404394531, - "estimated_join_cardinality": 1 + "cost_for_plan": 2.404394531 } ] }, @@ -454,11 +452,15 @@ select * from v2 { }, "rows_for_plan": 1, "cost_for_plan": 2.404394531, - "cost_for_sorting": 1, - "estimated_join_cardinality": 1 + "cost_for_sorting": 1 } ] }, + { + "check_split_materialized": { + "not_applicable": "no candidate field can be accessed through ref" + } + }, { "best_join_order": ["t1"] }, @@ -525,8 +527,7 @@ select * from v2 { } }, "rows_for_plan": 2, - "cost_for_plan": 2.4, - "estimated_join_cardinality": 2 + "cost_for_plan": 2.4 } ] }, @@ -662,8 +663,7 @@ explain select * from v2 { } }, "rows_for_plan": 10, - "cost_for_plan": 4.021972656, - "estimated_join_cardinality": 10 + "cost_for_plan": 4.021972656 } ] }, @@ -780,11 +780,15 @@ explain select * from v1 { }, "rows_for_plan": 10, "cost_for_plan": 4.021972656, - "cost_for_sorting": 10, - "estimated_join_cardinality": 10 + "cost_for_sorting": 10 } ] }, + { + "check_split_materialized": { + "not_applicable": "group list has no candidates" + } + }, { "best_join_order": ["t1"] }, @@ -845,8 +849,7 @@ explain select * from v1 { } }, "rows_for_plan": 10, - "cost_for_plan": 12, - "estimated_join_cardinality": 10 + "cost_for_plan": 12 } ] }, @@ -1047,7 +1050,7 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b { }, "rows_for_plan": 100, "cost_for_plan": 242.3759623, - "estimated_join_cardinality": 100 + "pruned_by_hanging_leaf": true } ] }, @@ -1278,8 +1281,7 @@ EXPLAIN SELECT DISTINCT a FROM t1 { } }, "rows_for_plan": 5, - "cost_for_plan": 7.25, - "estimated_join_cardinality": 5 + "cost_for_plan": 7.25 } ] }, @@ -1470,8 +1472,7 @@ EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a { }, "rows_for_plan": 8, "cost_for_plan": 3.8, - "cost_for_sorting": 8, - "estimated_join_cardinality": 8 + "cost_for_sorting": 8 } ] }, @@ -1669,8 +1670,7 @@ EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id { }, "rows_for_plan": 9, "cost_for_plan": 4.15, - "cost_for_sorting": 9, - "estimated_join_cardinality": 9 + "cost_for_sorting": 9 } ] }, @@ -1857,8 +1857,7 @@ EXPLAIN SELECT * FROM t1 WHERE a = 20010104e0 GROUP BY id { }, "rows_for_plan": 9, "cost_for_plan": 4.15, - "cost_for_sorting": 9, - "estimated_join_cardinality": 9 + "cost_for_sorting": 9 } ] }, @@ -2114,6 +2113,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { "access_type": "ref", "index": "a_c", "used_range_estimates": true, + "rowid_filter_skipped": "worst/max seeks clipping", "rows": 180, "cost": 180.2743776, "chosen": true @@ -2140,8 +2140,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { } }, "rows_for_plan": 21, - "cost_for_plan": 25.34242739, - "estimated_join_cardinality": 21 + "cost_for_plan": 25.34242739 } ] }, @@ -2176,6 +2175,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { { "index": "a_a", "can_resolve_order": true, + "direction": 1, "updated_limit": 47, "index_scan_time": 47, "usable": false, @@ -2184,6 +2184,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { { "index": "a_c", "can_resolve_order": true, + "direction": 1, "updated_limit": 47, "range_scan_time": 4.331020747, "index_scan_time": 4.331020747, @@ -2392,8 +2393,7 @@ select t1.a from t1 left join t2 on t1.a=t2.a { } }, "rows_for_plan": 4, - "cost_for_plan": 2.806835937, - "estimated_join_cardinality": 4 + "cost_for_plan": 2.806835937 } ] }, @@ -2561,7 +2561,7 @@ explain select * from t1 left join t2 on t2.a=t1.a { }, "rows_for_plan": 4, "cost_for_plan": 7.606835937, - "estimated_join_cardinality": 4 + "pruned_by_hanging_leaf": true } ] } @@ -2740,8 +2740,7 @@ explain select t1.a from t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and } }, "rows_for_plan": 4, - "cost_for_plan": 2.806835937, - "estimated_join_cardinality": 4 + "cost_for_plan": 2.806835937 } ] }, @@ -2820,15 +2819,6 @@ explain extended select * from t1 where a in (select pk from t10) { "join_preparation": { "select_id": 2, "steps": [ - { - "transformation": { - "select_id": 2, - "from": "IN (SELECT)", - "to": "materialization", - "sjm_scan_allowed": true, - "possible": true - } - }, { "transformation": { "select_id": 2, @@ -2853,6 +2843,15 @@ explain extended select * from t1 where a in (select pk from t10) { "join_optimization": { "select_id": 1, "steps": [ + { + "transformation": { + "select_id": 2, + "from": "IN (SELECT)", + "to": "materialization", + "sjm_scan_allowed": true, + "possible": true + } + }, { "transformation": { "select_id": 2, @@ -2948,8 +2947,7 @@ explain extended select * from t1 where a in (select pk from t10) { } }, "rows_for_plan": 10, - "cost_for_plan": 4.021972656, - "estimated_join_cardinality": 10 + "cost_for_plan": 4.021972656 } ] } @@ -3021,8 +3019,7 @@ explain extended select * from t1 where a in (select pk from t10) { { "chosen_strategy": "SJ-Materialization" } - ], - "estimated_join_cardinality": 3 + ] } ] }, @@ -3427,7 +3424,7 @@ explain select * from t1 where pk = 2 and a=5 and b=1 { }, "rows_for_plan": 1, "cost_for_plan": 0.326073957, - "estimated_join_cardinality": 1 + "pruned_by_hanging_leaf": true } ] }, @@ -3555,8 +3552,7 @@ select f1(a) from t1 { } }, "rows_for_plan": 4, - "cost_for_plan": 2.806835937, - "estimated_join_cardinality": 4 + "cost_for_plan": 2.806835937 } ] }, @@ -3652,8 +3648,7 @@ select f2(a) from t1 { } }, "rows_for_plan": 4, - "cost_for_plan": 2.806835937, - "estimated_join_cardinality": 4 + "cost_for_plan": 2.806835937 } ] }, @@ -3699,7 +3694,7 @@ a 2 select length(trace) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; length(trace) -2141 +2092 set optimizer_trace_max_mem_size=100; select * from t1; a @@ -3713,7 +3708,7 @@ select * from t1 { "join_preparation": { "select_id": 1, "steps": [ - 2041 0 + 1992 0 set optimizer_trace_max_mem_size=0; select * from t1; a @@ -3721,7 +3716,7 @@ a 2 select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES -select * from t1 2141 0 +select * from t1 2092 0 drop table t1; set optimizer_trace='enabled=off'; set @@optimizer_trace_max_mem_size= @save_optimizer_trace_max_mem_size; @@ -3816,7 +3811,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 { "select_id": 1, "steps": [ { - "expanded_query": "select NULL AS `NULL` from t0 join t1 where t0.a = t1.a and t1.a < 3" + "expanded_query": "delete from t0,t1 using t0 join t1 where t0.a = t1.a and t1.a < 3" } ] } @@ -4064,7 +4059,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 { }, "rows_for_plan": 3, "cost_for_plan": 4.948514767, - "estimated_join_cardinality": 3 + "pruned_by_hanging_leaf": true } ] }, @@ -4101,6 +4096,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 { "rec_per_key_stats_missing": true, "used_range_estimates": false, "reason": "not better than ref estimates", + "rowid_filter_skipped": "worst/max seeks clipping", "rows": 2, "cost": 3.003514767, "chosen": true @@ -4185,7 +4181,7 @@ explain select * from (select rand() from t1)q { "derived": { "table": "q", "select_id": 2, - "algorithm": "merged" + "algorithm": "materialized" } }, { @@ -4199,7 +4195,7 @@ explain select * from (select rand() from t1)q { } }, { - "expanded_query": "/* select#1 */ select rand() AS `rand()` from (/* select#2 */ select rand() AS `rand()` from t1) q" + "expanded_query": "/* select#1 */ select q.`rand()` AS `rand()` from (/* select#2 */ select rand() AS `rand()` from t1) q" } ] } @@ -4208,14 +4204,6 @@ explain select * from (select rand() from t1)q { "join_optimization": { "select_id": 1, "steps": [ - { - "derived": { - "table": "q", - "select_id": 2, - "algorithm": "materialized", - "cause": "Random function in the select" - } - }, { "join_optimization": { "select_id": 2, @@ -4263,8 +4251,7 @@ explain select * from (select rand() from t1)q { } }, "rows_for_plan": 3, - "cost_for_plan": 2.605126953, - "estimated_join_cardinality": 3 + "cost_for_plan": 2.605126953 } ] }, @@ -4328,8 +4315,7 @@ explain select * from (select rand() from t1)q { } }, "rows_for_plan": 3, - "cost_for_plan": 3.6, - "estimated_join_cardinality": 3 + "cost_for_plan": 3.6 } ] }, @@ -4394,15 +4380,6 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_ "join_preparation": { "select_id": 2, "steps": [ - { - "transformation": { - "select_id": 2, - "from": "IN (SELECT)", - "to": "materialization", - "sjm_scan_allowed": true, - "possible": true - } - }, { "transformation": { "select_id": 2, @@ -4427,6 +4404,15 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_ "join_optimization": { "select_id": 1, "steps": [ + { + "transformation": { + "select_id": 2, + "from": "IN (SELECT)", + "to": "materialization", + "sjm_scan_allowed": true, + "possible": true + } + }, { "transformation": { "select_id": 2, @@ -4557,8 +4543,7 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_ } }, "rows_for_plan": 9, - "cost_for_plan": 6.410253906, - "estimated_join_cardinality": 9 + "cost_for_plan": 6.410253906 } ] }, @@ -4678,8 +4663,7 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_ { "chosen_strategy": "SJ-Materialization" } - ], - "estimated_join_cardinality": 3 + ] } ] }, @@ -4845,15 +4829,6 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "join_preparation": { "select_id": 2, "steps": [ - { - "transformation": { - "select_id": 2, - "from": "IN (SELECT)", - "to": "materialization", - "sjm_scan_allowed": true, - "possible": true - } - }, { "transformation": { "select_id": 2, @@ -4872,15 +4847,6 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "join_preparation": { "select_id": 3, "steps": [ - { - "transformation": { - "select_id": 3, - "from": "IN (SELECT)", - "to": "materialization", - "sjm_scan_allowed": true, - "possible": true - } - }, { "transformation": { "select_id": 3, @@ -4905,6 +4871,15 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "join_optimization": { "select_id": 1, "steps": [ + { + "transformation": { + "select_id": 2, + "from": "IN (SELECT)", + "to": "materialization", + "sjm_scan_allowed": true, + "possible": true + } + }, { "transformation": { "select_id": 2, @@ -4913,6 +4888,15 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "converted_to_semi_join": true } }, + { + "transformation": { + "select_id": 3, + "from": "IN (SELECT)", + "to": "materialization", + "sjm_scan_allowed": true, + "possible": true + } + }, { "transformation": { "select_id": 3, @@ -5222,8 +5206,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { { "chosen_strategy": "DuplicateWeedout" } - ], - "estimated_join_cardinality": 27 + ] } ] }, @@ -5345,8 +5328,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { { "chosen_strategy": "DuplicateWeedout" } - ], - "estimated_join_cardinality": 27 + ] } ] }, @@ -5518,6 +5500,11 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "rows_for_plan": 729, "cost_for_plan": 451.8615234, "semijoin_strategy_choice": [ + { + "strategy": "FirstMatch", + "records": 27, + "read_time": 665.225293 + }, { "strategy": "DuplicateWeedout", "records": 27, @@ -5675,35 +5662,26 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "t_outer_2", "t_inner_3" ], - "table": "t_inner_4", + "table": "t_inner_2", "best_access_path": { "considered_access_paths": [ { "access_type": "scan", - "resulting_rows": 3, - "cost": 2.005126953, + "resulting_rows": 9, + "cost": 2.015380859, "chosen": true } ], "chosen_access_method": { "type": "scan", - "records": 3, - "cost": 2.005126953, + "records": 9, + "cost": 2.015380859, "uses_join_buffering": true } }, - "rows_for_plan": 2187, - "cost_for_plan": 611.8461426, - "semijoin_strategy_choice": [ - { - "strategy": "FirstMatch", - "records": 81, - "read_time": 2232.809033 - }, - { - "chosen_strategy": "FirstMatch" - } - ], + "rows_for_plan": 6561, + "cost_for_plan": 1486.656396, + "semijoin_strategy_choice": [], "pruned_by_cost": true }, { @@ -5713,25 +5691,25 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "t_outer_2", "t_inner_3" ], - "table": "t_inner_2", + "table": "t_inner_4", "best_access_path": { "considered_access_paths": [ { "access_type": "scan", - "resulting_rows": 9, - "cost": 2.015380859, + "resulting_rows": 3, + "cost": 2.005126953, "chosen": true } ], "chosen_access_method": { "type": "scan", - "records": 9, - "cost": 2.015380859, + "records": 3, + "cost": 2.005126953, "uses_join_buffering": true } }, - "rows_for_plan": 6561, - "cost_for_plan": 1486.656396, + "rows_for_plan": 2187, + "cost_for_plan": 611.8461426, "semijoin_strategy_choice": [], "pruned_by_cost": true } @@ -5764,7 +5742,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "rest_of_plan": [ { "plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_4"], - "table": "t_outer_2", + "table": "t_inner_2", "best_access_path": { "considered_access_paths": [ { @@ -5790,9 +5768,9 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "t_outer_1", "t_inner_1", "t_inner_4", - "t_outer_2" + "t_inner_2" ], - "table": "t_inner_2", + "table": "t_outer_2", "best_access_path": { "considered_access_paths": [ { @@ -5819,7 +5797,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "t_outer_1", "t_inner_1", "t_inner_4", - "t_outer_2" + "t_inner_2" ], "table": "t_inner_3", "best_access_path": { @@ -5847,7 +5825,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { }, { "plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_4"], - "table": "t_inner_2", + "table": "t_outer_2", "best_access_path": { "considered_access_paths": [ { @@ -5920,7 +5898,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "rest_of_plan": [ { "plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_3"], - "table": "t_outer_2", + "table": "t_inner_2", "best_access_path": { "considered_access_paths": [ { @@ -5946,27 +5924,27 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "t_outer_1", "t_inner_1", "t_inner_3", - "t_outer_2" + "t_inner_2" ], - "table": "t_inner_4", + "table": "t_outer_2", "best_access_path": { "considered_access_paths": [ { "access_type": "scan", - "resulting_rows": 3, - "cost": 2.005126953, + "resulting_rows": 9, + "cost": 2.015380859, "chosen": true } ], "chosen_access_method": { "type": "scan", - "records": 3, - "cost": 2.005126953, + "records": 9, + "cost": 2.015380859, "uses_join_buffering": true } }, - "rows_for_plan": 2187, - "cost_for_plan": 611.8461426, + "rows_for_plan": 6561, + "cost_for_plan": 1486.656396, "semijoin_strategy_choice": [], "pruned_by_cost": true }, @@ -5975,32 +5953,56 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "t_outer_1", "t_inner_1", "t_inner_3", - "t_outer_2" + "t_inner_2" ], - "table": "t_inner_2", + "table": "t_inner_4", "best_access_path": { "considered_access_paths": [ { "access_type": "scan", - "resulting_rows": 9, - "cost": 2.015380859, + "resulting_rows": 3, + "cost": 2.005126953, "chosen": true } ], "chosen_access_method": { "type": "scan", - "records": 9, - "cost": 2.015380859, + "records": 3, + "cost": 2.005126953, "uses_join_buffering": true } }, - "rows_for_plan": 6561, - "cost_for_plan": 1486.656396, + "rows_for_plan": 2187, + "cost_for_plan": 611.8461426, "semijoin_strategy_choice": [], "pruned_by_cost": true } ] }, + { + "plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_3"], + "table": "t_outer_2", + "best_access_path": { + "considered_access_paths": [ + { + "access_type": "scan", + "resulting_rows": 9, + "cost": 2.015380859, + "chosen": true + } + ], + "chosen_access_method": { + "type": "scan", + "records": 9, + "cost": 2.015380859, + "uses_join_buffering": true + } + }, + "rows_for_plan": 729, + "cost_for_plan": 172.4410156, + "semijoin_strategy_choice": [], + "pruned_by_heuristic": true + }, { "plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_3"], "table": "t_inner_4", @@ -6031,7 +6033,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "t_inner_3", "t_inner_4" ], - "table": "t_outer_2", + "table": "t_inner_2", "best_access_path": { "considered_access_paths": [ { @@ -6060,7 +6062,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "t_inner_3", "t_inner_4" ], - "table": "t_inner_2", + "table": "t_outer_2", "best_access_path": { "considered_access_paths": [ { @@ -6083,30 +6085,6 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "pruned_by_cost": true } ] - }, - { - "plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_3"], - "table": "t_inner_2", - "best_access_path": { - "considered_access_paths": [ - { - "access_type": "scan", - "resulting_rows": 9, - "cost": 2.015380859, - "chosen": true - } - ], - "chosen_access_method": { - "type": "scan", - "records": 9, - "cost": 2.015380859, - "uses_join_buffering": true - } - }, - "rows_for_plan": 729, - "cost_for_plan": 172.4410156, - "semijoin_strategy_choice": [], - "pruned_by_heuristic": true } ] } @@ -6425,15 +6403,6 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "join_preparation": { "select_id": 2, "steps": [ - { - "transformation": { - "select_id": 2, - "from": "IN (SELECT)", - "to": "materialization", - "sjm_scan_allowed": true, - "possible": true - } - }, { "transformation": { "select_id": 2, @@ -6452,15 +6421,6 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "join_preparation": { "select_id": 3, "steps": [ - { - "transformation": { - "select_id": 3, - "from": "IN (SELECT)", - "to": "materialization", - "sjm_scan_allowed": true, - "possible": true - } - }, { "transformation": { "select_id": 3, @@ -6485,6 +6445,15 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "join_optimization": { "select_id": 1, "steps": [ + { + "transformation": { + "select_id": 2, + "from": "IN (SELECT)", + "to": "materialization", + "sjm_scan_allowed": true, + "possible": true + } + }, { "transformation": { "select_id": 2, @@ -6493,6 +6462,15 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { "converted_to_semi_join": true } }, + { + "transformation": { + "select_id": 3, + "from": "IN (SELECT)", + "to": "materialization", + "sjm_scan_allowed": true, + "possible": true + } + }, { "transformation": { "select_id": 3, @@ -6667,8 +6645,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { } }, "rows_for_plan": 27, - "cost_for_plan": 10.02050781, - "estimated_join_cardinality": 27 + "cost_for_plan": 10.02050781 } ] }, @@ -6741,8 +6718,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { } }, "rows_for_plan": 27, - "cost_for_plan": 10.02050781, - "estimated_join_cardinality": 27 + "cost_for_plan": 10.02050781 } ] }, @@ -6961,8 +6937,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { { "chosen_strategy": "SJ-Materialization" } - ], - "estimated_join_cardinality": 27 + ] } ] }, @@ -7525,17 +7500,13 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": [ - { "index": "a_b", "ranges": - [ - "(2,4) <= (a,b) <= (2,4)" - ], + ["(2,4) <= (a,b) <= (2,4)"], "rowid_ordered": true, "using_mrr": false, "index_only": true, @@ -7549,8 +7520,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cause": "too few roworder scans" }, "analyzing_index_merge_union": - [ - ] + [] } ] explain select * from t1 where a >= 900 and b between 10 and 20; @@ -7559,17 +7529,13 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": [ - { "index": "a_b", "ranges": - [ - "(900,10) <= (a,b)" - ], + ["(900,10) <= (a,b)"], "rowid_ordered": false, "using_mrr": false, "index_only": true, @@ -7583,8 +7549,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cause": "too few roworder scans" }, "analyzing_index_merge_union": - [ - ] + [] } ] drop table t0,t1; @@ -7596,17 +7561,13 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": [ - { "index": "start_date", "ranges": - [ - "(2019-02-10,NULL) < (start_date,end_date)" - ], + ["(2019-02-10,NULL) < (start_date,end_date)"], "rowid_ordered": false, "using_mrr": false, "index_only": false, @@ -7620,8 +7581,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cause": "too few roworder scans" }, "analyzing_index_merge_union": - [ - ] + [] } ] drop table t1,one_k; @@ -7641,17 +7601,13 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": [ - { "index": "a_b_c", "ranges": - [ - "(1) <= (a,b) < (4,50)" - ], + ["(1) <= (a,b) < (4,50)"], "rowid_ordered": false, "using_mrr": false, "index_only": false, @@ -7665,8 +7621,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cause": "too few roworder scans" }, "analyzing_index_merge_union": - [ - ] + [] } ] drop table ten,t1; @@ -7680,17 +7635,13 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": [ - { "index": "i_b", "ranges": - [ - "(\xD9[\x943j\x99F\xA3\x9C\xF5\xB5\x8C\xFEw-\x8C) <= (b) <= (\xD9[\x943j\x99F\xA3\x9C\xF5\xB5\x8C\xFEw-\x8C)" - ], + ["(\xD9[\x943j\x99F\xA3\x9C\xF5\xB5\x8C\xFEw-\x8C) <= (b) <= (\xD9[\x943j\x99F\xA3\x9C\xF5\xB5\x8C\xFEw-\x8C)"], "rowid_ordered": true, "using_mrr": false, "index_only": false, @@ -7704,8 +7655,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cause": "too few roworder scans" }, "analyzing_index_merge_union": - [ - ] + [] } ] EXPLAIN SELECT * FROM t1 WHERE b IS NULL; @@ -7714,17 +7664,13 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": [ - { "index": "i_b", "ranges": - [ - "(NULL) <= (b) <= (NULL)" - ], + ["(NULL) <= (b) <= (NULL)"], "rowid_ordered": true, "using_mrr": false, "index_only": false, @@ -7738,8 +7684,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cause": "too few roworder scans" }, "analyzing_index_merge_union": - [ - ] + [] } ] drop table t1; @@ -7756,17 +7701,13 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": [ - { "index": "i_b", "ranges": - [ - "(ab\x0A) <= (b) <= (ab\x0A)" - ], + ["(ab\x0A) <= (b) <= (ab\x0A)"], "rowid_ordered": true, "using_mrr": false, "index_only": false, @@ -7780,8 +7721,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cause": "too few roworder scans" }, "analyzing_index_merge_union": - [ - ] + [] } ] ALTER TABLE t1 modify column b BINARY(10) AFTER i; @@ -7791,17 +7731,13 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": [ - { "index": "i_b", "ranges": - [ - "(ab\x0A\x00\x00\x00\x00\x00\x00\x00) <= (b) <= (ab\x0A\x00\x00\x00\x00\x00\x00\x00)" - ], + ["(ab\x0A\x00\x00\x00\x00\x00\x00\x00) <= (b) <= (ab\x0A\x00\x00\x00\x00\x00\x00\x00)"], "rowid_ordered": true, "using_mrr": false, "index_only": false, @@ -7815,8 +7751,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cause": "too few roworder scans" }, "analyzing_index_merge_union": - [ - ] + [] } ] ALTER TABLE t1 modify column b VARBINARY(10) AFTER i; @@ -7826,17 +7761,13 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": [ - { "index": "i_b", "ranges": - [ - "(ab\x0A) <= (b) <= (ab\x0A)" - ], + ["(ab\x0A) <= (b) <= (ab\x0A)"], "rowid_ordered": true, "using_mrr": false, "index_only": false, @@ -7850,8 +7781,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cause": "too few roworder scans" }, "analyzing_index_merge_union": - [ - ] + [] } ] drop table t1; @@ -7864,17 +7794,13 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": [ - { "index": "i_b", "ranges": - [ - "(ab\n) <= (b) <= (ab\n)" - ], + ["(ab\n) <= (b) <= (ab\n)"], "rowid_ordered": true, "using_mrr": false, "index_only": false, @@ -7888,8 +7814,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cause": "too few roworder scans" }, "analyzing_index_merge_union": - [ - ] + [] } ] drop table t1; @@ -7905,17 +7830,13 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": [ - { "index": "i_b", "ranges": - [ - "(ab\x0A) <= (b) <= (ab\x0A)" - ], + ["(ab\x0A) <= (b) <= (ab\x0A)"], "rowid_ordered": false, "using_mrr": false, "index_only": false, @@ -7929,8 +7850,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cause": "too few roworder scans" }, "analyzing_index_merge_union": - [ - ] + [] } ] drop table t1; @@ -7944,17 +7864,13 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": [ - { "index": "i_b", "ranges": - [ - "(ab\n) <= (b) <= (ab\n)" - ], + ["(ab\n) <= (b) <= (ab\n)"], "rowid_ordered": true, "using_mrr": false, "index_only": false, @@ -7968,8 +7884,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cause": "too few roworder scans" }, "analyzing_index_merge_union": - [ - ] + [] } ] drop table t1; @@ -8004,17 +7919,13 @@ EXPLAIN select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": [ - { "index": "start_date", "ranges": - [ - "(2019-02-10,NULL) < (start_date,end_date)" - ], + ["(2019-02-10,NULL) < (start_date,end_date)"], "rowid_ordered": false, "using_mrr": false, "index_only": false, @@ -8028,8 +7939,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cause": "too few roworder scans" }, "analyzing_index_merge_union": - [ - ] + [] } ] drop table t1, t0, one_k; @@ -8068,19 +7978,15 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) [ - [ - { "plan_prefix": - [ - ], + [], "table": "A", "best_access_path": { "considered_access_paths": [ - { "access_type": "scan", "resulting_rows": 5, @@ -8100,18 +8006,14 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) "cost_for_plan": 4.017089844, "rest_of_plan": [ - { "plan_prefix": - [ - "A" - ], + ["A"], "table": "B", "best_access_path": { "considered_access_paths": [ - { "access_type": "scan", "resulting_rows": 800, @@ -8128,22 +8030,18 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) } }, "rows_for_plan": 4000, - "cost_for_plan": 1025.003418, - "estimated_join_cardinality": 4000 + "cost_for_plan": 1025.003418 } ] }, - { "plan_prefix": - [ - ], + [], "table": "B", "best_access_path": { "considered_access_paths": [ - { "access_type": "scan", "resulting_rows": 800, @@ -8174,19 +8072,15 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) [ - [ - { "plan_prefix": - [ - ], + [], "table": "A", "best_access_path": { "considered_access_paths": [ - { "access_type": "scan", "resulting_rows": 10, @@ -8206,18 +8100,14 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) "cost_for_plan": 4.017089844, "rest_of_plan": [ - { "plan_prefix": - [ - "A" - ], + ["A"], "table": "B", "best_access_path": { "considered_access_paths": [ - { "access_type": "ref", "index": "b", @@ -8227,7 +8117,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) "cost": 20.00585794, "chosen": true }, - { "access_type": "scan", "resulting_rows": 800, @@ -8250,17 +8139,14 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) } ] }, - { "plan_prefix": - [ - ], + [], "table": "B", "best_access_path": { "considered_access_paths": [ - { "access_type": "scan", "resulting_rows": 800, @@ -8296,17 +8182,13 @@ a select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": [ - { "index": "a", "ranges": - [ - "() <= (a) <= ()" - ], + ["() <= (a) <= ()"], "rowid_ordered": false, "using_mrr": false, "index_only": false, @@ -8320,8 +8202,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cause": "too few roworder scans" }, "analyzing_index_merge_union": - [ - ] + [] } ] DROP TABLE t1; @@ -8343,7 +8224,6 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.semijoin_table_pullout')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.semijoin_table_pullout')) [ - { "pulled_out_tables": [ @@ -8364,15 +8244,11 @@ kp1 kp2 select JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) [ - [ - { "index": "kp1", "ranges": - [ - "(2,4) <= (kp1,kp2) <= (2)" - ], + ["(2,4) <= (kp1,kp2) <= (2)"], "rowid_ordered": false, "using_mrr": false, "index_only": true, @@ -8398,19 +8274,15 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) [ - [ - { "plan_prefix": - [ - ], + [], "table": "t1", "best_access_path": { "considered_access_paths": [ - { "access_type": "scan", "resulting_rows": 10, @@ -8430,18 +8302,14 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) "cost_for_plan": 4.021972656, "rest_of_plan": [ - { "plan_prefix": - [ - "t1" - ], + ["t1"], "table": "t2", "best_access_path": { "considered_access_paths": [ - { "access_type": "ref", "index": "a", @@ -8451,7 +8319,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) "cost": 20.00585794, "chosen": true }, - { "access_type": "scan", "resulting_rows": 100, @@ -8470,21 +8337,18 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) "rows_for_plan": 10, "cost_for_plan": 26.0278306, "cost_for_sorting": 10, - "estimated_join_cardinality": 10 + "pruned_by_hanging_leaf": true } ] }, - { "plan_prefix": - [ - ], + [], "table": "t2", "best_access_path": { "considered_access_paths": [ - { "access_type": "scan", "resulting_rows": 100, @@ -8505,18 +8369,14 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) "cost_for_plan": 22.21972656, "rest_of_plan": [ - { "plan_prefix": - [ - "t2" - ], + ["t2"], "table": "t1", "best_access_path": { "considered_access_paths": [ - { "access_type": "ref", "index": "a", @@ -8526,7 +8386,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) "cost": 200.0585794, "chosen": true }, - { "access_type": "scan", "resulting_rows": 10, @@ -8570,24 +8429,17 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) [ - [ - { "column_name": "a", "ranges": - [ - "1 <= a <= 5" - ], + ["1 <= a <= 5"], "selectivity_from_histogram": 0.05 }, - { "column_name": "b", "ranges": - [ - "NULL < b <= 5" - ], + ["NULL < b <= 5"], "selectivity_from_histogram": 0.05 } ] @@ -8600,9 +8452,7 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) [ - [ - { "column_name": "a", "ranges": @@ -8622,15 +8472,11 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) [ - [ - { "column_name": "b", "ranges": - [ - "10 <= b < 25" - ], + ["10 <= b < 25"], "selectivity_from_histogram": 0.15 } ] @@ -8648,15 +8494,11 @@ UPDATE t1 SET b=10 WHERE a=1; SELECT JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) [ - [ - { "index": "PRIMARY", "ranges": - [ - "(1) <= (a) <= (1)" - ], + ["(1) <= (a) <= (1)"], "rowid_ordered": true, "using_mrr": false, "index_only": false, @@ -8720,6 +8562,468 @@ SELECT a FROM t1 WHERE (a,b) in (SELECT @c,@d); a DROP TABLE t1; # +# MDEV-31085: multi-update using view with optimizer trace enabled +# +SET SESSION optimizer_trace = 'enabled=on'; +CREATE TABLE t (a int, b int); +CREATE VIEW v AS SELECT 1 AS c UNION SELECT 2 AS c; +INSERT INTO t VALUES (0,4),(5,6); +UPDATE t, v SET t.b = t.a, t.a = v.c WHERE v.c < t.a; +SELECT * FROM information_schema.optimizer_trace; +QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES +UPDATE t, v SET t.b = t.a, t.a = v.c WHERE v.c < t.a { + "steps": [ + { + "view": { + "table": "v", + "select_id": 2, + "algorithm": "materialized" + } + }, + { + "join_preparation": { + "select_id": 2, + "steps": [ + { + "expanded_query": "/* select#2 */ select 1 AS c" + } + ] + } + }, + { + "join_preparation": { + "select_id": 3, + "steps": [ + { + "expanded_query": "/* select#3 */ select 2 AS c" + } + ] + } + }, + { + "join_preparation": { + "select_id": 1, + "steps": [ + { + "expanded_query": "/* select#1 */ update t join v set t.b = t.a,t.a = v.c where v.c < t.a" + } + ] + } + }, + { + "join_optimization": { + "select_id": 1, + "steps": [ + { + "condition_processing": { + "condition": "WHERE", + "original_condition": "v.c < t.a", + "steps": [ + { + "transformation": "equality_propagation", + "resulting_condition": "v.c < t.a" + }, + { + "transformation": "constant_propagation", + "resulting_condition": "v.c < t.a" + }, + { + "transformation": "trivial_condition_removal", + "resulting_condition": "v.c < t.a" + } + ] + } + }, + { + "join_optimization": { + "select_id": 2, + "steps": [] + } + }, + { + "join_optimization": { + "select_id": 3, + "steps": [] + } + }, + { + "table_dependencies": [ + { + "table": "t", + "row_may_be_null": false, + "map_bit": 0, + "depends_on_map_bits": [] + }, + { + "table": "", + "row_may_be_null": false, + "map_bit": 1, + "depends_on_map_bits": [] + } + ] + }, + { + "ref_optimizer_key_uses": [] + }, + { + "rows_estimation": [ + { + "table": "t", + "table_scan": { + "rows": 2, + "cost": 2.004394531 + } + }, + { + "table": "", + "table_scan": { + "rows": 2, + "cost": 2 + } + } + ] + }, + { + "considered_execution_plans": [ + { + "plan_prefix": [], + "table": "t", + "best_access_path": { + "considered_access_paths": [ + { + "access_type": "scan", + "resulting_rows": 2, + "cost": 2.004394531, + "chosen": true + } + ], + "chosen_access_method": { + "type": "scan", + "records": 2, + "cost": 2.004394531, + "uses_join_buffering": false + } + }, + "rows_for_plan": 2, + "cost_for_plan": 2.404394531, + "rest_of_plan": [ + { + "plan_prefix": ["t"], + "table": "", + "best_access_path": { + "considered_access_paths": [ + { + "access_type": "scan", + "resulting_rows": 2, + "cost": 2, + "chosen": true + } + ], + "chosen_access_method": { + "type": "scan", + "records": 2, + "cost": 2, + "uses_join_buffering": true + } + }, + "rows_for_plan": 4, + "cost_for_plan": 5.204394531 + } + ] + }, + { + "plan_prefix": [], + "table": "", + "best_access_path": { + "considered_access_paths": [ + { + "access_type": "scan", + "resulting_rows": 2, + "cost": 2, + "chosen": true + } + ], + "chosen_access_method": { + "type": "scan", + "records": 2, + "cost": 2, + "uses_join_buffering": false + } + }, + "rows_for_plan": 2, + "cost_for_plan": 2.4, + "rest_of_plan": [ + { + "plan_prefix": [""], + "table": "t", + "best_access_path": { + "considered_access_paths": [ + { + "access_type": "scan", + "resulting_rows": 2, + "cost": 2.004394531, + "chosen": true + } + ], + "chosen_access_method": { + "type": "scan", + "records": 2, + "cost": 2.004394531, + "uses_join_buffering": true + } + }, + "rows_for_plan": 4, + "cost_for_plan": 5.204394531, + "pruned_by_cost": true + } + ] + } + ] + }, + { + "best_join_order": ["t", ""] + }, + { + "substitute_best_equal": { + "condition": "WHERE", + "resulting_condition": "v.c < t.a" + } + }, + { + "attaching_conditions_to_tables": { + "attached_conditions_computation": [], + "attached_conditions_summary": [ + { + "table": "t", + "attached": null + }, + { + "table": "", + "attached": "v.c < t.a" + } + ] + } + } + ] + } + }, + { + "join_execution": { + "select_id": 1, + "steps": [ + { + "join_execution": { + "select_id": 2, + "steps": [] + } + }, + { + "join_execution": { + "select_id": 3, + "steps": [] + } + }, + { + "join_preparation": { + "select_id": "fake", + "steps": [ + { + "expanded_query": "select c AS c from dual" + } + ] + } + }, + { + "join_optimization": { + "select_id": "fake", + "steps": [ + { + "table_dependencies": [ + { + "table": "union", + "row_may_be_null": false, + "map_bit": 0, + "depends_on_map_bits": [] + } + ] + }, + { + "rows_estimation": [ + { + "table": "union", + "table_scan": { + "rows": 2, + "cost": 10.1 + } + } + ] + }, + { + "considered_execution_plans": [ + { + "plan_prefix": [], + "table": "union", + "best_access_path": { + "considered_access_paths": [ + { + "access_type": "scan", + "resulting_rows": 2, + "cost": 10.1, + "chosen": true + } + ], + "chosen_access_method": { + "type": "scan", + "records": 2, + "cost": 10.1, + "uses_join_buffering": false + } + }, + "rows_for_plan": 2, + "cost_for_plan": 10.5 + } + ] + }, + { + "best_join_order": ["union"] + }, + { + "attaching_conditions_to_tables": { + "attached_conditions_computation": [], + "attached_conditions_summary": [ + { + "table": "union", + "attached": null + } + ] + } + } + ] + } + }, + { + "join_execution": { + "select_id": "fake", + "steps": [] + } + } + ] + } + } + ] +} 0 0 +SELECT * FROM t; +a b +0 4 +1 5 +SET optimizer_trace=DEFAULT; +DROP VIEW v; +DROP TABLE t; +# +# MDEV-26301: Split optimization improvements: Optimizer Trace coverage +# +create table t1(a int, b int); +insert into t1 select seq,seq from seq_1_to_5; +create table t2(a int, b int, key(a)); +insert into t2 +select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B; +create table t3(a int, b int, key(a)); +insert into t3 +select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B; +analyze table t1,t2,t3 persistent for all; +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 +test.t3 analyze status Engine-independent statistics collected +test.t3 analyze status Table is already up to date +create table t10 ( +grp_id int, +col1 int, +key(grp_id) +); +insert into t10 +select +A.seq, +B.seq +from +seq_1_to_100 A, +seq_1_to_100 B; +create table t11 ( +col1 int, +col2 int +); +insert into t11 +select A.seq, A.seq from seq_1_to_10 A; +analyze table t10,t11 persistent for all; +Table Op Msg_type Msg_text +test.t10 analyze status Engine-independent statistics collected +test.t10 analyze status Table is already up to date +test.t11 analyze status Engine-independent statistics collected +test.t11 analyze status OK +set optimizer_trace=1; +explain +select * from +( +(t1 left join t2 on t2.a=t1.b) +left join t3 on t3.a=t1.b +) left join (select grp_id, count(*) +from t10 left join t11 on t11.col1=t10.col1 +group by grp_id) T on T.grp_id=t1.b; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 +1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where +1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where +1 PRIMARY ref key0 key0 5 test.t1.b 10 Using where +2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100 +2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +select json_detailed(json_extract(trace, '$**.check_split_materialized')) as JS +from information_schema.optimizer_trace; +JS +[ + { + "split_candidates": + ["t10.grp_id"] + } +] +select +json_detailed( +json_remove( +json_extract(trace, '$**.choose_best_splitting') +, '$[0].split_plan_search[0]' + ) +) as JS +from information_schema.optimizer_trace; +JS +[ + { + "considered_keys": + [ + { + "table_name": "t10", + "index": "grp_id", + "rec_per_key": 100, + "param_tables": 1 + } + ], + "refills": 5, + "spl_pd_boundary": 2, + "split_plan_search": + [], + "lead_table": "t10", + "index": "grp_id", + "parts": 1, + "split_sel": 0.001, + "cost": 2535.968504, + "unsplit_cost": 253440.0075, + "records": 100, + "chosen": true + } +] +drop table t1,t2,t3,t10,t11; +set optimizer_trace=DEFAULT; +# # End of 10.4 tests # set optimizer_trace='enabled=on'; @@ -8790,8 +9094,7 @@ select count(*) from seq_1_to_10000000 { } }, "rows_for_plan": 10000000, - "cost_for_plan": 12000000, - "estimated_join_cardinality": 10000000 + "cost_for_plan": 12000000 } ] }, @@ -8841,7 +9144,6 @@ select JSON_DETAILED(JSON_EXTRACT(trace, '$**.mark_join_nest_as_const')) from information_schema.optimizer_trace; JSON_DETAILED(JSON_EXTRACT(trace, '$**.mark_join_nest_as_const')) [ - { "members": [ @@ -8867,19 +9169,16 @@ select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) [ - { "item": "t0.a in (1,2,3,4,5,6)", "conversion": [ - { "join_preparation": { "select_id": 2, "steps": [ - { "derived": { @@ -8888,18 +9187,6 @@ json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) "algorithm": "materialized" } }, - - { - "transformation": - { - "select_id": 2, - "from": "IN (SELECT)", - "to": "materialization", - "sjm_scan_allowed": true, - "possible": true - } - }, - { "transformation": { @@ -8909,7 +9196,6 @@ json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) "chosen": true } }, - { "expanded_query": "/* select#2 */ select tvc_0._col_1 from (values (1),(2),(3),(4),(5),(6)) tvc_0" } @@ -8926,7 +9212,6 @@ select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) [ - { "item": "t0.a in (1,2,3,4,5,t0.a + 1)", "done": false, @@ -8940,7 +9225,6 @@ select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) [ - { "item": "t0.a in ('1','2','3','4','5','6')", "done": false, @@ -9012,12 +9296,10 @@ from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.substitute_best_equal')) [ - { "condition": "WHERE", "resulting_condition": "t1.a = 3" }, - { "condition": "HAVING", "resulting_condition": "t1.a + t1.b < 10" @@ -9039,12 +9321,10 @@ from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.substitute_best_equal')) [ - { "condition": "WHERE", "resulting_condition": "t1.b > 5555" }, - { "condition": "ON expr", "attached_to": "t2", @@ -9068,12 +9348,10 @@ from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.substitute_best_equal')) [ - { "condition": "WHERE", "resulting_condition": "t1.b > 5555" }, - { "condition": "ON expr", "attached_to": "t2", @@ -9088,13 +9366,11 @@ from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.condition_processing')) [ - { "condition": "WHERE", "original_condition": "t1.b > 5555", "steps": [ - { "build_equal_items": { @@ -9103,17 +9379,14 @@ json_detailed(json_extract(trace, '$**.condition_processing')) "resulting_condition": "t3.a + t2.a < 1000 and multiple equal(t2.a, t1.a, t3.a)" } }, - { "transformation": "equality_propagation", "resulting_condition": "t1.b > 5555" }, - { "transformation": "constant_propagation", "resulting_condition": "t1.b > 5555" }, - { "transformation": "trivial_condition_removal", "resulting_condition": "t1.b > 5555" @@ -9163,78 +9436,73 @@ from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.choose_best_splitting')) [ - - [ - - { - "considered_execution_plans": - [ - - { - "plan_prefix": - [ - ], - "table": "t2", - "best_access_path": + { + "considered_keys": + [ + { + "table_name": "t2", + "index": "idx_a", + "rec_per_key": 1.8367, + "param_tables": 1 + } + ], + "refills": 4, + "spl_pd_boundary": 2, + "split_plan_search": + [ + { + "considered_execution_plans": + [ { - "considered_access_paths": - [ - + "plan_prefix": + [], + "table": "t2", + "best_access_path": + { + "considered_access_paths": + [ + { + "access_type": "ref", + "index": "idx_a", + "used_range_estimates": false, + "reason": "not available", + "rows": 1.8367, + "cost": 2.000585794, + "chosen": true + }, + { + "type": "scan", + "chosen": false, + "cause": "cost" + } + ], + "chosen_access_method": { - "access_type": "ref", - "index": "idx_a", - "used_range_estimates": false, - "reason": "not available", - "rows": 1.8367, + "type": "ref", + "records": 1.8367, "cost": 2.000585794, - "chosen": true - }, - - { - "type": "scan", - "chosen": false, - "cause": "cost" + "uses_join_buffering": false } - ], - "chosen_access_method": - { - "type": "ref", - "records": 1.8367, - "cost": 2.000585794, - "uses_join_buffering": false - } - }, - "rows_for_plan": 1.8367, - "cost_for_plan": 2.367925794, - "cost_for_sorting": 1.8367, - "estimated_join_cardinality": 1.8367 - } - ] - }, - - { - "best_splitting": - { - "table": "t2", - "key": "idx_a", - "record_count": 4, - "cost": 2.488945919, - "unsplit_cost": 25.72361682 + }, + "rows_for_plan": 1.8367, + "cost_for_plan": 2.367925794, + "cost_for_sorting": 1.8367 + } + ] } - } - ] -] -select -json_detailed(json_extract(trace, '$**.lateral_derived')) -from -information_schema.optimizer_trace; -json_detailed(json_extract(trace, '$**.lateral_derived')) -[ - + ], + "lead_table": "t2", + "index": "idx_a", + "parts": 1, + "split_sel": 0.020407778, + "cost": 2.488945919, + "unsplit_cost": 25.72361682, + "records": 1, + "chosen": true + }, { - "startup_cost": 9.955783677, - "splitting_cost": 2.488945919, - "records": 1 + "considered_keys": + [] } ] drop table t1,t2; @@ -9258,7 +9526,6 @@ select json_detailed(json_extract(trace, '$**.best_join_order')) from information_schema.OPTIMIZER_TRACE; json_detailed(json_extract(trace, '$**.best_join_order')) [ - [ "t1", "" diff --git a/mysql-test/main/opt_trace.test b/mysql-test/main/opt_trace.test index b689c80db1e6b..171f5a2627fc3 100644 --- a/mysql-test/main/opt_trace.test +++ b/mysql-test/main/opt_trace.test @@ -21,6 +21,7 @@ create view v2 as select * from t1 where t1.a=1 group by t1.b; set optimizer_trace="enabled=on"; --echo # Mergeable views/derived tables +--disable_view_protocol select * from v1; select * from information_schema.OPTIMIZER_TRACE; select * from (select * from t1 where t1.a=1)q; @@ -29,7 +30,7 @@ select * from information_schema.OPTIMIZER_TRACE; --echo # Non-Mergeable views select * from v2; select * from information_schema.OPTIMIZER_TRACE; - +--enable_view_protocol drop table t1,t2; drop view v1,v2; drop function f1; @@ -276,6 +277,7 @@ end| --disable_prepare_warnings delimiter ;| +--disable_view_protocol set optimizer_trace='enabled=on'; select f1(a) from t1; select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; @@ -285,11 +287,12 @@ drop table t1,t2; drop function f1; drop function f2; set optimizer_trace='enabled=off'; +--enable_view_protocol --echo # --echo # MDEV-18489: Limit the memory used by the optimizer trace --echo # - +--disable_view_protocol create table t1 (a int); insert into t1 values (1),(2); @@ -308,7 +311,7 @@ select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; drop table t1; set optimizer_trace='enabled=off'; set @@optimizer_trace_max_mem_size= @save_optimizer_trace_max_mem_size; - +--enable_view_protocol --echo # --echo # MDEV-18527: Optimizer trace for DELETE query shows table:null --echo # @@ -405,6 +408,8 @@ create table t1 ( a int, b int, key a_b(a,b)); insert into t1 select a,a from one_k; set optimizer_trace='enabled=on'; +#enable after fix MDEV-27871 +--disable_view_protocol explain select * from t1 force index (a_b) where a=2 and b=4; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; @@ -503,6 +508,7 @@ insert into t1 select date_add(now(), interval a day), date_add(now(), interval explain format=json select * from t1 force index(start_date) where start_date >= '2019-02-10' and end_date <'2019-04-01'; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; drop table t1, t0, one_k; +--enable_view_protocol --echo # --echo # MDEV-19776: Assertion `to_len >= 8' failed in convert_to_printable with optimizer trace enabled @@ -532,6 +538,8 @@ set optimizer_trace=1; --echo # (cost_for_plan is the same as best_access_path.cost for single-table SELECTs --echo # but for joins using condition selectivity it is not as trivial. So, --echo # now we are printing it) +#enable after fix MDEV-27871 +--disable_view_protocol explain select * from t0 A, one_k B where A.a<5 and B.a<800; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; @@ -541,6 +549,7 @@ set join_cache_level=@tmp_jcl; explain select * from t0 A, one_k B where A.a=B.b and B.a<800; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; drop table t0, one_k; +--enable_view_protocol --echo # --echo # Assertion `to_len >= 8' failed in convert_to_printable @@ -551,8 +560,10 @@ insert into t1 values ('foo'), ('bar'); EXPLAIN SELECT * FROM t1 WHERE a= REPEAT('a', 0); SELECT * FROM t1 WHERE a= REPEAT('a', 0); +#enable after fix MDEV-27871 +--disable_view_protocol select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; - +--enable_view_protocol DROP TABLE t1; --echo # @@ -582,7 +593,10 @@ create table t1 (kp1 int, kp2 int, key(kp1, kp2)); insert into t1 values (1,1),(1,5),(5,1),(5,5); set optimizer_trace=1; select * from t1 force index(kp1) where (kp1=2 and kp2 >=4); +#enable after fix MDEV-27871 +--disable_view_protocol select JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t1; --echo # @@ -594,10 +608,13 @@ INSERT INTO t1 SELECT seq, seq from seq_1_to_10; CREATE TABLE t2(a INT, b INT, key(a)); INSERT INTO t2 SELECT seq, seq from seq_1_to_100; +#enable after fix MDEV-27871 +--disable_view_protocol SET OPTIMIZER_TRACE=1; EXPLAIN SELECT * FROM t1, t2 WHERE t1.a=t2.a ORDER BY t2.b; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; DROP TABLE t1,t2; +--enable_view_protocol --echo # --echo # MDEV-22665: Print ranges in the optimizer trace created for non-indexed columns when @@ -608,12 +625,15 @@ CREATE TABLE t1(a INT, b INT); INSERT INTO t1 SELECT seq, seq from seq_1_to_100; SET optimizer_trace=1; ANALYZE TABLE t1 PERSISTENT FOR ALL; +#enable after fix MDEV-27871 +--disable_view_protocol EXPLAIN EXTENDED SELECT * from t1 WHERE a between 1 and 5 and b <= 5; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; EXPLAIN EXTENDED SELECT * from t1 WHERE a != 5; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; EXPLAIN EXTENDED SELECT * from t1 WHERE b >= 10 and b < 25; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t1; --echo # @@ -624,7 +644,10 @@ drop table t1; CREATE TABLE t1( a INT, b INT, PRIMARY KEY( a ) ); SELECT sum(b), row_number() OVER (order by b) FROM t1 WHERE a = 101; UPDATE t1 SET b=10 WHERE a=1; +#enable after fix MDEV-27871 +--disable_view_protocol SELECT JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol DROP TABLE t1; set optimizer_trace='enabled=off'; @@ -642,11 +665,12 @@ set max_session_mem_used=default; --echo # --echo # MDEV-22380 Assertion `name.length == strlen(name.str)' failed in Item::print_item_w_name on SELECT w/ optimizer_trace enabled --echo # - +--disable_view_protocol SET optimizer_trace="enabled=on"; SELECT 'a\0' LIMIT 0; SELECT query, trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; SET optimizer_trace=DEFAULT; +--enable_view_protocol --echo # --echo # MDEV-27238: Assertion `got_name == named_item_expected()' failed in Json_writer::on_start_object @@ -658,6 +682,95 @@ INSERT INTO t1 VALUES (0,0); SELECT a FROM t1 WHERE (a,b) in (SELECT @c,@d); DROP TABLE t1; +--echo # +--echo # MDEV-31085: multi-update using view with optimizer trace enabled +--echo # + +SET SESSION optimizer_trace = 'enabled=on'; + +CREATE TABLE t (a int, b int); +CREATE VIEW v AS SELECT 1 AS c UNION SELECT 2 AS c; +INSERT INTO t VALUES (0,4),(5,6); +UPDATE t, v SET t.b = t.a, t.a = v.c WHERE v.c < t.a; +SELECT * FROM information_schema.optimizer_trace; + +SELECT * FROM t; + +SET optimizer_trace=DEFAULT; + +DROP VIEW v; +DROP TABLE t; + +--echo # +--echo # MDEV-26301: Split optimization improvements: Optimizer Trace coverage +--echo # + +# 5 values +create table t1(a int, b int); +insert into t1 select seq,seq from seq_1_to_5; + +# 5 value groups of size 2 each +create table t2(a int, b int, key(a)); +insert into t2 +select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B; + +# 5 value groups of size 3 each +create table t3(a int, b int, key(a)); +insert into t3 +select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B; + +analyze table t1,t2,t3 persistent for all; + +create table t10 ( + grp_id int, + col1 int, + key(grp_id) +); + +# 100 groups of 100 values each +insert into t10 +select + A.seq, + B.seq +from + seq_1_to_100 A, + seq_1_to_100 B; + +# and X10 multiplier +create table t11 ( + col1 int, + col2 int +); +insert into t11 +select A.seq, A.seq from seq_1_to_10 A; + +analyze table t10,t11 persistent for all; + +set optimizer_trace=1; +explain +select * from + ( + (t1 left join t2 on t2.a=t1.b) + left join t3 on t3.a=t1.b + ) left join (select grp_id, count(*) + from t10 left join t11 on t11.col1=t10.col1 + group by grp_id) T on T.grp_id=t1.b; + +select json_detailed(json_extract(trace, '$**.check_split_materialized')) as JS +from information_schema.optimizer_trace; + +select + json_detailed( + json_remove( + json_extract(trace, '$**.choose_best_splitting') + , '$[0].split_plan_search[0]' + ) + ) as JS +from information_schema.optimizer_trace; + +drop table t1,t2,t3,t10,t11; +set optimizer_trace=DEFAULT; + --echo # --echo # End of 10.4 tests --echo # @@ -668,8 +781,10 @@ set optimizer_trace='enabled=on'; --echo # Test many rows to see output of big cost numbers --echo # +--disable_view_protocol select count(*) from seq_1_to_10000000; select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol --echo # --echo # MDEV-22891: Optimizer trace: const tables are not clearly visible @@ -689,14 +804,20 @@ insert into t3 select a,a from t0; explain select * from t1 left join (t2 join t3 on t3.pk=1000) on t2.a=t1.a and t2.pk is null; +#enable after fix MDEV-27871 +--disable_view_protocol select JSON_DETAILED(JSON_EXTRACT(trace, '$**.mark_join_nest_as_const')) from information_schema.optimizer_trace; +--enable_view_protocol drop table t0, t1, t2, t3; --echo # --echo # MDEV-23767: IN-to-subquery conversion is not visible in optimizer trace --echo # + +#enable after fix MDEV-27871 +--disable_view_protocol create table t0 (a int); INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -719,6 +840,7 @@ from information_schema.optimizer_trace; set in_predicate_conversion_threshold=@tmp; drop table t0; +--enable_view_protocol --echo # --echo # End of 10.5 tests @@ -798,10 +920,12 @@ from t1 left join (t2,t3) on t2.a=t1.a and t3.a=t2.a and t3.a + t2.a <1000 where t1.b > 5555; +--disable_view_protocol select json_detailed(json_extract(trace, '$**.substitute_best_equal')) from information_schema.optimizer_trace; +--enable_view_protocol --echo # The next query is test for: --echo # MDEV-23646: Optimizer trace: optimize_cond() should show ON expression processing @@ -848,17 +972,12 @@ where t1.b < 3; # Just show that choose_best_splitting function has coverage in the # optimizer trace and re-optmization of child select inside it is distinct # from the rest of join optimization. +--disable_view_protocol select json_detailed(json_extract(trace, '$**.choose_best_splitting')) from information_schema.optimizer_trace; - -# Same as above. just to show that splitting plan has some coverage in the -# trace. -select - json_detailed(json_extract(trace, '$**.lateral_derived')) -from - information_schema.optimizer_trace; +--enable_view_protocol drop table t1,t2; @@ -870,9 +989,11 @@ CREATE TABLE t1(id INT, f1 JSON); INSERT INTO t1 VALUES (1, '{\"1\": 1}'), (2, '{\"1\": 2}'), (3, '{\"1\": 3}'), (4, '{\"1\": 4}'), (5, '{\"1\": 5}'), (6, '{\"1\": 6}'); +--disable_view_protocol SELECT * FROM t1 WHERE id IN (SELECT id FROM t1 as tt2, JSON_TABLE(f1, "$" COLUMNS (jf FOR ORDINALITY)) AS tbl); +--enable_view_protocol select json_detailed(json_extract(trace, '$**.best_join_order')) from information_schema.OPTIMIZER_TRACE; diff --git a/mysql-test/main/opt_trace_index_merge.result b/mysql-test/main/opt_trace_index_merge.result index f1e13586eda19..1ef7565690e98 100644 --- a/mysql-test/main/opt_trace_index_merge.result +++ b/mysql-test/main/opt_trace_index_merge.result @@ -221,8 +221,7 @@ explain select * from t1 where a=1 or b=1 { } }, "rows_for_plan": 2, - "cost_for_plan": 2.884903732, - "estimated_join_cardinality": 2 + "cost_for_plan": 2.884903732 } ] }, @@ -312,17 +311,13 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": [ - { "index": "key1", "ranges": - [ - "(100) <= (key1) <= (100)" - ], + ["(100) <= (key1) <= (100)"], "rowid_ordered": true, "using_mrr": false, "index_only": false, @@ -330,13 +325,10 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cost": 2700.058937, "chosen": true }, - { "index": "key2", "ranges": - [ - "(100) <= (key2) <= (100)" - ], + ["(100) <= (key2) <= (100)"], "rowid_ordered": true, "using_mrr": false, "index_only": false, @@ -345,13 +337,10 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "chosen": false, "cause": "cost" }, - { "index": "key3", "ranges": - [ - "(100) <= (key3) <= (100)" - ], + ["(100) <= (key3) <= (100)"], "rowid_ordered": true, "using_mrr": false, "index_only": false, @@ -365,7 +354,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) { "intersecting_indexes": [ - { "index": "key1", "index_scan_cost": 10.31393703, @@ -377,7 +365,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "intersect_covering_with_this_index": false, "chosen": true }, - { "index": "key2", "index_scan_cost": 10.31393703, @@ -389,7 +376,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "intersect_covering_with_this_index": false, "chosen": true }, - { "index": "key3", "index_scan_cost": 10.31393703, @@ -413,14 +399,12 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "chosen": true }, "analyzing_index_merge_union": - [ - ] + [] } ] select JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary')) [ - { "range_access_plan": { @@ -431,35 +415,26 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary')) "clustered_pk_scan": false, "intersect_of": [ - { "type": "range_scan", "index": "key1", "rows": 2243, "ranges": - [ - "(100) <= (key1) <= (100)" - ] + ["(100) <= (key1) <= (100)"] }, - { "type": "range_scan", "index": "key2", "rows": 2243, "ranges": - [ - "(100) <= (key2) <= (100)" - ] + ["(100) <= (key2) <= (100)"] }, - { "type": "range_scan", "index": "key3", "rows": 2243, "ranges": - [ - "(100) <= (key3) <= (100)" - ] + ["(100) <= (key3) <= (100)"] } ] }, @@ -475,32 +450,25 @@ id select_type table type possible_keys key key_len ref rows Extra select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": - [ - ], + [], "analyzing_roworder_intersect": { "cause": "too few roworder scans" }, "analyzing_index_merge_union": [ - { "indexes_to_merge": [ - { "range_scan_alternatives": [ - { "index": "key1", "ranges": - [ - "(100) <= (key1) <= (100)" - ], + ["(100) <= (key1) <= (100)"], "rowid_ordered": true, "using_mrr": false, "index_only": true, @@ -508,13 +476,10 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cost": 457.058937, "chosen": true }, - { "index": "key2", "ranges": - [ - "(100) <= (key2) <= (100)" - ], + ["(100) <= (key2) <= (100)"], "rowid_ordered": true, "using_mrr": false, "index_only": true, @@ -527,17 +492,13 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "index_to_merge": "key1", "cumulated_cost": 457.058937 }, - { "range_scan_alternatives": [ - { "index": "key3", "ranges": - [ - "(100) <= (key3) <= (100)" - ], + ["(100) <= (key3) <= (100)"], "rowid_ordered": true, "using_mrr": false, "index_only": true, @@ -545,13 +506,10 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cost": 457.058937, "chosen": true }, - { "index": "key4", "ranges": - [ - "(100) <= (key4) <= (100)" - ], + ["(100) <= (key4) <= (100)"], "rowid_ordered": true, "using_mrr": false, "index_only": true, @@ -570,20 +528,16 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cause": "always cheaper than non roworder retrieval", "analyzing_roworder_scans": [ - { "type": "range_scan", "index": "key1", "rows": 2243, "ranges": - [ - "(100) <= (key1) <= (100)" - ], + ["(100) <= (key1) <= (100)"], "analyzing_roworder_intersect": { "intersecting_indexes": [ - { "index": "key1", "index_scan_cost": 10.31393703, @@ -595,7 +549,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "intersect_covering_with_this_index": false, "chosen": true }, - { "index": "key2", "index_scan_cost": 10.31393703, @@ -619,20 +572,16 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "chosen": true } }, - { "type": "range_scan", "index": "key3", "rows": 2243, "ranges": - [ - "(100) <= (key3) <= (100)" - ], + ["(100) <= (key3) <= (100)"], "analyzing_roworder_intersect": { "intersecting_indexes": [ - { "index": "key3", "index_scan_cost": 10.31393703, @@ -644,7 +593,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "intersect_covering_with_this_index": false, "chosen": true }, - { "index": "key4", "index_scan_cost": 10.31393703, @@ -679,14 +627,12 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) select JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary')) [ - { "range_access_plan": { "type": "index_roworder_union", "union_of": [ - { "type": "index_roworder_intersect", "rows": 77, @@ -695,29 +641,22 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary')) "clustered_pk_scan": false, "intersect_of": [ - { "type": "range_scan", "index": "key1", "rows": 2243, "ranges": - [ - "(100) <= (key1) <= (100)" - ] + ["(100) <= (key1) <= (100)"] }, - { "type": "range_scan", "index": "key2", "rows": 2243, "ranges": - [ - "(100) <= (key2) <= (100)" - ] + ["(100) <= (key2) <= (100)"] } ] }, - { "type": "index_roworder_intersect", "rows": 77, @@ -726,25 +665,19 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary')) "clustered_pk_scan": false, "intersect_of": [ - { "type": "range_scan", "index": "key3", "rows": 2243, "ranges": - [ - "(100) <= (key3) <= (100)" - ] + ["(100) <= (key3) <= (100)"] }, - { "type": "range_scan", "index": "key4", "rows": 2243, "ranges": - [ - "(100) <= (key4) <= (100)" - ] + ["(100) <= (key4) <= (100)"] } ] } diff --git a/mysql-test/main/opt_trace_index_merge.test b/mysql-test/main/opt_trace_index_merge.test index 73240b6a9e2a0..8591821118484 100644 --- a/mysql-test/main/opt_trace_index_merge.test +++ b/mysql-test/main/opt_trace_index_merge.test @@ -119,6 +119,8 @@ insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, -1, -1, 'key1 insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 100, 100, 'key4-key3'); set optimizer_trace='enabled=on'; +#check after fix MDEV-27871 +--disable_view_protocol --echo # 3-way ROR-intersection explain select key1,key2,key3 from t1 where key1=100 and key2=100 and key3=100; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; @@ -128,6 +130,7 @@ select JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary')) fro explain select key1,key2,key3,key4 from t1 where key1=100 and key2=100 or key3=100 and key4=100; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t0,t1; set optimizer_trace="enabled=off"; diff --git a/mysql-test/main/opt_trace_index_merge_innodb.result b/mysql-test/main/opt_trace_index_merge_innodb.result index 0ddaaeae89d1b..b9c59c7a10041 100644 --- a/mysql-test/main/opt_trace_index_merge_innodb.result +++ b/mysql-test/main/opt_trace_index_merge_innodb.result @@ -183,13 +183,13 @@ explain select * from t1 where pk1 != 0 and key1 = 1 { }, { "selectivity_for_indexes": [ - { - "index_name": "PRIMARY", - "selectivity_from_index": 1 - }, { "index_name": "key1", "selectivity_from_index": 0.001 + }, + { + "index_name": "PRIMARY", + "selectivity_from_index": 1 } ], "selectivity_for_columns": [], @@ -227,7 +227,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 { }, "rows_for_plan": 1, "cost_for_plan": 1.325146475, - "estimated_join_cardinality": 1 + "pruned_by_hanging_leaf": true } ] }, diff --git a/mysql-test/main/opt_trace_security.result b/mysql-test/main/opt_trace_security.result index e1937e744a434..7debcb06b4619 100644 --- a/mysql-test/main/opt_trace_security.result +++ b/mysql-test/main/opt_trace_security.result @@ -13,7 +13,7 @@ return a+1; END| set optimizer_trace="enabled=on"; select * from db1.t1; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `db1`.`t1` select * from information_schema.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES 0 1 @@ -107,8 +107,7 @@ select * from db1.t1 { } }, "rows_for_plan": 3, - "cost_for_plan": 2.605126953, - "estimated_join_cardinality": 3 + "cost_for_plan": 2.605126953 } ] }, @@ -229,8 +228,7 @@ select * from db1.v1 { } }, "rows_for_plan": 3, - "cost_for_plan": 2.605126953, - "estimated_join_cardinality": 3 + "cost_for_plan": 2.605126953 } ] }, diff --git a/mysql-test/main/opt_trace_security.test b/mysql-test/main/opt_trace_security.test index 9fa49190990fc..cf45a64d30bf7 100644 --- a/mysql-test/main/opt_trace_security.test +++ b/mysql-test/main/opt_trace_security.test @@ -155,6 +155,7 @@ delimiter ;| grant execute on function f1 to bar@localhost; +--disable_view_protocol connection con_foo; set optimizer_trace='enabled=on'; select * from db1.t1; @@ -186,6 +187,7 @@ select f1(a) from db1.t1; --echo # select query, INSUFFICIENT_PRIVILEGES from information_schema.OPTIMIZER_TRACE; set optimizer_trace='enabled=off'; +--enable_view_protocol connection default; select current_user(); diff --git a/mysql-test/main/opt_trace_ucs2.result b/mysql-test/main/opt_trace_ucs2.result index d8ecefddd5ed4..9e4f25f31500b 100644 --- a/mysql-test/main/opt_trace_ucs2.result +++ b/mysql-test/main/opt_trace_ucs2.result @@ -27,17 +27,13 @@ EXPLAIN select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ - { "range_scan_alternatives": [ - { "index": "col1", "ranges": - [ - "(a) <= (col1)" - ], + ["(a) <= (col1)"], "rowid_ordered": false, "using_mrr": false, "index_only": false, @@ -51,8 +47,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) "cause": "too few roworder scans" }, "analyzing_index_merge_union": - [ - ] + [] } ] drop table t1; diff --git a/mysql-test/main/opt_trace_ucs2.test b/mysql-test/main/opt_trace_ucs2.test index 827dc403d5812..1a79ea9780e87 100644 --- a/mysql-test/main/opt_trace_ucs2.test +++ b/mysql-test/main/opt_trace_ucs2.test @@ -6,5 +6,8 @@ insert into t1 values ('a', 'a'); insert into t1 values ('a', 'a'); set optimizer_trace=1; explain format=json select * from t1 force index(col1) where col1 >='a'; +#enable after fix MDEV-27871 +--disable_view_protocol select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; +--enable_view_protocol drop table t1; diff --git a/mysql-test/main/opt_tvc.result b/mysql-test/main/opt_tvc.result index 9752aa71bfb7e..9b6d97492cdba 100644 --- a/mysql-test/main/opt_tvc.result +++ b/mysql-test/main/opt_tvc.result @@ -732,3 +732,30 @@ a b 4 4 drop table t1; SET @@in_predicate_conversion_threshold= default; +# +# MDEV-27937: Prepared statement with ? in the list if IN predicate +# +set in_predicate_conversion_threshold=2; +create table t1 (id int, a int, b int); +insert into t1 values (1,3,30), (2,7,70), (3,1,10); +prepare stmt from " +select * from t1 where a in (7, ?, 5, 1); +"; +execute stmt using 3; +id a b +1 3 30 +2 7 70 +3 1 10 +deallocate prepare stmt; +prepare stmt from " +select * from t1 where (a,b) in ((7,70), (3,?), (5,50), (1,10)); +"; +execute stmt using 30; +id a b +1 3 30 +2 7 70 +3 1 10 +deallocate prepare stmt; +drop table t1; +set in_predicate_conversion_threshold=default; +# End of 10.3 tests diff --git a/mysql-test/main/opt_tvc.test b/mysql-test/main/opt_tvc.test index e4e8c6d791956..f8469f22aa156 100644 --- a/mysql-test/main/opt_tvc.test +++ b/mysql-test/main/opt_tvc.test @@ -428,3 +428,29 @@ eval $query; drop table t1; SET @@in_predicate_conversion_threshold= default; +--echo # +--echo # MDEV-27937: Prepared statement with ? in the list if IN predicate +--echo # + +set in_predicate_conversion_threshold=2; + +create table t1 (id int, a int, b int); +insert into t1 values (1,3,30), (2,7,70), (3,1,10); + +prepare stmt from " +select * from t1 where a in (7, ?, 5, 1); +"; +execute stmt using 3; +deallocate prepare stmt; + +prepare stmt from " +select * from t1 where (a,b) in ((7,70), (3,?), (5,50), (1,10)); +"; +execute stmt using 30; +deallocate prepare stmt; + +drop table t1; + +set in_predicate_conversion_threshold=default; + +--echo # End of 10.3 tests diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result index 81f173e764d63..b6345cd142e4d 100644 --- a/mysql-test/main/order_by.result +++ b/mysql-test/main/order_by.result @@ -1,5 +1,4 @@ call mtr.add_suppression("Sort aborted.*"); -drop table if exists t1,t2,t3; call mtr.add_suppression("Out of sort memory; increase server sort buffer size"); CREATE TABLE t1 ( id int(6) DEFAULT '0' NOT NULL, @@ -3566,6 +3565,49 @@ b a 40 1 30 4 drop table t1,t2; +# +# MDEV-22256 Assertion `length == pack_length()' failed in Field_timestamp_with_dec::sort_string +# +SET sql_mode=''; +SET @@SESSION.max_sort_length=4; +Warnings: +Warning 1292 Truncated incorrect max_sort_length value: '4' +CREATE TABLE t1 (c TIMESTAMP(1)); +INSERT INTO t1 VALUES(0); +DELETE FROM t1 ORDER BY c; +DROP TABLE t1; +SET @@SESSION.max_sort_length=DEFAULT; +SET sql_mode=DEFAULT; +SET sql_mode=''; +SET @@SESSION.max_sort_length=1; +Warnings: +Warning 1292 Truncated incorrect max_sort_length value: '1' +CREATE TEMPORARY TABLE t1 (c DATETIME); +INSERT INTO t1 VALUES(0); +DELETE FROM t1 ORDER BY c; +DROP TABLE t1; +SET @@SESSION.max_sort_length=DEFAULT; +SET sql_mode=DEFAULT; +# +# MDEV-25994 Crash with union of my_decimal type in ORDER BY clause +# +CREATE TABLE t1 (v1 INTEGER) ; +INSERT INTO t1 (v1) VALUES (8); +UPDATE t1 SET v1 = 1 ORDER BY (SELECT 1.1 UNION SELECT -1); +ERROR 21000: Subquery returns more than 1 row +# This one must be successful +UPDATE t1 SET v1 = 2 ORDER BY (SELECT 1 UNION SELECT 1); +UPDATE t1 SET v1 = 3 ORDER BY (SELECT 'a' UNION SELECT 'b'); +ERROR 21000: Subquery returns more than 1 row +# Insert some more data +INSERT INTO t1 (v1) VALUES (8),(9),(100),(-234),(46584),(0); +UPDATE t1 SET v1 = v1+1 ORDER BY (SELECT 100.122 UNION SELECT -189.2); +ERROR 21000: Subquery returns more than 1 row +# This one must be successful +UPDATE t1 SET v1 = v1-200 ORDER BY (SELECT 1 UNION SELECT 1); +UPDATE t1 SET v1 = v1 ORDER BY (SELECT 'abc' UNION SELECT 'bbb'); +ERROR 21000: Subquery returns more than 1 row +DROP TABLE t1; # End of 10.2 tests # # MDEV-16214: Incorrect plan taken by the optimizer , uses INDEX instead of ref access with ORDER BY @@ -4487,3 +4529,38 @@ a group_concat(t1.b) 58 1 DROP TABLE t1, t2; # End of 10.6 tests +# +# MDEV-13756 Implement descending index: KEY (a DESC, b ASC) +# +create table t1 (a int, b int, c int, key r (a desc, b asc)); +insert t1 select seq % 10, seq div 10, seq from seq_1_to_55; +insert t1 values (NULL, NULL, NULL), (9, NULL, NULL); +explain select * from t1 force index(r) order by a,b limit 20; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 57 Using filesort +explain select * from t1 force index(r) order by a desc,b limit 20; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL r 10 NULL 20 +select * from t1 force index(r) order by a desc,b limit 20; +a b c +9 NULL NULL +9 0 9 +9 1 19 +9 2 29 +9 3 39 +9 4 49 +8 0 8 +8 1 18 +8 2 28 +8 3 38 +8 4 48 +7 0 7 +7 1 17 +7 2 27 +7 3 37 +7 4 47 +6 0 6 +6 1 16 +6 2 26 +6 3 36 +drop table t1; diff --git a/mysql-test/main/order_by.test b/mysql-test/main/order_by.test index 9ad0af1d21ff2..1cd9efa27104a 100644 --- a/mysql-test/main/order_by.test +++ b/mysql-test/main/order_by.test @@ -1,13 +1,14 @@ +--source include/no_valgrind_without_big.inc # # Testing ORDER BY # -call mtr.add_suppression("Sort aborted.*"); - ---disable_warnings -drop table if exists t1,t2,t3; ---enable_warnings +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +# Check after fix MDEV-27871, possible this include can be removed +--source include/no_view_protocol.inc +call mtr.add_suppression("Sort aborted.*"); call mtr.add_suppression("Out of sort memory; increase server sort buffer size"); --source include/have_sequence.inc @@ -15,8 +16,6 @@ call mtr.add_suppression("Out of sort memory; increase server sort buffer size") # Test old ORDER BY bug # ---source include/have_sequence.inc - CREATE TABLE t1 ( id int(6) DEFAULT '0' NOT NULL, idservice int(5), @@ -2311,6 +2310,54 @@ explain (select b,a from t2 order by a limit 3) order by b desc; drop table t1,t2; +--echo # +--echo # MDEV-22256 Assertion `length == pack_length()' failed in Field_timestamp_with_dec::sort_string +--echo # + +SET sql_mode=''; +SET @@SESSION.max_sort_length=4; +CREATE TABLE t1 (c TIMESTAMP(1)); +INSERT INTO t1 VALUES(0); +DELETE FROM t1 ORDER BY c; +DROP TABLE t1; +SET @@SESSION.max_sort_length=DEFAULT; +SET sql_mode=DEFAULT; + +SET sql_mode=''; +SET @@SESSION.max_sort_length=1; +CREATE TEMPORARY TABLE t1 (c DATETIME); +INSERT INTO t1 VALUES(0); +DELETE FROM t1 ORDER BY c; +DROP TABLE t1; +SET @@SESSION.max_sort_length=DEFAULT; +SET sql_mode=DEFAULT; + +--echo # +--echo # MDEV-25994 Crash with union of my_decimal type in ORDER BY clause +--echo # + +CREATE TABLE t1 (v1 INTEGER) ; +INSERT INTO t1 (v1) VALUES (8); +--error ER_SUBQUERY_NO_1_ROW +UPDATE t1 SET v1 = 1 ORDER BY (SELECT 1.1 UNION SELECT -1); +--echo # This one must be successful +UPDATE t1 SET v1 = 2 ORDER BY (SELECT 1 UNION SELECT 1); +--error ER_SUBQUERY_NO_1_ROW +UPDATE t1 SET v1 = 3 ORDER BY (SELECT 'a' UNION SELECT 'b'); + +-- echo # Insert some more data +INSERT INTO t1 (v1) VALUES (8),(9),(100),(-234),(46584),(0); +--error ER_SUBQUERY_NO_1_ROW +UPDATE t1 SET v1 = v1+1 ORDER BY (SELECT 100.122 UNION SELECT -189.2); +--echo # This one must be successful +UPDATE t1 SET v1 = v1-200 ORDER BY (SELECT 1 UNION SELECT 1); +--error ER_SUBQUERY_NO_1_ROW +UPDATE t1 SET v1 = v1 ORDER BY (SELECT 'abc' UNION SELECT 'bbb'); + + +DROP TABLE t1; + + --echo # End of 10.2 tests --echo # @@ -2649,3 +2696,14 @@ eval $query; DROP TABLE t1, t2; --echo # End of 10.6 tests + +--echo # +--echo # MDEV-13756 Implement descending index: KEY (a DESC, b ASC) +--echo # +create table t1 (a int, b int, c int, key r (a desc, b asc)); +insert t1 select seq % 10, seq div 10, seq from seq_1_to_55; +insert t1 values (NULL, NULL, NULL), (9, NULL, NULL); +explain select * from t1 force index(r) order by a,b limit 20; +explain select * from t1 force index(r) order by a desc,b limit 20; + select * from t1 force index(r) order by a desc,b limit 20; +drop table t1; diff --git a/mysql-test/main/order_by_innodb.result b/mysql-test/main/order_by_innodb.result index 28922ef65f27a..741084c8a6c3f 100644 --- a/mysql-test/main/order_by_innodb.result +++ b/mysql-test/main/order_by_innodb.result @@ -1,8 +1,8 @@ -drop table if exists t0,t1,t2,t3; # # MDEV-6434: Wrong result (extra rows) with ORDER BY, multiple-column index, InnoDB # -CREATE TABLE t1 (a INT, b INT, c INT, d TEXT, KEY idx(a,b,c)) ENGINE=InnoDB; +CREATE TABLE t1 (a INT, b INT, c INT, d TEXT, KEY idx(a,b,c)) ENGINE=InnoDB +STATS_PERSISTENT=0; INSERT INTO t1 (a,c) VALUES (8, 9),(8, 10),(13, 15),(16, 17),(16, 18),(16, 19),(20, 21), (20, 22),(20, 24),(20, 25),(20, 26),(20, 27),(20, 28); @@ -14,8 +14,6 @@ DROP TABLE t1; # # MDEV-9457: Poor query plan chosen for ORDER BY query by a recent 10.1 # -create table t0 (a int); -insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t1 ( pk int primary key, key1 int, @@ -23,15 +21,9 @@ key2 int, col1 char(255), key(key1), key(key2) -) engine=innodb; -set @a=-1; +) engine=innodb stats_persistent=0; insert into t1 -select -@a:=@a+1, -@a, -@a, -repeat('abcd', 63) -from t0 A, t0 B, t0 C, t0 D; +select seq,seq,seq,repeat('abcd', 63) from seq_0_to_9999; # The following must NOT use 'index' on PK. # It should use index_merge(key1,key2) + filesort explain @@ -47,7 +39,7 @@ from t1 where key1<3 or key2<3; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where -drop table t0, t1; +drop table t1; # # MDEV-18094: Query with order by limit picking index scan over filesort # @@ -78,9 +70,12 @@ drop table t1,t0; # MDEV-14071: wrong results with orderby_uses_equalities=on # (duplicate of MDEV-13994) # -CREATE TABLE t1 (i int, j int, z int,PRIMARY KEY (i,j), KEY (z)) ENGINE=InnoDB; -CREATE TABLE t2 (i int, j int, PRIMARY KEY (i,j)) ENGINE=InnoDB; -CREATE TABLE t3 (j int, n varchar(5), PRIMARY KEY (j)) ENGINE=InnoDB; +CREATE TABLE t1 (i int, j int, z int,PRIMARY KEY (i,j), KEY (z)) ENGINE=InnoDB +STATS_PERSISTENT=0; +CREATE TABLE t2 (i int, j int, PRIMARY KEY (i,j)) ENGINE=InnoDB +STATS_PERSISTENT=0; +CREATE TABLE t3 (j int, n varchar(5), PRIMARY KEY (j)) ENGINE=InnoDB +STATS_PERSISTENT=0; INSERT INTO t1 VALUES (127,0,1),(188,0,1),(206,0,1),(218,0,1),(292,0,1),(338,0,1),(375,0,1), (381,0,1),(409,0,1),(466,0,1),(469,0,1),(498,0,1),(656,0,1); @@ -150,7 +145,8 @@ DROP TABLE t1,t2,t3; # # MDEV-25858: Query results are incorrect when indexes are added # -CREATE TABLE t1 (id int NOT NULL PRIMARY KEY) engine=innodb; +CREATE TABLE t1 (id int NOT NULL PRIMARY KEY) engine=innodb +STATS_PERSISTENT=0; insert into t1 values (1),(2),(3); CREATE TABLE t2 ( id int NOT NULL PRIMARY KEY, @@ -158,7 +154,7 @@ id2 int NOT NULL, d1 datetime, d2 timestamp NOT NULL, KEY id2 (id2) -) engine=innodb; +) engine=innodb stats_persistent=0; insert into t2 values (1,2,'2019-03-05 00:00:00','2019-03-06 00:00:00'), (2,3,'2019-03-05 00:00:00','2019-03-06 00:00:00'), @@ -180,7 +176,7 @@ id id 1 NULL 2 1 3 3 -create index for_latest_sort on t2 (d1 desc, d2 desc, id desc); +create index for_latest_sort on t2 (d1, d2, id); select t1.id,t2.id from @@ -198,6 +194,36 @@ id id 1 NULL 2 1 3 3 +# Now, same as above but use a DESC index +CREATE TABLE t3 ( +id int NOT NULL PRIMARY KEY, +id2 int NOT NULL, +d1 datetime, +d2 timestamp NOT NULL, +KEY id2 (id2) +) engine=innodb; +insert into t3 values +(1,2,'2019-03-05 00:00:00','2019-03-06 00:00:00'), +(2,3,'2019-03-05 00:00:00','2019-03-06 00:00:00'), +(3,3,'2019-03-06 00:00:00','2019-03-05 00:00:00'); +create index for_latest_sort on t3 (d1 desc, d2 desc, id desc); +select +t1.id,t3.id +from +t1 left join +t3 on t3.id2 = t1.id and +t3.id = (select dd.id +from t3 dd +where +dd.id2 = t1.id and +d1 > '2019-02-06 00:00:00' + order by +dd.d1 desc, dd.d2 desc, dd.id desc limit 1 +); +id id +1 NULL +2 1 +3 3 # # MDEV-27270: Wrong query plan with Range Checked for Each Record and ORDER BY ... LIMIT # @@ -221,5 +247,40 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index 1 PRIMARY t2 eq_ref PRIMARY,id2 PRIMARY 4 func # Using where 2 DEPENDENT SUBQUERY dd range id2,for_latest_sort for_latest_sort 6 NULL # Using where -drop table t1,t2; +drop table t1,t2,t3; # End of 10.2 tests +# +# MDEV-26938 Support descending indexes internally in InnoDB +# +create table t1 (a int, b int, c int, key r (a desc, b asc)); +insert t1 select seq % 10, seq div 10, seq from seq_1_to_55; +insert t1 values (NULL, NULL, NULL), (9, NULL, NULL); +explain select * from t1 force index(r) order by a,b limit 20; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 57 Using filesort +explain select * from t1 force index(r) order by a desc,b limit 20; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL r 10 NULL 20 +select * from t1 force index(r) order by a desc,b limit 20; +a b c +9 NULL NULL +9 0 9 +9 1 19 +9 2 29 +9 3 39 +9 4 49 +8 0 8 +8 1 18 +8 2 28 +8 3 38 +8 4 48 +7 0 7 +7 1 17 +7 2 27 +7 3 37 +7 4 47 +6 0 6 +6 1 16 +6 2 26 +6 3 36 +drop table t1; diff --git a/mysql-test/main/order_by_innodb.test b/mysql-test/main/order_by_innodb.test index af12644c07357..bdaef56672fc0 100644 --- a/mysql-test/main/order_by_innodb.test +++ b/mysql-test/main/order_by_innodb.test @@ -2,16 +2,14 @@ # ORDER BY handling (e.g. filesort) tests that require innodb # -- source include/have_innodb.inc - ---disable_warnings -drop table if exists t0,t1,t2,t3; ---enable_warnings +-- source include/have_sequence.inc --echo # --echo # MDEV-6434: Wrong result (extra rows) with ORDER BY, multiple-column index, InnoDB --echo # -CREATE TABLE t1 (a INT, b INT, c INT, d TEXT, KEY idx(a,b,c)) ENGINE=InnoDB; +CREATE TABLE t1 (a INT, b INT, c INT, d TEXT, KEY idx(a,b,c)) ENGINE=InnoDB +STATS_PERSISTENT=0; INSERT INTO t1 (a,c) VALUES (8, 9),(8, 10),(13, 15),(16, 17),(16, 18),(16, 19),(20, 21), @@ -24,9 +22,6 @@ DROP TABLE t1; --echo # --echo # MDEV-9457: Poor query plan chosen for ORDER BY query by a recent 10.1 --echo # -create table t0 (a int); -insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); - create table t1 ( pk int primary key, key1 int, @@ -34,16 +29,10 @@ create table t1 ( col1 char(255), key(key1), key(key2) -) engine=innodb; +) engine=innodb stats_persistent=0; -set @a=-1; insert into t1 -select - @a:=@a+1, - @a, - @a, - repeat('abcd', 63) -from t0 A, t0 B, t0 C, t0 D; +select seq,seq,seq,repeat('abcd', 63) from seq_0_to_9999; --echo # The following must NOT use 'index' on PK. --echo # It should use index_merge(key1,key2) + filesort @@ -60,7 +49,7 @@ select * from t1 where key1<3 or key2<3; -drop table t0, t1; +drop table t1; --echo # --echo # MDEV-18094: Query with order by limit picking index scan over filesort @@ -93,9 +82,12 @@ drop table t1,t0; --echo # (duplicate of MDEV-13994) --echo # -CREATE TABLE t1 (i int, j int, z int,PRIMARY KEY (i,j), KEY (z)) ENGINE=InnoDB; -CREATE TABLE t2 (i int, j int, PRIMARY KEY (i,j)) ENGINE=InnoDB; -CREATE TABLE t3 (j int, n varchar(5), PRIMARY KEY (j)) ENGINE=InnoDB; +CREATE TABLE t1 (i int, j int, z int,PRIMARY KEY (i,j), KEY (z)) ENGINE=InnoDB +STATS_PERSISTENT=0; +CREATE TABLE t2 (i int, j int, PRIMARY KEY (i,j)) ENGINE=InnoDB +STATS_PERSISTENT=0; +CREATE TABLE t3 (j int, n varchar(5), PRIMARY KEY (j)) ENGINE=InnoDB +STATS_PERSISTENT=0; INSERT INTO t1 VALUES (127,0,1),(188,0,1),(206,0,1),(218,0,1),(292,0,1),(338,0,1),(375,0,1), @@ -139,7 +131,8 @@ DROP TABLE t1,t2,t3; --echo # MDEV-25858: Query results are incorrect when indexes are added --echo # -CREATE TABLE t1 (id int NOT NULL PRIMARY KEY) engine=innodb; +CREATE TABLE t1 (id int NOT NULL PRIMARY KEY) engine=innodb +STATS_PERSISTENT=0; insert into t1 values (1),(2),(3); CREATE TABLE t2 ( @@ -148,7 +141,7 @@ CREATE TABLE t2 ( d1 datetime, d2 timestamp NOT NULL, KEY id2 (id2) -) engine=innodb; +) engine=innodb stats_persistent=0; insert into t2 values (1,2,'2019-03-05 00:00:00','2019-03-06 00:00:00'), @@ -169,7 +162,7 @@ from dd.d1 desc, dd.d2 desc, dd.id desc limit 1 ); -create index for_latest_sort on t2 (d1 desc, d2 desc, id desc); +create index for_latest_sort on t2 (d1, d2, id); select t1.id,t2.id @@ -185,6 +178,38 @@ from dd.d1 desc, dd.d2 desc, dd.id desc limit 1 ); +--echo # Now, same as above but use a DESC index + +CREATE TABLE t3 ( + id int NOT NULL PRIMARY KEY, + id2 int NOT NULL, + d1 datetime, + d2 timestamp NOT NULL, + KEY id2 (id2) +) engine=innodb; + +insert into t3 values + (1,2,'2019-03-05 00:00:00','2019-03-06 00:00:00'), + (2,3,'2019-03-05 00:00:00','2019-03-06 00:00:00'), + (3,3,'2019-03-06 00:00:00','2019-03-05 00:00:00'); +create index for_latest_sort on t3 (d1 desc, d2 desc, id desc); + + +select + t1.id,t3.id +from + t1 left join + t3 on t3.id2 = t1.id and + t3.id = (select dd.id + from t3 dd + where + dd.id2 = t1.id and + d1 > '2019-02-06 00:00:00' + order by + dd.d1 desc, dd.d2 desc, dd.id desc limit 1 + ); + + --echo # --echo # MDEV-27270: Wrong query plan with Range Checked for Each Record and ORDER BY ... LIMIT --echo # @@ -206,6 +231,18 @@ from order by dd.d1, dd.d2, dd.id limit 1 ); -drop table t1,t2; + +drop table t1,t2,t3; --echo # End of 10.2 tests + +--echo # +--echo # MDEV-26938 Support descending indexes internally in InnoDB +--echo # +create table t1 (a int, b int, c int, key r (a desc, b asc)); +insert t1 select seq % 10, seq div 10, seq from seq_1_to_55; +insert t1 values (NULL, NULL, NULL), (9, NULL, NULL); +explain select * from t1 force index(r) order by a,b limit 20; +explain select * from t1 force index(r) order by a desc,b limit 20; + select * from t1 force index(r) order by a desc,b limit 20; +drop table t1; diff --git a/mysql-test/main/outfile_loaddata.test b/mysql-test/main/outfile_loaddata.test index 85e26ac7b4ec1..9d966b1e99d0b 100644 --- a/mysql-test/main/outfile_loaddata.test +++ b/mysql-test/main/outfile_loaddata.test @@ -2,8 +2,12 @@ DROP TABLE IF EXISTS t1, t2; --enable_warnings +#enable view protocol after fix MDEV-27871 +-- source include/no_view_protocol.inc + --enable_prepare_warnings + --echo # --echo # Bug#31663 FIELDS TERMINATED BY special character --echo # diff --git a/mysql-test/main/parser.result b/mysql-test/main/parser.result index 6a24e43587850..89732e20b4065 100644 --- a/mysql-test/main/parser.result +++ b/mysql-test/main/parser.result @@ -1316,7 +1316,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, UNIQUE KEY `id` (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create or replace view v1 as select 1 between (2 between 3 and 4) and 5; Select view_definition from information_schema.views where table_schema='test' and table_name='v1'; @@ -1364,6 +1364,48 @@ SELECT tmp 1.e.test FROM scientific_notation AS tmp; 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 '1.e.test FROM scientific_notation AS tmp' at line 1 DROP TABLE scientific_notation; # +# MDEV-6899 extra semicolon in show create event syntax +# +set timestamp=unix_timestamp('2020-10-10 5:5:5'); +create table t1 (a int); +create trigger a before insert on t1 for each row set @a:=1;select 2$ +2 +2 +show create trigger a; +Trigger a +sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +SQL Original Statement CREATE DEFINER=`root`@`localhost` trigger a before insert on t1 for each row set @a:=1 +character_set_client latin1 +collation_connection latin1_swedish_ci +Database Collation latin1_swedish_ci +Created 2020-10-10 05:05:05.00 +drop table t1; +create procedure a() select 1;select 2$ +2 +2 +show create procedure a; +Procedure a +sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +Create Procedure CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +select 1 +character_set_client latin1 +collation_connection latin1_swedish_ci +Database Collation latin1_swedish_ci +drop procedure a; +create function a() returns int return 1;select 2$ +2 +2 +show create function a; +Function a +sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +Create Function CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +return 1 +character_set_client latin1 +collation_connection latin1_swedish_ci +Database Collation latin1_swedish_ci +drop function a; +set timestamp=default; +# # End of 10.2 tests # # @@ -1865,8 +1907,39 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp EXECUTE IMMEDIATE 'CREATE PROCEDURE p() UPDATE t SET c=\'\'"abc'; 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 '"abc' at line 1 SET @@sql_mode=@save_sql_mode; +# +# MDEV-30151 parse error 1=2 not between/in +# +SELECT 1=2 NOT IN (3,4); +1=2 NOT IN (3,4) +1 +SELECT 1=2 NOT BETWEEN 3 AND 4; +1=2 NOT BETWEEN 3 AND 4 +1 +CREATE TABLE t1 ( f INT AS ( 1 IN ( 2 NOT BETWEEN 3 AND 4 ) ) ); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f` int(11) GENERATED ALWAYS AS (1 = 2 not between 3 and 4) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 ( f INT, CHECK ( 1 IN ( 2 NOT BETWEEN 3 AND 4 ) ) ); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f` int(11) DEFAULT NULL, + CONSTRAINT `CONSTRAINT_1` CHECK (1 = 2 not between 3 and 4) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE VIEW v1 AS SELECT 1 IN ( 2 NOT BETWEEN 3 AND 4 ); +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 1 = 2 not between 3 and 4 AS `1 IN ( 2 NOT BETWEEN 3 AND 4 )` latin1 latin1_swedish_ci +DROP VIEW v1; +# # End of 10.3 tests # +# # MDEV-19540: 10.4 allow lock options with SELECT in brackets # which previous version do not # diff --git a/mysql-test/main/parser.test b/mysql-test/main/parser.test index cbd3274113ad0..dcad30b36b805 100644 --- a/mysql-test/main/parser.test +++ b/mysql-test/main/parser.test @@ -408,6 +408,9 @@ select "terminated";$$ select "non terminated, space" $$ select "terminated, space"; $$ select "non terminated, comment" /* comment */$$ + +#--view-protocol test mode can not parse query +--disable_view_protocol select "terminated, comment"; /* comment */$$ # Multi queries can not be used in --ps-protocol test mode @@ -430,6 +433,7 @@ DROP PROCEDURE IF EXISTS p26030; CREATE PROCEDURE p26030() SELECT 1; CALL p26030 $$ --enable_ps_protocol +--enable_view_protocol delimiter ;$$ DROP PROCEDURE p26030; @@ -689,7 +693,12 @@ DROP TABLE IF EXISTS t1; --enable_warnings SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE; + +#enable view protocol after fix MDEV-27871 +--disable_view_protocol SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE; +--enable_view_protocol + SELECT "1997-12-31 23:59:59" + INTERVAL 1 SECOND; SELECT 1 + INTERVAL(1,0,1,2) + 1; SELECT INTERVAL(1^1,0,1,2) + 1; @@ -849,10 +858,13 @@ SELECT 1 FROM t1 WHERE EXISTS(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 PROCEDURE ANALYSE() FOR UPDATE); +#enableafter fix MDEV-29537 +--disable_view_protocol SELECT 1 FROM t1 UNION SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 FOR UPDATE; +--enable_view_protocol --error ER_CANT_USE_OPTION_HERE SELECT 1 FROM t1 @@ -880,8 +892,10 @@ UNION SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1; (SELECT 1 FROM t1 FOR UPDATE) UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1; +#enableafter fix MDEV-29537 +--disable_view_protocol SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 FOR UPDATE; - +--enable_view_protocol --echo # "INTO" clause tests @@ -1181,12 +1195,18 @@ SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL); SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL); SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); +#enable view protocol after fix MDEV-27871 +--disable_view_protocol SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); +--enable_view_protocol SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL) FROM t1; SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL) FROM t1; SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; +#enable view protocol after fix MDEV-27871 +--disable_view_protocol SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; +--enable_view_protocol --error ER_SUBQUERY_NO_1_ROW SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP); @@ -1222,10 +1242,16 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (10),(20),(30); SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); +#enable view protocol after fix MDEV-27871 +--disable_view_protocol SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1); +--enable_view_protocol SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; +#enable view protocol after fix MDEV-27871 +--disable_view_protocol SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1; +--enable_view_protocol --error ER_SUBQUERY_NO_1_ROW SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP); @@ -1404,6 +1430,32 @@ SELECT tmp 1.e.test FROM scientific_notation AS tmp; DROP TABLE scientific_notation; +--echo # +--echo # MDEV-6899 extra semicolon in show create event syntax +--echo # +--disable_ps_protocol +set timestamp=unix_timestamp('2020-10-10 5:5:5'); +create table t1 (a int); +delimiter $; +create trigger a before insert on t1 for each row set @a:=1;select 2$ +delimiter ;$ +query_vertical show create trigger a; +drop table t1; + +delimiter $; +create procedure a() select 1;select 2$ +delimiter ;$ +query_vertical show create procedure a; +drop procedure a; + +delimiter $; +create function a() returns int return 1;select 2$ +delimiter ;$ +query_vertical show create function a; +drop function a; +set timestamp=default; +--enable_ps_protocol + --echo # --echo # End of 10.2 tests --echo # @@ -1521,6 +1573,8 @@ DROP PROCEDURE p1; --echo # MDEV-16697: Fix difference between 32bit/windows and 64bit --echo # systems in allowed select nest level --echo # +#enable view protocol after fix MDEV-27871 +--disable_view_protocol SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT @@ -1531,6 +1585,7 @@ DROP PROCEDURE p1; (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT 1 ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); +--enable_view_protocol --echo # --echo # MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar @@ -1629,13 +1684,34 @@ EXECUTE IMMEDIATE 'CREATE PROCEDURE p() UPDATE t SET c=\'\'"abc'; SET @@sql_mode=@save_sql_mode; +--echo # +--echo # MDEV-30151 parse error 1=2 not between/in +--echo # + +SELECT 1=2 NOT IN (3,4); +SELECT 1=2 NOT BETWEEN 3 AND 4; + +CREATE TABLE t1 ( f INT AS ( 1 IN ( 2 NOT BETWEEN 3 AND 4 ) ) ); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 ( f INT, CHECK ( 1 IN ( 2 NOT BETWEEN 3 AND 4 ) ) ); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE VIEW v1 AS SELECT 1 IN ( 2 NOT BETWEEN 3 AND 4 ); +SHOW CREATE VIEW v1; +DROP VIEW v1; + +--echo # --echo # End of 10.3 tests +--echo # --echo # --echo # MDEV-19540: 10.4 allow lock options with SELECT in brackets --echo # which previous version do not --echo # - +--disable_service_connection create table t1 (a int); (select * from t1) for update; --error ER_WRONG_USAGE @@ -1643,11 +1719,13 @@ create table t1 (a int); (select * from t1 for update); select * from t1 for update; drop table t1; +--enable_service_connection --echo # --echo # MDEV-20108: [ERROR] mysqld got signal 11 in --echo # st_select_lex::add_table_to_list --echo # +--disable_service_connection CREATE TABLE t1 (c1 INT NULL); CREATE TABLE t2 (c1 INT NULL); @@ -1657,6 +1735,7 @@ select * from t1; select * from t2; SET STATEMENT max_statement_time=900 FOR unlock tables; drop table t1, t2; +--enable_service_connection --echo # --echo # MDEV-21616: Server crash when using diff --git a/mysql-test/main/parser_bug21114_innodb.result b/mysql-test/main/parser_bug21114_innodb.result index e39b63f571daf..8c592f2d7bb8d 100644 --- a/mysql-test/main/parser_bug21114_innodb.result +++ b/mysql-test/main/parser_bug21114_innodb.result @@ -7,7 +7,7 @@ abs CREATE TABLE `abs` ( `col2` int(11) NOT NULL, `col3` varchar(10) DEFAULT NULL, PRIMARY KEY (`col1`,`col2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE bug21114_child; Table Create Table bug21114_child CREATE TABLE `bug21114_child` ( @@ -20,7 +20,7 @@ bug21114_child CREATE TABLE `bug21114_child` ( KEY `fk_fct_space` (`fk_col3`,`fk_col4`), CONSTRAINT `fk_fct` FOREIGN KEY (`fk_col1`, `fk_col2`) REFERENCES `abs` (`col1`, `col2`), CONSTRAINT `fk_fct_space` FOREIGN KEY (`fk_col3`, `fk_col4`) REFERENCES `abs` (`col1`, `col2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE bug21114_child; DROP TABLE abs; drop table if exists field; @@ -32,7 +32,7 @@ field CREATE TABLE `field` ( `col2` int(11) NOT NULL, `col3` varchar(10) DEFAULT NULL, PRIMARY KEY (`col1`,`col2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE bug21114_child; Table Create Table bug21114_child CREATE TABLE `bug21114_child` ( @@ -45,7 +45,7 @@ bug21114_child CREATE TABLE `bug21114_child` ( KEY `fk_fct_space` (`fk_col3`,`fk_col4`), CONSTRAINT `fk_fct` FOREIGN KEY (`fk_col1`, `fk_col2`) REFERENCES `field` (`col1`, `col2`), CONSTRAINT `fk_fct_space` FOREIGN KEY (`fk_col3`, `fk_col4`) REFERENCES `field` (`col1`, `col2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE bug21114_child; DROP TABLE field; drop table if exists format; @@ -57,7 +57,7 @@ format CREATE TABLE `format` ( `col2` int(11) NOT NULL, `col3` varchar(10) DEFAULT NULL, PRIMARY KEY (`col1`,`col2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE bug21114_child; Table Create Table bug21114_child CREATE TABLE `bug21114_child` ( @@ -70,7 +70,7 @@ bug21114_child CREATE TABLE `bug21114_child` ( KEY `fk_fct_space` (`fk_col3`,`fk_col4`), CONSTRAINT `fk_fct` FOREIGN KEY (`fk_col1`, `fk_col2`) REFERENCES `format` (`col1`, `col2`), CONSTRAINT `fk_fct_space` FOREIGN KEY (`fk_col3`, `fk_col4`) REFERENCES `format` (`col1`, `col2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE bug21114_child; DROP TABLE format; drop table if exists acos; diff --git a/mysql-test/main/parser_not_embedded.result b/mysql-test/main/parser_not_embedded.result index 25349e5157751..2147e25b3b1ad 100644 --- a/mysql-test/main/parser_not_embedded.result +++ b/mysql-test/main/parser_not_embedded.result @@ -102,3 +102,23 @@ ROLLBACK AND NO CHAIN NO RELEASE; # # End of 5.5 tests # +# +# MDEV-6899 extra semicolon in show create event syntax +# +set timestamp=unix_timestamp('2020-10-10 5:5:5'); +create event a on schedule every 1 day do set @a:=1;select 2$ +2 +2 +show create event a; +Event a +sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +time_zone SYSTEM +Create Event CREATE DEFINER=`root`@`localhost` EVENT `a` ON SCHEDULE EVERY 1 DAY STARTS '2020-10-10 05:05:05' ON COMPLETION NOT PRESERVE ENABLE DO set @a:=1 +character_set_client latin1 +collation_connection latin1_swedish_ci +Database Collation latin1_swedish_ci +drop event a; +set timestamp=default; +# +# End of 10.2 tests +# diff --git a/mysql-test/main/parser_not_embedded.test b/mysql-test/main/parser_not_embedded.test index 3af1260f4ad2a..0208ee57a2ef9 100644 --- a/mysql-test/main/parser_not_embedded.test +++ b/mysql-test/main/parser_not_embedded.test @@ -99,3 +99,20 @@ ROLLBACK AND NO CHAIN NO RELEASE; --echo # --echo # End of 5.5 tests --echo # + +--echo # +--echo # MDEV-6899 extra semicolon in show create event syntax +--echo # +--disable_ps_protocol +set timestamp=unix_timestamp('2020-10-10 5:5:5'); +delimiter $; +create event a on schedule every 1 day do set @a:=1;select 2$ +delimiter ;$ +query_vertical show create event a; +drop event a; +set timestamp=default; +--enable_ps_protocol + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/main/partition.result b/mysql-test/main/partition.result index a5d84072d11f9..57aaa227030d4 100644 --- a/mysql-test/main/partition.result +++ b/mysql-test/main/partition.result @@ -93,7 +93,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 2 SELECT * FROM t1; @@ -186,7 +186,7 @@ t1 CREATE TABLE `t1` ( `ddddddddd` int(11) NOT NULL DEFAULT 0, `new_field0` varchar(50) DEFAULT NULL, PRIMARY KEY (`ID`,`aaaa,aaaaa`,`ddddddddd`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`ID`) SUBPARTITION BY LINEAR KEY (`ID`,`aaaa,aaaaa`) SUBPARTITIONS 2 @@ -263,7 +263,7 @@ t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp(), `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (unix_timestamp(`a`)) (PARTITION `p1` VALUES LESS THAN (1199134800) ENGINE = MyISAM, PARTITION `p3` VALUES LESS THAN (1247688000) ENGINE = MyISAM, @@ -342,7 +342,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET sql_mode=''; CREATE TABLE t1 (a INT) @@ -376,7 +376,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `p0` ENGINE = MEMORY, PARTITION `p1` ENGINE = MEMORY) @@ -778,7 +778,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY KEY (`a`) (PARTITION `p0` VALUES LESS THAN (1) ENGINE = MyISAM, @@ -788,7 +788,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY KEY (`a`) (PARTITION `p0` VALUES LESS THAN (1) ENGINE = MyISAM, @@ -810,7 +810,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) NOT NULL, `c` int(11) NOT NULL, PRIMARY KEY (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) drop table t1; CREATE TABLE t1 ( @@ -988,7 +988,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `x1` VALUES IN (1) ENGINE = MEMORY) drop table t1; @@ -1014,7 +1014,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) PARTITIONS 5 drop table t1; @@ -1044,7 +1044,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -1069,7 +1069,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `x1` VALUES LESS THAN (6) ENGINE = MyISAM, PARTITION `x3` VALUES LESS THAN (8) ENGINE = MyISAM, @@ -1132,7 +1132,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `p1` ENGINE = MyISAM) @@ -1141,7 +1141,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `p1` ENGINE = MyISAM) @@ -1150,7 +1150,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `p1` ENGINE = MyISAM) @@ -1159,7 +1159,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `p0` ENGINE = MEMORY, PARTITION `p1` ENGINE = MEMORY) @@ -1168,7 +1168,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int) engine=myisam @@ -1179,7 +1179,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `p1` ENGINE = MyISAM) @@ -1189,7 +1189,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 engine=myisam partition by key(a) @@ -1199,7 +1199,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `p1` ENGINE = MyISAM) @@ -1212,7 +1212,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `p0` ENGINE = MEMORY, PARTITION `p1` ENGINE = MEMORY) @@ -1223,7 +1223,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 engine=heap partition by key (a) @@ -1234,7 +1234,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `p0` ENGINE = MEMORY, PARTITION `p1` ENGINE = MEMORY) @@ -1247,7 +1247,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `p0` ENGINE = MEMORY, PARTITION `p1` ENGINE = MEMORY) @@ -1261,7 +1261,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `p0` ENGINE = MEMORY, PARTITION `p1` ENGINE = MEMORY) @@ -1407,7 +1407,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY HASH (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM) @@ -1417,7 +1417,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY HASH (`a`) (PARTITION `p0` VALUES LESS THAN (100) @@ -1431,14 +1431,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) alter table t1 add partition (partition p1); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `p1` ENGINE = MyISAM) @@ -1524,7 +1524,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p1` VALUES IN (1) ENGINE = MyISAM, PARTITION `p2` VALUES IN (2) ENGINE = MyISAM) @@ -1538,7 +1538,7 @@ t2 CREATE TABLE `t2` ( `a` int(10) unsigned NOT NULL AUTO_INCREMENT, `c` char(10) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='no comment' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='no comment' PARTITION BY KEY (`a`) drop table t2; create table t1 (f1 int) partition by hash (f1) as select 1; @@ -1735,7 +1735,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (NULL) ENGINE = MyISAM) DROP TABLE t1; @@ -1789,7 +1789,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) drop table t1; CREATE TABLE t1 (a int) ENGINE = MYISAM PARTITION BY KEY(a); @@ -1863,7 +1863,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 10 insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), @@ -2029,7 +2029,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`b`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM) @@ -2170,7 +2170,7 @@ t1 CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `user` char(25) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`id`) SUBPARTITION BY HASH (`id`) SUBPARTITIONS 2 @@ -2820,3 +2820,41 @@ DROP TABLE t1,t2; # # End of 10.1 tests # +# +# MDEV-30596: Assertion 'pushed_rowid_filter != __null ...' failed +# +create table t1 (a int); +insert into t1 values (NULL),(1),(2); +create table t2 (a int); +insert into t2 select seq from seq_1_to_1000; +create table t3 ( +a1 int, +a2 int, +b int, +c int, +filler1 char(200), +filler2 char(200), +key(a1,a2), +key(b) +) partition by hash(a1) partitions 2; +insert into t3 select seq/100, seq/100, seq, seq, seq, seq from seq_1_to_10000; +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 +set @tmp_os= @@optimizer_switch; +set optimizer_switch='materialization=off'; +# Must not show "Using rowid filter": +explain +select * +from t1 +where +t1.a not in (select straight_join t3.a1 +from t2, t3 +where t3.b < 3000 and t3.a2=t2.a); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1000 Using where +2 DEPENDENT SUBQUERY t3 ref_or_null a1,b a1 10 func,test.t2.a 198 Using where; Full scan on NULL key +set optimizer_switch=@tmp_os; +drop table t1,t2,t3; diff --git a/mysql-test/main/partition.test b/mysql-test/main/partition.test index 5f4c5f659cae1..d96031a6b2b3e 100644 --- a/mysql-test/main/partition.test +++ b/mysql-test/main/partition.test @@ -3021,7 +3021,44 @@ INSERT INTO t2 VALUES (1),(2); UPDATE t1 SET a = 7 WHERE a = ( SELECT b FROM t2 ) ORDER BY a LIMIT 6; DROP TABLE t1,t2; - --echo # --echo # End of 10.1 tests --echo # + +--echo # +--echo # MDEV-30596: Assertion 'pushed_rowid_filter != __null ...' failed +--echo # +--source include/have_sequence.inc +create table t1 (a int); +insert into t1 values (NULL),(1),(2); +create table t2 (a int); +insert into t2 select seq from seq_1_to_1000; + +create table t3 ( + a1 int, + a2 int, + b int, + c int, + filler1 char(200), + filler2 char(200), + key(a1,a2), + key(b) +) partition by hash(a1) partitions 2; +insert into t3 select seq/100, seq/100, seq, seq, seq, seq from seq_1_to_10000; +analyze table t3 persistent for all; + +set @tmp_os= @@optimizer_switch; +set optimizer_switch='materialization=off'; + +--echo # Must not show "Using rowid filter": +explain +select * +from t1 +where + t1.a not in (select straight_join t3.a1 + from t2, t3 + where t3.b < 3000 and t3.a2=t2.a); +set optimizer_switch=@tmp_os; + +drop table t1,t2,t3; + diff --git a/mysql-test/main/partition_alter.result b/mysql-test/main/partition_alter.result index d233486b427d1..5a2d1ada4a456 100644 --- a/mysql-test/main/partition_alter.result +++ b/mysql-test/main/partition_alter.result @@ -69,7 +69,7 @@ t1 CREATE TABLE `t1` ( `b` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`,`d`), CONSTRAINT `CONSTRAINT_1` CHECK (`b` in (0,10)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE COLUMNS(`d`) (PARTITION `p1` VALUES LESS THAN ('2016-10-18') ENGINE = InnoDB, PARTITION `p2` VALUES LESS THAN ('2020-10-19') ENGINE = InnoDB) @@ -94,7 +94,7 @@ t1 CREATE TABLE `t1` ( `b` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`,`d`), CONSTRAINT `CONSTRAINT_1` CHECK (`b` in (0,10)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE COLUMNS(`d`) (PARTITION `p1` VALUES LESS THAN ('2016-10-18') ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN ('2020-10-19') ENGINE = MyISAM) @@ -116,7 +116,7 @@ t1 CREATE TABLE `t1` ( `dt2` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id_2`,`id_3`), KEY `id_1` (`id_1`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DELAY_KEY_WRITE=1 PARTITION BY HASH (`id_2`) (PARTITION `p01` ENGINE = MyISAM, PARTITION `p02` ENGINE = MyISAM, @@ -200,7 +200,132 @@ pk 2 delete from t1; drop table t1; +# +# MDEV-28576 RENAME COLUMN with NOCOPY algorithm leads to corrupt partitioned table +# +create table t (a int, b int) partition by list (b) (partition p1 values in (1, 2)); +insert into t values (0, 1), (2, 2); +alter table t change b f int, change a b int, algorithm=nocopy; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +delete from t order by b limit 1; +drop table t; +# +# MDEV-30112 ASAN errors in Item_ident::print / generate_partition_syntax +# +create table t (a int) partition by hash(a); +alter table t change a b int, drop a; +ERROR 42S22: Unknown column 'a' in 't' +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY HASH (`a`) +drop table t; # End of 10.3 tests +# +# Start of 10.4 tests +# +# +# MDEV-28545 MyISAM reorganize partition corrupt older table format +# +SET GLOBAL mysql56_temporal_format=OFF; +CREATE TABLE t (ts timestamp, KEY (ts)) ENGINE=MyISAM +PARTITION BY RANGE (unix_timestamp(ts)) ( +PARTITION p1 VALUES LESS THAN (1645398000), +PARTITION pn VALUES LESS THAN MAXVALUE +); +SET GLOBAL mysql56_temporal_format=ON; +FLUSH TABLES; +ALTER TABLE t DROP PARTITION p1; +CHECK TABLE t; +Table Op Msg_type Msg_text +test.t check status OK +DROP TABLE t; +SET GLOBAL mysql56_temporal_format=DEFAULT; +# +# End of 10.4 tests +# +# +# MDEV-28576 RENAME COLUMN with NOCOPY algorithm leads to corrupt partitioned table +# +create table t (a int) +partition by list (a) +subpartition by hash(a) subpartitions 2 +(partition p0 values in (1)); +alter table t rename column a to b, algorithm=nocopy; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY LIST (`b`) +SUBPARTITION BY HASH (`b`) +SUBPARTITIONS 2 +(PARTITION `p0` VALUES IN (1) ENGINE = MyISAM) +alter table t rename column b to c, algorithm=copy; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY LIST (`c`) +SUBPARTITION BY HASH (`c`) +SUBPARTITIONS 2 +(PARTITION `p0` VALUES IN (1) ENGINE = MyISAM) +drop table t; +create table t (d int, e int) +partition by list columns (d, e) +subpartition by key (d, e) +(partition p0 values in ((2, 3))); +alter table t rename column d to f, rename column e to g, algorithm=nocopy; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `f` int(11) DEFAULT NULL, + `g` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY LIST COLUMNS(`f`,`g`) +SUBPARTITION BY KEY (`f`,`g`) +(PARTITION `p0` VALUES IN ((2,3)) ENGINE = MyISAM) +alter table t rename column f to h, rename column g to i, algorithm=copy; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `h` int(11) DEFAULT NULL, + `i` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY LIST COLUMNS(`h`,`i`) +SUBPARTITION BY KEY (`h`,`i`) +(PARTITION `p0` VALUES IN ((2,3)) ENGINE = MyISAM) +drop table t; +create table t (k int, l int) +partition by range (k) +subpartition by hash(l) subpartitions 4 +(partition p0 values less than (5)); +alter table t rename column k to l, rename column l to k; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `l` int(11) DEFAULT NULL, + `k` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY RANGE (`l`) +SUBPARTITION BY HASH (`k`) +SUBPARTITIONS 4 +(PARTITION `p0` VALUES LESS THAN (5) ENGINE = MyISAM) +drop table t; +create table t (a int, b int) partition by list (b) (partition p1 values in (1, 2)); +insert into t values (0, 1), (2, 2); +alter table t rename column b to f, rename column a to b, algorithm=nocopy; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +delete from t order by b limit 1; +drop table t; +# End of 10.5 tests create or replace table t1 (x int primary key) partition by range(x) ( p1 values less than (10), @@ -214,7 +339,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -234,7 +359,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`x`) (PARTITION `p1` VALUES IN (2,3,4) ENGINE = MyISAM, PARTITION `p2` VALUES IN (12,13,14) ENGINE = MyISAM, @@ -265,3 +390,4 @@ partition by list(x) ( partitio values in (2, 3, 4), pn values in (52, 53, 54)); drop table t1; +# End of 10.7 tests diff --git a/mysql-test/main/partition_alter.test b/mysql-test/main/partition_alter.test index 782089087ae41..a4f2d529109db 100644 --- a/mysql-test/main/partition_alter.test +++ b/mysql-test/main/partition_alter.test @@ -185,8 +185,96 @@ select * from t1 partition(p1); delete from t1; drop table t1; +--echo # +--echo # MDEV-28576 RENAME COLUMN with NOCOPY algorithm leads to corrupt partitioned table +--echo # +create table t (a int, b int) partition by list (b) (partition p1 values in (1, 2)); +insert into t values (0, 1), (2, 2); +alter table t change b f int, change a b int, algorithm=nocopy; +check table t; +delete from t order by b limit 1; +# cleanup +drop table t; + +--echo # +--echo # MDEV-30112 ASAN errors in Item_ident::print / generate_partition_syntax +--echo # +create table t (a int) partition by hash(a); +--error ER_BAD_FIELD_ERROR +alter table t change a b int, drop a; +show create table t; +# Cleanup +drop table t; + --echo # End of 10.3 tests +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-28545 MyISAM reorganize partition corrupt older table format +--echo # + +SET GLOBAL mysql56_temporal_format=OFF; +CREATE TABLE t (ts timestamp, KEY (ts)) ENGINE=MyISAM +PARTITION BY RANGE (unix_timestamp(ts)) ( + PARTITION p1 VALUES LESS THAN (1645398000), + PARTITION pn VALUES LESS THAN MAXVALUE +); + +SET GLOBAL mysql56_temporal_format=ON; +FLUSH TABLES; +ALTER TABLE t DROP PARTITION p1; +CHECK TABLE t; +DROP TABLE t; +SET GLOBAL mysql56_temporal_format=DEFAULT; + +--echo # +--echo # End of 10.4 tests +--echo # + +--echo # +--echo # MDEV-28576 RENAME COLUMN with NOCOPY algorithm leads to corrupt partitioned table +--echo # +create table t (a int) +partition by list (a) +subpartition by hash(a) subpartitions 2 +(partition p0 values in (1)); +alter table t rename column a to b, algorithm=nocopy; +show create table t; +alter table t rename column b to c, algorithm=copy; +show create table t; +drop table t; + +create table t (d int, e int) +partition by list columns (d, e) +subpartition by key (d, e) +(partition p0 values in ((2, 3))); +alter table t rename column d to f, rename column e to g, algorithm=nocopy; +show create table t; +alter table t rename column f to h, rename column g to i, algorithm=copy; +show create table t; +drop table t; + +create table t (k int, l int) +partition by range (k) +subpartition by hash(l) subpartitions 4 +(partition p0 values less than (5)); +alter table t rename column k to l, rename column l to k; +show create table t; +drop table t; + +create table t (a int, b int) partition by list (b) (partition p1 values in (1, 2)); +insert into t values (0, 1), (2, 2); +alter table t rename column b to f, rename column a to b, algorithm=nocopy; +check table t; +delete from t order by b limit 1; +# cleanup +drop table t; + +--echo # End of 10.5 tests + create or replace table t1 (x int primary key) partition by range(x) ( p1 values less than (10), @@ -233,3 +321,5 @@ partition by list(x) ( pn values in (52, 53, 54)); drop table t1; + +--echo # End of 10.7 tests diff --git a/mysql-test/main/partition_cache_innodb.result b/mysql-test/main/partition_cache_innodb.result index 0cd60fa11a0fa..b6231297bc54f 100644 --- a/mysql-test/main/partition_cache_innodb.result +++ b/mysql-test/main/partition_cache_innodb.result @@ -22,7 +22,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `created_at` datetime NOT NULL, `cool` tinyint(4) DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (to_days(`created_at`)) (PARTITION `month_2010_4` VALUES LESS THAN (734258) ENGINE = InnoDB, PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = InnoDB, @@ -71,7 +71,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `created_at` datetime NOT NULL, `cool` tinyint(4) DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (to_days(`created_at`)) SUBPARTITION BY HASH (`cool`) SUBPARTITIONS 3 diff --git a/mysql-test/main/partition_cache_myisam.result b/mysql-test/main/partition_cache_myisam.result index 441a7d080c352..89f27f6d4fc30 100644 --- a/mysql-test/main/partition_cache_myisam.result +++ b/mysql-test/main/partition_cache_myisam.result @@ -22,7 +22,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `created_at` datetime NOT NULL, `cool` tinyint(4) DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (to_days(`created_at`)) (PARTITION `month_2010_4` VALUES LESS THAN (734258) ENGINE = MyISAM, PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = MyISAM, @@ -71,7 +71,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `created_at` datetime NOT NULL, `cool` tinyint(4) DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (to_days(`created_at`)) SUBPARTITION BY HASH (`cool`) SUBPARTITIONS 3 diff --git a/mysql-test/main/partition_column.result b/mysql-test/main/partition_column.result index 041c485c1a8f6..c3a2ce872cea6 100644 --- a/mysql-test/main/partition_column.result +++ b/mysql-test/main/partition_column.result @@ -29,7 +29,7 @@ t1 CREATE TABLE `t1` ( `name` varchar(255) DEFAULT NULL, `department` varchar(10) DEFAULT NULL, `country` varchar(255) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`department`,`country`) (PARTITION `first_office` VALUES IN (('dep1','Russia'),('dep1','Croatia')) ENGINE = MyISAM, PARTITION `second_office` VALUES IN (('dep2','Russia')) ENGINE = MyISAM) @@ -172,7 +172,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`a`) (PARTITION `p0` VALUES IN ('''') ENGINE = MyISAM, PARTITION `p1` VALUES IN ('\\') ENGINE = MyISAM, @@ -231,7 +231,7 @@ t1 CREATE TABLE `t1` ( `b` char(10) DEFAULT NULL, `c` varchar(25) DEFAULT NULL, `d` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE COLUMNS(`a`,`b`,`c`,`d`) SUBPARTITION BY HASH (to_seconds(`d`)) SUBPARTITIONS 4 @@ -314,7 +314,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`a`,`b`) (PARTITION `p0` VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM, PARTITION `p1` VALUES IN ((1,1),(2,2)) ENGINE = MyISAM, @@ -348,7 +348,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`a`,`b`) (PARTITION `p0` VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM, PARTITION `p1` VALUES IN ((1,1),(2,2)) ENGINE = MyISAM, @@ -372,7 +372,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (2,1) ENGINE = MyISAM, PARTITION `p1` VALUES IN (NULL,4,3) ENGINE = MyISAM) @@ -402,7 +402,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`a`) (PARTITION `p0` VALUES IN (2,1) ENGINE = MyISAM, PARTITION `p1` VALUES IN (4,NULL,3) ENGINE = MyISAM) @@ -417,7 +417,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`a`) (PARTITION `p0` VALUES IN (2,1) ENGINE = MyISAM, PARTITION `p1` VALUES IN (4,NULL,3) ENGINE = MyISAM) @@ -452,7 +452,7 @@ t1 CREATE TABLE `t1` ( `b` char(10) DEFAULT NULL, `c` varchar(5) DEFAULT NULL, `d` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE COLUMNS(`a`,`b`,`c`) SUBPARTITION BY KEY (`c`,`d`) SUBPARTITIONS 3 @@ -485,7 +485,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(2) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE COLUMNS(`a`,`b`,`c`) (PARTITION `p0` VALUES LESS THAN (1,'A',1) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN (1,'B',1) ENGINE = MyISAM) diff --git a/mysql-test/main/partition_datatype.result b/mysql-test/main/partition_datatype.result index 2e518c194f003..fb2635ceda953 100644 --- a/mysql-test/main/partition_datatype.result +++ b/mysql-test/main/partition_datatype.result @@ -332,7 +332,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bit(27) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `p1` ENGINE = MyISAM, @@ -853,7 +853,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` timestamp NULL DEFAULT NULL, `tz` varchar(16) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (unix_timestamp(`a`)) (PARTITION `p0` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `p-2000` VALUES LESS THAN (946684800) ENGINE = MyISAM, @@ -1337,7 +1337,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` timestamp NULL DEFAULT NULL, `tz` varchar(16) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (unix_timestamp(`a`)) (PARTITION `p0` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `p-2000` VALUES LESS THAN (946684800) ENGINE = MyISAM, diff --git a/mysql-test/main/partition_debug_sync.result b/mysql-test/main/partition_debug_sync.result index 7006491fcaa13..635f7735e6c79 100644 --- a/mysql-test/main/partition_debug_sync.result +++ b/mysql-test/main/partition_debug_sync.result @@ -53,9 +53,14 @@ SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done'; ALTER TABLE t2 REMOVE PARTITIONING; connection default; SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions'; -SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table SIGNAL waiting_for_alter'; +SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table SIGNAL waiting_for_alter WAIT_FOR mtr_continue'; SET DEBUG_SYNC= 'rm_table_no_locks_before_binlog SIGNAL delete_done'; DROP TABLE IF EXISTS t2; +# Create a new connection thread to orchestrate the ALTER and DROP +# threads' DEBUG_SYNC points to avoid lost signals +connect con2,localhost,root,,; +SET DEBUG_SYNC= 'now SIGNAL mtr_continue'; +connection default; connection con1; ERROR 42S02: Table 'test.t2' doesn't exist SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/main/partition_debug_sync.test b/mysql-test/main/partition_debug_sync.test index 09ebba0b0e2fa..bc49153f80351 100644 --- a/mysql-test/main/partition_debug_sync.test +++ b/mysql-test/main/partition_debug_sync.test @@ -66,12 +66,27 @@ SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done'; --send ALTER TABLE t2 REMOVE PARTITIONING connection default; SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions'; -SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table SIGNAL waiting_for_alter'; + +SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table SIGNAL waiting_for_alter WAIT_FOR mtr_continue'; SET DEBUG_SYNC= 'rm_table_no_locks_before_binlog SIGNAL delete_done'; -DROP TABLE IF EXISTS t2; +--send DROP TABLE IF EXISTS t2 + +--echo # Create a new connection thread to orchestrate the ALTER and DROP +--echo # threads' DEBUG_SYNC points to avoid lost signals +connect(con2,localhost,root,,); +let $wait_condition= select count(*)=0 from information_schema.processlist where state like "debug sync point: alter_table_before_open_tables"; +source include/wait_condition.inc; +SET DEBUG_SYNC= 'now SIGNAL mtr_continue'; + +# Return execution for DROP TABLE +connection default; +--reap + +# Return execution for ALTER TABLE connection con1; --error ER_NO_SUCH_TABLE --reap + SET DEBUG_SYNC= 'RESET'; disconnect con1; --source include/wait_until_disconnected.inc diff --git a/mysql-test/main/partition_default.result b/mysql-test/main/partition_default.result index db3b714bbcca9..fa947531250ad 100644 --- a/mysql-test/main/partition_default.result +++ b/mysql-test/main/partition_default.result @@ -21,7 +21,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p2` VALUES IN (4,5,6) ENGINE = MyISAM, PARTITION `p1` VALUES IN (1) ENGINE = MyISAM, @@ -71,7 +71,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` DEFAULT ENGINE = MyISAM, PARTITION `p2` VALUES IN (4,5,6) ENGINE = MyISAM, @@ -99,7 +99,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` DEFAULT ENGINE = MyISAM, PARTITION `p2` VALUES IN (4,5,6) ENGINE = MyISAM, @@ -127,7 +127,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`a`,`b`) (PARTITION `p2` VALUES IN ((1,4),(2,5),(3,6)) ENGINE = MyISAM, PARTITION `p1` VALUES IN ((1,1),(0,0)) ENGINE = MyISAM, @@ -175,7 +175,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p2` VALUES IN (4,5,6) ENGINE = MyISAM, PARTITION `p1` VALUES IN (1,20) ENGINE = MyISAM, @@ -255,7 +255,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`a`,`b`) (PARTITION `p2` VALUES IN ((1,4),(2,5),(3,6),(5,5)) ENGINE = MyISAM, PARTITION `p1` VALUES IN ((1,1),(20,20)) ENGINE = MyISAM, @@ -324,7 +324,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a` + `b`) (PARTITION `p2` VALUES IN (1,2,3,7) ENGINE = MyISAM, PARTITION `p1` VALUES IN (21,0) ENGINE = MyISAM, @@ -361,7 +361,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a` + 5) (PARTITION `p2` VALUES IN (1,2,3,7) ENGINE = MyISAM, PARTITION `p1` VALUES IN (0) ENGINE = MyISAM, @@ -831,7 +831,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p2` VALUES IN (1,2,3) ENGINE = MyISAM, PARTITION `p1` VALUES IN (20,0) ENGINE = MyISAM, @@ -865,7 +865,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p2` VALUES IN (1,2,3) ENGINE = MyISAM, PARTITION `p1` VALUES IN (20,0) ENGINE = MyISAM, @@ -899,7 +899,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p2` DEFAULT ENGINE = MyISAM, PARTITION `p1` VALUES IN (20,0) ENGINE = MyISAM, @@ -926,7 +926,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p1` VALUES IN (20,0) ENGINE = MyISAM, PARTITION `p0` VALUES IN (10) ENGINE = MyISAM) @@ -944,7 +944,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p1` VALUES IN (20,0) ENGINE = MyISAM, PARTITION `p0` VALUES IN (10) ENGINE = MyISAM, @@ -976,7 +976,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`a`,`b`) (PARTITION `p2` VALUES IN ((1,4),(2,5),(3,6)) ENGINE = MyISAM, PARTITION `p1` VALUES IN ((1,1),(0,0)) ENGINE = MyISAM, @@ -1010,7 +1010,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`a`,`b`) (PARTITION `p2` VALUES IN ((1,4),(2,5),(3,6)) ENGINE = MyISAM, PARTITION `p1` VALUES IN ((1,1),(0,0)) ENGINE = MyISAM, @@ -1044,7 +1044,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`a`,`b`) (PARTITION `p2` DEFAULT ENGINE = MyISAM, PARTITION `p1` VALUES IN ((1,1),(0,0)) ENGINE = MyISAM, @@ -1071,7 +1071,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`a`,`b`) (PARTITION `p1` VALUES IN ((1,1),(0,0)) ENGINE = MyISAM, PARTITION `p0` VALUES IN ((10,10)) ENGINE = MyISAM) @@ -1089,7 +1089,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`a`,`b`) (PARTITION `p1` VALUES IN ((1,1),(0,0)) ENGINE = MyISAM, PARTITION `p0` VALUES IN ((10,10)) ENGINE = MyISAM, @@ -1137,7 +1137,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`a`,`b`) (PARTITION `p0` DEFAULT ENGINE = MyISAM, PARTITION `p2` VALUES IN ((1,4),(2,5),(3,6)) ENGINE = MyISAM, @@ -1244,7 +1244,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`i`) (PARTITION `pdef` DEFAULT ENGINE = MyISAM) DROP TABLE t1; @@ -1261,7 +1261,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`i`) (PARTITION `p` VALUES IN (1,2,3,4) ENGINE = MyISAM) DROP TABLE t1; diff --git a/mysql-test/main/partition_error.result b/mysql-test/main/partition_error.result index bff08c0d447cb..0b07fe3013008 100644 --- a/mysql-test/main/partition_error.result +++ b/mysql-test/main/partition_error.result @@ -6,7 +6,18 @@ drop table if exists t1, t2; CREATE TABLE t1 (a int); CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1; ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1; -ERROR 42000: Can't open table +ERROR HY000: 'test.v1' is not of type 'BASE TABLE' +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-28599 EXCHANGE PARTITION on view causes ER_CHECK_NO_SUCH_TABLE instead of ER_WRONG_OBJECT +# +CREATE TABLE t1 (a int) +PARTITION BY HASH (a) +PARTITIONS 2; +CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1; +ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1; +ERROR HY000: 'test.v1' is not of type 'BASE TABLE' DROP VIEW v1; DROP TABLE t1; # @@ -780,7 +791,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, `purchased` date DEFAULT NULL -) ENGINE= DEFAULT CHARSET=latin1 +) ENGINE= DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (year(`purchased`)) SUBPARTITION BY HASH (to_days(`purchased`)) (PARTITION `p0` VALUES LESS THAN MAXVALUE ENGINE = ) @@ -801,7 +812,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, `purchased` date DEFAULT NULL -) ENGINE= DEFAULT CHARSET=latin1 +) ENGINE= DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (year(`purchased`)) SUBPARTITION BY HASH (to_days(`purchased`)) (PARTITION `p0` VALUES LESS THAN MAXVALUE @@ -821,7 +832,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, `purchased` date DEFAULT NULL -) ENGINE= DEFAULT CHARSET=latin1 +) ENGINE= DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (year(`purchased`)) (PARTITION `p0` VALUES LESS THAN MAXVALUE ENGINE = ) DROP TABLE t1; @@ -896,7 +907,7 @@ partitions 3 (partition tablespace ts1, partition x2 tablespace ts2, partition x3 tablespace ts3); -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 'ts1, +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 x2 tablespace ts2, partition x3 tablespace ts3)' at line 8 CREATE TABLE t1 ( @@ -1782,7 +1793,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) SUBPARTITION BY HASH (`a`) (PARTITION `p1` VALUES IN (1) @@ -1812,7 +1823,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) SUBPARTITION BY HASH (`a`) (PARTITION `p1` VALUES IN (1) @@ -1849,7 +1860,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, KEY `inx_a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY HASH (`a`) (PARTITION `pUpTo10` VALUES LESS THAN (10) diff --git a/mysql-test/main/partition_error.test b/mysql-test/main/partition_error.test index 25b15578248d0..b8d07e595e568 100644 --- a/mysql-test/main/partition_error.test +++ b/mysql-test/main/partition_error.test @@ -16,7 +16,19 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`; --echo # CREATE TABLE t1 (a int); CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1; ---error ER_CHECK_NO_SUCH_TABLE +--error ER_WRONG_OBJECT +ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1; +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-28599 EXCHANGE PARTITION on view causes ER_CHECK_NO_SUCH_TABLE instead of ER_WRONG_OBJECT +--echo # +CREATE TABLE t1 (a int) +PARTITION BY HASH (a) +PARTITIONS 2; +CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1; +--error ER_WRONG_OBJECT ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1; DROP VIEW v1; DROP TABLE t1; diff --git a/mysql-test/main/partition_example.result b/mysql-test/main/partition_example.result index 3aa1ed639ca64..df5c9c7522e5c 100644 --- a/mysql-test/main/partition_example.result +++ b/mysql-test/main/partition_example.result @@ -7,7 +7,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (1) ENGINE = EXAMPLE, PARTITION `p1` VALUES IN (2) ENGINE = EXAMPLE) @@ -20,7 +20,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340 +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `ull`=12340 PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (1) ENGINE = EXAMPLE, PARTITION `p1` VALUES IN (2) ENGINE = EXAMPLE) diff --git a/mysql-test/main/partition_exchange.result b/mysql-test/main/partition_exchange.result index 02c9eeb50e94f..b7c9be3480eda 100644 --- a/mysql-test/main/partition_exchange.result +++ b/mysql-test/main/partition_exchange.result @@ -1,4 +1,3 @@ -DROP TABLE IF EXISTS t1, t2, t3, t, tp, tsp, tmp; # # Bug#11894100: EXCHANGE PARTITION CAN'T BE EXECUTED IF # ROW_FORMAT WAS SET EXPLICITLY @@ -6,38 +5,32 @@ DROP TABLE IF EXISTS t1, t2, t3, t, tp, tsp, tmp; # Same definition (both have ROW_FORMAT set) CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, -year year(2) DEFAULT NULL, +year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB ROW_FORMAT=COMPACT PARTITION BY HASH (id) PARTITIONS 2; -Warnings: -Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead CREATE TABLE t2 LIKE t1; -Warnings: -Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead ALTER TABLE t2 REMOVE PARTITIONING; -Warnings: -Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead SHOW CREATE TABLE t1; Table t1 Create Table CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `year` year(2) DEFAULT NULL, + `year` year(4) DEFAULT NULL, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT PARTITION BY HASH (`id`) PARTITIONS 2 SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `year` year(2) DEFAULT NULL, + `year` year(4) DEFAULT NULL, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2') @@ -53,28 +46,24 @@ ENGINE InnoDB ROW_FORMAT Compact CREATE_OPTIONS row_format=COMPACT ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; -Warnings: -Level Note -Code 1287 -Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead SHOW CREATE TABLE t1; Table t1 Create Table CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `year` year(2) DEFAULT NULL, + `year` year(4) DEFAULT NULL, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT PARTITION BY HASH (`id`) PARTITIONS 2 SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `year` year(2) DEFAULT NULL, + `year` year(4) DEFAULT NULL, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2') @@ -93,37 +82,29 @@ DROP TABLE t2; # Only the partitioned table have ROW_FORMAT set. CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, -year year(2) DEFAULT NULL, +year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB; -Warnings: -Level Note -Code 1287 -Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; -Warnings: -Level Note -Code 1287 -Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead SHOW CREATE TABLE t1; Table t1 Create Table CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `year` year(2) DEFAULT NULL, + `year` year(4) DEFAULT NULL, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT PARTITION BY HASH (`id`) PARTITIONS 2 SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `year` year(2) DEFAULT NULL, + `year` year(4) DEFAULT NULL, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2') @@ -142,49 +123,37 @@ CREATE_OPTIONS DROP TABLE t1, t2; CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, -year year(2) DEFAULT NULL, +year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB PARTITION BY HASH (id) PARTITIONS 2; -Warnings: -Level Note -Code 1287 -Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, -year year(2) DEFAULT NULL, +year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB ROW_FORMAT = COMPACT; -Warnings: -Level Note -Code 1287 -Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; -Warnings: -Level Note -Code 1287 -Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead SHOW CREATE TABLE t1; Table t1 Create Table CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `year` year(2) DEFAULT NULL, + `year` year(4) DEFAULT NULL, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`id`) PARTITIONS 2 SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `year` year(2) DEFAULT NULL, + `year` year(4) DEFAULT NULL, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2') @@ -203,49 +172,37 @@ CREATE_OPTIONS row_format=COMPACT DROP TABLE t1, t2; CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, -year year(2) DEFAULT NULL, +year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB PARTITION BY HASH (id) PARTITIONS 2; -Warnings: -Level Note -Code 1287 -Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, -year year(2) DEFAULT NULL, +year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB; -Warnings: -Level Note -Code 1287 -Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; -Warnings: -Level Note -Code 1287 -Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead SHOW CREATE TABLE t1; Table t1 Create Table CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `year` year(2) DEFAULT NULL, + `year` year(4) DEFAULT NULL, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`id`) PARTITIONS 2 SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `year` year(2) DEFAULT NULL, + `year` year(4) DEFAULT NULL, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2') @@ -264,49 +221,37 @@ CREATE_OPTIONS DROP TABLE t1, t2; CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, -year year(2) DEFAULT NULL, +year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB ROW_FORMAT = REDUNDANT PARTITION BY HASH (id) PARTITIONS 2; -Warnings: -Level Note -Code 1287 -Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, -year year(2) DEFAULT NULL, +year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB ROW_FORMAT = REDUNDANT; -Warnings: -Level Note -Code 1287 -Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; -Warnings: -Level Note -Code 1287 -Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead SHOW CREATE TABLE t1; Table t1 Create Table CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `year` year(2) DEFAULT NULL, + `year` year(4) DEFAULT NULL, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT PARTITION BY HASH (`id`) PARTITIONS 2 SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `year` year(2) DEFAULT NULL, + `year` year(4) DEFAULT NULL, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2') @@ -325,46 +270,38 @@ CREATE_OPTIONS row_format=REDUNDANT DROP TABLE t1, t2; CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, -year year(2) DEFAULT NULL, +year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB PARTITION BY HASH (id) PARTITIONS 2; -Warnings: -Level Note -Code 1287 -Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, -year year(2) DEFAULT NULL, +year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB ROW_FORMAT = REDUNDANT; -Warnings: -Level Note -Code 1287 -Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; ERROR HY000: Non matching attribute 'ROW_FORMAT' between partition and table SHOW CREATE TABLE t1; Table t1 Create Table CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `year` year(2) DEFAULT NULL, + `year` year(4) DEFAULT NULL, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`id`) PARTITIONS 2 SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `year` year(2) DEFAULT NULL, + `year` year(4) DEFAULT NULL, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2') @@ -383,46 +320,38 @@ CREATE_OPTIONS row_format=REDUNDANT DROP TABLE t1, t2; CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, -year year(2) DEFAULT NULL, +year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB ROW_FORMAT = COMPACT PARTITION BY HASH (id) PARTITIONS 2; -Warnings: -Level Note -Code 1287 -Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, -year year(2) DEFAULT NULL, +year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB ROW_FORMAT = REDUNDANT; -Warnings: -Level Note -Code 1287 -Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; ERROR HY000: Non matching attribute 'ROW_FORMAT' between partition and table SHOW CREATE TABLE t1; Table t1 Create Table CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `year` year(2) DEFAULT NULL, + `year` year(4) DEFAULT NULL, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT PARTITION BY HASH (`id`) PARTITIONS 2 SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `year` year(2) DEFAULT NULL, + `year` year(4) DEFAULT NULL, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2') @@ -496,14 +425,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -534,14 +463,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -594,14 +523,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -650,14 +579,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -667,7 +596,7 @@ tsp CREATE TABLE `tsp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY HASH (`a`) (PARTITION `p0` VALUES LESS THAN (100) @@ -704,14 +633,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -742,14 +671,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -781,14 +710,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tsp; Table Create Table tsp CREATE TABLE `tsp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY HASH (`a`) (PARTITION `p0` VALUES LESS THAN (100) @@ -826,14 +755,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -864,14 +793,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -905,14 +834,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -924,14 +853,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -957,14 +886,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=1000 MAX_ROWS=100000 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MIN_ROWS=1000 MAX_ROWS=100000 SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -987,7 +916,7 @@ t CREATE TABLE `t` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), KEY `ba_key` (`b`,`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( @@ -995,7 +924,7 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), KEY `ba_key` (`b`,`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1046,7 +975,7 @@ t CREATE TEMPORARY TABLE `t` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), KEY `ba_key` (`b`,`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( @@ -1054,7 +983,7 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), KEY `ba_key` (`b`,`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1067,7 +996,7 @@ t CREATE TEMPORARY TABLE `t` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), KEY `ba_key` (`b`,`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( @@ -1075,7 +1004,7 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), KEY `ba_key` (`b`,`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1307,3 +1236,27 @@ CREATE TABLE t2 like t1; ALTER TABLE t2 REMOVE PARTITIONING; ALTER TABLE t1 EXCHANGE PARTITION pm WITH TABLE t2; DROP TABLE t1, t2; +# +# MDEV-14642 Assertion `table->s->db_create_options == part_table->s->db_create_options' failed in compare_table_with_partition +# +CREATE TABLE t1 (a INT) ROW_FORMAT=DYNAMIC PARTITION BY KEY(a) PARTITIONS 2; +CREATE TABLE t2 (a INT) ; +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; +ERROR HY000: Tables have different definitions +DROP TABLE t1, t2; +CREATE TABLE t1 (a INT, PRIMARY KEY(a)) ENGINE=InnoDB PARTITION BY KEY(a) PARTITIONS 2; +CREATE TABLE t2 (a INT, PRIMARY KEY(a)) CHECKSUM=1, ENGINE=InnoDB; +ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; +ERROR HY000: Tables have different definitions +DROP TABLE t1, t2; +# +# MDEV-27683 EXCHANGE PARTITION allows different index direction, but causes further errors +# +CREATE TABLE t1 (a INT, KEY(a DESC)) PARTITION BY KEY(a) PARTITIONS 4; +CREATE TABLE t2 (a INT, KEY(a)); +ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; +ERROR HY000: Tables have different definitions +DROP TABLE t1, t2; +# +# End of 10.8 tests +# diff --git a/mysql-test/main/partition_exchange.test b/mysql-test/main/partition_exchange.test index d865a1e541aa2..82ccc29e00ef9 100644 --- a/mysql-test/main/partition_exchange.test +++ b/mysql-test/main/partition_exchange.test @@ -1,11 +1,6 @@ --source include/have_innodb.inc --source include/have_partition.inc ---disable_warnings -DROP TABLE IF EXISTS t1, t2, t3, t, tp, tsp, tmp; ---enable_warnings - ---enable_prepare_warnings --echo # --echo # Bug#11894100: EXCHANGE PARTITION CAN'T BE EXECUTED IF --echo # ROW_FORMAT WAS SET EXPLICITLY @@ -14,7 +9,7 @@ DROP TABLE IF EXISTS t1, t2, t3, t, tp, tsp, tmp; --echo # Same definition (both have ROW_FORMAT set) CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, - year year(2) DEFAULT NULL, + year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB ROW_FORMAT=COMPACT @@ -46,7 +41,7 @@ DROP TABLE t2; --echo # Only the partitioned table have ROW_FORMAT set. CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, - year year(2) DEFAULT NULL, + year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB; @@ -63,7 +58,7 @@ ORDER BY TABLE_NAME; DROP TABLE t1, t2; CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, - year year(2) DEFAULT NULL, + year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB @@ -71,7 +66,7 @@ PARTITION BY HASH (id) PARTITIONS 2; CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, - year year(2) DEFAULT NULL, + year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB ROW_FORMAT = COMPACT; @@ -88,7 +83,7 @@ ORDER BY TABLE_NAME; DROP TABLE t1, t2; CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, - year year(2) DEFAULT NULL, + year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB @@ -96,7 +91,7 @@ PARTITION BY HASH (id) PARTITIONS 2; CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, - year year(2) DEFAULT NULL, + year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB; @@ -113,7 +108,7 @@ ORDER BY TABLE_NAME; DROP TABLE t1, t2; CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, - year year(2) DEFAULT NULL, + year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB ROW_FORMAT = REDUNDANT @@ -121,7 +116,7 @@ PARTITION BY HASH (id) PARTITIONS 2; CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, - year year(2) DEFAULT NULL, + year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB ROW_FORMAT = REDUNDANT; @@ -138,7 +133,7 @@ ORDER BY TABLE_NAME; DROP TABLE t1, t2; CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, - year year(2) DEFAULT NULL, + year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB @@ -146,7 +141,7 @@ PARTITION BY HASH (id) PARTITIONS 2; CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, - year year(2) DEFAULT NULL, + year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB ROW_FORMAT = REDUNDANT; @@ -164,7 +159,7 @@ ORDER BY TABLE_NAME; DROP TABLE t1, t2; CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, - year year(2) DEFAULT NULL, + year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB ROW_FORMAT = COMPACT @@ -172,7 +167,7 @@ PARTITION BY HASH (id) PARTITIONS 2; CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, - year year(2) DEFAULT NULL, + year year DEFAULT NULL, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id) ) ENGINE=InnoDB ROW_FORMAT = REDUNDANT; @@ -537,4 +532,34 @@ ALTER TABLE t2 REMOVE PARTITIONING; ALTER TABLE t1 EXCHANGE PARTITION pm WITH TABLE t2; DROP TABLE t1, t2; ---disable_prepare_warnings +--echo # +--echo # MDEV-14642 Assertion `table->s->db_create_options == part_table->s->db_create_options' failed in compare_table_with_partition +--echo # +CREATE TABLE t1 (a INT) ROW_FORMAT=DYNAMIC PARTITION BY KEY(a) PARTITIONS 2; +CREATE TABLE t2 (a INT) ; +--error ER_TABLES_DIFFERENT_METADATA +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; + +# Cleanup +DROP TABLE t1, t2; + +CREATE TABLE t1 (a INT, PRIMARY KEY(a)) ENGINE=InnoDB PARTITION BY KEY(a) PARTITIONS 2; +CREATE TABLE t2 (a INT, PRIMARY KEY(a)) CHECKSUM=1, ENGINE=InnoDB; +--error ER_TABLES_DIFFERENT_METADATA +ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; + +# Cleanup +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-27683 EXCHANGE PARTITION allows different index direction, but causes further errors +--echo # +CREATE TABLE t1 (a INT, KEY(a DESC)) PARTITION BY KEY(a) PARTITIONS 4; +CREATE TABLE t2 (a INT, KEY(a)); +--error ER_TABLES_DIFFERENT_METADATA +ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; +DROP TABLE t1, t2; + +--echo # +--echo # End of 10.8 tests +--echo # diff --git a/mysql-test/main/partition_explicit_prune.result b/mysql-test/main/partition_explicit_prune.result index 5b3049c146f50..07af2d58a42e2 100644 --- a/mysql-test/main/partition_explicit_prune.result +++ b/mysql-test/main/partition_explicit_prune.result @@ -201,7 +201,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(64) DEFAULT NULL, PRIMARY KEY (`a`), KEY `b` (`b`,`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY HASH (`a`) (PARTITION `pNeg` VALUES LESS THAN (0) @@ -1133,7 +1133,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(64) DEFAULT NULL, PRIMARY KEY (`a`), KEY `b` (`b`,`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY HASH (`a`) (PARTITION `pNeg` VALUES LESS THAN (0) @@ -1165,7 +1165,7 @@ t2 CREATE TABLE `t2` ( `b` varchar(64) DEFAULT NULL, PRIMARY KEY (`a`), KEY `b` (`b`,`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY HASH (`a`) (PARTITION `pNeg` VALUES LESS THAN (0) @@ -1192,7 +1192,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` int(11) NOT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t3; a b -4 (pNeg-)subp0, Updated, Updated2, Updated from a = -2 @@ -1665,7 +1665,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(64) DEFAULT NULL, PRIMARY KEY (`a`), KEY `b` (`b`,`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY HASH (`a`) (PARTITION `pNeg` VALUES LESS THAN (0) @@ -1897,7 +1897,7 @@ ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; SELECT * FROM t1 PARTITION (p0); i UNLOCK TABLES; -DROP TABLE t1; +DROP TABLE t1, t2; # # MDEV-18371 Server crashes in ha_innobase::cmp_ref upon UPDATE with PARTITION clause. # @@ -1915,7 +1915,88 @@ a b 4 3 8 2 2 6 -DROP TABLE t1, t2; +DROP TABLE t1; +# +# MDEV-21134 Crash with partitioned table, PARTITION syntax, and index_merge. +# +create table t1 ( +pk int primary key, +a int, +b int, +filler char(32), +key (a), +key (b) +) engine=myisam partition by range(pk) ( +partition p0 values less than (10), +partition p1 values less than MAXVALUE +) ; +insert into t1 select +seq, +MOD(seq, 100), +MOD(seq, 100), +'filler-data-filler-data' + from +seq_1_to_5000; +explain select * from t1 partition (p1) where a=10 and b=10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where +flush tables; +select * from t1 partition (p1)where a=10 and b=10; +pk a b filler +10 10 10 filler-data-filler-data +110 10 10 filler-data-filler-data +210 10 10 filler-data-filler-data +310 10 10 filler-data-filler-data +410 10 10 filler-data-filler-data +510 10 10 filler-data-filler-data +610 10 10 filler-data-filler-data +710 10 10 filler-data-filler-data +810 10 10 filler-data-filler-data +910 10 10 filler-data-filler-data +1010 10 10 filler-data-filler-data +1110 10 10 filler-data-filler-data +1210 10 10 filler-data-filler-data +1310 10 10 filler-data-filler-data +1410 10 10 filler-data-filler-data +1510 10 10 filler-data-filler-data +1610 10 10 filler-data-filler-data +1710 10 10 filler-data-filler-data +1810 10 10 filler-data-filler-data +1910 10 10 filler-data-filler-data +2010 10 10 filler-data-filler-data +2110 10 10 filler-data-filler-data +2210 10 10 filler-data-filler-data +2310 10 10 filler-data-filler-data +2410 10 10 filler-data-filler-data +2510 10 10 filler-data-filler-data +2610 10 10 filler-data-filler-data +2710 10 10 filler-data-filler-data +2810 10 10 filler-data-filler-data +2910 10 10 filler-data-filler-data +3010 10 10 filler-data-filler-data +3110 10 10 filler-data-filler-data +3210 10 10 filler-data-filler-data +3310 10 10 filler-data-filler-data +3410 10 10 filler-data-filler-data +3510 10 10 filler-data-filler-data +3610 10 10 filler-data-filler-data +3710 10 10 filler-data-filler-data +3810 10 10 filler-data-filler-data +3910 10 10 filler-data-filler-data +4010 10 10 filler-data-filler-data +4110 10 10 filler-data-filler-data +4210 10 10 filler-data-filler-data +4310 10 10 filler-data-filler-data +4410 10 10 filler-data-filler-data +4510 10 10 filler-data-filler-data +4610 10 10 filler-data-filler-data +4710 10 10 filler-data-filler-data +4810 10 10 filler-data-filler-data +4910 10 10 filler-data-filler-data +DROP TABLE t1; +# +# End of 10.3 tests +# # # MDEV-18982: INSERT using explicit patition pruning with column list # @@ -1925,3 +2006,6 @@ select * from t1; a 1 drop table t1; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/partition_explicit_prune.test b/mysql-test/main/partition_explicit_prune.test index 4dc3275394f17..2e9a15d4c5e3d 100644 --- a/mysql-test/main/partition_explicit_prune.test +++ b/mysql-test/main/partition_explicit_prune.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_partition.inc +--source include/have_sequence.inc # Helper statement let $get_handler_status_counts= SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS @@ -8,6 +9,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; --echo # --echo # Bug#13559657: PARTITION SELECTION DOES NOT WORK WITH VIEWS --echo # +--disable_view_protocol CREATE TABLE t1 (a int) ENGINE = InnoDB PARTITION BY HASH (a) PARTITIONS 2; @@ -83,7 +85,7 @@ SELECT * FROM v1; SELECT * FROM t1; DROP VIEW v1; DROP TABLE t1; - +--enable_service_connection --echo # Original tests for WL#5217 --echo # Must have InnoDB as engine to get the same statistics results. @@ -99,7 +101,7 @@ eval $get_handler_status_counts; eval $get_handler_status_counts; --echo # OK, seems to add number of variables processed before HANDLER_WRITE --echo # and number of variables + 1 evaluated in the previous call in RND_NEXT - +--disable_service_connection CREATE TABLE t1 (a INT NOT NULL, b varchar (64), @@ -622,7 +624,7 @@ eval $get_handler_status_counts; SELECT * FROM t3 PARTITION (pNeg); DROP TABLE t1, t2, t3; -# +--enable_view_protocol --echo # Test from superseeded WL# 2682 # Partition select tests. # @@ -846,11 +848,12 @@ DROP TABLE t1; --echo # --echo # Test explicit partition selection on a non partitioned temp table --echo # +--disable_view_protocol CREATE TEMPORARY TABLE t1 (a INT); --error ER_PARTITION_CLAUSE_ON_NONPARTITIONED SELECT * FROM t1 PARTITION(pNonexisting); DROP TEMPORARY TABLE t1; - +--enable_view_protocol --echo # --echo # Test CREATE LIKE does not take PARTITION clause --echo # @@ -865,6 +868,7 @@ 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 # +--disable_service_connection 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; @@ -876,8 +880,8 @@ SELECT * FROM t1 PARTITION (p0); ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; SELECT * FROM t1 PARTITION (p0); UNLOCK TABLES; -DROP TABLE t1; - +DROP TABLE t1, t2; +--enable_service_connection --echo # --echo # MDEV-18371 Server crashes in ha_innobase::cmp_ref upon UPDATE with PARTITION clause. --echo # @@ -887,10 +891,41 @@ INSERT INTO t1 VALUES (3,0),(8,2),(7,8),(3,4),(2,4),(0,7),(4,3),(3,6); FLUSH TABLES; UPDATE t1 PARTITION (p3,p1) SET a = 2 WHERE a = 3; SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-21134 Crash with partitioned table, PARTITION syntax, and index_merge. +--echo # +create table t1 ( + pk int primary key, + a int, + b int, + filler char(32), + key (a), + key (b) + ) engine=myisam partition by range(pk) ( + partition p0 values less than (10), + partition p1 values less than MAXVALUE + ) ; + +insert into t1 select +seq, + MOD(seq, 100), + MOD(seq, 100), + 'filler-data-filler-data' + from + seq_1_to_5000; + +explain select * from t1 partition (p1) where a=10 and b=10; +flush tables; +select * from t1 partition (p1)where a=10 and b=10; -# Cleanup -DROP TABLE t1, t2; +DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # --echo # --echo # MDEV-18982: INSERT using explicit patition pruning with column list @@ -900,3 +935,8 @@ create table t1 (a int) partition by hash(a); insert into t1 partition (p0) (a) values (1); select * from t1; drop table t1; + +--echo # +--echo # End of 10.4 tests +--echo # + diff --git a/mysql-test/main/partition_grant.result b/mysql-test/main/partition_grant.result index 41934896aeb58..c269896975db8 100644 --- a/mysql-test/main/partition_grant.result +++ b/mysql-test/main/partition_grant.result @@ -14,7 +14,7 @@ GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` GRANT SELECT, ALTER ON `mysqltest_1`.* TO `mysqltest_1`@`localhost` alter table t1 add b int; alter table t1 drop partition p2; -ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table `mysqltest_1`.`t1` disconnect conn1; connection default; grant drop on mysqltest_1.* to mysqltest_1@localhost; @@ -25,7 +25,7 @@ connection default; revoke alter on mysqltest_1.* from mysqltest_1@localhost; connect conn3,localhost,mysqltest_1,,mysqltest_1; alter table t1 drop partition p3; -ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table `mysqltest_1`.`t1` disconnect conn3; connection default; revoke select,alter,drop on mysqltest_1.* from mysqltest_1@localhost; diff --git a/mysql-test/main/partition_innodb.result b/mysql-test/main/partition_innodb.result index f5b2e4b3fcd66..95ca989eabfdc 100644 --- a/mysql-test/main/partition_innodb.result +++ b/mysql-test/main/partition_innodb.result @@ -450,7 +450,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) drop table t1; create table t1 (a int) @@ -464,7 +464,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0) ENGINE = InnoDB) drop table t1; @@ -543,7 +543,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `int_column` int(11) DEFAULT NULL, `char_column` char(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`int_column`) SUBPARTITION BY KEY (`char_column`) SUBPARTITIONS 2 @@ -590,7 +590,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL, `b` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 2 SELECT * FROM t1; @@ -618,7 +618,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL, `b` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 2 SELECT * FROM t1; @@ -946,7 +946,7 @@ 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' +Warning 1292 Truncated incorrect DECIMAL value: 'foo' DROP view v; DROP TABLE t1, t2; SET @save_isp=@@innodb_stats_persistent; diff --git a/mysql-test/main/partition_innodb.test b/mysql-test/main/partition_innodb.test index 26c7c0783f338..563a750b81b95 100644 --- a/mysql-test/main/partition_innodb.test +++ b/mysql-test/main/partition_innodb.test @@ -3,6 +3,7 @@ --source include/have_innodb.inc --source include/default_optimizer_switch.inc +--disable_service_connection call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); set global default_storage_engine='innodb'; @@ -94,7 +95,7 @@ DROP TABLE t1; --echo # Bug#54747: Deadlock between REORGANIZE PARTITION and --echo # SELECT is not detected --echo # - +--disable_view_protocol CREATE TABLE t1 (user_num BIGINT, hours SMALLINT, @@ -140,11 +141,12 @@ COMMIT; --connection default DROP TABLE t1; - +--enable_view_protocol --echo # --echo # Bug#50418: DROP PARTITION does not interact with transactions --echo # +--disable_view_protocol CREATE TABLE t1 ( id INT AUTO_INCREMENT NOT NULL, name CHAR(50) NOT NULL, @@ -183,7 +185,7 @@ SELECT * FROM t1; --echo # No changes. COMMIT; DROP TABLE t1; - +--enable_view_protocol --echo # --echo # Bug#51830: Incorrect partition pruning on range partition (regression) @@ -582,6 +584,7 @@ DROP TABLE t1; --echo # Bug#47343: InnoDB fails to clean-up after lock wait timeout on --echo # REORGANIZE PARTITION --echo # +--disable_view_protocol CREATE TABLE t1 ( a INT, b DATE NOT NULL, @@ -616,6 +619,7 @@ connection default; SELECT * FROM t1; COMMIT; DROP TABLE t1; +--enable_view_protocol # # Bug #55146 Assertion `m_part_spec.start_part == m_part_spec.end_part' in index_read_idx_map @@ -968,6 +972,7 @@ set global default_storage_engine=default; --echo # Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT --echo # Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE --echo # +--disable_view_protocol CREATE TABLE t1 (a INT, b INT, @@ -1001,7 +1006,7 @@ SELECT b FROM t1 WHERE b = 0; SELECT b FROM t1 WHERE b = 0; --disconnect con1 DROP TABLE t1; - +--enable_view_protocol --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 @@ -1144,3 +1149,4 @@ DROP TABLE t1; --echo # --echo # End of 10.3 tests --echo # +--enable_service_connection diff --git a/mysql-test/main/partition_innodb_plugin.result b/mysql-test/main/partition_innodb_plugin.result index 2cc2323703b20..8211f0aac8981 100644 --- a/mysql-test/main/partition_innodb_plugin.result +++ b/mysql-test/main/partition_innodb_plugin.result @@ -29,7 +29,7 @@ t1 CREATE TABLE `t1` ( `time` date NOT NULL, `id2` bigint(20) NOT NULL, PRIMARY KEY (`id`,`time`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PARTITION BY RANGE (to_days(`time`)) (PARTITION `p10` VALUES LESS THAN (734708) ENGINE = InnoDB, PARTITION `p20` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -58,7 +58,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `user_num` char(10) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=4 PARTITION BY HASH (`id`) PARTITIONS 1 SET GLOBAL innodb_file_per_table = OFF; @@ -96,7 +96,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `user_num` char(10) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=4 PARTITION BY HASH (`id`) PARTITIONS 3 DROP TABLE t1; diff --git a/mysql-test/main/partition_innodb_plugin.test b/mysql-test/main/partition_innodb_plugin.test index bd96042c3f404..c24945152b3aa 100644 --- a/mysql-test/main/partition_innodb_plugin.test +++ b/mysql-test/main/partition_innodb_plugin.test @@ -100,6 +100,8 @@ SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed; # # Bug#32430 - show engine innodb status causes errors # +#change to "disable_service_connection" after fix MDEV-29278 +--disable_view_protocol SET @save_detect= @@GLOBAL.innodb_deadlock_detect; SET @save_report= @@GLOBAL.innodb_deadlock_report; SET GLOBAL innodb_deadlock_detect=ON; @@ -163,3 +165,4 @@ ROLLBACK; disconnect con1; connection default; DROP TABLE `t``\""e`; +--enable_view_protocol diff --git a/mysql-test/main/partition_innodb_semi_consistent.test b/mysql-test/main/partition_innodb_semi_consistent.test index 7a1dfc361730e..c1a516b255f1a 100644 --- a/mysql-test/main/partition_innodb_semi_consistent.test +++ b/mysql-test/main/partition_innodb_semi_consistent.test @@ -1,3 +1,5 @@ +-- source include/no_view_protocol.inc + -- source include/have_partition.inc -- source include/not_embedded.inc -- source include/have_innodb.inc diff --git a/mysql-test/main/partition_mgm.result b/mysql-test/main/partition_mgm.result index 37733a4e764a7..9d2b9ce6f5766 100644 --- a/mysql-test/main/partition_mgm.result +++ b/mysql-test/main/partition_mgm.result @@ -23,7 +23,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) PARTITIONS 2 ALTER TABLE t1 COALESCE PARTITION 1; @@ -32,7 +32,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) PARTITIONS 1 drop table t1; @@ -57,7 +57,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) PARTITIONS 5 DROP TABLE t1; @@ -69,7 +69,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) PARTITIONS 5 DROP TABLE t1; @@ -80,7 +80,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) PARTITIONS 5 DROP TABLE t1; @@ -89,7 +89,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) PARTITIONS 5 DROP TABLE t1; diff --git a/mysql-test/main/partition_mgm_err.result b/mysql-test/main/partition_mgm_err.result index 22bd225b528fe..864b1cbd37f32 100644 --- a/mysql-test/main/partition_mgm_err.result +++ b/mysql-test/main/partition_mgm_err.result @@ -138,13 +138,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 PARTITION BY KEY(a) PARTITIONS 2; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 2 DROP TABLE t1; diff --git a/mysql-test/main/partition_mrr_aria.result b/mysql-test/main/partition_mrr_aria.result index 99fb17338c3d1..7ff5c9b63ed66 100644 --- a/mysql-test/main/partition_mrr_aria.result +++ b/mysql-test/main/partition_mrr_aria.result @@ -27,7 +27,7 @@ t3 CREATE TABLE `t3` ( `col2` int(11) DEFAULT NULL, PRIMARY KEY (`ID`,`part_id`), KEY `key_col` (`key_col`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`part_id`) (PARTITION `p1` VALUES LESS THAN (3) ENGINE = Aria, PARTITION `p2` VALUES LESS THAN (7) ENGINE = Aria, diff --git a/mysql-test/main/partition_mrr_innodb.result b/mysql-test/main/partition_mrr_innodb.result index 8e34914a6e3ec..98819021a6dbb 100644 --- a/mysql-test/main/partition_mrr_innodb.result +++ b/mysql-test/main/partition_mrr_innodb.result @@ -27,7 +27,7 @@ t3 CREATE TABLE `t3` ( `col2` int(11) DEFAULT NULL, PRIMARY KEY (`ID`,`part_id`), KEY `key_col` (`key_col`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`part_id`) (PARTITION `p1` VALUES LESS THAN (3) ENGINE = InnoDB, PARTITION `p2` VALUES LESS THAN (7) ENGINE = InnoDB, diff --git a/mysql-test/main/partition_mrr_myisam.result b/mysql-test/main/partition_mrr_myisam.result index 395b64ffb111c..c3ce2935417ec 100644 --- a/mysql-test/main/partition_mrr_myisam.result +++ b/mysql-test/main/partition_mrr_myisam.result @@ -27,7 +27,7 @@ t3 CREATE TABLE `t3` ( `col2` int(11) DEFAULT NULL, PRIMARY KEY (`ID`,`part_id`), KEY `key_col` (`key_col`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`part_id`) (PARTITION `p1` VALUES LESS THAN (3) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (7) ENGINE = MyISAM, diff --git a/mysql-test/main/partition_myisam.result b/mysql-test/main/partition_myisam.result index 3a549060d8e07..3509d2f284c06 100644 --- a/mysql-test/main/partition_myisam.result +++ b/mysql-test/main/partition_myisam.result @@ -26,7 +26,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 CHECKSUM=1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CHECKSUM=1 PARTITION BY RANGE (`i`) (PARTITION `p3` VALUES LESS THAN (3) ENGINE = MyISAM, PARTITION `p5` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -40,7 +40,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6); CHECKSUM TABLE t1; Table Checksum @@ -56,7 +56,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 CHECKSUM=1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CHECKSUM=1 DROP TABLE t1; # # Bug#31931: Mix of handlers error message @@ -107,7 +107,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`) -) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (NULL); # NOTE: 12 exists only in non transactional engines! SELECT * FROM t1; @@ -129,7 +129,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`) -) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) INSERT INTO t1 VALUES (NULL); SELECT * FROM t1; diff --git a/mysql-test/main/partition_not_blackhole.result b/mysql-test/main/partition_not_blackhole.result index 6cb8dea80c827..9753cd2bae241 100644 --- a/mysql-test/main/partition_not_blackhole.result +++ b/mysql-test/main/partition_not_blackhole.result @@ -9,7 +9,7 @@ SHOW TABLES; Tables_in_test t1 SHOW CREATE TABLE t1; -ERROR HY000: Failed to read from the .par file +ERROR HY000: Incorrect information in file: './test/t1.frm' DROP TABLE t1; ERROR HY000: Got error 175 "File too short; Expected more data in file" from storage engine partition t1.frm diff --git a/mysql-test/main/partition_not_blackhole.test b/mysql-test/main/partition_not_blackhole.test index d9e653b52521d..fe7452432b239 100644 --- a/mysql-test/main/partition_not_blackhole.test +++ b/mysql-test/main/partition_not_blackhole.test @@ -17,7 +17,7 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`; --copy_file std_data/parts/t1_blackhole.par $MYSQLD_DATADIR/test/t1.par SHOW TABLES; --replace_result $MYSQLD_DATADIR ./ ---error ER_FAILED_READ_FROM_PAR_FILE +--error ER_NOT_FORM_FILE SHOW CREATE TABLE t1; # The replace is needed for Solaris diff --git a/mysql-test/main/partition_not_windows.result b/mysql-test/main/partition_not_windows.result index 03282ac134ac6..1d18ebfbd6281 100644 --- a/mysql-test/main/partition_not_windows.result +++ b/mysql-test/main/partition_not_windows.result @@ -30,7 +30,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`i`) (PARTITION `p01` VALUES LESS THAN (1000) ENGINE = MyISAM) DROP TABLE t1, t2; diff --git a/mysql-test/main/partition_order.result b/mysql-test/main/partition_order.result index cecfc90eefb25..d4a0c133d1091 100644 --- a/mysql-test/main/partition_order.result +++ b/mysql-test/main/partition_order.result @@ -1,4 +1,3 @@ -drop table if exists t1; CREATE TABLE t1 ( a int not null, b int not null, @@ -783,3 +782,17 @@ a b c 1 1 1 1 NULL NULL drop table t1; +# +# MDEV-13756 Implement descending index: KEY (a DESC, b ASC) +# +create table t1 (a int, b int, key(a desc)) partition by hash(a) partitions 4; +insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6); +explain select * from t1 order by a limit 3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a 5 NULL 3 +select * from t1 order by a limit 3; +a b +1 1 +2 2 +3 3 +drop table t1; diff --git a/mysql-test/main/partition_order.test b/mysql-test/main/partition_order.test index ad956361d007b..f5cd4c2507417 100644 --- a/mysql-test/main/partition_order.test +++ b/mysql-test/main/partition_order.test @@ -1,14 +1,9 @@ -#--disable_abort_on_error # # Simple test for the partition storage engine # Focuses on tests of ordered index read # -- source include/have_partition.inc ---disable_warnings -drop table if exists t1; ---enable_warnings - # # Ordered index read, int type # @@ -842,3 +837,12 @@ INSERT into t1 values (1, NULL, NULL), (2, NULL, '10'); select * from t1 where a = 1 order by a desc, b desc; select * from t1 where a = 1 order by b desc; drop table t1; + +--echo # +--echo # MDEV-13756 Implement descending index: KEY (a DESC, b ASC) +--echo # +create table t1 (a int, b int, key(a desc)) partition by hash(a) partitions 4; +insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6); +explain select * from t1 order by a limit 3; +select * from t1 order by a limit 3; +drop table t1; diff --git a/mysql-test/main/partition_pruning.result b/mysql-test/main/partition_pruning.result index 519bf590b9b7e..ec0cb144a51de 100644 --- a/mysql-test/main/partition_pruning.result +++ b/mysql-test/main/partition_pruning.result @@ -2677,7 +2677,7 @@ select * from t1 X, t1 Y where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3); id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE X p1,p2 range a,b a 4 NULL 4 Using where -1 SIMPLE Y p2,p3 ref|filter a,b b|a 4|4 test.X.b 2 (50%) Using where; Using rowid filter +1 SIMPLE Y p2,p3 ref a,b b 4 test.X.b 2 Using where explain partitions select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2); id select_type table partitions type possible_keys key key_len ref rows Extra diff --git a/mysql-test/main/partition_range.result b/mysql-test/main/partition_range.result index 7384def5c856e..9cefe83e1e2fa 100644 --- a/mysql-test/main/partition_range.result +++ b/mysql-test/main/partition_range.result @@ -30,7 +30,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (to_days(`a`)) SUBPARTITION BY HASH (to_seconds(`a`)) (PARTITION `p0` VALUES LESS THAN (1) ENGINE = MyISAM) @@ -70,7 +70,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (to_seconds(`a`)) (PARTITION `p0` VALUES LESS THAN (63340531200) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN (63342604800) ENGINE = MyISAM) @@ -101,7 +101,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (to_seconds(`a`)) (PARTITION `p0` VALUES LESS THAN (63240134400) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN (63271756800) ENGINE = MyISAM) @@ -131,7 +131,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (to_seconds(`a`)) (PARTITION `p0` VALUES LESS THAN (63240177600) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN (63271800000) ENGINE = MyISAM) @@ -161,7 +161,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) drop table t1; @@ -292,7 +292,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) NOT NULL, `c` int(11) NOT NULL, PRIMARY KEY (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `x1` VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION `x2` VALUES LESS THAN (10) ENGINE = MyISAM, @@ -316,7 +316,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) NOT NULL, `c` int(11) NOT NULL, PRIMARY KEY (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `x1` VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION `x2` VALUES LESS THAN (10) ENGINE = MyISAM, @@ -417,7 +417,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) NOT NULL, `c` int(11) NOT NULL, PRIMARY KEY (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY HASH (`a` + `b`) (PARTITION `x1` VALUES LESS THAN (1) @@ -435,7 +435,7 @@ t1 CREATE TABLE `t1` ( `c` int(11) NOT NULL, `d` int(11) DEFAULT NULL, PRIMARY KEY (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY HASH (`a` + `b`) (PARTITION `x1` VALUES LESS THAN (1) @@ -666,7 +666,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM) @@ -679,7 +679,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (2) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM) diff --git a/mysql-test/main/partition_sp.result b/mysql-test/main/partition_sp.result new file mode 100644 index 0000000000000..585e2c7ab9dab --- /dev/null +++ b/mysql-test/main/partition_sp.result @@ -0,0 +1,22 @@ +# +# MDEV-8652: Partitioned table creation problem when +# creating from procedure context twice in same session +# +CREATE PROCEDURE p1() +BEGIN +DROP TABLE IF EXISTS t1 ; +CREATE TABLE t1 ( +id INT PRIMARY KEY +) +PARTITION BY RANGE (id) ( +PARTITION P1 VALUES LESS THAN (2), +PARTITION P2 VALUES LESS THAN (3) +); +END | +call p1(); +call p1(); +drop procedure p1; +drop table t1; +# +# End of 10.2 tests +# diff --git a/mysql-test/main/partition_sp.test b/mysql-test/main/partition_sp.test new file mode 100644 index 0000000000000..1d3d1d707c74e --- /dev/null +++ b/mysql-test/main/partition_sp.test @@ -0,0 +1,35 @@ +--source include/have_partition.inc + +--echo # +--echo # MDEV-8652: Partitioned table creation problem when +--echo # creating from procedure context twice in same session +--echo # + + +DELIMITER |; + +CREATE PROCEDURE p1() +BEGIN + DROP TABLE IF EXISTS t1 ; + + CREATE TABLE t1 ( + id INT PRIMARY KEY + ) + PARTITION BY RANGE (id) ( + PARTITION P1 VALUES LESS THAN (2), + PARTITION P2 VALUES LESS THAN (3) + ); +END | + +DELIMITER ;| + +call p1(); +call p1(); + +drop procedure p1; +drop table t1; + +--echo # +--echo # End of 10.2 tests +--echo # + diff --git a/mysql-test/main/partition_symlink.result b/mysql-test/main/partition_symlink.result index 90048eb343883..17ddecbe19d14 100644 --- a/mysql-test/main/partition_symlink.result +++ b/mysql-test/main/partition_symlink.result @@ -21,7 +21,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM, PARTITION `p1` VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM, @@ -30,7 +30,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/tmp/' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/tmp/' INSERT INTO t1 VALUES (0), (1), (2); ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ALTER TABLE t1 EXCHANGE PARTITION p2 WITH TABLE t2; @@ -161,7 +161,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`i`) (PARTITION `p01` VALUES LESS THAN (1000) ENGINE = MyISAM) DROP TABLE t1, t2; @@ -177,3 +177,97 @@ partition by key (a) (partition p0, partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); Got one of the listed errors +# +# MDEV-25917 create table like fails if source table is partitioned and engine is myisam or aria with data directory. +# +CREATE TABLE t1 (a INT) +ENGINE = MyISAM +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0) +DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp' + INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp', +PARTITION p1 VALUES IN (1) +DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp' + INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp', +PARTITION p2 VALUES IN (2)); +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY LIST (`a`) +(PARTITION `p0` VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM, + PARTITION `p1` VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM, + PARTITION `p2` VALUES IN (2) ENGINE = MyISAM) +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY LIST (`a`) +(PARTITION `p0` VALUES IN (0) ENGINE = MyISAM, + PARTITION `p1` VALUES IN (1) ENGINE = MyISAM, + PARTITION `p2` VALUES IN (2) ENGINE = MyISAM) +DROP TABLE t1, t2; +CREATE TABLE t1 ( +ID int(11) NOT NULL, +type int(11)) Engine=MyISAM +PARTITION BY RANGE(ID) +SUBPARTITION BY HASH(type) +( +PARTITION p01 VALUES LESS THAN(100) +(SUBPARTITION s11 +DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp' + INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp', +SUBPARTITION s12 +DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp' + INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp' + ), +PARTITION p11 VALUES LESS THAN(200) +(SUBPARTITION s21, SUBPARTITION s22), +PARTITION p21 VALUES LESS THAN MAXVALUE +(SUBPARTITION s31 +DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp' + INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp', +SUBPARTITION s32 +DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp' + INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp' + ) +); +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ID` int(11) NOT NULL, + `type` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY RANGE (`ID`) +SUBPARTITION BY HASH (`type`) +(PARTITION `p01` VALUES LESS THAN (100) + (SUBPARTITION `s11` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM, + SUBPARTITION `s12` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM), + PARTITION `p11` VALUES LESS THAN (200) + (SUBPARTITION `s21` ENGINE = MyISAM, + SUBPARTITION `s22` ENGINE = MyISAM), + PARTITION `p21` VALUES LESS THAN MAXVALUE + (SUBPARTITION `s31` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM, + SUBPARTITION `s32` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM)) +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ID` int(11) NOT NULL, + `type` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY RANGE (`ID`) +SUBPARTITION BY HASH (`type`) +(PARTITION `p01` VALUES LESS THAN (100) + (SUBPARTITION `s11` ENGINE = MyISAM, + SUBPARTITION `s12` ENGINE = MyISAM), + PARTITION `p11` VALUES LESS THAN (200) + (SUBPARTITION `s21` ENGINE = MyISAM, + SUBPARTITION `s22` ENGINE = MyISAM), + PARTITION `p21` VALUES LESS THAN MAXVALUE + (SUBPARTITION `s31` ENGINE = MyISAM, + SUBPARTITION `s32` ENGINE = MyISAM)) +DROP TABLE t1, t2; diff --git a/mysql-test/main/partition_symlink.test b/mysql-test/main/partition_symlink.test index 8f6e837299a76..07d653ee4d64e 100644 --- a/mysql-test/main/partition_symlink.test +++ b/mysql-test/main/partition_symlink.test @@ -1,5 +1,6 @@ # Test that must have symlink. eg. using DATA/INDEX DIR # (DATA/INDEX DIR requires symlinks) + # This test is only useful for MyISAM, since no other engine supports DATA DIR -- source include/have_partition.inc -- source include/have_symlink.inc @@ -15,6 +16,7 @@ DROP DATABASE IF EXISTS mysqltest2; --echo # --echo # Test for WL#4445: EXCHANGE PARTITION --echo # +--disable_service_connection --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval CREATE TABLE t1 (a INT) ENGINE = MyISAM @@ -44,6 +46,7 @@ ALTER TABLE t1 EXCHANGE PARTITION p2 WITH TABLE t2; SELECT * FROM t1; SELECT * FROM t2; DROP TABLE t1, t2; +--enable_service_connection # skipped because of bug#52354 #CREATE TABLE t1 LIKE t2; #ALTER TABLE t1 PARTITION BY LIST (a) @@ -72,6 +75,7 @@ DROP TABLE t1, t2; -- echo # Creating two non colliding tables mysqltest2.t1 and test.t1 -- echo # test.t1 have partitions in mysqltest2-directory! -- echo # user root: +--disable_service_connection CREATE USER mysqltest_1@localhost; CREATE DATABASE mysqltest2; USE mysqltest2; @@ -110,6 +114,7 @@ connection default; SELECT * FROM t1; DROP TABLE t1; DROP DATABASE mysqltest2; + --enable_service_connection # The below test shows that a pre-existing partition can not be # destroyed by a new partition from another table. # (Remember that a table or partition that uses the DATA/INDEX DIR @@ -220,3 +225,58 @@ ENGINE = MyISAM partition by key (a) (partition p0, partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); + +--echo # +--echo # MDEV-25917 create table like fails if source table is partitioned and engine is myisam or aria with data directory. +--echo # +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval CREATE TABLE t1 (a INT) +ENGINE = MyISAM +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0) + DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp' + INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp', + PARTITION p1 VALUES IN (1) + DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp' + INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp', + PARTITION p2 VALUES IN (2)); + +CREATE TABLE t2 LIKE t1; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval CREATE TABLE t1 ( + ID int(11) NOT NULL, + type int(11)) Engine=MyISAM +PARTITION BY RANGE(ID) +SUBPARTITION BY HASH(type) +( + PARTITION p01 VALUES LESS THAN(100) + (SUBPARTITION s11 + DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp' + INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp', + SUBPARTITION s12 + DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp' + INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp' + ), + PARTITION p11 VALUES LESS THAN(200) + (SUBPARTITION s21, SUBPARTITION s22), + PARTITION p21 VALUES LESS THAN MAXVALUE + (SUBPARTITION s31 + DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp' + INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp', + SUBPARTITION s32 + DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp' + INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp' + ) +); + +CREATE TABLE t2 LIKE t1; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; + +DROP TABLE t1, t2; diff --git a/mysql-test/main/partition_utf8.result b/mysql-test/main/partition_utf8.result index d279cdfab4327..f244e7f748909 100644 --- a/mysql-test/main/partition_utf8.result +++ b/mysql-test/main/partition_utf8.result @@ -5,8 +5,8 @@ partition by list columns (a) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(2) CHARACTER SET cp1250 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(2) CHARACTER SET cp1250 COLLATE cp1250_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`a`) (PARTITION `p0` VALUES IN (_cp1250 0x81) ENGINE = MyISAM) drop table t1; @@ -16,8 +16,8 @@ partition by list columns (a) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(2) CHARACTER SET cp1250 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(2) CHARACTER SET cp1250 COLLATE cp1250_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`a`) (PARTITION `p0` VALUES IN ('€') ENGINE = MyISAM) drop table t1; @@ -43,8 +43,8 @@ partition p1 values in ('')); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(2) CHARACTER SET ucs2 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` varchar(2) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST COLUMNS(`a`) (PARTITION `p0` VALUES IN ('†') ENGINE = MyISAM, PARTITION `p1` VALUES IN ('') ENGINE = MyISAM) @@ -79,7 +79,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PARTITION BY LIST COLUMNS(`a`) (PARTITION `p0` VALUES IN (_binary 0xff) ENGINE = MyISAM) SELECT PARTITION_DESCRIPTION FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME='t1'; diff --git a/mysql-test/main/percona_nonflushing_analyze_debug.test b/mysql-test/main/percona_nonflushing_analyze_debug.test index 4c9c2dcb7685c..fdaf7aed6c061 100644 --- a/mysql-test/main/percona_nonflushing_analyze_debug.test +++ b/mysql-test/main/percona_nonflushing_analyze_debug.test @@ -1,5 +1,6 @@ --source include/have_debug_sync.inc --source include/have_innodb.inc +--source include/no_view_protocol.inc #set use_stat_tables='preferably_for_queries'; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; diff --git a/mysql-test/main/plugin.result b/mysql-test/main/plugin.result index 5806b8f5de3fb..50a82efe55ab7 100644 --- a/mysql-test/main/plugin.result +++ b/mysql-test/main/plugin.result @@ -40,11 +40,15 @@ a set global example_ulong_var=500; set global example_enum_var= e1; set session example_int_var= -1; +set global example_deprecated_var=1; +Warnings: +Warning 1287 '@@example_deprecated_var' is deprecated and will be removed in a future release show status like 'example%'; Variable_name Value Example_func_example enum_var is 0, ulong_var is 500, int_var is -1, double_var is 8.500000, really show variables like 'example%'; Variable_name Value +example_deprecated_var 0 example_double_thdvar 8.500000 example_double_var 8.500000 example_enum_var e1 @@ -124,7 +128,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `complex`='c,f,f,f' -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=10000 `STR`='dskj' `one_or_two`='one' `YESNO`=0 +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `ULL`=10000 `STR`='dskj' `one_or_two`='one' `YESNO`=0 drop table t1; SET @OLD_SQL_MODE=@@SQL_MODE; SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS'; @@ -139,7 +143,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=10000000000000000000 `one_or_two`='ttt' `YESNO`=SSS +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `ULL`=10000000000000000000 `one_or_two`='ttt' `YESNO`=SSS #alter table alter table t1 ULL=10000000; Warnings: @@ -149,7 +153,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `one_or_two`='ttt' `YESNO`=SSS `ULL`=10000000 +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `one_or_two`='ttt' `YESNO`=SSS `ULL`=10000000 alter table t1 change a a int complex='c,c,c'; Warnings: Note 1105 EXAMPLE DEBUG: Field `a` COMPLEX '(null)' -> 'c,c,c' @@ -158,14 +162,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `complex`='c,c,c', `b` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `one_or_two`='ttt' `YESNO`=SSS `ULL`=10000000 +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `one_or_two`='ttt' `YESNO`=SSS `ULL`=10000000 alter table t1 one_or_two=two; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `complex`='c,c,c', `b` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `YESNO`=SSS `ULL`=10000000 `one_or_two`=two +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `YESNO`=SSS `ULL`=10000000 `one_or_two`=two drop table t1; #illegal value error SET SQL_MODE=''; @@ -180,7 +184,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=4660 +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `ULL`=4660 SET example_varopt_default=33; select create_options from information_schema.tables where table_schema='test' and table_name='t1'; create_options @@ -192,27 +196,27 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; create table t1 (a int) engine=example; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `VAROPT`=33 +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `VAROPT`=33 drop table t1; create table t1 (a int) engine=example varopt=15; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `varopt`=15 +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `varopt`=15 alter table t1 varopt=default; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `VAROPT`=33 +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `VAROPT`=33 drop table t1; SET @@SQL_MODE=@OLD_SQL_MODE; select 1; @@ -353,6 +357,15 @@ select * from mysql.plugin WHERE name='unexisting_plugin'; name dl UNINSTALL PLUGIN unexisting_plugin; ERROR 42000: PLUGIN unexisting_plugin does not exist +# +# MDEV-26323 use-after-poison issue of MariaDB server +# +INSTALL PLUGIN DEALLOCATE SONAME ''; +ERROR HY000: Can't open shared library '.so' +INSTALL PLUGIN DEALLOCATE SONAME 'x'; +ERROR HY000: Can't open shared library 'x.so' +INSTALL PLUGIN DEALLOCATE SONAME 'xx'; +ERROR HY000: Can't open shared library 'xx.so' # End of 10.2 tests # # MDEV-16294: INSTALL PLUGIN IF NOT EXISTS / UNINSTALL PLUGIN IF EXISTS diff --git a/mysql-test/main/plugin.test b/mysql-test/main/plugin.test index 19199f767f565..9151a6e905c48 100644 --- a/mysql-test/main/plugin.test +++ b/mysql-test/main/plugin.test @@ -27,6 +27,7 @@ SELECT * FROM t1; set global example_ulong_var=500; set global example_enum_var= e1; set session example_int_var= -1; +set global example_deprecated_var=1; show status like 'example%'; show variables like 'example%'; @@ -255,10 +256,12 @@ select plugin_name from information_schema.plugins where plugin_library like 'ha # # # +--disable_service_connection set names utf8; select convert('admin𝌆' using utf8); --error ER_UDF_NO_PATHS install plugin foo soname 'admin𝌆'; +--enable_service_connection --echo # End of 5.5 test @@ -295,6 +298,23 @@ select * from mysql.plugin WHERE name='unexisting_plugin'; --error ER_SP_DOES_NOT_EXIST UNINSTALL PLUGIN unexisting_plugin; +--echo # +--echo # MDEV-26323 use-after-poison issue of MariaDB server +--echo # + +--replace_regex /library '.*[\\/].(dll|so)' [(].*[)]/library '.so'/ +--error ER_CANT_OPEN_LIBRARY +INSTALL PLUGIN DEALLOCATE SONAME ''; + +--replace_regex /library '.*[\\/]x.(dll|so)' [(].*[)]/library 'x.so'/ +--error ER_CANT_OPEN_LIBRARY +INSTALL PLUGIN DEALLOCATE SONAME 'x'; + +--replace_regex /library '.*[\\/]xx.(dll|so)' [(].*[)]/library 'xx.so'/ +--error ER_CANT_OPEN_LIBRARY +INSTALL PLUGIN DEALLOCATE SONAME 'xx'; + + --echo # End of 10.2 tests --source include/install_plugin_if_exists.inc diff --git a/mysql-test/main/plugin_auth.result b/mysql-test/main/plugin_auth.result index 3d86d71300923..ac10bd067071b 100644 --- a/mysql-test/main/plugin_auth.result +++ b/mysql-test/main/plugin_auth.result @@ -23,12 +23,12 @@ test mysql.proxies_priv; SHOW CREATE TABLE mysql.proxies_priv; Table Create Table proxies_priv CREATE TABLE `proxies_priv` ( - `Host` char(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Proxied_host` char(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Proxied_user` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(255) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Proxied_host` char(255) NOT NULL DEFAULT '', + `Proxied_user` char(128) NOT NULL DEFAULT '', `With_grant` tinyint(1) NOT NULL DEFAULT 0, - `Grantor` varchar(384) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Grantor` varchar(384) NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`), KEY `Grantor` (`Grantor`) diff --git a/mysql-test/main/plugin_auth.test b/mysql-test/main/plugin_auth.test index 30e4fa6e0ad2c..48f35ac65e255 100644 --- a/mysql-test/main/plugin_auth.test +++ b/mysql-test/main/plugin_auth.test @@ -2,6 +2,10 @@ --source include/not_embedded.inc --source include/mysql_upgrade_preparation.inc --source include/have_innodb.inc +--source include/no_valgrind_without_big.inc + +#enable view protocol after fix MDEV-29542 +--source include/no_view_protocol.inc SET GLOBAL SQL_MODE=""; SET LOCAL SQL_MODE=""; diff --git a/mysql-test/main/plugin_auth_qa.test b/mysql-test/main/plugin_auth_qa.test index fce72a66702ff..9919d09359120 100644 --- a/mysql-test/main/plugin_auth_qa.test +++ b/mysql-test/main/plugin_auth_qa.test @@ -2,6 +2,8 @@ --source include/have_plugin_auth.inc --source include/not_embedded.inc +#enable view protocol after fix MDEV-29542 +--source include/no_view_protocol.inc set sql_mode=""; diff --git a/mysql-test/main/plugin_auth_qa_1.test b/mysql-test/main/plugin_auth_qa_1.test index c2435a1d80017..1c53da598443c 100644 --- a/mysql-test/main/plugin_auth_qa_1.test +++ b/mysql-test/main/plugin_auth_qa_1.test @@ -2,6 +2,8 @@ --source include/have_plugin_auth.inc --source include/not_embedded.inc +#enable view protocol after fix MDEV-29542 +--source include/no_view_protocol.inc CREATE DATABASE test_user_db; diff --git a/mysql-test/main/plugin_auth_qa_2.test b/mysql-test/main/plugin_auth_qa_2.test index 136419e571f0f..17e627ab77387 100644 --- a/mysql-test/main/plugin_auth_qa_2.test +++ b/mysql-test/main/plugin_auth_qa_2.test @@ -5,6 +5,8 @@ # by this application and the application checks the values set the the plugin. --source include/have_plugin_interface.inc --source include/not_embedded.inc +#enable view protocol after fix MDEV-29542 +--source include/no_view_protocol.inc CREATE DATABASE test_user_db; diff --git a/mysql-test/main/plugin_auth_qa_3.test b/mysql-test/main/plugin_auth_qa_3.test index 2d8b82e373a8a..12474eccecd37 100644 --- a/mysql-test/main/plugin_auth_qa_3.test +++ b/mysql-test/main/plugin_auth_qa_3.test @@ -5,6 +5,8 @@ # by this application and the application checks the values set the the plugin. --source include/have_plugin_server.inc --source include/not_embedded.inc +#enable view protocol after fix MDEV-29542 +--source include/no_view_protocol.inc CREATE DATABASE test_user_db; diff --git a/mysql-test/main/plugin_not_embedded.result b/mysql-test/main/plugin_not_embedded.result index a9ac5735137c0..3f9ce5764482d 100644 --- a/mysql-test/main/plugin_not_embedded.result +++ b/mysql-test/main/plugin_not_embedded.result @@ -6,7 +6,7 @@ GRANT INSERT ON mysql.plugin TO bug51770@localhost; connect con1,localhost,bug51770,,; INSTALL PLUGIN example SONAME 'ha_example.so'; UNINSTALL PLUGIN example; -ERROR 42000: DELETE command denied to user 'bug51770'@'localhost' for table 'plugin' +ERROR 42000: DELETE command denied to user 'bug51770'@'localhost' for table `mysql`.`plugin` connection default; GRANT DELETE ON mysql.plugin TO bug51770@localhost; connection con1; diff --git a/mysql-test/main/pool_of_threads.test b/mysql-test/main/pool_of_threads.test index 3d581d4605da8..4f2077aef7483 100644 --- a/mysql-test/main/pool_of_threads.test +++ b/mysql-test/main/pool_of_threads.test @@ -1,13 +1,18 @@ +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection +-- source include/no_view_protocol.inc + # Start with thread_handling=pool-of-threads # and run a number of tests -- source include/have_pool_of_threads.inc -- source include/default_optimizer_switch.inc -SET optimizer_switch='outer_join_with_cache=off'; # Slow test, don't run during staging part -- source include/not_staging.inc -- source include/long_test.inc + +SET optimizer_switch='outer_join_with_cache=off'; -- source include/common-tests.inc SET optimizer_switch=default; diff --git a/mysql-test/main/precedence.test b/mysql-test/main/precedence.test index cd7cee4f911da..b93aea72e65a8 100644 --- a/mysql-test/main/precedence.test +++ b/mysql-test/main/precedence.test @@ -4501,6 +4501,10 @@ create or replace view v1 as select 3 BETWEEN 1 AND 2 AND NULL, 3 BETWEEN (1 AND Select view_definition from information_schema.views where table_schema='test' and table_name='v1'; select 3 BETWEEN 1 AND 2 AND NULL, 3 BETWEEN (1 AND 2) AND NULL, 3 BETWEEN 1 AND (2 AND NULL), (3 BETWEEN 1 AND 2) AND NULL union select * from v1; +# Looks like it is necessary that the view protocol uses the same connection, +# not util connection +--disable_service_connection + set sql_mode=PIPES_AS_CONCAT; create or replace view v1 as select 2 OR 3 || 3, 2 OR (3 || 3), (2 OR 3) || 3; Select view_definition from information_schema.views where table_schema='test' and table_name='v1'; @@ -4788,4 +4792,6 @@ Select view_definition from information_schema.views where table_schema='test' a create or replace view v1 as select 2 IS TRUE = 3, 2 IS FALSE = 3, 2 IS UNKNOWN = 3, 2 IS NULL = 3, ISNULL(2) = 1; Select view_definition from information_schema.views where table_schema='test' and table_name='v1'; +--enable_service_connection + drop view v1; diff --git a/mysql-test/main/precedence_bugs.result b/mysql-test/main/precedence_bugs.result index 4b13e820d7f1a..723ab823b488c 100644 --- a/mysql-test/main/precedence_bugs.result +++ b/mysql-test/main/precedence_bugs.result @@ -58,3 +58,21 @@ Create View CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY D character_set_client latin1 collation_connection latin1_swedish_ci drop view v1; +# +# MDEV-30082 View definition losing brackets changes semantics of the query and causes wrong result +# +create table t1 (a varchar(1), b bool) engine=myisam; +insert into t1 values ('u',1),('s',1); +select * from t1 where t1.b in (t1.a <= all (select 'a')); +a b +create view v as select * from t1 where t1.b in (t1.a <= all (select 'a')); +select * from v; +a b +show create view v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where `t1`.`b` = (`t1`.`a` <= all (select 'a')) latin1 latin1_swedish_ci +drop view v; +drop table t1; +# +# End of 10.3 results +# diff --git a/mysql-test/main/precedence_bugs.test b/mysql-test/main/precedence_bugs.test index 6e8e624c840c5..ae35ca9152731 100644 --- a/mysql-test/main/precedence_bugs.test +++ b/mysql-test/main/precedence_bugs.test @@ -39,3 +39,19 @@ drop table t1; create view v1 as select 1 like (now() between '2000-01-01' and '2012-12-12' ); query_vertical show create view v1; drop view v1; + +--echo # +--echo # MDEV-30082 View definition losing brackets changes semantics of the query and causes wrong result +--echo # +create table t1 (a varchar(1), b bool) engine=myisam; +insert into t1 values ('u',1),('s',1); +select * from t1 where t1.b in (t1.a <= all (select 'a')); +create view v as select * from t1 where t1.b in (t1.a <= all (select 'a')); +select * from v; +show create view v; +drop view v; +drop table t1; + +--echo # +--echo # End of 10.3 results +--echo # diff --git a/mysql-test/main/prepare.result b/mysql-test/main/prepare.result index cfe6603dbbec1..7c730bff0c583 100644 --- a/mysql-test/main/prepare.result +++ b/mysql-test/main/prepare.result @@ -64,3 +64,19 @@ SQRT(?) is not null # # End of 10.3 tests # +# +# MDEV-17869 AddressSanitizer: use-after-poison in Item_change_list::rollback_item_tree_changes +# +create table t1 (pk int, v1 varchar(1)); +insert t1 values (1,'v'),(2,'v'),(3,'c'); +create table t2 (pk int, v1 varchar(1)); +insert t2 values (1,'x'); +create table t3 (pk int, i1 int, v1 varchar(1)); +insert t3 values (10,8,9); +execute immediate 'select straight_join 1 from (t1 join t2 on (t1.v1 = t2.v1)) +where (3, 6) in (select tc.pk, t3.i1 from (t3 join t1 as tc on (tc.v1 = t3.v1)) having tc.pk > 1 );'; +1 +drop table t1, t2, t3; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/prepare.test b/mysql-test/main/prepare.test index 4d1573eb0c85a..bf37f6dc8d189 100644 --- a/mysql-test/main/prepare.test +++ b/mysql-test/main/prepare.test @@ -52,3 +52,20 @@ execute p1 using 17864960750176564435; --echo # --echo # End of 10.3 tests --echo # + +--echo # +--echo # MDEV-17869 AddressSanitizer: use-after-poison in Item_change_list::rollback_item_tree_changes +--echo # +create table t1 (pk int, v1 varchar(1)); +insert t1 values (1,'v'),(2,'v'),(3,'c'); +create table t2 (pk int, v1 varchar(1)); +insert t2 values (1,'x'); +create table t3 (pk int, i1 int, v1 varchar(1)); +insert t3 values (10,8,9); +execute immediate 'select straight_join 1 from (t1 join t2 on (t1.v1 = t2.v1)) +where (3, 6) in (select tc.pk, t3.i1 from (t3 join t1 as tc on (tc.v1 = t3.v1)) having tc.pk > 1 );'; +drop table t1, t2, t3; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/processlist.result b/mysql-test/main/processlist.result index 2d3228a6d91b8..d99160f5c7489 100644 --- a/mysql-test/main/processlist.result +++ b/mysql-test/main/processlist.result @@ -40,3 +40,23 @@ utf8mb4_string xxx😎yyy # # End of 10.1 tests # +# +# Start of 10.3 tests +# +# +# MDEV-28131 Unexpected warning while selecting from information_schema.processlist +# +connect conn1, localhost, root,,; +connection conn1; +SELECT SLEEP(1000); +connection default; +SELECT progress FROM information_schema.processlist WHERE info='SELECT SLEEP(1000)'; +progress +0.000 +connection conn1; +Got one of the listed errors +connection default; +disconnect conn1; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/processlist.test b/mysql-test/main/processlist.test index 8e98701459a1b..7e60f196f657f 100644 --- a/mysql-test/main/processlist.test +++ b/mysql-test/main/processlist.test @@ -1,3 +1,5 @@ +-- source include/no_view_protocol.inc + # # MDEV-4578 information_schema.processlist reports incorrect value for Time (2147483647) # @@ -70,3 +72,38 @@ SELECT INFO, INFO_BINARY, 'xxx😎yyy' AS utf8mb4_string FROM INFORMATION_SCHEMA --echo # --echo # End of 10.1 tests --echo # + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-28131 Unexpected warning while selecting from information_schema.processlist +--echo # + +connect (conn1, localhost, root,,); +connection conn1; +let $ID= `select connection_id()`; +send SELECT SLEEP(1000); +connection default; +let $wait_timeout= 10; +let $wait_condition=select count(*)=1 from information_schema.processlist +where state='User sleep' and info='SELECT SLEEP(1000)'; +--source include/wait_condition.inc +SELECT progress FROM information_schema.processlist WHERE info='SELECT SLEEP(1000)'; +disable_query_log; +eval kill $ID; +enable_query_log; +let $wait_timeout= 10; +let $wait_condition=select count(*)=0 from information_schema.processlist +where state='User sleep' and info='SELECT SLEEP(1000)'; +--source include/wait_condition.inc +connection conn1; +--error 2013,ER_CONNECTION_KILLED +reap; +connection default; +disconnect conn1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/profiling.result b/mysql-test/main/profiling.result index f1403c3ec2f01..f4673e6286140 100644 --- a/mysql-test/main/profiling.result +++ b/mysql-test/main/profiling.result @@ -296,12 +296,12 @@ id 2 3 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'hello' -Warning 1292 Truncated incorrect DOUBLE value: 'hello' -Warning 1292 Truncated incorrect DOUBLE value: 'hello' -Warning 1292 Truncated incorrect DOUBLE value: 'hello' -Warning 1292 Truncated incorrect DOUBLE value: 'hello' -Warning 1292 Truncated incorrect DOUBLE value: 'hello' +Warning 1292 Truncated incorrect DECIMAL value: 'hello' +Warning 1292 Truncated incorrect DECIMAL value: 'hello' +Warning 1292 Truncated incorrect DECIMAL value: 'hello' +Warning 1292 Truncated incorrect DECIMAL value: 'hello' +Warning 1292 Truncated incorrect DECIMAL value: 'hello' +Warning 1292 Truncated incorrect DECIMAL value: 'hello' select @@profiling; @@profiling 1 diff --git a/mysql-test/main/profiling.test b/mysql-test/main/profiling.test index 912e4f69798a2..714c68c00c789 100644 --- a/mysql-test/main/profiling.test +++ b/mysql-test/main/profiling.test @@ -1,4 +1,5 @@ --source include/have_profiling.inc +--source include/no_view_protocol.inc # Verify that the protocol isn't violated if we ask for profiling info # before profiling has recorded anything. diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result index cd01a8949bde7..21e67ff320a07 100644 --- a/mysql-test/main/ps.result +++ b/mysql-test/main/ps.result @@ -1109,12 +1109,12 @@ show create table mysqltest.t1; Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci show create table mysqltest.t2; Table Create Table t2 CREATE TABLE `t2` ( - `test` varchar(4) CHARACTER SET latin1 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 + `test` varchar(4) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci drop table mysqltest.t1; drop table mysqltest.t2; alter database mysqltest character set latin1; @@ -1124,12 +1124,12 @@ show create table mysqltest.t1; Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table mysqltest.t2; Table Create Table t2 CREATE TABLE `t2` ( `test` varchar(4) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop database mysqltest; deallocate prepare stmt1; deallocate prepare stmt2; @@ -1703,7 +1703,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`i`) -) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COMMENT='comment for table t1' +) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='comment for table t1' flush tables; select * from t2; i j k @@ -1713,7 +1713,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`i`) -) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COMMENT='comment for table t1' +) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='comment for table t1' deallocate prepare stmt; drop table t1, t2; set @old_character_set_server= @@character_set_server; @@ -1722,13 +1722,13 @@ prepare stmt from "create database mysqltest_1"; execute stmt; show create database mysqltest_1; Database Create Database -mysqltest_1 CREATE DATABASE `mysqltest_1` /*!40100 DEFAULT CHARACTER SET latin1 */ +mysqltest_1 CREATE DATABASE `mysqltest_1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ drop database mysqltest_1; set @@character_set_server= utf8; execute stmt; show create database mysqltest_1; Database Create Database -mysqltest_1 CREATE DATABASE `mysqltest_1` /*!40100 DEFAULT CHARACTER SET utf8mb3 */ +mysqltest_1 CREATE DATABASE `mysqltest_1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */ drop database mysqltest_1; deallocate prepare stmt; set @@character_set_server= @old_character_set_server; @@ -1755,7 +1755,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `?` decimal(2,1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; drop table if exists t1; create table t1 (a bigint unsigned, b bigint(20) unsigned); @@ -2506,21 +2506,21 @@ tab1 CREATE TABLE `tab1` ( `a` int(11) NOT NULL, `b` char(1) NOT NULL, PRIMARY KEY (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci call proc_1(); Table Create Table tab1 CREATE TABLE `tab1` ( `a` int(11) NOT NULL, `b` char(1) NOT NULL, PRIMARY KEY (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci call proc_1(); Table Create Table tab1 CREATE TABLE `tab1` ( `a` int(11) NOT NULL, `b` char(1) NOT NULL, PRIMARY KEY (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop procedure proc_1; create function func_1() returns int begin show create table tab1; return 1; end| ERROR 0A000: Not allowed to return a result set from a function @@ -2535,21 +2535,21 @@ tab1 CREATE TABLE `tab1` ( `a` int(11) NOT NULL, `b` char(1) NOT NULL, PRIMARY KEY (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci execute abc; Table Create Table tab1 CREATE TABLE `tab1` ( `a` int(11) NOT NULL, `b` char(1) NOT NULL, PRIMARY KEY (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci execute abc; Table Create Table tab1 CREATE TABLE `tab1` ( `a` int(11) NOT NULL, `b` char(1) NOT NULL, PRIMARY KEY (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci deallocate prepare abc; drop table tab1; drop view if exists v1; @@ -2973,17 +2973,17 @@ execute stmt; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` char(100) CHARACTER SET utf8mb3 DEFAULT NULL, + `c` char(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, KEY `c` (`c`(10)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; execute stmt; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` char(100) CHARACTER SET utf8mb3 DEFAULT NULL, + `c` char(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, KEY `c` (`c`(10)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; drop table if exists t1, t2; create table t1 (a int, b int); @@ -3319,7 +3319,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = 127; @a @a = 127 127 1 @@ -3337,7 +3337,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = 32767; @a @a = 32767 32767 1 @@ -3355,7 +3355,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = 8388607; @a @a = 8388607 8388607 1 @@ -3373,7 +3373,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = 2147483647; @a @a = 2147483647 2147483647 1 @@ -3391,7 +3391,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = 9223372036854775807; @a @a = 9223372036854775807 9223372036854775807 1 @@ -3409,7 +3409,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = b'10100100101'; @a @a = b'10100100101' 1317 1 @@ -3427,7 +3427,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = '2007-11-18 15:01:02'; @a @a = '2007-11-18 15:01:02' 2007-11-18 15:01:02 1 @@ -3445,7 +3445,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = '1234-11-12 12:34:59'; @a @a = '1234-11-12 12:34:59' 1234-11-12 12:34:59 1 @@ -3463,7 +3463,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = '123:45:01'; @a @a = '123:45:01' 123:45:01 1 @@ -3481,7 +3481,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = '1234-11-12'; @a @a = '1234-11-12' 1234-11-12 1 @@ -3499,7 +3499,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = 2010; @a @a = 2010 2010 1 @@ -3517,7 +3517,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a - 123.4567 < 0.00001; @a @a - 123.4567 < 0.00001 123.45670318603516 1 @@ -3535,7 +3535,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a - 123.45678 < 0.000001; @a @a - 123.45678 < 0.000001 123.45678 1 @@ -3553,7 +3553,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` decimal(65,38) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = 123.456789; @a @a = 123.456789 123.456789 1 @@ -3571,7 +3571,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = REPEAT('a', 16); @a @a = REPEAT('a', 16) aaaaaaaaaaaaaaaa 1 @@ -3589,7 +3589,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = REPEAT('b', 16); @a @a = REPEAT('b', 16) bbbbbbbbbbbbbbbb 1 @@ -3607,7 +3607,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = REPEAT('c', 16); @a @a = REPEAT('c', 16) cccccccccccccccc 1 @@ -3625,7 +3625,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = REPEAT('d', 16); @a @a = REPEAT('d', 16) dddddddddddddddd 1 @@ -3643,7 +3643,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = REPEAT('e', 16); @a @a = REPEAT('e', 16) eeeeeeeeeeeeeeee 1 @@ -3661,7 +3661,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = REPEAT('f', 16); @a @a = REPEAT('f', 16) ffffffffffffffff 1 @@ -3679,7 +3679,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = REPEAT('g', 32); @a @a = REPEAT('g', 32) gggggggggggggggggggggggggggggggg 1 @@ -3697,7 +3697,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = REPEAT('h', 16); @a @a = REPEAT('h', 16) hhhhhhhhhhhhhhhh 1 @@ -3715,7 +3715,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = REPEAT('i', 16); @a @a = REPEAT('i', 16) iiiiiiiiiiiiiiii 1 @@ -3733,7 +3733,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = REPEAT('j', 16); @a @a = REPEAT('j', 16) jjjjjjjjjjjjjjjj 1 @@ -3751,7 +3751,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = REPEAT('k', 16); @a @a = REPEAT('k', 16) kkkkkkkkkkkkkkkk 1 @@ -3769,7 +3769,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = REPEAT('l', 16); @a @a = REPEAT('l', 16) llllllllllllllll 1 @@ -3787,7 +3787,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = 'aaa'; @a @a = 'aaa' aaa 1 @@ -3805,7 +3805,7 @@ SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( `c1` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT @a, @a = 'aaa'; @a @a = 'aaa' aaa 1 @@ -4392,15 +4392,15 @@ set sql_mode='STRICT_ALL_TABLES'; CREATE TABLE t1 (id int, count int); insert into t1 values (1,1),(0,2); update t1 set count = count + 1 where id = '1bad'; -ERROR 22007: Truncated incorrect DOUBLE value: '1bad' +ERROR 22007: Truncated incorrect DECIMAL value: '1bad' prepare stmt from "update t1 set count = count + 1 where id = '1bad'"; execute stmt; -ERROR 22007: Truncated incorrect DOUBLE value: '1bad' +ERROR 22007: Truncated incorrect DECIMAL value: '1bad' deallocate prepare stmt; prepare stmt from 'update t1 set count = count + 1 where id = ?'; set @a = '1bad'; execute stmt using @a; -ERROR 22007: Truncated incorrect DOUBLE value: '1bad' +ERROR 22007: Truncated incorrect DECIMAL value: '1bad' deallocate prepare stmt; drop table t1; CREATE TABLE t1 (id decimal(10,5), count int); @@ -4565,70 +4565,70 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(2) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXECUTE stmt USING 10.123; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` decimal(5,3) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXECUTE stmt USING 10.123e0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` double NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXECUTE stmt USING CURRENT_DATE; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` date NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXECUTE stmt USING CURRENT_TIMESTAMP; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` datetime NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXECUTE stmt USING CURRENT_TIMESTAMP(3); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` datetime(3) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXECUTE stmt USING CURRENT_TIMESTAMP(6); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` datetime(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXECUTE stmt USING CURRENT_TIME; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` time NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXECUTE stmt USING CURRENT_TIME(3); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` time(3) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXECUTE stmt USING CURRENT_TIME(6); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` time(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DEALLOCATE PREPARE stmt; # @@ -4749,7 +4749,7 @@ EXECUTE IMMEDIATE 'SHOW CREATE TABLE t1'; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci EXECUTE IMMEDIATE 'DROP TABLE t1'; SET @stmt= 'CREATE TABLE t1 (a INT)'; EXECUTE IMMEDIATE @stmt; @@ -4758,7 +4758,7 @@ EXECUTE IMMEDIATE @stmt; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET @stmt= 'DROP TABLE t1'; EXECUTE IMMEDIATE @stmt; # @@ -4775,7 +4775,7 @@ t1 CREATE TABLE `t1` ( `b` decimal(3,1) NOT NULL, `c` double NOT NULL, `d` tinytext NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXECUTE IMMEDIATE 'CREATE TABLE t1 AS SELECT ? AS a,? AS b,? AS c,? AS d' @@ -4787,7 +4787,7 @@ t1 CREATE TABLE `t1` ( `b` decimal(3,1) NOT NULL, `c` double NOT NULL, `d` varchar(3) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXECUTE IMMEDIATE 'CREATE TABLE t1 AS SELECT ? AS t1,? AS t2, ? AS d1,? AS dt1, ? AS dt2' @@ -4804,7 +4804,7 @@ t1 CREATE TABLE `t1` ( `d1` date NOT NULL, `dt1` datetime NOT NULL, `dt2` datetime(3) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Using a user variable as an EXECUTE IMMEDIATE..USING out parameter @@ -5197,7 +5197,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned DEFAULT NULL, `b` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1(OUT v YEAR) SET v = 2010; @@ -5211,7 +5211,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned DEFAULT NULL, `b` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1(OUT v BIT(16)) SET v = 2010; @@ -5225,7 +5225,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned DEFAULT NULL, `b` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -5267,8 +5267,8 @@ CREATE TABLE t1 AS SELECT @a AS c1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` longtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -5305,7 +5305,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL, `b` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 10 AS a,? AS b' USING 10; SHOW CREATE TABLE t1; @@ -5313,7 +5313,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(2) NOT NULL, `b` int(2) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 999999999 AS a,? AS b' USING 999999999; SHOW CREATE TABLE t1; @@ -5321,7 +5321,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(9) NOT NULL, `b` int(9) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 2147483647 AS a,? AS b' USING 2147483647; SHOW CREATE TABLE t1; @@ -5329,7 +5329,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(10) NOT NULL, `b` bigint(10) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-14603 signal 11 with short stacktrace @@ -5556,11 +5556,15 @@ EXPLAIN EXTENDED UPDATE t3 SET c3 = ( SELECT COUNT(d1.c1) FROM ( SELECT a11.c1 F id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 0 100.00 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Note 1003 /* select#1 */ update `test`.`t3` set `test`.`t3`.`c3` = (/* select#2 */ select count(NULL) from `test`.`t1` `a11` straight_join `test`.`t2` `a21` join `test`.`t1` `a12` where 0) PREPARE stmt FROM "EXPLAIN EXTENDED UPDATE t3 SET c3 = ( SELECT COUNT(d1.c1) FROM ( SELECT a11.c1 FROM t1 AS a11 STRAIGHT_JOIN t2 AS a21 ON a21.c2 = a11.c1 JOIN t1 AS a12 ON a12.c1 = a11.c1 ) d1 )"; EXECUTE stmt; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 0 100.00 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Note 1003 /* select#1 */ update `test`.`t3` set `test`.`t3`.`c3` = (/* select#2 */ select count(NULL) from `test`.`t1` `a11` straight_join `test`.`t2` `a21` join `test`.`t1` `a12` where 0) DEALLOCATE PREPARE stmt; DROP TABLE t1, t2, t3; # @@ -5576,6 +5580,28 @@ a DEALLOCATE PREPARE stmt; DROP VIEW v1; DROP TABLE t1; +# +# MDEV-19631: Assertion `0' failed in st_select_lex_unit::optimize or +# different plan upon 2nd execution of PS with EXPLAIN +# +CREATE TABLE t1 (a INT); +PREPARE stmt FROM 'EXPLAIN SELECT * FROM t1 HAVING 6 IN ( SELECT 6 UNION SELECT 5 )'; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +# Without the patch the second execution of the 'stmt' prepared statement +# would result in server crash. +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +DEALLOCATE PREPARE stmt; +DROP TABLE t1; # End of 10.2 tests # # @@ -5593,6 +5619,122 @@ a.a a.b DEALLOCATE PREPARE stmt; DROP PROCEDURE p1; # +# MDEV-16128: Server crash in Item_func::print_op on 2nd execution of PS +# +CREATE TABLE t1 (a varchar(10)); +CREATE TABLE t2 (b varchar(10) CHARACTER SET utf8 ); +CREATE TABLE t3 (c varchar(10) CHARACTER SET utf8); +INSERT INTO t1 VALUES ('b'); +INSERT INTO t2 VALUES ('b'); +INSERT INTO t3 VALUES ('b'); +PREPARE stmt FROM "SELECT t1.* FROM (t1 JOIN t2 ON (t2.b = t1.a)) WHERE (EXISTS (SELECT 1 FROM t3 WHERE t3.c = t1.a))"; +EXECUTE stmt; +a +b +# Without the patch second execution of the prepared statement +# would lead to server crash. +EXECUTE stmt; +a +b +# Clean up +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2, t3; +CREATE TABLE t1 (a varchar(10)); +CREATE TABLE t2 (b varchar(10) CHARACTER SET utf8); +INSERT INTO t1 VALUES ('b'); +INSERT INTO t2 VALUES ('b'); +PREPARE stmt FROM 'SELECT STRAIGHT_JOIN 1 FROM t1 WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.b = t1.a)'; +EXECUTE stmt; +1 +1 +# Without the patch second execution of the prepared statement +# would lead to server crash. +EXECUTE stmt; +1 +1 +# Clean up +DEALLOCATE PREPARE stmt; +# Check that EXECUTE USING is run correctly +PREPARE stmt FROM 'SELECT 300 FROM t1 WHERE EXISTS (SELECT 100 FROM t2 WHERE t2.b = ?)'; +EXECUTE stmt USING 'b'; +300 +300 +EXECUTE stmt USING 'b'; +300 +300 +EXECUTE stmt USING 'd'; +300 +EXECUTE stmt USING 'd'; +300 +EXECUTE stmt USING _binary 'b'; +300 +300 +EXECUTE stmt USING _binary 'b'; +300 +300 +EXECUTE stmt USING _binary 'B'; +300 +300 +EXECUTE stmt USING 'B'; +300 +300 +EXECUTE stmt USING _binary 'd'; +300 +EXECUTE stmt USING _binary 'd'; +300 +EXECUTE stmt USING _ucs2 'b'; +300 +300 +EXECUTE stmt USING _ucs2 'b'; +300 +300 +EXECUTE stmt USING _ucs2 'd'; +300 +EXECUTE stmt USING _ucs2 'd'; +300 +EXECUTE stmt USING _latin1 'b'; +300 +300 +EXECUTE stmt USING _latin1 'b'; +300 +300 +EXECUTE stmt USING _latin1 'd'; +300 +EXECUTE stmt USING _latin1 'd'; +300 +CREATE TABLE t3 (c VARCHAR(10) CHARACTER SET ucs2); +INSERT INTO t3 VALUES ('b'); +PREPARE stmt FROM 'SELECT 300 FROM t1 WHERE EXISTS (SELECT 100 FROM t3 WHERE t3.c = ?)'; +EXECUTE stmt USING 'b'; +300 +300 +EXECUTE stmt USING 'b'; +300 +300 +EXECUTE stmt USING 'd'; +300 +EXECUTE stmt USING 'd'; +300 +DROP TABLE t1, t2, t3; +set @@max_session_mem_used=default; +create table t (a varchar(10)) character set utf8; +insert into t values (''); +prepare stmt from "select 1 from t where a = ?"; +set @@max_session_mem_used=(select memory_used*2 from information_schema.processlist where id=connection_id()); +deallocate prepare stmt; +drop table t; +set @@max_session_mem_used=default; +create table t (a varchar(10)) character set utf8; +insert into t values (''); +prepare stmt from "select 1 from t where a = 'a'"; +set @@max_session_mem_used=(select memory_used*2 from information_schema.processlist where id=connection_id()); +deallocate prepare stmt; +drop table t; +set @@max_session_mem_used=default; +# +# End of 10.3 tests +# +# # MDEV-19263: Server crashes in mysql_handle_single_derived # upon 2nd execution of PS # @@ -5640,5 +5782,18 @@ connection default; SET GLOBAL disconnect_on_expired_password=@disconnect_on_expired_password_save; DROP USER user1@localhost; # +# MDEV-21173: Assertion `m_thd == __null' failed in sp_head::~sp_head +# +CREATE TABLE t1 (a INT); +EXECUTE IMMEDIATE "CREATE PROCEDURE p1() SELECT 1 FROM t1 PROCEDURE ANALYSE( 10, (SELECT a FROM t1));"; +ERROR 42000: PROCEDURE does not support subqueries or stored functions +DROP TABLE t1; +BEGIN NOT ATOMIC +PREPARE stmt FROM 'SELECT ?'; +EXECUTE stmt USING ((SELECT 1)); +END; +$ +ERROR 42000: EXECUTE..USING does not support subqueries or stored functions +# # End of 10.4 tests # diff --git a/mysql-test/main/ps.test b/mysql-test/main/ps.test index c4ec92540a2a3..bb6ce7d4048b3 100644 --- a/mysql-test/main/ps.test +++ b/mysql-test/main/ps.test @@ -5006,6 +5006,19 @@ DEALLOCATE PREPARE stmt; DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # MDEV-19631: Assertion `0' failed in st_select_lex_unit::optimize or +--echo # different plan upon 2nd execution of PS with EXPLAIN +--echo # +CREATE TABLE t1 (a INT); +PREPARE stmt FROM 'EXPLAIN SELECT * FROM t1 HAVING 6 IN ( SELECT 6 UNION SELECT 5 )'; +EXECUTE stmt; +--echo # Without the patch the second execution of the 'stmt' prepared statement +--echo # would result in server crash. +EXECUTE stmt; +# Cleanup +DEALLOCATE PREPARE stmt; +DROP TABLE t1; --echo # End of 10.2 tests --echo # @@ -5026,6 +5039,116 @@ DEALLOCATE PREPARE stmt; DROP PROCEDURE p1; +--echo # +--echo # MDEV-16128: Server crash in Item_func::print_op on 2nd execution of PS +--echo # + +CREATE TABLE t1 (a varchar(10)); +CREATE TABLE t2 (b varchar(10) CHARACTER SET utf8 ); +CREATE TABLE t3 (c varchar(10) CHARACTER SET utf8); +INSERT INTO t1 VALUES ('b'); +INSERT INTO t2 VALUES ('b'); +INSERT INTO t3 VALUES ('b'); + +PREPARE stmt FROM "SELECT t1.* FROM (t1 JOIN t2 ON (t2.b = t1.a)) WHERE (EXISTS (SELECT 1 FROM t3 WHERE t3.c = t1.a))"; +EXECUTE stmt; +--echo # Without the patch second execution of the prepared statement +--echo # would lead to server crash. +EXECUTE stmt; +--echo # Clean up +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2, t3; + +CREATE TABLE t1 (a varchar(10)); +CREATE TABLE t2 (b varchar(10) CHARACTER SET utf8); +INSERT INTO t1 VALUES ('b'); +INSERT INTO t2 VALUES ('b'); +PREPARE stmt FROM 'SELECT STRAIGHT_JOIN 1 FROM t1 WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.b = t1.a)'; +EXECUTE stmt; +--echo # Without the patch second execution of the prepared statement +--echo # would lead to server crash. +EXECUTE stmt; + +--echo # Clean up +DEALLOCATE PREPARE stmt; + +--echo # Check that EXECUTE USING is run correctly +PREPARE stmt FROM 'SELECT 300 FROM t1 WHERE EXISTS (SELECT 100 FROM t2 WHERE t2.b = ?)'; +EXECUTE stmt USING 'b'; +EXECUTE stmt USING 'b'; + +EXECUTE stmt USING 'd'; +EXECUTE stmt USING 'd'; + +EXECUTE stmt USING _binary 'b'; +EXECUTE stmt USING _binary 'b'; + +EXECUTE stmt USING _binary 'B'; +EXECUTE stmt USING 'B'; + +EXECUTE stmt USING _binary 'd'; +EXECUTE stmt USING _binary 'd'; + +EXECUTE stmt USING _ucs2 'b'; +EXECUTE stmt USING _ucs2 'b'; + +EXECUTE stmt USING _ucs2 'd'; +EXECUTE stmt USING _ucs2 'd'; + +EXECUTE stmt USING _latin1 'b'; +EXECUTE stmt USING _latin1 'b'; + +EXECUTE stmt USING _latin1 'd'; +EXECUTE stmt USING _latin1 'd'; + +CREATE TABLE t3 (c VARCHAR(10) CHARACTER SET ucs2); +INSERT INTO t3 VALUES ('b'); +PREPARE stmt FROM 'SELECT 300 FROM t1 WHERE EXISTS (SELECT 100 FROM t3 WHERE t3.c = ?)'; +EXECUTE stmt USING 'b'; +EXECUTE stmt USING 'b'; +EXECUTE stmt USING 'd'; +EXECUTE stmt USING 'd'; +DROP TABLE t1, t2, t3; + +set @@max_session_mem_used=default; +create table t (a varchar(10)) character set utf8; +insert into t values (''); +prepare stmt from "select 1 from t where a = ?"; +set @@max_session_mem_used=(select memory_used*2 from information_schema.processlist where id=connection_id()); +let $run= 1000; +disable_result_log; +disable_query_log; +while ($run) { + execute stmt using repeat('x',10000); + dec $run; +} +enable_result_log; +enable_query_log; +deallocate prepare stmt; +drop table t; +set @@max_session_mem_used=default; + +create table t (a varchar(10)) character set utf8; +insert into t values (''); +prepare stmt from "select 1 from t where a = 'a'"; +set @@max_session_mem_used=(select memory_used*2 from information_schema.processlist where id=connection_id()); +let $run= 1000; +disable_result_log; +disable_query_log; +while ($run) { + execute stmt; + dec $run; +} +enable_result_log; +enable_query_log; +deallocate prepare stmt; +drop table t; +set @@max_session_mem_used=default; + +--echo # +--echo # End of 10.3 tests +--echo # + --echo # --echo # MDEV-19263: Server crashes in mysql_handle_single_derived --echo # upon 2nd execution of PS @@ -5083,6 +5206,25 @@ connection default; SET GLOBAL disconnect_on_expired_password=@disconnect_on_expired_password_save; DROP USER user1@localhost; +--echo # +--echo # MDEV-21173: Assertion `m_thd == __null' failed in sp_head::~sp_head +--echo # +CREATE TABLE t1 (a INT); + +--error ER_SUBQUERIES_NOT_SUPPORTED +EXECUTE IMMEDIATE "CREATE PROCEDURE p1() SELECT 1 FROM t1 PROCEDURE ANALYSE( 10, (SELECT a FROM t1));"; +DROP TABLE t1; + +delimiter $; +--error ER_SUBQUERIES_NOT_SUPPORTED +BEGIN NOT ATOMIC + PREPARE stmt FROM 'SELECT ?'; + EXECUTE stmt USING ((SELECT 1)); +END; +$ + +delimiter ;$ + --echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/ps_1general.result b/mysql-test/main/ps_1general.result index 05a40f54a5255..ca2447b6b2618 100644 --- a/mysql-test/main/ps_1general.result +++ b/mysql-test/main/ps_1general.result @@ -283,8 +283,8 @@ SET @arg00=1; execute stmt4 using @arg00; Field Type Null Key Default Extra Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' prepare stmt4 from ' show columns from t2 from test like ''a%'' '; execute stmt4; Field Type Null Key Default Extra diff --git a/mysql-test/main/ps_1general.test b/mysql-test/main/ps_1general.test index b0f408e3bcf15..20f2ad019f4e3 100644 --- a/mysql-test/main/ps_1general.test +++ b/mysql-test/main/ps_1general.test @@ -462,7 +462,9 @@ prepare stmt1 from ' handler t1 open '; prepare stmt3 from ' commit ' ; prepare stmt3 from ' rollback ' ; - +# the view protocol has to use the same connection, +# not util connection +--disable_service_connection ## switch the sql_mode prepare stmt4 from ' SET sql_mode=ansi '; execute stmt4; @@ -479,6 +481,7 @@ execute stmt5; SET sql_mode=ansi; execute stmt5; SET sql_mode=""; +--enable_service_connection prepare stmt1 from ' flush local privileges ' ; prepare stmt1 from ' reset query cache ' ; diff --git a/mysql-test/main/ps_2myisam.result b/mysql-test/main/ps_2myisam.result index c85abaad05193..256665ce4cbb7 100644 --- a/mysql-test/main/ps_2myisam.result +++ b/mysql-test/main/ps_2myisam.result @@ -1805,7 +1805,7 @@ t5 CREATE TABLE `t5` ( `param13` decimal(65,38) DEFAULT NULL, `param14` longtext DEFAULT NULL, `param15` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def test t5 t5 const01 const01 3 1 1 N 36865 0 63 diff --git a/mysql-test/main/ps_3innodb.result b/mysql-test/main/ps_3innodb.result index 53f736f41a303..675587e020a02 100644 --- a/mysql-test/main/ps_3innodb.result +++ b/mysql-test/main/ps_3innodb.result @@ -1788,7 +1788,7 @@ t5 CREATE TABLE `t5` ( `param13` decimal(65,38) DEFAULT NULL, `param14` longtext DEFAULT NULL, `param15` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def test t5 t5 const01 const01 3 1 1 N 36865 0 63 diff --git a/mysql-test/main/ps_4heap.result b/mysql-test/main/ps_4heap.result index 0cf1ed13cba68..dcde7613bfe49 100644 --- a/mysql-test/main/ps_4heap.result +++ b/mysql-test/main/ps_4heap.result @@ -1789,7 +1789,7 @@ t5 CREATE TABLE `t5` ( `param13` decimal(65,38) DEFAULT NULL, `param14` longtext DEFAULT NULL, `param15` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def test t5 t5 const01 const01 3 1 1 N 36865 0 63 diff --git a/mysql-test/main/ps_5merge.result b/mysql-test/main/ps_5merge.result index 49155394e2ab3..c9d33dbb1ae7d 100644 --- a/mysql-test/main/ps_5merge.result +++ b/mysql-test/main/ps_5merge.result @@ -1726,7 +1726,7 @@ t5 CREATE TABLE `t5` ( `param13` decimal(65,38) DEFAULT NULL, `param14` longtext DEFAULT NULL, `param15` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def test t5 t5 const01 const01 3 1 1 N 36865 0 63 @@ -5094,7 +5094,7 @@ t5 CREATE TABLE `t5` ( `param13` decimal(65,38) DEFAULT NULL, `param14` longtext DEFAULT NULL, `param15` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def test t5 t5 const01 const01 3 1 1 N 36865 0 63 diff --git a/mysql-test/main/ps_ddl.result b/mysql-test/main/ps_ddl.result index d99aeb0fa543d..dcbb698270226 100644 --- a/mysql-test/main/ps_ddl.result +++ b/mysql-test/main/ps_ddl.result @@ -216,7 +216,7 @@ new trigger: 10 drop trigger t1_bd; set @val=11; execute stmt using @val; -call p_verify_reprepare_count(1); +call p_verify_reprepare_count(0); SUCCESS select @message; @@ -226,7 +226,7 @@ Test 6-e: removing a relevant trigger drop trigger t1_bi; set @val=12; execute stmt using @val; -call p_verify_reprepare_count(1); +call p_verify_reprepare_count(0); SUCCESS select @message; @@ -386,7 +386,7 @@ a flush table t1; set @var=9; execute stmt using @var; -call p_verify_reprepare_count(1); +call p_verify_reprepare_count(0); SUCCESS select * from t2; @@ -834,7 +834,7 @@ a b c 10 20 50 20 40 100 30 60 150 -call p_verify_reprepare_count(1); +call p_verify_reprepare_count(0); SUCCESS # Check that we properly handle ALTER VIEW statements. @@ -1214,7 +1214,7 @@ drop trigger v2_bi; set @message=null; set @var=9; execute stmt using @var; -call p_verify_reprepare_count(1); +call p_verify_reprepare_count(0); SUCCESS select @message; @@ -2588,7 +2588,7 @@ SELECT * FROM t1; a 2048 1025 -1024 +2048 DROP TABLE t1; # # End of 10.1 tests diff --git a/mysql-test/main/ps_ddl.test b/mysql-test/main/ps_ddl.test index 8d811ec00c026..e12fb11d50f1e 100644 --- a/mysql-test/main/ps_ddl.test +++ b/mysql-test/main/ps_ddl.test @@ -252,7 +252,8 @@ drop trigger t1_bd; set @val=11; execute stmt using @val; -call p_verify_reprepare_count(1); +# No trigger in opened table => nothing to check => no reprepare +call p_verify_reprepare_count(0); select @message; --echo Test 6-e: removing a relevant trigger @@ -261,7 +262,8 @@ drop trigger t1_bi; set @val=12; execute stmt using @val; -call p_verify_reprepare_count(1); +# No trigger in opened table => nothing to check => no reprepare +call p_verify_reprepare_count(0); select @message; set @val=13; execute stmt using @val; @@ -376,7 +378,8 @@ select * from t3; flush table t1; set @var=9; execute stmt using @var; -call p_verify_reprepare_count(1); +# flush tables now do not mean reprepare +call p_verify_reprepare_count(0); select * from t2; select * from t3; drop view v1; @@ -745,7 +748,7 @@ call p_verify_reprepare_count(1); flush table t2; execute stmt; -call p_verify_reprepare_count(1); +call p_verify_reprepare_count(0); --echo # Check that we properly handle ALTER VIEW statements. execute stmt; @@ -973,7 +976,8 @@ drop trigger v2_bi; set @message=null; set @var=9; execute stmt using @var; -call p_verify_reprepare_count(1); +# No trigger in opened table => nothing to check => no reprepare +call p_verify_reprepare_count(0); select @message; create trigger v2_bi after insert on v2 for each row set @message="v2_ai"; set @var= 10; @@ -1674,6 +1678,8 @@ drop table t1; deallocate prepare stmt; create table t1 (a int); insert into t1 (a) values (1); +#t2-temporary table, cannot create a temporary view +--disable_view_protocol prepare stmt from "create temporary table if not exists t2 as select * from t1"; execute stmt; drop table t2; @@ -1700,6 +1706,7 @@ drop table t1; drop temporary table t2; drop table t2; deallocate prepare stmt; +--enable_view_protocol create table t1 (a int); prepare stmt from "create table t2 like t1"; diff --git a/mysql-test/main/ps_grant.result b/mysql-test/main/ps_grant.result index c9ef089b215b7..a0a05a231cd24 100644 --- a/mysql-test/main/ps_grant.result +++ b/mysql-test/main/ps_grant.result @@ -28,7 +28,7 @@ execute s_t9 ; my_col 1 select a as my_col from t1; -ERROR 42000: SELECT command denied to user 'second_user'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'second_user'@'localhost' for table `mysqltest`.`t1` connection default; grant select on mysqltest.t1 to second_user@localhost identified by 'looser' ; @@ -71,7 +71,7 @@ Grants for second_user@localhost GRANT SELECT ON `mysqltest`.`t9` TO `second_user`@`localhost` GRANT USAGE ON *.* TO `second_user`@`localhost` IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3' execute s_t1 ; -ERROR 42000: SELECT command denied to user 'second_user'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'second_user'@'localhost' for table `mysqltest`.`t1` connection default; disconnect con3; revoke all privileges, grant option from second_user@localhost ; diff --git a/mysql-test/main/ps_innodb.result b/mysql-test/main/ps_innodb.result index 4a5819e40727b..2b9ec621f0f06 100644 --- a/mysql-test/main/ps_innodb.result +++ b/mysql-test/main/ps_innodb.result @@ -7,15 +7,15 @@ set sql_mode='STRICT_TRANS_TABLES'; CREATE TABLE t1 (id int, count int) engine=innodb; insert into t1 values (1,1),(0,2); update t1 set count = count + 1 where id = '1bad'; -ERROR 22007: Truncated incorrect DOUBLE value: '1bad' +ERROR 22007: Truncated incorrect DECIMAL value: '1bad' prepare stmt from "update t1 set count = count + 1 where id = '1bad'"; execute stmt; -ERROR 22007: Truncated incorrect DOUBLE value: '1bad' +ERROR 22007: Truncated incorrect DECIMAL value: '1bad' deallocate prepare stmt; prepare stmt from 'update t1 set count = count + 1 where id = ?'; set @a = '1bad'; execute stmt using @a; -ERROR 22007: Truncated incorrect DOUBLE value: '1bad' +ERROR 22007: Truncated incorrect DECIMAL value: '1bad' deallocate prepare stmt; drop table t1; CREATE TABLE t1 (id decimal(10,5), count int) engine=innodb; diff --git a/mysql-test/main/ps_missed_cmds.result b/mysql-test/main/ps_missed_cmds.result index ce3b6acc8985c..bde750434b3fe 100644 --- a/mysql-test/main/ps_missed_cmds.result +++ b/mysql-test/main/ps_missed_cmds.result @@ -242,268 +242,18 @@ DEALLOCATE PREPARE stmt_4; DROP TABLE t1; # Test case 10: Check that the HELP statement # is supported by prepared statements -PREPARE stmt_1 FROM "HELP `UPDATE`"; +INSERT INTO mysql.help_topic VALUES (0, 'Tamagotchi', 0, 'This digital pet is not a KB article', 'no example', 'https://tamagotchi.com/'); +PREPARE stmt_1 FROM "HELP `Tamagotchi`"; EXECUTE stmt_1; name description example -UPDATE Syntax ------- -Single-table syntax: - -UPDATE [LOW_PRIORITY] [IGNORE] table_reference - [PARTITION (partition_list)] - SET col1={expr1|DEFAULT} [,col2={expr2|DEFAULT}] ... - [WHERE where_condition] - [ORDER BY ...] - [LIMIT row_count] - -Multiple-table syntax: - -UPDATE [LOW_PRIORITY] [IGNORE] table_references - SET col1={expr1|DEFAULT} [, col2={expr2|DEFAULT}] ... - [WHERE where_condition] - -Description ------------ -For the single-table syntax, the UPDATE statement updates -columns of existing rows in the named table with new values. -The -SET clause indicates which columns to modify and the values -they should be given. Each value can be given as an -expression, or the keyword -DEFAULT to set a column explicitly to its default value. The -WHERE clause, if given, specifies the conditions that -identify -which rows to update. With no WHERE clause, all rows are -updated. If the ORDER BY clause is specified, the rows are -updated in the order that is specified. The LIMIT clause -places a limit on the number of rows that can be updated. - -The PARTITION clause was introduced in MariaDB 10.0. See -Partition Pruning and Selection for details. - -Until MariaDB 10.3.2, for the multiple-table syntax, UPDATE -updates rows in each -table named in table_references that satisfy the conditions. -In this case, -ORDER BY and LIMIT cannot be used. This restriction was -lifted in MariaDB 10.3.2 and both clauses can be used with -multiple-table updates. An UPDATE can also reference tables -which are located in different databases; see Identifier -Qualifiers for the syntax. - -where_condition is an expression that evaluates to true for -each row to be updated. - -table_references and where_condition are as -specified as described in SELECT. - -Assignments are evaluated in left-to-right order, unless the -SIMULTANEOUS_ASSIGNMENT sql_mode (available from MariaDB -10.3.5) is set, in which case the UPDATE statement evaluates -all assignments simultaneously. - -You need the UPDATE privilege only for columns referenced in -an UPDATE that are actually updated. You need only the -SELECT privilege for any columns that are read but -not modified. See GRANT. - -The UPDATE statement supports the following modifiers: -If you use the LOW_PRIORITY keyword, execution of - the UPDATE is delayed until no other clients are reading -from - the table. This affects only storage engines that use only -table-level - locking (MyISAM, MEMORY, MERGE). See HIGH_PRIORITY and -LOW_PRIORITY clauses for details. -If you use the IGNORE keyword, the update statement does - not abort even if errors occur during the update. Rows for -which - duplicate-key conflicts occur are not updated. Rows for -which columns are - updated to values that would cause data conversion errors -are updated to the - closest valid values instead. - -UPDATE Statements With the Same Source and Target - -From MariaDB 10.3.2, UPDATE statements may have the same -source and target. - -For example, given the following table: - -DROP TABLE t1; - -CREATE TABLE t1 (c1 INT, c2 INT); -INSERT INTO t1 VALUES (10,10), (20,20); - -Until MariaDB 10.3.1, the following UPDATE statement would -not work: - -UPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1); -ERROR 1093 (HY000): Table 't1' is specified twice, - both as a target for 'UPDATE' and as a separate source -for data - -From MariaDB 10.3.2, the statement executes successfully: - -UPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1); - -SELECT * FROM t1; - -+------+------+ -| c1 | c2 | -+------+------+ -| 10 | 10 | -| 21 | 20 | -+------+------+ - -Example - -Single-table syntax: - -UPDATE table_name SET column1 = value1, column2 = value2 -WHERE id=100; - -Multiple-table syntax: - -UPDATE tab1, tab2 SET tab1.column1 = value1, tab1.column2 = -value2 WHERE tab1.id = tab2.id; - - - -URL: https://mariadb.com/kb/en/library/update/ +Tamagotchi This digital pet is not a KB article no example # Execute the same prepared statement the second time to check that # no internal structures used for handling the 'HELP' statement # were damaged. EXECUTE stmt_1; name description example -UPDATE Syntax ------- -Single-table syntax: - -UPDATE [LOW_PRIORITY] [IGNORE] table_reference - [PARTITION (partition_list)] - SET col1={expr1|DEFAULT} [,col2={expr2|DEFAULT}] ... - [WHERE where_condition] - [ORDER BY ...] - [LIMIT row_count] - -Multiple-table syntax: - -UPDATE [LOW_PRIORITY] [IGNORE] table_references - SET col1={expr1|DEFAULT} [, col2={expr2|DEFAULT}] ... - [WHERE where_condition] - -Description ------------ -For the single-table syntax, the UPDATE statement updates -columns of existing rows in the named table with new values. -The -SET clause indicates which columns to modify and the values -they should be given. Each value can be given as an -expression, or the keyword -DEFAULT to set a column explicitly to its default value. The -WHERE clause, if given, specifies the conditions that -identify -which rows to update. With no WHERE clause, all rows are -updated. If the ORDER BY clause is specified, the rows are -updated in the order that is specified. The LIMIT clause -places a limit on the number of rows that can be updated. - -The PARTITION clause was introduced in MariaDB 10.0. See -Partition Pruning and Selection for details. - -Until MariaDB 10.3.2, for the multiple-table syntax, UPDATE -updates rows in each -table named in table_references that satisfy the conditions. -In this case, -ORDER BY and LIMIT cannot be used. This restriction was -lifted in MariaDB 10.3.2 and both clauses can be used with -multiple-table updates. An UPDATE can also reference tables -which are located in different databases; see Identifier -Qualifiers for the syntax. - -where_condition is an expression that evaluates to true for -each row to be updated. - -table_references and where_condition are as -specified as described in SELECT. - -Assignments are evaluated in left-to-right order, unless the -SIMULTANEOUS_ASSIGNMENT sql_mode (available from MariaDB -10.3.5) is set, in which case the UPDATE statement evaluates -all assignments simultaneously. - -You need the UPDATE privilege only for columns referenced in -an UPDATE that are actually updated. You need only the -SELECT privilege for any columns that are read but -not modified. See GRANT. - -The UPDATE statement supports the following modifiers: -If you use the LOW_PRIORITY keyword, execution of - the UPDATE is delayed until no other clients are reading -from - the table. This affects only storage engines that use only -table-level - locking (MyISAM, MEMORY, MERGE). See HIGH_PRIORITY and -LOW_PRIORITY clauses for details. -If you use the IGNORE keyword, the update statement does - not abort even if errors occur during the update. Rows for -which - duplicate-key conflicts occur are not updated. Rows for -which columns are - updated to values that would cause data conversion errors -are updated to the - closest valid values instead. - -UPDATE Statements With the Same Source and Target - -From MariaDB 10.3.2, UPDATE statements may have the same -source and target. - -For example, given the following table: - -DROP TABLE t1; - -CREATE TABLE t1 (c1 INT, c2 INT); -INSERT INTO t1 VALUES (10,10), (20,20); - -Until MariaDB 10.3.1, the following UPDATE statement would -not work: - -UPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1); -ERROR 1093 (HY000): Table 't1' is specified twice, - both as a target for 'UPDATE' and as a separate source -for data - -From MariaDB 10.3.2, the statement executes successfully: - -UPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1); - -SELECT * FROM t1; - -+------+------+ -| c1 | c2 | -+------+------+ -| 10 | 10 | -| 21 | 20 | -+------+------+ - -Example - -Single-table syntax: - -UPDATE table_name SET column1 = value1, column2 = value2 -WHERE id=100; - -Multiple-table syntax: - -UPDATE tab1, tab2 SET tab1.column1 = value1, tab1.column2 = -value2 WHERE tab1.id = tab2.id; - - - -URL: https://mariadb.com/kb/en/library/update/ +Tamagotchi This digital pet is not a KB article no example +DELETE FROM mysql.help_topic WHERE help_topic_id = 0; # Test case 11: Check that the 'CREATE PROCEDURE' statement # is supported by prepared statements PREPARE stmt_1 FROM 'CREATE PROCEDURE p1() SET @a=1'; @@ -694,7 +444,7 @@ EXECUTE stmt_1; # results in emitting the error ER_FOREIGN_SERVER_EXISTS # since a server with same has just been created. EXECUTE stmt_1; -ERROR HY000: The foreign server, s, you are trying to create already exists +ERROR HY000: Cannot create foreign server 's' as it already exists EXECUTE stmt_2; # Execute the same prepared statement the second time to check that # no internal structures used for handling the 'ALTER SERVER' statement diff --git a/mysql-test/main/ps_missed_cmds.test b/mysql-test/main/ps_missed_cmds.test index 632457209f2eb..e8b4e263008e6 100644 --- a/mysql-test/main/ps_missed_cmds.test +++ b/mysql-test/main/ps_missed_cmds.test @@ -72,7 +72,7 @@ DROP TABLE t1; --echo # Test case 3: Check that the 'USE' statement is supported by --echo # prepared statements - +--disable_service_connection CREATE DATABASE mdev_16708_db; PREPARE stmt_1 FROM 'USE mdev_16708_db'; EXECUTE stmt_1; @@ -88,7 +88,7 @@ SELECT DATABASE(); DEALLOCATE PREPARE stmt_1; USE test; DROP DATABASE mdev_16708_db; - +--enable_service_connection --echo # Test case 4: Check that the 'ALTER DATABASE' statement is supported --echo # by prepared statements CREATE DATABASE mdev_16708_db; @@ -151,6 +151,7 @@ DROP TABLE t1; --echo # Test case 7: Check that the BEGIN/SAVEPOINT/RELEASE SAVEPOINT --echo # statements are supported by prepared statements +--disable_view_protocol --echo # Set up environmentr for the test case CREATE TABLE t1 (a INT); @@ -195,6 +196,7 @@ DEALLOCATE PREPARE stmt_1; DEALLOCATE PREPARE stmt_2; DEALLOCATE PREPARE stmt_3; DROP TABLE t1; +--enable_view_protocol --echo # Test case 8: Check that the 'PURGE BINARY LOGS BEFORE' statement --echo # is supported by prepared statements @@ -267,13 +269,16 @@ DROP TABLE t1; --echo # Test case 10: Check that the HELP statement --echo # is supported by prepared statements -PREPARE stmt_1 FROM "HELP `UPDATE`"; +# avoid existing articles that may get updated. +INSERT INTO mysql.help_topic VALUES (0, 'Tamagotchi', 0, 'This digital pet is not a KB article', 'no example', 'https://tamagotchi.com/'); +PREPARE stmt_1 FROM "HELP `Tamagotchi`"; EXECUTE stmt_1; --echo # Execute the same prepared statement the second time to check that --echo # no internal structures used for handling the 'HELP' statement --echo # were damaged. EXECUTE stmt_1; +DELETE FROM mysql.help_topic WHERE help_topic_id = 0; --echo # Test case 11: Check that the 'CREATE PROCEDURE' statement --echo # is supported by prepared statements diff --git a/mysql-test/main/ps_missed_cmds_bin_prot.result b/mysql-test/main/ps_missed_cmds_bin_prot.result index a56371565a6b8..adb6eda2c56af 100644 --- a/mysql-test/main/ps_missed_cmds_bin_prot.result +++ b/mysql-test/main/ps_missed_cmds_bin_prot.result @@ -104,28 +104,11 @@ HANDLER t1 CLOSE; DROP TABLE t1; # Test case 10: Check that the statements 'HELP' # is supported by prepared statements -HELP `ALTER SERVER`; +INSERT INTO mysql.help_topic VALUES (0, 'Tamagotchi', 0, 'This digital pet is not a KB article', 'no example', 'https://tamagotchi.com/'); +HELP `Tamagotchi`; name description example -ALTER SERVER Syntax ------- -ALTER SERVER server_name - OPTIONS (option [, option] ...) - -Description ------------ -Alters the server information for server_name, adjusting the -specified -options as per the CREATE SERVER command. The corresponding -fields in the mysql.servers table are updated accordingly. -This statement requires the SUPER privilege. - -Examples --------- -ALTER SERVER s OPTIONS (USER 'sally'); - - - -URL: https://mariadb.com/kb/en/library/alter-server/ +Tamagotchi This digital pet is not a KB article no example +DELETE FROM mysql.help_topic WHERE help_topic_id = 0; # Test case 11: Check that the statements CREATE/ALTER/DROP PROCEDURE # are supported by prepared statements CREATE PROCEDURE p1() SET @a=1; diff --git a/mysql-test/main/ps_missed_cmds_bin_prot.test b/mysql-test/main/ps_missed_cmds_bin_prot.test index f10ee9a3b550d..44db51926297b 100644 --- a/mysql-test/main/ps_missed_cmds_bin_prot.test +++ b/mysql-test/main/ps_missed_cmds_bin_prot.test @@ -128,7 +128,10 @@ DROP TABLE t1; --echo # Test case 10: Check that the statements 'HELP' --echo # is supported by prepared statements -HELP `ALTER SERVER`; +# avoid existing articles that may get updated. +INSERT INTO mysql.help_topic VALUES (0, 'Tamagotchi', 0, 'This digital pet is not a KB article', 'no example', 'https://tamagotchi.com/'); +HELP `Tamagotchi`; +DELETE FROM mysql.help_topic WHERE help_topic_id = 0; --echo # Test case 11: Check that the statements CREATE/ALTER/DROP PROCEDURE --echo # are supported by prepared statements diff --git a/mysql-test/main/query_cache.test b/mysql-test/main/query_cache.test index f8152945396b6..f3c8093d41b19 100644 --- a/mysql-test/main/query_cache.test +++ b/mysql-test/main/query_cache.test @@ -1,5 +1,7 @@ -- source include/have_query_cache.inc -- source include/long_test.inc +-- source include/no_valgrind_without_big.inc +-- source include/no_view_protocol.inc set @save_query_cache_size=@@query_cache_size; # diff --git a/mysql-test/main/query_cache_debug.test b/mysql-test/main/query_cache_debug.test index 90b76077cac3f..5942e6f42aaf8 100644 --- a/mysql-test/main/query_cache_debug.test +++ b/mysql-test/main/query_cache_debug.test @@ -2,6 +2,7 @@ --source include/have_query_cache.inc --source include/have_debug_sync.inc --source include/long_test.inc +--source include/no_valgrind_without_big.inc set global query_cache_type= ON; set @save_query_cache_size=@@global.query_cache_size; @@ -55,6 +56,7 @@ drop table t1; # # Bug#41098: Query Cache returns wrong result with concurrent insert # +--disable_view_protocol --disable_warnings DROP TABLE IF EXISTS t1, t2; @@ -106,7 +108,7 @@ DROP TABLE t1,t2; SET GLOBAL concurrent_insert= DEFAULT; SET GLOBAL query_cache_size= DEFAULT; SET GLOBAL query_cache_type= DEFAULT; - +--enable_view_protocol --echo # --echo # Bug43758 Query cache can lock up threads in 'freeing items' state @@ -197,8 +199,17 @@ SET DEBUG_SYNC="now WAIT_FOR parked1_2"; --echo ** and finally release the mutex. The threads will continue to wait --echo ** until a broadcast signal reaches them causing both threads to --echo ** come alive and check the condition. + +# Before sending signals back-to-back, we have to ensure the previous signal +# was received +let $wait_condition= select count(*)=3 from information_schema.processlist where state like "%debug%"; +source include/wait_condition.inc; SET DEBUG_SYNC="now SIGNAL go2"; +let $wait_condition= select count(*)=2 from information_schema.processlist where state like "%debug%"; +source include/wait_condition.inc; SET DEBUG_SYNC="now SIGNAL go3"; +let $wait_condition= select count(*)=1 from information_schema.processlist where state like "%debug%"; +source include/wait_condition.inc; --echo ** --echo ** Finally signal the DELETE statement on THD1 one last time. @@ -208,6 +219,8 @@ SET DEBUG_SYNC="now SIGNAL go3"; --echo ** invalidations and a broadcast signal will be sent to the thread --echo ** group holding result set writers. SET DEBUG_SYNC="now SIGNAL go1_2"; +let $wait_condition= select count(*)=0 from information_schema.processlist where state like "%debug%"; +source include/wait_condition.inc; --echo ** --echo ************************************************************************* diff --git a/mysql-test/main/query_cache_innodb.test b/mysql-test/main/query_cache_innodb.test index 72ae891e33180..7ac96220c11ab 100644 --- a/mysql-test/main/query_cache_innodb.test +++ b/mysql-test/main/query_cache_innodb.test @@ -17,7 +17,7 @@ set query_cache_type=1; create table t1 ( id int unsigned auto_increment, primary key(id) ) engine=innodb; create table t2 ( t2id int unsigned, id int unsigned, primary key(t2id, id), foreign key (`id`) references t1(`id`) on delete cascade ) engine=innodb; - +--disable_view_protocol insert into t1 values (1); insert into t2 values (1,1); select * from t2; @@ -26,6 +26,7 @@ show status like "Qcache_queries_in_cache"; delete from t1; show status like "Qcache_queries_in_cache"; select * from t2; +--enable_view_protocol optimize table t2; select * from t2; diff --git a/mysql-test/main/query_cache_merge.test b/mysql-test/main/query_cache_merge.test index 6212ff624e0cb..9b342d57a8e79 100644 --- a/mysql-test/main/query_cache_merge.test +++ b/mysql-test/main/query_cache_merge.test @@ -38,6 +38,7 @@ while ($1) # prepare and execute, and we will get a constant validation # error. See WL#4165 for details. # +--disable_view_protocol set @save_table_definition_cache= @@global.table_definition_cache; set @@global.table_definition_cache=512; create table t00 (a int) engine=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST; @@ -52,6 +53,7 @@ drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t2 SET @@global.query_cache_size=0; set @@global.table_definition_cache=@save_table_definition_cache; +--enable_view_protocol # End of 4.1 tests @@ -83,8 +85,10 @@ while ($c) eval CREATE TABLE t0 (a INT) ENGINE=MERGE UNION($str); SET GLOBAL query_cache_size = 1048576; FLUSH STATUS; +--disable_view_protocol SELECT a FROM t0 WHERE a = 1; SHOW STATUS LIKE "Qcache_queries_in_cache"; +--enable_view_protocol let $c= 255; let $i= 1; diff --git a/mysql-test/main/query_cache_notembedded.result b/mysql-test/main/query_cache_notembedded.result index 29a091b68c198..3477161e9cf5e 100644 --- a/mysql-test/main/query_cache_notembedded.result +++ b/mysql-test/main/query_cache_notembedded.result @@ -462,6 +462,27 @@ flush query cache| delete from t1| drop procedure bug3583| drop table t1| +# +# MDEV-29760 DROP DATABASE hangs when particular query cache is present +# +create table t1 (id int); +create table t2 like t1; +create table t3 like t1; +create database d; +create table d.t1 like test.t1; +create table d.t2 like test.t2; +set LOCAL query_cache_type=ON; +select id from t3; +id +select 'x' a, 'y' b from d.t1; +a b +select 'x' a, 'y' b from d.t1, d.t2; +a b +drop database d; +drop table t1, t2, t3; +# +# End of 10.5 tests +# SET GLOBAL query_cache_size=@query_cache_size_save; SET GLOBAL query_cache_type=@query_cache_type_save; set GLOBAL sql_mode=@sql_mode_save; diff --git a/mysql-test/main/query_cache_notembedded.test b/mysql-test/main/query_cache_notembedded.test index 03c9d9e4cd4ff..83c7b1628e81b 100644 --- a/mysql-test/main/query_cache_notembedded.test +++ b/mysql-test/main/query_cache_notembedded.test @@ -325,6 +325,33 @@ drop procedure bug3583| drop table t1| delimiter ;| +--echo # +--echo # MDEV-29760 DROP DATABASE hangs when particular query cache is present +--echo # + +create table t1 (id int); +create table t2 like t1; +create table t3 like t1; + +create database d; + +create table d.t1 like test.t1; +create table d.t2 like test.t2; + +set LOCAL query_cache_type=ON; + +select id from t3; +select 'x' a, 'y' b from d.t1; +select 'x' a, 'y' b from d.t1, d.t2; + +drop database d; + +drop table t1, t2, t3; + +--echo # +--echo # End of 10.5 tests +--echo # + # Wait till we reached the initial number of concurrent sessions --source include/wait_until_count_sessions.inc SET GLOBAL query_cache_size=@query_cache_size_save; diff --git a/mysql-test/main/query_cache_with_views.test b/mysql-test/main/query_cache_with_views.test index c55327e3d0a27..e472a7dd47842 100644 --- a/mysql-test/main/query_cache_with_views.test +++ b/mysql-test/main/query_cache_with_views.test @@ -1,4 +1,5 @@ -- source include/have_query_cache.inc +-- source include/no_view_protocol.inc # # QUERY CACHE options for VIEWs # diff --git a/mysql-test/main/range.result b/mysql-test/main/range.result index 11bf47f45008c..6ff4f409666b4 100644 --- a/mysql-test/main/range.result +++ b/mysql-test/main/range.result @@ -281,7 +281,7 @@ INSERT INTO t1 VALUES (33,5),(33,5),(33,5),(33,5),(34,5),(35,5); EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref|filter a,b b|a 5|5 const 15 (5%) Using where; Using rowid filter +1 SIMPLE t1 range|filter a,b a|b 5|5 NULL 2 (41%) Using index condition; Using where; Using rowid filter SELECT * FROM t1 WHERE a IN(1,2) AND b=5; a b DROP TABLE t1; @@ -3697,6 +3697,36 @@ SELECT * FROM t1 LEFT JOIN t2 ON a = pk WHERE b >= 0 AND pk IS NULL; a pk b DROP TABLE t1, t2; SET @@optimizer_switch= @save_optimizer_switch; + +# MDEV-28858 Wrong result with table elimination combined with +# not_null_range_scan +# +CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10,1),(null,2); +CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(2); +SET @save_optimizer_switch= @@optimizer_switch; +SET optimizer_switch= 'not_null_range_scan=on'; +SELECT t1.b FROM t1 LEFT JOIN t2 ON t1.a = t2.pk WHERE t1.a IS NULL ORDER BY t1.b; +b +2 +SET optimizer_switch= 'not_null_range_scan=off'; +SELECT t1.b FROM t1 LEFT JOIN t2 ON t1.a = t2.pk WHERE t1.a IS NULL ORDER BY t1.b; +b +2 +SET @@optimizer_switch=@save_optimizer_switch; +drop table t1,t2; +# +# MDEV-30373 Wrong result with range access +# +CREATE TABLE t1 (pk int, a int, PRIMARY KEY (pk), KEY(a)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,3),(2,6),(3,9); +SELECT * FROM t1 WHERE a < 8 OR ( pk BETWEEN 1 AND 5 AND a BETWEEN 7 AND 10 ); +pk a +1 3 +2 6 +3 9 +DROP TABLE t1; # # End of 10.5 tests # diff --git a/mysql-test/main/range.test b/mysql-test/main/range.test index 6a2e318e7329d..c42670c1ed185 100644 --- a/mysql-test/main/range.test +++ b/mysql-test/main/range.test @@ -1,3 +1,4 @@ +--source include/no_valgrind_without_big.inc # # Problem with range optimizer # @@ -1252,14 +1253,23 @@ SELECT * FROM t1 WHERE a >= '2009:09:23 00:00:00'; --echo # The former may give errors for the truncated values, while the latter --echo # gives warnings. The purpose of this test is not to interfere, and only --echo # preserve existing behavior. + + +#view protocol generates additional warning +--disable_view_protocol + SELECT str_to_date('2007-10-00', '%Y-%m-%d') >= '' AND str_to_date('2007-10-00', '%Y-%m-%d') <= '2007/10/20'; SELECT str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND str_to_date('2007-20-00', '%Y-%m-%d') <= ''; +--enable_view_protocol +#enable after fix MDEV-27871 +--disable_view_protocol SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20'; SELECT str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND ''; +--enable_view_protocol SELECT str_to_date('', '%Y-%m-%d'); @@ -1662,6 +1672,8 @@ INSERT INTO t1 (fd) SELECT fd FROM t1; INSERT INTO t1 (fd) SELECT fd FROM t1; INSERT INTO t1 (fd) SELECT fd FROM t1; INSERT INTO t1 (fd) SELECT fd FROM t1; +#check after fix MDEV-29601 +--disable_service_connection --echo # The following should show "Impossible WHERE" : explain SELECT * FROM t1 WHERE fd='😁'; @@ -1672,6 +1684,7 @@ SELECT * FROM t1 WHERE fd='😁'; explain select count(*) from t1 where fd <'😁'; select count(*) from t1 where fd <'😁'; select count(*) from t1 ignore index (ix_fd) where fd <'😁'; +--enable_service_connection drop table t1; set names default; @@ -2492,6 +2505,33 @@ DROP TABLE t1, t2; SET @@optimizer_switch= @save_optimizer_switch; +--echo +--echo # MDEV-28858 Wrong result with table elimination combined with +--echo # not_null_range_scan +--echo # + +CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10,1),(null,2); +CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(2); + +SET @save_optimizer_switch= @@optimizer_switch; +SET optimizer_switch= 'not_null_range_scan=on'; +SELECT t1.b FROM t1 LEFT JOIN t2 ON t1.a = t2.pk WHERE t1.a IS NULL ORDER BY t1.b; +SET optimizer_switch= 'not_null_range_scan=off'; +SELECT t1.b FROM t1 LEFT JOIN t2 ON t1.a = t2.pk WHERE t1.a IS NULL ORDER BY t1.b; +SET @@optimizer_switch=@save_optimizer_switch; +drop table t1,t2; + +--echo # +--echo # MDEV-30373 Wrong result with range access +--echo # + +CREATE TABLE t1 (pk int, a int, PRIMARY KEY (pk), KEY(a)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,3),(2,6),(3,9); +SELECT * FROM t1 WHERE a < 8 OR ( pk BETWEEN 1 AND 5 AND a BETWEEN 7 AND 10 ); +DROP TABLE t1; + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/range_aria_dbt3.result b/mysql-test/main/range_aria_dbt3.result new file mode 100644 index 0000000000000..f08a1b244f834 --- /dev/null +++ b/mysql-test/main/range_aria_dbt3.result @@ -0,0 +1,25 @@ +set default_storage_engine=Aria; +CREATE DATABASE dbt3_s001; +use dbt3_s001; +# +# MDEV-30325 Wrong result upon range query using index condition +# +SELECT COUNT(*) FROM lineitem force index (i_l_orderkey_quantity,i_l_shipdate) WHERE l_shipdate < '1994-01-01' AND l_orderkey < 800 OR l_quantity > 3 AND l_orderkey NOT IN ( 157, 1444 ); +COUNT(*) +5658 +SELECT COUNT(*) FROM lineitem ignore index (i_l_orderkey_quantity,i_l_shipdate) WHERE l_shipdate < '1994-01-01' AND l_orderkey < 800 OR l_quantity > 3 AND l_orderkey NOT IN ( 157, 1444 ); +COUNT(*) +5658 +# +# MDEV-30373 Wrong result with range access +# +explain SELECT COUNT(*) FROM lineitem WHERE l_orderkey BETWEEN 111 AND 262 OR ( l_orderkey BETWEEN 152 AND 672 AND l_linenumber BETWEEN 4 AND 9 ); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem range PRIMARY,i_l_orderkey,i_l_orderkey_quantity PRIMARY 8 NULL 506 Using where; Using index +SELECT COUNT(*) FROM lineitem WHERE l_orderkey BETWEEN 111 AND 262 OR ( l_orderkey BETWEEN 152 AND 672 AND l_linenumber BETWEEN 4 AND 9 ); +COUNT(*) +293 +DROP DATABASE dbt3_s001; +# +# End of 10.5 tests +# diff --git a/mysql-test/main/range_aria_dbt3.test b/mysql-test/main/range_aria_dbt3.test new file mode 100644 index 0000000000000..141bf43885bac --- /dev/null +++ b/mysql-test/main/range_aria_dbt3.test @@ -0,0 +1,33 @@ +# +# This is generic tests using dbt3_s001 tables +# This file uses the Aria storage engine +# + +set default_storage_engine=Aria; + +CREATE DATABASE dbt3_s001; +use dbt3_s001; +--disable_query_log +--source include/dbt3_s001.inc +--enable_query_log + +--echo # +--echo # MDEV-30325 Wrong result upon range query using index condition +--echo # + +SELECT COUNT(*) FROM lineitem force index (i_l_orderkey_quantity,i_l_shipdate) WHERE l_shipdate < '1994-01-01' AND l_orderkey < 800 OR l_quantity > 3 AND l_orderkey NOT IN ( 157, 1444 ); +SELECT COUNT(*) FROM lineitem ignore index (i_l_orderkey_quantity,i_l_shipdate) WHERE l_shipdate < '1994-01-01' AND l_orderkey < 800 OR l_quantity > 3 AND l_orderkey NOT IN ( 157, 1444 ); + +--echo # +--echo # MDEV-30373 Wrong result with range access +--echo # + +explain SELECT COUNT(*) FROM lineitem WHERE l_orderkey BETWEEN 111 AND 262 OR ( l_orderkey BETWEEN 152 AND 672 AND l_linenumber BETWEEN 4 AND 9 ); + +SELECT COUNT(*) FROM lineitem WHERE l_orderkey BETWEEN 111 AND 262 OR ( l_orderkey BETWEEN 152 AND 672 AND l_linenumber BETWEEN 4 AND 9 ); + +DROP DATABASE dbt3_s001; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/main/range_innodb.result b/mysql-test/main/range_innodb.result index be7e89b9fd200..eddfbfd0d62dc 100644 --- a/mysql-test/main/range_innodb.result +++ b/mysql-test/main/range_innodb.result @@ -1,15 +1,11 @@ # # Range optimizer (and related) tests that need InnoDB. # -drop table if exists t0, t1, t2; # # MDEV-6735: Range checked for each record used with key # 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 + D.a * 1000 -from t0 A, t0 B, t0 C, t0 D; create table t2 ( a int, b int, @@ -22,12 +18,12 @@ key(b) ) engine=innodb; insert into t2 select -a,a, +seq,seq, repeat('0123456789', 10), repeat('0123456789', 10), repeat('0123456789', 10), repeat('0123456789', 10) -from t1; +from seq_0_to_9999; analyze table t2; Table Op Msg_type Msg_text test.t2 analyze status Engine-independent statistics collected @@ -37,20 +33,20 @@ explain select * from t0 left join t2 on t2.a = 4) LIMIT 2; +id p es er x +14645 foobar 4 4 0 +14646 foobar 4 4 0 +EXPLAIN EXTENDED SELECT * FROM t1 +WHERE ((p = 'foo' AND er != 4) OR er = 4 ) AND (es >= 4) LIMIT 2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range es,er,p es 1 NULL # 100.00 Using index condition; Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`p` AS `p`,`test`.`t1`.`es` AS `es`,`test`.`t1`.`er` AS `er`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`p` = 'foo' and `test`.`t1`.`er` <> 4 or `test`.`t1`.`er` = 4) and `test`.`t1`.`es` >= 4 limit 2 +set optimizer_switch='index_merge_sort_intersection=off'; +SELECT * FROM t1 +WHERE ((p = 'foo' AND er != 4) OR er = 4 ) AND (es >= 4) LIMIT 2; +id p es er x +14645 foobar 4 4 0 +14646 foobar 4 4 0 +EXPLAIN EXTENDED SELECT * FROM t1 +WHERE ((p = 'foo' AND er != 4) OR er = 4 ) AND (es >= 4) LIMIT 2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range es,er,p es 1 NULL # 100.00 Using index condition; Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`p` AS `p`,`test`.`t1`.`es` AS `es`,`test`.`t1`.`er` AS `er`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`p` = 'foo' and `test`.`t1`.`er` <> 4 or `test`.`t1`.`er` = 4) and `test`.`t1`.`es` >= 4 limit 2 +set optimizer_switch='index_merge_sort_intersection=on'; +SELECT * FROM t1 +WHERE ((p = 'foo' AND er < 6) OR er >=2 ) AND (es >= 4) LIMIT 2; +id p es er x +14007 foobar 4 2 0 +14008 foobar 4 2 0 +EXPLAIN EXTENDED SELECT * FROM t1 +WHERE ((p = 'foo' AND er < 6) OR er >=2 ) AND (es >= 4) LIMIT 2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range es,er,p es 1 NULL # 100.00 Using index condition; Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`p` AS `p`,`test`.`t1`.`es` AS `es`,`test`.`t1`.`er` AS `er`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`p` = 'foo' and `test`.`t1`.`er` < 6 or `test`.`t1`.`er` >= 2) and `test`.`t1`.`es` >= 4 limit 2 +set optimizer_switch='index_merge_sort_intersection=off'; +SELECT * FROM t1 +WHERE ((p = 'foo' AND er < 6) OR er >=2 ) AND (es >= 4) LIMIT 2; +id p es er x +14007 foobar 4 2 0 +14008 foobar 4 2 0 +EXPLAIN EXTENDED SELECT * FROM t1 +WHERE ((p = 'foo' AND er < 6) OR er >=2 ) AND (es >= 4) LIMIT 2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range es,er,p es 1 NULL # 100.00 Using index condition; Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`p` AS `p`,`test`.`t1`.`es` AS `es`,`test`.`t1`.`er` AS `er`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`p` = 'foo' and `test`.`t1`.`er` < 6 or `test`.`t1`.`er` >= 2) and `test`.`t1`.`es` >= 4 limit 2 +set optimizer_switch='index_merge_sort_intersection=default'; +set global innodb_stats_persistent= @save_isp; +DROP TABLE t1; +# End of 10.2 tests +# # MDEV-19634: Assertion `0' failed in row_sel_convert_mysql_key_to_innobase, # [Warning] InnoDB: Using a partial-field key prefix in search # diff --git a/mysql-test/main/range_innodb.test b/mysql-test/main/range_innodb.test index f79104fde85bd..276b9cea08f51 100644 --- a/mysql-test/main/range_innodb.test +++ b/mysql-test/main/range_innodb.test @@ -4,10 +4,8 @@ --source include/have_innodb.inc --source include/have_debug.inc - ---disable_warnings -drop table if exists t0, t1, t2; ---enable_warnings +--source include/have_sequence.inc +--source include/no_valgrind_without_big.inc --echo # --echo # MDEV-6735: Range checked for each record used with key @@ -16,10 +14,6 @@ drop table if exists t0, t1, t2; 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 + D.a * 1000 -from t0 A, t0 B, t0 C, t0 D; - create table t2 ( a int, b int, @@ -33,18 +27,18 @@ create table t2 ( insert into t2 select - a,a, + seq,seq, repeat('0123456789', 10), repeat('0123456789', 10), repeat('0123456789', 10), repeat('0123456789', 10) -from t1; +from seq_0_to_9999; analyze table t2; --echo # The following must not use "Range checked for each record": explain select * from t0 left join t2 on t2.a = 4) LIMIT 2; + +set optimizer_switch='index_merge_sort_intersection=on'; +eval $q; +--replace_column 9 # +eval EXPLAIN EXTENDED $q; + +set optimizer_switch='index_merge_sort_intersection=off'; +# execution of $q and explain for it led to an assertion failure in 10.4 +# (with the optimizer switch rowid_filter set to 'on') +eval $q; +--replace_column 9 # +eval EXPLAIN EXTENDED $q; + +let $q= +SELECT * FROM t1 + WHERE ((p = 'foo' AND er < 6) OR er >=2 ) AND (es >= 4) LIMIT 2; + +set optimizer_switch='index_merge_sort_intersection=on'; +eval $q; +--replace_column 9 # +eval EXPLAIN EXTENDED $q; + +set optimizer_switch='index_merge_sort_intersection=off'; +eval $q; +--replace_column 9 # +eval EXPLAIN EXTENDED $q; + +set optimizer_switch='index_merge_sort_intersection=default'; + +set global innodb_stats_persistent= @save_isp; +DROP TABLE t1; + +--echo # End of 10.2 tests + --echo # --echo # MDEV-19634: Assertion `0' failed in row_sel_convert_mysql_key_to_innobase, --echo # [Warning] InnoDB: Using a partial-field key prefix in search diff --git a/mysql-test/main/range_mrr_icp.result b/mysql-test/main/range_mrr_icp.result index 6da0fc9bd686b..c2c715a0a89d7 100644 --- a/mysql-test/main/range_mrr_icp.result +++ b/mysql-test/main/range_mrr_icp.result @@ -3686,6 +3686,36 @@ SELECT * FROM t1 LEFT JOIN t2 ON a = pk WHERE b >= 0 AND pk IS NULL; a pk b DROP TABLE t1, t2; SET @@optimizer_switch= @save_optimizer_switch; + +# MDEV-28858 Wrong result with table elimination combined with +# not_null_range_scan +# +CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10,1),(null,2); +CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(2); +SET @save_optimizer_switch= @@optimizer_switch; +SET optimizer_switch= 'not_null_range_scan=on'; +SELECT t1.b FROM t1 LEFT JOIN t2 ON t1.a = t2.pk WHERE t1.a IS NULL ORDER BY t1.b; +b +2 +SET optimizer_switch= 'not_null_range_scan=off'; +SELECT t1.b FROM t1 LEFT JOIN t2 ON t1.a = t2.pk WHERE t1.a IS NULL ORDER BY t1.b; +b +2 +SET @@optimizer_switch=@save_optimizer_switch; +drop table t1,t2; +# +# MDEV-30373 Wrong result with range access +# +CREATE TABLE t1 (pk int, a int, PRIMARY KEY (pk), KEY(a)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,3),(2,6),(3,9); +SELECT * FROM t1 WHERE a < 8 OR ( pk BETWEEN 1 AND 5 AND a BETWEEN 7 AND 10 ); +pk a +1 3 +2 6 +3 9 +DROP TABLE t1; # # End of 10.5 tests # diff --git a/mysql-test/main/range_notembedded.result b/mysql-test/main/range_notembedded.result index eeab230e72f7f..e1bcc7463d5d7 100644 --- a/mysql-test/main/range_notembedded.result +++ b/mysql-test/main/range_notembedded.result @@ -20,13 +20,11 @@ select json_detailed(JSON_EXTRACT(trace, '$**.ranges')) from information_schema.optimizer_trace; json_detailed(JSON_EXTRACT(trace, '$**.ranges')) [ - [ "(1) <= (key1) <= (1)", "(2) <= (key1) <= (2)", "(3) <= (key1) <= (3)" ], - [ "(1) <= (key1) <= (1)", "(2) <= (key1) <= (2)", @@ -71,9 +69,7 @@ from information_schema.optimizer_trace); select left(@json, 500); left(@json, 500) [ - [ - { "index": "key1", "ranges": @@ -85,7 +81,7 @@ left(@json, 500) "(1,1,5) <= (kp1,kp2,kp3) <= (1,1,5)", "(1,1,6) <= (kp1,kp2,kp3) <= (1,1,6)", "(1,1,7) <= (kp1,kp2,kp3) <= (1,1,7)", - " + "(1,1,8) <= (kp ## Repeat the above with low max_weight: set @tmp9750_weight=@@optimizer_max_sel_arg_weight; set optimizer_max_sel_arg_weight=20; @@ -102,9 +98,7 @@ set @json= json_detailed(json_extract(@trace, '$**.range_scan_alternatives')); select left(@json, 500); left(@json, 500) [ - [ - { "index": "key1", "ranges": @@ -119,14 +113,13 @@ left(@json, 500) "(8) <= (kp1) <= (8)", "(9) <= (kp1) <= (9)", "(10) <= (kp1) <= (10)" - + ], + set @json= json_detailed(json_extract(@trace, '$**.setup_range_conditions')); select left(@json, 2500); left(@json, 2500) [ - [ - { "sel_arg_weight_heuristic": { @@ -136,7 +129,6 @@ left(@json, 2500) "key2_weight": 10 } }, - { "sel_arg_weight_heuristic": { @@ -146,7 +138,6 @@ left(@json, 2500) "key2_weight": 10 } }, - { "sel_arg_weight_heuristic": { @@ -173,9 +164,7 @@ from information_schema.optimizer_trace); select left(@json, 1500); left(@json, 1500) [ - [ - { "index": "key1", "ranges": @@ -209,7 +198,8 @@ left(@json, 1500) "(3,7) <= (kp1,kp2) <= (3,7)", "(3,8) <= (kp1,kp2) <= (3,8)", "(3,9) <= (kp1,kp2) <= (3,9)", - "(3,10) <= (kp1,kp2 + "(3,10) <= (kp1,kp2) <= (3,10)", + set optimizer_max_sel_arg_weight= @tmp9750_weight; set optimizer_trace=@tmp_9750; drop table t1; @@ -248,3 +238,12 @@ WHERE (help_topic_id < '2' OR help_topic_id != 8 OR help_topic_id < 1) AND help_keyword_id = help_topic_id; help_topic_id help_keyword_id +# +# MDEV-29242: Assertion `computed_weight == weight' failed SEL_ARG::verify_weight +# +CREATE TABLE t1 (id INT, KEY (id)); +INSERT INTO t1 VALUES (1),(5); +SELECT id FROM t1 WHERE id IS NULL OR id NOT BETWEEN 1 AND 4; +id +5 +DROP TABLE t1; diff --git a/mysql-test/main/range_notembedded.test b/mysql-test/main/range_notembedded.test index 4e77d6a4810b4..00d16a5d56470 100644 --- a/mysql-test/main/range_notembedded.test +++ b/mysql-test/main/range_notembedded.test @@ -150,3 +150,12 @@ FROM mysql.help_relation WHERE (help_topic_id < '2' OR help_topic_id != 8 OR help_topic_id < 1) AND help_keyword_id = help_topic_id; + +--echo # +--echo # MDEV-29242: Assertion `computed_weight == weight' failed SEL_ARG::verify_weight +--echo # +CREATE TABLE t1 (id INT, KEY (id)); +INSERT INTO t1 VALUES (1),(5); +SELECT id FROM t1 WHERE id IS NULL OR id NOT BETWEEN 1 AND 4; +DROP TABLE t1; + diff --git a/mysql-test/main/range_vs_index_merge.result b/mysql-test/main/range_vs_index_merge.result index 7108fd89a7dd7..1729b95a10507 100644 --- a/mysql-test/main/range_vs_index_merge.result +++ b/mysql-test/main/range_vs_index_merge.result @@ -1810,7 +1810,7 @@ EXPLAIN SELECT * FROM t1 WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR (a<2 or a>2); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,idx PRIMARY 0 NULL 2 Using index condition; Using where +1 SIMPLE t1 ALL PRIMARY,idx NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR (a<2 or a>2); a b diff --git a/mysql-test/main/range_vs_index_merge.test b/mysql-test/main/range_vs_index_merge.test index 670762bcb2f81..38b643c0b1396 100644 --- a/mysql-test/main/range_vs_index_merge.test +++ b/mysql-test/main/range_vs_index_merge.test @@ -1,3 +1,4 @@ +--source include/no_valgrind_without_big.inc --source include/default_optimizer_switch.inc --source include/default_charset.inc --source include/have_sequence.inc @@ -692,7 +693,7 @@ DROP INDEX CityName on City; CREATE INDEX Name ON City(Name); CREATE INDEX Population ON City(Population); - +--disable_view_protocol --replace_column 9 # EXPLAIN SELECT * FROM City @@ -752,6 +753,7 @@ SELECT * FROM City AND (Population >= 100000 AND Population < 120000) ORDER BY Population LIMIT 5; SHOW STATUS LIKE 'Handler_read_%'; +--enable_view_protocol set optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/main/read_only_innodb.test b/mysql-test/main/read_only_innodb.test index 9ba3ccaca077c..4b00c32b1853d 100644 --- a/mysql-test/main/read_only_innodb.test +++ b/mysql-test/main/read_only_innodb.test @@ -1,6 +1,7 @@ # should work with embedded server after mysqltest is fixed -- source include/not_embedded.inc -- source include/have_innodb.inc +-- source include/no_view_protocol.inc # # BUG#11733: COMMITs should not happen if read-only is set diff --git a/mysql-test/main/rename.result b/mysql-test/main/rename.result index 15c744e158cfe..64ccf38595895 100644 --- a/mysql-test/main/rename.result +++ b/mysql-test/main/rename.result @@ -94,12 +94,12 @@ show create table t1_tmp; Table Create Table t1_tmp CREATE TEMPORARY TABLE `t1_tmp` ( `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2_tmp; Table Create Table t2_tmp CREATE TEMPORARY TABLE `t2_tmp` ( `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci rename table t1 to t1_tmp; rename table t2_tmp to t2; rename table t2 to tmp, tmp to t2; @@ -112,25 +112,25 @@ SHOW CREATE TABLE t1_tmp; Table Create Table t1_tmp CREATE TEMPORARY TABLE `t1_tmp` ( `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1_tmp; SHOW CREATE TABLE t1_tmp; Table Create Table t1_tmp CREATE TABLE `t1_tmp` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1_tmp; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TEMPORARY TABLE `t2` ( `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; CREATE TABLE t1 (a INT); insert into t1 values (1); diff --git a/mysql-test/main/reopen_temp_table.test b/mysql-test/main/reopen_temp_table.test index 2b3ff3bab5ebc..3d621fbbc56f4 100644 --- a/mysql-test/main/reopen_temp_table.test +++ b/mysql-test/main/reopen_temp_table.test @@ -1,5 +1,9 @@ --source include/have_innodb.inc +#Temporary table is only available to the current session +#and the view cannot be created based on the temporary table +--source include/no_view_protocol.inc + --echo # --echo # MDEV-5535: Cannot reopen temporary table --echo # diff --git a/mysql-test/main/repair.test b/mysql-test/main/repair.test index 435eb99683a8f..45de1e7350043 100644 --- a/mysql-test/main/repair.test +++ b/mysql-test/main/repair.test @@ -1,6 +1,7 @@ # # Test of repair table # + --source include/have_sequence.inc --source include/default_charset.inc @@ -235,6 +236,7 @@ drop table t1; # # MDEV-11539 test_if_reopen: Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed upon select from I_S # +--disable_view_protocol CREATE TABLE t1 (i INT) ENGINE=MyISAM; INSERT t1 VALUES (1); LOCK TABLE t1 WRITE; @@ -245,7 +247,7 @@ SELECT * FROM INFORMATION_SCHEMA.TABLES; SELECT * FROM t1; UNLOCK TABLES; DROP TABLE t1; - +--enable_view_protocol --echo # End of 10.0 tests # diff --git a/mysql-test/main/repair_symlink-5543.result b/mysql-test/main/repair_symlink-5543.result index 2024c9f568477..e99bd4ea31287 100644 --- a/mysql-test/main/repair_symlink-5543.result +++ b/mysql-test/main/repair_symlink-5543.result @@ -1,7 +1,5 @@ create table t1 (a int) engine=myisam data directory='MYSQL_TMP_DIR'; insert t1 values (1); -# Some systems fail with errcode 40, or 90 (MIPS) when doing openat, -# while others don't have openat and fail with errcode 20. repair table t1; Table Op Msg_type Msg_text test.t1 repair error 20 for record at pos 0 diff --git a/mysql-test/main/repair_symlink-5543.test b/mysql-test/main/repair_symlink-5543.test index 7c4ad7db0dc6d..002b8d8023b4e 100644 --- a/mysql-test/main/repair_symlink-5543.test +++ b/mysql-test/main/repair_symlink-5543.test @@ -9,9 +9,10 @@ eval create table t1 (a int) engine=myisam data directory='$MYSQL_TMP_DIR'; insert t1 values (1); --system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t1.TMD ---echo # Some systems fail with errcode 40, or 90 (MIPS) when doing openat, ---echo # while others don't have openat and fail with errcode 20. ---replace_regex / '.*\/t1/ 'MYSQL_TMP_DIR\/t1/ /[49]0/20/ /85/20/ /".*"/""/ +# Some systems fail with errcode 31 (FreeBSD), 40 (Linux), 85 (AIX), +# or 90 (MIPS) when doing openat, +# while others don't have openat and fail with errcode 20. +--replace_regex / '.*\/t1/ 'MYSQL_TMP_DIR\/t1/ /[49]0|31|85/20/ /".*"/""/ repair table t1; drop table t1; @@ -19,7 +20,7 @@ drop table t1; eval create table t2 (a int) engine=aria data directory='$MYSQL_TMP_DIR'; insert t2 values (1); --system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t2.TMD ---replace_regex / '.*\/t2/ 'MYSQL_TMP_DIR\/t2/ /[49]0/20/ /85/20/ /".*"/""/ +--replace_regex / '.*\/t2/ 'MYSQL_TMP_DIR\/t2/ /[49]0|31|85/20/ /".*"/""/ repair table t2; drop table t2; diff --git a/mysql-test/main/reset_connection.test b/mysql-test/main/reset_connection.test index 29a8ff52f898e..e6a456fb27d70 100644 --- a/mysql-test/main/reset_connection.test +++ b/mysql-test/main/reset_connection.test @@ -4,6 +4,7 @@ FLUSH STATUS; --disable_result_log --disable_query_log +--disable_service_connection let $i = 10; begin; @@ -37,4 +38,6 @@ 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 +disconnect latin1_conn; + +--enable_service_connection diff --git a/mysql-test/main/row-checksum-old.result b/mysql-test/main/row-checksum-old.result index d374013f61c55..7caed4fc7dcf4 100644 --- a/mysql-test/main/row-checksum-old.result +++ b/mysql-test/main/row-checksum-old.result @@ -1,4 +1,3 @@ -drop table if exists t1; create table t1 (a int null, v varchar(100)) engine=myisam checksum=0; insert into t1 values(null, null), (1, "hello"); checksum table t1; @@ -98,4 +97,48 @@ CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 2326430205 drop table t1; +# # End of 5.5 tests +# +# +# MDEV-28020 CHECKSUM TABLE calculates different checksums +# +create table t1 ( a int, b int as (a) virtual, c text) engine=myisam checksum=1; +insert ignore t1 values (1,2,'foo'),(2,3,'bar'); +Warnings: +Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored +Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored +checksum table t1 extended; +Table Checksum +test.t1 4101438232 +checksum table t1; +Table Checksum +test.t1 4101438232 +drop table t1; +create table t1 ( a int, b int as (a) virtual, c text, key(b)) engine=myisam checksum=1; +insert ignore t1 values (1,2,'foo'),(2,3,'bar'); +Warnings: +Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored +Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored +checksum table t1 extended; +Table Checksum +test.t1 4101438232 +checksum table t1; +Table Checksum +test.t1 4101438232 +drop table t1; +create table t1 ( a int, b int as (a) stored, c text) engine=myisam checksum=1; +insert ignore t1 values (1,2,'foo'),(2,3,'bar'); +Warnings: +Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored +Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored +checksum table t1 extended; +Table Checksum +test.t1 2897795735 +checksum table t1; +Table Checksum +test.t1 2897795735 +drop table t1; +# +# End of 10.2 tests +# diff --git a/mysql-test/main/row-checksum.result b/mysql-test/main/row-checksum.result index 4625e09c0603d..c80ca4eed9a02 100644 --- a/mysql-test/main/row-checksum.result +++ b/mysql-test/main/row-checksum.result @@ -1,4 +1,3 @@ -drop table if exists t1; create table t1 (a int null, v varchar(100)) engine=myisam checksum=0; insert into t1 values(null, null), (1, "hello"); checksum table t1; @@ -98,4 +97,48 @@ CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 2326430205 drop table t1; +# # End of 5.5 tests +# +# +# MDEV-28020 CHECKSUM TABLE calculates different checksums +# +create table t1 ( a int, b int as (a) virtual, c text) engine=myisam checksum=1; +insert ignore t1 values (1,2,'foo'),(2,3,'bar'); +Warnings: +Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored +Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored +checksum table t1 extended; +Table Checksum +test.t1 4101438232 +checksum table t1; +Table Checksum +test.t1 4101438232 +drop table t1; +create table t1 ( a int, b int as (a) virtual, c text, key(b)) engine=myisam checksum=1; +insert ignore t1 values (1,2,'foo'),(2,3,'bar'); +Warnings: +Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored +Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored +checksum table t1 extended; +Table Checksum +test.t1 4101438232 +checksum table t1; +Table Checksum +test.t1 4101438232 +drop table t1; +create table t1 ( a int, b int as (a) stored, c text) engine=myisam checksum=1; +insert ignore t1 values (1,2,'foo'),(2,3,'bar'); +Warnings: +Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored +Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored +checksum table t1 extended; +Table Checksum +test.t1 2897795735 +checksum table t1; +Table Checksum +test.t1 2897795735 +drop table t1; +# +# End of 10.2 tests +# diff --git a/mysql-test/main/row-checksum.test b/mysql-test/main/row-checksum.test index 5acfda45f75df..3b510abba8472 100644 --- a/mysql-test/main/row-checksum.test +++ b/mysql-test/main/row-checksum.test @@ -2,12 +2,8 @@ # Test checksum # --- source include/have_innodb.inc --- source include/have_maria.inc - ---disable_warnings -drop table if exists t1; ---enable_warnings +--source include/have_innodb.inc +--source include/have_maria.inc create table t1 (a int null, v varchar(100)) engine=myisam checksum=0; insert into t1 values(null, null), (1, "hello"); @@ -76,4 +72,31 @@ CHECKSUM TABLE t1 EXTENDED; drop table t1; +--echo # --echo # End of 5.5 tests +--echo # + +--echo # +--echo # MDEV-28020 CHECKSUM TABLE calculates different checksums +--echo # +create table t1 ( a int, b int as (a) virtual, c text) engine=myisam checksum=1; +insert ignore t1 values (1,2,'foo'),(2,3,'bar'); +checksum table t1 extended; +checksum table t1; +drop table t1; + +create table t1 ( a int, b int as (a) virtual, c text, key(b)) engine=myisam checksum=1; +insert ignore t1 values (1,2,'foo'),(2,3,'bar'); +checksum table t1 extended; +checksum table t1; +drop table t1; + +create table t1 ( a int, b int as (a) stored, c text) engine=myisam checksum=1; +insert ignore t1 values (1,2,'foo'),(2,3,'bar'); +checksum table t1 extended; +checksum table t1; +drop table t1; + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/main/row.result b/mysql-test/main/row.result index 12ab4208c119d..38af3b403279e 100644 --- a/mysql-test/main/row.result +++ b/mysql-test/main/row.result @@ -18,14 +18,14 @@ Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'a' Warning 1292 Truncated incorrect DOUBLE value: 'a' Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' Warning 1292 Truncated incorrect DOUBLE value: 'a' select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3)); row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3)) 1 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' Warning 1292 Truncated incorrect DOUBLE value: 'a' select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3)); row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3)) @@ -49,16 +49,16 @@ select row('b',1.5,3) IN (row('b',NULL,3), row('a',1.5,3), row(1,3,3)); row('b',1.5,3) IN (row('b',NULL,3), row('a',1.5,3), row(1,3,3)) 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' select row('b',1.5,3) IN (row('b',NULL,4), row('a',1.5,3), row(1,3,3)); row('b',1.5,3) IN (row('b',NULL,4), row('a',1.5,3), row(1,3,3)) 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' select (1,2,(3,4)) IN ((3,2,(3,4)), (1,2,(3,4))); (1,2,(3,4)) IN ((3,2,(3,4)), (1,2,(3,4))) 1 diff --git a/mysql-test/main/row.test b/mysql-test/main/row.test index d78d61b078abd..8fae416063c06 100644 --- a/mysql-test/main/row.test +++ b/mysql-test/main/row.test @@ -7,9 +7,12 @@ select (1,2,3) IN ((3,2,3), (1,2,3), (1,3,3)); select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)); select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3)); select row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3)); +#view protocol generates additional warning +--disable_view_protocol select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a')); select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3)); select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3)); +--enable_view_protocol select row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3)); select row('b',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3)); select row('b',1.5,3) IN (row('b',NULL,3), row('a',1.5,3), row(1,3,3)); @@ -256,8 +259,10 @@ default character set 'latin1'; insert into t1 (a) values('abc'); insert into t2 (c) values('abc'); select * from t1,t2 where (a,b) = (c,d); - +#enable after fix MDEV-29542 +--disable_view_protocol select host,user from mysql.user where (host,user) = ('localhost','test'); +--enable_view_protocol drop table t1,t2; --echo # diff --git a/mysql-test/main/rowid_filter.result b/mysql-test/main/rowid_filter.result index 10662f0edfaa5..2ab2f9797581f 100644 --- a/mysql-test/main/rowid_filter.result +++ b/mysql-test/main/rowid_filter.result @@ -35,7 +35,7 @@ lineitem CREATE TABLE `lineitem` ( KEY `i_l_orderkey_quantity` (`l_orderkey`,`l_quantity`), KEY `i_l_commitdate` (`l_commitDATE`), KEY `i_l_quantity` (`l_quantity`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table orders; Table Create Table orders CREATE TABLE `orders` ( @@ -52,7 +52,7 @@ orders CREATE TABLE `orders` ( KEY `i_o_orderdate` (`o_orderDATE`), KEY `i_o_custkey` (`o_custkey`), KEY `i_o_totalprice` (`o_totalprice`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci set optimizer_use_condition_selectivity=2; select 100 * @@ -134,6 +134,7 @@ ANALYZE "rows": 702, "selectivity_pct": 11.69025812, "r_rows": 605, + "r_lookups": 510, "r_selectivity_pct": 11.76470588, "r_buffer_size": "REPLACED", "r_filling_time_ms": "REPLACED" @@ -352,8 +353,8 @@ FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND o_totalprice between 200000 and 230000; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 Using index condition -1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (5%) Using where; Using rowid filter +1 SIMPLE orders range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 69 Using index condition +1 SIMPLE lineitem ref|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey|i_l_shipdate 4|4 dbt3_s001.orders.o_orderkey 4 (2%) Using where; Using rowid filter set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND @@ -365,42 +366,42 @@ EXPLAIN "nested_loop": [ { "table": { - "table_name": "lineitem", + "table_name": "orders", "access_type": "range", + "possible_keys": ["PRIMARY", "i_o_totalprice"], + "key": "i_o_totalprice", + "key_length": "9", + "used_key_parts": ["o_totalprice"], + "rows": 69, + "filtered": 100, + "index_condition": "orders.o_totalprice between 200000 and 230000" + } + }, + { + "table": { + "table_name": "lineitem", + "access_type": "ref", "possible_keys": [ "PRIMARY", "i_l_shipdate", "i_l_orderkey", "i_l_orderkey_quantity" ], - "key": "i_l_shipdate", - "key_length": "4", - "used_key_parts": ["l_shipDATE"], - "rows": 98, - "filtered": 100, - "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'" - } - }, - { - "table": { - "table_name": "orders", - "access_type": "eq_ref", - "possible_keys": ["PRIMARY", "i_o_totalprice"], - "key": "PRIMARY", + "key": "i_l_orderkey", "key_length": "4", - "used_key_parts": ["o_orderkey"], - "ref": ["dbt3_s001.lineitem.l_orderkey"], + "used_key_parts": ["l_orderkey"], + "ref": ["dbt3_s001.orders.o_orderkey"], "rowid_filter": { "range": { - "key": "i_o_totalprice", - "used_key_parts": ["o_totalprice"] + "key": "i_l_shipdate", + "used_key_parts": ["l_shipDATE"] }, - "rows": 69, - "selectivity_pct": 4.6 + "rows": 98, + "selectivity_pct": 1.631973356 }, - "rows": 1, - "filtered": 4.599999905, - "attached_condition": "orders.o_totalprice between 200000 and 230000" + "rows": 4, + "filtered": 1.631973386, + "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'" } } ] @@ -411,8 +412,8 @@ FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND o_totalprice between 200000 and 230000; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 98.00 100.00 100.00 Using index condition -1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (5%) 0.11 (10%) 4.60 100.00 Using where; Using rowid filter +1 SIMPLE orders range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 69 71.00 100.00 100.00 Using index condition +1 SIMPLE lineitem ref|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey|i_l_shipdate 4|4 dbt3_s001.orders.o_orderkey 4 (2%) 0.15 (2%) 1.63 100.00 Using where; Using rowid filter set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND @@ -426,56 +427,57 @@ ANALYZE "nested_loop": [ { "table": { - "table_name": "lineitem", + "table_name": "orders", "access_type": "range", - "possible_keys": [ - "PRIMARY", - "i_l_shipdate", - "i_l_orderkey", - "i_l_orderkey_quantity" - ], - "key": "i_l_shipdate", - "key_length": "4", - "used_key_parts": ["l_shipDATE"], + "possible_keys": ["PRIMARY", "i_o_totalprice"], + "key": "i_o_totalprice", + "key_length": "9", + "used_key_parts": ["o_totalprice"], "r_loops": 1, - "rows": 98, - "r_rows": 98, + "rows": 69, + "r_rows": 71, "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, - "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'" + "index_condition": "orders.o_totalprice between 200000 and 230000" } }, { "table": { - "table_name": "orders", - "access_type": "eq_ref", - "possible_keys": ["PRIMARY", "i_o_totalprice"], - "key": "PRIMARY", + "table_name": "lineitem", + "access_type": "ref", + "possible_keys": [ + "PRIMARY", + "i_l_shipdate", + "i_l_orderkey", + "i_l_orderkey_quantity" + ], + "key": "i_l_orderkey", "key_length": "4", - "used_key_parts": ["o_orderkey"], - "ref": ["dbt3_s001.lineitem.l_orderkey"], + "used_key_parts": ["l_orderkey"], + "ref": ["dbt3_s001.orders.o_orderkey"], "rowid_filter": { "range": { - "key": "i_o_totalprice", - "used_key_parts": ["o_totalprice"] + "key": "i_l_shipdate", + "used_key_parts": ["l_shipDATE"] }, - "rows": 69, - "selectivity_pct": 4.6, - "r_rows": 71, - "r_selectivity_pct": 10.41666667, + "rows": 98, + "selectivity_pct": 1.631973356, + "r_rows": 98, + "r_lookups": 476, + "r_selectivity_pct": 2.31092437, "r_buffer_size": "REPLACED", "r_filling_time_ms": "REPLACED" }, - "r_loops": 98, - "rows": 1, - "r_rows": 0.112244898, + "r_loops": 71, + "rows": 4, + "r_rows": 0.154929577, "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", - "filtered": 4.599999905, + "filtered": 1.631973386, "r_filtered": 100, - "attached_condition": "orders.o_totalprice between 200000 and 230000" + "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'" } } ] @@ -740,6 +742,7 @@ ANALYZE "rows": 702, "selectivity_pct": 11.69025812, "r_rows": 605, + "r_lookups": 510, "r_selectivity_pct": 11.76470588, "r_buffer_size": "REPLACED", "r_filling_time_ms": "REPLACED" @@ -772,6 +775,7 @@ ANALYZE "rows": 139, "selectivity_pct": 9.266666667, "r_rows": 144, + "r_lookups": 59, "r_selectivity_pct": 25.42372881, "r_buffer_size": "REPLACED", "r_filling_time_ms": "REPLACED" @@ -1072,6 +1076,7 @@ ANALYZE "rows": 509, "selectivity_pct": 8.476269775, "r_rows": 510, + "r_lookups": 476, "r_selectivity_pct": 7.773109244, "r_buffer_size": "REPLACED", "r_filling_time_ms": "REPLACED" @@ -2205,7 +2210,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 HAVING (7, 9) IN (SELECT t2.i1, t2.i2 FROM t2 WHERE t2.i1 = 3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +2 SUBQUERY t2 ref i1,i2 i1 5 const 1 100.00 Using index condition; Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` having 0 DROP TABLE t1,t2; @@ -2214,7 +2219,7 @@ DROP TABLE t1,t2; # that uses in expensive subquery # CREATE TABLE t1 ( -pk1 INT PRIMARY KEY, a1 INT, b1 VARCHAR(1), KEY(b1) +pk1 INT PRIMARY KEY, a1 INT, b1 VARCHAR(1), KEY(a1), KEY(b1) ) ENGINE=MyISAM; INSERT INTO t1 VALUES (10,0,'z'),(11,3,'j'),(12,8,'f'),(13,8,'p'),(14,6,'w'),(15,0,'c'),(16,1,'j'), @@ -2233,21 +2238,31 @@ INSERT INTO t1 VALUES (101,0,'u'),(102,7,'r'),(103,2,'x'),(104,8,'e'),(105,8,'i'),(106,5,'q'), (107,8,'z'),(108,3,'k'),(109,65,NULL); CREATE TABLE t2 (pk2 INT PRIMARY KEY, a2 INT, b2 VARCHAR(1)) ENGINE=MyISAM; -INSERT INTO t2 VALUES (1,1,'x'); +INSERT INTO t2 VALUES (1,1,'i'); INSERT INTO t2 SELECT * FROM t1; -SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 ) +INSERT INTO t1 SELECT pk1+200, a1, b1 FROM t1; +INSERT INTO t1 SELECT pk1+400, a1, b1 FROM t1; +ANALYZE TABLE t1,t2 PERSISTENT FOR ALL; +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 +SELECT * FROM t1 INNER JOIN t2 ON ( pk1+1 = pk2+2 AND a1 = a2 ) WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 ); pk1 a1 b1 pk2 a2 b2 -65 2 a 109 65 NULL -EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 ) +17 1 f 16 1 j +37 3 g 36 3 a +105 8 i 104 8 e +EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON ( pk1+1 = pk2+2 AND a1 = a2 ) WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 ); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 101 100.00 Using where -1 PRIMARY t1 eq_ref|filter PRIMARY,b1 PRIMARY|b1 4|4 test.t2.a2 1 (87%) 87.00 Using where; Using rowid filter +1 PRIMARY t1 ref a1,b1 a1 5 test.t2.a2 36 28.75 Using where 2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 100.00 Using index condition Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`pk2` AS `pk2`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`pk1` = `test`.`t2`.`a2` and `test`.`t1`.`b1` <= (/* select#2 */ select max(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`pk2` <= 1) and `test`.`t2`.`a2` <> `test`.`t2`.`pk2` -EXPLAIN FORMAT=JSON SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 ) +Note 1003 /* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`pk2` AS `pk2`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a1` = `test`.`t2`.`a2` and `test`.`t1`.`b1` <= (/* select#2 */ select max(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`pk2` <= 1) and `test`.`t1`.`pk1` + 1 = `test`.`t2`.`pk2` + 2 +EXPLAIN FORMAT=JSON SELECT * FROM t1 INNER JOIN t2 ON ( pk1+1 = pk2+2 AND a1 = a2 ) WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 ); EXPLAIN { @@ -2260,29 +2275,21 @@ EXPLAIN "access_type": "ALL", "rows": 101, "filtered": 100, - "attached_condition": "t2.a2 <> t2.pk2 and t2.a2 is not null" + "attached_condition": "t2.a2 is not null" } }, { "table": { "table_name": "t1", - "access_type": "eq_ref", - "possible_keys": ["PRIMARY", "b1"], - "key": "PRIMARY", - "key_length": "4", - "used_key_parts": ["pk1"], + "access_type": "ref", + "possible_keys": ["a1", "b1"], + "key": "a1", + "key_length": "5", + "used_key_parts": ["a1"], "ref": ["test.t2.a2"], - "rowid_filter": { - "range": { - "key": "b1", - "used_key_parts": ["b1"] - }, - "rows": 87, - "selectivity_pct": 87 - }, - "rows": 1, - "filtered": 87, - "attached_condition": "t1.b1 <= (subquery#2)" + "rows": 36, + "filtered": 28.75, + "attached_condition": "t1.b1 <= (subquery#2) and t1.pk1 + 1 = t2.pk2 + 2" } } ], @@ -2355,13 +2362,466 @@ set @save_optimizer_switch= @@optimizer_switch; SET @@optimizer_switch="index_merge_sort_union=OFF"; CREATE TABLE t1 (a INT, b INT, INDEX(a), INDEX(b)); INSERT INTO t1 VALUES (0,0),(1,0),(-1,1), (-2,1), (-2,3), (-3,4), (-2,4); +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +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 explain SELECT * FROM t1 WHERE a > 0 AND b=0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref|filter a,b b|a 5|5 const 2 (14%) Using where; Using rowid filter +1 SIMPLE t1 range|filter a,b a|b 5|5 NULL 77 (34%) Using index condition; Using where; Using rowid filter SELECT * FROM t1 WHERE a > 0 AND b=0; a b 1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 drop table t1; SET @@optimizer_switch=@save_optimizer_switch; +# +# MDEV-28846: Poor performance when rowid filter contains no elements +# +create table t1 ( +pk int primary key auto_increment, +nm varchar(32), +fl1 tinyint default 0, +fl2 tinyint default 0, +index idx1(nm, fl1), +index idx2(fl2) +) engine=myisam; +create table name ( +pk int primary key auto_increment, +nm bigint +) engine=myisam; +create table flag2 ( +pk int primary key auto_increment, +fl2 tinyint +) engine=myisam; +insert into name(nm) select seq from seq_1_to_1000 order by rand(17); +insert into flag2(fl2) select seq mod 2 from seq_1_to_1000 order by rand(19); +insert into t1(nm,fl2) +select nm, fl2 from name, flag2 where name.pk = flag2.pk; +analyze table t1 persistent for all; +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 '500%' as a; +a +500% +set optimizer_switch='rowid_filter=on'; +explain +select * from t1 where nm like '500%' AND fl2 = 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range idx1,idx2 idx1 35 NULL 1 Using index condition; Using where +analyze format=json +select * from t1 where nm like '500%' AND fl2 = 0; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "range", + "possible_keys": ["idx1", "idx2"], + "key": "idx1", + "key_length": "35", + "used_key_parts": ["nm"], + "r_loops": 1, + "rows": 1, + "r_rows": 1, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 49.20000076, + "r_filtered": 100, + "index_condition": "t1.nm like '500%'", + "attached_condition": "t1.fl2 = 0" + } + } + ] + } +} +select * from t1 where nm like '500%' AND fl2 = 0; +pk nm fl1 fl2 +517 500 0 0 +truncate table name; +truncate table flag2; +truncate table t1; +insert into name(nm) select seq from seq_1_to_1000 order by rand(17); +insert into flag2(fl2) select seq mod 2 from seq_1_to_1000 order by rand(19); +insert into t1(nm,fl2) +select nm, fl2 from name, flag2 where name.pk = flag2.pk; +analyze table t1 persistent for all; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status Table is already up to date +set optimizer_switch='rowid_filter=off'; +explain +select * from t1 where nm like '500%' AND fl2 = 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range idx1,idx2 idx1 35 NULL 1 Using index condition; Using where +analyze format=json +select * from t1 where nm like '500%' AND fl2 = 0; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "range", + "possible_keys": ["idx1", "idx2"], + "key": "idx1", + "key_length": "35", + "used_key_parts": ["nm"], + "r_loops": 1, + "rows": 1, + "r_rows": 1, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 49.20000076, + "r_filtered": 100, + "index_condition": "t1.nm like '500%'", + "attached_condition": "t1.fl2 = 0" + } + } + ] + } +} +select * from t1 where nm like '500%' AND fl2 = 0; +pk nm fl1 fl2 +517 500 0 0 +truncate table name; +truncate table flag2; +truncate table t1; +insert into name(nm) select seq from seq_1_to_1000 order by rand(17); +insert into flag2(fl2) select seq mod 10 from seq_1_to_1000 order by rand(19); +insert into t1(nm,fl2) +select nm, fl2 from name, flag2 where name.pk = flag2.pk; +analyze table t1 persistent for all; +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 '607%' as a; +a +607% +set optimizer_switch='rowid_filter=on'; +explain +select * from t1 where nm like '607%' AND fl2 = 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range idx1,idx2 idx1 35 NULL 1 Using index condition; Using where +select * from t1 where nm like '607%' AND fl2 = 0; +pk nm fl1 fl2 +721 607 0 0 +truncate table name; +truncate table flag2; +truncate table t1; +insert into name(nm) select seq from seq_1_to_10000 order by rand(17); +insert into flag2(fl2) select seq mod 100 from seq_1_to_10000 order by rand(19); +insert into t1(nm,fl2) +select nm, fl2 from name, flag2 where name.pk = flag2.pk; +analyze table t1 persistent for all; +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 '75%' as a; +a +75% +set optimizer_switch='rowid_filter=on'; +explain +select * from t1 where nm like '75%' AND fl2 = 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref|filter idx1,idx2 idx2|idx1 2|35 const 55 (1%) Using where; Using rowid filter +analyze format=json +select * from t1 where nm like '75%' AND fl2 = 0; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ref", + "possible_keys": ["idx1", "idx2"], + "key": "idx2", + "key_length": "2", + "used_key_parts": ["fl2"], + "ref": ["const"], + "rowid_filter": { + "range": { + "key": "idx1", + "used_key_parts": ["nm"] + }, + "rows": 115, + "selectivity_pct": 1.15, + "r_rows": 111, + "r_lookups": 100, + "r_selectivity_pct": 2, + "r_buffer_size": "REPLACED", + "r_filling_time_ms": "REPLACED" + }, + "r_loops": 1, + "rows": 55, + "r_rows": 2, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 1.149999976, + "r_filtered": 100, + "attached_condition": "t1.nm like '75%'" + } + } + ] + } +} +select * from t1 where nm like '75%' AND fl2 = 0; +pk nm fl1 fl2 +4543 7503 0 0 +7373 7518 0 0 +drop table name, flag2; +drop table t1; +create table t1 ( +pk int primary key auto_increment, +nm char(255), +fl1 tinyint default 0, +fl2 int default 0, +index idx1(nm, fl1), +index idx2(fl2) +) engine=myisam; +create table name ( +pk int primary key auto_increment, +nm bigint +) engine=myisam; +create table flag2 ( +pk int primary key auto_increment, +fl2 int +) engine=myisam; +insert into name(nm) select seq from seq_1_to_10000 order by rand(17); +insert into flag2(fl2) select seq mod 10 from seq_1_to_10000 order by rand(19); +insert into t1(nm,fl2) +select nm, fl2 from name, flag2 where name.pk = flag2.pk; +analyze table t1 persistent for all; +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 t1 +where +( +nm like '3400%' or nm like '3402%' or nm like '3403%' or +nm like '3404%' or nm like '3405%' or nm like '3406%' or nm like '3407%' or +nm like '3409%' or +nm like '3411%' or nm like '3412%' or nm like '3413%' or +nm like '3414%' or nm like '3415%' or nm like '3416%' or nm like '3417%' or +nm like '3418%' or nm like '3419%' or +nm like '3421%' or nm like '3422%' or nm like '3423%' or +nm like '3424%' or nm like '3425%' or nm like '3426%' or nm like '3427%' or +nm like '3428%' or nm like '3429%' or +nm like '3430%' or nm like '3431%' or nm like '3432%' or nm like '3433%' or +nm like '3434%' or nm like '3435%' or nm like '3436%' or nm like '3437%' or +nm like '3439%' or +nm like '3440%' or nm like '3441%' or nm like '3442%' or nm like '3443%' or +nm like '3444%' or nm like '3445%' or nm like '3446%' or nm like '3447%' or +nm like '3448%' +) and fl2 = 0; +pk nm fl1 fl2 +analyze format=json select * from t1 +where +( +nm like '3400%' or nm like '3402%' or nm like '3403%' or +nm like '3404%' or nm like '3405%' or nm like '3406%' or nm like '3407%' or +nm like '3409%' or +nm like '3411%' or nm like '3412%' or nm like '3413%' or +nm like '3414%' or nm like '3415%' or nm like '3416%' or nm like '3417%' or +nm like '3418%' or nm like '3419%' or +nm like '3421%' or nm like '3422%' or nm like '3423%' or +nm like '3424%' or nm like '3425%' or nm like '3426%' or nm like '3427%' or +nm like '3428%' or nm like '3429%' or +nm like '3430%' or nm like '3431%' or nm like '3432%' or nm like '3433%' or +nm like '3434%' or nm like '3435%' or nm like '3436%' or nm like '3437%' or +nm like '3439%' or +nm like '3440%' or nm like '3441%' or nm like '3442%' or nm like '3443%' or +nm like '3444%' or nm like '3445%' or nm like '3446%' or nm like '3447%' or +nm like '3448%' +) and fl2 = 0; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ref", + "possible_keys": ["idx1", "idx2"], + "key": "idx2", + "key_length": "5", + "used_key_parts": ["fl2"], + "ref": ["const"], + "rowid_filter": { + "range": { + "key": "idx1", + "used_key_parts": ["nm"] + }, + "rows": 44, + "selectivity_pct": 0.44, + "r_rows": 44, + "r_lookups": 1000, + "r_selectivity_pct": 0, + "r_buffer_size": "REPLACED", + "r_filling_time_ms": "REPLACED" + }, + "r_loops": 1, + "rows": 863, + "r_rows": 0, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 0.439999998, + "r_filtered": 100, + "attached_condition": "t1.nm like '3400%' or t1.nm like '3402%' or t1.nm like '3403%' or t1.nm like '3404%' or t1.nm like '3405%' or t1.nm like '3406%' or t1.nm like '3407%' or t1.nm like '3409%' or t1.nm like '3411%' or t1.nm like '3412%' or t1.nm like '3413%' or t1.nm like '3414%' or t1.nm like '3415%' or t1.nm like '3416%' or t1.nm like '3417%' or t1.nm like '3418%' or t1.nm like '3419%' or t1.nm like '3421%' or t1.nm like '3422%' or t1.nm like '3423%' or t1.nm like '3424%' or t1.nm like '3425%' or t1.nm like '3426%' or t1.nm like '3427%' or t1.nm like '3428%' or t1.nm like '3429%' or t1.nm like '3430%' or t1.nm like '3431%' or t1.nm like '3432%' or t1.nm like '3433%' or t1.nm like '3434%' or t1.nm like '3435%' or t1.nm like '3436%' or t1.nm like '3437%' or t1.nm like '3439%' or t1.nm like '3440%' or t1.nm like '3441%' or t1.nm like '3442%' or t1.nm like '3443%' or t1.nm like '3444%' or t1.nm like '3445%' or t1.nm like '3446%' or t1.nm like '3447%' or t1.nm like '3448%'" + } + } + ] + } +} +create table t0 select * from t1 where nm like '34%'; +delete from t1 using t1,t0 where t1.nm=t0.nm; +analyze format=json select * from t1 +where +( +nm like '3400%' or nm like '3402%' or nm like '3403%' or +nm like '3404%' or nm like '3405%' or nm like '3406%' or nm like '3407%' or +nm like '3409%' or +nm like '3411%' or nm like '3412%' or nm like '3413%' or +nm like '3414%' or nm like '3415%' or nm like '3416%' or nm like '3417%' or +nm like '3418%' or nm like '3419%' or +nm like '3421%' or nm like '3422%' or nm like '3423%' or +nm like '3424%' or nm like '3425%' or nm like '3426%' or nm like '3427%' or +nm like '3428%' or nm like '3429%' or +nm like '3430%' or nm like '3431%' or nm like '3432%' or nm like '3433%' or +nm like '3434%' or nm like '3435%' or nm like '3436%' or nm like '3437%' or +nm like '3439%' or +nm like '3440%' or nm like '3441%' or nm like '3442%' or nm like '3443%' or +nm like '3444%' or nm like '3445%' or nm like '3446%' or nm like '3447%' or +nm like '3448%' +) and fl2 = 0; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ref", + "possible_keys": ["idx1", "idx2"], + "key": "idx2", + "key_length": "5", + "used_key_parts": ["fl2"], + "ref": ["const"], + "rowid_filter": { + "range": { + "key": "idx1", + "used_key_parts": ["nm"] + }, + "rows": 44, + "selectivity_pct": 0.44, + "r_rows": 0, + "r_lookups": 0, + "r_selectivity_pct": 0, + "r_buffer_size": "REPLACED", + "r_filling_time_ms": "REPLACED" + }, + "r_loops": 1, + "rows": 853, + "r_rows": 0, + "filtered": 0.439999998, + "r_filtered": 100, + "attached_condition": "t1.nm like '3400%' or t1.nm like '3402%' or t1.nm like '3403%' or t1.nm like '3404%' or t1.nm like '3405%' or t1.nm like '3406%' or t1.nm like '3407%' or t1.nm like '3409%' or t1.nm like '3411%' or t1.nm like '3412%' or t1.nm like '3413%' or t1.nm like '3414%' or t1.nm like '3415%' or t1.nm like '3416%' or t1.nm like '3417%' or t1.nm like '3418%' or t1.nm like '3419%' or t1.nm like '3421%' or t1.nm like '3422%' or t1.nm like '3423%' or t1.nm like '3424%' or t1.nm like '3425%' or t1.nm like '3426%' or t1.nm like '3427%' or t1.nm like '3428%' or t1.nm like '3429%' or t1.nm like '3430%' or t1.nm like '3431%' or t1.nm like '3432%' or t1.nm like '3433%' or t1.nm like '3434%' or t1.nm like '3435%' or t1.nm like '3436%' or t1.nm like '3437%' or t1.nm like '3439%' or t1.nm like '3440%' or t1.nm like '3441%' or t1.nm like '3442%' or t1.nm like '3443%' or t1.nm like '3444%' or t1.nm like '3445%' or t1.nm like '3446%' or t1.nm like '3447%' or t1.nm like '3448%'" + } + } + ] + } +} +drop table t0; +set optimizer_switch='rowid_filter=default'; +drop table name, flag2; +drop table t1; set @@use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/main/rowid_filter.test b/mysql-test/main/rowid_filter.test index 163b71b6153ee..a2543e197ca94 100644 --- a/mysql-test/main/rowid_filter.test +++ b/mysql-test/main/rowid_filter.test @@ -320,7 +320,7 @@ DROP TABLE t1,t2; --echo # CREATE TABLE t1 ( - pk1 INT PRIMARY KEY, a1 INT, b1 VARCHAR(1), KEY(b1) + pk1 INT PRIMARY KEY, a1 INT, b1 VARCHAR(1), KEY(a1), KEY(b1) ) ENGINE=MyISAM; INSERT INTO t1 VALUES (10,0,'z'),(11,3,'j'),(12,8,'f'),(13,8,'p'),(14,6,'w'),(15,0,'c'),(16,1,'j'), @@ -340,11 +340,16 @@ INSERT INTO t1 VALUES (107,8,'z'),(108,3,'k'),(109,65,NULL); CREATE TABLE t2 (pk2 INT PRIMARY KEY, a2 INT, b2 VARCHAR(1)) ENGINE=MyISAM; -INSERT INTO t2 VALUES (1,1,'x'); +INSERT INTO t2 VALUES (1,1,'i'); INSERT INTO t2 SELECT * FROM t1; +INSERT INTO t1 SELECT pk1+200, a1, b1 FROM t1; +INSERT INTO t1 SELECT pk1+400, a1, b1 FROM t1; + +ANALYZE TABLE t1,t2 PERSISTENT FOR ALL; + let $q= -SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 ) +SELECT * FROM t1 INNER JOIN t2 ON ( pk1+1 = pk2+2 AND a1 = a2 ) WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 ); eval $q; @@ -399,6 +404,15 @@ set @save_optimizer_switch= @@optimizer_switch; SET @@optimizer_switch="index_merge_sort_union=OFF"; CREATE TABLE t1 (a INT, b INT, INDEX(a), INDEX(b)); INSERT INTO t1 VALUES (0,0),(1,0),(-1,1), (-2,1), (-2,3), (-3,4), (-2,4); +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; + +ANALYZE table t1 PERSISTENT FOR ALL; + explain SELECT * FROM t1 WHERE a > 0 AND b=0; SELECT * FROM t1 WHERE a > 0 AND b=0; @@ -406,4 +420,194 @@ drop table t1; SET @@optimizer_switch=@save_optimizer_switch; +--echo # +--echo # MDEV-28846: Poor performance when rowid filter contains no elements +--echo # + +--source include/have_sequence.inc + +create table t1 ( + pk int primary key auto_increment, + nm varchar(32), + fl1 tinyint default 0, + fl2 tinyint default 0, + index idx1(nm, fl1), + index idx2(fl2) +) engine=myisam; + +create table name ( + pk int primary key auto_increment, + nm bigint +) engine=myisam; + +create table flag2 ( + pk int primary key auto_increment, + fl2 tinyint +) engine=myisam; + +insert into name(nm) select seq from seq_1_to_1000 order by rand(17); +insert into flag2(fl2) select seq mod 2 from seq_1_to_1000 order by rand(19); + +insert into t1(nm,fl2) + select nm, fl2 from name, flag2 where name.pk = flag2.pk; + +analyze table t1 persistent for all; + +let $a= +`select concat((select nm from t1 where fl2=0 order by RAND(13) limit 1),'%')`; +eval select '$a' as a; + +set optimizer_switch='rowid_filter=on'; +eval +explain +select * from t1 where nm like '$a' AND fl2 = 0; +--source include/analyze-format.inc +eval +analyze format=json +select * from t1 where nm like '$a' AND fl2 = 0; +eval +select * from t1 where nm like '$a' AND fl2 = 0; + +truncate table name; +truncate table flag2; +truncate table t1; + +insert into name(nm) select seq from seq_1_to_1000 order by rand(17); +insert into flag2(fl2) select seq mod 2 from seq_1_to_1000 order by rand(19); + +insert into t1(nm,fl2) + select nm, fl2 from name, flag2 where name.pk = flag2.pk; + +analyze table t1 persistent for all; + +set optimizer_switch='rowid_filter=off'; +eval +explain +select * from t1 where nm like '$a' AND fl2 = 0; +--source include/analyze-format.inc +eval +analyze format=json +select * from t1 where nm like '$a' AND fl2 = 0; +eval +select * from t1 where nm like '$a' AND fl2 = 0; + +truncate table name; +truncate table flag2; +truncate table t1; + +insert into name(nm) select seq from seq_1_to_1000 order by rand(17); +insert into flag2(fl2) select seq mod 10 from seq_1_to_1000 order by rand(19); + +insert into t1(nm,fl2) + select nm, fl2 from name, flag2 where name.pk = flag2.pk; + +analyze table t1 persistent for all; + +let $a= +`select concat((select nm from t1 where fl2=0 order by RAND(13) limit 1),'%')`; +eval select '$a' as a; + +set optimizer_switch='rowid_filter=on'; +eval +explain +select * from t1 where nm like '$a' AND fl2 = 0; +eval +select * from t1 where nm like '$a' AND fl2 = 0; + +truncate table name; +truncate table flag2; +truncate table t1; + +insert into name(nm) select seq from seq_1_to_10000 order by rand(17); +insert into flag2(fl2) select seq mod 100 from seq_1_to_10000 order by rand(19); + +insert into t1(nm,fl2) + select nm, fl2 from name, flag2 where name.pk = flag2.pk; + +analyze table t1 persistent for all; + +let $a= +`select concat(left((select nm from t1 where fl2=0 order by RAND(13) limit 1),2),'%')`; +eval select '$a' as a; + +set optimizer_switch='rowid_filter=on'; +eval +explain +select * from t1 where nm like '$a' AND fl2 = 0; +--source include/analyze-format.inc +eval +analyze format=json +select * from t1 where nm like '$a' AND fl2 = 0; +eval +select * from t1 where nm like '$a' AND fl2 = 0; + +drop table name, flag2; +drop table t1; + +# This test shows that if the container is empty there are no lookups into it + +create table t1 ( + pk int primary key auto_increment, + nm char(255), + fl1 tinyint default 0, + fl2 int default 0, + index idx1(nm, fl1), + index idx2(fl2) +) engine=myisam; + +create table name ( + pk int primary key auto_increment, + nm bigint +) engine=myisam; + +create table flag2 ( + pk int primary key auto_increment, + fl2 int +) engine=myisam; + +insert into name(nm) select seq from seq_1_to_10000 order by rand(17); +insert into flag2(fl2) select seq mod 10 from seq_1_to_10000 order by rand(19); + +insert into t1(nm,fl2) + select nm, fl2 from name, flag2 where name.pk = flag2.pk; + +analyze table t1 persistent for all; + +let $q= +select * from t1 +where +( + nm like '3400%' or nm like '3402%' or nm like '3403%' or + nm like '3404%' or nm like '3405%' or nm like '3406%' or nm like '3407%' or + nm like '3409%' or + nm like '3411%' or nm like '3412%' or nm like '3413%' or + nm like '3414%' or nm like '3415%' or nm like '3416%' or nm like '3417%' or + nm like '3418%' or nm like '3419%' or + nm like '3421%' or nm like '3422%' or nm like '3423%' or + nm like '3424%' or nm like '3425%' or nm like '3426%' or nm like '3427%' or + nm like '3428%' or nm like '3429%' or + nm like '3430%' or nm like '3431%' or nm like '3432%' or nm like '3433%' or + nm like '3434%' or nm like '3435%' or nm like '3436%' or nm like '3437%' or + nm like '3439%' or + nm like '3440%' or nm like '3441%' or nm like '3442%' or nm like '3443%' or + nm like '3444%' or nm like '3445%' or nm like '3446%' or nm like '3447%' or + nm like '3448%' +) and fl2 = 0; + +eval $q; +--source include/analyze-format.inc +eval analyze format=json $q; + +create table t0 select * from t1 where nm like '34%'; +delete from t1 using t1,t0 where t1.nm=t0.nm; +--source include/analyze-format.inc +eval analyze format=json $q; + +drop table t0; + +set optimizer_switch='rowid_filter=default'; + +drop table name, flag2; +drop table t1; + set @@use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/main/rowid_filter_innodb.result b/mysql-test/main/rowid_filter_innodb.result index b4385229151d0..107470fab4505 100644 --- a/mysql-test/main/rowid_filter_innodb.result +++ b/mysql-test/main/rowid_filter_innodb.result @@ -38,7 +38,7 @@ lineitem CREATE TABLE `lineitem` ( KEY `i_l_orderkey_quantity` (`l_orderkey`,`l_quantity`), KEY `i_l_commitdate` (`l_commitDATE`), KEY `i_l_quantity` (`l_quantity`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table orders; Table Create Table orders CREATE TABLE `orders` ( @@ -55,7 +55,7 @@ orders CREATE TABLE `orders` ( KEY `i_o_orderdate` (`o_orderDATE`), KEY `i_o_custkey` (`o_custkey`), KEY `i_o_totalprice` (`o_totalprice`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci set optimizer_use_condition_selectivity=2; select 100 * @@ -137,6 +137,7 @@ ANALYZE "rows": 605, "selectivity_pct": 10.07493755, "r_rows": 605, + "r_lookups": 510, "r_selectivity_pct": 11.76470588, "r_buffer_size": "REPLACED", "r_filling_time_ms": "REPLACED" @@ -719,6 +720,7 @@ ANALYZE "rows": 605, "selectivity_pct": 10.07493755, "r_rows": 605, + "r_lookups": 510, "r_selectivity_pct": 11.76470588, "r_buffer_size": "REPLACED", "r_filling_time_ms": "REPLACED" @@ -2156,7 +2158,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 HAVING (7, 9) IN (SELECT t2.i1, t2.i2 FROM t2 WHERE t2.i1 = 3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +2 SUBQUERY t2 ref i1,i2 i1 5 const 1 100.00 Using index condition; Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` having 0 DROP TABLE t1,t2; @@ -2165,7 +2167,7 @@ DROP TABLE t1,t2; # that uses in expensive subquery # CREATE TABLE t1 ( -pk1 INT PRIMARY KEY, a1 INT, b1 VARCHAR(1), KEY(b1) +pk1 INT PRIMARY KEY, a1 INT, b1 VARCHAR(1), KEY(a1), KEY(b1) ) ENGINE=MyISAM; INSERT INTO t1 VALUES (10,0,'z'),(11,3,'j'),(12,8,'f'),(13,8,'p'),(14,6,'w'),(15,0,'c'),(16,1,'j'), @@ -2184,21 +2186,31 @@ INSERT INTO t1 VALUES (101,0,'u'),(102,7,'r'),(103,2,'x'),(104,8,'e'),(105,8,'i'),(106,5,'q'), (107,8,'z'),(108,3,'k'),(109,65,NULL); CREATE TABLE t2 (pk2 INT PRIMARY KEY, a2 INT, b2 VARCHAR(1)) ENGINE=MyISAM; -INSERT INTO t2 VALUES (1,1,'x'); +INSERT INTO t2 VALUES (1,1,'i'); INSERT INTO t2 SELECT * FROM t1; -SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 ) +INSERT INTO t1 SELECT pk1+200, a1, b1 FROM t1; +INSERT INTO t1 SELECT pk1+400, a1, b1 FROM t1; +ANALYZE TABLE t1,t2 PERSISTENT FOR ALL; +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 +SELECT * FROM t1 INNER JOIN t2 ON ( pk1+1 = pk2+2 AND a1 = a2 ) WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 ); pk1 a1 b1 pk2 a2 b2 -65 2 a 109 65 NULL -EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 ) +17 1 f 16 1 j +37 3 g 36 3 a +105 8 i 104 8 e +EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON ( pk1+1 = pk2+2 AND a1 = a2 ) WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 ); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 101 100.00 Using where -1 PRIMARY t1 eq_ref|filter PRIMARY,b1 PRIMARY|b1 4|4 test.t2.a2 1 (87%) 87.00 Using where; Using rowid filter +1 PRIMARY t1 ref a1,b1 a1 5 test.t2.a2 36 28.75 Using where 2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 100.00 Using index condition Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`pk2` AS `pk2`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`pk1` = `test`.`t2`.`a2` and `test`.`t1`.`b1` <= (/* select#2 */ select max(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`pk2` <= 1) and `test`.`t2`.`a2` <> `test`.`t2`.`pk2` -EXPLAIN FORMAT=JSON SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 ) +Note 1003 /* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`pk2` AS `pk2`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a1` = `test`.`t2`.`a2` and `test`.`t1`.`b1` <= (/* select#2 */ select max(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`pk2` <= 1) and `test`.`t1`.`pk1` + 1 = `test`.`t2`.`pk2` + 2 +EXPLAIN FORMAT=JSON SELECT * FROM t1 INNER JOIN t2 ON ( pk1+1 = pk2+2 AND a1 = a2 ) WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 ); EXPLAIN { @@ -2211,29 +2223,21 @@ EXPLAIN "access_type": "ALL", "rows": 101, "filtered": 100, - "attached_condition": "t2.a2 <> t2.pk2 and t2.a2 is not null" + "attached_condition": "t2.a2 is not null" } }, { "table": { "table_name": "t1", - "access_type": "eq_ref", - "possible_keys": ["PRIMARY", "b1"], - "key": "PRIMARY", - "key_length": "4", - "used_key_parts": ["pk1"], + "access_type": "ref", + "possible_keys": ["a1", "b1"], + "key": "a1", + "key_length": "5", + "used_key_parts": ["a1"], "ref": ["test.t2.a2"], - "rowid_filter": { - "range": { - "key": "b1", - "used_key_parts": ["b1"] - }, - "rows": 87, - "selectivity_pct": 87 - }, - "rows": 1, - "filtered": 87, - "attached_condition": "t1.b1 <= (subquery#2)" + "rows": 36, + "filtered": 28.75, + "attached_condition": "t1.b1 <= (subquery#2) and t1.pk1 + 1 = t2.pk2 + 2" } } ], @@ -2306,15 +2310,468 @@ set @save_optimizer_switch= @@optimizer_switch; SET @@optimizer_switch="index_merge_sort_union=OFF"; CREATE TABLE t1 (a INT, b INT, INDEX(a), INDEX(b)); INSERT INTO t1 VALUES (0,0),(1,0),(-1,1), (-2,1), (-2,3), (-3,4), (-2,4); +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +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 explain SELECT * FROM t1 WHERE a > 0 AND b=0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref|filter a,b b|a 5|5 const 2 (14%) Using where; Using rowid filter +1 SIMPLE t1 range|filter a,b a|b 5|5 NULL 64 (29%) Using index condition; Using where; Using rowid filter SELECT * FROM t1 WHERE a > 0 AND b=0; a b 1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 +1 0 drop table t1; SET @@optimizer_switch=@save_optimizer_switch; +# +# MDEV-28846: Poor performance when rowid filter contains no elements +# +create table t1 ( +pk int primary key auto_increment, +nm varchar(32), +fl1 tinyint default 0, +fl2 tinyint default 0, +index idx1(nm, fl1), +index idx2(fl2) +) engine=myisam; +create table name ( +pk int primary key auto_increment, +nm bigint +) engine=myisam; +create table flag2 ( +pk int primary key auto_increment, +fl2 tinyint +) engine=myisam; +insert into name(nm) select seq from seq_1_to_1000 order by rand(17); +insert into flag2(fl2) select seq mod 2 from seq_1_to_1000 order by rand(19); +insert into t1(nm,fl2) +select nm, fl2 from name, flag2 where name.pk = flag2.pk; +analyze table t1 persistent for all; +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 '500%' as a; +a +500% +set optimizer_switch='rowid_filter=on'; +explain +select * from t1 where nm like '500%' AND fl2 = 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range idx1,idx2 idx1 35 NULL 1 Using index condition; Using where +analyze format=json +select * from t1 where nm like '500%' AND fl2 = 0; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "range", + "possible_keys": ["idx1", "idx2"], + "key": "idx1", + "key_length": "35", + "used_key_parts": ["nm"], + "r_loops": 1, + "rows": 1, + "r_rows": 1, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 49.20000076, + "r_filtered": 100, + "index_condition": "t1.nm like '500%'", + "attached_condition": "t1.fl2 = 0" + } + } + ] + } +} +select * from t1 where nm like '500%' AND fl2 = 0; +pk nm fl1 fl2 +517 500 0 0 +truncate table name; +truncate table flag2; +truncate table t1; +insert into name(nm) select seq from seq_1_to_1000 order by rand(17); +insert into flag2(fl2) select seq mod 2 from seq_1_to_1000 order by rand(19); +insert into t1(nm,fl2) +select nm, fl2 from name, flag2 where name.pk = flag2.pk; +analyze table t1 persistent for all; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status Table is already up to date +set optimizer_switch='rowid_filter=off'; +explain +select * from t1 where nm like '500%' AND fl2 = 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range idx1,idx2 idx1 35 NULL 1 Using index condition; Using where +analyze format=json +select * from t1 where nm like '500%' AND fl2 = 0; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "range", + "possible_keys": ["idx1", "idx2"], + "key": "idx1", + "key_length": "35", + "used_key_parts": ["nm"], + "r_loops": 1, + "rows": 1, + "r_rows": 1, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 49.20000076, + "r_filtered": 100, + "index_condition": "t1.nm like '500%'", + "attached_condition": "t1.fl2 = 0" + } + } + ] + } +} +select * from t1 where nm like '500%' AND fl2 = 0; +pk nm fl1 fl2 +517 500 0 0 +truncate table name; +truncate table flag2; +truncate table t1; +insert into name(nm) select seq from seq_1_to_1000 order by rand(17); +insert into flag2(fl2) select seq mod 10 from seq_1_to_1000 order by rand(19); +insert into t1(nm,fl2) +select nm, fl2 from name, flag2 where name.pk = flag2.pk; +analyze table t1 persistent for all; +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 '607%' as a; +a +607% +set optimizer_switch='rowid_filter=on'; +explain +select * from t1 where nm like '607%' AND fl2 = 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range idx1,idx2 idx1 35 NULL 1 Using index condition; Using where +select * from t1 where nm like '607%' AND fl2 = 0; +pk nm fl1 fl2 +721 607 0 0 +truncate table name; +truncate table flag2; +truncate table t1; +insert into name(nm) select seq from seq_1_to_10000 order by rand(17); +insert into flag2(fl2) select seq mod 100 from seq_1_to_10000 order by rand(19); +insert into t1(nm,fl2) +select nm, fl2 from name, flag2 where name.pk = flag2.pk; +analyze table t1 persistent for all; +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 '75%' as a; +a +75% +set optimizer_switch='rowid_filter=on'; +explain +select * from t1 where nm like '75%' AND fl2 = 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref|filter idx1,idx2 idx2|idx1 2|35 const 55 (1%) Using where; Using rowid filter +analyze format=json +select * from t1 where nm like '75%' AND fl2 = 0; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ref", + "possible_keys": ["idx1", "idx2"], + "key": "idx2", + "key_length": "2", + "used_key_parts": ["fl2"], + "ref": ["const"], + "rowid_filter": { + "range": { + "key": "idx1", + "used_key_parts": ["nm"] + }, + "rows": 115, + "selectivity_pct": 1.15, + "r_rows": 111, + "r_lookups": 100, + "r_selectivity_pct": 2, + "r_buffer_size": "REPLACED", + "r_filling_time_ms": "REPLACED" + }, + "r_loops": 1, + "rows": 55, + "r_rows": 2, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 1.149999976, + "r_filtered": 100, + "attached_condition": "t1.nm like '75%'" + } + } + ] + } +} +select * from t1 where nm like '75%' AND fl2 = 0; +pk nm fl1 fl2 +4543 7503 0 0 +7373 7518 0 0 +drop table name, flag2; +drop table t1; +create table t1 ( +pk int primary key auto_increment, +nm char(255), +fl1 tinyint default 0, +fl2 int default 0, +index idx1(nm, fl1), +index idx2(fl2) +) engine=myisam; +create table name ( +pk int primary key auto_increment, +nm bigint +) engine=myisam; +create table flag2 ( +pk int primary key auto_increment, +fl2 int +) engine=myisam; +insert into name(nm) select seq from seq_1_to_10000 order by rand(17); +insert into flag2(fl2) select seq mod 10 from seq_1_to_10000 order by rand(19); +insert into t1(nm,fl2) +select nm, fl2 from name, flag2 where name.pk = flag2.pk; +analyze table t1 persistent for all; +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 t1 +where +( +nm like '3400%' or nm like '3402%' or nm like '3403%' or +nm like '3404%' or nm like '3405%' or nm like '3406%' or nm like '3407%' or +nm like '3409%' or +nm like '3411%' or nm like '3412%' or nm like '3413%' or +nm like '3414%' or nm like '3415%' or nm like '3416%' or nm like '3417%' or +nm like '3418%' or nm like '3419%' or +nm like '3421%' or nm like '3422%' or nm like '3423%' or +nm like '3424%' or nm like '3425%' or nm like '3426%' or nm like '3427%' or +nm like '3428%' or nm like '3429%' or +nm like '3430%' or nm like '3431%' or nm like '3432%' or nm like '3433%' or +nm like '3434%' or nm like '3435%' or nm like '3436%' or nm like '3437%' or +nm like '3439%' or +nm like '3440%' or nm like '3441%' or nm like '3442%' or nm like '3443%' or +nm like '3444%' or nm like '3445%' or nm like '3446%' or nm like '3447%' or +nm like '3448%' +) and fl2 = 0; +pk nm fl1 fl2 +analyze format=json select * from t1 +where +( +nm like '3400%' or nm like '3402%' or nm like '3403%' or +nm like '3404%' or nm like '3405%' or nm like '3406%' or nm like '3407%' or +nm like '3409%' or +nm like '3411%' or nm like '3412%' or nm like '3413%' or +nm like '3414%' or nm like '3415%' or nm like '3416%' or nm like '3417%' or +nm like '3418%' or nm like '3419%' or +nm like '3421%' or nm like '3422%' or nm like '3423%' or +nm like '3424%' or nm like '3425%' or nm like '3426%' or nm like '3427%' or +nm like '3428%' or nm like '3429%' or +nm like '3430%' or nm like '3431%' or nm like '3432%' or nm like '3433%' or +nm like '3434%' or nm like '3435%' or nm like '3436%' or nm like '3437%' or +nm like '3439%' or +nm like '3440%' or nm like '3441%' or nm like '3442%' or nm like '3443%' or +nm like '3444%' or nm like '3445%' or nm like '3446%' or nm like '3447%' or +nm like '3448%' +) and fl2 = 0; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ref", + "possible_keys": ["idx1", "idx2"], + "key": "idx2", + "key_length": "5", + "used_key_parts": ["fl2"], + "ref": ["const"], + "rowid_filter": { + "range": { + "key": "idx1", + "used_key_parts": ["nm"] + }, + "rows": 44, + "selectivity_pct": 0.44, + "r_rows": 44, + "r_lookups": 1000, + "r_selectivity_pct": 0, + "r_buffer_size": "REPLACED", + "r_filling_time_ms": "REPLACED" + }, + "r_loops": 1, + "rows": 863, + "r_rows": 0, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 0.439999998, + "r_filtered": 100, + "attached_condition": "t1.nm like '3400%' or t1.nm like '3402%' or t1.nm like '3403%' or t1.nm like '3404%' or t1.nm like '3405%' or t1.nm like '3406%' or t1.nm like '3407%' or t1.nm like '3409%' or t1.nm like '3411%' or t1.nm like '3412%' or t1.nm like '3413%' or t1.nm like '3414%' or t1.nm like '3415%' or t1.nm like '3416%' or t1.nm like '3417%' or t1.nm like '3418%' or t1.nm like '3419%' or t1.nm like '3421%' or t1.nm like '3422%' or t1.nm like '3423%' or t1.nm like '3424%' or t1.nm like '3425%' or t1.nm like '3426%' or t1.nm like '3427%' or t1.nm like '3428%' or t1.nm like '3429%' or t1.nm like '3430%' or t1.nm like '3431%' or t1.nm like '3432%' or t1.nm like '3433%' or t1.nm like '3434%' or t1.nm like '3435%' or t1.nm like '3436%' or t1.nm like '3437%' or t1.nm like '3439%' or t1.nm like '3440%' or t1.nm like '3441%' or t1.nm like '3442%' or t1.nm like '3443%' or t1.nm like '3444%' or t1.nm like '3445%' or t1.nm like '3446%' or t1.nm like '3447%' or t1.nm like '3448%'" + } + } + ] + } +} +create table t0 select * from t1 where nm like '34%'; +delete from t1 using t1,t0 where t1.nm=t0.nm; +analyze format=json select * from t1 +where +( +nm like '3400%' or nm like '3402%' or nm like '3403%' or +nm like '3404%' or nm like '3405%' or nm like '3406%' or nm like '3407%' or +nm like '3409%' or +nm like '3411%' or nm like '3412%' or nm like '3413%' or +nm like '3414%' or nm like '3415%' or nm like '3416%' or nm like '3417%' or +nm like '3418%' or nm like '3419%' or +nm like '3421%' or nm like '3422%' or nm like '3423%' or +nm like '3424%' or nm like '3425%' or nm like '3426%' or nm like '3427%' or +nm like '3428%' or nm like '3429%' or +nm like '3430%' or nm like '3431%' or nm like '3432%' or nm like '3433%' or +nm like '3434%' or nm like '3435%' or nm like '3436%' or nm like '3437%' or +nm like '3439%' or +nm like '3440%' or nm like '3441%' or nm like '3442%' or nm like '3443%' or +nm like '3444%' or nm like '3445%' or nm like '3446%' or nm like '3447%' or +nm like '3448%' +) and fl2 = 0; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ref", + "possible_keys": ["idx1", "idx2"], + "key": "idx2", + "key_length": "5", + "used_key_parts": ["fl2"], + "ref": ["const"], + "rowid_filter": { + "range": { + "key": "idx1", + "used_key_parts": ["nm"] + }, + "rows": 44, + "selectivity_pct": 0.44, + "r_rows": 0, + "r_lookups": 0, + "r_selectivity_pct": 0, + "r_buffer_size": "REPLACED", + "r_filling_time_ms": "REPLACED" + }, + "r_loops": 1, + "rows": 853, + "r_rows": 0, + "filtered": 0.439999998, + "r_filtered": 100, + "attached_condition": "t1.nm like '3400%' or t1.nm like '3402%' or t1.nm like '3403%' or t1.nm like '3404%' or t1.nm like '3405%' or t1.nm like '3406%' or t1.nm like '3407%' or t1.nm like '3409%' or t1.nm like '3411%' or t1.nm like '3412%' or t1.nm like '3413%' or t1.nm like '3414%' or t1.nm like '3415%' or t1.nm like '3416%' or t1.nm like '3417%' or t1.nm like '3418%' or t1.nm like '3419%' or t1.nm like '3421%' or t1.nm like '3422%' or t1.nm like '3423%' or t1.nm like '3424%' or t1.nm like '3425%' or t1.nm like '3426%' or t1.nm like '3427%' or t1.nm like '3428%' or t1.nm like '3429%' or t1.nm like '3430%' or t1.nm like '3431%' or t1.nm like '3432%' or t1.nm like '3433%' or t1.nm like '3434%' or t1.nm like '3435%' or t1.nm like '3436%' or t1.nm like '3437%' or t1.nm like '3439%' or t1.nm like '3440%' or t1.nm like '3441%' or t1.nm like '3442%' or t1.nm like '3443%' or t1.nm like '3444%' or t1.nm like '3445%' or t1.nm like '3446%' or t1.nm like '3447%' or t1.nm like '3448%'" + } + } + ] + } +} +drop table t0; +set optimizer_switch='rowid_filter=default'; +drop table name, flag2; +drop table t1; set @@use_stat_tables=@save_use_stat_tables; SET GLOBAL innodb_stats_persistent=@save_stats_persistent; # @@ -2340,6 +2797,10 @@ insert into t1 values (81,'a','a',20),(82,'a','a',0),(83,'a','a',0),(84,'a','a',null), (85,'a','a',-1),(86,'a','a',5),(87,'a','a',null),(88,'a','a',160), (89,null,null,null),(90,'a','a',14785),(91,'a','a',0),(92,'a','a',null); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK ( select * from t1 where (f1 is null and f2 is null) and (f2 between 'a' and 'z' or f1 in ('a'))) union @@ -2449,7 +2910,7 @@ id y x explain extended select * from t1 join t2 on t1.id = t2.x where t2.y = 2 and t1.id = 1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 100.00 Using index -1 SIMPLE t2 ref x,y y 5 const 2 100.00 Using where +1 SIMPLE t2 index_merge x,y y,x 5,5 NULL 1 100.00 Using intersect(y,x); Using where; Using index Warnings: Note 1003 select 1 AS `id`,`test`.`t2`.`y` AS `y`,`test`.`t2`.`x` AS `x` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`y` = 2 and `test`.`t2`.`x` = 1 drop table t1, t2; @@ -2458,46 +2919,44 @@ drop table t1, t2; # create table t1 (a int, b int, key (b), key (a)) engine=innodb; insert into t1 -select (rand(1)*1000)/10, (rand(1001)*1000)/50 from seq_1_to_1000; +select (rand(1)*1000)/10, (rand(1001)*1000)/20 from seq_1_to_1000; analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK set @save_optimizer_switch= @@optimizer_switch; set optimizer_switch='rowid_filter=off'; -select count(*) from t1 where a in (22,83,11) and b=2; +select count(*) from t1 where a between 21 and 30 and b=2; count(*) -6 -explain extended select count(*) from t1 where a in (22,83,11) and b=2; +5 +explain extended select count(*) from t1 where a between 21 and 30 and b=2; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range b,a a 5 NULL 33 5.90 Using index condition; Using where +1 SIMPLE t1 ref b,a b 5 const 24 9.60 Using where Warnings: -Note 1003 select count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` in (22,83,11) -select * from t1 where a in (22,83,11) and b=2; +Note 1003 select count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` between 21 and 30 +select * from t1 where a between 21 and 30 and b=2; a b -11 2 -11 2 -11 2 +30 2 +21 2 22 2 -83 2 -83 2 +26 2 +25 2 set optimizer_switch='rowid_filter=on'; -select count(*) from t1 where a in (22,83,11) and b=2; +select count(*) from t1 where a between 21 and 30 and b=2; count(*) -6 -explain extended select count(*) from t1 where a in (22,83,11) and b=2; +5 +explain extended select count(*) from t1 where a between 21 and 30 and b=2; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref|filter b,a b|a 5|5 const 59 (3%) 3.30 Using where; Using rowid filter +1 SIMPLE t1 ref b,a b 5 const 24 9.60 Using where Warnings: -Note 1003 select count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` in (22,83,11) -select * from t1 where a in (22,83,11) and b=2; +Note 1003 select count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` between 21 and 30 +select * from t1 where a between 21 and 30 and b=2; a b -11 2 -11 2 -83 2 -11 2 -83 2 +30 2 +21 2 22 2 +26 2 +25 2 drop table t1; set optimizer_switch=@save_optimizer_switch; SET SESSION DEFAULT_STORAGE_ENGINE=DEFAULT; @@ -2652,7 +3111,7 @@ set global innodb_stats_persistent= @stats.save; # CREATE TABLE t1 ( id int(11) unsigned NOT NULL AUTO_INCREMENT, -domain varchar(255) NOT NULL, +domain varchar(32) NOT NULL, registrant_name varchar(255) DEFAULT NULL, registrant_organization varchar(255) DEFAULT NULL, registrant_street1 varchar(255) DEFAULT NULL, @@ -2743,21 +3202,216 @@ null, 'SUELZBURGSTRASSE 158A', null, null, null, null, 'KOELN', '50937', 'MAXIMILIAN V. KETELHODT', null, 'SUELZBURGSTRASSE 158A', null, null, null, null, 'KOELN', '50937', 'GERMANY', 'ICANN@EXPIRES-2009.WEBCARE24.COM', '492214307580', '', '2017-01-30 10:08:29'); +INSERT INTO t1 ( +domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp) +VALUES +('www.mailhost.i-dev.fr', null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, '', '2016-12-22 09:18:28'); +INSERT INTO t1 ( +domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp) +VALUES +('www.mailhost.i-dev.fr', null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, '', '2016-12-22 09:18:28'); +INSERT INTO t1 ( +domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp) +VALUES +('www.mailhost.i-dev.fr', null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, '', '2016-12-22 09:18:28'); +INSERT INTO t1 ( +domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp) +VALUES +('www.mailhost.i-dev.fr', null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, '', '2016-12-22 09:18:28'); +INSERT INTO t1 ( +domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp) +VALUES +('www.mailhost.i-dev.fr', null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, '', '2016-12-22 09:18:28'); +INSERT INTO t1 ( +domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp) +VALUES +('www.mailhost.i-dev.fr', null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, '', '2016-12-22 09:18:28'); +INSERT INTO t1 ( +domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp) +VALUES +('www.mailhost.i-dev.fr', null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, '', '2016-12-22 09:18:28'); +INSERT INTO t1 ( +domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp) +VALUES +('www.mailhost.i-dev.fr', null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, '', '2016-12-22 09:18:28'); +INSERT INTO t1 ( +domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp) +SELECT +domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp +FROM t1; +INSERT INTO t1 ( +domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp) +SELECT +domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp +FROM t1; +ANALYZE TABLE t1 PERSISTENT FOR ALL; +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 'json' +test.t1 analyze status OK SET @save_optimizer_switch=@@optimizer_switch; SET optimizer_switch='mrr=on,mrr_sort_keys=on'; SELECT * FROM t1 WHERE 1 = 1 AND domain = 'www.mailhost.i-dev.fr' AND -timestamp >= DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -1 MONTH) +timestamp >= DATE_ADD('2017-01-30 08:24:51', INTERVAL -1 MONTH) ORDER BY timestamp DESC; id domain registrant_name registrant_organization registrant_street1 registrant_street2 registrant_street3 registrant_street4 registrant_street5 registrant_city registrant_postal_code registrant_country registrant_email registrant_telephone administrative_name administrative_organization administrative_street1 administrative_street2 administrative_street3 administrative_street4 administrative_street5 administrative_city administrative_postal_code administrative_country administrative_email administrative_telephone technical_name technical_organization technical_street1 technical_street2 technical_street3 technical_street4 technical_street5 technical_city technical_postal_code technical_country technical_email technical_telephone json timestamp +80551 www.mailhost.i-dev.fr NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 2017-01-30 10:00:56 +80579 www.mailhost.i-dev.fr NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 2017-01-30 10:00:56 +80594 www.mailhost.i-dev.fr NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 2017-01-30 10:00:56 +80609 www.mailhost.i-dev.fr NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 2017-01-30 10:00:56 EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1 = 1 AND domain = 'www.mailhost.i-dev.fr' AND -timestamp >= DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -1 MONTH) +timestamp >= DATE_ADD('2017-01-30 08:24:51', INTERVAL -1 MONTH) ORDER BY timestamp DESC; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref|filter ixEventWhoisDomainDomain,ixEventWhoisDomainTimestamp ixEventWhoisDomainDomain|ixEventWhoisDomainTimestamp 767|4 const 2 (14%) 14.29 Using index condition; Using where; Using filesort; Using rowid filter +1 SIMPLE t1 ALL ixEventWhoisDomainDomain,ixEventWhoisDomainTimestamp NULL NULL NULL 60 22.22 Using where; Using filesort Warnings: -Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`domain` AS `domain`,`test`.`t1`.`registrant_name` AS `registrant_name`,`test`.`t1`.`registrant_organization` AS `registrant_organization`,`test`.`t1`.`registrant_street1` AS `registrant_street1`,`test`.`t1`.`registrant_street2` AS `registrant_street2`,`test`.`t1`.`registrant_street3` AS `registrant_street3`,`test`.`t1`.`registrant_street4` AS `registrant_street4`,`test`.`t1`.`registrant_street5` AS `registrant_street5`,`test`.`t1`.`registrant_city` AS `registrant_city`,`test`.`t1`.`registrant_postal_code` AS `registrant_postal_code`,`test`.`t1`.`registrant_country` AS `registrant_country`,`test`.`t1`.`registrant_email` AS `registrant_email`,`test`.`t1`.`registrant_telephone` AS `registrant_telephone`,`test`.`t1`.`administrative_name` AS `administrative_name`,`test`.`t1`.`administrative_organization` AS `administrative_organization`,`test`.`t1`.`administrative_street1` AS `administrative_street1`,`test`.`t1`.`administrative_street2` AS `administrative_street2`,`test`.`t1`.`administrative_street3` AS `administrative_street3`,`test`.`t1`.`administrative_street4` AS `administrative_street4`,`test`.`t1`.`administrative_street5` AS `administrative_street5`,`test`.`t1`.`administrative_city` AS `administrative_city`,`test`.`t1`.`administrative_postal_code` AS `administrative_postal_code`,`test`.`t1`.`administrative_country` AS `administrative_country`,`test`.`t1`.`administrative_email` AS `administrative_email`,`test`.`t1`.`administrative_telephone` AS `administrative_telephone`,`test`.`t1`.`technical_name` AS `technical_name`,`test`.`t1`.`technical_organization` AS `technical_organization`,`test`.`t1`.`technical_street1` AS `technical_street1`,`test`.`t1`.`technical_street2` AS `technical_street2`,`test`.`t1`.`technical_street3` AS `technical_street3`,`test`.`t1`.`technical_street4` AS `technical_street4`,`test`.`t1`.`technical_street5` AS `technical_street5`,`test`.`t1`.`technical_city` AS `technical_city`,`test`.`t1`.`technical_postal_code` AS `technical_postal_code`,`test`.`t1`.`technical_country` AS `technical_country`,`test`.`t1`.`technical_email` AS `technical_email`,`test`.`t1`.`technical_telephone` AS `technical_telephone`,`test`.`t1`.`json` AS `json`,`test`.`t1`.`timestamp` AS `timestamp` from `test`.`t1` where `test`.`t1`.`domain` = 'www.mailhost.i-dev.fr' and `test`.`t1`.`timestamp` >= (current_timestamp() + interval -1 month) order by `test`.`t1`.`timestamp` desc +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`domain` AS `domain`,`test`.`t1`.`registrant_name` AS `registrant_name`,`test`.`t1`.`registrant_organization` AS `registrant_organization`,`test`.`t1`.`registrant_street1` AS `registrant_street1`,`test`.`t1`.`registrant_street2` AS `registrant_street2`,`test`.`t1`.`registrant_street3` AS `registrant_street3`,`test`.`t1`.`registrant_street4` AS `registrant_street4`,`test`.`t1`.`registrant_street5` AS `registrant_street5`,`test`.`t1`.`registrant_city` AS `registrant_city`,`test`.`t1`.`registrant_postal_code` AS `registrant_postal_code`,`test`.`t1`.`registrant_country` AS `registrant_country`,`test`.`t1`.`registrant_email` AS `registrant_email`,`test`.`t1`.`registrant_telephone` AS `registrant_telephone`,`test`.`t1`.`administrative_name` AS `administrative_name`,`test`.`t1`.`administrative_organization` AS `administrative_organization`,`test`.`t1`.`administrative_street1` AS `administrative_street1`,`test`.`t1`.`administrative_street2` AS `administrative_street2`,`test`.`t1`.`administrative_street3` AS `administrative_street3`,`test`.`t1`.`administrative_street4` AS `administrative_street4`,`test`.`t1`.`administrative_street5` AS `administrative_street5`,`test`.`t1`.`administrative_city` AS `administrative_city`,`test`.`t1`.`administrative_postal_code` AS `administrative_postal_code`,`test`.`t1`.`administrative_country` AS `administrative_country`,`test`.`t1`.`administrative_email` AS `administrative_email`,`test`.`t1`.`administrative_telephone` AS `administrative_telephone`,`test`.`t1`.`technical_name` AS `technical_name`,`test`.`t1`.`technical_organization` AS `technical_organization`,`test`.`t1`.`technical_street1` AS `technical_street1`,`test`.`t1`.`technical_street2` AS `technical_street2`,`test`.`t1`.`technical_street3` AS `technical_street3`,`test`.`t1`.`technical_street4` AS `technical_street4`,`test`.`t1`.`technical_street5` AS `technical_street5`,`test`.`t1`.`technical_city` AS `technical_city`,`test`.`t1`.`technical_postal_code` AS `technical_postal_code`,`test`.`t1`.`technical_country` AS `technical_country`,`test`.`t1`.`technical_email` AS `technical_email`,`test`.`t1`.`technical_telephone` AS `technical_telephone`,`test`.`t1`.`json` AS `json`,`test`.`t1`.`timestamp` AS `timestamp` from `test`.`t1` where `test`.`t1`.`domain` = 'www.mailhost.i-dev.fr' and `test`.`t1`.`timestamp` >= ('2017-01-30 08:24:51' + interval -1 month) order by `test`.`t1`.`timestamp` desc SET optimizer_switch=@save_optimizer_switch; DROP TABLE t1; # @@ -2919,6 +3573,10 @@ insert into filt(id,aceid,clid,fh) values (6341490487802728361,6341490487802728360,1,1291319099896431785), (6341490487802728362,6341490487802728360,1,8948400944397203540), (6341490487802728363,6341490487802728361,1,6701841652906431497); +insert into filt select id+10000,aceid,clid,fh from filt; +insert into filt select id+20000,aceid,clid,fh from filt; +insert into filt select id+40000,aceid,clid,fh from filt; +insert into filt select id+80000,aceid,clid,fh from filt; analyze table filt, acei, acli; Table Op Msg_type Msg_text test.filt analyze status Engine-independent statistics collected @@ -2943,7 +3601,7 @@ fi.fh in (6311439873746261694,-397087483897438286, id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index 1 SIMPLE a ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where -1 SIMPLE fi ref filt_aceid,filt_fh filt_aceid 8 test.a.id 1 17.14 Using where +1 SIMPLE fi ref filt_aceid,filt_fh filt_aceid 8 test.a.id 24 14.46 Using where Warnings: Note 1003 select `test`.`t`.`id` AS `id`,`test`.`fi`.`id` AS `id`,`test`.`fi`.`aceid` AS `aceid`,`test`.`fi`.`clid` AS `clid`,`test`.`fi`.`fh` AS `fh` from `test`.`acli` `t` join `test`.`acei` `a` join `test`.`filt` `fi` where `test`.`t`.`tp` = 121 and `test`.`a`.`atp` = 1 and `test`.`fi`.`aceid` = `test`.`a`.`id` and `test`.`a`.`aclid` = `test`.`t`.`id` and `test`.`t`.`rid` = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and `test`.`fi`.`fh` in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774) set statement optimizer_switch='rowid_filter=off' for select t.id, fi.* @@ -2958,6 +3616,36 @@ fi.fh in (6311439873746261694,-397087483897438286, id id aceid clid fh 3080602882609775594 3080602882609775600 3080602882609775598 1 6311439873746261694 3080602882609775594 3080602882609775601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609785600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609785601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609795600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609795601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609805600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609805601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609815600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609815601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609825600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609825601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609835600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609835601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609845600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609845601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609855600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609855601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609865600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609865601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609875600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609875601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609885600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609885601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609895600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609895601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609905600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609905601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609915600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609915601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609925600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609925601 3080602882609775598 1 6311439873746261694 set statement optimizer_switch='rowid_filter=on' for explain extended select t.id, fi.* from (acli t inner join acei a on a.aclid = t.id) inner join filt fi on a.id = fi.aceid @@ -2970,7 +3658,7 @@ fi.fh in (6311439873746261694,-397087483897438286, id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index 1 SIMPLE a ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where -1 SIMPLE fi ref|filter filt_aceid,filt_fh filt_aceid|filt_fh 8|8 test.a.id 1 (17%) 17.14 Using where; Using rowid filter +1 SIMPLE fi ref filt_aceid,filt_fh filt_aceid 8 test.a.id 24 14.46 Using where Warnings: Note 1003 select `test`.`t`.`id` AS `id`,`test`.`fi`.`id` AS `id`,`test`.`fi`.`aceid` AS `aceid`,`test`.`fi`.`clid` AS `clid`,`test`.`fi`.`fh` AS `fh` from `test`.`acli` `t` join `test`.`acei` `a` join `test`.`filt` `fi` where `test`.`t`.`tp` = 121 and `test`.`a`.`atp` = 1 and `test`.`fi`.`aceid` = `test`.`a`.`id` and `test`.`a`.`aclid` = `test`.`t`.`id` and `test`.`t`.`rid` = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and `test`.`fi`.`fh` in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774) set statement optimizer_switch='rowid_filter=on' for select t.id, fi.* @@ -2985,6 +3673,36 @@ fi.fh in (6311439873746261694,-397087483897438286, id id aceid clid fh 3080602882609775594 3080602882609775600 3080602882609775598 1 6311439873746261694 3080602882609775594 3080602882609775601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609785600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609785601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609795600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609795601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609805600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609805601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609815600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609815601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609825600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609825601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609835600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609835601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609845600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609845601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609855600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609855601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609865600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609865601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609875600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609875601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609885600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609885601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609895600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609895601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609905600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609905601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609915600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609915601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609925600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609925601 3080602882609775598 1 6311439873746261694 set optimizer_switch='mrr=on'; set join_cache_level=6; set statement optimizer_switch='rowid_filter=off' for explain extended select t.id, fi.* @@ -2999,7 +3717,7 @@ fi.fh in (6311439873746261694,-397087483897438286, id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index 1 SIMPLE a ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where; Using join buffer (flat, BKA join); Rowid-ordered scan -1 SIMPLE fi ref filt_aceid,filt_fh filt_aceid 8 test.a.id 1 17.14 Using where; Using join buffer (incremental, BKA join); Rowid-ordered scan +1 SIMPLE fi ref filt_aceid,filt_fh filt_aceid 8 test.a.id 24 14.46 Using where; Using join buffer (incremental, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t`.`id` AS `id`,`test`.`fi`.`id` AS `id`,`test`.`fi`.`aceid` AS `aceid`,`test`.`fi`.`clid` AS `clid`,`test`.`fi`.`fh` AS `fh` from `test`.`acli` `t` join `test`.`acei` `a` join `test`.`filt` `fi` where `test`.`t`.`tp` = 121 and `test`.`a`.`atp` = 1 and `test`.`fi`.`aceid` = `test`.`a`.`id` and `test`.`a`.`aclid` = `test`.`t`.`id` and `test`.`t`.`rid` = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and `test`.`fi`.`fh` in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774) set statement optimizer_switch='rowid_filter=off' for select t.id, fi.* @@ -3014,6 +3732,36 @@ fi.fh in (6311439873746261694,-397087483897438286, id id aceid clid fh 3080602882609775594 3080602882609775600 3080602882609775598 1 6311439873746261694 3080602882609775594 3080602882609775601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609785600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609785601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609795600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609795601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609805600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609805601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609815600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609815601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609825600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609825601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609835600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609835601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609845600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609845601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609855600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609855601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609865600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609865601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609875600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609875601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609885600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609885601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609895600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609895601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609905600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609905601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609915600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609915601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609925600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609925601 3080602882609775598 1 6311439873746261694 set statement optimizer_switch='rowid_filter=on' for explain extended select t.id, fi.* from (acli t inner join acei a on a.aclid = t.id) inner join filt fi on a.id = fi.aceid @@ -3026,7 +3774,7 @@ fi.fh in (6311439873746261694,-397087483897438286, id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index 1 SIMPLE a ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where; Using join buffer (flat, BKA join); Rowid-ordered scan -1 SIMPLE fi ref|filter filt_aceid,filt_fh filt_aceid|filt_fh 8|8 test.a.id 1 (17%) 17.14 Using where; Using join buffer (incremental, BKA join); Rowid-ordered scan; Using rowid filter +1 SIMPLE fi ref filt_aceid,filt_fh filt_aceid 8 test.a.id 24 14.46 Using where; Using join buffer (incremental, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t`.`id` AS `id`,`test`.`fi`.`id` AS `id`,`test`.`fi`.`aceid` AS `aceid`,`test`.`fi`.`clid` AS `clid`,`test`.`fi`.`fh` AS `fh` from `test`.`acli` `t` join `test`.`acei` `a` join `test`.`filt` `fi` where `test`.`t`.`tp` = 121 and `test`.`a`.`atp` = 1 and `test`.`fi`.`aceid` = `test`.`a`.`id` and `test`.`a`.`aclid` = `test`.`t`.`id` and `test`.`t`.`rid` = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and `test`.`fi`.`fh` in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774) set statement optimizer_switch='rowid_filter=on' for select t.id, fi.* @@ -3041,6 +3789,36 @@ fi.fh in (6311439873746261694,-397087483897438286, id id aceid clid fh 3080602882609775594 3080602882609775600 3080602882609775598 1 6311439873746261694 3080602882609775594 3080602882609775601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609785600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609785601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609795600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609795601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609805600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609805601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609815600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609815601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609825600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609825601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609835600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609835601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609845600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609845601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609855600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609855601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609865600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609865601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609875600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609875601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609885600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609885601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609895600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609895601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609905600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609905601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609915600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609915601 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609925600 3080602882609775598 1 6311439873746261694 +3080602882609775594 3080602882609925601 3080602882609775598 1 6311439873746261694 set statement optimizer_switch='rowid_filter=on' for analyze format=json select t.id, fi.* from (acli t inner join acei a on a.aclid = t.id) inner join filt fi on a.id = fi.aceid @@ -3113,7 +3891,11 @@ ANALYZE "join_type": "BKA", "mrr_type": "Rowid-ordered scan", "attached_condition": "a.atp = 1", - "r_filtered": 100 + "r_loops": 3, + "r_filtered": 100, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 1 } }, { @@ -3126,32 +3908,24 @@ ANALYZE "key_length": "8", "used_key_parts": ["aceid"], "ref": ["test.a.id"], - "rowid_filter": { - "range": { - "key": "filt_fh", - "used_key_parts": ["fh"] - }, - "rows": 6, - "selectivity_pct": 17.14285714, - "r_rows": 5, - "r_selectivity_pct": 40, - "r_buffer_size": "REPLACED", - "r_filling_time_ms": "REPLACED" - }, "r_loops": 1, - "rows": 1, - "r_rows": 2, + "rows": 24, + "r_rows": 80, "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", - "filtered": 17.1428566, + "filtered": 14.46428585, "r_filtered": 100 }, "buffer_type": "incremental", - "buffer_size": "603", + "buffer_size": "4Kb", "join_type": "BKA", "mrr_type": "Rowid-ordered scan", "attached_condition": "fi.fh in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774)", - "r_filtered": 100 + "r_loops": 3, + "r_filtered": 40, + "r_unpack_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_effective_rows": 26.66666667 } } ] @@ -3161,3 +3935,109 @@ set optimizer_switch=@save_optimizer_switch; set join_cache_level=@save_join_cache_level; drop table filt, acei, acli; set global innodb_stats_persistent= @stats.save; +# +# MDEV-22846: ref access with full scan on keys with NULLs + rowid_filter +# +set @stats.save= @@innodb_stats_persistent; +set global innodb_stats_persistent=0; +CREATE TABLE t1 (pk int NOT NULL, c1 varchar(1)) engine=innodb; +INSERT INTO t1 VALUES +(1,NULL),(15,'o'),(16,'x'),(19,'t'),(35,'k'),(36,'h'),(42,'t'),(43,'h'), +(53,'l'),(62,'a'),(71,NULL),(79,'u'),(128,'y'),(129,NULL),(133,NULL); +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +CREATE TABLE t2 ( +i1 int, c1 varchar(1) NOT NULL, +filler1 char(255) default '0', filler2 char(255) default '0', +KEY c1 (c1), KEY i1 (i1) +) engine=innodb; +INSERT INTO t2(i1,c1) VALUES +(NULL,'1'),(1,'1'),(2,'t'),(3,'1'),(4,'u'),(5,'1'), +(6,'4'),(7,'4'),(8,'1'),(1,'u'),(2,'1'),(NULL,'w'); +INSERT INTO t2 SELECT * FROM t2; +INSERT INTO t2 SELECT * FROM t2; +INSERT INTO t2 SELECT * FROM t2; +INSERT INTO t2 SELECT * FROM t2; +ANALYZE TABLE t1,t2 PERSISTENT FOR ALL; +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 +SELECT * FROM t1 +WHERE t1.c1 NOT IN (SELECT t2.c1 FROM t2, t1 AS a1 +WHERE t2.i1 = t1.pk AND t2.i1 BETWEEN 3 AND 5); +pk c1 +1 NULL +15 o +16 x +19 t +35 k +36 h +42 t +43 h +53 l +62 a +71 NULL +79 u +128 y +129 NULL +133 NULL +1 NULL +15 o +16 x +19 t +35 k +36 h +42 t +43 h +53 l +62 a +71 NULL +79 u +128 y +129 NULL +133 NULL +1 NULL +15 o +16 x +19 t +35 k +36 h +42 t +43 h +53 l +62 a +71 NULL +79 u +128 y +129 NULL +133 NULL +1 NULL +15 o +16 x +19 t +35 k +36 h +42 t +43 h +53 l +62 a +71 NULL +79 u +128 y +129 NULL +133 NULL +EXPLAIN EXTENDED SELECT * FROM t1 +WHERE t1.c1 NOT IN (SELECT t2.c1 FROM t2, t1 AS a1 +WHERE t2.i1 = t1.pk AND t2.i1 BETWEEN 3 AND 5); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 60 100.00 Using where +2 DEPENDENT SUBQUERY t2 ref c1,i1 i1 5 test.t1.pk 20 100.00 Using index condition; Using where +2 DEPENDENT SUBQUERY a1 ALL NULL NULL NULL NULL 60 100.00 Using join buffer (flat, BNL join) +Warnings: +Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1 +Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1` AS `c1` from `test`.`t1` where !<`test`.`t1`.`c1`,`test`.`t1`.`pk`>((`test`.`t1`.`c1`,(/* select#2 */ select `test`.`t2`.`c1` from `test`.`t2` join `test`.`t1` `a1` where `test`.`t2`.`i1` = `test`.`t1`.`pk` and `test`.`t2`.`i1` between 3 and 5 and trigcond((`test`.`t1`.`c1`) = `test`.`t2`.`c1`)))) +DROP TABLE t1,t2; +set global innodb_stats_persistent= @stats.save; +# End of 10.4 tests diff --git a/mysql-test/main/rowid_filter_innodb.test b/mysql-test/main/rowid_filter_innodb.test index bc5518eba8d37..8705a0c9a1267 100644 --- a/mysql-test/main/rowid_filter_innodb.test +++ b/mysql-test/main/rowid_filter_innodb.test @@ -1,3 +1,4 @@ +--source include/no_valgrind_without_big.inc --source include/have_innodb.inc SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB'; @@ -37,6 +38,8 @@ insert into t1 values (85,'a','a',-1),(86,'a','a',5),(87,'a','a',null),(88,'a','a',160), (89,null,null,null),(90,'a','a',14785),(91,'a','a',0),(92,'a','a',null); +analyze table t1; + let $q= ( select * from t1 where (f1 is null and f2 is null) and (f2 between 'a' and 'z' or f1 in ('a'))) @@ -78,13 +81,13 @@ drop table t1, t2; create table t1 (a int, b int, key (b), key (a)) engine=innodb; insert into t1 -select (rand(1)*1000)/10, (rand(1001)*1000)/50 from seq_1_to_1000; +select (rand(1)*1000)/10, (rand(1001)*1000)/20 from seq_1_to_1000; analyze table t1; let $q= -select count(*) from t1 where a in (22,83,11) and b=2; +select count(*) from t1 where a between 21 and 30 and b=2; let $q1= -select * from t1 where a in (22,83,11) and b=2; +select * from t1 where a between 21 and 30 and b=2; set @save_optimizer_switch= @@optimizer_switch; @@ -229,7 +232,7 @@ set global innodb_stats_persistent= @stats.save; CREATE TABLE t1 ( id int(11) unsigned NOT NULL AUTO_INCREMENT, - domain varchar(255) NOT NULL, + domain varchar(32) NOT NULL, registrant_name varchar(255) DEFAULT NULL, registrant_organization varchar(255) DEFAULT NULL, registrant_street1 varchar(255) DEFAULT NULL, @@ -322,6 +325,66 @@ technical_email, technical_telephone, json, timestamp) VALUES null, 'KOELN', '50937', 'GERMANY', 'ICANN@EXPIRES-2009.WEBCARE24.COM', '492214307580', '', '2017-01-30 10:08:29'); +let $sqi= +INSERT INTO t1 ( +domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp) +VALUES +('www.mailhost.i-dev.fr', null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, '', '2016-12-22 09:18:28'); + +eval $sqi; +eval $sqi; +eval $sqi; +eval $sqi; +eval $sqi; +eval $sqi; +eval $sqi; +eval $sqi; + +let $qi= +INSERT INTO t1 ( +domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp) +SELECT +domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp +FROM t1; + +eval $qi; +eval $qi; + +ANALYZE TABLE t1 PERSISTENT FOR ALL; + SET @save_optimizer_switch=@@optimizer_switch; SET optimizer_switch='mrr=on,mrr_sort_keys=on'; @@ -329,7 +392,7 @@ SET optimizer_switch='mrr=on,mrr_sort_keys=on'; let $q= SELECT * FROM t1 WHERE 1 = 1 AND domain = 'www.mailhost.i-dev.fr' AND - timestamp >= DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -1 MONTH) + timestamp >= DATE_ADD('2017-01-30 08:24:51', INTERVAL -1 MONTH) ORDER BY timestamp DESC; eval $q; @@ -502,6 +565,11 @@ insert into filt(id,aceid,clid,fh) values (6341490487802728362,6341490487802728360,1,8948400944397203540), (6341490487802728363,6341490487802728361,1,6701841652906431497); +insert into filt select id+10000,aceid,clid,fh from filt; +insert into filt select id+20000,aceid,clid,fh from filt; +insert into filt select id+40000,aceid,clid,fh from filt; +insert into filt select id+80000,aceid,clid,fh from filt; + analyze table filt, acei, acli; let $q= @@ -540,3 +608,46 @@ set join_cache_level=@save_join_cache_level; drop table filt, acei, acli; set global innodb_stats_persistent= @stats.save; + +--echo # +--echo # MDEV-22846: ref access with full scan on keys with NULLs + rowid_filter +--echo # + +set @stats.save= @@innodb_stats_persistent; +set global innodb_stats_persistent=0; + +CREATE TABLE t1 (pk int NOT NULL, c1 varchar(1)) engine=innodb; +INSERT INTO t1 VALUES +(1,NULL),(15,'o'),(16,'x'),(19,'t'),(35,'k'),(36,'h'),(42,'t'),(43,'h'), +(53,'l'),(62,'a'),(71,NULL),(79,'u'),(128,'y'),(129,NULL),(133,NULL); +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; + +CREATE TABLE t2 ( +i1 int, c1 varchar(1) NOT NULL, +filler1 char(255) default '0', filler2 char(255) default '0', +KEY c1 (c1), KEY i1 (i1) +) engine=innodb; +INSERT INTO t2(i1,c1) VALUES +(NULL,'1'),(1,'1'),(2,'t'),(3,'1'),(4,'u'),(5,'1'), +(6,'4'),(7,'4'),(8,'1'),(1,'u'),(2,'1'),(NULL,'w'); +INSERT INTO t2 SELECT * FROM t2; +INSERT INTO t2 SELECT * FROM t2; +INSERT INTO t2 SELECT * FROM t2; +INSERT INTO t2 SELECT * FROM t2; + +ANALYZE TABLE t1,t2 PERSISTENT FOR ALL; + +let $q= +SELECT * FROM t1 +WHERE t1.c1 NOT IN (SELECT t2.c1 FROM t2, t1 AS a1 + WHERE t2.i1 = t1.pk AND t2.i1 BETWEEN 3 AND 5); + +eval $q; +eval EXPLAIN EXTENDED $q; + +DROP TABLE t1,t2; + +set global innodb_stats_persistent= @stats.save; + +--echo # End of 10.4 tests diff --git a/mysql-test/main/rowid_filter_innodb_debug.result b/mysql-test/main/rowid_filter_innodb_debug.result index 6fd75294bdb54..f82b29aa1e662 100644 --- a/mysql-test/main/rowid_filter_innodb_debug.result +++ b/mysql-test/main/rowid_filter_innodb_debug.result @@ -2,12 +2,8 @@ set default_storage_engine=innodb; # # MDEV-22761 KILL QUERY during rowid_filter, crashes # -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(a int); -insert into t2 select A.a + B.a* 10 from t0 A, t0 B; +insert into t2 select * from seq_0_to_99; CREATE TABLE t3 ( key1 int , key2 int, @@ -21,11 +17,10 @@ engine InnoDB insert into t3 select -A.a, -A.a, +A.seq, +B.seq, 'filler-data-filler-data' -from -t0 A, t1 B; +from seq_0_to_99 A, seq_0_to_99 B; analyze table t2,t3; Table Op Msg_type Msg_text test.t2 analyze status Engine-independent statistics collected @@ -38,13 +33,12 @@ where t3.key1=t2.a and t3.key2 in (2,3); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 100 Using where -1 SIMPLE t3 ref|filter key1,key2 key1|key2 5|5 test.t2.a 1000 (20%) Using where; Using rowid filter +1 SIMPLE t3 ref|filter key1,key2 key1|key2 5|5 test.t2.a 100 (2%) Using where; Using rowid filter set debug_sync='handler_rowid_filter_check SIGNAL at_rowid_filter_check WAIT_FOR go'; select * from t2, t3 where t3.key1=t2.a and t3.key2 in (2,3); connect con1, localhost, root,,; -connection con1; set debug_sync='now WAIT_FOR at_rowid_filter_check'; kill query $target_id; set debug_sync='now SIGNAL go'; @@ -52,32 +46,5 @@ connection default; disconnect con1; ERROR 70100: Query execution was interrupted set debug_sync='RESET'; -drop table t0,t1,t2,t3; +drop table t2,t3; set default_storage_engine=default; -set @save_optimizer_switch= @@optimizer_switch; -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=2; -set optimizer_switch='rowid_filter=on'; -# -# MDEV-22761 KILL QUERY during rowid_filter, crashes -# (The smaller testcase) -# -CREATE TABLE t1 (a INT, b INT, INDEX(a), INDEX(b)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (0,0),(1,0),(-1,1), (-2,1), (-2,3), (-3,4), (-2,4); -set debug_sync='handler_rowid_filter_check SIGNAL killme WAIT_FOR go'; -SELECT * FROM t1 WHERE a > 0 AND b=0; -connect con1, localhost, root,,; -connection con1; -set debug_sync='now WAIT_FOR killme'; -kill query @id; -set debug_sync='now SIGNAL go'; -connection default; -ERROR 70100: Query execution was interrupted -set debug_sync='RESET'; -disconnect con1; -drop table t1; -set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; -set @@optimizer_switch=@save_optimizer_switch; -set @@use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/main/rowid_filter_innodb_debug.test b/mysql-test/main/rowid_filter_innodb_debug.test index eb43edd9e9e6a..60381658eafec 100644 --- a/mysql-test/main/rowid_filter_innodb_debug.test +++ b/mysql-test/main/rowid_filter_innodb_debug.test @@ -1,51 +1,7 @@ --source include/have_innodb.inc +--source include/no_valgrind_without_big.inc set default_storage_engine=innodb; --source include/rowid_filter_debug_kill.inc set default_storage_engine=default; ---source include/default_optimizer_switch.inc ---source include/count_sessions.inc - -set @save_optimizer_switch= @@optimizer_switch; -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=2; -set optimizer_switch='rowid_filter=on'; - ---echo # ---echo # MDEV-22761 KILL QUERY during rowid_filter, crashes ---echo # (The smaller testcase) ---echo # - -CREATE TABLE t1 (a INT, b INT, INDEX(a), INDEX(b)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (0,0),(1,0),(-1,1), (-2,1), (-2,3), (-3,4), (-2,4); - -let $ID= `SELECT @id := CONNECTION_ID()`; - -set debug_sync='handler_rowid_filter_check SIGNAL killme WAIT_FOR go'; -send SELECT * FROM t1 WHERE a > 0 AND b=0; - -connect (con1, localhost, root,,); -connection con1; -let $ignore= `SELECT @id := $ID`; -set debug_sync='now WAIT_FOR killme'; -kill query @id; -set debug_sync='now SIGNAL go'; - -connection default; ---error ER_QUERY_INTERRUPTED -reap; -set debug_sync='RESET'; - -disconnect con1; -drop table t1; - -set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; -set @@optimizer_switch=@save_optimizer_switch; -set @@use_stat_tables=@save_use_stat_tables; - ---source include/wait_until_count_sessions.inc diff --git a/mysql-test/main/rowid_filter_myisam_debug.result b/mysql-test/main/rowid_filter_myisam_debug.result index 16fcb2a416ea1..75a8fad6947a1 100644 --- a/mysql-test/main/rowid_filter_myisam_debug.result +++ b/mysql-test/main/rowid_filter_myisam_debug.result @@ -1,12 +1,8 @@ # # MDEV-22761 KILL QUERY during rowid_filter, crashes # -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(a int); -insert into t2 select A.a + B.a* 10 from t0 A, t0 B; +insert into t2 select * from seq_0_to_99; CREATE TABLE t3 ( key1 int , key2 int, @@ -20,11 +16,10 @@ engine MyISAM insert into t3 select -A.a, -A.a, +A.seq, +B.seq, 'filler-data-filler-data' -from -t0 A, t1 B; +from seq_0_to_99 A, seq_0_to_99 B; analyze table t2,t3; Table Op Msg_type Msg_text test.t2 analyze status Engine-independent statistics collected @@ -37,13 +32,12 @@ where t3.key1=t2.a and t3.key2 in (2,3); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 100 Using where -1 SIMPLE t3 ref|filter key1,key2 key1|key2 5|5 test.t2.a 1000 (18%) Using where; Using rowid filter +1 SIMPLE t3 ref|filter key1,key2 key1|key2 5|5 test.t2.a 100 (2%) Using where; Using rowid filter set debug_sync='handler_rowid_filter_check SIGNAL at_rowid_filter_check WAIT_FOR go'; select * from t2, t3 where t3.key1=t2.a and t3.key2 in (2,3); connect con1, localhost, root,,; -connection con1; set debug_sync='now WAIT_FOR at_rowid_filter_check'; kill query $target_id; set debug_sync='now SIGNAL go'; @@ -51,4 +45,4 @@ connection default; disconnect con1; ERROR 70100: Query execution was interrupted set debug_sync='RESET'; -drop table t0,t1,t2,t3; +drop table t2,t3; diff --git a/mysql-test/main/rownum.result b/mysql-test/main/rownum.result index 3ad51c93260f3..b61269b1b4742 100644 --- a/mysql-test/main/rownum.result +++ b/mysql-test/main/rownum.result @@ -139,6 +139,13 @@ select * from t1,t2 where t1.a=t2.a and rownum()<=2 order by t1.a,t2.a; a b a b 2 20 2 21 3 30 3 31 +create view v1 as +select * from (select * from t1 order by a desc) as t where rownum() <= 2; +select * from v1; +a b +3 30 +2 20 +drop view v1; # # Having # @@ -984,3 +991,29 @@ next row is 3 3 next row is 5 5 +# +# MDEV-31073: Server crash, assertion `table != 0 && +# view->field_translation != 0' failure with ROWNUM and view +# +CREATE TABLE t (f INT); +INSERT INTO t VALUES (1),(2); +CREATE VIEW v AS SELECT * FROM t; +UPDATE v SET f = 10 WHERE ROWNUM() > 42 LIMIT 1; +DROP VIEW v; +DROP TABLE t; +CREATE TABLE t (f INT); +INSERT INTO t VALUES (1),(2); +CREATE VIEW v AS SELECT f, 3 as e FROM t; +UPDATE v SET f = 10 WHERE e > 42 LIMIT 1; +DROP VIEW v; +DROP TABLE t; +CREATE TABLE t (f INT); +INSERT INTO t VALUES (1),(2); +CREATE VIEW v AS SELECT f, ROWNUM() as e FROM t; +UPDATE v SET f = 10 WHERE e > 42 LIMIT 1; +ERROR HY000: The target table v of the UPDATE is not updatable +DROP VIEW v; +DROP TABLE t; +# +# End of 10.6 tests +# diff --git a/mysql-test/main/rownum.test b/mysql-test/main/rownum.test index 3fe1ac13aac72..291bd9bd99330 100644 --- a/mysql-test/main/rownum.test +++ b/mysql-test/main/rownum.test @@ -58,6 +58,11 @@ select *,rownum() from t1,t2 order by t2.a desc, t1.a desc; select * from (select * from t1 order by a desc) as t where rownum() <= 2; select * from t1,t2 where t1.a=t2.a and rownum()<=2 order by t1.a,t2.a; +create view v1 as +select * from (select * from t1 order by a desc) as t where rownum() <= 2; +select * from v1; +drop view v1; + --echo # --echo # Having --echo # @@ -97,7 +102,10 @@ CREATE TABLE t3 ( b varchar(1024) DEFAULT NULL ); insert into t3 select mod(seq*3,20)+1, repeat(char(33+mod(seq,90)),mod(seq,10)*100) from seq_1_to_23; +#chack after fix MDEV-28571 +--disable_view_protocol SELECT sq.a,length(sq.f) FROM (SELECT a, GROUP_CONCAT(b,b) AS f FROM t3 GROUP BY a ORDER BY a desc) as sq WHERE ROWNUM() <= 10; +--enable_view_protocol drop table t3; --echo # @@ -433,6 +441,7 @@ drop table t1; create table t1 (a int); insert into t1 values (1),(2),(3),(4),(5); +--disable_view_protocol let $query= select * from (select a from t1 where a < 1000) as tt where rownum() <= 2; flush status; @@ -481,6 +490,7 @@ eval prepare stmt from "$query"; execute stmt; execute stmt; deallocate prepare stmt; +--enable_view_protocol --echo # Other limit @@ -563,3 +573,40 @@ drop table t1; --echo # Table value constructors --echo # values ("first row"),("next row is 3"),(rownum()),("next row is 5"),(rownum()); + +--echo # +--echo # MDEV-31073: Server crash, assertion `table != 0 && +--echo # view->field_translation != 0' failure with ROWNUM and view +--echo # + +CREATE TABLE t (f INT); +INSERT INTO t VALUES (1),(2); +CREATE VIEW v AS SELECT * FROM t; +UPDATE v SET f = 10 WHERE ROWNUM() > 42 LIMIT 1; + +# Cleanup +DROP VIEW v; +DROP TABLE t; + +CREATE TABLE t (f INT); +INSERT INTO t VALUES (1),(2); +CREATE VIEW v AS SELECT f, 3 as e FROM t; +UPDATE v SET f = 10 WHERE e > 42 LIMIT 1; + +# Cleanup +DROP VIEW v; +DROP TABLE t; + +CREATE TABLE t (f INT); +INSERT INTO t VALUES (1),(2); +CREATE VIEW v AS SELECT f, ROWNUM() as e FROM t; +--error ER_NON_UPDATABLE_TABLE +UPDATE v SET f = 10 WHERE e > 42 LIMIT 1; + +# Cleanup +DROP VIEW v; +DROP TABLE t; + +--echo # +--echo # End of 10.6 tests +--echo # diff --git a/mysql-test/main/schema.result b/mysql-test/main/schema.result index 99ac6c71985b8..74a8bf9b56276 100644 --- a/mysql-test/main/schema.result +++ b/mysql-test/main/schema.result @@ -2,7 +2,7 @@ drop database if exists mysqltest1; create schema foo; show create schema foo; Database Create Database -foo CREATE DATABASE `foo` /*!40100 DEFAULT CHARACTER SET latin1 */ +foo CREATE DATABASE `foo` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ show schemas; Database foo diff --git a/mysql-test/main/second_frac-9175.test b/mysql-test/main/second_frac-9175.test index 91baf99745957..4cda672b8204e 100644 --- a/mysql-test/main/second_frac-9175.test +++ b/mysql-test/main/second_frac-9175.test @@ -2,8 +2,13 @@ # MDEV-9175 Query parser tansforms MICROSECOND into SECOND_FRAC, which does not work # +#enable after fix MDEV-27871 +--disable_view_protocol + select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456'); explain extended select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456'); create view v1 as select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456'); select * from v1; drop view v1; + +--enable_view_protocol diff --git a/mysql-test/main/secure_file_priv_win.result b/mysql-test/main/secure_file_priv_win.result index af402ae95373e..418be1df711e7 100644 --- a/mysql-test/main/secure_file_priv_win.result +++ b/mysql-test/main/secure_file_priv_win.result @@ -1,8 +1,6 @@ CREATE TABLE t1 (c1 longtext); INSERT INTO t1 values ('a'); -SELECT * FROM t1 INTO OUTFILE 'MYSQL_TMP_DIR/B11764517.tmp'; -Warnings: -Warning 1287 ' INTO FROM...' instead +SELECT * INTO OUTFILE 'MYSQL_TMP_DIR/B11764517.tmp' FROM t1; show global variables like 'secure_file_priv'; Variable_name Value secure_file_priv MYSQL_TMP_DIR/ @@ -31,18 +29,10 @@ LOAD DATA INFILE 'MYSQL_TMP_DIR_UCASE/B11764517.tmp' INTO TABLE t1; LOAD DATA INFILE 'MYSQL_TMP_DIR_LCASE/B11764517.tmp' INTO TABLE t1; LOAD DATA INFILE "MYSQL_TMP_DIR\\..a..\\..\\..\\B11764517.tmp" into table t1; ERROR HY000: The MariaDB server is running with the --secure-file-priv option so it cannot execute this statement -SELECT * FROM t1 INTO OUTFILE 'MYSQL_TMP_DIR\\..a..\\..\\..\\B11764517-2.tmp'; +SELECT * INTO OUTFILE 'MYSQL_TMP_DIR\\..a..\\..\\..\\B11764517-2.tmp' FROM t1; ERROR HY000: The MariaDB server is running with the --secure-file-priv option so it cannot execute this statement -SELECT * FROM t1 INTO OUTFILE 'MYSQL_TMP_DIR\\B11764517-2.tmp'; -Warnings: -Warning 1287 ' INTO FROM...' instead -SELECT * FROM t1 INTO OUTFILE 'MYSQL_TMP_DIR/B11764517-3.tmp'; -Warnings: -Warning 1287 ' INTO FROM...' instead -SELECT * FROM t1 INTO OUTFILE 'MYSQL_TMP_DIR_UCASE/B11764517-4.tmp'; -Warnings: -Warning 1287 ' INTO FROM...' instead -SELECT * FROM t1 INTO OUTFILE 'MYSQL_TMP_DIR_LCASE/B11764517-5.tmp'; -Warnings: -Warning 1287 ' INTO FROM...' instead +SELECT * INTO OUTFILE 'MYSQL_TMP_DIR\\B11764517-2.tmp' FROM t1; +SELECT * INTO OUTFILE 'MYSQL_TMP_DIR/B11764517-3.tmp' FROM t1; +SELECT * INTO OUTFILE 'MYSQL_TMP_DIR_UCASE/B11764517-4.tmp' FROM t1; +SELECT * INTO OUTFILE 'MYSQL_TMP_DIR_LCASE/B11764517-5.tmp' FROM t1; DROP TABLE t1; diff --git a/mysql-test/main/secure_file_priv_win.test b/mysql-test/main/secure_file_priv_win.test index a12510974ce02..be5345dc1613d 100644 --- a/mysql-test/main/secure_file_priv_win.test +++ b/mysql-test/main/secure_file_priv_win.test @@ -14,7 +14,7 @@ LET $MYSQL_TMP_DIR_LCASE= `SELECT lower('$MYSQL_TMP_DIR')`; #create the file --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR -eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR/B11764517.tmp'; +eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR/B11764517.tmp' FROM t1; --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR show global variables like 'secure_file_priv'; @@ -52,19 +52,19 @@ eval LOAD DATA INFILE "$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517.tmp" int --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR --error ER_OPTION_PREVENTS_STATEMENT -eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517-2.tmp'; +eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517-2.tmp' FROM t1; --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR -eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR\\\\B11764517-2.tmp'; +eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR\\\\B11764517-2.tmp' FROM t1; --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR -eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR/B11764517-3.tmp'; +eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR/B11764517-3.tmp' FROM t1; --replace_result $MYSQL_TMP_DIR_UCASE MYSQL_TMP_DIR_UCASE -eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR_UCASE/B11764517-4.tmp'; +eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR_UCASE/B11764517-4.tmp' FROM t1; --replace_result $MYSQL_TMP_DIR_LCASE MYSQL_TMP_DIR_LCASE -eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR_LCASE/B11764517-5.tmp'; +eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR_LCASE/B11764517-5.tmp' FROM t1; --error 0,1 --remove_file $MYSQL_TMP_DIR/B11764517.tmp; diff --git a/mysql-test/main/select,ps.rdiff b/mysql-test/main/select,ps.rdiff new file mode 100644 index 0000000000000..7cbcd2be98e8d --- /dev/null +++ b/mysql-test/main/select,ps.rdiff @@ -0,0 +1,12 @@ +--- mysql-test/main/select.result 2023-01-31 09:30:58.151377805 +0100 ++++ mysql-test/main/select.reject 2023-02-01 13:44:11.026958614 +0100 +@@ -5661,6 +5661,8 @@ + Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1249 Select 2 was reduced during optimization ++Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 ++Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and (1 or <`test`.`t1`.`a`>((/* select#3 */ select 3 from DUAL where `test`.`t1`.`a` = `test`.`t1`.`a`)) = 3) + PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3))'; + diff --git a/mysql-test/main/select.result b/mysql-test/main/select.result index 2f051ab33bf1b..abffe58739df0 100644 --- a/mysql-test/main/select.result +++ b/mysql-test/main/select.result @@ -3474,13 +3474,13 @@ INSERT INTO t2 VALUES EXPLAIN SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL c NULL NULL NULL 18 Using where -1 SIMPLE t1 eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using rowid filter +1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using index condition +1 SIMPLE t2 ref c c 5 test.t1.a 2 EXPLAIN SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL c NULL NULL NULL 18 Using where -1 SIMPLE t1 eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using rowid filter +1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using index condition; Using where +1 SIMPLE t2 ref c c 5 test.t1.a 2 DROP TABLE t1, t2; create table t1 ( a int unsigned not null auto_increment primary key, @@ -3793,7 +3793,7 @@ t1 CREATE TABLE `t1` ( `i` decimal(19,0) NOT NULL, `c` decimal(19,0) NOT NULL, `co` decimal(19,0) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select if(1, cast(1111111111111111111 as unsigned), 1) i, @@ -5262,11 +5262,11 @@ SELECT `varchar_nokey` G1 FROM CC WHERE `int_nokey` AND `int_key` <= 4 HAVING G1 ORDER BY `varchar_key` LIMIT 6 ; G1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'z' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'q' -Warning 1292 Truncated incorrect DOUBLE value: 'm' -Warning 1292 Truncated incorrect DOUBLE value: 'j' +Warning 1292 Truncated incorrect DECIMAL value: 'z' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'q' +Warning 1292 Truncated incorrect DECIMAL value: 'm' +Warning 1292 Truncated incorrect DECIMAL value: 'j' DROP TABLE CC; # End of test#45227 # @@ -5593,4 +5593,106 @@ select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined)); (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined)) NULL drop table t1; +# +# Bug MDEV-24262 Server crashes in st_join_table::cleanup upon +# erroneous GROUP_CONCAT +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,10),(2,20); +SELECT b, GROUP_CONCAT(b ORDER BY 2), MIN(a) AS f FROM t1 GROUP BY b ORDER BY f; +ERROR 42S22: Unknown column '2' in 'order clause' +DROP TABLE t1; +# +# Bug MDEV-24560 SIGSEGV in st_join_table::cleanup + server and client +# hang + cross-mysqld-interaction + double free or corruption (!prev) +# +CREATE TABLE t1 (c INT); +SET SESSION sql_buffer_result=1; +SELECT GROUP_CONCAT(c ORDER BY 2) FROM t1; +GROUP_CONCAT(c ORDER BY 2) +NULL +SELECT GROUP_CONCAT(c ORDER BY 0) FROM t1; +GROUP_CONCAT(c ORDER BY 0) +NULL +DROP TABLE t1; +CREATE TABLE t1 (grp INT,c CHAR); +SET sql_buffer_result=1; +SELECT grp,GROUP_CONCAT(c ORDER BY 2) FROM t1 GROUP BY grp; +grp GROUP_CONCAT(c ORDER BY 2) +DROP TABLE t1; +# +# Bug MDEV-28077 "Wrong create options" with "big_tables" option enabled +# +CREATE TABLE t1(a VARCHAR(16383) CHARACTER SET UTF32, KEY k(a)); +Warnings: +Note 1071 Specified key was too long; max key length is 1000 bytes +INSERT INTO t1 VALUES ('abc'), ('def'), ('FFF'), ('abc'), ('FFF'); +SET SESSION big_tables=ON; +SELECT DISTINCT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +3 +PREPARE stmt FROM 'SELECT DISTINCT COUNT(DISTINCT a) FROM t1'; +EXECUTE stmt; +COUNT(DISTINCT a) +3 +EXECUTE stmt; +COUNT(DISTINCT a) +3 +DROP TABLE t1; +# +# MDEV-29294: Assertion `functype() == ((Item_cond *) new_item)->functype()' +# failed in Item_cond::remove_eq_conds on SELECT +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +# Test for nested OR conditions: +SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +a +1 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +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; Using temporary +3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 +Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and (1 or <`test`.`t1`.`a`>((/* select#3 */ select 3 from DUAL where `test`.`t1`.`a` = `test`.`t1`.`a`)) = 3) +PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3))'; +EXECUTE stmt; +a +1 +EXECUTE stmt; +a +1 +CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +SELECT * FROM v1; +a +1 +# Test for nested AND conditions: +SELECT * FROM t1 WHERE a = 1 OR +(3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3)); +a +1 +PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 OR + (3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3))'; +EXECUTE stmt; +a +1 +EXECUTE stmt; +a +1 +CREATE VIEW v2 AS SELECT * FROM t1 WHERE a = 1 OR +(3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3)); +SELECT * FROM v2; +a +1 +DROP TABLE t1; +DROP VIEW v1, v2; End of 10.0 tests diff --git a/mysql-test/main/select.test b/mysql-test/main/select.test index b9891280c45d0..332b5a36aeaf6 100644 --- a/mysql-test/main/select.test +++ b/mysql-test/main/select.test @@ -2,6 +2,9 @@ # Find string "NOTE NOTE NOTE" in order to find some 'unsure' tests # +--source include/no_valgrind_without_big.inc +--source include/protocol.inc + # # Simple select test # @@ -1735,7 +1738,9 @@ select count(*) from t2; select count(*) from t2 where fld1 < 098024; # PS does correct pre-zero here. MySQL can't do it as it returns a number. --disable_ps_protocol +--disable_view_protocol select min(fld1) from t2 where fld1>= 098024; +--enable_view_protocol --enable_ps_protocol select max(fld1) from t2 where fld1>= 098024; select count(*) from t3 where price2=76234234; @@ -1743,7 +1748,9 @@ select count(*) from t3 where companynr=512 and price2=76234234; explain select min(fld1),max(fld1),count(*) from t2; # PS does correct pre-zero here. MySQL can't do it as it returns a number. --disable_ps_protocol +--disable_view_protocol select min(fld1),max(fld1),count(*) from t2; +--enable_view_protocol --enable_ps_protocol select min(t2nr),max(t2nr) from t3 where t2nr=2115 and price2=823742; select count(*),min(t2nr),max(t2nr) from t3 where name='spates' and companynr=78; @@ -2178,7 +2185,7 @@ drop table t2; # # Bug #11745: SELECT ... FROM DUAL with WHERE condition # - +--disable_view_protocol CREATE TABLE t1 (a int, b int, c int); INSERT INTO t1 SELECT 50, 3, 3 FROM DUAL @@ -2197,7 +2204,7 @@ select count(*) from t1 limit 2,3; select found_rows(); select SQL_CALC_FOUND_ROWS count(*) from t1 limit 2,3; select found_rows(); - +--enable_view_protocol DROP TABLE t1; # @@ -2493,9 +2500,10 @@ DROP TABLE t1,t2; # # Bug #10650 # - +#enable after fix MDEV-28535 +--disable_view_protocol select x'3136' + 0, X'3136' + 0, b'10' + 0, B'10' + 0; - +--enable_view_protocol # # Bug #11398 Bug in field_conv() results in wrong result of join with index # @@ -2606,7 +2614,10 @@ SELECT * FROM BUG_12595 WHERE a LIKE 'hakan*%' ESCAPE '*'; SELECT * FROM BUG_12595 WHERE a LIKE 'hakan**%' ESCAPE '**'; # this should work when sql_mode is not NO_BACKSLASH_ESCAPES SELECT * FROM BUG_12595 WHERE a LIKE 'hakan%' ESCAPE ''; +#enable after fix MDEV-29601 +--disable_service_connection SELECT * FROM BUG_12595 WHERE a LIKE 'hakan\%' ESCAPE ''; +--enable_service_connection SELECT * FROM BUG_12595 WHERE a LIKE 'ha\%an' ESCAPE 0x5c; SELECT * FROM BUG_12595 WHERE a LIKE 'ha%%an' ESCAPE '%'; SELECT * FROM BUG_12595 WHERE a LIKE 'ha\%an' ESCAPE '\\'; @@ -2614,19 +2625,28 @@ SELECT * FROM BUG_12595 WHERE a LIKE 'ha|%an' ESCAPE '|'; SET @@SQL_MODE='NO_BACKSLASH_ESCAPES'; SHOW LOCAL VARIABLES LIKE 'SQL_MODE'; +#enable after fix MDEV-29231 +--disable_view_protocol SELECT * FROM BUG_12595 WHERE a LIKE 'hakan\%'; +--enable_view_protocol SELECT * FROM BUG_12595 WHERE a LIKE 'hakan*%' ESCAPE '*'; -- error 1210 SELECT * FROM BUG_12595 WHERE a LIKE 'hakan**%' ESCAPE '**'; +#enable after fix MDEV-29231 +--disable_view_protocol -- error 1210 SELECT * FROM BUG_12595 WHERE a LIKE 'hakan\%' ESCAPE '\\'; +--enable_view_protocol #this gives an error when NO_BACKSLASH_ESCAPES is set -- error 1210 SELECT * FROM BUG_12595 WHERE a LIKE 'hakan%' ESCAPE ''; SELECT * FROM BUG_12595 WHERE a LIKE 'ha\%an' ESCAPE 0x5c; SELECT * FROM BUG_12595 WHERE a LIKE 'ha|%an' ESCAPE '|'; +#enable after fix MDEV-29231 +--disable_view_protocol -- error 1210 SELECT * FROM BUG_12595 WHERE a LIKE 'hakan\n%' ESCAPE '\n'; +--enable_view_protocol SET @@SQL_MODE=@OLD_SQL_MODE12595; DROP TABLE BUG_12595; @@ -3543,7 +3563,8 @@ DROP VIEW v1; # On DATETIME-like literals with trailing garbage, BETWEEN fudged in a # DATETIME comparator, while greater/less-than used bin-string comparisons. # Should correctly be compared as DATE or DATETIME, but throw a warning: - +#enable after fix MDEV-27871 +--disable_view_protocol select str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT' and '2007/10/20 00:00:00 GMT'; select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6'; @@ -3586,6 +3607,7 @@ select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34'; select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01' and '2007/10/20'; +--enable_view_protocol set SQL_MODE=DEFAULT; select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'; select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20'; @@ -3597,12 +3619,15 @@ select str_to_date('1','%Y-%m-%d') = '1'; select str_to_date('1','%Y-%m-%d') = '1'; select str_to_date('','%Y-%m-%d') = ''; +#enable after fix MDEV-27871 +--disable_view_protocol select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'; select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL; select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01'; select str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL; select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01'; select str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL; +--enable_view_protocol # # Bug #30666: Incorrect order when using range conditions on 2 tables or more @@ -3712,7 +3737,7 @@ DROP TABLE t1; # # Bug #32942 now() - interval '7200' second is NOT pre-calculated, causing "full table scan" # - +--disable_view_protocol CREATE TABLE t1 (a INT, b INT); CREATE TABLE t2 (a INT, c INT, KEY(a)); @@ -3726,7 +3751,7 @@ FLUSH STATUS; SELECT DISTINCT b FROM t1 LEFT JOIN t2 USING(a) WHERE c <= 3; SHOW STATUS LIKE 'Handler_read%'; DROP TABLE t1, t2; - +--enable_view_protocol # # Bug#40953 SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error # @@ -4677,4 +4702,92 @@ select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined)); drop table t1; +--echo # +--echo # Bug MDEV-24262 Server crashes in st_join_table::cleanup upon +--echo # erroneous GROUP_CONCAT +--echo # + +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,10),(2,20); +--error ER_BAD_FIELD_ERROR +SELECT b, GROUP_CONCAT(b ORDER BY 2), MIN(a) AS f FROM t1 GROUP BY b ORDER BY f; + +DROP TABLE t1; + +--echo # +--echo # Bug MDEV-24560 SIGSEGV in st_join_table::cleanup + server and client +--echo # hang + cross-mysqld-interaction + double free or corruption (!prev) +--echo # + +CREATE TABLE t1 (c INT); +SET SESSION sql_buffer_result=1; +SELECT GROUP_CONCAT(c ORDER BY 2) FROM t1; +SELECT GROUP_CONCAT(c ORDER BY 0) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (grp INT,c CHAR); +SET sql_buffer_result=1; +SELECT grp,GROUP_CONCAT(c ORDER BY 2) FROM t1 GROUP BY grp; +DROP TABLE t1; + +--echo # +--echo # Bug MDEV-28077 "Wrong create options" with "big_tables" option enabled +--echo # +CREATE TABLE t1(a VARCHAR(16383) CHARACTER SET UTF32, KEY k(a)); +INSERT INTO t1 VALUES ('abc'), ('def'), ('FFF'), ('abc'), ('FFF'); + +# big_tables are deprecated after some version +--disable_warnings +SET SESSION big_tables=ON; +SELECT DISTINCT COUNT(DISTINCT a) FROM t1; + +PREPARE stmt FROM 'SELECT DISTINCT COUNT(DISTINCT a) FROM t1'; +EXECUTE stmt; +EXECUTE stmt; + +--enable_warnings +DROP TABLE t1; + +--echo # +--echo # MDEV-29294: Assertion `functype() == ((Item_cond *) new_item)->functype()' +--echo # failed in Item_cond::remove_eq_conds on SELECT +--echo # +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); + +--echo # Test for nested OR conditions: +SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); + +--enable_prepare_warnings +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +--disable_prepare_warnings + +PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3))'; +EXECUTE stmt; +EXECUTE stmt; + +CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +SELECT * FROM v1; + +--echo # Test for nested AND conditions: +SELECT * FROM t1 WHERE a = 1 OR + (3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3)); + +PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 OR + (3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3))'; +EXECUTE stmt; +EXECUTE stmt; + +CREATE VIEW v2 AS SELECT * FROM t1 WHERE a = 1 OR + (3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3)); +SELECT * FROM v2; + +DROP TABLE t1; +DROP VIEW v1, v2; + --echo End of 10.0 tests diff --git a/mysql-test/main/select_found.test b/mysql-test/main/select_found.test index 3361369772211..4b6bdbb15e162 100644 --- a/mysql-test/main/select_found.test +++ b/mysql-test/main/select_found.test @@ -1,6 +1,11 @@ # # Testing of found_rows() # + +# Tests will be skipped for the view protocol otherwise +# found_rows() will return an incorrect result. +-- source include/no_view_protocol.inc + --disable_warnings drop table if exists t1,t2; --enable_warnings diff --git a/mysql-test/main/select_jcl6,ps.rdiff b/mysql-test/main/select_jcl6,ps.rdiff new file mode 100644 index 0000000000000..18652a0683b3a --- /dev/null +++ b/mysql-test/main/select_jcl6,ps.rdiff @@ -0,0 +1,12 @@ +--- mysql-test/main/select_jcl6.result 2023-01-31 09:30:58.151377805 +0100 ++++ mysql-test/main/select_jcl6.reject 2023-02-01 13:44:10.722958771 +0100 +@@ -5672,6 +5672,8 @@ + Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1249 Select 2 was reduced during optimization ++Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 ++Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and (1 or <`test`.`t1`.`a`>((/* select#3 */ select 3 from DUAL where `test`.`t1`.`a` = `test`.`t1`.`a`)) = 3) + PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3))'; + diff --git a/mysql-test/main/select_jcl6.result b/mysql-test/main/select_jcl6.result index 6a309d8aa69f3..1a7eb796e969d 100644 --- a/mysql-test/main/select_jcl6.result +++ b/mysql-test/main/select_jcl6.result @@ -3485,13 +3485,13 @@ INSERT INTO t2 VALUES EXPLAIN SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL c NULL NULL NULL 18 Using where -1 SIMPLE t1 eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter +1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using index condition; Rowid-ordered scan +1 SIMPLE t2 ref c c 5 test.t1.a 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan EXPLAIN SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL c NULL NULL NULL 18 Using where -1 SIMPLE t1 eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter +1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t2 ref c c 5 test.t1.a 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan DROP TABLE t1, t2; create table t1 ( a int unsigned not null auto_increment primary key, @@ -3804,7 +3804,7 @@ t1 CREATE TABLE `t1` ( `i` decimal(19,0) NOT NULL, `c` decimal(19,0) NOT NULL, `co` decimal(19,0) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select if(1, cast(1111111111111111111 as unsigned), 1) i, @@ -5273,11 +5273,11 @@ SELECT `varchar_nokey` G1 FROM CC WHERE `int_nokey` AND `int_key` <= 4 HAVING G1 ORDER BY `varchar_key` LIMIT 6 ; G1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'j' -Warning 1292 Truncated incorrect DOUBLE value: 'z' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'q' -Warning 1292 Truncated incorrect DOUBLE value: 'm' +Warning 1292 Truncated incorrect DECIMAL value: 'j' +Warning 1292 Truncated incorrect DECIMAL value: 'z' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'q' +Warning 1292 Truncated incorrect DECIMAL value: 'm' DROP TABLE CC; # End of test#45227 # @@ -5604,6 +5604,108 @@ select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined)); (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined)) NULL drop table t1; +# +# Bug MDEV-24262 Server crashes in st_join_table::cleanup upon +# erroneous GROUP_CONCAT +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,10),(2,20); +SELECT b, GROUP_CONCAT(b ORDER BY 2), MIN(a) AS f FROM t1 GROUP BY b ORDER BY f; +ERROR 42S22: Unknown column '2' in 'order clause' +DROP TABLE t1; +# +# Bug MDEV-24560 SIGSEGV in st_join_table::cleanup + server and client +# hang + cross-mysqld-interaction + double free or corruption (!prev) +# +CREATE TABLE t1 (c INT); +SET SESSION sql_buffer_result=1; +SELECT GROUP_CONCAT(c ORDER BY 2) FROM t1; +GROUP_CONCAT(c ORDER BY 2) +NULL +SELECT GROUP_CONCAT(c ORDER BY 0) FROM t1; +GROUP_CONCAT(c ORDER BY 0) +NULL +DROP TABLE t1; +CREATE TABLE t1 (grp INT,c CHAR); +SET sql_buffer_result=1; +SELECT grp,GROUP_CONCAT(c ORDER BY 2) FROM t1 GROUP BY grp; +grp GROUP_CONCAT(c ORDER BY 2) +DROP TABLE t1; +# +# Bug MDEV-28077 "Wrong create options" with "big_tables" option enabled +# +CREATE TABLE t1(a VARCHAR(16383) CHARACTER SET UTF32, KEY k(a)); +Warnings: +Note 1071 Specified key was too long; max key length is 1000 bytes +INSERT INTO t1 VALUES ('abc'), ('def'), ('FFF'), ('abc'), ('FFF'); +SET SESSION big_tables=ON; +SELECT DISTINCT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +3 +PREPARE stmt FROM 'SELECT DISTINCT COUNT(DISTINCT a) FROM t1'; +EXECUTE stmt; +COUNT(DISTINCT a) +3 +EXECUTE stmt; +COUNT(DISTINCT a) +3 +DROP TABLE t1; +# +# MDEV-29294: Assertion `functype() == ((Item_cond *) new_item)->functype()' +# failed in Item_cond::remove_eq_conds on SELECT +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +# Test for nested OR conditions: +SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +a +1 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +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; Using temporary +3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 +Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and (1 or <`test`.`t1`.`a`>((/* select#3 */ select 3 from DUAL where `test`.`t1`.`a` = `test`.`t1`.`a`)) = 3) +PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3))'; +EXECUTE stmt; +a +1 +EXECUTE stmt; +a +1 +CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +SELECT * FROM v1; +a +1 +# Test for nested AND conditions: +SELECT * FROM t1 WHERE a = 1 OR +(3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3)); +a +1 +PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 OR + (3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3))'; +EXECUTE stmt; +a +1 +EXECUTE stmt; +a +1 +CREATE VIEW v2 AS SELECT * FROM t1 WHERE a = 1 OR +(3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3)); +SELECT * FROM v2; +a +1 +DROP TABLE t1; +DROP VIEW v1, v2; End of 10.0 tests set join_cache_level=default; set @@optimizer_switch=@save_optimizer_switch_jcl6; diff --git a/mysql-test/main/select_pkeycache,ps.rdiff b/mysql-test/main/select_pkeycache,ps.rdiff new file mode 100644 index 0000000000000..320a402fefcf2 --- /dev/null +++ b/mysql-test/main/select_pkeycache,ps.rdiff @@ -0,0 +1,12 @@ +--- mysql-test/main/select_pkeycache.result 2023-01-31 09:30:58.151377805 +0100 ++++ mysql-test/main/select_pkeycache.reject 2023-02-01 13:43:21.742985365 +0100 +@@ -5661,6 +5661,8 @@ + Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1249 Select 2 was reduced during optimization ++Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 ++Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and (1 or <`test`.`t1`.`a`>((/* select#3 */ select 3 from DUAL where `test`.`t1`.`a` = `test`.`t1`.`a`)) = 3) + PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3))'; + diff --git a/mysql-test/main/select_pkeycache.result b/mysql-test/main/select_pkeycache.result index 2f051ab33bf1b..abffe58739df0 100644 --- a/mysql-test/main/select_pkeycache.result +++ b/mysql-test/main/select_pkeycache.result @@ -3474,13 +3474,13 @@ INSERT INTO t2 VALUES EXPLAIN SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL c NULL NULL NULL 18 Using where -1 SIMPLE t1 eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using rowid filter +1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using index condition +1 SIMPLE t2 ref c c 5 test.t1.a 2 EXPLAIN SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL c NULL NULL NULL 18 Using where -1 SIMPLE t1 eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using rowid filter +1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using index condition; Using where +1 SIMPLE t2 ref c c 5 test.t1.a 2 DROP TABLE t1, t2; create table t1 ( a int unsigned not null auto_increment primary key, @@ -3793,7 +3793,7 @@ t1 CREATE TABLE `t1` ( `i` decimal(19,0) NOT NULL, `c` decimal(19,0) NOT NULL, `co` decimal(19,0) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select if(1, cast(1111111111111111111 as unsigned), 1) i, @@ -5262,11 +5262,11 @@ SELECT `varchar_nokey` G1 FROM CC WHERE `int_nokey` AND `int_key` <= 4 HAVING G1 ORDER BY `varchar_key` LIMIT 6 ; G1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'z' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'q' -Warning 1292 Truncated incorrect DOUBLE value: 'm' -Warning 1292 Truncated incorrect DOUBLE value: 'j' +Warning 1292 Truncated incorrect DECIMAL value: 'z' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'q' +Warning 1292 Truncated incorrect DECIMAL value: 'm' +Warning 1292 Truncated incorrect DECIMAL value: 'j' DROP TABLE CC; # End of test#45227 # @@ -5593,4 +5593,106 @@ select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined)); (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined)) NULL drop table t1; +# +# Bug MDEV-24262 Server crashes in st_join_table::cleanup upon +# erroneous GROUP_CONCAT +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,10),(2,20); +SELECT b, GROUP_CONCAT(b ORDER BY 2), MIN(a) AS f FROM t1 GROUP BY b ORDER BY f; +ERROR 42S22: Unknown column '2' in 'order clause' +DROP TABLE t1; +# +# Bug MDEV-24560 SIGSEGV in st_join_table::cleanup + server and client +# hang + cross-mysqld-interaction + double free or corruption (!prev) +# +CREATE TABLE t1 (c INT); +SET SESSION sql_buffer_result=1; +SELECT GROUP_CONCAT(c ORDER BY 2) FROM t1; +GROUP_CONCAT(c ORDER BY 2) +NULL +SELECT GROUP_CONCAT(c ORDER BY 0) FROM t1; +GROUP_CONCAT(c ORDER BY 0) +NULL +DROP TABLE t1; +CREATE TABLE t1 (grp INT,c CHAR); +SET sql_buffer_result=1; +SELECT grp,GROUP_CONCAT(c ORDER BY 2) FROM t1 GROUP BY grp; +grp GROUP_CONCAT(c ORDER BY 2) +DROP TABLE t1; +# +# Bug MDEV-28077 "Wrong create options" with "big_tables" option enabled +# +CREATE TABLE t1(a VARCHAR(16383) CHARACTER SET UTF32, KEY k(a)); +Warnings: +Note 1071 Specified key was too long; max key length is 1000 bytes +INSERT INTO t1 VALUES ('abc'), ('def'), ('FFF'), ('abc'), ('FFF'); +SET SESSION big_tables=ON; +SELECT DISTINCT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +3 +PREPARE stmt FROM 'SELECT DISTINCT COUNT(DISTINCT a) FROM t1'; +EXECUTE stmt; +COUNT(DISTINCT a) +3 +EXECUTE stmt; +COUNT(DISTINCT a) +3 +DROP TABLE t1; +# +# MDEV-29294: Assertion `functype() == ((Item_cond *) new_item)->functype()' +# failed in Item_cond::remove_eq_conds on SELECT +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +# Test for nested OR conditions: +SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +a +1 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +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; Using temporary +3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 +Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and (1 or <`test`.`t1`.`a`>((/* select#3 */ select 3 from DUAL where `test`.`t1`.`a` = `test`.`t1`.`a`)) = 3) +PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3))'; +EXECUTE stmt; +a +1 +EXECUTE stmt; +a +1 +CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +SELECT * FROM v1; +a +1 +# Test for nested AND conditions: +SELECT * FROM t1 WHERE a = 1 OR +(3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3)); +a +1 +PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 OR + (3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3))'; +EXECUTE stmt; +a +1 +EXECUTE stmt; +a +1 +CREATE VIEW v2 AS SELECT * FROM t1 WHERE a = 1 OR +(3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3)); +SELECT * FROM v2; +a +1 +DROP TABLE t1; +DROP VIEW v1, v2; End of 10.0 tests diff --git a/mysql-test/main/selectivity.result b/mysql-test/main/selectivity.result index 003b91a6a280a..bbe7948b1b3b3 100644 --- a/mysql-test/main/selectivity.result +++ b/mysql-test/main/selectivity.result @@ -326,8 +326,8 @@ group by c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice order by o_totalprice desc, o_orderdate; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY orders ALL PRIMARY,i_o_custkey NULL NULL NULL 1500 100.00 Using where; Using temporary; Using filesort -1 PRIMARY eq_ref distinct_key distinct_key 4 dbt3_s001.orders.o_orderkey 1 100.00 1 PRIMARY customer eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 100.00 +1 PRIMARY eq_ref distinct_key distinct_key 4 dbt3_s001.orders.o_orderkey 1 100.00 1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey_quantity 4 dbt3_s001.orders.o_orderkey 4 100.00 Using index 2 MATERIALIZED lineitem index NULL i_l_orderkey_quantity 13 NULL 6005 100.00 Using index Warnings: @@ -360,8 +360,8 @@ group by c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice order by o_totalprice desc, o_orderdate; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY orders ALL PRIMARY,i_o_custkey NULL NULL NULL 1500 100.00 Using where; Using temporary; Using filesort -1 PRIMARY eq_ref distinct_key distinct_key 4 dbt3_s001.orders.o_orderkey 1 100.00 1 PRIMARY customer eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 100.00 +1 PRIMARY eq_ref distinct_key distinct_key 4 dbt3_s001.orders.o_orderkey 1 100.00 1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey_quantity 4 dbt3_s001.orders.o_orderkey 4 100.00 Using index 2 MATERIALIZED lineitem index NULL i_l_orderkey_quantity 13 NULL 6005 100.00 Using index Warnings: @@ -834,7 +834,7 @@ flush table t1; set optimizer_use_condition_selectivity=4; explain extended select * from t1 where a=0; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.39 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.78 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0 drop table t1; @@ -1641,8 +1641,8 @@ drop function f1; # create table t1 (a int, b int, key (b), key (a)); insert into t1 -select (rand(1)*1000)/10, (rand(1001)*1000)/50 from seq_1_to_1000; -analyze table t1 ; +select (rand(1)*1000)/10, (rand(1001)*1000)/20 from seq_1_to_1000; +analyze table t1 persistent for all; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date @@ -1654,14 +1654,14 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` USE INDEX () where `test`.`t1`.`a` in (17,51,5) explain extended select * from t1 use index () where b=2; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 5.90 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 2.40 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` USE INDEX () where `test`.`t1`.`b` = 2 # Now, the equality is used for ref access, while the range condition # gives selectivity data explain extended select * from t1 where a in (17,51,5) and b=2; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref|filter b,a b|a 5|5 const 58 (3%) 2.90 Using where; Using rowid filter +1 SIMPLE t1 ref b,a b 5 const 24 2.90 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` in (17,51,5) drop table t1; @@ -1817,6 +1817,12 @@ create table t1 (id int, a int, PRIMARY KEY(id), key(a)); insert into t1 select seq,seq from seq_1_to_100; create table t2 (id int, a int, b int, PRIMARY KEY(id), key(a), key(b)); insert into t2 select seq,seq,seq from seq_1_to_100; +analyze table t1,t2 persistent for all; +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 set optimizer_switch='exists_to_in=off'; set optimizer_use_condition_selectivity=2; SELECT * FROM t1 @@ -1935,9 +1941,9 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 +DROP TABLE t1; +# End of 10.2 tests set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; set histogram_size=@save_histogram_size; set use_stat_tables= @save_use_stat_tables; -DROP TABLE t1; -# End of 10.2 tests set @@global.histogram_size=@save_histogram_size; diff --git a/mysql-test/main/selectivity.test b/mysql-test/main/selectivity.test index 1d96dc0bf80b4..df3850d74b787 100644 --- a/mysql-test/main/selectivity.test +++ b/mysql-test/main/selectivity.test @@ -1,3 +1,4 @@ +--source include/no_valgrind_without_big.inc --source include/have_stat_tables.inc --source include/have_sequence.inc --source include/default_charset.inc @@ -848,7 +849,7 @@ create table t2 (c int, d int, key(c), key(d)) engine=myisam; insert t2 select floor(rand()*1e5/2)*2, floor(rand()*1e5/3)*3 from t1; analyze table t1,t2; - +--disable_view_protocol set optimizer_use_condition_selectivity=1; explain extended select * from t1, t2, t1 as t3 @@ -864,7 +865,7 @@ select * from t1, t2, t1 as t3 --sorted_result select * from t1, t2, t1 as t3 where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000; - +--enable_view_protocol set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; drop table t1,t2; @@ -1110,8 +1111,8 @@ drop function f1; --echo # create table t1 (a int, b int, key (b), key (a)); insert into t1 -select (rand(1)*1000)/10, (rand(1001)*1000)/50 from seq_1_to_1000; -analyze table t1 ; +select (rand(1)*1000)/10, (rand(1001)*1000)/20 from seq_1_to_1000; +analyze table t1 persistent for all; --echo # Check what info the optimizer has about selectivities explain extended select * from t1 use index () where a in (17,51,5); @@ -1248,6 +1249,8 @@ insert into t1 select seq,seq from seq_1_to_100; create table t2 (id int, a int, b int, PRIMARY KEY(id), key(a), key(b)); insert into t2 select seq,seq,seq from seq_1_to_100; +analyze table t1,t2 persistent for all; + set optimizer_switch='exists_to_in=off'; set optimizer_use_condition_selectivity=2; @@ -1318,16 +1321,17 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; -set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; -set histogram_size=@save_histogram_size; -set use_stat_tables= @save_use_stat_tables; DROP TABLE t1; --echo # End of 10.2 tests + # # Clean up # +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set histogram_size=@save_histogram_size; +set use_stat_tables= @save_use_stat_tables; --source include/restore_charset.inc set @@global.histogram_size=@save_histogram_size; diff --git a/mysql-test/main/selectivity_innodb.result b/mysql-test/main/selectivity_innodb.result index 8db83c6bcaf9c..f35d8b66f8f6e 100644 --- a/mysql-test/main/selectivity_innodb.result +++ b/mysql-test/main/selectivity_innodb.result @@ -331,8 +331,8 @@ group by c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice order by o_totalprice desc, o_orderdate; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY orders ALL PRIMARY,i_o_custkey NULL NULL NULL 1500 100.00 Using where; Using temporary; Using filesort -1 PRIMARY eq_ref distinct_key distinct_key 4 dbt3_s001.orders.o_orderkey 1 100.00 1 PRIMARY customer eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 100.00 +1 PRIMARY eq_ref distinct_key distinct_key 4 dbt3_s001.orders.o_orderkey 1 100.00 1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey_quantity 4 dbt3_s001.orders.o_orderkey 4 100.00 Using index 2 MATERIALIZED lineitem index NULL PRIMARY 8 NULL 6005 100.00 Warnings: @@ -365,8 +365,8 @@ group by c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice order by o_totalprice desc, o_orderdate; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY orders ALL PRIMARY,i_o_custkey NULL NULL NULL 1500 100.00 Using where; Using temporary; Using filesort -1 PRIMARY eq_ref distinct_key distinct_key 4 dbt3_s001.orders.o_orderkey 1 100.00 1 PRIMARY customer eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 100.00 +1 PRIMARY eq_ref distinct_key distinct_key 4 dbt3_s001.orders.o_orderkey 1 100.00 1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey_quantity 4 dbt3_s001.orders.o_orderkey 4 100.00 Using index 2 MATERIALIZED lineitem index NULL PRIMARY 8 NULL 6005 100.00 Warnings: @@ -845,7 +845,7 @@ flush table t1; set optimizer_use_condition_selectivity=4; explain extended select * from t1 where a=0; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.39 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.78 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0 drop table t1; @@ -1653,8 +1653,8 @@ drop function f1; # create table t1 (a int, b int, key (b), key (a)); insert into t1 -select (rand(1)*1000)/10, (rand(1001)*1000)/50 from seq_1_to_1000; -analyze table t1 ; +select (rand(1)*1000)/10, (rand(1001)*1000)/20 from seq_1_to_1000; +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 @@ -1666,14 +1666,14 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` USE INDEX () where `test`.`t1`.`a` in (17,51,5) explain extended select * from t1 use index () where b=2; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 5.90 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 2.40 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` USE INDEX () where `test`.`t1`.`b` = 2 # Now, the equality is used for ref access, while the range condition # gives selectivity data explain extended select * from t1 where a in (17,51,5) and b=2; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref|filter b,a b|a 5|5 const 59 (3%) 2.90 Using where; Using rowid filter +1 SIMPLE t1 ref b,a b 5 const 24 2.90 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` in (17,51,5) drop table t1; @@ -1829,6 +1829,12 @@ create table t1 (id int, a int, PRIMARY KEY(id), key(a)); insert into t1 select seq,seq from seq_1_to_100; create table t2 (id int, a int, b int, PRIMARY KEY(id), key(a), key(b)); insert into t2 select seq,seq,seq from seq_1_to_100; +analyze table t1,t2 persistent for all; +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 optimizer_switch='exists_to_in=off'; set optimizer_use_condition_selectivity=2; SELECT * FROM t1 @@ -1947,11 +1953,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 +DROP TABLE t1; +# End of 10.2 tests set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; set histogram_size=@save_histogram_size; set use_stat_tables= @save_use_stat_tables; -DROP TABLE t1; -# End of 10.2 tests set @@global.histogram_size=@save_histogram_size; set optimizer_switch=@save_optimizer_switch_for_selectivity_test; set @tmp_ust= @@use_stat_tables; diff --git a/mysql-test/main/selectivity_innodb_notembedded.result b/mysql-test/main/selectivity_innodb_notembedded.result new file mode 100644 index 0000000000000..8b06fe7556b90 --- /dev/null +++ b/mysql-test/main/selectivity_innodb_notembedded.result @@ -0,0 +1,104 @@ +SET SESSION STORAGE_ENGINE='InnoDB'; +Warnings: +Warning 1287 '@@storage_engine' is deprecated and will be removed in a future release. Please use '@@default_storage_engine' instead +set @save_optimizer_switch_for_selectivity_test=@@optimizer_switch; +set optimizer_switch='extended_keys=on'; +drop table if exists t0,t1,t2,t3; +select @@global.use_stat_tables; +@@global.use_stat_tables +COMPLEMENTARY +select @@session.use_stat_tables; +@@session.use_stat_tables +COMPLEMENTARY +set @save_use_stat_tables=@@use_stat_tables; +set use_stat_tables='preferably'; +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; +set @save_histogram_size=@@histogram_size; +set @save_histogram_type=@@histogram_type; +set join_cache_level=2; +set @@global.histogram_size=0,@@local.histogram_size=0; +set histogram_type='single_prec_hb'; +set optimizer_use_condition_selectivity=3; +# +# MDEV-31067: selectivity_from_histogram >1.0 for a DOUBLE_PREC_HB histogram +# +create table t0(a int); +insert into t0 select 1 from seq_1_to_78; +create table t1(a int); +insert into t1 select 1 from seq_1_to_26; +create table t10 (a int); +insert into t10 select 0 from t0, seq_1_to_4; +insert into t10 select 8693 from t1; +insert into t10 select 8694 from t1; +insert into t10 select 8695 from t1; +insert into t10 select 34783 from t1; +insert into t10 select 34784 from t1; +insert into t10 select 34785 from t1; +insert into t10 select 34785 from t0, seq_1_to_8; +insert into t10 select 65214 from t1; +insert into t10 select 65215 from t1; +insert into t10 select 65216 from t1; +insert into t10 select 65216 from t0, seq_1_to_52; +insert into t10 select 65217 from t1; +insert into t10 select 65218 from t1; +insert into t10 select 65219 from t1; +insert into t10 select 65219 from t0; +insert into t10 select 73913 from t1; +insert into t10 select 73914 from t1; +insert into t10 select 73915 from t1; +insert into t10 select 73915 from t0, seq_1_to_40; +insert into t10 select 78257 from t1; +insert into t10 select 78258 from t1; +insert into t10 select 78259 from t1; +insert into t10 select 91300 from t1; +insert into t10 select 91301 from t1; +insert into t10 select 91302 from t1; +insert into t10 select 91302 from t0, seq_1_to_6; +insert into t10 select 91303 from t1; +insert into t10 select 91304 from t1; +insert into t10 select 91305 from t1; +insert into t10 select 91305 from t0, seq_1_to_8; +insert into t10 select 99998 from t1; +insert into t10 select 99999 from t1; +insert into t10 select 100000 from t1; +set use_stat_tables=preferably; +analyze table t10 persistent for all; +Table Op Msg_type Msg_text +test.t10 analyze status Engine-independent statistics collected +test.t10 analyze status OK +flush tables; +set @tmp=@@optimizer_trace; +set optimizer_trace=1; +explain select * from t10 where a in (91303); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t10 ALL NULL NULL NULL NULL 9984 Using where +# Must have selectivity_from_histogram <= 1.0: +select json_detailed(json_extract(trace, '$**.selectivity_for_columns')) as sel +from information_schema.optimizer_trace; +sel +[ + [ + { + "column_name": "a", + "ranges": + ["91303 <= a <= 91303"], + "selectivity_from_histogram": 0.035714283 + } + ] +] +set optimizer_trace=@tmp; +drop table t0,t1,t10; +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set histogram_size=@save_histogram_size; +set use_stat_tables= @save_use_stat_tables; +# +# End of 10.4 tests +# +# +# Clean up +# +set @@global.histogram_size=@save_histogram_size; +set optimizer_switch=@save_optimizer_switch_for_selectivity_test; +SET SESSION STORAGE_ENGINE=DEFAULT; +Warnings: +Warning 1287 '@@storage_engine' is deprecated and will be removed in a future release. Please use '@@default_storage_engine' instead diff --git a/mysql-test/main/selectivity_innodb_notembedded.test b/mysql-test/main/selectivity_innodb_notembedded.test new file mode 100644 index 0000000000000..387f7dcb7de52 --- /dev/null +++ b/mysql-test/main/selectivity_innodb_notembedded.test @@ -0,0 +1,16 @@ +--source include/have_innodb.inc +# This test is slow on buildbot. +--source include/big_test.inc +--source include/default_optimizer_switch.inc +--source include/not_embedded.inc + +SET SESSION STORAGE_ENGINE='InnoDB'; + +set @save_optimizer_switch_for_selectivity_test=@@optimizer_switch; +set optimizer_switch='extended_keys=on'; + +--source selectivity_notembedded.test + +set optimizer_switch=@save_optimizer_switch_for_selectivity_test; + +SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/main/selectivity_no_engine.result b/mysql-test/main/selectivity_no_engine.result index 3811b12a1be16..00e2b8fc39780 100644 --- a/mysql-test/main/selectivity_no_engine.result +++ b/mysql-test/main/selectivity_no_engine.result @@ -36,12 +36,12 @@ test.t2 analyze status OK # The following two must have the same in 'Extra' column: explain extended select * from t2 where col1 IN (20, 180); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.35 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.00 Using where Warnings: Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` in (20,180) explain extended select * from t2 where col1 IN (180, 20); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.35 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.00 Using where Warnings: Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` in (180,20) drop table t1, t2; @@ -102,7 +102,7 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain extended select * from t1 where col1 in (1,2,3); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 3.37 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 2.97 Using where Warnings: Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` in (1,2,3) # Must not cause fp division by zero, or produce nonsense numbers: @@ -314,6 +314,29 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE a ALL NULL NULL NULL NULL 5 Using where 1 SIMPLE b hash_ALL NULL #hash#$hj 1341 test.a.Host,test.a.User,test.a.Password,test.a.Select_priv,test.a.Insert_priv,test.a.Update_priv,test.a.Delete_priv,test.a.Create_priv,test.a.Drop_priv,test.a.Reload_priv,test.a.Shutdown_priv,test.a.Process_priv,test.a.File_priv,test.a.Grant_priv,test.a.References_priv,test.a.Index_priv,test.a.Alter_priv,test.a.Show_db_priv,test.a.Super_priv,test.a.Create_tmp_table_priv,test.a.Lock_tables_priv,test.a.Execute_priv,test.a.Repl_slave_priv,test.a.Repl_client_priv,test.a.Create_view_priv,test.a.Show_view_priv,test.a.Create_routine_priv,test.a.Alter_routine_priv,test.a.Create_user_priv,test.a.Event_priv,test.a.Trigger_priv,test.a.Create_tablespace_priv,test.a.Delete_history_priv,test.a.ssl_type,test.a.ssl_cipher,test.a.x509_issuer,test.a.x509_subject,test.a.max_questions,test.a.max_updates,test.a.max_connections,test.a.max_user_connections,test.a.plugin,test.a.authentication_string,test.a.password_expired,test.a.is_role,test.a.default_role,test.a.max_statement_time 5 Using where; Using join buffer (flat, BNLH join) DROP TABLE t1,t2,t3; +# +# MDEV-31199: Assertion `field->table->stats_is_read' fails with hash_join_cardinality=on +# +CREATE TABLE t1 (a VARCHAR(255)); +INSERT INTO t1 VALUES ('u'),('uu'); +CREATE TABLE t2 (b VARCHAR(255)) CHARACTER SET utf8mb4; +INSERT INTO t2 VALUES ('x'),('xx'); +CREATE TABLE t3 (c VARCHAR(255)); +INSERT INTO t3 VALUES ('z'),('zz'); +ANALYZE TABLE t1, t2, t3 PERSISTENT FOR ALL; +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 +set @tmp1=@@optimizer_switch, @tmp2=@@join_cache_level; +set optimizer_switch='hash_join_cardinality=on', join_cache_level=3; +SELECT t1.* FROM t1 JOIN (SELECT DISTINCT b FROM t2 JOIN t3) sq ON sq.b = t1.a; +a +set optimizer_switch=@tmp1, join_cache_level=@tmp2; +DROP TABLE t1, t2, t3; # # End of the test file # diff --git a/mysql-test/main/selectivity_no_engine.test b/mysql-test/main/selectivity_no_engine.test index 5bc78e0378177..47bac21a2e16d 100644 --- a/mysql-test/main/selectivity_no_engine.test +++ b/mysql-test/main/selectivity_no_engine.test @@ -250,6 +250,26 @@ SELECT * FROM t1 AS a NATURAL JOIN t1 AS b; DROP TABLE t1,t2,t3; +--echo # +--echo # MDEV-31199: Assertion `field->table->stats_is_read' fails with hash_join_cardinality=on +--echo # +CREATE TABLE t1 (a VARCHAR(255)); +INSERT INTO t1 VALUES ('u'),('uu'); + +CREATE TABLE t2 (b VARCHAR(255)) CHARACTER SET utf8mb4; +INSERT INTO t2 VALUES ('x'),('xx'); + +CREATE TABLE t3 (c VARCHAR(255)); +INSERT INTO t3 VALUES ('z'),('zz'); + +ANALYZE TABLE t1, t2, t3 PERSISTENT FOR ALL; # Optional, fails either way + +set @tmp1=@@optimizer_switch, @tmp2=@@join_cache_level; +set optimizer_switch='hash_join_cardinality=on', join_cache_level=3; +SELECT t1.* FROM t1 JOIN (SELECT DISTINCT b FROM t2 JOIN t3) sq ON sq.b = t1.a; +set optimizer_switch=@tmp1, join_cache_level=@tmp2; +DROP TABLE t1, t2, t3; + --echo # --echo # End of the test file --echo # diff --git a/mysql-test/main/selectivity_notembedded.result b/mysql-test/main/selectivity_notembedded.result new file mode 100644 index 0000000000000..d2e90a19a68b3 --- /dev/null +++ b/mysql-test/main/selectivity_notembedded.result @@ -0,0 +1,95 @@ +drop table if exists t0,t1,t2,t3; +select @@global.use_stat_tables; +@@global.use_stat_tables +COMPLEMENTARY +select @@session.use_stat_tables; +@@session.use_stat_tables +COMPLEMENTARY +set @save_use_stat_tables=@@use_stat_tables; +set use_stat_tables='preferably'; +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; +set @save_histogram_size=@@histogram_size; +set @save_histogram_type=@@histogram_type; +set join_cache_level=2; +set @@global.histogram_size=0,@@local.histogram_size=0; +set histogram_type='single_prec_hb'; +set optimizer_use_condition_selectivity=3; +# +# MDEV-31067: selectivity_from_histogram >1.0 for a DOUBLE_PREC_HB histogram +# +create table t0(a int); +insert into t0 select 1 from seq_1_to_78; +create table t1(a int); +insert into t1 select 1 from seq_1_to_26; +create table t10 (a int); +insert into t10 select 0 from t0, seq_1_to_4; +insert into t10 select 8693 from t1; +insert into t10 select 8694 from t1; +insert into t10 select 8695 from t1; +insert into t10 select 34783 from t1; +insert into t10 select 34784 from t1; +insert into t10 select 34785 from t1; +insert into t10 select 34785 from t0, seq_1_to_8; +insert into t10 select 65214 from t1; +insert into t10 select 65215 from t1; +insert into t10 select 65216 from t1; +insert into t10 select 65216 from t0, seq_1_to_52; +insert into t10 select 65217 from t1; +insert into t10 select 65218 from t1; +insert into t10 select 65219 from t1; +insert into t10 select 65219 from t0; +insert into t10 select 73913 from t1; +insert into t10 select 73914 from t1; +insert into t10 select 73915 from t1; +insert into t10 select 73915 from t0, seq_1_to_40; +insert into t10 select 78257 from t1; +insert into t10 select 78258 from t1; +insert into t10 select 78259 from t1; +insert into t10 select 91300 from t1; +insert into t10 select 91301 from t1; +insert into t10 select 91302 from t1; +insert into t10 select 91302 from t0, seq_1_to_6; +insert into t10 select 91303 from t1; +insert into t10 select 91304 from t1; +insert into t10 select 91305 from t1; +insert into t10 select 91305 from t0, seq_1_to_8; +insert into t10 select 99998 from t1; +insert into t10 select 99999 from t1; +insert into t10 select 100000 from t1; +set use_stat_tables=preferably; +analyze table t10 persistent for all; +Table Op Msg_type Msg_text +test.t10 analyze status Engine-independent statistics collected +test.t10 analyze status OK +flush tables; +set @tmp=@@optimizer_trace; +set optimizer_trace=1; +explain select * from t10 where a in (91303); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t10 ALL NULL NULL NULL NULL 9984 Using where +# Must have selectivity_from_histogram <= 1.0: +select json_detailed(json_extract(trace, '$**.selectivity_for_columns')) as sel +from information_schema.optimizer_trace; +sel +[ + [ + { + "column_name": "a", + "ranges": + ["91303 <= a <= 91303"], + "selectivity_from_histogram": 0.035714283 + } + ] +] +set optimizer_trace=@tmp; +drop table t0,t1,t10; +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set histogram_size=@save_histogram_size; +set use_stat_tables= @save_use_stat_tables; +# +# End of 10.4 tests +# +# +# Clean up +# +set @@global.histogram_size=@save_histogram_size; diff --git a/mysql-test/main/selectivity_notembedded.test b/mysql-test/main/selectivity_notembedded.test new file mode 100644 index 0000000000000..6752bd3c7e1ca --- /dev/null +++ b/mysql-test/main/selectivity_notembedded.test @@ -0,0 +1,121 @@ +--source include/no_valgrind_without_big.inc +--source include/have_stat_tables.inc +--source include/have_sequence.inc +--source include/default_charset.inc +--source include/not_embedded.inc + +--disable_warnings +drop table if exists t0,t1,t2,t3; +--enable_warnings + +select @@global.use_stat_tables; +select @@session.use_stat_tables; + +set @save_use_stat_tables=@@use_stat_tables; +set use_stat_tables='preferably'; + +--source include/default_optimizer_switch.inc +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; +set @save_histogram_size=@@histogram_size; +set @save_histogram_type=@@histogram_type; +set join_cache_level=2; +set @@global.histogram_size=0,@@local.histogram_size=0; +set histogram_type='single_prec_hb'; + +# check that statistics on nulls is used + +set optimizer_use_condition_selectivity=3; + +--echo # +--echo # MDEV-31067: selectivity_from_histogram >1.0 for a DOUBLE_PREC_HB histogram +--echo # +create table t0(a int); # This holds how many rows we hold in a bucket. +insert into t0 select 1 from seq_1_to_78; + +create table t1(a int); # one-third of a bucket +insert into t1 select 1 from seq_1_to_26; + +create table t10 (a int); +insert into t10 select 0 from t0, seq_1_to_4; + +insert into t10 select 8693 from t1; +insert into t10 select 8694 from t1; +insert into t10 select 8695 from t1; + + +insert into t10 select 34783 from t1; +insert into t10 select 34784 from t1; +insert into t10 select 34785 from t1; + + +insert into t10 select 34785 from t0, seq_1_to_8; + +insert into t10 select 65214 from t1; +insert into t10 select 65215 from t1; +insert into t10 select 65216 from t1; + +insert into t10 select 65216 from t0, seq_1_to_52; + +insert into t10 select 65217 from t1; +insert into t10 select 65218 from t1; +insert into t10 select 65219 from t1; + +insert into t10 select 65219 from t0; + + +insert into t10 select 73913 from t1; +insert into t10 select 73914 from t1; +insert into t10 select 73915 from t1; + +insert into t10 select 73915 from t0, seq_1_to_40; + + +insert into t10 select 78257 from t1; +insert into t10 select 78258 from t1; +insert into t10 select 78259 from t1; + +insert into t10 select 91300 from t1; +insert into t10 select 91301 from t1; +insert into t10 select 91302 from t1; + +insert into t10 select 91302 from t0, seq_1_to_6; + +insert into t10 select 91303 from t1; # Only 1/3rd of bucket matches the search tuple +insert into t10 select 91304 from t1; +insert into t10 select 91305 from t1; + +insert into t10 select 91305 from t0, seq_1_to_8; + +insert into t10 select 99998 from t1; +insert into t10 select 99999 from t1; +insert into t10 select 100000 from t1; + +set use_stat_tables=preferably; +analyze table t10 persistent for all; +flush tables; + +set @tmp=@@optimizer_trace; +set optimizer_trace=1; +explain select * from t10 where a in (91303); + +--echo # Must have selectivity_from_histogram <= 1.0: +select json_detailed(json_extract(trace, '$**.selectivity_for_columns')) as sel +from information_schema.optimizer_trace; + +set optimizer_trace=@tmp; +drop table t0,t1,t10; + +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set histogram_size=@save_histogram_size; +set use_stat_tables= @save_use_stat_tables; + + +--echo # +--echo # End of 10.4 tests +--echo # + +--echo # +--echo # Clean up +--echo # +--source include/restore_charset.inc +set @@global.histogram_size=@save_histogram_size; diff --git a/mysql-test/main/session_tracker_last_gtid.result b/mysql-test/main/session_tracker_last_gtid.result index 795d0aaa2a20f..5a78d5f03ce90 100644 --- a/mysql-test/main/session_tracker_last_gtid.result +++ b/mysql-test/main/session_tracker_last_gtid.result @@ -32,3 +32,4 @@ drop table t1; -- last_gtid -- 0-1-1002 +reset master; diff --git a/mysql-test/main/session_tracker_last_gtid.test b/mysql-test/main/session_tracker_last_gtid.test index 24cf2104a0cf8..58aee2de83718 100644 --- a/mysql-test/main/session_tracker_last_gtid.test +++ b/mysql-test/main/session_tracker_last_gtid.test @@ -17,3 +17,4 @@ select @@last_gtid; drop table t1; --disable_session_track_info +reset master; diff --git a/mysql-test/main/set_operation.result b/mysql-test/main/set_operation.result index c74179afe4122..fa0fe21d1561d 100644 --- a/mysql-test/main/set_operation.result +++ b/mysql-test/main/set_operation.result @@ -638,8 +638,6 @@ EXPLAIN "materialized": { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", "query_specifications": [ { "query_block": { @@ -961,7 +959,7 @@ UNION ALL select * from t3; 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 `test`.`t1`.`a` AS `i1`,`test`.`t1`.`b` AS `i2` from `test`.`t1` union all select `__9`.`c` AS `c`,`__9`.`d` AS `d` from (select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` intersect all (values (1,1),(2,2),(2,2),(5,5),(2,2)) intersect all select `sq`.`a` AS `a`,`sq`.`b` AS `b` from (select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` union all select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) `sq`) `__9` except all select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` union all select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` union select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` except select `test`.`t1`.`a` AS `a`,`test`.`t2`.`c` AS `c` from (`test`.`t1` join `test`.`t2`) union all select `v0`.`g` AS `g`,`v0`.`h` AS `h` from `test`.`v0` where `v0`.`g` < 4 union all select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `i1`,`t1`.`b` AS `i2` from `t1` union all select `__9`.`c` AS `c`,`__9`.`d` AS `d` from (select `t2`.`c` AS `c`,`t2`.`d` AS `d` from `t2` intersect all (values (1,1),(2,2),(2,2),(5,5),(2,2)) intersect all select `sq`.`a` AS `a`,`sq`.`b` AS `b` from (select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` union all select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1`) `sq`) `__9` except all select `t3`.`e` AS `e`,`t3`.`f` AS `f` from `t3` union all select `t2`.`c` AS `c`,`t2`.`d` AS `d` from `t2` union select `t3`.`e` AS `e`,`t3`.`f` AS `f` from `t3` except select `t1`.`a` AS `a`,`t2`.`c` AS `c` from (`t1` join `t2`) union all select `v0`.`g` AS `g`,`v0`.`h` AS `h` from `v0` where `v0`.`g` < 4 union all select `t3`.`e` AS `e`,`t3`.`f` AS `f` from `t3` latin1 latin1_swedish_ci select * from v1 limit 14; i1 i2 1 1 diff --git a/mysql-test/main/set_operation_oracle.test b/mysql-test/main/set_operation_oracle.test index 60fda4a5cb598..52152b8311008 100644 --- a/mysql-test/main/set_operation_oracle.test +++ b/mysql-test/main/set_operation_oracle.test @@ -28,8 +28,10 @@ insert into t234 values(2); insert into t234 values(3); insert into t234 values(4); - +#enable after fix MDEV-29553 +--disable_view_protocol select * from t13 union select * from t234 intersect select * from t12; +--enable_view_protocol set SQL_MODE=default; drop table t1,t2,t3; @@ -45,6 +47,8 @@ insert into t3 values (1,1),(3,3); set SQL_MODE=ORACLE; +#enable after fix MDEV-29553 +--disable_view_protocol select a,b from t1 union all select c,d from t2 intersect select e,f from t3 union all select 4,'4' from dual; explain extended select a,b from t1 union all select c,d from t2 intersect select e,f from t3 union all select 4,'4' from dual; @@ -52,6 +56,7 @@ select a,b from t1 union all select c,d from t2 intersect select e,f from t3 uni select a,b from t1 union all select c,d from t2 intersect all select e,f from t3 union all select 4,'4' from dual; explain extended select a,b from t1 union all select c,d from t2 intersect all select e,f from t3 union all select 4,'4' from dual; +--enable_view_protocol select e,f from t3 intersect select c,d from t2 union all select a,b from t1 union all select 4,'4' from dual; explain extended diff --git a/mysql-test/main/set_password.test b/mysql-test/main/set_password.test index ec652a0927446..071b2d05cdcaa 100644 --- a/mysql-test/main/set_password.test +++ b/mysql-test/main/set_password.test @@ -4,6 +4,8 @@ # Various combinations of SET PASSWORD and not-empty mysql.user.plugin field # --source include/not_embedded.inc +#enable view protocol after fix MDEV-29542 +--source include/no_view_protocol.inc --enable_connect_log diff --git a/mysql-test/main/set_statement.result b/mysql-test/main/set_statement.result index 53574fb4e4fd5..7e8266d2ab3a2 100644 --- a/mysql-test/main/set_statement.result +++ b/mysql-test/main/set_statement.result @@ -132,6 +132,8 @@ sort_buffer_size 100000 '#------------------ STATEMENT Test 6 -----------------------#' '# Initialize variables to known setting' SET SESSION keep_files_on_create=ON; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '# Pre-STATEMENT variable value' SHOW SESSION VARIABLES LIKE 'keep_files_on_create'; @@ -142,6 +144,9 @@ SET STATEMENT keep_files_on_create=OFF FOR SELECT *,@@keep_files_on_create FROM v1 v2 @@keep_files_on_create 1 2 0 3 4 0 +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '# Post-STATEMENT variable value' SHOW SESSION VARIABLES LIKE 'keep_files_on_create'; @@ -174,6 +179,8 @@ myisam_repair_threads=1, sort_buffer_size = 200000, max_join_size=2222220000000, keep_files_on_create=ON; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '# LONG ' SHOW SESSION VARIABLES LIKE 'sort_buffer_size'; @@ -195,6 +202,9 @@ SET STATEMENT keep_files_on_create=OFF FOR SHOW SESSION VARIABLES LIKE 'keep_files_on_create'; Variable_name Value keep_files_on_create OFF +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SHOW SESSION VARIABLES LIKE 'keep_files_on_create'; Variable_name Value keep_files_on_create ON @@ -231,6 +241,8 @@ sort_buffer_size=100000, binlog_format=mixed, keep_files_on_create=ON, max_join_size=2222220000000; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '' '# Pre-STATEMENT variable value @@ -263,6 +275,9 @@ max_join_size=4444440000000 FOR SELECT myProc(123.45); myProc(123.45) 200006.17 +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SET STATEMENT myisam_sort_buffer_size=400000, myisam_repair_threads=2, sort_buffer_size=300000, @@ -272,6 +287,9 @@ max_join_size=4444440000000 FOR SELECT myProc(123.45); myProc(123.45) 300006.17 +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '# Post-STATEMENT No 1 variable value Pre-STATEMENT for No 2' SELECT @@myisam_sort_buffer_size, @@ -290,6 +308,9 @@ binlog_format=row, keep_files_on_create=OFF, max_join_size=4444440000000 FOR DROP FUNCTION myProc; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '# Post-STATEMENT No 2 variable value SELECT @@myisam_sort_buffer_size, @@ -309,6 +330,8 @@ sort_buffer_size=100000, binlog_format=mixed, keep_files_on_create=ON, max_join_size=2222220000000; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '' '# Pre-STATEMENT variable value @@ -329,6 +352,9 @@ keep_files_on_create=OFF, max_join_size=4444440000000 FOR PREPARE stmt1 FROM 'SET STATEMENT binlog_format=row FOR SELECT *,@@binlog_format,@@sort_buffer_size FROM t1'; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' 'Test No 1 Post Value & Test 2 Pre values' SELECT @@myisam_sort_buffer_size, @@ -350,6 +376,9 @@ EXECUTE stmt1; v1 v2 @@binlog_format @@sort_buffer_size 1 2 ROW 200000 3 4 ROW 200000 +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '# Post-STATEMENT No 2 SELECT @@myisam_sort_buffer_size, @@ -370,6 +399,8 @@ sort_buffer_size=100000, binlog_format=mixed, keep_files_on_create=ON, max_join_size=2222220000000; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '' '# Pre-STATEMENT variable value @@ -397,6 +428,9 @@ SELECT @@myisam_sort_buffer_size, @@keep_files_on_create, @@max_join_size; END| +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' 'Test No 1 Post Value & Test 2 Pre values' SELECT @@myisam_sort_buffer_size, @@ -418,6 +452,9 @@ max_join_size=4444440000001 FOR CALL p1(); @@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size 400001 3 200001 ROW 0 4444440000001 +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '# Post-STATEMENT No 2 SELECT @@myisam_sort_buffer_size, @@ -438,6 +475,8 @@ sort_buffer_size=100000, binlog_format=mixed, keep_files_on_create=ON, max_join_size=2222220000000; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '' CREATE PROCEDURE p2() BEGIN @@ -470,6 +509,11 @@ max_join_size=4444440000000 FOR CALL p2(); @@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size 400000 3 300000 MIXED 0 3333330000000 +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '# Post-STATEMENT SELECT @@myisam_sort_buffer_size, @@ -490,6 +534,8 @@ sort_buffer_size=100000, binlog_format=mixed, keep_files_on_create=ON, max_join_size=2222220000000; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '' CREATE PROCEDURE p3() BEGIN @@ -530,6 +576,13 @@ CALL p3(); 400000 2 200000 ROW 0 4444440000000 @@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size 400000 3 300000 MIXED 0 3333330000000 +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '# Post-STATEMENT SELECT @@myisam_sort_buffer_size, @@ -552,6 +605,8 @@ sort_buffer_size=100000, binlog_format=mixed, keep_files_on_create=ON, max_join_size=2222220000000; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '' CREATE PROCEDURE p4() BEGIN @@ -625,6 +680,11 @@ CALL p4(); 320000 2 220022 ROW 1 2222220000000 @@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size 320000 2 220022 ROW 1 2222220000000 +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '# Post-STATEMENT SELECT @@myisam_sort_buffer_size, @@ -768,6 +828,8 @@ sort_buffer_size=100000, binlog_format=mixed, keep_files_on_create=ON, max_join_size=2222220000000; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '# Pre-STATEMENT variable value SELECT @@myisam_sort_buffer_size, @@ -793,6 +855,10 @@ sort_buffer_size=230013, binlog_format=row, keep_files_on_create=ON, max_join_size=2323230000000; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '# Post-STATEMENT SELECT @@myisam_sort_buffer_size, @@ -813,6 +879,8 @@ sort_buffer_size=100000, binlog_format=mixed, keep_files_on_create=ON, max_join_size=2222220000000; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '# Pre-STATEMENT variable value SELECT @@myisam_sort_buffer_size, @@ -859,6 +927,10 @@ CALL p5(); 400000 2 200000 ROW 0 4444440000000 @@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size 260000 3 230013 ROW 1 2323230000000 +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release '' '# Post-STATEMENT SELECT @@myisam_sort_buffer_size, @@ -970,6 +1042,8 @@ SELECT @@binlog_format; ROW SET @@binlog_format = @save_binlog_format; SET @@keep_files_on_create = @save_keep_files_on_create; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SET @@max_join_size = @save_max_join_size; SET @@myisam_repair_threads = @save_myisam_repair_threads; SET @@myisam_sort_buffer_size = @save_myisam_sort_buffer_size; @@ -1011,7 +1085,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select @@default_storage_engine; @@default_storage_engine MyISAM @@ -1021,7 +1095,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; SET @@default_storage_engine=@save_dfs; SET STATEMENT keycache1.key_buffer_size=1024 FOR SELECT 1; @@ -1229,7 +1303,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(3) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # Create the table t1 with the same definition as it used before # using regular statement execution mode. @@ -1240,8 +1314,20 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(3) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; +# +# MDEV-29074 GET_BIT variables crash in SET STATEMENT +# +set statement log_queries_not_using_indexes=1 for select @@log_queries_not_using_indexes; +@@log_queries_not_using_indexes +1 +select @@log_queries_not_using_indexes; +@@log_queries_not_using_indexes +0 +# +# End of 10.3 tests +# create table t (a int); SET sql_mode=ORACLE; SET STATEMENT myisam_sort_buffer_size=800000 FOR OPTIMIZE TABLE t; diff --git a/mysql-test/main/set_statement.test b/mysql-test/main/set_statement.test index 670e9862abc5d..aae7cea40d159 100644 --- a/mysql-test/main/set_statement.test +++ b/mysql-test/main/set_statement.test @@ -976,6 +976,7 @@ SET STATEMENT keycache1.key_buffer_size=1024 FOR SELECT 1; # # MDEV-6940: SET STATEMENT executed after SET GLOBAL does not work # +--disable_view_protocol set @save_general_log=@@global.general_log; --echo # SET STATEMENT works (OK) set statement lock_wait_timeout=1 for select @@lock_wait_timeout; @@ -1036,6 +1037,7 @@ select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_ti set statement long_query_time=0.01,min_examined_row_limit=50 for select sleep(0.1); select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%'; --echo #--- +--enable_view_protocol # # log_slow_verbosity is impossible to check because results are not written # in TABLE mode @@ -1161,6 +1163,16 @@ SHOW CREATE TABLE t1; DROP TABLE t1; +--echo # +--echo # MDEV-29074 GET_BIT variables crash in SET STATEMENT +--echo # +set statement log_queries_not_using_indexes=1 for select @@log_queries_not_using_indexes; +select @@log_queries_not_using_indexes; + +--echo # +--echo # End of 10.3 tests +--echo # + create table t (a int); SET sql_mode=ORACLE; SET STATEMENT myisam_sort_buffer_size=800000 FOR OPTIMIZE TABLE t; diff --git a/mysql-test/main/show.result b/mysql-test/main/show.result index d1b373d8969a6..e453ee90c7e8b 100644 --- a/mysql-test/main/show.result +++ b/mysql-test/main/show.result @@ -40,5 +40,28 @@ nm varchar(32) YES NULL a int(11) YES NULL drop table t1; # +# MDEV-4621 select returns null for information_schema.statistics.collation field +# +create table t1 (f varchar(64), key(f)); +select index_name, column_name, collation, cardinality from information_schema.STATISTICS where table_schema='test' and table_name='t1'; +index_name column_name collation cardinality +f f A NULL +select index_name, column_name, collation from information_schema.STATISTICS where table_schema='test' and table_name='t1'; +index_name column_name collation +f f A +drop table t1; +# # End of 10.2 tests # +# +# MDEV-28253 Mysqldump - INVISIBLE column error +# +create table t1 (a int, b datetime invisible on update now() without system versioning) with system versioning; +desc t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b datetime YES NULL on update current_timestamp(), INVISIBLE, WITHOUT SYSTEM VERSIONING +drop table t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/show.test b/mysql-test/main/show.test index f2f6efc4e45e4..37c30000e59d9 100644 --- a/mysql-test/main/show.test +++ b/mysql-test/main/show.test @@ -34,6 +34,25 @@ show fields from test.t1 where field in where table_name='t1' group by column_name) dt); drop table t1; +--echo # +--echo # MDEV-4621 select returns null for information_schema.statistics.collation field +--echo # +create table t1 (f varchar(64), key(f)); +select index_name, column_name, collation, cardinality from information_schema.STATISTICS where table_schema='test' and table_name='t1'; +select index_name, column_name, collation from information_schema.STATISTICS where table_schema='test' and table_name='t1'; +drop table t1; + --echo # --echo # End of 10.2 tests --echo # + +--echo # +--echo # MDEV-28253 Mysqldump - INVISIBLE column error +--echo # +create table t1 (a int, b datetime invisible on update now() without system versioning) with system versioning; +desc t1; +drop table t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/show_check.result b/mysql-test/main/show_check.result index f07c19261d0f3..26c96a5114b5c 100644 --- a/mysql-test/main/show_check.result +++ b/mysql-test/main/show_check.result @@ -63,20 +63,20 @@ Table Op Msg_type Msg_text test.t1 check status OK show index from t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema STATISTICS STATISTICS TABLE_NAME Table 253 64 2 N 1 0 8 -def information_schema STATISTICS STATISTICS NON_UNIQUE Non_unique 8 1 1 N 32769 0 63 -def information_schema STATISTICS STATISTICS INDEX_NAME Key_name 253 64 7 N 1 0 8 -def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 32769 0 63 -def information_schema STATISTICS STATISTICS COLUMN_NAME Column_name 253 64 1 N 1 0 8 -def information_schema STATISTICS STATISTICS COLLATION Collation 253 1 1 Y 0 0 8 -def information_schema STATISTICS STATISTICS CARDINALITY Cardinality 8 21 1 Y 32768 0 63 -def information_schema STATISTICS STATISTICS SUB_PART Sub_part 8 3 0 Y 32768 0 63 -def information_schema STATISTICS STATISTICS PACKED Packed 253 10 0 Y 0 0 8 -def information_schema STATISTICS STATISTICS NULLABLE Null 253 3 0 N 1 0 8 -def information_schema STATISTICS STATISTICS INDEX_TYPE Index_type 253 16 5 N 1 0 8 -def information_schema STATISTICS STATISTICS COMMENT Comment 253 16 0 Y 0 0 8 -def information_schema STATISTICS STATISTICS INDEX_COMMENT Index_comment 253 1024 0 N 1 0 8 -def information_schema STATISTICS STATISTICS IGNORED Ignored 253 3 2 N 1 0 8 +def information_schema STATISTICS STATISTICS TABLE_NAME Table 253 64 2 N 4097 0 8 +def information_schema STATISTICS STATISTICS NON_UNIQUE Non_unique 8 1 1 N 36865 0 63 +def information_schema STATISTICS STATISTICS INDEX_NAME Key_name 253 64 7 N 4097 0 8 +def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 36865 0 63 +def information_schema STATISTICS STATISTICS COLUMN_NAME Column_name 253 64 1 N 4097 0 8 +def information_schema STATISTICS STATISTICS COLLATION Collation 253 1 1 Y 4096 0 8 +def information_schema STATISTICS STATISTICS CARDINALITY Cardinality 8 21 1 Y 36864 0 63 +def information_schema STATISTICS STATISTICS SUB_PART Sub_part 8 3 0 Y 36864 0 63 +def information_schema STATISTICS STATISTICS PACKED Packed 253 10 0 Y 4096 0 8 +def information_schema STATISTICS STATISTICS NULLABLE Null 253 3 0 N 4097 0 8 +def information_schema STATISTICS STATISTICS INDEX_TYPE Index_type 253 16 5 N 4097 0 8 +def information_schema STATISTICS STATISTICS COMMENT Comment 253 16 0 Y 4096 0 8 +def information_schema STATISTICS STATISTICS INDEX_COMMENT Index_comment 253 1024 0 N 4097 0 8 +def information_schema STATISTICS STATISTICS IGNORED Ignored 253 3 2 N 4097 0 8 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored t1 0 PRIMARY 1 a A 5 NULL NULL BTREE NO t1 1 b 1 b A 1 NULL NULL BTREE NO @@ -103,47 +103,47 @@ drop table t1; -- after Bug#29394 is implemented. show variables like "wait_timeout%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 -def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 5 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 4097 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 5 N 4097 0 8 Variable_name Value wait_timeout 28800 show variables like "WAIT_timeout%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 -def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 5 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 4097 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 5 N 4097 0 8 Variable_name Value wait_timeout 28800 show variables like "this_doesn't_exists%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 1 0 8 -def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 0 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 4097 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 0 N 4097 0 8 Variable_name Value show table status from test like "this_doesn't_exists%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema TABLES TABLES TABLE_NAME Name 253 64 0 N 1 0 8 -def information_schema TABLES TABLES ENGINE Engine 253 64 0 Y 0 0 8 -def information_schema TABLES TABLES VERSION Version 8 21 0 Y 32800 0 63 -def information_schema TABLES TABLES ROW_FORMAT Row_format 253 10 0 Y 0 0 8 -def information_schema TABLES TABLES TABLE_ROWS Rows 8 21 0 Y 32800 0 63 -def information_schema TABLES TABLES AVG_ROW_LENGTH Avg_row_length 8 21 0 Y 32800 0 63 -def information_schema TABLES TABLES DATA_LENGTH Data_length 8 21 0 Y 32800 0 63 -def information_schema TABLES TABLES MAX_DATA_LENGTH Max_data_length 8 21 0 Y 32800 0 63 -def information_schema TABLES TABLES INDEX_LENGTH Index_length 8 21 0 Y 32800 0 63 -def information_schema TABLES TABLES DATA_FREE Data_free 8 21 0 Y 32800 0 63 -def information_schema TABLES TABLES AUTO_INCREMENT Auto_increment 8 21 0 Y 32800 0 63 -def information_schema TABLES TABLES CREATE_TIME Create_time 12 19 0 Y 128 0 63 -def information_schema TABLES TABLES UPDATE_TIME Update_time 12 19 0 Y 128 0 63 -def information_schema TABLES TABLES CHECK_TIME Check_time 12 19 0 Y 128 0 63 -def information_schema TABLES TABLES TABLE_COLLATION Collation 253 32 0 Y 0 0 8 -def information_schema TABLES TABLES CHECKSUM Checksum 8 21 0 Y 32800 0 63 -def information_schema TABLES TABLES CREATE_OPTIONS Create_options 253 2048 0 Y 0 0 8 -def information_schema TABLES TABLES TABLE_COMMENT Comment 253 2048 0 N 1 0 8 -def information_schema TABLES TABLES MAX_INDEX_LENGTH Max_index_length 8 21 0 Y 32800 0 63 -def information_schema TABLES TABLES TEMPORARY Temporary 253 1 0 Y 0 0 8 +def information_schema TABLES TABLES TABLE_NAME Name 253 64 0 N 4097 0 8 +def information_schema TABLES TABLES ENGINE Engine 253 64 0 Y 4096 0 8 +def information_schema TABLES TABLES VERSION Version 8 21 0 Y 36896 0 63 +def information_schema TABLES TABLES ROW_FORMAT Row_format 253 10 0 Y 4096 0 8 +def information_schema TABLES TABLES TABLE_ROWS Rows 8 21 0 Y 36896 0 63 +def information_schema TABLES TABLES AVG_ROW_LENGTH Avg_row_length 8 21 0 Y 36896 0 63 +def information_schema TABLES TABLES DATA_LENGTH Data_length 8 21 0 Y 36896 0 63 +def information_schema TABLES TABLES MAX_DATA_LENGTH Max_data_length 8 21 0 Y 36896 0 63 +def information_schema TABLES TABLES INDEX_LENGTH Index_length 8 21 0 Y 36896 0 63 +def information_schema TABLES TABLES DATA_FREE Data_free 8 21 0 Y 36896 0 63 +def information_schema TABLES TABLES AUTO_INCREMENT Auto_increment 8 21 0 Y 36896 0 63 +def information_schema TABLES TABLES CREATE_TIME Create_time 12 19 0 Y 4224 0 63 +def information_schema TABLES TABLES UPDATE_TIME Update_time 12 19 0 Y 4224 0 63 +def information_schema TABLES TABLES CHECK_TIME Check_time 12 19 0 Y 4224 0 63 +def information_schema TABLES TABLES TABLE_COLLATION Collation 253 32 0 Y 4096 0 8 +def information_schema TABLES TABLES CHECKSUM Checksum 8 21 0 Y 36896 0 63 +def information_schema TABLES TABLES CREATE_OPTIONS Create_options 253 2048 0 Y 4096 0 8 +def information_schema TABLES TABLES TABLE_COMMENT Comment 253 2048 0 N 4097 0 8 +def information_schema TABLES TABLES MAX_INDEX_LENGTH Max_index_length 8 21 0 Y 36896 0 63 +def information_schema TABLES TABLES TEMPORARY Temporary 253 1 0 Y 4096 0 8 Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary show databases; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema SCHEMATA SCHEMATA SCHEMA_NAME Database 253 64 18 N 1 0 8 +def information_schema SCHEMATA SCHEMATA SCHEMA_NAME Database 253 64 18 N 4097 0 8 Database information_schema mtr @@ -153,7 +153,7 @@ sys test show databases like "test%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema SCHEMATA SCHEMATA SCHEMA_NAME Database (test%) 253 64 4 N 1 0 8 +def information_schema SCHEMATA SCHEMATA SCHEMA_NAME Database (test%) 253 64 4 N 4097 0 8 Database (test%) test create table t1 (f1 int not null, f2 int not null, f3 int not null, f4 int not null, primary key(f1,f2,f3,f4)); @@ -199,13 +199,13 @@ show create table t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 rename t2; show create table t2; Table Create Table t2 CREATE TEMPORARY TABLE `t2` ( `a` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; create table t1 ( test_set set( 'val1', 'val2', 'val3' ) not null default '', @@ -222,7 +222,7 @@ t1 CREATE TABLE `t1` ( `c` int(11) NOT NULL COMMENT 'int column', `c-b` int(11) DEFAULT NULL COMMENT 'name with a minus', `space 2` int(11) DEFAULT NULL COMMENT 'name with a space' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='it''s a table' set sql_quote_show_create=0; show create table t1; Table Create Table @@ -232,7 +232,7 @@ t1 CREATE TABLE t1 ( c int(11) NOT NULL COMMENT 'int column', `c-b` int(11) DEFAULT NULL COMMENT 'name with a minus', `space 2` int(11) DEFAULT NULL COMMENT 'name with a space' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='it''s a table' set sql_quote_show_create=1; show full columns from t1; Field Type Collation Null Key Default Extra Privileges Comment @@ -248,7 +248,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, UNIQUE KEY `aa` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int not null, primary key (a)); show create table t1; @@ -256,7 +256,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; flush tables; show open tables; @@ -279,7 +279,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` varchar(10) DEFAULT NULL, KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test' alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0; show create table t1; Table Create Table @@ -287,7 +287,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` varchar(10) DEFAULT NULL, KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test' ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK_KEYS=DEFAULT DELAY_KEY_WRITE=0 ROW_FORMAT=default; show create table t1; Table Create Table @@ -295,7 +295,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` varchar(10) DEFAULT NULL, KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0)); show columns from t1; @@ -365,7 +365,7 @@ t1 CREATE TABLE `t1` ( `type_long_blob` longblob DEFAULT NULL, PRIMARY KEY (`type_tiny`), KEY `type_short` (`type_short`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test' insert into t1 (type_timestamp) values ("2003-02-07 10:00:01"); select * from t1; type_bool type_tiny type_short type_mediumint type_bigint type_decimal type_numeric empty_char type_char type_varchar type_timestamp type_date type_time type_datetime type_year type_enum type_set type_tinyblob type_blob type_medium_blob type_long_blob @@ -399,28 +399,28 @@ SHOW CREATE TABLE ```ab``cd```; Table Create Table `ab`cd` CREATE TABLE ```ab``cd``` ( i int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE ```ab``cd```; CREATE TABLE ```ab````cd``` (i INT); SHOW CREATE TABLE ```ab````cd```; Table Create Table `ab``cd` CREATE TABLE ```ab````cd``` ( i int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE ```ab````cd```; CREATE TABLE ```a` (i INT); SHOW CREATE TABLE ```a`; Table Create Table `a CREATE TABLE ```a` ( i int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE ```a`; CREATE TABLE `a.1` (i INT); SHOW CREATE TABLE `a.1`; Table Create Table a.1 CREATE TABLE `a.1` ( i int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE `a.1`; SET sql_mode= 'ANSI_QUOTES'; CREATE TABLE """a" (i INT); @@ -428,7 +428,7 @@ SHOW CREATE TABLE """a"; Table Create Table "a CREATE TABLE """a" ( i int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE """a"; SET sql_mode= ''; SET sql_quote_show_create= OFF; @@ -437,14 +437,14 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE t1 ( i int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE `table` (i INT); SHOW CREATE TABLE `table`; Table Create Table table CREATE TABLE `table` ( i int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE `table`; SET sql_quote_show_create= @old_sql_quote_show_create; SET sql_mode= @old_sql_mode; @@ -523,7 +523,7 @@ drop table t1, t2, t3; create database mysqltest; show create database mysqltest; Database Create Database -mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ +mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ create table mysqltest.t1(a int); insert into mysqltest.t1 values(1); create user mysqltest_1@localhost; @@ -539,30 +539,30 @@ a 1 show create database mysqltest; Database Create Database -mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ +mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ drop table t1; -ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`t1` drop database mysqltest; ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest' disconnect con1; connect con2,localhost,mysqltest_2,,test; connection con2; select * from mysqltest.t1; -ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table `mysqltest`.`t1` show create database mysqltest; ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest' drop table mysqltest.t1; -ERROR 42000: DROP command denied to user 'mysqltest_2'@'localhost' for table 't1' +ERROR 42000: DROP command denied to user 'mysqltest_2'@'localhost' for table `mysqltest`.`t1` drop database mysqltest; ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest' disconnect con2; connect con3,localhost,mysqltest_3,,test; connection con3; select * from mysqltest.t1; -ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table `mysqltest`.`t1` show create database mysqltest; Database Create Database -mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ +mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ drop table mysqltest.t1; drop database mysqltest; disconnect con3; @@ -579,7 +579,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, KEY `i` (`i`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY; SHOW CREATE TABLE t1; @@ -587,7 +587,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, KEY `i` (`i`) USING HASH -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY; SHOW CREATE TABLE t1; @@ -595,7 +595,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, KEY `i` (`i`) USING BTREE -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM; SHOW CREATE TABLE t1; @@ -603,7 +603,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, KEY `i` (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM; SHOW CREATE TABLE t1; @@ -611,7 +611,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, KEY `i` (`i`) USING BTREE -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM; SHOW CREATE TABLE t1; @@ -619,14 +619,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, KEY `i` (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 ENGINE=MEMORY; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, KEY `i` (`i`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM; SHOW CREATE TABLE t1; @@ -634,14 +634,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, KEY `i` (`i`) USING BTREE -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 ENGINE=MEMORY; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, KEY `i` (`i`) USING BTREE -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1( field1 text NOT NULL, @@ -649,20 +649,20 @@ PRIMARY KEY(field1(1000)) ); show index from t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema STATISTICS STATISTICS TABLE_NAME Table 253 64 2 N 1 0 63 -def information_schema STATISTICS STATISTICS NON_UNIQUE Non_unique 8 1 1 N 32769 0 63 -def information_schema STATISTICS STATISTICS INDEX_NAME Key_name 253 64 7 N 1 0 63 -def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 32769 0 63 -def information_schema STATISTICS STATISTICS COLUMN_NAME Column_name 253 64 6 N 1 0 63 -def information_schema STATISTICS STATISTICS COLLATION Collation 253 1 1 Y 0 0 63 -def information_schema STATISTICS STATISTICS CARDINALITY Cardinality 8 21 1 Y 32768 0 63 -def information_schema STATISTICS STATISTICS SUB_PART Sub_part 8 3 4 Y 32768 0 63 -def information_schema STATISTICS STATISTICS PACKED Packed 253 10 0 Y 0 0 63 -def information_schema STATISTICS STATISTICS NULLABLE Null 253 3 0 N 1 0 63 -def information_schema STATISTICS STATISTICS INDEX_TYPE Index_type 253 16 5 N 1 0 63 -def information_schema STATISTICS STATISTICS COMMENT Comment 253 16 0 Y 0 0 63 -def information_schema STATISTICS STATISTICS INDEX_COMMENT Index_comment 253 1024 0 N 1 0 63 -def information_schema STATISTICS STATISTICS IGNORED Ignored 253 3 2 N 1 0 63 +def information_schema STATISTICS STATISTICS TABLE_NAME Table 253 64 2 N 4097 0 63 +def information_schema STATISTICS STATISTICS NON_UNIQUE Non_unique 8 1 1 N 36865 0 63 +def information_schema STATISTICS STATISTICS INDEX_NAME Key_name 253 64 7 N 4097 0 63 +def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 36865 0 63 +def information_schema STATISTICS STATISTICS COLUMN_NAME Column_name 253 64 6 N 4097 0 63 +def information_schema STATISTICS STATISTICS COLLATION Collation 253 1 1 Y 4096 0 63 +def information_schema STATISTICS STATISTICS CARDINALITY Cardinality 8 21 1 Y 36864 0 63 +def information_schema STATISTICS STATISTICS SUB_PART Sub_part 8 3 4 Y 36864 0 63 +def information_schema STATISTICS STATISTICS PACKED Packed 253 10 0 Y 4096 0 63 +def information_schema STATISTICS STATISTICS NULLABLE Null 253 3 0 N 4097 0 63 +def information_schema STATISTICS STATISTICS INDEX_TYPE Index_type 253 16 5 N 4097 0 63 +def information_schema STATISTICS STATISTICS COMMENT Comment 253 16 0 Y 4096 0 63 +def information_schema STATISTICS STATISTICS INDEX_COMMENT Index_comment 253 1024 0 N 4097 0 63 +def information_schema STATISTICS STATISTICS IGNORED Ignored 253 3 2 N 4097 0 63 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored t1 0 PRIMARY 1 field1 A 0 1000 NULL BTREE NO drop table t1; @@ -679,7 +679,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) NOT NULL, PRIMARY KEY (`c1`) USING HASH, KEY `c2` (`c2`) USING BTREE -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; flush tables; SHOW TABLE STATUS like 't1'; @@ -877,63 +877,63 @@ set names utf8; ---------------------------------------------------------------- SHOW CHARACTER SET LIKE 'utf8mb3'; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema CHARACTER_SETS CHARACTER_SETS CHARACTER_SET_NAME Charset 253 96 7 N 1 0 33 -def information_schema CHARACTER_SETS CHARACTER_SETS DESCRIPTION Description 253 180 13 N 1 0 33 -def information_schema CHARACTER_SETS CHARACTER_SETS DEFAULT_COLLATE_NAME Default collation 253 96 18 N 1 0 33 -def information_schema CHARACTER_SETS CHARACTER_SETS MAXLEN Maxlen 8 3 1 N 32769 0 63 +def information_schema CHARACTER_SETS CHARACTER_SETS CHARACTER_SET_NAME Charset 253 96 7 N 4097 0 33 +def information_schema CHARACTER_SETS CHARACTER_SETS DESCRIPTION Description 253 180 13 N 4097 0 33 +def information_schema CHARACTER_SETS CHARACTER_SETS DEFAULT_COLLATE_NAME Default collation 253 96 18 N 4097 0 33 +def information_schema CHARACTER_SETS CHARACTER_SETS MAXLEN Maxlen 8 3 1 N 36865 0 63 Charset Description Default collation Maxlen utf8mb3 UTF-8 Unicode utf8mb3_general_ci 3 ---------------------------------------------------------------- SHOW COLLATION LIKE 'latin1_bin'; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema COLLATIONS COLLATIONS COLLATION_NAME Collation 253 96 10 N 1 0 33 -def information_schema COLLATIONS COLLATIONS CHARACTER_SET_NAME Charset 253 96 6 N 1 0 33 -def information_schema COLLATIONS COLLATIONS ID Id 8 11 2 N 32769 0 63 -def information_schema COLLATIONS COLLATIONS IS_DEFAULT Default 253 9 0 N 1 0 33 -def information_schema COLLATIONS COLLATIONS IS_COMPILED Compiled 253 9 3 N 1 0 33 -def information_schema COLLATIONS COLLATIONS SORTLEN Sortlen 8 3 1 N 32769 0 63 +def information_schema COLLATIONS COLLATIONS COLLATION_NAME Collation 253 96 10 N 4097 0 33 +def information_schema COLLATIONS COLLATIONS CHARACTER_SET_NAME Charset 253 96 6 N 4097 0 33 +def information_schema COLLATIONS COLLATIONS ID Id 8 11 2 N 36865 0 63 +def information_schema COLLATIONS COLLATIONS IS_DEFAULT Default 253 9 0 N 4097 0 33 +def information_schema COLLATIONS COLLATIONS IS_COMPILED Compiled 253 9 3 N 4097 0 33 +def information_schema COLLATIONS COLLATIONS SORTLEN Sortlen 8 3 1 N 36865 0 63 Collation Charset Id Default Compiled Sortlen latin1_bin latin1 47 Yes 1 ---------------------------------------------------------------- SHOW CREATE DATABASE mysqltest1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def Database 253 192 10 N 1 39 33 -def Create Database 253 3072 69 N 1 39 33 +def Create Database 253 3072 95 N 1 39 33 Database Create Database -mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */ +mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ ---------------------------------------------------------------- SHOW DATABASES LIKE 'mysqltest1'; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema SCHEMATA SCHEMATA SCHEMA_NAME Database (mysqltest1) 253 192 10 N 1 0 33 +def information_schema SCHEMATA SCHEMATA SCHEMA_NAME Database (mysqltest1) 253 192 10 N 4097 0 33 Database (mysqltest1) mysqltest1 ---------------------------------------------------------------- SHOW CREATE TABLE t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def Table 253 192 2 N 1 39 33 -def Create Table 253 3072 102 N 1 39 33 +def Create Table 253 3072 128 N 1 39 33 Table Create Table t1 CREATE TABLE `t1` ( `c` int(11) NOT NULL, PRIMARY KEY (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ---------------------------------------------------------------- SHOW INDEX FROM t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema STATISTICS STATISTICS TABLE_NAME Table 253 192 2 N 1 0 33 -def information_schema STATISTICS STATISTICS NON_UNIQUE Non_unique 8 1 1 N 32769 0 63 -def information_schema STATISTICS STATISTICS INDEX_NAME Key_name 253 192 7 N 1 0 33 -def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 32769 0 63 -def information_schema STATISTICS STATISTICS COLUMN_NAME Column_name 253 192 1 N 1 0 33 -def information_schema STATISTICS STATISTICS COLLATION Collation 253 3 1 Y 0 0 33 -def information_schema STATISTICS STATISTICS CARDINALITY Cardinality 8 21 1 Y 32768 0 63 -def information_schema STATISTICS STATISTICS SUB_PART Sub_part 8 3 0 Y 32768 0 63 -def information_schema STATISTICS STATISTICS PACKED Packed 253 30 0 Y 0 0 33 -def information_schema STATISTICS STATISTICS NULLABLE Null 253 9 0 N 1 0 33 -def information_schema STATISTICS STATISTICS INDEX_TYPE Index_type 253 48 5 N 1 0 33 -def information_schema STATISTICS STATISTICS COMMENT Comment 253 48 0 Y 0 0 33 -def information_schema STATISTICS STATISTICS INDEX_COMMENT Index_comment 253 3072 0 N 1 0 33 -def information_schema STATISTICS STATISTICS IGNORED Ignored 253 9 2 N 1 0 33 +def information_schema STATISTICS STATISTICS TABLE_NAME Table 253 192 2 N 4097 0 33 +def information_schema STATISTICS STATISTICS NON_UNIQUE Non_unique 8 1 1 N 36865 0 63 +def information_schema STATISTICS STATISTICS INDEX_NAME Key_name 253 192 7 N 4097 0 33 +def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 36865 0 63 +def information_schema STATISTICS STATISTICS COLUMN_NAME Column_name 253 192 1 N 4097 0 33 +def information_schema STATISTICS STATISTICS COLLATION Collation 253 3 1 Y 4096 0 33 +def information_schema STATISTICS STATISTICS CARDINALITY Cardinality 8 21 1 Y 36864 0 63 +def information_schema STATISTICS STATISTICS SUB_PART Sub_part 8 3 0 Y 36864 0 63 +def information_schema STATISTICS STATISTICS PACKED Packed 253 30 0 Y 4096 0 33 +def information_schema STATISTICS STATISTICS NULLABLE Null 253 9 0 N 4097 0 33 +def information_schema STATISTICS STATISTICS INDEX_TYPE Index_type 253 48 5 N 4097 0 33 +def information_schema STATISTICS STATISTICS COMMENT Comment 253 48 0 Y 4096 0 33 +def information_schema STATISTICS STATISTICS INDEX_COMMENT Index_comment 253 3072 0 N 4097 0 33 +def information_schema STATISTICS STATISTICS IGNORED Ignored 253 9 2 N 4097 0 33 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored t1 0 PRIMARY 1 c A 0 NULL NULL BTREE NO ---------------------------------------------------------------- @@ -950,15 +950,15 @@ TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't1'; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema TABLES TABLES TABLE_CATALOG TABLE_CATALOG 253 1536 3 N 1 0 33 -def information_schema TABLES TABLES TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 1 0 33 -def information_schema TABLES TABLES TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33 -def information_schema TABLES TABLES TABLE_TYPE TABLE_TYPE 253 192 10 N 1 0 33 -def information_schema TABLES TABLES ENGINE ENGINE 253 192 6 Y 0 0 33 -def information_schema TABLES TABLES ROW_FORMAT ROW_FORMAT 253 30 5 Y 0 0 33 -def information_schema TABLES TABLES TABLE_COLLATION TABLE_COLLATION 253 96 17 Y 0 0 33 -def information_schema TABLES TABLES CREATE_OPTIONS CREATE_OPTIONS 253 6144 0 Y 0 0 33 -def information_schema TABLES TABLES TABLE_COMMENT TABLE_COMMENT 253 6144 0 N 1 0 33 +def information_schema TABLES TABLES TABLE_CATALOG TABLE_CATALOG 253 1536 3 N 4097 0 33 +def information_schema TABLES TABLES TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 4097 0 33 +def information_schema TABLES TABLES TABLE_NAME TABLE_NAME 253 192 2 N 4097 0 33 +def information_schema TABLES TABLES TABLE_TYPE TABLE_TYPE 253 192 10 N 4097 0 33 +def information_schema TABLES TABLES ENGINE ENGINE 253 192 6 Y 4096 0 33 +def information_schema TABLES TABLES ROW_FORMAT ROW_FORMAT 253 30 5 Y 4096 0 33 +def information_schema TABLES TABLES TABLE_COLLATION TABLE_COLLATION 253 96 17 Y 4096 0 33 +def information_schema TABLES TABLES CREATE_OPTIONS CREATE_OPTIONS 253 6144 0 Y 4096 0 33 +def information_schema TABLES TABLES TABLE_COMMENT TABLE_COMMENT 253 6144 0 N 4097 0 33 TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_COLLATION CREATE_OPTIONS TABLE_COMMENT def test t1 BASE TABLE MyISAM Fixed latin1_swedish_ci ---------------------------------------------------------------- @@ -980,53 +980,53 @@ COLUMN_COMMENT FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 't1'; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema COLUMNS COLUMNS TABLE_CATALOG TABLE_CATALOG 253 1536 3 N 1 0 33 -def information_schema COLUMNS COLUMNS TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 1 0 33 -def information_schema COLUMNS COLUMNS TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33 -def information_schema COLUMNS COLUMNS COLUMN_NAME COLUMN_NAME 253 192 1 N 1 0 33 -def information_schema COLUMNS COLUMNS COLUMN_DEFAULT COLUMN_DEFAULT 252 589788 0 Y 16 0 33 -def information_schema COLUMNS COLUMNS IS_NULLABLE IS_NULLABLE 253 9 2 N 1 0 33 -def information_schema COLUMNS COLUMNS DATA_TYPE DATA_TYPE 253 192 3 N 1 0 33 -def information_schema COLUMNS COLUMNS CHARACTER_SET_NAME CHARACTER_SET_NAME 253 96 0 Y 0 0 33 -def information_schema COLUMNS COLUMNS COLLATION_NAME COLLATION_NAME 253 96 0 Y 0 0 33 -def information_schema COLUMNS COLUMNS COLUMN_TYPE COLUMN_TYPE 252 589815 7 N 17 0 33 -def information_schema COLUMNS COLUMNS COLUMN_KEY COLUMN_KEY 253 9 3 N 1 0 33 -def information_schema COLUMNS COLUMNS EXTRA EXTRA 253 90 0 N 1 0 33 -def information_schema COLUMNS COLUMNS PRIVILEGES PRIVILEGES 253 240 31 N 1 0 33 -def information_schema COLUMNS COLUMNS COLUMN_COMMENT COLUMN_COMMENT 253 3072 0 N 1 0 33 +def information_schema COLUMNS COLUMNS TABLE_CATALOG TABLE_CATALOG 253 1536 3 N 4097 0 33 +def information_schema COLUMNS COLUMNS TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 4097 0 33 +def information_schema COLUMNS COLUMNS TABLE_NAME TABLE_NAME 253 192 2 N 4097 0 33 +def information_schema COLUMNS COLUMNS COLUMN_NAME COLUMN_NAME 253 192 1 N 4097 0 33 +def information_schema COLUMNS COLUMNS COLUMN_DEFAULT COLUMN_DEFAULT 252 589788 0 Y 4112 0 33 +def information_schema COLUMNS COLUMNS IS_NULLABLE IS_NULLABLE 253 9 2 N 4097 0 33 +def information_schema COLUMNS COLUMNS DATA_TYPE DATA_TYPE 253 192 3 N 4097 0 33 +def information_schema COLUMNS COLUMNS CHARACTER_SET_NAME CHARACTER_SET_NAME 253 96 0 Y 4096 0 33 +def information_schema COLUMNS COLUMNS COLLATION_NAME COLLATION_NAME 253 96 0 Y 4096 0 33 +def information_schema COLUMNS COLUMNS COLUMN_TYPE COLUMN_TYPE 252 589815 7 N 4113 0 33 +def information_schema COLUMNS COLUMNS COLUMN_KEY COLUMN_KEY 253 9 3 N 4097 0 33 +def information_schema COLUMNS COLUMNS EXTRA EXTRA 253 240 0 N 4097 0 33 +def information_schema COLUMNS COLUMNS PRIVILEGES PRIVILEGES 253 240 31 N 4097 0 33 +def information_schema COLUMNS COLUMNS COLUMN_COMMENT COLUMN_COMMENT 253 3072 0 N 4097 0 33 TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT def test t1 c NULL NO int NULL NULL int(11) PRI select,insert,update,references ---------------------------------------------------------------- SHOW TABLES LIKE 't1'; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema TABLE_NAMES TABLE_NAMES TABLE_NAME Tables_in_test (t1) 253 219 2 N 1 0 33 +def information_schema TABLE_NAMES TABLE_NAMES TABLE_NAME Tables_in_test (t1) 253 219 2 N 4097 0 33 Tables_in_test (t1) t1 ---------------------------------------------------------------- SHOW COLUMNS FROM t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema COLUMNS COLUMNS COLUMN_NAME Field 253 192 1 N 1 0 33 -def information_schema COLUMNS COLUMNS COLUMN_TYPE Type 252 589815 7 N 17 0 33 -def information_schema COLUMNS COLUMNS IS_NULLABLE Null 253 9 2 N 1 0 33 -def information_schema COLUMNS COLUMNS COLUMN_KEY Key 253 9 3 N 1 0 33 -def information_schema COLUMNS COLUMNS COLUMN_DEFAULT Default 252 589788 0 Y 16 0 33 -def information_schema COLUMNS COLUMNS EXTRA Extra 253 90 0 N 1 0 33 +def information_schema COLUMNS COLUMNS COLUMN_NAME Field 253 192 1 N 4097 0 33 +def information_schema COLUMNS COLUMNS COLUMN_TYPE Type 252 589815 7 N 4113 0 33 +def information_schema COLUMNS COLUMNS IS_NULLABLE Null 253 9 2 N 4097 0 33 +def information_schema COLUMNS COLUMNS COLUMN_KEY Key 253 9 3 N 4097 0 33 +def information_schema COLUMNS COLUMNS COLUMN_DEFAULT Default 252 589788 0 Y 4112 0 33 +def information_schema COLUMNS COLUMNS EXTRA Extra 253 240 0 N 4097 0 33 Field Type Null Key Default Extra c int(11) NO PRI NULL ---------------------------------------------------------------- SHOW TRIGGERS LIKE 't1'; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema TRIGGERS TRIGGERS TRIGGER_NAME Trigger 253 192 5 N 1 0 33 -def information_schema TRIGGERS TRIGGERS EVENT_MANIPULATION Event 253 18 6 N 1 0 33 -def information_schema TRIGGERS TRIGGERS EVENT_OBJECT_TABLE Table 253 192 2 N 1 0 33 -def information_schema TRIGGERS TRIGGERS ACTION_STATEMENT Statement 252 589815 10 N 17 0 33 -def information_schema TRIGGERS TRIGGERS ACTION_TIMING Timing 253 18 6 N 1 0 33 -def information_schema TRIGGERS TRIGGERS CREATED Created 12 22 22 Y 128 2 63 -def information_schema TRIGGERS TRIGGERS SQL_MODE sql_mode 253 24576 89 N 1 0 33 -def information_schema TRIGGERS TRIGGERS DEFINER Definer 253 1152 14 N 1 0 33 -def information_schema TRIGGERS TRIGGERS CHARACTER_SET_CLIENT character_set_client 253 96 6 N 1 0 33 -def information_schema TRIGGERS TRIGGERS COLLATION_CONNECTION collation_connection 253 96 6 N 1 0 33 -def information_schema TRIGGERS TRIGGERS DATABASE_COLLATION Database Collation 253 96 17 N 1 0 33 +def information_schema TRIGGERS TRIGGERS TRIGGER_NAME Trigger 253 192 5 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS EVENT_MANIPULATION Event 253 18 6 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS EVENT_OBJECT_TABLE Table 253 192 2 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_STATEMENT Statement 252 589815 10 N 4113 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_TIMING Timing 253 18 6 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS CREATED Created 12 22 22 Y 4224 2 63 +def information_schema TRIGGERS TRIGGERS SQL_MODE sql_mode 253 24576 89 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS DEFINER Definer 253 1152 14 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS CHARACTER_SET_CLIENT character_set_client 253 96 6 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS COLLATION_CONNECTION collation_connection 253 96 6 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS DATABASE_COLLATION Database Collation 253 96 17 N 4097 0 33 Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation t1_bi INSERT t1 SET @a = 1 BEFORE # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost binary binary latin1_swedish_ci ---------------------------------------------------------------- @@ -1051,28 +1051,28 @@ DEFINER FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 't1_bi'; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema TRIGGERS TRIGGERS TRIGGER_CATALOG TRIGGER_CATALOG 253 1536 3 N 1 0 33 -def information_schema TRIGGERS TRIGGERS TRIGGER_SCHEMA TRIGGER_SCHEMA 253 192 4 N 1 0 33 -def information_schema TRIGGERS TRIGGERS TRIGGER_NAME TRIGGER_NAME 253 192 5 N 1 0 33 -def information_schema TRIGGERS TRIGGERS EVENT_MANIPULATION EVENT_MANIPULATION 253 18 6 N 1 0 33 -def information_schema TRIGGERS TRIGGERS EVENT_OBJECT_CATALOG EVENT_OBJECT_CATALOG 253 1536 3 N 1 0 33 -def information_schema TRIGGERS TRIGGERS EVENT_OBJECT_SCHEMA EVENT_OBJECT_SCHEMA 253 192 4 N 1 0 33 -def information_schema TRIGGERS TRIGGERS EVENT_OBJECT_TABLE EVENT_OBJECT_TABLE 253 192 2 N 1 0 33 -def information_schema TRIGGERS TRIGGERS ACTION_CONDITION ACTION_CONDITION 252 589815 0 Y 16 0 33 -def information_schema TRIGGERS TRIGGERS ACTION_STATEMENT ACTION_STATEMENT 252 589815 10 N 17 0 33 -def information_schema TRIGGERS TRIGGERS ACTION_ORIENTATION ACTION_ORIENTATION 253 27 3 N 1 0 33 -def information_schema TRIGGERS TRIGGERS ACTION_TIMING ACTION_TIMING 253 18 6 N 1 0 33 -def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_OLD_TABLE 253 192 0 Y 0 0 33 -def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_NEW_TABLE 253 192 0 Y 0 0 33 -def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_OLD_ROW 253 9 3 N 1 0 33 -def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_NEW_ROW ACTION_REFERENCE_NEW_ROW 253 9 3 N 1 0 33 -def information_schema TRIGGERS TRIGGERS SQL_MODE SQL_MODE 253 24576 89 N 1 0 33 -def information_schema TRIGGERS TRIGGERS DEFINER DEFINER 253 1152 14 N 1 0 33 +def information_schema TRIGGERS TRIGGERS TRIGGER_CATALOG TRIGGER_CATALOG 253 1536 3 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS TRIGGER_SCHEMA TRIGGER_SCHEMA 253 192 4 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS TRIGGER_NAME TRIGGER_NAME 253 192 5 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS EVENT_MANIPULATION EVENT_MANIPULATION 253 18 6 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS EVENT_OBJECT_CATALOG EVENT_OBJECT_CATALOG 253 1536 3 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS EVENT_OBJECT_SCHEMA EVENT_OBJECT_SCHEMA 253 192 4 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS EVENT_OBJECT_TABLE EVENT_OBJECT_TABLE 253 192 2 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_CONDITION ACTION_CONDITION 252 589815 0 Y 4112 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_STATEMENT ACTION_STATEMENT 252 589815 10 N 4113 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_ORIENTATION ACTION_ORIENTATION 253 27 3 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_TIMING ACTION_TIMING 253 18 6 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_OLD_TABLE 253 192 0 Y 4096 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_NEW_TABLE 253 192 0 Y 4096 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_OLD_ROW 253 9 3 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_NEW_ROW ACTION_REFERENCE_NEW_ROW 253 9 3 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS SQL_MODE SQL_MODE 253 24576 89 N 4097 0 33 +def information_schema TRIGGERS TRIGGERS DEFINER DEFINER 253 1152 14 N 4097 0 33 TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW SQL_MODE DEFINER def test t1_bi INSERT def test t1 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost SELECT CREATED FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name='t1_bi'; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema TRIGGERS TRIGGERS CREATED CREATED 12 22 22 Y 128 2 63 +def information_schema TRIGGERS TRIGGERS CREATED CREATED 12 22 22 Y 4224 2 63 CREATED # ---------------------------------------------------------------- @@ -1089,17 +1089,17 @@ SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema VIEWS VIEWS TABLE_CATALOG TABLE_CATALOG 253 1536 3 N 1 0 33 -def information_schema VIEWS VIEWS TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 1 0 33 -def information_schema VIEWS VIEWS TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33 -def information_schema VIEWS VIEWS VIEW_DEFINITION VIEW_DEFINITION 252 589815 15 N 17 0 33 -def information_schema VIEWS VIEWS CHECK_OPTION CHECK_OPTION 253 24 4 N 1 0 33 -def information_schema VIEWS VIEWS IS_UPDATABLE IS_UPDATABLE 253 9 2 N 1 0 33 -def information_schema VIEWS VIEWS DEFINER DEFINER 253 1152 14 N 1 0 33 -def information_schema VIEWS VIEWS SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33 -def information_schema VIEWS VIEWS CHARACTER_SET_CLIENT CHARACTER_SET_CLIENT 253 96 6 N 1 0 33 -def information_schema VIEWS VIEWS COLLATION_CONNECTION COLLATION_CONNECTION 253 96 6 N 1 0 33 -def information_schema VIEWS VIEWS ALGORITHM ALGORITHM 253 30 9 N 1 0 33 +def information_schema VIEWS VIEWS TABLE_CATALOG TABLE_CATALOG 253 1536 3 N 4097 0 33 +def information_schema VIEWS VIEWS TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 4097 0 33 +def information_schema VIEWS VIEWS TABLE_NAME TABLE_NAME 253 192 2 N 4097 0 33 +def information_schema VIEWS VIEWS VIEW_DEFINITION VIEW_DEFINITION 252 589815 15 N 4113 0 33 +def information_schema VIEWS VIEWS CHECK_OPTION CHECK_OPTION 253 24 4 N 4097 0 33 +def information_schema VIEWS VIEWS IS_UPDATABLE IS_UPDATABLE 253 9 2 N 4097 0 33 +def information_schema VIEWS VIEWS DEFINER DEFINER 253 1152 14 N 4097 0 33 +def information_schema VIEWS VIEWS SECURITY_TYPE SECURITY_TYPE 253 21 7 N 4097 0 33 +def information_schema VIEWS VIEWS CHARACTER_SET_CLIENT CHARACTER_SET_CLIENT 253 96 6 N 4097 0 33 +def information_schema VIEWS VIEWS COLLATION_CONNECTION COLLATION_CONNECTION 253 96 6 N 4097 0 33 +def information_schema VIEWS VIEWS ALGORITHM ALGORITHM 253 30 9 N 4097 0 33 TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM def test v1 select 1 AS `1` NONE NO root@localhost DEFINER binary binary UNDEFINED ---------------------------------------------------------------- @@ -1137,24 +1137,24 @@ DEFINER FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p1'; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema ROUTINES ROUTINES SPECIFIC_NAME SPECIFIC_NAME 253 192 2 N 1 0 33 -def information_schema ROUTINES ROUTINES ROUTINE_CATALOG ROUTINE_CATALOG 253 1536 3 N 1 0 33 -def information_schema ROUTINES ROUTINES ROUTINE_SCHEMA ROUTINE_SCHEMA 253 192 4 N 1 0 33 -def information_schema ROUTINES ROUTINES ROUTINE_NAME ROUTINE_NAME 253 192 2 N 1 0 33 -def information_schema ROUTINES ROUTINES ROUTINE_TYPE ROUTINE_TYPE 253 39 9 N 1 0 33 -def information_schema ROUTINES ROUTINES DTD_IDENTIFIER DTD_IDENTIFIER 252 589815 0 Y 16 0 33 -def information_schema ROUTINES ROUTINES ROUTINE_BODY ROUTINE_BODY 253 24 3 N 1 0 33 -def information_schema ROUTINES ROUTINES ROUTINE_DEFINITION ROUTINE_DEFINITION 252 589815 8 Y 16 0 33 -def information_schema ROUTINES ROUTINES EXTERNAL_NAME EXTERNAL_NAME 253 192 0 Y 0 0 33 -def information_schema ROUTINES ROUTINES EXTERNAL_LANGUAGE EXTERNAL_LANGUAGE 253 192 0 Y 0 0 33 -def information_schema ROUTINES ROUTINES PARAMETER_STYLE PARAMETER_STYLE 253 24 3 N 1 0 33 -def information_schema ROUTINES ROUTINES IS_DETERMINISTIC IS_DETERMINISTIC 253 9 2 N 1 0 33 -def information_schema ROUTINES ROUTINES SQL_DATA_ACCESS SQL_DATA_ACCESS 253 192 12 N 1 0 33 -def information_schema ROUTINES ROUTINES SQL_PATH SQL_PATH 253 192 0 Y 0 0 33 -def information_schema ROUTINES ROUTINES SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33 -def information_schema ROUTINES ROUTINES SQL_MODE SQL_MODE 253 24576 89 N 1 0 33 -def information_schema ROUTINES ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 252 589815 0 N 17 0 33 -def information_schema ROUTINES ROUTINES DEFINER DEFINER 253 1152 14 N 1 0 33 +def information_schema ROUTINES ROUTINES SPECIFIC_NAME SPECIFIC_NAME 253 192 2 N 4097 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_CATALOG ROUTINE_CATALOG 253 1536 3 N 4097 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_SCHEMA ROUTINE_SCHEMA 253 192 4 N 4097 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_NAME ROUTINE_NAME 253 192 2 N 4097 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_TYPE ROUTINE_TYPE 253 39 9 N 4097 0 33 +def information_schema ROUTINES ROUTINES DTD_IDENTIFIER DTD_IDENTIFIER 252 589815 0 Y 4112 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_BODY ROUTINE_BODY 253 24 3 N 4097 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_DEFINITION ROUTINE_DEFINITION 252 589815 8 Y 4112 0 33 +def information_schema ROUTINES ROUTINES EXTERNAL_NAME EXTERNAL_NAME 253 192 0 Y 4096 0 33 +def information_schema ROUTINES ROUTINES EXTERNAL_LANGUAGE EXTERNAL_LANGUAGE 253 192 0 Y 4096 0 33 +def information_schema ROUTINES ROUTINES PARAMETER_STYLE PARAMETER_STYLE 253 24 3 N 4097 0 33 +def information_schema ROUTINES ROUTINES IS_DETERMINISTIC IS_DETERMINISTIC 253 9 2 N 4097 0 33 +def information_schema ROUTINES ROUTINES SQL_DATA_ACCESS SQL_DATA_ACCESS 253 192 12 N 4097 0 33 +def information_schema ROUTINES ROUTINES SQL_PATH SQL_PATH 253 192 0 Y 4096 0 33 +def information_schema ROUTINES ROUTINES SECURITY_TYPE SECURITY_TYPE 253 21 7 N 4097 0 33 +def information_schema ROUTINES ROUTINES SQL_MODE SQL_MODE 253 24576 89 N 4097 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 252 589815 0 N 4113 0 33 +def information_schema ROUTINES ROUTINES DEFINER DEFINER 253 1152 14 N 4097 0 33 SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE SQL_MODE ROUTINE_COMMENT DEFINER p1 def test p1 PROCEDURE NULL SQL SELECT 1 NULL NULL SQL NO CONTAINS SQL NULL DEFINER STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost ---------------------------------------------------------------- @@ -1192,24 +1192,24 @@ DEFINER FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'f1'; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema ROUTINES ROUTINES SPECIFIC_NAME SPECIFIC_NAME 253 192 2 N 1 0 33 -def information_schema ROUTINES ROUTINES ROUTINE_CATALOG ROUTINE_CATALOG 253 1536 3 N 1 0 33 -def information_schema ROUTINES ROUTINES ROUTINE_SCHEMA ROUTINE_SCHEMA 253 192 4 N 1 0 33 -def information_schema ROUTINES ROUTINES ROUTINE_NAME ROUTINE_NAME 253 192 2 N 1 0 33 -def information_schema ROUTINES ROUTINES ROUTINE_TYPE ROUTINE_TYPE 253 39 8 N 1 0 33 -def information_schema ROUTINES ROUTINES DTD_IDENTIFIER DTD_IDENTIFIER 252 589815 7 Y 16 0 33 -def information_schema ROUTINES ROUTINES ROUTINE_BODY ROUTINE_BODY 253 24 3 N 1 0 33 -def information_schema ROUTINES ROUTINES ROUTINE_DEFINITION ROUTINE_DEFINITION 252 589815 8 Y 16 0 33 -def information_schema ROUTINES ROUTINES EXTERNAL_NAME EXTERNAL_NAME 253 192 0 Y 0 0 33 -def information_schema ROUTINES ROUTINES EXTERNAL_LANGUAGE EXTERNAL_LANGUAGE 253 192 0 Y 0 0 33 -def information_schema ROUTINES ROUTINES PARAMETER_STYLE PARAMETER_STYLE 253 24 3 N 1 0 33 -def information_schema ROUTINES ROUTINES IS_DETERMINISTIC IS_DETERMINISTIC 253 9 2 N 1 0 33 -def information_schema ROUTINES ROUTINES SQL_DATA_ACCESS SQL_DATA_ACCESS 253 192 12 N 1 0 33 -def information_schema ROUTINES ROUTINES SQL_PATH SQL_PATH 253 192 0 Y 0 0 33 -def information_schema ROUTINES ROUTINES SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33 -def information_schema ROUTINES ROUTINES SQL_MODE SQL_MODE 253 24576 89 N 1 0 33 -def information_schema ROUTINES ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 252 589815 0 N 17 0 33 -def information_schema ROUTINES ROUTINES DEFINER DEFINER 253 1152 14 N 1 0 33 +def information_schema ROUTINES ROUTINES SPECIFIC_NAME SPECIFIC_NAME 253 192 2 N 4097 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_CATALOG ROUTINE_CATALOG 253 1536 3 N 4097 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_SCHEMA ROUTINE_SCHEMA 253 192 4 N 4097 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_NAME ROUTINE_NAME 253 192 2 N 4097 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_TYPE ROUTINE_TYPE 253 39 8 N 4097 0 33 +def information_schema ROUTINES ROUTINES DTD_IDENTIFIER DTD_IDENTIFIER 252 589815 7 Y 4112 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_BODY ROUTINE_BODY 253 24 3 N 4097 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_DEFINITION ROUTINE_DEFINITION 252 589815 8 Y 4112 0 33 +def information_schema ROUTINES ROUTINES EXTERNAL_NAME EXTERNAL_NAME 253 192 0 Y 4096 0 33 +def information_schema ROUTINES ROUTINES EXTERNAL_LANGUAGE EXTERNAL_LANGUAGE 253 192 0 Y 4096 0 33 +def information_schema ROUTINES ROUTINES PARAMETER_STYLE PARAMETER_STYLE 253 24 3 N 4097 0 33 +def information_schema ROUTINES ROUTINES IS_DETERMINISTIC IS_DETERMINISTIC 253 9 2 N 4097 0 33 +def information_schema ROUTINES ROUTINES SQL_DATA_ACCESS SQL_DATA_ACCESS 253 192 12 N 4097 0 33 +def information_schema ROUTINES ROUTINES SQL_PATH SQL_PATH 253 192 0 Y 4096 0 33 +def information_schema ROUTINES ROUTINES SECURITY_TYPE SECURITY_TYPE 253 21 7 N 4097 0 33 +def information_schema ROUTINES ROUTINES SQL_MODE SQL_MODE 253 24576 89 N 4097 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 252 589815 0 N 4113 0 33 +def information_schema ROUTINES ROUTINES DEFINER DEFINER 253 1152 14 N 4097 0 33 SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE SQL_MODE ROUTINE_COMMENT DEFINER f1 def test f1 FUNCTION int(11) SQL RETURN 1 NULL NULL SQL NO CONTAINS SQL NULL DEFINER STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost ---------------------------------------------------------------- @@ -1266,7 +1266,7 @@ PRIMARY KEY (Codigo) show create table t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def Table 253 192 2 N 1 39 33 -def Create Table 253 3072 461 N 1 39 33 +def Create Table 253 3072 488 N 1 39 33 Table Create Table t1 CREATE TABLE `t1` ( `Codigo` int(10) unsigned NOT NULL AUTO_INCREMENT, @@ -1279,14 +1279,14 @@ t1 CREATE TABLE `t1` ( `Provincia` varchar(255) DEFAULT NULL, `Poblacion` varchar(255) DEFAULT NULL, PRIMARY KEY (`Codigo`) -) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci drop table t1; End of 5.0 tests SHOW AUTHORS; create database mysqltest; show create database mysqltest; Database Create Database -mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ +mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ create table mysqltest.t1(a int); insert into mysqltest.t1 values(1); create user mysqltest_4@localhost; @@ -1295,7 +1295,7 @@ connect con4,localhost,mysqltest_4,,mysqltest; connection con4; show create database mysqltest; Database Create Database -mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ +mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ disconnect con4; connection default; delete from mysql.user where user='mysqltest_4'; @@ -1453,7 +1453,7 @@ p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_ SELECT 'тест' AS test koi8r koi8r_general_ci latin1_swedish_ci SHOW CREATE FUNCTION f1; Function sql_mode Create Function character_set_client collation_connection Database Collation -f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS char(10) CHARSET latin1 +f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS char(10) CHARSET latin1 COLLATE latin1_swedish_ci RETURN 'тест' koi8r koi8r_general_ci latin1_swedish_ci SHOW CREATE TRIGGER t1_bi; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created @@ -1493,7 +1493,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci disconnect con1; connection default; UNLOCK TABLES; @@ -1512,7 +1512,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection con1; ALTER TABLE t1 CHARACTER SET = utf8; UNLOCK TABLES; diff --git a/mysql-test/main/show_explain.result b/mysql-test/main/show_explain.result index 317a12ef31177..6ad93930448e6 100644 --- a/mysql-test/main/show_explain.result +++ b/mysql-test/main/show_explain.result @@ -1007,7 +1007,7 @@ SELECT a+SLEEP(0.01) FROM t1 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 ORDER BY b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using temporary; Using filesort +1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using filesort set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT a+SLEEP(0.01) FROM t1 @@ -1016,7 +1016,7 @@ ORDER BY b; connection default; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using temporary; Using filesort +1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using filesort Warnings: Note 1003 SELECT a+SLEEP(0.01) FROM t1 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 @@ -1039,7 +1039,7 @@ ORDER BY b; connection default; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using temporary; Using filesort +1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using filesort Warnings: Note 1003 SELECT a+SLEEP(0.01) FROM t1 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 diff --git a/mysql-test/main/show_explain.test b/mysql-test/main/show_explain.test index 6cbd92ce44b7a..9ccf344a782be 100644 --- a/mysql-test/main/show_explain.test +++ b/mysql-test/main/show_explain.test @@ -1,6 +1,10 @@ # # Tests for SHOW EXPLAIN FOR functionality # +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + --source include/have_debug.inc --source include/have_debug_sync.inc --source include/have_innodb.inc diff --git a/mysql-test/main/show_profile.test b/mysql-test/main/show_profile.test index c20b29c40bfea..fe923d74a0e3f 100644 --- a/mysql-test/main/show_profile.test +++ b/mysql-test/main/show_profile.test @@ -5,6 +5,10 @@ # that SHOW PROFILES, SHOW PROFILE FOR QUERY and SHOW PROFILE CPU FOR QUERY # do not cause syntax errors. It also increases code coverage for sql_profile.cc +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + --source include/have_profiling.inc SET profiling = 1; SELECT 1; diff --git a/mysql-test/main/shutdown.test b/mysql-test/main/shutdown.test index 69616f535b235..71f2156a17f64 100644 --- a/mysql-test/main/shutdown.test +++ b/mysql-test/main/shutdown.test @@ -1,4 +1,6 @@ --source include/not_embedded.inc + +--disable_service_connection # # SHUTDOWN statement # @@ -16,8 +18,8 @@ disconnect c1; create procedure try_shutdown() shutdown; drop procedure try_shutdown; ---let $_server_id= `SELECT @@server_id` ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --exec echo "wait" > $_expect_file_name --send shutdown @@ -36,3 +38,4 @@ drop user user1@localhost; --let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err --let SEARCH_PATTERN=(mysqld|mariadbd)(\.exe)? \(initiated by: root\[root\] @ localhost \[(::1)?\]\): Normal shutdown --source include/search_pattern_in_file.inc +--enable_service_connection diff --git a/mysql-test/main/shutdown_not_windows.combinations b/mysql-test/main/shutdown_debug.combinations similarity index 100% rename from mysql-test/main/shutdown_not_windows.combinations rename to mysql-test/main/shutdown_debug.combinations diff --git a/mysql-test/main/shutdown_not_windows.result b/mysql-test/main/shutdown_debug.result similarity index 100% rename from mysql-test/main/shutdown_not_windows.result rename to mysql-test/main/shutdown_debug.result diff --git a/mysql-test/main/shutdown_debug.test b/mysql-test/main/shutdown_debug.test new file mode 100644 index 0000000000000..587b88dc55eb2 --- /dev/null +++ b/mysql-test/main/shutdown_debug.test @@ -0,0 +1,15 @@ +source include/not_embedded.inc; +source include/have_debug.inc; +-- source include/no_view_protocol.inc + +--echo # +--echo # MDEV-18353 Shutdown may miss to wait for connection thread +--echo # +call mtr.add_suppression('Thread .* did not exit'); +set @old_dbug=@@global.debug_dbug; +set global debug_dbug='+d,CONNECT_wait'; +select variable_value into @cons from information_schema.global_status where variable_name='connections'; +exec $MYSQL -e "select sleep(3600)" >/dev/null 2>&1 &; +let $wait_condition= select variable_value>@cons from information_schema.global_status where variable_name='connections'; +source include/wait_condition.inc; +source include/restart_mysqld.inc; diff --git a/mysql-test/main/shutdown_not_windows.test b/mysql-test/main/shutdown_not_windows.test deleted file mode 100644 index e93867e2227a3..0000000000000 --- a/mysql-test/main/shutdown_not_windows.test +++ /dev/null @@ -1,14 +0,0 @@ -source include/not_windows.inc; -source include/not_embedded.inc; -source include/have_debug.inc; ---echo # ---echo # MDEV-18353 Shutdown may miss to wait for connection thread ---echo # -call mtr.add_suppression('Thread .* did not exit'); -set @old_dbug=@@global.debug_dbug; -set global debug_dbug='+d,CONNECT_wait'; -select variable_value into @cons from information_schema.global_status where variable_name='connections'; -exec $MYSQL -e 'select sleep(3600)' >/dev/null 2>&1 &; -let $wait_condition= select variable_value>@cons from information_schema.global_status where variable_name='connections'; -source include/wait_condition.inc; -source include/restart_mysqld.inc; diff --git a/mysql-test/main/simultaneous_assignment.test b/mysql-test/main/simultaneous_assignment.test index a21e33346d6cd..aea454855f531 100644 --- a/mysql-test/main/simultaneous_assignment.test +++ b/mysql-test/main/simultaneous_assignment.test @@ -29,7 +29,7 @@ UPDATE t1, t2 --echo # --echo # Check standard update --echo # - +--disable_view_protocol UPDATE t1 SET c1 = c1+1, c2 = c1+1, @@ -43,6 +43,7 @@ UPDATE t1 c3 = c2+1; SELECT * FROM t1; ROLLBACK; +--enable_view_protocol --echo # --echo # Check update through a single view @@ -73,7 +74,8 @@ CREATE VIEW v1 (a, b) AS SELECT t1.c1, t2.c1 FROM t1, t2 WHERE t1.c1=t2.c1; UPDATE v1 SET a = 10, b = 20; - + +--disable_view_protocol START TRANSACTION; UPDATE v1 SET a = 10; @@ -116,6 +118,7 @@ UPDATE t1 SELECT * FROM t1; SELECT * FROM t2; ROLLBACK; +--enable_view_protocol DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/main/single_delete_update.test b/mysql-test/main/single_delete_update.test index ec939641ea388..4a4ad5e5a8ec5 100644 --- a/mysql-test/main/single_delete_update.test +++ b/mysql-test/main/single_delete_update.test @@ -2,6 +2,10 @@ # Single table specific update/delete tests (mysql_update and mysql_delete) # +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + --echo # --echo # Bug #30584: delete with order by and limit clauses does not use --echo # limit efficiently diff --git a/mysql-test/main/sp-anchor-row-type-cursor.result b/mysql-test/main/sp-anchor-row-type-cursor.result index 64359988a3db9..e56c51bb82ef4 100644 --- a/mysql-test/main/sp-anchor-row-type-cursor.result +++ b/mysql-test/main/sp-anchor-row-type-cursor.result @@ -89,7 +89,7 @@ t2 CREATE TABLE `t2` ( `rec.b` varchar(10) DEFAULT NULL, `rec.c` double DEFAULT NULL, `rec.d` decimal(10,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CALL p1(); ERROR 42S02: Table 'test.t1' doesn't exist @@ -118,7 +118,7 @@ t2 CREATE TABLE `t2` ( `rec.b` varchar(10) DEFAULT NULL, `rec.c` double DEFAULT NULL, `rec.d` decimal(10,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -146,7 +146,7 @@ t2 CREATE TABLE `t2` ( `rec.b` varchar(10) DEFAULT NULL, `rec.c` double DEFAULT NULL, `rec.d` decimal(10,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP VIEW v1; DROP TABLE t1; DROP PROCEDURE p1; @@ -175,7 +175,7 @@ t2 CREATE TABLE `t2` ( `rec.b` varchar(10) DEFAULT NULL, `rec.c` double DEFAULT NULL, `rec.d` decimal(10,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP VIEW v1; DROP TABLE t1; DROP PROCEDURE p1; @@ -1005,7 +1005,7 @@ CALL p1(); Table Create Table t1 CREATE TABLE `t1` ( `rec1.a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP PROCEDURE p1; # # MDEV-14139 Anchored data types for variables @@ -1030,10 +1030,10 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(3) DEFAULT NULL, `c` time DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(3) DEFAULT NULL, `c` time DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci diff --git a/mysql-test/main/sp-anchor-row-type-table.result b/mysql-test/main/sp-anchor-row-type-table.result index b51ee5bf55d5e..00fda5f12adc9 100644 --- a/mysql-test/main/sp-anchor-row-type-table.result +++ b/mysql-test/main/sp-anchor-row-type-table.result @@ -40,7 +40,7 @@ t2 CREATE TABLE `t2` ( `rec.b` varchar(10) DEFAULT NULL, `rec.c` double DEFAULT NULL, `rec.d` decimal(10,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -64,7 +64,7 @@ t2 CREATE TABLE `t2` ( `rec.b` varchar(10) DEFAULT NULL, `rec.c` double DEFAULT NULL, `rec.d` decimal(10,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -89,7 +89,7 @@ t2 CREATE TABLE `t2` ( `rec.b` varchar(10) DEFAULT NULL, `rec.c` double DEFAULT NULL, `rec.d` decimal(10,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP VIEW v1; DROP TABLE t1; DROP PROCEDURE p1; @@ -115,7 +115,7 @@ t2 CREATE TABLE `t2` ( `rec.b` varchar(10) DEFAULT NULL, `rec.c` double DEFAULT NULL, `rec.d` decimal(10,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP VIEW v1; DROP TABLE t1; DROP PROCEDURE p1; @@ -707,8 +707,8 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` text DEFAULT NULL, - `c` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP PROCEDURE p2; DROP PROCEDURE p1; DROP TABLE t1; @@ -807,10 +807,10 @@ Table Create Table t2 CREATE TABLE `t2` ( `int11` int(11) DEFAULT NULL, `text0` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Table Create Table t2 CREATE TABLE `t2` ( `int11` int(11) DEFAULT NULL, `text0` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; diff --git a/mysql-test/main/sp-anchor-type.result b/mysql-test/main/sp-anchor-type.result index ac867bd5ca390..94e5182acb2cb 100644 --- a/mysql-test/main/sp-anchor-type.result +++ b/mysql-test/main/sp-anchor-type.result @@ -97,7 +97,7 @@ t2 CREATE TABLE `t2` ( `a` tinyint(4) DEFAULT NULL, `b` int(11) DEFAULT NULL, `ts` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP PROCEDURE p1; DROP TABLE t1; # @@ -126,7 +126,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `c` int(11) DEFAULT NULL, `d` varchar(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP PROCEDURE p1; DROP TABLE t1; # @@ -152,7 +152,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `dzr` decimal(10,3) unsigned DEFAULT NULL, `dzt` decimal(10,3) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP PROCEDURE p1; DROP TABLE t1; # @@ -179,7 +179,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a 11 @@ -199,7 +199,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a 11 @@ -227,7 +227,7 @@ SHOW CREATE TABLE test.t2; Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE test.t2; # # This interprets "TYPE OF t1.a" as INT, as in test1.t1.a @@ -238,7 +238,7 @@ SHOW CREATE TABLE test.t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE test.t2; # # Error if there is no an active database @@ -280,7 +280,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP PROCEDURE p1; DROP TABLE t2; DROP DATABASE test1; @@ -464,13 +464,13 @@ t2 CREATE TABLE `t2` ( `dc209` decimal(20,9) DEFAULT NULL, `cc` char(10) DEFAULT NULL, `cv` varchar(10) DEFAULT NULL, - `cvu` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL, + `cvu` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `t1` tinytext DEFAULT NULL, `t2` text DEFAULT NULL, `t3` mediumtext DEFAULT NULL, `t4` longtext DEFAULT NULL, - `enum1` char(1) DEFAULT NULL, - `set1` char(5) DEFAULT NULL, + `enum1` varchar(1) DEFAULT NULL, + `set1` varchar(5) DEFAULT NULL, `blob1` tinyblob DEFAULT NULL, `blob2` blob DEFAULT NULL, `blob3` mediumblob DEFAULT NULL, @@ -486,7 +486,7 @@ t2 CREATE TABLE `t2` ( `ts0` timestamp NULL DEFAULT NULL, `ts3` timestamp(3) NULL DEFAULT NULL, `ts6` timestamp(6) NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; bit6 0 bit7 A @@ -626,13 +626,13 @@ t2 CREATE TABLE `t2` ( `dc209` decimal(20,9) DEFAULT NULL, `cc` char(10) DEFAULT NULL, `cv` varchar(10) DEFAULT NULL, - `cvu` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL, + `cvu` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `t1` tinytext DEFAULT NULL, `t2` text DEFAULT NULL, `t3` mediumtext DEFAULT NULL, `t4` longtext DEFAULT NULL, - `enum1` char(1) DEFAULT NULL, - `set1` char(5) DEFAULT NULL, + `enum1` varchar(1) DEFAULT NULL, + `set1` varchar(5) DEFAULT NULL, `blob1` tinyblob DEFAULT NULL, `blob2` blob DEFAULT NULL, `blob3` mediumblob DEFAULT NULL, @@ -648,7 +648,7 @@ t2 CREATE TABLE `t2` ( `ts0` timestamp NULL DEFAULT NULL, `ts3` timestamp(3) NULL DEFAULT NULL, `ts6` timestamp(6) NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; bit6 0 bit7 A @@ -824,11 +824,11 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `tables_table_name` varchar(64) CHARACTER SET utf8mb3 DEFAULT NULL, + `tables_table_name` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `tables_table_rows` bigint(21) unsigned DEFAULT NULL, - `processlist_info` longtext CHARACTER SET utf8mb3 DEFAULT NULL, + `processlist_info` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `processlist_info_binary` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -853,7 +853,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a0` int(11) DEFAULT NULL, `a1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -873,7 +873,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(10) DEFAULT NULL, `b` smallint(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b test 123 @@ -1044,7 +1044,7 @@ t1 CREATE TABLE `t1` ( `a_flt0` float DEFAULT NULL, `a_dbl0` double DEFAULT NULL, `a_bit3` bit(3) DEFAULT NULL, - `a_enum0` char(1) DEFAULT NULL, + `a_enum0` varchar(1) DEFAULT NULL, `a_varchar10` varchar(10) DEFAULT NULL, `a_text1` text DEFAULT NULL, `a_tinytext1` tinytext DEFAULT NULL, @@ -1054,7 +1054,7 @@ t1 CREATE TABLE `t1` ( `a_datetime4` datetime(4) DEFAULT NULL, `a_timestamp5` timestamp(5) NULL DEFAULT NULL, `a_date0` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Table Create Table t1 CREATE TABLE `t1` ( `aa_int11` int(11) DEFAULT NULL, @@ -1062,7 +1062,7 @@ t1 CREATE TABLE `t1` ( `aa_flt0` float DEFAULT NULL, `aa_dbl0` double DEFAULT NULL, `aa_bit3` bit(3) DEFAULT NULL, - `aa_enum0` char(1) DEFAULT NULL, + `aa_enum0` varchar(1) DEFAULT NULL, `aa_varchar10` varchar(10) DEFAULT NULL, `aa_text1` text DEFAULT NULL, `aa_tinytext1` tinytext DEFAULT NULL, @@ -1072,4 +1072,4 @@ t1 CREATE TABLE `t1` ( `aa_datetime4` datetime(4) DEFAULT NULL, `aa_timestamp5` timestamp(5) NULL DEFAULT NULL, `aa_date0` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci diff --git a/mysql-test/main/sp-anchor-type.test b/mysql-test/main/sp-anchor-type.test index 56136c4bd63b0..0e24ef900d8a7 100644 --- a/mysql-test/main/sp-anchor-type.test +++ b/mysql-test/main/sp-anchor-type.test @@ -167,6 +167,9 @@ DROP TABLE t1; --echo # --echo # Temporary tables shadow real tables for TYPE OF purposes --echo # +#view cannot has temporary table in definition +--disable_view_protocol + CREATE TABLE t1 (a VARCHAR(10)); INSERT INTO t1 VALUES ('t1'); CREATE TEMPORARY TABLE t1 (a INT); @@ -201,6 +204,7 @@ DROP TABLE t2; DROP PROCEDURE p1; DROP TABLE t1; +--enable_view_protocol --echo # --echo # "TYPE OF t1.a" searches for "t1" in the current database diff --git a/mysql-test/main/sp-bugs.result b/mysql-test/main/sp-bugs.result index 8c6788d03f432..a166a5a0a9a53 100644 --- a/mysql-test/main/sp-bugs.result +++ b/mysql-test/main/sp-bugs.result @@ -353,3 +353,13 @@ drop table _t1; # # End of 10.3 tests # +# +# MDEV-22001: Server crashes in st_select_lex_unit::exclude_level upon execution of SP +# +BEGIN NOT ATOMIC DECLARE a INT DEFAULT 0 IN ( SELECT 1 ) OR 2 ; END $ +BEGIN NOT ATOMIC DECLARE a INT DEFAULT 0 IN ( SELECT 1 ) OR (SELECT 2) ; END $ +KILL (('x' IN ( SELECT 1)) MOD 44); +ERROR HY000: Unknown thread id: 0 +# +# End of 10.4 tests +# diff --git a/mysql-test/main/sp-bugs.test b/mysql-test/main/sp-bugs.test index 9b81fd1af61d1..18fe14dc8bc9c 100644 --- a/mysql-test/main/sp-bugs.test +++ b/mysql-test/main/sp-bugs.test @@ -371,3 +371,18 @@ drop table _t1; --echo # --echo # End of 10.3 tests --echo # + +--echo # +--echo # MDEV-22001: Server crashes in st_select_lex_unit::exclude_level upon execution of SP +--echo # +--delimiter $ +BEGIN NOT ATOMIC DECLARE a INT DEFAULT 0 IN ( SELECT 1 ) OR 2 ; END $ +BEGIN NOT ATOMIC DECLARE a INT DEFAULT 0 IN ( SELECT 1 ) OR (SELECT 2) ; END $ +--delimiter ; + +--error ER_NO_SUCH_THREAD +KILL (('x' IN ( SELECT 1)) MOD 44); + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/sp-cursor.result b/mysql-test/main/sp-cursor.result index 110ae7be03a83..83b05264339c7 100644 --- a/mysql-test/main/sp-cursor.result +++ b/mysql-test/main/sp-cursor.result @@ -737,3 +737,118 @@ rec.en1 c DROP PROCEDURE p1; DROP TABLE t1; +# +# MDEV-26009: Server crash when calling twice procedure using FOR-loop +# +CREATE TABLE t1 ( id int, name varchar(24)); +INSERT INTO t1 values (1, 'x'), (2, 'y'), (3, 'z'); +create function get_name(_id int) returns varchar(24) +return (select name from t1 where id = _id); +select get_name(id) from t1; +get_name(id) +x +y +z +create procedure test_proc() +begin +declare _cur cursor for select get_name(id) from t1; +for row in _cur do select 1; end for; +end; +^^ +call test_proc(); +1 +1 +1 +1 +1 +1 +call test_proc(); +1 +1 +1 +1 +1 +1 +drop procedure test_proc; +drop function get_name; +drop table t1; +CREATE TABLE t1 (id int, name varchar(24)); +INSERT INTO t1 (id, name) VALUES (1, 'x'),(2, 'y'),(3, 'z'); +create function get_name(_id int) returns varchar(24) +return (select name from t1 where id = _id); +create view v1 as select get_name(id) from t1; +create procedure test_proc() +begin +declare _cur cursor for select 1 from v1; +for row in _cur do select 1; end for; +end$$ +call test_proc(); +1 +1 +1 +1 +1 +1 +call test_proc(); +1 +1 +1 +1 +1 +1 +drop procedure test_proc; +drop view v1; +drop function get_name; +drop table t1; +# +# MDEV-28266: Crash in Field_string::type_handler when calling procedures +# +CREATE TABLE t (f INT); +CREATE TRIGGER tr AFTER INSERT ON t FOR EACH ROW +FOR x IN (SELECT * FROM json_table(NULL, '$' COLUMNS(a CHAR(1) path '$.*')) tmp) +DO set @a=1; END FOR $ +INSERT INTO t () values (); +DROP TABLE t; +# +# End of 10.6 tests +# +# +# Start of 10.8 tests +# +# +# MDEV-10654 IN, OUT, INOUT parameters in CREATE FUNCTION +# +BEGIN NOT ATOMIC +DECLARE va INT; +DECLARE cur CURSOR (IN a INT) FOR SELECT a FROM dual; +OPEN cur(1); +FETCH cur INTO va; +CLOSE cur; +SELECT va; +END; +$$ +va +1 +BEGIN NOT ATOMIC +DECLARE va INT; +DECLARE cur CURSOR (OUT a INT) FOR SELECT a FROM dual; +OPEN cur(1); +FETCH cur INTO va; +CLOSE cur; +SELECT va; +END; +$$ +ERROR 42000: This version of MariaDB doesn't yet support 'OUT/INOUT cursor parameter' +BEGIN NOT ATOMIC +DECLARE va INT; +DECLARE cur CURSOR (INOUT a INT) FOR SELECT a FROM dual; +OPEN cur(1); +FETCH cur INTO va; +CLOSE cur; +SELECT va; +END; +$$ +ERROR 42000: This version of MariaDB doesn't yet support 'OUT/INOUT cursor parameter' +# +# End of 10.8 tests +# diff --git a/mysql-test/main/sp-cursor.test b/mysql-test/main/sp-cursor.test index 97483ef9caf0b..feb681201a257 100644 --- a/mysql-test/main/sp-cursor.test +++ b/mysql-test/main/sp-cursor.test @@ -744,3 +744,131 @@ DELIMITER ;$$ CALL p1(); DROP PROCEDURE p1; DROP TABLE t1; + + +--echo # +--echo # MDEV-26009: Server crash when calling twice procedure using FOR-loop +--echo # + + +CREATE TABLE t1 ( id int, name varchar(24)); +INSERT INTO t1 values (1, 'x'), (2, 'y'), (3, 'z'); + +create function get_name(_id int) returns varchar(24) + return (select name from t1 where id = _id); + +select get_name(id) from t1; + +delimiter ^^; + +create procedure test_proc() +begin + declare _cur cursor for select get_name(id) from t1; + for row in _cur do select 1; end for; +end; +^^ +delimiter ;^^ + +call test_proc(); +call test_proc(); + +drop procedure test_proc; +drop function get_name; +drop table t1; + + +CREATE TABLE t1 (id int, name varchar(24)); +INSERT INTO t1 (id, name) VALUES (1, 'x'),(2, 'y'),(3, 'z'); + +create function get_name(_id int) returns varchar(24) + return (select name from t1 where id = _id); + +create view v1 as select get_name(id) from t1; + +delimiter $$; +create procedure test_proc() +begin + declare _cur cursor for select 1 from v1; + for row in _cur do select 1; end for; +end$$ +delimiter ;$$ + +call test_proc(); +call test_proc(); + +drop procedure test_proc; +drop view v1; +drop function get_name; +drop table t1; + +--echo # +--echo # MDEV-28266: Crash in Field_string::type_handler when calling procedures +--echo # + +CREATE TABLE t (f INT); + +--delimiter $ +CREATE TRIGGER tr AFTER INSERT ON t FOR EACH ROW + FOR x IN (SELECT * FROM json_table(NULL, '$' COLUMNS(a CHAR(1) path '$.*')) tmp) + DO set @a=1; END FOR $ +--delimiter ; + +INSERT INTO t () values (); + +# Cleanup +DROP TABLE t; + +--echo # +--echo # End of 10.6 tests +--echo # + + +--echo # +--echo # Start of 10.8 tests +--echo # + +--echo # +--echo # MDEV-10654 IN, OUT, INOUT parameters in CREATE FUNCTION +--echo # + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE va INT; + DECLARE cur CURSOR (IN a INT) FOR SELECT a FROM dual; + OPEN cur(1); + FETCH cur INTO va; + CLOSE cur; + SELECT va; +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +--error ER_NOT_SUPPORTED_YET +BEGIN NOT ATOMIC + DECLARE va INT; + DECLARE cur CURSOR (OUT a INT) FOR SELECT a FROM dual; + OPEN cur(1); + FETCH cur INTO va; + CLOSE cur; + SELECT va; +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +--error ER_NOT_SUPPORTED_YET +BEGIN NOT ATOMIC + DECLARE va INT; + DECLARE cur CURSOR (INOUT a INT) FOR SELECT a FROM dual; + OPEN cur(1); + FETCH cur INTO va; + CLOSE cur; + SELECT va; +END; +$$ +DELIMITER ;$$ + +--echo # +--echo # End of 10.8 tests +--echo # diff --git a/mysql-test/main/sp-error.test b/mysql-test/main/sp-error.test index 9b0213a1f919f..8bd70358c9feb 100644 --- a/mysql-test/main/sp-error.test +++ b/mysql-test/main/sp-error.test @@ -1613,6 +1613,7 @@ drop view v1; create view v2 as select bug11555_2(); drop view v2; # But we should hide name of missing implicitly used table when we use view +--disable_view_protocol create table t1 (i int); create view v1 as select bug11555_1(); create view v2 as select bug11555_2(); @@ -1628,6 +1629,7 @@ select * from v3; # another form of view usage. create view v4 as select * from v1; drop view v1, v2, v3, v4; +--enable_view_protocol # We also should hide details about broken triggers which are # invoked for view. drop function bug11555_1; diff --git a/mysql-test/main/sp-i_s_columns.result b/mysql-test/main/sp-i_s_columns.result new file mode 100644 index 0000000000000..707fd76fd77bf --- /dev/null +++ b/mysql-test/main/sp-i_s_columns.result @@ -0,0 +1,34 @@ +# +# MDEV-28267 ASAN heap-use-after-free in Item_sp::func_name_cstring +# +CREATE TABLE t1 (a INT); +CREATE FUNCTION test.f1(a INT) RETURNS TEXT RETURN ''; +CREATE FUNCTION test.f2(a INT) RETURNS TEXT RETURN ''; +CREATE VIEW v1 AS SELECT f1(a) AS v1 FROM t1; +CREATE VIEW v2 AS SELECT f1(a) AS v2 FROM t1; +CREATE VIEW v3 AS SELECT f1(a) AS v3 FROM t1; +CREATE VIEW v4 AS SELECT f1(a) AS v4 FROM t1; +BEGIN NOT ATOMIC +FOR i IN 1..10 +DO +ANALYZE FORMAT=JSON SELECT * +FROM INFORMATION_SCHEMA.COLUMNS +WHERE +TABLE_SCHEMA='test' + AND +TABLE_NAME LIKE 'v%' + AND +(SLEEP(0.01)=0 OR f1(ordinal_position) >'') +ORDER BY TABLE_NAME; +END FOR; +END; +$$ +connect con1,localhost,root,,test; +CREATE OR REPLACE FUNCTION f2(a INT) RETURNS TEXT RETURN ''; +connection default; +disconnect con1; +connection default; +DROP FUNCTION f1; +DROP FUNCTION f2; +DROP TABLE t1; +DROP VIEW v1, v2, v3, v4; diff --git a/mysql-test/main/sp-i_s_columns.test b/mysql-test/main/sp-i_s_columns.test new file mode 100644 index 0000000000000..0782d06d1cc02 --- /dev/null +++ b/mysql-test/main/sp-i_s_columns.test @@ -0,0 +1,49 @@ +--echo # +--echo # MDEV-28267 ASAN heap-use-after-free in Item_sp::func_name_cstring +--echo # + +CREATE TABLE t1 (a INT); +CREATE FUNCTION test.f1(a INT) RETURNS TEXT RETURN ''; +CREATE FUNCTION test.f2(a INT) RETURNS TEXT RETURN ''; +CREATE VIEW v1 AS SELECT f1(a) AS v1 FROM t1; +CREATE VIEW v2 AS SELECT f1(a) AS v2 FROM t1; +CREATE VIEW v3 AS SELECT f1(a) AS v3 FROM t1; +CREATE VIEW v4 AS SELECT f1(a) AS v4 FROM t1; + +--disable_result_log + +DELIMITER $$; +--send +BEGIN NOT ATOMIC + FOR i IN 1..10 + DO + ANALYZE FORMAT=JSON SELECT * + FROM INFORMATION_SCHEMA.COLUMNS + WHERE + TABLE_SCHEMA='test' + AND + TABLE_NAME LIKE 'v%' + AND + (SLEEP(0.01)=0 OR f1(ordinal_position) >'') + ORDER BY TABLE_NAME; + END FOR; +END; +$$ +DELIMITER ;$$ + +--connect (con1,localhost,root,,test) +CREATE OR REPLACE FUNCTION f2(a INT) RETURNS TEXT RETURN ''; +--connection default +--reap + +--enable_result_log + + +# Cleanup +--disconnect con1 +--connection default + +DROP FUNCTION f1; +DROP FUNCTION f2; +DROP TABLE t1; +DROP VIEW v1, v2, v3, v4; diff --git a/mysql-test/main/sp-inout.result b/mysql-test/main/sp-inout.result new file mode 100644 index 0000000000000..a1e7ffa979960 --- /dev/null +++ b/mysql-test/main/sp-inout.result @@ -0,0 +1,2033 @@ +# +# MDEV-10654 IN, OUT, INOUT parameters in CREATE FUNCTION +# +# +# CREATE FUNCTION with IN, OUT, INOUT qualifiers +# SHOW CREATE FUNCTION +# +CREATE FUNCTION add_func(IN a INT, IN b INT, OUT c INT, INOUT d INT) RETURNS INT +BEGIN +SET c= 100; +SET d= d + 1; +RETURN a + b; +END; +$$ +SHOW CREATE FUNCTION add_func; +Function sql_mode Create Function character_set_client collation_connection Database Collation +add_func STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `add_func`(IN a INT, IN b INT, OUT c INT, INOUT d INT) RETURNS int(11) +BEGIN +SET c= 100; +SET d= d + 1; +RETURN a + b; +END latin1 latin1_swedish_ci latin1_swedish_ci +DROP FUNCTION add_func; +# +# CREATE PROCEDURE with IN, OUT, INOUT qualifiers +# SHOW CREATE PROCEDURE +# +CREATE PROCEDURE add_proc(IN a INT, IN b INT, INOUT c INT, OUT d INT) +BEGIN +SET d= a + b + c + d; +END; +$$ +SHOW CREATE PROCEDURE add_proc; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +add_proc STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `add_proc`(IN a INT, IN b INT, INOUT c INT, OUT d INT) +BEGIN +SET d= a + b + c + d; +END latin1 latin1_swedish_ci latin1_swedish_ci +DROP PROCEDURE add_proc; +# +# Call function from SELECT query +# SELECT > FUNCTION(IN) +# +CREATE FUNCTION add_func2(IN a INT, IN b INT) RETURNS INT +BEGIN +RETURN a + b; +END; +$$ +SET @a = 2; +SET @b = 3; +SELECT add_func2(@a, @b); +add_func2(@a, @b) +5 +DROP FUNCTION add_func2; +# +# Call function from SELECT query +# SELECT > FUNCTION(OUT) +# +CREATE FUNCTION add_func3(IN a INT, IN b INT, OUT c INT) RETURNS INT +BEGIN +SET c = 100; +RETURN a + b; +END; +$$ +SET @a = 2; +SET @b = 3; +SET @c = 0; +SET @res= add_func3(@a, @b, @c); +SELECT @res, @a, @b, @c; +@res @a @b @c +5 2 3 100 +SELECT add_func3(@a, @b, @c); +ERROR HY000: OUT or INOUT argument 3 for function add_func3 is not allowed here +DROP FUNCTION add_func3; +# +# Call function from SELECT query +# SELECT > FUNCTION(INOUT) +# +CREATE FUNCTION add_func4(IN a INT, IN b INT, OUT c INT, INOUT d INT) RETURNS INT +BEGIN +SET c = 100; +SET d = d + 1; +RETURN a + b; +END; +$$ +SET @a = 2; +SET @b = 3; +SET @c = 0; +SET @d = 9; +SET @res= add_func4(@a, @b, @c, @d); +SELECT @res, @a, @b, @c, @d; +@res @a @b @c @d +5 2 3 100 10 +SELECT add_func4(@a, @b, @c, @d); +ERROR HY000: OUT or INOUT argument 3 for function add_func4 is not allowed here +DROP FUNCTION add_func4; +# +# Call from procedure +# PROCEDURE(OUT) > FUNCTION(IN) +# +CREATE FUNCTION add_func2(IN a INT, IN b INT) RETURNS INT +BEGIN +RETURN a + b; +END; +$$ +CREATE PROCEDURE add_proc2(IN a INT, IN b INT, OUT c INT) +BEGIN +SET c = add_func2(a, b); +END; +$$ +SET @a = 2; +SET @b = 3; +SET @c = 0; +CALL add_proc2(@a, @b, @c); +SELECT @a, @b, @c; +@a @b @c +2 3 5 +DROP FUNCTION add_func2; +DROP PROCEDURE add_proc2; +# +# Call from procedure +# PROCEDURE(OUT) > FUNCTION(OUT) +# +CREATE FUNCTION add_func3(IN a INT, IN b INT, OUT c INT) RETURNS INT +BEGIN +SET c = 100; +RETURN a + b; +END; +$$ +CREATE PROCEDURE add_proc3(IN a INT, IN b INT, OUT c INT) +BEGIN +DECLARE res INT; +SET res = add_func3(a, b, c); +END; +$$ +SET @a = 2; +SET @b = 3; +SET @c = 0; +CALL add_proc3(@a, @b, @c); +SELECT @a, @b, @c; +@a @b @c +2 3 100 +DROP FUNCTION add_func3; +DROP PROCEDURE add_proc3; +# +# Call from procedure +# PROCEDURE(OUT) > FUNCTION(INOUT) +# +CREATE FUNCTION add_func4(IN a INT, IN b INT, OUT c INT, INOUT d INT) RETURNS INT +BEGIN +SET c = 100; +SET d = d + 1; +RETURN a + b; +END; +$$ +CREATE PROCEDURE add_proc4(IN a INT, IN b INT, OUT res INT) +BEGIN +DECLARE c INT; +DECLARE d INT; +SET d = 30; +SET res = add_func4(a, b, c, d); +SET res = c + d; +END; +$$ +SET @a = 2; +SET @b = 3; +SET @res = 0; +CALL add_proc4(@a, @b, @res); +SELECT @a, @b, @res; +@a @b @res +2 3 131 +DROP FUNCTION add_func4; +DROP PROCEDURE add_proc4; +# +# Call from procedure +# PROCEDURE(OUT) > PROCEDURE(OUT) +# +CREATE PROCEDURE add_proc(IN a INT, IN b INT, OUT c INT) +BEGIN +SET c = a + b; +END; +$$ +CREATE PROCEDURE test_proc1(IN a INT, IN b INT, OUT c INT) +BEGIN +CALL add_proc(a, b, c); +END; +$$ +SET @a = 2; +SET @b = 3; +SET @c = 0; +CALL test_proc1(@a, @b, @c); +SELECT @a, @b, @c; +@a @b @c +2 3 5 +DROP PROCEDURE add_proc; +DROP PROCEDURE test_proc1; +# +# Argument's order change +# PROCEDURE(a IN, b IN, c OUT) > FUNCTION(b IN, a IN, c OUT) +# +CREATE FUNCTION func_sub(IN b INT, IN a INT, OUT c INT) RETURNS INT +BEGIN +DECLARE res INT; +SET c = a - b; +SET res = a; +RETURN res; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, IN b INT, OUT c INT) +BEGIN +DECLARE res INT; +SET res = func_sub(b, a, c); +END; +$$ +SET @a = 2; +SET @b = 3; +SET @c = 0; +CALL proc_main(@a, @b, @c); +SELECT @a, @b, @c; +@a @b @c +2 3 -1 +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; +# +# Argument's order change +# PROCEDURE(a IN, b IN, c OUT) > FUNCTION(c OUT, b IN, a IN) +# +CREATE FUNCTION func_sub(OUT c INT, IN b INT, IN a INT) RETURNS INT +BEGIN +DECLARE res INT; +SET c = a - b; +SET res = a; +RETURN res; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, IN b INT, OUT c INT) +BEGIN +DECLARE res INT; +SET res = func_sub(c, b, a); +END; +$$ +SET @a = 2; +SET @b = 3; +SET @c = 0; +CALL proc_main(@a, @b, @c); +SELECT @a, @b, @c; +@a @b @c +2 3 -1 +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; +# +# Argument's order change +# PROCEDURE(a IN, b IN, c INOUT, d OUT) > FUNCTION(d OUT, a IN, b IN, c INOUT) +# +CREATE FUNCTION func_sub(OUT d INT, IN a INT, IN b INT, INOUT c INT) RETURNS INT +BEGIN +SET c = c + 6; +SET d = 10; +RETURN a - b; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, IN b INT, INOUT c INT, OUT d INT) +BEGIN +DECLARE res INT; +SET res = func_sub(d, a, b, c); +SET d = d + c + res; +END; +$$ +SET @a = 15; +SET @b = 5; +SET @c = 4; +SET @d= 0; +CALL proc_main(@a, @b, @c, @d); +SELECT @a, @b, @c, @d; +@a @b @c @d +15 5 10 30 +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; +# +# Argument's order change +# PROCEDURE(IN a INT, IN b INT, INOUT c INT, OUT d INT) > FUNCTION1(c INOUT INT, IN b INT) > FUNCTION2(d OUT INT, IN a INT) +# +CREATE FUNCTION func_sub1(INOUT c INT, IN b INT) RETURNS INT +BEGIN +SET c = c + b; +RETURN 0; +END; +$$ +CREATE FUNCTION func_sub2(OUT d INT, IN a INT) RETURNS INT +BEGIN +SET d = 5 + a; +RETURN 0; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, IN b INT, INOUT c INT, OUT d INT) +BEGIN +DECLARE res1 INT; +DECLARE res2 INT; +SET res1 = func_sub1(c, b); +SET res2 = func_sub2(d, a); +SET d = d + c; +END; +$$ +SET @a = 15; +SET @b = 6; +SET @c = 4; +SET @d= 0; +CALL proc_main(@a, @b, @c, @d); +SELECT @a, @b, @c, @d; +@a @b @c @d +15 6 10 30 +DROP FUNCTION func_sub1; +DROP FUNCTION func_sub2; +DROP PROCEDURE proc_main; +# +# Argument's order change +# FUNCTION1(a IN, b IN) > FUNCTION2(b IN, c OUT, a IN) +# +CREATE FUNCTION func_sub(IN b INT, OUT c INT, IN a INT) RETURNS INT +BEGIN +SET c = 100; +RETURN a + b; +END; +$$ +CREATE FUNCTION func_main(IN a INT, IN b INT) RETURNS INT +BEGIN +DECLARE c INT; +DECLARE res INT; +SET res = func_sub(b, c, a); +RETURN res + c; +END; +$$ +SET @a = 2; +SET @b = 3; +SELECT func_main(@a, @b); +func_main(@a, @b) +105 +DROP FUNCTION func_sub; +DROP FUNCTION func_main; +# +# Call procedure inside function +# FUNCTION1(a IN, b IN) > PROCEDURE(a IN, b IN, c OUT) +# +CREATE PROCEDURE proc_sub(IN a INT, IN b INT, OUT c INT) +BEGIN +SET c = a + b; +END; +$$ +CREATE FUNCTION func_main(IN b INT, IN a INT) RETURNS INT +BEGIN +DECLARE c INT; +CALL proc_sub(a, b, c); +RETURN c; +END; +$$ +SET @a = 2; +SET @b = 3; +SELECT func_main(@a, @b); +func_main(@a, @b) +5 +DROP PROCEDURE proc_sub; +DROP FUNCTION func_main; +# +# Call procedure inside function +# FUNCTION1(a IN, b IN) > PROCEDURE(a IN, b INOUT) +# +CREATE PROCEDURE proc_sub(IN a INT, INOUT b INT) +BEGIN +SET b = a + b; +END; +$$ +CREATE FUNCTION func_main(IN b INT, IN a INT) RETURNS INT +BEGIN +CALL proc_sub(a, b); +RETURN b; +END; +$$ +SET @a = 2; +SET @b = 3; +SELECT func_main(@a, @b); +func_main(@a, @b) +5 +DROP PROCEDURE proc_sub; +DROP FUNCTION func_main; +# +# Call procedure inside function +# FUNCTION1(a IN, b IN, c OUT) > PROCEDURE(a IN, b IN, c OUT) +# +CREATE PROCEDURE proc_sub(IN a INT, IN b INT, OUT c INT) +BEGIN +SET c = a + b; +END; +$$ +CREATE FUNCTION func_main(IN b INT, IN a INT, OUT c INT) RETURNS INT +BEGIN +DECLARE res INT; +CALL proc_sub(a, b, c); +RETURN 0; +END; +$$ +SET @a = 2; +SET @b = 3; +SET @c = 0; +DO func_main(@a, @b, @c); +SELECT @a, @b, @c; +@a @b @c +2 3 5 +SELECT func_main(@a, @b, @c); +ERROR HY000: OUT or INOUT argument 3 for function func_main is not allowed here +DROP PROCEDURE proc_sub; +DROP FUNCTION func_main; +# +# Call function from UPDATE query +# UPDATE SET = FUNCTION(a IN) +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +CREATE FUNCTION func(IN a INT) RETURNS INT +BEGIN +RETURN a * 10; +END; +$$ +SET @a = 5; +UPDATE Persons SET Age = func(@a) WHERE ID = 1; +SELECT * FROM Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +DROP TABLE Persons; +DROP FUNCTION func; +# +# Call function from UPDATE query +# UPDATE
SET = FUNCTION(a OUT) +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +CREATE FUNCTION func(OUT a INT) RETURNS INT +BEGIN +SET a = 5; +RETURN 80; +END; +$$ +SET @a = 0; +UPDATE Persons SET Age = func(@a) WHERE ID = 1; +ERROR HY000: OUT or INOUT argument 1 for function func is not allowed here +DROP TABLE Persons; +DROP FUNCTION func; +# +# Call function from INSERT query +# INSERT INTO
SELECT , , FUNCTION(a IN) +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +CREATE FUNCTION func(IN a INT) RETURNS INT +BEGIN +RETURN a * 10; +END; +$$ +SET @a = 4; +INSERT INTO Persons SELECT 4, 'DDD', func(@a); +SELECT * FROM Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +4 DDD 40 +DROP TABLE Persons; +DROP FUNCTION func; +# +# Call function from INSERT query +# INSERT INTO
SELECT , , FUNCTION(a OUT) +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +CREATE FUNCTION func(OUT a INT) RETURNS INT +BEGIN +SET a = 45; +RETURN 40; +END; +$$ +SELECT * FROM Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +SET @a = 0; +INSERT INTO Persons SELECT 5, 'EEE', func(@a); +ERROR HY000: OUT or INOUT argument 1 for function func is not allowed here +DROP TABLE Persons; +DROP FUNCTION func; +# +# Call function from DELETE query +# DELETE FROM
WHERE = FUNCTION(a IN) +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +CREATE FUNCTION func(IN a INT) RETURNS INT +BEGIN +RETURN a; +END; +$$ +SELECT * FROM Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +4 DDD 40 +SET @a = 4; +DELETE FROM Persons WHERE ID = func(@a); +SELECT * FROM Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +DROP TABLE Persons; +DROP FUNCTION func; +# +# Call function from DELETE query +# DELETE FROM
WHERE = FUNCTION(a OUT) +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +CREATE FUNCTION func(OUT a INT) RETURNS INT +BEGIN +SET a = 40; +RETURN 4; +END; +$$ +SELECT * FROM Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +4 DDD 40 +SET @a = 0; +DELETE FROM Persons WHERE ID = func(@a); +ERROR HY000: OUT or INOUT argument 1 for function func is not allowed here +DROP TABLE Persons; +DROP FUNCTION func; +# +# SELECT query inside function +# FUNCTION(a IN) > SELECT … FROM
+# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +CREATE FUNCTION func_main(IN a INT) RETURNS INT +BEGIN +DECLARE c INT; +SELECT AGE INTO c FROM Persons WHERE ID = a; +RETURN c; +END; +$$ +SET @a = 3; +SELECT func_main(@a); +func_main(@a) +30 +SELECT * from Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +4 DDD 40 +DROP TABLE Persons; +DROP FUNCTION func_main; +# +# SELECT query inside function +# FUNCTION(a OUT) > SELECT … FROM
+# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +CREATE FUNCTION func_main(OUT a INT) RETURNS INT +BEGIN +SELECT AGE INTO a FROM Persons WHERE ID = 3; +RETURN 0; +END; +$$ +SET @a = 0; +SELECT func_main(@a); +ERROR HY000: OUT or INOUT argument 1 for function func_main is not allowed here +DROP TABLE Persons; +DROP FUNCTION func_main; +# +# SELECT query inside function +# FUNCTION(a INOUT) > SELECT … FROM
+# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +CREATE FUNCTION func_main(INOUT a INT) RETURNS INT +BEGIN +SELECT AGE INTO a FROM Persons WHERE ID = a; +RETURN 0; +END; +$$ +SET @a = 1; +SELECT func_main(@a); +ERROR HY000: OUT or INOUT argument 1 for function func_main is not allowed here +DROP TABLE Persons; +DROP FUNCTION func_main; +# +# SELECT query inside function +# FUNCTION(a IN) > FUNCTION(a IN, b OUT) > SELECT … FROM
+# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +CREATE FUNCTION func_sub(IN a INT, OUT b INT) RETURNS INT +BEGIN +SELECT AGE INTO b FROM Persons WHERE ID = a; +RETURN 0; +END; +$$ +CREATE FUNCTION func_main(IN a INT) RETURNS INT +BEGIN +DECLARE b INT; +DECLARE res INT; +SET res = func_sub(a, b); +RETURN b; +END; +$$ +SET @a = 2; +SELECT func_main(@a); +func_main(@a) +20 +SELECT * from Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +4 DDD 40 +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP FUNCTION func_main; +# +# UPDATE query inside function +# FUNCTION(a IN) > UPDATE
SET … +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'EEE', 40); +CREATE FUNCTION func_main(IN a INT) RETURNS INT +BEGIN +DECLARE c INT; +UPDATE Persons SET AGE = 50 WHERE ID = a; +SELECT AGE INTO c FROM Persons WHERE ID = a; +RETURN c; +END; +$$ +SELECT * from Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 EEE 40 +SET @a = 5; +SELECT func_main(@a); +func_main(@a) +50 +SELECT * from Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 EEE 50 +DROP TABLE Persons; +DROP FUNCTION func_main; +# +# UPDATE query inside function +# FUNCTION(a IN, b OUT) > UPDATE
SET … +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'EEE', 40); +CREATE FUNCTION func_main(IN a INT, OUT b INT) RETURNS INT +BEGIN +UPDATE Persons SET AGE = 60 WHERE ID = a; +SELECT AGE INTO b FROM Persons WHERE ID = a; +RETURN 0; +END; +$$ +SET @a = 5; +SET @b = 0; +SELECT func_main(@a, @b); +ERROR HY000: OUT or INOUT argument 2 for function func_main is not allowed here +DROP TABLE Persons; +DROP FUNCTION func_main; +# +# UPDATE query inside function +# FUNCTION(a IN, b INOUT) > UPDATE
SET … +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'EEE', 40); +CREATE FUNCTION func_main(IN a INT, INOUT b INT) RETURNS INT +BEGIN +UPDATE Persons SET AGE = 60 WHERE ID = a; +SELECT AGE INTO b FROM Persons WHERE ID = a; +RETURN 0; +END; +$$ +SET @a = 5; +SET @b = 0; +SELECT func_main(@a, @b); +ERROR HY000: OUT or INOUT argument 2 for function func_main is not allowed here +DROP TABLE Persons; +DROP FUNCTION func_main; +# +# UPDATE query inside function +# FUNCTION(a IN) > FUNCTION(a IN, b OUT) > UPDATE
SET … +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 80); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'EEE', 40); +CREATE FUNCTION func_sub(IN a INT, OUT b INT) RETURNS INT +BEGIN +UPDATE Persons SET AGE = 10 WHERE ID = a; +SELECT AGE INTO b FROM Persons WHERE ID = a; +RETURN 0; +END; +$$ +CREATE FUNCTION func_main(IN a INT) RETURNS INT +BEGIN +DECLARE b INT; +DECLARE res INT; +SET res = func_sub(a, b); +RETURN b; +END; +$$ +SELECT * from Persons; +ID Name Age +1 AAA 80 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 EEE 40 +SET @a = 1; +SELECT func_main(@a); +func_main(@a) +10 +SELECT * from Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 EEE 40 +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP FUNCTION func_main; +# +# INSERT query inside function +# FUNCTION(a IN) > INSERT INTO
VALUES … +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'EEE', 50); +CREATE FUNCTION func_main(IN a INT) RETURNS INT +BEGIN +DECLARE b INT; +INSERT INTO Persons VALUE (a, 'FFF', 60); +SELECT AGE INTO b FROM Persons WHERE ID = a; +RETURN b; +END; +$$ +SELECT * from Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 EEE 50 +SET @a = 6; +SELECT func_main(@a); +func_main(@a) +60 +SELECT * from Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 EEE 50 +6 FFF 60 +DROP TABLE Persons; +DROP FUNCTION func_main; +# +# INSERT query inside function +# FUNCTION(a IN, b OUT) > INSERT INTO
VALUES … +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'EEE', 50); +CREATE FUNCTION func_main(IN a INT, OUT b INT) RETURNS INT +BEGIN +INSERT INTO Persons VALUE (a, 'FFF', 60); +SELECT AGE INTO b FROM Persons WHERE ID = a; +RETURN 0; +END; +$$ +SELECT * from Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 EEE 50 +SET @a = 6; +SET @b = 0; +SELECT func_main(@a, @b); +ERROR HY000: OUT or INOUT argument 2 for function func_main is not allowed here +DROP TABLE Persons; +DROP FUNCTION func_main; +# +# INSERT query inside function +# FUNCTION(a IN, b INOUT) > INSERT INTO
VALUES … +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'EEE', 40); +CREATE FUNCTION func_main(IN a INT, INOUT b INT) RETURNS INT +BEGIN +INSERT INTO Persons VALUE (a, 'FFF', 60); +SELECT AGE INTO b FROM Persons WHERE ID = a; +RETURN 0; +END; +$$ +SELECT * from Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 EEE 40 +SET @a = 6; +SET @b = 0; +SELECT func_main(@a, @b); +ERROR HY000: OUT or INOUT argument 2 for function func_main is not allowed here +DROP TABLE Persons; +DROP FUNCTION func_main; +# +# INSERT query inside function +# FUNCTION(a IN) > FUNCTION(a IN, b OUT) > INSERT INTO
VALUES … +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'EEE', 40); +CREATE FUNCTION func_sub(IN a INT, OUT b INT) RETURNS INT +BEGIN +INSERT INTO Persons VALUE (a, 'FFF', 60); +SELECT AGE INTO b FROM Persons WHERE ID = a; +RETURN 0; +END; +$$ +CREATE FUNCTION func_main(IN a INT) RETURNS INT +BEGIN +DECLARE b INT; +DECLARE res INT; +SET res = func_sub(a, b); +RETURN b; +END; +$$ +SELECT * from Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 EEE 40 +SET @a = 6; +SELECT func_main(@a); +func_main(@a) +60 +SELECT * from Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 EEE 40 +6 FFF 60 +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP FUNCTION func_main; +# +# PROCEDURE > FUNCTION > SQL query +# PROCEDURE(OUT) > FUNCTION(IN) > SELECT FROM
… +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +CREATE FUNCTION func_sub(IN a INT) RETURNS INT +BEGIN +DECLARE b INT; +SELECT AGE INTO b FROM Persons WHERE ID = a; +RETURN b; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN +SET b = func_sub(a); +END; +$$ +SELECT * from Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +4 DDD 40 +SET @a = 2; +SET @b = 0; +CALL proc_main(@a, @b); +SELECT @b; +@b +20 +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; +# +# PROCEDURE > FUNCTION > SQL query +# PROCEDURE(OUT) > FUNCTION(OUT) > SELECT FROM
… +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +CREATE FUNCTION func_sub(IN a INT, OUT b INT) RETURNS INT +BEGIN +SELECT AGE INTO b FROM Persons WHERE ID = a; +RETURN 0; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN +DECLARE res INT; +SET res = func_sub(a, b); +END; +$$ +SELECT * from Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +4 DDD 40 +SET @a = 1; +SET @b = 0; +CALL proc_main(@a, @b); +SELECT @b; +@b +50 +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; +# +# PROCEDURE > FUNCTION > SQL query +# PROCEDURE(OUT) > FUNCTION(INOUT) > SELECT FROM
… +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +CREATE FUNCTION func_sub(IN a INT, INOUT c INT) RETURNS INT +BEGIN +DECLARE res INT; +SELECT AGE INTO res FROM Persons WHERE ID = a; +SET c = c * 100; +RETURN res; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN +DECLARE c INT; +DECLARE res INT; +SET c = 5; +SET res = func_sub(a, c); +SET b = c; +END; +$$ +SELECT * from Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +4 DDD 40 +SET @a = 2; +SET @b = 0; +CALL proc_main(@a, @b); +SELECT @b; +@b +500 +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; +# +# PROCEDURE > FUNCTION > SQL query +# PROCEDURE(OUT) > FUNCTION(IN) > INSESRT INTO
… +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +CREATE FUNCTION func_sub(IN a INT) RETURNS INT +BEGIN +INSERT INTO Persons VALUE (a, 'FFF', 50); +RETURN 0; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN +SET b = func_sub(a); +END; +$$ +SELECT * from Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +4 DDD 40 +SET @a = 5; +SET @b = 1; +CALL proc_main(@a, @b); +SELECT @b; +@b +0 +SELECT * from Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 FFF 50 +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; +# +# PROCEDURE > FUNCTION > SQL query +# PROCEDURE(OUT) > FUNCTION(OUT) > INSESRT INTO
… +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'FFF', 50); +CREATE FUNCTION func_sub(IN a INT, OUT b INT) RETURNS INT +BEGIN +INSERT INTO Persons VALUE (a, 'GGG', 60); +RETURN 0; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN +DECLARE res INT; +SET res = func_sub(a, b); +END; +$$ +SELECT * from Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 FFF 50 +SET @a = 6; +SET @b = 0; +CALL proc_main(@a, @b); +SELECT * from Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 FFF 50 +6 GGG 60 +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; +# +# PROCEDURE > FUNCTION > SQL query +# PROCEDURE(OUT) > FUNCTION(INOUT) > INSESRT INTO
… +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'FFF', 50); +INSERT INTO Persons VALUES (6, 'GGG', 60); +CREATE FUNCTION func_sub(IN a INT, INOUT c INT) RETURNS INT +BEGIN +DECLARE res INT; +INSERT INTO Persons VALUE (a, 'HHH', 70); +SET c = c * 100; +RETURN res; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN +DECLARE c INT; +DECLARE res INT; +SET c = 5; +SET res = func_sub(a, c); +SET b = c; +END; +$$ +SELECT * from Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 FFF 50 +6 GGG 60 +SET @a = 7; +SET @b = 0; +CALL proc_main(@a, @b); +SELECT @b; +@b +500 +SELECT * from Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 FFF 50 +6 GGG 60 +7 HHH 70 +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; +# +# PROCEDURE > FUNCTION > SQL query +# PROCEDURE(OUT) > FUNCTION(IN) > UPDATE
SET … +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'FFF', 50); +INSERT INTO Persons VALUES (6, 'GGG', 60); +INSERT INTO Persons VALUES (7, 'HHH', 70); +CREATE FUNCTION func_sub(IN a INT) RETURNS INT +BEGIN +UPDATE Persons SET AGE = 100 WHERE ID = a; +RETURN 0; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN +SET b = func_sub(a); +END; +$$ +SELECT * from Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 FFF 50 +6 GGG 60 +7 HHH 70 +SET @a = 5; +SET @b = 0; +CALL proc_main(@a, @b); +SELECT * from Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 FFF 100 +6 GGG 60 +7 HHH 70 +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; +# +# PROCEDURE > FUNCTION > SQL query +# PROCEDURE(OUT) > FUNCTION(OUT) > UPDATE
SET … +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'FFF', 100); +INSERT INTO Persons VALUES (6, 'GGG', 60); +INSERT INTO Persons VALUES (7, 'HHH', 70); +CREATE FUNCTION func_sub(IN a INT, OUT b INT) RETURNS INT +BEGIN +UPDATE Persons SET AGE = 100 WHERE ID = a; +SET b = 1; +RETURN 0; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN +DECLARE res INT; +SET res = func_sub(a, b); +END; +$$ +SELECT * from Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 FFF 100 +6 GGG 60 +7 HHH 70 +SET @a = 6; +SET @b = 0; +CALL proc_main(@a, @b); +SELECT @b; +@b +1 +SELECT * from Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 FFF 100 +6 GGG 100 +7 HHH 70 +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; +# +# PROCEDURE > FUNCTION > SQL query +# PROCEDURE(OUT) > FUNCTION(INOUT) > UPDATE
SET … +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'FFF', 100); +INSERT INTO Persons VALUES (6, 'GGG', 100); +INSERT INTO Persons VALUES (7, 'HHH', 70); +CREATE FUNCTION func_sub(IN a INT, INOUT c INT) RETURNS INT +BEGIN +DECLARE res INT; +UPDATE Persons SET AGE = 100 WHERE ID = a; +SET c = c * 100; +RETURN res; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN +DECLARE c INT; +DECLARE res INT; +SET c = 5; +SET res = func_sub(a, c); +SET b = c; +END; +$$ +SELECT * from Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 FFF 100 +6 GGG 100 +7 HHH 70 +SET @a = 7; +SET @b = 0; +CALL proc_main(@a, @b); +SELECT @b; +@b +500 +SELECT * from Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +4 DDD 40 +5 FFF 100 +6 GGG 100 +7 HHH 100 +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; +# +# Trigger +# TRIGGER AFTER UPDATE ON TABLE1 > UPDATE TABLE2 +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +CREATE TABLE PersonsLog ( +UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); +CREATE OR REPLACE TRIGGER my_trigger +AFTER UPDATE ON Persons +FOR EACH ROW +UPDATE PersonsLog SET UpdateCount = UpdateCount+1; +$$ +SELECT * FROM Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +0 +UPDATE Persons SET Age = 20 WHERE ID = 1; +SELECT * FROM Persons; +ID Name Age +1 AAA 20 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +1 +DROP TRIGGER my_trigger; +DROP TABLE Persons; +DROP TABLE PersonsLog; +# +# Trigger +# TRIGGER AFTER UPDATE ON TABLE1 > FUNCTION(IN) > UPDATE TABLE2 +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +CREATE TABLE PersonsLog ( +UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); +CREATE FUNCTION func(IN a INT) RETURNS INT +BEGIN +UPDATE PersonsLog SET UpdateCount = UpdateCount+a; +RETURN 0; +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +AFTER UPDATE ON Persons +FOR EACH ROW +BEGIN +DECLARE a INT; +DECLARE res INT; +SET a = 1; +SET res = 0; +SET res = func(a); +END; +$$ +SELECT * FROM Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +0 +UPDATE Persons SET Age = 30 WHERE ID = 1; +SELECT * FROM Persons; +ID Name Age +1 AAA 30 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +1 +DROP TRIGGER my_trigger; +DROP FUNCTION func; +DROP TABLE Persons; +DROP TABLE PersonsLog; +# +# Trigger +# TRIGGER AFTER UPDATE ON TABLE1 > FUNCTION(OUT) > UPDATE TABLE2 +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 40); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +CREATE TABLE PersonsLog ( +UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); +CREATE FUNCTION func(IN age_in INT, OUT age_out INT) RETURNS INT +BEGIN +UPDATE PersonsLog SET UpdateCount = UpdateCount+1; +SET age_out = age_in + 1; +RETURN 0; +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +BEFORE UPDATE ON Persons +FOR EACH ROW +BEGIN +DECLARE res INT DEFAULT (func(OLD.age, NEW.age)); +END; +$$ +SELECT * FROM Persons; +ID Name Age +1 AAA 40 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +0 +UPDATE Persons SET Age = 50 WHERE ID = 1; +SELECT * FROM Persons; +ID Name Age +1 AAA 41 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +1 +DROP TRIGGER my_trigger; +DROP FUNCTION func; +DROP TABLE Persons; +DROP TABLE PersonsLog; +# +# Trigger +# TRIGGER AFTER UPDATE ON TABLE1 > FUNCTION(INOUT) > UPDATE TABLE2 +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +CREATE TABLE PersonsLog ( +UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); +CREATE FUNCTION func(INOUT a INT) RETURNS INT +BEGIN +UPDATE PersonsLog SET UpdateCount = UpdateCount+1; +SET a = 100; +RETURN 0; +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +AFTER UPDATE ON Persons +FOR EACH ROW +BEGIN +DECLARE a INT; +DECLARE res INT; +SET a = 10; +SET res = 0; +SET res = func(a); +END; +$$ +SELECT * FROM Persons; +ID Name Age +1 AAA 50 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +0 +UPDATE Persons SET Age = 60 WHERE ID = 1; +SELECT * FROM Persons; +ID Name Age +1 AAA 60 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +1 +DROP TRIGGER my_trigger; +DROP FUNCTION func; +DROP TABLE Persons; +DROP TABLE PersonsLog; +# +# Trigger +# TRIGGER AFTER UPDATE ON TABLE1 > PROCEDURE(IN) > UPDATE TABLE2 +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +CREATE TABLE PersonsLog ( +UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); +CREATE PROCEDURE proc(IN a INT) +BEGIN +UPDATE PersonsLog SET UpdateCount = UpdateCount+a; +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +AFTER UPDATE ON Persons +FOR EACH ROW +BEGIN +CALL proc(1); +END; +$$ +SELECT * FROM Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +0 +UPDATE Persons SET Age = 30 WHERE ID = 1; +SELECT * FROM Persons; +ID Name Age +1 AAA 30 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +1 +DROP TRIGGER my_trigger; +DROP PROCEDURE proc; +DROP TABLE Persons; +DROP TABLE PersonsLog; +# +# Trigger +# TRIGGER AFTER UPDATE ON TABLE1 > PROCEDURE(OUT) > UPDATE TABLE2 +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +CREATE TABLE PersonsLog ( +UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); +CREATE PROCEDURE proc(IN old_age INT, OUT new_age INT) +BEGIN +UPDATE PersonsLog SET UpdateCount = UpdateCount+1; +SET new_age=old_age+41; +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +BEFORE UPDATE ON Persons +FOR EACH ROW +BEGIN +CALL proc(OLD.age, NEW.age); +END; +$$ +SELECT * FROM Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +0 +UPDATE Persons SET Age = 50 WHERE ID = 1; +SELECT * FROM Persons; +ID Name Age +1 AAA 51 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +1 +DROP TRIGGER my_trigger; +DROP PROCEDURE proc; +DROP TABLE Persons; +DROP TABLE PersonsLog; +# +# Trigger +# TRIGGER AFTER UPDATE ON TABLE1 > PROCEDURE(INOUT) > UPDATE TABLE2 +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +CREATE TABLE PersonsLog ( +UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); +CREATE PROCEDURE proc(INOUT a INT) +BEGIN +UPDATE PersonsLog SET UpdateCount = UpdateCount+1; +SET a = 51; +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +BEFORE UPDATE ON Persons +FOR EACH ROW +BEGIN +CALL proc(NEW.age); +END; +$$ +SELECT * FROM Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +0 +UPDATE Persons SET Age = 50 WHERE ID = 1; +SELECT * FROM Persons; +ID Name Age +1 AAA 51 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +1 +DROP TRIGGER my_trigger; +DROP PROCEDURE proc; +DROP TABLE Persons; +DROP TABLE PersonsLog; +# +# Trigger +# TRIGGER AFTER UPDATE ON TABLE1 > PROCEDURE(OUT) > FUNCTION(IN) > UPDATE TABLE2 +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +CREATE TABLE PersonsLog ( +UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); +CREATE FUNCTION func(IN a INT) RETURNS INT +BEGIN +UPDATE PersonsLog SET UpdateCount = UpdateCount+1; +RETURN 0; +END; +$$ +CREATE PROCEDURE proc(OUT a INT) +BEGIN +DECLARE res INT; +SET a = 100; +SET res = func(a); +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +AFTER UPDATE ON Persons +FOR EACH ROW +BEGIN +CALL proc(@a); +END; +$$ +SELECT * FROM Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +0 +UPDATE Persons SET Age = 60 WHERE ID = 1; +SELECT * FROM Persons; +ID Name Age +1 AAA 60 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +1 +DROP TRIGGER my_trigger; +DROP FUNCTION func; +DROP PROCEDURE proc; +DROP TABLE Persons; +DROP TABLE PersonsLog; +# +# Trigger +# TRIGGER AFTER UPDATE ON TABLE1 > PROCEDURE(OUT) > FUNCTION(OUT) > UPDATE TABLE2 +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +CREATE TABLE PersonsLog ( +UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); +CREATE FUNCTION func(OUT a INT) RETURNS INT +BEGIN +SET a = 200; +UPDATE PersonsLog SET UpdateCount = UpdateCount+1; +RETURN 0; +END; +$$ +CREATE PROCEDURE proc(OUT a INT) +BEGIN +DECLARE res INT; +SET a = 100; +SET res = func(a); +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +AFTER UPDATE ON Persons +FOR EACH ROW +BEGIN +CALL proc(@a); +END; +$$ +SELECT * FROM Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +0 +UPDATE Persons SET Age = 80 WHERE ID = 1; +SELECT * FROM Persons; +ID Name Age +1 AAA 80 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +1 +DROP FUNCTION func; +DROP PROCEDURE proc; +DROP TABLE Persons; +DROP TABLE PersonsLog; +# +# Trigger +# TRIGGER AFTER UPDATE ON TABLE1 > PROCEDURE(OUT) > FUNCTION(INOUT) > UPDATE TABLE2 +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +CREATE TABLE PersonsLog ( +UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); +CREATE FUNCTION func(INOUT a INT) RETURNS INT +BEGIN +SET a = 200; +UPDATE PersonsLog SET UpdateCount = UpdateCount+1; +RETURN 0; +END; +$$ +CREATE PROCEDURE proc(OUT a INT) +BEGIN +DECLARE res INT; +SET a = 100; +SET res = func(a); +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +AFTER UPDATE ON Persons +FOR EACH ROW +BEGIN +CALL proc(@a); +END; +$$ +SELECT * FROM Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +0 +UPDATE Persons SET Age = 90 WHERE ID = 1; +SELECT * FROM Persons; +ID Name Age +1 AAA 90 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +1 +DROP TRIGGER my_trigger; +DROP FUNCTION func; +DROP PROCEDURE proc; +DROP TABLE Persons; +DROP TABLE PersonsLog; +# +# Trigger +# TRIGGER AFTER UPDATE ON TABLE1 > PROCEDURE(OUT) > FUNCTION(OUT) > UPDATE TABLE2 with OUT argument (to check if OUT is returning by reference) +# +CREATE TABLE Persons ( +ID int, +Name varchar(255), +Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +CREATE TABLE PersonsLog ( +UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); +CREATE FUNCTION func(OUT a INT) RETURNS INT +BEGIN +SET a = 111; +UPDATE PersonsLog SET UpdateCount = UpdateCount+1; +RETURN 0; +END; +$$ +CREATE PROCEDURE proc(OUT a INT) +BEGIN +DECLARE res INT; +SET res = func(a); +UPDATE PersonsLog SET UpdateCount = a; +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +AFTER UPDATE ON Persons +FOR EACH ROW +BEGIN +CALL proc(@a); +END; +$$ +SELECT * FROM Persons; +ID Name Age +1 AAA 10 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +0 +UPDATE Persons SET Age = 80 WHERE ID = 1; +SELECT * FROM Persons; +ID Name Age +1 AAA 80 +2 BBB 20 +3 CCC 30 +SELECT * FROM PersonsLog; +UpdateCount +111 +DROP TRIGGER my_trigger; +DROP FUNCTION func; +DROP PROCEDURE proc; +DROP TABLE Persons; +DROP TABLE PersonsLog; diff --git a/mysql-test/main/sp-inout.test b/mysql-test/main/sp-inout.test new file mode 100644 index 0000000000000..8f3f134b675bb --- /dev/null +++ b/mysql-test/main/sp-inout.test @@ -0,0 +1,1964 @@ +--echo # +--echo # MDEV-10654 IN, OUT, INOUT parameters in CREATE FUNCTION +--echo # + + +--echo # +--echo # CREATE FUNCTION with IN, OUT, INOUT qualifiers +--echo # SHOW CREATE FUNCTION +--echo # + +DELIMITER $$; +CREATE FUNCTION add_func(IN a INT, IN b INT, OUT c INT, INOUT d INT) RETURNS INT +BEGIN + SET c= 100; + SET d= d + 1; + RETURN a + b; +END; +$$ +DELIMITER ;$$ + +SHOW CREATE FUNCTION add_func; +DROP FUNCTION add_func; + +--echo # +--echo # CREATE PROCEDURE with IN, OUT, INOUT qualifiers +--echo # SHOW CREATE PROCEDURE +--echo # + +DELIMITER $$; +CREATE PROCEDURE add_proc(IN a INT, IN b INT, INOUT c INT, OUT d INT) +BEGIN + SET d= a + b + c + d; +END; +$$ +DELIMITER ;$$ + +SHOW CREATE PROCEDURE add_proc; +DROP PROCEDURE add_proc; + +--echo # +--echo # Call function from SELECT query +--echo # SELECT > FUNCTION(IN) +--echo # + +DELIMITER $$; +CREATE FUNCTION add_func2(IN a INT, IN b INT) RETURNS INT +BEGIN + RETURN a + b; +END; +$$ +DELIMITER ;$$ + +SET @a = 2; +SET @b = 3; +SELECT add_func2(@a, @b); +DROP FUNCTION add_func2; + +--echo # +--echo # Call function from SELECT query +--echo # SELECT > FUNCTION(OUT) +--echo # + +DELIMITER $$; +CREATE FUNCTION add_func3(IN a INT, IN b INT, OUT c INT) RETURNS INT +BEGIN + SET c = 100; + RETURN a + b; +END; +$$ +DELIMITER ;$$ + +SET @a = 2; +SET @b = 3; +SET @c = 0; +SET @res= add_func3(@a, @b, @c); +SELECT @res, @a, @b, @c; +--error ER_SF_OUT_INOUT_ARG_NOT_ALLOWED +SELECT add_func3(@a, @b, @c); +DROP FUNCTION add_func3; + +--echo # +--echo # Call function from SELECT query +--echo # SELECT > FUNCTION(INOUT) +--echo # + +DELIMITER $$; +CREATE FUNCTION add_func4(IN a INT, IN b INT, OUT c INT, INOUT d INT) RETURNS INT +BEGIN + SET c = 100; + SET d = d + 1; + RETURN a + b; +END; +$$ +DELIMITER ;$$ + +SET @a = 2; +SET @b = 3; +SET @c = 0; +SET @d = 9; +SET @res= add_func4(@a, @b, @c, @d); +SELECT @res, @a, @b, @c, @d; +--error ER_SF_OUT_INOUT_ARG_NOT_ALLOWED +SELECT add_func4(@a, @b, @c, @d); +DROP FUNCTION add_func4; + +--echo # +--echo # Call from procedure +--echo # PROCEDURE(OUT) > FUNCTION(IN) +--echo # + +DELIMITER $$; +CREATE FUNCTION add_func2(IN a INT, IN b INT) RETURNS INT +BEGIN + RETURN a + b; +END; +$$ +CREATE PROCEDURE add_proc2(IN a INT, IN b INT, OUT c INT) +BEGIN + SET c = add_func2(a, b); +END; +$$ +DELIMITER ;$$ + +SET @a = 2; +SET @b = 3; +SET @c = 0; +CALL add_proc2(@a, @b, @c); +SELECT @a, @b, @c; +DROP FUNCTION add_func2; +DROP PROCEDURE add_proc2; + +--echo # +--echo # Call from procedure +--echo # PROCEDURE(OUT) > FUNCTION(OUT) +--echo # + +DELIMITER $$; +CREATE FUNCTION add_func3(IN a INT, IN b INT, OUT c INT) RETURNS INT +BEGIN + SET c = 100; + RETURN a + b; +END; +$$ +CREATE PROCEDURE add_proc3(IN a INT, IN b INT, OUT c INT) +BEGIN + DECLARE res INT; + SET res = add_func3(a, b, c); +END; +$$ +DELIMITER ;$$ + +SET @a = 2; +SET @b = 3; +SET @c = 0; +CALL add_proc3(@a, @b, @c); +SELECT @a, @b, @c; +DROP FUNCTION add_func3; +DROP PROCEDURE add_proc3; + +--echo # +--echo # Call from procedure +--echo # PROCEDURE(OUT) > FUNCTION(INOUT) +--echo # + +DELIMITER $$; +CREATE FUNCTION add_func4(IN a INT, IN b INT, OUT c INT, INOUT d INT) RETURNS INT +BEGIN + SET c = 100; + SET d = d + 1; + RETURN a + b; +END; +$$ +CREATE PROCEDURE add_proc4(IN a INT, IN b INT, OUT res INT) +BEGIN + DECLARE c INT; + DECLARE d INT; + SET d = 30; + SET res = add_func4(a, b, c, d); + SET res = c + d; +END; +$$ +DELIMITER ;$$ + +SET @a = 2; +SET @b = 3; +SET @res = 0; +CALL add_proc4(@a, @b, @res); +SELECT @a, @b, @res; +DROP FUNCTION add_func4; +DROP PROCEDURE add_proc4; + +--echo # +--echo # Call from procedure +--echo # PROCEDURE(OUT) > PROCEDURE(OUT) +--echo # + +DELIMITER $$; +CREATE PROCEDURE add_proc(IN a INT, IN b INT, OUT c INT) +BEGIN + SET c = a + b; +END; +$$ +CREATE PROCEDURE test_proc1(IN a INT, IN b INT, OUT c INT) +BEGIN + CALL add_proc(a, b, c); +END; +$$ +DELIMITER ;$$ + +SET @a = 2; +SET @b = 3; +SET @c = 0; +CALL test_proc1(@a, @b, @c); +SELECT @a, @b, @c; +DROP PROCEDURE add_proc; +DROP PROCEDURE test_proc1; + +--echo # +--echo # Argument's order change +--echo # PROCEDURE(a IN, b IN, c OUT) > FUNCTION(b IN, a IN, c OUT) +--echo # + +DELIMITER $$; +CREATE FUNCTION func_sub(IN b INT, IN a INT, OUT c INT) RETURNS INT +BEGIN + DECLARE res INT; + SET c = a - b; + SET res = a; + RETURN res; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, IN b INT, OUT c INT) +BEGIN + DECLARE res INT; + SET res = func_sub(b, a, c); +END; +$$ +DELIMITER ;$$ + +SET @a = 2; +SET @b = 3; +SET @c = 0; +CALL proc_main(@a, @b, @c); +SELECT @a, @b, @c; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; + +--echo # +--echo # Argument's order change +--echo # PROCEDURE(a IN, b IN, c OUT) > FUNCTION(c OUT, b IN, a IN) +--echo # + +DELIMITER $$; +CREATE FUNCTION func_sub(OUT c INT, IN b INT, IN a INT) RETURNS INT +BEGIN + DECLARE res INT; + SET c = a - b; + SET res = a; + RETURN res; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, IN b INT, OUT c INT) +BEGIN + DECLARE res INT; + SET res = func_sub(c, b, a); +END; +$$ +DELIMITER ;$$ + +SET @a = 2; +SET @b = 3; +SET @c = 0; +CALL proc_main(@a, @b, @c); +SELECT @a, @b, @c; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; + +--echo # +--echo # Argument's order change +--echo # PROCEDURE(a IN, b IN, c INOUT, d OUT) > FUNCTION(d OUT, a IN, b IN, c INOUT) +--echo # + +DELIMITER $$; +CREATE FUNCTION func_sub(OUT d INT, IN a INT, IN b INT, INOUT c INT) RETURNS INT +BEGIN + SET c = c + 6; + SET d = 10; + RETURN a - b; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, IN b INT, INOUT c INT, OUT d INT) +BEGIN + DECLARE res INT; + SET res = func_sub(d, a, b, c); + SET d = d + c + res; +END; +$$ +DELIMITER ;$$ + +SET @a = 15; +SET @b = 5; +SET @c = 4; +SET @d= 0; +CALL proc_main(@a, @b, @c, @d); +SELECT @a, @b, @c, @d; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; + +--echo # +--echo # Argument's order change +--echo # PROCEDURE(IN a INT, IN b INT, INOUT c INT, OUT d INT) > FUNCTION1(c INOUT INT, IN b INT) > FUNCTION2(d OUT INT, IN a INT) +--echo # + +DELIMITER $$; +CREATE FUNCTION func_sub1(INOUT c INT, IN b INT) RETURNS INT +BEGIN + SET c = c + b; + RETURN 0; +END; +$$ +CREATE FUNCTION func_sub2(OUT d INT, IN a INT) RETURNS INT +BEGIN + SET d = 5 + a; + RETURN 0; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, IN b INT, INOUT c INT, OUT d INT) +BEGIN + DECLARE res1 INT; + DECLARE res2 INT; + SET res1 = func_sub1(c, b); + SET res2 = func_sub2(d, a); + SET d = d + c; +END; +$$ +DELIMITER ;$$ + +SET @a = 15; +SET @b = 6; +SET @c = 4; +SET @d= 0; +CALL proc_main(@a, @b, @c, @d); +SELECT @a, @b, @c, @d; +DROP FUNCTION func_sub1; +DROP FUNCTION func_sub2; +DROP PROCEDURE proc_main; + +--echo # +--echo # Argument's order change +--echo # FUNCTION1(a IN, b IN) > FUNCTION2(b IN, c OUT, a IN) +--echo # + +DELIMITER $$; +CREATE FUNCTION func_sub(IN b INT, OUT c INT, IN a INT) RETURNS INT +BEGIN + SET c = 100; + RETURN a + b; +END; +$$ +CREATE FUNCTION func_main(IN a INT, IN b INT) RETURNS INT +BEGIN + DECLARE c INT; + DECLARE res INT; + SET res = func_sub(b, c, a); + RETURN res + c; +END; +$$ +DELIMITER ;$$ + +SET @a = 2; +SET @b = 3; +SELECT func_main(@a, @b); +DROP FUNCTION func_sub; +DROP FUNCTION func_main; + +--echo # +--echo # Call procedure inside function +--echo # FUNCTION1(a IN, b IN) > PROCEDURE(a IN, b IN, c OUT) +--echo # + +DELIMITER $$; +CREATE PROCEDURE proc_sub(IN a INT, IN b INT, OUT c INT) +BEGIN + SET c = a + b; +END; +$$ +CREATE FUNCTION func_main(IN b INT, IN a INT) RETURNS INT +BEGIN + DECLARE c INT; + CALL proc_sub(a, b, c); + RETURN c; +END; +$$ +DELIMITER ;$$ + +SET @a = 2; +SET @b = 3; +SELECT func_main(@a, @b); +DROP PROCEDURE proc_sub; +DROP FUNCTION func_main; + +--echo # +--echo # Call procedure inside function +--echo # FUNCTION1(a IN, b IN) > PROCEDURE(a IN, b INOUT) +--echo # + +DELIMITER $$; +CREATE PROCEDURE proc_sub(IN a INT, INOUT b INT) +BEGIN + SET b = a + b; +END; +$$ +CREATE FUNCTION func_main(IN b INT, IN a INT) RETURNS INT +BEGIN + CALL proc_sub(a, b); + RETURN b; +END; +$$ +DELIMITER ;$$ + +SET @a = 2; +SET @b = 3; +SELECT func_main(@a, @b); +DROP PROCEDURE proc_sub; +DROP FUNCTION func_main; + +--echo # +--echo # Call procedure inside function +--echo # FUNCTION1(a IN, b IN, c OUT) > PROCEDURE(a IN, b IN, c OUT) +--echo # + +DELIMITER $$; +CREATE PROCEDURE proc_sub(IN a INT, IN b INT, OUT c INT) +BEGIN + SET c = a + b; +END; +$$ +CREATE FUNCTION func_main(IN b INT, IN a INT, OUT c INT) RETURNS INT +BEGIN + DECLARE res INT; + CALL proc_sub(a, b, c); + RETURN 0; +END; +$$ +DELIMITER ;$$ + +SET @a = 2; +SET @b = 3; +SET @c = 0; +DO func_main(@a, @b, @c); +SELECT @a, @b, @c; +--error ER_SF_OUT_INOUT_ARG_NOT_ALLOWED +SELECT func_main(@a, @b, @c); +DROP PROCEDURE proc_sub; +DROP FUNCTION func_main; + +--echo # +--echo # Call function from UPDATE query +--echo # UPDATE
SET = FUNCTION(a IN) +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); + +DELIMITER $$; +CREATE FUNCTION func(IN a INT) RETURNS INT +BEGIN + RETURN a * 10; +END; +$$ +DELIMITER ;$$ + +SET @a = 5; +UPDATE Persons SET Age = func(@a) WHERE ID = 1; +SELECT * FROM Persons; +DROP TABLE Persons; +DROP FUNCTION func; + +--echo # +--echo # Call function from UPDATE query +--echo # UPDATE
SET = FUNCTION(a OUT) +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); + +DELIMITER $$; +CREATE FUNCTION func(OUT a INT) RETURNS INT +BEGIN + SET a = 5; + RETURN 80; +END; +$$ +DELIMITER ;$$ + +SET @a = 0; +--error ER_SF_OUT_INOUT_ARG_NOT_ALLOWED +UPDATE Persons SET Age = func(@a) WHERE ID = 1; +DROP TABLE Persons; +DROP FUNCTION func; + +--echo # +--echo # Call function from INSERT query +--echo # INSERT INTO
SELECT , , FUNCTION(a IN) +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); + +DELIMITER $$; +CREATE FUNCTION func(IN a INT) RETURNS INT +BEGIN + RETURN a * 10; +END; +$$ +DELIMITER ;$$ + +SET @a = 4; +INSERT INTO Persons SELECT 4, 'DDD', func(@a); +SELECT * FROM Persons; +DROP TABLE Persons; +DROP FUNCTION func; + +--echo # +--echo # Call function from INSERT query +--echo # INSERT INTO
SELECT , , FUNCTION(a OUT) +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); + +DELIMITER $$; +CREATE FUNCTION func(OUT a INT) RETURNS INT +BEGIN + SET a = 45; + RETURN 40; +END; +$$ +DELIMITER ;$$ + +SELECT * FROM Persons; +SET @a = 0; +--error ER_SF_OUT_INOUT_ARG_NOT_ALLOWED +INSERT INTO Persons SELECT 5, 'EEE', func(@a); +DROP TABLE Persons; +DROP FUNCTION func; + +--echo # +--echo # Call function from DELETE query +--echo # DELETE FROM
WHERE = FUNCTION(a IN) +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); + +DELIMITER $$; +CREATE FUNCTION func(IN a INT) RETURNS INT +BEGIN + RETURN a; +END; +$$ +DELIMITER ;$$ + +SELECT * FROM Persons; +SET @a = 4; +DELETE FROM Persons WHERE ID = func(@a); +SELECT * FROM Persons; +DROP TABLE Persons; +DROP FUNCTION func; + +--echo # +--echo # Call function from DELETE query +--echo # DELETE FROM
WHERE = FUNCTION(a OUT) +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); + +DELIMITER $$; +CREATE FUNCTION func(OUT a INT) RETURNS INT +BEGIN + SET a = 40; + RETURN 4; +END; +$$ +DELIMITER ;$$ + +SELECT * FROM Persons; +SET @a = 0; +--error ER_SF_OUT_INOUT_ARG_NOT_ALLOWED +DELETE FROM Persons WHERE ID = func(@a); +DROP TABLE Persons; +DROP FUNCTION func; + +--echo # +--echo # SELECT query inside function +--echo # FUNCTION(a IN) > SELECT … FROM
+--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); + +DELIMITER $$; +CREATE FUNCTION func_main(IN a INT) RETURNS INT +BEGIN + DECLARE c INT; + SELECT AGE INTO c FROM Persons WHERE ID = a; + RETURN c; +END; +$$ +DELIMITER ;$$ + +SET @a = 3; +SELECT func_main(@a); +SELECT * from Persons; +DROP TABLE Persons; +DROP FUNCTION func_main; + +--echo # +--echo # SELECT query inside function +--echo # FUNCTION(a OUT) > SELECT … FROM
+--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); + +DELIMITER $$; +CREATE FUNCTION func_main(OUT a INT) RETURNS INT +BEGIN + SELECT AGE INTO a FROM Persons WHERE ID = 3; + RETURN 0; +END; +$$ +DELIMITER ;$$ + +SET @a = 0; +--error ER_SF_OUT_INOUT_ARG_NOT_ALLOWED +SELECT func_main(@a); +DROP TABLE Persons; +DROP FUNCTION func_main; + +--echo # +--echo # SELECT query inside function +--echo # FUNCTION(a INOUT) > SELECT … FROM
+--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); + +DELIMITER $$; +CREATE FUNCTION func_main(INOUT a INT) RETURNS INT +BEGIN + SELECT AGE INTO a FROM Persons WHERE ID = a; + RETURN 0; +END; +$$ +DELIMITER ;$$ + +SET @a = 1; +--error ER_SF_OUT_INOUT_ARG_NOT_ALLOWED +SELECT func_main(@a); +DROP TABLE Persons; +DROP FUNCTION func_main; + +--echo # +--echo # SELECT query inside function +--echo # FUNCTION(a IN) > FUNCTION(a IN, b OUT) > SELECT … FROM
+--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); + +DELIMITER $$; +CREATE FUNCTION func_sub(IN a INT, OUT b INT) RETURNS INT +BEGIN + SELECT AGE INTO b FROM Persons WHERE ID = a; + RETURN 0; +END; +$$ +CREATE FUNCTION func_main(IN a INT) RETURNS INT +BEGIN + DECLARE b INT; + DECLARE res INT; + SET res = func_sub(a, b); + RETURN b; +END; +$$ +DELIMITER ;$$ + +SET @a = 2; +SELECT func_main(@a); +SELECT * from Persons; +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP FUNCTION func_main; + +--echo # +--echo # UPDATE query inside function +--echo # FUNCTION(a IN) > UPDATE
SET … +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'EEE', 40); + +DELIMITER $$; +CREATE FUNCTION func_main(IN a INT) RETURNS INT +BEGIN + DECLARE c INT; + UPDATE Persons SET AGE = 50 WHERE ID = a; + SELECT AGE INTO c FROM Persons WHERE ID = a; + RETURN c; +END; +$$ +DELIMITER ;$$ + +SELECT * from Persons; +SET @a = 5; +SELECT func_main(@a); +SELECT * from Persons; +DROP TABLE Persons; +DROP FUNCTION func_main; + +--echo # +--echo # UPDATE query inside function +--echo # FUNCTION(a IN, b OUT) > UPDATE
SET … +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'EEE', 40); + +DELIMITER $$; +CREATE FUNCTION func_main(IN a INT, OUT b INT) RETURNS INT +BEGIN + UPDATE Persons SET AGE = 60 WHERE ID = a; + SELECT AGE INTO b FROM Persons WHERE ID = a; + RETURN 0; +END; +$$ +DELIMITER ;$$ + +SET @a = 5; +SET @b = 0; +--error ER_SF_OUT_INOUT_ARG_NOT_ALLOWED +SELECT func_main(@a, @b); +DROP TABLE Persons; +DROP FUNCTION func_main; + +--echo # +--echo # UPDATE query inside function +--echo # FUNCTION(a IN, b INOUT) > UPDATE
SET … +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'EEE', 40); + +DELIMITER $$; +CREATE FUNCTION func_main(IN a INT, INOUT b INT) RETURNS INT +BEGIN + UPDATE Persons SET AGE = 60 WHERE ID = a; + SELECT AGE INTO b FROM Persons WHERE ID = a; + RETURN 0; +END; +$$ +DELIMITER ;$$ + +SET @a = 5; +SET @b = 0; +--error ER_SF_OUT_INOUT_ARG_NOT_ALLOWED +SELECT func_main(@a, @b); +DROP TABLE Persons; +DROP FUNCTION func_main; + +--echo # +--echo # UPDATE query inside function +--echo # FUNCTION(a IN) > FUNCTION(a IN, b OUT) > UPDATE
SET … +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 80); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'EEE', 40); + +DELIMITER $$; +CREATE FUNCTION func_sub(IN a INT, OUT b INT) RETURNS INT +BEGIN + UPDATE Persons SET AGE = 10 WHERE ID = a; + SELECT AGE INTO b FROM Persons WHERE ID = a; + RETURN 0; +END; +$$ +CREATE FUNCTION func_main(IN a INT) RETURNS INT +BEGIN + DECLARE b INT; + DECLARE res INT; + SET res = func_sub(a, b); + RETURN b; +END; +$$ +DELIMITER ;$$ + +SELECT * from Persons; +SET @a = 1; +SELECT func_main(@a); +SELECT * from Persons; +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP FUNCTION func_main; + + +--echo # +--echo # INSERT query inside function +--echo # FUNCTION(a IN) > INSERT INTO
VALUES … +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'EEE', 50); + +DELIMITER $$; +CREATE FUNCTION func_main(IN a INT) RETURNS INT +BEGIN + DECLARE b INT; + INSERT INTO Persons VALUE (a, 'FFF', 60); + SELECT AGE INTO b FROM Persons WHERE ID = a; + RETURN b; +END; +$$ +DELIMITER ;$$ + +SELECT * from Persons; +SET @a = 6; +SELECT func_main(@a); +SELECT * from Persons; +DROP TABLE Persons; +DROP FUNCTION func_main; + +--echo # +--echo # INSERT query inside function +--echo # FUNCTION(a IN, b OUT) > INSERT INTO
VALUES … +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'EEE', 50); + +DELIMITER $$; +CREATE FUNCTION func_main(IN a INT, OUT b INT) RETURNS INT +BEGIN + INSERT INTO Persons VALUE (a, 'FFF', 60); + SELECT AGE INTO b FROM Persons WHERE ID = a; + RETURN 0; +END; +$$ +DELIMITER ;$$ + +SELECT * from Persons; +SET @a = 6; +SET @b = 0; +--error ER_SF_OUT_INOUT_ARG_NOT_ALLOWED +SELECT func_main(@a, @b); +DROP TABLE Persons; +DROP FUNCTION func_main; + +--echo # +--echo # INSERT query inside function +--echo # FUNCTION(a IN, b INOUT) > INSERT INTO
VALUES … +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'EEE', 40); + +DELIMITER $$; +CREATE FUNCTION func_main(IN a INT, INOUT b INT) RETURNS INT +BEGIN + INSERT INTO Persons VALUE (a, 'FFF', 60); + SELECT AGE INTO b FROM Persons WHERE ID = a; + RETURN 0; +END; +$$ +DELIMITER ;$$ + +SELECT * from Persons; +SET @a = 6; +SET @b = 0; +--error ER_SF_OUT_INOUT_ARG_NOT_ALLOWED +SELECT func_main(@a, @b); +DROP TABLE Persons; +DROP FUNCTION func_main; + +--echo # +--echo # INSERT query inside function +--echo # FUNCTION(a IN) > FUNCTION(a IN, b OUT) > INSERT INTO
VALUES … +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'EEE', 40); + +DELIMITER $$; +CREATE FUNCTION func_sub(IN a INT, OUT b INT) RETURNS INT +BEGIN + INSERT INTO Persons VALUE (a, 'FFF', 60); + SELECT AGE INTO b FROM Persons WHERE ID = a; + RETURN 0; +END; +$$ +CREATE FUNCTION func_main(IN a INT) RETURNS INT +BEGIN + DECLARE b INT; + DECLARE res INT; + SET res = func_sub(a, b); + RETURN b; +END; +$$ +DELIMITER ;$$ + +SELECT * from Persons; +SET @a = 6; +SELECT func_main(@a); +SELECT * from Persons; +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP FUNCTION func_main; + +--echo # +--echo # PROCEDURE > FUNCTION > SQL query +--echo # PROCEDURE(OUT) > FUNCTION(IN) > SELECT FROM
… +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); + +DELIMITER $$; +CREATE FUNCTION func_sub(IN a INT) RETURNS INT +BEGIN + DECLARE b INT; + SELECT AGE INTO b FROM Persons WHERE ID = a; + RETURN b; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN + SET b = func_sub(a); +END; +$$ +DELIMITER ;$$ + +SELECT * from Persons; +SET @a = 2; +SET @b = 0; +CALL proc_main(@a, @b); +SELECT @b; +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; + +--echo # +--echo # PROCEDURE > FUNCTION > SQL query +--echo # PROCEDURE(OUT) > FUNCTION(OUT) > SELECT FROM
… +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); + +DELIMITER $$; +CREATE FUNCTION func_sub(IN a INT, OUT b INT) RETURNS INT +BEGIN + SELECT AGE INTO b FROM Persons WHERE ID = a; + RETURN 0; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN + DECLARE res INT; + SET res = func_sub(a, b); +END; +$$ +DELIMITER ;$$ + +SELECT * from Persons; +SET @a = 1; +SET @b = 0; +CALL proc_main(@a, @b); +SELECT @b; +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; + +--echo # +--echo # PROCEDURE > FUNCTION > SQL query +--echo # PROCEDURE(OUT) > FUNCTION(INOUT) > SELECT FROM
… +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); + +DELIMITER $$; +CREATE FUNCTION func_sub(IN a INT, INOUT c INT) RETURNS INT +BEGIN + DECLARE res INT; + SELECT AGE INTO res FROM Persons WHERE ID = a; + SET c = c * 100; + RETURN res; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN + DECLARE c INT; + DECLARE res INT; + SET c = 5; + SET res = func_sub(a, c); + SET b = c; +END; +$$ +DELIMITER ;$$ + +SELECT * from Persons; +SET @a = 2; +SET @b = 0; +CALL proc_main(@a, @b); +SELECT @b; +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; + + +--echo # +--echo # PROCEDURE > FUNCTION > SQL query +--echo # PROCEDURE(OUT) > FUNCTION(IN) > INSESRT INTO
… +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); + +DELIMITER $$; +CREATE FUNCTION func_sub(IN a INT) RETURNS INT +BEGIN + INSERT INTO Persons VALUE (a, 'FFF', 50); + RETURN 0; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN + SET b = func_sub(a); +END; +$$ +DELIMITER ;$$ + +SELECT * from Persons; +SET @a = 5; +SET @b = 1; +CALL proc_main(@a, @b); +SELECT @b; +SELECT * from Persons; +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; + + +--echo # +--echo # PROCEDURE > FUNCTION > SQL query +--echo # PROCEDURE(OUT) > FUNCTION(OUT) > INSESRT INTO
… +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'FFF', 50); + +DELIMITER $$; +CREATE FUNCTION func_sub(IN a INT, OUT b INT) RETURNS INT +BEGIN + INSERT INTO Persons VALUE (a, 'GGG', 60); + RETURN 0; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN + DECLARE res INT; + SET res = func_sub(a, b); +END; +$$ +DELIMITER ;$$ + +SELECT * from Persons; +SET @a = 6; +SET @b = 0; +CALL proc_main(@a, @b); +SELECT * from Persons; +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; + + +--echo # +--echo # PROCEDURE > FUNCTION > SQL query +--echo # PROCEDURE(OUT) > FUNCTION(INOUT) > INSESRT INTO
… +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'FFF', 50); +INSERT INTO Persons VALUES (6, 'GGG', 60); + +DELIMITER $$; +CREATE FUNCTION func_sub(IN a INT, INOUT c INT) RETURNS INT +BEGIN + DECLARE res INT; + INSERT INTO Persons VALUE (a, 'HHH', 70); + SET c = c * 100; + RETURN res; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN + DECLARE c INT; + DECLARE res INT; + SET c = 5; + SET res = func_sub(a, c); + SET b = c; +END; +$$ +DELIMITER ;$$ + +SELECT * from Persons; +SET @a = 7; +SET @b = 0; +CALL proc_main(@a, @b); +SELECT @b; +SELECT * from Persons; +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; + + +--echo # +--echo # PROCEDURE > FUNCTION > SQL query +--echo # PROCEDURE(OUT) > FUNCTION(IN) > UPDATE
SET … +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'FFF', 50); +INSERT INTO Persons VALUES (6, 'GGG', 60); +INSERT INTO Persons VALUES (7, 'HHH', 70); + +DELIMITER $$; +CREATE FUNCTION func_sub(IN a INT) RETURNS INT +BEGIN + UPDATE Persons SET AGE = 100 WHERE ID = a; + RETURN 0; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN + SET b = func_sub(a); +END; +$$ +DELIMITER ;$$ + +SELECT * from Persons; +SET @a = 5; +SET @b = 0; +CALL proc_main(@a, @b); +SELECT * from Persons; +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; + +--echo # +--echo # PROCEDURE > FUNCTION > SQL query +--echo # PROCEDURE(OUT) > FUNCTION(OUT) > UPDATE
SET … +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'FFF', 100); +INSERT INTO Persons VALUES (6, 'GGG', 60); +INSERT INTO Persons VALUES (7, 'HHH', 70); + +DELIMITER $$; +CREATE FUNCTION func_sub(IN a INT, OUT b INT) RETURNS INT +BEGIN + UPDATE Persons SET AGE = 100 WHERE ID = a; + SET b = 1; + RETURN 0; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN + DECLARE res INT; + SET res = func_sub(a, b); +END; +$$ +DELIMITER ;$$ + +SELECT * from Persons; +SET @a = 6; +SET @b = 0; +CALL proc_main(@a, @b); +SELECT @b; +SELECT * from Persons; +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; + + +--echo # +--echo # PROCEDURE > FUNCTION > SQL query +--echo # PROCEDURE(OUT) > FUNCTION(INOUT) > UPDATE
SET … +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); +INSERT INTO Persons VALUES (4, 'DDD', 40); +INSERT INTO Persons VALUES (5, 'FFF', 100); +INSERT INTO Persons VALUES (6, 'GGG', 100); +INSERT INTO Persons VALUES (7, 'HHH', 70); + +DELIMITER $$; +CREATE FUNCTION func_sub(IN a INT, INOUT c INT) RETURNS INT +BEGIN + DECLARE res INT; + UPDATE Persons SET AGE = 100 WHERE ID = a; + SET c = c * 100; + RETURN res; +END; +$$ +CREATE PROCEDURE proc_main(IN a INT, OUT b INT) +BEGIN + DECLARE c INT; + DECLARE res INT; + SET c = 5; + SET res = func_sub(a, c); + SET b = c; +END; +$$ +DELIMITER ;$$ + +SELECT * from Persons; +SET @a = 7; +SET @b = 0; +CALL proc_main(@a, @b); +SELECT @b; +SELECT * from Persons; +DROP TABLE Persons; +DROP FUNCTION func_sub; +DROP PROCEDURE proc_main; + + +--echo # +--echo # Trigger +--echo # TRIGGER AFTER UPDATE ON TABLE1 > UPDATE TABLE2 +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); + +CREATE TABLE PersonsLog ( + UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); + +DELIMITER $$; +CREATE OR REPLACE TRIGGER my_trigger +AFTER UPDATE ON Persons +FOR EACH ROW + UPDATE PersonsLog SET UpdateCount = UpdateCount+1; +$$ +DELIMITER ;$$ + +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +UPDATE Persons SET Age = 20 WHERE ID = 1; +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +DROP TRIGGER my_trigger; +DROP TABLE Persons; +DROP TABLE PersonsLog; + +--echo # +--echo # Trigger +--echo # TRIGGER AFTER UPDATE ON TABLE1 > FUNCTION(IN) > UPDATE TABLE2 +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); + +CREATE TABLE PersonsLog ( + UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); + +DELIMITER $$; +CREATE FUNCTION func(IN a INT) RETURNS INT +BEGIN + UPDATE PersonsLog SET UpdateCount = UpdateCount+a; + RETURN 0; +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +AFTER UPDATE ON Persons +FOR EACH ROW +BEGIN + DECLARE a INT; + DECLARE res INT; + SET a = 1; + SET res = 0; + SET res = func(a); +END; +$$ +DELIMITER ;$$ + +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +UPDATE Persons SET Age = 30 WHERE ID = 1; +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +DROP TRIGGER my_trigger; +DROP FUNCTION func; +DROP TABLE Persons; +DROP TABLE PersonsLog; + +--echo # +--echo # Trigger +--echo # TRIGGER AFTER UPDATE ON TABLE1 > FUNCTION(OUT) > UPDATE TABLE2 +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 40); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); + +CREATE TABLE PersonsLog ( + UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); + +DELIMITER $$; +CREATE FUNCTION func(IN age_in INT, OUT age_out INT) RETURNS INT +BEGIN + UPDATE PersonsLog SET UpdateCount = UpdateCount+1; + SET age_out = age_in + 1; + RETURN 0; +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +BEFORE UPDATE ON Persons +FOR EACH ROW +BEGIN + DECLARE res INT DEFAULT (func(OLD.age, NEW.age)); +END; +$$ +DELIMITER ;$$ + +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +UPDATE Persons SET Age = 50 WHERE ID = 1; +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +DROP TRIGGER my_trigger; +DROP FUNCTION func; +DROP TABLE Persons; +DROP TABLE PersonsLog; + +--echo # +--echo # Trigger +--echo # TRIGGER AFTER UPDATE ON TABLE1 > FUNCTION(INOUT) > UPDATE TABLE2 +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 50); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); + +CREATE TABLE PersonsLog ( + UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); + +DELIMITER $$; +CREATE FUNCTION func(INOUT a INT) RETURNS INT +BEGIN + UPDATE PersonsLog SET UpdateCount = UpdateCount+1; + SET a = 100; + RETURN 0; +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +AFTER UPDATE ON Persons +FOR EACH ROW +BEGIN + DECLARE a INT; + DECLARE res INT; + SET a = 10; + SET res = 0; + SET res = func(a); +END; +$$ +DELIMITER ;$$ + +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +UPDATE Persons SET Age = 60 WHERE ID = 1; +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +DROP TRIGGER my_trigger; +DROP FUNCTION func; +DROP TABLE Persons; +DROP TABLE PersonsLog; + +--echo # +--echo # Trigger +--echo # TRIGGER AFTER UPDATE ON TABLE1 > PROCEDURE(IN) > UPDATE TABLE2 +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); + +CREATE TABLE PersonsLog ( + UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); + +DELIMITER $$; +CREATE PROCEDURE proc(IN a INT) +BEGIN + UPDATE PersonsLog SET UpdateCount = UpdateCount+a; +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +AFTER UPDATE ON Persons +FOR EACH ROW +BEGIN + CALL proc(1); +END; +$$ +DELIMITER ;$$ + +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +UPDATE Persons SET Age = 30 WHERE ID = 1; +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +DROP TRIGGER my_trigger; +DROP PROCEDURE proc; +DROP TABLE Persons; +DROP TABLE PersonsLog; + +--echo # +--echo # Trigger +--echo # TRIGGER AFTER UPDATE ON TABLE1 > PROCEDURE(OUT) > UPDATE TABLE2 +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); + +CREATE TABLE PersonsLog ( + UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); + +DELIMITER $$; +CREATE PROCEDURE proc(IN old_age INT, OUT new_age INT) +BEGIN + UPDATE PersonsLog SET UpdateCount = UpdateCount+1; + SET new_age=old_age+41; +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +BEFORE UPDATE ON Persons +FOR EACH ROW +BEGIN + CALL proc(OLD.age, NEW.age); +END; +$$ +DELIMITER ;$$ + +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +UPDATE Persons SET Age = 50 WHERE ID = 1; +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +DROP TRIGGER my_trigger; +DROP PROCEDURE proc; +DROP TABLE Persons; +DROP TABLE PersonsLog; + +--echo # +--echo # Trigger +--echo # TRIGGER AFTER UPDATE ON TABLE1 > PROCEDURE(INOUT) > UPDATE TABLE2 +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); + +CREATE TABLE PersonsLog ( + UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); + +DELIMITER $$; +CREATE PROCEDURE proc(INOUT a INT) +BEGIN + UPDATE PersonsLog SET UpdateCount = UpdateCount+1; + SET a = 51; +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +BEFORE UPDATE ON Persons +FOR EACH ROW +BEGIN + CALL proc(NEW.age); +END; +$$ +DELIMITER ;$$ + +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +UPDATE Persons SET Age = 50 WHERE ID = 1; +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +DROP TRIGGER my_trigger; +DROP PROCEDURE proc; +DROP TABLE Persons; +DROP TABLE PersonsLog; + +--echo # +--echo # Trigger +--echo # TRIGGER AFTER UPDATE ON TABLE1 > PROCEDURE(OUT) > FUNCTION(IN) > UPDATE TABLE2 +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); + +CREATE TABLE PersonsLog ( + UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); + +DELIMITER $$; +CREATE FUNCTION func(IN a INT) RETURNS INT +BEGIN + UPDATE PersonsLog SET UpdateCount = UpdateCount+1; + RETURN 0; +END; +$$ +CREATE PROCEDURE proc(OUT a INT) +BEGIN + DECLARE res INT; + SET a = 100; + SET res = func(a); +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +AFTER UPDATE ON Persons +FOR EACH ROW +BEGIN + CALL proc(@a); +END; +$$ +DELIMITER ;$$ + +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +UPDATE Persons SET Age = 60 WHERE ID = 1; +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +DROP TRIGGER my_trigger; +DROP FUNCTION func; +DROP PROCEDURE proc; +DROP TABLE Persons; +DROP TABLE PersonsLog; + +--echo # +--echo # Trigger +--echo # TRIGGER AFTER UPDATE ON TABLE1 > PROCEDURE(OUT) > FUNCTION(OUT) > UPDATE TABLE2 +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); + +CREATE TABLE PersonsLog ( + UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); + +DELIMITER $$; +CREATE FUNCTION func(OUT a INT) RETURNS INT +BEGIN + SET a = 200; + UPDATE PersonsLog SET UpdateCount = UpdateCount+1; + RETURN 0; +END; +$$ +CREATE PROCEDURE proc(OUT a INT) +BEGIN + DECLARE res INT; + SET a = 100; + SET res = func(a); +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +AFTER UPDATE ON Persons +FOR EACH ROW +BEGIN + CALL proc(@a); +END; +$$ +DELIMITER ;$$ + +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +UPDATE Persons SET Age = 80 WHERE ID = 1; +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +DROP FUNCTION func; +DROP PROCEDURE proc; +DROP TABLE Persons; +DROP TABLE PersonsLog; + +--echo # +--echo # Trigger +--echo # TRIGGER AFTER UPDATE ON TABLE1 > PROCEDURE(OUT) > FUNCTION(INOUT) > UPDATE TABLE2 +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); + +CREATE TABLE PersonsLog ( + UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); + +DELIMITER $$; +CREATE FUNCTION func(INOUT a INT) RETURNS INT +BEGIN + SET a = 200; + UPDATE PersonsLog SET UpdateCount = UpdateCount+1; + RETURN 0; +END; +$$ +CREATE PROCEDURE proc(OUT a INT) +BEGIN + DECLARE res INT; + SET a = 100; + SET res = func(a); +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +AFTER UPDATE ON Persons +FOR EACH ROW +BEGIN + CALL proc(@a); +END; +$$ +DELIMITER ;$$ + +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +UPDATE Persons SET Age = 90 WHERE ID = 1; +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +DROP TRIGGER my_trigger; +DROP FUNCTION func; +DROP PROCEDURE proc; +DROP TABLE Persons; +DROP TABLE PersonsLog; + +--echo # +--echo # Trigger +--echo # TRIGGER AFTER UPDATE ON TABLE1 > PROCEDURE(OUT) > FUNCTION(OUT) > UPDATE TABLE2 with OUT argument (to check if OUT is returning by reference) +--echo # + +CREATE TABLE Persons ( + ID int, + Name varchar(255), + Age int +); +INSERT INTO Persons VALUES (1, 'AAA', 10); +INSERT INTO Persons VALUES (2, 'BBB', 20); +INSERT INTO Persons VALUES (3, 'CCC', 30); + +CREATE TABLE PersonsLog ( + UpdateCount int +); +INSERT INTO PersonsLog VALUES (0); + +DELIMITER $$; +CREATE FUNCTION func(OUT a INT) RETURNS INT +BEGIN + SET a = 111; + UPDATE PersonsLog SET UpdateCount = UpdateCount+1; + RETURN 0; +END; +$$ +CREATE PROCEDURE proc(OUT a INT) +BEGIN + DECLARE res INT; + SET res = func(a); + UPDATE PersonsLog SET UpdateCount = a; +END; +$$ +CREATE OR REPLACE TRIGGER my_trigger +AFTER UPDATE ON Persons +FOR EACH ROW +BEGIN + CALL proc(@a); +END; +$$ +DELIMITER ;$$ + +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +UPDATE Persons SET Age = 80 WHERE ID = 1; +SELECT * FROM Persons; +SELECT * FROM PersonsLog; +DROP TRIGGER my_trigger; +DROP FUNCTION func; +DROP PROCEDURE proc; +DROP TABLE Persons; +DROP TABLE PersonsLog; diff --git a/mysql-test/main/sp-lock.test b/mysql-test/main/sp-lock.test index 703c59e8f28b0..f31a826823145 100644 --- a/mysql-test/main/sp-lock.test +++ b/mysql-test/main/sp-lock.test @@ -20,6 +20,9 @@ --echo # then call a DDL operation on a procedure, and then check --echo # that the savepoint is no longer present. +# Tests will be skipped for the view protocol +-- source include/no_view_protocol.inc + --disable_warnings drop table if exists t1; drop procedure if exists p1; diff --git a/mysql-test/main/sp-no-valgrind.test b/mysql-test/main/sp-no-valgrind.test index 21e52f2d3d555..6bacc7b150cb1 100644 --- a/mysql-test/main/sp-no-valgrind.test +++ b/mysql-test/main/sp-no-valgrind.test @@ -1,4 +1,4 @@ - +--source include/not_msan.inc --source include/not_valgrind_build.inc --echo # MDEV-20699 do not cache SP in SHOW CREATE diff --git a/mysql-test/main/sp-prelocking.test b/mysql-test/main/sp-prelocking.test index 38cbd5aa11078..fd754a9371c57 100644 --- a/mysql-test/main/sp-prelocking.test +++ b/mysql-test/main/sp-prelocking.test @@ -19,7 +19,7 @@ drop function if exists f3; --enable_warnings # BUG#8072 - +--disable_service_connection create database mysqltest; delimiter //; use mysqltest// @@ -42,7 +42,7 @@ select database(); drop procedure mysqltest.sp1; drop database mysqltest; - +--enable_service_connection # BUG#8766 delimiter //; diff --git a/mysql-test/main/sp-row.result b/mysql-test/main/sp-row.result index 2764b4cd99986..b66455dfdb915 100644 --- a/mysql-test/main/sp-row.result +++ b/mysql-test/main/sp-row.result @@ -20,7 +20,7 @@ RETURN a; END; $$ SELECT f1(ROW(10,20)); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Cannot cast 'row' as 'int' in assignment of `f1(ROW(10,20))` DROP FUNCTION f1; # # ROW as an SP parameter @@ -236,7 +236,7 @@ SELECT f1(a); END; $$ CALL p1(); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Cannot cast 'row' as 'int' in assignment of `a` DROP PROCEDURE p1; DROP FUNCTION f1; # @@ -286,7 +286,7 @@ RETURN rec; END; $$ SELECT f1(10); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Cannot cast 'row' as 'int' in assignment of `f1(10)` DROP FUNCTION f1; # # Using the entire ROW in SELECT..CREATE @@ -744,10 +744,10 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `rec1.a` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL, - `rec2.a` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL, - `rec3.a` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `rec1.a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `rec2.a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `rec3.a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -760,7 +760,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(11) DEFAULT NULL, `rec.var` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var INT(1); DECLARE rec ROW(var INT(1)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -770,7 +770,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(11) DEFAULT NULL, `rec.var` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var INT(2); DECLARE rec ROW(var INT(2)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -780,7 +780,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(11) DEFAULT NULL, `rec.var` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var INT(3); DECLARE rec ROW(var INT(3)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -790,7 +790,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(11) DEFAULT NULL, `rec.var` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var INT(4); DECLARE rec ROW(var INT(4)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -800,7 +800,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(11) DEFAULT NULL, `rec.var` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var INT(5); DECLARE rec ROW(var INT(5)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -810,7 +810,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(11) DEFAULT NULL, `rec.var` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var INT(6); DECLARE rec ROW(var INT(6)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -820,7 +820,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(11) DEFAULT NULL, `rec.var` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var INT(7); DECLARE rec ROW(var INT(7)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -830,7 +830,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(11) DEFAULT NULL, `rec.var` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var INT(8); DECLARE rec ROW(var INT(8)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -840,7 +840,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(11) DEFAULT NULL, `rec.var` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var INT(9); DECLARE rec ROW(var INT(9)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -850,7 +850,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(11) DEFAULT NULL, `rec.var` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var INT(10); DECLARE rec ROW(var INT(10)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -860,7 +860,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(11) DEFAULT NULL, `rec.var` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var INT(11); DECLARE rec ROW(var INT(11)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -870,7 +870,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(11) DEFAULT NULL, `rec.var` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var INT(12); DECLARE rec ROW(var INT(12)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -880,7 +880,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(12) DEFAULT NULL, `rec.var` int(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var INT(13); DECLARE rec ROW(var INT(13)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -890,7 +890,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(13) DEFAULT NULL, `rec.var` int(13) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var INT(14); DECLARE rec ROW(var INT(14)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -900,7 +900,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(14) DEFAULT NULL, `rec.var` int(14) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var INT(20); DECLARE rec ROW(var INT(20)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -910,7 +910,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(20) DEFAULT NULL, `rec.var` int(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var INT(21); DECLARE rec ROW(var INT(21)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -920,7 +920,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` int(21) DEFAULT NULL, `rec.var` int(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -933,7 +933,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(4) DEFAULT NULL, `rec.var` tinyint(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYINT(1); DECLARE rec ROW(var TINYINT(1)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -943,7 +943,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(4) DEFAULT NULL, `rec.var` tinyint(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYINT(2); DECLARE rec ROW(var TINYINT(2)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -953,7 +953,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(4) DEFAULT NULL, `rec.var` tinyint(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYINT(3); DECLARE rec ROW(var TINYINT(3)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -963,7 +963,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(4) DEFAULT NULL, `rec.var` tinyint(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYINT(4); DECLARE rec ROW(var TINYINT(4)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -973,7 +973,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(4) DEFAULT NULL, `rec.var` tinyint(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYINT(5); DECLARE rec ROW(var TINYINT(5)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -983,7 +983,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(5) DEFAULT NULL, `rec.var` tinyint(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYINT(6); DECLARE rec ROW(var TINYINT(6)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -993,7 +993,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(6) DEFAULT NULL, `rec.var` tinyint(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYINT(7); DECLARE rec ROW(var TINYINT(7)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1003,7 +1003,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(7) DEFAULT NULL, `rec.var` tinyint(7) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYINT(8); DECLARE rec ROW(var TINYINT(8)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1013,7 +1013,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(8) DEFAULT NULL, `rec.var` tinyint(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYINT(9); DECLARE rec ROW(var TINYINT(9)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1023,7 +1023,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(9) DEFAULT NULL, `rec.var` tinyint(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYINT(10); DECLARE rec ROW(var TINYINT(10)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1033,7 +1033,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(10) DEFAULT NULL, `rec.var` tinyint(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYINT(11); DECLARE rec ROW(var TINYINT(11)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1043,7 +1043,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(11) DEFAULT NULL, `rec.var` tinyint(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYINT(12); DECLARE rec ROW(var TINYINT(12)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1053,7 +1053,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(12) DEFAULT NULL, `rec.var` tinyint(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYINT(13); DECLARE rec ROW(var TINYINT(13)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1063,7 +1063,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(13) DEFAULT NULL, `rec.var` tinyint(13) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYINT(14); DECLARE rec ROW(var TINYINT(14)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1073,7 +1073,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(14) DEFAULT NULL, `rec.var` tinyint(14) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYINT(20); DECLARE rec ROW(var TINYINT(20)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1083,7 +1083,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(20) DEFAULT NULL, `rec.var` tinyint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYINT(21); DECLARE rec ROW(var TINYINT(21)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1093,7 +1093,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinyint(21) DEFAULT NULL, `rec.var` tinyint(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -1106,7 +1106,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(6) DEFAULT NULL, `rec.var` smallint(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var SMALLINT(1); DECLARE rec ROW(var SMALLINT(1)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1116,7 +1116,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(6) DEFAULT NULL, `rec.var` smallint(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var SMALLINT(2); DECLARE rec ROW(var SMALLINT(2)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1126,7 +1126,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(6) DEFAULT NULL, `rec.var` smallint(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var SMALLINT(3); DECLARE rec ROW(var SMALLINT(3)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1136,7 +1136,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(6) DEFAULT NULL, `rec.var` smallint(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var SMALLINT(4); DECLARE rec ROW(var SMALLINT(4)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1146,7 +1146,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(6) DEFAULT NULL, `rec.var` smallint(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var SMALLINT(5); DECLARE rec ROW(var SMALLINT(5)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1156,7 +1156,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(6) DEFAULT NULL, `rec.var` smallint(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var SMALLINT(6); DECLARE rec ROW(var SMALLINT(6)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1166,7 +1166,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(6) DEFAULT NULL, `rec.var` smallint(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var SMALLINT(7); DECLARE rec ROW(var SMALLINT(7)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1176,7 +1176,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(7) DEFAULT NULL, `rec.var` smallint(7) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var SMALLINT(8); DECLARE rec ROW(var SMALLINT(8)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1186,7 +1186,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(8) DEFAULT NULL, `rec.var` smallint(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var SMALLINT(9); DECLARE rec ROW(var SMALLINT(9)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1196,7 +1196,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(9) DEFAULT NULL, `rec.var` smallint(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var SMALLINT(10); DECLARE rec ROW(var SMALLINT(10)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1206,7 +1206,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(10) DEFAULT NULL, `rec.var` smallint(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var SMALLINT(11); DECLARE rec ROW(var SMALLINT(11)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1216,7 +1216,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(11) DEFAULT NULL, `rec.var` smallint(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var SMALLINT(12); DECLARE rec ROW(var SMALLINT(12)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1226,7 +1226,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(12) DEFAULT NULL, `rec.var` smallint(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var SMALLINT(13); DECLARE rec ROW(var SMALLINT(13)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1236,7 +1236,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(13) DEFAULT NULL, `rec.var` smallint(13) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var SMALLINT(14); DECLARE rec ROW(var SMALLINT(14)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1246,7 +1246,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(14) DEFAULT NULL, `rec.var` smallint(14) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var SMALLINT(20); DECLARE rec ROW(var SMALLINT(20)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1256,7 +1256,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(20) DEFAULT NULL, `rec.var` smallint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var SMALLINT(21); DECLARE rec ROW(var SMALLINT(21)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1266,7 +1266,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` smallint(21) DEFAULT NULL, `rec.var` smallint(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -1279,7 +1279,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(9) DEFAULT NULL, `rec.var` mediumint(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMINT(1); DECLARE rec ROW(var MEDIUMINT(1)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1289,7 +1289,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(8) DEFAULT NULL, `rec.var` mediumint(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMINT(2); DECLARE rec ROW(var MEDIUMINT(2)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1299,7 +1299,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(8) DEFAULT NULL, `rec.var` mediumint(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMINT(3); DECLARE rec ROW(var MEDIUMINT(3)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1309,7 +1309,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(8) DEFAULT NULL, `rec.var` mediumint(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMINT(4); DECLARE rec ROW(var MEDIUMINT(4)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1319,7 +1319,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(8) DEFAULT NULL, `rec.var` mediumint(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMINT(5); DECLARE rec ROW(var MEDIUMINT(5)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1329,7 +1329,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(8) DEFAULT NULL, `rec.var` mediumint(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMINT(6); DECLARE rec ROW(var MEDIUMINT(6)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1339,7 +1339,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(8) DEFAULT NULL, `rec.var` mediumint(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMINT(7); DECLARE rec ROW(var MEDIUMINT(7)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1349,7 +1349,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(8) DEFAULT NULL, `rec.var` mediumint(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMINT(8); DECLARE rec ROW(var MEDIUMINT(8)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1359,7 +1359,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(8) DEFAULT NULL, `rec.var` mediumint(8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMINT(9); DECLARE rec ROW(var MEDIUMINT(9)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1369,7 +1369,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(9) DEFAULT NULL, `rec.var` mediumint(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMINT(10); DECLARE rec ROW(var MEDIUMINT(10)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1379,7 +1379,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(10) DEFAULT NULL, `rec.var` mediumint(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMINT(11); DECLARE rec ROW(var MEDIUMINT(11)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1389,7 +1389,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(11) DEFAULT NULL, `rec.var` mediumint(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMINT(12); DECLARE rec ROW(var MEDIUMINT(12)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1399,7 +1399,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(12) DEFAULT NULL, `rec.var` mediumint(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMINT(13); DECLARE rec ROW(var MEDIUMINT(13)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1409,7 +1409,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(13) DEFAULT NULL, `rec.var` mediumint(13) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMINT(14); DECLARE rec ROW(var MEDIUMINT(14)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1419,7 +1419,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(14) DEFAULT NULL, `rec.var` mediumint(14) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMINT(20); DECLARE rec ROW(var MEDIUMINT(20)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1429,7 +1429,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(20) DEFAULT NULL, `rec.var` mediumint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMINT(21); DECLARE rec ROW(var MEDIUMINT(21)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1439,7 +1439,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumint(21) DEFAULT NULL, `rec.var` mediumint(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -1452,7 +1452,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(20) DEFAULT NULL, `rec.var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BIGINT(1); DECLARE rec ROW(var BIGINT(1)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1462,7 +1462,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(20) DEFAULT NULL, `rec.var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BIGINT(2); DECLARE rec ROW(var BIGINT(2)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1472,7 +1472,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(20) DEFAULT NULL, `rec.var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BIGINT(3); DECLARE rec ROW(var BIGINT(3)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1482,7 +1482,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(20) DEFAULT NULL, `rec.var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BIGINT(4); DECLARE rec ROW(var BIGINT(4)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1492,7 +1492,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(20) DEFAULT NULL, `rec.var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BIGINT(5); DECLARE rec ROW(var BIGINT(5)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1502,7 +1502,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(20) DEFAULT NULL, `rec.var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BIGINT(6); DECLARE rec ROW(var BIGINT(6)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1512,7 +1512,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(20) DEFAULT NULL, `rec.var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BIGINT(7); DECLARE rec ROW(var BIGINT(7)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1522,7 +1522,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(20) DEFAULT NULL, `rec.var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BIGINT(8); DECLARE rec ROW(var BIGINT(8)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1532,7 +1532,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(20) DEFAULT NULL, `rec.var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BIGINT(9); DECLARE rec ROW(var BIGINT(9)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1542,7 +1542,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(20) DEFAULT NULL, `rec.var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BIGINT(10); DECLARE rec ROW(var BIGINT(10)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1552,7 +1552,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(20) DEFAULT NULL, `rec.var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BIGINT(11); DECLARE rec ROW(var BIGINT(11)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1562,7 +1562,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(20) DEFAULT NULL, `rec.var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BIGINT(12); DECLARE rec ROW(var BIGINT(12)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1572,7 +1572,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(20) DEFAULT NULL, `rec.var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BIGINT(13); DECLARE rec ROW(var BIGINT(13)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1582,7 +1582,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(20) DEFAULT NULL, `rec.var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BIGINT(14); DECLARE rec ROW(var BIGINT(14)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1592,7 +1592,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(20) DEFAULT NULL, `rec.var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BIGINT(20); DECLARE rec ROW(var BIGINT(20)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1602,7 +1602,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(20) DEFAULT NULL, `rec.var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BIGINT(21); DECLARE rec ROW(var BIGINT(21)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1612,7 +1612,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` bigint(21) DEFAULT NULL, `rec.var` bigint(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -1625,7 +1625,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double DEFAULT NULL, `rec.var` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DOUBLE(30,1); DECLARE rec ROW(var DOUBLE(30,1)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1635,7 +1635,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double(30,1) DEFAULT NULL, `rec.var` double(30,1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DOUBLE(30,2); DECLARE rec ROW(var DOUBLE(30,2)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1645,7 +1645,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double(30,2) DEFAULT NULL, `rec.var` double(30,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DOUBLE(30,3); DECLARE rec ROW(var DOUBLE(30,3)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1655,7 +1655,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double(30,3) DEFAULT NULL, `rec.var` double(30,3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DOUBLE(30,4); DECLARE rec ROW(var DOUBLE(30,4)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1665,7 +1665,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double(30,4) DEFAULT NULL, `rec.var` double(30,4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DOUBLE(30,5); DECLARE rec ROW(var DOUBLE(30,5)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1675,7 +1675,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double(30,5) DEFAULT NULL, `rec.var` double(30,5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DOUBLE(30,6); DECLARE rec ROW(var DOUBLE(30,6)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1685,7 +1685,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double(30,6) DEFAULT NULL, `rec.var` double(30,6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DOUBLE(30,7); DECLARE rec ROW(var DOUBLE(30,7)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1695,7 +1695,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double(30,7) DEFAULT NULL, `rec.var` double(30,7) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DOUBLE(30,8); DECLARE rec ROW(var DOUBLE(30,8)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1705,7 +1705,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double(30,8) DEFAULT NULL, `rec.var` double(30,8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DOUBLE(30,9); DECLARE rec ROW(var DOUBLE(30,9)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1715,7 +1715,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double(30,9) DEFAULT NULL, `rec.var` double(30,9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DOUBLE(30,10); DECLARE rec ROW(var DOUBLE(30,10)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1725,7 +1725,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double(30,10) DEFAULT NULL, `rec.var` double(30,10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DOUBLE(30,11); DECLARE rec ROW(var DOUBLE(30,11)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1735,7 +1735,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double(30,11) DEFAULT NULL, `rec.var` double(30,11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DOUBLE(30,12); DECLARE rec ROW(var DOUBLE(30,12)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1745,7 +1745,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double(30,12) DEFAULT NULL, `rec.var` double(30,12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DOUBLE(30,13); DECLARE rec ROW(var DOUBLE(30,13)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1755,7 +1755,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double(30,13) DEFAULT NULL, `rec.var` double(30,13) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DOUBLE(30,14); DECLARE rec ROW(var DOUBLE(30,14)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1765,7 +1765,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double(30,14) DEFAULT NULL, `rec.var` double(30,14) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DOUBLE(30,20); DECLARE rec ROW(var DOUBLE(30,20)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1775,7 +1775,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double(30,20) DEFAULT NULL, `rec.var` double(30,20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DOUBLE(30,21); DECLARE rec ROW(var DOUBLE(30,21)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1785,7 +1785,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` double(30,21) DEFAULT NULL, `rec.var` double(30,21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -1798,7 +1798,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` char(1) DEFAULT NULL, `rec.var` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BINARY; DECLARE rec ROW(var BINARY); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1808,7 +1808,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` binary(1) DEFAULT NULL, `rec.var` binary(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var CHAR(1); DECLARE rec ROW(var CHAR(1)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1818,7 +1818,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` char(1) DEFAULT NULL, `rec.var` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var CHAR(10); DECLARE rec ROW(var CHAR(10)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1828,7 +1828,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` char(10) DEFAULT NULL, `rec.var` char(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var NCHAR(10); DECLARE rec ROW(var NCHAR(10)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1836,9 +1836,9 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `var` char(10) CHARACTER SET utf8mb3 DEFAULT NULL, - `rec.var` char(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `var` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `rec.var` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var BINARY(10); DECLARE rec ROW(var BINARY(10)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1848,7 +1848,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` binary(10) DEFAULT NULL, `rec.var` binary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var VARBINARY(10); DECLARE rec ROW(var VARBINARY(10)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1858,7 +1858,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` varbinary(10) DEFAULT NULL, `rec.var` varbinary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var VARCHAR(10); DECLARE rec ROW(var VARCHAR(10)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1868,7 +1868,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` varchar(10) DEFAULT NULL, `rec.var` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var VARCHAR(10) CHARACTER SET utf8; DECLARE rec ROW(var VARCHAR(10) CHARACTER SET utf8); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1876,9 +1876,9 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `var` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL, - `rec.var` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `var` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `rec.var` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin; DECLARE rec ROW(var VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1888,7 +1888,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `rec.var` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -1901,7 +1901,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` time DEFAULT NULL, `rec.var` time DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TIME(1); DECLARE rec ROW(var TIME(1)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1911,7 +1911,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` time(1) DEFAULT NULL, `rec.var` time(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TIME(2); DECLARE rec ROW(var TIME(2)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1921,7 +1921,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` time(2) DEFAULT NULL, `rec.var` time(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TIME(3); DECLARE rec ROW(var TIME(3)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1931,7 +1931,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` time(3) DEFAULT NULL, `rec.var` time(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TIME(4); DECLARE rec ROW(var TIME(4)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1941,7 +1941,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` time(4) DEFAULT NULL, `rec.var` time(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TIME(5); DECLARE rec ROW(var TIME(5)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1951,7 +1951,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` time(5) DEFAULT NULL, `rec.var` time(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TIME(6); DECLARE rec ROW(var TIME(6)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1961,7 +1961,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` time(6) DEFAULT NULL, `rec.var` time(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -1974,7 +1974,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` datetime DEFAULT NULL, `rec.var` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DATETIME(1); DECLARE rec ROW(var DATETIME(1)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1984,7 +1984,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` datetime(1) DEFAULT NULL, `rec.var` datetime(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DATETIME(2); DECLARE rec ROW(var DATETIME(2)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -1994,7 +1994,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` datetime(2) DEFAULT NULL, `rec.var` datetime(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DATETIME(3); DECLARE rec ROW(var DATETIME(3)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -2004,7 +2004,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` datetime(3) DEFAULT NULL, `rec.var` datetime(3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DATETIME(4); DECLARE rec ROW(var DATETIME(4)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -2014,7 +2014,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` datetime(4) DEFAULT NULL, `rec.var` datetime(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DATETIME(5); DECLARE rec ROW(var DATETIME(5)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -2024,7 +2024,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` datetime(5) DEFAULT NULL, `rec.var` datetime(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var DATETIME(6); DECLARE rec ROW(var DATETIME(6)); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -2034,7 +2034,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` datetime(6) DEFAULT NULL, `rec.var` datetime(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -2047,7 +2047,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` text DEFAULT NULL, `rec.var` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYTEXT; DECLARE rec ROW(var TINYTEXT); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -2057,7 +2057,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` tinytext DEFAULT NULL, `rec.var` tinytext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMTEXT; DECLARE rec ROW(var MEDIUMTEXT); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -2067,7 +2067,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` mediumtext DEFAULT NULL, `rec.var` mediumtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var LONGTEXT; DECLARE rec ROW(var LONGTEXT); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -2077,7 +2077,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `var` longtext DEFAULT NULL, `rec.var` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TEXT CHARACTER SET utf8; DECLARE rec ROW(var TEXT CHARACTER SET utf8); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -2085,9 +2085,9 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `var` text CHARACTER SET utf8mb3 DEFAULT NULL, - `rec.var` text CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `var` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `rec.var` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var TINYTEXT CHARACTER SET utf8; DECLARE rec ROW(var TINYTEXT CHARACTER SET utf8); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -2095,9 +2095,9 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `var` tinytext CHARACTER SET utf8mb3 DEFAULT NULL, - `rec.var` tinytext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `var` tinytext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `rec.var` tinytext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var MEDIUMTEXT CHARACTER SET utf8; DECLARE rec ROW(var MEDIUMTEXT CHARACTER SET utf8); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -2105,9 +2105,9 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `var` mediumtext CHARACTER SET utf8mb3 DEFAULT NULL, - `rec.var` mediumtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `var` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `rec.var` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN DECLARE var LONGTEXT CHARACTER SET utf8; DECLARE rec ROW(var LONGTEXT CHARACTER SET utf8); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END; @@ -2115,9 +2115,9 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `var` longtext CHARACTER SET utf8mb3 DEFAULT NULL, - `rec.var` longtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `var` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `rec.var` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; # @@ -2282,12 +2282,12 @@ Table Create Table t1 CREATE TABLE `t1` ( `int11` int(11) DEFAULT NULL, `text1` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Table Create Table t1 CREATE TABLE `t1` ( `int11` int(11) DEFAULT NULL, `text1` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # # MDEV-16385 ROW SP variable is allowed in unexpected context # diff --git a/mysql-test/main/sp-row.test b/mysql-test/main/sp-row.test index 527ff9455bd65..c49ea293bfed6 100644 --- a/mysql-test/main/sp-row.test +++ b/mysql-test/main/sp-row.test @@ -27,7 +27,7 @@ BEGIN END; $$ DELIMITER ;$$ ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT f1(ROW(10,20)); DROP FUNCTION f1; @@ -307,7 +307,7 @@ BEGIN END; $$ DELIMITER ;$$ ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION CALL p1(); DROP PROCEDURE p1; DROP FUNCTION f1; @@ -393,7 +393,7 @@ BEGIN END; $$ DELIMITER ;$$ ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT f1(10); DROP FUNCTION f1; diff --git a/mysql-test/main/sp-security-anchor-type.result b/mysql-test/main/sp-security-anchor-type.result index 4ee846f9f2ef1..12e3c0fa24e02 100644 --- a/mysql-test/main/sp-security-anchor-type.result +++ b/mysql-test/main/sp-security-anchor-type.result @@ -21,9 +21,9 @@ user1@localhost # Making sure that user1 does not have privileges to db1.t1 # SHOW CREATE TABLE db1.t1; -ERROR 42000: SHOW command denied to user 'user1'@'localhost' for table 't1' +ERROR 42000: SHOW command denied to user 'user1'@'localhost' for table `db1`.`t1` SHOW FIELDS IN db1.t1; -ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table `db1`.`t1` # # Trigger: using TYPE OF with a table we don't have access to # @@ -39,7 +39,7 @@ SET NEW.b = 10; END $$ INSERT INTO t1 (a) VALUES (10); -ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table `db1`.`t1` SELECT * FROM t1; a b 10 20 @@ -56,7 +56,7 @@ SELECT a; END; $$ CALL p1; -ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table `db1`.`t1` DROP PROCEDURE p1; # # Stored procedure: Using TYPE OF for with a table that we don't have access to @@ -72,7 +72,7 @@ END; $$ connection conn1; CALL p1; -ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table `db1`.`t1` DROP PROCEDURE p1; connection default; CREATE PROCEDURE p1() @@ -84,7 +84,7 @@ END; $$ connection conn1; CALL p1; -ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table `db1`.`t1` DROP PROCEDURE p1; # # Stored procedure: Using TYPE OF for with a table that we don't have access to @@ -129,7 +129,7 @@ RETURN OCTET_LENGTH(a); END; $$ SELECT f1(); -ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table `db1`.`t1` DROP FUNCTION f1; DROP TABLE t1; # @@ -147,7 +147,7 @@ END; $$ connection conn1; SELECT f1(); -ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table `db1`.`t1` DROP FUNCTION f1; DROP TABLE t1; # @@ -176,7 +176,7 @@ connection conn1; # Making sure that user1 has access to db1.t1.a, but not to db1.t1.b # SHOW CREATE TABLE db1.t1; -ERROR 42000: SHOW command denied to user 'user1'@'localhost' for table 't1' +ERROR 42000: SHOW command denied to user 'user1'@'localhost' for table `db1`.`t1` SHOW FIELDS IN db1.t1; Field Type Null Key Default Extra a int(11) YES NULL diff --git a/mysql-test/main/sp-security-anchor-type.test b/mysql-test/main/sp-security-anchor-type.test index e61d5e3805269..1aefa724f67a3 100644 --- a/mysql-test/main/sp-security-anchor-type.test +++ b/mysql-test/main/sp-security-anchor-type.test @@ -89,6 +89,7 @@ DROP PROCEDURE p1; --echo # DEFINER root, SQL SECURITY INVOKER --echo # +--disable_service_connection connection default; DELIMITER $$; CREATE PROCEDURE p1() @@ -160,7 +161,7 @@ DROP PROCEDURE p1; --echo # Stored function: Using TYPE OF for with a table that we don't have access to --echo # DEFINER user1, SQL SECURITY DEFAULT --echo # - +--disable_view_protocol CREATE TABLE t1 (a INT); DELIMITER $$; CREATE FUNCTION f1() RETURNS INT @@ -197,7 +198,7 @@ connection conn1; SELECT f1(); DROP FUNCTION f1; DROP TABLE t1; - +--enable_view_protocol --echo # --echo # Stored function: Using TYPE OF for with a table that we don't have access to @@ -269,7 +270,7 @@ INSERT INTO t1 (a) VALUES (10); SELECT * FROM t1; DROP TRIGGER tr1; DROP TABLE t1; - +--enable_service_connection --echo # diff --git a/mysql-test/main/sp-security.result b/mysql-test/main/sp-security.result index 2571f9d8696b2..5c62a95b34ab3 100644 --- a/mysql-test/main/sp-security.result +++ b/mysql-test/main/sp-security.result @@ -50,7 +50,7 @@ select db1_secret.db(); db1_secret.db() test select * from db1_secret.t1; -ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table `db1_secret`.`t1` create procedure db1_secret.dummy() begin end; ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret' drop procedure db1_secret.dummy; @@ -65,7 +65,7 @@ select db1_secret.db(); db1_secret.db() test select * from db1_secret.t1; -ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user ''@'localhost' for table `db1_secret`.`t1` create procedure db1_secret.dummy() begin end; ERROR 42000: Access denied for user ''@'%' to database 'db1_secret' drop procedure db1_secret.dummy; @@ -102,14 +102,14 @@ db() test connection con2user1; call db1_secret.stamp(5); -ERROR 42000: INSERT command denied to user 'user1'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'user1'@'localhost' for table `db1_secret`.`t1` select db1_secret.db(); -ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table `db1_secret`.`t1` connection con3anon; call db1_secret.stamp(6); -ERROR 42000: INSERT command denied to user ''@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user ''@'localhost' for table `db1_secret`.`t1` select db1_secret.db(); -ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user ''@'localhost' for table `db1_secret`.`t1` connection con1root; drop database if exists db2; create database db2; @@ -127,7 +127,7 @@ connection con2user1; use db2; create procedure p () insert into t2 values (1); call p(); -ERROR 42000: INSERT command denied to user 'user1'@'localhost' for table 't2' +ERROR 42000: INSERT command denied to user 'user1'@'localhost' for table `db2`.`t2` connect con4user2,localhost,user2,,; connection con4user2; use db2; @@ -405,9 +405,9 @@ id int(11) YES NULL call db_bug14533.bug14533_2(); id desc db_bug14533.t1; -ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table `db_bug14533`.`t1` select * from db_bug14533.t1; -ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table `db_bug14533`.`t1` connection default; disconnect user_bug14533; drop user user_bug14533@localhost; @@ -567,24 +567,24 @@ END| CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT f_evil(); connect conn1, localhost, mysqltest_u1,,; SELECT COUNT(*) FROM t1; -ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table `test`.`t1` SELECT f_evil(); -ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table `test`.`t1` SELECT @a, @b; @a @b mysqltest_u1@localhost NULL SELECT f_suid(f_evil()); -ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table `test`.`t1` SELECT @a, @b; @a @b mysqltest_u1@localhost NULL CALL p_suid(f_evil()); -ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table `test`.`t1` SELECT @a, @b; @a @b mysqltest_u1@localhost NULL SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table `test`.`v1` SELECT @a, @b; @a @b mysqltest_u1@localhost NULL @@ -659,7 +659,9 @@ USE test; DROP USER 'tester'; DROP USER 'Tester'; DROP DATABASE B48872; -End of 5.0 tests. +# +# End of 5.0 tests. +# # # Test for bug#57061 "User without privilege on routine can discover # its existence." @@ -804,7 +806,7 @@ DROP DATABASE u1; DROP USER u1@localhost; set @@global.character_set_server=@save_character_set_server; # -# Start of 10.5 tests +# End of 10.2 tests # # # MDEV-20366 Server crashes in get_current_user upon SET PASSWORD via SP @@ -821,3 +823,17 @@ DROP USER foo@localhost; # # End of 10.5 tests # +# +# MDEV-29852 SIGSEGV in mysql_create_routine or is_acl_user on 2nd execution, ASAN use-after-poison in get_current_user (sql_acl.cc) +# +set @cmd:="create definer=u function f(i int) returns char binary reads sql data return concat (1,i)"; +prepare s from @cmd; +execute s; +Warnings: +Note 1449 The user specified as a definer ('u'@'%') does not exist +execute s; +ERROR 42000: FUNCTION f already exists +drop function f; +# +# End of 10.6 tests +# diff --git a/mysql-test/main/sp-security.test b/mysql-test/main/sp-security.test index e11e8911b60e0..13fdbd68a5527 100644 --- a/mysql-test/main/sp-security.test +++ b/mysql-test/main/sp-security.test @@ -911,8 +911,9 @@ DROP USER 'tester'; DROP USER 'Tester'; DROP DATABASE B48872; ---echo End of 5.0 tests. - +--echo # +--echo # End of 5.0 tests. +--echo # --echo # --echo # Test for bug#57061 "User without privilege on routine can discover @@ -1080,9 +1081,8 @@ DROP USER u1@localhost; set @@global.character_set_server=@save_character_set_server; - --echo # ---echo # Start of 10.5 tests +--echo # End of 10.2 tests --echo # --echo # @@ -1102,7 +1102,20 @@ CALL p1(); DROP PROCEDURE p1; DROP USER foo@localhost; - --echo # --echo # End of 10.5 tests --echo # + +--echo # +--echo # MDEV-29852 SIGSEGV in mysql_create_routine or is_acl_user on 2nd execution, ASAN use-after-poison in get_current_user (sql_acl.cc) +--echo # +set @cmd:="create definer=u function f(i int) returns char binary reads sql data return concat (1,i)"; +prepare s from @cmd; +execute s; +--error ER_SP_ALREADY_EXISTS +execute s; +drop function f; + +--echo # +--echo # End of 10.6 tests +--echo # diff --git a/mysql-test/main/sp-ucs2.result b/mysql-test/main/sp-ucs2.result index c1ca89c9150aa..912a45b1b4d1c 100644 --- a/mysql-test/main/sp-ucs2.result +++ b/mysql-test/main/sp-ucs2.result @@ -120,7 +120,7 @@ RETURNS ENUM( 'w' ) CHARACTER SET ucs2 RETURN 0; SHOW CREATE FUNCTION bug48766; Function sql_mode Create Function character_set_client collation_connection Database Collation -bug48766 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `bug48766`() RETURNS enum('w') CHARSET ucs2 +bug48766 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `bug48766`() RETURNS enum('w') CHARSET ucs2 COLLATE ucs2_general_ci RETURN 0 utf8mb3 utf8mb3_general_ci latin1_swedish_ci SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME='bug48766'; @@ -132,7 +132,7 @@ RETURNS ENUM('а','б','в','г') CHARACTER SET ucs2 RETURN 0; SHOW CREATE FUNCTION bug48766; Function sql_mode Create Function character_set_client collation_connection Database Collation -bug48766 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `bug48766`() RETURNS enum('а','б','в','г') CHARSET ucs2 +bug48766 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `bug48766`() RETURNS enum('а','б','в','г') CHARSET ucs2 COLLATE ucs2_general_ci RETURN 0 utf8mb3 utf8mb3_general_ci latin1_swedish_ci SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME='bug48766'; diff --git a/mysql-test/main/sp-vars.result b/mysql-test/main/sp-vars.result index de30156c60203..a5616b9e2319f 100644 --- a/mysql-test/main/sp-vars.result +++ b/mysql-test/main/sp-vars.result @@ -1026,11 +1026,11 @@ BEGIN SELECT arg; END| CALL p1((1, 2)); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Cannot cast 'row' as 'tinyint' in assignment of `arg` CALL p1((SELECT * FROM t1 LIMIT 1)); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Cannot cast 'row' as 'tinyint' in assignment of `arg` CALL p1((SELECT col1, col2 FROM t1 LIMIT 1)); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Cannot cast 'row' as 'tinyint' in assignment of `arg` DROP PROCEDURE p1; DROP TABLE t1; @@ -1252,7 +1252,7 @@ $$ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE "t1" ( - "var" tinytext CHARACTER SET utf8mb3 DEFAULT NULL + "var" tinytext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL ) DROP TABLE t1; BEGIN NOT ATOMIC @@ -1263,7 +1263,7 @@ $$ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE "t1" ( - "var" text CHARACTER SET utf8mb3 DEFAULT NULL + "var" text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL ) DROP TABLE t1; BEGIN NOT ATOMIC @@ -1274,7 +1274,7 @@ $$ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE "t1" ( - "var" mediumtext CHARACTER SET utf8mb3 DEFAULT NULL + "var" mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL ) DROP TABLE t1; BEGIN NOT ATOMIC @@ -1285,7 +1285,7 @@ $$ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE "t1" ( - "var" longtext CHARACTER SET utf8mb3 DEFAULT NULL + "var" longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL ) DROP TABLE t1; BEGIN NOT ATOMIC @@ -1307,7 +1307,7 @@ $$ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE "t1" ( - "var" char(1) DEFAULT NULL + "var" varchar(1) DEFAULT NULL ) DROP TABLE t1; # diff --git a/mysql-test/main/sp-vars.test b/mysql-test/main/sp-vars.test index 9edf245acbebc..5e1e07888cac5 100644 --- a/mysql-test/main/sp-vars.test +++ b/mysql-test/main/sp-vars.test @@ -1221,13 +1221,13 @@ BEGIN END| delimiter ;| ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION CALL p1((1, 2)); ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION CALL p1((SELECT * FROM t1 LIMIT 1)); ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION CALL p1((SELECT col1, col2 FROM t1 LIMIT 1)); # diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result index 21cc7c7b78f25..37c22e45b451f 100644 --- a/mysql-test/main/sp.result +++ b/mysql-test/main/sp.result @@ -255,7 +255,7 @@ return i+1| call sub1("sub1a", (select 7))| call sub1("sub1b", (select max(i) from t2))| call sub1("sub1c", (select i,d from t2 limit 1))| -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Cannot cast 'row' as 'int' in assignment of `x` call sub1("sub1d", (select 1 from (select 1) a))| call sub2("sub2")| select * from t1 order by id| @@ -2347,7 +2347,7 @@ show create table t3| Table Create Table t3 CREATE TABLE `t3` ( `bug2773()` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t3| drop function bug2773| drop procedure if exists bug3788| @@ -2406,9 +2406,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` char(16) NOT NULL DEFAULT '', `data` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Database Create Database -test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ +test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ Database (foo) Level Code Message Field Type Null Key Default Extra @@ -2427,9 +2427,9 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` char(16) NOT NULL DEFAULT '', `data` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Database Create Database -test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ +test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ Database (foo) Level Code Message Field Type Null Key Default Extra @@ -3759,17 +3759,17 @@ call bug12589_1()| Table Create Table tm1 CREATE TEMPORARY TABLE `tm1` ( `spv1` decimal(3,3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci call bug12589_2()| Table Create Table tm1 CREATE TEMPORARY TABLE `tm1` ( `spv1` decimal(6,3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci call bug12589_3()| Table Create Table tm1 CREATE TEMPORARY TABLE `tm1` ( `spv1` decimal(6,3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop procedure bug12589_1| drop procedure bug12589_2| drop procedure bug12589_3| @@ -4806,7 +4806,7 @@ show create table t3| Table Create Table t3 CREATE TABLE `t3` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t3| i 0 @@ -4817,7 +4817,7 @@ show create table t3| Table Create Table t3 CREATE TABLE `t3` ( `j` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t3| j 0 @@ -4915,19 +4915,19 @@ use mysqltest1| call p1()| show create database mysqltest1| Database Create Database -mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET koi8r */ +mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET koi8r COLLATE koi8r_general_ci */ show create database mysqltest2| Database Create Database -mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET utf8mb3 */ +mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */ alter database mysqltest1 character set utf8| use mysqltest2| call mysqltest1.p1()| show create database mysqltest1| Database Create Database -mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET koi8r */ +mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET koi8r COLLATE koi8r_general_ci */ show create database mysqltest2| Database Create Database -mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET utf8mb3 */ +mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */ drop database mysqltest1| drop database mysqltest2| use test| @@ -4979,19 +4979,19 @@ CREATE FUNCTION mysqltest2.bug16211_f4() RETURNS CHAR(10) CHARSET koi8r RETURN ""| SHOW CREATE FUNCTION bug16211_f1| Function sql_mode Create Function character_set_client collation_connection Database Collation -bug16211_f1 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f1`() RETURNS char(10) CHARSET utf8mb3 +bug16211_f1 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f1`() RETURNS char(10) CHARSET utf8mb3 COLLATE utf8mb3_general_ci RETURN "" latin1 latin1_swedish_ci utf8mb3_general_ci SHOW CREATE FUNCTION bug16211_f2| Function sql_mode Create Function character_set_client collation_connection Database Collation -bug16211_f2 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f2`() RETURNS char(10) CHARSET koi8r +bug16211_f2 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f2`() RETURNS char(10) CHARSET koi8r COLLATE koi8r_general_ci RETURN "" latin1 latin1_swedish_ci utf8mb3_general_ci SHOW CREATE FUNCTION mysqltest2.bug16211_f3| Function sql_mode Create Function character_set_client collation_connection Database Collation -bug16211_f3 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f3`() RETURNS char(10) CHARSET utf8mb3 +bug16211_f3 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f3`() RETURNS char(10) CHARSET utf8mb3 COLLATE utf8mb3_general_ci RETURN "" latin1 latin1_swedish_ci utf8mb3_general_ci SHOW CREATE FUNCTION mysqltest2.bug16211_f4| Function sql_mode Create Function character_set_client collation_connection Database Collation -bug16211_f4 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f4`() RETURNS char(10) CHARSET koi8r +bug16211_f4 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f4`() RETURNS char(10) CHARSET koi8r COLLATE koi8r_general_ci RETURN "" latin1 latin1_swedish_ci utf8mb3_general_ci SELECT dtd_identifier FROM INFORMATION_SCHEMA.ROUTINES @@ -5029,19 +5029,19 @@ ALTER DATABASE mysqltest1 CHARACTER SET cp1251| ALTER DATABASE mysqltest2 CHARACTER SET cp1251| SHOW CREATE FUNCTION bug16211_f1| Function sql_mode Create Function character_set_client collation_connection Database Collation -bug16211_f1 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f1`() RETURNS char(10) CHARSET utf8mb3 +bug16211_f1 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f1`() RETURNS char(10) CHARSET utf8mb3 COLLATE utf8mb3_general_ci RETURN "" latin1 latin1_swedish_ci utf8mb3_general_ci SHOW CREATE FUNCTION bug16211_f2| Function sql_mode Create Function character_set_client collation_connection Database Collation -bug16211_f2 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f2`() RETURNS char(10) CHARSET koi8r +bug16211_f2 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f2`() RETURNS char(10) CHARSET koi8r COLLATE koi8r_general_ci RETURN "" latin1 latin1_swedish_ci utf8mb3_general_ci SHOW CREATE FUNCTION mysqltest2.bug16211_f3| Function sql_mode Create Function character_set_client collation_connection Database Collation -bug16211_f3 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f3`() RETURNS char(10) CHARSET utf8mb3 +bug16211_f3 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f3`() RETURNS char(10) CHARSET utf8mb3 COLLATE utf8mb3_general_ci RETURN "" latin1 latin1_swedish_ci utf8mb3_general_ci SHOW CREATE FUNCTION mysqltest2.bug16211_f4| Function sql_mode Create Function character_set_client collation_connection Database Collation -bug16211_f4 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f4`() RETURNS char(10) CHARSET koi8r +bug16211_f4 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f4`() RETURNS char(10) CHARSET koi8r COLLATE koi8r_general_ci RETURN "" latin1 latin1_swedish_ci utf8mb3_general_ci SELECT dtd_identifier FROM INFORMATION_SCHEMA.ROUTINES @@ -6068,7 +6068,7 @@ examplebug20777 CREATE TABLE `examplebug20777` ( `2**64-2` bigint(20) unsigned DEFAULT NULL, `2**64-1` bigint(20) unsigned DEFAULT NULL, `2**64` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from examplebug20777 order by i; i 2**63-2 2**63-1 2**63 2**63+1 2**64-2 2**64-1 2**64 0 9223372036854775806 9223372036854775807 9223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 18446744073709551615 @@ -6432,7 +6432,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `v` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; @@ -6443,7 +6443,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `v` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; @@ -6452,7 +6452,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `v` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; @@ -6463,7 +6463,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `v` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; @@ -6871,7 +6871,7 @@ Another_very_long_enum_element_identifier SHOW CREATE FUNCTION f1; Function sql_mode Create Function character_set_client collation_connection Database Collation -f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(p INT) RETURNS enum('Very_long_enum_element_identifier','Another_very_long_enum_element_identifier') CHARSET latin1 +f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(p INT) RETURNS enum('Very_long_enum_element_identifier','Another_very_long_enum_element_identifier') CHARSET latin1 COLLATE latin1_swedish_ci BEGIN CASE p WHEN 1 THEN @@ -8478,6 +8478,34 @@ b-c 0 drop procedure p1| drop function f1| +# +# MDEV-24827: MariaDB 10.5.5 crash (sig 11) during a SELECT +# +CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT); +CREATE TABLE t2 (c1 INT PRIMARY KEY, c2 INT, KEY idx_c2(c2)); +INSERT INTO t1 (c1, c2) SELECT seq, seq FROM seq_1_to_10000; +INSERT INTO t2 (c1, c2) SELECT seq, seq FROM seq_1_to_20000; +CREATE OR REPLACE PROCEDURE p1() +begin +DECLARE done INT DEFAULT FALSE; +DECLARE a INT; +DECLARE cur1 CURSOR FOR +SELECT t2.c1 AS c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 +WHERE EXISTS (SELECT 1 FROM t1 WHERE c2 = -1) ORDER BY c1; +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; +OPEN cur1; +read_loop: LOOP +FETCH cur1 INTO a; +IF done THEN +LEAVE read_loop; +END IF; +END LOOP; +CLOSE cur1; +END $ +CALL p1(); +DROP PROCEDURE p1; +DROP TABLE t1; +DROP TABLE t2; #End of 10.2 tests # # MDEV-12007 Allow ROW variables as a cursor FETCH target @@ -8669,11 +8697,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.000000' +ERROR 22007: Truncated incorrect DECIMAL 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.000000' +ERROR 22007: Truncated incorrect DECIMAL 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.000000' +ERROR 22007: Truncated incorrect DECIMAL value: '2001-01-01 10:20:30.000000' DROP FUNCTION f1; DROP FUNCTION f2; DROP FUNCTION f3; @@ -8716,7 +8744,7 @@ t2 CREATE TABLE `t2` ( `c1` varchar(11) DEFAULT NULL, `c2` varchar(11) DEFAULT NULL, `c3` varchar(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; DROP FUNCTION f1; CREATE FUNCTION f1() RETURNS TINYTEXT CHARACTER SET latin1 RETURN ''; @@ -8727,7 +8755,7 @@ t1 CREATE TABLE `t1` ( `c1` tinytext DEFAULT NULL, `c2` tinytext DEFAULT NULL, `c3` varchar(255) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION f1; CREATE FUNCTION f1() RETURNS TEXT CHARACTER SET latin1 RETURN ''; @@ -8738,7 +8766,7 @@ t1 CREATE TABLE `t1` ( `c1` text DEFAULT NULL, `c2` text DEFAULT NULL, `c3` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION f1; CREATE FUNCTION f1() RETURNS MEDIUMTEXT CHARACTER SET latin1 RETURN ''; @@ -8749,7 +8777,7 @@ t1 CREATE TABLE `t1` ( `c1` mediumtext DEFAULT NULL, `c2` mediumtext DEFAULT NULL, `c3` mediumtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION f1; CREATE FUNCTION f1() RETURNS LONGTEXT CHARACTER SET latin1 RETURN ''; @@ -8760,7 +8788,7 @@ t1 CREATE TABLE `t1` ( `c1` longtext DEFAULT NULL, `c2` longtext DEFAULT NULL, `c3` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION f1; CREATE FUNCTION f1() RETURNS TINYTEXT CHARACTER SET utf8 RETURN ''; @@ -8768,10 +8796,10 @@ CREATE TABLE t1 AS SELECT f1() AS c1, COALESCE(f1()) AS c2, CONCAT(f1()) AS c3; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` tinytext CHARACTER SET utf8mb3 DEFAULT NULL, - `c2` text CHARACTER SET utf8mb3 DEFAULT NULL, - `c3` varchar(255) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` tinytext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c2` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c3` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION f1; CREATE FUNCTION f1() RETURNS TEXT CHARACTER SET utf8 RETURN ''; @@ -8779,10 +8807,10 @@ CREATE TABLE t1 AS SELECT f1() AS c1, COALESCE(f1()) AS c2, CONCAT(f1()) AS c3; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` text CHARACTER SET utf8mb3 DEFAULT NULL, - `c2` mediumtext CHARACTER SET utf8mb3 DEFAULT NULL, - `c3` mediumtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c2` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c3` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION f1; CREATE FUNCTION f1() RETURNS MEDIUMTEXT CHARACTER SET utf8 RETURN ''; @@ -8790,10 +8818,10 @@ CREATE TABLE t1 AS SELECT f1() AS c1, COALESCE(f1()) AS c2, CONCAT(f1()) AS c3; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` mediumtext CHARACTER SET utf8mb3 DEFAULT NULL, - `c2` longtext CHARACTER SET utf8mb3 DEFAULT NULL, - `c3` longtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c2` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c3` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION f1; CREATE FUNCTION f1() RETURNS LONGTEXT CHARACTER SET utf8 RETURN ''; @@ -8801,10 +8829,10 @@ CREATE TABLE t1 AS SELECT f1() AS c1, COALESCE(f1()) AS c2, CONCAT(f1()) AS c3; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` longtext CHARACTER SET utf8mb3 DEFAULT NULL, - `c2` longtext CHARACTER SET utf8mb3 DEFAULT NULL, - `c3` longtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c2` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c3` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION f1; # @@ -8854,7 +8882,7 @@ END; $$ SHOW CREATE FUNCTION f1; Function sql_mode Create Function character_set_client collation_connection Database Collation -f1 STRICT_ALL_TABLES CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS text COMPRESSED CHARSET latin1 +f1 STRICT_ALL_TABLES CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS text COMPRESSED CHARSET latin1 COLLATE latin1_swedish_ci BEGIN RETURN ''; END latin1 latin1_swedish_ci latin1_swedish_ci @@ -8869,6 +8897,19 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp BEGIN RETURN ''; END' at line 2 +# +# MDEV-28220: Assert failure in sp_head::~sp_head on parsing a syntax incorrect statement CREATE SEQUENCE ... RESTART inside CREATE PROCEDURE/CREATE FUNCTION + +# Specifying the RESTART clause for the statement CREATE SEQUENCE is a syntax error. +# Check that CREATE PROCEDURE doesn't crash server if the statement +# CREATE SEQUNCE ... RESTART is specified in its body. +# +CREATE PROCEDURE sp1() CREATE SEQUENCE s1 START WITH 300 INCREMENT BY 30 RESTART; +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 'RESTART' at line 1 +# CREATE SEQUNCE ... RESTART and CREATE SEQUNCE ... RESTART WITH ... are +# handled by different grammar rules, so check the both cases. +CREATE PROCEDURE sp1() CREATE SEQUENCE s1 START WITH 300 INCREMENT BY 30 RESTART WITH 100; +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 'RESTART' at line 1 # End of 10.3 tests # # Start of 10.4 tests @@ -8883,5 +8924,63 @@ END; $$ ERROR 42000: Incorrect usage/placement of 'HIGH_PRIORITY' # +# MDEV-21173: Assertion `m_thd == __null' failed in sp_head::~sp_head +# +CREATE TABLE t1 (a INT); +CREATE PROCEDURE p1() SELECT 1 FROM t1 PROCEDURE ANALYSE( 10, (SELECT a FROM t1)); +ERROR 42000: PROCEDURE does not support subqueries or stored functions +DROP TABLE t1; # End of 10.4 tests # +# +# MDEV-29129: Performance regression starting in 10.6: unlimited "select order by limit" +# +CREATE TABLE t1 ( +lookupId int primary key, +value varchar(255) +); +insert into t1 select seq, seq from seq_1_to_100; +# Note: the function is intentionally NOT declared as DETERMINISTIC +CREATE FUNCTION f1(LOOKUPID_IN INT) RETURNS varchar(255) CHARSET utf8 +BEGIN +DECLARE LOOKUP_VALUE VARCHAR(255); +SET LOOKUP_VALUE = (SELECT value FROM t1 WHERE lookupId = LOOKUPID_IN); +set @counter=@counter+1; +RETURN LOOKUP_VALUE; +END; +// +create table t2 ( +col1 int, +col2 int +); +insert into t2 select mod(seq,100), seq from seq_1_to_1000; +explain +select f1(col1) from t2 order by col2 desc limit 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 1000 Using filesort +set @counter=0; +select f1(col1) from t2 order by col2 desc limit 5; +f1(col1) +NULL +99 +98 +97 +96 +# Must show 5, not 1000: +select @counter; +@counter +5 +drop function f1; +drop table t1,t2; +# +# MDEV-28129: MariaDB UAF issue at lex_end_nops(LEX*) +# +CREATE PROCEDURE sp() SELECT 1 INTO @; +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 +CREATE PROCEDURE sp() SET @=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 '=1' at line 1 +CREATE PROCEDURE sp() SELECT @; +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 +# +# End of 10.7 tests +# diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test index 9265b97e7c9bf..2e3a492659e5b 100644 --- a/mysql-test/main/sp.test +++ b/mysql-test/main/sp.test @@ -1,4 +1,7 @@ +--source include/no_valgrind_without_big.inc --source include/have_partition.inc +--source include/have_sequence.inc + # # Basic stored PROCEDURE tests # @@ -384,7 +387,7 @@ create function sub3(i int) returns int deterministic call sub1("sub1a", (select 7))| call sub1("sub1b", (select max(i) from t2))| ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION call sub1("sub1c", (select i,d from t2 limit 1))| call sub1("sub1d", (select 1 from (select 1) a))| call sub2("sub2")| @@ -1304,6 +1307,8 @@ create function f1() returns int return (select sum(data) from t1)| # Let us also test some weird cases where no real tables is used +# enable after fix MDEV-28535 +--disable_view_protocol create function f0() returns int return (select * from (select 100) as r)| select f0()| @@ -1311,10 +1316,13 @@ select *, f0() from (select 1) as t| create view v0 as select f0()| select * from v0| select *, f0() from v0| +--enable_view_protocol # # Let us test how well prelocking works with explicit LOCK TABLES. # +#use disable/enable_service_connection after fix MDEV-28535 +--disable_service_connection lock tables t1 read, t1 as t11 read| # These should work well select f3()| @@ -1331,9 +1339,11 @@ select id, f3() from t1| --error ER_TABLE_NOT_LOCKED select f4()| unlock tables| +--enable_service_connection # Let us test how LOCK TABLES which implicitly depends on functions # works +--disable_service_connection lock tables v2 read, mysql.proc read| select * from v2| select * from v1| @@ -1343,6 +1353,7 @@ select * from v1, t1| --error ER_TABLE_NOT_LOCKED select f4()| unlock tables| +--enable_service_connection # Tests for handling of temporary tables in functions. # @@ -1366,6 +1377,7 @@ select f9()| select f9() from t1 limit 1| # Function which uses both temporary and permanent tables. +--disable_view_protocol create function f10() returns int begin drop temporary table if exists t3; @@ -1378,6 +1390,7 @@ end| select f10()| create table t4 as select 1 as id| select f10()| +--enable_view_protocol create function f11() returns int begin @@ -5996,6 +6009,7 @@ SHOW CREATE FUNCTION bug16211_f2| SHOW CREATE FUNCTION mysqltest2.bug16211_f3| SHOW CREATE FUNCTION mysqltest2.bug16211_f4| +--disable_service_connection SELECT dtd_identifier FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = "mysqltest1" AND ROUTINE_NAME = "bug16211_f1"| @@ -6011,6 +6025,7 @@ WHERE ROUTINE_SCHEMA = "mysqltest2" AND ROUTINE_NAME = "bug16211_f3"| SELECT dtd_identifier FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = "mysqltest2" AND ROUTINE_NAME = "bug16211_f4"| +--enable_service_connection SELECT CHARSET(bug16211_f1())| SELECT CHARSET(bug16211_f2())| @@ -10031,6 +10046,46 @@ drop procedure p1| drop function f1| delimiter ;| +--echo # +--echo # MDEV-24827: MariaDB 10.5.5 crash (sig 11) during a SELECT +--echo # + +CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT); +CREATE TABLE t2 (c1 INT PRIMARY KEY, c2 INT, KEY idx_c2(c2)); + +INSERT INTO t1 (c1, c2) SELECT seq, seq FROM seq_1_to_10000; +INSERT INTO t2 (c1, c2) SELECT seq, seq FROM seq_1_to_20000; + +--delimiter $ + +CREATE OR REPLACE PROCEDURE p1() +begin + DECLARE done INT DEFAULT FALSE; + DECLARE a INT; + + DECLARE cur1 CURSOR FOR + SELECT t2.c1 AS c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 + WHERE EXISTS (SELECT 1 FROM t1 WHERE c2 = -1) ORDER BY c1; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + OPEN cur1; + read_loop: LOOP + FETCH cur1 INTO a; + IF done THEN + LEAVE read_loop; + END IF; + END LOOP; + CLOSE cur1; +END $ + +--delimiter ; + +CALL p1(); + +DROP PROCEDURE p1; +DROP TABLE t1; +DROP TABLE t2; --echo #End of 10.2 tests @@ -10418,6 +10473,21 @@ END; $$ DELIMITER ;$$ +--echo # +--echo # MDEV-28220: Assert failure in sp_head::~sp_head on parsing a syntax incorrect statement CREATE SEQUENCE ... RESTART inside CREATE PROCEDURE/CREATE FUNCTION +--echo + +--echo # Specifying the RESTART clause for the statement CREATE SEQUENCE is a syntax error. +--echo # Check that CREATE PROCEDURE doesn't crash server if the statement +--echo # CREATE SEQUNCE ... RESTART is specified in its body. +--echo # +--error ER_PARSE_ERROR +CREATE PROCEDURE sp1() CREATE SEQUENCE s1 START WITH 300 INCREMENT BY 30 RESTART; +--echo # CREATE SEQUNCE ... RESTART and CREATE SEQUNCE ... RESTART WITH ... are +--echo # handled by different grammar rules, so check the both cases. +--error ER_PARSE_ERROR +CREATE PROCEDURE sp1() CREATE SEQUENCE s1 START WITH 300 INCREMENT BY 30 RESTART WITH 100; + --echo # End of 10.3 tests @@ -10438,7 +10508,68 @@ END; $$ DELIMITER ;$$ - --echo # +--echo # MDEV-21173: Assertion `m_thd == __null' failed in sp_head::~sp_head +--echo # +CREATE TABLE t1 (a INT); +--error ER_SUBQUERIES_NOT_SUPPORTED +CREATE PROCEDURE p1() SELECT 1 FROM t1 PROCEDURE ANALYSE( 10, (SELECT a FROM t1)); + +DROP TABLE t1; + --echo # End of 10.4 tests --echo # + +--echo # +--echo # MDEV-29129: Performance regression starting in 10.6: unlimited "select order by limit" +--echo # + +CREATE TABLE t1 ( + lookupId int primary key, + value varchar(255) +); +insert into t1 select seq, seq from seq_1_to_100; + +-- echo # Note: the function is intentionally NOT declared as DETERMINISTIC +delimiter //; +CREATE FUNCTION f1(LOOKUPID_IN INT) RETURNS varchar(255) CHARSET utf8 +BEGIN + DECLARE LOOKUP_VALUE VARCHAR(255); + SET LOOKUP_VALUE = (SELECT value FROM t1 WHERE lookupId = LOOKUPID_IN); + set @counter=@counter+1; + RETURN LOOKUP_VALUE; +END; +// +delimiter ;// + +create table t2 ( + col1 int, + col2 int +); +insert into t2 select mod(seq,100), seq from seq_1_to_1000; + +explain +select f1(col1) from t2 order by col2 desc limit 5; +set @counter=0; +select f1(col1) from t2 order by col2 desc limit 5; +--echo # Must show 5, not 1000: +select @counter; +drop function f1; +drop table t1,t2; + +--echo # +--echo # MDEV-28129: MariaDB UAF issue at lex_end_nops(LEX*) +--echo # + +--error ER_PARSE_ERROR +CREATE PROCEDURE sp() SELECT 1 INTO @; + +--error ER_PARSE_ERROR +CREATE PROCEDURE sp() SET @=1; + +--error ER_PARSE_ERROR +CREATE PROCEDURE sp() SELECT @; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/sp_trans.result b/mysql-test/main/sp_trans.result index 58ef4ad15f776..d558442a6e758 100644 --- a/mysql-test/main/sp_trans.result +++ b/mysql-test/main/sp_trans.result @@ -589,11 +589,11 @@ default_storage_engine MyISAM Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Table Create Table t2 CREATE TABLE `t2` ( `id` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW GLOBAL VARIABLES LIKE 'default_storage_engine'| Variable_name Value default_storage_engine MyISAM diff --git a/mysql-test/main/sql_mode.result b/mysql-test/main/sql_mode.result index 25a90703bf5f5..6ac65302d47f5 100644 --- a/mysql-test/main/sql_mode.result +++ b/mysql-test/main/sql_mode.result @@ -15,11 +15,11 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL AUTO_INCREMENT, - `pseudo` varchar(35) CHARACTER SET latin2 NOT NULL DEFAULT '', - `email` varchar(60) CHARACTER SET latin2 NOT NULL DEFAULT '', + `pseudo` varchar(35) CHARACTER SET latin2 COLLATE latin2_general_ci NOT NULL DEFAULT '', + `email` varchar(60) CHARACTER SET latin2 COLLATE latin2_general_ci NOT NULL DEFAULT '', PRIMARY KEY (`a`), UNIQUE KEY `email` (`email`) USING BTREE -) ENGINE=MEMORY DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC set @@sql_mode="ansi_quotes"; show variables like 'sql_mode'; Variable_name Value @@ -28,11 +28,11 @@ show create table t1; Table Create Table t1 CREATE TABLE "t1" ( "a" int(11) NOT NULL AUTO_INCREMENT, - "pseudo" varchar(35) CHARACTER SET latin2 NOT NULL DEFAULT '', - "email" varchar(60) CHARACTER SET latin2 NOT NULL DEFAULT '', + "pseudo" varchar(35) CHARACTER SET latin2 COLLATE latin2_general_ci NOT NULL DEFAULT '', + "email" varchar(60) CHARACTER SET latin2 COLLATE latin2_general_ci NOT NULL DEFAULT '', PRIMARY KEY ("a"), UNIQUE KEY "email" ("email") USING BTREE -) ENGINE=MEMORY DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC set @@sql_mode="no_table_options"; show variables like 'sql_mode'; Variable_name Value @@ -41,8 +41,8 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL AUTO_INCREMENT, - `pseudo` varchar(35) CHARACTER SET latin2 NOT NULL DEFAULT '', - `email` varchar(60) CHARACTER SET latin2 NOT NULL DEFAULT '', + `pseudo` varchar(35) CHARACTER SET latin2 COLLATE latin2_general_ci NOT NULL DEFAULT '', + `email` varchar(60) CHARACTER SET latin2 COLLATE latin2_general_ci NOT NULL DEFAULT '', PRIMARY KEY (`a`), UNIQUE KEY `email` (`email`) USING BTREE ) @@ -54,11 +54,11 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL AUTO_INCREMENT, - `pseudo` varchar(35) CHARACTER SET latin2 NOT NULL DEFAULT '', - `email` varchar(60) CHARACTER SET latin2 NOT NULL DEFAULT '', + `pseudo` varchar(35) CHARACTER SET latin2 COLLATE latin2_general_ci NOT NULL DEFAULT '', + `email` varchar(60) CHARACTER SET latin2 COLLATE latin2_general_ci NOT NULL DEFAULT '', PRIMARY KEY (`a`), UNIQUE KEY `email` (`email`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC set @@sql_mode="no_field_options,mysql323,mysql40"; show variables like 'sql_mode'; Variable_name Value @@ -80,8 +80,8 @@ show create table t1; Table Create Table t1 CREATE TABLE "t1" ( "a" int(11) NOT NULL, - "pseudo" varchar(35) CHARACTER SET latin2 NOT NULL DEFAULT '', - "email" varchar(60) CHARACTER SET latin2 NOT NULL DEFAULT '', + "pseudo" varchar(35) CHARACTER SET latin2 COLLATE latin2_general_ci NOT NULL DEFAULT '', + "email" varchar(60) CHARACTER SET latin2 COLLATE latin2_general_ci NOT NULL DEFAULT '', PRIMARY KEY ("a"), UNIQUE KEY "email" ("email") ) @@ -98,7 +98,7 @@ t1 CREATE TABLE `t1` ( `a` char(10) DEFAULT NULL, `b` char(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL, `c` binary(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci set @@sql_mode="mysql323"; show create table t1; Table Create Table @@ -122,7 +122,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `min_num` decimal(6,6) DEFAULT 0.000001 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1 ; set session sql_mode = 'IGNORE_SPACE'; create table t1 ( min_num dec(6,6) default 0.000001); @@ -130,14 +130,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `min_num` decimal(6,6) DEFAULT 0.000001 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1 ; create table t1 ( min_num dec(6,6) default .000001); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `min_num` decimal(6,6) DEFAULT 0.000001 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1 ; set @@SQL_MODE=NULL; ERROR 42000: Variable 'sql_mode' can't be set to the value of 'NULL' @@ -159,7 +159,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`f1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=''; show local variables like 'SQL_MODE'; diff --git a/mysql-test/main/sql_mode.test b/mysql-test/main/sql_mode.test index 97f5cf427912e..b1c5f05e6181a 100644 --- a/mysql-test/main/sql_mode.test +++ b/mysql-test/main/sql_mode.test @@ -152,6 +152,8 @@ order by masks.p, example; DROP TABLE t1; +# enable after fix MDEV-29231 +--disable_view_protocol SET @@SQL_MODE='NO_BACKSLASH_ESCAPES'; show local variables like 'SQL_MODE'; @@ -193,9 +195,11 @@ from order by masks.p, example; DROP TABLE t1; +--enable_view_protocol # Bug #6368: Make sure backslashes mixed with doubled quotes are handled # correctly in NO_BACKSLASH_ESCAPES mode +--disable_service_connection SET @@SQL_MODE='NO_BACKSLASH_ESCAPES'; SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b'; SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b"; @@ -203,7 +207,7 @@ SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b"; SET @@SQL_MODE=''; SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b'; SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b"; - +--enable_service_connection # # Bug#6877: MySQL should give an error if the requested table type # is not available diff --git a/mysql-test/main/sql_mode_pad_char_to_full_length.result b/mysql-test/main/sql_mode_pad_char_to_full_length.result new file mode 100644 index 0000000000000..6f68aade613b9 --- /dev/null +++ b/mysql-test/main/sql_mode_pad_char_to_full_length.result @@ -0,0 +1,94 @@ +# +# Start of 10.4 tests +# +# +# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic +# +SET default_storage_engine=MyISAM; +# +# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic +# +CREATE TABLE t1 (a INT,b CHAR(20)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE UNIQUE INDEX bi USING HASH ON t1 (b); +INSERT INTO t1 VALUES (0,0); +SET sql_mode='pad_char_to_full_length'; +DELETE FROM t1; +DROP TABLE t1; +SET sql_mode=''; +CREATE TABLE t1 (a INT,b CHAR(20)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE UNIQUE INDEX bi USING HASH ON t1 (b); +SET sql_mode='pad_char_to_full_length'; +INSERT INTO t1 VALUES (0,0); +DELETE FROM t1; +DROP TABLE t1; +SET sql_mode=''; +CREATE OR REPLACE TABLE t1 (a CHAR(20),b CHAR(20)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(20) DEFAULT NULL, + `b` char(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE UNIQUE INDEX bi USING HASH ON t1 (b); +INSERT INTO t1 VALUES (0,0); +SET sql_mode='pad_char_to_full_length'; +DELETE FROM t1; +DROP TABLE t1; +SET default_storage_engine=MEMORY; +# +# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic +# +CREATE TABLE t1 (a INT,b CHAR(20)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(20) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE UNIQUE INDEX bi USING HASH ON t1 (b); +INSERT INTO t1 VALUES (0,0); +SET sql_mode='pad_char_to_full_length'; +DELETE FROM t1; +DROP TABLE t1; +SET sql_mode=''; +CREATE TABLE t1 (a INT,b CHAR(20)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(20) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE UNIQUE INDEX bi USING HASH ON t1 (b); +SET sql_mode='pad_char_to_full_length'; +INSERT INTO t1 VALUES (0,0); +DELETE FROM t1; +DROP TABLE t1; +SET sql_mode=''; +CREATE OR REPLACE TABLE t1 (a CHAR(20),b CHAR(20)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(20) DEFAULT NULL, + `b` char(20) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE UNIQUE INDEX bi USING HASH ON t1 (b); +INSERT INTO t1 VALUES (0,0); +SET sql_mode='pad_char_to_full_length'; +DELETE FROM t1; +DROP TABLE t1; +SET default_storage_engine=DEFAULT; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/sql_mode_pad_char_to_full_length.test b/mysql-test/main/sql_mode_pad_char_to_full_length.test new file mode 100644 index 0000000000000..4d492bc1b709a --- /dev/null +++ b/mysql-test/main/sql_mode_pad_char_to_full_length.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic +--echo # + +SET default_storage_engine=MyISAM; +--source include/sql_mode_pad_char_to_full_length.inc + +SET default_storage_engine=MEMORY; +--source include/sql_mode_pad_char_to_full_length.inc + +SET default_storage_engine=DEFAULT; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/sql_safe_updates.result b/mysql-test/main/sql_safe_updates.result index 356cd36bad930..f2944e6048976 100644 --- a/mysql-test/main/sql_safe_updates.result +++ b/mysql-test/main/sql_safe_updates.result @@ -1,3 +1,27 @@ +# +# MDEV-14429 sql_safe_updates in my.cnf not work +# select @@sql_safe_updates; @@sql_safe_updates 1 +# +# MDEV-18304 sql_safe_updates does not work with OR clauses +# +create table t1 (a int, b int, primary key (a), key (b)); +update t1 set b=2 where a=1 or b=2; +ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column +explain update t1 set b=2 where a=1 or b=2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where +delete from t1 where a=1 or b=2; +ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column +explain delete from t1 where a=1 or b=2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where +insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8); +update t1 set b=2 where a=1 or b=2; +delete from t1 where a=1 or b=2; +drop table t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/sql_safe_updates.test b/mysql-test/main/sql_safe_updates.test index 18decd0ff2cd2..25fe4a15ca26a 100644 --- a/mysql-test/main/sql_safe_updates.test +++ b/mysql-test/main/sql_safe_updates.test @@ -1,4 +1,23 @@ -# -# MDEV-14429 sql_safe_updates in my.cnf not work -# +--echo # +--echo # MDEV-14429 sql_safe_updates in my.cnf not work +--echo # select @@sql_safe_updates; + +--echo # +--echo # MDEV-18304 sql_safe_updates does not work with OR clauses +--echo # +create table t1 (a int, b int, primary key (a), key (b)); +--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE +update t1 set b=2 where a=1 or b=2; +explain update t1 set b=2 where a=1 or b=2; +--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE +delete from t1 where a=1 or b=2; +explain delete from t1 where a=1 or b=2; +insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8); +update t1 set b=2 where a=1 or b=2; +delete from t1 where a=1 or b=2; +drop table t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/ssl-big.test b/mysql-test/main/ssl-big.test index 44db11b52bbe2..46076e03e7000 100644 --- a/mysql-test/main/ssl-big.test +++ b/mysql-test/main/ssl-big.test @@ -6,6 +6,8 @@ -- source include/have_64bit.inc # No point in running with valgrind as it takes 1.5 hours -- source include/not_valgrind.inc +# This test often times out with MemorySanitizer. +-- source include/not_msan.inc # Save the initial number of concurrent sessions --source include/count_sessions.inc diff --git a/mysql-test/main/ssl.test b/mysql-test/main/ssl.test index 82ada27ffd4f9..d3830bb7007e8 100644 --- a/mysql-test/main/ssl.test +++ b/mysql-test/main/ssl.test @@ -1,3 +1,4 @@ +--source include/no_valgrind_without_big.inc # Turn on ssl between the client and server # and run a number of tests diff --git a/mysql-test/main/ssl_7937,nossl.result b/mysql-test/main/ssl_7937,nossl.result index 72693233bc829..7ce4a754bf830 100644 --- a/mysql-test/main/ssl_7937,nossl.result +++ b/mysql-test/main/ssl_7937,nossl.result @@ -9,7 +9,7 @@ mysql --ssl -e "call test.have_ssl()" have_ssl no mysql --ssl-ca=cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()" -ERROR 2026 (HY000): SSL connection error: SSL is required, but the server does not support it +ERROR 2026 (HY000): TLS/SSL error: SSL is required, but the server does not support it mysql --ssl --ssl-verify-server-cert -e "call test.have_ssl()" -ERROR 2026 (HY000): SSL connection error: SSL is required, but the server does not support it +ERROR 2026 (HY000): TLS/SSL error: SSL is required, but the server does not support it drop procedure have_ssl; diff --git a/mysql-test/main/ssl_7937.result b/mysql-test/main/ssl_7937.result index a94ca3b352973..86180af3692b1 100644 --- a/mysql-test/main/ssl_7937.result +++ b/mysql-test/main/ssl_7937.result @@ -12,5 +12,5 @@ mysql --ssl-ca=cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()" have_ssl yes mysql --ssl --ssl-verify-server-cert -e "call test.have_ssl()" -ERROR 2026 (HY000): SSL connection error: Failed to verify the server certificate +ERROR 2026 (HY000): TLS/SSL error: Failed to verify the server certificate drop procedure have_ssl; diff --git a/mysql-test/main/ssl_7937.test b/mysql-test/main/ssl_7937.test index 59c13107e010c..58583a32ae3f5 100644 --- a/mysql-test/main/ssl_7937.test +++ b/mysql-test/main/ssl_7937.test @@ -21,6 +21,6 @@ create procedure have_ssl() --exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1 --echo mysql --ssl --ssl-verify-server-cert -e "call test.have_ssl()" ---replace_regex /SSL connection error.*certificate[^\n]*/SSL connection error: Failed to verify the server certificate/ +--replace_regex /TLS\/SSL error.*certificate[^\n]*/TLS\/SSL error: Failed to verify the server certificate/ --exec $MYSQL --ssl --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1 drop procedure have_ssl; diff --git a/mysql-test/main/ssl_ca.result b/mysql-test/main/ssl_ca.result index afffe4e4dff8f..85683a0ba9056 100644 --- a/mysql-test/main/ssl_ca.result +++ b/mysql-test/main/ssl_ca.result @@ -2,7 +2,7 @@ # Bug#21920657: SSL-CA FAILS SILENTLY IF THE PATH CANNOT BE FOUND # # try to connect with wrong '--ssl-ca' path : should fail -ERROR 2026 (HY000): SSL connection error: xxxx +ERROR 2026 (HY000): TLS/SSL error: xxxx # try to connect with correct '--ssl-ca' path : should connect have_ssl 1 diff --git a/mysql-test/main/ssl_ca.test b/mysql-test/main/ssl_ca.test index 106da14013003..b66afc221886c 100644 --- a/mysql-test/main/ssl_ca.test +++ b/mysql-test/main/ssl_ca.test @@ -7,7 +7,7 @@ --echo # try to connect with wrong '--ssl-ca' path : should fail ---replace_regex /SSL connection error.*/SSL connection error: xxxx/ +--replace_regex /TLS\/SSL error.*/TLS\/SSL error: xxxx/ --error 1 --exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/wrong-cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';" 2>&1 --echo diff --git a/mysql-test/main/ssl_cipher.result b/mysql-test/main/ssl_cipher.result index 66d817b7b4123..42f37f488e7c0 100644 --- a/mysql-test/main/ssl_cipher.result +++ b/mysql-test/main/ssl_cipher.result @@ -44,7 +44,7 @@ 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 +mysqltest: Could not open connection 'default': 2026 TLS/SSL error: xxxxVariable_name Value Ssl_cipher AES256-SHA Variable_name Value Ssl_cipher AES128-SHA diff --git a/mysql-test/main/ssl_cipher.test b/mysql-test/main/ssl_cipher.test index d4cdcffb276f7..4671b085ce782 100644 --- a/mysql-test/main/ssl_cipher.test +++ b/mysql-test/main/ssl_cipher.test @@ -54,7 +54,7 @@ EOF # 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/ +--replace_regex /2026 TLS\/SSL error.*/2026 TLS\/SSL 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 diff --git a/mysql-test/main/ssl_crl.result b/mysql-test/main/ssl_crl.result index 598774bd77217..d5603254ea585 100644 --- a/mysql-test/main/ssl_crl.result +++ b/mysql-test/main/ssl_crl.result @@ -2,4 +2,4 @@ Variable_name Value 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 +ERROR 2026 (HY000): TLS/SSL error: sslv3 alert certificate revoked diff --git a/mysql-test/main/ssl_crl.test b/mysql-test/main/ssl_crl.test index 23bae038d54c2..9b4758578a70c 100644 --- a/mysql-test/main/ssl_crl.test +++ b/mysql-test/main/ssl_crl.test @@ -8,6 +8,6 @@ --echo # try logging in with a certificate in the server's --ssl-crl : should fail # OpenSSL 1.1.1a correctly rejects the certificate, but the error message is different ---replace_regex /ERROR 2013 \(HY000\): Lost connection to server at '.*', system error: [0-9]+/ERROR 2026 (HY000): SSL connection error: sslv3 alert certificate revoked/ +--replace_regex /ERROR 2013 \(HY000\): Lost connection to server at '.*', system error: [0-9]+/ERROR 2026 (HY000): TLS\/SSL error: sslv3 alert certificate revoked/ --error 1 --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.result b/mysql-test/main/ssl_crl_clients.result index 0d8ed9a41581d..7cc03deee0c29 100644 --- a/mysql-test/main/ssl_crl_clients.result +++ b/mysql-test/main/ssl_crl_clients.result @@ -1,13 +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 +ERROR 2026 (HY000): TLS/SSL error: certificate revoked # Test mysql connecting to a server with a certificate revoked by -crlpath -ERROR 2026 (HY000): SSL connection error: certificate revoked +ERROR 2026 (HY000): TLS/SSL 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' +mariadb-admin: connect to server at 'localhost' failed +error: 'TLS/SSL 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' +mariadb-admin: connect to server at 'localhost' failed +error: 'TLS/SSL error: certificate revoked' diff --git a/mysql-test/main/ssl_crl_clients.test b/mysql-test/main/ssl_crl_clients.test index f1dc4909cc679..95b4ac3c0d530 100644 --- a/mysql-test/main/ssl_crl_clients.test +++ b/mysql-test/main/ssl_crl_clients.test @@ -34,11 +34,11 @@ copy_file $MYSQL_TEST_DIR/std_data/server-cert.crl $MYSQL_TMP_DIR/ed1f42db.r0; 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 ---replace_regex /.*mysqladmin.*:/mysqladmin:/ /SSL connection error: .*CRYPT_E_REVOKED./SSL connection error: certificate revoked/ +--replace_regex /.*mariadb-admin.*:/mariadb-admin:/ /TLS\/SSL error: .*CRYPT_E_REVOKED./TLS\/SSL error: certificate revoked/ --error 1 --exec $MYSQLADMIN $ssl_crl $admin_suffix 2>&1 --echo # Test mysqladmin connecting to a server with a certificate revoked by -crlpath ---replace_regex /.*mysqladmin.*:/mysqladmin:/ /SSL connection error: .*CRYPT_E_REVOKED./SSL connection error: certificate revoked/ +--replace_regex /.*mariadb-admin.*:/mariadb-admin:/ /TLS\/SSL error: .*CRYPT_E_REVOKED./TLS\/SSL error: certificate revoked/ --error 1 --exec $MYSQLADMIN $ssl_crlpath $admin_suffix 2>&1 diff --git a/mysql-test/main/ssl_system_ca,bad.result b/mysql-test/main/ssl_system_ca,bad.result index b9c6d3e29d8f0..1799e9f5e3245 100644 --- a/mysql-test/main/ssl_system_ca,bad.result +++ b/mysql-test/main/ssl_system_ca,bad.result @@ -1 +1 @@ -ERROR 2026 (HY000): SSL connection error: Validation of SSL server certificate failed +ERROR 2026 (HY000): TLS/SSL error: Validation of SSL server certificate failed diff --git a/mysql-test/main/ssl_timeout.result b/mysql-test/main/ssl_timeout.result index e0d1dbed69fbd..208be527a6bf8 100644 --- a/mysql-test/main/ssl_timeout.result +++ b/mysql-test/main/ssl_timeout.result @@ -5,6 +5,6 @@ SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS have_ssl 1 SELECT SLEEP(600); -ERROR HY000: Lost connection to server during query +Got one of the listed errors connection default; disconnect ssl_con; diff --git a/mysql-test/main/ssl_timeout.test b/mysql-test/main/ssl_timeout.test index 430fe7130de10..f5965f874ff49 100644 --- a/mysql-test/main/ssl_timeout.test +++ b/mysql-test/main/ssl_timeout.test @@ -10,7 +10,7 @@ connect (ssl_con,localhost,root,,,,,SSL read_timeout=5); SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; # --error CR_SERVER_LOST ---error 2013 +--error 2013,2026 SELECT SLEEP(600); connection default; diff --git a/mysql-test/main/stat_tables.result b/mysql-test/main/stat_tables.result index 22f5bfafb8e2e..379e9737e1c2f 100644 --- a/mysql-test/main/stat_tables.result +++ b/mysql-test/main/stat_tables.result @@ -216,8 +216,8 @@ id select_type table type possible_keys key key_len ref rows Extra 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_partkey 5 dbt3_s001.part.p_partkey 30 Using where 1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where -1 SIMPLE orders eq_ref|filter PRIMARY,i_o_orderdate,i_o_custkey PRIMARY|i_o_orderdate 4|4 dbt3_s001.lineitem.l_orderkey 1 (27%) Using where; Using rowid filter 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, diff --git a/mysql-test/main/stat_tables.test b/mysql-test/main/stat_tables.test index 9955908bd6033..7488ccb6877f8 100644 --- a/mysql-test/main/stat_tables.test +++ b/mysql-test/main/stat_tables.test @@ -1,3 +1,7 @@ +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + --source include/have_stat_tables.inc --source include/have_partition.inc diff --git a/mysql-test/main/stat_tables_disabled.test b/mysql-test/main/stat_tables_disabled.test index e6b965afe348e..27b99d0dfdfae 100644 --- a/mysql-test/main/stat_tables_disabled.test +++ b/mysql-test/main/stat_tables_disabled.test @@ -4,7 +4,9 @@ set @innodb_stats_persistent_sample_pages_save= set global innodb_stats_persistent= 1; set global innodb_stats_persistent_sample_pages=100; + --source include/have_innodb.inc +--source include/no_valgrind_without_big.inc SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB'; diff --git a/mysql-test/main/stat_tables_innodb.test b/mysql-test/main/stat_tables_innodb.test index f439ec5231530..fd8dc6bf3c503 100644 --- a/mysql-test/main/stat_tables_innodb.test +++ b/mysql-test/main/stat_tables_innodb.test @@ -1,3 +1,4 @@ +--source include/no_valgrind_without_big.inc --source include/have_innodb.inc --source include/have_sequence.inc diff --git a/mysql-test/main/stat_tables_missing.result b/mysql-test/main/stat_tables_missing.result index a7cd35b1d1fb8..3f8f9e982ae7d 100644 --- a/mysql-test/main/stat_tables_missing.result +++ b/mysql-test/main/stat_tables_missing.result @@ -6,6 +6,6 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `b` varchar(100) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table mysql.column_stats1 rename to mysql.column_stats; drop table t1; diff --git a/mysql-test/main/stat_tables_par.inc b/mysql-test/main/stat_tables_par.inc index 16f64cebfe767..52e66ef09d218 100644 --- a/mysql-test/main/stat_tables_par.inc +++ b/mysql-test/main/stat_tables_par.inc @@ -1,6 +1,8 @@ # Note that this test requires a fresh restart to not have problems with the # old status values +--disable_service_connection + set @save_use_stat_tables=@@use_stat_tables; set use_stat_tables='preferably'; @@ -241,6 +243,8 @@ DROP DATABASE dbt3_s001; use test; +--enable_service_connection + # # Bug mdev-4019: crash when executing in parallel ANALYZE and # SELECT * FROM information_schema.statistics diff --git a/mysql-test/main/stat_tables_par_innodb.test b/mysql-test/main/stat_tables_par_innodb.test index 79ab23dcc3ff4..024814933c613 100644 --- a/mysql-test/main/stat_tables_par_innodb.test +++ b/mysql-test/main/stat_tables_par_innodb.test @@ -1,6 +1,7 @@ # Note that this test requires a fresh restart to not have problems with the # old status values +--source include/no_valgrind_without_big.inc --source include/have_stat_tables.inc --source include/have_debug_sync.inc --source include/not_embedded.inc diff --git a/mysql-test/main/stat_tables_rbr.result b/mysql-test/main/stat_tables_rbr.result index 130d1f6da9a1d..38f774412bda5 100644 --- a/mysql-test/main/stat_tables_rbr.result +++ b/mysql-test/main/stat_tables_rbr.result @@ -1,3 +1,4 @@ +RESET MASTER; # # Bug mdev-463: assertion failure when running ANALYZE with RBR on # diff --git a/mysql-test/main/stat_tables_rbr.test b/mysql-test/main/stat_tables_rbr.test index 1b6a960374362..efa54423dfaea 100644 --- a/mysql-test/main/stat_tables_rbr.test +++ b/mysql-test/main/stat_tables_rbr.test @@ -1,7 +1,7 @@ --source include/have_binlog_format_row.inc --source include/have_innodb.inc --source include/have_partition.inc - +RESET MASTER; # clear up binlogs --echo # --echo # Bug mdev-463: assertion failure when running ANALYZE with RBR on --echo # diff --git a/mysql-test/main/statistics.result b/mysql-test/main/statistics.result index 43b28f464e14b..5ecb439bacccc 100644 --- a/mysql-test/main/statistics.result +++ b/mysql-test/main/statistics.result @@ -1,7 +1,6 @@ set @SINGLE_PREC_TYPE='single_prec_hb'; set @DOUBLE_PREC_TYPE='double_prec_hb'; set @DEFAULT_HIST_TYPE='double_prec_hb'; -drop table if exists t1,t2; set @save_use_stat_tables=@@use_stat_tables; set @save_histogram_size=@@global.histogram_size; set @@global.histogram_size=0,@@local.histogram_size=0; @@ -418,7 +417,7 @@ t1 CREATE TABLE `t1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`y`,`x`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -443,7 +442,7 @@ t1 CREATE TABLE `t1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`e`,`b`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -467,7 +466,7 @@ s1 CREATE TABLE `s1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`e`,`x`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM mysql.table_stats; db_name table_name cardinality test s1 40 @@ -505,7 +504,7 @@ t1 CREATE TABLE `t1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`e`,`b`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM mysql.table_stats; db_name table_name cardinality test t1 40 @@ -543,7 +542,7 @@ t1 CREATE TABLE `t1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`e`,`x`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -572,7 +571,7 @@ t1 CREATE TABLE `t1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`e`,`b`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -630,7 +629,7 @@ t1 CREATE TABLE `t1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`e`,`x`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -659,7 +658,7 @@ t1 CREATE TABLE `t1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`e`,`b`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -712,7 +711,7 @@ t1 CREATE TABLE `t1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`e`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -739,7 +738,7 @@ t1 CREATE TABLE `t1` ( KEY `idx1` (`e`), KEY `idx3` (`d`), KEY `idx4` (`e`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -756,7 +755,7 @@ t1 CREATE TABLE `t1` ( `f` bit(3) DEFAULT NULL, PRIMARY KEY (`a`), KEY `idx3` (`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 ADD COLUMN b varchar(32); CREATE INDEX idx1 ON t1(b, e); CREATE INDEX idx2 ON t1(c, d); @@ -775,7 +774,7 @@ t1 CREATE TABLE `t1` ( KEY `idx1` (`b`,`e`), KEY `idx2` (`c`,`d`), KEY `idx4` (`e`,`b`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -846,7 +845,7 @@ t1 CREATE TABLE `t1` ( `f` bit(3) DEFAULT NULL, PRIMARY KEY (`a`), KEY `idx3` (`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -876,7 +875,7 @@ t1 CREATE TABLE `t1` ( KEY `idx1` (`b`,`e`), KEY `idx2` (`c`,`d`), KEY `idx4` (`e`,`b`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -1771,7 +1770,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` blob DEFAULT NULL, `b` text DEFAULT decode_histogram(@`SINGLE_PREC_TYPE`,`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES (0x0000000000000000000000000101010101010101010202020303030304040404050505050606070707080809090A0A0B0C0D0D0E0E0F10111213131415161718191B1C1E202224292A2E33373B4850575F6A76818C9AA7B9C4CFDADFE5EBF0F4F8FAFCFF); SELECT b FROM t1; b diff --git a/mysql-test/main/statistics.test b/mysql-test/main/statistics.test index 1d431237e82ff..525836abba849 100644 --- a/mysql-test/main/statistics.test +++ b/mysql-test/main/statistics.test @@ -1,3 +1,7 @@ +--source include/no_valgrind_without_big.inc +--source include/have_stat_tables.inc +--source include/have_innodb.inc + set @SINGLE_PREC_TYPE='single_prec_hb'; set @DOUBLE_PREC_TYPE='double_prec_hb'; set @DEFAULT_HIST_TYPE='double_prec_hb'; @@ -8,12 +12,6 @@ if ($histogram_type_override) { eval set @DEFAULT_HIST_TYPE=$histogram_type_override; } ---source include/have_stat_tables.inc ---source include/have_innodb.inc ---disable_warnings -drop table if exists t1,t2; ---enable_warnings - set @save_use_stat_tables=@@use_stat_tables; set @save_histogram_size=@@global.histogram_size; set @@global.histogram_size=0,@@local.histogram_size=0; @@ -607,6 +605,7 @@ set use_stat_tables='preferably'; ANALYZE TABLE Country, City, CountryLanguage; --enable_result_log +--disable_view_protocol --sorted_result SELECT UPPER(db_name), UPPER(table_name), cardinality FROM mysql.table_stats; @@ -618,6 +617,7 @@ SELECT UPPER(db_name), UPPER(table_name), SELECT UPPER(db_name), UPPER(table_name), index_name, prefix_arity, avg_frequency FROM mysql.index_stats; +--enable_view_protocol use test; @@ -671,10 +671,12 @@ ANALYZE TABLE City; FLUSH TABLES; --enable_result_log +--disable_view_protocol --source include/histogram_replaces.inc --query_vertical select UPPER(db_name),UPPER(table_name),UPPER(column_name),min_value,max_value,nulls_ratio,avg_length,avg_frequency,hist_size,hist_type,decode_histogram(hist_type,histogram) from mysql.column_stats where UPPER(db_name)='WORLD' and UPPER(table_name)='COUNTRYLANGUAGE' and UPPER(column_name) = 'PERCENTAGE'; --source include/histogram_replaces.inc --query_vertical select UPPER(db_name),UPPER(table_name),UPPER(column_name),min_value,max_value,nulls_ratio,avg_length,avg_frequency,hist_size,hist_type,decode_histogram(hist_type,histogram) from mysql.column_stats where UPPER(db_name)='WORLD' and UPPER(table_name)='CITY' and UPPER(column_name) = 'POPULATION'; +--enable_view_protocol set histogram_type=@SINGLE_PREC_TYPE; set histogram_size=0; diff --git a/mysql-test/main/statistics_json.result b/mysql-test/main/statistics_json.result index a97400567778d..748287152b158 100644 --- a/mysql-test/main/statistics_json.result +++ b/mysql-test/main/statistics_json.result @@ -7,7 +7,6 @@ set @DEFAULT_HIST_TYPE='double_prec_hb'; set @SINGLE_PREC_TYPE='JSON_HB'; set @DOUBLE_PREC_TYPE='JSON_HB'; set @DEFAULT_HIST_TYPE='JSON_HB'; -drop table if exists t1,t2; set @save_use_stat_tables=@@use_stat_tables; set @save_histogram_size=@@global.histogram_size; set @@global.histogram_size=0,@@local.histogram_size=0; @@ -778,7 +777,7 @@ t1 CREATE TABLE `t1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`y`,`x`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -803,7 +802,7 @@ t1 CREATE TABLE `t1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`e`,`b`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -827,7 +826,7 @@ s1 CREATE TABLE `s1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`e`,`x`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM mysql.table_stats; db_name table_name cardinality test s1 40 @@ -865,7 +864,7 @@ t1 CREATE TABLE `t1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`e`,`b`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM mysql.table_stats; db_name table_name cardinality test t1 40 @@ -903,7 +902,7 @@ t1 CREATE TABLE `t1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`e`,`x`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -932,7 +931,7 @@ t1 CREATE TABLE `t1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`e`,`b`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -990,7 +989,7 @@ t1 CREATE TABLE `t1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`e`,`x`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -1019,7 +1018,7 @@ t1 CREATE TABLE `t1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`e`,`b`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -1072,7 +1071,7 @@ t1 CREATE TABLE `t1` ( KEY `idx2` (`c`,`d`), KEY `idx3` (`d`), KEY `idx4` (`e`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -1099,7 +1098,7 @@ t1 CREATE TABLE `t1` ( KEY `idx1` (`e`), KEY `idx3` (`d`), KEY `idx4` (`e`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -1116,7 +1115,7 @@ t1 CREATE TABLE `t1` ( `f` bit(3) DEFAULT NULL, PRIMARY KEY (`a`), KEY `idx3` (`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 ADD COLUMN b varchar(32); CREATE INDEX idx1 ON t1(b, e); CREATE INDEX idx2 ON t1(c, d); @@ -1135,7 +1134,7 @@ t1 CREATE TABLE `t1` ( KEY `idx1` (`b`,`e`), KEY `idx2` (`c`,`d`), KEY `idx4` (`e`,`b`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -1206,7 +1205,7 @@ t1 CREATE TABLE `t1` ( `f` bit(3) DEFAULT NULL, PRIMARY KEY (`a`), KEY `idx3` (`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -1236,7 +1235,7 @@ t1 CREATE TABLE `t1` ( KEY `idx1` (`b`,`e`), KEY `idx2` (`c`,`d`), KEY `idx4` (`e`,`b`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 0 49 0.0000 4.0000 1.0000 0 NULL NULL @@ -8322,3 +8321,34 @@ histogram ] } drop table t1; +# +# MDEV-28882: Assertion `tmp >= 0' failed in best_access_path +# +CREATE TABLE t1 (a varchar(1)); +INSERT INTO t1 VALUES ('o'),('s'),('j'),('s'),('y'),('s'),('l'), +('q'),('x'),('m'),('t'),('d'),('v'),('j'),('p'),('t'),('b'),('q'); +set histogram_type=json_hb; +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 +# filtered must not be negative: +explain format=json select * from t1 where a > 'y'; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 5.555555344, + "attached_condition": "t1.a > 'y'" + } + } + ] + } +} +drop table t1; diff --git a/mysql-test/main/statistics_json.test b/mysql-test/main/statistics_json.test index 10583620cda1a..5263a98fff7ee 100644 --- a/mysql-test/main/statistics_json.test +++ b/mysql-test/main/statistics_json.test @@ -117,6 +117,8 @@ drop table t2; DELETE FROM mysql.column_stats; +--disable_service_connection + create schema world; use world; --disable_query_log @@ -143,6 +145,9 @@ set histogram_type=@save_histogram_type; set histogram_size=@save_histogram_size; DROP SCHEMA world; + +--enable_service_connection + use test; create table t10 ( @@ -460,3 +465,19 @@ from mysql.column_stats where table_name='t1' and db_name=database(); drop table t1; +--echo # +--echo # MDEV-28882: Assertion `tmp >= 0' failed in best_access_path +--echo # + +CREATE TABLE t1 (a varchar(1)); + +INSERT INTO t1 VALUES ('o'),('s'),('j'),('s'),('y'),('s'),('l'), + ('q'),('x'),('m'),('t'),('d'),('v'),('j'),('p'),('t'),('b'),('q'); + +set histogram_type=json_hb; +analyze table t1 persistent for all; +--echo # filtered must not be negative: +explain format=json select * from t1 where a > 'y'; + +drop table t1; + diff --git a/mysql-test/main/statistics_upgrade.result b/mysql-test/main/statistics_upgrade.result index 6e28711524512..87e2b23570d76 100644 --- a/mysql-test/main/statistics_upgrade.result +++ b/mysql-test/main/statistics_upgrade.result @@ -57,16 +57,16 @@ error : Corrupt show create table mysql.column_stats; Table Create Table column_stats CREATE TABLE `column_stats` ( - `db_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `column_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `db_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, + `column_name` varchar(64) NOT NULL, `min_value` varbinary(255) DEFAULT NULL, `max_value` varbinary(255) DEFAULT NULL, `nulls_ratio` decimal(12,4) DEFAULT NULL, `avg_length` decimal(12,4) DEFAULT NULL, `avg_frequency` decimal(12,4) DEFAULT NULL, `hist_size` tinyint(3) unsigned DEFAULT NULL, - `hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') COLLATE utf8mb3_bin DEFAULT NULL, + `hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') DEFAULT NULL, `histogram` longblob DEFAULT NULL, PRIMARY KEY (`db_name`,`table_name`,`column_name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns' @@ -85,3 +85,7 @@ db_name table_name hist_type_equal histogram_equal test t1 1 1 test t2 1 1 drop table t1,t2,t4; +# +# MDEV-28866 mariadb-upgrade to 10.8 mysql.column_stats hist_type + histogram errors +# +FOUND 2 /Incorrect definition of table mysql.column_stats:/ in mysqld.1.err diff --git a/mysql-test/main/statistics_upgrade.test b/mysql-test/main/statistics_upgrade.test index 705cf65e05303..9f47ab1a83bcc 100644 --- a/mysql-test/main/statistics_upgrade.test +++ b/mysql-test/main/statistics_upgrade.test @@ -65,3 +65,13 @@ from A.column_name=B.column_name; drop table t1,t2,t4; + +--echo # +--echo # MDEV-28866 mariadb-upgrade to 10.8 mysql.column_stats hist_type + histogram errors +--echo # +# There should only be two count here corresponding the test creation of mysql.column_stats, and +# none generated by the $MYSQL_UPGRADE run. +--let $error_log= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let SEARCH_FILE= $error_log +--let SEARCH_PATTERN= Incorrect definition of table mysql.column_stats: +--source include/search_pattern_in_file.inc diff --git a/mysql-test/main/status.result b/mysql-test/main/status.result index d25cde89ee10e..d17bd9c6a6154 100644 --- a/mysql-test/main/status.result +++ b/mysql-test/main/status.result @@ -243,13 +243,13 @@ return (select * from db37908.t1 limit 1)| connect user1,localhost,mysqltest_1,,test; connection user1; select * from db37908.t1; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `db37908`.`t1` show status where variable_name ='uptime' and 2 in (select * from db37908.t1); -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `db37908`.`t1` show procedure status where name ='proc37908' and 1 in (select f1 from db37908.t1); -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `db37908`.`t1` show function status where name ='func37908' and 1 in (select func37908()); -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `db37908`.`t1` connection default; disconnect user1; disconnect root; diff --git a/mysql-test/main/status.test b/mysql-test/main/status.test index 78626615d457b..a1baa36baf8f9 100644 --- a/mysql-test/main/status.test +++ b/mysql-test/main/status.test @@ -280,7 +280,6 @@ show status like 'Com%function'; # connect (root, localhost, root,,test); connection root; -let $root_connection_id= `select connection_id()`; --disable_warnings create database db37908; --enable_warnings @@ -296,7 +295,6 @@ delimiter ;| connect (user1,localhost,mysqltest_1,,test); connection user1; -let $user1_connection_id= `select connection_id()`; --error ER_TABLEACCESS_DENIED_ERROR select * from db37908.t1; @@ -315,11 +313,8 @@ drop procedure proc37908; drop function func37908; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; DROP USER mysqltest_1@localhost; -# Wait till the sessions user1 and root are disconnected -let $wait_condition = - SELECT COUNT(*) = 0 - FROM information_schema.processlist - WHERE id in ('$root_connection_id','$user1_connection_id'); +# Wait until all non-default sessions are disconnected +let $wait_condition = SELECT COUNT(*) = 1 FROM information_schema.processlist; --source include/wait_condition.inc # diff --git a/mysql-test/main/strict.result b/mysql-test/main/strict.result index b9db41663984f..3163059956c46 100644 --- a/mysql-test/main/strict.result +++ b/mysql-test/main/strict.result @@ -1251,7 +1251,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned NOT NULL, `b` date NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @@sql_mode='traditional'; create table t1 (d date); @@ -1275,7 +1275,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(a int, b timestamp not null default 20050102030405); alter table t1 add primary key(a); @@ -1285,7 +1285,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` timestamp NOT NULL DEFAULT '2005-01-02 03:04:05', PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @@sql_mode='traditional'; create table t1(a bit(2)); @@ -1301,7 +1301,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `date` date NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2,t1; set @@sql_mode= @org_mode; set @@sql_mode='traditional'; @@ -1441,14 +1441,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='123456789*123456789*123456789*123456789*123456789*123456789*' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='123456789*123456789*123456789*123456789*123456789*123456789*' drop table t1; CREATE TABLE t3 (f1 INT) COMMENT 'כקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחן'; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `f1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='כקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחן' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='כקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחן' DROP TABLE t3; set sql_mode= 'traditional'; create table t1(col1 tinyint, col2 tinyint unsigned, diff --git a/mysql-test/main/strings.result b/mysql-test/main/strings.result index b327381f8bfa8..6573e7344227f 100644 --- a/mysql-test/main/strings.result +++ b/mysql-test/main/strings.result @@ -9,15 +9,6 @@ ERROR HY000: \042D\0442\0443 \043E\043F\0435\0440\0430\0446\0438\044E \043D\0435 STOP SLAVE; RESET SLAVE ALL; # -# MDEV-25778 Overrun buffer in to_string_native() -# -CREATE TABLE t1 (a DECIMAL(15,11) ZEROFILL); -INSERT INTO t1 (a) VALUES (0.1),(0.2); -SELECT length(ENCRYPT(a)) AS f, COUNT(*) FROM t1 GROUP BY f; -f COUNT(*) -13 2 -DROP TABLE t1; -# # MDEV-25754 ASAN: stack-buffer-overflow in Field_newdate::val_str # CREATE TABLE t1 (d DATE); @@ -27,3 +18,13 @@ LENGTH(CONCAT_WS(d, ' ')) 1 1 DROP TABLE t1; +# +# MDEV-28315 ASAN stack-buffer-overflow in String::copy_aligned +# +CREATE TABLE t1 (a VARBINARY(128)) CHARACTER SET utf32; +INSERT INTO t1 VALUES ('South Carolina, Vermont, New Jersey, New Mexico, Wisconsin, Missouri, Delaware'); +CREATE TABLE t2 (b SET('South Carolina', 'Vermont', 'Texas', 'New Mexico', 'Wisconsin', 'Missouri', 'Delaware', 'Wyoming', 'New Jersey', 'Maryland', 'Illinois', 'New York')) CHARACTER SET utf32; +INSERT INTO t2 SELECT * FROM t1; +ERROR 01000: Data truncated for column 'b' at row 1 +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/main/strings.test b/mysql-test/main/strings.test index d0785cfb07244..3f3f4b572af84 100644 --- a/mysql-test/main/strings.test +++ b/mysql-test/main/strings.test @@ -17,19 +17,22 @@ STOP SLAVE; RESET SLAVE ALL; --echo # ---echo # MDEV-25778 Overrun buffer in to_string_native() +--echo # MDEV-25754 ASAN: stack-buffer-overflow in Field_newdate::val_str --echo # -CREATE TABLE t1 (a DECIMAL(15,11) ZEROFILL); -INSERT INTO t1 (a) VALUES (0.1),(0.2); -SELECT length(ENCRYPT(a)) AS f, COUNT(*) FROM t1 GROUP BY f; +CREATE TABLE t1 (d DATE); +INSERT INTO t1 VALUES ('1920-03-02'),('2020-12-01'); +SELECT LENGTH(CONCAT_WS(d, ' ')) FROM t1; DROP TABLE t1; --echo # ---echo # MDEV-25754 ASAN: stack-buffer-overflow in Field_newdate::val_str +--echo # MDEV-28315 ASAN stack-buffer-overflow in String::copy_aligned --echo # -CREATE TABLE t1 (d DATE); -INSERT INTO t1 VALUES ('1920-03-02'),('2020-12-01'); -SELECT LENGTH(CONCAT_WS(d, ' ')) FROM t1; +CREATE TABLE t1 (a VARBINARY(128)) CHARACTER SET utf32; +INSERT INTO t1 VALUES ('South Carolina, Vermont, New Jersey, New Mexico, Wisconsin, Missouri, Delaware'); +CREATE TABLE t2 (b SET('South Carolina', 'Vermont', 'Texas', 'New Mexico', 'Wisconsin', 'Missouri', 'Delaware', 'Wyoming', 'New Jersey', 'Maryland', 'Illinois', 'New York')) CHARACTER SET utf32; +--error WARN_DATA_TRUNCATED +INSERT INTO t2 SELECT * FROM t1; DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/main/subselect.result b/mysql-test/main/subselect.result index 167382fc328f4..0c877b03b97f2 100644 --- a/mysql-test/main/subselect.result +++ b/mysql-test/main/subselect.result @@ -118,30 +118,30 @@ ROW(1,2,3) > (SELECT 1,2,1) SELECT ROW(1,2,3) = (SELECT 1,2,NULL); ROW(1,2,3) = (SELECT 1,2,NULL) NULL -SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a'); -(SELECT 1.5,2,'a') = ROW(1.5,2,'a') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m; +m 1 -SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b'); -(SELECT 1.5,2,'a') = ROW(1.5,2,'b') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m; +m 0 -SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b'); -(SELECT 1.5,2,'a') = ROW('1.5b',2,'b') +SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m; +m 0 Warnings: Warning 1292 Truncated incorrect DOUBLE value: '1.5b' -SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); -(SELECT 'b',2,'a') = ROW(1.5,2,'a') +SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a') AS m; +m 0 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'b' -SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a'); -(SELECT 1.5,2,'a') = ROW(1.5,'2','a') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a') AS m; +m 1 -SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); -(SELECT 1.5,'c','a') = ROW(1.5,2,'a') +SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a') AS m; +m 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'c' SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a); ERROR 21000: Operand should contain 1 column(s) SELECT 1 as a,(SELECT a+a) b,(SELECT b); @@ -228,19 +228,26 @@ a 2 select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1); a -select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; -b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) +select +b, +(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m +from t4; +b m 8 7.5000 8 4.5000 9 7.5000 -explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; +explain extended +select +b, +(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m +from t4; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` +Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `m` from `test`.`t4` select * from t3 where exists (select * from t2 where t2.b=t3.a); a 7 @@ -307,21 +314,34 @@ select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 w b ma 7 12 create table t5 (a int); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 insert into t5 values (5); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 insert into t5 values (2); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 -explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; +explain extended +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 @@ -330,7 +350,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 /* select#1 */ select <`test`.`t2`.`a`>((/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` +Note 1003 /* select#1 */ select <`test`.`t2`.`a`>((/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `m`,`test`.`t2`.`a` AS `a` from `test`.`t2` select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; ERROR 21000: Subquery returns more than 1 row create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); @@ -486,8 +506,11 @@ SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING t mot topic date pseudo joce 40143 2002-10-22 joce joce 43506 2002-10-22 joce -SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2; -mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) +SELECT +*, +topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) AS m +FROM t2; +mot topic date pseudo m joce 40143 2002-10-22 joce 1 joce 43506 2002-10-22 joce 1 SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2); @@ -505,8 +528,11 @@ joce 40143 2002-10-22 joce SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000); mot topic date pseudo joce 40143 2002-10-22 joce -SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2; -mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) +SELECT +*, +topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) AS m +FROM t2; +mot topic date pseudo m joce 40143 2002-10-22 joce 1 joce 43506 2002-10-22 joce 0 drop table t1,t2; @@ -879,6 +905,25 @@ NULL select 1.5 > ANY (SELECT * from t1); 1.5 > ANY (SELECT * from t1) NULL +update t1 set a=NULL where a=2.5; +select 1.5 IN (SELECT * from t1); +1.5 IN (SELECT * from t1) +1 +select 3.5 IN (SELECT * from t1); +3.5 IN (SELECT * from t1) +1 +select 10.5 IN (SELECT * from t1); +10.5 IN (SELECT * from t1) +NULL +select 1.5 > ALL (SELECT * from t1); +1.5 > ALL (SELECT * from t1) +0 +select 10.5 > ALL (SELECT * from t1); +10.5 > ALL (SELECT * from t1) +NULL +select 1.5 > ANY (SELECT * from t1); +1.5 > ANY (SELECT * from t1) +NULL select 10.5 > ANY (SELECT * from t1); 10.5 > ANY (SELECT * from t1) 1 @@ -889,6 +934,20 @@ Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` +explain extended select (select a+1) from t1; +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 +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` +explain extended select (select a+1) from t1; +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 +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` select (select a+1) from t1; (select a+1) 2.5 @@ -1234,7 +1293,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT 1)` int(1) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a; SHOW CREATE TABLE t1; @@ -1242,7 +1301,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT a)` int(1) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a; SHOW CREATE TABLE t1; @@ -1250,7 +1309,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT a+0)` int(3) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a; select * from t1; @@ -1259,8 +1318,8 @@ a SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(3) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` int(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int); insert into t1 values (1), (2), (3); @@ -1530,8 +1589,8 @@ create table t3 (a int, b int); insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10); insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1); insert into t3 values (3,3), (2,2), (1,1); -select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3; -a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) +select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) as m from t3; +a m 3 1 2 2 1 2 @@ -1726,8 +1785,8 @@ CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(1 INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1); CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1; INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status'); -select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid; -dbid name (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') +select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') as m FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') as m from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid; +dbid name m -1 Valid 1 -1 Valid 2 1 -1 Should Not Return 0 @@ -3192,13 +3251,13 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `sub_a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t3 AS (SELECT a FROM t1 WHERE a < '2000-01-01') UNION (SELECT a FROM t1 WHERE a > '2000-01-01'); SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2,t3; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (1), (2); @@ -3782,9 +3841,10 @@ SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a; 2 1 1 -SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) +SELECT +(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) AS m FROM t1 GROUP BY t1.a; -(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) +m 2 1 1 @@ -3794,9 +3854,9 @@ COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b)) 1 1 1 1 SELECT COUNT(DISTINCT t1.b), -(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) +(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) AS m FROM t1 GROUP BY t1.a; -COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) +COUNT(DISTINCT t1.b) m 2 2 1 1 1 1 @@ -3820,16 +3880,10 @@ SELECT ( SELECT COUNT(DISTINCT t1.b) ) ) -FROM t1 GROUP BY t1.a LIMIT 1) +FROM t1 GROUP BY t1.a LIMIT 1) AS m FROM t1 t2 GROUP BY t2.a; -( -SELECT ( -SELECT ( -SELECT COUNT(DISTINCT t1.b) -) -) -FROM t1 GROUP BY t1.a LIMIT 1) +m 2 2 2 @@ -4682,7 +4736,7 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -5967,7 +6021,7 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -6348,10 +6402,10 @@ ORDER BY b ); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) @@ -6359,10 +6413,10 @@ GROUP BY b ); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' DROP TABLE t1, t2; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6423,11 +6477,10 @@ CREATE TABLE t3 (a int, b int); INSERT INTO t3 VALUES (10,7), (0,7); SELECT SUM(DISTINCT b), (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0 -WHERE t.a != 0 AND t2.a != 0) +WHERE t.a != 0 AND t2.a != 0) AS m FROM (SELECT * FROM t3) AS t GROUP BY 2; -SUM(DISTINCT b) (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0 -WHERE t.a != 0 AND t2.a != 0) +SUM(DISTINCT b) m 7 NULL SELECT SUM(DISTINCT b), (SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1) @@ -6560,66 +6613,93 @@ CREATE TABLE t3 (f3a int default 1, f3b int default 2); INSERT INTO t3 VALUES (1,1),(2,2); set @old_optimizer_switch = @@session.optimizer_switch; set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off'; -SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m; +m NULL -SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m; +m NULL set @@session.optimizer_switch=@old_optimizer_switch; -SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m; +m NULL -SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2; +SELECT +(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2 AS m; (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m; +m NULL select (null, null) = (null, null); (null, null) = (null, null) @@ -6665,8 +6745,10 @@ INSERT INTO t2 VALUES (1); CREATE TABLE t3 ( c INT ); INSERT INTO t3 VALUES (4),(5); SET optimizer_switch='subquery_cache=off'; -SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; -( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) +SELECT +( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) AS m +FROM t1; +m 1 NULL SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1; @@ -6883,7 +6965,9 @@ CREATE TABLE t3 (c INT); INSERT INTO t3 VALUES (8),(3); set @@expensive_subquery_limit= 0; EXPLAIN -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 @@ -6893,9 +6977,11 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) 3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 flush status; -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; -(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +m NULL NULL NULL @@ -6921,7 +7007,9 @@ Handler_read_rnd_deleted 0 Handler_read_rnd_next 22 set @@expensive_subquery_limit= default; EXPLAIN -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 @@ -6931,9 +7019,11 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) 3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 flush status; -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; -(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +m NULL NULL NULL @@ -7382,6 +7472,17 @@ a drop table t1,t2,t3; # End of 10.2 tests # +# MDEV-29926: ASAN heap-use-after-free in Explain_query::~Explain_query +# +CREATE TABLE t (a VARCHAR(1)) CHARACTER SET utf8mb3; +EXECUTE IMMEDIATE "SELECT COUNT(*) FROM t WHERE a < (SELECT 'x')"; +COUNT(*) +0 +DROP TABLE t; +# +# End of 10.3 tests +# +# # Start of 10.4 tests # # diff --git a/mysql-test/main/subselect.test b/mysql-test/main/subselect.test index 19c30bd6dc87b..0f6032fb14871 100644 --- a/mysql-test/main/subselect.test +++ b/mysql-test/main/subselect.test @@ -75,13 +75,16 @@ SELECT ROW(1,2,3) = (SELECT 1,2,3); SELECT ROW(1,2,3) = (SELECT 1,2,1); SELECT ROW(1,2,3) < (SELECT 1,2,1); SELECT ROW(1,2,3) > (SELECT 1,2,1); +#enable after fix MDEV-28585 +--disable_view_protocol SELECT ROW(1,2,3) = (SELECT 1,2,NULL); -SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a'); -SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b'); -SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b'); -SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); -SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a'); -SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); +--enable_view_protocol +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m; +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m; +SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m; +SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a') AS m; +SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a') AS m; +SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a') AS m; -- error ER_OPERAND_COLUMNS SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a); @@ -119,8 +122,15 @@ set optimizer_switch=@tmp_optimizer_switch; select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1); select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a > t1.a) order by 1 desc limit 1); select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1); -select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; -explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; +select + b, + (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m +from t4; +explain extended +select + b, + (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m +from t4; select * from t3 where exists (select * from t2 where t2.b=t3.a); select * from t3 where not exists (select * from t2 where t2.b=t3.a); select * from t3 where a in (select b from t2); @@ -145,18 +155,34 @@ select * from t3 where a in (select a,b from t2); select * from t3 where a in (select * from t2); insert into t4 values (12,7),(1,7),(10,9),(9,6),(7,6),(3,9),(1,10); # empty set + select b,max(a) as ma from t4 group by b having b < (select max(t2.a) from t2 where t2.b=t4.b); insert into t2 values (2,10); select b,max(a) as ma from t4 group by b having ma < (select max(t2.a) from t2 where t2.b=t4.b); delete from t2 where a=2 and b=10; select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 where t2.b=t4.b); create table t5 (a int); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; + +select + (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, + a +from t2; insert into t5 values (5); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; +select + (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, + a +from t2; insert into t5 values (2); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; +select + (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, + a +from t2; +explain extended +select + (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, + a +from t2; + -- error ER_SUBQUERY_NO_1_ROW select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); @@ -260,13 +286,19 @@ SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic HAVING t SELECT * from t2 where topic = any (SELECT SUM(topic) FROM t1); SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic); SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100); -SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2; +SELECT + *, + topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) AS m +FROM t2; SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2); SELECT * from t2 where topic <> any (SELECT SUM(topic) FROM t2); SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000); SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000); SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000); -SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2; +SELECT + *, + topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) AS m +FROM t2; drop table t1,t2; #forumconthardwarefr7 @@ -467,6 +499,8 @@ INSERT INTO t1 values (1),(1); UPDATE t2 SET id=(SELECT * FROM t1); drop table t2, t1; +#enable after fix MDEV-28585 +--disable_view_protocol #NULL test create table t1 (a int); insert into t1 values (1),(2),(3); @@ -508,8 +542,18 @@ select 10.5 IN (SELECT * from t1); select 1.5 > ALL (SELECT * from t1); select 10.5 > ALL (SELECT * from t1); select 1.5 > ANY (SELECT * from t1); +update t1 set a=NULL where a=2.5; +select 1.5 IN (SELECT * from t1); +select 3.5 IN (SELECT * from t1); +select 10.5 IN (SELECT * from t1); +select 1.5 > ALL (SELECT * from t1); +select 10.5 > ALL (SELECT * from t1); +select 1.5 > ANY (SELECT * from t1); select 10.5 > ANY (SELECT * from t1); --enable_prepare_warnings +--enable_view_protocol +explain extended select (select a+1) from t1; +explain extended select (select a+1) from t1; explain extended select (select a+1) from t1; --disable_prepare_warnings select (select a+1) from t1; @@ -933,7 +977,7 @@ create table t3 (a int, b int); insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10); insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1); insert into t3 values (3,3), (2,2), (1,1); -select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3; +select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) as m from t3; drop table t1,t2,t3; # @@ -1051,7 +1095,7 @@ CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(1 INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1); CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1; INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status'); -select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid; +select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') as m FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') as m from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid; SELECT dbid, name FROM t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND ((date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')) AND t4.task_id = taskid; drop table t1,t2,t3,t4; @@ -1203,6 +1247,8 @@ drop table t1; # # ref_or_null replacing with ref # +#--view-protocol is disabled because view gives another query plan +--disable_view_protocol create table t1 (id int not null, text varchar(20) not null default '', primary key (id)); insert into t1 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text11'), (12, 'text12'); select * from t1 where id not in (select id from t1 where id < 8); @@ -1215,6 +1261,7 @@ insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, ' select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id); explain extended select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id); drop table t1,t2; +--enable_view_protocol # # Static tables & rund() in subqueries @@ -1422,12 +1469,14 @@ DROP TABLE t1; # # SELECT(EXISTS * ...)optimisation # +#--view-protocol is disabled because view gives another query plan +--disable_view_protocol create table t1 (a int, b int); insert into t1 values (1,2),(3,4); select * from t1 up where exists (select * from t1 where t1.a=up.a); explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a); drop table t1; - +--enable_view_protocol # # Bug#4102 subselect in HAVING @@ -2658,16 +2707,18 @@ DROP TABLE t1; # # Bug#21540 Subqueries with no from and aggregate functions return # wrong results + CREATE TABLE t1 (a INT, b INT); CREATE TABLE t2 (a INT); INSERT INTO t2 values (1); INSERT INTO t1 VALUES (1,1),(1,2),(2,3),(3,4); SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a; -SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) +SELECT + (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) AS m FROM t1 GROUP BY t1.a; SELECT COUNT(DISTINCT t1.b), (SELECT COUNT(DISTINCT t1.b)) FROM t1 GROUP BY t1.a; SELECT COUNT(DISTINCT t1.b), - (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) + (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) AS m FROM t1 GROUP BY t1.a; SELECT ( SELECT ( @@ -2681,12 +2732,11 @@ SELECT ( SELECT COUNT(DISTINCT t1.b) ) ) - FROM t1 GROUP BY t1.a LIMIT 1) + FROM t1 GROUP BY t1.a LIMIT 1) AS m FROM t1 t2 GROUP BY t2.a; DROP TABLE t1,t2; - # # Bug#21727 Correlated subquery that requires filesort: # slow with big sort_buffer_size @@ -2935,7 +2985,6 @@ SELECT COUNT(*) c, a, DROP table t1,t2; - # # Bug#27321 Wrong subquery result in a grouping select # @@ -2987,6 +3036,7 @@ SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a; SELECT a FROM t1 t0 WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a; +--disable_service_connection SET @@sql_mode='ansi'; --error ER_INVALID_GROUP_FUNC_USE SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a; @@ -2998,6 +3048,7 @@ SELECT a FROM t1 t0 WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a; SET @@sql_mode=default; +--enable_service_connection DROP TABLE t1; @@ -3116,6 +3167,7 @@ DROP TABLE t1,t2; # Bug#27333 subquery grouped for aggregate of outer query / no aggregate # of subquery # + CREATE TABLE t1 (a INTEGER, b INTEGER); CREATE TABLE t2 (x INTEGER); INSERT INTO t1 VALUES (1,11), (2,22), (2,22); @@ -3130,6 +3182,7 @@ SELECT a, COUNT(b), (SELECT COUNT(b) FROM t2) FROM t1 GROUP BY a; SELECT a, COUNT(b), (SELECT COUNT(b)+0 FROM t2) FROM t1 GROUP BY a; SELECT (SELECT SUM(t1.a)/AVG(t2.x) FROM t2) FROM t1; + DROP TABLE t1,t2; # second test case from 27333 @@ -3804,6 +3857,8 @@ SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a; SELECT a FROM t1 t0 WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a; +--disable_service_connection + SET @@sql_mode='ansi'; --error ER_INVALID_GROUP_FUNC_USE SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a; @@ -3815,6 +3870,8 @@ SELECT a FROM t1 t0 WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a; SET @@sql_mode=default; +--enable_service_connection + DROP TABLE t1; # @@ -5351,7 +5408,7 @@ INSERT INTO t3 VALUES (10,7), (0,7); SELECT SUM(DISTINCT b), (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0 - WHERE t.a != 0 AND t2.a != 0) + WHERE t.a != 0 AND t2.a != 0) AS m FROM (SELECT * FROM t3) AS t GROUP BY 2; @@ -5511,26 +5568,53 @@ INSERT INTO t3 VALUES (1,1),(2,2); set @old_optimizer_switch = @@session.optimizer_switch; set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off'; -SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2; -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2; -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2; -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1); -SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2; -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2; -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2; -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1); +SELECT + (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m +FROM t2; +SELECT + (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m + FROM t2; +SELECT + (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +SELECT + (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m; +SELECT + (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) AS m +FROM t2; +SELECT + (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +SELECT + (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +SELECT + (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m; set @@session.optimizer_switch=@old_optimizer_switch; # check different IN with default switches -SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2; -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2; -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2; -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1); -SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2; -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2; -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2; -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1); +SELECT + (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m +FROM t2; +SELECT + (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +SELECT + (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +SELECT + (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m; +SELECT + (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2 AS m; +SELECT + (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +SELECT + (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +SELECT + (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m; # other row operation with NULL single row subquery also should work select (null, null) = (null, null); @@ -5570,7 +5654,9 @@ INSERT INTO t3 VALUES (4),(5); SET optimizer_switch='subquery_cache=off'; -SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; +SELECT + ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) AS m +FROM t1; # This query just for example, it should return the same as above (1 and NULL) SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1; @@ -5760,12 +5846,16 @@ INSERT INTO t3 VALUES (8),(3); set @@expensive_subquery_limit= 0; EXPLAIN -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT + (SELECT MIN(b) FROM t1, t2 + WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; flush status; -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT + (SELECT MIN(b) FROM t1, t2 + WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; show status like "subquery_cache%"; @@ -5774,12 +5864,16 @@ show status like '%Handler_read%'; set @@expensive_subquery_limit= default; EXPLAIN -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT + (SELECT MIN(b) FROM t1, t2 + WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; flush status; -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT + (SELECT MIN(b) FROM t1, t2 + WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; show status like "subquery_cache%"; @@ -6058,7 +6152,10 @@ CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=MyISAM; INSERT t1 VALUES (4),(8); CREATE TABLE t2 (f2 INT, KEY(f2)) ENGINE=MyISAM; INSERT t2 VALUES (6); +#view definition cannot contain a subquery in the FROM clause +--disable_view_protocol SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2; +--enable_view_protocol --echo # --echo # Disable this query till MDEV-13399 is resolved --echo # @@ -6216,6 +6313,20 @@ drop table t1,t2,t3; --echo # End of 10.2 tests +--echo # +--echo # MDEV-29926: ASAN heap-use-after-free in Explain_query::~Explain_query +--echo # + +CREATE TABLE t (a VARCHAR(1)) CHARACTER SET utf8mb3; +EXECUTE IMMEDIATE "SELECT COUNT(*) FROM t WHERE a < (SELECT 'x')"; + +# Cleanup +DROP TABLE t; + +--echo # +--echo # End of 10.3 tests +--echo # + --echo # --echo # Start of 10.4 tests diff --git a/mysql-test/main/subselect2.result b/mysql-test/main/subselect2.result index 34e6e857d1422..e63636103017e 100644 --- a/mysql-test/main/subselect2.result +++ b/mysql-test/main/subselect2.result @@ -262,7 +262,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2c ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) 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`,`test`.`t1`.`c1` AS `c1` from `test`.`t1` where !<`test`.`t1`.`c1`,`test`.`t1`.`a`>((`test`.`t1`.`c1`,(/* select#2 */ select `test`.`t2a`.`c2` from `test`.`t2` `t2a` join `test`.`t2` `t2b` join `test`.`t2` `t2c` where (`test`.`t2b`.`m` <> `test`.`t1`.`a` or `test`.`t2b`.`m` = `test`.`t2a`.`m`) and trigcond((`test`.`t1`.`c1`) = `test`.`t2a`.`c2` or `test`.`t2a`.`c2` is null) and `test`.`t2c`.`c2` = `test`.`t2b`.`c2` and `test`.`t2b`.`n` = `test`.`t2a`.`m` having trigcond(`test`.`t2a`.`c2` is null)))) +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`c1` AS `c1` from `test`.`t1` where !<`test`.`t1`.`c1`,`test`.`t1`.`a`>((`test`.`t1`.`c1`,(/* select#2 */ select `test`.`t2a`.`c2` from `test`.`t2` `t2a` join `test`.`t2` `t2b` join `test`.`t2` `t2c` where `test`.`t2c`.`c2` = `test`.`t2b`.`c2` and `test`.`t2b`.`n` = `test`.`t2a`.`m` and (`test`.`t2b`.`m` <> `test`.`t1`.`a` or `test`.`t2b`.`m` = `test`.`t2a`.`m`) and trigcond((`test`.`t1`.`c1`) = `test`.`t2a`.`c2` or `test`.`t2a`.`c2` is null) having trigcond(`test`.`t2a`.`c2` is null)))) DROP TABLE t1,t2; # # MDEV-614, also MDEV-536, also LP:1050806: diff --git a/mysql-test/main/subselect2.test b/mysql-test/main/subselect2.test index 3b982b8b7d0fa..fcc39f7309728 100644 --- a/mysql-test/main/subselect2.test +++ b/mysql-test/main/subselect2.test @@ -264,6 +264,8 @@ set optimizer_switch=@tmp_mdev567; --echo # MDEV-4996: degenerate OR formula in WHERE of a subquery --echo # +--disable_view_protocol + CREATE TABLE t1 (a int, c1 varchar(1)) ENGINE=MyISAM; INSERT INTO t1 VALUES (2,'x'), (8,'d'); @@ -283,6 +285,8 @@ SELECT * FROM t1 WHERE c1 NOT IN ( DROP TABLE t1,t2; +--enable_view_protocol + --echo # --echo # MDEV-614, also MDEV-536, also LP:1050806: --echo # different result for a query using subquery between 5.5.25 and 5.5.27 diff --git a/mysql-test/main/subselect3.inc b/mysql-test/main/subselect3.inc index 8ed1c9ee21077..af7b45542bd9e 100644 --- a/mysql-test/main/subselect3.inc +++ b/mysql-test/main/subselect3.inc @@ -689,6 +689,8 @@ SELECT a AS x, ROW(11, 12) = (SELECT MAX(x), 12), ROW(11, 12) IN (SELECT MAX(x), DROP TABLE t1; +#enable after fix MDEV-28585 +--disable_view_protocol --echo # both columns should be same SELECT ROW(1,2) = (SELECT NULL, NULL), ROW(1,2) IN (SELECT NULL, NULL); SELECT ROW(1,2) = (SELECT 1, NULL), ROW(1,2) IN (SELECT 1, NULL); @@ -696,6 +698,7 @@ SELECT ROW(1,2) = (SELECT NULL, 2), ROW(1,2) IN (SELECT NULL, 2); SELECT ROW(1,2) = (SELECT NULL, 1), ROW(1,2) IN (SELECT NULL, 1); SELECT ROW(1,2) = (SELECT 1, 1), ROW(1,2) IN (SELECT 1, 1); SELECT ROW(1,2) = (SELECT 1, 2), ROW(1,2) IN (SELECT 1, 2); +--enable_view_protocol # # Bug #37362 Crash in do_field_eq diff --git a/mysql-test/main/subselect3.result b/mysql-test/main/subselect3.result index 299faadeff776..28187e0ffdd3c 100644 --- a/mysql-test/main/subselect3.result +++ b/mysql-test/main/subselect3.result @@ -169,7 +169,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ref a a 5 test.t1.b 1 100.00 Using where Warnings: Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<`test`.`t3`.`a`,`test`.`t3`.`oref`>((`test`.`t3`.`a`,(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond((`test`.`t3`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) and `test`.`t2`.`a` = `test`.`t1`.`b` having trigcond(`test`.`t1`.`a` is null)))) AS `Z` from `test`.`t3` +Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<`test`.`t3`.`a`,`test`.`t3`.`oref`>((`test`.`t3`.`a`,(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` and `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond((`test`.`t3`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) having trigcond(`test`.`t1`.`a` is null)))) AS `Z` from `test`.`t3` drop table t1, t2, t3; create table t1 (a int NOT NULL, b int NOT NULL, key(a)); insert into t1 values @@ -197,7 +197,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ref a a 4 test.t1.b 1 100.00 Using where Warnings: Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<`test`.`t3`.`a`,`test`.`t3`.`oref`>((`test`.`t3`.`a`,(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond((`test`.`t3`.`a`) = `test`.`t1`.`a`) and `test`.`t2`.`a` = `test`.`t1`.`b`))) AS `Z` from `test`.`t3` +Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<`test`.`t3`.`a`,`test`.`t3`.`oref`>((`test`.`t3`.`a`,(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` and `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond((`test`.`t3`.`a`) = `test`.`t1`.`a`)))) AS `Z` from `test`.`t3` drop table t1,t2,t3; create table t1 (oref int, grp int); insert into t1 (oref, grp) values @@ -1160,8 +1160,8 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY A ALL NULL NULL NULL NULL 10 1 PRIMARY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) 1 PRIMARY E ALL NULL NULL NULL NULL 5 Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY D ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) -1 PRIMARY C ALL NULL NULL NULL NULL 10 Using where; End temporary; Using join buffer (flat, BNL join) +1 PRIMARY C ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +1 PRIMARY D ALL NULL NULL NULL NULL 10 Using where; End temporary; Using join buffer (flat, BNL join) flush status; select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E where a+1 < 10000 + A.a + B.a +C.a+D.a); count(*) diff --git a/mysql-test/main/subselect3_jcl6.result b/mysql-test/main/subselect3_jcl6.result index aebeb4e0cc1ac..9df821e07dc60 100644 --- a/mysql-test/main/subselect3_jcl6.result +++ b/mysql-test/main/subselect3_jcl6.result @@ -172,7 +172,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ref a a 5 test.t1.b 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<`test`.`t3`.`a`,`test`.`t3`.`oref`>((`test`.`t3`.`a`,(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond((`test`.`t3`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) and `test`.`t2`.`a` = `test`.`t1`.`b` having trigcond(`test`.`t1`.`a` is null)))) AS `Z` from `test`.`t3` +Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<`test`.`t3`.`a`,`test`.`t3`.`oref`>((`test`.`t3`.`a`,(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` and `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond((`test`.`t3`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) having trigcond(`test`.`t1`.`a` is null)))) AS `Z` from `test`.`t3` drop table t1, t2, t3; create table t1 (a int NOT NULL, b int NOT NULL, key(a)); insert into t1 values @@ -200,7 +200,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ref a a 4 test.t1.b 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1 -Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<`test`.`t3`.`a`,`test`.`t3`.`oref`>((`test`.`t3`.`a`,(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond((`test`.`t3`.`a`) = `test`.`t1`.`a`) and `test`.`t2`.`a` = `test`.`t1`.`b`))) AS `Z` from `test`.`t3` +Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<`test`.`t3`.`a`,`test`.`t3`.`oref`>((`test`.`t3`.`a`,(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` and `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond((`test`.`t3`.`a`) = `test`.`t1`.`a`)))) AS `Z` from `test`.`t3` drop table t1,t2,t3; create table t1 (oref int, grp int); insert into t1 (oref, grp) values @@ -1163,8 +1163,8 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY A ALL NULL NULL NULL NULL 10 1 PRIMARY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) 1 PRIMARY E ALL NULL NULL NULL NULL 5 Using where; Start temporary; Using join buffer (incremental, BNL join) -1 PRIMARY D hash_ALL NULL #hash#$hj 5 test.E.a 10 Using where; Using join buffer (incremental, BNLH join) -1 PRIMARY C ALL NULL NULL NULL NULL 10 Using where; End temporary; Using join buffer (incremental, BNL join) +1 PRIMARY C ALL NULL NULL NULL NULL 10 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY D hash_ALL NULL #hash#$hj 5 test.E.a 10 Using where; End temporary; Using join buffer (incremental, BNLH join) flush status; select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E where a+1 < 10000 + A.a + B.a +C.a+D.a); count(*) diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result index 78df05f48590a..b0e08a360062b 100644 --- a/mysql-test/main/subselect4.result +++ b/mysql-test/main/subselect4.result @@ -20,8 +20,8 @@ WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3)) ORDER BY count(*); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 index NULL a 5 NULL 2 Using index -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table # should not crash the next statement SELECT 1 FROM t1 WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3)) @@ -1358,6 +1358,8 @@ INSERT IGNORE INTO t2 VALUES (8,0,0),(5,0,0); CREATE TABLE t3 (f4 int,KEY (f4)) ; INSERT IGNORE INTO t3 VALUES (0),(0); set @@optimizer_switch='semijoin=off'; +# NOTE: the following should have 'SUBQUERY', not 'DEPENDENT SUBQUERY' +# for line with id=2, see MDEV-27794. EXPLAIN SELECT * FROM t1 WHERE (SELECT f2 FROM t2 @@ -1367,7 +1369,7 @@ FROM t3 AS SQ1_t1 JOIN t3 AS SQ1_t3 ON SQ1_t3.f4 GROUP BY SQ1_t1.f4)); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where 3 SUBQUERY SQ1_t3 range f4 f4 5 NULL 2 Using where; Using index; Using temporary 3 SUBQUERY SQ1_t1 index NULL f4 5 NULL 2 Using index; Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE @@ -1675,7 +1677,7 @@ WHERE ( alias2.f1 , alias2.f2 ) IN ( SELECT max(f2) , f1 FROM t0 GROUP BY f2 , f f1 f2 8 8 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'u' +Warning 1292 Truncated incorrect DECIMAL value: 'u' EXPLAIN SELECT * FROM t2 WHERE (f1b, f2b) IN (SELECT max(f1a), f2a FROM t1 GROUP BY f1a, f2a); id select_type table type possible_keys key key_len ref rows Extra @@ -1709,7 +1711,7 @@ WHERE ( alias2.f1 , alias2.f2 ) IN ( SELECT max(f2) , f1 FROM t0 GROUP BY f2 , f f1 f2 8 8 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'u' +Warning 1292 Truncated incorrect DECIMAL value: 'u' EXPLAIN SELECT * FROM t2 WHERE (f1b, f2b) IN (SELECT max(f1a), f2a FROM t1 GROUP BY f1a, f2a); id select_type table type possible_keys key key_len ref rows Extra @@ -1901,8 +1903,8 @@ WHERE SUBQUERY2_t2.col_varchar_nokey IN (SELECT col_varchar_nokey FROM t1 GROUP BY col_varchar_nokey)); col_int_key Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'v' -Warning 1292 Truncated incorrect DOUBLE value: 'r' +Warning 1292 Truncated incorrect DECIMAL value: 'v' +Warning 1292 Truncated incorrect DECIMAL value: 'r' set @@optimizer_switch='subquery_cache=off,materialization=off,in_to_exists=on,semijoin=off'; EXPLAIN SELECT col_int_key @@ -1926,8 +1928,8 @@ WHERE SUBQUERY2_t2.col_varchar_nokey IN (SELECT col_varchar_nokey FROM t1 GROUP BY col_varchar_nokey)); col_int_key Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'v' -Warning 1292 Truncated incorrect DOUBLE value: 'r' +Warning 1292 Truncated incorrect DECIMAL value: 'v' +Warning 1292 Truncated incorrect DECIMAL value: 'r' drop table t1, t2; set @@optimizer_switch = @old_optimizer_switch; # @@ -2349,7 +2351,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 /* select#1 */ select 3 AS `f` from dual where !<3>((3,(/* select#2 */ select `test`.`t1`.`b` from `test`.`t1` where (`test`.`t1`.`c` = 'USA' or `test`.`t1`.`c` <> 'USA') and trigcond((3) = `test`.`t1`.`b` or `test`.`t1`.`b` is null) and `test`.`t1`.`b` = `test`.`t1`.`a` having trigcond(`test`.`t1`.`b` is null)))) +Note 1003 /* select#1 */ select 3 AS `f` from dual where !<3>((3,(/* select#2 */ select `test`.`t1`.`b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and (`test`.`t1`.`c` = 'USA' or `test`.`t1`.`c` <> 'USA') and trigcond((3) = `test`.`t1`.`b` or `test`.`t1`.`b` is null) having trigcond(`test`.`t1`.`b` is null)))) SELECT * FROM t2 WHERE f NOT IN (SELECT b FROM t1 WHERE 0 OR (c IN ('USA') OR c NOT IN ('USA')) AND a = b); @@ -2866,7 +2868,308 @@ FROM (t1 JOIN t1 AS ref_t1 ON (t1.i1 > (SELECT ref_t1.i1 AS c0 FROM t1 b ORDER BY -c0))); ERROR 21000: Subquery returns more than 1 row DROP TABLE t1; +# +# MDEV-22377: Subquery in an UPDATE query uses full scan instead of range +# +CREATE TABLE t1 ( +key1 varchar(30) NOT NULL, +col1 int(11) NOT NULL, +filler char(100) +); +insert into t1 select seq, seq, seq from seq_1_to_100; +CREATE TABLE t10 ( +key1 varchar(30) NOT NULL, +col1 int, +filler char(100), +PRIMARY KEY (key1) +); +insert into t10 select seq, seq, seq from seq_1_to_1000; +CREATE TABLE t11 ( +key1 varchar(30) NOT NULL, +filler char(100), +PRIMARY KEY (key1) +); +insert into t11 select seq, seq from seq_1_to_1000; +set @tmp_os=@@optimizer_switch; +set optimizer_switch='semijoin=off,materialization=off'; +# Must use range access (not full scan) for table tms: +explain select * from t1 hist +WHERE +key1 IN ('1','2','3','4','5','6','7','8','9','10') AND +hist.col1 NOT IN (SELECT tn.col1 +FROM t10 tn JOIN t11 tms ON tms.key1 = tn.key1 +WHERE tn.key1 IN ('1','2','3','4','5','6','7','8','9','10') +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY hist ALL NULL NULL NULL NULL 100 Using where +2 DEPENDENT SUBQUERY tms range PRIMARY PRIMARY 32 NULL 10 Using where; Using index +2 DEPENDENT SUBQUERY tn eq_ref PRIMARY PRIMARY 32 test.tms.key1 1 Using where +set optimizer_switch=@tmp_os; +drop table t1, t10, t11; +# +# MDEV-28268: Server crashes in Expression_cache_tracker::fetch_current_stats +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,2),(3,4); +ANALYZE FORMAT=JSON +SELECT DISTINCT +(SELECT MIN(a) FROM t1 WHERE b <= ANY (SELECT a FROM t1)) AS f +FROM t1; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "duplicate_removal": { + "temporary_table": { + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 2, + "r_rows": 2, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + } + } + ], + "subqueries": [ + { + "expression_cache": { + "state": "disabled", + "r_loops": 0, + "query_block": { + "select_id": 2, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 2, + "r_rows": 2, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 50, + "attached_condition": "((t1.b,(subquery#3) >= 4))" + } + } + ], + "subqueries": [ + { + "query_block": { + "select_id": 3, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 2, + "r_rows": 2, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + } + } + ] + } + } + ] + } + } + } + ] + } + } + } +} +DROP TABLE t1; # End of 10.2 tests +# +# MDEV-29139: Redundannt subquery in GROUP BY clause of ANY/ALL subquery +# +create table t1 (a int); +insert into t1 values (3), (1), (2); +create table t2 (b int not null); +insert into t2 values (4), (2); +create table t3 (c int); +insert into t3 values (7), (1); +explain extended select a from t1 +where a >= any (select b from t2 group by (select c from t3 where c = 1)); +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 +2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a`,(/* select#2 */ select min(`test`.`t2`.`b`) from `test`.`t2`) <= (`test`.`t1`.`a`))) +select a from t1 +where a >= any (select b from t2 group by (select c from t3 where c = 1)); +a +3 +2 +prepare stmt from "select a from t1 +where a >= any (select b from t2 group by (select c from t3 where c = 1))"; +execute stmt; +a +3 +2 +execute stmt; +a +3 +2 +deallocate prepare stmt; +explain extended select a from t1 +where a <= all (select b from t2 group by (select c from t3 where c = 1)); +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 +2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a`,(/* select#2 */ select min(`test`.`t2`.`b`) from `test`.`t2`) < (`test`.`t1`.`a`))) +select a from t1 +where a <= all (select b from t2 group by (select c from t3 where c = 1)); +a +1 +2 +explain extended select a from t1 +where a >= any (select b from t2 group by 1 + (select c from t3 where c = 1)); +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 +2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a`,(/* select#2 */ select min(`test`.`t2`.`b`) from `test`.`t2`) <= (`test`.`t1`.`a`))) +select a from t1 +where a >= any (select b from t2 group by 1 + (select c from t3 where c = 1)); +a +3 +2 +drop table t1,t2,t3; +# +# MDEV-29139: Redundant IN/ALL/ANY predicand in GROUP BY clause of +# IN/ALL/ANY/EXISTS subquery +# +create table t1 (a int); +create table t2 (b int); +create table t3 (c int); +create table t4 (d int); +insert into t1 values (3), (1); +insert into t2 values (3), (2); +insert into t3 values (4), (2); +insert into t4 values (1), (7); +explain extended select b from t2 +where exists (select c from t3 +group by (select a from t1 where a = 1) in (select d from t4)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where 1 +select b from t2 +where exists (select c from t3 +group by (select a from t1 where a = 1) in (select d from t4)); +b +3 +2 +prepare stmt from "select b from t2 +where exists (select c from t3 +group by (select a from t1 where a = 1) in (select d from t4))"; +execute stmt; +b +3 +2 +execute stmt; +b +3 +2 +deallocate prepare stmt; +explain extended select b from t2 +where exists (select c from t3 +group by (select a from t1 where a = 1) >= +any (select d from t4)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where 1 +select b from t2 +where exists (select c from t3 +group by (select a from t1 where a = 1) >= +any (select d from t4)); +b +3 +2 +explain extended select b from t2 +where exists (select c from t3 +group by (select a from t1 where a = 1) < +all (select d from t4)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where 1 +select b from t2 +where exists (select c from t3 +group by (select a from t1 where a = 1) < +all (select d from t4)); +b +3 +2 +explain extended select b from t2 +where b in (select c from t3 +group by (select a from t1 where a = 1) in (select d from t4)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 select `test`.`t2`.`b` AS `b` from `test`.`t2` semi join (`test`.`t3`) where 1 +select b from t2 +where b in (select c from t3 +group by (select a from t1 where a = 1) in (select d from t4)); +b +2 +explain extended select b from t2 +where b >= any (select c from t3 +group by (select a from t1 where a = 1) in +(select d from t4)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where ((`test`.`t2`.`b`,(/* select#2 */ select min(`test`.`t3`.`c`) from `test`.`t3`) <= (`test`.`t2`.`b`))) +select b from t2 +where b >= any (select c from t3 +group by (select a from t1 where a = 1) in +(select d from t4)); +b +3 +2 +explain extended select b from t2 +where b <= all (select c from t3 +group by (select a from t1 where a = 1) in +(select d from t4)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where ((`test`.`t2`.`b`,(/* select#2 */ select `test`.`t3`.`c` from `test`.`t3`) < (`test`.`t2`.`b`))) +select b from t2 +where b <= all (select c from t3 +group by (select a from t1 where a = 1) in +(select d from t4)); +b +2 +drop table t1,t2,t3,t4; # End of 10.3 tests # # MDEV-19134: EXISTS() slower if ORDER BY is defined diff --git a/mysql-test/main/subselect4.test b/mysql-test/main/subselect4.test index 8be44f214f05d..2bbdb54b9c8a1 100644 --- a/mysql-test/main/subselect4.test +++ b/mysql-test/main/subselect4.test @@ -1,5 +1,8 @@ # General purpose bug fix tests go here : subselect.test too large +#remove this include after fix MDEV-27871, MDEV-27957 +--source include/no_view_protocol.inc + --source include/default_optimizer_switch.inc --disable_warnings @@ -1041,6 +1044,8 @@ INSERT IGNORE INTO t3 VALUES (0),(0); set @@optimizer_switch='semijoin=off'; +--echo # NOTE: the following should have 'SUBQUERY', not 'DEPENDENT SUBQUERY' +--echo # for line with id=2, see MDEV-27794. EXPLAIN SELECT * FROM t1 WHERE (SELECT f2 FROM t2 @@ -2380,8 +2385,179 @@ FROM (t1 JOIN t1 AS ref_t1 ON DROP TABLE t1; +--echo # +--echo # MDEV-22377: Subquery in an UPDATE query uses full scan instead of range +--echo # + +CREATE TABLE t1 ( + key1 varchar(30) NOT NULL, + col1 int(11) NOT NULL, + filler char(100) +); +insert into t1 select seq, seq, seq from seq_1_to_100; + +CREATE TABLE t10 ( + key1 varchar(30) NOT NULL, + col1 int, + filler char(100), + PRIMARY KEY (key1) +); +insert into t10 select seq, seq, seq from seq_1_to_1000; + +CREATE TABLE t11 ( + key1 varchar(30) NOT NULL, + filler char(100), + PRIMARY KEY (key1) +); +insert into t11 select seq, seq from seq_1_to_1000; + + +set @tmp_os=@@optimizer_switch; +set optimizer_switch='semijoin=off,materialization=off'; + +--echo # Must use range access (not full scan) for table tms: +explain select * from t1 hist +WHERE + key1 IN ('1','2','3','4','5','6','7','8','9','10') AND + hist.col1 NOT IN (SELECT tn.col1 + FROM t10 tn JOIN t11 tms ON tms.key1 = tn.key1 + WHERE tn.key1 IN ('1','2','3','4','5','6','7','8','9','10') + ); + +set optimizer_switch=@tmp_os; + +drop table t1, t10, t11; + +--echo # +--echo # MDEV-28268: Server crashes in Expression_cache_tracker::fetch_current_stats +--echo # +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,2),(3,4); + +--source include/analyze-format.inc +ANALYZE FORMAT=JSON +SELECT DISTINCT + (SELECT MIN(a) FROM t1 WHERE b <= ANY (SELECT a FROM t1)) AS f +FROM t1; + +# Cleanup +DROP TABLE t1; + --echo # End of 10.2 tests + +--echo # +--echo # MDEV-29139: Redundannt subquery in GROUP BY clause of ANY/ALL subquery +--echo # + +create table t1 (a int); +insert into t1 values (3), (1), (2); +create table t2 (b int not null); +insert into t2 values (4), (2); +create table t3 (c int); +insert into t3 values (7), (1); + +let $q1= +select a from t1 + where a >= any (select b from t2 group by (select c from t3 where c = 1)); + +eval explain extended $q1; +eval $q1; + +eval prepare stmt from "$q1"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +let $q2= +select a from t1 + where a <= all (select b from t2 group by (select c from t3 where c = 1)); + +eval explain extended $q2; +eval $q2; + +let $q3= +select a from t1 + where a >= any (select b from t2 group by 1 + (select c from t3 where c = 1)); +eval explain extended $q3; +eval $q3; + +drop table t1,t2,t3; + +--echo # +--echo # MDEV-29139: Redundant IN/ALL/ANY predicand in GROUP BY clause of +--echo # IN/ALL/ANY/EXISTS subquery +--echo # + +create table t1 (a int); +create table t2 (b int); +create table t3 (c int); +create table t4 (d int); + +insert into t1 values (3), (1); +insert into t2 values (3), (2); +insert into t3 values (4), (2); +insert into t4 values (1), (7); + +let $q1= +select b from t2 + where exists (select c from t3 + group by (select a from t1 where a = 1) in (select d from t4)); + +eval explain extended $q1; +eval $q1; + +eval prepare stmt from "$q1"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +let $q2= +select b from t2 + where exists (select c from t3 + group by (select a from t1 where a = 1) >= + any (select d from t4)); + +eval explain extended $q2; +eval $q2; + +let $q3= +select b from t2 + where exists (select c from t3 + group by (select a from t1 where a = 1) < + all (select d from t4)); + +eval explain extended $q3; +eval $q3; + +let $q4= +select b from t2 + where b in (select c from t3 + group by (select a from t1 where a = 1) in (select d from t4)); + +eval explain extended $q4; +eval $q4; + +let $q5= +select b from t2 + where b >= any (select c from t3 + group by (select a from t1 where a = 1) in + (select d from t4)); + +eval explain extended $q5; +eval $q5; + +let $q6= +select b from t2 + where b <= all (select c from t3 + group by (select a from t1 where a = 1) in + (select d from t4)); + +eval explain extended $q6; +eval $q6; + +drop table t1,t2,t3,t4; + --echo # End of 10.3 tests --echo # diff --git a/mysql-test/main/subselect_cache.result b/mysql-test/main/subselect_cache.result index 132e870a860bf..e859ebbd2e8ee 100644 --- a/mysql-test/main/subselect_cache.result +++ b/mysql-test/main/subselect_cache.result @@ -2889,70 +2889,70 @@ WHERE table1 .`col_varchar_key` ) field10 1 NULL w 1 NULL y Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' SET @@optimizer_switch='subquery_cache=on'; /* cache is on */ SELECT COUNT( DISTINCT table2 .`col_int_key` ) , ( SELECT SUBQUERY2_t1 .`col_int_key` @@ -2980,32 +2980,32 @@ WHERE table1 .`col_varchar_key` ) field10 1 NULL w 1 NULL y Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'c' -Warning 1292 Truncated incorrect DOUBLE value: 'd' -Warning 1292 Truncated incorrect DOUBLE value: 'e' -Warning 1292 Truncated incorrect DOUBLE value: 'f' -Warning 1292 Truncated incorrect DOUBLE value: 'g' -Warning 1292 Truncated incorrect DOUBLE value: 'h' -Warning 1292 Truncated incorrect DOUBLE value: 'i' -Warning 1292 Truncated incorrect DOUBLE value: 'j' -Warning 1292 Truncated incorrect DOUBLE value: 'k' -Warning 1292 Truncated incorrect DOUBLE value: 'l' -Warning 1292 Truncated incorrect DOUBLE value: 'm' -Warning 1292 Truncated incorrect DOUBLE value: 'n' -Warning 1292 Truncated incorrect DOUBLE value: 'o' -Warning 1292 Truncated incorrect DOUBLE value: 'p' -Warning 1292 Truncated incorrect DOUBLE value: 'q' -Warning 1292 Truncated incorrect DOUBLE value: 'r' -Warning 1292 Truncated incorrect DOUBLE value: 's' -Warning 1292 Truncated incorrect DOUBLE value: 't' -Warning 1292 Truncated incorrect DOUBLE value: 'u' -Warning 1292 Truncated incorrect DOUBLE value: 'v' -Warning 1292 Truncated incorrect DOUBLE value: 'w' -Warning 1292 Truncated incorrect DOUBLE value: 'x' -Warning 1292 Truncated incorrect DOUBLE value: 'y' -Warning 1292 Truncated incorrect DOUBLE value: 'z' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'd' +Warning 1292 Truncated incorrect DECIMAL value: 'e' +Warning 1292 Truncated incorrect DECIMAL value: 'f' +Warning 1292 Truncated incorrect DECIMAL value: 'g' +Warning 1292 Truncated incorrect DECIMAL value: 'h' +Warning 1292 Truncated incorrect DECIMAL value: 'i' +Warning 1292 Truncated incorrect DECIMAL value: 'j' +Warning 1292 Truncated incorrect DECIMAL value: 'k' +Warning 1292 Truncated incorrect DECIMAL value: 'l' +Warning 1292 Truncated incorrect DECIMAL value: 'm' +Warning 1292 Truncated incorrect DECIMAL value: 'n' +Warning 1292 Truncated incorrect DECIMAL value: 'o' +Warning 1292 Truncated incorrect DECIMAL value: 'p' +Warning 1292 Truncated incorrect DECIMAL value: 'q' +Warning 1292 Truncated incorrect DECIMAL value: 'r' +Warning 1292 Truncated incorrect DECIMAL value: 's' +Warning 1292 Truncated incorrect DECIMAL value: 't' +Warning 1292 Truncated incorrect DECIMAL value: 'u' +Warning 1292 Truncated incorrect DECIMAL value: 'v' +Warning 1292 Truncated incorrect DECIMAL value: 'w' +Warning 1292 Truncated incorrect DECIMAL value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'y' +Warning 1292 Truncated incorrect DECIMAL value: 'z' drop table t1,t2,t3,t4; set @@optimizer_switch= default; #launchpad BUG#609045 @@ -3430,9 +3430,9 @@ WHERE table1 .`col_varchar_key` ) field10 1 NULL d 1 NULL f Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'f' -Warning 1292 Truncated incorrect DOUBLE value: 'f' -Warning 1292 Truncated incorrect DOUBLE value: 'f' +Warning 1292 Truncated incorrect DECIMAL value: 'f' +Warning 1292 Truncated incorrect DECIMAL value: 'f' +Warning 1292 Truncated incorrect DECIMAL value: 'f' SET @@optimizer_switch = 'subquery_cache=on'; /* cache is on */ SELECT COUNT( DISTINCT table2 .`col_int_key` ) , ( SELECT SUBQUERY2_t1 .`col_int_key` @@ -3447,9 +3447,9 @@ WHERE table1 .`col_varchar_key` ) field10 1 NULL d 1 NULL f Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'f' -Warning 1292 Truncated incorrect DOUBLE value: 'f' -Warning 1292 Truncated incorrect DOUBLE value: 'f' +Warning 1292 Truncated incorrect DECIMAL value: 'f' +Warning 1292 Truncated incorrect DECIMAL value: 'f' +Warning 1292 Truncated incorrect DECIMAL value: 'f' drop table t1,t2,t3,t4; set @@optimizer_switch= default; #launchpad BUG#611625 diff --git a/mysql-test/main/subselect_cache.test b/mysql-test/main/subselect_cache.test index 8fcecf1281b9c..cf647afb9941c 100644 --- a/mysql-test/main/subselect_cache.test +++ b/mysql-test/main/subselect_cache.test @@ -1,3 +1,7 @@ +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + --disable_warnings drop table if exists t0,t1,t2,t3,t4,t5,t6,t7,t8,t9; drop view if exists v1; diff --git a/mysql-test/main/subselect_exists2in.test b/mysql-test/main/subselect_exists2in.test index e70d643138bd4..8ad89be2b65b8 100644 --- a/mysql-test/main/subselect_exists2in.test +++ b/mysql-test/main/subselect_exists2in.test @@ -270,6 +270,8 @@ INSERT INTO t3 VALUES (4),(5); SET optimizer_switch='exists_to_in=on,subquery_cache=off,materialization=on,in_to_exists=off,semijoin=off'; +#enable after fix MDEV-27871 +--disable_view_protocol explain extended SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; @@ -325,6 +327,8 @@ set optimizer_switch='exists_to_in=on'; drop table t1,t3; +--enable_view_protocol + --echo # --echo # MDEV-159 Assertion about not marked for read failed in --echo # String* Field_varstring::val_str(String*, String*) @@ -400,6 +404,9 @@ set optimizer_switch='exists_to_in=on'; --echo # --echo # MDEV-160 Exists2In: Crash in in hp_movelink with subquery_cache=ON --echo # +#--view-protocol is disabled because view gives another query plan +--disable_view_protocol + SET optimizer_switch = 'in_to_exists=on,subquery_cache=on,exists_to_in=on'; CREATE TABLE t1 ( @@ -512,6 +519,8 @@ WHERE EXISTS ( SELECT 1 FROM t2 WHERE b = alias1.a AND b > alias2.b ) OR a = 5; +--enable_view_protocol + drop table t1, t2; set optimizer_switch=default; set optimizer_switch='exists_to_in=on'; @@ -776,12 +785,16 @@ SELECT STRAIGHT_JOIN sq1.f2 set @optimizer_switch_save=@@optimizer_switch; +#--view-protocol is disabled because view gives another query plan +--disable_view_protocol + set optimizer_switch='exists_to_in=off'; eval explain extended $q; eval $q; set optimizer_switch='exists_to_in=on'; eval explain extended $q; eval $q; +--enable_view_protocol set optimizer_switch= @optimizer_switch_save; diff --git a/mysql-test/main/subselect_extra.test b/mysql-test/main/subselect_extra.test index 3651aed9aab48..3f2f7b611fff2 100644 --- a/mysql-test/main/subselect_extra.test +++ b/mysql-test/main/subselect_extra.test @@ -40,6 +40,9 @@ drop tables t1, t2; --echo # --echo # Bug #32694: NOT NULL table field in a subquery produces invalid results --echo # +#--view-protocol is disabled because view gives another query plan +--disable_view_protocol + create table t1 (id int(10) not null, cur_date datetime not null); create table t2 (id int(10) not null, cur_date date not null); insert into t1 (id, cur_date) values (1, '2007-04-25 18:30:22'); @@ -73,6 +76,7 @@ select * from t2 where id in (select id from t2 as x1 where (t2.cur_date is null)); drop table t1,t2; +--enable_view_protocol --echo # --echo # From group_min_max.test diff --git a/mysql-test/main/subselect_extra_no_semijoin.test b/mysql-test/main/subselect_extra_no_semijoin.test index 681f92bd8c448..448f52a81e944 100644 --- a/mysql-test/main/subselect_extra_no_semijoin.test +++ b/mysql-test/main/subselect_extra_no_semijoin.test @@ -12,6 +12,8 @@ set @optimizer_switch_for_subselect_extra_test=null; --echo # MDEV-6439: Server crashes in Explain_union::print_explain with explain in slow log, tis620 charset --echo # +--disable_service_connection + ## Using a separate client connection is easier than restoring state connect(con1,localhost,root,,); @@ -36,3 +38,5 @@ drop table t1,t2; SET GLOBAL slow_query_log=@tmp; disconnect con1; connection default; + +--enable_service_connection diff --git a/mysql-test/main/subselect_innodb.result b/mysql-test/main/subselect_innodb.result index abc429fb55081..242b01f89550f 100644 --- a/mysql-test/main/subselect_innodb.result +++ b/mysql-test/main/subselect_innodb.result @@ -155,6 +155,9 @@ EXECUTE my_stmt; b count(*) deallocate prepare my_stmt; drop table t1,t2; +# +# End of 4.1 tests +# CREATE TABLE t1 ( school_name varchar(45) NOT NULL, country varchar(45) NOT NULL, @@ -288,7 +291,6 @@ LIMIT 10; col_time_key col_datetime_key DROP TABLE t1; DROP TABLE t2; -# End of Bug #58756 # # Bug#60085 crash in Item::save_in_field() with time data type # @@ -357,7 +359,9 @@ LIMIT 1; maxkey NULL DROP TABLE t1,t2; -End of 5.1 tests +# +# End of 5.1 tests +# # # lp:827416 Crash in select_describe() on EXPLAIN with DISTINCT in nested subqueries # @@ -578,7 +582,7 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DEPENDENT SUBQUERY t2 ref key1 key1 5 test.t1.a # Using where; Using filesort drop table t1,t2; # -# mdev-12931: semi-join in ON expression of STRAIGHT_JOIN +# MDEV-12931: semi-join in ON expression of STRAIGHT_JOIN # joining a base table and a mergeable derived table # CREATE TABLE t1 (f1 int) ENGINE=InnoDB; @@ -630,6 +634,52 @@ a b 2019-03-10 02:55:05 2019-03-10 02:55:05 DROP TABLE t1,t2; set character_set_connection=@save_character_set_connection; +# +# MDEV-26047: MariaDB server crash at Item_subselect::init_expr_cache_tracker +# +CREATE TABLE t1 (a int) engine=innodb; +SELECT 1 IN ( +SELECT NULL +FROM t1 +WHERE +a IS NOT NULL +GROUP BY +(SELECT NULL from dual WHERE a = 1) +); +1 IN ( +SELECT NULL +FROM t1 +WHERE +a IS NOT NULL +GROUP BY +(SELECT NULL from dual WHERE a = 1) +) +0 +drop table t1; +# Testcase from MDEV-26164 +create table t1(a int); +# Disable the warning as it includes current time and changes for every test run. +select 1 from t1 where not exists +( +select 1 from t1 where binary current_time() +group by (select a),(select 1) +); +1 +drop table t1; +# +# MDEV-28437: Assertion `!eliminated' failed in Item_subselect::exec +# +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (3),(4); +SELECT 1 IN (SELECT a FROM t1 LEFT JOIN t2 ON (a = b AND EXISTS (SELECT * FROM t1))); +1 IN (SELECT a FROM t1 LEFT JOIN t2 ON (a = b AND EXISTS (SELECT * FROM t1))) +1 +drop table t1,t2; +# +# End of 10.2 tests +# # # MDEV-17362: SIGSEGV in JOIN::optimize_inner or Assertion `fixed == 0' # failed in Item_equal::fix_fields, server crashes after 2nd execution @@ -663,5 +713,19 @@ a b execute stmt; a b drop table t1,t2; +# +# MDEV-28097 use-after-free when WHERE has subquery with an outer reference in HAVING +# +create table t1 (a text(60) not null) engine=innodb; +insert into t1 values ('1'),('0'); +select distinct a from t1 where '' in (select 'x' like a having a like a); +a +1 +0 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '' +drop table t1; +# # End of 10.4 tests +# SET GLOBAL innodb_stats_persistent = @saved_stats_persistent; diff --git a/mysql-test/main/subselect_innodb.test b/mysql-test/main/subselect_innodb.test index 19871e14008ba..e354ddc44960c 100644 --- a/mysql-test/main/subselect_innodb.test +++ b/mysql-test/main/subselect_innodb.test @@ -1,3 +1,4 @@ +-- source include/no_valgrind_without_big.inc -- source include/have_innodb.inc # Note: the tests uses only non-semijoin subqueries so semi-join switch @@ -32,7 +33,10 @@ CREATE INDEX CMFLDRPARNT_IDX ON t1 (PARENTID); INSERT INTO t1 VALUES("0c9aab05b15048c59bc35c8461507deb", "System", "System", "2003-06-05 16:30:00", "The system content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "9c9aab05b15048c59bc35c8461507deb", "1"); INSERT INTO t1 VALUES("2f6161e879db43c1a5b82c21ddc49089", "Default", "System", "2003-06-09 10:52:02", "The default content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "03eea05112b845949f3fd03278b5fe43", "1"); INSERT INTO t1 VALUES("c373e9f5ad0791724315444553544200", "AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", "2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1'); +--enable_view_protocol drop table t1; # @@ -69,7 +73,10 @@ CREATE TABLE t2 ( INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t3 VALUES (1,1),(2,2),(3,3); INSERT INTO t2 VALUES (1,1),(2,2),(3,3); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT distinct p1.processor_id, (SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.processor_id and p2.processor_id = y.processor_id) FROM t1 p1; +--enable_view_protocol drop table t2,t1,t3; # @@ -163,7 +170,9 @@ EXECUTE my_stmt; deallocate prepare my_stmt; drop table t1,t2; -# End of 4.1 tests +--echo # +--echo # End of 4.1 tests +--echo # CREATE TABLE t1 ( school_name varchar(45) NOT NULL, @@ -205,6 +214,8 @@ CREATE TABLE `t3` ( `t3_id` int NOT NULL ); INSERT INTO `t3` VALUES (3); +#enable after fix MDEV-27871 +--disable_view_protocol select (SELECT rs.t2_id FROM t2 rs @@ -214,6 +225,7 @@ select WHERE lt.t3_id=a.t3_id) ORDER BY b DESC LIMIT 1) from t3 AS a; +--enable_view_protocol # repeat above query in SP --disable_warnings DROP PROCEDURE IF EXISTS p1; @@ -288,8 +300,6 @@ LIMIT 10; DROP TABLE t1; DROP TABLE t2; ---echo # End of Bug #58756 - --echo # --echo # Bug#60085 crash in Item::save_in_field() with time data type --echo # @@ -353,7 +363,9 @@ eval $query; DROP TABLE t1,t2; ---echo End of 5.1 tests +--echo # +--echo # End of 5.1 tests +--echo # --echo # --echo # lp:827416 Crash in select_describe() on EXPLAIN with DISTINCT in nested subqueries @@ -506,8 +518,6 @@ drop table t1,t2; --echo # for a subquery from the expression used in ref access --echo # ---source include/have_innodb.inc - CREATE TABLE t1 (i1 INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2); @@ -577,7 +587,7 @@ from drop table t1,t2; --echo # ---echo # mdev-12931: semi-join in ON expression of STRAIGHT_JOIN +--echo # MDEV-12931: semi-join in ON expression of STRAIGHT_JOIN --echo # joining a base table and a mergeable derived table --echo # @@ -627,6 +637,52 @@ DROP TABLE t1,t2; set character_set_connection=@save_character_set_connection; +--echo # +--echo # MDEV-26047: MariaDB server crash at Item_subselect::init_expr_cache_tracker +--echo # +CREATE TABLE t1 (a int) engine=innodb; +#enable abter fix MDEV-27871 +--disable_view_protocol +SELECT 1 IN ( + SELECT NULL + FROM t1 + WHERE + a IS NOT NULL + GROUP BY + (SELECT NULL from dual WHERE a = 1) +); +--enable_view_protocol +drop table t1; + +--echo # Testcase from MDEV-26164 +create table t1(a int); +--echo # Disable the warning as it includes current time and changes for every test run. +--disable_warnings +select 1 from t1 where not exists +( + select 1 from t1 where binary current_time() + group by (select a),(select 1) +); +--enable_warnings +drop table t1; + +--echo # +--echo # MDEV-28437: Assertion `!eliminated' failed in Item_subselect::exec +--echo # +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (3),(4); +#enable after fix MDEV-27871 +--disable_view_protocol +SELECT 1 IN (SELECT a FROM t1 LEFT JOIN t2 ON (a = b AND EXISTS (SELECT * FROM t1))); +--enable_view_protocol +drop table t1,t2; + +--echo # +--echo # End of 10.2 tests +--echo # + --echo # --echo # MDEV-17362: SIGSEGV in JOIN::optimize_inner or Assertion `fixed == 0' --echo # failed in Item_equal::fix_fields, server crashes after 2nd execution @@ -660,6 +716,16 @@ execute stmt; drop table t1,t2; +--echo # +--echo # MDEV-28097 use-after-free when WHERE has subquery with an outer reference in HAVING +--echo # +create table t1 (a text(60) not null) engine=innodb; +insert into t1 values ('1'),('0'); +select distinct a from t1 where '' in (select 'x' like a having a like a); +drop table t1; + +--echo # --echo # End of 10.4 tests +--echo # SET GLOBAL innodb_stats_persistent = @saved_stats_persistent; diff --git a/mysql-test/main/subselect_mat.result b/mysql-test/main/subselect_mat.result index 980db9f3ee153..271b3c18a3047 100644 --- a/mysql-test/main/subselect_mat.result +++ b/mysql-test/main/subselect_mat.result @@ -173,7 +173,7 @@ t2i_c CREATE TABLE `t2i_c` ( KEY `it2i1` (`b1`), KEY `it2i2` (`b2`), KEY `it2i3` (`b1`,`b2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci explain extended select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1); id select_type table type possible_keys key key_len ref rows filtered Extra @@ -578,9 +578,9 @@ select * from t1 group by (a1 in (select col from columns)); a1 a2 1 - 00 2 - 00 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1 - 00' -Warning 1292 Truncated incorrect DOUBLE value: '1 - 01' -Warning 1292 Truncated incorrect DOUBLE value: '1 - 02' +Warning 1292 Truncated incorrect DECIMAL value: '1 - 00' +Warning 1292 Truncated incorrect DECIMAL value: '1 - 01' +Warning 1292 Truncated incorrect DECIMAL value: '1 - 02' /* ORDER BY clause */ explain extended select * from t1 order by (select col from columns limit 1); diff --git a/mysql-test/main/subselect_mat.test b/mysql-test/main/subselect_mat.test index fc43d19ae11e7..cacafb0000f2c 100644 --- a/mysql-test/main/subselect_mat.test +++ b/mysql-test/main/subselect_mat.test @@ -192,6 +192,8 @@ INSERT INTO t2 VALUES (1000,6,2); set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off'; +#enable after fix MDEV-27871 +--disable_view_protocol EXPLAIN SELECT (f1, f2, f3) NOT IN (SELECT COUNT(DISTINCT f2), f1, f3 FROM t1 GROUP BY f1, f3) @@ -201,6 +203,8 @@ SELECT (f1, f2, f3) NOT IN (SELECT COUNT(DISTINCT f2), f1, f3 FROM t1 GROUP BY f1, f3) FROM t2; +--enable_view_protocol + drop table t1, t2; --echo # diff --git a/mysql-test/main/subselect_mat_cost_bugs.result b/mysql-test/main/subselect_mat_cost_bugs.result index 6a218ed5e04d4..1889291398cbc 100644 --- a/mysql-test/main/subselect_mat_cost_bugs.result +++ b/mysql-test/main/subselect_mat_cost_bugs.result @@ -100,7 +100,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 index c3 c3 9 NULL 2 100.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1 -Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where <`test`.`t1`.`c1`,`test`.`t1`.`pk`>((`test`.`t1`.`c1`,(/* select#2 */ select `test`.`t1a`.`c1` from `test`.`t1b` join `test`.`t2` left join `test`.`t1a` on(`test`.`t1a`.`c2` = `test`.`t1b`.`pk` and 2) where `test`.`t1`.`pk` <> 0 and (`test`.`t1`.`c1`) = `test`.`t1a`.`c1` and `test`.`t2`.`c3` = `test`.`t1b`.`c4`))) +Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where <`test`.`t1`.`c1`,`test`.`t1`.`pk`>((`test`.`t1`.`c1`,(/* select#2 */ select `test`.`t1a`.`c1` from `test`.`t1b` join `test`.`t2` left join `test`.`t1a` on(`test`.`t1a`.`c2` = `test`.`t1b`.`pk` and 2) where `test`.`t2`.`c3` = `test`.`t1b`.`c4` and `test`.`t1`.`pk` <> 0 and (`test`.`t1`.`c1`) = `test`.`t1a`.`c1`))) SELECT pk FROM t1 WHERE c1 IN @@ -209,8 +209,8 @@ WHERE (t1.f1>0 or t1.f1<0) AND alias2.f10 ORDER BY field1 ; field1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'f' -Warning 1292 Truncated incorrect DOUBLE value: 'd' +Warning 1292 Truncated incorrect DECIMAL value: 'f' +Warning 1292 Truncated incorrect DECIMAL value: 'd' set optimizer_switch=@tmp_optimizer_switch; drop table t1,t2; # @@ -273,8 +273,8 @@ WHERE alias1.f11 OR alias1.f3 = 50 AND alias1.f10 ); f12 f13 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'f' -Warning 1292 Truncated incorrect DOUBLE value: 'd' +Warning 1292 Truncated incorrect DECIMAL value: 'f' +Warning 1292 Truncated incorrect DECIMAL value: 'd' EXPLAIN SELECT * FROM t2 WHERE ( f12 ) IN ( @@ -292,8 +292,8 @@ FROM t1 AS alias1, t1 AS alias2 WHERE (alias2.f10 = alias1.f11) AND (alias1.f11 OR alias1.f3 = 50 AND alias1.f10)); f12 f13 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'f' -Warning 1292 Truncated incorrect DOUBLE value: 'd' +Warning 1292 Truncated incorrect DECIMAL value: 'f' +Warning 1292 Truncated incorrect DECIMAL value: 'd' set @@optimizer_switch=@save_optimizer_switch; drop table t1, t2; # @@ -364,7 +364,7 @@ AND a = SOME (SELECT b FROM t5)); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where 2 DEPENDENT SUBQUERY t5 index c c 10 NULL 2 Using where; Using index; Start temporary -2 DEPENDENT SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 test.t5.b 1 Using index condition; Using where; End temporary +2 DEPENDENT SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 test.t5.b 1 Using where; End temporary SELECT * FROM t3 WHERE t3.b > ALL ( diff --git a/mysql-test/main/subselect_mat_cost_bugs.test b/mysql-test/main/subselect_mat_cost_bugs.test index ba1aad06a1595..4f837efcdd8e2 100644 --- a/mysql-test/main/subselect_mat_cost_bugs.test +++ b/mysql-test/main/subselect_mat_cost_bugs.test @@ -442,10 +442,13 @@ INSERT INTO t1 VALUES (1,'foo','bar'),(2,'bar','foo'); CREATE TABLE t2 (pk2 INT PRIMARY KEY, a2 VARCHAR(3), KEY(a2)) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,'abc'),(2,'xyz'),(3,'foo'); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT 'qux' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 ); SELECT 'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 ); EXPLAIN SELECT 'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 ); +--enable_view_protocol DROP TABLE t1,t2; diff --git a/mysql-test/main/subselect_no_exists_to_in.result b/mysql-test/main/subselect_no_exists_to_in.result index 70add4d174099..c7fc78ce28ec1 100644 --- a/mysql-test/main/subselect_no_exists_to_in.result +++ b/mysql-test/main/subselect_no_exists_to_in.result @@ -122,30 +122,30 @@ ROW(1,2,3) > (SELECT 1,2,1) SELECT ROW(1,2,3) = (SELECT 1,2,NULL); ROW(1,2,3) = (SELECT 1,2,NULL) NULL -SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a'); -(SELECT 1.5,2,'a') = ROW(1.5,2,'a') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m; +m 1 -SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b'); -(SELECT 1.5,2,'a') = ROW(1.5,2,'b') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m; +m 0 -SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b'); -(SELECT 1.5,2,'a') = ROW('1.5b',2,'b') +SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m; +m 0 Warnings: Warning 1292 Truncated incorrect DOUBLE value: '1.5b' -SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); -(SELECT 'b',2,'a') = ROW(1.5,2,'a') +SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a') AS m; +m 0 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'b' -SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a'); -(SELECT 1.5,2,'a') = ROW(1.5,'2','a') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a') AS m; +m 1 -SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); -(SELECT 1.5,'c','a') = ROW(1.5,2,'a') +SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a') AS m; +m 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'c' SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a); ERROR 21000: Operand should contain 1 column(s) SELECT 1 as a,(SELECT a+a) b,(SELECT b); @@ -232,19 +232,26 @@ a 2 select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1); a -select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; -b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) +select +b, +(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m +from t4; +b m 8 7.5000 8 4.5000 9 7.5000 -explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; +explain extended +select +b, +(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m +from t4; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` +Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `m` from `test`.`t4` select * from t3 where exists (select * from t2 where t2.b=t3.a); a 7 @@ -311,21 +318,34 @@ select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 w b ma 7 12 create table t5 (a int); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 insert into t5 values (5); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 insert into t5 values (2); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 -explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; +explain extended +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 @@ -334,7 +354,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 /* select#1 */ select <`test`.`t2`.`a`>((/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` +Note 1003 /* select#1 */ select <`test`.`t2`.`a`>((/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `m`,`test`.`t2`.`a` AS `a` from `test`.`t2` select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; ERROR 21000: Subquery returns more than 1 row create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); @@ -490,8 +510,11 @@ SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING t mot topic date pseudo joce 40143 2002-10-22 joce joce 43506 2002-10-22 joce -SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2; -mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) +SELECT +*, +topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) AS m +FROM t2; +mot topic date pseudo m joce 40143 2002-10-22 joce 1 joce 43506 2002-10-22 joce 1 SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2); @@ -509,8 +532,11 @@ joce 40143 2002-10-22 joce SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000); mot topic date pseudo joce 40143 2002-10-22 joce -SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2; -mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) +SELECT +*, +topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) AS m +FROM t2; +mot topic date pseudo m joce 40143 2002-10-22 joce 1 joce 43506 2002-10-22 joce 0 drop table t1,t2; @@ -883,6 +909,25 @@ NULL select 1.5 > ANY (SELECT * from t1); 1.5 > ANY (SELECT * from t1) NULL +update t1 set a=NULL where a=2.5; +select 1.5 IN (SELECT * from t1); +1.5 IN (SELECT * from t1) +1 +select 3.5 IN (SELECT * from t1); +3.5 IN (SELECT * from t1) +1 +select 10.5 IN (SELECT * from t1); +10.5 IN (SELECT * from t1) +NULL +select 1.5 > ALL (SELECT * from t1); +1.5 > ALL (SELECT * from t1) +0 +select 10.5 > ALL (SELECT * from t1); +10.5 > ALL (SELECT * from t1) +NULL +select 1.5 > ANY (SELECT * from t1); +1.5 > ANY (SELECT * from t1) +NULL select 10.5 > ANY (SELECT * from t1); 10.5 > ANY (SELECT * from t1) 1 @@ -893,6 +938,20 @@ Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` +explain extended select (select a+1) from t1; +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 +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` +explain extended select (select a+1) from t1; +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 +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` select (select a+1) from t1; (select a+1) 2.5 @@ -1238,7 +1297,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT 1)` int(1) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a; SHOW CREATE TABLE t1; @@ -1246,7 +1305,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT a)` int(1) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a; SHOW CREATE TABLE t1; @@ -1254,7 +1313,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT a+0)` int(3) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a; select * from t1; @@ -1263,8 +1322,8 @@ a SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(3) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` int(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int); insert into t1 values (1), (2), (3); @@ -1534,8 +1593,8 @@ create table t3 (a int, b int); insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10); insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1); insert into t3 values (3,3), (2,2), (1,1); -select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3; -a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) +select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) as m from t3; +a m 3 1 2 2 1 2 @@ -1730,8 +1789,8 @@ CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(1 INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1); CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1; INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status'); -select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid; -dbid name (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') +select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') as m FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') as m from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid; +dbid name m -1 Valid 1 -1 Valid 2 1 -1 Should Not Return 0 @@ -3195,13 +3254,13 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `sub_a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t3 AS (SELECT a FROM t1 WHERE a < '2000-01-01') UNION (SELECT a FROM t1 WHERE a > '2000-01-01'); SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2,t3; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (1), (2); @@ -3785,9 +3844,10 @@ SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a; 2 1 1 -SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) +SELECT +(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) AS m FROM t1 GROUP BY t1.a; -(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) +m 2 1 1 @@ -3797,9 +3857,9 @@ COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b)) 1 1 1 1 SELECT COUNT(DISTINCT t1.b), -(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) +(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) AS m FROM t1 GROUP BY t1.a; -COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) +COUNT(DISTINCT t1.b) m 2 2 1 1 1 1 @@ -3823,16 +3883,10 @@ SELECT ( SELECT COUNT(DISTINCT t1.b) ) ) -FROM t1 GROUP BY t1.a LIMIT 1) +FROM t1 GROUP BY t1.a LIMIT 1) AS m FROM t1 t2 GROUP BY t2.a; -( -SELECT ( -SELECT ( -SELECT COUNT(DISTINCT t1.b) -) -) -FROM t1 GROUP BY t1.a LIMIT 1) +m 2 2 2 @@ -4684,7 +4738,7 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -5967,7 +6021,7 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -6348,10 +6402,10 @@ ORDER BY b ); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) @@ -6359,10 +6413,10 @@ GROUP BY b ); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' DROP TABLE t1, t2; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6423,11 +6477,10 @@ CREATE TABLE t3 (a int, b int); INSERT INTO t3 VALUES (10,7), (0,7); SELECT SUM(DISTINCT b), (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0 -WHERE t.a != 0 AND t2.a != 0) +WHERE t.a != 0 AND t2.a != 0) AS m FROM (SELECT * FROM t3) AS t GROUP BY 2; -SUM(DISTINCT b) (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0 -WHERE t.a != 0 AND t2.a != 0) +SUM(DISTINCT b) m 7 NULL SELECT SUM(DISTINCT b), (SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1) @@ -6560,66 +6613,93 @@ CREATE TABLE t3 (f3a int default 1, f3b int default 2); INSERT INTO t3 VALUES (1,1),(2,2); set @old_optimizer_switch = @@session.optimizer_switch; set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off'; -SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m; +m NULL -SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m; +m NULL set @@session.optimizer_switch=@old_optimizer_switch; -SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m; +m NULL -SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2; +SELECT +(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2 AS m; (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m; +m NULL select (null, null) = (null, null); (null, null) = (null, null) @@ -6665,8 +6745,10 @@ INSERT INTO t2 VALUES (1); CREATE TABLE t3 ( c INT ); INSERT INTO t3 VALUES (4),(5); SET optimizer_switch='subquery_cache=off'; -SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; -( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) +SELECT +( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) AS m +FROM t1; +m 1 NULL SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1; @@ -6883,7 +6965,9 @@ CREATE TABLE t3 (c INT); INSERT INTO t3 VALUES (8),(3); set @@expensive_subquery_limit= 0; EXPLAIN -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 @@ -6893,9 +6977,11 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) 3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 flush status; -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; -(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +m NULL NULL NULL @@ -6921,7 +7007,9 @@ Handler_read_rnd_deleted 0 Handler_read_rnd_next 22 set @@expensive_subquery_limit= default; EXPLAIN -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 @@ -6931,9 +7019,11 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) 3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 flush status; -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; -(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +m NULL NULL NULL @@ -7382,6 +7472,17 @@ a drop table t1,t2,t3; # End of 10.2 tests # +# MDEV-29926: ASAN heap-use-after-free in Explain_query::~Explain_query +# +CREATE TABLE t (a VARCHAR(1)) CHARACTER SET utf8mb3; +EXECUTE IMMEDIATE "SELECT COUNT(*) FROM t WHERE a < (SELECT 'x')"; +COUNT(*) +0 +DROP TABLE t; +# +# End of 10.3 tests +# +# # Start of 10.4 tests # # diff --git a/mysql-test/main/subselect_no_mat.result b/mysql-test/main/subselect_no_mat.result index f0c7033803c9c..5998be625350a 100644 --- a/mysql-test/main/subselect_no_mat.result +++ b/mysql-test/main/subselect_no_mat.result @@ -125,30 +125,30 @@ ROW(1,2,3) > (SELECT 1,2,1) SELECT ROW(1,2,3) = (SELECT 1,2,NULL); ROW(1,2,3) = (SELECT 1,2,NULL) NULL -SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a'); -(SELECT 1.5,2,'a') = ROW(1.5,2,'a') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m; +m 1 -SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b'); -(SELECT 1.5,2,'a') = ROW(1.5,2,'b') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m; +m 0 -SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b'); -(SELECT 1.5,2,'a') = ROW('1.5b',2,'b') +SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m; +m 0 Warnings: Warning 1292 Truncated incorrect DOUBLE value: '1.5b' -SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); -(SELECT 'b',2,'a') = ROW(1.5,2,'a') +SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a') AS m; +m 0 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'b' -SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a'); -(SELECT 1.5,2,'a') = ROW(1.5,'2','a') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a') AS m; +m 1 -SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); -(SELECT 1.5,'c','a') = ROW(1.5,2,'a') +SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a') AS m; +m 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'c' SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a); ERROR 21000: Operand should contain 1 column(s) SELECT 1 as a,(SELECT a+a) b,(SELECT b); @@ -235,19 +235,26 @@ a 2 select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1); a -select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; -b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) +select +b, +(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m +from t4; +b m 8 7.5000 8 4.5000 9 7.5000 -explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; +explain extended +select +b, +(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m +from t4; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` +Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `m` from `test`.`t4` select * from t3 where exists (select * from t2 where t2.b=t3.a); a 7 @@ -314,21 +321,34 @@ select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 w b ma 7 12 create table t5 (a int); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 insert into t5 values (5); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 insert into t5 values (2); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 -explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; +explain extended +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 @@ -337,7 +357,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 /* select#1 */ select <`test`.`t2`.`a`>((/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` +Note 1003 /* select#1 */ select <`test`.`t2`.`a`>((/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `m`,`test`.`t2`.`a` AS `a` from `test`.`t2` select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; ERROR 21000: Subquery returns more than 1 row create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); @@ -493,8 +513,11 @@ SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING t mot topic date pseudo joce 40143 2002-10-22 joce joce 43506 2002-10-22 joce -SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2; -mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) +SELECT +*, +topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) AS m +FROM t2; +mot topic date pseudo m joce 40143 2002-10-22 joce 1 joce 43506 2002-10-22 joce 1 SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2); @@ -512,8 +535,11 @@ joce 40143 2002-10-22 joce SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000); mot topic date pseudo joce 40143 2002-10-22 joce -SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2; -mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) +SELECT +*, +topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) AS m +FROM t2; +mot topic date pseudo m joce 40143 2002-10-22 joce 1 joce 43506 2002-10-22 joce 0 drop table t1,t2; @@ -886,6 +912,25 @@ NULL select 1.5 > ANY (SELECT * from t1); 1.5 > ANY (SELECT * from t1) NULL +update t1 set a=NULL where a=2.5; +select 1.5 IN (SELECT * from t1); +1.5 IN (SELECT * from t1) +1 +select 3.5 IN (SELECT * from t1); +3.5 IN (SELECT * from t1) +1 +select 10.5 IN (SELECT * from t1); +10.5 IN (SELECT * from t1) +NULL +select 1.5 > ALL (SELECT * from t1); +1.5 > ALL (SELECT * from t1) +0 +select 10.5 > ALL (SELECT * from t1); +10.5 > ALL (SELECT * from t1) +NULL +select 1.5 > ANY (SELECT * from t1); +1.5 > ANY (SELECT * from t1) +NULL select 10.5 > ANY (SELECT * from t1); 10.5 > ANY (SELECT * from t1) 1 @@ -896,6 +941,20 @@ Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` +explain extended select (select a+1) from t1; +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 +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` +explain extended select (select a+1) from t1; +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 +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` select (select a+1) from t1; (select a+1) 2.5 @@ -1241,7 +1300,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT 1)` int(1) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a; SHOW CREATE TABLE t1; @@ -1249,7 +1308,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT a)` int(1) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a; SHOW CREATE TABLE t1; @@ -1257,7 +1316,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT a+0)` int(3) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a; select * from t1; @@ -1266,8 +1325,8 @@ a SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(3) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` int(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int); insert into t1 values (1), (2), (3); @@ -1537,8 +1596,8 @@ create table t3 (a int, b int); insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10); insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1); insert into t3 values (3,3), (2,2), (1,1); -select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3; -a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) +select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) as m from t3; +a m 3 1 2 2 1 2 @@ -1733,8 +1792,8 @@ CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(1 INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1); CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1; INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status'); -select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid; -dbid name (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') +select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') as m FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') as m from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid; +dbid name m -1 Valid 1 -1 Valid 2 1 -1 Should Not Return 0 @@ -3197,13 +3256,13 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `sub_a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t3 AS (SELECT a FROM t1 WHERE a < '2000-01-01') UNION (SELECT a FROM t1 WHERE a > '2000-01-01'); SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2,t3; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (1), (2); @@ -3785,9 +3844,10 @@ SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a; 2 1 1 -SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) +SELECT +(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) AS m FROM t1 GROUP BY t1.a; -(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) +m 2 1 1 @@ -3797,9 +3857,9 @@ COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b)) 1 1 1 1 SELECT COUNT(DISTINCT t1.b), -(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) +(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) AS m FROM t1 GROUP BY t1.a; -COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) +COUNT(DISTINCT t1.b) m 2 2 1 1 1 1 @@ -3823,16 +3883,10 @@ SELECT ( SELECT COUNT(DISTINCT t1.b) ) ) -FROM t1 GROUP BY t1.a LIMIT 1) +FROM t1 GROUP BY t1.a LIMIT 1) AS m FROM t1 t2 GROUP BY t2.a; -( -SELECT ( -SELECT ( -SELECT COUNT(DISTINCT t1.b) -) -) -FROM t1 GROUP BY t1.a LIMIT 1) +m 2 2 2 @@ -4682,7 +4736,7 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -5964,7 +6018,7 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -6343,10 +6397,10 @@ ORDER BY b ); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) @@ -6354,10 +6408,10 @@ GROUP BY b ); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' DROP TABLE t1, t2; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6418,11 +6472,10 @@ CREATE TABLE t3 (a int, b int); INSERT INTO t3 VALUES (10,7), (0,7); SELECT SUM(DISTINCT b), (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0 -WHERE t.a != 0 AND t2.a != 0) +WHERE t.a != 0 AND t2.a != 0) AS m FROM (SELECT * FROM t3) AS t GROUP BY 2; -SUM(DISTINCT b) (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0 -WHERE t.a != 0 AND t2.a != 0) +SUM(DISTINCT b) m 7 NULL SELECT SUM(DISTINCT b), (SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1) @@ -6555,66 +6608,93 @@ CREATE TABLE t3 (f3a int default 1, f3b int default 2); INSERT INTO t3 VALUES (1,1),(2,2); set @old_optimizer_switch = @@session.optimizer_switch; set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off'; -SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m; +m NULL -SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m; +m NULL set @@session.optimizer_switch=@old_optimizer_switch; -SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m; +m NULL -SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2; +SELECT +(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2 AS m; (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m; +m NULL select (null, null) = (null, null); (null, null) = (null, null) @@ -6660,8 +6740,10 @@ INSERT INTO t2 VALUES (1); CREATE TABLE t3 ( c INT ); INSERT INTO t3 VALUES (4),(5); SET optimizer_switch='subquery_cache=off'; -SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; -( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) +SELECT +( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) AS m +FROM t1; +m 1 NULL SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1; @@ -6877,7 +6959,9 @@ CREATE TABLE t3 (c INT); INSERT INTO t3 VALUES (8),(3); set @@expensive_subquery_limit= 0; EXPLAIN -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 @@ -6887,9 +6971,11 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) 3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 flush status; -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; -(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +m NULL NULL NULL @@ -6915,7 +7001,9 @@ Handler_read_rnd_deleted 0 Handler_read_rnd_next 22 set @@expensive_subquery_limit= default; EXPLAIN -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 @@ -6925,9 +7013,11 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) 3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 flush status; -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; -(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +m NULL NULL NULL @@ -7375,6 +7465,17 @@ a drop table t1,t2,t3; # End of 10.2 tests # +# MDEV-29926: ASAN heap-use-after-free in Explain_query::~Explain_query +# +CREATE TABLE t (a VARCHAR(1)) CHARACTER SET utf8mb3; +EXECUTE IMMEDIATE "SELECT COUNT(*) FROM t WHERE a < (SELECT 'x')"; +COUNT(*) +0 +DROP TABLE t; +# +# End of 10.3 tests +# +# # Start of 10.4 tests # # diff --git a/mysql-test/main/subselect_no_opts.result b/mysql-test/main/subselect_no_opts.result index 8ff79c1790bc0..4d3ecfd70e154 100644 --- a/mysql-test/main/subselect_no_opts.result +++ b/mysql-test/main/subselect_no_opts.result @@ -121,30 +121,30 @@ ROW(1,2,3) > (SELECT 1,2,1) SELECT ROW(1,2,3) = (SELECT 1,2,NULL); ROW(1,2,3) = (SELECT 1,2,NULL) NULL -SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a'); -(SELECT 1.5,2,'a') = ROW(1.5,2,'a') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m; +m 1 -SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b'); -(SELECT 1.5,2,'a') = ROW(1.5,2,'b') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m; +m 0 -SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b'); -(SELECT 1.5,2,'a') = ROW('1.5b',2,'b') +SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m; +m 0 Warnings: Warning 1292 Truncated incorrect DOUBLE value: '1.5b' -SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); -(SELECT 'b',2,'a') = ROW(1.5,2,'a') +SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a') AS m; +m 0 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'b' -SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a'); -(SELECT 1.5,2,'a') = ROW(1.5,'2','a') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a') AS m; +m 1 -SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); -(SELECT 1.5,'c','a') = ROW(1.5,2,'a') +SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a') AS m; +m 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'c' SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a); ERROR 21000: Operand should contain 1 column(s) SELECT 1 as a,(SELECT a+a) b,(SELECT b); @@ -231,19 +231,26 @@ a 2 select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1); a -select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; -b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) +select +b, +(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m +from t4; +b m 8 7.5000 8 4.5000 9 7.5000 -explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; +explain extended +select +b, +(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m +from t4; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,(/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` +Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,(/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`) AS `m` from `test`.`t4` select * from t3 where exists (select * from t2 where t2.b=t3.a); a 7 @@ -310,21 +317,34 @@ select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 w b ma 7 12 create table t5 (a int); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 insert into t5 values (5); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 insert into t5 values (2); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 -explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; +explain extended +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 @@ -333,7 +353,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 /* select#1 */ select (/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` +Note 1003 /* select#1 */ select (/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`) AS `m`,`test`.`t2`.`a` AS `a` from `test`.`t2` select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; ERROR 21000: Subquery returns more than 1 row create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); @@ -489,8 +509,11 @@ SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING t mot topic date pseudo joce 40143 2002-10-22 joce joce 43506 2002-10-22 joce -SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2; -mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) +SELECT +*, +topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) AS m +FROM t2; +mot topic date pseudo m joce 40143 2002-10-22 joce 1 joce 43506 2002-10-22 joce 1 SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2); @@ -508,8 +531,11 @@ joce 40143 2002-10-22 joce SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000); mot topic date pseudo joce 40143 2002-10-22 joce -SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2; -mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) +SELECT +*, +topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) AS m +FROM t2; +mot topic date pseudo m joce 40143 2002-10-22 joce 1 joce 43506 2002-10-22 joce 0 drop table t1,t2; @@ -882,6 +908,25 @@ NULL select 1.5 > ANY (SELECT * from t1); 1.5 > ANY (SELECT * from t1) NULL +update t1 set a=NULL where a=2.5; +select 1.5 IN (SELECT * from t1); +1.5 IN (SELECT * from t1) +1 +select 3.5 IN (SELECT * from t1); +3.5 IN (SELECT * from t1) +1 +select 10.5 IN (SELECT * from t1); +10.5 IN (SELECT * from t1) +NULL +select 1.5 > ALL (SELECT * from t1); +1.5 > ALL (SELECT * from t1) +0 +select 10.5 > ALL (SELECT * from t1); +10.5 > ALL (SELECT * from t1) +NULL +select 1.5 > ANY (SELECT * from t1); +1.5 > ANY (SELECT * from t1) +NULL select 10.5 > ANY (SELECT * from t1); 10.5 > ANY (SELECT * from t1) 1 @@ -892,6 +937,20 @@ Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` +explain extended select (select a+1) from t1; +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 +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` +explain extended select (select a+1) from t1; +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 +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` select (select a+1) from t1; (select a+1) 2.5 @@ -1237,7 +1296,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT 1)` int(1) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a; SHOW CREATE TABLE t1; @@ -1245,7 +1304,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT a)` int(1) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a; SHOW CREATE TABLE t1; @@ -1253,7 +1312,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT a+0)` int(3) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a; select * from t1; @@ -1262,8 +1321,8 @@ a SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(3) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` int(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int); insert into t1 values (1), (2), (3); @@ -1533,8 +1592,8 @@ create table t3 (a int, b int); insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10); insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1); insert into t3 values (3,3), (2,2), (1,1); -select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3; -a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) +select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) as m from t3; +a m 3 1 2 2 1 2 @@ -1729,8 +1788,8 @@ CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(1 INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1); CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1; INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status'); -select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid; -dbid name (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') +select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') as m FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') as m from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid; +dbid name m -1 Valid 1 -1 Valid 2 1 -1 Should Not Return 0 @@ -3193,13 +3252,13 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `sub_a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t3 AS (SELECT a FROM t1 WHERE a < '2000-01-01') UNION (SELECT a FROM t1 WHERE a > '2000-01-01'); SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2,t3; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (1), (2); @@ -3781,9 +3840,10 @@ SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a; 2 1 1 -SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) +SELECT +(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) AS m FROM t1 GROUP BY t1.a; -(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) +m 2 1 1 @@ -3793,9 +3853,9 @@ COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b)) 1 1 1 1 SELECT COUNT(DISTINCT t1.b), -(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) +(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) AS m FROM t1 GROUP BY t1.a; -COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) +COUNT(DISTINCT t1.b) m 2 2 1 1 1 1 @@ -3819,16 +3879,10 @@ SELECT ( SELECT COUNT(DISTINCT t1.b) ) ) -FROM t1 GROUP BY t1.a LIMIT 1) +FROM t1 GROUP BY t1.a LIMIT 1) AS m FROM t1 t2 GROUP BY t2.a; -( -SELECT ( -SELECT ( -SELECT COUNT(DISTINCT t1.b) -) -) -FROM t1 GROUP BY t1.a LIMIT 1) +m 2 2 2 @@ -4678,7 +4732,7 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -5960,7 +6014,7 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -6339,10 +6393,10 @@ ORDER BY b ); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) @@ -6350,10 +6404,10 @@ GROUP BY b ); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' DROP TABLE t1, t2; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6414,11 +6468,10 @@ CREATE TABLE t3 (a int, b int); INSERT INTO t3 VALUES (10,7), (0,7); SELECT SUM(DISTINCT b), (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0 -WHERE t.a != 0 AND t2.a != 0) +WHERE t.a != 0 AND t2.a != 0) AS m FROM (SELECT * FROM t3) AS t GROUP BY 2; -SUM(DISTINCT b) (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0 -WHERE t.a != 0 AND t2.a != 0) +SUM(DISTINCT b) m 7 NULL SELECT SUM(DISTINCT b), (SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1) @@ -6551,66 +6604,93 @@ CREATE TABLE t3 (f3a int default 1, f3b int default 2); INSERT INTO t3 VALUES (1,1),(2,2); set @old_optimizer_switch = @@session.optimizer_switch; set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off'; -SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m; +m NULL -SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m; +m NULL set @@session.optimizer_switch=@old_optimizer_switch; -SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m; +m NULL -SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2; +SELECT +(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2 AS m; (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m; +m NULL select (null, null) = (null, null); (null, null) = (null, null) @@ -6656,8 +6736,10 @@ INSERT INTO t2 VALUES (1); CREATE TABLE t3 ( c INT ); INSERT INTO t3 VALUES (4),(5); SET optimizer_switch='subquery_cache=off'; -SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; -( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) +SELECT +( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) AS m +FROM t1; +m 1 NULL SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1; @@ -6874,7 +6956,9 @@ CREATE TABLE t3 (c INT); INSERT INTO t3 VALUES (8),(3); set @@expensive_subquery_limit= 0; EXPLAIN -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 @@ -6884,9 +6968,11 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) 3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 flush status; -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; -(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +m NULL NULL NULL @@ -6912,7 +6998,9 @@ Handler_read_rnd_deleted 0 Handler_read_rnd_next 22 set @@expensive_subquery_limit= default; EXPLAIN -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 @@ -6922,9 +7010,11 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) 3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 flush status; -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; -(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +m NULL NULL NULL @@ -7373,6 +7463,17 @@ a drop table t1,t2,t3; # End of 10.2 tests # +# MDEV-29926: ASAN heap-use-after-free in Explain_query::~Explain_query +# +CREATE TABLE t (a VARCHAR(1)) CHARACTER SET utf8mb3; +EXECUTE IMMEDIATE "SELECT COUNT(*) FROM t WHERE a < (SELECT 'x')"; +COUNT(*) +0 +DROP TABLE t; +# +# End of 10.3 tests +# +# # Start of 10.4 tests # # diff --git a/mysql-test/main/subselect_no_scache.result b/mysql-test/main/subselect_no_scache.result index 37ca0d4c030ac..7991829cd49cc 100644 --- a/mysql-test/main/subselect_no_scache.result +++ b/mysql-test/main/subselect_no_scache.result @@ -124,30 +124,30 @@ ROW(1,2,3) > (SELECT 1,2,1) SELECT ROW(1,2,3) = (SELECT 1,2,NULL); ROW(1,2,3) = (SELECT 1,2,NULL) NULL -SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a'); -(SELECT 1.5,2,'a') = ROW(1.5,2,'a') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m; +m 1 -SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b'); -(SELECT 1.5,2,'a') = ROW(1.5,2,'b') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m; +m 0 -SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b'); -(SELECT 1.5,2,'a') = ROW('1.5b',2,'b') +SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m; +m 0 Warnings: Warning 1292 Truncated incorrect DOUBLE value: '1.5b' -SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); -(SELECT 'b',2,'a') = ROW(1.5,2,'a') +SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a') AS m; +m 0 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'b' -SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a'); -(SELECT 1.5,2,'a') = ROW(1.5,'2','a') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a') AS m; +m 1 -SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); -(SELECT 1.5,'c','a') = ROW(1.5,2,'a') +SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a') AS m; +m 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'c' SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a); ERROR 21000: Operand should contain 1 column(s) SELECT 1 as a,(SELECT a+a) b,(SELECT b); @@ -234,19 +234,26 @@ a 2 select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1); a -select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; -b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) +select +b, +(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m +from t4; +b m 8 7.5000 8 4.5000 9 7.5000 -explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; +explain extended +select +b, +(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m +from t4; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,(/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` +Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,(/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`) AS `m` from `test`.`t4` select * from t3 where exists (select * from t2 where t2.b=t3.a); a 7 @@ -313,21 +320,34 @@ select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 w b ma 7 12 create table t5 (a int); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 insert into t5 values (5); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 insert into t5 values (2); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 -explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; +explain extended +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 @@ -336,7 +356,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 /* select#1 */ select (/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` +Note 1003 /* select#1 */ select (/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`) AS `m`,`test`.`t2`.`a` AS `a` from `test`.`t2` select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; ERROR 21000: Subquery returns more than 1 row create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); @@ -492,8 +512,11 @@ SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING t mot topic date pseudo joce 40143 2002-10-22 joce joce 43506 2002-10-22 joce -SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2; -mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) +SELECT +*, +topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) AS m +FROM t2; +mot topic date pseudo m joce 40143 2002-10-22 joce 1 joce 43506 2002-10-22 joce 1 SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2); @@ -511,8 +534,11 @@ joce 40143 2002-10-22 joce SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000); mot topic date pseudo joce 40143 2002-10-22 joce -SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2; -mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) +SELECT +*, +topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) AS m +FROM t2; +mot topic date pseudo m joce 40143 2002-10-22 joce 1 joce 43506 2002-10-22 joce 0 drop table t1,t2; @@ -885,6 +911,25 @@ NULL select 1.5 > ANY (SELECT * from t1); 1.5 > ANY (SELECT * from t1) NULL +update t1 set a=NULL where a=2.5; +select 1.5 IN (SELECT * from t1); +1.5 IN (SELECT * from t1) +1 +select 3.5 IN (SELECT * from t1); +3.5 IN (SELECT * from t1) +1 +select 10.5 IN (SELECT * from t1); +10.5 IN (SELECT * from t1) +NULL +select 1.5 > ALL (SELECT * from t1); +1.5 > ALL (SELECT * from t1) +0 +select 10.5 > ALL (SELECT * from t1); +10.5 > ALL (SELECT * from t1) +NULL +select 1.5 > ANY (SELECT * from t1); +1.5 > ANY (SELECT * from t1) +NULL select 10.5 > ANY (SELECT * from t1); 10.5 > ANY (SELECT * from t1) 1 @@ -895,6 +940,20 @@ Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` +explain extended select (select a+1) from t1; +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 +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` +explain extended select (select a+1) from t1; +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 +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` select (select a+1) from t1; (select a+1) 2.5 @@ -1240,7 +1299,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT 1)` int(1) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a; SHOW CREATE TABLE t1; @@ -1248,7 +1307,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT a)` int(1) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a; SHOW CREATE TABLE t1; @@ -1256,7 +1315,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT a+0)` int(3) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a; select * from t1; @@ -1265,8 +1324,8 @@ a SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(3) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` int(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int); insert into t1 values (1), (2), (3); @@ -1536,8 +1595,8 @@ create table t3 (a int, b int); insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10); insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1); insert into t3 values (3,3), (2,2), (1,1); -select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3; -a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) +select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) as m from t3; +a m 3 1 2 2 1 2 @@ -1732,8 +1791,8 @@ CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(1 INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1); CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1; INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status'); -select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid; -dbid name (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') +select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') as m FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') as m from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid; +dbid name m -1 Valid 1 -1 Valid 2 1 -1 Should Not Return 0 @@ -3198,13 +3257,13 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `sub_a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t3 AS (SELECT a FROM t1 WHERE a < '2000-01-01') UNION (SELECT a FROM t1 WHERE a > '2000-01-01'); SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2,t3; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (1), (2); @@ -3788,9 +3847,10 @@ SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a; 2 1 1 -SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) +SELECT +(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) AS m FROM t1 GROUP BY t1.a; -(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) +m 2 1 1 @@ -3800,9 +3860,9 @@ COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b)) 1 1 1 1 SELECT COUNT(DISTINCT t1.b), -(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) +(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) AS m FROM t1 GROUP BY t1.a; -COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) +COUNT(DISTINCT t1.b) m 2 2 1 1 1 1 @@ -3826,16 +3886,10 @@ SELECT ( SELECT COUNT(DISTINCT t1.b) ) ) -FROM t1 GROUP BY t1.a LIMIT 1) +FROM t1 GROUP BY t1.a LIMIT 1) AS m FROM t1 t2 GROUP BY t2.a; -( -SELECT ( -SELECT ( -SELECT COUNT(DISTINCT t1.b) -) -) -FROM t1 GROUP BY t1.a LIMIT 1) +m 2 2 2 @@ -4688,7 +4742,7 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -5973,7 +6027,7 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -6354,10 +6408,10 @@ ORDER BY b ); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) @@ -6365,10 +6419,10 @@ GROUP BY b ); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' DROP TABLE t1, t2; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6429,11 +6483,10 @@ CREATE TABLE t3 (a int, b int); INSERT INTO t3 VALUES (10,7), (0,7); SELECT SUM(DISTINCT b), (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0 -WHERE t.a != 0 AND t2.a != 0) +WHERE t.a != 0 AND t2.a != 0) AS m FROM (SELECT * FROM t3) AS t GROUP BY 2; -SUM(DISTINCT b) (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0 -WHERE t.a != 0 AND t2.a != 0) +SUM(DISTINCT b) m 7 NULL SELECT SUM(DISTINCT b), (SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1) @@ -6566,66 +6619,93 @@ CREATE TABLE t3 (f3a int default 1, f3b int default 2); INSERT INTO t3 VALUES (1,1),(2,2); set @old_optimizer_switch = @@session.optimizer_switch; set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off'; -SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m; +m NULL -SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m; +m NULL set @@session.optimizer_switch=@old_optimizer_switch; -SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m; +m NULL -SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2; +SELECT +(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2 AS m; (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m; +m NULL select (null, null) = (null, null); (null, null) = (null, null) @@ -6671,8 +6751,10 @@ INSERT INTO t2 VALUES (1); CREATE TABLE t3 ( c INT ); INSERT INTO t3 VALUES (4),(5); SET optimizer_switch='subquery_cache=off'; -SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; -( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) +SELECT +( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) AS m +FROM t1; +m 1 NULL SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1; @@ -6889,7 +6971,9 @@ CREATE TABLE t3 (c INT); INSERT INTO t3 VALUES (8),(3); set @@expensive_subquery_limit= 0; EXPLAIN -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 @@ -6899,9 +6983,11 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) 3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 flush status; -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; -(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +m NULL NULL NULL @@ -6927,7 +7013,9 @@ Handler_read_rnd_deleted 0 Handler_read_rnd_next 58 set @@expensive_subquery_limit= default; EXPLAIN -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 @@ -6937,9 +7025,11 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) 3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 flush status; -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; -(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +m NULL NULL NULL @@ -7388,6 +7478,17 @@ a drop table t1,t2,t3; # End of 10.2 tests # +# MDEV-29926: ASAN heap-use-after-free in Explain_query::~Explain_query +# +CREATE TABLE t (a VARCHAR(1)) CHARACTER SET utf8mb3; +EXECUTE IMMEDIATE "SELECT COUNT(*) FROM t WHERE a < (SELECT 'x')"; +COUNT(*) +0 +DROP TABLE t; +# +# End of 10.3 tests +# +# # Start of 10.4 tests # # diff --git a/mysql-test/main/subselect_no_semijoin.result b/mysql-test/main/subselect_no_semijoin.result index d4aad3e1d32ae..a9408248aa8d1 100644 --- a/mysql-test/main/subselect_no_semijoin.result +++ b/mysql-test/main/subselect_no_semijoin.result @@ -121,30 +121,30 @@ ROW(1,2,3) > (SELECT 1,2,1) SELECT ROW(1,2,3) = (SELECT 1,2,NULL); ROW(1,2,3) = (SELECT 1,2,NULL) NULL -SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a'); -(SELECT 1.5,2,'a') = ROW(1.5,2,'a') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m; +m 1 -SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b'); -(SELECT 1.5,2,'a') = ROW(1.5,2,'b') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m; +m 0 -SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b'); -(SELECT 1.5,2,'a') = ROW('1.5b',2,'b') +SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m; +m 0 Warnings: Warning 1292 Truncated incorrect DOUBLE value: '1.5b' -SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); -(SELECT 'b',2,'a') = ROW(1.5,2,'a') +SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a') AS m; +m 0 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'b' -SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a'); -(SELECT 1.5,2,'a') = ROW(1.5,'2','a') +SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a') AS m; +m 1 -SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); -(SELECT 1.5,'c','a') = ROW(1.5,2,'a') +SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a') AS m; +m 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'c' SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a); ERROR 21000: Operand should contain 1 column(s) SELECT 1 as a,(SELECT a+a) b,(SELECT b); @@ -231,19 +231,26 @@ a 2 select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1); a -select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; -b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) +select +b, +(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m +from t4; +b m 8 7.5000 8 4.5000 9 7.5000 -explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; +explain extended +select +b, +(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m +from t4; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` +Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `m` from `test`.`t4` select * from t3 where exists (select * from t2 where t2.b=t3.a); a 7 @@ -310,21 +317,34 @@ select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 w b ma 7 12 create table t5 (a int); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 insert into t5 values (5); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 insert into t5 values (2); -select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; +m a NULL 1 2 2 -explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; +explain extended +select +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m, +a +from t2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 @@ -333,7 +353,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 /* select#1 */ select <`test`.`t2`.`a`>((/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` +Note 1003 /* select#1 */ select <`test`.`t2`.`a`>((/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `m`,`test`.`t2`.`a` AS `a` from `test`.`t2` select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; ERROR 21000: Subquery returns more than 1 row create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); @@ -489,8 +509,11 @@ SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING t mot topic date pseudo joce 40143 2002-10-22 joce joce 43506 2002-10-22 joce -SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2; -mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) +SELECT +*, +topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) AS m +FROM t2; +mot topic date pseudo m joce 40143 2002-10-22 joce 1 joce 43506 2002-10-22 joce 1 SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2); @@ -508,8 +531,11 @@ joce 40143 2002-10-22 joce SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000); mot topic date pseudo joce 40143 2002-10-22 joce -SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2; -mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) +SELECT +*, +topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) AS m +FROM t2; +mot topic date pseudo m joce 40143 2002-10-22 joce 1 joce 43506 2002-10-22 joce 0 drop table t1,t2; @@ -882,6 +908,25 @@ NULL select 1.5 > ANY (SELECT * from t1); 1.5 > ANY (SELECT * from t1) NULL +update t1 set a=NULL where a=2.5; +select 1.5 IN (SELECT * from t1); +1.5 IN (SELECT * from t1) +1 +select 3.5 IN (SELECT * from t1); +3.5 IN (SELECT * from t1) +1 +select 10.5 IN (SELECT * from t1); +10.5 IN (SELECT * from t1) +NULL +select 1.5 > ALL (SELECT * from t1); +1.5 > ALL (SELECT * from t1) +0 +select 10.5 > ALL (SELECT * from t1); +10.5 > ALL (SELECT * from t1) +NULL +select 1.5 > ANY (SELECT * from t1); +1.5 > ANY (SELECT * from t1) +NULL select 10.5 > ANY (SELECT * from t1); 10.5 > ANY (SELECT * from t1) 1 @@ -892,6 +937,20 @@ Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` +explain extended select (select a+1) from t1; +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 +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` +explain extended select (select a+1) from t1; +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 +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1` select (select a+1) from t1; (select a+1) 2.5 @@ -1237,7 +1296,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT 1)` int(1) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a; SHOW CREATE TABLE t1; @@ -1245,7 +1304,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT a)` int(1) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a; SHOW CREATE TABLE t1; @@ -1253,7 +1312,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) NOT NULL DEFAULT 0, `(SELECT a+0)` int(3) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a; select * from t1; @@ -1262,8 +1321,8 @@ a SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(3) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` int(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int); insert into t1 values (1), (2), (3); @@ -1533,8 +1592,8 @@ create table t3 (a int, b int); insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10); insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1); insert into t3 values (3,3), (2,2), (1,1); -select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3; -a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) +select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) as m from t3; +a m 3 1 2 2 1 2 @@ -1729,8 +1788,8 @@ CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(1 INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1); CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1; INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status'); -select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid; -dbid name (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') +select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') as m FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') as m from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid; +dbid name m -1 Valid 1 -1 Valid 2 1 -1 Should Not Return 0 @@ -3193,13 +3252,13 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `sub_a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t3 AS (SELECT a FROM t1 WHERE a < '2000-01-01') UNION (SELECT a FROM t1 WHERE a > '2000-01-01'); SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `a` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2,t3; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (1), (2); @@ -3781,9 +3840,10 @@ SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a; 2 1 1 -SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) +SELECT +(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) AS m FROM t1 GROUP BY t1.a; -(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) +m 2 1 1 @@ -3793,9 +3853,9 @@ COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b)) 1 1 1 1 SELECT COUNT(DISTINCT t1.b), -(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) +(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) AS m FROM t1 GROUP BY t1.a; -COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) +COUNT(DISTINCT t1.b) m 2 2 1 1 1 1 @@ -3819,16 +3879,10 @@ SELECT ( SELECT COUNT(DISTINCT t1.b) ) ) -FROM t1 GROUP BY t1.a LIMIT 1) +FROM t1 GROUP BY t1.a LIMIT 1) AS m FROM t1 t2 GROUP BY t2.a; -( -SELECT ( -SELECT ( -SELECT COUNT(DISTINCT t1.b) -) -) -FROM t1 GROUP BY t1.a LIMIT 1) +m 2 2 2 @@ -4678,7 +4732,7 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -5960,7 +6014,7 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -6339,10 +6393,10 @@ ORDER BY b ); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) @@ -6350,10 +6404,10 @@ GROUP BY b ); 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' DROP TABLE t1, t2; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6414,11 +6468,10 @@ CREATE TABLE t3 (a int, b int); INSERT INTO t3 VALUES (10,7), (0,7); SELECT SUM(DISTINCT b), (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0 -WHERE t.a != 0 AND t2.a != 0) +WHERE t.a != 0 AND t2.a != 0) AS m FROM (SELECT * FROM t3) AS t GROUP BY 2; -SUM(DISTINCT b) (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0 -WHERE t.a != 0 AND t2.a != 0) +SUM(DISTINCT b) m 7 NULL SELECT SUM(DISTINCT b), (SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1) @@ -6551,66 +6604,93 @@ CREATE TABLE t3 (f3a int default 1, f3b int default 2); INSERT INTO t3 VALUES (1,1),(2,2); set @old_optimizer_switch = @@session.optimizer_switch; set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off'; -SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m; +m NULL -SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m; +m NULL set @@session.optimizer_switch=@old_optimizer_switch; -SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2; -(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) +SELECT +(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m; +m NULL -SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2; +SELECT +(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2 AS m; (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) NULL NULL -SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2; -(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) +SELECT +(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2; -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m +FROM t2; +m NULL NULL -SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1); -(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) +SELECT +(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m; +m NULL select (null, null) = (null, null); (null, null) = (null, null) @@ -6656,8 +6736,10 @@ INSERT INTO t2 VALUES (1); CREATE TABLE t3 ( c INT ); INSERT INTO t3 VALUES (4),(5); SET optimizer_switch='subquery_cache=off'; -SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; -( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) +SELECT +( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) AS m +FROM t1; +m 1 NULL SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1; @@ -6874,7 +6956,9 @@ CREATE TABLE t3 (c INT); INSERT INTO t3 VALUES (8),(3); set @@expensive_subquery_limit= 0; EXPLAIN -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 @@ -6884,9 +6968,11 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) 3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 flush status; -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; -(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +m NULL NULL NULL @@ -6912,7 +6998,9 @@ Handler_read_rnd_deleted 0 Handler_read_rnd_next 22 set @@expensive_subquery_limit= default; EXPLAIN -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 @@ -6922,9 +7010,11 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) 3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 flush status; -SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +SELECT +(SELECT MIN(b) FROM t1, t2 +WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; -(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) +m NULL NULL NULL @@ -7373,6 +7463,17 @@ a drop table t1,t2,t3; # End of 10.2 tests # +# MDEV-29926: ASAN heap-use-after-free in Explain_query::~Explain_query +# +CREATE TABLE t (a VARCHAR(1)) CHARACTER SET utf8mb3; +EXECUTE IMMEDIATE "SELECT COUNT(*) FROM t WHERE a < (SELECT 'x')"; +COUNT(*) +0 +DROP TABLE t; +# +# End of 10.3 tests +# +# # Start of 10.4 tests # # diff --git a/mysql-test/main/subselect_sj.result b/mysql-test/main/subselect_sj.result index b4ad66458dca0..ea6180e9022b1 100644 --- a/mysql-test/main/subselect_sj.result +++ b/mysql-test/main/subselect_sj.result @@ -1705,15 +1705,15 @@ x m c Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'x' -Warning 1292 Truncated incorrect DOUBLE value: 'm' -Warning 1292 Truncated incorrect DOUBLE value: 'c' -Warning 1292 Truncated incorrect DOUBLE value: 'x' -Warning 1292 Truncated incorrect DOUBLE value: 'm' -Warning 1292 Truncated incorrect DOUBLE value: 'c' -Warning 1292 Truncated incorrect DOUBLE value: 'x' -Warning 1292 Truncated incorrect DOUBLE value: 'm' -Warning 1292 Truncated incorrect DOUBLE value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'm' +Warning 1292 Truncated incorrect DECIMAL value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'm' +Warning 1292 Truncated incorrect DECIMAL value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'm' +Warning 1292 Truncated incorrect DECIMAL value: 'c' drop table t1,t2,t3,t4; # # BUG#751484: Valgrind warning / sporadic crash in evaluate_join_record sql_select.cc:14099 with semijoin @@ -2100,8 +2100,8 @@ f1 f2 f3 f3 4 0 0 0 0 NULL NULL NULL Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'foo' -Warning 1292 Truncated incorrect DOUBLE value: 'foo' +Warning 1292 Truncated incorrect DECIMAL value: 'foo' +Warning 1292 Truncated incorrect DECIMAL value: 'foo' DROP TABLE t1, t2, t3, t4; set @tmp803457=@@optimizer_switch; # @@ -2178,10 +2178,10 @@ INSERT INTO t5 VALUES (7,0),(9,0); explain SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t5 index a a 10 NULL 2 Using index; Start temporary +1 PRIMARY t5 index a a 10 NULL 2 Using where; Using index; LooseScan 1 PRIMARY t4 ALL NULL NULL NULL NULL 3 -1 PRIMARY t2 ALL b NULL NULL NULL 10 Using where -1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; End temporary; Using join buffer (flat, BNL join) +1 PRIMARY t2 ref b b 5 test.t5.b 2 Using where; FirstMatch(t5) +1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; Using join buffer (flat, BNL join) SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b); a 0 @@ -2294,13 +2294,13 @@ PREPARE st1 FROM "SELECT * FROM t2 LEFT JOIN t1 ON t2.a != 0 AND ('j','r') IN ( EXECUTE st1; a a Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'j' -Warning 1292 Truncated incorrect DOUBLE value: 'r' +Warning 1292 Truncated incorrect DECIMAL value: 'j' +Warning 1292 Truncated incorrect DECIMAL value: 'r' EXECUTE st1; a a Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'j' -Warning 1292 Truncated incorrect DOUBLE value: 'r' +Warning 1292 Truncated incorrect DECIMAL value: 'j' +Warning 1292 Truncated incorrect DECIMAL value: 'r' DROP TABLE t1, t2, t3; # # BUG#849776: Wrong result with semijoin + "Impossible where" @@ -2500,8 +2500,8 @@ WHERE t1.a = t2.a AND t2.a IN (SELECT b FROM t3 STRAIGHT_JOIN t4); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 system NULL NULL NULL NULL 1 1 PRIMARY ALL distinct_key NULL NULL NULL 1 -1 PRIMARY t2 ref a a 5 const 1 Using index -1 PRIMARY t1 ref a a 5 func 1 Using index +1 PRIMARY t1 ref a a 5 const 1 Using index +1 PRIMARY t2 ref a a 5 func 1 Using index 2 MATERIALIZED t4 ALL NULL NULL NULL NULL 0 SELECT * FROM t1, t2 WHERE t1.a = t2.a AND t2.a IN (SELECT b FROM t3 STRAIGHT_JOIN t4); @@ -3318,4 +3318,35 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 2 MATERIALIZED t4 ALL NULL NULL NULL NULL 500 drop table t1, t2, t3, t4; +# +# MDEV-20770: Server crashes in JOIN::transform_in_predicates_into_in_subq +# upon 2nd execution of PS/SP comparing GEOMETRY with other types +# +CREATE TABLE t1 (a GEOMETRY); +CREATE TABLE t2 (b INT); +INSERT INTO t1 VALUES (GeomFromText('POINT(0 0)')),(GeomFromText('POINT(1 1)')); +INSERT INTO t2 VALUES (1),(2); +PREPARE stmt FROM "SELECT * from t1 WHERE a IN (SELECT b FROM t2)"; +EXECUTE stmt; +ERROR HY000: Illegal parameter data types geometry and int for operation '=' +EXECUTE stmt; +ERROR HY000: Illegal parameter data types geometry and int for operation '=' +EXECUTE stmt; +ERROR HY000: Illegal parameter data types geometry and int for operation '=' +EXECUTE stmt; +ERROR HY000: Illegal parameter data types geometry and int for operation '=' +DROP TABLE t1, t2; +# +# MDEV-28871: Assert ... failed in JOIN::dbug_verify_sj_inner_tables with low optimizer_search_depth +# +set @tmp_28871=@@optimizer_search_depth; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t1 VALUES (3),(4); +SET optimizer_search_depth= 1; +SELECT * FROM t1 WHERE a IN (SELECT b FROM t2 JOIN t1); +a +DROP TABLE t1, t2; +set optimizer_search_depth= @tmp_28871; set optimizer_switch=@subselect_sj_tmp; diff --git a/mysql-test/main/subselect_sj.test b/mysql-test/main/subselect_sj.test index c5c3354bc3253..e4d02ed666c0c 100644 --- a/mysql-test/main/subselect_sj.test +++ b/mysql-test/main/subselect_sj.test @@ -1,3 +1,4 @@ +--source include/no_valgrind_without_big.inc # # Nested Loops semi-join subquery evaluation tests # @@ -2995,5 +2996,45 @@ explain select * from t3 where a in (select a from t4); drop table t1, t2, t3, t4; +--echo # +--echo # MDEV-20770: Server crashes in JOIN::transform_in_predicates_into_in_subq +--echo # upon 2nd execution of PS/SP comparing GEOMETRY with other types +--echo # + +CREATE TABLE t1 (a GEOMETRY); +CREATE TABLE t2 (b INT); + +INSERT INTO t1 VALUES (GeomFromText('POINT(0 0)')),(GeomFromText('POINT(1 1)')); +INSERT INTO t2 VALUES (1),(2); + +PREPARE stmt FROM "SELECT * from t1 WHERE a IN (SELECT b FROM t2)"; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +EXECUTE stmt; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +EXECUTE stmt; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +EXECUTE stmt; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +EXECUTE stmt; + +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-28871: Assert ... failed in JOIN::dbug_verify_sj_inner_tables with low optimizer_search_depth +--echo # +set @tmp_28871=@@optimizer_search_depth; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); + +# Data is optional, fails either way +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t1 VALUES (3),(4); + +SET optimizer_search_depth= 1; + +SELECT * FROM t1 WHERE a IN (SELECT b FROM t2 JOIN t1); +DROP TABLE t1, t2; +set optimizer_search_depth= @tmp_28871; + # The following command must be the last one the file set optimizer_switch=@subselect_sj_tmp; diff --git a/mysql-test/main/subselect_sj2.result b/mysql-test/main/subselect_sj2.result index 2d0df9a05d08c..727dfcc4c40cb 100644 --- a/mysql-test/main/subselect_sj2.result +++ b/mysql-test/main/subselect_sj2.result @@ -466,11 +466,11 @@ where t0.a in ( select t1.a from t1,t2 where t2.a=t0.a and t1.b=t2.b); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t0 ALL NULL NULL NULL NULL 5 100.00 Using where -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 -1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2) +1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Start temporary +1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 Using where; End temporary Warnings: Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b` +Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t2`.`b` = `test`.`t1`.`b` update t1 set a=3, b=11 where a=4; update t2 set b=11 where a=3; select * from t0 where t0.a in @@ -721,7 +721,7 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci set @a=0; create table t3 as select * from t2 limit 0; insert into t3 select @a:=@a+1, t2.a from t2, t0; @@ -1129,8 +1129,8 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL # Using where 1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d # Using index 1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) -1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) 1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) +1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 WHERE alias3.d IN ( SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 @@ -1150,8 +1150,8 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL # Using where 1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d # Using index 1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) -1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) 1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) +1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 WHERE alias3.d IN ( SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 diff --git a/mysql-test/main/subselect_sj2_jcl6.result b/mysql-test/main/subselect_sj2_jcl6.result index f0e8e9b4881d9..66882150ebd60 100644 --- a/mysql-test/main/subselect_sj2_jcl6.result +++ b/mysql-test/main/subselect_sj2_jcl6.result @@ -477,11 +477,11 @@ where t0.a in ( select t1.a from t1,t2 where t2.a=t0.a and t1.b=t2.b); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t0 ALL NULL NULL NULL NULL 5 100.00 Using where -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2); Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Start temporary; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 Using where; End temporary; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b` +Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t2`.`b` = `test`.`t1`.`b` update t1 set a=3, b=11 where a=4; update t2 set b=11 where a=3; # Not anymore: @@ -734,7 +734,7 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci set @a=0; create table t3 as select * from t2 limit 0; insert into t3 select @a:=@a+1, t2.a from t2, t0; @@ -1142,8 +1142,8 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL # Using where 1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d # Using index 1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) -1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) -1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (incremental, BNL join) +1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) +1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (incremental, BNL join) SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 WHERE alias3.d IN ( SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 @@ -1163,8 +1163,8 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL # Using where 1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d # Using index 1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) -1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) -1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (incremental, BNL join) +1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) +1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (incremental, BNL join) SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 WHERE alias3.d IN ( SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 diff --git a/mysql-test/main/subselect_sj2_mat.result b/mysql-test/main/subselect_sj2_mat.result index 9b497ade58b16..fe6bc0b9cbe3c 100644 --- a/mysql-test/main/subselect_sj2_mat.result +++ b/mysql-test/main/subselect_sj2_mat.result @@ -468,11 +468,11 @@ where t0.a in ( select t1.a from t1,t2 where t2.a=t0.a and t1.b=t2.b); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t0 ALL NULL NULL NULL NULL 5 100.00 Using where -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 -1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2) +1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Start temporary +1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 Using where; End temporary Warnings: Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b` +Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t2`.`b` = `test`.`t1`.`b` update t1 set a=3, b=11 where a=4; update t2 set b=11 where a=3; select * from t0 where t0.a in @@ -723,7 +723,7 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci set @a=0; create table t3 as select * from t2 limit 0; insert into t3 select @a:=@a+1, t2.a from t2, t0; @@ -1131,8 +1131,8 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL # Using where 1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d # Using index 1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) -1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) 1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) +1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 WHERE alias3.d IN ( SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 @@ -1152,8 +1152,8 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL # Using where 1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d # Using index 1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) -1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) 1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) +1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 WHERE alias3.d IN ( SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 @@ -1933,19 +1933,19 @@ AND t3.id_product IN (SELECT id_product FROM t2 t2_4 WHERE t2_4.id_t2 = 34 OR t2 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 t3 index PRIMARY PRIMARY 4 NULL 18 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 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 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.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) +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 +5 MATERIALIZED t2_4 range id_t2,id_product id_t2 5 NULL 18 Using index condition; Using where +6 MATERIALIZED t2_5 range id_t2,id_product id_t2 5 NULL 31 Using index condition; Using where 3 MATERIALIZED t2_2 ref id_t2,id_product id_t2 5 const 12 4 MATERIALIZED t2_3 range id_t2,id_product id_t2 5 NULL 33 Using index condition; Using where -6 MATERIALIZED t2_5 range id_t2,id_product id_t2 5 NULL 31 Using index condition; Using where 2 MATERIALIZED t2_1 ALL id_t2,id_product NULL NULL NULL 223 Using where -5 MATERIALIZED t2_4 range id_t2,id_product id_t2 5 NULL 18 Using index condition; Using where set optimizer_switch='rowid_filter=default'; drop table t1,t2,t3,t4,t5; set global innodb_stats_persistent= @innodb_stats_persistent_save; diff --git a/mysql-test/main/subselect_sj_jcl6.result b/mysql-test/main/subselect_sj_jcl6.result index 2301a03f97304..bddf3fdd26829 100644 --- a/mysql-test/main/subselect_sj_jcl6.result +++ b/mysql-test/main/subselect_sj_jcl6.result @@ -1716,15 +1716,15 @@ x m c Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'x' -Warning 1292 Truncated incorrect DOUBLE value: 'm' -Warning 1292 Truncated incorrect DOUBLE value: 'c' -Warning 1292 Truncated incorrect DOUBLE value: 'x' -Warning 1292 Truncated incorrect DOUBLE value: 'm' -Warning 1292 Truncated incorrect DOUBLE value: 'c' -Warning 1292 Truncated incorrect DOUBLE value: 'x' -Warning 1292 Truncated incorrect DOUBLE value: 'm' -Warning 1292 Truncated incorrect DOUBLE value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'm' +Warning 1292 Truncated incorrect DECIMAL value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'm' +Warning 1292 Truncated incorrect DECIMAL value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'm' +Warning 1292 Truncated incorrect DECIMAL value: 'c' drop table t1,t2,t3,t4; # # BUG#751484: Valgrind warning / sporadic crash in evaluate_join_record sql_select.cc:14099 with semijoin @@ -2111,8 +2111,8 @@ f1 f2 f3 f3 4 0 0 0 0 NULL NULL NULL Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'foo' -Warning 1292 Truncated incorrect DOUBLE value: 'foo' +Warning 1292 Truncated incorrect DECIMAL value: 'foo' +Warning 1292 Truncated incorrect DECIMAL value: 'foo' DROP TABLE t1, t2, t3, t4; set @tmp803457=@@optimizer_switch; # @@ -2189,10 +2189,10 @@ INSERT INTO t5 VALUES (7,0),(9,0); explain SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t5 index a a 10 NULL 2 Using index; Start temporary -1 PRIMARY t4 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY t2 ALL b NULL NULL NULL 10 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; End temporary; Using join buffer (incremental, BNL join) +1 PRIMARY t5 index a a 10 NULL 2 Using where; Using index; LooseScan +1 PRIMARY t4 ALL NULL NULL NULL NULL 3 +1 PRIMARY t2 ref b b 5 test.t5.b 2 Using where; FirstMatch(t5) +1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; Using join buffer (flat, BNL join) SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b); a 0 @@ -2305,13 +2305,13 @@ PREPARE st1 FROM "SELECT * FROM t2 LEFT JOIN t1 ON t2.a != 0 AND ('j','r') IN ( EXECUTE st1; a a Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'j' -Warning 1292 Truncated incorrect DOUBLE value: 'r' +Warning 1292 Truncated incorrect DECIMAL value: 'j' +Warning 1292 Truncated incorrect DECIMAL value: 'r' EXECUTE st1; a a Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'j' -Warning 1292 Truncated incorrect DOUBLE value: 'r' +Warning 1292 Truncated incorrect DECIMAL value: 'j' +Warning 1292 Truncated incorrect DECIMAL value: 'r' DROP TABLE t1, t2, t3; # # BUG#849776: Wrong result with semijoin + "Impossible where" @@ -2511,8 +2511,8 @@ WHERE t1.a = t2.a AND t2.a IN (SELECT b FROM t3 STRAIGHT_JOIN t4); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 system NULL NULL NULL NULL 1 1 PRIMARY ALL distinct_key NULL NULL NULL 1 -1 PRIMARY t2 ref a a 5 const 1 Using index -1 PRIMARY t1 ref a a 5 func 1 Using index +1 PRIMARY t1 ref a a 5 const 1 Using index +1 PRIMARY t2 ref a a 5 func 1 Using index 2 MATERIALIZED t4 ALL NULL NULL NULL NULL 0 SELECT * FROM t1, t2 WHERE t1.a = t2.a AND t2.a IN (SELECT b FROM t3 STRAIGHT_JOIN t4); @@ -3329,6 +3329,37 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 2 MATERIALIZED t4 ALL NULL NULL NULL NULL 500 drop table t1, t2, t3, t4; +# +# MDEV-20770: Server crashes in JOIN::transform_in_predicates_into_in_subq +# upon 2nd execution of PS/SP comparing GEOMETRY with other types +# +CREATE TABLE t1 (a GEOMETRY); +CREATE TABLE t2 (b INT); +INSERT INTO t1 VALUES (GeomFromText('POINT(0 0)')),(GeomFromText('POINT(1 1)')); +INSERT INTO t2 VALUES (1),(2); +PREPARE stmt FROM "SELECT * from t1 WHERE a IN (SELECT b FROM t2)"; +EXECUTE stmt; +ERROR HY000: Illegal parameter data types geometry and int for operation '=' +EXECUTE stmt; +ERROR HY000: Illegal parameter data types geometry and int for operation '=' +EXECUTE stmt; +ERROR HY000: Illegal parameter data types geometry and int for operation '=' +EXECUTE stmt; +ERROR HY000: Illegal parameter data types geometry and int for operation '=' +DROP TABLE t1, t2; +# +# MDEV-28871: Assert ... failed in JOIN::dbug_verify_sj_inner_tables with low optimizer_search_depth +# +set @tmp_28871=@@optimizer_search_depth; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t1 VALUES (3),(4); +SET optimizer_search_depth= 1; +SELECT * FROM t1 WHERE a IN (SELECT b FROM t2 JOIN t1); +a +DROP TABLE t1, t2; +set optimizer_search_depth= @tmp_28871; set optimizer_switch=@subselect_sj_tmp; # # BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off diff --git a/mysql-test/main/subselect_sj_jcl6.test b/mysql-test/main/subselect_sj_jcl6.test index 179c1aa029bb4..f4f605c040611 100644 --- a/mysql-test/main/subselect_sj_jcl6.test +++ b/mysql-test/main/subselect_sj_jcl6.test @@ -1,6 +1,7 @@ # # Run subselect_sj.test with BKA enabled # +--source include/no_valgrind_without_big.inc --source include/default_optimizer_switch.inc set @save_optimizer_switch_jcl6=@@optimizer_switch; diff --git a/mysql-test/main/subselect_sj_mat.result b/mysql-test/main/subselect_sj_mat.result index 97dcf07705cf5..2cc35c1896c35 100644 --- a/mysql-test/main/subselect_sj_mat.result +++ b/mysql-test/main/subselect_sj_mat.result @@ -181,7 +181,7 @@ t2i_c CREATE TABLE `t2i_c` ( KEY `it2i1` (`b1`), KEY `it2i2` (`b2`), KEY `it2i3` (`b1`,`b2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci explain extended select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1); id select_type table type possible_keys key key_len ref rows filtered Extra @@ -604,9 +604,9 @@ select * from t1 group by (a1 in (select col from columns)); a1 a2 1 - 00 2 - 00 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1 - 00' -Warning 1292 Truncated incorrect DOUBLE value: '1 - 01' -Warning 1292 Truncated incorrect DOUBLE value: '1 - 02' +Warning 1292 Truncated incorrect DECIMAL value: '1 - 00' +Warning 1292 Truncated incorrect DECIMAL value: '1 - 01' +Warning 1292 Truncated incorrect DECIMAL value: '1 - 02' /* ORDER BY clause */ explain extended select * from t1 order by (select col from columns limit 1); diff --git a/mysql-test/main/subselect_sj_mat.test b/mysql-test/main/subselect_sj_mat.test index 8d5bbd8ef82df..6b343900dcacf 100644 --- a/mysql-test/main/subselect_sj_mat.test +++ b/mysql-test/main/subselect_sj_mat.test @@ -197,6 +197,9 @@ select * from v1m where (c2, b1) in (select distinct c2, b1 from v2m where b1 is drop view v1, v2, v1m, v2m; +#--view-protocol is disabled because view gives another query plan +--disable_view_protocol + # nested subqueries, views explain extended select * from t1 @@ -330,6 +333,7 @@ explain extended select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual); select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual); +--enable_view_protocol /****************************************************************************** * Subqueries in other uncovered clauses. @@ -814,6 +818,9 @@ explain extended select a from t1 group by a having a in (select c from t2 where d >= 20); select a from t1 group by a having a in (select c from t2 where d >= 20); +#--view-protocol is disabled because view gives another query plan +--disable_view_protocol + explain extended select a from t1 group by a having a in (select c from t2 where d >= some(select e from t3 where max(b)=e)); @@ -824,6 +831,7 @@ select a from t1 where a in (select c from t2 where d >= some(select e from t3 where b=e)); select a from t1 where a in (select c from t2 where d >= some(select e from t3 where b=e)); +--enable_view_protocol drop table t1, t2, t3; diff --git a/mysql-test/main/sum_distinct-big.test b/mysql-test/main/sum_distinct-big.test index 41aa5a44c19fe..f808f79dfb1c8 100644 --- a/mysql-test/main/sum_distinct-big.test +++ b/mysql-test/main/sum_distinct-big.test @@ -5,6 +5,7 @@ --source include/big_test.inc # Test will take more than one hour with valgrind --source include/not_valgrind.inc +--source include/not_msan.inc --source include/have_innodb.inc --source include/have_sequence.inc diff --git a/mysql-test/main/symlink-myisam-11902.test b/mysql-test/main/symlink-myisam-11902.test index 8fae41222cfa1..c782ef44ec54f 100644 --- a/mysql-test/main/symlink-myisam-11902.test +++ b/mysql-test/main/symlink-myisam-11902.test @@ -56,5 +56,8 @@ flush tables; drop table if exists t1; exec rm -r $MYSQLTEST_VARDIR/tmp/foo; +# Under Valgrind, this could display a warning ER_FILE_NOT_FOUND +--disable_warnings drop table mysql.t1; +--enable_warnings set debug_sync='RESET'; diff --git a/mysql-test/main/symlink.result b/mysql-test/main/symlink.result index e8063ee736cc4..f6a18edbd9497 100644 --- a/mysql-test/main/symlink.result +++ b/mysql-test/main/symlink.result @@ -42,7 +42,7 @@ t9 CREATE TABLE `t9` ( `b` char(16) NOT NULL, `c` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/' +) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/' alter table t9 rename t8, add column d int not null; alter table t8 rename t7; rename table t7 to t9; @@ -55,7 +55,7 @@ t9 CREATE TABLE `t9` ( `c` int(11) NOT NULL, `d` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/' +) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/' create database mysqltest; create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="/this-dir-does-not-exist"; @@ -81,7 +81,7 @@ t9 CREATE TABLE `t9` ( `c` int(11) NOT NULL, `d` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/' +) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/' drop database mysqltest; create table t1 (a int not null) engine=myisam; alter table t1 data directory="MYSQLTEST_VARDIR/tmp"; @@ -91,7 +91,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 add b int; alter table t1 data directory="MYSQLTEST_VARDIR/log"; Warnings: @@ -101,7 +101,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 index directory="MYSQLTEST_VARDIR/log"; Warnings: Warning 1618 option ignored @@ -110,7 +110,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1(a INT) DATA DIRECTORY='TEST_DIR/tmp' @@ -130,14 +130,14 @@ show create table t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/log/' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQLTEST_VARDIR/log/' connection session2; create temporary table t1 (a int) engine=myisam data directory="MYSQLTEST_VARDIR/log" select 99 a; show create table t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/log/' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQLTEST_VARDIR/log/' connection default; create table t1 (a int) engine=myisam select 42 a; connection session1; @@ -157,9 +157,13 @@ a drop table t1; End of 4.1 tests SET SESSION keep_files_on_create = TRUE; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release CREATE TABLE t1 (a INT) ENGINE MYISAM; Got one of the listed errors SET SESSION keep_files_on_create = FALSE; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release CREATE TABLE t1 (a INT) ENGINE MYISAM; DROP TABLE t1; End of 5.0 tests @@ -211,7 +215,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/' select create_options from information_schema.tables where table_name='t1'; create_options DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/' @@ -224,7 +228,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop tables t1, t2; # # Test for bug #25514146 DB_NAME IS IGNORED WHEN CREATING TABLE @@ -247,5 +251,5 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL, `c3` varchar(100) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 DATA DIRECTORY='MYSQL_TMP_DIR/' INDEX DIRECTORY='MYSQL_TMP_DIR/' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DELAY_KEY_WRITE=1 DATA DIRECTORY='MYSQL_TMP_DIR/' INDEX DIRECTORY='MYSQL_TMP_DIR/' drop table t1; diff --git a/mysql-test/main/symlink.test b/mysql-test/main/symlink.test index cf95d4cb93814..d5f52e9a60d86 100644 --- a/mysql-test/main/symlink.test +++ b/mysql-test/main/symlink.test @@ -144,6 +144,9 @@ DROP TABLE t2; # # Bug#8706 - temporary table with data directory option fails # +#view cannot has temporary table in definition +--disable_view_protocol + connect (session1,localhost,root,,); connect (session2,localhost,root,,); @@ -176,6 +179,8 @@ connection default; select * from t1; drop table t1; +--enable_view_protocol + --echo End of 4.1 tests # diff --git a/mysql-test/main/synchronization.result b/mysql-test/main/synchronization.result index ee8195820b016..511ee0546600e 100644 --- a/mysql-test/main/synchronization.result +++ b/mysql-test/main/synchronization.result @@ -10,7 +10,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; ALTER TABLE t1 CHANGE x2 x1 INT; @@ -20,7 +20,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; connection con1; @@ -31,7 +31,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; ALTER TABLE t1 CHANGE x2 x1 INT; @@ -41,7 +41,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; connection con1; @@ -52,7 +52,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; ALTER TABLE t1 CHANGE x2 x1 INT; @@ -62,7 +62,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; connection con1; @@ -73,7 +73,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; ALTER TABLE t1 CHANGE x2 x1 INT; @@ -83,7 +83,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; connection con1; @@ -94,7 +94,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; ALTER TABLE t1 CHANGE x2 x1 INT; @@ -104,7 +104,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; connection con1; @@ -115,7 +115,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; ALTER TABLE t1 CHANGE x2 x1 INT; @@ -125,7 +125,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; connection con1; @@ -136,7 +136,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; ALTER TABLE t1 CHANGE x2 x1 INT; @@ -146,7 +146,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; connection con1; @@ -157,7 +157,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; ALTER TABLE t1 CHANGE x2 x1 INT; @@ -167,7 +167,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; connection con1; @@ -178,7 +178,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; ALTER TABLE t1 CHANGE x2 x1 INT; @@ -188,7 +188,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; connection con1; @@ -199,7 +199,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; ALTER TABLE t1 CHANGE x2 x1 INT; @@ -209,7 +209,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `xx` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; connection con1; DROP TABLE t1; diff --git a/mysql-test/main/system_mysql_db.result b/mysql-test/main/system_mysql_db.result index dcc71da36779e..2c97d0c6809e7 100644 --- a/mysql-test/main/system_mysql_db.result +++ b/mysql-test/main/system_mysql_db.result @@ -34,29 +34,29 @@ user show create table db; Table Create Table db CREATE TABLE `db` ( - `Host` char(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `References_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Delete_history_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `References_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Delete_history_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', PRIMARY KEY (`Host`,`Db`,`User`), KEY `User` (`User`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Database privileges' @@ -66,56 +66,56 @@ user CREATE ALGORITHM=UNDEFINED DEFINER=`mariadb.sys`@`localhost` SQL SECURITY D show create table func; Table Create Table func CREATE TABLE `func` ( - `name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `name` char(64) NOT NULL DEFAULT '', `ret` tinyint(1) NOT NULL DEFAULT 0, - `dl` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `type` enum('function','aggregate') CHARACTER SET utf8mb3 NOT NULL, + `dl` char(128) NOT NULL DEFAULT '', + `type` enum('function','aggregate') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(255) NOT NULL DEFAULT '', + `User` char(128) 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=utf8mb3 COLLATE=utf8mb3_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` ( - `Host` char(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Table_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Grantor` varchar(384) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Table_name` char(64) NOT NULL DEFAULT '', + `Grantor` varchar(384) NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', - `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', + `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), KEY `Grantor` (`Grantor`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Table privileges' show create table columns_priv; Table Create Table columns_priv CREATE TABLE `columns_priv` ( - `Host` char(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Table_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Column_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Table_name` char(64) NOT NULL DEFAULT '', + `Column_name` char(64) NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Column privileges' show create table procs_priv; Table Create Table procs_priv CREATE TABLE `procs_priv` ( - `Host` char(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Routine_name` char(64) CHARACTER SET utf8mb3 NOT NULL DEFAULT '', - `Routine_type` enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') COLLATE utf8mb3_bin NOT NULL, - `Grantor` varchar(384) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Routine_name` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', + `Routine_type` enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') NOT NULL, + `Grantor` varchar(384) NOT NULL DEFAULT '', + `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), KEY `Grantor` (`Grantor`) @@ -133,7 +133,7 @@ servers CREATE TABLE `servers` ( `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) -) ENGINE=Aria DEFAULT CHARSET=utf8mb3 PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='MySQL Foreign Servers table' +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='MySQL Foreign Servers table' show create table proc; Table Create Table proc CREATE TABLE `proc` ( @@ -159,7 +159,7 @@ proc CREATE TABLE `proc` ( `body_utf8` longblob DEFAULT NULL, `aggregate` enum('NONE','GROUP') NOT NULL DEFAULT 'NONE', PRIMARY KEY (`db`,`name`,`type`) -) ENGINE=Aria DEFAULT CHARSET=utf8mb3 PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Stored Procedures' +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Stored Procedures' show create table event; Table Create Table event CREATE TABLE `event` ( @@ -180,13 +180,13 @@ event CREATE TABLE `event` ( `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 utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', `originator` int(10) unsigned NOT NULL, - `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', + `time_zone` char(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'SYSTEM', `character_set_client` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `collation_connection` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `db_collation` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `body_utf8` longblob DEFAULT NULL, PRIMARY KEY (`db`,`name`) -) ENGINE=Aria DEFAULT CHARSET=utf8mb3 PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Events' +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Events' show create table general_log; Table Create Table general_log CREATE TABLE `general_log` ( @@ -196,7 +196,7 @@ general_log CREATE TABLE `general_log` ( `server_id` int(10) unsigned NOT NULL, `command_type` varchar(64) NOT NULL, `argument` mediumtext NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='General log' +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='General log' show create table slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( @@ -213,37 +213,37 @@ slow_log CREATE TABLE `slow_log` ( `sql_text` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `rows_affected` int(11) NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='Slow log' +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log' show create table table_stats; Table Create Table table_stats CREATE TABLE `table_stats` ( - `db_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `db_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, `cardinality` bigint(21) unsigned DEFAULT NULL, PRIMARY KEY (`db_name`,`table_name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Tables' show create table column_stats; Table Create Table column_stats CREATE TABLE `column_stats` ( - `db_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `column_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `db_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, + `column_name` varchar(64) NOT NULL, `min_value` varbinary(255) DEFAULT NULL, `max_value` varbinary(255) DEFAULT NULL, `nulls_ratio` decimal(12,4) DEFAULT NULL, `avg_length` decimal(12,4) DEFAULT NULL, `avg_frequency` decimal(12,4) DEFAULT NULL, `hist_size` tinyint(3) unsigned DEFAULT NULL, - `hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') COLLATE utf8mb3_bin DEFAULT NULL, + `hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') DEFAULT NULL, `histogram` longblob DEFAULT NULL, PRIMARY KEY (`db_name`,`table_name`,`column_name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns' show create table index_stats; Table Create Table index_stats CREATE TABLE `index_stats` ( - `db_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `index_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `db_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, + `index_name` varchar(64) NOT NULL, `prefix_arity` int(11) unsigned NOT NULL, `avg_frequency` decimal(12,4) DEFAULT NULL, PRIMARY KEY (`db_name`,`table_name`,`index_name`,`prefix_arity`) diff --git a/mysql-test/main/system_mysql_db_fix40123.result b/mysql-test/main/system_mysql_db_fix40123.result index 4ab80425a35a2..57845704fa11c 100644 --- a/mysql-test/main/system_mysql_db_fix40123.result +++ b/mysql-test/main/system_mysql_db_fix40123.result @@ -72,29 +72,29 @@ user show create table db; Table Create Table db CREATE TABLE `db` ( - `Host` char(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `References_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Delete_history_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `References_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Delete_history_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', PRIMARY KEY (`Host`,`Db`,`User`), KEY `User` (`User`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Database privileges' @@ -104,56 +104,56 @@ user CREATE ALGORITHM=UNDEFINED DEFINER=`mariadb.sys`@`localhost` SQL SECURITY D show create table func; Table Create Table func CREATE TABLE `func` ( - `name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `name` char(64) NOT NULL DEFAULT '', `ret` tinyint(1) NOT NULL DEFAULT 0, - `dl` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `type` enum('function','aggregate') CHARACTER SET utf8mb3 NOT NULL, + `dl` char(128) NOT NULL DEFAULT '', + `type` enum('function','aggregate') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(255) NOT NULL DEFAULT '', + `User` char(128) 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=utf8mb3 COLLATE=utf8mb3_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` ( - `Host` char(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Table_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Grantor` varchar(384) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Table_name` char(64) NOT NULL DEFAULT '', + `Grantor` varchar(384) NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', - `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', + `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), KEY `Grantor` (`Grantor`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Table privileges' show create table columns_priv; Table Create Table columns_priv CREATE TABLE `columns_priv` ( - `Host` char(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Table_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Column_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Table_name` char(64) NOT NULL DEFAULT '', + `Column_name` char(64) NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Column privileges' show create table procs_priv; Table Create Table procs_priv CREATE TABLE `procs_priv` ( - `Host` char(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Routine_name` char(64) CHARACTER SET utf8mb3 NOT NULL DEFAULT '', - `Routine_type` enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') COLLATE utf8mb3_bin NOT NULL, - `Grantor` varchar(384) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Routine_name` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', + `Routine_type` enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') NOT NULL, + `Grantor` varchar(384) NOT NULL DEFAULT '', + `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), KEY `Grantor` (`Grantor`) @@ -171,7 +171,7 @@ servers CREATE TABLE `servers` ( `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) -) ENGINE=Aria DEFAULT CHARSET=utf8mb3 PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='MySQL Foreign Servers table' +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='MySQL Foreign Servers table' show create table proc; Table Create Table proc CREATE TABLE `proc` ( @@ -197,7 +197,7 @@ proc CREATE TABLE `proc` ( `body_utf8` longblob DEFAULT NULL, `aggregate` enum('NONE','GROUP') NOT NULL DEFAULT 'NONE', PRIMARY KEY (`db`,`name`,`type`) -) ENGINE=Aria DEFAULT CHARSET=utf8mb3 PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Stored Procedures' +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Stored Procedures' show create table event; Table Create Table event CREATE TABLE `event` ( @@ -218,13 +218,13 @@ event CREATE TABLE `event` ( `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 utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', `originator` int(10) unsigned NOT NULL, - `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', + `time_zone` char(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'SYSTEM', `character_set_client` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `collation_connection` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `db_collation` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `body_utf8` longblob DEFAULT NULL, PRIMARY KEY (`db`,`name`) -) ENGINE=Aria DEFAULT CHARSET=utf8mb3 PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Events' +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Events' show create table general_log; Table Create Table general_log CREATE TABLE `general_log` ( @@ -234,7 +234,7 @@ general_log CREATE TABLE `general_log` ( `server_id` int(10) unsigned NOT NULL, `command_type` varchar(64) NOT NULL, `argument` mediumtext NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='General log' +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='General log' show create table slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( @@ -251,37 +251,37 @@ slow_log CREATE TABLE `slow_log` ( `sql_text` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `rows_affected` int(11) NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='Slow log' +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log' show create table table_stats; Table Create Table table_stats CREATE TABLE `table_stats` ( - `db_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `db_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, `cardinality` bigint(21) unsigned DEFAULT NULL, PRIMARY KEY (`db_name`,`table_name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Tables' show create table column_stats; Table Create Table column_stats CREATE TABLE `column_stats` ( - `db_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `column_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `db_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, + `column_name` varchar(64) NOT NULL, `min_value` varbinary(255) DEFAULT NULL, `max_value` varbinary(255) DEFAULT NULL, `nulls_ratio` decimal(12,4) DEFAULT NULL, `avg_length` decimal(12,4) DEFAULT NULL, `avg_frequency` decimal(12,4) DEFAULT NULL, `hist_size` tinyint(3) unsigned DEFAULT NULL, - `hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') COLLATE utf8mb3_bin DEFAULT NULL, + `hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') DEFAULT NULL, `histogram` longblob DEFAULT NULL, PRIMARY KEY (`db_name`,`table_name`,`column_name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns' show create table index_stats; Table Create Table index_stats CREATE TABLE `index_stats` ( - `db_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `index_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `db_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, + `index_name` varchar(64) NOT NULL, `prefix_arity` int(11) unsigned NOT NULL, `avg_frequency` decimal(12,4) DEFAULT NULL, PRIMARY KEY (`db_name`,`table_name`,`index_name`,`prefix_arity`) diff --git a/mysql-test/main/system_mysql_db_fix50030.result b/mysql-test/main/system_mysql_db_fix50030.result index 4244ab47d50fe..28a33d1110469 100644 --- a/mysql-test/main/system_mysql_db_fix50030.result +++ b/mysql-test/main/system_mysql_db_fix50030.result @@ -76,29 +76,29 @@ user show create table db; Table Create Table db CREATE TABLE `db` ( - `Host` char(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `References_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Delete_history_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `References_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Delete_history_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', PRIMARY KEY (`Host`,`Db`,`User`), KEY `User` (`User`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Database privileges' @@ -108,56 +108,56 @@ user CREATE ALGORITHM=UNDEFINED DEFINER=`mariadb.sys`@`localhost` SQL SECURITY D show create table func; Table Create Table func CREATE TABLE `func` ( - `name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `name` char(64) NOT NULL DEFAULT '', `ret` tinyint(1) NOT NULL DEFAULT 0, - `dl` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `type` enum('function','aggregate') CHARACTER SET utf8mb3 NOT NULL, + `dl` char(128) NOT NULL DEFAULT '', + `type` enum('function','aggregate') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(255) NOT NULL DEFAULT '', + `User` char(128) 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=utf8mb3 COLLATE=utf8mb3_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` ( - `Host` char(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Table_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Grantor` varchar(384) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Table_name` char(64) NOT NULL DEFAULT '', + `Grantor` varchar(384) NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', - `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', + `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), KEY `Grantor` (`Grantor`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Table privileges' show create table columns_priv; Table Create Table columns_priv CREATE TABLE `columns_priv` ( - `Host` char(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Table_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Column_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Table_name` char(64) NOT NULL DEFAULT '', + `Column_name` char(64) NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Column privileges' show create table procs_priv; Table Create Table procs_priv CREATE TABLE `procs_priv` ( - `Host` char(60) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Routine_name` char(64) CHARACTER SET utf8mb3 NOT NULL DEFAULT '', - `Routine_type` enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') COLLATE utf8mb3_bin NOT NULL, - `Grantor` varchar(384) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Host` char(60) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Routine_name` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', + `Routine_type` enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') NOT NULL, + `Grantor` varchar(384) NOT NULL DEFAULT '', + `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), KEY `Grantor` (`Grantor`) @@ -166,16 +166,16 @@ show create table servers; Table Create Table servers CREATE TABLE `servers` ( `Server_name` char(64) NOT NULL DEFAULT '', - `Host` char(64) NOT NULL DEFAULT '', + `Host` varchar(2048) NOT NULL DEFAULT '', `Db` char(64) NOT NULL DEFAULT '', `Username` char(128) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, `Socket` char(64) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', - `Owner` char(64) NOT NULL DEFAULT '', + `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) -) ENGINE=Aria DEFAULT CHARSET=utf8mb3 PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='MySQL Foreign Servers table' +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='MySQL Foreign Servers table' show create table proc; Table Create Table proc CREATE TABLE `proc` ( @@ -201,7 +201,7 @@ proc CREATE TABLE `proc` ( `body_utf8` longblob DEFAULT NULL, `aggregate` enum('NONE','GROUP') NOT NULL DEFAULT 'NONE', PRIMARY KEY (`db`,`name`,`type`) -) ENGINE=Aria DEFAULT CHARSET=utf8mb3 PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Stored Procedures' +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Stored Procedures' show create table event; Table Create Table event CREATE TABLE `event` ( @@ -222,13 +222,13 @@ event CREATE TABLE `event` ( `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 utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', `originator` int(10) unsigned NOT NULL, - `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', + `time_zone` char(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'SYSTEM', `character_set_client` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `collation_connection` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `db_collation` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `body_utf8` longblob DEFAULT NULL, PRIMARY KEY (`db`,`name`) -) ENGINE=Aria DEFAULT CHARSET=utf8mb3 PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Events' +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Events' show create table general_log; Table Create Table general_log CREATE TABLE `general_log` ( @@ -238,7 +238,7 @@ general_log CREATE TABLE `general_log` ( `server_id` int(10) unsigned NOT NULL, `command_type` varchar(64) NOT NULL, `argument` mediumtext NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='General log' +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='General log' show create table slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( @@ -255,37 +255,37 @@ slow_log CREATE TABLE `slow_log` ( `sql_text` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `rows_affected` int(11) NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='Slow log' +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log' show create table table_stats; Table Create Table table_stats CREATE TABLE `table_stats` ( - `db_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `db_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, `cardinality` bigint(21) unsigned DEFAULT NULL, PRIMARY KEY (`db_name`,`table_name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Tables' show create table column_stats; Table Create Table column_stats CREATE TABLE `column_stats` ( - `db_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `column_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `db_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, + `column_name` varchar(64) NOT NULL, `min_value` varbinary(255) DEFAULT NULL, `max_value` varbinary(255) DEFAULT NULL, `nulls_ratio` decimal(12,4) DEFAULT NULL, `avg_length` decimal(12,4) DEFAULT NULL, `avg_frequency` decimal(12,4) DEFAULT NULL, `hist_size` tinyint(3) unsigned DEFAULT NULL, - `hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') COLLATE utf8mb3_bin DEFAULT NULL, + `hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') DEFAULT NULL, `histogram` longblob DEFAULT NULL, PRIMARY KEY (`db_name`,`table_name`,`column_name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns' show create table index_stats; Table Create Table index_stats CREATE TABLE `index_stats` ( - `db_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `index_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `db_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, + `index_name` varchar(64) NOT NULL, `prefix_arity` int(11) unsigned NOT NULL, `avg_frequency` decimal(12,4) DEFAULT NULL, PRIMARY KEY (`db_name`,`table_name`,`index_name`,`prefix_arity`) diff --git a/mysql-test/main/system_mysql_db_fix50117.result b/mysql-test/main/system_mysql_db_fix50117.result index 5934140631521..10f6ae00c97b5 100644 --- a/mysql-test/main/system_mysql_db_fix50117.result +++ b/mysql-test/main/system_mysql_db_fix50117.result @@ -56,29 +56,29 @@ user show create table db; Table Create Table db CREATE TABLE `db` ( - `Host` char(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `References_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', - `Delete_history_priv` enum('N','Y') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'N', + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `References_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Delete_history_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', PRIMARY KEY (`Host`,`Db`,`User`), KEY `User` (`User`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Database privileges' @@ -88,56 +88,56 @@ user CREATE ALGORITHM=UNDEFINED DEFINER=`mariadb.sys`@`localhost` SQL SECURITY D show create table func; Table Create Table func CREATE TABLE `func` ( - `name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `name` char(64) NOT NULL DEFAULT '', `ret` tinyint(1) NOT NULL DEFAULT 0, - `dl` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `type` enum('function','aggregate') CHARACTER SET utf8mb3 NOT NULL, + `dl` char(128) NOT NULL DEFAULT '', + `type` enum('function','aggregate') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(255) NOT NULL DEFAULT '', + `User` char(128) 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=utf8mb3 COLLATE=utf8mb3_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` ( - `Host` char(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Table_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Grantor` varchar(384) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Table_name` char(64) NOT NULL DEFAULT '', + `Grantor` varchar(384) NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', - `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', + `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), KEY `Grantor` (`Grantor`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Table privileges' show create table columns_priv; Table Create Table columns_priv CREATE TABLE `columns_priv` ( - `Host` char(255) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Table_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Column_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Table_name` char(64) NOT NULL DEFAULT '', + `Column_name` char(64) NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Column privileges' show create table procs_priv; Table Create Table procs_priv CREATE TABLE `procs_priv` ( - `Host` char(60) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `User` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Routine_name` char(64) CHARACTER SET utf8mb3 NOT NULL DEFAULT '', - `Routine_type` enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') COLLATE utf8mb3_bin NOT NULL, - `Grantor` varchar(384) COLLATE utf8mb3_bin NOT NULL DEFAULT '', - `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8mb3 NOT NULL DEFAULT '', + `Host` char(60) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Routine_name` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', + `Routine_type` enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') NOT NULL, + `Grantor` varchar(384) NOT NULL DEFAULT '', + `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), KEY `Grantor` (`Grantor`) @@ -146,16 +146,16 @@ show create table servers; Table Create Table servers CREATE TABLE `servers` ( `Server_name` char(64) NOT NULL DEFAULT '', - `Host` char(64) NOT NULL DEFAULT '', + `Host` varchar(2048) NOT NULL DEFAULT '', `Db` char(64) NOT NULL DEFAULT '', `Username` char(128) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, `Socket` char(64) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', - `Owner` char(64) NOT NULL DEFAULT '', + `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) -) ENGINE=Aria DEFAULT CHARSET=utf8mb3 PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='MySQL Foreign Servers table' +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='MySQL Foreign Servers table' show create table proc; Table Create Table proc CREATE TABLE `proc` ( @@ -181,7 +181,7 @@ proc CREATE TABLE `proc` ( `body_utf8` longblob DEFAULT NULL, `aggregate` enum('NONE','GROUP') NOT NULL DEFAULT 'NONE', PRIMARY KEY (`db`,`name`,`type`) -) ENGINE=Aria DEFAULT CHARSET=utf8mb3 PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Stored Procedures' +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Stored Procedures' show create table event; Table Create Table event CREATE TABLE `event` ( @@ -202,13 +202,13 @@ event CREATE TABLE `event` ( `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 utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', `originator` int(10) unsigned NOT NULL, - `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', + `time_zone` char(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'SYSTEM', `character_set_client` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `collation_connection` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `db_collation` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, `body_utf8` longblob DEFAULT NULL, PRIMARY KEY (`db`,`name`) -) ENGINE=Aria DEFAULT CHARSET=utf8mb3 PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Events' +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Events' show create table general_log; Table Create Table general_log CREATE TABLE `general_log` ( @@ -218,7 +218,7 @@ general_log CREATE TABLE `general_log` ( `server_id` int(10) unsigned NOT NULL, `command_type` varchar(64) NOT NULL, `argument` mediumtext NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='General log' +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='General log' show create table slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( @@ -235,37 +235,37 @@ slow_log CREATE TABLE `slow_log` ( `sql_text` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `rows_affected` int(11) NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='Slow log' +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log' show create table table_stats; Table Create Table table_stats CREATE TABLE `table_stats` ( - `db_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `db_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, `cardinality` bigint(21) unsigned DEFAULT NULL, PRIMARY KEY (`db_name`,`table_name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Tables' show create table column_stats; Table Create Table column_stats CREATE TABLE `column_stats` ( - `db_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `column_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `db_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, + `column_name` varchar(64) NOT NULL, `min_value` varbinary(255) DEFAULT NULL, `max_value` varbinary(255) DEFAULT NULL, `nulls_ratio` decimal(12,4) DEFAULT NULL, `avg_length` decimal(12,4) DEFAULT NULL, `avg_frequency` decimal(12,4) DEFAULT NULL, `hist_size` tinyint(3) unsigned DEFAULT NULL, - `hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') COLLATE utf8mb3_bin DEFAULT NULL, + `hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') DEFAULT NULL, `histogram` longblob DEFAULT NULL, PRIMARY KEY (`db_name`,`table_name`,`column_name`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns' show create table index_stats; Table Create Table index_stats CREATE TABLE `index_stats` ( - `db_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, - `index_name` varchar(64) COLLATE utf8mb3_bin NOT NULL, + `db_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, + `index_name` varchar(64) NOT NULL, `prefix_arity` int(11) unsigned NOT NULL, `avg_frequency` decimal(12,4) DEFAULT NULL, PRIMARY KEY (`db_name`,`table_name`,`index_name`,`prefix_arity`) diff --git a/mysql-test/main/system_mysql_db_fix50568.result b/mysql-test/main/system_mysql_db_fix50568.result new file mode 100644 index 0000000000000..842d470f3ccca --- /dev/null +++ b/mysql-test/main/system_mysql_db_fix50568.result @@ -0,0 +1,297 @@ +use test; +CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary 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, 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, 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, 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, Execute_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, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges'; +Warnings: +Warning 1280 Name 'Host' ignored for PRIMARY key. +CREATE TABLE IF NOT EXISTS host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary 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, 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, 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, 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, Execute_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, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges'; +Warnings: +Warning 1280 Name 'Host' ignored for PRIMARY key. +CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) 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, 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, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'; +Warnings: +Warning 1280 Name 'Host' ignored for PRIMARY key. +CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions'; +CREATE TABLE IF NOT EXISTS plugin ( name varchar(64) DEFAULT '' NOT NULL, dl varchar(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci comment='MySQL plugins'; +CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table'; +CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges'; +CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges'; +CREATE TABLE IF NOT EXISTS help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url text not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics'; +CREATE TABLE IF NOT EXISTS help_category ( help_category_id smallint unsigned not null, name char(64) not null, parent_category_id smallint unsigned null, url text not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories'; +CREATE TABLE IF NOT EXISTS help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation'; +CREATE TABLE IF NOT EXISTS help_keyword ( help_keyword_id int unsigned not null, name char(64) not null, primary key (help_keyword_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help keywords'; +CREATE TABLE IF NOT EXISTS time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names'; +Warnings: +Warning 1280 Name 'Name' ignored for PRIMARY key. +CREATE TABLE IF NOT EXISTS time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones'; +Warnings: +Warning 1280 Name 'TzId' ignored for PRIMARY key. +CREATE TABLE IF NOT EXISTS time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions'; +Warnings: +Warning 1280 Name 'TzIdTranTime' ignored for PRIMARY key. +CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, `Offset` int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types'; +Warnings: +Warning 1280 Name 'TzIdTrTId' ignored for PRIMARY key. +CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones'; +Warnings: +Warning 1280 Name 'TranTime' ignored for PRIMARY key. +CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin 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', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') 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 NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin 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', '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') DEFAULT '' NOT NULL, comment text collate utf8_bin NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures'; +CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) COLLATE utf8_general_ci DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges'; +CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, 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') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator INTEGER UNSIGNED NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events'; +CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM; +CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(16) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges'; +Warnings: +Warning 1280 Name 'Host' ignored for PRIMARY key. +show tables; +Tables_in_db +column_stats +columns_priv +db +event +func +general_log +global_priv +gtid_slave_pos +help_category +help_keyword +help_relation +help_topic +host +index_stats +innodb_index_stats +innodb_table_stats +ndb_binlog_index +plugin +proc +procs_priv +proxies_priv +roles_mapping +servers +slow_log +table_stats +tables_priv +time_zone +time_zone_leap_second +time_zone_name +time_zone_transition +time_zone_transition_type +transaction_registry +user +show create table db; +Table Create Table +db CREATE TABLE `db` ( + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `References_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + `Delete_history_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N', + PRIMARY KEY (`Host`,`Db`,`User`), + KEY `User` (`User`) +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Database privileges' +show create table user; +View Create View character_set_client collation_connection +user CREATE ALGORITHM=UNDEFINED DEFINER=`mariadb.sys`@`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`,if(ifnull(json_value(`global_priv`.`Priv`,'$.password_last_changed'),1) = 0,'Y','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` ( + `name` char(64) NOT NULL DEFAULT '', + `ret` tinyint(1) NOT NULL DEFAULT 0, + `dl` char(128) NOT NULL DEFAULT '', + `type` enum('function','aggregate') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + PRIMARY KEY (`name`) +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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(255) NOT NULL DEFAULT '', + `User` char(128) 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=utf8mb3 COLLATE=utf8mb3_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` ( + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Table_name` char(64) NOT NULL DEFAULT '', + `Grantor` varchar(384) NOT NULL DEFAULT '', + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', + `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', + PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), + KEY `Grantor` (`Grantor`) +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Table privileges' +show create table columns_priv; +Table Create Table +columns_priv CREATE TABLE `columns_priv` ( + `Host` char(255) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Table_name` char(64) NOT NULL DEFAULT '', + `Column_name` char(64) NOT NULL DEFAULT '', + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', + PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Column privileges' +show create table procs_priv; +Table Create Table +procs_priv CREATE TABLE `procs_priv` ( + `Host` char(60) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `User` char(128) NOT NULL DEFAULT '', + `Routine_name` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', + `Routine_type` enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') NOT NULL, + `Grantor` varchar(384) NOT NULL DEFAULT '', + `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), + KEY `Grantor` (`Grantor`) +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Procedure privileges' +show create table servers; +Table Create Table +servers CREATE TABLE `servers` ( + `Server_name` char(64) NOT NULL DEFAULT '', + `Host` varchar(2048) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `Username` char(128) NOT NULL DEFAULT '', + `Password` char(64) NOT NULL DEFAULT '', + `Port` int(4) NOT NULL DEFAULT 0, + `Socket` char(64) NOT NULL DEFAULT '', + `Wrapper` char(64) NOT NULL DEFAULT '', + `Owner` varchar(512) NOT NULL DEFAULT '', + PRIMARY KEY (`Server_name`) +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='MySQL Foreign Servers table' +show create table proc; +Table Create Table +proc CREATE TABLE `proc` ( + `db` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `name` char(64) NOT NULL DEFAULT '', + `type` enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') NOT NULL, + `specific_name` char(64) NOT NULL DEFAULT '', + `language` enum('SQL') NOT NULL DEFAULT 'SQL', + `sql_data_access` enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') NOT NULL DEFAULT 'CONTAINS_SQL', + `is_deterministic` enum('YES','NO') NOT NULL DEFAULT 'NO', + `security_type` enum('INVOKER','DEFINER') NOT NULL DEFAULT 'DEFINER', + `param_list` blob NOT NULL, + `returns` longblob NOT NULL, + `body` longblob NOT NULL, + `definer` varchar(384) CHARACTER SET utf8mb3 COLLATE utf8mb3_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','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '', + `comment` text CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL, + `character_set_client` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, + `collation_connection` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, + `db_collation` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, + `body_utf8` longblob DEFAULT NULL, + `aggregate` enum('NONE','GROUP') NOT NULL DEFAULT 'NONE', + PRIMARY KEY (`db`,`name`,`type`) +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Stored Procedures' +show create table event; +Table Create Table +event CREATE TABLE `event` ( + `db` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `name` char(64) NOT NULL DEFAULT '', + `body` longblob NOT NULL, + `definer` varchar(384) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `execute_at` datetime DEFAULT NULL, + `interval_value` int(11) DEFAULT NULL, + `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `last_executed` datetime DEFAULT NULL, + `starts` datetime DEFAULT NULL, + `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','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '', + `comment` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `originator` int(10) unsigned NOT NULL, + `time_zone` char(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'SYSTEM', + `character_set_client` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, + `collation_connection` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, + `db_collation` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, + `body_utf8` longblob DEFAULT NULL, + PRIMARY KEY (`db`,`name`) +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Events' +show create table general_log; +Table Create Table +general_log CREATE TABLE `general_log` ( + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `user_host` mediumtext NOT NULL, + `thread_id` bigint(21) unsigned NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `command_type` varchar(64) NOT NULL, + `argument` mediumtext NOT NULL +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='General log' +show create table slow_log; +Table Create Table +slow_log CREATE TABLE `slow_log` ( + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `user_host` mediumtext NOT NULL, + `query_time` time(6) NOT NULL, + `lock_time` time(6) NOT NULL, + `rows_sent` int(11) NOT NULL, + `rows_examined` int(11) NOT NULL, + `db` varchar(512) NOT NULL, + `last_insert_id` int(11) NOT NULL, + `insert_id` int(11) NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `sql_text` mediumtext NOT NULL, + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log' +show create table table_stats; +Table Create Table +table_stats CREATE TABLE `table_stats` ( + `db_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, + `cardinality` bigint(21) unsigned DEFAULT NULL, + PRIMARY KEY (`db_name`,`table_name`) +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Tables' +show create table column_stats; +Table Create Table +column_stats CREATE TABLE `column_stats` ( + `db_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, + `column_name` varchar(64) NOT NULL, + `min_value` varbinary(255) DEFAULT NULL, + `max_value` varbinary(255) DEFAULT NULL, + `nulls_ratio` decimal(12,4) DEFAULT NULL, + `avg_length` decimal(12,4) DEFAULT NULL, + `avg_frequency` decimal(12,4) DEFAULT NULL, + `hist_size` tinyint(3) unsigned DEFAULT NULL, + `hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') DEFAULT NULL, + `histogram` longblob DEFAULT NULL, + PRIMARY KEY (`db_name`,`table_name`,`column_name`) +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns' +show create table index_stats; +Table Create Table +index_stats CREATE TABLE `index_stats` ( + `db_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, + `index_name` varchar(64) NOT NULL, + `prefix_arity` int(11) unsigned NOT NULL, + `avg_frequency` decimal(12,4) DEFAULT NULL, + PRIMARY KEY (`db_name`,`table_name`,`index_name`,`prefix_arity`) +) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Indexes' +DROP VIEW user; +DROP TABLE db, host, 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, event, proxies_priv, general_log, slow_log, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos, global_priv, ndb_binlog_index; +show tables; +Tables_in_test diff --git a/mysql-test/main/system_mysql_db_fix50568.test b/mysql-test/main/system_mysql_db_fix50568.test new file mode 100644 index 0000000000000..3429f8c54783c --- /dev/null +++ b/mysql-test/main/system_mysql_db_fix50568.test @@ -0,0 +1,99 @@ +# Embedded server doesn't support external clients +--source include/not_embedded.inc +--source include/have_innodb.inc + +# Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set +# to the location of mysql_fix_privilege_tables.sql +if (!$MYSQL_FIX_PRIVILEGE_TABLES) +{ + skip Test needs MYSQL_FIX_PRIVILEGE_TABLES; +} + +# +# This is the test for mysql_fix_privilege_tables +# It checks that a system tables from mysql 5.5.68 +# can be upgraded to current system table format +# +# Note: If this test fails, don't be confused about the errors reported +# by mysql-test-run This shows warnings generated by +# mysql_fix_system_tables which should be ignored. +# Instead, concentrate on the errors in r/system_mysql_db.reject + +use test; + +# create system tables as in mysql-5.5.68 +CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary 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, 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, 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, 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, Execute_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, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges'; + +CREATE TABLE IF NOT EXISTS host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary 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, 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, 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, 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, Execute_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, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges'; + +CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) 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, 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, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'; + +CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions'; + + +CREATE TABLE IF NOT EXISTS plugin ( name varchar(64) DEFAULT '' NOT NULL, dl varchar(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci comment='MySQL plugins'; + + +CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table'; + + +CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges'; + +CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges'; + + +CREATE TABLE IF NOT EXISTS help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url text not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics'; + + +CREATE TABLE IF NOT EXISTS help_category ( help_category_id smallint unsigned not null, name char(64) not null, parent_category_id smallint unsigned null, url text not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories'; + + +CREATE TABLE IF NOT EXISTS help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation'; + + +CREATE TABLE IF NOT EXISTS help_keyword ( help_keyword_id int unsigned not null, name char(64) not null, primary key (help_keyword_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help keywords'; + + +CREATE TABLE IF NOT EXISTS time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names'; + + +CREATE TABLE IF NOT EXISTS time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones'; + + +CREATE TABLE IF NOT EXISTS time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions'; + + +CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, `Offset` int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types'; + + +CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones'; + +CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin 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', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') 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 NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin 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', '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') DEFAULT '' NOT NULL, comment text collate utf8_bin NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures'; + +CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) COLLATE utf8_general_ci DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges'; + + +CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, 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') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator INTEGER UNSIGNED NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events'; + + +CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM; + +CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(16) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges'; + + +-- disable_result_log +# Run the mysql_fix_privilege_tables.sql using "mysql --force" +--exec $MYSQL --force test < $MYSQL_FIX_PRIVILEGE_TABLES +-- enable_result_log + +# Dump the tables that should be compared +-- source include/system_db_struct.inc + +# Drop all tables created by this test +DROP VIEW user; +DROP TABLE db, host, 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, event, proxies_priv, general_log, slow_log, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos, global_priv, ndb_binlog_index; + +# check that we dropped all system tables +show tables; + +# End of 4.1 tests diff --git a/mysql-test/main/table_elim.test b/mysql-test/main/table_elim.test index 8de4743b9fd25..e5770877e6fd7 100644 --- a/mysql-test/main/table_elim.test +++ b/mysql-test/main/table_elim.test @@ -614,6 +614,10 @@ SET optimizer_switch=@save_optimizer_switch; --echo # --echo # MDEV-7893: table_elimination works wrong with on computed expression and compound unique key --echo # (just a testcase) + +#enable after fix MDEV-28602 +--disable_view_protocol + CREATE TABLE t1 ( PostID int(10) unsigned NOT NULL ) DEFAULT CHARSET=utf8; @@ -641,3 +645,4 @@ LIMIT 1; DROP TABLE t1,t2; +--enable_view_protocol diff --git a/mysql-test/main/table_options-5867.result b/mysql-test/main/table_options-5867.result index f915c2740ae7d..e06e5f4c2c727 100644 --- a/mysql-test/main/table_options-5867.result +++ b/mysql-test/main/table_options-5867.result @@ -14,24 +14,24 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `complex`='c,f,f,f' `invalid`=3 -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=10000 `str`='dskj' `one_or_two`='one' `yesno`=0 `foobar`=barfoo +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `ull`=10000 `str`='dskj' `one_or_two`='one' `yesno`=0 `foobar`=barfoo show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, KEY `a` (`a`) `some_option`=2014 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci set sql_mode=''; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `complex`='c,f,f,f' /* `invalid`=3 */ -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=10000 `str`='dskj' `one_or_two`='one' `yesno`=0 /* `foobar`=barfoo */ +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `ull`=10000 `str`='dskj' `one_or_two`='one' `yesno`=0 /* `foobar`=barfoo */ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, KEY `a` (`a`) /* `some_option`=2014 */ -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; uninstall soname 'ha_example'; diff --git a/mysql-test/main/table_options.result b/mysql-test/main/table_options.result index 164fe4e30d050..60f25c96a0dce 100644 --- a/mysql-test/main/table_options.result +++ b/mysql-test/main/table_options.result @@ -11,7 +11,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `fkey`=vvv, KEY `akey` (`a`) `dff`=vvv -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey1`='1v1' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `tkey1`='1v1' drop table t1; #reassiginig options in the same line create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1 TKEY1=DEFAULT tkey1=1v2 tkey2=2v1; @@ -25,7 +25,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `fkey`=vvv, KEY `akey` (`a`) `dff`=vvv -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey1`=1v2 `tkey2`=2v1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `tkey1`=1v2 `tkey2`=2v1 #add option alter table t1 tkey4=4v1; Warnings: @@ -35,7 +35,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `fkey`=vvv, KEY `akey` (`a`) `dff`=vvv -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey1`=1v2 `tkey2`=2v1 `tkey4`=4v1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `tkey1`=1v2 `tkey2`=2v1 `tkey4`=4v1 #remove options alter table t1 tkey3=DEFAULT tkey4=DEFAULT; Warnings: @@ -46,7 +46,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `fkey`=vvv, KEY `akey` (`a`) `dff`=vvv -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey1`=1v2 `tkey2`=2v1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `tkey1`=1v2 `tkey2`=2v1 drop table t1; create table t1 (a int fkey1=v1, key akey (a) kkey1=v1) tkey1=1v1 tkey1=1v2 TKEY1=DEFAULT tkey2=2v1 tkey3=3v1; Warnings: @@ -60,7 +60,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `fkey1`=v1, KEY `akey` (`a`) `kkey1`=v1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `tkey2`=2v1 `tkey3`=3v1 #change field with option with the same value alter table t1 change a a int `FKEY1`='v1'; Warnings: @@ -70,7 +70,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `FKEY1`='v1', KEY `akey` (`a`) `kkey1`=v1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `tkey2`=2v1 `tkey3`=3v1 #change field with option with a different value alter table t1 change a a int fkey1=v2; Warnings: @@ -80,7 +80,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `fkey1`=v2, KEY `akey` (`a`) `kkey1`=v1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `tkey2`=2v1 `tkey3`=3v1 #new column no options alter table t1 add column b int; show create table t1; @@ -89,7 +89,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `fkey1`=v2, `b` int(11) DEFAULT NULL, KEY `akey` (`a`) `kkey1`=v1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `tkey2`=2v1 `tkey3`=3v1 #new key with options alter table t1 add key bkey (b) kkey2=v1; Warnings: @@ -101,7 +101,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, KEY `akey` (`a`) `kkey1`=v1, KEY `bkey` (`b`) `kkey2`=v1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `tkey2`=2v1 `tkey3`=3v1 #new column with options alter table t1 add column c int fkey1=v1 fkey2=v2; Warnings: @@ -115,7 +115,7 @@ t1 CREATE TABLE `t1` ( `c` int(11) DEFAULT NULL `fkey1`=v1 `fkey2`=v2, KEY `akey` (`a`) `kkey1`=v1, KEY `bkey` (`b`) `kkey2`=v1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `tkey2`=2v1 `tkey3`=3v1 #new key no options alter table t1 add key ckey (c); show create table t1; @@ -127,7 +127,7 @@ t1 CREATE TABLE `t1` ( KEY `akey` (`a`) `kkey1`=v1, KEY `bkey` (`b`) `kkey2`=v1, KEY `ckey` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `tkey2`=2v1 `tkey3`=3v1 #drop column alter table t1 drop b; show create table t1; @@ -137,7 +137,7 @@ t1 CREATE TABLE `t1` ( `c` int(11) DEFAULT NULL `fkey1`=v1 `fkey2`=v2, KEY `akey` (`a`) `kkey1`=v1, KEY `ckey` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `tkey2`=2v1 `tkey3`=3v1 #add column with options after delete alter table t1 add column b int fkey2=v1; Warnings: @@ -150,7 +150,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL `fkey2`=v1, KEY `akey` (`a`) `kkey1`=v1, KEY `ckey` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `tkey2`=2v1 `tkey3`=3v1 #add key alter table t1 add key bkey (b) kkey2=v2; Warnings: @@ -164,7 +164,7 @@ t1 CREATE TABLE `t1` ( KEY `akey` (`a`) `kkey1`=v1, KEY `ckey` (`c`), KEY `bkey` (`b`) `kkey2`=v2 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `tkey2`=2v1 `tkey3`=3v1 drop table t1; create table t1 (a int) tkey1=100; Warnings: @@ -173,7 +173,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey1`=100 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `tkey1`=100 drop table t1; #error on unknown option SET SQL_MODE=''; diff --git a/mysql-test/main/table_value_constr.result b/mysql-test/main/table_value_constr.result index 0522e6ae6cc90..49d23264a63c1 100644 --- a/mysql-test/main/table_value_constr.result +++ b/mysql-test/main/table_value_constr.result @@ -1304,8 +1304,6 @@ EXPLAIN { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", "query_specifications": [ { "query_block": { @@ -1525,8 +1523,6 @@ EXPLAIN { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", "query_specifications": [ { "query_block": { @@ -1589,8 +1585,6 @@ EXPLAIN { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", "query_specifications": [ { "query_block": { @@ -1633,8 +1627,6 @@ EXPLAIN { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", "query_specifications": [ { "query_block": { @@ -1677,10 +1669,6 @@ ANALYZE { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", - "r_loops": 0, - "r_rows": null, "query_specifications": [ { "query_block": { @@ -1908,10 +1896,6 @@ ANALYZE { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", - "r_loops": 0, - "r_rows": null, "query_specifications": [ { "query_block": { @@ -1976,10 +1960,6 @@ ANALYZE { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", - "r_loops": 0, - "r_rows": null, "query_specifications": [ { "query_block": { @@ -2022,10 +2002,6 @@ ANALYZE { "query_block": { "union_result": { - "table_name": "", - "access_type": "ALL", - "r_loops": 0, - "r_rows": null, "query_specifications": [ { "query_block": { @@ -3155,5 +3131,124 @@ INSERT INTO t1 (VALUES (IGNORE) UNION VALUES (IGNORE)); ERROR HY000: 'ignore' is not allowed in this context DROP TABLE t1; # +# MDEV-28603: VIEW with table value constructor used as single-value +# subquery contains subquery as its first element +# +create table t1 (a int); +insert into t1 values (3), (7), (1); +create table t2 (b int); +insert into t2 values (1), (2); +create view v as select (values ((select * from t1 where a > 5))) as m from t2; +select (values ((select * from t1 where a > 5))) as m from t2; +m +7 +7 +select * from v; +m +7 +7 +with cte as ( select (values ((select * from t1 where a > 5))) as m from t2 ) select * from cte; +m +7 +7 +explain select (values ((select * from t1 where a > 5))) as m from t2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 +4 SUBQUERY ALL NULL NULL NULL NULL 2 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where +explain select * from v; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 +5 SUBQUERY ALL NULL NULL NULL NULL 2 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +4 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where +explain with cte as ( select (values ((select * from t1 where a > 5))) as m from t2 ) select * from cte; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 +5 SUBQUERY ALL NULL NULL NULL NULL 2 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +4 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where +prepare stmt from "select (values ((select * from t1 where a > 5))) as m from t2"; +execute stmt; +m +7 +7 +execute stmt; +m +7 +7 +deallocate prepare stmt; +prepare stmt from "select * from v"; +execute stmt; +m +7 +7 +execute stmt; +m +7 +7 +deallocate prepare stmt; +prepare stmt from "with cte as ( select (values ((select * from t1 where a > 5))) as m from t2 ) select * from cte"; +execute stmt; +m +7 +7 +execute stmt; +m +7 +7 +deallocate prepare stmt; +show create view v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select (values ((select `t1`.`a` from `t1` where `t1`.`a` > 5))) AS `m` from `t2` latin1 latin1_swedish_ci +drop view v; +prepare stmt from "create view v as select (values ((select * from t1 where a > 5))) as m from t2"; +execute stmt; +show create view v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select (values ((select `t1`.`a` from `t1` where `t1`.`a` > 5))) AS `m` from `t2` latin1 latin1_swedish_ci +select * from v; +m +7 +7 +drop view v; +execute stmt; +show create view v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select (values ((select `t1`.`a` from `t1` where `t1`.`a` > 5))) AS `m` from `t2` latin1 latin1_swedish_ci +select * from v; +m +7 +7 +deallocate prepare stmt; +prepare stmt from "show create view v"; +execute stmt; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select (values ((select `t1`.`a` from `t1` where `t1`.`a` > 5))) AS `m` from `t2` latin1 latin1_swedish_ci +execute stmt; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select (values ((select `t1`.`a` from `t1` where `t1`.`a` > 5))) AS `m` from `t2` latin1 latin1_swedish_ci +deallocate prepare stmt; +drop view v; +create view v as select (values ((select * from t1 where a > 5 +union +select * from t1 where a > 7))) as m from t2; +select (values ((select * from t1 where a > 5 +union +select * from t1 where a > 7))) as m from t2; +m +7 +7 +select * from v; +m +7 +7 +show create view v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select (values ((select `t1`.`a` from `t1` where `t1`.`a` > 5 union select `t1`.`a` from `t1` where `t1`.`a` > 7))) AS `m` from `t2` latin1 latin1_swedish_ci +drop view v; +drop table t1,t2; +# # End of 10.4 tests # diff --git a/mysql-test/main/table_value_constr.test b/mysql-test/main/table_value_constr.test index 05aca94135006..177aa96e6373c 100644 --- a/mysql-test/main/table_value_constr.test +++ b/mysql-test/main/table_value_constr.test @@ -1479,6 +1479,9 @@ execute stmt; execute stmt; deallocate prepare stmt; +#enable after fix MDEV-28603 +--disable_view_protocol + let $q2= select (values ((select * from t1 where a > 10))) from t2; eval $q2; @@ -1515,6 +1518,8 @@ execute stmt; execute stmt; deallocate prepare stmt; +--enable_view_protocol + drop view v1; drop table t1,t2,t3; @@ -1586,6 +1591,10 @@ values ((values (2))), ((values ((values (4))))) union all values ((values (8))), ((values ((select 4)))); +#A view definition cannot contain a subquery in the FROM clause +# in the SELECT statement +--disable_view_protocol + select * from (values ((values (2)))) dt; select * from (values ((values (2)), (5), (select 4))) dt; @@ -1598,6 +1607,8 @@ select * from (values ((values (2))), ((values (3)))) dt; select * from (values ((values (2))), ((select 4)), ((values (3)))) dt; +--enable_view_protocol + create table t1 (a int); insert into t1 values (3), (7), (1); @@ -1621,10 +1632,16 @@ values ((values ((select (values(2)) from t1 where a=8)))); --error ER_SUBQUERY_NO_1_ROW values ((select (values(2)) from t1 where a<7)); +#A view definition cannot contain a subquery in the FROM clause +# in the SELECT statement +--disable_view_protocol + select * from (values ((values ((select a from t1 where a=7))))) dt; select * from (values ((values ((select (values(2)) from t1 where a=8))))) dt; +--enable_view_protocol + insert into t1(a) values ((values (2))), ((values (3))); select * from t1; @@ -1635,6 +1652,10 @@ drop table t1; --echo # MDEV-25484: Derived table using TVC with LIMIT and ORDER BY --echo # +#A view definition cannot contain a subquery in the FROM clause +# in the SELECT statement +--disable_view_protocol + create table t1 (a int); insert into t1 values (3), (7), (1); @@ -1652,6 +1673,8 @@ select * from (values (3),(7),(1) union values (2),(4) order by 1 limit 2) as dt drop table t1; +--enable_view_protocol + --echo # --echo # MDEV-23182: Server crashes in --echo # Item::fix_fields_if_needed / table_value_constr::prepare upon 2nd execution of PS @@ -1715,6 +1738,80 @@ INSERT INTO t1 (VALUES (DEFAULT) UNION VALUES (DEFAULT)); INSERT INTO t1 (VALUES (IGNORE) UNION VALUES (IGNORE)); DROP TABLE t1; +--echo # +--echo # MDEV-28603: VIEW with table value constructor used as single-value +--echo # subquery contains subquery as its first element +--echo # + +create table t1 (a int); +insert into t1 values (3), (7), (1); +create table t2 (b int); +insert into t2 values (1), (2); + +let $q= +select (values ((select * from t1 where a > 5))) as m from t2; + +eval create view v as $q; + +eval $q; +eval select * from v; +eval with cte as ( $q ) select * from cte; + +eval explain $q; +eval explain select * from v; +eval explain with cte as ( $q ) select * from cte; + +eval prepare stmt from "$q"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +eval prepare stmt from "select * from v"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +eval prepare stmt from "with cte as ( $q ) select * from cte"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +show create view v; + +drop view v; + +eval prepare stmt from "create view v as $q"; +execute stmt; +show create view v; +select * from v; +drop view v; +execute stmt; +show create view v; +select * from v; +deallocate prepare stmt; + +prepare stmt from "show create view v"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +drop view v; + +let $q= +select (values ((select * from t1 where a > 5 + union + select * from t1 where a > 7))) as m from t2; + +eval create view v as $q; + +eval $q; +eval select * from v; + +show create view v; + +drop view v; +drop table t1,t2; + --echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/temp_table.result b/mysql-test/main/temp_table.result index 0e443cb71ddf9..7f005bde37c62 100644 --- a/mysql-test/main/temp_table.result +++ b/mysql-test/main/temp_table.result @@ -127,7 +127,7 @@ show create table v1; Table Create Table v1 CREATE TEMPORARY TABLE `v1` ( `A` varchar(19) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 'This is view' AS `A` latin1 latin1_swedish_ci diff --git a/mysql-test/main/temp_table.test b/mysql-test/main/temp_table.test index 4f1bb3c55689e..6ed5dbd88dbc6 100644 --- a/mysql-test/main/temp_table.test +++ b/mysql-test/main/temp_table.test @@ -2,6 +2,9 @@ --source include/not_embedded.inc --source include/have_innodb.inc +#View cannot has temporary table in definition +--source include/no_view_protocol.inc + # # Test of temporary tables # diff --git a/mysql-test/main/temp_table_frm.test b/mysql-test/main/temp_table_frm.test index ddc4ffa575c53..47d2fc40d20f0 100644 --- a/mysql-test/main/temp_table_frm.test +++ b/mysql-test/main/temp_table_frm.test @@ -1,7 +1,11 @@ +#View cannot has temporary table in definition +-- source include/no_view_protocol.inc + # # MDEV-4260 Don't create frm files for temporary tables # + # 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; diff --git a/mysql-test/main/temporal_literal.result b/mysql-test/main/temporal_literal.result index 2197b990f3bb4..dc283da463636 100644 --- a/mysql-test/main/temporal_literal.result +++ b/mysql-test/main/temporal_literal.result @@ -41,7 +41,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `DATE'2010-01-01'` date NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT {d'2001-01-01'}, @@ -53,7 +53,7 @@ t1 CREATE TABLE `t1` ( `{d'2001-01-01'}` date NOT NULL, `{ d '2001-01-01' }` date NOT NULL, `2001-01-01 10:10:10` varchar(19) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXPLAIN EXTENDED SELECT {d'2010-01-01'}; id select_type table type possible_keys key key_len ref rows filtered Extra @@ -158,7 +158,7 @@ t1 CREATE TABLE `t1` ( `TIME'10:10:10.1234'` time(4) NOT NULL, `TIME'10:10:10.12345'` time(5) NOT NULL, `TIME'10:10:10.123456'` time(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT {t'10:10:10'}, @@ -174,7 +174,7 @@ t1 CREATE TABLE `t1` ( `{t'10:10:10.'}` time NOT NULL, `{t'10:10:10.123456'}` time(6) NOT NULL, `2001-01-01` varchar(10) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXPLAIN EXTENDED SELECT {t'10:01:01'}; id select_type table type possible_keys key key_len ref rows filtered Extra @@ -250,7 +250,7 @@ t1 CREATE TABLE `t1` ( `TIMESTAMP'2010-01-01 10:10:10.1234'` datetime(4) NOT NULL, `TIMESTAMP'2010-01-01 10:10:10.12345'` datetime(5) NOT NULL, `TIMESTAMP'2010-01-01 10:10:10.123456'` datetime(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT {ts'2001-01-01 10:10:10'}, @@ -266,7 +266,7 @@ t1 CREATE TABLE `t1` ( `{ts'2001-01-01 10:10:10.'}` datetime NOT NULL, `{ts'2001-01-01 10:10:10.123456'}` datetime(6) NOT NULL, `2001-01-01` varchar(10) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; EXPLAIN EXTENDED SELECT {ts'2010-01-01 10:10:10'}; id select_type table type possible_keys key key_len ref rows filtered Extra @@ -594,7 +594,7 @@ t1 CREATE TABLE `t1` ( `DATE'2001-00-00'` date DEFAULT NULL, `DATE'2001-00-01'` date DEFAULT NULL, `DATE'2001-01-00'` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT TIMESTAMP'2001-01-01 00:00:00', @@ -610,7 +610,7 @@ t1 CREATE TABLE `t1` ( `TIMESTAMP'2001-00-00 00:00:00'` datetime DEFAULT NULL, `TIMESTAMP'2001-00-01 00:00:00'` datetime DEFAULT NULL, `TIMESTAMP'2001-01-00 00:00:00'` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-5975 Prepared statements with DATE literals do not honor NO_ZERO_IN_DATE diff --git a/mysql-test/main/thread_pool_info.result b/mysql-test/main/thread_pool_info.result index 53fa1d1255dbb..d79a4f8d50b05 100644 --- a/mysql-test/main/thread_pool_info.result +++ b/mysql-test/main/thread_pool_info.result @@ -1,13 +1,13 @@ DESC INFORMATION_SCHEMA.THREAD_POOL_GROUPS; Field Type Null Key Default Extra -GROUP_ID int(6) NO 0 -CONNECTIONS int(6) NO 0 -THREADS int(6) NO 0 -ACTIVE_THREADS int(6) NO 0 -STANDBY_THREADS int(6) NO 0 -QUEUE_LENGTH int(6) NO 0 -HAS_LISTENER tinyint(1) NO 0 -IS_STALLED tinyint(1) NO 0 +GROUP_ID int(6) NO NULL +CONNECTIONS int(6) NO NULL +THREADS int(6) NO NULL +ACTIVE_THREADS int(6) NO NULL +STANDBY_THREADS int(6) NO NULL +QUEUE_LENGTH int(6) NO NULL +HAS_LISTENER tinyint(1) NO NULL +IS_STALLED tinyint(1) NO NULL SELECT COUNT(*)=@@thread_pool_size FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS; COUNT(*)=@@thread_pool_size 1 @@ -28,17 +28,17 @@ SUM(IS_STALLED) 0 DESC INFORMATION_SCHEMA.THREAD_POOL_STATS; Field Type Null Key Default Extra -GROUP_ID int(6) NO 0 -THREAD_CREATIONS bigint(19) NO 0 -THREAD_CREATIONS_DUE_TO_STALL bigint(19) NO 0 -WAKES bigint(19) NO 0 -WAKES_DUE_TO_STALL bigint(19) NO 0 -THROTTLES bigint(19) NO 0 -STALLS bigint(19) NO 0 -POLLS_BY_LISTENER bigint(19) NO 0 -POLLS_BY_WORKER bigint(19) NO 0 -DEQUEUES_BY_LISTENER bigint(19) NO 0 -DEQUEUES_BY_WORKER bigint(19) NO 0 +GROUP_ID int(6) NO NULL +THREAD_CREATIONS bigint(19) NO NULL +THREAD_CREATIONS_DUE_TO_STALL bigint(19) NO NULL +WAKES bigint(19) NO NULL +WAKES_DUE_TO_STALL bigint(19) NO NULL +THROTTLES bigint(19) NO NULL +STALLS bigint(19) NO NULL +POLLS_BY_LISTENER bigint(19) NO NULL +POLLS_BY_WORKER bigint(19) NO NULL +DEQUEUES_BY_LISTENER bigint(19) NO NULL +DEQUEUES_BY_WORKER bigint(19) NO NULL SELECT SUM(DEQUEUES_BY_LISTENER+DEQUEUES_BY_WORKER) > 0 FROM INFORMATION_SCHEMA.THREAD_POOL_STATS; SUM(DEQUEUES_BY_LISTENER+DEQUEUES_BY_WORKER) > 0 1 @@ -57,8 +57,8 @@ SUM(POLLS_BY_WORKER) 0 DESC INFORMATION_SCHEMA.THREAD_POOL_WAITS; Field Type Null Key Default Extra -REASON varchar(16) NO -COUNT bigint(19) NO 0 +REASON varchar(16) NO NULL +COUNT bigint(19) NO NULL SELECT REASON FROM INFORMATION_SCHEMA.THREAD_POOL_WAITS; REASON UNKNOWN @@ -85,11 +85,11 @@ COUNT FLUSH THREAD_POOL_WAITS; DESC INFORMATION_SCHEMA.THREAD_POOL_QUEUES; Field Type Null Key Default Extra -GROUP_ID int(6) NO 0 -POSITION int(6) NO 0 -PRIORITY int(1) NO 0 +GROUP_ID int(6) NO NULL +POSITION int(6) NO NULL +PRIORITY int(1) NO NULL CONNECTION_ID bigint(19) unsigned YES NULL -QUEUEING_TIME_MICROSECONDS bigint(19) NO 0 +QUEUEING_TIME_MICROSECONDS bigint(19) NO NULL # restart: with restart_parameters connect con1, localhost, root,,test; connection con1; diff --git a/mysql-test/main/thread_pool_info.test b/mysql-test/main/thread_pool_info.test index cd906454d8c88..8d4ac01bb1c8e 100644 --- a/mysql-test/main/thread_pool_info.test +++ b/mysql-test/main/thread_pool_info.test @@ -1,4 +1,7 @@ source include/not_embedded.inc; +source include/not_aix.inc; + +-- source include/no_view_protocol.inc let $have_plugin = `SELECT COUNT(*) FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_STATUS='ACTIVE' AND PLUGIN_NAME = 'THREAD_POOL_GROUPS'`; if(!$have_plugin) diff --git a/mysql-test/main/timezone.result b/mysql-test/main/timezone.result index d84fe54ba8c12..2ba1e3fb1d59c 100644 --- a/mysql-test/main/timezone.result +++ b/mysql-test/main/timezone.result @@ -1,13 +1,18 @@ -DROP TABLE IF EXISTS t1; show variables like "system_time_zone"; Variable_name Value system_time_zone MET +# +# Test unix timestamp +# select @a:=FROM_UNIXTIME(1); @a:=FROM_UNIXTIME(1) 1970-01-01 01:00:01 select unix_timestamp(@a); unix_timestamp(@a) 1 +# +# Test of some values, including some with daylight saving time +# CREATE TABLE t1 (ts int); INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 01:00')); INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 02:00')); @@ -32,6 +37,9 @@ ts from_unixtime(ts) 1048989599 2003-03-30 03:59:59 1048989601 2003-03-30 04:00:01 DROP TABLE t1; +# +# Test of warning for spring time-gap values for system time zone +# CREATE TABLE t1 (ts timestamp); INSERT INTO t1 (ts) VALUES ('2003-03-30 01:59:59'), ('2003-03-30 02:59:59'), @@ -39,6 +47,9 @@ INSERT INTO t1 (ts) VALUES ('2003-03-30 01:59:59'), Warnings: Warning 1299 Invalid TIMESTAMP value in column 'ts' at row 2 DROP TABLE t1; +# +# Test for fix for Bug#2523 Check that boundary dates are processed correctly. +# select unix_timestamp('1970-01-01 01:00:00'), unix_timestamp('1970-01-01 01:00:01'), unix_timestamp('2038-01-19 04:14:07'), @@ -48,3 +59,19 @@ unix_timestamp('1970-01-01 01:00:00') unix_timestamp('1970-01-01 01:00:01') unix select unix_timestamp('1969-12-31 23:59:59'), unix_timestamp('1970-01-01 00:00:00'), unix_timestamp('1970-01-01 00:59:59'); unix_timestamp('1969-12-31 23:59:59') unix_timestamp('1970-01-01 00:00:00') unix_timestamp('1970-01-01 00:59:59') NULL NULL NULL +# +# End of 4.1 tests +# +# +# MDEV-27393 Timezone tables cannot have descending indexes +# +call mtr.add_suppression('mysql.time_zone_transition_type table is incorrectly defined or corrupted'); +alter table mysql.time_zone_transition_type drop primary key; +alter table mysql.time_zone_transition_type add primary key (time_zone_id,transition_type_id desc); +SET @@time_zone='Japan'; +ERROR HY000: Unknown or incorrect time zone: 'Japan' +alter table mysql.time_zone_transition_type drop primary key; +alter table mysql.time_zone_transition_type add primary key (time_zone_id,transition_type_id); +# +# End of 10.8 tests +# diff --git a/mysql-test/main/timezone.test b/mysql-test/main/timezone.test index ec1d50cf0aebc..89c3ab5cfc1ed 100644 --- a/mysql-test/main/timezone.test +++ b/mysql-test/main/timezone.test @@ -7,24 +7,19 @@ disable_query_log; select FROM_UNIXTIME(24*3600); enable_query_log; -# Initialization ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings - # The following is because of daylight saving time --replace_result MEST MET show variables like "system_time_zone"; -# -# Test unix timestamp -# +--echo # +--echo # Test unix timestamp +--echo # select @a:=FROM_UNIXTIME(1); select unix_timestamp(@a); -# -# Test of some values, including some with daylight saving time -# +--echo # +--echo # Test of some values, including some with daylight saving time +--echo # CREATE TABLE t1 (ts int); INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 01:00')); @@ -42,19 +37,18 @@ SELECT ts,from_unixtime(ts) FROM t1; DROP TABLE t1; -# -# Test of warning for spring time-gap values for system time zone -# +--echo # +--echo # Test of warning for spring time-gap values for system time zone +--echo # CREATE TABLE t1 (ts timestamp); INSERT INTO t1 (ts) VALUES ('2003-03-30 01:59:59'), ('2003-03-30 02:59:59'), ('2003-03-30 03:00:00'); DROP TABLE t1; -# -# Test for fix for Bug#2523 Check that boundary dates are processed -# correctly. -# +--echo # +--echo # Test for fix for Bug#2523 Check that boundary dates are processed correctly. +--echo # select unix_timestamp('1970-01-01 01:00:00'), unix_timestamp('1970-01-01 01:00:01'), unix_timestamp('2038-01-19 04:14:07'), @@ -62,4 +56,21 @@ select unix_timestamp('1970-01-01 01:00:00'), select unix_timestamp('1969-12-31 23:59:59'), unix_timestamp('1970-01-01 00:00:00'), unix_timestamp('1970-01-01 00:59:59'); -# End of 4.1 tests +--echo # +--echo # End of 4.1 tests +--echo # + +--echo # +--echo # MDEV-27393 Timezone tables cannot have descending indexes +--echo # +call mtr.add_suppression('mysql.time_zone_transition_type table is incorrectly defined or corrupted'); +alter table mysql.time_zone_transition_type drop primary key; +alter table mysql.time_zone_transition_type add primary key (time_zone_id,transition_type_id desc); +--error ER_UNKNOWN_TIME_ZONE +SET @@time_zone='Japan'; +alter table mysql.time_zone_transition_type drop primary key; +alter table mysql.time_zone_transition_type add primary key (time_zone_id,transition_type_id); + +--echo # +--echo # End of 10.8 tests +--echo # diff --git a/mysql-test/main/timezone2.result b/mysql-test/main/timezone2.result index f943e2859514e..806255f26f5a4 100644 --- a/mysql-test/main/timezone2.result +++ b/mysql-test/main/timezone2.result @@ -654,3 +654,25 @@ SET time_zone=DEFAULT; # # End of 10.4 tests # +# +# MDEV-27101 Subquery using the ALL keyword on TIMESTAMP columns produces a wrong result +# +SET time_zone='Europe/Moscow'; +CREATE TABLE t1 (a TIMESTAMP NULL); +SET timestamp=1288477526; +/* this is summer time, earlier */ +INSERT INTO t1 VALUES (NOW()); +SET timestamp=1288477526+3599; +/* this is winter time, later */ +INSERT INTO t1 VALUES (NOW()); +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 a, UNIX_TIMESTAMP(a) FROM t1 WHERE a <= ALL (SELECT * FROM t1); +a UNIX_TIMESTAMP(a) +2010-10-31 02:25:26 1288477526 +SELECT a, UNIX_TIMESTAMP(a) FROM t1 WHERE a >= ALL (SELECT * FROM t1); +a UNIX_TIMESTAMP(a) +2010-10-31 02:25:25 1288481125 +DROP TABLE t1; diff --git a/mysql-test/main/timezone2.test b/mysql-test/main/timezone2.test index 6a8c9f258e418..20c926a796c9f 100644 --- a/mysql-test/main/timezone2.test +++ b/mysql-test/main/timezone2.test @@ -12,6 +12,9 @@ drop function if exists f1; # create table t1 (ts timestamp); +#enable after fix MDEV-27871 +--disable_view_protocol + set time_zone='+00:00'; select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()); insert into t1 (ts) values ('2003-03-30 02:30:00'); @@ -27,6 +30,8 @@ insert into t1 (ts) values ('2003-03-30 02:30:00'); # Here we will get different results select * from t1; +--enable_view_protocol + drop table t1; @@ -187,6 +192,9 @@ insert into t1 (tz) values ('MET'), ('UTC'); select tz, convert_tz('2003-12-31 00:00:00',tz,'UTC'), convert_tz('2003-12-31 00:00:00','UTC',tz) from t1 order by tz; drop table t1; +#enable after fix MDEV-27871 +--disable_view_protocol + # Parameters to CONVERT_TZ() what should give NULL select convert_tz('2003-12-31 04:00:00', NULL, 'UTC'); select convert_tz('2003-12-31 04:00:00', 'SomeNotExistingTimeZone', 'UTC'); @@ -194,6 +202,8 @@ select convert_tz('2003-12-31 04:00:00', 'MET', 'SomeNotExistingTimeZone'); select convert_tz('2003-12-31 04:00:00', 'MET', NULL); select convert_tz( NULL, 'MET', 'UTC'); +--enable_view_protocol + # # Test for bug #4508 "CONVERT_TZ() function with new time zone as param # crashes server." (Was caused by improperly worked mechanism of time zone @@ -254,6 +264,7 @@ SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creato # BUG#19339: CONVERT_TZ(): overly aggressive in locking time_zone_name # table # +--disable_service_connection --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -272,6 +283,7 @@ UPDATE t1 SET t = CONVERT_TZ(t, 'UTC', 'Europe/Moscow'); UNLOCK TABLES; DROP TABLE t1; +--enable_service_connection --echo # --echo # Bug #55424: convert_tz crashes when fed invalid data @@ -302,8 +314,13 @@ SET timestamp=DEFAULT; --echo # --echo # MDEV-5506 safe_mutex: Trying to lock unitialized mutex at safemalloc.c on server shutdown after SELECT with CONVERT_TZ --echo # + +#enable after fix MDEV-27871 +--disable_view_protocol + SELECT CONVERT_TZ('2001-10-08 00:00:00', MAKE_SET(0,'+01:00'), '+00:00' ); +--enable_view_protocol --echo # --echo # End of 5.3 tests @@ -598,3 +615,18 @@ SET time_zone=DEFAULT; --echo # --echo # End of 10.4 tests --echo # + +--echo # +--echo # MDEV-27101 Subquery using the ALL keyword on TIMESTAMP columns produces a wrong result +--echo # + +SET time_zone='Europe/Moscow'; +CREATE TABLE t1 (a TIMESTAMP NULL); +SET timestamp=1288477526; /* this is summer time, earlier */ +INSERT INTO t1 VALUES (NOW()); +SET timestamp=1288477526+3599; /* this is winter time, later */ +INSERT INTO t1 VALUES (NOW()); +SELECT a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a; +SELECT a, UNIX_TIMESTAMP(a) FROM t1 WHERE a <= ALL (SELECT * FROM t1); +SELECT a, UNIX_TIMESTAMP(a) FROM t1 WHERE a >= ALL (SELECT * FROM t1); +DROP TABLE t1; diff --git a/mysql-test/main/timezone_grant.result b/mysql-test/main/timezone_grant.result index bacc8348e8909..6d9872448a747 100644 --- a/mysql-test/main/timezone_grant.result +++ b/mysql-test/main/timezone_grant.result @@ -25,9 +25,9 @@ convert_tz(b, 'Europe/Moscow', 'UTC') update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC') where t1.a = t2.c and t2.d = (select max(d) from t2); select * from mysql.time_zone_name; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `mysql`.`time_zone_name` select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `mysql`.`time_zone_name` connection default; disconnect tzuser; connection default; @@ -54,9 +54,9 @@ convert_tz(b, 'Europe/Moscow', 'UTC') update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC') where t1.a = t2.c and t2.d = (select max(d) from t2); select * from mysql.time_zone_name; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `mysql`.`time_zone_name` select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `mysql`.`time_zone_name` drop table t1, t2; create table t1 (a int, b datetime); create table t2 (a int, b varchar(40)); @@ -82,10 +82,10 @@ a lb 1 2001-01-01 03:00:00 2 2002-01-01 03:00:00 select * from v1, mysql.time_zone; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `mysql`.`time_zone` drop view v1; create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1, mysql.time_zone; -ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 'time_zone' +ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table `mysql`.`time_zone` connection default; disconnect tzuser3; drop table t1; diff --git a/mysql-test/main/tmp_table_count-7586.test b/mysql-test/main/tmp_table_count-7586.test index 8bfb0e7c5cf48..0629e27f1642b 100644 --- a/mysql-test/main/tmp_table_count-7586.test +++ b/mysql-test/main/tmp_table_count-7586.test @@ -3,6 +3,10 @@ --source include/have_perfschema.inc --source include/not_embedded.inc +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + create table t2 (a int); insert into t2 values (1),(2),(3); create view v2 as select a from t2; diff --git a/mysql-test/main/tmp_table_error.result b/mysql-test/main/tmp_table_error.result new file mode 100644 index 0000000000000..3a1a97250014b --- /dev/null +++ b/mysql-test/main/tmp_table_error.result @@ -0,0 +1,2634 @@ +call mtr.add_suppression('Index for table'); +create table t1 ( +a int primary key, +b text +) engine=innodb; +create table t2 as +select +1 +from +(select distinct +b as c0, +b as c1, +b as c2, +b as c3, +b as c4, +b as c5, +b as c6, +b as c7, +b as c8, +b as c9, +b as c10, +b as c11, +b as c12, +b as c13, +b as c14, +b as c15, +b as c16, +b as c17, +b as c18, +b as c19, +b as c20, +b as c21, +b as c22, +b as c23, +b as c24, +b as c25, +b as c26, +b as c27, +b as c28, +b as c29, +b as c30, +b as c31, +b as c32, +b as c33, +b as c34, +b as c35, +b as c36, +b as c37, +b as c38, +b as c39, +b as c40, +b as c41, +b as c42, +b as c43, +b as c45, +b as c46, +b as c47, +b as c48, +b as c49, +b as c50, +b as c51, +b as c52, +b as c53, +b as c54, +b as c55, +b as c56, +b as c57, +b as c58, +b as c59, +b as c60, +b as c61, +b as c62, +b as c63, +b as c64, +b as c65, +b as c66, +b as c67, +b as c68, +b as c69, +b as c70, +b as c71, +b as c72, +b as c73, +b as c74, +b as c75, +b as c76, +b as c77, +b as c78, +b as c79, +b as c80, +b as c81, +b as c82, +b as c83, +b as c84, +b as c85, +b as c86, +b as c87, +b as c88, +b as c89, +b as c90, +b as c91, +b as c92, +b as c93, +b as c94, +b as c95, +b as c96, +b as c97, +b as c98, +b as c99, +b as c100, +b as c101, +b as c102, +b as c103, +b as c104, +b as c105, +b as c106, +b as c107, +b as c108, +b as c109, +b as c110, +b as c111, +b as c112, +b as c113, +b as c114, +b as c115, +b as c116, +b as c117, +b as c118, +b as c119, +b as c120, +b as c121, +b as c122, +b as c123, +b as c124, +b as c125, +b as c126, +b as c127, +b as c128, +b as c129, +b as c130, +b as c131, +b as c132, +b as c133, +b as c134, +b as c135, +b as c136, +b as c137, +b as c138, +b as c139, +b as c140, +b as c141, +b as c142, +b as c143, +b as c144, +b as c145, +b as c146, +b as c147, +b as c148, +b as c149, +b as c150, +b as c151, +b as c152, +b as c153, +b as c154, +b as c155, +b as c156, +b as c157, +b as c158, +b as c159, +b as c160, +b as c161, +b as c162, +b as c163, +b as c164, +b as c165, +b as c166, +b as c167, +b as c168, +b as c169, +b as c170, +b as c171, +b as c172, +b as c173, +b as c174, +b as c175, +b as c176, +b as c177, +b as c178, +b as c179, +b as c180, +b as c181, +b as c182, +b as c183, +b as c184, +b as c185, +b as c186, +b as c187, +b as c188, +b as c189, +b as c190, +b as c191, +b as c192, +b as c193, +b as c194, +b as c195, +b as c196, +b as c197, +b as c198, +b as c199, +b as c200, +b as c201, +b as c202, +b as c203, +b as c204, +b as c205, +b as c206, +b as c207, +b as c208, +b as c209, +b as c210, +b as c211, +b as c212, +b as c213, +b as c214, +b as c215, +b as c216, +b as c217, +b as c218, +b as c219, +b as c220, +b as c221, +b as c222, +b as c223, +b as c224, +b as c225, +b as c226, +b as c227, +b as c228, +b as c229, +b as c230, +b as c231, +b as c232, +b as c233, +b as c234, +b as c235, +b as c236, +b as c237, +b as c238, +b as c239, +b as c240, +b as c241, +b as c242, +b as c243, +b as c244, +b as c245, +b as c246, +b as c247, +b as c248, +b as c249, +b as c250, +b as c251, +b as c252, +b as c253, +b as c254, +b as c255, +b as c256, +b as c257, +b as c258, +b as c259, +b as c260, +b as c261, +b as c262, +b as c263, +b as c264, +b as c265, +b as c266, +b as c267, +b as c268, +b as c269, +b as c270, +b as c271, +b as c272, +b as c273, +b as c274, +b as c275, +b as c276, +b as c277, +b as c278, +b as c279, +b as c280, +b as c281, +b as c282, +b as c283, +b as c284, +b as c285, +b as c286, +b as c287, +b as c288, +b as c289, +b as c290, +b as c291, +b as c292, +b as c293, +b as c294, +b as c295, +b as c296, +b as c297, +b as c298, +b as c299, +b as c300, +b as c301, +b as c302, +b as c303, +b as c304, +b as c305, +b as c306, +b as c307, +b as c308, +b as c309, +b as c310, +b as c311, +b as c312, +b as c313, +b as c314, +b as c315, +b as c316, +b as c317, +b as c318, +b as c319, +b as c320, +b as c321, +b as c322, +b as c323, +b as c324, +b as c325, +b as c326, +b as c327, +b as c328, +b as c329, +b as c330, +b as c331, +b as c332, +b as c333, +b as c334, +b as c335, +b as c336, +b as c337, +b as c338, +b as c339, +b as c340, +b as c341, +b as c342, +b as c343, +b as c344, +b as c345, +b as c346, +b as c347, +b as c348, +b as c349, +b as c350, +b as c351, +b as c352, +b as c353, +b as c354, +b as c355, +b as c356, +b as c357, +b as c358, +b as c359, +b as c360, +b as c361, +b as c362, +b as c363, +b as c364, +b as c365, +b as c366, +b as c367, +b as c368, +b as c369, +b as c370, +b as c371, +b as c372, +b as c373, +b as c374, +b as c375, +b as c376, +b as c377, +b as c378, +b as c379, +b as c380, +b as c381, +b as c382, +b as c383, +b as c384, +b as c385, +b as c386, +b as c387, +b as c388, +b as c389, +b as c390, +b as c391, +b as c392, +b as c393, +b as c394, +b as c395, +b as c396, +b as c397, +b as c398, +b as c399, +b as c400, +b as c401, +b as c402, +b as c403, +b as c404, +b as c405, +b as c406, +b as c407, +b as c409, +b as c410, +b as c411, +b as c412, +b as c413, +b as c414, +b as c415, +b as c416, +b as c417, +b as c418, +b as c419, +b as c420, +b as c421, +b as c422, +b as c423, +b as c424, +b as c425, +b as c426, +b as c427, +b as c428, +b as c429, +b as c430, +b as c431, +b as c432, +b as c433, +b as c434, +b as c435, +b as c436, +b as c437, +b as c438, +b as c439, +b as c440, +b as c441, +b as c442, +b as c443, +b as c444, +b as c445, +b as c446, +b as c447, +b as c448, +b as c449, +b as c450, +b as c451, +b as c452, +b as c453, +b as c454, +b as c455, +b as c456, +b as c457, +b as c458, +b as c459, +b as c460, +b as c461, +b as c462, +b as c463, +b as c464, +b as c465, +b as c466, +b as c467, +b as c468, +b as c469, +b as c470, +b as c471, +b as c472, +b as c473, +b as c474, +b as c475, +b as c476, +b as c477, +b as c478, +b as c479, +b as c480, +b as c481, +b as c482, +b as c483, +b as c484, +b as c485, +b as c486, +b as c487, +b as c488, +b as c489, +b as c490, +b as c491, +b as c492, +b as c493, +b as c494, +b as c495, +b as c496, +b as c497, +b as c498, +b as c499, +b as c500, +b as c501, +b as c502, +b as c503, +b as c504, +b as c505, +b as c506, +b as c507, +b as c508, +b as c509, +b as c510, +b as c511, +b as c512, +b as c513, +b as c514, +b as c515, +b as c516, +b as c517, +b as c518, +b as c519, +b as c520, +b as c521, +b as c522, +b as c523, +b as c524, +b as c525, +b as c526, +b as c527, +b as c528, +b as c529, +b as c530, +b as c531, +b as c532, +b as c533, +b as c534, +b as c535, +b as c536, +b as c537, +b as c538, +b as c539, +b as c540, +b as c541, +b as c542, +b as c543, +b as c544, +b as c545, +b as c546, +b as c547, +b as c548, +b as c549, +b as c550, +b as c551, +b as c552, +b as c553, +b as c554, +b as c555, +b as c556, +b as c557, +b as c558, +b as c559, +b as c560, +b as c561, +b as c562, +b as c563, +b as c564, +b as c565, +b as c566, +b as c567, +b as c568, +b as c569, +b as c570, +b as c571, +b as c572, +b as c573, +b as c574, +b as c575, +b as c576, +b as c577, +b as c578, +b as c579, +b as c580, +b as c581, +b as c582, +b as c583, +b as c584, +b as c585, +b as c586, +b as c587, +b as c588, +b as c589, +b as c590, +b as c591, +b as c592, +b as c593, +b as c594, +b as c595, +b as c596, +b as c597, +b as c598, +b as c599, +b as c600, +b as c601, +b as c602, +b as c603, +b as c604, +b as c605, +b as c606, +b as c607, +b as c608, +b as c609, +b as c610, +b as c611, +b as c612, +b as c613, +b as c614, +b as c615, +b as c616, +b as c617, +b as c618, +b as c619, +b as c620, +b as c621, +b as c622, +b as c623, +b as c624, +b as c625, +b as c626, +b as c627, +b as c628, +b as c629, +b as c630, +b as c631, +b as c632, +b as c633, +b as c634, +b as c635, +b as c636, +b as c637, +b as c638, +b as c639, +b as c640, +b as c641, +b as c642, +b as c643, +b as c644, +b as c645, +b as c646, +b as c647, +b as c648, +b as c649, +b as c650, +b as c651, +b as c652, +b as c653, +b as c654, +b as c655, +b as c656, +b as c657, +b as c658, +b as c659, +b as c660, +b as c661, +b as c662, +b as c663, +b as c664, +b as c665, +b as c666, +b as c667, +b as c668, +b as c669, +b as c670, +b as c671, +b as c672, +b as c673, +b as c674, +b as c675, +b as c676, +b as c677, +b as c678, +b as c679, +b as c680, +b as c681, +b as c682, +b as c683, +b as c684, +b as c685, +b as c686, +b as c687, +b as c688, +b as c689, +b as c690, +b as c691, +b as c692, +b as c693, +b as c694, +b as c695, +b as c696, +b as c697, +b as c698, +b as c699, +b as c700, +b as c701, +b as c702, +b as c703, +b as c704, +b as c705, +b as c706, +b as c707, +b as c708, +b as c709, +b as c710, +b as c711, +b as c712, +b as c713, +b as c714, +b as c715, +b as c716, +b as c717, +b as c718, +b as c719, +b as c720, +b as c721, +b as c722, +b as c723, +b as c724, +b as c725, +b as c726, +b as c727, +b as c728, +b as c729, +b as c730, +b as c731, +b as c732, +b as c733, +b as c734, +b as c735, +b as c736, +b as c737, +b as c738, +b as c739, +b as c740, +b as c741, +b as c742, +b as c743, +b as c744, +b as c745, +b as c746, +b as c747, +b as c748, +b as c749, +b as c750, +b as c751, +b as c752, +b as c753, +b as c754, +b as c755, +b as c756, +b as c757, +b as c758, +b as c759, +b as c760, +b as c761, +b as c762, +b as c763, +b as c764, +b as c765, +b as c766, +b as c767, +b as c768, +b as c769, +b as c770, +b as c771, +b as c772, +b as c773, +b as c774, +b as c775, +b as c776, +b as c777, +b as c778, +b as c779, +b as c780, +b as c781, +b as c782, +b as c783, +b as c784, +b as c785, +b as c786, +b as c787, +b as c788, +b as c789, +b as c790, +b as c791, +b as c792, +b as c793, +b as c794, +b as c795, +b as c796, +b as c797, +b as c798, +b as c799, +b as c800, +b as c801, +b as c802, +b as c803, +b as c804, +b as c805, +b as c806, +b as c807, +b as c808, +b as c809, +b as c810, +b as c811, +b as c812, +b as c813, +b as c814, +b as c815, +b as c816, +b as c817, +b as c818, +b as c819, +b as c820, +b as c821, +b as c822, +b as c823, +b as c824, +b as c825, +b as c826, +b as c827, +b as c828, +b as c829, +b as c830, +b as c831, +b as c832, +b as c833, +b as c834, +b as c835, +b as c836, +b as c837, +b as c838, +b as c839, +b as c840, +b as c841, +b as c842, +b as c843, +b as c844, +b as c845, +b as c846, +b as c847, +b as c848, +b as c849, +b as c850, +b as c851, +b as c852, +b as c853, +b as c854, +b as c855, +b as c856, +b as c857, +b as c858, +b as c859, +b as c860, +b as c861, +b as c862, +b as c863, +b as c864, +b as c865, +b as c866, +b as c867, +b as c868, +b as c869, +b as c870, +b as c871, +b as c872, +b as c873, +b as c874, +b as c875, +b as c876, +b as c877, +b as c878, +b as c879, +b as c880, +b as c881, +b as c882, +b as c883, +b as c884, +b as c885, +b as c886, +b as c887, +b as c888, +b as c889, +b as c890, +b as c891, +b as c892, +b as c893, +b as c894, +b as c895, +b as c897, +b as c898, +b as c899, +b as c900, +b as c901, +b as c902, +b as c903, +b as c904, +b as c905, +b as c906, +b as c907, +b as c908, +b as c909, +b as c910, +b as c911, +b as c912, +b as c913, +b as c914, +b as c915, +b as c916, +b as c917, +b as c918, +b as c919, +b as c920, +b as c921, +b as c922, +b as c923, +b as c924, +b as c925, +b as c926, +b as c927, +b as c928, +b as c929, +b as c930, +b as c931, +b as c932, +b as c933, +b as c934, +b as c935, +b as c936, +b as c937, +b as c938, +b as c939, +b as c940, +b as c941, +b as c942, +b as c943, +b as c944, +b as c945, +b as c946, +b as c947, +b as c948, +b as c949, +b as c950, +b as c951, +b as c952, +b as c953, +b as c954, +b as c955, +b as c956, +b as c957, +b as c958, +b as c959, +b as c960, +b as c961, +b as c962, +b as c963, +b as c964, +b as c965, +b as c966, +b as c967, +b as c968, +b as c969, +b as c970, +b as c971, +b as c972, +b as c973, +b as c974, +b as c975, +b as c976, +b as c977, +b as c978, +b as c979, +b as c980, +b as c981, +b as c982, +b as c983, +b as c984, +b as c985, +b as c986, +b as c987, +b as c988, +b as c989, +b as c990, +b as c991, +b as c992, +b as c993, +b as c995, +b as c996, +b as c997, +b as c998, +b as c999, +b as c1000, +b as c1001, +b as c1002, +b as c1003, +b as c1004, +b as c1005, +b as c1006, +b as c1007, +b as c1008, +b as c1009, +b as c1010, +b as c1011, +b as c1012, +b as c1013, +b as c1014, +b as c1015, +b as c1016, +b as c1017, +b as c1018, +b as c1019, +b as c1020, +b as c1021, +b as c1022, +b as c1023, +b as c1024, +b as c1025, +b as c1026, +b as c1027, +b as c1028, +b as c1029, +b as c1030, +b as c1031, +b as c1032, +b as c1033, +b as c1034, +b as c1035, +b as c1036, +b as c1037, +b as c1038, +b as c1039, +b as c1040, +b as c1041, +b as c1042, +b as c1043, +b as c1044, +b as c1045, +b as c1046, +b as c1047, +b as c1048, +b as c1049, +b as c1050, +b as c1051, +b as c1052, +b as c1053, +b as c1054, +b as c1055, +b as c1056, +b as c1057, +b as c1058, +b as c1059, +b as c1060, +b as c1061, +b as c1062, +b as c1063, +b as c1064, +b as c1065, +b as c1066, +b as c1067, +b as c1068, +b as c1069, +b as c1070, +b as c1071, +b as c1072, +b as c1073, +b as c1074, +b as c1075, +b as c1076, +b as c1077, +b as c1078, +b as c1079, +b as c1080, +b as c1081, +b as c1082, +b as c1083, +b as c1084, +b as c1085, +b as c1086, +b as c1087, +b as c1088, +b as c1089, +b as c1090, +b as c1091, +b as c1092, +b as c1093, +b as c1094, +b as c1095, +b as c1096, +b as c1097, +b as c1098, +b as c1099, +b as c1100, +b as c1101, +b as c1102, +b as c1103, +b as c1104, +b as c1105, +b as c1106, +b as c1107, +b as c1108, +b as c1109, +b as c1110, +b as c1111, +b as c1112, +b as c1113, +b as c1114, +b as c1115, +b as c1116, +b as c1117, +b as c1118, +b as c1119, +b as c1120, +b as c1121, +b as c1122, +b as c1123, +b as c1124, +b as c1125, +b as c1126, +b as c1127, +b as c1128, +b as c1129, +b as c1130, +b as c1131, +b as c1132, +b as c1133, +b as c1134, +b as c1135, +b as c1136, +b as c1137, +b as c1138, +b as c1139, +b as c1140, +b as c1141, +b as c1142, +b as c1143, +b as c1144, +b as c1145, +b as c1146, +b as c1147, +b as c1148, +b as c1149, +b as c1150, +b as c1151, +b as c1152, +b as c1153, +b as c1154, +b as c1155, +b as c1156, +b as c1157, +b as c1158, +b as c1159, +b as c1160, +b as c1161, +b as c1162, +b as c1163, +b as c1164, +b as c1165, +b as c1166, +b as c1167, +b as c1168, +b as c1169, +b as c1170, +b as c1171, +b as c1172, +b as c1173, +b as c1174, +b as c1175, +b as c1176, +b as c1177, +b as c1178, +b as c1179, +b as c1180, +b as c1181, +b as c1182, +b as c1183, +b as c1184, +b as c1185, +b as c1186, +b as c1187, +b as c1188, +b as c1189, +b as c1190, +b as c1191, +b as c1192, +b as c1193, +b as c1194, +b as c1195, +b as c1196, +b as c1197, +b as c1198, +b as c1199, +b as c1200, +b as c1201, +b as c1202, +b as c1203, +b as c1204, +b as c1205, +b as c1206, +b as c1207, +b as c1208, +b as c1209, +b as c1210, +b as c1211, +b as c1212, +b as c1213, +b as c1214, +b as c1215, +b as c1216, +b as c1217, +b as c1218, +b as c1219, +b as c1220, +b as c1221, +b as c1222, +b as c1223, +b as c1224, +b as c1225, +b as c1226, +b as c1227, +b as c1228, +b as c1229, +b as c1230, +b as c1231, +b as c1232, +b as c1233, +b as c1234, +b as c1235, +b as c1236, +b as c1237, +b as c1238, +b as c1239, +b as c1240, +b as c1241, +b as c1242, +b as c1243, +b as c1244, +b as c1245, +b as c1246, +b as c1247, +b as c1248, +b as c1249, +b as c1250, +b as c1251, +b as c1252, +b as c1253, +b as c1254, +b as c1255, +b as c1256, +b as c1257, +b as c1258, +b as c1259, +b as c1260, +b as c1261, +b as c1262, +b as c1263, +b as c1264, +b as c1265, +b as c1266, +b as c1267, +b as c1268, +b as c1269, +b as c1270, +b as c1271, +b as c1272, +b as c1273, +b as c1274, +b as c1275, +b as c1276, +b as c1277, +b as c1278, +b as c1279, +b as c1280, +b as c1281, +b as c1282, +b as c1283, +b as c1284, +b as c1285, +b as c1286, +b as c1287, +b as c1288, +b as c1289, +b as c1290, +b as c1291, +b as c1292, +b as c1293, +b as c1294, +b as c1295, +b as c1296, +b as c1297, +b as c1298, +b as c1299, +b as c1300, +b as c1301, +b as c1302, +b as c1303, +b as c1304, +b as c1305, +b as c1306, +b as c1307, +b as c1308, +b as c1309, +b as c1310, +b as c1311, +b as c1312, +b as c1313, +b as c1314, +b as c1315, +b as c1316, +b as c1317, +b as c1318, +b as c1319, +b as c1320, +b as c1321, +b as c1322, +b as c1323, +b as c1324, +b as c1325, +b as c1326, +b as c1327, +b as c1328, +b as c1329, +b as c1330, +b as c1331, +b as c1332, +b as c1333, +b as c1334, +b as c1335, +b as c1336, +b as c1337, +b as c1338, +b as c1339, +b as c1340, +b as c1341, +b as c1342, +b as c1343, +b as c1344, +b as c1345, +b as c1346, +b as c1347, +b as c1348, +b as c1349, +b as c1350, +b as c1351, +b as c1352, +b as c1353, +b as c1354, +b as c1355, +b as c1356, +b as c1357, +b as c1358, +b as c1359, +b as c1360, +b as c1361, +b as c1362, +b as c1363, +b as c1364, +b as c1365, +b as c1366, +b as c1367, +b as c1368, +b as c1369, +b as c1370, +b as c1371, +b as c1372, +b as c1373, +b as c1374, +b as c1375, +b as c1376, +b as c1377, +b as c1378, +b as c1379, +b as c1380, +b as c1381, +b as c1382, +b as c1383, +b as c1384, +b as c1385, +b as c1386, +b as c1387, +b as c1388, +b as c1389, +b as c1390, +b as c1391, +b as c1392, +b as c1393, +b as c1394, +b as c1395, +b as c1396, +b as c1397, +b as c1398, +b as c1399, +b as c1400, +b as c1401, +b as c1402, +b as c1403, +b as c1404, +b as c1405, +b as c1406, +b as c1407, +b as c1408, +b as c1409, +b as c1410, +b as c1411, +b as c1412, +b as c1413, +b as c1414, +b as c1415, +b as c1416, +b as c1417, +b as c1418, +b as c1419, +b as c1420, +b as c1421, +b as c1422, +b as c1423, +b as c1424, +b as c1425, +b as c1426, +b as c1427, +b as c1428, +b as c1429, +b as c1430, +b as c1431, +b as c1432, +b as c1433, +b as c1434, +b as c1435, +b as c1436, +b as c1437, +b as c1438, +b as c1439, +b as c1440, +b as c1441, +b as c1442, +b as c1443, +b as c1444, +b as c1445, +b as c1446, +b as c1447, +b as c1448, +b as c1449, +b as c1451, +b as c1452, +b as c1453, +b as c1454, +b as c1455, +b as c1456, +b as c1457, +b as c1458, +b as c1459, +b as c1460, +b as c1461, +b as c1462, +b as c1463, +b as c1464, +b as c1465, +b as c1466, +b as c1467, +b as c1468, +b as c1469, +b as c1470, +b as c1471, +b as c1472, +b as c1473, +b as c1474, +b as c1475, +b as c1476, +b as c1477, +b as c1478, +b as c1479, +b as c1480, +b as c1481, +b as c1482, +b as c1483, +b as c1484, +b as c1485, +b as c1486, +b as c1487, +b as c1488, +b as c1489, +b as c1490, +b as c1491, +b as c1492, +b as c1493, +b as c1494, +b as c1495, +b as c1496, +b as c1497, +b as c1498, +b as c1499, +b as c1500, +b as c1501, +b as c1502, +b as c1503, +b as c1504, +b as c1505, +b as c1506, +b as c1507, +b as c1508, +b as c1509, +b as c1510, +b as c1511, +b as c1512, +b as c1513, +b as c1514, +b as c1515, +b as c1516, +b as c1517, +b as c1518, +b as c1519, +b as c1520, +b as c1521, +b as c1522, +b as c1523, +b as c1524, +b as c1525, +b as c1526, +b as c1527, +b as c1528, +b as c1529, +b as c1530, +b as c1531, +b as c1532, +b as c1533, +b as c1534, +b as c1535, +b as c1536, +b as c1537, +b as c1538, +b as c1539, +b as c1540, +b as c1541, +b as c1542, +b as c1543, +b as c1544, +b as c1545, +b as c1546, +b as c1547, +b as c1548, +b as c1549, +b as c1550, +b as c1551, +b as c1552, +b as c1553, +b as c1554, +b as c1555, +b as c1556, +b as c1557, +b as c1558, +b as c1559, +b as c1560, +b as c1561, +b as c1562, +b as c1563, +b as c1564, +b as c1565, +b as c1566, +b as c1567, +b as c1568, +b as c1569, +b as c1570, +b as c1571, +b as c1572, +b as c1573, +b as c1574, +b as c1575, +b as c1576, +b as c1577, +b as c1578, +b as c1579, +b as c1580, +b as c1581, +b as c1582, +b as c1583, +b as c1584, +b as c1585, +b as c1586, +b as c1587, +b as c1588, +b as c1589, +b as c1590, +b as c1591, +b as c1592, +b as c1593, +b as c1594, +b as c1595, +b as c1596, +b as c1597, +b as c1598, +b as c1599, +b as c1600, +b as c1601, +b as c1602, +b as c1603, +b as c1604, +b as c1605, +b as c1606, +b as c1607, +b as c1608, +b as c1609, +b as c1610, +b as c1611, +b as c1612, +b as c1613, +b as c1614, +b as c1615, +b as c1616, +b as c1617, +b as c1618, +b as c1619, +b as c1620, +b as c1621, +b as c1622, +b as c1623, +b as c1624, +b as c1625, +b as c1626, +b as c1627, +b as c1628, +b as c1629, +b as c1630, +b as c1631, +b as c1632, +b as c1633, +b as c1634, +b as c1635, +b as c1636, +b as c1637, +b as c1638, +b as c1639, +b as c1640, +b as c1641, +b as c1642, +b as c1643, +b as c1644, +b as c1645, +b as c1646, +b as c1647, +b as c1648, +b as c1649, +b as c1650, +b as c1651, +b as c1652, +b as c1653, +b as c1654, +b as c1655, +b as c1656, +b as c1657, +b as c1658, +b as c1659, +b as c1660, +b as c1661, +b as c1662, +b as c1663, +b as c1664, +b as c1665, +b as c1666, +b as c1667, +b as c1668, +b as c1669, +b as c1670, +b as c1671, +b as c1672, +b as c1673, +b as c1674, +b as c1675, +b as c1676, +b as c1677, +b as c1678, +b as c1679, +b as c1680, +b as c1681, +b as c1682, +b as c1683, +b as c1684, +b as c1685, +b as c1686, +b as c1687, +b as c1688, +b as c1689, +b as c1690, +b as c1691, +b as c1692, +b as c1693, +b as c1694, +b as c1695, +b as c1696, +b as c1697, +b as c1698, +b as c1699, +b as c1700, +b as c1701, +b as c1702, +b as c1703, +b as c1704, +b as c1705, +b as c1706, +b as c1707, +b as c1708, +b as c1709, +b as c1710, +b as c1711, +b as c1712, +b as c1713, +b as c1714, +b as c1715, +b as c1716, +b as c1717, +b as c1718, +b as c1719, +b as c1720, +b as c1721, +b as c1722, +b as c1723, +b as c1724, +b as c1725, +b as c1726, +b as c1727, +b as c1728, +b as c1729, +b as c1730, +b as c1731, +b as c1732, +b as c1733, +b as c1734, +b as c1735, +b as c1736, +b as c1737, +b as c1738, +b as c1739, +b as c1740, +b as c1741, +b as c1742, +b as c1743, +b as c1744, +b as c1745, +b as c1746, +b as c1747, +b as c1748, +b as c1749, +b as c1750, +b as c1751, +b as c1752, +b as c1753, +b as c1754, +b as c1755, +b as c1756, +b as c1757, +b as c1758, +b as c1759, +b as c1760, +b as c1761, +b as c1762, +b as c1763, +b as c1764, +b as c1765, +b as c1766, +b as c1767, +b as c1768, +b as c1769, +b as c1770, +b as c1771, +b as c1772, +b as c1773, +b as c1774, +b as c1775, +b as c1776, +b as c1777, +b as c1778, +b as c1779, +b as c1780, +b as c1781, +b as c1782, +b as c1783, +b as c1784, +b as c1785, +b as c1786, +b as c1787, +b as c1788, +b as c1789, +b as c1790, +b as c1791, +b as c1792, +b as c1793, +b as c1794, +b as c1795, +b as c1796, +b as c1797, +b as c1798, +b as c1799, +b as c1800, +b as c1801, +b as c1802, +b as c1803, +b as c1804, +b as c1805, +b as c1806, +b as c1807, +b as c1808, +b as c1809, +b as c1810, +b as c1811, +b as c1812, +b as c1813, +b as c1814, +b as c1815, +b as c1816, +b as c1817, +b as c1818, +b as c1819, +b as c1820, +b as c1821, +b as c1822, +b as c1823, +b as c1824, +b as c1825, +b as c1826, +b as c1827, +b as c1828, +b as c1829, +b as c1830, +b as c1831, +b as c1832, +b as c1833, +b as c1834, +b as c1835, +b as c1836, +b as c1837, +b as c1838, +b as c1839, +b as c1840, +b as c1841, +b as c1842, +b as c1843, +b as c1844, +b as c1845, +b as c1846, +b as c1847, +b as c1848, +b as c1849, +b as c1850, +b as c1851, +b as c1852, +b as c1853, +b as c1854, +b as c1855, +b as c1856, +b as c1857, +b as c1858, +b as c1859, +b as c1860, +b as c1861, +b as c1862, +b as c1863, +b as c1864, +b as c1865, +b as c1866, +b as c1867, +b as c1868, +b as c1869, +b as c1870, +b as c1871, +b as c1872, +b as c1873, +b as c1874, +b as c1875, +b as c1876, +b as c1877, +b as c1878, +b as c1879, +b as c1880, +b as c1881, +b as c1882, +b as c1883, +b as c1884, +b as c1885, +b as c1886, +b as c1887, +b as c1888, +b as c1889, +b as c1890, +b as c1891, +b as c1892, +b as c1893, +b as c1894, +b as c1895, +b as c1896, +b as c1897, +b as c1898, +b as c1899, +b as c1900, +b as c1901, +b as c1902, +b as c1903, +b as c1904, +b as c1905, +b as c1906, +b as c1907, +b as c1908, +b as c1909, +b as c1910, +b as c1911, +b as c1912, +b as c1913, +b as c1914, +b as c1915, +b as c1916, +b as c1917, +b as c1918, +b as c1919, +b as c1920, +b as c1921, +b as c1922, +b as c1923, +b as c1924, +b as c1925, +b as c1926, +b as c1927, +b as c1928, +b as c1929, +b as c1930, +b as c1931, +b as c1932, +b as c1933, +b as c1934, +b as c1935, +b as c1936, +b as c1937, +b as c1938, +b as c1939, +b as c1940, +b as c1941, +b as c1942, +b as c1943, +b as c1944, +b as c1945, +b as c1946, +b as c1947, +b as c1948, +b as c1949, +b as c1950, +b as c1951, +b as c1952, +b as c1953, +b as c1954, +b as c1955, +b as c1956, +b as c1957, +b as c1958, +b as c1959, +b as c1960, +b as c1961, +b as c1962, +b as c1963, +b as c1964, +b as c1965, +b as c1966, +b as c1967, +b as c1968, +b as c1969, +b as c1970, +b as c1971, +b as c1972, +b as c1973, +b as c1974, +b as c1975, +b as c1976, +b as c1977, +b as c1978, +b as c1979, +b as c1980, +b as c1981, +b as c1982, +b as c1983, +b as c1984, +b as c1985, +b as c1986, +b as c1987, +b as c1988, +b as c1989, +b as c1990, +b as c1991, +b as c1992, +b as c1993, +b as c1994, +b as c1995, +b as c1996, +b as c1997, +b as c1998, +b as c1999, +b as c2000, +b as c2001, +b as c2002, +b as c2003, +b as c2004, +b as c2005, +b as c2006, +b as c2007, +b as c2008, +b as c2009, +b as c2010, +b as c2011, +b as c2012, +b as c2013, +b as c2014, +b as c2015, +b as c2016, +b as c2017, +b as c2018, +b as c2019, +b as c2020, +b as c2021, +b as c2022, +b as c2023, +b as c2024, +b as c2025, +b as c2026, +b as c2027, +b as c2028, +b as c2029, +b as c2030, +b as c2031, +b as c2032, +b as c2033, +b as c2034, +b as c2035, +b as c2036, +b as c2037, +b as c2038, +b as c2039, +b as c2040, +b as c2041, +b as c2042, +b as c2043, +b as c2044, +b as c2045, +b as c2046, +b as c2047, +b as c2048, +b as c2049, +b as c2050, +b as c2051, +b as c2052, +b as c2053, +b as c2054, +b as c2055, +b as c2056, +b as c2057, +b as c2058, +b as c2059, +b as c2060, +b as c2061, +b as c2062, +b as c2063, +b as c2064, +b as c2065, +b as c2066, +b as c2067, +b as c2068, +b as c2069, +b as c2070, +b as c2071, +b as c2072, +b as c2073, +b as c2074, +b as c2075, +b as c2076, +b as c2077, +b as c2078, +b as c2079, +b as c2080, +b as c2081, +b as c2082, +b as c2083, +b as c2084, +b as c2085, +b as c2086, +b as c2087, +b as c2088, +b as c2089, +b as c2090, +b as c2091, +b as c2092, +b as c2093, +b as c2094, +b as c2095, +b as c2096, +b as c2097, +b as c2098, +b as c2099, +b as c2100, +b as c2101, +b as c2102, +b as c2103, +b as c2104, +b as c2105, +b as c2106, +b as c2107, +b as c2108, +b as c2109, +b as c2110, +b as c2111, +b as c2112, +b as c2113, +b as c2114, +b as c2115, +b as c2116, +b as c2117, +b as c2118, +b as c2119, +b as c2120, +b as c2121, +b as c2122, +b as c2123, +b as c2124, +b as c2125, +b as c2126, +b as c2127, +b as c2128, +b as c2129, +b as c2130, +b as c2131, +b as c2132, +b as c2133, +b as c2134, +b as c2135, +b as c2136, +b as c2137, +b as c2138, +b as c2139, +b as c2140, +b as c2141, +b as c2142, +b as c2143, +b as c2144, +b as c2145, +b as c2146, +b as c2147, +b as c2148, +b as c2149, +b as c2150, +b as c2151, +b as c2152, +b as c2153, +b as c2154, +b as c2155, +b as c2156, +b as c2157, +b as c2158, +b as c2159, +b as c2160, +b as c2161, +b as c2162, +b as c2163, +b as c2164, +b as c2165, +b as c2166, +b as c2167, +b as c2168, +b as c2169, +b as c2170, +b as c2171, +b as c2172, +b as c2173, +b as c2174, +b as c2175, +b as c2176, +b as c2177, +b as c2178, +b as c2179, +b as c2180, +b as c2181, +b as c2182, +b as c2183, +b as c2184, +b as c2185, +b as c2186, +b as c2187, +b as c2188, +b as c2189, +b as c2190, +b as c2191, +b as c2192, +b as c2193, +b as c2194, +b as c2195, +b as c2196, +b as c2197, +b as c2198, +b as c2199, +b as c2200, +b as c2201, +b as c2202, +b as c2203, +b as c2204, +b as c2205, +b as c2206, +b as c2207, +b as c2208, +b as c2209, +b as c2210, +b as c2211, +b as c2212, +b as c2213, +b as c2214, +b as c2215, +b as c2216, +b as c2217, +b as c2218, +b as c2219, +b as c2220, +b as c2221, +b as c2222, +b as c2223, +b as c2224, +b as c2225, +b as c2226, +b as c2227, +b as c2228, +b as c2229, +b as c2230, +b as c2231, +b as c2232, +b as c2233, +b as c2234, +b as c2235, +b as c2236, +b as c2237, +b as c2238, +b as c2239, +b as c2240, +b as c2241, +b as c2242, +b as c2243, +b as c2244, +b as c2245, +b as c2246, +b as c2247, +b as c2248, +b as c2249, +b as c2250, +b as c2251, +b as c2252, +b as c2253, +b as c2254, +b as c2255, +b as c2256, +b as c2257, +b as c2258, +b as c2259, +b as c2260, +b as c2261, +b as c2262, +b as c2263, +b as c2264, +b as c2265, +b as c2266, +b as c2267, +b as c2268, +b as c2269, +b as c2270, +b as c2271, +b as c2272, +b as c2273, +b as c2274, +b as c2275, +b as c2276, +b as c2277, +b as c2278, +b as c2279, +b as c2280, +b as c2281, +b as c2282, +b as c2283, +b as c2284, +b as c2285, +b as c2286, +b as c2287, +b as c2288, +b as c2289, +b as c2290, +b as c2291, +b as c2292, +b as c2293, +b as c2294, +b as c2295, +b as c2296, +b as c2297, +b as c2298, +b as c2299, +b as c2300, +b as c2301, +b as c2302, +b as c2303, +b as c2304, +b as c2305, +b as c2306, +b as c2307, +b as c2308, +b as c2309, +b as c2310, +b as c2311, +b as c2312, +b as c2313, +b as c2314, +b as c2315, +b as c2316, +b as c2317, +b as c2318, +b as c2319, +b as c2320, +b as c2321, +b as c2322, +b as c2323, +b as c2324, +b as c2325, +b as c2326, +b as c2327, +b as c2328, +b as c2329, +b as c2330, +b as c2331, +b as c2332, +b as c2333, +b as c2334, +b as c2335, +b as c2336, +b as c2337, +b as c2338, +b as c2339, +b as c2340, +b as c2341, +b as c2342, +b as c2343, +b as c2344, +b as c2345, +b as c2346, +b as c2347, +b as c2348, +b as c2349, +b as c2350, +b as c2351, +b as c2352, +b as c2353, +b as c2354, +b as c2355, +b as c2356, +b as c2357, +b as c2358, +b as c2359, +b as c2360, +b as c2361, +b as c2362, +b as c2363, +b as c2364, +b as c2365, +b as c2366, +b as c2367, +b as c2368, +b as c2369, +b as c2370, +b as c2371, +b as c2372, +b as c2373, +b as c2374, +b as c2375, +b as c2376, +b as c2377, +b as c2378, +b as c2379, +b as c2380, +b as c2381, +b as c2382, +b as c2383, +b as c2384, +b as c2385, +b as c2386, +b as c2387, +b as c2388, +b as c2389, +b as c2390, +b as c2391, +b as c2392, +b as c2393, +b as c2394, +b as c2395, +b as c2396, +b as c2397, +b as c2398, +b as c2399, +b as c2400, +b as c2401, +b as c2402, +b as c2403, +b as c2404, +b as c2405, +b as c2406, +b as c2407, +b as c2408, +b as c2409, +b as c2410, +b as c2411, +b as c2412, +b as c2413, +b as c2414, +b as c2415, +b as c2416, +b as c2417, +b as c2418, +b as c2419, +b as c2420, +b as c2421, +b as c2422, +b as c2423, +b as c2424, +b as c2425, +b as c2426, +b as c2427, +b as c2428, +b as c2429, +b as c2430, +b as c2431, +b as c2432, +b as c2433, +b as c2434, +b as c2435, +b as c2436, +b as c2437, +b as c2438, +b as c2439, +b as c2440, +b as c2441, +b as c2442, +b as c2443, +b as c2444, +b as c2445, +b as c2446, +b as c2447, +b as c2448, +b as c2449, +b as c2450, +b as c2451, +b as c2452, +b as c2453, +b as c2454, +b as c2455, +b as c2456, +b as c2457, +b as c2458, +b as c2459, +b as c2460, +b as c2461, +b as c2462, +b as c2463, +b as c2464, +b as c2465, +b as c2466, +b as c2467, +b as c2468, +b as c2469, +b as c2470, +b as c2471, +b as c2472, +b as c2473, +b as c2474, +b as c2475, +b as c2476, +b as c2477, +b as c2478, +b as c2479, +b as c2480, +b as c2481, +b as c2482, +b as c2483, +b as c2484, +b as c2485, +b as c2486, +b as c2487, +b as c2488, +b as c2489, +b as c2490, +b as c2491, +b as c2492, +b as c2493, +b as c2494, +b as c2495, +b as c2496, +b as c2497, +b as c2498, +b as c2499, +b as c2500, +b as c2501, +b as c2503, +b as c2504, +b as c2505, +b as c2506, +b as c2507, +b as c2508, +b as c2509, +b as c2510, +b as c2511, +b as c2512, +b as c2513, +b as c2514, +b as c2515, +b as c2516, +b as c2517, +b as c2518, +b as c2519, +b as c2520, +b as c2521, +b as c2522, +b as c2523, +b as c2524, +b as c2525, +b as c2526, +b as c2527, +b as c2528, +b as c2529, +b as c2530, +b as c2531, +b as c2532, +b as c2533, +b as c2534, +b as c2535, +b as c2536, +b as c2537, +b as c2538, +b as c2539, +b as c2540, +b as c2541, +b as c2542, +b as c2543, +b as c2544, +b as c2545, +b as c2546, +b as c2547, +b as c2548, +b as c2549, +b as c2550, +b as c2551, +b as c2552, +b as c2553, +b as c2554, +b as c2555, +b as c2556, +b as c2557, +b as c2558, +b as c2559, +b as c2560, +b as c2561, +b as c2562, +b as c2563, +b as c2564, +b as c2565, +b as c2566, +b as c2567, +b as c2568, +b as c2569, +b as c2570, +b as c2571, +b as c2572, +b as c2573, +b as c2574, +b as c2575, +b as c2576, +b as c2577, +b as c2578, +b as c2579, +b as c2580, +b as c2581, +b as c2582, +b as c2583, +b as c2584, +b as c2585, +b as c2586, +b as c2587, +b as c2588, +b as c2589, +b as c2590, +b as c2591, +b as c2592, +b as c2593, +b as c2594, +b as c2595, +b as c2596, +b as c2597, +b as c2598, +b as c2599, +b as c2600, +b as c2601, +b as c2602, +b as c2603, +b as c2604, +b as c2605, +b as c2606, +b as c2607, +b as c2608, +b as c2609, +b as c2610, +b as c2611, +b as c2612, +b as c2613, +b as c2614, +b as c2615, +b as c2616, +b as c2617, +b as c2618, +b as c2619, +b as c2620, +b as c2621, +b as c2622, +b as c2623, +b as c2624, +b as c2626 +from t1 +) as tt1; +ERROR 0A000: Aria table 'tmp' has too many columns and/or indexes and/or unique constraints. +drop table t1; diff --git a/mysql-test/main/tmp_table_error.test b/mysql-test/main/tmp_table_error.test new file mode 100644 index 0000000000000..dbddaaaa4c794 --- /dev/null +++ b/mysql-test/main/tmp_table_error.test @@ -0,0 +1,2637 @@ +source include/have_innodb.inc; +call mtr.add_suppression('Index for table'); +create table t1 ( + a int primary key, + b text +) engine=innodb; + +--replace_regex /'.*'/'tmp'/ +--error 140 +create table t2 as +select + 1 + from + (select distinct + b as c0, + b as c1, + b as c2, + b as c3, + b as c4, + b as c5, + b as c6, + b as c7, + b as c8, + b as c9, + b as c10, + b as c11, + b as c12, + b as c13, + b as c14, + b as c15, + b as c16, + b as c17, + b as c18, + b as c19, + b as c20, + b as c21, + b as c22, + b as c23, + b as c24, + b as c25, + b as c26, + b as c27, + b as c28, + b as c29, + b as c30, + b as c31, + b as c32, + b as c33, + b as c34, + b as c35, + b as c36, + b as c37, + b as c38, + b as c39, + b as c40, + b as c41, + b as c42, + b as c43, + b as c45, + b as c46, + b as c47, + b as c48, + b as c49, + b as c50, + b as c51, + b as c52, + b as c53, + b as c54, + b as c55, + b as c56, + b as c57, + b as c58, + b as c59, + b as c60, + b as c61, + b as c62, + b as c63, + b as c64, + b as c65, + b as c66, + b as c67, + b as c68, + b as c69, + b as c70, + b as c71, + b as c72, + b as c73, + b as c74, + b as c75, + b as c76, + b as c77, + b as c78, + b as c79, + b as c80, + b as c81, + b as c82, + b as c83, + b as c84, + b as c85, + b as c86, + b as c87, + b as c88, + b as c89, + b as c90, + b as c91, + b as c92, + b as c93, + b as c94, + b as c95, + b as c96, + b as c97, + b as c98, + b as c99, + b as c100, + b as c101, + b as c102, + b as c103, + b as c104, + b as c105, + b as c106, + b as c107, + b as c108, + b as c109, + b as c110, + b as c111, + b as c112, + b as c113, + b as c114, + b as c115, + b as c116, + b as c117, + b as c118, + b as c119, + b as c120, + b as c121, + b as c122, + b as c123, + b as c124, + b as c125, + b as c126, + b as c127, + b as c128, + b as c129, + b as c130, + b as c131, + b as c132, + b as c133, + b as c134, + b as c135, + b as c136, + b as c137, + b as c138, + b as c139, + b as c140, + b as c141, + b as c142, + b as c143, + b as c144, + b as c145, + b as c146, + b as c147, + b as c148, + b as c149, + b as c150, + b as c151, + b as c152, + b as c153, + b as c154, + b as c155, + b as c156, + b as c157, + b as c158, + b as c159, + b as c160, + b as c161, + b as c162, + b as c163, + b as c164, + b as c165, + b as c166, + b as c167, + b as c168, + b as c169, + b as c170, + b as c171, + b as c172, + b as c173, + b as c174, + b as c175, + b as c176, + b as c177, + b as c178, + b as c179, + b as c180, + b as c181, + b as c182, + b as c183, + b as c184, + b as c185, + b as c186, + b as c187, + b as c188, + b as c189, + b as c190, + b as c191, + b as c192, + b as c193, + b as c194, + b as c195, + b as c196, + b as c197, + b as c198, + b as c199, + b as c200, + b as c201, + b as c202, + b as c203, + b as c204, + b as c205, + b as c206, + b as c207, + b as c208, + b as c209, + b as c210, + b as c211, + b as c212, + b as c213, + b as c214, + b as c215, + b as c216, + b as c217, + b as c218, + b as c219, + b as c220, + b as c221, + b as c222, + b as c223, + b as c224, + b as c225, + b as c226, + b as c227, + b as c228, + b as c229, + b as c230, + b as c231, + b as c232, + b as c233, + b as c234, + b as c235, + b as c236, + b as c237, + b as c238, + b as c239, + b as c240, + b as c241, + b as c242, + b as c243, + b as c244, + b as c245, + b as c246, + b as c247, + b as c248, + b as c249, + b as c250, + b as c251, + b as c252, + b as c253, + b as c254, + b as c255, + b as c256, + b as c257, + b as c258, + b as c259, + b as c260, + b as c261, + b as c262, + b as c263, + b as c264, + b as c265, + b as c266, + b as c267, + b as c268, + b as c269, + b as c270, + b as c271, + b as c272, + b as c273, + b as c274, + b as c275, + b as c276, + b as c277, + b as c278, + b as c279, + b as c280, + b as c281, + b as c282, + b as c283, + b as c284, + b as c285, + b as c286, + b as c287, + b as c288, + b as c289, + b as c290, + b as c291, + b as c292, + b as c293, + b as c294, + b as c295, + b as c296, + b as c297, + b as c298, + b as c299, + b as c300, + b as c301, + b as c302, + b as c303, + b as c304, + b as c305, + b as c306, + b as c307, + b as c308, + b as c309, + b as c310, + b as c311, + b as c312, + b as c313, + b as c314, + b as c315, + b as c316, + b as c317, + b as c318, + b as c319, + b as c320, + b as c321, + b as c322, + b as c323, + b as c324, + b as c325, + b as c326, + b as c327, + b as c328, + b as c329, + b as c330, + b as c331, + b as c332, + b as c333, + b as c334, + b as c335, + b as c336, + b as c337, + b as c338, + b as c339, + b as c340, + b as c341, + b as c342, + b as c343, + b as c344, + b as c345, + b as c346, + b as c347, + b as c348, + b as c349, + b as c350, + b as c351, + b as c352, + b as c353, + b as c354, + b as c355, + b as c356, + b as c357, + b as c358, + b as c359, + b as c360, + b as c361, + b as c362, + b as c363, + b as c364, + b as c365, + b as c366, + b as c367, + b as c368, + b as c369, + b as c370, + b as c371, + b as c372, + b as c373, + b as c374, + b as c375, + b as c376, + b as c377, + b as c378, + b as c379, + b as c380, + b as c381, + b as c382, + b as c383, + b as c384, + b as c385, + b as c386, + b as c387, + b as c388, + b as c389, + b as c390, + b as c391, + b as c392, + b as c393, + b as c394, + b as c395, + b as c396, + b as c397, + b as c398, + b as c399, + b as c400, + b as c401, + b as c402, + b as c403, + b as c404, + b as c405, + b as c406, + b as c407, + b as c409, + b as c410, + b as c411, + b as c412, + b as c413, + b as c414, + b as c415, + b as c416, + b as c417, + b as c418, + b as c419, + b as c420, + b as c421, + b as c422, + b as c423, + b as c424, + b as c425, + b as c426, + b as c427, + b as c428, + b as c429, + b as c430, + b as c431, + b as c432, + b as c433, + b as c434, + b as c435, + b as c436, + b as c437, + b as c438, + b as c439, + b as c440, + b as c441, + b as c442, + b as c443, + b as c444, + b as c445, + b as c446, + b as c447, + b as c448, + b as c449, + b as c450, + b as c451, + b as c452, + b as c453, + b as c454, + b as c455, + b as c456, + b as c457, + b as c458, + b as c459, + b as c460, + b as c461, + b as c462, + b as c463, + b as c464, + b as c465, + b as c466, + b as c467, + b as c468, + b as c469, + b as c470, + b as c471, + b as c472, + b as c473, + b as c474, + b as c475, + b as c476, + b as c477, + b as c478, + b as c479, + b as c480, + b as c481, + b as c482, + b as c483, + b as c484, + b as c485, + b as c486, + b as c487, + b as c488, + b as c489, + b as c490, + b as c491, + b as c492, + b as c493, + b as c494, + b as c495, + b as c496, + b as c497, + b as c498, + b as c499, + b as c500, + b as c501, + b as c502, + b as c503, + b as c504, + b as c505, + b as c506, + b as c507, + b as c508, + b as c509, + b as c510, + b as c511, + b as c512, + b as c513, + b as c514, + b as c515, + b as c516, + b as c517, + b as c518, + b as c519, + b as c520, + b as c521, + b as c522, + b as c523, + b as c524, + b as c525, + b as c526, + b as c527, + b as c528, + b as c529, + b as c530, + b as c531, + b as c532, + b as c533, + b as c534, + b as c535, + b as c536, + b as c537, + b as c538, + b as c539, + b as c540, + b as c541, + b as c542, + b as c543, + b as c544, + b as c545, + b as c546, + b as c547, + b as c548, + b as c549, + b as c550, + b as c551, + b as c552, + b as c553, + b as c554, + b as c555, + b as c556, + b as c557, + b as c558, + b as c559, + b as c560, + b as c561, + b as c562, + b as c563, + b as c564, + b as c565, + b as c566, + b as c567, + b as c568, + b as c569, + b as c570, + b as c571, + b as c572, + b as c573, + b as c574, + b as c575, + b as c576, + b as c577, + b as c578, + b as c579, + b as c580, + b as c581, + b as c582, + b as c583, + b as c584, + b as c585, + b as c586, + b as c587, + b as c588, + b as c589, + b as c590, + b as c591, + b as c592, + b as c593, + b as c594, + b as c595, + b as c596, + b as c597, + b as c598, + b as c599, + b as c600, + b as c601, + b as c602, + b as c603, + b as c604, + b as c605, + b as c606, + b as c607, + b as c608, + b as c609, + b as c610, + b as c611, + b as c612, + b as c613, + b as c614, + b as c615, + b as c616, + b as c617, + b as c618, + b as c619, + b as c620, + b as c621, + b as c622, + b as c623, + b as c624, + b as c625, + b as c626, + b as c627, + b as c628, + b as c629, + b as c630, + b as c631, + b as c632, + b as c633, + b as c634, + b as c635, + b as c636, + b as c637, + b as c638, + b as c639, + b as c640, + b as c641, + b as c642, + b as c643, + b as c644, + b as c645, + b as c646, + b as c647, + b as c648, + b as c649, + b as c650, + b as c651, + b as c652, + b as c653, + b as c654, + b as c655, + b as c656, + b as c657, + b as c658, + b as c659, + b as c660, + b as c661, + b as c662, + b as c663, + b as c664, + b as c665, + b as c666, + b as c667, + b as c668, + b as c669, + b as c670, + b as c671, + b as c672, + b as c673, + b as c674, + b as c675, + b as c676, + b as c677, + b as c678, + b as c679, + b as c680, + b as c681, + b as c682, + b as c683, + b as c684, + b as c685, + b as c686, + b as c687, + b as c688, + b as c689, + b as c690, + b as c691, + b as c692, + b as c693, + b as c694, + b as c695, + b as c696, + b as c697, + b as c698, + b as c699, + b as c700, + b as c701, + b as c702, + b as c703, + b as c704, + b as c705, + b as c706, + b as c707, + b as c708, + b as c709, + b as c710, + b as c711, + b as c712, + b as c713, + b as c714, + b as c715, + b as c716, + b as c717, + b as c718, + b as c719, + b as c720, + b as c721, + b as c722, + b as c723, + b as c724, + b as c725, + b as c726, + b as c727, + b as c728, + b as c729, + b as c730, + b as c731, + b as c732, + b as c733, + b as c734, + b as c735, + b as c736, + b as c737, + b as c738, + b as c739, + b as c740, + b as c741, + b as c742, + b as c743, + b as c744, + b as c745, + b as c746, + b as c747, + b as c748, + b as c749, + b as c750, + b as c751, + b as c752, + b as c753, + b as c754, + b as c755, + b as c756, + b as c757, + b as c758, + b as c759, + b as c760, + b as c761, + b as c762, + b as c763, + b as c764, + b as c765, + b as c766, + b as c767, + b as c768, + b as c769, + b as c770, + b as c771, + b as c772, + b as c773, + b as c774, + b as c775, + b as c776, + b as c777, + b as c778, + b as c779, + b as c780, + b as c781, + b as c782, + b as c783, + b as c784, + b as c785, + b as c786, + b as c787, + b as c788, + b as c789, + b as c790, + b as c791, + b as c792, + b as c793, + b as c794, + b as c795, + b as c796, + b as c797, + b as c798, + b as c799, + b as c800, + b as c801, + b as c802, + b as c803, + b as c804, + b as c805, + b as c806, + b as c807, + b as c808, + b as c809, + b as c810, + b as c811, + b as c812, + b as c813, + b as c814, + b as c815, + b as c816, + b as c817, + b as c818, + b as c819, + b as c820, + b as c821, + b as c822, + b as c823, + b as c824, + b as c825, + b as c826, + b as c827, + b as c828, + b as c829, + b as c830, + b as c831, + b as c832, + b as c833, + b as c834, + b as c835, + b as c836, + b as c837, + b as c838, + b as c839, + b as c840, + b as c841, + b as c842, + b as c843, + b as c844, + b as c845, + b as c846, + b as c847, + b as c848, + b as c849, + b as c850, + b as c851, + b as c852, + b as c853, + b as c854, + b as c855, + b as c856, + b as c857, + b as c858, + b as c859, + b as c860, + b as c861, + b as c862, + b as c863, + b as c864, + b as c865, + b as c866, + b as c867, + b as c868, + b as c869, + b as c870, + b as c871, + b as c872, + b as c873, + b as c874, + b as c875, + b as c876, + b as c877, + b as c878, + b as c879, + b as c880, + b as c881, + b as c882, + b as c883, + b as c884, + b as c885, + b as c886, + b as c887, + b as c888, + b as c889, + b as c890, + b as c891, + b as c892, + b as c893, + b as c894, + b as c895, + b as c897, + b as c898, + b as c899, + b as c900, + b as c901, + b as c902, + b as c903, + b as c904, + b as c905, + b as c906, + b as c907, + b as c908, + b as c909, + b as c910, + b as c911, + b as c912, + b as c913, + b as c914, + b as c915, + b as c916, + b as c917, + b as c918, + b as c919, + b as c920, + b as c921, + b as c922, + b as c923, + b as c924, + b as c925, + b as c926, + b as c927, + b as c928, + b as c929, + b as c930, + b as c931, + b as c932, + b as c933, + b as c934, + b as c935, + b as c936, + b as c937, + b as c938, + b as c939, + b as c940, + b as c941, + b as c942, + b as c943, + b as c944, + b as c945, + b as c946, + b as c947, + b as c948, + b as c949, + b as c950, + b as c951, + b as c952, + b as c953, + b as c954, + b as c955, + b as c956, + b as c957, + b as c958, + b as c959, + b as c960, + b as c961, + b as c962, + b as c963, + b as c964, + b as c965, + b as c966, + b as c967, + b as c968, + b as c969, + b as c970, + b as c971, + b as c972, + b as c973, + b as c974, + b as c975, + b as c976, + b as c977, + b as c978, + b as c979, + b as c980, + b as c981, + b as c982, + b as c983, + b as c984, + b as c985, + b as c986, + b as c987, + b as c988, + b as c989, + b as c990, + b as c991, + b as c992, + b as c993, + b as c995, + b as c996, + b as c997, + b as c998, + b as c999, + b as c1000, + b as c1001, + b as c1002, + b as c1003, + b as c1004, + b as c1005, + b as c1006, + b as c1007, + b as c1008, + b as c1009, + b as c1010, + b as c1011, + b as c1012, + b as c1013, + b as c1014, + b as c1015, + b as c1016, + b as c1017, + b as c1018, + b as c1019, + b as c1020, + b as c1021, + b as c1022, + b as c1023, + b as c1024, + b as c1025, + b as c1026, + b as c1027, + b as c1028, + b as c1029, + b as c1030, + b as c1031, + b as c1032, + b as c1033, + b as c1034, + b as c1035, + b as c1036, + b as c1037, + b as c1038, + b as c1039, + b as c1040, + b as c1041, + b as c1042, + b as c1043, + b as c1044, + b as c1045, + b as c1046, + b as c1047, + b as c1048, + b as c1049, + b as c1050, + b as c1051, + b as c1052, + b as c1053, + b as c1054, + b as c1055, + b as c1056, + b as c1057, + b as c1058, + b as c1059, + b as c1060, + b as c1061, + b as c1062, + b as c1063, + b as c1064, + b as c1065, + b as c1066, + b as c1067, + b as c1068, + b as c1069, + b as c1070, + b as c1071, + b as c1072, + b as c1073, + b as c1074, + b as c1075, + b as c1076, + b as c1077, + b as c1078, + b as c1079, + b as c1080, + b as c1081, + b as c1082, + b as c1083, + b as c1084, + b as c1085, + b as c1086, + b as c1087, + b as c1088, + b as c1089, + b as c1090, + b as c1091, + b as c1092, + b as c1093, + b as c1094, + b as c1095, + b as c1096, + b as c1097, + b as c1098, + b as c1099, + b as c1100, + b as c1101, + b as c1102, + b as c1103, + b as c1104, + b as c1105, + b as c1106, + b as c1107, + b as c1108, + b as c1109, + b as c1110, + b as c1111, + b as c1112, + b as c1113, + b as c1114, + b as c1115, + b as c1116, + b as c1117, + b as c1118, + b as c1119, + b as c1120, + b as c1121, + b as c1122, + b as c1123, + b as c1124, + b as c1125, + b as c1126, + b as c1127, + b as c1128, + b as c1129, + b as c1130, + b as c1131, + b as c1132, + b as c1133, + b as c1134, + b as c1135, + b as c1136, + b as c1137, + b as c1138, + b as c1139, + b as c1140, + b as c1141, + b as c1142, + b as c1143, + b as c1144, + b as c1145, + b as c1146, + b as c1147, + b as c1148, + b as c1149, + b as c1150, + b as c1151, + b as c1152, + b as c1153, + b as c1154, + b as c1155, + b as c1156, + b as c1157, + b as c1158, + b as c1159, + b as c1160, + b as c1161, + b as c1162, + b as c1163, + b as c1164, + b as c1165, + b as c1166, + b as c1167, + b as c1168, + b as c1169, + b as c1170, + b as c1171, + b as c1172, + b as c1173, + b as c1174, + b as c1175, + b as c1176, + b as c1177, + b as c1178, + b as c1179, + b as c1180, + b as c1181, + b as c1182, + b as c1183, + b as c1184, + b as c1185, + b as c1186, + b as c1187, + b as c1188, + b as c1189, + b as c1190, + b as c1191, + b as c1192, + b as c1193, + b as c1194, + b as c1195, + b as c1196, + b as c1197, + b as c1198, + b as c1199, + b as c1200, + b as c1201, + b as c1202, + b as c1203, + b as c1204, + b as c1205, + b as c1206, + b as c1207, + b as c1208, + b as c1209, + b as c1210, + b as c1211, + b as c1212, + b as c1213, + b as c1214, + b as c1215, + b as c1216, + b as c1217, + b as c1218, + b as c1219, + b as c1220, + b as c1221, + b as c1222, + b as c1223, + b as c1224, + b as c1225, + b as c1226, + b as c1227, + b as c1228, + b as c1229, + b as c1230, + b as c1231, + b as c1232, + b as c1233, + b as c1234, + b as c1235, + b as c1236, + b as c1237, + b as c1238, + b as c1239, + b as c1240, + b as c1241, + b as c1242, + b as c1243, + b as c1244, + b as c1245, + b as c1246, + b as c1247, + b as c1248, + b as c1249, + b as c1250, + b as c1251, + b as c1252, + b as c1253, + b as c1254, + b as c1255, + b as c1256, + b as c1257, + b as c1258, + b as c1259, + b as c1260, + b as c1261, + b as c1262, + b as c1263, + b as c1264, + b as c1265, + b as c1266, + b as c1267, + b as c1268, + b as c1269, + b as c1270, + b as c1271, + b as c1272, + b as c1273, + b as c1274, + b as c1275, + b as c1276, + b as c1277, + b as c1278, + b as c1279, + b as c1280, + b as c1281, + b as c1282, + b as c1283, + b as c1284, + b as c1285, + b as c1286, + b as c1287, + b as c1288, + b as c1289, + b as c1290, + b as c1291, + b as c1292, + b as c1293, + b as c1294, + b as c1295, + b as c1296, + b as c1297, + b as c1298, + b as c1299, + b as c1300, + b as c1301, + b as c1302, + b as c1303, + b as c1304, + b as c1305, + b as c1306, + b as c1307, + b as c1308, + b as c1309, + b as c1310, + b as c1311, + b as c1312, + b as c1313, + b as c1314, + b as c1315, + b as c1316, + b as c1317, + b as c1318, + b as c1319, + b as c1320, + b as c1321, + b as c1322, + b as c1323, + b as c1324, + b as c1325, + b as c1326, + b as c1327, + b as c1328, + b as c1329, + b as c1330, + b as c1331, + b as c1332, + b as c1333, + b as c1334, + b as c1335, + b as c1336, + b as c1337, + b as c1338, + b as c1339, + b as c1340, + b as c1341, + b as c1342, + b as c1343, + b as c1344, + b as c1345, + b as c1346, + b as c1347, + b as c1348, + b as c1349, + b as c1350, + b as c1351, + b as c1352, + b as c1353, + b as c1354, + b as c1355, + b as c1356, + b as c1357, + b as c1358, + b as c1359, + b as c1360, + b as c1361, + b as c1362, + b as c1363, + b as c1364, + b as c1365, + b as c1366, + b as c1367, + b as c1368, + b as c1369, + b as c1370, + b as c1371, + b as c1372, + b as c1373, + b as c1374, + b as c1375, + b as c1376, + b as c1377, + b as c1378, + b as c1379, + b as c1380, + b as c1381, + b as c1382, + b as c1383, + b as c1384, + b as c1385, + b as c1386, + b as c1387, + b as c1388, + b as c1389, + b as c1390, + b as c1391, + b as c1392, + b as c1393, + b as c1394, + b as c1395, + b as c1396, + b as c1397, + b as c1398, + b as c1399, + b as c1400, + b as c1401, + b as c1402, + b as c1403, + b as c1404, + b as c1405, + b as c1406, + b as c1407, + b as c1408, + b as c1409, + b as c1410, + b as c1411, + b as c1412, + b as c1413, + b as c1414, + b as c1415, + b as c1416, + b as c1417, + b as c1418, + b as c1419, + b as c1420, + b as c1421, + b as c1422, + b as c1423, + b as c1424, + b as c1425, + b as c1426, + b as c1427, + b as c1428, + b as c1429, + b as c1430, + b as c1431, + b as c1432, + b as c1433, + b as c1434, + b as c1435, + b as c1436, + b as c1437, + b as c1438, + b as c1439, + b as c1440, + b as c1441, + b as c1442, + b as c1443, + b as c1444, + b as c1445, + b as c1446, + b as c1447, + b as c1448, + b as c1449, + b as c1451, + b as c1452, + b as c1453, + b as c1454, + b as c1455, + b as c1456, + b as c1457, + b as c1458, + b as c1459, + b as c1460, + b as c1461, + b as c1462, + b as c1463, + b as c1464, + b as c1465, + b as c1466, + b as c1467, + b as c1468, + b as c1469, + b as c1470, + b as c1471, + b as c1472, + b as c1473, + b as c1474, + b as c1475, + b as c1476, + b as c1477, + b as c1478, + b as c1479, + b as c1480, + b as c1481, + b as c1482, + b as c1483, + b as c1484, + b as c1485, + b as c1486, + b as c1487, + b as c1488, + b as c1489, + b as c1490, + b as c1491, + b as c1492, + b as c1493, + b as c1494, + b as c1495, + b as c1496, + b as c1497, + b as c1498, + b as c1499, + b as c1500, + b as c1501, + b as c1502, + b as c1503, + b as c1504, + b as c1505, + b as c1506, + b as c1507, + b as c1508, + b as c1509, + b as c1510, + b as c1511, + b as c1512, + b as c1513, + b as c1514, + b as c1515, + b as c1516, + b as c1517, + b as c1518, + b as c1519, + b as c1520, + b as c1521, + b as c1522, + b as c1523, + b as c1524, + b as c1525, + b as c1526, + b as c1527, + b as c1528, + b as c1529, + b as c1530, + b as c1531, + b as c1532, + b as c1533, + b as c1534, + b as c1535, + b as c1536, + b as c1537, + b as c1538, + b as c1539, + b as c1540, + b as c1541, + b as c1542, + b as c1543, + b as c1544, + b as c1545, + b as c1546, + b as c1547, + b as c1548, + b as c1549, + b as c1550, + b as c1551, + b as c1552, + b as c1553, + b as c1554, + b as c1555, + b as c1556, + b as c1557, + b as c1558, + b as c1559, + b as c1560, + b as c1561, + b as c1562, + b as c1563, + b as c1564, + b as c1565, + b as c1566, + b as c1567, + b as c1568, + b as c1569, + b as c1570, + b as c1571, + b as c1572, + b as c1573, + b as c1574, + b as c1575, + b as c1576, + b as c1577, + b as c1578, + b as c1579, + b as c1580, + b as c1581, + b as c1582, + b as c1583, + b as c1584, + b as c1585, + b as c1586, + b as c1587, + b as c1588, + b as c1589, + b as c1590, + b as c1591, + b as c1592, + b as c1593, + b as c1594, + b as c1595, + b as c1596, + b as c1597, + b as c1598, + b as c1599, + b as c1600, + b as c1601, + b as c1602, + b as c1603, + b as c1604, + b as c1605, + b as c1606, + b as c1607, + b as c1608, + b as c1609, + b as c1610, + b as c1611, + b as c1612, + b as c1613, + b as c1614, + b as c1615, + b as c1616, + b as c1617, + b as c1618, + b as c1619, + b as c1620, + b as c1621, + b as c1622, + b as c1623, + b as c1624, + b as c1625, + b as c1626, + b as c1627, + b as c1628, + b as c1629, + b as c1630, + b as c1631, + b as c1632, + b as c1633, + b as c1634, + b as c1635, + b as c1636, + b as c1637, + b as c1638, + b as c1639, + b as c1640, + b as c1641, + b as c1642, + b as c1643, + b as c1644, + b as c1645, + b as c1646, + b as c1647, + b as c1648, + b as c1649, + b as c1650, + b as c1651, + b as c1652, + b as c1653, + b as c1654, + b as c1655, + b as c1656, + b as c1657, + b as c1658, + b as c1659, + b as c1660, + b as c1661, + b as c1662, + b as c1663, + b as c1664, + b as c1665, + b as c1666, + b as c1667, + b as c1668, + b as c1669, + b as c1670, + b as c1671, + b as c1672, + b as c1673, + b as c1674, + b as c1675, + b as c1676, + b as c1677, + b as c1678, + b as c1679, + b as c1680, + b as c1681, + b as c1682, + b as c1683, + b as c1684, + b as c1685, + b as c1686, + b as c1687, + b as c1688, + b as c1689, + b as c1690, + b as c1691, + b as c1692, + b as c1693, + b as c1694, + b as c1695, + b as c1696, + b as c1697, + b as c1698, + b as c1699, + b as c1700, + b as c1701, + b as c1702, + b as c1703, + b as c1704, + b as c1705, + b as c1706, + b as c1707, + b as c1708, + b as c1709, + b as c1710, + b as c1711, + b as c1712, + b as c1713, + b as c1714, + b as c1715, + b as c1716, + b as c1717, + b as c1718, + b as c1719, + b as c1720, + b as c1721, + b as c1722, + b as c1723, + b as c1724, + b as c1725, + b as c1726, + b as c1727, + b as c1728, + b as c1729, + b as c1730, + b as c1731, + b as c1732, + b as c1733, + b as c1734, + b as c1735, + b as c1736, + b as c1737, + b as c1738, + b as c1739, + b as c1740, + b as c1741, + b as c1742, + b as c1743, + b as c1744, + b as c1745, + b as c1746, + b as c1747, + b as c1748, + b as c1749, + b as c1750, + b as c1751, + b as c1752, + b as c1753, + b as c1754, + b as c1755, + b as c1756, + b as c1757, + b as c1758, + b as c1759, + b as c1760, + b as c1761, + b as c1762, + b as c1763, + b as c1764, + b as c1765, + b as c1766, + b as c1767, + b as c1768, + b as c1769, + b as c1770, + b as c1771, + b as c1772, + b as c1773, + b as c1774, + b as c1775, + b as c1776, + b as c1777, + b as c1778, + b as c1779, + b as c1780, + b as c1781, + b as c1782, + b as c1783, + b as c1784, + b as c1785, + b as c1786, + b as c1787, + b as c1788, + b as c1789, + b as c1790, + b as c1791, + b as c1792, + b as c1793, + b as c1794, + b as c1795, + b as c1796, + b as c1797, + b as c1798, + b as c1799, + b as c1800, + b as c1801, + b as c1802, + b as c1803, + b as c1804, + b as c1805, + b as c1806, + b as c1807, + b as c1808, + b as c1809, + b as c1810, + b as c1811, + b as c1812, + b as c1813, + b as c1814, + b as c1815, + b as c1816, + b as c1817, + b as c1818, + b as c1819, + b as c1820, + b as c1821, + b as c1822, + b as c1823, + b as c1824, + b as c1825, + b as c1826, + b as c1827, + b as c1828, + b as c1829, + b as c1830, + b as c1831, + b as c1832, + b as c1833, + b as c1834, + b as c1835, + b as c1836, + b as c1837, + b as c1838, + b as c1839, + b as c1840, + b as c1841, + b as c1842, + b as c1843, + b as c1844, + b as c1845, + b as c1846, + b as c1847, + b as c1848, + b as c1849, + b as c1850, + b as c1851, + b as c1852, + b as c1853, + b as c1854, + b as c1855, + b as c1856, + b as c1857, + b as c1858, + b as c1859, + b as c1860, + b as c1861, + b as c1862, + b as c1863, + b as c1864, + b as c1865, + b as c1866, + b as c1867, + b as c1868, + b as c1869, + b as c1870, + b as c1871, + b as c1872, + b as c1873, + b as c1874, + b as c1875, + b as c1876, + b as c1877, + b as c1878, + b as c1879, + b as c1880, + b as c1881, + b as c1882, + b as c1883, + b as c1884, + b as c1885, + b as c1886, + b as c1887, + b as c1888, + b as c1889, + b as c1890, + b as c1891, + b as c1892, + b as c1893, + b as c1894, + b as c1895, + b as c1896, + b as c1897, + b as c1898, + b as c1899, + b as c1900, + b as c1901, + b as c1902, + b as c1903, + b as c1904, + b as c1905, + b as c1906, + b as c1907, + b as c1908, + b as c1909, + b as c1910, + b as c1911, + b as c1912, + b as c1913, + b as c1914, + b as c1915, + b as c1916, + b as c1917, + b as c1918, + b as c1919, + b as c1920, + b as c1921, + b as c1922, + b as c1923, + b as c1924, + b as c1925, + b as c1926, + b as c1927, + b as c1928, + b as c1929, + b as c1930, + b as c1931, + b as c1932, + b as c1933, + b as c1934, + b as c1935, + b as c1936, + b as c1937, + b as c1938, + b as c1939, + b as c1940, + b as c1941, + b as c1942, + b as c1943, + b as c1944, + b as c1945, + b as c1946, + b as c1947, + b as c1948, + b as c1949, + b as c1950, + b as c1951, + b as c1952, + b as c1953, + b as c1954, + b as c1955, + b as c1956, + b as c1957, + b as c1958, + b as c1959, + b as c1960, + b as c1961, + b as c1962, + b as c1963, + b as c1964, + b as c1965, + b as c1966, + b as c1967, + b as c1968, + b as c1969, + b as c1970, + b as c1971, + b as c1972, + b as c1973, + b as c1974, + b as c1975, + b as c1976, + b as c1977, + b as c1978, + b as c1979, + b as c1980, + b as c1981, + b as c1982, + b as c1983, + b as c1984, + b as c1985, + b as c1986, + b as c1987, + b as c1988, + b as c1989, + b as c1990, + b as c1991, + b as c1992, + b as c1993, + b as c1994, + b as c1995, + b as c1996, + b as c1997, + b as c1998, + b as c1999, + b as c2000, + b as c2001, + b as c2002, + b as c2003, + b as c2004, + b as c2005, + b as c2006, + b as c2007, + b as c2008, + b as c2009, + b as c2010, + b as c2011, + b as c2012, + b as c2013, + b as c2014, + b as c2015, + b as c2016, + b as c2017, + b as c2018, + b as c2019, + b as c2020, + b as c2021, + b as c2022, + b as c2023, + b as c2024, + b as c2025, + b as c2026, + b as c2027, + b as c2028, + b as c2029, + b as c2030, + b as c2031, + b as c2032, + b as c2033, + b as c2034, + b as c2035, + b as c2036, + b as c2037, + b as c2038, + b as c2039, + b as c2040, + b as c2041, + b as c2042, + b as c2043, + b as c2044, + b as c2045, + b as c2046, + b as c2047, + b as c2048, + b as c2049, + b as c2050, + b as c2051, + b as c2052, + b as c2053, + b as c2054, + b as c2055, + b as c2056, + b as c2057, + b as c2058, + b as c2059, + b as c2060, + b as c2061, + b as c2062, + b as c2063, + b as c2064, + b as c2065, + b as c2066, + b as c2067, + b as c2068, + b as c2069, + b as c2070, + b as c2071, + b as c2072, + b as c2073, + b as c2074, + b as c2075, + b as c2076, + b as c2077, + b as c2078, + b as c2079, + b as c2080, + b as c2081, + b as c2082, + b as c2083, + b as c2084, + b as c2085, + b as c2086, + b as c2087, + b as c2088, + b as c2089, + b as c2090, + b as c2091, + b as c2092, + b as c2093, + b as c2094, + b as c2095, + b as c2096, + b as c2097, + b as c2098, + b as c2099, + b as c2100, + b as c2101, + b as c2102, + b as c2103, + b as c2104, + b as c2105, + b as c2106, + b as c2107, + b as c2108, + b as c2109, + b as c2110, + b as c2111, + b as c2112, + b as c2113, + b as c2114, + b as c2115, + b as c2116, + b as c2117, + b as c2118, + b as c2119, + b as c2120, + b as c2121, + b as c2122, + b as c2123, + b as c2124, + b as c2125, + b as c2126, + b as c2127, + b as c2128, + b as c2129, + b as c2130, + b as c2131, + b as c2132, + b as c2133, + b as c2134, + b as c2135, + b as c2136, + b as c2137, + b as c2138, + b as c2139, + b as c2140, + b as c2141, + b as c2142, + b as c2143, + b as c2144, + b as c2145, + b as c2146, + b as c2147, + b as c2148, + b as c2149, + b as c2150, + b as c2151, + b as c2152, + b as c2153, + b as c2154, + b as c2155, + b as c2156, + b as c2157, + b as c2158, + b as c2159, + b as c2160, + b as c2161, + b as c2162, + b as c2163, + b as c2164, + b as c2165, + b as c2166, + b as c2167, + b as c2168, + b as c2169, + b as c2170, + b as c2171, + b as c2172, + b as c2173, + b as c2174, + b as c2175, + b as c2176, + b as c2177, + b as c2178, + b as c2179, + b as c2180, + b as c2181, + b as c2182, + b as c2183, + b as c2184, + b as c2185, + b as c2186, + b as c2187, + b as c2188, + b as c2189, + b as c2190, + b as c2191, + b as c2192, + b as c2193, + b as c2194, + b as c2195, + b as c2196, + b as c2197, + b as c2198, + b as c2199, + b as c2200, + b as c2201, + b as c2202, + b as c2203, + b as c2204, + b as c2205, + b as c2206, + b as c2207, + b as c2208, + b as c2209, + b as c2210, + b as c2211, + b as c2212, + b as c2213, + b as c2214, + b as c2215, + b as c2216, + b as c2217, + b as c2218, + b as c2219, + b as c2220, + b as c2221, + b as c2222, + b as c2223, + b as c2224, + b as c2225, + b as c2226, + b as c2227, + b as c2228, + b as c2229, + b as c2230, + b as c2231, + b as c2232, + b as c2233, + b as c2234, + b as c2235, + b as c2236, + b as c2237, + b as c2238, + b as c2239, + b as c2240, + b as c2241, + b as c2242, + b as c2243, + b as c2244, + b as c2245, + b as c2246, + b as c2247, + b as c2248, + b as c2249, + b as c2250, + b as c2251, + b as c2252, + b as c2253, + b as c2254, + b as c2255, + b as c2256, + b as c2257, + b as c2258, + b as c2259, + b as c2260, + b as c2261, + b as c2262, + b as c2263, + b as c2264, + b as c2265, + b as c2266, + b as c2267, + b as c2268, + b as c2269, + b as c2270, + b as c2271, + b as c2272, + b as c2273, + b as c2274, + b as c2275, + b as c2276, + b as c2277, + b as c2278, + b as c2279, + b as c2280, + b as c2281, + b as c2282, + b as c2283, + b as c2284, + b as c2285, + b as c2286, + b as c2287, + b as c2288, + b as c2289, + b as c2290, + b as c2291, + b as c2292, + b as c2293, + b as c2294, + b as c2295, + b as c2296, + b as c2297, + b as c2298, + b as c2299, + b as c2300, + b as c2301, + b as c2302, + b as c2303, + b as c2304, + b as c2305, + b as c2306, + b as c2307, + b as c2308, + b as c2309, + b as c2310, + b as c2311, + b as c2312, + b as c2313, + b as c2314, + b as c2315, + b as c2316, + b as c2317, + b as c2318, + b as c2319, + b as c2320, + b as c2321, + b as c2322, + b as c2323, + b as c2324, + b as c2325, + b as c2326, + b as c2327, + b as c2328, + b as c2329, + b as c2330, + b as c2331, + b as c2332, + b as c2333, + b as c2334, + b as c2335, + b as c2336, + b as c2337, + b as c2338, + b as c2339, + b as c2340, + b as c2341, + b as c2342, + b as c2343, + b as c2344, + b as c2345, + b as c2346, + b as c2347, + b as c2348, + b as c2349, + b as c2350, + b as c2351, + b as c2352, + b as c2353, + b as c2354, + b as c2355, + b as c2356, + b as c2357, + b as c2358, + b as c2359, + b as c2360, + b as c2361, + b as c2362, + b as c2363, + b as c2364, + b as c2365, + b as c2366, + b as c2367, + b as c2368, + b as c2369, + b as c2370, + b as c2371, + b as c2372, + b as c2373, + b as c2374, + b as c2375, + b as c2376, + b as c2377, + b as c2378, + b as c2379, + b as c2380, + b as c2381, + b as c2382, + b as c2383, + b as c2384, + b as c2385, + b as c2386, + b as c2387, + b as c2388, + b as c2389, + b as c2390, + b as c2391, + b as c2392, + b as c2393, + b as c2394, + b as c2395, + b as c2396, + b as c2397, + b as c2398, + b as c2399, + b as c2400, + b as c2401, + b as c2402, + b as c2403, + b as c2404, + b as c2405, + b as c2406, + b as c2407, + b as c2408, + b as c2409, + b as c2410, + b as c2411, + b as c2412, + b as c2413, + b as c2414, + b as c2415, + b as c2416, + b as c2417, + b as c2418, + b as c2419, + b as c2420, + b as c2421, + b as c2422, + b as c2423, + b as c2424, + b as c2425, + b as c2426, + b as c2427, + b as c2428, + b as c2429, + b as c2430, + b as c2431, + b as c2432, + b as c2433, + b as c2434, + b as c2435, + b as c2436, + b as c2437, + b as c2438, + b as c2439, + b as c2440, + b as c2441, + b as c2442, + b as c2443, + b as c2444, + b as c2445, + b as c2446, + b as c2447, + b as c2448, + b as c2449, + b as c2450, + b as c2451, + b as c2452, + b as c2453, + b as c2454, + b as c2455, + b as c2456, + b as c2457, + b as c2458, + b as c2459, + b as c2460, + b as c2461, + b as c2462, + b as c2463, + b as c2464, + b as c2465, + b as c2466, + b as c2467, + b as c2468, + b as c2469, + b as c2470, + b as c2471, + b as c2472, + b as c2473, + b as c2474, + b as c2475, + b as c2476, + b as c2477, + b as c2478, + b as c2479, + b as c2480, + b as c2481, + b as c2482, + b as c2483, + b as c2484, + b as c2485, + b as c2486, + b as c2487, + b as c2488, + b as c2489, + b as c2490, + b as c2491, + b as c2492, + b as c2493, + b as c2494, + b as c2495, + b as c2496, + b as c2497, + b as c2498, + b as c2499, + b as c2500, + b as c2501, + b as c2503, + b as c2504, + b as c2505, + b as c2506, + b as c2507, + b as c2508, + b as c2509, + b as c2510, + b as c2511, + b as c2512, + b as c2513, + b as c2514, + b as c2515, + b as c2516, + b as c2517, + b as c2518, + b as c2519, + b as c2520, + b as c2521, + b as c2522, + b as c2523, + b as c2524, + b as c2525, + b as c2526, + b as c2527, + b as c2528, + b as c2529, + b as c2530, + b as c2531, + b as c2532, + b as c2533, + b as c2534, + b as c2535, + b as c2536, + b as c2537, + b as c2538, + b as c2539, + b as c2540, + b as c2541, + b as c2542, + b as c2543, + b as c2544, + b as c2545, + b as c2546, + b as c2547, + b as c2548, + b as c2549, + b as c2550, + b as c2551, + b as c2552, + b as c2553, + b as c2554, + b as c2555, + b as c2556, + b as c2557, + b as c2558, + b as c2559, + b as c2560, + b as c2561, + b as c2562, + b as c2563, + b as c2564, + b as c2565, + b as c2566, + b as c2567, + b as c2568, + b as c2569, + b as c2570, + b as c2571, + b as c2572, + b as c2573, + b as c2574, + b as c2575, + b as c2576, + b as c2577, + b as c2578, + b as c2579, + b as c2580, + b as c2581, + b as c2582, + b as c2583, + b as c2584, + b as c2585, + b as c2586, + b as c2587, + b as c2588, + b as c2589, + b as c2590, + b as c2591, + b as c2592, + b as c2593, + b as c2594, + b as c2595, + b as c2596, + b as c2597, + b as c2598, + b as c2599, + b as c2600, + b as c2601, + b as c2602, + b as c2603, + b as c2604, + b as c2605, + b as c2606, + b as c2607, + b as c2608, + b as c2609, + b as c2610, + b as c2611, + b as c2612, + b as c2613, + b as c2614, + b as c2615, + b as c2616, + b as c2617, + b as c2618, + b as c2619, + b as c2620, + b as c2621, + b as c2622, + b as c2623, + b as c2624, + b as c2626 + from t1 + ) as tt1; +drop table t1; diff --git a/mysql-test/main/trigger-compat.result b/mysql-test/main/trigger-compat.result index 387d4fb148983..cb2970890f1b5 100644 --- a/mysql-test/main/trigger-compat.result +++ b/mysql-test/main/trigger-compat.result @@ -142,3 +142,298 @@ DROP TRIGGER tr12; DROP TRIGGER tr11; DROP TABLE t1; DROP TABLE t2; +# +# MDEV-25659 trigger name is empty after upgrade to 10.4 +# +# START: Total triggers 1, broken triggers 1, DROP TABLE +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); +FLUSH TABLES; +DELETE FROM t1 WHERE a=1; +ERROR 42000: Trigger 'tr1' has an error in its body: 'Undeclared variable: unknown_variable' +INSERT INTO t1 VALUES (2); +ERROR 42000: Trigger 'tr1' has an error in its body: 'Undeclared variable: unknown_variable' +SET time_zone='+00:00'; +SHOW TRIGGERS LIKE 't1'; +Trigger tr1 +Event DELETE +Table t1 +Statement CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW +BEGIN + IF unknown_variable + THEN + INSERT INTO t2 VALUES (OLD.a); + END IF; +END +Timing AFTER +Created 2022-01-13 08:23:06.47 +sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +Definer +character_set_client utf8mb3 +collation_connection utf8mb3_general_ci +Database Collation latin1_swedish_ci +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='tr1'; +TRIGGER_CATALOG def +TRIGGER_SCHEMA test +TRIGGER_NAME tr1 +EVENT_MANIPULATION DELETE +EVENT_OBJECT_CATALOG def +EVENT_OBJECT_SCHEMA test +EVENT_OBJECT_TABLE t1 +ACTION_ORDER 1 +ACTION_CONDITION NULL +ACTION_STATEMENT CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW +BEGIN + IF unknown_variable + THEN + INSERT INTO t2 VALUES (OLD.a); + END IF; +END +ACTION_ORIENTATION ROW +ACTION_TIMING AFTER +ACTION_REFERENCE_OLD_TABLE NULL +ACTION_REFERENCE_NEW_TABLE NULL +ACTION_REFERENCE_OLD_ROW OLD +ACTION_REFERENCE_NEW_ROW NEW +CREATED 2022-01-13 08:23:06.47 +SQL_MODE STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +DEFINER +CHARACTER_SET_CLIENT utf8mb3 +COLLATION_CONNECTION utf8mb3_general_ci +DATABASE_COLLATION latin1_swedish_ci +SET time_zone=DEFAULT; +# Listing trigger files +t1.TRG +tr1.TRN +# Listing trigger files done +DROP TABLE t1; +# Listing trigger files +# Listing trigger files done +# END: Total triggers 1, broken triggers 1, DROP TABLE +# START: Total triggers 1, broken triggers 1, DROP TRIGGER +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); +FLUSH TABLES; +DELETE FROM t1 WHERE a=1; +ERROR 42000: Trigger 'tr1' has an error in its body: 'Undeclared variable: unknown_variable' +INSERT INTO t1 VALUES (2); +ERROR 42000: Trigger 'tr1' has an error in its body: 'Undeclared variable: unknown_variable' +SET time_zone='+00:00'; +SHOW TRIGGERS LIKE 't1'; +Trigger tr1 +Event DELETE +Table t1 +Statement CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW +BEGIN + IF unknown_variable + THEN + INSERT INTO t2 VALUES (OLD.a); + END IF; +END +Timing AFTER +Created 2022-01-13 08:23:06.47 +sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +Definer +character_set_client utf8mb3 +collation_connection utf8mb3_general_ci +Database Collation latin1_swedish_ci +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='tr1'; +TRIGGER_CATALOG def +TRIGGER_SCHEMA test +TRIGGER_NAME tr1 +EVENT_MANIPULATION DELETE +EVENT_OBJECT_CATALOG def +EVENT_OBJECT_SCHEMA test +EVENT_OBJECT_TABLE t1 +ACTION_ORDER 1 +ACTION_CONDITION NULL +ACTION_STATEMENT CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW +BEGIN + IF unknown_variable + THEN + INSERT INTO t2 VALUES (OLD.a); + END IF; +END +ACTION_ORIENTATION ROW +ACTION_TIMING AFTER +ACTION_REFERENCE_OLD_TABLE NULL +ACTION_REFERENCE_NEW_TABLE NULL +ACTION_REFERENCE_OLD_ROW OLD +ACTION_REFERENCE_NEW_ROW NEW +CREATED 2022-01-13 08:23:06.47 +SQL_MODE STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +DEFINER +CHARACTER_SET_CLIENT utf8mb3 +COLLATION_CONNECTION utf8mb3_general_ci +DATABASE_COLLATION latin1_swedish_ci +SET time_zone=DEFAULT; +# Listing trigger files +t1.TRG +tr1.TRN +# Listing trigger files done +DROP TRIGGER tr1; +# Listing trigger files +# Listing trigger files done +DROP TABLE t1; +# END: Total triggers 1, broken triggers 1, DROP TRIGGER +# START: Total triggers 2, broken triggers 1, DROP TABLE +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); +FLUSH TABLES; +DELETE FROM t1 WHERE a=1; +ERROR 42000: Trigger 'tr1' has an error in its body: 'Undeclared variable: unknown_variable' +INSERT INTO t1 VALUES (2); +ERROR 42000: Trigger 'tr1' has an error in its body: 'Undeclared variable: unknown_variable' +SET time_zone='+00:00'; +SHOW TRIGGERS LIKE 't1'; +Trigger tr2 +Event INSERT +Table t1 +Statement INSERT INTO t2 VALUES (NEW.a+100) +Timing AFTER +Created 2022-01-13 10:01:48.74 +sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +Definer root@localhost +character_set_client utf8mb3 +collation_connection utf8mb3_general_ci +Database Collation latin1_swedish_ci +Trigger tr1 +Event DELETE +Table t1 +Statement CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW +BEGIN + IF unknown_variable + THEN + INSERT INTO t2 VALUES (OLD.a); + END IF; +END +Timing AFTER +Created 2022-01-13 10:01:48.73 +sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +Definer +character_set_client utf8mb3 +collation_connection utf8mb3_general_ci +Database Collation latin1_swedish_ci +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='tr1'; +TRIGGER_CATALOG def +TRIGGER_SCHEMA test +TRIGGER_NAME tr1 +EVENT_MANIPULATION DELETE +EVENT_OBJECT_CATALOG def +EVENT_OBJECT_SCHEMA test +EVENT_OBJECT_TABLE t1 +ACTION_ORDER 1 +ACTION_CONDITION NULL +ACTION_STATEMENT CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW +BEGIN + IF unknown_variable + THEN + INSERT INTO t2 VALUES (OLD.a); + END IF; +END +ACTION_ORIENTATION ROW +ACTION_TIMING AFTER +ACTION_REFERENCE_OLD_TABLE NULL +ACTION_REFERENCE_NEW_TABLE NULL +ACTION_REFERENCE_OLD_ROW OLD +ACTION_REFERENCE_NEW_ROW NEW +CREATED 2022-01-13 10:01:48.73 +SQL_MODE STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +DEFINER +CHARACTER_SET_CLIENT utf8mb3 +COLLATION_CONNECTION utf8mb3_general_ci +DATABASE_COLLATION latin1_swedish_ci +SET time_zone=DEFAULT; +# Listing trigger files +t1.TRG +tr1.TRN +tr2.TRN +# Listing trigger files done +DROP TABLE t1; +# Listing trigger files +# Listing trigger files done +# END: Total triggers 2, broken triggers 1, using DROP TABLE +# START: Total triggers 2, broken triggers 1, DROP TRIGGER +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); +FLUSH TABLES; +DELETE FROM t1 WHERE a=1; +ERROR 42000: Trigger 'tr1' has an error in its body: 'Undeclared variable: unknown_variable' +INSERT INTO t1 VALUES (2); +ERROR 42000: Trigger 'tr1' has an error in its body: 'Undeclared variable: unknown_variable' +SET time_zone='+00:00'; +SHOW TRIGGERS LIKE 't1'; +Trigger tr2 +Event INSERT +Table t1 +Statement INSERT INTO t2 VALUES (NEW.a+100) +Timing AFTER +Created 2022-01-13 10:01:48.74 +sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +Definer root@localhost +character_set_client utf8mb3 +collation_connection utf8mb3_general_ci +Database Collation latin1_swedish_ci +Trigger tr1 +Event DELETE +Table t1 +Statement CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW +BEGIN + IF unknown_variable + THEN + INSERT INTO t2 VALUES (OLD.a); + END IF; +END +Timing AFTER +Created 2022-01-13 10:01:48.73 +sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +Definer +character_set_client utf8mb3 +collation_connection utf8mb3_general_ci +Database Collation latin1_swedish_ci +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='tr1'; +TRIGGER_CATALOG def +TRIGGER_SCHEMA test +TRIGGER_NAME tr1 +EVENT_MANIPULATION DELETE +EVENT_OBJECT_CATALOG def +EVENT_OBJECT_SCHEMA test +EVENT_OBJECT_TABLE t1 +ACTION_ORDER 1 +ACTION_CONDITION NULL +ACTION_STATEMENT CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW +BEGIN + IF unknown_variable + THEN + INSERT INTO t2 VALUES (OLD.a); + END IF; +END +ACTION_ORIENTATION ROW +ACTION_TIMING AFTER +ACTION_REFERENCE_OLD_TABLE NULL +ACTION_REFERENCE_NEW_TABLE NULL +ACTION_REFERENCE_OLD_ROW OLD +ACTION_REFERENCE_NEW_ROW NEW +CREATED 2022-01-13 10:01:48.73 +SQL_MODE STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +DEFINER +CHARACTER_SET_CLIENT utf8mb3 +COLLATION_CONNECTION utf8mb3_general_ci +DATABASE_COLLATION latin1_swedish_ci +SET time_zone=DEFAULT; +# Listing trigger files +t1.TRG +tr1.TRN +tr2.TRN +# Listing trigger files done +DROP TRIGGER tr1; +# Listing trigger files +t1.TRG +tr2.TRN +# Listing trigger files done +INSERT INTO t1 VALUES (100); +ERROR 42S02: Table 'test.t2' doesn't exist +DROP TABLE t1; +# Listing trigger files +# Listing trigger files done +# END: Total triggers 2, broken triggers 1, using DROP TRIGGER diff --git a/mysql-test/main/trigger-compat.test b/mysql-test/main/trigger-compat.test index baf3cad11d60e..4d9160c772826 100644 --- a/mysql-test/main/trigger-compat.test +++ b/mysql-test/main/trigger-compat.test @@ -289,3 +289,219 @@ DROP TRIGGER tr11; DROP TABLE t1; DROP TABLE t2; + + +--echo # +--echo # MDEV-25659 trigger name is empty after upgrade to 10.4 +--echo # + +--echo # START: Total triggers 1, broken triggers 1, DROP TABLE + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); + +--write_file $MYSQLD_DATADIR/test/tr1.TRN +TYPE=TRIGGERNAME +trigger_table=t1 +EOF + +--write_file $MYSQLD_DATADIR/test/t1.TRG +TYPE=TRIGGERS +triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW\nBEGIN\n IF unknown_variable\n THEN\n INSERT INTO t2 VALUES (OLD.a);\n END IF;\nEND' +sql_modes=1411383296 +definers='root@localhost' +client_cs_names='utf8' +connection_cl_names='utf8_general_ci' +db_cl_names='latin1_swedish_ci' +created=164206218647 +EOF + +FLUSH TABLES; +--error ER_PARSE_ERROR +DELETE FROM t1 WHERE a=1; +--error ER_PARSE_ERROR +INSERT INTO t1 VALUES (2); + +SET time_zone='+00:00'; +--vertical_results +SHOW TRIGGERS LIKE 't1'; +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='tr1'; +--horizontal_results +SET time_zone=DEFAULT; + +--echo # Listing trigger files +--list_files $MYSQLD_DATADIR/test *.TR? +--echo # Listing trigger files done + +DROP TABLE t1; + +--echo # Listing trigger files +--list_files $MYSQLD_DATADIR/test *.TR? +--echo # Listing trigger files done + +--echo # END: Total triggers 1, broken triggers 1, DROP TABLE + + +--echo # START: Total triggers 1, broken triggers 1, DROP TRIGGER + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); + +--write_file $MYSQLD_DATADIR/test/tr1.TRN +TYPE=TRIGGERNAME +trigger_table=t1 +EOF + +--write_file $MYSQLD_DATADIR/test/t1.TRG +TYPE=TRIGGERS +triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW\nBEGIN\n IF unknown_variable\n THEN\n INSERT INTO t2 VALUES (OLD.a);\n END IF;\nEND' +sql_modes=1411383296 +definers='root@localhost' +client_cs_names='utf8' +connection_cl_names='utf8_general_ci' +db_cl_names='latin1_swedish_ci' +created=164206218647 +EOF + +FLUSH TABLES; +--error ER_PARSE_ERROR +DELETE FROM t1 WHERE a=1; +--error ER_PARSE_ERROR +INSERT INTO t1 VALUES (2); + +SET time_zone='+00:00'; +--vertical_results +SHOW TRIGGERS LIKE 't1'; +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='tr1'; +--horizontal_results +SET time_zone=DEFAULT; + +--echo # Listing trigger files +--list_files $MYSQLD_DATADIR/test *.TR? +--echo # Listing trigger files done + +DROP TRIGGER tr1; + +--echo # Listing trigger files +--list_files $MYSQLD_DATADIR/test *.TR? +--echo # Listing trigger files done + +DROP TABLE t1; + +--echo # END: Total triggers 1, broken triggers 1, DROP TRIGGER + + +--echo # START: Total triggers 2, broken triggers 1, DROP TABLE + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); + +--write_file $MYSQLD_DATADIR/test/tr1.TRN +TYPE=TRIGGERNAME +trigger_table=t1 +EOF + +--write_file $MYSQLD_DATADIR/test/tr2.TRN +TYPE=TRIGGERNAME +trigger_table=t1 +EOF + +--write_file $MYSQLD_DATADIR/test/t1.TRG +TYPE=TRIGGERS +triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr2 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NEW.a+100)' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW\nBEGIN\n IF unknown_variable\n THEN\n INSERT INTO t2 VALUES (OLD.a);\n END IF;\nEND' +sql_modes=1411383296 1411383296 +definers='root@localhost' 'root@localhost' +client_cs_names='utf8' 'utf8' +connection_cl_names='utf8_general_ci' 'utf8_general_ci' +db_cl_names='latin1_swedish_ci' 'latin1_swedish_ci' +created=164206810874 164206810873 +EOF + +FLUSH TABLES; +--error ER_PARSE_ERROR +DELETE FROM t1 WHERE a=1; +--error ER_PARSE_ERROR +INSERT INTO t1 VALUES (2); + +SET time_zone='+00:00'; +--vertical_results +SHOW TRIGGERS LIKE 't1'; +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='tr1'; +--horizontal_results +SET time_zone=DEFAULT; + +--echo # Listing trigger files +--list_files $MYSQLD_DATADIR/test *.TR? +--echo # Listing trigger files done + +DROP TABLE t1; + +--echo # Listing trigger files +--list_files $MYSQLD_DATADIR/test *.TR? +--echo # Listing trigger files done + +--echo # END: Total triggers 2, broken triggers 1, using DROP TABLE + + +--echo # START: Total triggers 2, broken triggers 1, DROP TRIGGER + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); + +--write_file $MYSQLD_DATADIR/test/tr1.TRN +TYPE=TRIGGERNAME +trigger_table=t1 +EOF + +--write_file $MYSQLD_DATADIR/test/tr2.TRN +TYPE=TRIGGERNAME +trigger_table=t1 +EOF + +--write_file $MYSQLD_DATADIR/test/t1.TRG +TYPE=TRIGGERS +triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr2 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NEW.a+100)' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW\nBEGIN\n IF unknown_variable\n THEN\n INSERT INTO t2 VALUES (OLD.a);\n END IF;\nEND' +sql_modes=1411383296 1411383296 +definers='root@localhost' 'root@localhost' +client_cs_names='utf8' 'utf8' +connection_cl_names='utf8_general_ci' 'utf8_general_ci' +db_cl_names='latin1_swedish_ci' 'latin1_swedish_ci' +created=164206810874 164206810873 +EOF + +FLUSH TABLES; +--error ER_PARSE_ERROR +DELETE FROM t1 WHERE a=1; +--error ER_PARSE_ERROR +INSERT INTO t1 VALUES (2); + +SET time_zone='+00:00'; +--vertical_results +SHOW TRIGGERS LIKE 't1'; +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='tr1'; +--horizontal_results +SET time_zone=DEFAULT; + +--echo # Listing trigger files +--list_files $MYSQLD_DATADIR/test *.TR? +--echo # Listing trigger files done + +DROP TRIGGER tr1; + +--echo # Listing trigger files +--list_files $MYSQLD_DATADIR/test *.TR? +--echo # Listing trigger files done + +# Now we dropped the broken trigger. Make sure the good one is fired. +# If everything goes as expected, it will try to insert into t2, +# which does not exists, hence the (expected) error. +--error ER_NO_SUCH_TABLE +INSERT INTO t1 VALUES (100); + +DROP TABLE t1; + +--echo # Listing trigger files +--list_files $MYSQLD_DATADIR/test *.TR? +--echo # Listing trigger files done + +--echo # END: Total triggers 2, broken triggers 1, using DROP TRIGGER diff --git a/mysql-test/main/trigger.result b/mysql-test/main/trigger.result index 8065f7f5ac401..410c5a53ce218 100644 --- a/mysql-test/main/trigger.result +++ b/mysql-test/main/trigger.result @@ -319,7 +319,7 @@ drop table t1; drop table t3; create temporary table t1 (i int); create trigger trg before insert on t1 for each row set @a:=1; -ERROR HY000: Trigger's 't1' is view or temporary table +ERROR HY000: Trigger's 't1' is a view, temporary table or sequence drop table t1; create table t1 (x1col char); create trigger tx1 before insert on t1 for each row set new.x1col = 'x'; @@ -635,7 +635,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show triggers; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation t1_bi INSERT t1 set new.a = '2004-01-00' BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci @@ -967,7 +967,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop trigger test.t1_bi; ERROR HY000: Trigger does not exist drop trigger t1_bi; @@ -2431,6 +2431,13 @@ CREATE TRIGGER t1_trigger BEFORE INSERT ON t1 FOR EACH ROW BEGIN END; INSERT INTO t1 () VALUES (); DROP TABLE t1; # +# Bug#33141958 - THE FIRST ASAN UAF ISSUE OF MYSQL SERVER +# +create table t1 (a int); +create trigger tr1 after insert on t1 for each row alter table t1 tablespace s2; +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger +drop table t1; +# # End of 10.2 tests # # diff --git a/mysql-test/main/trigger.test b/mysql-test/main/trigger.test index 42b690a892191..466e9b8f3e5a6 100644 --- a/mysql-test/main/trigger.test +++ b/mysql-test/main/trigger.test @@ -1,6 +1,7 @@ # This test uses chmod, can't be run with root permissions -- source include/not_as_root.inc ---source include/default_charset.inc +-- source include/no_valgrind_without_big.inc +-- source include/default_charset.inc # # Basic triggers test @@ -1082,6 +1083,7 @@ drop trigger t1_ai; drop table t4; # Rename between different databases if triggers exist should fail create database mysqltest; +--disable_service_connection use mysqltest; create table t1 (id int); create trigger t1_bi before insert on t1 for each row set @a:=new.id; @@ -1097,6 +1099,7 @@ select @a; select trigger_schema, trigger_name, event_object_schema, event_object_table, action_statement from information_schema.triggers where event_object_schema = 'test' or event_object_schema = 'mysqltest'; +--enable_service_connection # There should be no fantom .TRN files --error ER_TRG_DOES_NOT_EXIST drop trigger test.t1_bi; @@ -2762,6 +2765,14 @@ CREATE TRIGGER t1_trigger BEFORE INSERT ON t1 FOR EACH ROW BEGIN END; INSERT INTO t1 () VALUES (); DROP TABLE t1; +--echo # +--echo # Bug#33141958 - THE FIRST ASAN UAF ISSUE OF MYSQL SERVER +--echo # +create table t1 (a int); +--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +create trigger tr1 after insert on t1 for each row alter table t1 tablespace s2; +drop table t1; + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/trigger_notembedded.result b/mysql-test/main/trigger_notembedded.result index e276ddd1e48c2..41547ac1e99ed 100644 --- a/mysql-test/main/trigger_notembedded.result +++ b/mysql-test/main/trigger_notembedded.result @@ -23,7 +23,7 @@ connection wl2818_definer_con; CREATE TRIGGER trg1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(CURRENT_USER()); -ERROR 42000: TRIGGER command denied to user 'mysqltest_dfn'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'mysqltest_dfn'@'localhost' for table `mysqltest_db1`.`t1` disconnect wl2818_definer_con; connection default; GRANT TRIGGER ON mysqltest_db1.t1 TO mysqltest_dfn@localhost; @@ -38,12 +38,12 @@ REVOKE TRIGGER ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost; connect wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1; connection wl2818_definer_con; DROP TRIGGER trg1; -ERROR 42000: TRIGGER command denied to user 'mysqltest_dfn'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'mysqltest_dfn'@'localhost' for table `mysqltest_db1`.`t1` disconnect wl2818_definer_con; connect wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1; connection wl2818_definer_con; INSERT INTO t1 VALUES(0); -ERROR 42000: TRIGGER command denied to user 'mysqltest_dfn'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'mysqltest_dfn'@'localhost' for table `mysqltest_db1`.`t1` disconnect wl2818_definer_con; connection default; GRANT TRIGGER ON mysqltest_db1.t1 TO mysqltest_dfn@localhost; @@ -95,7 +95,7 @@ REVOKE INSERT ON mysqltest_db1.t2 FROM mysqltest_dfn@localhost; connection wl2818_invoker_con; use mysqltest_db1; INSERT INTO t1 VALUES(3); -ERROR 42000: INSERT command denied to user 'mysqltest_dfn'@'localhost' for table 't2' +ERROR 42000: INSERT command denied to user 'mysqltest_dfn'@'localhost' for table `mysqltest_db1`.`t2` SELECT * FROM t1; num_value 1 @@ -563,7 +563,7 @@ INSERT INTO t2 VALUES (2); connection default; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; UPDATE IGNORE t1, t2 SET t1.a1 = 2, t2.a1 = 3 WHERE t1.a1 = 1 AND t2.a1 = 2; -ERROR 42000: TRIGGER command denied to user 'mysqltest_u1'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`t1` DROP DATABASE mysqltest_db1; DROP USER mysqltest_u1@localhost; disconnect con1; diff --git a/mysql-test/main/trigger_wl3253.result b/mysql-test/main/trigger_wl3253.result index bd2d250cb2fcd..ed08b336c19a8 100644 --- a/mysql-test/main/trigger_wl3253.result +++ b/mysql-test/main/trigger_wl3253.result @@ -314,7 +314,7 @@ CREATE TRIGGER tr1_bu BEFORE UPDATE ON t1 FOR EACH ROW SET @a:=3; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -376,7 +376,7 @@ CREATE TRIGGER tr1_1_bi BEFORE INSERT ON t1 FOR EACH ROW FOLLOWS tr1_bi SET @a:= /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; diff --git a/mysql-test/main/truncate.test b/mysql-test/main/truncate.test index 9e28deacf63cc..592c234a367fd 100644 --- a/mysql-test/main/truncate.test +++ b/mysql-test/main/truncate.test @@ -69,6 +69,9 @@ drop table t1; --echo # --echo # Bug#20667 - Truncate table fails for a write locked table --echo # + +--disable_service_connection + CREATE TABLE t1 (c1 INT); LOCK TABLE t1 WRITE; INSERT INTO t1 VALUES (1); @@ -137,6 +140,8 @@ TRUNCATE p1; SHOW CREATE PROCEDURE p1; DROP PROCEDURE p1; +--enable_service_connection + --echo # --echo # Bug#46452 Crash in MDL, HANDLER OPEN + TRUNCATE TABLE --echo # diff --git a/mysql-test/main/truncate_notembedded.result b/mysql-test/main/truncate_notembedded.result index cf6498427d05f..e8bf6c2575bfe 100644 --- a/mysql-test/main/truncate_notembedded.result +++ b/mysql-test/main/truncate_notembedded.result @@ -13,7 +13,7 @@ a UNLOCK TABLES; connection con1; TRUNCATE TABLE t1; -ERROR HY000: The MariaDB server is running with the --max-thread-mem-used=8192 option so it cannot execute this statement +ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement disconnect con1; connection default; DROP TABLE t1; diff --git a/mysql-test/main/truncate_notembedded.test b/mysql-test/main/truncate_notembedded.test index 70da48f5a4f9c..764a353ad34d3 100644 --- a/mysql-test/main/truncate_notembedded.test +++ b/mysql-test/main/truncate_notembedded.test @@ -5,6 +5,7 @@ --echo # is_bulk_op())' failed upon killed TRUNCATE --echo # +--disable_service_connection CREATE TABLE t1 (a INT) ENGINE=MyISAM; LOCK TABLE t1 READ; @@ -26,6 +27,7 @@ TRUNCATE TABLE t1; --disconnect con1 --connection default DROP TABLE t1; +--enable_service_connection --echo # --echo # End of 10.2 tests diff --git a/mysql-test/main/type_binary.result b/mysql-test/main/type_binary.result index 76dab6e4e936d..ca0495e38994d 100644 --- a/mysql-test/main/type_binary.result +++ b/mysql-test/main/type_binary.result @@ -23,7 +23,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `s1` varbinary(20) DEFAULT NULL, `s2` varbinary(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (0x41,0x4100),(0x41,0x4120),(0x4100,0x4120); select hex(s1), hex(s2) from t1; hex(s1) hex(s2) diff --git a/mysql-test/main/type_binary.test b/mysql-test/main/type_binary.test index 9f7a0db66d5e9..04cdc94e6d885 100644 --- a/mysql-test/main/type_binary.test +++ b/mysql-test/main/type_binary.test @@ -135,6 +135,7 @@ DROP TABLE t1; --echo # CREATE TABLE t1 (a VARCHAR(39)); +--disable_view_protocol --enable_metadata SELECT CAST(a AS BINARY(0)), @@ -153,4 +154,5 @@ SELECT CAST(a AS BINARY(16777216)) FROM t1; --disable_metadata +--enable_view_protocol DROP TABLE t1; diff --git a/mysql-test/main/type_bit.result b/mysql-test/main/type_bit.result index f44bdf70c4a56..e051a52d56a19 100644 --- a/mysql-test/main/type_bit.result +++ b/mysql-test/main/type_bit.result @@ -42,7 +42,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bit(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a bit(64)); insert into t1 values @@ -497,7 +497,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` bit(7) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1 (id1 int(11), b1 bit(1)); create table t2 (id2 int(11), b2 bit(1)); @@ -792,7 +792,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bit(8) DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # # Bug#50591 bit(31) causes Duplicate entry '1-NULL' for key 'group_key' @@ -826,7 +826,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c` decimal(1,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SELECT COALESCE(val, 1) FROM t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -907,7 +907,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(1) unsigned DEFAULT NULL, `cr` int(1) unsigned DEFAULT NULL, `ct` int(1) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 1 cf 1 cc 1 @@ -922,7 +922,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(1) unsigned DEFAULT NULL, `cr` int(1) unsigned DEFAULT NULL, `ct` int(1) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 3 cf 3 cc 3 @@ -937,7 +937,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(1) unsigned DEFAULT NULL, `cr` int(1) unsigned DEFAULT NULL, `ct` int(1) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 7 cf 7 cc 7 @@ -952,7 +952,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(2) unsigned DEFAULT NULL, `cr` int(2) unsigned DEFAULT NULL, `ct` int(2) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 15 cf 15 cc 15 @@ -967,7 +967,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(2) unsigned DEFAULT NULL, `cr` int(2) unsigned DEFAULT NULL, `ct` int(2) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 31 cf 31 cc 31 @@ -982,7 +982,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(2) unsigned DEFAULT NULL, `cr` int(2) unsigned DEFAULT NULL, `ct` int(2) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 63 cf 63 cc 63 @@ -997,7 +997,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(3) unsigned DEFAULT NULL, `cr` int(3) unsigned DEFAULT NULL, `ct` int(3) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 127 cf 127 cc 127 @@ -1012,7 +1012,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(3) unsigned DEFAULT NULL, `cr` int(3) unsigned DEFAULT NULL, `ct` int(3) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 255 cf 255 cc 255 @@ -1027,7 +1027,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(3) unsigned DEFAULT NULL, `cr` int(3) unsigned DEFAULT NULL, `ct` int(3) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 511 cf 511 cc 511 @@ -1042,7 +1042,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(4) unsigned DEFAULT NULL, `cr` int(4) unsigned DEFAULT NULL, `ct` int(4) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 1023 cf 1023 cc 1023 @@ -1057,7 +1057,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(4) unsigned DEFAULT NULL, `cr` int(4) unsigned DEFAULT NULL, `ct` int(4) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 2047 cf 2047 cc 2047 @@ -1072,7 +1072,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(4) unsigned DEFAULT NULL, `cr` int(4) unsigned DEFAULT NULL, `ct` int(4) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 4095 cf 4095 cc 4095 @@ -1087,7 +1087,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(4) unsigned DEFAULT NULL, `cr` int(4) unsigned DEFAULT NULL, `ct` int(4) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 8191 cf 8191 cc 8191 @@ -1102,7 +1102,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(5) unsigned DEFAULT NULL, `cr` int(5) unsigned DEFAULT NULL, `ct` int(5) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 16383 cf 16383 cc 16383 @@ -1117,7 +1117,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(5) unsigned DEFAULT NULL, `cr` int(5) unsigned DEFAULT NULL, `ct` int(5) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 32767 cf 32767 cc 32767 @@ -1132,7 +1132,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(5) unsigned DEFAULT NULL, `cr` int(5) unsigned DEFAULT NULL, `ct` int(5) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 65535 cf 65535 cc 65535 @@ -1147,7 +1147,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(6) unsigned DEFAULT NULL, `cr` int(6) unsigned DEFAULT NULL, `ct` int(6) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 131071 cf 131071 cc 131071 @@ -1162,7 +1162,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(6) unsigned DEFAULT NULL, `cr` int(6) unsigned DEFAULT NULL, `ct` int(6) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 262143 cf 262143 cc 262143 @@ -1177,7 +1177,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(6) unsigned DEFAULT NULL, `cr` int(6) unsigned DEFAULT NULL, `ct` int(6) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 524287 cf 524287 cc 524287 @@ -1192,7 +1192,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(7) unsigned DEFAULT NULL, `cr` int(7) unsigned DEFAULT NULL, `ct` int(7) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 1048575 cf 1048575 cc 1048575 @@ -1207,7 +1207,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(7) unsigned DEFAULT NULL, `cr` int(7) unsigned DEFAULT NULL, `ct` int(7) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 2097151 cf 2097151 cc 2097151 @@ -1222,7 +1222,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(7) unsigned DEFAULT NULL, `cr` int(7) unsigned DEFAULT NULL, `ct` int(7) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 4194303 cf 4194303 cc 4194303 @@ -1237,7 +1237,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(7) unsigned DEFAULT NULL, `cr` int(7) unsigned DEFAULT NULL, `ct` int(7) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 8388607 cf 8388607 cc 8388607 @@ -1252,7 +1252,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(8) unsigned DEFAULT NULL, `cr` int(8) unsigned DEFAULT NULL, `ct` int(8) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 16777215 cf 16777215 cc 16777215 @@ -1267,7 +1267,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(8) unsigned DEFAULT NULL, `cr` int(8) unsigned DEFAULT NULL, `ct` int(8) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 33554431 cf 33554431 cc 33554431 @@ -1282,7 +1282,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(8) unsigned DEFAULT NULL, `cr` int(8) unsigned DEFAULT NULL, `ct` int(8) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 67108863 cf 67108863 cc 67108863 @@ -1297,7 +1297,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(9) unsigned DEFAULT NULL, `cr` int(9) unsigned DEFAULT NULL, `ct` int(9) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 134217727 cf 134217727 cc 134217727 @@ -1312,7 +1312,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(9) unsigned DEFAULT NULL, `cr` int(9) unsigned DEFAULT NULL, `ct` int(9) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 268435455 cf 268435455 cc 268435455 @@ -1327,7 +1327,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(9) unsigned DEFAULT NULL, `cr` int(9) unsigned DEFAULT NULL, `ct` int(9) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 536870911 cf 536870911 cc 536870911 @@ -1342,7 +1342,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(10) unsigned DEFAULT NULL, `cr` int(10) unsigned DEFAULT NULL, `ct` int(10) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 1073741823 cf 1073741823 cc 1073741823 @@ -1357,7 +1357,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(10) unsigned DEFAULT NULL, `cr` int(10) unsigned DEFAULT NULL, `ct` int(10) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 2147483647 cf 2147483647 cc 2147483647 @@ -1372,7 +1372,7 @@ Create Table CREATE TABLE `t2` ( `cc` int(10) unsigned DEFAULT NULL, `cr` int(10) unsigned DEFAULT NULL, `ct` int(10) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 4294967295 cf 4294967295 cc 4294967295 @@ -1387,7 +1387,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(10) unsigned DEFAULT NULL, `cr` bigint(10) unsigned DEFAULT NULL, `ct` bigint(10) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 8589934591 cf 8589934591 cc 8589934591 @@ -1402,7 +1402,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(11) unsigned DEFAULT NULL, `cr` bigint(11) unsigned DEFAULT NULL, `ct` bigint(11) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 17179869183 cf 17179869183 cc 17179869183 @@ -1417,7 +1417,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(11) unsigned DEFAULT NULL, `cr` bigint(11) unsigned DEFAULT NULL, `ct` bigint(11) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 34359738367 cf 34359738367 cc 34359738367 @@ -1432,7 +1432,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(11) unsigned DEFAULT NULL, `cr` bigint(11) unsigned DEFAULT NULL, `ct` bigint(11) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 68719476735 cf 68719476735 cc 68719476735 @@ -1447,7 +1447,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(12) unsigned DEFAULT NULL, `cr` bigint(12) unsigned DEFAULT NULL, `ct` bigint(12) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 137438953471 cf 137438953471 cc 137438953471 @@ -1462,7 +1462,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(12) unsigned DEFAULT NULL, `cr` bigint(12) unsigned DEFAULT NULL, `ct` bigint(12) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 274877906943 cf 274877906943 cc 274877906943 @@ -1477,7 +1477,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(12) unsigned DEFAULT NULL, `cr` bigint(12) unsigned DEFAULT NULL, `ct` bigint(12) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 549755813887 cf 549755813887 cc 549755813887 @@ -1492,7 +1492,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(13) unsigned DEFAULT NULL, `cr` bigint(13) unsigned DEFAULT NULL, `ct` bigint(13) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 1099511627775 cf 1099511627775 cc 1099511627775 @@ -1507,7 +1507,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(13) unsigned DEFAULT NULL, `cr` bigint(13) unsigned DEFAULT NULL, `ct` bigint(13) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 2199023255551 cf 2199023255551 cc 2199023255551 @@ -1522,7 +1522,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(13) unsigned DEFAULT NULL, `cr` bigint(13) unsigned DEFAULT NULL, `ct` bigint(13) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 4398046511103 cf 4398046511103 cc 4398046511103 @@ -1537,7 +1537,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(13) unsigned DEFAULT NULL, `cr` bigint(13) unsigned DEFAULT NULL, `ct` bigint(13) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 8796093022207 cf 8796093022207 cc 8796093022207 @@ -1552,7 +1552,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(14) unsigned DEFAULT NULL, `cr` bigint(14) unsigned DEFAULT NULL, `ct` bigint(14) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 17592186044415 cf 17592186044415 cc 17592186044415 @@ -1567,7 +1567,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(14) unsigned DEFAULT NULL, `cr` bigint(14) unsigned DEFAULT NULL, `ct` bigint(14) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 35184372088831 cf 35184372088831 cc 35184372088831 @@ -1582,7 +1582,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(14) unsigned DEFAULT NULL, `cr` bigint(14) unsigned DEFAULT NULL, `ct` bigint(14) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 70368744177663 cf 70368744177663 cc 70368744177663 @@ -1597,7 +1597,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(15) unsigned DEFAULT NULL, `cr` bigint(15) unsigned DEFAULT NULL, `ct` bigint(15) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 140737488355327 cf 140737488355327 cc 140737488355327 @@ -1612,7 +1612,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(15) unsigned DEFAULT NULL, `cr` bigint(15) unsigned DEFAULT NULL, `ct` bigint(15) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 281474976710655 cf 281474976710655 cc 281474976710655 @@ -1627,7 +1627,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(15) unsigned DEFAULT NULL, `cr` bigint(15) unsigned DEFAULT NULL, `ct` bigint(15) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 562949953421311 cf 562949953421311 cc 562949953421311 @@ -1642,7 +1642,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(16) unsigned DEFAULT NULL, `cr` bigint(16) unsigned DEFAULT NULL, `ct` bigint(16) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 1125899906842623 cf 1125899906842623 cc 1125899906842623 @@ -1657,7 +1657,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(16) unsigned DEFAULT NULL, `cr` bigint(16) unsigned DEFAULT NULL, `ct` bigint(16) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 2251799813685247 cf 2251799813685247 cc 2251799813685247 @@ -1672,7 +1672,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(16) unsigned DEFAULT NULL, `cr` bigint(16) unsigned DEFAULT NULL, `ct` bigint(16) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 4503599627370495 cf 4503599627370495 cc 4503599627370495 @@ -1687,7 +1687,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(16) unsigned DEFAULT NULL, `cr` bigint(16) unsigned DEFAULT NULL, `ct` bigint(16) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9007199254740991 cf 9007199254740991 cc 9007199254740991 @@ -1702,7 +1702,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(17) unsigned DEFAULT NULL, `cr` bigint(17) unsigned DEFAULT NULL, `ct` bigint(17) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 18014398509481983 cf 18014398509481983 cc 18014398509481983 @@ -1717,7 +1717,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(17) unsigned DEFAULT NULL, `cr` bigint(17) unsigned DEFAULT NULL, `ct` bigint(17) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 36028797018963967 cf 36028797018963967 cc 36028797018963967 @@ -1732,7 +1732,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(17) unsigned DEFAULT NULL, `cr` bigint(17) unsigned DEFAULT NULL, `ct` bigint(17) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 72057594037927935 cf 72057594037927935 cc 72057594037927935 @@ -1747,7 +1747,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(18) unsigned DEFAULT NULL, `cr` bigint(18) unsigned DEFAULT NULL, `ct` bigint(18) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 144115188075855871 cf 144115188075855871 cc 144115188075855871 @@ -1762,7 +1762,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(18) unsigned DEFAULT NULL, `cr` bigint(18) unsigned DEFAULT NULL, `ct` bigint(18) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 288230376151711743 cf 288230376151711743 cc 288230376151711743 @@ -1777,7 +1777,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(18) unsigned DEFAULT NULL, `cr` bigint(18) unsigned DEFAULT NULL, `ct` bigint(18) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 576460752303423487 cf 576460752303423487 cc 576460752303423487 @@ -1792,7 +1792,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(19) unsigned DEFAULT NULL, `cr` bigint(19) unsigned DEFAULT NULL, `ct` bigint(19) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 1152921504606846975 cf 1152921504606846975 cc 1152921504606846975 @@ -1807,7 +1807,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(19) unsigned DEFAULT NULL, `cr` bigint(19) unsigned DEFAULT NULL, `ct` bigint(19) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 2305843009213693951 cf 2305843009213693951 cc 2305843009213693951 @@ -1822,7 +1822,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(19) unsigned DEFAULT NULL, `cr` bigint(19) unsigned DEFAULT NULL, `ct` bigint(19) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 4611686018427387903 cf 4611686018427387903 cc 4611686018427387903 @@ -1837,7 +1837,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(19) unsigned DEFAULT NULL, `cr` bigint(19) unsigned DEFAULT NULL, `ct` bigint(19) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 9223372036854775807 cf 9223372036854775807 cc 9223372036854775807 @@ -1852,7 +1852,7 @@ Create Table CREATE TABLE `t2` ( `cc` bigint(20) unsigned DEFAULT NULL, `cr` bigint(20) unsigned DEFAULT NULL, `ct` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 18446744073709551615 cf 18446744073709551615 cc 18446744073709551615 @@ -1878,7 +1878,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `MIN(CASE WHEN 0 THEN b END)` bigint(1) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # diff --git a/mysql-test/main/type_bit.test b/mysql-test/main/type_bit.test index 2e66c7fb7cd36..846fc34e2e989 100644 --- a/mysql-test/main/type_bit.test +++ b/mysql-test/main/type_bit.test @@ -234,7 +234,9 @@ drop table t1, t2; create table t1 (a bit(7)); insert into t1 values (0x60); --enable_metadata +--disable_view_protocol select * from t1; +--enable_view_protocol --disable_metadata drop table t1; @@ -297,10 +299,12 @@ DROP TABLE t1; CREATE TABLE t1 (b BIT); INSERT INTO t1 (b) VALUES (1), (0); --enable_metadata +--disable_view_protocol --replace_column 1 # SELECT DISTINCT b FROM t1; --replace_column 1 # SELECT b FROM t1 GROUP BY b; +--enable_view_protocol --disable_metadata DROP TABLE t1; @@ -456,7 +460,9 @@ SELECT * FROM t2; SHOW CREATE TABLE t2; DROP TABLE t2; --enable_metadata +--disable_view_protocol SELECT COALESCE(val, 1) FROM t1; +--enable_view_protocol --disable_metadata DROP TABLE t1; @@ -550,11 +556,13 @@ DELIMITER ;$$ --echo # CREATE TABLE t1 (b BIT(1)); +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT MIN(CASE WHEN 0 THEN b END) FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol CREATE TABLE t2 AS SELECT MIN(CASE WHEN 0 THEN b END) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t2; diff --git a/mysql-test/main/type_bit_innodb.result b/mysql-test/main/type_bit_innodb.result index a3ac23ebb71cf..67b4ff5567489 100644 --- a/mysql-test/main/type_bit_innodb.result +++ b/mysql-test/main/type_bit_innodb.result @@ -43,7 +43,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bit(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a bit(64)) engine=innodb; insert into t1 values @@ -389,21 +389,21 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bit(1) DEFAULT NULL, `b` bit(10) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 engine=heap; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bit(1) DEFAULT NULL, `b` bit(10) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 engine=innodb; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bit(1) DEFAULT NULL, `b` bit(10) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a bit(7)) engine=innodb; insert into t1 values (0x60); diff --git a/mysql-test/main/type_bit_innodb.test b/mysql-test/main/type_bit_innodb.test index 6317bbc3a2d22..5fc7c18824603 100644 --- a/mysql-test/main/type_bit_innodb.test +++ b/mysql-test/main/type_bit_innodb.test @@ -142,7 +142,9 @@ drop table t1; create table t1 (a bit(7)) engine=innodb; insert into t1 values (0x60); --enable_metadata +--disable_view_protocol select * from t1; +--enable_view_protocol --disable_metadata drop table t1; diff --git a/mysql-test/main/type_blob.result b/mysql-test/main/type_blob.result index c2739e4b16697..e5ffb898a937f 100644 --- a/mysql-test/main/type_blob.result +++ b/mysql-test/main/type_blob.result @@ -27,12 +27,12 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` mediumtext DEFAULT NULL, `b` mediumblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` mediumtext CHARACTER SET utf8mb3 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1,t2,t3,t4; CREATE TABLE t1 (a char(257) default "hello"); ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead @@ -46,13 +46,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext DEFAULT 'hello' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 (a blob default "hello"); SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` blob DEFAULT 'hello' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1,t2; create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr)); insert into t1 values (null,"a","A"); @@ -377,7 +377,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` text DEFAULT NULL, KEY `a` (`a`(1000)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 ( t1_id bigint(21) NOT NULL auto_increment, @@ -737,7 +737,7 @@ t1 CREATE TABLE `t1` ( `e` int(11) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`(255),`d`), KEY `a` (`a`,`b`,`d`,`e`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE table t1 (a blob); insert into t1 values ('b'),('a\0'),('a'),('a '),('aa'),(NULL); @@ -814,7 +814,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (default); select * from t1; a @@ -826,7 +826,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @@sql_mode=''; CREATE TABLE t (c TEXT CHARSET ASCII); @@ -912,7 +912,7 @@ SHOW CREATE TABLE b15776; Table Create Table b15776 CREATE TABLE `b15776` ( `a` year(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE b15776; CREATE TABLE b15776 (a year(0)); Warnings: @@ -939,7 +939,7 @@ SHOW CREATE TABLE b15776; Table Create Table b15776 CREATE TABLE `b15776` ( `a` year(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE b15776; CREATE TABLE b15776 select cast(null as char(4294967295)); show columns from b15776; @@ -1081,8 +1081,8 @@ CREATE TABLE t1 (a TEXT(1431655798) CHARACTER SET utf8); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` longtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; create table t1 (a int); alter table t1 add column b blob, alter column b set default "foo"; @@ -1091,7 +1091,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` blob DEFAULT 'foo' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # # End of 10.2 test diff --git a/mysql-test/main/type_date.result b/mysql-test/main/type_date.result index 950e2a7951abc..feac3295fafa6 100644 --- a/mysql-test/main/type_date.result +++ b/mysql-test/main/type_date.result @@ -1,4 +1,3 @@ -drop table if exists t1,t2; create table t1 (a char(16), b date, c datetime); insert into t1 SET a='test 2000-01-01', b='2000-01-01', c='2000-01-01'; select * from t1 where c = '2000-01-01'; @@ -885,7 +884,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP VIEW v1; DROP TABLE t1; @@ -1112,7 +1111,7 @@ t2 CREATE TABLE `t2` ( `CEIL(a)` int(8) unsigned DEFAULT NULL, `ROUND(a)` int(8) unsigned DEFAULT NULL, `TRUNCATE(a,0)` int(8) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2,t1; # # MDEV-23388 Assertion `args[0]->decimals == 0' failed in Item_func_round::fix_arg_int @@ -1141,9 +1140,27 @@ t2 CREATE TABLE `t2` ( `GREATEST(c_date,c_date)` date NOT NULL, `GREATEST(c_date,c_int)` date DEFAULT NULL, `GREATEST(c_int,c_date)` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # +# MDEV-29890 Update with inner join false row count result +# +set sql_mode='NO_ZERO_DATE'; +create table t1 (a1 bigint primary key, a2 date not null, a3 bigint not null); +create table t2 (b1 bigint primary key); +insert into t2 (b1) values (1); +insert into t1 (a1, a2, a3) values (1, current_date, 1),( 2, current_date, 1); +update t1 inner join t2 on t1.a3 = t2.b1 set t1.a2 = t1.a2 + interval 1 day; +select row_count(); +row_count() +2 +set sql_mode=''; +alter table t1 modify a2 date not null default '0000-00-00'; +set sql_mode='NO_ZERO_DATE'; +update t1 inner join t2 on t1.a3 = t2.b1 set t1.a2 = t1.a2 + interval 1 day; +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 1136062bb885e..cbc3c67bf64e0 100644 --- a/mysql-test/main/type_date.test +++ b/mysql-test/main/type_date.test @@ -1,10 +1,6 @@ # # test of problem with date fields # ---disable_warnings -drop table if exists t1,t2; ---enable_warnings - create table t1 (a char(16), b date, c datetime); insert into t1 SET a='test 2000-01-01', b='2000-01-01', c='2000-01-01'; select * from t1 where c = '2000-01-01'; @@ -78,6 +74,8 @@ drop table t1; # Test problem with DATE_FORMAT # +#enable after fix MDEV-27871 +--disable_view_protocol CREATE TABLE t1(AFIELD INT); INSERT INTO t1 VALUES(1); CREATE TABLE t2(GMT VARCHAR(32)); @@ -89,6 +87,7 @@ SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GM DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) FROM t1,t2 GROUP BY t1.AFIELD; drop table t1,t2; +--enable_view_protocol # # Multiple SELECT DATE_FORMAT gave incorrect results (Bug #4036) @@ -288,7 +287,10 @@ drop table t1; --echo # --echo # MDEV-4634 Crash in CONVERT_TZ --echo # +#enable after fix MDEV-27871 +--disable_view_protocol SELECT CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2022-00-00')),'+00:00','+7:5'); +--enable_view_protocol --echo # --echo # MDEV-4804 Date comparing false result @@ -764,11 +766,13 @@ DROP TABLE t2,t1; SELECT ROUND(GREATEST('1', CAST('2020-12-12' AS DATE))); +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT GREATEST('1', CAST('2020-12-12' AS DATE)); --disable_metadata --enable_ps_protocol +--enable_view_protocol CREATE TABLE t1 (c_date DATE NOT NULL, c_int INT NOT NULL); CREATE TABLE t2 AS SELECT @@ -780,6 +784,23 @@ SHOW CREATE TABLE t2; DROP TABLE t2; DROP TABLE t1; +--echo # +--echo # MDEV-29890 Update with inner join false row count result +--echo # +set sql_mode='NO_ZERO_DATE'; +create table t1 (a1 bigint primary key, a2 date not null, a3 bigint not null); +create table t2 (b1 bigint primary key); +insert into t2 (b1) values (1); +insert into t1 (a1, a2, a3) values (1, current_date, 1),( 2, current_date, 1); +update t1 inner join t2 on t1.a3 = t2.b1 set t1.a2 = t1.a2 + interval 1 day; +select row_count(); +set sql_mode=''; +alter table t1 modify a2 date not null default '0000-00-00'; +set sql_mode='NO_ZERO_DATE'; +update t1 inner join t2 on t1.a3 = t2.b1 set t1.a2 = t1.a2 + interval 1 day; +drop table t1, t2; +set sql_mode=default; + --echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/type_datetime.result b/mysql-test/main/type_datetime.result index 77d77d218f089..3e864d0ffa9bf 100644 --- a/mysql-test/main/type_datetime.result +++ b/mysql-test/main/type_datetime.result @@ -205,7 +205,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `da` date DEFAULT '1962-03-03', `dt` datetime DEFAULT '1962-03-03 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (); insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38'); Warnings: @@ -601,7 +601,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `da` date DEFAULT '1962-03-03', `dt` datetime DEFAULT '1962-03-03 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (); insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38'); Warnings: @@ -1122,7 +1122,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `MAX(CAST(a AS DATETIME))` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; SET timestamp=DEFAULT; diff --git a/mysql-test/main/type_datetime.test b/mysql-test/main/type_datetime.test index 4fddf1c1a7428..5816977029df2 100644 --- a/mysql-test/main/type_datetime.test +++ b/mysql-test/main/type_datetime.test @@ -139,10 +139,12 @@ DROP TABLE t1; # Bug 19491 (CAST DATE AS DECIMAL returns incorrect result # SELECT CAST(CAST('2006-08-10' AS DATE) AS DECIMAL(20,6)); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) AS DECIMAL(20,6)); SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6)); SELECT CAST(CAST('10:11:12.098700' AS TIME(6)) AS DECIMAL(20,6)); - +--disable_view_protocol # # Test of storing datetime into date fields @@ -250,7 +252,10 @@ select least(cast('01-01-01' as date), '01-01-02') + 0; select greatest(cast('01-01-01' as date), '01-01-02') + 0; select least(cast('01-01-01' as datetime), '01-01-02') + 0; select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed); +#enable after fix MDEV-27871 +--disable_view_protocol select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal(16,2)); +--enable_view_protocol --disable_warnings DROP PROCEDURE IF EXISTS test27759 ; --enable_warnings @@ -359,6 +364,7 @@ drop table t1; # # Bug #32694: NOT NULL table field in a subquery produces invalid results # +--disable_view_protocol create table t1 (id int(10) not null, cur_date datetime not null); create table t2 (id int(10) not null, cur_date date not null); insert into t1 (id, cur_date) values (1, '2007-04-25 18:30:22'); @@ -398,6 +404,7 @@ SET optimizer_switch=@save_optimizer_switch; drop table t1,t2; +--enable_view_protocol # # Bug #37526: asymertic operator <=> in trigger @@ -438,6 +445,9 @@ create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '196 create table t1 (t time default '916:00:00 a'); set @@sql_mode= @org_mode; +#enable after fix MDEV-27871 +--disable_view_protocol + # # Bug #42146 - DATETIME fractional seconds parse error # @@ -449,11 +459,13 @@ SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.0123450' AS # once more with feeling (but no warnings) SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS DATETIME(6)) AS DECIMAL(30,7)); + # # Bug #38435 - LONG Microseconds cause MySQL to fail a CAST to DATETIME or DATE # # show we truncate microseconds from the right SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime(6)) AS DECIMAL(30,7)); +--enable_view_protocol --echo # --echo # Bug#59173: Failure to handle DATE(TIME) values where Year, Month or @@ -496,8 +508,10 @@ drop table t1,t2; --echo # --echo # MDEV-4634 Crash in CONVERT_TZ --echo # +#enable after fix MDEV-27871 +--disable_view_protocol SELECT CONVERT_TZ(GREATEST(TIMESTAMP('2021-00-00'),TIMESTAMP('2022-00-00')),'+00:00','+7:5'); - +--enable_view_protocol --echo # --echo # MDEV-5041 Inserting a TIME with hour>24 into a DATETIME column produces a wrong value @@ -658,7 +672,10 @@ SELECT CAST(TIME'00:00:00.000001' AS DATETIME(6)); SELECT CAST(CAST('10:20:30' AS TIME) AS DATETIME); SELECT CAST(CAST('00:00:00.000001' AS TIME(6)) AS DATETIME(6)); SELECT CAST(CAST(TIMESTAMP'0000-00-00 10:20:30' AS TIME) AS DATETIME); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6)); +--enable_view_protocol SET old_mode=DEFAULT; SET sql_mode=DEFAULT; @@ -683,9 +700,11 @@ SET timestamp=UNIX_TIMESTAMP('2015-01-01 00:00:00'); CREATE TABLE t1 (a TIME); INSERT INTO t1 VALUES ('00:00:00'),('00:01:00'); --disable_ps_protocol +--disable_view_protocol --enable_metadata SELECT MAX(CAST(a AS DATETIME)) FROM t1; --disable_metadata +--enable_view_protocol --enable_ps_protocol CREATE TABLE t2 AS SELECT MAX(CAST(a AS DATETIME)) FROM t1; SHOW CREATE TABLE t2; diff --git a/mysql-test/main/type_datetime_hires.result b/mysql-test/main/type_datetime_hires.result index 02adadd16c5c9..bec5d5be415a6 100644 --- a/mysql-test/main/type_datetime_hires.result +++ b/mysql-test/main/type_datetime_hires.result @@ -65,7 +65,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime(4) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show columns from t1; Field Type Null Key Default Extra a datetime(4) YES NULL @@ -110,12 +110,12 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` datetime(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `a` datetime(4) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2, t3; insert t1 values ('2010-12-13 14:15:16.222222'); select a, a+0, a-1, a*1, a/2 from t1; @@ -135,7 +135,7 @@ t2 CREATE TABLE `t2` ( `a-1` decimal(19,4) DEFAULT NULL, `a*1` decimal(19,4) DEFAULT NULL, `a/2` decimal(22,8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t3; Table Create Table t3 CREATE TABLE `t3` ( @@ -143,7 +143,7 @@ t3 CREATE TABLE `t3` ( `min(a)` datetime(4) DEFAULT NULL, `sum(a)` decimal(40,4) DEFAULT NULL, `avg(a)` decimal(22,8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2, t3; create table t1 (f0_datetime datetime(0), f1_datetime datetime(1), f2_datetime datetime(2), f3_datetime datetime(3), f4_datetime datetime(4), f5_datetime datetime(5), f6_datetime datetime(6)); insert t1 values ( '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432'); @@ -256,7 +256,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t2; a b 2010-02-03 04:05:06.000000 2010-02-03 04:05:06.789100 @@ -372,7 +372,7 @@ t2 CREATE TABLE `t2` ( `r2` datetime DEFAULT NULL, `t1` datetime DEFAULT NULL, `t2` datetime NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a DATETIME(6)); @@ -910,7 +910,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `FLOOR(TIMESTAMP'2001-01-01 00:00:00.999999')` datetime DEFAULT NULL, `CEILING(TIMESTAMP'2001-01-01 00:00:00.999999')` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a DATETIME(6)); INSERT INTO t1 VALUES ('9999-12-31 23:59:59.999999'); diff --git a/mysql-test/main/type_decimal.result b/mysql-test/main/type_decimal.result index 7bf3b52970aac..3643dbea272df 100644 --- a/mysql-test/main/type_decimal.result +++ b/mysql-test/main/type_decimal.result @@ -711,14 +711,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `d` decimal(5,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (d decimal); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `d` decimal(10,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (d decimal(66,0)); ERROR 42000: Too big precision 66 specified for 'd'. Maximum is 65 @@ -891,7 +891,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(10,0) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select round(a,b) as c from t1 order by c; c 1000 @@ -1004,7 +1004,7 @@ SHOW CREATE TABLE t1dec102; Table Create Table t1dec102 CREATE TABLE `t1dec102` ( `a` decimal(10,2)/*old*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW COLUMNS FROM t1dec102; Field Type Null Key Default Extra a decimal(10,2)/*old*/ YES NULL @@ -1058,7 +1058,7 @@ SHOW CREATE TABLE t1dec102; Table Create Table t1dec102 CREATE TABLE `t1dec102` ( `a` decimal(10,2)/*old*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t1 AS SELECT a, MAX(a), COALESCE(a) FROM t1dec102; SHOW CREATE TABLE t1; Table Create Table @@ -1066,14 +1066,14 @@ t1 CREATE TABLE `t1` ( `a` decimal(10,2) DEFAULT NULL, `MAX(a)` decimal(10,2) DEFAULT NULL, `COALESCE(a)` decimal(10,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT a FROM t1dec102 UNION SELECT a FROM t1dec102; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(10,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP TABLE t1dec102; # @@ -1175,14 +1175,14 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `MAX(a)` decimal(10,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT COALESCE(a) FROM t1dec102; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `COALESCE(a)` decimal(10,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a BIGINT); CREATE TABLE t2 AS SELECT a FROM t1dec102 UNION SELECT a FROM t1; @@ -1190,7 +1190,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` decimal(21,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a MEDIUMINT); @@ -1199,7 +1199,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` decimal(10,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a YEAR); @@ -1208,7 +1208,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` decimal(10,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; DROP TABLE t1dec102; diff --git a/mysql-test/main/type_decimal.test b/mysql-test/main/type_decimal.test index 1076592fe6256..9e294410a386e 100644 --- a/mysql-test/main/type_decimal.test +++ b/mysql-test/main/type_decimal.test @@ -675,7 +675,10 @@ DROP TABLE t1dec102; SELECT CAST('0e111111111' AS DECIMAL(38,0)) AS a; SELECT CAST('0e1111111111' AS DECIMAL(38,0)) AS a; +#enable after fix MDEV-29647 +--disable_view_protocol SELECT CAST('.00000000000000000000000000000000000001e111111111111111111111' AS DECIMAL(38,0)) AS a; +--disable_view_protocol CREATE TABLE t1 (str VARCHAR(128), comment VARCHAR(128)); INSERT INTO t1 VALUES diff --git a/mysql-test/main/type_enum.result b/mysql-test/main/type_enum.result index d8b558c7ce0a9..9e313f5b3024e 100644 --- a/mysql-test/main/type_enum.result +++ b/mysql-test/main/type_enum.result @@ -1627,14 +1627,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` enum('','a','b') NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a enum (' ','a','b ') not null default 'b '); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` enum('','a','b') NOT NULL DEFAULT 'b' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a enum ('0','1')); insert ignore into t1 set a='foobar'; @@ -1659,7 +1659,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` enum('�','1','2') NOT NULL DEFAULT '�' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set names latin1; CREATE TABLE t1 ( @@ -1671,7 +1671,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT 1, `b` enum('value','���_value','���') NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show columns from t1; Field Type Null Key Default Extra a int(11) YES 1 @@ -1699,8 +1699,8 @@ a ENUM(' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('�','�','�') CHARACTER SET utf8 DEFAULT '�' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` enum('�','�','�') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '�' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('�'), ('�'), ('�'); select a from t1 order by a; a @@ -1718,7 +1718,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` enum('�','�','�') DEFAULT '�' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select a from t1 order by a; a � @@ -1752,28 +1752,28 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL, `f2` enum('��') DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(russian enum('E','F','E�F','F�E') NOT NULL DEFAULT'E'); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `russian` enum('E','F','E�F','F�E') NOT NULL DEFAULT 'E' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(denormal enum('E','F','E,F','F,E') NOT NULL DEFAULT'E'); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `denormal` enum('E','F','E,F','F,E') NOT NULL DEFAULT 'E' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(russian_deviant enum('E','F','E�F','F,E') NOT NULL DEFAULT'E'); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `russian_deviant` enum('E','F','E�F','F,E') NOT NULL DEFAULT 'E' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','  !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\�','zz�������������������������������������������������������������������������������������������������������������������������������')); @@ -1932,14 +1932,16 @@ ALTER TABLE t2 ADD PRIMARY KEY(c1); SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; c1 a +a SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; c1 a +a # t2 should NOT be eliminated EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 range PRIMARY PRIMARY 1 NULL 1 Using where; Using index +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1 (c1 SET('a') CHARACTER SET latin1 PRIMARY KEY); INSERT INTO t1 VALUES ('a'); @@ -1957,14 +1959,16 @@ ALTER TABLE t2 ADD PRIMARY KEY(c1); SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; c1 a +a SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; c1 a +a # t2 should NOT be eliminated EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 range PRIMARY PRIMARY 1 NULL 1 Using where; Using index +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 PRIMARY KEY); INSERT INTO t1 VALUES ('a'); @@ -1982,14 +1986,16 @@ ALTER TABLE t2 ADD PRIMARY KEY(c1); SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; c1 a +a SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; c1 a +a # t2 should NOT be eliminated EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 range PRIMARY PRIMARY 1 NULL 1 Using where; Using index +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index DROP TABLE IF EXISTS t1,t2; # # MDEV-6991 GROUP_MIN_MAX optimization is erroneously applied in some cases @@ -2219,6 +2225,27 @@ a DROP TABLE t1; # +# MDEV-26129 Bad results with join comparing case insensitive VARCHAR/ENUM/SET expression to a _bin ENUM column +# +CREATE TABLE t1 (a ENUM('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (a ENUM('a','A','b','B','c','C','d','D','e','E') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +INSERT INTO t2 VALUES ('b'),('B'),('c'),('C'),('d'),('D'),('e'),('E'); +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.a res FROM t1 JOIN t2 ON t1.a COLLATE latin1_swedish_ci=t2.a; +res +a +a +SELECT t1.a res FROM t1 LEFT JOIN t2 ON t1.a COLLATE latin1_swedish_ci=t2.a; +res +a +a +DROP TABLE IF EXISTS t1,t2; +# +# End of 10.2. tests +# +# # Start of 10.3 tests # # @@ -2264,7 +2291,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `(SELECT a FROM t1)` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; # UNION + table column CREATE TABLE t2 AS SELECT (SELECT a FROM t1 UNION SELECT NULL); @@ -2272,7 +2299,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `(SELECT a FROM t1 UNION SELECT NULL)` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; # UNION + SP variable CREATE PROCEDURE p1() @@ -2287,7 +2314,7 @@ CALL p1(); Table Create Table t2 CREATE TABLE `t2` ( `(SELECT va FROM t1 UNION SELECT NULL)` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP PROCEDURE p1; # UNION + anchored SP variable CREATE PROCEDURE p1() @@ -2302,7 +2329,7 @@ CALL p1(); Table Create Table t2 CREATE TABLE `t2` ( `(SELECT va FROM t1 UNION SELECT NULL)` varchar(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP PROCEDURE p1; DROP TABLE t1; # @@ -2320,9 +2347,40 @@ t2 CREATE TABLE `t2` ( `CEILING(a)` int(5) unsigned DEFAULT NULL, `TRUNCATE(a,0)` int(5) unsigned DEFAULT NULL, `ROUND(a)` int(5) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a FLOOR(a) CEILING(a) TRUNCATE(a,0) ROUND(a) 999999999999999999999999999999999999999999999999999999999999 1 1 1 1 DROP TABLE t2; DROP TABLE t1; +# +# MDEV-29062 Wrong result set metadata for a mix of INT+ENUM +# +CREATE TABLE t1 +( +c_int INT, +c_enum ENUM('1') +); +CREATE TABLE t2 AS SELECT c_int FROM t1 UNION SELECT c_enum FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c_int` varchar(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2; +CREATE OR REPLACE TABLE t2 AS SELECT COALESCE(c_int, c_enum) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(c_int, c_enum)` varchar(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2; +SELECT c_int FROM t1 UNION SELECT c_enum FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c_int c_int 253 11 0 Y 0 0 8 +c_int +SELECT COALESCE(c_int, c_enum) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c_int, c_enum) 253 11 0 Y 0 39 8 +COALESCE(c_int, c_enum) +DROP TABLE t1; diff --git a/mysql-test/main/type_enum.test b/mysql-test/main/type_enum.test index a36d63f872529..30a10407f89d4 100644 --- a/mysql-test/main/type_enum.test +++ b/mysql-test/main/type_enum.test @@ -110,7 +110,9 @@ insert into t1 values ('Y'); alter table t1 add b set ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin; alter table t1 add c enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin; --enable_metadata +--disable_view_protocol select * from t1; +--enable_view_protocol --disable_metadata drop table t1; @@ -234,7 +236,9 @@ CREATE TABLE t1 ( ) ENGINE=MyISAM; INSERT INTO t1 VALUES (1),(2); --enable_metadata +--disable_view_protocol SELECT AVG(f1) FROM t1; +--enable_view_protocol --disable_metadata drop table t1; @@ -457,6 +461,26 @@ ALTER TABLE t1 MODIFY a ENUM('2001','2002'); SELECT * FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-26129 Bad results with join comparing case insensitive VARCHAR/ENUM/SET expression to a _bin ENUM column +--echo # + +CREATE TABLE t1 (a ENUM('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (a ENUM('a','A','b','B','c','C','d','D','e','E') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +# without the following insert the bug doesn't show, was fixed in MDEV-6978 +INSERT INTO t2 VALUES ('b'),('B'),('c'),('C'),('d'),('D'),('e'),('E'); +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.a res FROM t1 JOIN t2 ON t1.a COLLATE latin1_swedish_ci=t2.a; +SELECT t1.a res FROM t1 LEFT JOIN t2 ON t1.a COLLATE latin1_swedish_ci=t2.a; +DROP TABLE IF EXISTS t1,t2; + + +--echo # +--echo # End of 10.2. tests +--echo # + --echo # --echo # Start of 10.3 tests --echo # @@ -531,3 +555,33 @@ SHOW CREATE TABLE t2; SELECT * FROM t2; DROP TABLE t2; DROP TABLE t1; + + +--echo # +--echo # MDEV-29062 Wrong result set metadata for a mix of INT+ENUM +--echo # + +CREATE TABLE t1 +( + c_int INT, + c_enum ENUM('1') +); + +CREATE TABLE t2 AS SELECT c_int FROM t1 UNION SELECT c_enum FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +CREATE OR REPLACE TABLE t2 AS SELECT COALESCE(c_int, c_enum) FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +--disable_view_protocol +--disable_ps_protocol +--enable_metadata +SELECT c_int FROM t1 UNION SELECT c_enum FROM t1; +SELECT COALESCE(c_int, c_enum) FROM t1; +--disable_metadata +--enable_ps_protocol +--enable_view_protocol + +DROP TABLE t1; diff --git a/mysql-test/main/type_float.result b/mysql-test/main/type_float.result index 5137a8229b6e3..500f906642ddd 100644 --- a/mysql-test/main/type_float.result +++ b/mysql-test/main/type_float.result @@ -95,7 +95,7 @@ t2 CREATE TABLE `t2` ( `col2` double(22,5) DEFAULT NULL, `col3` double DEFAULT NULL, `col4` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1,t2; create table t1 (a float); insert into t1 values (1); @@ -238,7 +238,7 @@ show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `d` double(18,9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2, t3; create table t1 select 105213674794682365.00 + 0.0 x; show warnings; @@ -794,43 +794,43 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `1.01e1` double NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 as select truncate(10.000000000001e1, 30) as t; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `t` double(47,30) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 as select truncate(10.000000000001e1, 31) as t; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `t` double NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 as select truncate(10.000000000001e1, 39) as t; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `t` double NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 as select truncate(10.000000000001e1, 51) as t; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `t` double NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 as select truncate(10.000000000001e1, 20)/2 as t; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `t` double(41,24) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 as select truncate(10.000000000001e1, 28)/2 as t; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `t` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table if exists t1; # # MDEV-11586 UNION of FLOAT type results in erroneous precision @@ -930,7 +930,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 0.671437 @@ -942,14 +942,14 @@ Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(12) DEFAULT NULL, `c2` varchar(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; CREATE TABLE t1 (a FLOAT DEFAULT CAST(0.671437 AS FLOAT)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` float DEFAULT (cast(0.671437 as float)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a FLOAT); INSERT INTO t1 VALUES (1, 0.671437),(2, 0.671437); @@ -961,6 +961,13 @@ id a DELETE FROM t1 WHERE a=CAST(0.671437 AS FLOAT); DROP TABLE t1; # +# MDEV-29473 UBSAN: Signed integer overflow: X * Y cannot be represented in type 'int' in strings/dtoa.c +# +CREATE TABLE t1 (c DOUBLE); +INSERT INTO t1 VALUES ('1e4294967297'); +ERROR 22003: Out of range value for column 'c' at row 1 +DROP TABLE t1; +# # End of 10.3 tests # # diff --git a/mysql-test/main/type_float.test b/mysql-test/main/type_float.test index a12bf67a42650..7516508ac3c50 100644 --- a/mysql-test/main/type_float.test +++ b/mysql-test/main/type_float.test @@ -337,8 +337,11 @@ select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo; --echo # MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result --echo # +#enable after fix MDEV-29552 +--disable_view_protocol SELECT LEFT('a',EXP(50)); SELECT LEFT('a', COALESCE(1e30)); +--enable_view_protocol CREATE TABLE t1 (a FLOAT); INSERT INTO t1 VALUES (1e30); @@ -629,9 +632,12 @@ DROP TABLE t1, t2; --echo # MDEV-16872 Add CAST(expr AS FLOAT) --echo # +#'float' in the note is written with in lowercase in --view-protocol +--disable_view_protocol SELECT CAST(0.671437 AS FLOAT), CONCAT(CAST(0.671437 AS FLOAT)); SELECT CAST(1e40 AS FLOAT), CONCAT(CAST(1e40 AS FLOAT)); SELECT CAST(-1e40 AS FLOAT), CONCAT(CAST(-1e40 AS FLOAT)); +--enable_view_protocol SET sql_mode='STRICT_ALL_TABLES,STRICT_TRANS_TABLES'; CREATE TABLE t1 (a FLOAT); @@ -663,6 +669,16 @@ SELECT * FROM t1; DELETE FROM t1 WHERE a=CAST(0.671437 AS FLOAT); DROP TABLE t1; +--echo # +--echo # MDEV-29473 UBSAN: Signed integer overflow: X * Y cannot be represented in type 'int' in strings/dtoa.c +--echo # + +# This test was failing with UBSAN builds + +CREATE TABLE t1 (c DOUBLE); +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO t1 VALUES ('1e4294967297'); +DROP TABLE t1; --echo # --echo # End of 10.3 tests diff --git a/mysql-test/main/type_geometry_mix_int.result b/mysql-test/main/type_geometry_mix_int.result new file mode 100644 index 0000000000000..773eaabc65a17 --- /dev/null +++ b/mysql-test/main/type_geometry_mix_int.result @@ -0,0 +1,351 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target GEOMETRY DEFAULT POINT(1,1), source INT DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` geometry DEFAULT point(1,1), + `source` int(11) DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +SELECT * FROM v3; +id target source +1 POINT(1 1) 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +SELECT * FROM v3; +id target source +1 POINT(1 1) 0 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target int(11) +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(11) DEFAULT NULL; +DECLARE dst geometry DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a geometry) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a geometry) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst geometry) +BEGIN +DECLARE src int(11) DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst geometry DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'int' as 'geometry' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS geometry +BEGIN +DECLARE rc int(11) DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(11) DEFAULT NULL; +DECLARE cur1 CURSOR(t geometry) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst geometry DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target INT DEFAULT 0, source GEOMETRY DEFAULT POINT(1,1)); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` int(11) DEFAULT 0, + `source` geometry DEFAULT point(1,1), + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1366 Incorrect integer value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\xF0?' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 POINT(1 1) +2 0 POINT(1 1) +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22007: Incorrect integer value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\xF0?' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 POINT(1 1) +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target geometry +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src geometry DEFAULT NULL; +DECLARE dst int(11) DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a int(11)) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a int(11)) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst int(11)) +BEGIN +DECLARE src geometry DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst int(11) DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'geometry' as 'int' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS int(11) +BEGIN +DECLARE rc geometry DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src geometry DEFAULT NULL; +DECLARE cur1 CURSOR(t int(11)) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst int(11) DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/type_geometry_mix_int.test b/mysql-test/main/type_geometry_mix_int.test new file mode 100644 index 0000000000000..1c64a13e1e832 --- /dev/null +++ b/mysql-test/main/type_geometry_mix_int.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target GEOMETRY DEFAULT POINT(1,1), source INT DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target INT DEFAULT 0, source GEOMETRY DEFAULT POINT(1,1)); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/type_hex_hybrid.result b/mysql-test/main/type_hex_hybrid.result index afe338a1cd87b..baca0d592b7b6 100644 --- a/mysql-test/main/type_hex_hybrid.result +++ b/mysql-test/main/type_hex_hybrid.result @@ -51,7 +51,7 @@ Create Table CREATE TABLE `t1` ( `c3` int(3) unsigned NOT NULL, `c4` int(3) unsigned NOT NULL, `c5` int(3) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci c1 255 c2 255 c3 255 @@ -66,7 +66,7 @@ Create Table CREATE TABLE `t1` ( `c3` int(5) unsigned NOT NULL, `c4` int(5) unsigned NOT NULL, `c5` int(5) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci c1 65535 c2 65535 c3 65535 @@ -81,7 +81,7 @@ Create Table CREATE TABLE `t1` ( `c3` int(8) unsigned NOT NULL, `c4` int(8) unsigned NOT NULL, `c5` int(8) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci c1 16777215 c2 16777215 c3 16777215 @@ -96,7 +96,7 @@ Create Table CREATE TABLE `t1` ( `c3` bigint(10) unsigned NOT NULL, `c4` bigint(10) unsigned NOT NULL, `c5` bigint(10) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci c1 4294967295 c2 4294967295 c3 4294967295 @@ -111,7 +111,7 @@ Create Table CREATE TABLE `t1` ( `c3` bigint(13) unsigned NOT NULL, `c4` bigint(13) unsigned NOT NULL, `c5` bigint(13) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci c1 1099511627775 c2 1099511627775 c3 1099511627775 @@ -126,7 +126,7 @@ Create Table CREATE TABLE `t1` ( `c3` bigint(15) unsigned NOT NULL, `c4` bigint(15) unsigned NOT NULL, `c5` bigint(15) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci c1 281474976710655 c2 281474976710655 c3 281474976710655 @@ -141,7 +141,7 @@ Create Table CREATE TABLE `t1` ( `c3` bigint(17) unsigned NOT NULL, `c4` bigint(17) unsigned NOT NULL, `c5` bigint(17) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci c1 72057594037927935 c2 72057594037927935 c3 72057594037927935 @@ -156,7 +156,7 @@ Create Table CREATE TABLE `t1` ( `c3` bigint(20) unsigned NOT NULL, `c4` bigint(20) unsigned NOT NULL, `c5` bigint(20) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci c1 18446744073709551615 c2 18446744073709551615 c3 18446744073709551615 @@ -171,7 +171,7 @@ Create Table CREATE TABLE `t1` ( `c3` bigint(20) unsigned NOT NULL, `c4` bigint(20) unsigned NOT NULL, `c5` bigint(20) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci c1 18446744073709551615 c2 18446744073709551615 c3 18446744073709551615 @@ -189,7 +189,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `ROUND(0xFFFFFFFFFFFFFFFF,-10)` decimal(21,0) unsigned NOT NULL, `ROUND(0xFFFFFFFFFFFFFFFF,-11)` decimal(21,0) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; ROUND(0xFFFFFFFFFFFFFFFF,-10) ROUND(0xFFFFFFFFFFFFFFFF,-11) 18446744070000000000 18446744100000000000 @@ -229,7 +229,7 @@ Create Table CREATE TABLE `t1` ( `c3` decimal(21,0) unsigned NOT NULL, `c4` decimal(21,0) unsigned NOT NULL, `c5` decimal(21,0) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # End of 10.4 tests diff --git a/mysql-test/main/type_hex_hybrid.test b/mysql-test/main/type_hex_hybrid.test index 175169fbda454..3f15f06dd12f0 100644 --- a/mysql-test/main/type_hex_hybrid.test +++ b/mysql-test/main/type_hex_hybrid.test @@ -6,6 +6,7 @@ --echo # MDEV-16426 Optimizer erroneously treats equal constants of different formats as same --echo # +--disable_service_connection # It's important for CHARSET('a') and CHARSET(0x61) to have different lengths in this test. # 'latin1' and 'binary' have same lengths, so using 'utf8'. SET NAMES utf8; @@ -15,6 +16,7 @@ SELECT CHARSET('a'),CHARSET(0x61),LENGTH(CHARSET('a'))+a,LENGTH(CHARSET(0x61))+a SELECT * FROM t1 WHERE LENGTH(CHARSET('a'))+a<=>LENGTH(CHARSET(0x61))+a; EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(CHARSET('a'))+a<=>LENGTH(CHARSET(0x61))+a; DROP TABLE t1; +--enable_service_connection --echo # --echo # MDEV-23320 Hex hybrid constants 0xHHHH work badly in rounding functions diff --git a/mysql-test/main/type_int.result b/mysql-test/main/type_int.result index c9763a1453e70..1d38181c71df2 100644 --- a/mysql-test/main/type_int.result +++ b/mysql-test/main/type_int.result @@ -185,7 +185,7 @@ t2 CREATE TABLE `t2` ( `CONCAT(sint32)` varchar(11) DEFAULT NULL, `CONCAT(uint64)` varchar(20) DEFAULT NULL, `CONCAT(sint64)` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT CONCAT(COALESCE(uint8)),CONCAT(COALESCE(sint8)), @@ -207,7 +207,7 @@ t2 CREATE TABLE `t2` ( `CONCAT(COALESCE(sint32))` varchar(11) DEFAULT NULL, `CONCAT(COALESCE(uint64))` varchar(20) DEFAULT NULL, `CONCAT(COALESCE(sint64))` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE FUNCTION uint8() RETURNS TINYINT(2) UNSIGNED RETURN 1; @@ -239,7 +239,7 @@ t1 CREATE TABLE `t1` ( `CONCAT(sint32())` varchar(11) DEFAULT NULL, `CONCAT(uint64())` varchar(20) DEFAULT NULL, `CONCAT(sint64())` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT CONCAT(COALESCE(uint8())),CONCAT(COALESCE(sint8())), @@ -260,7 +260,7 @@ t1 CREATE TABLE `t1` ( `CONCAT(COALESCE(sint32()))` varchar(11) DEFAULT NULL, `CONCAT(COALESCE(uint64()))` varchar(20) DEFAULT NULL, `CONCAT(COALESCE(sint64()))` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP FUNCTION uint8; DROP FUNCTION sint8; @@ -286,6 +286,175 @@ a 127 DROP TABLE t1, t2; # +# MDEV-21445 Strange/inconsistent behavior of IN condition when mixing numbers and strings +# +CREATE TABLE t1 ( +id bigint(20) unsigned NOT NULL, +PRIMARY KEY (id) +); +INSERT INTO t1 VALUES(1234),(97716021308405775),(97716021308405770),(97716021308405780); +SELECT * FROM t1 WHERE id IN(97716021308405775); +id +97716021308405775 +SELECT * FROM t1 WHERE id IN('97716021308405775'); +id +97716021308405775 +SELECT * FROM t1 WHERE id IN('1234',97716021308405775); +id +1234 +97716021308405775 +SELECT * FROM t1 WHERE id IN('1234','97716021308405775'); +id +1234 +97716021308405775 +SELECT * FROM t1 WHERE id = 1234 OR id = '97716021308405775'; +id +1234 +97716021308405775 +SELECT * FROM t1 WHERE id IN(1234,'97716021308405775'); +id +1234 +97716021308405775 +SELECT * FROM t1 WHERE id IN('97716021308405775',1234); +id +1234 +97716021308405775 +DROP TABLE t1; +CREATE TABLE t1 (id bigint(20) unsigned NOT NULL PRIMARY KEY); +INSERT INTO t1 VALUES(1234),(97716021308405775),(97716021308405770),(97716021308405780); +SELECT +id, +CASE id +WHEN '97716021308405770' THEN '70' + WHEN '97716021308405775' THEN '75' + WHEN '97716021308405780' THEN '80' + END AS c1 +FROM t1; +id c1 +1234 NULL +97716021308405770 70 +97716021308405775 75 +97716021308405780 80 +SELECT +id, +CASE +WHEN id='97716021308405770' THEN '70' + WHEN id='97716021308405775' THEN '75' + WHEN id='97716021308405780' THEN '80' + END AS c1 +FROM t1; +id c1 +1234 NULL +97716021308405770 70 +97716021308405775 75 +97716021308405780 80 +SELECT id, id BETWEEN '97716021308405775' AND '97716021308405775' AS c1 FROM t1; +id c1 +1234 0 +97716021308405770 0 +97716021308405775 1 +97716021308405780 0 +SELECT id, id BETWEEN '97716021308405775' AND 97716021308405775 AS c1 FROM t1; +id c1 +1234 0 +97716021308405770 0 +97716021308405775 1 +97716021308405780 0 +SELECT id, id BETWEEN 97716021308405775 AND '97716021308405775' AS c1 FROM t1; +id c1 +1234 0 +97716021308405770 0 +97716021308405775 1 +97716021308405780 0 +DROP TABLE t1; +SELECT '97716021308405770'=97716021308405770; +'97716021308405770'=97716021308405770 +1 +SELECT 97716021308405770='97716021308405770'; +97716021308405770='97716021308405770' +1 +SELECT '9e+16'=90000000000000000; +'9e+16'=90000000000000000 +1 +SELECT 90000000000000000='9e+16'; +90000000000000000='9e+16' +1 +SELECT '9e+30'>90000000000000000; +'9e+30'>90000000000000000 +1 +SELECT 90000000000000000<'9e+30'; +90000000000000000<'9e+30' +1 +SELECT '9e+80'>90000000000000000; +'9e+80'>90000000000000000 +1 +SELECT 90000000000000000<'9e+80'; +90000000000000000<'9e+80' +1 +SELECT '9.9999999999999999e+80'>90000000000000000; +'9.9999999999999999e+80'>90000000000000000 +1 +SELECT 90000000000000000<'9.9999999999999999e+80'; +90000000000000000<'9.9999999999999999e+80' +1 +SELECT '1e+81'>90000000000000000; +'1e+81'>90000000000000000 +1 +Warnings: +Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated +Warning 1292 Truncated incorrect DECIMAL value: '1e+81' +SELECT 90000000000000000<'1e+81'; +90000000000000000<'1e+81' +1 +Warnings: +Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated +Warning 1292 Truncated incorrect DECIMAL value: '1e+81' +SELECT '9e+100'>90000000000000000; +'9e+100'>90000000000000000 +1 +Warnings: +Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated +Warning 1292 Truncated incorrect DECIMAL value: '9e+100' +SELECT 90000000000000000<'9e+100'; +90000000000000000<'9e+100' +1 +Warnings: +Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated +Warning 1292 Truncated incorrect DECIMAL value: '9e+100' +SELECT CAST(0xFFFFFFFFFFFFFFFF AS UNSIGNED)=18446744073709551615; +CAST(0xFFFFFFFFFFFFFFFF AS UNSIGNED)=18446744073709551615 +1 +SELECT 18446744073709551615=CAST(0xFFFFFFFFFFFFFFFF AS UNSIGNED); +18446744073709551615=CAST(0xFFFFFFFFFFFFFFFF AS UNSIGNED) +1 +SELECT CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED)=9223372036854775807; +CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED)=9223372036854775807 +1 +SELECT 9223372036854775807=CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED); +9223372036854775807=CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED) +1 +# +# MDEV-25492 BETWEEN clause returns incorrect results on quoted 64-bit ints +# +CREATE TABLE betweentest +( +id int(11) unsigned NOT NULL AUTO_INCREMENT, +range1 bigint(20) DEFAULT NULL, +range2 bigint(20) DEFAULT NULL, +PRIMARY KEY (id) +); +INSERT INTO betweentest VALUES +(1,2739499741191602369,2739499741191602369), +(2,2739499741191602192,2739499741191602192), +(3,2739138623713574912,2739138623730352127); +SELECT * FROM betweentest WHERE '2739499741191602192' BETWEEN range1 AND range2; +id range1 range2 +2 2739499741191602192 2739499741191602192 +SELECT * FROM betweentest WHERE 2739499741191602192 BETWEEN range1 AND range2; +id range1 range2 +2 2739499741191602192 2739499741191602192 +DROP TABLE betweentest; +# # End of 10.3 tests # # @@ -438,7 +607,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` tinyint(4) DEFAULT NULL, `FLOOR(a)` tinyint(4) DEFAULT NULL, `CEILING(a)` tinyint(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -128 ROUND(a) -128 ROUND(a,1) -128 @@ -464,7 +633,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` smallint(6) DEFAULT NULL, `FLOOR(a)` smallint(6) DEFAULT NULL, `CEILING(a)` smallint(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -32768 ROUND(a) -32768 ROUND(a,1) -32768 @@ -490,7 +659,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` mediumint(9) DEFAULT NULL, `FLOOR(a)` mediumint(9) DEFAULT NULL, `CEILING(a)` mediumint(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -8388608 ROUND(a) -8388608 ROUND(a,1) -8388608 @@ -516,7 +685,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` int(11) DEFAULT NULL, `FLOOR(a)` int(11) DEFAULT NULL, `CEILING(a)` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -2147483648 ROUND(a) -2147483648 ROUND(a,1) -2147483648 @@ -542,7 +711,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` bigint(20) DEFAULT NULL, `FLOOR(a)` bigint(20) DEFAULT NULL, `CEILING(a)` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9223372036854775808 ROUND(a) -9223372036854775808 ROUND(a,1) -9223372036854775808 @@ -568,7 +737,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` bigint(20) DEFAULT NULL, `FLOOR(a)` bigint(20) DEFAULT NULL, `CEILING(a)` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9223372036854775808 ROUND(a) -9223372036854775808 ROUND(a,1) -9223372036854775808 @@ -594,7 +763,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` bigint(21) DEFAULT NULL, `FLOOR(a)` bigint(21) DEFAULT NULL, `CEILING(a)` bigint(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9223372036854775808 ROUND(a) -9223372036854775808 ROUND(a,1) -9223372036854775808 @@ -620,7 +789,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` bigint(22) DEFAULT NULL, `FLOOR(a)` bigint(22) DEFAULT NULL, `CEILING(a)` bigint(22) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9223372036854775808 ROUND(a) -9223372036854775808 ROUND(a,1) -9223372036854775808 @@ -646,7 +815,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` bigint(23) DEFAULT NULL, `FLOOR(a)` bigint(23) DEFAULT NULL, `CEILING(a)` bigint(23) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9223372036854775808 ROUND(a) -9223372036854775808 ROUND(a,1) -9223372036854775808 @@ -672,7 +841,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` bigint(30) DEFAULT NULL, `FLOOR(a)` bigint(30) DEFAULT NULL, `CEILING(a)` bigint(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9223372036854775808 ROUND(a) -9223372036854775808 ROUND(a,1) -9223372036854775808 @@ -698,7 +867,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` tinyint(3) unsigned DEFAULT NULL, `FLOOR(a)` tinyint(3) unsigned DEFAULT NULL, `CEILING(a)` tinyint(3) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a) 0 ROUND(a,1) 0 @@ -724,7 +893,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` smallint(5) unsigned DEFAULT NULL, `FLOOR(a)` smallint(5) unsigned DEFAULT NULL, `CEILING(a)` smallint(5) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a) 0 ROUND(a,1) 0 @@ -750,7 +919,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` mediumint(8) unsigned DEFAULT NULL, `FLOOR(a)` mediumint(8) unsigned DEFAULT NULL, `CEILING(a)` mediumint(8) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a) 0 ROUND(a,1) 0 @@ -776,7 +945,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` int(10) unsigned DEFAULT NULL, `FLOOR(a)` int(10) unsigned DEFAULT NULL, `CEILING(a)` int(10) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a) 0 ROUND(a,1) 0 @@ -802,7 +971,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` bigint(20) unsigned DEFAULT NULL, `FLOOR(a)` bigint(20) unsigned DEFAULT NULL, `CEILING(a)` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a) 0 ROUND(a,1) 0 @@ -828,7 +997,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` bigint(20) unsigned DEFAULT NULL, `FLOOR(a)` bigint(20) unsigned DEFAULT NULL, `CEILING(a)` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a) 0 ROUND(a,1) 0 @@ -854,7 +1023,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` bigint(21) unsigned DEFAULT NULL, `FLOOR(a)` bigint(21) unsigned DEFAULT NULL, `CEILING(a)` bigint(21) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a) 0 ROUND(a,1) 0 @@ -880,7 +1049,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` bigint(22) unsigned DEFAULT NULL, `FLOOR(a)` bigint(22) unsigned DEFAULT NULL, `CEILING(a)` bigint(22) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a) 0 ROUND(a,1) 0 @@ -906,7 +1075,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` bigint(23) unsigned DEFAULT NULL, `FLOOR(a)` bigint(23) unsigned DEFAULT NULL, `CEILING(a)` bigint(23) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a) 0 ROUND(a,1) 0 @@ -932,7 +1101,7 @@ Create Table CREATE TABLE `t2` ( `TRUNCATE(a,0)` bigint(30) unsigned DEFAULT NULL, `FLOOR(a)` bigint(30) unsigned DEFAULT NULL, `CEILING(a)` bigint(30) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a) 0 ROUND(a,1) 0 @@ -960,7 +1129,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `ROUND(18446744073709551615,-10)` decimal(21,0) unsigned NOT NULL, `ROUND(18446744073709551615,-11)` decimal(21,0) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; ROUND(18446744073709551615,-10) ROUND(18446744073709551615,-11) 18446744070000000000 18446744100000000000 @@ -985,7 +1154,7 @@ Table t1 Create Table CREATE TABLE `t1` ( `c01` decimal(21,0) unsigned NOT NULL, `c19` decimal(21,0) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE PROCEDURE p1(t VARCHAR(64)) BEGIN @@ -1012,7 +1181,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` int(5) DEFAULT NULL, `ROUND(a,-20)` int(5) DEFAULT NULL, `ROUND(a,-30)` int(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -128 ROUND(a,-1) -130 ROUND(a,-2) -100 @@ -1035,7 +1204,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` int(7) DEFAULT NULL, `ROUND(a,-20)` int(7) DEFAULT NULL, `ROUND(a,-30)` int(7) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -32768 ROUND(a,-1) -32770 ROUND(a,-2) -32800 @@ -1058,7 +1227,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` bigint(10) DEFAULT NULL, `ROUND(a,-20)` bigint(10) DEFAULT NULL, `ROUND(a,-30)` bigint(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -8388608 ROUND(a,-1) -8388610 ROUND(a,-2) -8388600 @@ -1081,7 +1250,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` bigint(12) DEFAULT NULL, `ROUND(a,-20)` bigint(12) DEFAULT NULL, `ROUND(a,-30)` bigint(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -2147483648 ROUND(a,-1) -2147483650 ROUND(a,-2) -2147483600 @@ -1104,7 +1273,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` decimal(20,0) DEFAULT NULL, `ROUND(a,-20)` decimal(20,0) DEFAULT NULL, `ROUND(a,-30)` decimal(20,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9223372036854775808 ROUND(a,-1) -9223372036854775810 ROUND(a,-2) -9223372036854775800 @@ -1127,7 +1296,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` decimal(20,0) DEFAULT NULL, `ROUND(a,-20)` decimal(20,0) DEFAULT NULL, `ROUND(a,-30)` decimal(20,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9223372036854775808 ROUND(a,-1) -9223372036854775810 ROUND(a,-2) -9223372036854775800 @@ -1150,7 +1319,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` decimal(21,0) DEFAULT NULL, `ROUND(a,-20)` decimal(21,0) DEFAULT NULL, `ROUND(a,-30)` decimal(21,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9223372036854775808 ROUND(a,-1) -9223372036854775810 ROUND(a,-2) -9223372036854775800 @@ -1173,7 +1342,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` decimal(22,0) DEFAULT NULL, `ROUND(a,-20)` decimal(22,0) DEFAULT NULL, `ROUND(a,-30)` decimal(22,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9223372036854775808 ROUND(a,-1) -9223372036854775810 ROUND(a,-2) -9223372036854775800 @@ -1196,7 +1365,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` decimal(23,0) DEFAULT NULL, `ROUND(a,-20)` decimal(23,0) DEFAULT NULL, `ROUND(a,-30)` decimal(23,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9223372036854775808 ROUND(a,-1) -9223372036854775810 ROUND(a,-2) -9223372036854775800 @@ -1219,7 +1388,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` decimal(30,0) DEFAULT NULL, `ROUND(a,-20)` decimal(30,0) DEFAULT NULL, `ROUND(a,-30)` decimal(30,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9223372036854775808 ROUND(a,-1) -9223372036854775810 ROUND(a,-2) -9223372036854775800 @@ -1242,7 +1411,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` int(4) unsigned DEFAULT NULL, `ROUND(a,-20)` int(4) unsigned DEFAULT NULL, `ROUND(a,-30)` int(4) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a,-1) 0 ROUND(a,-2) 0 @@ -1265,7 +1434,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` int(6) unsigned DEFAULT NULL, `ROUND(a,-20)` int(6) unsigned DEFAULT NULL, `ROUND(a,-30)` int(6) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a,-1) 0 ROUND(a,-2) 0 @@ -1288,7 +1457,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` int(9) unsigned DEFAULT NULL, `ROUND(a,-20)` int(9) unsigned DEFAULT NULL, `ROUND(a,-30)` int(9) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a,-1) 0 ROUND(a,-2) 0 @@ -1311,7 +1480,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` bigint(11) unsigned DEFAULT NULL, `ROUND(a,-20)` bigint(11) unsigned DEFAULT NULL, `ROUND(a,-30)` bigint(11) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a,-1) 0 ROUND(a,-2) 0 @@ -1334,7 +1503,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` decimal(21,0) unsigned DEFAULT NULL, `ROUND(a,-20)` decimal(21,0) unsigned DEFAULT NULL, `ROUND(a,-30)` decimal(21,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a,-1) 0 ROUND(a,-2) 0 @@ -1357,7 +1526,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` decimal(21,0) unsigned DEFAULT NULL, `ROUND(a,-20)` decimal(21,0) unsigned DEFAULT NULL, `ROUND(a,-30)` decimal(21,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a,-1) 0 ROUND(a,-2) 0 @@ -1380,7 +1549,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` decimal(22,0) unsigned DEFAULT NULL, `ROUND(a,-20)` decimal(22,0) unsigned DEFAULT NULL, `ROUND(a,-30)` decimal(22,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a,-1) 0 ROUND(a,-2) 0 @@ -1403,7 +1572,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` decimal(23,0) unsigned DEFAULT NULL, `ROUND(a,-20)` decimal(23,0) unsigned DEFAULT NULL, `ROUND(a,-30)` decimal(23,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a,-1) 0 ROUND(a,-2) 0 @@ -1426,7 +1595,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` decimal(24,0) unsigned DEFAULT NULL, `ROUND(a,-20)` decimal(24,0) unsigned DEFAULT NULL, `ROUND(a,-30)` decimal(24,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a,-1) 0 ROUND(a,-2) 0 @@ -1449,7 +1618,7 @@ Create Table CREATE TABLE `t2` ( `ROUND(a,-19)` decimal(31,0) unsigned DEFAULT NULL, `ROUND(a,-20)` decimal(31,0) unsigned DEFAULT NULL, `ROUND(a,-30)` decimal(31,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0 ROUND(a,-1) 0 ROUND(a,-2) 0 @@ -1488,7 +1657,7 @@ Create Table CREATE TABLE `t1` ( `c1` bigint(20) unsigned DEFAULT NULL, `c2` decimal(21,0) unsigned NOT NULL, `c3` decimal(21,0) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # End of 10.4 tests diff --git a/mysql-test/main/type_int.test b/mysql-test/main/type_int.test index c2edb0a97563c..7ffbe94cc0d10 100644 --- a/mysql-test/main/type_int.test +++ b/mysql-test/main/type_int.test @@ -220,6 +220,108 @@ INSERT IGNORE INTO t2 SELECT a FROM t1; SELECT * FROM t2; DROP TABLE t1, t2; +--echo # +--echo # MDEV-21445 Strange/inconsistent behavior of IN condition when mixing numbers and strings +--echo # + +CREATE TABLE t1 ( + id bigint(20) unsigned NOT NULL, + PRIMARY KEY (id) +); +INSERT INTO t1 VALUES(1234),(97716021308405775),(97716021308405770),(97716021308405780); + +# OK +SELECT * FROM t1 WHERE id IN(97716021308405775); +SELECT * FROM t1 WHERE id IN('97716021308405775'); +SELECT * FROM t1 WHERE id IN('1234',97716021308405775); +SELECT * FROM t1 WHERE id IN('1234','97716021308405775'); +SELECT * FROM t1 WHERE id = 1234 OR id = '97716021308405775'; + +# The following was not OK +SELECT * FROM t1 WHERE id IN(1234,'97716021308405775'); +SELECT * FROM t1 WHERE id IN('97716021308405775',1234); + +DROP TABLE t1; + + +CREATE TABLE t1 (id bigint(20) unsigned NOT NULL PRIMARY KEY); +INSERT INTO t1 VALUES(1234),(97716021308405775),(97716021308405770),(97716021308405780); +SELECT + id, + CASE id + WHEN '97716021308405770' THEN '70' + WHEN '97716021308405775' THEN '75' + WHEN '97716021308405780' THEN '80' + END AS c1 +FROM t1; + +SELECT + id, + CASE + WHEN id='97716021308405770' THEN '70' + WHEN id='97716021308405775' THEN '75' + WHEN id='97716021308405780' THEN '80' + END AS c1 +FROM t1; + +SELECT id, id BETWEEN '97716021308405775' AND '97716021308405775' AS c1 FROM t1; +SELECT id, id BETWEEN '97716021308405775' AND 97716021308405775 AS c1 FROM t1; +SELECT id, id BETWEEN 97716021308405775 AND '97716021308405775' AS c1 FROM t1; + +DROP TABLE t1; + +SELECT '97716021308405770'=97716021308405770; +SELECT 97716021308405770='97716021308405770'; + +SELECT '9e+16'=90000000000000000; +SELECT 90000000000000000='9e+16'; + +SELECT '9e+30'>90000000000000000; +SELECT 90000000000000000<'9e+30'; + +SELECT '9e+80'>90000000000000000; +SELECT 90000000000000000<'9e+80'; + +SELECT '9.9999999999999999e+80'>90000000000000000; +SELECT 90000000000000000<'9.9999999999999999e+80'; + +SELECT '1e+81'>90000000000000000; +SELECT 90000000000000000<'1e+81'; + +SELECT '9e+100'>90000000000000000; +SELECT 90000000000000000<'9e+100'; + +SELECT CAST(0xFFFFFFFFFFFFFFFF AS UNSIGNED)=18446744073709551615; +SELECT 18446744073709551615=CAST(0xFFFFFFFFFFFFFFFF AS UNSIGNED); + +SELECT CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED)=9223372036854775807; +SELECT 9223372036854775807=CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED); + + +--echo # +--echo # MDEV-25492 BETWEEN clause returns incorrect results on quoted 64-bit ints +--echo # + +CREATE TABLE betweentest +( + id int(11) unsigned NOT NULL AUTO_INCREMENT, + range1 bigint(20) DEFAULT NULL, + range2 bigint(20) DEFAULT NULL, + PRIMARY KEY (id) +); + +INSERT INTO betweentest VALUES + (1,2739499741191602369,2739499741191602369), + (2,2739499741191602192,2739499741191602192), + (3,2739138623713574912,2739138623730352127); + +SELECT * FROM betweentest WHERE '2739499741191602192' BETWEEN range1 AND range2; + +SELECT * FROM betweentest WHERE 2739499741191602192 BETWEEN range1 AND range2; + +DROP TABLE betweentest; + + --echo # --echo # End of 10.3 tests --echo # diff --git a/mysql-test/main/type_interval.test b/mysql-test/main/type_interval.test index 15999dc609d32..d27700a6725a8 100644 --- a/mysql-test/main/type_interval.test +++ b/mysql-test/main/type_interval.test @@ -19,12 +19,15 @@ INSERT INTO t1 VALUES ('87649416:00:00'), ('3652059 00:00:00'); +#enable after fix MDEV-29525 +--disable_view_protocol 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; +--enable_view_protocol DROP TABLE t1; @@ -40,12 +43,15 @@ INSERT INTO t1 VALUES (876494155959), (876494160000); +#enable after fix MDEV-29525 +--disable_view_protocol 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; +--enable_view_protocol DROP TABLE t1; diff --git a/mysql-test/main/type_json.result b/mysql-test/main/type_json.result index dfe4699b36101..681bd42c4e3b9 100644 --- a/mysql-test/main/type_json.result +++ b/mysql-test/main/type_json.result @@ -3,7 +3,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`a`)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1(a json character set utf8); 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 'character set utf8)' at line 1 create or replace table t1(a json default '{a:1}'); @@ -11,13 +11,13 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '{a:1}' CHECK (json_valid(`a`)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1(a json not null check (json_valid(a))); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`a`)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert t1 values ('[]'); insert t1 values ('a'); ERROR 23000: CONSTRAINT `t1.a` failed for `test`.`t1` @@ -26,7 +26,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`a`)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert t1 values ('[]'); insert t1 values ('a'); ERROR 23000: CONSTRAINT `t1.a` failed for `test`.`t1` @@ -36,7 +36,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT json_object('now',current_timestamp()) CHECK (json_valid(`a`)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert t1 values (); select * from t1; a @@ -52,25 +52,25 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `t` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`t`)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`a`)), `t` varchar(38) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `t` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`t`)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1,t2,t3; create table t1 (t json check (length(t) > 0)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `t` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (octet_length(`t`) > 0) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (t text) engine=myisam; insert into t1 values ("{}"),(""); @@ -92,7 +92,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT json_object('now',1) CHECK (json_valid(`a`)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select cast('{a:1}' as text); 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 'text)' at line 1 @@ -126,5 +126,38 @@ def JSON_COMPACT('{}') 253 (format=json) 6 0 Y 0 0 33 js0 JSON_COMPACT(js0) JSON_COMPACT('{}') DROP TABLE t1; # +# MDEV-27361 Hybrid functions with JSON arguments do not send format metadata +# +CREATE TABLE t1 (a JSON); +INSERT INTO t1 VALUES ('{"a":"b"}'); +SELECT a, JSON_COMPACT(a), COALESCE(a) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a a 252 (format=json) 4294967295 9 Y 144 0 33 +def JSON_COMPACT(a) 251 (format=json) 4294967295 9 Y 128 0 33 +def COALESCE(a) 251 (format=json) 4294967295 9 Y 128 39 33 +a JSON_COMPACT(a) COALESCE(a) +{"a":"b"} {"a":"b"} {"a":"b"} +SELECT JSON_ARRAYAGG(1), JSON_ARRAYAGG(a) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def JSON_ARRAYAGG(1) 252 (format=json) 9437184 3 Y 0 0 33 +def JSON_ARRAYAGG(a) 252 (format=json) 12582912 11 Y 128 0 33 +JSON_ARRAYAGG(1) JSON_ARRAYAGG(a) +[1] [{"a":"b"}] +SELECT JSON_OBJECTAGG('a','b'), JSON_OBJECTAGG('a',a) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def JSON_OBJECTAGG('a','b') 252 (format=json) 9437184 9 Y 0 0 33 +def JSON_OBJECTAGG('a',a) 252 (format=json) 12582912 15 Y 128 0 33 +JSON_OBJECTAGG('a','b') JSON_OBJECTAGG('a',a) +{"a":"b"} {"a":{"a":"b"}} +DROP TABLE t1; +# +# MDEV-27018 IF and COALESCE lose "json" property +# +SELECT json_object('a', (SELECT json_objectagg(b, c) FROM (SELECT 'b','c') d)) AS j FROM DUAL; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def j 250 (format=json) 9437283 16 Y 0 39 33 +j +{"a": {"b":"c"}} +# # End of 10.5 tests # diff --git a/mysql-test/main/type_json.test b/mysql-test/main/type_json.test index 7ab0af20e033f..38754ba6e1e9f 100644 --- a/mysql-test/main/type_json.test +++ b/mysql-test/main/type_json.test @@ -80,14 +80,47 @@ CREATE TABLE t1 ( js2 TEXT CHECK (LENGTH(js2) > 0 AND JSON_VALID(js2)), js3 TEXT CHECK (LENGTH(js2) > 0 OR JSON_VALID(js2)) ) CHARACTER SET utf8; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT * FROM t1; SELECT js0, JSON_COMPACT(js0), JSON_COMPACT('{}') FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t1; + +--echo # +--echo # MDEV-27361 Hybrid functions with JSON arguments do not send format metadata +--echo # + +CREATE TABLE t1 (a JSON); +INSERT INTO t1 VALUES ('{"a":"b"}'); +--disable_view_protocol +--disable_ps_protocol +--enable_metadata +SELECT a, JSON_COMPACT(a), COALESCE(a) FROM t1; +SELECT JSON_ARRAYAGG(1), JSON_ARRAYAGG(a) FROM t1; +SELECT JSON_OBJECTAGG('a','b'), JSON_OBJECTAGG('a',a) FROM t1; +--disable_metadata +--disable_ps_protocol +--enable_view_protocol +DROP TABLE t1; + + +--echo # +--echo # MDEV-27018 IF and COALESCE lose "json" property +--echo # + +--disable_view_protocol +--disable_ps_protocol +--enable_metadata +SELECT json_object('a', (SELECT json_objectagg(b, c) FROM (SELECT 'b','c') d)) AS j FROM DUAL; +--disable_metadata +--disable_ps_protocol +--enable_view_protocol + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/type_nchar.result b/mysql-test/main/type_nchar.result index 97c66d8d9a1e1..5fa1a004aba81 100644 --- a/mysql-test/main/type_nchar.result +++ b/mysql-test/main/type_nchar.result @@ -3,48 +3,48 @@ create table t1 (c nchar(10)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` char(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (c national char(10)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` char(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (c national varchar(10)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (c nvarchar(10)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (c nchar varchar(10)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (c national character varying(10)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (c nchar varying(10)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; diff --git a/mysql-test/main/type_newdecimal.result b/mysql-test/main/type_newdecimal.result index c55938eebf1a6..1aa8c28b44a50 100644 --- a/mysql-test/main/type_newdecimal.result +++ b/mysql-test/main/type_newdecimal.result @@ -59,7 +59,7 @@ t1 CREATE TABLE `t1` ( `if(0, NULL, 1.2)` decimal(2,1) DEFAULT NULL, `if(1, 0.22e1, 1.1)` double NOT NULL, `if(1E0, 1.1, 1.2)` decimal(2,1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 select nullif(1.1, 1.1), nullif(1.1, 1.2), nullif(1.1, 0.11e1), nullif(1.0, 1), nullif(1, 1.0), nullif(1, 1.1); select * from t1; @@ -74,7 +74,7 @@ t1 CREATE TABLE `t1` ( `nullif(1.0, 1)` decimal(2,1) DEFAULT NULL, `nullif(1, 1.0)` int(1) DEFAULT NULL, `nullif(1, 1.1)` int(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a decimal(4,2)); insert ignore into t1 value (10000), (1.1e10), ("11111"), (100000.1); @@ -178,7 +178,7 @@ t1 CREATE TABLE `t1` ( `truncate(-5678.123451,-3)` decimal(4,0) NOT NULL, `abs(-1.1)` decimal(2,1) NOT NULL, `-(-1.1)` decimal(2,1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set session sql_mode='traditional'; select 1e10/0e0; @@ -772,7 +772,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `0.5` decimal(2,1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; select round(1.5),round(2.5); round(1.5) round(2.5) @@ -937,14 +937,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `sl` decimal(5,5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (sl decimal(65, 38)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `sl` decimal(65,38) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 ( f1 decimal unsigned not null default 17.49, @@ -977,7 +977,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f0` decimal(30,30) unsigned zerofill NOT NULL DEFAULT 0.000000000000000000000000000000, `f1` decimal(10,0) unsigned zerofill NOT NULL DEFAULT 0000000000 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; drop procedure if exists wg2; create procedure wg2() @@ -1027,7 +1027,7 @@ t1 CREATE TABLE `t1` ( `my_double` double DEFAULT NULL, `my_varchar` varchar(50) DEFAULT NULL, `my_decimal` decimal(65,30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 SET my_float = 1.175494345e-32, my_double = 1.175494345e-32, my_varchar = '1.175494345e-32'; @@ -1541,7 +1541,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `5.05 / 0.014` decimal(10,6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; 5.05 / 0.014 360.714286 @@ -2035,7 +2035,7 @@ 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 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-20495 Assertion `precision > 0' failed in decimal_bin_size upon CREATE .. SELECT with zerofilled decimal @@ -2046,7 +2046,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `f` decimal(1,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED); CREATE TABLE t2 AS SELECT 0 MOD d AS f FROM t1; @@ -2054,7 +2054,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `f` decimal(1,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1 (d DECIMAL(1,0) ZEROFILL); CREATE TABLE t2 AS SELECT CAST(0 AS UNSIGNED) MOD d AS f FROM t1; @@ -2062,7 +2062,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `f` decimal(1,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED); CREATE TABLE t2 AS SELECT CAST(0 AS UNSIGNED) MOD d AS f FROM t1; @@ -2070,7 +2070,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `f` decimal(1,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; # # MDEV-20560 Assertion `precision > 0' failed in decimal_bin_size upon SELECT with MOD short unsigned decimal @@ -2086,7 +2086,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `f` decimal(1,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; CREATE TABLE t1 (a DECIMAL(1,0) UNSIGNED); INSERT INTO t1 VALUES (1.0),(2.0); @@ -2099,7 +2099,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `f` decimal(1,0) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; # # End of 5.5 tests @@ -2297,7 +2297,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(2,1) DEFAULT 0.0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT '0.1 '); Warnings: @@ -2306,7 +2306,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(2,1) DEFAULT 0.1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT '0.10001 '); Warnings: @@ -2315,7 +2315,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(2,1) DEFAULT 0.1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT '0.10001'); Warnings: @@ -2324,7 +2324,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(2,1) DEFAULT 0.1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT 0.10001); Warnings: @@ -2333,7 +2333,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(2,1) DEFAULT 0.1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT 0.10001e0); Warnings: @@ -2342,7 +2342,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(2,1) DEFAULT 0.1 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-23105 Cast number string with many leading zeros to decimal gives unexpected result @@ -2441,21 +2441,45 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(34,33) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 as select 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 as a; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(39,38) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 as select 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 as a; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(39,38) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # +# MDEV-25317 Assertion `scale <= precision' failed in +# decimal_bin_size And Assertion `scale >= 0 && precision > 0 && scale <= precision' +# failed in decimal_bin_size_inline/decimal_bin_size. +# +SELECT AVG(DISTINCT 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001); +AVG(DISTINCT 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0.00000000000000000000000000000000000000 +CREATE TABLE t1 AS SELECT NULL AS v1; +SELECT 1 FROM t1 GROUP BY v1 ORDER BY AVG ( from_unixtime ( '' ) ) ; +1 +1 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '' +DROP TABLE t1; +SELECT SUM(DISTINCT 0.000000000000000000000000000000000000001); +SUM(DISTINCT 0.000000000000000000000000000000000000001) +0.00000000000000000000000000000000000000 +CREATE TABLE t1 AS SELECT 1.000000000000000000000000000000000 AS a; +ALTER TABLE t1 ADD COLUMN b INT; +SELECT ROUND (a,b) AS c FROM t1 ORDER BY c; +c +NULL +DROP TABLE t1; +# # End of 10.2 tests # # @@ -2488,7 +2512,7 @@ Create Table CREATE TABLE `t2` ( `ca` decimal(29,0) DEFAULT NULL, `LENGTH(FLOOR(a))` int(10) DEFAULT NULL, `LENGTH(CEILING(a))` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9999999999999999999999999999.9999999999 fa -10000000000000000000000000000 ca -9999999999999999999999999999 @@ -2507,7 +2531,7 @@ Create Table CREATE TABLE `t2` ( `ca` decimal(19,0) DEFAULT NULL, `LENGTH(FLOOR(a))` int(10) DEFAULT NULL, `LENGTH(CEILING(a))` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -999999999999999999.9999999999 fa -1000000000000000000 ca -999999999999999999 @@ -2526,7 +2550,7 @@ Create Table CREATE TABLE `t2` ( `ca` bigint(19) DEFAULT NULL, `LENGTH(FLOOR(a))` int(10) DEFAULT NULL, `LENGTH(CEILING(a))` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -99999999999999999.9999999999 fa -100000000000000000 ca -99999999999999999 @@ -2545,7 +2569,7 @@ Create Table CREATE TABLE `t2` ( `ca` bigint(12) DEFAULT NULL, `LENGTH(FLOOR(a))` int(10) DEFAULT NULL, `LENGTH(CEILING(a))` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -9999999999.9999999999 fa -10000000000 ca -9999999999 @@ -2564,7 +2588,7 @@ Create Table CREATE TABLE `t2` ( `ca` bigint(11) DEFAULT NULL, `LENGTH(FLOOR(a))` int(10) DEFAULT NULL, `LENGTH(CEILING(a))` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -999999999.9999999999 fa -1000000000 ca -999999999 @@ -2583,7 +2607,7 @@ Create Table CREATE TABLE `t2` ( `ca` int(10) DEFAULT NULL, `LENGTH(FLOOR(a))` int(10) DEFAULT NULL, `LENGTH(CEILING(a))` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -99999999.9999999999 fa -100000000 ca -99999999 @@ -2602,7 +2626,7 @@ Create Table CREATE TABLE `t2` ( `ca` int(2) DEFAULT NULL, `LENGTH(FLOOR(a))` int(10) DEFAULT NULL, `LENGTH(CEILING(a))` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a -0.9999999999 fa -1 ca 0 @@ -2621,7 +2645,7 @@ Create Table CREATE TABLE `t2` ( `ca` decimal(29,0) unsigned DEFAULT NULL, `LENGTH(FLOOR(a))` int(10) DEFAULT NULL, `LENGTH(CEILING(a))` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0.0000000000 fa 0 ca 0 @@ -2640,7 +2664,7 @@ Create Table CREATE TABLE `t2` ( `ca` decimal(19,0) unsigned DEFAULT NULL, `LENGTH(FLOOR(a))` int(10) DEFAULT NULL, `LENGTH(CEILING(a))` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0.0000000000 fa 0 ca 0 @@ -2659,7 +2683,7 @@ Create Table CREATE TABLE `t2` ( `ca` bigint(18) unsigned DEFAULT NULL, `LENGTH(FLOOR(a))` int(10) DEFAULT NULL, `LENGTH(CEILING(a))` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0.0000000000 fa 0 ca 0 @@ -2678,7 +2702,7 @@ Create Table CREATE TABLE `t2` ( `ca` bigint(11) unsigned DEFAULT NULL, `LENGTH(FLOOR(a))` int(10) DEFAULT NULL, `LENGTH(CEILING(a))` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0.0000000000 fa 0 ca 0 @@ -2697,7 +2721,7 @@ Create Table CREATE TABLE `t2` ( `ca` bigint(10) unsigned DEFAULT NULL, `LENGTH(FLOOR(a))` int(10) DEFAULT NULL, `LENGTH(CEILING(a))` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0.0000000000 fa 0 ca 0 @@ -2716,7 +2740,7 @@ Create Table CREATE TABLE `t2` ( `ca` int(9) unsigned DEFAULT NULL, `LENGTH(FLOOR(a))` int(10) DEFAULT NULL, `LENGTH(CEILING(a))` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0.0000000000 fa 0 ca 0 @@ -2735,7 +2759,7 @@ Create Table CREATE TABLE `t2` ( `ca` int(1) unsigned DEFAULT NULL, `LENGTH(FLOOR(a))` int(10) DEFAULT NULL, `LENGTH(CEILING(a))` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a 0.0000000000 fa 0 ca 0 @@ -2773,7 +2797,7 @@ Create Table CREATE TABLE `t2` ( `a` decimal(38,38) DEFAULT NULL, `FORMAT(a,0)` varchar(2) DEFAULT NULL, `FORMAT(a,38)` varchar(41) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2,t1; # # End of 10.4 tests diff --git a/mysql-test/main/type_newdecimal.test b/mysql-test/main/type_newdecimal.test index 5e4d3b4b84b0b..d30a2f0067b3c 100644 --- a/mysql-test/main/type_newdecimal.test +++ b/mysql-test/main/type_newdecimal.test @@ -587,8 +587,11 @@ select floor(9.999999999999999999999); select floor(-9.999999999999999999999); #-- should return -10 # +#enable_view_protocol in 10.4 +--disable_view_protocol select floor(-999999999999999999999.999); select ceiling(999999999999999999999.999); +--enable_view_protocol # # select 99999999999999999999999999999999999999 mod 3; @@ -606,9 +609,12 @@ select round(99999999999999999.999,3); select round(-99999999999999999.999,3); #-- should return -100000000000000000.000 # +#enable after fix MDEV-28660 +--disable_view_protocol select truncate(99999999999999999999999999999999999999,49); #-- should return 99999999999999999999999999999999999999.000 # +--enable_view_protocol select truncate(99.999999999999999999999999999999999999,49); #-- should return 99.9999999999999999999999999999999 # @@ -860,7 +866,10 @@ select 0/0; # --disable_ps_protocol select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 as x; +#enableview protocol after fix MDEV-28659 +--disable_view_protocol select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 1 as x; +--enable_view_protocol --enable_ps_protocol # # Bug #10004 @@ -943,7 +952,10 @@ drop table t1; # # Bug #10891 (converting to decimal crashes server) # +#enable after fix MDEV-27871 +--disable_view_protocol select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15)); +--enable_view_protocol # # Bug #11708 (conversion to decimal fails in decimal part) @@ -1231,12 +1243,16 @@ DROP TABLE t1; # # Bug #36270: incorrect calculation result - works in 4.1 but not in 5.0 or 5.1 # +#enable after fix MDEV-27871 +--disable_view_protocol # show that if we need to truncate the scale of an operand, we pick the # right one (that is, we discard the least significant decimal places) select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 * 1.01500000 * 1.01500000 * 0.99500000); +--enable_view_protocol + # # Bug #31616 div_precision_increment description looks wrong # @@ -1255,7 +1271,13 @@ DROP TABLE t1; let $nine_81= 999999999999999999999999999999999999999999999999999999999999999999999999999999999; + +#view protocol generates additional warning +--disable_view_protocol eval SELECT substring(('M') FROM ($nine_81)) AS foo; +--enable_view_protocol +#enable after fix MDEV-28661 +--disable_view_protocol eval SELECT min($nine_81) AS foo; eval SELECT multipolygonfromtext(('4294967294.1'),($nine_81)) AS foo; eval SELECT convert(($nine_81), decimal(30,30)) AS foo; @@ -1267,6 +1289,7 @@ eval SELECT date_sub(($nine_81), day_minute) AS foo; eval SELECT truncate($nine_81, 28) AS foo; +--enable_view_protocol --echo End of 5.0 tests @@ -1896,6 +1919,26 @@ show create table t1; drop table t1; +--echo # +--echo # MDEV-25317 Assertion `scale <= precision' failed in +--echo # decimal_bin_size And Assertion `scale >= 0 && precision > 0 && scale <= precision' +--echo # failed in decimal_bin_size_inline/decimal_bin_size. +--echo # +#enable after fix MDEV-27871 +--disable_view_protocol +SELECT AVG(DISTINCT 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001); +--enable_view_protocol +CREATE TABLE t1 AS SELECT NULL AS v1; +SELECT 1 FROM t1 GROUP BY v1 ORDER BY AVG ( from_unixtime ( '' ) ) ; +DROP TABLE t1; + +SELECT SUM(DISTINCT 0.000000000000000000000000000000000000001); + +CREATE TABLE t1 AS SELECT 1.000000000000000000000000000000000 AS a; +ALTER TABLE t1 ADD COLUMN b INT; +SELECT ROUND (a,b) AS c FROM t1 ORDER BY c; +DROP TABLE t1; + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/type_num.result b/mysql-test/main/type_num.result index 2dadb4f1f8d4c..849190b68f4ad 100644 --- a/mysql-test/main/type_num.result +++ b/mysql-test/main/type_num.result @@ -550,22 +550,22 @@ SELECT COUNT(*) FROM t1 WHERE i1='1 '; COUNT(*) 2 Warnings: -Note 1292 Truncated incorrect DOUBLE value: '1 ' +Note 1292 Truncated incorrect DECIMAL value: '1 ' SELECT COUNT(*) FROM t1 WHERE i2='1 '; COUNT(*) 2 Warnings: -Note 1292 Truncated incorrect DOUBLE value: '1 ' +Note 1292 Truncated incorrect DECIMAL value: '1 ' SELECT COUNT(*) FROM t1 WHERE i4='1 '; COUNT(*) 2 Warnings: -Note 1292 Truncated incorrect DOUBLE value: '1 ' +Note 1292 Truncated incorrect DECIMAL value: '1 ' SELECT COUNT(*) FROM t1 WHERE i8='1 '; COUNT(*) 2 Warnings: -Note 1292 Truncated incorrect DOUBLE value: '1 ' +Note 1292 Truncated incorrect DECIMAL value: '1 ' SELECT COUNT(*) FROM t1 WHERE d='1 '; COUNT(*) 2 @@ -585,22 +585,22 @@ SELECT COUNT(*) FROM t1 WHERE i1=''; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SELECT COUNT(*) FROM t1 WHERE i2=''; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SELECT COUNT(*) FROM t1 WHERE i4=''; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SELECT COUNT(*) FROM t1 WHERE i8=''; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SELECT COUNT(*) FROM t1 WHERE d=''; COUNT(*) 2 @@ -620,22 +620,22 @@ SELECT COUNT(*) FROM t1 WHERE i1='x'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'x' SELECT COUNT(*) FROM t1 WHERE i2='x'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'x' SELECT COUNT(*) FROM t1 WHERE i4='x'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'x' SELECT COUNT(*) FROM t1 WHERE i8='x'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'x' SELECT COUNT(*) FROM t1 WHERE d='x'; COUNT(*) 2 @@ -655,22 +655,22 @@ SELECT COUNT(*) FROM t1 WHERE i1=' x'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: ' x' +Warning 1292 Truncated incorrect DECIMAL value: ' x' SELECT COUNT(*) FROM t1 WHERE i2=' x'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: ' x' +Warning 1292 Truncated incorrect DECIMAL value: ' x' SELECT COUNT(*) FROM t1 WHERE i4=' x'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: ' x' +Warning 1292 Truncated incorrect DECIMAL value: ' x' SELECT COUNT(*) FROM t1 WHERE i8=' x'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: ' x' +Warning 1292 Truncated incorrect DECIMAL value: ' x' SELECT COUNT(*) FROM t1 WHERE d=' x'; COUNT(*) 2 @@ -690,22 +690,22 @@ SELECT COUNT(*) FROM t1 WHERE i1='.'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '.' +Warning 1292 Truncated incorrect DECIMAL value: '.' SELECT COUNT(*) FROM t1 WHERE i2='.'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '.' +Warning 1292 Truncated incorrect DECIMAL value: '.' SELECT COUNT(*) FROM t1 WHERE i4='.'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '.' +Warning 1292 Truncated incorrect DECIMAL value: '.' SELECT COUNT(*) FROM t1 WHERE i8='.'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '.' +Warning 1292 Truncated incorrect DECIMAL value: '.' SELECT COUNT(*) FROM t1 WHERE d='.'; COUNT(*) 2 @@ -725,22 +725,22 @@ SELECT COUNT(*) FROM t1 WHERE i1='-'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '-' +Warning 1292 Truncated incorrect DECIMAL value: '-' SELECT COUNT(*) FROM t1 WHERE i2='-'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '-' +Warning 1292 Truncated incorrect DECIMAL value: '-' SELECT COUNT(*) FROM t1 WHERE i4='-'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '-' +Warning 1292 Truncated incorrect DECIMAL value: '-' SELECT COUNT(*) FROM t1 WHERE i8='-'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '-' +Warning 1292 Truncated incorrect DECIMAL value: '-' SELECT COUNT(*) FROM t1 WHERE d='-'; COUNT(*) 2 @@ -760,22 +760,22 @@ SELECT COUNT(*) FROM t1 WHERE i1='+'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '+' +Warning 1292 Truncated incorrect DECIMAL value: '+' SELECT COUNT(*) FROM t1 WHERE i2='+'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '+' +Warning 1292 Truncated incorrect DECIMAL value: '+' SELECT COUNT(*) FROM t1 WHERE i4='+'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '+' +Warning 1292 Truncated incorrect DECIMAL value: '+' SELECT COUNT(*) FROM t1 WHERE i8='+'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '+' +Warning 1292 Truncated incorrect DECIMAL value: '+' SELECT COUNT(*) FROM t1 WHERE d='+'; COUNT(*) 2 @@ -795,22 +795,22 @@ SELECT COUNT(*) FROM t1 WHERE i1='1x'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1x' +Warning 1292 Truncated incorrect DECIMAL value: '1x' SELECT COUNT(*) FROM t1 WHERE i2='1x'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1x' +Warning 1292 Truncated incorrect DECIMAL value: '1x' SELECT COUNT(*) FROM t1 WHERE i4='1x'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1x' +Warning 1292 Truncated incorrect DECIMAL value: '1x' SELECT COUNT(*) FROM t1 WHERE i8='1x'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1x' +Warning 1292 Truncated incorrect DECIMAL value: '1x' SELECT COUNT(*) FROM t1 WHERE d='1x'; COUNT(*) 2 @@ -830,22 +830,22 @@ SELECT COUNT(*) FROM t1 WHERE i1='1e'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1e' +Warning 1292 Truncated incorrect DECIMAL value: '1e' SELECT COUNT(*) FROM t1 WHERE i2='1e'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1e' +Warning 1292 Truncated incorrect DECIMAL value: '1e' SELECT COUNT(*) FROM t1 WHERE i4='1e'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1e' +Warning 1292 Truncated incorrect DECIMAL value: '1e' SELECT COUNT(*) FROM t1 WHERE i8='1e'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1e' +Warning 1292 Truncated incorrect DECIMAL value: '1e' SELECT COUNT(*) FROM t1 WHERE d='1e'; COUNT(*) 2 @@ -865,22 +865,22 @@ SELECT COUNT(*) FROM t1 WHERE i1='1e+'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1e+' +Warning 1292 Truncated incorrect DECIMAL value: '1e+' SELECT COUNT(*) FROM t1 WHERE i2='1e+'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1e+' +Warning 1292 Truncated incorrect DECIMAL value: '1e+' SELECT COUNT(*) FROM t1 WHERE i4='1e+'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1e+' +Warning 1292 Truncated incorrect DECIMAL value: '1e+' SELECT COUNT(*) FROM t1 WHERE i8='1e+'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1e+' +Warning 1292 Truncated incorrect DECIMAL value: '1e+' SELECT COUNT(*) FROM t1 WHERE d='1e+'; COUNT(*) 2 @@ -900,22 +900,22 @@ SELECT COUNT(*) FROM t1 WHERE i1='1E-'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1E-' +Warning 1292 Truncated incorrect DECIMAL value: '1E-' SELECT COUNT(*) FROM t1 WHERE i2='1E-'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1E-' +Warning 1292 Truncated incorrect DECIMAL value: '1E-' SELECT COUNT(*) FROM t1 WHERE i4='1E-'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1E-' +Warning 1292 Truncated incorrect DECIMAL value: '1E-' SELECT COUNT(*) FROM t1 WHERE i8='1E-'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1E-' +Warning 1292 Truncated incorrect DECIMAL value: '1E-' SELECT COUNT(*) FROM t1 WHERE d='1E-'; COUNT(*) 2 @@ -935,22 +935,22 @@ SELECT COUNT(*) FROM t1 WHERE i1='1Ex'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1Ex' +Warning 1292 Truncated incorrect DECIMAL value: '1Ex' SELECT COUNT(*) FROM t1 WHERE i2='1Ex'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1Ex' +Warning 1292 Truncated incorrect DECIMAL value: '1Ex' SELECT COUNT(*) FROM t1 WHERE i4='1Ex'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1Ex' +Warning 1292 Truncated incorrect DECIMAL value: '1Ex' SELECT COUNT(*) FROM t1 WHERE i8='1Ex'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1Ex' +Warning 1292 Truncated incorrect DECIMAL value: '1Ex' SELECT COUNT(*) FROM t1 WHERE d='1Ex'; COUNT(*) 2 @@ -970,22 +970,22 @@ SELECT COUNT(*) FROM t1 WHERE i1='1e+x'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1e+x' +Warning 1292 Truncated incorrect DECIMAL value: '1e+x' SELECT COUNT(*) FROM t1 WHERE i2='1e+x'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1e+x' +Warning 1292 Truncated incorrect DECIMAL value: '1e+x' SELECT COUNT(*) FROM t1 WHERE i4='1e+x'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1e+x' +Warning 1292 Truncated incorrect DECIMAL value: '1e+x' SELECT COUNT(*) FROM t1 WHERE i8='1e+x'; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1e+x' +Warning 1292 Truncated incorrect DECIMAL value: '1e+x' SELECT COUNT(*) FROM t1 WHERE d='1e+x'; COUNT(*) 2 @@ -1005,22 +1005,26 @@ SELECT COUNT(*) FROM t1 WHERE i1='1e1000'; COUNT(*) 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1e1000' +Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated +Warning 1292 Truncated incorrect DECIMAL value: '1e1000' SELECT COUNT(*) FROM t1 WHERE i2='1e1000'; COUNT(*) 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1e1000' +Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated +Warning 1292 Truncated incorrect DECIMAL value: '1e1000' SELECT COUNT(*) FROM t1 WHERE i4='1e1000'; COUNT(*) 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1e1000' +Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated +Warning 1292 Truncated incorrect DECIMAL value: '1e1000' SELECT COUNT(*) FROM t1 WHERE i8='1e1000'; COUNT(*) 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '1e1000' +Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated +Warning 1292 Truncated incorrect DECIMAL value: '1e1000' SELECT COUNT(*) FROM t1 WHERE d='1e1000'; COUNT(*) 0 @@ -1056,7 +1060,7 @@ SELECT COUNT(*) FROM t1 FORCE INDEX(i8) WHERE i8='1 '; COUNT(*) 2 Warnings: -Note 1292 Truncated incorrect DOUBLE value: '1 ' +Note 1292 Truncated incorrect DECIMAL value: '1 ' SELECT COUNT(*) FROM t1 FORCE INDEX(d) WHERE d='1 '; COUNT(*) 2 @@ -1081,7 +1085,7 @@ SELECT COUNT(*) FROM t1 FORCE INDEX(i8) WHERE i8=''; COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SELECT COUNT(*) FROM t1 FORCE INDEX(d) WHERE d=''; COUNT(*) 2 diff --git a/mysql-test/main/type_num.test b/mysql-test/main/type_num.test index cc715d6cda2d4..251734e4d1bea 100644 --- a/mysql-test/main/type_num.test +++ b/mysql-test/main/type_num.test @@ -687,6 +687,7 @@ SELECT --echo # --disable_ps_protocol +--disable_view_protocol --enable_metadata SELECT NULL+1 AS c0, COALESCE(NULL)+1 AS c2, @@ -696,6 +697,7 @@ SELECT NULL+1 AS c0, COALESCE(COALESCE(''))+1 AS c6; --disable_metadata --enable_ps_protocol +--enable_view_protocol --echo # --echo # Start of 10.2 tests diff --git a/mysql-test/main/type_num_innodb.result b/mysql-test/main/type_num_innodb.result index 581a387b2e8f3..92dc705de9030 100644 --- a/mysql-test/main/type_num_innodb.result +++ b/mysql-test/main/type_num_innodb.result @@ -46,39 +46,22 @@ ALTER TABLE t1 MODIFY a DECIMAL(10,0); SELECT * FROM t1,t2 WHERE a=d; a b c pk d e Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'd' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'd' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'f' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'f' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'g' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'k' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'm' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'm' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'm' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'o' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'q' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'r' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'u' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'w' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'x' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'x' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 'y' ALTER TABLE t1 MODIFY a DOUBLE; SELECT * FROM t1,t2 WHERE a=d; diff --git a/mysql-test/main/type_row.result b/mysql-test/main/type_row.result index dc74cfc88a405..45f4fd895bf71 100644 --- a/mysql-test/main/type_row.result +++ b/mysql-test/main/type_row.result @@ -49,3 +49,26 @@ ERROR HY000: Illegal parameter data types row and int for operation 'MOD' # # End of 10.5 tests # +# +# Start of 10.7 tests +# +# +# MDEV-29356 Assertion `0' failed in Type_handler_row::Item_save_in_field on INSERT +# +SET sql_mode=''; +CREATE TABLE t1 (c1 INT,c2 INT); +CREATE TRIGGER t BEFORE INSERT ON t1 FOR EACH ROW SET NEW.c1=(SELECT * FROM t1); +INSERT INTO t1 VALUES (0,0); +ERROR HY000: Cannot cast 'row' as 'int' in assignment of `test`.`t1`.`c1` +DROP TABLE t1; +SET sql_mode=DEFAULT; +SET sql_mode=''; +CREATE TABLE t1 (c1 INT,c2 INT) ENGINE=MyISAM; +CREATE TRIGGER t BEFORE INSERT ON t1 FOR EACH ROW SET NEW.c1=ROW(1,1); +INSERT INTO t1 VALUES (0,0); +ERROR HY000: Cannot cast 'row' as 'int' in assignment of `test`.`t1`.`c1` +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/type_row.test b/mysql-test/main/type_row.test index 2a5902351e20d..6f8312d5f18e7 100644 --- a/mysql-test/main/type_row.test +++ b/mysql-test/main/type_row.test @@ -60,3 +60,31 @@ SELECT ROW(1,1) % 1; --echo # --echo # End of 10.5 tests --echo # + +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-29356 Assertion `0' failed in Type_handler_row::Item_save_in_field on INSERT +--echo # + +SET sql_mode=''; +CREATE TABLE t1 (c1 INT,c2 INT); +CREATE TRIGGER t BEFORE INSERT ON t1 FOR EACH ROW SET NEW.c1=(SELECT * FROM t1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +INSERT INTO t1 VALUES (0,0); +DROP TABLE t1; +SET sql_mode=DEFAULT; + +SET sql_mode=''; +CREATE TABLE t1 (c1 INT,c2 INT) ENGINE=MyISAM; +CREATE TRIGGER t BEFORE INSERT ON t1 FOR EACH ROW SET NEW.c1=ROW(1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +INSERT INTO t1 VALUES (0,0); +DROP TABLE t1; +SET sql_mode=DEFAULT; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/main/type_set.result b/mysql-test/main/type_set.result index 5f54521c9dc80..571e0d36eafee 100644 --- a/mysql-test/main/type_set.result +++ b/mysql-test/main/type_set.result @@ -4,14 +4,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` set('','a','b') NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a set (' ','a','b ') not null default 'b '); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` set('','a','b') NOT NULL DEFAULT 'b' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 ( user varchar(64) NOT NULL default '', path varchar(255) NOT NULL default '', privilege set('select','RESERVED30','RESERVED29','RESERVED28','RESERVED27','RESERVED26', 'RESERVED25','RESERVED24','data.delete','RESERVED22','RESERVED21', 'RESERVED20','data.insert.none','data.insert.approve', 'data.insert.delete','data.insert.move','data.insert.propose', 'data.insert.reject','RESERVED13','RESERVED12','RESERVED11','RESERVED10', 'RESERVED09','data.update','RESERVED07','RESERVED06','RESERVED05', 'RESERVED04','metadata.delete','metadata.put','RESERVED01','RESERVED00') NOT NULL default '', KEY user (user) ) ENGINE=MyISAM CHARSET=utf8; DROP TABLE t1; @@ -21,7 +21,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `s` set('a','A') CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a'),('a,A'),('A,a'),('A'); select s from t1 order by s; s @@ -84,7 +84,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1') DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1(c set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64')); INSERT INTO t1 VALUES(7); @@ -373,9 +373,40 @@ t2 CREATE TABLE `t2` ( `CEILING(a)` int(5) unsigned DEFAULT NULL, `TRUNCATE(a,0)` int(5) unsigned DEFAULT NULL, `ROUND(a)` int(5) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a FLOOR(a) CEILING(a) TRUNCATE(a,0) ROUND(a) 999999999999999999999999999999999999999999999999999999999999 1 1 1 1 DROP TABLE t2; DROP TABLE t1; +# +# MDEV-29062 Wrong result set metadata for a mix of INT+ENUM +# +CREATE TABLE t1 +( +c_int INT, +c_set SET('1') +); +CREATE TABLE t2 AS SELECT c_int FROM t1 UNION SELECT c_set FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c_int` varchar(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2; +CREATE OR REPLACE TABLE t2 AS SELECT COALESCE(c_int, c_set) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(c_int, c_set)` varchar(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2; +SELECT c_int FROM t1 UNION SELECT c_set FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c_int c_int 253 33 0 Y 0 0 33 +c_int +SELECT COALESCE(c_int, c_set) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c_int, c_set) 253 33 0 Y 0 39 33 +COALESCE(c_int, c_set) +DROP TABLE t1; diff --git a/mysql-test/main/type_set.test b/mysql-test/main/type_set.test index 2d0c81340ae33..0ef2d158c4d4d 100644 --- a/mysql-test/main/type_set.test +++ b/mysql-test/main/type_set.test @@ -261,3 +261,33 @@ SHOW CREATE TABLE t2; SELECT * FROM t2; DROP TABLE t2; DROP TABLE t1; + + +--echo # +--echo # MDEV-29062 Wrong result set metadata for a mix of INT+ENUM +--echo # + +CREATE TABLE t1 +( + c_int INT, + c_set SET('1') +); + +CREATE TABLE t2 AS SELECT c_int FROM t1 UNION SELECT c_set FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +CREATE OR REPLACE TABLE t2 AS SELECT COALESCE(c_int, c_set) FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +--disable_view_protocol +--disable_ps_protocol +--enable_metadata +SELECT c_int FROM t1 UNION SELECT c_set FROM t1; +SELECT COALESCE(c_int, c_set) FROM t1; +--disable_metadata +--enable_ps_protocol +--enable_view_protocol + +DROP TABLE t1; diff --git a/mysql-test/main/type_temporal_mariadb53.result b/mysql-test/main/type_temporal_mariadb53.result index 140c74ac836fe..2e517feff0095 100644 --- a/mysql-test/main/type_temporal_mariadb53.result +++ b/mysql-test/main/type_temporal_mariadb53.result @@ -12,7 +12,7 @@ mariadb5312_datetime CREATE TABLE `mariadb5312_datetime` ( `t4` datetime(4) /* mariadb-5.3 */ DEFAULT NULL, `t5` datetime(5) /* mariadb-5.3 */ DEFAULT NULL, `t6` datetime(6) /* mariadb-5.3 */ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='mariadb5312_datetime'; COLUMN_NAME t0 DATA_TYPE datetime @@ -90,7 +90,7 @@ mariadb5312_timestamp CREATE TABLE `mariadb5312_timestamp` ( `t4` timestamp(4) /* mariadb-5.3 */ NOT NULL DEFAULT '0000-00-00 00:00:00.0000', `t5` timestamp(5) /* mariadb-5.3 */ NOT NULL DEFAULT '0000-00-00 00:00:00.00000', `t6` timestamp(6) /* mariadb-5.3 */ NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='mariadb5312_timestamp'; COLUMN_NAME t0 DATA_TYPE timestamp @@ -168,7 +168,7 @@ mariadb5312_time CREATE TABLE `mariadb5312_time` ( `t4` time(4) /* mariadb-5.3 */ DEFAULT NULL, `t5` time(5) /* mariadb-5.3 */ DEFAULT NULL, `t6` time(6) /* mariadb-5.3 */ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='mariadb5312_time'; COLUMN_NAME t0 DATA_TYPE time diff --git a/mysql-test/main/type_temporal_mysql56.result b/mysql-test/main/type_temporal_mysql56.result index cdc951dac1407..0208fd524f6f2 100644 --- a/mysql-test/main/type_temporal_mysql56.result +++ b/mysql-test/main/type_temporal_mysql56.result @@ -8,7 +8,7 @@ mysql56time CREATE TABLE `mysql56time` ( `t4` time(4) DEFAULT NULL, `t5` time(5) DEFAULT NULL, `t6` time(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM mysql56time; t0 838:59:59 t1 838:59:59.0 @@ -42,7 +42,7 @@ mysql56datetime CREATE TABLE `mysql56datetime` ( `dt4` datetime(4) DEFAULT NULL, `dt5` datetime(5) DEFAULT NULL, `dt6` datetime(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM mysql56datetime; dt0 0000-00-00 00:00:00 dt1 0000-00-00 00:00:00.0 @@ -70,7 +70,7 @@ mysql56timestamp CREATE TABLE `mysql56timestamp` ( `ts4` timestamp(4) NOT NULL DEFAULT '0000-00-00 00:00:00.0000', `ts5` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000', `ts6` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM mysql56timestamp; ts0 1970-01-01 00:00:01 ts1 1970-01-01 00:00:01.0 diff --git a/mysql-test/main/type_temporal_mysql56_debug.result b/mysql-test/main/type_temporal_mysql56_debug.result index a93ec82fa4d30..24fbc511aef59 100644 --- a/mysql-test/main/type_temporal_mysql56_debug.result +++ b/mysql-test/main/type_temporal_mysql56_debug.result @@ -68,7 +68,7 @@ t1 CREATE TABLE `t1` ( `a4` time(4) /* mysql-5.6 */ DEFAULT NULL, `a5` time(5) /* mysql-5.6 */ DEFAULT NULL, `a6` time(6) /* mysql-5.6 */ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # CREATE..SELECT and SHOW Table Create Table @@ -87,7 +87,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(a4)` time(4) /* mysql-5.6 */ DEFAULT NULL, `COALESCE(a5)` time(5) /* mysql-5.6 */ DEFAULT NULL, `COALESCE(a6)` time(6) /* mysql-5.6 */ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # ALTER..FORCE and SHOW Table Create Table @@ -99,7 +99,7 @@ t1 CREATE TABLE `t1` ( `a4` time(4) /* mysql-5.6 */ DEFAULT NULL, `a5` time(5) /* mysql-5.6 */ DEFAULT NULL, `a6` time(6) /* mysql-5.6 */ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Setting @@global.mysql56_temporal_format=false @@ -120,7 +120,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(a4)` time(4) /* mariadb-5.3 */ DEFAULT NULL, `COALESCE(a5)` time(5) /* mariadb-5.3 */ DEFAULT NULL, `COALESCE(a6)` time(6) /* mariadb-5.3 */ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # ALTER..FORCE and SHOW Table Create Table @@ -132,7 +132,7 @@ t1 CREATE TABLE `t1` ( `a4` time(4) /* mariadb-5.3 */ DEFAULT NULL, `a5` time(5) /* mariadb-5.3 */ DEFAULT NULL, `a6` time(6) /* mariadb-5.3 */ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Setting @@global.mysql56_temporal_format=true @@ -153,7 +153,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(a4)` time(4) /* mysql-5.6 */ DEFAULT NULL, `COALESCE(a5)` time(5) /* mysql-5.6 */ DEFAULT NULL, `COALESCE(a6)` time(6) /* mysql-5.6 */ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # ALTER..FORCE and SHOW Table Create Table @@ -165,7 +165,7 @@ t1 CREATE TABLE `t1` ( `a4` time(4) /* mysql-5.6 */ DEFAULT NULL, `a5` time(5) /* mysql-5.6 */ DEFAULT NULL, `a6` time(6) /* mysql-5.6 */ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a0 DATETIME, @@ -188,7 +188,7 @@ t1 CREATE TABLE `t1` ( `a4` datetime(4) /* mysql-5.6 */ DEFAULT NULL, `a5` datetime(5) /* mysql-5.6 */ DEFAULT NULL, `a6` datetime(6) /* mysql-5.6 */ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # CREATE..SELECT and SHOW Table Create Table @@ -207,7 +207,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(a4)` datetime(4) /* mysql-5.6 */ DEFAULT NULL, `COALESCE(a5)` datetime(5) /* mysql-5.6 */ DEFAULT NULL, `COALESCE(a6)` datetime(6) /* mysql-5.6 */ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # ALTER..FORCE and SHOW Table Create Table @@ -219,7 +219,7 @@ t1 CREATE TABLE `t1` ( `a4` datetime(4) /* mysql-5.6 */ DEFAULT NULL, `a5` datetime(5) /* mysql-5.6 */ DEFAULT NULL, `a6` datetime(6) /* mysql-5.6 */ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Setting @@global.mysql56_temporal_format=false @@ -240,7 +240,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(a4)` datetime(4) /* mariadb-5.3 */ DEFAULT NULL, `COALESCE(a5)` datetime(5) /* mariadb-5.3 */ DEFAULT NULL, `COALESCE(a6)` datetime(6) /* mariadb-5.3 */ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # ALTER..FORCE and SHOW Table Create Table @@ -252,7 +252,7 @@ t1 CREATE TABLE `t1` ( `a4` datetime(4) /* mariadb-5.3 */ DEFAULT NULL, `a5` datetime(5) /* mariadb-5.3 */ DEFAULT NULL, `a6` datetime(6) /* mariadb-5.3 */ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Setting @@global.mysql56_temporal_format=true @@ -273,7 +273,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(a4)` datetime(4) /* mysql-5.6 */ DEFAULT NULL, `COALESCE(a5)` datetime(5) /* mysql-5.6 */ DEFAULT NULL, `COALESCE(a6)` datetime(6) /* mysql-5.6 */ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # ALTER..FORCE and SHOW Table Create Table @@ -285,7 +285,7 @@ t1 CREATE TABLE `t1` ( `a4` datetime(4) /* mysql-5.6 */ DEFAULT NULL, `a5` datetime(5) /* mysql-5.6 */ DEFAULT NULL, `a6` datetime(6) /* mysql-5.6 */ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a0 TIMESTAMP, @@ -308,7 +308,7 @@ t1 CREATE TABLE `t1` ( `a4` timestamp(4) /* mysql-5.6 */ NOT NULL DEFAULT '0000-00-00 00:00:00.0000', `a5` timestamp(5) /* mysql-5.6 */ NOT NULL DEFAULT '0000-00-00 00:00:00.00000', `a6` timestamp(6) /* mysql-5.6 */ NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # CREATE..SELECT and SHOW Table Create Table @@ -327,7 +327,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(a4)` timestamp(4) /* mysql-5.6 */ NULL DEFAULT NULL, `COALESCE(a5)` timestamp(5) /* mysql-5.6 */ NULL DEFAULT NULL, `COALESCE(a6)` timestamp(6) /* mysql-5.6 */ NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # ALTER..FORCE and SHOW Table Create Table @@ -339,7 +339,7 @@ t1 CREATE TABLE `t1` ( `a4` timestamp(4) /* mysql-5.6 */ NOT NULL DEFAULT '0000-00-00 00:00:00.0000', `a5` timestamp(5) /* mysql-5.6 */ NOT NULL DEFAULT '0000-00-00 00:00:00.00000', `a6` timestamp(6) /* mysql-5.6 */ NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Setting @@global.mysql56_temporal_format=false @@ -360,7 +360,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(a4)` timestamp(4) /* mariadb-5.3 */ NULL DEFAULT NULL, `COALESCE(a5)` timestamp(5) /* mariadb-5.3 */ NULL DEFAULT NULL, `COALESCE(a6)` timestamp(6) /* mariadb-5.3 */ NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # ALTER..FORCE and SHOW Table Create Table @@ -372,7 +372,7 @@ t1 CREATE TABLE `t1` ( `a4` timestamp(4) /* mariadb-5.3 */ NOT NULL DEFAULT '0000-00-00 00:00:00.0000', `a5` timestamp(5) /* mariadb-5.3 */ NOT NULL DEFAULT '0000-00-00 00:00:00.00000', `a6` timestamp(6) /* mariadb-5.3 */ NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Setting @@global.mysql56_temporal_format=true @@ -393,7 +393,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(a4)` timestamp(4) /* mysql-5.6 */ NULL DEFAULT NULL, `COALESCE(a5)` timestamp(5) /* mysql-5.6 */ NULL DEFAULT NULL, `COALESCE(a6)` timestamp(6) /* mysql-5.6 */ NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # ALTER..FORCE and SHOW Table Create Table @@ -405,7 +405,7 @@ t1 CREATE TABLE `t1` ( `a4` timestamp(4) /* mysql-5.6 */ NOT NULL DEFAULT '0000-00-00 00:00:00.0000', `a5` timestamp(5) /* mysql-5.6 */ NOT NULL DEFAULT '0000-00-00 00:00:00.00000', `a6` timestamp(6) /* mysql-5.6 */ NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET @@global.mysql56_temporal_format=DEFAULT; DROP PROCEDURE mdev16542; diff --git a/mysql-test/main/type_time.result b/mysql-test/main/type_time.result index 40746345bdf06..a863eaea6862f 100644 --- a/mysql-test/main/type_time.result +++ b/mysql-test/main/type_time.result @@ -2420,5 +2420,31 @@ SET @@global.mysql56_temporal_format=default; DROP PROCEDURE p1; SET timestamp=DEFAULT; # +# MDEV-26765 UNIX_TIMESTAMP(CURRENT_TIME()) return null ?!? +# +SET @@time_zone='+00:00'; +SET timestamp=1234567; +SELECT CURRENT_TIMESTAMP; +CURRENT_TIMESTAMP +1970-01-15 06:56:07 +SELECT UNIX_TIMESTAMP(CURRENT_TIME()); +UNIX_TIMESTAMP(CURRENT_TIME()) +1234567 +SELECT UNIX_TIMESTAMP(TIME'06:56:07'); +UNIX_TIMESTAMP(TIME'06:56:07') +1234567 +SELECT UNIX_TIMESTAMP(TIME'10:20:30'); +UNIX_TIMESTAMP(TIME'10:20:30') +1246830 +CREATE OR REPLACE TABLE t1 (a TIME); +INSERT INTO t1 VALUES (TIME'06:56:07'),('10:20:30'); +SELECT UNIX_TIMESTAMP(a) FROM t1 ORDER BY a; +UNIX_TIMESTAMP(a) +1234567 +1246830 +DROP TABLE t1; +SET @@time_zone=DEFAULT; +SET TIMESTAMP=DEFAULT; +# # End of 10.4 tests # diff --git a/mysql-test/main/type_time.test b/mysql-test/main/type_time.test index 0739348fcf0e7..9ed5c3a73dce1 100644 --- a/mysql-test/main/type_time.test +++ b/mysql-test/main/type_time.test @@ -134,9 +134,12 @@ drop table t1; --echo # --echo # MDEV-4634 Crash in CONVERT_TZ --echo # +#enable after fix MDEV-27871 +--disable_view_protocol SET timestamp=unix_timestamp('2001-02-03 10:20:30'); SELECT CONVERT_TZ(GREATEST(TIME('00:00:00'),TIME('00:00:00')),'+00:00','+7:5'); SET timestamp=DEFAULT; +--enable_view_protocol --echo # --echo # MDEV-4652 Wrong result for CONCAT(GREATEST(TIME('00:00:01'),TIME('00:00:00'))) @@ -851,7 +854,10 @@ DROP TABLE t1; --echo # SET timestamp=UNIX_TIMESTAMP('2001-01-01 00:00:00'); SELECT TIME'10:20:30' IN (102030,TIME'10:20:31'); +#enable after fix MDEV-27871 +--disable_view_protocol SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32'); +--enable_view_protocol CREATE TABLE t1 (a TIME); INSERT INTO t1 VALUES ('10:20:30'),('10:20:31'),('10:20:32'); SELECT a FROM t1 WHERE a IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') ORDER BY a; @@ -1560,6 +1566,25 @@ SET @@global.mysql56_temporal_format=default; DROP PROCEDURE p1; SET timestamp=DEFAULT; +--echo # +--echo # MDEV-26765 UNIX_TIMESTAMP(CURRENT_TIME()) return null ?!? +--echo # + +SET @@time_zone='+00:00'; +SET timestamp=1234567; +SELECT CURRENT_TIMESTAMP; +SELECT UNIX_TIMESTAMP(CURRENT_TIME()); +SELECT UNIX_TIMESTAMP(TIME'06:56:07'); +SELECT UNIX_TIMESTAMP(TIME'10:20:30'); +CREATE OR REPLACE TABLE t1 (a TIME); +INSERT INTO t1 VALUES (TIME'06:56:07'),('10:20:30'); +SELECT UNIX_TIMESTAMP(a) FROM t1 ORDER BY a; +DROP TABLE t1; + +SET @@time_zone=DEFAULT; +SET TIMESTAMP=DEFAULT; + + --echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/type_time_hires.result b/mysql-test/main/type_time_hires.result index 661ca0e98f5aa..ed00a8d473de3 100644 --- a/mysql-test/main/type_time_hires.result +++ b/mysql-test/main/type_time_hires.result @@ -75,7 +75,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time(4) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show columns from t1; Field Type Null Key Default Extra a time(4) YES NULL @@ -129,12 +129,12 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` time(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `a` time(4) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2, t3; insert t1 values ('2010-12-13 14:15:16.222222'); Warnings: @@ -156,7 +156,7 @@ t2 CREATE TABLE `t2` ( `a-1` decimal(12,4) DEFAULT NULL, `a*1` decimal(12,4) DEFAULT NULL, `a/2` decimal(15,8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t3; Table Create Table t3 CREATE TABLE `t3` ( @@ -164,7 +164,7 @@ t3 CREATE TABLE `t3` ( `min(a)` time(4) DEFAULT NULL, `sum(a)` decimal(33,4) DEFAULT NULL, `avg(a)` decimal(15,8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2, t3; create table t1 (f0_time time(0), f1_time time(1), f2_time time(2), f3_time time(3), f4_time time(4), f5_time time(5), f6_time time(6)); insert t1 values ( '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432'); @@ -314,7 +314,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` time(6) DEFAULT NULL, `b` time(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t2; a b 03:04:06.234500 03:04:06.234561 @@ -360,7 +360,7 @@ select cast(1e-6 as time(6)); cast(1e-6 as time(6)) 00:00:00.000001 # -# Start of 10.4 tests +# End of 5.5 tests # # # MDEV-20397 Support TIMESTAMP, DATETIME, TIME in ROUND() and TRUNCATE() @@ -379,7 +379,7 @@ t2 CREATE TABLE `t2` ( `r2` time NOT NULL, `t1` time DEFAULT NULL, `t2` time NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a TIME(6)); @@ -681,7 +681,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `FLOOR(TIME'00:00:00.999999')` time NOT NULL, `CEILING(TIME'00:00:00.999999')` time NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIME(6)); INSERT INTO t1 VALUES ('838:59:59.999999'); @@ -907,3 +907,14 @@ a CEILING(a) CEILING_SP(a) CEILING(a)=CEILING_SP(a) DROP FUNCTION FLOOR_SP; DROP FUNCTION CEILING_SP; DROP TABLE t1; +# +# MDEV-29924 Assertion `(((nr) % (1LL << 24)) % (int) log_10_int[6 - dec]) == 0' failed in my_time_packed_to_binary on SELECT when using TIME field +# +create table t1 (c decimal(3,1),d time(6)); +insert into t1 values (null,0.1),(null,0.1), (0.1,0.2); +select c from t1 where c= '2010-02-01 09:31:02.0'; SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0'; -CREATE TABLE t2 ( a TIMESTAMP, KEY ( a DESC ) ); +CREATE TABLE t2 ( a TIMESTAMP, KEY ( a ) ); INSERT INTO t2 VALUES( '2010-02-01 09:31:01' ); INSERT INTO t2 VALUES( '2010-02-01 09:31:02' ); @@ -717,10 +717,13 @@ SET sql_mode=DEFAULT; --echo # MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY --echo # +#double warning +--disable_view_protocol 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; +--enable_view_protocol --echo # --echo # MDEV-17972 Assertion `is_valid_value_slow()' failed in Datetime::Datetime @@ -874,7 +877,44 @@ SELECT CASE WHEN a THEN DEFAULT(a) END FROM t1; DROP TABLE t1; SET timestamp=DEFAULT; +--echo # +--echo # MDEV-27653 long uniques don't work with unicode collations +--echo # + +CREATE TABLE t1 (a timestamp, UNIQUE KEY(a) USING HASH); +SET time_zone='+00:00'; +INSERT INTO t1 VALUES ('2001-01-01 10:20:30'); +SET time_zone='+01:00'; +--error ER_DUP_ENTRY +INSERT INTO t1 SELECT MAX(a) FROM t1; +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a timestamp, UNIQUE KEY(a) USING HASH); +SET time_zone='+00:00'; +INSERT INTO t1 VALUES ('2001-01-01 10:20:30'); +SET time_zone='+01:00'; +CHECK TABLE t1; +DROP TABLE t1; +SET time_zone=DEFAULT; --echo # --echo # End of 10.4 tests --echo # + +--echo # +--echo # MDEV-29225 make explicit_defaults_for_timestamps SESSION variable +--echo # + +set explicit_defaults_for_timestamp=OFF; +create table t1 (f1 timestamp, f2 timestamp); +show create table t1; +drop table t1; +set explicit_defaults_for_timestamp=ON; +create table t1 (f1 timestamp, f2 timestamp); +show create table t1; +drop table t1; + +--echo # +--echo # End of 10.10 tests +--echo # diff --git a/mysql-test/main/type_timestamp_hires.result b/mysql-test/main/type_timestamp_hires.result index 64675ff997381..b3b7a008083e3 100644 --- a/mysql-test/main/type_timestamp_hires.result +++ b/mysql-test/main/type_timestamp_hires.result @@ -65,7 +65,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp(4) NOT NULL DEFAULT current_timestamp(4) ON UPDATE current_timestamp(4) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show columns from t1; Field Type Null Key Default Extra a timestamp(4) NO current_timestamp(4) on update current_timestamp(4) @@ -110,12 +110,12 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` timestamp(4) NOT NULL DEFAULT current_timestamp(4) ON UPDATE current_timestamp(4) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `a` timestamp(4) NOT NULL DEFAULT current_timestamp(4) ON UPDATE current_timestamp(4) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2, t3; insert t1 values ('2010-12-13 14:15:16.222222'); select a, a+0, a-1, a*1, a/2 from t1; @@ -135,7 +135,7 @@ t2 CREATE TABLE `t2` ( `a-1` decimal(19,4) NOT NULL, `a*1` decimal(19,4) NOT NULL, `a/2` decimal(22,8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t3; Table Create Table t3 CREATE TABLE `t3` ( @@ -143,7 +143,7 @@ t3 CREATE TABLE `t3` ( `min(a)` timestamp(4) NULL DEFAULT NULL, `sum(a)` decimal(40,4) DEFAULT NULL, `avg(a)` decimal(22,8) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2, t3; create table t1 (f0_timestamp timestamp(0), f1_timestamp timestamp(1), f2_timestamp timestamp(2), f3_timestamp timestamp(3), f4_timestamp timestamp(4), f5_timestamp timestamp(5), f6_timestamp timestamp(6)); insert t1 values ( '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432'); @@ -256,7 +256,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', `b` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t2; a b 2010-02-03 04:05:06.000000 2010-02-03 04:05:06.789100 @@ -277,19 +277,19 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp(5) NOT NULL DEFAULT current_timestamp(5) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 (a timestamp(5) default current_timestamp()); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp(5) NOT NULL DEFAULT current_timestamp(5) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 (a timestamp(5) default current_timestamp(2)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp(5) NOT NULL DEFAULT current_timestamp(2) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert t1 () values (); select * from t1; a @@ -299,25 +299,25 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp(5) NOT NULL DEFAULT current_timestamp(5) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 (a timestamp(5) default current_timestamp(6)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp(5) NOT NULL DEFAULT current_timestamp(5) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 (a timestamp(5) on update current_timestamp); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE current_timestamp(5) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 (a timestamp(5) on update current_timestamp()); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE current_timestamp(5) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 (a timestamp(5) on update current_timestamp(3)); ERROR HY000: Invalid ON UPDATE clause for 'a' column create or replace table t1 (a timestamp(5) on update current_timestamp(5)); @@ -325,13 +325,13 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE current_timestamp(5) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 (a timestamp(5) on update current_timestamp(6)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE current_timestamp(5) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # # Start of 10.4 tests @@ -355,7 +355,7 @@ t2 CREATE TABLE `t2` ( `r2` datetime DEFAULT NULL, `t1` datetime DEFAULT NULL, `t2` datetime NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; SET time_zone='+00:00'; @@ -635,7 +635,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `FLOOR(a)` datetime DEFAULT NULL, `CEILING(a)` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; # # End of 10.4 tests diff --git a/mysql-test/main/type_uint.result b/mysql-test/main/type_uint.result index ef7a7ed98cae3..7a90d6f0689cd 100644 --- a/mysql-test/main/type_uint.result +++ b/mysql-test/main/type_uint.result @@ -25,7 +25,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t2; a 1 diff --git a/mysql-test/main/type_varchar.result b/mysql-test/main/type_varchar.result index cfc8218b8ab84..ea31dddabda68 100644 --- a/mysql-test/main/type_varchar.result +++ b/mysql-test/main/type_varchar.result @@ -8,7 +8,7 @@ t1 CREATE TABLE `t1` ( `c` char(3) DEFAULT NULL, `e` enum('abc','def','ghi') DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table vchar; Table Create Table vchar CREATE TABLE `vchar` ( @@ -16,7 +16,7 @@ vchar CREATE TABLE `vchar` ( `c` char(3) DEFAULT NULL, `e` enum('abc','def','ghi') DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc', 'de', 'ghi', 'jkl'); insert into t1 values ('abc ', 'de ', 'ghi', 'jkl '); insert into t1 values ('abc ', 'd ', 'ghi', 'jkl '); @@ -42,7 +42,7 @@ vchar CREATE TABLE `vchar` ( `e` enum('abc','def','ghi') DEFAULT NULL, `t` text DEFAULT NULL, `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select length(v),length(c),length(e),length(t) from vchar; length(v) length(c) length(e) length(t) 3 2 3 3 @@ -399,21 +399,21 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` varchar(65500) DEFAULT NULL, KEY `index1` (`f1`(10)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify f1 varchar(255); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` varchar(255) DEFAULT NULL, KEY `index1` (`f1`(10)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify f1 tinytext; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` tinytext DEFAULT NULL, KEY `index1` (`f1`(10)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; DROP TABLE IF EXISTS t1; CREATE TABLE t1(f1 VARCHAR(100) DEFAULT 'test'); @@ -476,7 +476,6 @@ a (a DIV 2) t 0 Warnings: Warning 1292 Truncated incorrect DECIMAL value: '1a' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: 't ' SELECT a,CAST(a AS SIGNED) FROM t1 ORDER BY a; a CAST(a AS SIGNED) @@ -498,8 +497,8 @@ SELECT 5 = a FROM t1; 0 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 's' -Warning 1292 Truncated incorrect DOUBLE value: '' +Warning 1292 Truncated incorrect DECIMAL value: 's' +Warning 1292 Truncated incorrect DECIMAL value: '' DROP TABLE t1; CREATE TABLE t1 (a CHAR(16)); INSERT INTO t1 VALUES ('5'), ('s'), (''); @@ -509,8 +508,8 @@ SELECT 5 = a FROM t1; 0 0 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 's ' -Warning 1292 Truncated incorrect DOUBLE value: ' ' +Warning 1292 Truncated incorrect DECIMAL value: 's ' +Warning 1292 Truncated incorrect DECIMAL value: ' ' DROP TABLE t1; # # MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 @@ -753,7 +752,7 @@ vchar CREATE TABLE `vchar` ( `c` char(3) DEFAULT NULL, `e` enum('abc','def','ghi') DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE vchar ADD FULLTEXT INDEX(v); SHOW CREATE TABLE vchar; Table Create Table @@ -763,7 +762,7 @@ vchar CREATE TABLE `vchar` ( `e` enum('abc','def','ghi') DEFAULT NULL, `t` text DEFAULT NULL, FULLTEXT KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE vchar; # # End of 10.5 tests diff --git a/mysql-test/main/type_varchar_mysql41.result b/mysql-test/main/type_varchar_mysql41.result index 116e29a27c52a..cc7f663d70901 100644 --- a/mysql-test/main/type_varchar_mysql41.result +++ b/mysql-test/main/type_varchar_mysql41.result @@ -40,37 +40,37 @@ t1old CREATE TABLE `t1old` ( `c` char(3) DEFAULT NULL, `e` enum('abc','def','ghi') DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CALL p1('v'); Table Create Table t2_simple CREATE TABLE `t2_simple` ( `v` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Table Create Table t2_union_vv CREATE TABLE `t2_union_vv` ( `v` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Table Create Table t2_union_vn CREATE TABLE `t2_union_vn` ( `v` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Table Create Table t2_union_nv CREATE TABLE `t2_union_nv` ( `v` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(v)` varchar(30) DEFAULT NULL, `COALESCE(v,v)` varchar(30) DEFAULT NULL, `COALESCE(v,NULL)` varchar(30) DEFAULT NULL, `COALESCE(NULL,v)` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Table Create Table t2 CREATE TABLE `t2` ( `LEAST(v,v)` varchar(30) DEFAULT NULL, `LEAST(v,NULL)` varchar(30) DEFAULT NULL, `LEAST(NULL,v)` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1old; TRUNCATE TABLE t1old; SHOW CREATE TABLE t1old; @@ -78,36 +78,36 @@ Table Create Table t1old CREATE TABLE `t1old` ( `a` varbinary(255)/*old*/ DEFAULT NULL, `b` varchar(255)/*old*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CALL p1('a'); Table Create Table t2_simple CREATE TABLE `t2_simple` ( `a` varbinary(255) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Table Create Table t2_union_vv CREATE TABLE `t2_union_vv` ( `a` varbinary(255) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Table Create Table t2_union_vn CREATE TABLE `t2_union_vn` ( `a` varbinary(255) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Table Create Table t2_union_nv CREATE TABLE `t2_union_nv` ( `a` varbinary(255) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a)` varbinary(255) DEFAULT NULL, `COALESCE(a,a)` varbinary(255) DEFAULT NULL, `COALESCE(a,NULL)` varbinary(255) DEFAULT NULL, `COALESCE(NULL,a)` varbinary(255) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Table Create Table t2 CREATE TABLE `t2` ( `LEAST(a,a)` varbinary(255) DEFAULT NULL, `LEAST(a,NULL)` varbinary(255) DEFAULT NULL, `LEAST(NULL,a)` varbinary(255) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1old; DROP PROCEDURE p1; diff --git a/mysql-test/main/type_year.result b/mysql-test/main/type_year.result index a3918580e1f1c..aaee5049c634d 100644 --- a/mysql-test/main/type_year.result +++ b/mysql-test/main/type_year.result @@ -210,11 +210,11 @@ SELECT * FROM t2 WHERE yy = 'test'; yy c2 00 2000 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'test' +Warning 1292 Truncated incorrect DECIMAL value: 'test' SELECT * FROM t4 WHERE yyyy = 'test'; yyyy c4 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'test' +Warning 1292 Truncated incorrect DECIMAL value: 'test' SELECT * FROM t2 WHERE yy = '1999'; yy c2 99 1999 @@ -514,7 +514,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` year(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 (a YEAR(1)); Warnings: Note 1287 'YEAR(1)' is deprecated and will be removed in a future release. Please use YEAR(4) instead @@ -522,7 +522,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` year(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 (a YEAR(2)); Warnings: Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead @@ -530,7 +530,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` year(2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 (a YEAR(3)); Warnings: Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead @@ -538,13 +538,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` year(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 (a YEAR(4)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` year(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 (a YEAR(5)); Warnings: Note 1287 'YEAR(5)' is deprecated and will be removed in a future release. Please use YEAR(4) instead @@ -552,7 +552,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` year(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t1 (a YEAR(100)); Warnings: Note 1287 'YEAR(100)' is deprecated and will be removed in a future release. Please use YEAR(4) instead @@ -560,7 +560,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` year(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # # End of 10.2 tests diff --git a/mysql-test/main/type_year.test b/mysql-test/main/type_year.test index 09538fab805d6..7672fa9496832 100644 --- a/mysql-test/main/type_year.test +++ b/mysql-test/main/type_year.test @@ -155,12 +155,15 @@ DROP TABLE t1; --echo # Bug #59211: Select Returns Different Value for min(year) Function --echo # +#enable after fix MDEV-28673 +--disable_view_protocol CREATE TABLE t1(c1 YEAR(4)); INSERT INTO t1 VALUES (1901),(2155),(0000); SELECT * FROM t1; SELECT COUNT(*) AS total_rows, MIN(c1) AS min_value, MAX(c1) FROM t1; SELECT COUNT(*) AS total_rows, MIN(c1+0) AS min_value, MAX(c1+0) FROM t1; DROP TABLE t1; +--enable_view_protocol --echo # --echo # WL#6219: Deprecate and remove YEAR(2) type @@ -366,12 +369,14 @@ DROP TABLE t2,t1; CREATE TABLE t1 (a YEAR); INSERT INTO t1 VALUES (2000),(2001); SELECT MAX( NULLIF( a, 1970 ) ) AS f FROM t1; +--disable_view_protocol --disable_ps_protocol --enable_metadata SELECT NULLIF(a, 1970) AS f FROM t1 ORDER BY a; SELECT MAX(NULLIF(a, 1970)) AS f FROM t1; --disable_metadata --enable_ps_protocol +--enable_view_protocol DROP TABLE t1; --disable_prepare_warnings diff --git a/mysql-test/main/udf.result b/mysql-test/main/udf.result index 27bd17e7e31a2..8dc24a8dd38bc 100644 --- a/mysql-test/main/udf.result +++ b/mysql-test/main/udf.result @@ -458,7 +458,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT metaphon(`a` AS `a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a) VALUES ('Hello'); SELECT * FROM t1; a b diff --git a/mysql-test/main/udf.test b/mysql-test/main/udf.test index 058f131273dd4..e9823a318637f 100644 --- a/mysql-test/main/udf.test +++ b/mysql-test/main/udf.test @@ -247,6 +247,9 @@ DROP FUNCTION avgcost; # Bug #15439: UDF name case handling forces DELETE FROM mysql.func to remove # the UDF # + +#enable view prtotocol after fix MDEV-28677 +--disable_view_protocol select * from mysql.func; --replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB eval CREATE FUNCTION is_const RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; @@ -259,6 +262,7 @@ select * from mysql.func; --error 1305 select is_const(3); +--enable_view_protocol # # Bug#18761: constant expression as UDF parameters not passed in as constant @@ -400,6 +404,8 @@ DROP TABLE const_len_bug; # Bug #30355: Incorrect ordering of UDF results # +#enable view protocol after fix MDEV-28678 +--disable_view_protocol --replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB eval CREATE FUNCTION udf_sequence RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO"; CREATE TABLE t1 (a INT); @@ -415,6 +421,7 @@ SELECT * FROM t2 WHERE a = udf_sequence(); DROP FUNCTION udf_sequence; DROP TABLE t1,t2; +--enable_view_protocol # # Bug#31767 (DROP FUNCTION name resolution) diff --git a/mysql-test/main/udf_debug_sync.test b/mysql-test/main/udf_debug_sync.test index 593500c1e188a..0b5be340054a4 100644 --- a/mysql-test/main/udf_debug_sync.test +++ b/mysql-test/main/udf_debug_sync.test @@ -4,6 +4,7 @@ # # MDEV-5616 - Deadlock between CREATE/DROP FUNCTION and SELECT from view # +--disable_service_connection --replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO"; CREATE VIEW v1 AS SELECT myfunc_int(1); @@ -38,3 +39,4 @@ connection default; SET debug_sync='RESET'; DROP VIEW v1; DROP FUNCTION myfunc_int; +--enable_service_connection diff --git a/mysql-test/main/union.result b/mysql-test/main/union.result index c0a45a2ac1471..aab13d191a469 100644 --- a/mysql-test/main/union.result +++ b/mysql-test/main/union.result @@ -1,4 +1,3 @@ -drop table if exists t1,t2,t3,t4,t5,t6; CREATE TABLE t1 (a int not null, b char (10) not null); insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); CREATE TABLE t2 (a int not null, b char (10) not null); @@ -611,7 +610,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(2) NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT 12 as a UNION select "aa" as a; select * from t1; @@ -622,7 +621,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(2) NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT 12 as a UNION select 12.2 as a; select * from t1; @@ -633,7 +632,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(3,1) NOT NULL DEFAULT 0.0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t2 (it1 tinyint, it2 tinyint not null, i int not null, ib bigint, f float, d double, y year, da date, dt datetime, sc char(10), sv varchar(10), b blob, tx text); insert into t2 values (NULL, 1, 3, 4, 1.5, 2.5, 1972, '1972-10-22', '1972-10-22 11:50', 'testc', 'testv', 'tetetetetest', 'teeeeeeeeeeeest'); @@ -646,7 +645,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `it2` tinyint(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT it2 from t2 UNION select i from t2; select * from t1; @@ -657,7 +656,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `it2` int(11) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT i from t2 UNION select f from t2; select * from t1; @@ -668,7 +667,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT f from t2 UNION select d from t2; select * from t1; @@ -679,7 +678,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT ib from t2 UNION select f from t2; select * from t1; @@ -690,7 +689,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `ib` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT ib from t2 UNION select d from t2; select * from t1; @@ -701,7 +700,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `ib` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT f from t2 UNION select y from t2; select * from t1; @@ -712,7 +711,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT f from t2 UNION select da from t2; select * from t1; @@ -723,7 +722,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f` varchar(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT y from t2 UNION select da from t2; select * from t1; @@ -734,7 +733,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `y` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT y from t2 UNION select dt from t2; select * from t1; @@ -745,7 +744,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `y` varchar(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT da from t2 UNION select dt from t2; select * from t1; @@ -756,7 +755,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `da` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT dt from t2 UNION select trim(sc) from t2; select trim(dt) from t1; @@ -767,7 +766,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `dt` varchar(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT dt from t2 UNION select sv from t2; select * from t1; @@ -778,7 +777,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `dt` varchar(19) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT sc from t2 UNION select sv from t2; select * from t1; @@ -789,7 +788,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `sc` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT dt from t2 UNION select b from t2; select * from t1; @@ -800,7 +799,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `dt` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT sv from t2 UNION select b from t2; select * from t1; @@ -811,7 +810,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `sv` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT i from t2 UNION select d from t2 UNION select b from t2; select * from t1; @@ -823,7 +822,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT sv from t2 UNION select tx from t2; select * from t1; @@ -834,7 +833,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `sv` text DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 SELECT b from t2 UNION select tx from t2; select * from t1; @@ -845,7 +844,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `b` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1,t2; create table t1 select 1 union select -1; select * from t1; @@ -856,7 +855,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `1` int(2) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 select _latin1"test" union select _latin2"testt" ; ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'UNION' @@ -864,8 +863,8 @@ create table t1 select _latin2"test" union select _latin2"testt" ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `test` varchar(5) CHARACTER SET latin2 NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `test` varchar(5) CHARACTER SET latin2 COLLATE latin2_general_ci NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (s char(200)); insert into t1 values (repeat("1",200)); @@ -1112,7 +1111,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `test` varchar(4) NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1; count(*) 1 @@ -1125,7 +1124,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `_latin1'test' collate latin1_bin` varchar(4) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1; count(*) 3 @@ -1138,7 +1137,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `test` varchar(4) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1; count(*) 3 @@ -1151,7 +1150,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `test` varchar(4) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1; count(*) 3 @@ -1170,7 +1169,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a collate latin1_german1_ci` varchar(1) CHARACTER SET latin1 COLLATE latin1_german1_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as (select a from t2) union @@ -1179,7 +1178,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET latin1 COLLATE latin1_german1_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 as (select a from t2) union @@ -1189,7 +1188,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1) CHARACTER SET latin1 COLLATE latin1_german1_ci DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; drop table t2; create table t1(a1 int, f1 char(10)); @@ -1273,10 +1272,10 @@ c ENUM("one", "two") show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('ä','ö','ü') CHARACTER SET utf8mb3 NOT NULL DEFAULT 'ü', - `b` enum('one','two') CHARACTER SET utf8mb3 DEFAULT NULL, + `a` enum('ä','ö','ü') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'ü', + `b` enum('one','two') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `c` enum('one','two') DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('ä', 'one', 'one'), ('ö', 'two', 'one'), ('ü', NULL, NULL); create table t2 select NULL union select a from t1; show columns from t2; @@ -1332,7 +1331,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select row_format from information_schema.TABLES where table_schema="test" and table_name="t2"; row_format Dynamic @@ -1341,7 +1340,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=FIXED drop table t1,t2; CREATE TABLE t1 (a mediumtext); CREATE TABLE t2 (b varchar(20)); @@ -1355,7 +1354,7 @@ show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `left(a,100000000)` mediumtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop tables t1,t2,t3; CREATE TABLE t1 (a longtext); CREATE TABLE t2 (b varchar(20)); @@ -1369,7 +1368,7 @@ show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `left(a,100000000)` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop tables t1,t2,t3; SET @tmp_max= @@global.max_allowed_packet; SET @@global.max_allowed_packet=25000000; @@ -1384,7 +1383,7 @@ SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `a` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLES t1,t3; CREATE TABLE t1 (a tinytext); INSERT INTO t1 VALUES ('a'); @@ -1393,7 +1392,7 @@ SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `a` varchar(510) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLES t1,t3; CREATE TABLE t1 (a mediumtext); INSERT INTO t1 VALUES ('a'); @@ -1402,7 +1401,7 @@ SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `a` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLES t1,t3; CREATE TABLE t1 (a tinyblob); INSERT INTO t1 VALUES ('a'); @@ -1411,7 +1410,7 @@ SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `a` varbinary(510) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLES t1,t2,t3; connection default; SET @@global.max_allowed_packet:= @tmp_max; @@ -1445,10 +1444,10 @@ t2 CREATE TABLE `t2` ( `f3` binary(1) DEFAULT NULL, `f4` binary(5) DEFAULT NULL, `f5` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `f6` varchar(1) CHARACTER SET utf8mb3 DEFAULT NULL, + `f6` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `f7` text DEFAULT NULL, - `f8` mediumtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `f8` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; CREATE TABLE t1 ( @@ -1465,11 +1464,11 @@ SELECT c_varchar, c_varchar, c_varchar, c_varchar FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `c_tinytext` text CHARACTER SET utf8mb3 DEFAULT NULL, - `c_text` mediumtext CHARACTER SET utf8mb3 DEFAULT NULL, - `c_mediumtext` longtext CHARACTER SET utf8mb3 DEFAULT NULL, - `c_longtext` longtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c_tinytext` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c_text` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c_mediumtext` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c_longtext` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; (select avg(1)) union (select avg(1)) union (select avg(1)) union @@ -1536,6 +1535,9 @@ DROP TABLE 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 'into @var) union (select 1)' at line 1 (select 1) union (select 1 into @var); 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 'into @var)' at line 1 +select @var; +@var +NULL (select 2) union (select 1 into @var); 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 'into @var)' at line 1 (select 1) union (select 1) into @var; @@ -2341,21 +2343,21 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `1` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE OR REPLACE TABLE t1 AS SELECT 1 UNION SELECT 1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `1` int(1) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE OR REPLACE TABLE t1 AS SELECT * FROM (SELECT 1 UNION SELECT 1) AS t0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `1` int(1) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-9495 Wrong field type for a UNION of a signed and an unsigned INT expression @@ -2367,7 +2369,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` decimal(10,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2 ORDER BY a; a 2147483647 @@ -2379,7 +2381,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a,b)` decimal(10,0) DEFAULT NULL, `COALESCE(b,a)` decimal(10,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; COALESCE(a,b) COALESCE(b,a) 2147483647 4294967295 @@ -2393,14 +2395,14 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(3,1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE OR REPLACE TABLE t1 AS SELECT 10.1 AS a UNION SELECT CAST(10 AS UNSIGNED); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(3,1) NOT NULL DEFAULT 0.0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-12594 UNION between fixed length double columns does not always preserve scale @@ -2412,49 +2414,49 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` float(20,4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE OR REPLACE TABLE t2 SELECT a FROM t1 UNION SELECT c FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` float(20,4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE OR REPLACE TABLE t2 SELECT b FROM t1 UNION SELECT b FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `b` float(20,3) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE OR REPLACE TABLE t2 SELECT c FROM t1 UNION SELECT c FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c` float(20,4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE OR REPLACE TABLE t2 SELECT c FROM t1 UNION SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c` float(20,4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE OR REPLACE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` float(21,4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE OR REPLACE TABLE t2 AS SELECT b FROM t1 UNION SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `b` float(21,4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # Corner case @@ -2465,7 +2467,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `b` float(255,4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -2487,7 +2489,7 @@ t1 CREATE TABLE `t1` ( `COALESCE(-1,-1)` int(2) NOT NULL, `COALESCE(1,-1)` int(2) NOT NULL, `COALESCE(-1,1)` int(2) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT 1 AS c1,1 AS c2,-1 AS c3,-1 AS c4 UNION SELECT 1,-1,1,-1; SHOW CREATE TABLE t1; @@ -2497,7 +2499,7 @@ t1 CREATE TABLE `t1` ( `c2` int(2) NOT NULL DEFAULT 0, `c3` int(2) NOT NULL DEFAULT 0, `c4` int(2) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-12599 UNION is not symmetric when mixing INT and CHAR @@ -2508,7 +2510,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(1) NOT NULL DEFAULT '', `c2` varchar(1) NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE OR REPLACE TABLE t1 AS SELECT 11112222 AS c1, 'a' AS c2 UNION SELECT 'a', 11112222; SHOW CREATE TABLE t1; @@ -2516,7 +2518,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(8) NOT NULL DEFAULT '', `c2` varchar(8) NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE OR REPLACE TABLE t1 AS SELECT 111122223333 AS c1, 'a' AS c2 UNION SELECT 'a', 111122223333; SHOW CREATE TABLE t1; @@ -2524,7 +2526,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(12) NOT NULL DEFAULT '', `c2` varchar(12) NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE OR REPLACE TABLE t1 AS SELECT 1111222233334444 AS c1, 'a' AS c2 UNION SELECT 'a', 1111222233334444; SHOW CREATE TABLE t1; @@ -2532,7 +2534,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` varchar(16) NOT NULL DEFAULT '', `c2` varchar(16) NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a INT(3), b VARCHAR(1)); CREATE TABLE t2 AS SELECT a,b FROM t1 UNION SELECT b,a FROM t1; @@ -2541,7 +2543,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(11) DEFAULT NULL, `b` varchar(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a BIGINT(3), b VARCHAR(1)); @@ -2551,7 +2553,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(20) DEFAULT NULL, `b` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a BIGINT(12), b VARCHAR(1)); @@ -2561,7 +2563,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(20) DEFAULT NULL, `b` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -2662,22 +2664,122 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `NULL` binary(0) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t3 SELECT NULL UNION SELECT NULL; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `NULL` binary(0) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE OR REPLACE TABLE t4 SELECT NULL UNION SELECT NULL; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `NULL` binary(0) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t4 ADD INDEX (`NULL`); DROP TABLE t1, t2, t3, t4; set @@default_storage_engine=@save_default_storage_engine; # +# MDEV-29022: add_slave destroy child list and has dead code +# (test added to be sure that ordering by several subqueries works) +# +create table t1 (aa int); +insert into t1 values (-1),(0),(1),(2),(3),(4),(5),(6),(98),(99),(100),(102); +create table t2 (a int, b int); +insert into t2 values (2,2),(2,3),(3,4),(3,5); +select a as a, b as b, +(select max(aa) from t1 where aa < t2.a) as c, +(select max(aa) from t1 where aa < t2.b) as d +from t2 +union select 0 as a, 100 as b, +(select max(aa) from t1 where aa < 0) as c, +(select max(aa) from t1 where aa < 100) as d +union select 0 as a, 99 as b, +(select max(aa) from t1 where aa < 0) as c, +(select max(aa) from t1 where aa < 99) as d +order by (select max(aa) from t1 where aa < a), +(select max(aa) from t1 where aa < b); +a b c d +0 99 -1 98 +0 100 -1 99 +2 2 1 1 +2 3 1 2 +3 4 2 3 +3 5 2 4 +select a as a, b as b, +(select max(aa) from t1 where aa < t2.a) as c, +(select 200 - max(aa) from t1 where aa < t2.b) as d +from t2 +union select 0 as a, 100 as b, +(select max(aa) from t1 where aa < 0) as c, +(select 200 - max(aa) from t1 where aa < 100) as d +union select 0 as a, 99 as b, +(select max(aa) from t1 where aa < 0) as c, +(select 200 - max(aa) from t1 where aa < 99) as d +order by (select max(aa) from t1 where aa < a), +(select 200 - max(aa) from t1 where aa < b); +a b c d +0 100 -1 101 +0 99 -1 102 +2 3 1 198 +2 2 1 199 +3 5 2 196 +3 4 2 197 +(select a as a, b as b, +(select max(aa) from t1 where aa < t2.a) as c, +(select max(aa) from t1 where aa < t2.b) as d +from t2) +union (select 0 as a, 100 as b, +(select max(aa) from t1 where aa < 0) as c, +(select max(aa) from t1 where aa < 100) as d) +union (select 0 as a, 99 as b, +(select max(aa) from t1 where aa < 0) as c, +(select max(aa) from t1 where aa < 99) as d) +order by (select max(aa) from t1 where aa < a), +(select max(aa) from t1 where aa < b); +a b c d +0 99 -1 98 +0 100 -1 99 +2 2 1 1 +2 3 1 2 +3 4 2 3 +3 5 2 4 +(select a as a, b as b, +(select max(aa) from t1 where aa < t2.a) as c, +(select 200 - max(aa) from t1 where aa < t2.b) as d +from t2) +union (select 0 as a, 100 as b, +(select max(aa) from t1 where aa < 0) as c, +(select 200 - max(aa) from t1 where aa < 100) as d) +union (select 0 as a, 99 as b, +(select max(aa) from t1 where aa < 0) as c, +(select 200 - max(aa) from t1 where aa < 99) as d) +order by (select max(aa) from t1 where aa < a), +(select 200 - max(aa) from t1 where aa < b); +a b c d +0 100 -1 101 +0 99 -1 102 +2 3 1 198 +2 2 1 199 +3 5 2 196 +3 4 2 197 +drop table t1,t2; +# +# MDEV-30066 (limit + offset) union all (...) limit = incorrect result +# +create table t1(id int primary key auto_increment, c1 int); +insert into t1(c1) values(1),(2),(3); +(select * from t1 where c1>=1 order by c1 desc limit 2,1) union all (select * from t1 where c1>1 order by c1 desc); +id c1 +1 1 +2 2 +3 3 +(select * from t1 where c1>=1 order by c1 desc limit 2,1) union all (select * from t1 where c1>1 order by c1 desc) limit 2; +id c1 +1 1 +2 2 +drop table t1; +# # End of 10.3 tests # diff --git a/mysql-test/main/union.test b/mysql-test/main/union.test index 6c0203f2a5f03..4cebdcff9bb68 100644 --- a/mysql-test/main/union.test +++ b/mysql-test/main/union.test @@ -2,10 +2,6 @@ # Test of unions # ---disable_warnings -drop table if exists t1,t2,t3,t4,t5,t6; ---enable_warnings - CREATE TABLE t1 (a int not null, b char (10) not null); insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); CREATE TABLE t2 (a int not null, b char (10) not null); @@ -23,9 +19,10 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g (select a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 4; (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1); (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc; ---error 1250 +--error ER_TABLENAME_NOT_ALLOWED_HERE (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b; explain extended (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc; +--disable_view_protocol select count(*) from ( (select a,b from t1 limit 2) union all (select a,b from t2 order by a)) q; (select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2; @@ -34,20 +31,20 @@ select count(*) from ( select a,b from t1 union all select a,b from t2) q; select sql_calc_found_rows a,b from t1 union all select a,b from t2 limit 2; select found_rows(); - +--enable_view_protocol # # Test some error conditions with UNION # explain select a,b from t1 union all select a,b from t2; ---error 1054 +--error ER_BAD_FIELD_ERROR explain select xx from t1 union select 1; ---error 1222 +--error ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT explain select a,b from t1 union select 1; ---error 1222 +--error ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT explain select 1 union select a,b from t1 union select 1; ---error 1222 +--error ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT explain select a,b from t1 union select 1 limit 0; --error ER_PARSE_ERROR @@ -59,19 +56,19 @@ select a,b from t1 order by a union select a,b from t2; --error ER_PARSE_ERROR insert into t3 select a from t1 order by a union select a from t2; ---error 1222 +--error ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT create table t3 select a,b from t1 union select a from t2; ---error 1222 +--error ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT select a,b from t1 union select a from t2; ---error 1222 +--error ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT select * from t1 union select a from t2; ---error 1222 +--error ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT select a from t1 union select * from t2; ---error 1234 +--error ER_CANT_USE_OPTION_HERE select * from t1 union select SQL_BUFFER_RESULT * from t2; # Test CREATE, INSERT and REPLACE @@ -85,13 +82,13 @@ drop table t1,t2,t3; # # Test some unions without tables # ---error 1096 +--error ER_NO_TABLES_USED select * union select 1; select 1 as a,(select a union select a); ---error 1054 +--error ER_BAD_FIELD_ERROR (select 1) union (select 2) order by 0; SELECT @a:=1 UNION SELECT @a:=@a+1; ---error 1054 +--error ER_BAD_FIELD_ERROR (SELECT 1) UNION (SELECT 2) ORDER BY (SELECT a); --sorted_result (SELECT 1,3) UNION (SELECT 2,1) ORDER BY (SELECT 2); @@ -210,6 +207,7 @@ insert into t1 values (1),(2),(3); create table t2 (a int); insert into t2 values (3),(4),(5); +--disable_view_protocol # Test global limits SELECT COUNT(*) FROM ( (SELECT * FROM t1) UNION all (SELECT * FROM t2)) q; @@ -235,12 +233,15 @@ SELECT COUNT(*) FROM ( (SELECT * FROM t1 LIMIT 1) UNION SELECT * FROM t2) q; (SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1; select found_rows(); +--enable_view_protocol # In these case found_rows() should work --error ER_PARSE_ERROR SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2; +--disable_view_protocol SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION all SELECT * FROM t2 LIMIT 2; select found_rows(); +--enable_view_protocol # The following examples will not be exact SELECT COUNT(*) FROM ( @@ -248,12 +249,16 @@ SELECT * FROM t1 UNION SELECT * FROM t2) q; SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2; SELECT COUNT(*) FROM ( (SELECT * FROM t1 LIMIT 1) UNION all SELECT * FROM t2) q; +--disable_view_protocol (SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all SELECT * FROM t2 LIMIT 2; select found_rows(); +--enable_view_protocol SELECT COUNT(*) FROM ( SELECT * FROM t1 UNION all SELECT * FROM t2) q; +--disable_view_protocol SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 100; select found_rows(); +--enable_view_protocol --error ER_PARSE_ERROR SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 100 UNION SELECT * FROM t2; SELECT COUNT(*) FROM ( @@ -269,8 +274,10 @@ SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION SELECT * FROM t2 LIMIT 2; SELECT COUNT(*) FROM ( (SELECT * FROM t1 LIMIT 1) UNION SELECT * FROM t2) q; (SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 2; +--disable_view_protocol SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2,2; select found_rows(); +--enable_view_protocol SELECT COUNT(*) FROM ( SELECT * FROM t1 UNION SELECT * FROM t2) q; --error ER_PARSE_ERROR @@ -284,7 +291,7 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1; (SELECT * FROM t1 ORDER by a) UNION ALL (SELECT * FROM t2 ORDER BY a) ORDER BY A desc LIMIT 4; # Wrong usage ---error 1234 +--error ER_CANT_USE_OPTION_HERE (SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1; create temporary table t1 select a from t1 union select a from t2; @@ -467,7 +474,7 @@ create table t1 select 1 union select -1; select * from t1; show create table t1; drop table t1; --- error 1267 +-- error ER_CANT_AGGREGATE_2COLLATIONS create table t1 select _latin1"test" union select _latin2"testt" ; create table t1 select _latin2"test" union select _latin2"testt" ; show create table t1; @@ -502,6 +509,7 @@ insert t1 select a+1, a+b from t1; insert t1 select a+1, a+b from t1; insert t1 select a+1, a+b from t1; FLUSH STATUS; +--disable_view_protocol show status like 'Slow_queries'; select count(*) from t1 where a=7; show status like 'Slow_queries'; @@ -515,6 +523,7 @@ show status like 'Slow_queries'; flush status; select a from t1 where b not in (1,2,3) union select a from t1 where b not in (4,5,6); show status like 'Slow_queries'; +--enable_view_protocol drop table t1; # @@ -573,7 +582,7 @@ set sql_select_limit=default; # CREATE TABLE t1 (i int(11) default NULL,c char(1) default NULL,KEY i (i)); CREATE TABLE t2 (i int(11) default NULL,c char(1) default NULL,KEY i (i)); ---error 1054 +--error ER_BAD_FIELD_ERROR explain (select * from t1) union (select * from t2) order by not_existing_column; drop table t1, t2; @@ -675,7 +684,7 @@ drop table t1; create table t2 ( a char character set latin1 collate latin1_swedish_ci, b char character set latin1 collate latin1_german1_ci); ---error 1271 +--error ER_CANT_AGGREGATE_NCOLLATIONS create table t1 as (select a from t2) union (select b from t2); @@ -972,7 +981,7 @@ CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (3),(1),(2),(4),(1); SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a) AS test; ---error 1054 +--error ER_BAD_FIELD_ERROR SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY c) AS test; DROP TABLE t1; @@ -985,6 +994,7 @@ DROP TABLE t1; (select 1 into @var) union (select 1); --error ER_PARSE_ERROR (select 1) union (select 1 into @var); +select @var; --error ER_PARSE_ERROR (select 2) union (select 1 into @var); --enable_prepare_warnings @@ -1363,8 +1373,10 @@ INSERT INTO t2 VALUES (4), (5), (6); INSERT INTO t3 VALUES (7), (8), (9); TRUNCATE table mysql.slow_log; --sorted_result +--disable_view_protocol SELECT * FROM t17059925 UNION SELECT * FROM t2 UNION SELECT * FROM t3; SELECT sql_text, rows_examined FROM mysql.slow_log WHERE sql_text LIKE '%SELECT%t17059925%'; +--enable_view_protocol DROP TABLE t17059925, t2, t3; ## Reset to initial values @@ -1877,6 +1889,7 @@ drop table t1,t2,t3; --disable_ps_protocol --enable_metadata +--disable_view_protocol SELECT CAST(1 AS UNSIGNED) UNION ALL SELECT * from (SELECT NULL) t; SELECT CAST(1 AS SIGNED) UNION ALL SELECT * from (SELECT NULL) t; @@ -1885,6 +1898,7 @@ SELECT CAST(1 AS SIGNED) UNION ALL SELECT * from (SELECT CAST(1 AS UNSIGNED)) t; SELECT CAST(1 AS UNSIGNED) UNION ALL SELECT NULL; SELECT CAST(1 AS UNSIGNED) UNION ALL SELECT CAST(1 AS SIGNED); +--enable_view_protocol --disable_metadata --enable_ps_protocol @@ -1913,6 +1927,86 @@ DROP TABLE t1, t2, t3, t4; set @@default_storage_engine=@save_default_storage_engine; + +--echo # +--echo # MDEV-29022: add_slave destroy child list and has dead code +--echo # (test added to be sure that ordering by several subqueries works) +--echo # + +create table t1 (aa int); + +insert into t1 values (-1),(0),(1),(2),(3),(4),(5),(6),(98),(99),(100),(102); + + +create table t2 (a int, b int); + +insert into t2 values (2,2),(2,3),(3,4),(3,5); + + +select a as a, b as b, + (select max(aa) from t1 where aa < t2.a) as c, + (select max(aa) from t1 where aa < t2.b) as d + from t2 +union select 0 as a, 100 as b, + (select max(aa) from t1 where aa < 0) as c, + (select max(aa) from t1 where aa < 100) as d +union select 0 as a, 99 as b, + (select max(aa) from t1 where aa < 0) as c, + (select max(aa) from t1 where aa < 99) as d + order by (select max(aa) from t1 where aa < a), + (select max(aa) from t1 where aa < b); + +select a as a, b as b, + (select max(aa) from t1 where aa < t2.a) as c, + (select 200 - max(aa) from t1 where aa < t2.b) as d + from t2 +union select 0 as a, 100 as b, + (select max(aa) from t1 where aa < 0) as c, + (select 200 - max(aa) from t1 where aa < 100) as d +union select 0 as a, 99 as b, + (select max(aa) from t1 where aa < 0) as c, + (select 200 - max(aa) from t1 where aa < 99) as d + order by (select max(aa) from t1 where aa < a), + (select 200 - max(aa) from t1 where aa < b); + + +(select a as a, b as b, + (select max(aa) from t1 where aa < t2.a) as c, + (select max(aa) from t1 where aa < t2.b) as d + from t2) +union (select 0 as a, 100 as b, + (select max(aa) from t1 where aa < 0) as c, + (select max(aa) from t1 where aa < 100) as d) +union (select 0 as a, 99 as b, + (select max(aa) from t1 where aa < 0) as c, + (select max(aa) from t1 where aa < 99) as d) + order by (select max(aa) from t1 where aa < a), + (select max(aa) from t1 where aa < b); + +(select a as a, b as b, + (select max(aa) from t1 where aa < t2.a) as c, + (select 200 - max(aa) from t1 where aa < t2.b) as d + from t2) +union (select 0 as a, 100 as b, + (select max(aa) from t1 where aa < 0) as c, + (select 200 - max(aa) from t1 where aa < 100) as d) +union (select 0 as a, 99 as b, + (select max(aa) from t1 where aa < 0) as c, + (select 200 - max(aa) from t1 where aa < 99) as d) + order by (select max(aa) from t1 where aa < a), + (select 200 - max(aa) from t1 where aa < b); + +drop table t1,t2; + +--echo # +--echo # MDEV-30066 (limit + offset) union all (...) limit = incorrect result +--echo # +create table t1(id int primary key auto_increment, c1 int); +insert into t1(c1) values(1),(2),(3); +(select * from t1 where c1>=1 order by c1 desc limit 2,1) union all (select * from t1 where c1>1 order by c1 desc); +(select * from t1 where c1>=1 order by c1 desc limit 2,1) union all (select * from t1 where c1>1 order by c1 desc) limit 2; +drop table t1; + --echo # --echo # End of 10.3 tests --echo # diff --git a/mysql-test/main/union_innodb.result b/mysql-test/main/union_innodb.result new file mode 100644 index 0000000000000..876897fa86519 --- /dev/null +++ b/mysql-test/main/union_innodb.result @@ -0,0 +1,34 @@ +# +# MDEV-25636: Bug report: abortion in sql/sql_parse.cc:6294 +# +CREATE TABLE t1 (i1 int)engine=innodb; +INSERT INTO `t1` VALUES (62),(66); +CREATE TABLE t2 (i1 int) engine=innodb; +SELECT 1 FROM t1 +WHERE t1.i1 =( SELECT t1.i1 FROM t2 +UNION SELECT i1 FROM (t1 AS dt1 natural JOIN t2) +window w1 as (partition by t1.i1)); +1 +drop table t1,t2; +# Another testcase +CREATE TABLE t1 (i3 int NOT NULL, i1 int , i2 int , i4 int , PRIMARY key(i2)); +INSERT INTO t1 VALUES (6,72,98,98),(46,1,6952,0); +SELECT i1 FROM t1 +WHERE t1.i3 = +(SELECT ref_4.i2 FROM t1 AS ref_4 +WHERE t1.i2 > (SELECT i3 FROM t1 ORDER BY i3 LIMIT 1 OFFSET 4) +UNION +SELECT ref_6.i2 +FROM (t1 AS ref_5 JOIN t1 AS ref_6 ON ((ref_6.i1 > ref_6.i2) OR (ref_5.i4 < ref_5.i4))) +WHERE (t1.i2 >= t1.i2)); +i1 +drop table t1; +# +# MDEV-25761: Assertion `aggr != __null' failed in sub_select_postjoin_aggr +# +CREATE TABLE t1 ( a int NOT NULL PRIMARY KEY) engine=innodb; +INSERT INTO t1 VALUES (0),(4),(31); +CREATE TABLE t2 (i int) engine=innodb; +DELETE FROM t1 WHERE t1.a = +(SELECT t1.a FROM t2 UNION SELECT DISTINCT 52 FROM t2 r WHERE t1.a = t1.a); +DROP TABLE t1,t2; diff --git a/mysql-test/main/union_innodb.test b/mysql-test/main/union_innodb.test new file mode 100644 index 0000000000000..cb805a30bb41d --- /dev/null +++ b/mysql-test/main/union_innodb.test @@ -0,0 +1,45 @@ +--source include/have_innodb.inc + +--echo # +--echo # MDEV-25636: Bug report: abortion in sql/sql_parse.cc:6294 +--echo # + +CREATE TABLE t1 (i1 int)engine=innodb; +INSERT INTO `t1` VALUES (62),(66); +CREATE TABLE t2 (i1 int) engine=innodb; + +SELECT 1 FROM t1 +WHERE t1.i1 =( SELECT t1.i1 FROM t2 + UNION SELECT i1 FROM (t1 AS dt1 natural JOIN t2) + window w1 as (partition by t1.i1)); + +drop table t1,t2; + +--echo # Another testcase +CREATE TABLE t1 (i3 int NOT NULL, i1 int , i2 int , i4 int , PRIMARY key(i2)); +INSERT INTO t1 VALUES (6,72,98,98),(46,1,6952,0); + +SELECT i1 FROM t1 +WHERE t1.i3 = + (SELECT ref_4.i2 FROM t1 AS ref_4 + WHERE t1.i2 > (SELECT i3 FROM t1 ORDER BY i3 LIMIT 1 OFFSET 4) + UNION + SELECT ref_6.i2 + FROM (t1 AS ref_5 JOIN t1 AS ref_6 ON ((ref_6.i1 > ref_6.i2) OR (ref_5.i4 < ref_5.i4))) + WHERE (t1.i2 >= t1.i2)); + +drop table t1; + +--echo # +--echo # MDEV-25761: Assertion `aggr != __null' failed in sub_select_postjoin_aggr +--echo # + +CREATE TABLE t1 ( a int NOT NULL PRIMARY KEY) engine=innodb; +INSERT INTO t1 VALUES (0),(4),(31); + +CREATE TABLE t2 (i int) engine=innodb; + +DELETE FROM t1 WHERE t1.a = + (SELECT t1.a FROM t2 UNION SELECT DISTINCT 52 FROM t2 r WHERE t1.a = t1.a); + +DROP TABLE t1,t2; diff --git a/mysql-test/main/update.result b/mysql-test/main/update.result index f5edf1c6be36a..b9b80fb48de5c 100644 --- a/mysql-test/main/update.result +++ b/mysql-test/main/update.result @@ -734,3 +734,32 @@ UPDATE t1,t2 SET t1.i1 = -39 WHERE t2.d1 <> t1.i1 AND t2.d1 = t1.d2; ERROR 22007: Incorrect datetime value: '19' for column `test`.`t1`.`i1` at row 1 DROP TABLE t1,t2; # End of MariaDB 10.2 tests +# +# MDEV-20773: UPDATE with LIKE predicate over non-indexed column +# of VARCHAR type +# +create table t1 (a1 varchar(30), a2 varchar(30) collate utf8_bin); +insert into t1 values +('aa','zzz'), ('b','xxaa'), ('ccc','yyy'), ('ddd','xxb'); +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 +explain extended +update t1 set a1 = 'u' + where a2 like 'xx%' and exists(select 1 from t1 where t1.a1 < 'c'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 50.00 Using where +2 SUBQUERY t1 ALL NULL NULL NULL NULL 4 50.00 Using where +Warnings: +Note 1003 /* select#1 */ update `test`.`t1` set `test`.`t1`.`a1` = 'u' where `test`.`t1`.`a2` like 'xx%' +update t1 set a1 = 'u' + where a2 like 'xx%' and exists(select 1 from t1 where t1.a1 < 'c'); +select * from t1; +a1 a2 +aa zzz +u xxaa +ccc yyy +u xxb +drop table t1; +# End of MariaDB 10.4 tests diff --git a/mysql-test/main/update.test b/mysql-test/main/update.test index 84709102f967d..147d69d50c957 100644 --- a/mysql-test/main/update.test +++ b/mysql-test/main/update.test @@ -233,9 +233,12 @@ drop table t1; create table t1 ( a int, b int default 0, index (a) ); insert into t1 (a) values (0),(0),(0),(0),(0),(0),(0),(0); +# the view protocol creates an additional statistics data +--disable_view_protocol flush status; select a from t1 order by a limit 1; show status like 'handler_read%'; +--enable_view_protocol flush status; update t1 set a=9999 order by a limit 1; @@ -673,3 +676,26 @@ UPDATE t1,t2 SET t1.i1 = -39 WHERE t2.d1 <> t1.i1 AND t2.d1 = t1.d2; DROP TABLE t1,t2; --echo # End of MariaDB 10.2 tests + +--echo # +--echo # MDEV-20773: UPDATE with LIKE predicate over non-indexed column +--echo # of VARCHAR type +--echo # + +create table t1 (a1 varchar(30), a2 varchar(30) collate utf8_bin); +insert into t1 values + ('aa','zzz'), ('b','xxaa'), ('ccc','yyy'), ('ddd','xxb'); +analyze table t1 persistent for all; + +explain extended +update t1 set a1 = 'u' + where a2 like 'xx%' and exists(select 1 from t1 where t1.a1 < 'c'); + +update t1 set a1 = 'u' + where a2 like 'xx%' and exists(select 1 from t1 where t1.a1 < 'c'); + +select * from t1; + +drop table t1; + +--echo # End of MariaDB 10.4 tests diff --git a/mysql-test/main/update_innodb.test b/mysql-test/main/update_innodb.test index a5c6acf862083..c213ba8b331a0 100644 --- a/mysql-test/main/update_innodb.test +++ b/mysql-test/main/update_innodb.test @@ -105,7 +105,7 @@ drop table t1,t2; set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; set @@use_stat_tables= @save_use_stat_tables; - +--disable_view_protocol CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY) engine=innodb; CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY) engine=innodb; INSERT INTO t1 VALUES (1); @@ -159,5 +159,6 @@ commit; --connection default disconnect con2; drop table t1,t2; +--enable_view_protocol --echo # End of 10.4 tests diff --git a/mysql-test/main/update_use_source.result b/mysql-test/main/update_use_source.result index 2774e7ee92d67..5a9e0a7750c75 100644 --- a/mysql-test/main/update_use_source.result +++ b/mysql-test/main/update_use_source.result @@ -76,7 +76,8 @@ rollback; explain update t1 set c1=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 > 3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where -2 DEPENDENT SUBQUERY a ALL NULL NULL NULL NULL 8 Using where +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED a ALL NULL NULL NULL NULL 8 start transaction; update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3; affected rows: 4 @@ -317,7 +318,8 @@ rollback; explain update t1 set c1=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 > 3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 range t1_c2 t1_c2 5 NULL 2 Using where -2 DEPENDENT SUBQUERY a ref t1_c2 t1_c2 5 test.t1.c2 4 Using index +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED a range t1_c2 t1_c2 5 NULL 2 Using where; Using index start transaction; update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3; affected rows: 4 @@ -558,7 +560,8 @@ rollback; explain update t1 set c1=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 > 3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 range t1_c2 t1_c2 5 NULL 2 Using where -2 DEPENDENT SUBQUERY a ref t1_c2 t1_c2 5 test.t1.c2 1 Using index +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED a range t1_c2 t1_c2 5 NULL 2 Using where; Using index start transaction; update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3; affected rows: 4 @@ -800,7 +803,8 @@ rollback; explain update t1 set c1=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 > 3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 range t1_c2 t1_c2 5 NULL 2 Using where -2 DEPENDENT SUBQUERY a ref t1_c2 t1_c2 5 test.t1.c2 1 Using index +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED a range t1_c2 t1_c2 5 NULL 2 Using where; Using index start transaction; update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3; affected rows: 4 diff --git a/mysql-test/main/update_use_source.test b/mysql-test/main/update_use_source.test index d446bd512dd30..1b765138a1851 100644 --- a/mysql-test/main/update_use_source.test +++ b/mysql-test/main/update_use_source.test @@ -1,5 +1,6 @@ --source include/have_sequence.inc --source include/have_innodb.inc +--source include/no_valgrind_without_big.inc create table t1 (old_c1 integer, old_c2 integer,c1 integer, c2 integer, c3 integer) engine=InnoDB STATS_PERSISTENT=0; create view v1 as select * from t1 where c2=2; diff --git a/mysql-test/main/upgrade.result b/mysql-test/main/upgrade.result index 7c6df30fa7479..4e8cca3830d77 100644 --- a/mysql-test/main/upgrade.result +++ b/mysql-test/main/upgrade.result @@ -10,12 +10,12 @@ create table `#mysql50#mysqltest-1`.`t1` (a int); create table `#mysql50#mysqltest-1`.`#mysql50#t-1` (a int); show create database `mysqltest1`; Database Create Database -mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */ +mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ show create database `mysqltest-1`; ERROR 42000: Unknown database 'mysqltest-1' show create database `#mysql50#mysqltest-1`; Database Create Database -#mysql50#mysqltest-1 CREATE DATABASE `#mysql50#mysqltest-1` /*!40100 DEFAULT CHARACTER SET latin1 */ +#mysql50#mysqltest-1 CREATE DATABASE `#mysql50#mysqltest-1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ show tables in `mysqltest1`; Tables_in_mysqltest1 #mysql50#t-1 @@ -26,10 +26,10 @@ Tables_in_#mysql50#mysqltest-1 t1 show create database `mysqltest1`; Database Create Database -mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */ +mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ show create database `mysqltest-1`; Database Create Database -mysqltest-1 CREATE DATABASE `mysqltest-1` /*!40100 DEFAULT CHARACTER SET latin1 */ +mysqltest-1 CREATE DATABASE `mysqltest-1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ show create database `#mysql50#mysqltest-1`; ERROR 42000: Unknown database '#mysql50#mysqltest-1' show tables in `mysqltest1`; @@ -88,7 +88,7 @@ Database (%a-b-c%) a-b-c show create database `a-b-c`; Database Create Database -a-b-c CREATE DATABASE `a-b-c` /*!40100 DEFAULT CHARACTER SET latin2 */ +a-b-c CREATE DATABASE `a-b-c` /*!40100 DEFAULT CHARACTER SET latin2 COLLATE latin2_general_ci */ show tables in `a-b-c`; Tables_in_a-b-c t1 @@ -96,7 +96,7 @@ show create table `a-b-c`.`t1`; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin2 +) ENGINE=MyISAM DEFAULT CHARSET=latin2 COLLATE=latin2_general_ci drop database `a-b-c`; drop database `tabc`; use `#mysql50#a-b-c`; diff --git a/mysql-test/main/upgrade.test b/mysql-test/main/upgrade.test index e7a3e4d8abf16..ed75b8649673a 100644 --- a/mysql-test/main/upgrade.test +++ b/mysql-test/main/upgrade.test @@ -1,6 +1,9 @@ call mtr.add_suppression("Invalid .old.. table or database name"); --source include/not_embedded.inc +#remove this include after fix MDEV-27872 +--source include/no_view_protocol.inc + --disable_warnings drop database if exists `mysqltest1`; drop database if exists `mysqltest-1`; diff --git a/mysql-test/main/upgrade_MDEV-19650.result b/mysql-test/main/upgrade_MDEV-19650.result index bc0ff17028ffd..90f2d7b0aa7e7 100644 --- a/mysql-test/main/upgrade_MDEV-19650.result +++ b/mysql-test/main/upgrade_MDEV-19650.result @@ -285,7 +285,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `g` geometry DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci use mysql; select count(*) from user; count(*) diff --git a/mysql-test/main/upgrade_mdev_24363.test b/mysql-test/main/upgrade_mdev_24363.test index cdb49037a40cf..c188d4c7facbd 100644 --- a/mysql-test/main/upgrade_mdev_24363.test +++ b/mysql-test/main/upgrade_mdev_24363.test @@ -9,7 +9,7 @@ --echo # Test that mysql.user password_expired column --echo # shows the right value as in mysql.global_priv --echo # - +--disable_service_connection create user gigi@localhost; show create user gigi@localhost; select password_expired from mysql.user where user='gigi' and host='localhost'; @@ -19,6 +19,7 @@ show create user gigi@localhost; select password_expired from mysql.user where user='gigi' and host='localhost'; drop user gigi@localhost; +--enable_service_connection --echo # --echo # Test that upgrades from 10.4+ versions before this mdev diff --git a/mysql-test/main/user_var-binlog.result b/mysql-test/main/user_var-binlog.result index 20d1d8e7da8c5..cd0bf056c17b2 100644 --- a/mysql-test/main/user_var-binlog.result +++ b/mysql-test/main/user_var-binlog.result @@ -29,11 +29,11 @@ SET @`a b`:=_latin1 X'68656C6C6F' COLLATE `latin1_swedish_ci`/*!*/; use `test`/*!*/; SET TIMESTAMP=10000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; INSERT INTO t1 VALUES(@`a b`) diff --git a/mysql-test/main/user_var.result b/mysql-test/main/user_var.result index de339b4b037db..a5837996c1906 100644 --- a/mysql-test/main/user_var.result +++ b/mysql-test/main/user_var.result @@ -219,7 +219,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `@first_var` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @first_var= cast(NULL as signed integer); create table t1 select @first_var; @@ -227,7 +227,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `@first_var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @first_var= NULL; create table t1 select @first_var; @@ -235,7 +235,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `@first_var` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @first_var= concat(NULL); create table t1 select @first_var; @@ -243,7 +243,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `@first_var` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @first_var=1; set @first_var= cast(NULL as CHAR); @@ -252,7 +252,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `@first_var` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @a=18446744071710965857; select @a; @@ -372,14 +372,14 @@ insert into t1 (b) values (10), (30), (10), (10); set @var := 0; explain select if(b=@var, 999, b) , @var := b from t1 order by b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort set @var := 0; select if(b=@var, 999, b) , @var := b from t1 order by b; if(b=@var, 999, b) @var := b 10 10 -10 10 30 30 999 10 +999 10 drop table t1; create temporary table t1 (id int); insert into t1 values (2), (3), (3), (4); @@ -590,7 +590,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` bigint(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 2233999999 diff --git a/mysql-test/main/user_var.test b/mysql-test/main/user_var.test index d7a1cae126c53..589043f096e51 100644 --- a/mysql-test/main/user_var.test +++ b/mysql-test/main/user_var.test @@ -1,6 +1,7 @@ # Initialise source include/have_sequence.inc; + --error 1054 set @a := foo; set @a := connection_id() + 3; @@ -492,6 +493,7 @@ DROP TABLE t1; --echo # Check that used memory extends if we set a variable --echo # +--disable_service_connection # Execute twice so number stablizes a bit let $tmp= `select memory_used from information_schema.processlist`; set @var= repeat('a',20000); @@ -501,6 +503,7 @@ let $tmp2= `select memory_used from information_schema.processlist`; eval select $tmp < $tmp2; --enable_column_names --enable_query_log +--enable_service_connection # # MDEV-13897 SELECT @a := MAX(col) FROM t requires full index scan diff --git a/mysql-test/main/userstat-badlogin-4824.test b/mysql-test/main/userstat-badlogin-4824.test index 78f2150e44639..12cca9f12b3d3 100644 --- a/mysql-test/main/userstat-badlogin-4824.test +++ b/mysql-test/main/userstat-badlogin-4824.test @@ -1,6 +1,10 @@ # # MDEV-4824 userstats - wrong user statistics # +# Tests will be skipped for the view protocol because the view protocol creates +# an additional util connection and other statistics data +-- source include/no_view_protocol.inc + --source include/not_embedded.inc set @save_userstat=@@global.userstat; diff --git a/mysql-test/main/userstat.result b/mysql-test/main/userstat.result index 9152f6023049b..5315317e33a7e 100644 --- a/mysql-test/main/userstat.result +++ b/mysql-test/main/userstat.result @@ -3,71 +3,71 @@ Warnings: Warning 1287 ' INTO FROM...' instead show columns from information_schema.client_statistics; Field Type Null Key Default Extra -CLIENT varchar(64) NO -TOTAL_CONNECTIONS bigint(21) NO 0 -CONCURRENT_CONNECTIONS bigint(21) NO 0 -CONNECTED_TIME bigint(21) NO 0 -BUSY_TIME double NO 0 -CPU_TIME double NO 0 -BYTES_RECEIVED bigint(21) NO 0 -BYTES_SENT bigint(21) NO 0 -BINLOG_BYTES_WRITTEN bigint(21) NO 0 -ROWS_READ bigint(21) NO 0 -ROWS_SENT bigint(21) NO 0 -ROWS_DELETED bigint(21) NO 0 -ROWS_INSERTED bigint(21) NO 0 -ROWS_UPDATED bigint(21) NO 0 -SELECT_COMMANDS bigint(21) NO 0 -UPDATE_COMMANDS bigint(21) NO 0 -OTHER_COMMANDS bigint(21) NO 0 -COMMIT_TRANSACTIONS bigint(21) NO 0 -ROLLBACK_TRANSACTIONS bigint(21) NO 0 -DENIED_CONNECTIONS bigint(21) NO 0 -LOST_CONNECTIONS bigint(21) NO 0 -ACCESS_DENIED bigint(21) NO 0 -EMPTY_QUERIES bigint(21) NO 0 -TOTAL_SSL_CONNECTIONS bigint(21) unsigned NO 0 -MAX_STATEMENT_TIME_EXCEEDED bigint(21) NO 0 +CLIENT varchar(64) NO NULL +TOTAL_CONNECTIONS bigint(21) NO NULL +CONCURRENT_CONNECTIONS bigint(21) NO NULL +CONNECTED_TIME bigint(21) NO NULL +BUSY_TIME double NO NULL +CPU_TIME double NO NULL +BYTES_RECEIVED bigint(21) NO NULL +BYTES_SENT bigint(21) NO NULL +BINLOG_BYTES_WRITTEN bigint(21) NO NULL +ROWS_READ bigint(21) NO NULL +ROWS_SENT bigint(21) NO NULL +ROWS_DELETED bigint(21) NO NULL +ROWS_INSERTED bigint(21) NO NULL +ROWS_UPDATED bigint(21) NO NULL +SELECT_COMMANDS bigint(21) NO NULL +UPDATE_COMMANDS bigint(21) NO NULL +OTHER_COMMANDS bigint(21) NO NULL +COMMIT_TRANSACTIONS bigint(21) NO NULL +ROLLBACK_TRANSACTIONS bigint(21) NO NULL +DENIED_CONNECTIONS bigint(21) NO NULL +LOST_CONNECTIONS bigint(21) NO NULL +ACCESS_DENIED bigint(21) NO NULL +EMPTY_QUERIES bigint(21) NO NULL +TOTAL_SSL_CONNECTIONS bigint(21) unsigned NO NULL +MAX_STATEMENT_TIME_EXCEEDED bigint(21) NO NULL show columns from information_schema.user_statistics; Field Type Null Key Default Extra -USER varchar(128) NO -TOTAL_CONNECTIONS int(11) NO 0 -CONCURRENT_CONNECTIONS int(11) NO 0 -CONNECTED_TIME int(11) NO 0 -BUSY_TIME double NO 0 -CPU_TIME double NO 0 -BYTES_RECEIVED bigint(21) NO 0 -BYTES_SENT bigint(21) NO 0 -BINLOG_BYTES_WRITTEN bigint(21) NO 0 -ROWS_READ bigint(21) NO 0 -ROWS_SENT bigint(21) NO 0 -ROWS_DELETED bigint(21) NO 0 -ROWS_INSERTED bigint(21) NO 0 -ROWS_UPDATED bigint(21) NO 0 -SELECT_COMMANDS bigint(21) NO 0 -UPDATE_COMMANDS bigint(21) NO 0 -OTHER_COMMANDS bigint(21) NO 0 -COMMIT_TRANSACTIONS bigint(21) NO 0 -ROLLBACK_TRANSACTIONS bigint(21) NO 0 -DENIED_CONNECTIONS bigint(21) NO 0 -LOST_CONNECTIONS bigint(21) NO 0 -ACCESS_DENIED bigint(21) NO 0 -EMPTY_QUERIES bigint(21) NO 0 -TOTAL_SSL_CONNECTIONS bigint(21) unsigned NO 0 -MAX_STATEMENT_TIME_EXCEEDED bigint(21) NO 0 +USER varchar(128) NO NULL +TOTAL_CONNECTIONS int(11) NO NULL +CONCURRENT_CONNECTIONS int(11) NO NULL +CONNECTED_TIME int(11) NO NULL +BUSY_TIME double NO NULL +CPU_TIME double NO NULL +BYTES_RECEIVED bigint(21) NO NULL +BYTES_SENT bigint(21) NO NULL +BINLOG_BYTES_WRITTEN bigint(21) NO NULL +ROWS_READ bigint(21) NO NULL +ROWS_SENT bigint(21) NO NULL +ROWS_DELETED bigint(21) NO NULL +ROWS_INSERTED bigint(21) NO NULL +ROWS_UPDATED bigint(21) NO NULL +SELECT_COMMANDS bigint(21) NO NULL +UPDATE_COMMANDS bigint(21) NO NULL +OTHER_COMMANDS bigint(21) NO NULL +COMMIT_TRANSACTIONS bigint(21) NO NULL +ROLLBACK_TRANSACTIONS bigint(21) NO NULL +DENIED_CONNECTIONS bigint(21) NO NULL +LOST_CONNECTIONS bigint(21) NO NULL +ACCESS_DENIED bigint(21) NO NULL +EMPTY_QUERIES bigint(21) NO NULL +TOTAL_SSL_CONNECTIONS bigint(21) unsigned NO NULL +MAX_STATEMENT_TIME_EXCEEDED bigint(21) NO NULL show columns from information_schema.index_statistics; Field Type Null Key Default Extra -TABLE_SCHEMA varchar(192) NO -TABLE_NAME varchar(192) NO -INDEX_NAME varchar(192) NO -ROWS_READ bigint(21) NO 0 +TABLE_SCHEMA varchar(192) NO NULL +TABLE_NAME varchar(192) NO NULL +INDEX_NAME varchar(192) NO NULL +ROWS_READ bigint(21) NO NULL show columns from information_schema.table_statistics; Field Type Null Key Default Extra -TABLE_SCHEMA varchar(192) NO -TABLE_NAME varchar(192) NO -ROWS_READ bigint(21) NO 0 -ROWS_CHANGED bigint(21) NO 0 -ROWS_CHANGED_X_INDEXES bigint(21) NO 0 +TABLE_SCHEMA varchar(192) NO NULL +TABLE_NAME varchar(192) NO NULL +ROWS_READ bigint(21) NO NULL +ROWS_CHANGED bigint(21) NO NULL +ROWS_CHANGED_X_INDEXES bigint(21) NO NULL set @save_general_log=@@global.general_log; set @@global.general_log=0; set @@global.userstat=1; diff --git a/mysql-test/main/varbinary.result b/mysql-test/main/varbinary.result index 3a182e7469213..ad8172bcfcd2d 100644 --- a/mysql-test/main/varbinary.result +++ b/mysql-test/main/varbinary.result @@ -84,7 +84,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(255)/*old*/ DEFAULT NULL, `b` varchar(255)/*old*/ DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select length(a), length(b) from t1; length(a) length(b) 255 3 @@ -100,7 +100,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(255) DEFAULT NULL, `b` varchar(255) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select length(a), length(b) from t1; length(a) length(b) 3 3 @@ -139,13 +139,13 @@ show create table table_28127_a; Table Create Table table_28127_a CREATE TABLE `table_28127_a` ( `0b02` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table table_28127_b(0b2 int); show create table table_28127_b; Table Create Table table_28127_b CREATE TABLE `table_28127_b` ( `0b2` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table table_28127_a; drop table table_28127_b; select 0b01000001; diff --git a/mysql-test/main/varbinary.test b/mysql-test/main/varbinary.test index f03f3fcf70318..19e0e88932e0a 100644 --- a/mysql-test/main/varbinary.test +++ b/mysql-test/main/varbinary.test @@ -142,9 +142,12 @@ select x'41', 0+x'3635'; select N'abc', length(N'abc'); +#enable after fix MDEV-28535 +--disable_view_protocol select N'', length(N''); select '', length(''); +--enable_view_protocol select b'', 0+b''; diff --git a/mysql-test/main/variables.result b/mysql-test/main/variables.result index 49af27b8a5f86..3f367ef459914 100644 --- a/mysql-test/main/variables.result +++ b/mysql-test/main/variables.result @@ -700,7 +700,7 @@ t1 CREATE TABLE `t1` ( `c3` mediumint(9) DEFAULT NULL, `c4` int(11) DEFAULT NULL, `c5` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set @arg00= 8, @arg01= 8.8, @arg02= 'a string', @arg03= 0.2e0; create table t1 as select @arg00 as c1, @arg01 as c2, @arg02 as c3, @arg03 as c4; @@ -711,7 +711,7 @@ t1 CREATE TABLE `t1` ( `c2` decimal(65,38) DEFAULT NULL, `c3` longtext DEFAULT NULL, `c4` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; SET GLOBAL MYISAM_DATA_POINTER_SIZE= 7; SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE'; @@ -1549,7 +1549,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(1) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result index 44f475ede848b..329f367844e62 100644 --- a/mysql-test/main/view.result +++ b/mysql-test/main/view.result @@ -1503,6 +1503,8 @@ execute stmt1 using @a; set @a= 301; execute stmt1 using @a; deallocate prepare stmt1; +insert into v3(a) select sum(302); +insert into v3(a) select sum(303) over (); select * from v3; a b 100 0 @@ -1521,6 +1523,14 @@ a b 301 10 301 1000 301 2000 +302 0 +302 10 +302 1000 +302 2000 +303 0 +303 10 +303 1000 +303 2000 drop view v3; drop tables t1,t2; create table t1(f1 int); @@ -1942,14 +1952,6 @@ f1 2005-02-02 drop view v1; drop table t1; -CREATE VIEW v1 AS SELECT ENCRYPT("dhgdhgd"); -SELECT * FROM v1; -drop view v1; -CREATE VIEW v1 AS SELECT SUBSTRING_INDEX("dkjhgd:kjhdjh", ":", 1); -SELECT * FROM v1; -SUBSTRING_INDEX("dkjhgd:kjhdjh", ":", 1) -dkjhgd -drop view v1; create table t1 (f59 int, f60 int, f61 int); insert into t1 values (19,41,32); create view v1 as select f59, f60 from t1 where f59 in @@ -6156,11 +6158,11 @@ CREATE VIEW v1 AS SELECT * FROM t1; SELECT * FROM t1 WHERE a <> 0 AND a = ' 1'; a Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '`1' +Warning 1292 Truncated incorrect DECIMAL value: '`1' SELECT * FROM v1 WHERE a <> 0 AND a = ' 1'; a Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '`1' +Warning 1292 Truncated incorrect DECIMAL value: '`1' DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (a ENUM('5','6')); @@ -6183,11 +6185,11 @@ CREATE VIEW v1 AS SELECT * FROM t1; SELECT * FROM t1 WHERE a <> 0 AND a = ' 1'; a Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '`1' +Warning 1292 Truncated incorrect DECIMAL value: '`1' SELECT * FROM v1 WHERE a <> 0 AND a = ' 1'; a Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '`1' +Warning 1292 Truncated incorrect DECIMAL value: '`1' DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (a ENUM('5','6')); @@ -6321,7 +6323,7 @@ t2 CREATE TABLE `t2` ( `code` int(11) DEFAULT NULL, `COUNT(DISTINCT country)` bigint(21) NOT NULL, `MAX(id)` int(11) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t3 AS SELECT code, COUNT(DISTINCT country), MAX(id) FROM v1 GROUP BY code ORDER BY MAX(id); SHOW CREATE TABLE t3; @@ -6330,7 +6332,7 @@ t3 CREATE TABLE `t3` ( `code` int(11) DEFAULT NULL, `COUNT(DISTINCT country)` bigint(21) NOT NULL, `MAX(id)` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP VIEW v1; DROP TABLE t1,t2,t3; # @@ -6558,7 +6560,7 @@ INSERT INTO t3 VALUES (1),(8); CREATE VIEW v1 AS SELECT * FROM t1 LEFT JOIN ( SELECT t2.* FROM t2 INNER JOIN t3 ON ( k = j ) ) AS alias1 ON ( i = j ); 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 `test`.`t1`.`i` AS `i`,`alias1`.`j` AS `j` from (`test`.`t1` left join (select `test`.`t2`.`j` AS `j` from (`test`.`t2` join `test`.`t3` on(`test`.`t3`.`k` = `test`.`t2`.`j`))) `alias1` on(`test`.`t1`.`i` = `alias1`.`j`)) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,`alias1`.`j` AS `j` from (`t1` left join (select `t2`.`j` AS `j` from (`t2` join `t3` on(`t3`.`k` = `t2`.`j`))) `alias1` on(`t1`.`i` = `alias1`.`j`)) latin1 latin1_swedish_ci SELECT * FROM t1 LEFT JOIN ( SELECT t2.* FROM t2 INNER JOIN t3 ON ( k = j ) ) AS alias1 ON ( i = j ); i j 3 NULL @@ -6705,7 +6707,7 @@ EXECUTE stmt; DEALLOCATE PREPARE stmt; 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 `testalias`.`testcase` AS `testcase` from (select case when 1 in (select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` < 2) then 1 end AS `testcase`) `testalias` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `testalias`.`testcase` AS `testcase` from (select case when 1 in (select `t1`.`a` from `t1` where `t1`.`a` < 2) then 1 end AS `testcase`) `testalias` latin1 latin1_swedish_ci SELECT * FROM v1; testcase 1 @@ -6728,7 +6730,9 @@ DROP TABLE t1; # # MDEV-24314: create view with derived table without default database # -drop database test; +create database dummy; +use dummy; +drop database dummy; create database db1; create table db1.t1 (a int); insert into db1.t1 values (3),(7),(1); @@ -6758,7 +6762,6 @@ a drop view db1.v1; drop table db1.t1; drop database db1; -create database test; use test; # # MDEV-16940: update of multi-table view returning error used in SP @@ -6792,49 +6795,6 @@ sum(z) DROP TABLE t1; DROP VIEW v1; # -# MDEV-24454: Crash at change_item_tree -# -CREATE TABLE t1(f0 INT); -CREATE VIEW v1 AS -SELECT -f0 AS f1 -FROM t1; -CREATE VIEW v2 AS -SELECT -(SELECT GROUP_CONCAT(v1.f1 SEPARATOR ', ') -FROM v1 n) AS f2, -GROUP_CONCAT('' SEPARATOR ', ') AS f3 -FROM v1; -CREATE VIEW v3 AS -SELECT 1 as f4 FROM v2; -CREATE PROCEDURE p1() -SELECT * FROM v3; -CALL p1(); -f4 -1 -CALL p1(); -f4 -1 -drop procedure p1; -drop view v1,v2,v3; -drop table t1; -# -# MDEV-25631: Crash in st_select_lex::mark_as_dependent with -# VIEW, aggregate and subquery -# -CREATE TABLE t1 (i1 int); -insert into t1 values (1),(2),(3); -CREATE VIEW v1 AS -SELECT t1.i1 FROM (t1 a JOIN t1 ON (t1.i1 = (SELECT t1.i1 FROM t1 b))); -SELECT 1 FROM (SELECT count(((SELECT i1 FROM v1))) FROM v1) dt ; -ERROR 21000: Subquery returns more than 1 row -delete from t1 where i1 > 1; -SELECT 1 FROM (SELECT count(((SELECT i1 FROM v1))) FROM v1) dt ; -1 -1 -drop view v1; -drop table t1; -# # MDEV-26299: Some views force server (and mysqldump) to generate # invalid SQL for their definitions # @@ -6846,6 +6806,52 @@ drop view v1; CREATE VIEW v1 AS select `t1`.`12345678901234567890123456789012345678901234567890123456789012345` AS `Name_exp_1` from (select '12345678901234567890123456789012345678901234567890123456789012345') `t1`; drop view v1; # +# MDEV-25631: view with outer reference in select used +# as argument of set function +# +create table t1 (c int); +insert into t1 values (1); +create view v1 as select c from t1 where (select t1.c from t1 t) = 1; +select * from (select sum((select * from v1)) as r) dt; +r +1 +with cte as (select c from t1 where (select t1.c from t1 t) = 1) +select * from (select sum((select * from cte)) as r) dt1 +union +select * from (select sum((select * from cte)) as r) dt2; +r +1 +drop view v1; +drop table t1; +# +# MDEV-17124: mariadb 10.1.34, views and prepared statements: +# ERROR 1615 (HY000): Prepared statement needs to be re-prepared +# +set @tdc= @@table_definition_cache, @tc= @@table_open_cache; +set global table_definition_cache= 400, table_open_cache= 400; +create table tt (a int, primary key(a)) engine=MyISAM; +create view v as select * from tt; +insert into tt values(1),(2),(3),(4); +prepare stmt from 'select * from tt'; +#fill table definition cache +execute stmt; +a +1 +2 +3 +4 +prepare stmt from 'select * from v'; +execute stmt; +a +1 +2 +3 +4 +drop database db; +drop view v; +drop table tt; +set global table_definition_cache= @tdc, table_open_cache= @tc; +# # End of 10.2 tests # # @@ -6879,6 +6885,42 @@ id bar Drop View v1; Drop table t1; # +# MDEV-24281: Execution of PREPARE from CREATE VIEW statement +# +create table t1 (s1 int); +insert into t1 values (3), (7), (1); +prepare stmt from " +create view v1 as select 's1', s1, 1 as My_exp_s1 from t1; +"; +execute stmt; +deallocate prepare stmt; +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 's1' AS `My_exp_1_s1`,`t1`.`s1` AS `s1`,1 AS `My_exp_s1` from `t1` latin1 latin1_swedish_ci +select * from v1; +My_exp_1_s1 s1 My_exp_s1 +s1 3 1 +s1 7 1 +s1 1 1 +drop view v1; +prepare stmt from " +create view v1 as select 's1', s1, 1 as My_exp_s1 from t1; +"; +execute stmt; +execute stmt; +ERROR 42S01: Table 'v1' already exists +deallocate prepare stmt; +drop view v1; +drop table t1; +# +# MDEV-28696 View created as "select b''; " references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +# +CREATE VIEW v1 as select b''; +SELECT * FROM v1; +b'' + +DROP VIEW v1; +# # End of 10.3 tests # # @@ -6897,8 +6939,37 @@ CREATE TABLE t4 AS SELECT * FROM t1 JOIN t2 ON t1.x > t2.b; ERROR 42S22: Unknown column 't1.x' in 'on clause' DROP TABLE t1,t2,t3; # -# End of 10.4 tests +# MDEV-29088: view specification contains unknown column in ON condition +# +create table t1 (a int); +create table t2 (b int); +create table t3 (c int); +create view v as +select * from t1 left join t2 on t1.a=t2.b and t1.a in (select d from t3); +ERROR 42S22: Unknown column 'd' in 'field list' +create algorithm=merge view v as +select * from t1 left join t2 on t1.a=t2.b and t1.a in (select d from t3); +ERROR 42S22: Unknown column 'd' in 'field list' +drop table t1,t2,t3; # +# MDEV-31189: Server crash or assertion failure in upon 2nd +# execution of PS with views and HAVING +# +CREATE TABLE t (f INT); +INSERT INTO t VALUES (1),(2); +CREATE VIEW v1 AS SELECT 1 AS a; +CREATE VIEW v2 AS SELECT a FROM v1; +PREPARE stmt FROM "SELECT * FROM v2 HAVING 1 IN (SELECT f FROM t)"; +EXECUTE stmt; +a +1 +EXECUTE stmt; +a +1 +DROP VIEW v1; +DROP VIEW v2; +DROP TABLE t; +# End of 10.4 tests # # MDEV-13115: SELECT .. SKIP LOCKED - ensure SHOW CREATE VIEW is correct # @@ -6925,5 +6996,20 @@ Drop View v3; Drop View v4; Drop table t1; # +# MDEV-26456: SIGSEGV in flush_tables_with_read_lock on FLUSH TABLE +# +CREATE FUNCTION f() RETURNS INT RETURN (SELECT 1 FROM t); +CREATE VIEW v AS SELECT f(); +SELECT * FROM v; +ERROR HY000: View 'test.v' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +FLUSH TABLE v WITH READ LOCK; +UNLOCK TABLES; +FLUSH TABLES v FOR EXPORT; +UNLOCK TABLES; +SELECT * FROM v; +ERROR HY000: View 'test.v' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +DROP VIEW v; +DROP FUNCTION f; +# # End of 10.6 tests # diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test index 4bc688efa3d93..fa3f0d312a709 100644 --- a/mysql-test/main/view.test +++ b/mysql-test/main/view.test @@ -1334,6 +1334,8 @@ execute stmt1 using @a; set @a= 301; execute stmt1 using @a; deallocate prepare stmt1; +insert into v3(a) select sum(302); +insert into v3(a) select sum(303) over (); --sorted_result select * from v3; @@ -1715,18 +1717,6 @@ select * from v1 where '2005.02.02'=f1; drop view v1; drop table t1; -# -# using encrypt & substring_index in view (Bug#7024) -# -CREATE VIEW v1 AS SELECT ENCRYPT("dhgdhgd"); -disable_result_log; -SELECT * FROM v1; -enable_result_log; -drop view v1; -CREATE VIEW v1 AS SELECT SUBSTRING_INDEX("dkjhgd:kjhdjh", ":", 1); -SELECT * FROM v1; -drop view v1; - # # hide underlying tables names in case of imposibility to update (Bug#10773) # @@ -6447,7 +6437,9 @@ DROP TABLE t1; --echo # MDEV-24314: create view with derived table without default database --echo # -drop database test; +create database dummy; +use dummy; +drop database dummy; create database db1; create table db1.t1 (a int); @@ -6470,7 +6462,6 @@ drop view db1.v1; drop table db1.t1; drop database db1; -create database test; use test; --echo # @@ -6512,72 +6503,82 @@ DROP TABLE t1; DROP VIEW v1; --echo # ---echo # MDEV-24454: Crash at change_item_tree +--echo # MDEV-26299: Some views force server (and mysqldump) to generate +--echo # invalid SQL for their definitions --echo # -CREATE TABLE t1(f0 INT); - -CREATE VIEW v1 AS -SELECT - f0 AS f1 -FROM t1; +create view v1 as + select * from + (select + "12345678901234567890123456789012345678901234567890123456789012345") as t1; -CREATE VIEW v2 AS -SELECT - (SELECT GROUP_CONCAT(v1.f1 SEPARATOR ', ') - FROM v1 n) AS f2, - GROUP_CONCAT('' SEPARATOR ', ') AS f3 -FROM v1; +let $definition=`select VIEW_DEFINITION from information_schema.views where TABLE_NAME="v1"`; -CREATE VIEW v3 AS -SELECT 1 as f4 FROM v2; +drop view v1; -CREATE PROCEDURE p1() - SELECT * FROM v3; +eval CREATE VIEW v1 AS $definition; -CALL p1(); -CALL p1(); -drop procedure p1; -drop view v1,v2,v3; -drop table t1; +drop view v1; --echo # ---echo # MDEV-25631: Crash in st_select_lex::mark_as_dependent with ---echo # VIEW, aggregate and subquery +--echo # MDEV-25631: view with outer reference in select used +--echo # as argument of set function --echo # -CREATE TABLE t1 (i1 int); -insert into t1 values (1),(2),(3); #not important -CREATE VIEW v1 AS - SELECT t1.i1 FROM (t1 a JOIN t1 ON (t1.i1 = (SELECT t1.i1 FROM t1 b))); +create table t1 (c int); +insert into t1 values (1); +create view v1 as select c from t1 where (select t1.c from t1 t) = 1; ---error ER_SUBQUERY_NO_1_ROW -SELECT 1 FROM (SELECT count(((SELECT i1 FROM v1))) FROM v1) dt ; -delete from t1 where i1 > 1; -SELECT 1 FROM (SELECT count(((SELECT i1 FROM v1))) FROM v1) dt ; +select * from (select sum((select * from v1)) as r) dt; + +with cte as (select c from t1 where (select t1.c from t1 t) = 1) +select * from (select sum((select * from cte)) as r) dt1 +union +select * from (select sum((select * from cte)) as r) dt2; drop view v1; drop table t1; - --echo # ---echo # MDEV-26299: Some views force server (and mysqldump) to generate ---echo # invalid SQL for their definitions +--echo # MDEV-17124: mariadb 10.1.34, views and prepared statements: +--echo # ERROR 1615 (HY000): Prepared statement needs to be re-prepared --echo # -create view v1 as - select * from - (select - "12345678901234567890123456789012345678901234567890123456789012345") as t1; +set @tdc= @@table_definition_cache, @tc= @@table_open_cache; +set global table_definition_cache= 400, table_open_cache= 400; -let $definition=`select VIEW_DEFINITION from information_schema.views where TABLE_NAME="v1"`; +create table tt (a int, primary key(a)) engine=MyISAM; +create view v as select * from tt; +insert into tt values(1),(2),(3),(4); -drop view v1; +prepare stmt from 'select * from tt'; +--echo #fill table definition cache +--disable_query_log +--disable_result_log +create database db; +use db; +--let $tables=401 +while ($tables) +{ + --eval create table t$tables (i int) engine=MyISAM + --eval select * from t$tables + --dec $tables +} -eval CREATE VIEW v1 AS $definition; +use test; -drop view v1; +--enable_query_log +--enable_result_log +execute stmt; +prepare stmt from 'select * from v'; +execute stmt; + +# Cleanup +drop database db; +drop view v; +drop table tt; +set global table_definition_cache= @tdc, table_open_cache= @tc; --echo # --echo # End of 10.2 tests @@ -6618,6 +6619,41 @@ SELECT v.id, v.foo AS bar FROM v1 v Drop View v1; Drop table t1; +--echo # +--echo # MDEV-24281: Execution of PREPARE from CREATE VIEW statement +--echo # + +create table t1 (s1 int); +insert into t1 values (3), (7), (1); + +prepare stmt from " +create view v1 as select 's1', s1, 1 as My_exp_s1 from t1; +"; +execute stmt; +deallocate prepare stmt; +show create view v1; +select * from v1; +drop view v1; + +prepare stmt from " +create view v1 as select 's1', s1, 1 as My_exp_s1 from t1; +"; +execute stmt; +--error ER_TABLE_EXISTS_ERROR +execute stmt; +deallocate prepare stmt; +drop view v1; +drop table t1; + +--echo # +--echo # MDEV-28696 View created as "select b''; " references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +--echo # + +CREATE VIEW v1 as select b''; +SELECT * FROM v1; +DROP VIEW v1; + + --echo # --echo # End of 10.3 tests --echo # @@ -6642,9 +6678,44 @@ CREATE TABLE t4 AS SELECT * FROM t1 JOIN t2 ON t1.x > t2.b; DROP TABLE t1,t2,t3; --echo # ---echo # End of 10.4 tests +--echo # MDEV-29088: view specification contains unknown column in ON condition --echo # +create table t1 (a int); +create table t2 (b int); +create table t3 (c int); + +--error ER_BAD_FIELD_ERROR +create view v as + select * from t1 left join t2 on t1.a=t2.b and t1.a in (select d from t3); + +--error ER_BAD_FIELD_ERROR +create algorithm=merge view v as + select * from t1 left join t2 on t1.a=t2.b and t1.a in (select d from t3); + +drop table t1,t2,t3; + +--echo # +--echo # MDEV-31189: Server crash or assertion failure in upon 2nd +--echo # execution of PS with views and HAVING +--echo # + +CREATE TABLE t (f INT); +INSERT INTO t VALUES (1),(2); # Optional, fails either way +CREATE VIEW v1 AS SELECT 1 AS a; +CREATE VIEW v2 AS SELECT a FROM v1; + +PREPARE stmt FROM "SELECT * FROM v2 HAVING 1 IN (SELECT f FROM t)"; +EXECUTE stmt; +EXECUTE stmt; + +# Cleanup +DROP VIEW v1; +DROP VIEW v2; +DROP TABLE t; + +--echo # End of 10.4 tests + --echo # --echo # MDEV-13115: SELECT .. SKIP LOCKED - ensure SHOW CREATE VIEW is correct --echo # @@ -6669,6 +6740,24 @@ Drop View v3; Drop View v4; Drop table t1; +--echo # +--echo # MDEV-26456: SIGSEGV in flush_tables_with_read_lock on FLUSH TABLE +--echo # + +CREATE FUNCTION f() RETURNS INT RETURN (SELECT 1 FROM t); +CREATE VIEW v AS SELECT f(); +--error ER_VIEW_INVALID +SELECT * FROM v; +FLUSH TABLE v WITH READ LOCK; +UNLOCK TABLES; +FLUSH TABLES v FOR EXPORT; +UNLOCK TABLES; +--error ER_VIEW_INVALID +SELECT * FROM v; + +DROP VIEW v; +DROP FUNCTION f; + --echo # --echo # End of 10.6 tests --echo # diff --git a/mysql-test/main/view_grant.result b/mysql-test/main/view_grant.result index c31ba882e765a..370035147a164 100644 --- a/mysql-test/main/view_grant.result +++ b/mysql-test/main/view_grant.result @@ -25,13 +25,13 @@ create definer=root@localhost view v1 as select * from mysqltest.t1; ERROR 42000: Access denied; you need (at least one of) the SUPER, SET USER privilege(s) for this operation create view v1 as select * from mysqltest.t1; alter view v1 as select * from mysqltest.t1; -ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 'v1' +ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table `test`.`v1` create or replace view v1 as select * from mysqltest.t1; -ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 'v1' +ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table `test`.`v1` create view mysqltest.v2 as select * from mysqltest.t1; -ERROR 42000: CREATE VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2' +ERROR 42000: CREATE VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v2` create view v2 as select * from mysqltest.t2; -ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2' +ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`t2` connection root; show create view v1; View Create View character_set_client collation_connection @@ -98,7 +98,7 @@ c select c from mysqltest.v4; c select c from mysqltest.v5; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v5' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v5` show columns from mysqltest.v1; Field Type Null Key Default Extra c bigint(12) YES NULL @@ -110,23 +110,23 @@ d bigint(12) YES NULL explain select c from mysqltest.v1; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v1; -ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1' +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v1` explain select c from mysqltest.v2; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v2; -ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2' +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v2` explain select c from mysqltest.v3; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v3; -ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v3' +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v3` explain select c from mysqltest.v4; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v4; -ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v4' +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v4` explain select c from mysqltest.v5; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v5' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v5` show create view mysqltest.v5; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v5' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v5` connection root; grant select on mysqltest.v5 to mysqltest_1@localhost; connection user1; @@ -136,7 +136,7 @@ v5 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI explain select c from mysqltest.v1; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v1; -ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1' +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v1` connection root; grant show view on mysqltest.v1 to mysqltest_1@localhost; grant select on mysqltest.t1 to mysqltest_1@localhost; @@ -151,17 +151,17 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI explain select c from mysqltest.v2; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v2; -ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2' +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v2` explain select c from mysqltest.v3; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v3; -ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v3' +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v3` explain select c from mysqltest.v4; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v4; -ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v4' +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v4` explain select c from mysqltest.v5; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v5' +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v5` connection root; grant show view on mysqltest.* to mysqltest_1@localhost; connection user1; @@ -248,9 +248,9 @@ ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for column update v2 set c=a+c; ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for column 'c' in table 'v2' update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c; -ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table 'v3' +ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v3` update v3 set a=a+c; -ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table 'v3' +ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v3` use test; connection root; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; @@ -281,9 +281,9 @@ select * from t1; a b 5 10 delete v2 from t2,v2 where t2.x=v2.c; -ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v2` delete from v2 where c < 4; -ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table 'v2' +ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v2` use test; connection root; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; @@ -316,9 +316,9 @@ a b 5 6 3 4 insert into v2 values (5,6); -ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v2` insert into v2 select x,y from t2; -ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table 'v2' +ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v2` use test; connection root; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; @@ -336,7 +336,7 @@ connection user1; create view v1 as select * from mysqltest.t1; create view v2 as select b from mysqltest.t2; create view mysqltest.v1 as select * from mysqltest.t1; -ERROR 42000: CREATE VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1' +ERROR 42000: CREATE VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v1` create view v3 as select a from mysqltest.t2; ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for column 'a' in table 't2' connection root; @@ -605,7 +605,7 @@ connection user1; use mysqltest; LOCK TABLES v1 READ; SHOW CREATE TABLE v1; -ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1' +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v1` UNLOCK TABLES; use test; connection root; @@ -664,29 +664,29 @@ ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or SELECT 1 FROM mysqltest1.v_t1; ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them SELECT * FROM mysqltest1.t1; -ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for table `mysqltest1`.`t1` SELECT * FROM mysqltest1.v_ts; x 1 2 SELECT * FROM mysqltest1.v_ts, mysqltest1.t1 WHERE mysqltest1.t1.x = mysqltest1.v_ts.x; -ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for table `mysqltest1`.`t1` SELECT * FROM mysqltest1.v_ti; -ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for table 'v_ti' +ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for table `mysqltest1`.`v_ti` INSERT INTO mysqltest1.v_ts VALUES (100); -ERROR 42000: INSERT command denied to user 'readonly'@'localhost' for table 'v_ts' +ERROR 42000: INSERT command denied to user 'readonly'@'localhost' for table `mysqltest1`.`v_ts` INSERT INTO mysqltest1.v_ti VALUES (100); UPDATE mysqltest1.v_ts SET x= 200 WHERE x = 100; -ERROR 42000: UPDATE command denied to user 'readonly'@'localhost' for table 'v_ts' +ERROR 42000: UPDATE command denied to user 'readonly'@'localhost' for table `mysqltest1`.`v_ts` UPDATE mysqltest1.v_ts SET x= 200; -ERROR 42000: UPDATE command denied to user 'readonly'@'localhost' for table 'v_ts' +ERROR 42000: UPDATE command denied to user 'readonly'@'localhost' for table `mysqltest1`.`v_ts` UPDATE mysqltest1.v_tu SET x= 200 WHERE x = 100; UPDATE mysqltest1.v_tus SET x= 200 WHERE x = 100; UPDATE mysqltest1.v_tu SET x= 200; DELETE FROM mysqltest1.v_ts WHERE x= 200; -ERROR 42000: DELETE command denied to user 'readonly'@'localhost' for table 'v_ts' +ERROR 42000: DELETE command denied to user 'readonly'@'localhost' for table `mysqltest1`.`v_ts` DELETE FROM mysqltest1.v_ts; -ERROR 42000: DELETE command denied to user 'readonly'@'localhost' for table 'v_ts' +ERROR 42000: DELETE command denied to user 'readonly'@'localhost' for table `mysqltest1`.`v_ts` DELETE FROM mysqltest1.v_td WHERE x= 200; ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for column 'x' in table 'v_td' DELETE FROM mysqltest1.v_tds WHERE x= 200; @@ -899,11 +899,11 @@ REVOKE SELECT ON t2 FROM mysqltest_u2@localhost; UPDATE t2 SET s = 'private' WHERE s = 'public'; connection conn2; SELECT * FROM mysqltest_db1.v1, mysqltest_db1.t2; -ERROR 42000: SELECT command denied to user 'mysqltest_u2'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'mysqltest_u2'@'localhost' for table `mysqltest_db1`.`t2` EXECUTE stmt1; -ERROR 42000: SELECT command denied to user 'mysqltest_u2'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'mysqltest_u2'@'localhost' for table `mysqltest_db1`.`t2` EXECUTE stmt2; -ERROR 42000: SELECT command denied to user 'mysqltest_u2'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'mysqltest_u2'@'localhost' for table `mysqltest_db1`.`t2` disconnect conn2; disconnect conn1; connection default; @@ -928,9 +928,9 @@ GRANT SELECT ON db26813.t1 TO u26813@localhost; connect u1,localhost,u26813,,db26813; connection u1; ALTER VIEW v1 AS SELECT f2 FROM t1; -ERROR 42000: CREATE VIEW command denied to user 'u26813'@'localhost' for table 'v1' +ERROR 42000: CREATE VIEW command denied to user 'u26813'@'localhost' for table `db26813`.`v1` ALTER VIEW v2 AS SELECT f2 FROM t1; -ERROR 42000: DROP command denied to user 'u26813'@'localhost' for table 'v2' +ERROR 42000: DROP command denied to user 'u26813'@'localhost' for table `db26813`.`v2` ALTER VIEW v3 AS SELECT f2 FROM t1; ERROR 42000: Access denied; you need (at least one of) the SUPER, SET USER privilege(s) for this operation connection root; @@ -1093,13 +1093,13 @@ f1 SELECT f2 FROM t1; ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'f2' in table 't1' SELECT * FROM t1; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `db1`.`t1` SELECT f1 FROM v1; f1 SELECT f2 FROM v1; ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'f2' in table 'v1' SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `db1`.`v1` connection default; disconnect root; disconnect addconfoo; @@ -1196,9 +1196,9 @@ disconnect test11765687; connect test11765687,localhost,cecil,,mysqltest1; connection test11765687; select * from v1; -ERROR 42000: SELECT command denied to user 'cecil'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'cecil'@'localhost' for table `mysqltest1`.`v1` explain select * from v1; -ERROR 42000: SELECT command denied to user 'cecil'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'cecil'@'localhost' for table `mysqltest1`.`v1` disconnect test11765687; ... as dan connect test11765687,localhost,dan,,mysqltest1; @@ -1226,11 +1226,11 @@ show create view v2; View Create View character_set_client collation_connection v2 CREATE ALGORITHM=UNDEFINED DEFINER=`alice`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `v1`.`i` AS `i`,`t2`.`j` AS `j` from (`v1` join `t2`) latin1 latin1_swedish_ci explain select * from t1; -ERROR 42000: SELECT command denied to user 'fiona'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'fiona'@'localhost' for table `mysqltest1`.`t1` explain select * from v1; -ERROR 42000: SELECT command denied to user 'fiona'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'fiona'@'localhost' for table `mysqltest1`.`v1` explain select * from t2; -ERROR 42000: SELECT command denied to user 'fiona'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'fiona'@'localhost' for table `mysqltest1`.`t2` explain select * from v2; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table disconnect test11765687; @@ -1240,7 +1240,7 @@ connection test11765687; select * from v2; i j explain select * from v1; -ERROR 42000: SELECT command denied to user 'greg'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'greg'@'localhost' for table `mysqltest1`.`v1` explain select * from v2; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table disconnect test11765687; @@ -1248,9 +1248,9 @@ disconnect test11765687; connect test11765687,localhost,han,,mysqltest1; connection test11765687; select * from t3; -ERROR 42000: SELECT command denied to user 'han'@'localhost' for table 't3' +ERROR 42000: SELECT command denied to user 'han'@'localhost' for table `mysqltest1`.`t3` explain select * from t3; -ERROR 42000: SELECT command denied to user 'han'@'localhost' for table 't3' +ERROR 42000: SELECT command denied to user 'han'@'localhost' for table `mysqltest1`.`t3` select k from t3; k explain select k from t3; @@ -1290,9 +1290,9 @@ disconnect test11765687; connect test11765687,localhost,lena,,mysqltest1; connection test11765687; select * from v2; -ERROR 42000: SELECT command denied to user 'lena'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'lena'@'localhost' for table `mysqltest1`.`v2` explain select * from v2; -ERROR 42000: SELECT command denied to user 'lena'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'lena'@'localhost' for table `mysqltest1`.`v2` disconnect test11765687; ... as mhairi connect test11765687,localhost,mhairi,,mysqltest1; @@ -1412,9 +1412,9 @@ connect connection1, localhost, mysqluser1, , mysqltest1; This would lead to failed assertion. CREATE VIEW v1 AS SELECT a, b FROM t1, t2; SELECT * FROM v1; -ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table `mysqltest1`.`v1` SELECT b FROM v1; -ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table `mysqltest1`.`v1` disconnect connection1; connection default; DROP TABLE t1, t2; @@ -1433,9 +1433,9 @@ GRANT SELECT( a ) ON v1 TO mysqluser1@localhost; GRANT UPDATE( b ) ON t2 TO mysqluser1@localhost; connect connection1, localhost, mysqluser1, , test; SELECT * FROM mysqltest1.v1; -ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table `mysqltest1`.`v1` CREATE VIEW v1 AS SELECT * FROM mysqltest1.t2; -ERROR 42000: ANY command denied to user 'mysqluser1'@'localhost' for table 't2' +ERROR 42000: ANY command denied to user 'mysqluser1'@'localhost' for table `mysqltest1`.`t2` disconnect connection1; connection default; DROP TABLE t1, t2; @@ -1458,9 +1458,9 @@ connection default; REVOKE SELECT ON mysqltest1.* FROM mysqluser1@localhost; connection connection1; EXECUTE stmt_v1; -ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table `mysqltest1`.`v1` EXECUTE stmt_v2; -ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v2' +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table `mysqltest1`.`v2` disconnect connection1; connect connection2, localhost, mysqluser1,,; PREPARE stmt FROM "SELECT a FROM v3"; @@ -1620,11 +1620,11 @@ REVOKE SHOW VIEW ON v_f1 FROM mysqluser1@localhost; REVOKE SHOW VIEW ON v_v1 FROM mysqluser1@localhost; connection connection1; SHOW CREATE VIEW mysqltest1.v_t1; -ERROR 42000: SHOW VIEW command denied to user 'mysqluser1'@'localhost' for table 'v_t1' +ERROR 42000: SHOW VIEW command denied to user 'mysqluser1'@'localhost' for table `mysqltest1`.`v_t1` SHOW CREATE VIEW mysqltest1.v_f1; -ERROR 42000: SHOW VIEW command denied to user 'mysqluser1'@'localhost' for table 'v_f1' +ERROR 42000: SHOW VIEW command denied to user 'mysqluser1'@'localhost' for table `mysqltest1`.`v_f1` SHOW CREATE VIEW mysqltest1.v_v1; -ERROR 42000: SHOW VIEW command denied to user 'mysqluser1'@'localhost' for table 'v_v1' +ERROR 42000: SHOW VIEW command denied to user 'mysqluser1'@'localhost' for table `mysqltest1`.`v_v1` SHOW CREATE VIEW v_mysqluser1_t1; View Create View character_set_client collation_connection v_mysqluser1_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci @@ -1875,7 +1875,7 @@ update mysqltest2.t2 as t2, mysqltest1.v1_temp as v1 set t2.val= 'test4' # Temptable views can't be updated. update mysqltest2.t2 as t2, mysqltest1.v1_merge as v1 set v1.val= 'test5' where t2.id= v1.id; -ERROR 42000: UPDATE command denied to user 'user_11766767'@'localhost' for table 'v1_merge' +ERROR 42000: UPDATE command denied to user 'user_11766767'@'localhost' for table `mysqltest1`.`v1_merge` update mysqltest1.t1 as t1, mysqltest2.v2_merge as v2 set v2.val= 'test6' where t1.id= v2.id; # @@ -1899,7 +1899,7 @@ update mysqltest2.t2 as t2, mysqltest1.v11_temp as v11 set t2.val= 'test10' # on a view. update mysqltest2.t2 as t2, mysqltest1.v11_merge as v11 set v11.val= 'test11' where t2.id= v11.id; -ERROR 42000: UPDATE command denied to user 'user_11766767'@'localhost' for table 'v11_merge' +ERROR 42000: UPDATE command denied to user 'user_11766767'@'localhost' for table `mysqltest1`.`v11_merge` update mysqltest1.t1 as t1, mysqltest2.v21_merge as v21 set v21.val= 'test12' where t1.id= v21.id; # As before, temptable views are not updateable. @@ -1961,7 +1961,7 @@ CREATE VIEW foo.v AS SELECT * FROM JSON_TABLE('[1,2,3]', '$[*]' COLUMNS (num INT CREATE USER foo@localhost; connect con1,localhost,foo,,; SELECT * FROM foo.v; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'v' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `foo`.`v` # # Clean-up. # diff --git a/mysql-test/main/wait_timeout.test b/mysql-test/main/wait_timeout.test index 84841aabb8bf8..f7289ceed1f67 100644 --- a/mysql-test/main/wait_timeout.test +++ b/mysql-test/main/wait_timeout.test @@ -61,7 +61,7 @@ connection default; # When the connection is closed in this way, the error code should # be consistent see Bug#2845 for an explanation # depending on platform/client, either errno 2006 or 2013 can occur below ---error 2006,2013 +--error 2006,2013,5014 SELECT 2; --echo --enable_reconnect; --enable_reconnect @@ -113,7 +113,7 @@ connection con1; # When the connection is closed in this way, the error code should # be consistent see Bug#2845 for an explanation # depending on platform/client, either errno 2006 or 2013 can occur below ---error 2006,2013 +--error 2006,2013,5014 SELECT 2; --echo --enable_reconnect; --enable_reconnect diff --git a/mysql-test/main/warnings.result b/mysql-test/main/warnings.result index aa4cab37741e1..8340cb9e981af 100644 --- a/mysql-test/main/warnings.result +++ b/mysql-test/main/warnings.result @@ -327,7 +327,6 @@ select CAST(a AS DECIMAL(13,5)) FROM (SELECT '' as a) t; CAST(a AS DECIMAL(13,5)) 0.00000 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '' create table t1 (a integer unsigned); insert into t1 values (1),(-1),(0),(-2); diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result index b1e04fadb3a88..109296ef2a132 100644 --- a/mysql-test/main/win.result +++ b/mysql-test/main/win.result @@ -3276,7 +3276,7 @@ SHOW CREATE TABLE fv_result; Table Create Table fv_result CREATE TABLE `fv_result` ( `somedate` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM fv_result; somedate 2017-07-20 12:47:56 @@ -4277,6 +4277,91 @@ drop procedure sp7; drop view v1,v2; drop table t1; # +# MDEV-17785: Window functions not working in ONLY_FULL_GROUP_BY mode +# +CREATE TABLE t1(a VARCHAR(10), b int); +INSERT INTO t1 VALUES +('Maths', 60),('Maths', 60), +('Maths', 70),('Maths', 55), +('Biology', 60), ('Biology', 70); +SET @save_sql_mode= @@sql_mode; +SET sql_mode = 'ONLY_FULL_GROUP_BY'; +SELECT +RANK() OVER (PARTITION BY a ORDER BY b) AS rank, +a, b FROM t1 ORDER BY a, b DESC; +rank a b +2 Biology 70 +1 Biology 60 +4 Maths 70 +2 Maths 60 +2 Maths 60 +1 Maths 55 +SET sql_mode= @save_sql_mode; +DROP TABLE t1; +CREATE TABLE t1(i int,j int); +INSERT INTO t1 VALUES (1,1), (1,5),(1,4), (2,2),(2,5), (3,3),(4,4); +INSERT INTO t1 VALUES (1,1), (1,5),(1,4), (2,2),(2,5), (3,3),(4,4); +SELECT i, LAST_VALUE(COUNT(i)) OVER (PARTITION BY i ORDER BY j) FROM t1 GROUP BY i; +i LAST_VALUE(COUNT(i)) OVER (PARTITION BY i ORDER BY j) +1 6 +2 4 +3 2 +4 2 +DROP TABLE t1; +# +# MDEV-15208: server crashed, when using ORDER BY with window function and UNION +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(2),(2),(2),(2),(2); +SELECT 1 UNION SELECT a FROM t1 ORDER BY (row_number() over ()); +ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION +DROP TABLE t1; +# +# MDEV-19398: Assertion `item1->type() == Item::FIELD_ITEM && +# item2->type() == Item::FIELD_ITEM' failed in compare_order_elements +# +CREATE TABLE t1 ( id varchar(10)); +INSERT INTO t1 values (1),(2),(3); +SELECT +dense_rank() over (ORDER BY avg(1)+3), +rank() over (ORDER BY avg(1)) +FROM t1 +GROUP BY nullif(id, 15532); +dense_rank() over (ORDER BY avg(1)+3) rank() over (ORDER BY avg(1)) +1 1 +1 1 +1 1 +SELECT +dense_rank() over (ORDER BY avg(1)), +rank() over (ORDER BY avg(1)) +FROM t1 +GROUP BY nullif(id, 15532); +dense_rank() over (ORDER BY avg(1)) rank() over (ORDER BY avg(1)) +1 1 +1 1 +1 1 +drop table t1; +CREATE TABLE t1 ( a char(25), b text); +INSERT INTO t1 VALUES ('foo','bar'); +SELECT +SUM(b) OVER (PARTITION BY a), +ROW_NUMBER() OVER (PARTITION BY b) +FROM t1 +GROUP BY +LEFT((SYSDATE()), 'foo') +WITH ROLLUP; +SUM(b) OVER (PARTITION BY a) ROW_NUMBER() OVER (PARTITION BY b) +0 1 +0 2 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +Warning 1292 Truncated incorrect INTEGER value: 'foo' +Warning 1292 Truncated incorrect INTEGER value: 'foo' +Warning 1292 Truncated incorrect DOUBLE value: 'bar' +Warning 1292 Truncated incorrect DOUBLE value: 'bar' +drop table t1; +# +# # End of 10.2 tests # # @@ -4309,7 +4394,7 @@ t2 CREATE TABLE `t2` ( `pk` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL, `bit_or` bigint(21) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; pk a b 1 0 1 @@ -4324,7 +4409,7 @@ t2 CREATE TABLE `t2` ( `pk` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL, `bit_or` bigint(21) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; pk a bit_or 1 0 18446744073709551615 @@ -4332,6 +4417,46 @@ pk a bit_or DROP TABLE t2; DROP TABLE t1; # +# MDEV-15178: Filesort::make_sortorder: Assertion `pos->field != __null | +# +CREATE TABLE t1 (i1 int, a int); +INSERT INTO t1 VALUES (1, 1), (2, 2),(3, 3); +CREATE TABLE t2 (i2 int); +INSERT INTO t2 VALUES (1),(2),(5),(1),(7),(4),(3); +SELECT +a, +RANK() OVER (ORDER BY SUM(DISTINCT i1)) +FROM +t1, t2 WHERE t2.i2 = t1.i1 +GROUP BY +a; +a RANK() OVER (ORDER BY SUM(DISTINCT i1)) +1 1 +2 2 +3 3 +DROP TABLE t1, t2; +# +# MDEV-17014: Crash server using ROW_NUMBER() OVER (PARTITION ..) +# +CREATE TABLE t1 (UID BIGINT); +CREATE TABLE t2 (UID BIGINT); +CREATE TABLE t3 (UID BIGINT); +insert into t1 VALUES (1),(2); +insert into t2 VALUES (1),(2); +insert into t3 VALUES (1),(2); +SELECT +ROW_NUMBER() OVER (PARTITION BY GROUP_CONCAT(TT1.UID)) +FROM t1 TT1, +t2 TT2, +t3 TT3 +WHERE TT3.UID = TT1.UID AND TT2.UID = TT3.UID +GROUP BY TT1.UID +; +ROW_NUMBER() OVER (PARTITION BY GROUP_CONCAT(TT1.UID)) +1 +1 +DROP TABLE t1, t2, t3; +# # End of 10.3 tests # # @@ -4345,3 +4470,27 @@ row_number() OVER (order by a) 2 3 drop table t1; +# +# MDEV-28206 SIGSEGV in Item_field::fix_fields when using LEAD...OVER +# +CREATE TABLE t(c1 INT); +CREATE FUNCTION f() RETURNS INT READS SQL DATA BEGIN +DECLARE v INT; +SELECT 1 INTO v FROM (SELECT c1,COALESCE(LEAD(a2.c1) OVER (PARTITION BY a2.c1 ORDER BY a2.c1),a2.c1) AS a1 FROM (t a2 JOIN t a3 USING (c1))) a4; +RETURN 1; +END// +SELECT f(),f(); +f() f() +1 1 +EXECUTE IMMEDIATE "SELECT LEAD(c1) OVER (ORDER BY c1) FROM t NATURAL JOIN t AS a;"; +LEAD(c1) OVER (ORDER BY c1) +EXECUTE IMMEDIATE "SELECT SUM(c1) OVER (ORDER BY c1) FROM t NATURAL JOIN t AS a;"; +SUM(c1) OVER (ORDER BY c1) +EXECUTE IMMEDIATE "SELECT LEAD(c) OVER (ORDER BY c) FROM (SELECT 1 AS c) AS a NATURAL JOIN (SELECT 1 AS c) AS b;"; +LEAD(c) OVER (ORDER BY c) +NULL +DROP FUNCTION f; +DROP TABLE t; +# +# End of 10.6 tests +# diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test index 431333864618a..0cc929ce46bb3 100644 --- a/mysql-test/main/win.test +++ b/mysql-test/main/win.test @@ -1,6 +1,10 @@ # # Window Functions Tests # +--source include/no_valgrind_without_big.inc +#remove this include after fix MDEV-27871, MDEV-27938 +--source include/no_view_protocol.inc + --source include/have_sequence.inc --disable_warnings @@ -2702,6 +2706,76 @@ drop procedure sp7; drop view v1,v2; drop table t1; +--echo # +--echo # MDEV-17785: Window functions not working in ONLY_FULL_GROUP_BY mode +--echo # + +CREATE TABLE t1(a VARCHAR(10), b int); + +INSERT INTO t1 VALUES +('Maths', 60),('Maths', 60), +('Maths', 70),('Maths', 55), +('Biology', 60), ('Biology', 70); + +SET @save_sql_mode= @@sql_mode; +SET sql_mode = 'ONLY_FULL_GROUP_BY'; + +SELECT + RANK() OVER (PARTITION BY a ORDER BY b) AS rank, + a, b FROM t1 ORDER BY a, b DESC; + +SET sql_mode= @save_sql_mode; +DROP TABLE t1; + +CREATE TABLE t1(i int,j int); +INSERT INTO t1 VALUES (1,1), (1,5),(1,4), (2,2),(2,5), (3,3),(4,4); +INSERT INTO t1 VALUES (1,1), (1,5),(1,4), (2,2),(2,5), (3,3),(4,4); +SELECT i, LAST_VALUE(COUNT(i)) OVER (PARTITION BY i ORDER BY j) FROM t1 GROUP BY i; +DROP TABLE t1; + +--echo # +--echo # MDEV-15208: server crashed, when using ORDER BY with window function and UNION +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(2),(2),(2),(2),(2); +--error ER_AGGREGATE_ORDER_FOR_UNION +SELECT 1 UNION SELECT a FROM t1 ORDER BY (row_number() over ()); +DROP TABLE t1; + +--echo # +--echo # MDEV-19398: Assertion `item1->type() == Item::FIELD_ITEM && +--echo # item2->type() == Item::FIELD_ITEM' failed in compare_order_elements +--echo # +CREATE TABLE t1 ( id varchar(10)); +INSERT INTO t1 values (1),(2),(3); + +SELECT + dense_rank() over (ORDER BY avg(1)+3), + rank() over (ORDER BY avg(1)) +FROM t1 +GROUP BY nullif(id, 15532); + +SELECT + dense_rank() over (ORDER BY avg(1)), + rank() over (ORDER BY avg(1)) +FROM t1 +GROUP BY nullif(id, 15532); +drop table t1; + +CREATE TABLE t1 ( a char(25), b text); +INSERT INTO t1 VALUES ('foo','bar'); + +SELECT + SUM(b) OVER (PARTITION BY a), + ROW_NUMBER() OVER (PARTITION BY b) +FROM t1 +GROUP BY + LEFT((SYSDATE()), 'foo') +WITH ROLLUP; +drop table t1; + +--echo # --echo # --echo # End of 10.2 tests --echo # @@ -2742,6 +2816,46 @@ DROP TABLE t2; DROP TABLE t1; +--echo # +--echo # MDEV-15178: Filesort::make_sortorder: Assertion `pos->field != __null | +--echo # + +CREATE TABLE t1 (i1 int, a int); +INSERT INTO t1 VALUES (1, 1), (2, 2),(3, 3); + +CREATE TABLE t2 (i2 int); +INSERT INTO t2 VALUES (1),(2),(5),(1),(7),(4),(3); + +SELECT + a, + RANK() OVER (ORDER BY SUM(DISTINCT i1)) +FROM + t1, t2 WHERE t2.i2 = t1.i1 +GROUP BY + a; + +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-17014: Crash server using ROW_NUMBER() OVER (PARTITION ..) +--echo # +CREATE TABLE t1 (UID BIGINT); +CREATE TABLE t2 (UID BIGINT); +CREATE TABLE t3 (UID BIGINT); + +insert into t1 VALUES (1),(2); +insert into t2 VALUES (1),(2); +insert into t3 VALUES (1),(2); +SELECT +ROW_NUMBER() OVER (PARTITION BY GROUP_CONCAT(TT1.UID)) +FROM t1 TT1, + t2 TT2, + t3 TT3 +WHERE TT3.UID = TT1.UID AND TT2.UID = TT3.UID +GROUP BY TT1.UID +; + +DROP TABLE t1, t2, t3; --echo # --echo # End of 10.3 tests @@ -2755,3 +2869,31 @@ create table t1 (a int); insert into t1 values (1),(2),(3); SELECT row_number() OVER (order by a) FROM t1 order by NAME_CONST('myname',NULL); drop table t1; + +--echo # +--echo # MDEV-28206 SIGSEGV in Item_field::fix_fields when using LEAD...OVER +--echo # + +CREATE TABLE t(c1 INT); + +DELIMITER //; +CREATE FUNCTION f() RETURNS INT READS SQL DATA BEGIN + DECLARE v INT; + SELECT 1 INTO v FROM (SELECT c1,COALESCE(LEAD(a2.c1) OVER (PARTITION BY a2.c1 ORDER BY a2.c1),a2.c1) AS a1 FROM (t a2 JOIN t a3 USING (c1))) a4; + RETURN 1; +END// +DELIMITER ;// + +SELECT f(),f(); + +EXECUTE IMMEDIATE "SELECT LEAD(c1) OVER (ORDER BY c1) FROM t NATURAL JOIN t AS a;"; +EXECUTE IMMEDIATE "SELECT SUM(c1) OVER (ORDER BY c1) FROM t NATURAL JOIN t AS a;"; + +EXECUTE IMMEDIATE "SELECT LEAD(c) OVER (ORDER BY c) FROM (SELECT 1 AS c) AS a NATURAL JOIN (SELECT 1 AS c) AS b;"; + +DROP FUNCTION f; +DROP TABLE t; + +--echo # +--echo # End of 10.6 tests +--echo # diff --git a/mysql-test/main/win_avg.test b/mysql-test/main/win_avg.test index 23a3652d943df..86edcce5679d7 100644 --- a/mysql-test/main/win_avg.test +++ b/mysql-test/main/win_avg.test @@ -35,7 +35,8 @@ insert into t1 values (126 , 6, 1, NULL), (127 , 6, 1, NULL); - +#enable after fix MDEV-27871 +--disable_view_protocol --sorted_result select pk, a, b, avg(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) from t1; @@ -43,5 +44,5 @@ from t1; --sorted_result select pk, a, c, avg(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) from t1; - +--enable_view_protocol drop table t1; diff --git a/mysql-test/main/win_big-mdev-10092.test b/mysql-test/main/win_big-mdev-10092.test index 090d43b0b7b1d..c4bda66018bb8 100644 --- a/mysql-test/main/win_big-mdev-10092.test +++ b/mysql-test/main/win_big-mdev-10092.test @@ -85,6 +85,9 @@ call add_data(); call add_data(); set sort_buffer_size = 1024; +#enable after fix MDEV-27871 +--disable_view_protocol + flush status; select o_custkey, Avg(o_custkey) OVER ( ORDER BY o_custkey ) from orders; select variable_name, @@ -99,5 +102,7 @@ select variable_name, from information_schema.session_status where variable_name like 'Sort_merge_passes'; +--enable_view_protocol + drop table orders; drop procedure add_data; diff --git a/mysql-test/main/win_big-mdev-11697.test b/mysql-test/main/win_big-mdev-11697.test index 9488a93855434..b3ac2b41e894d 100644 --- a/mysql-test/main/win_big-mdev-11697.test +++ b/mysql-test/main/win_big-mdev-11697.test @@ -1,3 +1,5 @@ +--source include/no_valgrind_without_big.inc + set max_recursive_iterations=200000; create table test_table (id int, random_data varchar(36), static_int int, static_varchar varchar(10)); @@ -40,6 +42,8 @@ commit; analyze table test_table; explain select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10; +#enable after fix MDEV-27871 +--disable_view_protocol flush status; select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10; @@ -47,6 +51,7 @@ select variable_name, case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end from information_schema.session_status where variable_name like 'Sort_merge_passes'; +--enable_view_protocol drop table test_table; set max_recursive_iterations=default; diff --git a/mysql-test/main/win_big.test b/mysql-test/main/win_big.test index 09c8d640b099f..e53eaa7029168 100644 --- a/mysql-test/main/win_big.test +++ b/mysql-test/main/win_big.test @@ -28,10 +28,13 @@ select sum(b) over (order by a rows between 2 preceding and 2 following) as SUM_B from t10; +#enable after fix MDEV-27871 +--disable_view_protocol select variable_name, case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end from information_schema.session_status where variable_name like 'Sort_merge_passes'; +--enable_view_protocol set sort_buffer_size=1024; flush status; @@ -40,10 +43,13 @@ select sum(b) over (order by a rows between 2 preceding and 2 following) as SUM_B from t10; +#enable after fix MDEV-27871 +--disable_view_protocol select variable_name, case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end from information_schema.session_status where variable_name like 'Sort_merge_passes'; +--enable_view_protocol let $diff_tables= t21, t22; source include/diff_tables.inc; @@ -60,10 +66,13 @@ select sum(b) over (order by a rows between 20 preceding and 20 following) as SUM_B3 from t10; +#enable after fix MDEV-27871 +--disable_view_protocol select variable_name, case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end from information_schema.session_status where variable_name like 'Sort_merge_passes'; +--enable_view_protocol set sort_buffer_size=1024; flush status; @@ -74,10 +83,13 @@ select sum(b) over (order by a rows between 20 preceding and 20 following) as SUM_B3 from t10; +#enable after fix MDEV-27871 +--disable_view_protocol select variable_name, case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end from information_schema.session_status where variable_name like 'Sort_merge_passes'; +--enable_view_protocol let $diff_tables= t21, t22; source include/diff_tables.inc; @@ -94,11 +106,13 @@ select sum(b) over (order by a range between 5000 preceding and 5000 following) as SUM_B1 from t10; - +#enable after fix MDEV-27871 +--disable_view_protocol select variable_name, case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end from information_schema.session_status where variable_name like 'Sort_merge_passes'; +--enable_view_protocol set sort_buffer_size=1024; flush status; @@ -108,10 +122,13 @@ select sum(b) over (order by a range between 5000 preceding and 5000 following) as SUM_B1 from t10; +#enable after fix MDEV-27871 +--disable_view_protocol select variable_name, case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end from information_schema.session_status where variable_name like 'Sort_merge_passes'; +--enable_view_protocol let $diff_tables= t21, t22; source include/diff_tables.inc; diff --git a/mysql-test/main/win_first_last_value.result b/mysql-test/main/win_first_last_value.result index 4c3aa6a716157..1c1073eb34808 100644 --- a/mysql-test/main/win_first_last_value.result +++ b/mysql-test/main/win_first_last_value.result @@ -141,5 +141,5 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `FIRST_VALUE(b) OVER()` int(11) DEFAULT NULL, `FIRST_VALUE(c) OVER()` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2,t1; diff --git a/mysql-test/main/win_first_last_value.test b/mysql-test/main/win_first_last_value.test index 0a90a98a5d47f..d027eb84702ea 100644 --- a/mysql-test/main/win_first_last_value.test +++ b/mysql-test/main/win_first_last_value.test @@ -27,6 +27,8 @@ select pk, first_value(pk) over (order by pk), from t1 order by pk desc; +#enable after fix MDEV-28535 +--disable_view_protocol select pk, first_value(pk) over (order by pk RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), @@ -38,6 +40,7 @@ select pk, RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) from t1 order by pk; +--enable_view_protocol select pk, first_value(pk) over (order by pk desc), diff --git a/mysql-test/main/win_nth_value.test b/mysql-test/main/win_nth_value.test index b9764d1e9d7cf..2d47677f65c7a 100644 --- a/mysql-test/main/win_nth_value.test +++ b/mysql-test/main/win_nth_value.test @@ -42,11 +42,16 @@ select pk, from t1 order by pk asc; +#enable after fix MDEV-27871 +--disable_view_protocol select pk, a, nth_value(pk, 1) over (partition by a order by pk ROWS between 1 preceding and 1 following) from t1; +--enable_view_protocol +#enable after fix MDEV-28535 +--disable_view_protocol select pk, a, nth_value(a, 1) over (order by a RANGE BETWEEN 1 preceding and 1 following), @@ -63,5 +68,6 @@ select pk, nth_value(a, 12) over (order by a RANGE BETWEEN 1 preceding and 1 following) from t1 order by pk asc; +--enable_view_protocol drop table t1; diff --git a/mysql-test/main/win_ntile.test b/mysql-test/main/win_ntile.test index c65ba7e1521b2..c508b1627ad5f 100644 --- a/mysql-test/main/win_ntile.test +++ b/mysql-test/main/win_ntile.test @@ -152,6 +152,8 @@ select pk, a, b, from t1; select t1.a from t1 where pk = 13; +#enable after fix MDEV-27871 +--disable_view_protocol select pk, a, b, ntile((select a from t1 where pk=13)) over (partition by b order by pk) from t1; @@ -160,6 +162,7 @@ explain select pk, a, b, ntile((select a from t1 where pk=13)) over (partition by b order by pk) from t1; +--enable_view_protocol select a from t1; --error ER_SUBQUERY_NO_1_ROW diff --git a/mysql-test/main/win_orderby.result b/mysql-test/main/win_orderby.result index bf4a40a4db3c2..1a9860c1c7636 100644 --- a/mysql-test/main/win_orderby.result +++ b/mysql-test/main/win_orderby.result @@ -24,3 +24,66 @@ pk count(a) over (order by pk rows between 2 preceding and 2 following) 28 5 27 5 drop table t0,t1; +# +# MDEV-30052: Crash with a query containing nested WINDOW clauses +# +CREATE TABLE t1 (c INT); +insert into t1 values (1),(2); +UPDATE t1 SET c=1 +WHERE c=2 +ORDER BY +(1 IN (( +SELECT * +FROM (SELECT * FROM t1) AS v1 +GROUP BY c +WINDOW v2 AS (ORDER BY +(SELECT * +FROM t1 +GROUP BY c +WINDOW v3 AS (PARTITION BY c) +) +) +)) +); +drop table t1; +# +# MDEV-29359: Server crashed with heap-use-after-free in +# Field::is_null(long long) const (Just testcase) +# +CREATE TABLE t1 (id int); +INSERT INTO t1 VALUES (-1),(0),(84); +SELECT +id IN (SELECT id +FROM t1 +WINDOW w AS (ORDER BY (SELECT 1 +FROM t1 +WHERE +EXISTS ( SELECT id +FROM t1 +GROUP BY id +WINDOW w2 AS (ORDER BY id) +) +) +) +) +FROM t1; +id IN (SELECT id +FROM t1 +WINDOW w AS (ORDER BY (SELECT 1 +FROM t1 +WHERE +EXISTS ( SELECT id +FROM t1 +GROUP BY id +WINDOW w2 AS (ORDER BY id) +) +) +) +) +1 +1 +1 +DROP TABLE t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/win_orderby.test b/mysql-test/main/win_orderby.test index 0d42c60648619..65421fc095caa 100644 --- a/mysql-test/main/win_orderby.test +++ b/mysql-test/main/win_orderby.test @@ -21,6 +21,8 @@ select 1 from t0 A, t0 B, t0 C; +#enable after fix MDEV-27871 +--disable_view_protocol select pk, count(a) over (order by pk rows between 2 preceding and 2 following) @@ -28,5 +30,61 @@ from t1 where pk between 1 and 30 order by pk desc limit 4; +--disable_view_protocol drop table t0,t1; + + +--echo # +--echo # MDEV-30052: Crash with a query containing nested WINDOW clauses +--echo # + +CREATE TABLE t1 (c INT); +insert into t1 values (1),(2); +UPDATE t1 SET c=1 +WHERE c=2 +ORDER BY + (1 IN (( + SELECT * + FROM (SELECT * FROM t1) AS v1 + GROUP BY c + WINDOW v2 AS (ORDER BY + (SELECT * + FROM t1 + GROUP BY c + WINDOW v3 AS (PARTITION BY c) + ) + ) + )) + ); +drop table t1; + +--echo # +--echo # MDEV-29359: Server crashed with heap-use-after-free in +--echo # Field::is_null(long long) const (Just testcase) +--echo # + +CREATE TABLE t1 (id int); +INSERT INTO t1 VALUES (-1),(0),(84); + +SELECT + id IN (SELECT id + FROM t1 + WINDOW w AS (ORDER BY (SELECT 1 + FROM t1 + WHERE + EXISTS ( SELECT id + FROM t1 + GROUP BY id + WINDOW w2 AS (ORDER BY id) + ) + ) + ) + ) +FROM t1; + +DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/win_percentile.result b/mysql-test/main/win_percentile.result index 09c2c4fc5de7e..65788c21e789b 100644 --- a/mysql-test/main/win_percentile.result +++ b/mysql-test/main/win_percentile.result @@ -391,7 +391,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `name` char(30) DEFAULT NULL, `pc` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2, t1; # UNSIGNED INT variants CREATE OR REPLACE TABLE t1 (name CHAR(30), star_rating BIGINT UNSIGNED); @@ -408,7 +408,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `name` char(30) DEFAULT NULL, `pc` bigint(20) unsigned DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT name, pc, HEX(pc) FROM t2 ORDER BY name, pc; name pc HEX(pc) Lady of the Flies 9223372036854775810 8000000000000002 @@ -432,7 +432,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `name` char(30) DEFAULT NULL, `pc` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2, t1; # DECIMAL variants CREATE OR REPLACE TABLE t1 (name CHAR(30), star_rating DECIMAL(30,2)); @@ -449,7 +449,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `name` char(30) DEFAULT NULL, `pc` decimal(30,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2 ORDER BY name, pc; name pc Lady of the Flies 20000000000.00 diff --git a/mysql-test/main/win_percentile.test b/mysql-test/main/win_percentile.test index e981dc62c41b4..9626caffc541e 100644 --- a/mysql-test/main/win_percentile.test +++ b/mysql-test/main/win_percentile.test @@ -50,11 +50,13 @@ select name, percentile_cont(null) within group(order by score) over (partition --error ER_WRONG_TYPE_OF_ARGUMENT select name, percentile_disc(null) within group(order by score) over (partition by name) from t1; +--disable_view_protocol --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; +--enable_view_protocol --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; @@ -62,7 +64,10 @@ select name from t1 a where (select percentile_disc(0.5) within group (order by --error ER_WRONG_TYPE_FOR_PERCENTILE_FUNC select score, percentile_cont(0.5) within group(order by name) over (partition by score) from t1; +#enable after fix MDEV-27871 +--disable_view_protocol select score, percentile_disc(0.5) within group(order by name) over (partition by score) from t1; +--enable_view_protocol --echo #parameter value should be in the range of [0,1] --error ER_ARGUMENT_OUT_OF_RANGE diff --git a/mysql-test/main/win_std.test b/mysql-test/main/win_std.test index c1964ecac988f..e7986e2cf8415 100644 --- a/mysql-test/main/win_std.test +++ b/mysql-test/main/win_std.test @@ -25,6 +25,9 @@ select std(c) over (order by a) from t2; --enable_warnings +#enable after fix MDEV-27871 +--disable_view_protocol + --echo # Empty frame. select std(b) over (order by a rows between 2 following and 1 following) from t2; @@ -135,6 +138,7 @@ from t2; --sorted_result select pk, a, b, std(b) over (order by a range between 0 following and 1 following) from t2; +--enable_view_protocol drop table t1; drop table t2; diff --git a/mysql-test/main/win_sum.result b/mysql-test/main/win_sum.result index 66a48fe8293c7..71d87bd6ecac0 100644 --- a/mysql-test/main/win_sum.result +++ b/mysql-test/main/win_sum.result @@ -93,3 +93,15 @@ pk a c sum(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FO 126 6 NULL NULL 127 6 NULL NULL drop table t1; +# +# End of 10.2 tests +# +# +# MDEV-28094 Window function in expression in ORDER BY +# +SELECT EXISTS (SELECT 1 ORDER BY 1+sum(2) OVER ()); +EXISTS (SELECT 1 ORDER BY 1+sum(2) OVER ()) +1 +# +# End of 10.4 tests +# diff --git a/mysql-test/main/win_sum.test b/mysql-test/main/win_sum.test index aa4965bfd5ad3..d76ec4d6d2444 100644 --- a/mysql-test/main/win_sum.test +++ b/mysql-test/main/win_sum.test @@ -35,6 +35,8 @@ insert into t1 values (126 , 6, 1, NULL), (127 , 6, 1, NULL); +#enable after fix MDEV-27871 +--disable_view_protocol --sorted_result select pk, a, b, sum(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) @@ -43,5 +45,19 @@ from t1; --sorted_result select pk, a, c, sum(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) from t1; +--enable_view_protocol drop table t1; + +--echo # +--echo # End of 10.2 tests +--echo # + +--echo # +--echo # MDEV-28094 Window function in expression in ORDER BY +--echo # +SELECT EXISTS (SELECT 1 ORDER BY 1+sum(2) OVER ()); + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/windows_debug.result b/mysql-test/main/windows_debug.result index e6816cdd99be2..797056b00a1e5 100644 --- a/mysql-test/main/windows_debug.result +++ b/mysql-test/main/windows_debug.result @@ -1,4 +1,10 @@ # mdev-23741 sharing violation when renaming .frm file in ALTER -CREATE TABLE t(i int); -SET STATEMENT debug_dbug='+d,rename_sharing_violation' FOR ALTER TABLE t ADD PRIMARY KEY (i); +SET @saved_dbug = @@SESSION.debug_dbug; +SET debug_dbug='+d,file_sharing_violation'; +CREATE TABLE t(i int) ENGINE=ARIA; +ALTER TABLE t ADD PRIMARY KEY (i); +FLUSH TABLES t; +SELECT * FROM t; +i DROP TABLE t; +SET debug_dbug=@saved_dbug; diff --git a/mysql-test/main/windows_debug.test b/mysql-test/main/windows_debug.test index bb0880ddc550c..32ea57552a788 100644 --- a/mysql-test/main/windows_debug.test +++ b/mysql-test/main/windows_debug.test @@ -4,8 +4,16 @@ --source include/windows.inc --echo # mdev-23741 sharing violation when renaming .frm file in ALTER -CREATE TABLE t(i int); -SET STATEMENT debug_dbug='+d,rename_sharing_violation' FOR ALTER TABLE t ADD PRIMARY KEY (i); + +SET @saved_dbug = @@SESSION.debug_dbug; +SET debug_dbug='+d,file_sharing_violation'; + +CREATE TABLE t(i int) ENGINE=ARIA; +ALTER TABLE t ADD PRIMARY KEY (i); +FLUSH TABLES t; +SELECT * FROM t; DROP TABLE t; +SET debug_dbug=@saved_dbug; + #End of 10.3 tests diff --git a/mysql-test/main/winservice.inc b/mysql-test/main/winservice.inc index 42aab645cc84c..2d8f6ccae1e33 100644 --- a/mysql-test/main/winservice.inc +++ b/mysql-test/main/winservice.inc @@ -18,7 +18,7 @@ error 0,$ERROR_SERVICE_DOES_NOT_EXIST; exec $sc_exe delete $service_name; --enable_result_log -source include/kill_mysqld.inc; +source include/shutdown_mysqld.inc; echo # run mysql_install_db with --service parameter; --disable_result_log exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --port=$MASTER_MYPORT --password=$password --service=$service_name -R; diff --git a/mysql-test/main/winservice_basic.result b/mysql-test/main/winservice_basic.result index a4de00802070d..0a5e8693b6bc1 100644 --- a/mysql-test/main/winservice_basic.result +++ b/mysql-test/main/winservice_basic.result @@ -1,4 +1,3 @@ -# Kill the server # run mysql_install_db with --service parameter # Start service # Connect with root user password=password diff --git a/mysql-test/main/winservice_i18n.result b/mysql-test/main/winservice_i18n.result index 873f0828b1f5f..8d5eba3df38ec 100644 --- a/mysql-test/main/winservice_i18n.result +++ b/mysql-test/main/winservice_i18n.result @@ -1,4 +1,3 @@ -# Kill the server # run mysql_install_db with --service parameter # Start service # Connect with root user password=パスワード diff --git a/mysql-test/main/xa_prepared_binlog_off.test b/mysql-test/main/xa_prepared_binlog_off.test index edbfa7c28252f..7db25d7cc3fcf 100644 --- a/mysql-test/main/xa_prepared_binlog_off.test +++ b/mysql-test/main/xa_prepared_binlog_off.test @@ -5,6 +5,7 @@ --source include/not_valgrind.inc --source include/not_embedded.inc +--source include/no_view_protocol.inc # Common part with XA binlogging testing call mtr.add_suppression("You need to use --log-bin to make --log-slave-updates work."); diff --git a/mysql-test/main/xml.test b/mysql-test/main/xml.test index 3c7ecf6d060dc..f042c4371ce83 100644 --- a/mysql-test/main/xml.test +++ b/mysql-test/main/xml.test @@ -166,11 +166,14 @@ select extractValue('','/a/@b[2=position()]'); select extractValue('','/a/@b[3=position()]'); select extractValue('','/a/@b[2>=position()]'); select extractValue('','/a/@b[2<=position()]'); +#enable after fix MDEV-27871 +--disable_view_protocol select extractValue('','/a/@b[position()=3 or position()=2]'); SELECT extractValue('aa1c1a2','/a/b[count(c)=0]'); SELECT extractValue('aa1c1a2','/a/b[count(c)=1]'); select extractValue('a1b1b24','/a/b[sum(@ba)=3]'); +--enable_view_protocol select extractValue('b1b2','/a/b[1]'); select extractValue('b1b2','/a/b[boolean(1)]'); @@ -213,8 +216,11 @@ select extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")]'); select extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")][2]'); SET @xml='a1b1c1b2a2'; +#enable after fix MDEV-27871 +--disable_view_protocol select UpdateXML('a1b1c1b2a2','/a/b/c','+++++++++'); select UpdateXML('a1b1c1b2a2','/a/b/c','+++++++++'); +--enable_view_protocol select UpdateXML('a1b1c1b2a2','/a/b/c',''); SET @xml='bb'; @@ -271,7 +277,10 @@ select extractvalue('bb!','//b!'); # select extractvalue('ABC','/a/descendant::*'); select extractvalue('ABC','/a/self::*'); +#enable after fix MDEV-27871 +--disable_view_protocol select extractvalue('ABC','/a/descendant-or-self::*'); +--enable_view_protocol # Bug #16320 XML: extractvalue() won't accept names containing underscores # select extractvalue('A','/A_B'); @@ -280,24 +289,36 @@ select extractvalue('A','/A_B'); # Bug#16318: XML: extractvalue() incorrectly returns last() = 1 # select extractvalue('AB1B2','/a/b[position()]'); +#enable after fix MDEV-27871 +--disable_view_protocol select extractvalue('AB1B2','/a/b[count(.)=last()]'); +--enable_view_protocol select extractvalue('AB1B2','/a/b[last()]'); select extractvalue('AB1B2','/a/b[last()-1]'); select extractvalue('AB1B2','/a/b[last()=1]'); select extractvalue('AB1B2','/a/b[last()=2]'); +#enable after fix MDEV-27871 +--disable_view_protocol select extractvalue('AB1B2','/a/b[last()=position()]'); +--enable_view_protocol select extractvalue('AB1B2','/a/b[count(.)]'); select extractvalue('AB1B2','/a/b[count(.)-1]'); select extractvalue('AB1B2','/a/b[count(.)=1]'); select extractvalue('AB1B2','/a/b[count(.)=2]'); +#enable after fix MDEV-27871 +--disable_view_protocol select extractvalue('AB1B2','/a/b[count(.)=position()]'); +--enable_view_protocol # # Bug#16316: XML: extractvalue() is case-sensitive with contains() # select extractvalue('Jack','/a[contains(../a,"J")]'); select extractvalue('Jack','/a[contains(../a,"j")]'); +#enable after fix MDEV-27871 +--disable_view_protocol select extractvalue('Jack','/a[contains(../a,"j")]' collate latin1_bin); select extractvalue('Jack' collate latin1_bin,'/a[contains(../a,"j")]'); +--enable_view_protocol # # Bug#18285: ExtractValue not returning character @@ -309,12 +330,16 @@ select ExtractValue('','/tag1'); # Bug#18201: XML: ExtractValue works even if the xml fragment # is not well-formed xml # + +#view protocol generates additional warning +--disable_view_protocol select extractValue('a','/a'); select extractValue('a<','/a'); select extractValue('aaa','/a'); select extractValue('a','/a'); +--enable_view_protocol # # Bug #18171 XML: ExtractValue: the XPath position() @@ -358,22 +383,33 @@ DROP PROCEDURE p2; # Bug#18170: XML: ExtractValue(): # XPath expression can't use QNames (colon in names) # +#enable after fix MDEV-27871 +--disable_view_protocol select extractValue('','count(ns:element)'); select extractValue('a','/ns:element'); select extractValue('a','/ns:element/@xmlns:ns'); - +--enable_view_protocol # # Bug#20795 extractvalue() won't accept names containing a dot (.) # +#enable after fix MDEV-27871 +--disable_view_protocol select extractValue('DataOtherdata','/foo/foo.bar'); select extractValue('DataOtherdata','/foo/something'); +--enable_view_protocol # # Bug#20854 XML functions: wrong result in ExtractValue # +#enable after fix MDEV-27871 +--disable_view_protocol --error 1105 select extractValue('<01>10:39:15<02>140','/zot/tim0/02'); select extractValue('<01>10:39:15<02>140','//*'); +--enable_view_protocol + +#view protocol generates additional warning +--disable_view_protocol # dot and dash are bad identtifier start character select extractValue('<.>test','//*'); select extractValue('<->test','//*'); @@ -383,6 +419,7 @@ select extractValue('<:>test','//*'); select extractValue('<_>test','//*'); # dot, dash, underscore and semicolon are good identifier middle characters select extractValue('test','//*'); +--enable_view_protocol # # Bug#22823 gt and lt operators appear to be @@ -421,9 +458,13 @@ select ExtractValue(@xml, "/entry[(50<=pt)]/id"); # Test nodetypes in node name context # select ExtractValue('test','/a/b/Text'); +#enable after fix MDEV-27871 +--disable_view_protocol select ExtractValue('test','/a/b/comment'); select ExtractValue('test','/a/b/node'); select ExtractValue('test','/a/b/processing-instruction'); +--enable_view_protocol + # # Test keywords in node name contexts # @@ -439,6 +480,8 @@ select ExtractValue('test', '/a/div:div'); # Test axis names in node name context # select ExtractValue('test', '/a/ancestor'); +#enable after fix MDEV-27871 +--disable_view_protocol select ExtractValue('test', '/a/ancestor-or-self'); select ExtractValue('test', '/a/attribute'); select ExtractValue('test', '/a/child'); @@ -450,6 +493,7 @@ select ExtractValue('test', '/a/namespace'); select ExtractValue('test', '/a/parent'); select ExtractValue('test', '/a/preceding'); select ExtractValue('test', '/a/preceding-sibling'); +--enable_view_protocol select ExtractValue('test', '/a/self'); # @@ -572,8 +616,12 @@ SELECT ExtractValue(@xml, 'html/body'); # These two documents will fail. # Quoted strings are not allowed in regular tags # +#view protocol generates additional warning +--disable_view_protocol + SELECT ExtractValue('CharData', '/xml'); SELECT ExtractValue('CharData', '/xml'); +--enable_view_protocol # # Bug#42495 updatexml: Assertion failed: xpath->context, file .\item_xmlfunc.cc, line 2507 @@ -603,7 +651,8 @@ INSERT INTO t1 (id, xml) VALUES (15, ''), (14, ''); - +#enable after fix MDEV-28535 +--disable_view_protocol SELECT extractvalue( xml, '/bla/@name' ), extractvalue( xml, '/bla/@name' ) @@ -614,6 +663,7 @@ SELECT UpdateXML(xml, '/bla/@name', 'test'), UpdateXML(xml, '/bla/@name', 'test') FROM t1 ORDER BY t1.id; +--enable_view_protocol DROP TABLE t1; @@ -643,14 +693,20 @@ SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1)); --echo # --echo # Bug #44332 my_xml_scan reads behind the end of buffer --echo # + +#view protocol generates additional warning +--disable_view_protocol SELECT UPDATEXML(CONVERT(_latin1'<' USING utf8),'1','1'); SELECT UPDATEXML(CONVERT(_latin1'' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL 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 DECIMAL 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 DECIMAL value: '-3333.3333\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' @@ -3475,11 +3466,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 28 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL 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 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL 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 DECIMAL 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 DECIMAL value: '-3333.3333\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' @@ -3499,11 +3487,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 27 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection @@ -3519,11 +3504,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 27 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -3541,11 +3523,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 26 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection @@ -3561,11 +3540,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 26 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result index 6db6e374ca738..88269f25a0132 100644 --- a/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result +++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result @@ -221,31 +221,31 @@ connect user5_2, localhost, user_2, , db_storedproc_1; user_2@localhost db_storedproc_1 CALL sp5_s_i(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_ins(); -ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_sel(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` connection default; root@localhost db_storedproc_1 CALL sp5_sel(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` grant insert on db_storedproc_1.* to 'user_1'@'localhost'; flush privileges; connection user5_2; user_2@localhost db_storedproc_1 CALL sp5_s_i(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_ins(); CALL sp5_sel(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` connection default; root@localhost db_storedproc_1 CALL sp5_sel(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` grant SELECT on db_storedproc_1.* to 'user_1'@'localhost'; flush privileges; connection user5_2; @@ -276,9 +276,9 @@ inserted outside of SP NULL inserted from sp5_ins 2000-10-00 inserted from sp5_s_i 2000-10-00 inserted from sp5_ins 2000-10-00 -ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_ins(); -ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_sel(); c1 c2 c3 inserted outside of SP NULL @@ -294,11 +294,11 @@ connection user5_2; user_2@localhost db_storedproc_1 CALL sp5_s_i(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_ins(); -ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_sel(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` disconnect user5_2; connection default; @@ -348,9 +348,9 @@ user_2@localhost db_storedproc_1 CALL sp3166_s_i(); c1 inserted outside SP -ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table 't3166' +ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table `db_storedproc_1`.`t3166` CALL sp3166_ins(); -ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table 't3166' +ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table `db_storedproc_1`.`t3166` CALL sp3166_sel(); c1 inserted outside SP @@ -390,10 +390,10 @@ connect user6_4, localhost, user_2, , db_storedproc_1; user_2@localhost db_storedproc_1 CALL sp3166_s_i(); -ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table 't3166' +ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table `db_storedproc_1`.`t3166` CALL sp3166_ins(); CALL sp3166_sel(); -ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table 't3166' +ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table `db_storedproc_1`.`t3166` disconnect user6_4; connection default; CALL sp3166_s_i(); diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03.result b/mysql-test/suite/funcs_1/r/innodb_trig_03.result index 92cbff3fafbcf..c2f0bb4a2f063 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_03.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_03.result @@ -99,7 +99,7 @@ test_noprivs@localhost use priv_db; create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.2_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table `priv_db`.`t1` connection default; use priv_db; insert into t1 (f1) values ('insert 3.5.3.2-no'); @@ -135,7 +135,7 @@ Testcase 3.5.3.6: connection no_privs; use priv_db; drop trigger trg1_2; -ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table `priv_db`.`t1` connection default; use priv_db; insert into t1 (f1) values ('insert 3.5.3.6-yes'); @@ -391,7 +391,7 @@ connection no_privs_424d; show grants; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT SELECT (f1), INSERT (f1) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` +GRANT SELECT (`f1`), INSERT (`f1`) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` use priv_db; create trigger trg4d_1 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-1d'; @@ -413,7 +413,7 @@ connection yes_privs_424d; show grants; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT UPDATE (f1) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` +GRANT UPDATE (`f1`) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` use priv_db; create trigger trg4d_2 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-2d'; @@ -618,14 +618,14 @@ grant UPDATE (f1), INSERT (f1) on priv_db.t1 to test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` +GRANT INSERT (`f1`), UPDATE (`f1`) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER on *.* to test_yesprivs@localhost; grant SELECT (f1) on priv_db.t1 to test_yesprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` +GRANT INSERT (`f1`), UPDATE (`f1`) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` connect no_privs_425d,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; connect yes_privs_425d,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection default; @@ -633,7 +633,7 @@ connection no_privs_425d; show grants; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` +GRANT INSERT (`f1`), UPDATE (`f1`) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` use priv_db; create trigger trg5d_1 before INSERT on t1 for each row set @test_var= new.f1; @@ -649,7 +649,7 @@ connection yes_privs_425d; show grants; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT SELECT (f1) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` +GRANT SELECT (`f1`) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` use priv_db; create trigger trg5d_2 before INSERT on t1 for each row set @test_var= new.f1; @@ -688,7 +688,7 @@ insert into t2 values (new.f1); connection default; use priv_db; insert into t1 (f1) values (4); -ERROR 42000: INSERT command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: INSERT command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` revoke SELECT on priv_db.t2 from test_yesprivs@localhost; grant INSERT on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (4); @@ -706,7 +706,7 @@ update t2 set f2=new.f1-1; connection default; use priv_db; insert into t1 (f1) values (2); -ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` revoke INSERT on priv_db.t2 from test_yesprivs@localhost; grant UPDATE on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (2); @@ -725,7 +725,7 @@ select f2 into @aaa from t2 where f2=new.f1; connection default; use priv_db; insert into t1 (f1) values (1); -ERROR 42000: SELECT command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` revoke UPDATE on priv_db.t2 from test_yesprivs@localhost; grant SELECT on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (1); @@ -748,7 +748,7 @@ delete from t2; connection default; use priv_db; insert into t1 (f1) values (1); -ERROR 42000: DELETE command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: DELETE command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` revoke SELECT on priv_db.t2 from test_yesprivs@localhost; grant DELETE on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (1); diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result index 875aa18e81f01..457d98d572fde 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result @@ -31,7 +31,7 @@ no trigger privilege on db level for create: use priv_db; create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; use priv_db; insert into t1 (f1) values ('insert-yes'); @@ -107,7 +107,7 @@ current_user test_yesprivs@localhost use priv_db; drop trigger trg1_2; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connection no_privs; select current_user; current_user @@ -117,7 +117,7 @@ use priv_db; no trigger privilege at activation time: ---------------------------------------- insert into t1 (f1) values ('insert-yes'); -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 insert-yes @@ -155,7 +155,7 @@ Grants for test_yesprivs@localhost GRANT USAGE ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, UPDATE, TRIGGER ON `priv_db`.* TO `test_yesprivs`@`localhost` drop trigger trg1_2; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` takes effect after use priv_db: ------------------------------- @@ -195,14 +195,14 @@ test_yesprivs@localhost use no_priv_db; create trigger trg1_3 before INSERT on t1 for each row set new.f1 = 'trig 1_3-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `no_priv_db`.`t1` use priv_db; create trigger trg1_3 before INSERT on t1 for each row set new.f1 = 'trig 1_3-yes'; use no_priv_db; create trigger trg1_4 before UPDATE on t1 for each row set new.f1 = 'trig 1_4-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `no_priv_db`.`t1` use priv_db; create trigger trg1_4 before UPDATE on t1 for each row set new.f1 = 'trig 1_4-yes'; @@ -302,7 +302,7 @@ Tables_in_priv_db t1 create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connection no_privs; select current_user; current_user @@ -376,7 +376,7 @@ select current_user; current_user test_yesprivs@localhost drop trigger trg1_2; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` no trigger privilege at activation time: ---------------------------------------- @@ -385,7 +385,7 @@ select current_user; current_user test_noprivs@localhost insert into t1 (f1) values ('insert5-no'); -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 insert1-yes @@ -476,12 +476,12 @@ current_user test_yesprivs@localhost create trigger trg2_1 before INSERT on t2 for each row set new.f1 = 'trig 2_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` create trigger trg1_3 before INSERT on t1 for each row set new.f1 = 'trig 1_3-yes'; create trigger trg2_2 before UPDATE on t2 for each row set new.f1 = 'trig 2_2-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` create trigger trg1_4 before UPDATE on t1 for each row set new.f1 = 'trig 1_4-yes'; show triggers; @@ -615,7 +615,7 @@ Trigger Event Table Statement Timing Created sql_mode Definer character_set_clie select * from information_schema.triggers; TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION drop trigger trg1_1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connection default; select current_user; current_user @@ -635,7 +635,7 @@ current_user test_yesprivs@localhost create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connection no_privs; select current_user; current_user @@ -671,11 +671,11 @@ set new.f1 = 'trig 1_2-yes'; create trigger no_priv_db.trg1_9 before insert on no_priv_db.t1 for each row set new.f1 = 'trig 1_9-yes'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `no_priv_db`.`t1` use no_priv_db; create trigger trg1_2 before INSERT on t1 for each row set new.f1 = 'trig 1_2-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `no_priv_db`.`t1` create trigger priv_db.trg1_9 before UPDATE on priv_db.t1 for each row set new.f1 = 'trig 1_9-yes'; @@ -699,7 +699,7 @@ select f1 from t1 order by f1; f1 insert-yes drop trigger priv_db.trg1_9; -ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table `priv_db`.`t1` connection default; select current_user; current_user @@ -708,7 +708,7 @@ drop trigger priv_db.trg1_9; revoke TRIGGER on priv_db.* from test_yesprivs@localhost; use priv_db; insert into t1 (f1) values ('insert-yes'); -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 insert-yes @@ -728,7 +728,7 @@ test_yesprivs@localhost use no_priv_db; create trigger trg1_2 before INSERT on t1 for each row set new.f1 = 'trig 1_2-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `no_priv_db`.`t1` connection no_privs; select current_user; current_user @@ -843,7 +843,7 @@ set new.f1 = 'trig 2_1-yes'; use priv2_db; create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig1_1-yes'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv2_db`.`t1` connection no_privs; select current_user; current_user @@ -918,7 +918,7 @@ test_yesprivs@localhost use priv1_db; create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv1_db`.`t1` connection default; select current_user; current_user @@ -945,7 +945,7 @@ create trigger trg1_2 before INSERT on t1 for each row set new.f1 = 'trig 1_2-yes'; create trigger trg2_1 before INSERT on t2 for each row set new.f1 = 'trig 2_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv1_db`.`t2` connection no_privs; select current_user; current_user @@ -986,7 +986,7 @@ current_user test_yesprivs@localhost create trigger trg2_1 before INSERT on t2 for each row set new.f1 = 'trig 2_1-yes'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv1_db`.`t2` use priv1_db; create trigger trg2_1 before INSERT on t2 for each row set new.f1 = 'trig 2_1-yes'; @@ -1110,7 +1110,7 @@ select current_user; current_user test_yesprivs@localhost execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1122,7 +1122,7 @@ current_user test_useprivs@localhost prepare ins1 from 'insert into t1 (f1) values (''insert5-no'')'; execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1173,7 +1173,7 @@ select current_user; current_user test_yesprivs@localhost execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1185,7 +1185,7 @@ select current_user; current_user test_useprivs@localhost execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1240,7 +1240,7 @@ select current_user; current_user test_yesprivs@localhost execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1255,7 +1255,7 @@ select current_user; current_user test_useprivs@localhost execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1323,11 +1323,11 @@ current_user test_yesprivs@localhost use priv_db; insert into t1 (f1) values ('insert-no'); -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 drop trigger trg1_0; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connection default; select current_user; current_user @@ -1541,8 +1541,8 @@ show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT USAGE ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT TRIGGER ON `priv_db`.* TO `test_yesprivs`@`localhost` -GRANT SELECT (f1), INSERT ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` -GRANT SELECT (f1), INSERT, UPDATE (f1) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` +GRANT SELECT (`f1`), INSERT ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` +GRANT SELECT (`f1`), INSERT, UPDATE (`f1`) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` connection yes_privs; select current_user; current_user @@ -1638,12 +1638,12 @@ update t1 set f1 = 'update6_no' where f1 like '%insert%'; update t2 set f1 = 'update6_no' where f1 like '%insert%'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` update t1 set f1 = 'update7_no' where f1 like '%insert%'; update t2 set f1 = 'update7_no' where f1 like '%insert%'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1669,7 +1669,7 @@ test_noprivs@localhost update t1 set f1 = 'update8-no', f2 = 'update8-no' where f2 like '%yes'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select * from t1 order by f1,f2,f3; f1 f2 f3 trig 1_1-yes NULL NULL @@ -1692,8 +1692,8 @@ to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT USAGE ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT SELECT (f1), INSERT, UPDATE ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` -GRANT SELECT, SELECT (f1), INSERT, UPDATE (f3, f2), TRIGGER ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` +GRANT SELECT (`f1`), INSERT, UPDATE ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` +GRANT SELECT, SELECT (`f1`), INSERT, UPDATE (`f3`, `f2`), TRIGGER ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` connection yes_privs; select current_user; current_user @@ -1735,15 +1735,15 @@ to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT USAGE ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT SELECT (f1), INSERT, UPDATE ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` -GRANT SELECT, SELECT (f1), INSERT, UPDATE (f3, f2, f1) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` +GRANT SELECT (`f1`), INSERT, UPDATE ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` +GRANT SELECT, SELECT (`f1`), INSERT, UPDATE (`f3`, `f2`, `f1`) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` connection no_privs; select current_user; current_user test_noprivs@localhost use priv_db; update t1 set f3= f3+1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f3 from t1 order by f3; f3 NULL diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_0407.result b/mysql-test/suite/funcs_1/r/innodb_trig_0407.result index 371bc93594506..d551575960e1b 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_0407.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_0407.result @@ -237,7 +237,7 @@ Testcase 3.5.5.2: Create temporary table t1_temp (f1 bigint signed, f2 bigint unsigned); Create trigger trg2 before INSERT on t1_temp for each row set new.f2=9999; -ERROR HY000: Trigger's 't1_temp' is view or temporary table +ERROR HY000: Trigger's 't1_temp' is a view, temporary table or sequence drop table t1_temp; Testcase 3.5.5.3: diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_1011ext.result b/mysql-test/suite/funcs_1/r/innodb_trig_1011ext.result index e8276a604516c..9e09c50d96858 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_1011ext.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_1011ext.result @@ -367,7 +367,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1); create trigger tr1 after insert on t1 for each row insert into t2 (f2) values (new.f1+1); diff --git a/mysql-test/suite/funcs_1/r/is_character_sets.result b/mysql-test/suite/funcs_1/r/is_character_sets.result index af4dca9c666dc..6a1671a473c4d 100644 --- a/mysql-test/suite/funcs_1/r/is_character_sets.result +++ b/mysql-test/suite/funcs_1/r/is_character_sets.result @@ -28,24 +28,24 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.CHARACTER_SETS; Field Type Null Key Default Extra -CHARACTER_SET_NAME varchar(32) NO -DEFAULT_COLLATE_NAME varchar(32) NO -DESCRIPTION varchar(60) NO -MAXLEN bigint(3) NO 0 +CHARACTER_SET_NAME varchar(32) NO NULL +DEFAULT_COLLATE_NAME varchar(32) NO NULL +DESCRIPTION varchar(60) NO NULL +MAXLEN bigint(3) NO NULL SHOW CREATE TABLE information_schema.CHARACTER_SETS; Table Create Table CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` ( - `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '', - `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL DEFAULT '', - `DESCRIPTION` varchar(60) NOT NULL DEFAULT '', - `MAXLEN` bigint(3) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `CHARACTER_SET_NAME` varchar(32) NOT NULL, + `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL, + `DESCRIPTION` varchar(60) NOT NULL, + `MAXLEN` bigint(3) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.CHARACTER_SETS; Field Type Null Key Default Extra -CHARACTER_SET_NAME varchar(32) NO -DEFAULT_COLLATE_NAME varchar(32) NO -DESCRIPTION varchar(60) NO -MAXLEN bigint(3) NO 0 +CHARACTER_SET_NAME varchar(32) NO NULL +DEFAULT_COLLATE_NAME varchar(32) NO NULL +DESCRIPTION varchar(60) NO NULL +MAXLEN bigint(3) NO NULL # Testcases 3.2.2.2 and 3.2.2.3 are checked in suite/funcs_1/t/charset_collation*.test ######################################################################## # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and 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 578717ee30796..3a8fbac917044 100644 --- a/mysql-test/suite/funcs_1/r/is_check_constraints.result +++ b/mysql-test/suite/funcs_1/r/is_check_constraints.result @@ -134,7 +134,7 @@ GRANT SELECT (a) ON t1 TO foo; SHOW GRANTS FOR foo; Grants for foo@% GRANT USAGE ON *.* TO `foo`@`%` -GRANT SELECT (a) ON `db`.`t1` TO `foo`@`%` +GRANT SELECT (`a`) ON `db`.`t1` TO `foo`@`%` SELECT * FROM information_schema.check_constraints; CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME LEVEL CHECK_CLAUSE def db t1 CONSTRAINT_1 Table `b` > 0 @@ -169,7 +169,7 @@ t CREATE TABLE `t` ( CONSTRAINT `CONSTRAINT_1` CHECK (`t0` > 0), CONSTRAINT `tc_1` CHECK (`t1` > 1), CONSTRAINT `t2` CHECK (`t2` > 1) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from information_schema.table_constraints where CONSTRAINT_TYPE='CHECK'; CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE def mysql Priv mysql global_priv CHECK diff --git a/mysql-test/suite/funcs_1/r/is_coll_char_set_appl.result b/mysql-test/suite/funcs_1/r/is_coll_char_set_appl.result index b72681689e11f..d1663dfcde4a1 100644 --- a/mysql-test/suite/funcs_1/r/is_coll_char_set_appl.result +++ b/mysql-test/suite/funcs_1/r/is_coll_char_set_appl.result @@ -28,18 +28,18 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; Field Type Null Key Default Extra -COLLATION_NAME varchar(32) NO -CHARACTER_SET_NAME varchar(32) NO +COLLATION_NAME varchar(32) NO NULL +CHARACTER_SET_NAME varchar(32) NO NULL SHOW CREATE TABLE information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; Table Create Table COLLATION_CHARACTER_SET_APPLICABILITY CREATE TEMPORARY TABLE `COLLATION_CHARACTER_SET_APPLICABILITY` ( - `COLLATION_NAME` varchar(32) NOT NULL DEFAULT '', - `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '' -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `COLLATION_NAME` varchar(32) NOT NULL, + `CHARACTER_SET_NAME` varchar(32) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; Field Type Null Key Default Extra -COLLATION_NAME varchar(32) NO -CHARACTER_SET_NAME varchar(32) NO +COLLATION_NAME varchar(32) NO NULL +CHARACTER_SET_NAME varchar(32) NO NULL # Testcases 3.2.4.2 and 3.2.4.3 are checked in suite/funcs_1/t/charset_collation*.test ######################################################################## # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and diff --git a/mysql-test/suite/funcs_1/r/is_collations.result b/mysql-test/suite/funcs_1/r/is_collations.result index 465baa64ee9ba..1e840d507171a 100644 --- a/mysql-test/suite/funcs_1/r/is_collations.result +++ b/mysql-test/suite/funcs_1/r/is_collations.result @@ -28,30 +28,30 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.COLLATIONS; Field Type Null Key Default Extra -COLLATION_NAME varchar(32) NO -CHARACTER_SET_NAME varchar(32) NO -ID bigint(11) NO 0 -IS_DEFAULT varchar(3) NO -IS_COMPILED varchar(3) NO -SORTLEN bigint(3) NO 0 +COLLATION_NAME varchar(32) NO NULL +CHARACTER_SET_NAME varchar(32) NO NULL +ID bigint(11) NO NULL +IS_DEFAULT varchar(3) NO NULL +IS_COMPILED varchar(3) NO NULL +SORTLEN bigint(3) NO NULL SHOW CREATE TABLE information_schema.COLLATIONS; Table Create Table COLLATIONS CREATE TEMPORARY TABLE `COLLATIONS` ( - `COLLATION_NAME` varchar(32) NOT NULL DEFAULT '', - `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '', - `ID` bigint(11) NOT NULL DEFAULT 0, - `IS_DEFAULT` varchar(3) NOT NULL DEFAULT '', - `IS_COMPILED` varchar(3) NOT NULL DEFAULT '', - `SORTLEN` bigint(3) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `COLLATION_NAME` varchar(32) NOT NULL, + `CHARACTER_SET_NAME` varchar(32) NOT NULL, + `ID` bigint(11) NOT NULL, + `IS_DEFAULT` varchar(3) NOT NULL, + `IS_COMPILED` varchar(3) NOT NULL, + `SORTLEN` bigint(3) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.COLLATIONS; Field Type Null Key Default Extra -COLLATION_NAME varchar(32) NO -CHARACTER_SET_NAME varchar(32) NO -ID bigint(11) NO 0 -IS_DEFAULT varchar(3) NO -IS_COMPILED varchar(3) NO -SORTLEN bigint(3) NO 0 +COLLATION_NAME varchar(32) NO NULL +CHARACTER_SET_NAME varchar(32) NO NULL +ID bigint(11) NO NULL +IS_DEFAULT varchar(3) NO NULL +IS_COMPILED varchar(3) NO NULL +SORTLEN bigint(3) NO NULL # Testcases 3.2.3.2 and 3.2.3.3 are checked in suite/funcs_1/t/charset_collation*.test ######################################################################## # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and diff --git a/mysql-test/suite/funcs_1/r/is_column_privileges.result b/mysql-test/suite/funcs_1/r/is_column_privileges.result index 4a013956ef721..3e64f217c74e5 100644 --- a/mysql-test/suite/funcs_1/r/is_column_privileges.result +++ b/mysql-test/suite/funcs_1/r/is_column_privileges.result @@ -28,33 +28,33 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.COLUMN_PRIVILEGES; Field Type Null Key Default Extra -GRANTEE varchar(385) NO -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -COLUMN_NAME varchar(64) NO -PRIVILEGE_TYPE varchar(64) NO -IS_GRANTABLE varchar(3) NO +GRANTEE varchar(385) NO NULL +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +COLUMN_NAME varchar(64) NO NULL +PRIVILEGE_TYPE varchar(64) NO NULL +IS_GRANTABLE varchar(3) NO NULL SHOW CREATE TABLE information_schema.COLUMN_PRIVILEGES; Table Create Table COLUMN_PRIVILEGES CREATE TEMPORARY TABLE `COLUMN_PRIVILEGES` ( - `GRANTEE` varchar(385) NOT NULL DEFAULT '', - `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', - `COLUMN_NAME` varchar(64) NOT NULL DEFAULT '', - `PRIVILEGE_TYPE` varchar(64) NOT NULL DEFAULT '', - `IS_GRANTABLE` varchar(3) NOT NULL DEFAULT '' -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `GRANTEE` varchar(385) NOT NULL, + `TABLE_CATALOG` varchar(512) NOT NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL, + `TABLE_NAME` varchar(64) NOT NULL, + `COLUMN_NAME` varchar(64) NOT NULL, + `PRIVILEGE_TYPE` varchar(64) NOT NULL, + `IS_GRANTABLE` varchar(3) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.COLUMN_PRIVILEGES; Field Type Null Key Default Extra -GRANTEE varchar(385) NO -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -COLUMN_NAME varchar(64) NO -PRIVILEGE_TYPE varchar(64) NO -IS_GRANTABLE varchar(3) NO +GRANTEE varchar(385) NO NULL +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +COLUMN_NAME varchar(64) NO NULL +PRIVILEGE_TYPE varchar(64) NO NULL +IS_GRANTABLE varchar(3) NO NULL SELECT table_catalog, table_schema, table_name, column_name, privilege_type FROM information_schema.column_privileges WHERE table_catalog IS NOT NULL; table_catalog table_schema table_name column_name privilege_type @@ -219,7 +219,7 @@ SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` GRANT ALL PRIVILEGES ON `test`.* TO `testuser1`@`localhost` -GRANT SELECT (f3, f1) ON `db_datadict`.`my_table` TO `testuser1`@`localhost` +GRANT SELECT (`f3`, `f1`) ON `db_datadict`.`my_table` TO `testuser1`@`localhost` connection testuser1; SELECT * FROM information_schema.column_privileges WHERE table_name = 'my_table' @@ -231,7 +231,7 @@ SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` GRANT ALL PRIVILEGES ON `test`.* TO `testuser1`@`localhost` -GRANT SELECT (f3, f1) ON `db_datadict`.`my_table` TO `testuser1`@`localhost` +GRANT SELECT (`f3`, `f1`) ON `db_datadict`.`my_table` TO `testuser1`@`localhost` connection default; ALTER TABLE db_datadict.my_table DROP COLUMN f3; GRANT UPDATE (f1) ON db_datadict.my_table TO 'testuser1'@'localhost'; @@ -246,7 +246,7 @@ SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` GRANT ALL PRIVILEGES ON `test`.* TO `testuser1`@`localhost` -GRANT SELECT (f3, f1), UPDATE (f1) ON `db_datadict`.`my_table` TO `testuser1`@`localhost` +GRANT SELECT (`f3`, `f1`), UPDATE (`f1`) ON `db_datadict`.`my_table` TO `testuser1`@`localhost` connection testuser1; SELECT * FROM information_schema.column_privileges WHERE table_name = 'my_table' @@ -259,7 +259,7 @@ SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` GRANT ALL PRIVILEGES ON `test`.* TO `testuser1`@`localhost` -GRANT SELECT (f3, f1), UPDATE (f1) ON `db_datadict`.`my_table` TO `testuser1`@`localhost` +GRANT SELECT (`f3`, `f1`), UPDATE (`f1`) ON `db_datadict`.`my_table` TO `testuser1`@`localhost` SELECT f1, f3 FROM db_datadict.my_table; ERROR 42S22: Unknown column 'f3' in 'field list' connection default; @@ -275,7 +275,7 @@ SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` GRANT ALL PRIVILEGES ON `test`.* TO `testuser1`@`localhost` -GRANT SELECT (f3, f1), UPDATE (f1) ON `db_datadict`.`my_table` TO `testuser1`@`localhost` +GRANT SELECT (`f3`, `f1`), UPDATE (`f1`) ON `db_datadict`.`my_table` TO `testuser1`@`localhost` connection testuser1; SELECT * FROM information_schema.column_privileges WHERE table_name = 'my_table' @@ -288,7 +288,7 @@ SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` GRANT ALL PRIVILEGES ON `test`.* TO `testuser1`@`localhost` -GRANT SELECT (f3, f1), UPDATE (f1) ON `db_datadict`.`my_table` TO `testuser1`@`localhost` +GRANT SELECT (`f3`, `f1`), UPDATE (`f1`) ON `db_datadict`.`my_table` TO `testuser1`@`localhost` connection default; DROP TABLE db_datadict.my_table; SELECT * FROM information_schema.column_privileges @@ -302,7 +302,7 @@ SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` GRANT ALL PRIVILEGES ON `test`.* TO `testuser1`@`localhost` -GRANT SELECT (f3, f1), UPDATE (f1) ON `db_datadict`.`my_table` TO `testuser1`@`localhost` +GRANT SELECT (`f3`, `f1`), UPDATE (`f1`) ON `db_datadict`.`my_table` TO `testuser1`@`localhost` connection testuser1; SELECT * FROM information_schema.column_privileges WHERE table_name = 'my_table' @@ -315,7 +315,7 @@ SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` GRANT ALL PRIVILEGES ON `test`.* TO `testuser1`@`localhost` -GRANT SELECT (f3, f1), UPDATE (f1) ON `db_datadict`.`my_table` TO `testuser1`@`localhost` +GRANT SELECT (`f3`, `f1`), UPDATE (`f1`) ON `db_datadict`.`my_table` TO `testuser1`@`localhost` connection default; REVOKE ALL ON db_datadict.my_table FROM 'testuser1'@'localhost'; SELECT * FROM information_schema.column_privileges diff --git a/mysql-test/suite/funcs_1/r/is_columns.result b/mysql-test/suite/funcs_1/r/is_columns.result index 76b724f2f402d..7cd949c36aaa7 100644 --- a/mysql-test/suite/funcs_1/r/is_columns.result +++ b/mysql-test/suite/funcs_1/r/is_columns.result @@ -28,14 +28,14 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.COLUMNS; Field Type Null Key Default Extra -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -COLUMN_NAME varchar(64) NO -ORDINAL_POSITION bigint(21) unsigned NO 0 +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +COLUMN_NAME varchar(64) NO NULL +ORDINAL_POSITION bigint(21) unsigned NO NULL COLUMN_DEFAULT longtext YES NULL -IS_NULLABLE varchar(3) NO -DATA_TYPE varchar(64) NO +IS_NULLABLE varchar(3) NO NULL +DATA_TYPE varchar(64) NO NULL CHARACTER_MAXIMUM_LENGTH bigint(21) unsigned YES NULL CHARACTER_OCTET_LENGTH bigint(21) unsigned YES NULL NUMERIC_PRECISION bigint(21) unsigned YES NULL @@ -43,49 +43,49 @@ NUMERIC_SCALE bigint(21) unsigned YES NULL DATETIME_PRECISION bigint(21) unsigned YES NULL CHARACTER_SET_NAME varchar(32) YES NULL COLLATION_NAME varchar(32) YES NULL -COLUMN_TYPE longtext NO -COLUMN_KEY varchar(3) NO -EXTRA varchar(30) NO -PRIVILEGES varchar(80) NO -COLUMN_COMMENT varchar(1024) NO -IS_GENERATED varchar(6) NO +COLUMN_TYPE longtext NO NULL +COLUMN_KEY varchar(3) NO NULL +EXTRA varchar(80) NO NULL +PRIVILEGES varchar(80) NO NULL +COLUMN_COMMENT varchar(1024) NO NULL +IS_GENERATED varchar(6) NO NULL GENERATION_EXPRESSION longtext YES NULL SHOW CREATE TABLE information_schema.COLUMNS; Table Create Table COLUMNS CREATE TEMPORARY TABLE `COLUMNS` ( - `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', - `COLUMN_NAME` varchar(64) NOT NULL DEFAULT '', - `ORDINAL_POSITION` bigint(21) unsigned NOT NULL DEFAULT 0, - `COLUMN_DEFAULT` longtext DEFAULT NULL, - `IS_NULLABLE` varchar(3) NOT NULL DEFAULT '', - `DATA_TYPE` varchar(64) NOT NULL DEFAULT '', - `CHARACTER_MAXIMUM_LENGTH` bigint(21) unsigned DEFAULT NULL, - `CHARACTER_OCTET_LENGTH` bigint(21) unsigned DEFAULT NULL, - `NUMERIC_PRECISION` bigint(21) unsigned DEFAULT NULL, - `NUMERIC_SCALE` bigint(21) unsigned DEFAULT NULL, - `DATETIME_PRECISION` bigint(21) unsigned DEFAULT NULL, - `CHARACTER_SET_NAME` varchar(32) DEFAULT NULL, - `COLLATION_NAME` varchar(32) DEFAULT NULL, - `COLUMN_TYPE` longtext NOT NULL DEFAULT '', - `COLUMN_KEY` varchar(3) NOT NULL DEFAULT '', - `EXTRA` varchar(30) NOT NULL DEFAULT '', - `PRIVILEGES` varchar(80) NOT NULL DEFAULT '', - `COLUMN_COMMENT` varchar(1024) NOT NULL DEFAULT '', - `IS_GENERATED` varchar(6) NOT NULL DEFAULT '', - `GENERATION_EXPRESSION` longtext DEFAULT NULL -) DEFAULT CHARSET=utf8mb3 + `TABLE_CATALOG` varchar(512) NOT NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL, + `TABLE_NAME` varchar(64) NOT NULL, + `COLUMN_NAME` varchar(64) NOT NULL, + `ORDINAL_POSITION` bigint(21) unsigned NOT NULL, + `COLUMN_DEFAULT` longtext, + `IS_NULLABLE` varchar(3) NOT NULL, + `DATA_TYPE` varchar(64) NOT NULL, + `CHARACTER_MAXIMUM_LENGTH` bigint(21) unsigned, + `CHARACTER_OCTET_LENGTH` bigint(21) unsigned, + `NUMERIC_PRECISION` bigint(21) unsigned, + `NUMERIC_SCALE` bigint(21) unsigned, + `DATETIME_PRECISION` bigint(21) unsigned, + `CHARACTER_SET_NAME` varchar(32), + `COLLATION_NAME` varchar(32), + `COLUMN_TYPE` longtext NOT NULL, + `COLUMN_KEY` varchar(3) NOT NULL, + `EXTRA` varchar(80) NOT NULL, + `PRIVILEGES` varchar(80) NOT NULL, + `COLUMN_COMMENT` varchar(1024) NOT NULL, + `IS_GENERATED` varchar(6) NOT NULL, + `GENERATION_EXPRESSION` longtext +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.COLUMNS; Field Type Null Key Default Extra -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -COLUMN_NAME varchar(64) NO -ORDINAL_POSITION bigint(21) unsigned NO 0 +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +COLUMN_NAME varchar(64) NO NULL +ORDINAL_POSITION bigint(21) unsigned NO NULL COLUMN_DEFAULT longtext YES NULL -IS_NULLABLE varchar(3) NO -DATA_TYPE varchar(64) NO +IS_NULLABLE varchar(3) NO NULL +DATA_TYPE varchar(64) NO NULL CHARACTER_MAXIMUM_LENGTH bigint(21) unsigned YES NULL CHARACTER_OCTET_LENGTH bigint(21) unsigned YES NULL NUMERIC_PRECISION bigint(21) unsigned YES NULL @@ -93,12 +93,12 @@ NUMERIC_SCALE bigint(21) unsigned YES NULL DATETIME_PRECISION bigint(21) unsigned YES NULL CHARACTER_SET_NAME varchar(32) YES NULL COLLATION_NAME varchar(32) YES NULL -COLUMN_TYPE longtext NO -COLUMN_KEY varchar(3) NO -EXTRA varchar(30) NO -PRIVILEGES varchar(80) NO -COLUMN_COMMENT varchar(1024) NO -IS_GENERATED varchar(6) NO +COLUMN_TYPE longtext NO NULL +COLUMN_KEY varchar(3) NO NULL +EXTRA varchar(80) NO NULL +PRIVILEGES varchar(80) NO NULL +COLUMN_COMMENT varchar(1024) NO NULL +IS_GENERATED varchar(6) NO NULL GENERATION_EXPRESSION longtext YES NULL SELECT table_catalog, table_schema, table_name, column_name FROM information_schema.columns WHERE table_catalog IS NULL OR table_catalog <> 'def'; @@ -170,7 +170,7 @@ Field Type Null Key Default Extra f1 char(10) YES MUL NULL f2 text YES NULL SHOW COLUMNS FROM db_datadict.t2; -ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table `db_datadict`.`t2` SHOW COLUMNS FROM db_datadict.v1; Field Type Null Key Default Extra f2 int(1) NO 0 @@ -182,13 +182,13 @@ TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAUL def db_datadict t2 f1 1 NULL NO char 10 10 NULL NULL NULL latin1 latin1_swedish_ci char(10) PRI insert NEVER NULL def db_datadict t2 f2 2 NULL YES text 65535 65535 NULL NULL NULL latin1 latin1_swedish_ci text insert NEVER NULL SHOW COLUMNS FROM db_datadict.t1; -ERROR 42000: SELECT command denied to user 'testuser2'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'testuser2'@'localhost' for table `db_datadict`.`t1` SHOW COLUMNS FROM db_datadict.t2; Field Type Null Key Default Extra f1 char(10) NO PRI NULL f2 text YES NULL SHOW COLUMNS FROM db_datadict.v1; -ERROR 42000: SELECT command denied to user 'testuser2'@'localhost' for table 'v1' +ERROR 42000: SELECT command denied to user 'testuser2'@'localhost' for table `db_datadict`.`v1` connection default; disconnect testuser1; disconnect testuser2; diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result index 5d239dd839309..3664f6861af4d 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result @@ -3,126 +3,126 @@ WHERE table_schema = 'information_schema' AND table_name <> 'profiling' AND table_name not like 'innodb_%' ORDER BY table_schema, table_name, column_name; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION -def information_schema ALL_PLUGINS LOAD_OPTION 11 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema ALL_PLUGINS LOAD_OPTION 11 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema ALL_PLUGINS PLUGIN_AUTHOR 8 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema ALL_PLUGINS PLUGIN_AUTH_VERSION 13 NULL YES varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) select NEVER NULL def information_schema ALL_PLUGINS PLUGIN_DESCRIPTION 9 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL def information_schema ALL_PLUGINS PLUGIN_LIBRARY 6 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema ALL_PLUGINS PLUGIN_LIBRARY_VERSION 7 NULL YES varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select NEVER NULL -def information_schema ALL_PLUGINS PLUGIN_LICENSE 10 '' NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) select NEVER NULL -def information_schema ALL_PLUGINS PLUGIN_MATURITY 12 '' NO varchar 12 36 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(12) select NEVER NULL -def information_schema ALL_PLUGINS PLUGIN_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema ALL_PLUGINS PLUGIN_STATUS 3 '' NO varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) select NEVER NULL -def information_schema ALL_PLUGINS PLUGIN_TYPE 4 '' NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) select NEVER NULL -def information_schema ALL_PLUGINS PLUGIN_TYPE_VERSION 5 '' NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select NEVER NULL -def information_schema ALL_PLUGINS PLUGIN_VERSION 2 '' NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select NEVER NULL -def information_schema APPLICABLE_ROLES GRANTEE 1 '' NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) select NEVER NULL +def information_schema ALL_PLUGINS PLUGIN_LICENSE 10 NULL NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) select NEVER NULL +def information_schema ALL_PLUGINS PLUGIN_MATURITY 12 NULL NO varchar 12 36 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(12) select NEVER NULL +def information_schema ALL_PLUGINS PLUGIN_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema ALL_PLUGINS PLUGIN_STATUS 3 NULL NO varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) select NEVER NULL +def information_schema ALL_PLUGINS PLUGIN_TYPE 4 NULL NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) select NEVER NULL +def information_schema ALL_PLUGINS PLUGIN_TYPE_VERSION 5 NULL NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select NEVER NULL +def information_schema ALL_PLUGINS PLUGIN_VERSION 2 NULL NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select NEVER NULL +def information_schema APPLICABLE_ROLES GRANTEE 1 NULL NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) select NEVER NULL def information_schema APPLICABLE_ROLES IS_DEFAULT 4 NULL YES varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL -def information_schema APPLICABLE_ROLES IS_GRANTABLE 3 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL -def information_schema APPLICABLE_ROLES ROLE_NAME 2 '' NO varchar 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(128) select NEVER NULL -def information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema CHARACTER_SETS DESCRIPTION 3 '' NO varchar 60 180 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(60) select NEVER NULL -def information_schema CHARACTER_SETS MAXLEN 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) select NEVER NULL -def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 6 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL -def information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema CHECK_CONSTRAINTS LEVEL 5 '' NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) select NEVER NULL -def information_schema CHECK_CONSTRAINTS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema CLIENT_STATISTICS ACCESS_DENIED 22 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS BINLOG_BYTES_WRITTEN 9 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS BUSY_TIME 5 0 NO double NULL NULL 21 NULL NULL NULL NULL double select NEVER NULL -def information_schema CLIENT_STATISTICS BYTES_RECEIVED 7 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS BYTES_SENT 8 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS CLIENT 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema CLIENT_STATISTICS COMMIT_TRANSACTIONS 18 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS CONCURRENT_CONNECTIONS 3 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS CONNECTED_TIME 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS CPU_TIME 6 0 NO double NULL NULL 21 NULL NULL NULL NULL double select NEVER NULL -def information_schema CLIENT_STATISTICS DENIED_CONNECTIONS 20 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS EMPTY_QUERIES 23 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS LOST_CONNECTIONS 21 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 25 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS OTHER_COMMANDS 17 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS ROLLBACK_TRANSACTIONS 19 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS ROWS_DELETED 12 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS ROWS_INSERTED 13 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS ROWS_READ 10 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS ROWS_SENT 11 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS ROWS_UPDATED 14 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS SELECT_COMMANDS 15 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS 2 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema CLIENT_STATISTICS TOTAL_SSL_CONNECTIONS 24 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema CLIENT_STATISTICS UPDATE_COMMANDS 16 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema COLLATIONS CHARACTER_SET_NAME 2 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema COLLATIONS COLLATION_NAME 1 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema COLLATIONS ID 3 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(11) select NEVER NULL -def information_schema COLLATIONS IS_COMPILED 5 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL -def information_schema COLLATIONS IS_DEFAULT 4 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL -def information_schema COLLATIONS SORTLEN 6 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) select NEVER NULL -def information_schema COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME 2 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME 1 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema APPLICABLE_ROLES IS_GRANTABLE 3 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL +def information_schema APPLICABLE_ROLES ROLE_NAME 2 NULL NO varchar 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(128) select NEVER NULL +def information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema CHARACTER_SETS DESCRIPTION 3 NULL NO varchar 60 180 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(60) select NEVER NULL +def information_schema CHARACTER_SETS MAXLEN 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) select NEVER NULL +def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 6 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL +def information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema CHECK_CONSTRAINTS LEVEL 5 NULL NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) select NEVER NULL +def information_schema CHECK_CONSTRAINTS TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema CLIENT_STATISTICS ACCESS_DENIED 22 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS BINLOG_BYTES_WRITTEN 9 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS BUSY_TIME 5 NULL NO double NULL NULL 21 NULL NULL NULL NULL double select NEVER NULL +def information_schema CLIENT_STATISTICS BYTES_RECEIVED 7 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS BYTES_SENT 8 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS CLIENT 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema CLIENT_STATISTICS COMMIT_TRANSACTIONS 18 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS CONCURRENT_CONNECTIONS 3 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS CONNECTED_TIME 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS CPU_TIME 6 NULL NO double NULL NULL 21 NULL NULL NULL NULL double select NEVER NULL +def information_schema CLIENT_STATISTICS DENIED_CONNECTIONS 20 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS EMPTY_QUERIES 23 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS LOST_CONNECTIONS 21 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 25 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS OTHER_COMMANDS 17 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS ROLLBACK_TRANSACTIONS 19 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS ROWS_DELETED 12 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS ROWS_INSERTED 13 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS ROWS_READ 10 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS ROWS_SENT 11 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS ROWS_UPDATED 14 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS SELECT_COMMANDS 15 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS 2 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema CLIENT_STATISTICS TOTAL_SSL_CONNECTIONS 24 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema CLIENT_STATISTICS UPDATE_COMMANDS 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema COLLATIONS CHARACTER_SET_NAME 2 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema COLLATIONS COLLATION_NAME 1 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema COLLATIONS ID 3 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(11) select NEVER NULL +def information_schema COLLATIONS IS_COMPILED 5 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL +def information_schema COLLATIONS IS_DEFAULT 4 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL +def information_schema COLLATIONS SORTLEN 6 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) select NEVER NULL +def information_schema COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME 2 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME 1 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL def information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema COLUMNS CHARACTER_OCTET_LENGTH 10 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema COLUMNS CHARACTER_SET_NAME 14 NULL YES varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL def information_schema COLUMNS COLLATION_NAME 15 NULL YES varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema COLUMNS COLUMN_COMMENT 20 '' NO varchar 1024 3072 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1024) select NEVER NULL +def information_schema COLUMNS COLUMN_COMMENT 20 NULL NO varchar 1024 3072 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1024) select NEVER NULL def information_schema COLUMNS COLUMN_DEFAULT 6 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL -def information_schema COLUMNS COLUMN_KEY 17 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL -def information_schema COLUMNS COLUMN_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema COLUMNS COLUMN_TYPE 16 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL -def information_schema COLUMNS DATA_TYPE 8 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema COLUMNS COLUMN_KEY 17 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL +def information_schema COLUMNS COLUMN_NAME 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema COLUMNS COLUMN_TYPE 16 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL +def information_schema COLUMNS DATA_TYPE 8 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema COLUMNS DATETIME_PRECISION 13 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema COLUMNS EXTRA 18 '' NO varchar 30 90 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(30) select NEVER NULL +def information_schema COLUMNS EXTRA 18 NULL NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) select NEVER NULL def information_schema COLUMNS GENERATION_EXPRESSION 22 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL -def information_schema COLUMNS IS_GENERATED 21 '' NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) select NEVER NULL -def information_schema COLUMNS IS_NULLABLE 7 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL +def information_schema COLUMNS IS_GENERATED 21 NULL NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) select NEVER NULL +def information_schema COLUMNS IS_NULLABLE 7 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL def information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema COLUMNS ORDINAL_POSITION 5 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema COLUMNS PRIVILEGES 19 '' NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) select NEVER NULL -def information_schema COLUMNS TABLE_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema COLUMNS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema COLUMNS TABLE_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema COLUMN_PRIVILEGES COLUMN_NAME 5 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema COLUMN_PRIVILEGES GRANTEE 1 '' NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) select NEVER NULL -def information_schema COLUMN_PRIVILEGES IS_GRANTABLE 7 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL -def information_schema COLUMN_PRIVILEGES PRIVILEGE_TYPE 6 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema COLUMN_PRIVILEGES TABLE_CATALOG 2 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema COLUMN_PRIVILEGES TABLE_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema COLUMN_PRIVILEGES TABLE_SCHEMA 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema COLUMNS ORDINAL_POSITION 5 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema COLUMNS PRIVILEGES 19 NULL NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) select NEVER NULL +def information_schema COLUMNS TABLE_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema COLUMNS TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema COLUMNS TABLE_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema COLUMN_PRIVILEGES COLUMN_NAME 5 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema COLUMN_PRIVILEGES GRANTEE 1 NULL NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) select NEVER NULL +def information_schema COLUMN_PRIVILEGES IS_GRANTABLE 7 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL +def information_schema COLUMN_PRIVILEGES PRIVILEGE_TYPE 6 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema COLUMN_PRIVILEGES TABLE_CATALOG 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema COLUMN_PRIVILEGES TABLE_NAME 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema COLUMN_PRIVILEGES TABLE_SCHEMA 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema ENABLED_ROLES ROLE_NAME 1 NULL YES varchar 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(128) select NEVER NULL -def information_schema ENGINES COMMENT 3 '' NO varchar 160 480 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(160) select NEVER NULL -def information_schema ENGINES ENGINE 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema ENGINES COMMENT 3 NULL NO varchar 160 480 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(160) select NEVER NULL +def information_schema ENGINES ENGINE 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema ENGINES SAVEPOINTS 6 NULL YES varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL -def information_schema ENGINES SUPPORT 2 '' NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) select NEVER NULL +def information_schema ENGINES SUPPORT 2 NULL NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) select NEVER NULL def information_schema ENGINES TRANSACTIONS 4 NULL YES varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL def information_schema ENGINES XA 5 NULL YES varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL -def information_schema EVENTS CHARACTER_SET_CLIENT 22 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema EVENTS COLLATION_CONNECTION 23 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema EVENTS CREATED 17 '0000-00-00 00:00:00' NO datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL -def information_schema EVENTS DATABASE_COLLATION 24 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema EVENTS DEFINER 4 '' NO varchar 384 1152 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(384) select NEVER NULL +def information_schema EVENTS CHARACTER_SET_CLIENT 22 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema EVENTS COLLATION_CONNECTION 23 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema EVENTS CREATED 17 NULL NO datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL +def information_schema EVENTS DATABASE_COLLATION 24 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema EVENTS DEFINER 4 NULL NO varchar 384 1152 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(384) select NEVER NULL def information_schema EVENTS ENDS 14 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL -def information_schema EVENTS EVENT_BODY 6 '' NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) select NEVER NULL -def information_schema EVENTS EVENT_CATALOG 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema EVENTS EVENT_COMMENT 20 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema EVENTS EVENT_DEFINITION 7 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL -def information_schema EVENTS EVENT_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema EVENTS EVENT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema EVENTS EVENT_TYPE 8 '' NO varchar 9 27 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(9) select NEVER NULL +def information_schema EVENTS EVENT_BODY 6 NULL NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) select NEVER NULL +def information_schema EVENTS EVENT_CATALOG 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema EVENTS EVENT_COMMENT 20 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema EVENTS EVENT_DEFINITION 7 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL +def information_schema EVENTS EVENT_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema EVENTS EVENT_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema EVENTS EVENT_TYPE 8 NULL NO varchar 9 27 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(9) select NEVER NULL def information_schema EVENTS EXECUTE_AT 9 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL def information_schema EVENTS INTERVAL_FIELD 11 NULL YES varchar 18 54 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(18) select NEVER NULL def information_schema EVENTS INTERVAL_VALUE 10 NULL YES varchar 256 768 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(256) select NEVER NULL -def information_schema EVENTS LAST_ALTERED 18 '0000-00-00 00:00:00' NO datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL +def information_schema EVENTS LAST_ALTERED 18 NULL NO datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL def information_schema EVENTS LAST_EXECUTED 19 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL -def information_schema EVENTS ON_COMPLETION 16 '' NO varchar 12 36 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(12) select NEVER NULL -def information_schema EVENTS ORIGINATOR 21 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(10) select NEVER NULL -def information_schema EVENTS SQL_MODE 12 '' NO varchar 8192 24576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8192) select NEVER NULL +def information_schema EVENTS ON_COMPLETION 16 NULL NO varchar 12 36 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(12) select NEVER NULL +def information_schema EVENTS ORIGINATOR 21 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(10) select NEVER NULL +def information_schema EVENTS SQL_MODE 12 NULL NO varchar 8192 24576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8192) select NEVER NULL def information_schema EVENTS STARTS 13 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL -def information_schema EVENTS STATUS 15 '' NO varchar 18 54 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(18) select NEVER NULL -def information_schema EVENTS TIME_ZONE 5 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema EVENTS STATUS 15 NULL NO varchar 18 54 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(18) select NEVER NULL +def information_schema EVENTS TIME_ZONE 5 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema FILES AUTOEXTEND_SIZE 19 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema FILES AVG_ROW_LENGTH 28 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema FILES CHECKSUM 36 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL @@ -132,12 +132,12 @@ def information_schema FILES CREATION_TIME 20 NULL YES datetime NULL NULL NULL N def information_schema FILES DATA_FREE 32 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema FILES DATA_LENGTH 29 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema FILES DELETED_ROWS 12 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select NEVER NULL -def information_schema FILES ENGINE 10 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema FILES EXTENT_SIZE 16 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select NEVER NULL +def information_schema FILES ENGINE 10 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema FILES EXTENT_SIZE 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select NEVER NULL def information_schema FILES EXTRA 38 NULL YES varchar 255 765 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(255) select NEVER NULL -def information_schema FILES FILE_ID 1 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select NEVER NULL +def information_schema FILES FILE_ID 1 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select NEVER NULL def information_schema FILES FILE_NAME 2 NULL YES varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema FILES FILE_TYPE 3 '' NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select NEVER NULL +def information_schema FILES FILE_TYPE 3 NULL NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select NEVER NULL def information_schema FILES FREE_EXTENTS 14 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select NEVER NULL def information_schema FILES FULLTEXT_KEYS 11 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema FILES INDEX_LENGTH 31 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL @@ -150,9 +150,9 @@ def information_schema FILES MAXIMUM_SIZE 18 NULL YES bigint NULL NULL 20 0 NULL def information_schema FILES MAX_DATA_LENGTH 30 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema FILES RECOVER_TIME 23 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select NEVER NULL def information_schema FILES ROW_FORMAT 26 NULL YES varchar 10 30 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(10) select NEVER NULL -def information_schema FILES STATUS 37 '' NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select NEVER NULL +def information_schema FILES STATUS 37 NULL NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select NEVER NULL def information_schema FILES TABLESPACE_NAME 4 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema FILES TABLE_CATALOG 5 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema FILES TABLE_CATALOG 5 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema FILES TABLE_NAME 7 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema FILES TABLE_ROWS 27 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema FILES TABLE_SCHEMA 6 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL @@ -161,82 +161,82 @@ def information_schema FILES TRANSACTION_COUNTER 24 NULL YES bigint NULL NULL 19 def information_schema FILES UPDATE_COUNT 13 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select NEVER NULL def information_schema FILES UPDATE_TIME 34 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL def information_schema FILES VERSION 25 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema GEOMETRY_COLUMNS COORD_DIMENSION 11 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select NEVER NULL -def information_schema GEOMETRY_COLUMNS F_GEOMETRY_COLUMN 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema GEOMETRY_COLUMNS F_TABLE_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema GEOMETRY_COLUMNS F_TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema GEOMETRY_COLUMNS F_TABLE_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema GEOMETRY_COLUMNS GEOMETRY_TYPE 10 0 NO int NULL NULL 10 0 NULL NULL NULL int(7) select NEVER NULL -def information_schema GEOMETRY_COLUMNS G_GEOMETRY_COLUMN 8 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema GEOMETRY_COLUMNS G_TABLE_CATALOG 5 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema GEOMETRY_COLUMNS G_TABLE_NAME 7 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema GEOMETRY_COLUMNS G_TABLE_SCHEMA 6 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema GEOMETRY_COLUMNS MAX_PPR 12 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select NEVER NULL -def information_schema GEOMETRY_COLUMNS SRID 13 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) select NEVER NULL -def information_schema GEOMETRY_COLUMNS STORAGE_TYPE 9 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select NEVER NULL -def information_schema GLOBAL_STATUS VARIABLE_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 '' NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL -def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 '' NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL -def information_schema INDEX_STATISTICS INDEX_NAME 3 '' NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) select NEVER NULL -def information_schema INDEX_STATISTICS ROWS_READ 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema INDEX_STATISTICS TABLE_NAME 2 '' NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) select NEVER NULL -def information_schema INDEX_STATISTICS TABLE_SCHEMA 1 '' NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) select NEVER NULL +def information_schema GEOMETRY_COLUMNS COORD_DIMENSION 11 NULL NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select NEVER NULL +def information_schema GEOMETRY_COLUMNS F_GEOMETRY_COLUMN 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema GEOMETRY_COLUMNS F_TABLE_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema GEOMETRY_COLUMNS F_TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema GEOMETRY_COLUMNS F_TABLE_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema GEOMETRY_COLUMNS GEOMETRY_TYPE 10 NULL NO int NULL NULL 10 0 NULL NULL NULL int(7) select NEVER NULL +def information_schema GEOMETRY_COLUMNS G_GEOMETRY_COLUMN 8 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema GEOMETRY_COLUMNS G_TABLE_CATALOG 5 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema GEOMETRY_COLUMNS G_TABLE_NAME 7 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema GEOMETRY_COLUMNS G_TABLE_SCHEMA 6 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema GEOMETRY_COLUMNS MAX_PPR 12 NULL NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select NEVER NULL +def information_schema GEOMETRY_COLUMNS SRID 13 NULL NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) select NEVER NULL +def information_schema GEOMETRY_COLUMNS STORAGE_TYPE 9 NULL NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select NEVER NULL +def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL +def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL +def information_schema INDEX_STATISTICS INDEX_NAME 3 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) select NEVER NULL +def information_schema INDEX_STATISTICS ROWS_READ 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema INDEX_STATISTICS TABLE_NAME 2 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) select NEVER NULL +def information_schema INDEX_STATISTICS TABLE_SCHEMA 1 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) select NEVER NULL def information_schema KEYWORDS WORD 1 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema KEY_CACHES BLOCK_SIZE 5 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema KEY_CACHES DIRTY_BLOCKS 8 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema KEY_CACHES FULL_SIZE 4 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema KEY_CACHES KEY_CACHE_NAME 1 '' NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) select NEVER NULL -def information_schema KEY_CACHES READS 10 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema KEY_CACHES READ_REQUESTS 9 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema KEY_CACHES BLOCK_SIZE 5 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema KEY_CACHES DIRTY_BLOCKS 8 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema KEY_CACHES FULL_SIZE 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema KEY_CACHES KEY_CACHE_NAME 1 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) select NEVER NULL +def information_schema KEY_CACHES READS 10 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema KEY_CACHES READ_REQUESTS 9 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema KEY_CACHES SEGMENTS 2 NULL YES int NULL NULL 10 0 NULL NULL NULL int(3) unsigned select NEVER NULL def information_schema KEY_CACHES SEGMENT_NUMBER 3 NULL YES int NULL NULL 10 0 NULL NULL NULL int(3) unsigned select NEVER NULL -def information_schema KEY_CACHES UNUSED_BLOCKS 7 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema KEY_CACHES USED_BLOCKS 6 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema KEY_CACHES WRITES 12 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema KEY_CACHES WRITE_REQUESTS 11 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema KEY_COLUMN_USAGE COLUMN_NAME 7 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema KEY_COLUMN_USAGE CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema KEY_COLUMN_USAGE CONSTRAINT_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema KEY_COLUMN_USAGE CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema KEY_COLUMN_USAGE ORDINAL_POSITION 8 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(10) select NEVER NULL +def information_schema KEY_CACHES UNUSED_BLOCKS 7 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema KEY_CACHES USED_BLOCKS 6 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema KEY_CACHES WRITES 12 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema KEY_CACHES WRITE_REQUESTS 11 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema KEY_COLUMN_USAGE COLUMN_NAME 7 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema KEY_COLUMN_USAGE CONSTRAINT_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema KEY_COLUMN_USAGE CONSTRAINT_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema KEY_COLUMN_USAGE CONSTRAINT_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema KEY_COLUMN_USAGE ORDINAL_POSITION 8 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(10) select NEVER NULL def information_schema KEY_COLUMN_USAGE POSITION_IN_UNIQUE_CONSTRAINT 9 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(10) select NEVER NULL def information_schema KEY_COLUMN_USAGE REFERENCED_COLUMN_NAME 12 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema KEY_COLUMN_USAGE REFERENCED_TABLE_NAME 11 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema KEY_COLUMN_USAGE REFERENCED_TABLE_SCHEMA 10 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema KEY_COLUMN_USAGE TABLE_CATALOG 4 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema KEY_COLUMN_USAGE TABLE_NAME 6 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema KEY_COLUMN_USAGE TABLE_SCHEMA 5 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema OPTIMIZER_TRACE INSUFFICIENT_PRIVILEGES 4 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) select NEVER NULL -def information_schema OPTIMIZER_TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE 3 0 NO int NULL NULL 10 0 NULL NULL NULL int(20) select NEVER NULL -def information_schema OPTIMIZER_TRACE QUERY 1 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL -def information_schema OPTIMIZER_TRACE TRACE 2 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL +def information_schema KEY_COLUMN_USAGE TABLE_CATALOG 4 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema KEY_COLUMN_USAGE TABLE_NAME 6 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema KEY_COLUMN_USAGE TABLE_SCHEMA 5 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema OPTIMIZER_TRACE INSUFFICIENT_PRIVILEGES 4 NULL NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) select NEVER NULL +def information_schema OPTIMIZER_TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(20) select NEVER NULL +def information_schema OPTIMIZER_TRACE QUERY 1 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL +def information_schema OPTIMIZER_TRACE TRACE 2 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL def information_schema PARAMETERS CHARACTER_MAXIMUM_LENGTH 8 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) select NEVER NULL def information_schema PARAMETERS CHARACTER_OCTET_LENGTH 9 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) select NEVER NULL def information_schema PARAMETERS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema PARAMETERS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema PARAMETERS DATA_TYPE 7 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema PARAMETERS DATA_TYPE 7 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema PARAMETERS DATETIME_PRECISION 12 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema PARAMETERS DTD_IDENTIFIER 15 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL +def information_schema PARAMETERS DTD_IDENTIFIER 15 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL def information_schema PARAMETERS NUMERIC_PRECISION 10 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) select NEVER NULL def information_schema PARAMETERS NUMERIC_SCALE 11 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) select NEVER NULL -def information_schema PARAMETERS ORDINAL_POSITION 4 0 NO int NULL NULL 10 0 NULL NULL NULL int(21) select NEVER NULL +def information_schema PARAMETERS ORDINAL_POSITION 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(21) select NEVER NULL def information_schema PARAMETERS PARAMETER_MODE 5 NULL YES varchar 5 15 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(5) select NEVER NULL def information_schema PARAMETERS PARAMETER_NAME 6 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema PARAMETERS ROUTINE_TYPE 16 '' NO varchar 9 27 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(9) select NEVER NULL -def information_schema PARAMETERS SPECIFIC_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema PARAMETERS SPECIFIC_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema PARAMETERS SPECIFIC_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema PARTITIONS AVG_ROW_LENGTH 14 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema PARAMETERS ROUTINE_TYPE 16 NULL NO varchar 9 27 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(9) select NEVER NULL +def information_schema PARAMETERS SPECIFIC_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema PARAMETERS SPECIFIC_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema PARAMETERS SPECIFIC_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema PARTITIONS AVG_ROW_LENGTH 14 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema PARTITIONS CHECKSUM 22 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema PARTITIONS CHECK_TIME 21 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL def information_schema PARTITIONS CREATE_TIME 19 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL -def information_schema PARTITIONS DATA_FREE 18 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema PARTITIONS DATA_LENGTH 15 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema PARTITIONS INDEX_LENGTH 17 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema PARTITIONS DATA_FREE 18 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema PARTITIONS DATA_LENGTH 15 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema PARTITIONS INDEX_LENGTH 17 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema PARTITIONS MAX_DATA_LENGTH 16 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema PARTITIONS NODEGROUP 24 '' NO varchar 12 36 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(12) select NEVER NULL -def information_schema PARTITIONS PARTITION_COMMENT 23 '' NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) select NEVER NULL +def information_schema PARTITIONS NODEGROUP 24 NULL NO varchar 12 36 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(12) select NEVER NULL +def information_schema PARTITIONS PARTITION_COMMENT 23 NULL NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) select NEVER NULL def information_schema PARTITIONS PARTITION_DESCRIPTION 12 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL def information_schema PARTITIONS PARTITION_EXPRESSION 10 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL def information_schema PARTITIONS PARTITION_METHOD 8 NULL YES varchar 18 54 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(18) select NEVER NULL @@ -247,136 +247,136 @@ def information_schema PARTITIONS SUBPARTITION_METHOD 9 NULL YES varchar 12 36 N def information_schema PARTITIONS SUBPARTITION_NAME 5 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema PARTITIONS SUBPARTITION_ORDINAL_POSITION 7 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema PARTITIONS TABLESPACE_NAME 25 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema PARTITIONS TABLE_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema PARTITIONS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema PARTITIONS TABLE_ROWS 13 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema PARTITIONS TABLE_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema PARTITIONS TABLE_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema PARTITIONS TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema PARTITIONS TABLE_ROWS 13 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema PARTITIONS TABLE_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema PARTITIONS UPDATE_TIME 20 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL -def information_schema PLUGINS LOAD_OPTION 11 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema PLUGINS LOAD_OPTION 11 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema PLUGINS PLUGIN_AUTHOR 8 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema PLUGINS PLUGIN_AUTH_VERSION 13 NULL YES varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) select NEVER NULL def information_schema PLUGINS PLUGIN_DESCRIPTION 9 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL def information_schema PLUGINS PLUGIN_LIBRARY 6 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema PLUGINS PLUGIN_LIBRARY_VERSION 7 NULL YES varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select NEVER NULL -def information_schema PLUGINS PLUGIN_LICENSE 10 '' NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) select NEVER NULL -def information_schema PLUGINS PLUGIN_MATURITY 12 '' NO varchar 12 36 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(12) select NEVER NULL -def information_schema PLUGINS PLUGIN_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema PLUGINS PLUGIN_STATUS 3 '' NO varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) select NEVER NULL -def information_schema PLUGINS PLUGIN_TYPE 4 '' NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) select NEVER NULL -def information_schema PLUGINS PLUGIN_TYPE_VERSION 5 '' NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select NEVER NULL -def information_schema PLUGINS PLUGIN_VERSION 2 '' NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select NEVER NULL -def information_schema PROCESSLIST COMMAND 5 '' NO varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) select NEVER NULL +def information_schema PLUGINS PLUGIN_LICENSE 10 NULL NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) select NEVER NULL +def information_schema PLUGINS PLUGIN_MATURITY 12 NULL NO varchar 12 36 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(12) select NEVER NULL +def information_schema PLUGINS PLUGIN_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema PLUGINS PLUGIN_STATUS 3 NULL NO varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) select NEVER NULL +def information_schema PLUGINS PLUGIN_TYPE 4 NULL NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) select NEVER NULL +def information_schema PLUGINS PLUGIN_TYPE_VERSION 5 NULL NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select NEVER NULL +def information_schema PLUGINS PLUGIN_VERSION 2 NULL NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select NEVER NULL +def information_schema PROCESSLIST COMMAND 5 NULL NO varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) select NEVER NULL def information_schema PROCESSLIST DB 4 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema PROCESSLIST EXAMINED_ROWS 15 0 NO int NULL NULL 10 0 NULL NULL NULL int(7) select NEVER NULL -def information_schema PROCESSLIST HOST 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema PROCESSLIST ID 1 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select NEVER NULL +def information_schema PROCESSLIST EXAMINED_ROWS 15 NULL NO int NULL NULL 10 0 NULL NULL NULL int(7) select NEVER NULL +def information_schema PROCESSLIST HOST 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema PROCESSLIST ID 1 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select NEVER NULL def information_schema PROCESSLIST INFO 8 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL def information_schema PROCESSLIST INFO_BINARY 17 NULL YES blob 65535 65535 NULL NULL NULL NULL NULL blob select NEVER NULL -def information_schema PROCESSLIST MAX_MEMORY_USED 14 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(7) select NEVER NULL -def information_schema PROCESSLIST MAX_STAGE 11 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select NEVER NULL -def information_schema PROCESSLIST MEMORY_USED 13 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(7) select NEVER NULL -def information_schema PROCESSLIST PROGRESS 12 0.000 NO decimal NULL NULL 7 3 NULL NULL NULL decimal(7,3) select NEVER NULL -def information_schema PROCESSLIST QUERY_ID 16 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select NEVER NULL -def information_schema PROCESSLIST STAGE 10 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select NEVER NULL +def information_schema PROCESSLIST MAX_MEMORY_USED 14 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(7) select NEVER NULL +def information_schema PROCESSLIST MAX_STAGE 11 NULL NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select NEVER NULL +def information_schema PROCESSLIST MEMORY_USED 13 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(7) select NEVER NULL +def information_schema PROCESSLIST PROGRESS 12 NULL NO decimal NULL NULL 7 3 NULL NULL NULL decimal(7,3) select NEVER NULL +def information_schema PROCESSLIST QUERY_ID 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select NEVER NULL +def information_schema PROCESSLIST STAGE 10 NULL NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select NEVER NULL def information_schema PROCESSLIST STATE 7 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema PROCESSLIST TID 18 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select NEVER NULL -def information_schema PROCESSLIST TIME 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(7) select NEVER NULL -def information_schema PROCESSLIST TIME_MS 9 0.000 NO decimal NULL NULL 22 3 NULL NULL NULL decimal(22,3) select NEVER NULL -def information_schema PROCESSLIST USER 2 '' NO varchar 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(128) select NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS DELETE_RULE 9 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS MATCH_OPTION 7 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS REFERENCED_TABLE_NAME 11 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS TABLE_NAME 10 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_CATALOG 4 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema PROCESSLIST TID 18 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select NEVER NULL +def information_schema PROCESSLIST TIME 6 NULL NO int NULL NULL 10 0 NULL NULL NULL int(7) select NEVER NULL +def information_schema PROCESSLIST TIME_MS 9 NULL NO decimal NULL NULL 22 3 NULL NULL NULL decimal(22,3) select NEVER NULL +def information_schema PROCESSLIST USER 2 NULL NO varchar 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(128) select NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS DELETE_RULE 9 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS MATCH_OPTION 7 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS REFERENCED_TABLE_NAME 11 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS TABLE_NAME 10 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_CATALOG 4 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL def information_schema REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_NAME 6 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_SCHEMA 5 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS UPDATE_RULE 8 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_SCHEMA 5 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS UPDATE_RULE 8 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema ROUTINES CHARACTER_MAXIMUM_LENGTH 7 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) select NEVER NULL def information_schema ROUTINES CHARACTER_OCTET_LENGTH 8 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) select NEVER NULL -def information_schema ROUTINES CHARACTER_SET_CLIENT 29 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema ROUTINES CHARACTER_SET_CLIENT 29 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL def information_schema ROUTINES CHARACTER_SET_NAME 12 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema ROUTINES COLLATION_CONNECTION 30 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema ROUTINES COLLATION_CONNECTION 30 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL def information_schema ROUTINES COLLATION_NAME 13 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema ROUTINES CREATED 24 '0000-00-00 00:00:00' NO datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL -def information_schema ROUTINES DATABASE_COLLATION 31 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema ROUTINES DATA_TYPE 6 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema ROUTINES CREATED 24 NULL NO datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL +def information_schema ROUTINES DATABASE_COLLATION 31 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema ROUTINES DATA_TYPE 6 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema ROUTINES DATETIME_PRECISION 11 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema ROUTINES DEFINER 28 '' NO varchar 384 1152 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(384) select NEVER NULL +def information_schema ROUTINES DEFINER 28 NULL NO varchar 384 1152 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(384) select NEVER NULL def information_schema ROUTINES DTD_IDENTIFIER 14 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL def information_schema ROUTINES EXTERNAL_LANGUAGE 18 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema ROUTINES EXTERNAL_NAME 17 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema ROUTINES IS_DETERMINISTIC 20 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL -def information_schema ROUTINES LAST_ALTERED 25 '0000-00-00 00:00:00' NO datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL +def information_schema ROUTINES IS_DETERMINISTIC 20 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL +def information_schema ROUTINES LAST_ALTERED 25 NULL NO datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL def information_schema ROUTINES NUMERIC_PRECISION 9 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) select NEVER NULL def information_schema ROUTINES NUMERIC_SCALE 10 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) select NEVER NULL -def information_schema ROUTINES PARAMETER_STYLE 19 '' NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) select NEVER NULL -def information_schema ROUTINES ROUTINE_BODY 15 '' NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) select NEVER NULL -def information_schema ROUTINES ROUTINE_CATALOG 2 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema ROUTINES ROUTINE_COMMENT 27 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL +def information_schema ROUTINES PARAMETER_STYLE 19 NULL NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) select NEVER NULL +def information_schema ROUTINES ROUTINE_BODY 15 NULL NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) select NEVER NULL +def information_schema ROUTINES ROUTINE_CATALOG 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema ROUTINES ROUTINE_COMMENT 27 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL def information_schema ROUTINES ROUTINE_DEFINITION 16 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL -def information_schema ROUTINES ROUTINE_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema ROUTINES ROUTINE_SCHEMA 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema ROUTINES ROUTINE_TYPE 5 '' NO varchar 13 39 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(13) select NEVER NULL -def information_schema ROUTINES SECURITY_TYPE 23 '' NO varchar 7 21 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(7) select NEVER NULL -def information_schema ROUTINES SPECIFIC_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema ROUTINES SQL_DATA_ACCESS 21 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema ROUTINES SQL_MODE 26 '' NO varchar 8192 24576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8192) select NEVER NULL +def information_schema ROUTINES ROUTINE_NAME 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema ROUTINES ROUTINE_SCHEMA 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema ROUTINES ROUTINE_TYPE 5 NULL NO varchar 13 39 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(13) select NEVER NULL +def information_schema ROUTINES SECURITY_TYPE 23 NULL NO varchar 7 21 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(7) select NEVER NULL +def information_schema ROUTINES SPECIFIC_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema ROUTINES SQL_DATA_ACCESS 21 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema ROUTINES SQL_MODE 26 NULL NO varchar 8192 24576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8192) select NEVER NULL def information_schema ROUTINES SQL_PATH 22 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema SCHEMATA CATALOG_NAME 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME 3 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema SCHEMATA DEFAULT_COLLATION_NAME 4 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema SCHEMATA SCHEMA_COMMENT 6 '' NO varchar 1024 3072 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1024) select NEVER NULL -def information_schema SCHEMATA SCHEMA_NAME 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema SCHEMATA CATALOG_NAME 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME 3 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema SCHEMATA DEFAULT_COLLATION_NAME 4 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema SCHEMATA SCHEMA_COMMENT 6 NULL NO varchar 1024 3072 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1024) select NEVER NULL +def information_schema SCHEMATA SCHEMA_NAME 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema SCHEMATA SQL_PATH 5 NULL YES varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema SCHEMA_PRIVILEGES GRANTEE 1 '' NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) select NEVER NULL -def information_schema SCHEMA_PRIVILEGES IS_GRANTABLE 5 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL -def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema SESSION_STATUS VARIABLE_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema SESSION_STATUS VARIABLE_VALUE 2 '' NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL -def information_schema SESSION_VARIABLES VARIABLE_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 '' NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL -def information_schema SPATIAL_REF_SYS AUTH_NAME 2 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema SPATIAL_REF_SYS AUTH_SRID 3 0 NO int NULL NULL 10 0 NULL NULL NULL int(5) select NEVER NULL -def information_schema SPATIAL_REF_SYS SRID 1 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) select NEVER NULL -def information_schema SPATIAL_REF_SYS SRTEXT 4 '' NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL +def information_schema SCHEMA_PRIVILEGES GRANTEE 1 NULL NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) select NEVER NULL +def information_schema SCHEMA_PRIVILEGES IS_GRANTABLE 5 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL +def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema SESSION_STATUS VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema SESSION_STATUS VARIABLE_VALUE 2 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL +def information_schema SESSION_VARIABLES VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL +def information_schema SPATIAL_REF_SYS AUTH_NAME 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema SPATIAL_REF_SYS AUTH_SRID 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(5) select NEVER NULL +def information_schema SPATIAL_REF_SYS SRID 1 NULL NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) select NEVER NULL +def information_schema SPATIAL_REF_SYS SRTEXT 4 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL def information_schema SQL_FUNCTIONS FUNCTION 1 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema STATISTICS CARDINALITY 10 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL def information_schema STATISTICS COLLATION 9 NULL YES varchar 1 3 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1) select NEVER NULL -def information_schema STATISTICS COLUMN_NAME 8 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema STATISTICS COLUMN_NAME 8 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema STATISTICS COMMENT 15 NULL YES varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) select NEVER NULL -def information_schema STATISTICS IGNORED 17 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL -def information_schema STATISTICS INDEX_COMMENT 16 '' NO varchar 1024 3072 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1024) select NEVER NULL -def information_schema STATISTICS INDEX_NAME 6 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema STATISTICS INDEX_SCHEMA 5 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema STATISTICS INDEX_TYPE 14 '' NO varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) select NEVER NULL -def information_schema STATISTICS NON_UNIQUE 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(1) select NEVER NULL -def information_schema STATISTICS NULLABLE 13 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL +def information_schema STATISTICS IGNORED 17 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL +def information_schema STATISTICS INDEX_COMMENT 16 NULL NO varchar 1024 3072 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1024) select NEVER NULL +def information_schema STATISTICS INDEX_NAME 6 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema STATISTICS INDEX_SCHEMA 5 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema STATISTICS INDEX_TYPE 14 NULL NO varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) select NEVER NULL +def information_schema STATISTICS NON_UNIQUE 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(1) select NEVER NULL +def information_schema STATISTICS NULLABLE 13 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL def information_schema STATISTICS PACKED 12 NULL YES varchar 10 30 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(10) select NEVER NULL -def information_schema STATISTICS SEQ_IN_INDEX 7 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(2) select NEVER NULL +def information_schema STATISTICS SEQ_IN_INDEX 7 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(2) select NEVER NULL def information_schema STATISTICS SUB_PART 11 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(3) select NEVER NULL -def information_schema STATISTICS TABLE_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema STATISTICS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema STATISTICS TABLE_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema STATISTICS TABLE_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema STATISTICS TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema STATISTICS TABLE_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema SYSTEM_VARIABLES COMMAND_LINE_ARGUMENT 14 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL def information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST 12 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL -def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_PATH 15 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL def information_schema SYSTEM_VARIABLES NUMERIC_BLOCK_SIZE 11 NULL YES varchar 21 63 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(21) select NEVER NULL def information_schema SYSTEM_VARIABLES NUMERIC_MAX_VALUE 10 NULL YES varchar 21 63 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(21) select NEVER NULL def information_schema SYSTEM_VARIABLES NUMERIC_MIN_VALUE 9 NULL YES varchar 21 63 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(21) select NEVER NULL -def information_schema SYSTEM_VARIABLES READ_ONLY 13 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL +def information_schema SYSTEM_VARIABLES READ_ONLY 13 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL def information_schema SYSTEM_VARIABLES SESSION_VALUE 2 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL -def information_schema SYSTEM_VARIABLES VARIABLE_COMMENT 8 '' NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL -def information_schema SYSTEM_VARIABLES VARIABLE_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema SYSTEM_VARIABLES VARIABLE_SCOPE 6 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema SYSTEM_VARIABLES VARIABLE_TYPE 7 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema SYSTEM_VARIABLES VARIABLE_COMMENT 8 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL +def information_schema SYSTEM_VARIABLES VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema SYSTEM_VARIABLES VARIABLE_SCOPE 6 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema SYSTEM_VARIABLES VARIABLE_TYPE 7 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL @@ -390,104 +390,104 @@ def information_schema TABLES INDEX_LENGTH 12 NULL YES bigint NULL NULL 20 0 NUL def information_schema TABLES MAX_DATA_LENGTH 11 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema TABLES MAX_INDEX_LENGTH 22 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema TABLES ROW_FORMAT 7 NULL YES varchar 10 30 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(10) select NEVER NULL -def information_schema TABLES TABLE_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema TABLES TABLE_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL def information_schema TABLES TABLE_COLLATION 18 NULL YES varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema TABLES TABLE_COMMENT 21 '' NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL -def information_schema TABLES TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema TABLES TABLE_COMMENT 21 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL +def information_schema TABLES TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema TABLES TABLE_ROWS 8 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema TABLES TABLE_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema TABLES TABLE_TYPE 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema TABLES TABLE_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema TABLES TABLE_TYPE 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema TABLES TEMPORARY 23 NULL YES varchar 1 3 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1) select NEVER NULL def information_schema TABLES UPDATE_TIME 16 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NEVER NULL def information_schema TABLES VERSION 6 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema TABLESPACES AUTOEXTEND_SIZE 6 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema TABLESPACES ENGINE 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema TABLESPACES ENGINE 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema TABLESPACES EXTENT_SIZE 5 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema TABLESPACES LOGFILE_GROUP_NAME 4 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema TABLESPACES MAXIMUM_SIZE 7 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema TABLESPACES NODEGROUP_ID 8 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL def information_schema TABLESPACES TABLESPACE_COMMENT 9 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL -def information_schema TABLESPACES TABLESPACE_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema TABLESPACES TABLESPACE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL def information_schema TABLESPACES TABLESPACE_TYPE 3 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema TABLE_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema TABLE_CONSTRAINTS CONSTRAINT_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema TABLE_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema TABLE_CONSTRAINTS CONSTRAINT_TYPE 6 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema TABLE_CONSTRAINTS TABLE_NAME 5 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema TABLE_CONSTRAINTS TABLE_SCHEMA 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema TABLE_PRIVILEGES GRANTEE 1 '' NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) select NEVER NULL -def information_schema TABLE_PRIVILEGES IS_GRANTABLE 6 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL -def information_schema TABLE_PRIVILEGES PRIVILEGE_TYPE 5 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema TABLE_PRIVILEGES TABLE_CATALOG 2 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema TABLE_PRIVILEGES TABLE_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema TABLE_PRIVILEGES TABLE_SCHEMA 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema TABLE_STATISTICS ROWS_CHANGED 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema TABLE_STATISTICS ROWS_CHANGED_X_INDEXES 5 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema TABLE_STATISTICS ROWS_READ 3 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema TABLE_STATISTICS TABLE_NAME 2 '' NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) select NEVER NULL -def information_schema TABLE_STATISTICS TABLE_SCHEMA 1 '' NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) select NEVER NULL +def information_schema TABLE_CONSTRAINTS CONSTRAINT_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema TABLE_CONSTRAINTS CONSTRAINT_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema TABLE_CONSTRAINTS CONSTRAINT_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema TABLE_CONSTRAINTS CONSTRAINT_TYPE 6 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema TABLE_CONSTRAINTS TABLE_NAME 5 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema TABLE_CONSTRAINTS TABLE_SCHEMA 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema TABLE_PRIVILEGES GRANTEE 1 NULL NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) select NEVER NULL +def information_schema TABLE_PRIVILEGES IS_GRANTABLE 6 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL +def information_schema TABLE_PRIVILEGES PRIVILEGE_TYPE 5 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema TABLE_PRIVILEGES TABLE_CATALOG 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema TABLE_PRIVILEGES TABLE_NAME 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema TABLE_PRIVILEGES TABLE_SCHEMA 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema TABLE_STATISTICS ROWS_CHANGED 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema TABLE_STATISTICS ROWS_CHANGED_X_INDEXES 5 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema TABLE_STATISTICS ROWS_READ 3 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema TABLE_STATISTICS TABLE_NAME 2 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) select NEVER NULL +def information_schema TABLE_STATISTICS TABLE_SCHEMA 1 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) select NEVER NULL def information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL -def information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select NEVER NULL -def information_schema TRIGGERS ACTION_ORIENTATION 11 '' NO varchar 9 27 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(9) select NEVER NULL -def information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL +def information_schema TRIGGERS ACTION_ORDER 8 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select NEVER NULL +def information_schema TRIGGERS ACTION_ORIENTATION 11 NULL NO varchar 9 27 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(9) select NEVER NULL +def information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL def information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL +def information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL def information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema TRIGGERS ACTION_STATEMENT 10 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL -def information_schema TRIGGERS ACTION_TIMING 12 '' NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) select NEVER NULL -def information_schema TRIGGERS CHARACTER_SET_CLIENT 20 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema TRIGGERS COLLATION_CONNECTION 21 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL +def information_schema TRIGGERS ACTION_TIMING 12 NULL NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) select NEVER NULL +def information_schema TRIGGERS CHARACTER_SET_CLIENT 20 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema TRIGGERS COLLATION_CONNECTION 21 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL def information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL 2 NULL NULL datetime(2) select NEVER NULL -def information_schema TRIGGERS DATABASE_COLLATION 22 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema TRIGGERS DEFINER 19 '' NO varchar 384 1152 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(384) select NEVER NULL -def information_schema TRIGGERS EVENT_MANIPULATION 4 '' NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) select NEVER NULL -def information_schema TRIGGERS EVENT_OBJECT_CATALOG 5 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema TRIGGERS EVENT_OBJECT_TABLE 7 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema TRIGGERS SQL_MODE 18 '' NO varchar 8192 24576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8192) select NEVER NULL -def information_schema TRIGGERS TRIGGER_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema TRIGGERS TRIGGER_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema TRIGGERS TRIGGER_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema USER_PRIVILEGES GRANTEE 1 '' NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) select NEVER NULL -def information_schema USER_PRIVILEGES IS_GRANTABLE 4 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL -def information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema USER_PRIVILEGES TABLE_CATALOG 2 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema USER_STATISTICS ACCESS_DENIED 22 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS BINLOG_BYTES_WRITTEN 9 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS BUSY_TIME 5 0 NO double NULL NULL 21 NULL NULL NULL NULL double select NEVER NULL -def information_schema USER_STATISTICS BYTES_RECEIVED 7 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS BYTES_SENT 8 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS COMMIT_TRANSACTIONS 18 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS CONCURRENT_CONNECTIONS 3 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) select NEVER NULL -def information_schema USER_STATISTICS CONNECTED_TIME 4 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) select NEVER NULL -def information_schema USER_STATISTICS CPU_TIME 6 0 NO double NULL NULL 21 NULL NULL NULL NULL double select NEVER NULL -def information_schema USER_STATISTICS DENIED_CONNECTIONS 20 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS EMPTY_QUERIES 23 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS LOST_CONNECTIONS 21 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 25 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS OTHER_COMMANDS 17 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS ROLLBACK_TRANSACTIONS 19 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS ROWS_DELETED 12 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS ROWS_INSERTED 13 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS ROWS_READ 10 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS ROWS_SENT 11 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS ROWS_UPDATED 14 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS SELECT_COMMANDS 15 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS TOTAL_CONNECTIONS 2 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) select NEVER NULL -def information_schema USER_STATISTICS TOTAL_SSL_CONNECTIONS 24 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL -def information_schema USER_STATISTICS UPDATE_COMMANDS 16 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL -def information_schema USER_STATISTICS USER 1 '' NO varchar 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(128) select NEVER NULL -def information_schema VIEWS ALGORITHM 11 '' NO varchar 10 30 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(10) select NEVER NULL -def information_schema VIEWS CHARACTER_SET_CLIENT 9 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema VIEWS CHECK_OPTION 5 '' NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) select NEVER NULL -def information_schema VIEWS COLLATION_CONNECTION 10 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL -def information_schema VIEWS DEFINER 7 '' NO varchar 384 1152 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(384) select NEVER NULL -def information_schema VIEWS IS_UPDATABLE 6 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL -def information_schema VIEWS SECURITY_TYPE 8 '' NO varchar 7 21 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(7) select NEVER NULL -def information_schema VIEWS TABLE_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL -def information_schema VIEWS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema VIEWS TABLE_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL -def information_schema VIEWS VIEW_DEFINITION 4 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL +def information_schema TRIGGERS DATABASE_COLLATION 22 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema TRIGGERS DEFINER 19 NULL NO varchar 384 1152 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(384) select NEVER NULL +def information_schema TRIGGERS EVENT_MANIPULATION 4 NULL NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) select NEVER NULL +def information_schema TRIGGERS EVENT_OBJECT_CATALOG 5 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema TRIGGERS SQL_MODE 18 NULL NO varchar 8192 24576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8192) select NEVER NULL +def information_schema TRIGGERS TRIGGER_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema TRIGGERS TRIGGER_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema TRIGGERS TRIGGER_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema USER_PRIVILEGES GRANTEE 1 NULL NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) select NEVER NULL +def information_schema USER_PRIVILEGES IS_GRANTABLE 4 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL +def information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema USER_STATISTICS ACCESS_DENIED 22 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS BINLOG_BYTES_WRITTEN 9 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS BUSY_TIME 5 NULL NO double NULL NULL 21 NULL NULL NULL NULL double select NEVER NULL +def information_schema USER_STATISTICS BYTES_RECEIVED 7 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS BYTES_SENT 8 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS COMMIT_TRANSACTIONS 18 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS CONCURRENT_CONNECTIONS 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select NEVER NULL +def information_schema USER_STATISTICS CONNECTED_TIME 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select NEVER NULL +def information_schema USER_STATISTICS CPU_TIME 6 NULL NO double NULL NULL 21 NULL NULL NULL NULL double select NEVER NULL +def information_schema USER_STATISTICS DENIED_CONNECTIONS 20 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS EMPTY_QUERIES 23 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS LOST_CONNECTIONS 21 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 25 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS OTHER_COMMANDS 17 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS ROLLBACK_TRANSACTIONS 19 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS ROWS_DELETED 12 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS ROWS_INSERTED 13 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS ROWS_READ 10 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS ROWS_SENT 11 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS ROWS_UPDATED 14 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS SELECT_COMMANDS 15 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS TOTAL_CONNECTIONS 2 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select NEVER NULL +def information_schema USER_STATISTICS TOTAL_SSL_CONNECTIONS 24 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL +def information_schema USER_STATISTICS UPDATE_COMMANDS 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL +def information_schema USER_STATISTICS USER 1 NULL NO varchar 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(128) select NEVER NULL +def information_schema VIEWS ALGORITHM 11 NULL NO varchar 10 30 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(10) select NEVER NULL +def information_schema VIEWS CHARACTER_SET_CLIENT 9 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema VIEWS CHECK_OPTION 5 NULL NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) select NEVER NULL +def information_schema VIEWS COLLATION_CONNECTION 10 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select NEVER NULL +def information_schema VIEWS DEFINER 7 NULL NO varchar 384 1152 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(384) select NEVER NULL +def information_schema VIEWS IS_UPDATABLE 6 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL +def information_schema VIEWS SECURITY_TYPE 8 NULL NO varchar 7 21 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(7) select NEVER NULL +def information_schema VIEWS TABLE_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL +def information_schema VIEWS TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema VIEWS TABLE_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL +def information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext select NEVER NULL ########################################################################## # Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH ########################################################################## @@ -628,7 +628,7 @@ NULL information_schema COLUMNS DATETIME_PRECISION bigint NULL NULL NULL NULL bi 3.0000 information_schema COLUMNS COLLATION_NAME varchar 32 96 utf8mb3 utf8mb3_general_ci varchar(32) 1.0000 information_schema COLUMNS COLUMN_TYPE longtext 4294967295 4294967295 utf8mb3 utf8mb3_general_ci longtext 3.0000 information_schema COLUMNS COLUMN_KEY varchar 3 9 utf8mb3 utf8mb3_general_ci varchar(3) -3.0000 information_schema COLUMNS EXTRA varchar 30 90 utf8mb3 utf8mb3_general_ci varchar(30) +3.0000 information_schema COLUMNS EXTRA varchar 80 240 utf8mb3 utf8mb3_general_ci varchar(80) 3.0000 information_schema COLUMNS PRIVILEGES varchar 80 240 utf8mb3 utf8mb3_general_ci varchar(80) 3.0000 information_schema COLUMNS COLUMN_COMMENT varchar 1024 3072 utf8mb3 utf8mb3_general_ci varchar(1024) 3.0000 information_schema COLUMNS IS_GENERATED varchar 6 18 utf8mb3 utf8mb3_general_ci varchar(6) diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result index d021272b8c2ba..622f839901feb 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result @@ -3,126 +3,126 @@ WHERE table_schema = 'information_schema' AND table_name <> 'profiling' AND table_name not like 'innodb_%' ORDER BY table_schema, table_name, column_name; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION -def information_schema ALL_PLUGINS LOAD_OPTION 11 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema ALL_PLUGINS LOAD_OPTION 11 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema ALL_PLUGINS PLUGIN_AUTHOR 8 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema ALL_PLUGINS PLUGIN_AUTH_VERSION 13 NULL YES varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) NEVER NULL def information_schema ALL_PLUGINS PLUGIN_DESCRIPTION 9 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL def information_schema ALL_PLUGINS PLUGIN_LIBRARY 6 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema ALL_PLUGINS PLUGIN_LIBRARY_VERSION 7 NULL YES varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) NEVER NULL -def information_schema ALL_PLUGINS PLUGIN_LICENSE 10 '' NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) NEVER NULL -def information_schema ALL_PLUGINS PLUGIN_MATURITY 12 '' NO varchar 12 36 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(12) NEVER NULL -def information_schema ALL_PLUGINS PLUGIN_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema ALL_PLUGINS PLUGIN_STATUS 3 '' NO varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) NEVER NULL -def information_schema ALL_PLUGINS PLUGIN_TYPE 4 '' NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) NEVER NULL -def information_schema ALL_PLUGINS PLUGIN_TYPE_VERSION 5 '' NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) NEVER NULL -def information_schema ALL_PLUGINS PLUGIN_VERSION 2 '' NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) NEVER NULL -def information_schema APPLICABLE_ROLES GRANTEE 1 '' NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) NEVER NULL +def information_schema ALL_PLUGINS PLUGIN_LICENSE 10 NULL NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) NEVER NULL +def information_schema ALL_PLUGINS PLUGIN_MATURITY 12 NULL NO varchar 12 36 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(12) NEVER NULL +def information_schema ALL_PLUGINS PLUGIN_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema ALL_PLUGINS PLUGIN_STATUS 3 NULL NO varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) NEVER NULL +def information_schema ALL_PLUGINS PLUGIN_TYPE 4 NULL NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) NEVER NULL +def information_schema ALL_PLUGINS PLUGIN_TYPE_VERSION 5 NULL NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) NEVER NULL +def information_schema ALL_PLUGINS PLUGIN_VERSION 2 NULL NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) NEVER NULL +def information_schema APPLICABLE_ROLES GRANTEE 1 NULL NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) NEVER NULL def information_schema APPLICABLE_ROLES IS_DEFAULT 4 NULL YES varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL -def information_schema APPLICABLE_ROLES IS_GRANTABLE 3 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL -def information_schema APPLICABLE_ROLES ROLE_NAME 2 '' NO varchar 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(128) NEVER NULL -def information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema CHARACTER_SETS DESCRIPTION 3 '' NO varchar 60 180 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(60) NEVER NULL -def information_schema CHARACTER_SETS MAXLEN 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) NEVER NULL -def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 6 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL -def information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema CHECK_CONSTRAINTS LEVEL 5 '' NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) NEVER NULL -def information_schema CHECK_CONSTRAINTS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema CLIENT_STATISTICS ACCESS_DENIED 22 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS BINLOG_BYTES_WRITTEN 9 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS BUSY_TIME 5 0 NO double NULL NULL 21 NULL NULL NULL NULL double NEVER NULL -def information_schema CLIENT_STATISTICS BYTES_RECEIVED 7 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS BYTES_SENT 8 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS CLIENT 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema CLIENT_STATISTICS COMMIT_TRANSACTIONS 18 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS CONCURRENT_CONNECTIONS 3 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS CONNECTED_TIME 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS CPU_TIME 6 0 NO double NULL NULL 21 NULL NULL NULL NULL double NEVER NULL -def information_schema CLIENT_STATISTICS DENIED_CONNECTIONS 20 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS EMPTY_QUERIES 23 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS LOST_CONNECTIONS 21 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 25 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS OTHER_COMMANDS 17 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS ROLLBACK_TRANSACTIONS 19 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS ROWS_DELETED 12 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS ROWS_INSERTED 13 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS ROWS_READ 10 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS ROWS_SENT 11 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS ROWS_UPDATED 14 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS SELECT_COMMANDS 15 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS 2 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema CLIENT_STATISTICS TOTAL_SSL_CONNECTIONS 24 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema CLIENT_STATISTICS UPDATE_COMMANDS 16 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema COLLATIONS CHARACTER_SET_NAME 2 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema COLLATIONS COLLATION_NAME 1 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema COLLATIONS ID 3 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(11) NEVER NULL -def information_schema COLLATIONS IS_COMPILED 5 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL -def information_schema COLLATIONS IS_DEFAULT 4 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL -def information_schema COLLATIONS SORTLEN 6 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) NEVER NULL -def information_schema COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME 2 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME 1 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema APPLICABLE_ROLES IS_GRANTABLE 3 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL +def information_schema APPLICABLE_ROLES ROLE_NAME 2 NULL NO varchar 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(128) NEVER NULL +def information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema CHARACTER_SETS DESCRIPTION 3 NULL NO varchar 60 180 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(60) NEVER NULL +def information_schema CHARACTER_SETS MAXLEN 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) NEVER NULL +def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 6 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL +def information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema CHECK_CONSTRAINTS LEVEL 5 NULL NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) NEVER NULL +def information_schema CHECK_CONSTRAINTS TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema CLIENT_STATISTICS ACCESS_DENIED 22 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS BINLOG_BYTES_WRITTEN 9 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS BUSY_TIME 5 NULL NO double NULL NULL 21 NULL NULL NULL NULL double NEVER NULL +def information_schema CLIENT_STATISTICS BYTES_RECEIVED 7 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS BYTES_SENT 8 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS CLIENT 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema CLIENT_STATISTICS COMMIT_TRANSACTIONS 18 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS CONCURRENT_CONNECTIONS 3 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS CONNECTED_TIME 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS CPU_TIME 6 NULL NO double NULL NULL 21 NULL NULL NULL NULL double NEVER NULL +def information_schema CLIENT_STATISTICS DENIED_CONNECTIONS 20 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS EMPTY_QUERIES 23 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS LOST_CONNECTIONS 21 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 25 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS OTHER_COMMANDS 17 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS ROLLBACK_TRANSACTIONS 19 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS ROWS_DELETED 12 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS ROWS_INSERTED 13 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS ROWS_READ 10 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS ROWS_SENT 11 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS ROWS_UPDATED 14 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS SELECT_COMMANDS 15 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS 2 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema CLIENT_STATISTICS TOTAL_SSL_CONNECTIONS 24 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema CLIENT_STATISTICS UPDATE_COMMANDS 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema COLLATIONS CHARACTER_SET_NAME 2 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema COLLATIONS COLLATION_NAME 1 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema COLLATIONS ID 3 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(11) NEVER NULL +def information_schema COLLATIONS IS_COMPILED 5 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL +def information_schema COLLATIONS IS_DEFAULT 4 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL +def information_schema COLLATIONS SORTLEN 6 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) NEVER NULL +def information_schema COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME 2 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME 1 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL def information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema COLUMNS CHARACTER_OCTET_LENGTH 10 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema COLUMNS CHARACTER_SET_NAME 14 NULL YES varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL def information_schema COLUMNS COLLATION_NAME 15 NULL YES varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema COLUMNS COLUMN_COMMENT 20 '' NO varchar 1024 3072 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1024) NEVER NULL +def information_schema COLUMNS COLUMN_COMMENT 20 NULL NO varchar 1024 3072 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1024) NEVER NULL def information_schema COLUMNS COLUMN_DEFAULT 6 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL -def information_schema COLUMNS COLUMN_KEY 17 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL -def information_schema COLUMNS COLUMN_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema COLUMNS COLUMN_TYPE 16 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL -def information_schema COLUMNS DATA_TYPE 8 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema COLUMNS COLUMN_KEY 17 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL +def information_schema COLUMNS COLUMN_NAME 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema COLUMNS COLUMN_TYPE 16 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL +def information_schema COLUMNS DATA_TYPE 8 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema COLUMNS DATETIME_PRECISION 13 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema COLUMNS EXTRA 18 '' NO varchar 30 90 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(30) NEVER NULL +def information_schema COLUMNS EXTRA 18 NULL NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) NEVER NULL def information_schema COLUMNS GENERATION_EXPRESSION 22 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL -def information_schema COLUMNS IS_GENERATED 21 '' NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) NEVER NULL -def information_schema COLUMNS IS_NULLABLE 7 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL +def information_schema COLUMNS IS_GENERATED 21 NULL NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) NEVER NULL +def information_schema COLUMNS IS_NULLABLE 7 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL def information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema COLUMNS ORDINAL_POSITION 5 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema COLUMNS PRIVILEGES 19 '' NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) NEVER NULL -def information_schema COLUMNS TABLE_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema COLUMNS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema COLUMNS TABLE_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema COLUMN_PRIVILEGES COLUMN_NAME 5 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema COLUMN_PRIVILEGES GRANTEE 1 '' NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) NEVER NULL -def information_schema COLUMN_PRIVILEGES IS_GRANTABLE 7 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL -def information_schema COLUMN_PRIVILEGES PRIVILEGE_TYPE 6 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema COLUMN_PRIVILEGES TABLE_CATALOG 2 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema COLUMN_PRIVILEGES TABLE_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema COLUMN_PRIVILEGES TABLE_SCHEMA 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema COLUMNS ORDINAL_POSITION 5 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema COLUMNS PRIVILEGES 19 NULL NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) NEVER NULL +def information_schema COLUMNS TABLE_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema COLUMNS TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema COLUMNS TABLE_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema COLUMN_PRIVILEGES COLUMN_NAME 5 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema COLUMN_PRIVILEGES GRANTEE 1 NULL NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) NEVER NULL +def information_schema COLUMN_PRIVILEGES IS_GRANTABLE 7 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL +def information_schema COLUMN_PRIVILEGES PRIVILEGE_TYPE 6 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema COLUMN_PRIVILEGES TABLE_CATALOG 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema COLUMN_PRIVILEGES TABLE_NAME 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema COLUMN_PRIVILEGES TABLE_SCHEMA 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema ENABLED_ROLES ROLE_NAME 1 NULL YES varchar 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(128) NEVER NULL -def information_schema ENGINES COMMENT 3 '' NO varchar 160 480 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(160) NEVER NULL -def information_schema ENGINES ENGINE 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema ENGINES COMMENT 3 NULL NO varchar 160 480 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(160) NEVER NULL +def information_schema ENGINES ENGINE 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema ENGINES SAVEPOINTS 6 NULL YES varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL -def information_schema ENGINES SUPPORT 2 '' NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) NEVER NULL +def information_schema ENGINES SUPPORT 2 NULL NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) NEVER NULL def information_schema ENGINES TRANSACTIONS 4 NULL YES varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL def information_schema ENGINES XA 5 NULL YES varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL -def information_schema EVENTS CHARACTER_SET_CLIENT 22 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema EVENTS COLLATION_CONNECTION 23 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema EVENTS CREATED 17 '0000-00-00 00:00:00' NO datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL -def information_schema EVENTS DATABASE_COLLATION 24 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema EVENTS DEFINER 4 '' NO varchar 384 1152 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(384) NEVER NULL +def information_schema EVENTS CHARACTER_SET_CLIENT 22 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema EVENTS COLLATION_CONNECTION 23 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema EVENTS CREATED 17 NULL NO datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL +def information_schema EVENTS DATABASE_COLLATION 24 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema EVENTS DEFINER 4 NULL NO varchar 384 1152 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(384) NEVER NULL def information_schema EVENTS ENDS 14 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL -def information_schema EVENTS EVENT_BODY 6 '' NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) NEVER NULL -def information_schema EVENTS EVENT_CATALOG 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema EVENTS EVENT_COMMENT 20 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema EVENTS EVENT_DEFINITION 7 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL -def information_schema EVENTS EVENT_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema EVENTS EVENT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema EVENTS EVENT_TYPE 8 '' NO varchar 9 27 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(9) NEVER NULL +def information_schema EVENTS EVENT_BODY 6 NULL NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) NEVER NULL +def information_schema EVENTS EVENT_CATALOG 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema EVENTS EVENT_COMMENT 20 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema EVENTS EVENT_DEFINITION 7 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL +def information_schema EVENTS EVENT_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema EVENTS EVENT_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema EVENTS EVENT_TYPE 8 NULL NO varchar 9 27 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(9) NEVER NULL def information_schema EVENTS EXECUTE_AT 9 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL def information_schema EVENTS INTERVAL_FIELD 11 NULL YES varchar 18 54 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(18) NEVER NULL def information_schema EVENTS INTERVAL_VALUE 10 NULL YES varchar 256 768 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(256) NEVER NULL -def information_schema EVENTS LAST_ALTERED 18 '0000-00-00 00:00:00' NO datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL +def information_schema EVENTS LAST_ALTERED 18 NULL NO datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL def information_schema EVENTS LAST_EXECUTED 19 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL -def information_schema EVENTS ON_COMPLETION 16 '' NO varchar 12 36 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(12) NEVER NULL -def information_schema EVENTS ORIGINATOR 21 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(10) NEVER NULL -def information_schema EVENTS SQL_MODE 12 '' NO varchar 8192 24576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8192) NEVER NULL +def information_schema EVENTS ON_COMPLETION 16 NULL NO varchar 12 36 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(12) NEVER NULL +def information_schema EVENTS ORIGINATOR 21 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(10) NEVER NULL +def information_schema EVENTS SQL_MODE 12 NULL NO varchar 8192 24576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8192) NEVER NULL def information_schema EVENTS STARTS 13 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL -def information_schema EVENTS STATUS 15 '' NO varchar 18 54 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(18) NEVER NULL -def information_schema EVENTS TIME_ZONE 5 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema EVENTS STATUS 15 NULL NO varchar 18 54 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(18) NEVER NULL +def information_schema EVENTS TIME_ZONE 5 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema FILES AUTOEXTEND_SIZE 19 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema FILES AVG_ROW_LENGTH 28 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema FILES CHECKSUM 36 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL @@ -132,12 +132,12 @@ def information_schema FILES CREATION_TIME 20 NULL YES datetime NULL NULL NULL N def information_schema FILES DATA_FREE 32 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema FILES DATA_LENGTH 29 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema FILES DELETED_ROWS 12 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(4) NEVER NULL -def information_schema FILES ENGINE 10 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema FILES EXTENT_SIZE 16 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) NEVER NULL +def information_schema FILES ENGINE 10 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema FILES EXTENT_SIZE 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) NEVER NULL def information_schema FILES EXTRA 38 NULL YES varchar 255 765 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(255) NEVER NULL -def information_schema FILES FILE_ID 1 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) NEVER NULL +def information_schema FILES FILE_ID 1 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) NEVER NULL def information_schema FILES FILE_NAME 2 NULL YES varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema FILES FILE_TYPE 3 '' NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) NEVER NULL +def information_schema FILES FILE_TYPE 3 NULL NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) NEVER NULL def information_schema FILES FREE_EXTENTS 14 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(4) NEVER NULL def information_schema FILES FULLTEXT_KEYS 11 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema FILES INDEX_LENGTH 31 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL @@ -150,9 +150,9 @@ def information_schema FILES MAXIMUM_SIZE 18 NULL YES bigint NULL NULL 20 0 NULL def information_schema FILES MAX_DATA_LENGTH 30 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema FILES RECOVER_TIME 23 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(4) NEVER NULL def information_schema FILES ROW_FORMAT 26 NULL YES varchar 10 30 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(10) NEVER NULL -def information_schema FILES STATUS 37 '' NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) NEVER NULL +def information_schema FILES STATUS 37 NULL NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) NEVER NULL def information_schema FILES TABLESPACE_NAME 4 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema FILES TABLE_CATALOG 5 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema FILES TABLE_CATALOG 5 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema FILES TABLE_NAME 7 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema FILES TABLE_ROWS 27 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema FILES TABLE_SCHEMA 6 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL @@ -161,82 +161,82 @@ def information_schema FILES TRANSACTION_COUNTER 24 NULL YES bigint NULL NULL 19 def information_schema FILES UPDATE_COUNT 13 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(4) NEVER NULL def information_schema FILES UPDATE_TIME 34 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL def information_schema FILES VERSION 25 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema GEOMETRY_COLUMNS COORD_DIMENSION 11 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) NEVER NULL -def information_schema GEOMETRY_COLUMNS F_GEOMETRY_COLUMN 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema GEOMETRY_COLUMNS F_TABLE_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema GEOMETRY_COLUMNS F_TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema GEOMETRY_COLUMNS F_TABLE_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema GEOMETRY_COLUMNS GEOMETRY_TYPE 10 0 NO int NULL NULL 10 0 NULL NULL NULL int(7) NEVER NULL -def information_schema GEOMETRY_COLUMNS G_GEOMETRY_COLUMN 8 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema GEOMETRY_COLUMNS G_TABLE_CATALOG 5 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema GEOMETRY_COLUMNS G_TABLE_NAME 7 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema GEOMETRY_COLUMNS G_TABLE_SCHEMA 6 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema GEOMETRY_COLUMNS MAX_PPR 12 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) NEVER NULL -def information_schema GEOMETRY_COLUMNS SRID 13 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) NEVER NULL -def information_schema GEOMETRY_COLUMNS STORAGE_TYPE 9 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) NEVER NULL -def information_schema GLOBAL_STATUS VARIABLE_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 '' NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL -def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 '' NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL -def information_schema INDEX_STATISTICS INDEX_NAME 3 '' NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) NEVER NULL -def information_schema INDEX_STATISTICS ROWS_READ 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema INDEX_STATISTICS TABLE_NAME 2 '' NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) NEVER NULL -def information_schema INDEX_STATISTICS TABLE_SCHEMA 1 '' NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) NEVER NULL +def information_schema GEOMETRY_COLUMNS COORD_DIMENSION 11 NULL NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) NEVER NULL +def information_schema GEOMETRY_COLUMNS F_GEOMETRY_COLUMN 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema GEOMETRY_COLUMNS F_TABLE_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema GEOMETRY_COLUMNS F_TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema GEOMETRY_COLUMNS F_TABLE_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema GEOMETRY_COLUMNS GEOMETRY_TYPE 10 NULL NO int NULL NULL 10 0 NULL NULL NULL int(7) NEVER NULL +def information_schema GEOMETRY_COLUMNS G_GEOMETRY_COLUMN 8 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema GEOMETRY_COLUMNS G_TABLE_CATALOG 5 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema GEOMETRY_COLUMNS G_TABLE_NAME 7 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema GEOMETRY_COLUMNS G_TABLE_SCHEMA 6 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema GEOMETRY_COLUMNS MAX_PPR 12 NULL NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) NEVER NULL +def information_schema GEOMETRY_COLUMNS SRID 13 NULL NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) NEVER NULL +def information_schema GEOMETRY_COLUMNS STORAGE_TYPE 9 NULL NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) NEVER NULL +def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL +def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL +def information_schema INDEX_STATISTICS INDEX_NAME 3 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) NEVER NULL +def information_schema INDEX_STATISTICS ROWS_READ 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema INDEX_STATISTICS TABLE_NAME 2 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) NEVER NULL +def information_schema INDEX_STATISTICS TABLE_SCHEMA 1 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) NEVER NULL def information_schema KEYWORDS WORD 1 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema KEY_CACHES BLOCK_SIZE 5 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema KEY_CACHES DIRTY_BLOCKS 8 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema KEY_CACHES FULL_SIZE 4 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema KEY_CACHES KEY_CACHE_NAME 1 '' NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) NEVER NULL -def information_schema KEY_CACHES READS 10 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema KEY_CACHES READ_REQUESTS 9 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema KEY_CACHES BLOCK_SIZE 5 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema KEY_CACHES DIRTY_BLOCKS 8 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema KEY_CACHES FULL_SIZE 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema KEY_CACHES KEY_CACHE_NAME 1 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) NEVER NULL +def information_schema KEY_CACHES READS 10 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema KEY_CACHES READ_REQUESTS 9 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema KEY_CACHES SEGMENTS 2 NULL YES int NULL NULL 10 0 NULL NULL NULL int(3) unsigned NEVER NULL def information_schema KEY_CACHES SEGMENT_NUMBER 3 NULL YES int NULL NULL 10 0 NULL NULL NULL int(3) unsigned NEVER NULL -def information_schema KEY_CACHES UNUSED_BLOCKS 7 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema KEY_CACHES USED_BLOCKS 6 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema KEY_CACHES WRITES 12 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema KEY_CACHES WRITE_REQUESTS 11 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema KEY_COLUMN_USAGE COLUMN_NAME 7 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema KEY_COLUMN_USAGE CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema KEY_COLUMN_USAGE CONSTRAINT_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema KEY_COLUMN_USAGE CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema KEY_COLUMN_USAGE ORDINAL_POSITION 8 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(10) NEVER NULL +def information_schema KEY_CACHES UNUSED_BLOCKS 7 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema KEY_CACHES USED_BLOCKS 6 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema KEY_CACHES WRITES 12 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema KEY_CACHES WRITE_REQUESTS 11 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema KEY_COLUMN_USAGE COLUMN_NAME 7 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema KEY_COLUMN_USAGE CONSTRAINT_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema KEY_COLUMN_USAGE CONSTRAINT_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema KEY_COLUMN_USAGE CONSTRAINT_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema KEY_COLUMN_USAGE ORDINAL_POSITION 8 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(10) NEVER NULL def information_schema KEY_COLUMN_USAGE POSITION_IN_UNIQUE_CONSTRAINT 9 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(10) NEVER NULL def information_schema KEY_COLUMN_USAGE REFERENCED_COLUMN_NAME 12 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema KEY_COLUMN_USAGE REFERENCED_TABLE_NAME 11 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema KEY_COLUMN_USAGE REFERENCED_TABLE_SCHEMA 10 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema KEY_COLUMN_USAGE TABLE_CATALOG 4 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema KEY_COLUMN_USAGE TABLE_NAME 6 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema KEY_COLUMN_USAGE TABLE_SCHEMA 5 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema OPTIMIZER_TRACE INSUFFICIENT_PRIVILEGES 4 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) NEVER NULL -def information_schema OPTIMIZER_TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE 3 0 NO int NULL NULL 10 0 NULL NULL NULL int(20) NEVER NULL -def information_schema OPTIMIZER_TRACE QUERY 1 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL -def information_schema OPTIMIZER_TRACE TRACE 2 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL +def information_schema KEY_COLUMN_USAGE TABLE_CATALOG 4 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema KEY_COLUMN_USAGE TABLE_NAME 6 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema KEY_COLUMN_USAGE TABLE_SCHEMA 5 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema OPTIMIZER_TRACE INSUFFICIENT_PRIVILEGES 4 NULL NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) NEVER NULL +def information_schema OPTIMIZER_TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(20) NEVER NULL +def information_schema OPTIMIZER_TRACE QUERY 1 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL +def information_schema OPTIMIZER_TRACE TRACE 2 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL def information_schema PARAMETERS CHARACTER_MAXIMUM_LENGTH 8 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) NEVER NULL def information_schema PARAMETERS CHARACTER_OCTET_LENGTH 9 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) NEVER NULL def information_schema PARAMETERS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema PARAMETERS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema PARAMETERS DATA_TYPE 7 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema PARAMETERS DATA_TYPE 7 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema PARAMETERS DATETIME_PRECISION 12 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema PARAMETERS DTD_IDENTIFIER 15 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL +def information_schema PARAMETERS DTD_IDENTIFIER 15 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL def information_schema PARAMETERS NUMERIC_PRECISION 10 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) NEVER NULL def information_schema PARAMETERS NUMERIC_SCALE 11 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) NEVER NULL -def information_schema PARAMETERS ORDINAL_POSITION 4 0 NO int NULL NULL 10 0 NULL NULL NULL int(21) NEVER NULL +def information_schema PARAMETERS ORDINAL_POSITION 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(21) NEVER NULL def information_schema PARAMETERS PARAMETER_MODE 5 NULL YES varchar 5 15 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(5) NEVER NULL def information_schema PARAMETERS PARAMETER_NAME 6 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema PARAMETERS ROUTINE_TYPE 16 '' NO varchar 9 27 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(9) NEVER NULL -def information_schema PARAMETERS SPECIFIC_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema PARAMETERS SPECIFIC_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema PARAMETERS SPECIFIC_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema PARTITIONS AVG_ROW_LENGTH 14 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema PARAMETERS ROUTINE_TYPE 16 NULL NO varchar 9 27 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(9) NEVER NULL +def information_schema PARAMETERS SPECIFIC_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema PARAMETERS SPECIFIC_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema PARAMETERS SPECIFIC_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema PARTITIONS AVG_ROW_LENGTH 14 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema PARTITIONS CHECKSUM 22 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema PARTITIONS CHECK_TIME 21 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL def information_schema PARTITIONS CREATE_TIME 19 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL -def information_schema PARTITIONS DATA_FREE 18 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema PARTITIONS DATA_LENGTH 15 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema PARTITIONS INDEX_LENGTH 17 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema PARTITIONS DATA_FREE 18 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema PARTITIONS DATA_LENGTH 15 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema PARTITIONS INDEX_LENGTH 17 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema PARTITIONS MAX_DATA_LENGTH 16 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema PARTITIONS NODEGROUP 24 '' NO varchar 12 36 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(12) NEVER NULL -def information_schema PARTITIONS PARTITION_COMMENT 23 '' NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) NEVER NULL +def information_schema PARTITIONS NODEGROUP 24 NULL NO varchar 12 36 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(12) NEVER NULL +def information_schema PARTITIONS PARTITION_COMMENT 23 NULL NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) NEVER NULL def information_schema PARTITIONS PARTITION_DESCRIPTION 12 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL def information_schema PARTITIONS PARTITION_EXPRESSION 10 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL def information_schema PARTITIONS PARTITION_METHOD 8 NULL YES varchar 18 54 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(18) NEVER NULL @@ -247,136 +247,136 @@ def information_schema PARTITIONS SUBPARTITION_METHOD 9 NULL YES varchar 12 36 N def information_schema PARTITIONS SUBPARTITION_NAME 5 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema PARTITIONS SUBPARTITION_ORDINAL_POSITION 7 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema PARTITIONS TABLESPACE_NAME 25 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema PARTITIONS TABLE_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema PARTITIONS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema PARTITIONS TABLE_ROWS 13 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema PARTITIONS TABLE_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema PARTITIONS TABLE_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema PARTITIONS TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema PARTITIONS TABLE_ROWS 13 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema PARTITIONS TABLE_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema PARTITIONS UPDATE_TIME 20 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL -def information_schema PLUGINS LOAD_OPTION 11 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema PLUGINS LOAD_OPTION 11 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema PLUGINS PLUGIN_AUTHOR 8 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema PLUGINS PLUGIN_AUTH_VERSION 13 NULL YES varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) NEVER NULL def information_schema PLUGINS PLUGIN_DESCRIPTION 9 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL def information_schema PLUGINS PLUGIN_LIBRARY 6 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema PLUGINS PLUGIN_LIBRARY_VERSION 7 NULL YES varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) NEVER NULL -def information_schema PLUGINS PLUGIN_LICENSE 10 '' NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) NEVER NULL -def information_schema PLUGINS PLUGIN_MATURITY 12 '' NO varchar 12 36 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(12) NEVER NULL -def information_schema PLUGINS PLUGIN_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema PLUGINS PLUGIN_STATUS 3 '' NO varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) NEVER NULL -def information_schema PLUGINS PLUGIN_TYPE 4 '' NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) NEVER NULL -def information_schema PLUGINS PLUGIN_TYPE_VERSION 5 '' NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) NEVER NULL -def information_schema PLUGINS PLUGIN_VERSION 2 '' NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) NEVER NULL -def information_schema PROCESSLIST COMMAND 5 '' NO varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) NEVER NULL +def information_schema PLUGINS PLUGIN_LICENSE 10 NULL NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) NEVER NULL +def information_schema PLUGINS PLUGIN_MATURITY 12 NULL NO varchar 12 36 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(12) NEVER NULL +def information_schema PLUGINS PLUGIN_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema PLUGINS PLUGIN_STATUS 3 NULL NO varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) NEVER NULL +def information_schema PLUGINS PLUGIN_TYPE 4 NULL NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) NEVER NULL +def information_schema PLUGINS PLUGIN_TYPE_VERSION 5 NULL NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) NEVER NULL +def information_schema PLUGINS PLUGIN_VERSION 2 NULL NO varchar 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) NEVER NULL +def information_schema PROCESSLIST COMMAND 5 NULL NO varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) NEVER NULL def information_schema PROCESSLIST DB 4 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema PROCESSLIST EXAMINED_ROWS 15 0 NO int NULL NULL 10 0 NULL NULL NULL int(7) NEVER NULL -def information_schema PROCESSLIST HOST 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema PROCESSLIST ID 1 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) NEVER NULL +def information_schema PROCESSLIST EXAMINED_ROWS 15 NULL NO int NULL NULL 10 0 NULL NULL NULL int(7) NEVER NULL +def information_schema PROCESSLIST HOST 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema PROCESSLIST ID 1 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) NEVER NULL def information_schema PROCESSLIST INFO 8 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL def information_schema PROCESSLIST INFO_BINARY 17 NULL YES blob 65535 65535 NULL NULL NULL NULL NULL blob NEVER NULL -def information_schema PROCESSLIST MAX_MEMORY_USED 14 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(7) NEVER NULL -def information_schema PROCESSLIST MAX_STAGE 11 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) NEVER NULL -def information_schema PROCESSLIST MEMORY_USED 13 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(7) NEVER NULL -def information_schema PROCESSLIST PROGRESS 12 0.000 NO decimal NULL NULL 7 3 NULL NULL NULL decimal(7,3) NEVER NULL -def information_schema PROCESSLIST QUERY_ID 16 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) NEVER NULL -def information_schema PROCESSLIST STAGE 10 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) NEVER NULL +def information_schema PROCESSLIST MAX_MEMORY_USED 14 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(7) NEVER NULL +def information_schema PROCESSLIST MAX_STAGE 11 NULL NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) NEVER NULL +def information_schema PROCESSLIST MEMORY_USED 13 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(7) NEVER NULL +def information_schema PROCESSLIST PROGRESS 12 NULL NO decimal NULL NULL 7 3 NULL NULL NULL decimal(7,3) NEVER NULL +def information_schema PROCESSLIST QUERY_ID 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) NEVER NULL +def information_schema PROCESSLIST STAGE 10 NULL NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) NEVER NULL def information_schema PROCESSLIST STATE 7 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema PROCESSLIST TID 18 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) NEVER NULL -def information_schema PROCESSLIST TIME 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(7) NEVER NULL -def information_schema PROCESSLIST TIME_MS 9 0.000 NO decimal NULL NULL 22 3 NULL NULL NULL decimal(22,3) NEVER NULL -def information_schema PROCESSLIST USER 2 '' NO varchar 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(128) NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS DELETE_RULE 9 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS MATCH_OPTION 7 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS REFERENCED_TABLE_NAME 11 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS TABLE_NAME 10 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_CATALOG 4 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema PROCESSLIST TID 18 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) NEVER NULL +def information_schema PROCESSLIST TIME 6 NULL NO int NULL NULL 10 0 NULL NULL NULL int(7) NEVER NULL +def information_schema PROCESSLIST TIME_MS 9 NULL NO decimal NULL NULL 22 3 NULL NULL NULL decimal(22,3) NEVER NULL +def information_schema PROCESSLIST USER 2 NULL NO varchar 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(128) NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS DELETE_RULE 9 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS MATCH_OPTION 7 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS REFERENCED_TABLE_NAME 11 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS TABLE_NAME 10 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_CATALOG 4 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL def information_schema REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_NAME 6 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_SCHEMA 5 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema REFERENTIAL_CONSTRAINTS UPDATE_RULE 8 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_SCHEMA 5 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema REFERENTIAL_CONSTRAINTS UPDATE_RULE 8 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema ROUTINES CHARACTER_MAXIMUM_LENGTH 7 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) NEVER NULL def information_schema ROUTINES CHARACTER_OCTET_LENGTH 8 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) NEVER NULL -def information_schema ROUTINES CHARACTER_SET_CLIENT 29 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema ROUTINES CHARACTER_SET_CLIENT 29 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL def information_schema ROUTINES CHARACTER_SET_NAME 12 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema ROUTINES COLLATION_CONNECTION 30 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema ROUTINES COLLATION_CONNECTION 30 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL def information_schema ROUTINES COLLATION_NAME 13 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema ROUTINES CREATED 24 '0000-00-00 00:00:00' NO datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL -def information_schema ROUTINES DATABASE_COLLATION 31 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema ROUTINES DATA_TYPE 6 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema ROUTINES CREATED 24 NULL NO datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL +def information_schema ROUTINES DATABASE_COLLATION 31 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema ROUTINES DATA_TYPE 6 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema ROUTINES DATETIME_PRECISION 11 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema ROUTINES DEFINER 28 '' NO varchar 384 1152 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(384) NEVER NULL +def information_schema ROUTINES DEFINER 28 NULL NO varchar 384 1152 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(384) NEVER NULL def information_schema ROUTINES DTD_IDENTIFIER 14 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL def information_schema ROUTINES EXTERNAL_LANGUAGE 18 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema ROUTINES EXTERNAL_NAME 17 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema ROUTINES IS_DETERMINISTIC 20 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL -def information_schema ROUTINES LAST_ALTERED 25 '0000-00-00 00:00:00' NO datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL +def information_schema ROUTINES IS_DETERMINISTIC 20 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL +def information_schema ROUTINES LAST_ALTERED 25 NULL NO datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL def information_schema ROUTINES NUMERIC_PRECISION 9 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) NEVER NULL def information_schema ROUTINES NUMERIC_SCALE 10 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) NEVER NULL -def information_schema ROUTINES PARAMETER_STYLE 19 '' NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) NEVER NULL -def information_schema ROUTINES ROUTINE_BODY 15 '' NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) NEVER NULL -def information_schema ROUTINES ROUTINE_CATALOG 2 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema ROUTINES ROUTINE_COMMENT 27 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL +def information_schema ROUTINES PARAMETER_STYLE 19 NULL NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) NEVER NULL +def information_schema ROUTINES ROUTINE_BODY 15 NULL NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) NEVER NULL +def information_schema ROUTINES ROUTINE_CATALOG 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema ROUTINES ROUTINE_COMMENT 27 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL def information_schema ROUTINES ROUTINE_DEFINITION 16 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL -def information_schema ROUTINES ROUTINE_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema ROUTINES ROUTINE_SCHEMA 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema ROUTINES ROUTINE_TYPE 5 '' NO varchar 13 39 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(13) NEVER NULL -def information_schema ROUTINES SECURITY_TYPE 23 '' NO varchar 7 21 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(7) NEVER NULL -def information_schema ROUTINES SPECIFIC_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema ROUTINES SQL_DATA_ACCESS 21 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema ROUTINES SQL_MODE 26 '' NO varchar 8192 24576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8192) NEVER NULL +def information_schema ROUTINES ROUTINE_NAME 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema ROUTINES ROUTINE_SCHEMA 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema ROUTINES ROUTINE_TYPE 5 NULL NO varchar 13 39 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(13) NEVER NULL +def information_schema ROUTINES SECURITY_TYPE 23 NULL NO varchar 7 21 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(7) NEVER NULL +def information_schema ROUTINES SPECIFIC_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema ROUTINES SQL_DATA_ACCESS 21 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema ROUTINES SQL_MODE 26 NULL NO varchar 8192 24576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8192) NEVER NULL def information_schema ROUTINES SQL_PATH 22 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema SCHEMATA CATALOG_NAME 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME 3 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema SCHEMATA DEFAULT_COLLATION_NAME 4 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema SCHEMATA SCHEMA_COMMENT 6 '' NO varchar 1024 3072 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1024) NEVER NULL -def information_schema SCHEMATA SCHEMA_NAME 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema SCHEMATA CATALOG_NAME 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME 3 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema SCHEMATA DEFAULT_COLLATION_NAME 4 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema SCHEMATA SCHEMA_COMMENT 6 NULL NO varchar 1024 3072 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1024) NEVER NULL +def information_schema SCHEMATA SCHEMA_NAME 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema SCHEMATA SQL_PATH 5 NULL YES varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema SCHEMA_PRIVILEGES GRANTEE 1 '' NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) NEVER NULL -def information_schema SCHEMA_PRIVILEGES IS_GRANTABLE 5 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL -def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema SESSION_STATUS VARIABLE_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema SESSION_STATUS VARIABLE_VALUE 2 '' NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL -def information_schema SESSION_VARIABLES VARIABLE_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 '' NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL -def information_schema SPATIAL_REF_SYS AUTH_NAME 2 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema SPATIAL_REF_SYS AUTH_SRID 3 0 NO int NULL NULL 10 0 NULL NULL NULL int(5) NEVER NULL -def information_schema SPATIAL_REF_SYS SRID 1 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) NEVER NULL -def information_schema SPATIAL_REF_SYS SRTEXT 4 '' NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL +def information_schema SCHEMA_PRIVILEGES GRANTEE 1 NULL NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) NEVER NULL +def information_schema SCHEMA_PRIVILEGES IS_GRANTABLE 5 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL +def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema SESSION_STATUS VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema SESSION_STATUS VARIABLE_VALUE 2 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL +def information_schema SESSION_VARIABLES VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL +def information_schema SPATIAL_REF_SYS AUTH_NAME 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema SPATIAL_REF_SYS AUTH_SRID 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(5) NEVER NULL +def information_schema SPATIAL_REF_SYS SRID 1 NULL NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) NEVER NULL +def information_schema SPATIAL_REF_SYS SRTEXT 4 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL def information_schema SQL_FUNCTIONS FUNCTION 1 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema STATISTICS CARDINALITY 10 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL def information_schema STATISTICS COLLATION 9 NULL YES varchar 1 3 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1) NEVER NULL -def information_schema STATISTICS COLUMN_NAME 8 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema STATISTICS COLUMN_NAME 8 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema STATISTICS COMMENT 15 NULL YES varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) NEVER NULL -def information_schema STATISTICS IGNORED 17 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL -def information_schema STATISTICS INDEX_COMMENT 16 '' NO varchar 1024 3072 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1024) NEVER NULL -def information_schema STATISTICS INDEX_NAME 6 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema STATISTICS INDEX_SCHEMA 5 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema STATISTICS INDEX_TYPE 14 '' NO varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) NEVER NULL -def information_schema STATISTICS NON_UNIQUE 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(1) NEVER NULL -def information_schema STATISTICS NULLABLE 13 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL +def information_schema STATISTICS IGNORED 17 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL +def information_schema STATISTICS INDEX_COMMENT 16 NULL NO varchar 1024 3072 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1024) NEVER NULL +def information_schema STATISTICS INDEX_NAME 6 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema STATISTICS INDEX_SCHEMA 5 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema STATISTICS INDEX_TYPE 14 NULL NO varchar 16 48 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(16) NEVER NULL +def information_schema STATISTICS NON_UNIQUE 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(1) NEVER NULL +def information_schema STATISTICS NULLABLE 13 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL def information_schema STATISTICS PACKED 12 NULL YES varchar 10 30 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(10) NEVER NULL -def information_schema STATISTICS SEQ_IN_INDEX 7 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(2) NEVER NULL +def information_schema STATISTICS SEQ_IN_INDEX 7 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(2) NEVER NULL def information_schema STATISTICS SUB_PART 11 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(3) NEVER NULL -def information_schema STATISTICS TABLE_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema STATISTICS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema STATISTICS TABLE_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema STATISTICS TABLE_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema STATISTICS TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema STATISTICS TABLE_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema SYSTEM_VARIABLES COMMAND_LINE_ARGUMENT 14 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL def information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST 12 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL -def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_PATH 15 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL def information_schema SYSTEM_VARIABLES NUMERIC_BLOCK_SIZE 11 NULL YES varchar 21 63 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(21) NEVER NULL def information_schema SYSTEM_VARIABLES NUMERIC_MAX_VALUE 10 NULL YES varchar 21 63 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(21) NEVER NULL def information_schema SYSTEM_VARIABLES NUMERIC_MIN_VALUE 9 NULL YES varchar 21 63 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(21) NEVER NULL -def information_schema SYSTEM_VARIABLES READ_ONLY 13 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL +def information_schema SYSTEM_VARIABLES READ_ONLY 13 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL def information_schema SYSTEM_VARIABLES SESSION_VALUE 2 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL -def information_schema SYSTEM_VARIABLES VARIABLE_COMMENT 8 '' NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL -def information_schema SYSTEM_VARIABLES VARIABLE_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema SYSTEM_VARIABLES VARIABLE_SCOPE 6 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema SYSTEM_VARIABLES VARIABLE_TYPE 7 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema SYSTEM_VARIABLES VARIABLE_COMMENT 8 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL +def information_schema SYSTEM_VARIABLES VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema SYSTEM_VARIABLES VARIABLE_SCOPE 6 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema SYSTEM_VARIABLES VARIABLE_TYPE 7 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL @@ -390,104 +390,104 @@ def information_schema TABLES INDEX_LENGTH 12 NULL YES bigint NULL NULL 20 0 NUL def information_schema TABLES MAX_DATA_LENGTH 11 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema TABLES MAX_INDEX_LENGTH 22 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema TABLES ROW_FORMAT 7 NULL YES varchar 10 30 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(10) NEVER NULL -def information_schema TABLES TABLE_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema TABLES TABLE_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL def information_schema TABLES TABLE_COLLATION 18 NULL YES varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema TABLES TABLE_COMMENT 21 '' NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL -def information_schema TABLES TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema TABLES TABLE_COMMENT 21 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL +def information_schema TABLES TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema TABLES TABLE_ROWS 8 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema TABLES TABLE_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema TABLES TABLE_TYPE 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema TABLES TABLE_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema TABLES TABLE_TYPE 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema TABLES TEMPORARY 23 NULL YES varchar 1 3 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1) NEVER NULL def information_schema TABLES UPDATE_TIME 16 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL def information_schema TABLES VERSION 6 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema TABLESPACES AUTOEXTEND_SIZE 6 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema TABLESPACES ENGINE 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema TABLESPACES ENGINE 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema TABLESPACES EXTENT_SIZE 5 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema TABLESPACES LOGFILE_GROUP_NAME 4 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema TABLESPACES MAXIMUM_SIZE 7 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema TABLESPACES NODEGROUP_ID 8 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def information_schema TABLESPACES TABLESPACE_COMMENT 9 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL -def information_schema TABLESPACES TABLESPACE_NAME 1 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema TABLESPACES TABLESPACE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL def information_schema TABLESPACES TABLESPACE_TYPE 3 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema TABLE_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema TABLE_CONSTRAINTS CONSTRAINT_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema TABLE_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema TABLE_CONSTRAINTS CONSTRAINT_TYPE 6 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema TABLE_CONSTRAINTS TABLE_NAME 5 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema TABLE_CONSTRAINTS TABLE_SCHEMA 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema TABLE_PRIVILEGES GRANTEE 1 '' NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) NEVER NULL -def information_schema TABLE_PRIVILEGES IS_GRANTABLE 6 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL -def information_schema TABLE_PRIVILEGES PRIVILEGE_TYPE 5 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema TABLE_PRIVILEGES TABLE_CATALOG 2 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema TABLE_PRIVILEGES TABLE_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema TABLE_PRIVILEGES TABLE_SCHEMA 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema TABLE_STATISTICS ROWS_CHANGED 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema TABLE_STATISTICS ROWS_CHANGED_X_INDEXES 5 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema TABLE_STATISTICS ROWS_READ 3 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema TABLE_STATISTICS TABLE_NAME 2 '' NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) NEVER NULL -def information_schema TABLE_STATISTICS TABLE_SCHEMA 1 '' NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) NEVER NULL +def information_schema TABLE_CONSTRAINTS CONSTRAINT_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema TABLE_CONSTRAINTS CONSTRAINT_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema TABLE_CONSTRAINTS CONSTRAINT_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema TABLE_CONSTRAINTS CONSTRAINT_TYPE 6 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema TABLE_CONSTRAINTS TABLE_NAME 5 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema TABLE_CONSTRAINTS TABLE_SCHEMA 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema TABLE_PRIVILEGES GRANTEE 1 NULL NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) NEVER NULL +def information_schema TABLE_PRIVILEGES IS_GRANTABLE 6 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL +def information_schema TABLE_PRIVILEGES PRIVILEGE_TYPE 5 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema TABLE_PRIVILEGES TABLE_CATALOG 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema TABLE_PRIVILEGES TABLE_NAME 4 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema TABLE_PRIVILEGES TABLE_SCHEMA 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema TABLE_STATISTICS ROWS_CHANGED 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema TABLE_STATISTICS ROWS_CHANGED_X_INDEXES 5 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema TABLE_STATISTICS ROWS_READ 3 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema TABLE_STATISTICS TABLE_NAME 2 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) NEVER NULL +def information_schema TABLE_STATISTICS TABLE_SCHEMA 1 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) NEVER NULL def information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL -def information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) NEVER NULL -def information_schema TRIGGERS ACTION_ORIENTATION 11 '' NO varchar 9 27 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(9) NEVER NULL -def information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL +def information_schema TRIGGERS ACTION_ORDER 8 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) NEVER NULL +def information_schema TRIGGERS ACTION_ORIENTATION 11 NULL NO varchar 9 27 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(9) NEVER NULL +def information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL def information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL +def information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL def information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema TRIGGERS ACTION_STATEMENT 10 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL -def information_schema TRIGGERS ACTION_TIMING 12 '' NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) NEVER NULL -def information_schema TRIGGERS CHARACTER_SET_CLIENT 20 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema TRIGGERS COLLATION_CONNECTION 21 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL +def information_schema TRIGGERS ACTION_TIMING 12 NULL NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) NEVER NULL +def information_schema TRIGGERS CHARACTER_SET_CLIENT 20 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema TRIGGERS COLLATION_CONNECTION 21 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL def information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL 2 NULL NULL datetime(2) NEVER NULL -def information_schema TRIGGERS DATABASE_COLLATION 22 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema TRIGGERS DEFINER 19 '' NO varchar 384 1152 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(384) NEVER NULL -def information_schema TRIGGERS EVENT_MANIPULATION 4 '' NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) NEVER NULL -def information_schema TRIGGERS EVENT_OBJECT_CATALOG 5 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema TRIGGERS EVENT_OBJECT_TABLE 7 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema TRIGGERS SQL_MODE 18 '' NO varchar 8192 24576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8192) NEVER NULL -def information_schema TRIGGERS TRIGGER_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema TRIGGERS TRIGGER_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema TRIGGERS TRIGGER_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema USER_PRIVILEGES GRANTEE 1 '' NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) NEVER NULL -def information_schema USER_PRIVILEGES IS_GRANTABLE 4 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL -def information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema USER_PRIVILEGES TABLE_CATALOG 2 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema USER_STATISTICS ACCESS_DENIED 22 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS BINLOG_BYTES_WRITTEN 9 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS BUSY_TIME 5 0 NO double NULL NULL 21 NULL NULL NULL NULL double NEVER NULL -def information_schema USER_STATISTICS BYTES_RECEIVED 7 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS BYTES_SENT 8 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS COMMIT_TRANSACTIONS 18 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS CONCURRENT_CONNECTIONS 3 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) NEVER NULL -def information_schema USER_STATISTICS CONNECTED_TIME 4 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) NEVER NULL -def information_schema USER_STATISTICS CPU_TIME 6 0 NO double NULL NULL 21 NULL NULL NULL NULL double NEVER NULL -def information_schema USER_STATISTICS DENIED_CONNECTIONS 20 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS EMPTY_QUERIES 23 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS LOST_CONNECTIONS 21 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 25 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS OTHER_COMMANDS 17 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS ROLLBACK_TRANSACTIONS 19 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS ROWS_DELETED 12 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS ROWS_INSERTED 13 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS ROWS_READ 10 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS ROWS_SENT 11 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS ROWS_UPDATED 14 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS SELECT_COMMANDS 15 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS TOTAL_CONNECTIONS 2 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) NEVER NULL -def information_schema USER_STATISTICS TOTAL_SSL_CONNECTIONS 24 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL -def information_schema USER_STATISTICS UPDATE_COMMANDS 16 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL -def information_schema USER_STATISTICS USER 1 '' NO varchar 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(128) NEVER NULL -def information_schema VIEWS ALGORITHM 11 '' NO varchar 10 30 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(10) NEVER NULL -def information_schema VIEWS CHARACTER_SET_CLIENT 9 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema VIEWS CHECK_OPTION 5 '' NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) NEVER NULL -def information_schema VIEWS COLLATION_CONNECTION 10 '' NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL -def information_schema VIEWS DEFINER 7 '' NO varchar 384 1152 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(384) NEVER NULL -def information_schema VIEWS IS_UPDATABLE 6 '' NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL -def information_schema VIEWS SECURITY_TYPE 8 '' NO varchar 7 21 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(7) NEVER NULL -def information_schema VIEWS TABLE_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL -def information_schema VIEWS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema VIEWS TABLE_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL -def information_schema VIEWS VIEW_DEFINITION 4 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL +def information_schema TRIGGERS DATABASE_COLLATION 22 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema TRIGGERS DEFINER 19 NULL NO varchar 384 1152 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(384) NEVER NULL +def information_schema TRIGGERS EVENT_MANIPULATION 4 NULL NO varchar 6 18 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(6) NEVER NULL +def information_schema TRIGGERS EVENT_OBJECT_CATALOG 5 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema TRIGGERS SQL_MODE 18 NULL NO varchar 8192 24576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8192) NEVER NULL +def information_schema TRIGGERS TRIGGER_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema TRIGGERS TRIGGER_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema TRIGGERS TRIGGER_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema USER_PRIVILEGES GRANTEE 1 NULL NO varchar 385 1155 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(385) NEVER NULL +def information_schema USER_PRIVILEGES IS_GRANTABLE 4 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL +def information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema USER_STATISTICS ACCESS_DENIED 22 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS BINLOG_BYTES_WRITTEN 9 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS BUSY_TIME 5 NULL NO double NULL NULL 21 NULL NULL NULL NULL double NEVER NULL +def information_schema USER_STATISTICS BYTES_RECEIVED 7 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS BYTES_SENT 8 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS COMMIT_TRANSACTIONS 18 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS CONCURRENT_CONNECTIONS 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) NEVER NULL +def information_schema USER_STATISTICS CONNECTED_TIME 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) NEVER NULL +def information_schema USER_STATISTICS CPU_TIME 6 NULL NO double NULL NULL 21 NULL NULL NULL NULL double NEVER NULL +def information_schema USER_STATISTICS DENIED_CONNECTIONS 20 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS EMPTY_QUERIES 23 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS LOST_CONNECTIONS 21 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 25 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS OTHER_COMMANDS 17 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS ROLLBACK_TRANSACTIONS 19 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS ROWS_DELETED 12 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS ROWS_INSERTED 13 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS ROWS_READ 10 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS ROWS_SENT 11 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS ROWS_UPDATED 14 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS SELECT_COMMANDS 15 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS TOTAL_CONNECTIONS 2 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) NEVER NULL +def information_schema USER_STATISTICS TOTAL_SSL_CONNECTIONS 24 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL +def information_schema USER_STATISTICS UPDATE_COMMANDS 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def information_schema USER_STATISTICS USER 1 NULL NO varchar 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(128) NEVER NULL +def information_schema VIEWS ALGORITHM 11 NULL NO varchar 10 30 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(10) NEVER NULL +def information_schema VIEWS CHARACTER_SET_CLIENT 9 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema VIEWS CHECK_OPTION 5 NULL NO varchar 8 24 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(8) NEVER NULL +def information_schema VIEWS COLLATION_CONNECTION 10 NULL NO varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL +def information_schema VIEWS DEFINER 7 NULL NO varchar 384 1152 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(384) NEVER NULL +def information_schema VIEWS IS_UPDATABLE 6 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL +def information_schema VIEWS SECURITY_TYPE 8 NULL NO varchar 7 21 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(7) NEVER NULL +def information_schema VIEWS TABLE_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL +def information_schema VIEWS TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema VIEWS TABLE_SCHEMA 2 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL +def information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb3 utf8mb3_general_ci longtext NEVER NULL ########################################################################## # Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH ########################################################################## @@ -628,7 +628,7 @@ NULL information_schema COLUMNS DATETIME_PRECISION bigint NULL NULL NULL NULL bi 3.0000 information_schema COLUMNS COLLATION_NAME varchar 32 96 utf8mb3 utf8mb3_general_ci varchar(32) 1.0000 information_schema COLUMNS COLUMN_TYPE longtext 4294967295 4294967295 utf8mb3 utf8mb3_general_ci longtext 3.0000 information_schema COLUMNS COLUMN_KEY varchar 3 9 utf8mb3 utf8mb3_general_ci varchar(3) -3.0000 information_schema COLUMNS EXTRA varchar 30 90 utf8mb3 utf8mb3_general_ci varchar(30) +3.0000 information_schema COLUMNS EXTRA varchar 80 240 utf8mb3 utf8mb3_general_ci varchar(80) 3.0000 information_schema COLUMNS PRIVILEGES varchar 80 240 utf8mb3 utf8mb3_general_ci varchar(80) 3.0000 information_schema COLUMNS COLUMN_COMMENT varchar 1024 3072 utf8mb3 utf8mb3_general_ci varchar(1024) 3.0000 information_schema COLUMNS IS_GENERATED varchar 6 18 utf8mb3 utf8mb3_general_ci varchar(6) diff --git a/mysql-test/suite/funcs_1/r/is_engines.result b/mysql-test/suite/funcs_1/r/is_engines.result index 96db819c4291e..ad774caa11fe5 100644 --- a/mysql-test/suite/funcs_1/r/is_engines.result +++ b/mysql-test/suite/funcs_1/r/is_engines.result @@ -28,27 +28,27 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.ENGINES; Field Type Null Key Default Extra -ENGINE varchar(64) NO -SUPPORT varchar(8) NO -COMMENT varchar(160) NO +ENGINE varchar(64) NO NULL +SUPPORT varchar(8) NO NULL +COMMENT varchar(160) NO NULL TRANSACTIONS varchar(3) YES NULL XA varchar(3) YES NULL SAVEPOINTS varchar(3) YES NULL SHOW CREATE TABLE information_schema.ENGINES; Table Create Table ENGINES CREATE TEMPORARY TABLE `ENGINES` ( - `ENGINE` varchar(64) NOT NULL DEFAULT '', - `SUPPORT` varchar(8) NOT NULL DEFAULT '', - `COMMENT` varchar(160) NOT NULL DEFAULT '', - `TRANSACTIONS` varchar(3) DEFAULT NULL, - `XA` varchar(3) DEFAULT NULL, - `SAVEPOINTS` varchar(3) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `ENGINE` varchar(64) NOT NULL, + `SUPPORT` varchar(8) NOT NULL, + `COMMENT` varchar(160) NOT NULL, + `TRANSACTIONS` varchar(3), + `XA` varchar(3), + `SAVEPOINTS` varchar(3) +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.ENGINES; Field Type Null Key Default Extra -ENGINE varchar(64) NO -SUPPORT varchar(8) NO -COMMENT varchar(160) NO +ENGINE varchar(64) NO NULL +SUPPORT varchar(8) NO NULL +COMMENT varchar(160) NO NULL TRANSACTIONS varchar(3) YES NULL XA varchar(3) YES NULL SAVEPOINTS varchar(3) YES NULL diff --git a/mysql-test/suite/funcs_1/r/is_events.result b/mysql-test/suite/funcs_1/r/is_events.result index 57b1943b6c20b..a597d43f0ea95 100644 --- a/mysql-test/suite/funcs_1/r/is_events.result +++ b/mysql-test/suite/funcs_1/r/is_events.result @@ -28,84 +28,84 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.EVENTS; Field Type Null Key Default Extra -EVENT_CATALOG varchar(64) NO -EVENT_SCHEMA varchar(64) NO -EVENT_NAME varchar(64) NO -DEFINER varchar(384) NO -TIME_ZONE varchar(64) NO -EVENT_BODY varchar(8) NO -EVENT_DEFINITION longtext NO -EVENT_TYPE varchar(9) NO +EVENT_CATALOG varchar(64) NO NULL +EVENT_SCHEMA varchar(64) NO NULL +EVENT_NAME varchar(64) NO NULL +DEFINER varchar(384) NO NULL +TIME_ZONE varchar(64) NO NULL +EVENT_BODY varchar(8) NO NULL +EVENT_DEFINITION longtext NO NULL +EVENT_TYPE varchar(9) NO NULL EXECUTE_AT datetime YES NULL INTERVAL_VALUE varchar(256) YES NULL INTERVAL_FIELD varchar(18) YES NULL -SQL_MODE varchar(8192) NO +SQL_MODE varchar(8192) NO NULL STARTS datetime YES NULL ENDS datetime YES NULL -STATUS varchar(18) NO -ON_COMPLETION varchar(12) NO -CREATED datetime NO 0000-00-00 00:00:00 -LAST_ALTERED datetime NO 0000-00-00 00:00:00 +STATUS varchar(18) NO NULL +ON_COMPLETION varchar(12) NO NULL +CREATED datetime NO NULL +LAST_ALTERED datetime NO NULL LAST_EXECUTED datetime YES NULL -EVENT_COMMENT varchar(64) NO -ORIGINATOR bigint(10) NO 0 -CHARACTER_SET_CLIENT varchar(32) NO -COLLATION_CONNECTION varchar(32) NO -DATABASE_COLLATION varchar(32) NO +EVENT_COMMENT varchar(64) NO NULL +ORIGINATOR bigint(10) NO NULL +CHARACTER_SET_CLIENT varchar(32) NO NULL +COLLATION_CONNECTION varchar(32) NO NULL +DATABASE_COLLATION varchar(32) NO NULL SHOW CREATE TABLE information_schema.EVENTS; Table Create Table EVENTS CREATE TEMPORARY TABLE `EVENTS` ( - `EVENT_CATALOG` varchar(64) NOT NULL DEFAULT '', - `EVENT_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `EVENT_NAME` varchar(64) NOT NULL DEFAULT '', - `DEFINER` varchar(384) NOT NULL DEFAULT '', - `TIME_ZONE` varchar(64) NOT NULL DEFAULT '', - `EVENT_BODY` varchar(8) NOT NULL DEFAULT '', - `EVENT_DEFINITION` longtext NOT NULL DEFAULT '', - `EVENT_TYPE` varchar(9) NOT NULL DEFAULT '', - `EXECUTE_AT` datetime DEFAULT NULL, - `INTERVAL_VALUE` varchar(256) DEFAULT NULL, - `INTERVAL_FIELD` varchar(18) DEFAULT NULL, - `SQL_MODE` varchar(8192) NOT NULL DEFAULT '', - `STARTS` datetime DEFAULT NULL, - `ENDS` datetime DEFAULT NULL, - `STATUS` varchar(18) NOT NULL DEFAULT '', - `ON_COMPLETION` varchar(12) NOT NULL DEFAULT '', - `CREATED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `LAST_ALTERED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `LAST_EXECUTED` datetime DEFAULT NULL, - `EVENT_COMMENT` varchar(64) NOT NULL DEFAULT '', - `ORIGINATOR` bigint(10) NOT NULL DEFAULT 0, - `CHARACTER_SET_CLIENT` varchar(32) NOT NULL DEFAULT '', - `COLLATION_CONNECTION` varchar(32) NOT NULL DEFAULT '', - `DATABASE_COLLATION` varchar(32) NOT NULL DEFAULT '' -) DEFAULT CHARSET=utf8mb3 + `EVENT_CATALOG` varchar(64) NOT NULL, + `EVENT_SCHEMA` varchar(64) NOT NULL, + `EVENT_NAME` varchar(64) NOT NULL, + `DEFINER` varchar(384) NOT NULL, + `TIME_ZONE` varchar(64) NOT NULL, + `EVENT_BODY` varchar(8) NOT NULL, + `EVENT_DEFINITION` longtext NOT NULL, + `EVENT_TYPE` varchar(9) NOT NULL, + `EXECUTE_AT` datetime, + `INTERVAL_VALUE` varchar(256), + `INTERVAL_FIELD` varchar(18), + `SQL_MODE` varchar(8192) NOT NULL, + `STARTS` datetime, + `ENDS` datetime, + `STATUS` varchar(18) NOT NULL, + `ON_COMPLETION` varchar(12) NOT NULL, + `CREATED` datetime NOT NULL, + `LAST_ALTERED` datetime NOT NULL, + `LAST_EXECUTED` datetime, + `EVENT_COMMENT` varchar(64) NOT NULL, + `ORIGINATOR` bigint(10) NOT NULL, + `CHARACTER_SET_CLIENT` varchar(32) NOT NULL, + `COLLATION_CONNECTION` varchar(32) NOT NULL, + `DATABASE_COLLATION` varchar(32) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.EVENTS; Field Type Null Key Default Extra -EVENT_CATALOG varchar(64) NO -EVENT_SCHEMA varchar(64) NO -EVENT_NAME varchar(64) NO -DEFINER varchar(384) NO -TIME_ZONE varchar(64) NO -EVENT_BODY varchar(8) NO -EVENT_DEFINITION longtext NO -EVENT_TYPE varchar(9) NO +EVENT_CATALOG varchar(64) NO NULL +EVENT_SCHEMA varchar(64) NO NULL +EVENT_NAME varchar(64) NO NULL +DEFINER varchar(384) NO NULL +TIME_ZONE varchar(64) NO NULL +EVENT_BODY varchar(8) NO NULL +EVENT_DEFINITION longtext NO NULL +EVENT_TYPE varchar(9) NO NULL EXECUTE_AT datetime YES NULL INTERVAL_VALUE varchar(256) YES NULL INTERVAL_FIELD varchar(18) YES NULL -SQL_MODE varchar(8192) NO +SQL_MODE varchar(8192) NO NULL STARTS datetime YES NULL ENDS datetime YES NULL -STATUS varchar(18) NO -ON_COMPLETION varchar(12) NO -CREATED datetime NO 0000-00-00 00:00:00 -LAST_ALTERED datetime NO 0000-00-00 00:00:00 +STATUS varchar(18) NO NULL +ON_COMPLETION varchar(12) NO NULL +CREATED datetime NO NULL +LAST_ALTERED datetime NO NULL LAST_EXECUTED datetime YES NULL -EVENT_COMMENT varchar(64) NO -ORIGINATOR bigint(10) NO 0 -CHARACTER_SET_CLIENT varchar(32) NO -COLLATION_CONNECTION varchar(32) NO -DATABASE_COLLATION varchar(32) NO +EVENT_COMMENT varchar(64) NO NULL +ORIGINATOR bigint(10) NO NULL +CHARACTER_SET_CLIENT varchar(32) NO NULL +COLLATION_CONNECTION varchar(32) NO NULL +DATABASE_COLLATION varchar(32) NO NULL SELECT event_catalog, event_name, event_body, event_type, event_type, status, on_completion FROM information_schema.events 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 3add9ee9c6358..f721be917489f 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 @@ -28,14 +28,14 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.KEY_COLUMN_USAGE; Field Type Null Key Default Extra -CONSTRAINT_CATALOG varchar(512) NO -CONSTRAINT_SCHEMA varchar(64) NO -CONSTRAINT_NAME varchar(64) NO -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -COLUMN_NAME varchar(64) NO -ORDINAL_POSITION bigint(10) NO 0 +CONSTRAINT_CATALOG varchar(512) NO NULL +CONSTRAINT_SCHEMA varchar(64) NO NULL +CONSTRAINT_NAME varchar(64) NO NULL +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +COLUMN_NAME varchar(64) NO NULL +ORDINAL_POSITION bigint(10) NO NULL POSITION_IN_UNIQUE_CONSTRAINT bigint(10) YES NULL REFERENCED_TABLE_SCHEMA varchar(64) YES NULL REFERENCED_TABLE_NAME varchar(64) YES NULL @@ -43,29 +43,29 @@ REFERENCED_COLUMN_NAME varchar(64) YES NULL SHOW CREATE TABLE information_schema.KEY_COLUMN_USAGE; Table Create Table KEY_COLUMN_USAGE CREATE TEMPORARY TABLE `KEY_COLUMN_USAGE` ( - `CONSTRAINT_CATALOG` varchar(512) NOT NULL DEFAULT '', - `CONSTRAINT_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `CONSTRAINT_NAME` varchar(64) NOT NULL DEFAULT '', - `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', - `COLUMN_NAME` varchar(64) NOT NULL DEFAULT '', - `ORDINAL_POSITION` bigint(10) NOT NULL DEFAULT 0, - `POSITION_IN_UNIQUE_CONSTRAINT` bigint(10) DEFAULT NULL, - `REFERENCED_TABLE_SCHEMA` varchar(64) DEFAULT NULL, - `REFERENCED_TABLE_NAME` varchar(64) DEFAULT NULL, - `REFERENCED_COLUMN_NAME` varchar(64) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `CONSTRAINT_CATALOG` varchar(512) NOT NULL, + `CONSTRAINT_SCHEMA` varchar(64) NOT NULL, + `CONSTRAINT_NAME` varchar(64) NOT NULL, + `TABLE_CATALOG` varchar(512) NOT NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL, + `TABLE_NAME` varchar(64) NOT NULL, + `COLUMN_NAME` varchar(64) NOT NULL, + `ORDINAL_POSITION` bigint(10) NOT NULL, + `POSITION_IN_UNIQUE_CONSTRAINT` bigint(10), + `REFERENCED_TABLE_SCHEMA` varchar(64), + `REFERENCED_TABLE_NAME` varchar(64), + `REFERENCED_COLUMN_NAME` varchar(64) +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.KEY_COLUMN_USAGE; Field Type Null Key Default Extra -CONSTRAINT_CATALOG varchar(512) NO -CONSTRAINT_SCHEMA varchar(64) NO -CONSTRAINT_NAME varchar(64) NO -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -COLUMN_NAME varchar(64) NO -ORDINAL_POSITION bigint(10) NO 0 +CONSTRAINT_CATALOG varchar(512) NO NULL +CONSTRAINT_SCHEMA varchar(64) NO NULL +CONSTRAINT_NAME varchar(64) NO NULL +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +COLUMN_NAME varchar(64) NO NULL +ORDINAL_POSITION bigint(10) NO NULL POSITION_IN_UNIQUE_CONSTRAINT bigint(10) YES NULL REFERENCED_TABLE_SCHEMA varchar(64) YES NULL REFERENCED_TABLE_NAME varchar(64) YES NULL 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 e52eac4c45b7c..0b9788c45101f 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 @@ -28,14 +28,14 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.KEY_COLUMN_USAGE; Field Type Null Key Default Extra -CONSTRAINT_CATALOG varchar(512) NO -CONSTRAINT_SCHEMA varchar(64) NO -CONSTRAINT_NAME varchar(64) NO -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -COLUMN_NAME varchar(64) NO -ORDINAL_POSITION bigint(10) NO 0 +CONSTRAINT_CATALOG varchar(512) NO NULL +CONSTRAINT_SCHEMA varchar(64) NO NULL +CONSTRAINT_NAME varchar(64) NO NULL +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +COLUMN_NAME varchar(64) NO NULL +ORDINAL_POSITION bigint(10) NO NULL POSITION_IN_UNIQUE_CONSTRAINT bigint(10) YES NULL REFERENCED_TABLE_SCHEMA varchar(64) YES NULL REFERENCED_TABLE_NAME varchar(64) YES NULL @@ -43,29 +43,29 @@ REFERENCED_COLUMN_NAME varchar(64) YES NULL SHOW CREATE TABLE information_schema.KEY_COLUMN_USAGE; Table Create Table KEY_COLUMN_USAGE CREATE TEMPORARY TABLE `KEY_COLUMN_USAGE` ( - `CONSTRAINT_CATALOG` varchar(512) NOT NULL DEFAULT '', - `CONSTRAINT_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `CONSTRAINT_NAME` varchar(64) NOT NULL DEFAULT '', - `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', - `COLUMN_NAME` varchar(64) NOT NULL DEFAULT '', - `ORDINAL_POSITION` bigint(10) NOT NULL DEFAULT 0, - `POSITION_IN_UNIQUE_CONSTRAINT` bigint(10) DEFAULT NULL, - `REFERENCED_TABLE_SCHEMA` varchar(64) DEFAULT NULL, - `REFERENCED_TABLE_NAME` varchar(64) DEFAULT NULL, - `REFERENCED_COLUMN_NAME` varchar(64) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `CONSTRAINT_CATALOG` varchar(512) NOT NULL, + `CONSTRAINT_SCHEMA` varchar(64) NOT NULL, + `CONSTRAINT_NAME` varchar(64) NOT NULL, + `TABLE_CATALOG` varchar(512) NOT NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL, + `TABLE_NAME` varchar(64) NOT NULL, + `COLUMN_NAME` varchar(64) NOT NULL, + `ORDINAL_POSITION` bigint(10) NOT NULL, + `POSITION_IN_UNIQUE_CONSTRAINT` bigint(10), + `REFERENCED_TABLE_SCHEMA` varchar(64), + `REFERENCED_TABLE_NAME` varchar(64), + `REFERENCED_COLUMN_NAME` varchar(64) +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.KEY_COLUMN_USAGE; Field Type Null Key Default Extra -CONSTRAINT_CATALOG varchar(512) NO -CONSTRAINT_SCHEMA varchar(64) NO -CONSTRAINT_NAME varchar(64) NO -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -COLUMN_NAME varchar(64) NO -ORDINAL_POSITION bigint(10) NO 0 +CONSTRAINT_CATALOG varchar(512) NO NULL +CONSTRAINT_SCHEMA varchar(64) NO NULL +CONSTRAINT_NAME varchar(64) NO NULL +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +COLUMN_NAME varchar(64) NO NULL +ORDINAL_POSITION bigint(10) NO NULL POSITION_IN_UNIQUE_CONSTRAINT bigint(10) YES NULL REFERENCED_TABLE_SCHEMA varchar(64) YES NULL REFERENCED_TABLE_NAME varchar(64) YES NULL diff --git a/mysql-test/suite/funcs_1/r/is_routines.result b/mysql-test/suite/funcs_1/r/is_routines.result index dab8c783b31ac..a1931a964ce89 100644 --- a/mysql-test/suite/funcs_1/r/is_routines.result +++ b/mysql-test/suite/funcs_1/r/is_routines.result @@ -29,12 +29,12 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.ROUTINES; Field Type Null Key Default Extra -SPECIFIC_NAME varchar(64) NO -ROUTINE_CATALOG varchar(512) NO -ROUTINE_SCHEMA varchar(64) NO -ROUTINE_NAME varchar(64) NO -ROUTINE_TYPE varchar(13) NO -DATA_TYPE varchar(64) NO +SPECIFIC_NAME varchar(64) NO NULL +ROUTINE_CATALOG varchar(512) NO NULL +ROUTINE_SCHEMA varchar(64) NO NULL +ROUTINE_NAME varchar(64) NO NULL +ROUTINE_TYPE varchar(13) NO NULL +DATA_TYPE varchar(64) NO NULL CHARACTER_MAXIMUM_LENGTH int(21) YES NULL CHARACTER_OCTET_LENGTH int(21) YES NULL NUMERIC_PRECISION int(21) YES NULL @@ -43,66 +43,66 @@ DATETIME_PRECISION bigint(21) unsigned YES NULL CHARACTER_SET_NAME varchar(64) YES NULL COLLATION_NAME varchar(64) YES NULL DTD_IDENTIFIER longtext YES NULL -ROUTINE_BODY varchar(8) NO +ROUTINE_BODY varchar(8) NO NULL ROUTINE_DEFINITION longtext YES NULL EXTERNAL_NAME varchar(64) YES NULL EXTERNAL_LANGUAGE varchar(64) YES NULL -PARAMETER_STYLE varchar(8) NO -IS_DETERMINISTIC varchar(3) NO -SQL_DATA_ACCESS varchar(64) NO +PARAMETER_STYLE varchar(8) NO NULL +IS_DETERMINISTIC varchar(3) NO NULL +SQL_DATA_ACCESS varchar(64) NO NULL SQL_PATH varchar(64) YES NULL -SECURITY_TYPE varchar(7) NO -CREATED datetime NO 0000-00-00 00:00:00 -LAST_ALTERED datetime NO 0000-00-00 00:00:00 -SQL_MODE varchar(8192) NO -ROUTINE_COMMENT longtext NO -DEFINER varchar(384) NO -CHARACTER_SET_CLIENT varchar(32) NO -COLLATION_CONNECTION varchar(32) NO -DATABASE_COLLATION varchar(32) NO +SECURITY_TYPE varchar(7) NO NULL +CREATED datetime NO NULL +LAST_ALTERED datetime NO NULL +SQL_MODE varchar(8192) NO NULL +ROUTINE_COMMENT longtext NO NULL +DEFINER varchar(384) NO NULL +CHARACTER_SET_CLIENT varchar(32) NO NULL +COLLATION_CONNECTION varchar(32) NO NULL +DATABASE_COLLATION varchar(32) NO NULL SHOW CREATE TABLE information_schema.ROUTINES; Table Create Table ROUTINES CREATE TEMPORARY TABLE `ROUTINES` ( - `SPECIFIC_NAME` varchar(64) NOT NULL DEFAULT '', - `ROUTINE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `ROUTINE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `ROUTINE_NAME` varchar(64) NOT NULL DEFAULT '', - `ROUTINE_TYPE` varchar(13) NOT NULL DEFAULT '', - `DATA_TYPE` varchar(64) NOT NULL DEFAULT '', - `CHARACTER_MAXIMUM_LENGTH` int(21) DEFAULT NULL, - `CHARACTER_OCTET_LENGTH` int(21) DEFAULT NULL, - `NUMERIC_PRECISION` int(21) DEFAULT NULL, - `NUMERIC_SCALE` int(21) DEFAULT NULL, - `DATETIME_PRECISION` bigint(21) unsigned DEFAULT NULL, - `CHARACTER_SET_NAME` varchar(64) DEFAULT NULL, - `COLLATION_NAME` varchar(64) DEFAULT NULL, - `DTD_IDENTIFIER` longtext DEFAULT NULL, - `ROUTINE_BODY` varchar(8) NOT NULL DEFAULT '', - `ROUTINE_DEFINITION` longtext DEFAULT NULL, - `EXTERNAL_NAME` varchar(64) DEFAULT NULL, - `EXTERNAL_LANGUAGE` varchar(64) DEFAULT NULL, - `PARAMETER_STYLE` varchar(8) NOT NULL DEFAULT '', - `IS_DETERMINISTIC` varchar(3) NOT NULL DEFAULT '', - `SQL_DATA_ACCESS` varchar(64) NOT NULL DEFAULT '', - `SQL_PATH` varchar(64) DEFAULT NULL, - `SECURITY_TYPE` varchar(7) NOT NULL DEFAULT '', - `CREATED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `LAST_ALTERED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `SQL_MODE` varchar(8192) NOT NULL DEFAULT '', - `ROUTINE_COMMENT` longtext NOT NULL DEFAULT '', - `DEFINER` varchar(384) NOT NULL DEFAULT '', - `CHARACTER_SET_CLIENT` varchar(32) NOT NULL DEFAULT '', - `COLLATION_CONNECTION` varchar(32) NOT NULL DEFAULT '', - `DATABASE_COLLATION` varchar(32) NOT NULL DEFAULT '' -) DEFAULT CHARSET=utf8mb3 + `SPECIFIC_NAME` varchar(64) NOT NULL, + `ROUTINE_CATALOG` varchar(512) NOT NULL, + `ROUTINE_SCHEMA` varchar(64) NOT NULL, + `ROUTINE_NAME` varchar(64) NOT NULL, + `ROUTINE_TYPE` varchar(13) NOT NULL, + `DATA_TYPE` varchar(64) NOT NULL, + `CHARACTER_MAXIMUM_LENGTH` int(21), + `CHARACTER_OCTET_LENGTH` int(21), + `NUMERIC_PRECISION` int(21), + `NUMERIC_SCALE` int(21), + `DATETIME_PRECISION` bigint(21) unsigned, + `CHARACTER_SET_NAME` varchar(64), + `COLLATION_NAME` varchar(64), + `DTD_IDENTIFIER` longtext, + `ROUTINE_BODY` varchar(8) NOT NULL, + `ROUTINE_DEFINITION` longtext, + `EXTERNAL_NAME` varchar(64), + `EXTERNAL_LANGUAGE` varchar(64), + `PARAMETER_STYLE` varchar(8) NOT NULL, + `IS_DETERMINISTIC` varchar(3) NOT NULL, + `SQL_DATA_ACCESS` varchar(64) NOT NULL, + `SQL_PATH` varchar(64), + `SECURITY_TYPE` varchar(7) NOT NULL, + `CREATED` datetime NOT NULL, + `LAST_ALTERED` datetime NOT NULL, + `SQL_MODE` varchar(8192) NOT NULL, + `ROUTINE_COMMENT` longtext NOT NULL, + `DEFINER` varchar(384) NOT NULL, + `CHARACTER_SET_CLIENT` varchar(32) NOT NULL, + `COLLATION_CONNECTION` varchar(32) NOT NULL, + `DATABASE_COLLATION` varchar(32) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.ROUTINES; Field Type Null Key Default Extra -SPECIFIC_NAME varchar(64) NO -ROUTINE_CATALOG varchar(512) NO -ROUTINE_SCHEMA varchar(64) NO -ROUTINE_NAME varchar(64) NO -ROUTINE_TYPE varchar(13) NO -DATA_TYPE varchar(64) NO +SPECIFIC_NAME varchar(64) NO NULL +ROUTINE_CATALOG varchar(512) NO NULL +ROUTINE_SCHEMA varchar(64) NO NULL +ROUTINE_NAME varchar(64) NO NULL +ROUTINE_TYPE varchar(13) NO NULL +DATA_TYPE varchar(64) NO NULL CHARACTER_MAXIMUM_LENGTH int(21) YES NULL CHARACTER_OCTET_LENGTH int(21) YES NULL NUMERIC_PRECISION int(21) YES NULL @@ -111,23 +111,23 @@ DATETIME_PRECISION bigint(21) unsigned YES NULL CHARACTER_SET_NAME varchar(64) YES NULL COLLATION_NAME varchar(64) YES NULL DTD_IDENTIFIER longtext YES NULL -ROUTINE_BODY varchar(8) NO +ROUTINE_BODY varchar(8) NO NULL ROUTINE_DEFINITION longtext YES NULL EXTERNAL_NAME varchar(64) YES NULL EXTERNAL_LANGUAGE varchar(64) YES NULL -PARAMETER_STYLE varchar(8) NO -IS_DETERMINISTIC varchar(3) NO -SQL_DATA_ACCESS varchar(64) NO +PARAMETER_STYLE varchar(8) NO NULL +IS_DETERMINISTIC varchar(3) NO NULL +SQL_DATA_ACCESS varchar(64) NO NULL SQL_PATH varchar(64) YES NULL -SECURITY_TYPE varchar(7) NO -CREATED datetime NO 0000-00-00 00:00:00 -LAST_ALTERED datetime NO 0000-00-00 00:00:00 -SQL_MODE varchar(8192) NO -ROUTINE_COMMENT longtext NO -DEFINER varchar(384) NO -CHARACTER_SET_CLIENT varchar(32) NO -COLLATION_CONNECTION varchar(32) NO -DATABASE_COLLATION varchar(32) NO +SECURITY_TYPE varchar(7) NO NULL +CREATED datetime NO NULL +LAST_ALTERED datetime NO NULL +SQL_MODE varchar(8192) NO NULL +ROUTINE_COMMENT longtext NO NULL +DEFINER varchar(384) NO NULL +CHARACTER_SET_CLIENT varchar(32) NO NULL +COLLATION_CONNECTION varchar(32) NO NULL +DATABASE_COLLATION varchar(32) NO NULL USE test; DROP PROCEDURE IF EXISTS sp_for_routines; DROP FUNCTION IF EXISTS function_for_routines; 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 f4cae5749750f..dba5e7f330e14 100644 --- a/mysql-test/suite/funcs_1/r/is_routines_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_routines_embedded.result @@ -29,12 +29,12 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.ROUTINES; Field Type Null Key Default Extra -SPECIFIC_NAME varchar(64) NO -ROUTINE_CATALOG varchar(512) NO -ROUTINE_SCHEMA varchar(64) NO -ROUTINE_NAME varchar(64) NO -ROUTINE_TYPE varchar(13) NO -DATA_TYPE varchar(64) NO +SPECIFIC_NAME varchar(64) NO NULL +ROUTINE_CATALOG varchar(512) NO NULL +ROUTINE_SCHEMA varchar(64) NO NULL +ROUTINE_NAME varchar(64) NO NULL +ROUTINE_TYPE varchar(13) NO NULL +DATA_TYPE varchar(64) NO NULL CHARACTER_MAXIMUM_LENGTH int(21) YES NULL CHARACTER_OCTET_LENGTH int(21) YES NULL NUMERIC_PRECISION int(21) YES NULL @@ -43,66 +43,66 @@ DATETIME_PRECISION bigint(21) unsigned YES NULL CHARACTER_SET_NAME varchar(64) YES NULL COLLATION_NAME varchar(64) YES NULL DTD_IDENTIFIER longtext YES NULL -ROUTINE_BODY varchar(8) NO +ROUTINE_BODY varchar(8) NO NULL ROUTINE_DEFINITION longtext YES NULL EXTERNAL_NAME varchar(64) YES NULL EXTERNAL_LANGUAGE varchar(64) YES NULL -PARAMETER_STYLE varchar(8) NO -IS_DETERMINISTIC varchar(3) NO -SQL_DATA_ACCESS varchar(64) NO +PARAMETER_STYLE varchar(8) NO NULL +IS_DETERMINISTIC varchar(3) NO NULL +SQL_DATA_ACCESS varchar(64) NO NULL SQL_PATH varchar(64) YES NULL -SECURITY_TYPE varchar(7) NO -CREATED datetime NO 0000-00-00 00:00:00 -LAST_ALTERED datetime NO 0000-00-00 00:00:00 -SQL_MODE varchar(8192) NO -ROUTINE_COMMENT longtext NO -DEFINER varchar(384) NO -CHARACTER_SET_CLIENT varchar(32) NO -COLLATION_CONNECTION varchar(32) NO -DATABASE_COLLATION varchar(32) NO +SECURITY_TYPE varchar(7) NO NULL +CREATED datetime NO NULL +LAST_ALTERED datetime NO NULL +SQL_MODE varchar(8192) NO NULL +ROUTINE_COMMENT longtext NO NULL +DEFINER varchar(384) NO NULL +CHARACTER_SET_CLIENT varchar(32) NO NULL +COLLATION_CONNECTION varchar(32) NO NULL +DATABASE_COLLATION varchar(32) NO NULL SHOW CREATE TABLE information_schema.ROUTINES; Table Create Table ROUTINES CREATE TEMPORARY TABLE `ROUTINES` ( - `SPECIFIC_NAME` varchar(64) NOT NULL DEFAULT '', - `ROUTINE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `ROUTINE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `ROUTINE_NAME` varchar(64) NOT NULL DEFAULT '', - `ROUTINE_TYPE` varchar(13) NOT NULL DEFAULT '', - `DATA_TYPE` varchar(64) NOT NULL DEFAULT '', - `CHARACTER_MAXIMUM_LENGTH` int(21) DEFAULT NULL, - `CHARACTER_OCTET_LENGTH` int(21) DEFAULT NULL, - `NUMERIC_PRECISION` int(21) DEFAULT NULL, - `NUMERIC_SCALE` int(21) DEFAULT NULL, - `DATETIME_PRECISION` bigint(21) unsigned DEFAULT NULL, - `CHARACTER_SET_NAME` varchar(64) DEFAULT NULL, - `COLLATION_NAME` varchar(64) DEFAULT NULL, - `DTD_IDENTIFIER` longtext DEFAULT NULL, - `ROUTINE_BODY` varchar(8) NOT NULL DEFAULT '', - `ROUTINE_DEFINITION` longtext DEFAULT NULL, - `EXTERNAL_NAME` varchar(64) DEFAULT NULL, - `EXTERNAL_LANGUAGE` varchar(64) DEFAULT NULL, - `PARAMETER_STYLE` varchar(8) NOT NULL DEFAULT '', - `IS_DETERMINISTIC` varchar(3) NOT NULL DEFAULT '', - `SQL_DATA_ACCESS` varchar(64) NOT NULL DEFAULT '', - `SQL_PATH` varchar(64) DEFAULT NULL, - `SECURITY_TYPE` varchar(7) NOT NULL DEFAULT '', - `CREATED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `LAST_ALTERED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `SQL_MODE` varchar(8192) NOT NULL DEFAULT '', - `ROUTINE_COMMENT` longtext NOT NULL DEFAULT '', - `DEFINER` varchar(384) NOT NULL DEFAULT '', - `CHARACTER_SET_CLIENT` varchar(32) NOT NULL DEFAULT '', - `COLLATION_CONNECTION` varchar(32) NOT NULL DEFAULT '', - `DATABASE_COLLATION` varchar(32) NOT NULL DEFAULT '' -) DEFAULT CHARSET=utf8mb3 + `SPECIFIC_NAME` varchar(64) NOT NULL, + `ROUTINE_CATALOG` varchar(512) NOT NULL, + `ROUTINE_SCHEMA` varchar(64) NOT NULL, + `ROUTINE_NAME` varchar(64) NOT NULL, + `ROUTINE_TYPE` varchar(13) NOT NULL, + `DATA_TYPE` varchar(64) NOT NULL, + `CHARACTER_MAXIMUM_LENGTH` int(21), + `CHARACTER_OCTET_LENGTH` int(21), + `NUMERIC_PRECISION` int(21), + `NUMERIC_SCALE` int(21), + `DATETIME_PRECISION` bigint(21) unsigned, + `CHARACTER_SET_NAME` varchar(64), + `COLLATION_NAME` varchar(64), + `DTD_IDENTIFIER` longtext, + `ROUTINE_BODY` varchar(8) NOT NULL, + `ROUTINE_DEFINITION` longtext, + `EXTERNAL_NAME` varchar(64), + `EXTERNAL_LANGUAGE` varchar(64), + `PARAMETER_STYLE` varchar(8) NOT NULL, + `IS_DETERMINISTIC` varchar(3) NOT NULL, + `SQL_DATA_ACCESS` varchar(64) NOT NULL, + `SQL_PATH` varchar(64), + `SECURITY_TYPE` varchar(7) NOT NULL, + `CREATED` datetime NOT NULL, + `LAST_ALTERED` datetime NOT NULL, + `SQL_MODE` varchar(8192) NOT NULL, + `ROUTINE_COMMENT` longtext NOT NULL, + `DEFINER` varchar(384) NOT NULL, + `CHARACTER_SET_CLIENT` varchar(32) NOT NULL, + `COLLATION_CONNECTION` varchar(32) NOT NULL, + `DATABASE_COLLATION` varchar(32) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.ROUTINES; Field Type Null Key Default Extra -SPECIFIC_NAME varchar(64) NO -ROUTINE_CATALOG varchar(512) NO -ROUTINE_SCHEMA varchar(64) NO -ROUTINE_NAME varchar(64) NO -ROUTINE_TYPE varchar(13) NO -DATA_TYPE varchar(64) NO +SPECIFIC_NAME varchar(64) NO NULL +ROUTINE_CATALOG varchar(512) NO NULL +ROUTINE_SCHEMA varchar(64) NO NULL +ROUTINE_NAME varchar(64) NO NULL +ROUTINE_TYPE varchar(13) NO NULL +DATA_TYPE varchar(64) NO NULL CHARACTER_MAXIMUM_LENGTH int(21) YES NULL CHARACTER_OCTET_LENGTH int(21) YES NULL NUMERIC_PRECISION int(21) YES NULL @@ -111,23 +111,23 @@ DATETIME_PRECISION bigint(21) unsigned YES NULL CHARACTER_SET_NAME varchar(64) YES NULL COLLATION_NAME varchar(64) YES NULL DTD_IDENTIFIER longtext YES NULL -ROUTINE_BODY varchar(8) NO +ROUTINE_BODY varchar(8) NO NULL ROUTINE_DEFINITION longtext YES NULL EXTERNAL_NAME varchar(64) YES NULL EXTERNAL_LANGUAGE varchar(64) YES NULL -PARAMETER_STYLE varchar(8) NO -IS_DETERMINISTIC varchar(3) NO -SQL_DATA_ACCESS varchar(64) NO +PARAMETER_STYLE varchar(8) NO NULL +IS_DETERMINISTIC varchar(3) NO NULL +SQL_DATA_ACCESS varchar(64) NO NULL SQL_PATH varchar(64) YES NULL -SECURITY_TYPE varchar(7) NO -CREATED datetime NO 0000-00-00 00:00:00 -LAST_ALTERED datetime NO 0000-00-00 00:00:00 -SQL_MODE varchar(8192) NO -ROUTINE_COMMENT longtext NO -DEFINER varchar(384) NO -CHARACTER_SET_CLIENT varchar(32) NO -COLLATION_CONNECTION varchar(32) NO -DATABASE_COLLATION varchar(32) NO +SECURITY_TYPE varchar(7) NO NULL +CREATED datetime NO NULL +LAST_ALTERED datetime NO NULL +SQL_MODE varchar(8192) NO NULL +ROUTINE_COMMENT longtext NO NULL +DEFINER varchar(384) NO NULL +CHARACTER_SET_CLIENT varchar(32) NO NULL +COLLATION_CONNECTION varchar(32) NO NULL +DATABASE_COLLATION varchar(32) NO NULL USE test; DROP PROCEDURE IF EXISTS sp_for_routines; DROP FUNCTION IF EXISTS function_for_routines; diff --git a/mysql-test/suite/funcs_1/r/is_schema_privileges.result b/mysql-test/suite/funcs_1/r/is_schema_privileges.result index 0b4268cf92aeb..1c8f50df7ceb8 100644 --- a/mysql-test/suite/funcs_1/r/is_schema_privileges.result +++ b/mysql-test/suite/funcs_1/r/is_schema_privileges.result @@ -28,27 +28,27 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.SCHEMA_PRIVILEGES; Field Type Null Key Default Extra -GRANTEE varchar(385) NO -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -PRIVILEGE_TYPE varchar(64) NO -IS_GRANTABLE varchar(3) NO +GRANTEE varchar(385) NO NULL +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +PRIVILEGE_TYPE varchar(64) NO NULL +IS_GRANTABLE varchar(3) NO NULL SHOW CREATE TABLE information_schema.SCHEMA_PRIVILEGES; Table Create Table SCHEMA_PRIVILEGES CREATE TEMPORARY TABLE `SCHEMA_PRIVILEGES` ( - `GRANTEE` varchar(385) NOT NULL DEFAULT '', - `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `PRIVILEGE_TYPE` varchar(64) NOT NULL DEFAULT '', - `IS_GRANTABLE` varchar(3) NOT NULL DEFAULT '' -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `GRANTEE` varchar(385) NOT NULL, + `TABLE_CATALOG` varchar(512) NOT NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL, + `PRIVILEGE_TYPE` varchar(64) NOT NULL, + `IS_GRANTABLE` varchar(3) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.SCHEMA_PRIVILEGES; Field Type Null Key Default Extra -GRANTEE varchar(385) NO -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -PRIVILEGE_TYPE varchar(64) NO -IS_GRANTABLE varchar(3) NO +GRANTEE varchar(385) NO NULL +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +PRIVILEGE_TYPE varchar(64) NO NULL +IS_GRANTABLE varchar(3) NO NULL SELECT GRANTEE, TABLE_CATALOG, TABLE_SCHEMA, PRIVILEGE_TYPE FROM information_schema.schema_privileges WHERE table_catalog IS NOT NULL; GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE diff --git a/mysql-test/suite/funcs_1/r/is_schemata.result b/mysql-test/suite/funcs_1/r/is_schemata.result index 3949ab16755c9..5a12c63fe25e7 100644 --- a/mysql-test/suite/funcs_1/r/is_schemata.result +++ b/mysql-test/suite/funcs_1/r/is_schemata.result @@ -28,30 +28,30 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.SCHEMATA; Field Type Null Key Default Extra -CATALOG_NAME varchar(512) NO -SCHEMA_NAME varchar(64) NO -DEFAULT_CHARACTER_SET_NAME varchar(32) NO -DEFAULT_COLLATION_NAME varchar(32) NO +CATALOG_NAME varchar(512) NO NULL +SCHEMA_NAME varchar(64) NO NULL +DEFAULT_CHARACTER_SET_NAME varchar(32) NO NULL +DEFAULT_COLLATION_NAME varchar(32) NO NULL SQL_PATH varchar(512) YES NULL -SCHEMA_COMMENT varchar(1024) NO +SCHEMA_COMMENT varchar(1024) NO NULL SHOW CREATE TABLE information_schema.SCHEMATA; Table Create Table SCHEMATA CREATE TEMPORARY TABLE `SCHEMATA` ( - `CATALOG_NAME` varchar(512) NOT NULL DEFAULT '', - `SCHEMA_NAME` varchar(64) NOT NULL DEFAULT '', - `DEFAULT_CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '', - `DEFAULT_COLLATION_NAME` varchar(32) NOT NULL DEFAULT '', - `SQL_PATH` varchar(512) DEFAULT NULL, - `SCHEMA_COMMENT` varchar(1024) NOT NULL DEFAULT '' -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `CATALOG_NAME` varchar(512) NOT NULL, + `SCHEMA_NAME` varchar(64) NOT NULL, + `DEFAULT_CHARACTER_SET_NAME` varchar(32) NOT NULL, + `DEFAULT_COLLATION_NAME` varchar(32) NOT NULL, + `SQL_PATH` varchar(512), + `SCHEMA_COMMENT` varchar(1024) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.SCHEMATA; Field Type Null Key Default Extra -CATALOG_NAME varchar(512) NO -SCHEMA_NAME varchar(64) NO -DEFAULT_CHARACTER_SET_NAME varchar(32) NO -DEFAULT_COLLATION_NAME varchar(32) NO +CATALOG_NAME varchar(512) NO NULL +SCHEMA_NAME varchar(64) NO NULL +DEFAULT_CHARACTER_SET_NAME varchar(32) NO NULL +DEFAULT_COLLATION_NAME varchar(32) NO NULL SQL_PATH varchar(512) YES NULL -SCHEMA_COMMENT varchar(1024) NO +SCHEMA_COMMENT varchar(1024) NO NULL SELECT catalog_name, schema_name, sql_path FROM information_schema.schemata WHERE catalog_name IS NOT NULL or sql_path IS NOT NULL diff --git a/mysql-test/suite/funcs_1/r/is_schemata_embedded.result b/mysql-test/suite/funcs_1/r/is_schemata_embedded.result index 5652e916cb10a..0156d6117bd9f 100644 --- a/mysql-test/suite/funcs_1/r/is_schemata_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_schemata_embedded.result @@ -28,30 +28,30 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.SCHEMATA; Field Type Null Key Default Extra -CATALOG_NAME varchar(512) NO -SCHEMA_NAME varchar(64) NO -DEFAULT_CHARACTER_SET_NAME varchar(32) NO -DEFAULT_COLLATION_NAME varchar(32) NO +CATALOG_NAME varchar(512) NO NULL +SCHEMA_NAME varchar(64) NO NULL +DEFAULT_CHARACTER_SET_NAME varchar(32) NO NULL +DEFAULT_COLLATION_NAME varchar(32) NO NULL SQL_PATH varchar(512) YES NULL -SCHEMA_COMMENT varchar(1024) NO +SCHEMA_COMMENT varchar(1024) NO NULL SHOW CREATE TABLE information_schema.SCHEMATA; Table Create Table SCHEMATA CREATE TEMPORARY TABLE `SCHEMATA` ( - `CATALOG_NAME` varchar(512) NOT NULL DEFAULT '', - `SCHEMA_NAME` varchar(64) NOT NULL DEFAULT '', - `DEFAULT_CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '', - `DEFAULT_COLLATION_NAME` varchar(32) NOT NULL DEFAULT '', - `SQL_PATH` varchar(512) DEFAULT NULL, - `SCHEMA_COMMENT` varchar(1024) NOT NULL DEFAULT '' -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `CATALOG_NAME` varchar(512) NOT NULL, + `SCHEMA_NAME` varchar(64) NOT NULL, + `DEFAULT_CHARACTER_SET_NAME` varchar(32) NOT NULL, + `DEFAULT_COLLATION_NAME` varchar(32) NOT NULL, + `SQL_PATH` varchar(512), + `SCHEMA_COMMENT` varchar(1024) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.SCHEMATA; Field Type Null Key Default Extra -CATALOG_NAME varchar(512) NO -SCHEMA_NAME varchar(64) NO -DEFAULT_CHARACTER_SET_NAME varchar(32) NO -DEFAULT_COLLATION_NAME varchar(32) NO +CATALOG_NAME varchar(512) NO NULL +SCHEMA_NAME varchar(64) NO NULL +DEFAULT_CHARACTER_SET_NAME varchar(32) NO NULL +DEFAULT_COLLATION_NAME varchar(32) NO NULL SQL_PATH varchar(512) YES NULL -SCHEMA_COMMENT varchar(1024) NO +SCHEMA_COMMENT varchar(1024) NO NULL SELECT catalog_name, schema_name, sql_path FROM information_schema.schemata WHERE catalog_name IS NOT NULL or sql_path IS NOT NULL diff --git a/mysql-test/suite/funcs_1/r/is_statistics.result b/mysql-test/suite/funcs_1/r/is_statistics.result index 229183c036b36..4729ddf0d3a0a 100644 --- a/mysql-test/suite/funcs_1/r/is_statistics.result +++ b/mysql-test/suite/funcs_1/r/is_statistics.result @@ -28,63 +28,63 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.STATISTICS; Field Type Null Key Default Extra -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -NON_UNIQUE bigint(1) NO 0 -INDEX_SCHEMA varchar(64) NO -INDEX_NAME varchar(64) NO -SEQ_IN_INDEX bigint(2) NO 0 -COLUMN_NAME varchar(64) NO +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +NON_UNIQUE bigint(1) NO NULL +INDEX_SCHEMA varchar(64) NO NULL +INDEX_NAME varchar(64) NO NULL +SEQ_IN_INDEX bigint(2) NO NULL +COLUMN_NAME varchar(64) NO NULL COLLATION varchar(1) YES NULL CARDINALITY bigint(21) YES NULL SUB_PART bigint(3) YES NULL PACKED varchar(10) YES NULL -NULLABLE varchar(3) NO -INDEX_TYPE varchar(16) NO +NULLABLE varchar(3) NO NULL +INDEX_TYPE varchar(16) NO NULL COMMENT varchar(16) YES NULL -INDEX_COMMENT varchar(1024) NO -IGNORED varchar(3) NO +INDEX_COMMENT varchar(1024) NO NULL +IGNORED varchar(3) NO NULL SHOW CREATE TABLE information_schema.STATISTICS; Table Create Table STATISTICS CREATE TEMPORARY TABLE `STATISTICS` ( - `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', - `NON_UNIQUE` bigint(1) NOT NULL DEFAULT 0, - `INDEX_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `INDEX_NAME` varchar(64) NOT NULL DEFAULT '', - `SEQ_IN_INDEX` bigint(2) NOT NULL DEFAULT 0, - `COLUMN_NAME` varchar(64) NOT NULL DEFAULT '', - `COLLATION` varchar(1) DEFAULT NULL, - `CARDINALITY` bigint(21) DEFAULT NULL, - `SUB_PART` bigint(3) DEFAULT NULL, - `PACKED` varchar(10) DEFAULT NULL, - `NULLABLE` varchar(3) NOT NULL DEFAULT '', - `INDEX_TYPE` varchar(16) NOT NULL DEFAULT '', - `COMMENT` varchar(16) DEFAULT NULL, - `INDEX_COMMENT` varchar(1024) NOT NULL DEFAULT '', - `IGNORED` varchar(3) NOT NULL DEFAULT '' -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `TABLE_CATALOG` varchar(512) NOT NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL, + `TABLE_NAME` varchar(64) NOT NULL, + `NON_UNIQUE` bigint(1) NOT NULL, + `INDEX_SCHEMA` varchar(64) NOT NULL, + `INDEX_NAME` varchar(64) NOT NULL, + `SEQ_IN_INDEX` bigint(2) NOT NULL, + `COLUMN_NAME` varchar(64) NOT NULL, + `COLLATION` varchar(1), + `CARDINALITY` bigint(21), + `SUB_PART` bigint(3), + `PACKED` varchar(10), + `NULLABLE` varchar(3) NOT NULL, + `INDEX_TYPE` varchar(16) NOT NULL, + `COMMENT` varchar(16), + `INDEX_COMMENT` varchar(1024) NOT NULL, + `IGNORED` varchar(3) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.STATISTICS; Field Type Null Key Default Extra -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -NON_UNIQUE bigint(1) NO 0 -INDEX_SCHEMA varchar(64) NO -INDEX_NAME varchar(64) NO -SEQ_IN_INDEX bigint(2) NO 0 -COLUMN_NAME varchar(64) NO +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +NON_UNIQUE bigint(1) NO NULL +INDEX_SCHEMA varchar(64) NO NULL +INDEX_NAME varchar(64) NO NULL +SEQ_IN_INDEX bigint(2) NO NULL +COLUMN_NAME varchar(64) NO NULL COLLATION varchar(1) YES NULL CARDINALITY bigint(21) YES NULL SUB_PART bigint(3) YES NULL PACKED varchar(10) YES NULL -NULLABLE varchar(3) NO -INDEX_TYPE varchar(16) NO +NULLABLE varchar(3) NO NULL +INDEX_TYPE varchar(16) NO NULL COMMENT varchar(16) YES NULL -INDEX_COMMENT varchar(1024) NO -IGNORED varchar(3) NO +INDEX_COMMENT varchar(1024) NO NULL +IGNORED varchar(3) NO NULL SELECT table_catalog, table_schema, table_name, index_schema, index_name FROM information_schema.statistics WHERE table_catalog IS NOT NULL ORDER BY table_schema, table_name, index_schema, index_name; @@ -243,7 +243,7 @@ def db_datadict_2 t4 0 db_datadict_2 PRIMARY 1 f1 NULL 0 NULL NULL HASH NO SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` -GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO `testuser1`@`localhost` +GRANT SELECT (`f5`, `f1`) ON `db_datadict_2`.`t3` TO `testuser1`@`localhost` GRANT SELECT ON `db_datadict`.`t1` TO `testuser1`@`localhost` WITH GRANT OPTION SHOW GRANTS FOR 'testuser2'@'localhost'; Grants for testuser2@localhost @@ -262,7 +262,7 @@ def db_datadict_2 t3 0 db_datadict_2 PRIMARY 1 f1 NULL 0 NULL NULL HASH NO SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` -GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO `testuser1`@`localhost` +GRANT SELECT (`f5`, `f1`) ON `db_datadict_2`.`t3` TO `testuser1`@`localhost` GRANT SELECT ON `db_datadict`.`t1` TO `testuser1`@`localhost` WITH GRANT OPTION SHOW GRANTS FOR 'testuser2'@'localhost'; ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'mysql' @@ -281,7 +281,7 @@ REVOKE SELECT,GRANT OPTION ON db_datadict.t1 FROM 'testuser1'@'localhost'; SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` -GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO `testuser1`@`localhost` +GRANT SELECT (`f5`, `f1`) ON `db_datadict_2`.`t3` TO `testuser1`@`localhost` connection testuser1; SELECT * FROM information_schema.statistics WHERE table_schema LIKE 'db_datadict%' @@ -294,7 +294,7 @@ def db_datadict_2 t3 0 db_datadict_2 PRIMARY 1 f1 NULL 0 NULL NULL HASH NO SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` -GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO `testuser1`@`localhost` +GRANT SELECT (`f5`, `f1`) ON `db_datadict_2`.`t3` TO `testuser1`@`localhost` connection default; disconnect testuser1; disconnect testuser2; 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 de44c2d505234..ce052821ec822 100644 --- a/mysql-test/suite/funcs_1/r/is_table_constraints.result +++ b/mysql-test/suite/funcs_1/r/is_table_constraints.result @@ -28,30 +28,30 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.TABLE_CONSTRAINTS; Field Type Null Key Default Extra -CONSTRAINT_CATALOG varchar(512) NO -CONSTRAINT_SCHEMA varchar(64) NO -CONSTRAINT_NAME varchar(64) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -CONSTRAINT_TYPE varchar(64) NO +CONSTRAINT_CATALOG varchar(512) NO NULL +CONSTRAINT_SCHEMA varchar(64) NO NULL +CONSTRAINT_NAME varchar(64) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +CONSTRAINT_TYPE varchar(64) NO NULL SHOW CREATE TABLE information_schema.TABLE_CONSTRAINTS; Table Create Table TABLE_CONSTRAINTS CREATE TEMPORARY TABLE `TABLE_CONSTRAINTS` ( - `CONSTRAINT_CATALOG` varchar(512) NOT NULL DEFAULT '', - `CONSTRAINT_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `CONSTRAINT_NAME` varchar(64) NOT NULL DEFAULT '', - `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', - `CONSTRAINT_TYPE` varchar(64) NOT NULL DEFAULT '' -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `CONSTRAINT_CATALOG` varchar(512) NOT NULL, + `CONSTRAINT_SCHEMA` varchar(64) NOT NULL, + `CONSTRAINT_NAME` varchar(64) NOT NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL, + `TABLE_NAME` varchar(64) NOT NULL, + `CONSTRAINT_TYPE` varchar(64) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.TABLE_CONSTRAINTS; Field Type Null Key Default Extra -CONSTRAINT_CATALOG varchar(512) NO -CONSTRAINT_SCHEMA varchar(64) NO -CONSTRAINT_NAME varchar(64) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -CONSTRAINT_TYPE varchar(64) NO +CONSTRAINT_CATALOG varchar(512) NO NULL +CONSTRAINT_SCHEMA varchar(64) NO NULL +CONSTRAINT_NAME varchar(64) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +CONSTRAINT_TYPE varchar(64) NO NULL SELECT constraint_catalog, constraint_schema, constraint_name, table_schema, table_name FROM information_schema.table_constraints @@ -111,7 +111,7 @@ GRANT SELECT(f5) ON db_datadict.t1 TO 'testuser1'@'localhost'; SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` -GRANT SELECT (f5) ON `db_datadict`.`t1` TO `testuser1`@`localhost` +GRANT SELECT (`f5`) ON `db_datadict`.`t1` TO `testuser1`@`localhost` SELECT * FROM information_schema.table_constraints WHERE table_schema = 'db_datadict' ORDER BY table_schema,table_name, constraint_name; @@ -135,7 +135,7 @@ connect testuser1, localhost, testuser1, , db_datadict; SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` -GRANT SELECT (f5) ON `db_datadict`.`t1` TO `testuser1`@`localhost` +GRANT SELECT (`f5`) ON `db_datadict`.`t1` TO `testuser1`@`localhost` SELECT * FROM information_schema.table_constraints WHERE table_schema = 'db_datadict' ORDER BY table_schema,table_name, constraint_name; @@ -151,7 +151,7 @@ t1 0 my_idx1 1 f6 ### ### ### ### ### ### ### NO t1 0 my_idx1 2 f1 ### ### ### ### ### ### ### NO t1 0 my_idx2 1 f3 ### ### ### ### ### ### ### NO SHOW INDEXES FROM db_datadict.t2; -ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table `db_datadict`.`t2` connection default; disconnect testuser1; DROP USER 'testuser1'@'localhost'; diff --git a/mysql-test/suite/funcs_1/r/is_table_privileges.result b/mysql-test/suite/funcs_1/r/is_table_privileges.result index f749a236b9a7d..66e98854ab756 100644 --- a/mysql-test/suite/funcs_1/r/is_table_privileges.result +++ b/mysql-test/suite/funcs_1/r/is_table_privileges.result @@ -28,30 +28,30 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.TABLE_PRIVILEGES; Field Type Null Key Default Extra -GRANTEE varchar(385) NO -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -PRIVILEGE_TYPE varchar(64) NO -IS_GRANTABLE varchar(3) NO +GRANTEE varchar(385) NO NULL +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +PRIVILEGE_TYPE varchar(64) NO NULL +IS_GRANTABLE varchar(3) NO NULL SHOW CREATE TABLE information_schema.TABLE_PRIVILEGES; Table Create Table TABLE_PRIVILEGES CREATE TEMPORARY TABLE `TABLE_PRIVILEGES` ( - `GRANTEE` varchar(385) NOT NULL DEFAULT '', - `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', - `PRIVILEGE_TYPE` varchar(64) NOT NULL DEFAULT '', - `IS_GRANTABLE` varchar(3) NOT NULL DEFAULT '' -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `GRANTEE` varchar(385) NOT NULL, + `TABLE_CATALOG` varchar(512) NOT NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL, + `TABLE_NAME` varchar(64) NOT NULL, + `PRIVILEGE_TYPE` varchar(64) NOT NULL, + `IS_GRANTABLE` varchar(3) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.TABLE_PRIVILEGES; Field Type Null Key Default Extra -GRANTEE varchar(385) NO -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -PRIVILEGE_TYPE varchar(64) NO -IS_GRANTABLE varchar(3) NO +GRANTEE varchar(385) NO NULL +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +PRIVILEGE_TYPE varchar(64) NO NULL +IS_GRANTABLE varchar(3) NO NULL SELECT table_catalog, table_schema, table_name, privilege_type FROM information_schema.table_privileges WHERE table_catalog IS NOT NULL; table_catalog table_schema table_name privilege_type diff --git a/mysql-test/suite/funcs_1/r/is_tables.result b/mysql-test/suite/funcs_1/r/is_tables.result index 54c75efd74e98..35daab13c351e 100644 --- a/mysql-test/suite/funcs_1/r/is_tables.result +++ b/mysql-test/suite/funcs_1/r/is_tables.result @@ -28,10 +28,10 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.TABLES; Field Type Null Key Default Extra -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -TABLE_TYPE varchar(64) NO +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +TABLE_TYPE varchar(64) NO NULL ENGINE varchar(64) YES NULL VERSION bigint(21) unsigned YES NULL ROW_FORMAT varchar(10) YES NULL @@ -48,42 +48,42 @@ CHECK_TIME datetime YES NULL TABLE_COLLATION varchar(32) YES NULL CHECKSUM bigint(21) unsigned YES NULL CREATE_OPTIONS varchar(2048) YES NULL -TABLE_COMMENT varchar(2048) NO +TABLE_COMMENT varchar(2048) NO NULL MAX_INDEX_LENGTH bigint(21) unsigned YES NULL TEMPORARY varchar(1) YES NULL SHOW CREATE TABLE information_schema.TABLES; Table Create Table TABLES CREATE TEMPORARY TABLE `TABLES` ( - `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', - `TABLE_TYPE` varchar(64) NOT NULL DEFAULT '', - `ENGINE` varchar(64) DEFAULT NULL, - `VERSION` bigint(21) unsigned DEFAULT NULL, - `ROW_FORMAT` varchar(10) DEFAULT NULL, - `TABLE_ROWS` bigint(21) unsigned DEFAULT NULL, - `AVG_ROW_LENGTH` bigint(21) unsigned DEFAULT NULL, - `DATA_LENGTH` bigint(21) unsigned DEFAULT NULL, - `MAX_DATA_LENGTH` bigint(21) unsigned DEFAULT NULL, - `INDEX_LENGTH` bigint(21) unsigned DEFAULT NULL, - `DATA_FREE` bigint(21) unsigned DEFAULT NULL, - `AUTO_INCREMENT` bigint(21) unsigned DEFAULT NULL, - `CREATE_TIME` datetime DEFAULT NULL, - `UPDATE_TIME` datetime DEFAULT NULL, - `CHECK_TIME` datetime DEFAULT NULL, - `TABLE_COLLATION` varchar(32) DEFAULT NULL, - `CHECKSUM` bigint(21) unsigned DEFAULT NULL, - `CREATE_OPTIONS` varchar(2048) DEFAULT NULL, - `TABLE_COMMENT` varchar(2048) NOT NULL DEFAULT '', - `MAX_INDEX_LENGTH` bigint(21) unsigned DEFAULT NULL, - `TEMPORARY` varchar(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `TABLE_CATALOG` varchar(512) NOT NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL, + `TABLE_NAME` varchar(64) NOT NULL, + `TABLE_TYPE` varchar(64) NOT NULL, + `ENGINE` varchar(64), + `VERSION` bigint(21) unsigned, + `ROW_FORMAT` varchar(10), + `TABLE_ROWS` bigint(21) unsigned, + `AVG_ROW_LENGTH` bigint(21) unsigned, + `DATA_LENGTH` bigint(21) unsigned, + `MAX_DATA_LENGTH` bigint(21) unsigned, + `INDEX_LENGTH` bigint(21) unsigned, + `DATA_FREE` bigint(21) unsigned, + `AUTO_INCREMENT` bigint(21) unsigned, + `CREATE_TIME` datetime, + `UPDATE_TIME` datetime, + `CHECK_TIME` datetime, + `TABLE_COLLATION` varchar(32), + `CHECKSUM` bigint(21) unsigned, + `CREATE_OPTIONS` varchar(2048), + `TABLE_COMMENT` varchar(2048) NOT NULL, + `MAX_INDEX_LENGTH` bigint(21) unsigned, + `TEMPORARY` varchar(1) +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.TABLES; Field Type Null Key Default Extra -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -TABLE_TYPE varchar(64) NO +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +TABLE_TYPE varchar(64) NO NULL ENGINE varchar(64) YES NULL VERSION bigint(21) unsigned YES NULL ROW_FORMAT varchar(10) YES NULL @@ -100,7 +100,7 @@ CHECK_TIME datetime YES NULL TABLE_COLLATION varchar(32) YES NULL CHECKSUM bigint(21) unsigned YES NULL CREATE_OPTIONS varchar(2048) YES NULL -TABLE_COMMENT varchar(2048) NO +TABLE_COMMENT varchar(2048) NO NULL MAX_INDEX_LENGTH bigint(21) unsigned YES NULL TEMPORARY varchar(1) YES NULL SELECT table_catalog, table_schema, table_name diff --git a/mysql-test/suite/funcs_1/r/is_tables_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_embedded.result index 1d8e276ba73c3..ab42aed82bd41 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_tables_embedded.result @@ -28,10 +28,10 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.TABLES; Field Type Null Key Default Extra -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -TABLE_TYPE varchar(64) NO +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +TABLE_TYPE varchar(64) NO NULL ENGINE varchar(64) YES NULL VERSION bigint(21) unsigned YES NULL ROW_FORMAT varchar(10) YES NULL @@ -48,42 +48,42 @@ CHECK_TIME datetime YES NULL TABLE_COLLATION varchar(32) YES NULL CHECKSUM bigint(21) unsigned YES NULL CREATE_OPTIONS varchar(2048) YES NULL -TABLE_COMMENT varchar(2048) NO +TABLE_COMMENT varchar(2048) NO NULL MAX_INDEX_LENGTH bigint(21) unsigned YES NULL TEMPORARY varchar(1) YES NULL SHOW CREATE TABLE information_schema.TABLES; Table Create Table TABLES CREATE TEMPORARY TABLE `TABLES` ( - `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', - `TABLE_TYPE` varchar(64) NOT NULL DEFAULT '', - `ENGINE` varchar(64) DEFAULT NULL, - `VERSION` bigint(21) unsigned DEFAULT NULL, - `ROW_FORMAT` varchar(10) DEFAULT NULL, - `TABLE_ROWS` bigint(21) unsigned DEFAULT NULL, - `AVG_ROW_LENGTH` bigint(21) unsigned DEFAULT NULL, - `DATA_LENGTH` bigint(21) unsigned DEFAULT NULL, - `MAX_DATA_LENGTH` bigint(21) unsigned DEFAULT NULL, - `INDEX_LENGTH` bigint(21) unsigned DEFAULT NULL, - `DATA_FREE` bigint(21) unsigned DEFAULT NULL, - `AUTO_INCREMENT` bigint(21) unsigned DEFAULT NULL, - `CREATE_TIME` datetime DEFAULT NULL, - `UPDATE_TIME` datetime DEFAULT NULL, - `CHECK_TIME` datetime DEFAULT NULL, - `TABLE_COLLATION` varchar(32) DEFAULT NULL, - `CHECKSUM` bigint(21) unsigned DEFAULT NULL, - `CREATE_OPTIONS` varchar(2048) DEFAULT NULL, - `TABLE_COMMENT` varchar(2048) NOT NULL DEFAULT '', - `MAX_INDEX_LENGTH` bigint(21) unsigned DEFAULT NULL, - `TEMPORARY` varchar(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `TABLE_CATALOG` varchar(512) NOT NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL, + `TABLE_NAME` varchar(64) NOT NULL, + `TABLE_TYPE` varchar(64) NOT NULL, + `ENGINE` varchar(64), + `VERSION` bigint(21) unsigned, + `ROW_FORMAT` varchar(10), + `TABLE_ROWS` bigint(21) unsigned, + `AVG_ROW_LENGTH` bigint(21) unsigned, + `DATA_LENGTH` bigint(21) unsigned, + `MAX_DATA_LENGTH` bigint(21) unsigned, + `INDEX_LENGTH` bigint(21) unsigned, + `DATA_FREE` bigint(21) unsigned, + `AUTO_INCREMENT` bigint(21) unsigned, + `CREATE_TIME` datetime, + `UPDATE_TIME` datetime, + `CHECK_TIME` datetime, + `TABLE_COLLATION` varchar(32), + `CHECKSUM` bigint(21) unsigned, + `CREATE_OPTIONS` varchar(2048), + `TABLE_COMMENT` varchar(2048) NOT NULL, + `MAX_INDEX_LENGTH` bigint(21) unsigned, + `TEMPORARY` varchar(1) +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.TABLES; Field Type Null Key Default Extra -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -TABLE_TYPE varchar(64) NO +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +TABLE_TYPE varchar(64) NO NULL ENGINE varchar(64) YES NULL VERSION bigint(21) unsigned YES NULL ROW_FORMAT varchar(10) YES NULL @@ -100,7 +100,7 @@ CHECK_TIME datetime YES NULL TABLE_COLLATION varchar(32) YES NULL CHECKSUM bigint(21) unsigned YES NULL CREATE_OPTIONS varchar(2048) YES NULL -TABLE_COMMENT varchar(2048) NO +TABLE_COMMENT varchar(2048) NO NULL MAX_INDEX_LENGTH bigint(21) unsigned YES NULL TEMPORARY varchar(1) YES NULL SELECT table_catalog, table_schema, table_name diff --git a/mysql-test/suite/funcs_1/r/is_triggers.result b/mysql-test/suite/funcs_1/r/is_triggers.result index c6485e58f44dc..6a1aed781dae2 100644 --- a/mysql-test/suite/funcs_1/r/is_triggers.result +++ b/mysql-test/suite/funcs_1/r/is_triggers.result @@ -30,78 +30,78 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.TRIGGERS; Field Type Null Key Default Extra -TRIGGER_CATALOG varchar(512) NO -TRIGGER_SCHEMA varchar(64) NO -TRIGGER_NAME varchar(64) NO -EVENT_MANIPULATION varchar(6) NO -EVENT_OBJECT_CATALOG varchar(512) NO -EVENT_OBJECT_SCHEMA varchar(64) NO -EVENT_OBJECT_TABLE varchar(64) NO -ACTION_ORDER bigint(4) NO 0 +TRIGGER_CATALOG varchar(512) NO NULL +TRIGGER_SCHEMA varchar(64) NO NULL +TRIGGER_NAME varchar(64) NO NULL +EVENT_MANIPULATION varchar(6) NO NULL +EVENT_OBJECT_CATALOG varchar(512) NO NULL +EVENT_OBJECT_SCHEMA varchar(64) NO NULL +EVENT_OBJECT_TABLE varchar(64) NO NULL +ACTION_ORDER bigint(4) NO NULL ACTION_CONDITION longtext YES NULL -ACTION_STATEMENT longtext NO -ACTION_ORIENTATION varchar(9) NO -ACTION_TIMING varchar(6) NO +ACTION_STATEMENT longtext NO NULL +ACTION_ORIENTATION varchar(9) NO NULL +ACTION_TIMING varchar(6) NO NULL ACTION_REFERENCE_OLD_TABLE varchar(64) YES NULL ACTION_REFERENCE_NEW_TABLE varchar(64) YES NULL -ACTION_REFERENCE_OLD_ROW varchar(3) NO -ACTION_REFERENCE_NEW_ROW varchar(3) NO +ACTION_REFERENCE_OLD_ROW varchar(3) NO NULL +ACTION_REFERENCE_NEW_ROW varchar(3) NO NULL CREATED datetime(2) YES NULL -SQL_MODE varchar(8192) NO -DEFINER varchar(384) NO -CHARACTER_SET_CLIENT varchar(32) NO -COLLATION_CONNECTION varchar(32) NO -DATABASE_COLLATION varchar(32) NO +SQL_MODE varchar(8192) NO NULL +DEFINER varchar(384) NO NULL +CHARACTER_SET_CLIENT varchar(32) NO NULL +COLLATION_CONNECTION varchar(32) NO NULL +DATABASE_COLLATION varchar(32) NO NULL SHOW CREATE TABLE information_schema.TRIGGERS; Table Create Table TRIGGERS CREATE TEMPORARY TABLE `TRIGGERS` ( - `TRIGGER_CATALOG` varchar(512) NOT NULL DEFAULT '', - `TRIGGER_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `TRIGGER_NAME` varchar(64) NOT NULL DEFAULT '', - `EVENT_MANIPULATION` varchar(6) NOT NULL DEFAULT '', - `EVENT_OBJECT_CATALOG` varchar(512) NOT NULL DEFAULT '', - `EVENT_OBJECT_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `EVENT_OBJECT_TABLE` varchar(64) NOT NULL DEFAULT '', - `ACTION_ORDER` bigint(4) NOT NULL DEFAULT 0, - `ACTION_CONDITION` longtext DEFAULT NULL, - `ACTION_STATEMENT` longtext NOT NULL DEFAULT '', - `ACTION_ORIENTATION` varchar(9) NOT NULL DEFAULT '', - `ACTION_TIMING` varchar(6) NOT NULL DEFAULT '', - `ACTION_REFERENCE_OLD_TABLE` varchar(64) DEFAULT NULL, - `ACTION_REFERENCE_NEW_TABLE` varchar(64) DEFAULT NULL, - `ACTION_REFERENCE_OLD_ROW` varchar(3) NOT NULL DEFAULT '', - `ACTION_REFERENCE_NEW_ROW` varchar(3) NOT NULL DEFAULT '', - `CREATED` datetime(2) DEFAULT NULL, - `SQL_MODE` varchar(8192) NOT NULL DEFAULT '', - `DEFINER` varchar(384) NOT NULL DEFAULT '', - `CHARACTER_SET_CLIENT` varchar(32) NOT NULL DEFAULT '', - `COLLATION_CONNECTION` varchar(32) NOT NULL DEFAULT '', - `DATABASE_COLLATION` varchar(32) NOT NULL DEFAULT '' -) DEFAULT CHARSET=utf8mb3 + `TRIGGER_CATALOG` varchar(512) NOT NULL, + `TRIGGER_SCHEMA` varchar(64) NOT NULL, + `TRIGGER_NAME` varchar(64) NOT NULL, + `EVENT_MANIPULATION` varchar(6) NOT NULL, + `EVENT_OBJECT_CATALOG` varchar(512) NOT NULL, + `EVENT_OBJECT_SCHEMA` varchar(64) NOT NULL, + `EVENT_OBJECT_TABLE` varchar(64) NOT NULL, + `ACTION_ORDER` bigint(4) NOT NULL, + `ACTION_CONDITION` longtext, + `ACTION_STATEMENT` longtext NOT NULL, + `ACTION_ORIENTATION` varchar(9) NOT NULL, + `ACTION_TIMING` varchar(6) NOT NULL, + `ACTION_REFERENCE_OLD_TABLE` varchar(64), + `ACTION_REFERENCE_NEW_TABLE` varchar(64), + `ACTION_REFERENCE_OLD_ROW` varchar(3) NOT NULL, + `ACTION_REFERENCE_NEW_ROW` varchar(3) NOT NULL, + `CREATED` datetime(2), + `SQL_MODE` varchar(8192) NOT NULL, + `DEFINER` varchar(384) NOT NULL, + `CHARACTER_SET_CLIENT` varchar(32) NOT NULL, + `COLLATION_CONNECTION` varchar(32) NOT NULL, + `DATABASE_COLLATION` varchar(32) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.TRIGGERS; Field Type Null Key Default Extra -TRIGGER_CATALOG varchar(512) NO -TRIGGER_SCHEMA varchar(64) NO -TRIGGER_NAME varchar(64) NO -EVENT_MANIPULATION varchar(6) NO -EVENT_OBJECT_CATALOG varchar(512) NO -EVENT_OBJECT_SCHEMA varchar(64) NO -EVENT_OBJECT_TABLE varchar(64) NO -ACTION_ORDER bigint(4) NO 0 +TRIGGER_CATALOG varchar(512) NO NULL +TRIGGER_SCHEMA varchar(64) NO NULL +TRIGGER_NAME varchar(64) NO NULL +EVENT_MANIPULATION varchar(6) NO NULL +EVENT_OBJECT_CATALOG varchar(512) NO NULL +EVENT_OBJECT_SCHEMA varchar(64) NO NULL +EVENT_OBJECT_TABLE varchar(64) NO NULL +ACTION_ORDER bigint(4) NO NULL ACTION_CONDITION longtext YES NULL -ACTION_STATEMENT longtext NO -ACTION_ORIENTATION varchar(9) NO -ACTION_TIMING varchar(6) NO +ACTION_STATEMENT longtext NO NULL +ACTION_ORIENTATION varchar(9) NO NULL +ACTION_TIMING varchar(6) NO NULL ACTION_REFERENCE_OLD_TABLE varchar(64) YES NULL ACTION_REFERENCE_NEW_TABLE varchar(64) YES NULL -ACTION_REFERENCE_OLD_ROW varchar(3) NO -ACTION_REFERENCE_NEW_ROW varchar(3) NO +ACTION_REFERENCE_OLD_ROW varchar(3) NO NULL +ACTION_REFERENCE_NEW_ROW varchar(3) NO NULL CREATED datetime(2) YES NULL -SQL_MODE varchar(8192) NO -DEFINER varchar(384) NO -CHARACTER_SET_CLIENT varchar(32) NO -COLLATION_CONNECTION varchar(32) NO -DATABASE_COLLATION varchar(32) NO +SQL_MODE varchar(8192) NO NULL +DEFINER varchar(384) NO NULL +CHARACTER_SET_CLIENT varchar(32) NO NULL +COLLATION_CONNECTION varchar(32) NO NULL +DATABASE_COLLATION varchar(32) NO NULL SELECT * FROM information_schema.triggers WHERE trigger_catalog IS NOT NULL OR event_object_catalog IS NOT NULL OR action_condition IS NOT NULL OR action_reference_old_table IS NOT NULL @@ -172,9 +172,9 @@ Grants for testuser4@localhost GRANT TRIGGER ON *.* TO `testuser4`@`localhost` # TRIGGER Privilege + no SELECT Privilege on t1 --> result for query SELECT * FROM db_datadict.t1; -ERROR 42000: SELECT command denied to user 'testuser4'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'testuser4'@'localhost' for table `db_datadict`.`t1` DESC db_datadict.t1; -ERROR 42000: SELECT command denied to user 'testuser4'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'testuser4'@'localhost' for table `db_datadict`.`t1` SELECT * FROM information_schema.triggers WHERE trigger_name = 'trg1'; TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION diff --git a/mysql-test/suite/funcs_1/r/is_triggers_embedded.result b/mysql-test/suite/funcs_1/r/is_triggers_embedded.result index 5a681db49b63d..a35297899aaf3 100644 --- a/mysql-test/suite/funcs_1/r/is_triggers_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_triggers_embedded.result @@ -30,78 +30,78 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.TRIGGERS; Field Type Null Key Default Extra -TRIGGER_CATALOG varchar(512) NO -TRIGGER_SCHEMA varchar(64) NO -TRIGGER_NAME varchar(64) NO -EVENT_MANIPULATION varchar(6) NO -EVENT_OBJECT_CATALOG varchar(512) NO -EVENT_OBJECT_SCHEMA varchar(64) NO -EVENT_OBJECT_TABLE varchar(64) NO -ACTION_ORDER bigint(4) NO 0 +TRIGGER_CATALOG varchar(512) NO NULL +TRIGGER_SCHEMA varchar(64) NO NULL +TRIGGER_NAME varchar(64) NO NULL +EVENT_MANIPULATION varchar(6) NO NULL +EVENT_OBJECT_CATALOG varchar(512) NO NULL +EVENT_OBJECT_SCHEMA varchar(64) NO NULL +EVENT_OBJECT_TABLE varchar(64) NO NULL +ACTION_ORDER bigint(4) NO NULL ACTION_CONDITION longtext YES NULL -ACTION_STATEMENT longtext NO -ACTION_ORIENTATION varchar(9) NO -ACTION_TIMING varchar(6) NO +ACTION_STATEMENT longtext NO NULL +ACTION_ORIENTATION varchar(9) NO NULL +ACTION_TIMING varchar(6) NO NULL ACTION_REFERENCE_OLD_TABLE varchar(64) YES NULL ACTION_REFERENCE_NEW_TABLE varchar(64) YES NULL -ACTION_REFERENCE_OLD_ROW varchar(3) NO -ACTION_REFERENCE_NEW_ROW varchar(3) NO +ACTION_REFERENCE_OLD_ROW varchar(3) NO NULL +ACTION_REFERENCE_NEW_ROW varchar(3) NO NULL CREATED datetime(2) YES NULL -SQL_MODE varchar(8192) NO -DEFINER varchar(384) NO -CHARACTER_SET_CLIENT varchar(32) NO -COLLATION_CONNECTION varchar(32) NO -DATABASE_COLLATION varchar(32) NO +SQL_MODE varchar(8192) NO NULL +DEFINER varchar(384) NO NULL +CHARACTER_SET_CLIENT varchar(32) NO NULL +COLLATION_CONNECTION varchar(32) NO NULL +DATABASE_COLLATION varchar(32) NO NULL SHOW CREATE TABLE information_schema.TRIGGERS; Table Create Table TRIGGERS CREATE TEMPORARY TABLE `TRIGGERS` ( - `TRIGGER_CATALOG` varchar(512) NOT NULL DEFAULT '', - `TRIGGER_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `TRIGGER_NAME` varchar(64) NOT NULL DEFAULT '', - `EVENT_MANIPULATION` varchar(6) NOT NULL DEFAULT '', - `EVENT_OBJECT_CATALOG` varchar(512) NOT NULL DEFAULT '', - `EVENT_OBJECT_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `EVENT_OBJECT_TABLE` varchar(64) NOT NULL DEFAULT '', - `ACTION_ORDER` bigint(4) NOT NULL DEFAULT 0, - `ACTION_CONDITION` longtext DEFAULT NULL, - `ACTION_STATEMENT` longtext NOT NULL DEFAULT '', - `ACTION_ORIENTATION` varchar(9) NOT NULL DEFAULT '', - `ACTION_TIMING` varchar(6) NOT NULL DEFAULT '', - `ACTION_REFERENCE_OLD_TABLE` varchar(64) DEFAULT NULL, - `ACTION_REFERENCE_NEW_TABLE` varchar(64) DEFAULT NULL, - `ACTION_REFERENCE_OLD_ROW` varchar(3) NOT NULL DEFAULT '', - `ACTION_REFERENCE_NEW_ROW` varchar(3) NOT NULL DEFAULT '', - `CREATED` datetime(2) DEFAULT NULL, - `SQL_MODE` varchar(8192) NOT NULL DEFAULT '', - `DEFINER` varchar(384) NOT NULL DEFAULT '', - `CHARACTER_SET_CLIENT` varchar(32) NOT NULL DEFAULT '', - `COLLATION_CONNECTION` varchar(32) NOT NULL DEFAULT '', - `DATABASE_COLLATION` varchar(32) NOT NULL DEFAULT '' -) DEFAULT CHARSET=utf8mb3 + `TRIGGER_CATALOG` varchar(512) NOT NULL, + `TRIGGER_SCHEMA` varchar(64) NOT NULL, + `TRIGGER_NAME` varchar(64) NOT NULL, + `EVENT_MANIPULATION` varchar(6) NOT NULL, + `EVENT_OBJECT_CATALOG` varchar(512) NOT NULL, + `EVENT_OBJECT_SCHEMA` varchar(64) NOT NULL, + `EVENT_OBJECT_TABLE` varchar(64) NOT NULL, + `ACTION_ORDER` bigint(4) NOT NULL, + `ACTION_CONDITION` longtext, + `ACTION_STATEMENT` longtext NOT NULL, + `ACTION_ORIENTATION` varchar(9) NOT NULL, + `ACTION_TIMING` varchar(6) NOT NULL, + `ACTION_REFERENCE_OLD_TABLE` varchar(64), + `ACTION_REFERENCE_NEW_TABLE` varchar(64), + `ACTION_REFERENCE_OLD_ROW` varchar(3) NOT NULL, + `ACTION_REFERENCE_NEW_ROW` varchar(3) NOT NULL, + `CREATED` datetime(2), + `SQL_MODE` varchar(8192) NOT NULL, + `DEFINER` varchar(384) NOT NULL, + `CHARACTER_SET_CLIENT` varchar(32) NOT NULL, + `COLLATION_CONNECTION` varchar(32) NOT NULL, + `DATABASE_COLLATION` varchar(32) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.TRIGGERS; Field Type Null Key Default Extra -TRIGGER_CATALOG varchar(512) NO -TRIGGER_SCHEMA varchar(64) NO -TRIGGER_NAME varchar(64) NO -EVENT_MANIPULATION varchar(6) NO -EVENT_OBJECT_CATALOG varchar(512) NO -EVENT_OBJECT_SCHEMA varchar(64) NO -EVENT_OBJECT_TABLE varchar(64) NO -ACTION_ORDER bigint(4) NO 0 +TRIGGER_CATALOG varchar(512) NO NULL +TRIGGER_SCHEMA varchar(64) NO NULL +TRIGGER_NAME varchar(64) NO NULL +EVENT_MANIPULATION varchar(6) NO NULL +EVENT_OBJECT_CATALOG varchar(512) NO NULL +EVENT_OBJECT_SCHEMA varchar(64) NO NULL +EVENT_OBJECT_TABLE varchar(64) NO NULL +ACTION_ORDER bigint(4) NO NULL ACTION_CONDITION longtext YES NULL -ACTION_STATEMENT longtext NO -ACTION_ORIENTATION varchar(9) NO -ACTION_TIMING varchar(6) NO +ACTION_STATEMENT longtext NO NULL +ACTION_ORIENTATION varchar(9) NO NULL +ACTION_TIMING varchar(6) NO NULL ACTION_REFERENCE_OLD_TABLE varchar(64) YES NULL ACTION_REFERENCE_NEW_TABLE varchar(64) YES NULL -ACTION_REFERENCE_OLD_ROW varchar(3) NO -ACTION_REFERENCE_NEW_ROW varchar(3) NO +ACTION_REFERENCE_OLD_ROW varchar(3) NO NULL +ACTION_REFERENCE_NEW_ROW varchar(3) NO NULL CREATED datetime(2) YES NULL -SQL_MODE varchar(8192) NO -DEFINER varchar(384) NO -CHARACTER_SET_CLIENT varchar(32) NO -COLLATION_CONNECTION varchar(32) NO -DATABASE_COLLATION varchar(32) NO +SQL_MODE varchar(8192) NO NULL +DEFINER varchar(384) NO NULL +CHARACTER_SET_CLIENT varchar(32) NO NULL +COLLATION_CONNECTION varchar(32) NO NULL +DATABASE_COLLATION varchar(32) NO NULL SELECT * FROM information_schema.triggers WHERE trigger_catalog IS NOT NULL OR event_object_catalog IS NOT NULL OR action_condition IS NOT NULL OR action_reference_old_table IS NOT NULL 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 4363b2851e779..4228c744e46d0 100644 --- a/mysql-test/suite/funcs_1/r/is_user_privileges.result +++ b/mysql-test/suite/funcs_1/r/is_user_privileges.result @@ -28,24 +28,24 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.USER_PRIVILEGES; Field Type Null Key Default Extra -GRANTEE varchar(385) NO -TABLE_CATALOG varchar(512) NO -PRIVILEGE_TYPE varchar(64) NO -IS_GRANTABLE varchar(3) NO +GRANTEE varchar(385) NO NULL +TABLE_CATALOG varchar(512) NO NULL +PRIVILEGE_TYPE varchar(64) NO NULL +IS_GRANTABLE varchar(3) NO NULL SHOW CREATE TABLE information_schema.USER_PRIVILEGES; Table Create Table USER_PRIVILEGES CREATE TEMPORARY TABLE `USER_PRIVILEGES` ( - `GRANTEE` varchar(385) NOT NULL DEFAULT '', - `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `PRIVILEGE_TYPE` varchar(64) NOT NULL DEFAULT '', - `IS_GRANTABLE` varchar(3) NOT NULL DEFAULT '' -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `GRANTEE` varchar(385) NOT NULL, + `TABLE_CATALOG` varchar(512) NOT NULL, + `PRIVILEGE_TYPE` varchar(64) NOT NULL, + `IS_GRANTABLE` varchar(3) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.USER_PRIVILEGES; Field Type Null Key Default Extra -GRANTEE varchar(385) NO -TABLE_CATALOG varchar(512) NO -PRIVILEGE_TYPE varchar(64) NO -IS_GRANTABLE varchar(3) NO +GRANTEE varchar(385) NO NULL +TABLE_CATALOG varchar(512) NO NULL +PRIVILEGE_TYPE varchar(64) NO NULL +IS_GRANTABLE varchar(3) NO NULL SELECT grantee, table_catalog, privilege_type FROM information_schema.user_privileges WHERE table_catalog IS NULL OR table_catalog <> 'def'; @@ -367,7 +367,7 @@ PRIVILEGE_TYPE UPDATE IS_GRANTABLE NO SELECT host,user,json_detailed(priv) FROM mysql.global_priv WHERE user LIKE 'testuser%' ORDER BY host, user; -ERROR 42000: SELECT command denied to user 'testuser2'@'localhost' for table 'global_priv' +ERROR 42000: SELECT command denied to user 'testuser2'@'localhost' for table `mysql`.`global_priv` SHOW GRANTS; Grants for testuser2@localhost GRANT INSERT, UPDATE ON *.* TO `testuser2`@`localhost` @@ -381,7 +381,7 @@ PRIVILEGE_TYPE USAGE IS_GRANTABLE NO SELECT host,user,json_detailed(priv) FROM mysql.global_priv WHERE user LIKE 'testuser%' ORDER BY host, user; -ERROR 42000: SELECT command denied to user 'testuser3'@'localhost' for table 'global_priv' +ERROR 42000: SELECT command denied to user 'testuser3'@'localhost' for table `mysql`.`global_priv` SHOW GRANTS; Grants for testuser3@localhost GRANT USAGE ON *.* TO `testuser3`@`localhost` @@ -447,12 +447,12 @@ PRIVILEGE_TYPE USAGE IS_GRANTABLE NO SELECT host,user,json_detailed(priv) FROM mysql.global_priv WHERE user LIKE 'testuser%' ORDER BY host, user; -ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table 'global_priv' +ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table `mysql`.`global_priv` SHOW GRANTS; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` CREATE TABLE db_datadict.tb_55 ( c1 TEXT ); -ERROR 42000: CREATE command denied to user 'testuser1'@'localhost' for table 'tb_55' +ERROR 42000: CREATE command denied to user 'testuser1'@'localhost' for table `db_datadict`.`tb_55` SELECT * FROM information_schema.user_privileges WHERE grantee LIKE '''testuser%''' ORDER BY grantee, table_catalog, privilege_type; @@ -462,12 +462,12 @@ PRIVILEGE_TYPE USAGE IS_GRANTABLE NO SELECT host,user,json_detailed(priv) FROM mysql.global_priv WHERE user LIKE 'testuser%' ORDER BY host, user; -ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table 'global_priv' +ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table `mysql`.`global_priv` SHOW GRANTS; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` CREATE TABLE db_datadict.tb_66 ( c1 TEXT ); -ERROR 42000: CREATE command denied to user 'testuser1'@'localhost' for table 'tb_66' +ERROR 42000: CREATE command denied to user 'testuser1'@'localhost' for table `db_datadict`.`tb_66` # Add ALL on db_datadict.* (and select on mysql.global_priv) to testuser1; connection default; @@ -564,7 +564,7 @@ GRANT USAGE ON *.* TO `testuser1`@`localhost` GRANT ALL PRIVILEGES ON `db_datadict`.* TO `testuser1`@`localhost` WITH GRANT OPTION GRANT SELECT ON `mysql`.`global_priv` TO `testuser1`@`localhost` CREATE TABLE db_datadict.tb_56 ( c1 TEXT ); -ERROR 42000: CREATE command denied to user 'testuser1'@'localhost' for table 'tb_56' +ERROR 42000: CREATE command denied to user 'testuser1'@'localhost' for table `db_datadict`.`tb_56` USE db_datadict; SELECT * FROM information_schema.user_privileges WHERE grantee LIKE '''testuser%''' @@ -671,7 +671,7 @@ PRIVILEGE_TYPE USAGE IS_GRANTABLE NO SELECT host,user,json_detailed(priv) FROM mysql.global_priv WHERE user LIKE 'testuser%' ORDER BY host, user; -ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table 'global_priv' +ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table `mysql`.`global_priv` SHOW GRANTS; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` diff --git a/mysql-test/suite/funcs_1/r/is_views.result b/mysql-test/suite/funcs_1/r/is_views.result index 2f0068a29f73b..c42e4867d75d5 100644 --- a/mysql-test/suite/funcs_1/r/is_views.result +++ b/mysql-test/suite/funcs_1/r/is_views.result @@ -28,45 +28,45 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.VIEWS; Field Type Null Key Default Extra -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -VIEW_DEFINITION longtext NO -CHECK_OPTION varchar(8) NO -IS_UPDATABLE varchar(3) NO -DEFINER varchar(384) NO -SECURITY_TYPE varchar(7) NO -CHARACTER_SET_CLIENT varchar(32) NO -COLLATION_CONNECTION varchar(32) NO -ALGORITHM varchar(10) NO +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +VIEW_DEFINITION longtext NO NULL +CHECK_OPTION varchar(8) NO NULL +IS_UPDATABLE varchar(3) NO NULL +DEFINER varchar(384) NO NULL +SECURITY_TYPE varchar(7) NO NULL +CHARACTER_SET_CLIENT varchar(32) NO NULL +COLLATION_CONNECTION varchar(32) NO NULL +ALGORITHM varchar(10) NO NULL SHOW CREATE TABLE information_schema.VIEWS; Table Create Table VIEWS CREATE TEMPORARY TABLE `VIEWS` ( - `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', - `VIEW_DEFINITION` longtext NOT NULL DEFAULT '', - `CHECK_OPTION` varchar(8) NOT NULL DEFAULT '', - `IS_UPDATABLE` varchar(3) NOT NULL DEFAULT '', - `DEFINER` varchar(384) NOT NULL DEFAULT '', - `SECURITY_TYPE` varchar(7) NOT NULL DEFAULT '', - `CHARACTER_SET_CLIENT` varchar(32) NOT NULL DEFAULT '', - `COLLATION_CONNECTION` varchar(32) NOT NULL DEFAULT '', - `ALGORITHM` varchar(10) NOT NULL DEFAULT '' -) DEFAULT CHARSET=utf8mb3 + `TABLE_CATALOG` varchar(512) NOT NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL, + `TABLE_NAME` varchar(64) NOT NULL, + `VIEW_DEFINITION` longtext NOT NULL, + `CHECK_OPTION` varchar(8) NOT NULL, + `IS_UPDATABLE` varchar(3) NOT NULL, + `DEFINER` varchar(384) NOT NULL, + `SECURITY_TYPE` varchar(7) NOT NULL, + `CHARACTER_SET_CLIENT` varchar(32) NOT NULL, + `COLLATION_CONNECTION` varchar(32) NOT NULL, + `ALGORITHM` varchar(10) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.VIEWS; Field Type Null Key Default Extra -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -VIEW_DEFINITION longtext NO -CHECK_OPTION varchar(8) NO -IS_UPDATABLE varchar(3) NO -DEFINER varchar(384) NO -SECURITY_TYPE varchar(7) NO -CHARACTER_SET_CLIENT varchar(32) NO -COLLATION_CONNECTION varchar(32) NO -ALGORITHM varchar(10) NO +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +VIEW_DEFINITION longtext NO NULL +CHECK_OPTION varchar(8) NO NULL +IS_UPDATABLE varchar(3) NO NULL +DEFINER varchar(384) NO NULL +SECURITY_TYPE varchar(7) NO NULL +CHARACTER_SET_CLIENT varchar(32) NO NULL +COLLATION_CONNECTION varchar(32) NO NULL +ALGORITHM varchar(10) NO NULL SELECT table_catalog, table_schema, table_name FROM information_schema.views WHERE table_catalog <> 'def'; table_catalog table_schema table_name diff --git a/mysql-test/suite/funcs_1/r/is_views_embedded.result b/mysql-test/suite/funcs_1/r/is_views_embedded.result index 319500416357e..72fcead6bcd75 100644 --- a/mysql-test/suite/funcs_1/r/is_views_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_views_embedded.result @@ -28,45 +28,45 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.VIEWS; Field Type Null Key Default Extra -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -VIEW_DEFINITION longtext NO -CHECK_OPTION varchar(8) NO -IS_UPDATABLE varchar(3) NO -DEFINER varchar(384) NO -SECURITY_TYPE varchar(7) NO -CHARACTER_SET_CLIENT varchar(32) NO -COLLATION_CONNECTION varchar(32) NO -ALGORITHM varchar(10) NO +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +VIEW_DEFINITION longtext NO NULL +CHECK_OPTION varchar(8) NO NULL +IS_UPDATABLE varchar(3) NO NULL +DEFINER varchar(384) NO NULL +SECURITY_TYPE varchar(7) NO NULL +CHARACTER_SET_CLIENT varchar(32) NO NULL +COLLATION_CONNECTION varchar(32) NO NULL +ALGORITHM varchar(10) NO NULL SHOW CREATE TABLE information_schema.VIEWS; Table Create Table VIEWS CREATE TEMPORARY TABLE `VIEWS` ( - `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', - `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', - `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', - `VIEW_DEFINITION` longtext NOT NULL DEFAULT '', - `CHECK_OPTION` varchar(8) NOT NULL DEFAULT '', - `IS_UPDATABLE` varchar(3) NOT NULL DEFAULT '', - `DEFINER` varchar(384) NOT NULL DEFAULT '', - `SECURITY_TYPE` varchar(7) NOT NULL DEFAULT '', - `CHARACTER_SET_CLIENT` varchar(32) NOT NULL DEFAULT '', - `COLLATION_CONNECTION` varchar(32) NOT NULL DEFAULT '', - `ALGORITHM` varchar(10) NOT NULL DEFAULT '' -) DEFAULT CHARSET=utf8mb3 + `TABLE_CATALOG` varchar(512) NOT NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL, + `TABLE_NAME` varchar(64) NOT NULL, + `VIEW_DEFINITION` longtext NOT NULL, + `CHECK_OPTION` varchar(8) NOT NULL, + `IS_UPDATABLE` varchar(3) NOT NULL, + `DEFINER` varchar(384) NOT NULL, + `SECURITY_TYPE` varchar(7) NOT NULL, + `CHARACTER_SET_CLIENT` varchar(32) NOT NULL, + `COLLATION_CONNECTION` varchar(32) NOT NULL, + `ALGORITHM` varchar(10) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW COLUMNS FROM information_schema.VIEWS; Field Type Null Key Default Extra -TABLE_CATALOG varchar(512) NO -TABLE_SCHEMA varchar(64) NO -TABLE_NAME varchar(64) NO -VIEW_DEFINITION longtext NO -CHECK_OPTION varchar(8) NO -IS_UPDATABLE varchar(3) NO -DEFINER varchar(384) NO -SECURITY_TYPE varchar(7) NO -CHARACTER_SET_CLIENT varchar(32) NO -COLLATION_CONNECTION varchar(32) NO -ALGORITHM varchar(10) NO +TABLE_CATALOG varchar(512) NO NULL +TABLE_SCHEMA varchar(64) NO NULL +TABLE_NAME varchar(64) NO NULL +VIEW_DEFINITION longtext NO NULL +CHECK_OPTION varchar(8) NO NULL +IS_UPDATABLE varchar(3) NO NULL +DEFINER varchar(384) NO NULL +SECURITY_TYPE varchar(7) NO NULL +CHARACTER_SET_CLIENT varchar(32) NO NULL +COLLATION_CONNECTION varchar(32) NO NULL +ALGORITHM varchar(10) NO NULL SELECT table_catalog, table_schema, table_name FROM information_schema.views WHERE table_catalog <> 'def'; table_catalog table_schema table_name diff --git a/mysql-test/suite/funcs_1/r/memory_func_view.result b/mysql-test/suite/funcs_1/r/memory_func_view.result index 6dd12ddc11c36..e9b88b9309ab8 100644 --- a/mysql-test/suite/funcs_1/r/memory_func_view.result +++ b/mysql-test/suite/funcs_1/r/memory_func_view.result @@ -3412,11 +3412,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 29 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection @@ -3432,11 +3429,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 29 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' DROP VIEW v1; @@ -3454,11 +3448,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 28 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL 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 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL 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 DECIMAL 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 DECIMAL value: '-3333.3333\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' @@ -3476,11 +3467,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 28 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL 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 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL 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 DECIMAL 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 DECIMAL value: '-3333.3333\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' @@ -3500,11 +3488,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 27 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection @@ -3520,11 +3505,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 27 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -3542,11 +3524,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 26 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection @@ -3562,11 +3541,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 26 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_06.result b/mysql-test/suite/funcs_1/r/memory_storedproc_06.result index ce1ee82e89a26..694cfc0158f1d 100644 --- a/mysql-test/suite/funcs_1/r/memory_storedproc_06.result +++ b/mysql-test/suite/funcs_1/r/memory_storedproc_06.result @@ -221,31 +221,31 @@ connect user5_2, localhost, user_2, , db_storedproc_1; user_2@localhost db_storedproc_1 CALL sp5_s_i(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_ins(); -ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_sel(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` connection default; root@localhost db_storedproc_1 CALL sp5_sel(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` grant insert on db_storedproc_1.* to 'user_1'@'localhost'; flush privileges; connection user5_2; user_2@localhost db_storedproc_1 CALL sp5_s_i(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_ins(); CALL sp5_sel(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` connection default; root@localhost db_storedproc_1 CALL sp5_sel(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` grant SELECT on db_storedproc_1.* to 'user_1'@'localhost'; flush privileges; connection user5_2; @@ -276,9 +276,9 @@ inserted outside of SP NULL inserted from sp5_ins 2000-10-00 inserted from sp5_s_i 2000-10-00 inserted from sp5_ins 2000-10-00 -ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_ins(); -ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_sel(); c1 c2 c3 inserted outside of SP NULL @@ -294,11 +294,11 @@ connection user5_2; user_2@localhost db_storedproc_1 CALL sp5_s_i(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_ins(); -ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_sel(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` disconnect user5_2; connection default; @@ -348,9 +348,9 @@ user_2@localhost db_storedproc_1 CALL sp3166_s_i(); c1 inserted outside SP -ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table 't3166' +ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table `db_storedproc_1`.`t3166` CALL sp3166_ins(); -ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table 't3166' +ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table `db_storedproc_1`.`t3166` CALL sp3166_sel(); c1 inserted outside SP @@ -390,10 +390,10 @@ connect user6_4, localhost, user_2, , db_storedproc_1; user_2@localhost db_storedproc_1 CALL sp3166_s_i(); -ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table 't3166' +ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table `db_storedproc_1`.`t3166` CALL sp3166_ins(); CALL sp3166_sel(); -ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table 't3166' +ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table `db_storedproc_1`.`t3166` disconnect user6_4; connection default; CALL sp3166_s_i(); diff --git a/mysql-test/suite/funcs_1/r/memory_trig_03.result b/mysql-test/suite/funcs_1/r/memory_trig_03.result index 68969afc97f5f..18d55140d67c4 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_03.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_03.result @@ -99,7 +99,7 @@ test_noprivs@localhost use priv_db; create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.2_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table `priv_db`.`t1` connection default; use priv_db; insert into t1 (f1) values ('insert 3.5.3.2-no'); @@ -135,7 +135,7 @@ Testcase 3.5.3.6: connection no_privs; use priv_db; drop trigger trg1_2; -ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table `priv_db`.`t1` connection default; use priv_db; insert into t1 (f1) values ('insert 3.5.3.6-yes'); @@ -391,7 +391,7 @@ connection no_privs_424d; show grants; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT SELECT (f1), INSERT (f1) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` +GRANT SELECT (`f1`), INSERT (`f1`) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` use priv_db; create trigger trg4d_1 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-1d'; @@ -413,7 +413,7 @@ connection yes_privs_424d; show grants; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT UPDATE (f1) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` +GRANT UPDATE (`f1`) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` use priv_db; create trigger trg4d_2 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-2d'; @@ -618,14 +618,14 @@ grant UPDATE (f1), INSERT (f1) on priv_db.t1 to test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` +GRANT INSERT (`f1`), UPDATE (`f1`) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER on *.* to test_yesprivs@localhost; grant SELECT (f1) on priv_db.t1 to test_yesprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` +GRANT INSERT (`f1`), UPDATE (`f1`) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` connect no_privs_425d,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; connect yes_privs_425d,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection default; @@ -633,7 +633,7 @@ connection no_privs_425d; show grants; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` +GRANT INSERT (`f1`), UPDATE (`f1`) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` use priv_db; create trigger trg5d_1 before INSERT on t1 for each row set @test_var= new.f1; @@ -649,7 +649,7 @@ connection yes_privs_425d; show grants; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT SELECT (f1) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` +GRANT SELECT (`f1`) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` use priv_db; create trigger trg5d_2 before INSERT on t1 for each row set @test_var= new.f1; @@ -688,7 +688,7 @@ insert into t2 values (new.f1); connection default; use priv_db; insert into t1 (f1) values (4); -ERROR 42000: INSERT command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: INSERT command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` revoke SELECT on priv_db.t2 from test_yesprivs@localhost; grant INSERT on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (4); @@ -706,7 +706,7 @@ update t2 set f2=new.f1-1; connection default; use priv_db; insert into t1 (f1) values (2); -ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` revoke INSERT on priv_db.t2 from test_yesprivs@localhost; grant UPDATE on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (2); @@ -725,7 +725,7 @@ select f2 into @aaa from t2 where f2=new.f1; connection default; use priv_db; insert into t1 (f1) values (1); -ERROR 42000: SELECT command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` revoke UPDATE on priv_db.t2 from test_yesprivs@localhost; grant SELECT on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (1); @@ -748,7 +748,7 @@ delete from t2; connection default; use priv_db; insert into t1 (f1) values (1); -ERROR 42000: DELETE command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: DELETE command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` revoke SELECT on priv_db.t2 from test_yesprivs@localhost; grant DELETE on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (1); diff --git a/mysql-test/suite/funcs_1/r/memory_trig_03e.result b/mysql-test/suite/funcs_1/r/memory_trig_03e.result index d100bdfc824cf..684685480c2c9 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_03e.result @@ -32,7 +32,7 @@ no trigger privilege on db level for create: use priv_db; create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; use priv_db; insert into t1 (f1) values ('insert-yes'); @@ -108,7 +108,7 @@ current_user test_yesprivs@localhost use priv_db; drop trigger trg1_2; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connection no_privs; select current_user; current_user @@ -118,7 +118,7 @@ use priv_db; no trigger privilege at activation time: ---------------------------------------- insert into t1 (f1) values ('insert-yes'); -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 insert-yes @@ -156,7 +156,7 @@ Grants for test_yesprivs@localhost GRANT USAGE ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, UPDATE, TRIGGER ON `priv_db`.* TO `test_yesprivs`@`localhost` drop trigger trg1_2; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` takes effect after use priv_db: ------------------------------- @@ -196,14 +196,14 @@ test_yesprivs@localhost use no_priv_db; create trigger trg1_3 before INSERT on t1 for each row set new.f1 = 'trig 1_3-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `no_priv_db`.`t1` use priv_db; create trigger trg1_3 before INSERT on t1 for each row set new.f1 = 'trig 1_3-yes'; use no_priv_db; create trigger trg1_4 before UPDATE on t1 for each row set new.f1 = 'trig 1_4-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `no_priv_db`.`t1` use priv_db; create trigger trg1_4 before UPDATE on t1 for each row set new.f1 = 'trig 1_4-yes'; @@ -303,7 +303,7 @@ Tables_in_priv_db t1 create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connection no_privs; select current_user; current_user @@ -377,7 +377,7 @@ select current_user; current_user test_yesprivs@localhost drop trigger trg1_2; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` no trigger privilege at activation time: ---------------------------------------- @@ -386,7 +386,7 @@ select current_user; current_user test_noprivs@localhost insert into t1 (f1) values ('insert5-no'); -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 insert1-yes @@ -477,12 +477,12 @@ current_user test_yesprivs@localhost create trigger trg2_1 before INSERT on t2 for each row set new.f1 = 'trig 2_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` create trigger trg1_3 before INSERT on t1 for each row set new.f1 = 'trig 1_3-yes'; create trigger trg2_2 before UPDATE on t2 for each row set new.f1 = 'trig 2_2-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` create trigger trg1_4 before UPDATE on t1 for each row set new.f1 = 'trig 1_4-yes'; show triggers; @@ -616,7 +616,7 @@ Trigger Event Table Statement Timing Created sql_mode Definer character_set_clie select * from information_schema.triggers; TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION drop trigger trg1_1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connection default; select current_user; current_user @@ -636,7 +636,7 @@ current_user test_yesprivs@localhost create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connection no_privs; select current_user; current_user @@ -672,11 +672,11 @@ set new.f1 = 'trig 1_2-yes'; create trigger no_priv_db.trg1_9 before insert on no_priv_db.t1 for each row set new.f1 = 'trig 1_9-yes'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `no_priv_db`.`t1` use no_priv_db; create trigger trg1_2 before INSERT on t1 for each row set new.f1 = 'trig 1_2-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `no_priv_db`.`t1` create trigger priv_db.trg1_9 before UPDATE on priv_db.t1 for each row set new.f1 = 'trig 1_9-yes'; @@ -700,7 +700,7 @@ select f1 from t1 order by f1; f1 insert-yes drop trigger priv_db.trg1_9; -ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table `priv_db`.`t1` connection default; select current_user; current_user @@ -709,7 +709,7 @@ drop trigger priv_db.trg1_9; revoke TRIGGER on priv_db.* from test_yesprivs@localhost; use priv_db; insert into t1 (f1) values ('insert-yes'); -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 insert-yes @@ -729,7 +729,7 @@ test_yesprivs@localhost use no_priv_db; create trigger trg1_2 before INSERT on t1 for each row set new.f1 = 'trig 1_2-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `no_priv_db`.`t1` connection no_privs; select current_user; current_user @@ -844,7 +844,7 @@ set new.f1 = 'trig 2_1-yes'; use priv2_db; create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig1_1-yes'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv2_db`.`t1` connection no_privs; select current_user; current_user @@ -919,7 +919,7 @@ test_yesprivs@localhost use priv1_db; create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv1_db`.`t1` connection default; select current_user; current_user @@ -946,7 +946,7 @@ create trigger trg1_2 before INSERT on t1 for each row set new.f1 = 'trig 1_2-yes'; create trigger trg2_1 before INSERT on t2 for each row set new.f1 = 'trig 2_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv1_db`.`t2` connection no_privs; select current_user; current_user @@ -987,7 +987,7 @@ current_user test_yesprivs@localhost create trigger trg2_1 before INSERT on t2 for each row set new.f1 = 'trig 2_1-yes'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv1_db`.`t2` use priv1_db; create trigger trg2_1 before INSERT on t2 for each row set new.f1 = 'trig 2_1-yes'; @@ -1111,7 +1111,7 @@ select current_user; current_user test_yesprivs@localhost execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1123,7 +1123,7 @@ current_user test_useprivs@localhost prepare ins1 from 'insert into t1 (f1) values (''insert5-no'')'; execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1174,7 +1174,7 @@ select current_user; current_user test_yesprivs@localhost execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1186,7 +1186,7 @@ select current_user; current_user test_useprivs@localhost execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1241,7 +1241,7 @@ select current_user; current_user test_yesprivs@localhost execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1256,7 +1256,7 @@ select current_user; current_user test_useprivs@localhost execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1324,11 +1324,11 @@ current_user test_yesprivs@localhost use priv_db; insert into t1 (f1) values ('insert-no'); -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 drop trigger trg1_0; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connection default; select current_user; current_user @@ -1480,8 +1480,8 @@ show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT USAGE ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT TRIGGER ON `priv_db`.* TO `test_yesprivs`@`localhost` -GRANT SELECT (f1), INSERT ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` -GRANT SELECT (f1), INSERT, UPDATE (f1) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` +GRANT SELECT (`f1`), INSERT ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` +GRANT SELECT (`f1`), INSERT, UPDATE (`f1`) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` connection yes_privs; select current_user; current_user @@ -1577,12 +1577,12 @@ update t1 set f1 = 'update6_no' where f1 like '%insert%'; update t2 set f1 = 'update6_no' where f1 like '%insert%'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` update t1 set f1 = 'update7_no' where f1 like '%insert%'; update t2 set f1 = 'update7_no' where f1 like '%insert%'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1608,7 +1608,7 @@ test_noprivs@localhost update t1 set f1 = 'update8-no', f2 = 'update8-no' where f2 like '%yes'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select * from t1 order by f1,f2,f3; f1 f2 f3 trig 1_1-yes NULL NULL @@ -1631,8 +1631,8 @@ to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT USAGE ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT SELECT (f1), INSERT, UPDATE ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` -GRANT SELECT, SELECT (f1), INSERT, UPDATE (f3, f2), TRIGGER ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` +GRANT SELECT (`f1`), INSERT, UPDATE ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` +GRANT SELECT, SELECT (`f1`), INSERT, UPDATE (`f3`, `f2`), TRIGGER ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` connection yes_privs; select current_user; current_user @@ -1674,15 +1674,15 @@ to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT USAGE ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT SELECT (f1), INSERT, UPDATE ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` -GRANT SELECT, SELECT (f1), INSERT, UPDATE (f3, f2, f1) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` +GRANT SELECT (`f1`), INSERT, UPDATE ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` +GRANT SELECT, SELECT (`f1`), INSERT, UPDATE (`f3`, `f2`, `f1`) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` connection no_privs; select current_user; current_user test_noprivs@localhost use priv_db; update t1 set f3= f3+1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f3 from t1 order by f3; f3 NULL diff --git a/mysql-test/suite/funcs_1/r/memory_trig_0407.result b/mysql-test/suite/funcs_1/r/memory_trig_0407.result index 00457776b027f..ceae360946c0e 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_0407.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_0407.result @@ -237,7 +237,7 @@ Testcase 3.5.5.2: Create temporary table t1_temp (f1 bigint signed, f2 bigint unsigned); Create trigger trg2 before INSERT on t1_temp for each row set new.f2=9999; -ERROR HY000: Trigger's 't1_temp' is view or temporary table +ERROR HY000: Trigger's 't1_temp' is a view, temporary table or sequence drop table t1_temp; Testcase 3.5.5.3: diff --git a/mysql-test/suite/funcs_1/r/memory_trig_1011ext.result b/mysql-test/suite/funcs_1/r/memory_trig_1011ext.result index fa767e51eb59f..c1b697bd59953 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_1011ext.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_1011ext.result @@ -372,7 +372,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1); create trigger tr1 after insert on t1 for each row insert into t2 (f2) values (new.f1+1); diff --git a/mysql-test/suite/funcs_1/r/myisam_func_view.result b/mysql-test/suite/funcs_1/r/myisam_func_view.result index 6dd12ddc11c36..e9b88b9309ab8 100644 --- a/mysql-test/suite/funcs_1/r/myisam_func_view.result +++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result @@ -3412,11 +3412,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 29 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection @@ -3432,11 +3429,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 29 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' DROP VIEW v1; @@ -3454,11 +3448,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 28 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL 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 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL 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 DECIMAL 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 DECIMAL value: '-3333.3333\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' @@ -3476,11 +3467,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 28 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL 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 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL 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 DECIMAL 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 DECIMAL value: '-3333.3333\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' @@ -3500,11 +3488,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 27 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection @@ -3520,11 +3505,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 27 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -3542,11 +3524,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 26 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection @@ -3562,11 +3541,8 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 26 Warnings: -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Warning 1918 Encountered illegal value '' when converting to DECIMAL Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result index ce1ee82e89a26..694cfc0158f1d 100644 --- a/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result +++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result @@ -221,31 +221,31 @@ connect user5_2, localhost, user_2, , db_storedproc_1; user_2@localhost db_storedproc_1 CALL sp5_s_i(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_ins(); -ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_sel(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` connection default; root@localhost db_storedproc_1 CALL sp5_sel(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` grant insert on db_storedproc_1.* to 'user_1'@'localhost'; flush privileges; connection user5_2; user_2@localhost db_storedproc_1 CALL sp5_s_i(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_ins(); CALL sp5_sel(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` connection default; root@localhost db_storedproc_1 CALL sp5_sel(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` grant SELECT on db_storedproc_1.* to 'user_1'@'localhost'; flush privileges; connection user5_2; @@ -276,9 +276,9 @@ inserted outside of SP NULL inserted from sp5_ins 2000-10-00 inserted from sp5_s_i 2000-10-00 inserted from sp5_ins 2000-10-00 -ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_ins(); -ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_sel(); c1 c2 c3 inserted outside of SP NULL @@ -294,11 +294,11 @@ connection user5_2; user_2@localhost db_storedproc_1 CALL sp5_s_i(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_ins(); -ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` CALL sp5_sel(); -ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165' +ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table `db_storedproc_1`.`t3165` disconnect user5_2; connection default; @@ -348,9 +348,9 @@ user_2@localhost db_storedproc_1 CALL sp3166_s_i(); c1 inserted outside SP -ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table 't3166' +ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table `db_storedproc_1`.`t3166` CALL sp3166_ins(); -ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table 't3166' +ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table `db_storedproc_1`.`t3166` CALL sp3166_sel(); c1 inserted outside SP @@ -390,10 +390,10 @@ connect user6_4, localhost, user_2, , db_storedproc_1; user_2@localhost db_storedproc_1 CALL sp3166_s_i(); -ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table 't3166' +ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table `db_storedproc_1`.`t3166` CALL sp3166_ins(); CALL sp3166_sel(); -ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table 't3166' +ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table `db_storedproc_1`.`t3166` disconnect user6_4; connection default; CALL sp3166_s_i(); diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_03.result b/mysql-test/suite/funcs_1/r/myisam_trig_03.result index 68969afc97f5f..18d55140d67c4 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_03.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_03.result @@ -99,7 +99,7 @@ test_noprivs@localhost use priv_db; create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.2_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table `priv_db`.`t1` connection default; use priv_db; insert into t1 (f1) values ('insert 3.5.3.2-no'); @@ -135,7 +135,7 @@ Testcase 3.5.3.6: connection no_privs; use priv_db; drop trigger trg1_2; -ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table `priv_db`.`t1` connection default; use priv_db; insert into t1 (f1) values ('insert 3.5.3.6-yes'); @@ -391,7 +391,7 @@ connection no_privs_424d; show grants; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT SELECT (f1), INSERT (f1) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` +GRANT SELECT (`f1`), INSERT (`f1`) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` use priv_db; create trigger trg4d_1 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-1d'; @@ -413,7 +413,7 @@ connection yes_privs_424d; show grants; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT UPDATE (f1) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` +GRANT UPDATE (`f1`) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` use priv_db; create trigger trg4d_2 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-2d'; @@ -618,14 +618,14 @@ grant UPDATE (f1), INSERT (f1) on priv_db.t1 to test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` +GRANT INSERT (`f1`), UPDATE (`f1`) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER on *.* to test_yesprivs@localhost; grant SELECT (f1) on priv_db.t1 to test_yesprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` +GRANT INSERT (`f1`), UPDATE (`f1`) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` connect no_privs_425d,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; connect yes_privs_425d,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection default; @@ -633,7 +633,7 @@ connection no_privs_425d; show grants; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` +GRANT INSERT (`f1`), UPDATE (`f1`) ON `priv_db`.`t1` TO `test_noprivs`@`localhost` use priv_db; create trigger trg5d_1 before INSERT on t1 for each row set @test_var= new.f1; @@ -649,7 +649,7 @@ connection yes_privs_425d; show grants; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT SELECT (f1) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` +GRANT SELECT (`f1`) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` use priv_db; create trigger trg5d_2 before INSERT on t1 for each row set @test_var= new.f1; @@ -688,7 +688,7 @@ insert into t2 values (new.f1); connection default; use priv_db; insert into t1 (f1) values (4); -ERROR 42000: INSERT command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: INSERT command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` revoke SELECT on priv_db.t2 from test_yesprivs@localhost; grant INSERT on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (4); @@ -706,7 +706,7 @@ update t2 set f2=new.f1-1; connection default; use priv_db; insert into t1 (f1) values (2); -ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` revoke INSERT on priv_db.t2 from test_yesprivs@localhost; grant UPDATE on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (2); @@ -725,7 +725,7 @@ select f2 into @aaa from t2 where f2=new.f1; connection default; use priv_db; insert into t1 (f1) values (1); -ERROR 42000: SELECT command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` revoke UPDATE on priv_db.t2 from test_yesprivs@localhost; grant SELECT on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (1); @@ -748,7 +748,7 @@ delete from t2; connection default; use priv_db; insert into t1 (f1) values (1); -ERROR 42000: DELETE command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: DELETE command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` revoke SELECT on priv_db.t2 from test_yesprivs@localhost; grant DELETE on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (1); diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result index 22db7ad337ee5..b44cdb7a0070d 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result @@ -32,7 +32,7 @@ no trigger privilege on db level for create: use priv_db; create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; use priv_db; insert into t1 (f1) values ('insert-yes'); @@ -108,7 +108,7 @@ current_user test_yesprivs@localhost use priv_db; drop trigger trg1_2; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connection no_privs; select current_user; current_user @@ -118,7 +118,7 @@ use priv_db; no trigger privilege at activation time: ---------------------------------------- insert into t1 (f1) values ('insert-yes'); -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 insert-yes @@ -156,7 +156,7 @@ Grants for test_yesprivs@localhost GRANT USAGE ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, UPDATE, TRIGGER ON `priv_db`.* TO `test_yesprivs`@`localhost` drop trigger trg1_2; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` takes effect after use priv_db: ------------------------------- @@ -196,14 +196,14 @@ test_yesprivs@localhost use no_priv_db; create trigger trg1_3 before INSERT on t1 for each row set new.f1 = 'trig 1_3-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `no_priv_db`.`t1` use priv_db; create trigger trg1_3 before INSERT on t1 for each row set new.f1 = 'trig 1_3-yes'; use no_priv_db; create trigger trg1_4 before UPDATE on t1 for each row set new.f1 = 'trig 1_4-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `no_priv_db`.`t1` use priv_db; create trigger trg1_4 before UPDATE on t1 for each row set new.f1 = 'trig 1_4-yes'; @@ -303,7 +303,7 @@ Tables_in_priv_db t1 create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connection no_privs; select current_user; current_user @@ -377,7 +377,7 @@ select current_user; current_user test_yesprivs@localhost drop trigger trg1_2; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` no trigger privilege at activation time: ---------------------------------------- @@ -386,7 +386,7 @@ select current_user; current_user test_noprivs@localhost insert into t1 (f1) values ('insert5-no'); -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 insert1-yes @@ -477,12 +477,12 @@ current_user test_yesprivs@localhost create trigger trg2_1 before INSERT on t2 for each row set new.f1 = 'trig 2_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` create trigger trg1_3 before INSERT on t1 for each row set new.f1 = 'trig 1_3-yes'; create trigger trg2_2 before UPDATE on t2 for each row set new.f1 = 'trig 2_2-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` create trigger trg1_4 before UPDATE on t1 for each row set new.f1 = 'trig 1_4-yes'; show triggers; @@ -616,7 +616,7 @@ Trigger Event Table Statement Timing Created sql_mode Definer character_set_clie select * from information_schema.triggers; TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION drop trigger trg1_1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connection default; select current_user; current_user @@ -636,7 +636,7 @@ current_user test_yesprivs@localhost create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connection no_privs; select current_user; current_user @@ -672,11 +672,11 @@ set new.f1 = 'trig 1_2-yes'; create trigger no_priv_db.trg1_9 before insert on no_priv_db.t1 for each row set new.f1 = 'trig 1_9-yes'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `no_priv_db`.`t1` use no_priv_db; create trigger trg1_2 before INSERT on t1 for each row set new.f1 = 'trig 1_2-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `no_priv_db`.`t1` create trigger priv_db.trg1_9 before UPDATE on priv_db.t1 for each row set new.f1 = 'trig 1_9-yes'; @@ -700,7 +700,7 @@ select f1 from t1 order by f1; f1 insert-yes drop trigger priv_db.trg1_9; -ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table `priv_db`.`t1` connection default; select current_user; current_user @@ -709,7 +709,7 @@ drop trigger priv_db.trg1_9; revoke TRIGGER on priv_db.* from test_yesprivs@localhost; use priv_db; insert into t1 (f1) values ('insert-yes'); -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 insert-yes @@ -729,7 +729,7 @@ test_yesprivs@localhost use no_priv_db; create trigger trg1_2 before INSERT on t1 for each row set new.f1 = 'trig 1_2-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `no_priv_db`.`t1` connection no_privs; select current_user; current_user @@ -844,7 +844,7 @@ set new.f1 = 'trig 2_1-yes'; use priv2_db; create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig1_1-yes'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv2_db`.`t1` connection no_privs; select current_user; current_user @@ -919,7 +919,7 @@ test_yesprivs@localhost use priv1_db; create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv1_db`.`t1` connection default; select current_user; current_user @@ -946,7 +946,7 @@ create trigger trg1_2 before INSERT on t1 for each row set new.f1 = 'trig 1_2-yes'; create trigger trg2_1 before INSERT on t2 for each row set new.f1 = 'trig 2_1-no'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv1_db`.`t2` connection no_privs; select current_user; current_user @@ -987,7 +987,7 @@ current_user test_yesprivs@localhost create trigger trg2_1 before INSERT on t2 for each row set new.f1 = 'trig 2_1-yes'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv1_db`.`t2` use priv1_db; create trigger trg2_1 before INSERT on t2 for each row set new.f1 = 'trig 2_1-yes'; @@ -1111,7 +1111,7 @@ select current_user; current_user test_yesprivs@localhost execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1123,7 +1123,7 @@ current_user test_useprivs@localhost prepare ins1 from 'insert into t1 (f1) values (''insert5-no'')'; execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1174,7 +1174,7 @@ select current_user; current_user test_yesprivs@localhost execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1186,7 +1186,7 @@ select current_user; current_user test_useprivs@localhost execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1241,7 +1241,7 @@ select current_user; current_user test_yesprivs@localhost execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1256,7 +1256,7 @@ select current_user; current_user test_useprivs@localhost execute ins1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1324,11 +1324,11 @@ current_user test_yesprivs@localhost use priv_db; insert into t1 (f1) values ('insert-no'); -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f1 from t1 order by f1; f1 drop trigger trg1_0; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` connection default; select current_user; current_user @@ -1480,8 +1480,8 @@ show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT USAGE ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT TRIGGER ON `priv_db`.* TO `test_yesprivs`@`localhost` -GRANT SELECT (f1), INSERT ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` -GRANT SELECT (f1), INSERT, UPDATE (f1) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` +GRANT SELECT (`f1`), INSERT ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` +GRANT SELECT (`f1`), INSERT, UPDATE (`f1`) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` connection yes_privs; select current_user; current_user @@ -1577,12 +1577,12 @@ update t1 set f1 = 'update6_no' where f1 like '%insert%'; update t2 set f1 = 'update6_no' where f1 like '%insert%'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` update t1 set f1 = 'update7_no' where f1 like '%insert%'; update t2 set f1 = 'update7_no' where f1 like '%insert%'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t2` select f1 from t1 order by f1; f1 trig 1_1-yes @@ -1608,7 +1608,7 @@ test_noprivs@localhost update t1 set f1 = 'update8-no', f2 = 'update8-no' where f2 like '%yes'; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select * from t1 order by f1,f2,f3; f1 f2 f3 trig 1_1-yes NULL NULL @@ -1631,8 +1631,8 @@ to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT USAGE ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT SELECT (f1), INSERT, UPDATE ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` -GRANT SELECT, SELECT (f1), INSERT, UPDATE (f3, f2), TRIGGER ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` +GRANT SELECT (`f1`), INSERT, UPDATE ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` +GRANT SELECT, SELECT (`f1`), INSERT, UPDATE (`f3`, `f2`), TRIGGER ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` connection yes_privs; select current_user; current_user @@ -1674,15 +1674,15 @@ to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT USAGE ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -GRANT SELECT (f1), INSERT, UPDATE ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` -GRANT SELECT, SELECT (f1), INSERT, UPDATE (f3, f2, f1) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` +GRANT SELECT (`f1`), INSERT, UPDATE ON `priv_db`.`t2` TO `test_yesprivs`@`localhost` +GRANT SELECT, SELECT (`f1`), INSERT, UPDATE (`f3`, `f2`, `f1`) ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` connection no_privs; select current_user; current_user test_noprivs@localhost use priv_db; update t1 set f3= f3+1; -ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` select f3 from t1 order by f3; f3 NULL diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_0407.result b/mysql-test/suite/funcs_1/r/myisam_trig_0407.result index 00457776b027f..ceae360946c0e 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_0407.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_0407.result @@ -237,7 +237,7 @@ Testcase 3.5.5.2: Create temporary table t1_temp (f1 bigint signed, f2 bigint unsigned); Create trigger trg2 before INSERT on t1_temp for each row set new.f2=9999; -ERROR HY000: Trigger's 't1_temp' is view or temporary table +ERROR HY000: Trigger's 't1_temp' is a view, temporary table or sequence drop table t1_temp; Testcase 3.5.5.3: diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_1011ext.result b/mysql-test/suite/funcs_1/r/myisam_trig_1011ext.result index 72e5dc938e300..cacef967ca961 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_1011ext.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_1011ext.result @@ -372,7 +372,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1); create trigger tr1 after insert on t1 for each row insert into t2 (f2) values (new.f1+1); diff --git a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result index c70389ad65e4a..126bf44f7ebb0 100644 --- a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result +++ b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result @@ -24,25 +24,25 @@ connection default; SHOW CREATE TABLE processlist; Table Create Table PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` ( - `ID` bigint(4) NOT NULL DEFAULT 0, - `USER` varchar(128) NOT NULL DEFAULT '', - `HOST` varchar(64) NOT NULL DEFAULT '', - `DB` varchar(64) DEFAULT NULL, - `COMMAND` varchar(16) NOT NULL DEFAULT '', - `TIME` int(7) NOT NULL DEFAULT 0, - `STATE` varchar(64) DEFAULT NULL, - `INFO` longtext DEFAULT NULL, - `TIME_MS` decimal(22,3) NOT NULL DEFAULT 0.000, - `STAGE` tinyint(2) NOT NULL DEFAULT 0, - `MAX_STAGE` tinyint(2) NOT NULL DEFAULT 0, - `PROGRESS` decimal(7,3) NOT NULL DEFAULT 0.000, - `MEMORY_USED` bigint(7) NOT NULL DEFAULT 0, - `MAX_MEMORY_USED` bigint(7) NOT NULL DEFAULT 0, - `EXAMINED_ROWS` int(7) NOT NULL DEFAULT 0, - `QUERY_ID` bigint(4) NOT NULL DEFAULT 0, - `INFO_BINARY` blob DEFAULT NULL, - `TID` bigint(4) NOT NULL DEFAULT 0 -) DEFAULT CHARSET=utf8mb3 + `ID` bigint(4) NOT NULL, + `USER` varchar(128) NOT NULL, + `HOST` varchar(64) NOT NULL, + `DB` varchar(64), + `COMMAND` varchar(16) NOT NULL, + `TIME` int(7) NOT NULL, + `STATE` varchar(64), + `INFO` longtext, + `TIME_MS` decimal(22,3) NOT NULL, + `STAGE` tinyint(2) NOT NULL, + `MAX_STAGE` tinyint(2) NOT NULL, + `PROGRESS` decimal(7,3) NOT NULL, + `MEMORY_USED` bigint(7) NOT NULL, + `MAX_MEMORY_USED` bigint(7) NOT NULL, + `EXAMINED_ROWS` int(7) NOT NULL, + `QUERY_ID` bigint(4) NOT NULL, + `INFO_BINARY` blob, + `TID` bigint(4) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW processlist; Id User Host db Command Time State Info Progress ID root HOST_NAME information_schema Query TIME starting SHOW processlist TIME_MS @@ -104,25 +104,25 @@ SHOW/SELECT shows only the processes (1) of the user. SHOW CREATE TABLE processlist; Table Create Table PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` ( - `ID` bigint(4) NOT NULL DEFAULT 0, - `USER` varchar(128) NOT NULL DEFAULT '', - `HOST` varchar(64) NOT NULL DEFAULT '', - `DB` varchar(64) DEFAULT NULL, - `COMMAND` varchar(16) NOT NULL DEFAULT '', - `TIME` int(7) NOT NULL DEFAULT 0, - `STATE` varchar(64) DEFAULT NULL, - `INFO` longtext DEFAULT NULL, - `TIME_MS` decimal(22,3) NOT NULL DEFAULT 0.000, - `STAGE` tinyint(2) NOT NULL DEFAULT 0, - `MAX_STAGE` tinyint(2) NOT NULL DEFAULT 0, - `PROGRESS` decimal(7,3) NOT NULL DEFAULT 0.000, - `MEMORY_USED` bigint(7) NOT NULL DEFAULT 0, - `MAX_MEMORY_USED` bigint(7) NOT NULL DEFAULT 0, - `EXAMINED_ROWS` int(7) NOT NULL DEFAULT 0, - `QUERY_ID` bigint(4) NOT NULL DEFAULT 0, - `INFO_BINARY` blob DEFAULT NULL, - `TID` bigint(4) NOT NULL DEFAULT 0 -) DEFAULT CHARSET=utf8mb3 + `ID` bigint(4) NOT NULL, + `USER` varchar(128) NOT NULL, + `HOST` varchar(64) NOT NULL, + `DB` varchar(64), + `COMMAND` varchar(16) NOT NULL, + `TIME` int(7) NOT NULL, + `STATE` varchar(64), + `INFO` longtext, + `TIME_MS` decimal(22,3) NOT NULL, + `STAGE` tinyint(2) NOT NULL, + `MAX_STAGE` tinyint(2) NOT NULL, + `PROGRESS` decimal(7,3) NOT NULL, + `MEMORY_USED` bigint(7) NOT NULL, + `MAX_MEMORY_USED` bigint(7) NOT NULL, + `EXAMINED_ROWS` int(7) NOT NULL, + `QUERY_ID` bigint(4) NOT NULL, + `INFO_BINARY` blob, + `TID` bigint(4) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW processlist; Id User Host db Command Time State Info Progress ID ddicttestuser1 HOST_NAME information_schema Query TIME starting SHOW processlist TIME_MS diff --git a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result index b3077fa4a7e22..95c706b3f2552 100644 --- a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result +++ b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result @@ -24,25 +24,25 @@ connection default; SHOW CREATE TABLE processlist; Table Create Table PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` ( - `ID` bigint(4) NOT NULL DEFAULT 0, - `USER` varchar(128) NOT NULL DEFAULT '', - `HOST` varchar(64) NOT NULL DEFAULT '', - `DB` varchar(64) DEFAULT NULL, - `COMMAND` varchar(16) NOT NULL DEFAULT '', - `TIME` int(7) NOT NULL DEFAULT 0, - `STATE` varchar(64) DEFAULT NULL, - `INFO` longtext DEFAULT NULL, - `TIME_MS` decimal(22,3) NOT NULL DEFAULT 0.000, - `STAGE` tinyint(2) NOT NULL DEFAULT 0, - `MAX_STAGE` tinyint(2) NOT NULL DEFAULT 0, - `PROGRESS` decimal(7,3) NOT NULL DEFAULT 0.000, - `MEMORY_USED` bigint(7) NOT NULL DEFAULT 0, - `MAX_MEMORY_USED` bigint(7) NOT NULL DEFAULT 0, - `EXAMINED_ROWS` int(7) NOT NULL DEFAULT 0, - `QUERY_ID` bigint(4) NOT NULL DEFAULT 0, - `INFO_BINARY` blob DEFAULT NULL, - `TID` bigint(4) NOT NULL DEFAULT 0 -) DEFAULT CHARSET=utf8mb3 + `ID` bigint(4) NOT NULL, + `USER` varchar(128) NOT NULL, + `HOST` varchar(64) NOT NULL, + `DB` varchar(64), + `COMMAND` varchar(16) NOT NULL, + `TIME` int(7) NOT NULL, + `STATE` varchar(64), + `INFO` longtext, + `TIME_MS` decimal(22,3) NOT NULL, + `STAGE` tinyint(2) NOT NULL, + `MAX_STAGE` tinyint(2) NOT NULL, + `PROGRESS` decimal(7,3) NOT NULL, + `MEMORY_USED` bigint(7) NOT NULL, + `MAX_MEMORY_USED` bigint(7) NOT NULL, + `EXAMINED_ROWS` int(7) NOT NULL, + `QUERY_ID` bigint(4) NOT NULL, + `INFO_BINARY` blob, + `TID` bigint(4) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW processlist; Id User Host db Command Time State Info Progress ID root HOST_NAME information_schema Query TIME starting SHOW processlist TIME_MS @@ -104,25 +104,25 @@ SHOW/SELECT shows only the processes (1) of the user. SHOW CREATE TABLE processlist; Table Create Table PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` ( - `ID` bigint(4) NOT NULL DEFAULT 0, - `USER` varchar(128) NOT NULL DEFAULT '', - `HOST` varchar(64) NOT NULL DEFAULT '', - `DB` varchar(64) DEFAULT NULL, - `COMMAND` varchar(16) NOT NULL DEFAULT '', - `TIME` int(7) NOT NULL DEFAULT 0, - `STATE` varchar(64) DEFAULT NULL, - `INFO` longtext DEFAULT NULL, - `TIME_MS` decimal(22,3) NOT NULL DEFAULT 0.000, - `STAGE` tinyint(2) NOT NULL DEFAULT 0, - `MAX_STAGE` tinyint(2) NOT NULL DEFAULT 0, - `PROGRESS` decimal(7,3) NOT NULL DEFAULT 0.000, - `MEMORY_USED` bigint(7) NOT NULL DEFAULT 0, - `MAX_MEMORY_USED` bigint(7) NOT NULL DEFAULT 0, - `EXAMINED_ROWS` int(7) NOT NULL DEFAULT 0, - `QUERY_ID` bigint(4) NOT NULL DEFAULT 0, - `INFO_BINARY` blob DEFAULT NULL, - `TID` bigint(4) NOT NULL DEFAULT 0 -) DEFAULT CHARSET=utf8mb3 + `ID` bigint(4) NOT NULL, + `USER` varchar(128) NOT NULL, + `HOST` varchar(64) NOT NULL, + `DB` varchar(64), + `COMMAND` varchar(16) NOT NULL, + `TIME` int(7) NOT NULL, + `STATE` varchar(64), + `INFO` longtext, + `TIME_MS` decimal(22,3) NOT NULL, + `STAGE` tinyint(2) NOT NULL, + `MAX_STAGE` tinyint(2) NOT NULL, + `PROGRESS` decimal(7,3) NOT NULL, + `MEMORY_USED` bigint(7) NOT NULL, + `MAX_MEMORY_USED` bigint(7) NOT NULL, + `EXAMINED_ROWS` int(7) NOT NULL, + `QUERY_ID` bigint(4) NOT NULL, + `INFO_BINARY` blob, + `TID` bigint(4) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW processlist; Id User Host db Command Time State Info Progress ID ddicttestuser1 HOST_NAME information_schema Query TIME starting SHOW processlist TIME_MS diff --git a/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result b/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result index 34dbd6b92ee39..dba8de65fc035 100644 --- a/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result +++ b/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result @@ -12,25 +12,25 @@ USE test; SHOW CREATE TABLE INFORMATION_SCHEMA.PROCESSLIST; Table Create Table PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` ( - `ID` bigint(4) NOT NULL DEFAULT 0, - `USER` varchar(128) NOT NULL DEFAULT '', - `HOST` varchar(64) NOT NULL DEFAULT '', - `DB` varchar(64) DEFAULT NULL, - `COMMAND` varchar(16) NOT NULL DEFAULT '', - `TIME` int(7) NOT NULL DEFAULT 0, - `STATE` varchar(64) DEFAULT NULL, - `INFO` longtext DEFAULT NULL, - `TIME_MS` decimal(22,3) NOT NULL DEFAULT 0.000, - `STAGE` tinyint(2) NOT NULL DEFAULT 0, - `MAX_STAGE` tinyint(2) NOT NULL DEFAULT 0, - `PROGRESS` decimal(7,3) NOT NULL DEFAULT 0.000, - `MEMORY_USED` bigint(7) NOT NULL DEFAULT 0, - `MAX_MEMORY_USED` bigint(7) NOT NULL DEFAULT 0, - `EXAMINED_ROWS` int(7) NOT NULL DEFAULT 0, - `QUERY_ID` bigint(4) NOT NULL DEFAULT 0, - `INFO_BINARY` blob DEFAULT NULL, - `TID` bigint(4) NOT NULL DEFAULT 0 -) DEFAULT CHARSET=utf8mb3 + `ID` bigint(4) NOT NULL, + `USER` varchar(128) NOT NULL, + `HOST` varchar(64) NOT NULL, + `DB` varchar(64), + `COMMAND` varchar(16) NOT NULL, + `TIME` int(7) NOT NULL, + `STATE` varchar(64), + `INFO` longtext, + `TIME_MS` decimal(22,3) NOT NULL, + `STAGE` tinyint(2) NOT NULL, + `MAX_STAGE` tinyint(2) NOT NULL, + `PROGRESS` decimal(7,3) NOT NULL, + `MEMORY_USED` bigint(7) NOT NULL, + `MAX_MEMORY_USED` bigint(7) NOT NULL, + `EXAMINED_ROWS` int(7) NOT NULL, + `QUERY_ID` bigint(4) NOT NULL, + `INFO_BINARY` blob, + `TID` bigint(4) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci # Ensure that the information about the own connection is correct. #-------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/processlist_val_ps.result b/mysql-test/suite/funcs_1/r/processlist_val_ps.result index ba927bb60ee9b..0806f00fc6acc 100644 --- a/mysql-test/suite/funcs_1/r/processlist_val_ps.result +++ b/mysql-test/suite/funcs_1/r/processlist_val_ps.result @@ -12,25 +12,25 @@ USE test; SHOW CREATE TABLE INFORMATION_SCHEMA.PROCESSLIST; Table Create Table PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` ( - `ID` bigint(4) NOT NULL DEFAULT 0, - `USER` varchar(128) NOT NULL DEFAULT '', - `HOST` varchar(64) NOT NULL DEFAULT '', - `DB` varchar(64) DEFAULT NULL, - `COMMAND` varchar(16) NOT NULL DEFAULT '', - `TIME` int(7) NOT NULL DEFAULT 0, - `STATE` varchar(64) DEFAULT NULL, - `INFO` longtext DEFAULT NULL, - `TIME_MS` decimal(22,3) NOT NULL DEFAULT 0.000, - `STAGE` tinyint(2) NOT NULL DEFAULT 0, - `MAX_STAGE` tinyint(2) NOT NULL DEFAULT 0, - `PROGRESS` decimal(7,3) NOT NULL DEFAULT 0.000, - `MEMORY_USED` bigint(7) NOT NULL DEFAULT 0, - `MAX_MEMORY_USED` bigint(7) NOT NULL DEFAULT 0, - `EXAMINED_ROWS` int(7) NOT NULL DEFAULT 0, - `QUERY_ID` bigint(4) NOT NULL DEFAULT 0, - `INFO_BINARY` blob DEFAULT NULL, - `TID` bigint(4) NOT NULL DEFAULT 0 -) DEFAULT CHARSET=utf8mb3 + `ID` bigint(4) NOT NULL, + `USER` varchar(128) NOT NULL, + `HOST` varchar(64) NOT NULL, + `DB` varchar(64), + `COMMAND` varchar(16) NOT NULL, + `TIME` int(7) NOT NULL, + `STATE` varchar(64), + `INFO` longtext, + `TIME_MS` decimal(22,3) NOT NULL, + `STAGE` tinyint(2) NOT NULL, + `MAX_STAGE` tinyint(2) NOT NULL, + `PROGRESS` decimal(7,3) NOT NULL, + `MEMORY_USED` bigint(7) NOT NULL, + `MAX_MEMORY_USED` bigint(7) NOT NULL, + `EXAMINED_ROWS` int(7) NOT NULL, + `QUERY_ID` bigint(4) NOT NULL, + `INFO_BINARY` blob, + `TID` bigint(4) NOT NULL +) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci # Ensure that the information about the own connection is correct. #-------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result index d2cc935351856..efeb63ae61610 100644 --- a/mysql-test/suite/funcs_1/r/storedproc.result +++ b/mysql-test/suite/funcs_1/r/storedproc.result @@ -1689,7 +1689,7 @@ CREATE FUNCTION fn1 (s char(20)) returns char(50) return concat('hello, ', s, '!'); show CREATE FUNCTION fn1; Function sql_mode Create Function character_set_client collation_connection Database Collation -fn1 CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(s char(20)) RETURNS char(50) CHARSET latin1 +fn1 CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(s char(20)) RETURNS char(50) CHARSET latin1 COLLATE latin1_swedish_ci return concat('hello, ', s, '!') latin1 DROP FUNCTION fn1; @@ -1849,7 +1849,7 @@ connection u_1; user_1@localhost db_storedproc USE db_storedproc; CALL sp11(); -ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table `mysql`.`t1` commit work; disconnect u_1; connection default; diff --git a/mysql-test/suite/funcs_1/t/is_columns_is_embedded.test b/mysql-test/suite/funcs_1/t/is_columns_is_embedded.test index 9db247fd6fd71..bb9cc2a6ffb25 100644 --- a/mysql-test/suite/funcs_1/t/is_columns_is_embedded.test +++ b/mysql-test/suite/funcs_1/t/is_columns_is_embedded.test @@ -14,7 +14,7 @@ # --source include/have_innodb.inc ---source include/is_embedded.inc +--source include/is_embedded_no_privileges.inc let $my_where = WHERE table_schema = 'information_schema' AND table_name <> 'profiling' AND table_name not like 'innodb_%'; diff --git a/mysql-test/suite/funcs_1/t/is_columns_myisam_embedded.test b/mysql-test/suite/funcs_1/t/is_columns_myisam_embedded.test index 9e31190c008a0..3679cdebbe2c2 100644 --- a/mysql-test/suite/funcs_1/t/is_columns_myisam_embedded.test +++ b/mysql-test/suite/funcs_1/t/is_columns_myisam_embedded.test @@ -10,10 +10,8 @@ # 2008-06-06 mleich Create this this variant for the embedded server. # -if (`SELECT VERSION() NOT LIKE '%embedded%'`) -{ - --skip Test requires: embedded server -} +--source include/is_embedded_no_privileges.inc + let $engine_type= MyISAM; --enable_prepare_warnings SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; diff --git a/mysql-test/suite/funcs_1/t/is_columns_mysql_embedded.test b/mysql-test/suite/funcs_1/t/is_columns_mysql_embedded.test index d1ed45425ec99..9ef1b6d869aec 100644 --- a/mysql-test/suite/funcs_1/t/is_columns_mysql_embedded.test +++ b/mysql-test/suite/funcs_1/t/is_columns_mysql_embedded.test @@ -10,10 +10,7 @@ # 2008-06-06 mleich Create this variant for the embedded server # -if (`SELECT VERSION() NOT LIKE '%embedded%'`) -{ - --skip Test requires: embedded server -} +--source include/is_embedded_no_privileges.inc let $my_where = WHERE table_schema = 'mysql'; --source suite/funcs_1/datadict/columns.inc diff --git a/mysql-test/suite/funcs_1/t/myisam_views-big.test b/mysql-test/suite/funcs_1/t/myisam_views-big.test index bf499ee789aca..60fe1b8eaba33 100644 --- a/mysql-test/suite/funcs_1/t/myisam_views-big.test +++ b/mysql-test/suite/funcs_1/t/myisam_views-big.test @@ -4,6 +4,8 @@ # because of a pair of slow Solaris Sparc machines in pb2, # this test is marked as big: --source include/big_test.inc +# This test often times out with MSAN +--source include/not_msan.inc # MyISAM tables should be used # diff --git a/mysql-test/suite/funcs_2/charset/charset_master.test b/mysql-test/suite/funcs_2/charset/charset_master.test index 8f3ac64c7537d..099f44c9a0274 100644 --- a/mysql-test/suite/funcs_2/charset/charset_master.test +++ b/mysql-test/suite/funcs_2/charset/charset_master.test @@ -38,7 +38,7 @@ if (`SELECT COUNT(*) <> 36 FROM information_schema.character_sets 'hp8' , 'keybcs2', 'koi8r' , 'koi8u' , 'latin1', 'latin2' , 'latin5' , 'latin7' , 'macce' , 'macroman', 'sjis' , 'swe7' , 'tis620' , 'ucs2' , 'ujis', - 'utf8' + 'utf8mb3' )`) { --skip Not all character sets required for this test are present @@ -72,12 +72,12 @@ WHERE collation_name IN ( 'ucs2_latvian_ci', 'ucs2_lithuanian_ci', 'ucs2_persian_ci', 'ucs2_polish_ci', 'ucs2_roman_ci', 'ucs2_romanian_ci', 'ucs2_slovak_ci', 'ucs2_slovenian_ci', 'ucs2_spanish2_ci', 'ucs2_spanish_ci', 'ucs2_swedish_ci', 'ucs2_turkish_ci', -'ucs2_unicode_ci', 'ujis_bin', 'ujis_japanese_ci', 'utf8_bin', -'utf8_czech_ci', 'utf8_danish_ci', 'utf8_estonian_ci', 'utf8_general_ci', -'utf8_hungarian_ci', 'utf8_icelandic_ci', 'utf8_latvian_ci', 'utf8_lithuanian_ci', -'utf8_persian_ci', 'utf8_polish_ci', 'utf8_roman_ci', 'utf8_romanian_ci', -'utf8_slovak_ci', 'utf8_slovenian_ci', 'utf8_spanish2_ci', 'utf8_spanish_ci', -'utf8_swedish_ci', 'utf8_turkish_ci', 'utf8_unicode_ci' +'ucs2_unicode_ci', 'ujis_bin', 'ujis_japanese_ci', 'utf8mb3_bin', +'utf8mb3_czech_ci', 'utf8mb3_danish_ci', 'utf8mb3_estonian_ci', 'utf8mb3_general_ci', +'utf8mb3_hungarian_ci', 'utf8mb3_icelandic_ci', 'utf8mb3_latvian_ci', 'utf8mb3_lithuanian_ci', +'utf8mb3_persian_ci', 'utf8mb3_polish_ci', 'utf8mb3_roman_ci', 'utf8mb3_romanian_ci', +'utf8mb3_slovak_ci', 'utf8mb3_slovenian_ci', 'utf8mb3_spanish2_ci', 'utf8mb3_spanish_ci', +'utf8mb3_swedish_ci', 'utf8mb3_turkish_ci', 'utf8mb3_unicode_ci' )`) { --skip Not all collations required for this test are present @@ -86,7 +86,7 @@ WHERE collation_name IN ( ################################ let $check_std_csets= 1; let $check_ucs2_csets= 1; -let $check_utf8_csets= 1; +let $check_utf8mb3_csets= 1; # Bug#32784: Timeout in test "innodb_charset": InnoDB much slower # than other handlers @@ -104,7 +104,7 @@ SET autocommit=0; ################################ let $check_std_csets= 1; let $check_ucs2_csets= 1; -let $check_utf8_csets= 1; +let $check_utf8mb3_csets= 1; # # Check all charsets/collation combinations @@ -610,7 +610,7 @@ let $coll= ucs2_unicode_ci; } -if ($check_utf8_csets) +if ($check_utf8mb3_csets) { # utf8 diff --git a/mysql-test/suite/funcs_2/r/innodb_charset.result b/mysql-test/suite/funcs_2/r/innodb_charset.result index 1ce5972ecccb8..399fc1d9fe765 100644 --- a/mysql-test/suite/funcs_2/r/innodb_charset.result +++ b/mysql-test/suite/funcs_2/r/innodb_charset.result @@ -1,3 +1,4 @@ +SET GLOBAL innodb_max_purge_lag_wait=0; set @save_character_set_database= @@character_set_database; DROP TABLE IF EXISTS test.t1; SET NAMES armscii8; @@ -17563,7 +17564,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_bin; @@ -20104,7 +20105,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_czech_ci; @@ -22645,7 +22646,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_danish_ci; @@ -25186,7 +25187,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_estonian_ci; @@ -27727,7 +27728,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_general_ci; @@ -30268,7 +30269,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_hungarian_ci; @@ -32809,7 +32810,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_icelandic_ci; @@ -35350,7 +35351,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_latvian_ci; @@ -37891,7 +37892,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_lithuanian_ci; @@ -40432,7 +40433,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_persian_ci; @@ -42973,7 +42974,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_polish_ci; @@ -45514,7 +45515,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_roman_ci; @@ -48055,7 +48056,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_romanian_ci; @@ -50596,7 +50597,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_slovak_ci; @@ -53137,7 +53138,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_slovenian_ci; @@ -55678,7 +55679,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_spanish2_ci; @@ -58219,7 +58220,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_spanish_ci; @@ -60760,7 +60761,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_swedish_ci; @@ -63301,7 +63302,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_turkish_ci; @@ -65842,7 +65843,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=InnoDB CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci; @@ -68382,7 +68383,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_bin) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_bin # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_bin # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -70921,7 +70922,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_czech_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_czech_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_czech_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_czech_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -73460,7 +73461,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_danish_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_danish_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_danish_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_danish_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -75999,7 +76000,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_estonian_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_estonian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_estonian_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_estonian_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -78538,7 +78539,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_general_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -81077,7 +81078,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_hungarian_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_hungarian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_hungarian_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_hungarian_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -83616,7 +83617,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_icelandic_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_icelandic_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_icelandic_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_icelandic_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -86155,7 +86156,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_latvian_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_latvian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_latvian_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_latvian_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -88694,7 +88695,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_lithuanian_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_lithuanian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_lithuanian_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_lithuanian_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -91233,7 +91234,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_persian_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_persian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_persian_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_persian_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -93772,7 +93773,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_polish_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_polish_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_polish_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_polish_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -96311,7 +96312,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_roman_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_roman_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_roman_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_roman_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -98850,7 +98851,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_romanian_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_romanian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_romanian_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_romanian_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -101389,7 +101390,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_slovak_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_slovak_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_slovak_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_slovak_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -103928,7 +103929,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_slovenian_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_slovenian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_slovenian_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_slovenian_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -106467,7 +106468,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_spanish2_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_spanish2_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_spanish2_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_spanish2_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -109006,7 +109007,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_spanish_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_spanish_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_spanish_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_spanish_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -111545,7 +111546,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_swedish_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_swedish_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_swedish_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_swedish_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -114084,7 +114085,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_turkish_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_turkish_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_turkish_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_turkish_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -116623,7 +116624,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_unicode_ci) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_unicode_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 InnoDB # # # # # # # # # # # # utf8_unicode_ci # # # 0 N +t1 InnoDB # # # # # # # # # # # # utf8mb3_unicode_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; diff --git a/mysql-test/suite/funcs_2/r/memory_charset.result b/mysql-test/suite/funcs_2/r/memory_charset.result index 66cdada9b6176..bf21eac2a5334 100644 --- a/mysql-test/suite/funcs_2/r/memory_charset.result +++ b/mysql-test/suite/funcs_2/r/memory_charset.result @@ -17563,7 +17563,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_bin; @@ -20104,7 +20104,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_czech_ci; @@ -22645,7 +22645,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_danish_ci; @@ -25186,7 +25186,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_estonian_ci; @@ -27727,7 +27727,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_general_ci; @@ -30268,7 +30268,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_hungarian_ci; @@ -32809,7 +32809,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_icelandic_ci; @@ -35350,7 +35350,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_latvian_ci; @@ -37891,7 +37891,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_lithuanian_ci; @@ -40432,7 +40432,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_persian_ci; @@ -42973,7 +42973,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_polish_ci; @@ -45514,7 +45514,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_roman_ci; @@ -48055,7 +48055,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_romanian_ci; @@ -50596,7 +50596,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_slovak_ci; @@ -53137,7 +53137,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_slovenian_ci; @@ -55678,7 +55678,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_spanish2_ci; @@ -58219,7 +58219,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_spanish_ci; @@ -60760,7 +60760,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_swedish_ci; @@ -63301,7 +63301,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_turkish_ci; @@ -65842,7 +65842,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=Memory CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci; @@ -68382,7 +68382,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_bin) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_bin; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_bin # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_bin # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -70921,7 +70921,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_czech_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_czech_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_czech_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_czech_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -73460,7 +73460,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_danish_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_danish_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_danish_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_danish_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -75999,7 +75999,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_estonian_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_estonian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_estonian_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_estonian_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -78538,7 +78538,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_general_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_general_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_general_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_general_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -81077,7 +81077,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_hungarian_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_hungarian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_hungarian_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_hungarian_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -83616,7 +83616,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_icelandic_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_icelandic_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_icelandic_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_icelandic_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -86155,7 +86155,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_latvian_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_latvian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_latvian_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_latvian_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -88694,7 +88694,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_lithuanian_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_lithuanian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_lithuanian_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_lithuanian_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -91233,7 +91233,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_persian_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_persian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_persian_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_persian_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -93772,7 +93772,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_polish_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_polish_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_polish_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_polish_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -96311,7 +96311,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_roman_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_roman_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_roman_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_roman_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -98850,7 +98850,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_romanian_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_romanian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_romanian_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_romanian_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -101389,7 +101389,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_slovak_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_slovak_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_slovak_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_slovak_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -103928,7 +103928,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_slovenian_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_slovenian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_slovenian_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_slovenian_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -106467,7 +106467,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_spanish2_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_spanish2_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_spanish2_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_spanish2_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -109006,7 +109006,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_spanish_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_spanish_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_spanish_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_spanish_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -111545,7 +111545,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_swedish_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_swedish_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_swedish_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_swedish_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -114084,7 +114084,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_turkish_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_turkish_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_turkish_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_turkish_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -116623,7 +116623,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_unicode_ci) ENGINE=Memory CHARACTER SET utf8 COLLATE utf8_unicode_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MEMORY # # # # # # # # # # # # utf8_unicode_ci # # # 0 N +t1 MEMORY # # # # # # # # # # # # utf8mb3_unicode_ci # # # 0 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; diff --git a/mysql-test/suite/funcs_2/r/myisam_charset.result b/mysql-test/suite/funcs_2/r/myisam_charset.result index 9950b446a63a2..b6cbebd4ec110 100644 --- a/mysql-test/suite/funcs_2/r/myisam_charset.result +++ b/mysql-test/suite/funcs_2/r/myisam_charset.result @@ -17563,7 +17563,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_bin; @@ -20104,7 +20104,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_czech_ci; @@ -22645,7 +22645,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_danish_ci; @@ -25186,7 +25186,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_estonian_ci; @@ -27727,7 +27727,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_general_ci; @@ -30268,7 +30268,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_hungarian_ci; @@ -32809,7 +32809,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_icelandic_ci; @@ -35350,7 +35350,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_latvian_ci; @@ -37891,7 +37891,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_lithuanian_ci; @@ -40432,7 +40432,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_persian_ci; @@ -42973,7 +42973,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_polish_ci; @@ -45514,7 +45514,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_roman_ci; @@ -48055,7 +48055,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_romanian_ci; @@ -50596,7 +50596,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_slovak_ci; @@ -53137,7 +53137,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_slovenian_ci; @@ -55678,7 +55678,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_spanish2_ci; @@ -58219,7 +58219,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_spanish_ci; @@ -60760,7 +60760,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_swedish_ci; @@ -63301,7 +63301,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_turkish_ci; @@ -65842,7 +65842,7 @@ SET NAMES utf8; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; ALTER TABLE test.t1 CHANGE a a CHAR(4) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci; @@ -68382,7 +68382,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_bin) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_bin # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_bin # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -70921,7 +70921,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_czech_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_czech_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_czech_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_czech_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -73460,7 +73460,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_danish_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_danish_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_danish_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_danish_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -75999,7 +75999,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_estonian_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_estonian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_estonian_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_estonian_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -78538,7 +78538,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_general_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_general_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_general_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -81077,7 +81077,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_hungarian_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_hungarian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_hungarian_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_hungarian_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -83616,7 +83616,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_icelandic_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_icelandic_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_icelandic_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_icelandic_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -86155,7 +86155,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_latvian_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_latvian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_latvian_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_latvian_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -88694,7 +88694,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_lithuanian_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_lithuanian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_lithuanian_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_lithuanian_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -91233,7 +91233,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_persian_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_persian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_persian_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_persian_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -93772,7 +93772,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_polish_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_polish_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_polish_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_polish_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -96311,7 +96311,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_roman_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_roman_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_roman_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_roman_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -98850,7 +98850,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_romanian_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_romanian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_romanian_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_romanian_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -101389,7 +101389,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_slovak_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_slovak_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_slovak_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_slovak_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -103928,7 +103928,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_slovenian_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_slovenian_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_slovenian_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_slovenian_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -106467,7 +106467,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_spanish2_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_spanish2_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_spanish2_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_spanish2_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -109006,7 +109006,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_spanish_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_spanish_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_spanish_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_spanish_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -111545,7 +111545,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_swedish_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_swedish_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_swedish_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_swedish_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -114084,7 +114084,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_turkish_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_turkish_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_turkish_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_turkish_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; @@ -116623,7 +116623,7 @@ USE test; CREATE TABLE test.t1 (a CHAR(4) CHARACTER SET utf8 COLLATE utf8_unicode_ci) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary -t1 MyISAM # # # # # # # # # # # # utf8_unicode_ci # # # 17179868160 N +t1 MyISAM # # # # # # # # # # # # utf8mb3_unicode_ci # # # 17179868160 N LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_2/data/charset_utf8.txt' INTO TABLE test.t1; DELETE FROM test.t1 WHERE CHAR_LENGTH(a) <> 1; diff --git a/mysql-test/suite/funcs_2/t/innodb_charset.test b/mysql-test/suite/funcs_2/t/innodb_charset.test index da4dea44ad7d3..631c20352d42c 100644 --- a/mysql-test/suite/funcs_2/t/innodb_charset.test +++ b/mysql-test/suite/funcs_2/t/innodb_charset.test @@ -9,6 +9,10 @@ --source include/no_valgrind_without_big.inc --source include/have_innodb.inc +# Starting with MariaDB 10.6, ensure that DDL recovery will have completed +# before DROP DATABASE test. +SET GLOBAL innodb_max_purge_lag_wait=0; + let $engine_type= InnoDB; --source suite/funcs_2/charset/charset_master.test diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index c00bc326bcaf6..bcf6078f62467 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -10,40 +10,20 @@ # ############################################################################## -GCF-1081 : MDEV-18283 Galera test failure on galera.GCF-1081 -GCF-939 : MDEV-21520 galera.GCF-939 -MDEV-20225 : MDEV-20886 galera.MDEV-20225 -MW-328A : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002 -MW-328B : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002 -MW-328D : MDEV-27550 ER_LOCK_DEADLOCK is gone after MDEV-27025 -MW-329 : MDEV-19962 Galera test failure on MW-329 -galera_applier_ftwrl_table_alter : MDEV-26502 : galera.galera_applier_ftwrl_table_alter MTR failed : Result content mismatch -galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event() -galera_bf_abort_group_commit : MDEV-18282 Galera test failure on galera.galera_bf_abort_group_commit -galera_bf_kill_debug : MDEV-24485 wsrep::client_state::do_acquire_ownership(): Assertion `state_ == s_idle || mode_ != m_local' failed -galera_bf_lock_wait : MDEV-21597 wsrep::transaction::start_transaction(): Assertion `active() == false' failed -galera_encrypt_tmp_files : Get error failed to enable encryption of temporary files -galera_ftwrl : MDEV-21525 galera.galera_ftwrl -galera_gcache_recover_manytrx : MDEV-18834 Galera test failure -galera_kill_largechanges : MDEV-18179 Galera test failure on galera.galera_kill_largechanges -galera_many_tables_nopk : MDEV-18182 Galera test failure on galera.galera_many_tables_nopk -galera_mdl_race : MDEV-21524 galera.galera_mdl_race -galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails -galera_pc_ignore_sb : MDEV-20888 galera.galera_pc_ignore_sb +galera_as_slave_ctas : MDEV-28378 timeout galera_pc_recovery : MDEV-25199 cluster fails to start up -galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim -galera_sst_mysqldump : MDEV-26501 : galera.galera_sst_mysqldump MTR failed: galera SST with mysqldump failed -galera_trigger : MDEV-24048 galera.galera_trigger MTR fails: Result content mismatch -galera_unicode_identifiers : MDEV-26500 : galera.galera_unicode_identifiers MTR failed: InnoDB: innodb_fatal_semaphore_wait_threshold was exceeded for dict_sys.mutex -galera_var_dirty_reads : MDEV-25615 Galera test failure on galera_var_dirty_reads -galera_var_ignore_apply_errors : MDEV-26770 galera_var_ignore_apply_errors fails Server did not transition to READY state +galera_sst_encrypted : MDEV-29876 Galera test failure on galera_sst_encrypted +MW-284 : MDEV-29861 Galera test case hangs +galera_binlog_checksum : MDEV-29861 Galera test case hangs +galera_var_notify_ssl_ipv6 : MDEV-29861 Galera test case hangs +galera_var_notify_cmd: MDEV-29861 Galera test case hangs galera_var_node_address : MDEV-20485 Galera test failure -galera_var_notify_cmd : MDEV-21905 Galera test galera_var_notify_cmd causes hang -galera_var_retry_autocommit: MDEV-18181 Galera test failure on galera.galera_var_retry_autocommit -galera_wsrep_provider_unset_set: wsrep_provider is read-only for security reasons -mysql-wsrep#198 : MDEV-24446: galera.mysql-wsrep#198 MTR failed: query 'reap' failed: 2000: Unknown MySQL error -partition : MDEV-19958 Galera test failure on galera.partition -pxc-421: wsrep_provider is read-only for security reasons -query_cache: MDEV-15805 Test failure on galera.query_cache -versioning_trx_id: MDEV-18590: galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch -galera_bf_abort_at_after_statement : Unstable +MDEV-26575 : MDEV-29878 Galera test failure on MDEV-26575 +galera_bf_abort_shutdown : MDEV-29918 Assertion failure on galera_bf_abort_shutdown +# Links to below failures in MDEV-30172 +galera_wan : [ERROR] WSREP: /home/buildbot/buildbot/build/gcs/src/gcs_state_msg.cpp:gcs_state_msg_get_quorum():947: Failed to establish quorum. +galera_var_ignore_apply_errors : 28: "Server did not transition to READY state" +galera_bf_kill_debug : timeout after 900 seconds +galera_ssl_upgrade : [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 130: Incorrect file format 'gtid_slave_pos' +galera_parallel_simple : timeout related to wsrep_sync_wait +galera_insert_bulk : MDEV-30536 no expected deadlock in galera_insert_bulk test diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf index 64c92883b3ada..3532c1f213494 100644 --- a/mysql-test/suite/galera/galera_2nodes.cnf +++ b/mysql-test/suite/galera/galera_2nodes.cnf @@ -7,47 +7,31 @@ binlog-format=row innodb-autoinc-lock-mode=2 default-storage-engine=innodb wsrep-provider=@ENV.WSREP_PROVIDER -wsrep_node_address=127.0.0.1 # enforce read-committed characteristics across the cluster +# wsrep-causal-reads=ON wsrep-sync-wait=15 [mysqld.1] -loose-innodb +wsrep-on=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 -wsrep-cluster-address=gcomm:// +wsrep_cluster_address=gcomm:// wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' -# enforce read-committed characteristics across the cluster -wsrep_causal_reads=ON -wsrep_sync_wait = 15 - [mysqld.2] -loose-innodb -# debug=d:t:i:o,/tmp/mysqld.2.trace +wsrep-on=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S' - -# enforce read-committed characteristics across the cluster -wsrep_causal_reads=ON -wsrep_sync_wait = 15 - -wsrep_node_address=127.0.0.1 -wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port -wsrep_sst_receive_address='127.0.0.2:@mysqld.2.#sst_port' - -# enforce read-committed characteristics across the cluster -wsrep_causal_reads=ON -wsrep_sync_wait = 15 +wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' [ENV] NODE_MYPORT_1= @mysqld.1.port diff --git a/mysql-test/suite/galera/galera_2nodes_as_master.cnf b/mysql-test/suite/galera/galera_2nodes_as_master.cnf index 4d89b02387ba6..ba53d6062c1ad 100644 --- a/mysql-test/suite/galera/galera_2nodes_as_master.cnf +++ b/mysql-test/suite/galera/galera_2nodes_as_master.cnf @@ -7,50 +7,44 @@ !include include/default_mysqld.cnf [mysqld] +loose-innodb log-bin=mysqld-bin +log-slave-updates binlog-format=row innodb-autoinc-lock-mode=2 default-storage-engine=innodb +# enforce read-committed characteristics across the cluster +# wsrep-causal-reads=ON +wsrep-sync-wait=15 [mysqld.1] +wsrep-on=1 +server-id=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port - -server-id=1 -log_slave_updates - -wsrep-on=1 -wsrep-provider=@ENV.WSREP_PROVIDER -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M' +wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address=gcomm:// -wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' -wsrep_node_address=127.0.0.1 +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port -# enforce read-committed characteristics across the cluster -wsrep-causal-reads=ON -wsrep-sync-wait=15 +wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' [mysqld.2] +wsrep-on=1 +server-id=2 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port - -server-id=2 -log_slave_updates - -wsrep-on=1 wsrep_provider=@ENV.WSREP_PROVIDER -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M' wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' -wsrep_node_address=127.0.0.1 +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port -# enforce read-committed characteristics across the cluster -wsrep-causal-reads=ON -wsrep-sync-wait=15 +wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' [mysqld.3] +wsrep-on=OFF server-id=3 [ENV] diff --git a/mysql-test/suite/galera/galera_2nodes_as_slave.cnf b/mysql-test/suite/galera/galera_2nodes_as_slave.cnf index f22703a59f0ae..f25c7cc6d484e 100644 --- a/mysql-test/suite/galera/galera_2nodes_as_slave.cnf +++ b/mysql-test/suite/galera/galera_2nodes_as_slave.cnf @@ -6,61 +6,45 @@ !include include/default_mysqld.cnf [mysqld] +loose-innodb +log-bin=mysqld-bin +log-slave-updates binlog-format=row +innodb-autoinc-lock-mode=2 +default-storage-engine=innodb +# enforce read-committed characteristics across the cluster +# wsrep-causal-reads=ON +wsrep-sync-wait=15 [mysqld.1] +wsrep-on=1 +server-id=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 - -log-bin=master-bin -log-bin-index=master-bin -log-slave-updates - -innodb-autoinc-lock-mode=2 -default-storage-engine=innodb -wsrep-provider=@ENV.WSREP_PROVIDER -wsrep_node_address=127.0.0.1 -wsrep-cluster-address=gcomm:// -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M' +wsrep_provider=@ENV.WSREP_PROVIDER +wsrep_cluster_address=gcomm:// +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' -# enforce read-committed characteristics across the cluster -wsrep-causal-reads=ON -wsrep-sync-wait=15 -server-id=1 - [mysqld.2] +wsrep-on=1 +server-id=2 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 - -log-bin=master-bin -log-bin-index=master-bin -log-slave-updates - -innodb-autoinc-lock-mode=2 -default-storage-engine=innodb -wsrep-provider=@ENV.WSREP_PROVIDER -wsrep_node_address=127.0.0.1 +wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' -# enforce read-committed characteristics across the cluster -wsrep-causal-reads=ON -wsrep-sync-wait=15 -server-id=2 - [mysqld.3] -log-bin=master-bin -log-bin-index=master-bin -server-id=3 wsrep-on=OFF +server-id=3 [ENV] NODE_MYPORT_1= @mysqld.1.port diff --git a/mysql-test/suite/galera/galera_2x2nodes.cnf b/mysql-test/suite/galera/galera_2x2nodes.cnf new file mode 100644 index 0000000000000..922906eac6f39 --- /dev/null +++ b/mysql-test/suite/galera/galera_2x2nodes.cnf @@ -0,0 +1,77 @@ +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld] +loose-innodb +log-bin=mysqld-bin +log-slave-updates +binlog-format=row +innodb-autoinc-lock-mode=2 +default-storage-engine=innodb +wsrep_gtid_mode=1 +gtid_ignore_duplicates +auto_increment_increment=3 + +wsrep-provider=@ENV.WSREP_PROVIDER +# enforce read-committed characteristics across the cluster +# wsrep-causal-reads=ON +wsrep-sync-wait=15 + +[mysqld.1] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address=gcomm:// +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' + +[mysqld.2] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' + +[mysqld.3] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address=gcomm:// +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' + +[mysqld.4] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.3.#galera_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.4.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port' + +[ENV] +NODE_MYPORT_1= @mysqld.1.port +NODE_MYSOCK_1= @mysqld.1.socket + +NODE_MYPORT_2= @mysqld.2.port +NODE_MYSOCK_2= @mysqld.2.socket + +NODE_MYPORT_3= @mysqld.3.port +NODE_MYSOCK_3= @mysqld.3.socket + +NODE_MYPORT_4= @mysqld.4.port +NODE_MYSOCK_4= @mysqld.4.socket + + diff --git a/mysql-test/suite/galera/galera_3nodes_as_slave.cnf b/mysql-test/suite/galera/galera_3nodes_as_slave.cnf index 68558b697e852..0ecf877b5a33f 100644 --- a/mysql-test/suite/galera/galera_3nodes_as_slave.cnf +++ b/mysql-test/suite/galera/galera_3nodes_as_slave.cnf @@ -6,79 +6,57 @@ !include include/default_mysqld.cnf [mysqld] -log-bin +loose-innodb +log-bin=mysqld-bin +log-slave-updates binlog-format=row +innodb-autoinc-lock-mode=2 +default-storage-engine=innodb +# enforce read-committed characteristics across the cluster +# wsrep-causal-reads=ON +wsrep-sync-wait=15 [mysqld.1] +wsrep-on=1 +server-id=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 - -log-slave-updates -wsrep-on=1 - -innodb-autoinc-lock-mode=2 -default-storage-engine=innodb -wsrep-provider=@ENV.WSREP_PROVIDER -wsrep_node_address=127.0.0.1 -wsrep-cluster-address=gcomm:// -wsrep_provider_options='base_port=@mysqld.1.#galera_port;evs.install_timeout = PT15S;evs.max_install_timeouts=1;gcache.size=10M' +wsrep_provider=@ENV.WSREP_PROVIDER +wsrep_cluster_address=gcomm:// +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' -# enforce read-committed characteristics across the cluster -wsrep-causal-reads=ON -wsrep-sync-wait=15 -server-id=1 - [mysqld.2] +wsrep-on=1 +server-id=2 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 - -log-slave-updates -wsrep-on=1 - -innodb-autoinc-lock-mode=2 -default-storage-engine=innodb -wsrep-provider=@ENV.WSREP_PROVIDER -wsrep_node_address=127.0.0.1 +wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.install_timeout=PT15S;evs.max_install_timeouts=1;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' -# enforce read-committed characteristics across the cluster -wsrep-causal-reads=ON -wsrep-sync-wait=15 -server-id=2 - [mysqld.3] +wsrep-on=1 +server-id=3 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 - -log-slave-updates -wsrep-on=1 - -innodb-autoinc-lock-mode=2 -default-storage-engine=innodb wsrep-provider=@ENV.WSREP_PROVIDER -wsrep_node_address=127.0.0.1 wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.install_timeout=PT15S;evs.max_install_timeouts=1;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' -# enforce read-committed characteristics across the cluster -wsrep-causal-reads=ON -wsrep-sync-wait=15 -server-id=3 - [mysqld.4] +wsrep-on=OFF server-id=4 [ENV] diff --git a/mysql-test/suite/galera/galera_4nodes.cnf b/mysql-test/suite/galera/galera_4nodes.cnf index 65620313b23ac..66238a8e4c245 100644 --- a/mysql-test/suite/galera/galera_4nodes.cnf +++ b/mysql-test/suite/galera/galera_4nodes.cnf @@ -2,54 +2,56 @@ !include include/default_mysqld.cnf [mysqld] +loose-innodb binlog-format=row innodb-autoinc-lock-mode=2 default-storage-engine=innodb wsrep-provider=@ENV.WSREP_PROVIDER -wsrep_node_address=127.0.0.1 # enforce read-committed characteristics across the cluster -wsrep-causal-reads=ON +# wsrep-causal-reads=ON wsrep-sync-wait=15 [mysqld.1] +wsrep-on=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 -wsrep-cluster-address=gcomm:// -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M' +wsrep_cluster_address=gcomm:// +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' [mysqld.2] +wsrep-on=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' - [mysqld.3] +wsrep-on=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' - [mysqld.4] +wsrep-on=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.4.#galera_port;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.4.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port' diff --git a/mysql-test/suite/galera/include/galera_wsrep_recover.inc b/mysql-test/suite/galera/include/galera_wsrep_recover.inc index d2956ea99e6dc..aa2f0e2e777e5 100644 --- a/mysql-test/suite/galera/include/galera_wsrep_recover.inc +++ b/mysql-test/suite/galera/include/galera_wsrep_recover.inc @@ -1,5 +1,12 @@ --echo Performing --wsrep-recover ... +if ($wsrep_recover_additional) +{ +--exec $MYSQLD --defaults-group-suffix=.$galera_wsrep_recover_server_id --defaults-file=$MYSQLTEST_VARDIR/my.cnf --log-error=$MYSQL_TMP_DIR/galera_wsrep_recover.log --innodb --wsrep-recover $wsrep_recover_additional > $MYSQL_TMP_DIR/galera_wsrep_recover.log 2>&1 +} +if (!$wsrep_recover_additional) +{ --exec $MYSQLD --defaults-group-suffix=.$galera_wsrep_recover_server_id --defaults-file=$MYSQLTEST_VARDIR/my.cnf --log-error=$MYSQL_TMP_DIR/galera_wsrep_recover.log --innodb --wsrep-recover > $MYSQL_TMP_DIR/galera_wsrep_recover.log 2>&1 +} --perl use strict; diff --git a/mysql-test/suite/galera/include/kill_galera.inc b/mysql-test/suite/galera/include/kill_galera.inc index 98ebf4ff35d0d..28a1b0f368c3c 100644 --- a/mysql-test/suite/galera/include/kill_galera.inc +++ b/mysql-test/suite/galera/include/kill_galera.inc @@ -2,12 +2,12 @@ if (!$kill_signal) { ---let $kill_signal = 9 +--let $kill_signal = KILL } # 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 +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --exec echo "wait" > $_expect_file_name # Kill the connected server diff --git a/mysql-test/suite/galera/include/shutdown_mysqld.inc b/mysql-test/suite/galera/include/shutdown_mysqld.inc index 54bba1318e717..793be8d76acb2 100644 --- a/mysql-test/suite/galera/include/shutdown_mysqld.inc +++ b/mysql-test/suite/galera/include/shutdown_mysqld.inc @@ -8,8 +8,8 @@ if ($rpl_inited) } # 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 +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --exec echo "wait" > $_expect_file_name # Send shutdown to the connected server diff --git a/mysql-test/suite/galera/r/GAL-401.result b/mysql-test/suite/galera/r/GAL-401.result index 3dfc32ffb8cc2..859a4415f8d1a 100644 --- a/mysql-test/suite/galera/r/GAL-401.result +++ b/mysql-test/suite/galera/r/GAL-401.result @@ -22,7 +22,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` char(1) DEFAULT NULL, PRIMARY KEY (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CALL mtr.add_suppression("WSREP: Protocol violation. JOIN message sender (.*) is not in state transfer \\(SYNCED\\). Message ignored."); connection node_1; diff --git a/mysql-test/suite/galera/r/GCF-1081.result b/mysql-test/suite/galera/r/GCF-1081.result deleted file mode 100644 index ede512ec6b12e..0000000000000 --- a/mysql-test/suite/galera/r/GCF-1081.result +++ /dev/null @@ -1,47 +0,0 @@ -connection node_2; -connection node_1; -connection node_1; -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, 0), (3, 0); -CREATE PROCEDURE proc_update () -BEGIN -UPDATE t1 SET f2 = 1 where f1 > 0; -END| -connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; -SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync'; -connection node_1; -CALL proc_update ();; -connection node_1a; -SET SESSION wsrep_sync_wait = 0; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -connection node_1a; -SET GLOBAL DEBUG = 'd,sync.wsrep_before_BF_victim_unlock'; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead -connection node_2; -INSERT INTO t1 VALUES (2, 2);; -connection node_1a; -SET SESSION DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_before_BF_victim_unlock_reached'; -SET GLOBAL DEBUG = ''; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead -connection node_1a; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync'; -connection node_2; -SELECT * FROM t1; -f1 f2 -1 1 -2 2 -3 1 -connection node_1; -SELECT * FROM t1; -f1 f2 -1 1 -2 2 -3 1 -wsrep_local_replays -1 -DROP PROCEDURE proc_update; -DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/MDEV-10715.result b/mysql-test/suite/galera/r/MDEV-10715.result index 5ab60f08097bd..12b9c2367c428 100644 --- a/mysql-test/suite/galera/r/MDEV-10715.result +++ b/mysql-test/suite/galera/r/MDEV-10715.result @@ -26,3 +26,5 @@ wsrep_last_written_gtid() 1-1-0 connection node_1; drop table t1; +connection node_2; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); diff --git a/mysql-test/suite/galera/r/MDEV-18832.result b/mysql-test/suite/galera/r/MDEV-18832.result index 700a0bbefb1d5..2e0872b9f2e18 100644 --- a/mysql-test/suite/galera/r/MDEV-18832.result +++ b/mysql-test/suite/galera/r/MDEV-18832.result @@ -12,3 +12,6 @@ INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' DROP SEQUENCE Seq1_1; DROP TABLE t1; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +connection node_2; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); diff --git a/mysql-test/suite/galera/r/MDEV-20225.result b/mysql-test/suite/galera/r/MDEV-20225.result index 9f20daed9de03..245051309d130 100644 --- a/mysql-test/suite/galera/r/MDEV-20225.result +++ b/mysql-test/suite/galera/r/MDEV-20225.result @@ -11,11 +11,12 @@ DROP TRIGGER tr1; connection node_2; connection node_1; INSERT INTO t1 VALUES (NULL); -connection node_2; +connection node_2a; SET GLOBAL debug_dbug = 'RESET'; SET DEBUG_SYNC = 'now SIGNAL signal.mdev_20225_continue'; SET DEBUG_SYNC = 'RESET'; SET GLOBAL wsrep_slave_threads = 1; +connection node_2; SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/MDEV-25389.result b/mysql-test/suite/galera/r/MDEV-25389.result new file mode 100644 index 0000000000000..f369fe4dbaee9 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-25389.result @@ -0,0 +1,17 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_2; +call mtr.add_suppression("WSREP: Failed to create/initialize system thread"); +SET GLOBAL debug_dbug='+d,wsrep_simulate_failed_connection_1'; +SET GLOBAL wsrep_slave_threads=2; +ERROR HY000: Incorrect arguments to SET +SELECT @@wsrep_slave_threads; +@@wsrep_slave_threads +1 +SET GLOBAL debug_dbug=''; +SET GLOBAL wsrep_slave_threads=1; +SELECT @@wsrep_slave_threads; +@@wsrep_slave_threads +1 diff --git a/mysql-test/suite/galera/r/MDEV-25494.result b/mysql-test/suite/galera/r/MDEV-25494.result new file mode 100644 index 0000000000000..e4d477ca5d446 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-25494.result @@ -0,0 +1,14 @@ +connection node_2; +connection node_1; +SET SESSION binlog_format=STATEMENT; +Warnings: +Warning 1105 MariaDB Galera and flashback do not support binlog format: STATEMENT +CREATE TEMPORARY TABLE t (i INT) UNION=(t); +ALTER TABLE t ADD extrac CHAR(1); +SHOW CREATE TABLE t; +Table Create Table +t CREATE TEMPORARY TABLE `t` ( + `i` int(11) DEFAULT NULL, + `extrac` char(1) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t; diff --git a/mysql-test/suite/galera/r/MDEV-26575.result b/mysql-test/suite/galera/r/MDEV-26575.result new file mode 100644 index 0000000000000..5b447e1ae2096 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-26575.result @@ -0,0 +1,11 @@ +connection node_2; +connection node_1; +connection node_2; +call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*"); +connection node_1; +connection node_1; +connection node_2; +connection node_2; +SET SESSION wsrep_on = OFF; +XA START 'xatest'; +ERROR 42000: This version of MariaDB doesn't yet support 'XA transactions with Galera replication' diff --git a/mysql-test/suite/galera/r/MDEV-26597.result b/mysql-test/suite/galera/r/MDEV-26597.result new file mode 100644 index 0000000000000..15e334468a5e8 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-26597.result @@ -0,0 +1,19 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_2; +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 FLOAT(3,2)); +SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512'; +SET @@autocommit=0; +INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75); +CREATE TABLE t1 ( pk int primary key) ENGINE=INNODB; +ERROR HY000: Maximum writeset size exceeded +SHOW WARNINGS; +Level Code Message +Error 1105 Maximum writeset size exceeded +connection node_2; +SET SESSION wsrep_sync_wait = 0; +Killing server ... +connection node_1; +DROP TABLE t3; diff --git a/mysql-test/suite/galera/r/MDEV-27123.result b/mysql-test/suite/galera/r/MDEV-27123.result new file mode 100644 index 0000000000000..98377162a355f --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-27123.result @@ -0,0 +1,17 @@ +connection node_2; +connection node_1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 3 +auto_increment_offset 3 +create table t4 (c1 int primary key auto_increment) engine=innodb; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 3 +auto_increment_offset 3 +alter table t4 add (c2 varchar(50)); +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 3 +auto_increment_offset 3 +DROP TABLE t4; diff --git a/mysql-test/suite/galera/r/MDEV-27713.result b/mysql-test/suite/galera/r/MDEV-27713.result new file mode 100644 index 0000000000000..14575cb484da8 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-27713.result @@ -0,0 +1,46 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 ( +f1 INT, +f2 VARCHAR(255) PRIMARY KEY +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES(1, 'abc'); +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (2,'def'); +connection node_2; +SET GLOBAL event_scheduler=ON; +CREATE PROCEDURE update_table() +BEGIN +SET AUTOCOMMIT=OFF; +DO GET_LOCK('local_lock', 0); +SET DEBUG_SYNC = 'innodb_row_update_for_mysql_begin SIGNAL blocked WAIT_FOR continue'; +UPDATE t1 SET f2 = 'jkl' WHERE f1 != 2; +DO RELEASE_LOCK('local_lock'); +END| +CREATE DEFINER=current_user +EVENT event +ON SCHEDULE AT CURRENT_TIMESTAMP +ON COMPLETION PRESERVE +ENABLE +DO CALL update_table(); +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +SET DEBUG_SYNC = 'now WAIT_FOR blocked'; +connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2; +SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb"; +connection node_1; +COMMIT; +connection node_2b; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +connection node_2a; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_2; +SET GLOBAL event_scheduler=default; +DROP PROCEDURE update_table; +DROP EVENT event; +SET DEBUG_SYNC='reset'; +SET GLOBAL debug_dbug = DEFAULT; +connection node_1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/MDEV-27862.result b/mysql-test/suite/galera/r/MDEV-27862.result new file mode 100644 index 0000000000000..25b7bc6cfd26a --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-27862.result @@ -0,0 +1,54 @@ +connection node_2; +connection node_1; +CREATE SEQUENCE seq_nocache ENGINE=InnoDB; +DROP SEQUENCE seq_nocache; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +connection node_2; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +connection node_1; +CREATE SEQUENCE seq NOCACHE ENGINE=InnoDB; +SELECT NEXTVAL(seq) = 1; +NEXTVAL(seq) = 1 +1 +connection node_2; +SELECT NEXTVAL(seq) = 2; +NEXTVAL(seq) = 2 +1 +connection node_1; +SELECT NEXTVAL(seq) = 3; +NEXTVAL(seq) = 3 +1 +SELECT SETVAL(seq, 100); +SETVAL(seq, 100) +100 +connection node_2; +SELECT NEXTVAL(seq) = 101; +NEXTVAL(seq) = 101 +1 +connection node_1; +SELECT NEXTVAL(seq) = 102; +NEXTVAL(seq) = 102 +1 +DROP SEQUENCE seq; +CREATE TABLE t1(f1 INT); +CREATE SEQUENCE seq_transaction NOCACHE ENGINE=InnoDB; +START TRANSACTION; +INSERT INTO t1 VALUES (0); +SELECT NEXTVAL(seq_transaction); +NEXTVAL(seq_transaction) +1 +INSERT INTO t1 VALUES (NEXTVAL(seq_transaction)); +COMMIT; +connection node_2; +SELECT COUNT(*) = 2 FROM t1; +COUNT(*) = 2 +1 +SELECT NEXTVAL(seq_transaction) = 3; +NEXTVAL(seq_transaction) = 3 +1 +connection node_1; +SELECT NEXTVAL(seq_transaction) = 4; +NEXTVAL(seq_transaction) = 4 +1 +DROP SEQUENCE seq_transaction; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/MDEV-28053.result b/mysql-test/suite/galera/r/MDEV-28053.result new file mode 100644 index 0000000000000..b3f93688dd050 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-28053.result @@ -0,0 +1,14 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_3; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +connection node_2; +connection node_3; +DROP TABLE t1; +connection node_2; +connection node_2; +STOP SLAVE; +RESET SLAVE ALL; +connection node_3; +RESET MASTER; diff --git a/mysql-test/suite/galera/r/MDEV-29142.result b/mysql-test/suite/galera/r/MDEV-29142.result new file mode 100644 index 0000000000000..2528520e23667 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-29142.result @@ -0,0 +1,45 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_1; +call mtr.add_suppression("WSREP: Event .* Write_rows_v1 apply failed:.*"); +call mtr.add_suppression("WSREP: Failed to apply write set:.*"); +call mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on.*"); +connection node_2; +call mtr.add_suppression("WSREP: Failed to open table mysql.wsrep_streaming_log for writing"); +call mtr.add_suppression("WSREP: Failed to open SR table for write"); +call mtr.add_suppression("WSREP: Failed to recover SR transactions from schema: wsrep_on : 0"); +call mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on.*"); +SET @@global.tx_read_only = ON; +SET default_storage_engine = SEQUENCE; +create table t1 (c1 int); +ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by the engine") +CREATE TABLE t1(c1 VARCHAR(20)) engine=innodb; +INSERT INTO t1 VALUES(0xA9B8); +create TABLE t1 (c1 int) engine=innodb; +ERROR 42S01: Table 't1' already exists +create TABLE t1 (c1 int) engine=innodb; +ERROR 42S01: Table 't1' already exists +SET GLOBAL wsrep_on=OFF; +SET GLOBAL wsrep_cluster_address='gcomm://'; +INSERT INTO t1 VALUES (1); +SELECT 1; +1 +1 +SELECT 1; +1 +1 +COMMIT; +# Killing cluster because we have messed with wsrep_cluster_address +connection node_2; +SET SESSION wsrep_sync_wait = 0; +Killing server ... +connection node_1; +SET SESSION wsrep_sync_wait = 0; +Killing server ... +connection node_2; +call mtr.add_suppression("WSREP: Failed to open table mysql.wsrep_streaming_log for writing"); +call mtr.add_suppression("WSREP: Failed to open SR table for write"); +call mtr.add_suppression("WSREP: Failed to recover SR transactions from schema: wsrep_on : 0"); +DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/galera/r/MDEV-29512.result b/mysql-test/suite/galera/r/MDEV-29512.result new file mode 100644 index 0000000000000..aaf24df920e99 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-29512.result @@ -0,0 +1,40 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 int, f3 varchar(2000)); +INSERT INTO t1 VALUES (1, 0, REPEAT('1234567890', 200)); +INSERT INTO t1 VALUES (3, 3, REPEAT('1234567890', 200)); +SET SESSION wsrep_sync_wait=0; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; +SET SESSION wsrep_sync_wait=0; +connection node_1; +begin; +select f1,f2 from t1; +f1 f2 +1 0 +3 3 +connection node_2; +UPDATE t1 SET f2=2 WHERE f1=3; +connection node_1a; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +connection node_1; +UPDATE t1 SET f2=1 WHERE f1=3; +SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync'; +COMMIT; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync'; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +SET GLOBAL debug_dbug = NULL; +SET debug_sync='RESET'; +connection node_1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +select f1,f2 from t1; +f1 f2 +1 0 +3 2 +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/MDEV-30804.result b/mysql-test/suite/galera/r/MDEV-30804.result new file mode 100644 index 0000000000000..2bf323d19f84e --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-30804.result @@ -0,0 +1,11 @@ +connection node_2; +connection node_1; +CREATE TABLE t (a INT) ENGINE=Aria; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +START TRANSACTION; +INSERT INTO t VALUES ('1'); +INSERT INTO t1 VALUES ('1'); +COMMIT; +ERROR HY000: Transactional commit not supported by involved engine(s) +DROP TABLE t; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/MDEV-30955.result b/mysql-test/suite/galera/r/MDEV-30955.result new file mode 100644 index 0000000000000..2a090cb58bca2 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-30955.result @@ -0,0 +1,26 @@ +connection node_2; +connection node_1; +CREATE TABLE t (a CHAR(1) KEY); +START TRANSACTION; +HANDLER t OPEN; +disconnect node_1; +connect node_1, 127.0.0.1, root, , test, $NODE_MYPORT_1; +DROP TABLE t; +BACKUP STAGE START; +START TRANSACTION; +disconnect node_1; +connect node_1, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY); +START TRANSACTION; +INSERT INTO t1 VALUES(1); +HANDLER t2 OPEN; +connection node_2; +INSERT INTO t1 VALUES(1); +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; +connection node_1; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP TABLE t1,t2; diff --git a/mysql-test/suite/galera/r/create.result b/mysql-test/suite/galera/r/create.result index 6ad94dd3d4301..cd0380b206d0f 100644 --- a/mysql-test/suite/galera/r/create.result +++ b/mysql-test/suite/galera/r/create.result @@ -64,7 +64,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `i` int(11) DEFAULT NULL, KEY `idx` (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; # # MDEV-9853: WSREP says it cannot get fake InnoDB transaction ID diff --git a/mysql-test/suite/galera/r/enforce_storage_engine2.result b/mysql-test/suite/galera/r/enforce_storage_engine2.result index 8b174139eaee3..b652eacd4f42d 100644 --- a/mysql-test/suite/galera/r/enforce_storage_engine2.result +++ b/mysql-test/suite/galera/r/enforce_storage_engine2.result @@ -9,6 +9,7 @@ CREATE TABLE t1(i INT) ENGINE=INNODB; CREATE TABLE t2(i INT) ENGINE=MYISAM; Warnings: Note 1266 Using storage engine InnoDB for table 't2' +Note 1266 Using storage engine InnoDB for table 't2' connection node_2; SHOW TABLES; Tables_in_test @@ -18,11 +19,11 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; # End of tests diff --git a/mysql-test/suite/galera/r/galera-features#117.result b/mysql-test/suite/galera/r/galera-features#117.result index 583f3c74a8b68..21d810ca16555 100644 --- a/mysql-test/suite/galera/r/galera-features#117.result +++ b/mysql-test/suite/galera/r/galera-features#117.result @@ -1,5 +1,7 @@ connection node_2; connection node_1; +connection node_1; +connection node_2; connection node_2; SET SESSION wsrep_on=OFF; CREATE TABLE test.t1 (f2 INTEGER); @@ -11,7 +13,7 @@ SHOW CREATE TABLE test.t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW STATUS LIKE 'wsrep_cluster_status'; Variable_name Value wsrep_cluster_status Primary @@ -22,7 +24,7 @@ SHOW CREATE TABLE test.t1; Table Create Table t1 CREATE TABLE `t1` ( `f2` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW STATUS LIKE 'wsrep_cluster_status'; Variable_name Value wsrep_cluster_status Disconnected @@ -35,3 +37,4 @@ Killing server ... CALL mtr.add_suppression("Inconsistent by consensus."); CALL mtr.add_suppression("WSREP: Failed to execute TOI action"); CALL mtr.add_suppression("WSREP: TO isolation end failed"); +connection node_1; diff --git a/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result b/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result index 5ae577a6323c5..b40c57c5d9021 100644 --- a/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result +++ b/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result @@ -14,7 +14,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -32,7 +32,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -50,7 +50,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -68,7 +68,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -86,7 +86,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -104,7 +104,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -122,7 +122,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -140,7 +140,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -158,7 +158,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -176,7 +176,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -202,7 +202,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -220,7 +220,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -238,7 +238,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -256,7 +256,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -274,7 +274,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -292,7 +292,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -310,7 +310,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -328,7 +328,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -346,7 +346,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -364,7 +364,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; diff --git a/mysql-test/suite/galera/r/galera_MDEV-29512.result b/mysql-test/suite/galera/r/galera_MDEV-29512.result new file mode 100644 index 0000000000000..aaf24df920e99 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_MDEV-29512.result @@ -0,0 +1,40 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 int, f3 varchar(2000)); +INSERT INTO t1 VALUES (1, 0, REPEAT('1234567890', 200)); +INSERT INTO t1 VALUES (3, 3, REPEAT('1234567890', 200)); +SET SESSION wsrep_sync_wait=0; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; +SET SESSION wsrep_sync_wait=0; +connection node_1; +begin; +select f1,f2 from t1; +f1 f2 +1 0 +3 3 +connection node_2; +UPDATE t1 SET f2=2 WHERE f1=3; +connection node_1a; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +connection node_1; +UPDATE t1 SET f2=1 WHERE f1=3; +SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync'; +COMMIT; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync'; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +SET GLOBAL debug_dbug = NULL; +SET debug_sync='RESET'; +connection node_1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +select f1,f2 from t1; +f1 f2 +1 0 +3 2 +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_UK_conflict.result b/mysql-test/suite/galera/r/galera_UK_conflict.result index 402289d7ef864..b0420d58ede1c 100644 --- a/mysql-test/suite/galera/r/galera_UK_conflict.result +++ b/mysql-test/suite/galera/r/galera_UK_conflict.result @@ -144,7 +144,6 @@ SET debug_sync='RESET'; connection node_1; SET GLOBAL wsrep_slave_threads = DEFAULT; connection node_2; -SET SESSION wsrep_sync_wait=15; SELECT * FROM t1; f1 f2 f3 1 1 0 diff --git a/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result b/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result index a5aeb6eb36666..451b2c80c2a39 100644 --- a/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result +++ b/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result @@ -24,7 +24,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` int(11) DEFAULT NULL, PRIMARY KEY (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'; COUNT(*) = 0 1 diff --git a/mysql-test/suite/galera/r/galera_as_slave.result b/mysql-test/suite/galera/r/galera_as_slave.result index 391ceecd509d9..1035fe1e9be1a 100644 --- a/mysql-test/suite/galera/r/galera_as_slave.result +++ b/mysql-test/suite/galera/r/galera_as_slave.result @@ -18,6 +18,12 @@ SELECT COUNT(*) = 3 FROM t1; COUNT(*) = 3 1 connection node_3; +SET @@session.binlog_alter_two_phase = 1; +ALTER TABLE t1 ADD COLUMN f2 INT; +INSERT INTO t1 VALUES (4,1); +connection node_1; +connection node_2; +connection node_3; DROP TABLE t1; connection node_2; STOP SLAVE; diff --git a/mysql-test/suite/galera/r/galera_as_slave_autoinc.result b/mysql-test/suite/galera/r/galera_as_slave_autoinc.result index 6ac51f4495031..ffaa62c0003fd 100644 --- a/mysql-test/suite/galera/r/galera_as_slave_autoinc.result +++ b/mysql-test/suite/galera/r/galera_as_slave_autoinc.result @@ -11,10 +11,14 @@ c char(32) DEFAULT 'dummy_text', PRIMARY KEY (i) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; insert into t1(i) values(null); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave select * from t1; i c 1 dummy_text insert into t1(i) values(null), (null), (null); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave select * from t1; i c 1 dummy_text @@ -23,8 +27,12 @@ i c 4 dummy_text SET SESSION auto_increment_increment=7; insert into t1(i) values(null), (null), (null); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave SET SESSION auto_increment_offset=5; insert into t1(i) values(null), (null), (null); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave select * from t1; i c 1 dummy_text @@ -81,8 +89,10 @@ binlog_format ROW show variables like 'auto_increment_increment'; Variable_name Value auto_increment_increment 2 +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format"); connection node_3; DROP TABLE t1; +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format"); connection node_2; STOP SLAVE; RESET SLAVE ALL; diff --git a/mysql-test/suite/galera/r/galera_backup_start.result b/mysql-test/suite/galera/r/galera_backup_start.result new file mode 100644 index 0000000000000..253a0ce74166d --- /dev/null +++ b/mysql-test/suite/galera/r/galera_backup_start.result @@ -0,0 +1,6 @@ +connection node_2; +connection node_1; +BACKUP STAGE START; +START TRANSACTION; +COMMIT; +BACKUP STAGE END; diff --git a/mysql-test/suite/galera/r/galera_bf_abort_at_after_statement.result b/mysql-test/suite/galera/r/galera_bf_abort_at_after_statement.result index f6f0803227f70..71eeb6861eac7 100644 --- a/mysql-test/suite/galera/r/galera_bf_abort_at_after_statement.result +++ b/mysql-test/suite/galera/r/galera_bf_abort_at_after_statement.result @@ -12,6 +12,8 @@ connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; SET DEBUG_SYNC = 'now WAIT_FOR blocked'; connection node_1; UPDATE t1 SET val=3 WHERE id=1; +connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2; +set session wsrep_sync_wait=0; connection node_2a; SET DEBUG_SYNC = 'now SIGNAL continue'; connection node_2; @@ -21,3 +23,5 @@ SET DEBUG_SYNC = 'RESET'; connection node_1; SET DEBUG_SYNC = 'RESET'; DROP TABLE t1; +disconnect node_2a; +disconnect node_2b; diff --git a/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result b/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result deleted file mode 100644 index 0ef2a1a72c648..0000000000000 --- a/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result +++ /dev/null @@ -1,18 +0,0 @@ -connection node_2; -connection node_1; -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -connection node_2a; -SELECT GET_LOCK("foo", 1000); -GET_LOCK("foo", 1000) -1 -connection node_2; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT GET_LOCK("foo", 1000);; -connection node_1; -INSERT INTO t1 VALUES (1); -connection node_2; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -wsrep_local_aborts_increment -1 -DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_bf_abort_ps_bind.result b/mysql-test/suite/galera/r/galera_bf_abort_ps_bind.result new file mode 100644 index 0000000000000..02f4dd25f7c42 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_bf_abort_ps_bind.result @@ -0,0 +1,38 @@ +connection node_2; +connection node_1; +CREATE TABLE t (i int primary key auto_increment, j varchar(20) character set utf8); +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +insert into t values (1, 'first'); +PS_prepare INSERT INTO t(j) VALUES (?);; +PS_bind node1; +PS_execute; +PS_execute; +select * from t; +i j +1 first +3 node1 +5 node1 +PS_close; +PS_prepare INSERT INTO t(j) VALUES (?);; +PS_bind node1; +begin; +update t set j='node1' where i=1; +connection node_2; +update t set j='node2' where i=1; +connection node_1a; +connection node_1; +PS_execute; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +PS_execute; +commit; +PS_close; +select * from t; +i j +1 node2 +3 node1 +5 node1 +7 node1 +drop table t; diff --git a/mysql-test/suite/galera/r/galera_bf_abort_shutdown.result b/mysql-test/suite/galera/r/galera_bf_abort_shutdown.result index fa2a5c373f232..5233ea6c63ca0 100644 --- a/mysql-test/suite/galera/r/galera_bf_abort_shutdown.result +++ b/mysql-test/suite/galera/r/galera_bf_abort_shutdown.result @@ -5,8 +5,11 @@ connection node_2; connection node_1; CREATE TABLE t1 (f1 INT PRIMARY KEY); connection node_2; +call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*"); SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR continue'; INSERT INTO t1 VALUES (1); connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; connection node_1; +connection node_2a; +connection node_1; DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_binlog_cache_size.result b/mysql-test/suite/galera/r/galera_binlog_cache_size.result index eafb68710eed4..a92e548ab7fa4 100644 --- a/mysql-test/suite/galera/r/galera_binlog_cache_size.result +++ b/mysql-test/suite/galera/r/galera_binlog_cache_size.result @@ -10,6 +10,6 @@ SET AUTOCOMMIT=ON; START TRANSACTION; INSERT INTO t1 SELECT REPEAT('a', 767) FROM ten; INSERT INTO t1 SELECT REPEAT('a', 767) FROM ten; -ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again DROP TABLE t1; DROP TABLE ten; diff --git a/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result index a09ad6b97b984..4fe33674701e5 100644 --- a/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result +++ b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result @@ -1,29 +1,44 @@ connection node_2; connection node_1; connection node_1; +SET GLOBAL auto_increment_offset=1; +connection node_2; +SET GLOBAL auto_increment_offset=2; +connection node_1; connection node_2; connection node_2; SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; connection node_1; SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; CREATE TABLE t1 ( -i int(11) NOT NULL AUTO_INCREMENT, -c char(32) DEFAULT 'dummy_text', -PRIMARY KEY (i) +i int(11) NOT NULL primary key AUTO_INCREMENT, +c char(32) DEFAULT 'dummy_text' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 1 insert into t1(i) values(null); -select * from t1; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave +select * from t1 order by i; i c 1 dummy_text insert into t1(i) values(null), (null), (null); -select * from t1; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave +select * from t1 order by i; i c 1 dummy_text 3 dummy_text 5 dummy_text 7 dummy_text connection node_2; -select * from t1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 2 +select * from t1 order by i; i c 1 dummy_text 3 dummy_text @@ -41,23 +56,34 @@ SET GLOBAL wsrep_auto_increment_control='OFF'; SET SESSION auto_increment_increment = 3; SET SESSION auto_increment_offset = 1; CREATE TABLE t1 ( -i int(11) NOT NULL AUTO_INCREMENT, -c char(32) DEFAULT 'dummy_text', -PRIMARY KEY (i) +i int(11) NOT NULL primary key AUTO_INCREMENT, +c char(32) DEFAULT 'dummy_text' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 3 +auto_increment_offset 1 insert into t1(i) values(null); -select * from t1; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave +select * from t1 order by i; i c 1 dummy_text insert into t1(i) values(null), (null), (null); -select * from t1; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave +select * from t1 order by i; i c 1 dummy_text 4 dummy_text 7 dummy_text 10 dummy_text connection node_2; -select * from t1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 2 +select * from t1 order by i; i c 1 dummy_text 4 dummy_text @@ -66,6 +92,7 @@ i c connection node_1; SET GLOBAL wsrep_auto_increment_control='ON'; SET SESSION binlog_format='ROW'; +connection node_1; show variables like 'binlog_format'; Variable_name Value binlog_format ROW @@ -81,29 +108,37 @@ auto_increment_increment 3 auto_increment_offset 1 wsrep_auto_increment_control OFF SET GLOBAL wsrep_auto_increment_control='ON'; +connection node_1; drop table t1; connection node_2; SET GLOBAL wsrep_forced_binlog_format='ROW'; connection node_1; SET GLOBAL wsrep_forced_binlog_format='ROW'; CREATE TABLE t1 ( -i int(11) NOT NULL AUTO_INCREMENT, -c char(32) DEFAULT 'dummy_text', -PRIMARY KEY (i) +i int(11) NOT NULL primary key AUTO_INCREMENT, +c char(32) DEFAULT 'dummy_text' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 1 insert into t1(i) values(null); -select * from t1; +select * from t1 order by i; i c 1 dummy_text insert into t1(i) values(null), (null), (null); -select * from t1; +select * from t1 order by i; i c 1 dummy_text 3 dummy_text 5 dummy_text 7 dummy_text connection node_2; -select * from t1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 2 +select * from t1 order by i; i c 1 dummy_text 3 dummy_text @@ -121,23 +156,30 @@ SET GLOBAL wsrep_auto_increment_control='OFF'; SET SESSION auto_increment_increment = 3; SET SESSION auto_increment_offset = 1; CREATE TABLE t1 ( -i int(11) NOT NULL AUTO_INCREMENT, -c char(32) DEFAULT 'dummy_text', -PRIMARY KEY (i) +i int(11) NOT NULL primary key AUTO_INCREMENT, +c char(32) DEFAULT 'dummy_text' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 3 +auto_increment_offset 1 insert into t1(i) values(null); -select * from t1; +select * from t1 order by i; i c 1 dummy_text insert into t1(i) values(null), (null), (null); -select * from t1; +select * from t1 order by i; i c 1 dummy_text 4 dummy_text 7 dummy_text 10 dummy_text connection node_2; -select * from t1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 2 +select * from t1 order by i; i c 1 dummy_text 4 dummy_text @@ -151,13 +193,13 @@ binlog_format ROW show variables like '%auto_increment%'; Variable_name Value auto_increment_increment 2 -auto_increment_offset 1 +auto_increment_offset 2 wsrep_auto_increment_control ON SET GLOBAL wsrep_auto_increment_control='OFF'; show variables like '%auto_increment%'; Variable_name Value -auto_increment_increment 3 -auto_increment_offset 1 +auto_increment_increment 1 +auto_increment_offset 2 wsrep_auto_increment_control OFF SET GLOBAL wsrep_auto_increment_control='ON'; drop table t1; diff --git a/mysql-test/suite/galera/r/galera_can_run_toi.result b/mysql-test/suite/galera/r/galera_can_run_toi.result index 1a3a377f82ed4..69dea0c1c0931 100644 --- a/mysql-test/suite/galera/r/galera_can_run_toi.result +++ b/mysql-test/suite/galera/r/galera_can_run_toi.result @@ -9,7 +9,7 @@ SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t3 values (1); SET sql_mode=default; ALTER TABLE t3 engine=innodbCLUSTER; @@ -18,7 +18,7 @@ SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t3; SET sql_mode=''; SET SESSION default_storage_engine=MyISAM; @@ -33,5 +33,5 @@ SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `c1` varchar(10) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t3; diff --git a/mysql-test/suite/galera/r/galera_create_function.result b/mysql-test/suite/galera/r/galera_create_function.result index 85fa85d81f145..e8766eba155fa 100644 --- a/mysql-test/suite/galera/r/galera_create_function.result +++ b/mysql-test/suite/galera/r/galera_create_function.result @@ -24,7 +24,7 @@ RETURN 123; connection node_1; SHOW CREATE FUNCTION f1; Function sql_mode Create Function character_set_client collation_connection Database Collation -f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user1`@`%` FUNCTION `f1`(param INTEGER) RETURNS varchar(200) CHARSET latin1 +f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user1`@`%` FUNCTION `f1`(param INTEGER) RETURNS varchar(200) CHARSET latin1 COLLATE latin1_swedish_ci MODIFIES SQL DATA COMMENT 'f1_comment' RETURN 'abc' latin1 latin1_swedish_ci latin1_swedish_ci @@ -34,7 +34,7 @@ SELECT 1 FROM DUAL; 1 SHOW CREATE FUNCTION f1; Function sql_mode Create Function character_set_client collation_connection Database Collation -f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user1`@`%` FUNCTION `f1`(param INTEGER) RETURNS varchar(200) CHARSET latin1 +f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user1`@`%` FUNCTION `f1`(param INTEGER) RETURNS varchar(200) CHARSET latin1 COLLATE latin1_swedish_ci MODIFIES SQL DATA COMMENT 'f1_comment' RETURN 'abc' latin1 latin1_swedish_ci latin1_swedish_ci diff --git a/mysql-test/suite/galera/r/galera_create_table_like.result b/mysql-test/suite/galera/r/galera_create_table_like.result index 82543331ad519..d1633077dcba4 100644 --- a/mysql-test/suite/galera/r/galera_create_table_like.result +++ b/mysql-test/suite/galera/r/galera_create_table_like.result @@ -49,3 +49,8 @@ DROP TABLE schema2.real_table2; DROP TABLE schema2.real_table3; DROP SCHEMA schema1; DROP SCHEMA schema2; +use test; +CREATE TEMPORARY TABLE t (c INT) ENGINE=mrg_myisam UNION=(t,t2) insert_method=FIRST; +CREATE TABLE t2 LIKE t; +ERROR HY000: Table 't' is differently defined or of non-MyISAM type or doesn't exist +DROP TABLE t; diff --git a/mysql-test/suite/galera/r/galera_ctas.result b/mysql-test/suite/galera/r/galera_ctas.result index f044f807410b3..ae8b611e6117a 100644 --- a/mysql-test/suite/galera/r/galera_ctas.result +++ b/mysql-test/suite/galera/r/galera_ctas.result @@ -17,21 +17,21 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL, `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `a` int(11) DEFAULT NULL, `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2, t3,t4; SET SESSION default_storage_engine=Aria; CREATE TABLE t2 AS SELECT * FROM t1_Aria; @@ -43,21 +43,21 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL, `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `a` int(11) DEFAULT NULL, `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 DROP TABLE t2, t3,t4; SET SESSION default_storage_engine=InnoDB; CREATE TABLE t2 AS SELECT * FROM t1_Aria; @@ -69,20 +69,20 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL, `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `a` int(11) DEFAULT NULL, `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2, t3,t4; DROP TABLE t1_MyISAM, t1_Aria,t1_InnoDB; diff --git a/mysql-test/suite/galera/r/galera_ddl_fk_conflict.result b/mysql-test/suite/galera/r/galera_ddl_fk_conflict.result index 5f09345b79b08..03e84f9facde4 100644 --- a/mysql-test/suite/galera/r/galera_ddl_fk_conflict.result +++ b/mysql-test/suite/galera/r/galera_ddl_fk_conflict.result @@ -7,389 +7,6 @@ connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1; connection node_1b; SET SESSION wsrep_sync_wait=0; ###################################################################### -# Test for OPTIMIZE -###################################################################### -###################################################################### -# -# Scenario #1: DML working on FK parent table BF aborted by DDL -# over child table -# -###################################################################### -connection node_1; -SET SESSION wsrep_sync_wait=0; -CREATE TABLE p1 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); -INSERT INTO p1 VALUES (1, 'INITIAL VALUE'); -CREATE TABLE p2 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); -INSERT INTO p2 VALUES (1, 'INITIAL VALUE'); -INSERT INTO p2 VALUES (2, 'INITIAL VALUE'); -CREATE TABLE c1 (pk INTEGER PRIMARY KEY, fk INTEGER, FOREIGN KEY (fk) REFERENCES p1(pk)); -INSERT INTO c1 VALUES (1,1); -CREATE TABLE c2 (pk INTEGER PRIMARY KEY, fk1 INTEGER, fk2 INTEGER, FOREIGN KEY (fk1) REFERENCES p1(pk), FOREIGN KEY (fk2) REFERENCES p2(pk)); -INSERT INTO c2 VALUES (1,1,1), (2,1,2); -connection node_1; -SET AUTOCOMMIT=ON; -START TRANSACTION; -UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1; -connection node_2; -SET SESSION wsrep_sync_wait=0; -OPTIMIZE TABLE c1 ; -Table Op Msg_type Msg_text -test.c1 optimize note Table does not support optimize, doing recreate + analyze instead -test.c1 optimize status OK -connection node_1; -COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE'; -EXPECT_1 -1 -SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE'; -EXPECT_2 -2 -connection node_2; -SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE'; -EXPECT_1 -1 -SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE'; -EXPECT_2 -2 -###################################################################### -# -# Scenario #2: DML working on FK parent table tries to replicate, but -# fails in certification for earlier DDL on child table -# -###################################################################### -connection node_1; -BEGIN; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -connection node_2; -OPTIMIZE TABLE c1 ; -Table Op Msg_type Msg_text -test.c1 optimize note Table does not support optimize, doing recreate + analyze instead -test.c1 optimize status OK -connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -connection node_1; -UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1; -COMMIT; -connection node_1a; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -connection node_1; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -SELECT 'I deadlocked'; -I deadlocked -I deadlocked -SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE'; -EXPECT_1 -1 -SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE'; -EXPECT_2 -2 -connection node_2; -SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE'; -EXPECT_1 -1 -SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE'; -EXPECT_2 -2 -###################################################################### -# -# Scenario #3: 2 DMLs working on two FK parent tables try to replicate, -# but fails in certification for earlier DDL on child table -# which is child to both FK parents -# -###################################################################### -connection node_1; -BEGIN; -connection node_1b; -BEGIN; -connection node_1a; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -connection node_2; -OPTIMIZE TABLE c2 ; -Table Op Msg_type Msg_text -test.c2 optimize note Table does not support optimize, doing recreate + analyze instead -test.c2 optimize status OK -connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -connection node_1; -UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1; -COMMIT; -connection node_1b; -UPDATE p2 SET f2 = 'TO DEADLOCK' WHERE pk = 2; -COMMIT; -connection node_1a; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -connection node_1; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -SELECT 'I deadlocked'; -I deadlocked -I deadlocked -connection node_1b; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -SELECT 'I deadlocked'; -I deadlocked -I deadlocked -SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE'; -EXPECT_1 -1 -SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE'; -EXPECT_2 -2 -connection node_2; -SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE'; -EXPECT_1 -1 -SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE'; -EXPECT_2 -2 -DROP TABLE c1, c2; -DROP TABLE p1, p2; -###################################################################### -# Test for OPTIMIZE -###################################################################### -connection node_1; -SET SESSION wsrep_sync_wait=0; -CREATE TABLE p1 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); -INSERT INTO p1 VALUES (1, 'INITIAL VALUE'); -CREATE TABLE c1 (pk INTEGER PRIMARY KEY, fk INTEGER, FOREIGN KEY (fk) REFERENCES p1(pk)); -INSERT INTO c1 VALUES (1,1); -###################################################################### -# -# Scenario #4: DML working on FK parent table tries to replicate, but -# fails in certification for earlier DDL on child table -# and another temporary table. TMP table should be skipped -# but FK child table should be replicated with proper keys -# -###################################################################### -connection node_1; -BEGIN; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -connection node_2; -CREATE TEMPORARY TABLE tmp (i int); -OPTIMIZE TABLE c1, tmp ; -Table Op Msg_type Msg_text -test.c1 optimize note Table does not support optimize, doing recreate + analyze instead -test.c1 optimize status OK -test.tmp optimize note Table does not support optimize, doing recreate + analyze instead -test.tmp optimize status OK -DROP TABLE tmp; -connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -connection node_1; -UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1; -COMMIT; -connection node_1a; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -connection node_1; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -SELECT 'I deadlocked'; -I deadlocked -I deadlocked -SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE'; -EXPECT_1 -1 -connection node_2; -SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE'; -EXPECT_1 -1 -DROP TABLE c1; -DROP TABLE p1; -###################################################################### -# Test for REPAIR -###################################################################### -###################################################################### -# -# Scenario #1: DML working on FK parent table BF aborted by DDL -# over child table -# -###################################################################### -connection node_1; -SET SESSION wsrep_sync_wait=0; -CREATE TABLE p1 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); -INSERT INTO p1 VALUES (1, 'INITIAL VALUE'); -CREATE TABLE p2 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); -INSERT INTO p2 VALUES (1, 'INITIAL VALUE'); -INSERT INTO p2 VALUES (2, 'INITIAL VALUE'); -CREATE TABLE c1 (pk INTEGER PRIMARY KEY, fk INTEGER, FOREIGN KEY (fk) REFERENCES p1(pk)); -INSERT INTO c1 VALUES (1,1); -CREATE TABLE c2 (pk INTEGER PRIMARY KEY, fk1 INTEGER, fk2 INTEGER, FOREIGN KEY (fk1) REFERENCES p1(pk), FOREIGN KEY (fk2) REFERENCES p2(pk)); -INSERT INTO c2 VALUES (1,1,1), (2,1,2); -connection node_1; -SET AUTOCOMMIT=ON; -START TRANSACTION; -UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1; -connection node_2; -SET SESSION wsrep_sync_wait=0; -REPAIR TABLE c1 ; -Table Op Msg_type Msg_text -test.c1 repair note The storage engine for the table doesn't support repair -connection node_1; -COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE'; -EXPECT_1 -1 -SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE'; -EXPECT_2 -2 -connection node_2; -SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE'; -EXPECT_1 -1 -SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE'; -EXPECT_2 -2 -###################################################################### -# -# Scenario #2: DML working on FK parent table tries to replicate, but -# fails in certification for earlier DDL on child table -# -###################################################################### -connection node_1; -BEGIN; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -connection node_2; -REPAIR TABLE c1 ; -Table Op Msg_type Msg_text -test.c1 repair note The storage engine for the table doesn't support repair -connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -connection node_1; -UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1; -COMMIT; -connection node_1a; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -connection node_1; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -SELECT 'I deadlocked'; -I deadlocked -I deadlocked -SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE'; -EXPECT_1 -1 -SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE'; -EXPECT_2 -2 -connection node_2; -SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE'; -EXPECT_1 -1 -SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE'; -EXPECT_2 -2 -###################################################################### -# -# Scenario #3: 2 DMLs working on two FK parent tables try to replicate, -# but fails in certification for earlier DDL on child table -# which is child to both FK parents -# -###################################################################### -connection node_1; -BEGIN; -connection node_1b; -BEGIN; -connection node_1a; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -connection node_2; -REPAIR TABLE c2 ; -Table Op Msg_type Msg_text -test.c2 repair note The storage engine for the table doesn't support repair -connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -connection node_1; -UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1; -COMMIT; -connection node_1b; -UPDATE p2 SET f2 = 'TO DEADLOCK' WHERE pk = 2; -COMMIT; -connection node_1a; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -connection node_1; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -SELECT 'I deadlocked'; -I deadlocked -I deadlocked -connection node_1b; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -SELECT 'I deadlocked'; -I deadlocked -I deadlocked -SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE'; -EXPECT_1 -1 -SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE'; -EXPECT_2 -2 -connection node_2; -SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE'; -EXPECT_1 -1 -SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE'; -EXPECT_2 -2 -DROP TABLE c1, c2; -DROP TABLE p1, p2; -###################################################################### -# Test for REPAIR -###################################################################### -connection node_1; -SET SESSION wsrep_sync_wait=0; -CREATE TABLE p1 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); -INSERT INTO p1 VALUES (1, 'INITIAL VALUE'); -CREATE TABLE c1 (pk INTEGER PRIMARY KEY, fk INTEGER, FOREIGN KEY (fk) REFERENCES p1(pk)); -INSERT INTO c1 VALUES (1,1); -###################################################################### -# -# Scenario #4: DML working on FK parent table tries to replicate, but -# fails in certification for earlier DDL on child table -# and another temporary table. TMP table should be skipped -# but FK child table should be replicated with proper keys -# -###################################################################### -connection node_1; -BEGIN; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -connection node_2; -CREATE TEMPORARY TABLE tmp (i int); -REPAIR TABLE c1, tmp ; -Table Op Msg_type Msg_text -test.c1 repair note The storage engine for the table doesn't support repair -test.tmp repair note The storage engine for the table doesn't support repair -DROP TABLE tmp; -connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -connection node_1; -UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1; -COMMIT; -connection node_1a; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -connection node_1; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -SELECT 'I deadlocked'; -I deadlocked -I deadlocked -SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE'; -EXPECT_1 -1 -connection node_2; -SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE'; -EXPECT_1 -1 -DROP TABLE c1; -DROP TABLE p1; -###################################################################### # Test for ALTER ENGINE=INNODB ###################################################################### ###################################################################### diff --git a/mysql-test/suite/galera/r/galera_ddl_fk_no_conflict.result b/mysql-test/suite/galera/r/galera_ddl_fk_no_conflict.result new file mode 100644 index 0000000000000..430469221438e --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ddl_fk_no_conflict.result @@ -0,0 +1,330 @@ +connection node_2; +connection node_1; +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ); +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); +connection node_1; +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; +pk +1 +2 +3 +4 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +OPTIMIZE TABLE child;; +Table Op Msg_type Msg_text +test.child optimize note Table does not support optimize, doing recreate + analyze instead +test.child optimize status OK +connection node_1; +COMMIT; +DROP TABLE child, parent; +disconnect node_1a; +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON UPDATE CASCADE); +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); +connection node_1; +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; +pk +1 +2 +3 +4 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +OPTIMIZE TABLE child;; +Table Op Msg_type Msg_text +test.child optimize note Table does not support optimize, doing recreate + analyze instead +test.child optimize status OK +connection node_1; +COMMIT; +DROP TABLE child, parent; +disconnect node_1a; +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON DELETE CASCADE); +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); +connection node_1; +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; +pk +1 +2 +3 +4 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +OPTIMIZE TABLE child;; +Table Op Msg_type Msg_text +test.child optimize note Table does not support optimize, doing recreate + analyze instead +test.child optimize status OK +connection node_1; +COMMIT; +DROP TABLE child, parent; +disconnect node_1a; +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON UPDATE CASCADE ON DELETE CASCADE); +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); +connection node_1; +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; +pk +1 +2 +3 +4 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +OPTIMIZE TABLE child;; +Table Op Msg_type Msg_text +test.child optimize note Table does not support optimize, doing recreate + analyze instead +test.child optimize status OK +connection node_1; +COMMIT; +DROP TABLE child, parent; +disconnect node_1a; +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ); +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); +connection node_1; +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; +pk +1 +2 +3 +4 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +REPAIR TABLE child;; +Table Op Msg_type Msg_text +test.child repair note The storage engine for the table doesn't support repair +connection node_1; +COMMIT; +DROP TABLE child, parent; +disconnect node_1a; +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON UPDATE CASCADE); +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); +connection node_1; +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; +pk +1 +2 +3 +4 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +REPAIR TABLE child;; +Table Op Msg_type Msg_text +test.child repair note The storage engine for the table doesn't support repair +connection node_1; +COMMIT; +DROP TABLE child, parent; +disconnect node_1a; +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON DELETE CASCADE); +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); +connection node_1; +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; +pk +1 +2 +3 +4 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +REPAIR TABLE child;; +Table Op Msg_type Msg_text +test.child repair note The storage engine for the table doesn't support repair +connection node_1; +COMMIT; +DROP TABLE child, parent; +disconnect node_1a; +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON UPDATE CASCADE ON DELETE CASCADE); +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); +connection node_1; +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; +pk +1 +2 +3 +4 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +REPAIR TABLE child;; +Table Op Msg_type Msg_text +test.child repair note The storage engine for the table doesn't support repair +connection node_1; +COMMIT; +DROP TABLE child, parent; +disconnect node_1a; +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ); +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); +connection node_1; +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; +pk +1 +2 +3 +4 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +CHECK TABLE child;; +Table Op Msg_type Msg_text +test.child check status OK +connection node_1; +COMMIT; +DROP TABLE child, parent; +disconnect node_1a; +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON UPDATE CASCADE); +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); +connection node_1; +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; +pk +1 +2 +3 +4 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +CHECK TABLE child;; +Table Op Msg_type Msg_text +test.child check status OK +connection node_1; +COMMIT; +DROP TABLE child, parent; +disconnect node_1a; +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON DELETE CASCADE); +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); +connection node_1; +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; +pk +1 +2 +3 +4 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +CHECK TABLE child;; +Table Op Msg_type Msg_text +test.child check status OK +connection node_1; +COMMIT; +DROP TABLE child, parent; +disconnect node_1a; +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON UPDATE CASCADE ON DELETE CASCADE); +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); +connection node_1; +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; +pk +1 +2 +3 +4 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +CHECK TABLE child;; +Table Op Msg_type Msg_text +test.child check status OK +connection node_1; +COMMIT; +DROP TABLE child, parent; +disconnect node_1a; +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ); +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); +connection node_1; +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; +pk +1 +2 +3 +4 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +ANALYZE TABLE child;; +Table Op Msg_type Msg_text +test.child analyze status Engine-independent statistics collected +test.child analyze status OK +connection node_1; +COMMIT; +DROP TABLE child, parent; +disconnect node_1a; +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON UPDATE CASCADE); +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); +connection node_1; +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; +pk +1 +2 +3 +4 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +ANALYZE TABLE child;; +Table Op Msg_type Msg_text +test.child analyze status Engine-independent statistics collected +test.child analyze status OK +connection node_1; +COMMIT; +DROP TABLE child, parent; +disconnect node_1a; +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON DELETE CASCADE); +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); +connection node_1; +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; +pk +1 +2 +3 +4 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +ANALYZE TABLE child;; +Table Op Msg_type Msg_text +test.child analyze status Engine-independent statistics collected +test.child analyze status OK +connection node_1; +COMMIT; +DROP TABLE child, parent; +disconnect node_1a; +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON UPDATE CASCADE ON DELETE CASCADE); +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); +connection node_1; +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; +pk +1 +2 +3 +4 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +ANALYZE TABLE child;; +Table Op Msg_type Msg_text +test.child analyze status Engine-independent statistics collected +test.child analyze status OK +connection node_1; +COMMIT; +DROP TABLE child, parent; +disconnect node_1a; diff --git a/mysql-test/suite/galera/r/galera_ddl_multiline.result b/mysql-test/suite/galera/r/galera_ddl_multiline.result index 9e70731a62b48..9a5ccabd00ec9 100644 --- a/mysql-test/suite/galera/r/galera_ddl_multiline.result +++ b/mysql-test/suite/galera/r/galera_ddl_multiline.result @@ -7,46 +7,46 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_2; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_1; CREATE TABLE t3 (f1 INTEGER) ENGINE=InnoDB; CREATE TABLE t4 (f1 INTEGER) ENGINE=InnoDB;; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_2; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_1; INSERT INTO t1 VALUES (1); CREATE TABLE t5 (f1 INTEGER) ENGINE=InnoDB; @@ -57,7 +57,7 @@ SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_2; SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 @@ -66,7 +66,7 @@ SHOW CREATE TABLE t5; Table Create Table t5 CREATE TABLE `t5` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_1; CREATE TABLE t6 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t2 VALUES (1);; SELECT COUNT(*) = 1 FROM t2; @@ -76,7 +76,7 @@ SHOW CREATE TABLE t6; Table Create Table t6 CREATE TABLE `t6` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_2; SELECT COUNT(*) = 1 FROM t2; COUNT(*) = 1 @@ -85,7 +85,7 @@ SHOW CREATE TABLE t6; Table Create Table t6 CREATE TABLE `t6` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci include/diff_servers.inc [servers=1 2] connection node_1; DROP TABLE t1, t2, t3, t4, t5, t6; diff --git a/mysql-test/suite/galera/r/galera_drop_database.result b/mysql-test/suite/galera/r/galera_drop_database.result index 6ab4b3d0c7be9..03b55136c6f47 100644 --- a/mysql-test/suite/galera/r/galera_drop_database.result +++ b/mysql-test/suite/galera/r/galera_drop_database.result @@ -48,3 +48,6 @@ SHOW TABLES; Tables_in_fts DROP DATABASE fts; connection node_2; +call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:"); +Warnings: +Note 1049 Unknown database 'fts' diff --git a/mysql-test/suite/galera/r/galera_events2.result b/mysql-test/suite/galera/r/galera_events2.result index cd44579af90c4..26d3a74a7f306 100644 --- a/mysql-test/suite/galera/r/galera_events2.result +++ b/mysql-test/suite/galera/r/galera_events2.result @@ -111,6 +111,7 @@ f1 f2 SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT def test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND SLAVESIDE_DISABLED NOT PRESERVE +call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*"); connection node_1; SELECT * FROM t1; f1 f2 diff --git a/mysql-test/suite/galera/r/galera_gcache_recover.result b/mysql-test/suite/galera/r/galera_gcache_recover.result index 819c595ece30c..72088a5447b1d 100644 --- a/mysql-test/suite/galera/r/galera_gcache_recover.result +++ b/mysql-test/suite/galera/r/galera_gcache_recover.result @@ -20,8 +20,6 @@ connection node_1; include/diff_servers.inc [servers=1 2] connection node_1; CALL mtr.add_suppression("Skipped GCache ring buffer recovery"); -include/assert_grep.inc [async IST sender starting to serve] connection node_2; CALL mtr.add_suppression("Skipped GCache ring buffer recovery"); -include/assert_grep.inc [Recovering GCache ring buffer: found gapless sequence] DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result b/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result index faa85126f039b..5caf22b39ca41 100644 --- a/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result +++ b/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result @@ -94,6 +94,7 @@ CALL insert_1m ();; connection node_1_insert_10m; CALL insert_10m ();; connection node_2; +call mtr.add_suppression("Error in Log_event::read_log_event():.*"); SET SESSION wsrep_sync_wait = 0; Killing server ... connection node_1; @@ -130,9 +131,9 @@ DROP PROCEDURE update_simple; DROP PROCEDURE insert_1k; DROP PROCEDURE insert_1m; connection node_1; +call mtr.add_suppression("Error in Log_event::read_log_event():.*"); CALL mtr.add_suppression("conflict state 7 after post commit"); CALL mtr.add_suppression("Skipped GCache ring buffer recovery"); -include/assert_grep.inc [async IST sender starting to serve] connection node_2; +call mtr.add_suppression("Error in Log_event::read_log_event():.*"); CALL mtr.add_suppression("Skipped GCache ring buffer recovery"); -include/assert_grep.inc [Recovering GCache ring buffer: found gapless sequence] diff --git a/mysql-test/suite/galera/r/galera_gra_log.result b/mysql-test/suite/galera/r/galera_gra_log.result index a6c6b1afa0a93..8c0286a4ef1a9 100644 --- a/mysql-test/suite/galera/r/galera_gra_log.result +++ b/mysql-test/suite/galera/r/galera_gra_log.result @@ -18,11 +18,11 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=/*!*/; SET @@session.pseudo_thread_id=/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (f1 INTEGER) diff --git a/mysql-test/suite/galera/r/galera_gtid_server_id.result b/mysql-test/suite/galera/r/galera_gtid_server_id.result new file mode 100644 index 0000000000000..8765fcc163672 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_gtid_server_id.result @@ -0,0 +1,83 @@ +connection node_2; +connection node_1; +connection node_1; +select @@gtid_domain_id, @@server_id, @@wsrep_gtid_domain_id,@@wsrep_gtid_mode; +@@gtid_domain_id @@server_id @@wsrep_gtid_domain_id @@wsrep_gtid_mode +0 11 1 1 +connection node_2; +call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); +select @@gtid_domain_id, @@server_id, @@wsrep_gtid_domain_id,@@wsrep_gtid_mode; +@@gtid_domain_id @@server_id @@wsrep_gtid_domain_id @@wsrep_gtid_mode +0 12 1 1 +connection node_1; +CREATE TABLE t1(id int not null primary key) engine=innodb; +INSERT INTO t1 values (1); +show global variables like '%gtid%'; +Variable_name Value +gtid_binlog_pos 1-11-2 +gtid_binlog_state 1-11-2 +gtid_cleanup_batch_size 64 +gtid_current_pos 1-11-2 +gtid_domain_id 0 +gtid_ignore_duplicates OFF +gtid_pos_auto_engines +gtid_slave_pos +gtid_strict_mode OFF +wsrep_gtid_domain_id 1 +wsrep_gtid_mode ON +connection node_2; +SET SESSION wsrep_sync_wait=15; +show global variables like '%gtid%'; +Variable_name Value +gtid_binlog_pos 0-12-1,1-11-2 +gtid_binlog_state 0-12-1,1-11-2 +gtid_cleanup_batch_size 64 +gtid_current_pos 0-12-1 +gtid_domain_id 0 +gtid_ignore_duplicates OFF +gtid_pos_auto_engines +gtid_slave_pos +gtid_strict_mode OFF +wsrep_gtid_domain_id 1 +wsrep_gtid_mode ON +SET GLOBAL server_id=200; +ERROR 42000: Variable 'server_id' can't be set to the value of '200' +SHOW WARNINGS; +Level Code Message +Warning 1231 Can't change server_id because wsrep and wsrep_gtid_mode is set. You can set server_id only with wsrep_new_cluster. +Error 1231 Variable 'server_id' can't be set to the value of '200' +SET SESSION server_id=200; +ERROR 42000: Variable 'server_id' can't be set to the value of '200' +SHOW WARNINGS; +Level Code Message +Warning 1231 Can't change server_id because wsrep and wsrep_gtid_mode is set. You can set server_id only with wsrep_new_cluster. +Error 1231 Variable 'server_id' can't be set to the value of '200' +INSERT INTO t1 values(2); +show global variables like '%gtid%'; +Variable_name Value +gtid_binlog_pos 0-12-1,1-11-3 +gtid_binlog_state 0-12-1,1-11-3 +gtid_cleanup_batch_size 64 +gtid_current_pos 0-12-1 +gtid_domain_id 0 +gtid_ignore_duplicates OFF +gtid_pos_auto_engines +gtid_slave_pos +gtid_strict_mode OFF +wsrep_gtid_domain_id 1 +wsrep_gtid_mode ON +connection node_1; +show global variables like '%gtid%'; +Variable_name Value +gtid_binlog_pos 1-11-3 +gtid_binlog_state 1-11-3 +gtid_cleanup_batch_size 64 +gtid_current_pos 1-11-3 +gtid_domain_id 0 +gtid_ignore_duplicates OFF +gtid_pos_auto_engines +gtid_slave_pos +gtid_strict_mode OFF +wsrep_gtid_domain_id 1 +wsrep_gtid_mode ON +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_gtid_slave.result b/mysql-test/suite/galera/r/galera_gtid_slave.result index 1ff062064e7cb..d460d16981100 100644 --- a/mysql-test/suite/galera/r/galera_gtid_slave.result +++ b/mysql-test/suite/galera/r/galera_gtid_slave.result @@ -41,3 +41,5 @@ reset master; SET GLOBAL wsrep_on=ON; connection node_3; reset master; +connection node_2; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); diff --git a/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result b/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result index 992f6c3455b35..f41e3abc49785 100644 --- a/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result +++ b/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result @@ -166,3 +166,5 @@ set global wsrep_on=ON; #Connection 3 connection node_3; reset master; +connection node_2; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); diff --git a/mysql-test/suite/galera/r/galera_gtid_trx_conflict.result b/mysql-test/suite/galera/r/galera_gtid_trx_conflict.result index dcabff408417f..602816f18a9b3 100644 --- a/mysql-test/suite/galera/r/galera_gtid_trx_conflict.result +++ b/mysql-test/suite/galera/r/galera_gtid_trx_conflict.result @@ -42,3 +42,4 @@ SELECT @@gtid_binlog_state; @@gtid_binlog_state 1-1-101 DROP TABLE t1; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); diff --git a/mysql-test/suite/galera/r/galera_insert_bulk.result b/mysql-test/suite/galera/r/galera_insert_bulk.result new file mode 100644 index 0000000000000..f4d4adf64e18f --- /dev/null +++ b/mysql-test/suite/galera/r/galera_insert_bulk.result @@ -0,0 +1,30 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET foreign_key_checks = 0; +SET unique_checks = 0; +START TRANSACTION; +connection node_2; +SET foreign_key_checks = 1; +SET unique_checks = 1; +INSERT INTO t1 VALUES (1001); +connection node_1; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +START TRANSACTION; +connection node_2; +SET foreign_key_checks = 1; +SET unique_checks = 1; +START TRANSACTION; +INSERT INTO t1 VALUES (1001); +connection node_1; +COMMIT; +2 +connection node_2; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff new file mode 100644 index 0000000000000..96e5def88ff70 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff @@ -0,0 +1,190 @@ +--- r/galera_ist_MDEV-28423.result ++++ r/galera_ist_MDEV-28423.reject +@@ -517,3 +517,187 @@ + 1 + DROP TABLE t1; + COMMIT; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++connection node_1; ++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1,'node1_committed_before'); ++INSERT INTO t1 VALUES (2,'node1_committed_before'); ++INSERT INTO t1 VALUES (3,'node1_committed_before'); ++INSERT INTO t1 VALUES (4,'node1_committed_before'); ++INSERT INTO t1 VALUES (5,'node1_committed_before'); ++connection node_2; ++START TRANSACTION; ++INSERT INTO t1 VALUES (6,'node2_committed_before'); ++INSERT INTO t1 VALUES (7,'node2_committed_before'); ++INSERT INTO t1 VALUES (8,'node2_committed_before'); ++INSERT INTO t1 VALUES (9,'node2_committed_before'); ++INSERT INTO t1 VALUES (10,'node2_committed_before'); ++COMMIT; ++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ++connection node_1; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++connection node_2; ++SET wsrep_sync_wait = 0; ++Killing server ... ++connection node_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after'); ++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after'); ++connection node_2; ++Performing --wsrep-recover ... ++connection node_2; ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after'); ++COMMIT; ++connection node_1; ++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after'); ++COMMIT; ++connection node_1a_galera_st_kill_slave_ddl; ++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after'); ++ROLLBACK; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++connection node_1; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result b/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result new file mode 100644 index 0000000000000..5a71b490a80f7 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result @@ -0,0 +1,519 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +Performing State Transfer on a server that has been temporarily disconnected +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Unloading wsrep provider ... +SET GLOBAL wsrep_cluster_address = ''; +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Loading wsrep provider ... +disconnect node_2; +connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_disconnect_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that has been shut down cleanly and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_shutdown_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that has been killed and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Killing server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +Starting server ... +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff new file mode 100644 index 0000000000000..9e6530aa9f76a --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff @@ -0,0 +1,190 @@ +--- r/galera_ist_MDEV-28583.result ++++ r/galera_ist_MDEV-28583.reject +@@ -517,3 +517,187 @@ + 1 + DROP TABLE t1; + COMMIT; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++connection node_1; ++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1,'node1_committed_before'); ++INSERT INTO t1 VALUES (2,'node1_committed_before'); ++INSERT INTO t1 VALUES (3,'node1_committed_before'); ++INSERT INTO t1 VALUES (4,'node1_committed_before'); ++INSERT INTO t1 VALUES (5,'node1_committed_before'); ++connection node_2; ++START TRANSACTION; ++INSERT INTO t1 VALUES (6,'node2_committed_before'); ++INSERT INTO t1 VALUES (7,'node2_committed_before'); ++INSERT INTO t1 VALUES (8,'node2_committed_before'); ++INSERT INTO t1 VALUES (9,'node2_committed_before'); ++INSERT INTO t1 VALUES (10,'node2_committed_before'); ++COMMIT; ++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ++connection node_1; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++connection node_2; ++SET wsrep_sync_wait = 0; ++Killing server ... ++connection node_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after'); ++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after'); ++connection node_2; ++Performing --wsrep-recover ... ++connection node_2; ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after'); ++COMMIT; ++connection node_1; ++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after'); ++COMMIT; ++connection node_1a_galera_st_kill_slave_ddl; ++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after'); ++ROLLBACK; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++connection node_1; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result b/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result new file mode 100644 index 0000000000000..5a71b490a80f7 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result @@ -0,0 +1,519 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +Performing State Transfer on a server that has been temporarily disconnected +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Unloading wsrep provider ... +SET GLOBAL wsrep_cluster_address = ''; +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Loading wsrep provider ... +disconnect node_2; +connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_disconnect_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that has been shut down cleanly and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_shutdown_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that has been killed and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Killing server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +Starting server ... +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; diff --git a/mysql-test/suite/galera/r/galera_ist_progress.result b/mysql-test/suite/galera/r/galera_ist_progress.result index 9233d95b970d6..16772271b72b7 100644 --- a/mysql-test/suite/galera/r/galera_ist_progress.result +++ b/mysql-test/suite/galera/r/galera_ist_progress.result @@ -7,7 +7,7 @@ connection node_2; SET SESSION wsrep_on = OFF; SET SESSION wsrep_on = ON; connection node_1; -CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (3); @@ -23,8 +23,7 @@ SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0'; connection node_1; connection node_2; connection node_1; -include/assert_grep.inc [Receiving IST: 13 writesets, seqnos 3-15] -include/assert_grep.inc [Receiving IST\.\.\. 0\.0% \( 0/13 events\) complete] -include/assert_grep.inc [Receiving IST\.\.\.100\.0% \(13/13 events\) complete] +"Trying to find IST progress reporting" +found connection node_1; DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_ist_restart_joiner.result b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result index 7cb6d90840e96..2f78c4757627d 100644 --- a/mysql-test/suite/galera/r/galera_ist_restart_joiner.result +++ b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result @@ -18,6 +18,7 @@ SET SESSION wsrep_on=ON; connection node_1; UPDATE t1 SET f2 = 'd' WHERE f1 > 3; connection node_2; +Killing server ... connection node_1; UPDATE t1 SET f2 = 'e' WHERE f1 > 4; connection node_2; diff --git a/mysql-test/suite/galera/r/galera_kill_applier.result b/mysql-test/suite/galera/r/galera_kill_applier.result index 78a91d2638f56..a47f486b5fb62 100644 --- a/mysql-test/suite/galera/r/galera_kill_applier.result +++ b/mysql-test/suite/galera/r/galera_kill_applier.result @@ -5,9 +5,13 @@ SELECT @@wsrep_slave_threads; @@wsrep_slave_threads 1 SET GLOBAL wsrep_slave_threads=2; +KILL ID; Got one of the listed errors +KILL QUERY ID; Got one of the listed errors +KILL ID; Got one of the listed errors +KILL QUERY ID; Got one of the listed errors SET GLOBAL wsrep_slave_threads=DEFAULT; connection node_1; diff --git a/mysql-test/suite/galera/r/galera_kill_largechanges.result b/mysql-test/suite/galera/r/galera_kill_largechanges.result deleted file mode 100644 index 99a8005e03e03..0000000000000 --- a/mysql-test/suite/galera/r/galera_kill_largechanges.result +++ /dev/null @@ -1,24 +0,0 @@ -connection node_2; -connection node_1; -connection node_1; -connection node_2; -connection node_1; -SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; -CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; -INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10),(11); -CREATE TABLE t1 (f1 VARCHAR(128)) ENGINE=InnoDB; -connection node_2; -Killing server ... -connection node_1; -INSERT INTO t1 SELECT REPEAT('a', 128) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6; -connection node_2; -connection node_2a; -SELECT COUNT(*) FROM t1; -COUNT(*) -1771561 -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; -VARIABLE_VALUE -2 -connection node_1; -DROP TABLE t1; -DROP TABLE ten; diff --git a/mysql-test/suite/galera/r/galera_last_committed_id.result b/mysql-test/suite/galera/r/galera_last_committed_id.result index eadf49d7ce093..1a1339ede32b9 100644 --- a/mysql-test/suite/galera/r/galera_last_committed_id.result +++ b/mysql-test/suite/galera/r/galera_last_committed_id.result @@ -33,3 +33,5 @@ wsrep_last_written_id_advanced 1 SET AUTOCOMMIT=ON; DROP TABLE t1; +connection node_2; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); diff --git a/mysql-test/suite/galera/r/galera_locks_funcs.result b/mysql-test/suite/galera/r/galera_locks_funcs.result new file mode 100644 index 0000000000000..25d3bbe28f55a --- /dev/null +++ b/mysql-test/suite/galera/r/galera_locks_funcs.result @@ -0,0 +1,24 @@ +connection node_2; +connection node_1; +CREATE TABLE t (c DOUBLE,c2 INT,PRIMARY KEY(c)) ENGINE=InnoDB; +INSERT INTO t values (1,1); +SELECT GET_LOCK('a',1); +ERROR 42000: This version of MariaDB doesn't yet support 'GET_LOCK in cluster (WSREP_ON=ON)' +SHOW WARNINGS; +Level Code Message +Error 1235 This version of MariaDB doesn't yet support 'GET_LOCK in cluster (WSREP_ON=ON)' +SELECT * FROM t; +c c2 +1 1 +SELECT RELEASE_LOCK('a'); +ERROR 42000: This version of MariaDB doesn't yet support 'RELEASE_LOCK in cluster (WSREP_ON=ON)' +SHOW WARNINGS; +Level Code Message +Error 1235 This version of MariaDB doesn't yet support 'RELEASE_LOCK in cluster (WSREP_ON=ON)' +SELECT RELEASE_ALL_LOCKS(); +ERROR 42000: This version of MariaDB doesn't yet support 'RELEASE_ALL_LOCKS in cluster (WSREP_ON=ON)' +SHOW WARNINGS; +Level Code Message +Error 1235 This version of MariaDB doesn't yet support 'RELEASE_ALL_LOCKS in cluster (WSREP_ON=ON)' +COMMIT; +DROP TABLE t; diff --git a/mysql-test/suite/galera/r/galera_log_bin.result b/mysql-test/suite/galera/r/galera_log_bin.result index 160575df412c6..df7ace9d95a68 100644 --- a/mysql-test/suite/galera/r/galera_log_bin.result +++ b/mysql-test/suite/galera/r/galera_log_bin.result @@ -78,3 +78,4 @@ DROP TABLE t2; connection node_1; SET GLOBAL wsrep_on=OFF; RESET MASTER; +SET GLOBAL wsrep_on=ON; diff --git a/mysql-test/suite/galera/r/galera_log_bin_ext.result b/mysql-test/suite/galera/r/galera_log_bin_ext.result index 58e13fb71a089..b110cb4dba3c7 100644 --- a/mysql-test/suite/galera/r/galera_log_bin_ext.result +++ b/mysql-test/suite/galera/r/galera_log_bin_ext.result @@ -1,6 +1,8 @@ connection node_2; connection node_1; connection node_1; +connection node_2; +connection node_1; set global wsrep_on=OFF; reset master; set global wsrep_on=ON; @@ -46,35 +48,22 @@ hostname1-bin.000001 # Xid # # COMMIT /* XID */ hostname1-bin.000001 # Gtid # # GTID #-#-# hostname1-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER connection node_2; +Shutting down server ... +connection node_1; +Cleaning var directory ... +connection node_2; +Starting server ... +connection node_2; SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; COUNT(*) = 2 1 include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -hostname1-bin.000001 # Gtid # # GTID #-#-# -hostname1-bin.000001 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB -hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-# -hostname1-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1) -hostname1-bin.000001 # Table_map # # table_id: # (test.t1) -hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F -hostname1-bin.000001 # Xid # # COMMIT /* XID */ -hostname1-bin.000001 # Gtid # # GTID #-#-# -hostname1-bin.000001 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB -hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-# -hostname1-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1) -hostname1-bin.000001 # Table_map # # table_id: # (test.t2) -hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F -hostname1-bin.000001 # Xid # # COMMIT /* XID */ -hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-# -hostname1-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1) -hostname1-bin.000001 # Table_map # # table_id: # (test.t2) -hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F -hostname1-bin.000001 # Xid # # COMMIT /* XID */ -hostname1-bin.000001 # Gtid # # GTID #-#-# -hostname1-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER +hostname1-bin.000002 # Binlog_checkpoint # # hostname1-bin.000002 DROP TABLE t1; DROP TABLE t2; #cleanup connection node_1; SET GLOBAL wsrep_on=OFF; RESET MASTER; +SET GLOBAL wsrep_on=ON; diff --git a/mysql-test/suite/galera/r/galera_log_bin_ext_mariabackup.result b/mysql-test/suite/galera/r/galera_log_bin_ext_mariabackup.result new file mode 100644 index 0000000000000..b110cb4dba3c7 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_log_bin_ext_mariabackup.result @@ -0,0 +1,69 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_1; +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +connection node_2; +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 (id INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1); +INSERT INTO t2 VALUES (1); +connection node_2; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 2 FROM t2; +COUNT(*) = 2 +1 +connection node_1; +ALTER TABLE t1 ADD COLUMN f2 INTEGER; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +hostname1-bin.000001 # Gtid # # GTID #-#-# +hostname1-bin.000001 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB +hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-# +hostname1-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1) +hostname1-bin.000001 # Table_map # # table_id: # (test.t1) +hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +hostname1-bin.000001 # Xid # # COMMIT /* XID */ +hostname1-bin.000001 # Gtid # # GTID #-#-# +hostname1-bin.000001 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB +hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-# +hostname1-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1) +hostname1-bin.000001 # Table_map # # table_id: # (test.t2) +hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +hostname1-bin.000001 # Xid # # COMMIT /* XID */ +hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-# +hostname1-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1) +hostname1-bin.000001 # Table_map # # table_id: # (test.t2) +hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +hostname1-bin.000001 # Xid # # COMMIT /* XID */ +hostname1-bin.000001 # Gtid # # GTID #-#-# +hostname1-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER +connection node_2; +Shutting down server ... +connection node_1; +Cleaning var directory ... +connection node_2; +Starting server ... +connection node_2; +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; +COUNT(*) = 2 +1 +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +hostname1-bin.000002 # Binlog_checkpoint # # hostname1-bin.000002 +DROP TABLE t1; +DROP TABLE t2; +#cleanup +connection node_1; +SET GLOBAL wsrep_on=OFF; +RESET MASTER; +SET GLOBAL wsrep_on=ON; diff --git a/mysql-test/suite/galera/r/galera_log_bin_opt.result b/mysql-test/suite/galera/r/galera_log_bin_opt.result index 160575df412c6..df7ace9d95a68 100644 --- a/mysql-test/suite/galera/r/galera_log_bin_opt.result +++ b/mysql-test/suite/galera/r/galera_log_bin_opt.result @@ -78,3 +78,4 @@ DROP TABLE t2; connection node_1; SET GLOBAL wsrep_on=OFF; RESET MASTER; +SET GLOBAL wsrep_on=ON; diff --git a/mysql-test/suite/galera/r/galera_many_rows.result b/mysql-test/suite/galera/r/galera_many_rows.result index 566bc59f8ab16..b34c2484aeae7 100644 --- a/mysql-test/suite/galera/r/galera_many_rows.result +++ b/mysql-test/suite/galera/r/galera_many_rows.result @@ -5,32 +5,32 @@ connection node_2; connection node_1; SET SESSION innodb_lock_wait_timeout=600; SET SESSION lock_wait_timeout=600; -CREATE TABLE ten (f1 INTEGER) engine=InnoDB; +CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) engine=InnoDB; INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; -INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; +INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; connection node_2; SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = 15; SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT1H'; SELECT COUNT(*) FROM t1; COUNT(*) -100000 -INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; +10000 +INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; connection node_1; SELECT COUNT(*) FROM t1; COUNT(*) -200000 +20000 UPDATE t1 SET f2 = 1; connection node_2; SELECT COUNT(*) FROM t1 WHERE f2 = 1; COUNT(*) -200000 +20000 connection node_1; START TRANSACTION; SELECT COUNT(*) FROM t1; COUNT(*) -200000 +20000 UPDATE t1 SET f2 = 3; connection node_2; START TRANSACTION; diff --git a/mysql-test/suite/galera/r/galera_many_tables_nopk.result b/mysql-test/suite/galera/r/galera_many_tables_nopk.result index 2a226defcc77a..d341a1816e5d8 100644 --- a/mysql-test/suite/galera/r/galera_many_tables_nopk.result +++ b/mysql-test/suite/galera/r/galera_many_tables_nopk.result @@ -6,8 +6,8 @@ START TRANSACTION; COMMIT; connection node_2; CREATE TABLE sum_table (f1 INTEGER); -SELECT SUM(f1) = 900 FROM sum_table; -SUM(f1) = 900 +SELECT SUM(f1) = 100 FROM sum_table; +SUM(f1) = 100 1 connection node_1; SET AUTOCOMMIT=OFF; @@ -15,7 +15,7 @@ START TRANSACTION; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -UPDATE t900 SET f1 = 3; +UPDATE t100 SET f1 = 3; connection node_1; COMMIT; connection node_2; diff --git a/mysql-test/suite/galera/r/galera_myisam_transactions.result b/mysql-test/suite/galera/r/galera_myisam_transactions.result index 091c5ffb6f665..6afcda47a2369 100644 --- a/mysql-test/suite/galera/r/galera_myisam_transactions.result +++ b/mysql-test/suite/galera/r/galera_myisam_transactions.result @@ -37,3 +37,14 @@ SELECT COUNT(*) = 0 FROM t2; COUNT(*) = 0 1 DROP TABLE t1, t2, t3; +SET SESSION lock_wait_timeout=2; +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; +CREATE TEMPORARY TABLE t1 (i INT, PRIMARY KEY pk (i)) ENGINE=MyISAM; +Warnings: +Warning 1280 Name 'pk' ignored for PRIMARY key. +PREPARE stmt FROM "INSERT INTO t1 (id) SELECT * FROM (SELECT 4 AS i) AS y"; +INSERT INTO t1 VALUES(4); +DEALLOCATE PREPARE stmt; +COMMIT; +DROP TABLE t1; +SET GLOBAL wsrep_mode = DEFAULT; diff --git a/mysql-test/suite/galera/r/galera_query_cache_invalidate.result b/mysql-test/suite/galera/r/galera_query_cache_invalidate.result new file mode 100644 index 0000000000000..98438b3b52782 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_query_cache_invalidate.result @@ -0,0 +1,119 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; +connection node_2; +call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); +connection node_4; +call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); +connection node_3; +CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos;; +START SLAVE; +include/wait_for_slave_to_start.inc +connection node_1; +CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb; +SET AUTOCOMMIT=1; +INSERT INTO t1 VALUES (4000000, 'foobar'); +SELECT COUNT(*) FROM t1; +COUNT(*) +50001 +connection node_3; +connection node_1; +# node_1 +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +connection node_2; +# node_2 +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +connection node_3; +# node_3 +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +connection node_4; +# node_4 +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +connection node_1; +# node_1 insert new +INSERT INTO t1 values (5000000, 'foobar'); +connection node_3; +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +connection node_2; +# node_2 +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +connection node_3; +# node_3 +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +connection node_4; +# node_4 +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +connection node_2; +# node_3 different query same table +SELECT id, msg FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +connection node_4; +# node_6 different query same table +SELECT id, msg FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +connection node_1; +drop table t1; +connection node_3; +connection node_3; +STOP SLAVE; +RESET SLAVE ALL; +connection node_1; +SET SESSION WSREP_ON=OFF; +RESET MASTER; +SET SESSION WSREP_ON=ON; +disconnect node_2; +disconnect node_1; +# End of test diff --git a/mysql-test/suite/galera/r/galera_read_only.result b/mysql-test/suite/galera/r/galera_read_only.result index fe8b45fa596ee..e7e18ca814594 100644 --- a/mysql-test/suite/galera/r/galera_read_only.result +++ b/mysql-test/suite/galera/r/galera_read_only.result @@ -17,10 +17,18 @@ connect foo_node_2,127.0.0.1,foo,,test,$port_2,; connection foo_node_2; INSERT INTO t1 VALUES (2); ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement +CREATE TEMPORARY TABLE t2(id int not null primary key) engine=innodb; +INSERT INTO t2 values (1); +DROP TABLE t2; connection node_2; -SELECT COUNT(*) = 1 FROM t1; -COUNT(*) = 1 +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 1 +connection node_2; +SET GLOBAL read_only=TRUE; +CREATE TEMPORARY TABLE t2(id int not null primary key) engine=innodb; +INSERT INTO t2 values (1); +DROP TABLE t2; SET GLOBAL read_only=FALSE; DROP TABLE t1; DROP USER foo@localhost; diff --git a/mysql-test/suite/galera/r/galera_repair_view.result b/mysql-test/suite/galera/r/galera_repair_view.result new file mode 100644 index 0000000000000..8dfe8c8db5250 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_repair_view.result @@ -0,0 +1,17 @@ +connection node_2; +connection node_1; +CREATE TABLE t1(a int not null primary key) engine=innodb; +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +CREATE VIEW v1 AS SELECT a FROM t1; +REPAIR VIEW v1; +Table Op Msg_type Msg_text +test.v1 repair status OK +DROP VIEW v1; +DROP TABLE t1; +CREATE VIEW v1 AS SELECT table_name FROM information_schema.tables; +REPAIR VIEW v1; +Table Op Msg_type Msg_text +test.v1 repair status OK +DROP VIEW v1; diff --git a/mysql-test/suite/galera/r/galera_repl_max_ws_size.result b/mysql-test/suite/galera/r/galera_repl_max_ws_size.result index 0528df7b9f6a4..343381b99ea75 100644 --- a/mysql-test/suite/galera/r/galera_repl_max_ws_size.result +++ b/mysql-test/suite/galera/r/galera_repl_max_ws_size.result @@ -4,7 +4,7 @@ connection node_1; CREATE TABLE t1 (f1 VARCHAR(512)) ENGINE=InnoDB; SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512'; INSERT INTO t1 VALUES (REPEAT('a', 512)); -ERROR HY000: Got error 5 "Input/output error" during COMMIT +ERROR HY000: Maximum writeset size exceeded SELECT COUNT(*) = 0 FROM t1; COUNT(*) = 0 1 diff --git a/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result b/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result index 6e672c2d44419..b1ee6f5955fc9 100644 --- a/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result +++ b/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result @@ -41,6 +41,7 @@ f1 f2 connection node_2; Starting server ... Starting server ... +call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:"); SELECT * FROM t1; f1 f2 1 a diff --git a/mysql-test/suite/galera/r/galera_roles.result b/mysql-test/suite/galera/r/galera_roles.result index 35487185db2d4..19bc9be62b068 100644 --- a/mysql-test/suite/galera/r/galera_roles.result +++ b/mysql-test/suite/galera/r/galera_roles.result @@ -33,7 +33,7 @@ GRANT USAGE ON *.* TO `foo`@`localhost` FLUSH TABLES; ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation SELECT * FROM mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` SHOW TABLES FROM test1; ERROR 42000: Access denied for user 'foo'@'localhost' to database 'test1' SET ROLE role1; @@ -51,7 +51,7 @@ a b 1 2 3 4 SELECT * FROM test1.t2; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `test1`.`t2` SELECT a FROM test1.t2; a 5 @@ -69,7 +69,7 @@ GRANT USAGE ON *.* TO `foo`@`localhost` FLUSH TABLES; ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation SELECT * FROM mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` SHOW TABLES FROM test1; ERROR 42000: Access denied for user 'foo'@'localhost' to database 'test1' SET ROLE role1; @@ -87,7 +87,7 @@ a b 1 2 3 4 SELECT * FROM test1.t2; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `test1`.`t2` SELECT a FROM test1.t2; a 5 @@ -124,11 +124,11 @@ DROP ROLE role1; connection foo_node_1; FLUSH TABLES; SELECT * FROM mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` SELECT * FROM test1.t1; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `test1`.`t1` SELECT a FROM test1.t2; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `test1`.`t2` SHOW GRANTS; Grants for foo@localhost GRANT USAGE ON *.* TO `foo`@`localhost` @@ -146,11 +146,11 @@ role1 connection foo_node_2; FLUSH TABLES; SELECT * FROM mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` SELECT * FROM test1.t1; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `test1`.`t1` SELECT a FROM test1.t2; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `test1`.`t2` SHOW GRANTS; Grants for foo@localhost GRANT USAGE ON *.* TO `foo`@`localhost` diff --git a/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result b/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result index 310611a0e49fa..54af2e68aa1f7 100644 --- a/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result +++ b/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result @@ -17,7 +17,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL, `f2` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW VARIABLES LIKE 'wsrep_desync'; Variable_name Value wsrep_desync OFF @@ -44,7 +44,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL, `f2` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET wsrep_OSU_method=TOI; DROP TABLE t1; SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/suite/galera/r/galera_savepoint_replay.result b/mysql-test/suite/galera/r/galera_savepoint_replay.result new file mode 100644 index 0000000000000..afea5f82e3ce5 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_savepoint_replay.result @@ -0,0 +1,53 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'a'); +connection node_1; +SET AUTOCOMMIT=ON; +START TRANSACTION; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE; +f1 f2 +2 a +SAVEPOINT my_sp; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET SESSION wsrep_sync_wait=0; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +connection node_2; +UPDATE t1 SET f2 = 'c' WHERE f1 = 2; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync'; +connection node_1; +COMMIT; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync'; +connection node_1; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; +COUNT(*) = 1 +1 +wsrep_local_replays +1 +connection node_2; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; +COUNT(*) = 1 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_schema.result b/mysql-test/suite/galera/r/galera_schema.result index 24a4099c94dd4..a43a5d9f02204 100644 --- a/mysql-test/suite/galera/r/galera_schema.result +++ b/mysql-test/suite/galera/r/galera_schema.result @@ -48,7 +48,7 @@ wsrep_cluster CREATE TABLE `wsrep_cluster` ( `protocol_version` int(11) NOT NULL, `capabilities` int(11) NOT NULL, PRIMARY KEY (`cluster_uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 SHOW CREATE TABLE wsrep_cluster_members; Table Create Table wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` ( @@ -57,7 +57,7 @@ wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` ( `node_name` char(32) NOT NULL, `node_incoming_address` varchar(256) NOT NULL, PRIMARY KEY (`node_uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 SHOW CREATE TABLE wsrep_cluster_members_history; Table Create Table wsrep_cluster_members_history CREATE TABLE `wsrep_cluster_members_history` ( @@ -68,7 +68,7 @@ wsrep_cluster_members_history CREATE TABLE `wsrep_cluster_members_history` ( `node_name` char(32) NOT NULL, `node_incoming_address` varchar(256) NOT NULL, PRIMARY KEY (`node_uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 SHOW CREATE TABLE wsrep_streaming_log; Table Create Table wsrep_streaming_log CREATE TABLE `wsrep_streaming_log` ( @@ -78,7 +78,7 @@ wsrep_streaming_log CREATE TABLE `wsrep_streaming_log` ( `flags` int(11) NOT NULL, `frag` longblob NOT NULL, PRIMARY KEY (`node_uuid`,`trx_id`,`seqno`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 SHOW CREATE TABLE mysql.wsrep_cluster; Table Create Table wsrep_cluster CREATE TABLE `wsrep_cluster` ( @@ -88,7 +88,7 @@ wsrep_cluster CREATE TABLE `wsrep_cluster` ( `protocol_version` int(11) NOT NULL, `capabilities` int(11) NOT NULL, PRIMARY KEY (`cluster_uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 SHOW CREATE TABLE mysql.wsrep_cluster_members; Table Create Table wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` ( @@ -97,7 +97,7 @@ wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` ( `node_name` char(32) NOT NULL, `node_incoming_address` varchar(256) NOT NULL, PRIMARY KEY (`node_uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 SHOW CREATE TABLE mysql.wsrep_streaming_log; Table Create Table wsrep_streaming_log CREATE TABLE `wsrep_streaming_log` ( @@ -107,7 +107,7 @@ wsrep_streaming_log CREATE TABLE `wsrep_streaming_log` ( `flags` int(11) NOT NULL, `frag` longblob NOT NULL, PRIMARY KEY (`node_uuid`,`trx_id`,`seqno`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 DROP TABLE wsrep_cluster; DROP TABLE wsrep_cluster_members; DROP TABLE wsrep_cluster_members_history; diff --git a/mysql-test/suite/galera/r/galera_sequences.result b/mysql-test/suite/galera/r/galera_sequences.result new file mode 100644 index 0000000000000..da669e6774e42 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sequences.result @@ -0,0 +1,109 @@ +connection node_2; +connection node_1; +connection node_1; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +CALL mtr.add_suppression("WSREP: CREATE TABLE isolation failure"); +connection node_2; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +connection node_1; +CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 1000000 increment by 0 cache 1000 nocycle ENGINE=InnoDB; +SHOW CREATE SEQUENCE seq; +Table Create Table +seq CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 1000000 increment by 0 cache 1000 nocycle ENGINE=InnoDB +connection node_2; +SHOW CREATE SEQUENCE seq; +Table Create Table +seq CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 1000000 increment by 0 cache 1000 nocycle ENGINE=InnoDB +connection node_1; +ALTER SEQUENCE seq MAXVALUE = 10000; +SHOW CREATE SEQUENCE seq; +Table Create Table +seq CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 10000 increment by 0 cache 1000 nocycle ENGINE=InnoDB +connection node_2; +SHOW CREATE SEQUENCE seq; +Table Create Table +seq CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 10000 increment by 0 cache 1000 nocycle ENGINE=InnoDB +connection node_1; +DROP SEQUENCE seq; +SHOW CREATE SEQUENCE seq; +ERROR 42S02: Table 'test.seq' doesn't exist +connection node_2; +SHOW CREATE SEQUENCE seq; +ERROR 42S02: Table 'test.seq' doesn't exist +connection node_1; +CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1; +select NEXT VALUE FOR Seq1_1; +NEXT VALUE FOR Seq1_1 +1 +alter table Seq1_1 engine=myisam; +select NEXT VALUE FOR Seq1_1; +NEXT VALUE FOR Seq1_1 +1001 +alter table Seq1_1 engine=innodb; +select NEXT VALUE FOR Seq1_1; +NEXT VALUE FOR Seq1_1 +2001 +connection node_2; +SHOW CREATE SEQUENCE Seq1_1; +Table Create Table +Seq1_1 CREATE SEQUENCE `Seq1_1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB +select NEXT VALUE FOR Seq1_1; +NEXT VALUE FOR Seq1_1 +3001 +connection node_1; +DROP SEQUENCE Seq1_1; +connection node_1; +CREATE TABLE t2 (d CHAR(1)KEY); +SET SESSION autocommit=0; +INSERT INTO t2 VALUES(1); +CREATE TEMPORARY SEQUENCE seq1 NOCACHE ENGINE=INNODB; +CREATE SEQUENCE seq2 NOCACHE ENGINE=INNODB; +COMMIT; +SET SESSION AUTOCOMMIT=1; +SHOW CREATE TABLE seq1; +Table Create Table +seq1 CREATE TEMPORARY TABLE `seq1` ( + `next_not_cached_value` bigint(21) NOT NULL, + `minimum_value` bigint(21) NOT NULL, + `maximum_value` bigint(21) NOT NULL, + `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used', + `increment` bigint(21) NOT NULL COMMENT 'increment value', + `cache_size` bigint(21) unsigned NOT NULL, + `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed', + `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done' +) ENGINE=InnoDB SEQUENCE=1 +connection node_2; +SHOW CREATE SEQUENCE seq1; +ERROR 42S02: Table 'test.seq1' doesn't exist +SHOW CREATE SEQUENCE seq2; +Table Create Table +seq2 CREATE SEQUENCE `seq2` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB +connection node_1; +SET SESSION autocommit=1; +DROP SEQUENCE seq1; +DROP SEQUENCE seq2; +DROP TABLE t2; +SET SESSION AUTOCOMMIT=0; +SET SESSION wsrep_OSU_method='RSU'; +CREATE TABLE t1(c1 VARCHAR(10)); +INSERT INTO t1 (c1) VALUES(''); +create temporary sequence sq1 NOCACHE engine=innodb; +create sequence sq2 NOCACHE engine=innodb; +COMMIT; +SHOW CREATE SEQUENCE sq1; +Table Create Table +sq1 CREATE SEQUENCE `sq1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB +SHOW CREATE SEQUENCE sq2; +Table Create Table +sq2 CREATE SEQUENCE `sq2` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB +connection node_2; +SHOW CREATE SEQUENCE sq1; +ERROR 42S02: Table 'test.sq1' doesn't exist +SHOW CREATE SEQUENCE sq2; +ERROR 42S02: Table 'test.sq2' doesn't exist +connection node_1; +SET SESSION AUTOCOMMIT=1; +DROP TABLE t1; +DROP SEQUENCE sq1; +DROP SEQUENCE sq2; +SET SESSION wsrep_OSU_method='TOI'; diff --git a/mysql-test/suite/galera/r/galera_sst_encrypted.result b/mysql-test/suite/galera/r/galera_sst_encrypted.result new file mode 100644 index 0000000000000..52ca6e06bae3d --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_encrypted.result @@ -0,0 +1,348 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +Performing State Transfer on a server that has been shut down cleanly and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_shutdown_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that starts from a clean var directory +This is accomplished by shutting down node #2 and removing its var directory before restarting it +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +Cleaning var directory ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_clean_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff index bad8355b5145c..3aad611cacb5e 100644 --- a/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff @@ -1,5 +1,5 @@ ---- r/galera_sst_mariabackup.result 2021-04-10 14:25:04.142716409 +0300 -+++ r/galera_sst_mariabackup,debug.reject 2021-04-10 14:53:30.033162191 +0300 +--- r/galera_sst_mariabackup.result ++++ r/galera_sst_mariabackup.reject @@ -516,5 +516,189 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive,debug.rdiff new file mode 100644 index 0000000000000..a9c796da6075b --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive,debug.rdiff @@ -0,0 +1,192 @@ +--- r/galera_sst_mariabackup_logarchive.result ++++ r/galera_sst_mariabackup_logarchive.reject +@@ -516,5 +516,189 @@ + 1 + DROP TABLE t1; + COMMIT; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++connection node_1; ++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1,'node1_committed_before'); ++INSERT INTO t1 VALUES (2,'node1_committed_before'); ++INSERT INTO t1 VALUES (3,'node1_committed_before'); ++INSERT INTO t1 VALUES (4,'node1_committed_before'); ++INSERT INTO t1 VALUES (5,'node1_committed_before'); ++connection node_2; ++START TRANSACTION; ++INSERT INTO t1 VALUES (6,'node2_committed_before'); ++INSERT INTO t1 VALUES (7,'node2_committed_before'); ++INSERT INTO t1 VALUES (8,'node2_committed_before'); ++INSERT INTO t1 VALUES (9,'node2_committed_before'); ++INSERT INTO t1 VALUES (10,'node2_committed_before'); ++COMMIT; ++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ++connection node_1; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++connection node_2; ++SET wsrep_sync_wait = 0; ++Killing server ... ++connection node_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after'); ++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after'); ++connection node_2; ++Performing --wsrep-recover ... ++connection node_2; ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after'); ++COMMIT; ++connection node_1; ++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after'); ++COMMIT; ++connection node_1a_galera_st_kill_slave_ddl; ++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after'); ++ROLLBACK; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++connection node_1; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET GLOBAL debug_dbug = $debug_orig; + disconnect node_2; + disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive.result new file mode 100644 index 0000000000000..c2bbb94653adb --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive.result @@ -0,0 +1,522 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_2; +connection node_1; +Performing State Transfer on a server that has been shut down cleanly and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_shutdown_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that starts from a clean var directory +This is accomplished by shutting down node #2 and removing its var directory before restarting it +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +Cleaning var directory ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_clean_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that has been killed and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Killing server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +Starting server ... +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_sst_rsync,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync,debug.rdiff index c4937bfb4ca90..87f8a463bd064 100644 --- a/mysql-test/suite/galera/r/galera_sst_rsync,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_rsync,debug.rdiff @@ -1,5 +1,5 @@ ---- r/galera_sst_rsync_data_dir.result 2021-04-10 14:35:28.090610315 +0300 -+++ r/galera_sst_rsync_data_dir,debug.reject 2021-04-10 15:41:44.876068411 +0300 +--- galera_sst_rsync.result ++++ galera_sst_rsync.reject @@ -516,3 +516,187 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto,debug.rdiff new file mode 100644 index 0000000000000..5bc47c58303e4 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto,debug.rdiff @@ -0,0 +1,188 @@ +@@ -516,3 +516,187 @@ + 1 + DROP TABLE t1; + COMMIT; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++connection node_1; ++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1,'node1_committed_before'); ++INSERT INTO t1 VALUES (2,'node1_committed_before'); ++INSERT INTO t1 VALUES (3,'node1_committed_before'); ++INSERT INTO t1 VALUES (4,'node1_committed_before'); ++INSERT INTO t1 VALUES (5,'node1_committed_before'); ++connection node_2; ++START TRANSACTION; ++INSERT INTO t1 VALUES (6,'node2_committed_before'); ++INSERT INTO t1 VALUES (7,'node2_committed_before'); ++INSERT INTO t1 VALUES (8,'node2_committed_before'); ++INSERT INTO t1 VALUES (9,'node2_committed_before'); ++INSERT INTO t1 VALUES (10,'node2_committed_before'); ++COMMIT; ++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ++connection node_1; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++connection node_2; ++SET wsrep_sync_wait = 0; ++Killing server ... ++connection node_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after'); ++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after'); ++connection node_2; ++Performing --wsrep-recover ... ++connection node_2; ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after'); ++COMMIT; ++connection node_1; ++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after'); ++COMMIT; ++connection node_1a_galera_st_kill_slave_ddl; ++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after'); ++ROLLBACK; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++connection node_1; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto.result b/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto.result new file mode 100644 index 0000000000000..8b531bc6a3f59 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto.result @@ -0,0 +1,518 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +Performing State Transfer on a server that has been shut down cleanly and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_shutdown_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that starts from a clean var directory +This is accomplished by shutting down node #2 and removing its var directory before restarting it +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +Cleaning var directory ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_clean_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that has been killed and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Killing server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +Starting server ... +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; diff --git a/mysql-test/suite/galera/r/galera_sync_wait_show.result b/mysql-test/suite/galera/r/galera_sync_wait_show.result index 793da3246ff8b..8f6f936806ada 100644 --- a/mysql-test/suite/galera/r/galera_sync_wait_show.result +++ b/mysql-test/suite/galera/r/galera_sync_wait_show.result @@ -7,7 +7,7 @@ CREATE DATABASE db1; connection node_2; SHOW CREATE DATABASE db1; Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */ +db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ DROP DATABASE db1; connection node_1; CREATE PROCEDURE p1 () SELECT 1 FROM DUAL; diff --git a/mysql-test/suite/galera/r/galera_sync_wait_upto.result b/mysql-test/suite/galera/r/galera_sync_wait_upto.result index e18cd3b5432e9..c9f468774fb7c 100644 --- a/mysql-test/suite/galera/r/galera_sync_wait_upto.result +++ b/mysql-test/suite/galera/r/galera_sync_wait_upto.result @@ -23,3 +23,5 @@ WSREP_SYNC_WAIT_UPTO 1 connection node_1; DROP TABLE t1; +connection node_2; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_error.result b/mysql-test/suite/galera/r/galera_toi_ddl_error.result index 386dc28bed3d5..9aec137d01027 100644 --- a/mysql-test/suite/galera/r/galera_toi_ddl_error.result +++ b/mysql-test/suite/galera/r/galera_toi_ddl_error.result @@ -12,13 +12,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP TABLE ten; CALL mtr.add_suppression("Ignoring error 'Duplicate entry '111110' for key 'PRIMARY'' on query."); diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result b/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result index db702b1a59eaa..bc6dc4991e732 100644 --- a/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result +++ b/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result @@ -14,7 +14,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, PRIMARY KEY (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT COUNT(*) = 3 FROM t1; COUNT(*) = 3 1 @@ -29,7 +29,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, PRIMARY KEY (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT COUNT(*) = 3 FROM t1; COUNT(*) = 3 1 diff --git a/mysql-test/suite/galera/r/galera_toi_ftwrl.result b/mysql-test/suite/galera/r/galera_toi_ftwrl.result index fdc8b294c1c68..320ff8e7d1f1a 100644 --- a/mysql-test/suite/galera/r/galera_toi_ftwrl.result +++ b/mysql-test/suite/galera/r/galera_toi_ftwrl.result @@ -13,5 +13,5 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `f2` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result b/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result index 86c30fa4b23e2..9071331eaa1ae 100644 --- a/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result +++ b/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result @@ -22,7 +22,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL AUTO_INCREMENT, `node` varchar(10) DEFAULT NULL, PRIMARY KEY (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_2a; SHOW CREATE TABLE t1; Table Create Table @@ -30,7 +30,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL AUTO_INCREMENT, `node` varchar(10) DEFAULT NULL, PRIMARY KEY (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_1a; SELECT @@auto_increment_increment = 1; @@auto_increment_increment = 1 diff --git a/mysql-test/suite/galera/r/galera_var_cluster_address.result b/mysql-test/suite/galera/r/galera_var_cluster_address.result index 8c1070e43cefc..9cfe5a8f7658c 100644 --- a/mysql-test/suite/galera/r/galera_var_cluster_address.result +++ b/mysql-test/suite/galera/r/galera_var_cluster_address.result @@ -48,7 +48,7 @@ CALL mtr.add_suppression("failed to open gcomm backend connection: 110: failed t CALL mtr.add_suppression("Failed to open backend connection: -110 \\(Connection timed out\\)"); CALL mtr.add_suppression("gcs connect failed: Connection timed out"); CALL mtr.add_suppression("WSREP: wsrep::connect\\(foo://\\) failed: 7"); -CALL mtr.add_suppression("WSREP: wsrep::connect\\(gcomm://192.0.2.1\\) failed: 7"); +CALL mtr.add_suppression("WSREP: wsrep::connect\\(gcomm://.*\\) failed: 7"); disconnect node_2; disconnect node_1; # End of test diff --git a/mysql-test/suite/galera/r/galera_var_dirty_reads.result b/mysql-test/suite/galera/r/galera_var_dirty_reads.result index 240f1802385ec..2b164fecee626 100644 --- a/mysql-test/suite/galera/r/galera_var_dirty_reads.result +++ b/mysql-test/suite/galera/r/galera_var_dirty_reads.result @@ -19,9 +19,9 @@ SHOW STATUS LIKE 'wsrep_cluster_status'; Variable_name Value wsrep_cluster_status Disconnected SELECT * FROM t1; -Got one of the listed errors +ERROR 08S01: WSREP has not yet prepared node for application use SELECT 1 FROM t1; -Got one of the listed errors +ERROR 08S01: WSREP has not yet prepared node for application use SET @@session.wsrep_dirty_reads=ON; SELECT * FROM t1; i @@ -34,7 +34,7 @@ i variable_name variable_value 1 WSREP_DIRTY_READS ON SET @@session.wsrep_dirty_reads=OFF; SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1; -Got one of the listed errors +ERROR 08S01: WSREP has not yet prepared node for application use SELECT 1; 1 1 diff --git a/mysql-test/suite/galera/r/galera_var_gtid_domain_id.result b/mysql-test/suite/galera/r/galera_var_gtid_domain_id.result index 3a23f0c8122e7..0edfdf47d345c 100644 --- a/mysql-test/suite/galera/r/galera_var_gtid_domain_id.result +++ b/mysql-test/suite/galera/r/galera_var_gtid_domain_id.result @@ -89,6 +89,8 @@ connection node_2; set global wsrep_on=OFF; reset master; set global wsrep_on=ON; +connection node_2; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); disconnect node_2; disconnect node_1; # End of test diff --git a/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result b/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result deleted file mode 100644 index 758c34ee62ee6..0000000000000 --- a/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result +++ /dev/null @@ -1,30 +0,0 @@ -connection node_2; -connection node_1; -connection node_1a; -SET SESSION wsrep_sync_wait = 0; -connection node_1; -CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB; -CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; -INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); -SET GLOBAL innodb_disallow_writes=ON; -INSERT INTO t1 (f2) SELECT 'abcde ' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; -connection node_2; -INSERT INTO t1 (f2) SELECT 'fghij ' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; -SELECT COUNT(*) AS EXPECT_10000 FROM t1; -EXPECT_10000 -10000 -connection node_1a; -SET GLOBAL innodb_disallow_writes=OFF; -connection node_1; -SELECT COUNT(*) AS EXPECT_20000 FROM t1; -EXPECT_20000 -20000 -connection node_2; -SELECT COUNT(*) AS EXPECT_20000 FROM t1; -EXPECT_20000 -20000 -connection node_1; -connection node_2; -DROP TABLE t1; -DROP TABLE ten; -disconnect node_1a; diff --git a/mysql-test/suite/galera/r/galera_var_max_ws_rows.result b/mysql-test/suite/galera/r/galera_var_max_ws_rows.result index 16e868f04858e..72d16d196ee57 100644 --- a/mysql-test/suite/galera/r/galera_var_max_ws_rows.result +++ b/mysql-test/suite/galera/r/galera_var_max_ws_rows.result @@ -132,7 +132,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` bigint(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT COUNT(*) FROM t1; COUNT(*) 2 diff --git a/mysql-test/suite/galera/r/galera_var_max_ws_size.result b/mysql-test/suite/galera/r/galera_var_max_ws_size.result index 89c9698eed4db..bd712ef9b5594 100644 --- a/mysql-test/suite/galera/r/galera_var_max_ws_size.result +++ b/mysql-test/suite/galera/r/galera_var_max_ws_size.result @@ -4,7 +4,7 @@ connection node_1; CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(1024)) Engine=InnoDB; SET GLOBAL wsrep_max_ws_size = 1024; INSERT INTO t1 VALUES (DEFAULT, REPEAT('X', 1024)); -ERROR HY000: Got error 5 "Input/output error" during COMMIT +ERROR HY000: Maximum writeset size exceeded SELECT COUNT(*) = 0 FROM t1; COUNT(*) = 0 1 diff --git a/mysql-test/suite/galera/r/galera_var_notify_ssl_ipv6.result b/mysql-test/suite/galera/r/galera_var_notify_ssl_ipv6.result new file mode 100644 index 0000000000000..432d6c0adbd4e --- /dev/null +++ b/mysql-test/suite/galera/r/galera_var_notify_ssl_ipv6.result @@ -0,0 +1,13 @@ +connection node_2; +connection node_1; +connection node_1; +SELECT COUNT(DISTINCT uuid) AS EXPECT_2 FROM mtr_wsrep_notify.membership; +EXPECT_2 +2 +SELECT MAX(size) AS EXPECT_2 FROM mtr_wsrep_notify.status; +EXPECT_2 +2 +SELECT COUNT(DISTINCT idx) AS EXPECT_2 FROM mtr_wsrep_notify.status; +EXPECT_2 +2 +DROP SCHEMA mtr_wsrep_notify; diff --git a/mysql-test/suite/galera/r/galera_var_replicate_aria_on.result b/mysql-test/suite/galera/r/galera_var_replicate_aria_on.result index 39fd748314c6d..91c07ba6681e7 100644 --- a/mysql-test/suite/galera/r/galera_var_replicate_aria_on.result +++ b/mysql-test/suite/galera/r/galera_var_replicate_aria_on.result @@ -89,11 +89,8 @@ connection node_1; SET GLOBAL wsrep_sync_wait=15; CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=Aria; CREATE TABLE t2 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; -SET AUTOCOMMIT=OFF; -START TRANSACTION; INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); -COMMIT; connection node_2; SET GLOBAL wsrep_sync_wait=15; SELECT COUNT(*) AS EXPECT_1 FROM t1; @@ -103,6 +100,7 @@ SELECT COUNT(*) AS EXPECT_1 FROM t2; EXPECT_1 1 connection node_1; +SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES (2); INSERT INTO t2 VALUES (2); @@ -129,6 +127,7 @@ INSERT INTO t1 VALUES (1); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' connection node_1; COMMIT; +ERROR HY000: Transactional commit not supported by involved engine(s) DROP TABLE t1,t2; connection node_1; CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=INNODB; diff --git a/mysql-test/suite/galera/r/galera_var_retry_autocommit.result b/mysql-test/suite/galera/r/galera_var_retry_autocommit.result index b8943464cb787..50667b0a4fa99 100644 --- a/mysql-test/suite/galera/r/galera_var_retry_autocommit.result +++ b/mysql-test/suite/galera/r/galera_var_retry_autocommit.result @@ -12,25 +12,33 @@ connection node_2; TRUNCATE TABLE t1; connection node_1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 +SELECT COUNT(*) FROM t1; +COUNT(*) +0 SET DEBUG_SYNC = 'RESET'; DROP TABLE t1; connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; SET SESSION wsrep_retry_autocommit = 1; +SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit'; SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue'; INSERT INTO t1 (f1) VALUES (3); connection node_1a; SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; connection node_2; TRUNCATE TABLE t1; +connection node_1a; +SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached'; +SELECT COUNT(*) FROM t1; +COUNT(*) +0 +SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue'; connection node_1; -SELECT COUNT(*) = 1 FROM t1; -COUNT(*) = 1 +SELECT COUNT(*) FROM t1; +COUNT(*) 1 SET DEBUG_SYNC = 'RESET'; +SET GLOBAL debug_dbug = NULL; DROP TABLE t1; connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; @@ -44,18 +52,17 @@ connection node_2; TRUNCATE TABLE t1; connection node_1a; SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached'; -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 +SELECT COUNT(*) FROM t1; +COUNT(*) +0 SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue WAIT_FOR before_cert'; connection node_2; TRUNCATE TABLE t1; connection node_1a; -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 +SELECT COUNT(*) FROM t1; +COUNT(*) +0 connection node_1; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction SET DEBUG_SYNC = 'RESET'; SET GLOBAL debug_dbug = NULL; DROP TABLE t1; @@ -65,9 +72,11 @@ SET SESSION wsrep_retry_autocommit = 64; SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit'; SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 64'; INSERT INTO t1 VALUES (5); +connection node_2; +connection node_1; connection node_1; -SELECT COUNT(*) = 1 FROM t1; -COUNT(*) = 1 +SELECT COUNT(*) FROM t1; +COUNT(*) 1 SET DEBUG_SYNC = 'RESET'; SET GLOBAL debug_dbug = NULL; diff --git a/mysql-test/suite/galera/r/galera_var_wsrep_mode.result b/mysql-test/suite/galera/r/galera_var_wsrep_mode.result index 8682ad685a5b8..b5b33fe8ae597 100644 --- a/mysql-test/suite/galera/r/galera_var_wsrep_mode.result +++ b/mysql-test/suite/galera/r/galera_var_wsrep_mode.result @@ -20,8 +20,8 @@ SET GLOBAL wsrep_mode='A'; ERROR 42000: Variable 'wsrep_mode' can't be set to the value of 'A' SET GLOBAL wsrep_mode=NULL; ERROR 42000: Variable 'wsrep_mode' can't be set to the value of 'NULL' -SET GLOBAL wsrep_mode=64; -ERROR 42000: Variable 'wsrep_mode' can't be set to the value of '64' +SET GLOBAL wsrep_mode=128; +ERROR 42000: Variable 'wsrep_mode' can't be set to the value of '128' SET GLOBAL wsrep_mode=REQUIRED_PRIMARY_KEY,REPLICATE_MYISAM; 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 SET GLOBAL wsrep_mode=1; diff --git a/mysql-test/suite/galera/r/galera_wan_restart_sst.result b/mysql-test/suite/galera/r/galera_wan_restart_sst.result index 053903381602c..2433a1d9c4842 100644 --- a/mysql-test/suite/galera/r/galera_wan_restart_sst.result +++ b/mysql-test/suite/galera/r/galera_wan_restart_sst.result @@ -1,17 +1,21 @@ connection node_2; connection node_1; -SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; -VARIABLE_VALUE = 4 -1 +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; +connection node_1; +connection node_2; +connection node_3; +connection node_4; +SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +EXPECT_4 +4 connection node_1; CREATE TABLE t1 (f1 INTEGER); INSERT INTO t1 VALUES (1); connection node_2; INSERT INTO t1 VALUES (2); -connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connection node_3; INSERT INTO t1 VALUES (3); -connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; connection node_4; INSERT INTO t1 VALUES (4); connection node_3; @@ -85,3 +89,6 @@ CALL mtr.add_suppression("Action message in non-primary configuration from membe connection node_4; CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); +connection node_1; +disconnect node_3; +disconnect node_4; diff --git a/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result index 244623d52b776..143dee3e6e441 100644 --- a/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result +++ b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result @@ -1,6 +1,14 @@ connection node_2; connection node_1; connection node_1; +connection node_2; +connection node_2; +Shutting down server ... +connection node_1; +connection node_2; +Cleaning grastate.dat file ... +Starting server ... +connection node_1; SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; VARIABLE_VALUE Primary @@ -38,3 +46,7 @@ VARIABLE_VALUE SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; VARIABLE_VALUE Synced +Shutting down server ... +Cleaning var directory ... +Starting server ... +connection node_1; diff --git a/mysql-test/suite/galera/r/lp1376747-2.result b/mysql-test/suite/galera/r/lp1376747-2.result index 5e5b5be6c869f..950606eeb95b8 100644 --- a/mysql-test/suite/galera/r/lp1376747-2.result +++ b/mysql-test/suite/galera/r/lp1376747-2.result @@ -19,7 +19,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `f2` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * from t1; id f2 1 NULL diff --git a/mysql-test/suite/galera/r/lp1376747-3.result b/mysql-test/suite/galera/r/lp1376747-3.result index 62893b85bcf1f..916c3d80ee045 100644 --- a/mysql-test/suite/galera/r/lp1376747-3.result +++ b/mysql-test/suite/galera/r/lp1376747-3.result @@ -17,7 +17,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `f2` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_1; INSERT INTO t1 VALUES (2,3); connection node_2; diff --git a/mysql-test/suite/galera/r/lp1376747-4.result b/mysql-test/suite/galera/r/lp1376747-4.result index 9c021c3eac3ba..16141f0268dc8 100644 --- a/mysql-test/suite/galera/r/lp1376747-4.result +++ b/mysql-test/suite/galera/r/lp1376747-4.result @@ -16,7 +16,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked2 WAIT_FOR go2'; FLUSH TABLES t1 WITH READ LOCK;; connection node_2; @@ -28,7 +28,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_2a; set debug_sync= 'RESET'; UNLOCK TABLES; @@ -39,7 +39,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `f2` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * from t1; id f2 1 NULL diff --git a/mysql-test/suite/galera/r/lp1376747.result b/mysql-test/suite/galera/r/lp1376747.result index 1b9dd545409c5..ec7e0bc435784 100644 --- a/mysql-test/suite/galera/r/lp1376747.result +++ b/mysql-test/suite/galera/r/lp1376747.result @@ -19,7 +19,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `f2` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * from t1; id f2 1 NULL diff --git a/mysql-test/suite/galera/r/mariadb_tzinfo_to_sql.result b/mysql-test/suite/galera/r/mariadb_tzinfo_to_sql.result new file mode 100644 index 0000000000000..d47cec0992fb6 --- /dev/null +++ b/mysql-test/suite/galera/r/mariadb_tzinfo_to_sql.result @@ -0,0 +1,271 @@ +connection node_2; +connection node_1; +# +# MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases +# + +# On node_1 +connection node_1; +CREATE TABLE time_zone LIKE mysql.time_zone; +CREATE TABLE time_zone_name LIKE mysql.time_zone_name; +CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition; +CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type; +CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second; +ALTER TABLE time_zone_name ENGINE=MyISAM; +Warnings: +Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1' +ALTER TABLE time_zone_transition_type ENGINE=MyISAM; +Warnings: +Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1' +SET @save_wsrep_mode=@@WSREP_MODE; +# +# Run on zoneinfo directory --skip-write-binlog +# + +# Apply on node_1 + +Warnings: +Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1' +'binlog stationary as expected' +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN; +@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@WSREP_ON @@SQL_LOG_BIN +1 0 1 1 1 1 +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff +FROM information_schema.global_status g +JOIN baseline b USING (VARIABLE_NAME) +ORDER BY g.VARIABLE_NAME; +VARIABLE_NAME diff +COM_ALTER_TABLE 2 +COM_BEGIN 0 +COM_INSERT 6 +COM_LOCK_TABLES 1 +COM_TRUNCATE 4 +SELECT COUNT(*) FROM time_zone; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 + +# On node_2 (not replicated) + +connection node_2; +SELECT COUNT(*) FROM time_zone; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 + +# Apply on node_1 + +connection node_1; +SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM'; +Warnings: +Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1' +'binlog stationary as expected' +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN; +@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@WSREP_ON @@SQL_LOG_BIN +1 0 1 1 1 1 +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff +FROM information_schema.global_status g +JOIN baseline b USING (VARIABLE_NAME) +ORDER BY g.VARIABLE_NAME; +VARIABLE_NAME diff +COM_ALTER_TABLE 2 +COM_BEGIN 0 +COM_INSERT 6 +COM_LOCK_TABLES 1 +COM_TRUNCATE 4 +SELECT COUNT(*) FROM time_zone; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 + +# On node_2 (not replicated) + +connection node_2; +SELECT COUNT(*) FROM time_zone; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 +# +# Run on zoneinfo directory without --skip-write-binlog +# + +# Apply on node_1 + +connection node_1; +Warnings: +Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1' +'binlog advanced as expected' +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN; +@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@WSREP_ON @@SQL_LOG_BIN +1 0 1 1 1 1 +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff +FROM information_schema.global_status g +JOIN baseline b USING (VARIABLE_NAME) +ORDER BY g.VARIABLE_NAME; +VARIABLE_NAME diff +COM_ALTER_TABLE 2 +COM_BEGIN 0 +COM_INSERT 6 +COM_LOCK_TABLES 1 +COM_TRUNCATE 4 +SELECT COUNT(*) FROM time_zone; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 + +# On node_2 (replicated via ARIA) + +connection node_2; +SELECT COUNT(*) FROM time_zone; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +TRUNCATE TABLE time_zone_leap_second; + +# Apply on node_1 + +connection node_1; +SET GLOBAL WSREP_MODE=''; +Warnings: +Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1' +Warnings: +Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1' +'binlog advanced as expected' +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN; +@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@WSREP_ON @@SQL_LOG_BIN +1 1 1 1 1 1 +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff +FROM information_schema.global_status g +JOIN baseline b USING (VARIABLE_NAME) +ORDER BY g.VARIABLE_NAME; +VARIABLE_NAME diff +COM_ALTER_TABLE 8 +COM_BEGIN 1 +COM_INSERT 6 +COM_LOCK_TABLES 0 +COM_TRUNCATE 4 +SELECT COUNT(*) FROM time_zone; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 +SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES +WHERE +TABLE_SCHEMA = DATABASE() +AND TABLE_NAME LIKE 'time_zone%' ORDER BY TABLE_NAME; +TABLE_NAME ENGINE +time_zone Aria +time_zone_leap_second Aria +time_zone_name MyISAM +time_zone_transition Aria +time_zone_transition_type MyISAM + +# On node_2 (replicated via InnoDB) + +connection node_2; +SELECT COUNT(*) FROM time_zone; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 +connection node_1; +SET GLOBAL WSREP_MODE=@save_wsrep_mode; +DROP TABLE baseline; +DROP TABLE time_zone; +DROP TABLE time_zone_name; +DROP TABLE time_zone_transition; +DROP TABLE time_zone_transition_type; +DROP TABLE time_zone_leap_second; +# +# End of 10.6 tests +# diff --git a/mysql-test/suite/galera/r/mdev-26175.result b/mysql-test/suite/galera/r/mdev-26175.result new file mode 100644 index 0000000000000..f84244fe91619 --- /dev/null +++ b/mysql-test/suite/galera/r/mdev-26175.result @@ -0,0 +1,24 @@ +connection node_2; +connection node_1; +connection node_1; +SET sql_mode="no_zero_date"; +SET GLOBAL wsrep_max_ws_rows=1; +CREATE TABLE t2 (a INT); +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TRIGGER tgr BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (0); +INSERT INTO t1 VALUES (0),(1); +ERROR HY000: wsrep_max_ws_rows exceeded +SELECT * FROM t1; +a +SELECT * FROM t2; +a +connection node_2; +SELECT * FROM t1; +a +SELECT * FROM t2; +a +connection node_1; +SET sql_mode=DEFAULT; +SET GLOBAL wsrep_max_ws_rows=DEFAULT; +DROP TRIGGER tgr; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/galera/r/mdev_10518.result b/mysql-test/suite/galera/r/mdev_10518.result index b07f530358640..8426cd31349dc 100644 --- a/mysql-test/suite/galera/r/mdev_10518.result +++ b/mysql-test/suite/galera/r/mdev_10518.result @@ -89,6 +89,8 @@ connection node_2; set global wsrep_on=OFF; reset master; set global wsrep_on=ON; +connection node_2; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); disconnect node_2; disconnect node_1; # End of test diff --git a/mysql-test/suite/galera/r/mysql_tzinfo_to_sql.result b/mysql-test/suite/galera/r/mysql_tzinfo_to_sql.result new file mode 100644 index 0000000000000..e0cee3a50bf87 --- /dev/null +++ b/mysql-test/suite/galera/r/mysql_tzinfo_to_sql.result @@ -0,0 +1,154 @@ +connection node_2; +connection node_1; +# +# MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases +# + +# On node_1 +connection node_1; +CREATE TABLE time_zone LIKE mysql.time_zone; +CREATE TABLE time_zone_name LIKE mysql.time_zone_name; +CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition; +CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type; +CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second; +# +# Run on zoneinfo directory --skip-write-binlog +# + +# Apply on node_1 + +load timezones +'binlog stationary as expected' +SELECT COUNT(*) FROM time_zone; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 + +# On node_2 (not replicated) + +connection node_2; +SELECT COUNT(*) FROM time_zone; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 +# +# Run on zoneinfo directory without --skip-write-binlog +# + +# Apply on node_1 + +connection node_1; +load timezones +'binlog advanced as expected' +SELECT COUNT(*) FROM time_zone; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 + +# On node_2 (replicated via InnoDB) + +connection node_2; +SELECT COUNT(*) FROM time_zone; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +TRUNCATE TABLE time_zone_leap_second; + +# Apply on node_1 (with wsrep_on=OFF) + +connection node_1; +SET GLOBAL WSREP_ON=OFF; +load timezones +SET GLOBAL WSREP_ON=ON; +'binlog advanced as expected' +SELECT COUNT(*) FROM time_zone; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +2 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 + +# On node_2 (Should not have been replicated) + +connection node_2; +SELECT COUNT(*) FROM time_zone; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_name; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_transition_type; +COUNT(*) +0 +SELECT COUNT(*) FROM time_zone_leap_second; +COUNT(*) +0 +connection node_1; +DROP TABLE time_zone; +DROP TABLE time_zone_name; +DROP TABLE time_zone_transition; +DROP TABLE time_zone_transition_type; +DROP TABLE time_zone_leap_second; +# +# End of 10.2 tests +# diff --git a/mysql-test/suite/galera/r/partition.result b/mysql-test/suite/galera/r/partition.result index 2e16d06519c04..9d649fcec6927 100644 --- a/mysql-test/suite/galera/r/partition.result +++ b/mysql-test/suite/galera/r/partition.result @@ -57,7 +57,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`i`) -) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`i`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p2` VALUES LESS THAN (20) ENGINE = InnoDB, @@ -67,7 +67,7 @@ Table Create Table p1 CREATE TABLE `p1` ( `i` int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`i`) -) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM test.t1; i 19 @@ -94,7 +94,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`i`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `pMax` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -106,7 +106,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`i`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `pMax` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) diff --git a/mysql-test/suite/galera/r/query_cache.result b/mysql-test/suite/galera/r/query_cache.result deleted file mode 100644 index 5dabd38a9823b..0000000000000 --- a/mysql-test/suite/galera/r/query_cache.result +++ /dev/null @@ -1,1758 +0,0 @@ -connection node_2; -connection node_1; - -# Execute FLUSH/RESET commands. -# On node-1 -connection node_1; -SET @query_cache_size_saved=@@GLOBAL.query_cache_size; -SET @query_cache_type_saved=@@GLOBAL.query_cache_type; -set GLOBAL query_cache_size=1355776; -flush query cache; -reset query cache; -flush status; -# On node-2 -connection node_2; -SET @query_cache_size_saved=@@GLOBAL.query_cache_size; -SET @query_cache_type_saved=@@GLOBAL.query_cache_type; -set GLOBAL query_cache_size=1355776; -flush query cache; -reset query cache; -flush status; -# On node-1 -connection node_1; -create table t1 (a int not null) engine=innodb; -insert into t1 values (1),(2),(3); -select * from t1; -a -1 -2 -3 -select * from t1; -a -1 -2 -3 -select sql_no_cache * from t1; -a -1 -2 -3 -select length(now()) from t1; -length(now()) -19 -19 -19 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 1 -# On node-2 -connection node_2; -select * from t1; -a -1 -2 -3 -select * from t1; -a -1 -2 -3 -select sql_no_cache * from t1; -a -1 -2 -3 -select length(now()) from t1; -length(now()) -19 -19 -19 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 1 -# On node-1 -connection node_1; -delete from t1 where a=1; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 1 -# On node-2 -connection node_2; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 1 -# On node-1 -connection node_1; -select * from t1; -a -2 -3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 1 -# On node-2 -connection node_2; -select * from t1; -a -2 -3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 1 -# On node-1 -connection node_1; -update t1 set a=1 where a=3; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 1 -# On node-2 -connection node_2; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 1 -# On node-1 -connection node_1; -select * from t1; -a -2 -1 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 1 -# On node-2 -connection node_2; -select * from t1; -a -2 -1 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 1 -# On node-1 -connection node_1; -drop table t1; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 1 -# On node-2 -connection node_2; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 1 - -# On node-1 -connection node_1; -create table t1 (a int not null) ENGINE=MyISAM; -insert into t1 values (1),(2),(3); -create table t2 (a int not null) ENGINE=MyISAM; -insert into t2 values (4),(5),(6); -create table t3 (a int not null) engine=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST; -select * from t3; -a -1 -2 -3 -4 -5 -6 -select * from t3; -a -1 -2 -3 -4 -5 -6 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 2 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 2 -insert into t2 values (7); -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 2 -select * from t1; -a -1 -2 -3 -select * from t1; -a -1 -2 -3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -insert into t3 values (8); -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -select * from t3; -a -1 -2 -3 -8 -4 -5 -6 -7 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -update t2 set a=9 where a=7; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -select * from t1; -a -1 -2 -3 -8 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -update t3 set a=10 where a=1; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -select * from t3; -a -10 -2 -3 -8 -4 -5 -6 -9 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -delete from t2 where a=9; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -select * from t1; -a -10 -2 -3 -8 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -delete from t3 where a=10; -select * from t3; -a -2 -3 -8 -4 -5 -6 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -# On node-2 -connection node_2; -select * from t3; -a -select * from t3; -a -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 4 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 2 -drop table t1, t2, t3; -# On node-1 -connection node_1; -set query_cache_type=demand; -create table t1 (a int not null) engine=innodb; -insert into t1 values (1),(2),(3); -select * from t1; -a -1 -2 -3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -select sql_cache * from t1 union select * from t1; -a -1 -2 -3 -set query_cache_type=2; -select sql_cache * from t1 union select * from t1; -a -1 -2 -3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 4 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -set query_cache_type=on; -# On node-2 -connection node_2; -set query_cache_type=demand; -select * from t1; -a -1 -2 -3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 2 -select sql_cache * from t1 union select * from t1; -a -1 -2 -3 -set query_cache_type=2; -select sql_cache * from t1 union select * from t1; -a -1 -2 -3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -set query_cache_type=on; -# On node-1 -connection node_1; -select sql_no_cache * from t1; -a -1 -2 -3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 4 -# On node-2 -connection node_2; -select sql_no_cache * from t1; -a -1 -2 -3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -drop table t1; -# On node-1 -connection node_1; -create table t1 (a text not null) engine=innodb; -select CONNECTION_ID() from t1; -CONNECTION_ID() -select FOUND_ROWS(); -FOUND_ROWS() -0 -select NOW() from t1; -NOW() -select CURDATE() from t1; -CURDATE() -select CURTIME() from t1; -CURTIME() -select DATABASE() from t1; -DATABASE() -select ENCRYPT("test") from t1; -ENCRYPT("test") -select LAST_INSERT_ID() from t1; -LAST_INSERT_ID() -select RAND() from t1; -RAND() -select UNIX_TIMESTAMP() from t1; -UNIX_TIMESTAMP() -select USER() from t1; -USER() -select CURRENT_USER() from t1; -CURRENT_USER() -select benchmark(1,1) from t1; -benchmark(1,1) -explain extended select benchmark(1,1) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1 100.00 -Warnings: -Note 1003 select benchmark(1,1) AS `benchmark(1,1)` from `test`.`t1` -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 4 -# On node-2 -connection node_2; -select CONNECTION_ID() from t1; -CONNECTION_ID() -select FOUND_ROWS(); -FOUND_ROWS() -0 -select NOW() from t1; -NOW() -select CURDATE() from t1; -CURDATE() -select CURTIME() from t1; -CURTIME() -select DATABASE() from t1; -DATABASE() -select ENCRYPT("test") from t1; -ENCRYPT("test") -select LAST_INSERT_ID() from t1; -LAST_INSERT_ID() -select RAND() from t1; -RAND() -select UNIX_TIMESTAMP() from t1; -UNIX_TIMESTAMP() -select USER() from t1; -USER() -select CURRENT_USER() from t1; -CURRENT_USER() -select benchmark(1,1) from t1; -benchmark(1,1) -explain extended select benchmark(1,1) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1 100.00 -Warnings: -Note 1003 select benchmark(1,1) AS `benchmark(1,1)` from `test`.`t1` -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -drop table t1; -# On node-1 -connection node_1; -create database mysqltest; -create table mysqltest.t1 (i int not null auto_increment, a int, primary key -(i)) engine=innodb; -insert into mysqltest.t1 values (1, 1); -select * from mysqltest.t1 where i is null; -i a -create table t1(a int) engine=innodb; -select * from t1; -a -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 4 -select * from mysqltest.t1; -i a -1 1 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 4 -# On node-2 -connection node_2; -select * from t1; -a -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -select * from mysqltest.t1; -i a -1 1 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -drop database mysqltest; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -drop table t1; -# On node-1 -connection node_1; -create table t1 (a char(1) not null collate koi8r_general_ci) engine=innodb; -insert into t1 values(_koi8r 0xc3); -set CHARACTER SET koi8r; -select * from t1; -a -� -set CHARACTER SET cp1251_koi8; -select * from t1; -a -� -set CHARACTER SET DEFAULT; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 4 -# On node-2 -connection node_2; -set CHARACTER SET koi8r; -select * from t1; -a -� -set CHARACTER SET cp1251_koi8; -select * from t1; -a -� -set CHARACTER SET DEFAULT; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 3 -drop table t1; -# On node-1 -connection node_1; -create database if not exists mysqltest; -create table mysqltest.t1 (i int not null) engine=innodb; -create table t1 (i int not null) engine=innodb; -insert into mysqltest.t1 (i) values (1); -insert into t1 (i) values (2); -select * from t1; -i -2 -use mysqltest; -select * from t1; -i -1 -select * from t1; -i -1 -use test; -select * from t1; -i -2 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 6 -# On node-2 -connection node_2; -select * from t1; -i -2 -use mysqltest; -select * from t1; -i -1 -select * from t1; -i -1 -use test; -select * from t1; -i -2 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 5 -drop database mysqltest; -drop table t1; -# On node-1 -connection node_1; -create table t1 (i int not null) engine=innodb; -insert into t1 (i) values (1),(2),(3),(4); -select SQL_CALC_FOUND_ROWS * from t1 limit 2; -i -1 -2 -select FOUND_ROWS(); -FOUND_ROWS() -4 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 6 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -select * from t1 where i=1; -i -1 -select FOUND_ROWS(); -FOUND_ROWS() -1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 6 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -select SQL_CALC_FOUND_ROWS * from t1 limit 2; -i -1 -2 -select FOUND_ROWS(); -FOUND_ROWS() -4 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 7 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -select * from t1 where i=1; -i -1 -select FOUND_ROWS(); -FOUND_ROWS() -1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 8 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -# On node-2 -connection node_2; -select SQL_CALC_FOUND_ROWS * from t1 limit 2; -i -1 -2 -select FOUND_ROWS(); -FOUND_ROWS() -4 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 5 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -select * from t1 where i=1; -i -1 -select FOUND_ROWS(); -FOUND_ROWS() -1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 5 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -select SQL_CALC_FOUND_ROWS * from t1 limit 2; -i -1 -2 -select FOUND_ROWS(); -FOUND_ROWS() -4 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 6 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -select * from t1 where i=1; -i -1 -select FOUND_ROWS(); -FOUND_ROWS() -1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 7 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -drop table t1; -# On node-2 -connection node_2; -flush query cache; -reset query cache; -# On node-1 -connection node_1; -flush query cache; -reset query cache; -create table t1 (a int not null) ENGINE=MYISAM; -insert into t1 values (1),(2),(3); -select * from t1; -a -1 -2 -3 -select * from t1; -a -1 -2 -3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 9 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 21 -insert delayed into t1 values (4); -select a from t1; -a -1 -2 -3 -4 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 9 -# On node-2 -connection node_2; -select * from t1; -a -select * from t1; -a -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 8 -insert delayed into t1 values (4); -select a from t1; -a -4 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 8 -drop table t1; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 8 -# On node-1 -connection node_1; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 9 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 22 -# On node-2 -connection node_2; -show global variables like "query_cache_min_res_unit"; -Variable_name Value -query_cache_min_res_unit 4096 -set GLOBAL query_cache_min_res_unit=1001; -Warnings: -Warning 1292 Truncated incorrect query_cache_min_res_unit value: '1001' -show global variables like "query_cache_min_res_unit"; -Variable_name Value -query_cache_min_res_unit 1000 -# On node-1 -connection node_1; -show global variables like "query_cache_min_res_unit"; -Variable_name Value -query_cache_min_res_unit 4096 -set GLOBAL query_cache_min_res_unit=1001; -Warnings: -Warning 1292 Truncated incorrect query_cache_min_res_unit value: '1001' -show global variables like "query_cache_min_res_unit"; -Variable_name Value -query_cache_min_res_unit 1000 -create table t1 (a int not null) engine=innodb; -insert into t1 values (1),(2),(3); -create table t2 (a int not null) engine=innodb; -insert into t2 values (1),(2),(3); -select * from t1; -a -1 -2 -3 -select * from t1; -a -1 -2 -3 -select * from t2; -a -1 -2 -3 -select * from t2; -a -1 -2 -3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 24 -# On node-2 -connection node_2; -select * from t1; -a -1 -2 -3 -select * from t1; -a -1 -2 -3 -select * from t2; -a -1 -2 -3 -select * from t2; -a -1 -2 -3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 10 -drop table t1; -select a from t2; -a -1 -2 -3 -select a from t2; -a -1 -2 -3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 18 -set GLOBAL query_cache_min_res_unit=default; -show global variables like "query_cache_min_res_unit"; -Variable_name Value -query_cache_min_res_unit 4096 -# On node-1 -connection node_1; -select a from t2; -a -1 -2 -3 -select a from t2; -a -1 -2 -3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 25 -drop table t2; -set GLOBAL query_cache_min_res_unit=default; -show global variables like "query_cache_min_res_unit"; -Variable_name Value -query_cache_min_res_unit 4096 -# On node-1 -connection node_1; -create table t1 (a int not null) engine=innodb; -insert into t1 values (1); -select "aaa" from t1; -aaa -aaa -select "AAA" from t1; -AAA -AAA -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 27 -# On node-2 -connection node_2; -select "aaa" from t1; -aaa -aaa -select "AAA" from t1; -AAA -AAA -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 20 -drop table t1; -# On node-1 -connection node_1; -create table t1 (a int) engine=innodb; -set GLOBAL query_cache_size=1000; -Warnings: -Warning 1292 Truncated incorrect query_cache_size value: '1000' -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 0 -select * from t1; -a -set GLOBAL query_cache_size=1024; -Warnings: -Warning 1282 Query cache failed to set size 1024; new query cache size is 0 -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 0 -select * from t1; -a -set GLOBAL query_cache_size=10240; -Warnings: -Warning 1282 Query cache failed to set size 10240; new query cache size is 0 -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 0 -select * from t1; -a -set GLOBAL query_cache_size=20480; -Warnings: -Warning 1282 Query cache failed to set size 20480; new query cache size is 0 -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 0 -select * from t1; -a -set GLOBAL query_cache_size=40960; -Warnings: -Warning 1282 Query cache failed to set size 40960; new query cache size is 0 -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 0 -select * from t1; -a -set GLOBAL query_cache_size=51200; -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 51200 -select * from t1; -a -set GLOBAL query_cache_size=61440; -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 61440 -select * from t1; -a -set GLOBAL query_cache_size=81920; -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 81920 -select * from t1; -a -set GLOBAL query_cache_size=102400; -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 102400 -select * from t1; -a -# On node-2 -connection node_2; -set GLOBAL query_cache_size=1000; -Warnings: -Warning 1292 Truncated incorrect query_cache_size value: '1000' -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 0 -select * from t1; -a -set GLOBAL query_cache_size=1024; -Warnings: -Warning 1282 Query cache failed to set size 1024; new query cache size is 0 -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 0 -select * from t1; -a -set GLOBAL query_cache_size=10240; -Warnings: -Warning 1282 Query cache failed to set size 10240; new query cache size is 0 -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 0 -select * from t1; -a -set GLOBAL query_cache_size=20480; -Warnings: -Warning 1282 Query cache failed to set size 20480; new query cache size is 0 -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 0 -select * from t1; -a -set GLOBAL query_cache_size=40960; -Warnings: -Warning 1282 Query cache failed to set size 40960; new query cache size is 0 -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 0 -select * from t1; -a -set GLOBAL query_cache_size=51200; -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 51200 -select * from t1; -a -set GLOBAL query_cache_size=61440; -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 61440 -select * from t1; -a -set GLOBAL query_cache_size=81920; -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 81920 -select * from t1; -a -set GLOBAL query_cache_size=102400; -show global variables like "query_cache_size"; -Variable_name Value -query_cache_size 102400 -select * from t1; -a -drop table t1; -# On node-1 -connection node_1; -set GLOBAL query_cache_size=1048576; -create table t1 (i int not null) engine=innodb; -create table t2 (i int not null) engine=innodb; -select * from t1; -i -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -create temporary table t3 (i int not null); -select * from t2; -i -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -select * from t3; -i -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -update t1 set i=(select distinct 1 from (select * from t2) a); -drop table t3; -# On node-2 -connection node_2; -set GLOBAL query_cache_size=1048576; -select * from t1; -i -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -select * from t2; -i -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -drop table t1, t2; -# On node-1 -connection node_1; -use mysql; -select * from db; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -use test; -select * from mysql.db; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -# On node-1 -connection node_1; -create table t1(id int auto_increment primary key) engine=innodb; -insert into t1 values (1), (2), (3); -select * from t1; -id -1 -2 -3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -# On node-2 -connection node_2; -select * from t1; -id -1 -2 -3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -# On node-1 -connection node_1; -alter table t1 rename to t2; -select * from t1; -ERROR 42S02: Table 'test.t1' doesn't exist -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -# On node-2 -connection node_2; -select * from t1; -ERROR 42S02: Table 'test.t1' doesn't exist -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -drop table t2; -# On node-1 -connection node_1; -create table t1 (word char(20) not null) engine=innodb; -select * from t1; -word -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -load data infile 'MYSQLTEST_VARDIR/std_data/words.dat' into table t1; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -# On node-2 -connection node_2; -select count(*) from t1; -count(*) -70 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -load data infile 'MYSQLTEST_VARDIR/std_data/words.dat' into table t1; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -select count(*) from t1; -count(*) -140 -drop table t1; -# -# INTO OUTFILE/DUMPFILE test -# -# On node-1 -connection node_1; -create table t1 (a int) engine=innodb; -insert into t1 values (1),(2),(3); -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -select * from t1 into outfile "query_cache.out.file"; -Warnings: -Warning 1287 ' INTO FROM...' instead -select * from t1 into outfile "query_cache.out.file"; -ERROR HY000: File 'query_cache.out.file' already exists -select * from t1 limit 1 into dumpfile "query_cache.dump.file"; -Warnings: -Warning 1287 ' INTO FROM...' instead -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 36 -drop table t1; -# -# Test of SQL_SELECT_LIMIT -# -# On node-1 -connection node_1; -create table t1 (a int) engine=innodb; -insert into t1 values (1),(2); -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -select * from t1; -a -1 -2 -SET SQL_SELECT_LIMIT=1; -select * from t1; -a -1 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 38 -SET SQL_SELECT_LIMIT=DEFAULT; -# On node-2 -connection node_2; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -select * from t1; -a -1 -2 -SET SQL_SELECT_LIMIT=1; -select * from t1; -a -1 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -SET SQL_SELECT_LIMIT=DEFAULT; -drop table t1; -# -# WRITE LOCK & QC -# -# On node-1 -connection node_1; -create table t1 (a int not null) engine=innodb; -create table t2 (a int not null) engine=innodb; -set query_cache_wlock_invalidate=1; -create view v1 as select * from t1; -select * from t1; -a -select * from t2; -a -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 40 -lock table t1 write, t2 read; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -unlock table; -select * from t1; -a -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -lock table v1 write; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 41 -unlock table; -drop view v1; -set query_cache_wlock_invalidate=default; -# On node-2 -connection node_2; -set query_cache_wlock_invalidate=1; -create view v1 as select * from t1; -select * from t1; -a -select * from t2; -a -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -lock table t1 write, t2 read; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -unlock table; -select * from t1; -a -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -lock table v1 write; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 35 -unlock table; -drop view v1; -set query_cache_wlock_invalidate=default; -drop table t1,t2; -# -# Hiding real table stored in query cache by temporary table -# -# On node-1 -connection node_1; -create table t1 (id int primary key) engine=innodb; -insert into t1 values (1),(2),(3); -select * from t1; -id -1 -2 -3 -create temporary table t1 (a int not null auto_increment primary key); -select * from t1; -a -drop table t1; -drop table t1; -# On node-1 -connection node_1; -SET NAMES koi8r; -CREATE TABLE t1 (a char(1) character set koi8r) engine=innodb; -INSERT INTO t1 VALUES (_koi8r 0xc3),(_koi8r 0xc3); -SELECT a,'Â','â'='Â' FROM t1; -a  'â'='Â' -�  0 -�  0 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 43 -set collation_connection=koi8r_bin; -SELECT a,'Â','â'='Â' FROM t1; -a  'â'='Â' -�  0 -�  0 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 44 -set character_set_client=cp1251; -SELECT a,'Â','â'='Â' FROM t1; -a �? '�?'='�?' -� �? 1 -� �? 1 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 45 -set character_set_results=cp1251; -SELECT a,'Â','â'='Â' FROM t1; -a �? 'â'='Â' -� �? 1 -� �? 1 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 4 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 46 -SET NAMES default; -# On node-2 -connection node_2; -# -# Run select -# -SELECT a,'Â','â'='Â' FROM t1; -a  'â'='Â' -?  0 -?  0 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -set collation_connection=koi8r_bin; -SELECT a,'Â','â'='Â' FROM t1; -a ?? 'â'='Â' -? ?? 1 -? ?? 1 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 2 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 37 -set character_set_client=cp1251; -SELECT a,'Â','â'='Â' FROM t1; -a ?? '??'='?�' -? ?? 1 -? ?? 1 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 38 -set character_set_results=cp1251; -SELECT a,'Â','â'='Â' FROM t1; -a �? 'â'='Â' -� �? 1 -� �? 1 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 4 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -show status like "Qcache_inserts"; -Variable_name Value -Qcache_inserts 39 -drop table t1; -# -# Comments before command -# -# On node-1 -connection node_1; -create table t1 (a int) engine=innodb; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -/**/ select * from t1; -a -/**/ select * from t1; -a -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 13 -# On node-2 -connection node_2; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 -/**/ select * from t1; -a -/**/ select * from t1; -a -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 -drop table t1; -# -# Information schema & query cache test -# -# On node-1 -connection node_1; -set session query_cache_type = 2; -create table t1(a int) engine=innodb; -select table_name from information_schema.tables -where table_schema="test"; -table_name -t1 -drop table t1; -select table_name from information_schema.tables -where table_schema="test"; -table_name -set session query_cache_type = 1; -set global query_cache_size=1024*1024; -flush query cache; -create table t1 ( a int ) engine=myisam; -insert into t1 values (1); -select a from t1; -a -1 -select a from t1; -a -1 -show status like 'qcache_queries_in_cache'; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 14 -repair table t1; -Table Op Msg_type Msg_text -test.t1 repair status OK -show status like 'qcache_queries_in_cache'; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 14 -# On node-2 -connection node_2; -select a from t1; -a -select a from t1; -a -show status like 'qcache_queries_in_cache'; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 13 -repair table t1; -Table Op Msg_type Msg_text -test.t1 repair status OK -show status like 'qcache_queries_in_cache'; -Variable_name Value -Qcache_queries_in_cache 0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 13 -drop table t1; -# Restore original settings. -# On node-1 -connection node_1; -SET GLOBAL query_cache_size=@query_cache_size_saved; -SET GLOBAL query_cache_type=@query_cache_type_saved; - -# On node-2 -connection node_2; -SET GLOBAL query_cache_size=@query_cache_size_saved; -SET GLOBAL query_cache_type=@query_cache_type_saved; -# End of test diff --git a/mysql-test/suite/galera/r/rename.result b/mysql-test/suite/galera/r/rename.result index 3ad715fa38c8c..c4a70a611597d 100644 --- a/mysql-test/suite/galera/r/rename.result +++ b/mysql-test/suite/galera/r/rename.result @@ -23,7 +23,7 @@ i 1 # Following RENAME should not replicate to other node. RENAME TABLE t1 TO t2; -ERROR 42000: DROP, ALTER command denied to user 'foo'@'localhost' for table 't1' +ERROR 42000: DROP, ALTER command denied to user 'foo'@'localhost' for table `test`.`t1` # On node 2 connection node_2; USE test; diff --git a/mysql-test/suite/galera/r/wsrep_mode_strict_replication.result b/mysql-test/suite/galera/r/wsrep_mode_strict_replication.result index 9b6a7cd044c2c..cf2ab0ee5da99 100644 --- a/mysql-test/suite/galera/r/wsrep_mode_strict_replication.result +++ b/mysql-test/suite/galera/r/wsrep_mode_strict_replication.result @@ -37,14 +37,14 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_2; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_1; TRUNCATE TABLE before_t1; ERROR HY000: Galera replication not supported @@ -86,7 +86,7 @@ before_t1 CREATE TABLE `before_t1` ( `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `b` (`b`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 connection node_2; SHOW CREATE TABLE before_t1; Table Create Table @@ -95,7 +95,7 @@ before_t1 CREATE TABLE `before_t1` ( `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `b` (`b`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 connection node_1; DROP INDEX b ON before_t1; ERROR HY000: Galera replication not supported @@ -106,7 +106,7 @@ before_t1 CREATE TABLE `before_t1` ( `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `b` (`b`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 connection node_2; SHOW CREATE TABLE before_t1; Table Create Table @@ -115,7 +115,7 @@ before_t1 CREATE TABLE `before_t1` ( `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `b` (`b`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 connection node_1; ALTER TABLE before_t1 ADD COLUMN f int; ERROR HY000: Galera replication not supported @@ -126,7 +126,7 @@ before_t1 CREATE TABLE `before_t1` ( `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `b` (`b`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 connection node_2; SHOW CREATE TABLE before_t1; Table Create Table @@ -135,7 +135,7 @@ before_t1 CREATE TABLE `before_t1` ( `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `b` (`b`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 connection node_1; RENAME TABLE before_t1 to after_t1; ERROR HY000: Galera replication not supported @@ -146,7 +146,7 @@ before_t1 CREATE TABLE `before_t1` ( `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `b` (`b`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 SHOW CREATE TABLE after_t1; ERROR 42S02: Table 'test.after_t1' doesn't exist connection node_2; @@ -157,7 +157,7 @@ before_t1 CREATE TABLE `before_t1` ( `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `b` (`b`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 SHOW CREATE TABLE after_t1; ERROR 42S02: Table 'test.after_t1' doesn't exist connection node_1; @@ -170,7 +170,7 @@ before_t1 CREATE TABLE `before_t1` ( `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `b` (`b`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 connection node_2; SHOW CREATE TABLE before_t1; Table Create Table @@ -179,7 +179,7 @@ before_t1 CREATE TABLE `before_t1` ( `count` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `b` (`b`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 connection node_1; set @@global.wsrep_mode=default; select @@global.wsrep_mode; diff --git a/mysql-test/suite/sys_vars/r/wsrep_slave_threads_basic.result b/mysql-test/suite/galera/r/wsrep_slave_threads_basic.result similarity index 97% rename from mysql-test/suite/sys_vars/r/wsrep_slave_threads_basic.result rename to mysql-test/suite/galera/r/wsrep_slave_threads_basic.result index 62be5a42416c1..edfb4747d9244 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_slave_threads_basic.result +++ b/mysql-test/suite/galera/r/wsrep_slave_threads_basic.result @@ -1,3 +1,5 @@ +connection node_2; +connection node_1; # # wsrep_slave_threads # diff --git a/mysql-test/suite/galera/t/GCF-1081.test b/mysql-test/suite/galera/t/GCF-1081.test deleted file mode 100644 index 38553feda3912..0000000000000 --- a/mysql-test/suite/galera/t/GCF-1081.test +++ /dev/null @@ -1,72 +0,0 @@ -# -# GCF-1081 - Assertion `!thd->sp_runtime_ctx` -# -# Test replaying of stored procedures -# - ---source include/galera_cluster.inc ---source include/have_innodb.inc ---source include/have_debug_sync.inc ---source include/galera_have_debug_sync.inc - ---connection node_1 - ---let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` - -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, 0), (3, 0); - -DELIMITER |; -CREATE PROCEDURE proc_update () -BEGIN - UPDATE t1 SET f2 = 1 where f1 > 0; -END| -DELIMITER ;| - -# Block the SP ---connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 ---let $galera_sync_point = commit_monitor_master_enter_sync ---source include/galera_set_sync_point.inc - ---connection node_1 ---send CALL proc_update (); - -# Wait until SP is blocked ---connection node_1a -SET SESSION wsrep_sync_wait = 0; ---source include/galera_wait_sync_point.inc - -# Issue a conflicting insert on node #2 ---connection node_1a -SET GLOBAL debug_dbug = 'd,sync.wsrep_before_BF_victim_unlock'; - ---connection node_2 ---send INSERT INTO t1 VALUES (2, 2); - -# Wait until it BF aborts the SP ---connection node_1a -SET SESSION DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_before_BF_victim_unlock_reached'; -SET GLOBAL debug_dbug = ''; - -# Unblock the SP ---connection node_1a ---source include/galera_clear_sync_point.inc ---source include/galera_signal_sync_point.inc - ---connection node_2 ---reap -SELECT * FROM t1; - -# SP succeeds ---connection node_1 ---reap -SELECT * FROM t1; - -# wsrep_local_replays has increased by 1 ---let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` ---disable_query_log ---eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old AS wsrep_local_replays; ---enable_query_log - -DROP PROCEDURE proc_update; -DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/MDEV-10715.test b/mysql-test/suite/galera/t/MDEV-10715.test index 186320589c378..20c5293f01bc4 100644 --- a/mysql-test/suite/galera/t/MDEV-10715.test +++ b/mysql-test/suite/galera/t/MDEV-10715.test @@ -17,3 +17,6 @@ select wsrep_last_written_gtid(); --connection node_1 drop table t1; + +--connection node_2 +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); \ No newline at end of file diff --git a/mysql-test/suite/galera/t/MDEV-18832.test b/mysql-test/suite/galera/t/MDEV-18832.test index e2f1b2afd4582..ba93761435a7f 100644 --- a/mysql-test/suite/galera/t/MDEV-18832.test +++ b/mysql-test/suite/galera/t/MDEV-18832.test @@ -13,3 +13,11 @@ CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1; INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1); DROP SEQUENCE Seq1_1; DROP TABLE t1; + +# Supress warning for SEQUENCES that are declared without `NOCACHE` introduced with MDEV-27862 + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); + +--connection node_2 + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); diff --git a/mysql-test/suite/galera/t/MDEV-20225.test b/mysql-test/suite/galera/t/MDEV-20225.test index 2124e4995308a..60ab1c53e4017 100644 --- a/mysql-test/suite/galera/t/MDEV-20225.test +++ b/mysql-test/suite/galera/t/MDEV-20225.test @@ -34,12 +34,16 @@ INSERT INTO t1 VALUES (NULL); # so there is no sync point or condition to wait. --sleep 1 ---connection node_2 +--let $galera_connection_name = node_2a +--let $galera_server_number = 2 +--source include/galera_connect.inc +--connection node_2a SET GLOBAL debug_dbug = 'RESET'; SET DEBUG_SYNC = 'now SIGNAL signal.mdev_20225_continue'; SET DEBUG_SYNC = 'RESET'; SET GLOBAL wsrep_slave_threads = 1; +--connection node_2 # Trigger should now be dropped on node_2. --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME like '%tr1' --source include/wait_condition.inc diff --git a/mysql-test/suite/galera/t/MDEV-25389.test b/mysql-test/suite/galera/t/MDEV-25389.test new file mode 100644 index 0000000000000..fc52337191839 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-25389.test @@ -0,0 +1,24 @@ +--source include/galera_cluster.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_2 +call mtr.add_suppression("WSREP: Failed to create/initialize system thread"); +SET GLOBAL debug_dbug='+d,wsrep_simulate_failed_connection_1'; +--error ER_WRONG_ARGUMENTS +SET GLOBAL wsrep_slave_threads=2; +SELECT @@wsrep_slave_threads; +SET GLOBAL debug_dbug=''; +SET GLOBAL wsrep_slave_threads=1; +SELECT @@wsrep_slave_threads; + +# MDEV-29878: this test caused a subsequent test to fail +# during shutdown. Do a restart here, to make sure the +# issue is fixed. +--source include/restart_mysqld.inc + +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/MDEV-25494.test b/mysql-test/suite/galera/t/MDEV-25494.test new file mode 100644 index 0000000000000..a6a7014546969 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-25494.test @@ -0,0 +1,7 @@ +--source include/galera_cluster.inc + +SET SESSION binlog_format=STATEMENT; +CREATE TEMPORARY TABLE t (i INT) UNION=(t); +ALTER TABLE t ADD extrac CHAR(1); +SHOW CREATE TABLE t; +DROP TABLE t; diff --git a/mysql-test/suite/galera/t/MDEV-26575.test b/mysql-test/suite/galera/t/MDEV-26575.test new file mode 100644 index 0000000000000..4554f632c6f08 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-26575.test @@ -0,0 +1,23 @@ +# +# MDEV-26575 Server crashes when execute shutdown statement after +# starting an XA transaction +# + +--source include/galera_cluster.inc + +--connection node_2 +call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*"); +--connection node_1 + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--connection node_2 +SET SESSION wsrep_on = OFF; +--error ER_NOT_SUPPORTED_YET +XA START 'xatest'; +--source include/restart_mysqld.inc + +--source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/MDEV-26597.test b/mysql-test/suite/galera/t/MDEV-26597.test new file mode 100644 index 0000000000000..783a52cad5031 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-26597.test @@ -0,0 +1,32 @@ +--source include/galera_cluster.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--connection node_2 +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 FLOAT(3,2)); +SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512'; +SET @@autocommit=0; +INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75); +--error ER_UNKNOWN_ERROR +CREATE TABLE t1 ( pk int primary key) ENGINE=INNODB; +SHOW WARNINGS; + +--connection node_2 +SET SESSION wsrep_sync_wait = 0; +--source include/kill_galera.inc + +--let $start_mysqld_params = "" +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--source include/start_mysqld.inc + +# +# Cleanup +# +--source ../../galera/include/auto_increment_offset_restore.inc +--connection node_1 +DROP TABLE t3; + + diff --git a/mysql-test/suite/galera/t/MDEV-27123.opt b/mysql-test/suite/galera/t/MDEV-27123.opt new file mode 100644 index 0000000000000..1c4accb816a78 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-27123.opt @@ -0,0 +1,2 @@ +--wsrep_auto_increment_control=OFF --auto_increment_increment=3 --auto_increment_offset=3 + diff --git a/mysql-test/suite/galera/t/MDEV-27123.test b/mysql-test/suite/galera/t/MDEV-27123.test new file mode 100644 index 0000000000000..c2b682d6dedb1 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-27123.test @@ -0,0 +1,8 @@ +--source include/galera_cluster.inc + +show variables like 'auto_increment%'; +create table t4 (c1 int primary key auto_increment) engine=innodb; +show variables like 'auto_increment%'; +alter table t4 add (c2 varchar(50)); +show variables like 'auto_increment%'; +DROP TABLE t4; diff --git a/mysql-test/suite/galera/t/MDEV-27713.test b/mysql-test/suite/galera/t/MDEV-27713.test new file mode 100644 index 0000000000000..4bfcd7e3d50d2 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-27713.test @@ -0,0 +1,67 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/big_test.inc + +CREATE TABLE t1 ( + f1 INT, + f2 VARCHAR(255) PRIMARY KEY +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO t1 VALUES(1, 'abc'); + +--connection node_1 +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (2,'def'); + +--connection node_2 + +SET GLOBAL event_scheduler=ON; + +DELIMITER |; +CREATE PROCEDURE update_table() +BEGIN + SET AUTOCOMMIT=OFF; + DO GET_LOCK('local_lock', 0); + SET DEBUG_SYNC = 'innodb_row_update_for_mysql_begin SIGNAL blocked WAIT_FOR continue'; + UPDATE t1 SET f2 = 'jkl' WHERE f1 != 2; + DO RELEASE_LOCK('local_lock'); +END| +DELIMITER ;| + +CREATE DEFINER=current_user + EVENT event + ON SCHEDULE AT CURRENT_TIMESTAMP + ON COMPLETION PRESERVE + ENABLE + DO CALL update_table(); + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +SET DEBUG_SYNC = 'now WAIT_FOR blocked'; + +# Applier control thread +--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2 +SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb"; + +--connection node_1 +COMMIT; + +# Applier control thread +--connection node_2b +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; + +--connection node_2a +SET DEBUG_SYNC = 'now SIGNAL continue'; + +--connection node_2 +SET GLOBAL event_scheduler=default; +DROP PROCEDURE update_table; +DROP EVENT event; +SET DEBUG_SYNC='reset'; +SET GLOBAL debug_dbug = DEFAULT; + +--connection node_1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/MDEV-27862.combinations b/mysql-test/suite/galera/t/MDEV-27862.combinations new file mode 100644 index 0000000000000..1eeb8fb4614e9 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-27862.combinations @@ -0,0 +1,4 @@ +[binlogoff] + +[binlogon] +log-bin diff --git a/mysql-test/suite/galera/t/MDEV-27862.test b/mysql-test/suite/galera/t/MDEV-27862.test new file mode 100644 index 0000000000000..89d3465b91f50 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-27862.test @@ -0,0 +1,67 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# Report WARNING when SEQUENCE is created without `NOCACHE` + +CREATE SEQUENCE seq_nocache ENGINE=InnoDB; +DROP SEQUENCE seq_nocache; + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); + +--connection node_2 + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); + +# NEXTVAL + +--connection node_1 + +CREATE SEQUENCE seq NOCACHE ENGINE=InnoDB; + +SELECT NEXTVAL(seq) = 1; + +--connection node_2 + +SELECT NEXTVAL(seq) = 2; + +--connection node_1 + +SELECT NEXTVAL(seq) = 3; + + +# SETVAL + +SELECT SETVAL(seq, 100); + +--connection node_2 + +SELECT NEXTVAL(seq) = 101; + +--connection node_1 + +SELECT NEXTVAL(seq) = 102; + +DROP SEQUENCE seq; + +# TRANSACTIONS + +CREATE TABLE t1(f1 INT); +CREATE SEQUENCE seq_transaction NOCACHE ENGINE=InnoDB; + +START TRANSACTION; +INSERT INTO t1 VALUES (0); +SELECT NEXTVAL(seq_transaction); +INSERT INTO t1 VALUES (NEXTVAL(seq_transaction)); +COMMIT; + +--connection node_2 + +SELECT COUNT(*) = 2 FROM t1; +SELECT NEXTVAL(seq_transaction) = 3; + +--connection node_1 +SELECT NEXTVAL(seq_transaction) = 4; + +DROP SEQUENCE seq_transaction; +DROP TABLE t1; + diff --git a/mysql-test/suite/galera/t/MDEV-28053.cnf b/mysql-test/suite/galera/t/MDEV-28053.cnf new file mode 100644 index 0000000000000..2a500639d1d83 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-28053.cnf @@ -0,0 +1,6 @@ +!include ../galera_2nodes_as_slave.cnf + +[mysqld] +slave_parallel_threads=4 +slave_parallel_mode=optimistic +gtid_strict_mode=1 diff --git a/mysql-test/suite/galera/t/MDEV-28053.test b/mysql-test/suite/galera/t/MDEV-28053.test new file mode 100644 index 0000000000000..85cb20c7e10c7 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-28053.test @@ -0,0 +1,61 @@ +# +# MDEV-28053 - Sysbench data load crashes Galera secondary node in +# async master slave setup +# +# Setup: node 3 is a regular MariaDB server, nodes 1 and 2 are members +# of a Galera cluster. Node 2 connects to node 3 through async replication. +# +# Test uses multiple parallel async applier threads (see MDEV-28053.cnf) +# + +--source include/have_innodb.inc +--source include/galera_cluster.inc + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +--connection node_3 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; + +# +# Execute a few INSERTs, to simulate sysbench data load phase +# +--let $counter=100 +--disable_query_log +while ($counter) { + --connection node_3 + INSERT INTO t1 VALUES(); + --dec $counter +} +--enable_query_log +--let gtid = `SELECT @@last_gtid` + +# +# Start async replication on node 2. +# If bug is present, expect a crash when applying +# events concurrently. +# +--connection node_2 +--disable_query_log +--disable_result_log +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3; +START SLAVE; +--eval SELECT MASTER_GTID_WAIT('$gtid', 600) +--enable_result_log +--enable_query_log + +# +# Cleanup +# +--connection node_3 +DROP TABLE t1; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +--connection node_2 +STOP SLAVE; +RESET SLAVE ALL; + +--connection node_3 +RESET MASTER; diff --git a/mysql-test/suite/galera/t/MDEV-29142.test b/mysql-test/suite/galera/t/MDEV-29142.test new file mode 100644 index 0000000000000..7e9776b005b24 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-29142.test @@ -0,0 +1,73 @@ +--source include/galera_cluster.inc +--source include/have_sequence.inc +--source include/force_restart.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--connection node_1 +call mtr.add_suppression("WSREP: Event .* Write_rows_v1 apply failed:.*"); +call mtr.add_suppression("WSREP: Failed to apply write set:.*"); +call mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on.*"); + +--connection node_2 +call mtr.add_suppression("WSREP: Failed to open table mysql.wsrep_streaming_log for writing"); +call mtr.add_suppression("WSREP: Failed to open SR table for write"); +call mtr.add_suppression("WSREP: Failed to recover SR transactions from schema: wsrep_on : 0"); +call mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on.*"); + +SET @@global.tx_read_only = ON; +--error 0,1286 +SET default_storage_engine = SEQUENCE; +--error 1005 +create table t1 (c1 int); +CREATE TABLE t1(c1 VARCHAR(20)) engine=innodb; +INSERT INTO t1 VALUES(0xA9B8); +--error 1050 +create TABLE t1 (c1 int) engine=innodb; +--error 1050 +create TABLE t1 (c1 int) engine=innodb; +--let $wsrep_cluster_address_saved = `SELECT @@global.wsrep_cluster_address` +SET GLOBAL wsrep_on=OFF; +SET GLOBAL wsrep_cluster_address='gcomm://'; +INSERT INTO t1 VALUES (1); +SELECT 1; +SELECT 1; +COMMIT; + +# +# Kill the entire cluster and restart +# +--echo # Killing cluster because we have messed with wsrep_cluster_address +--connection node_2 +SET SESSION wsrep_sync_wait = 0; +--source include/kill_galera.inc + +--connection node_1 +SET SESSION wsrep_sync_wait = 0; +--source include/kill_galera.inc + +--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat +--let $start_mysqld_params = "--wsrep-new-cluster" +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--source include/start_mysqld.inc + +--connection node_2 +--let $start_mysqld_params = "" +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--source include/start_mysqld.inc + +call mtr.add_suppression("WSREP: Failed to open table mysql.wsrep_streaming_log for writing"); +call mtr.add_suppression("WSREP: Failed to open SR table for write"); +call mtr.add_suppression("WSREP: Failed to recover SR transactions from schema: wsrep_on : 0"); + +# +# Cleanup +# +--source ../../galera/include/auto_increment_offset_restore.inc +# We killed cluster, it might mean that table does not exists +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings diff --git a/mysql-test/suite/galera/t/MDEV-29512.cnf b/mysql-test/suite/galera/t/MDEV-29512.cnf new file mode 100644 index 0000000000000..bf8e0c379841e --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-29512.cnf @@ -0,0 +1,15 @@ +!include ../galera_2nodes.cnf + +[mysqld] +log-bin +log-slave-updates + +[mysqld.1] +log_bin +log_slave_updates +max-binlog-size=4096 +expire-logs-days=1 + + +[mysqld.2] + diff --git a/mysql-test/suite/galera/t/MDEV-29512.test b/mysql-test/suite/galera/t/MDEV-29512.test new file mode 100644 index 0000000000000..ffcef792f8541 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-29512.test @@ -0,0 +1,91 @@ +# +# This test is for reproducing the issue in: +# https://jira.mariadb.org/browse/MDEV-29512 +# +# The hanging in MDEV-29512 happens when binlog purging is attempted, and there is +# one local BF aborted transaction waiting for commit monitor. +# +# The test will launch two node cluster and enable binlogging with expire log days, +# to force binlog purging to happen. +# A local transaction is executed so that will become BF abort victim, and has advanced +# to replication stage waiting for commit monitor for final cleanup (to mark position in innodb) +# after that, applier is released to complete the BF abort and due to binlog configuration, +# starting the binlog purging. This is where the hanging would occur, if code is buggy +# +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/galera_have_debug_sync.inc + +# +# binlog size is limited to 4096 bytes, we will create enough events to +# cause binlog rotation +# +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 int, f3 varchar(2000)); +INSERT INTO t1 VALUES (1, 0, REPEAT('1234567890', 200)); +INSERT INTO t1 VALUES (3, 3, REPEAT('1234567890', 200)); + +SET SESSION wsrep_sync_wait=0; + +# set sync point for replication applier +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; + +# Control connection to manage sync points for appliers +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION wsrep_sync_wait=0; + +# starting local transaction, only select so far, +# write will happen later and this will be ordered after the transaction in node_2 +--connection node_1 +begin; +select f1,f2 from t1; + +# send from node 2 an UPDATE transaction, which will BF abort the transaction in node_1 +--connection node_2 +--let $wait_condition=select count(*)=2 from t1 +--source include/wait_condition.inc + +UPDATE t1 SET f2=2 WHERE f1=3; + +--connection node_1a +# wait to see the UPDATE from node_2 in apply_cb sync point +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; + +--connection node_1 +# now issuing conflicting update +UPDATE t1 SET f2=1 WHERE f1=3; + +# Block the local commit, send final COMMIT and wait until it gets blocked +--let $galera_sync_point = commit_monitor_master_enter_sync +--source include/galera_set_sync_point.inc +--send COMMIT + +--connection node_1a +# wait for the local commit to enter in commit monitor wait state +--let $galera_sync_point = commit_monitor_master_enter_sync +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc + +# release the local transaction to continue with commit +--let $galera_sync_point = commit_monitor_master_enter_sync +--source include/galera_signal_sync_point.inc + +# and now release the applier, it should force local trx to abort +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +SET GLOBAL debug_dbug = NULL; +SET debug_sync='RESET'; + +--connection node_1 +--error ER_LOCK_DEADLOCK +--reap + +# wait until applying is complete +--let $wait_condition = SELECT COUNT(*)=1 FROM t1 WHERE f2=2 +--source include/wait_condition.inc + +# final read to verify what we got +select f1,f2 from t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/MDEV-30804.cnf b/mysql-test/suite/galera/t/MDEV-30804.cnf new file mode 100644 index 0000000000000..9dbd81f758d0d --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-30804.cnf @@ -0,0 +1,7 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +log-bin + +[mysqld.2] +log-bin diff --git a/mysql-test/suite/galera/t/MDEV-30804.test b/mysql-test/suite/galera/t/MDEV-30804.test new file mode 100644 index 0000000000000..561953a0578a2 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-30804.test @@ -0,0 +1,21 @@ +# +# Test that transaction requiring two-phase commit and involving +# storage engines not supporting it rolls back with a message. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_aria.inc + +CREATE TABLE t (a INT) ENGINE=Aria; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; + +START TRANSACTION; +INSERT INTO t VALUES ('1'); +INSERT INTO t1 VALUES ('1'); + +--error ER_ERROR_DURING_COMMIT +COMMIT; + +DROP TABLE t; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/MDEV-30955.test b/mysql-test/suite/galera/t/MDEV-30955.test new file mode 100644 index 0000000000000..18577120e8354 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-30955.test @@ -0,0 +1,70 @@ +# +# MDEV-30955 +# Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, +# table->s->db.str, table->s->table_name.str, MDL_SHARED)' +# failed in close_thread_table() +# + +--source include/galera_cluster.inc + +# +# Test 1: Assertion thd->mdl_context.is_lock_owner() +# failed in close_thread_table() +# +CREATE TABLE t (a CHAR(1) KEY); +START TRANSACTION; +HANDLER t OPEN; + +# +# If bug is present the transaction will be aborted +# through Wsrep_client_service::bf_rollback() and +# release explicit locks too early. Later, during +# THD::cleanup(), table t will be closed and the +# THD is expected to be owner of the MDL lock that +# was just released. +# +--disconnect node_1 + +--connect node_1, 127.0.0.1, root, , test, $NODE_MYPORT_1 +DROP TABLE t; + + +# +# Test 2: Similar issue reproduces also with BACKUP STAGE locks. +# See comments in MDEV-25037 +# + +BACKUP STAGE START; +START TRANSACTION; +--disconnect node_1 +--connect node_1, 127.0.0.1, root, , test, $NODE_MYPORT_1 + + +# +# Test 3: Assertion `!thd->mdl_context.has_locks()' failed +# in do_command() +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY); + +--let $bf_count = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.global_status WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` + +START TRANSACTION; +INSERT INTO t1 VALUES(1); +HANDLER t2 OPEN; + +--connection node_2 +INSERT INTO t1 VALUES(1); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +--let $wait_condition = SELECT VARIABLE_VALUE = $bf_count + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts' +--source include/wait_condition.inc + +--connection node_1 +--error ER_LOCK_DEADLOCK +COMMIT; + +DROP TABLE t1,t2; diff --git a/mysql-test/suite/galera/t/MW-44.test b/mysql-test/suite/galera/t/MW-44.test index a2acfc57f6c36..7b479d4584436 100644 --- a/mysql-test/suite/galera/t/MW-44.test +++ b/mysql-test/suite/galera/t/MW-44.test @@ -19,7 +19,11 @@ SET SESSION wsrep_osu_method=RSU; ALTER TABLE t1 ADD COLUMN f2 INTEGER; SET SESSION wsrep_osu_method=TOI; ---let $wait_condition = SELECT COUNT(*) = 2 FROM mysql.general_log WHERE argument LIKE "CREATE%" OR argument LIKE "ALTER%" +--let $wait_condition = SELECT COUNT(*) = 1 FROM mysql.general_log WHERE argument LIKE "CREATE%" AND command_type != 'Prepare' +--let $wait_condition_on_error_output = SELECT * FROM mysql.general_log +--source include/wait_condition_with_debug.inc + +--let $wait_condition = SELECT COUNT(*) = 1 FROM mysql.general_log WHERE argument LIKE "ALTER%" AND command_type != 'Prepare' --let $wait_condition_on_error_output = SELECT * FROM mysql.general_log --source include/wait_condition_with_debug.inc diff --git a/mysql-test/suite/galera/t/galera-features#117.test b/mysql-test/suite/galera/t/galera-features#117.test index 0436b201a09f7..30301996d1c2f 100644 --- a/mysql-test/suite/galera/t/galera-features#117.test +++ b/mysql-test/suite/galera/t/galera-features#117.test @@ -4,6 +4,11 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source ../galera/include/auto_increment_offset_save.inc + --connection node_2 SET SESSION wsrep_on=OFF; CREATE TABLE test.t1 (f2 INTEGER); @@ -36,3 +41,7 @@ SHOW TABLES IN test; CALL mtr.add_suppression("Inconsistent by consensus."); CALL mtr.add_suppression("WSREP: Failed to execute TOI action"); CALL mtr.add_suppression("WSREP: TO isolation end failed"); + +--connection node_1 +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_FK_duplicate_client_insert.test b/mysql-test/suite/galera/t/galera_FK_duplicate_client_insert.test index 02322fc02ec92..6dd1fee1d4e80 100644 --- a/mysql-test/suite/galera/t/galera_FK_duplicate_client_insert.test +++ b/mysql-test/suite/galera/t/galera_FK_duplicate_client_insert.test @@ -72,7 +72,7 @@ while($counter > 0) update user set j = j + 1 WHERE id > 0; --connection node_1_i - set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; + set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; send insert into user_session(id,fk1,fk2) values (2, 2, 2); --connection node_1 @@ -126,7 +126,7 @@ while($counter > 0) #update user set j = j + 1 WHERE id > 0; --connection node_1_i - set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; + set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; send execute ins1; --connection node_1 diff --git a/mysql-test/suite/galera/t/galera_MDEV-29512.cnf b/mysql-test/suite/galera/t/galera_MDEV-29512.cnf new file mode 100644 index 0000000000000..bf8e0c379841e --- /dev/null +++ b/mysql-test/suite/galera/t/galera_MDEV-29512.cnf @@ -0,0 +1,15 @@ +!include ../galera_2nodes.cnf + +[mysqld] +log-bin +log-slave-updates + +[mysqld.1] +log_bin +log_slave_updates +max-binlog-size=4096 +expire-logs-days=1 + + +[mysqld.2] + diff --git a/mysql-test/suite/galera/t/galera_MDEV-29512.test b/mysql-test/suite/galera/t/galera_MDEV-29512.test new file mode 100644 index 0000000000000..ffcef792f8541 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_MDEV-29512.test @@ -0,0 +1,91 @@ +# +# This test is for reproducing the issue in: +# https://jira.mariadb.org/browse/MDEV-29512 +# +# The hanging in MDEV-29512 happens when binlog purging is attempted, and there is +# one local BF aborted transaction waiting for commit monitor. +# +# The test will launch two node cluster and enable binlogging with expire log days, +# to force binlog purging to happen. +# A local transaction is executed so that will become BF abort victim, and has advanced +# to replication stage waiting for commit monitor for final cleanup (to mark position in innodb) +# after that, applier is released to complete the BF abort and due to binlog configuration, +# starting the binlog purging. This is where the hanging would occur, if code is buggy +# +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/galera_have_debug_sync.inc + +# +# binlog size is limited to 4096 bytes, we will create enough events to +# cause binlog rotation +# +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 int, f3 varchar(2000)); +INSERT INTO t1 VALUES (1, 0, REPEAT('1234567890', 200)); +INSERT INTO t1 VALUES (3, 3, REPEAT('1234567890', 200)); + +SET SESSION wsrep_sync_wait=0; + +# set sync point for replication applier +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; + +# Control connection to manage sync points for appliers +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION wsrep_sync_wait=0; + +# starting local transaction, only select so far, +# write will happen later and this will be ordered after the transaction in node_2 +--connection node_1 +begin; +select f1,f2 from t1; + +# send from node 2 an UPDATE transaction, which will BF abort the transaction in node_1 +--connection node_2 +--let $wait_condition=select count(*)=2 from t1 +--source include/wait_condition.inc + +UPDATE t1 SET f2=2 WHERE f1=3; + +--connection node_1a +# wait to see the UPDATE from node_2 in apply_cb sync point +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; + +--connection node_1 +# now issuing conflicting update +UPDATE t1 SET f2=1 WHERE f1=3; + +# Block the local commit, send final COMMIT and wait until it gets blocked +--let $galera_sync_point = commit_monitor_master_enter_sync +--source include/galera_set_sync_point.inc +--send COMMIT + +--connection node_1a +# wait for the local commit to enter in commit monitor wait state +--let $galera_sync_point = commit_monitor_master_enter_sync +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc + +# release the local transaction to continue with commit +--let $galera_sync_point = commit_monitor_master_enter_sync +--source include/galera_signal_sync_point.inc + +# and now release the applier, it should force local trx to abort +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +SET GLOBAL debug_dbug = NULL; +SET debug_sync='RESET'; + +--connection node_1 +--error ER_LOCK_DEADLOCK +--reap + +# wait until applying is complete +--let $wait_condition = SELECT COUNT(*)=1 FROM t1 WHERE f2=2 +--source include/wait_condition.inc + +# final read to verify what we got +select f1,f2 from t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_UK_conflict.test b/mysql-test/suite/galera/t/galera_UK_conflict.test index fb4cdb416c3ba..7a14821cc32e6 100644 --- a/mysql-test/suite/galera/t/galera_UK_conflict.test +++ b/mysql-test/suite/galera/t/galera_UK_conflict.test @@ -140,6 +140,14 @@ SELECT * FROM t1; # original state in node 1 INSERT INTO t1 VALUES (7,7,7); INSERT INTO t1 VALUES (8,8,8); +SELECT COUNT(*) FROM t1; +SELECT * FROM t1; + +--connection node_1 +--let $wait_condition = SELECT COUNT(*) = 7 FROM t1 +--source include/wait_condition.inc +SELECT COUNT(*) FROM t1; +SELECT * FROM t1; DROP TABLE t1; @@ -268,7 +276,6 @@ SET debug_sync='RESET'; SET GLOBAL wsrep_slave_threads = DEFAULT; --connection node_2 -SET SESSION wsrep_sync_wait=15; SELECT * FROM t1; # replicate some transactions, so that wsrep slave thread count can reach @@ -276,4 +283,13 @@ SELECT * FROM t1; INSERT INTO t1 VALUES (7,7,7); INSERT INTO t1 VALUES (8,8,8); +SELECT COUNT(*) FROM t1; +SELECT * FROM t1; + +--connection node_1 +--let $wait_condition = SELECT COUNT(*) = 7 FROM t1 +--source include/wait_condition.inc +SELECT COUNT(*) FROM t1; +SELECT * FROM t1; + DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_as_slave.test b/mysql-test/suite/galera/t/galera_as_slave.test index da92437b1182d..859fe19c9bb3b 100644 --- a/mysql-test/suite/galera/t/galera_as_slave.test +++ b/mysql-test/suite/galera/t/galera_as_slave.test @@ -37,9 +37,25 @@ INSERT INTO t1 VALUES (3); --connection node_2 SELECT COUNT(*) = 3 FROM t1; +--connection node_3 +SET @@session.binlog_alter_two_phase = 1; +ALTER TABLE t1 ADD COLUMN f2 INT; +INSERT INTO t1 VALUES (4,1); + +--connection node_1 +--let $count = 4 +--let $table = t1 +--source include/wait_until_rows_count.inc + +--connection node_2 +--let $count = 4 +--let $table = t1 +--source include/wait_until_rows_count.inc + --connection node_3 DROP TABLE t1; + --connection node_2 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; --source include/wait_condition.inc diff --git a/mysql-test/suite/galera/t/galera_as_slave_autoinc.test b/mysql-test/suite/galera/t/galera_as_slave_autoinc.test index e0c8bf2968283..ce4c87e2beea1 100644 --- a/mysql-test/suite/galera/t/galera_as_slave_autoinc.test +++ b/mysql-test/suite/galera/t/galera_as_slave_autoinc.test @@ -68,9 +68,11 @@ select * from t1; show variables like 'binlog_format'; show variables like 'auto_increment_increment'; +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format"); --connection node_3 DROP TABLE t1; +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format"); --connection node_2 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; diff --git a/mysql-test/suite/galera/t/galera_backup_start.test b/mysql-test/suite/galera/t/galera_backup_start.test new file mode 100644 index 0000000000000..4489e9ff582ce --- /dev/null +++ b/mysql-test/suite/galera/t/galera_backup_start.test @@ -0,0 +1,6 @@ +--source include/galera_cluster.inc + +BACKUP STAGE START; +START TRANSACTION; +COMMIT; +BACKUP STAGE END; diff --git a/mysql-test/suite/galera/t/galera_bf_abort_at_after_statement.test b/mysql-test/suite/galera/t/galera_bf_abort_at_after_statement.test index 738aedbda9e08..224db90256933 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_at_after_statement.test +++ b/mysql-test/suite/galera/t/galera_bf_abort_at_after_statement.test @@ -34,6 +34,11 @@ SET DEBUG_SYNC = 'now WAIT_FOR blocked'; # cause BF abort on other node UPDATE t1 SET val=3 WHERE id=1; +--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2 +set session wsrep_sync_wait=0; +--let $wait_condition = SELECT COUNT(*) = 1 FROM t1 where id = 1 and val = 3 +--source include/wait_condition.inc + --connection node_2a SET DEBUG_SYNC = 'now SIGNAL continue'; @@ -47,3 +52,7 @@ SET DEBUG_SYNC = 'RESET'; --connection node_1 SET DEBUG_SYNC = 'RESET'; DROP TABLE t1; + +--disconnect node_2a +--disconnect node_2b + diff --git a/mysql-test/suite/galera/t/galera_bf_abort_get_lock.test b/mysql-test/suite/galera/t/galera_bf_abort_get_lock.test deleted file mode 100644 index 72fc1c5b583bb..0000000000000 --- a/mysql-test/suite/galera/t/galera_bf_abort_get_lock.test +++ /dev/null @@ -1,36 +0,0 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc - -# -# Test a local transaction being aborted by a slave one while it is running a GET_LOCK() -# - -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; - ---let $galera_connection_name = node_2a ---let $galera_server_number = 2 ---source include/galera_connect.inc ---connection node_2a -SELECT GET_LOCK("foo", 1000); - ---connection node_2 -SET AUTOCOMMIT=OFF; ---let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` -INSERT INTO t1 VALUES (1); ---send SELECT GET_LOCK("foo", 1000); - ---connection node_1 -INSERT INTO t1 VALUES (1); - ---connection node_2 ---error ER_LOCK_DEADLOCK ---reap - ---let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` - -# Check that wsrep_local_bf_aborts has been incremented by exactly 1 ---disable_query_log ---eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment; ---enable_query_log - -DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_bf_abort_ps_bind.cnf b/mysql-test/suite/galera/t/galera_bf_abort_ps_bind.cnf new file mode 100644 index 0000000000000..62cf185403249 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_bf_abort_ps_bind.cnf @@ -0,0 +1,7 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep-debug=1 + +[mysqld.2] +wsrep-debug=1 diff --git a/mysql-test/suite/galera/t/galera_bf_abort_ps_bind.test b/mysql-test/suite/galera/t/galera_bf_abort_ps_bind.test new file mode 100644 index 0000000000000..dcfcb052d49d6 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_bf_abort_ps_bind.test @@ -0,0 +1,61 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/no_protocol.inc + +CREATE TABLE t (i int primary key auto_increment, j varchar(20) character set utf8); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION wsrep_sync_wait = 0; + +--connection node_1 +insert into t values (1, 'first'); + +# prepare a statement for inserting rows into table t +--PS_prepare INSERT INTO t(j) VALUES (?); + +# bind parameter, to insert with column j having value 'node1' +--PS_bind node1 + +# insert two rows with the PS +# this is for showing that two execute commands can follow a bind command +--PS_execute +--PS_execute +select * from t; + +# close the prepared statement, and prepare a new PS, +# this happens to be same as the first PS +# also bind parameter for the PS +--PS_close +--PS_prepare INSERT INTO t(j) VALUES (?); +--PS_bind node1 + +# start a transaction and make one update +# leaving the transaction open +begin; +update t set j='node1' where i=1; + +# replicate a transaction from node2, which BF aborts the open +# transaction in node1 +--connection node_2 +update t set j='node2' where i=1; + +# wait until the BF has completed, and update from node_2 has committed +--connection node_1a +--let $wait_condition = SELECT COUNT(*) = 1 FROM t WHERE j='node2' +--source include/wait_condition.inc + +# continue the open transaction, trying to insert third row, deadlock is now observed +--connection node_1 +--error ER_LOCK_DEADLOCK +--PS_execute + +# try to insert one more row +--PS_execute +commit; + +--PS_close + +select * from t; + +drop table t; diff --git a/mysql-test/suite/galera/t/galera_bf_abort_shutdown.test b/mysql-test/suite/galera/t/galera_bf_abort_shutdown.test index c7af8375b3f9a..6eb1cd9f4b2a4 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_shutdown.test +++ b/mysql-test/suite/galera/t/galera_bf_abort_shutdown.test @@ -18,16 +18,27 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY); --connection node_2 +call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*"); SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR continue'; --send INSERT INTO t1 VALUES (1) --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 ---source include/restart_mysqld.inc +--source include/shutdown_mysqld.inc + +# On node_1, verify that the node has left the cluster. +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_2a +--source include/start_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc # Restore original auto_increment_offset values. --let $node_2=node_2a --source include/auto_increment_offset_restore.inc ---connection node_1 - DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.cnf b/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.cnf index 889c81b4a0a54..91e9199b092df 100644 --- a/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.cnf +++ b/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.cnf @@ -2,6 +2,8 @@ [mysqld.1] auto_increment_offset=1 +auto_increment_increment=1 [mysqld.2] auto_increment_offset=2 +auto_increment_increment=1 diff --git a/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test b/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test index 817f4f82b43c3..994f7695fc631 100644 --- a/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test +++ b/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test @@ -3,7 +3,12 @@ ## --source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/force_restart.inc + +--connection node_1 +SET GLOBAL auto_increment_offset=1; +--connection node_2 +SET GLOBAL auto_increment_offset=2; --let $node_1=node_1 --let $node_2=node_2 @@ -18,27 +23,36 @@ --connection node_2 SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; +--disable_query_log +call mtr.add_suppression("Unsafe statement written to the binary log"); +--enable_query_log + --connection node_1 SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; +--disable_query_log +call mtr.add_suppression("Unsafe statement written to the binary log"); +--enable_query_log + CREATE TABLE t1 ( - i int(11) NOT NULL AUTO_INCREMENT, - c char(32) DEFAULT 'dummy_text', - PRIMARY KEY (i) + i int(11) NOT NULL primary key AUTO_INCREMENT, + c char(32) DEFAULT 'dummy_text' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +show variables like 'auto_increment%'; insert into t1(i) values(null); -select * from t1; +select * from t1 order by i; insert into t1(i) values(null), (null), (null); -select * from t1; +select * from t1 order by i; --connection node_2 --let $wait_condition = SELECT COUNT(*) = 4 FROM t1; --source include/wait_condition.inc -select * from t1; +show variables like 'auto_increment%'; +select * from t1 order by i; SET GLOBAL wsrep_forced_binlog_format='none'; @@ -72,36 +86,31 @@ SET SESSION auto_increment_increment = 3; SET SESSION auto_increment_offset = 1; CREATE TABLE t1 ( - i int(11) NOT NULL AUTO_INCREMENT, - c char(32) DEFAULT 'dummy_text', - PRIMARY KEY (i) + i int(11) NOT NULL primary key AUTO_INCREMENT, + c char(32) DEFAULT 'dummy_text' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +show variables like 'auto_increment%'; insert into t1(i) values(null); -select * from t1; +select * from t1 order by i; insert into t1(i) values(null), (null), (null); -select * from t1; +select * from t1 order by i; --connection node_2 --let $wait_condition = SELECT COUNT(*) = 4 FROM t1; --source include/wait_condition.inc +show variables like 'auto_increment%'; -select * from t1; +select * from t1 order by i; --connection node_1 - -## -## Verify the return to automatic calculation of the step -## and offset of the auto-increment: -## - SET GLOBAL wsrep_auto_increment_control='ON'; - SET SESSION binlog_format='ROW'; - +--source include/auto_increment_offset_restore.inc +--connection node_1 show variables like 'binlog_format'; show variables like '%auto_increment%'; @@ -119,7 +128,8 @@ show variables like '%auto_increment%'; ## SET GLOBAL wsrep_auto_increment_control='ON'; - +--source include/auto_increment_offset_restore.inc +--connection node_1 drop table t1; ## @@ -134,24 +144,25 @@ SET GLOBAL wsrep_forced_binlog_format='ROW'; SET GLOBAL wsrep_forced_binlog_format='ROW'; CREATE TABLE t1 ( - i int(11) NOT NULL AUTO_INCREMENT, - c char(32) DEFAULT 'dummy_text', - PRIMARY KEY (i) + i int(11) NOT NULL primary key AUTO_INCREMENT, + c char(32) DEFAULT 'dummy_text' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +show variables like 'auto_increment%'; insert into t1(i) values(null); -select * from t1; +select * from t1 order by i; insert into t1(i) values(null), (null), (null); -select * from t1; +select * from t1 order by i; --connection node_2 --let $wait_condition = SELECT COUNT(*) = 4 FROM t1; --source include/wait_condition.inc -select * from t1; +show variables like 'auto_increment%'; +select * from t1 order by i; SET GLOBAL wsrep_forced_binlog_format='none'; @@ -181,24 +192,25 @@ SET SESSION auto_increment_increment = 3; SET SESSION auto_increment_offset = 1; CREATE TABLE t1 ( - i int(11) NOT NULL AUTO_INCREMENT, - c char(32) DEFAULT 'dummy_text', - PRIMARY KEY (i) + i int(11) NOT NULL primary key AUTO_INCREMENT, + c char(32) DEFAULT 'dummy_text' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +show variables like 'auto_increment%'; insert into t1(i) values(null); -select * from t1; +select * from t1 order by i; insert into t1(i) values(null), (null), (null); -select * from t1; +select * from t1 order by i; --connection node_2 --let $wait_condition = SELECT COUNT(*) = 4 FROM t1; --source include/wait_condition.inc +show variables like 'auto_increment%'; -select * from t1; +select * from t1 order by i; --connection node_1 @@ -208,6 +220,7 @@ select * from t1; ## SET GLOBAL wsrep_auto_increment_control='ON'; +--source include/auto_increment_offset_restore.inc show variables like 'binlog_format'; show variables like '%auto_increment%'; diff --git a/mysql-test/suite/galera/t/galera_create_table_like.test b/mysql-test/suite/galera/t/galera_create_table_like.test index 0e0e8b0ffcfb9..3cf51521be1a9 100644 --- a/mysql-test/suite/galera/t/galera_create_table_like.test +++ b/mysql-test/suite/galera/t/galera_create_table_like.test @@ -48,3 +48,12 @@ DROP TABLE schema2.real_table3; DROP SCHEMA schema1; DROP SCHEMA schema2; + +# +# MDEV-25856: SIGSEGV in ha_myisammrg::append_create_info +# +use test; +CREATE TEMPORARY TABLE t (c INT) ENGINE=mrg_myisam UNION=(t,t2) insert_method=FIRST; +--error 1472 +CREATE TABLE t2 LIKE t; +DROP TABLE t; diff --git a/mysql-test/suite/galera/t/galera_ddl_fk_conflict.test b/mysql-test/suite/galera/t/galera_ddl_fk_conflict.test index 88837933e5aed..4ec866a9f74b9 100644 --- a/mysql-test/suite/galera/t/galera_ddl_fk_conflict.test +++ b/mysql-test/suite/galera/t/galera_ddl_fk_conflict.test @@ -17,14 +17,6 @@ SET SESSION wsrep_sync_wait=0; --connection node_1b SET SESSION wsrep_sync_wait=0; ---let $table_admin_command = OPTIMIZE ---source galera_ddl_fk_conflict.inc ---source galera_ddl_fk_conflict_with_tmp.inc - ---let $table_admin_command = REPAIR ---source galera_ddl_fk_conflict.inc ---source galera_ddl_fk_conflict_with_tmp.inc - --let $table_admin_command = ALTER --let $table_admin_command_end = ENGINE=INNODB --source galera_ddl_fk_conflict.inc diff --git a/mysql-test/suite/galera/t/galera_ddl_fk_no_conflict.inc b/mysql-test/suite/galera/t/galera_ddl_fk_no_conflict.inc new file mode 100644 index 0000000000000..9e2dd391678c3 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ddl_fk_no_conflict.inc @@ -0,0 +1,34 @@ +# This test attempts to show that OPTIMIZE on a child table does NOT +# acquire MDL locks on the parent table. # +# param: $table_admin_command +# DDL table command to test, script will build full SQL statement: +# $table_admin_command TABLE c; +# +# param: $FK_constraint +# Foreign key constraint to use when creating the child table. +# + +CREATE TABLE parent (pk INTEGER PRIMARY KEY); +--eval CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) $fk_constraint) + +INSERT INTO parent VALUES (1), (2), (3), (4); +INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4); + +--connection node_1 +# Start a transaction that uses the parent table, +# so that we acquire MDL lock on parent. +START TRANSACTION; +SELECT * FROM parent FOR UPDATE; + +# In a different connection, execute the table +# admin command (OPTIMIZE / REPAIR ...) on the child table. +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--eval $table_admin_command TABLE child; + +# Expect no conflict. +--connection node_1 +COMMIT; + +DROP TABLE child, parent; + +--disconnect node_1a diff --git a/mysql-test/suite/galera/t/galera_ddl_fk_no_conflict.test b/mysql-test/suite/galera/t/galera_ddl_fk_no_conflict.test new file mode 100644 index 0000000000000..6307b629e2b32 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ddl_fk_no_conflict.test @@ -0,0 +1,57 @@ +# +# This test attempts to show that table admin commands +# (OPTIMIZE / REPAIR / ANALYZE ...) on child table, +# do NOT cause conflicts on parent table operations. +# Contrary to what is said in MDEV-21577, which claimed +# that OPTIMIZE and REPAIR do take MDL locks on parent +# table. +# +# Should this test start failing due to a conflict +# (i.e. ER_LOCK_DEADLOCK), then it might be that we +# are missing additional keys for certification +# on the corresponding table admin command. + +--source include/galera_cluster.inc + +--let $table_admin_command = OPTIMIZE +--let $fk_constraint = +--source galera_ddl_fk_no_conflict.inc +--let $fk_constraint = ON UPDATE CASCADE +--source galera_ddl_fk_no_conflict.inc +--let $fk_constraint = ON DELETE CASCADE +--source galera_ddl_fk_no_conflict.inc +--let $fk_constraint = ON UPDATE CASCADE ON DELETE CASCADE +--source galera_ddl_fk_no_conflict.inc + + +--let $table_admin_command = REPAIR +--let $fk_constraint = +--source galera_ddl_fk_no_conflict.inc +--let $fk_constraint = ON UPDATE CASCADE +--source galera_ddl_fk_no_conflict.inc +--let $fk_constraint = ON DELETE CASCADE +--source galera_ddl_fk_no_conflict.inc +--let $fk_constraint = ON UPDATE CASCADE ON DELETE CASCADE +--source galera_ddl_fk_no_conflict.inc + + +--let $table_admin_command = CHECK +--let $fk_constraint = +--source galera_ddl_fk_no_conflict.inc +--let $fk_constraint = ON UPDATE CASCADE +--source galera_ddl_fk_no_conflict.inc +--let $fk_constraint = ON DELETE CASCADE +--source galera_ddl_fk_no_conflict.inc +--let $fk_constraint = ON UPDATE CASCADE ON DELETE CASCADE +--source galera_ddl_fk_no_conflict.inc + + +--let $table_admin_command = ANALYZE +--let $fk_constraint = +--source galera_ddl_fk_no_conflict.inc +--let $fk_constraint = ON UPDATE CASCADE +--source galera_ddl_fk_no_conflict.inc +--let $fk_constraint = ON DELETE CASCADE +--source galera_ddl_fk_no_conflict.inc +--let $fk_constraint = ON UPDATE CASCADE ON DELETE CASCADE +--source galera_ddl_fk_no_conflict.inc diff --git a/mysql-test/suite/galera/t/galera_drop_database.test b/mysql-test/suite/galera/t/galera_drop_database.test index 8dc73c1ce38ef..c1a66e1f66cc6 100644 --- a/mysql-test/suite/galera/t/galera_drop_database.test +++ b/mysql-test/suite/galera/t/galera_drop_database.test @@ -56,6 +56,7 @@ SHOW TABLES; DROP DATABASE fts; --connection node_2 +call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:"); --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'fts_t1'; --source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'fts_t2'; diff --git a/mysql-test/suite/galera/t/galera_events2.test b/mysql-test/suite/galera/t/galera_events2.test index 3dfbe406fc4fb..b29ad3ba2f2aa 100644 --- a/mysql-test/suite/galera/t/galera_events2.test +++ b/mysql-test/suite/galera/t/galera_events2.test @@ -137,6 +137,8 @@ SELECT * FROM t1; --echo # node_2 Event should be SERVERSIDE_DISABLED SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; +call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*"); + --connection node_1 SELECT * FROM t1; --echo # node_1 Event should be ENABLED diff --git a/mysql-test/suite/galera/t/galera_gcache_recover.test b/mysql-test/suite/galera/t/galera_gcache_recover.test index e1bfe517d27cd..fe2a65ee14e80 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover.test +++ b/mysql-test/suite/galera/t/galera_gcache_recover.test @@ -54,24 +54,7 @@ INSERT INTO t1 VALUES (3); # Warning happens when the cluster is started for the first time CALL mtr.add_suppression("Skipped GCache ring buffer recovery"); -# Confirm that IST took place ---let $assert_text = async IST sender starting to serve ---let $assert_select = async IST sender starting to serve ---let $assert_count = 1 ---let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err ---let $assert_only_after = starting as process ---source include/assert_grep.inc - --connection node_2 CALL mtr.add_suppression("Skipped GCache ring buffer recovery"); -# Confirm that gcache recovery took place - ---let $assert_text = Recovering GCache ring buffer: found gapless sequence ---let $assert_select = Recovering GCache ring buffer: found gapless sequence ---let $assert_count = 1 ---let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err ---let $assert_only_after = starting as process ---source include/assert_grep.inc - DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test index 08165f30f7d3d..214d5166781e7 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test +++ b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test @@ -126,6 +126,7 @@ DELIMITER ;| --send CALL insert_10m (); --connection node_2 +call mtr.add_suppression("Error in Log_event::read_log_event():.*"); SET SESSION wsrep_sync_wait = 0; # Make sure that node_2 is not killed while TOIs are applied. @@ -199,27 +200,8 @@ DROP PROCEDURE insert_1k; DROP PROCEDURE insert_1m; --connection node_1 +call mtr.add_suppression("Error in Log_event::read_log_event():.*"); CALL mtr.add_suppression("conflict state 7 after post commit"); # Warning happens when the cluster is started for the first time CALL mtr.add_suppression("Skipped GCache ring buffer recovery"); - -# Confirm that IST took place ---let $assert_text = async IST sender starting to serve ---let $assert_select = async IST sender starting to serve ---let $assert_count = 1 ---let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err ---let $assert_only_after = starting as process ---source include/assert_grep.inc - ---connection node_2 -CALL mtr.add_suppression("Skipped GCache ring buffer recovery"); - -# Confirm that gcache recovery took place - ---let $assert_text = Recovering GCache ring buffer: found gapless sequence ---let $assert_select = Recovering GCache ring buffer: found gapless sequence ---let $assert_count = 1 ---let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err ---let $assert_only_after = starting as process ---source include/assert_grep.inc diff --git a/mysql-test/suite/galera/t/galera_gtid_server_id.cnf b/mysql-test/suite/galera/t/galera_gtid_server_id.cnf new file mode 100644 index 0000000000000..bda7a00ab2ed0 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_gtid_server_id.cnf @@ -0,0 +1,16 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep_gtid_domain_id=1 +wsrep_gtid_mode=ON +server-id=11 +log_slave_updates +log_bin + +[mysqld.2] +wsrep_gtid_domain_id=1 +wsrep_gtid_mode=ON +server-id=12 +log_slave_updates +log_bin + diff --git a/mysql-test/suite/galera/t/galera_gtid_server_id.test b/mysql-test/suite/galera/t/galera_gtid_server_id.test new file mode 100644 index 0000000000000..9bb07371f92fe --- /dev/null +++ b/mysql-test/suite/galera/t/galera_gtid_server_id.test @@ -0,0 +1,28 @@ +--source include/galera_cluster.inc + +--connection node_1 +select @@gtid_domain_id, @@server_id, @@wsrep_gtid_domain_id,@@wsrep_gtid_mode; +--connection node_2 +call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); +select @@gtid_domain_id, @@server_id, @@wsrep_gtid_domain_id,@@wsrep_gtid_mode; + +--connection node_1 +CREATE TABLE t1(id int not null primary key) engine=innodb; +INSERT INTO t1 values (1); +show global variables like '%gtid%'; +--connection node_2 +SET SESSION wsrep_sync_wait=15; +show global variables like '%gtid%'; +# This should give error +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL server_id=200; +SHOW WARNINGS; +# This should give error +--error ER_WRONG_VALUE_FOR_VAR +SET SESSION server_id=200; +SHOW WARNINGS; +INSERT INTO t1 values(2); +show global variables like '%gtid%'; +--connection node_1 +show global variables like '%gtid%'; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_gtid_slave.test b/mysql-test/suite/galera/t/galera_gtid_slave.test index df55ea03cb0ca..b3fbbb02d5f3d 100644 --- a/mysql-test/suite/galera/t/galera_gtid_slave.test +++ b/mysql-test/suite/galera/t/galera_gtid_slave.test @@ -90,3 +90,6 @@ SET GLOBAL wsrep_on=ON; --connection node_3 reset master; + +--connection node_2 +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); diff --git a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test index d03445d537af0..b2ddc7e153d96 100644 --- a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test +++ b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test @@ -197,3 +197,6 @@ set global wsrep_on=ON; --echo #Connection 3 --connection node_3 reset master; + +--connection node_2 +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); diff --git a/mysql-test/suite/galera/t/galera_gtid_trx_conflict.test b/mysql-test/suite/galera/t/galera_gtid_trx_conflict.test index 27539b2ab5224..6f05196b8dad6 100644 --- a/mysql-test/suite/galera/t/galera_gtid_trx_conflict.test +++ b/mysql-test/suite/galera/t/galera_gtid_trx_conflict.test @@ -51,6 +51,6 @@ SELECT @@gtid_binlog_state; --connection node_2 SELECT @@gtid_binlog_state; - - DROP TABLE t1; + +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); diff --git a/mysql-test/suite/galera/t/galera_insert_bulk.test b/mysql-test/suite/galera/t/galera_insert_bulk.test new file mode 100644 index 0000000000000..f58870d5f74b7 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_insert_bulk.test @@ -0,0 +1,88 @@ +# +# Test that bulk insert replicates as table-level exclusive key and +# rolls back properly if needed. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Make bulk insert BF-abort, but regular insert succeed. +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +# Disable foreign and unique key checks to allow bulk insert. +SET foreign_key_checks = 0; +SET unique_checks = 0; + +START TRANSACTION; + +--let $count=0 +--disable_query_log +while ($count < 1000) +{ + --eval INSERT INTO t1 VALUES ($count) + --inc $count +} +--enable_query_log + +--connection node_2 + +# Disable bulk insert. +SET foreign_key_checks = 1; +SET unique_checks = 1; + +# Insert a value out of the bulk insert range. +INSERT INTO t1 VALUES (1001); + +--connection node_1 +--error ER_LOCK_DEADLOCK +COMMIT; + +DROP TABLE t1; + +# +# Make bulk insert succeed, but regular insert BF-abort. +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +--let $before_bulk_keys = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_repl_keys'` + +START TRANSACTION; + +--let $count=0 +--disable_query_log +while ($count < 1000) +{ + --eval INSERT INTO t1 VALUES ($count) + --inc $count +} +--enable_query_log + +--connection node_2 + +# Disable bulk insert. +SET foreign_key_checks = 1; +SET unique_checks = 1; + +START TRANSACTION; + +# Insert a value out of the bulk insert range. +INSERT INTO t1 VALUES (1001); + +--connection node_1 +COMMIT; + +# Expect two keys to be added for bulk insert: DB-level shared key and table-level exclusive key. +--let $bulk_keys_count = `SELECT VARIABLE_VALUE - $before_bulk_keys FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_repl_keys'` +--echo $bulk_keys_count + +--connection node_2 +--error ER_LOCK_DEADLOCK +COMMIT; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf b/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf new file mode 100644 index 0000000000000..691e52208b1da --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf @@ -0,0 +1,44 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +# server-id=101 +#wsrep-debug=1 +innodb_file_per_table +innodb_autoinc_lock_mode=2 +#wsrep_sst_method=rsync +wsrep_sst_method=mariabackup +wsrep_sst_auth=root: +binlog_format=ROW +core-file +log-output=none +wsrep_slave_threads=2 +wsrep_on=1 +gtid_strict_mode=1 +log_slave_updates=ON +log_bin=binlog + +[mysqld.2] +# server-id=102 +#wsrep-debug=1 +innodb_file_per_table +innodb_autoinc_lock_mode=2 +#wsrep_sst_method=rsync +wsrep_sst_method=mariabackup +wsrep_sst_auth=root: +binlog_format=ROW +core-file +log-output=none +wsrep_slave_threads=2 +wsrep_on=1 +gtid_strict_mode=1 +log_slave_updates=ON +log_bin=binlog + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' + +[sst] +transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_ist_MDEV-28423.test b/mysql-test/suite/galera/t/galera_ist_MDEV-28423.test new file mode 100644 index 0000000000000..8668c4ce15828 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ist_MDEV-28423.test @@ -0,0 +1,18 @@ +# MDEV-28423: Galera IST is failing on Joiner node + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_mariabackup.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--source suite/galera/include/galera_st_disconnect_slave.inc +--source suite/galera/include/galera_st_shutdown_slave.inc + +--source suite/galera/include/galera_st_kill_slave.inc +--source suite/galera/include/galera_st_kill_slave_ddl.inc + +--source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf b/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf new file mode 100644 index 0000000000000..3835cd02a414b --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf @@ -0,0 +1,44 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +# server-id=101 +#wsrep-debug=1 +innodb_file_per_table +innodb_autoinc_lock_mode=2 +wsrep_sst_method=rsync +#wsrep_sst_method=mariabackup +wsrep_sst_auth=root: +binlog_format=ROW +core-file +log-output=none +wsrep_slave_threads=2 +wsrep_on=1 +gtid_strict_mode=1 +log_slave_updates=ON +log_bin=binlog + +[mysqld.2] +# server-id=102 +#wsrep-debug=1 +innodb_file_per_table +innodb_autoinc_lock_mode=2 +wsrep_sst_method=rsync +#wsrep_sst_method=mariabackup +wsrep_sst_auth=root: +binlog_format=ROW +core-file +log-output=none +wsrep_slave_threads=2 +wsrep_on=1 +gtid_strict_mode=1 +log_slave_updates=ON +log_bin=binlog + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' + +[sst] +transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_ist_MDEV-28583.test b/mysql-test/suite/galera/t/galera_ist_MDEV-28583.test new file mode 100644 index 0000000000000..2c8c0bd80dacb --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ist_MDEV-28583.test @@ -0,0 +1,18 @@ +# MDEV-28583: Galera: binlogs disappear after rsync IST + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_mariabackup.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--source suite/galera/include/galera_st_disconnect_slave.inc +--source suite/galera/include/galera_st_shutdown_slave.inc + +--source suite/galera/include/galera_st_kill_slave.inc +--source suite/galera/include/galera_st_kill_slave_ddl.inc + +--source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_ist_progress.cnf b/mysql-test/suite/galera/t/galera_ist_progress.cnf index 0a26f6d6c8317..b37e7f38ce3a5 100644 --- a/mysql-test/suite/galera/t/galera_ist_progress.cnf +++ b/mysql-test/suite/galera/t/galera_ist_progress.cnf @@ -3,3 +3,5 @@ [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' + + diff --git a/mysql-test/suite/galera/t/galera_ist_progress.test b/mysql-test/suite/galera/t/galera_ist_progress.test index 3d7c53bd1eb37..60034ec0db1a1 100644 --- a/mysql-test/suite/galera/t/galera_ist_progress.test +++ b/mysql-test/suite/galera/t/galera_ist_progress.test @@ -3,12 +3,11 @@ # --source include/galera_cluster.inc -# This could cause out of storage if run /dev/shm ---source include/big_test.inc ---source include/force_restart.inc # Isolate node #2 --connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; --connection node_1 @@ -24,7 +23,7 @@ SET SESSION wsrep_on = ON; # Node #2 is now isolated. Run some transactions to accumulate writesets for IST --connection node_1 -CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (3); @@ -50,26 +49,15 @@ SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0'; --source include/wait_condition.inc # -# Grep for expected IST output in joiner log +# sed for expected IST output in joiner log # --connection node_1 ---let $assert_count = 1 ---let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err ---let $assert_only_after = Need state transfer - ---let $assert_text = Receiving IST: 13 writesets, seqnos 3-15 ---let $assert_select = Receiving IST: 13 writesets, seqnos 3-15 ---source include/assert_grep.inc - ---let $assert_text = Receiving IST\.\.\. 0\.0% \( 0/13 events\) complete ---let $assert_select = Receiving IST\.\.\. 0\.0% \( 0/13 events\) complete ---source include/assert_grep.inc - ---let $assert_text = Receiving IST\.\.\.100\.0% \(13/13 events\) complete ---let $assert_select = Receiving IST\.\.\.100\.0% \(13/13 events\) complete ---source include/assert_grep.inc +# Grep is not safe always and we are interested that there is at least one progress report (there can be more) +let $MYSQLD_DATADIR= `SELECT @@datadir`; +--echo "Trying to find IST progress reporting" +--exec sed -ne 's/.*Receiving IST.*/found/p' $MYSQLD_DATADIR/../../log/mysqld.2.err | tail -1 # Cleanup diff --git a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test index f56d0e657bd61..b36a0de57b6ee 100644 --- a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test +++ b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test @@ -35,8 +35,8 @@ UPDATE t1 SET f2 = 'c' WHERE f1 > 2; --connection node_2 # 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 +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --exec echo "wait" > $_expect_file_name --let KILL_NODE_PIDFILE = `SELECT @@pid_file` @@ -61,19 +61,7 @@ UPDATE t1 SET f2 = 'd' WHERE f1 > 3; # Kill node #2 while IST is in progress --connection node_2 - -# Kill the connected server ---disable_reconnect - ---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 +--source include/kill_galera.inc --connection node_1 --source include/wait_until_connected_again.inc diff --git a/mysql-test/suite/galera/t/galera_kill_applier.test b/mysql-test/suite/galera/t/galera_kill_applier.test index 3a28582261386..88ec55ed0c175 100644 --- a/mysql-test/suite/galera/t/galera_kill_applier.test +++ b/mysql-test/suite/galera/t/galera_kill_applier.test @@ -16,21 +16,23 @@ SET GLOBAL wsrep_slave_threads=2; --let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle' LIMIT 1` ---disable_query_log +--replace_result $applier_thread ID --error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR --eval KILL $applier_thread +--replace_result $applier_thread ID --error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR --eval KILL QUERY $applier_thread --let $aborter_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep aborter idle' LIMIT 1` +--replace_result $aborter_thread ID --error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR --eval KILL $aborter_thread +--replace_result $aborter_thread ID --error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR --eval KILL QUERY $aborter_thread ---enable_query_log SET GLOBAL wsrep_slave_threads=DEFAULT; diff --git a/mysql-test/suite/galera/t/galera_kill_largechanges.test b/mysql-test/suite/galera/t/galera_kill_largechanges.test deleted file mode 100644 index c671764fa9e39..0000000000000 --- a/mysql-test/suite/galera/t/galera_kill_largechanges.test +++ /dev/null @@ -1,50 +0,0 @@ -# -# This test kill -9-s a slave while a large update has been performed on the master. SST is performed. -# - ---source include/big_test.inc ---source include/galera_cluster.inc - -# Save original auto_increment_offset values. ---let $node_1=node_1 ---let $node_2=node_2 ---source include/auto_increment_offset_save.inc - ---connection node_1 -# Enable the master to continue running during the split-brain situation that -# occurs when the slave is killed ---let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` -SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; - -CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; -INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10),(11); -CREATE TABLE t1 (f1 VARCHAR(128)) ENGINE=InnoDB; - ---connection node_2 ---source include/kill_galera.inc - ---connection node_1 -# We create a 128Mb (or so) transaction that is larger than gcache. The size of the gcache is not adjustable dynamically -INSERT INTO t1 SELECT REPEAT('a', 128) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6; - ---connection node_2 ---source include/start_mysqld.inc - ---let $galera_connection_name = node_2a ---let $galera_server_number = 2 ---source include/galera_connect.inc ---connection node_2a - -SELECT COUNT(*) FROM t1; -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; - ---connection node_1 ---disable_query_log ---eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig'; ---enable_query_log - ---let $node_2=node_2a ---source include/auto_increment_offset_restore.inc - -DROP TABLE t1; -DROP TABLE ten; diff --git a/mysql-test/suite/galera/t/galera_last_committed_id.test b/mysql-test/suite/galera/t/galera_last_committed_id.test index b6e3e1f7e7a64..6e1f0de7d0b95 100644 --- a/mysql-test/suite/galera/t/galera_last_committed_id.test +++ b/mysql-test/suite/galera/t/galera_last_committed_id.test @@ -64,3 +64,6 @@ COMMIT; SET AUTOCOMMIT=ON; DROP TABLE t1; + +--connection node_2 +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); diff --git a/mysql-test/suite/galera/t/galera_locks_funcs.test b/mysql-test/suite/galera/t/galera_locks_funcs.test new file mode 100644 index 0000000000000..42838e9585c6e --- /dev/null +++ b/mysql-test/suite/galera/t/galera_locks_funcs.test @@ -0,0 +1,18 @@ +--source include/galera_cluster.inc + +CREATE TABLE t (c DOUBLE,c2 INT,PRIMARY KEY(c)) ENGINE=InnoDB; +INSERT INTO t values (1,1); +--error ER_NOT_SUPPORTED_YET +SELECT GET_LOCK('a',1); +SHOW WARNINGS; +SELECT * FROM t; +--error ER_NOT_SUPPORTED_YET +SELECT RELEASE_LOCK('a'); +SHOW WARNINGS; +# New in 10.5 +--error ER_NOT_SUPPORTED_YET +SELECT RELEASE_ALL_LOCKS(); +SHOW WARNINGS; +COMMIT; +DROP TABLE t; + diff --git a/mysql-test/suite/galera/t/galera_log_bin.inc b/mysql-test/suite/galera/t/galera_log_bin.inc index cc78367b510cd..4c24584675273 100644 --- a/mysql-test/suite/galera/t/galera_log_bin.inc +++ b/mysql-test/suite/galera/t/galera_log_bin.inc @@ -34,7 +34,6 @@ ALTER TABLE t1 ADD COLUMN f2 INTEGER; --connection node_2 SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ---let $MASTER_MYPORT=$NODE_MYPORT_2 --source include/show_binlog_events.inc DROP TABLE t1; @@ -44,3 +43,4 @@ DROP TABLE t2; --connection node_1 SET GLOBAL wsrep_on=OFF; RESET MASTER; +SET GLOBAL wsrep_on=ON; diff --git a/mysql-test/suite/galera/t/galera_log_bin_ext.cnf b/mysql-test/suite/galera/t/galera_log_bin_ext.cnf index 012209610ea90..ae47de90bb815 100644 --- a/mysql-test/suite/galera/t/galera_log_bin_ext.cnf +++ b/mysql-test/suite/galera/t/galera_log_bin_ext.cnf @@ -9,3 +9,6 @@ log-slave-updates log-bin = hostname2-bin log-bin-index = hostname2.bdx log-slave-updates + +[sst] +sst_max_binlogs= diff --git a/mysql-test/suite/galera/t/galera_log_bin_ext.test b/mysql-test/suite/galera/t/galera_log_bin_ext.test index 923bd623a8a23..752073aecdb3b 100644 --- a/mysql-test/suite/galera/t/galera_log_bin_ext.test +++ b/mysql-test/suite/galera/t/galera_log_bin_ext.test @@ -1 +1 @@ ---source galera_log_bin.inc +--source galera_log_bin_sst.inc diff --git a/mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup.cnf b/mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup.cnf new file mode 100644 index 0000000000000..c988136b8fbb9 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup.cnf @@ -0,0 +1,19 @@ +!include ../galera_2nodes.cnf + +[mysqld] +wsrep_sst_method=mariabackup +wsrep_sst_auth="root:" + +[mysqld.1] +log-bin=@ENV.MYSQLTEST_VARDIR/mysqld.1/data/hostname1-bin +log-bin-index = hostname1.bdx +log-slave-updates + +[mysqld.2] +log-bin=@ENV.MYSQLTEST_VARDIR/mysqld.2/data/hostname2-bin +log-bin-index = hostname2.bdx +log-slave-updates + +[sst] +transferfmt=@ENV.MTR_GALERA_TFMT +sst_max_binlogs= diff --git a/mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup.test b/mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup.test new file mode 100644 index 0000000000000..47df45b4c71dd --- /dev/null +++ b/mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup.test @@ -0,0 +1,2 @@ +--source include/have_mariabackup.inc +--source galera_log_bin_sst.inc diff --git a/mysql-test/suite/galera/t/galera_log_bin_sst.inc b/mysql-test/suite/galera/t/galera_log_bin_sst.inc new file mode 100644 index 0000000000000..3d20add6d9efb --- /dev/null +++ b/mysql-test/suite/galera/t/galera_log_bin_sst.inc @@ -0,0 +1,89 @@ +--source include/galera_cluster.inc +--source include/force_restart.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--connection node_1 +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; +--connection node_2 +set global wsrep_on=OFF; +reset master; +set global wsrep_on=ON; + +# +# Test Galera with --log-bin --log-slave-updates . +# This way the actual MySQL binary log is used, +# rather than Galera's own implementation +# + +CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); + +CREATE TABLE t2 (id INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1); +INSERT INTO t2 VALUES (1); + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1; +SELECT COUNT(*) = 2 FROM t2; + +--connection node_1 +ALTER TABLE t1 ADD COLUMN f2 INTEGER; +--let $MASTER_MYPORT=$NODE_MYPORT_1 +--source include/show_binlog_events.inc + +--connection node_2 + +#--connection node_2 +#--source suite/galera/include/galera_stop_replication.inc + +--echo Shutting down server ... +--source include/shutdown_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +# +# Force SST +# +--echo Cleaning var directory ... +--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mtr +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/performance_schema +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/test +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mysql +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data + +--connection node_2 + +--echo Starting server ... +let $restart_noprint=2; +--source include/start_mysqld.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc + +--connection node_2 +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; +--source include/show_binlog_events.inc + +DROP TABLE t1; +DROP TABLE t2; + +--echo #cleanup +--connection node_1 +SET GLOBAL wsrep_on=OFF; +RESET MASTER; +SET GLOBAL wsrep_on=ON; + +# Restore original auto_increment_offset values. +--source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_many_rows.test b/mysql-test/suite/galera/t/galera_many_rows.test index bc9e99db8daa6..3623b3f33b068 100644 --- a/mysql-test/suite/galera/t/galera_many_rows.test +++ b/mysql-test/suite/galera/t/galera_many_rows.test @@ -10,11 +10,11 @@ SET SESSION innodb_lock_wait_timeout=600; SET SESSION lock_wait_timeout=600; -CREATE TABLE ten (f1 INTEGER) engine=InnoDB; +CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) engine=InnoDB; INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; -INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; +INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; --connection node_2 SET SESSION wsrep_sync_wait = 0; @@ -24,7 +24,7 @@ SET SESSION wsrep_sync_wait = 15; SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT1H'; SELECT COUNT(*) FROM t1; -INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; +INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; --connection node_1 SELECT COUNT(*) FROM t1; diff --git a/mysql-test/suite/galera/t/galera_many_tables_nopk.test b/mysql-test/suite/galera/t/galera_many_tables_nopk.test index 98a65b7c66085..5bfab686726b8 100644 --- a/mysql-test/suite/galera/t/galera_many_tables_nopk.test +++ b/mysql-test/suite/galera/t/galera_many_tables_nopk.test @@ -7,18 +7,17 @@ if (!`SELECT @@open_files_limit >= 1024`){ } # -# This test forces 900 tables without a PK to participate in a single -# transaction. The reason for 900 is that some linux system has by default -# a limit of 1024 open files / process +# This test forces 100 tables without a PK to participate in a single +# transaction. # # -# First, create 900 tables +# First, create 100 tables # --connection node_1 ---let $count = 900 +--let $count = 100 while ($count) { --disable_query_log @@ -28,7 +27,7 @@ while ($count) --dec $count } ---let $count = 900 +--let $count = 100 while ($count) { --disable_query_log @@ -39,13 +38,13 @@ while ($count) } # -# Second, perform 900 updates +# Second, perform 100 updates # SET AUTOCOMMIT=OFF; START TRANSACTION; ---let $count = 900 +--let $count = 100 while ($count) { --disable_query_log @@ -63,7 +62,7 @@ COMMIT; --connection node_2 CREATE TABLE sum_table (f1 INTEGER); ---let $count = 900 +--let $count = 100 while ($count) { --disable_query_log @@ -73,7 +72,7 @@ while ($count) --dec $count } -SELECT SUM(f1) = 900 FROM sum_table; +SELECT SUM(f1) = 100 FROM sum_table; # # Fourth, create a deadlock @@ -83,7 +82,7 @@ SELECT SUM(f1) = 900 FROM sum_table; SET AUTOCOMMIT=OFF; START TRANSACTION; ---let $count = 900 +--let $count = 100 while ($count) { --disable_query_log @@ -96,7 +95,7 @@ while ($count) --connection node_2 SET AUTOCOMMIT=OFF; START TRANSACTION; -UPDATE t900 SET f1 = 3; +UPDATE t100 SET f1 = 3; --connection node_1 COMMIT; diff --git a/mysql-test/suite/galera/t/galera_myisam_transactions.test b/mysql-test/suite/galera/t/galera_myisam_transactions.test index 00e0bf3fdcadd..808aebdcbe4e7 100644 --- a/mysql-test/suite/galera/t/galera_myisam_transactions.test +++ b/mysql-test/suite/galera/t/galera_myisam_transactions.test @@ -34,3 +34,16 @@ SELECT COUNT(*) = 0 FROM t2; SELECT COUNT(*) = 0 FROM t2; DROP TABLE t1, t2, t3; + +# +# MDEV-25201 : Assertion `thd->wsrep_trx_meta.gtid.seqno == (-1)' failed in int wsrep_to_isolation_begin(THD*, const char*, const char*, const TABLE_LIST*, Alter_info*) +# +SET SESSION lock_wait_timeout=2; +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; +CREATE TEMPORARY TABLE t1 (i INT, PRIMARY KEY pk (i)) ENGINE=MyISAM; +PREPARE stmt FROM "INSERT INTO t1 (id) SELECT * FROM (SELECT 4 AS i) AS y"; +INSERT INTO t1 VALUES(4); +DEALLOCATE PREPARE stmt; +COMMIT; +DROP TABLE t1; +SET GLOBAL wsrep_mode = DEFAULT; diff --git a/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf b/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf new file mode 100644 index 0000000000000..ae48aa3ae0fa3 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf @@ -0,0 +1,11 @@ +!include ../galera_2nodes.cnf + +[mysqld] +wsrep_debug=1 + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' + diff --git a/mysql-test/suite/galera/t/galera_query_cache_invalidate.cnf b/mysql-test/suite/galera/t/galera_query_cache_invalidate.cnf new file mode 100644 index 0000000000000..49269422a35fd --- /dev/null +++ b/mysql-test/suite/galera/t/galera_query_cache_invalidate.cnf @@ -0,0 +1,25 @@ +!include ../galera_2x2nodes.cnf + +[mysqld.1] +wsrep_gtid_domain_id=1 +server-id=11 +query_cache_type=1 +query_cache_size=15M + +[mysqld.2] +wsrep_gtid_domain_id=1 +server-id=12 +query_cache_type=1 +query_cache_size=15M + +[mysqld.3] +wsrep_gtid_domain_id=2 +server-id=13 +query_cache_type=1 +query_cache_size=15M + +[mysqld.4] +wsrep_gtid_domain_id=2 +server-id=21 +query_cache_type=1 +query_cache_size=15M diff --git a/mysql-test/suite/galera/t/galera_query_cache_invalidate.test b/mysql-test/suite/galera/t/galera_query_cache_invalidate.test new file mode 100644 index 0000000000000..d72d8a9ba40b1 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_query_cache_invalidate.test @@ -0,0 +1,120 @@ +--source include/big_test.inc +--source include/force_restart.inc +--source include/galera_cluster.inc +--source include/have_sequence.inc + +# +# MDEV-28641 : Query cache entries not invalidated on slave of a Galera cluster +# +# We use two 2-node galera clusters as follows +# +# A(1) <-> B(2) {Galera cluster 1} +# | {Async replication} +# D(3) <-> E(4) {Galera cluster 2} +# +# Normal asyncronous replication is used between nodes 1 and 3 +# so that node_1 is master and node_3 a slave. +# +# In this test we can't test is some query fast or slow but we can +# test does all nodes see all rows (this is not true before fix) +# +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 + +--connection node_2 +call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); +--connection node_4 +call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); + +--connection node_3 + +--replace_result $NODE_MYPORT_1 NODE_MYPORT_1 +--eval CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_1, master_use_gtid=current_pos; +START SLAVE; +--source include/wait_for_slave_to_start.inc + +--connection node_1 + +CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb; +--disable_query_log +INSERT INTO t1 SELECT seq, md5(rand()) from seq_1_to_50000; +COMMIT; +--enable_query_log +SET AUTOCOMMIT=1; +INSERT INTO t1 VALUES (4000000, 'foobar'); +SELECT COUNT(*) FROM t1; +--sync_slave_with_master node_3 + +# +# All nodes should see one row and first query is slow and second fast +# +--connection node_1 +--echo # node_1 +SELECT * FROM t1 WHERE msg='foobar'; +SELECT * FROM t1 WHERE msg='foobar'; +--connection node_2 +--echo # node_2 +SELECT * FROM t1 WHERE msg='foobar'; +SELECT * FROM t1 WHERE msg='foobar'; +--connection node_3 +--echo # node_3 +SELECT * FROM t1 WHERE msg='foobar'; +SELECT * FROM t1 WHERE msg='foobar'; +--connection node_4 +--echo # node_4 +SELECT * FROM t1 WHERE msg='foobar'; +SELECT * FROM t1 WHERE msg='foobar'; +# +# Insert a new row in master, this should cause query cache +# invalidation +# +--connection node_1 +--echo # node_1 insert new +INSERT INTO t1 values (5000000, 'foobar'); +--sync_slave_with_master node_3 + +# +# All nodes should see 2 rows +# +SELECT * FROM t1 WHERE msg='foobar'; +SELECT * FROM t1 WHERE msg='foobar'; + +--connection node_2 +--echo # node_2 +SELECT * FROM t1 WHERE msg='foobar'; +SELECT * FROM t1 WHERE msg='foobar'; +--connection node_3 +--echo # node_3 +SELECT * FROM t1 WHERE msg='foobar'; +SELECT * FROM t1 WHERE msg='foobar'; +--connection node_4 +--echo # node_4 +SELECT * FROM t1 WHERE msg='foobar'; +SELECT * FROM t1 WHERE msg='foobar'; + +--connection node_2 +--echo # node_3 different query same table +SELECT id, msg FROM t1 WHERE msg='foobar'; + +--connection node_4 +--echo # node_6 different query same table +SELECT id, msg FROM t1 WHERE msg='foobar'; + +# +# Cleanup +# +--connection node_1 +drop table t1; +--sync_slave_with_master node_3 + +--connection node_3 +STOP SLAVE; +RESET SLAVE ALL; + +--connection node_1 +SET SESSION WSREP_ON=OFF; +RESET MASTER; +SET SESSION WSREP_ON=ON; + +--source include/galera_end.inc +--echo # End of test diff --git a/mysql-test/suite/galera/t/galera_read_only.test b/mysql-test/suite/galera/t/galera_read_only.test index c0fa4af07e0a9..56fe2fdd91001 100644 --- a/mysql-test/suite/galera/t/galera_read_only.test +++ b/mysql-test/suite/galera/t/galera_read_only.test @@ -28,9 +28,20 @@ CREATE USER foo@localhost; --connection foo_node_2 --error ER_OPTION_PREVENTS_STATEMENT INSERT INTO t1 VALUES (2); +# Writes to temporary tables are allowed +CREATE TEMPORARY TABLE t2(id int not null primary key) engine=innodb; +INSERT INTO t2 values (1); +DROP TABLE t2; --connection node_2 -SELECT COUNT(*) = 1 FROM t1; +SELECT COUNT(*) AS EXPECT_1 FROM t1; + +--connection node_2 +SET GLOBAL read_only=TRUE; +# Writes to temporary tables are allowed +CREATE TEMPORARY TABLE t2(id int not null primary key) engine=innodb; +INSERT INTO t2 values (1); +DROP TABLE t2; # Cleanup SET GLOBAL read_only=FALSE; diff --git a/mysql-test/suite/galera/t/galera_repair_view.test b/mysql-test/suite/galera/t/galera_repair_view.test new file mode 100644 index 0000000000000..0010d90c7ece8 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_repair_view.test @@ -0,0 +1,12 @@ +--source include/galera_cluster.inc + +CREATE TABLE t1(a int not null primary key) engine=innodb; +REPAIR TABLE t1; +CREATE VIEW v1 AS SELECT a FROM t1; +REPAIR VIEW v1; +DROP VIEW v1; +DROP TABLE t1; + +CREATE VIEW v1 AS SELECT table_name FROM information_schema.tables; +REPAIR VIEW v1; +DROP VIEW v1; diff --git a/mysql-test/suite/galera/t/galera_repl_max_ws_size.test b/mysql-test/suite/galera/t/galera_repl_max_ws_size.test index 60b866ae01893..2e29a030664b6 100644 --- a/mysql-test/suite/galera/t/galera_repl_max_ws_size.test +++ b/mysql-test/suite/galera/t/galera_repl_max_ws_size.test @@ -12,7 +12,7 @@ CREATE TABLE t1 (f1 VARCHAR(512)) ENGINE=InnoDB; SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512'; ---error ER_ERROR_DURING_COMMIT +--error ER_UNKNOWN_ERROR INSERT INTO t1 VALUES (REPEAT('a', 512)); SELECT COUNT(*) = 0 FROM t1; diff --git a/mysql-test/suite/galera/t/galera_restart_on_unknown_option.test b/mysql-test/suite/galera/t/galera_restart_on_unknown_option.test index ed7f106c12311..6a0f24dbaaea4 100644 --- a/mysql-test/suite/galera/t/galera_restart_on_unknown_option.test +++ b/mysql-test/suite/galera/t/galera_restart_on_unknown_option.test @@ -125,6 +125,7 @@ SELECT * FROM t1; # Sanity check (node 2 is running now and can perform SQL operators): +call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:"); SELECT * FROM t1; --connection node_1 diff --git a/mysql-test/suite/galera/t/galera_savepoint_replay.test b/mysql-test/suite/galera/t/galera_savepoint_replay.test new file mode 100644 index 0000000000000..cff26f4a94f20 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_savepoint_replay.test @@ -0,0 +1,86 @@ +# +# This test tests replaying a transaction with savepoint +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/galera_have_debug_sync.inc + +--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'a'); + +--connection node_1 +SET AUTOCOMMIT=ON; +START TRANSACTION; + +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE; +SAVEPOINT my_sp; + +# Block the applier on node #1 and issue a conflicting update on node #2 +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +SET SESSION wsrep_sync_wait=0; +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_set_sync_point.inc + +--connection node_2 +UPDATE t1 SET f2 = 'c' WHERE f1 = 2; + +--connection node_1a +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc + +# Block the commit, send the COMMIT and wait until it gets blocked + +--let $galera_sync_point = commit_monitor_master_enter_sync +--source include/galera_set_sync_point.inc + +--connection node_1 +--send COMMIT + +--connection node_1a + +--let $galera_sync_point = apply_monitor_slave_enter_sync commit_monitor_master_enter_sync +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc + +# Let the conflicting UPDATE proceed and wait until it hits abort_trx_end. +# The victim transaction still sits in commit_monitor_master_sync_point. + +--let $galera_sync_point = abort_trx_end +--source include/galera_set_sync_point.inc +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_signal_sync_point.inc +--let $galera_sync_point = abort_trx_end commit_monitor_master_enter_sync +--source include/galera_wait_sync_point.inc + +# Let the transactions proceed +--source include/galera_clear_sync_point.inc +--let $galera_sync_point = abort_trx_end +--source include/galera_signal_sync_point.inc +--let $galera_sync_point = commit_monitor_master_enter_sync +--source include/galera_signal_sync_point.inc + +# Commit succeeds +--connection node_1 +--reap + +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; + +# wsrep_local_replays has increased by 1 +--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` +--disable_query_log +--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays; +--enable_query_log + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; + +DROP TABLE t1; + diff --git a/mysql-test/suite/galera/t/galera_sequences.cnf b/mysql-test/suite/galera/t/galera_sequences.cnf new file mode 100644 index 0000000000000..98e724fb2d0f4 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences.cnf @@ -0,0 +1,9 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +log-bin +log-slave-updates + +[mysqld.2] +log-bin +log-slave-updates diff --git a/mysql-test/suite/galera/t/galera_sequences.test b/mysql-test/suite/galera/t/galera_sequences.test new file mode 100644 index 0000000000000..613823d83e905 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences.test @@ -0,0 +1,100 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# MDEV-19353 : Alter Sequence do not replicate to another nodes with in Galera Cluster +# + +--connection node_1 +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +CALL mtr.add_suppression("WSREP: CREATE TABLE isolation failure"); +--connection node_2 + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); + +--connection node_1 +CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 1000000 increment by 0 cache 1000 nocycle ENGINE=InnoDB; +SHOW CREATE SEQUENCE seq; + +--connection node_2 +SHOW CREATE SEQUENCE seq; + +--connection node_1 +ALTER SEQUENCE seq MAXVALUE = 10000; +SHOW CREATE SEQUENCE seq; + +--connection node_2 +SHOW CREATE SEQUENCE seq; + +--connection node_1 +DROP SEQUENCE seq; +--error ER_NO_SUCH_TABLE +SHOW CREATE SEQUENCE seq; + +--connection node_2 +--error ER_NO_SUCH_TABLE +SHOW CREATE SEQUENCE seq; + +# +# MDEV-18848 : Galera: 10.4 node crashed with Assertion `client_state.transaction().active()` after altering SEQUENCE table's engine to myisam and back to innodb +# +--connection node_1 +CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1; +select NEXT VALUE FOR Seq1_1; +alter table Seq1_1 engine=myisam; +select NEXT VALUE FOR Seq1_1; +alter table Seq1_1 engine=innodb; +select NEXT VALUE FOR Seq1_1; + +--connection node_2 +SHOW CREATE SEQUENCE Seq1_1; +select NEXT VALUE FOR Seq1_1; + +--connection node_1 +DROP SEQUENCE Seq1_1; + +# +# MDEV-24045 : Assertion client_state_.mode() != wsrep::client_state::m_toi failed in int wsrep::transaction::before_commit() +# + +--connection node_1 +CREATE TABLE t2 (d CHAR(1)KEY); +SET SESSION autocommit=0; +INSERT INTO t2 VALUES(1); +CREATE TEMPORARY SEQUENCE seq1 NOCACHE ENGINE=INNODB; +CREATE SEQUENCE seq2 NOCACHE ENGINE=INNODB; +COMMIT; +SET SESSION AUTOCOMMIT=1; +SHOW CREATE TABLE seq1; +--connection node_2 +--error ER_NO_SUCH_TABLE +SHOW CREATE SEQUENCE seq1; +SHOW CREATE SEQUENCE seq2; +--connection node_1 +SET SESSION autocommit=1; +DROP SEQUENCE seq1; +DROP SEQUENCE seq2; +DROP TABLE t2; +# +# Case2 +# +SET SESSION AUTOCOMMIT=0; +SET SESSION wsrep_OSU_method='RSU'; +CREATE TABLE t1(c1 VARCHAR(10)); +INSERT INTO t1 (c1) VALUES(''); +create temporary sequence sq1 NOCACHE engine=innodb; +create sequence sq2 NOCACHE engine=innodb; +COMMIT; +SHOW CREATE SEQUENCE sq1; +SHOW CREATE SEQUENCE sq2; +--connection node_2 +--error ER_NO_SUCH_TABLE +SHOW CREATE SEQUENCE sq1; +--error ER_NO_SUCH_TABLE +SHOW CREATE SEQUENCE sq2; +--connection node_1 +SET SESSION AUTOCOMMIT=1; +DROP TABLE t1; +DROP SEQUENCE sq1; +DROP SEQUENCE sq2; +SET SESSION wsrep_OSU_method='TOI'; diff --git a/mysql-test/suite/galera/t/galera_sst_encrypted.cnf b/mysql-test/suite/galera/t/galera_sst_encrypted.cnf new file mode 100644 index 0000000000000..e10c3e9f21529 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_encrypted.cnf @@ -0,0 +1,17 @@ +!include ../galera_2nodes.cnf + +[mysqld] +plugin-load-add=@ENV.FILE_KEY_MANAGEMENT_SO +loose-file-key-management +loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt +loose-file-key-management-encryption-algorithm=aes_cbc +wsrep-debug=1 +innodb_encryption_threads = 4 +innodb_file_per_table=1 +wsrep_sst_method=rsync + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' diff --git a/mysql-test/suite/galera/t/galera_sst_encrypted.test b/mysql-test/suite/galera/t/galera_sst_encrypted.test new file mode 100644 index 0000000000000..0ad05a3417839 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_encrypted.test @@ -0,0 +1,16 @@ +--source include/big_test.inc +--source include/galera_cluster.inc +--source ../encryption/include/have_file_key_management_plugin.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--source suite/galera/include/galera_st_shutdown_slave.inc +--source suite/galera/include/galera_st_clean_slave.inc + +# Restore original auto_increment_offset values. +--source include/auto_increment_offset_restore.inc + +--source include/galera_end.inc diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_logarchive.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_logarchive.cnf new file mode 100644 index 0000000000000..04043ac2b74bc --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_logarchive.cnf @@ -0,0 +1,17 @@ +!include ../galera_2nodes.cnf + +[mysqld] +wsrep_sst_method=mariabackup +wsrep_sst_auth="root:" +wsrep_debug=1 + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' + +[sst] +transferfmt=@ENV.MTR_GALERA_TFMT +sst-log-archive=1 +sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/tmp/logarchive diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_logarchive.test b/mysql-test/suite/galera/t/galera_sst_mariabackup_logarchive.test new file mode 100644 index 0000000000000..09a18ab4c2c28 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_logarchive.test @@ -0,0 +1,64 @@ +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_mariabackup.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--connection node_2 + +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--source include/wait_condition.inc + +--connection node_1 + +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--source include/wait_condition.inc + +--remove_files_wildcard $MYSQLTEST_VARDIR/tmp/logarchive * + +--source suite/galera/include/galera_st_shutdown_slave.inc +--source suite/galera/include/galera_st_clean_slave.inc + +--source suite/galera/include/galera_st_kill_slave.inc +--source suite/galera/include/galera_st_kill_slave_ddl.inc + +# Restore original auto_increment_offset values. +--source include/auto_increment_offset_restore.inc + +--let sst_test_true_count=6 +--source include/maybe_debug.inc +if ($have_debug) { + --let sst_test_true_count=6 +} + +--source include/galera_end.inc + +--list_files_write_file $MYSQLTEST_VARDIR/tmp/logarchive_list $MYSQLTEST_VARDIR/tmp/logarchive mariabackup.*.log.*.gz + +--perl + use strict; + use warnings; + my $file=$ENV{'MYSQLTEST_VARDIR'}.'/tmp/logarchive_list'; + my $count=0; + open(FILE, "$file") or die("Error $? opening $file: $!\n"); + while () { + my $line = $_; + $count++; + } + close(FILE) or die("Error $? closing $file: $!"); + my $true_count=$ENV{'sst_test_true_count'}; + if ($count != $true_count) { + die("Wrong log archives counter: $count instead of $true_count"); + } +EOF + +--remove_file $MYSQLTEST_VARDIR/tmp/logarchive_list +--remove_files_wildcard $MYSQLTEST_VARDIR/tmp/logarchive * +--rmdir $MYSQLTEST_VARDIR/tmp/logarchive diff --git a/mysql-test/suite/galera/t/galera_sst_rsync.test b/mysql-test/suite/galera/t/galera_sst_rsync.test index 5c08707e87038..c944c8d84b7f9 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync.test +++ b/mysql-test/suite/galera/t/galera_sst_rsync.test @@ -10,4 +10,5 @@ --source suite/galera/include/galera_st_kill_slave.inc --source suite/galera/include/galera_st_kill_slave_ddl.inc + --source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_sst_rsync2.cnf b/mysql-test/suite/galera/t/galera_sst_rsync2.cnf index 0159596f99bea..a089baacf368f 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync2.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync2.cnf @@ -5,10 +5,10 @@ wsrep_sst_method=rsync [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' -log_bin=@ENV.MYSQLTEST_VARDIR/server1_binlog +log_bin=@ENV.MYSQLTEST_VARDIR/mysqld.1/server1_binlog log_bin_index=@ENV.MYSQLTEST_VARDIR/tmp/server1_binlog_index.index [mysqld.2] wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' -log_bin=@ENV.MYSQLTEST_VARDIR/server2_binlog +log_bin=@ENV.MYSQLTEST_VARDIR/mysqld.2/server2_binlog log_bin_index=@ENV.MYSQLTEST_VARDIR/tmp/server2_binlog_index.index diff --git a/mysql-test/suite/galera/t/galera_sst_rsync2.test b/mysql-test/suite/galera/t/galera_sst_rsync2.test index f796356cac7e8..20fae4a751ef8 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync2.test +++ b/mysql-test/suite/galera/t/galera_sst_rsync2.test @@ -7,6 +7,8 @@ --source suite/galera/include/galera_st_shutdown_slave.inc --source suite/galera/include/galera_st_clean_slave.inc +--let $wsrep_recover_additional=--log-bin=$MYSQLTEST_VARDIR/mysqld.2/server2_binlog --log-bin-index=$MYSQLTEST_VARDIR/tmp/server2_binlog_index.index + --source suite/galera/include/galera_st_kill_slave.inc --source suite/galera/include/galera_st_kill_slave_ddl.inc --source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_logbasename.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_logbasename.cnf index 4f25af7cd8ba1..3913ab6660fe9 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync_logbasename.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync_logbasename.cnf @@ -12,4 +12,3 @@ log_bin wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' log_basename=server2 log_bin - diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_recv_auto.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_recv_auto.cnf new file mode 100644 index 0000000000000..c2888926a570b --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_rsync_recv_auto.cnf @@ -0,0 +1,18 @@ +!include ../galera_2nodes.cnf + +[mysqld] +wsrep_sst_method=rsync +bind-address=:: + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port;gcache.size=1;pc.ignore_sb=true' +wsrep_node_incoming_address='[::1]:@mysqld.1.port' +wsrep_node_address=::1 +wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' + +[mysqld.2] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port;gcache.size=1;pc.ignore_sb=true' +wsrep_node_address=::1 +wsrep_node_incoming_address='[::1]:@mysqld.2.port' +wsrep_sst_receive_address=AUTO diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_recv_auto.test b/mysql-test/suite/galera/t/galera_sst_rsync_recv_auto.test new file mode 100644 index 0000000000000..6cc533ce739bb --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_rsync_recv_auto.test @@ -0,0 +1,15 @@ +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/check_ipv6.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--source suite/galera/include/galera_st_shutdown_slave.inc +--source suite/galera/include/galera_st_clean_slave.inc + +--source suite/galera/include/galera_st_kill_slave.inc +--source suite/galera/include/galera_st_kill_slave_ddl.inc + +--source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_sync_wait_upto.test b/mysql-test/suite/galera/t/galera_sync_wait_upto.test index 05353ac7a3ab5..8465ddebfeb86 100644 --- a/mysql-test/suite/galera/t/galera_sync_wait_upto.test +++ b/mysql-test/suite/galera/t/galera_sync_wait_upto.test @@ -70,3 +70,6 @@ INSERT INTO t1 VALUES (2); --connection node_1 DROP TABLE t1; + +--connection node_2 +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); diff --git a/mysql-test/suite/galera/t/galera_var_cluster_address.test b/mysql-test/suite/galera/t/galera_var_cluster_address.test index 85ae73ffda4c7..e25de0aeb21c6 100644 --- a/mysql-test/suite/galera/t/galera_var_cluster_address.test +++ b/mysql-test/suite/galera/t/galera_var_cluster_address.test @@ -67,7 +67,7 @@ CALL mtr.add_suppression("failed to open gcomm backend connection: 110: failed t CALL mtr.add_suppression("Failed to open backend connection: -110 \\(Connection timed out\\)"); CALL mtr.add_suppression("gcs connect failed: Connection timed out"); CALL mtr.add_suppression("WSREP: wsrep::connect\\(foo://\\) failed: 7"); -CALL mtr.add_suppression("WSREP: wsrep::connect\\(gcomm://192.0.2.1\\) failed: 7"); +CALL mtr.add_suppression("WSREP: wsrep::connect\\(gcomm://.*\\) failed: 7"); # Restore original auto_increment_offset values. --source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_var_dirty_reads.test b/mysql-test/suite/galera/t/galera_var_dirty_reads.test index 85f72e633dc29..e0c5b666c3242 100644 --- a/mysql-test/suite/galera/t/galera_var_dirty_reads.test +++ b/mysql-test/suite/galera/t/galera_var_dirty_reads.test @@ -31,10 +31,10 @@ SHOW STATUS LIKE 'wsrep_ready'; # Must return 'Disconnected' SHOW STATUS LIKE 'wsrep_cluster_status'; ---error ER_UNKNOWN_COM_ERROR,1047 +--error ER_UNKNOWN_COM_ERROR SELECT * FROM t1; ---error ER_UNKNOWN_COM_ERROR,1047 +--error ER_UNKNOWN_COM_ERROR SELECT 1 FROM t1; SET @@session.wsrep_dirty_reads=ON; @@ -46,7 +46,7 @@ SELECT i, variable_name, variable_value FROM t1, information_schema.session_vari SET @@session.wsrep_dirty_reads=OFF; ---error ER_UNKNOWN_COM_ERROR,1047 +--error ER_UNKNOWN_COM_ERROR SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1; diff --git a/mysql-test/suite/galera/t/galera_var_gtid_domain_id.test b/mysql-test/suite/galera/t/galera_var_gtid_domain_id.test index eec47507e3acb..4de1121ae778c 100644 --- a/mysql-test/suite/galera/t/galera_var_gtid_domain_id.test +++ b/mysql-test/suite/galera/t/galera_var_gtid_domain_id.test @@ -59,6 +59,8 @@ set global wsrep_on=OFF; reset master; set global wsrep_on=ON; +--connection node_2 +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); + --source include/galera_end.inc --echo # End of test - diff --git a/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test b/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test deleted file mode 100644 index 10f3815e13536..0000000000000 --- a/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test +++ /dev/null @@ -1,72 +0,0 @@ -# -# This test checks that innodb_disallow_writes works as expected -# -# Note that we need to enable binlog for this test: If the commit -# to InnoDB is done in one phase, the transaction is committed in -# memory before it is persisted to disk. This means that the -# innodb_disallow_writes=ON may not prevent transaction to -# become visible to other readers. On the other hand, if the -# commit is two phase (as it is with binlog), the transaction -# will be blocked in prepare phase. -# - ---source include/galera_cluster.inc ---source include/have_innodb.inc ---source include/have_log_bin.inc - ---let $datadir= `SELECT @@datadir` - - -# Open a separate connection to be used to run SHOW PROCESSLIST ---let $galera_connection_name = node_1a ---let $galera_server_number = 1 ---source include/galera_connect.inc ---connection node_1a -SET SESSION wsrep_sync_wait = 0; - ---connection node_1 -CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB; -CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; -INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); - -SET GLOBAL innodb_disallow_writes=ON; ---exec find $datadir -type f-exec md5sum {} \; | md5sum >$MYSQLTEST_VARDIR/tmp/innodb_before - -# -# This insert has no effect before innodb_disallow_writes is OFF -# ---send INSERT INTO t1 (f2) SELECT 'abcde ' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; - ---connection node_2 -INSERT INTO t1 (f2) SELECT 'fghij ' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; -SELECT COUNT(*) AS EXPECT_10000 FROM t1; - ---connection node_1a ---sleep 5 - ---exec find $datadir -type f-exec md5sum {} \; | md5sum >$MYSQLTEST_VARDIR/tmp/innodb_after - -SET GLOBAL innodb_disallow_writes=OFF; - ---connection node_1 ---reap ---let $wait_condition = SELECT COUNT(*) = 20000 FROM t1; ---source include/wait_condition.inc - -SELECT COUNT(*) AS EXPECT_20000 FROM t1; - ---connection node_2 ---let $wait_condition = SELECT COUNT(*) = 20000 FROM t1; ---source include/wait_condition.inc -SELECT COUNT(*) AS EXPECT_20000 FROM t1; - ---connection node_1 ---diff_files $MYSQLTEST_VARDIR/tmp/innodb_before $MYSQLTEST_VARDIR/tmp/innodb_after - ---connection node_2 - -DROP TABLE t1; -DROP TABLE ten; - ---disconnect node_1a - diff --git a/mysql-test/suite/galera/t/galera_var_max_ws_size.test b/mysql-test/suite/galera/t/galera_var_max_ws_size.test index 8eb93bda9be0b..9444b8f2c4d49 100644 --- a/mysql-test/suite/galera/t/galera_var_max_ws_size.test +++ b/mysql-test/suite/galera/t/galera_var_max_ws_size.test @@ -12,7 +12,7 @@ CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(1024)) Engine --let $wsrep_max_ws_size_orig = `SELECT @@wsrep_max_ws_size` SET GLOBAL wsrep_max_ws_size = 1024; ---error ER_ERROR_DURING_COMMIT +--error ER_UNKNOWN_ERROR INSERT INTO t1 VALUES (DEFAULT, REPEAT('X', 1024)); SELECT COUNT(*) = 0 FROM t1; diff --git a/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6-master.opt b/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6-master.opt new file mode 100644 index 0000000000000..99c5889916b29 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6-master.opt @@ -0,0 +1 @@ +--wsrep_notify_cmd=$MYSQL_TEST_DIR/std_data/wsrep_notify_ssl.sh --wsrep-sync-wait=0 diff --git a/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6.cnf b/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6.cnf new file mode 100644 index 0000000000000..db6f36605b745 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6.cnf @@ -0,0 +1,20 @@ +!include ../galera_2nodes.cnf + +[mysqld] +ssl-cert=@ENV.MYSQL_TEST_DIR/std_data/server-cert.pem +ssl-key=@ENV.MYSQL_TEST_DIR/std_data/server-key.pem +ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem +bind-address=:: + +[mysqld.1] +wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port;repl.causal_read_timeout=PT90S;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_incoming_address='[::1]:@mysqld.1.port' +wsrep_node_address=[::1]:@mysqld.1.#galera_port +wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' + +[mysqld.2] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port;repl.causal_read_timeout=PT90S;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_incoming_address='[::1]:@mysqld.2.port' +wsrep_node_address=[::1]:@mysqld.2.#galera_port +wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' diff --git a/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6.test b/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6.test new file mode 100644 index 0000000000000..2c2b106c2aedd --- /dev/null +++ b/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6.test @@ -0,0 +1,20 @@ +# +# Test wsrep_notify_cmd. We use a version of the support-files/wsrep_notify.sh script that writes +# notifications into a table. +# + +--source include/galera_cluster.inc +--source include/have_ssl_communication.inc +--source include/check_ipv6.inc +--source include/force_restart.inc + +--connection node_1 +--let $wait_condition = SELECT COUNT(DISTINCT uuid) = 2 FROM mtr_wsrep_notify.membership; +--source include/wait_condition.inc + +SELECT COUNT(DISTINCT uuid) AS EXPECT_2 FROM mtr_wsrep_notify.membership; +SELECT MAX(size) AS EXPECT_2 FROM mtr_wsrep_notify.status; +SELECT COUNT(DISTINCT idx) AS EXPECT_2 FROM mtr_wsrep_notify.status; + +# CLEANUP +DROP SCHEMA mtr_wsrep_notify; diff --git a/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test b/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test index c3bc53ee17fec..ac9a79e61962c 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test @@ -85,18 +85,15 @@ SELECT * FROM t1; DROP TABLE t1; # -# Transaction +# Preparation for next tests # --connection node_1 SET GLOBAL wsrep_sync_wait=15; CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=Aria; CREATE TABLE t2 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; -SET AUTOCOMMIT=OFF; -START TRANSACTION; INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); -COMMIT; --connection node_2 SET GLOBAL wsrep_sync_wait=15; @@ -108,6 +105,7 @@ SELECT COUNT(*) AS EXPECT_1 FROM t2; # --connection node_1 +SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES (2); INSERT INTO t2 VALUES (2); @@ -138,6 +136,8 @@ INSERT INTO t2 VALUES (1); INSERT INTO t1 VALUES (1); --connection node_1 + +--error ER_ERROR_DURING_COMMIT COMMIT; DROP TABLE t1,t2; diff --git a/mysql-test/suite/galera/t/galera_var_retry_autocommit.test b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test index 6bed1b0120f27..c58eba1410ed0 100644 --- a/mysql-test/suite/galera/t/galera_var_retry_autocommit.test +++ b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test @@ -25,12 +25,14 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; --connection node_2 +--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1' +--source include/wait_condition.inc TRUNCATE TABLE t1; --connection node_1 --error ER_LOCK_DEADLOCK --reap -SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) FROM t1; SET DEBUG_SYNC = 'RESET'; DROP TABLE t1; @@ -44,6 +46,7 @@ DROP TABLE t1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; SET SESSION wsrep_retry_autocommit = 1; +SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit'; SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue'; --send INSERT INTO t1 (f1) VALUES (3) @@ -51,13 +54,21 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; --connection node_2 +--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1' +--source include/wait_condition.inc TRUNCATE TABLE t1; +--connection node_1a +SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached'; +SELECT COUNT(*) FROM t1; +SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue'; + --connection node_1 --reap -SELECT COUNT(*) = 1 FROM t1; +SELECT COUNT(*) FROM t1; SET DEBUG_SYNC = 'RESET'; +SET GLOBAL debug_dbug = NULL; DROP TABLE t1; @@ -78,21 +89,23 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; --connection node_2 +--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1' +--source include/wait_condition.inc TRUNCATE TABLE t1; --connection node_1a SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached'; -SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) FROM t1; SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue WAIT_FOR before_cert'; --connection node_2 TRUNCATE TABLE t1; --connection node_1a -SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) FROM t1; --connection node_1 ---error ER_LOCK_DEADLOCK +--error 0,ER_LOCK_DEADLOCK --reap SET DEBUG_SYNC = 'RESET'; @@ -113,6 +126,11 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu --send INSERT INTO t1 VALUES (5) +--connection node_2 +--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1' +--source include/wait_condition.inc + +--connection node_1 --disable_query_log --disable_result_log --let $count = 64 @@ -126,7 +144,7 @@ while ($count) --connection node_1a SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached'; - SELECT COUNT(*) = 1 FROM t1; + SELECT COUNT(*) FROM t1; SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue'; --dec $count @@ -135,8 +153,9 @@ while ($count) --enable_query_log --connection node_1 +--error 0,ER_LOCK_DEADLOCK --reap -SELECT COUNT(*) = 1 FROM t1; +SELECT COUNT(*) FROM t1; SET DEBUG_SYNC = 'RESET'; SET GLOBAL debug_dbug = NULL; diff --git a/mysql-test/suite/galera/t/galera_var_wsrep_mode.test b/mysql-test/suite/galera/t/galera_var_wsrep_mode.test index 56953b1e71b8f..002dce0a05a99 100644 --- a/mysql-test/suite/galera/t/galera_var_wsrep_mode.test +++ b/mysql-test/suite/galera/t/galera_var_wsrep_mode.test @@ -22,7 +22,7 @@ SET GLOBAL wsrep_mode='A'; --error ER_WRONG_VALUE_FOR_VAR SET GLOBAL wsrep_mode=NULL; --error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL wsrep_mode=64; +SET GLOBAL wsrep_mode=128; --error ER_PARSE_ERROR SET GLOBAL wsrep_mode=REQUIRED_PRIMARY_KEY,REPLICATE_MYISAM; # diff --git a/mysql-test/suite/galera/t/galera_wan_restart_sst.test b/mysql-test/suite/galera/t/galera_wan_restart_sst.test index 0ded4032103a9..7a8c0df4946ba 100644 --- a/mysql-test/suite/galera/t/galera_wan_restart_sst.test +++ b/mysql-test/suite/galera/t/galera_wan_restart_sst.test @@ -12,7 +12,19 @@ --source include/galera_cluster.inc --source include/have_innodb.inc -SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--let $node_4=node_4 +--source include/auto_increment_offset_save.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --connection node_1 CREATE TABLE t1 (f1 INTEGER); @@ -21,11 +33,9 @@ INSERT INTO t1 VALUES (1); --connection node_2 INSERT INTO t1 VALUES (2); ---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connection node_3 INSERT INTO t1 VALUES (3); ---connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 --connection node_4 INSERT INTO t1 VALUES (4); @@ -136,3 +146,10 @@ CALL mtr.add_suppression("Action message in non-primary configuration from membe --connection node_4 CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); CALL mtr.add_suppression("Action message in non-primary configuration from member 0"); + +# Restore original auto_increment_offset values. +--source include/auto_increment_offset_restore.inc + +--connection node_1 +--disconnect node_3 +--disconnect node_4 diff --git a/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt b/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt deleted file mode 100644 index c31150c46af7e..0000000000000 --- a/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt +++ /dev/null @@ -1 +0,0 @@ ---wsrep-new-cluster diff --git a/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test index 84b6c032fc6b0..94ea008cb1658 100644 --- a/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test +++ b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test @@ -6,6 +6,34 @@ --source include/galera_cluster.inc +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--connection node_2 +--echo Shutting down server ... +--source include/shutdown_mysqld.inc + +--connection node_1 + +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--connection node_2 + +# +# Delete grastate.dat with safe_to_bootstrap: 0 +# +--echo Cleaning grastate.dat file ... +--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat + +--echo Starting server ... +--let $restart_noprint=2 +--let $start_mysqld_params="--wsrep-new-cluster" +--source include/start_mysqld.inc +--source include/wait_until_ready.inc + --connection node_1 --let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; @@ -37,3 +65,29 @@ SELECT (VARIABLE_VALUE = 0 OR VARIABLE_VALUE = 1 ) FROM INFORMATION_SCHEMA.GLOBA SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; + +--echo Shutting down server ... +--source include/shutdown_mysqld.inc + +# +# Force SST +# +--echo Cleaning var directory ... +--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mtr +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/performance_schema +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/test +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mysql +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data + +--echo Starting server ... +--let $start_mysqld_params= +--source include/start_mysqld.inc +--source include/wait_until_ready.inc + +--connection node_1 + +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/mariadb_tzinfo_to_sql.opt b/mysql-test/suite/galera/t/mariadb_tzinfo_to_sql.opt new file mode 100644 index 0000000000000..beae84b386292 --- /dev/null +++ b/mysql-test/suite/galera/t/mariadb_tzinfo_to_sql.opt @@ -0,0 +1 @@ +--log-bin diff --git a/mysql-test/suite/galera/t/mariadb_tzinfo_to_sql.test b/mysql-test/suite/galera/t/mariadb_tzinfo_to_sql.test new file mode 100644 index 0000000000000..eb5febb127a75 --- /dev/null +++ b/mysql-test/suite/galera/t/mariadb_tzinfo_to_sql.test @@ -0,0 +1,235 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/no_protocol.inc + +--echo # +--echo # MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases +--echo # + +--exec mkdir $MYSQLTEST_VARDIR/zoneinfo +--exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix +--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT + +--echo +--echo # On node_1 +--connection node_1 + +CREATE TABLE time_zone LIKE mysql.time_zone; +CREATE TABLE time_zone_name LIKE mysql.time_zone_name; +CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition; +CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type; +CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second; +ALTER TABLE time_zone_name ENGINE=MyISAM; +ALTER TABLE time_zone_transition_type ENGINE=MyISAM; + +SET @save_wsrep_mode=@@WSREP_MODE; + +--echo # +--echo # Run on zoneinfo directory --skip-write-binlog +--echo # + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>/dev/null > $MYSQL_TMP_DIR/tz.sql + +--echo +--echo # Apply on node_1 +--echo +--let $snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1) +--disable_query_log +CREATE TEMPORARY TABLE baseline AS + SELECT VARIABLE_NAME,VARIABLE_VALUE + FROM information_schema.global_status + WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE'); +--source $MYSQL_TMP_DIR/tz.sql +--enable_query_log +--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1) + +if ($snap_pos == $new_snap_pos) +{ +--echo 'binlog stationary as expected' +} +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN; +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff + FROM information_schema.global_status g + JOIN baseline b USING (VARIABLE_NAME) + ORDER BY g.VARIABLE_NAME; + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +--echo +--echo # On node_2 (not replicated) +--echo +--connection node_2 + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +--echo +--echo # Apply on node_1 +--echo +--connection node_1 + +SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM'; +--disable_query_log +CREATE OR REPLACE TEMPORARY TABLE baseline AS + SELECT VARIABLE_NAME,VARIABLE_VALUE + FROM information_schema.global_status + WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE'); +--source $MYSQL_TMP_DIR/tz.sql +--enable_query_log +--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1) + +if ($snap_pos == $new_snap_pos) +{ +--echo 'binlog stationary as expected' +} +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN; +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff + FROM information_schema.global_status g + JOIN baseline b USING (VARIABLE_NAME) + ORDER BY g.VARIABLE_NAME; + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +--echo +--echo # On node_2 (not replicated) +--echo +--connection node_2 + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +--echo # +--echo # Run on zoneinfo directory without --skip-write-binlog +--echo # + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>/dev/null > $MYSQL_TMP_DIR/tz.sql + +--echo +--echo # Apply on node_1 +--echo +--connection node_1 + +--disable_query_log +CREATE OR REPLACE TEMPORARY TABLE baseline AS + SELECT VARIABLE_NAME,VARIABLE_VALUE + FROM information_schema.global_status + WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE'); +--source $MYSQL_TMP_DIR/tz.sql +--enable_query_log +--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1) + +if ($snap_pos < $new_snap_pos) +{ +--echo 'binlog advanced as expected' +} +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN; +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff + FROM information_schema.global_status g + JOIN baseline b USING (VARIABLE_NAME) + ORDER BY g.VARIABLE_NAME; + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +--echo +--echo # On node_2 (replicated via ARIA) +--echo +--connection node_2 + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +TRUNCATE TABLE time_zone_leap_second; + +--echo +--echo # Apply on node_1 +--echo +--connection node_1 + +SET GLOBAL WSREP_MODE=''; +--let $snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1) +--disable_query_log +CREATE OR REPLACE TEMPORARY TABLE baseline AS + SELECT VARIABLE_NAME,VARIABLE_VALUE + FROM information_schema.global_status + WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE'); +--source $MYSQL_TMP_DIR/tz.sql +--enable_query_log +--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1) + +if ($snap_pos < $new_snap_pos) +{ +--echo 'binlog advanced as expected' +} +SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN; +SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff + FROM information_schema.global_status g + JOIN baseline b USING (VARIABLE_NAME) + ORDER BY g.VARIABLE_NAME; + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES +WHERE + TABLE_SCHEMA = DATABASE() + AND TABLE_NAME LIKE 'time_zone%' ORDER BY TABLE_NAME; + +--echo +--echo # On node_2 (replicated via InnoDB) +--echo +--connection node_2 + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +# +# Cleanup +# + +--connection node_1 +--remove_file $MYSQL_TMP_DIR/tz.sql +--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo +SET GLOBAL WSREP_MODE=@save_wsrep_mode; +DROP TABLE baseline; +DROP TABLE time_zone; +DROP TABLE time_zone_name; +DROP TABLE time_zone_transition; +DROP TABLE time_zone_transition_type; +DROP TABLE time_zone_leap_second; + +--echo # +--echo # End of 10.6 tests +--echo # diff --git a/mysql-test/suite/galera/t/mdev-26175.test b/mysql-test/suite/galera/t/mdev-26175.test new file mode 100644 index 0000000000000..1a3f1153e03cf --- /dev/null +++ b/mysql-test/suite/galera/t/mdev-26175.test @@ -0,0 +1,27 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# MDEV-26175 : Assertion `! thd->in_sub_stmt' failed in bool trans_rollback_stmt(THD*) +# +--connection node_1 +SET sql_mode="no_zero_date"; +SET GLOBAL wsrep_max_ws_rows=1; +CREATE TABLE t2 (a INT); +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TRIGGER tgr BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (0); + +--error ER_ERROR_DURING_COMMIT +INSERT INTO t1 VALUES (0),(1); +SELECT * FROM t1; +SELECT * FROM t2; + +--connection node_2 +SELECT * FROM t1; +SELECT * FROM t2; + +--connection node_1 +SET sql_mode=DEFAULT; +SET GLOBAL wsrep_max_ws_rows=DEFAULT; +DROP TRIGGER tgr; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/galera/t/mdev_10518.test b/mysql-test/suite/galera/t/mdev_10518.test index eec47507e3acb..4de1121ae778c 100644 --- a/mysql-test/suite/galera/t/mdev_10518.test +++ b/mysql-test/suite/galera/t/mdev_10518.test @@ -59,6 +59,8 @@ set global wsrep_on=OFF; reset master; set global wsrep_on=ON; +--connection node_2 +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); + --source include/galera_end.inc --echo # End of test - diff --git a/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.opt b/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.opt new file mode 100644 index 0000000000000..beae84b386292 --- /dev/null +++ b/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.opt @@ -0,0 +1 @@ +--log-bin diff --git a/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.test b/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.test new file mode 100644 index 0000000000000..6bfad2f18b592 --- /dev/null +++ b/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.test @@ -0,0 +1,156 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/not_embedded.inc +# merge note: 10.6 change not_embedded.inc to no_protocol.inc + +# Unlike the similar galera.mariadb_tzinfo_to_sql.test in 10.6+, this +# tests that the output can be parsed by the mysql client. +--echo # +--echo # MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases +--echo # + +--exec mkdir $MYSQLTEST_VARDIR/zoneinfo +--exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix +--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT + +--echo +--echo # On node_1 +--connection node_1 + +CREATE TABLE time_zone LIKE mysql.time_zone; +CREATE TABLE time_zone_name LIKE mysql.time_zone_name; +CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition; +CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type; +CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second; + +--echo # +--echo # Run on zoneinfo directory --skip-write-binlog +--echo # + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>/dev/null > $MYSQL_TMP_DIR/tz.sql + +--echo +--echo # Apply on node_1 +--echo +--let $snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1) +--echo load timezones +--exec $MYSQL test < "$MYSQL_TMP_DIR/tz.sql" +--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1) + +if ($snap_pos == $new_snap_pos) +{ +--echo 'binlog stationary as expected' +} + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +--echo +--echo # On node_2 (not replicated) +--echo +--connection node_2 + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +--echo # +--echo # Run on zoneinfo directory without --skip-write-binlog +--echo # + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>/dev/null > $MYSQL_TMP_DIR/tz.sql + +--echo +--echo # Apply on node_1 +--echo +--connection node_1 + +--echo load timezones +--exec $MYSQL test < "$MYSQL_TMP_DIR/tz.sql" +--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1) + +if ($snap_pos < $new_snap_pos) +{ +--echo 'binlog advanced as expected' +} + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +--echo +--echo # On node_2 (replicated via InnoDB) +--echo +--connection node_2 + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +TRUNCATE TABLE time_zone_leap_second; + +--echo +--echo # Apply on node_1 (with wsrep_on=OFF) +--echo +--connection node_1 + +SET GLOBAL WSREP_ON=OFF; +--let $snap_pos= $new_snap_pos +--echo load timezones +--exec $MYSQL test < "$MYSQL_TMP_DIR/tz.sql" +--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1) +SET GLOBAL WSREP_ON=ON; + +if ($snap_pos < $new_snap_pos) +{ +--echo 'binlog advanced as expected' +} + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +--echo +--echo # On node_2 (Should not have been replicated) +--echo +--connection node_2 + +SELECT COUNT(*) FROM time_zone; +SELECT COUNT(*) FROM time_zone_name; +SELECT COUNT(*) FROM time_zone_transition; +SELECT COUNT(*) FROM time_zone_transition_type; +SELECT COUNT(*) FROM time_zone_leap_second; + +# +# Cleanup +# + +--connection node_1 +--remove_file $MYSQL_TMP_DIR/tz.sql +--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo +DROP TABLE time_zone; +DROP TABLE time_zone_name; +DROP TABLE time_zone_transition; +DROP TABLE time_zone_transition_type; +DROP TABLE time_zone_leap_second; + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/suite/galera/t/query_cache.cnf b/mysql-test/suite/galera/t/query_cache.cnf deleted file mode 100644 index 4a82e9fa0375a..0000000000000 --- a/mysql-test/suite/galera/t/query_cache.cnf +++ /dev/null @@ -1,9 +0,0 @@ -!include ../galera_2nodes.cnf - -[mysqld.1] -query_cache_type=1 - -[mysqld.2] -query_cache_type=1 - - diff --git a/mysql-test/suite/galera/t/query_cache.test b/mysql-test/suite/galera/t/query_cache.test deleted file mode 100644 index aeec67fb576b5..0000000000000 --- a/mysql-test/suite/galera/t/query_cache.test +++ /dev/null @@ -1,1112 +0,0 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc ---source include/have_query_cache.inc - ---echo ---echo # Execute FLUSH/RESET commands. ---echo # On node-1 ---connection node_1 -SET @query_cache_size_saved=@@GLOBAL.query_cache_size; -SET @query_cache_type_saved=@@GLOBAL.query_cache_type; -set GLOBAL query_cache_size=1355776; -flush query cache; # This crashed in some versions -reset query cache; -flush status; - ---echo # On node-2 ---connection node_2 -SET @query_cache_size_saved=@@GLOBAL.query_cache_size; -SET @query_cache_type_saved=@@GLOBAL.query_cache_type; -set GLOBAL query_cache_size=1355776; -flush query cache; # This crashed in some versions -reset query cache; -flush status; - -# -# INSERT/UPDATE/DELETE/DROP/SELECT -# - ---echo # On node-1 ---connection node_1 -create table t1 (a int not null) engine=innodb; -insert into t1 values (1),(2),(3); -select * from t1; -select * from t1; -select sql_no_cache * from t1; -select length(now()) from t1; - -show status like "Qcache_queries_in_cache"; -show status like "Qcache_inserts"; -show status like "Qcache_hits"; - ---echo # On node-2 ---connection node_2 - -select * from t1; -select * from t1; -select sql_no_cache * from t1; -select length(now()) from t1; - -show status like "Qcache_queries_in_cache"; -show status like "Qcache_inserts"; -show status like "Qcache_hits"; - -# DELETE should invalidate cache on both the nodes. ---echo # On node-1 ---connection node_1 -delete from t1 where a=1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - ---echo # On node-2 ---connection node_2 -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - -# Add a SELECT to the cache. ---echo # On node-1 ---connection node_1 -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - ---echo # On node-2 ---connection node_2 -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - -# UPDATE should invalidate cache on both the nodes. ---echo # On node-1 ---connection node_1 -update t1 set a=1 where a=3; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - ---echo # On node-2 ---connection node_2 -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - -# Add a SELECT to the cache. ---echo # On node-1 ---connection node_1 -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - ---echo # On node-2 ---connection node_2 -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - -# DROP should invalidate cache on both the nodes. ---echo # On node-1 ---connection node_1 -drop table t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - ---echo # On node-2 ---connection node_2 -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - -# -# MERGE TABLES with INSERT/UPDATE and DELETE -# ---echo ---echo # On node-1 ---connection node_1 -create table t1 (a int not null) ENGINE=MyISAM; -insert into t1 values (1),(2),(3); -create table t2 (a int not null) ENGINE=MyISAM; -insert into t2 values (4),(5),(6); -create table t3 (a int not null) engine=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST; -# insert -select * from t3; -select * from t3; -show status like "Qcache_hits"; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -insert into t2 values (7); -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -select * from t1; -select * from t1; -show status like "Qcache_hits"; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -insert into t3 values (8); -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -# update -select * from t3; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -update t2 set a=9 where a=7; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -update t3 set a=10 where a=1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -#delete -select * from t3; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -delete from t2 where a=9; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -delete from t3 where a=10; -select * from t3; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - ---echo # On node-2 ---connection node_2 -# MERGE table, expect no records. -select * from t3; -select * from t3; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_inserts"; -show status like "Qcache_hits"; - -drop table t1, t2, t3; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - -# -# SELECT SQL_CACHE ... -# ---echo # On node-1 ---connection node_1 -set query_cache_type=demand; -create table t1 (a int not null) engine=innodb; -insert into t1 values (1),(2),(3); -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -select sql_cache * from t1 union select * from t1; -set query_cache_type=2; -select sql_cache * from t1 union select * from t1; -show status like "Qcache_hits"; -show status like "Qcache_queries_in_cache"; -set query_cache_type=on; - ---echo # On node-2 ---connection node_2 -set query_cache_type=demand; -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -select sql_cache * from t1 union select * from t1; -set query_cache_type=2; -select sql_cache * from t1 union select * from t1; -show status like "Qcache_hits"; -show status like "Qcache_queries_in_cache"; -set query_cache_type=on; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - -# -# SELECT SQL_NO_CACHE -# ---echo # On node-1 ---connection node_1 -select sql_no_cache * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; ---echo # On node-2 ---connection node_2 -select sql_no_cache * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -drop table t1; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - -# -# Check that queries that uses NOW(), LAST_INSERT_ID()... are not cached. -# ---echo # On node-1 ---connection node_1 -create table t1 (a text not null) engine=innodb; -select CONNECTION_ID() from t1; -select FOUND_ROWS(); -select NOW() from t1; -select CURDATE() from t1; -select CURTIME() from t1; -select DATABASE() from t1; -select ENCRYPT("test") from t1; -select LAST_INSERT_ID() from t1; -select RAND() from t1; -select UNIX_TIMESTAMP() from t1; -select USER() from t1; -select CURRENT_USER() from t1; -select benchmark(1,1) from t1; -explain extended select benchmark(1,1) from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; ---echo # On node-2 ---connection node_2 -select CONNECTION_ID() from t1; -select FOUND_ROWS(); -select NOW() from t1; -select CURDATE() from t1; -select CURTIME() from t1; -select DATABASE() from t1; -select ENCRYPT("test") from t1; -select LAST_INSERT_ID() from t1; -select RAND() from t1; -select UNIX_TIMESTAMP() from t1; -select USER() from t1; -select CURRENT_USER() from t1; -select benchmark(1,1) from t1; -explain extended select benchmark(1,1) from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -drop table t1; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - -# -# Non-cachable ODBC work around (and prepare cache for drop database) -# ---echo # On node-1 ---connection node_1 -create database mysqltest; -create table mysqltest.t1 (i int not null auto_increment, a int, primary key - (i)) engine=innodb; -insert into mysqltest.t1 values (1, 1); -select * from mysqltest.t1 where i is null; -create table t1(a int) engine=innodb; -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -select * from mysqltest.t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - ---echo # On node-2 ---connection node_2 -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -select * from mysqltest.t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -# -# drop db -# -drop database mysqltest; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -drop table t1; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - -# -# Charset conversion (cp1251_koi8 always present) -# Note: Queries using different default character sets are cached separately. -# ---echo # On node-1 ---connection node_1 -create table t1 (a char(1) not null collate koi8r_general_ci) engine=innodb; -insert into t1 values(_koi8r 0xc3); -set CHARACTER SET koi8r; -select * from t1; -set CHARACTER SET cp1251_koi8; -select * from t1; -set CHARACTER SET DEFAULT; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - ---echo # On node-2 ---connection node_2 -set CHARACTER SET koi8r; -select * from t1; -set CHARACTER SET cp1251_koi8; -select * from t1; -set CHARACTER SET DEFAULT; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -drop table t1; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - -# -# Same tables in different dbs -# ---echo # On node-1 ---connection node_1 -create database if not exists mysqltest; -create table mysqltest.t1 (i int not null) engine=innodb; -create table t1 (i int not null) engine=innodb; -insert into mysqltest.t1 (i) values (1); -insert into t1 (i) values (2); - -select * from t1; -use mysqltest; -select * from t1; -select * from t1; -use test; -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - ---echo # On node-2 ---connection node_2 -select * from t1; -use mysqltest; -select * from t1; -select * from t1; -use test; -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -drop database mysqltest; -drop table t1; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - -# -# FOUND_ROWS() -# ---echo # On node-1 ---connection node_1 -create table t1 (i int not null) engine=innodb; -insert into t1 (i) values (1),(2),(3),(4); - -select SQL_CALC_FOUND_ROWS * from t1 limit 2; -select FOUND_ROWS(); -show status like "Qcache_hits"; -show status like "Qcache_queries_in_cache"; - -select * from t1 where i=1; -select FOUND_ROWS(); -show status like "Qcache_hits"; -show status like "Qcache_queries_in_cache"; - -select SQL_CALC_FOUND_ROWS * from t1 limit 2; -select FOUND_ROWS(); -show status like "Qcache_hits"; -show status like "Qcache_queries_in_cache"; - -select * from t1 where i=1; -select FOUND_ROWS(); -show status like "Qcache_hits"; -show status like "Qcache_queries_in_cache"; - ---echo # On node-2 ---connection node_2 -select SQL_CALC_FOUND_ROWS * from t1 limit 2; -select FOUND_ROWS(); -show status like "Qcache_hits"; -show status like "Qcache_queries_in_cache"; - -select * from t1 where i=1; -select FOUND_ROWS(); -show status like "Qcache_hits"; -show status like "Qcache_queries_in_cache"; - -select SQL_CALC_FOUND_ROWS * from t1 limit 2; -select FOUND_ROWS(); -show status like "Qcache_hits"; -show status like "Qcache_queries_in_cache"; - -select * from t1 where i=1; -select FOUND_ROWS(); -show status like "Qcache_hits"; -show status like "Qcache_queries_in_cache"; - -drop table t1; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - -# -# Test insert delayed (MYISAM) -# - ---echo # On node-2 ---connection node_2 -flush query cache; -reset query cache; - ---echo # On node-1 ---connection node_1 -flush query cache; -reset query cache; - -create table t1 (a int not null) ENGINE=MYISAM; -insert into t1 values (1),(2),(3); -select * from t1; -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; -insert delayed into t1 values (4); ---sleep 5 # Wait for insert delayed to be executed. -select a from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - ---echo # On node-2 ---connection node_2 -select * from t1; -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -insert delayed into t1 values (4); ---sleep 5 # Wait for insert delayed to be executed. -select a from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - -drop table t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - ---echo # On node-1 ---connection node_1 -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; - -# -# Test of min result data unit size changing -# ---echo # On node-2 ---connection node_2 -show global variables like "query_cache_min_res_unit"; -set GLOBAL query_cache_min_res_unit=1001; -show global variables like "query_cache_min_res_unit"; - ---echo # On node-1 ---connection node_1 -show global variables like "query_cache_min_res_unit"; -set GLOBAL query_cache_min_res_unit=1001; -show global variables like "query_cache_min_res_unit"; -create table t1 (a int not null) engine=innodb; -insert into t1 values (1),(2),(3); -create table t2 (a int not null) engine=innodb; -insert into t2 values (1),(2),(3); -select * from t1; -select * from t1; -select * from t2; -select * from t2; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; - ---echo # On node-2 ---connection node_2 -select * from t1; -select * from t1; -select * from t2; -select * from t2; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -drop table t1; -select a from t2; -select a from t2; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; -set GLOBAL query_cache_min_res_unit=default; -show global variables like "query_cache_min_res_unit"; - ---echo # On node-1 ---connection node_1 -select a from t2; -select a from t2; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; -drop table t2; -set GLOBAL query_cache_min_res_unit=default; -show global variables like "query_cache_min_res_unit"; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - -# -# Case sensitive test -# ---echo # On node-1 ---connection node_1 -create table t1 (a int not null) engine=innodb; -insert into t1 values (1); -select "aaa" from t1; -select "AAA" from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; - ---echo # On node-2 ---connection node_2 -select "aaa" from t1; -select "AAA" from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; -drop table t1; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - -# -# Test of query cache resizing -# ---echo # On node-1 ---connection node_1 -create table t1 (a int) engine=innodb; -set GLOBAL query_cache_size=1000; -show global variables like "query_cache_size"; -select * from t1; -set GLOBAL query_cache_size=1024; -show global variables like "query_cache_size"; -select * from t1; -set GLOBAL query_cache_size=10240; -show global variables like "query_cache_size"; -select * from t1; -set GLOBAL query_cache_size=20480; -show global variables like "query_cache_size"; -select * from t1; -set GLOBAL query_cache_size=40960; -show global variables like "query_cache_size"; -select * from t1; -set GLOBAL query_cache_size=51200; -show global variables like "query_cache_size"; -select * from t1; -set GLOBAL query_cache_size=61440; -show global variables like "query_cache_size"; -select * from t1; -set GLOBAL query_cache_size=81920; -show global variables like "query_cache_size"; -select * from t1; -set GLOBAL query_cache_size=102400; -show global variables like "query_cache_size"; -select * from t1; - ---echo # On node-2 ---connection node_2 -set GLOBAL query_cache_size=1000; -show global variables like "query_cache_size"; -select * from t1; -set GLOBAL query_cache_size=1024; -show global variables like "query_cache_size"; -select * from t1; -set GLOBAL query_cache_size=10240; -show global variables like "query_cache_size"; -select * from t1; -set GLOBAL query_cache_size=20480; -show global variables like "query_cache_size"; -select * from t1; -set GLOBAL query_cache_size=40960; -show global variables like "query_cache_size"; -select * from t1; -set GLOBAL query_cache_size=51200; -show global variables like "query_cache_size"; -select * from t1; -set GLOBAL query_cache_size=61440; -show global variables like "query_cache_size"; -select * from t1; -set GLOBAL query_cache_size=81920; -show global variables like "query_cache_size"; -select * from t1; -set GLOBAL query_cache_size=102400; -show global variables like "query_cache_size"; -select * from t1; - -drop table t1; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - -# -# Temporary tables (ignored by Galera) -# ---echo # On node-1 ---connection node_1 -set GLOBAL query_cache_size=1048576; -create table t1 (i int not null) engine=innodb; -create table t2 (i int not null) engine=innodb; -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -create temporary table t3 (i int not null); -select * from t2; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -select * from t3; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -update t1 set i=(select distinct 1 from (select * from t2) a); -drop table t3; - ---echo # On node-2 ---connection node_2 -set GLOBAL query_cache_size=1048576; -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -select * from t2; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - -drop table t1, t2; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - -# -# System databse test (no need to perform it on node_2) -# Note: Queries on system tables are not cached. -# ---echo # On node-1 ---connection node_1 -use mysql; -disable_result_log; -select * from db; -enable_result_log; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -use test; -disable_result_log; -select * from mysql.db; -enable_result_log; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - -# -# Simple rename test -# ---echo # On node-1 ---connection node_1 -create table t1(id int auto_increment primary key) engine=innodb; -insert into t1 values (1), (2), (3); -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - ---echo # On node-2 ---connection node_2 -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - ---echo # On node-1 ---connection node_1 -alter table t1 rename to t2; ---error ER_NO_SUCH_TABLE -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - ---echo # On node-2 ---connection node_2 ---error ER_NO_SUCH_TABLE -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -drop table t2; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - -# -# Load data invalidation test -# ---echo # On node-1 ---connection node_1 -create table t1 (word char(20) not null) engine=innodb; -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval load data infile '$MYSQLTEST_VARDIR/std_data/words.dat' into table t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; ---let $wait_condition = SELECT COUNT(*) = 70 FROM t1; ---source include/wait_condition.inc - ---echo # On node-2 ---connection node_2 ---let $wait_condition = SELECT COUNT(*) = 70 FROM t1; ---source include/wait_condition.inc -select count(*) from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval load data infile '$MYSQLTEST_VARDIR/std_data/words.dat' into table t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -select count(*) from t1; - -drop table t1; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - ---echo # ---echo # INTO OUTFILE/DUMPFILE test ---echo # ---echo # On node-1 ---connection node_1 -create table t1 (a int) engine=innodb; -insert into t1 values (1),(2),(3); -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -select * from t1 into outfile "query_cache.out.file"; ---error ER_FILE_EXISTS_ERROR -select * from t1 into outfile "query_cache.out.file"; -select * from t1 limit 1 into dumpfile "query_cache.dump.file"; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; -drop table t1; -let $datadir=`select @@datadir`; ---remove_file $datadir/test/query_cache.dump.file ---remove_file $datadir/test/query_cache.out.file - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - ---echo # ---echo # Test of SQL_SELECT_LIMIT ---echo # ---echo # On node-1 ---connection node_1 -create table t1 (a int) engine=innodb; -insert into t1 values (1),(2); -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -select * from t1; -SET SQL_SELECT_LIMIT=1; -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; -SET SQL_SELECT_LIMIT=DEFAULT; - ---echo # On node-2 ---connection node_2 -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -select * from t1; -SET SQL_SELECT_LIMIT=1; -select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -SET SQL_SELECT_LIMIT=DEFAULT; - -drop table t1; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - ---echo # ---echo # WRITE LOCK & QC ---echo # ---echo # On node-1 ---connection node_1 -create table t1 (a int not null) engine=innodb; -create table t2 (a int not null) engine=innodb; - -set query_cache_wlock_invalidate=1; -create view v1 as select * from t1; -select * from t1; -select * from t2; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; -lock table t1 write, t2 read; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -unlock table; -select * from t1; -# Implicit locking of t1 does not invalidate QC -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -lock table v1 write; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; -unlock table; -drop view v1; -set query_cache_wlock_invalidate=default; - ---echo # On node-2 ---connection node_2 -set query_cache_wlock_invalidate=1; -create view v1 as select * from t1; -select * from t1; -select * from t2; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -lock table t1 write, t2 read; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -unlock table; -select * from t1; -# Implicit locking of t1 does not invalidate QC -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -lock table v1 write; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; -unlock table; -drop view v1; -set query_cache_wlock_invalidate=default; - -drop table t1,t2; - ---echo # ---echo # Hiding real table stored in query cache by temporary table ---echo # ---echo # On node-1 ---connection node_1 -create table t1 (id int primary key) engine=innodb; -insert into t1 values (1),(2),(3); -select * from t1; -create temporary table t1 (a int not null auto_increment primary key); -select * from t1; -drop table t1; -drop table t1; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - -# -# Test character set related variables: -# character_set_result -# character_set_client -# charactet_set_connection/collation_connection -# If at least one of the above variables has changed, -# the cached query can't be reused. In the below test -# absolutely the same query is used several times, -# SELECT should fetch different results for every instance. -# No hits should be produced. -# New cache entry should appear for every SELECT. -# - ---echo # On node-1 ---connection node_1 -SET NAMES koi8r; -CREATE TABLE t1 (a char(1) character set koi8r) engine=innodb; -INSERT INTO t1 VALUES (_koi8r 0xc3),(_koi8r 0xc3); -# -# Run select -# -SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; -# -# Change collation_connection and run the same query again -# -set collation_connection=koi8r_bin; -SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; -# -# Now change character_set_client and run the same query again -# -set character_set_client=cp1251; -SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; -# -# And finally change character_set_results and run the same query again -# -set character_set_results=cp1251; -SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; -SET NAMES default; - ---echo # On node-2 ---connection node_2 - ---echo # ---echo # Run select ---echo # - -SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -# -# Change collation_connection and run the same query again -# -set collation_connection=koi8r_bin; -SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; -# -# Now change character_set_client and run the same query again -# -set character_set_client=cp1251; -SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; -# -# And finally change character_set_results and run the same query again -# -set character_set_results=cp1251; -SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -show status like "Qcache_inserts"; - -drop table t1; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - ---echo # ---echo # Comments before command ---echo # - ---echo # On node-1 ---connection node_1 -create table t1 (a int) engine=innodb; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -/**/ select * from t1; -/**/ select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - ---echo # On node-2 ---connection node_2 -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -/**/ select * from t1; -/**/ select * from t1; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; - -drop table t1; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - ---echo # ---echo # Information schema & query cache test ---echo # - ---echo # On node-1 ---connection node_1 -set session query_cache_type = 2; -create table t1(a int) engine=innodb; -select table_name from information_schema.tables -where table_schema="test"; -drop table t1; -select table_name from information_schema.tables -where table_schema="test"; -# Bug #8480: REPAIR TABLE needs to flush the table from the query cache -set session query_cache_type = 1; -set global query_cache_size=1024*1024; -flush query cache; -create table t1 ( a int ) engine=myisam; # myisam for repair tables -insert into t1 values (1); -select a from t1; -select a from t1; -show status like 'qcache_queries_in_cache'; -show status like "Qcache_hits"; -repair table t1; -show status like 'qcache_queries_in_cache'; -show status like "Qcache_hits"; - ---echo # On node-2 ---connection node_2 -select a from t1; -select a from t1; -show status like 'qcache_queries_in_cache'; -show status like "Qcache_hits"; -repair table t1; -show status like 'qcache_queries_in_cache'; -show status like "Qcache_hits"; -drop table t1; - -# -# RESET QUERY CACHE -# ---source include/reset_query_cache.inc - ---echo # Restore original settings. ---echo # On node-1 ---connection node_1 -SET GLOBAL query_cache_size=@query_cache_size_saved; -SET GLOBAL query_cache_type=@query_cache_type_saved; ---echo ---echo # On node-2 ---connection node_2 -SET GLOBAL query_cache_size=@query_cache_size_saved; -SET GLOBAL query_cache_type=@query_cache_type_saved; - ---echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_slave_threads_basic.test b/mysql-test/suite/galera/t/wsrep_slave_threads_basic.test similarity index 96% rename from mysql-test/suite/sys_vars/t/wsrep_slave_threads_basic.test rename to mysql-test/suite/galera/t/wsrep_slave_threads_basic.test index 80b4648982d08..ecf159f836529 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_slave_threads_basic.test +++ b/mysql-test/suite/galera/t/wsrep_slave_threads_basic.test @@ -1,4 +1,4 @@ ---source include/have_wsrep.inc +--source include/galera_cluster.inc --echo # --echo # wsrep_slave_threads diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index 0638dd1e3bc02..b51d221e72fff 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -10,25 +10,16 @@ # ############################################################################## -GAL-501 : MDEV-24645 galera_3nodes.GAL-501 MTR failed: failed to open gcomm backend connection: 110 -GCF-354 : MDEV-25614 Galera test failure on GCF-354 -galera_gtid_2_cluster : MDEV-23775 Galera test failure on galera_3nodes.galera_gtid_2_cluster -galera_ist_gcache_rollover : MDEV-23578 WSREP: exception caused by message: {v=0,t=1,ut=255,o=4,s=0,sr=0,as=1,f=6,src=50524cfe,srcvid=view_id(REG,50524cfe,4),insvid=view_id(UNKNOWN,00000000,0),ru=00000000,r=[-1,-1],fs=75,nl=(} -galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to server during query -galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to server during query -galera_pc_bootstrap : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed -galera_safe_to_bootstrap : MDEV-24097 galera_3nodes.galera_safe_to_bootstrap MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed -galera_slave_options_do : MDEV-8798 -galera_slave_options_ignore : MDEV-8798 -galera_vote_rejoin_mysqldump : MDEV-24481: galera_3nodes.galera_vote_rejoin_mysqldump MTR failed: mysql_shutdown failed -galera_ipv6_mysqldump : MDEV-26499: galera_3nodes.galera_ipv6_mysqldump MTR failed: mysql_shutdown failed +galera_2_cluster : MDEV-29877 Galera test failure on galera_2_cluster +galera_gtid_2_cluster : MDEV-29877 Galera test failure on galera_2_cluster galera_ipv6_mariabackup : MDEV-24097 galera_ipv6_mariabackup_section : MDEV-24097, MDEV-22195 -galera_wsrep_schema : MDEV-26503 : galera_3nodes.galera_wsrep_schema MTR failed: mysql_shutdown failed -galera_ipv6_mariabackup : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed -galera_ipv6_mariabackup_section : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed -galera_ipv6_rsync : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed -galera_ipv6_rsync_section : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed -galera_ssl_reload : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed -galera_toi_vote : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed -galera_wsrep_schema_init : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed +galera_vote_rejoin_mysqldump : MDEV-24481: galera_3nodes.galera_vote_rejoin_mysqldump MTR failed: mysql_shutdown failed +galera_ssl_reload : MDEV-30172 At line 50: mysql_shutdown failed +GCF-354 : mysqltest: At line 39: query 'DROP TABLE test.t1' failed: 1047: WSREP has not yet prepared node for application use +GCF-354 : mysqltest: At line 30: query 'INSERT INTO test.t1 values (1)' failed: 1180: Got error 6 "No such device or address" +galera_ipv6_mysqldump : mysql_shutdown failed +# Opensuse/suse/rocky9/rocky84/rhel9/rhel8-ppc64le .. - all same IPv6 isn't configured right or skipping or galera +galera_ipv6_mysqldump : Can't connect to server on '::1' (115) +galera_ipv6_rsync : Can't connect to server on '::1' (115) +galera_ipv6_rsync_section : Can't connect to server on '::1' (115) diff --git a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf index 3a3c43781d54c..cd7a892f4c911 100644 --- a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf @@ -2,7 +2,8 @@ !include include/default_mysqld.cnf [mysqld] -log-bin +loose-innodb +log-bin=mysqld-bin log-slave-updates binlog-format=row innodb-autoinc-lock-mode=2 @@ -12,83 +13,73 @@ gtid_ignore_duplicates auto_increment_increment=3 wsrep-provider=@ENV.WSREP_PROVIDER -wsrep_node_address=127.0.0.1 # enforce read-committed characteristics across the cluster +# wsrep-causal-reads=ON wsrep-sync-wait=15 [mysqld.1] +wsrep-on=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 -wsrep-cluster-address='gcomm://' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT30S;evs.inactive_timeout=PT90S;evs.install_timeout=PT60S;pc.wait_prim_timeout = PT60S' - -wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port +wsrep_cluster_address=gcomm:// +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' [mysqld.2] +wsrep-on=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT30S;evs.inactive_timeout=PT90S;evs.install_timeout=PT60S;pc.wait_prim_timeout = PT60S' - -wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' [mysqld.3] +wsrep-on=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT30S;evs.inactive_timeout=PT90S;evs.install_timeout=PT60S;pc.wait_prim_timeout = PT60S' - -wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' - [mysqld.4] -wsrep_cluster_name=cluster2 +wsrep-on=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 -wsrep-cluster-address='gcomm://' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT30S;evs.inactive_timeout=PT90S;evs.install_timeout=PT60S;pc.wait_prim_timeout = PT60S' - -wsrep_sst_receive_address=127.0.0.2:@mysqld.4.#sst_port +wsrep_cluster_address=gcomm:// +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.4.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port' [mysqld.5] -wsrep_cluster_name=cluster2 +wsrep-on=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.4.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.5.#galera_port;evs.suspect_timeout=PT30S;evs.inactive_timeout=PT90S;evs.install_timeout=PT60S;pc.wait_prim_timeout = PT60S' - -wsrep_sst_receive_address=127.0.0.2:@mysqld.5.#sst_port +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.5.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.5.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.5.port wsrep_sst_receive_address='127.0.0.1:@mysqld.5.#sst_port' [mysqld.6] -wsrep_cluster_name=cluster2 +wsrep-on=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.4.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.6.#galera_port;evs.suspect_timeout=PT30S;evs.inactive_timeout=PT90S;evs.install_timeout=PT60S;pc.wait_prim_timeout = PT60S' - -wsrep_sst_receive_address=127.0.0.2:@mysqld.6.#sst_port +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.6.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.6.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.6.port wsrep_sst_receive_address='127.0.0.1:@mysqld.6.#sst_port' diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf index d33ed0caddff0..a7dd4d21bc734 100644 --- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf @@ -2,51 +2,47 @@ !include include/default_mysqld.cnf [mysqld] +loose-innodb binlog-format=row innodb-autoinc-lock-mode=2 default-storage-engine=innodb auto_increment_increment=3 wsrep-provider=@ENV.WSREP_PROVIDER -wsrep_node_address=127.0.0.1 # enforce read-committed characteristics across the cluster -wsrep-causal-reads=ON +# wsrep-causal-reads=ON wsrep-sync-wait=15 [mysqld.1] +wsrep-on=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -#wsrep-new-cluster -wsrep-on=1 -wsrep-cluster-address='gcomm://' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S' - -wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port +wsrep_cluster_address=gcomm:// +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' [mysqld.2] +wsrep-on=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S' - -wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' [mysqld.3] +wsrep-on=1 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep-on=1 wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S' - -wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' diff --git a/mysql-test/suite/galera_3nodes/r/GCF-363.result b/mysql-test/suite/galera_3nodes/r/GCF-363.result index fbcbac3a39824..fb235aceb772f 100644 --- a/mysql-test/suite/galera_3nodes/r/GCF-363.result +++ b/mysql-test/suite/galera_3nodes/r/GCF-363.result @@ -6,7 +6,6 @@ connection node_2; connection node_3; connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) ENGINE=InnoDB; -connection node_1; SET GLOBAL wsrep_on=OFF; INSERT INTO t1 VALUES (1, 'a'); SET GLOBAL wsrep_on=ON; @@ -48,3 +47,4 @@ connection node_3; CALL mtr.add_suppression("WSREP: Vote 0 \\\(success\\\) on (.*) is inconsistent with group. Leaving cluster."); CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on "); CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); +connection node_1; diff --git a/mysql-test/suite/galera_3nodes/r/MDEV-29171.result b/mysql-test/suite/galera_3nodes/r/MDEV-29171.result new file mode 100644 index 0000000000000..151be86d9cc6d --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/MDEV-29171.result @@ -0,0 +1,41 @@ +connection node_2; +connection node_1; +connection node_1; +select @@wsrep_gtid_domain_id,@@wsrep_node_name; +@@wsrep_gtid_domain_id @@wsrep_node_name +100 node1 +connection node_2; +select @@wsrep_gtid_domain_id,@@wsrep_node_name; +@@wsrep_gtid_domain_id @@wsrep_node_name +100 node2 +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_3; +select @@wsrep_gtid_domain_id,@@wsrep_node_name; +@@wsrep_gtid_domain_id @@wsrep_node_name +100 node3 +connection node_3; +connection node_2; +connection node_1; +connection node_1; +# restart: --wsrep_new_cluster --wsrep_gtid_domain_id=200 +show variables like 'wsrep_gtid_domain_id'; +Variable_name Value +wsrep_gtid_domain_id 200 +connection node_2; +# restart +show variables like 'wsrep_gtid_domain_id'; +Variable_name Value +wsrep_gtid_domain_id 200 +connection node_3; +# restart: --wsrep_sst_donor=node2 +show variables like 'wsrep_gtid_domain_id'; +Variable_name Value +wsrep_gtid_domain_id 200 +connection node_1; +set global wsrep_gtid_domain_id=100; +connection node_2; +set global wsrep_gtid_domain_id=100; +CALL mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); +connection node_3; +set global wsrep_gtid_domain_id=100; +CALL mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result b/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result index 87898891f9b89..5214eafa1c896 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result +++ b/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result @@ -75,15 +75,19 @@ connection node_2; SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); connection node_3; SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); connection node_5; SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); connection node_6; SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); diff --git a/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result b/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result new file mode 100644 index 0000000000000..4a5e9a4530c07 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result @@ -0,0 +1,41 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +SET GLOBAL innodb_max_dirty_pages_pct=99; +SET GLOBAL innodb_max_dirty_pages_pct_lwm=99; +connection node_1; +CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB; +CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +INSERT INTO t1 (f2) SELECT REPEAT('x', 1024) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; +connection node_2; +Killing node #3 to free ports for garbd ... +connection node_3; +connection node_1; +SET GLOBAL debug_dbug = "+d,sync.wsrep_donor_state"; +Starting garbd ... +SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_donor_state_reached"; +SET GLOBAL innodb_max_dirty_pages_pct_lwm=0; +SET GLOBAL innodb_max_dirty_pages_pct=0; +SET SESSION debug_sync = "now SIGNAL signal.wsrep_donor_state"; +SET GLOBAL debug_dbug = ""; +SET debug_sync='RESET'; +connection node_2; +Killing garbd ... +connection node_1; +connection node_2; +DROP TABLE t1; +DROP TABLE ten; +Restarting node #3 to satisfy MTR's end-of-test checks +connection node_3; +connection node_1; +connection node_1; +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); +connection node_2; +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); +connection node_3; +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); diff --git a/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result index 2138f48addaf6..5d4b1d43fd687 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result +++ b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result @@ -65,5 +65,5 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, PRIMARY KEY (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_slave_options_do.result b/mysql-test/suite/galera_3nodes/r/galera_slave_options_do.result deleted file mode 100644 index 7185e92863d8c..0000000000000 --- a/mysql-test/suite/galera_3nodes/r/galera_slave_options_do.result +++ /dev/null @@ -1,28 +0,0 @@ -CREATE DATABASE db1; -CREATE DATABASE db2; -CREATE TABLE db1.t1 (f1 INTEGER) ENGINE=InnoDB; -CREATE TABLE db2.t2A (f1 INTEGER) ENGINE=InnoDB; -CREATE TABLE db2.t2B (f1 INTEGER) ENGINE=InnoDB; -INSERT INTO db1.t1 VALUES (1); -INSERT INTO db2.t2A VALUES (2); -INSERT INTO db2.t2B VALUES (3); -SELECT COUNT(*) = 0 FROM db1.t1; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM db2.t2A; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 1 FROM db2.t2B; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM db1.t1; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 1 FROM db2.t2A; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM db2.t2B; -COUNT(*) = 1 -1 -DROP SCHEMA db1; -DROP SCHEMA db2; diff --git a/mysql-test/suite/galera_3nodes/r/galera_slave_options_ignore.result b/mysql-test/suite/galera_3nodes/r/galera_slave_options_ignore.result deleted file mode 100644 index 7185e92863d8c..0000000000000 --- a/mysql-test/suite/galera_3nodes/r/galera_slave_options_ignore.result +++ /dev/null @@ -1,28 +0,0 @@ -CREATE DATABASE db1; -CREATE DATABASE db2; -CREATE TABLE db1.t1 (f1 INTEGER) ENGINE=InnoDB; -CREATE TABLE db2.t2A (f1 INTEGER) ENGINE=InnoDB; -CREATE TABLE db2.t2B (f1 INTEGER) ENGINE=InnoDB; -INSERT INTO db1.t1 VALUES (1); -INSERT INTO db2.t2A VALUES (2); -INSERT INTO db2.t2B VALUES (3); -SELECT COUNT(*) = 0 FROM db1.t1; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM db2.t2A; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 1 FROM db2.t2B; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM db1.t1; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 1 FROM db2.t2A; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM db2.t2B; -COUNT(*) = 1 -1 -DROP SCHEMA db1; -DROP SCHEMA db2; diff --git a/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result b/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result index 776c54aebe13e..69d5a3dcc0e9e 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result +++ b/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result @@ -20,7 +20,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci LOCK TABLE t1 WRITE; UNLOCK TABLES; FLUSH TABLES WITH READ LOCK; diff --git a/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result b/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result index d43f31d4c877d..e49a1714a3edf 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result +++ b/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result @@ -47,7 +47,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_2; SET SESSION wsrep_on=OFF; SET SESSION wsrep_on=ON; @@ -56,7 +56,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT COUNT(*) AS expect_0 FROM t1; expect_0 0 @@ -66,7 +66,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'PRIMARY'; check that column/key exists'"); connection node_1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result b/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result index f51eb815cd501..62c3924d92ce9 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result +++ b/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result @@ -14,7 +14,7 @@ wsrep_cluster CREATE TABLE `wsrep_cluster` ( `protocol_version` int(11) NOT NULL, `capabilities` int(11) NOT NULL, PRIMARY KEY (`cluster_uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 SHOW CREATE TABLE mysql.wsrep_cluster_members; Table Create Table wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` ( @@ -23,7 +23,7 @@ wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` ( `node_name` char(32) NOT NULL, `node_incoming_address` varchar(256) NOT NULL, PRIMARY KEY (`node_uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster; EXPECT_1 1 @@ -74,3 +74,4 @@ cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHER SELECT COUNT(*) AS EXPECT_3 FROM mysql.wsrep_cluster_members; EXPECT_3 3 +disconnect node_3; diff --git a/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema_init.result b/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema_init.result index d9d3e817bed59..862e14d0269d2 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema_init.result +++ b/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema_init.result @@ -14,7 +14,7 @@ wsrep_cluster CREATE TABLE `wsrep_cluster` ( `protocol_version` int(11) NOT NULL, `capabilities` int(11) NOT NULL, PRIMARY KEY (`cluster_uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 SHOW CREATE TABLE mysql.wsrep_cluster_members; Table Create Table wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` ( @@ -23,7 +23,7 @@ wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` ( `node_name` char(32) NOT NULL, `node_incoming_address` varchar(256) NOT NULL, PRIMARY KEY (`node_uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 SELECT @@sql_safe_updates; @@sql_safe_updates 1 diff --git a/mysql-test/suite/galera_3nodes/t/GCF-363.test b/mysql-test/suite/galera_3nodes/t/GCF-363.test index 76be88bc771ad..17c510e7c9c01 100644 --- a/mysql-test/suite/galera_3nodes/t/GCF-363.test +++ b/mysql-test/suite/galera_3nodes/t/GCF-363.test @@ -16,7 +16,6 @@ --connection node_1 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) ENGINE=InnoDB; ---connection node_1 SET GLOBAL wsrep_on=OFF; INSERT INTO t1 VALUES (1, 'a'); SET GLOBAL wsrep_on=ON; @@ -71,4 +70,6 @@ CALL mtr.add_suppression("WSREP: Vote 0 \\\(success\\\) on (.*) is inconsistent CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on "); CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); +--connection node_1 +# Restore original auto_increment_offset values. --source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/MDEV-29171.cnf b/mysql-test/suite/galera_3nodes/t/MDEV-29171.cnf new file mode 100644 index 0000000000000..27f1c29f9998e --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/MDEV-29171.cnf @@ -0,0 +1,14 @@ +!include ../galera_3nodes.cnf + +[mysqld.1] +wsrep-node-name="node1" +wsrep-gtid-mode=ON +wsrep-gtid-domain-id=100 + +[mysqld.2] +wsrep-node-name="node2" +wsrep-gtid-mode=ON + +[mysqld.3] +wsrep-node-name="node3" +wsrep-gtid-mode=ON diff --git a/mysql-test/suite/galera_3nodes/t/MDEV-29171.test b/mysql-test/suite/galera_3nodes/t/MDEV-29171.test new file mode 100644 index 0000000000000..33fa4d722ae7b --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/MDEV-29171.test @@ -0,0 +1,83 @@ +# +# MDEV-29171: changing the value of wsrep_gtid_domain_id +# with full cluster restart fails on some nodes +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Initially wsrep gtid domain id is 100 +# +--connection node_1 +select @@wsrep_gtid_domain_id,@@wsrep_node_name; + +--connection node_2 +select @@wsrep_gtid_domain_id,@@wsrep_node_name; + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_3 +select @@wsrep_gtid_domain_id,@@wsrep_node_name; + + +# +# Shutdown all nodes +# +--connection node_3 +--source include/shutdown_mysqld.inc + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +--source include/shutdown_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +--source include/shutdown_mysqld.inc + + +# +# Bootstrap from node_1 and change wsrep_gtid_domain_id to 200 +# +--connection node_1 +--let $restart_parameters = --wsrep_new_cluster --wsrep_gtid_domain_id=200 +--source include/start_mysqld.inc +show variables like 'wsrep_gtid_domain_id'; + + +# +# Restart node_2, expect that wsrep_gtid_domain_id has changed to 200 +# +--connection node_2 +--let $restart_parameters = +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--source include/start_mysqld.inc +show variables like 'wsrep_gtid_domain_id'; + + +# +# Restart node_3, select node_2 as donor +# If bug is present, node_3 remains on domain id 100 +# +--connection node_3 +--let $restart_parameters = --wsrep_sst_donor="node2" +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.3.expect +--source include/start_mysqld.inc +# Expect domain id 200 +show variables like 'wsrep_gtid_domain_id'; + + +# +# Cleanup +# +--connection node_1 +set global wsrep_gtid_domain_id=100; + +--connection node_2 +set global wsrep_gtid_domain_id=100; +CALL mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); + +--connection node_3 +set global wsrep_gtid_domain_id=100; +CALL mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); diff --git a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test index 8a9a74a725244..d7b0f36551f23 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test +++ b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test @@ -129,20 +129,28 @@ SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); + --connection node_3 SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); + --connection node_5 SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); + --connection node_6 SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; + +CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); diff --git a/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.cnf b/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.cnf new file mode 100644 index 0000000000000..8b7cb948a870a --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.cnf @@ -0,0 +1,13 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep_sst_method=rsync + +[mysqld.1] +wsrep_node_name=node1 + +[mysqld.2] +wsrep_node_name=node2 + +[mysqld.3] +wsrep_node_name=node3 diff --git a/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test b/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test new file mode 100644 index 0000000000000..f5eaf6fc59a24 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test @@ -0,0 +1,136 @@ +# +# A very basic test for the galera arbitrator. We shut down node #3 and use its port allocation to start garbd. +# As MTR does not allow multiple servers to be down at the same time, we are limited as to what we can test. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_garbd.inc +--source include/big_test.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +--connection node_1 +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_3 = $_NODE_GALERAPORT + +--source ../galera/include/auto_increment_offset_save.inc + +# Save galera ports +--connection node_1 +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT +--let $datadir= `SELECT @@datadir` + +--let $innodb_max_dirty_pages_pct = `SELECT @@innodb_max_dirty_pages_pct` +--let $innodb_max_dirty_pages_pct_lwm = `SELECT @@innodb_max_dirty_pages_pct_lwm` + +SET GLOBAL innodb_max_dirty_pages_pct=99; +SET GLOBAL innodb_max_dirty_pages_pct_lwm=99; + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB; +CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +INSERT INTO t1 (f2) SELECT REPEAT('x', 1024) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; + +--connection node_2 +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT + +--echo Killing node #3 to free ports for garbd ... +--connection node_3 +--source include/shutdown_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +# stop SST donor thread when node is in donor state +SET GLOBAL debug_dbug = "+d,sync.wsrep_donor_state"; + +--echo Starting garbd ... +--exec $MTR_GARBD_EXE --address "gcomm://127.0.0.1:$NODE_GALERAPORT_1" --group my_wsrep_cluster --donor node1 --sst backup --options 'base_port=$NODE_GALERAPORT_3' > $MYSQL_TMP_DIR/garbd.log 2>&1 & + +SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_donor_state_reached"; + +# +# get hash of data directory contents before BP dirty page flushing +# +--exec find $datadir -type f ! -name tables_flushed ! -name backup_sst_complete -exec md5sum {} \; | md5sum >$MYSQLTEST_VARDIR/tmp/innodb_before + +# this should force buffer pool flushing, if not already done by donor state change transfer +SET GLOBAL innodb_max_dirty_pages_pct_lwm=0; +SET GLOBAL innodb_max_dirty_pages_pct=0; + +--disable_query_log +--disable_result_log +select f1 from t1; +select * from ten; +--enable_result_log +--enable_query_log + +# +# +# record the hash of data directory contents after BP dirty page flushing +# +--exec find $datadir -type f ! -name tables_flushed ! -name backup_sst_complete -exec md5sum {} \; | md5sum >$MYSQLTEST_VARDIR/tmp/innodb_after + +# there should be no disk writes +--diff_files $MYSQLTEST_VARDIR/tmp/innodb_before $MYSQLTEST_VARDIR/tmp/innodb_after + +SET SESSION debug_sync = "now SIGNAL signal.wsrep_donor_state"; +SET GLOBAL debug_dbug = ""; +SET debug_sync='RESET'; + +--connection node_2 + +# +# garbd will die automatically, because of the backup SST script +# but just to be sure, sending explicit kill here, as well +# +--echo Killing garbd ... +# FreeBSD's /bin/pkill only supports short versions of the options: +# -o Select only the oldest (least recently started) +# -f Match against full argument lists +--error 0,1 +--exec pkill -o -f garbd.*$NODE_GALERAPORT_3 + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--connection node_2 + +DROP TABLE t1; +DROP TABLE ten; + +--echo Restarting node #3 to satisfy MTR's end-of-test checks +--connection node_3 +let $restart_noprint=2; +--source include/start_mysqld.inc + +--connection node_1 +--disable_query_log +--eval SET GLOBAL innodb_max_dirty_pages_pct = $innodb_max_dirty_pages_pct +--eval SET GLOBAL innodb_max_dirty_pages_pct_lwm = $innodb_max_dirty_pages_pct_lwm +--enable_query_log + +--source ../galera/include/auto_increment_offset_restore.inc + +--connection node_1 +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); + +--connection node_2 +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); + +--connection node_3 +CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)"); diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf index 3b0f0173b35b4..415a8f3325796 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf @@ -3,33 +3,33 @@ [mysqld] wsrep_sst_method=mariabackup wsrep_sst_auth="root:" -wsrep_node_address=::1 +bind-address=:: [mysqld.1] wsrep-cluster-address=gcomm:// wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' +wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.1.port' wsrep_node_name=node_1 -bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' +wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.2.port' wsrep_node_name=node_2 wsrep_sst_donor=node_1 -bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' +wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.3.port' wsrep_node_name=node_3 wsrep_sst_donor=node_1 -bind-address=:: [SST] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf index a3ab9a857070f..21f229ffcce09 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf @@ -7,33 +7,33 @@ bind-address=:: innodb-data-home-dir= wsrep_sst_method=mariabackup wsrep_sst_auth="root:" -wsrep_node_address=::1 +bind-address=:: [mysqld.1] wsrep-cluster-address=gcomm:// wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' +wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.1.port' wsrep_node_name=node_1 -bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' +wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.2.port' wsrep_node_name=node_2 wsrep_sst_donor=node_1 -bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' +wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.3.port' wsrep_node_name=node_3 wsrep_sst_donor=node_1 -bind-address=:: [SST] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf index c163f798335b5..afdfacfa3a58f 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf @@ -2,25 +2,25 @@ [mysqld] wsrep_sst_method=rsync -wsrep_node_address=::1 +bind-address=:: [mysqld.1] wsrep-cluster-address=gcomm:// wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' +wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.1.port' -bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' +wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.2.port' -bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' +wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.3.port' -bind-address=:: diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf index c163f798335b5..afdfacfa3a58f 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf @@ -2,25 +2,25 @@ [mysqld] wsrep_sst_method=rsync -wsrep_node_address=::1 +bind-address=:: [mysqld.1] wsrep-cluster-address=gcomm:// wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' +wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.1.port' -bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' +wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.2.port' -bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' +wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.3.port' -bind-address=:: diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf index ee92efeff1d47..c34144d9a69c8 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf @@ -7,25 +7,25 @@ innodb-data-home-dir=/tmp [mysqld] innodb-data-home-dir= wsrep_sst_method=rsync -wsrep_node_address=::1 +bind-address=:: [mysqld.1] wsrep-cluster-address=gcomm:// wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' +wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.1.port' -bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' +wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.2.port' -bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' +wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.3.port' -bind-address=:: diff --git a/mysql-test/suite/galera_3nodes/t/galera_slave_options_do.cnf b/mysql-test/suite/galera_3nodes/t/galera_slave_options_do.cnf deleted file mode 100644 index 1ebde6186c104..0000000000000 --- a/mysql-test/suite/galera_3nodes/t/galera_slave_options_do.cnf +++ /dev/null @@ -1,7 +0,0 @@ -!include ../galera_3nodes.cnf - -[mysqld.1] -binlog-do-db=db2 - -[mysqld.2] -replicate-wild-do-table=db2.t2B diff --git a/mysql-test/suite/galera_3nodes/t/galera_slave_options_do.test b/mysql-test/suite/galera_3nodes/t/galera_slave_options_do.test deleted file mode 100644 index 1437c90c670a6..0000000000000 --- a/mysql-test/suite/galera_3nodes/t/galera_slave_options_do.test +++ /dev/null @@ -1,34 +0,0 @@ -# -# This tests checks the operation of binlog-do-db , replicate-wild-do-table -# - ---source include/galera_cluster.inc ---source include/have_innodb.inc - ---connection node_1 -CREATE DATABASE db1; -CREATE DATABASE db2; - -CREATE TABLE db1.t1 (f1 INTEGER) ENGINE=InnoDB; -CREATE TABLE db2.t2A (f1 INTEGER) ENGINE=InnoDB; -CREATE TABLE db2.t2B (f1 INTEGER) ENGINE=InnoDB; - -INSERT INTO db1.t1 VALUES (1); -INSERT INTO db2.t2A VALUES (2); -INSERT INTO db2.t2B VALUES (3); - ---connection node_2 -SELECT COUNT(*) = 0 FROM db1.t1; -SELECT COUNT(*) = 0 FROM db2.t2A; -SELECT COUNT(*) = 1 FROM db2.t2B; - - ---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 ---connection node_3 -SELECT COUNT(*) = 0 FROM db1.t1; -SELECT COUNT(*) = 1 FROM db2.t2A; -SELECT COUNT(*) = 1 FROM db2.t2B; - ---connection node_1 -DROP SCHEMA db1; -DROP SCHEMA db2; diff --git a/mysql-test/suite/galera_3nodes/t/galera_slave_options_ignore.cnf b/mysql-test/suite/galera_3nodes/t/galera_slave_options_ignore.cnf deleted file mode 100644 index 9b78d47e25475..0000000000000 --- a/mysql-test/suite/galera_3nodes/t/galera_slave_options_ignore.cnf +++ /dev/null @@ -1,7 +0,0 @@ -!include ../galera_3nodes.cnf - -[mysqld.1] -binlog-ignore-db=db1 - -[mysqld.2] -replicate-wild-ignore-table=db2.t2A diff --git a/mysql-test/suite/galera_3nodes/t/galera_slave_options_ignore.test b/mysql-test/suite/galera_3nodes/t/galera_slave_options_ignore.test deleted file mode 100644 index 8e73dee70ae8d..0000000000000 --- a/mysql-test/suite/galera_3nodes/t/galera_slave_options_ignore.test +++ /dev/null @@ -1,35 +0,0 @@ -# -# This tests checks the operation of binlog-ignore-db , replicate-wild-ignore-table -# - ---source include/galera_cluster.inc ---source include/have_innodb.inc - ---connection node_1 -CREATE DATABASE db1; -CREATE DATABASE db2; - -CREATE TABLE db1.t1 (f1 INTEGER) ENGINE=InnoDB; -CREATE TABLE db2.t2A (f1 INTEGER) ENGINE=InnoDB; -CREATE TABLE db2.t2B (f1 INTEGER) ENGINE=InnoDB; - -INSERT INTO db1.t1 VALUES (1); -INSERT INTO db2.t2A VALUES (2); -INSERT INTO db2.t2B VALUES (3); - ---connection node_2 -SELECT COUNT(*) = 0 FROM db1.t1; -SELECT COUNT(*) = 0 FROM db2.t2A; -SELECT COUNT(*) = 1 FROM db2.t2B; - - ---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 ---connection node_3 ---source include/galera_wait_ready.inc -SELECT COUNT(*) = 0 FROM db1.t1; -SELECT COUNT(*) = 1 FROM db2.t2A; -SELECT COUNT(*) = 1 FROM db2.t2B; - ---connection node_1 -DROP SCHEMA db1; -DROP SCHEMA db2; diff --git a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test index 52bbf3a652c13..d6e20d3bbfbf1 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test +++ b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test @@ -17,6 +17,9 @@ # Make the test fail if table structure has changed +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + SHOW CREATE TABLE mysql.wsrep_cluster; SHOW CREATE TABLE mysql.wsrep_cluster_members; @@ -74,3 +77,5 @@ SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STAT SELECT COUNT(*) AS EXPECT_3 FROM mysql.wsrep_cluster_members; --source ../galera/include/auto_increment_offset_restore.inc + +--disconnect node_3 diff --git a/mysql-test/suite/galera_3nodes_sr/disabled.def b/mysql-test/suite/galera_3nodes_sr/disabled.def index 900b27860a559..df2277fb8ad2a 100644 --- a/mysql-test/suite/galera_3nodes_sr/disabled.def +++ b/mysql-test/suite/galera_3nodes_sr/disabled.def @@ -1,6 +1,13 @@ -GCF-336 : -GCF-582 : -GCF-810A : -GCF-810B : -GCF-810C : -galera_sr_kill_slave_after_apply_rollback2 : \ No newline at end of file +############################################################################## +# +# List the test cases that are to be disabled temporarily. +# +# Separate the test case name and the comment with ':'. +# +# : MDEV- +# +# Do not use any TAB characters for whitespace. +# +############################################################################## + +galera_sr_kill_slave_after_apply_rollback2 : MDEV-29892 Galera test failure on galera_sr_kill_slave_after_apply_rollback2 \ No newline at end of file diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-336.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-336.result index bb6c11edf36d7..eeccfa3b5a391 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/GCF-336.result +++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-336.result @@ -1,11 +1,17 @@ +connection node_2; +connection node_1; +connection node_2; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; SET SESSION wsrep_trx_fragment_size = 1; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES (1); +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; COUNT(*) > 0 1 +connection node_1; SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; COUNT(*) > 0 1 @@ -13,14 +19,19 @@ SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SELECT COUNT(*) > 0 FROM t1; COUNT(*) > 0 1 +connection node_2a; SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; SET SESSION wsrep_sync_wait=0; +connection node_2; INSERT INTO t1 VALUES (2); ERROR 40001: Deadlock found when trying to get lock; try restarting transaction COMMIT; ERROR 08S01: WSREP has not yet prepared node for application use +connection node_2a; SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; DROP TABLE t1; CALL mtr.add_suppression("replication aborted"); CALL mtr.add_suppression("WSREP: fragment replication failed: 3"); CALL mtr.add_suppression("WSREP: failed to send SR rollback for "); +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_3; diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-582.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-582.result index 9e2a4823973d8..94bc532e02177 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/GCF-582.result +++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-582.result @@ -1,4 +1,15 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; +connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +connection node_2; +connection node_1; +connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1b; SET SESSION wsrep_trx_fragment_size = 1; SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -7,17 +18,22 @@ INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (3); INSERT INTO t1 VALUES (4); INSERT INTO t1 VALUES (5); +connection node_2; +# restart SELECT COUNT(*) FROM mysql.wsrep_streaming_log; COUNT(*) 5 +connection node_1; SELECT COUNT(*) FROM mysql.wsrep_streaming_log; COUNT(*) 5 COMMIT; SELECT COUNT(*) FROM t1; COUNT(*) -5 +0 +connection node_2; SELECT COUNT(*) FROM t1; COUNT(*) -5 +0 DROP TABLE t1; +disconnect node_1b; diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-606.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-606.result index 775f7ee0412c4..a964537a8ae6d 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/GCF-606.result +++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-606.result @@ -1,5 +1,9 @@ connection node_2; connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-810A.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-810A.result deleted file mode 100644 index 9a83ff3c04166..0000000000000 --- a/mysql-test/suite/galera_3nodes_sr/r/GCF-810A.result +++ /dev/null @@ -1,256 +0,0 @@ -SET GLOBAL debug="d,crash_last_fragment_commit_before_fragment_removal"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -crash_last_fragment_commit_before_fragment_removal -COMMIT; -Got one of the listed errors -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; -COUNT(DISTINCT node_uuid) = 1 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; -COUNT(DISTINCT node_uuid) = 1 -1 -COMMIT; -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET GLOBAL debug = ''; -SET GLOBAL debug="d,crash_last_fragment_commit_after_fragment_removal"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -crash_last_fragment_commit_after_fragment_removal -COMMIT; -Got one of the listed errors -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; -COUNT(DISTINCT node_uuid) = 1 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; -COUNT(DISTINCT node_uuid) = 1 -1 -COMMIT; -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET GLOBAL debug = ''; -SET GLOBAL debug="d,crash_replicate_fragment_success"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -crash_replicate_fragment_success -COMMIT; -Got one of the listed errors -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; -COUNT(DISTINCT node_uuid) = 1 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; -COUNT(DISTINCT node_uuid) = 1 -1 -COMMIT; -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET GLOBAL debug = ''; -SET GLOBAL debug="d,crash_replicate_fragment_after_certify"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -crash_replicate_fragment_after_certify -COMMIT; -Got one of the listed errors -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; -COUNT(DISTINCT node_uuid) = 1 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; -COUNT(DISTINCT node_uuid) = 1 -1 -COMMIT; -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET GLOBAL debug = ''; -SET GLOBAL debug="d,crash_replicate_fragment_before_certify"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -crash_replicate_fragment_before_certify -COMMIT; -Got one of the listed errors -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; -COUNT(DISTINCT node_uuid) = 1 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; -COUNT(DISTINCT node_uuid) = 1 -1 -COMMIT; -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET GLOBAL debug = ''; -DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-810B.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-810B.result deleted file mode 100644 index bbec3531a49d0..0000000000000 --- a/mysql-test/suite/galera_3nodes_sr/r/GCF-810B.result +++ /dev/null @@ -1,100 +0,0 @@ -SET GLOBAL debug="d,crash_apply_cb_before_append_frag"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); -COMMIT; -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; -COUNT(DISTINCT node_uuid) = 1 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; -COUNT(DISTINCT node_uuid) = 1 -1 -COMMIT; -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET GLOBAL debug = ''; -SET GLOBAL debug="d,crash_apply_cb_after_append_frag"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); -COMMIT; -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; -COUNT(DISTINCT node_uuid) = 1 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; -COUNT(DISTINCT node_uuid) = 1 -1 -COMMIT; -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET GLOBAL debug = ''; -CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member"); -DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-810C.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-810C.result deleted file mode 100644 index 1a6dcbfd392ea..0000000000000 --- a/mysql-test/suite/galera_3nodes_sr/r/GCF-810C.result +++ /dev/null @@ -1,177 +0,0 @@ -SET GLOBAL debug="d,crash_commit_cb_last_fragment_commit_success"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -SET SESSION wsrep_trx_fragment_size=1; -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'); -SELECT 1 FROM t1; -Got one of the listed errors -SELECT * FROM mysql.wsrep_streaming_log; -node_uuid trx_id seqno flags frag -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT * FROM mysql.wsrep_streaming_log; -node_uuid trx_id seqno flags frag -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT * FROM mysql.wsrep_streaming_log; -node_uuid trx_id seqno flags frag -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET GLOBAL debug="d,crash_commit_cb_before_last_fragment_commit"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -SET SESSION wsrep_trx_fragment_size=1; -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'); -SELECT 1 FROM t1; -Got one of the listed errors -SELECT * FROM mysql.wsrep_streaming_log; -node_uuid trx_id seqno flags frag -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT * FROM mysql.wsrep_streaming_log; -node_uuid trx_id seqno flags frag -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT * FROM mysql.wsrep_streaming_log; -node_uuid trx_id seqno flags frag -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET GLOBAL debug="d,crash_apply_cb_after_fragment_removal"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -SET SESSION wsrep_trx_fragment_size=1; -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'); -SELECT 1 FROM t1; -Got one of the listed errors -SELECT * FROM mysql.wsrep_streaming_log; -node_uuid trx_id seqno flags frag -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT * FROM mysql.wsrep_streaming_log; -node_uuid trx_id seqno flags frag -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT * FROM mysql.wsrep_streaming_log; -node_uuid trx_id seqno flags frag -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET GLOBAL debug="d,crash_apply_cb_before_fragment_removal"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; -SET AUTOCOMMIT=OFF; -SET SESSION wsrep_trx_fragment_size=1; -START TRANSACTION; -INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); -SET SESSION wsrep_trx_fragment_size=1; -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'); -SELECT 1 FROM t1; -Got one of the listed errors -SELECT * FROM mysql.wsrep_streaming_log; -node_uuid trx_id seqno flags frag -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT * FROM mysql.wsrep_streaming_log; -node_uuid trx_id seqno flags frag -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT * FROM mysql.wsrep_streaming_log; -node_uuid trx_id seqno flags frag -SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; -COUNT(*) > 0 -1 -SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result b/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result index 8de724c157606..9addd29b0ea11 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result +++ b/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result @@ -5,6 +5,9 @@ connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3; connection node_1; +connection node_2; +connection node_3; +connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); connection node_2; SET SESSION wsrep_trx_fragment_size=1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_isolate_master.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_isolate_master.result index bb4eb829abce4..d38a2779c966c 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_isolate_master.result +++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_isolate_master.result @@ -1,5 +1,9 @@ connection node_2; connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; SET SESSION wsrep_trx_fragment_size = 1; @@ -22,7 +26,7 @@ connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; connection node_1a; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; connection node_2; -connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_3; connection node_2; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback2.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback2.result index 21e301ed35398..31413fbb80ab6 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback2.result +++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback2.result @@ -1,3 +1,11 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; SET SESSION wsrep_trx_fragment_size = 1; SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -7,25 +15,33 @@ INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (3); INSERT INTO t1 VALUES (4); INSERT INTO t1 VALUES (5); +connection node_2; SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; Killing server ... +connection node_1; INSERT INTO t1 VALUES (6); ROLLBACK; -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +5 +connection node_2; +# restart +connection node_1; +connection node_2; SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 +SELECT COUNT(*) FROM t1; +COUNT(*) +6 +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +5 SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 +SELECT COUNT(*) FROM t1; +COUNT(*) 1 +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +5 +connection node_1; +disconnect node_1a; DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-582.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-582.test index bf19ea84c871b..20580c3729850 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-582.test +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-582.test @@ -1,6 +1,14 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--LET $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + --connection node_1 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; @@ -11,6 +19,8 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc +--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1b SET SESSION wsrep_trx_fragment_size = 1; SET AUTOCOMMIT=OFF; START TRANSACTION; @@ -37,3 +47,6 @@ SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1; DROP TABLE t1; + +--disconnect node_1b +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test index 6d49247ab5e39..879c007e601b4 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test @@ -6,6 +6,13 @@ # The master transitions to a non-prim view and back to prim. Its ongoing # should fail to commit. # +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--LET $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 @@ -78,3 +85,4 @@ DROP TABLE t1; --connection node_2 CALL mtr.add_suppression("WSREP: failed to send SR rollback for "); +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-810A.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-810A.test deleted file mode 100644 index fda16b7265ce9..0000000000000 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-810A.test +++ /dev/null @@ -1,137 +0,0 @@ -# -# Exercise the crash points which crash the server at various points important to SR -# - ---source include/big_test.inc ---source include/galera_cluster.inc ---source include/have_debug_sync.inc - ---connect node_2_check, 127.0.0.1, root, , test, $NODE_MYPORT_2 ---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 ---connect node_3_check, 127.0.0.1, root, , test, $NODE_MYPORT_3 - -# -# crash_last_fragment_commit_before_fragment_removal -# - ---connection node_2 ---enable_reconnect -SET GLOBAL debug_dbug="d,crash_last_fragment_commit_before_fragment_removal"; ---source suite/galera_3nodes/include/galera_expect_node_crash.inc ---source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc - ---echo crash_last_fragment_commit_before_fragment_removal - ---connection node_2 ---error 2006,2013 -COMMIT; - ---connection node_1 ---let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_cluster_size' ---source include/wait_condition.inc - ---connection node_2 ---source include/start_mysqld.inc ---source suite/galera_3nodes/include/galera_sr_crash_post_check.inc - -# -# crash_last_fragment_commit_after_fragment_removal -# - ---connection node_2 -SET GLOBAL debug_dbug="d,crash_last_fragment_commit_after_fragment_removal"; ---source suite/galera_3nodes/include/galera_expect_node_crash.inc ---source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc - ---echo crash_last_fragment_commit_after_fragment_removal - ---connection node_2 ---error 2006,2013 -COMMIT; - ---connection node_1 ---let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_cluster_size' ---source include/wait_condition.inc - ---connection node_2 ---source include/start_mysqld.inc ---source suite/galera_3nodes/include/galera_sr_crash_post_check.inc - -# -# crash_last_fragment_commit_success -# -# Case crash_last_fragment_commit_success is commented out, -# the changes will be visible on slave due to succesful commit, -# so the galera_sr_crash_post_check will fail. -# - -# --connection node_2 -# SET GLOBAL debug_dbug="d,crash_last_fragment_commit_success"; -# --source suite/galera_3nodes/include/galera_expect_node_crash.inc -# --source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc - -# --echo crash_last_fragment_commit_success - -# --connection node_2 -# --error 2006,2013 -# COMMIT; - -# --source include/start_mysqld.inc -# --source suite/galera_3nodes/include/galera_sr_crash_post_check.inc - -# -# crash_replicate_fragment_success -# - ---connection node_2 -SET GLOBAL debug_dbug="d,crash_replicate_fragment_success"; ---source suite/galera_3nodes/include/galera_expect_node_crash.inc ---source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc - ---echo crash_replicate_fragment_success - ---connection node_2 ---error 2006,2013 -COMMIT; - ---source include/start_mysqld.inc ---source suite/galera_3nodes/include/galera_sr_crash_post_check.inc - -# -# crash_replicate_fragment_after_certify -# - ---connection node_2 -SET GLOBAL debug_dbug="d,crash_replicate_fragment_after_certify"; ---source suite/galera_3nodes/include/galera_expect_node_crash.inc ---source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc - ---echo crash_replicate_fragment_after_certify - ---connection node_2 ---error 2006,2013 -COMMIT; - ---source include/start_mysqld.inc ---source suite/galera_3nodes/include/galera_sr_crash_post_check.inc - -# -# crash_replicate_fragment_before_certify -# - ---connection node_2 -SET GLOBAL debug_dbug="d,crash_replicate_fragment_before_certify"; ---source suite/galera_3nodes/include/galera_expect_node_crash.inc ---source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc - ---echo crash_replicate_fragment_before_certify - ---connection node_2 ---error 2006,2013 -COMMIT; - ---source include/start_mysqld.inc ---source suite/galera_3nodes/include/galera_sr_crash_post_check.inc - - -DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-810B.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-810B.test deleted file mode 100644 index cb41b2348de9e..0000000000000 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-810B.test +++ /dev/null @@ -1,49 +0,0 @@ -# -# Exercise the crash points which crash the server at various points important to SR -# - ---source include/big_test.inc ---source include/galera_cluster.inc ---source include/have_debug_sync.inc - ---connect node_2_check, 127.0.0.1, root, , test, $NODE_MYPORT_2 ---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 ---connect node_3_check, 127.0.0.1, root, , test, $NODE_MYPORT_3 - -# -# crash_apply_cb_before_append_frag -# - ---connection node_3 -SET GLOBAL debug_dbug="d,crash_apply_cb_before_append_frag"; ---source suite/galera_3nodes/include/galera_expect_node_crash.inc ---source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes2.inc - ---connection node_3 ---error 0,2006,2013 -COMMIT; - ---source include/start_mysqld.inc ---sleep 5 ---source suite/galera_3nodes/include/galera_sr_crash_post_check2.inc - -# -# crash_apply_cb_after_append_frag -# - ---connection node_3 -SET GLOBAL debug_dbug="d,crash_apply_cb_after_append_frag"; ---source suite/galera_3nodes/include/galera_expect_node_crash.inc ---source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes2.inc - ---connection node_3 ---error 0,2006,2013 -COMMIT; - ---source include/start_mysqld.inc ---sleep 5 ---source suite/galera_3nodes/include/galera_sr_crash_post_check2.inc - ---connection node_1 -CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member"); -DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-810C.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-810C.test deleted file mode 100644 index 6c4da2cb5f081..0000000000000 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-810C.test +++ /dev/null @@ -1,70 +0,0 @@ -# -# Exercise the crash points which crash the server at various points important to SR -# - ---source include/big_test.inc ---source include/galera_cluster.inc ---source include/have_debug_sync.inc - ---connect node_2_check, 127.0.0.1, root, , test, $NODE_MYPORT_2 ---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 ---enable_reconnect ---connect node_3_check, 127.0.0.1, root, , test, $NODE_MYPORT_3 - -# -# crash_commit_cb_last_fragment_commit_success -# - ---connection node_3 -SET GLOBAL debug_dbug="d,crash_commit_cb_last_fragment_commit_success"; ---source suite/galera_3nodes/include/galera_expect_node_crash.inc ---source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes3.inc - ---source include/start_mysqld.inc ---sleep 5 ---source include/galera_wait_ready.inc ---source suite/galera_3nodes/include/galera_sr_crash_post_check3.inc - -# -# crash_commit_cb_before_last_fragment_commit -# - ---connection node_3 -SET GLOBAL debug_dbug="d,crash_commit_cb_before_last_fragment_commit"; ---source suite/galera_3nodes/include/galera_expect_node_crash.inc ---source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes3.inc - ---source include/start_mysqld.inc ---sleep 5 ---source include/galera_wait_ready.inc ---source suite/galera_3nodes/include/galera_sr_crash_post_check3.inc - -# -# crash_apply_cb_after_fragment_removal -# - ---connection node_3 -SET GLOBAL debug_dbug="d,crash_apply_cb_after_fragment_removal"; ---source suite/galera_3nodes/include/galera_expect_node_crash.inc ---source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes3.inc - ---source include/start_mysqld.inc ---sleep 5 ---source include/galera_wait_ready.inc ---source suite/galera_3nodes/include/galera_sr_crash_post_check3.inc - -# -# crash_apply_cb_before_fragment_removal -# - ---connection node_3 -SET GLOBAL debug_dbug="d,crash_apply_cb_before_fragment_removal"; ---source suite/galera_3nodes/include/galera_expect_node_crash.inc ---source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes3.inc - ---source include/start_mysqld.inc ---sleep 5 ---source include/galera_wait_ready.inc ---source suite/galera_3nodes/include/galera_sr_crash_post_check3.inc - -DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test index eb7f5603452ee..ab8b62b969a91 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test @@ -15,8 +15,8 @@ --connection node_2 SET GLOBAL debug_dbug="d,crash_last_fragment_commit_after_fragment_removal"; ---let $_server_id= `SELECT @@server_id` ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --exec echo "wait" > $_expect_file_name CREATE TABLE t1 (f1 VARCHAR(30)) ENGINE=InnoDB; diff --git a/mysql-test/suite/galera_3nodes_sr/t/MDEV-26707.test b/mysql-test/suite/galera_3nodes_sr/t/MDEV-26707.test index 98c20cd14d5df..a952b343d9fbd 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/MDEV-26707.test +++ b/mysql-test/suite/galera_3nodes_sr/t/MDEV-26707.test @@ -24,6 +24,11 @@ --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3 +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc --connection node_1 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); @@ -166,3 +171,5 @@ SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; --connection node_1 DROP TABLE t1; + +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test index 30fd0192f261b..27674148f4607 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test @@ -4,6 +4,12 @@ # # Test the effect of gmcast.isolate on master during an SR transaction # +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc --connection node_1 CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; @@ -41,7 +47,7 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; --source include/wait_condition.inc --source include/galera_wait_ready.inc ---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_3 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc --source include/galera_wait_ready.inc @@ -125,3 +131,5 @@ SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; --connection node_1 CALL mtr.add_suppression("failed to send SR rollback for"); DROP TABLE t1; + +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test index 83964769ef5ff..6ca2011d22134 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test @@ -7,8 +7,15 @@ --source include/galera_cluster.inc --source include/have_innodb.inc ---connection node_1 +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a --let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size` SET SESSION wsrep_trx_fragment_size = 1; SET AUTOCOMMIT=OFF; @@ -33,7 +40,7 @@ SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; INSERT INTO t1 VALUES (6); ROLLBACK; -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; --connection node_2 --source include/start_mysqld.inc @@ -42,15 +49,20 @@ SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; --source include/wait_until_connected_again.inc --source include/galera_wait_ready.inc ---connection node_2 +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc --connection node_2 SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT COUNT(*) = 0 FROM t1; -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -SELECT COUNT(*) = 0 FROM t1; -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +--connection node_1 +--disconnect node_1a DROP TABLE t1; +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test index ea549a6bea272..08a59296e4190 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test @@ -7,7 +7,6 @@ --source include/galera_cluster.inc --source include/have_innodb.inc - --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 # Save original auto_increment_offset values. --let $node_1=node_1 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.inc b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.inc index 776291cc9c0cc..9fe33e78eb565 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.inc +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.inc @@ -8,6 +8,8 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 BLOB) ENGINE=InnoDB; # Introduce inconsistency --connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1' +--source include/wait_condition.inc SET SESSION wsrep_on=OFF; --eval INSERT INTO t1 VALUES ($inconsistent_fragment, 'X') SET SESSION wsrep_on=ON; diff --git a/mysql-test/suite/galera_sr/disabled.def b/mysql-test/suite/galera_sr/disabled.def index 9f6ae2a51effd..1132a0097c46e 100644 --- a/mysql-test/suite/galera_sr/disabled.def +++ b/mysql-test/suite/galera_sr/disabled.def @@ -10,8 +10,6 @@ # ############################################################################## -GCF-1018B : MDEV-18534 wsrep::transaction::adopt(): Assertion `transaction.is_streaming()' failed -GCF-1060 : MDEV-20848 galera_sr.GCF_1060 -GCF-585 : MDEV-24698 galera_sr.GCF-585 MTR failed with SIGABRT: no such a transition REPLICATING -> APPLYING -galera-features#56 : MDEV-24896 -galera_sr_shutdown_master : MDEV-23612: galera_sr.galera_sr_shutdown_master MTR failed: WSREP_SST: [ERROR] Possible timeout in receving first data from donor in gtid stage +GCF-1060 : MDEV-26528 wrong usage of mutex LOCK_thd_kill and LOCK_thd_kill +galera_sr_cc_master : MDEV-29882 Galera test failure on galera_sr_cc_master +mysql-wsrep-features#138 : At line 25: query 'DROP TABLE t1' failed: 2013: Lost connection to MySQL server during query diff --git a/mysql-test/suite/galera_sr/r/MDEV-27553.result b/mysql-test/suite/galera_sr/r/MDEV-27553.result new file mode 100644 index 0000000000000..5a6a5bd49569c --- /dev/null +++ b/mysql-test/suite/galera_sr/r/MDEV-27553.result @@ -0,0 +1,36 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +connection node_2; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +SELECT COUNT(*) `Expect 1` FROM mysql.wsrep_streaming_log; +Expect 1 +1 +SET @@global.debug_dbug="+d,ha_index_init_fail"; +ROLLBACK; +connection node_1; +SET SESSION wsrep_sync_wait = 0; +SELECT COUNT(*) `Expect 0` FROM mysql.wsrep_streaming_log; +Expect 0 +0 +connection node_2; +SET @@global.debug_dbug=""; +SET SESSION wsrep_sync_wait = 0; +SELECT COUNT(*) `Expect 1` FROM mysql.wsrep_streaming_log; +Expect 1 +1 +connection node_2; +SET GLOBAL wsrep_on=OFF; +# restart +SELECT COUNT(*) `Expect 0` FROM mysql.wsrep_streaming_log; +Expect 0 +0 +DROP TABLE t1; +CALL mtr.add_suppression("WSREP: Failed to init table for index scan"); +CALL mtr.add_suppression("WSREP: Failed to apply write set"); +CALL mtr.add_suppression("Failed to report last committed"); diff --git a/mysql-test/suite/galera_sr/r/MDEV-27615.result b/mysql-test/suite/galera_sr/r/MDEV-27615.result new file mode 100644 index 0000000000000..e3bfd0ed5396d --- /dev/null +++ b/mysql-test/suite/galera_sr/r/MDEV-27615.result @@ -0,0 +1,27 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; +SET DEBUG_SYNC='wsrep_before_fragment_certification SIGNAL before_fragment WAIT_FOR continue'; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES (1);; +connection node_2a; +SET SESSION wsrep_sync_wait = 0; +SET DEBUG_SYNC='now WAIT_FOR before_fragment'; +SET GLOBAL wsrep_cluster_address = ''; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_2; +ERROR HY000: Lost connection to server during query +connection node_2a; +SELECT * FROM mysql.wsrep_streaming_log; +node_uuid trx_id seqno flags frag +SELECT * FROM t1; +f1 +DROP TABLE t1; +SET DEBUG_SYNC = 'RESET'; +disconnect node_2; +connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2; diff --git a/mysql-test/suite/galera_sr/r/MDEV-30838.result b/mysql-test/suite/galera_sr/r/MDEV-30838.result new file mode 100644 index 0000000000000..6997b9c4d5d82 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/MDEV-30838.result @@ -0,0 +1,15 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES(1); +SET debug_dbug='+d,ib_create_table_fail_too_many_trx'; +INSERT INTO t1 VALUES(2); +ERROR HY000: Error while appending streaming replication fragment +COMMIT; +SELECT * FROM t1; +f1 +SET debug_dbug='-d,ib_create_table_fail_too_many_trx'; +DROP TABLE t1; +CALL mtr.add_suppression("Error writing into mysql.wsrep_streaming_log: 177"); diff --git a/mysql-test/suite/galera_sr/r/MDEV-30862.result b/mysql-test/suite/galera_sr/r/MDEV-30862.result new file mode 100644 index 0000000000000..43da77f24df20 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/MDEV-30862.result @@ -0,0 +1,11 @@ +connection node_2; +connection node_1; +SET autocommit=0; +SET SESSION wsrep_trx_fragment_size=1; +CREATE TABLE t2 SELECT seq FROM seq_1_to_50; +ERROR 42000: CREATE TABLE AS SELECT is not supported with streaming replication +CREATE TABLE t1 (f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY); +INSERT INTO t1 VALUES(DEFAULT); +CREATE TABLE t2 SELECT * FROM t1; +ERROR 42000: CREATE TABLE AS SELECT is not supported with streaming replication +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_create_drop.result b/mysql-test/suite/galera_sr/r/galera_sr_create_drop.result index c8658f09ff08b..5fa48e26edfb5 100644 --- a/mysql-test/suite/galera_sr/r/galera_sr_create_drop.result +++ b/mysql-test/suite/galera_sr/r/galera_sr_create_drop.result @@ -8,7 +8,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, PRIMARY KEY (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_1; DROP TABLE t1; connection node_2; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_shutdown_slave.result b/mysql-test/suite/galera_sr/r/galera_sr_shutdown_slave.result index 902aa27d5aab8..34995d35a4f40 100644 --- a/mysql-test/suite/galera_sr/r/galera_sr_shutdown_slave.result +++ b/mysql-test/suite/galera_sr/r/galera_sr_shutdown_slave.result @@ -2,6 +2,8 @@ connection node_2; connection node_1; connection node_1; connection node_2; +connection node_2; +call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*"); connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE = InnoDB; connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; diff --git a/mysql-test/suite/galera_sr/r/mdev_18631.result b/mysql-test/suite/galera_sr/r/mdev_18631.result index bc6c0e4853893..779ae5266a348 100644 --- a/mysql-test/suite/galera_sr/r/mdev_18631.result +++ b/mysql-test/suite/galera_sr/r/mdev_18631.result @@ -5,6 +5,7 @@ connection node_1; CREATE TABLE t1(f1 INT PRIMARY KEY) ENGINE=INNODB; INSERT INTO t1 VALUES (1), (2), (3); connection node_2; +call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); SELECT * FROM t1; f1 1 diff --git a/mysql-test/suite/galera_sr/t/MDEV-27553.test b/mysql-test/suite/galera_sr/t/MDEV-27553.test new file mode 100644 index 0000000000000..5c557db920193 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/MDEV-27553.test @@ -0,0 +1,80 @@ +# +# MDEV-27553 Assertion `inited==INDEX' failed: int handler::ha_index_end() +# + +--source include/galera_cluster.inc +--source include/have_debug.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--source suite/galera/include/auto_increment_offset_save.inc + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); + +--connection node_2 +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +SELECT COUNT(*) `Expect 1` FROM mysql.wsrep_streaming_log; + +# +# Issue ROLLBACK and make sure it fails to clean up +# the streaming log. Failure to remove fragments +# results in apply failure of the rollback fragment. +# The node should disconnect from the cluster. +# +SET @@global.debug_dbug="+d,ha_index_init_fail"; +ROLLBACK; + + +# +# Expect the cluster to shrink +# +--connection node_1 +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +# +# ROLLBACK should clean up the streaming log just fine in node 1 +# +SELECT COUNT(*) `Expect 0` FROM mysql.wsrep_streaming_log; + + +# +# Expect the failure on ROLLBACK to leave a entry in streaming log +# +--connection node_2 +SET @@global.debug_dbug=""; +SET SESSION wsrep_sync_wait = 0; +# Expect node to be disconnected +--let wait_condition = SELECT VARIABLE_VALUE = 'Disconnected' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +SELECT COUNT(*) `Expect 1` FROM mysql.wsrep_streaming_log; + + +# +# Restart node 2, so that it joins the cluster back +# +--connection node_2 +SET GLOBAL wsrep_on=OFF; +--source include/restart_mysqld.inc + +# +# After restart, the streaming log is empty in node 2 +# +SELECT COUNT(*) `Expect 0` FROM mysql.wsrep_streaming_log; + +# +# Cleanup +# +DROP TABLE t1; + +CALL mtr.add_suppression("WSREP: Failed to init table for index scan"); +CALL mtr.add_suppression("WSREP: Failed to apply write set"); +CALL mtr.add_suppression("Failed to report last committed"); + +--source suite/galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_sr/t/MDEV-27615.test b/mysql-test/suite/galera_sr/t/MDEV-27615.test new file mode 100644 index 0000000000000..121a85fb20c2d --- /dev/null +++ b/mysql-test/suite/galera_sr/t/MDEV-27615.test @@ -0,0 +1,72 @@ +# +# MDEV-27615 - Assertion `server_id.is_undefined() == false' +# failed in wsrep::transaction::certify_fragment() +# + +--source include/galera_cluster.inc +--source include/have_debug_sync.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--source suite/galera/include/auto_increment_offset_save.inc + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 + +--connection node_2 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; + +# +# Set debug sync point right before the assert +# +SET DEBUG_SYNC='wsrep_before_fragment_certification SIGNAL before_fragment WAIT_FOR continue'; + +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +--send INSERT INTO t1 VALUES (1); + + +# +# Disconnect node_2 from cluster +# +--connection node_2a +SET SESSION wsrep_sync_wait = 0; +--let $node_2_cluster_address = `SELECT @@wsrep_cluster_address` +SET DEBUG_SYNC='now WAIT_FOR before_fragment'; +SET GLOBAL wsrep_cluster_address = ''; + +--let $wait_condition = SELECT VARIABLE_VALUE = 'Disconnected' FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +SET DEBUG_SYNC = 'now SIGNAL continue'; + + +# +# Disconnect causes connection to node_2 to be closed +# +--connection node_2 +--error 2013 # CR_SERVER_LOST +--reap + + +# +# Reconnect node 2 +# +--connection node_2a +--disable_query_log +--eval SET GLOBAL wsrep_cluster_address = '$node_2_cluster_address'; +--enable_query_log +--source include/wait_wsrep_ready.inc + +# +# Expect the transaction to be rolled back and cleanup +# +SELECT * FROM mysql.wsrep_streaming_log; +SELECT * FROM t1; + +DROP TABLE t1; +SET DEBUG_SYNC = 'RESET'; + +--disconnect node_2 +--connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2 + + +--source suite/galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_sr/t/MDEV-30838.test b/mysql-test/suite/galera_sr/t/MDEV-30838.test new file mode 100644 index 0000000000000..39ca7d2a375b5 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/MDEV-30838.test @@ -0,0 +1,18 @@ +# +# MDEV-30838 - Assertion `m_thd == _current_thd()' failed in +# virtual int Wsrep_client_service::bf_rollback() +# +--source include/galera_cluster.inc +--source include/have_debug_sync.inc +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES(1); +SET debug_dbug='+d,ib_create_table_fail_too_many_trx'; +--error ER_ERROR_DURING_COMMIT +INSERT INTO t1 VALUES(2); +COMMIT; +SELECT * FROM t1; +SET debug_dbug='-d,ib_create_table_fail_too_many_trx'; +DROP TABLE t1; +CALL mtr.add_suppression("Error writing into mysql.wsrep_streaming_log: 177"); diff --git a/mysql-test/suite/galera_sr/t/MDEV-30862.test b/mysql-test/suite/galera_sr/t/MDEV-30862.test new file mode 100644 index 0000000000000..6be77b4d71b40 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/MDEV-30862.test @@ -0,0 +1,24 @@ +# +# MDEV-30862 Assertion `mode_ == m_high_priority' failed in +# void wsrep::client_state::after_applying() +# + +--source include/galera_cluster.inc +--source include/have_sequence.inc + +SET autocommit=0; +SET SESSION wsrep_trx_fragment_size=1; +--error ER_NOT_ALLOWED_COMMAND +CREATE TABLE t2 SELECT seq FROM seq_1_to_50; + + +# +# Same test without using seq +# +CREATE TABLE t1 (f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY); +INSERT INTO t1 VALUES(DEFAULT); +--error ER_NOT_ALLOWED_COMMAND +CREATE TABLE t2 SELECT * FROM t1; + + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test index d1b0d4b8c883a..5d4a58b2d0312 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test @@ -8,6 +8,8 @@ --let $node_1=node_1 --let $node_2=node_2 --source ../galera/include/auto_increment_offset_save.inc +--connection node_2 +call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*"); --connection node_1 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE = InnoDB; diff --git a/mysql-test/suite/galera_sr/t/mdev_18631.test b/mysql-test/suite/galera_sr/t/mdev_18631.test index b6a0d85bbd491..0d1ea34c2f218 100644 --- a/mysql-test/suite/galera_sr/t/mdev_18631.test +++ b/mysql-test/suite/galera_sr/t/mdev_18631.test @@ -14,6 +14,7 @@ CREATE TABLE t1(f1 INT PRIMARY KEY) ENGINE=INNODB; INSERT INTO t1 VALUES (1), (2), (3); --connection node_2 +call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); SELECT * FROM t1; --connection node_1 diff --git a/mysql-test/suite/gcol/inc/gcol_blocked_sql_funcs_main.inc b/mysql-test/suite/gcol/inc/gcol_blocked_sql_funcs_main.inc index 9435551ce6fb2..879e2fe857d86 100644 --- a/mysql-test/suite/gcol/inc/gcol_blocked_sql_funcs_main.inc +++ b/mysql-test/suite/gcol/inc/gcol_blocked_sql_funcs_main.inc @@ -247,3 +247,7 @@ create table t1 (a int); alter table t1 add column r blob generated always as (match(a) against ('' in boolean mode)) virtual; drop table t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/suite/gcol/inc/gcol_column_def_options.inc b/mysql-test/suite/gcol/inc/gcol_column_def_options.inc index 646dc1abc7bf0..d4db5b5de7647 100644 --- a/mysql-test/suite/gcol/inc/gcol_column_def_options.inc +++ b/mysql-test/suite/gcol/inc/gcol_column_def_options.inc @@ -49,18 +49,18 @@ alter table t1 add column (h int generated always as (a+1) virtual, i int as(5) drop table t1; --echo # DEFAULT ---error 1064 +--error ER_PARSE_ERROR create table t1 (a int, b int generated always as (a+1) virtual default 0); create table t1 (a int); ---error 1064 +--error ER_PARSE_ERROR alter table t1 add column b int generated always as (a+1) virtual default 0; drop table t1; --echo # AUTO_INCREMENT ---error 1064 +--error ER_PARSE_ERROR create table t1 (a int, b int generated always as (a+1) virtual AUTO_INCREMENT); create table t1 (a int); ---error 1064 +--error ER_PARSE_ERROR alter table t1 add column b int generated always as (a+1) virtual AUTO_INCREMENT; drop table t1; @@ -203,6 +203,13 @@ create table t1 (a int, b int generated always as(-b) virtual, c int generated a create table t1 (a int, b int generated always as(-c) virtual, c int generated always as (b + 1) virtual); --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) stored, col_int_key int); +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) unique, col_int_key int); +create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key), col_int_key int); +show create table t1; +insert t1 (col_int_key) values (10),(20),(30); +select * from t1; +drop table t1; --echo # Bug#20339347: FAIL TO USE CREATE ....SELECT STATEMENT TO CREATE A NEW TABLE create table t1 (a int, b int generated always as(-a) virtual, c int generated always as (b + 1) stored); diff --git a/mysql-test/suite/gcol/inc/gcol_supported_sql_funcs_main.inc b/mysql-test/suite/gcol/inc/gcol_supported_sql_funcs_main.inc index 88268ddd6c471..3bb44523e6459 100644 --- a/mysql-test/suite/gcol/inc/gcol_supported_sql_funcs_main.inc +++ b/mysql-test/suite/gcol/inc/gcol_supported_sql_funcs_main.inc @@ -12,6 +12,9 @@ # Change Date: # # Change: # ################################################################################ + +--source include/have_des.inc + set time_zone="+03:00"; --echo # --echo # NUMERIC FUNCTIONS @@ -1189,18 +1192,6 @@ let $values1 = 'any value',default; let $rows = 1; --source suite/gcol/inc/gcol_supported_sql_funcs.inc ---echo # DES_ENCRYPT(), DES_DECRYPT() ---source include/have_ssl_crypto_functs.inc -let $cols = a varchar(1024), b varchar(1024) generated always as (des_encrypt(des_decrypt(a,'adf'),'adf')) virtual; -let $values1 = 'MySQL',default; ---disable_warnings -eval create table t1 ($cols); -show create table t1; ---enable_warnings -eval insert into t1 values ($values1); -select * from t1; -drop table t1; - --echo # INET_ATON(), INET_NTOA() let $cols = a varchar(1024), b varchar(1024) generated always as (inet_ntoa(inet_aton(a))) virtual; let $values1 = '127.0.0.1',default; diff --git a/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_innodb.result b/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_innodb.result index fa8f2660aef85..6b7faa18da8f3 100644 --- a/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_innodb.result @@ -129,7 +129,7 @@ create table t1 (a int, b int generated always as (stddev_pop(a)) virtual); ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` # STDDEV_SAMP() create table t1 (a int, b int generated always as (stddev_samp(a)) virtual); -ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` +ERROR HY000: Function or expression 'stddev_samp()' cannot be used in the GENERATED ALWAYS AS clause of `b` # STDDEV() create table t1 (a int, b int generated always as (stddev(a)) virtual); ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` @@ -170,6 +170,9 @@ alter table t1 add column r blob generated always as (match(a) against ('' in boolean mode)) virtual; ERROR HY000: Function or expression 'match ... against()' cannot be used in the GENERATED ALWAYS AS clause of `r` drop table t1; +# +# End of 10.3 tests +# DROP VIEW IF EXISTS v1,v2; DROP TABLE IF EXISTS t1,t2,t3; DROP PROCEDURE IF EXISTS p1; diff --git a/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_myisam.result b/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_myisam.result index b777bb485de4f..99921c658b335 100644 --- a/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_myisam.result @@ -131,7 +131,7 @@ create table t1 (a int, b int generated always as (stddev_pop(a)) virtual); ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` # STDDEV_SAMP() create table t1 (a int, b int generated always as (stddev_samp(a)) virtual); -ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` +ERROR HY000: Function or expression 'stddev_samp()' cannot be used in the GENERATED ALWAYS AS clause of `b` # STDDEV() create table t1 (a int, b int generated always as (stddev(a)) virtual); ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` @@ -172,6 +172,9 @@ alter table t1 add column r blob generated always as (match(a) against ('' in boolean mode)) virtual; ERROR HY000: Function or expression 'match ... against()' cannot be used in the GENERATED ALWAYS AS clause of `r` drop table t1; +# +# End of 10.3 tests +# DROP VIEW IF EXISTS v1,v2; DROP TABLE IF EXISTS t1,t2,t3; DROP PROCEDURE IF EXISTS p1; diff --git a/mysql-test/suite/gcol/r/gcol_bugfixes.result b/mysql-test/suite/gcol/r/gcol_bugfixes.result index 6d93c63fc2f95..f124ebe611c14 100644 --- a/mysql-test/suite/gcol/r/gcol_bugfixes.result +++ b/mysql-test/suite/gcol/r/gcol_bugfixes.result @@ -251,7 +251,7 @@ HAVING x > '2000-02-06' ORDER BY col_time_nokey, pk; x Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '2000-02-06' +Warning 1292 Truncated incorrect DECIMAL value: '2000-02-06' DROP TABLE c; # Bug#21341044: Conditional jump at sort_param::make_sort_key CREATE TABLE t1 ( @@ -489,7 +489,7 @@ t1 CREATE TABLE `t1` ( `a` char(1) DEFAULT NULL, `b` char(1) DEFAULT NULL, `c` char(2) GENERATED ALWAYS AS (`a` <> 0 or `b` <> 0) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES('1','1'); SELECT * FROM t1; a b c @@ -510,7 +510,7 @@ t1 CREATE TABLE `t1` ( `a` char(1) DEFAULT NULL, `b` char(1) DEFAULT NULL, `c` char(2) GENERATED ALWAYS AS (concat(`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES('1','1'); SELECT * FROM t1; a b c diff --git a/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result b/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result index 2f462b3a685f8..8c1925c942aee 100644 --- a/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result @@ -68,7 +68,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 add column c int generated always as (a+2) stored primary key; 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 'primary key' at line 1 drop table t1; @@ -82,7 +82,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL COMMENT 'my comment' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -95,7 +95,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL COMMENT 'my comment' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -115,7 +115,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL COMMENT 'my comment' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t2; Field Type Null Key Default Extra a int(11) YES NULL @@ -137,7 +137,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) STORED -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -161,7 +161,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) STORED -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int, b int generated always as (a % 2) virtual); alter table t1 modify b int generated always as (a % 2) stored references t2(a); @@ -173,7 +173,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; drop table t2; FK options @@ -196,7 +196,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -208,7 +208,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) STORED -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -221,7 +221,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -234,7 +234,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (5 * 2) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -264,6 +264,24 @@ create table t1 (a int, b int generated always as(-c) virtual, c int generated a ERROR 01000: Expression for field `b` is referring to uninitialized field `c` create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) stored, col_int_key int); ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the GENERATED ALWAYS AS clause of `pk` +create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) unique, col_int_key int); +ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the GENERATED ALWAYS AS clause of `pk` +create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key), col_int_key int); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + `col_int_nokey` int(11) GENERATED ALWAYS AS (`pk` + `col_int_key`) VIRTUAL, + `col_int_key` int(11) DEFAULT NULL, + PRIMARY KEY (`pk`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +insert t1 (col_int_key) values (10),(20),(30); +select * from t1; +pk col_int_nokey col_int_key +1 11 10 +2 22 20 +3 33 30 +drop table t1; # Bug#20339347: FAIL TO USE CREATE ....SELECT STATEMENT TO CREATE A NEW TABLE create table t1 (a int, b int generated always as(-a) virtual, c int generated always as (b + 1) stored); insert into t1(a) values(1),(2); @@ -301,7 +319,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL, `c` varchar(12) GENERATED ALWAYS AS ('aaaabb') STORED, `d` blob GENERATED ALWAYS AS (`c`) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 order by a; a b c d 1 2 aaaabb aaaabb @@ -314,7 +332,7 @@ t2 CREATE TABLE `t2` ( `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL, `c` varchar(12) GENERATED ALWAYS AS ('aaaabb') STORED, `d` blob GENERATED ALWAYS AS (`c`) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t3 AS SELECT * FROM t1; SHOW CREATE TABLE t3; Table Create Table @@ -323,7 +341,7 @@ t3 CREATE TABLE `t3` ( `b` int(11) DEFAULT NULL, `c` varchar(12) DEFAULT NULL, `d` blob DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t3 order by a; a b c d 1 2 aaaabb aaaabb @@ -335,7 +353,7 @@ t4 CREATE TABLE `t4` ( `b` int(11) DEFAULT NULL, `c` varchar(12) DEFAULT NULL, `d` blob DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t4 order by b; b c d 2 aaaabb aaaabb @@ -434,7 +452,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin GENERATED ALWAYS AS ('foo bar') VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (i INT); ALTER TABLE t1 ADD COLUMN c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar"); @@ -443,7 +461,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, `c` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin GENERATED ALWAYS AS ('foo bar') VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (i INT COLLATE utf8_bin, c INT COLLATE utf8_bin GENERATED ALWAYS AS (10)); 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 'GENERATED ALWAYS AS (10))' at line 1 @@ -638,7 +656,7 @@ t1 CREATE TABLE `t1` ( `c` char(3) GENERATED ALWAYS AS (substr(`b`,1,3)) VIRTUAL, PRIMARY KEY (`a`), KEY `c` (`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 order by a; a b c 1 bbbb bbb diff --git a/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result b/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result index 4a7f4368dd492..734e05bbcd37c 100644 --- a/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result @@ -68,7 +68,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 add column c int generated always as (a+2) stored primary key; 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 'primary key' at line 1 drop table t1; @@ -82,7 +82,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL COMMENT 'my comment' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -95,7 +95,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL COMMENT 'my comment' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -115,7 +115,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL COMMENT 'my comment' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t2; Field Type Null Key Default Extra a int(11) YES NULL @@ -137,7 +137,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -161,7 +161,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int, b int generated always as (a % 2) virtual); alter table t1 modify b int generated always as (a % 2) stored references t2(a); @@ -173,7 +173,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; drop table t2; FK options @@ -196,7 +196,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -208,7 +208,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -221,7 +221,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -234,7 +234,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (5 * 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -264,6 +264,24 @@ create table t1 (a int, b int generated always as(-c) virtual, c int generated a ERROR 01000: Expression for field `b` is referring to uninitialized field `c` create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) stored, col_int_key int); ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the GENERATED ALWAYS AS clause of `pk` +create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) unique, col_int_key int); +ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the GENERATED ALWAYS AS clause of `pk` +create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key), col_int_key int); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + `col_int_nokey` int(11) GENERATED ALWAYS AS (`pk` + `col_int_key`) VIRTUAL, + `col_int_key` int(11) DEFAULT NULL, + PRIMARY KEY (`pk`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +insert t1 (col_int_key) values (10),(20),(30); +select * from t1; +pk col_int_nokey col_int_key +1 11 10 +2 22 20 +3 33 30 +drop table t1; # Bug#20339347: FAIL TO USE CREATE ....SELECT STATEMENT TO CREATE A NEW TABLE create table t1 (a int, b int generated always as(-a) virtual, c int generated always as (b + 1) stored); insert into t1(a) values(1),(2); @@ -301,7 +319,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL, `c` varchar(12) GENERATED ALWAYS AS ('aaaabb') STORED, `d` blob GENERATED ALWAYS AS (`c`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 order by a; a b c d 1 2 aaaabb aaaabb @@ -314,7 +332,7 @@ t2 CREATE TABLE `t2` ( `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL, `c` varchar(12) GENERATED ALWAYS AS ('aaaabb') STORED, `d` blob GENERATED ALWAYS AS (`c`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t3 AS SELECT * FROM t1; SHOW CREATE TABLE t3; Table Create Table @@ -323,7 +341,7 @@ t3 CREATE TABLE `t3` ( `b` int(11) DEFAULT NULL, `c` varchar(12) DEFAULT NULL, `d` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t3 order by a; a b c d 1 2 aaaabb aaaabb @@ -335,7 +353,7 @@ t4 CREATE TABLE `t4` ( `b` int(11) DEFAULT NULL, `c` varchar(12) DEFAULT NULL, `d` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t4 order by b; b c d 2 aaaabb aaaabb @@ -434,7 +452,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin GENERATED ALWAYS AS ('foo bar') VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (i INT); ALTER TABLE t1 ADD COLUMN c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar"); @@ -443,7 +461,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, `c` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin GENERATED ALWAYS AS ('foo bar') VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (i INT COLLATE utf8_bin, c INT COLLATE utf8_bin GENERATED ALWAYS AS (10)); 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 'GENERATED ALWAYS AS (10))' at line 1 @@ -638,7 +656,7 @@ t1 CREATE TABLE `t1` ( `c` char(3) GENERATED ALWAYS AS (substr(`b`,1,3)) VIRTUAL, PRIMARY KEY (`a`), KEY `c` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 order by a; a b c 1 bbbb bbb diff --git a/mysql-test/suite/gcol/r/gcol_keys_innodb.result b/mysql-test/suite/gcol/r/gcol_keys_innodb.result index c2027d21442e3..0228f9be842c7 100644 --- a/mysql-test/suite/gcol/r/gcol_keys_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_keys_innodb.result @@ -13,7 +13,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) VIRTUAL, UNIQUE KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -26,7 +26,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, UNIQUE KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -39,7 +39,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) VIRTUAL, UNIQUE KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -52,7 +52,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, UNIQUE KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -77,7 +77,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) VIRTUAL, KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -92,7 +92,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -105,7 +105,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, KEY `a` (`a`,`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES MUL NULL diff --git a/mysql-test/suite/gcol/r/gcol_keys_myisam.result b/mysql-test/suite/gcol/r/gcol_keys_myisam.result index 364d53afe1d8d..523ff3a376443 100644 --- a/mysql-test/suite/gcol/r/gcol_keys_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_keys_myisam.result @@ -13,7 +13,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) VIRTUAL, UNIQUE KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -26,7 +26,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, UNIQUE KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -39,7 +39,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) VIRTUAL, UNIQUE KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -52,7 +52,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, UNIQUE KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -77,7 +77,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) VIRTUAL, KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -92,7 +92,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -105,7 +105,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, KEY `a` (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES MUL NULL diff --git a/mysql-test/suite/gcol/r/gcol_non_stored_columns_innodb.result b/mysql-test/suite/gcol/r/gcol_non_stored_columns_innodb.result index da1ecda5ca700..6527b50be958c 100644 --- a/mysql-test/suite/gcol/r/gcol_non_stored_columns_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_non_stored_columns_innodb.result @@ -91,7 +91,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) STORED -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 8. ALTER. Modify virtual non-stored -> virtual stored create table t1 (a int, b int generated always as (a % 2) virtual); @@ -102,7 +102,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 9. CREATE LIKE # - Column1: "real" @@ -141,7 +141,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` varchar(5) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 11. ALTER. Dropping a virtual stored column. # - Column1: virtual stored @@ -163,7 +163,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` char(5) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 12. ALTER. Adding a new virtual non-stored column. create table t1 (a int, b datetime); @@ -184,7 +184,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (dayofyear(`b`)) VIRTUAL, `b` datetime DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 13. ALTER. Adding a new virtual stored column. create table t1 (a int, b datetime); @@ -205,7 +205,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (dayofyear(`b`)) STORED, `b` datetime DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 15. ALTER. Changing the expression of a virtual non-stored column. create table t1 (a int, b datetime, c int generated always as (week(b)) virtual); @@ -226,7 +226,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (week(`b`,1)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; DROP VIEW IF EXISTS v1,v2; DROP TABLE IF EXISTS t1,t2,t3; diff --git a/mysql-test/suite/gcol/r/gcol_non_stored_columns_myisam.result b/mysql-test/suite/gcol/r/gcol_non_stored_columns_myisam.result index 9165fc31cf743..3e3b12f146845 100644 --- a/mysql-test/suite/gcol/r/gcol_non_stored_columns_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_non_stored_columns_myisam.result @@ -91,7 +91,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 8. ALTER. Modify virtual non-stored -> virtual stored create table t1 (a int, b int generated always as (a % 2) virtual); @@ -102,7 +102,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 9. CREATE LIKE # - Column1: "real" @@ -141,7 +141,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` varchar(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 11. ALTER. Dropping a virtual stored column. # - Column1: virtual stored @@ -163,7 +163,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` char(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 12. ALTER. Adding a new virtual non-stored column. create table t1 (a int, b datetime); @@ -184,7 +184,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (dayofyear(`b`)) VIRTUAL, `b` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 13. ALTER. Adding a new virtual stored column. create table t1 (a int, b datetime); @@ -205,7 +205,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (dayofyear(`b`)) STORED, `b` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 15. ALTER. Changing the expression of a virtual non-stored column. create table t1 (a int, b datetime, c int generated always as (week(b)) virtual); @@ -226,7 +226,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (week(`b`,1)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; DROP VIEW IF EXISTS v1,v2; DROP TABLE IF EXISTS t1,t2,t3; diff --git a/mysql-test/suite/gcol/r/gcol_purge.result b/mysql-test/suite/gcol/r/gcol_purge.result index ea8369ad8e5c6..11063c7cd6f36 100644 --- a/mysql-test/suite/gcol/r/gcol_purge.result +++ b/mysql-test/suite/gcol/r/gcol_purge.result @@ -1,7 +1,11 @@ +SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET @save_dbug=@@GLOBAL.debug_dbug; +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; CREATE TABLE t1(f1 INT NOT NULL, f2 int not null, f3 int generated always as (f2 * 2) VIRTUAL, primary key(f1), INDEX (f3))ENGINE=InnoDB; connect con1,localhost,root,,,; +InnoDB 0 transactions not purged START TRANSACTION WITH CONSISTENT SNAPSHOT; connection default; INSERT INTO t1(f1, f2) VALUES(1,2); @@ -18,5 +22,6 @@ commit; disconnect con1; disconnect con2; connection default; -set global debug_dbug=default; +SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; +SET GLOBAL debug_dbug=@save_dbug; DROP TABLE t1; diff --git a/mysql-test/suite/gcol/r/gcol_rollback.result b/mysql-test/suite/gcol/r/gcol_rollback.result index 5ee94d3ef446b..0bbf034122bd8 100644 --- a/mysql-test/suite/gcol/r/gcol_rollback.result +++ b/mysql-test/suite/gcol/r/gcol_rollback.result @@ -79,10 +79,29 @@ a b c d ROLLBACK; SET DEBUG_SYNC = 'now SIGNAL dml_done'; connection con1; -disconnect con1; connection default; SELECT * FROM t; a b d 9 10 29 DROP TABLE t; SET DEBUG_SYNC = 'RESET'; +# +# MDEV-30597 Assertion `flag == 1' failed in +# row_build_index_entry_low +# +CREATE TABLE t1 ( +col1 INT PRIMARY KEY, col_text TEXT, +col_text_g TEXT GENERATED ALWAYS AS (SUBSTR(col_text,1,499)) +) ENGINE = InnoDB ROW_FORMAT = Compact; +connection con1; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +INSERT INTO t1 (col1) VALUES (1) ; +DELETE FROM t1 WHERE col1 = 1; +ALTER TABLE t1 ADD UNIQUE INDEX (col_text_g(9)); +BEGIN; +INSERT INTO t1 (col1) VALUES (1); +ROLLBACK; +disconnect con1; +DROP TABLE t1; +# End of 10.4 tests diff --git a/mysql-test/suite/gcol/r/gcol_select_innodb.result b/mysql-test/suite/gcol/r/gcol_select_innodb.result index 17acbcf2bb205..72d1e9f320c23 100644 --- a/mysql-test/suite/gcol/r/gcol_select_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_select_innodb.result @@ -492,11 +492,11 @@ ORDER BY field1, alias1.col_date_key, field1 ASC, field1 DESC, alias1.col_time_key ASC, field1; field1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'c' -Warning 1292 Truncated incorrect DOUBLE value: 't' -Warning 1292 Truncated incorrect DOUBLE value: 'm' -Warning 1292 Truncated incorrect DOUBLE value: 'd' -Warning 1292 Truncated incorrect DOUBLE value: 'd' +Warning 1292 Truncated incorrect DECIMAL value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 't' +Warning 1292 Truncated incorrect DECIMAL value: 'm' +Warning 1292 Truncated incorrect DECIMAL value: 'd' +Warning 1292 Truncated incorrect DECIMAL value: 'd' DROP TABLE cc; SET sql_mode=@save_old_sql_mode; # diff --git a/mysql-test/suite/gcol/r/gcol_select_myisam.result b/mysql-test/suite/gcol/r/gcol_select_myisam.result index 67c495f6a6e78..0d18976f3bf38 100644 --- a/mysql-test/suite/gcol/r/gcol_select_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_select_myisam.result @@ -1076,11 +1076,11 @@ ORDER BY field1, alias1.col_date_key, field1 ASC, field1 DESC, alias1.col_time_key ASC, field1; field1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'c' -Warning 1292 Truncated incorrect DOUBLE value: 't' -Warning 1292 Truncated incorrect DOUBLE value: 'm' -Warning 1292 Truncated incorrect DOUBLE value: 'd' -Warning 1292 Truncated incorrect DOUBLE value: 'd' +Warning 1292 Truncated incorrect DECIMAL value: 'c' +Warning 1292 Truncated incorrect DECIMAL value: 't' +Warning 1292 Truncated incorrect DECIMAL value: 'm' +Warning 1292 Truncated incorrect DECIMAL value: 'd' +Warning 1292 Truncated incorrect DECIMAL value: 'd' DROP TABLE cc; SET sql_mode=@save_old_sql_mode; # @@ -1179,13 +1179,13 @@ 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 1292 Truncated incorrect DOUBLE value: 'cccc' -Warning 1292 Truncated incorrect DOUBLE value: 'cccc' +Warning 1292 Truncated incorrect DECIMAL value: 'cccc' SELECT /*+ bka() */ 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c WHERE b.b>c.a; c Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'cccc' -Warning 1292 Truncated incorrect DOUBLE value: 'cccc' +Warning 1292 Truncated incorrect DECIMAL value: 'cccc' DROP TABLE t; set @optimizer_switch_save = @@optimizer_switch; set optimizer_switch='mrr_cost_based=off'; diff --git a/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_innodb.result b/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_innodb.result index fbdd663d7214d..9929f4d1eaa61 100644 --- a/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_innodb.result @@ -11,7 +11,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (abs(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-1, default); select * from t1; a b @@ -26,7 +26,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(acos(`a`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1, default); insert into t1 values (1.0001,default); insert into t1 values (0,default); @@ -45,7 +45,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(asin(`a`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (0.2, default); insert into t1 values (1.0001,default); select * from t1; @@ -63,7 +63,7 @@ t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, `c` double GENERATED ALWAYS AS (format(atan(`a`,`b`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-2,2,default); insert into t1 values (format(PI(),6),0,default); select * from t1; @@ -79,7 +79,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `c` double GENERATED ALWAYS AS (format(atan(`a`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-2,default); insert into t1 values (format(PI(),6),default); select * from t1; @@ -97,7 +97,7 @@ t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, `c` double GENERATED ALWAYS AS (format(atan(`a`,`b`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-2,2,default); insert into t1 values (format(PI(),6),0,default); select * from t1; @@ -114,7 +114,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (ceiling(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1.23,default); insert into t1 values (-1.23,default); select * from t1; @@ -133,7 +133,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL, `d` varchar(10) GENERATED ALWAYS AS (conv(`a`,`b`,`c`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a',16,2,default); insert into t1 values ('6e',18,8,default); insert into t1 values (-17,10,-18,default); @@ -154,7 +154,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(cos(`a`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (format(PI(),6),default); select * from t1; a b @@ -169,7 +169,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(cot(`a`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (0,default); insert into t1 values (12,default); select * from t1; @@ -185,7 +185,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (crc32(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); insert into t1 values ('mysql',default); select * from t1; @@ -202,7 +202,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(degrees(`a`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (format(PI(),6),default); insert into t1 values (format(PI()/2,6),default); select * from t1; @@ -219,7 +219,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (`a` / 2) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); select * from t1; a b @@ -234,7 +234,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(exp(`a`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); insert into t1 values (-2,default); insert into t1 values (0,default); @@ -253,7 +253,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (floor(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1.23,default); insert into t1 values (-1.23,default); select * from t1; @@ -270,7 +270,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(ln(`a`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); insert into t1 values (-2,default); Warnings: @@ -292,7 +292,7 @@ t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, `c` double GENERATED ALWAYS AS (format(log(`a`,`b`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,65536,default); insert into t1 values (10,100,default); insert into t1 values (1,100,default); @@ -314,7 +314,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(log(`a`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); insert into t1 values (-2,default); Warnings: @@ -335,7 +335,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(log2(`a`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (65536,default); insert into t1 values (-100,default); Warnings: @@ -356,7 +356,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(log10(`a`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); insert into t1 values (100,default); insert into t1 values (-100,default); @@ -379,7 +379,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (`a` - 1) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); select * from t1; a b @@ -394,7 +394,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 10) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (11,default); select * from t1; @@ -411,7 +411,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 10) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (11,default); select * from t1; @@ -428,7 +428,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (conv(`a`,10,8)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (12,default); select * from t1; a b @@ -443,7 +443,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(pi() * `a` * `a`,6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); select * from t1; a b @@ -458,7 +458,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); select * from t1; a b @@ -474,7 +474,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (pow(`a`,2)) VIRTUAL, `c` int(11) GENERATED ALWAYS AS (pow(`a`,2)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default,default); insert into t1 values (2,default,default); select * from t1; @@ -491,7 +491,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(radians(`a`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (90,default); select * from t1; a b @@ -506,7 +506,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (round(`a`,0)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-1.23,default); insert into t1 values (-1.58,default); insert into t1 values (1.58,default); @@ -525,7 +525,7 @@ t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (round(`a`,`b`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1.298,1,default); insert into t1 values (1.298,0,default); insert into t1 values (23.298,-1,default); @@ -544,7 +544,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (sign(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-32,default); insert into t1 values (0,default); insert into t1 values (234,default); @@ -563,7 +563,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(sin(`a`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (format(PI()/2,6),default); select * from t1; a b @@ -578,7 +578,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(sqrt(`a`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (4,default); insert into t1 values (20,default); insert into t1 values (-16,default); @@ -597,7 +597,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(tan(`a`),6)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (format(PI(),6),default); insert into t1 values (format(PI()+1,6),default); select * from t1; @@ -614,7 +614,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (`a` * 3) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (0,default); insert into t1 values (1,default); insert into t1 values (2,default); @@ -633,7 +633,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (truncate(`a`,4)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1.223,default); insert into t1 values (1.999,default); insert into t1 values (1.999,default); @@ -654,7 +654,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (-`a`) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (-1,default); select * from t1; @@ -674,7 +674,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(2) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (ascii(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2',default); insert into t1 values (2,default); insert into t1 values ('dx',default); @@ -693,7 +693,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (conv(`a`,10,2)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (12,default); select * from t1; a b @@ -708,7 +708,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (bit_length(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -723,7 +723,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (char_length(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -739,7 +739,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` varbinary(10) GENERATED ALWAYS AS (char(`a`,`b`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (77,121,default); select * from t1; a b c @@ -754,7 +754,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (char_length(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -770,7 +770,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` varchar(20) GENERATED ALWAYS AS (concat_ws(',',`a`,`b`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('value1','value2',default); select * from t1; a b c @@ -786,7 +786,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` varchar(20) GENERATED ALWAYS AS (concat(`a`,',',`b`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('value1','value2',default); select * from t1; a b c @@ -803,7 +803,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(10) DEFAULT NULL, `c` int(11) DEFAULT NULL, `d` varchar(10) GENERATED ALWAYS AS (elt(`c`,`a`,`b`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('value1','value2',1,default); insert into t1 values ('value1','value2',2,default); select * from t1; @@ -820,7 +820,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (export_set(`a`,'1','0','',10)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (6,default); select * from t1; a b @@ -836,7 +836,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (field('aa',`a`,`b`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('aa','bb',default); insert into t1 values ('bb','aa',default); select * from t1; @@ -854,7 +854,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (find_in_set(`a`,`b`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('aa','aa,bb,cc',default); insert into t1 values ('aa','bb,aa,cc',default); select * from t1; @@ -871,7 +871,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` varchar(20) GENERATED ALWAYS AS (format(`a`,2)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (12332.123456,default); select * from t1; a b @@ -886,7 +886,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (hex(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (17,default); select * from t1; a b @@ -900,7 +900,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (hex(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -916,7 +916,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` varchar(20) GENERATED ALWAYS AS (insert(`a`,octet_length(`a`),octet_length(`b`),`b`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('start,','end',default); select * from t1; a b c @@ -932,7 +932,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (locate(`b`,`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar,','bar',default); insert into t1 values ('xbar,','foobar',default); select * from t1; @@ -949,7 +949,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (lcase(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -964,7 +964,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(5) GENERATED ALWAYS AS (left(`a`,5)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar',default); select * from t1; a b @@ -979,7 +979,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (octet_length(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -994,7 +994,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` like 'H%o') VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); select * from t1; @@ -1011,7 +1011,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (locate('bar',`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar',default); select * from t1; a b @@ -1026,7 +1026,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (lcase(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -1041,7 +1041,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (lpad(`a`,4,' ')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); insert into t1 values ('M',default); select * from t1; @@ -1058,7 +1058,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (ltrim(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (' MySQL',default); insert into t1 values ('MySQL',default); select * from t1; @@ -1077,7 +1077,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(10) DEFAULT NULL, `c` int(11) DEFAULT NULL, `d` varchar(30) GENERATED ALWAYS AS (make_set(`c`,`a`,`b`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a','b',1,default); insert into t1 values ('a','b',3,default); select * from t1; @@ -1094,7 +1094,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,1,2)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar',default); select * from t1; a b @@ -1109,7 +1109,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` not like 'H%o') VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); select * from t1; @@ -1126,7 +1126,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (!(`a` regexp 'H.+o')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); insert into t1 values ('hello',default); select * from t1; @@ -1143,7 +1143,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (octet_length(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -1158,7 +1158,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (ord(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2',default); select * from t1; a b @@ -1173,7 +1173,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (locate('bar',`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar',default); select * from t1; a b @@ -1188,7 +1188,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (quote(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Don\'t',default); select * from t1; a b @@ -1203,7 +1203,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` regexp 'H.+o') VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); insert into t1 values ('hello',default); select * from t1; @@ -1220,7 +1220,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(30) GENERATED ALWAYS AS (repeat(`a`,3)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -1235,7 +1235,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(30) GENERATED ALWAYS AS (replace(`a`,'aa','bb')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('maa',default); select * from t1; a b @@ -1250,7 +1250,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(30) GENERATED ALWAYS AS (reverse(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('maa',default); select * from t1; a b @@ -1265,7 +1265,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (right(`a`,4)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar',default); select * from t1; a b @@ -1280,7 +1280,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` regexp 'H.+o') VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); select * from t1; @@ -1297,7 +1297,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (rpad(`a`,4,'??')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('He',default); select * from t1; a b @@ -1312,7 +1312,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (rtrim(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello ',default); select * from t1; a b @@ -1327,7 +1327,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(20) GENERATED ALWAYS AS (soundex(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); select * from t1; a b @@ -1343,7 +1343,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (soundex(`a`) = soundex(`b`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello','Hello',default); insert into t1 values ('Hello','MySQL',default); insert into t1 values ('Hello','hello',default); @@ -1362,7 +1362,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (concat(`a`,space(5))) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello', default); select * from t1; a b @@ -1378,7 +1378,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(9) DEFAULT NULL, `b` varchar(9) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (strcmp(`a`,`b`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello','Hello', default); insert into t1 values ('Hello','Hello1', default); select * from t1; @@ -1395,7 +1395,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,2)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); select * from t1; a b @@ -1410,7 +1410,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (substring_index(`a`,'.',2)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('www.mysql.com',default); select * from t1; a b @@ -1425,7 +1425,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,2,2)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); select * from t1; a b @@ -1440,7 +1440,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (trim(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (' aa ',default); select * from t1; a b @@ -1455,7 +1455,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (ucase(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -1470,7 +1470,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (unhex(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('4D7953514C',default); select * from t1; a b @@ -1485,7 +1485,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (ucase(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -1500,7 +1500,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (weight_string(`a`,0,4,65)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -1518,7 +1518,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(16) GENERATED ALWAYS AS (case `a` when NULL then 'asd' when 'b' then 'B' else `a` end) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (NULL,default); insert into t1 values ('b',default); insert into t1 values ('c',default); @@ -1538,7 +1538,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (if(`a` = 1,`a`,`b`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,2,default); insert into t1 values (3,4,default); select * from t1; @@ -1556,7 +1556,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` varchar(10) GENERATED ALWAYS AS (ifnull(`a`,'DEFAULT')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (NULL,'adf',default); insert into t1 values ('a','adf',default); select * from t1; @@ -1573,7 +1573,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (nullif(`a`,'DEFAULT')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('DEFAULT',default); insert into t1 values ('a',default); select * from t1; @@ -1593,7 +1593,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` > 0 and `a` < 2) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-1,default); insert into t1 values (1,default); select * from t1; @@ -1610,7 +1610,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` between 0 and 2) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-1,default); insert into t1 values (1,default); select * from t1; @@ -1627,7 +1627,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varbinary(10) GENERATED ALWAYS AS (cast(`a` as char charset binary)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('11',default); insert into t1 values (1,default); select * from t1; @@ -1644,7 +1644,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` & 5) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (0,default); select * from t1; @@ -1661,7 +1661,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (~`a`) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); Warnings: Warning 1264 Out of range value for column 'b' at row 1 @@ -1678,7 +1678,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` | 5) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (0,default); insert into t1 values (2,default); @@ -1697,7 +1697,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` ^ 5) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (0,default); insert into t1 values (2,default); @@ -1716,7 +1716,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` DIV 5) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (7,default); select * from t1; @@ -1734,7 +1734,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` <=> `b`) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,1,default); insert into t1 values (NULL,NULL,default); insert into t1 values (1,NULL,default); @@ -1754,7 +1754,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` = `b`) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); select * from t1; @@ -1772,7 +1772,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` >= `b`) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); select * from t1; @@ -1790,7 +1790,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` > `b`) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); select * from t1; @@ -1807,7 +1807,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` is not null) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (NULL,default); select * from t1; @@ -1824,7 +1824,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` is null) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (NULL,default); select * from t1; @@ -1841,7 +1841,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` << 2) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (3,default); select * from t1; @@ -1859,7 +1859,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` <= `b`) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); insert into t1 values ('b','c',default); @@ -1879,7 +1879,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` < `b`) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); insert into t1 values ('b','c',default); @@ -1898,7 +1898,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` not between 0 and 2) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-1,default); insert into t1 values (1,default); select * from t1; @@ -1916,7 +1916,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` <> `b`) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); insert into t1 values ('b','c',default); @@ -1936,7 +1936,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` <> `b`) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); insert into t1 values ('b','c',default); @@ -1955,7 +1955,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` > 5 or `a` < 3) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (4,default); select * from t1; @@ -1972,7 +1972,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` >> 2) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (8,default); insert into t1 values (3,default); select * from t1; @@ -1989,7 +1989,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` xor 5) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (0,default); insert into t1 values (1,default); insert into t1 values (2,default); @@ -2011,7 +2011,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (`a` + interval 1 month) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2026,7 +2026,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (addtime(`a`,'02:00:00')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2041,7 +2041,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (convert_tz(`a`,'MET','UTC')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2056,7 +2056,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (`a` + interval 1 month) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2071,7 +2071,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` varchar(64) GENERATED ALWAYS AS (date_format(`a`,'%W %M %D')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2086,7 +2086,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (`a` - interval 1 month) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2101,7 +2101,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (cast(`a` as date)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31 02:00:00',default); select * from t1; a b @@ -2116,7 +2116,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (to_days(`a`) - to_days('2000-01-01')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2131,7 +2131,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (dayofmonth(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2146,7 +2146,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (dayname(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2161,7 +2161,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (dayofmonth(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2176,7 +2176,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (dayofweek(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2191,7 +2191,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (dayofyear(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2206,7 +2206,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (extract(year from `a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2221,7 +2221,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (from_days(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (730669,default); select * from t1; a b @@ -2236,7 +2236,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (from_unixtime(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1196440219,default); select * from t1; a b @@ -2251,7 +2251,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` varchar(32) GENERATED ALWAYS AS (date_format(`a`,get_format(DATE, 'EUR'))) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2266,7 +2266,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (hour(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('10:05:03',default); select * from t1; a b @@ -2281,7 +2281,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (last_day(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2003-02-05',default); insert into t1 values ('2003-02-32',default); select * from t1; @@ -2297,7 +2297,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (makedate(`a`,1)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2001,default); select * from t1; a b @@ -2312,7 +2312,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` time GENERATED ALWAYS AS (maketime(`a`,1,3)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (12,default); select * from t1; a b @@ -2327,7 +2327,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (microsecond(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2009-12-31 12:00:00.123456',default); insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; @@ -2344,7 +2344,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (minute(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; a b @@ -2359,7 +2359,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (month(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; a b @@ -2374,7 +2374,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` varchar(16) GENERATED ALWAYS AS (monthname(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; a b @@ -2389,7 +2389,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (period_add(`a`,2)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (200801,default); select * from t1; a b @@ -2405,7 +2405,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (period_diff(`a`,`b`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (200802,200703,default); select * from t1; a b c @@ -2420,7 +2420,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (quarter(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2435,7 +2435,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, `b` time GENERATED ALWAYS AS (sec_to_time(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2378,default); select * from t1; a b @@ -2450,7 +2450,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (second(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('10:05:03',default); select * from t1; a b @@ -2465,7 +2465,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(64) DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (str_to_date(`a`,'%m/%d/%Y')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('04/30/2004',default); select * from t1; a b @@ -2480,7 +2480,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (`a` - interval 1 month) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2495,7 +2495,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (subtime(`a`,'02:00:00')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2510,7 +2510,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` varchar(32) GENERATED ALWAYS AS (time_format(`a`,'%r')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31 02:03:04',default); select * from t1; a b @@ -2525,7 +2525,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (time_to_sec(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('22:23:00',default); select * from t1; a b @@ -2540,7 +2540,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` time GENERATED ALWAYS AS (cast(`a` as time)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31 02:03:04',default); select * from t1; a b @@ -2556,7 +2556,7 @@ t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime DEFAULT NULL, `c` time GENERATED ALWAYS AS (timediff(`a`,`b`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-12-31 23:59:59.000001','2008-12-30 01:01:01.000002',default); select * from t1; a b c @@ -2571,7 +2571,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` timestamp GENERATED ALWAYS AS (cast(`a` as datetime)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-12-31',default); select * from t1; a b @@ -2586,7 +2586,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` timestamp GENERATED ALWAYS AS (`a` + interval 1 minute) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2003-01-02',default); select * from t1; a b @@ -2601,7 +2601,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c` bigint(20) GENERATED ALWAYS AS (timestampdiff(MONTH,`a`,`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2003-02-01',default); select * from t1; a c @@ -2616,7 +2616,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (to_days(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2007-10-07',default); select * from t1; a b @@ -2631,7 +2631,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (week(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-09-01',default); select * from t1; a b @@ -2646,7 +2646,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (weekday(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-09-01',default); select * from t1; a b @@ -2661,7 +2661,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (week(`a`,3)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-09-01',default); select * from t1; a b @@ -2676,7 +2676,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (year(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-09-01',default); select * from t1; a b @@ -2691,7 +2691,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (yearweek(`a`,0)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-09-01',default); select * from t1; a b @@ -2713,7 +2713,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` bigint(20) unsigned GENERATED ALWAYS AS (cast(`a` as unsigned)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (-1,default); Warnings: @@ -2734,7 +2734,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` bigint(20) unsigned GENERATED ALWAYS AS (cast(`a` as unsigned)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (-1,default); Warnings: @@ -2758,7 +2758,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (extractvalue(`a`,'/b')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -2777,7 +2777,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (aes_encrypt(aes_decrypt(`a`,'adf'),'adf')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -2792,7 +2792,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (bit_count(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (5,default); select * from t1; a b @@ -2807,7 +2807,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (charset(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -2822,7 +2822,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (coercibility(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -2837,7 +2837,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (collation(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -2852,7 +2852,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (uncompress(compress(`a`))) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -2867,7 +2867,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (decode(encode(`a`,'abc'),'abc')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -2882,27 +2882,13 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT 'aaa', `b` varchar(1024) GENERATED ALWAYS AS (ifnull(`a`,default(`a`))) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('any value',default); select * from t1; a b any value any value drop table t1; set sql_warnings = 0; -# DES_ENCRYPT(), DES_DECRYPT() -create table t1 (a varchar(1024), b varchar(1024) generated always as (des_encrypt(des_decrypt(a,'adf'),'adf')) virtual); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) GENERATED ALWAYS AS (des_encrypt(des_decrypt(`a`,'adf'),'adf')) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -insert into t1 values ('MySQL',default); -select * from t1; -a b -MySQL �w2�� -��� -drop table t1; # INET_ATON(), INET_NTOA() set sql_warnings = 1; create table t1 (a varchar(1024), b varchar(1024) generated always as (inet_ntoa(inet_aton(a))) virtual); @@ -2911,7 +2897,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (inet_ntoa(inet_aton(`a`))) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('127.0.0.1',default); select * from t1; a b @@ -2926,7 +2912,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varbinary(32) GENERATED ALWAYS AS (md5(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('testing',default); select * from t1; a b @@ -2941,7 +2927,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (password(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('badpwd',default); select * from t1; a b @@ -2956,7 +2942,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (sha(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -2971,7 +2957,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (sha(`a`)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -2986,7 +2972,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (sha2(`a`,224)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -3001,7 +2987,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(1) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (uncompressed_length(compress(repeat(`a`,30)))) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a',default); select * from t1; a b diff --git a/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_myisam.result b/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_myisam.result index c92760f75b5a2..802e830a58763 100644 --- a/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_myisam.result @@ -11,7 +11,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (abs(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-1, default); select * from t1; a b @@ -26,7 +26,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(acos(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1, default); insert into t1 values (1.0001,default); insert into t1 values (0,default); @@ -45,7 +45,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(asin(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (0.2, default); insert into t1 values (1.0001,default); select * from t1; @@ -63,7 +63,7 @@ t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, `c` double GENERATED ALWAYS AS (format(atan(`a`,`b`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-2,2,default); insert into t1 values (format(PI(),6),0,default); select * from t1; @@ -79,7 +79,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `c` double GENERATED ALWAYS AS (format(atan(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-2,default); insert into t1 values (format(PI(),6),default); select * from t1; @@ -97,7 +97,7 @@ t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, `c` double GENERATED ALWAYS AS (format(atan(`a`,`b`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-2,2,default); insert into t1 values (format(PI(),6),0,default); select * from t1; @@ -114,7 +114,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (ceiling(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1.23,default); insert into t1 values (-1.23,default); select * from t1; @@ -133,7 +133,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL, `d` varchar(10) GENERATED ALWAYS AS (conv(`a`,`b`,`c`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a',16,2,default); insert into t1 values ('6e',18,8,default); insert into t1 values (-17,10,-18,default); @@ -154,7 +154,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(cos(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (format(PI(),6),default); select * from t1; a b @@ -169,7 +169,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(cot(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (0,default); insert into t1 values (12,default); select * from t1; @@ -185,7 +185,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (crc32(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); insert into t1 values ('mysql',default); select * from t1; @@ -202,7 +202,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(degrees(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (format(PI(),6),default); insert into t1 values (format(PI()/2,6),default); select * from t1; @@ -219,7 +219,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (`a` / 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); select * from t1; a b @@ -234,7 +234,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(exp(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); insert into t1 values (-2,default); insert into t1 values (0,default); @@ -253,7 +253,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (floor(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1.23,default); insert into t1 values (-1.23,default); select * from t1; @@ -270,7 +270,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(ln(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); insert into t1 values (-2,default); Warnings: @@ -292,7 +292,7 @@ t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, `c` double GENERATED ALWAYS AS (format(log(`a`,`b`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,65536,default); insert into t1 values (10,100,default); insert into t1 values (1,100,default); @@ -314,7 +314,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(log(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); insert into t1 values (-2,default); Warnings: @@ -335,7 +335,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(log2(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (65536,default); insert into t1 values (-100,default); Warnings: @@ -356,7 +356,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(log10(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); insert into t1 values (100,default); insert into t1 values (-100,default); @@ -379,7 +379,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (`a` - 1) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); select * from t1; a b @@ -394,7 +394,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 10) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (11,default); select * from t1; @@ -411,7 +411,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 10) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (11,default); select * from t1; @@ -428,7 +428,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (conv(`a`,10,8)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (12,default); select * from t1; a b @@ -443,7 +443,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(pi() * `a` * `a`,6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); select * from t1; a b @@ -458,7 +458,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); select * from t1; a b @@ -474,7 +474,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (pow(`a`,2)) VIRTUAL, `c` int(11) GENERATED ALWAYS AS (pow(`a`,2)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default,default); insert into t1 values (2,default,default); select * from t1; @@ -491,7 +491,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(radians(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (90,default); select * from t1; a b @@ -506,7 +506,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (round(`a`,0)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-1.23,default); insert into t1 values (-1.58,default); insert into t1 values (1.58,default); @@ -525,7 +525,7 @@ t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (round(`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1.298,1,default); insert into t1 values (1.298,0,default); insert into t1 values (23.298,-1,default); @@ -544,7 +544,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (sign(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-32,default); insert into t1 values (0,default); insert into t1 values (234,default); @@ -563,7 +563,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(sin(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (format(PI()/2,6),default); select * from t1; a b @@ -578,7 +578,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(sqrt(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (4,default); insert into t1 values (20,default); insert into t1 values (-16,default); @@ -597,7 +597,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(tan(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (format(PI(),6),default); insert into t1 values (format(PI()+1,6),default); select * from t1; @@ -614,7 +614,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (`a` * 3) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (0,default); insert into t1 values (1,default); insert into t1 values (2,default); @@ -633,7 +633,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (truncate(`a`,4)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1.223,default); insert into t1 values (1.999,default); insert into t1 values (1.999,default); @@ -654,7 +654,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (-`a`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (-1,default); select * from t1; @@ -674,7 +674,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(2) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (ascii(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2',default); insert into t1 values (2,default); insert into t1 values ('dx',default); @@ -693,7 +693,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (conv(`a`,10,2)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (12,default); select * from t1; a b @@ -708,7 +708,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (bit_length(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -723,7 +723,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (char_length(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -739,7 +739,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` varbinary(10) GENERATED ALWAYS AS (char(`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (77,121,default); select * from t1; a b c @@ -754,7 +754,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (char_length(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -770,7 +770,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` varchar(20) GENERATED ALWAYS AS (concat_ws(',',`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('value1','value2',default); select * from t1; a b c @@ -786,7 +786,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` varchar(20) GENERATED ALWAYS AS (concat(`a`,',',`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('value1','value2',default); select * from t1; a b c @@ -803,7 +803,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(10) DEFAULT NULL, `c` int(11) DEFAULT NULL, `d` varchar(10) GENERATED ALWAYS AS (elt(`c`,`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('value1','value2',1,default); insert into t1 values ('value1','value2',2,default); select * from t1; @@ -820,7 +820,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (export_set(`a`,'1','0','',10)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (6,default); select * from t1; a b @@ -836,7 +836,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (field('aa',`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('aa','bb',default); insert into t1 values ('bb','aa',default); select * from t1; @@ -854,7 +854,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (find_in_set(`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('aa','aa,bb,cc',default); insert into t1 values ('aa','bb,aa,cc',default); select * from t1; @@ -871,7 +871,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` varchar(20) GENERATED ALWAYS AS (format(`a`,2)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (12332.123456,default); select * from t1; a b @@ -886,7 +886,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (hex(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (17,default); select * from t1; a b @@ -900,7 +900,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (hex(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -916,7 +916,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` varchar(20) GENERATED ALWAYS AS (insert(`a`,octet_length(`a`),octet_length(`b`),`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('start,','end',default); select * from t1; a b c @@ -932,7 +932,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (locate(`b`,`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar,','bar',default); insert into t1 values ('xbar,','foobar',default); select * from t1; @@ -949,7 +949,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (lcase(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -964,7 +964,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(5) GENERATED ALWAYS AS (left(`a`,5)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar',default); select * from t1; a b @@ -979,7 +979,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (octet_length(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -994,7 +994,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` like 'H%o') VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); select * from t1; @@ -1011,7 +1011,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (locate('bar',`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar',default); select * from t1; a b @@ -1026,7 +1026,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (lcase(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -1041,7 +1041,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (lpad(`a`,4,' ')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); insert into t1 values ('M',default); select * from t1; @@ -1058,7 +1058,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (ltrim(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (' MySQL',default); insert into t1 values ('MySQL',default); select * from t1; @@ -1077,7 +1077,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(10) DEFAULT NULL, `c` int(11) DEFAULT NULL, `d` varchar(30) GENERATED ALWAYS AS (make_set(`c`,`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a','b',1,default); insert into t1 values ('a','b',3,default); select * from t1; @@ -1094,7 +1094,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,1,2)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar',default); select * from t1; a b @@ -1109,7 +1109,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` not like 'H%o') VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); select * from t1; @@ -1126,7 +1126,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (!(`a` regexp 'H.+o')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); insert into t1 values ('hello',default); select * from t1; @@ -1143,7 +1143,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (octet_length(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -1158,7 +1158,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (ord(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2',default); select * from t1; a b @@ -1173,7 +1173,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (locate('bar',`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar',default); select * from t1; a b @@ -1188,7 +1188,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (quote(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Don\'t',default); select * from t1; a b @@ -1203,7 +1203,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` regexp 'H.+o') VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); insert into t1 values ('hello',default); select * from t1; @@ -1220,7 +1220,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(30) GENERATED ALWAYS AS (repeat(`a`,3)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -1235,7 +1235,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(30) GENERATED ALWAYS AS (replace(`a`,'aa','bb')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('maa',default); select * from t1; a b @@ -1250,7 +1250,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(30) GENERATED ALWAYS AS (reverse(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('maa',default); select * from t1; a b @@ -1265,7 +1265,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (right(`a`,4)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar',default); select * from t1; a b @@ -1280,7 +1280,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` regexp 'H.+o') VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); select * from t1; @@ -1297,7 +1297,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (rpad(`a`,4,'??')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('He',default); select * from t1; a b @@ -1312,7 +1312,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (rtrim(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello ',default); select * from t1; a b @@ -1327,7 +1327,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(20) GENERATED ALWAYS AS (soundex(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); select * from t1; a b @@ -1343,7 +1343,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (soundex(`a`) = soundex(`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello','Hello',default); insert into t1 values ('Hello','MySQL',default); insert into t1 values ('Hello','hello',default); @@ -1362,7 +1362,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (concat(`a`,space(5))) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello', default); select * from t1; a b @@ -1378,7 +1378,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(9) DEFAULT NULL, `b` varchar(9) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (strcmp(`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello','Hello', default); insert into t1 values ('Hello','Hello1', default); select * from t1; @@ -1395,7 +1395,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,2)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); select * from t1; a b @@ -1410,7 +1410,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (substring_index(`a`,'.',2)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('www.mysql.com',default); select * from t1; a b @@ -1425,7 +1425,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,2,2)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); select * from t1; a b @@ -1440,7 +1440,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (trim(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (' aa ',default); select * from t1; a b @@ -1455,7 +1455,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (ucase(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -1470,7 +1470,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (unhex(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('4D7953514C',default); select * from t1; a b @@ -1485,7 +1485,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (ucase(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -1500,7 +1500,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (weight_string(`a`,0,4,65)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -1518,7 +1518,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(16) GENERATED ALWAYS AS (case `a` when NULL then 'asd' when 'b' then 'B' else `a` end) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (NULL,default); insert into t1 values ('b',default); insert into t1 values ('c',default); @@ -1538,7 +1538,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (if(`a` = 1,`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,2,default); insert into t1 values (3,4,default); select * from t1; @@ -1556,7 +1556,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` varchar(10) GENERATED ALWAYS AS (ifnull(`a`,'DEFAULT')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (NULL,'adf',default); insert into t1 values ('a','adf',default); select * from t1; @@ -1573,7 +1573,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (nullif(`a`,'DEFAULT')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('DEFAULT',default); insert into t1 values ('a',default); select * from t1; @@ -1593,7 +1593,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` > 0 and `a` < 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-1,default); insert into t1 values (1,default); select * from t1; @@ -1610,7 +1610,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` between 0 and 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-1,default); insert into t1 values (1,default); select * from t1; @@ -1627,7 +1627,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varbinary(10) GENERATED ALWAYS AS (cast(`a` as char charset binary)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('11',default); insert into t1 values (1,default); select * from t1; @@ -1644,7 +1644,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` & 5) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (0,default); select * from t1; @@ -1661,7 +1661,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (~`a`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); Warnings: Warning 1264 Out of range value for column 'b' at row 1 @@ -1678,7 +1678,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` | 5) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (0,default); insert into t1 values (2,default); @@ -1697,7 +1697,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` ^ 5) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (0,default); insert into t1 values (2,default); @@ -1716,7 +1716,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` DIV 5) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (7,default); select * from t1; @@ -1734,7 +1734,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` <=> `b`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,1,default); insert into t1 values (NULL,NULL,default); insert into t1 values (1,NULL,default); @@ -1754,7 +1754,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` = `b`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); select * from t1; @@ -1772,7 +1772,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` >= `b`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); select * from t1; @@ -1790,7 +1790,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` > `b`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); select * from t1; @@ -1807,7 +1807,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` is not null) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (NULL,default); select * from t1; @@ -1824,7 +1824,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` is null) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (NULL,default); select * from t1; @@ -1841,7 +1841,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` << 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (3,default); select * from t1; @@ -1859,7 +1859,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` <= `b`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); insert into t1 values ('b','c',default); @@ -1879,7 +1879,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` < `b`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); insert into t1 values ('b','c',default); @@ -1898,7 +1898,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` not between 0 and 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-1,default); insert into t1 values (1,default); select * from t1; @@ -1916,7 +1916,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` <> `b`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); insert into t1 values ('b','c',default); @@ -1936,7 +1936,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` <> `b`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); insert into t1 values ('b','c',default); @@ -1955,7 +1955,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` > 5 or `a` < 3) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (4,default); select * from t1; @@ -1972,7 +1972,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` >> 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (8,default); insert into t1 values (3,default); select * from t1; @@ -1989,7 +1989,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` xor 5) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (0,default); insert into t1 values (1,default); insert into t1 values (2,default); @@ -2011,7 +2011,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (`a` + interval 1 month) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2026,7 +2026,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (addtime(`a`,'02:00:00')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2041,7 +2041,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (convert_tz(`a`,'MET','UTC')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2056,7 +2056,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (`a` + interval 1 month) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2071,7 +2071,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` varchar(64) GENERATED ALWAYS AS (date_format(`a`,'%W %M %D')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2086,7 +2086,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (`a` - interval 1 month) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2101,7 +2101,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (cast(`a` as date)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31 02:00:00',default); select * from t1; a b @@ -2116,7 +2116,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (to_days(`a`) - to_days('2000-01-01')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2131,7 +2131,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (dayofmonth(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2146,7 +2146,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (dayname(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2161,7 +2161,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (dayofmonth(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2176,7 +2176,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (dayofweek(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2191,7 +2191,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (dayofyear(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2206,7 +2206,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (extract(year from `a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2221,7 +2221,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (from_days(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (730669,default); select * from t1; a b @@ -2236,7 +2236,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (from_unixtime(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1196440219,default); select * from t1; a b @@ -2251,7 +2251,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` varchar(32) GENERATED ALWAYS AS (date_format(`a`,get_format(DATE, 'EUR'))) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2266,7 +2266,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (hour(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('10:05:03',default); select * from t1; a b @@ -2281,7 +2281,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (last_day(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2003-02-05',default); insert into t1 values ('2003-02-32',default); select * from t1; @@ -2297,7 +2297,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (makedate(`a`,1)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2001,default); select * from t1; a b @@ -2312,7 +2312,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` time GENERATED ALWAYS AS (maketime(`a`,1,3)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (12,default); select * from t1; a b @@ -2327,7 +2327,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (microsecond(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2009-12-31 12:00:00.123456',default); insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; @@ -2344,7 +2344,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (minute(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; a b @@ -2359,7 +2359,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (month(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; a b @@ -2374,7 +2374,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` varchar(16) GENERATED ALWAYS AS (monthname(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; a b @@ -2389,7 +2389,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (period_add(`a`,2)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (200801,default); select * from t1; a b @@ -2405,7 +2405,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (period_diff(`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (200802,200703,default); select * from t1; a b c @@ -2420,7 +2420,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (quarter(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2435,7 +2435,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, `b` time GENERATED ALWAYS AS (sec_to_time(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2378,default); select * from t1; a b @@ -2450,7 +2450,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (second(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('10:05:03',default); select * from t1; a b @@ -2465,7 +2465,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(64) DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (str_to_date(`a`,'%m/%d/%Y')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('04/30/2004',default); select * from t1; a b @@ -2480,7 +2480,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (`a` - interval 1 month) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2495,7 +2495,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (subtime(`a`,'02:00:00')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2510,7 +2510,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` varchar(32) GENERATED ALWAYS AS (time_format(`a`,'%r')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31 02:03:04',default); select * from t1; a b @@ -2525,7 +2525,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (time_to_sec(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('22:23:00',default); select * from t1; a b @@ -2540,7 +2540,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` time GENERATED ALWAYS AS (cast(`a` as time)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31 02:03:04',default); select * from t1; a b @@ -2556,7 +2556,7 @@ t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime DEFAULT NULL, `c` time GENERATED ALWAYS AS (timediff(`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-12-31 23:59:59.000001','2008-12-30 01:01:01.000002',default); select * from t1; a b c @@ -2571,7 +2571,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` timestamp GENERATED ALWAYS AS (cast(`a` as datetime)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-12-31',default); select * from t1; a b @@ -2586,7 +2586,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` timestamp GENERATED ALWAYS AS (`a` + interval 1 minute) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2003-01-02',default); select * from t1; a b @@ -2601,7 +2601,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c` bigint(20) GENERATED ALWAYS AS (timestampdiff(MONTH,`a`,`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2003-02-01',default); select * from t1; a c @@ -2616,7 +2616,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (to_days(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2007-10-07',default); select * from t1; a b @@ -2631,7 +2631,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (week(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-09-01',default); select * from t1; a b @@ -2646,7 +2646,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (weekday(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-09-01',default); select * from t1; a b @@ -2661,7 +2661,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (week(`a`,3)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-09-01',default); select * from t1; a b @@ -2676,7 +2676,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (year(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-09-01',default); select * from t1; a b @@ -2691,7 +2691,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (yearweek(`a`,0)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-09-01',default); select * from t1; a b @@ -2713,7 +2713,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` bigint(20) unsigned GENERATED ALWAYS AS (cast(`a` as unsigned)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (-1,default); Warnings: @@ -2734,7 +2734,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` bigint(20) unsigned GENERATED ALWAYS AS (cast(`a` as unsigned)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (-1,default); Warnings: @@ -2758,7 +2758,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (extractvalue(`a`,'/b')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -2777,7 +2777,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (aes_encrypt(aes_decrypt(`a`,'adf'),'adf')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -2792,7 +2792,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (bit_count(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (5,default); select * from t1; a b @@ -2807,7 +2807,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (charset(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -2822,7 +2822,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (coercibility(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -2837,7 +2837,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (collation(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -2852,7 +2852,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (uncompress(compress(`a`))) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -2867,7 +2867,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (decode(encode(`a`,'abc'),'abc')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -2882,27 +2882,13 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT 'aaa', `b` varchar(1024) GENERATED ALWAYS AS (ifnull(`a`,default(`a`))) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('any value',default); select * from t1; a b any value any value drop table t1; set sql_warnings = 0; -# DES_ENCRYPT(), DES_DECRYPT() -create table t1 (a varchar(1024), b varchar(1024) generated always as (des_encrypt(des_decrypt(a,'adf'),'adf')) virtual); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) GENERATED ALWAYS AS (des_encrypt(des_decrypt(`a`,'adf'),'adf')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -insert into t1 values ('MySQL',default); -select * from t1; -a b -MySQL �w2�� -��� -drop table t1; # INET_ATON(), INET_NTOA() set sql_warnings = 1; create table t1 (a varchar(1024), b varchar(1024) generated always as (inet_ntoa(inet_aton(a))) virtual); @@ -2911,7 +2897,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (inet_ntoa(inet_aton(`a`))) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('127.0.0.1',default); select * from t1; a b @@ -2926,7 +2912,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varbinary(32) GENERATED ALWAYS AS (md5(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('testing',default); select * from t1; a b @@ -2941,7 +2927,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (password(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('badpwd',default); select * from t1; a b @@ -2956,7 +2942,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (sha(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -2971,7 +2957,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (sha(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -2986,7 +2972,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (sha2(`a`,224)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -3001,7 +2987,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(1) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (uncompressed_length(compress(repeat(`a`,30)))) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a',default); select * from t1; a b diff --git a/mysql-test/suite/gcol/r/innodb_virtual_basic.result b/mysql-test/suite/gcol/r/innodb_virtual_basic.result index 4e8adbd88e61b..5b599dc3520a9 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_basic.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_basic.result @@ -391,7 +391,7 @@ t CREATE TABLE `t` ( `e` int(11) GENERATED ALWAYS AS (10) VIRTUAL, `h` int(11) NOT NULL, PRIMARY KEY (`h`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT INSERT INTO t VALUES (REPEAT('g', 10000), REPEAT('x', 2800), DEFAULT, DEFAULT, DEFAULT, 1); INSERT INTO t VALUES (REPEAT('a', 9000), REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 2); INSERT INTO t VALUES (REPEAT('m', 8000), REPEAT('n', 3000), DEFAULT, DEFAULT, DEFAULT, 3); @@ -552,7 +552,7 @@ t1 CREATE TABLE `t1` ( `col9` text DEFAULT NULL, `col6` int(11) DEFAULT NULL, UNIQUE KEY `uidx` (`col5`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t (a INT, b INT GENERATED ALWAYS AS (a), c point, d point GENERATED ALWAYS AS (c), spatial index idx (d)); ERROR 42000: All parts of a SPATIAL index must be NOT NULL @@ -762,7 +762,7 @@ t CREATE TABLE `t` ( `e` int(11) GENERATED ALWAYS AS (10) VIRTUAL, `h` int(11) NOT NULL, PRIMARY KEY (`h`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC INSERT INTO t VALUES (REPEAT('g', 10000), REPEAT('x', 2800), DEFAULT, DEFAULT, DEFAULT, 1); INSERT INTO t VALUES (REPEAT('a', 9000), REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 2); INSERT INTO t VALUES (REPEAT('m', 8000), REPEAT('n', 3000), DEFAULT, DEFAULT, DEFAULT, 3); @@ -811,7 +811,7 @@ t CREATE TABLE `t` ( `e` int(11) GENERATED ALWAYS AS (10) VIRTUAL, `h` int(11) NOT NULL, PRIMARY KEY (`h`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT INSERT INTO t VALUES (REPEAT('g', 10000), REPEAT('x', 2800), DEFAULT, DEFAULT, DEFAULT, 1); INSERT INTO t VALUES (REPEAT('a', 9000), REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 2); INSERT INTO t VALUES (REPEAT('m', 8000), REPEAT('n', 3000), DEFAULT, DEFAULT, DEFAULT, 3); @@ -860,7 +860,7 @@ t CREATE TABLE `t` ( `e` int(11) GENERATED ALWAYS AS (10) VIRTUAL, `h` int(11) NOT NULL, PRIMARY KEY (`h`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED INSERT INTO t VALUES (REPEAT('g', 10000), REPEAT('x', 2800), DEFAULT, DEFAULT, DEFAULT, 1); INSERT INTO t VALUES (REPEAT('a', 9000), REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 2); INSERT INTO t VALUES (REPEAT('m', 8000), REPEAT('n', 3000), DEFAULT, DEFAULT, DEFAULT, 3); @@ -982,7 +982,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL, `h` varchar(10) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE parent (id INT PRIMARY KEY) ENGINE=INNODB; CREATE TABLE child ( @@ -1290,7 +1290,7 @@ t CREATE TABLE `t` ( `h` varchar(10) DEFAULT NULL, KEY `idx` (`d`), KEY `idx2` (`e`,`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t DROP COLUMN d, ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE; ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY ALTER TABLE t DROP COLUMN d, ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (e), ALGORITHM=INPLACE, LOCK=NONE; @@ -1306,7 +1306,7 @@ t CREATE TABLE `t` ( `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL, KEY `idx2` (`e`), KEY `idx` (`e`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t ADD INDEX idx4(c, e), ADD COLUMN x VARCHAR(10) GENERATED ALWAYS AS(h), DROP INDEX idx, ALGORITHM=INPLACE, LOCK=NONE; SHOW CREATE TABLE t; Table Create Table @@ -1319,7 +1319,7 @@ t CREATE TABLE `t` ( `x` varchar(10) GENERATED ALWAYS AS (`h`) VIRTUAL, KEY `idx2` (`e`), KEY `idx4` (`c`,`e`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t ADD COLUMN i INT GENERATED ALWAYS AS(a+a+b), ADD COLUMN j INT, ALGORITHM=INPLACE; ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY ALTER TABLE t ADD INDEX (x), ADD COLUMN j INT, ALGORITHM=INPLACE, LOCK=NONE; @@ -1338,7 +1338,7 @@ t CREATE TABLE `t` ( KEY `idx2` (`e`), KEY `idx4` (`c`,`e`), KEY `x` (`x`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t ADD COLUMN i INT GENERATED ALWAYS AS(a+a+b), ADD INDEX (i), ALGORITHM=INPLACE, LOCK=NONE; ERROR 0A000: LOCK=NONE is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try LOCK=SHARED ALTER TABLE t ADD COLUMN i INT GENERATED ALWAYS AS(a+a+b), ADD INDEX (i), ALGORITHM=INPLACE, LOCK=SHARED; @@ -1357,7 +1357,7 @@ t CREATE TABLE `t` ( KEY `idx4` (`c`,`e`), KEY `x` (`x`), KEY `i` (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT i FROM t; i NULL diff --git a/mysql-test/suite/gcol/r/innodb_virtual_debug.result b/mysql-test/suite/gcol/r/innodb_virtual_debug.result index 806cf1a98c86d..3f3e3ea31d187 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_debug.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_debug.result @@ -46,7 +46,7 @@ t CREATE TABLE `t` ( `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL, `h` varchar(10) DEFAULT NULL, KEY `idx` (`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t; a b c h 0 3 3 mm @@ -85,7 +85,7 @@ t CREATE TABLE `t` ( `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL, `h` varchar(10) DEFAULT NULL, KEY `idx_1` (`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT c FROM t; c NULL @@ -105,7 +105,7 @@ SET lock_wait_timeout = 1; ALTER TABLE t1 ADD UNIQUE INDEX(c, b); connection default; SET DEBUG_SYNC = 'now WAIT_FOR s1'; -SET DEBUG_SYNC = 'row_ins_sec_index_enter SIGNAL s2 WAIT_FOR s3'; +SET DEBUG_SYNC = 'row_log_insert_handle SIGNAL s2 WAIT_FOR s3'; INSERT INTO t1(a, b) VALUES(2, 2); connection con1; ERROR HY000: Lock wait timeout exceeded; try restarting transaction @@ -124,3 +124,24 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; +# +# MDEV-28806 Assertion `flag == 1' failure in +# row_build_index_entry_low upon concurrent ALTER and UPDATE +# +CREATE TABLE t1(a CHAR(8), b INT, c INT AS (b), KEY(a)) ENGINE=InnoDB; +INSERT INTO t1(b) VALUES (1),(2); +connect con1,localhost,root,,test; +SET DEBUG_SYNC="alter_table_inplace_before_lock_upgrade SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 ADD KEY ind (c); +connection default; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +UPDATE t1 SET a ='foo'; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection con1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +disconnect con1; +connection default; +SET DEBUG_SYNC=RESET; diff --git a/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result b/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result index 93bba0039f9ed..3f3b2db8f3240 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result @@ -89,7 +89,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL, KEY `idx` (`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; a b c 2 2 4 @@ -129,7 +129,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (`a` + `b`) VIRTUAL, KEY `idx` (`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; a b c 2 2 4 @@ -150,10 +150,7 @@ lock table t write; connection prevent_purge; commit; connection default; -InnoDB 0 transactions not purged disconnect lock_table; -start transaction with consistent snapshot; -commit; InnoDB 0 transactions not purged set global debug_dbug=@old_dbug; drop table t; diff --git a/mysql-test/suite/gcol/r/innodb_virtual_fk.result b/mysql-test/suite/gcol/r/innodb_virtual_fk.result index de61c16f739a7..faba10161fb96 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_fk.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_fk.result @@ -705,7 +705,7 @@ ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col); ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") SET foreign_key_checks=0; ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col); -ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk' in the foreign table 't1' +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk' in the foreign table 't1' ALTER TABLE t1 ADD INDEX(v4); ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col); SET foreign_key_checks=1; @@ -722,7 +722,7 @@ t1 CREATE TABLE `t1` ( `v4` char(10) GENERATED ALWAYS AS (`c4`) VIRTUAL, KEY `v4` (`v4`), CONSTRAINT `fk` FOREIGN KEY (`v4`) REFERENCES `nosuch` (`col`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 DROP FOREIGN KEY fk; ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col); ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") @@ -738,7 +738,7 @@ t1 CREATE TABLE `t1` ( `v3` time GENERATED ALWAYS AS (`c3`) VIRTUAL, `v4` char(10) GENERATED ALWAYS AS (`c4`) VIRTUAL, KEY `v4` (`v4`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-20396 Server crashes after DELETE with SEL NULL Foreign key and a @@ -786,7 +786,7 @@ t1 CREATE TABLE `t1` ( KEY `f1` (`f1`), KEY `f2` (`f2`), CONSTRAINT `r` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 DROP INDEX f1; ALTER TABLE t1 DROP f3; DROP TABLE t1; @@ -1000,7 +1000,7 @@ email_stats CREATE TABLE `email_stats` ( KEY `idx_es1` (`email_id`), KEY `mautic_generated_sent_date_email` (`generated_sent_email`,`email_id`), CONSTRAINT `fk_ea1` FOREIGN KEY (`email_id`) REFERENCES `emails` (`breaker`) ON DELETE SET NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO emails VALUES (1,1); INSERT INTO email_stats(id, email_id, date_sent) VALUES (1, 1, '2020-10-22 13:32:41'); diff --git a/mysql-test/suite/gcol/r/innodb_virtual_index.result b/mysql-test/suite/gcol/r/innodb_virtual_index.result index 34a0b0c66e8ec..52203c0610c03 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_index.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_index.result @@ -1,3 +1,4 @@ +SET default_storage_engine= innodb; SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; # @@ -205,7 +206,7 @@ t1 CREATE TABLE `t1` ( `col1` int(10) DEFAULT NULL, `col2` char(21) GENERATED ALWAYS AS (`col1` * `col1`) VIRTUAL, KEY `n` (`col2`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci DROP TABLE t1; # # Bug #27968952 INNODB CRASH/CORRUPTION WITH TEXT PREFIX INDEXES @@ -248,12 +249,15 @@ ENGINE=InnoDB; INSERT IGNORE INTO t1 (a,b) VALUES(1,20190132); Warnings: Warning 1265 Data truncated for column 'vb' at row 1 +SELECT * FROM t1; +a b vb +1 20190132 0000-00-00 BEGIN; DELETE FROM t1; INSERT INTO t1 (a,b) VALUES(1,20190123); -ERROR 22007: Incorrect date value: '20190132' for column `test`.`t1`.`vb` at row 1 SELECT * FROM t1; a b vb +1 20190123 2019-01-23 ROLLBACK; SELECT * FROM t1; a b vb @@ -310,3 +314,62 @@ ALTER TABLE t1 ADD KEY (b), ALGORITHM=INPLACE; # Cleanup DROP TABLE t1; # End of 10.2 tests +# +# MDEV-29299 SELECT from table with vcol index reports warning +# +CREATE TABLE t(fld1 INT NOT NULL, +fld2 INT AS (100/fld1) VIRTUAL, +KEY(fld1), KEY(fld2)); +CREATE TABLE t_odd(id int); +INSERT INTO t(fld1) VALUES(1), (2); +connect stop_purge,localhost,root; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +INSERT INTO t_odd VALUES(10000); +connection default; +UPDATE IGNORE t SET fld1= 3 WHERE fld1= 2; +UPDATE IGNORE t SET fld1= 4 WHERE fld1= 3; +UPDATE IGNORE t SET fld1= 0 WHERE fld1= 4; +Warnings: +Warning 1365 Division by 0 +SELECT fld2 FROM t FORCE INDEX(fld2); +fld2 +NULL +100 +SELECT fld2 FROM t FORCE INDEX(fld1); +fld2 +100 +NULL +Warnings: +Warning 1365 Division by 0 +disconnect stop_purge; +DROP TABLE t, t_odd; +# +# MDEV-29753 An error is wrongly reported during INSERT with vcol index +# See also Bug #22990029 +# +CREATE TABLE t(pk INT PRIMARY KEY, +fld1 INT NOT NULL, +fld2 INT AS (100/fld1) VIRTUAL, +KEY(fld1), KEY(fld2)); +INSERT IGNORE t(pk, fld1) VALUES(1, 0); +Warnings: +Warning 1365 Division by 0 +SELECT * FROM t; +pk fld1 fld2 +1 0 NULL +Warnings: +Warning 1365 Division by 0 +BEGIN; +DELETE FROM t; +Warnings: +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +INSERT INTO t (pk, fld1) VALUES(1,1); +SELECT * FROM t; +pk fld1 fld2 +1 1 100 +# Cleanup +ROLLBACK; +DROP TABLE t; +# End of 10.3 tests diff --git a/mysql-test/suite/gcol/r/innodb_virtual_purge.result b/mysql-test/suite/gcol/r/innodb_virtual_purge.result index ee88527ec2e04..48a2d31338267 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_purge.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_purge.result @@ -24,7 +24,7 @@ COMMIT; UPDATE t1 SET a=1; connection default; InnoDB 0 transactions not purged -CHECK TABLE t1; +CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK SELECT b1 FROM t1; @@ -123,7 +123,7 @@ COMMIT; disconnect con1; connection default; InnoDB 0 transactions not purged -CHECK TABLE t1; +CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK SELECT b1 FROM t1; @@ -134,7 +134,7 @@ SELECT * FROM t1; a b b1 a1 a4 b3 100 10 10 100 90 100 100 10 10 100 90 100 -CHECK TABLE t2; +CHECK TABLE t2 EXTENDED; Table Op Msg_type Msg_text test.t2 check status OK DROP TABLE t2, t1, t0; diff --git a/mysql-test/suite/gcol/r/rpl_gcol.result b/mysql-test/suite/gcol/r/rpl_gcol.result index a7950b75bd08f..bcf072ab04b3e 100644 --- a/mysql-test/suite/gcol/r/rpl_gcol.result +++ b/mysql-test/suite/gcol/r/rpl_gcol.result @@ -8,7 +8,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (2,default); select * from t1; diff --git a/mysql-test/suite/gcol/r/virtual_index_drop.result b/mysql-test/suite/gcol/r/virtual_index_drop.result index 45ee4843b7c12..484b177a88633 100644 --- a/mysql-test/suite/gcol/r/virtual_index_drop.result +++ b/mysql-test/suite/gcol/r/virtual_index_drop.result @@ -11,7 +11,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL, `f2` int(11) GENERATED ALWAYS AS (`f1` + 2) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT, f2 INT AS (f1 + 2) VIRTUAL)ENGINE=InnoDB; INSERT INTO t1(f1) VALUES(1), (1); @@ -22,7 +22,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL, `f2` int(11) GENERATED ALWAYS AS (`f1` + 2) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT, f2 INT AS (f1) VIRTUAL)ENGINE=InnoDB; INSERT INTO t1(f1) VALUES(1); @@ -46,7 +46,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL, `f2` int(11) GENERATED ALWAYS AS (`f1`) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT, f2 INT AS (f1) VIRTUAL)ENGINE=InnoDB; INSERT INTO t1(f1) VALUES(1); diff --git a/mysql-test/suite/gcol/t/gcol_purge.test b/mysql-test/suite/gcol/t/gcol_purge.test index 3696b41b3d8c1..ecfd89f4469f2 100644 --- a/mysql-test/suite/gcol/t/gcol_purge.test +++ b/mysql-test/suite/gcol/t/gcol_purge.test @@ -1,9 +1,14 @@ --source include/have_innodb.inc --source include/have_debug.inc + +SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET @save_dbug=@@GLOBAL.debug_dbug; +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; CREATE TABLE t1(f1 INT NOT NULL, f2 int not null, f3 int generated always as (f2 * 2) VIRTUAL, primary key(f1), INDEX (f3))ENGINE=InnoDB; connect(con1,localhost,root,,,); +--source ../innodb/include/wait_all_purged.inc START TRANSACTION WITH CONSISTENT SNAPSHOT; connection default; @@ -26,5 +31,6 @@ commit; disconnect con1; disconnect con2; connection default; -set global debug_dbug=default; +SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; +SET GLOBAL debug_dbug=@save_dbug; DROP TABLE t1; diff --git a/mysql-test/suite/gcol/t/gcol_rollback.test b/mysql-test/suite/gcol/t/gcol_rollback.test index ba88dda45d7f2..888e6be861e5f 100644 --- a/mysql-test/suite/gcol/t/gcol_rollback.test +++ b/mysql-test/suite/gcol/t/gcol_rollback.test @@ -103,7 +103,6 @@ SET DEBUG_SYNC = 'now SIGNAL dml_done'; connection con1; reap; -disconnect con1; connection default; SELECT * FROM t; @@ -111,5 +110,27 @@ SELECT * FROM t; DROP TABLE t; SET DEBUG_SYNC = 'RESET'; +--echo # +--echo # MDEV-30597 Assertion `flag == 1' failed in +--echo # row_build_index_entry_low +--echo # +CREATE TABLE t1 ( +col1 INT PRIMARY KEY, col_text TEXT, +col_text_g TEXT GENERATED ALWAYS AS (SUBSTR(col_text,1,499)) +) ENGINE = InnoDB ROW_FORMAT = Compact; +connection con1; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +INSERT INTO t1 (col1) VALUES (1) ; +DELETE FROM t1 WHERE col1 = 1; +ALTER TABLE t1 ADD UNIQUE INDEX (col_text_g(9)); +BEGIN; +INSERT INTO t1 (col1) VALUES (1); +ROLLBACK; +disconnect con1; +DROP TABLE t1; + # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc + +--echo # End of 10.4 tests diff --git a/mysql-test/suite/gcol/t/innodb_virtual_debug.test b/mysql-test/suite/gcol/t/innodb_virtual_debug.test index 40446b991cd8b..cd2b860400ce4 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_debug.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_debug.test @@ -295,7 +295,7 @@ SET lock_wait_timeout = 1; connection default; SET DEBUG_SYNC = 'now WAIT_FOR s1'; -SET DEBUG_SYNC = 'row_ins_sec_index_enter SIGNAL s2 WAIT_FOR s3'; +SET DEBUG_SYNC = 'row_log_insert_handle SIGNAL s2 WAIT_FOR s3'; --send INSERT INTO t1(a, b) VALUES(2, 2) connection con1; @@ -312,4 +312,30 @@ SELECT * FROM t1; CHECK TABLE t1; DROP TABLE t1; +--echo # +--echo # MDEV-28806 Assertion `flag == 1' failure in +--echo # row_build_index_entry_low upon concurrent ALTER and UPDATE +--echo # + +CREATE TABLE t1(a CHAR(8), b INT, c INT AS (b), KEY(a)) ENGINE=InnoDB; +INSERT INTO t1(b) VALUES (1),(2); + +--connect (con1,localhost,root,,test) +SET DEBUG_SYNC="alter_table_inplace_before_lock_upgrade SIGNAL dml_start WAIT_FOR dml_commit"; +send ALTER TABLE t1 ADD KEY ind (c); + +--connection default +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +UPDATE t1 SET a ='foo'; +SET DEBUG_SYNC="now SIGNAL dml_commit"; + +# Cleanup +--connection con1 +--reap +CHECK TABLE t1; +DROP TABLE t1; +--disconnect con1 +connection default; +SET DEBUG_SYNC=RESET; + --source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test index 2f1f8b29abac2..d9b764a75a74a 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test @@ -191,10 +191,7 @@ lock table t write; connection prevent_purge; commit; connection default; ---source ../../innodb/include/wait_all_purged.inc disconnect lock_table; -start transaction with consistent snapshot; -commit; --source ../../innodb/include/wait_all_purged.inc set global debug_dbug=@old_dbug; drop table t; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_index.test b/mysql-test/suite/gcol/t/innodb_virtual_index.test index 4a41623264e69..d0e1951842ef9 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_index.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_index.test @@ -1,6 +1,8 @@ --source include/have_innodb.inc --source include/have_sequence.inc +SET default_storage_engine= innodb; + # Ensure that the history list length will actually be decremented by purge. SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; @@ -280,9 +282,9 @@ DROP TABLE t1; CREATE TABLE t1(a INT PRIMARY KEY, b INT, vb DATE AS(b) VIRTUAL, KEY(vb)) ENGINE=InnoDB; INSERT IGNORE INTO t1 (a,b) VALUES(1,20190132); +SELECT * FROM t1; BEGIN; DELETE FROM t1; ---error ER_TRUNCATED_WRONG_VALUE INSERT INTO t1 (a,b) VALUES(1,20190123); SELECT * FROM t1; ROLLBACK; @@ -341,3 +343,49 @@ DROP TABLE t1; --echo # End of 10.2 tests +--echo # +--echo # MDEV-29299 SELECT from table with vcol index reports warning +--echo # + +CREATE TABLE t(fld1 INT NOT NULL, + fld2 INT AS (100/fld1) VIRTUAL, + KEY(fld1), KEY(fld2)); +CREATE TABLE t_odd(id int); +INSERT INTO t(fld1) VALUES(1), (2); + +--connect stop_purge,localhost,root +# This prevents purge for records in t +START TRANSACTION WITH CONSISTENT SNAPSHOT; +INSERT INTO t_odd VALUES(10000); + +--connection default +UPDATE IGNORE t SET fld1= 3 WHERE fld1= 2; +UPDATE IGNORE t SET fld1= 4 WHERE fld1= 3; +UPDATE IGNORE t SET fld1= 0 WHERE fld1= 4; +SELECT fld2 FROM t FORCE INDEX(fld2); +SELECT fld2 FROM t FORCE INDEX(fld1); + +--disconnect stop_purge +DROP TABLE t, t_odd; + +--echo # +--echo # MDEV-29753 An error is wrongly reported during INSERT with vcol index +--echo # See also Bug #22990029 +--echo # + +CREATE TABLE t(pk INT PRIMARY KEY, + fld1 INT NOT NULL, + fld2 INT AS (100/fld1) VIRTUAL, + KEY(fld1), KEY(fld2)); +INSERT IGNORE t(pk, fld1) VALUES(1, 0); +SELECT * FROM t; +BEGIN; +DELETE FROM t; +INSERT INTO t (pk, fld1) VALUES(1,1); +SELECT * FROM t; + +--echo # Cleanup +ROLLBACK; +DROP TABLE t; + +--echo # End of 10.3 tests diff --git a/mysql-test/suite/gcol/t/innodb_virtual_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_purge.test index c79a817dd4eda..e9e4caf8e07fc 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_purge.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_purge.test @@ -38,7 +38,7 @@ UPDATE t1 SET a=1; connection default; --source ../../innodb/include/wait_all_purged.inc -CHECK TABLE t1; +CHECK TABLE t1 EXTENDED; SELECT b1 FROM t1; @@ -123,11 +123,11 @@ disconnect con1; connection default; --source ../../innodb/include/wait_all_purged.inc -CHECK TABLE t1; +CHECK TABLE t1 EXTENDED; SELECT b1 FROM t1; SELECT * FROM t1; -CHECK TABLE t2; +CHECK TABLE t2 EXTENDED; DROP TABLE t2, t1, t0; CREATE TABLE t1 (a VARCHAR(30), b INT, a2 VARCHAR(30) GENERATED ALWAYS AS (a) VIRTUAL); diff --git a/mysql-test/suite/gcol/t/virtual_index_drop.test b/mysql-test/suite/gcol/t/virtual_index_drop.test index e1ec43f75e5ee..0fe4986f2c198 100644 --- a/mysql-test/suite/gcol/t/virtual_index_drop.test +++ b/mysql-test/suite/gcol/t/virtual_index_drop.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_debug.inc +--source include/have_debug_sync.inc --echo # --echo # MDEV-24971 InnoDB access freed virtual column diff --git a/mysql-test/suite/handler/aria.result b/mysql-test/suite/handler/aria.result index e34164957a31d..b0a4a1732897d 100644 --- a/mysql-test/suite/handler/aria.result +++ b/mysql-test/suite/handler/aria.result @@ -1690,3 +1690,19 @@ a b HANDLER t1 CLOSE; DROP TABLE t1; End of 5.1 tests +# +# 10.2 Test +# +# MDEV-20207: Assertion `! is_set()' failed in +# Diagnostics_area::set_eof_status upon HANDLER READ +# +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (a POINT, KEY(a)); +HANDLER t1 OPEN h; +HANDLER h READ a = (0); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +HANDLER h CLOSE; +DROP TABLE t1; +# End of 10.2 Test diff --git a/mysql-test/suite/handler/aria.test b/mysql-test/suite/handler/aria.test index 1913d2b791cbb..912a9e8972159 100644 --- a/mysql-test/suite/handler/aria.test +++ b/mysql-test/suite/handler/aria.test @@ -80,3 +80,23 @@ HANDLER t1 CLOSE; DROP TABLE t1; --echo End of 5.1 tests + +--echo # +--echo # 10.2 Test +--echo # +--echo # MDEV-20207: Assertion `! is_set()' failed in +--echo # Diagnostics_area::set_eof_status upon HANDLER READ +--echo # + +DROP TABLE IF EXISTS t1; + +CREATE TABLE t1 (a POINT, KEY(a)); +HANDLER t1 OPEN h; + +--error ER_CANT_CREATE_GEOMETRY_OBJECT +HANDLER h READ a = (0); + +HANDLER h CLOSE; +DROP TABLE t1; + +--echo # End of 10.2 Test diff --git a/mysql-test/suite/handler/innodb.result b/mysql-test/suite/handler/innodb.result index dac6b2e997beb..5d44642db0137 100644 --- a/mysql-test/suite/handler/innodb.result +++ b/mysql-test/suite/handler/innodb.result @@ -1772,3 +1772,19 @@ HANDLER t1 READ `PRIMARY` PREV; f1 f2 3 3 DROP TABLE t1; +# +# 10.2 Test +# +# MDEV-20207: Assertion `! is_set()' failed in +# Diagnostics_area::set_eof_status upon HANDLER READ +# +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (a POINT, KEY(a)); +HANDLER t1 OPEN h; +HANDLER h READ a = (0); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +HANDLER h CLOSE; +DROP TABLE t1; +# End of 10.2 Test diff --git a/mysql-test/suite/handler/innodb.test b/mysql-test/suite/handler/innodb.test index 5c2dae8a14680..8c9844743f4cb 100644 --- a/mysql-test/suite/handler/innodb.test +++ b/mysql-test/suite/handler/innodb.test @@ -27,3 +27,23 @@ HANDLER t1 OPEN; HANDLER t1 READ FIRST WHERE f2 <= 1; HANDLER t1 READ `PRIMARY` PREV; DROP TABLE t1; + +--echo # +--echo # 10.2 Test +--echo # +--echo # MDEV-20207: Assertion `! is_set()' failed in +--echo # Diagnostics_area::set_eof_status upon HANDLER READ +--echo # + +DROP TABLE IF EXISTS t1; + +CREATE TABLE t1 (a POINT, KEY(a)); +HANDLER t1 OPEN h; + +--error ER_CANT_CREATE_GEOMETRY_OBJECT +HANDLER h READ a = (0); + +HANDLER h CLOSE; +DROP TABLE t1; + +--echo # End of 10.2 Test diff --git a/mysql-test/suite/handler/interface.result b/mysql-test/suite/handler/interface.result index 5dcb80d2b2fbb..3758400345b6f 100644 --- a/mysql-test/suite/handler/interface.result +++ b/mysql-test/suite/handler/interface.result @@ -315,6 +315,22 @@ handler v read next; ERROR 42S02: Unknown table 'v' in HANDLER drop view v; # +# 10.2 Test +# +# MDEV-20207: Assertion `! is_set()' failed in +# Diagnostics_area::set_eof_status upon HANDLER READ +# +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (a POINT, KEY(a)); +HANDLER t1 OPEN h; +HANDLER h READ a = (0); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +HANDLER h CLOSE; +DROP TABLE t1; +# End of 10.2 Test +# # MDEV-15813 ASAN use-after-poison in hp_hashnr upon # HANDLER READ on a versioned HEAP table # diff --git a/mysql-test/suite/handler/interface.test b/mysql-test/suite/handler/interface.test index 0ecdbf9c5cfe2..a4ed640dbc0c9 100644 --- a/mysql-test/suite/handler/interface.test +++ b/mysql-test/suite/handler/interface.test @@ -357,6 +357,26 @@ execute stmt; handler v read next; drop view v; +--echo # +--echo # 10.2 Test +--echo # +--echo # MDEV-20207: Assertion `! is_set()' failed in +--echo # Diagnostics_area::set_eof_status upon HANDLER READ +--echo # + +DROP TABLE IF EXISTS t1; + +CREATE TABLE t1 (a POINT, KEY(a)); +HANDLER t1 OPEN h; + +--error ER_CANT_CREATE_GEOMETRY_OBJECT +HANDLER h READ a = (0); + +HANDLER h CLOSE; +DROP TABLE t1; + +--echo # End of 10.2 Test + --echo # --echo # MDEV-15813 ASAN use-after-poison in hp_hashnr upon --echo # HANDLER READ on a versioned HEAP table diff --git a/mysql-test/suite/handler/myisam.result b/mysql-test/suite/handler/myisam.result index 896908e1602a1..cc817ccd8899d 100644 --- a/mysql-test/suite/handler/myisam.result +++ b/mysql-test/suite/handler/myisam.result @@ -1776,3 +1776,17 @@ test.t1 preload_keys status OK HANDLER t1 READ FIRST; ERROR 42S02: Unknown table 't1' in HANDLER End of 5.1 tests +# +# 10.2 Test +# +# MDEV-20207: Assertion `! is_set()' failed in +# Diagnostics_area::set_eof_status upon HANDLER READ +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a POINT, KEY(a)); +HANDLER t1 OPEN h; +HANDLER h READ a = (0); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +HANDLER h CLOSE; +DROP TABLE t1; +# End of 10.2 Test diff --git a/mysql-test/suite/handler/myisam.test b/mysql-test/suite/handler/myisam.test index a2d87630aef16..2fce8548322e9 100644 --- a/mysql-test/suite/handler/myisam.test +++ b/mysql-test/suite/handler/myisam.test @@ -169,3 +169,23 @@ HANDLER t1 READ FIRST; --echo End of 5.1 tests + +--echo # +--echo # 10.2 Test +--echo # +--echo # MDEV-20207: Assertion `! is_set()' failed in +--echo # Diagnostics_area::set_eof_status upon HANDLER READ +--echo # + +DROP TABLE IF EXISTS t1; + +CREATE TABLE t1 (a POINT, KEY(a)); +HANDLER t1 OPEN h; + +--error ER_CANT_CREATE_GEOMETRY_OBJECT +HANDLER h READ a = (0); + +HANDLER h CLOSE; +DROP TABLE t1; + +--echo # End of 10.2 Test diff --git a/mysql-test/suite/heap/heap.result b/mysql-test/suite/heap/heap.result index 15bb9ea0b50f1..bef3913dcb197 100644 --- a/mysql-test/suite/heap/heap.result +++ b/mysql-test/suite/heap/heap.result @@ -266,7 +266,7 @@ t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` varchar(50) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t2 like t1; show create table t2; Table Create Table @@ -274,7 +274,7 @@ t2 CREATE TABLE `t2` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` varchar(50) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t3 select * from t1; show create table t3; Table Create Table @@ -282,7 +282,7 @@ t3 CREATE TABLE `t3` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` varchar(50) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify c varchar(10); show create table t1; Table Create Table @@ -290,7 +290,7 @@ t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` varchar(50) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify v char(10); show create table t1; Table Create Table @@ -298,7 +298,7 @@ t1 CREATE TABLE `t1` ( `v` char(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` varchar(50) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR alter table t1 modify t varchar(10); Warnings: @@ -309,7 +309,7 @@ t1 CREATE TABLE `t1` ( `v` char(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` varchar(10) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+*+*+ * @@ -325,7 +325,7 @@ t1 CREATE TABLE `t1` ( KEY `v` (`v`), KEY `c` (`c`), KEY `t` (`t`(10)) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1; count(*) 270 @@ -560,7 +560,7 @@ t1 CREATE TABLE `t1` ( KEY `v` (`v`) USING BTREE, KEY `c` (`c`) USING BTREE, KEY `t` (`t`(10)) USING BTREE -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1; count(*) 267 @@ -648,7 +648,7 @@ t1 CREATE TABLE `t1` ( KEY `v` (`v`(5)), KEY `c` (`c`(5)), KEY `t` (`t`(5)) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (v varchar(65530), key(v(10))); show create table t1; @@ -656,7 +656,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `v` varchar(65530) DEFAULT NULL, KEY `v` (`v`(10)) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values(repeat('a',65530)); select length(v) from t1 where v=repeat('a',65530); length(v) diff --git a/mysql-test/suite/heap/heap_auto_increment.result b/mysql-test/suite/heap/heap_auto_increment.result index e3fd377d4ef49..0501de22729c6 100644 --- a/mysql-test/suite/heap/heap_auto_increment.result +++ b/mysql-test/suite/heap/heap_auto_increment.result @@ -53,7 +53,7 @@ t1 CREATE TABLE `t1` ( `id` tinyint(4) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (name) VALUES ('dog'); UPDATE t1 SET id=-1 WHERE id=1; INSERT INTO t1 (name) VALUES ('cat'); @@ -92,7 +92,7 @@ t1 CREATE TABLE `t1` ( `id` tinyint(4) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -106,7 +106,7 @@ t1 CREATE TABLE `t1` ( `id` smallint(6) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -120,7 +120,7 @@ t1 CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -134,7 +134,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -148,7 +148,7 @@ t1 CREATE TABLE `t1` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -162,7 +162,7 @@ t1 CREATE TABLE `t1` ( `id` float NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -176,7 +176,7 @@ t1 CREATE TABLE `t1` ( `id` double NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name diff --git a/mysql-test/suite/heap/heap_hash.result b/mysql-test/suite/heap/heap_hash.result index 6bc9ff0d527af..e523920bcd00b 100644 --- a/mysql-test/suite/heap/heap_hash.result +++ b/mysql-test/suite/heap/heap_hash.result @@ -1,4 +1,3 @@ -drop table if exists t1,t2; create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; @@ -467,4 +466,23 @@ SELECT * FROM t1 WHERE c1='bar2'; c1 bar2 DROP TABLE t1; -End of 5.5 tests +# +# End of 5.5 tests +# +# +# MDEV-27406 Index on a HEAP table retains DESC attribute despite being hash +# +create table t1 (a int, key(a desc)) engine=memory; +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 Ignored +t1 1 a 1 a NULL 0 NULL NULL YES HASH NO +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +# +# End of 10.8 tests +# diff --git a/mysql-test/suite/heap/heap_hash.test b/mysql-test/suite/heap/heap_hash.test index 3a8979a2393a7..3d3855d8062cf 100644 --- a/mysql-test/suite/heap/heap_hash.test +++ b/mysql-test/suite/heap/heap_hash.test @@ -2,10 +2,6 @@ # Test of heap tables. # ---disable_warnings -drop table if exists t1,t2; ---enable_warnings - create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; @@ -346,4 +342,18 @@ explain SELECT * FROM t1 WHERE c1='bar2'; SELECT * FROM t1 WHERE c1='bar2'; DROP TABLE t1; ---echo End of 5.5 tests +--echo # +--echo # End of 5.5 tests +--echo # + +--echo # +--echo # MDEV-27406 Index on a HEAP table retains DESC attribute despite being hash +--echo # +create table t1 (a int, key(a desc)) engine=memory; +show index from t1; +show create table t1; +drop table t1; + +--echo # +--echo # End of 10.8 tests +--echo # diff --git a/mysql-test/suite/innodb/disabled.def b/mysql-test/suite/innodb/disabled.def deleted file mode 100644 index 35c941f8af74f..0000000000000 --- a/mysql-test/suite/innodb/disabled.def +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################## -# -# 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. -# -############################################################################## - -create-index-debug : MDEV-13680 InnoDB may crash when btr_page_alloc() fails diff --git a/mysql-test/suite/innodb/include/have_innodb_bzip2.inc b/mysql-test/suite/innodb/include/have_innodb_bzip2.inc deleted file mode 100644 index afbe78f0cf965..0000000000000 --- a/mysql-test/suite/innodb/include/have_innodb_bzip2.inc +++ /dev/null @@ -1,4 +0,0 @@ -if (! `SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_have_bzip2' AND variable_value = 'ON'`) -{ - --skip Test requires InnoDB compiled with libbz2 -} diff --git a/mysql-test/suite/innodb/include/have_innodb_lz4.inc b/mysql-test/suite/innodb/include/have_innodb_lz4.inc deleted file mode 100644 index bda3ffa86232f..0000000000000 --- a/mysql-test/suite/innodb/include/have_innodb_lz4.inc +++ /dev/null @@ -1,4 +0,0 @@ -if (!`SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_have_lz4' AND variable_value = 'ON'`) -{ - --skip Test requires InnoDB compiled with liblz4 -} diff --git a/mysql-test/suite/innodb/include/have_innodb_lzma.inc b/mysql-test/suite/innodb/include/have_innodb_lzma.inc deleted file mode 100644 index 86eda33f19471..0000000000000 --- a/mysql-test/suite/innodb/include/have_innodb_lzma.inc +++ /dev/null @@ -1,4 +0,0 @@ -if (!`SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_have_lzma' AND variable_value = 'ON' `) -{ - --skip Test requires InnoDB compiled with liblzma -} diff --git a/mysql-test/suite/innodb/include/have_innodb_lzo.inc b/mysql-test/suite/innodb/include/have_innodb_lzo.inc deleted file mode 100644 index f40418b00fbc0..0000000000000 --- a/mysql-test/suite/innodb/include/have_innodb_lzo.inc +++ /dev/null @@ -1,4 +0,0 @@ -if (! `SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_have_lzo' AND variable_value = 'ON'`) -{ - --skip Test requires InnoDB compiled with liblzo -} diff --git a/mysql-test/suite/innodb/include/have_innodb_snappy.inc b/mysql-test/suite/innodb/include/have_innodb_snappy.inc deleted file mode 100644 index c4dca4c19ee30..0000000000000 --- a/mysql-test/suite/innodb/include/have_innodb_snappy.inc +++ /dev/null @@ -1,4 +0,0 @@ -if (! `SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_have_snappy' AND variable_value = 'ON'`) -{ - --skip Test requires InnoDB compiled with libsnappy -} diff --git a/mysql-test/suite/innodb/include/innodb-page-compression.inc b/mysql-test/suite/innodb/include/innodb-page-compression.inc deleted file mode 100644 index fec0f0cf01cfc..0000000000000 --- a/mysql-test/suite/innodb/include/innodb-page-compression.inc +++ /dev/null @@ -1,128 +0,0 @@ -# This test is slow on buildbot. ---source include/big_test.inc -create table innodb_normal (c1 int not null auto_increment primary key, b char(200)) engine=innodb; -create table innodb_page_compressed1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; -create table innodb_page_compressed2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; -create table innodb_page_compressed3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; -create table innodb_page_compressed4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; -create table innodb_page_compressed5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; -create table innodb_page_compressed6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; -create table innodb_page_compressed7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; -create table innodb_page_compressed8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; -create table innodb_page_compressed9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; - ---disable_query_log -begin; -let $i = 2000; -while ($i) -{ - insert into innodb_normal(b) values(REPEAT('Aa',50)); - insert into innodb_normal(b) values(REPEAT('a',100)); - insert into innodb_normal(b) values(REPEAT('b',100)); - insert into innodb_normal(b) values(REPEAT('0',100)); - insert into innodb_normal(b) values(REPEAT('1',100)); - dec $i; -} - -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; ---enable_query_log - -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed3; -select count(*) from innodb_page_compressed4; -select count(*) from innodb_page_compressed5; -select count(*) from innodb_page_compressed6; -select count(*) from innodb_page_compressed6; -select count(*) from innodb_page_compressed7; -select count(*) from innodb_page_compressed8; -select count(*) from innodb_page_compressed9; - -# -# Wait until pages are really compressed -# -let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED'; ---source include/wait_condition.inc - ---let $MYSQLD_DATADIR=`select @@datadir` - -# shutdown before grep - ---source include/shutdown_mysqld.inc - ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_normal.ibd ---let SEARCH_RANGE = 10000000 ---let SEARCH_PATTERN=AaAaAaAa ---echo # innodb_normal expected FOUND --- let SEARCH_FILE=$t1_IBD --- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed1.ibd ---echo # innodb_page_compressed1 page compressed expected NOT FOUND --- let SEARCH_FILE=$t1_IBD --- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed2.ibd ---echo # innodb_page_compressed2 page compressed expected NOT FOUND --- let SEARCH_FILE=$t1_IBD --- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed3.ibd ---echo # innodb_page_compressed3 page compressed expected NOT FOUND --- let SEARCH_FILE=$t1_IBD --- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed4.ibd ---echo # innodb_page_compressed4 page compressed expected NOT FOUND --- let SEARCH_FILE=$t1_IBD --- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed5.ibd ---echo # innodb_page_compressed5 page compressed expected NOT FOUND --- let SEARCH_FILE=$t1_IBD --- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed6.ibd ---echo # innodb_page_compressed6 page compressed expected NOT FOUND --- let SEARCH_FILE=$t1_IBD --- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed7.ibd ---echo # innodb_page_compressed7 page compressed expected NOT FOUND --- let SEARCH_FILE=$t1_IBD --- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed8.ibd ---echo # innodb_page_compressed8 page compressed expected NOT FOUND --- let SEARCH_FILE=$t1_IBD --- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed9.ibd ---echo # innodb_page_compressed9 page compressed expected NOT FOUND --- let SEARCH_FILE=$t1_IBD --- source include/search_pattern_in_file.inc - --- source include/start_mysqld.inc - -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed3; -select count(*) from innodb_page_compressed4; -select count(*) from innodb_page_compressed5; -select count(*) from innodb_page_compressed6; -select count(*) from innodb_page_compressed6; -select count(*) from innodb_page_compressed7; -select count(*) from innodb_page_compressed8; -select count(*) from innodb_page_compressed9; - -let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_DECOMPRESSED'; ---source include/wait_condition.inc - -drop table innodb_normal; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; diff --git a/mysql-test/suite/innodb/r/alter_candidate_key.result b/mysql-test/suite/innodb/r/alter_candidate_key.result index 79cb225e3b5b9..a3f5d004bf5f7 100644 --- a/mysql-test/suite/innodb/r/alter_candidate_key.result +++ b/mysql-test/suite/innodb/r/alter_candidate_key.result @@ -9,7 +9,7 @@ t1 CREATE TABLE `t1` ( `f2` int(11) NOT NULL, UNIQUE KEY `uidx2` (`f1`,`f2`), UNIQUE KEY `uidx1` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL conc_dml WAIT_FOR go_ahead'; ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE; @@ -25,7 +25,7 @@ t1 CREATE TABLE `t1` ( `f2` int(11) NOT NULL, UNIQUE KEY `uidx1` (`f2`), UNIQUE KEY `uidx2` (`f11`,`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -43,7 +43,7 @@ t1 CREATE TABLE `t1` ( `f2` int(11) NOT NULL, UNIQUE KEY `uidx2` (`f1`,`f2`), UNIQUE KEY `uidx1` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL conc_dml WAIT_FOR go_ahead'; ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE; @@ -60,7 +60,7 @@ t1 CREATE TABLE `t1` ( `f2` int(11) NOT NULL, UNIQUE KEY `uidx1` (`f2`), UNIQUE KEY `uidx2` (`f11`,`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -74,7 +74,7 @@ connection con1; SET DEBUG_SYNC='now WAIT_FOR dml'; BEGIN; INSERT INTO t1 SET a=NULL; -ROLLBACK; +COMMIT; set DEBUG_SYNC='now SIGNAL dml_done'; connection default; ERROR 22004: Invalid use of NULL value @@ -91,7 +91,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` int(11) NOT NULL, UNIQUE KEY `f2` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, UNIQUE KEY(f2), UNIQUE KEY(f2))ENGINE=InnoDB; @@ -104,7 +104,7 @@ t1 CREATE TABLE `t1` ( `f2` int(11) NOT NULL, UNIQUE KEY `f2` (`f2`), UNIQUE KEY `f2_2` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE; SHOW CREATE TABLE t1; Table Create Table @@ -112,5 +112,5 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` int(11) NOT NULL, UNIQUE KEY `f2_2` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/alter_copy.result b/mysql-test/suite/innodb/r/alter_copy.result index 5fdcf2005dfa0..8c9e5966b2ef5 100644 --- a/mysql-test/suite/innodb/r/alter_copy.result +++ b/mysql-test/suite/innodb/r/alter_copy.result @@ -35,7 +35,7 @@ t1 CREATE TABLE `t1` ( FULLTEXT KEY `b` (`b`), FULLTEXT KEY `c` (`c`), FULLTEXT KEY `b_2` (`b`,`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 FORCE, ALGORITHM=COPY; connect hang,localhost,root; SET DEBUG_SYNC='alter_table_copy_trans_commit SIGNAL hung WAIT_FOR ever'; @@ -51,7 +51,7 @@ ADD INDEX(a,b,d), ADD INDEX(a,d,b), ADD INDEX(b,c,d), ADD INDEX(b,d,c), ALGORITHM=COPY; connection default; SET DEBUG_SYNC='now WAIT_FOR hung'; -# restart: --innodb-force-recovery=3 +# restart: --innodb-force-recovery=3 --debug_dbug=+d,recv_ran_out_of_buffer disconnect hang; FTS_INDEX_1.ibd FTS_INDEX_2.ibd @@ -89,7 +89,7 @@ t CREATE TABLE `t` ( `c` int(11) DEFAULT NULL, `d` int(11) DEFAULT NULL, UNIQUE KEY `a` (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT COUNT(*) FROM t; COUNT(*) 999 @@ -115,7 +115,7 @@ t1 CREATE TABLE `t1` ( FULLTEXT KEY `b` (`b`), FULLTEXT KEY `c` (`c`), FULLTEXT KEY `b_2` (`b`,`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -156,7 +156,7 @@ t CREATE TABLE `t` ( `c` int(11) DEFAULT NULL, `d` int(11) DEFAULT NULL, UNIQUE KEY `a` (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT COUNT(*) FROM t; COUNT(*) 999 @@ -182,7 +182,7 @@ t1 CREATE TABLE `t1` ( FULLTEXT KEY `b` (`b`), FULLTEXT KEY `c` (`c`), FULLTEXT KEY `b_2` (`b`,`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK diff --git a/mysql-test/suite/innodb/r/alter_crash.result b/mysql-test/suite/innodb/r/alter_crash.result index 46ea85d3e1e70..110653101fe2d 100644 --- a/mysql-test/suite/innodb/r/alter_crash.result +++ b/mysql-test/suite/innodb/r/alter_crash.result @@ -65,7 +65,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` int(11) NOT NULL, PRIMARY KEY (`f2`,`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (5,6),(7,8); SELECT * FROM t1; f1 f2 @@ -107,7 +107,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `f1` int(11) NOT NULL, `f2` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=InnoDB; ALTER TABLE t2 ADD PRIMARY KEY (f2, f1); @@ -145,7 +145,7 @@ t1 CREATE TABLE `t1` ( `d` int(11) DEFAULT NULL, PRIMARY KEY (`a`), KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UPDATE t1 SET d=NULL; SELECT * FROM t1; a b d @@ -169,9 +169,6 @@ INSERT INTO t1(f1, f2) VALUES(2, "This is column2 value"); ROLLBACK; set DEBUG_SYNC = 'now SIGNAL insert_done'; connection default; -Warnings: -Warning 1265 Data truncated for column 'f3' at row 3 -Warning 1265 Data truncated for column 'f4' at row 3 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -181,7 +178,7 @@ t1 CREATE TABLE `t1` ( `f6` int(11) NOT NULL, `f4` char(100) NOT NULL, PRIMARY KEY (`f6`,`f4`(3),`f3`(3)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT COUNT(*) FROM t1; COUNT(*) 1 @@ -202,6 +199,7 @@ connection default; SET DEBUG_SYNC = 'now WAIT_FOR scanned'; BEGIN; INSERT INTO t1 VALUES(2,1); +COMMIT; SET DEBUG_SYNC = 'now SIGNAL commit'; SET DEBUG_SYNC = 'now WAIT_FOR c'; SET GLOBAL innodb_fil_make_page_dirty_debug=0; @@ -217,8 +215,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; a b 1 1 +2 1 DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/alter_crash_rebuild.result b/mysql-test/suite/innodb/r/alter_crash_rebuild.result new file mode 100644 index 0000000000000..159e8e496f73d --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_crash_rebuild.result @@ -0,0 +1,19 @@ +CREATE TABLE t1 (a INT NOT NULL) ENGINE=InnoDB STATS_PERSISTENT=0; +connect ddl,localhost,root; +SET DEBUG_SYNC='after_trx_committed_in_memory SIGNAL stuck WAIT_FOR ever'; +ALTER TABLE t1 ADD PRIMARY KEY(a); +connection default; +SET DEBUG_SYNC='now WAIT_FOR stuck'; +SET GLOBAL innodb_log_checkpoint_now=ON; +# restart +disconnect ddl; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 +SELECT * FROM t1; +a +DROP TABLE t1; +InnoDB 0 transactions not purged diff --git a/mysql-test/suite/innodb/r/alter_dml_apply.result b/mysql-test/suite/innodb/r/alter_dml_apply.result new file mode 100644 index 0000000000000..c9def9d6a411d --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_dml_apply.result @@ -0,0 +1,39 @@ +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, +f3 CHAR(200), f4 CHAR(200), +PRIMARY KEY(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB"); +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 ADD UNIQUE KEY(f2), ADD UNIQUE INDEX(f4(10)); +connect con1,localhost,root,,,; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +DELETE FROM t1 WHERE f1= 6000; +INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB"); +ROLLBACK; +BEGIN; +DELETE FROM t1 WHERE f1= 6000; +INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB"); +INSERT INTO t1 SELECT seq, seq, repeat('a', 200), repeat('b', 200) FROM seq_1_to_4000; +COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection default; +ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 ADD UNIQUE KEY(f2), ADD INDEX(f3(10)); +connection con1; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +DELETE FROM t1; +INSERT INTO t1 SELECT seq, seq, repeat('d', 200), repeat('e', 200) FROM +seq_1_to_4000; +UPDATE t1 SET f3=repeat('c', 200), f4= repeat('d', 200), f2=3; +COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection default; +ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +disconnect con1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET DEBUG_SYNC=reset; diff --git a/mysql-test/suite/innodb/r/alter_key_block_size-11757.result b/mysql-test/suite/innodb/r/alter_key_block_size-11757.result index 6e3b35b6f1a22..0368bb3f1f432 100644 --- a/mysql-test/suite/innodb/r/alter_key_block_size-11757.result +++ b/mysql-test/suite/innodb/r/alter_key_block_size-11757.result @@ -11,7 +11,7 @@ t1 CREATE TABLE `t1` ( `id2` bigint(20) NOT NULL, PRIMARY KEY (`id1`), UNIQUE KEY `id2` (`id2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 SET innodb_strict_mode=ON; alter table t1 row_format=dynamic; ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE' @@ -26,7 +26,7 @@ t1 CREATE TABLE `t1` ( `id2` bigint(20) NOT NULL, PRIMARY KEY (`id1`), UNIQUE KEY `id2` (`id2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=8 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=8 SET innodb_strict_mode=ON; alter table t1 key_block_size=0; show create table t1; @@ -36,7 +36,7 @@ t1 CREATE TABLE `t1` ( `id2` bigint(20) NOT NULL, PRIMARY KEY (`id1`) KEY_BLOCK_SIZE=8, UNIQUE KEY `id2` (`id2`) KEY_BLOCK_SIZE=8 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC alter table t1 drop primary key, add primary key (id1), drop key id2, add unique (id2); show create table t1; @@ -46,5 +46,5 @@ t1 CREATE TABLE `t1` ( `id2` bigint(20) NOT NULL, PRIMARY KEY (`id1`), UNIQUE KEY `id2` (`id2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC drop table t1; diff --git a/mysql-test/suite/innodb/r/alter_large_dml.result b/mysql-test/suite/innodb/r/alter_large_dml.result index 41f497a5591f2..e73377e6bc272 100644 --- a/mysql-test/suite/innodb/r/alter_large_dml.result +++ b/mysql-test/suite/innodb/r/alter_large_dml.result @@ -35,7 +35,7 @@ t1 CREATE TABLE `t1` ( `f6` char(200) DEFAULT NULL, `f7` char(200) DEFAULT NULL, `f8` char(200) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT COUNT(*) FROM t1; COUNT(*) 16384 diff --git a/mysql-test/suite/innodb/r/alter_mdl_timeout.result b/mysql-test/suite/innodb/r/alter_mdl_timeout.result index 7af1362c69e98..e4fba8e260f75 100644 --- a/mysql-test/suite/innodb/r/alter_mdl_timeout.result +++ b/mysql-test/suite/innodb/r/alter_mdl_timeout.result @@ -10,7 +10,7 @@ begin; INSERT INTO t1 VALUES('e','e',5, 5); SET DEBUG_SYNC="now SIGNAL con1_insert"; SET DEBUG_SYNC="now WAIT_FOR con1_wait"; -SET DEBUG_SYNC="before_row_upd_sec_new_index_entry SIGNAL con1_update WAIT_FOR alter_rollback"; +SET DEBUG_SYNC="after_row_upd_clust SIGNAL con1_update WAIT_FOR alter_rollback"; UPDATE t1 set f4 = 10 order by f1 desc limit 2; connection default; ERROR HY000: Lock wait timeout exceeded; try restarting transaction diff --git a/mysql-test/suite/innodb/r/alter_not_null_debug,STRICT.rdiff b/mysql-test/suite/innodb/r/alter_not_null_debug,STRICT.rdiff index 09c717c44b0b7..81466d791acf7 100644 --- a/mysql-test/suite/innodb/r/alter_not_null_debug,STRICT.rdiff +++ b/mysql-test/suite/innodb/r/alter_not_null_debug,STRICT.rdiff @@ -1,11 +1,16 @@ -18,21c18 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 -< Warnings: -< Warning 1265 Data truncated for column 'c2' at row 3 ---- -> ERROR 01000: Data truncated for column 'c2' at row 3 -24c21 -< 2 0 ---- -> 2 NULL +@@ -15,13 +15,10 @@ + SET DEBUG_SYNC= 'now SIGNAL flushed'; + affected rows: 0 + connection default; +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 +-Warnings: +-Warning 1265 Data truncated for column 'c2' at row 3 ++ERROR 22004: Invalid use of NULL value + SELECT * FROM t1; + c1 c2 +-2 0 ++2 NULL + 3 1 + DROP TABLE t1; + CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB; diff --git a/mysql-test/suite/innodb/r/alter_partitioned.result b/mysql-test/suite/innodb/r/alter_partitioned.result index 08e1654c04470..feb8cd947112a 100644 --- a/mysql-test/suite/innodb/r/alter_partitioned.result +++ b/mysql-test/suite/innodb/r/alter_partitioned.result @@ -24,7 +24,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `pk` int(11) NOT NULL, PRIMARY KEY (`pk`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection con1; COMMIT; connection default; diff --git a/mysql-test/suite/innodb/r/alter_persistent_autoinc.result b/mysql-test/suite/innodb/r/alter_persistent_autoinc.result new file mode 100644 index 0000000000000..52ac4d83ad918 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_persistent_autoinc.result @@ -0,0 +1,42 @@ +CREATE TABLE t1 (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB; +ALTER TABLE t1 MODIFY c INT NULL, ALGORITHM=INSTANT; +INSERT INTO t1 SET c=1; +CREATE TABLE t2 (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB; +ALTER TABLE t2 MODIFY c INT NULL, FORCE, ALGORITHM=INPLACE; +INSERT INTO t2 SET c=1; +CREATE TABLE t3 (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB; +ALTER TABLE t3 MODIFY c INT NULL, ALGORITHM=INPLACE; +INSERT INTO t3 SET c=1; +CREATE TABLE t4 (c1 INT AUTO_INCREMENT NULL UNIQUE, c2 INT) ENGINE=InnoDB; +ALTER TABLE t4 MODIFY c1 INT NULL, CHANGE COLUMN c2 c3 INT, ALGORITHM=INPLACE; +INSERT INTO t4 SET c1=1; +CREATE TABLE t5 (c1 INT AUTO_INCREMENT NULL UNIQUE, c2 INT, c3 INTEGER GENERATED ALWAYS AS (c2)) ENGINE=InnoDB; +ALTER TABLE t5 MODIFY c1 INT NULL, MODIFY COLUMN c2 INT FIRST, ALGORITHM=INPLACE; +INSERT INTO t5 SET c1=1; +CREATE TABLE t6 (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB +PARTITION BY LIST(c) ( +PARTITION p1 VALUES IN (1), +PARTITION p2 VALUES IN (2) +); +ALTER TABLE t6 MODIFY c INT NULL, ALGORITHM=INSTANT; +INSERT INTO t6 SET c=1; +INSERT INTO t6 SET c=2; +CREATE TABLE t7 (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB +PARTITION BY LIST(c) ( +PARTITION p1 VALUES IN (1), +PARTITION p2 VALUES IN (2) +); +ALTER TABLE t7 MODIFY c INT NULL, ALGORITHM=INPLACE; +INSERT INTO t7 SET c=1; +INSERT INTO t7 SET c=2; +CREATE TABLE t8 (c1 INT AUTO_INCREMENT NULL UNIQUE, c2 INT) ENGINE=InnoDB +PARTITION BY LIST(c1) ( +PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +ALTER TABLE t8 MODIFY c1 INT NULL, CHANGE COLUMN c2 c3 INT, ALGORITHM=INPLACE; +INSERT INTO t8 SET c1=1; +INSERT INTO t8 SET c1=2; +FLUSH TABLES t1, t2, t3, t4, t5, t6, t7, t8 FOR EXPORT; +AUTO_INCREMENT not partitioned: 0 0 0 0 0 +AUTO_INCREMENT partitioned: (0, 0) (0, 0) (0, 0) +UNLOCK TABLES; +DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8; diff --git a/mysql-test/suite/innodb/r/alter_rename_existing.result b/mysql-test/suite/innodb/r/alter_rename_existing.result index aff8a3a09a1cc..1fdc2011a24de 100644 --- a/mysql-test/suite/innodb/r/alter_rename_existing.result +++ b/mysql-test/suite/innodb/r/alter_rename_existing.result @@ -24,7 +24,7 @@ t2 CREATE TABLE `t2` ( `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `b` char(10) DEFAULT NULL, UNIQUE KEY `a` (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * from t2; a b 1 one @@ -44,7 +44,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `b` char(20) DEFAULT NULL, UNIQUE KEY `a` (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT name, space=0 FROM information_schema.innodb_sys_tables WHERE name = 'test/t1'; name space=0 test/t1 1 @@ -75,7 +75,7 @@ t1 CREATE TABLE `t1` ( `c` int(11) DEFAULT NULL, `d` int(11) DEFAULT NULL, UNIQUE KEY `a` (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT name, space=0 FROM information_schema.innodb_sys_tables WHERE name = 'test/t1'; name space=0 test/t1 0 diff --git a/mysql-test/suite/innodb/r/alter_table.result b/mysql-test/suite/innodb/r/alter_table.result index 3b0d3b0659dcc..d39edd3c826d0 100644 --- a/mysql-test/suite/innodb/r/alter_table.result +++ b/mysql-test/suite/innodb/r/alter_table.result @@ -8,7 +8,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` text NOT NULL, KEY `idx1` (`a`(3072)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC drop table t1; set @@sql_mode=default; create table t1 ( @@ -97,12 +97,12 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 TRANSACTIONAL=1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci TRANSACTIONAL=1 alter table t1 engine=innodb; alter table t1 add column b int; drop table t1,t2; diff --git a/mysql-test/suite/innodb/r/alter_table_upgrade.result b/mysql-test/suite/innodb/r/alter_table_upgrade.result new file mode 100644 index 0000000000000..5438f5eadc0c8 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_table_upgrade.result @@ -0,0 +1,36 @@ +# +# Start of 10.4 tests +# +# +# MDEV-29481 mariadb-upgrade prints confusing statement +# +CREATE TABLE pet4 ( +build_time double(18,7) DEFAULT NULL, +KEY idx1 (build_time)) ENGINE=InnoDB; +FLUSH TABLES; +SHOW CREATE TABLE pet4; +Table Create Table +pet4 CREATE TABLE `pet4` ( + `build_time` double(18,7) DEFAULT NULL, + KEY `idx1` (`build_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +CHECK TABLE pet4 FOR UPGRADE; +Table Op Msg_type Msg_text +test.pet4 check status OK +ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=INSTANT; +DROP TABLE pet4; +CREATE TABLE pet4 ( +build_time double(18,7) DEFAULT NULL, +KEY idx1 (build_time)) ENGINE=InnoDB; +FLUSH TABLES; +SHOW CREATE TABLE pet4; +Table Create Table +pet4 CREATE TABLE `pet4` ( + `build_time` double(18,7) DEFAULT NULL, + KEY `idx1` (`build_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=NOCOPY; +DROP TABLE pet4; +# +# End of 10.4 tests +# diff --git a/mysql-test/suite/innodb/r/alter_varchar_change.result b/mysql-test/suite/innodb/r/alter_varchar_change.result index 9bf0d126588ef..8b9608b9b4f5f 100644 --- a/mysql-test/suite/innodb/r/alter_varchar_change.result +++ b/mysql-test/suite/innodb/r/alter_varchar_change.result @@ -26,7 +26,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` varchar(200) NOT NULL, PRIMARY KEY (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), @@ -43,7 +43,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` varchar(200) DEFAULT NULL, KEY `idx` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), f3 VARCHAR(100), INDEX idx(f2, f3), index idx1(f3, f2))ENGINE=InnoDB; @@ -66,7 +66,7 @@ t1 CREATE TABLE `t1` ( `f3` varchar(150) DEFAULT NULL, KEY `idx` (`f2`,`f3`), KEY `idx1` (`f3`,`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), INDEX idx(f2(40)))ENGINE=InnoDB; @@ -87,7 +87,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` varchar(200) DEFAULT NULL, KEY `idx` (`f2`(40)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), FULLTEXT idx(f2))ENGINE=InnoDB; @@ -108,7 +108,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` varchar(200) DEFAULT NULL, FULLTEXT KEY `idx` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), @@ -133,7 +133,7 @@ t1 CREATE TABLE `t1` ( `f2` varchar(100) DEFAULT NULL, `f3` varchar(50) GENERATED ALWAYS AS (`f2`) VIRTUAL, KEY `idx` (`f3`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), @@ -156,7 +156,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` varchar(200) DEFAULT NULL, KEY `idx` (`f2`(10)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), @@ -178,7 +178,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` varchar(200) DEFAULT NULL, KEY `idx` (`f2`(10)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), @@ -200,7 +200,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` varchar(200) DEFAULT NULL, KEY `idx` (`f2`(50)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), @@ -223,7 +223,7 @@ t1 CREATE TABLE `t1` ( `f2` varchar(200) DEFAULT NULL, KEY `idx` (`f2`), KEY `idx1` (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), @@ -245,7 +245,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` varchar(200) DEFAULT NULL, KEY `idx` (`f2`(6)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), @@ -263,7 +263,7 @@ t1 CREATE TABLE `t1` ( `f2` varchar(200) DEFAULT NULL, `f3` int(11) DEFAULT NULL, KEY `idx` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100) PRIMARY KEY)ENGINE=InnoDB; CALL get_table_id("test/t1", @tbl_id); @@ -279,7 +279,7 @@ t1 CREATE TABLE `t1` ( `f2` varchar(200) NOT NULL, `f3` int(11) DEFAULT NULL, PRIMARY KEY (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100))ENGINE=INNODB; CALL get_table_id("test/t1", @tbl_id); @@ -294,7 +294,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` varchar(200) DEFAULT NULL, FULLTEXT KEY `idx` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100) PRIMARY KEY)ENGINE=InnoDB; @@ -310,7 +310,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` char(200) NOT NULL, PRIMARY KEY (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), @@ -329,7 +329,7 @@ t1 CREATE TABLE `t1` ( `f2` varchar(50) DEFAULT NULL, KEY `idx` (`f2`(10)), KEY `idx1` (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), @@ -347,7 +347,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` varchar(5) DEFAULT NULL, KEY `idx` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), FULLTEXT idx(f2))ENGINE=InnoDB; @@ -368,7 +368,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` varchar(50) DEFAULT NULL, FULLTEXT KEY `idx` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), @@ -385,7 +385,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` char(200) DEFAULT NULL, KEY `idx` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), @@ -402,7 +402,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` text DEFAULT NULL, KEY `idx` (`f2`(40)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), @@ -419,7 +419,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` varchar(300) DEFAULT NULL, KEY `idx` (`f2`(40)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(128), @@ -436,7 +436,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` varchar(300) DEFAULT NULL, KEY `idx` (`f2`(40)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(128), @@ -453,7 +453,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` varchar(300) DEFAULT NULL, KEY `idx` (`f2`(40)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), @@ -468,9 +468,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, - `f2` varchar(200) CHARACTER SET utf16 DEFAULT NULL, + `f2` varchar(200) CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL, KEY `idx` (`f2`(40)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), @@ -487,7 +487,7 @@ t1 CREATE TABLE `t1` ( `f2` varchar(100) DEFAULT NULL, `f3` varchar(50) GENERATED ALWAYS AS (`f2`) VIRTUAL, KEY `idx` (`f3`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE get_index_id; DROP PROCEDURE get_table_id; diff --git a/mysql-test/suite/innodb/r/auto_increment_dup.result b/mysql-test/suite/innodb/r/auto_increment_dup.result index 9926047b66564..134545701ae94 100644 --- a/mysql-test/suite/innodb/r/auto_increment_dup.result +++ b/mysql-test/suite/innodb/r/auto_increment_dup.result @@ -12,7 +12,7 @@ t1 CREATE TABLE `t1` ( `c` char(1) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `k` (`k`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # # Sequential execution # diff --git a/mysql-test/suite/innodb/r/autoinc_debug.result b/mysql-test/suite/innodb/r/autoinc_debug.result index 0048a623f9a60..b3b7a469ada37 100644 --- a/mysql-test/suite/innodb/r/autoinc_debug.result +++ b/mysql-test/suite/innodb/r/autoinc_debug.result @@ -16,7 +16,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # restart # SETTING auto_increment_increment IN CONNECTION1 SET AUTO_INCREMENT_INCREMENT = 2; @@ -37,7 +37,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET DEBUG_SYNC= 'now SIGNAL opened1'; connection con1; SELECT * FROM t1; @@ -50,7 +50,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; disconnect con1; DROP TABLE t1; @@ -66,7 +66,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET DEBUG_SYNC = 'now SIGNAL flushed'; connect con1, localhost, root,,; # SETTING auto_increment_increment in connection1 @@ -88,7 +88,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET DEBUG_SYNC= 'now SIGNAL opened1'; disconnect con1; connection default; @@ -102,6 +102,6 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET DEBUG_SYNC='RESET'; diff --git a/mysql-test/suite/innodb/r/autoinc_persist,desc.rdiff b/mysql-test/suite/innodb/r/autoinc_persist,desc.rdiff new file mode 100644 index 0000000000000..639a60648e44c --- /dev/null +++ b/mysql-test/suite/innodb/r/autoinc_persist,desc.rdiff @@ -0,0 +1,769 @@ +@@ -13,212 +13,212 @@ + # + # Pre-create several tables + SET SQL_MODE='STRICT_ALL_TABLES'; +-CREATE TABLE t1(a TINYINT AUTO_INCREMENT KEY) ENGINE = InnoDB; ++CREATE TABLE t1(a TINYINT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t1 VALUES(0), (0), (0), (0), (-1), (-10), (0), + (20), (30), (31); + SELECT * FROM t1; + a +--10 +--1 +-1 +-2 +-3 +-4 +-5 +-20 +-30 + 31 +-CREATE TABLE t2(a TINYINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; ++30 ++20 ++5 ++4 ++3 ++2 ++1 ++-1 ++-10 ++CREATE TABLE t2(a TINYINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t2 VALUES(-5); + ERROR 22003: Out of range value for column 'a' at row 1 + INSERT INTO t2 VALUES(0), (0), (0), (0), (8), (10), (0), + (20), (30), (31); + SELECT * FROM t2; + a +-1 +-2 +-3 +-4 +-8 +-10 +-11 +-20 +-30 + 31 +-CREATE TABLE t3(a SMALLINT AUTO_INCREMENT KEY) ENGINE = InnoDB; ++30 ++20 ++11 ++10 ++8 ++4 ++3 ++2 ++1 ++CREATE TABLE t3(a SMALLINT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t3 VALUES(0), (0), (0), (0), (-1), (-10), (0), + (20), (30), (31), (1024), (4096); + SELECT * FROM t3; + a +--10 +--1 +-1 +-2 +-3 +-4 +-5 +-20 +-30 +-31 +-1024 + 4096 +-CREATE TABLE t4(a SMALLINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; ++1024 ++31 ++30 ++20 ++5 ++4 ++3 ++2 ++1 ++-1 ++-10 ++CREATE TABLE t4(a SMALLINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t4 VALUES(-5); + ERROR 22003: Out of range value for column 'a' at row 1 + INSERT INTO t4 VALUES(0), (0), (0), (0), (8), (10), (0), + (20), (30), (31), (1024), (4096); + SELECT * FROM t4; + a +-1 +-2 +-3 +-4 +-8 +-10 +-11 +-20 +-30 +-31 +-1024 + 4096 +-CREATE TABLE t5(a MEDIUMINT AUTO_INCREMENT KEY) ENGINE = InnoDB; ++1024 ++31 ++30 ++20 ++11 ++10 ++8 ++4 ++3 ++2 ++1 ++CREATE TABLE t5(a MEDIUMINT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t5 VALUES(0), (0), (0), (0), (-1), (-10), (0), + (20), (30), (31), (1000000), (1000005); + SELECT * FROM t5; + a +--10 +--1 +-1 +-2 +-3 +-4 +-5 +-20 +-30 +-31 +-1000000 + 1000005 +-CREATE TABLE t6(a MEDIUMINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; ++1000000 ++31 ++30 ++20 ++5 ++4 ++3 ++2 ++1 ++-1 ++-10 ++CREATE TABLE t6(a MEDIUMINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t6 VALUES(-5); + ERROR 22003: Out of range value for column 'a' at row 1 + INSERT INTO t6 VALUES(0), (0), (0), (0), (8), (10), (0), + (20), (30), (31), (1000000), (1000005); + SELECT * FROM t6; + a +-1 +-2 +-3 +-4 +-8 +-10 +-11 +-20 +-30 +-31 +-1000000 + 1000005 +-CREATE TABLE t7(a INT AUTO_INCREMENT KEY) ENGINE = InnoDB; ++1000000 ++31 ++30 ++20 ++11 ++10 ++8 ++4 ++3 ++2 ++1 ++CREATE TABLE t7(a INT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t7 VALUES(0), (0), (0), (0), (-1), (-10), (0), + (20), (30), (31), (100000000), (100000008); + SELECT * FROM t7; + a +--10 +--1 +-1 +-2 +-3 +-4 +-5 +-20 +-30 +-31 +-100000000 + 100000008 +-CREATE TABLE t8(a INT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; ++100000000 ++31 ++30 ++20 ++5 ++4 ++3 ++2 ++1 ++-1 ++-10 ++CREATE TABLE t8(a INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t8 VALUES(-5); + ERROR 22003: Out of range value for column 'a' at row 1 + INSERT INTO t8 VALUES(0), (0), (0), (0), (8), (10), (0), + (20), (30), (31), (100000000), (100000008); + SELECT * FROM t8; + a +-1 +-2 +-3 +-4 +-8 +-10 +-11 +-20 +-30 +-31 +-100000000 + 100000008 +-CREATE TABLE t9(a BIGINT AUTO_INCREMENT KEY) ENGINE = InnoDB; ++100000000 ++31 ++30 ++20 ++11 ++10 ++8 ++4 ++3 ++2 ++1 ++CREATE TABLE t9(a BIGINT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t9 VALUES(0), (0), (0), (0), (-1), (-10), (0), + (20), (30), (31), (100000000000), (100000000006); + SELECT * FROM t9; + a +--10 +--1 +-1 +-2 +-3 +-4 +-5 +-20 +-30 +-31 +-100000000000 + 100000000006 +-CREATE TABLE t10(a BIGINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; ++100000000000 ++31 ++30 ++20 ++5 ++4 ++3 ++2 ++1 ++-1 ++-10 ++CREATE TABLE t10(a BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t10 VALUES(-5); + ERROR 22003: Out of range value for column 'a' at row 1 + INSERT INTO t10 VALUES(0), (0), (0), (0), (8), (10), (0), + (20), (30), (31), (100000000000), (100000000006); + SELECT * FROM t10; + a +-1 +-2 +-3 +-4 +-8 +-10 +-11 +-20 +-30 +-31 +-100000000000 + 100000000006 +-CREATE TABLE t11(a FLOAT AUTO_INCREMENT KEY) ENGINE = InnoDB; ++100000000000 ++31 ++30 ++20 ++11 ++10 ++8 ++4 ++3 ++2 ++1 ++CREATE TABLE t11(a FLOAT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t11 VALUES(0), (0), (0), (0), (-1), (-10), (0), + (20), (30), (31); + SELECT * FROM t11; + a +--10 +--1 +-1 +-2 +-3 +-4 +-5 +-20 +-30 + 31 +-CREATE TABLE t12(a DOUBLE AUTO_INCREMENT KEY) ENGINE = InnoDB; ++30 ++20 ++5 ++4 ++3 ++2 ++1 ++-1 ++-10 ++CREATE TABLE t12(a DOUBLE AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t12 VALUES(0), (0), (0), (0), (-1), (-10), (0), + (20), (30), (31); + SELECT * FROM t12; + a +--10 +--1 +-1 +-2 +-3 +-4 +-5 +-20 +-30 + 31 ++30 ++20 ++5 ++4 ++3 ++2 ++1 ++-1 ++-10 + # Scenario 1: Normal restart, to test if the counters are persisted + # Scenario 2: Delete some values, to test the counters should not be the + # one which is the largest in current table +@@ -242,14 +242,14 @@ + SELECT MAX(a) AS `Expect 100000000000` FROM t9; + Expect 100000000000 + 100000000000 +-CREATE TABLE t13(a INT AUTO_INCREMENT KEY) ENGINE = InnoDB, ++CREATE TABLE t13(a INT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB, + AUTO_INCREMENT = 1234; + # restart + SHOW CREATE TABLE t13; + Table Create Table + t13 CREATE TABLE `t13` ( + `a` int(11) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=1234 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + INSERT INTO t13 VALUES(0); + SELECT a AS `Expect 1234` FROM t13; +@@ -464,28 +464,28 @@ + INSERT INTO t1 VALUES(0), (0); + SELECT * FROM t1; + a +-1 + 2 ++1 + INSERT INTO t3 VALUES(0), (0); + SELECT * FROM t3; + a +-1 + 2 ++1 + INSERT INTO t5 VALUES(0), (0); + SELECT * FROM t5; + a +-1 + 2 ++1 + INSERT INTO t7 VALUES(0), (0); + SELECT * FROM t7; + a +-1 + 2 ++1 + INSERT INTO t9 VALUES(0), (0); + SELECT * FROM t9; + a +-1 + 2 ++1 + # Ensure that all changes before the server is killed are persisted. + set global innodb_flush_log_at_trx_commit=1; + TRUNCATE TABLE t1; +@@ -498,63 +498,63 @@ + INSERT INTO t19 VALUES(0), (0); + SELECT * FROM t19; + a +-1 + 2 ++1 + # restart + INSERT INTO t1 VALUES(0), (0); + SELECT * FROM t1; + a +-1 + 2 ++1 + INSERT INTO t3 VALUES(0), (0); + SELECT * FROM t3; + a +-1 + 2 ++1 + INSERT INTO t5 VALUES(0), (0); + SELECT * FROM t5; + a +-1 + 2 ++1 + INSERT INTO t7 VALUES(0), (0); + SELECT * FROM t7; + a +-1 + 2 ++1 + INSERT INTO t19 VALUES(0), (0); + SELECT * FROM t19; + a +-1 +-2 +-3 + 4 ++3 ++2 ++1 + DELETE FROM t19 WHERE a = 4; + RENAME TABLE t19 to t9; + INSERT INTO t9 VALUES(0), (0); + SELECT * FROM t9; + a +-1 +-2 +-3 +-5 + 6 ++5 ++3 ++2 ++1 + TRUNCATE TABLE t9; + INSERT INTO t9 VALUES(0), (0); + SELECT * FROM t9; + a +-1 + 2 ++1 + # Scenario 8: Test ALTER TABLE operations + INSERT INTO t3 VALUES(0), (0), (100), (200), (1000); + SELECT * FROM t3; + a +-1 +-2 +-3 +-4 +-100 +-200 + 1000 ++200 ++100 ++4 ++3 ++2 ++1 + DELETE FROM t3 WHERE a > 300; + SELECT MAX(a) AS `Expect 200` FROM t3; + Expect 200 +@@ -566,7 +566,7 @@ + Table Create Table + t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + INSERT INTO t3 VALUES(0); + SELECT MAX(a) AS `Expect 201` FROM t3; +@@ -579,7 +579,7 @@ + Table Create Table + t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=500 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + INSERT INTO t3 VALUES(0); + SELECT MAX(a) AS `Expect 500` FROM t3; +@@ -591,13 +591,13 @@ + Table Create Table + t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + INSERT INTO t3 VALUES(0), (0); + SELECT * FROM t3; + a +-100 + 101 ++100 + INSERT INTO t3 VALUES(150), (180); + UPDATE t3 SET a = 200 WHERE a = 150; + INSERT INTO t3 VALUES(220); +@@ -607,7 +607,7 @@ + Table Create Table + t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=221 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + INSERT INTO t3 VALUES(0); + SELECT MAX(a) AS `Expect 221` FROM t3; +@@ -619,7 +619,7 @@ + Table Create Table + t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=120 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + # MDEV-6076: Test adding an AUTO_INCREMENT COLUMN + CREATE TABLE mdev6076a (b INT) ENGINE=InnoDB; +@@ -669,18 +669,18 @@ + INSERT INTO t_inplace SELECT * FROM t3; + SELECT * FROM t_inplace; + a +-100 +-101 +-120 +-121 +-122 +-200 + 210 ++200 ++122 ++121 ++120 ++101 ++100 + SHOW CREATE TABLE t_inplace; + Table Create Table + t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + # This will keep the autoinc counter + ALTER TABLE t_inplace AUTO_INCREMENT = 250, ALGORITHM = INPLACE; +@@ -689,7 +689,7 @@ + Table Create Table + t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + # This should keep the autoinc counter as well + ALTER TABLE t_inplace ADD COLUMN b INT, ALGORITHM = INPLACE; +@@ -699,16 +699,16 @@ + t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + DELETE FROM t_inplace WHERE a > 150; + SELECT * FROM t_inplace; + a b +-100 NULL +-101 NULL +-120 NULL +-121 NULL + 122 NULL ++121 NULL ++120 NULL ++101 NULL ++100 NULL + # This should reset the autoinc counter to the one specified + # Since it's smaller than current one but bigger than existing + # biggest counter in the table +@@ -719,7 +719,7 @@ + t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + # This should reset the autoinc counter to the next value of + # current max counter in the table, since the specified value +@@ -730,7 +730,7 @@ + Table Create Table + t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + INSERT INTO t_inplace VALUES(0), (0); + SELECT MAX(a) AS `Expect 124` FROM t_inplace; +@@ -757,18 +757,18 @@ + INSERT INTO t_copy SELECT * FROM t3; + SELECT * FROM t_copy; + a +-100 +-101 +-120 +-121 +-122 +-200 + 210 ++200 ++122 ++121 ++120 ++101 ++100 + SHOW CREATE TABLE t_copy; + Table Create Table + t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + # This will keep the autoinc counter + ALTER TABLE t_copy AUTO_INCREMENT = 250, ALGORITHM = COPY; +@@ -777,7 +777,7 @@ + Table Create Table + t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + # This should keep the autoinc counter as well + ALTER TABLE t_copy ADD COLUMN b INT, ALGORITHM = COPY; +@@ -787,16 +787,16 @@ + t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + DELETE FROM t_copy WHERE a > 150; + SELECT * FROM t_copy; + a b +-100 NULL +-101 NULL +-120 NULL +-121 NULL + 122 NULL ++121 NULL ++120 NULL ++101 NULL ++100 NULL + # This should reset the autoinc counter to the one specified + # Since it's smaller than current one but bigger than existing + # biggest counter in the table +@@ -807,7 +807,7 @@ + t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + # This should reset the autoinc counter to the next value of + # current max counter in the table, since the specified value +@@ -818,7 +818,7 @@ + Table Create Table + t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + INSERT INTO t_copy VALUES(0), (0); + SELECT MAX(a) AS `Expect 124` FROM t_copy; +@@ -842,7 +842,7 @@ + 126 + DROP TABLE t_copy, it_copy; + # Scenario 9: Test the sql_mode = NO_AUTO_VALUE_ON_ZERO +-CREATE TABLE t30 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT, key(b)) ENGINE = InnoDB; ++CREATE TABLE t30 (a INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(a DESC), b INT, key(b)) ENGINE = InnoDB; + set SQL_MODE = NO_AUTO_VALUE_ON_ZERO; + INSERT INTO t30 VALUES(NULL, 1), (200, 2), (0, 3); + INSERT INTO t30(b) VALUES(4), (5), (6), (7); +@@ -869,20 +869,20 @@ + set global innodb_flush_log_at_trx_commit=1; + CREATE TABLE t31 (a INT) ENGINE = InnoDB; + INSERT INTO t31 VALUES(1), (2); +-ALTER TABLE t31 ADD b INT AUTO_INCREMENT PRIMARY KEY; ++ALTER TABLE t31 ADD b INT AUTO_INCREMENT, ADD PRIMARY KEY(b DESC); + INSERT INTO t31 VALUES(3, 0), (4, NULL), (5, NULL); + INSERT INTO t31 VALUES(6, 0); + ERROR 23000: Duplicate entry '0' for key 'PRIMARY' + SELECT * FROM t31; + a b +-3 0 +-1 1 +-2 2 +-4 3 + 5 4 ++4 3 ++2 2 ++1 1 ++3 0 + SET SQL_MODE = 0; + # Scenario 10: Rollback would not rollback the counter +-CREATE TABLE t32 (a BIGINT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; ++CREATE TABLE t32 (a BIGINT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE=InnoDB; + INSERT INTO t32 VALUES(0), (0); + # Ensure that all changes before the server is killed are persisted. + set global innodb_flush_log_at_trx_commit=1; +@@ -897,7 +897,7 @@ + # increasing the counter + CREATE TABLE t33 ( + a BIGINT NOT NULL PRIMARY KEY, +-b BIGINT NOT NULL AUTO_INCREMENT, KEY(b)) ENGINE = InnoDB; ++b BIGINT NOT NULL AUTO_INCREMENT, INDEX(b DESC)) ENGINE = InnoDB; + INSERT INTO t33 VALUES(1, NULL); + INSERT INTO t33 VALUES(2, NULL); + INSERT INTO t33 VALUES(2, NULL); +@@ -920,13 +920,13 @@ + INSERT INTO t31(a) VALUES(6), (0); + SELECT * FROM t31; + a b +-3 0 +-1 1 +-2 2 +-4 3 +-5 4 +-6 5 + 0 6 ++6 5 ++5 4 ++4 3 ++2 2 ++1 1 ++3 0 + DROP TABLE t31; + set SQL_MODE = NO_AUTO_VALUE_ON_ZERO; + DELETE FROM t30 WHERE a = 0; +@@ -965,7 +965,7 @@ + DROP TABLE t33; + CREATE TABLE t33 ( + a BIGINT NOT NULL PRIMARY KEY, +-b BIGINT NOT NULL AUTO_INCREMENT, KEY(b)) ENGINE = InnoDB; ++b BIGINT NOT NULL AUTO_INCREMENT, INDEX(b DESC)) ENGINE = InnoDB; + ALTER TABLE t33 DISCARD TABLESPACE; + restore: t33 .ibd and .cfg files + ALTER TABLE t33 IMPORT TABLESPACE; +@@ -975,7 +975,7 @@ + 4 + SELECT * FROM t33; + a b +-10 1 +-2 2 + 3 4 ++2 2 ++10 1 + DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t30, t32, t33; diff --git a/mysql-test/suite/innodb/r/autoinc_persist.result b/mysql-test/suite/innodb/r/autoinc_persist.result index ee796160406cd..9e5cd4ad23e26 100644 --- a/mysql-test/suite/innodb/r/autoinc_persist.result +++ b/mysql-test/suite/innodb/r/autoinc_persist.result @@ -242,7 +242,7 @@ DELETE FROM t9 WHERE a > 100000000000; SELECT MAX(a) AS `Expect 100000000000` FROM t9; Expect 100000000000 100000000000 -CREATE TABLE t13(a INT AUTO_INCREMENT PRIMARY KEY) ENGINE = InnoDB, +CREATE TABLE t13(a INT AUTO_INCREMENT KEY) ENGINE = InnoDB, AUTO_INCREMENT = 1234; # restart SHOW CREATE TABLE t13; @@ -250,7 +250,7 @@ Table Create Table t13 CREATE TABLE `t13` ( `a` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=1234 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=1234 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t13 VALUES(0); SELECT a AS `Expect 1234` FROM t13; Expect 1234 @@ -567,7 +567,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` smallint(6) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t3 VALUES(0); SELECT MAX(a) AS `Expect 201` FROM t3; Expect 201 @@ -580,7 +580,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` smallint(6) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=500 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=500 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t3 VALUES(0); SELECT MAX(a) AS `Expect 500` FROM t3; Expect 500 @@ -592,7 +592,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` smallint(6) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t3 VALUES(0), (0); SELECT * FROM t3; a @@ -608,7 +608,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` smallint(6) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=221 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=221 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t3 VALUES(0); SELECT MAX(a) AS `Expect 221` FROM t3; Expect 221 @@ -620,7 +620,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` smallint(6) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=120 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=120 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # MDEV-6076: Test adding an AUTO_INCREMENT COLUMN CREATE TABLE mdev6076a (b INT) ENGINE=InnoDB; INSERT INTO mdev6076a VALUES(2),(1); @@ -681,7 +681,7 @@ Table Create Table t_inplace CREATE TABLE `t_inplace` ( `a` smallint(6) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # This will keep the autoinc counter ALTER TABLE t_inplace AUTO_INCREMENT = 250, ALGORITHM = INPLACE; # We expect the counter to be 250 @@ -690,7 +690,7 @@ Table Create Table t_inplace CREATE TABLE `t_inplace` ( `a` smallint(6) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # This should keep the autoinc counter as well ALTER TABLE t_inplace ADD COLUMN b INT, ALGORITHM = INPLACE; # We expect the counter to be 250 @@ -700,7 +700,7 @@ t_inplace CREATE TABLE `t_inplace` ( `a` smallint(6) NOT NULL AUTO_INCREMENT, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DELETE FROM t_inplace WHERE a > 150; SELECT * FROM t_inplace; a b @@ -720,7 +720,7 @@ t_inplace CREATE TABLE `t_inplace` ( `a` smallint(6) NOT NULL AUTO_INCREMENT, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # This should reset the autoinc counter to the next value of # current max counter in the table, since the specified value # is smaller than the existing biggest value(50 < 123) @@ -731,7 +731,7 @@ Table Create Table t_inplace CREATE TABLE `t_inplace` ( `a` smallint(6) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t_inplace VALUES(0), (0); SELECT MAX(a) AS `Expect 124` FROM t_inplace; Expect 124 @@ -769,7 +769,7 @@ Table Create Table t_copy CREATE TABLE `t_copy` ( `a` smallint(6) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # This will keep the autoinc counter ALTER TABLE t_copy AUTO_INCREMENT = 250, ALGORITHM = COPY; # We expect the counter to be 250 @@ -778,7 +778,7 @@ Table Create Table t_copy CREATE TABLE `t_copy` ( `a` smallint(6) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # This should keep the autoinc counter as well ALTER TABLE t_copy ADD COLUMN b INT, ALGORITHM = COPY; # We expect the counter to be 250 @@ -788,7 +788,7 @@ t_copy CREATE TABLE `t_copy` ( `a` smallint(6) NOT NULL AUTO_INCREMENT, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DELETE FROM t_copy WHERE a > 150; SELECT * FROM t_copy; a b @@ -808,7 +808,7 @@ t_copy CREATE TABLE `t_copy` ( `a` smallint(6) NOT NULL AUTO_INCREMENT, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # This should reset the autoinc counter to the next value of # current max counter in the table, since the specified value # is smaller than the existing biggest value(50 < 123) @@ -819,7 +819,7 @@ Table Create Table t_copy CREATE TABLE `t_copy` ( `a` smallint(6) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t_copy VALUES(0), (0); SELECT MAX(a) AS `Expect 124` FROM t_copy; Expect 124 @@ -882,8 +882,7 @@ a b 5 4 SET SQL_MODE = 0; # Scenario 10: Rollback would not rollback the counter -CREATE TABLE t32 ( -a BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +CREATE TABLE t32 (a BIGINT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t32 VALUES(0), (0); # Ensure that all changes before the server is killed are persisted. set global innodb_flush_log_at_trx_commit=1; @@ -898,8 +897,7 @@ ROLLBACK; # increasing the counter CREATE TABLE t33 ( a BIGINT NOT NULL PRIMARY KEY, -b BIGINT NOT NULL AUTO_INCREMENT, -KEY(b)) ENGINE = InnoDB; +b BIGINT NOT NULL AUTO_INCREMENT, KEY(b)) ENGINE = InnoDB; INSERT INTO t33 VALUES(1, NULL); INSERT INTO t33 VALUES(2, NULL); INSERT INTO t33 VALUES(2, NULL); @@ -967,8 +965,7 @@ UNLOCK TABLES; DROP TABLE t33; CREATE TABLE t33 ( a BIGINT NOT NULL PRIMARY KEY, -b BIGINT NOT NULL AUTO_INCREMENT, -KEY(b)) ENGINE = InnoDB; +b BIGINT NOT NULL AUTO_INCREMENT, KEY(b)) ENGINE = InnoDB; ALTER TABLE t33 DISCARD TABLESPACE; restore: t33 .ibd and .cfg files ALTER TABLE t33 IMPORT TABLESPACE; diff --git a/mysql-test/suite/innodb/r/blob_cmp_empty.result b/mysql-test/suite/innodb/r/blob_cmp_empty.result new file mode 100644 index 0000000000000..24ae8e1c01e93 --- /dev/null +++ b/mysql-test/suite/innodb/r/blob_cmp_empty.result @@ -0,0 +1,19 @@ +connect prevent_purge,localhost,root,,; +start transaction with consistent snapshot; +connection default; +SET @fill_amount = (@@innodb_page_size / 2 ) + 1; +CREATE TABLE t1 (col_text TEXT NOT NULL, KEY (col_text(9))) ENGINE=InnoDB; +INSERT INTO t1 (col_text) VALUES (REPEAT('x', @fill_amount)); +UPDATE t1 SET col_text=''; +UPDATE t1 SET col_text=REPEAT('y', @fill_amount); +connect con1,localhost,root,,; +SET @fill_amount = (@@innodb_page_size / 2 ) + 1; +BEGIN; +INSERT INTO t1 (col_text) VALUES (REPEAT('z', @fill_amount)); +connection default; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +disconnect con1; +disconnect prevent_purge; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/blob_unique2pk.result b/mysql-test/suite/innodb/r/blob_unique2pk.result index 57953dc86246c..c2c3241381e94 100644 --- a/mysql-test/suite/innodb/r/blob_unique2pk.result +++ b/mysql-test/suite/innodb/r/blob_unique2pk.result @@ -8,7 +8,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` tinyblob NOT NULL, UNIQUE KEY `f1` (`f1`(255)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (f1 point not null) engine=innodb; alter table t1 add unique index (f1); diff --git a/mysql-test/suite/innodb/r/change_column_collation.result b/mysql-test/suite/innodb/r/change_column_collation.result new file mode 100644 index 0000000000000..132a57a52db10 --- /dev/null +++ b/mysql-test/suite/innodb/r/change_column_collation.result @@ -0,0 +1,136 @@ +# +# MDEV-26294 Duplicate entries in unique index not detected when +# changing collation with INPLACE algorithm +# +SET NAMES utf8; +CREATE TABLE t1 ( +id INT PRIMARY KEY, +msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_swedish_ci UNIQUE +) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 'aaa'); +INSERT INTO t1 VALUES (2, 'ååå'); +ALTER TABLE t1 MODIFY msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci, ALGORITHM=inplace; +ERROR 23000: Duplicate entry 'NULL' for key 'msg' +DROP TABLE t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY, +msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin, +id_2 INT not null, +unique index(msg, id_2) +) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 'aaa', 2); +INSERT INTO t1 VALUES (2, 'AAA', 3); +ALTER TABLE t1 MODIFY msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci, ALGORITHM=inplace; +DROP TABLE t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY, +msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin, +unique index(msg) +) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 'aaa'); +INSERT INTO t1 VALUES (2, 'bbb'); +INSERT INTO t1 VALUES (3, 'ccc'); +SET DEBUG_SYNC = 'RESET'; +SET DEBUG_SYNC = 'row_log_apply_before SIGNAL before_apply WAIT_FOR go_ahead'; +ALTER TABLE t1 MODIFY msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci, ALGORITHM=NOCOPY; +connect con1,localhost,root,,; +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR before_apply'; +INSERT INTO t1 VALUES (4, 'AAA'); +UPDATE t1 set msg = "ddd" where id = 2; +DELETE FROM t1 WHERE id= 3; +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +ERROR 23000: Duplicate entry 'NULL' for key 'msg' +SET DEBUG_SYNC = 'RESET'; +SELECT * FROM t1; +id msg +4 AAA +1 aaa +2 ddd +DROP TABLE t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY, +f1 INT NOT NULL, +f2 INT NOT NULL, +f3 INT NOT NULL, +msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin, +msg_1 VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin, +unique index(f1, msg, f2, msg_1, f3), +unique index(f1, msg_1, f2, msg, f3), +unique index(f1, msg, f3, msg_1, f2), +unique index(f1, msg_1, f3, msg, f2), +unique index(f2, msg_1, f1, msg, f3), +unique index(f2, msg, f3, msg_1, f1), +unique index(f3, f2, msg, msg_1, f1), +unique index(f3, msg, msg_1, f1, f2) +) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 1, 1, 1, 'aaa', 'aaa'); +SET DEBUG_DBUG="+d,create_index_fail"; +SET DEBUG_SYNC="innodb_inplace_alter_table_enter SIGNAL con1_go WAIT_FOR alter_signal"; +ALTER TABLE t1 MODIFY msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci, MODIFY msg_1 VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci, ALGORITHM=NOCOPY; +connection con1; +SET DEBUG_SYNC="now WAIT_FOR con1_go"; +BEGIN; +SELECT * FROM t1; +id f1 f2 f3 msg msg_1 +1 1 1 1 aaa aaa +SET DEBUG_SYNC="now SIGNAL alter_signal"; +connection default; +ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +connection con1; +rollback; +INSERT INTO t1 VALUES(2, 2, 2, 2, 'bbb', 'bbb'); +disconnect con1; +connection default; +SET DEBUG_SYNC=reset; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + `f3` int(11) NOT NULL, + `msg` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, + `msg_1` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `f1` (`f1`,`msg`,`f2`,`msg_1`,`f3`), + UNIQUE KEY `f1_2` (`f1`,`msg_1`,`f2`,`msg`,`f3`), + UNIQUE KEY `f1_3` (`f1`,`msg`,`f3`,`msg_1`,`f2`), + UNIQUE KEY `f1_4` (`f1`,`msg_1`,`f3`,`msg`,`f2`), + UNIQUE KEY `f2` (`f2`,`msg_1`,`f1`,`msg`,`f3`), + UNIQUE KEY `f2_2` (`f2`,`msg`,`f3`,`msg_1`,`f1`), + UNIQUE KEY `f3` (`f3`,`f2`,`msg`,`msg_1`,`f1`), + UNIQUE KEY `f3_2` (`f3`,`msg`,`msg_1`,`f1`,`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES(3, 3, 3, 3, 'ccc', 'ccc'); +DROP TABLE t1; +CREATE TABLE t1(id INT PRIMARY KEY, msg VARCHAR(100), +msg_1 VARCHAR(100) AS (msg) VIRTUAL, +msg_2 VARCHAR(100) AS (msg) STORED, +UNIQUE(msg), UNIQUE(msg_1), +UNIQUE(msg_2))ENGINE=InnoDB; +ALTER TABLE t1 MODIFY msg_1 VARCHAR(100) CHARACTER SET utf8 +COLLATE utf8_unicode_ci, ALGORITHM=inplace; +ERROR HY000: This is not yet supported for generated columns +ALTER TABLE t1 MODIFY msg_2 VARCHAR(100) CHARACTER SET utf8 +COLLATE utf8_unicode_ci, ALGORITHM=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +DROP TABLE t1; +# +# MDEV-29314 Assertion `n_fields > n_cols' failed +# in dict_index_t::init_change_cols +# +CREATE TABLE t (a VARCHAR(16) COLLATE utf8_bin, +FULLTEXT (a)) ENGINE=InnoDB COLLATE utf8_unicode_520_ci; +ALTER TABLE t MODIFY COLUMN a VARCHAR(512); +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` varchar(512) DEFAULT NULL, + FULLTEXT KEY `a` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_520_ci +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff index 6cf0fdf415945..44446602b9f05 100644 --- a/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff +++ b/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff @@ -1,18 +1,18 @@ ---- check_ibd_filesize.result -+++ check_ibd_filesize.result,32k +--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530 ++++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:29:25.129637040 +0530 @@ -3,18 +3,12 @@ # SPACE IN 5.7 THAN IN 5.6 # CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; --# bytes: 98304 -+# bytes: 196608 +-# bytes: 65536 ++# bytes: 131072 INSERT INTO t1 SELECT * FROM seq_1_to_25000; -# bytes: 9437184 +# bytes: 786432 DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB; --# bytes: 98304 -+# bytes: 196608 +-# bytes: 65536 ++# bytes: 131072 INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; -# bytes: 4194304 -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff index 52cd683275543..ef55ad971fe79 100644 --- a/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff +++ b/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff @@ -1,17 +1,17 @@ ---- check_ibd_filesize.result -+++ check_ibd_filesize.result,4k +--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530 ++++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:31:39.288769153 +0530 @@ -3,18 +3,18 @@ # SPACE IN 5.7 THAN IN 5.6 # CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; --# bytes: 98304 -+# bytes: 24576 +-# bytes: 65536 ++# bytes: 16384 INSERT INTO t1 SELECT * FROM seq_1_to_25000; # bytes: 9437184 DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB; --# bytes: 98304 -+# bytes: 24576 +-# bytes: 65536 ++# bytes: 16384 INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; # bytes: 4194304 DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff index 23d9fbe608f03..bcdcea3116060 100644 --- a/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff +++ b/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff @@ -1,18 +1,18 @@ ---- check_ibd_filesize.result -+++ check_ibd_filesize.result,64k +--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530 ++++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:30:28.957174270 +0530 @@ -3,18 +3,12 @@ # SPACE IN 5.7 THAN IN 5.6 # CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; --# bytes: 98304 -+# bytes: 393216 +-# bytes: 65536 ++# bytes: 262144 INSERT INTO t1 SELECT * FROM seq_1_to_25000; -# bytes: 9437184 +# bytes: 983040 DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB; --# bytes: 98304 -+# bytes: 393216 +-# bytes: 65536 ++# bytes: 262144 INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; -# bytes: 4194304 -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff index 17936a3def94f..7b699ef4cea45 100644 --- a/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff +++ b/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff @@ -1,17 +1,17 @@ ---- check_ibd_filesize.result -+++ check_ibd_filesize.result,8k +--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530 ++++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:31:03.516962339 +0530 @@ -3,18 +3,18 @@ # SPACE IN 5.7 THAN IN 5.6 # CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; --# bytes: 98304 -+# bytes: 49152 +-# bytes: 65536 ++# bytes: 32768 INSERT INTO t1 SELECT * FROM seq_1_to_25000; # bytes: 9437184 DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB; --# bytes: 98304 -+# bytes: 49152 +-# bytes: 65536 ++# bytes: 32768 INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; # bytes: 4194304 DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize.result b/mysql-test/suite/innodb/r/check_ibd_filesize.result index a6f5fbd938797..0d224d6ac5fd1 100644 --- a/mysql-test/suite/innodb/r/check_ibd_filesize.result +++ b/mysql-test/suite/innodb/r/check_ibd_filesize.result @@ -3,12 +3,12 @@ # SPACE IN 5.7 THAN IN 5.6 # CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; -# bytes: 98304 +# bytes: 65536 INSERT INTO t1 SELECT * FROM seq_1_to_25000; # bytes: 9437184 DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB; -# bytes: 98304 +# bytes: 65536 INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; # bytes: 4194304 DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/create-index-debug.result b/mysql-test/suite/innodb/r/create-index-debug.result deleted file mode 100644 index 9d266c68af335..0000000000000 --- a/mysql-test/suite/innodb/r/create-index-debug.result +++ /dev/null @@ -1,23 +0,0 @@ -SET @saved_debug_dbug = @@SESSION.debug_dbug; -# -#BUG#21326304 INNODB ONLINE ALTER TABLE ENDS IN CRASH ON DISK FULL -# -CREATE TABLE t1(f1 CHAR(255) NOT NULL, f2 CHAR(255) NOT NULL, f3 -CHAR(255) NOT NULL, f4 CHAR(255) NOT NULL, f5 CHAR(255) NOT NULL,f6 -CHAR(255) NOT NULL, f7 CHAR(255) NOT NULL, f8 CHAR(255) NOT NULL,f9 -CHAR(255) NOT NULL, f10 CHAR(255) NOT NULL, f11 CHAR(255) NOT NULL,f12 -CHAR(255) NOT NULL, f13 CHAR(255) NOT NULL, f14 CHAR(255) NOT NULL,f15 -CHAR(255) NOT NULL, f16 CHAR(255) NOT NULL, f17 CHAR(255) NOT NULL,f18 -CHAR(255) NOT NULL) -ENGINE=INNODB ROW_FORMAT=DYNAMIC; -INSERT INTO t1 -VALUES('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r'); -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -SET debug_dbug = '+d,disk_is_full'; -ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; -ERROR HY000: The table 't1' is full -SET debug_dbug= @saved_debug_dbug; -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/cursor-restore-locking.result b/mysql-test/suite/innodb/r/cursor-restore-locking.result new file mode 100644 index 0000000000000..48263151ceb65 --- /dev/null +++ b/mysql-test/suite/innodb/r/cursor-restore-locking.result @@ -0,0 +1,40 @@ +SET @save_freq=@@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; +CREATE TABLE t (a int PRIMARY KEY, b int NOT NULL UNIQUE) engine = InnoDB; +InnoDB 0 transactions not purged +connect prevent_purge,localhost,root,,; +start transaction with consistent snapshot; +connect con_del_1,localhost,root,,; +INSERT INTO t VALUES (20,20); +SET DEBUG_SYNC = 'innodb_row_search_for_mysql_exit SIGNAL first_del_row_search_mvcc_finished WAIT_FOR first_del_cont'; +DELETE FROM t WHERE b = 20; +connect con_ins_1,localhost,root,,; +SET DEBUG_SYNC = 'now WAIT_FOR first_del_row_search_mvcc_finished'; +SET DEBUG_SYNC = 'lock_wait_start SIGNAL first_ins_locked'; +SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL first_ins_row_inserted WAIT_FOR first_ins_cont'; +INSERT INTO t VALUES(10, 20); +connect con_del_2,localhost,root,,; +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +SET DEBUG_SYNC = 'now WAIT_FOR first_ins_locked'; +SET DEBUG_SYNC = 'lock_wait_start SIGNAL second_del_locked'; +DELETE FROM t WHERE b = 20; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR second_del_locked'; +SET DEBUG_SYNC = 'now SIGNAL first_del_cont'; +SET DEBUG_SYNC = 'now WAIT_FOR first_ins_row_inserted'; +connection con_del_1; +connection default; +disconnect prevent_purge; +InnoDB 0 transactions not purged +SET DEBUG_SYNC = 'now SIGNAL first_ins_cont'; +connection con_del_2; +connection con_ins_1; +connection default; +INSERT INTO t VALUES(30, 20); +disconnect con_ins_1; +disconnect con_del_1; +disconnect con_del_2; +connection default; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t; +SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_freq; diff --git a/mysql-test/suite/innodb/r/deadlock_in_subqueries_join.result b/mysql-test/suite/innodb/r/deadlock_in_subqueries_join.result new file mode 100644 index 0000000000000..2e82b0662f81c --- /dev/null +++ b/mysql-test/suite/innodb/r/deadlock_in_subqueries_join.result @@ -0,0 +1,50 @@ +CREATE TABLE t1 ( +pkey int NOT NULL PRIMARY KEY, +c int +) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1,1); +CREATE TABLE t2 ( +pkey int NOT NULL PRIMARY KEY, +c int +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t2 VALUES (2, NULL); +CREATE TABLE t3 (c int) engine = InnoDB; +INSERT INTO t3 VALUES (10), (20), (30), (40), (50); +connect con1, localhost,root,,; +connection default; +START TRANSACTION; +UPDATE t3 SET c=c+1000; +SELECT * FROM t1 FOR UPDATE; +pkey c +1 1 +connection con1; +START TRANSACTION; +DELETE FROM t2 WHERE c NOT IN (SELECT ref_0.pkey FROM t1 AS ref_0 INNER JOIN t1 AS ref_1 ON ref_0.c = ref_0.pkey); +connection default; +SELECT * FROM t2 FOR UPDATE; +pkey c +2 NULL +COMMIT; +connection con1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +COMMIT; +connection default; +START TRANSACTION; +UPDATE t3 SET c=c+1000; +SELECT * FROM t1 FOR UPDATE; +pkey c +1 1 +connection con1; +START TRANSACTION; +UPDATE t2 SET pkey=pkey+10 WHERE c NOT IN (SELECT ref_0.pkey FROM t1 AS ref_0 INNER JOIN t1 AS ref_1 ON ref_0.c = ref_0.pkey); +connection default; +SELECT * FROM t2 FOR UPDATE; +pkey c +2 NULL +COMMIT; +connection con1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +COMMIT; +disconnect con1; +connection default; +DROP TABLE t1,t2,t3; diff --git a/mysql-test/suite/innodb/r/deadlock_victim_race.result b/mysql-test/suite/innodb/r/deadlock_victim_race.result new file mode 100644 index 0000000000000..061edc775f048 --- /dev/null +++ b/mysql-test/suite/innodb/r/deadlock_victim_race.result @@ -0,0 +1,46 @@ +connect cancel_purge,localhost,root,,; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB; +CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB; +INSERT INTO t VALUES (10, 10), (20, 20), (30, 30); +INSERT INTO t2 VALUES (10), (20), (30); +BEGIN; +SELECT * FROM t WHERE a = 20 FOR UPDATE; +a b +20 20 +connect con_2,localhost,root,,; +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +SET DEBUG_SYNC = 'lock_trx_handle_wait_enter SIGNAL upd_locked WAIT_FOR upd_cont EXECUTE 2'; +UPDATE t SET b = 100; +connect con_3,localhost,root,,; +BEGIN; +UPDATE t2 SET a = a + 100; +SELECT * FROM t WHERE a = 30 FOR UPDATE; +a b +30 30 +SET DEBUG_SYNC='now WAIT_FOR upd_locked'; +SET DEBUG_SYNC = 'lock_wait_start SIGNAL sel_locked'; +SELECT * FROM t WHERE a = 20 FOR UPDATE; +connection default; +SET DEBUG_SYNC='now WAIT_FOR sel_locked'; +ROLLBACK; +SET DEBUG_SYNC='now SIGNAL upd_cont'; +SET DEBUG_SYNC="now WAIT_FOR upd_locked"; +SET SESSION innodb_lock_wait_timeout=1; +SELECT * FROM t WHERE a = 10 FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET DEBUG_SYNC="now SIGNAL upd_cont"; +connection con_3; +a b +20 20 +connection con_2; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +disconnect con_3; +disconnect con_2; +connection default; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t; +DROP TABLE t2; +disconnect cancel_purge; diff --git a/mysql-test/suite/innodb/r/deadlock_wait_lock_race.result b/mysql-test/suite/innodb/r/deadlock_wait_lock_race.result new file mode 100644 index 0000000000000..874f5af47d029 --- /dev/null +++ b/mysql-test/suite/innodb/r/deadlock_wait_lock_race.result @@ -0,0 +1,27 @@ +CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB STATS_PERSISTENT=0; +CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB STATS_PERSISTENT=0; +INSERT INTO t VALUES (10, 10), (20, 20), (30, 30); +INSERT INTO t2 VALUES (10), (20), (30); +BEGIN; +UPDATE t2 SET a = a + 100; +SELECT * FROM t WHERE a = 20 FOR UPDATE; +a b +20 20 +connect con_2,localhost,root,,; +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +SET DEBUG_SYNC = 'lock_trx_handle_wait_before_unlocked_wait_lock_check SIGNAL upd_locked WAIT_FOR upd_cont'; +UPDATE t SET b = 100; +connection default; +SET DEBUG_SYNC="now WAIT_FOR upd_locked"; +SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL upd_cont"; +SELECT * FROM t WHERE a = 10 FOR UPDATE; +connection con_2; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +disconnect con_2; +connection default; +a b +10 10 +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t; +DROP TABLE t2; diff --git a/mysql-test/suite/innodb/r/deadlock_wait_thr_race.result b/mysql-test/suite/innodb/r/deadlock_wait_thr_race.result new file mode 100644 index 0000000000000..6992a447c071b --- /dev/null +++ b/mysql-test/suite/innodb/r/deadlock_wait_thr_race.result @@ -0,0 +1,33 @@ +CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB STATS_PERSISTENT=0; +CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB STATS_PERSISTENT=0; +INSERT INTO t VALUES (10, 10), (20, 20), (30, 30); +INSERT INTO t2 VALUES (10), (20), (30); +BEGIN; +UPDATE t2 SET a = a + 100; +SELECT * FROM t WHERE a = 20 FOR UPDATE; +a b +20 20 +connect con_2,localhost,root,,; +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +SET DEBUG_SYNC = 'lock_trx_handle_wait_enter SIGNAL upd_locked WAIT_FOR upd_cont'; +SET DEBUG_SYNC = 'trx_t_release_locks_enter SIGNAL sel_cont WAIT_FOR upd_cont_2'; +BEGIN; +UPDATE t SET b = 100; +connection default; +SET DEBUG_SYNC="now WAIT_FOR upd_locked"; +SET DEBUG_SYNC="deadlock_report_before_lock_releasing SIGNAL upd_cont WAIT_FOR sel_cont"; +SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL sel_before_suspend"; +SELECT * FROM t WHERE a = 10 FOR UPDATE;; +connect con_3,localhost,root,,; +SET DEBUG_SYNC="now WAIT_FOR sel_before_suspend"; +SET DEBUG_SYNC="now SIGNAL upd_cont_2"; +disconnect con_3; +connection con_2; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +disconnect con_2; +connection default; +a b +10 10 +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t; +DROP TABLE t2; diff --git a/mysql-test/suite/innodb/r/default_row_format_alter.result b/mysql-test/suite/innodb/r/default_row_format_alter.result index 42cbab8a5f2a2..33936b5900398 100644 --- a/mysql-test/suite/innodb/r/default_row_format_alter.result +++ b/mysql-test/suite/innodb/r/default_row_format_alter.result @@ -129,5 +129,25 @@ SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; ROW_FORMAT Dynamic DROP TABLE t1; +# +# MDEV-31025 Redundant table alter fails when fixed column +# stored externally +# +set @old_sql_mode = @@sql_mode; +SET @@sql_mode=''; +CREATE TABLE t1(pk INT,c CHAR(255),c2 CHAR(255),c3 CHAR(255), +c4 char(255), c5 char(255), c6 char(255), +c7 char(255), c8 char(255), primary key(pk) +)Engine=InnoDB character set utf32 ROW_FORMAT=REDUNDANT; +INSERT INTO t1(pk, c) VALUES (1, repeat('a', 255)); +ALTER TABLE t1 FORCE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT LENGTH(c) FROM t1; +LENGTH(c) +1020 +DROP TABLE t1; +set @@sql_mode = @old_sql_mode; # End of 10.4 tests SET GLOBAL innodb_default_row_format = @row_format; diff --git a/mysql-test/suite/innodb/r/default_row_format_create.result b/mysql-test/suite/innodb/r/default_row_format_create.result index 50adc757b626a..a1334101b6105 100644 --- a/mysql-test/suite/innodb/r/default_row_format_create.result +++ b/mysql-test/suite/innodb/r/default_row_format_create.result @@ -58,10 +58,13 @@ CREATE TABLE t(c INT) ENGINE=InnoDB page_compressed=1; DROP TABLE IF EXISTS t; SET GLOBAL innodb_compression_level=1; CREATE TABLE t(a INT)ENGINE=InnoDB ROW_FORMAT=DYNAMIC page_compressed=1; +CREATE TEMPORARY TABLE tt(a INT PRIMARY KEY) +ROW_FORMAT=DYNAMIC page_compressed=1 ENGINE=InnoDB; SET GLOBAL innodb_compression_level=0; ALTER TABLE t FORCE, ROW_FORMAT=DEFAULT, ALGORITHM=INPLACE; ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'PAGE_COMPRESSED' ALTER TABLE t FORCE, ROW_FORMAT=DEFAULT, ALGORITHM=COPY; ERROR HY000: Can't create table `test`.`t` (errno: 140 "Wrong create options") DROP TABLE t; +TRUNCATE tt; SET GLOBAL innodb_compression_level=@save_level; diff --git a/mysql-test/suite/innodb/r/dml_purge.result b/mysql-test/suite/innodb/r/dml_purge.result index 95330b80d3343..38273d571c004 100644 --- a/mysql-test/suite/innodb/r/dml_purge.result +++ b/mysql-test/suite/innodb/r/dml_purge.result @@ -7,6 +7,7 @@ SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; CREATE TABLE t1(a INT PRIMARY KEY, b INT NOT NULL) ROW_FORMAT=REDUNDANT ENGINE=InnoDB; +InnoDB 0 transactions not purged connect prevent_purge,localhost,root; START TRANSACTION WITH CONSISTENT SNAPSHOT; connection default; @@ -19,7 +20,11 @@ UPDATE t1 SET b=4 WHERE a=3; disconnect prevent_purge; connection default; InnoDB 0 transactions not purged +connection con1; +ROLLBACK; disconnect con1; +connection default; +InnoDB 0 transactions not purged FLUSH TABLE t1 FOR EXPORT; Clustered index root page contents: N_RECS=3; LEVEL=0 diff --git a/mysql-test/suite/innodb/r/dropdb_cs.result b/mysql-test/suite/innodb/r/dropdb_cs.result new file mode 100644 index 0000000000000..59f02c74a049d --- /dev/null +++ b/mysql-test/suite/innodb/r/dropdb_cs.result @@ -0,0 +1,16 @@ +# +# MDEV-28802 DROP DATABASE in InnoDB still is case-insensitive +# +SET @save_fpt=@@GLOBAL.innodb_file_per_table; +SET GLOBAL innodb_file_per_table=0; +CREATE DATABASE Db; +CREATE TABLE Db.t1 (c1 INT KEY) ENGINE=InnoDB; +CREATE DATABASE DB; +DROP DATABASE DB; +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'D%'; +NAME +Db/t1 +DROP DATABASE Db; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'D%'; +TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE +SET GLOBAL innodb_file_per_table=@save_fpt; diff --git a/mysql-test/suite/innodb/r/file_format_defaults.result b/mysql-test/suite/innodb/r/file_format_defaults.result index ab4d72258a5c7..ee30b09dabf7d 100644 --- a/mysql-test/suite/innodb/r/file_format_defaults.result +++ b/mysql-test/suite/innodb/r/file_format_defaults.result @@ -14,7 +14,7 @@ Table Create Table tab0 CREATE TABLE `tab0` ( `c1` varchar(65530) DEFAULT NULL, KEY `c1` (`c1`(3072)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED DROP TABLE tab0; CREATE TABLE tab0 (c1 VARCHAR(65530), KEY(c1(3073))) ENGINE=InnoDB KEY_BLOCK_SIZE=2; ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. diff --git a/mysql-test/suite/innodb/r/foreign-keys.result b/mysql-test/suite/innodb/r/foreign-keys.result index 45177a4bddf26..503825dbeeef4 100644 --- a/mysql-test/suite/innodb/r/foreign-keys.result +++ b/mysql-test/suite/innodb/r/foreign-keys.result @@ -76,7 +76,7 @@ t2 CREATE TABLE `t2` ( `f2` int(11) NOT NULL, PRIMARY KEY (`f2`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci disconnect con1; connection default; select * from t2 where f2 not in (select f1 from t1); @@ -207,7 +207,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -215,7 +215,7 @@ t2 CREATE TABLE `t2` ( `fid` int(11) NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `fk_fid` FOREIGN KEY (`fid`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1,t2; ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails drop table t1,t2; diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result index 2ccdfe20d0e92..acf021db22c08 100644 --- a/mysql-test/suite/innodb/r/foreign_key.result +++ b/mysql-test/suite/innodb/r/foreign_key.result @@ -39,7 +39,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL, KEY `idx` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -48,7 +48,7 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`a`), KEY `ind` (`b`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1, 80); INSERT INTO t1 VALUES (2, 81); INSERT INTO t1 VALUES (3, 82); @@ -137,7 +137,34 @@ SELECT unique_constraint_name FROM information_schema.referential_constraints WHERE table_name = 't2'; unique_constraint_name PRIMARY +# +# MDEV-28317 Assertion failure on rollback of FOREIGN KEY operation +# +SET foreign_key_checks=0; +CREATE TABLE parent(a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE child(a INT,FOREIGN KEY(a) REFERENCES parent(a) ON DELETE CASCADE) +ENGINE=InnoDB; +INSERT INTO child VALUES(1); +ALTER TABLE child DROP INDEX a; +connect incomplete, localhost, root,,; +BEGIN; +DELETE FROM child; +connection default; +INSERT INTO parent SET a=0; +FLUSH TABLES; # restart +disconnect incomplete; +INSERT INTO child SET a=0; +INSERT INTO child SET a=1; +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON DELETE CASCADE) +DELETE FROM parent; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON DELETE CASCADE) +ALTER TABLE child ADD INDEX(a); +DELETE FROM parent; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON DELETE CASCADE) +ALTER TABLE child FORCE; +DELETE FROM parent; +DROP TABLE child,parent; SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; SELECT unique_constraint_name FROM information_schema.referential_constraints @@ -191,7 +218,7 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`a`), FULLTEXT KEY `b` (`b`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t1` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP DATABASE best; # # MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check hangs @@ -526,7 +553,7 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`id`), KEY `ref_id` (`ref_id`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`ref_id`) REFERENCES `t1` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection con1; BEGIN; UPDATE t2 SET f = 11 WHERE id = 1; @@ -656,9 +683,9 @@ START TRANSACTION WITH CONSISTENT SNAPSHOT; connection default; DELETE IGNORE FROM t1 WHERE b = 1; Warnings: -Warning 152 InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 20. Please drop extra constraints and try again +Warning 152 InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 15. Please drop extra constraints and try again Warning 1296 Got error 193 '`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`b`) ON DELETE CASCADE' from InnoDB -Warning 152 InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 20. Please drop extra constraints and try again +Warning 152 InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 15. Please drop extra constraints and try again Warning 1296 Got error 193 '`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`b`) ON DELETE CASCADE' from InnoDB SELECT a FROM t1 FORCE INDEX(a); a @@ -748,7 +775,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -756,7 +783,7 @@ t2 CREATE TABLE `t2` ( `fid` int(11) NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `fk_fid` FOREIGN KEY (`fid`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1,t2; ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails drop table t1,t2; @@ -783,7 +810,7 @@ t2 CREATE TABLE `t2` ( `f2` int(11) NOT NULL, `f3` int(11) NOT NULL, PRIMARY KEY (`f3`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 (f1 INT NOT NULL)ENGINE=InnoDB; ERROR 42S01: Table 't2' already exists DROP TABLE t2, t1; @@ -809,7 +836,40 @@ ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint Parsing foreign keys 3... ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") Parsing foreign keys 4... +# +# MDEV-27583 InnoDB uses different constants for FK cascade +# error message in SQL vs error log +# +CREATE TABLE t1 +(a INT, b INT, KEY(b), +CONSTRAINT FOREIGN KEY (a) REFERENCES t1 (b) ON DELETE CASCADE) +ENGINE=InnoDB; +INSERT INTO t1 (a,b) VALUES +(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0), +(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,1),(1,0); +DELETE FROM t1 WHERE b = 1; +ERROR HY000: Got error 193 '`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`b`) ON DELETE CASCADE' from InnoDB +SHOW WARNINGS; +Level Code Message +Warning 152 InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 15. Please drop extra constraints and try again +Error 1296 Got error 193 '`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`b`) ON DELETE CASCADE' from InnoDB +DROP TABLE t1; +FOUND 1 /InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 15.*/ in mysqld.1.err # End of 10.2 tests +# +# MDEV-28980 InnoDB: Failing assertion: len <= MAX_TABLE_NAME_LEN +# +SET NAMES utf8; +CREATE TABLE t (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE DATABASE `db`; +CREATE TABLE `db`.u ( +a INT PRIMARY KEY, +CONSTRAINT `††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††` + FOREIGN KEY (a) REFERENCES test.t (a)) ENGINE=InnoDB; +DROP TABLE `db`.u; +DROP DATABASE `db`; +DROP TABLE t; +# End of 10.3 tests CREATE TABLE t1 (a GEOMETRY, INDEX(a(8)), FOREIGN KEY (a) REFERENCES x (xx)) ENGINE=InnoDB; ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") @@ -842,7 +902,7 @@ t2 CREATE TABLE `t2` ( KEY `fk` (`y`), CONSTRAINT `fk` FOREIGN KEY (`y`) REFERENCES `t1` (`y`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`x`) REFERENCES `t1` (`x`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t3 (z int); alter table t3 add x int references t1(x), add y int constraint fk2 references t1(y); show create table t3; @@ -855,7 +915,7 @@ t3 CREATE TABLE `t3` ( KEY `fk2` (`y`), CONSTRAINT `fk2` FOREIGN KEY (`y`) REFERENCES `t1` (`y`), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`x`) REFERENCES `t1` (`x`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop tables t3, t2, t1; create table t1 (id int primary key); create table t2 (id2 int references t1); @@ -867,7 +927,7 @@ t2 CREATE TABLE `t2` ( `id` int(11) DEFAULT NULL, KEY `id` (`id`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop tables t2, t1; set default_storage_engine= default; # @@ -884,6 +944,8 @@ DROP TABLE t1; # # TODO: enable them after MDEV-16417 is finished create or replace table t1 (a int primary key) engine=innodb; +create or replace table t2 (a int, constraint foo check(a > 0), foreign key(a) references t1(a) on update cascade) engine=innodb; +ERROR HY000: Function or expression 'a' cannot be used in the CHECK clause of `foo` create or replace table t2 (a int, check(a > 0), foreign key(a) references t1(a) on update cascade) engine=innodb; ERROR HY000: Function or expression 'a' cannot be used in the CHECK clause of `CONSTRAINT_1` create or replace table t1 (f1 int, f2 date, f3 date, key(f1,f3,f2)) engine=innodb; @@ -918,7 +980,7 @@ t2 CREATE TABLE `t2` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop tables t2, t1; # End of 10.5 tests # @@ -941,11 +1003,30 @@ ALTER TABLE parent FORCE, ALGORITHM=INPLACE; ERROR HY000: Lock wait timeout exceeded; try restarting transaction ALTER TABLE parent ADD COLUMN b INT, ALGORITHM=INSTANT; ERROR HY000: Lock wait timeout exceeded; try restarting transaction -disconnect con1; +connection con1; +COMMIT; +connection default; SET innodb_lock_wait_timeout=DEFAULT; TRUNCATE TABLE parent; ALTER TABLE parent FORCE, ALGORITHM=COPY; ALTER TABLE parent FORCE, ALGORITHM=INPLACE; ALTER TABLE parent ADD COLUMN b INT, ALGORITHM=INSTANT; DROP TABLE child, parent; +# +# MDEV-26217 Failing assertion: list.count > 0 in ut_list_remove +# or Assertion `lock->trx == this' failed in dberr_t trx_t::drop_table +# +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 (pk INT PRIMARY KEY, FOREIGN KEY(pk) REFERENCES t1(pk)) +ENGINE=InnoDB; +connection con1; +SET FOREIGN_KEY_CHECKS=OFF; +CREATE OR REPLACE TABLE t1 (b INT) ENGINE=InnoDB; +connection default; +INSERT INTO t2 VALUES (1); +connection con1; +disconnect con1; +connection default; +DROP TABLE IF EXISTS t2, t1; # End of 10.6 tests diff --git a/mysql-test/suite/innodb/r/foreign_key_debug.result b/mysql-test/suite/innodb/r/foreign_key_debug.result index 10a7e6f36e924..a2b0673608181 100644 --- a/mysql-test/suite/innodb/r/foreign_key_debug.result +++ b/mysql-test/suite/innodb/r/foreign_key_debug.result @@ -23,7 +23,7 @@ t2 CREATE TABLE `t2` ( `f2` int(11) NOT NULL, PRIMARY KEY (`f2`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci disconnect con1; connection default; select * from t2 where f2 not in (select f1 from t1); diff --git a/mysql-test/suite/innodb/r/foreign_key_not_windows.result b/mysql-test/suite/innodb/r/foreign_key_not_windows.result new file mode 100644 index 0000000000000..aaff06f8d6866 --- /dev/null +++ b/mysql-test/suite/innodb/r/foreign_key_not_windows.result @@ -0,0 +1,31 @@ +# +# MDEV-28980 InnoDB: Failing assertion: len <= MAX_TABLE_NAME_LEN +# +CREATE TABLE t (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE DATABASE `d255`; +CREATE TABLE `d255`.`d255` +(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB; +ERROR HY000: Long database name and identifier for object resulted in path length exceeding 512 characters. Path: './@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023/@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@ +CREATE TABLE `d255`.`_##################################################` +(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB; +ERROR HY000: Long database name and identifier for object resulted in path length exceeding 512 characters. Path: './@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023/_@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023 +CREATE TABLE `d255`.`##################################################` +(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB; +# +# MDEV-29258 Failing assertion for name length on RENAME TABLE +# +CREATE TABLE `d255`.`d245` (x INT) ENGINE=InnoDB; +DROP TABLE `d255`.`d250`; +RENAME TABLE `d250#`.`d245` TO `d250#`.`d250`; +RENAME TABLE `d255`.`d250` TO a; +DROP TABLE a,t; +# +# MDEV-29409 Buffer overflow in my_wc_mb_filename() on RENAME TABLE +# +CREATE TABLE `d255`.t(a INT PRIMARY KEY)ENGINE=InnoDB; +CREATE TABLE `d255`.u(a INT PRIMARY KEY, +CONSTRAINT `d320` FOREIGN KEY (a) REFERENCES `d255`.t (a)) ENGINE=InnoDB; +RENAME TABLE `d255`.u TO u; +DROP TABLE u; +DROP DATABASE `d255`; +# End of 10.3 tests diff --git a/mysql-test/suite/innodb/r/full_crc32_import.result b/mysql-test/suite/innodb/r/full_crc32_import.result index 677bff22d534a..32964be46d4fc 100644 --- a/mysql-test/suite/innodb/r/full_crc32_import.result +++ b/mysql-test/suite/innodb/r/full_crc32_import.result @@ -38,6 +38,8 @@ restore: t1 .ibd and .cfg files ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Internal error: Drop all secondary indexes before importing table test/t1 when .cfg file is missing. ALTER TABLE t1 DROP INDEX b; +Warnings: +Warning 1814 Tablespace has been discarded for table `t1` ALTER TABLE t1 IMPORT TABLESPACE; SHOW CREATE TABLE t1; Table Create Table @@ -46,7 +48,7 @@ t1 CREATE TABLE `t1` ( `b` blob DEFAULT NULL, `c` blob DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC UPDATE t1 set b = repeat("de", 100) where b = repeat("cd", 200); explain SELECT a FROM t1 where b = repeat("de", 100); id select_type table type possible_keys key key_len ref rows Extra @@ -116,9 +118,10 @@ restore: t1 .ibd and .cfg files ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Internal error: Drop all secondary indexes before importing table test/t1 when .cfg file is missing. ALTER TABLE t1 DROP INDEX idx1; -ALTER TABLE t1 IMPORT TABLESPACE; Warnings: Warning 1814 Tablespace has been discarded for table `t1` +ALTER TABLE t1 IMPORT TABLESPACE; +Warnings: Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t1.cfg', will attempt to import without schema verification SHOW CREATE TABLE t1; Table Create Table @@ -127,7 +130,7 @@ t1 CREATE TABLE `t1` ( `c2` point NOT NULL, `c3` linestring NOT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=16372 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=16372 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC UPDATE t1 SET C2 = ST_GeomFromText('POINT(0 0)'); SELECT COUNT(*) FROM t1; COUNT(*) @@ -174,6 +177,17 @@ UNLOCK TABLES; SET GLOBAL innodb_compression_algorithm=0; ALTER TABLE t1 FORCE; ALTER TABLE t1 DISCARD TABLESPACE; +# Display the discarded table name by using SPACE and PAGE_NO +# column in INNODB_SYS_INDEXES and discard doesn't affect the +# SPACE in INNODB_SYS_TABLES +SELECT t.NAME, t.SPACE BETWEEN 1 and 0xFFFFFFEF as SYS_TABLE_SPACE_RANGE +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t +WHERE t.TABLE_ID IN ( +SELECT i.TABLE_ID FROM +INFORMATION_SCHEMA.INNODB_SYS_INDEXES i WHERE +i.PAGE_NO IS NULL and i.SPACE IS NULL); +NAME SYS_TABLE_SPACE_RANGE +test/t1 1 db.opt t1.frm restore: t1 .ibd and .cfg files diff --git a/mysql-test/suite/innodb/r/gap_lock_split.result b/mysql-test/suite/innodb/r/gap_lock_split.result new file mode 100644 index 0000000000000..a5765cb569430 --- /dev/null +++ b/mysql-test/suite/innodb/r/gap_lock_split.result @@ -0,0 +1,28 @@ +SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; +CREATE TABLE t1(id INT PRIMARY key, val VARCHAR(16000)) ENGINE=InnoDB; +INSERT INTO t1 (id,val) SELECT 2*seq,'x' FROM seq_0_to_1023; +connect con1,localhost,root,,; +InnoDB 0 transactions not purged +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +DELETE FROM t1 WHERE id=1788; +BEGIN; +SELECT * FROM t1 WHERE id=1788 FOR UPDATE; +id val +connection con1; +COMMIT; +InnoDB 0 transactions not purged +connection default; +INSERT INTO t1 (id,val) VALUES (1787, REPEAT('x',2000)); +connection con1; +SET innodb_lock_wait_timeout=0; +INSERT INTO t1 (id,val) VALUES (1788, 'x'); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE id=1788 FOR UPDATE; +id val +disconnect con1; +connection default; +COMMIT; +DROP TABLE t1; +SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; diff --git a/mysql-test/suite/innodb/r/ibuf_delete.result b/mysql-test/suite/innodb/r/ibuf_delete.result new file mode 100644 index 0000000000000..1481fca9bf677 --- /dev/null +++ b/mysql-test/suite/innodb/r/ibuf_delete.result @@ -0,0 +1,49 @@ +SET @buffering= @@innodb_change_buffering; +SET GLOBAL innodb_change_buffering= deletes; +SET @flush= @@innodb_flush_log_at_trx_commit; +SET GLOBAL innodb_flush_log_at_trx_commit= 0; +CREATE TABLE t1 ( +a varchar(1024), +b varchar(1024), +c varchar(1024), +d varchar(1024), +e varchar(1024), +f varchar(1024), +g varchar(1024), +h varchar(1024), +key (a), +key (b), +key (c), +key (d) +) ENGINE=InnoDB; +INSERT INTO t1 +SELECT REPEAT('x',10), REPEAT('x',13), REPEAT('x',427), REPEAT('x',244), +REPEAT('x',9), REPEAT('x',112), REPEAT('x',814), REPEAT('x',633) +FROM seq_1_to_1024; +CREATE TEMPORARY TABLE t2 ( +a varchar(1024), +b varchar(1024), +c varchar(1024), +d varchar(1024), +e varchar(1024), +f varchar(1024), +g varchar(1024), +h varchar(1024), +i varchar(1024), +j varchar(1024), +k varchar(1024), +l varchar(1024), +m varchar(1024), +key (a), +key (b), +key (c), +key (d), +key (e), +key (f) +) ENGINE=InnoDB; +SET @x=REPEAT('x',512); +INSERT INTO t2 SELECT @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x +FROM seq_1_to_768; +DROP TABLE t1, t2; +SET GLOBAL innodb_change_buffering= @buffering; +SET GLOBAL innodb_flush_log_at_trx_commit= @flush; diff --git a/mysql-test/suite/innodb/r/ibuf_not_empty.result b/mysql-test/suite/innodb/r/ibuf_not_empty.result index d1b8203b063f6..dbb9814c11185 100644 --- a/mysql-test/suite/innodb/r/ibuf_not_empty.result +++ b/mysql-test/suite/innodb/r/ibuf_not_empty.result @@ -5,13 +5,14 @@ c INT, INDEX(b)) ENGINE=InnoDB STATS_PERSISTENT=0; SET GLOBAL innodb_change_buffering_debug = 1; +SET GLOBAL innodb_change_buffering=all; INSERT INTO t1 SELECT 0,'x',1 FROM seq_1_to_1024; # restart: --innodb-force-recovery=6 --innodb-change-buffer-dump check table t1; Table Op Msg_type Msg_text test.t1 check Warning InnoDB: Index 'b' contains 990 entries, should be 1024. test.t1 check error Corrupt -# restart +# restart: --innodb-force_recovery=0 SET GLOBAL innodb_fast_shutdown=0; -# restart +# restart: --innodb-force_recovery=0 DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/import_bugs.result b/mysql-test/suite/innodb/r/import_bugs.result index 14e4954e79f69..98f3e76763b8d 100644 --- a/mysql-test/suite/innodb/r/import_bugs.result +++ b/mysql-test/suite/innodb/r/import_bugs.result @@ -8,13 +8,19 @@ FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; ALTER TABLE imp_t1 IMPORT TABLESPACE; ERROR HY000: Schema mismatch (ROW_FORMAT mismatch) +CREATE TABLE imp_t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +ERROR 42S01: Table 'imp_t1' already exists +DROP TABLE imp_t1; +CREATE TABLE imp_t1 (a INT PRIMARY KEY) ENGINE=InnoDB; DROP TABLE imp_t1, t1; SET GLOBAL innodb_checksum_algorithm=@save_innodb_checksum_algorithm; # -# MDEV-27006 Assertion `!lock_trx_has_sys_table_locks(trx)' --echo # failed in dberr_t row_discard_tablespace_for_mysql +# MDEV-27006 Assertion `!lock_trx_has_sys_table_locks(trx)' +# failed in dberr_t row_discard_tablespace_for_mysql # (dict_table_t*, trx_t*) CREATE TABLE t1 (c INT KEY) ENGINE=INNODB; CREATE TABLE t2 (c INT KEY,FOREIGN KEY(c) REFERENCES t1 (c)) ENGINE=INNODB; ALTER TABLE t1 DISCARD TABLESPACE; ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails DROP TABLE t2, t1; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb/r/import_corrupted.result b/mysql-test/suite/innodb/r/import_corrupted.result index 149a48dccfe60..bc24a28f22fb7 100644 --- a/mysql-test/suite/innodb/r/import_corrupted.result +++ b/mysql-test/suite/innodb/r/import_corrupted.result @@ -1,6 +1,7 @@ call mtr.add_suppression("Table `test`.`t2` should have 2 indexes but the tablespace has 1 indexes"); call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it"); call mtr.add_suppression("Trying to read .* bytes at .* outside the bounds of the file: \\..test.t2\\.ibd"); +call mtr.add_suppression("InnoDB: File '.*test/t2\\.ibd' is corrupted"); CREATE TABLE t1 ( id INT AUTO_INCREMENT PRIMARY KEY, not_id INT, diff --git a/mysql-test/suite/innodb/r/import_tablespace_race.result b/mysql-test/suite/innodb/r/import_tablespace_race.result new file mode 100644 index 0000000000000..6c8b2e3a26e50 --- /dev/null +++ b/mysql-test/suite/innodb/r/import_tablespace_race.result @@ -0,0 +1,27 @@ +# +# MDEV-29144 ER_TABLE_SCHEMA_MISMATCH or crash on DISCARD/IMPORT +# +call mtr.add_suppression("InnoDB: Unknown index id"); +CREATE TABLE t (pk int PRIMARY KEY, c varchar(1024)) +ENGINE=InnoDB CHARSET latin1; +INSERT INTO t SELECT seq, 'x' FROM seq_1_to_100; +connect con1,localhost,root,,test; +BEGIN NOT ATOMIC +DECLARE a INT DEFAULT 0; +REPEAT +SET a= a+1; +UPDATE t SET c = 'xx' WHERE pk = a; +UNTIL a = 100 +END REPEAT; +END +$ +connection default; +ALTER TABLE t NOWAIT ADD INDEX (c); +connection con1; +connection default; +FLUSH TABLE t FOR EXPORT; +UNLOCK TABLES; +DROP TABLE t; +ALTER TABLE t DISCARD TABLESPACE; +ALTER TABLE t IMPORT TABLESPACE; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/index_merge_threshold.result b/mysql-test/suite/innodb/r/index_merge_threshold.result index 35cb82e6f1e2c..989d31e90b1c7 100644 --- a/mysql-test/suite/innodb/r/index_merge_threshold.result +++ b/mysql-test/suite/innodb/r/index_merge_threshold.result @@ -48,7 +48,7 @@ tab CREATE TABLE `tab` ( KEY `index5` (`c5`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=30', KEY `index6` (`c6`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=35', KEY `index7` (`c7`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=40' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i WHERE t.TABLE_ID = i.TABLE_ID AND t.NAME = 'test/tab'; @@ -84,7 +84,7 @@ tab CREATE TABLE `tab` ( KEY `index5` (`c5`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=30', KEY `index6` (`c6`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=35', KEY `index7` (`c7`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=40' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='MERGE_THRESHOLD=49' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='MERGE_THRESHOLD=49' SELECT t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i WHERE t.TABLE_ID = i.TABLE_ID AND t.NAME = 'test/tab'; @@ -120,7 +120,7 @@ tab CREATE TABLE `tab` ( KEY `index5` (`c5`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=30', KEY `index6` (`c6`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=35', KEY `index7` (`c7`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=40' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='MERGE_THRESHOLD=49' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='MERGE_THRESHOLD=49' SELECT t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i WHERE t.TABLE_ID = i.TABLE_ID AND t.NAME = 'test/tab'; @@ -158,7 +158,7 @@ tab CREATE TABLE `tab` ( KEY `index6` (`c6`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=35', KEY `index7` (`c7`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=40', KEY `index8` (`c7`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=45' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='MERGE_THRESHOLD=49' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='MERGE_THRESHOLD=49' SELECT t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i WHERE t.TABLE_ID = i.TABLE_ID AND t.NAME = 'test/tab'; diff --git a/mysql-test/suite/innodb/r/information_schema_grants.result b/mysql-test/suite/innodb/r/information_schema_grants.result index feadb7b8d12f5..a468081db20d9 100644 --- a/mysql-test/suite/innodb/r/information_schema_grants.result +++ b/mysql-test/suite/innodb/r/information_schema_grants.result @@ -263,6 +263,7 @@ select count(*) > -1 from d_trx; count(*) > -1 1 connection default; +SET GLOBAL innodb_max_purge_lag_wait=0; drop database test; create database test; drop user select_only@localhost; diff --git a/mysql-test/suite/innodb/r/innodb-16k.result b/mysql-test/suite/innodb/r/innodb-16k.result index 84b1eb6d3d342..d46bea183c94a 100644 --- a/mysql-test/suite/innodb/r/innodb-16k.result +++ b/mysql-test/suite/innodb/r/innodb-16k.result @@ -1,17 +1,18 @@ call mtr.add_suppression("InnoDB: Cannot add field .* in table"); -SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; -SET GLOBAL innodb_purge_rseg_truncate_frequency=1; # Test 1) Show the page size from Information Schema SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size'; variable_value 16384 # Test 4) The maximum row size is dependent upon the page size. -# Redundant: 8123, Compact: 8126. -# Compressed: 8126, Dynamic: 8126. +# Redundant: 8123, Compact: 8126, Dynamic: 8126. # Each row format has its own amount of overhead that # varies depending on number of fields and other overhead. SET SESSION innodb_strict_mode = ON; +SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET @save_level=@@GLOBAL.innodb_compression_level; +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; +SET GLOBAL innodb_compression_level=1; CREATE TABLE t1 ( c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200), c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200), @@ -20,7 +21,7 @@ c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200), c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200), c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200), c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200), -c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(157) +c36 char(200), c37 char(200), c38 char(196) ) ROW_FORMAT=compressed; DROP TABLE t1; CREATE TABLE t1 ( @@ -242,7 +243,7 @@ t1 CREATE TABLE `t1` ( `d` text NOT NULL, PRIMARY KEY (`a`,`b`(255),`c`(255)), KEY `b` (`b`(767)) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -351,7 +352,7 @@ t1 CREATE TABLE `t1` ( KEY `t1r` (`r`(767)), KEY `t1s` (`s`(767)), KEY `t1t` (`t`(767)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC DROP TABLE t1; Test an assertion failure on purge. CREATE TABLE t1_purge ( @@ -467,7 +468,7 @@ tlong2 CREATE TABLE `tlong2` ( KEY `ndx_n` (`n`(500)), KEY `ndx_o` (`o`(500)), KEY `ndx_p` (`p`(500)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC SET SESSION innodb_strict_mode = ON; CREATE TABLE bug12547647( a int NOT NULL, b blob NOT NULL, c text, @@ -500,12 +501,13 @@ drop table t1; CREATE TABLE t1(c text, PRIMARY KEY (c(440))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. -CREATE TABLE t1(c text, PRIMARY KEY (c(438))) +CREATE TABLE t1(c text, PRIMARY KEY (c(292))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512)); -InnoDB 0 transactions not purged DROP TABLE t1; +InnoDB 0 transactions not purged +SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency; +SET GLOBAL innodb_compression_level=@save_level; DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge; DROP TABLE tlong; DROP TABLE tlong2; -SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; diff --git a/mysql-test/suite/innodb/r/innodb-32k-crash.result b/mysql-test/suite/innodb/r/innodb-32k-crash.result index 438d535026361..98b4a128118d2 100644 --- a/mysql-test/suite/innodb/r/innodb-32k-crash.result +++ b/mysql-test/suite/innodb/r/innodb-32k-crash.result @@ -225,7 +225,7 @@ t1 CREATE TABLE `t1` ( KEY `t1f3` (`h`(767)), KEY `t1f4` (`i`(767)), KEY `t1f5` (`j`(767)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC show create table t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -289,5 +289,5 @@ t2 CREATE TABLE `t2` ( KEY `t1f1` (`f`(767)), KEY `t1f2` (`g`(767)), KEY `t1f3` (`h`(767)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT drop table t1,t2; diff --git a/mysql-test/suite/innodb/r/innodb-32k.result b/mysql-test/suite/innodb/r/innodb-32k.result index 3660fac3a2f2e..7dd1df8cfc591 100644 --- a/mysql-test/suite/innodb/r/innodb-32k.result +++ b/mysql-test/suite/innodb/r/innodb-32k.result @@ -270,7 +270,7 @@ tlong2 CREATE TABLE `tlong2` ( KEY `ndx_n` (`n`(500)), KEY `ndx_o` (`o`(500)), KEY `ndx_p` (`p`(500)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC SET SESSION innodb_strict_mode = ON; CREATE TABLE t3( a int NOT NULL, b blob NOT NULL, c text, @@ -738,7 +738,7 @@ t2 CREATE TABLE `t2` ( `COL195` text DEFAULT NULL, `COL196` text DEFAULT NULL, `COL197` text DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC update t2 set col150=@a; update t2 set col145=@b; drop table t2; diff --git a/mysql-test/suite/innodb/r/innodb-64k.result b/mysql-test/suite/innodb/r/innodb-64k.result index f8dad893d0e91..758179568b9e7 100644 --- a/mysql-test/suite/innodb/r/innodb-64k.result +++ b/mysql-test/suite/innodb/r/innodb-64k.result @@ -470,7 +470,7 @@ t1 CREATE TABLE `t1` ( KEY `xtc1c5` (`cc`(767),`dc`(767)), KEY `xte1e5` (`ec`(767),`fc`(767)), KEY `xt5k1f6` (`lc`(767),`mc`(767)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC SHOW WARNINGS; Level Code Message CREATE TABLE t2(COL1 TEXT, @@ -873,7 +873,7 @@ t1 CREATE TABLE `t1` ( KEY `xtc1c5` (`cc`(767),`dc`(767)), KEY `xte1e5` (`ec`(767),`fc`(767)), KEY `xt5k1f6` (`lc`(767),`mc`(767)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC show create table t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -1074,7 +1074,7 @@ t2 CREATE TABLE `t2` ( `COL195` text DEFAULT NULL, `COL196` text DEFAULT NULL, `COL197` text DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC BEGIN; update t2 set col150=@a; update t2 set col145=@b; @@ -1082,9 +1082,11 @@ COMMIT; drop table t2; DROP TABLE t1; # -# MDEV-19526 heap number overflow +# MDEV-19526/MDEV-29742 heap number overflow # CREATE TABLE t1(a SMALLINT NOT NULL UNIQUE AUTO_INCREMENT, KEY(a)) ENGINE=InnoDB; INSERT INTO t1 (a) SELECT seq FROM seq_1_to_8191; +ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; DROP TABLE t1; +# End of 10.3 tests diff --git a/mysql-test/suite/innodb/r/innodb-alter-autoinc.result b/mysql-test/suite/innodb/r/innodb-alter-autoinc.result index a96d2f634cbc5..3186b00aa38ee 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-autoinc.result +++ b/mysql-test/suite/innodb/r/innodb-alter-autoinc.result @@ -29,7 +29,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `id` (`id`,`a`) -) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci BEGIN; INSERT INTO t1 VALUES(7,0); SELECT * FROM t1; @@ -48,7 +48,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `id` (`id`,`a`) -) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY, DROP COLUMN id, AUTO_INCREMENT = 42, LOCK=NONE; ERROR 0A000: LOCK=NONE is not supported. Reason: Adding an auto-increment column requires a lock. Try LOCK=SHARED @@ -68,7 +68,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `id` (`id`,`a`) -) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 SET a=123; INSERT INTO t1 VALUES(-123,-45); ALTER TABLE t1 AUTO_INCREMENT = 75; @@ -90,7 +90,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `id` (`id`,`a`) -) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a INT) ENGINE=InnoDB; INSERT INTO t1 VALUES(347),(33101),(123),(45),(6); @@ -112,7 +112,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `id` (`id`,`a`) -) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci BEGIN; INSERT INTO t1 VALUES(7,0); SELECT * FROM t1; @@ -131,7 +131,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `id` (`id`,`a`) -) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY, DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=COPY; SELECT * FROM t1; @@ -148,7 +148,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `id` (`id`,`a`) -) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 SET a=123; INSERT INTO t1 VALUES(-123,-45); ALTER TABLE t1 AUTO_INCREMENT = 75; @@ -170,5 +170,5 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `id` (`id`,`a`) -) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-alter-debug.result b/mysql-test/suite/innodb/r/innodb-alter-debug.result index 81fc67e55c76c..c55b4a3ddd568 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-debug.result +++ b/mysql-test/suite/innodb/r/innodb-alter-debug.result @@ -23,7 +23,7 @@ t1ć CREATE TABLE `t1ć` ( PRIMARY KEY (`c1`), KEY `c2` (`c2`), CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `①` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1ć, ①; # # Bug #21364096 THE BOGUS DUPLICATE KEY ERROR IN ONLINE DDL @@ -43,9 +43,8 @@ SET DEBUG_SYNC = 'now SIGNAL s2'; /* connection default */ connection default; /* reap */ alter table t1 force, add b int, ALGORITHM=inplace; -ERROR 23000: Duplicate entry '1' for key 'uk' SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2'; -alter table t1 force, add b int, ALGORITHM=inplace;; +alter table t1 force, add c int, ALGORITHM=inplace;; /* connection con1 */ connection con1; set DEBUG_SYNC = 'now WAIT_FOR s1'; @@ -55,7 +54,6 @@ SET DEBUG_SYNC = 'now SIGNAL s2'; /* connection default */ connection default; /* reap */ alter table t1 force, add b int, ALGORITHM=inplace; -ERROR 23000: Duplicate entry '1' for key 'uk' SET DEBUG_SYNC = 'RESET'; drop table t1; # @@ -72,7 +70,6 @@ ERROR 23000: Duplicate entry '1' for key 'a' SET DEBUG_SYNC = 'now SIGNAL S2'; disconnect con1; connection default; -ERROR 23000: Duplicate entry '1' for key 'a' SET DEBUG_SYNC='RESET'; DROP TABLE t1; # @@ -137,7 +134,7 @@ DROP TABLE t1; # CREATE TABLE t1(a INT PRIMARY KEY, b INT, INDEX(b)) ENGINE=InnoDB; SET @save_dbug=@@debug_dbug; -SET debug_dbug='+d,innodb_table_deadlock'; +SET debug_dbug='+d,deadlock_table_fail'; ALTER TABLE t1 DROP INDEX b, ALGORITHM=INPLACE; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction SET debug_dbug=@save_dbug; diff --git a/mysql-test/suite/innodb/r/innodb-alter-table.result b/mysql-test/suite/innodb/r/innodb-alter-table.result index 9f296e3b58e80..552944f1e35db 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-table.result +++ b/mysql-test/suite/innodb/r/innodb-alter-table.result @@ -85,7 +85,7 @@ w_findispmon05u CREATE TABLE `w_findispmon05u` ( KEY `atpkey` (`f5atpkey`), KEY `inatkey` (`f5atzo05`,`pos`), KEY `pos` (`pos`,`f5atzo05`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE `w_findispmon05u`; CREATE TABLE t ( a INT NOT NULL, @@ -104,7 +104,7 @@ t CREATE TABLE `t` ( `c` int(11) NOT NULL, PRIMARY KEY (`a`), UNIQUE KEY `c` (`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t CHANGE COLUMN c b INT NOT NULL, ADD UNIQUE INDEX (c); @@ -133,7 +133,7 @@ child CREATE TABLE `child` ( PRIMARY KEY (`a`), KEY `c` (`c`), CONSTRAINT `child_ibfk_1` FOREIGN KEY (`c`) REFERENCES `parent` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE child, parent; CREATE TABLE IF NOT EXISTS ticket ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, @@ -183,7 +183,7 @@ ticket CREATE TABLE `ticket` ( `org_id` int(10) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `org_id` (`org_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE ticket; CREATE TABLE t ( id bigint(20) unsigned NOT NULL auto_increment, diff --git a/mysql-test/suite/innodb/r/innodb-alter-tempfile.result b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result index 845dbacbada72..4475abab0660c 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-tempfile.result +++ b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result @@ -18,7 +18,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Consecutive Alter table does not create same temporary file name ALTER TABLE t1 ADD PRIMARY KEY (f2, f1); show create table t1; @@ -27,7 +27,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` int(11) NOT NULL, PRIMARY KEY (`f2`,`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # # MDEV-22928 InnoDB fails to fetch index type diff --git a/mysql-test/suite/innodb/r/innodb-alter-timestamp.result b/mysql-test/suite/innodb/r/innodb-alter-timestamp.result index 5e95429c7bf43..1609812ed304c 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-timestamp.result +++ b/mysql-test/suite/innodb/r/innodb-alter-timestamp.result @@ -30,7 +30,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (i1 INT UNSIGNED NOT NULL, d1 TIMESTAMP NULL) ENGINE=InnoDB; SHOW CREATE TABLE t1; @@ -38,7 +38,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i1` int(10) unsigned NOT NULL, `d1` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (i1) VALUES (1), (2), (3), (4), (5); select * from t1; i1 d1 @@ -113,7 +113,7 @@ t1 CREATE TABLE `t1` ( `u1` varchar(30) DEFAULT substr(user(),1), `d2` timestamp NOT NULL DEFAULT '2017-05-08 16:23:45', `d3` timestamp NOT NULL DEFAULT `d1` -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 ADD COLUMN d4 TIMESTAMP DEFAULT CURRENT_TIMESTAMP; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 @@ -146,6 +146,8 @@ CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; ALTER TABLE t DISCARD TABLESPACE; SET sql_mode='NO_ZERO_DATE'; ALTER TABLE t ADD c DATE NOT NULL; +Warnings: +Warning 1814 Tablespace has been discarded for table `t` SET sql_mode=DEFAULT; DROP TABLE t; # End of 10.3 tests diff --git a/mysql-test/suite/innodb/r/innodb-alter.result b/mysql-test/suite/innodb/r/innodb-alter.result index a25b072cd53e3..16c33ee02a2ce 100644 --- a/mysql-test/suite/innodb/r/innodb-alter.result +++ b/mysql-test/suite/innodb/r/innodb-alter.result @@ -46,7 +46,7 @@ t1 CREATE TABLE `t1` ( `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 ALTER c2 DROP DEFAULT; SHOW CREATE TABLE t1; Table Create Table @@ -56,7 +56,7 @@ t1 CREATE TABLE `t1` ( `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; @@ -168,7 +168,7 @@ t3 CREATE TABLE `t3` ( `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c3`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t1c; Table Create Table t1c CREATE TABLE `t1c` ( @@ -180,7 +180,7 @@ t1c CREATE TABLE `t1c` ( KEY `c3` (`c3`), CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t3` (`c3`), CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t3 CHANGE c3 `12345678901234567890123456789012345678901234567890123456789012345` INT; ERROR 42000: Identifier name '12345678901234567890123456789012345678901234567890123456789012345' is too long @@ -194,7 +194,7 @@ t3 CREATE TABLE `t3` ( `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`1234567890123456789012345678901234567890123456789012345678901234`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t3 CHANGE `1234567890123456789012345678901234567890123456789012345678901234` `倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿偀` INT; @@ -227,7 +227,7 @@ t2 CREATE TABLE `t2` ( `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c3`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci RENAME TABLE t2 TO t1; SELECT st.NAME, i.NAME FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i @@ -276,7 +276,7 @@ t1c CREATE TABLE `t1c` ( KEY `c3` (`c3`), CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`), CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET foreign_key_checks=0; DROP TABLE t1p; SET foreign_key_checks=1; @@ -291,7 +291,7 @@ t1c CREATE TABLE `t1c` ( KEY `c3` (`c3`), CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`), CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; @@ -327,7 +327,7 @@ t1c CREATE TABLE `t1c` ( KEY `c2` (`c2`), CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`), CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; @@ -355,7 +355,7 @@ t1c CREATE TABLE `t1c` ( PRIMARY KEY (`c1`), KEY `c2` (`c2`), CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; @@ -380,7 +380,7 @@ t1c CREATE TABLE `t1c` ( `c2` int(11) DEFAULT NULL, `c3` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; @@ -437,7 +437,7 @@ tt CREATE TABLE `tt` ( `ct` text DEFAULT NULL, PRIMARY KEY (`pk`), FULLTEXT KEY `ct` (`ct`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE; ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE; @@ -538,7 +538,7 @@ t1n CREATE TABLE `t1n` ( PRIMARY KEY (`c2`), FULLTEXT KEY `ct` (`c1`), FULLTEXT KEY `ct_2` (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1n CHANGE c2 c1 INT, CHANGE ct c2 INT, CHANGE c1 ct TEXT, ALGORITHM=COPY; SHOW CREATE TABLE t1n; @@ -551,7 +551,7 @@ t1n CREATE TABLE `t1n` ( PRIMARY KEY (`c1`), FULLTEXT KEY `ct` (`ct`), FULLTEXT KEY `ct_2` (`ct`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=INPLACE; ERROR 42000: Key column 'c2' doesn't exist in table ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=COPY; @@ -568,7 +568,7 @@ t1n CREATE TABLE `t1n` ( KEY `c4` (`c4`), FULLTEXT KEY `ct` (`ct`), FULLTEXT KEY `ct_2` (`ct`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1n DROP INDEX c4; ALTER TABLE t1n CHANGE c4 c1 INT, ADD INDEX(c1), ALGORITHM=INPLACE; ERROR 42S21: Duplicate column name 'c1' @@ -584,7 +584,7 @@ t1n CREATE TABLE `t1n` ( KEY `c11` (`c11`), FULLTEXT KEY `ct` (`ct`), FULLTEXT KEY `ct_2` (`ct`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1n; ALTER TABLE t1o MODIFY c1 BIGINT UNSIGNED NOT NULL, DROP INDEX ct, ALGORITHM=INPLACE; @@ -611,7 +611,7 @@ t1o CREATE TABLE `t1o` ( `cu` text DEFAULT NULL, PRIMARY KEY (`FTS_DOC_ID`), FULLTEXT KEY `ct` (`ct`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL, DROP INDEX ct, ALGORITHM=INPLACE; SHOW CREATE TABLE t1o; @@ -622,7 +622,7 @@ t1o CREATE TABLE `t1o` ( `ct` text DEFAULT NULL, `cu` text DEFAULT NULL, PRIMARY KEY (`foo_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1c, t1p, sys_tables, sys_indexes, sys_foreign; CREATE TABLE sys_tables SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME='test/t1o'; @@ -717,14 +717,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c2` int(11) NOT NULL, KEY `c2` (`c2`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 CHANGE COLUMN c1 C1 INT; ALTER TABLE t2 CHANGE COLUMN c2 C2 INT; SHOW CREATE TABLE t1; @@ -732,14 +732,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `C1` int(11) NOT NULL, PRIMARY KEY (`C1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `C2` int(11) DEFAULT NULL, KEY `c2` (`C2`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`C2`) REFERENCES `t1` (`C1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 CHANGE COLUMN C1 c5 INT; ALTER TABLE t2 CHANGE COLUMN C2 c6 INT; SHOW CREATE TABLE t1; @@ -747,14 +747,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `c5` int(11) NOT NULL, PRIMARY KEY (`c5`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c6` int(11) DEFAULT NULL, KEY `c2` (`c6`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c6`) REFERENCES `t1` (`c5`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID WHERE T.NAME='test/t1'; @@ -780,7 +780,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `A` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`A`) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID WHERE T.NAME='test/t1'; @@ -830,7 +830,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `b` (`B`), UNIQUE KEY `c` (`C`), UNIQUE KEY `d` (`D`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -846,7 +846,7 @@ t2 CREATE TABLE `t2` ( CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`BB`) REFERENCES `t1` (`B`), CONSTRAINT `t2_ibfk_3` FOREIGN KEY (`CC`) REFERENCES `t1` (`C`), CONSTRAINT `t2_ibfk_4` FOREIGN KEY (`DD`) REFERENCES `t1` (`D`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DELETE FROM t1 WHERE a=1; ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`AA`) REFERENCES `t1` (`A`)) DELETE FROM t1 WHERE A=1; @@ -872,7 +872,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `A` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`A`) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID WHERE T.NAME='test/t1'; @@ -918,7 +918,7 @@ t1 CREATE TABLE `t1` ( KEY `fk_1` (`a1`,`a3`), CONSTRAINT `fk_1` FOREIGN KEY (`a1`, `a3`) REFERENCES `parent` (`a`, `b`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `fk_a` FOREIGN KEY (`a1`, `a3`) REFERENCES `parent` (`a`, `b`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -931,7 +931,7 @@ t1 CREATE TABLE `t1` ( KEY `fk_1` (`a1`,`a4`), CONSTRAINT `fk_1` FOREIGN KEY (`a1`, `a4`) REFERENCES `parent` (`a`, `b`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `fk_a` FOREIGN KEY (`a1`, `a4`) REFERENCES `parent` (`a`, `b`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -944,7 +944,7 @@ t1 CREATE TABLE `t1` ( KEY `fk_1` (`a1`,`a4`), CONSTRAINT `fk_1` FOREIGN KEY (`a1`, `a4`) REFERENCES `parent` (`a`, `c`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `fk_a` FOREIGN KEY (`a1`, `a4`) REFERENCES `parent` (`a`, `c`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -973,7 +973,7 @@ CREATE TABLE `t1` ( `name` varchar(20) DEFAULT NULL, PRIMARY KEY (`id`), KEY `index2` (`name`,`age`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; ALTER TABLE dest_db.t1 DISCARD TABLESPACE; ALTER TABLE dest_db.t1 IMPORT TABLESPACE; CHECK TABLE dest_db.t1; @@ -987,7 +987,7 @@ t1 CREATE TABLE `t1` ( `name` varchar(20) DEFAULT NULL, PRIMARY KEY (`id`), KEY `index2` (`name`,`age`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM dest_db.t1; id age name DROP TABLE dest_db.t1; @@ -1000,7 +1000,7 @@ CREATE TABLE `t1` ( `age` int(11) DEFAULT NULL, `name` varchar(20) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; ALTER TABLE dest_db.t1 DISCARD TABLESPACE; ALTER TABLE dest_db.t1 IMPORT TABLESPACE; CHECK TABLE dest_db.t1; @@ -1013,7 +1013,7 @@ t1 CREATE TABLE `t1` ( `age` int(11) DEFAULT NULL, `name` varchar(20) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM dest_db.t1; id age name DROP TABLE dest_db.t1; diff --git a/mysql-test/suite/innodb/r/innodb-autoinc-18274.result b/mysql-test/suite/innodb/r/innodb-autoinc-18274.result index 22afc65a6498a..0f030a8c16f78 100644 --- a/mysql-test/suite/innodb/r/innodb-autoinc-18274.result +++ b/mysql-test/suite/innodb/r/innodb-autoinc-18274.result @@ -7,7 +7,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DELETE FROM t1; OPTIMIZE TABLE t1; Table Op Msg_type Msg_text @@ -18,7 +18,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES(null); SELECT * FROM t1; c1 diff --git a/mysql-test/suite/innodb/r/innodb-autoinc-44030.result b/mysql-test/suite/innodb/r/innodb-autoinc-44030.result index 857a70a03be88..8db5952d1d086 100644 --- a/mysql-test/suite/innodb/r/innodb-autoinc-44030.result +++ b/mysql-test/suite/innodb/r/innodb-autoinc-44030.result @@ -15,7 +15,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `d1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`d1`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES(null); SELECT * FROM t1; d1 @@ -30,7 +30,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `d1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`d1`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES(null); INSERT INTO t1 VALUES(null); SELECT * FROM t1; diff --git a/mysql-test/suite/innodb/r/innodb-autoinc-part.result b/mysql-test/suite/innodb/r/innodb-autoinc-part.result new file mode 100644 index 0000000000000..f7bbc10c6ece3 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-autoinc-part.result @@ -0,0 +1,34 @@ +# +# MDEV-28416 Incorrect AUTO_INCREMENT may be issued +# +SET @aii=@@auto_increment_increment; +SET auto_increment_increment=300; +CREATE TABLE t1 (a SERIAL) ENGINE=innodb +PARTITION BY RANGE (a) ( +PARTITION p0 VALUES LESS THAN (6), +PARTITION p1 VALUES LESS THAN MAXVALUE +); +INSERT INTO t1 VALUES (18446744073709551613); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551614 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY RANGE (`a`) +(PARTITION `p0` VALUES LESS THAN (6) ENGINE = InnoDB, + PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) +INSERT INTO t1 VALUES (NULL); +ERROR 22003: Out of range value for column 'a' at row 1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=298 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY RANGE (`a`) +(PARTITION `p0` VALUES LESS THAN (6) ENGINE = InnoDB, + PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) +DROP TABLE t1; +SET auto_increment_increment=@aii; +# End of 10.2 tests diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result index 1efd5c61af7e9..2fb12dcf8e267 100644 --- a/mysql-test/suite/innodb/r/innodb-autoinc.result +++ b/mysql-test/suite/innodb/r/innodb-autoinc.result @@ -1,4 +1,3 @@ -drop table if exists t1; CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; INSERT INTO t1 VALUES (9223372036854775807, null); INSERT INTO t1 (c2) VALUES ('innodb'); @@ -103,14 +102,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci TRUNCATE TABLE t1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1), (2), (3); INSERT INTO t1 VALUES (NULL), (NULL), (NULL); SELECT c1 FROM t1; @@ -126,7 +125,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1), (2), (3); @@ -144,14 +143,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DELETE FROM t1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1), (2), (3); INSERT INTO t1 VALUES (NULL), (NULL), (NULL); SELECT c1 FROM t1; @@ -167,7 +166,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP TABLE IF EXISTS t1; Warnings: @@ -643,7 +642,7 @@ t CREATE TABLE `t` ( `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `b` varchar(200) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t(b) VALUES('S1'); SELECT a,b FROM t; a b @@ -658,7 +657,7 @@ t CREATE TABLE `t` ( `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `b` varchar(200) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t(b) VALUES('S2'); SELECT a,b FROM t; a b @@ -671,7 +670,7 @@ t CREATE TABLE `t` ( `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `b` varchar(200) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t(b) VALUES('S2'); SELECT a,b FROM t; a b @@ -688,7 +687,7 @@ t CREATE TABLE `t` ( `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `b` varchar(200) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t(b) VALUES('S1'); SELECT a,b FROM t; a b @@ -708,7 +707,7 @@ t CREATE TABLE `t` ( `a` tinyint(4) NOT NULL AUTO_INCREMENT, `b` varchar(200) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t(b) VALUES('S0'),('S1'); SHOW CREATE TABLE t; Table Create Table @@ -716,7 +715,7 @@ t CREATE TABLE `t` ( `a` tinyint(4) NOT NULL AUTO_INCREMENT, `b` varchar(200) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t(a,b) VALUES(28,'S2'); SET SESSION auto_increment_increment=1; SHOW CREATE TABLE t; @@ -725,7 +724,7 @@ t CREATE TABLE `t` ( `a` tinyint(4) NOT NULL AUTO_INCREMENT, `b` varchar(200) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t(b) VALUES('S3'); SHOW CREATE TABLE t; Table Create Table @@ -733,7 +732,7 @@ t CREATE TABLE `t` ( `a` tinyint(4) NOT NULL AUTO_INCREMENT, `b` varchar(200) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t(b) VALUES('S4'); SELECT * FROM t; a b @@ -748,7 +747,7 @@ t CREATE TABLE `t` ( `a` tinyint(4) NOT NULL AUTO_INCREMENT, `b` varchar(200) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5; DROP TABLE IF EXISTS t1; @@ -789,7 +788,7 @@ t2 CREATE TABLE `t2` ( `n` int(10) unsigned NOT NULL, `o` enum('FALSE','TRUE') DEFAULT NULL, PRIMARY KEY (`m`) -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (b,c) SELECT n,o FROM t2 ; SHOW CREATE TABLE t1; Table Create Table @@ -798,7 +797,7 @@ t1 CREATE TABLE `t1` ( `b` int(10) unsigned NOT NULL, `c` enum('FALSE','TRUE') DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (b,c) SELECT n,o FROM t2 ; SELECT * FROM t1; a b c @@ -829,7 +828,7 @@ t1 CREATE TABLE `t1` ( `b` int(10) unsigned NOT NULL, `c` enum('FALSE','TRUE') DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; SELECT * FROM t1; a b c @@ -865,7 +864,7 @@ t1 CREATE TABLE `t1` ( `b` int(10) unsigned NOT NULL, `c` enum('FALSE','TRUE') DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; SELECT * FROM t1; a b c @@ -906,7 +905,7 @@ t1 CREATE TABLE `t1` ( `b` int(10) unsigned NOT NULL, `c` enum('FALSE','TRUE') DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; SHOW CREATE TABLE t1; Table Create Table @@ -915,7 +914,7 @@ t1 CREATE TABLE `t1` ( `b` int(10) unsigned NOT NULL, `c` enum('FALSE','TRUE') DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; SHOW CREATE TABLE t1; Table Create Table @@ -924,7 +923,7 @@ t1 CREATE TABLE `t1` ( `b` int(10) unsigned NOT NULL, `c` enum('FALSE','TRUE') DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; SELECT * FROM t1; a b c @@ -980,7 +979,7 @@ t1 CREATE TABLE `t1` ( `b` int(10) unsigned NOT NULL, `c` enum('FALSE','TRUE') DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP TABLE t2; DROP TABLE IF EXISTS t1; @@ -1020,7 +1019,7 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 -127 innodb @@ -1043,7 +1042,7 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 1 NULL @@ -1062,7 +1061,7 @@ t1 CREATE TABLE `t1` ( `c1` smallint(6) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 -32767 innodb @@ -1085,7 +1084,7 @@ t1 CREATE TABLE `t1` ( `c1` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 1 NULL @@ -1104,7 +1103,7 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(9) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 -8388607 innodb @@ -1127,7 +1126,7 @@ t1 CREATE TABLE `t1` ( `c1` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 1 NULL @@ -1146,7 +1145,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 -2147483647 innodb @@ -1169,7 +1168,7 @@ t1 CREATE TABLE `t1` ( `c1` int(10) unsigned NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 1 NULL @@ -1188,7 +1187,7 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 -9223372036854775807 innodb @@ -1211,7 +1210,7 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 1 NULL @@ -1228,7 +1227,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `i1` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (c2) values (0); SELECT * FROM t1; c1 c2 @@ -1247,7 +1246,7 @@ t1 CREATE TABLE `t1` ( `C1` double NOT NULL AUTO_INCREMENT, `C2` char(10) DEFAULT NULL, PRIMARY KEY (`C1`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB; INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb'); @@ -1259,7 +1258,7 @@ t1 CREATE TABLE `t1` ( `C1` float NOT NULL AUTO_INCREMENT, `C2` char(10) DEFAULT NULL, PRIMARY KEY (`C1`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP TABLE IF EXISTS t1; Warnings: @@ -1271,7 +1270,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 SET c1 = 2; INSERT INTO t1 SET c1 = -1; SELECT * FROM t1; @@ -1286,7 +1285,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci REPLACE INTO t1 VALUES (-1); SELECT * FROM t1; c1 @@ -1298,7 +1297,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP TABLE IF EXISTS t1; Warnings: @@ -1316,7 +1315,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL); @@ -1331,7 +1330,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL); @@ -1351,7 +1350,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5); @@ -1366,7 +1365,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL); @@ -1381,7 +1380,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; DROP TABLE IF EXISTS t1; Warnings: @@ -1395,7 +1394,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` bigint(20) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=256; SHOW VARIABLES LIKE "auto_inc%"; @@ -1410,7 +1409,7 @@ t1 CREATE TABLE `t1` ( `c1` tinyint(4) NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 1 NULL @@ -1428,7 +1427,7 @@ t1 CREATE TABLE `t1` ( `c1` int(10) unsigned NOT NULL AUTO_INCREMENT, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=2147483649 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2147483649 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 2147483648 a @@ -1442,7 +1441,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL DEFAULT 0, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1(c2) VALUES('b'); SELECT * FROM t1; c1 c2 @@ -1454,7 +1453,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL DEFAULT 0, `c2` varchar(10) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Bug #14049391 INNODB MISCALCULATES AUTO-INCREMENT @@ -1468,7 +1467,7 @@ Table Create Table t CREATE TABLE `t` ( `i` int(11) NOT NULL AUTO_INCREMENT, KEY `i` (`i`) -) ENGINE=InnoDB AUTO_INCREMENT=601 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=601 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET auto_increment_increment = 50; INSERT INTO t VALUES (NULL); SELECT * FROM t; @@ -1481,7 +1480,7 @@ Table Create Table t CREATE TABLE `t` ( `i` int(11) NOT NULL AUTO_INCREMENT, KEY `i` (`i`) -) ENGINE=InnoDB AUTO_INCREMENT=651 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=651 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t; SET auto_increment_increment = DEFAULT; # @@ -1529,7 +1528,7 @@ t1 CREATE TABLE `t1` ( `id` tinyint(4) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -1543,7 +1542,7 @@ t1 CREATE TABLE `t1` ( `id` smallint(6) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -1557,7 +1556,7 @@ t1 CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -1571,7 +1570,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -1585,7 +1584,7 @@ t1 CREATE TABLE `t1` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -1599,7 +1598,7 @@ t1 CREATE TABLE `t1` ( `id` float NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -1613,7 +1612,7 @@ t1 CREATE TABLE `t1` ( `id` double NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci id name 1 dog id name @@ -1622,3 +1621,27 @@ id name -1 dog 2 cat DROP PROCEDURE autoinc_mdev15353_one; +# +# MDEV-28416 Incorrect AUTO_INCREMENT may be issued +# +SET @aii=@@auto_increment_increment; +SET auto_increment_increment=300; +CREATE TABLE t1 (a SERIAL) ENGINE=innodb; +INSERT INTO t1 VALUES (18446744073709551613); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551614 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES (NULL); +ERROR 22003: Out of range value for column 'a' at row 1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +SET auto_increment_increment=@aii; +# End of 10.2 tests diff --git a/mysql-test/suite/innodb/r/innodb-change-buffer-recovery.result b/mysql-test/suite/innodb/r/innodb-change-buffer-recovery.result deleted file mode 100644 index e303784744170..0000000000000 --- a/mysql-test/suite/innodb/r/innodb-change-buffer-recovery.result +++ /dev/null @@ -1,54 +0,0 @@ -# -# Bug#69122 - INNODB DOESN'T REDO-LOG INSERT BUFFER MERGE -# OPERATION IF IT IS DONE IN-PLACE -# -call mtr.add_suppression("InnoDB: innodb_read_only prevents crash recovery"); -call mtr.add_suppression("Plugin initialization aborted at srv0start\\.cc"); -call mtr.add_suppression("Plugin 'InnoDB'"); -FLUSH TABLES; -CREATE TABLE t1( -a INT AUTO_INCREMENT PRIMARY KEY, -b CHAR(1), -c INT, -INDEX(b)) -ENGINE=InnoDB STATS_PERSISTENT=0; -SET GLOBAL innodb_change_buffering_debug = 1; -INSERT INTO t1 SELECT 0,'x',1 FROM seq_1_to_8192; -BEGIN; -SELECT b FROM t1 LIMIT 3; -b -x -x -x -connect con1,localhost,root,,; -BEGIN; -DELETE FROM t1 WHERE a=1; -INSERT INTO t1 VALUES(1,'X',1); -SET DEBUG_DBUG='+d,crash_after_log_ibuf_upd_inplace'; -SELECT b FROM t1 LIMIT 3; -ERROR HY000: Lost connection to server during query -disconnect con1; -connection default; -FOUND 1 /Wrote log record for ibuf update in place operation/ in mysqld.1.err -# restart: --innodb-read-only -CHECK TABLE t1; -Table Op Msg_type Msg_text -test.t1 check Error Unknown storage engine 'InnoDB' -test.t1 check error Corrupt -FOUND 1 /innodb_read_only prevents crash recovery/ in mysqld.1.err -# restart: --innodb-force-recovery=5 -SELECT * FROM t1 LIMIT 1; -a b c -1 X 1 -SHOW ENGINE INNODB STATUS; -Type Name Status -InnoDB insert 0, delete mark 0 -SET GLOBAL innodb_fast_shutdown=0; -# restart -CHECK TABLE t1; -Table Op Msg_type Msg_text -test.t1 check status OK -SHOW ENGINE INNODB STATUS; -Type Name Status -InnoDB -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-corrupted-table.result b/mysql-test/suite/innodb/r/innodb-corrupted-table.result index 9a0b3d818109e..bfe31b01455e9 100644 --- a/mysql-test/suite/innodb/r/innodb-corrupted-table.result +++ b/mysql-test/suite/innodb/r/innodb-corrupted-table.result @@ -12,7 +12,7 @@ t1 CREATE TABLE `t1` ( `pk` int(11) DEFAULT NULL, `i` int(11) DEFAULT NULL, KEY `i` (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Warnings: Warning 1082 InnoDB: Table test/t1 has a primary key in InnoDB data dictionary, but not in MariaDB! Warning 1082 InnoDB: Table test/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB @@ -33,7 +33,7 @@ t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, `j` int(11) DEFAULT NULL, KEY `i` (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 add primary key (pk); show warnings; Level Code Message @@ -45,5 +45,5 @@ t1 CREATE TABLE `t1` ( `j` int(11) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `i` (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb-dict.result b/mysql-test/suite/innodb/r/innodb-dict.result index d56fec0f9af9f..5be1cefaa9350 100644 --- a/mysql-test/suite/innodb/r/innodb-dict.result +++ b/mysql-test/suite/innodb/r/innodb-dict.result @@ -7,7 +7,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `d` int(11) DEFAULT NULL, KEY `my_d` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9); INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1; @@ -40,5 +40,5 @@ Table Create Table t1 CREATE TABLE `t1` ( `D` int(11) DEFAULT NULL, KEY `my_d` (`D`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-fk-virtual.result b/mysql-test/suite/innodb/r/innodb-fk-virtual.result index a79cd133aa30d..b39e770c729db 100644 --- a/mysql-test/suite/innodb/r/innodb-fk-virtual.result +++ b/mysql-test/suite/innodb/r/innodb-fk-virtual.result @@ -26,7 +26,7 @@ b CREATE TABLE `b` ( `c_cola` int(10) GENERATED ALWAYS AS (`cola` + 2) VIRTUAL, KEY `p_cola_fk` (`p_cola`), CONSTRAINT `p_cola_fk` FOREIGN KEY (`p_cola`) REFERENCES `a` (`p_cola`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table b add constraint `v_cola_fk` foreign key (v_cola) references a (v_cola) on delete restrict @@ -44,7 +44,7 @@ b CREATE TABLE `b` ( KEY `v_cola_fk` (`v_cola`), CONSTRAINT `p_cola_fk` FOREIGN KEY (`p_cola`) REFERENCES `a` (`p_cola`), CONSTRAINT `v_cola_fk` FOREIGN KEY (`v_cola`) REFERENCES `a` (`v_cola`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table b add constraint `c_cola_fk` foreign key (c_cola) references a (cola) on delete restrict @@ -64,7 +64,7 @@ b CREATE TABLE `b` ( CONSTRAINT `c_cola_fk` FOREIGN KEY (`c_cola`) REFERENCES `a` (`cola`), CONSTRAINT `p_cola_fk` FOREIGN KEY (`p_cola`) REFERENCES `a` (`p_cola`), CONSTRAINT `v_cola_fk` FOREIGN KEY (`v_cola`) REFERENCES `a` (`v_cola`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into a(cola) values (12); select * from a; cola v_cola p_cola diff --git a/mysql-test/suite/innodb/r/innodb-fk.result b/mysql-test/suite/innodb/r/innodb-fk.result index 7982c5f1f4978..e06c744fedd88 100644 --- a/mysql-test/suite/innodb/r/innodb-fk.result +++ b/mysql-test/suite/innodb/r/innodb-fk.result @@ -89,7 +89,7 @@ person CREATE TABLE `person` ( `Name` varchar(50) NOT NULL, PRIMARY KEY (`Id`), CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `group` (`Id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci CREATE TABLE `kg_test2`.`person2` ( `Id` INT(11) NOT NULL AUTO_INCREMENT, `Name` VARCHAR(50) NOT NULL, @@ -110,7 +110,7 @@ person2 CREATE TABLE `person2` ( `Name` varchar(50) NOT NULL, PRIMARY KEY (`Id`), CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `kg_test1`.`group` (`Id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW WARNINGS; Level Code Message DROP DATABASE kg_test2; @@ -136,7 +136,7 @@ Table Create Table KEY `id_depart_in` (`id_depart_in`), CONSTRAINT `#departaments_tree_ibfk_1` FOREIGN KEY (`id_depart`) REFERENCES `#departaments` (`id_depart`), CONSTRAINT `#departaments_tree_ibfk_2` FOREIGN KEY (`id_depart_in`) REFERENCES `#departaments` (`id_depart`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE `#departaments_tree`; DROP TABLE `#departaments`; CREATE TABLE `boroda` ( @@ -164,7 +164,7 @@ Table Create Table KEY `b` (`b`), CONSTRAINT `#boroda_ibfk_1` FOREIGN KEY (`a`) REFERENCES `#boroda` (`id`), CONSTRAINT `#boroda_ibfk_2` FOREIGN KEY (`b`) REFERENCES `#boroda` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE `#boroda`; CREATE TABLE `boroda` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, @@ -188,7 +188,7 @@ bor#oda CREATE TABLE `bor#oda` ( KEY `b` (`b`), CONSTRAINT `bor#oda_ibfk_1` FOREIGN KEY (`a`) REFERENCES `bor#oda` (`id`), CONSTRAINT `bor#oda_ibfk_2` FOREIGN KEY (`b`) REFERENCES `bor#oda` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE `bor#oda`; # # MDEV-21127 Assertion `(size_t)(ptr - buf) < MAX_TEXT - 4' failed in key_text::key_text diff --git a/mysql-test/suite/innodb/r/innodb-fkcheck.result b/mysql-test/suite/innodb/r/innodb-fkcheck.result index efa227e4035fd..f86ba50597fac 100644 --- a/mysql-test/suite/innodb/r/innodb-fkcheck.result +++ b/mysql-test/suite/innodb/r/innodb-fkcheck.result @@ -27,7 +27,14 @@ c CREATE TABLE `c` ( `d2` datetime NOT NULL, PRIMARY KEY (`b`,`d1`), CONSTRAINT `b_fk` FOREIGN KEY (`b`) REFERENCES `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE b ( +b bigint unsigned NOT NULL, +d1 date NOT NULL, +PRIMARY KEY (b,d1) +) ENGINE=InnoDB; +DROP TABLE b; +set foreign_key_checks = 1; CREATE TABLE b ( b bigint unsigned NOT NULL, d1 date NOT NULL, @@ -38,6 +45,7 @@ show warnings; Level Code Message Error 1005 Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed") Warning 1215 Cannot add foreign key constraint for `b` +set foreign_key_checks = 0; DROP TABLE IF EXISTS d; Warnings: Note 1051 Unknown table 'bug_fk.d' @@ -58,7 +66,7 @@ c CREATE TABLE `c` ( `d2` datetime NOT NULL, PRIMARY KEY (`b`,`d1`), CONSTRAINT `b_fk` FOREIGN KEY (`b`) REFERENCES `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table d; Table Create Table d CREATE TABLE `d` ( @@ -66,7 +74,7 @@ d CREATE TABLE `d` ( `d1` date NOT NULL, PRIMARY KEY (`b`,`d1`), CONSTRAINT `bd_fk` FOREIGN KEY (`b`) REFERENCES `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE b ( b bigint unsigned NOT NULL, d1 date NOT NULL, diff --git a/mysql-test/suite/innodb/r/innodb-get-fk.result b/mysql-test/suite/innodb/r/innodb-get-fk.result index 2b1ed5e7c79a1..0a460995db7ab 100644 --- a/mysql-test/suite/innodb/r/innodb-get-fk.result +++ b/mysql-test/suite/innodb/r/innodb-get-fk.result @@ -40,7 +40,7 @@ crew_role_assigned CREATE TABLE `crew_role_assigned` ( KEY `fk_crewRoleAssigned_pilotId` (`crew_id`), CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This is a comment about tables' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='This is a comment about tables' SET GLOBAL innodb_buffer_pool_load_now = ON; SET GLOBAL innodb_buffer_pool_dump_now = ON; SET GLOBAL innodb_buffer_pool_load_abort = ON; @@ -57,7 +57,7 @@ crew_role_assigned CREATE TABLE `crew_role_assigned` ( KEY `fk_crewRoleAssigned_pilotId` (`crew_id`), CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This is a new comment about tables' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='This is a new comment about tables' # restart: --innodb-read-only SHOW CREATE TABLE `repro`.`crew_role_assigned`; Table Create Table @@ -70,7 +70,7 @@ crew_role_assigned CREATE TABLE `crew_role_assigned` ( KEY `fk_crewRoleAssigned_pilotId` (`crew_id`), CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This is a new comment about tables' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='This is a new comment about tables' # restart DROP TABLE `repro`.`crew_role_assigned`; DROP TABLE `repro`.`pilot`; diff --git a/mysql-test/suite/innodb/r/innodb-index,debug.rdiff b/mysql-test/suite/innodb/r/innodb-index,debug.rdiff deleted file mode 100644 index 2740e440cd5ec..0000000000000 --- a/mysql-test/suite/innodb/r/innodb-index,debug.rdiff +++ /dev/null @@ -1,10 +0,0 @@ ---- innodb-index.result -+++ innodb-index.reject -@@ -1851,6 +1851,7 @@ - # - # MDEV-15325 Incomplete validation of missing tablespace during recovery - # -+SET GLOBAL DEBUG_DBUG='+d,fil_names_write_bogus'; - CREATE TABLE t1(f1 INT PRIMARY KEY)ENGINE=InnoDB; - CREATE TABLE t2(f1 INT PRIMARY KEY)ENGINE=InnoDB; - # Kill the server diff --git a/mysql-test/suite/innodb/r/innodb-index-debug.result b/mysql-test/suite/innodb/r/innodb-index-debug.result index f6b23eea41a22..8c200109aa416 100644 --- a/mysql-test/suite/innodb/r/innodb-index-debug.result +++ b/mysql-test/suite/innodb/r/innodb-index-debug.result @@ -5,7 +5,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5); SET @saved_debug_dbug = @@SESSION.debug_dbug; SET DEBUG_DBUG='+d,ib_build_indexes_too_many_concurrent_trxs, ib_rename_indexes_too_many_concurrent_trxs, ib_drop_index_too_many_concurrent_trxs'; @@ -18,7 +18,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT NOT NULL, INDEX(c2)) ENGINE=InnoDB; @@ -111,27 +111,28 @@ t1 CREATE TABLE `t1` ( `k2` char(200) DEFAULT NULL, `k3` char(200) DEFAULT NULL, PRIMARY KEY (`k1`) -) ENGINE=InnoDB AUTO_INCREMENT=1024 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=1024 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; drop table t480; # # MDEV-12827 Assertion failure when reporting duplicate key error # in online table rebuild # -CREATE TABLE t1 (j INT UNIQUE, i INT UNIQUE) ENGINE=InnoDB; +CREATE TABLE t1 (j INT UNIQUE, i INT) ENGINE=InnoDB; INSERT INTO t1 VALUES(2, 2); connect con1,localhost,root,,test; SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built WAIT_FOR log'; -ALTER TABLE t1 DROP j, FORCE; +ALTER TABLE t1 DROP j, ADD UNIQUE INDEX(i), FORCE; connection default; SET DEBUG_SYNC='now WAIT_FOR built'; SET DEBUG_DBUG='+d,row_ins_row_level'; INSERT INTO t1 (i) VALUES (0),(0); -ERROR 23000: Duplicate entry '0' for key 'i' SET DEBUG_SYNC='now SIGNAL log'; SET DEBUG_DBUG=@saved_debug_dbug; connection con1; ERROR 23000: Duplicate entry '0' for key 'i' +DELETE FROM t1; +ALTER TABLE t1 ADD UNIQUE INDEX(i); SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built2 WAIT_FOR log2'; ALTER TABLE t1 DROP j, FORCE; connection default; @@ -141,7 +142,6 @@ UPDATE t1 SET i=0; ERROR 23000: Duplicate entry '0' for key 'i' SET DEBUG_SYNC='now SIGNAL log2'; connection con1; -ERROR 23000: Duplicate entry '0' for key 'i' disconnect con1; connection default; SET DEBUG_SYNC='RESET'; diff --git a/mysql-test/suite/innodb/r/innodb-index-online-fk.result b/mysql-test/suite/innodb/r/innodb-index-online-fk.result index a30419855195b..84e8ea896352b 100644 --- a/mysql-test/suite/innodb/r/innodb-index-online-fk.result +++ b/mysql-test/suite/innodb/r/innodb-index-online-fk.result @@ -36,13 +36,13 @@ SET foreign_key_checks = 0; ALTER TABLE child ADD CONSTRAINT fk_20 FOREIGN KEY (a1, a2) REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE, ALGORITHM = INPLACE; -ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_20' in the referenced table 'parent' +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_20' in the referenced table 'parent' SHOW WARNINGS; Level Code Message -Error 1822 Failed to add the foreign key constaint. Missing index for constraint 'fk_20' in the referenced table 'parent' +Error 1822 Failed to add the foreign key constraint. Missing index for constraint 'fk_20' in the referenced table 'parent' SHOW ERRORS; Level Code Message -Error 1822 Failed to add the foreign key constaint. Missing index for constraint 'fk_20' in the referenced table 'parent' +Error 1822 Failed to add the foreign key constraint. Missing index for constraint 'fk_20' in the referenced table 'parent' CREATE INDEX idx1 on parent(a, b); ALTER TABLE child ADD CONSTRAINT fk_10 FOREIGN KEY (a1, a2) REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE, @@ -82,7 +82,7 @@ child CREATE TABLE `child` ( CONSTRAINT `fk_10` FOREIGN KEY (`a1`, `a2`) REFERENCES `parent` (`a`, `b`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_2` FOREIGN KEY (`a1`, `a2`) REFERENCES `parent` (`a`, `b`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_3` FOREIGN KEY (`a1`, `a2`) REFERENCES `parent` (`a`, `b`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DELETE FROM parent where a = 1; SELECT * FROM child; a1 a2 @@ -141,11 +141,11 @@ SET DEBUG_DBUG = '+d,innodb_test_no_foreign_idx'; ALTER TABLE `#child` ADD CONSTRAINT fk_40 FOREIGN KEY (a1, a2) REFERENCES `#parent`(a, b) ON DELETE CASCADE ON UPDATE CASCADE, ALGORITHM = INPLACE; -ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_40' in the foreign table '#child' +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_40' in the foreign table '#child' SET DEBUG_DBUG = @saved_debug_dbug; SHOW ERRORS; Level Code Message -Error 1821 Failed to add the foreign key constaint. Missing index for constraint 'fk_40' in the foreign table '#child' +Error 1821 Failed to add the foreign key constraint. Missing index for constraint 'fk_40' in the foreign table '#child' SELECT * FROM information_schema.INNODB_SYS_FOREIGN; ID FOR_NAME REF_NAME N_COLS TYPE test/fk_1 test/child test/parent 1 6 @@ -168,11 +168,11 @@ SET DEBUG_DBUG = '+d,innodb_test_no_reference_idx'; ALTER TABLE child ADD CONSTRAINT fk_42 FOREIGN KEY (a1, a2) REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE, ALGORITHM = INPLACE; -ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_42' in the referenced table 'parent' +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_42' in the referenced table 'parent' SET DEBUG_DBUG = @saved_debug_dbug; SHOW ERRORS; Level Code Message -Error 1822 Failed to add the foreign key constaint. Missing index for constraint 'fk_42' in the referenced table 'parent' +Error 1822 Failed to add the foreign key constraint. Missing index for constraint 'fk_42' in the referenced table 'parent' SET DEBUG_DBUG = '+d,innodb_test_wrong_fk_option'; ALTER TABLE child ADD CONSTRAINT fk_42 FOREIGN KEY (a1, a2) REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE, @@ -258,7 +258,7 @@ child CREATE TABLE `child` ( PRIMARY KEY (`a1`), KEY `fk_4` (`a2`), CONSTRAINT `fk_4` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM information_schema.INNODB_SYS_FOREIGN; ID FOR_NAME REF_NAME N_COLS TYPE test/fk_4 test/child test/parent 1 5 @@ -352,7 +352,7 @@ child CREATE TABLE `child` ( PRIMARY KEY (`a3`), KEY `tb` (`a2`), CONSTRAINT `fk_1` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE child; CREATE TABLE child (a1 INT NOT NULL, a2 INT) ENGINE = InnoDB; ALTER TABLE child ADD PRIMARY KEY idx (a1), @@ -389,7 +389,7 @@ child CREATE TABLE `child` ( PRIMARY KEY (`a1`), KEY `fk_1` (`a2`), CONSTRAINT `fk_1` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE child; CREATE TABLE child (a1 INT NOT NULL, a2 INT) ENGINE = InnoDB; ALTER TABLE child CHANGE a1 a3 INT, @@ -423,7 +423,7 @@ child CREATE TABLE `child` ( `a2` int(11) DEFAULT NULL, KEY `fk_1` (`a3`), CONSTRAINT `fk_1` FOREIGN KEY (`a3`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE child; CREATE TABLE child (a1 INT NOT NULL, a2 INT) ENGINE = InnoDB; ALTER TABLE child ADD PRIMARY KEY idx (a3), CHANGE a1 a3 INT, @@ -456,7 +456,7 @@ child CREATE TABLE `child` ( KEY `fk_b` (`a1_new`), CONSTRAINT `fk_a` FOREIGN KEY (`a2_new`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `fk_b` FOREIGN KEY (`a1_new`) REFERENCES `parent` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * from information_schema.INNODB_SYS_FOREIGN; ID FOR_NAME REF_NAME N_COLS TYPE test/fk_a test/child test/parent 1 6 @@ -470,7 +470,7 @@ ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1_new) REFERENCES parent(b), ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2_new) REFERENCES parent(a), ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(c), ALGORITHM = INPLACE; -ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_new_3' in the referenced table 'parent' +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_new_3' in the referenced table 'parent' SHOW CREATE TABLE child; Table Create Table child CREATE TABLE `child` ( @@ -481,7 +481,7 @@ child CREATE TABLE `child` ( KEY `fk_b` (`a1_new`), CONSTRAINT `fk_a` FOREIGN KEY (`a2_new`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `fk_b` FOREIGN KEY (`a1_new`) REFERENCES `parent` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * from information_schema.INNODB_SYS_FOREIGN; ID FOR_NAME REF_NAME N_COLS TYPE test/fk_a test/child test/parent 1 6 @@ -509,7 +509,7 @@ child CREATE TABLE `child` ( CONSTRAINT `fk_new_1` FOREIGN KEY (`a1_new`) REFERENCES `parent` (`b`), CONSTRAINT `fk_new_2` FOREIGN KEY (`a2_new`) REFERENCES `parent` (`a`), CONSTRAINT `fk_new_3` FOREIGN KEY (`a3`) REFERENCES `parent` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * from information_schema.INNODB_SYS_FOREIGN; ID FOR_NAME REF_NAME N_COLS TYPE test/fk_a test/child test/parent 1 6 @@ -532,7 +532,7 @@ ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1) REFERENCES parent(b), ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2) REFERENCES parent(a), ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(c), ALGORITHM = INPLACE; -ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_new_3' in the referenced table 'parent' +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_new_3' in the referenced table 'parent' SHOW CREATE TABLE child; Table Create Table child CREATE TABLE `child` ( @@ -540,7 +540,7 @@ child CREATE TABLE `child` ( `a2` int(11) DEFAULT NULL, `a3` int(11) DEFAULT NULL, KEY `tb` (`a2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * from information_schema.INNODB_SYS_FOREIGN; ID FOR_NAME REF_NAME N_COLS TYPE SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS; @@ -564,7 +564,7 @@ child CREATE TABLE `child` ( CONSTRAINT `fk_new_1` FOREIGN KEY (`a1`) REFERENCES `parent` (`b`), CONSTRAINT `fk_new_2` FOREIGN KEY (`a2`) REFERENCES `parent` (`a`), CONSTRAINT `fk_new_3` FOREIGN KEY (`a3`) REFERENCES `parent` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * from information_schema.INNODB_SYS_FOREIGN; ID FOR_NAME REF_NAME N_COLS TYPE test/fk_new_1 test/child test/parent 1 0 diff --git a/mysql-test/suite/innodb/r/innodb-index-online.result b/mysql-test/suite/innodb/r/innodb-index-online.result index 1ee352cd402bc..7138c5d7a1830 100644 --- a/mysql-test/suite/innodb/r/innodb-index-online.result +++ b/mysql-test/suite/innodb/r/innodb-index-online.result @@ -54,7 +54,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, `c3` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 BEGIN; INSERT INTO t1 VALUES(7,4,2); connection con1; @@ -85,7 +85,8 @@ ddl_sort_file_alter_table 0 ddl_log_file_alter_table 0 BEGIN; INSERT INTO t1 VALUES(7,4,2); -ROLLBACK; +COMMIT; +DELETE FROM t1 where c1 = 7; SET DEBUG_SYNC = 'now SIGNAL rollback_done'; connection con1; ERROR 23000: Duplicate entry '4' for key 'c2' @@ -96,14 +97,14 @@ SET DEBUG_SYNC = 'now WAIT_FOR created'; SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; name count ddl_background_drop_indexes 0 -ddl_online_create_index 0 +ddl_online_create_index 1 ddl_pending_alter_table 1 ddl_sort_file_alter_table 0 ddl_log_file_alter_table 0 INSERT INTO t1 VALUES(6,3,1); SET DEBUG_SYNC = 'now SIGNAL dml_done'; connection con1; -ERROR 23000: Duplicate entry for key 'c2' +ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' DELETE FROM t1 WHERE c1=6; ALTER TABLE t1 ADD UNIQUE INDEX(c2); SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; @@ -217,7 +218,7 @@ t1 CREATE TABLE `t1` ( `c3` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2d` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=1 connection default; SET @merge_encrypt_0= (SELECT variable_value FROM information_schema.global_status @@ -243,38 +244,22 @@ ddl_online_create_index 1 ddl_pending_alter_table 1 ddl_sort_file_alter_table 0 ddl_log_file_alter_table 0 -BEGIN; -DELETE FROM t1; -ROLLBACK; UPDATE t1 SET c2 = c2 + 1; -BEGIN; +UPDATE t1 SET c2 = c2 + 2; UPDATE t1 SET c2 = c2 + 1; -DELETE FROM t1; -ROLLBACK; -BEGIN; -DELETE FROM t1; -ROLLBACK; +UPDATE t1 SET c2 = c2 + 2; UPDATE t1 SET c2 = c2 + 1; -BEGIN; +UPDATE t1 SET c2 = c2 + 2; UPDATE t1 SET c2 = c2 + 1; -DELETE FROM t1; -ROLLBACK; -BEGIN; -DELETE FROM t1; -ROLLBACK; +UPDATE t1 SET c2 = c2 + 2; UPDATE t1 SET c2 = c2 + 1; -BEGIN; +UPDATE t1 SET c2 = c2 + 2; UPDATE t1 SET c2 = c2 + 1; -DELETE FROM t1; -ROLLBACK; -BEGIN; -DELETE FROM t1; -ROLLBACK; +UPDATE t1 SET c2 = c2 + 2; UPDATE t1 SET c2 = c2 + 1; -BEGIN; +UPDATE t1 SET c2 = c2 + 2; UPDATE t1 SET c2 = c2 + 1; -DELETE FROM t1; -ROLLBACK; +UPDATE t1 SET c2 = c2 + 2; SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; name count ddl_background_drop_indexes 0 @@ -310,7 +295,7 @@ ERROR HY000: Creating index 'c2e' required more than 'innodb_online_alter_log_ma SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; name count ddl_background_drop_indexes 1 -ddl_online_create_index 0 +ddl_online_create_index 1 ddl_pending_alter_table 0 ddl_sort_file_alter_table 0 ddl_log_file_alter_table 1 @@ -321,7 +306,7 @@ name pos SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; name count ddl_background_drop_indexes 1 -ddl_online_create_index 0 +ddl_online_create_index 1 ddl_pending_alter_table 0 ddl_sort_file_alter_table 0 ddl_log_file_alter_table 1 @@ -348,7 +333,7 @@ SET @rowlog_decrypt_1= WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted'); connection con1; SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2f_created WAIT_FOR dml3_done'; -ALTER TABLE t1 ADD INDEX c2f(c2); +ALTER TABLE t1 ADD INDEX c2f(c22f), CHANGE c2 c22f INT; connection default; SET DEBUG_SYNC = 'now WAIT_FOR c2f_created'; SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; @@ -361,19 +346,45 @@ ddl_log_file_alter_table 1 BEGIN; INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160; DELETE FROM t1 WHERE c1 > 320; -ROLLBACK; +COMMIT; BEGIN; UPDATE t1 SET c2 = c2 + 1; -DELETE FROM t1; -ROLLBACK; +COMMIT; BEGIN; INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160; DELETE FROM t1 WHERE c1 > 320; -ROLLBACK; +COMMIT; BEGIN; UPDATE t1 SET c2 = c2 + 1; -DELETE FROM t1; -ROLLBACK; +COMMIT; +BEGIN; +INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160; +DELETE FROM t1 WHERE c1 > 320; +COMMIT; +BEGIN; +UPDATE t1 SET c2 = c2 + 1; +COMMIT; +BEGIN; +INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160; +DELETE FROM t1 WHERE c1 > 320; +COMMIT; +BEGIN; +UPDATE t1 SET c2 = c2 + 1; +COMMIT; +BEGIN; +INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160; +DELETE FROM t1 WHERE c1 > 320; +COMMIT; +BEGIN; +UPDATE t1 SET c2 = c2 + 1; +COMMIT; +BEGIN; +INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160; +DELETE FROM t1 WHERE c1 > 320; +COMMIT; +BEGIN; +UPDATE t1 SET c2 = c2 + 1; +COMMIT; SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; name count ddl_background_drop_indexes 0 @@ -385,7 +396,6 @@ SET DEBUG_SYNC = 'now SIGNAL dml3_done'; connection con1; Warnings: Note 1831 Duplicate index `c2f`. This is deprecated and will be disallowed in a future release -ALTER TABLE t1 CHANGE c2 c22f INT; SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; name count ddl_background_drop_indexes 0 @@ -452,7 +462,7 @@ name pos SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; name count ddl_background_drop_indexes 1 -ddl_online_create_index 0 +ddl_online_create_index 1 ddl_pending_alter_table 0 ddl_sort_file_alter_table 0 ddl_log_file_alter_table 2 @@ -460,7 +470,7 @@ connection default; SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; name count ddl_background_drop_indexes 1 -ddl_online_create_index 0 +ddl_online_create_index 1 ddl_pending_alter_table 0 ddl_sort_file_alter_table 0 ddl_log_file_alter_table 2 @@ -474,7 +484,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`c1`), KEY `c2d` (`c22f`), KEY `c2f` (`c22f`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1 COMMENT='testing if c2e will be dropped' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=1 COMMENT='testing if c2e will be dropped' ALTER TABLE t1 DROP INDEX c2d, DROP INDEX c2f; SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; name count @@ -498,7 +508,6 @@ SET DEBUG_SYNC = 'row_log_apply_before SIGNAL t1u_created WAIT_FOR dup_done'; ALTER TABLE t1 ADD UNIQUE(c); connection con1; SET DEBUG_SYNC = 'now WAIT_FOR t1u_created'; -BEGIN; INSERT INTO t1 VALUES('bar'),('bar'); SET DEBUG_SYNC = 'now SIGNAL dup_done'; connection default; diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result index 1bcb4e620bbb8..a76837b91a2b2 100644 --- a/mysql-test/suite/innodb/r/innodb-index.result +++ b/mysql-test/suite/innodb/r/innodb-index.result @@ -23,7 +23,7 @@ t1 CREATE TABLE `t1` ( `c` char(10) NOT NULL, `d` varchar(20) DEFAULT NULL, KEY `d2` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci analyze table t1; explain select * from t1 force index(d2) order by d; id select_type table type possible_keys key key_len ref rows Extra @@ -44,7 +44,7 @@ t1 CREATE TABLE `t1` ( `c` char(10) NOT NULL, `d` varchar(20) DEFAULT NULL, KEY `d2` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 add index (b); affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 @@ -57,7 +57,7 @@ t1 CREATE TABLE `t1` ( `d` varchar(20) DEFAULT NULL, KEY `d2` (`d`), KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 add unique index (c), add index (d); affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 1 @@ -74,7 +74,7 @@ t1 CREATE TABLE `t1` ( KEY `d2` (`d`), KEY `b` (`b`), KEY `d` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected @@ -96,7 +96,7 @@ t1 CREATE TABLE `t1` ( KEY `d2` (`d`), KEY `b` (`b`), KEY `d` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci affected rows: 1 alter table t1 add primary key (c); ERROR 42000: Multiple primary key defined @@ -117,7 +117,7 @@ t1 CREATE TABLE `t1` ( KEY `d2` (`d`), KEY `b` (`b`), KEY `d` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected @@ -146,7 +146,7 @@ t1 CREATE TABLE `t1` ( KEY `d2` (`d`), KEY `b` (`b`), KEY `d` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values(6,1,'ggg','ggg'); select * from t1; a b c d @@ -198,7 +198,7 @@ t1 CREATE TABLE `t1` ( KEY `d2` (`d`), KEY `b` (`b`), KEY `d` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb; insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ad','ad'),(4,4,'afe','afe'); @@ -215,7 +215,7 @@ t1 CREATE TABLE `t1` ( `d` varchar(20) DEFAULT NULL, PRIMARY KEY (`a`), KEY `c` (`c`(2)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci affected rows: 1 alter table t1 add unique index (d(10)); affected rows: 0 @@ -230,7 +230,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`a`), UNIQUE KEY `d` (`d`(10)), KEY `c` (`c`(2)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci affected rows: 1 insert into t1 values(5,1,'ggg','ggg'); analyze table t1; @@ -274,7 +274,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`a`), UNIQUE KEY `d` (`d`(10)), KEY `c` (`c`(2)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 drop index d; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 @@ -314,7 +314,7 @@ t1 CREATE TABLE `t1` ( `d` varchar(20) DEFAULT NULL, PRIMARY KEY (`a`), KEY `c` (`c`(2)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb; insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe'); @@ -350,7 +350,7 @@ t1 CREATE TABLE `t1` ( `d` varchar(20) DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`,`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 add index (b,c); affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 @@ -385,7 +385,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`,`c`), KEY `b_2` (`b`,`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 add unique index (c,d); affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 @@ -435,7 +435,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `b` (`b`,`c`), UNIQUE KEY `c` (`c`,`d`), KEY `b_2` (`b`,`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(a int not null, b int not null, c int, primary key (a), key (b)) engine = innodb; create table t3(a int not null, c int not null, d int, primary key (a), key (c)) engine = innodb; @@ -506,7 +506,7 @@ t4 CREATE TABLE `t4` ( PRIMARY KEY (`a`), KEY `d` (`d`), CONSTRAINT `dc` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t3 add constraint dc foreign key (a) references t1(a); ERROR HY000: Can't create table `test`.`t3` (errno: 121 "Duplicate key on write or update") SET FOREIGN_KEY_CHECKS=0; @@ -521,7 +521,7 @@ t3 CREATE TABLE `t3` ( `d` int(11) DEFAULT NULL, PRIMARY KEY (`a`), KEY `c` (`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t2 drop index b, add index (beta); affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 @@ -540,7 +540,7 @@ t2 CREATE TABLE `t2` ( CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`beta`) REFERENCES `t1` (`b`) ON DELETE SET NULL, CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`c`) REFERENCES `t3` (`c`), CONSTRAINT `t2_ibfk_3` FOREIGN KEY (`d`) REFERENCES `t4` (`d`) ON UPDATE SET NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci delete from t1; ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `dc` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) drop index dc on t4; @@ -579,7 +579,7 @@ t1 CREATE TABLE `t1` ( `c` char(10) DEFAULT NULL, `d` varchar(20) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci alter table t1 add index (b); insert into t1 values(10,10,'kkk','iii'); select * from t1; @@ -610,7 +610,7 @@ t1 CREATE TABLE `t1` ( `d` varchar(20) DEFAULT NULL, PRIMARY KEY (`a`), KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci alter table t1 add unique index (c), add index (d); insert into t1 values(11,11,'aaa','mmm'); select * from t1; @@ -669,7 +669,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c` (`c`), KEY `b` (`b`), KEY `d` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci check table t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -687,7 +687,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(a int not null, c int not null,b int, primary key(a), unique key(c), key(b)) engine = innodb; alter table t1 drop index c, drop index b; @@ -698,7 +698,7 @@ t1 CREATE TABLE `t1` ( `c` int(11) NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(a int not null, b int, primary key(a)) engine = innodb; alter table t1 add index (b); @@ -709,7 +709,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`), KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb; insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe'); @@ -725,7 +725,7 @@ t1 CREATE TABLE `t1` ( `c` char(10) DEFAULT NULL, `d` varchar(20) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(a int not null, b int not null, c int, primary key (a), key(c)) engine=innodb; insert into t1 values (5,1,5),(4,2,4),(3,3,3),(2,4,2),(1,5,1); @@ -742,7 +742,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`), KEY `c` (`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci check table t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -802,7 +802,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL, PRIMARY KEY (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci check table t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -838,7 +838,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci check table t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -883,7 +883,7 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`c1`), KEY `fk_t2_ca` (`c3`), CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE INDEX i_t2_c3_c2 ON t2(c3, c2); SHOW CREATE TABLE t2; Table Create Table @@ -894,7 +894,7 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`c1`), KEY `i_t2_c3_c2` (`c3`,`c2`), CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; INSERT INTO t2 VALUES(0,0,0); @@ -921,7 +921,7 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`c1`,`c2`,`c3`), KEY `fk_t2_ca` (`c3`), CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE INDEX i_t2_c3_c2 ON t2(c3, c2); SHOW CREATE TABLE t2; Table Create Table @@ -932,7 +932,7 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`c1`,`c2`,`c3`), KEY `i_t2_c3_c2` (`c3`,`c2`), CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t2 VALUES(0,0,1); ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`)) INSERT INTO t2 VALUES(0,0,0); @@ -958,13 +958,13 @@ FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1), ALGORITHM=COPY; ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1); -ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1' +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1' ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2), ALGORITHM=COPY; ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2); -ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1' +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1' ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1), ALGORITHM=INPLACE; ERROR HY000: Failed to add the foreign key constraint on table 't2'. Incorrect options in FOREIGN KEY constraint 'test/fk_t2_ca' @@ -979,7 +979,7 @@ FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2), ALGORITHM=COPY; ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2); -ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1' +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1' ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1); affected rows: 0 @@ -992,7 +992,7 @@ t1 CREATE TABLE `t1` ( `c1` bigint(12) NOT NULL, `c2` bigint(12) NOT NULL, PRIMARY KEY (`c2`,`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci affected rows: 1 SHOW CREATE TABLE t2; Table Create Table @@ -1003,7 +1003,7 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`c1`), KEY `fk_t2_ca` (`c3`,`c2`), CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci affected rows: 1 CREATE INDEX i_t2_c2_c1 ON t2(c2, c1); affected rows: 0 @@ -1018,7 +1018,7 @@ t2 CREATE TABLE `t2` ( KEY `fk_t2_ca` (`c3`,`c2`), KEY `i_t2_c2_c1` (`c2`,`c1`), CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci affected rows: 1 CREATE INDEX i_t2_c3_c1_c2 ON t2(c3, c1, c2); affected rows: 0 @@ -1034,7 +1034,7 @@ t2 CREATE TABLE `t2` ( KEY `i_t2_c2_c1` (`c2`,`c1`), KEY `i_t2_c3_c1_c2` (`c3`,`c1`,`c2`), CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci affected rows: 1 CREATE INDEX i_t2_c3_c2 ON t2(c3, c2); affected rows: 0 @@ -1050,7 +1050,7 @@ t2 CREATE TABLE `t2` ( KEY `i_t2_c3_c1_c2` (`c3`,`c1`,`c2`), KEY `i_t2_c3_c2` (`c3`,`c2`), CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci affected rows: 1 DROP TABLE t2; DROP TABLE t1; @@ -1170,7 +1170,7 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` char(1) DEFAULT NULL, KEY `t2a` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2i; Table Create Table t2i CREATE TABLE `t2i` ( @@ -1178,7 +1178,7 @@ t2i CREATE TABLE `t2i` ( `b` char(1) NOT NULL, PRIMARY KEY (`a`,`b`), KEY `t2a` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2c; Table Create Table t2c CREATE TABLE `t2c` ( @@ -1186,7 +1186,7 @@ t2c CREATE TABLE `t2c` ( `b` char(1) NOT NULL, PRIMARY KEY (`a`,`b`), KEY `t2a` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2,t2c,t2i; CREATE TABLE t1 (c VARCHAR(1024), c1 CHAR(255) NOT NULL,c2 CHAR(255) NOT NULL,c3 CHAR(255) NOT NULL, @@ -1942,8 +1942,56 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL, KEY `i1` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Warnings: Warning 1082 InnoDB: Table test/t contains 0 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB Warning 1082 InnoDB: Table test/t contains 0 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB DROP TABLE t; +# +# MDEV-27374 InnoDB table becomes corrupt after renaming DESC-indexed column +# +CREATE TABLE t1 (a VARCHAR(8), PRIMARY KEY(a DESC)) ENGINE=InnoDB; +ALTER TABLE t1 RENAME COLUMN a TO b, ALGORITHM=INPLACE; +SELECT TABLE_ID INTO @table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME="test/t1"; +SELECT INDEX_ID INTO @index_id FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE TABLE_ID = @table_id; +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS WHERE INDEX_ID=@index_id; +NAME +b +DROP TABLE t1; +# +# MDEV-27432 ASC/DESC primary and unique keys cause index +# inconsistency between InnoDB and server +# +CREATE TABLE t1 (id INT NOT NULL, UNIQUE(id DESC)) ENGINE=InnoDB; +ALTER TABLE t1 ADD PRIMARY KEY (id), ALGORITHM=INPLACE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `id` (`id` DESC) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# +# MDEV-27445 Index inconsistency and assertion failure after +# renaming virtual column with DESC key +# +CREATE TABLE t1(a INT, b INT AS (a), KEY(a, b DESC)) ENGINE=InnoDB; +ALTER TABLE t1 RENAME COLUMN IF EXISTS b TO v; +ALTER TABLE t1 FORCE; +DROP TABLE t1; +# +# MDEV-27592 DESC primary index fails to set wide format +# while renaming the column +# +CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(8), b INT, KEY(a DESC,b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,'foo',10); +ALTER TABLE t1 RENAME COLUMN b TO c, ALGORITHM=INPLACE; +SELECT TABLE_ID INTO @table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME="test/t1"; +SELECT INDEX_ID INTO @index_id FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE TABLE_ID = @table_id ORDER BY INDEX_ID DESC LIMIT 1; +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS WHERE INDEX_ID=@index_id; +NAME +a +c +DROP TABLE t1; +# End of 10.8 tests diff --git a/mysql-test/suite/innodb/r/innodb-index_ucs2.result b/mysql-test/suite/innodb/r/innodb-index_ucs2.result index c8a1e8c7da15a..a6e38280bcbb4 100644 --- a/mysql-test/suite/innodb/r/innodb-index_ucs2.result +++ b/mysql-test/suite/innodb/r/innodb-index_ucs2.result @@ -19,7 +19,7 @@ t1 CREATE TABLE `t1` ( `c` char(10) DEFAULT NULL, `d` varchar(20) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci alter table t1 add index (b); insert into t1 values(10,10,'kkk','iii'); select * from t1; @@ -50,7 +50,7 @@ t1 CREATE TABLE `t1` ( `d` varchar(20) DEFAULT NULL, PRIMARY KEY (`a`), KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci alter table t1 add unique index (c), add index (d); insert into t1 values(11,11,'aaa','mmm'); select * from t1; @@ -109,7 +109,7 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c` (`c`), KEY `b` (`b`), KEY `d` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci check table t1; Table Op Msg_type Msg_text test.t1 check status OK diff --git a/mysql-test/suite/innodb/r/innodb-mdev7046.result b/mysql-test/suite/innodb/r/innodb-mdev7046.result index 08f0ac24f9cd3..f65c0ff4e2599 100644 --- a/mysql-test/suite/innodb/r/innodb-mdev7046.result +++ b/mysql-test/suite/innodb/r/innodb-mdev7046.result @@ -1,3 +1,3 @@ show create database test; Database Create Database -test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ +test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ diff --git a/mysql-test/suite/innodb/r/innodb-online-alter-gis.result b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result index 65dc23ddf2cc1..6a57be49ac5e8 100644 --- a/mysql-test/suite/innodb/r/innodb-online-alter-gis.result +++ b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result @@ -22,7 +22,7 @@ t1 CREATE TABLE `t1` ( `d` int(11) DEFAULT NULL, SPATIAL KEY `c` (`b`), KEY `d` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d; ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED show warnings; @@ -61,7 +61,7 @@ t1 CREATE TABLE `t1` ( `f3` linestring NOT NULL, PRIMARY KEY (`f1`), SPATIAL KEY `f3` (`f3`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 INSERT INTO t1 VALUES (1, ST_linefromtext(concat('linestring', '( 0 0, 1 1, 2 2, 3 3, 4 4, 5 5, 6 6, 7 7, 8 8, 9 9, 10 10, 11 11, 12 12, 13 13, 14 14, 15 15, 16 16, 17 17, 18 18, 19 19, 20 20, 21 21, 22 22, 23 23, 24 24, 25 25, 26 26, 27 27, 28 28, 29 29, 30 30, 31 31, 32 32, 33 33, 34 34, 35 35, 36 36, 37 37, 38 38, 39 39, 40 40, 41 41, 42 42, 43 43, 44 44, 45 45, 46 46, 47 47, 48 48, 49 49, 50 50, 51 51, 52 52, 53 53, 54 54, 55 55, 56 56, 57 57, 58 58, 59 59, 60 60, 61 61, 62 62, 63 63, 64 64, 65 65, 66 66, 67 67, 68 68, 69 69, 70 70, 71 71, 72 72, 73 73, 74 74, 75 75, 76 76, 77 77, 78 78, 79 79, 9999 9999)')));; ALTER TABLE t1 ROW_FORMAT = DYNAMIC, KEY_BLOCK_SIZE=0, ALGORITHM=INPLACE; DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_bzip2.result b/mysql-test/suite/innodb/r/innodb-page_compression_bzip2.result deleted file mode 100644 index 34b0d9431b513..0000000000000 --- a/mysql-test/suite/innodb/r/innodb-page_compression_bzip2.result +++ /dev/null @@ -1,444 +0,0 @@ -set global innodb_compression_algorithm = 5; -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -Level Code Message -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -Level Code Message -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -Level Code Message -show create table innodb_page_compressed1; -Table Create Table -innodb_page_compressed1 CREATE TABLE `innodb_page_compressed1` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=1 -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -Level Code Message -show create table innodb_page_compressed2; -Table Create Table -innodb_page_compressed2 CREATE TABLE `innodb_page_compressed2` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=2 -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -Level Code Message -show create table innodb_page_compressed3; -Table Create Table -innodb_page_compressed3 CREATE TABLE `innodb_page_compressed3` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=3 -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -Level Code Message -show create table innodb_page_compressed4; -Table Create Table -innodb_page_compressed4 CREATE TABLE `innodb_page_compressed4` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=4 -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -Level Code Message -show create table innodb_page_compressed5; -Table Create Table -innodb_page_compressed5 CREATE TABLE `innodb_page_compressed5` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=5 -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -Level Code Message -show create table innodb_page_compressed6; -Table Create Table -innodb_page_compressed6 CREATE TABLE `innodb_page_compressed6` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=6 -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -Level Code Message -show create table innodb_page_compressed7; -Table Create Table -innodb_page_compressed7 CREATE TABLE `innodb_page_compressed7` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=7 -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -Level Code Message -show create table innodb_page_compressed8; -Table Create Table -innodb_page_compressed8 CREATE TABLE `innodb_page_compressed8` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -Level Code Message -show create table innodb_page_compressed9; -Table Create Table -innodb_page_compressed9 CREATE TABLE `innodb_page_compressed9` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=9 -create procedure innodb_insert_proc (repeat_count int) -begin -declare current_num int; -set current_num = 0; -while current_num < repeat_count do -insert into innodb_normal values(current_num,'testing..'); -set current_num = current_num + 1; -end while; -end// -commit; -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -count(*) -5000 -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -alter table innodb_normal page_compressed=1 page_compression_level=8, -algorithm=instant; -show warnings; -Level Code Message -show create table innodb_normal; -Table Create Table -innodb_normal CREATE TABLE `innodb_normal` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=instant; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACE -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=nocopy; -ERROR 0A000: ALGORITHM=NOCOPY is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACE -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -Level Code Message -show create table innodb_compressed; -Table Create Table -innodb_compressed CREATE TABLE `innodb_compressed` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -# restart -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -set global innodb_compression_algorithm = 1; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -# restart -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -set global innodb_compression_algorithm = 0; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -# restart -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_default.result b/mysql-test/suite/innodb/r/innodb-page_compression_default.result deleted file mode 100644 index 4610d251fc029..0000000000000 --- a/mysql-test/suite/innodb/r/innodb-page_compression_default.result +++ /dev/null @@ -1,96 +0,0 @@ -create table innodb_normal (c1 int not null auto_increment primary key, b char(200)) engine=innodb; -create table innodb_page_compressed1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; -create table innodb_page_compressed2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; -create table innodb_page_compressed3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; -create table innodb_page_compressed4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; -create table innodb_page_compressed5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; -create table innodb_page_compressed6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; -create table innodb_page_compressed7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; -create table innodb_page_compressed8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; -create table innodb_page_compressed9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; -select count(*) from innodb_page_compressed1; -count(*) -10000 -select count(*) from innodb_page_compressed3; -count(*) -10000 -select count(*) from innodb_page_compressed4; -count(*) -10000 -select count(*) from innodb_page_compressed5; -count(*) -10000 -select count(*) from innodb_page_compressed6; -count(*) -10000 -select count(*) from innodb_page_compressed6; -count(*) -10000 -select count(*) from innodb_page_compressed7; -count(*) -10000 -select count(*) from innodb_page_compressed8; -count(*) -10000 -select count(*) from innodb_page_compressed9; -count(*) -10000 -# innodb_normal expected FOUND -FOUND 24084 /AaAaAaAa/ in innodb_normal.ibd -# innodb_page_compressed1 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed1.ibd -# innodb_page_compressed2 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed2.ibd -# innodb_page_compressed3 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed3.ibd -# innodb_page_compressed4 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed4.ibd -# innodb_page_compressed5 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed5.ibd -# innodb_page_compressed6 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed6.ibd -# innodb_page_compressed7 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed7.ibd -# innodb_page_compressed8 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed8.ibd -# innodb_page_compressed9 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed9.ibd -# restart -select count(*) from innodb_page_compressed1; -count(*) -10000 -select count(*) from innodb_page_compressed3; -count(*) -10000 -select count(*) from innodb_page_compressed4; -count(*) -10000 -select count(*) from innodb_page_compressed5; -count(*) -10000 -select count(*) from innodb_page_compressed6; -count(*) -10000 -select count(*) from innodb_page_compressed6; -count(*) -10000 -select count(*) from innodb_page_compressed7; -count(*) -10000 -select count(*) from innodb_page_compressed8; -count(*) -10000 -select count(*) from innodb_page_compressed9; -count(*) -10000 -drop table innodb_normal; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; -#done diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_lz4.result b/mysql-test/suite/innodb/r/innodb-page_compression_lz4.result deleted file mode 100644 index 8ea650c2241ac..0000000000000 --- a/mysql-test/suite/innodb/r/innodb-page_compression_lz4.result +++ /dev/null @@ -1,444 +0,0 @@ -set global innodb_compression_algorithm = 2; -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -Level Code Message -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -Level Code Message -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -Level Code Message -show create table innodb_page_compressed1; -Table Create Table -innodb_page_compressed1 CREATE TABLE `innodb_page_compressed1` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=1 -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -Level Code Message -show create table innodb_page_compressed2; -Table Create Table -innodb_page_compressed2 CREATE TABLE `innodb_page_compressed2` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=2 -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -Level Code Message -show create table innodb_page_compressed3; -Table Create Table -innodb_page_compressed3 CREATE TABLE `innodb_page_compressed3` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=3 -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -Level Code Message -show create table innodb_page_compressed4; -Table Create Table -innodb_page_compressed4 CREATE TABLE `innodb_page_compressed4` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=4 -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -Level Code Message -show create table innodb_page_compressed5; -Table Create Table -innodb_page_compressed5 CREATE TABLE `innodb_page_compressed5` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=5 -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -Level Code Message -show create table innodb_page_compressed6; -Table Create Table -innodb_page_compressed6 CREATE TABLE `innodb_page_compressed6` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=6 -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -Level Code Message -show create table innodb_page_compressed7; -Table Create Table -innodb_page_compressed7 CREATE TABLE `innodb_page_compressed7` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=7 -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -Level Code Message -show create table innodb_page_compressed8; -Table Create Table -innodb_page_compressed8 CREATE TABLE `innodb_page_compressed8` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -Level Code Message -show create table innodb_page_compressed9; -Table Create Table -innodb_page_compressed9 CREATE TABLE `innodb_page_compressed9` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=9 -create procedure innodb_insert_proc (repeat_count int) -begin -declare current_num int; -set current_num = 0; -while current_num < repeat_count do -insert into innodb_normal values(current_num,'testing..'); -set current_num = current_num + 1; -end while; -end// -commit; -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -count(*) -5000 -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -alter table innodb_normal page_compressed=1 page_compression_level=8, -algorithm=instant; -show warnings; -Level Code Message -show create table innodb_normal; -Table Create Table -innodb_normal CREATE TABLE `innodb_normal` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=instant; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACE -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=nocopy; -ERROR 0A000: ALGORITHM=NOCOPY is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACE -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -Level Code Message -show create table innodb_compressed; -Table Create Table -innodb_compressed CREATE TABLE `innodb_compressed` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -# restart -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -set global innodb_compression_algorithm = 1; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -# restart -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -set global innodb_compression_algorithm = 0; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -# restart -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_lzma.result b/mysql-test/suite/innodb/r/innodb-page_compression_lzma.result deleted file mode 100644 index 4206b0b83d4e0..0000000000000 --- a/mysql-test/suite/innodb/r/innodb-page_compression_lzma.result +++ /dev/null @@ -1,444 +0,0 @@ -set global innodb_compression_algorithm = 4; -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -Level Code Message -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -Level Code Message -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -Level Code Message -show create table innodb_page_compressed1; -Table Create Table -innodb_page_compressed1 CREATE TABLE `innodb_page_compressed1` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=1 -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -Level Code Message -show create table innodb_page_compressed2; -Table Create Table -innodb_page_compressed2 CREATE TABLE `innodb_page_compressed2` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=2 -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -Level Code Message -show create table innodb_page_compressed3; -Table Create Table -innodb_page_compressed3 CREATE TABLE `innodb_page_compressed3` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=3 -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -Level Code Message -show create table innodb_page_compressed4; -Table Create Table -innodb_page_compressed4 CREATE TABLE `innodb_page_compressed4` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=4 -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -Level Code Message -show create table innodb_page_compressed5; -Table Create Table -innodb_page_compressed5 CREATE TABLE `innodb_page_compressed5` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=5 -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -Level Code Message -show create table innodb_page_compressed6; -Table Create Table -innodb_page_compressed6 CREATE TABLE `innodb_page_compressed6` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=6 -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -Level Code Message -show create table innodb_page_compressed7; -Table Create Table -innodb_page_compressed7 CREATE TABLE `innodb_page_compressed7` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=7 -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -Level Code Message -show create table innodb_page_compressed8; -Table Create Table -innodb_page_compressed8 CREATE TABLE `innodb_page_compressed8` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -Level Code Message -show create table innodb_page_compressed9; -Table Create Table -innodb_page_compressed9 CREATE TABLE `innodb_page_compressed9` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=9 -create procedure innodb_insert_proc (repeat_count int) -begin -declare current_num int; -set current_num = 0; -while current_num < repeat_count do -insert into innodb_normal values(current_num,'testing..'); -set current_num = current_num + 1; -end while; -end// -commit; -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -count(*) -5000 -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -alter table innodb_normal page_compressed=1 page_compression_level=8, -algorithm=instant; -show warnings; -Level Code Message -show create table innodb_normal; -Table Create Table -innodb_normal CREATE TABLE `innodb_normal` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=instant; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACE -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=nocopy; -ERROR 0A000: ALGORITHM=NOCOPY is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACE -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -Level Code Message -show create table innodb_compressed; -Table Create Table -innodb_compressed CREATE TABLE `innodb_compressed` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -# restart -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -set global innodb_compression_algorithm = 1; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -# restart -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -set global innodb_compression_algorithm = 0; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -# restart -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_lzo.result b/mysql-test/suite/innodb/r/innodb-page_compression_lzo.result deleted file mode 100644 index c440d28ddd30f..0000000000000 --- a/mysql-test/suite/innodb/r/innodb-page_compression_lzo.result +++ /dev/null @@ -1,357 +0,0 @@ -set global innodb_compression_algorithm = 3; -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -Level Code Message -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -Level Code Message -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -Level Code Message -show create table innodb_page_compressed1; -Table Create Table -innodb_page_compressed1 CREATE TABLE `innodb_page_compressed1` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=1 -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -Level Code Message -show create table innodb_page_compressed2; -Table Create Table -innodb_page_compressed2 CREATE TABLE `innodb_page_compressed2` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=2 -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -Level Code Message -show create table innodb_page_compressed3; -Table Create Table -innodb_page_compressed3 CREATE TABLE `innodb_page_compressed3` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=3 -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -Level Code Message -show create table innodb_page_compressed4; -Table Create Table -innodb_page_compressed4 CREATE TABLE `innodb_page_compressed4` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=4 -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -Level Code Message -show create table innodb_page_compressed5; -Table Create Table -innodb_page_compressed5 CREATE TABLE `innodb_page_compressed5` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=5 -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -Level Code Message -show create table innodb_page_compressed6; -Table Create Table -innodb_page_compressed6 CREATE TABLE `innodb_page_compressed6` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=6 -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -Level Code Message -show create table innodb_page_compressed7; -Table Create Table -innodb_page_compressed7 CREATE TABLE `innodb_page_compressed7` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=7 -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -Level Code Message -show create table innodb_page_compressed8; -Table Create Table -innodb_page_compressed8 CREATE TABLE `innodb_page_compressed8` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -Level Code Message -show create table innodb_page_compressed9; -Table Create Table -innodb_page_compressed9 CREATE TABLE `innodb_page_compressed9` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=9 -create procedure innodb_insert_proc (repeat_count int) -begin -declare current_num int; -set current_num = 0; -while current_num < repeat_count do -insert into innodb_normal values(current_num,'testing..'); -set current_num = current_num + 1; -end while; -end// -commit; -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -count(*) -5000 -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -alter table innodb_normal page_compressed=1 page_compression_level=8, -algorithm=instant; -show warnings; -Level Code Message -show create table innodb_normal; -Table Create Table -innodb_normal CREATE TABLE `innodb_normal` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=instant; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACE -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=nocopy; -ERROR 0A000: ALGORITHM=NOCOPY is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACE -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -Level Code Message -show create table innodb_compressed; -Table Create Table -innodb_compressed CREATE TABLE `innodb_compressed` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -# restart -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -set global innodb_compression_algorithm = 1; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -# restart -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_snappy.result b/mysql-test/suite/innodb/r/innodb-page_compression_snappy.result deleted file mode 100644 index 2f675bcf1b45f..0000000000000 --- a/mysql-test/suite/innodb/r/innodb-page_compression_snappy.result +++ /dev/null @@ -1,97 +0,0 @@ -set global innodb_compression_algorithm = snappy; -create table innodb_normal (c1 int not null auto_increment primary key, b char(200)) engine=innodb; -create table innodb_page_compressed1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; -create table innodb_page_compressed2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; -create table innodb_page_compressed3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; -create table innodb_page_compressed4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; -create table innodb_page_compressed5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; -create table innodb_page_compressed6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; -create table innodb_page_compressed7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; -create table innodb_page_compressed8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; -create table innodb_page_compressed9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; -select count(*) from innodb_page_compressed1; -count(*) -10000 -select count(*) from innodb_page_compressed3; -count(*) -10000 -select count(*) from innodb_page_compressed4; -count(*) -10000 -select count(*) from innodb_page_compressed5; -count(*) -10000 -select count(*) from innodb_page_compressed6; -count(*) -10000 -select count(*) from innodb_page_compressed6; -count(*) -10000 -select count(*) from innodb_page_compressed7; -count(*) -10000 -select count(*) from innodb_page_compressed8; -count(*) -10000 -select count(*) from innodb_page_compressed9; -count(*) -10000 -# innodb_normal expected FOUND -FOUND 24084 /AaAaAaAa/ in innodb_normal.ibd -# innodb_page_compressed1 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed1.ibd -# innodb_page_compressed2 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed2.ibd -# innodb_page_compressed3 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed3.ibd -# innodb_page_compressed4 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed4.ibd -# innodb_page_compressed5 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed5.ibd -# innodb_page_compressed6 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed6.ibd -# innodb_page_compressed7 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed7.ibd -# innodb_page_compressed8 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed8.ibd -# innodb_page_compressed9 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed9.ibd -# restart -select count(*) from innodb_page_compressed1; -count(*) -10000 -select count(*) from innodb_page_compressed3; -count(*) -10000 -select count(*) from innodb_page_compressed4; -count(*) -10000 -select count(*) from innodb_page_compressed5; -count(*) -10000 -select count(*) from innodb_page_compressed6; -count(*) -10000 -select count(*) from innodb_page_compressed6; -count(*) -10000 -select count(*) from innodb_page_compressed7; -count(*) -10000 -select count(*) from innodb_page_compressed8; -count(*) -10000 -select count(*) from innodb_page_compressed9; -count(*) -10000 -drop table innodb_normal; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; -#done diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_tables.result b/mysql-test/suite/innodb/r/innodb-page_compression_tables.result deleted file mode 100644 index 693db6eb7ecd8..0000000000000 --- a/mysql-test/suite/innodb/r/innodb-page_compression_tables.result +++ /dev/null @@ -1,155 +0,0 @@ -set global innodb_compression_algorithm = 1; -create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb; -create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_compressed=1; -create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_compressed=1; -create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed page_compressed=1; -ERROR HY000: Can't create table `test`.`innodb_compressed` (errno: 140 "Wrong create options") -show warnings; -Level Code Message -Warning 140 InnoDB: PAGE_COMPRESSED table can't have ROW_TYPE=COMPRESSED -Error 1005 Can't create table `test`.`innodb_compressed` (errno: 140 "Wrong create options") -Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB -show create table innodb_compact; -Table Create Table -innodb_compact CREATE TABLE `innodb_compact` ( - `c1` bigint(20) NOT NULL, - `b` char(200) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT `page_compressed`=1 -show create table innodb_dynamic; -Table Create Table -innodb_dynamic CREATE TABLE `innodb_dynamic` ( - `c1` bigint(20) NOT NULL, - `b` char(200) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC `page_compressed`=1 -create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant page_compressed=1; -ERROR HY000: Can't create table `test`.`innodb_redundant` (errno: 140 "Wrong create options") -show warnings; -Level Code Message -Warning 140 InnoDB: PAGE_COMPRESSED table can't have ROW_TYPE=REDUNDANT -Error 1005 Can't create table `test`.`innodb_redundant` (errno: 140 "Wrong create options") -Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB -create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant; -show create table innodb_redundant; -Table Create Table -innodb_redundant CREATE TABLE `innodb_redundant` ( - `c1` bigint(20) NOT NULL, - `b` char(200) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT -alter table innodb_redundant page_compressed=1; -ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'PAGE_COMPRESSED' -show warnings; -Level Code Message -Warning 140 InnoDB: PAGE_COMPRESSED table can't have ROW_TYPE=REDUNDANT -Error 1478 Table storage engine 'InnoDB' does not support the create option 'PAGE_COMPRESSED' -show create table innodb_redundant; -Table Create Table -innodb_redundant CREATE TABLE `innodb_redundant` ( - `c1` bigint(20) NOT NULL, - `b` char(200) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT -alter table innodb_redundant row_format=compact page_compressed=1; -show create table innodb_redundant; -Table Create Table -innodb_redundant CREATE TABLE `innodb_redundant` ( - `c1` bigint(20) NOT NULL, - `b` char(200) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT `page_compressed`=1 -drop table innodb_redundant; -# -# MDEV-24455 Assertion `!m_freed_space' failed in mtr_t::start -# -CREATE TABLE t1 (a TEXT, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED='ON'; -BEGIN; -INSERT INTO t1 VALUES(REPEAT('x',81),REPEAT('x',8034)); -ROLLBACK; -DROP TABLE t1; -create procedure innodb_insert_proc (repeat_count int) -begin -declare current_num int; -set current_num = 0; -while current_num < repeat_count do -insert into innodb_normal values(current_num, substring(MD5(RAND()), -64)); -set current_num = current_num + 1; -end while; -end// -commit; -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -insert into innodb_compact select * from innodb_normal; -insert into innodb_dynamic select * from innodb_normal; -update innodb_compact set c1 = c1 + 1; -update innodb_dynamic set c1 = c1 + 1; -select count(*) from innodb_compact where c1 < 1500000; -count(*) -5000 -select count(*) from innodb_dynamic where c1 < 1500000; -count(*) -5000 -# restart -update innodb_compact set c1 = c1 + 1; -update innodb_dynamic set c1 = c1 + 1; -select count(*) from innodb_compact where c1 < 1500000; -count(*) -5000 -select count(*) from innodb_dynamic where c1 < 1500000; -count(*) -5000 -set global innodb_compression_algorithm = 0; -alter table innodb_compact page_compressed=DEFAULT, algorithm=instant; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACE -alter table innodb_compact page_compressed=DEFAULT; -alter table innodb_dynamic page_compressed=DEFAULT, algorithm=instant; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACE -alter table innodb_dynamic page_compressed=DEFAULT; -show create table innodb_compact; -Table Create Table -innodb_compact CREATE TABLE `innodb_compact` ( - `c1` bigint(20) NOT NULL, - `b` char(200) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT -show create table innodb_dynamic; -Table Create Table -innodb_dynamic CREATE TABLE `innodb_dynamic` ( - `c1` bigint(20) NOT NULL, - `b` char(200) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC -update innodb_compact set c1 = c1 + 1; -update innodb_dynamic set c1 = c1 + 1; -select count(*) from innodb_compact where c1 < 1500000; -count(*) -5000 -select count(*) from innodb_dynamic where c1 < 1500000; -count(*) -5000 -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compact; -drop table innodb_dynamic; -CREATE TABLE no_compression (id INT NOT NULL, name VARCHAR(200)) ENGINE=InnoDB; -SET SESSION innodb_compression_default = 1; -CREATE TABLE default_compression (id INT NOT NULL, name VARCHAR(200)) ENGINE=InnoDB; -CREATE TABLE explicit_no_compression (id INT NOT NULL, name VARCHAR(200)) ENGINE=InnoDB PAGE_COMPRESSED=0; -SHOW CREATE TABLE no_compression; -Table Create Table -no_compression CREATE TABLE `no_compression` ( - `id` int(11) NOT NULL, - `name` varchar(200) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW CREATE TABLE default_compression; -Table Create Table -default_compression CREATE TABLE `default_compression` ( - `id` int(11) NOT NULL, - `name` varchar(200) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`='ON' -SHOW CREATE TABLE explicit_no_compression; -Table Create Table -explicit_no_compression CREATE TABLE `explicit_no_compression` ( - `id` int(11) NOT NULL, - `name` varchar(200) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=0 -DROP TABLE no_compression; -DROP TABLE default_compression; -DROP TABLE explicit_no_compression; -SET SESSION innodb_compression_default = 0; diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_zip.result b/mysql-test/suite/innodb/r/innodb-page_compression_zip.result deleted file mode 100644 index f57ab6a82d2b0..0000000000000 --- a/mysql-test/suite/innodb/r/innodb-page_compression_zip.result +++ /dev/null @@ -1,356 +0,0 @@ -set global innodb_compression_algorithm = 1; -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -Level Code Message -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -Level Code Message -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -Level Code Message -show create table innodb_page_compressed1; -Table Create Table -innodb_page_compressed1 CREATE TABLE `innodb_page_compressed1` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=1 -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -Level Code Message -show create table innodb_page_compressed2; -Table Create Table -innodb_page_compressed2 CREATE TABLE `innodb_page_compressed2` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=2 -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -Level Code Message -show create table innodb_page_compressed3; -Table Create Table -innodb_page_compressed3 CREATE TABLE `innodb_page_compressed3` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=3 -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -Level Code Message -show create table innodb_page_compressed4; -Table Create Table -innodb_page_compressed4 CREATE TABLE `innodb_page_compressed4` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=4 -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -Level Code Message -show create table innodb_page_compressed5; -Table Create Table -innodb_page_compressed5 CREATE TABLE `innodb_page_compressed5` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=5 -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -Level Code Message -show create table innodb_page_compressed6; -Table Create Table -innodb_page_compressed6 CREATE TABLE `innodb_page_compressed6` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=6 -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -Level Code Message -show create table innodb_page_compressed7; -Table Create Table -innodb_page_compressed7 CREATE TABLE `innodb_page_compressed7` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=7 -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -Level Code Message -show create table innodb_page_compressed8; -Table Create Table -innodb_page_compressed8 CREATE TABLE `innodb_page_compressed8` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -Level Code Message -show create table innodb_page_compressed9; -Table Create Table -innodb_page_compressed9 CREATE TABLE `innodb_page_compressed9` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=9 -create procedure innodb_insert_proc (repeat_count int) -begin -declare current_num int; -set current_num = 0; -while current_num < repeat_count do -insert into innodb_normal values(current_num,'testing..'); -set current_num = current_num + 1; -end while; -end// -commit; -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -count(*) -5000 -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -alter table innodb_normal page_compressed=1 page_compression_level=8, -algorithm=instant; -show warnings; -Level Code Message -show create table innodb_normal; -Table Create Table -innodb_normal CREATE TABLE `innodb_normal` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=instant; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACE -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=nocopy; -ERROR 0A000: ALGORITHM=NOCOPY is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACE -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -Level Code Message -show create table innodb_compressed; -Table Create Table -innodb_compressed CREATE TABLE `innodb_compressed` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -# restart -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -set global innodb_compression_algorithm = 0; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -# restart -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; diff --git a/mysql-test/suite/innodb/r/innodb-system-table-view.result b/mysql-test/suite/innodb/r/innodb-system-table-view.result index a103797686669..580ed08e42460 100644 --- a/mysql-test/suite/innodb/r/innodb-system-table-view.result +++ b/mysql-test/suite/innodb/r/innodb-system-table-view.result @@ -81,6 +81,7 @@ test/t_redundant DEFAULT DEFAULT MYSQLD_DATADIR/test/t_redundant.ibd test/t_compact DEFAULT DEFAULT MYSQLD_DATADIR/test/t_compact.ibd test/t_compressed DEFAULT 2048 MYSQLD_DATADIR/test/t_compressed.ibd test/t_dynamic DEFAULT DEFAULT MYSQLD_DATADIR/test/t_dynamic.ibd +innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1 DROP TABLE t_redundant, t_compact, t_compressed, t_dynamic; SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS; count(*) @@ -168,3 +169,10 @@ test/parent 1 2 DROP TABLE child; DROP TABLE parent; SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; +# +# MDEV-29479 I_S.INNODB_SYS_TABLESPACES doesn't have +# temporary tablespace information +# +SELECT SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE name like 'innodb_temporary'; +SPACE +4294967294 diff --git a/mysql-test/suite/innodb/r/innodb-table-online.result b/mysql-test/suite/innodb/r/innodb-table-online.result index 91d9b35512510..5a8b3d24d757d 100644 --- a/mysql-test/suite/innodb/r/innodb-table-online.result +++ b/mysql-test/suite/innodb/r/innodb-table-online.result @@ -57,7 +57,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) NOT NULL, `c3` char(255) NOT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT BEGIN; INSERT INTO t1 VALUES(7,4,2); connection con1; @@ -86,7 +86,7 @@ t1 CREATE TABLE `t1` ( `c3` char(255) NOT NULL, UNIQUE KEY `c2` (`c2`), UNIQUE KEY `c2_2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT ALTER TABLE t1 DROP INDEX c2, ADD PRIMARY KEY(c1); connection default; SET DEBUG_SYNC = 'now WAIT_FOR scanned'; @@ -97,11 +97,11 @@ ddl_online_create_index 1 ddl_pending_alter_table 1 ddl_sort_file_alter_table 0 ddl_log_file_alter_table 0 -BEGIN; INSERT INTO t1 VALUES(4,7,2); SET DEBUG_SYNC = 'now SIGNAL insert_done'; connection con1; ERROR 23000: Duplicate entry '4' for key 'PRIMARY' +DELETE FROM t1 WHERE c1=4 and c2=7; connection default; ROLLBACK; connection con1; @@ -113,7 +113,7 @@ t1 CREATE TABLE `t1` ( `c3` char(255) NOT NULL, UNIQUE KEY `c2` (`c2`), UNIQUE KEY `c2_2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT ALTER TABLE t1 DROP PRIMARY KEY, ADD UNIQUE INDEX(c2), ALGORITHM = INPLACE; ERROR 42000: Can't DROP INDEX `PRIMARY`; check that it exists ALTER TABLE t1 DROP INDEX c2, ADD PRIMARY KEY(c1), ALGORITHM = INPLACE; @@ -195,7 +195,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) NOT NULL, `c3` char(255) NOT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT ALTER TABLE t1 ROW_FORMAT=REDUNDANT; SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt2 WAIT_FOR dml2_done'; SET lock_wait_timeout = 10; @@ -213,30 +213,22 @@ ddl_online_create_index 1 ddl_pending_alter_table 1 ddl_sort_file_alter_table 0 ddl_log_file_alter_table 1 -BEGIN; -DELETE FROM t1; -ROLLBACK; UPDATE t1 SET c2 = c2 + 1; -BEGIN; +UPDATE t1 SET c2 = c2 + 2; UPDATE t1 SET c2 = c2 + 1; -DELETE FROM t1; -ROLLBACK; -BEGIN; -DELETE FROM t1; -ROLLBACK; +UPDATE t1 SET c2 = c2 + 2; UPDATE t1 SET c2 = c2 + 1; -BEGIN; +UPDATE t1 SET c2 = c2 + 2; UPDATE t1 SET c2 = c2 + 1; -DELETE FROM t1; -ROLLBACK; -BEGIN; -DELETE FROM t1; -ROLLBACK; +UPDATE t1 SET c2 = c2 + 2; UPDATE t1 SET c2 = c2 + 1; -BEGIN; +UPDATE t1 SET c2 = c2 + 2; UPDATE t1 SET c2 = c2 + 1; -DELETE FROM t1; -ROLLBACK; +UPDATE t1 SET c2 = c2 + 2; +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; name count ddl_background_drop_indexes 0 @@ -286,7 +278,7 @@ SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt3 WAIT_FOR dml3_done ALTER TABLE t1 ADD PRIMARY KEY(c22f), CHANGE c2 c22f INT; ERROR 42000: Multiple primary key defined ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(c22f), CHANGE c2 c22f INT; -ERROR 23000: Duplicate entry '5' for key 'PRIMARY' +ERROR 23000: Duplicate entry '26' for key 'PRIMARY' ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(c22f,c1,c4(5)), CHANGE c2 c22f INT, CHANGE c3 c3 CHAR(255) NULL, CHANGE c1 c1 INT AFTER c22f, ADD COLUMN c4 VARCHAR(6) DEFAULT 'Online', LOCK=NONE; @@ -302,11 +294,8 @@ ddl_log_file_alter_table 1 BEGIN; INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 240; DELETE FROM t1 WHERE c1 > 320; -ROLLBACK; -BEGIN; UPDATE t1 SET c2 = c2 + 1; -DELETE FROM t1; -ROLLBACK; +COMMIT; SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; name count ddl_background_drop_indexes 0 @@ -374,12 +363,11 @@ SET DEBUG_SYNC = 'now WAIT_FOR c3p5_created0'; BEGIN; INSERT INTO t1 VALUES(347,33101,'Pikku kakkosen posti','YLETV2'); INSERT INTO t1 VALUES(33101,347,NULL,''); +COMMIT; SET DEBUG_SYNC = 'now SIGNAL ins_done0'; connection con1; -ERROR 01000: Data truncated for column 'c3' at row 323 -connection default; -ROLLBACK; -connection con1; +ERROR 22004: Invalid use of NULL value +DELETE FROM t1 WHERE c1= 347 and c22f = 33101; ALTER TABLE t1 MODIFY c3 CHAR(255) NOT NULL; SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL c3p5_created WAIT_FOR ins_done'; ALTER TABLE t1 DROP PRIMARY KEY, DROP COLUMN c22f, @@ -405,20 +393,20 @@ ddl_log_file_alter_table 2 connection default; SELECT COUNT(*) FROM t1; COUNT(*) -321 +322 ALTER TABLE t1 ROW_FORMAT=REDUNDANT; SELECT * FROM t1 LIMIT 10; c22f c1 c3 c4 -5 1 1foo Online -5 6 6foofoofoofoofoofoo Online -5 11 11foofoofoofoofoofoofoofoofoofoofoo Online -5 16 16foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online -5 21 21foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online -5 26 26foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online -5 31 31foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online -5 36 36foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online -5 41 41foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online -5 46 46foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online +27 1 1foo Online +27 6 6foofoofoofoofoofoo Online +27 11 11foofoofoofoofoofoofoofoofoofoofoo Online +27 16 16foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online +27 21 21foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online +27 26 26foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online +27 31 31foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online +27 36 36foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online +27 41 41foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online +27 46 46foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online connection con1; ALTER TABLE t1 DISCARD TABLESPACE; connection default; @@ -430,7 +418,7 @@ t1 CREATE TABLE `t1` ( `c3` char(255) NOT NULL, `c4` varchar(6) NOT NULL DEFAULT 'Online', PRIMARY KEY (`c22f`,`c1`,`c4`(5)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT SET GLOBAL innodb_monitor_disable = module_ddl; DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY, b blob) ENGINE=InnoDB; @@ -445,13 +433,45 @@ INSERT INTO t1 VALUES(1, repeat('a', 10000)); ROLLBACK; SET DEBUG_SYNC = 'now SIGNAL ins'; connection con1; -disconnect con1; connection default; SELECT * FROM t1; a b 0 NULL DROP TABLE t1; SET DEBUG_SYNC = 'RESET'; +# +# MDEV-29600 Memory leak in row_log_table_apply_update() +# +CREATE TABLE t1 (pk INT PRIMARY KEY, f TEXT) ENGINE=InnoDB; +INSERT INTO t1 SET pk=1; +connection con1; +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL created WAIT_FOR updated'; +ALTER TABLE t1 FORCE; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR created'; +UPDATE t1 SET f = REPEAT('a', 20000); +SET DEBUG_SYNC = 'now SIGNAL updated'; +connection con1; +connection default; +DROP TABLE t1; +# +# MDEV-29977 Memory leak in row_log_table_apply_update +# +CREATE TABLE t1(f1 longtext, f2 int, KEY(f1(1024)), KEY(f2, f1(20))) ENGINE=InnoDB; +INSERT INTO t1 VALUES('a', 1); +connection con1; +set DEBUG_SYNC="innodb_inplace_alter_table_enter SIGNAL con_default WAIT_FOR con1_signal"; +ALTER TABLE t1 FORCE; +connection default; +SET DEBUG_SYNC="now WAIT_FOR con_default"; +UPDATE t1 SET f1 = NULL; +UPDATE t1 SET f1 = REPEAT('b', 9000); +SET DEBUG_SYNC="now SIGNAL con1_signal"; +connection con1; +DROP TABLE t1; +connection default; +SET DEBUG_SYNC=RESET; +disconnect con1; SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig; SET GLOBAL innodb_monitor_enable = default; SET GLOBAL innodb_monitor_disable = default; diff --git a/mysql-test/suite/innodb/r/innodb-update-insert.result b/mysql-test/suite/innodb/r/innodb-update-insert.result index b50c35578d984..28a61245c3a57 100644 --- a/mysql-test/suite/innodb/r/innodb-update-insert.result +++ b/mysql-test/suite/innodb/r/innodb-update-insert.result @@ -10,7 +10,7 @@ t1 CREATE TABLE `t1` ( `f2` int(11) NOT NULL, `f3` blob DEFAULT NULL, PRIMARY KEY (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a', 0, repeat('b',8102)); select f1 from t1; f1 diff --git a/mysql-test/suite/innodb/r/innodb-virtual-columns.result b/mysql-test/suite/innodb/r/innodb-virtual-columns.result index 1a726ee267569..b97eaac75651b 100644 --- a/mysql-test/suite/innodb/r/innodb-virtual-columns.result +++ b/mysql-test/suite/innodb/r/innodb-virtual-columns.result @@ -38,7 +38,7 @@ grad_degree CREATE TABLE `grad_degree` ( `deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data', `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term', PRIMARY KEY (`student_id`,`plan`,`admit_term`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci CREATE INDEX grad_degree_wdraw_rsn_ndx ON grad_degree (wdraw_rsn); CREATE INDEX grad_degree_as_of_term_ndx ON grad_degree (deg_as_of_term); INSERT IGNORE grad_degree ( @@ -153,7 +153,7 @@ grad_degree CREATE TABLE `grad_degree` ( `deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data', `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term', PRIMARY KEY (`student_id`,`plan`,`admit_term`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci CREATE INDEX grad_degree_wdraw_rsn_ndx ON grad_degree (wdraw_rsn); CREATE INDEX grad_degree_as_of_term_ndx ON grad_degree (deg_as_of_term); INSERT IGNORE grad_degree ( @@ -210,7 +210,7 @@ grad_degree CREATE TABLE `grad_degree` ( `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term', PRIMARY KEY (`student_id`,`plan`,`admit_term`), KEY `grad_degree_as_of_term_ndx` (`deg_as_of_term`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE grad_degree; CREATE TABLE IF NOT EXISTS grad_degree ( student_id int(8) UNSIGNED NOT NULL, @@ -289,7 +289,7 @@ grad_degree CREATE TABLE `grad_degree` ( `deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data', `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term', PRIMARY KEY (`student_id`,`plan`,`admit_term`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci CREATE INDEX grad_degree_wdraw_rsn_ndx ON grad_degree (wdraw_rsn); ALTER TABLE grad_degree DROP COLUMN ofis_deg_status2, DROP COLUMN ofis_deg_status3, DROP COLUMN ofis_deg_status4, DROP COLUMN ofis_deg_status5, DROP COLUMN ofis_deg_status6, diff --git a/mysql-test/suite/innodb/r/innodb-virtual-columns2.result b/mysql-test/suite/innodb/r/innodb-virtual-columns2.result index 99a1c610bd3ac..57a2fe6440d5b 100644 --- a/mysql-test/suite/innodb/r/innodb-virtual-columns2.result +++ b/mysql-test/suite/innodb/r/innodb-virtual-columns2.result @@ -13,7 +13,7 @@ t1 CREATE TABLE `t1` ( `c` varchar(8) NOT NULL DEFAULT '', `vi` smallint(6) GENERATED ALWAYS AS (`i`) VIRTUAL, KEY `y` (`y`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE; y i c vi INSERT INTO t1 (i) VALUES (1),(2); @@ -33,7 +33,7 @@ t1 CREATE TABLE `t1` ( `i` smallint(6) DEFAULT NULL, `vi` smallint(6) GENERATED ALWAYS AS (`i`) VIRTUAL, KEY `y` (`y`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE; y i vi INSERT INTO t1 (i) VALUES (1),(2); @@ -55,7 +55,7 @@ t1 CREATE TABLE `t1` ( `b` blob DEFAULT NULL, `vi` smallint(6) GENERATED ALWAYS AS (`i`) VIRTUAL, KEY `y` (`y`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE; y i b vi INSERT INTO t1 (i) VALUES (1),(2); diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-1.result b/mysql-test/suite/innodb/r/innodb-wl5522-1.result index 55557a8fb997e..204d6bc8b78d3 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522-1.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522-1.result @@ -795,3 +795,19 @@ DROP DATABASE testdb_wl5522; call mtr.add_suppression("Got error -1 when reading table '.*'"); call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'.*"); call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded"); +# +# MDEV-27882 Innodb - recognise MySQL-8.0 innodb flags and give a specific error message +# +# +CREATE TABLE `t1` (`i` int(11) NOT NULL, PRIMARY KEY (`i`) ) ENGINE=InnoDB; +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +ALTER TABLE t1 DISCARD TABLESPACE; +call mtr.add_suppression("InnoDB: unsupported MySQL tablespace"); +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR 42000: Table 't1' uses an extension that doesn't exist in this MariaDB version +DROP TABLE t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result index 4c1b35ac1e490..e7af2d9469ed6 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result @@ -9,6 +9,8 @@ call mtr.add_suppression("InnoDB: Page for tablespace "); call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS="); call mtr.add_suppression("InnoDB: Unknown index id .* on page"); call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` because the \\.ibd file is missing"); +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*ibdata1' page"); +call mtr.add_suppression("InnoDB: File '.*ibdata1' is corrupted"); FLUSH TABLES; SET GLOBAL innodb_file_per_table = 1; CREATE TABLE t1 (c1 INT) ENGINE = InnoDB; @@ -449,7 +451,7 @@ ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure"; ALTER TABLE t1 IMPORT TABLESPACE; -ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Too many concurrent transactions +ERROR HY000: Internal error: Error importing tablespace for table `test`.`t1` : Too many concurrent transactions restore: t1 .ibd and .cfg files SET SESSION debug_dbug=@saved_debug_dbug; SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; @@ -523,7 +525,7 @@ t1 CREATE TABLE `t1` ( KEY `idx1` (`c2`), KEY `idx2` (`c3`(512)), KEY `idx3` (`c4`(512)) -) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT c1, c2 FROM t1; c1 c2 1 16 @@ -831,7 +833,7 @@ t1 CREATE TABLE `t1` ( KEY `idx1` (`c2`), KEY `idx2` (`c3`(512)), KEY `idx3` (`c4`(512)) -) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; INSERT IGNORE INTO t1 VALUES @@ -852,7 +854,7 @@ ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1"; ALTER TABLE t1 IMPORT TABLESPACE; -ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Data structure corruption +ERROR HY000: Internal error: Error importing tablespace for table `test`.`t1` : Data structure corruption SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t1; unlink: t1.ibd @@ -862,10 +864,8 @@ ALTER TABLE t1 DISCARD TABLESPACE; SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files -SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure"; ALTER TABLE t1 IMPORT TABLESPACE; -ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Data structure corruption -SET SESSION debug_dbug=@saved_debug_dbug; +ERROR HY000: Index for table 't1' is corrupt; try to repair it DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg @@ -902,6 +902,8 @@ ALTER TABLE t1 DISCARD TABLESPACE; SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` ALTER TABLE t1 ADD INDEX idx(c1); +Warnings: +Warning 1814 Tablespace has been discarded for table `t1` DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg diff --git a/mysql-test/suite/innodb/r/innodb-wl5522.result b/mysql-test/suite/innodb/r/innodb-wl5522.result index dc03bd914240e..6baa5df9e5504 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522.result @@ -64,16 +64,24 @@ a b c # Done restarting server # List before t1 DISCARD db.opt +t1.cfg.sav t1.frm t1.ibd +t1.ibd.sav +t2.cfg.sav t2.frm t2.ibd +t2.ibd.sav ALTER TABLE t1 DISCARD TABLESPACE; # List after t1 DISCARD db.opt +t1.cfg.sav t1.frm +t1.ibd.sav +t2.cfg.sav t2.frm t2.ibd +t2.ibd.sav ALTER TABLE t1 IMPORT TABLESPACE; ALTER TABLE t1 ENGINE InnoDB; SELECT COUNT(*) FROM t1; @@ -91,10 +99,14 @@ a b c 638 Cavalry ..asdasdfaeraf db.opt t1.cfg +t1.cfg.sav t1.frm t1.ibd +t1.ibd.sav +t2.cfg.sav t2.frm t2.ibd +t2.ibd.sav SELECT COUNT(*) FROM t1; COUNT(*) 640 @@ -113,7 +125,9 @@ ALTER TABLE t2 ROW_FORMAT=DYNAMIC; ALTER TABLE t2 DISCARD TABLESPACE; # List after t2 DISCARD db.opt +t2.cfg.sav t2.frm +t2.ibd.sav ALTER TABLE t2 IMPORT TABLESPACE; ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x1; .cfg file uses ROW_FORMAT=COMPACT) ALTER TABLE t2 IMPORT TABLESPACE; @@ -252,13 +266,15 @@ ERROR HY000: Schema mismatch (Index x not found in tablespace meta-data file.) select count(*) from t1; ERROR HY000: Tablespace has been discarded for table `t1` ALTER TABLE t1 DROP INDEX x; +Warnings: +Warning 1814 Tablespace has been discarded for table `t1` ALTER TABLE t1 DROP INDEX x, ALGORITHM=copy; ERROR 42000: Can't DROP INDEX `x`; check that it exists ALTER TABLE t1 ADD INDEX idx(c2); -restore: t1 .ibd and .cfg files -ALTER TABLE t1 IMPORT TABLESPACE; Warnings: Warning 1814 Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -293,7 +309,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FLUSH TABLES t1 FOR EXPORT; Warnings: Warning 1809 Table `test`.`t1` in system tablespace @@ -311,7 +327,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; @@ -337,7 +353,7 @@ SELECT * FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files ALTER TABLE t1 IMPORT TABLESPACE; -ERROR HY000: Schema mismatch (Number of columns don't match, table has 6 columns but the tablespace meta-data file has 5 columns) +ERROR HY000: Schema mismatch (Column c3 not found in tablespace.) unlink: t1.ibd unlink: t1.cfg DROP TABLE t1; @@ -372,7 +388,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 1 1 @@ -403,7 +419,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; @@ -427,7 +443,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT SELECT * FROM t1; c1 c2 1 1 @@ -499,7 +515,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT SELECT * FROM t1; c1 c2 1 1 @@ -530,7 +546,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; @@ -554,7 +570,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT SELECT * FROM t1; c1 c2 1 1 @@ -629,7 +645,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT SELECT * FROM t1; c1 c2 1 1 @@ -660,7 +676,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; @@ -684,7 +700,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC SELECT * FROM t1; c1 c2 1 1 @@ -759,7 +775,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC SELECT * FROM t1; c1 c2 1 1 @@ -790,7 +806,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; @@ -814,7 +830,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED SELECT * FROM t1; c1 c2 1 1 @@ -902,7 +918,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED SELECT * FROM t1; c1 c2 1 1 @@ -922,6 +938,22 @@ c1 c2 15 1 16 1 DROP TABLE t1; +CREATE TABLE t1 ( id INT NOT NULL, i1 INT, i2 INT, i3 INT, PRIMARY KEY (id)) engine=innodb; +CREATE TABLE t2 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb; +ALTER TABLE t2 DISCARD TABLESPACE; +FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE t2 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Column DB_ROW_ID ordinal value mismatch, it's at 3 in the table and 4 in the tablespace meta-data file) +DROP TABLE t1, t2; +CREATE TABLE t1 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb; +CREATE TABLE t2 ( id INT NOT NULL, i1 INT, i2 INT, i3 INT, PRIMARY KEY (id)) engine=innodb; +ALTER TABLE t2 DISCARD TABLESPACE; +FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE t2 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Column i3 not found in tablespace.) +DROP TABLE t1, t2; call mtr.add_suppression("Got error -1 when reading table '.*'"); call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'"); call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded"); diff --git a/mysql-test/suite/innodb/r/innodb-wl5980-alter.result b/mysql-test/suite/innodb/r/innodb-wl5980-alter.result index 08ee9688603ce..4d6ac474da882 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5980-alter.result +++ b/mysql-test/suite/innodb/r/innodb-wl5980-alter.result @@ -53,7 +53,7 @@ t1 CREATE TABLE `t1` ( `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' ALTER TABLE t1 ALTER c2 DROP DEFAULT; SHOW CREATE TABLE t1; Table Create Table @@ -63,7 +63,7 @@ t1 CREATE TABLE `t1` ( `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' ### files in MYSQL_DATA_DIR/test db.opt sys_foreign.frm @@ -277,7 +277,7 @@ t3 CREATE TABLE `t3` ( `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c3`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SHOW CREATE TABLE t1c; Table Create Table t1c CREATE TABLE `t1c` ( @@ -289,7 +289,7 @@ t1c CREATE TABLE `t1c` ( KEY `c3` (`c3`), CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t3` (`c3`), CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' ALTER TABLE t3 CHANGE c3 `12345678901234567890123456789012345678901234567890123456789012345` INT; ERROR 42000: Identifier name '12345678901234567890123456789012345678901234567890123456789012345' is too long @@ -320,7 +320,7 @@ t3 CREATE TABLE `t3` ( `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`1234567890123456789012345678901234567890123456789012345678901234`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' ALTER TABLE t3 CHANGE `1234567890123456789012345678901234567890123456789012345678901234` `倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿偀` INT; @@ -404,7 +404,7 @@ t2 CREATE TABLE `t2` ( `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c3`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' RENAME TABLE t2 TO t1; SELECT st.NAME, i.NAME FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i @@ -470,7 +470,7 @@ t1c CREATE TABLE `t1c` ( KEY `c3` (`c3`), CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`), CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SET foreign_key_checks=0; DROP TABLE t1p; SET foreign_key_checks=1; @@ -485,7 +485,7 @@ t1c CREATE TABLE `t1c` ( KEY `c3` (`c3`), CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`), CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' ### files in MYSQL_DATA_DIR/test db.opt sys_foreign.frm @@ -555,7 +555,7 @@ t1c CREATE TABLE `t1c` ( KEY `c2` (`c2`), CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`), CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; @@ -601,7 +601,7 @@ t1c CREATE TABLE `t1c` ( PRIMARY KEY (`c1`), KEY `c2` (`c2`), CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; @@ -644,7 +644,7 @@ t1c CREATE TABLE `t1c` ( `c2` int(11) DEFAULT NULL, `c3` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; @@ -761,7 +761,7 @@ tt CREATE TABLE `tt` ( `ct` text DEFAULT NULL, PRIMARY KEY (`pk`), FULLTEXT KEY `ct` (`ct`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=COPY; ERROR 42000: Incorrect column name 'dB_row_Id' ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=INPLACE; @@ -1023,7 +1023,7 @@ t1n CREATE TABLE `t1n` ( `c1` text DEFAULT NULL, PRIMARY KEY (`c2`), FULLTEXT KEY `ct` (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1n CHANGE c2 c1 INT, CHANGE ct c2 INT, CHANGE c1 ct TEXT, ALGORITHM=COPY; ### files in MYSQL_DATA_DIR/test @@ -1089,7 +1089,7 @@ t1n CREATE TABLE `t1n` ( `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), FULLTEXT KEY `ct` (`ct`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=INPLACE; ERROR 42000: Key column 'c2' doesn't exist in table ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=COPY; @@ -1159,7 +1159,7 @@ t1n CREATE TABLE `t1n` ( PRIMARY KEY (`c1`), KEY `c4` (`c4`), FULLTEXT KEY `ct` (`ct`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1n DROP INDEX c4; ### files in MYSQL_DATA_DIR/test FTS_AUX_INDEX_1.isl @@ -1283,7 +1283,7 @@ t1n CREATE TABLE `t1n` ( PRIMARY KEY (`c1`), KEY `c11` (`c11`), FULLTEXT KEY `ct` (`ct`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1n; ALTER TABLE t1o MODIFY c1 BIGINT UNSIGNED NOT NULL; ### files in MYSQL_DATA_DIR/test @@ -1401,7 +1401,7 @@ t1o CREATE TABLE `t1o` ( `ct` text DEFAULT NULL, PRIMARY KEY (`FTS_DOC_ID`), FULLTEXT KEY `ct` (`ct`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL, DROP INDEX ct, LOCK=NONE; ### files in MYSQL_DATA_DIR/test @@ -1453,7 +1453,7 @@ t1o CREATE TABLE `t1o` ( `c2` int(11) DEFAULT NULL, `ct` text DEFAULT NULL, PRIMARY KEY (`foo_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1c, t1p, sys_tables, sys_indexes, sys_foreign; CREATE TABLE sys_tables SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME='test/t1o'; diff --git a/mysql-test/suite/innodb/r/innodb-wl5980-debug.result b/mysql-test/suite/innodb/r/innodb-wl5980-debug.result deleted file mode 100644 index 51cff4393aa97..0000000000000 --- a/mysql-test/suite/innodb/r/innodb-wl5980-debug.result +++ /dev/null @@ -1,27 +0,0 @@ -call mtr.add_suppression("Cannot find space id [0-9]+ in the tablespace memory cache"); -call mtr.add_suppression("Cannot rename table 'test/t1' to 'test/t2' since the dictionary cache already contains 'test/t2'."); -# -# WL5980 Remote tablespace debug error injection tests. -# -CREATE TABLE t1 (a int KEY, b text) ENGINE=Innodb DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir' ; -INSERT INTO t1 VALUES (1, 'tablespace'); -SELECT * FROM t1; -a b -1 tablespace -# -# Test the second injection point in fil_rename_tablespace(). -# Make sure the table is useable after this failure. -# -SET @save_dbug=@@debug_dbug; -SET debug_dbug="+d,fil_rename_tablespace_failure_2"; -RENAME TABLE t1 TO t2; -SET debug_dbug=@save_dbug; -INSERT INTO t1 VALUES (2, 'tablespace'); -SELECT * FROM t1; -a b -1 tablespace -2 tablespace -# -# Cleanup -# -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index d799cbb8fd9cc..47e5f0f5c946b 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -836,7 +836,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(20) DEFAULT NULL, KEY `a` (`a`(5)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb; insert into t1 values (NULL),(NULL),(NULL); @@ -1434,14 +1434,14 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `id2` int(11) NOT NULL, UNIQUE KEY `id` (`id`,`id2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `id` int(11) NOT NULL, KEY `t1_id_fk` (`id`), CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create index id on t2 (id); show create table t2; Table Create Table @@ -1449,7 +1449,7 @@ t2 CREATE TABLE `t2` ( `id` int(11) NOT NULL, KEY `id` (`id`), CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create index id2 on t2 (id); Warnings: Note 1831 Duplicate index `id2`. This is deprecated and will be disallowed in a future release @@ -1460,7 +1460,7 @@ t2 CREATE TABLE `t2` ( KEY `id` (`id`), KEY `id2` (`id`), CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop index id2 on t2; drop index id on t2; ERROR HY000: Cannot drop index 'id': needed in a foreign key constraint @@ -1470,7 +1470,7 @@ t2 CREATE TABLE `t2` ( `id` int(11) NOT NULL, KEY `id` (`id`), CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb; show create table t2; @@ -1480,7 +1480,7 @@ t2 CREATE TABLE `t2` ( `id2` int(11) NOT NULL, KEY `t1_id_fk` (`id`,`id2`), CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create unique index id on t2 (id,id2); show create table t2; Table Create Table @@ -1489,7 +1489,7 @@ t2 CREATE TABLE `t2` ( `id2` int(11) NOT NULL, UNIQUE KEY `id` (`id`,`id2`), CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb; show create table t2; @@ -1500,7 +1500,7 @@ t2 CREATE TABLE `t2` ( UNIQUE KEY `id` (`id`,`id2`), KEY `t1_id_fk` (`id2`,`id`), CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb; show create table t2; @@ -1510,7 +1510,7 @@ t2 CREATE TABLE `t2` ( `id2` int(11) NOT NULL, UNIQUE KEY `id` (`id`,`id2`), CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb; show create table t2; @@ -1521,7 +1521,7 @@ t2 CREATE TABLE `t2` ( UNIQUE KEY `id` (`id`,`id2`), KEY `t1_id_fk` (`id2`,`id`), CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb; show create table t2; @@ -1532,7 +1532,7 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`id`), KEY `id` (`id`,`id2`), CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb; show create table t2; @@ -1542,7 +1542,7 @@ t2 CREATE TABLE `t2` ( `id2` int(11) NOT NULL, KEY `t1_id_fk` (`id`), CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t2 add index id_test (id), add index id_test2 (id,id2); show create table t2; Table Create Table @@ -1552,7 +1552,7 @@ t2 CREATE TABLE `t2` ( KEY `id_test` (`id`), KEY `id_test2` (`id`,`id2`), CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb; ERROR 42000: Incorrect foreign key definition for 't1_id_fk': Key reference and table reference don't match @@ -1566,7 +1566,7 @@ t2 CREATE TABLE `t2` ( UNIQUE KEY `b_2` (`b`), KEY `b` (`b`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb; show create table t2; @@ -1578,7 +1578,7 @@ t2 CREATE TABLE `t2` ( UNIQUE KEY `b` (`b`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`), CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2, t1; create table t1 (c char(10), index (c,c)) engine=innodb; ERROR 42S21: Duplicate column name 'c' @@ -1738,7 +1738,7 @@ t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t2 like t1; show create table t2; Table Create Table @@ -1746,7 +1746,7 @@ t2 CREATE TABLE `t2` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create table t3 select * from t1; show create table t3; Table Create Table @@ -1754,7 +1754,7 @@ t3 CREATE TABLE `t3` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify c varchar(10); show create table t1; Table Create Table @@ -1762,7 +1762,7 @@ t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify v char(10); show create table t1; Table Create Table @@ -1770,7 +1770,7 @@ t1 CREATE TABLE `t1` ( `v` char(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 modify t varchar(10); Warnings: Note 1265 Data truncated for column 't' at row 2 @@ -1780,7 +1780,7 @@ t1 CREATE TABLE `t1` ( `v` char(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` varchar(10) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+*+*+ * @@ -1796,7 +1796,7 @@ t1 CREATE TABLE `t1` ( KEY `v` (`v`), KEY `c` (`c`), KEY `t` (`t`(10)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1; count(*) 270 @@ -2020,7 +2020,7 @@ t1 CREATE TABLE `t1` ( KEY `c` (`c`), KEY `t` (`t`(10)), KEY `v` (`v`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1 where v='a'; count(*) 10 @@ -2100,7 +2100,7 @@ t1 CREATE TABLE `t1` ( KEY `c` (`c`), KEY `t` (`t`(10)), KEY `v` (`v`(30)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from t1 where v='a'; count(*) 10 @@ -2180,7 +2180,7 @@ t1 CREATE TABLE `t1` ( KEY `c` (`c`), KEY `t` (`t`(10)), KEY `v` (`v`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -2258,14 +2258,14 @@ t1 CREATE TABLE `t1` ( KEY `v` (`v`(5)), KEY `c` (`c`(5)), KEY `t` (`t`(5)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (v char(10) character set utf8); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` char(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 + `v` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (v varchar(10), c char(10)) row_format=fixed; Warnings: @@ -2275,7 +2275,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=FIXED insert into t1 values('a','a'),('a ','a '); select concat('*',v,'*',c,'*') from t1; concat('*',v,'*',c,'*') @@ -2309,7 +2309,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `v` mediumtext DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (v varchar(65530) character set utf8); Warnings: @@ -2317,8 +2317,8 @@ Note 1246 Converting column 'v' from VARCHAR to TEXT show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` mediumtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 + `v` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; SET sql_mode = default; set default_storage_engine=MyISAM; @@ -2463,7 +2463,7 @@ t9 CREATE TABLE `t9` ( `col1` varchar(512) DEFAULT NULL, `col2` varchar(512) DEFAULT NULL, KEY `col1` (`col1`,`col2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2, t3, t4, t5, t6, t7, t8, t9; CREATE TABLE t1 ( @@ -2531,9 +2531,19 @@ disconnect b; set foreign_key_checks=0; create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb; create table t1(a char(10) primary key, b varchar(20)) engine = innodb; -ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") set foreign_key_checks=1; +insert into t2 values (1,1); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`)) +set foreign_key_checks=0; +drop table t1; +set foreign_key_checks=1; +insert into t2 values (1,1); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`)) +create table t1(a char(10) primary key, b varchar(20)) engine = innodb; +ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") drop table t2; +create table t1(a char(10) primary key, b varchar(20)) engine = innodb; +drop table t1; set foreign_key_checks=0; create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8; @@ -2718,7 +2728,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, KEY `t2_ibfk_0` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2,t1; SET sql_mode = default; CREATE TABLE t1 ( @@ -2759,7 +2769,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`c1`), UNIQUE KEY `c2` (`c2`), CONSTRAINT `c2_fk` FOREIGN KEY (`c2`) REFERENCES `t2` (`c1`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t1 drop foreign key c2_fk; show create table t1; Table Create Table @@ -2768,7 +2778,7 @@ t1 CREATE TABLE `t1` ( `c2` bigint(20) NOT NULL, PRIMARY KEY (`c1`), UNIQUE KEY `c2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; create table t1(a date) engine=innodb; create table t2(a date, key(a)) engine=innodb; @@ -3045,7 +3055,7 @@ t2 CREATE TABLE `t2` ( KEY `f` (`f`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f`) REFERENCES `t1` (`f`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `t2_t1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2, t1; CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB; CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB; @@ -3081,7 +3091,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 (id int PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t2 VALUES(42),(347),(348); ALTER TABLE t1 ADD CONSTRAINT t1_t2 FOREIGN KEY (id) REFERENCES t2(id); @@ -3091,7 +3101,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; SET innodb_strict_mode=ON; CREATE TABLE t1 ( @@ -3277,7 +3287,7 @@ t2 CREATE TEMPORARY TABLE `t2` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci START TRANSACTION READ ONLY; INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); INSERT INTO t1 VALUES(0); @@ -3305,7 +3315,7 @@ t2 CREATE TEMPORARY TABLE `t2` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 SELECT * FROM t2; diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_dump_pct.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_dump_pct.result index d9f5e4dfeed5d..fa17487df9767 100644 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_dump_pct.result +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_dump_pct.result @@ -2,13 +2,11 @@ CREATE TABLE tab5 (col1 int auto_increment primary key, col2 VARCHAR(25), col3 varchar(25)) ENGINE=InnoDB; CREATE INDEX idx1 ON tab5(col2(10)); CREATE INDEX idx2 ON tab5(col3(10)); -SET GLOBAL innodb_buffer_pool_filename=ib_buffer_pool100; SET GLOBAL innodb_buffer_pool_dump_pct=100; SELECT variable_value INTO @IBPDS FROM information_schema.global_status WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS'; SET GLOBAL innodb_buffer_pool_dump_now=ON; -SET GLOBAL innodb_buffer_pool_filename=ib_buffer_pool1; SET GLOBAL innodb_buffer_pool_dump_pct=1; SELECT @@global.innodb_buffer_pool_dump_pct; @@global.innodb_buffer_pool_dump_pct @@ -18,5 +16,4 @@ FROM information_schema.global_status WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS'; SET GLOBAL innodb_buffer_pool_dump_now=ON; SET GLOBAL innodb_buffer_pool_dump_pct=DEFAULT; -SET GLOBAL innodb_buffer_pool_filename=DEFAULT; DROP TABLE tab5; diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_bigtest.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_bigtest.result new file mode 100644 index 0000000000000..d6b29060dc731 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_bigtest.result @@ -0,0 +1,14 @@ +SET @save_size=@@innodb_buffer_pool_size; +# +# MDEV-27891: Delayed SIGSEGV in InnoDB buffer pool resize +# after or during DROP TABLE +# +select @@innodb_buffer_pool_chunk_size; +@@innodb_buffer_pool_chunk_size +1048576 +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +SET GLOBAL innodb_buffer_pool_size=256*1024*1024; +DROP TABLE t1; +SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + @@innodb_buffer_pool_chunk_size; +# End of 10.6 tests +SET GLOBAL innodb_buffer_pool_size=@save_size; diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result index 4bf244c958885..efb652091bf22 100644 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result @@ -1,6 +1,6 @@ select @@innodb_buffer_pool_chunk_size; @@innodb_buffer_pool_chunk_size -2097152 +4194304 create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; create or replace view view0 as select 1 union all select 1; set @`v_id` := 0; @@ -18,9 +18,9 @@ count(val) 262144 drop table t1; drop view view0; -set global innodb_buffer_pool_size = 1048576; +set global innodb_buffer_pool_size = 2*1048576; Warnings: -Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '1048576' +Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '2097152' select @@innodb_buffer_pool_size; @@innodb_buffer_pool_size -6291456 +4194304 diff --git a/mysql-test/suite/innodb/r/innodb_bug14007649.result b/mysql-test/suite/innodb/r/innodb_bug14007649.result index 659881b55a6e6..a20dde791cfe9 100644 --- a/mysql-test/suite/innodb/r/innodb_bug14007649.result +++ b/mysql-test/suite/innodb/r/innodb_bug14007649.result @@ -12,7 +12,7 @@ t1 CREATE TABLE `t1` ( `f2` int(11) DEFAULT NULL, KEY `i1` (`f1`,`f2`), KEY `i2` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL); connect a,localhost,root,,; connect b,localhost,root,,; diff --git a/mysql-test/suite/innodb/r/innodb_bug21704.result b/mysql-test/suite/innodb/r/innodb_bug21704.result index c0bc3af2f20b9..4573a3b336139 100644 --- a/mysql-test/suite/innodb/r/innodb_bug21704.result +++ b/mysql-test/suite/innodb/r/innodb_bug21704.result @@ -57,7 +57,7 @@ t1 CREATE TABLE `t1` ( `e` int(11) NOT NULL, `c` int(11) DEFAULT NULL, PRIMARY KEY (`e`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -65,7 +65,7 @@ t2 CREATE TABLE `t2` ( `c` int(11) DEFAULT NULL, PRIMARY KEY (`z`), CONSTRAINT `fk1` FOREIGN KEY (`z`) REFERENCES `t1` (`e`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( @@ -75,7 +75,7 @@ t3 CREATE TABLE `t3` ( PRIMARY KEY (`f`), KEY `b` (`g`), CONSTRAINT `fk2` FOREIGN KEY (`g`) REFERENCES `t3` (`f`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT SELECT f.*, c.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS c INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FOREIGN f diff --git a/mysql-test/suite/innodb/r/innodb_bug51378.result b/mysql-test/suite/innodb/r/innodb_bug51378.result index 2ffd533279bea..7d2c869b33bf7 100644 --- a/mysql-test/suite/innodb/r/innodb_bug51378.result +++ b/mysql-test/suite/innodb/r/innodb_bug51378.result @@ -16,7 +16,7 @@ bug51378 CREATE TABLE `bug51378` ( UNIQUE KEY `idx3` (`col1`,`col3`), UNIQUE KEY `idx` (`col1`,`col2`(31)), UNIQUE KEY `idx2` (`col1`,`col2`(31)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop index idx3 on bug51378; SHOW CREATE TABLE bug51378; Table Create Table @@ -26,7 +26,7 @@ bug51378 CREATE TABLE `bug51378` ( `col3` time NOT NULL, UNIQUE KEY `idx` (`col1`,`col2`(31)), UNIQUE KEY `idx2` (`col1`,`col2`(31)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table bug51378 add primary key idx3(col1, col2(31)); Warnings: Warning 1280 Name 'idx3' ignored for PRIMARY key. @@ -39,7 +39,7 @@ bug51378 CREATE TABLE `bug51378` ( PRIMARY KEY (`col1`,`col2`(31)), UNIQUE KEY `idx` (`col1`,`col2`(31)), UNIQUE KEY `idx2` (`col1`,`col2`(31)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table bug51378; create table bug51378 ( col1 int not null, @@ -54,7 +54,7 @@ bug51378 CREATE TABLE `bug51378` ( `col3` time NOT NULL, PRIMARY KEY (`col1`,`col2`(31)), UNIQUE KEY `idx` (`col1`,`col2`(31)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table bug51378; create table bug51378 ( col1 int not null, @@ -66,5 +66,5 @@ bug51378 CREATE TABLE `bug51378` ( `col1` int(11) NOT NULL, `col2` int(11) DEFAULT NULL, UNIQUE KEY `idx` (`col1`,`col2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table bug51378; diff --git a/mysql-test/suite/innodb/r/innodb_bug54044.result b/mysql-test/suite/innodb/r/innodb_bug54044.result index 29b0127f20b92..abaf67ea9e48f 100644 --- a/mysql-test/suite/innodb/r/innodb_bug54044.result +++ b/mysql-test/suite/innodb/r/innodb_bug54044.result @@ -4,7 +4,7 @@ SHOW CREATE TABLE table_54044; Table Create Table table_54044 CREATE TEMPORARY TABLE `table_54044` ( `IF(NULL IS NOT NULL, NULL, NULL)` binary(0) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE table_54044; CREATE TABLE tmp ENGINE = INNODB AS SELECT COALESCE(NULL, NULL, NULL), GREATEST(NULL, NULL), NULL; @@ -14,5 +14,5 @@ tmp CREATE TABLE `tmp` ( `COALESCE(NULL, NULL, NULL)` binary(0) DEFAULT NULL, `GREATEST(NULL, NULL)` binary(0) DEFAULT NULL, `NULL` binary(0) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE tmp; diff --git a/mysql-test/suite/innodb/r/innodb_bug56143.result b/mysql-test/suite/innodb/r/innodb_bug56143.result index 1efec7e888760..d3c465b3621a1 100644 --- a/mysql-test/suite/innodb/r/innodb_bug56143.result +++ b/mysql-test/suite/innodb/r/innodb_bug56143.result @@ -553,4 +553,4 @@ bug56143_2 CREATE TABLE `bug56143_2` ( CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa97` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa98` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa99` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci diff --git a/mysql-test/suite/innodb/r/innodb_bug68148.result b/mysql-test/suite/innodb/r/innodb_bug68148.result index 7206bccd50fa3..25bf7f58eb97a 100644 --- a/mysql-test/suite/innodb/r/innodb_bug68148.result +++ b/mysql-test/suite/innodb/r/innodb_bug68148.result @@ -31,5 +31,5 @@ main CREATE TABLE `main` ( KEY `idx_1` (`ref_id1`), CONSTRAINT `FK_1` FOREIGN KEY (`ref_id1`) REFERENCES `ref_table1` (`id`), CONSTRAINT `FK_2` FOREIGN KEY (`ref_id2`) REFERENCES `ref_table2` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE main, ref_table1, ref_table2; diff --git a/mysql-test/suite/innodb/r/innodb_bug84958.result b/mysql-test/suite/innodb/r/innodb_bug84958.result index a216dde1648fd..9a4129647b994 100644 --- a/mysql-test/suite/innodb/r/innodb_bug84958.result +++ b/mysql-test/suite/innodb/r/innodb_bug84958.result @@ -9,12 +9,10 @@ SET GLOBAL innodb_purge_rseg_truncate_frequency= 1; CREATE PROCEDURE insert_n(start int, end int) BEGIN DECLARE i INT DEFAULT start; -START TRANSACTION; WHILE i <= end do INSERT INTO t1 VALUES (1, 2, 3) ON DUPLICATE KEY UPDATE c = i; SET i = i + 1; END WHILE; -COMMIT; END~~ CREATE FUNCTION num_pages_get() RETURNS INT @@ -30,6 +28,7 @@ END~~ # CREATE TABLE t1 (a INT, b INT, c INT, PRIMARY KEY(a,b), KEY (b,c)) ENGINE=InnoDB STATS_PERSISTENT=0; +InnoDB 0 transactions not purged BEGIN; SELECT * FROM t1; a b c @@ -38,20 +37,24 @@ a b c # connect con2, localhost, root,,; connection con2; +BEGIN; INSERT INTO t1 VALUES (1, 2, 3) ON DUPLICATE KEY UPDATE c = NULL; CALL insert_n(1, 50);; connect con3, localhost, root,,; connection con3; +BEGIN; CALL insert_n(51, 100);; connection con2; +COMMIT; connection con3; INSERT INTO t1 VALUES (1, 2, 1) ON DUPLICATE KEY UPDATE c = NULL; +COMMIT; connection default; # # Connect to default and record how many pages were accessed # when selecting the record using the secondary key. # -InnoDB 4 transactions not purged +InnoDB 2 transactions not purged SET @num_pages_1 = num_pages_get(); SELECT * FROM t1 force index (b); a b c diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result index ae050170b4f86..3281f879c32fd 100644 --- a/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result @@ -151,7 +151,7 @@ t1 CREATE TABLE `t1` ( `title` varchar(100) DEFAULT NULL, KEY `idx_id` (`id`), KEY `idx_title` (`title`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t_part; Table Create Table t_part CREATE TABLE `t_part` ( @@ -159,7 +159,7 @@ t_part CREATE TABLE `t_part` ( `id` int(11) DEFAULT NULL, `title` varchar(30) DEFAULT NULL, KEY `idx` (`class`,`id`,`title`(10)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`id`) SUBPARTITION BY KEY (`id`) SUBPARTITIONS 4 diff --git a/mysql-test/suite/innodb/r/innodb_ctype_big5.result b/mysql-test/suite/innodb/r/innodb_ctype_big5.result index e417b07a21a13..4c9f7a81cc335 100644 --- a/mysql-test/suite/innodb/r/innodb_ctype_big5.result +++ b/mysql-test/suite/innodb/r/innodb_ctype_big5.result @@ -16,7 +16,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_chinese_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE big5_chinese_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=big5 COLLATE=big5_chinese_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -153,7 +153,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE big5_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=big5 COLLATE=big5_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); diff --git a/mysql-test/suite/innodb/r/innodb_ctype_latin1.result b/mysql-test/suite/innodb/r/innodb_ctype_latin1.result index b605b65dbfb13..d576f210d5af2 100644 --- a/mysql-test/suite/innodb/r/innodb_ctype_latin1.result +++ b/mysql-test/suite/innodb/r/innodb_ctype_latin1.result @@ -16,7 +16,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_swedish_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin1_swedish_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -153,7 +153,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE latin1_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); diff --git a/mysql-test/suite/innodb/r/innodb_ctype_ldml.result b/mysql-test/suite/innodb/r/innodb_ctype_ldml.result index 7cc6540d6712b..82679961d6826 100644 --- a/mysql-test/suite/innodb/r/innodb_ctype_ldml.result +++ b/mysql-test/suite/innodb/r/innodb_ctype_ldml.result @@ -448,7 +448,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` char(1) CHARACTER SET ucs2 COLLATE ucs2_vn_ci DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (0x0061); set @@character_set_results=NULL; select * from t1; diff --git a/mysql-test/suite/innodb/r/innodb_ctype_tis620.result b/mysql-test/suite/innodb/r/innodb_ctype_tis620.result index 0dc71fec71962..cf15d1232aada 100644 --- a/mysql-test/suite/innodb/r/innodb_ctype_tis620.result +++ b/mysql-test/suite/innodb/r/innodb_ctype_tis620.result @@ -9,8 +9,8 @@ CREATE TABLE t1(c TEXT CHARACTER SET tis620); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` text CHARACTER SET tis620 DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 + `c` text CHARACTER SET tis620 COLLATE tis620_thai_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES('100'); ALTER TABLE t1 ADD FULLTEXT INDEX(c), ALGORITHM=INPLACE; DROP TABLE t1; @@ -19,10 +19,76 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` text CHARACTER SET tis620 COLLATE tis620_thai_nopad_ci DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES('100'); ALTER TABLE t1 ADD FULLTEXT INDEX(c), ALGORITHM=INPLACE; DROP TABLE t1; # # End of 10.2 tests # +# +# Start of 10.4 tests +# +# +# MDEV-27670 Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit +# +CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(8), KEY(a)) ENGINE=InnoDB COLLATE tis620_thai_nopad_ci; +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +DROP TABLE t1; +# +# MDEV-27768 MDEV-25440: Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit +# +CREATE TABLE t1 (a INT KEY,b INT,c CHAR,KEY(b),KEY(c)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB; +INSERT INTO t1 VALUES (3,4,4); +DROP TABLE t1; +CREATE TABLE t1 (C1 CHAR KEY,B1 BIT,B2 BIT,C2 CHAR DEFAULT'') ROW_FORMAT=DYNAMIC COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB; +SELECT HEX(c1),HEX (c2) FROM t1 WHERE c1>=''AND c1<''AND c2=''LIMIT 2; +HEX(c1) HEX (c2) +DROP TABLE t1; +SET sql_mode=''; +CREATE TABLE t1 (a INT UNSIGNED,b INT,c CHAR(1),d BINARY (1),e VARCHAR(1),f VARBINARY(1),g BLOB,h BLOB,id INT,KEY(b),KEY(e)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB; +INSERT INTO t1 VALUES (4386060749083099108,157,0,0,0,0,0,0,12); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +INSERT INTO t1 VALUES (104,15158706241929488558,0,0,0,0,0,0,13); +Warnings: +Warning 1264 Out of range value for column 'b' at row 1 +SELECT GROUP_CONCAT(DISTINCT a,b ORDER BY c,b) FROM t1; +GROUP_CONCAT(DISTINCT a,b ORDER BY c,b) +4294967295157,1042147483647 +DROP TABLE t1; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a CHAR(9),b CHAR(7)) COLLATE=tis620_thai_nopad_ci; +INSERT INTO t1 VALUES (0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0); +ALTER TABLE t1 ADD INDEX kb (b),ADD INDEX kab (a,b),ALGORITHM=INPLACE; +DROP TABLE t1; +SET sql_mode=''; +CREATE TABLE t1 (a INT UNSIGNED,b INT UNSIGNED,c CHAR(1),d CHAR(1),e VARCHAR(1),f VARCHAR(1),g BLOB,h BLOB,id INT,KEY(b),KEY(e)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci; +INSERT INTO t1 VALUES (15842995496588415350,5339224446865937973,0,0,0,0,0,0,4); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'b' at row 1 +INSERT INTO t1 VALUES (8118894032862615316,5299008984764990929,0,0,0,0,0,0,1); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'b' at row 1 +SELECT GROUP_CONCAT(DISTINCT a,c ORDER BY a) FROM t1; +GROUP_CONCAT(DISTINCT a,c ORDER BY a) +42949672950 +DROP TABLE t1; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a CHAR,b CHAR,KEY(a,b)) ROW_FORMAT=DYNAMIC COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB; +INSERT INTO t1 VALUES (0,0); +DROP TABLE t1; +CREATE TABLE t1 (a CHAR,b CHAR) COLLATE=tis620_thai_nopad_ci; +INSERT INTO t1 VALUES (0,0); +SELECT a,SUM(DISTINCT a),MIN(b) FROM t1 GROUP BY a; +a SUM(DISTINCT a) MIN(b) +0 0 0 +DROP TABLE t1; +CREATE TABLE t1 (a CHAR,KEY(a)) ENGINE=InnoDB COLLATE=tis620_thai_nopad_ci; +INSERT INTO t1 VALUES (0); +DROP TABLE t1; +# +# End of 10.4 tests +# diff --git a/mysql-test/suite/innodb/r/innodb_ctype_utf8.result b/mysql-test/suite/innodb/r/innodb_ctype_utf8.result index 38196899a12f2..3ce1d3a1d53cc 100644 --- a/mysql-test/suite/innodb/r/innodb_ctype_utf8.result +++ b/mysql-test/suite/innodb/r/innodb_ctype_utf8.result @@ -16,7 +16,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_general_nopad_ci'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb3_general_nopad_ci NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_nopad_ci INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -153,7 +153,7 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_nopad_bin'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) COLLATE utf8mb3_nopad_bin NOT NULL, + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_nopad_bin INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); @@ -283,3 +283,101 @@ DROP TABLE t1; # # End of 10.2 tests # +# +# Start of 10.4 tests +# +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_nopad_ci; +# +# MDEV-30034 UNIQUE USING HASH accepts duplicate entries for tricky collations +# +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a TEXT COLLATE ,' + 'UNIQUE(a(3)))', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +ERROR 23000: Duplicate entry 'ß ' for key 'a' +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a TEXT COLLATE ,' + 'UNIQUE(a(3)) USING HASH)', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) USING HASH +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +ERROR 23000: Duplicate entry 'ß ' for key 'a' +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a VARCHAR(2000) COLLATE ,' + 'UNIQUE(a(3)))', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(2000) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +ERROR 23000: Duplicate entry 'ß ' for key 'a' +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a VARCHAR(2000) COLLATE ,' + 'UNIQUE(a(3)) USING HASH)', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(2000) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) USING HASH +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +ERROR 23000: Duplicate entry 'ß ' for key 'a' +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a CHAR(20) COLLATE ,' + 'UNIQUE(a(3)))', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a CHAR(20) COLLATE ,' + 'UNIQUE(a(3)) USING HASH)', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) USING HASH +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; +# +# End 10.4 tests +# diff --git a/mysql-test/suite/innodb/r/innodb_force_pk.result b/mysql-test/suite/innodb/r/innodb_force_pk.result index 867730a924780..64f728e4785a5 100644 --- a/mysql-test/suite/innodb/r/innodb_force_pk.result +++ b/mysql-test/suite/innodb/r/innodb_force_pk.result @@ -20,7 +20,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show warnings; Level Code Message drop table t1; @@ -30,7 +30,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, UNIQUE KEY `a` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show warnings; Level Code Message drop table t1; @@ -61,5 +61,5 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) NOT NULL, UNIQUE KEY `i` (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb_force_recovery.result b/mysql-test/suite/innodb/r/innodb_force_recovery.result index 029a6f71fa337..0523995067882 100644 --- a/mysql-test/suite/innodb/r/innodb_force_recovery.result +++ b/mysql-test/suite/innodb/r/innodb_force_recovery.result @@ -103,7 +103,7 @@ SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; select * from t2; f1 f2 1 2 -SET GLOBAL innodb_lock_wait_timeout=1; +SET SESSION innodb_lock_wait_timeout=1; insert into t2 values(1,2); ERROR HY000: Lock wait timeout exceeded; try restarting transaction insert into t2 values(9,10); diff --git a/mysql-test/suite/innodb/r/innodb_gis.result b/mysql-test/suite/innodb/r/innodb_gis.result index 90fc5be1e733b..4c89ad4b9fbc6 100644 --- a/mysql-test/suite/innodb/r/innodb_gis.result +++ b/mysql-test/suite/innodb/r/innodb_gis.result @@ -14,7 +14,7 @@ gis_point CREATE TABLE `gis_point` ( `fid` int(11) NOT NULL AUTO_INCREMENT, `g` point DEFAULT NULL, PRIMARY KEY (`fid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW FIELDS FROM gis_point; Field Type Null Key Default Extra fid int(11) NO PRI NULL auto_increment @@ -452,9 +452,9 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field drop table t1; create table t1 (pk integer primary key auto_increment, fl geometry not null); insert into t1 (fl) values (1); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t1`.`fl` insert into t1 (fl) values (1.11); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Cannot cast 'decimal' as 'geometry' in assignment of `test`.`t1`.`fl` insert into t1 (fl) values ("qwerty"); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 (fl) values (pointfromtext('point(1,1)')); diff --git a/mysql-test/suite/innodb/r/innodb_information_schema.result b/mysql-test/suite/innodb/r/innodb_information_schema.result index 6325917c236ef..921b062eae32f 100644 --- a/mysql-test/suite/innodb/r/innodb_information_schema.result +++ b/mysql-test/suite/innodb/r/innodb_information_schema.result @@ -1,18 +1,18 @@ lock_mode lock_type lock_table lock_index lock_rec lock_data -X RECORD `test`.```t'\"_str` PRIMARY 2 '1', 'abc', '''abc', 'abc''', 'a''bc', 'a''bc''', '''abc''''' -X RECORD `test`.```t'\"_str` PRIMARY 2 '1', 'abc', '''abc', 'abc''', 'a''bc', 'a''bc''', '''abc''''' -X RECORD `test`.```t'\"_str` PRIMARY 3 '2', 'abc', '"abc', 'abc"', 'a"bc', 'a"bc"', '"abc""' -X RECORD `test`.```t'\"_str` PRIMARY 3 '2', 'abc', '"abc', 'abc"', 'a"bc', 'a"bc"', '"abc""' -X RECORD `test`.```t'\"_str` PRIMARY 4 '3', 'abc', '\\abc', 'abc\\', 'a\\bc', 'a\\bc\\', '\\abc\\\\' -X RECORD `test`.```t'\"_str` PRIMARY 4 '3', 'abc', '\\abc', 'abc\\', 'a\\bc', 'a\\bc\\', '\\abc\\\\' -X RECORD `test`.```t'\"_str` PRIMARY 5 '4', 'abc', '\0abc', 'abc\0', 'a\0bc', 'a\0bc\0', 'a\0bc\0\0' -X RECORD `test`.```t'\"_str` PRIMARY 5 '4', 'abc', '\0abc', 'abc\0', 'a\0bc', 'a\0bc\0', 'a\0bc\0\0' -X RECORD `test`.`t_min` PRIMARY 2 -128, 0, -32768, 0, -8388608, 0, -2147483648, 0, -9223372036854775808, 0 -X RECORD `test`.`t_min` PRIMARY 2 -128, 0, -32768, 0, -8388608, 0, -2147483648, 0, -9223372036854775808, 0 -X RECORD `test`.`t_max` PRIMARY 2 127, 255, 32767, 65535, 8388607, 16777215, 2147483647, 4294967295, 9223372036854775807, 18446744073709551615 -X RECORD `test`.`t_max` PRIMARY 2 127, 255, 32767, 65535, 8388607, 16777215, 2147483647, 4294967295, 9223372036854775807, 18446744073709551615 -X RECORD `test`.```t'\"_str` PRIMARY 1 supremum pseudo-record -X RECORD `test`.```t'\"_str` PRIMARY 1 supremum pseudo-record +X RECORD `test`.```t'\"_str` PRIMARY 1 # +X RECORD `test`.```t'\"_str` PRIMARY 1 # +X RECORD `test`.```t'\"_str` PRIMARY 2 # +X RECORD `test`.```t'\"_str` PRIMARY 2 # +X RECORD `test`.```t'\"_str` PRIMARY 3 # +X RECORD `test`.```t'\"_str` PRIMARY 3 # +X RECORD `test`.```t'\"_str` PRIMARY 4 # +X RECORD `test`.```t'\"_str` PRIMARY 4 # +X RECORD `test`.```t'\"_str` PRIMARY 5 # +X RECORD `test`.```t'\"_str` PRIMARY 5 # +X RECORD `test`.`t_max` PRIMARY 2 # +X RECORD `test`.`t_max` PRIMARY 2 # +X RECORD `test`.`t_min` PRIMARY 2 # +X RECORD `test`.`t_min` PRIMARY 2 # lock_table COUNT(*) `test`.`t_max` 2 `test`.`t_min` 2 @@ -22,28 +22,28 @@ lock_table COUNT(*) "test"."t_min" 2 "test"."`t'\""_str" 10 Field Type Null Key Default Extra -trx_id bigint(21) unsigned NO 0 -trx_state varchar(13) NO -trx_started datetime NO 0000-00-00 00:00:00 +trx_id bigint(21) unsigned NO NULL +trx_state varchar(13) NO NULL +trx_started datetime NO NULL trx_requested_lock_id varchar(81) YES NULL trx_wait_started datetime YES NULL -trx_weight bigint(21) unsigned NO 0 -trx_mysql_thread_id bigint(21) unsigned NO 0 +trx_weight bigint(21) unsigned NO NULL +trx_mysql_thread_id bigint(21) unsigned NO NULL trx_query varchar(1024) YES NULL trx_operation_state varchar(64) YES NULL -trx_tables_in_use bigint(21) unsigned NO 0 -trx_tables_locked bigint(21) unsigned NO 0 -trx_lock_structs bigint(21) unsigned NO 0 -trx_lock_memory_bytes bigint(21) unsigned NO 0 -trx_rows_locked bigint(21) unsigned NO 0 -trx_rows_modified bigint(21) unsigned NO 0 -trx_concurrency_tickets bigint(21) unsigned NO 0 +trx_tables_in_use bigint(21) unsigned NO NULL +trx_tables_locked bigint(21) unsigned NO NULL +trx_lock_structs bigint(21) unsigned NO NULL +trx_lock_memory_bytes bigint(21) unsigned NO NULL +trx_rows_locked bigint(21) unsigned NO NULL +trx_rows_modified bigint(21) unsigned NO NULL +trx_concurrency_tickets bigint(21) unsigned NO NULL trx_isolation_level enum('READ UNCOMMITTED','READ COMMITTED','REPEATABLE READ','SERIALIZABLE') NO NULL -trx_unique_checks int(1) NO 0 -trx_foreign_key_checks int(1) NO 0 +trx_unique_checks int(1) NO NULL +trx_foreign_key_checks int(1) NO NULL trx_last_foreign_key_error varchar(256) YES NULL -trx_is_read_only int(1) NO 0 -trx_autocommit_non_locking int(1) NO 0 +trx_is_read_only int(1) NO NULL +trx_autocommit_non_locking int(1) NO NULL trx_state trx_weight trx_tables_in_use trx_tables_locked trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks trx_foreign_key_checks RUNNING 3 0 1 6 1 0 REPEATABLE READ 1 1 trx_isolation_level trx_unique_checks trx_foreign_key_checks diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result index 309ca847efb4e..aa8cc118ce6e5 100644 --- a/mysql-test/suite/innodb/r/innodb_mysql.result +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -1000,7 +1000,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='123' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='123' drop table t1; CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8; INSERT INTO t1 VALUES ('uk'),('bg'); @@ -1564,7 +1564,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` text DEFAULT NULL, KEY `a` (`a`(1024)) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci drop table t1; CREATE TABLE t1 ( a INT, @@ -1780,7 +1780,7 @@ t1 CREATE TABLE `t1` ( `b` char(4) NOT NULL, UNIQUE KEY `bb` (`b`), UNIQUE KEY `aa` (`a`(1)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; CREATE TABLE t1 (id int, type char(6), d int, INDEX idx(id,d)) ENGINE=InnoDB; INSERT INTO t1 VALUES @@ -1852,7 +1852,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f1`), KEY `f2_ref` (`f2`), CONSTRAINT `f2_ref` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Bug #36995: valgrind error in remove_const during subquery executions @@ -2139,7 +2139,7 @@ t2 CREATE TABLE `t2` ( CONSTRAINT `c2` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION, CONSTRAINT `f3` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; create table t1 (a int auto_increment primary key) engine=innodb; @@ -2190,7 +2190,7 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1) FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY ALL NULL NULL NULL NULL 2 -2 DERIVED t1 ref c3,c2 c3 5 const 2 Using where; Using filesort +2 DERIVED t1 ref c3,c2 c3 5 const 2 Using where DROP TABLE t1; CREATE TABLE t1 (c1 REAL, c2 REAL, c3 REAL, KEY (c3), KEY (c2, c3)) ENGINE=InnoDB; @@ -2204,7 +2204,7 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1) FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY ALL NULL NULL NULL NULL 2 -2 DERIVED t1 ref c3,c2 c3 9 const 2 Using where; Using filesort +2 DERIVED t1 ref c3,c2 c3 9 const 2 Using where DROP TABLE t1; CREATE TABLE t1 (c1 DECIMAL(12,2), c2 DECIMAL(12,2), c3 DECIMAL(12,2), KEY (c3), KEY (c2, c3)) @@ -2219,7 +2219,7 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1) FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY ALL NULL NULL NULL NULL 2 -2 DERIVED t1 ref c3,c2 c3 7 const 2 Using where; Using filesort +2 DERIVED t1 ref c3,c2 c3 7 const 2 Using where DROP TABLE t1; End of 5.1 tests # @@ -3203,7 +3203,7 @@ t2 CREATE TABLE `t2` ( `fk` int(11) DEFAULT NULL, KEY `x` (`fk`), CONSTRAINT `x` FOREIGN KEY (`fk`) REFERENCES `t1` (`pk`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2, t1; # # Test for bug #11762012 - "54553: INNODB ASSERTS IN HA_INNOBASE:: diff --git a/mysql-test/suite/innodb/r/innodb_page_compressed.result b/mysql-test/suite/innodb/r/innodb_page_compressed.result new file mode 100644 index 0000000000000..a494ff03e8b74 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_page_compressed.result @@ -0,0 +1,53 @@ +SET @save_algorithm = @@GLOBAL.innodb_compression_algorithm; +create table innodb_normal (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table innodb_page_compressed1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; +create table innodb_page_compressed2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; +create table innodb_page_compressed3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; +create table innodb_page_compressed4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; +create table innodb_page_compressed5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; +create table innodb_page_compressed6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; +create table innodb_page_compressed7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; +create table innodb_page_compressed8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; +create table innodb_page_compressed9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; +connect prevent_purge,localhost,root; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +begin; +insert into innodb_normal SET b=REPEAT('Aa',50); +insert into innodb_page_compressed1 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed2 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed3 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed4 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed5 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed6 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed7 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed8 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed9 SET b=REPEAT('Aa',50); +commit; +FLUSH TABLES innodb_normal, +innodb_page_compressed1, innodb_page_compressed2, innodb_page_compressed3, +innodb_page_compressed4, innodb_page_compressed5, innodb_page_compressed6, +innodb_page_compressed7, innodb_page_compressed8, innodb_page_compressed9 +FOR EXPORT; +FOUND 12 /AaAaAaAa/ in innodb_normal.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed1.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed2.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed3.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed4.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed5.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed6.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed7.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed8.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed9.ibd +UNLOCK TABLES; +drop table innodb_normal; +drop table innodb_page_compressed1; +drop table innodb_page_compressed2; +drop table innodb_page_compressed3; +drop table innodb_page_compressed4; +drop table innodb_page_compressed5; +drop table innodb_page_compressed6; +drop table innodb_page_compressed7; +drop table innodb_page_compressed8; +drop table innodb_page_compressed9; +SET GLOBAL innodb_compression_algorithm=@save_algorithm; diff --git a/mysql-test/suite/innodb/r/innodb_rename_index.result b/mysql-test/suite/innodb/r/innodb_rename_index.result index 482070c4ffc6d..43cf8fc5fb942 100644 --- a/mysql-test/suite/innodb/r/innodb_rename_index.result +++ b/mysql-test/suite/innodb/r/innodb_rename_index.result @@ -44,7 +44,7 @@ t CREATE TABLE `t` ( KEY `i3` (`d`), KEY `i4` (`e`), KEY `i1` (`f`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT t.name AS table_name, i.name AS index_name, @@ -103,7 +103,7 @@ t CREATE TABLE `t` ( KEY `i3` (`d`), KEY `i4` (`e`), KEY `aa` (`f`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT t.name AS table_name, i.name AS index_name, @@ -180,7 +180,7 @@ t CREATE TABLE `t` ( KEY `i3` (`d`), KEY `i4` (`e`), KEY `i1` (`f`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT t.name AS table_name, i.name AS index_name, @@ -264,7 +264,7 @@ t CREATE TABLE `t` ( KEY `i2` (`c`), KEY `i3` (`d`), KEY `i1` (`e`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT t.name AS table_name, i.name AS index_name, @@ -352,7 +352,7 @@ t CREATE TABLE `t` ( KEY `dd` (`d`), KEY `i4` (`e`), KEY `aa` (`f`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT t.name AS table_name, i.name AS index_name, @@ -405,7 +405,7 @@ t CREATE TABLE `t` ( KEY `i3` (`d`), KEY `i4` (`e`), KEY `i1` (`f`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT t.name AS table_name, i.name AS index_name, @@ -478,7 +478,7 @@ t CREATE TABLE `t` ( KEY `i3` (`c`), KEY `i4` (`e`), KEY `aa` (`f`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT t.name AS table_name, i.name AS index_name, @@ -545,7 +545,7 @@ t CREATE TABLE `t` ( KEY `bb` (`d`), KEY `i4` (`e`), KEY `i3` (`f`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT t.name AS table_name, i.name AS index_name, @@ -612,7 +612,7 @@ t CREATE TABLE `t` ( KEY `i2` (`c`), KEY `i4` (`e`), KEY `i3` (`f`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT t.name AS table_name, i.name AS index_name, @@ -664,7 +664,7 @@ t CREATE TABLE `t` ( KEY `i2` (`c`), KEY `i3` (`d`), KEY `i4` (`e`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT t.name AS table_name, i.name AS index_name, @@ -721,7 +721,7 @@ t CREATE TABLE `t` ( KEY `i3` (`d`), KEY `i4` (`e`), KEY `i9` (`f`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT t.name AS table_name, i.name AS index_name, @@ -775,7 +775,7 @@ t CREATE TABLE `t` ( KEY `i3` (`d`), KEY `i4` (`e`), KEY `i1` (`f`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT t.name AS table_name, i.name AS index_name, @@ -839,7 +839,7 @@ t CREATE TABLE `t` ( KEY `i2` (`c`), KEY `i3` (`d`), KEY `i4` (`e`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT t.name AS table_name, i.name AS index_name, @@ -883,7 +883,7 @@ t CREATE TABLE `t` ( PRIMARY KEY (`c2`), KEY `x` (`c3`), KEY `i2` (`c4`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT t.name AS table_name, i.name AS index_name, @@ -914,7 +914,7 @@ t CREATE TABLE `t` ( PRIMARY KEY (`c2`), KEY `x` (`c3`), KEY `y` (`c4`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT SELECT t.name AS table_name, i.name AS index_name, @@ -953,7 +953,7 @@ t CREATE TABLE `t` ( PRIMARY KEY (`c1`), KEY `x` (`c2`), KEY `i2` (`c3`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT t.name AS table_name, i.name AS index_name, diff --git a/mysql-test/suite/innodb/r/innodb_scrub.result b/mysql-test/suite/innodb/r/innodb_scrub.result index 1a4db0b541e22..b4a418ce2ad55 100644 --- a/mysql-test/suite/innodb/r/innodb_scrub.result +++ b/mysql-test/suite/innodb/r/innodb_scrub.result @@ -10,3 +10,18 @@ FLUSH TABLE t1 FOR EXPORT; UNLOCK TABLES; NOT FOUND /unicycle|repairman/ in t1.ibd DROP TABLE t1; +# +# MDEV-30527 Assertion !m_freed_pages in mtr_t::start() +# on DROP TEMPORARY TABLE +# +SET @scrub= @@GLOBAL.innodb_immediate_scrub_data_uncompressed; +SET GLOBAL innodb_immediate_scrub_data_uncompressed= 1; +SET @fpt=@@GLOBAL.innodb_file_per_table; +SET GLOBAL innodb_file_per_table=0; +CREATE TABLE t ENGINE=InnoDB AS SELECT 1; +DROP TABLE t; +SET GLOBAL innodb_file_per_table=@fpt; +CREATE TEMPORARY TABLE tmp ENGINE=InnoDB AS SELECT 1; +DROP TABLE tmp; +SET GLOBAL INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED= @scrub; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result index 2bbe990d7f113..385034f7853c5 100644 --- a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result +++ b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result @@ -69,8 +69,6 @@ buffer_pool_bytes_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL buffer_pool_pages_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer pages currently free (innodb_buffer_pool_pages_free) buffer_pages_created buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages created (innodb_pages_created) buffer_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages written (innodb_pages_written) -buffer_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of index pages written (innodb_index_pages_written) -buffer_non_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of non index pages written (innodb_non_index_pages_written) buffer_pages_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages read (innodb_pages_read) buffer_index_sec_rec_cluster_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of secondary record reads triggered cluster read buffer_index_sec_rec_cluster_reads_avoided buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of secondary record reads avoided triggering cluster read @@ -163,8 +161,8 @@ trx_commits_insert_update transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NUL trx_rollbacks transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back trx_rollbacks_savepoint transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back to savepoint trx_rseg_history_len transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Length of the TRX_RSEG_HISTORY list -trx_undo_slots_used transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo slots used -trx_undo_slots_cached transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo slots cached +trx_undo_slots_used transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of undo slots used +trx_undo_slots_cached transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of undo slots cached trx_rseg_current_size transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Current rollback segment size in pages purge_del_mark_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of delete-marked rows purged purge_upd_exist_or_extern_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of purges on updates of existing records and updates on delete marked record with externally stored field @@ -180,7 +178,6 @@ log_lsn_current recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 log_lsn_checkpoint_age recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Current LSN value minus LSN at last checkpoint log_lsn_buf_pool_oldest recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value The oldest modified block LSN in the buffer pool log_max_modified_age_async recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Maximum LSN difference; when exceeded, start asynchronous preflush -log_num_log_io recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of log I/Os log_waits recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of log waits due to small log buffer (innodb_log_waits) log_write_requests recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of log write requests (innodb_log_write_requests) log_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of log writes (innodb_log_writes) @@ -195,7 +192,7 @@ compress_pages_page_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL N compress_pages_page_compression_error compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of page compression errors compress_pages_encrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages encrypted compress_pages_decrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages decrypted -index_page_splits index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index page splits +index_page_splits index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of index page splits index_page_merge_attempts index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index page merge attempts index_page_merge_successful index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of successful index page merges index_page_reorg_attempts index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index page reorganization attempts diff --git a/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result b/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result index 13f21463390c3..70f1edabf1178 100644 --- a/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result +++ b/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result @@ -34,7 +34,7 @@ Table Create Table innodb_stats_drop_locked CREATE TABLE `innodb_stats_drop_locked` ( `c` int(11) DEFAULT NULL, KEY `c_key` (`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=1 DROP TABLE innodb_stats_drop_locked; ERROR HY000: Lock wait timeout exceeded; try restarting transaction DROP DATABASE unlocked; diff --git a/mysql-test/suite/innodb/r/innodb_status_variables.result b/mysql-test/suite/innodb/r/innodb_status_variables.result index 02f73f37d66dc..dd3d3ca1dd267 100644 --- a/mysql-test/suite/innodb/r/innodb_status_variables.result +++ b/mysql-test/suite/innodb/r/innodb_status_variables.result @@ -23,6 +23,7 @@ INNODB_BUFFER_POOL_PAGES_OLD INNODB_BUFFER_POOL_PAGES_TOTAL INNODB_BUFFER_POOL_PAGES_LRU_FLUSHED INNODB_BUFFER_POOL_PAGES_LRU_FREED +INNODB_BUFFER_POOL_PAGES_SPLIT INNODB_BUFFER_POOL_READ_AHEAD_RND INNODB_BUFFER_POOL_READ_AHEAD INNODB_BUFFER_POOL_READ_AHEAD_EVICTED @@ -87,8 +88,6 @@ INNODB_TRUNCATED_STATUS_WRITES INNODB_AVAILABLE_UNDO_LOGS INNODB_UNDO_TRUNCATIONS INNODB_PAGE_COMPRESSION_SAVED -INNODB_NUM_INDEX_PAGES_WRITTEN -INNODB_NUM_NON_INDEX_PAGES_WRITTEN INNODB_NUM_PAGES_PAGE_COMPRESSED INNODB_NUM_PAGE_COMPRESSED_TRIM_OP INNODB_NUM_PAGES_PAGE_DECOMPRESSED @@ -115,7 +114,6 @@ INNODB_ENCRYPTION_ROTATION_PAGES_READ_FROM_DISK INNODB_ENCRYPTION_ROTATION_PAGES_MODIFIED INNODB_ENCRYPTION_ROTATION_PAGES_FLUSHED INNODB_ENCRYPTION_ROTATION_ESTIMATED_IOPS -INNODB_ENCRYPTION_KEY_ROTATION_LIST_LENGTH INNODB_ENCRYPTION_N_MERGE_BLOCKS_ENCRYPTED INNODB_ENCRYPTION_N_MERGE_BLOCKS_DECRYPTED INNODB_ENCRYPTION_N_ROWLOG_BLOCKS_ENCRYPTED diff --git a/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result b/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result index 32d87b4668a23..6932b8f22926e 100644 --- a/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result +++ b/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result @@ -25,27 +25,6 @@ select @@innodb_ft_server_stopword_table; @@innodb_ft_server_stopword_table NULL drop table user_stopword_1, user_stopword_2; -select @@innodb_buffer_pool_filename; -@@innodb_buffer_pool_filename -ib_buffer_pool -set @blah='hello'; -set global innodb_buffer_pool_filename = @blah; -select @@innodb_buffer_pool_filename; -@@innodb_buffer_pool_filename -hello -set global innodb_buffer_pool_filename="bye"; -select @@innodb_buffer_pool_filename; -@@innodb_buffer_pool_filename -bye -set global innodb_buffer_pool_filename=NULL; -ERROR 42000: Variable 'innodb_buffer_pool_filename' can't be set to the value of 'NULL' -select @@innodb_buffer_pool_filename; -@@innodb_buffer_pool_filename -bye -set global innodb_buffer_pool_filename=default; -select @@innodb_buffer_pool_filename; -@@innodb_buffer_pool_filename -ib_buffer_pool CREATE TABLE t1 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, opening_line TEXT(500), author VARCHAR(200), title VARCHAR(200), FULLTEXT idx (opening_line)) ENGINE=InnoDB; diff --git a/mysql-test/suite/innodb/r/innodb_wl6326.result b/mysql-test/suite/innodb/r/innodb_wl6326.result deleted file mode 100644 index fcd58aedafe95..0000000000000 --- a/mysql-test/suite/innodb/r/innodb_wl6326.result +++ /dev/null @@ -1,405 +0,0 @@ -SET GLOBAL innodb_adaptive_hash_index = false; -SET GLOBAL innodb_stats_persistent = false; -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connect con3,localhost,root,,; -CREATE TABLE t1 ( -a00 CHAR(255) NOT NULL DEFAULT 'a', -a01 CHAR(255) NOT NULL DEFAULT 'a', -a02 CHAR(255) NOT NULL DEFAULT 'a', -a03 CHAR(255) NOT NULL DEFAULT 'a', -a04 CHAR(255) NOT NULL DEFAULT 'a', -a05 CHAR(255) NOT NULL DEFAULT 'a', -a06 CHAR(255) NOT NULL DEFAULT 'a', -b INT NOT NULL DEFAULT 0 -) ENGINE = InnoDB; -ALTER TABLE t1 ADD PRIMARY KEY( -a00, -a01, -a02, -a03, -a04, -a05, -a06 -); -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze status OK -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; -CLUST_INDEX_SIZE -1 -SET GLOBAL innodb_limit_optimistic_insert_debug = 7; -BEGIN; -INSERT INTO t1 (a00) VALUES ('aa'); -INSERT INTO t1 (a00) VALUES ('ab'); -INSERT INTO t1 (a00) VALUES ('ac'); -INSERT INTO t1 (a00) VALUES ('ad'); -INSERT INTO t1 (a00) VALUES ('ae'); -INSERT INTO t1 (a00) VALUES ('af'); -INSERT INTO t1 (a00) VALUES ('ag'); -INSERT INTO t1 (a00) VALUES ('ah'); -COMMIT; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze status OK -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; -CLUST_INDEX_SIZE -3 -BEGIN; -INSERT INTO t1 (a00) VALUES ('ai'); -INSERT INTO t1 (a00) VALUES ('aj'); -INSERT INTO t1 (a00) VALUES ('ak'); -COMMIT; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze status OK -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; -CLUST_INDEX_SIZE -4 -BEGIN; -INSERT INTO t1 (a00) VALUES ('al'); -INSERT INTO t1 (a00) VALUES ('am'); -INSERT INTO t1 (a00) VALUES ('an'); -INSERT INTO t1 (a00) VALUES ('ao'); -INSERT INTO t1 (a00) VALUES ('ap'); -INSERT INTO t1 (a00) VALUES ('aq'); -INSERT INTO t1 (a00) VALUES ('ar'); -COMMIT; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze status OK -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; -CLUST_INDEX_SIZE -5 -BEGIN; -INSERT INTO t1 (a00) VALUES ('as'); -INSERT INTO t1 (a00) VALUES ('at'); -INSERT INTO t1 (a00) VALUES ('au'); -INSERT INTO t1 (a00) VALUES ('av'); -INSERT INTO t1 (a00) VALUES ('aw'); -INSERT INTO t1 (a00) VALUES ('ax'); -INSERT INTO t1 (a00) VALUES ('ay'); -COMMIT; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze status OK -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; -CLUST_INDEX_SIZE -6 -BEGIN; -INSERT INTO t1 (a00) VALUES ('az'); -INSERT INTO t1 (a00) VALUES ('ba'); -INSERT INTO t1 (a00) VALUES ('bb'); -INSERT INTO t1 (a00) VALUES ('bc'); -INSERT INTO t1 (a00) VALUES ('bd'); -INSERT INTO t1 (a00) VALUES ('be'); -INSERT INTO t1 (a00) VALUES ('bf'); -COMMIT; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze status OK -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; -CLUST_INDEX_SIZE -7 -BEGIN; -INSERT INTO t1 (a00) VALUES ('bg'); -INSERT INTO t1 (a00) VALUES ('bh'); -INSERT INTO t1 (a00) VALUES ('bi'); -INSERT INTO t1 (a00) VALUES ('bj'); -INSERT INTO t1 (a00) VALUES ('bk'); -INSERT INTO t1 (a00) VALUES ('bl'); -INSERT INTO t1 (a00) VALUES ('bm'); -COMMIT; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze status OK -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; -CLUST_INDEX_SIZE -8 -BEGIN; -INSERT INTO t1 (a00) VALUES ('bn'); -INSERT INTO t1 (a00) VALUES ('bo'); -INSERT INTO t1 (a00) VALUES ('bp'); -INSERT INTO t1 (a00) VALUES ('bq'); -INSERT INTO t1 (a00) VALUES ('br'); -INSERT INTO t1 (a00) VALUES ('bs'); -INSERT INTO t1 (a00) VALUES ('bt'); -COMMIT; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze status OK -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; -CLUST_INDEX_SIZE -11 -BEGIN; -INSERT INTO t1 (a00) VALUES ('bu'); -INSERT INTO t1 (a00) VALUES ('bv'); -INSERT INTO t1 (a00) VALUES ('bw'); -INSERT INTO t1 (a00) VALUES ('bx'); -INSERT INTO t1 (a00) VALUES ('by'); -INSERT INTO t1 (a00) VALUES ('bz'); -INSERT INTO t1 (a00) VALUES ('ca'); -INSERT INTO t1 (a00) VALUES ('cb'); -INSERT INTO t1 (a00) VALUES ('cc'); -INSERT INTO t1 (a00) VALUES ('cd'); -INSERT INTO t1 (a00) VALUES ('ce'); -INSERT INTO t1 (a00) VALUES ('cf'); -INSERT INTO t1 (a00) VALUES ('cg'); -INSERT INTO t1 (a00) VALUES ('ch'); -INSERT INTO t1 (a00) VALUES ('ci'); -INSERT INTO t1 (a00) VALUES ('cj'); -INSERT INTO t1 (a00) VALUES ('ck'); -INSERT INTO t1 (a00) VALUES ('cl'); -INSERT INTO t1 (a00) VALUES ('cm'); -INSERT INTO t1 (a00) VALUES ('cn'); -INSERT INTO t1 (a00) VALUES ('co'); -COMMIT; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze status OK -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; -CLUST_INDEX_SIZE -15 -BEGIN; -INSERT INTO t1 (a00) VALUES ('cp'); -INSERT INTO t1 (a00) VALUES ('cq'); -INSERT INTO t1 (a00) VALUES ('cr'); -INSERT INTO t1 (a00) VALUES ('cs'); -INSERT INTO t1 (a00) VALUES ('ct'); -INSERT INTO t1 (a00) VALUES ('cu'); -INSERT INTO t1 (a00) VALUES ('cv'); -INSERT INTO t1 (a00) VALUES ('cw'); -INSERT INTO t1 (a00) VALUES ('cx'); -INSERT INTO t1 (a00) VALUES ('cy'); -INSERT INTO t1 (a00) VALUES ('cz'); -INSERT INTO t1 (a00) VALUES ('da'); -INSERT INTO t1 (a00) VALUES ('db'); -INSERT INTO t1 (a00) VALUES ('dc'); -INSERT INTO t1 (a00) VALUES ('dd'); -INSERT INTO t1 (a00) VALUES ('de'); -INSERT INTO t1 (a00) VALUES ('df'); -INSERT INTO t1 (a00) VALUES ('dg'); -INSERT INTO t1 (a00) VALUES ('dh'); -INSERT INTO t1 (a00) VALUES ('di'); -INSERT INTO t1 (a00) VALUES ('dj'); -INSERT INTO t1 (a00) VALUES ('dk'); -INSERT INTO t1 (a00) VALUES ('dl'); -INSERT INTO t1 (a00) VALUES ('dm'); -INSERT INTO t1 (a00) VALUES ('dn'); -INSERT INTO t1 (a00) VALUES ('do'); -INSERT INTO t1 (a00) VALUES ('dp'); -INSERT INTO t1 (a00) VALUES ('dq'); -INSERT INTO t1 (a00) VALUES ('dr'); -INSERT INTO t1 (a00) VALUES ('ds'); -INSERT INTO t1 (a00) VALUES ('dt'); -INSERT INTO t1 (a00) VALUES ('du'); -INSERT INTO t1 (a00) VALUES ('dv'); -INSERT INTO t1 (a00) VALUES ('dw'); -INSERT INTO t1 (a00) VALUES ('dx'); -INSERT INTO t1 (a00) VALUES ('dy'); -INSERT INTO t1 (a00) VALUES ('dz'); -INSERT INTO t1 (a00) VALUES ('ea'); -INSERT INTO t1 (a00) VALUES ('eb'); -INSERT INTO t1 (a00) VALUES ('ec'); -INSERT INTO t1 (a00) VALUES ('ed'); -INSERT INTO t1 (a00) VALUES ('ee'); -INSERT INTO t1 (a00) VALUES ('ef'); -INSERT INTO t1 (a00) VALUES ('eg'); -INSERT INTO t1 (a00) VALUES ('eh'); -INSERT INTO t1 (a00) VALUES ('ei'); -INSERT INTO t1 (a00) VALUES ('ej'); -INSERT INTO t1 (a00) VALUES ('ek'); -INSERT INTO t1 (a00) VALUES ('el'); -COMMIT; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze status OK -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; -CLUST_INDEX_SIZE -23 -BEGIN; -INSERT INTO t1 (a00) VALUES ('em'); -INSERT INTO t1 (a00) VALUES ('en'); -INSERT INTO t1 (a00) VALUES ('eo'); -INSERT INTO t1 (a00) VALUES ('ep'); -INSERT INTO t1 (a00) VALUES ('eq'); -INSERT INTO t1 (a00) VALUES ('er'); -INSERT INTO t1 (a00) VALUES ('es'); -INSERT INTO t1 (a00) VALUES ('et'); -INSERT INTO t1 (a00) VALUES ('eu'); -INSERT INTO t1 (a00) VALUES ('ev'); -INSERT INTO t1 (a00) VALUES ('ew'); -INSERT INTO t1 (a00) VALUES ('ex'); -INSERT INTO t1 (a00) VALUES ('ey'); -INSERT INTO t1 (a00) VALUES ('ez'); -INSERT INTO t1 (a00) VALUES ('fa'); -INSERT INTO t1 (a00) VALUES ('fb'); -INSERT INTO t1 (a00) VALUES ('fc'); -INSERT INTO t1 (a00) VALUES ('fd'); -INSERT INTO t1 (a00) VALUES ('fe'); -INSERT INTO t1 (a00) VALUES ('ff'); -INSERT INTO t1 (a00) VALUES ('fg'); -INSERT INTO t1 (a00) VALUES ('fh'); -INSERT INTO t1 (a00) VALUES ('fi'); -INSERT INTO t1 (a00) VALUES ('fj'); -INSERT INTO t1 (a00) VALUES ('fk'); -INSERT INTO t1 (a00) VALUES ('fl'); -INSERT INTO t1 (a00) VALUES ('fm'); -INSERT INTO t1 (a00) VALUES ('fn'); -INSERT INTO t1 (a00) VALUES ('fo'); -INSERT INTO t1 (a00) VALUES ('fp'); -INSERT INTO t1 (a00) VALUES ('fq'); -INSERT INTO t1 (a00) VALUES ('fr'); -INSERT INTO t1 (a00) VALUES ('fs'); -INSERT INTO t1 (a00) VALUES ('ft'); -INSERT INTO t1 (a00) VALUES ('fu'); -INSERT INTO t1 (a00) VALUES ('fv'); -INSERT INTO t1 (a00) VALUES ('fw'); -INSERT INTO t1 (a00) VALUES ('fx'); -INSERT INTO t1 (a00) VALUES ('fy'); -INSERT INTO t1 (a00) VALUES ('fz'); -INSERT INTO t1 (a00) VALUES ('ga'); -INSERT INTO t1 (a00) VALUES ('gb'); -INSERT INTO t1 (a00) VALUES ('gc'); -INSERT INTO t1 (a00) VALUES ('gd'); -INSERT INTO t1 (a00) VALUES ('ge'); -INSERT INTO t1 (a00) VALUES ('gf'); -INSERT INTO t1 (a00) VALUES ('gg'); -INSERT INTO t1 (a00) VALUES ('gh'); -COMMIT; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze status OK -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; -CLUST_INDEX_SIZE -29 -SET GLOBAL innodb_limit_optimistic_insert_debug = 0; -# Test start -SET DEBUG_SYNC = 'RESET'; -INSERT INTO t1 (a00) VALUES ('bfa'); -connection con1; -SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; -INSERT INTO t1 (a00) VALUES ('bfb'); -connection con2; -SET DEBUG_SYNC = 'now WAIT_FOR reached'; -SELECT a00,a01 FROM t1 WHERE a00 = 'aa'; -a00 a01 -aa a -SELECT a00,a01 FROM t1 WHERE a00 = 'aq'; -a00 a01 -aq a -SELECT a00,a01 FROM t1 WHERE a00 = 'cp'; -a00 a01 -cp a -SELECT a00,a01 FROM t1 WHERE a00 = 'el'; -a00 a01 -el a -SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; -SELECT a00,a01 FROM t1 WHERE a00 = 'ar'; -connection con3; -SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; -SELECT a00,a01 FROM t1 WHERE a00 = 'cn'; -connection default; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1'; -SET DEBUG_SYNC = 'now SIGNAL continue'; -connection con1; -connection con2; -a00 a01 -ar a -connection con3; -a00 a01 -cn a -connection default; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze status OK -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; -CLUST_INDEX_SIZE -30 -SET DEBUG_SYNC = 'RESET'; -INSERT INTO t1 (a00) VALUES ('coa'); -connection con1; -SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; -INSERT INTO t1 (a00) VALUES ('cob'); -connection con2; -SET DEBUG_SYNC = 'now WAIT_FOR reached'; -SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; -SELECT a00,a01 FROM t1 WHERE a00 = 'aa'; -connection con3; -SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; -SELECT a00,a01 FROM t1 WHERE a00 = 'el'; -connection default; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1'; -SET DEBUG_SYNC = 'now SIGNAL continue'; -connection con1; -connection con2; -a00 a01 -aa a -connection con3; -a00 a01 -el a -connection default; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze status OK -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; -CLUST_INDEX_SIZE -31 -SET DEBUG_SYNC = 'RESET'; -INSERT INTO t1 (a00) VALUES ('gba'); -connection con1; -SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; -INSERT INTO t1 (a00) VALUES ('gbb'); -connection con2; -SET DEBUG_SYNC = 'now WAIT_FOR reached'; -SELECT a00,a01 FROM t1 WHERE a00 = 'aa'; -a00 a01 -aa a -SELECT a00,a01 FROM t1 WHERE a00 = 'ek'; -a00 a01 -ek a -SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; -SELECT a00,a01 FROM t1 WHERE a00 = 'el'; -connection con3; -SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; -SELECT a00,a01 FROM t1 WHERE a00 = 'gb'; -connection default; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1'; -SET DEBUG_SYNC = 'now SIGNAL continue'; -connection con1; -connection con2; -a00 a01 -el a -connection con3; -a00 a01 -gb a -connection default; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze status OK -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; -CLUST_INDEX_SIZE -32 -SET DEBUG_SYNC = 'RESET'; -connection default; -disconnect con1; -disconnect con2; -disconnect con3; -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/insert-before-delete.result b/mysql-test/suite/innodb/r/insert-before-delete.result new file mode 100644 index 0000000000000..f2d2d26029496 --- /dev/null +++ b/mysql-test/suite/innodb/r/insert-before-delete.result @@ -0,0 +1,35 @@ +connect pause_purge,localhost,root; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +CREATE TABLE t (pk int PRIMARY KEY, sk INT UNIQUE) ENGINE=InnoDB; +INSERT INTO t VALUES (10, 100); +connect con1,localhost,root; +BEGIN; +SELECT * FROM t WHERE sk = 100 FOR UPDATE; +pk sk +10 100 +connect con2,localhost,root; +SET DEBUG_SYNC="lock_wait_start SIGNAL insert_wait_started"; +INSERT INTO t VALUES (5, 100) # trx 1; +connect con3,localhost,root; +SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SET DEBUG_SYNC="now WAIT_FOR insert_wait_started"; +SET DEBUG_SYNC="lock_wait_start SIGNAL delete_started_waiting"; +DELETE FROM t WHERE sk = 100 # trx 2; +connection con1; +SET DEBUG_SYNC="now WAIT_FOR delete_started_waiting"; +DELETE FROM t WHERE sk=100; +COMMIT; +disconnect con1; +connection con2; +disconnect con2; +connection con3; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +disconnect con3; +connection default; +SELECT * FROM t; +pk sk +5 100 +disconnect pause_purge; +SET DEBUG_SYNC="RESET"; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff new file mode 100644 index 0000000000000..9d40decbb304a --- /dev/null +++ b/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff @@ -0,0 +1,9 @@ +@@ -377,8 +377,6 @@ + c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB; + SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT; + ALTER TABLE t1 FORCE; +-Warnings: +-Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + INSERT IGNORE INTO t1 VALUES + (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), + (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); diff --git a/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff new file mode 100644 index 0000000000000..9d40decbb304a --- /dev/null +++ b/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff @@ -0,0 +1,9 @@ +@@ -377,8 +377,6 @@ + c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB; + SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT; + ALTER TABLE t1 FORCE; +-Warnings: +-Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + INSERT IGNORE INTO t1 VALUES + (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), + (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); diff --git a/mysql-test/suite/innodb/r/insert_into_empty.result b/mysql-test/suite/innodb/r/insert_into_empty.result index 3f4d56e82451c..45f3dd7654c9f 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty.result +++ b/mysql-test/suite/innodb/r/insert_into_empty.result @@ -45,6 +45,10 @@ SET tx_read_only=1; BEGIN; INSERT INTO t2 VALUES(0); INSERT INTO t VALUES(0); +ROLLBACK; +BEGIN; +INSERT INTO t2 VALUES(0); +INSERT INTO t VALUES(0); COMMIT; INSERT INTO t VALUES(0); DROP TEMPORARY TABLE t,t2; @@ -183,6 +187,72 @@ INSERT INTO t VALUES (0); INSERT INTO t VALUES (1),(0),(1); DROP TABLE t; # +# MDEV-28327 InnoDB persistent statistics fail to update +# after bulk insert +# +CREATE TABLE t1 (a INT PRIMARY KEY)ENGINE=InnoDB +STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; +INSERT INTO t1 SELECT * FROM seq_1_to_4096; +# Wait till statistics update after bulk insert operation +SELECT n_rows>=4000 FROM mysql.innodb_table_stats WHERE TABLE_NAME="t1"; +n_rows>=4000 +1 +DROP TABLE t1; +# +# MDEV-27214 Import with disabled keys corrupts meta-data like rows, indexes, ... +# +CREATE TABLE `t1` ( +`id` int(11) NOT NULL, +`a` int(11) DEFAULT NULL, +PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; +INSERT INTO `t1` VALUES (1,2),(2,3),(3,4); +# Wait till statistics update after bulk insert operation +SELECT TABLE_ROWS, AVG_ROW_LENGTH>0 FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'; +TABLE_ROWS AVG_ROW_LENGTH>0 +3 1 +DROP TABLE t1; +# +# MDEV-29975 InnoDB fails to release savepoint during bulk insert +# +CREATE TABLE t (c INT KEY) ENGINE=InnoDB; +begin; +INSERT INTO t VALUES (0,0); +ERROR 21S01: Column count doesn't match value count at row 1 +SAVEPOINT a; +INSERT INTO t VALUES (0),(0); +ERROR HY000: Got error 1 "Operation not permitted" during COMMIT +SAVEPOINT a; +commit; +SELECT * FROM t; +c +DROP TABLE t; +# +# MDEV-29545 InnoDB: Can't find record during replace stmt +# +CREATE TABLE t1(c1 INT PRIMARY KEY)ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 VALUES(3331); +connect con1,localhost,root,,,; +BEGIN; +SELECT c1 FROM t1; +c1 +connection default; +COMMIT; +connection con1; +REPLACE INTO t1 VALUES(1984), (1984); +COMMIT; +connection default; +disconnect con1; +SELECT * FROM t1; +c1 +1984 +3331 +DROP TABLE t1; +# End of 10.6 tests +# # MDEV-26947 UNIQUE column checks fail in InnoDB resulting # in table corruption # @@ -240,3 +310,153 @@ SELECT length(f1) FROM t1; length(f1) 8459264 DROP TABLE t1; +# +# MDEV-27858 Assertion `page_dir_get_n_heap(new_page) == 2U' failed in PageBulk::init +# +CREATE TABLE t1 (c INT) ENGINE=InnoDB; +CREATE TABLE t2 (c INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1); +LOCK TABLES t1 WRITE,t2 WRITE; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); +DROP TABLE t2, t1; +# +# MDEV-28138 MariaDB Assertion Failed in mtr_buf_t::has_space +# +CREATE TABLE t1( +f1 SERIAL, +f2 LINESTRING NOT NULL DEFAULT LineFromText('LINESTRING(1 1,2 2,3 3)'), +SPATIAL INDEX(f2))ENGINE=InnoDB; +INSERT INTO t1(f1) VALUES(0), (1), (2); +ERROR 23000: Duplicate entry '1' for key 'f1' +DROP TABLE t1; +# +# MDEV-28237 Assertion `0' failed in row_upd_sec_index_entry on DELETE +# +CREATE TABLE t1 (c0 YEAR UNIQUE) ENGINE=InnoDB; +INSERT INTO t1 VALUES (0),(0),(0),(0),(0),(0),(0); +ERROR HY000: Got error 1 "Operation not permitted" during COMMIT +DELETE FROM t1; +DROP TABLE t1; +# +# MDEV-28037 Assertion `trx->bulk_insert' failed in innodb_prepare_commit_versioned +# +CREATE TABLE t1 (c INT) ENGINE=InnoDB; +CREATE TABLE t2 (c INT) ENGINE=InnoDB; +CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW UPDATE t2 SET c=1; +INSERT INTO t1 VALUES (0); +SELECT * FROM t1; +c +0 +SELECT * FROM t2; +c +DROP TABLE t2, t1; +# +# MDEV-28242 Assertion `!check_foreigns' failed in +# trx_t::check_bulk_buffer +# +CREATE TABLE t1 (c INT)ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 VALUES(1), (1); +SET SESSION foreign_key_checks=TRUE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t2(d INT)ENGINE=InnoDB; +DROP TABLE t2, t1; +# +# MDEV-28400 Leak in trx_mod_time_t::start_bulk_insert +# +SET SESSION foreign_key_checks=0; +CREATE TABLE t1 (a INT) ENGINE=InnoDB PARTITION BY HASH(a) PARTITIONS 2; +INSERT INTO t1 VALUES (1),(2); +ALTER TABLE t1 REBUILD PARTITION p0; +DROP TABLE t1; +# +# MDEV-29570 InnoDB fails to clean bulk buffer when server +# does rollback operation +# +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB +PARTITION BY RANGE (pk) ( +PARTITION pn VALUES LESS THAN (20)); +INSERT INTO t1 VALUES (1),(21); +ERROR HY000: Table has no partition for value 21 +DROP TABLE t1; +# +# MDEV-29761 Bulk insert fails to rollback +# during insert..select +# +CREATE TABLE t1 (f1 INT)ENGINE=InnoDB; +CREATE TABLE t2 (f1 INT, UNIQUE INDEX(f1)) ENGINE=InnoDB; +CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(1); +BEGIN; +INSERT t1 SELECT 1 FROM seq_1_to_2; +COMMIT; +SELECT * FROM t1; +f1 +SELECT * FROM t2; +f1 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECK TABLE t2; +Table Op Msg_type Msg_text +test.t2 check status OK +DROP TABLE t1, t2; +# +# MDEV-29801 Inconsistent ER_TOO_BIG_ROWSIZE during bulk +# insert operation +# +call mtr.add_suppression("InnoDB: Cannot add field `(c0[36]|c11)` in table"); +SET @format= @@innodb_default_row_format; +CREATE TABLE t1 (pk int primary key, c01 text, c02 text, c03 text, +c04 text, c05 text, c06 text, c07 text, c08 text, +c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB; +SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT; +ALTER TABLE t1 FORCE; +Warnings: +Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +INSERT IGNORE INTO t1 VALUES +(1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), +(2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= @format; +# +# MDEV-30321 blob data corrupted by row_merge_write_blob_to_tmp_file() +# +CREATE TABLE t1 ( +`id` int(11) NOT NULL, +`data` LONGBLOB NOT NULL, +PRIMARY KEY (`id`) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1, REPEAT('X', @@innodb_sort_buffer_size)), +(2, REPEAT('X', @@innodb_sort_buffer_size)); +SELECT COUNT(*) AS nb_corrupted_rows FROM t1 WHERE data != REPEAT('X', @@innodb_sort_buffer_size); +nb_corrupted_rows +0 +DROP TABLE t1; +# End of 10.7 tests +# +# MDEV-30426 Assertion !rec_offs_nth_extern(offsets2, n) +# during bulk insert +# +CREATE TABLE t1(f1 TEXT NOT NULL, f2 TEXT NOT NULL, +f3 TEXT NOT NULL, f4 TEXT NOT NULL, +f5 TEXT NOT NULL, f6 TEXT NOT NULL, +PRIMARY KEY(f6(10)))ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 VALUES +(repeat('a', 200), repeat('b', 200), repeat('c', 200), +repeat('d', 200), repeat('e', 200), repeat('f', 200)), +(repeat('b', 20000), repeat('c', 16000), repeat('d', 12000), +repeat('e', 12000), repeat('f', 12000), repeat('f', 12000)); +ERROR HY000: Got error 1 "Operation not permitted" during COMMIT +COMMIT; +DROP TABLE t1; +# End of 10.8 tests diff --git a/mysql-test/suite/innodb/r/insert_into_empty_debug.result b/mysql-test/suite/innodb/r/insert_into_empty_debug.result new file mode 100644 index 0000000000000..d98748022692c --- /dev/null +++ b/mysql-test/suite/innodb/r/insert_into_empty_debug.result @@ -0,0 +1,32 @@ +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, +PRIMARY KEY(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 2), (2, 2); +SET DEBUG_SYNC="innodb_rollback_inplace_alter_table SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 ADD UNIQUE KEY(f2); +connect con1,localhost,root,,,; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +DELETE FROM t1; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection default; +ERROR 23000: Duplicate entry '2' for key 'f2' +connection con1; +COMMIT; +TRUNCATE TABLE t1; +SET unique_checks=0, foreign_key_checks=0; +BEGIN; +INSERT INTO t1 VALUES(1, 2); +ROLLBACK; +connection default; +SELECT * FROM t1; +f1 f2 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + PRIMARY KEY (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +disconnect con1; +DROP TABLE t1; +SET DEBUG_SYNC=RESET; diff --git a/mysql-test/suite/innodb/r/insert_into_empty_notembedded.result b/mysql-test/suite/innodb/r/insert_into_empty_notembedded.result new file mode 100644 index 0000000000000..5305b2e7a857b --- /dev/null +++ b/mysql-test/suite/innodb/r/insert_into_empty_notembedded.result @@ -0,0 +1,30 @@ +# +# Start of 10.6 tests +# +# +# MDEV-27214 Import with disabled keys corrupts meta-data like rows, indexes, ... +# +CREATE DATABASE db1; +CREATE TABLE db1.t1 (id int, a int,PRIMARY KEY (id)) ENGINE=InnoDB +STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; +INSERT INTO db1.t1 VALUES (1,2),(2,3),(3,4); +DROP DATABASE IF EXISTS db1; +CREATE DATABASE db1; +# Wait till statistics update after bulk insert operation +SELECT TABLE_ROWS, AVG_ROW_LENGTH>0 FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='db1'; +TABLE_ROWS AVG_ROW_LENGTH>0 +3 1 +OPTIMIZE TABLE db1.t1; +Table Op Msg_type Msg_text +db1.t1 optimize note Table does not support optimize, doing recreate + analyze instead +db1.t1 optimize status OK +# Wait till statistics update after bulk insert operation +SELECT TABLE_ROWS, AVG_ROW_LENGTH>0 FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='db1'; +TABLE_ROWS AVG_ROW_LENGTH>0 +3 1 +DROP DATABASE db1; +# +# End of 10.6 tests +# diff --git a/mysql-test/suite/innodb/r/instant_alter,32k.rdiff b/mysql-test/suite/innodb/r/instant_alter,32k.rdiff index 37c3c479e688d..892b216bf3f53 100644 --- a/mysql-test/suite/innodb/r/instant_alter,32k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter,32k.rdiff @@ -1,20 +1,18 @@ ---- instant_alter.result -+++ instant_alter,32k.result -@@ -2,7 +2,7 @@ - # MDEV-11369: Instant ADD COLUMN for InnoDB - # +@@ -5,7 +5,7 @@ + SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT; + call mtr.add_suppression("Cannot add field `.*` in table `test`.`.*` because after adding it, the row size is"); CREATE TABLE t(a INT UNIQUE)ENGINE=InnoDB ROW_FORMAT=COMPACT; -ALTER TABLE t ADD e INT, ROW_FORMAT=COMPRESSED; +ALTER TABLE t ADD e INT, ROW_FORMAT=DYNAMIC; INSERT INTO t SET a=1; SET @old_instant= (SELECT variable_value FROM information_schema.global_status -@@ -33,17 +33,17 @@ +@@ -36,17 +36,17 @@ `c` int(11) NOT NULL, `d` int(11) NOT NULL, UNIQUE KEY `a` (`a`) --) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED -+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC SELECT variable_value-@old_instant instants FROM information_schema.global_status WHERE variable_name = 'innodb_instant_alter_column'; @@ -30,7 +28,7 @@ DROP TABLE t; connect analyze, localhost, root; connection default; -@@ -374,7 +374,7 @@ +@@ -404,7 +404,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -39,7 +37,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -397,7 +397,7 @@ +@@ -428,7 +428,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -48,7 +46,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -410,7 +410,7 @@ +@@ -442,7 +442,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -56,8 +54,8 @@ +1 connection default; InnoDB 0 transactions not purged - DROP TABLE t1,t2,t3,big; -@@ -734,7 +734,7 @@ + DROP TABLE t1,t2,t3,t4,big; +@@ -1326,7 +1326,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -66,7 +64,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -757,7 +757,7 @@ +@@ -1350,7 +1350,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -75,7 +73,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -770,7 +770,7 @@ +@@ -1364,7 +1364,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -83,8 +81,8 @@ +1 connection default; InnoDB 0 transactions not purged - DROP TABLE t1,t2,t3,big; -@@ -1094,7 +1094,7 @@ + DROP TABLE t1,t2,t3,t4,big; +@@ -2248,7 +2248,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -93,7 +91,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -1117,7 +1117,7 @@ +@@ -2272,7 +2272,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -102,7 +100,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -1130,7 +1130,7 @@ +@@ -2286,7 +2286,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -110,4 +108,4 @@ +1 connection default; InnoDB 0 transactions not purged - DROP TABLE t1,t2,t3,big; + DROP TABLE t1,t2,t3,t4,big; diff --git a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff index 14ef4971267c6..a885eb260d687 100644 --- a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff @@ -1,5 +1,3 @@ ---- instant_alter.result -+++ instant_alter,4k.result @@ -244,7 +244,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; @@ -47,7 +45,7 @@ SELECT * FROM t2; id c1 d1 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf -@@ -326,8 +332,14 @@ +@@ -330,8 +336,14 @@ affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 ALTER TABLE t3 ADD COLUMN b BLOB NOT NULL; @@ -63,7 +61,7 @@ INSERT INTO t3 SET id=4; ERROR HY000: Field 'c2' doesn't have a default value INSERT INTO t3 SET id=4, c2=0, b=0xf09f98b1; -@@ -340,7 +352,9 @@ +@@ -344,7 +356,9 @@ ALTER TABLE t3 CHANGE t phrase TEXT DEFAULT 0xc3a4c3a448, CHANGE b b BLOB NOT NULL DEFAULT 'binary line of business'; affected rows: 4 @@ -74,7 +72,7 @@ INSERT INTO t3 SET id=5, c2=9; Warnings: Note 1265 Data truncated for column 'c7' at row 1 -@@ -354,7 +368,9 @@ +@@ -358,7 +372,9 @@ 5 9 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 ääH binary line of business ALTER TABLE t3 DROP c3, DROP c7; affected rows: 0 @@ -85,7 +83,7 @@ SELECT * FROM t3; id c2 c4 c5 c6 c8 phrase b 1 1 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog -@@ -382,6 +398,8 @@ +@@ -386,6 +402,8 @@ (id INT PRIMARY KEY, c1 VARCHAR(4000), c2 VARCHAR(4000), c3 VARCHAR(1000), p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'), SPATIAL INDEX(p)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; @@ -94,7 +92,7 @@ BEGIN; INSERT INTO big SET id=1, c1=REPEAT('a', 200), c2=REPEAT('b', 200), c3=REPEAT('c', 159); -@@ -400,13 +418,15 @@ +@@ -404,13 +422,15 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -112,7 +110,7 @@ CHECKSUM TABLE big; Table Checksum test.big 1705165209 -@@ -424,7 +444,7 @@ +@@ -428,7 +448,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -121,7 +119,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -438,7 +458,7 @@ +@@ -442,7 +462,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -130,7 +128,7 @@ connection default; InnoDB 0 transactions not purged DROP TABLE t1,t2,t3,t4,big; -@@ -1162,7 +1182,7 @@ +@@ -1166,7 +1186,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -139,7 +137,7 @@ connection default; ROLLBACK; connection analyze; -@@ -1173,7 +1193,7 @@ +@@ -1177,7 +1197,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -148,7 +146,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -1185,7 +1205,7 @@ +@@ -1189,7 +1209,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -157,7 +155,7 @@ connection default; ROLLBACK; connection analyze; -@@ -1196,11 +1216,13 @@ +@@ -1200,11 +1220,13 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -173,7 +171,7 @@ SELECT * FROM t2; id c1 d1 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf -@@ -1245,7 +1267,9 @@ +@@ -1253,7 +1275,9 @@ info: Records: 0 Duplicates: 0 Warnings: 0 ALTER TABLE t3 ADD COLUMN b BLOB NOT NULL; affected rows: 0 @@ -184,7 +182,7 @@ INSERT INTO t3 SET id=4; ERROR HY000: Field 'c2' doesn't have a default value INSERT INTO t3 SET id=4, c2=0, b=0xf09f98b1; -@@ -1258,7 +1282,9 @@ +@@ -1266,7 +1290,9 @@ ALTER TABLE t3 CHANGE t phrase TEXT DEFAULT 0xc3a4c3a448, CHANGE b b BLOB NOT NULL DEFAULT 'binary line of business'; affected rows: 4 @@ -195,7 +193,7 @@ INSERT INTO t3 SET id=5, c2=9; Warnings: Note 1265 Data truncated for column 'c7' at row 1 -@@ -1272,7 +1298,9 @@ +@@ -1280,7 +1306,9 @@ 5 9 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 ääH binary line of business ALTER TABLE t3 DROP c3, DROP c7; affected rows: 0 @@ -206,7 +204,7 @@ SELECT * FROM t3; id c2 c4 c5 c6 c8 phrase b 1 1 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog -@@ -1300,6 +1328,8 @@ +@@ -1308,6 +1336,8 @@ (id INT PRIMARY KEY, c1 VARCHAR(4000), c2 VARCHAR(4000), c3 VARCHAR(1000), p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'), SPATIAL INDEX(p)) ENGINE=InnoDB ROW_FORMAT=COMPACT; @@ -215,7 +213,7 @@ BEGIN; INSERT INTO big SET id=1, c1=REPEAT('a', 200), c2=REPEAT('b', 200), c3=REPEAT('c', 159); -@@ -1318,13 +1348,15 @@ +@@ -1326,13 +1356,15 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -233,7 +231,7 @@ CHECKSUM TABLE big; Table Checksum test.big 1705165209 -@@ -1342,7 +1374,7 @@ +@@ -1350,7 +1382,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -242,7 +240,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -1356,7 +1388,7 @@ +@@ -1364,7 +1396,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -251,7 +249,7 @@ connection default; InnoDB 0 transactions not purged DROP TABLE t1,t2,t3,t4,big; -@@ -2080,7 +2112,7 @@ +@@ -2088,7 +2120,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -260,7 +258,7 @@ connection default; ROLLBACK; connection analyze; -@@ -2091,7 +2123,7 @@ +@@ -2099,7 +2131,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -269,7 +267,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -2103,7 +2135,7 @@ +@@ -2111,7 +2143,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -278,7 +276,7 @@ connection default; ROLLBACK; connection analyze; -@@ -2114,7 +2146,7 @@ +@@ -2122,7 +2154,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -287,7 +285,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -2236,7 +2268,7 @@ +@@ -2248,7 +2280,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -296,7 +294,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -2260,7 +2292,7 @@ +@@ -2272,7 +2304,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -305,7 +303,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -2274,7 +2306,7 @@ +@@ -2286,7 +2318,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -314,7 +312,7 @@ connection default; InnoDB 0 transactions not purged DROP TABLE t1,t2,t3,t4,big; -@@ -2816,7 +2848,7 @@ +@@ -2836,7 +2868,7 @@ FROM information_schema.global_status WHERE variable_name = 'innodb_instant_alter_column'; instants diff --git a/mysql-test/suite/innodb/r/instant_alter,64k.rdiff b/mysql-test/suite/innodb/r/instant_alter,64k.rdiff index d9a398fc8c8c3..919f23d1ace16 100644 --- a/mysql-test/suite/innodb/r/instant_alter,64k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter,64k.rdiff @@ -1,20 +1,18 @@ ---- instant_alter.result -+++ instant_alter,64k.result -@@ -2,7 +2,7 @@ - # MDEV-11369: Instant ADD COLUMN for InnoDB - # +@@ -5,7 +5,7 @@ + SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT; + call mtr.add_suppression("Cannot add field `.*` in table `test`.`.*` because after adding it, the row size is"); CREATE TABLE t(a INT UNIQUE)ENGINE=InnoDB ROW_FORMAT=COMPACT; -ALTER TABLE t ADD e INT, ROW_FORMAT=COMPRESSED; +ALTER TABLE t ADD e INT, ROW_FORMAT=DYNAMIC; INSERT INTO t SET a=1; SET @old_instant= (SELECT variable_value FROM information_schema.global_status -@@ -33,17 +33,17 @@ +@@ -36,17 +36,17 @@ `c` int(11) NOT NULL, `d` int(11) NOT NULL, UNIQUE KEY `a` (`a`) --) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED -+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC SELECT variable_value-@old_instant instants FROM information_schema.global_status WHERE variable_name = 'innodb_instant_alter_column'; @@ -30,7 +28,7 @@ DROP TABLE t; connect analyze, localhost, root; connection default; -@@ -374,7 +374,7 @@ +@@ -404,7 +404,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -39,7 +37,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -397,7 +397,7 @@ +@@ -428,7 +428,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -48,7 +46,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -410,7 +410,7 @@ +@@ -442,7 +442,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -56,8 +54,8 @@ +1 connection default; InnoDB 0 transactions not purged - DROP TABLE t1,t2,t3,big; -@@ -734,7 +734,7 @@ + DROP TABLE t1,t2,t3,t4,big; +@@ -1326,7 +1326,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -66,7 +64,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -757,7 +757,7 @@ +@@ -1350,7 +1350,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -75,7 +73,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -770,7 +770,7 @@ +@@ -1364,7 +1364,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -83,8 +81,8 @@ +1 connection default; InnoDB 0 transactions not purged - DROP TABLE t1,t2,t3,big; -@@ -1094,7 +1094,7 @@ + DROP TABLE t1,t2,t3,t4,big; +@@ -2248,7 +2248,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -93,7 +91,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -1117,7 +1117,7 @@ +@@ -2272,7 +2272,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -102,7 +100,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -1130,7 +1130,7 @@ +@@ -2286,7 +2286,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -110,4 +108,4 @@ +1 connection default; InnoDB 0 transactions not purged - DROP TABLE t1,t2,t3,big; + DROP TABLE t1,t2,t3,t4,big; diff --git a/mysql-test/suite/innodb/r/instant_alter,8k.rdiff b/mysql-test/suite/innodb/r/instant_alter,8k.rdiff index b96262866e562..3babe020c0945 100644 --- a/mysql-test/suite/innodb/r/instant_alter,8k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter,8k.rdiff @@ -1,6 +1,4 @@ ---- instant_alter.result -+++ instant_alter,8k.result -@@ -240,7 +240,7 @@ +@@ -244,7 +244,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -9,7 +7,7 @@ connection default; ROLLBACK; connection analyze; -@@ -250,7 +250,7 @@ +@@ -255,7 +255,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -18,7 +16,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -261,7 +261,7 @@ +@@ -267,7 +267,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -27,7 +25,7 @@ connection default; ROLLBACK; connection analyze; -@@ -271,7 +271,7 @@ +@@ -278,7 +278,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -36,7 +34,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -374,7 +374,7 @@ +@@ -404,7 +404,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -45,7 +43,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -397,7 +397,7 @@ +@@ -428,7 +428,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -54,7 +52,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -410,7 +410,7 @@ +@@ -442,7 +442,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -62,8 +60,8 @@ +5 connection default; InnoDB 0 transactions not purged - DROP TABLE t1,t2,t3,big; -@@ -600,7 +600,7 @@ + DROP TABLE t1,t2,t3,t4,big; +@@ -1166,7 +1166,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -72,7 +70,7 @@ connection default; ROLLBACK; connection analyze; -@@ -610,7 +610,7 @@ +@@ -1177,7 +1177,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -81,7 +79,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -621,7 +621,7 @@ +@@ -1189,7 +1189,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -90,7 +88,7 @@ connection default; ROLLBACK; connection analyze; -@@ -631,7 +631,7 @@ +@@ -1200,7 +1200,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -99,7 +97,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -734,7 +734,7 @@ +@@ -1326,7 +1326,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -108,7 +106,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -757,7 +757,7 @@ +@@ -1350,7 +1350,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -117,7 +115,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -770,7 +770,7 @@ +@@ -1364,7 +1364,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -125,8 +123,8 @@ +5 connection default; InnoDB 0 transactions not purged - DROP TABLE t1,t2,t3,big; -@@ -960,7 +960,7 @@ + DROP TABLE t1,t2,t3,t4,big; +@@ -2088,7 +2088,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -135,7 +133,7 @@ connection default; ROLLBACK; connection analyze; -@@ -970,7 +970,7 @@ +@@ -2099,7 +2099,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -144,7 +142,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -981,7 +981,7 @@ +@@ -2111,7 +2111,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -153,7 +151,7 @@ connection default; ROLLBACK; connection analyze; -@@ -991,7 +991,7 @@ +@@ -2122,7 +2122,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -162,7 +160,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -1094,7 +1094,7 @@ +@@ -2248,7 +2248,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -171,7 +169,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -1117,7 +1117,7 @@ +@@ -2272,7 +2272,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -180,7 +178,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -1130,7 +1130,7 @@ +@@ -2286,7 +2286,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -188,4 +186,4 @@ +5 connection default; InnoDB 0 transactions not purged - DROP TABLE t1,t2,t3,big; + DROP TABLE t1,t2,t3,t4,big; diff --git a/mysql-test/suite/innodb/r/instant_alter.result b/mysql-test/suite/innodb/r/instant_alter.result index 9d14aca0c9d3b..18680432c7711 100644 --- a/mysql-test/suite/innodb/r/instant_alter.result +++ b/mysql-test/suite/innodb/r/instant_alter.result @@ -36,7 +36,7 @@ t CREATE TABLE `t` ( `c` int(11) NOT NULL, `d` int(11) NOT NULL, UNIQUE KEY `a` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED SELECT variable_value-@old_instant instants FROM information_schema.global_status WHERE variable_name = 'innodb_instant_alter_column'; @@ -175,7 +175,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`id`), UNIQUE KEY `c2` (`c2`), SPATIAL KEY `c3` (`c3`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT ALTER TABLE t1 CHANGE c2 c2 INT DEFAULT 42, CHANGE d1 d1 INT DEFAULT 1, @@ -206,7 +206,7 @@ t1 CREATE TABLE `t1` ( `d8` varchar(20) DEFAULT 'omnopq', PRIMARY KEY (`id`), UNIQUE KEY `c2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT SELECT * FROM t1; id c2 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 f1 d8 1 1 NULL 10 yyyyy 1970-01-01 03:00:42 3 yyyyy 2 hijkl -12345 NULL xyyyyy omnopq @@ -1109,7 +1109,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`id`), UNIQUE KEY `c2` (`c2`), SPATIAL KEY `c3` (`c3`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT ALTER TABLE t1 CHANGE c2 c2 INT DEFAULT 42, CHANGE d1 d1 INT DEFAULT 1, @@ -1140,7 +1140,7 @@ t1 CREATE TABLE `t1` ( `d8` varchar(20) DEFAULT 'omnopq', PRIMARY KEY (`id`), UNIQUE KEY `c2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT SELECT * FROM t1; id c2 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 f1 d8 1 1 NULL 10 yyyyy 1970-01-01 03:00:42 3 yyyyy 2 hijkl -12345 NULL xyyyyy omnopq @@ -2043,7 +2043,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`id`), UNIQUE KEY `c2` (`c2`), SPATIAL KEY `c3` (`c3`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC ALTER TABLE t1 CHANGE c2 c2 INT DEFAULT 42, CHANGE d1 d1 INT DEFAULT 1, @@ -2074,7 +2074,7 @@ t1 CREATE TABLE `t1` ( `d8` varchar(20) DEFAULT 'omnopq', PRIMARY KEY (`id`), UNIQUE KEY `c2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC SELECT * FROM t1; id c2 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 f1 d8 1 1 NULL 10 yyyyy 1970-01-01 03:00:42 3 yyyyy 2 hijkl -12345 NULL xyyyyy omnopq @@ -2887,7 +2887,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `i1` (`a`) COMMENT 'comment2' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-25057 Assertion `n_fields < dtuple_get_n_fields(entry)' @@ -2927,5 +2927,16 @@ t1 CREATE TABLE `t1` ( `f4` int(11) NOT NULL, PRIMARY KEY (`f1`,`f4`), KEY `f2` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; +# +# MDEV-28822 Table from older version requires table rebuild when adding column to table with multi-column index +# +CREATE TABLE mdev28822_100427_innodb ( +id int not null primary key, +msg varchar(10), +index(id, msg) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +FLUSH TABLES; +ALTER TABLE mdev28822_100427_innodb ADD i1 INTEGER, ALGORITHM=INSTANT; +DROP TABLE mdev28822_100427_innodb; diff --git a/mysql-test/suite/innodb/r/instant_alter_bugs.result b/mysql-test/suite/innodb/r/instant_alter_bugs.result index 79f1b0eb0681e..f56938550acb5 100644 --- a/mysql-test/suite/innodb/r/instant_alter_bugs.result +++ b/mysql-test/suite/innodb/r/instant_alter_bugs.result @@ -147,7 +147,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f3` varchar(255) DEFAULT NULL, PRIMARY KEY (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -157,7 +157,7 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`f1`), KEY `idx1` (`f2`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t2 CHANGE status status VARCHAR(20) DEFAULT NULL; DROP TABLE t2, t1; # @@ -193,19 +193,48 @@ Warnings: Warning 1814 Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files ALTER TABLE t1 IMPORT TABLESPACE; -Warnings: -Warning 1814 Tablespace has been discarded for table `t1` SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` int(11) NOT NULL, `c3` int(11) DEFAULT 10 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c1 c2 c3 1 0 10 DROP TABLE t1; +# +# MDEV-23801 Assertion index->table->instant... failed +# in btr_pcur_store_position() +# +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; +CREATE TABLE t ( +pk int auto_increment, +c01 char(255) not null default repeat('a',255), +c02 char(255) default repeat('a',255), +c03 char(255) default repeat('a',255), +c04 char(255) default repeat('a',255), +c05 char(255) not null default repeat('a',255), +c06 char(255) default repeat('a',255), +c07 char(255) default repeat('a',255), +c08 char(255) not null default repeat('a',255), +c09 char(255) default repeat('a',255), +c10 char(255) default repeat('a',255), +c11 char(255) default repeat('a',255), +c12 char(255) not null default repeat('a',255), +primary key (pk) +) ENGINE=InnoDB CHARACTER SET ucs2; +INSERT INTO t () VALUES (); +ALTER TABLE t ADD c INT; +BEGIN; +INSERT INTO t () VALUES (),(); +ROLLBACK; +DELETE FROM t; +InnoDB 0 transactions not purged +SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency; +CREATE TABLE tt ENGINE=InnoDB AS SELECT c FROM t; +DROP TABLE t, tt; # End of 10.3 tests create table t ( a varchar(9), @@ -370,7 +399,7 @@ ALTER TABLE t1 ADD COLUMN b INT NOT NULL, MODIFY a CHAR, ALGORITHM=INSTANT; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(1) COLLATE latin1_general_cs DEFAULT NULL, + `a` char(1) DEFAULT NULL, `b` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs DROP TABLE t1; @@ -380,7 +409,7 @@ ALTER TABLE t1 MODIFY a CHAR, ALGORITHM=INSTANT; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(1) COLLATE latin1_general_cs DEFAULT NULL + `a` char(1) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs ROW_FORMAT=REDUNDANT DROP TABLE t1; CREATE TABLE t1 (a CHAR NOT NULL) CHARSET latin2 COLLATE latin2_bin @@ -391,7 +420,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin2 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin2 COLLATE=latin2_general_ci ROW_FORMAT=REDUNDANT DROP TABLE t1; # # MDEV-21645 SIGSEGV in innobase_get_computed_value @@ -451,4 +480,20 @@ ALTER TABLE t ADD d INT; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 DROP TABLE t; +# +# MDEV-28060 Online DDL fails while checking for instant +# alter condition +# +CREATE TABLE t1(f1 CHAR(10) NOT NULL)ROW_FORMAT=REDUNDANT,ENGINE=InnoDB; +ALTER TABLE t1 ADD COLUMN(f2 INT NOT NULL, f3 INT NOT NULL, +f4 INT NOT NULL, f5 INT NOT NULL), +CHANGE COLUMN f1 f1 CHAR(10) DEFAULT NULL; +DROP TABLE t1; SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; +# +# MDEV-26420 Buffer overflow on instant ADD/DROP of generated column +# +CREATE TABLE t1 (i int AS (0) STORED, j INT) ENGINE=InnoDB; +ALTER TABLE t1 ADD COLUMN i INT GENERATED ALWAYS AS (1), DROP COLUMN i; +DROP TABLE t1; +# End of 10.4 tests diff --git a/mysql-test/suite/innodb/r/instant_alter_charset,redundant.rdiff b/mysql-test/suite/innodb/r/instant_alter_charset,redundant.rdiff index 22b7e46ea9c97..90846ac4644e4 100644 --- a/mysql-test/suite/innodb/r/instant_alter_charset,redundant.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter_charset,redundant.rdiff @@ -1,5 +1,3 @@ ---- instant_alter_charset.result 2019-06-17 14:36:02.311515062 +0300 -+++ instant_alter_charset,redundant.result 2019-06-17 14:50:11.888705725 +0300 @@ -279,7 +279,6 @@ alter table boundary_255 modify a varchar(70) charset utf8mb4, @@ -49,3 +47,12 @@ select * from t; a b c aa bb cc d dd aaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaa aaaaaaaaaa +@@ -2066,7 +2054,7 @@ + ALTER TABLE t1 + CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci, + ADD UNIQUE INDEX test_key (a); +-ERROR 23000: Duplicate entry 'NULL' for key 'test_key' ++ERROR 23000: Duplicate entry 'a1' for key 'test_key' + ALTER TABLE t1 CONVERT TO CHARACTER SET UTF8MB4 COLLATE UTF8MB4_UNICODE_520_CI; + CHECK TABLE t1; + Table Op Msg_type Msg_text diff --git a/mysql-test/suite/innodb/r/instant_alter_charset.result b/mysql-test/suite/innodb/r/instant_alter_charset.result index 7703b9c6b2a2f..91b166587e282 100644 --- a/mysql-test/suite/innodb/r/instant_alter_charset.result +++ b/mysql-test/suite/innodb/r/instant_alter_charset.result @@ -2027,7 +2027,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL, PRIMARY KEY (`a`(1)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE t1 MODIFY a VARCHAR(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; INSERT INTO t1 VALUES ('a'); @@ -2051,7 +2051,7 @@ INSERT INTO t1 VALUES (1, 'a1'), (2, 'a1'); ALTER TABLE t1 CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci, ADD UNIQUE INDEX test_key (a); -ERROR 23000: Duplicate entry 'a1' for key 'test_key' +ERROR 23000: Duplicate entry 'NULL' for key 'test_key' ALTER TABLE t1 CONVERT TO CHARACTER SET UTF8MB4 COLLATE UTF8MB4_UNICODE_520_CI; CHECK TABLE t1; Table Op Msg_type Msg_text @@ -2066,7 +2066,7 @@ INSERT INTO t1 VALUES (1, 'a1'), (2, 'a1'); ALTER TABLE t1 CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci, ADD UNIQUE INDEX test_key (a); -ERROR 23000: Duplicate entry 'a1' for key 'test_key' +ERROR 23000: Duplicate entry 'NULL' for key 'test_key' ALTER TABLE t1 CONVERT TO CHARACTER SET UTF8MB4 COLLATE UTF8MB4_UNICODE_520_CI; CHECK TABLE t1; Table Op Msg_type Msg_text diff --git a/mysql-test/suite/innodb/r/instant_alter_crash.result b/mysql-test/suite/innodb/r/instant_alter_crash.result index 556e8d415f4e5..7855aa24264d7 100644 --- a/mysql-test/suite/innodb/r/instant_alter_crash.result +++ b/mysql-test/suite/innodb/r/instant_alter_crash.result @@ -34,13 +34,15 @@ ROLLBACK; InnoDB 0 transactions not purged INSERT INTO t2 VALUES (16,1551,'Omnium enim rerum'),(128,1571,' principia parva sunt'); +BEGIN; +UPDATE t1 SET c2=c2+1; connect ddl, localhost, root; SET DEBUG_SYNC='innodb_alter_inplace_before_commit SIGNAL ddl WAIT_FOR ever'; ALTER TABLE t2 DROP COLUMN c3, ADD COLUMN c5 TEXT DEFAULT 'naturam abhorrere'; connection default; SET DEBUG_SYNC='now WAIT_FOR ddl'; SET GLOBAL innodb_flush_log_at_trx_commit=1; -UPDATE t1 SET c2=c2+1; +COMMIT; # Kill the server disconnect ddl; # restart @@ -61,6 +63,8 @@ DELETE FROM t2; ROLLBACK; InnoDB 0 transactions not purged INSERT INTO t2 VALUES (64,42,'De finibus bonorum'), (347,33101,' et malorum'); +BEGIN; +DELETE FROM t1; connect ddl, localhost, root; ALTER TABLE t2 DROP COLUMN c3; SET DEBUG_SYNC='innodb_alter_inplace_before_commit SIGNAL ddl WAIT_FOR ever'; @@ -68,7 +72,7 @@ ALTER TABLE t2 ADD COLUMN (c4 TEXT NOT NULL DEFAULT ' et malorum'); connection default; SET DEBUG_SYNC='now WAIT_FOR ddl'; SET GLOBAL innodb_flush_log_at_trx_commit=1; -DELETE FROM t1; +COMMIT; # Kill the server disconnect ddl; # restart @@ -138,6 +142,8 @@ InnoDB 0 transactions not purged # # MDEV-24323 Crash on recovery after kill during instant ADD COLUMN # +BEGIN; +INSERT INTO t1 VALUES(0,0); connect ddl, localhost, root; CREATE TABLE t3(id INT PRIMARY KEY, c2 INT, v2 INT AS(c2) VIRTUAL, UNIQUE(v2)) ENGINE=InnoDB; @@ -147,7 +153,7 @@ ALTER TABLE t3 ADD COLUMN c3 TEXT NOT NULL DEFAULT 'sic transit gloria mundi'; connection default; SET DEBUG_SYNC='now WAIT_FOR ddl'; SET GLOBAL innodb_flush_log_at_trx_commit=1; -INSERT INTO t1 VALUES(0,0); +COMMIT; # Kill the server disconnect ddl; # restart @@ -158,7 +164,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `c2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -166,7 +172,7 @@ t2 CREATE TABLE `t2` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `c2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( @@ -175,6 +181,52 @@ t3 CREATE TABLE `t3` ( `v2` int(11) GENERATED ALWAYS AS (`c2`) VIRTUAL, PRIMARY KEY (`id`), UNIQUE KEY `v2` (`v2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -DROP TABLE t1,t2,t3; +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2,t3; +# +# MDEV-29440 InnoDB instant ALTER TABLE recovery wrongly uses +# READ COMMITTED isolation level instead of READ UNCOMMITTED +# +CREATE TABLE t2(a INT UNSIGNED PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6); +BEGIN; +DELETE FROM t1; +connect ddl, localhost, root; +SET DEBUG_SYNC='innodb_alter_inplace_before_commit SIGNAL ddl WAIT_FOR ever'; +ALTER TABLE t2 ADD COLUMN b TINYINT UNSIGNED NOT NULL DEFAULT 42 FIRST; +connection default; +SET DEBUG_SYNC='now WAIT_FOR ddl'; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +COMMIT; +# Kill the server +disconnect ddl; +# restart +CHECK TABLE t2; +Table Op Msg_type Msg_text +test.t2 check status OK +DROP TABLE t1,t2; db.opt +# +# MDEV-26198 Assertion `0' failed in row_log_table_apply_op during +# ADD PRIMARY KEY or OPTIMIZE TABLE +# +CREATE TABLE t1(f1 year default null, f2 year default null, +f3 text, f4 year default null, f5 year default null, +f6 year default null, f7 year default null, +f8 year default null)ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES(1, 1, 1, 1, 1, 1, 1, 1); +ALTER TABLE t1 ADD COLUMN f9 year default null, ALGORITHM=INPLACE; +set DEBUG_SYNC="row_log_table_apply1_before SIGNAL con1_insert WAIT_FOR con1_finish"; +ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ADD COLUMN f10 YEAR DEFAULT NULL, ALGORITHM=INPLACE; +connect con1,localhost,root,,,; +SET DEBUG_SYNC="now WAIT_FOR con1_insert"; +INSERT IGNORE INTO t1 (f3) VALUES ( 'b' ); +INSERT IGNORE INTO t1 (f3) VALUES ( 'l' ); +SET DEBUG_SYNC="now SIGNAL con1_finish"; +connection default; +disconnect con1; +SET DEBUG_SYNC=RESET; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/instant_alter_debug,dynamic.rdiff b/mysql-test/suite/innodb/r/instant_alter_debug,dynamic.rdiff deleted file mode 100644 index 379514edad9dc..0000000000000 --- a/mysql-test/suite/innodb/r/instant_alter_debug,dynamic.rdiff +++ /dev/null @@ -1,6 +0,0 @@ -@@ -470,4 +470,4 @@ - FROM information_schema.global_status - WHERE variable_name = 'innodb_instant_alter_column'; - instants --33 -+32 diff --git a/mysql-test/suite/innodb/r/instant_alter_debug,redundant.rdiff b/mysql-test/suite/innodb/r/instant_alter_debug,redundant.rdiff index eafa8e5725d03..cff4ff18c70b1 100644 --- a/mysql-test/suite/innodb/r/instant_alter_debug,redundant.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter_debug,redundant.rdiff @@ -1,4 +1,4 @@ -@@ -509,4 +509,4 @@ +@@ -527,4 +527,4 @@ FROM information_schema.global_status WHERE variable_name = 'innodb_instant_alter_column'; instants diff --git a/mysql-test/suite/innodb/r/instant_alter_debug.result b/mysql-test/suite/innodb/r/instant_alter_debug.result index d6229415d34af..5f74c23426046 100644 --- a/mysql-test/suite/innodb/r/instant_alter_debug.result +++ b/mysql-test/suite/innodb/r/instant_alter_debug.result @@ -262,7 +262,6 @@ INSERT INTO t1 SET a=3; ROLLBACK; SET DEBUG_SYNC = 'now SIGNAL logged'; connection ddl; -ERROR 22004: Invalid use of NULL value disconnect ddl; connection default; SET DEBUG_SYNC = RESET; @@ -462,12 +461,27 @@ INSERT INTO t1 SET a=0, i=REPEAT('1', 10000); ROLLBACK; set DEBUG_SYNC='now SIGNAL go'; connection default; -disconnect con1; SELECT * FROM t1; a b c d e f g h i 1 2 3 4 5 6 7 8 test DROP TABLE t1; SET DEBUG_SYNC=RESET; +# +# MDEV-27962 Instant DDL downgrades the MDL when table is empty +# +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL)ENGINE=InnoDB; +SET DEBUG_SYNC="alter_table_inplace_after_lock_downgrade SIGNAL try_insert WAIT_FOR alter_progress"; +ALTER TABLE t1 ADD INDEX(f1), ADD INDEX(f2); +connection con1; +SET SESSION lock_wait_timeout=1; +SET DEBUG_SYNC="now WAIT_FOR try_insert"; +INSERT INTO t1 VALUES(1, 2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET DEBUG_SYNC="now SIGNAL alter_progress"; +disconnect con1; +connection default; +DROP TABLE t1; +SET DEBUG_SYNC=reset; # End of 10.4 tests # # MDEV-22867 Assertion instant.n_core_fields == n_core_fields diff --git a/mysql-test/suite/innodb/r/instant_alter_import.result b/mysql-test/suite/innodb/r/instant_alter_import.result index ed3c87b4e4139..3e7ee35fdc187 100644 --- a/mysql-test/suite/innodb/r/instant_alter_import.result +++ b/mysql-test/suite/innodb/r/instant_alter_import.result @@ -121,3 +121,39 @@ FLUSH TABLE t1 FOR EXPORT; UNLOCK TABLES; ALTER TABLE t2 IMPORT TABLESPACE; DROP TABLE t2, t1; +CREATE TABLE t1 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb; +CREATE TABLE t2 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb; +ALTER TABLE test.t1 add COLUMN i3 INT AFTER i1; +ALTER TABLE t2 DISCARD TABLESPACE; +FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE t2 IMPORT TABLESPACE; +ERROR HY000: Index for table 't2' is corrupt; try to repair it +DROP TABLE t1, t2; +# +# MDEV-28919 Assertion `(((core_null) + 7) >> 3) == +# oindex.n_core_null_bytes || !not_redundant()' failed +# +call mtr.add_suppression(" InnoDB: Tablespace for table `test`.`t` is set as discarded"); +CREATE TABLE t (a INTEGER, b INTEGER as (a) VIRTUAL, +c INTEGER)engine=innodb; +ALTER TABLE t DISCARD TABLESPACE; +FLUSH TABLES; +ALTER TABLE t DROP COLUMN b, algorithm=instant; +Warnings: +Warning 1814 Tablespace has been discarded for table `t` +ALTER TABLE t DROP COLUMN c, algorithm=instant; +Warnings: +Warning 1814 Tablespace has been discarded for table `t` +CREATE TABLE t1(a INTEGER)ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +FLUSH TABLE t1 FOR EXPORT; +unlock tables; +ALTER TABLE t IMPORT tablespace; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select * from t; +a +1 +DROP TABLE t, t1; diff --git a/mysql-test/suite/innodb/r/instant_alter_index_rename.result b/mysql-test/suite/innodb/r/instant_alter_index_rename.result index c14043e0ad2d2..49f2213fbaf3f 100644 --- a/mysql-test/suite/innodb/r/instant_alter_index_rename.result +++ b/mysql-test/suite/innodb/r/instant_alter_index_rename.result @@ -153,7 +153,7 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL, UNIQUE KEY `a_key` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=1 drop table t; create table rename_column_and_index ( a int, @@ -170,7 +170,7 @@ Table Create Table rename_column_and_index CREATE TABLE `rename_column_and_index` ( `aa` int(11) DEFAULT NULL, UNIQUE KEY `aa_key` (`aa`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci check table rename_column_and_index; Table Op Msg_type Msg_text test.rename_column_and_index check status OK diff --git a/mysql-test/suite/innodb/r/instant_alter_inject.result b/mysql-test/suite/innodb/r/instant_alter_inject.result index fe175f5bed0d8..2b030ad0d7344 100644 --- a/mysql-test/suite/innodb/r/instant_alter_inject.result +++ b/mysql-test/suite/innodb/r/instant_alter_inject.result @@ -40,7 +40,7 @@ t1 CREATE TABLE `t1` ( `c` char(3) DEFAULT 'lie', PRIMARY KEY (`a`), KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT PARTITION BY KEY () PARTITIONS 3 DROP TABLE t1; @@ -62,5 +62,5 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, KEY `a` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; diff --git a/mysql-test/suite/innodb/r/instant_alter_upgrade.result b/mysql-test/suite/innodb/r/instant_alter_upgrade.result new file mode 100644 index 0000000000000..fc7d28963cacd --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_upgrade.result @@ -0,0 +1,9 @@ +# +# MDEV-26577 InnoDB: Failing assertion: dict_tf2_is_valid(flags, flags2) +# during ADD COLUMN +# +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +CREATE TABLE t2(a INT PRIMARY KEY) ENGINE=InnoDB; +FLUSH TABLES; +ALTER TABLE t2 ADD COLUMN b INT; +DROP TABLE t1,t2; diff --git a/mysql-test/suite/innodb/r/instant_drop.result b/mysql-test/suite/innodb/r/instant_drop.result index 2b82eb3c80567..b9df9b0c29adf 100644 --- a/mysql-test/suite/innodb/r/instant_drop.result +++ b/mysql-test/suite/innodb/r/instant_drop.result @@ -56,7 +56,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f3` int(11) NOT NULL, `f5` blob DEFAULT repeat('aaa',950) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select f3 from t1; f3 2 @@ -98,7 +98,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f2` int(11) NOT NULL, KEY `idx` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1(f1 int, f2 int not null)engine=innodb; insert into t1 values(1, 2); @@ -149,7 +149,7 @@ t2 CREATE TABLE `t2` ( `f1` int(11) DEFAULT NULL, `f4` varchar(100) DEFAULT repeat('a',20), `f5` int(11) DEFAULT 10 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t2 add column f6 char(100) default repeat('a', 99), algorithm=instant; create table t3(f1 int, f2 int not null)engine=innodb; insert into t3 values(1, 2); @@ -184,7 +184,7 @@ t2 CREATE TABLE `t2` ( `f4` varchar(100) DEFAULT repeat('a',20), `f5` int(11) DEFAULT 10, `f6` char(100) DEFAULT repeat('a',99) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t3; f1 f3 f4 1 1 4 diff --git a/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result b/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result index 37ddb0a9348c7..ca010d663fa42 100644 --- a/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result +++ b/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result @@ -17,4 +17,8 @@ pk c 1 sql SELECT * FROM t1 WHERE pk = 12; ERROR HY000: Index for table 't1' is corrupt; try to repair it +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check Warning InnoDB: The B-tree of index PRIMARY is corrupted. +test.t1 check error Corrupt DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/lock_delete_updated.result b/mysql-test/suite/innodb/r/lock_delete_updated.result new file mode 100644 index 0000000000000..3ce63be36ab59 --- /dev/null +++ b/mysql-test/suite/innodb/r/lock_delete_updated.result @@ -0,0 +1,22 @@ +CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t VALUES (3); +BEGIN; +UPDATE t SET a = 2; +connect con1,localhost,root; +SET DEBUG_SYNC="lock_wait_start SIGNAL del_locked"; +DELETE FROM t; +connection default; +SET DEBUG_SYNC="now WAIT_FOR del_locked"; +UPDATE t SET a = 1; +COMMIT; +connection con1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +disconnect con1; +connection default; +# The above DELETE must delete all the rows in the table, so the +# following SELECT must show 0 rows. +SELECT count(*) FROM t; +count(*) +1 +SET DEBUG_SYNC="reset"; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/lock_move_wait_lock_race.result b/mysql-test/suite/innodb/r/lock_move_wait_lock_race.result new file mode 100644 index 0000000000000..572fbc9b1d191 --- /dev/null +++ b/mysql-test/suite/innodb/r/lock_move_wait_lock_race.result @@ -0,0 +1,34 @@ +CREATE TABLE t (pk int PRIMARY KEY, c varchar(10)) ENGINE=InnoDB; +INSERT INTO t VALUES (10, "0123456789"); +connection default; +BEGIN; +SELECT * FROM t WHERE c = 10 FOR UPDATE; +pk c +connect trx2, localhost,root,,; +BEGIN; +SET DEBUG_SYNC="lock_wait_start SIGNAL trx2_start_waiting"; +SET DEBUG_SYNC="lock_wait_end SIGNAL trx2_wait_end WAIT_FOR trx2_cont_upd"; +SET DEBUG_SYNC="lock_rec_store_on_page_infimum_end SIGNAL trx2_moved_locks WAIT_FOR trx2_cont"; +UPDATE t SET c = NULL WHERE pk = 10; +connect trx3, localhost,root,,; +SET DEBUG_SYNC="now WAIT_FOR trx2_start_waiting"; +SET innodb_lock_wait_timeout=1; +BEGIN; +SET DEBUG_SYNC="lock_wait_start SIGNAL trx3_start_waiting WAIT_FOR trx3_cont_waiting"; +SET DEBUG_SYNC="lock_sys_t_cancel_enter SIGNAL trx3_cancel_enter WAIT_FOR trx3_cont_cancel_waiting"; +UPDATE t SET c = "abcdefghij" WHERE pk = 10; +connection default; +SET DEBUG_SYNC="now WAIT_FOR trx3_start_waiting"; +COMMIT; +SET DEBUG_SYNC="now WAIT_FOR trx2_wait_end"; +SET DEBUG_SYNC="now SIGNAL trx3_cont_waiting"; +SET DEBUG_SYNC="now WAIT_FOR trx3_cancel_enter"; +SET DEBUG_SYNC="now SIGNAL trx2_cont_upd"; +SET DEBUG_SYNC="now WAIT_FOR trx2_moved_locks"; +SET DEBUG_SYNC="now SIGNAL trx3_cont_cancel_waiting"; +SET DEBUG_SYNC="now SIGNAL trx2_cont"; +disconnect trx2; +disconnect trx3; +connection default; +SET DEBUG_SYNC="RESET"; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/lock_update_split_rc.result b/mysql-test/suite/innodb/r/lock_update_split_rc.result new file mode 100644 index 0000000000000..6bdce124c5b08 --- /dev/null +++ b/mysql-test/suite/innodb/r/lock_update_split_rc.result @@ -0,0 +1,34 @@ +CREATE TABLE t ( +`a` INT NOT NULL, +`b` INT NOT NULL, +PRIMARY KEY (`a`) +) ENGINE=InnoDB; +SET GLOBAL innodb_limit_optimistic_insert_debug = 3; +INSERT INTO t VALUES(10, 0); +INSERT INTO t VALUES(20, 0); +INSERT INTO t VALUES(30, 0); +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +XA START '1'; +REPLACE INTO t VALUES(10, 1); +REPLACE INTO t VALUES(20, 1); +SET DEBUG_SYNC= 'ib_after_row_insert SIGNAL inserted WAIT_FOR cont'; +REPLACE INTO t VALUES(30, 1); +connect con1,localhost,root; +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +XA START '2'; +SET DEBUG_SYNC= 'now WAIT_FOR inserted'; +INSERT INTO t VALUES(40, 2); +SET DEBUG_SYNC= 'now SIGNAL cont'; +connection default; +XA END '1'; +XA PREPARE '1'; +connection default; +XA COMMIT '1'; +connection con1; +XA END '2'; +XA PREPARE '2'; +XA COMMIT '2'; +disconnect con1; +connection default; +SET DEBUG_SYNC= "RESET"; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/lock_wait_conflict.result b/mysql-test/suite/innodb/r/lock_wait_conflict.result deleted file mode 100644 index 25d18c03ea14d..0000000000000 --- a/mysql-test/suite/innodb/r/lock_wait_conflict.result +++ /dev/null @@ -1,27 +0,0 @@ -# -# MDEV-27025 insert-intention lock conflicts with waiting ORDINARY lock -# -CREATE TABLE t (a INT PRIMARY KEY, b INT NOT NULL UNIQUE) ENGINE=InnoDB; -connect prevent_purge,localhost,root,,; -start transaction with consistent snapshot; -connection default; -INSERT INTO t VALUES (20,20); -DELETE FROM t WHERE b = 20; -connect con_ins,localhost,root,,; -SET DEBUG_SYNC = 'row_ins_sec_index_entry_dup_locks_created SIGNAL ins_set_locks WAIT_FOR ins_cont'; -INSERT INTO t VALUES(10, 20); -connect con_del,localhost,root,,; -SET DEBUG_SYNC = 'now WAIT_FOR ins_set_locks'; -SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL del_locked'; -DELETE FROM t WHERE b = 20; -connection default; -SET DEBUG_SYNC = 'now WAIT_FOR del_locked'; -SET DEBUG_SYNC = 'now SIGNAL ins_cont'; -connection con_ins; -disconnect con_ins; -connection con_del; -disconnect con_del; -disconnect prevent_purge; -connection default; -SET DEBUG_SYNC = 'RESET'; -DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/log_corruption.result b/mysql-test/suite/innodb/r/log_corruption.result index 12e9d340bbd53..df58a90dcec23 100644 --- a/mysql-test/suite/innodb/r/log_corruption.result +++ b/mysql-test/suite/innodb/r/log_corruption.result @@ -20,7 +20,7 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED'); ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS FOUND 1 /InnoDB: Upgrade after a crash is not supported. This redo log was created before MariaDB 10\.2\.2, and we did not find a valid checkpoint/ in mysqld.1.err # empty redo log from before MariaDB 10.2.2 -# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=2m +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); @@ -28,7 +28,7 @@ COUNT(*) 1 FOUND 1 /InnoDB: Upgrading redo log:/ in mysqld.1.err # Corrupted multi-file redo log from before MariaDB 10.2.2 -# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=2m +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); @@ -36,7 +36,7 @@ COUNT(*) 0 FOUND 1 /InnoDB: Upgrade after a crash is not supported. This redo log was created before MariaDB 10\.2\.2, and it appears corrupted/ in mysqld.1.err # Empty multi-file redo log (wrong offset) from before MariaDB 10.2.2 -# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=2m +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); @@ -45,7 +45,7 @@ COUNT(*) FOUND 3 /Upgrade after a crash is not supported. This redo log was created before MariaDB 10\.2\.2, and we did not find a valid checkpoint\./ in mysqld.1.err # Multi-file redo log with size mismatch from after MariaDB 10.2.2 # Corrupted multi-file redo log from after MariaDB 10.2.2 -# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=2m +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); @@ -53,15 +53,16 @@ COUNT(*) 0 FOUND 3 /Upgrade after a crash is not supported. This redo log was created before MariaDB 10\.2\.2, and we did not find a valid checkpoint\./ in mysqld.1.err FOUND 1 /InnoDB: No valid checkpoint was found; the log was created with BogoDB 1\.2\.3\.4\./ in mysqld.1.err -# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=2m +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); COUNT(*) 0 +FOUND 1 /InnoDB: Log file .*ib_logfile1 is of different size 2097152 bytes than other log files 1048576 bytes!/ in mysqld.1.err FOUND 2 /InnoDB: No valid checkpoint was found; the log was created with BogoDB 1\.2\.3\.4\./ in mysqld.1.err # Empty multi-file redo log from after MariaDB 10.2.2 -# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=2m +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); @@ -74,6 +75,7 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /InnoDB: Log file .*ib_logfile1 is of different size 2097152 bytes than other log files 4194304 bytes!/ in mysqld.1.err FOUND 1 /InnoDB: Invalid log header checksum/ in mysqld.1.err # distant future redo log format, with valid header checksum # restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption @@ -165,7 +167,7 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED'); ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS FOUND 3 /\[ERROR\] InnoDB: Upgrade after a crash is not supported\. The redo log was created with MariaDB 10\.3\.1\./ in mysqld.1.err # Empty 10.3 redo log -# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=2m +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); @@ -173,7 +175,7 @@ COUNT(*) 1 FOUND 1 /InnoDB: log sequence number 1213964\b.*; transaction id 0/ in mysqld.1.err # Empty 10.2 redo log -# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=2m +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); @@ -181,7 +183,7 @@ COUNT(*) 1 FOUND 3 /InnoDB: Upgrading redo log:/ in mysqld.1.err # Empty 10.5 redo log -# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=2m +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); diff --git a/mysql-test/suite/innodb/r/log_file_name_debug.result b/mysql-test/suite/innodb/r/log_file_name_debug.result deleted file mode 100644 index 0058a30518535..0000000000000 --- a/mysql-test/suite/innodb/r/log_file_name_debug.result +++ /dev/null @@ -1,18 +0,0 @@ -# -# Bug#19685095 DO NOT CARE ABOUT UNRESOLVED MLOG_FILE_NAME -# IF THERE ARE NO OPERATIONS TO APPLY -# -SET GLOBAL DEBUG_DBUG='+d,fil_names_write_bogus'; -CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; -# Kill the server -# restart: --debug=d,innodb_log_abort_1 --innodb-log-file-size=4194304 -SELECT * FROM t1; -ERROR 42000: Unknown storage engine 'InnoDB' -FOUND 1 /InnoDB: Tablespace 4294967280 was not found at .*, but there were no modifications either/ in mysqld.1.err -# restart: --debug=d,innodb_log_abort_5,ib_log --innodb-log-file-size=4194304 -SELECT * FROM t1; -ERROR 42000: Unknown storage engine 'InnoDB' -FOUND 1 /ib_log: FILE_CHECKPOINT.* written/ in mysqld.1.err -# restart -# restart -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/log_file_size.result b/mysql-test/suite/innodb/r/log_file_size.result index 47ca20af2f464..7b4935e1ab12d 100644 --- a/mysql-test/suite/innodb/r/log_file_size.result +++ b/mysql-test/suite/innodb/r/log_file_size.result @@ -1,5 +1,5 @@ CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; -# restart: --innodb-log-file-size=2m +# restart: --innodb-log-file-size=4m CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK diff --git a/mysql-test/suite/innodb/r/log_upgrade.result b/mysql-test/suite/innodb/r/log_upgrade.result new file mode 100644 index 0000000000000..4da83460f9364 --- /dev/null +++ b/mysql-test/suite/innodb/r/log_upgrade.result @@ -0,0 +1,16 @@ +call mtr.add_suppression("InnoDB: The change buffer is corrupted"); +# +# MDEV-24412 InnoDB: Upgrade after a crash is not supported +# +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-force-recovery=5 --innodb-log-file-size=4m +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +COUNT(*) +1 +FOUND 1 /InnoDB: Upgrading redo log:/ in mysqld.1.err +ib_buffer_pool +ib_logfile0 +ibdata1 +# restart +# End of 10.5 tests diff --git a/mysql-test/suite/innodb/r/mdev-14846.result b/mysql-test/suite/innodb/r/mdev-14846.result index 219bd718febe9..a1ccfb6bb4d0e 100644 --- a/mysql-test/suite/innodb/r/mdev-14846.result +++ b/mysql-test/suite/innodb/r/mdev-14846.result @@ -31,11 +31,12 @@ pk f1 f2 f3 3 t q 1 5 z t NULL SET DEBUG_SYNC='now SIGNAL default_dml'; +SET DEBUG_SYNC='now SIGNAL con2_dml'; connection default; SET DEBUG_SYNC='now WAIT_FOR default_dml'; UPDATE t3 AS alias1 LEFT JOIN t3 AS alias2 ON ( alias1.f1 <> alias1.f2 ) SET alias1.f3 = 59 WHERE ( EXISTS ( SELECT t1.f3 FROM t1 WHERE t1.f1 = alias1.f1 ) ) OR alias2.f1 = 'h'; connect con2,localhost,root,,test; -set debug_sync='now WAIT_FOR default_dml'; +set debug_sync='now WAIT_FOR con2_dml'; SET DEBUG_SYNC='now SIGNAL con1_dml2'; disconnect con2; connection con1; diff --git a/mysql-test/suite/innodb/r/monitor.result b/mysql-test/suite/innodb/r/monitor.result index 0424ea51238df..221c92faaea34 100644 --- a/mysql-test/suite/innodb/r/monitor.result +++ b/mysql-test/suite/innodb/r/monitor.result @@ -35,8 +35,6 @@ buffer_pool_bytes_dirty disabled buffer_pool_pages_free disabled buffer_pages_created disabled buffer_pages_written disabled -buffer_index_pages_written disabled -buffer_non_index_pages_written disabled buffer_pages_read disabled buffer_index_sec_rec_cluster_reads disabled buffer_index_sec_rec_cluster_reads_avoided disabled @@ -146,7 +144,6 @@ log_lsn_current disabled log_lsn_checkpoint_age disabled log_lsn_buf_pool_oldest disabled log_max_modified_age_async disabled -log_num_log_io disabled log_waits disabled log_write_requests disabled log_writes disabled @@ -645,7 +642,7 @@ SET @end = (SELECT COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME = 'lock_rec_lock_created'); SELECT @end - @start; @end - @start -0 +1 # Records must not be S/X-locked if a table is X-locked. SET @start = @end; SET autocommit = 0; diff --git a/mysql-test/suite/innodb/r/no_pad.result b/mysql-test/suite/innodb/r/no_pad.result new file mode 100644 index 0000000000000..0c039c30a5e7a --- /dev/null +++ b/mysql-test/suite/innodb/r/no_pad.result @@ -0,0 +1,7 @@ +CREATE TABLE t1 (a CHAR(8), id INT, PRIMARY KEY (a,id)) COLLATE utf8_nopad_bin +ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES ('',1); +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('',2); +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/online_table_rebuild.result b/mysql-test/suite/innodb/r/online_table_rebuild.result new file mode 100644 index 0000000000000..46d9780decb7f --- /dev/null +++ b/mysql-test/suite/innodb/r/online_table_rebuild.result @@ -0,0 +1,67 @@ +CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(200), f3 CHAR(200))ENGINE=InnoDB; +INSERT INTO t1 VALUES(3, "innodb", "alter log"); +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 ADD PRIMARY KEY(f3(10)), ADD UNIQUE KEY(f2(10)); +CONNECT con1,localhost,root,,,; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +INSERT INTO t1 VALUES(1, repeat('b', 100), repeat('c', 100)); +INSERT INTO t1 VALUES(2, repeat('b', 100), repeat('a', 100)); +COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection default; +ERROR 23000: Duplicate entry 'bbbbbbbbbb' for key 'f2' +connection default; +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 ADD PRIMARY KEY(f1); +connection con1; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +INSERT INTO t1 SELECT 10, repeat('a', 100), repeat('b', 100) FROM seq_1_to_4800; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection default; +ERROR HY000: Creating index 'PRIMARY' required more than 'innodb_online_alter_log_max_size' bytes of modification log. Please try again +DELETE FROM t1; +INSERT INTO t1 VALUES(1, repeat('a', 100), repeat('b', 100)); +ALTER TABLE t1 ADD PRIMARY KEY(f1); +set DEBUG_SYNC="innodb_inplace_alter_table_enter SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(f3(10)); +connection con1; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +INSERT INTO t1 VALUES(2, repeat('b', 100), repeat('c', 100)); +UPDATE t1 set f3=repeat('c', 100) where f1=1; +COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection default; +ERROR 23000: Duplicate entry 'cccccccccc' for key 'PRIMARY' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` char(200) DEFAULT NULL, + `f3` char(200) DEFAULT NULL, + PRIMARY KEY (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# +# MDEV-30183 Assertion `!memcmp(rec_trx_id, old_pk_trx_id->data, +# 6 + 7)' failed in row_log_table_apply_update +# +set @old_sql_mode = @@sql_mode; +set @@sql_mode=""; +CREATE TABLE t1(col_int int, col_varchar varchar(500))ENGINE=InnoDB; +INSERT INTO t1(col_int) values(2560); +set debug_sync="row_log_table_apply1_before SIGNAL con1_begin WAIT_FOR con1_commit"; +ALTER TABLE t1 ADD PRIMARY KEY ( col_varchar); +connection con1; +SET DEBUG_SYNC="now WAIT_FOR con1_begin"; +UPDATE t1 SET col_int = 2178; +INSERT INTO t1(col_int) VALUES(3016); +UPDATE t1 set col_int=2802; +SET DEBUG_SYNC="now SIGNAL con1_commit"; +connection default; +ERROR 23000: Duplicate entry '' for key 'PRIMARY' +DROP TABLE t1; +SET @@sql_mode = @old_sql_mode; +disconnect con1; +SET DEBUG_SYNC=reset; diff --git a/mysql-test/suite/innodb/r/page_id_innochecksum.result b/mysql-test/suite/innodb/r/page_id_innochecksum.result index e2c13442fe6c8..7a5f44b21e6c5 100644 --- a/mysql-test/suite/innodb/r/page_id_innochecksum.result +++ b/mysql-test/suite/innodb/r/page_id_innochecksum.result @@ -3,4 +3,7 @@ create table t1(f1 int not null)engine=innodb; insert into t1 values(1), (2), (3); # Change the page offset FOUND 1 /page id mismatch/ in result.log +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; +InnoDB 0 transactions not purged drop table t1; +call mtr.add_suppression("InnoDB: Failed to read page 3 from file '.*test/t1\\.ibd': Page read from tablespace is corrupted\\."); diff --git a/mysql-test/suite/innodb/r/page_reorganize.result b/mysql-test/suite/innodb/r/page_reorganize.result index 1059fc78531a2..20e1600bd0de1 100644 --- a/mysql-test/suite/innodb/r/page_reorganize.result +++ b/mysql-test/suite/innodb/r/page_reorganize.result @@ -25,3 +25,10 @@ f1 disconnect con1; connection default; drop table t1; +# +# MDEV-27993 Assertion failed in btr_page_reorganize_low() +# +CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB; +SET DEBUG_DBUG = '+d,do_page_reorganize'; +INSERT INTO t1 VALUES(0,0); +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/purge.result b/mysql-test/suite/innodb/r/purge.result index fe10ca1f4d5ad..a71d0afdcbe30 100644 --- a/mysql-test/suite/innodb/r/purge.result +++ b/mysql-test/suite/innodb/r/purge.result @@ -115,7 +115,7 @@ t12963823 CREATE TABLE `t12963823` ( KEY `ndx_n` (`n`(500)), KEY `ndx_o` (`o`(500)), KEY `ndx_p` (`p`(500)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC InnoDB 0 transactions not purged DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge, t12637786, t12963823; SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; diff --git a/mysql-test/suite/innodb/r/purge_secondary.result b/mysql-test/suite/innodb/r/purge_secondary.result index a583e46418def..6c0612c7cfe9c 100644 --- a/mysql-test/suite/innodb/r/purge_secondary.result +++ b/mysql-test/suite/innodb/r/purge_secondary.result @@ -154,4 +154,19 @@ WHERE LOWER(variable_name) LIKE 'INNODB_BUFFER_POOL_PAGES_FLUSHED'; # FLUSH TABLES t1 FOR EXPORT; # UNLOCK TABLES; DROP TABLE t1; +# +# MDEV-29666 InnoDB fails to purge secondary index records +# when indexed virtual columns exist +# +CREATE TABLE t1 (a INT, b INT, a1 INT AS(a) VIRTUAL, +INDEX(a1),INDEX(b)) ENGINE=InnoDB; +INSERT INTO t1 SET a=1, b=1; +UPDATE t1 SET a=2, b=3; +InnoDB 0 transactions not purged +FLUSH TABLE t1 FOR EXPORT; +page 4: N_RECS=0x0001 +page 5: N_RECS=0x0001 +UNLOCK TABLES; +DROP TABLE t1; +# End of 10.3 tests SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/innodb/r/recovery_memory.result b/mysql-test/suite/innodb/r/recovery_memory.result new file mode 100644 index 0000000000000..9aba9bccdb3c3 --- /dev/null +++ b/mysql-test/suite/innodb/r/recovery_memory.result @@ -0,0 +1,32 @@ +call mtr.add_suppression("InnoDB: The change buffer is corrupted"); +call mtr.add_suppression("InnoDB: Plugin initialization aborted at srv0start.cc"); +call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); +call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed."); +CREATE TABLE t1(c TEXT, KEY(c(3072)))ENGINE=InnoDB; +CREATE PROCEDURE dorepeat() +LOOP +INSERT INTO t1 VALUES ('abc'); +UPDATE t1 SET c='cba'; +END LOOP +| +connect con1,localhost,root,,,; +CALL dorepeat(); +connection default; +# restart: --innodb_buffer_pool_size=5242880 +DROP TABLE t1; +DROP PROCEDURE dorepeat; +# +# MDEV-30552 InnoDB recovery crashes when error +# handling scenario +# +SET DEBUG_DBUG="+d,ib_log_checkpoint_avoid_hard"; +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +INSERT INTO t1 SELECT * FROM seq_1_to_65536; +# restart: with restart_parameters +# restart +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/recovery_shutdown.result b/mysql-test/suite/innodb/r/recovery_shutdown.result index dc785d580fec4..6f7ca6e0d1df6 100644 --- a/mysql-test/suite/innodb/r/recovery_shutdown.result +++ b/mysql-test/suite/innodb/r/recovery_shutdown.result @@ -4,13 +4,10 @@ call mtr.add_suppression("Found 1 prepared XA transactions"); # MDEV-13797 InnoDB may hang if shutdown is initiated soon after startup # while rolling back recovered incomplete transactions # -CREATE TABLE t (a INT) ENGINE=InnoDB; -BEGIN; -COMMIT; connect con$c,localhost,root,,; CREATE TABLE t8 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; XA START 'x'; -INSERT INTO t8 (a) SELECT NULL FROM t; +INSERT INTO t8 (a) SELECT NULL FROM seq_1_to_100; UPDATE t8 SET a=a+100, b=a; DELETE FROM t8; XA END 'x'; @@ -18,58 +15,54 @@ XA PREPARE 'x'; connect con$c,localhost,root,,; CREATE TABLE t7 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; BEGIN; -INSERT INTO t7 (a) SELECT NULL FROM t; +INSERT INTO t7 (a) SELECT NULL FROM seq_1_to_100; UPDATE t7 SET a=a+100, b=a; DELETE FROM t7; connect con$c,localhost,root,,; CREATE TABLE t6 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; BEGIN; -INSERT INTO t6 (a) SELECT NULL FROM t; +INSERT INTO t6 (a) SELECT NULL FROM seq_1_to_100; UPDATE t6 SET a=a+100, b=a; DELETE FROM t6; connect con$c,localhost,root,,; CREATE TABLE t5 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; BEGIN; -INSERT INTO t5 (a) SELECT NULL FROM t; +INSERT INTO t5 (a) SELECT NULL FROM seq_1_to_100; UPDATE t5 SET a=a+100, b=a; DELETE FROM t5; connect con$c,localhost,root,,; CREATE TABLE t4 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; BEGIN; -INSERT INTO t4 (a) SELECT NULL FROM t; +INSERT INTO t4 (a) SELECT NULL FROM seq_1_to_100; UPDATE t4 SET a=a+100, b=a; DELETE FROM t4; connect con$c,localhost,root,,; CREATE TABLE t3 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; BEGIN; -INSERT INTO t3 (a) SELECT NULL FROM t; +INSERT INTO t3 (a) SELECT NULL FROM seq_1_to_100; UPDATE t3 SET a=a+100, b=a; DELETE FROM t3; connect con$c,localhost,root,,; CREATE TABLE t2 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; BEGIN; -INSERT INTO t2 (a) SELECT NULL FROM t; +INSERT INTO t2 (a) SELECT NULL FROM seq_1_to_100; UPDATE t2 SET a=a+100, b=a; DELETE FROM t2; connect con$c,localhost,root,,; CREATE TABLE t1 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; BEGIN; -INSERT INTO t1 (a) SELECT NULL FROM t; +INSERT INTO t1 (a) SELECT NULL FROM seq_1_to_100; UPDATE t1 SET a=a+100, b=a; DELETE FROM t1; -INSERT INTO t1(a) SELECT NULL FROM t; -INSERT INTO t1(a) SELECT NULL FROM t1; -INSERT INTO t1(a) SELECT NULL FROM t1; -INSERT INTO t1(a) SELECT NULL FROM t1; -INSERT INTO t1(a) SELECT NULL FROM t1; +INSERT INTO t1(a) SELECT NULL FROM seq_1_to_1600; connection default; SET GLOBAL innodb_flush_log_at_trx_commit=1; -CREATE TABLE u(a SERIAL) ENGINE=INNODB; +CREATE TABLE MDEV_29559 (a TINYINT UNSIGNED PRIMARY KEY, KEY(a)) ENGINE=InnoDB; +INSERT INTO MDEV_29559 VALUES (0x69); FLUSH TABLES; # restart -# restart XA RECOVER; formatID gtrid_length bqual_length data 1 1 0 x # restart -DROP TABLE t,u; +DROP TABLE MDEV_29559; diff --git a/mysql-test/suite/innodb/r/restart,16k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,16k,innodb.rdiff new file mode 100644 index 0000000000000..b36ed067913ce --- /dev/null +++ b/mysql-test/suite/innodb/r/restart,16k,innodb.rdiff @@ -0,0 +1,16 @@ +--- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100 ++++ suite/innodb/r/restart.reject 2022-01-19 08:12:28.602794678 +1100 +@@ -32,10 +32,10 @@ + SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; + SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); +-ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '5242879' + SHOW WARNINGS; + Level Code Message +-Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE +-Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++Warning 1210 innodb_buffer_pool_size must be at least 5242880 for innodb_page_size=16384 ++Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '5242879' + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); + SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart,32k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,32k,innodb.rdiff new file mode 100644 index 0000000000000..8fa057814c48c --- /dev/null +++ b/mysql-test/suite/innodb/r/restart,32k,innodb.rdiff @@ -0,0 +1,16 @@ +--- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100 ++++ suite/innodb/r/restart.reject 2022-01-19 08:07:57.402230887 +1100 +@@ -32,10 +32,10 @@ + SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; + SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); +-ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '10485759' + SHOW WARNINGS; + Level Code Message +-Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE +-Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++Warning 1210 innodb_buffer_pool_size must be at least 10485760 for innodb_page_size=32768 ++Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '10485759' + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); + SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart,4k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,4k,innodb.rdiff new file mode 100644 index 0000000000000..7d0846360e039 --- /dev/null +++ b/mysql-test/suite/innodb/r/restart,4k,innodb.rdiff @@ -0,0 +1,16 @@ +--- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100 ++++ suite/innodb/r/restart.reject 2022-01-19 08:13:56.397475513 +1100 +@@ -32,10 +32,10 @@ + SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; + SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); +-ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '2097151' + SHOW WARNINGS; + Level Code Message +-Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE +-Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++Warning 1210 innodb_buffer_pool_size must be at least 2097152 for innodb_page_size=4096 ++Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '2097151' + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); + SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart,64k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,64k,innodb.rdiff new file mode 100644 index 0000000000000..3ac9f45b19606 --- /dev/null +++ b/mysql-test/suite/innodb/r/restart,64k,innodb.rdiff @@ -0,0 +1,16 @@ +--- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100 ++++ suite/innodb/r/restart.reject 2022-01-19 08:11:32.418759095 +1100 +@@ -32,10 +32,10 @@ + SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; + SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); +-ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '20971519' + SHOW WARNINGS; + Level Code Message +-Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE +-Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++Warning 1210 innodb_buffer_pool_size must be at least 20971520 for innodb_page_size=65536 ++Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '20971519' + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); + SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart,8k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,8k,innodb.rdiff new file mode 100644 index 0000000000000..4da55ebfcef9d --- /dev/null +++ b/mysql-test/suite/innodb/r/restart,8k,innodb.rdiff @@ -0,0 +1,16 @@ +--- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100 ++++ suite/innodb/r/restart.reject 2022-01-19 08:13:11.027788852 +1100 +@@ -32,10 +32,10 @@ + SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; + SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); +-ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '3145727' + SHOW WARNINGS; + Level Code Message +-Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE +-Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++Warning 1210 innodb_buffer_pool_size must be at least 3145728 for innodb_page_size=8192 ++Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '3145727' + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); + SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart.result b/mysql-test/suite/innodb/r/restart.result index ea9734d5a01fb..95d79a0ab143d 100644 --- a/mysql-test/suite/innodb/r/restart.result +++ b/mysql-test/suite/innodb/r/restart.result @@ -3,6 +3,8 @@ # # FIXME: Unlike MySQL, maybe MariaDB should not read the .ibd files # of tables with .isl file or DATA DIRECTORY attribute. +call mtr.add_suppression("\\[ERROR\\] InnoDB: MySQL-8\\.0 tablespace in "); +call mtr.add_suppression("\\[ERROR\\] InnoDB: Restart in MySQL for migration/recovery\\."); # FIXME: This is much more noisy than MariaDB 10.1! call mtr.add_suppression("\\[ERROR\\] InnoDB: Tablespace flags are invalid in datafile: .*test.t[rcd]\\.ibd"); call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number .* in a file operation\\."); @@ -27,3 +29,24 @@ a SELECT * FROM td; a DROP TABLE tr,tc,td; +# +# MDEV-27467 innodb to enfore the minimum innodb_buffer_pool_size in SET (resize) the same as startup +# +SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; +SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; +EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); +ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' +SHOW WARNINGS; +Level Code Message +Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE +Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' +EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); +SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; +# +# MDEV-27882 Innodb - recognise MySQL-8.0 innodb flags and give a specific error message +# +FOUND 1 /InnoDB: MySQL-8\.0 tablespace in \./ibdata1/ in attempted_start.err +# restart +# +# End of 10.3 tests +# diff --git a/mysql-test/suite/innodb/r/row_format_redundant.result b/mysql-test/suite/innodb/r/row_format_redundant.result index 8a629d06dd829..b798832e96f0d 100644 --- a/mysql-test/suite/innodb/r/row_format_redundant.result +++ b/mysql-test/suite/innodb/r/row_format_redundant.result @@ -1,3 +1,4 @@ +SET GLOBAL innodb_fast_shutdown=0; # restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb-undo-tablespaces=0 --innodb-stats-persistent=0 SET GLOBAL innodb_file_per_table=1; # @@ -8,25 +9,17 @@ SET GLOBAL innodb_file_per_table=ON; create table t1 (a int not null, d varchar(15) not null, b varchar(198) not null, c char(156)) engine=InnoDB row_format=redundant; -insert into t1 values(123, 'abcdef', 'jghikl', 'mnop'); -insert into t1 values(456, 'abcdef', 'jghikl', 'mnop'); -insert into t1 values(789, 'abcdef', 'jghikl', 'mnop'); -insert into t1 values(134, 'kasdfsdsadf', 'adfjlasdkfjasd', 'adfsadflkasdasdfljasdf'); -insert into t1 select * from t1; -insert into t1 select * from t1; -insert into t1 select * from t1; -insert into t1 select * from t1; -insert into t1 select * from t1; -insert into t1 select * from t1; -insert into t1 select * from t1; -insert into t1 select * from t1; -insert into t1 select * from t1; -insert into t1 select * from t1; +create temporary table t like t1; +insert into t values(123, 'abcdef', 'jghikl', 'mnop'); +insert into t values(456, 'abcdef', 'jghikl', 'mnop'); +insert into t values(789, 'abcdef', 'jghikl', 'mnop'); +insert into t values(134, 'kasdfsdsadf', 'adfjlasdkfjasd', 'adfsadflkasdasdfljasdf'); +insert into t1 select a,d,b,c from t, seq_1_to_1024; SET GLOBAL innodb_file_per_table=OFF; create table t2 (a int not null, d varchar(15) not null, b varchar(198) not null, c char(156), fulltext ftsic(c)) engine=InnoDB row_format=redundant; -insert into t2 select * from t1; +insert into t2 select a,d,b,c from t, seq_1_to_1024; create table t3 (a int not null, d varchar(15) not null, b varchar(198), c varchar(150), index k1(c(99), b(56)), index k2(b(5), c(10))) engine=InnoDB row_format=redundant; diff --git a/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result b/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result index fba209dd2b505..d00ac93831086 100644 --- a/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result +++ b/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result @@ -15,31 +15,71 @@ col_1 TEXT ,col_11 TEXT ) ENGINE=INNODB ROW_FORMAT=COMPACT; Warnings: -Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. TRUNCATE TABLE t1; Warnings: -Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize note Table does not support optimize, doing recreate + analyze instead test.t1 optimize status OK Warnings: -Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ALTER TABLE t1 FORCE; Warnings: -Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. SET innodb_strict_mode = ON; TRUNCATE TABLE t1; Warnings: -Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize note Table does not support optimize, doing recreate + analyze instead test.t1 optimize status OK Warnings: -Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ALTER TABLE t1 FORCE; Warnings: -Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. DROP TABLE t1; SET @@global.log_warnings = 2; +# +# MDEV-20194 Warnings inconsistently issued upon CHECK on +# table from older versions +# +set global innodb_compression_level=1; +CREATE TABLE t1( +f1 INT, f2 CHAR(200), f3 CHAR(200), +f4 CHAR(200), f5 CHAR(200), f6 CHAR(200), +f7 CHAR(200), f8 CHAR(200), f9 CHAR(200), +f10 CHAR(200), PRIMARY KEY(f1, f2(20), f3(20), f4(20)) +) ROW_FORMAT=COMPRESSED, ENGINE=InnoDB; +INSERT INTO t1 SELECT seq, repeat('a', 200), repeat('b', 200), +repeat('c', 200), repeat('d', 200), +repeat('d', 200), repeat('e', 200), +repeat('e', 200), repeat('f', 200), +repeat('g', 200) FROM seq_1_to_20; +DROP TABLE t1; +set global innodb_compression_level=default; +CREATE TABLE t1(f1 char(200), f2 char(200), f3 char(200), +f4 char(200), f5 char(200), f6 char(200), +f7 char(200), f8 char(200), f9 char(200), +f10 char(200), f11 char(200), f12 char(200), +f13 char(200), f14 char(200), f15 char(200), +f16 char(200), f17 char(200), f18 char(200), +f19 char(200), f20 char(200), f21 char(200), +f22 char(200), f23 char(200), f24 char(200), +f25 char(200), f26 char(200), f27 char(200), +f28 char(200), f29 char(200), f30 char(200), +f31 char(200), f32 char(200), f33 char(200), +primary key(f1(10), f2(10), f3(10), f4(10), +f5(10), f6(10), f7(10), f8(10), +f9(10), f10(10), f11(10), f12(10), +f13(10), f14(10), f15(10), f16(10), +f17(10), f18(10), f19(10), f20(10), +f21(10), f22(10), f23(10), f24(10), +f25(10), f26(10), f27(10), f28(10), +f29(10), f30(10), f31(10), f32(10), +f33(10))) +ENGINE=InnoDB; +ERROR 42000: Too many key parts specified; max 32 parts allowed diff --git a/mysql-test/suite/innodb/r/skip_symbolic_links.result b/mysql-test/suite/innodb/r/skip_symbolic_links.result new file mode 100644 index 0000000000000..42d42ef0a90bd --- /dev/null +++ b/mysql-test/suite/innodb/r/skip_symbolic_links.result @@ -0,0 +1,56 @@ +SELECT @@have_symlink; +@@have_symlink +DISABLED +CREATE TABLE t1(a INT) ENGINE=InnoDB DATA DIRECTORY 'MYSQL_TMP_DIR'; +Warnings: +Warning 1618 option ignored +DROP TABLE t1; +CREATE TABLE t1(a INT) ENGINE=InnoDB; +ALTER TABLE t1 DATA DIRECTORY 'MYSQL_TMP_DIR'; +Warnings: +Warning 1618 option ignored +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# restart: --symbolic-links +CREATE TABLE t1(a INT PRIMARY KEY, b INT) ENGINE=InnoDB +DATA DIRECTORY 'MYSQL_TMP_DIR'; +CREATE TABLE t2(a INT PRIMARY KEY, b INT) ENGINE=InnoDB +DATA DIRECTORY 'MYSQL_TMP_DIR'; +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +# restart +ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; +Warnings: +Warning 1618 option ignored +ALTER TABLE t2 FORCE, ALGORITHM=COPY; +Warnings: +Warning 1618 option ignored +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +Warnings: +Warning 1618 option ignored +t1.ibd +DROP TABLE t2; +RENAME TABLE t1 TO t2; +ALTER TABLE t2 ADD UNIQUE INDEX(b), RENAME TO t3; +Warnings: +Warning 1618 option ignored +ALTER TABLE t3 RENAME TO t2; +ALTER TABLE t2 DROP INDEX b, RENAME TO t1; +Warnings: +Warning 1618 option ignored +ALTER TABLE t1 CHANGE b c INT; +Warnings: +Warning 1618 option ignored +ALTER TABLE t1 CHANGE c b INT NOT NULL; +Warnings: +Warning 1618 option ignored +t1.ibd +TRUNCATE TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/sql_mode_pad_char_to_full_length.result b/mysql-test/suite/innodb/r/sql_mode_pad_char_to_full_length.result new file mode 100644 index 0000000000000..09c1cf5749706 --- /dev/null +++ b/mysql-test/suite/innodb/r/sql_mode_pad_char_to_full_length.result @@ -0,0 +1,51 @@ +SET default_storage_engine=InnoDB; +# +# Start of 10.4 tests +# +# +# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic +# +# +# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic +# +CREATE TABLE t1 (a INT,b CHAR(20)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(20) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE UNIQUE INDEX bi USING HASH ON t1 (b); +INSERT INTO t1 VALUES (0,0); +SET sql_mode='pad_char_to_full_length'; +DELETE FROM t1; +DROP TABLE t1; +SET sql_mode=''; +CREATE TABLE t1 (a INT,b CHAR(20)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(20) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE UNIQUE INDEX bi USING HASH ON t1 (b); +SET sql_mode='pad_char_to_full_length'; +INSERT INTO t1 VALUES (0,0); +DELETE FROM t1; +DROP TABLE t1; +SET sql_mode=''; +CREATE OR REPLACE TABLE t1 (a CHAR(20),b CHAR(20)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(20) DEFAULT NULL, + `b` char(20) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE UNIQUE INDEX bi USING HASH ON t1 (b); +INSERT INTO t1 VALUES (0,0); +SET sql_mode='pad_char_to_full_length'; +DELETE FROM t1; +DROP TABLE t1; +# +# End of 10.4 tests +# diff --git a/mysql-test/suite/innodb/r/stat_tables.result b/mysql-test/suite/innodb/r/stat_tables.result index bb4495704792f..c1ce6fc8fcea5 100644 --- a/mysql-test/suite/innodb/r/stat_tables.result +++ b/mysql-test/suite/innodb/r/stat_tables.result @@ -13,3 +13,17 @@ a drop table t1; rename table mysql.table_stats_save to mysql.table_stats; flush tables; +# +# MDEV-26753 Assertion state == TRX_STATE_PREPARED ||... failed +# +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; +XA START 'test'; +SELECT COUNT(*)>0 FROM mysql.innodb_index_stats LOCK IN SHARE MODE; +COUNT(*)>0 +1 +INSERT INTO t1 VALUES (1),(2); +UPDATE mysql.innodb_table_stats SET last_update=NULL WHERE table_name='t1'; +XA END 'test'; +XA ROLLBACK 'test'; +DROP TABLE t1; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb/r/stats_persistent.result b/mysql-test/suite/innodb/r/stats_persistent.result index 3ae10e31cb3f6..7e9c038d6f7e5 100644 --- a/mysql-test/suite/innodb/r/stats_persistent.result +++ b/mysql-test/suite/innodb/r/stats_persistent.result @@ -6,9 +6,9 @@ SET DEBUG_SYNC='dict_stats_update_persistent SIGNAL stop WAIT_FOR go'; ANALYZE TABLE t1; connect con1, localhost, root; SET DEBUG_SYNC='now WAIT_FOR stop'; -SELECT ENGINE,SUM(DATA_LENGTH+INDEX_LENGTH),COUNT(ENGINE),SUM(DATA_LENGTH),SUM(INDEX_LENGTH) FROM information_schema.TABLES WHERE ENGINE='InnoDB'; -ENGINE SUM(DATA_LENGTH+INDEX_LENGTH) COUNT(ENGINE) SUM(DATA_LENGTH) SUM(INDEX_LENGTH) -InnoDB 114688 4 65536 49152 +SELECT SUM(DATA_LENGTH+INDEX_LENGTH) FROM information_schema.TABLES WHERE ENGINE='InnoDB'; +SUM(DATA_LENGTH+INDEX_LENGTH) +SUM SET DEBUG_SYNC='now SIGNAL go'; disconnect con1; connection default; diff --git a/mysql-test/suite/innodb/r/stored_fk.result b/mysql-test/suite/innodb/r/stored_fk.result index 35524d5a88fae..fc48f346656e9 100644 --- a/mysql-test/suite/innodb/r/stored_fk.result +++ b/mysql-test/suite/innodb/r/stored_fk.result @@ -16,7 +16,7 @@ t2 CREATE TABLE `t2` ( `f4` int(11) GENERATED ALWAYS AS (`f1`) VIRTUAL, KEY `f1` (`f1`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; # adding foreign key constraint for base columns during alter copy. create table t2(f1 int not null, f2 int as (f1) stored) engine=innodb; @@ -28,7 +28,7 @@ t2 CREATE TABLE `t2` ( `f2` int(11) GENERATED ALWAYS AS (`f1`) STORED, KEY `f1` (`f1`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t2; # adding foreign key constraint for base columns during online alter. create table t2(f1 int not null, f2 int as (f1) stored) engine=innodb; @@ -49,7 +49,7 @@ CREATE TABLE s (a INT, b INT GENERATED ALWAYS AS (0) STORED, c INT, d INT GENERATED ALWAYS AS (0) VIRTUAL, e INT) ENGINE=innodb; CREATE TABLE t (a INT) ENGINE=innodb; ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (e) REFERENCES t(a) ON UPDATE SET null; -ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'c' in the referenced table 't' +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'c' in the referenced table 't' ALTER TABLE t ADD PRIMARY KEY(a); ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (e) REFERENCES t(a) ON UPDATE SET null; DROP TABLE s,t; @@ -57,7 +57,7 @@ CREATE TABLE s (a INT GENERATED ALWAYS AS (0) VIRTUAL, b INT GENERATED ALWAYS AS (0) STORED, c INT) ENGINE=innodb; CREATE TABLE t (a INT) ENGINE=innodb; ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (c) REFERENCES t(a) ON UPDATE SET null; -ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'c' in the referenced table 't' +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'c' in the referenced table 't' ALTER TABLE t ADD PRIMARY KEY(a); ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (c) REFERENCES t(a) ON UPDATE SET null; DROP TABLE s,t; @@ -68,7 +68,7 @@ DROP TABLE s,t; CREATE TABLE s (a INT, b INT) ENGINE=innodb; CREATE TABLE t (a INT) ENGINE=innodb; ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (a) REFERENCES t(a) ON UPDATE SET null; -ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'c' in the referenced table 't' +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'c' in the referenced table 't' ALTER TABLE t ADD PRIMARY KEY(a); ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (a) REFERENCES t(a) ON UPDATE SET null; DROP TABLE s,t; diff --git a/mysql-test/suite/innodb/r/table_definition_cache_debug.result b/mysql-test/suite/innodb/r/table_definition_cache_debug.result index df171c89cd482..6bd754aaca3b1 100644 --- a/mysql-test/suite/innodb/r/table_definition_cache_debug.result +++ b/mysql-test/suite/innodb/r/table_definition_cache_debug.result @@ -12,6 +12,7 @@ connection default; SET DEBUG_SYNC = 'now WAIT_FOR scanned'; BEGIN; INSERT INTO to_be_evicted VALUES(3, 2); +COMMIT; SET DEBUG_SYNC = 'now SIGNAL got_duplicate'; connection ddl; ERROR 23000: Duplicate entry '2' for key 'b' diff --git a/mysql-test/suite/innodb/r/table_flags.result b/mysql-test/suite/innodb/r/table_flags.result index ce71d9b022d53..779990351c6e7 100644 --- a/mysql-test/suite/innodb/r/table_flags.result +++ b/mysql-test/suite/innodb/r/table_flags.result @@ -105,7 +105,7 @@ Table Create Table td CREATE TABLE `td` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC SELECT * FROM td; a SHOW CREATE TABLE tz; @@ -113,7 +113,7 @@ Table Create Table tz CREATE TABLE `tz` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 BEGIN; INSERT INTO tz VALUES(42); ROLLBACK; @@ -131,31 +131,31 @@ Table Create Table tr CREATE TABLE `tr` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT SHOW CREATE TABLE tc; Table Create Table tc CREATE TABLE `tc` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT SHOW CREATE TABLE td; Table Create Table td CREATE TABLE `td` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC SHOW CREATE TABLE tz; Table Create Table tz CREATE TABLE `tz` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=9 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=9 BEGIN; INSERT INTO tr VALUES(1); INSERT INTO tc VALUES(1); diff --git a/mysql-test/suite/innodb/r/temporary_table.result b/mysql-test/suite/innodb/r/temporary_table.result index 3168c357bdedc..ffcee726f0d44 100644 --- a/mysql-test/suite/innodb/r/temporary_table.result +++ b/mysql-test/suite/innodb/r/temporary_table.result @@ -263,7 +263,7 @@ t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, `c` char(10) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=4 DROP TABLE t1; CREATE TEMPORARY TABLE t1 ( i INT NOT NULL PRIMARY KEY, @@ -277,7 +277,7 @@ t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, `c` char(10) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT DROP TABLE t1; CREATE TEMPORARY TABLE t1 ( i INT NOT NULL PRIMARY KEY, @@ -291,7 +291,7 @@ t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, `c` char(10) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT DROP TABLE t1; CREATE TEMPORARY TABLE t1 ( i INT NOT NULL PRIMARY KEY, @@ -310,7 +310,7 @@ t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, `c` char(10) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=4 DROP TABLE t1; CREATE TEMPORARY TABLE t1 ( i INT NOT NULL PRIMARY KEY, @@ -329,7 +329,7 @@ t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, `c` char(10) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED DROP TABLE t1; CREATE TEMPORARY TABLE t1 ( i INT NOT NULL PRIMARY KEY, @@ -352,7 +352,7 @@ t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, `c` char(10) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 DROP TABLE t1; CREATE TEMPORARY TABLE t1 ( i INT NOT NULL PRIMARY KEY, @@ -371,7 +371,7 @@ t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, `c` char(10) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=8 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=8 DROP TABLE t1; CREATE TEMPORARY TABLE t1 ( i INT NOT NULL PRIMARY KEY, @@ -385,7 +385,7 @@ t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, `c` char(10) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC DROP TABLE t1; CREATE TEMPORARY TABLE t1 ( i INT NOT NULL PRIMARY KEY @@ -403,7 +403,7 @@ Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED ALTER TABLE t1 KEY_BLOCK_SIZE = 4; Warnings: Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. @@ -421,7 +421,7 @@ Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 ALTER TABLE t1 KEY_BLOCK_SIZE = 4 ROW_FORMAT = COMPRESSED; Warnings: Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. @@ -439,7 +439,7 @@ Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4; Warnings: Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. @@ -453,7 +453,7 @@ Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4 ALTER TABLE t1 ROW_FORMAT = DYNAMIC; Warnings: Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. @@ -467,7 +467,7 @@ Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4 DROP TABLE t1; set innodb_strict_mode = ON; CREATE TEMPORARY TABLE t1 ( @@ -500,7 +500,7 @@ t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, `c` char(10) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT DROP TABLE t1; CREATE TEMPORARY TABLE t1 ( i INT NOT NULL PRIMARY KEY, @@ -550,7 +550,7 @@ t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, `c` char(10) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC DROP TABLE t1; CREATE TEMPORARY TABLE t1 ( i INT NOT NULL PRIMARY KEY @@ -590,7 +590,7 @@ Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC set innodb_strict_mode = OFF; ALTER TABLE t1 ROW_FORMAT = COMPRESSED; Warnings: @@ -624,7 +624,7 @@ Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, PRIMARY KEY (`i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 set innodb_strict_mode = OFF; ALTER TABLE t1 KEY_BLOCK_SIZE = 0; Warnings: @@ -635,7 +635,7 @@ Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, PRIMARY KEY (`i`) KEY_BLOCK_SIZE=8 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED ALTER TABLE t1 ROW_FORMAT = DYNAMIC; set innodb_strict_mode = ON; ALTER TABLE t1 ADD COLUMN j INT; @@ -645,7 +645,7 @@ t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) NOT NULL, `j` int(11) DEFAULT NULL, PRIMARY KEY (`i`) KEY_BLOCK_SIZE=8 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC DROP TABLE t1; CREATE TEMPORARY TABLE t1(f1 INT, KEY(f1)) ENGINE=InnoDB; INSERT INTO t1 VALUES(NULL); @@ -775,3 +775,30 @@ INSERT INTO t VALUES (1); START TRANSACTION READ ONLY; UPDATE t SET a = NULL; ROLLBACK; +DROP TABLE t; +# +# MDEV-29886 Assertion !index->table->is_temporary() failed +# in trx_undo_prev_version_build upon CHECK +# +CREATE TEMPORARY TABLE t (a INT, KEY(a)) ENGINE=InnoDB SELECT 1; +UPDATE t SET a=2; +CHECK TABLE t; +Table Op Msg_type Msg_text +test.t check status OK +CHECK TABLE t EXTENDED; +Table Op Msg_type Msg_text +test.t check status OK +DROP TEMPORARY TABLE t; +# +# MDEV-29978 Corruption errors upon CHECK on temporary InnoDB table +# +CREATE TEMPORARY TABLE t (f INT UNIQUE) ENGINE=InnoDB; +INSERT INTO t (f) VALUES (1),(2); +CHECK TABLE t; +Table Op Msg_type Msg_text +test.t check status OK +CHECK TABLE t EXTENDED; +Table Op Msg_type Msg_text +test.t check status OK +DROP TEMPORARY TABLE t; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb/r/temporary_table_optimization.result b/mysql-test/suite/innodb/r/temporary_table_optimization.result index c678fd56880c4..e2e9131b09d3b 100644 --- a/mysql-test/suite/innodb/r/temporary_table_optimization.result +++ b/mysql-test/suite/innodb/r/temporary_table_optimization.result @@ -149,7 +149,7 @@ t1 CREATE TEMPORARY TABLE `t1` ( `t1_i` int(11) DEFAULT NULL, `t1_c` char(10) DEFAULT NULL, UNIQUE KEY `pri_index` (`t1_i`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1 where t1_f >= 2.5; ERROR 42S22: Unknown column 't1_f' in 'where clause' alter table t1 add index sec_index2(t1_c), algorithm=inplace; diff --git a/mysql-test/suite/innodb/r/truncate_crash.result b/mysql-test/suite/innodb/r/truncate_crash.result index 0c20e76d33113..ae3e6f6f4bf9f 100644 --- a/mysql-test/suite/innodb/r/truncate_crash.result +++ b/mysql-test/suite/innodb/r/truncate_crash.result @@ -8,6 +8,10 @@ connection default; SET DEBUG_SYNC='now WAIT_FOR c'; # restart disconnect wait; +SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; +InnoDB 0 transactions not purged +SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; SELECT COUNT(*) FROM t1; COUNT(*) 0 diff --git a/mysql-test/suite/innodb/r/truncate_foreign.result b/mysql-test/suite/innodb/r/truncate_foreign.result index 3154674aabfa1..e587baa5288ff 100644 --- a/mysql-test/suite/innodb/r/truncate_foreign.result +++ b/mysql-test/suite/innodb/r/truncate_foreign.result @@ -80,9 +80,19 @@ SET FOREIGN_KEY_CHECKS=0; ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (a), ALGORITHM=COPY; INSERT INTO t1 VALUES (1,1); LOCK TABLES t1 WRITE; +SET FOREIGN_KEY_CHECKS=1; TRUNCATE t1; ERROR HY000: Cannot add foreign key constraint for `t1` INSERT INTO t1 VALUES (2,2); +ERROR HY000: Table 't1' was not locked with LOCK TABLES +SELECT * FROM t1; +pk a +1 1 +UNLOCK TABLES; +INSERT INTO t1 VALUES (2,2); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) +SET FOREIGN_KEY_CHECKS=0; +INSERT INTO t1 VALUES (2,2); SELECT * FROM t1; pk a 1 1 diff --git a/mysql-test/suite/innodb/r/truncate_missing.result b/mysql-test/suite/innodb/r/truncate_missing.result index b7e514b172b3d..9e28d0fe55616 100644 --- a/mysql-test/suite/innodb/r/truncate_missing.result +++ b/mysql-test/suite/innodb/r/truncate_missing.result @@ -9,7 +9,7 @@ Table Create Table t CREATE TABLE `t` ( `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, UNIQUE KEY `a` (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # restart SELECT * FROM t; ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB diff --git a/mysql-test/suite/innodb/r/trx_id_future.result b/mysql-test/suite/innodb/r/trx_id_future.result index 1ddc0e64f8b51..4f88b1d478398 100644 --- a/mysql-test/suite/innodb/r/trx_id_future.result +++ b/mysql-test/suite/innodb/r/trx_id_future.result @@ -6,13 +6,9 @@ SET GLOBAL innodb_purge_rseg_truncate_frequency=1; CREATE TABLE t1(a INT) row_format=redundant engine=innoDB; INSERT INTO t1 VALUES(1); InnoDB 0 transactions not purged -NOT FOUND /\[Warning\] InnoDB: A transaction id in a record of table `test`\.`t1` is newer than the system-wide maximum/ in mysqld.1.err call mtr.add_suppression("\\[Warning\\] InnoDB: A transaction id in a record of table `test`\\.`t1` is newer than the system-wide maximum"); -SET @save_count = @@max_error_count; -SET max_error_count = 1; +call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption"); +call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it"); SELECT * FROM t1; -a -Warnings: -Warning 1642 InnoDB: Transaction id in a record of table `test`.`t1` is newer than system-wide maximum. -SET max_error_count = @save_count; +ERROR HY000: Index for table 't1' is corrupt; try to repair it DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/undo_truncate.result b/mysql-test/suite/innodb/r/undo_truncate.result index fbfd061c9cc7b..48b184f07c74f 100644 --- a/mysql-test/suite/innodb/r/undo_truncate.result +++ b/mysql-test/suite/innodb/r/undo_truncate.result @@ -1,5 +1,10 @@ SET GLOBAL innodb_undo_log_truncate = 0; SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; +=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === +Space_Name Page_Size Zip_Size Path +innodb_undo001 DEFAULT DEFAULT MYSQLD_DATADIR//undo001 +innodb_undo002 DEFAULT DEFAULT MYSQLD_DATADIR//undo002 +innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1 create table t1(keyc int primary key, c char(100)) engine = innodb; create table t2(keyc int primary key, c char(100)) engine = innodb; connect con1,localhost,root,,; @@ -28,6 +33,8 @@ connection con2; commit; disconnect con2; connection default; +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; +SET GLOBAL innodb_max_purge_lag_wait=0; set global innodb_fast_shutdown=0; # restart drop table t1, t2; diff --git a/mysql-test/suite/innodb/r/update-cascade.result b/mysql-test/suite/innodb/r/update-cascade.result index a3c8fed931e6f..00d052a0b56f7 100644 --- a/mysql-test/suite/innodb/r/update-cascade.result +++ b/mysql-test/suite/innodb/r/update-cascade.result @@ -10,7 +10,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` blob DEFAULT NULL, PRIMARY KEY (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -19,7 +19,7 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`f1`), KEY `f2` (`f2`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1, repeat('+', 20000)); insert into t1 values (2, repeat('-', 20000)); insert into t1 values (3, repeat('=', 20000)); @@ -38,7 +38,7 @@ select f1, f2 from t2 for update; f1 f2 1 2 connection default; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL upd_waiting WAIT_FOR go_upd'; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; update t1 set f1 = 10 where f1 = 2; connection con1; set debug_sync='now WAIT_FOR upd_waiting'; @@ -73,7 +73,7 @@ t1 CREATE TABLE `t1` ( `f2` int(11) DEFAULT NULL, PRIMARY KEY (`f1`), KEY `k1` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -82,7 +82,7 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`f1`), KEY `f2` (`f2`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f2`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1, 91); insert into t2 values (1, 91); select f1, f2 from t1; @@ -97,7 +97,7 @@ select f1, f2 from t2 for update; f1 f2 1 91 connection default; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL upd_waiting WAIT_FOR go_upd'; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; update t1 set f2 = 28 where f2 = 91; connection con1; set debug_sync='now WAIT_FOR upd_waiting'; @@ -129,7 +129,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, `f2` blob DEFAULT NULL, PRIMARY KEY (`f1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -137,7 +137,7 @@ t2 CREATE TABLE `t2` ( `f2` blob DEFAULT NULL, PRIMARY KEY (`f1`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t3; Table Create Table t3 CREATE TABLE `t3` ( @@ -145,7 +145,7 @@ t3 CREATE TABLE `t3` ( `f2` blob DEFAULT NULL, PRIMARY KEY (`f1`), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t2` (`f1`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2, repeat('-', 20000)); insert into t2 values (2, repeat('%', 20000)); insert into t3 values (2, repeat('+', 20000)); @@ -164,7 +164,7 @@ select f1 from t3 for update; f1 2 connection default; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL upd_waiting WAIT_FOR go_upd'; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; update t1 set f1 = 10 where f1 = 2; connection con1; set debug_sync='now WAIT_FOR upd_waiting'; @@ -216,7 +216,7 @@ t1 CREATE TABLE `t1` ( `f2` int(11) DEFAULT NULL, PRIMARY KEY (`f1`), KEY `k1` (`f2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -225,7 +225,7 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`f1`), KEY `f2` (`f2`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f2`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t3; Table Create Table t3 CREATE TABLE `t3` ( @@ -234,7 +234,7 @@ t3 CREATE TABLE `t3` ( PRIMARY KEY (`f1`), KEY `f2` (`f2`), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t2` (`f2`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2, 91); insert into t2 values (2, 91); insert into t3 values (2, 91); @@ -253,7 +253,7 @@ select f1 from t3 for update; f1 2 connection default; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL upd_waiting WAIT_FOR go_upd'; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; update t1 set f2 = 28 where f2 = 91; connection con1; set debug_sync='now WAIT_FOR upd_waiting'; diff --git a/mysql-test/suite/innodb/r/update_time.result b/mysql-test/suite/innodb/r/update_time.result index a9c432ce6a8ce..50f4f88155f9b 100644 --- a/mysql-test/suite/innodb/r/update_time.result +++ b/mysql-test/suite/innodb/r/update_time.result @@ -19,24 +19,9 @@ SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' AND TIMESTAMPDIFF(SECOND, update_time, NOW()) < 120; COUNT(*) 1 -CREATE TEMPORARY TABLE big (a TEXT) ENGINE=INNODB; -SELECT COUNT(*) FROM information_schema.innodb_buffer_page -WHERE table_name = '`test`.`t`'; -COUNT(*) -1 -INSERT INTO big SELECT REPEAT('a', 1024) FROM seq_1_to_10240; -SELECT COUNT(*) FROM information_schema.innodb_buffer_page -WHERE table_name = '`test`.`t`'; -COUNT(*) -0 -SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' -AND update_time IS NOT NULL; -COUNT(*) -1 -DROP TEMPORARY TABLE big; # Test the behavior after restart with a prepared XA transaction XA START 'xatrx'; -INSERT INTO t VALUES (5); +DELETE FROM t; XA END 'xatrx'; XA PREPARE 'xatrx'; CONNECT con1,localhost,root,,; diff --git a/mysql-test/suite/innodb/t/101_compatibility.test b/mysql-test/suite/innodb/t/101_compatibility.test index eb1ec3b26ac20..878daad275673 100644 --- a/mysql-test/suite/innodb/t/101_compatibility.test +++ b/mysql-test/suite/innodb/t/101_compatibility.test @@ -1,5 +1,6 @@ --source include/innodb_page_size.inc --source include/not_embedded.inc +--source include/have_symlink.inc -- echo # -- echo # MDEV-11623 MariaDB 10.1 fails to start datadir created with diff --git a/mysql-test/suite/innodb/t/alter_candidate_key.test b/mysql-test/suite/innodb/t/alter_candidate_key.test index 7c8f5e30993f0..824ad1ea79927 100644 --- a/mysql-test/suite/innodb/t/alter_candidate_key.test +++ b/mysql-test/suite/innodb/t/alter_candidate_key.test @@ -50,7 +50,7 @@ connection con1; SET DEBUG_SYNC='now WAIT_FOR dml'; BEGIN; INSERT INTO t1 SET a=NULL; -ROLLBACK; +COMMIT; set DEBUG_SYNC='now SIGNAL dml_done'; connection default; --error ER_INVALID_USE_OF_NULL diff --git a/mysql-test/suite/innodb/t/alter_copy.test b/mysql-test/suite/innodb/t/alter_copy.test index 6b6a0151de49a..b62f812f4b7b6 100644 --- a/mysql-test/suite/innodb/t/alter_copy.test +++ b/mysql-test/suite/innodb/t/alter_copy.test @@ -2,8 +2,7 @@ --source include/have_debug.inc --source include/have_debug_sync.inc --source include/not_embedded.inc -# Valgrind gives leaks from the first shutdown which confuses mtr -#--source include/not_valgrind.inc +--source include/no_valgrind_without_big.inc --echo # --echo # MDEV-11415 AVOID INTERMEDIATE COMMIT WHILE DOING @@ -58,7 +57,7 @@ ALTER TABLE t ADD INDEX(b,c,d,a),ADD INDEX(b,c,a,d),ADD INDEX(b,a,c,d),ADD INDEX connection default; SET DEBUG_SYNC='now WAIT_FOR hung'; let $shutdown_timeout=0; ---let $restart_parameters= --innodb-force-recovery=3 +--let $restart_parameters= --innodb-force-recovery=3 --debug_dbug="+d,recv_ran_out_of_buffer" --source include/restart_mysqld.inc disconnect hang; let $shutdown_timeout=; diff --git a/mysql-test/suite/innodb/t/alter_crash.test b/mysql-test/suite/innodb/t/alter_crash.test index 1049efd3e122b..164ff877b6243 100644 --- a/mysql-test/suite/innodb/t/alter_crash.test +++ b/mysql-test/suite/innodb/t/alter_crash.test @@ -51,8 +51,8 @@ let $MYSQLD_DATADIR= `select @@datadir`; let datadir= `select @@datadir`; # These are from include/shutdown_mysqld.inc and allow to call start_mysqld.inc ---let $_server_id= `SELECT @@server_id` ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --echo # --echo # Bug #14669848 CRASH DURING ALTER MAKES ORIGINAL TABLE INACCESSIBLE @@ -213,6 +213,7 @@ connection default; SET DEBUG_SYNC = 'now WAIT_FOR scanned'; BEGIN; INSERT INTO t1 VALUES(2,1); +COMMIT; SET DEBUG_SYNC = 'now SIGNAL commit'; SET DEBUG_SYNC = 'now WAIT_FOR c'; # Make all pending changes durable for recovery. diff --git a/mysql-test/suite/innodb/t/alter_crash_rebuild.test b/mysql-test/suite/innodb/t/alter_crash_rebuild.test new file mode 100644 index 0000000000000..0ed3e4a1f9cb8 --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_crash_rebuild.test @@ -0,0 +1,24 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +CREATE TABLE t1 (a INT NOT NULL) ENGINE=InnoDB STATS_PERSISTENT=0; + +connect ddl,localhost,root; +SET DEBUG_SYNC='after_trx_committed_in_memory SIGNAL stuck WAIT_FOR ever'; +send ALTER TABLE t1 ADD PRIMARY KEY(a); + +connection default; +SET DEBUG_SYNC='now WAIT_FOR stuck'; + +SET GLOBAL innodb_log_checkpoint_now=ON; + +--let $shutdown_timeout=0 +--source include/restart_mysqld.inc + +disconnect ddl; + +SHOW CREATE TABLE t1; +SELECT * FROM t1; +DROP TABLE t1; +--source include/wait_all_purged.inc diff --git a/mysql-test/suite/innodb/t/alter_dml_apply.opt b/mysql-test/suite/innodb/t/alter_dml_apply.opt new file mode 100644 index 0000000000000..fa3418284bf87 --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_dml_apply.opt @@ -0,0 +1,2 @@ +--innodb_online_alter_log_max_size=64k +--innodb_sort_buffer_size=64k diff --git a/mysql-test/suite/innodb/t/alter_dml_apply.test b/mysql-test/suite/innodb/t/alter_dml_apply.test new file mode 100644 index 0000000000000..ac0455902fdfe --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_dml_apply.test @@ -0,0 +1,60 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_sequence.inc +--source include/no_valgrind_without_big.inc + +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, + f3 CHAR(200), f4 CHAR(200), + PRIMARY KEY(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB"); + +# InnoDB DML thread applies the online log, aborts other online index + +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +SEND ALTER TABLE t1 ADD UNIQUE KEY(f2), ADD UNIQUE INDEX(f4(10)); + +# InnoDB DML thread applies insert log + +connect(con1,localhost,root,,,); +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +# Rollback should avoid online index +BEGIN; +DELETE FROM t1 WHERE f1= 6000; +INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB"); +ROLLBACK; + +# Insert log will fetch the previous version in this case +BEGIN; +DELETE FROM t1 WHERE f1= 6000; +INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB"); +INSERT INTO t1 SELECT seq, seq, repeat('a', 200), repeat('b', 200) FROM seq_1_to_4000; +COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; + +connection default; +--error ER_DUP_ENTRY +reap; + +# DML Thread applies update log + +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +SEND ALTER TABLE t1 ADD UNIQUE KEY(f2), ADD INDEX(f3(10)); + +connection con1; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +DELETE FROM t1; +INSERT INTO t1 SELECT seq, seq, repeat('d', 200), repeat('e', 200) FROM +seq_1_to_4000; +UPDATE t1 SET f3=repeat('c', 200), f4= repeat('d', 200), f2=3; +COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; + +connection default; +--error ER_DUP_ENTRY +reap; +disconnect con1; +CHECK TABLE t1; +DROP TABLE t1; +SET DEBUG_SYNC=reset; diff --git a/mysql-test/suite/innodb/t/alter_large_dml.test b/mysql-test/suite/innodb/t/alter_large_dml.test index d8b288e5a9f55..7320fa008af17 100644 --- a/mysql-test/suite/innodb/t/alter_large_dml.test +++ b/mysql-test/suite/innodb/t/alter_large_dml.test @@ -5,6 +5,8 @@ --source include/have_debug.inc --source include/have_debug_sync.inc --source include/have_sequence.inc +# This test often times out with MemorySanitizer. +--source include/not_msan.inc CREATE TABLE t1(f1 char(200), f2 char(200), f3 char(200), f4 char(200), f5 char(200), f6 char(200), diff --git a/mysql-test/suite/innodb/t/alter_mdl_timeout.test b/mysql-test/suite/innodb/t/alter_mdl_timeout.test index 15e7f524fd098..6d916a3f23b03 100644 --- a/mysql-test/suite/innodb/t/alter_mdl_timeout.test +++ b/mysql-test/suite/innodb/t/alter_mdl_timeout.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_debug.inc +--source include/have_debug_sync.inc create table t1(f1 char(10), f2 char(10) not null, f3 int not null, f4 int not null, primary key(f3))engine=innodb; @@ -14,7 +15,7 @@ begin; INSERT INTO t1 VALUES('e','e',5, 5); SET DEBUG_SYNC="now SIGNAL con1_insert"; SET DEBUG_SYNC="now WAIT_FOR con1_wait"; -SET DEBUG_SYNC="before_row_upd_sec_new_index_entry SIGNAL con1_update WAIT_FOR alter_rollback"; +SET DEBUG_SYNC="after_row_upd_clust SIGNAL con1_update WAIT_FOR alter_rollback"; SEND UPDATE t1 set f4 = 10 order by f1 desc limit 2; connection default; diff --git a/mysql-test/suite/innodb/t/alter_missing_tablespace.test b/mysql-test/suite/innodb/t/alter_missing_tablespace.test index 5c7f63eb81382..9742adc30a613 100644 --- a/mysql-test/suite/innodb/t/alter_missing_tablespace.test +++ b/mysql-test/suite/innodb/t/alter_missing_tablespace.test @@ -1,5 +1,6 @@ --source include/not_embedded.inc --source include/innodb_page_size.inc +--source include/no_valgrind_without_big.inc --echo # --echo # Bug#13955083 ALLOW IN-PLACE DDL OPERATIONS ON MISSING diff --git a/mysql-test/suite/innodb/t/alter_not_null_debug.test b/mysql-test/suite/innodb/t/alter_not_null_debug.test index 9c5ba0faff090..87113b2b3f8c2 100644 --- a/mysql-test/suite/innodb/t/alter_not_null_debug.test +++ b/mysql-test/suite/innodb/t/alter_not_null_debug.test @@ -7,7 +7,7 @@ let $sql_mode = `SELECT @@SQL_MODE`; let $error_code = 0; if ($sql_mode == "STRICT_TRANS_TABLES") { - let $error_code = WARN_DATA_TRUNCATED; + let $error_code = ER_INVALID_USE_OF_NULL; } diff --git a/mysql-test/suite/innodb/t/alter_persistent_autoinc.test b/mysql-test/suite/innodb/t/alter_persistent_autoinc.test new file mode 100644 index 0000000000000..dcaea32700ca6 --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_persistent_autoinc.test @@ -0,0 +1,86 @@ +# Test the ability to remove AUTO_INCREMENT attribute +--source include/have_innodb.inc +--source include/have_partition.inc + +CREATE TABLE t1 (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB; +ALTER TABLE t1 MODIFY c INT NULL, ALGORITHM=INSTANT; +INSERT INTO t1 SET c=1; + +CREATE TABLE t2 (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB; +ALTER TABLE t2 MODIFY c INT NULL, FORCE, ALGORITHM=INPLACE; +INSERT INTO t2 SET c=1; + +CREATE TABLE t3 (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB; +ALTER TABLE t3 MODIFY c INT NULL, ALGORITHM=INPLACE; +INSERT INTO t3 SET c=1; + +CREATE TABLE t4 (c1 INT AUTO_INCREMENT NULL UNIQUE, c2 INT) ENGINE=InnoDB; +ALTER TABLE t4 MODIFY c1 INT NULL, CHANGE COLUMN c2 c3 INT, ALGORITHM=INPLACE; +INSERT INTO t4 SET c1=1; + +CREATE TABLE t5 (c1 INT AUTO_INCREMENT NULL UNIQUE, c2 INT, c3 INTEGER GENERATED ALWAYS AS (c2)) ENGINE=InnoDB; +# ha_innobase::commit_inplace_alter_table() should invoke innobase_reload_table() +ALTER TABLE t5 MODIFY c1 INT NULL, MODIFY COLUMN c2 INT FIRST, ALGORITHM=INPLACE; +INSERT INTO t5 SET c1=1; + +CREATE TABLE t6 (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB + PARTITION BY LIST(c) ( + PARTITION p1 VALUES IN (1), + PARTITION p2 VALUES IN (2) + ); +ALTER TABLE t6 MODIFY c INT NULL, ALGORITHM=INSTANT; +INSERT INTO t6 SET c=1; +INSERT INTO t6 SET c=2; + +CREATE TABLE t7 (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB + PARTITION BY LIST(c) ( + PARTITION p1 VALUES IN (1), + PARTITION p2 VALUES IN (2) + ); +ALTER TABLE t7 MODIFY c INT NULL, ALGORITHM=INPLACE; +INSERT INTO t7 SET c=1; +INSERT INTO t7 SET c=2; + +CREATE TABLE t8 (c1 INT AUTO_INCREMENT NULL UNIQUE, c2 INT) ENGINE=InnoDB + PARTITION BY LIST(c1) ( + PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +ALTER TABLE t8 MODIFY c1 INT NULL, CHANGE COLUMN c2 c3 INT, ALGORITHM=INPLACE; +INSERT INTO t8 SET c1=1; +INSERT INTO t8 SET c1=2; + +FLUSH TABLES t1, t2, t3, t4, t5, t6, t7, t8 FOR EXPORT; + +--let INNODB_PAGE_SIZE=`select @@innodb_page_size` +--let MYSQLD_DATADIR = `SELECT @@datadir` + +--perl +my $ps= $ENV{INNODB_PAGE_SIZE}; +my $PAGE_HEADER = 38; +my $PAGE_ROOT_AUTO_INC = 18; +print "AUTO_INCREMENT not partitioned: "; +for (my $i = 1; $i <= 5; ++$i) { + my $autoinc= read_autoinc("$ENV{MYSQLD_DATADIR}/test/t$i.ibd"); + print "$autoinc "; +} +print "\n"; +print "AUTO_INCREMENT partitioned: "; +for (my $i = 6; $i <= 8; ++$i) { + my $p1= read_autoinc("$ENV{MYSQLD_DATADIR}/test/t$i#P#p1.ibd"); + my $p2= read_autoinc("$ENV{MYSQLD_DATADIR}/test/t$i#P#p2.ibd"); + print "($p1, $p2) "; +} +print "\n"; +sub read_autoinc { + my $file= shift; + open(FILE, "<", $file) || die "Unable to open $file\n"; + sysseek(FILE, 3*$ps + $PAGE_HEADER + $PAGE_ROOT_AUTO_INC + 4, 0) + || die "Unable to seek $file\n"; + die "Unable to read $file\n" unless sysread(FILE, $_, 4) == 4; + my $t1=unpack("N",$_); + close(FILE); + return $t1; +} +EOF + +UNLOCK TABLES; +DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8; diff --git a/mysql-test/suite/innodb/t/alter_table_upgrade.test b/mysql-test/suite/innodb/t/alter_table_upgrade.test new file mode 100644 index 0000000000000..cd058aeee3c1d --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_table_upgrade.test @@ -0,0 +1,36 @@ +--source include/have_innodb.inc + +let $datadir=`select @@datadir`; + +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-29481 mariadb-upgrade prints confusing statement +--echo # + +CREATE TABLE pet4 ( + build_time double(18,7) DEFAULT NULL, + KEY idx1 (build_time)) ENGINE=InnoDB; +FLUSH TABLES; +remove_file $datadir/test/pet4.frm; +copy_file std_data/mysql_upgrade/mdev29481_100104_innodb.frm $datadir/test/pet4.frm; +SHOW CREATE TABLE pet4; +CHECK TABLE pet4 FOR UPGRADE; +ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=INSTANT; +DROP TABLE pet4; + +CREATE TABLE pet4 ( + build_time double(18,7) DEFAULT NULL, + KEY idx1 (build_time)) ENGINE=InnoDB; +FLUSH TABLES; +remove_file $datadir/test/pet4.frm; +copy_file std_data/mysql_upgrade/mdev29481_100104_innodb.frm $datadir/test/pet4.frm; +SHOW CREATE TABLE pet4; +ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=NOCOPY; +DROP TABLE pet4; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/suite/innodb/t/autoinc_debug.test b/mysql-test/suite/innodb/t/autoinc_debug.test index 485439f92505e..7722b848c74b1 100644 --- a/mysql-test/suite/innodb/t/autoinc_debug.test +++ b/mysql-test/suite/innodb/t/autoinc_debug.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_debug.inc +--source include/have_debug_sync.inc --source include/not_embedded.inc # Two parallel connection with autoinc column after restart. diff --git a/mysql-test/suite/innodb/t/autoinc_persist.combinations b/mysql-test/suite/innodb/t/autoinc_persist.combinations new file mode 100644 index 0000000000000..4ae2948e523dd --- /dev/null +++ b/mysql-test/suite/innodb/t/autoinc_persist.combinations @@ -0,0 +1,2 @@ +[asc] +[desc] diff --git a/mysql-test/suite/innodb/t/autoinc_persist.test b/mysql-test/suite/innodb/t/autoinc_persist.test index 6e094b40e02d8..ac933cc7b13d0 100644 --- a/mysql-test/suite/innodb/t/autoinc_persist.test +++ b/mysql-test/suite/innodb/t/autoinc_persist.test @@ -1,6 +1,20 @@ --source include/have_innodb.inc # Restarting is not supported when testing the embedded server. --source include/not_embedded.inc +--source include/no_valgrind_without_big.inc + +if ($MTR_COMBINATION_DESC) { + let $AUTO_INCREMENT_KEY_a= AUTO_INCREMENT, PRIMARY KEY(a DESC); + let $AUTO_INCREMENT_KEY_b= AUTO_INCREMENT, INDEX(b DESC); + let $AUTO_INCREMENT_PRIMARY_KEY_a= AUTO_INCREMENT, PRIMARY KEY(a DESC); + let $AUTO_INCREMENT_PRIMARY_KEY_b= AUTO_INCREMENT, ADD PRIMARY KEY(b DESC); +} +if (!$MTR_COMBINATION_DESC) { + let $AUTO_INCREMENT_KEY_a= AUTO_INCREMENT KEY; + let $AUTO_INCREMENT_KEY_b= AUTO_INCREMENT, KEY(b); + let $AUTO_INCREMENT_PRIMARY_KEY_a= AUTO_INCREMENT PRIMARY KEY; + let $AUTO_INCREMENT_PRIMARY_KEY_b= AUTO_INCREMENT PRIMARY KEY; +} --echo # --echo # MDEV-6076 Persistent AUTO_INCREMENT for InnoDB @@ -20,72 +34,72 @@ SET SQL_MODE='STRICT_ALL_TABLES'; -CREATE TABLE t1(a TINYINT AUTO_INCREMENT KEY) ENGINE = InnoDB; +eval CREATE TABLE t1(a TINYINT $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB; INSERT INTO t1 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31); SELECT * FROM t1; -CREATE TABLE t2(a TINYINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +eval CREATE TABLE t2(a TINYINT UNSIGNED $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB; --error ER_WARN_DATA_OUT_OF_RANGE INSERT INTO t2 VALUES(-5); INSERT INTO t2 VALUES(0), (0), (0), (0), (8), (10), (0), (20), (30), (31); SELECT * FROM t2; -CREATE TABLE t3(a SMALLINT AUTO_INCREMENT KEY) ENGINE = InnoDB; +eval CREATE TABLE t3(a SMALLINT $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB; INSERT INTO t3 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31), (1024), (4096); SELECT * FROM t3; -CREATE TABLE t4(a SMALLINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +eval CREATE TABLE t4(a SMALLINT UNSIGNED $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB; --error ER_WARN_DATA_OUT_OF_RANGE INSERT INTO t4 VALUES(-5); INSERT INTO t4 VALUES(0), (0), (0), (0), (8), (10), (0), (20), (30), (31), (1024), (4096); SELECT * FROM t4; -CREATE TABLE t5(a MEDIUMINT AUTO_INCREMENT KEY) ENGINE = InnoDB; +eval CREATE TABLE t5(a MEDIUMINT $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB; INSERT INTO t5 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31), (1000000), (1000005); SELECT * FROM t5; -CREATE TABLE t6(a MEDIUMINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +eval CREATE TABLE t6(a MEDIUMINT UNSIGNED $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB; --error ER_WARN_DATA_OUT_OF_RANGE INSERT INTO t6 VALUES(-5); INSERT INTO t6 VALUES(0), (0), (0), (0), (8), (10), (0), (20), (30), (31), (1000000), (1000005); SELECT * FROM t6; -CREATE TABLE t7(a INT AUTO_INCREMENT KEY) ENGINE = InnoDB; +eval CREATE TABLE t7(a INT $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB; INSERT INTO t7 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31), (100000000), (100000008); SELECT * FROM t7; -CREATE TABLE t8(a INT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +eval CREATE TABLE t8(a INT UNSIGNED $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB; --error ER_WARN_DATA_OUT_OF_RANGE INSERT INTO t8 VALUES(-5); INSERT INTO t8 VALUES(0), (0), (0), (0), (8), (10), (0), (20), (30), (31), (100000000), (100000008); SELECT * FROM t8; -CREATE TABLE t9(a BIGINT AUTO_INCREMENT KEY) ENGINE = InnoDB; +eval CREATE TABLE t9(a BIGINT $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB; INSERT INTO t9 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31), (100000000000), (100000000006); SELECT * FROM t9; -CREATE TABLE t10(a BIGINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +eval CREATE TABLE t10(a BIGINT UNSIGNED $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB; --error ER_WARN_DATA_OUT_OF_RANGE INSERT INTO t10 VALUES(-5); INSERT INTO t10 VALUES(0), (0), (0), (0), (8), (10), (0), (20), (30), (31), (100000000000), (100000000006); SELECT * FROM t10; -CREATE TABLE t11(a FLOAT AUTO_INCREMENT KEY) ENGINE = InnoDB; +eval CREATE TABLE t11(a FLOAT $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB; INSERT INTO t11 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31); SELECT * FROM t11; -CREATE TABLE t12(a DOUBLE AUTO_INCREMENT KEY) ENGINE = InnoDB; +eval CREATE TABLE t12(a DOUBLE $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB; INSERT INTO t12 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31); SELECT * FROM t12; @@ -105,7 +119,7 @@ SELECT MAX(a) AS `Expect 100000000` FROM t7; DELETE FROM t9 WHERE a > 100000000000; SELECT MAX(a) AS `Expect 100000000000` FROM t9; -CREATE TABLE t13(a INT AUTO_INCREMENT PRIMARY KEY) ENGINE = InnoDB, +eval CREATE TABLE t13(a INT $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB, AUTO_INCREMENT = 1234; --source include/restart_mysqld.inc @@ -439,7 +453,7 @@ INSERT INTO t3 VALUES(0), (0), (200), (210); --echo # Scenario 9: Test the sql_mode = NO_AUTO_VALUE_ON_ZERO -CREATE TABLE t30 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT, key(b)) ENGINE = InnoDB; +eval CREATE TABLE t30 (a INT NOT NULL $AUTO_INCREMENT_PRIMARY_KEY_a, b INT, key(b)) ENGINE = InnoDB; set SQL_MODE = NO_AUTO_VALUE_ON_ZERO; @@ -454,7 +468,7 @@ set global innodb_flush_log_at_trx_commit=1; CREATE TABLE t31 (a INT) ENGINE = InnoDB; INSERT INTO t31 VALUES(1), (2); -ALTER TABLE t31 ADD b INT AUTO_INCREMENT PRIMARY KEY; +eval ALTER TABLE t31 ADD b INT $AUTO_INCREMENT_PRIMARY_KEY_b; INSERT INTO t31 VALUES(3, 0), (4, NULL), (5, NULL); --error ER_DUP_ENTRY INSERT INTO t31 VALUES(6, 0); @@ -463,8 +477,7 @@ SELECT * FROM t31; SET SQL_MODE = 0; --echo # Scenario 10: Rollback would not rollback the counter -CREATE TABLE t32 ( -a BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +eval CREATE TABLE t32 (a BIGINT $AUTO_INCREMENT_PRIMARY_KEY_a) ENGINE=InnoDB; INSERT INTO t32 VALUES(0), (0); @@ -480,10 +493,9 @@ ROLLBACK; --echo # Scenario 11: Test duplicate primary key/secondary key will not stop --echo # increasing the counter -CREATE TABLE t33 ( +eval CREATE TABLE t33 ( a BIGINT NOT NULL PRIMARY KEY, -b BIGINT NOT NULL AUTO_INCREMENT, -KEY(b)) ENGINE = InnoDB; +b BIGINT NOT NULL $AUTO_INCREMENT_KEY_b) ENGINE = InnoDB; INSERT INTO t33 VALUES(1, NULL); INSERT INTO t33 VALUES(2, NULL); @@ -539,10 +551,9 @@ ib_backup_tablespaces("test", "t33"); EOF UNLOCK TABLES; DROP TABLE t33; -CREATE TABLE t33 ( +eval CREATE TABLE t33 ( a BIGINT NOT NULL PRIMARY KEY, -b BIGINT NOT NULL AUTO_INCREMENT, -KEY(b)) ENGINE = InnoDB; +b BIGINT NOT NULL $AUTO_INCREMENT_KEY_b) ENGINE = InnoDB; ALTER TABLE t33 DISCARD TABLESPACE; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; diff --git a/mysql-test/suite/innodb/t/blob-crash.test b/mysql-test/suite/innodb/t/blob-crash.test index beb500553eada..77787a3474590 100644 --- a/mysql-test/suite/innodb/t/blob-crash.test +++ b/mysql-test/suite/innodb/t/blob-crash.test @@ -1,5 +1,7 @@ ---source include/maybe_debug.inc --source include/innodb_page_size_small.inc +--source include/no_valgrind_without_big.inc + +let $have_debug_sync=`select count(*) = 1 from information_schema.session_variables where variable_name = 'debug_sync' and variable_value like 'on %'`; --echo # --echo # Bug #16963396 INNODB: USE OF LARGE EXTERNALLY-STORED FIELDS MAKES @@ -94,7 +96,7 @@ select f1, right(f2, 20), right(f3, 20) from t2; update t2 set f3 = '&'; select f1, right(f2, 20), right(f3, 20) from t2; -if ($have_debug) { +if ($have_debug_sync) { --disable_query_log set DEBUG_SYNC='blob_rollback_middle SIGNAL stuck WAIT_FOR ever'; send ROLLBACK; @@ -102,7 +104,7 @@ send ROLLBACK; } connection default; -if ($have_debug) { +if ($have_debug_sync) { --disable_query_log SET DEBUG_SYNC = 'now WAIT_FOR stuck'; --enable_query_log diff --git a/mysql-test/suite/innodb/t/blob_cmp_empty.test b/mysql-test/suite/innodb/t/blob_cmp_empty.test new file mode 100644 index 0000000000000..f41ac79b16f5c --- /dev/null +++ b/mysql-test/suite/innodb/t/blob_cmp_empty.test @@ -0,0 +1,26 @@ +--source include/innodb_row_format.inc +--source include/count_sessions.inc +--connect(prevent_purge,localhost,root,,) +start transaction with consistent snapshot; + +--connection default +SET @fill_amount = (@@innodb_page_size / 2 ) + 1; +CREATE TABLE t1 (col_text TEXT NOT NULL, KEY (col_text(9))) ENGINE=InnoDB; + +INSERT INTO t1 (col_text) VALUES (REPEAT('x', @fill_amount)); +UPDATE t1 SET col_text=''; +UPDATE t1 SET col_text=REPEAT('y', @fill_amount); + +--connect(con1,localhost,root,,) +SET @fill_amount = (@@innodb_page_size / 2 ) + 1; +BEGIN; +INSERT INTO t1 (col_text) VALUES (REPEAT('z', @fill_amount)); + +--connection default +# If the bug is not fixed, CHECK TABLE will complain about wrong secondary index +# rows count +CHECK TABLE t1; +--disconnect con1 +--disconnect prevent_purge +DROP TABLE t1; +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/change_column_collation.test b/mysql-test/suite/innodb/t/change_column_collation.test new file mode 100644 index 0000000000000..b70925cf411a5 --- /dev/null +++ b/mysql-test/suite/innodb/t/change_column_collation.test @@ -0,0 +1,147 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +--source include/count_sessions.inc + +--echo # +--echo # MDEV-26294 Duplicate entries in unique index not detected when +--echo # changing collation with INPLACE algorithm +--echo # + +# Detect the duplicate entry after collation change of column + +SET NAMES utf8; +CREATE TABLE t1 ( + id INT PRIMARY KEY, + msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_swedish_ci UNIQUE +) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 'aaa'); +INSERT INTO t1 VALUES (2, 'ååå'); +--error ER_DUP_ENTRY +ALTER TABLE t1 MODIFY msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci, ALGORITHM=inplace; +DROP TABLE t1; + +# PageBulk insert shouldn't fail like records are not in ascending order + +CREATE TABLE t1 ( + id INT PRIMARY KEY, + msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin, + id_2 INT not null, + unique index(msg, id_2) +) ENGINE=INNODB; + +INSERT INTO t1 VALUES (1, 'aaa', 2); +INSERT INTO t1 VALUES (2, 'AAA', 3); + +ALTER TABLE t1 MODIFY msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci, ALGORITHM=inplace; + +DROP TABLE t1; + +# Detect the duplicate entry from concurrent DML + +CREATE TABLE t1 ( + id INT PRIMARY KEY, + msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin, + unique index(msg) +) ENGINE=INNODB; + +INSERT INTO t1 VALUES (1, 'aaa'); +INSERT INTO t1 VALUES (2, 'bbb'); +INSERT INTO t1 VALUES (3, 'ccc'); + +SET DEBUG_SYNC = 'RESET'; +SET DEBUG_SYNC = 'row_log_apply_before SIGNAL before_apply WAIT_FOR go_ahead'; +--send +ALTER TABLE t1 MODIFY msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci, ALGORITHM=NOCOPY; + +connect (con1,localhost,root,,); +connection con1; + +SET DEBUG_SYNC = 'now WAIT_FOR before_apply'; +INSERT INTO t1 VALUES (4, 'AAA'); +UPDATE t1 set msg = "ddd" where id = 2; +DELETE FROM t1 WHERE id= 3; +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; + +connection default; + +--error ER_DUP_ENTRY +reap; + +SET DEBUG_SYNC = 'RESET'; +SELECT * FROM t1; +DROP TABLE t1; + +# InnoDB should store the changed collation column into +# change_col_info in index when rollback of alter happens + +CREATE TABLE t1 ( + id INT PRIMARY KEY, + f1 INT NOT NULL, + f2 INT NOT NULL, + f3 INT NOT NULL, + msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin, + msg_1 VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin, + unique index(f1, msg, f2, msg_1, f3), + unique index(f1, msg_1, f2, msg, f3), + unique index(f1, msg, f3, msg_1, f2), + unique index(f1, msg_1, f3, msg, f2), + unique index(f2, msg_1, f1, msg, f3), + unique index(f2, msg, f3, msg_1, f1), + unique index(f3, f2, msg, msg_1, f1), + unique index(f3, msg, msg_1, f1, f2) +) ENGINE=INNODB; + +INSERT INTO t1 VALUES (1, 1, 1, 1, 'aaa', 'aaa'); +SET DEBUG_DBUG="+d,create_index_fail"; +SET DEBUG_SYNC="innodb_inplace_alter_table_enter SIGNAL con1_go WAIT_FOR alter_signal"; +--send +ALTER TABLE t1 MODIFY msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci, MODIFY msg_1 VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci, ALGORITHM=NOCOPY; + +connection con1; +SET DEBUG_SYNC="now WAIT_FOR con1_go"; +BEGIN; +SELECT * FROM t1; +SET DEBUG_SYNC="now SIGNAL alter_signal"; +connection default; +--error ER_DUP_ENTRY +reap; +CHECK TABLE t1; +connection con1; +rollback; +INSERT INTO t1 VALUES(2, 2, 2, 2, 'bbb', 'bbb'); +disconnect con1; +connection default; +SET DEBUG_SYNC=reset; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES(3, 3, 3, 3, 'ccc', 'ccc'); +DROP TABLE t1; + +# Inplace Collation change is not supported for virtual column +# and stored column + +CREATE TABLE t1(id INT PRIMARY KEY, msg VARCHAR(100), + msg_1 VARCHAR(100) AS (msg) VIRTUAL, + msg_2 VARCHAR(100) AS (msg) STORED, + UNIQUE(msg), UNIQUE(msg_1), + UNIQUE(msg_2))ENGINE=InnoDB; +--error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN +ALTER TABLE t1 MODIFY msg_1 VARCHAR(100) CHARACTER SET utf8 + COLLATE utf8_unicode_ci, ALGORITHM=inplace; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 MODIFY msg_2 VARCHAR(100) CHARACTER SET utf8 + COLLATE utf8_unicode_ci, ALGORITHM=inplace; +DROP TABLE t1; + +--echo # +--echo # MDEV-29314 Assertion `n_fields > n_cols' failed +--echo # in dict_index_t::init_change_cols +--echo # +CREATE TABLE t (a VARCHAR(16) COLLATE utf8_bin, + FULLTEXT (a)) ENGINE=InnoDB COLLATE utf8_unicode_520_ci; +ALTER TABLE t MODIFY COLUMN a VARCHAR(512); +SHOW CREATE TABLE t; +DROP TABLE t; + +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/corrupted_during_recovery.test b/mysql-test/suite/innodb/t/corrupted_during_recovery.test index 4893a638ddaa6..f383d9ab9b8e5 100644 --- a/mysql-test/suite/innodb/t/corrupted_during_recovery.test +++ b/mysql-test/suite/innodb/t/corrupted_during_recovery.test @@ -6,8 +6,10 @@ call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed"); call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*test.t1\\.ibd' page"); call mtr.add_suppression("InnoDB: Failed to read page 3 from file '.*test.t1\\.ibd': Page read from tablespace is corrupted."); -call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=\\d+, page number=3\\]"); -call mtr.add_suppression("Table .*t1.* is corrupted. Please drop the table and recreate."); +call mtr.add_suppression("InnoDB: (Unable to apply log to|Discarding log for) corrupted page .*, page number=3\\]"); +call mtr.add_suppression("Table test/t1 is corrupted. Please drop the table and recreate\\."); +call mtr.add_suppression("InnoDB: File '.*test/t1\\.ibd' is corrupted"); +call mtr.add_suppression("InnoDB: A long wait .* was observed for dict_sys"); --enable_query_log let INNODB_PAGE_SIZE=`select @@innodb_page_size`; diff --git a/mysql-test/suite/innodb/t/create-index-debug.test b/mysql-test/suite/innodb/t/create-index-debug.test deleted file mode 100644 index 9ea416fbe1ea3..0000000000000 --- a/mysql-test/suite/innodb/t/create-index-debug.test +++ /dev/null @@ -1,34 +0,0 @@ ---source include/have_innodb.inc ---source include/have_innodb_16k.inc ---source include/have_debug.inc - -SET @saved_debug_dbug = @@SESSION.debug_dbug; - ---echo # ---echo #BUG#21326304 INNODB ONLINE ALTER TABLE ENDS IN CRASH ON DISK FULL ---echo # -CREATE TABLE t1(f1 CHAR(255) NOT NULL, f2 CHAR(255) NOT NULL, f3 -CHAR(255) NOT NULL, f4 CHAR(255) NOT NULL, f5 CHAR(255) NOT NULL,f6 -CHAR(255) NOT NULL, f7 CHAR(255) NOT NULL, f8 CHAR(255) NOT NULL,f9 -CHAR(255) NOT NULL, f10 CHAR(255) NOT NULL, f11 CHAR(255) NOT NULL,f12 -CHAR(255) NOT NULL, f13 CHAR(255) NOT NULL, f14 CHAR(255) NOT NULL,f15 -CHAR(255) NOT NULL, f16 CHAR(255) NOT NULL, f17 CHAR(255) NOT NULL,f18 -CHAR(255) NOT NULL) -ENGINE=INNODB ROW_FORMAT=DYNAMIC; - -INSERT INTO t1 -VALUES('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r'); - -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; - -SET debug_dbug = '+d,disk_is_full'; - ---error ER_RECORD_FILE_FULL -ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; - -SET debug_dbug= @saved_debug_dbug; - -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/create_isl_with_direct.test b/mysql-test/suite/innodb/t/create_isl_with_direct.test index 1427264e13e84..45d7fbf4ea5a0 100644 --- a/mysql-test/suite/innodb/t/create_isl_with_direct.test +++ b/mysql-test/suite/innodb/t/create_isl_with_direct.test @@ -1,12 +1,6 @@ --source include/not_embedded.inc --source include/have_innodb.inc - ---disable_query_log -CALL mtr.add_suppression(".*Failed to set O_DIRECT on file.*"); - -# The below mtr suppression to avoid failure in solaris platform. -CALL mtr.add_suppression("\\[ERROR\\] InnoDB: Failed to set DIRECTIO_ON on file.*"); ---enable_query_log +--source include/have_symlink.inc SHOW VARIABLES LIKE 'innodb_flush_method'; diff --git a/mysql-test/suite/innodb/t/cursor-restore-locking.test b/mysql-test/suite/innodb/t/cursor-restore-locking.test new file mode 100644 index 0000000000000..f8d00f57a5e16 --- /dev/null +++ b/mysql-test/suite/innodb/t/cursor-restore-locking.test @@ -0,0 +1,87 @@ +--source include/have_innodb.inc +--source include/count_sessions.inc +source include/have_debug.inc; +source include/have_debug_sync.inc; + +SET @save_freq=@@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; +CREATE TABLE t (a int PRIMARY KEY, b int NOT NULL UNIQUE) engine = InnoDB; + +--source include/wait_all_purged.inc +--connect(prevent_purge,localhost,root,,) +start transaction with consistent snapshot; + +--connect(con_del_1,localhost,root,,) +INSERT INTO t VALUES (20,20); +SET DEBUG_SYNC = 'innodb_row_search_for_mysql_exit SIGNAL first_del_row_search_mvcc_finished WAIT_FOR first_del_cont'; +--send DELETE FROM t WHERE b = 20 + +--connect(con_ins_1,localhost,root,,) +SET DEBUG_SYNC = 'now WAIT_FOR first_del_row_search_mvcc_finished'; +# It's supposed the following INSERT will be suspended just after +# lock_wait_start syncpoint, and will be awaken +# after the previous DELETE commits. ib_after_row_insert will be executed +# after the INSERT is woken up. The previous DELETE will wait for +# first_del_cont signal before commit, and this signal will be sent later. +# So it's safe to use two signals in a row here, it's guaranted the first +# signal will be received before the second signal is sent. +SET DEBUG_SYNC = 'lock_wait_start SIGNAL first_ins_locked'; +SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL first_ins_row_inserted WAIT_FOR first_ins_cont'; +--send INSERT INTO t VALUES(10, 20) + +--connect(con_del_2,localhost,root,,) +# After MDEV-30225 is fixed, the following DELETE creates next-key lock for +# unqique search for RR, and the above INSERT kills it as deadlock victim. +# But it still requests not-gap lock for RC. +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +SET DEBUG_SYNC = 'now WAIT_FOR first_ins_locked'; +SET DEBUG_SYNC = 'lock_wait_start SIGNAL second_del_locked'; +############################################################################### +# This DELETE is locked by the previous DELETE, after that DELETE is +# committed, it will still be locked by the next INSERT on delete-marked +# heap_no 2 record. After that INSERT inserted the record with heap_no 3, +# and after heap_no 2 record is purged, this DELETE will be unlocked and +# must restore persistent cursor position at heap_no 3 record, as it has the +# same secondary key value as former heap_no 2 record. Then it must be blocked +# by the previous INSERT, and after the INSERT is committed, it must +# delete the record, inserted by the previous INSERT, and the last INSERT(see +# below) must be finished without error. But instead this DELETE restores +# persistent cursor position to supremum, as a result, it does not delete the +# record, inserted by the previous INSERT, and the last INSERT is finished with +# duplicate key check error. +############################################################################### +--send DELETE FROM t WHERE b = 20 + +--connection default +SET DEBUG_SYNC = 'now WAIT_FOR second_del_locked'; +SET DEBUG_SYNC = 'now SIGNAL first_del_cont'; +SET DEBUG_SYNC = 'now WAIT_FOR first_ins_row_inserted'; +--connection con_del_1 +--reap + +--connection default +--disconnect prevent_purge +--source include/wait_all_purged.inc +SET DEBUG_SYNC = 'now SIGNAL first_ins_cont'; + +--connection con_del_2 +--reap + +--connection con_ins_1 +--reap + +--connection default +############################################################################### +# Duplicate key error is expected if the bug is not fixed. +############################################################################### +INSERT INTO t VALUES(30, 20); + +--disconnect con_ins_1 +--disconnect con_del_1 +--disconnect con_del_2 +--connection default + +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t; +SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_freq; +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/deadlock_in_subqueries_join.test b/mysql-test/suite/innodb/t/deadlock_in_subqueries_join.test new file mode 100644 index 0000000000000..b3adfb3b02d79 --- /dev/null +++ b/mysql-test/suite/innodb/t/deadlock_in_subqueries_join.test @@ -0,0 +1,81 @@ +--source include/have_innodb.inc +--source include/count_sessions.inc + +CREATE TABLE t1 ( + pkey int NOT NULL PRIMARY KEY, + c int +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES(1,1); + +CREATE TABLE t2 ( + pkey int NOT NULL PRIMARY KEY, + c int +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +INSERT INTO t2 VALUES (2, NULL); + +# The following table is to increase tansaction weight on deadlock resolution +CREATE TABLE t3 (c int) engine = InnoDB; +INSERT INTO t3 VALUES (10), (20), (30), (40), (50); + +--let $i= 2 +--let $delete= 2 +--let $update= 1 +--connect(con1, localhost,root,,) + +while($i) { +--connection default +START TRANSACTION; # trx 1 +# The following update is necessary to increase the transaction weight, which is +# calculated as the number of locks + the number of undo records during deadlock +# report. Victim's transaction should have minimum weight. We need trx 2 to be +# choosen as victim, that's why we need to increase the current transaction +# weight. +UPDATE t3 SET c=c+1000; +SELECT * FROM t1 FOR UPDATE; + +--connection con1 +START TRANSACTION; # trx 2 +# 1) read record from t2, lock it +# 2) check if the read record should be deleted, i.e. read record from t1, +# as the record from t1 is locked by trx 1, the subselect will be suspended. +# see 'while' loop in mysql_delete() or mysql_update() and +# select->skip_record(thd) call for details. +if ($i == $delete) { +--send DELETE FROM t2 WHERE c NOT IN (SELECT ref_0.pkey FROM t1 AS ref_0 INNER JOIN t1 AS ref_1 ON ref_0.c = ref_0.pkey) +} +if ($i == $update) { +--send UPDATE t2 SET pkey=pkey+10 WHERE c NOT IN (SELECT ref_0.pkey FROM t1 AS ref_0 INNER JOIN t1 AS ref_1 ON ref_0.c = ref_0.pkey) +} + +--connection default +let $wait_condition= + SELECT count(*) = 1 FROM information_schema.processlist + WHERE (state = 'Sending data' OR state = "Updating") + AND (info LIKE 'delete from t2 where%' OR + info LIKE 'UPDATE t2 SET pkey=pkey+10 WHERE%'); +--source include/wait_condition.inc + +# The record from t2 is locked by the previous delete, so trx 2 is waiting for +# trx 1, and trx 1 will be blocked by trx 2 with the following SELECT. So we +# have deadlock here. And trx 2 is chosen as deadlock victim as trx 1 has +# greater weight. +SELECT * FROM t2 FOR UPDATE; +COMMIT; + +--connection con1 +# If the bug is not fixed, there will be assertion failure as +# mysql_delete()/mysql_update() will continue execution despite its subselect +# got deadlock error +--error ER_LOCK_DEADLOCK +--reap +COMMIT; +--dec $i +} + +--disconnect con1 + +--connection default +DROP TABLE t1,t2,t3; +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/deadlock_victim_race.test b/mysql-test/suite/innodb/t/deadlock_victim_race.test new file mode 100644 index 0000000000000..b9a442fc5b9b2 --- /dev/null +++ b/mysql-test/suite/innodb/t/deadlock_victim_race.test @@ -0,0 +1,113 @@ +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/count_sessions.inc + +--connect(cancel_purge,localhost,root,,) +# Purge can cause deadlock in the test, requesting page's RW_X_LATCH for trx +# ids reseting, after trx 2 acqured RW_S_LATCH and suspended in debug sync point +# lock_trx_handle_wait_enter, waiting for upd_cont signal, which must be +# emitted after the last SELECT in this test. The last SELECT will hang waiting +# for purge RW_X_LATCH releasing, and trx 2 will be rolled back by timeout. +# The last SELECT will then be successfully executed instead of finishing by +# lock wait timeout. +START TRANSACTION WITH CONSISTENT SNAPSHOT; + +--connection default +CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB; +CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB; + +INSERT INTO t VALUES (10, 10), (20, 20), (30, 30); +INSERT INTO t2 VALUES (10), (20), (30); + +BEGIN; # trx 1 +SELECT * FROM t WHERE a = 20 FOR UPDATE; +# Locking order: +# (10,10) (20,20) (30,30) +# ^ +# trx 1 + +--connect(con_2,localhost,root,,) +# RC is neccessary to do semi-consistent read +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; # trx 2 +# The first time it will be hit on trying to lock (20,20), the second hit +# will be on (30,30). +SET DEBUG_SYNC = 'lock_trx_handle_wait_enter SIGNAL upd_locked WAIT_FOR upd_cont EXECUTE 2'; +# We must not modify primary key fields to cause rr_sequential() read record +# function choosing in mysql_update(), i.e. both query_plan.using_filesort and +# query_plan.using_io_buffer must be false during init_read_record() call. +--send UPDATE t SET b = 100 + +--connect(con_3,localhost,root,,) +BEGIN; # trx 3 +# The following update is necessary to increase the transaction weight, which is +# calculated as the number of locks + the number of undo records during deadlock +# report. Victim's transaction should have minimum weight. We need trx 2 to be +# choosen as victim, that's why we need to increase the current transaction +# weight. +UPDATE t2 SET a = a + 100; +SELECT * FROM t WHERE a = 30 FOR UPDATE; +SET DEBUG_SYNC='now WAIT_FOR upd_locked'; +# Locking queue: +# (10,10) (20,20) (30,30) +# ^ ^ ^ +# trx 2 trx 1 trx 3 +# trx 2 (waiting for 1) + +SET DEBUG_SYNC = 'lock_wait_start SIGNAL sel_locked'; +--send SELECT * FROM t WHERE a = 20 FOR UPDATE +--connection default +SET DEBUG_SYNC='now WAIT_FOR sel_locked'; +# Locking queue: +# (10,10) (20,20) (30,30) +# ^ ^ ^ +# trx 2 trx 1 trx 3 +# trx 2 (waiting for 1) +# trx 3 (waiting for 1) +# +# Note trx 1 must grant lock to trx2 before trx 2 checks the lock state in +# lock_trx_handle_wait(), i.e. the function must return DB_SUCCESS, that's why +# the following ROLLBACK must be executed before sending upd_cont signal. +ROLLBACK; +SET DEBUG_SYNC='now SIGNAL upd_cont'; + +SET DEBUG_SYNC="now WAIT_FOR upd_locked"; +# Locking queue: +# (10,10) (20,20) (30,30) +# ^ ^ ^ +# trx 2 trx 2 trx 3 +# trx 3 (waiting for 2) trx 2 (waiting for 3) +# +# Deadlock happened after trx 1 granted lock to trx 2, and trx2 continued +# sequential read (with rr_sequential() read record function), and requested +# lock on (30,30). But the deadlock has not been determined yet. + +SET SESSION innodb_lock_wait_timeout=1; +--error ER_LOCK_WAIT_TIMEOUT +# The deadlock will be determined in lock_wait() after lock wait timeout +# expired. +SELECT * FROM t WHERE a = 10 FOR UPDATE; +SET DEBUG_SYNC="now SIGNAL upd_cont"; + +--connection con_3 +--reap + +--connection con_2 +# As lock_trx_handle_wait() wrongly returned DB_SUCCESS instead of +# DB_DEADLOCK, row_search_mvcc() of trx 2 behaves so as if (30,30) was locked. +# But the waiting(for trx 3) lock was cancelled by deadlock checker after +# trx 2 was choosen as a victim (see lock_cancel_waiting_and_release() call +# from Deadlock::report() for details). The try to update non-locked record +# will cause assertion if the bug is not fixed. +--error ER_LOCK_DEADLOCK +--reap + +--disconnect con_3 +--disconnect con_2 + +--connection default +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t; +DROP TABLE t2; +--disconnect cancel_purge +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/deadlock_wait_lock_race.opt b/mysql-test/suite/innodb/t/deadlock_wait_lock_race.opt new file mode 100644 index 0000000000000..65470e63e448b --- /dev/null +++ b/mysql-test/suite/innodb/t/deadlock_wait_lock_race.opt @@ -0,0 +1 @@ +--innodb-force-recovery=2 diff --git a/mysql-test/suite/innodb/t/deadlock_wait_lock_race.test b/mysql-test/suite/innodb/t/deadlock_wait_lock_race.test new file mode 100644 index 0000000000000..79a62b098c9f5 --- /dev/null +++ b/mysql-test/suite/innodb/t/deadlock_wait_lock_race.test @@ -0,0 +1,67 @@ +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/count_sessions.inc + +# Purge can cause deadlock in the test, requesting page's RW_X_LATCH for trx +# ids reseting, after trx 2 acqured RW_S_LATCH and suspended in debug sync point +# lock_trx_handle_wait_enter, waiting for upd_cont signal, which must be +# emitted after the last SELECT in this test. The last SELECT will hang waiting +# for purge RW_X_LATCH releasing, and trx 2 will be rolled back by timeout. + +# There is deadlock_report_before_lock_releasing sync point in +# Deadlock::report(), which is waiting for sel_cont signal under +# lock_sys_t lock. The signal must be issued after "UPDATE t SET b = 100" +# rollback, and that rollback is executing undo record, which is blocked on +# dict_sys latch request. dict_sys is locked by the thread of statistics +# update(dict_stats_save()), and during that update lock_sys lock is requested, +# and can't be acquired as Deadlock::report() holds it. We have to disable +# statistics update to make the test stable. + +CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB STATS_PERSISTENT=0; +CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB STATS_PERSISTENT=0; + +INSERT INTO t VALUES (10, 10), (20, 20), (30, 30); +INSERT INTO t2 VALUES (10), (20), (30); + +BEGIN; # trx 1 +# The following update is necessary to increase the transaction weight, which is +# calculated as the number of locks + the number of undo records during deadlock +# report. Victim's transaction should have minimum weight. We need trx 2 to be +# choosen as victim, that's why we need to increase the current transaction +# weight. +UPDATE t2 SET a = a + 100; +SELECT * FROM t WHERE a = 20 FOR UPDATE; + +--connect(con_2,localhost,root,,) +# RC is necessary to do semi-consistent read +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; # trx 2 +# The first time it will be hit on trying to lock (20,20), the second hit +# will be on (30,30). +SET DEBUG_SYNC = 'lock_trx_handle_wait_before_unlocked_wait_lock_check SIGNAL upd_locked WAIT_FOR upd_cont'; +# We must not modify primary key fields to cause rr_sequential() read record +# function choosing in mysql_update(), i.e. both query_plan.using_filesort and +# query_plan.using_io_buffer must be false during init_read_record() call. +--send UPDATE t SET b = 100 + +--connection default +SET DEBUG_SYNC="now WAIT_FOR upd_locked"; +SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL upd_cont"; +--send SELECT * FROM t WHERE a = 10 FOR UPDATE + +--connection con_2 +# If the bug is not fixed, lock_trx_handle_wait() wrongly returns DB_SUCCESS +# instead of DB_DEADLOCK, row_search_mvcc() of trx 2 behaves so as if (20,20) +# was locked. Some debug assertion must crash the server. If the bug is fixed, +# trx 2 must just be rolled back by deadlock detector. +--error ER_LOCK_DEADLOCK +--reap + +--disconnect con_2 + +--connection default +--reap +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t; +DROP TABLE t2; +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/deadlock_wait_thr_race.opt b/mysql-test/suite/innodb/t/deadlock_wait_thr_race.opt new file mode 100644 index 0000000000000..65470e63e448b --- /dev/null +++ b/mysql-test/suite/innodb/t/deadlock_wait_thr_race.opt @@ -0,0 +1 @@ +--innodb-force-recovery=2 diff --git a/mysql-test/suite/innodb/t/deadlock_wait_thr_race.test b/mysql-test/suite/innodb/t/deadlock_wait_thr_race.test new file mode 100644 index 0000000000000..42576f35bafcd --- /dev/null +++ b/mysql-test/suite/innodb/t/deadlock_wait_thr_race.test @@ -0,0 +1,71 @@ +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/count_sessions.inc + +# Purge can cause deadlock in the test, requesting page's RW_X_LATCH for trx +# ids reseting, after trx 2 acqured RW_S_LATCH and suspended in debug sync point +# lock_trx_handle_wait_enter, waiting for upd_cont signal, which must be +# emitted after the last SELECT in this test. The last SELECT will hang waiting +# for purge RW_X_LATCH releasing, and trx 2 will be rolled back by timeout. + +# There is deadlock_report_before_lock_releasing sync point in +# Deadlock::report(), which is waiting for sel_cont signal under +# lock_sys_t lock. The signal must be issued after "UPDATE t SET b = 100" +# rollback, and that rollback is executing undo record, which is blocked on +# dict_sys latch request. dict_sys is locked by the thread of statistics +# update(dict_stats_save()), and during that update lock_sys lock is requested, +# and can't be acquired as Deadlock::report() holds it. We have to disable +# statistics update to make the test stable. + +CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB STATS_PERSISTENT=0; +CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB STATS_PERSISTENT=0; + +INSERT INTO t VALUES (10, 10), (20, 20), (30, 30); +INSERT INTO t2 VALUES (10), (20), (30); + +BEGIN; # trx 1 +# The following update is necessary to increase the transaction weight, which is +# calculated as the number of locks + the number of undo records during deadlock +# report. Victim's transaction should have minimum weight. We need trx 2 to be +# choosen as victim, that's why we need to increase the current transaction +# weight. +UPDATE t2 SET a = a + 100; +SELECT * FROM t WHERE a = 20 FOR UPDATE; + +--connect(con_2,localhost,root,,) +# RC is necessary to do semi-consistent read +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +# It will be hit on trying to lock (20,20). +SET DEBUG_SYNC = 'lock_trx_handle_wait_enter SIGNAL upd_locked WAIT_FOR upd_cont'; +SET DEBUG_SYNC = 'trx_t_release_locks_enter SIGNAL sel_cont WAIT_FOR upd_cont_2'; +BEGIN; # trx 2 +# We must not modify primary key fields to cause rr_sequential() read record +# function choosing in mysql_update(), i.e. both query_plan.using_filesort and +# query_plan.using_io_buffer must be false during init_read_record() call. +# The following UPDATE will be chosen as deadlock victim and rolled back. +--send UPDATE t SET b = 100 + +--connection default +SET DEBUG_SYNC="now WAIT_FOR upd_locked"; +SET DEBUG_SYNC="deadlock_report_before_lock_releasing SIGNAL upd_cont WAIT_FOR sel_cont"; +SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL sel_before_suspend"; +# If the bug is not fixed, the following SELECT will crash, as the above UPDATE +# will reset trx->lock.wait_thr during rollback +--send SELECT * FROM t WHERE a = 10 FOR UPDATE; + +--connect(con_3,localhost,root,,) +SET DEBUG_SYNC="now WAIT_FOR sel_before_suspend"; +SET DEBUG_SYNC="now SIGNAL upd_cont_2"; +--disconnect con_3 + +--connection con_2 +--error ER_LOCK_DEADLOCK +--reap +--disconnect con_2 + +--connection default +--reap +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t; +DROP TABLE t2; +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/default_row_format_alter.test b/mysql-test/suite/innodb/t/default_row_format_alter.test index f5dd246efb5ab..5f2170454f36f 100644 --- a/mysql-test/suite/innodb/t/default_row_format_alter.test +++ b/mysql-test/suite/innodb/t/default_row_format_alter.test @@ -150,6 +150,23 @@ ALTER TABLE t1 DROP b; SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; DROP TABLE t1; +--echo # +--echo # MDEV-31025 Redundant table alter fails when fixed column +--echo # stored externally +--echo # +set @old_sql_mode = @@sql_mode; +SET @@sql_mode=''; +CREATE TABLE t1(pk INT,c CHAR(255),c2 CHAR(255),c3 CHAR(255), + c4 char(255), c5 char(255), c6 char(255), + c7 char(255), c8 char(255), primary key(pk) + )Engine=InnoDB character set utf32 ROW_FORMAT=REDUNDANT; +INSERT INTO t1(pk, c) VALUES (1, repeat('a', 255)); +ALTER TABLE t1 FORCE; +CHECK TABLE t1; +SELECT LENGTH(c) FROM t1; +DROP TABLE t1; +set @@sql_mode = @old_sql_mode; + --echo # End of 10.4 tests SET GLOBAL innodb_default_row_format = @row_format; diff --git a/mysql-test/suite/innodb/t/default_row_format_create.test b/mysql-test/suite/innodb/t/default_row_format_create.test index 0b3e0d25f00aa..cd497d74de7cc 100644 --- a/mysql-test/suite/innodb/t/default_row_format_create.test +++ b/mysql-test/suite/innodb/t/default_row_format_create.test @@ -69,10 +69,13 @@ DROP TABLE IF EXISTS t; SET GLOBAL innodb_compression_level=1; CREATE TABLE t(a INT)ENGINE=InnoDB ROW_FORMAT=DYNAMIC page_compressed=1; +CREATE TEMPORARY TABLE tt(a INT PRIMARY KEY) +ROW_FORMAT=DYNAMIC page_compressed=1 ENGINE=InnoDB; SET GLOBAL innodb_compression_level=0; --error ER_ILLEGAL_HA_CREATE_OPTION ALTER TABLE t FORCE, ROW_FORMAT=DEFAULT, ALGORITHM=INPLACE; --error ER_CANT_CREATE_TABLE ALTER TABLE t FORCE, ROW_FORMAT=DEFAULT, ALGORITHM=COPY; DROP TABLE t; +TRUNCATE tt; SET GLOBAL innodb_compression_level=@save_level; diff --git a/mysql-test/suite/innodb/t/dml_purge.test b/mysql-test/suite/innodb/t/dml_purge.test index 37178982c8d50..7034939aa4e31 100644 --- a/mysql-test/suite/innodb/t/dml_purge.test +++ b/mysql-test/suite/innodb/t/dml_purge.test @@ -14,6 +14,7 @@ SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; CREATE TABLE t1(a INT PRIMARY KEY, b INT NOT NULL) ROW_FORMAT=REDUNDANT ENGINE=InnoDB; +--source include/wait_all_purged.inc --connect (prevent_purge,localhost,root) START TRANSACTION WITH CONSISTENT SNAPSHOT; @@ -33,7 +34,12 @@ UPDATE t1 SET b=4 WHERE a=3; # Initiate a full purge, which should reset the DB_TRX_ID except for a=3. --source include/wait_all_purged.inc # Initiate a ROLLBACK of the update, which should reset the DB_TRX_ID for a=3. +--connection con1 +ROLLBACK; --disconnect con1 +--connection default +# Reset the DB_TRX_ID for the hidden ADD COLUMN metadata record. +--source include/wait_all_purged.inc FLUSH TABLE t1 FOR EXPORT; # The following is based on innodb.table_flags: diff --git a/mysql-test/suite/innodb/t/dropdb_cs.test b/mysql-test/suite/innodb/t/dropdb_cs.test new file mode 100644 index 0000000000000..0053ca732be29 --- /dev/null +++ b/mysql-test/suite/innodb/t/dropdb_cs.test @@ -0,0 +1,17 @@ +--source include/have_innodb.inc +--source include/have_case_sensitive_file_system.inc + +--echo # +--echo # MDEV-28802 DROP DATABASE in InnoDB still is case-insensitive +--echo # + +SET @save_fpt=@@GLOBAL.innodb_file_per_table; +SET GLOBAL innodb_file_per_table=0; +CREATE DATABASE Db; +CREATE TABLE Db.t1 (c1 INT KEY) ENGINE=InnoDB; +CREATE DATABASE DB; +DROP DATABASE DB; +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'D%'; +DROP DATABASE Db; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'D%'; +SET GLOBAL innodb_file_per_table=@save_fpt; diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test index 07601adffd969..4b047ea4d4a17 100644 --- a/mysql-test/suite/innodb/t/foreign_key.test +++ b/mysql-test/suite/innodb/t/foreign_key.test @@ -102,7 +102,41 @@ INSERT INTO t2 VALUES (1); SELECT unique_constraint_name FROM information_schema.referential_constraints WHERE table_name = 't2'; +--echo # +--echo # MDEV-28317 Assertion failure on rollback of FOREIGN KEY operation +--echo # + +SET foreign_key_checks=0; +CREATE TABLE parent(a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE child(a INT,FOREIGN KEY(a) REFERENCES parent(a) ON DELETE CASCADE) +ENGINE=InnoDB; +INSERT INTO child VALUES(1); +ALTER TABLE child DROP INDEX a; + +connect(incomplete, localhost, root,,); +BEGIN; +DELETE FROM child; + +connection default; +INSERT INTO parent SET a=0; +FLUSH TABLES; + +--let $shutdown_timeout=0 --source include/restart_mysqld.inc +--let $shutdown_timeout= +disconnect incomplete; + +INSERT INTO child SET a=0; +--error ER_NO_REFERENCED_ROW_2 +INSERT INTO child SET a=1; +--error ER_ROW_IS_REFERENCED_2 +DELETE FROM parent; +ALTER TABLE child ADD INDEX(a); +--error ER_ROW_IS_REFERENCED_2 +DELETE FROM parent; +ALTER TABLE child FORCE; +DELETE FROM parent; +DROP TABLE child,parent; SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; @@ -821,8 +855,60 @@ eval create table t1($fk_ref int primary key, $fk_field int, $constrs) engine in drop table t1; --enable_query_log +--echo # +--echo # MDEV-27583 InnoDB uses different constants for FK cascade +--echo # error message in SQL vs error log +--echo # + +CREATE TABLE t1 +(a INT, b INT, KEY(b), +CONSTRAINT FOREIGN KEY (a) REFERENCES t1 (b) ON DELETE CASCADE) +ENGINE=InnoDB; + +INSERT INTO t1 (a,b) VALUES +(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0), +(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,1),(1,0); + +--error ER_GET_ERRMSG +DELETE FROM t1 WHERE b = 1; +SHOW WARNINGS; +DROP TABLE t1; + +let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; +let SEARCH_PATTERN= InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 15.*; +-- source include/search_pattern_in_file.inc + --echo # End of 10.2 tests +--echo # +--echo # MDEV-28980 InnoDB: Failing assertion: len <= MAX_TABLE_NAME_LEN +--echo # + +SET NAMES utf8; +CREATE TABLE t (a INT PRIMARY KEY) ENGINE=InnoDB; +# The maximum identifier length is 64 characters. +# my_charset_filename will expand some characters to 5 characters, +# e.g., # to @0023. +# Many operating systems (such as Linux) or file systems +# limit the path component length to 255 bytes, such as 51*5 characters. +# The bug was repeated with a shorter length, which we will use here, +# to avoid exceeding MAX_PATH on Microsoft Windows. +let $db=##########################; +--replace_result $db db +eval CREATE DATABASE `$db`; +--replace_result $db db +eval CREATE TABLE `$db`.u ( + a INT PRIMARY KEY, + CONSTRAINT `††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††` + FOREIGN KEY (a) REFERENCES test.t (a)) ENGINE=InnoDB; +--replace_result $db db +eval DROP TABLE `$db`.u; +--replace_result $db db +eval DROP DATABASE `$db`; +DROP TABLE t; + +--echo # End of 10.3 tests + # MDEV-21792 Server aborts upon attempt to create foreign key on spatial field # Fail to create foreign key for spatial fields --error ER_CANT_CREATE_TABLE @@ -884,6 +970,8 @@ DROP TABLE t1; --echo # TODO: enable them after MDEV-16417 is finished create or replace table t1 (a int primary key) engine=innodb; --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create or replace table t2 (a int, constraint foo check(a > 0), foreign key(a) references t1(a) on update cascade) engine=innodb; +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t2 (a int, check(a > 0), foreign key(a) references t1(a) on update cascade) engine=innodb; create or replace table t1 (f1 int, f2 date, f3 date, key(f1,f3,f2)) engine=innodb; @@ -942,7 +1030,9 @@ ALTER TABLE parent FORCE, ALGORITHM=COPY; ALTER TABLE parent FORCE, ALGORITHM=INPLACE; --error ER_LOCK_WAIT_TIMEOUT ALTER TABLE parent ADD COLUMN b INT, ALGORITHM=INSTANT; -disconnect con1; +connection con1; +COMMIT; +connection default; # Restore the timeout to avoid occasional races with purge. SET innodb_lock_wait_timeout=DEFAULT; TRUNCATE TABLE parent; @@ -951,6 +1041,37 @@ ALTER TABLE parent FORCE, ALGORITHM=INPLACE; ALTER TABLE parent ADD COLUMN b INT, ALGORITHM=INSTANT; DROP TABLE child, parent; +--echo # +--echo # MDEV-26217 Failing assertion: list.count > 0 in ut_list_remove +--echo # or Assertion `lock->trx == this' failed in dberr_t trx_t::drop_table +--echo # + +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); + +CREATE TABLE t2 (pk INT PRIMARY KEY, FOREIGN KEY(pk) REFERENCES t1(pk)) +ENGINE=InnoDB; + +--connection con1 +SET FOREIGN_KEY_CHECKS=OFF; +--send +CREATE OR REPLACE TABLE t1 (b INT) ENGINE=InnoDB; + +--connection default +--error 0,ER_NO_REFERENCED_ROW_2,ER_LOCK_DEADLOCK +INSERT INTO t2 VALUES (1); + +--connection con1 +--error 0,ER_CANT_CREATE_TABLE +--reap + +# Cleanup +--disconnect con1 +--connection default +--disable_warnings +DROP TABLE IF EXISTS t2, t1; +--enable_warnings + --echo # End of 10.6 tests --source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/foreign_key_not_windows.test b/mysql-test/suite/innodb/t/foreign_key_not_windows.test new file mode 100644 index 0000000000000..e5f42a0ddab03 --- /dev/null +++ b/mysql-test/suite/innodb/t/foreign_key_not_windows.test @@ -0,0 +1,77 @@ +--source include/have_innodb.inc +# On Microsoft Windows, there is an additional limit of MAX_PATH +--source include/not_windows.inc +# The embedded server prepends --datadir or --innodb-data-home-dir +# to the path names, which reduces the maximum length of names further. +--source include/not_embedded.inc + +--echo # +--echo # MDEV-28980 InnoDB: Failing assertion: len <= MAX_TABLE_NAME_LEN +--echo # + +# The main test is innodb.foreign_key. This is an additional test that +# the maximum length cannot be exceeded for implicitly created +# constraint names. On Microsoft Windows, MAX_PATH is a much stricter +# limit than the 255-byte maximum path component length on many other systems, +# including Linux and IBM AIX. + +CREATE TABLE t (a INT PRIMARY KEY) ENGINE=InnoDB; + +# The maximum identifier length is 64 characters. +# my_charset_filename will expand some characters to 5 characters, +# e.g., # to @0023. +# Many operating systems (such as Linux) or file systems +# limit the path component length to 255 bytes, +# corresponding to the 51 characters below: 5*51=255. +let $d255=###################################################; +let $d250=##################################################; +--replace_result $d255 d255 +eval CREATE DATABASE `$d255`; +--replace_result $d255 d255 +--error ER_IDENT_CAUSES_TOO_LONG_PATH +eval CREATE TABLE `$d255`.`$d255` +(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB; +--replace_result $d255 d255 +--error ER_IDENT_CAUSES_TOO_LONG_PATH +eval CREATE TABLE `$d255`.`_$d250` +(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB; +--replace_result $d255 d255 +eval CREATE TABLE `$d255`.`$d250` +(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB; + +--echo # +--echo # MDEV-29258 Failing assertion for name length on RENAME TABLE +--echo # + +let $d245=-------------------------------------------------; +--replace_result $d245 d245 $d255 d255 +eval CREATE TABLE `$d255`.`$d245` (x INT) ENGINE=InnoDB; +--replace_result $d250 d250 $d255 d255 +eval DROP TABLE `$d255`.`$d250`; + +--replace_result $d245 d245 $d250 d250 d255 d255 +eval RENAME TABLE `$d255`.`$d245` TO `$d255`.`$d250`; +--replace_result $d250 d250 $d255 d255 +eval RENAME TABLE `$d255`.`$d250` TO a; +--replace_result $d255 d255 +DROP TABLE a,t; + +--echo # +--echo # MDEV-29409 Buffer overflow in my_wc_mb_filename() on RENAME TABLE +--echo # + +let $d225=#############################################; +let $d320=################################################################; + +--replace_result $d255 d255 +eval CREATE TABLE `$d255`.t(a INT PRIMARY KEY)ENGINE=InnoDB; +--replace_result $d255 d255 $d320 d320 +eval CREATE TABLE `$d255`.u(a INT PRIMARY KEY, +CONSTRAINT `$d320` FOREIGN KEY (a) REFERENCES `$d255`.t (a)) ENGINE=InnoDB; +--replace_result $d255 d255 +eval RENAME TABLE `$d255`.u TO u; +DROP TABLE u; +--replace_result $d255 d255 +eval DROP DATABASE `$d255`; + +--echo # End of 10.3 tests diff --git a/mysql-test/suite/innodb/t/full_crc32_import.test b/mysql-test/suite/innodb/t/full_crc32_import.test index c50e3899fc819..b79fd95471be8 100644 --- a/mysql-test/suite/innodb/t/full_crc32_import.test +++ b/mysql-test/suite/innodb/t/full_crc32_import.test @@ -199,6 +199,16 @@ SET GLOBAL innodb_compression_algorithm=0; ALTER TABLE t1 FORCE; ALTER TABLE t1 DISCARD TABLESPACE; +--echo # Display the discarded table name by using SPACE and PAGE_NO +--echo # column in INNODB_SYS_INDEXES and discard doesn't affect the +--echo # SPACE in INNODB_SYS_TABLES +SELECT t.NAME, t.SPACE BETWEEN 1 and 0xFFFFFFEF as SYS_TABLE_SPACE_RANGE +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t +WHERE t.TABLE_ID IN ( + SELECT i.TABLE_ID FROM + INFORMATION_SCHEMA.INNODB_SYS_INDEXES i WHERE + i.PAGE_NO IS NULL and i.SPACE IS NULL); + --list_files $MYSQLD_DATADIR/test perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; diff --git a/mysql-test/suite/innodb/t/gap_lock_split.test b/mysql-test/suite/innodb/t/gap_lock_split.test new file mode 100644 index 0000000000000..8211a612d3537 --- /dev/null +++ b/mysql-test/suite/innodb/t/gap_lock_split.test @@ -0,0 +1,40 @@ +--source include/have_innodb.inc +--source include/have_sequence.inc +--source include/have_debug.inc + +SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; + +CREATE TABLE t1(id INT PRIMARY key, val VARCHAR(16000)) ENGINE=InnoDB; +INSERT INTO t1 (id,val) SELECT 2*seq,'x' FROM seq_0_to_1023; + +connect(con1,localhost,root,,); +source include/wait_all_purged.inc; +# Prevent purge. +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; + +DELETE FROM t1 WHERE id=1788; + +BEGIN; +# This will return no result, but should acquire a gap lock. +SELECT * FROM t1 WHERE id=1788 FOR UPDATE; + +connection con1; +COMMIT; +source include/wait_all_purged.inc; +connection default; + +INSERT INTO t1 (id,val) VALUES (1787, REPEAT('x',2000)); + +connection con1; +SET innodb_lock_wait_timeout=0; +--error ER_LOCK_WAIT_TIMEOUT +INSERT INTO t1 (id,val) VALUES (1788, 'x'); +SELECT * FROM t1 WHERE id=1788 FOR UPDATE; +disconnect con1; + +connection default; +COMMIT; +DROP TABLE t1; +SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; diff --git a/mysql-test/suite/innodb/t/ibuf_delete.test b/mysql-test/suite/innodb/t/ibuf_delete.test new file mode 100644 index 0000000000000..82b740b6aa1cf --- /dev/null +++ b/mysql-test/suite/innodb/t/ibuf_delete.test @@ -0,0 +1,67 @@ +--source include/have_innodb.inc +--source include/have_sequence.inc + +SET @buffering= @@innodb_change_buffering; +SET GLOBAL innodb_change_buffering= deletes; +SET @flush= @@innodb_flush_log_at_trx_commit; +SET GLOBAL innodb_flush_log_at_trx_commit= 0; + +CREATE TABLE t1 ( + a varchar(1024), + b varchar(1024), + c varchar(1024), + d varchar(1024), + e varchar(1024), + f varchar(1024), + g varchar(1024), + h varchar(1024), + key (a), + key (b), + key (c), + key (d) +) ENGINE=InnoDB; + +INSERT INTO t1 +SELECT REPEAT('x',10), REPEAT('x',13), REPEAT('x',427), REPEAT('x',244), +REPEAT('x',9), REPEAT('x',112), REPEAT('x',814), REPEAT('x',633) +FROM seq_1_to_1024; + +CREATE TEMPORARY TABLE t2 ( + a varchar(1024), + b varchar(1024), + c varchar(1024), + d varchar(1024), + e varchar(1024), + f varchar(1024), + g varchar(1024), + h varchar(1024), + i varchar(1024), + j varchar(1024), + k varchar(1024), + l varchar(1024), + m varchar(1024), + key (a), + key (b), + key (c), + key (d), + key (e), + key (f) +) ENGINE=InnoDB; + +SET @x=REPEAT('x',512); +INSERT INTO t2 SELECT @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x +FROM seq_1_to_768; + +--disable_query_log +--let $run=1024 +while ($run) +{ + eval DELETE FROM t1 LIMIT 1 /* $run */; + --dec $run +} +--enable_query_log + +# Cleanup +DROP TABLE t1, t2; +SET GLOBAL innodb_change_buffering= @buffering; +SET GLOBAL innodb_flush_log_at_trx_commit= @flush; diff --git a/mysql-test/suite/innodb/t/ibuf_not_empty.test b/mysql-test/suite/innodb/t/ibuf_not_empty.test index 545a78c887e7f..9362f8daffa63 100644 --- a/mysql-test/suite/innodb/t/ibuf_not_empty.test +++ b/mysql-test/suite/innodb/t/ibuf_not_empty.test @@ -1,4 +1,5 @@ --source include/have_innodb.inc +--source include/no_valgrind_without_big.inc # innodb_change_buffering_debug option is debug only --source include/have_debug.inc # Embedded server tests do not support restarting @@ -10,6 +11,8 @@ call mtr.add_suppression("InnoDB: Failed to find tablespace for table `test`\\.` call mtr.add_suppression("InnoDB: Allocated tablespace ID \\d+ for test.t1, old maximum was"); call mtr.add_suppression("InnoDB: Failed to find tablespace for table `mysql`\\.`transaction_registry` in the cache\\. Attempting to load the tablespace with space id"); call mtr.add_suppression("InnoDB: Allocated tablespace ID \\d+ for mysql.transaction_registry, old maximum was"); +call mtr.add_suppression("InnoDB: Trying to read 4096 bytes"); +call mtr.add_suppression("InnoDB: File './test/t1.ibd' is corrupted"); --enable_query_log CREATE TABLE t1( @@ -24,6 +27,7 @@ ENGINE=InnoDB STATS_PERSISTENT=0; # change buffering is possible, so that the change buffer will be used # whenever possible. SET GLOBAL innodb_change_buffering_debug = 1; +SET GLOBAL innodb_change_buffering=all; # Create enough rows for the table, so that the change buffer will be # used for modifying the secondary index page. There must be multiple @@ -104,7 +108,7 @@ truncate(FILE, $ps * $pages); close(FILE) || die "Unable to close $file"; EOF ---let $restart_parameters= +--let $restart_parameters=--innodb-force_recovery=0 --source include/start_mysqld.inc SET GLOBAL innodb_fast_shutdown=0; --source include/restart_mysqld.inc diff --git a/mysql-test/suite/innodb/t/import_bugs.test b/mysql-test/suite/innodb/t/import_bugs.test index 9898d11fc806c..7fcab9f9abc47 100644 --- a/mysql-test/suite/innodb/t/import_bugs.test +++ b/mysql-test/suite/innodb/t/import_bugs.test @@ -14,16 +14,22 @@ let $datadir=`select @@datadir`; UNLOCK TABLES; --error ER_TABLE_SCHEMA_MISMATCH ALTER TABLE imp_t1 IMPORT TABLESPACE; +--error ER_TABLE_EXISTS_ERROR +CREATE TABLE imp_t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +DROP TABLE imp_t1; +CREATE TABLE imp_t1 (a INT PRIMARY KEY) ENGINE=InnoDB; DROP TABLE imp_t1, t1; ---remove_file $datadir/test/imp_t1.ibd SET GLOBAL innodb_checksum_algorithm=@save_innodb_checksum_algorithm; --echo # ---echo # MDEV-27006 Assertion `!lock_trx_has_sys_table_locks(trx)' --echo # failed in dberr_t row_discard_tablespace_for_mysql +--echo # MDEV-27006 Assertion `!lock_trx_has_sys_table_locks(trx)' +--echo # failed in dberr_t row_discard_tablespace_for_mysql --echo # (dict_table_t*, trx_t*) CREATE TABLE t1 (c INT KEY) ENGINE=INNODB; CREATE TABLE t2 (c INT KEY,FOREIGN KEY(c) REFERENCES t1 (c)) ENGINE=INNODB; --error ER_ROW_IS_REFERENCED_2 ALTER TABLE t1 DISCARD TABLESPACE; DROP TABLE t2, t1; + +--echo # End of 10.6 tests diff --git a/mysql-test/suite/innodb/t/import_corrupted.test b/mysql-test/suite/innodb/t/import_corrupted.test index 016b71041f10a..bc2ee341fe278 100644 --- a/mysql-test/suite/innodb/t/import_corrupted.test +++ b/mysql-test/suite/innodb/t/import_corrupted.test @@ -1,8 +1,10 @@ --source include/have_innodb.inc +--source include/no_valgrind_without_big.inc call mtr.add_suppression("Table `test`.`t2` should have 2 indexes but the tablespace has 1 indexes"); call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it"); call mtr.add_suppression("Trying to read .* bytes at .* outside the bounds of the file: \\..test.t2\\.ibd"); +call mtr.add_suppression("InnoDB: File '.*test/t2\\.ibd' is corrupted"); let MYSQLD_DATADIR = `SELECT @@datadir`; @@ -56,14 +58,10 @@ CREATE TABLE t2 ( ALTER TABLE t2 DISCARD TABLESPACE; ---copy_file $MYSQLD_DATADIR/test/tmp.ibd $MYSQLD_DATADIR/test/t2.ibd ---copy_file $MYSQLD_DATADIR/test/tmp.cfg $MYSQLD_DATADIR/test/t2.cfg +--move_file $MYSQLD_DATADIR/test/tmp.ibd $MYSQLD_DATADIR/test/t2.ibd +--move_file $MYSQLD_DATADIR/test/tmp.cfg $MYSQLD_DATADIR/test/t2.cfg --error ER_NOT_KEYFILE ALTER TABLE t2 IMPORT TABLESPACE; DROP TABLE t2; - ---remove_file $MYSQLD_DATADIR/test/t2.ibd ---remove_file $MYSQLD_DATADIR/test/tmp.ibd ---remove_file $MYSQLD_DATADIR/test/tmp.cfg diff --git a/mysql-test/suite/innodb/t/import_tablespace_race.test b/mysql-test/suite/innodb/t/import_tablespace_race.test new file mode 100644 index 0000000000000..aca0b5df06d03 --- /dev/null +++ b/mysql-test/suite/innodb/t/import_tablespace_race.test @@ -0,0 +1,55 @@ +--source include/have_innodb.inc +--source include/have_sequence.inc + +--echo # +--echo # MDEV-29144 ER_TABLE_SCHEMA_MISMATCH or crash on DISCARD/IMPORT +--echo # + +call mtr.add_suppression("InnoDB: Unknown index id"); +CREATE TABLE t (pk int PRIMARY KEY, c varchar(1024)) +ENGINE=InnoDB CHARSET latin1; +INSERT INTO t SELECT seq, 'x' FROM seq_1_to_100; + +--connect (con1,localhost,root,,test) +--delimiter $ +--send + BEGIN NOT ATOMIC + DECLARE a INT DEFAULT 0; + REPEAT + SET a= a+1; + UPDATE t SET c = 'xx' WHERE pk = a; + UNTIL a = 100 + END REPEAT; + END +$ +--delimiter ; + +--connection default +--error 0,ER_LOCK_WAIT_TIMEOUT +ALTER TABLE t NOWAIT ADD INDEX (c); + +--connection con1 +--reap + +--connection default + +--let $datadir= `select @@datadir` + +FLUSH TABLE t FOR EXPORT; +--let $create= query_get_value(SHOW CREATE TABLE t, Create Table, 1) +--copy_file $datadir/test/t.cfg $datadir/test/t.cfg.sav +--copy_file $datadir/test/t.ibd $datadir/test/t.ibd.sav +UNLOCK TABLES; + +DROP TABLE t; +--disable_query_log +eval $create; +--enable_query_log + +ALTER TABLE t DISCARD TABLESPACE; +--move_file $datadir/test/t.cfg.sav $datadir/test/t.cfg +--move_file $datadir/test/t.ibd.sav $datadir/test/t.ibd +ALTER TABLE t IMPORT TABLESPACE; + +# Cleanup +DROP TABLE t; diff --git a/mysql-test/suite/innodb/t/information_schema_grants.test b/mysql-test/suite/innodb/t/information_schema_grants.test index 8960db9aad9e7..d0b2d2db962f8 100644 --- a/mysql-test/suite/innodb/t/information_schema_grants.test +++ b/mysql-test/suite/innodb/t/information_schema_grants.test @@ -270,6 +270,8 @@ select count(*) > -1 from i_trx; select count(*) > -1 from d_trx; connection default; +# Starting with MariaDB 10.6, ensure that DDL recovery will have completed. +SET GLOBAL innodb_max_purge_lag_wait=0; drop database test; create database test; drop user select_only@localhost; diff --git a/mysql-test/suite/innodb/t/innodb-16k.test b/mysql-test/suite/innodb/t/innodb-16k.test index c059f62385b21..56109543ee4d8 100644 --- a/mysql-test/suite/innodb/t/innodb-16k.test +++ b/mysql-test/suite/innodb/t/innodb-16k.test @@ -4,9 +4,6 @@ --source include/have_innodb_16k.inc call mtr.add_suppression("InnoDB: Cannot add field .* in table"); -SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; -SET GLOBAL innodb_purge_rseg_truncate_frequency=1; - let $MYSQLD_DATADIR= `select @@datadir`; --echo # Test 1) Show the page size from Information Schema @@ -14,15 +11,17 @@ SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size'; --echo # Test 4) The maximum row size is dependent upon the page size. ---echo # Redundant: 8123, Compact: 8126. ---echo # Compressed: 8126, Dynamic: 8126. +--echo # Redundant: 8123, Compact: 8126, Dynamic: 8126. --echo # Each row format has its own amount of overhead that --echo # varies depending on number of fields and other overhead. SET SESSION innodb_strict_mode = ON; +SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET @save_level=@@GLOBAL.innodb_compression_level; +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; +SET GLOBAL innodb_compression_level=1; - -# Compressed table; 7959 bytes with 40 CHAR fields +# Compressed table: compressBound() for the s390x DFLTCC instruction CREATE TABLE t1 ( c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200), c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200), @@ -31,7 +30,7 @@ c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200), c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200), c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200), c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200), -c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(157) +c36 char(200), c37 char(200), c38 char(196) ) ROW_FORMAT=compressed; DROP TABLE t1; @@ -450,16 +449,18 @@ drop table t1; CREATE TABLE t1(c text, PRIMARY KEY (c(440))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; -CREATE TABLE t1(c text, PRIMARY KEY (c(438))) +CREATE TABLE t1(c text, PRIMARY KEY (c(292))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512)); +DROP TABLE t1; + --source include/wait_all_purged.inc -DROP TABLE t1; +SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency; +SET GLOBAL innodb_compression_level=@save_level; + DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge; DROP TABLE tlong; DROP TABLE tlong2; - -SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; \ No newline at end of file diff --git a/mysql-test/suite/innodb/t/innodb-64k.test b/mysql-test/suite/innodb/t/innodb-64k.test index 62d7b929ba16b..972ba6bb8b82d 100644 --- a/mysql-test/suite/innodb/t/innodb-64k.test +++ b/mysql-test/suite/innodb/t/innodb-64k.test @@ -641,9 +641,12 @@ drop table t2; DROP TABLE t1; --echo # ---echo # MDEV-19526 heap number overflow +--echo # MDEV-19526/MDEV-29742 heap number overflow --echo # CREATE TABLE t1(a SMALLINT NOT NULL UNIQUE AUTO_INCREMENT, KEY(a)) ENGINE=InnoDB; INSERT INTO t1 (a) SELECT seq FROM seq_1_to_8191; +ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; DROP TABLE t1; + +--echo # End of 10.3 tests diff --git a/mysql-test/suite/innodb/t/innodb-alter-debug.test b/mysql-test/suite/innodb/t/innodb-alter-debug.test index 1789ec294e48b..c4a68ac71b7b6 100644 --- a/mysql-test/suite/innodb/t/innodb-alter-debug.test +++ b/mysql-test/suite/innodb/t/innodb-alter-debug.test @@ -52,11 +52,10 @@ SET DEBUG_SYNC = 'now SIGNAL s2'; --echo /* connection default */ connection default; --echo /* reap */ alter table t1 force, add b int, ALGORITHM=inplace; ---error ER_DUP_ENTRY --reap SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2'; ---send alter table t1 force, add b int, ALGORITHM=inplace; +--send alter table t1 force, add c int, ALGORITHM=inplace; --echo /* connection con1 */ connection con1; @@ -68,7 +67,6 @@ SET DEBUG_SYNC = 'now SIGNAL s2'; --echo /* connection default */ connection default; --echo /* reap */ alter table t1 force, add b int, ALGORITHM=inplace; ---error ER_DUP_ENTRY --reap SET DEBUG_SYNC = 'RESET'; @@ -92,7 +90,6 @@ SET DEBUG_SYNC = 'now SIGNAL S2'; disconnect con1; CONNECTION default; ---error ER_DUP_ENTRY reap; SET DEBUG_SYNC='RESET'; @@ -183,7 +180,7 @@ DROP TABLE t1; CREATE TABLE t1(a INT PRIMARY KEY, b INT, INDEX(b)) ENGINE=InnoDB; SET @save_dbug=@@debug_dbug; -SET debug_dbug='+d,innodb_table_deadlock'; +SET debug_dbug='+d,deadlock_table_fail'; --error ER_LOCK_DEADLOCK ALTER TABLE t1 DROP INDEX b, ALGORITHM=INPLACE; SET debug_dbug=@save_dbug; diff --git a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test index ab6e15868977e..0ae116f58f006 100644 --- a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test +++ b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test @@ -29,8 +29,8 @@ call mtr.add_suppression("InnoDB could not find key no 1 with name f2 from dict let datadir= `select @@datadir`; ---let $_server_id= `SELECT @@server_id` ---let $_expect_file_name=$MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb; SET debug_dbug='+d,innodb_alter_commit_crash_before_commit'; diff --git a/mysql-test/suite/innodb/t/innodb-autoinc-part.test b/mysql-test/suite/innodb/t/innodb-autoinc-part.test new file mode 100644 index 0000000000000..100546704ceec --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-autoinc-part.test @@ -0,0 +1,24 @@ +--source include/have_partition.inc +--source include/have_innodb.inc + +--echo # +--echo # MDEV-28416 Incorrect AUTO_INCREMENT may be issued +--echo # + +SET @aii=@@auto_increment_increment; +SET auto_increment_increment=300; + +CREATE TABLE t1 (a SERIAL) ENGINE=innodb +PARTITION BY RANGE (a) ( + PARTITION p0 VALUES LESS THAN (6), + PARTITION p1 VALUES LESS THAN MAXVALUE +); +INSERT INTO t1 VALUES (18446744073709551613); +SHOW CREATE TABLE t1; +--error HA_ERR_AUTOINC_ERANGE +INSERT INTO t1 VALUES (NULL); +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET auto_increment_increment=@aii; + +--echo # End of 10.2 tests diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test index ca7727d4cefc7..158460558d557 100644 --- a/mysql-test/suite/innodb/t/innodb-autoinc.test +++ b/mysql-test/suite/innodb/t/innodb-autoinc.test @@ -1,10 +1,4 @@ --source include/have_innodb.inc -# embedded server ignores 'delayed', so skip this --- source include/not_embedded.inc - ---disable_warnings -drop table if exists t1; ---enable_warnings # # Bug #34335 @@ -770,3 +764,20 @@ DROP TABLE t1; SET @engine='INNODB'; --source include/autoinc_mdev15353.inc + +--echo # +--echo # MDEV-28416 Incorrect AUTO_INCREMENT may be issued +--echo # + +SET @aii=@@auto_increment_increment; +SET auto_increment_increment=300; +CREATE TABLE t1 (a SERIAL) ENGINE=innodb; +INSERT INTO t1 VALUES (18446744073709551613); +SHOW CREATE TABLE t1; +--error HA_ERR_AUTOINC_ERANGE +INSERT INTO t1 VALUES (NULL); +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET auto_increment_increment=@aii; + +--echo # End of 10.2 tests diff --git a/mysql-test/suite/innodb/t/innodb-change-buffer-recovery-master.opt b/mysql-test/suite/innodb/t/innodb-change-buffer-recovery-master.opt deleted file mode 100644 index e5d7090c88353..0000000000000 --- a/mysql-test/suite/innodb/t/innodb-change-buffer-recovery-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb_buffer_pool_size=24M diff --git a/mysql-test/suite/innodb/t/innodb-change-buffer-recovery.test b/mysql-test/suite/innodb/t/innodb-change-buffer-recovery.test deleted file mode 100644 index a12ca43cec118..0000000000000 --- a/mysql-test/suite/innodb/t/innodb-change-buffer-recovery.test +++ /dev/null @@ -1,81 +0,0 @@ ---echo # ---echo # Bug#69122 - INNODB DOESN'T REDO-LOG INSERT BUFFER MERGE ---echo # OPERATION IF IT IS DONE IN-PLACE ---echo # ---source include/have_innodb.inc -# innodb_change_buffering_debug option is debug only ---source include/have_debug.inc -# Embedded server does not support crashing ---source include/not_embedded.inc -# DBUG_SUICIDE() hangs under valgrind ---source include/not_valgrind.inc -# This test is slow on buildbot. ---source include/big_test.inc ---source include/have_sequence.inc - -call mtr.add_suppression("InnoDB: innodb_read_only prevents crash recovery"); -call mtr.add_suppression("Plugin initialization aborted at srv0start\\.cc"); -call mtr.add_suppression("Plugin 'InnoDB'"); -FLUSH TABLES; - -CREATE TABLE t1( - a INT AUTO_INCREMENT PRIMARY KEY, - b CHAR(1), - c INT, - INDEX(b)) -ENGINE=InnoDB STATS_PERSISTENT=0; - ---let $_server_id= `SELECT @@server_id` ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect - -# The flag innodb_change_buffering_debug is only available in debug builds. -# It instructs InnoDB to try to evict pages from the buffer pool when -# change buffering is possible, so that the change buffer will be used -# whenever possible. -SET GLOBAL innodb_change_buffering_debug = 1; -let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err; - -# Create enough rows for the table, so that the change buffer will be -# used for modifying the secondary index page. There must be multiple -# index pages, because changes to the root page are never buffered. -INSERT INTO t1 SELECT 0,'x',1 FROM seq_1_to_8192; - -BEGIN; -SELECT b FROM t1 LIMIT 3; - -connect (con1,localhost,root,,); -BEGIN; -DELETE FROM t1 WHERE a=1; -# This should be buffered, if innodb_change_buffering_debug = 1 is in effect. -INSERT INTO t1 VALUES(1,'X',1); - -SET DEBUG_DBUG='+d,crash_after_log_ibuf_upd_inplace'; ---exec echo "wait" > $_expect_file_name ---error 2013 -# This should force a change buffer merge -SELECT b FROM t1 LIMIT 3; -disconnect con1; -connection default; -let SEARCH_PATTERN=Wrote log record for ibuf update in place operation; ---source include/search_pattern_in_file.inc - ---let $restart_parameters= --innodb-read-only ---source include/start_mysqld.inc -CHECK TABLE t1; ---source include/shutdown_mysqld.inc -let SEARCH_PATTERN=innodb_read_only prevents crash recovery; ---source include/search_pattern_in_file.inc - ---let $restart_parameters= --innodb-force-recovery=5 ---source include/start_mysqld.inc -SELECT * FROM t1 LIMIT 1; -replace_regex /.*operations:.* (insert.*), delete \d.*discarded .*/\1/; -SHOW ENGINE INNODB STATUS; -# Slow shutdown will not merge the changes due to innodb_force_recovery=5. -SET GLOBAL innodb_fast_shutdown=0; ---let $restart_parameters= ---source include/restart_mysqld.inc -CHECK TABLE t1; -replace_regex /.*operations:.* insert [1-9][0-9]*, delete mark [1-9][0-9]*, delete \d.*discarded .*//; -SHOW ENGINE INNODB STATUS; -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb-fkcheck.test b/mysql-test/suite/innodb/t/innodb-fkcheck.test index 4657edc4d651e..5ff3533fce1ce 100644 --- a/mysql-test/suite/innodb/t/innodb-fkcheck.test +++ b/mysql-test/suite/innodb/t/innodb-fkcheck.test @@ -46,7 +46,15 @@ show create table c; # # Note that column b has different type in parent table # ---error 1005 +CREATE TABLE b ( + b bigint unsigned NOT NULL, + d1 date NOT NULL, + PRIMARY KEY (b,d1) +) ENGINE=InnoDB; +DROP TABLE b; + +set foreign_key_checks = 1; +--error ER_CANT_CREATE_TABLE CREATE TABLE b ( b bigint unsigned NOT NULL, d1 date NOT NULL, @@ -54,6 +62,7 @@ CREATE TABLE b ( ) ENGINE=InnoDB; show warnings; +set foreign_key_checks = 0; DROP TABLE IF EXISTS d; @@ -64,7 +73,7 @@ CREATE TABLE d ( CONSTRAINT bd_fk FOREIGN KEY (b) REFERENCES b (b) ) ENGINE=InnoDB; -show warnings; +show warnings; set foreign_key_checks = 1; diff --git a/mysql-test/suite/innodb/t/innodb-get-fk.test b/mysql-test/suite/innodb/t/innodb-get-fk.test index 47db92a0c6d25..b4b170b89f93f 100644 --- a/mysql-test/suite/innodb/t/innodb-get-fk.test +++ b/mysql-test/suite/innodb/t/innodb-get-fk.test @@ -2,6 +2,8 @@ --source include/default_charset.inc # need to restart server --source include/not_embedded.inc +--source include/no_valgrind_without_big.inc + CREATE SCHEMA `repro`; CREATE TABLE `repro`.`crew` ( diff --git a/mysql-test/suite/innodb/t/innodb-index-debug.test b/mysql-test/suite/innodb/t/innodb-index-debug.test index 204bdfe5540cf..f03ef061769d8 100644 --- a/mysql-test/suite/innodb/t/innodb-index-debug.test +++ b/mysql-test/suite/innodb/t/innodb-index-debug.test @@ -122,17 +122,16 @@ drop table t480; --echo # in online table rebuild --echo # -CREATE TABLE t1 (j INT UNIQUE, i INT UNIQUE) ENGINE=InnoDB; +CREATE TABLE t1 (j INT UNIQUE, i INT) ENGINE=InnoDB; INSERT INTO t1 VALUES(2, 2); --connect (con1,localhost,root,,test) SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built WAIT_FOR log'; --send -ALTER TABLE t1 DROP j, FORCE; +ALTER TABLE t1 DROP j, ADD UNIQUE INDEX(i), FORCE; --connection default SET DEBUG_SYNC='now WAIT_FOR built'; SET DEBUG_DBUG='+d,row_ins_row_level'; ---error ER_DUP_ENTRY INSERT INTO t1 (i) VALUES (0),(0); SET DEBUG_SYNC='now SIGNAL log'; SET DEBUG_DBUG=@saved_debug_dbug; @@ -140,6 +139,8 @@ SET DEBUG_DBUG=@saved_debug_dbug; --connection con1 --error ER_DUP_ENTRY reap; +DELETE FROM t1; +ALTER TABLE t1 ADD UNIQUE INDEX(i); SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built2 WAIT_FOR log2'; --send ALTER TABLE t1 DROP j, FORCE; @@ -152,7 +153,6 @@ UPDATE t1 SET i=0; SET DEBUG_SYNC='now SIGNAL log2'; --connection con1 ---error ER_DUP_ENTRY reap; --disconnect con1 --connection default diff --git a/mysql-test/suite/innodb/t/innodb-index-online.test b/mysql-test/suite/innodb/t/innodb-index-online.test index 6f30dad531da4..ab4f5a965daf8 100644 --- a/mysql-test/suite/innodb/t/innodb-index-online.test +++ b/mysql-test/suite/innodb/t/innodb-index-online.test @@ -2,6 +2,7 @@ --source include/innodb_encrypt_log.inc --source include/have_debug.inc --source include/have_debug_sync.inc +--source include/no_valgrind_without_big.inc let $innodb_metrics_select= SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; @@ -98,7 +99,8 @@ eval $innodb_metrics_select; # Insert a duplicate entry (4) for the already started UNIQUE INDEX(c2). BEGIN; INSERT INTO t1 VALUES(7,4,2); -ROLLBACK; +COMMIT; +DELETE FROM t1 where c1 = 7; SET DEBUG_SYNC = 'now SIGNAL rollback_done'; connection con1; @@ -121,7 +123,7 @@ INSERT INTO t1 VALUES(6,3,1); SET DEBUG_SYNC = 'now SIGNAL dml_done'; connection con1; # This is due to the duplicate entry (6,3,1). ---error ER_DUP_UNKNOWN_IN_INDEX +--error ER_DUP_ENTRY reap; DELETE FROM t1 WHERE c1=6; ALTER TABLE t1 ADD UNIQUE INDEX(c2); @@ -237,17 +239,11 @@ SET DEBUG_SYNC = 'now WAIT_FOR c2e_created'; # At this point, the clustered index scan must have completed, # but the modification log keeps accumulating due to the DEBUG_SYNC. eval $innodb_metrics_select; -let $c= 4; +let $c= 8; while ($c) { - BEGIN; - DELETE FROM t1; - ROLLBACK; UPDATE t1 SET c2 = c2 + 1; - BEGIN; - UPDATE t1 SET c2 = c2 + 1; - DELETE FROM t1; - ROLLBACK; + UPDATE t1 SET c2 = c2 + 2; dec $c; } # Incomplete index c2e should exist until the DDL thread notices the overflow. @@ -317,25 +313,22 @@ connection con1; # Accumulate and apply some modification log. SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2f_created WAIT_FOR dml3_done'; --send -# FIXME: MDEV-13668 -#ALTER TABLE t1 ADD INDEX c2f(c22f), CHANGE c2 c22f INT; -ALTER TABLE t1 ADD INDEX c2f(c2); +ALTER TABLE t1 ADD INDEX c2f(c22f), CHANGE c2 c22f INT; connection default; SET DEBUG_SYNC = 'now WAIT_FOR c2f_created'; # Generate some log (delete-mark, delete-unmark, insert etc.) eval $innodb_metrics_select; -let $c= 2; +let $c= 6; while ($c) { BEGIN; INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160; DELETE FROM t1 WHERE c1 > 320; -ROLLBACK; +COMMIT; BEGIN; UPDATE t1 SET c2 = c2 + 1; -DELETE FROM t1; -ROLLBACK; +COMMIT; dec $c; } eval $innodb_metrics_select; @@ -344,8 +337,6 @@ SET DEBUG_SYNC = 'now SIGNAL dml3_done'; connection con1; reap; -# FIXME: MDEV-13668 -ALTER TABLE t1 CHANGE c2 c22f INT; eval $innodb_metrics_select; @@ -481,7 +472,6 @@ send ALTER TABLE t1 ADD UNIQUE(c); connection con1; SET DEBUG_SYNC = 'now WAIT_FOR t1u_created'; -BEGIN; INSERT INTO t1 VALUES('bar'),('bar'); SET DEBUG_SYNC = 'now SIGNAL dup_done'; diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test index c7aa6250da59d..c80e3e6c0660a 100644 --- a/mysql-test/suite/innodb/t/innodb-index.test +++ b/mysql-test/suite/innodb/t/innodb-index.test @@ -1,7 +1,6 @@ -- source include/have_innodb.inc # Embedded server tests do not support restarting. -- source include/not_embedded.inc --- source include/maybe_debug.inc let $MYSQLD_DATADIR= `select @@datadir`; @@ -1126,9 +1125,6 @@ drop table t1; --echo # --source include/no_checkpoint_start.inc -if ($have_debug) { -SET GLOBAL DEBUG_DBUG='+d,fil_names_write_bogus'; -} CREATE TABLE t1(f1 INT PRIMARY KEY)ENGINE=InnoDB; CREATE TABLE t2(f1 INT PRIMARY KEY)ENGINE=InnoDB; @@ -1156,13 +1152,6 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED'); --move_file $MYSQLD_DATADIR/test/t0.ibd $MYSQLD_DATADIR/test/t1.ibd --source include/start_mysqld.inc -if ($have_debug) { -# Initiate shutdown in order to issue a redo log checkpoint and to discard -# the redo log record that was emitted due to '+d,fil_names_write_bogus'. ---let $restart_noprint=2 ---source include/restart_mysqld.inc ---let $restart_noprint=0 -} SELECT * FROM t1; SELECT * FROM t2; @@ -1193,6 +1182,48 @@ SHOW CREATE TABLE t; --disable_prepare_warnings DROP TABLE t; +--echo # +--echo # MDEV-27374 InnoDB table becomes corrupt after renaming DESC-indexed column +--echo # +CREATE TABLE t1 (a VARCHAR(8), PRIMARY KEY(a DESC)) ENGINE=InnoDB; +ALTER TABLE t1 RENAME COLUMN a TO b, ALGORITHM=INPLACE; +SELECT TABLE_ID INTO @table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME="test/t1"; +SELECT INDEX_ID INTO @index_id FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE TABLE_ID = @table_id; +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS WHERE INDEX_ID=@index_id; +DROP TABLE t1; + +--echo # +--echo # MDEV-27432 ASC/DESC primary and unique keys cause index +--echo # inconsistency between InnoDB and server +--echo # +CREATE TABLE t1 (id INT NOT NULL, UNIQUE(id DESC)) ENGINE=InnoDB; +ALTER TABLE t1 ADD PRIMARY KEY (id), ALGORITHM=INPLACE; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-27445 Index inconsistency and assertion failure after +--echo # renaming virtual column with DESC key +--echo # +CREATE TABLE t1(a INT, b INT AS (a), KEY(a, b DESC)) ENGINE=InnoDB; +ALTER TABLE t1 RENAME COLUMN IF EXISTS b TO v; +ALTER TABLE t1 FORCE; +DROP TABLE t1; + +--echo # +--echo # MDEV-27592 DESC primary index fails to set wide format +--echo # while renaming the column +--echo # +CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(8), b INT, KEY(a DESC,b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,'foo',10); +ALTER TABLE t1 RENAME COLUMN b TO c, ALGORITHM=INPLACE; +SELECT TABLE_ID INTO @table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME="test/t1"; +SELECT INDEX_ID INTO @index_id FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE TABLE_ID = @table_id ORDER BY INDEX_ID DESC LIMIT 1; +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS WHERE INDEX_ID=@index_id; +DROP TABLE t1; + +--echo # End of 10.8 tests + --disable_query_log call mtr.add_suppression("InnoDB: Tablespace .* was not found at .*t[12].ibd."); diff --git a/mysql-test/suite/innodb/t/innodb-mdev7046.test b/mysql-test/suite/innodb/t/innodb-mdev7046.test index a8c8b7da2dbcc..cad348b19264b 100644 --- a/mysql-test/suite/innodb/t/innodb-mdev7046.test +++ b/mysql-test/suite/innodb/t/innodb-mdev7046.test @@ -31,6 +31,8 @@ RENAME TABLE t1 TO `t2_new..............................................end`; show warnings; drop table t1; +# Starting with MariaDB 10.6, ensure that DDL recovery will have completed. +SET GLOBAL innodb_max_purge_lag_wait=0; drop database test; create database test; use test; diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_bzip2.test b/mysql-test/suite/innodb/t/innodb-page_compression_bzip2.test deleted file mode 100644 index 391548d3e0c5f..0000000000000 --- a/mysql-test/suite/innodb/t/innodb-page_compression_bzip2.test +++ /dev/null @@ -1,246 +0,0 @@ --- source include/have_innodb.inc --- source include/have_innodb_bzip2.inc --- source include/not_embedded.inc - -# bzip2 -set global innodb_compression_algorithm = 5; - ---disable_query_log -SET GLOBAL innodb_read_only_compressed=OFF; ---enable_query_log - -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -show create table innodb_page_compressed1; -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -show create table innodb_page_compressed2; -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -show create table innodb_page_compressed3; -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -show create table innodb_page_compressed4; -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -show create table innodb_page_compressed5; -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -show create table innodb_page_compressed6; -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -show create table innodb_page_compressed7; -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -show create table innodb_page_compressed8; -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -show create table innodb_page_compressed9; -delimiter //; -create procedure innodb_insert_proc (repeat_count int) -begin - declare current_num int; - set current_num = 0; - while current_num < repeat_count do - insert into innodb_normal values(current_num,'testing..'); - set current_num = current_num + 1; - end while; -end// -delimiter ;// -commit; - -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -alter table innodb_normal page_compressed=1 page_compression_level=8, -algorithm=instant; -show warnings; -show create table innodb_normal; ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=instant; ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=nocopy; -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -show create table innodb_compressed; - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -# zlib -set global innodb_compression_algorithm = 1; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -# none -set global innodb_compression_algorithm = 0; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_default.test b/mysql-test/suite/innodb/t/innodb-page_compression_default.test deleted file mode 100644 index 34b1829485e7e..0000000000000 --- a/mysql-test/suite/innodb/t/innodb-page_compression_default.test +++ /dev/null @@ -1,8 +0,0 @@ ---source include/have_innodb.inc ---source include/not_embedded.inc - -# All page compression test use the same ---source include/innodb-page-compression.inc - --- echo #done - diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_lz4.test b/mysql-test/suite/innodb/t/innodb-page_compression_lz4.test deleted file mode 100644 index a091eb6ac3108..0000000000000 --- a/mysql-test/suite/innodb/t/innodb-page_compression_lz4.test +++ /dev/null @@ -1,248 +0,0 @@ --- source include/have_innodb.inc --- source include/have_innodb_lz4.inc --- source include/not_embedded.inc -# The test can take very long time with valgrind ---source include/not_valgrind.inc - -# lz4 -set global innodb_compression_algorithm = 2; - ---disable_query_log -SET GLOBAL innodb_read_only_compressed=OFF; ---enable_query_log - -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -show create table innodb_page_compressed1; -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -show create table innodb_page_compressed2; -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -show create table innodb_page_compressed3; -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -show create table innodb_page_compressed4; -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -show create table innodb_page_compressed5; -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -show create table innodb_page_compressed6; -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -show create table innodb_page_compressed7; -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -show create table innodb_page_compressed8; -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -show create table innodb_page_compressed9; -delimiter //; -create procedure innodb_insert_proc (repeat_count int) -begin - declare current_num int; - set current_num = 0; - while current_num < repeat_count do - insert into innodb_normal values(current_num,'testing..'); - set current_num = current_num + 1; - end while; -end// -delimiter ;// -commit; - -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -alter table innodb_normal page_compressed=1 page_compression_level=8, -algorithm=instant; -show warnings; -show create table innodb_normal; ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=instant; ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=nocopy; -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -show create table innodb_compressed; - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -# zlib -set global innodb_compression_algorithm = 1; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -# none -set global innodb_compression_algorithm = 0; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_lzma.test b/mysql-test/suite/innodb/t/innodb-page_compression_lzma.test deleted file mode 100644 index 7fbe17d620623..0000000000000 --- a/mysql-test/suite/innodb/t/innodb-page_compression_lzma.test +++ /dev/null @@ -1,246 +0,0 @@ --- source include/have_innodb.inc --- source include/have_innodb_lzma.inc --- source include/not_embedded.inc - -# lzma -set global innodb_compression_algorithm = 4; - ---disable_query_log -SET GLOBAL innodb_read_only_compressed=OFF; ---enable_query_log - -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -show create table innodb_page_compressed1; -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -show create table innodb_page_compressed2; -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -show create table innodb_page_compressed3; -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -show create table innodb_page_compressed4; -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -show create table innodb_page_compressed5; -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -show create table innodb_page_compressed6; -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -show create table innodb_page_compressed7; -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -show create table innodb_page_compressed8; -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -show create table innodb_page_compressed9; -delimiter //; -create procedure innodb_insert_proc (repeat_count int) -begin - declare current_num int; - set current_num = 0; - while current_num < repeat_count do - insert into innodb_normal values(current_num,'testing..'); - set current_num = current_num + 1; - end while; -end// -delimiter ;// -commit; - -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -alter table innodb_normal page_compressed=1 page_compression_level=8, -algorithm=instant; -show warnings; -show create table innodb_normal; ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=instant; ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=nocopy; -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -show create table innodb_compressed; - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -# zlib -set global innodb_compression_algorithm = 1; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -# none -set global innodb_compression_algorithm = 0; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_lzo.test b/mysql-test/suite/innodb/t/innodb-page_compression_lzo.test deleted file mode 100644 index 91e966415b6dc..0000000000000 --- a/mysql-test/suite/innodb/t/innodb-page_compression_lzo.test +++ /dev/null @@ -1,199 +0,0 @@ --- source include/have_innodb.inc --- source include/have_innodb_lzo.inc --- source include/not_embedded.inc - -# lzo -set global innodb_compression_algorithm = 3; - ---disable_query_log -SET GLOBAL innodb_read_only_compressed=OFF; ---enable_query_log - -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -show create table innodb_page_compressed1; -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -show create table innodb_page_compressed2; -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -show create table innodb_page_compressed3; -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -show create table innodb_page_compressed4; -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -show create table innodb_page_compressed5; -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -show create table innodb_page_compressed6; -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -show create table innodb_page_compressed7; -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -show create table innodb_page_compressed8; -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -show create table innodb_page_compressed9; -delimiter //; -create procedure innodb_insert_proc (repeat_count int) -begin - declare current_num int; - set current_num = 0; - while current_num < repeat_count do - insert into innodb_normal values(current_num,'testing..'); - set current_num = current_num + 1; - end while; -end// -delimiter ;// -commit; - -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -alter table innodb_normal page_compressed=1 page_compression_level=8, -algorithm=instant; -show warnings; -show create table innodb_normal; ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=instant; ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=nocopy; -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -show create table innodb_compressed; - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -# zlib -set global innodb_compression_algorithm = 1; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_snappy.test b/mysql-test/suite/innodb/t/innodb-page_compression_snappy.test deleted file mode 100644 index 0186c24ef2e38..0000000000000 --- a/mysql-test/suite/innodb/t/innodb-page_compression_snappy.test +++ /dev/null @@ -1,11 +0,0 @@ --- source include/have_innodb.inc --- source include/have_innodb_snappy.inc ---source include/not_embedded.inc - -# snappy -set global innodb_compression_algorithm = snappy; - -# All page compression test use the same ---source include/innodb-page-compression.inc - --- echo #done diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_tables.test b/mysql-test/suite/innodb/t/innodb-page_compression_tables.test deleted file mode 100644 index 312aa22edba51..0000000000000 --- a/mysql-test/suite/innodb/t/innodb-page_compression_tables.test +++ /dev/null @@ -1,112 +0,0 @@ ---source include/have_innodb.inc ---source include/not_embedded.inc - -let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`; - -# zlib -set global innodb_compression_algorithm = 1; - -create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb; -create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_compressed=1; -create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_compressed=1; ---error 1005 -create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed page_compressed=1; -show warnings; -show create table innodb_compact; -show create table innodb_dynamic; - -# MDEV-7133: InnoDB: Assertion failure in thread 140737091569408 in file dict0mem.cc line 74 -# InnoDB: Failing assertion: dict_tf_is_valid(flags) ---error 1005 -create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant page_compressed=1; -show warnings; -create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant; -show create table innodb_redundant; ---error ER_ILLEGAL_HA_CREATE_OPTION -alter table innodb_redundant page_compressed=1; -show warnings; -show create table innodb_redundant; -alter table innodb_redundant row_format=compact page_compressed=1; -show create table innodb_redundant; -drop table innodb_redundant; - ---echo # ---echo # MDEV-24455 Assertion `!m_freed_space' failed in mtr_t::start ---echo # -CREATE TABLE t1 (a TEXT, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED='ON'; -BEGIN; INSERT INTO t1 VALUES(REPEAT('x',81),REPEAT('x',8034)); ROLLBACK; -DROP TABLE t1; - -delimiter //; -create procedure innodb_insert_proc (repeat_count int) -begin - declare current_num int; - set current_num = 0; - while current_num < repeat_count do - insert into innodb_normal values(current_num, substring(MD5(RAND()), -64)); - set current_num = current_num + 1; - end while; -end// -delimiter ;// -commit; - -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; - -insert into innodb_compact select * from innodb_normal; -insert into innodb_dynamic select * from innodb_normal; - -update innodb_compact set c1 = c1 + 1; -update innodb_dynamic set c1 = c1 + 1; -select count(*) from innodb_compact where c1 < 1500000; -select count(*) from innodb_dynamic where c1 < 1500000; - ---source include/restart_mysqld.inc - -update innodb_compact set c1 = c1 + 1; -update innodb_dynamic set c1 = c1 + 1; -select count(*) from innodb_compact where c1 < 1500000; -select count(*) from innodb_dynamic where c1 < 1500000; - -# none -set global innodb_compression_algorithm = 0; - ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -alter table innodb_compact page_compressed=DEFAULT, algorithm=instant; -alter table innodb_compact page_compressed=DEFAULT; ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -alter table innodb_dynamic page_compressed=DEFAULT, algorithm=instant; -alter table innodb_dynamic page_compressed=DEFAULT; -show create table innodb_compact; -show create table innodb_dynamic; - -update innodb_compact set c1 = c1 + 1; -update innodb_dynamic set c1 = c1 + 1; -select count(*) from innodb_compact where c1 < 1500000; -select count(*) from innodb_dynamic where c1 < 1500000; - -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compact; -drop table innodb_dynamic; - -# MDEV-9820 introducing variable for having page compression turned on by default on InnoDB tables -# test that innodb_compression_default works as expected, i.e. if it has a value of 1 (ON) tables are by default created with page_compressed=1; -CREATE TABLE no_compression (id INT NOT NULL, name VARCHAR(200)) ENGINE=InnoDB; -SET SESSION innodb_compression_default = 1; -CREATE TABLE default_compression (id INT NOT NULL, name VARCHAR(200)) ENGINE=InnoDB; -CREATE TABLE explicit_no_compression (id INT NOT NULL, name VARCHAR(200)) ENGINE=InnoDB PAGE_COMPRESSED=0; -SHOW CREATE TABLE no_compression; -SHOW CREATE TABLE default_compression; -SHOW CREATE TABLE explicit_no_compression; -DROP TABLE no_compression; -DROP TABLE default_compression; -DROP TABLE explicit_no_compression; -SET SESSION innodb_compression_default = 0; - -# reset system ---disable_query_log -EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig; ---enable_query_log diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_zip.test b/mysql-test/suite/innodb/t/innodb-page_compression_zip.test deleted file mode 100644 index c0079a0dab3c2..0000000000000 --- a/mysql-test/suite/innodb/t/innodb-page_compression_zip.test +++ /dev/null @@ -1,198 +0,0 @@ ---source include/have_innodb.inc ---source include/not_embedded.inc -# This test is slow on buildbot. ---source include/big_test.inc - -# zlib -set global innodb_compression_algorithm = 1; - ---disable_query_log -SET GLOBAL innodb_read_only_compressed=OFF; ---enable_query_log - -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -show create table innodb_page_compressed1; -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -show create table innodb_page_compressed2; -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -show create table innodb_page_compressed3; -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -show create table innodb_page_compressed4; -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -show create table innodb_page_compressed5; -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -show create table innodb_page_compressed6; -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -show create table innodb_page_compressed7; -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -show create table innodb_page_compressed8; -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -show create table innodb_page_compressed9; -delimiter //; -create procedure innodb_insert_proc (repeat_count int) -begin - declare current_num int; - set current_num = 0; - while current_num < repeat_count do - insert into innodb_normal values(current_num,'testing..'); - set current_num = current_num + 1; - end while; -end// -delimiter ;// -commit; - -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -alter table innodb_normal page_compressed=1 page_compression_level=8, -algorithm=instant; -show warnings; -show create table innodb_normal; ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=instant; ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=nocopy; -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -show create table innodb_compressed; - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -# none -set global innodb_compression_algorithm = 0; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; diff --git a/mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test b/mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test index d5d04190b8ae1..ba37e82057f9e 100644 --- a/mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test +++ b/mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test @@ -1,5 +1,6 @@ # MDEV-6424: Mariadb server crashes with assertion failure in file ha_innodb.cc --source include/have_innodb.inc +--source include/no_valgrind_without_big.inc # DEBUG_SYNC must be compiled in. --source include/have_debug_sync.inc diff --git a/mysql-test/suite/innodb/t/innodb-stats-sample.test b/mysql-test/suite/innodb/t/innodb-stats-sample.test index 600688ab98dbe..34ca4c7b58ef3 100644 --- a/mysql-test/suite/innodb/t/innodb-stats-sample.test +++ b/mysql-test/suite/innodb/t/innodb-stats-sample.test @@ -1,4 +1,5 @@ --source include/have_innodb.inc +--source include/no_valgrind_without_big.inc # # Test that mysqld does not crash when running ANALYZE TABLE with # different values of the parameter innodb_stats_transient_sample_pages. diff --git a/mysql-test/suite/innodb/t/innodb-system-table-view.test b/mysql-test/suite/innodb/t/innodb-system-table-view.test index 4f5111eafbc50..ea620b398e5cc 100644 --- a/mysql-test/suite/innodb/t/innodb-system-table-view.test +++ b/mysql-test/suite/innodb/t/innodb-system-table-view.test @@ -141,3 +141,9 @@ DROP TABLE child; DROP TABLE parent; SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; + +--echo # +--echo # MDEV-29479 I_S.INNODB_SYS_TABLESPACES doesn't have +--echo # temporary tablespace information +--echo # +SELECT SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE name like 'innodb_temporary'; diff --git a/mysql-test/suite/innodb/t/innodb-table-online.test b/mysql-test/suite/innodb/t/innodb-table-online.test index 86d9cfdb2b4d6..45b1bc1ec8e68 100644 --- a/mysql-test/suite/innodb/t/innodb-table-online.test +++ b/mysql-test/suite/innodb/t/innodb-table-online.test @@ -101,7 +101,6 @@ SET DEBUG_SYNC = 'now WAIT_FOR scanned'; eval $innodb_metrics_select; # Insert a duplicate entry (4) for the already started UNIQUE INDEX(c1). -BEGIN; INSERT INTO t1 VALUES(4,7,2); SET DEBUG_SYNC = 'now SIGNAL insert_done'; @@ -111,7 +110,7 @@ connection con1; # error on the (4,7,2). --error ER_DUP_ENTRY reap; - +DELETE FROM t1 WHERE c1=4 and c2=7; connection default; ROLLBACK; @@ -204,17 +203,11 @@ UPDATE t1 SET c2 = c2 + 1; # At this point, the clustered index scan must have completed, # but the modification log keeps accumulating due to the DEBUG_SYNC. eval $innodb_metrics_select; -let $c= 3; +let $c= 8; while ($c) { - BEGIN; - DELETE FROM t1; - ROLLBACK; - UPDATE t1 SET c2 = c2 + 1; - BEGIN; UPDATE t1 SET c2 = c2 + 1; - DELETE FROM t1; - ROLLBACK; + UPDATE t1 SET c2 = c2 + 2; dec $c; } # Temporary table should exist until the DDL thread notices the overflow. @@ -279,11 +272,8 @@ eval $innodb_metrics_select; BEGIN; INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 240; DELETE FROM t1 WHERE c1 > 320; -ROLLBACK; -BEGIN; UPDATE t1 SET c2 = c2 + 1; -DELETE FROM t1; -ROLLBACK; +COMMIT; eval $innodb_metrics_select; # Release con1. SET DEBUG_SYNC = 'now SIGNAL dml3_done'; @@ -346,16 +336,13 @@ SET DEBUG_SYNC = 'now WAIT_FOR c3p5_created0'; BEGIN; INSERT INTO t1 VALUES(347,33101,'Pikku kakkosen posti','YLETV2'); INSERT INTO t1 VALUES(33101,347,NULL,''); +COMMIT; SET DEBUG_SYNC = 'now SIGNAL ins_done0'; connection con1; ---error WARN_DATA_TRUNCATED +--error ER_INVALID_USE_OF_NULL reap; - -connection default; -ROLLBACK; - -connection con1; +DELETE FROM t1 WHERE c1= 347 and c22f = 33101; ALTER TABLE t1 MODIFY c3 CHAR(255) NOT NULL; SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL c3p5_created WAIT_FOR ins_done'; @@ -409,13 +396,53 @@ SET DEBUG_SYNC = 'now SIGNAL ins'; connection con1; reap; -disconnect con1; connection default; SELECT * FROM t1; DROP TABLE t1; SET DEBUG_SYNC = 'RESET'; +--echo # +--echo # MDEV-29600 Memory leak in row_log_table_apply_update() +--echo # + +CREATE TABLE t1 (pk INT PRIMARY KEY, f TEXT) ENGINE=InnoDB; +INSERT INTO t1 SET pk=1; + +connection con1; +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL created WAIT_FOR updated'; +send ALTER TABLE t1 FORCE; + +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR created'; +UPDATE t1 SET f = REPEAT('a', 20000); +SET DEBUG_SYNC = 'now SIGNAL updated'; + +connection con1; +reap; + +connection default; +DROP TABLE t1; +--echo # +--echo # MDEV-29977 Memory leak in row_log_table_apply_update +--echo # +CREATE TABLE t1(f1 longtext, f2 int, KEY(f1(1024)), KEY(f2, f1(20))) ENGINE=InnoDB; +INSERT INTO t1 VALUES('a', 1); +connection con1; +set DEBUG_SYNC="innodb_inplace_alter_table_enter SIGNAL con_default WAIT_FOR con1_signal"; +send ALTER TABLE t1 FORCE; +connection default; +SET DEBUG_SYNC="now WAIT_FOR con_default"; +UPDATE t1 SET f1 = NULL; +UPDATE t1 SET f1 = REPEAT('b', 9000); +SET DEBUG_SYNC="now SIGNAL con1_signal"; +connection con1; +reap; +DROP TABLE t1; +connection default; +SET DEBUG_SYNC=RESET; +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/suite/innodb/t/innodb-trim.test b/mysql-test/suite/innodb/t/innodb-trim.test index 3f8eb5f2c717e..a077e6acafeba 100644 --- a/mysql-test/suite/innodb/t/innodb-trim.test +++ b/mysql-test/suite/innodb/t/innodb-trim.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_innodb_punchhole.inc +--source include/no_valgrind_without_big.inc --disable_query_log --disable_warnings diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-1.test b/mysql-test/suite/innodb/t/innodb-wl5522-1.test index 0d59df11c4464..dbd58835ec60e 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5522-1.test +++ b/mysql-test/suite/innodb/t/innodb-wl5522-1.test @@ -932,3 +932,34 @@ call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tabl --remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd --remove_file $MYSQLTEST_VARDIR/tmp/t1_fk.cfg --remove_file $MYSQLTEST_VARDIR/tmp/t1_fk.ibd + +--echo # +--echo # MDEV-27882 Innodb - recognise MySQL-8.0 innodb flags and give a specific error message +--echo # +--echo # + +CREATE TABLE `t1` (`i` int(11) NOT NULL, PRIMARY KEY (`i`) ) ENGINE=InnoDB; +FLUSH TABLES t1 FOR EXPORT; + +# We use the cfg file of ours. +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_backup_tablespaces("test", "t1"); +EOF + +UNLOCK TABLES; +ALTER TABLE t1 DISCARD TABLESPACE; + +--move_file $MYSQLTEST_VARDIR/tmp/t1.cfg $MYSQLD_DATADIR/test/t1.cfg +--copy_file std_data/mysql80/t1.ibd $MYSQLD_DATADIR/test/t1.ibd + +call mtr.add_suppression("InnoDB: unsupported MySQL tablespace"); +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t1 IMPORT TABLESPACE; + +DROP TABLE t1; +--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test index e7a39f23e119e..e642a9491fe33 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test +++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test @@ -29,6 +29,8 @@ call mtr.add_suppression("InnoDB: Page for tablespace "); call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS="); call mtr.add_suppression("InnoDB: Unknown index id .* on page"); call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` because the \\.ibd file is missing"); +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*ibdata1' page"); +call mtr.add_suppression("InnoDB: File '.*ibdata1' is corrupted"); FLUSH TABLES; let MYSQLD_DATADIR =`SELECT @@datadir`; @@ -38,8 +40,8 @@ SET GLOBAL innodb_file_per_table = 1; CREATE TABLE t1 (c1 INT) ENGINE = InnoDB; INSERT INTO t1 VALUES(1),(2),(3); ---let $_server_id= `SELECT @@server_id` ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --exec echo wait > $_expect_file_name SET SESSION debug_dbug="+d,ib_discard_before_commit_crash"; @@ -1173,20 +1175,29 @@ ALTER TABLE t1 DISCARD TABLESPACE; SELECT COUNT(*) FROM t1; # Restore files +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; + perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; ib_restore_tablespaces("test", "t1"); +my $page; +my $ps = $ENV{INNODB_PAGE_SIZE}; +my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd"; +open(FILE, "+<$file") || die "Unable to open $file"; +binmode FILE; +sysseek(FILE, 3*$ps, 0) || die "Unable to seek $file\n"; +die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps; +substr($page,24,2)='42'; +sysseek(FILE, 3*$ps, 0) || die "Unable to rewind $file\n"; +syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n"; +close(FILE) || die "Unable to close $file"; EOF -SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure"; - --replace_regex /'.*t1.cfg'/'t1.cfg'/ ---error ER_INTERNAL_ERROR +--error ER_NOT_KEYFILE ALTER TABLE t1 IMPORT TABLESPACE; -SET SESSION debug_dbug=@saved_debug_dbug; - DROP TABLE t1; perl; diff --git a/mysql-test/suite/innodb/t/innodb-wl5522.test b/mysql-test/suite/innodb/t/innodb-wl5522.test index a70ae86f1cd45..8eedb636a5fc9 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5522.test +++ b/mysql-test/suite/innodb/t/innodb-wl5522.test @@ -11,7 +11,6 @@ call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` FLUSH TABLES; -let $MYSQLD_TMPDIR = `SELECT @@tmpdir`; let $MYSQLD_DATADIR = `SELECT @@datadir`; let $checksum_algorithm = `SELECT @@innodb_checksum_algorithm`; @@ -41,10 +40,10 @@ CREATE TABLE t2(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT; FLUSH TABLE t1, t2 FOR EXPORT; --echo # List before copying files --list_files $MYSQLD_DATADIR/test ---copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg ---copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1.ibd ---move_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_TMPDIR/t2.cfg ---copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_TMPDIR/t2.ibd +--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t1.cfg.sav +--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t1.ibd.sav +--move_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_DATADIR/test/t2.cfg.sav +--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t2.ibd.sav UNLOCK TABLES; INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; SELECT COUNT(*) FROM t1; @@ -58,8 +57,8 @@ SELECT * FROM t1 ORDER BY a DESC LIMIT 3; ALTER TABLE t1 DISCARD TABLESPACE; --echo # List after t1 DISCARD --list_files $MYSQLD_DATADIR/test ---copy_file $MYSQLD_TMPDIR/t1.cfg $MYSQLD_DATADIR/test/t1.cfg ---copy_file $MYSQLD_TMPDIR/t1.ibd $MYSQLD_DATADIR/test/t1.ibd +--copy_file $MYSQLD_DATADIR/test/t1.cfg.sav $MYSQLD_DATADIR/test/t1.cfg +--copy_file $MYSQLD_DATADIR/test/t1.ibd.sav $MYSQLD_DATADIR/test/t1.ibd ALTER TABLE t1 IMPORT TABLESPACE; ALTER TABLE t1 ENGINE InnoDB; SELECT COUNT(*) FROM t1; @@ -70,15 +69,15 @@ SELECT COUNT(*) FROM t1; SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3; SELECT * FROM t1 ORDER BY a DESC LIMIT 3; DROP TABLE t1; ---remove_file $MYSQLD_TMPDIR/t1.cfg ---remove_file $MYSQLD_TMPDIR/t1.ibd +--remove_file $MYSQLD_DATADIR/test/t1.cfg.sav +--remove_file $MYSQLD_DATADIR/test/t1.ibd.sav ALTER TABLE t2 ROW_FORMAT=DYNAMIC; ALTER TABLE t2 DISCARD TABLESPACE; --echo # List after t2 DISCARD --list_files $MYSQLD_DATADIR/test ---move_file $MYSQLD_TMPDIR/t2.ibd $MYSQLD_DATADIR/test/t2.ibd ---move_file $MYSQLD_TMPDIR/t2.cfg $MYSQLD_DATADIR/test/t2.cfg +--move_file $MYSQLD_DATADIR/test/t2.ibd.sav $MYSQLD_DATADIR/test/t2.ibd +--move_file $MYSQLD_DATADIR/test/t2.cfg.sav $MYSQLD_DATADIR/test/t2.cfg --error ER_TABLE_SCHEMA_MISMATCH ALTER TABLE t2 IMPORT TABLESPACE; --remove_file $MYSQLD_DATADIR/test/t2.cfg @@ -98,10 +97,6 @@ if ($checksum_algorithm == "strict_full_crc32") { ALTER TABLE t2 IMPORT TABLESPACE; DROP TABLE t2; -if ($error_code) { ---remove_file $MYSQLD_DATADIR/test/t2.ibd -} - SET GLOBAL innodb_file_per_table = 1; SELECT @@innodb_file_per_table; @@ -1084,10 +1079,38 @@ DROP TABLE t1; SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed; --enable_query_log + +CREATE TABLE t1 ( id INT NOT NULL, i1 INT, i2 INT, i3 INT, PRIMARY KEY (id)) engine=innodb; +CREATE TABLE t2 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb; + +ALTER TABLE t2 DISCARD TABLESPACE; +FLUSH TABLES t1 FOR EXPORT; + +--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t2.ibd +--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t2.cfg + +UNLOCK TABLES; +--error ER_TABLE_SCHEMA_MISMATCH +ALTER TABLE t2 IMPORT TABLESPACE; + +DROP TABLE t1, t2; + + +CREATE TABLE t1 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb; +CREATE TABLE t2 ( id INT NOT NULL, i1 INT, i2 INT, i3 INT, PRIMARY KEY (id)) engine=innodb; + +ALTER TABLE t2 DISCARD TABLESPACE; +FLUSH TABLES t1 FOR EXPORT; + +--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t2.ibd +--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t2.cfg + +UNLOCK TABLES; +--error ER_TABLE_SCHEMA_MISMATCH +ALTER TABLE t2 IMPORT TABLESPACE; +DROP TABLE t1, t2; + + call mtr.add_suppression("Got error -1 when reading table '.*'"); call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'"); call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded"); - -# cleanup ---remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg ---remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd diff --git a/mysql-test/suite/innodb/t/innodb-wl5980-alter.test b/mysql-test/suite/innodb/t/innodb-wl5980-alter.test index 213997a868238..09c54db644fad 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5980-alter.test +++ b/mysql-test/suite/innodb/t/innodb-wl5980-alter.test @@ -4,6 +4,7 @@ --echo # --source include/have_innodb.inc +--source include/have_symlink.inc SET @innodb_file_per_table_orig=@@GLOBAL.innodb_file_per_table; LET $regexp=/FTS_[0-9a-f_]+([A-Z0-9_]+)\.([islbd]{3})/FTS_AUX_\1.\2/; diff --git a/mysql-test/suite/innodb/t/innodb-wl5980-debug.test b/mysql-test/suite/innodb/t/innodb-wl5980-debug.test deleted file mode 100644 index 2c5e2b48870d2..0000000000000 --- a/mysql-test/suite/innodb/t/innodb-wl5980-debug.test +++ /dev/null @@ -1,51 +0,0 @@ -# -# This testcase is to check the various debug injection points -# to make sure error conditions react corectly and acheive -# better code coverage. -# - -# Not supported in embedded ---source include/not_embedded.inc ---source include/have_debug.inc ---source include/have_innodb.inc - -# These messages are expected in the log -call mtr.add_suppression("Cannot find space id [0-9]+ in the tablespace memory cache"); -call mtr.add_suppression("Cannot rename table 'test/t1' to 'test/t2' since the dictionary cache already contains 'test/t2'."); - -# Set up some variables -LET $MYSQL_DATA_DIR = `select @@datadir`; -LET $data_directory_clause = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir'; ---enable_query_log - ---echo # ---echo # WL5980 Remote tablespace debug error injection tests. ---echo # - ---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR -eval CREATE TABLE t1 (a int KEY, b text) ENGINE=Innodb $data_directory_clause ; -INSERT INTO t1 VALUES (1, 'tablespace'); -SELECT * FROM t1; - ---echo # ---echo # Test the second injection point in fil_rename_tablespace(). ---echo # Make sure the table is useable after this failure. ---echo # -SET @save_dbug=@@debug_dbug; -SET debug_dbug="+d,fil_rename_tablespace_failure_2"; ---disable_result_log ---error ER_ERROR_ON_RENAME -RENAME TABLE t1 TO t2; ---enable_result_log -SET debug_dbug=@save_dbug; -INSERT INTO t1 VALUES (2, 'tablespace'); -SELECT * FROM t1; - ---echo # ---echo # Cleanup ---echo # - -DROP TABLE t1; - ---rmdir $MYSQL_TMP_DIR/alt_dir/test ---rmdir $MYSQL_TMP_DIR/alt_dir diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test index 3a8c12dfbbd4c..3b3b2770df742 100644 --- a/mysql-test/suite/innodb/t/innodb.test +++ b/mysql-test/suite/innodb/t/innodb.test @@ -1598,12 +1598,22 @@ disconnect b; set foreign_key_checks=0; create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb; +create table t1(a char(10) primary key, b varchar(20)) engine = innodb; +set foreign_key_checks=1; +--error ER_NO_REFERENCED_ROW_2 +insert into t2 values (1,1); +set foreign_key_checks=0; +drop table t1; +set foreign_key_checks=1; +--error ER_NO_REFERENCED_ROW_2 +insert into t2 values (1,1); # Embedded server doesn't chdir to data directory --replace_result $MYSQLTEST_VARDIR . master-data/ '' --error ER_CANT_CREATE_TABLE create table t1(a char(10) primary key, b varchar(20)) engine = innodb; -set foreign_key_checks=1; drop table t2; +create table t1(a char(10) primary key, b varchar(20)) engine = innodb; +drop table t1; # test that FKs between different charsets are not accepted in CREATE even # when f_k_c is 0 diff --git a/mysql-test/suite/innodb/t/innodb_28867993.test b/mysql-test/suite/innodb/t/innodb_28867993.test index 61e9578df7bc5..4777a9ac77f6b 100644 --- a/mysql-test/suite/innodb/t/innodb_28867993.test +++ b/mysql-test/suite/innodb/t/innodb_28867993.test @@ -6,6 +6,10 @@ source include/have_innodb.inc; create table t1 (a int) engine=innodb; insert t1 values (1),(2); create database ib_logfile2; +--disable_query_log +call mtr.add_suppression("InnoDB: Operating system error number "); +call mtr.add_suppression("InnoDB: Error number .* means "); +--enable_query_log source include/restart_mysqld.inc; select * from t1; drop table t1; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_dump_pct.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_dump_pct.test index a7a414d61da61..381091165ef08 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_dump_pct.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_dump_pct.test @@ -15,7 +15,6 @@ col2 VARCHAR(25), col3 varchar(25)) ENGINE=InnoDB; CREATE INDEX idx1 ON tab5(col2(10)); CREATE INDEX idx2 ON tab5(col3(10)); -SET GLOBAL innodb_buffer_pool_filename=ib_buffer_pool100; SET GLOBAL innodb_buffer_pool_dump_pct=100; #*********************************************************** @@ -58,8 +57,7 @@ AND variable_value != @IBPDS AND variable_value like 'Buffer pool(s) dump completed at%'; --source include/wait_condition.inc ---file_exists $MYSQLD_DATADIR/ib_buffer_pool100 -SET GLOBAL innodb_buffer_pool_filename=ib_buffer_pool1; +--move_file $MYSQLD_DATADIR/ib_buffer_pool $MYSQLD_DATADIR/ib_buffer_pool100 SET GLOBAL innodb_buffer_pool_dump_pct=1; SELECT @@global.innodb_buffer_pool_dump_pct; @@ -83,17 +81,15 @@ AND variable_value != @IBPDS AND variable_value like 'Buffer pool(s) dump completed at%'; --source include/wait_condition.inc ---file_exists $MYSQLD_DATADIR/ib_buffer_pool1 +--file_exists $MYSQLD_DATADIR/ib_buffer_pool perl; -my $size1 = -s "$ENV{MYSQLD_DATADIR}/ib_buffer_pool1"; +my $size1 = -s "$ENV{MYSQLD_DATADIR}/ib_buffer_pool"; my $size100 = -s "$ENV{MYSQLD_DATADIR}/ib_buffer_pool100"; die "$size100<=$size1\n" unless $size100 > $size1; EOF SET GLOBAL innodb_buffer_pool_dump_pct=DEFAULT; -SET GLOBAL innodb_buffer_pool_filename=DEFAULT; --remove_file $MYSQLD_DATADIR/ib_buffer_pool100 ---remove_file $MYSQLD_DATADIR/ib_buffer_pool1 DROP TABLE tab5; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test index da9e19c3d1c4e..051f38a572efd 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test @@ -7,7 +7,7 @@ let $wait_timeout = 180; let $wait_condition = - SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at ' + SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.opt new file mode 100644 index 0000000000000..72f055d3b58ae --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.opt @@ -0,0 +1,2 @@ +--innodb-buffer-pool-chunk-size=1M +--loose-skip-innodb-disable-resize_buffer_pool_debug diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.test new file mode 100644 index 0000000000000..db5da2924fa98 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.test @@ -0,0 +1,28 @@ +--source include/have_innodb.inc +--source include/big_test.inc + +SET @save_size=@@innodb_buffer_pool_size; + +let $wait_timeout = 60; +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; + +--echo # +--echo # MDEV-27891: Delayed SIGSEGV in InnoDB buffer pool resize +--echo # after or during DROP TABLE +--echo # + +select @@innodb_buffer_pool_chunk_size; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +SET GLOBAL innodb_buffer_pool_size=256*1024*1024; +DROP TABLE t1; +--source include/wait_condition.inc +SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + @@innodb_buffer_pool_chunk_size; +--source include/wait_condition.inc + +--echo # End of 10.6 tests + +SET GLOBAL innodb_buffer_pool_size=@save_size; +--source include/wait_condition.inc diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test index 1cdf4a318d024..c49ae4516387c 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test @@ -15,7 +15,7 @@ SET GLOBAL innodb_buffer_pool_size=8388608; let $wait_timeout = 60; let $wait_condition = - SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at ' + SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' FROM information_schema.global_status WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; --source include/wait_condition.inc diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt index b97a399545787..ade197de33801 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt @@ -1,3 +1,3 @@ --innodb-buffer-pool-size=16M ---innodb-buffer-pool-chunk-size=2M +--innodb-buffer-pool-chunk-size=4M --innodb-page-size=4k diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test index b63bede11ad3a..78db6bf0d5a51 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test @@ -8,7 +8,7 @@ let $wait_timeout = 180; let $wait_condition = - SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at ' + SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; @@ -51,7 +51,7 @@ drop table t1; drop view view0; # Try to shrink buffer pool to smaller than chunk size -set global innodb_buffer_pool_size = 1048576; +set global innodb_buffer_pool_size = 2*1048576; --source include/wait_condition.inc select @@innodb_buffer_pool_size; diff --git a/mysql-test/suite/innodb/t/innodb_bug14147491.test b/mysql-test/suite/innodb/t/innodb_bug14147491.test index c6e4f01a642f9..3c37f1b7cce33 100644 --- a/mysql-test/suite/innodb/t/innodb_bug14147491.test +++ b/mysql-test/suite/innodb/t/innodb_bug14147491.test @@ -12,6 +12,7 @@ call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted\\. Please dro call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*test.t1\\.ibd' page"); call mtr.add_suppression("InnoDB: We detected index corruption in an InnoDB type table"); call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it"); +call mtr.add_suppression("InnoDB: File '.*test/t1\\.ibd' is corrupted"); --enable_query_log --echo # Ensure that purge will not crash on the table after we corrupt it. @@ -70,13 +71,13 @@ EOF --echo # Now t1 is corrupted but we should not crash ---error 1030,1712,1932 +--error ER_GET_ERRNO,ER_NOT_KEYFILE,ER_INDEX_CORRUPT,ER_NO_SUCH_TABLE_IN_ENGINE SELECT * FROM t1; ---error 126,1030,1034,1712,1932 +--error 126,ER_GET_ERRNO,ER_NOT_KEYFILE,ER_INDEX_CORRUPT,ER_NO_SUCH_TABLE_IN_ENGINE INSERT INTO t1(b) VALUES('abcdef'); ---error 1030,1712,1932 +--error ER_GET_ERRNO,ER_NOT_KEYFILE,ER_INDEX_CORRUPT,ER_NO_SUCH_TABLE_IN_ENGINE UPDATE t1 set b = 'deadbeef' where a = 1; --echo # Cleanup, this must be possible diff --git a/mysql-test/suite/innodb/t/innodb_bug30423.test b/mysql-test/suite/innodb/t/innodb_bug30423.test index de53a93515690..9d9975c04ca9f 100644 --- a/mysql-test/suite/innodb/t/innodb_bug30423.test +++ b/mysql-test/suite/innodb/t/innodb_bug30423.test @@ -1,4 +1,5 @@ --source include/have_innodb.inc +--source include/no_valgrind_without_big.inc # Test for Bug #30423, InnoDBs treatment of NULL in index stats causes # bad "rows examined" estimates. # Implemented InnoDB system variable "innodb_stats_method" with diff --git a/mysql-test/suite/innodb/t/innodb_bug53290.test b/mysql-test/suite/innodb/t/innodb_bug53290.test index ea15212fa39a9..9d36d9bd2f6bd 100644 --- a/mysql-test/suite/innodb/t/innodb_bug53290.test +++ b/mysql-test/suite/innodb/t/innodb_bug53290.test @@ -1,4 +1,5 @@ -- source include/have_innodb.inc +-- source include/no_valgrind_without_big.inc create table bug53290 (x bigint) engine=innodb; diff --git a/mysql-test/suite/innodb/t/innodb_bug84958.test b/mysql-test/suite/innodb/t/innodb_bug84958.test index f895c8d12458b..b42f7bd639e79 100644 --- a/mysql-test/suite/innodb/t/innodb_bug84958.test +++ b/mysql-test/suite/innodb/t/innodb_bug84958.test @@ -13,12 +13,10 @@ DELIMITER ~~; CREATE PROCEDURE insert_n(start int, end int) BEGIN DECLARE i INT DEFAULT start; - START TRANSACTION; WHILE i <= end do INSERT INTO t1 VALUES (1, 2, 3) ON DUPLICATE KEY UPDATE c = i; SET i = i + 1; END WHILE; - COMMIT; END~~ CREATE FUNCTION num_pages_get() @@ -37,6 +35,7 @@ DELIMITER ;~~ --echo # CREATE TABLE t1 (a INT, b INT, c INT, PRIMARY KEY(a,b), KEY (b,c)) ENGINE=InnoDB STATS_PERSISTENT=0; +--source include/wait_all_purged.inc BEGIN; SELECT * FROM t1; @@ -45,18 +44,22 @@ SELECT * FROM t1; --echo # connect (con2, localhost, root,,); connection con2; +BEGIN; INSERT INTO t1 VALUES (1, 2, 3) ON DUPLICATE KEY UPDATE c = NULL; --send CALL insert_n(1, 50); connect (con3, localhost, root,,); connection con3; +BEGIN; --send CALL insert_n(51, 100); connection con2; reap; +COMMIT; connection con3; reap; INSERT INTO t1 VALUES (1, 2, 1) ON DUPLICATE KEY UPDATE c = NULL; +COMMIT; connection default; @@ -64,7 +67,7 @@ connection default; --echo # Connect to default and record how many pages were accessed --echo # when selecting the record using the secondary key. --echo # ---let $wait_all_purged=4 +--let $wait_all_purged=2 --source include/wait_all_purged.inc SET @num_pages_1 = num_pages_get(); SELECT * FROM t1 force index (b); diff --git a/mysql-test/suite/innodb/t/innodb_ctype_tis620.test b/mysql-test/suite/innodb/t/innodb_ctype_tis620.test index 4bab0fe956127..b0e9f42cc5ae2 100644 --- a/mysql-test/suite/innodb/t/innodb_ctype_tis620.test +++ b/mysql-test/suite/innodb/t/innodb_ctype_tis620.test @@ -27,3 +27,65 @@ DROP TABLE t1; --echo # --echo # End of 10.2 tests --echo # + +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-27670 Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit +--echo # + +CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(8), KEY(a)) ENGINE=InnoDB COLLATE tis620_thai_nopad_ci; +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +DROP TABLE t1; + +--echo # +--echo # MDEV-27768 MDEV-25440: Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit +--echo # + +CREATE TABLE t1 (a INT KEY,b INT,c CHAR,KEY(b),KEY(c)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB; +INSERT INTO t1 VALUES (3,4,4); +DROP TABLE t1; + +CREATE TABLE t1 (C1 CHAR KEY,B1 BIT,B2 BIT,C2 CHAR DEFAULT'') ROW_FORMAT=DYNAMIC COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB; +SELECT HEX(c1),HEX (c2) FROM t1 WHERE c1>=''AND c1<''AND c2=''LIMIT 2; +DROP TABLE t1; + +SET sql_mode=''; +CREATE TABLE t1 (a INT UNSIGNED,b INT,c CHAR(1),d BINARY (1),e VARCHAR(1),f VARBINARY(1),g BLOB,h BLOB,id INT,KEY(b),KEY(e)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB; +INSERT INTO t1 VALUES (4386060749083099108,157,0,0,0,0,0,0,12); +INSERT INTO t1 VALUES (104,15158706241929488558,0,0,0,0,0,0,13); +SELECT GROUP_CONCAT(DISTINCT a,b ORDER BY c,b) FROM t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +CREATE TABLE t1 (a CHAR(9),b CHAR(7)) COLLATE=tis620_thai_nopad_ci; +INSERT INTO t1 VALUES (0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0); +ALTER TABLE t1 ADD INDEX kb (b),ADD INDEX kab (a,b),ALGORITHM=INPLACE; +DROP TABLE t1; + +SET sql_mode=''; +CREATE TABLE t1 (a INT UNSIGNED,b INT UNSIGNED,c CHAR(1),d CHAR(1),e VARCHAR(1),f VARCHAR(1),g BLOB,h BLOB,id INT,KEY(b),KEY(e)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci; +INSERT INTO t1 VALUES (15842995496588415350,5339224446865937973,0,0,0,0,0,0,4); +INSERT INTO t1 VALUES (8118894032862615316,5299008984764990929,0,0,0,0,0,0,1); +SELECT GROUP_CONCAT(DISTINCT a,c ORDER BY a) FROM t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +CREATE TABLE t1 (a CHAR,b CHAR,KEY(a,b)) ROW_FORMAT=DYNAMIC COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB; +INSERT INTO t1 VALUES (0,0); +DROP TABLE t1; + +CREATE TABLE t1 (a CHAR,b CHAR) COLLATE=tis620_thai_nopad_ci; +INSERT INTO t1 VALUES (0,0); +SELECT a,SUM(DISTINCT a),MIN(b) FROM t1 GROUP BY a; +DROP TABLE t1; + +CREATE TABLE t1 (a CHAR,KEY(a)) ENGINE=InnoDB COLLATE=tis620_thai_nopad_ci; +INSERT INTO t1 VALUES (0); +DROP TABLE t1; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/suite/innodb/t/innodb_ctype_utf8.test b/mysql-test/suite/innodb/t/innodb_ctype_utf8.test index c3abaa9973108..99b7925321597 100644 --- a/mysql-test/suite/innodb/t/innodb_ctype_utf8.test +++ b/mysql-test/suite/innodb/t/innodb_ctype_utf8.test @@ -23,3 +23,15 @@ let $coll_pad='utf8_bin'; --echo # --echo # End of 10.2 tests --echo # + + +--echo # +--echo # Start of 10.4 tests +--echo # + +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_nopad_ci; +--source include/ctype_nopad_prefix_unique.inc + +--echo # +--echo # End 10.4 tests +--echo # diff --git a/mysql-test/suite/innodb/t/innodb_force_recovery.test b/mysql-test/suite/innodb/t/innodb_force_recovery.test index 76baf55af8391..2544db15f29de 100644 --- a/mysql-test/suite/innodb/t/innodb_force_recovery.test +++ b/mysql-test/suite/innodb/t/innodb_force_recovery.test @@ -146,7 +146,7 @@ SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; select * from t2; SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; select * from t2; -SET GLOBAL innodb_lock_wait_timeout=1; +SET SESSION innodb_lock_wait_timeout=1; --error ER_LOCK_WAIT_TIMEOUT insert into t2 values(1,2); insert into t2 values(9,10); diff --git a/mysql-test/suite/innodb/t/innodb_information_schema.test b/mysql-test/suite/innodb/t/innodb_information_schema.test index 395fa779773fd..88e2d3601a632 100644 --- a/mysql-test/suite/innodb/t/innodb_information_schema.test +++ b/mysql-test/suite/innodb/t/innodb_information_schema.test @@ -148,6 +148,8 @@ if (!$success) -- echo Timeout waiting for rows in INNODB_LOCKS to appear } +--replace_column 6 # +--sorted_result SELECT lock_mode, lock_type, lock_table, lock_index, lock_rec, lock_data FROM INFORMATION_SCHEMA.INNODB_LOCKS ORDER BY lock_data; diff --git a/mysql-test/suite/innodb/t/innodb_page_compressed.combinations b/mysql-test/suite/innodb/t/innodb_page_compressed.combinations new file mode 100644 index 0000000000000..498c85ee65c0e --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_page_compressed.combinations @@ -0,0 +1,11 @@ +[bzip2] +plugin-load-add=$PROVIDER_BZIP2_SO +[lz4] +plugin-load-add=$PROVIDER_LZ4_SO +[lzma] +plugin-load-add=$PROVIDER_LZMA_SO +[lzo] +plugin-load-add=$PROVIDER_LZO_SO +[snappy] +plugin-load-add=$PROVIDER_SNAPPY_SO +[zlib] diff --git a/mysql-test/suite/innodb/t/innodb_page_compressed.test b/mysql-test/suite/innodb/t/innodb_page_compressed.test new file mode 100644 index 0000000000000..74cd33e2aa567 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_page_compressed.test @@ -0,0 +1,86 @@ +-- source include/have_innodb.inc + +SET @save_algorithm = @@GLOBAL.innodb_compression_algorithm; +let $alg=`select regexp_replace('$MTR_COMBINATIONS', 'innodb,\|,innodb', '')`; + +if (!`select '$alg' = 'zlib'`) +{ + if (!`SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_have_$alg' AND variable_value = 'ON'`) + { + --skip Test requires InnoDB compiled with $alg + } + --disable_query_log + eval SET GLOBAL innodb_compression_algorithm=$alg; + --enable_query_log +} + +create table innodb_normal (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table innodb_page_compressed1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; +create table innodb_page_compressed2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; +create table innodb_page_compressed3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; +create table innodb_page_compressed4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; +create table innodb_page_compressed5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; +create table innodb_page_compressed6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; +create table innodb_page_compressed7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; +create table innodb_page_compressed8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; +create table innodb_page_compressed9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; + +connect (prevent_purge,localhost,root); +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; + +begin; +insert into innodb_normal SET b=REPEAT('Aa',50); +insert into innodb_page_compressed1 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed2 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed3 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed4 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed5 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed6 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed7 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed8 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed9 SET b=REPEAT('Aa',50); +commit; + +FLUSH TABLES innodb_normal, +innodb_page_compressed1, innodb_page_compressed2, innodb_page_compressed3, +innodb_page_compressed4, innodb_page_compressed5, innodb_page_compressed6, +innodb_page_compressed7, innodb_page_compressed8, innodb_page_compressed9 +FOR EXPORT; + +--let $MYSQLD_DATADIR=`select @@datadir` +--let SEARCH_PATTERN=AaAaAaAa +--let SEARCH_FILE=$MYSQLD_DATADIR/test/innodb_normal.ibd +--source include/search_pattern_in_file.inc +--let SEARCH_FILE=$MYSQLD_DATADIR/test/innodb_page_compressed1.ibd +--source include/search_pattern_in_file.inc +--let SEARCH_FILE=$MYSQLD_DATADIR/test/innodb_page_compressed2.ibd +--source include/search_pattern_in_file.inc +--let SEARCH_FILE=$MYSQLD_DATADIR/test/innodb_page_compressed3.ibd +--source include/search_pattern_in_file.inc +--let SEARCH_FILE=$MYSQLD_DATADIR/test/innodb_page_compressed4.ibd +--source include/search_pattern_in_file.inc +--let SEARCH_FILE=$MYSQLD_DATADIR/test/innodb_page_compressed5.ibd +--source include/search_pattern_in_file.inc +--let SEARCH_FILE=$MYSQLD_DATADIR/test/innodb_page_compressed6.ibd +--source include/search_pattern_in_file.inc +--let SEARCH_FILE=$MYSQLD_DATADIR/test/innodb_page_compressed7.ibd +--source include/search_pattern_in_file.inc +--let SEARCH_FILE=$MYSQLD_DATADIR/test/innodb_page_compressed8.ibd +--source include/search_pattern_in_file.inc +--let SEARCH_FILE=$MYSQLD_DATADIR/test/innodb_page_compressed9.ibd +--source include/search_pattern_in_file.inc + +UNLOCK TABLES; + +drop table innodb_normal; +drop table innodb_page_compressed1; +drop table innodb_page_compressed2; +drop table innodb_page_compressed3; +drop table innodb_page_compressed4; +drop table innodb_page_compressed5; +drop table innodb_page_compressed6; +drop table innodb_page_compressed7; +drop table innodb_page_compressed8; +drop table innodb_page_compressed9; +SET GLOBAL innodb_compression_algorithm=@save_algorithm; diff --git a/mysql-test/suite/innodb/t/innodb_scrub.test b/mysql-test/suite/innodb/t/innodb_scrub.test index 88b4e9cfd76b7..8fe460da4d3d3 100644 --- a/mysql-test/suite/innodb/t/innodb_scrub.test +++ b/mysql-test/suite/innodb/t/innodb_scrub.test @@ -1,4 +1,5 @@ -- source include/have_innodb.inc +-- source include/no_valgrind_without_big.inc let $MYSQLD_DATADIR=`select @@datadir`; CREATE TABLE t1(f1 int auto_increment primary key, @@ -26,3 +27,19 @@ FLUSH TABLE t1 FOR EXPORT; UNLOCK TABLES; -- source include/search_pattern_in_file.inc DROP TABLE t1; + +--echo # +--echo # MDEV-30527 Assertion !m_freed_pages in mtr_t::start() +--echo # on DROP TEMPORARY TABLE +--echo # +SET @scrub= @@GLOBAL.innodb_immediate_scrub_data_uncompressed; +SET GLOBAL innodb_immediate_scrub_data_uncompressed= 1; +SET @fpt=@@GLOBAL.innodb_file_per_table; +SET GLOBAL innodb_file_per_table=0; +CREATE TABLE t ENGINE=InnoDB AS SELECT 1; +DROP TABLE t; +SET GLOBAL innodb_file_per_table=@fpt; +CREATE TEMPORARY TABLE tmp ENGINE=InnoDB AS SELECT 1; +DROP TABLE tmp; +SET GLOBAL INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED= @scrub; +--echo # End of 10.6 tests diff --git a/mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test b/mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test index 2e1391355b93f..4383e26877d12 100644 --- a/mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test +++ b/mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test @@ -25,24 +25,6 @@ select @@innodb_ft_server_stopword_table; drop table user_stopword_1, user_stopword_2; -#Test innodb_buffer_pool_filename (global variable) - -select @@innodb_buffer_pool_filename; - -set @blah='hello'; -set global innodb_buffer_pool_filename = @blah; -select @@innodb_buffer_pool_filename; - -set global innodb_buffer_pool_filename="bye"; -select @@innodb_buffer_pool_filename; - ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_buffer_pool_filename=NULL; -select @@innodb_buffer_pool_filename; - -set global innodb_buffer_pool_filename=default; -select @@innodb_buffer_pool_filename; - #Test innodb_ft_aux_table (global variable) CREATE TABLE t1 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, opening_line TEXT(500), author VARCHAR(200), title VARCHAR(200), FULLTEXT idx diff --git a/mysql-test/suite/innodb/t/innodb_wl6326.opt b/mysql-test/suite/innodb/t/innodb_wl6326.opt deleted file mode 100644 index 99bf0e5a28b2b..0000000000000 --- a/mysql-test/suite/innodb/t/innodb_wl6326.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb-sys-tablestats diff --git a/mysql-test/suite/innodb/t/innodb_wl6326.test b/mysql-test/suite/innodb/t/innodb_wl6326.test deleted file mode 100644 index 1cf98cd1c7bec..0000000000000 --- a/mysql-test/suite/innodb/t/innodb_wl6326.test +++ /dev/null @@ -1,519 +0,0 @@ -# -# WL#6326: InnoDB: fix index->lock contention -# - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/have_innodb_16k.inc - ---disable_query_log -SET @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug; -SET @old_innodb_adaptive_hash_index = @@innodb_adaptive_hash_index; -SET @old_innodb_stats_persistent = @@innodb_stats_persistent; ---enable_query_log - -# Save the initial number of concurrent sessions ---source include/count_sessions.inc - -SET GLOBAL innodb_adaptive_hash_index = false; -SET GLOBAL innodb_stats_persistent = false; - ---connect (con1,localhost,root,,) ---connect (con2,localhost,root,,) ---connect (con3,localhost,root,,) - -CREATE TABLE t1 ( - a00 CHAR(255) NOT NULL DEFAULT 'a', - a01 CHAR(255) NOT NULL DEFAULT 'a', - a02 CHAR(255) NOT NULL DEFAULT 'a', - a03 CHAR(255) NOT NULL DEFAULT 'a', - a04 CHAR(255) NOT NULL DEFAULT 'a', - a05 CHAR(255) NOT NULL DEFAULT 'a', - a06 CHAR(255) NOT NULL DEFAULT 'a', - b INT NOT NULL DEFAULT 0 -) ENGINE = InnoDB; - -ALTER TABLE t1 ADD PRIMARY KEY( - a00, - a01, - a02, - a03, - a04, - a05, - a06 -); - -# -# Prepare primary key index tree to be used for this test. -# - -# Only root (1) -ANALYZE TABLE t1; -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; - -# Make the first records sparse artificially, -# not to cause modify_tree by single node_ptr insert operation. -# * (7 - 2) records should be larger than a half of the page size -# * (7 + 2) records should be fit to the page -# (above t1 definition is already adjusted) -SET GLOBAL innodb_limit_optimistic_insert_debug = 7; - -BEGIN; -INSERT INTO t1 (a00) VALUES ('aa'); -INSERT INTO t1 (a00) VALUES ('ab'); -INSERT INTO t1 (a00) VALUES ('ac'); -INSERT INTO t1 (a00) VALUES ('ad'); -INSERT INTO t1 (a00) VALUES ('ae'); -INSERT INTO t1 (a00) VALUES ('af'); -INSERT INTO t1 (a00) VALUES ('ag'); -INSERT INTO t1 (a00) VALUES ('ah'); -COMMIT; -# Raise root (1-2) -# (aa,ad) -# (aa,ab,ac)(ad,ae,af,ag,ah) -ANALYZE TABLE t1; -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; - -BEGIN; -INSERT INTO t1 (a00) VALUES ('ai'); -INSERT INTO t1 (a00) VALUES ('aj'); -INSERT INTO t1 (a00) VALUES ('ak'); -COMMIT; -# Split leaf (1-3) -# (aa,ad,ak) -# (aa,ab,ac)(ad,ae,af,ag,ah,ai,aj)(ak) -ANALYZE TABLE t1; -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; - -BEGIN; -INSERT INTO t1 (a00) VALUES ('al'); -INSERT INTO t1 (a00) VALUES ('am'); -INSERT INTO t1 (a00) VALUES ('an'); -INSERT INTO t1 (a00) VALUES ('ao'); -INSERT INTO t1 (a00) VALUES ('ap'); -INSERT INTO t1 (a00) VALUES ('aq'); -INSERT INTO t1 (a00) VALUES ('ar'); -COMMIT; -# Split leaf (1-4) -# (aa,ad,ak,ar) -# (aa,ab,ac)(ad,ae,af,ag,ah,ai,aj)(ak,al,am,an,ao,ap,aq)(ar) -ANALYZE TABLE t1; -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; - -BEGIN; -INSERT INTO t1 (a00) VALUES ('as'); -INSERT INTO t1 (a00) VALUES ('at'); -INSERT INTO t1 (a00) VALUES ('au'); -INSERT INTO t1 (a00) VALUES ('av'); -INSERT INTO t1 (a00) VALUES ('aw'); -INSERT INTO t1 (a00) VALUES ('ax'); -INSERT INTO t1 (a00) VALUES ('ay'); -COMMIT; -# Split leaf (1-5) -# (aa,ad,ak,ar,ay) -# (aa,ab,ac)(ad,ae,af,ag,ah,ai,aj)(ak,al,am,an,ao,ap,aq)(ar,as,at,au,av,aw,ax)(ay) -ANALYZE TABLE t1; -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; - -BEGIN; -INSERT INTO t1 (a00) VALUES ('az'); -INSERT INTO t1 (a00) VALUES ('ba'); -INSERT INTO t1 (a00) VALUES ('bb'); -INSERT INTO t1 (a00) VALUES ('bc'); -INSERT INTO t1 (a00) VALUES ('bd'); -INSERT INTO t1 (a00) VALUES ('be'); -INSERT INTO t1 (a00) VALUES ('bf'); -COMMIT; -# Split leaf (1-6) -# (aa,ad,ak,ar,ay,bf) -# (aa,ab,ac)(ad..)(ak..)(ar,as,at,au,av,aw,ax)(ay,az,ba,bb,bc,bd,be)(bf) -ANALYZE TABLE t1; -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; - -BEGIN; -INSERT INTO t1 (a00) VALUES ('bg'); -INSERT INTO t1 (a00) VALUES ('bh'); -INSERT INTO t1 (a00) VALUES ('bi'); -INSERT INTO t1 (a00) VALUES ('bj'); -INSERT INTO t1 (a00) VALUES ('bk'); -INSERT INTO t1 (a00) VALUES ('bl'); -INSERT INTO t1 (a00) VALUES ('bm'); -COMMIT; -# Split leaf (1-7) -# (aa,ad,ak,ar,ay,bf,bm) -# (aa,ab,ac)(ad..)(ak..)(ar..)(ay,az,ba,bb,bc,bd,be)(bf,bg,bh,bi,bj,bk,bl)(bm) -ANALYZE TABLE t1; -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; - -BEGIN; -INSERT INTO t1 (a00) VALUES ('bn'); -INSERT INTO t1 (a00) VALUES ('bo'); -INSERT INTO t1 (a00) VALUES ('bp'); -INSERT INTO t1 (a00) VALUES ('bq'); -INSERT INTO t1 (a00) VALUES ('br'); -INSERT INTO t1 (a00) VALUES ('bs'); -INSERT INTO t1 (a00) VALUES ('bt'); -COMMIT; -# Raise root (1-2-8) -# (aa,ar) -# (aa,ad,ak) (ar,ay,bf,bm,bt) -# (aa,ab,ac)(ad..)(ak..)(ar..)(ay..)(bf..)(bm..)(bt) -ANALYZE TABLE t1; -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; - -BEGIN; -INSERT INTO t1 (a00) VALUES ('bu'); -INSERT INTO t1 (a00) VALUES ('bv'); -INSERT INTO t1 (a00) VALUES ('bw'); -INSERT INTO t1 (a00) VALUES ('bx'); -INSERT INTO t1 (a00) VALUES ('by'); -INSERT INTO t1 (a00) VALUES ('bz'); -INSERT INTO t1 (a00) VALUES ('ca'); - -INSERT INTO t1 (a00) VALUES ('cb'); -INSERT INTO t1 (a00) VALUES ('cc'); -INSERT INTO t1 (a00) VALUES ('cd'); -INSERT INTO t1 (a00) VALUES ('ce'); -INSERT INTO t1 (a00) VALUES ('cf'); -INSERT INTO t1 (a00) VALUES ('cg'); -INSERT INTO t1 (a00) VALUES ('ch'); - -INSERT INTO t1 (a00) VALUES ('ci'); -INSERT INTO t1 (a00) VALUES ('cj'); -INSERT INTO t1 (a00) VALUES ('ck'); -INSERT INTO t1 (a00) VALUES ('cl'); -INSERT INTO t1 (a00) VALUES ('cm'); -INSERT INTO t1 (a00) VALUES ('cn'); -INSERT INTO t1 (a00) VALUES ('co'); -COMMIT; -# Split also at level 1 (1-3-11) -# (aa,ar,co) -# (aa,ad,ak) (ar,ay,bf,bm,bt,ca,ch) (co) -# (aa,ab,ac)(ad..)(ak..)(ar..)(ay..)(bf..)(bm..)(bt..)(ca..)(ch..)(co) -ANALYZE TABLE t1; -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; - -BEGIN; -INSERT INTO t1 (a00) VALUES ('cp'); -INSERT INTO t1 (a00) VALUES ('cq'); -INSERT INTO t1 (a00) VALUES ('cr'); -INSERT INTO t1 (a00) VALUES ('cs'); -INSERT INTO t1 (a00) VALUES ('ct'); -INSERT INTO t1 (a00) VALUES ('cu'); -INSERT INTO t1 (a00) VALUES ('cv'); - -INSERT INTO t1 (a00) VALUES ('cw'); -INSERT INTO t1 (a00) VALUES ('cx'); -INSERT INTO t1 (a00) VALUES ('cy'); -INSERT INTO t1 (a00) VALUES ('cz'); -INSERT INTO t1 (a00) VALUES ('da'); -INSERT INTO t1 (a00) VALUES ('db'); -INSERT INTO t1 (a00) VALUES ('dc'); - -INSERT INTO t1 (a00) VALUES ('dd'); -INSERT INTO t1 (a00) VALUES ('de'); -INSERT INTO t1 (a00) VALUES ('df'); -INSERT INTO t1 (a00) VALUES ('dg'); -INSERT INTO t1 (a00) VALUES ('dh'); -INSERT INTO t1 (a00) VALUES ('di'); -INSERT INTO t1 (a00) VALUES ('dj'); - -INSERT INTO t1 (a00) VALUES ('dk'); -INSERT INTO t1 (a00) VALUES ('dl'); -INSERT INTO t1 (a00) VALUES ('dm'); -INSERT INTO t1 (a00) VALUES ('dn'); -INSERT INTO t1 (a00) VALUES ('do'); -INSERT INTO t1 (a00) VALUES ('dp'); -INSERT INTO t1 (a00) VALUES ('dq'); - -INSERT INTO t1 (a00) VALUES ('dr'); -INSERT INTO t1 (a00) VALUES ('ds'); -INSERT INTO t1 (a00) VALUES ('dt'); -INSERT INTO t1 (a00) VALUES ('du'); -INSERT INTO t1 (a00) VALUES ('dv'); -INSERT INTO t1 (a00) VALUES ('dw'); -INSERT INTO t1 (a00) VALUES ('dx'); - -INSERT INTO t1 (a00) VALUES ('dy'); -INSERT INTO t1 (a00) VALUES ('dz'); -INSERT INTO t1 (a00) VALUES ('ea'); -INSERT INTO t1 (a00) VALUES ('eb'); -INSERT INTO t1 (a00) VALUES ('ec'); -INSERT INTO t1 (a00) VALUES ('ed'); -INSERT INTO t1 (a00) VALUES ('ee'); - -INSERT INTO t1 (a00) VALUES ('ef'); -INSERT INTO t1 (a00) VALUES ('eg'); -INSERT INTO t1 (a00) VALUES ('eh'); -INSERT INTO t1 (a00) VALUES ('ei'); -INSERT INTO t1 (a00) VALUES ('ej'); -INSERT INTO t1 (a00) VALUES ('ek'); -INSERT INTO t1 (a00) VALUES ('el'); -COMMIT; -# Split also at level 1 (1-4-18) -# (aa,ar,co,el) -# (aa,ad,ak) (ar,ay,bf,bm,bt,ca,ch) (co,cv,dc,dj,dq,dx,ee) (el) -# (aa,ab,ac)(ad..)(ak..)(ar..)(ay..)(bf..)(bm..)(bt..)(ca..)(ch..)(co..)(cv..)(dc..)(dj..)(dq..)(dx..)(ee..)(el) -ANALYZE TABLE t1; -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; - -BEGIN; -INSERT INTO t1 (a00) VALUES ('em'); -INSERT INTO t1 (a00) VALUES ('en'); -INSERT INTO t1 (a00) VALUES ('eo'); -INSERT INTO t1 (a00) VALUES ('ep'); -INSERT INTO t1 (a00) VALUES ('eq'); -INSERT INTO t1 (a00) VALUES ('er'); -INSERT INTO t1 (a00) VALUES ('es'); - -INSERT INTO t1 (a00) VALUES ('et'); -INSERT INTO t1 (a00) VALUES ('eu'); -INSERT INTO t1 (a00) VALUES ('ev'); -INSERT INTO t1 (a00) VALUES ('ew'); -INSERT INTO t1 (a00) VALUES ('ex'); -INSERT INTO t1 (a00) VALUES ('ey'); -INSERT INTO t1 (a00) VALUES ('ez'); - -INSERT INTO t1 (a00) VALUES ('fa'); -INSERT INTO t1 (a00) VALUES ('fb'); -INSERT INTO t1 (a00) VALUES ('fc'); -INSERT INTO t1 (a00) VALUES ('fd'); -INSERT INTO t1 (a00) VALUES ('fe'); -INSERT INTO t1 (a00) VALUES ('ff'); -INSERT INTO t1 (a00) VALUES ('fg'); - -INSERT INTO t1 (a00) VALUES ('fh'); -INSERT INTO t1 (a00) VALUES ('fi'); -INSERT INTO t1 (a00) VALUES ('fj'); -INSERT INTO t1 (a00) VALUES ('fk'); -INSERT INTO t1 (a00) VALUES ('fl'); -INSERT INTO t1 (a00) VALUES ('fm'); -INSERT INTO t1 (a00) VALUES ('fn'); - -INSERT INTO t1 (a00) VALUES ('fo'); -INSERT INTO t1 (a00) VALUES ('fp'); -INSERT INTO t1 (a00) VALUES ('fq'); -INSERT INTO t1 (a00) VALUES ('fr'); -INSERT INTO t1 (a00) VALUES ('fs'); -INSERT INTO t1 (a00) VALUES ('ft'); -INSERT INTO t1 (a00) VALUES ('fu'); - -INSERT INTO t1 (a00) VALUES ('fv'); -INSERT INTO t1 (a00) VALUES ('fw'); -INSERT INTO t1 (a00) VALUES ('fx'); -INSERT INTO t1 (a00) VALUES ('fy'); -INSERT INTO t1 (a00) VALUES ('fz'); -INSERT INTO t1 (a00) VALUES ('ga'); -INSERT INTO t1 (a00) VALUES ('gb'); - -INSERT INTO t1 (a00) VALUES ('gc'); -INSERT INTO t1 (a00) VALUES ('gd'); -INSERT INTO t1 (a00) VALUES ('ge'); -INSERT INTO t1 (a00) VALUES ('gf'); -INSERT INTO t1 (a00) VALUES ('gg'); -INSERT INTO t1 (a00) VALUES ('gh'); -COMMIT; - -# Current tree form (1-4-24) -# (aa,ar,co,el) -# (aa,ad,ak) (ar,ay,bf,bm,bt,ca,ch) (co,cv,dc,dj,dq,dx,ee) (el..,gb) -# (aa,ab,ac)(ad..)(ak..)(ar..)(ay..)(bf..)(bm..)(bt..)(ca..)(ch..)(co..)(cv..)(dc..)(dj..)(dq..)(dx..)(ee..)(el..)..(gb..) -ANALYZE TABLE t1; -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; - -# Insert the rest of records normally -SET GLOBAL innodb_limit_optimistic_insert_debug = 0; - ---echo # Test start - -# (1) Insert records to leaf page (bf..) and cause modify_page. -# - root page is not X latched -# - latched from level 1 page (ar,ay,bf,bm,bt,ca,ch) - -SET DEBUG_SYNC = 'RESET'; - -# Filling leaf page (bf..) -INSERT INTO t1 (a00) VALUES ('bfa'); - ---connection con1 -SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; -# Cause modify_tree ---send -INSERT INTO t1 (a00) VALUES ('bfb'); - ---connection con2 -SET DEBUG_SYNC = 'now WAIT_FOR reached'; -# Not blocked searches -SELECT a00,a01 FROM t1 WHERE a00 = 'aa'; -SELECT a00,a01 FROM t1 WHERE a00 = 'aq'; -# "where a00 = 'co'" is blocked because searching from smaller ('co','a','a',..). -SELECT a00,a01 FROM t1 WHERE a00 = 'cp'; -SELECT a00,a01 FROM t1 WHERE a00 = 'el'; - -SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; -# Blocked ---send -SELECT a00,a01 FROM t1 WHERE a00 = 'ar'; - ---connection con3 -SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; -# Blocked ---send -SELECT a00,a01 FROM t1 WHERE a00 = 'cn'; - ---connection default -# FIXME: These occasionally time out! ---disable_warnings -SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1'; ---enable_warnings -SET DEBUG_SYNC = 'now SIGNAL continue'; - ---connection con1 ---reap - ---connection con2 ---reap - ---connection con3 ---reap - ---connection default - -ANALYZE TABLE t1; -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; - - - -# (2) Insert records to leaf page (co..) and cause modify_page -# - root page is X latched, because node_ptr for 'co' -# is 1st record for (co,cv,dc,dj,dq,dx,ee) -# -# * ordinary pessimitic insert might be done by pessistic update -# and we should consider possibility node_ptr to be deleted. - -SET DEBUG_SYNC = 'RESET'; - -# Filling leaf page (co..) -INSERT INTO t1 (a00) VALUES ('coa'); - ---connection con1 -SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; -# Cause modify_tree ---send -INSERT INTO t1 (a00) VALUES ('cob'); - ---connection con2 -SET DEBUG_SYNC = 'now WAIT_FOR reached'; -# All searches are blocked because root page is X latched - -SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; -# Blocked ---send -SELECT a00,a01 FROM t1 WHERE a00 = 'aa'; - ---connection con3 -SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; -# Blocked ---send -SELECT a00,a01 FROM t1 WHERE a00 = 'el'; - ---connection default -# FIXME: These occasionally time out! ---disable_warnings -SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1'; ---enable_warnings -SET DEBUG_SYNC = 'now SIGNAL continue'; - ---connection con1 ---reap - ---connection con2 ---reap - ---connection con3 ---reap - ---connection default - -ANALYZE TABLE t1; -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; - - - -# (3) Insert records to rightmost leaf page (gb..) and cause modify_page -# - root page is not X latched, because node_ptr for 'gb' is the last record -# of the level 1 though it is last record in the page. -# - lathed from level 1 page (el..,gb) - -SET DEBUG_SYNC = 'RESET'; - -# Filling leaf page (gb..) -INSERT INTO t1 (a00) VALUES ('gba'); - ---connection con1 -SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; -# Cause modify_tree ---send -INSERT INTO t1 (a00) VALUES ('gbb'); - ---connection con2 -SET DEBUG_SYNC = 'now WAIT_FOR reached'; -# Not blocked searches -SELECT a00,a01 FROM t1 WHERE a00 = 'aa'; -SELECT a00,a01 FROM t1 WHERE a00 = 'ek'; - -SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; -# Blocked ---send -SELECT a00,a01 FROM t1 WHERE a00 = 'el'; - ---connection con3 -SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; -# Blocked ---send -SELECT a00,a01 FROM t1 WHERE a00 = 'gb'; - ---connection default -# FIXME: These occasionally time out! ---disable_warnings -SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1'; ---enable_warnings -SET DEBUG_SYNC = 'now SIGNAL continue'; - ---connection con1 ---reap - ---connection con2 ---reap - ---connection con3 ---reap - ---connection default -ANALYZE TABLE t1; -SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; - - - -# Cleanup -SET DEBUG_SYNC = 'RESET'; - ---connection default ---disconnect con1 ---disconnect con2 ---disconnect con3 - -DROP TABLE t1; - ---disable_query_log -SET GLOBAL innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug; -SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index; -SET GLOBAL innodb_stats_persistent = @old_innodb_stats_persistent; ---enable_query_log - -# Wait till all disconnects are completed. ---source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/insert-before-delete.test b/mysql-test/suite/innodb/t/insert-before-delete.test new file mode 100644 index 0000000000000..2547b94e5ea86 --- /dev/null +++ b/mysql-test/suite/innodb/t/insert-before-delete.test @@ -0,0 +1,72 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/count_sessions.inc + +--connect (pause_purge,localhost,root) +START TRANSACTION WITH CONSISTENT SNAPSHOT; + +--connection default +CREATE TABLE t (pk int PRIMARY KEY, sk INT UNIQUE) ENGINE=InnoDB; +INSERT INTO t VALUES (10, 100); + +--connect (con1,localhost,root) +BEGIN; # trx 0 +SELECT * FROM t WHERE sk = 100 FOR UPDATE; + +--connect (con2,localhost,root) +SET DEBUG_SYNC="lock_wait_start SIGNAL insert_wait_started"; +# trx 1 is locked on try to read the record in secondary index during duplicates +# check. It's the first in waiting queue, that's why it will be woken up firstly +# when trx 0 commits. +--send INSERT INTO t VALUES (5, 100) # trx 1 + +--connect (con3,localhost,root) +# MDEV-30225 is fixed only for RR +SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SET DEBUG_SYNC="now WAIT_FOR insert_wait_started"; +SET DEBUG_SYNC="lock_wait_start SIGNAL delete_started_waiting"; +# trx 2 can delete (5, 100) on master, but not on slave, as on slave trx 1 +# can insert (5, 100) after trx 2 positioned it's cursor. Trx 2 lock is placed +# in waiting queue after trx 1 lock, but its persistent cursor position was +# stored on (100, 10) record in secondary index before suspending. After trx 1 +# is committed, trx 2 will restore persistent cursor position on (100, 10). As +# (100, 5) secondary index record was inserted before (100, 10) in logical +# order, and (100, 10) record is delete-marked, trx 2 just continues scanning. +# +# Note. There can be several records with the same key in unique secondary +# index, but only one of them must be non-delete-marked. That's why when we do +# point query, cursor position is set in the first record in logical order, and +# then records are iterated until either non-delete-marked record is found or +# all records with the same unique fields are iterated. +--send DELETE FROM t WHERE sk = 100 # trx 2 + +--connection con1 +SET DEBUG_SYNC="now WAIT_FOR delete_started_waiting"; +DELETE FROM t WHERE sk=100; # trx 0 +COMMIT; +--disconnect con1 + +--connection con2 +--reap +--disconnect con2 + +--connection con3 +# If the bug is fixed, deadlock error will be there, as trx 2 owns +# next-key lock waiting for trx 1, and trx 1 requests +# insert-intention lock, conflicting with trx 2 next-key lock. +--error ER_LOCK_DEADLOCK +--reap +--disconnect con3 + +--connection default +# If the bug is not fixed, we will see the row inserted by trx 1 here. This can +# cause duplicate key error on slave, when some other trx tries in insert row +# with the same secondary key, as was inserted by trx 1, and not deleted by trx +# 2. +SELECT * FROM t; + +--disconnect pause_purge +SET DEBUG_SYNC="RESET"; +DROP TABLE t; +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/insert_into_empty.opt b/mysql-test/suite/innodb/t/insert_into_empty.opt new file mode 100644 index 0000000000000..c856c2d215af2 --- /dev/null +++ b/mysql-test/suite/innodb/t/insert_into_empty.opt @@ -0,0 +1 @@ +--innodb_sort_buffer_size=65536 diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test index 1d4f79b3f44c3..8452cecf7008e 100644 --- a/mysql-test/suite/innodb/t/insert_into_empty.test +++ b/mysql-test/suite/innodb/t/insert_into_empty.test @@ -1,5 +1,5 @@ --source include/have_innodb.inc - +--source include/innodb_page_size.inc --source include/have_sequence.inc --source include/maybe_debug.inc --source include/have_partition.inc @@ -51,6 +51,10 @@ SET tx_read_only=1; BEGIN; INSERT INTO t2 VALUES(0); INSERT INTO t VALUES(0); +ROLLBACK; +BEGIN; +INSERT INTO t2 VALUES(0); +INSERT INTO t VALUES(0); COMMIT; INSERT INTO t VALUES(0); @@ -195,6 +199,80 @@ INSERT INTO t VALUES (0); INSERT INTO t VALUES (1),(0),(1); DROP TABLE t; +--echo # +--echo # MDEV-28327 InnoDB persistent statistics fail to update +--echo # after bulk insert +--echo # +CREATE TABLE t1 (a INT PRIMARY KEY)ENGINE=InnoDB +STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; +INSERT INTO t1 SELECT * FROM seq_1_to_4096; +--echo # Wait till statistics update after bulk insert operation +let $wait_condition= select n_rows > 100 from mysql.innodb_table_stats +where table_name="t1"; +source include/wait_condition.inc; +# At innodb_page_size=4k this will be only 4075, not 4096. Add some slack. +# This is related to MDEV-24621 and possibly MDEV-26740. +SELECT n_rows>=4000 FROM mysql.innodb_table_stats WHERE TABLE_NAME="t1"; +DROP TABLE t1; + + +--echo # +--echo # MDEV-27214 Import with disabled keys corrupts meta-data like rows, indexes, ... +--echo # + +CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `a` int(11) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; +INSERT INTO `t1` VALUES (1,2),(2,3),(3,4); +--echo # Wait till statistics update after bulk insert operation +let $wait_condition= select n_rows > 0 from mysql.innodb_table_stats +where database_name='test' and table_name='t1'; +source include/wait_condition.inc; +SELECT TABLE_ROWS, AVG_ROW_LENGTH>0 FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'; +DROP TABLE t1; + +--echo # +--echo # MDEV-29975 InnoDB fails to release savepoint during bulk insert +--echo # +CREATE TABLE t (c INT KEY) ENGINE=InnoDB; +begin; +--error ER_WRONG_VALUE_COUNT_ON_ROW +INSERT INTO t VALUES (0,0); +SAVEPOINT a; +--error ER_ERROR_DURING_COMMIT +INSERT INTO t VALUES (0),(0); +SAVEPOINT a; +commit; +SELECT * FROM t; +DROP TABLE t; + +--echo # +--echo # MDEV-29545 InnoDB: Can't find record during replace stmt +--echo # +CREATE TABLE t1(c1 INT PRIMARY KEY)ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 VALUES(3331); + +connect(con1,localhost,root,,,); +BEGIN; +SELECT c1 FROM t1; + +connection default; +COMMIT; + +connection con1; +REPLACE INTO t1 VALUES(1984), (1984); +COMMIT; +connection default; +disconnect con1; +SELECT * FROM t1; +DROP TABLE t1; +--echo # End of 10.6 tests + --echo # --echo # MDEV-26947 UNIQUE column checks fail in InnoDB resulting --echo # in table corruption @@ -250,3 +328,154 @@ CREATE TABLE t1(f1 MEDIUMTEXT)ENGINE=InnoDB; INSERT INTO t1 VALUES(REPEAT(1, 8459264)); SELECT length(f1) FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-27858 Assertion `page_dir_get_n_heap(new_page) == 2U' failed in PageBulk::init +--echo # +CREATE TABLE t1 (c INT) ENGINE=InnoDB; +CREATE TABLE t2 (c INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1); +LOCK TABLES t1 WRITE,t2 WRITE; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); +DROP TABLE t2, t1; + +--echo # +--echo # MDEV-28138 MariaDB Assertion Failed in mtr_buf_t::has_space +--echo # +CREATE TABLE t1( + f1 SERIAL, + f2 LINESTRING NOT NULL DEFAULT LineFromText('LINESTRING(1 1,2 2,3 3)'), +SPATIAL INDEX(f2))ENGINE=InnoDB; +--error ER_DUP_ENTRY +INSERT INTO t1(f1) VALUES(0), (1), (2); +DROP TABLE t1; + +--echo # +--echo # MDEV-28237 Assertion `0' failed in row_upd_sec_index_entry on DELETE +--echo # +CREATE TABLE t1 (c0 YEAR UNIQUE) ENGINE=InnoDB; +--error ER_ERROR_DURING_COMMIT +INSERT INTO t1 VALUES (0),(0),(0),(0),(0),(0),(0); +DELETE FROM t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-28037 Assertion `trx->bulk_insert' failed in innodb_prepare_commit_versioned +--echo # +CREATE TABLE t1 (c INT) ENGINE=InnoDB; +CREATE TABLE t2 (c INT) ENGINE=InnoDB; +CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW UPDATE t2 SET c=1; +INSERT INTO t1 VALUES (0); +SELECT * FROM t1; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # +--echo # MDEV-28242 Assertion `!check_foreigns' failed in +--echo # trx_t::check_bulk_buffer +--echo # +CREATE TABLE t1 (c INT)ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 VALUES(1), (1); +SET SESSION foreign_key_checks=TRUE; +SHOW CREATE TABLE t1; +CREATE TABLE t2(d INT)ENGINE=InnoDB; +DROP TABLE t2, t1; + +--echo # +--echo # MDEV-28400 Leak in trx_mod_time_t::start_bulk_insert +--echo # + +SET SESSION foreign_key_checks=0; +CREATE TABLE t1 (a INT) ENGINE=InnoDB PARTITION BY HASH(a) PARTITIONS 2; +INSERT INTO t1 VALUES (1),(2); +ALTER TABLE t1 REBUILD PARTITION p0; +# Cleanup +DROP TABLE t1; + +--echo # +--echo # MDEV-29570 InnoDB fails to clean bulk buffer when server +--echo # does rollback operation +--echo # +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB + PARTITION BY RANGE (pk) ( + PARTITION pn VALUES LESS THAN (20)); +--error ER_NO_PARTITION_FOR_GIVEN_VALUE +INSERT INTO t1 VALUES (1),(21); +# Cleanup +DROP TABLE t1; + +--echo # +--echo # MDEV-29761 Bulk insert fails to rollback +--echo # during insert..select +--echo # +CREATE TABLE t1 (f1 INT)ENGINE=InnoDB; +CREATE TABLE t2 (f1 INT, UNIQUE INDEX(f1)) ENGINE=InnoDB; +CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(1); +BEGIN; +INSERT t1 SELECT 1 FROM seq_1_to_2; +COMMIT; +SELECT * FROM t1; +SELECT * FROM t2; +CHECK TABLE t1; +CHECK TABLE t2; +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-29801 Inconsistent ER_TOO_BIG_ROWSIZE during bulk +--echo # insert operation +--echo # +call mtr.add_suppression("InnoDB: Cannot add field `(c0[36]|c11)` in table"); + +SET @format= @@innodb_default_row_format; +CREATE TABLE t1 (pk int primary key, c01 text, c02 text, c03 text, + c04 text, c05 text, c06 text, c07 text, c08 text, + c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB; +SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT; +--replace_result 1982 8126 4030 8126 +ALTER TABLE t1 FORCE; +INSERT IGNORE INTO t1 VALUES +(1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), +(2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); +CHECK TABLE t1; +DROP TABLE t1; +SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= @format; + +--echo # +--echo # MDEV-30321 blob data corrupted by row_merge_write_blob_to_tmp_file() +--echo # + +CREATE TABLE t1 ( + `id` int(11) NOT NULL, + `data` LONGBLOB NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES + (1, REPEAT('X', @@innodb_sort_buffer_size)), + (2, REPEAT('X', @@innodb_sort_buffer_size)); + +SELECT COUNT(*) AS nb_corrupted_rows FROM t1 WHERE data != REPEAT('X', @@innodb_sort_buffer_size); +DROP TABLE t1; + +--echo # End of 10.7 tests + +--echo # +--echo # MDEV-30426 Assertion !rec_offs_nth_extern(offsets2, n) +--echo # during bulk insert +--echo # +CREATE TABLE t1(f1 TEXT NOT NULL, f2 TEXT NOT NULL, + f3 TEXT NOT NULL, f4 TEXT NOT NULL, + f5 TEXT NOT NULL, f6 TEXT NOT NULL, + PRIMARY KEY(f6(10)))ENGINE=InnoDB; +BEGIN; +--error ER_ERROR_DURING_COMMIT +INSERT INTO t1 VALUES + (repeat('a', 200), repeat('b', 200), repeat('c', 200), + repeat('d', 200), repeat('e', 200), repeat('f', 200)), + (repeat('b', 20000), repeat('c', 16000), repeat('d', 12000), + repeat('e', 12000), repeat('f', 12000), repeat('f', 12000)); +COMMIT; +DROP TABLE t1; +--echo # End of 10.8 tests diff --git a/mysql-test/suite/innodb/t/insert_into_empty_debug.test b/mysql-test/suite/innodb/t/insert_into_empty_debug.test new file mode 100644 index 0000000000000..4d2b99bd55443 --- /dev/null +++ b/mysql-test/suite/innodb/t/insert_into_empty_debug.test @@ -0,0 +1,36 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +# Encounter aborted online index during rollback of bulk insert + +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, + PRIMARY KEY(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 2), (2, 2); + +SET DEBUG_SYNC="innodb_rollback_inplace_alter_table SIGNAL dml_start WAIT_FOR dml_commit"; +send ALTER TABLE t1 ADD UNIQUE KEY(f2); + +connect(con1,localhost,root,,,); +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +DELETE FROM t1; +SET DEBUG_SYNC="now SIGNAL dml_commit"; + +connection default; +--error ER_DUP_ENTRY +reap; +connection con1; +COMMIT; +TRUNCATE TABLE t1; +SET unique_checks=0, foreign_key_checks=0; +BEGIN; +INSERT INTO t1 VALUES(1, 2); +ROLLBACK; + +connection default; +SELECT * FROM t1; +SHOW CREATE TABLE t1; +disconnect con1; +DROP TABLE t1; +SET DEBUG_SYNC=RESET; diff --git a/mysql-test/suite/innodb/t/insert_into_empty_notembedded.test b/mysql-test/suite/innodb/t/insert_into_empty_notembedded.test new file mode 100644 index 0000000000000..267501133eab5 --- /dev/null +++ b/mysql-test/suite/innodb/t/insert_into_empty_notembedded.test @@ -0,0 +1,43 @@ +--source include/not_embedded.inc +--source include/have_innodb.inc +--source include/innodb_page_size.inc +--source include/maybe_debug.inc + +--echo # +--echo # Start of 10.6 tests +--echo # + +--echo # +--echo # MDEV-27214 Import with disabled keys corrupts meta-data like rows, indexes, ... +--echo # + +CREATE DATABASE db1; +CREATE TABLE db1.t1 (id int, a int,PRIMARY KEY (id)) ENGINE=InnoDB +STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; +INSERT INTO db1.t1 VALUES (1,2),(2,3),(3,4); +--let $file = $MYSQLTEST_VARDIR/tmp/dump.sql +--exec $MYSQL_DUMP db1 t1 >$file +DROP DATABASE IF EXISTS db1; + +CREATE DATABASE db1; +--exec $MYSQL db1 < $file +--remove_file $file +--echo # Wait till statistics update after bulk insert operation +let $wait_condition= select n_rows > 0 from mysql.innodb_table_stats +where database_name='db1' and table_name='t1'; +source include/wait_condition.inc; +SELECT TABLE_ROWS, AVG_ROW_LENGTH>0 FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='db1'; + +OPTIMIZE TABLE db1.t1; +--echo # Wait till statistics update after bulk insert operation +let $wait_condition= select n_rows > 0 from mysql.innodb_table_stats +where database_name='db1' and table_name='t1'; +source include/wait_condition.inc; +SELECT TABLE_ROWS, AVG_ROW_LENGTH>0 FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='db1'; +DROP DATABASE db1; + +--echo # +--echo # End of 10.6 tests +--echo # diff --git a/mysql-test/suite/innodb/t/instant_alter.test b/mysql-test/suite/innodb/t/instant_alter.test index 22815798f695b..8e333e3bb7238 100644 --- a/mysql-test/suite/innodb/t/instant_alter.test +++ b/mysql-test/suite/innodb/t/instant_alter.test @@ -1,6 +1,8 @@ --source include/innodb_page_size.inc --source include/have_sequence.inc +let $datadir=`select @@datadir`; + --echo # --echo # MDEV-11369: Instant ADD COLUMN for InnoDB --echo # @@ -949,3 +951,19 @@ ALTER TABLE t1 DROP COLUMN f3, ADD FOREIGN KEY fk (f1) ALTER TABLE t1 DROP COLUMN f5; SHOW CREATE TABLE t1; DROP TABLE t1, t2; + + +--echo # +--echo # MDEV-28822 Table from older version requires table rebuild when adding column to table with multi-column index +--echo # + +CREATE TABLE mdev28822_100427_innodb ( + id int not null primary key, + msg varchar(10), + index(id, msg) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +FLUSH TABLES; +remove_file $datadir/test/mdev28822_100427_innodb.frm; +copy_file std_data/mysql_upgrade/mdev28822_100427_innodb.frm $datadir/test/mdev28822_100427_innodb.frm; +ALTER TABLE mdev28822_100427_innodb ADD i1 INTEGER, ALGORITHM=INSTANT; +DROP TABLE mdev28822_100427_innodb; diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test index 03465ee86eee1..b9d631a9213d3 100644 --- a/mysql-test/suite/innodb/t/instant_alter_bugs.test +++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test @@ -208,6 +208,46 @@ ALTER TABLE t1 IMPORT TABLESPACE; SHOW CREATE TABLE t1; SELECT * FROM t1; DROP TABLE t1; + + +--echo # +--echo # MDEV-23801 Assertion index->table->instant... failed +--echo # in btr_pcur_store_position() +--echo # + +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; + +CREATE TABLE t ( + pk int auto_increment, + c01 char(255) not null default repeat('a',255), + c02 char(255) default repeat('a',255), + c03 char(255) default repeat('a',255), + c04 char(255) default repeat('a',255), + c05 char(255) not null default repeat('a',255), + c06 char(255) default repeat('a',255), + c07 char(255) default repeat('a',255), + c08 char(255) not null default repeat('a',255), + c09 char(255) default repeat('a',255), + c10 char(255) default repeat('a',255), + c11 char(255) default repeat('a',255), + c12 char(255) not null default repeat('a',255), + primary key (pk) +) ENGINE=InnoDB CHARACTER SET ucs2; + +INSERT INTO t () VALUES (); +ALTER TABLE t ADD c INT; + +BEGIN; +INSERT INTO t () VALUES (),(); +ROLLBACK; +DELETE FROM t; + +--source include/wait_all_purged.inc +SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency; + +CREATE TABLE tt ENGINE=InnoDB AS SELECT c FROM t; +DROP TABLE t, tt; + --echo # End of 10.3 tests --disable_query_log @@ -473,4 +513,22 @@ ALTER TABLE t ADD d INT; --disable_info DROP TABLE t; +--echo # +--echo # MDEV-28060 Online DDL fails while checking for instant +--echo # alter condition +--echo # +CREATE TABLE t1(f1 CHAR(10) NOT NULL)ROW_FORMAT=REDUNDANT,ENGINE=InnoDB; +ALTER TABLE t1 ADD COLUMN(f2 INT NOT NULL, f3 INT NOT NULL, + f4 INT NOT NULL, f5 INT NOT NULL), + CHANGE COLUMN f1 f1 CHAR(10) DEFAULT NULL; +DROP TABLE t1; SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; + +--echo # +--echo # MDEV-26420 Buffer overflow on instant ADD/DROP of generated column +--echo # +CREATE TABLE t1 (i int AS (0) STORED, j INT) ENGINE=InnoDB; +ALTER TABLE t1 ADD COLUMN i INT GENERATED ALWAYS AS (1), DROP COLUMN i; +DROP TABLE t1; + +--echo # End of 10.4 tests diff --git a/mysql-test/suite/innodb/t/instant_alter_crash.test b/mysql-test/suite/innodb/t/instant_alter_crash.test index ddeaa6885e6d4..37cdb2862ad18 100644 --- a/mysql-test/suite/innodb/t/instant_alter_crash.test +++ b/mysql-test/suite/innodb/t/instant_alter_crash.test @@ -47,6 +47,9 @@ ROLLBACK; INSERT INTO t2 VALUES (16,1551,'Omnium enim rerum'),(128,1571,' principia parva sunt'); +BEGIN; +UPDATE t1 SET c2=c2+1; + connect ddl, localhost, root; SET DEBUG_SYNC='innodb_alter_inplace_before_commit SIGNAL ddl WAIT_FOR ever'; --send @@ -55,7 +58,7 @@ ALTER TABLE t2 DROP COLUMN c3, ADD COLUMN c5 TEXT DEFAULT 'naturam abhorrere'; connection default; SET DEBUG_SYNC='now WAIT_FOR ddl'; SET GLOBAL innodb_flush_log_at_trx_commit=1; -UPDATE t1 SET c2=c2+1; +COMMIT; --source include/kill_mysqld.inc disconnect ddl; @@ -73,6 +76,8 @@ ROLLBACK; --source include/wait_all_purged.inc INSERT INTO t2 VALUES (64,42,'De finibus bonorum'), (347,33101,' et malorum'); +BEGIN; +DELETE FROM t1; connect ddl, localhost, root; ALTER TABLE t2 DROP COLUMN c3; @@ -83,7 +88,7 @@ ALTER TABLE t2 ADD COLUMN (c4 TEXT NOT NULL DEFAULT ' et malorum'); connection default; SET DEBUG_SYNC='now WAIT_FOR ddl'; SET GLOBAL innodb_flush_log_at_trx_commit=1; -DELETE FROM t1; +COMMIT; --source include/kill_mysqld.inc disconnect ddl; @@ -177,6 +182,9 @@ DELETE FROM t2; --echo # --echo # MDEV-24323 Crash on recovery after kill during instant ADD COLUMN --echo # +BEGIN; +INSERT INTO t1 VALUES(0,0); + connect ddl, localhost, root; CREATE TABLE t3(id INT PRIMARY KEY, c2 INT, v2 INT AS(c2) VIRTUAL, UNIQUE(v2)) ENGINE=InnoDB; @@ -189,7 +197,7 @@ ALTER TABLE t3 ADD COLUMN c3 TEXT NOT NULL DEFAULT 'sic transit gloria mundi'; connection default; SET DEBUG_SYNC='now WAIT_FOR ddl'; SET GLOBAL innodb_flush_log_at_trx_commit=1; -INSERT INTO t1 VALUES(0,0); +COMMIT; --source include/kill_mysqld.inc disconnect ddl; @@ -198,6 +206,59 @@ disconnect ddl; SHOW CREATE TABLE t1; SHOW CREATE TABLE t2; SHOW CREATE TABLE t3; -DROP TABLE t1,t2,t3; +DROP TABLE t2,t3; + +--echo # +--echo # MDEV-29440 InnoDB instant ALTER TABLE recovery wrongly uses +--echo # READ COMMITTED isolation level instead of READ UNCOMMITTED +--echo # +CREATE TABLE t2(a INT UNSIGNED PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6); + +BEGIN; +DELETE FROM t1; + +connect ddl, localhost, root; +SET DEBUG_SYNC='innodb_alter_inplace_before_commit SIGNAL ddl WAIT_FOR ever'; +--send +ALTER TABLE t2 ADD COLUMN b TINYINT UNSIGNED NOT NULL DEFAULT 42 FIRST; + +connection default; +SET DEBUG_SYNC='now WAIT_FOR ddl'; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +COMMIT; + +--source include/kill_mysqld.inc +disconnect ddl; +--source include/start_mysqld.inc + +CHECK TABLE t2; +DROP TABLE t1,t2; --list_files $MYSQLD_DATADIR/test + +--echo # +--echo # MDEV-26198 Assertion `0' failed in row_log_table_apply_op during +--echo # ADD PRIMARY KEY or OPTIMIZE TABLE +--echo # +CREATE TABLE t1(f1 year default null, f2 year default null, + f3 text, f4 year default null, f5 year default null, + f6 year default null, f7 year default null, + f8 year default null)ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES(1, 1, 1, 1, 1, 1, 1, 1); +ALTER TABLE t1 ADD COLUMN f9 year default null, ALGORITHM=INPLACE; +set DEBUG_SYNC="row_log_table_apply1_before SIGNAL con1_insert WAIT_FOR con1_finish"; +send ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ADD COLUMN f10 YEAR DEFAULT NULL, ALGORITHM=INPLACE; + +connect(con1,localhost,root,,,); +SET DEBUG_SYNC="now WAIT_FOR con1_insert"; +INSERT IGNORE INTO t1 (f3) VALUES ( 'b' ); +INSERT IGNORE INTO t1 (f3) VALUES ( 'l' ); +SET DEBUG_SYNC="now SIGNAL con1_finish"; + +connection default; +reap; +disconnect con1; +SET DEBUG_SYNC=RESET; +CHECK TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/instant_alter_debug.test b/mysql-test/suite/innodb/t/instant_alter_debug.test index 02464d4f10054..c6eca884907ad 100644 --- a/mysql-test/suite/innodb/t/instant_alter_debug.test +++ b/mysql-test/suite/innodb/t/instant_alter_debug.test @@ -303,7 +303,6 @@ ROLLBACK; SET DEBUG_SYNC = 'now SIGNAL logged'; connection ddl; ---error ER_INVALID_USE_OF_NULL reap; disconnect ddl; @@ -533,11 +532,28 @@ set DEBUG_SYNC='now SIGNAL go'; connection default; reap; -disconnect con1; SELECT * FROM t1; DROP TABLE t1; SET DEBUG_SYNC=RESET; +--echo # +--echo # MDEV-27962 Instant DDL downgrades the MDL when table is empty +--echo # +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL)ENGINE=InnoDB; +SET DEBUG_SYNC="alter_table_inplace_after_lock_downgrade SIGNAL try_insert WAIT_FOR alter_progress"; +send ALTER TABLE t1 ADD INDEX(f1), ADD INDEX(f2); +connection con1; +SET SESSION lock_wait_timeout=1; +SET DEBUG_SYNC="now WAIT_FOR try_insert"; +--error ER_LOCK_WAIT_TIMEOUT +INSERT INTO t1 VALUES(1, 2); +SET DEBUG_SYNC="now SIGNAL alter_progress"; +disconnect con1; +connection default; +reap; +DROP TABLE t1; +SET DEBUG_SYNC=reset; + --echo # End of 10.4 tests --echo # diff --git a/mysql-test/suite/innodb/t/instant_alter_import.test b/mysql-test/suite/innodb/t/instant_alter_import.test index 854b5b3a95391..3a811def17018 100644 --- a/mysql-test/suite/innodb/t/instant_alter_import.test +++ b/mysql-test/suite/innodb/t/instant_alter_import.test @@ -6,6 +6,11 @@ call mtr.add_suppression("Operating system error number .* in a file operation." call mtr.add_suppression("The error means the system cannot find the path specified."); call mtr.add_suppression("File ./test/t1.ibd was not found"); +--disable_query_log +call mtr.add_suppression("Table `test`.`t2` contains unrecognizable instant ALTER metadata"); +call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it"); +--enable_query_log + set default_storage_engine=innodb; --echo # @@ -185,3 +190,46 @@ UNLOCK TABLES; ALTER TABLE t2 IMPORT TABLESPACE; DROP TABLE t2, t1; + + +CREATE TABLE t1 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb; +CREATE TABLE t2 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb; + +ALTER TABLE test.t1 add COLUMN i3 INT AFTER i1; + +ALTER TABLE t2 DISCARD TABLESPACE; +FLUSH TABLES t1 FOR EXPORT; + +--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t2.ibd +--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t2.cfg + +UNLOCK TABLES; +--error ER_NOT_KEYFILE +ALTER TABLE t2 IMPORT TABLESPACE; + +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-28919 Assertion `(((core_null) + 7) >> 3) == +--echo # oindex.n_core_null_bytes || !not_redundant()' failed +--echo # +call mtr.add_suppression(" InnoDB: Tablespace for table `test`.`t` is set as discarded"); +CREATE TABLE t (a INTEGER, b INTEGER as (a) VIRTUAL, + c INTEGER)engine=innodb; +ALTER TABLE t DISCARD TABLESPACE; +FLUSH TABLES; +# Table does reload +ALTER TABLE t DROP COLUMN b, algorithm=instant; +ALTER TABLE t DROP COLUMN c, algorithm=instant; + +CREATE TABLE t1(a INTEGER)ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +FLUSH TABLE t1 FOR EXPORT; +--let $MYSQLD_DATADIR= `select @@datadir` +--move_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t.cfg +--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t.ibd +unlock tables; +ALTER TABLE t IMPORT tablespace; +check table t; +select * from t; +DROP TABLE t, t1; diff --git a/mysql-test/suite/innodb/t/instant_alter_upgrade.test b/mysql-test/suite/innodb/t/instant_alter_upgrade.test new file mode 100644 index 0000000000000..d73fe187a726d --- /dev/null +++ b/mysql-test/suite/innodb/t/instant_alter_upgrade.test @@ -0,0 +1,16 @@ +--source include/have_innodb.inc +--source include/innodb_row_format.inc + +--echo # +--echo # MDEV-26577 InnoDB: Failing assertion: dict_tf2_is_valid(flags, flags2) +--echo # during ADD COLUMN +--echo # + +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +CREATE TABLE t2(a INT PRIMARY KEY) ENGINE=InnoDB; +FLUSH TABLES; +--let $datadir=`select @@datadir` +--remove_file $datadir/test/t2.frm +--copy_file $datadir/test/t1.frm $datadir/test/t2.frm +ALTER TABLE t2 ADD COLUMN b INT; +DROP TABLE t1,t2; diff --git a/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test b/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test index 92c3e2fbb0858..21d5336528a85 100644 --- a/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test +++ b/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test @@ -3,13 +3,15 @@ --disable_query_log call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*test.t1\\.ibd' page"); -call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=\\d+, page number=19\\]"); call mtr.add_suppression("\\[ERROR\\] InnoDB: Failed to read page 19 from file '.*test.t1\\.ibd': Page read from tablespace is corrupted\\."); +call mtr.add_suppression("InnoDB: (Unable to apply log to|Discarding log for) corrupted page .*, page number=19\\]"); call mtr.add_suppression("\\[ERROR\\] InnoDB: Plugin initialization aborted at srv0start\\.cc.* with error Data structure corruption"); call mtr.add_suppression("\\[ERROR\\] Plugin 'InnoDB' (init function|registration)"); call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption"); call mtr.add_suppression("\\[ERROR\\] (mysqld|mariadbd).*: Index for table 't1' is corrupt; try to repair it"); call mtr.add_suppression("InnoDB: btr_pcur_open_low level: 0 table: `test`\\.`t1` index: `PRIMARY`"); +call mtr.add_suppression("InnoDB: File '.*test/t1\\.ibd' is corrupted"); +call mtr.add_suppression("InnoDB: In page .* of index `PRIMARY` of table `test`\\.`t1`"); --enable_query_log CREATE TABLE t1 (pk INT PRIMARY KEY, c CHAR(255))ENGINE=InnoDB STATS_PERSISTENT=0; @@ -47,12 +49,12 @@ EOF --error ER_UNKNOWN_STORAGE_ENGINE SELECT * FROM t1 WHERE PK = 1; +# Force recovery to ignore the corrupted page. let $restart_parameters=--innodb-force-recovery=1; --source include/restart_mysqld.inc SELECT * FROM t1 WHERE PK = 1; --error ER_NOT_KEYFILE SELECT * FROM t1 WHERE pk = 12; +CHECK TABLE t1; DROP TABLE t1; -let $restart_parameters=; ---source include/restart_mysqld.inc diff --git a/mysql-test/suite/innodb/t/lock_delete_updated.test b/mysql-test/suite/innodb/t/lock_delete_updated.test new file mode 100644 index 0000000000000..1f7b13144e4f8 --- /dev/null +++ b/mysql-test/suite/innodb/t/lock_delete_updated.test @@ -0,0 +1,32 @@ +--source include/have_innodb.inc +--source include/count_sessions.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t VALUES (3); + +BEGIN; +UPDATE t SET a = 2; + +connect con1,localhost,root; +SET DEBUG_SYNC="lock_wait_start SIGNAL del_locked"; +send DELETE FROM t; + +connection default; +SET DEBUG_SYNC="now WAIT_FOR del_locked"; +UPDATE t SET a = 1; +COMMIT; + +connection con1; +error ER_LOCK_DEADLOCK; +reap; +disconnect con1; + +connection default; +--echo # The above DELETE must delete all the rows in the table, so the +--echo # following SELECT must show 0 rows. +SELECT count(*) FROM t; +SET DEBUG_SYNC="reset"; +DROP TABLE t; +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/lock_move_wait_lock_race.test b/mysql-test/suite/innodb/t/lock_move_wait_lock_race.test new file mode 100644 index 0000000000000..3a04c7127c821 --- /dev/null +++ b/mysql-test/suite/innodb/t/lock_move_wait_lock_race.test @@ -0,0 +1,58 @@ +--source include/have_innodb.inc +--source include/count_sessions.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +CREATE TABLE t (pk int PRIMARY KEY, c varchar(10)) ENGINE=InnoDB; +INSERT INTO t VALUES (10, "0123456789"); + +--connection default +BEGIN; +SELECT * FROM t WHERE c = 10 FOR UPDATE; + +--connect(trx2, localhost,root,,) +BEGIN; +SET DEBUG_SYNC="lock_wait_start SIGNAL trx2_start_waiting"; +SET DEBUG_SYNC="lock_wait_end SIGNAL trx2_wait_end WAIT_FOR trx2_cont_upd"; +SET DEBUG_SYNC="lock_rec_store_on_page_infimum_end SIGNAL trx2_moved_locks WAIT_FOR trx2_cont"; +################# +# We need to update clustered record without changing ordering fields and +# changing the size of non-ordering fields to cause locks moving from deleted +# record to infimum. +### +--send UPDATE t SET c = NULL WHERE pk = 10 + + +--connect(trx3, localhost,root,,) +SET DEBUG_SYNC="now WAIT_FOR trx2_start_waiting"; +################# +# The condition wariable waiting in lock_wait() must be finished by timeout +### +SET innodb_lock_wait_timeout=1; +BEGIN; +SET DEBUG_SYNC="lock_wait_start SIGNAL trx3_start_waiting WAIT_FOR trx3_cont_waiting"; +SET DEBUG_SYNC="lock_sys_t_cancel_enter SIGNAL trx3_cancel_enter WAIT_FOR trx3_cont_cancel_waiting"; +--send UPDATE t SET c = "abcdefghij" WHERE pk = 10 + +--connection default +SET DEBUG_SYNC="now WAIT_FOR trx3_start_waiting"; +COMMIT; +SET DEBUG_SYNC="now WAIT_FOR trx2_wait_end"; +SET DEBUG_SYNC="now SIGNAL trx3_cont_waiting"; +SET DEBUG_SYNC="now WAIT_FOR trx3_cancel_enter"; +SET DEBUG_SYNC="now SIGNAL trx2_cont_upd"; +SET DEBUG_SYNC="now WAIT_FOR trx2_moved_locks"; +################# +# If the bug is not fixed, there will be assertion failure here, because trx2 +# moved trx3 lock from deleted record to infimum when trx3 tried to cancel the +# lock. +### +SET DEBUG_SYNC="now SIGNAL trx3_cont_cancel_waiting"; +SET DEBUG_SYNC="now SIGNAL trx2_cont"; + +--disconnect trx2 +--disconnect trx3 +--connection default +SET DEBUG_SYNC="RESET"; +DROP TABLE t; +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/lock_update_split_rc.test b/mysql-test/suite/innodb/t/lock_update_split_rc.test new file mode 100644 index 0000000000000..38910e53ef33a --- /dev/null +++ b/mysql-test/suite/innodb/t/lock_update_split_rc.test @@ -0,0 +1,76 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/count_sessions.inc + +CREATE TABLE t ( + `a` INT NOT NULL, + `b` INT NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB; + +--disable_query_log +SET @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug; +--enable_query_log + +SET GLOBAL innodb_limit_optimistic_insert_debug = 3; + +INSERT INTO t VALUES(10, 0); +INSERT INTO t VALUES(20, 0); +INSERT INTO t VALUES(30, 0); + +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +XA START '1'; +REPLACE INTO t VALUES(10, 1); +REPLACE INTO t VALUES(20, 1); + +# We need the following sync point because mysql_insert() resets +# trx->duplicates with the following condition: +# +# if (duplic == DUP_REPLACE && +# (!table->triggers || !table->triggers->has_delete_triggers())) +# table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE); +# +# and ha_innobase::extra() resets trx_t::duplicates, but we need +# lock_update_split_right() to be invoked when trx->duplicates is set to +# repeat the bug. So the transaction will hang just after +# row_insert_for_mysql() call until another transaction inserts new row and +# splits the page. +SET DEBUG_SYNC= 'ib_after_row_insert SIGNAL inserted WAIT_FOR cont'; +--send REPLACE INTO t VALUES(30, 1) + +connect (con1,localhost,root); +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +XA START '2'; +SET DEBUG_SYNC= 'now WAIT_FOR inserted'; +# The following statement will cause page split and (20, ...) will be split +# record. As the previous REPLACE set non-gap X-lock on it, +# lock_update_split_right() and lock_rec_inherit_to_gap() will 'inherit' the +# lock from the very first (20, ...) new right page record to the supremum of +# the old left page, what should not be for READ COMMITTED isolation level +INSERT INTO t VALUES(40, 2); +SET DEBUG_SYNC= 'now SIGNAL cont'; + +--connection default +--reap +XA END '1'; +# This will cause the assertion failure, because the supremum of the left page +# has X-lock. +XA PREPARE '1'; +--connection default +XA COMMIT '1'; + +--connection con1 +XA END '2'; +XA PREPARE '2'; +XA COMMIT '2'; +--disconnect con1 + +--connection default +SET DEBUG_SYNC= "RESET"; +DROP TABLE t; + +--disable_query_log +SET GLOBAL innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug; +--enable_query_log + +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/lock_wait_conflict.test b/mysql-test/suite/innodb/t/lock_wait_conflict.test deleted file mode 100644 index 46a29e14b43f9..0000000000000 --- a/mysql-test/suite/innodb/t/lock_wait_conflict.test +++ /dev/null @@ -1,60 +0,0 @@ ---source include/have_innodb.inc ---source include/count_sessions.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc - ---echo # ---echo # MDEV-27025 insert-intention lock conflicts with waiting ORDINARY lock ---echo # - -# The test checks the ability to acquire exclusive record lock if the acquiring -# transaction already holds a shared lock on the record and another transaction -# is waiting for a lock. - -CREATE TABLE t (a INT PRIMARY KEY, b INT NOT NULL UNIQUE) ENGINE=InnoDB; - ---connect(prevent_purge,localhost,root,,) -start transaction with consistent snapshot; - ---connection default -INSERT INTO t VALUES (20,20); -DELETE FROM t WHERE b = 20; - ---connect(con_ins,localhost,root,,) -SET DEBUG_SYNC = 'row_ins_sec_index_entry_dup_locks_created SIGNAL ins_set_locks WAIT_FOR ins_cont'; -send -INSERT INTO t VALUES(10, 20); - ---connect(con_del,localhost,root,,) -SET DEBUG_SYNC = 'now WAIT_FOR ins_set_locks'; -SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL del_locked'; -############################################################################### -# This DELETE creates waiting ORDINARY X-lock for heap_no 2 as the record is -# delete-marked, this lock conflicts with ORDINARY S-lock set by the the last -# INSERT. After the last INSERT creates insert-intention lock on -# heap_no 2, this lock will conflict with waiting ORDINARY X-lock of this -# DELETE, what causes DEADLOCK error for this DELETE. -############################################################################### -send -DELETE FROM t WHERE b = 20; - ---connection default -SET DEBUG_SYNC = 'now WAIT_FOR del_locked'; -SET DEBUG_SYNC = 'now SIGNAL ins_cont'; - ---connection con_ins ---reap ---disconnect con_ins - ---connection con_del -# Without the fix, ER_LOCK_DEADLOCK would be reported here. ---reap ---disconnect con_del - ---disconnect prevent_purge - ---connection default - -SET DEBUG_SYNC = 'RESET'; -DROP TABLE t; ---source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/log_corruption.test b/mysql-test/suite/innodb/t/log_corruption.test index dad5f67afcaf8..6f7080f5b502e 100644 --- a/mysql-test/suite/innodb/t/log_corruption.test +++ b/mysql-test/suite/innodb/t/log_corruption.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_innodb_16k.inc +--source include/no_valgrind_without_big.inc --disable_query_log call mtr.add_suppression("InnoDB: Upgrade after a crash is not supported"); @@ -16,7 +17,8 @@ call mtr.add_suppression("InnoDB: Log scan aborted at LSN"); call mtr.add_suppression("InnoDB: Missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT for tablespace 42\\r?$"); call mtr.add_suppression("InnoDB: Obtaining redo log encryption key version 1 failed"); call mtr.add_suppression("InnoDB: Decrypting checkpoint failed"); -call mtr.add_suppression("InnoDB: Log file .*ib_logfile1 is of different size 2097152 bytes than other log files 1048576 bytes!"); +call mtr.add_suppression("InnoDB: Log file .*ib_logfile1 is of different size 2097152 bytes than other log files (1048576|4194304) bytes!"); +call mtr.add_suppression("InnoDB: The change buffer is corrupted"); --enable_query_log let bugdir= $MYSQLTEST_VARDIR/tmp/log_corruption; @@ -161,7 +163,7 @@ die unless seek(OUT, 0x800, 0); print OUT pack("NnnNx[496]N", 0x80000944, 12, 12, 0, 0xb2a); close OUT or die; EOF ---let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=2m +--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m --source include/start_mysqld.inc SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' @@ -191,7 +193,7 @@ print OUT chr(0) x 2048; close OUT or die; EOF ---let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=2m +--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m --source include/start_mysqld.inc SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' @@ -210,7 +212,7 @@ print OUT chr(0) x 1536; close OUT or die; EOF ---let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=2m +--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m --source include/start_mysqld.inc SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' @@ -241,7 +243,7 @@ close OUT or die; EOF --echo # Corrupted multi-file redo log from after MariaDB 10.2.2 ---let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=2m +--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m --source include/start_mysqld.inc SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' @@ -259,13 +261,14 @@ print OUT chr(0); close OUT or die; EOF ---let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=2m +--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m --source include/start_mysqld.inc SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); --source include/shutdown_mysqld.inc --let SEARCH_PATTERN=InnoDB: Log file .*ib_logfile1 is of different size 2097152 bytes than other log files 1048576 bytes! +--source include/search_pattern_in_file.inc --let SEARCH_PATTERN=InnoDB: No valid checkpoint was found; the log was created with BogoDB 1\\.2\\.3\\.4\\. --source include/search_pattern_in_file.inc @@ -282,7 +285,7 @@ print OUT $_, pack("N", mycrc32($_, 0, $polynomial)); close OUT or die; EOF ---let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=2m +--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m --source include/start_mysqld.inc SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' @@ -304,6 +307,8 @@ EOF --source include/start_mysqld.inc eval $check_no_innodb; --source include/shutdown_mysqld.inc +--let SEARCH_PATTERN=InnoDB: Log file .*ib_logfile1 is of different size 2097152 bytes than other log files 4194304 bytes! +--source include/search_pattern_in_file.inc let SEARCH_PATTERN=InnoDB: Invalid log header checksum; --source include/search_pattern_in_file.inc @@ -351,6 +356,9 @@ die unless seek(OUT, 0x210, 0); print OUT pack("NNx[264]", 0, 0x80c); print OUT pack("NNx[212]N", 0x590dbaac, 0xfe922582, 0xc72d49c4); close OUT or die; +die unless open OUT, ">", "$ENV{bugdir}/ib_logfile1"; +print OUT pack("x[4194304]"); +close OUT or die; EOF # Anything below innodb_force_recovery=6 must find a valid redo log. # Missing tablespace files are tolerated already with innodb_force_recovery=1. @@ -533,7 +541,7 @@ print OUT pack("NnnNx[496]N", 0x80000944, 12, 12, 1, 0x46c8a2a2); close OUT or die; EOF ---let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=2m +--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m --source include/start_mysqld.inc SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' diff --git a/mysql-test/suite/innodb/t/log_file.test b/mysql-test/suite/innodb/t/log_file.test index 0f26622e2b6ba..438fbe1a6e1fa 100644 --- a/mysql-test/suite/innodb/t/log_file.test +++ b/mysql-test/suite/innodb/t/log_file.test @@ -3,6 +3,7 @@ --echo # Bug#16418661 - CHANGING NAME IN FOR INNODB_DATA_FILE_PATH SHOULD NOT SUCCEED WITH LOG FILES --source include/have_innodb.inc +--source include/no_valgrind_without_big.inc --disable_query_log call mtr.add_suppression("InnoDB: Could not create undo tablespace.*undo002"); diff --git a/mysql-test/suite/innodb/t/log_file_name.test b/mysql-test/suite/innodb/t/log_file_name.test index b0935c90ca324..eb616d7f835db 100644 --- a/mysql-test/suite/innodb/t/log_file_name.test +++ b/mysql-test/suite/innodb/t/log_file_name.test @@ -2,7 +2,7 @@ # Test the detection of duplicate tablespaces. --source include/have_innodb.inc ---source include/not_valgrind.inc +--source include/no_valgrind_without_big.inc # Embedded server does not support crashing --source include/not_embedded.inc diff --git a/mysql-test/suite/innodb/t/log_file_name_debug.test b/mysql-test/suite/innodb/t/log_file_name_debug.test deleted file mode 100644 index 9ef3c9ff4dcd1..0000000000000 --- a/mysql-test/suite/innodb/t/log_file_name_debug.test +++ /dev/null @@ -1,50 +0,0 @@ ---source include/have_innodb.inc -# Embedded server does not support restarting ---source include/not_embedded.inc ---source include/have_debug.inc - ---echo # ---echo # Bug#19685095 DO NOT CARE ABOUT UNRESOLVED MLOG_FILE_NAME ---echo # IF THERE ARE NO OPERATIONS TO APPLY ---echo # - -SET GLOBAL DEBUG_DBUG='+d,fil_names_write_bogus'; ---disable_query_log -call mtr.add_suppression("InnoDB: Plugin initialization aborted"); -call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); -call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed"); -FLUSH TABLES; ---enable_query_log - ---let $change=`SELECT if(@@innodb_log_file_size = 4194304, 8388608, 4194304)` ---let $resize= --innodb-log-file-size=$change - ---source include/no_checkpoint_start.inc - -CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; - ---let CLEANUP_IF_CHECKPOINT=DROP TABLE t1; ---source include/no_checkpoint_end.inc - ---let $restart_parameters= --debug=d,innodb_log_abort_1 $resize ---source include/start_mysqld.inc ---error ER_UNKNOWN_STORAGE_ENGINE -SELECT * FROM t1; - ---let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err ---let SEARCH_PATTERN = InnoDB: Tablespace 4294967280 was not found at .*, but there were no modifications either ---source include/search_pattern_in_file.inc - ---let $restart_parameters= --debug=d,innodb_log_abort_5,ib_log $resize ---source include/restart_mysqld.inc ---error ER_UNKNOWN_STORAGE_ENGINE -SELECT * FROM t1; ---let SEARCH_PATTERN= ib_log: FILE_CHECKPOINT.* written ---source include/search_pattern_in_file.inc - ---let $restart_parameters= ---source include/restart_mysqld.inc -# Initiate shutdown in order to issue a redo log checkpoint and to discard -# the redo log record that was emitted due to '+d,fil_names_write_bogus'. ---source include/restart_mysqld.inc -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/log_file_size.test b/mysql-test/suite/innodb/t/log_file_size.test index 22838475c609e..261b024fa4179 100644 --- a/mysql-test/suite/innodb/t/log_file_size.test +++ b/mysql-test/suite/innodb/t/log_file_size.test @@ -55,7 +55,7 @@ let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); ---let $restart_parameters= --innodb-log-file-size=2m +--let $restart_parameters= --innodb-log-file-size=4m --source include/start_mysqld.inc let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; diff --git a/mysql-test/suite/innodb/t/log_upgrade.test b/mysql-test/suite/innodb/t/log_upgrade.test new file mode 100644 index 0000000000000..faf88c41bef23 --- /dev/null +++ b/mysql-test/suite/innodb/t/log_upgrade.test @@ -0,0 +1,120 @@ +--source include/have_innodb.inc +--source include/have_innodb_16k.inc +# Some operating systems or file systems do not support sparse files. +# For example, tmpfs on FreeBSD does not support them. +# On Microsoft Windows, sparse files have to be created in a special way. +--source include/big_test.inc +# include/shutdown_mysqld.inc does not work in ./mtr --embedded +--source include/not_embedded.inc + +call mtr.add_suppression("InnoDB: The change buffer is corrupted"); + +--source include/shutdown_mysqld.inc + +let bugdir= $MYSQLTEST_VARDIR/tmp/log_upgrade; +--mkdir $bugdir +--let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err + +--let $dirs= --innodb-data-home-dir=$bugdir --innodb-log-group-home-dir=$bugdir + +--echo # +--echo # MDEV-24412 InnoDB: Upgrade after a crash is not supported +--echo # + +perl; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl"; +my $polynomial = 0x82f63b78; # CRC-32C + +# Create a dummy system tablespace file using the default innodb_page_size=16k +die unless open OUT, ">", "$ENV{bugdir}/ibdata1"; +binmode OUT; + +# We calculate innodb_checksum_algorithm=crc32 for the pages. +# The following bytes are excluded: +# bytes 0..3 (the checksum is stored there) +# bytes 26..37 (encryption key version, post-encryption checksum, tablespace id) +# bytes $page_size-8..$page_size-1 (checksum, LSB of FIL_PAGE_LSN) + +# Tablespace header page with valid FSP_SIZE=768 pages. +# Also, write a dummy FSEG_MAGIC_N at offset 60 to keep fseg_inode_try_get() +# happy when fseg_n_reserved_pages() is following an invalid pointer +# from the all-zero change buffer header page (page 3). +## FIL_PAGE_OFFSET +my $head = pack("Nx[18]", 0); +## FSP_PAGE_SIZE, # FSEG_MAGIC_N +my $body = pack("x[8]Nx[10]Nx[16312]", 768, 97937874); +my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); +print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck); +# Dummy pages 1..6. +print OUT chr(0) x (6 * 16384); +# Dictionary header page (page 7). +## FIL_PAGE_OFFSET +$head = pack("Nx[18]", 7); +## DICT_HDR_TABLES,DICT_HDR_INDEXES +$body = pack("x[32]Nx[8]Nx[16290]", 8, 9); +$ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); +print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck); + +# Empty SYS_TABLES page (page 8). +## FIL_PAGE_OFFSET, FIL_PAGE_PREV, FIL_PAGE_NEXT, FIL_PAGE_TYPE +$head = pack("NNNx[8]n", 8, ~0, ~0, 17855); +## PAGE_N_DIR_SLOTS, PAGE_HEAP_TOP, PAGE_INDEX_ID == DICT_TABLES_ID +$body = pack("nnx[31]Cx[20]", 2, 124, 1); +$body .= pack("nxnn", 0x801, 3, 116) . "infimum"; +$body .= pack("xnxnxx", 0x901, 0x803) . "supremum"; +$body .= pack("x[16248]nn", 116, 101); +$ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); +print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck); + +# Empty SYS_INDEXES page (page 9). +## FIL_PAGE_OFFSET, FIL_PAGE_PREV, FIL_PAGE_NEXT, FIL_PAGE_TYPE +$head = pack("NNNx[8]n", 9, ~0, ~0, 17855); +## PAGE_N_DIR_SLOTS, PAGE_HEAP_TOP, PAGE_INDEX_ID == DICT_INDEXES_ID +$body = pack("nnx[31]Cx[20]", 2, 124, 3); +$body .= pack("nxnn", 0x801, 3, 116) . "infimum"; +$body .= pack("xnxnxx", 0x901, 0x803) . "supremum"; +$body .= pack("x[16248]nn", 116, 101); +$ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); +print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck); + +die unless seek(OUT, 768 * 16384 - 1, 0); +print OUT chr(0); +close OUT or die; + +die unless open OUT, ">", "$ENV{bugdir}/ib_logfile0"; +binmode OUT; +$_= pack("Nx[5]nx[5]", 1, 0x1286) . "BogoDB 4.3.2.1" . chr(0) x 478; +print OUT $_, pack("N", mycrc32($_, 0, $polynomial)); +# checkpoint page 1 and all-zero checkpoint 2 +$_= pack("x[13]nCNNx[484]", 0x1286, 12, 2, 0x80c); +print OUT $_, pack("N", mycrc32($_, 0, $polynomial)); +die unless seek(OUT, 0x1FFFFFFFF, 0); +print OUT chr(0); +close OUT or die; +die unless open OUT, ">", "$ENV{bugdir}/ib_logfile1"; +binmode OUT; +die unless seek(OUT, 0x800, 0); # the first 2048 bytes are unused! +$_= pack("Nnnx[500]", 0x80000944, 12, 12); +print OUT $_, pack("N", mycrc32($_, 0, $polynomial)); +die unless seek(OUT, 0x1FFFFFFFF, 0); +print OUT chr(0); +close OUT or die; +EOF + +--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m +--source include/start_mysqld.inc +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +--source include/shutdown_mysqld.inc +--let SEARCH_PATTERN= InnoDB: Upgrading redo log: +--source include/search_pattern_in_file.inc +--let $restart_parameters= $dirs + +--list_files $bugdir +--remove_files_wildcard $bugdir +--rmdir $bugdir +--let $restart_parameters= +--source include/start_mysqld.inc + +--echo # End of 10.5 tests diff --git a/mysql-test/suite/innodb/t/mdev-14846.test b/mysql-test/suite/innodb/t/mdev-14846.test index adcefecd52f25..b1f323025910a 100644 --- a/mysql-test/suite/innodb/t/mdev-14846.test +++ b/mysql-test/suite/innodb/t/mdev-14846.test @@ -35,6 +35,7 @@ SET DEBUG_SYNC='now WAIT_FOR con1_dml'; begin; SELECT * FROM t1 for update; # Holds x lock of all records in the table t1 SET DEBUG_SYNC='now SIGNAL default_dml'; +SET DEBUG_SYNC='now SIGNAL con2_dml'; --connection default SET DEBUG_SYNC='now WAIT_FOR default_dml'; @@ -42,7 +43,7 @@ SET DEBUG_SYNC='now WAIT_FOR default_dml'; # It holds the lock of all record in t3 and tries to acquire record lock for the table t1. --connect (con2,localhost,root,,test) -set debug_sync='now WAIT_FOR default_dml'; +set debug_sync='now WAIT_FOR con2_dml'; let $wait_condition= select count(*) > 0 from information_schema.innodb_lock_waits; --source include/wait_condition.inc diff --git a/mysql-test/suite/innodb/t/missing_tablespaces.test b/mysql-test/suite/innodb/t/missing_tablespaces.test index 9f970ca2dd243..7aeb0a26f3042 100644 --- a/mysql-test/suite/innodb/t/missing_tablespaces.test +++ b/mysql-test/suite/innodb/t/missing_tablespaces.test @@ -4,6 +4,7 @@ --source include/not_embedded.inc #Windows has trouble creating files/directories with long names --source include/not_windows.inc +--source include/no_valgrind_without_big.inc --echo # --echo # Bug#19419026 WHEN A TABLESPACE IS NOT FOUND, DO NOT REPORT "TABLE NOT FOUND" diff --git a/mysql-test/suite/innodb/t/monitor.test b/mysql-test/suite/innodb/t/monitor.test index 3a004b22751e7..d6fa3f2fbc98e 100644 --- a/mysql-test/suite/innodb/t/monitor.test +++ b/mysql-test/suite/innodb/t/monitor.test @@ -468,6 +468,9 @@ INSERT INTO t1 VALUES(1,1,'a'),(2,9999,'b'),(3,10000,'c'),(4,4,'d'); DELETE FROM t1 WHERE a = 9999 AND b='b'; COMMIT; +# After MDEV-30225 is fixed, the above DELETE creates next-key lock during +# secondary index unique search. That's why the result of the following must +# be 1. SET @end = (SELECT COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME = 'lock_rec_lock_created'); SELECT @end - @start; diff --git a/mysql-test/suite/innodb/t/no_pad.test b/mysql-test/suite/innodb/t/no_pad.test new file mode 100644 index 0000000000000..1be1972c9cad9 --- /dev/null +++ b/mysql-test/suite/innodb/t/no_pad.test @@ -0,0 +1,10 @@ +--source include/have_innodb.inc + +CREATE TABLE t1 (a CHAR(8), id INT, PRIMARY KEY (a,id)) COLLATE utf8_nopad_bin +ENGINE=InnoDB ROW_FORMAT=REDUNDANT; + +INSERT INTO t1 VALUES ('',1); +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('',2); +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/online_table_rebuild.opt b/mysql-test/suite/innodb/t/online_table_rebuild.opt new file mode 100644 index 0000000000000..fa3418284bf87 --- /dev/null +++ b/mysql-test/suite/innodb/t/online_table_rebuild.opt @@ -0,0 +1,2 @@ +--innodb_online_alter_log_max_size=64k +--innodb_sort_buffer_size=64k diff --git a/mysql-test/suite/innodb/t/online_table_rebuild.test b/mysql-test/suite/innodb/t/online_table_rebuild.test new file mode 100644 index 0000000000000..02e9639eae244 --- /dev/null +++ b/mysql-test/suite/innodb/t/online_table_rebuild.test @@ -0,0 +1,87 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_sequence.inc + +CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(200), f3 CHAR(200))ENGINE=InnoDB; +INSERT INTO t1 VALUES(3, "innodb", "alter log"); + +# InnoDB fails with DUPLICATE KEY error in commit phase + +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +send ALTER TABLE t1 ADD PRIMARY KEY(f3(10)), ADD UNIQUE KEY(f2(10)); +CONNECT(con1,localhost,root,,,); +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +INSERT INTO t1 VALUES(1, repeat('b', 100), repeat('c', 100)); +INSERT INTO t1 VALUES(2, repeat('b', 100), repeat('a', 100)); +COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; + +connection default; +--error ER_DUP_ENTRY +reap; + +# ONLINE_LOG_TOO_BIG error during commit phase + +connection default; + +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +SEND ALTER TABLE t1 ADD PRIMARY KEY(f1); + +connection con1; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +INSERT INTO t1 SELECT 10, repeat('a', 100), repeat('b', 100) FROM seq_1_to_4800; +SET DEBUG_SYNC="now SIGNAL dml_commit"; + +connection default; +--error ER_INNODB_ONLINE_LOG_TOO_BIG +reap; +DELETE FROM t1; +INSERT INTO t1 VALUES(1, repeat('a', 100), repeat('b', 100)); +ALTER TABLE t1 ADD PRIMARY KEY(f1); + +# Update operation leads to duplicate key error + +set DEBUG_SYNC="innodb_inplace_alter_table_enter SIGNAL dml_start WAIT_FOR dml_commit"; +SEND ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(f3(10)); + +connection con1; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +INSERT INTO t1 VALUES(2, repeat('b', 100), repeat('c', 100)); +UPDATE t1 set f3=repeat('c', 100) where f1=1; +COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; + +connection default; +--error ER_DUP_ENTRY +reap; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-30183 Assertion `!memcmp(rec_trx_id, old_pk_trx_id->data, +--echo # 6 + 7)' failed in row_log_table_apply_update +--echo # +set @old_sql_mode = @@sql_mode; +set @@sql_mode=""; +CREATE TABLE t1(col_int int, col_varchar varchar(500))ENGINE=InnoDB; +INSERT INTO t1(col_int) values(2560); +set debug_sync="row_log_table_apply1_before SIGNAL con1_begin WAIT_FOR con1_commit"; +send ALTER TABLE t1 ADD PRIMARY KEY ( col_varchar); + +connection con1; +SET DEBUG_SYNC="now WAIT_FOR con1_begin"; +UPDATE t1 SET col_int = 2178; +INSERT INTO t1(col_int) VALUES(3016); +UPDATE t1 set col_int=2802; +SET DEBUG_SYNC="now SIGNAL con1_commit"; + +connection default; +--error ER_DUP_ENTRY +reap; +DROP TABLE t1; +SET @@sql_mode = @old_sql_mode; +disconnect con1; +SET DEBUG_SYNC=reset; diff --git a/mysql-test/suite/innodb/t/page_id_innochecksum.test b/mysql-test/suite/innodb/t/page_id_innochecksum.test index f5166018dd1aa..2a2c14844faef 100644 --- a/mysql-test/suite/innodb/t/page_id_innochecksum.test +++ b/mysql-test/suite/innodb/t/page_id_innochecksum.test @@ -61,9 +61,11 @@ let SEARCH_PATTERN=page id mismatch; --source include/search_pattern_in_file.inc --remove_file $resultlog -# prevent purge from crashing on page ID mismatch -let $restart_parameters=--innodb-force-recovery=2; +let $restart_parameters=--innodb-force-recovery=1; --source include/start_mysqld.inc +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; +--source include/wait_all_purged.inc drop table t1; +call mtr.add_suppression("InnoDB: Failed to read page 3 from file '.*test/t1\\.ibd': Page read from tablespace is corrupted\\."); let $restart_parameters=; --source include/restart_mysqld.inc diff --git a/mysql-test/suite/innodb/t/page_reorganize.test b/mysql-test/suite/innodb/t/page_reorganize.test index 7408353976dc6..c4e0160cb6d63 100644 --- a/mysql-test/suite/innodb/t/page_reorganize.test +++ b/mysql-test/suite/innodb/t/page_reorganize.test @@ -53,4 +53,12 @@ connection default; drop table t1; +--echo # +--echo # MDEV-27993 Assertion failed in btr_page_reorganize_low() +--echo # +CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB; +SET DEBUG_DBUG = '+d,do_page_reorganize'; +INSERT INTO t1 VALUES(0,0); +DROP TABLE t1; + --source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/purge_secondary.test b/mysql-test/suite/innodb/t/purge_secondary.test index f2c85ce10e7ff..1a0d178f66adc 100644 --- a/mysql-test/suite/innodb/t/purge_secondary.test +++ b/mysql-test/suite/innodb/t/purge_secondary.test @@ -139,4 +139,36 @@ WHERE LOWER(variable_name) LIKE 'INNODB_BUFFER_POOL_PAGES_FLUSHED'; DROP TABLE t1; +--echo # +--echo # MDEV-29666 InnoDB fails to purge secondary index records +--echo # when indexed virtual columns exist +--echo # + +CREATE TABLE t1 (a INT, b INT, a1 INT AS(a) VIRTUAL, +INDEX(a1),INDEX(b)) ENGINE=InnoDB; +INSERT INTO t1 SET a=1, b=1; + +UPDATE t1 SET a=2, b=3; +let DATADIR=`select @@datadir`; +let PAGE_SIZE=`select @@innodb_page_size`; + +source include/wait_all_purged.inc; +FLUSH TABLE t1 FOR EXPORT; + +perl; +my $ps = $ENV{PAGE_SIZE}; +my $file = "$ENV{DATADIR}/test/t1.ibd"; +open(FILE, "<", $file) or die "Unable to open $file\n"; +die "Unable to read $file\n" unless + sysread(FILE, $_, 6*$ps) == 6*$ps; +close(FILE); +print "page 4: N_RECS=0x", unpack("H*", substr($_, 4 * $ps + 54, 2)), "\n"; +print "page 5: N_RECS=0x", unpack("H*", substr($_, 5 * $ps + 54, 2)), "\n"; +EOF + +UNLOCK TABLES; +DROP TABLE t1; + +--echo # End of 10.3 tests + SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/innodb/t/purge_thread_shutdown.test b/mysql-test/suite/innodb/t/purge_thread_shutdown.test index 5be29b7a6a3b8..762336cf0d14d 100644 --- a/mysql-test/suite/innodb/t/purge_thread_shutdown.test +++ b/mysql-test/suite/innodb/t/purge_thread_shutdown.test @@ -12,8 +12,8 @@ select user,state from information_schema.processlist order by 2; set global debug_dbug='+d,only_kill_system_threads'; set global innodb_fast_shutdown=0; -let $_server_id= `SELECT @@server_id`; -let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect; +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect exec echo "wait" > $_expect_file_name; send shutdown; diff --git a/mysql-test/suite/innodb/t/read_only_recover_committed.test b/mysql-test/suite/innodb/t/read_only_recover_committed.test index 6252c774a2590..d61fbd3c52216 100644 --- a/mysql-test/suite/innodb/t/read_only_recover_committed.test +++ b/mysql-test/suite/innodb/t/read_only_recover_committed.test @@ -1,8 +1,10 @@ --source include/have_innodb.inc --source include/have_debug.inc --source include/have_debug_sync.inc +--source include/no_valgrind_without_big.inc # need to restart server --source include/not_embedded.inc +--source include/no_valgrind_without_big.inc --disable_query_log # Ignore messages from the innodb_force_recovery=5 startup. diff --git a/mysql-test/suite/innodb/t/recovery_memory.opt b/mysql-test/suite/innodb/t/recovery_memory.opt new file mode 100644 index 0000000000000..7207fd27a4212 --- /dev/null +++ b/mysql-test/suite/innodb/t/recovery_memory.opt @@ -0,0 +1 @@ +--innodb_buffer_pool_size=1073741824 diff --git a/mysql-test/suite/innodb/t/recovery_memory.test b/mysql-test/suite/innodb/t/recovery_memory.test new file mode 100644 index 0000000000000..145b39d56f6f0 --- /dev/null +++ b/mysql-test/suite/innodb/t/recovery_memory.test @@ -0,0 +1,51 @@ +--source include/have_innodb.inc +--source include/big_test.inc +--source include/have_sequence.inc +--source include/maybe_debug.inc +call mtr.add_suppression("InnoDB: The change buffer is corrupted"); +call mtr.add_suppression("InnoDB: Plugin initialization aborted at srv0start.cc"); +call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); +call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed."); +CREATE TABLE t1(c TEXT, KEY(c(3072)))ENGINE=InnoDB; +DELIMITER |; + +CREATE PROCEDURE dorepeat() + LOOP + INSERT INTO t1 VALUES ('abc'); + UPDATE t1 SET c='cba'; + END LOOP +| + +DELIMITER ;| +connect(con1,localhost,root,,,); +send CALL dorepeat(); +connection default; +sleep 10; +let $shutdown_timeout=0; +let $restart_parameters=--innodb_buffer_pool_size=5242880; +--source include/restart_mysqld.inc +DROP TABLE t1; +DROP PROCEDURE dorepeat; + +--echo # +--echo # MDEV-30552 InnoDB recovery crashes when error +--echo # handling scenario +--echo # +if ($have_debug) { +SET DEBUG_DBUG="+d,ib_log_checkpoint_avoid_hard"; +let $restart_parameters=--innodb_buffer_pool_size=5242880 --debug_dbug="+d,ibuf_init_corrupt"; +} +if (!$have_debug) { +--echo SET DEBUG_DBUG="+d,ib_log_checkpoint_avoid_hard"; +let $restart_parameters=--innodb_buffer_pool_size=5242880; +} +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +INSERT INTO t1 SELECT * FROM seq_1_to_65536; +let $restart_noprint=1; +let $shutdown_timeout=0; +--source include/restart_mysqld.inc +let $restart_noprint=0; +let $restart_parameters=; +--source include/restart_mysqld.inc +SHOW CREATE TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/recovery_shutdown.test b/mysql-test/suite/innodb/t/recovery_shutdown.test index d9079f2e42cef..968ea62833a81 100644 --- a/mysql-test/suite/innodb/t/recovery_shutdown.test +++ b/mysql-test/suite/innodb/t/recovery_shutdown.test @@ -1,8 +1,7 @@ --source include/have_innodb.inc --source include/not_embedded.inc -# Valgrind has to be disabled as killing the server hard gives a lot of -# leak warnings ---source include/not_valgrind.inc +--source include/no_valgrind_without_big.inc +--source include/have_sequence.inc # Flush any open myisam tables from previous tests FLUSH TABLES; @@ -13,24 +12,14 @@ call mtr.add_suppression("Found 1 prepared XA transactions"); --echo # while rolling back recovered incomplete transactions --echo # -CREATE TABLE t (a INT) ENGINE=InnoDB; let $size = 100; let $trx = 8; -let $c = $size; -BEGIN; ---disable_query_log -while ($c) { -INSERT INTO t VALUES(); -dec $c; -} ---enable_query_log -COMMIT; let $c = $trx; connect (con$c,localhost,root,,); eval CREATE TABLE t$c (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; XA START 'x'; -eval INSERT INTO t$c (a) SELECT NULL FROM t; +eval INSERT INTO t$c (a) SELECT NULL FROM seq_1_to_$size; eval UPDATE t$c SET a=a+$size, b=a; eval DELETE FROM t$c; XA END 'x'; @@ -41,28 +30,24 @@ while ($c) connect (con$c,localhost,root,,); eval CREATE TABLE t$c (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; BEGIN; -eval INSERT INTO t$c (a) SELECT NULL FROM t; +eval INSERT INTO t$c (a) SELECT NULL FROM seq_1_to_$size; eval UPDATE t$c SET a=a+$size, b=a; eval DELETE FROM t$c; dec $c; } -INSERT INTO t1(a) SELECT NULL FROM t; -INSERT INTO t1(a) SELECT NULL FROM t1; -INSERT INTO t1(a) SELECT NULL FROM t1; -INSERT INTO t1(a) SELECT NULL FROM t1; -INSERT INTO t1(a) SELECT NULL FROM t1; +INSERT INTO t1(a) SELECT NULL FROM seq_1_to_1600; --connection default SET GLOBAL innodb_flush_log_at_trx_commit=1; -CREATE TABLE u(a SERIAL) ENGINE=INNODB; +CREATE TABLE MDEV_29559 (a TINYINT UNSIGNED PRIMARY KEY, KEY(a)) ENGINE=InnoDB; +INSERT INTO MDEV_29559 VALUES (0x69); FLUSH TABLES; --let $shutdown_timeout=0 --source include/restart_mysqld.inc --let $shutdown_timeout=60 ---source include/restart_mysqld.inc # Perform a slow shutdown in order to roll back all recovered transactions # and to avoid locking conflicts with the DROP TABLE below. @@ -85,4 +70,4 @@ dec $c; } --enable_query_log -DROP TABLE t,u; +DROP TABLE MDEV_29559; diff --git a/mysql-test/suite/innodb/t/restart.opt b/mysql-test/suite/innodb/t/restart.opt new file mode 100644 index 0000000000000..ce43e89cb2bf8 --- /dev/null +++ b/mysql-test/suite/innodb/t/restart.opt @@ -0,0 +1,2 @@ +--loose-innodb_disable_resize_buffer_pool_debug=0 +--innodb-buffer-pool-chunk-size=1M diff --git a/mysql-test/suite/innodb/t/restart.test b/mysql-test/suite/innodb/t/restart.test index a5f2e5a42e8ce..a1e45b37f9c89 100644 --- a/mysql-test/suite/innodb/t/restart.test +++ b/mysql-test/suite/innodb/t/restart.test @@ -1,8 +1,10 @@ --source include/innodb_page_size.inc --source include/not_embedded.inc +--source include/have_symlink.inc let datadir= `select @@datadir`; let page_size= `select @@innodb_page_size`; +let tmp_in_vardir=$MYSQLTEST_VARDIR/tmp; --echo # --echo # MDEV-15333 MariaDB (still) slow start @@ -14,6 +16,9 @@ let page_size= `select @@innodb_page_size`; --echo # FIXME: Unlike MySQL, maybe MariaDB should not read the .ibd files --echo # of tables with .isl file or DATA DIRECTORY attribute. +call mtr.add_suppression("\\[ERROR\\] InnoDB: MySQL-8\\.0 tablespace in "); +call mtr.add_suppression("\\[ERROR\\] InnoDB: Restart in MySQL for migration/recovery\\."); + --echo # FIXME: This is much more noisy than MariaDB 10.1! call mtr.add_suppression("\\[ERROR\\] InnoDB: Tablespace flags are invalid in datafile: .*test.t[rcd]\\.ibd"); call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number .* in a file operation\\."); @@ -23,19 +28,19 @@ call mtr.add_suppression("\\[Warning\\] InnoDB: Ignoring tablespace for test/td CREATE TABLE tr(a INT)ENGINE=InnoDB ROW_FORMAT=REDUNDANT; CREATE TABLE tc(a INT)ENGINE=InnoDB ROW_FORMAT=COMPACT PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9; ---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR +--replace_result $tmp_in_vardir MYSQL_TMP_DIR eval CREATE TABLE td(a INT)ENGINE=InnoDB ROW_FORMAT=DYNAMIC -STATS_PERSISTENT=0 DATA DIRECTORY='$MYSQL_TMP_DIR'; +STATS_PERSISTENT=0 DATA DIRECTORY='$tmp_in_vardir'; --source include/shutdown_mysqld.inc --move_file $datadir/test/tr.ibd $datadir/test/tr0.ibd --move_file $datadir/test/tc.ibd $datadir/test/tc0.ibd ---move_file $MYSQL_TMP_DIR/test/td.ibd $datadir/test/td0.ibd +--move_file $tmp_in_vardir/test/td.ibd $datadir/test/td0.ibd # TODO: test that MariaDB does not even attempt to open the files #--mkdir $datadir/test/tr.ibd #--mkdir $datadir/test/tc.ibd -#--mkdir $MYSQL_TMP_DIR/test/td.ibd +#--mkdir $tmp_in_vardir/test/td.ibd perl; die unless open OUT, ">", "$ENV{datadir}/test/tr.ibd"; @@ -44,8 +49,8 @@ close OUT or die; die unless open OUT, ">", "$ENV{datadir}/test/tc.ibd"; print OUT "bar " x $ENV{page_size}; close OUT or die; -die unless open OUT, ">", "$ENV{MYSQL_TMP_DIR}/test/td.ibd"; -print OUT "xyz " x $ENV{page_size}; +die unless open OUT, ">", "$ENV{tmp_in_vardir}/test/td.ibd"; +print OUT "Xyz " x $ENV{page_size}; close OUT or die; die unless open ISL, "+<", "$ENV{datadir}/test/td.isl"; $_=; @@ -71,17 +76,95 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED'); # TODO: test that MariaDB does not even attempt to open the files #--rmdir $datadir/test/tr.ibd #--rmdir $datadir/test/tc.ibd -#--rmdir $MYSQL_TMP_DIR/test/td.ibd +#--rmdir $tmp_in_vardir/test/td.ibd --remove_file $datadir/test/tr.ibd --remove_file $datadir/test/tc.ibd ---remove_file $MYSQL_TMP_DIR/test/td.ibd +--remove_file $tmp_in_vardir/test/td.ibd --move_file $datadir/test/tr0.ibd $datadir/test/tr.ibd --move_file $datadir/test/tc0.ibd $datadir/test/tc.ibd ---move_file $datadir/test/td0.ibd $MYSQL_TMP_DIR/test/td.ibd +--move_file $datadir/test/td0.ibd $tmp_in_vardir/test/td.ibd --source include/start_mysqld.inc SELECT * FROM tr; SELECT * FROM tc; SELECT * FROM td; DROP TABLE tr,tc,td; + +--echo # +--echo # MDEV-27467 innodb to enfore the minimum innodb_buffer_pool_size in SET (resize) the same as startup +--echo # + +let $wait_timeout = 180; +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' + FROM information_schema.global_status + WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; + +SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; +SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; +--error ER_WRONG_VALUE_FOR_VAR +EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); + +SHOW WARNINGS; + +EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); + +--source include/wait_condition.inc + +SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; + +--echo # +--echo # MDEV-27882 Innodb - recognise MySQL-8.0 innodb flags and give a specific error message +--echo # + +--let MYSQLD_DATADIR= `SELECT @@datadir` + +--source include/shutdown_mysqld.inc + +--move_file $MYSQLD_DATADIR/ibdata1 $MYSQLD_DATADIR/ibdata1.bak +--copy_file std_data/mysql80/ibdata1_$page_size $MYSQLD_DATADIR/ibdata1 + +perl; +use IO::Handle; +my $size = 9 * 1048576; +if ($ENV{MTR_COMBINATION_32K}) { + $size *= 2; +} +if ($ENV{MTR_COMBINATION_64K}) { + $size *= 4; +} +$size -= $ENV{page_size}; +die unless open(FILE, ">>", "$ENV{MYSQLD_DATADIR}/ibdata1"); +binmode FILE; + +print FILE chr(0) x $size; +close(FILE); +EOF + +--let ibdata_size='9M' +if ($MTR_COMBINATION_32K) +{ +--let ibdata_size='18M' +} +if ($MTR_COMBINATION_64K) +{ +--let ibdata_size='36M' +} + +--error 1 +exec $MYSQLD --no-defaults --skip-networking --innodb_data_file_path=ibdata1:$ibdata_size --innodb-page-size=$page_size --datadir=$MYSQLD_DATADIR --log-error=$tmp_in_vardir/attempted_start.err; + +let SEARCH_FILE= $tmp_in_vardir/attempted_start.err; +let SEARCH_PATTERN= InnoDB: MySQL-8\.0 tablespace in \./ibdata1; +source include/search_pattern_in_file.inc; + +--remove_file $tmp_in_vardir/attempted_start.err +--remove_file $MYSQLD_DATADIR/ibdata1 +--move_file $MYSQLD_DATADIR/ibdata1.bak $MYSQLD_DATADIR/ibdata1 + +--source include/start_mysqld.inc + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/suite/innodb/t/row_format_redundant.opt b/mysql-test/suite/innodb/t/row_format_redundant.opt new file mode 100644 index 0000000000000..c44c611ed60c7 --- /dev/null +++ b/mysql-test/suite/innodb/t/row_format_redundant.opt @@ -0,0 +1 @@ +--innodb-checksum-algorithm=crc32 diff --git a/mysql-test/suite/innodb/t/row_format_redundant.test b/mysql-test/suite/innodb/t/row_format_redundant.test index aadbfd2b77396..6de7597e98335 100644 --- a/mysql-test/suite/innodb/t/row_format_redundant.test +++ b/mysql-test/suite/innodb/t/row_format_redundant.test @@ -1,6 +1,7 @@ --source include/have_innodb.inc # Embedded mode doesn't allow restarting --source include/not_embedded.inc +--source include/have_sequence.inc --disable_query_log call mtr.add_suppression("InnoDB: Table `mysql`\\.`innodb_table_stats` not found"); @@ -21,6 +22,8 @@ let bugdir= $MYSQLTEST_VARDIR/tmp/row_format_redundant; --let $d=$d --innodb-data-file-path=ibdata1:1M:autoextend --let $d=$d --innodb-undo-tablespaces=0 --innodb-stats-persistent=0 --let $restart_parameters= $d +# Ensure that any DDL records from previous tests have been purged. +SET GLOBAL innodb_fast_shutdown=0; --source include/restart_mysqld.inc SET GLOBAL innodb_file_per_table=1; @@ -35,27 +38,21 @@ create table t1 (a int not null, d varchar(15) not null, b varchar(198) not null, c char(156)) engine=InnoDB row_format=redundant; -insert into t1 values(123, 'abcdef', 'jghikl', 'mnop'); -insert into t1 values(456, 'abcdef', 'jghikl', 'mnop'); -insert into t1 values(789, 'abcdef', 'jghikl', 'mnop'); -insert into t1 values(134, 'kasdfsdsadf', 'adfjlasdkfjasd', 'adfsadflkasdasdfljasdf'); -insert into t1 select * from t1; -insert into t1 select * from t1; -insert into t1 select * from t1; -insert into t1 select * from t1; -insert into t1 select * from t1; -insert into t1 select * from t1; -insert into t1 select * from t1; -insert into t1 select * from t1; -insert into t1 select * from t1; -insert into t1 select * from t1; +create temporary table t like t1; + +insert into t values(123, 'abcdef', 'jghikl', 'mnop'); +insert into t values(456, 'abcdef', 'jghikl', 'mnop'); +insert into t values(789, 'abcdef', 'jghikl', 'mnop'); +insert into t values(134, 'kasdfsdsadf', 'adfjlasdkfjasd', 'adfsadflkasdasdfljasdf'); + +insert into t1 select a,d,b,c from t, seq_1_to_1024; SET GLOBAL innodb_file_per_table=OFF; create table t2 (a int not null, d varchar(15) not null, b varchar(198) not null, c char(156), fulltext ftsic(c)) engine=InnoDB row_format=redundant; -insert into t2 select * from t1; +insert into t2 select a,d,b,c from t, seq_1_to_1024; create table t3 (a int not null, d varchar(15) not null, b varchar(198), c varchar(150), index k1(c(99), b(56)), index k2(b(5), c(10))) engine=InnoDB diff --git a/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test b/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test index af6c15e0e6bf0..209c86a29b5da 100644 --- a/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test +++ b/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test @@ -1,10 +1,14 @@ --source include/have_innodb.inc +--source include/have_sequence.inc +--source include/innodb_page_size_small.inc call mtr.add_suppression("InnoDB: Cannot add field .* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page."); SET innodb_strict_mode = 0; SET @@global.log_warnings = 3; +# Check the Warning | 139 | Row size too large (> 16318) +--replace_regex /> [0-9]+/> NNNN/ CREATE TABLE t1 ( col_1 TEXT ,col_2 TEXT @@ -19,14 +23,65 @@ CREATE TABLE t1 ( ,col_11 TEXT ) ENGINE=INNODB ROW_FORMAT=COMPACT; --enable_warnings +--replace_regex /> [0-9]+/> NNNN/ TRUNCATE TABLE t1; +--replace_regex /> [0-9]+/> NNNN/ OPTIMIZE TABLE t1; +--replace_regex /> [0-9]+/> NNNN/ ALTER TABLE t1 FORCE; SET innodb_strict_mode = ON; +--replace_regex /> [0-9]+/> NNNN/ TRUNCATE TABLE t1; +--replace_regex /> [0-9]+/> NNNN/ OPTIMIZE TABLE t1; +--replace_regex /> [0-9]+/> NNNN/ ALTER TABLE t1 FORCE; DROP TABLE t1; --disable_warnings SET @@global.log_warnings = 2; + +--echo # +--echo # MDEV-20194 Warnings inconsistently issued upon CHECK on +--echo # table from older versions +--echo # +set global innodb_compression_level=1; +CREATE TABLE t1( + f1 INT, f2 CHAR(200), f3 CHAR(200), + f4 CHAR(200), f5 CHAR(200), f6 CHAR(200), + f7 CHAR(200), f8 CHAR(200), f9 CHAR(200), + f10 CHAR(200), PRIMARY KEY(f1, f2(20), f3(20), f4(20)) + ) ROW_FORMAT=COMPRESSED, ENGINE=InnoDB; + +INSERT INTO t1 SELECT seq, repeat('a', 200), repeat('b', 200), + repeat('c', 200), repeat('d', 200), + repeat('d', 200), repeat('e', 200), + repeat('e', 200), repeat('f', 200), + repeat('g', 200) FROM seq_1_to_20; +DROP TABLE t1; +set global innodb_compression_level=default; + +# Maximum field in the index + +--error ER_TOO_MANY_KEY_PARTS +CREATE TABLE t1(f1 char(200), f2 char(200), f3 char(200), + f4 char(200), f5 char(200), f6 char(200), + f7 char(200), f8 char(200), f9 char(200), + f10 char(200), f11 char(200), f12 char(200), + f13 char(200), f14 char(200), f15 char(200), + f16 char(200), f17 char(200), f18 char(200), + f19 char(200), f20 char(200), f21 char(200), + f22 char(200), f23 char(200), f24 char(200), + f25 char(200), f26 char(200), f27 char(200), + f28 char(200), f29 char(200), f30 char(200), + f31 char(200), f32 char(200), f33 char(200), + primary key(f1(10), f2(10), f3(10), f4(10), + f5(10), f6(10), f7(10), f8(10), + f9(10), f10(10), f11(10), f12(10), + f13(10), f14(10), f15(10), f16(10), + f17(10), f18(10), f19(10), f20(10), + f21(10), f22(10), f23(10), f24(10), + f25(10), f26(10), f27(10), f28(10), + f29(10), f30(10), f31(10), f32(10), + f33(10))) + ENGINE=InnoDB; diff --git a/mysql-test/suite/innodb/t/skip_symbolic_links.opt b/mysql-test/suite/innodb/t/skip_symbolic_links.opt new file mode 100644 index 0000000000000..c7844699cdbed --- /dev/null +++ b/mysql-test/suite/innodb/t/skip_symbolic_links.opt @@ -0,0 +1 @@ +--skip-symbolic-links diff --git a/mysql-test/suite/innodb/t/skip_symbolic_links.test b/mysql-test/suite/innodb/t/skip_symbolic_links.test new file mode 100644 index 0000000000000..b5274d220c8b1 --- /dev/null +++ b/mysql-test/suite/innodb/t/skip_symbolic_links.test @@ -0,0 +1,51 @@ +--source include/have_innodb.inc +--source include/not_windows.inc + +SELECT @@have_symlink; +--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR +eval CREATE TABLE t1(a INT) ENGINE=InnoDB DATA DIRECTORY '$MYSQL_TMP_DIR'; +DROP TABLE t1; +CREATE TABLE t1(a INT) ENGINE=InnoDB; + +--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR +eval ALTER TABLE t1 DATA DIRECTORY '$MYSQL_TMP_DIR'; +SHOW CREATE TABLE t1; + +DROP TABLE t1; + +--let $restart_parameters=--symbolic-links +--source include/restart_mysqld.inc + +--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR +eval CREATE TABLE t1(a INT PRIMARY KEY, b INT) ENGINE=InnoDB +DATA DIRECTORY '$MYSQL_TMP_DIR'; +--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR +eval CREATE TABLE t2(a INT PRIMARY KEY, b INT) ENGINE=InnoDB +DATA DIRECTORY '$MYSQL_TMP_DIR'; + +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; + +--let $restart_parameters= +--source include/restart_mysqld.inc + +# Native ALTER will retain DATA DIRECTORY +ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; +ALTER TABLE t2 FORCE, ALGORITHM=COPY; +OPTIMIZE TABLE t1; +--list_files $MYSQL_TMP_DIR/test +DROP TABLE t2; + +RENAME TABLE t1 TO t2; +ALTER TABLE t2 ADD UNIQUE INDEX(b), RENAME TO t3; + +ALTER TABLE t3 RENAME TO t2; +ALTER TABLE t2 DROP INDEX b, RENAME TO t1; +ALTER TABLE t1 CHANGE b c INT; +ALTER TABLE t1 CHANGE c b INT NOT NULL; + +--list_files $MYSQL_TMP_DIR/test +# TRUNCATE TABLE will discard DATA DIRECTORY. +TRUNCATE TABLE t1; +--list_files $MYSQL_TMP_DIR/test +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/sql_mode_pad_char_to_full_length.test b/mysql-test/suite/innodb/t/sql_mode_pad_char_to_full_length.test new file mode 100644 index 0000000000000..ba286c744d90d --- /dev/null +++ b/mysql-test/suite/innodb/t/sql_mode_pad_char_to_full_length.test @@ -0,0 +1,18 @@ +--source include/have_innodb.inc + +SET default_storage_engine=InnoDB; + +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic +--echo # + +--source include/sql_mode_pad_char_to_full_length.inc + + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/suite/innodb/t/stat_tables.test b/mysql-test/suite/innodb/t/stat_tables.test index 68344b3f4259f..dd18c265e9903 100644 --- a/mysql-test/suite/innodb/t/stat_tables.test +++ b/mysql-test/suite/innodb/t/stat_tables.test @@ -15,3 +15,17 @@ select * from t1; drop table t1; rename table mysql.table_stats_save to mysql.table_stats; flush tables; + +--echo # +--echo # MDEV-26753 Assertion state == TRX_STATE_PREPARED ||... failed +--echo # +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; +XA START 'test'; +SELECT COUNT(*)>0 FROM mysql.innodb_index_stats LOCK IN SHARE MODE; +INSERT INTO t1 VALUES (1),(2); +UPDATE mysql.innodb_table_stats SET last_update=NULL WHERE table_name='t1'; +XA END 'test'; +XA ROLLBACK 'test'; +DROP TABLE t1; + +--echo # End of 10.6 tests diff --git a/mysql-test/suite/innodb/t/stats_persistent.test b/mysql-test/suite/innodb/t/stats_persistent.test index ac412d56d0df5..8561298c4d3f9 100644 --- a/mysql-test/suite/innodb/t/stats_persistent.test +++ b/mysql-test/suite/innodb/t/stats_persistent.test @@ -14,7 +14,8 @@ SET DEBUG_SYNC='dict_stats_update_persistent SIGNAL stop WAIT_FOR go'; --connect(con1, localhost, root) SET DEBUG_SYNC='now WAIT_FOR stop'; -SELECT ENGINE,SUM(DATA_LENGTH+INDEX_LENGTH),COUNT(ENGINE),SUM(DATA_LENGTH),SUM(INDEX_LENGTH) FROM information_schema.TABLES WHERE ENGINE='InnoDB'; +--replace_column 1 SUM +SELECT SUM(DATA_LENGTH+INDEX_LENGTH) FROM information_schema.TABLES WHERE ENGINE='InnoDB'; SET DEBUG_SYNC='now SIGNAL go'; --disconnect con1 diff --git a/mysql-test/suite/innodb/t/table_definition_cache_debug.test b/mysql-test/suite/innodb/t/table_definition_cache_debug.test index 6a466af4cc571..8950691e05c8a 100644 --- a/mysql-test/suite/innodb/t/table_definition_cache_debug.test +++ b/mysql-test/suite/innodb/t/table_definition_cache_debug.test @@ -29,6 +29,7 @@ SET DEBUG_SYNC = 'now WAIT_FOR scanned'; # and then hogs the table lock, so that the unique index cannot be dropped. BEGIN; INSERT INTO to_be_evicted VALUES(3, 2); +COMMIT; SET DEBUG_SYNC = 'now SIGNAL got_duplicate'; connection ddl; diff --git a/mysql-test/suite/innodb/t/table_flags.test b/mysql-test/suite/innodb/t/table_flags.test index 380052b9db666..6b2e6ee3ea629 100644 --- a/mysql-test/suite/innodb/t/table_flags.test +++ b/mysql-test/suite/innodb/t/table_flags.test @@ -1,6 +1,12 @@ --source include/innodb_page_size.inc # Embedded server tests do not support restarting --source include/not_embedded.inc +# Slow shutdown may take more than 120 seconds under Valgrind, +# causing the server to be (silently) killed. +# Due to that, crash recovery could "heal" the damage that our +# Perl code is inflicting, and the SELECT statements could succeed +# instead of failing with ER_NO_SUCH_TABLE_IN_ENGINE. +--source include/not_valgrind.inc --disable_query_log call mtr.add_suppression("InnoDB: Table `mysql`\\.`innodb_table_stats` not found"); diff --git a/mysql-test/suite/innodb/t/temporary_table.test b/mysql-test/suite/innodb/t/temporary_table.test index 594ab95ef582c..b0bc95dcd7ed0 100644 --- a/mysql-test/suite/innodb/t/temporary_table.test +++ b/mysql-test/suite/innodb/t/temporary_table.test @@ -5,13 +5,14 @@ # --source include/have_innodb.inc +--source include/innodb_page_size.inc # Embedded server does not restart of server --source include/not_embedded.inc --source include/no_valgrind_without_big.inc --disable_query_log -call mtr.add_suppression("Can't create/write to file '/dev/null/nonexistent/ib"); call mtr.add_suppression("Can't create/write to file '' \\\(Errcode: 20 \"Not a directory\"\\\)"); +call mtr.add_suppression("Can't create/write to file '/dev/null/.*/ib"); call mtr.add_suppression("InnoDB: Unable to create temporary file"); call mtr.add_suppression("last file in setting innodb_temp_data_file_path"); call mtr.add_suppression("The table 't1' is full"); @@ -134,7 +135,7 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED'); # We cannot use include/restart_mysqld.inc in this particular test, # because SHOW STATUS would fail due to unwritable (nonexistent) tmpdir. --source include/shutdown_mysqld.inc ---exec echo "restart: --tmpdir=/dev/null/nonexistent --skip-innodb-fast-shutdown" > $_expect_file_name +--exec echo "restart: --tmpdir=/dev/null/$MYSQL_TMP_DIR --skip-innodb-fast-shutdown" > $_expect_file_name --enable_reconnect --disable_result_log --disable_query_log @@ -612,3 +613,26 @@ INSERT INTO t VALUES (1); START TRANSACTION READ ONLY; UPDATE t SET a = NULL; ROLLBACK; +DROP TABLE t; + +--echo # +--echo # MDEV-29886 Assertion !index->table->is_temporary() failed +--echo # in trx_undo_prev_version_build upon CHECK +--echo # +CREATE TEMPORARY TABLE t (a INT, KEY(a)) ENGINE=InnoDB SELECT 1; +UPDATE t SET a=2; +CHECK TABLE t; +CHECK TABLE t EXTENDED; +DROP TEMPORARY TABLE t; + +--echo # +--echo # MDEV-29978 Corruption errors upon CHECK on temporary InnoDB table +--echo # + +CREATE TEMPORARY TABLE t (f INT UNIQUE) ENGINE=InnoDB; +INSERT INTO t (f) VALUES (1),(2); +CHECK TABLE t; +CHECK TABLE t EXTENDED; +DROP TEMPORARY TABLE t; + +--echo # End of 10.6 tests diff --git a/mysql-test/suite/innodb/t/truncate_crash.test b/mysql-test/suite/innodb/t/truncate_crash.test index 5cb39c745dc35..27b8feea8a42a 100644 --- a/mysql-test/suite/innodb/t/truncate_crash.test +++ b/mysql-test/suite/innodb/t/truncate_crash.test @@ -17,7 +17,13 @@ SET DEBUG_SYNC='now WAIT_FOR c'; --source include/restart_mysqld.inc disconnect wait; +SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; +--source include/wait_all_purged.inc +SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; + --replace_result 2 0 SELECT COUNT(*) FROM t1; TRUNCATE TABLE t1; DROP TABLE t1; + diff --git a/mysql-test/suite/innodb/t/truncate_foreign.test b/mysql-test/suite/innodb/t/truncate_foreign.test index e40029e18beb5..abbe1b3df870b 100644 --- a/mysql-test/suite/innodb/t/truncate_foreign.test +++ b/mysql-test/suite/innodb/t/truncate_foreign.test @@ -92,8 +92,19 @@ SET FOREIGN_KEY_CHECKS=0; ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (a), ALGORITHM=COPY; INSERT INTO t1 VALUES (1,1); LOCK TABLES t1 WRITE; +SET FOREIGN_KEY_CHECKS=1; --error ER_CANNOT_ADD_FOREIGN TRUNCATE t1; +# Whether TRUNCATE succeeds or fails, it will reload FOREIGN KEY constraints. +# As a result, ha_innobase::referenced_by_foreign_key() will retun TRUE +# (for the self-referential key), and the statement will fail. +--error ER_TABLE_NOT_LOCKED +INSERT INTO t1 VALUES (2,2); +SELECT * FROM t1; +UNLOCK TABLES; +--error ER_NO_REFERENCED_ROW_2 +INSERT INTO t1 VALUES (2,2); +SET FOREIGN_KEY_CHECKS=0; INSERT INTO t1 VALUES (2,2); SELECT * FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/trx_id_future.test b/mysql-test/suite/innodb/t/trx_id_future.test index b897800fa91b0..18077549cf68a 100644 --- a/mysql-test/suite/innodb/t/trx_id_future.test +++ b/mysql-test/suite/innodb/t/trx_id_future.test @@ -57,19 +57,11 @@ syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n"; close(FILE) || die "Unable to close $file"; EOF -# Debug assertions would fail due to the injected corruption. ---let $restart_parameters= --loose-skip-debug-assert --source include/start_mysqld.inc - -let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; -let SEARCH_PATTERN= \[Warning\] InnoDB: A transaction id in a record of table `test`\.`t1` is newer than the system-wide maximum; ---source include/search_pattern_in_file.inc - call mtr.add_suppression("\\[Warning\\] InnoDB: A transaction id in a record of table `test`\\.`t1` is newer than the system-wide maximum"); +call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption"); +call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it"); -# A debug assertion would cause a duplicated message to be output. -SET @save_count = @@max_error_count; -SET max_error_count = 1; +--error ER_NOT_KEYFILE SELECT * FROM t1; -SET max_error_count = @save_count; DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/undo_truncate.opt b/mysql-test/suite/innodb/t/undo_truncate.opt index f4d78725c6ea0..5e331e832fd3d 100644 --- a/mysql-test/suite/innodb/t/undo_truncate.opt +++ b/mysql-test/suite/innodb/t/undo_truncate.opt @@ -1 +1,3 @@ --innodb-buffer-pool-size=24M +--innodb-immediate-scrub-data-uncompressed=ON +--loose-innodb-sys-tablespaces diff --git a/mysql-test/suite/innodb/t/undo_truncate.test b/mysql-test/suite/innodb/t/undo_truncate.test index cf8c1a8d5e36e..496eccb002e43 100644 --- a/mysql-test/suite/innodb/t/undo_truncate.test +++ b/mysql-test/suite/innodb/t/undo_truncate.test @@ -3,14 +3,21 @@ --source include/have_undo_tablespaces.inc --source include/not_embedded.inc --source include/have_sequence.inc +--source include/no_valgrind_without_big.inc --disable_query_log call mtr.add_suppression("InnoDB: Difficult to find free blocks in the buffer pool"); +--disable_query_log +# This may be triggered on a slow system. +call mtr.add_suppression("InnoDB: Trying to delete tablespace.*pending operations"); --enable_query_log SET GLOBAL innodb_undo_log_truncate = 0; SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; +LET $MYSQLD_DATADIR = `select @@datadir`; +LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`; +--source suite/innodb/include/show_i_s_tablespaces.inc #----------------------------------------------------------------------------- # # Perform DML action using multiple clients and multiple undo tablespace. @@ -46,6 +53,8 @@ connection default; let $trx_before= `SHOW ENGINE INNODB STATUS`; let $trx_before= `select substr('$trx_before',9)+2`; +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; +SET GLOBAL innodb_max_purge_lag_wait=0; set global innodb_fast_shutdown=0; --source include/restart_mysqld.inc --replace_regex /.*Trx id counter ([0-9]+).*/\1/ diff --git a/mysql-test/suite/innodb/t/update-cascade.test b/mysql-test/suite/innodb/t/update-cascade.test index de8294703b4af..69e81ac4a2f80 100644 --- a/mysql-test/suite/innodb/t/update-cascade.test +++ b/mysql-test/suite/innodb/t/update-cascade.test @@ -28,7 +28,7 @@ start transaction; select f1, f2 from t2 for update; connection default; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL upd_waiting WAIT_FOR go_upd'; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; send update t1 set f1 = 10 where f1 = 2; connection con1; @@ -72,7 +72,7 @@ start transaction; select f1, f2 from t2 for update; connection default; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL upd_waiting WAIT_FOR go_upd'; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; send update t1 set f2 = 28 where f2 = 91; connection con1; @@ -120,7 +120,7 @@ start transaction; select f1 from t3 for update; connection default; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL upd_waiting WAIT_FOR go_upd'; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; send update t1 set f1 = 10 where f1 = 2; connection con1; @@ -183,7 +183,7 @@ start transaction; select f1 from t3 for update; connection default; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL upd_waiting WAIT_FOR go_upd'; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; send update t1 set f2 = 28 where f2 = 91; connection con1; diff --git a/mysql-test/suite/innodb/t/update_time.test b/mysql-test/suite/innodb/t/update_time.test index 35b583b51022f..ce8418904c90b 100644 --- a/mysql-test/suite/innodb/t/update_time.test +++ b/mysql-test/suite/innodb/t/update_time.test @@ -5,12 +5,8 @@ -- echo # -- source include/have_innodb.inc --- source include/have_innodb_max_16k.inc # restart does not work with embedded -- source include/not_embedded.inc -# This test is slow on buildbot. ---source include/big_test.inc ---source include/have_sequence.inc CREATE TABLE t (a INT) ENGINE=INNODB STATS_PERSISTENT=0; @@ -28,29 +24,10 @@ AND update_time IS NOT NULL; SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' AND TIMESTAMPDIFF(SECOND, update_time, NOW()) < 120; -CREATE TEMPORARY TABLE big (a TEXT) ENGINE=INNODB; - -SELECT COUNT(*) FROM information_schema.innodb_buffer_page -WHERE table_name = '`test`.`t`'; - -# evict table 't' by inserting as much data as the BP size itself -INSERT INTO big SELECT REPEAT('a', 1024) FROM seq_1_to_10240; - -# confirm that all pages for table 't' have been evicted -SELECT COUNT(*) FROM information_schema.innodb_buffer_page -WHERE table_name = '`test`.`t`'; - -# The result from this query will change once update_time becomes persistent -# (WL#6917). -SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' -AND update_time IS NOT NULL; - -DROP TEMPORARY TABLE big; - -- echo # Test the behavior after restart with a prepared XA transaction XA START 'xatrx'; -INSERT INTO t VALUES (5); +DELETE FROM t; XA END 'xatrx'; XA PREPARE 'xatrx'; diff --git a/mysql-test/suite/innodb/t/xa_recovery.test b/mysql-test/suite/innodb/t/xa_recovery.test index 7a67cd8e8b763..cfb8224018732 100644 --- a/mysql-test/suite/innodb/t/xa_recovery.test +++ b/mysql-test/suite/innodb/t/xa_recovery.test @@ -1,6 +1,7 @@ --source include/have_innodb.inc # Embedded server does not support restarting. --source include/not_embedded.inc +--source include/no_valgrind_without_big.inc # MDEV-8841 - close tables opened by previous tests, # so they don't get marked crashed when the server gets crashed diff --git a/mysql-test/suite/innodb_fts/r/basic.result b/mysql-test/suite/innodb_fts/r/basic.result index a98de60674a0c..a8ab0c043e431 100644 --- a/mysql-test/suite/innodb_fts/r/basic.result +++ b/mysql-test/suite/innodb_fts/r/basic.result @@ -5,12 +5,6 @@ body TEXT, FULLTEXT (title,body) ) ENGINE=InnoDB; ERROR HY000: Cannot create FULLTEXT index on temporary InnoDB table -CREATE TABLE articles ( -id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, -title VARCHAR(200), -body TEXT, -FULLTEXT (title,body) -) ENGINE=InnoDB; INSERT INTO articles (title,body) VALUES ('MySQL Tutorial','DBMS stands for DataBase ...') , ('How To Use MySQL Well','After you went through a ...'), diff --git a/mysql-test/suite/innodb_fts/r/bug_32831765.result b/mysql-test/suite/innodb_fts/r/bug_32831765.result index 1b828f4266b61..1d6ea1873bf30 100644 --- a/mysql-test/suite/innodb_fts/r/bug_32831765.result +++ b/mysql-test/suite/innodb_fts/r/bug_32831765.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("InnoDB: Total InnoDB FTS size .* for the table .* exceeds the innodb_ft_cache_size .*"); # # Bug#32831765 SERVER HITS OOM CONDITION WHEN LOADING TWO # INNODB TABLES WITH FTS INDEXES diff --git a/mysql-test/suite/innodb_fts/r/concurrent_insert.result b/mysql-test/suite/innodb_fts/r/concurrent_insert.result index e91ea02b1de4b..bc47511b04690 100644 --- a/mysql-test/suite/innodb_fts/r/concurrent_insert.result +++ b/mysql-test/suite/innodb_fts/r/concurrent_insert.result @@ -31,5 +31,33 @@ set DEBUG_SYNC= 'now SIGNAL fts_drop_index'; connection con1; drop table t1, t2; connection default; -set DEBUG_SYNC=RESET; SET @@GLOBAL.debug_dbug = @saved_dbug; +disconnect con1; +# +# MDEV-25984 Assertion `max_doc_id > 0' failed in fts_init_doc_id() +# +call mtr.add_suppression("InnoDB: \\(Lock wait timeout\\) while getting next doc id for table `test`.`t1`"); +CREATE TABLE t1(f1 CHAR(100), f2 INT, fulltext(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES("mariadb", 1), ("innodb", 1); +# restart +SET DEBUG_SYNC='innodb_rollback_after_fts_lock SIGNAL insert_dml WAIT_FOR ddl_continue'; +ALTER TABLE t1 ADD UNIQUE INDEX(f2); +connect con1,localhost,root,,,; +SET DEBUG_SYNC='now WAIT_FOR insert_dml'; +SET DEBUG_SYNC='fts_cmp_set_sync_doc_id_retry SIGNAL ddl_continue WAIT_FOR dml_finish'; +INSERT INTO t1 VALUES("index", 2); +connection default; +ERROR 23000: Duplicate entry '1' for key 'f2' +SET DEBUG_SYNC="now SIGNAL dml_finish"; +connection con1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` char(100) DEFAULT NULL, + `f2` int(11) DEFAULT NULL, + FULLTEXT KEY `f1` (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection default; +disconnect con1; +DROP TABLE t1; +set DEBUG_SYNC=RESET; diff --git a/mysql-test/suite/innodb_fts/r/crash_recovery.result b/mysql-test/suite/innodb_fts/r/crash_recovery.result index e8305cbb2f10f..83e5ddaea90b3 100644 --- a/mysql-test/suite/innodb_fts/r/crash_recovery.result +++ b/mysql-test/suite/innodb_fts/r/crash_recovery.result @@ -157,5 +157,18 @@ id title body 1 MySQL Tutorial DBMS stands for Database... 2 MariaDB Tutorial DB means Database ... DROP TABLE mdev19073, mdev19073_2; +# +# MDEV-28706 Redundant InnoDB table fails during alter +# +SET @@global.innodb_file_per_table = 0; +CREATE TABLE t1 ( +col_int INTEGER, col_text TEXT, +col_text_1 TEXT +) ENGINE = InnoDB ROW_FORMAT = Redundant ; +ALTER TABLE t1 ADD FULLTEXT KEY `ftidx` ( col_text ) ; +INSERT INTO t1 VALUES ( 1255, "mariadb", "InnoDB"); +# restart +ALTER TABLE t1 ADD FULLTEXT(col_text_1); +DROP TABLE t1; SELECT * FROM information_schema.innodb_sys_tables WHERE name LIKE 'test/%'; TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE diff --git a/mysql-test/suite/innodb_fts/r/create.result b/mysql-test/suite/innodb_fts/r/create.result index 3ca24f5253d11..4334344a98104 100644 --- a/mysql-test/suite/innodb_fts/r/create.result +++ b/mysql-test/suite/innodb_fts/r/create.result @@ -187,4 +187,27 @@ FTS_DOC_ID bigint unsigned not null, unique key FTS_DOC_ID_INDEX(FTS_DOC_ID, f1), fulltext (f2)) engine=innodb; -ERROR 42000: Incorrect index name 'FTS_DOC_ID_INDEX' +ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index +# +# MDEV-26938 Support descending indexes internally in InnoDB +# +CREATE TABLE t1(a INT PRIMARY KEY, b TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +UNIQUE KEY FTS_DOC_ID_INDEX(FTS_DOC_ID DESC), FULLTEXT(b)) +ENGINE=InnoDB; +ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index +CREATE TABLE t1(a INT PRIMARY KEY, b TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +UNIQUE KEY FTS_DOC_ID_INDEX(FTS_DOC_ID DESC)) ENGINE=InnoDB; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` text DEFAULT NULL, + `FTS_DOC_ID` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `FTS_DOC_ID_INDEX` (`FTS_DOC_ID` DESC) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 ADD FULLTEXT INDEX(b), ALGORITHM=INPLACE; +ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index +ALTER TABLE t1 ADD FULLTEXT INDEX(b), ALGORITHM=COPY; +ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/ft_result_cache_limit.result b/mysql-test/suite/innodb_fts/r/ft_result_cache_limit.result new file mode 100644 index 0000000000000..2dbdd5a04bc6c --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/ft_result_cache_limit.result @@ -0,0 +1,39 @@ +# +# Bug 1634932: Assertion failure in thread x in +# file fts0que.cc +# +SET @saved_innodb_ft_result_cache_limit= @@global.innodb_ft_result_cache_limit; +CREATE TABLE `t1` ( +`FTS_DOC_ID` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, +`text_content` MEDIUMTEXT, PRIMARY KEY (`FTS_DOC_ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE UNIQUE INDEX FTS_DOC_ID_INDEX ON t1(FTS_DOC_ID); +SET autocommit=0; +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i INT DEFAULT 1; +WHILE (i <= 250) DO +INSERT INTO t1 (text_content) VALUES ("some_text_1234 aaa"); +SET i = i + 1; +END WHILE; +END// +CALL populate_t1; +SET autocommit=1; +SET SESSION debug="+d,fts_instrument_result_cache_limit"; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +ALTER TABLE t1 ADD FULLTEXT INDEX `text_content_idx` (`text_content`); +SELECT FTS_DOC_ID, text_content +FROM t1 +WHERE MATCH text_content AGAINST ('+some_text_1234' IN BOOLEAN MODE); +ERROR HY000: Table handler out of memory +UPDATE t1 +SET text_content='some_text_12345' +where MATCH text_content AGAINST ('+some_text_1234' IN BOOLEAN MODE); +ERROR HY000: Table handler out of memory +DELETE FROM t1 +WHERE MATCH text_content AGAINST ('+some_text_1234' IN BOOLEAN MODE); +ERROR HY000: Table handler out of memory +SET GLOBAL innodb_ft_result_cache_limit = @saved_innodb_ft_result_cache_limit; +DROP TABLE t1; +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb_fts/r/fulltext.result b/mysql-test/suite/innodb_fts/r/fulltext.result index ce72d797ac19f..32dc87daa0447 100644 --- a/mysql-test/suite/innodb_fts/r/fulltext.result +++ b/mysql-test/suite/innodb_fts/r/fulltext.result @@ -242,7 +242,7 @@ t2 CREATE TABLE `t2` ( `inhalt` text DEFAULT NULL, KEY `tig` (`ticket`), FULLTEXT KEY `tix` (`inhalt`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t2 where MATCH inhalt AGAINST (NULL); ticket inhalt select * from t2 where MATCH inhalt AGAINST ('foobar'); @@ -407,7 +407,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10000) DEFAULT NULL, FULLTEXT KEY `a` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a)) ENGINE = InnoDB; INSERT INTO t1 VALUES('test'),('test1'),('test'); @@ -714,6 +714,73 @@ t1 CREATE TABLE `t1` ( `a` char(1) DEFAULT NULL, FULLTEXT KEY `a` (`a`), FULLTEXT KEY `a_2` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# +# MDEV-25257 SEGV in fts_get_next_doc_id upon some INSERT +# +SET @save = @@global.innodb_file_per_table; +SET @@global.innodb_file_per_table = 0; +CREATE TABLE t1 ( +col_int INTEGER, col_text TEXT, +col_int_g INTEGER GENERATED ALWAYS AS (col_int) +) ENGINE = InnoDB ROW_FORMAT = Redundant ; +ALTER TABLE t1 ADD FULLTEXT KEY `ftidx` ( col_text ) ; +ALTER TABLE t1 DROP KEY `ftidx` ; +INSERT INTO t1 (col_int, col_text) VALUES ( 1255, NULL); +DROP TABLE t1; +SET @@global.innodb_file_per_table = @save; +# +# MDEV-20797 FULLTEXT search with apostrophe, +# and mandatory words +# +CREATE TABLE t1(f1 TINYTEXT NOT NULL, FULLTEXT(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES('O''Brien'), ('O Brien'), ('�''Brien'); +INSERT INTO t1 VALUES('Brien'), ('O ''Brien'), ('O'' Brien'); +INSERT INTO t1 VALUES('Doh''nuts'); +SELECT * FROM t1 WHERE MATCH (f1) AGAINST ("+O'Brien" IN BOOLEAN MODE); +f1 +O'Brien +O Brien +�'Brien +Brien +O 'Brien +O' Brien +SELECT * FROM t1 WHERE MATCH (f1) AGAINST ("+Doh'nuts" IN BOOLEAN MODE); +f1 +Doh'nuts +SELECT * FROM t1 WHERE MATCH (f1) AGAINST ("+�''Brien" IN BOOLEAN MODE); +f1 +O'Brien +O Brien +�'Brien +Brien +O 'Brien +O' Brien +DROP TABLE t1; +# +# MDEV-29058 Assertion `index->type == 32' failed +# in dict_index_build_internal_fts +# +call mtr.add_suppression("InnoDB: Index `f` of table `test`.`t2` is corrupted"); +call mtr.add_suppression("InnoDB: Skip adjustment of root pages for index `f`."); +CREATE TABLE t1 (f CHAR(8), FULLTEXT KEY (f)) ENGINE=InnoDB; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 DISCARD TABLESPACE; +FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE t1 DISCARD TABLESPACE; +ALTER TABLE t2 IMPORT TABLESPACE; +DROP TABLE t2, t1; +# +# MDEV-29778 Having Unique index interference with MATCH +# from a FULLTEXT +# +CREATE TABLE t1(f1 VARCHAR(100), FULLTEXT(f1), +UNIQUE INDEX(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES("test"); +SELECT f1, MATCH(f1) AGAINST ("test" IN BOOLEAN MODE) FROM t1; +f1 MATCH(f1) AGAINST ("test" IN BOOLEAN MODE) +test 0.000000001885928302414186 DROP TABLE t1; # End of 10.3 tests diff --git a/mysql-test/suite/innodb_fts/r/fulltext2.result b/mysql-test/suite/innodb_fts/r/fulltext2.result index b210b3bd87457..10fee84884947 100644 --- a/mysql-test/suite/innodb_fts/r/fulltext2.result +++ b/mysql-test/suite/innodb_fts/r/fulltext2.result @@ -272,3 +272,27 @@ fts_doc_id first_name last_name score 6 Ned Flanders 0 7 Nelson Muntz 0 DROP TABLE t1; +CREATE TABLE t1(a INT, b TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +KEY FTS_DOC_ID_INDEX(FTS_DOC_ID))ENGINE=InnoDB; +ALTER TABLE t1 ADD COLUMN c INT as (a) VIRTUAL; +ALTER TABLE t1 ADD d INT NULL; +ALTER TABLE t1 ADD FULLTEXT(b); +ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index +DROP TABLE t1; +# +# MDEV-29169 Using MATCH returns NULL for Virtual Column +# +CREATE TABLE t (a TEXT DEFAULT NULL, +b TEXT AS (a), +c TEXT AS (concat(a, '1')), +d int AS (111) VIRTUAL, +FULLTEXT KEY `a` (`a`) +) ENGINE=InnoDB; +INSERT INTO t (a) VALUES ('test'); +SELECT * FROM t; +a b c d +test test test1 111 +SELECT * FROM t WHERE MATCH(a) AGAINST('test'); +a b c d +test test test1 111 +DROP TABLE t; diff --git a/mysql-test/suite/innodb_fts/r/fulltext_misc.result b/mysql-test/suite/innodb_fts/r/fulltext_misc.result index f3e1ef519fd78..69812ff8b725a 100644 --- a/mysql-test/suite/innodb_fts/r/fulltext_misc.result +++ b/mysql-test/suite/innodb_fts/r/fulltext_misc.result @@ -110,7 +110,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(23) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1, t2; CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci) ENGINE = InnoDB; INSERT INTO t1 VALUES('abcd'); @@ -129,8 +129,9 @@ test select * from t1 where a like "te_t"; a test -select * from t1 where match a against ("te*" in boolean mode)+0; +select * from t1 where match a against ("te*" in boolean mode); a +test drop table t1; # # Bug #49734: Crash on EXPLAIN EXTENDED UNION ... ORDER BY diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result index a64086c980227..d831477c2af86 100644 --- a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result +++ b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result @@ -262,7 +262,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-25271 Double free of table when inplace alter @@ -289,3 +289,32 @@ ENGINE=InnoDB; ALTER TABLE t1 ADD c SERIAL; DROP TABLE t1; # End of 10.3 tests +# +# MDEV-27582 Fulltext DDL decrements the FTS_DOC_ID value +# +CREATE TABLE t1 ( +f1 INT NOT NULL PRIMARY KEY, +f2 VARCHAR(64), FULLTEXT ft(f2)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +connect con1,localhost,root,,,; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +DELETE FROM t1 WHERE f1 = 2; +ALTER TABLE t1 DROP INDEX ft; +ALTER TABLE t1 ADD FULLTEXT INDEX ft (f2); +INSERT INTO t1 VALUES (3, 'innodb fts search'); +SET GLOBAL innodb_optimize_fulltext_only=ON; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +SET GLOBAL innodb_ft_aux_table = 'test/t1'; +SELECT max(DOC_ID) FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; +max(DOC_ID) +3 +SELECT * FROM t1 WHERE MATCH(f2) AGAINST("+innodb +search" IN BOOLEAN MODE); +f1 f2 +3 innodb fts search +DROP TABLE t1; +disconnect con1; +SET GLOBAL innodb_optimize_fulltext_only=OFF; +SET GLOBAL innodb_ft_aux_table = default; diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result b/mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result deleted file mode 100644 index cad1acb3b01eb..0000000000000 --- a/mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result +++ /dev/null @@ -1,761 +0,0 @@ -select * from information_schema.innodb_ft_default_stopword; -value -a -about -an -are -as -at -be -by -com -de -en -for -from -how -i -in -is -it -la -of -on -or -that -the -this -to -was -what -when -where -who -will -with -und -the -www -CREATE TABLE articles ( -id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, -title VARCHAR(200), -body TEXT, -FULLTEXT (title,body) -) ENGINE=InnoDB; -INSERT INTO articles (title,body) VALUES -('MySQL Tutorial','DBMS stands for DataBase ...') , -('How To Use MySQL Well','After you went through a ...'), -('Optimizing MySQL','In this tutorial we will show ...'), -('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), -('MySQL vs. YourSQL','In the following database comparison ...'), -('MySQL Security','When configured properly, MySQL ...'); -SELECT * FROM articles WHERE MATCH (title,body) -AGAINST ('the' IN NATURAL LANGUAGE MODE); -id title body -select @@innodb_ft_server_stopword_table; -@@innodb_ft_server_stopword_table -NULL -select @@innodb_ft_enable_stopword; -@@innodb_ft_enable_stopword -1 -select @@innodb_ft_user_stopword_table; -@@innodb_ft_user_stopword_table -NULL -set global innodb_ft_server_stopword_table = "not_defined"; -ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined' -create table user_stopword(value varchar(30)) engine = innodb; -set global innodb_ft_server_stopword_table = "test/user_stopword"; -drop index title on articles; -create fulltext index idx on articles(title, body); -SELECT * FROM articles WHERE MATCH (title,body) -AGAINST ('the' IN NATURAL LANGUAGE MODE); -id title body -5 MySQL vs. YourSQL In the following database comparison ... -CREATE TABLE articles_2 ( -id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, -title VARCHAR(200), -body TEXT, -FULLTEXT (title,body) -) ENGINE=InnoDB; -INSERT INTO articles_2 (title, body) -VALUES ('test for stopwords','this is it...'); -SELECT * FROM articles_2 WHERE MATCH (title,body) -AGAINST ('this' IN NATURAL LANGUAGE MODE); -id title body -1 test for stopwords this is it... -insert into user_stopword values("this"); -CREATE TABLE articles_3 ( -id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, -title VARCHAR(200), -body TEXT, -FULLTEXT (title,body) -) ENGINE=InnoDB; -INSERT INTO articles_3 (title, body) -VALUES ('test for stopwords','this is it...'); -SELECT * FROM articles_3 WHERE MATCH (title,body) -AGAINST ('this' IN NATURAL LANGUAGE MODE); -id title body -create table user_stopword_session(value varchar(30)) engine = innodb; -insert into user_stopword_session values("session"); -set session innodb_ft_user_stopword_table="test/user_stopword_session"; -CREATE TABLE articles_4 ( -id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, -title VARCHAR(200), -body TEXT, -FULLTEXT (title,body) -) ENGINE=InnoDB; -INSERT INTO articles_4 (title, body) -VALUES ('test for session stopwords','this should also be excluded...'); -SELECT * FROM articles_4 WHERE MATCH (title,body) -AGAINST ('session' IN NATURAL LANGUAGE MODE); -id title body -SELECT * FROM articles_4 WHERE MATCH (title,body) -AGAINST ('this' IN NATURAL LANGUAGE MODE); -id title body -1 test for session stopwords this should also be excluded... -connect con1,localhost,root,,; -CREATE TABLE articles_5 ( -id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, -title VARCHAR(200), -body TEXT, -FULLTEXT (title,body) -) ENGINE=InnoDB; -INSERT INTO articles_5 (title, body) -VALUES ('test for session stopwords','this should also be excluded...'); -SELECT * FROM articles_5 WHERE MATCH (title,body) -AGAINST ('session' IN NATURAL LANGUAGE MODE); -id title body -1 test for session stopwords this should also be excluded... -connection default; -drop table articles; -drop table articles_2; -drop table articles_3; -drop table articles_4; -drop table articles_5; -drop table user_stopword; -drop table user_stopword_session; -SET GLOBAL innodb_ft_enable_stopword=1; -SET GLOBAL innodb_ft_server_stopword_table=default; -CREATE TABLE articles ( -id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, -title VARCHAR(200), -body TEXT, -FULLTEXT `idx` (title,body) -) ENGINE=InnoDB; -SHOW CREATE TABLE articles; -Table Create Table -articles CREATE TABLE `articles` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `title` varchar(200) DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `idx` (`title`,`body`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -INSERT INTO articles (title,body) VALUES -('MySQL from Tutorial','DBMS stands for DataBase ...') , -('when To Use MySQL Well','After that you went through a ...'), -('where will Optimizing MySQL','In what tutorial we will show ...'), -('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), -('MySQL vs. YourSQL','In the following database comparison ...'), -('MySQL Security','When configured properly, MySQL ...'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); -id title body -INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE); -id title body -UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' -WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' -WHERE id = 7; -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -id title body -DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE id = 7; -id title body -7 update the record to see will is indexed or not -DELETE FROM articles WHERE id = 7; -SET SESSION innodb_ft_enable_stopword = 0; -select @@innodb_ft_enable_stopword; -@@innodb_ft_enable_stopword -0 -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); -id title body -INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE); -id title body -UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' -WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' -WHERE id = 8; -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -id title body -SELECT * FROM articles WHERE id = 8; -id title body -8 update the record to see will is indexed or not -DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE id = 8; -id title body -8 update the record to see will is indexed or not -DELETE FROM articles WHERE id = 8; -ALTER TABLE articles DROP INDEX idx; -SHOW CREATE TABLE articles; -Table Create Table -articles CREATE TABLE `articles` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `title` varchar(200) DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -ANALYZE TABLE articles; -Table Op Msg_type Msg_text -test.articles analyze status Engine-independent statistics collected -test.articles analyze Warning Engine-independent statistics are not collected for column 'body' -test.articles analyze status OK -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); -id title body -2 when To Use MySQL Well After that you went through a ... -6 MySQL Security When configured properly, MySQL ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -1 MySQL from Tutorial DBMS stands for DataBase ... -6 MySQL Security When configured properly, MySQL ... -2 when To Use MySQL Well After that you went through a ... -4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... -5 MySQL vs. YourSQL In the following database comparison ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); -id title body -2 when To Use MySQL Well After that you went through a ... -3 where will Optimizing MySQL In what tutorial we will show ... -6 MySQL Security When configured properly, MySQL ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); -id title body -1 MySQL from Tutorial DBMS stands for DataBase ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -id title body -9 the record will not index the , will words -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE); -id title body -9 the record will not index the , will words -UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' -WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -SELECT COUNT(*),max(id) FROM articles; -COUNT(*) max(id) -7 9 -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -id title body -9 update the record to see will is indexed or not -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -9 update the record to see will is indexed or not -DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE id = 9; -id title body -DROP TABLE articles; -SET SESSION innodb_ft_enable_stopword=1; -SET GLOBAL innodb_ft_server_stopword_table=default; -SET SESSION innodb_ft_user_stopword_table=default; -select @@innodb_ft_server_stopword_table; -@@innodb_ft_server_stopword_table -NULL -select @@innodb_ft_enable_stopword; -@@innodb_ft_enable_stopword -1 -select @@innodb_ft_user_stopword_table; -@@innodb_ft_user_stopword_table -NULL -CREATE TABLE articles ( -id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, -title VARCHAR(200), -body TEXT, -FULLTEXT `idx` (title,body) -) ENGINE=InnoDB; -INSERT INTO articles (title,body) VALUES -('MySQL from Tutorial','DBMS stands for DataBase ...') , -('when To Use MySQL Well','After that you went through a ...'), -('where will Optimizing MySQL','In what tutorial we will show ...'), -('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), -('MySQL vs. YourSQL','In the following database comparison ...'), -('MySQL Security','When configured properly, MySQL ...'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -id title body -create table user_stopword(value varchar(30)) engine = innodb; -set session innodb_ft_user_stopword_table = "test/user_stopword"; -create table server_stopword(value varchar(30)) engine = innodb; -set global innodb_ft_server_stopword_table = "test/server_stopword"; -insert into user_stopword values("this"),("will"),("the"); -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -id title body -insert into server_stopword values("what"),("where"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -DELETE FROM user_stopword; -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -insert into user_stopword values("this"),("will"),("the"); -ALTER TABLE articles DROP INDEX idx; -SET SESSION innodb_ft_enable_stopword = 0; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SET SESSION innodb_ft_enable_stopword = 1; -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -id title body -SET SESSION innodb_ft_enable_stopword = 1; -SET SESSION innodb_ft_user_stopword_table = default; -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -DROP TABLE articles,user_stopword,server_stopword; -SET SESSION innodb_ft_enable_stopword=1; -SET GLOBAL innodb_ft_server_stopword_table=default; -SET SESSION innodb_ft_user_stopword_table=default; -select @@innodb_ft_server_stopword_table; -@@innodb_ft_server_stopword_table -NULL -select @@innodb_ft_enable_stopword; -@@innodb_ft_enable_stopword -1 -select @@innodb_ft_user_stopword_table; -@@innodb_ft_user_stopword_table -NULL -CREATE TABLE articles ( -id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, -title VARCHAR(200), -body TEXT, -FULLTEXT `idx` (title,body) -) ENGINE=InnoDB; -SHOW CREATE TABLE articles; -Table Create Table -articles CREATE TABLE `articles` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `title` varchar(200) DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `idx` (`title`,`body`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -INSERT INTO articles (title,body) VALUES -('MySQL from Tutorial','DBMS stands for DataBase ...') , -('when To Use MySQL Well','After that you went through a ...'), -('where will Optimizing MySQL','In what tutorial we will show ...'), -('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), -('MySQL vs. YourSQL','In the following database comparison ...'), -('MySQL Security','When configured properly, MySQL ...'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -id title body -create table user_stopword(value varchar(30)) engine = innodb; -set session innodb_ft_user_stopword_table = "test/user_stopword"; -insert into user_stopword values("mysqld"),("DBMS"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE); -id title body -1 MySQL from Tutorial DBMS stands for DataBase ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld'); -id title body -4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld'); -id title body -set session innodb_ft_user_stopword_table = default; -create table server_stopword(value varchar(30)) engine = innodb; -set global innodb_ft_server_stopword_table = "test/server_stopword"; -insert into server_stopword values("root"),("properly"); -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly'); -id title body -set session innodb_ft_user_stopword_table = "test/user_stopword"; -set global innodb_ft_server_stopword_table = "test/server_stopword"; -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE); -id title body -4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly'); -id title body -6 MySQL Security When configured properly, MySQL ... -set session innodb_ft_user_stopword_table = "test/user_stopword"; -DELETE FROM user_stopword; -set global innodb_ft_server_stopword_table = "test/server_stopword"; -DELETE FROM server_stopword; -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE); -id title body -4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly'); -id title body -6 MySQL Security When configured properly, MySQL ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE); -id title body -1 MySQL from Tutorial DBMS stands for DataBase ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld'); -id title body -4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... -DROP TABLE articles,user_stopword,server_stopword; -SET SESSION innodb_ft_enable_stopword=1; -SET GLOBAL innodb_ft_server_stopword_table=default; -SET SESSION innodb_ft_user_stopword_table=default; -CREATE TABLE articles ( -id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, -title VARCHAR(200), -body TEXT, -FULLTEXT `idx` (title,body) -) ENGINE=InnoDB; -SHOW CREATE TABLE articles; -Table Create Table -articles CREATE TABLE `articles` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `title` varchar(200) DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `idx` (`title`,`body`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -INSERT INTO articles (title,body) VALUES -('MySQL from Tutorial','DBMS stands for DataBase ...') , -('when To Use MySQL Well','After that you went through a ...'), -('where will Optimizing MySQL','In what tutorial we will show ...'), -('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), -('MySQL vs. YourSQL','In the following database comparison ...'), -('MySQL Security','When configured properly, MySQL ...'); -SET SESSION innodb_ft_enable_stopword = 0; -select @@innodb_ft_enable_stopword; -@@innodb_ft_enable_stopword -0 -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -connection con1; -select @@innodb_ft_enable_stopword; -@@innodb_ft_enable_stopword -1 -ANALYZE TABLE articles; -Table Op Msg_type Msg_text -test.articles analyze status Engine-independent statistics collected -test.articles analyze Warning Engine-independent statistics are not collected for column 'body' -test.articles analyze status OK -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); -id title body -2 when To Use MySQL Well After that you went through a ... -6 MySQL Security When configured properly, MySQL ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -1 MySQL from Tutorial DBMS stands for DataBase ... -6 MySQL Security When configured properly, MySQL ... -2 when To Use MySQL Well After that you went through a ... -4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... -5 MySQL vs. YourSQL In the following database comparison ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); -id title body -2 when To Use MySQL Well After that you went through a ... -3 where will Optimizing MySQL In what tutorial we will show ... -6 MySQL Security When configured properly, MySQL ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); -id title body -1 MySQL from Tutorial DBMS stands for DataBase ... -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SET SESSION innodb_ft_enable_stopword = 1; -select @@innodb_ft_enable_stopword; -@@innodb_ft_enable_stopword -1 -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); -id title body -connection default; -select @@innodb_ft_enable_stopword; -@@innodb_ft_enable_stopword -0 -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); -id title body -INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE); -id title body -SET SESSION innodb_ft_enable_stopword = 1; -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE); -id title body -connection con1; -SET SESSION innodb_ft_enable_stopword = 1; -create table user_stopword(value varchar(30)) engine = innodb; -set session innodb_ft_user_stopword_table = "test/user_stopword"; -insert into user_stopword values("this"),("will"),("the"); -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -id title body -connection default; -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -id title body -select @@innodb_ft_user_stopword_table; -@@innodb_ft_user_stopword_table -NULL -create table user_stopword_1(value varchar(30)) engine = innodb; -set session innodb_ft_user_stopword_table = "test/user_stopword_1"; -insert into user_stopword_1 values("when"); -SET SESSION innodb_ft_enable_stopword = 1; -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE); -id title body -2 when To Use MySQL Well After that you went through a ... -6 MySQL Security When configured properly, MySQL ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when'); -id title body -2 when To Use MySQL Well After that you went through a ... -6 MySQL Security When configured properly, MySQL ... -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when'); -id title body -connection con1; -SET SESSION innodb_ft_enable_stopword = 1; -SET SESSION innodb_ft_user_stopword_table=default; -select @@innodb_ft_user_stopword_table; -@@innodb_ft_user_stopword_table -NULL -select @@innodb_ft_server_stopword_table; -@@innodb_ft_server_stopword_table -NULL -create table server_stopword(value varchar(30)) engine = innodb; -SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword"; -select @@innodb_ft_server_stopword_table; -@@innodb_ft_server_stopword_table -test/server_stopword -insert into server_stopword values("when"),("the"); -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the'); -id title body -disconnect con1; -connection default; -SET SESSION innodb_ft_enable_stopword = 1; -SET SESSION innodb_ft_user_stopword_table=default; -select @@innodb_ft_server_stopword_table; -@@innodb_ft_server_stopword_table -test/server_stopword -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where'); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -insert into server_stopword values("where"),("will"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where'); -id title body -3 where will Optimizing MySQL In what tutorial we will show ... -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the'); -id title body -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE); -id title body -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where'); -id title body -DROP TABLE articles,user_stopword,user_stopword_1,server_stopword; -SET SESSION innodb_ft_enable_stopword=1; -SET GLOBAL innodb_ft_server_stopword_table=default; -SET SESSION innodb_ft_user_stopword_table=default; diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result b/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result index 8717d002d3292..2cc992be73aba 100644 --- a/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result @@ -16,7 +16,7 @@ t1 CREATE TABLE `t1` ( `b` text DEFAULT NULL, PRIMARY KEY (`id`), FULLTEXT KEY `idx` (`a`,`b`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), ('MySQL vs. YourSQL','In the following database comparison ...'), @@ -298,7 +298,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT id FROM t2; id 1 @@ -310,7 +310,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT id FROM t2; id 3 @@ -321,7 +321,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT id FROM t2; id 7 @@ -546,7 +546,7 @@ t1 CREATE TABLE `t1` ( `b` text DEFAULT NULL, PRIMARY KEY (`id`), FULLTEXT KEY `idx` (`a`,`b`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES ('1001 MySQL Tricks','1. Never run mysqld as root. 2. q ...'), ('MySQL vs. YourSQL use','In the following database comparison ...'), @@ -716,7 +716,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `FTS_DOC_ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`FTS_DOC_ID`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb'); DROP TABLE t1, t2, mdev20987_2, mdev20987_1, mdev22358; "----------Test28---------" @@ -940,7 +940,7 @@ t1 CREATE TABLE `t1` ( `b` text DEFAULT NULL, PRIMARY KEY (`id`), FULLTEXT KEY `idx` (`a`,`b`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (a,b) VALUES ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), ('MySQL vs. YourSQL','In the following database comparison ...'), diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result b/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result index c7a19eb7572ad..52cbede731451 100644 --- a/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result @@ -185,7 +185,7 @@ t2 CREATE TABLE `t2` ( KEY `FTS_DOC_ID` (`FTS_DOC_ID`), FULLTEXT KEY `idx` (`s2`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`FTS_DOC_ID`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,'Sunshine'),(2,'Lollipops'); insert into t2 values (1,'Sunshine'),(2,'Lollipops'); update t1 set s1 = 3 where s1=1; @@ -485,7 +485,7 @@ t1 CREATE TABLE `t1` ( `b` text DEFAULT NULL, PRIMARY KEY (`id`), FULLTEXT KEY `idx` (`a`,`b`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ROW_FORMAT=COMPRESSED SELECT count(*) FROM information_schema.innodb_sys_tables WHERE name LIKE "%FTS_%" AND space !=0; count(*) 11 diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_multiple_index.result b/mysql-test/suite/innodb_fts/r/innodb_fts_multiple_index.result index a6dfc2d4b4a4a..bbf6f3eed465e 100644 --- a/mysql-test/suite/innodb_fts/r/innodb_fts_multiple_index.result +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_multiple_index.result @@ -19,7 +19,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`id`), FULLTEXT KEY `idx_1` (`a`), FULLTEXT KEY `idx_2` (`b`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 START TRANSACTION; INSERT INTO t1 (a,b) VALUES ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result b/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result index 85271aebcf463..b9b2350c00ba3 100644 --- a/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result @@ -1,4 +1,5 @@ INSTALL PLUGIN simple_parser SONAME 'mypluglib'; +FLUSH TABLES; # Test Part 1: Grammar Test CREATE TABLE articles ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, @@ -31,7 +32,7 @@ INSERT INTO articles (title, body) VALUES ('1001 MySQL Tricks','How to use full-text search engine'), ('Go MySQL Tricks','How to use full text search engine'); SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('mysql'); +MATCH(title, body) AGAINST('mysql') ORDER BY id; id title body 1 MySQL Tutorial DBMS stands for MySQL DataBase ... 2 How To Use MySQL Well After you went through a ... @@ -68,7 +69,7 @@ INSERT INTO articles (title, body) VALUES ('Go MySQL Tricks','How to use full text search engine'); ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser; SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('mysql'); +MATCH(title, body) AGAINST('mysql') ORDER BY id; id title body 1 MySQL Tutorial DBMS stands for MySQL DataBase ... 2 How To Use MySQL Well After you went through a ... @@ -88,21 +89,23 @@ MATCH(title, body) AGAINST('full text'); id title body 5 Go MySQL Tricks How to use full text search engine SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION); +MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION) +ORDER BY id; id title body -4 1001 MySQL Tricks How to use full-text search engine -5 Go MySQL Tricks How to use full text search engine -2 How To Use MySQL Well After you went through a ... 1 MySQL Tutorial DBMS stands for MySQL DataBase ... +2 How To Use MySQL Well After you went through a ... 3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks How to use full-text search engine +5 Go MySQL Tricks How to use full text search engine SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION); +MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION) +ORDER BY id; id title body -5 Go MySQL Tricks How to use full text search engine -4 1001 MySQL Tricks How to use full-text search engine -2 How To Use MySQL Well After you went through a ... 1 MySQL Tutorial DBMS stands for MySQL DataBase ... +2 How To Use MySQL Well After you went through a ... 3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks How to use full-text search engine +5 Go MySQL Tricks How to use full text search engine SELECT * FROM articles WHERE MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE); id title body @@ -138,30 +141,31 @@ INSERT INTO articles (title, body) VALUES ('Go MariaDB Tricks','How to use full text search engine'); # restart SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('MySQL'); +MATCH(title, body) AGAINST('MySQL') ORDER BY id; id title body 1 MySQL Tutorial DBMS stands for MySQL DataBase ... 2 How To Use MySQL Well After you went through a ... 3 Optimizing MySQL In this tutorial we will show ... 4 1001 MySQL Tricks How to use full-text search engine SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('tutorial'); +MATCH(title, body) AGAINST('tutorial') ORDER BY id; id title body 1 MySQL Tutorial DBMS stands for MySQL DataBase ... 3 Optimizing MySQL In this tutorial we will show ... SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('Tricks'); +MATCH(title, body) AGAINST('Tricks') ORDER BY id; id title body 4 1001 MySQL Tricks How to use full-text search engine 5 Go MariaDB Tricks How to use full text search engine SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('full text search'); +MATCH(title, body) AGAINST('full text search') ORDER BY id; id title body -5 Go MariaDB Tricks How to use full text search engine 4 1001 MySQL Tricks How to use full-text search engine +5 Go MariaDB Tricks How to use full text search engine SELECT COUNT(*) FROM articles; COUNT(*) 5 +INSERT INTO articles (title, body) VALUES ('111', '1234 1234 1234'); DROP TABLE articles; # Test Part 5: Test Uninstall Plugin After Index is Built CREATE TABLE articles ( @@ -185,7 +189,8 @@ UNINSTALL PLUGIN simple_parser; Warnings: Warning 1620 Plugin is busy and will be uninstalled on shutdown SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('mysql'); +MATCH(title, body) AGAINST('mysql') +ORDER BY id; id title body 1 MySQL Tutorial DBMS stands for MySQL DataBase ... 2 How To Use MySQL Well After you went through a ... diff --git a/mysql-test/suite/innodb_fts/r/misc_debug.result b/mysql-test/suite/innodb_fts/r/misc_debug.result index 2a2afacb0523d..cdfc4ff489a72 100644 --- a/mysql-test/suite/innodb_fts/r/misc_debug.result +++ b/mysql-test/suite/innodb_fts/r/misc_debug.result @@ -58,10 +58,19 @@ DROP TABLE t1; # call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)"); call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Too many concurrent transactions"); +SET @saved_debug_dbug= @@debug_dbug; CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB; SET debug_dbug='+d,ib_create_table_fail_too_many_trx'; TRUNCATE t1; -ERROR HY000: Got error -1 "Internal error < 0 (Not system error)" from storage engine InnoDB SET debug_dbug=@saved_debug_dbug; DROP TABLE t1; # End of 10.3 tests +CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100))ENGINE=InnoDB; +SET DEBUG_DBUG="+d,stats_lock_fail"; +ALTER TABLE t1 ADD FULLTEXT(f2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET debug_dbug=@saved_debug_dbug; +ALTER TABLE t1 DISCARD TABLESPACE; +ALTER TABLE t1 ADD FULLTEXT(f2); +ERROR HY000: Tablespace has been discarded for table `t1` +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/misc_debug2.result b/mysql-test/suite/innodb_fts/r/misc_debug2.result index ed7e6b9b7e184..9601e8fc82ee0 100644 --- a/mysql-test/suite/innodb_fts/r/misc_debug2.result +++ b/mysql-test/suite/innodb_fts/r/misc_debug2.result @@ -6,3 +6,18 @@ INSERT INTO mdev21563 VALUES('This is a test'); ALTER TABLE mdev21563 DISCARD TABLESPACE; # restart DROP TABLE mdev21563; +# +# MDEV-29342 Assertion failure in file que0que.cc line 728 +# +CREATE TABLE t1(f1 CHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES('mysql'), ('innodb'); +SET @save_dbug=@@debug_dbug; +set debug_dbug="+d,fts_instrument_sync_request"; +INSERT INTO t1 VALUES('test'); +set debug_dbug=@save_dbug; +INSERT INTO t1 VALUES('This is a fts issue'); +# restart +set debug_dbug="+d,fts_instrument_sync_request"; +UPDATE t1 SET f1="mariadb"; +set debug_dbug=@save_dbug; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/stopword,vers.rdiff b/mysql-test/suite/innodb_fts/r/stopword,vers.rdiff new file mode 100644 index 0000000000000..7405c47c41da3 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/stopword,vers.rdiff @@ -0,0 +1,192 @@ +--- stopword.result ++++ stopword,vers.reject +@@ -46,7 +46,7 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + INSERT INTO articles (title,body) VALUES + ('MySQL Tutorial','DBMS stands for DataBase ...') , + ('How To Use MySQL Well','After you went through a ...'), +@@ -60,7 +60,7 @@ + set global innodb_ft_server_stopword_table = "not_defined"; + ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined' + set global innodb_ft_server_stopword_table = NULL; +-create table user_stopword(value varchar(30)) engine = innodb; ++create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + set global innodb_ft_server_stopword_table = "test/user_stopword"; + drop index title on articles; + create fulltext index idx on articles(title, body); +@@ -73,7 +73,7 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + INSERT INTO articles_2 (title, body) + VALUES ('test for stopwords','this is it...'); + SELECT * FROM articles_2 WHERE MATCH (title,body) +@@ -88,13 +88,13 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + INSERT INTO articles_3 (title, body) + VALUES ('test for stopwords','this is it...'); + SELECT * FROM articles_3 WHERE MATCH (title,body) + AGAINST ('this' IN NATURAL LANGUAGE MODE); + id title body +-create table user_stopword_session(value varchar(30)) engine = innodb; ++create table user_stopword_session(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + insert into user_stopword values("this"); + delete from user_stopword; + insert into user_stopword_session values("session"); +@@ -104,7 +104,7 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + INSERT INTO articles_4 (title, body) + VALUES ('test for session stopwords','this should also be excluded...'); + SELECT * FROM articles_4 WHERE MATCH (title,body) +@@ -120,7 +120,7 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + INSERT INTO articles_5 (title, body) + VALUES ('test for session stopwords','this should also be excluded...'); + SELECT * FROM articles_5 WHERE MATCH (title,body) +@@ -142,7 +142,7 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT `idx` (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + SHOW CREATE TABLE articles; + Table Create Table + articles CREATE TABLE `articles` ( +@@ -151,7 +151,7 @@ + `body` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `idx` (`title`,`body`) +-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + INSERT INTO articles (title,body) VALUES + ('MySQL from Tutorial','DBMS stands for DataBase ...') , + ('when To Use MySQL Well','After that you went through a ...'), +@@ -248,7 +248,7 @@ + `title` varchar(200) DEFAULT NULL, + `body` text DEFAULT NULL, + PRIMARY KEY (`id`) +-) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ++) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); + ANALYZE TABLE articles; + Table Op Msg_type Msg_text +@@ -320,7 +320,7 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT `idx` (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + INSERT INTO articles (title,body) VALUES + ('MySQL from Tutorial','DBMS stands for DataBase ...') , + ('when To Use MySQL Well','After that you went through a ...'), +@@ -332,9 +332,9 @@ + id title body + SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); + id title body +-create table user_stopword(value varchar(30)) engine = innodb; ++create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + set session innodb_ft_user_stopword_table = "test/user_stopword"; +-create table server_stopword(value varchar(30)) engine = innodb; ++create table server_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + set global innodb_ft_server_stopword_table = "test/server_stopword"; + insert into user_stopword values("when"),("where"); + delete from user_stopword; +@@ -419,7 +419,7 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT `idx` (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + SHOW CREATE TABLE articles; + Table Create Table + articles CREATE TABLE `articles` ( +@@ -428,7 +428,7 @@ + `body` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `idx` (`title`,`body`) +-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + INSERT INTO articles (title,body) VALUES + ('MySQL from Tutorial','DBMS stands for DataBase ...') , + ('when To Use MySQL Well','After that you went through a ...'), +@@ -440,7 +440,7 @@ + id title body + SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); + id title body +-create table user_stopword(value varchar(30)) engine = innodb; ++create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + set session innodb_ft_user_stopword_table = "test/user_stopword"; + insert into user_stopword values("mysqld"),("DBMS"); + SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); +@@ -466,7 +466,7 @@ + SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld'); + id title body + set session innodb_ft_user_stopword_table = default; +-create table server_stopword(value varchar(30)) engine = innodb; ++create table server_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + set global innodb_ft_server_stopword_table = "test/server_stopword"; + insert into server_stopword values("root"),("properly"); + ALTER TABLE articles DROP INDEX idx; +@@ -530,7 +530,7 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT `idx` (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + SHOW CREATE TABLE articles; + Table Create Table + articles CREATE TABLE `articles` ( +@@ -539,7 +539,7 @@ + `body` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `idx` (`title`,`body`) +-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + INSERT INTO articles (title,body) VALUES + ('MySQL from Tutorial','DBMS stands for DataBase ...') , + ('when To Use MySQL Well','After that you went through a ...'), +@@ -656,7 +656,7 @@ + "In connection 1" + connection con1; + SET SESSION innodb_ft_enable_stopword = 1; +-create table user_stopword(value varchar(30)) engine = innodb; ++create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + set session innodb_ft_user_stopword_table = "test/user_stopword"; + insert into user_stopword values("this"),("will"),("the"); + ALTER TABLE articles DROP INDEX idx; +@@ -674,7 +674,7 @@ + select @@innodb_ft_user_stopword_table; + @@innodb_ft_user_stopword_table + NULL +-create table user_stopword_1(value varchar(30)) engine = innodb; ++create table user_stopword_1(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + set session innodb_ft_user_stopword_table = "test/user_stopword_1"; + insert into user_stopword_1 values("when"); + SET SESSION innodb_ft_enable_stopword = 1; +@@ -702,7 +702,7 @@ + select @@innodb_ft_server_stopword_table; + @@innodb_ft_server_stopword_table + NULL +-create table server_stopword(value varchar(30)) engine = innodb; ++create table server_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword"; + select @@innodb_ft_server_stopword_table; + @@innodb_ft_server_stopword_table diff --git a/mysql-test/suite/innodb_fts/r/stopword.result b/mysql-test/suite/innodb_fts/r/stopword.result index 05516d10f342b..aa6f51aac76a5 100644 --- a/mysql-test/suite/innodb_fts/r/stopword.result +++ b/mysql-test/suite/innodb_fts/r/stopword.result @@ -1,3 +1,6 @@ +SET @innodb_ft_server_stopword_table_orig=@@innodb_ft_server_stopword_table; +SET @innodb_ft_enable_stopword_orig=@@innodb_ft_enable_stopword; +SET @innodb_ft_user_stopword_table_orig=@@innodb_ft_user_stopword_table; call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist."); call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist."); select * from information_schema.innodb_ft_default_stopword; @@ -54,9 +57,6 @@ INSERT INTO articles (title,body) VALUES SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the' IN NATURAL LANGUAGE MODE); id title body -SET @innodb_ft_server_stopword_table_orig=@@innodb_ft_server_stopword_table; -SET @innodb_ft_enable_stopword_orig=@@innodb_ft_enable_stopword; -SET @innodb_ft_user_stopword_table_orig=@@innodb_ft_user_stopword_table; set global innodb_ft_server_stopword_table = "not_defined"; ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined' set global innodb_ft_server_stopword_table = NULL; @@ -80,6 +80,8 @@ SELECT * FROM articles_2 WHERE MATCH (title,body) AGAINST ('this' IN NATURAL LANGUAGE MODE); id title body 1 test for stopwords this is it... +insert into user_stopword values("the"); +delete from user_stopword; insert into user_stopword values("this"); CREATE TABLE articles_3 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, @@ -93,6 +95,8 @@ SELECT * FROM articles_3 WHERE MATCH (title,body) AGAINST ('this' IN NATURAL LANGUAGE MODE); id title body create table user_stopword_session(value varchar(30)) engine = innodb; +insert into user_stopword values("this"); +delete from user_stopword; insert into user_stopword_session values("session"); set session innodb_ft_user_stopword_table="test/user_stopword_session"; CREATE TABLE articles_4 ( @@ -147,7 +151,7 @@ articles CREATE TABLE `articles` ( `body` text DEFAULT NULL, PRIMARY KEY (`id`), FULLTEXT KEY `idx` (`title`,`body`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO articles (title,body) VALUES ('MySQL from Tutorial','DBMS stands for DataBase ...') , ('when To Use MySQL Well','After that you went through a ...'), @@ -244,7 +248,7 @@ articles CREATE TABLE `articles` ( `title` varchar(200) DEFAULT NULL, `body` text DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); ANALYZE TABLE articles; Table Op Msg_type Msg_text @@ -334,6 +338,8 @@ create table user_stopword(value varchar(30)) engine = innodb; set session innodb_ft_user_stopword_table = "test/user_stopword"; create table server_stopword(value varchar(30)) engine = innodb; set global innodb_ft_server_stopword_table = "test/server_stopword"; +insert into user_stopword values("when"),("where"); +delete from user_stopword; insert into user_stopword values("this"),("will"),("the"); ALTER TABLE articles DROP INDEX idx; ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); @@ -424,7 +430,7 @@ articles CREATE TABLE `articles` ( `body` text DEFAULT NULL, PRIMARY KEY (`id`), FULLTEXT KEY `idx` (`title`,`body`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO articles (title,body) VALUES ('MySQL from Tutorial','DBMS stands for DataBase ...') , ('when To Use MySQL Well','After that you went through a ...'), @@ -535,7 +541,7 @@ articles CREATE TABLE `articles` ( `body` text DEFAULT NULL, PRIMARY KEY (`id`), FULLTEXT KEY `idx` (`title`,`body`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO articles (title,body) VALUES ('MySQL from Tutorial','DBMS stands for DataBase ...') , ('when To Use MySQL Well','After that you went through a ...'), diff --git a/mysql-test/suite/innodb_fts/r/versioning,prepare.result b/mysql-test/suite/innodb_fts/r/versioning,prepare.result new file mode 100644 index 0000000000000..ada4f30d80cfc --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/versioning,prepare.result @@ -0,0 +1,695 @@ +# Upgrade test +CREATE TEMPORARY TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +) ENGINE=InnoDB; +ERROR HY000: Cannot create FULLTEXT index on temporary InnoDB table +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +)with system versioning ENGINE=InnoDB; +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +INSERT INTO articles (title,body) VALUES +('test query expansion','for database ...'); +INSERT INTO articles (title,body) VALUES +('test proximity search, test, proximity and phrase', +'search, with proximity innodb'); +INSERT INTO articles (title,body) VALUES +('test my proximity fts new search, test, proximity and phrase', +'search, with proximity innodb'); +INSERT INTO articles (title,body) VALUES +('test more of proximity fts search, test, more proximity and phrase', +'search, with proximity innodb'); +call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist."); +call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist."); +select * from information_schema.innodb_ft_default_stopword; +value +a +about +an +are +as +at +be +by +com +de +en +for +from +how +i +in +is +it +la +of +on +or +that +the +this +to +was +what +when +where +who +will +with +und +the +www +CREATE TABLE articles2 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +)with system versioning ENGINE=InnoDB; +INSERT INTO articles2 (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('the' IN NATURAL LANGUAGE MODE); +id title body +set global innodb_ft_server_stopword_table = "not_defined"; +ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined' +set global innodb_ft_server_stopword_table = NULL; +create table user_stopword(value varchar(30)) engine = innodb; +set global innodb_ft_server_stopword_table = "test/user_stopword"; +drop index title on articles2; +create fulltext index idx on articles2(title, body); +insert into articles2 (title, body) +values ('test for stopwords','this is it...'); +insert into user_stopword values("the"); +delete from user_stopword; +insert into user_stopword values("this"); +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +ERROR HY000: Index articles is corrupted +call mtr.add_suppression("test/articles.? contains 3 indexes inside InnoDB"); +alter table articles force; +Warnings: +Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB +flush tables; +show create table articles; +Table Create Table +articles CREATE TABLE `articles` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(200) DEFAULT NULL, + `body` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`,`body`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +5 MySQL vs. YourSQL In the following database comparison ... +7 test query expansion for database ... +SELECT COUNT(*) FROM articles +WHERE MATCH (title,body) +AGAINST ('database' IN NATURAL LANGUAGE MODE); +COUNT(*) +3 +SELECT * FROM articles +WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT COUNT(IF(MATCH (title,body) +AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL)) +AS count FROM articles; +count +3 +SELECT id, body, MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score +FROM articles; +id body score +1 DBMS stands for DataBase ... 0.2734021842479706 +2 After you went through a ... 0 +3 In this tutorial we will show ... 0 +4 1. Never run mysqld as root. 2. ... 0 +5 In the following database comparison ... 0.2734021842479706 +6 When configured properly, MySQL ... 0 +7 for database ... 0.2734021842479706 +8 search, with proximity innodb 0 +9 search, with proximity innodb 0 +10 search, with proximity innodb 0 +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('MySQL' IN NATURAL LANGUAGE MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('DBMS Security' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('t*' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +7 test query expansion for database ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('MY*' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('ru*' IN BOOLEAN MODE); +id title body +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR HY000: Table handler out of memory +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))' + IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR 42000: syntax error, unexpected $end +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR 42000: syntax error, unexpected $end +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +1 MySQL Tutorial DBMS stands for DataBase ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT COUNT(*) FROM articles +WHERE MATCH (title,body) +AGAINST ('database' WITH QUERY EXPANSION); +COUNT(*) +10 +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('test' WITH QUERY EXPANSION); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +8 test proximity search, test, proximity and phrase search, with proximity innodb +7 test query expansion for database ... +1 MySQL Tutorial DBMS stands for DataBase ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following comparison"@3' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following comparison"@2' IN BOOLEAN MODE); +id title body +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following database"' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@3' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@2' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@5' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@5' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@1' IN BOOLEAN MODE); +id title body +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@4' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@3' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"@4' IN BOOLEAN MODE); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"@3' IN BOOLEAN MODE); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"' IN BOOLEAN MODE); +id title body +set global innodb_ft_server_stopword_table= "test/user_stopword"; +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('the' IN NATURAL LANGUAGE MODE); +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('this' IN NATURAL LANGUAGE MODE); +drop index idx on articles2; +Warnings: +Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB +create fulltext index idx on articles2(title, body); +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('the' IN NATURAL LANGUAGE MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('this' IN NATURAL LANGUAGE MODE); +id title body +# Downgrade test +alter table articles force; +Warnings: +Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB +Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB +flush tables; +show create table articles; +Table Create Table +articles CREATE TABLE `articles` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(200) DEFAULT NULL, + `body` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`,`body`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +5 MySQL vs. YourSQL In the following database comparison ... +7 test query expansion for database ... +SELECT COUNT(*) FROM articles +WHERE MATCH (title,body) +AGAINST ('database' IN NATURAL LANGUAGE MODE); +COUNT(*) +3 +SELECT * FROM articles +WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT COUNT(IF(MATCH (title,body) +AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL)) +AS count FROM articles; +count +3 +SELECT id, body, MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score +FROM articles; +id body score +1 DBMS stands for DataBase ... 0.2734021842479706 +2 After you went through a ... 0 +3 In this tutorial we will show ... 0 +4 1. Never run mysqld as root. 2. ... 0 +5 In the following database comparison ... 0.2734021842479706 +6 When configured properly, MySQL ... 0 +7 for database ... 0.2734021842479706 +8 search, with proximity innodb 0 +9 search, with proximity innodb 0 +10 search, with proximity innodb 0 +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('MySQL' IN NATURAL LANGUAGE MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('DBMS Security' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('t*' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +7 test query expansion for database ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('MY*' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('ru*' IN BOOLEAN MODE); +id title body +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR HY000: Table handler out of memory +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))' + IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR 42000: syntax error, unexpected $end +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR 42000: syntax error, unexpected $end +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +1 MySQL Tutorial DBMS stands for DataBase ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT COUNT(*) FROM articles +WHERE MATCH (title,body) +AGAINST ('database' WITH QUERY EXPANSION); +COUNT(*) +10 +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('test' WITH QUERY EXPANSION); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +8 test proximity search, test, proximity and phrase search, with proximity innodb +7 test query expansion for database ... +1 MySQL Tutorial DBMS stands for DataBase ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following comparison"@3' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following comparison"@2' IN BOOLEAN MODE); +id title body +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following database"' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@3' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@2' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@5' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@5' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@1' IN BOOLEAN MODE); +id title body +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@4' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@3' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"@4' IN BOOLEAN MODE); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"@3' IN BOOLEAN MODE); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"' IN BOOLEAN MODE); +id title body +set global innodb_ft_server_stopword_table= "test/user_stopword"; +drop index idx on articles2; +Warnings: +Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB +Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB +create fulltext index idx on articles2(title, body); +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('the' IN NATURAL LANGUAGE MODE); +id title body +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('this' IN NATURAL LANGUAGE MODE); +id title body +# Cleanup +drop tables articles, articles2, user_stopword; +set global innodb_ft_server_stopword_table= default; diff --git a/mysql-test/suite/innodb_fts/r/versioning.result b/mysql-test/suite/innodb_fts/r/versioning.result new file mode 100644 index 0000000000000..baf25331d0d9e --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/versioning.result @@ -0,0 +1,304 @@ +# Upgrade test +DROP TABLE mysql.innodb_table_stats, mysql.innodb_index_stats; +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +ERROR HY000: Index articles is corrupted +call mtr.add_suppression("test/articles.? contains 3 indexes inside InnoDB"); +alter table articles force; +Warnings: +Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB +flush tables; +show create table articles; +Table Create Table +articles CREATE TABLE `articles` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(200) DEFAULT NULL, + `body` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`,`body`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +5 MySQL vs. YourSQL In the following database comparison ... +7 test query expansion for database ... +SELECT COUNT(*) FROM articles +WHERE MATCH (title,body) +AGAINST ('database' IN NATURAL LANGUAGE MODE); +COUNT(*) +3 +SELECT * FROM articles +WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT COUNT(IF(MATCH (title,body) +AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL)) +AS count FROM articles; +count +3 +SELECT id, body, MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score +FROM articles; +id body score +1 DBMS stands for DataBase ... 0.2734021842479706 +2 After you went through a ... 0 +3 In this tutorial we will show ... 0 +4 1. Never run mysqld as root. 2. ... 0 +5 In the following database comparison ... 0.2734021842479706 +6 When configured properly, MySQL ... 0 +7 for database ... 0.2734021842479706 +8 search, with proximity innodb 0 +9 search, with proximity innodb 0 +10 search, with proximity innodb 0 +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('MySQL' IN NATURAL LANGUAGE MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('DBMS Security' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('t*' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +7 test query expansion for database ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('MY*' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('ru*' IN BOOLEAN MODE); +id title body +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR HY000: Table handler out of memory +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))' + IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR 42000: syntax error, unexpected $end +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR 42000: syntax error, unexpected $end +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +1 MySQL Tutorial DBMS stands for DataBase ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT COUNT(*) FROM articles +WHERE MATCH (title,body) +AGAINST ('database' WITH QUERY EXPANSION); +COUNT(*) +10 +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('test' WITH QUERY EXPANSION); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +8 test proximity search, test, proximity and phrase search, with proximity innodb +7 test query expansion for database ... +1 MySQL Tutorial DBMS stands for DataBase ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following comparison"@3' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following comparison"@2' IN BOOLEAN MODE); +id title body +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following database"' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@3' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@2' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@5' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@5' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@1' IN BOOLEAN MODE); +id title body +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@4' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@3' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"@4' IN BOOLEAN MODE); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"@3' IN BOOLEAN MODE); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"' IN BOOLEAN MODE); +id title body +set global innodb_ft_server_stopword_table= "test/user_stopword"; +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('the' IN NATURAL LANGUAGE MODE); +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('this' IN NATURAL LANGUAGE MODE); +drop index idx on articles2; +Warnings: +Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB +create fulltext index idx on articles2(title, body); +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('the' IN NATURAL LANGUAGE MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('this' IN NATURAL LANGUAGE MODE); +id title body +# Cleanup +drop tables articles, articles2, user_stopword; +set global innodb_ft_server_stopword_table= default; diff --git a/mysql-test/suite/innodb_fts/t/basic.inc b/mysql-test/suite/innodb_fts/t/basic.inc new file mode 100644 index 0000000000000..fd7d09208bc26 --- /dev/null +++ b/mysql-test/suite/innodb_fts/t/basic.inc @@ -0,0 +1,264 @@ +if ($basic_stage == create_table) +{ +# Create FTS table +--error ER_INNODB_NO_FT_TEMP_TABLE +CREATE TEMPORARY TABLE articles ( + id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, + title VARCHAR(200), + body TEXT, + FULLTEXT (title,body) + ) ENGINE=InnoDB; + +--disable_query_log +eval CREATE TABLE articles ( + id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, + title VARCHAR(200), + body TEXT, + FULLTEXT (title,body) + )$create_options ENGINE=InnoDB; +--enable_query_log +} + +if ($basic_stage == insert_1) +{ +# Insert six rows +INSERT INTO articles (title,body) VALUES + ('MySQL Tutorial','DBMS stands for DataBase ...') , + ('How To Use MySQL Well','After you went through a ...'), + ('Optimizing MySQL','In this tutorial we will show ...'), + ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), + ('MySQL vs. YourSQL','In the following database comparison ...'), + ('MySQL Security','When configured properly, MySQL ...'); +} + +if ($basic_stage == select_1) +{ +# Look for 'Database' in table article +SELECT * FROM articles + WHERE MATCH (title,body) + AGAINST ('Database' IN NATURAL LANGUAGE MODE); + +SELECT COUNT(*) FROM articles + WHERE MATCH (title,body) + AGAINST ('database' IN NATURAL LANGUAGE MODE); + +SELECT * FROM articles + WHERE MATCH (title, body) + AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); + + +SELECT COUNT(IF(MATCH (title,body) + AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL)) + AS count FROM articles; + +# Select Relevance Ranking +SELECT id, body, MATCH (title,body) + AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score + FROM articles; + +# 'MySQL' treated as stopword (stopword functionality not yet supported) +SELECT * FROM articles + WHERE MATCH (title,body) + AGAINST ('MySQL' IN NATURAL LANGUAGE MODE); + +# Boolean search +# Select rows contain "MySQL" but not "YourSQL" +SELECT * FROM articles WHERE MATCH (title,body) + AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); + +# Select rows contain at least one of the two words +SELECT * FROM articles WHERE MATCH (title,body) + AGAINST ('DBMS Security' IN BOOLEAN MODE); + +# Select rows contain both "MySQL" and "YourSQL" +SELECT * FROM articles WHERE MATCH (title,body) + AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE); + +# Select rows contain "MySQL" but rank rows with "YourSQL" higher +SELECT * FROM articles WHERE MATCH (title,body) + AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE); + +# Test negation operator. Select rows contain MySQL, +# if the row contains "YourSQL", rank it lower +SELECT * FROM articles WHERE MATCH (title,body) + AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE); + +# Test wild card search operator +# Notice row with "the" will not get fetched due to +# stopword filtering +SELECT * FROM articles WHERE MATCH (title,body) + AGAINST ('t*' IN BOOLEAN MODE); + +# Test wild card search, notice row 6 with 2 "MySQL" rank first +SELECT * FROM articles WHERE MATCH (title,body) + AGAINST ('MY*' IN BOOLEAN MODE); + +# Another wild card search +SELECT * FROM articles WHERE MATCH (title,body) + AGAINST ('ru*' IN BOOLEAN MODE); + +# Test ">" and "<" Operator, the ">" operator increases +# the word relevance rank and the "<" operator decreases it +# Following test puts rows with "Well" on top and rows +# with "stands" at the bottom +SELECT * FROM articles WHERE MATCH (title,body) + AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE); + +# Test sub-expression boolean search. Find rows contain +# "MySQL" but not "Well" or "stands". +SELECT * FROM articles WHERE MATCH (title,body) + AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE); + +--error 128 +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))' + IN BOOLEAN MODE); + +--error ER_PARSE_ERROR +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +--error ER_PARSE_ERROR +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); + +# Test sub-expression boolean search. Find rows contain +# "MySQL" and "Well" or "MySQL" and "stands". But rank the +# doc with "Well" higher, and doc with "stands" lower. +SELECT * FROM articles WHERE MATCH (title,body) + AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE); + +# Test nested sub-expression. +SELECT * FROM articles WHERE MATCH (title,body) + AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE); + +# Find rows with "MySQL" but not "Tricks", "Security" nor "YourSQL" +SELECT * FROM articles WHERE MATCH (title,body) + AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE); + +# Test non-word delimiter combined with negate "-" operator +# This should return the same result as 'mysql - (Security DBMS)' +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE); +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE); + +# Again, the operator sequence should not matter +SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE); + +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE); + +# Test query expansion +SELECT COUNT(*) FROM articles + WHERE MATCH (title,body) + AGAINST ('database' WITH QUERY EXPANSION); +} + +if ($basic_stage == insert_2) +{ +INSERT INTO articles (title,body) VALUES + ('test query expansion','for database ...'); +} + +if ($basic_stage == select_2) +{ +# This query will return result containing word "database" as +# the query expand from "test" to words in document just +# inserted above +SELECT * FROM articles + WHERE MATCH (title,body) + AGAINST ('test' WITH QUERY EXPANSION); + +# This is to test the proximity search, search two word +# "following" and "comparison" within 19 character space +SELECT * FROM articles + WHERE MATCH (title,body) + AGAINST ('"following comparison"@3' IN BOOLEAN MODE); + +# This is to test the proximity search, search two word +# "following" and "comparison" within 19 character space +# This search should come with no return result +SELECT * FROM articles + WHERE MATCH (title,body) + AGAINST ('"following comparison"@2' IN BOOLEAN MODE); + +# This is to test the phrase search, searching phrase +# "following database" +SELECT * FROM articles + WHERE MATCH (title,body) + AGAINST ('"following database"' IN BOOLEAN MODE); +} + +if ($basic_stage == insert_3) +{ +# Insert into table with similar word of different distances +INSERT INTO articles (title,body) VALUES + ('test proximity search, test, proximity and phrase', + 'search, with proximity innodb'); + +INSERT INTO articles (title,body) VALUES + ('test my proximity fts new search, test, proximity and phrase', + 'search, with proximity innodb'); + +INSERT INTO articles (title,body) VALUES + ('test more of proximity fts search, test, more proximity and phrase', + 'search, with proximity innodb'); +} + +if ($basic_stage == select_3) +{ +# This should only return the first document +SELECT * FROM articles + WHERE MATCH (title,body) + AGAINST ('"proximity search"@3' IN BOOLEAN MODE); + +# This would return no document +SELECT * FROM articles + WHERE MATCH (title,body) + AGAINST ('"proximity search"@2' IN BOOLEAN MODE); + +# This give you all three documents +SELECT * FROM articles + WHERE MATCH (title,body) + AGAINST ('"proximity search"@5' IN BOOLEAN MODE); + +# Similar boundary testing for the words +SELECT * FROM articles + WHERE MATCH (title,body) + AGAINST ('"test proximity"@5' IN BOOLEAN MODE); + +# No document will be returned +SELECT * FROM articles + WHERE MATCH (title,body) + AGAINST ('"test proximity"@1' IN BOOLEAN MODE); + +# All three documents will be returned +SELECT * FROM articles + WHERE MATCH (title,body) + AGAINST ('"test proximity"@4' IN BOOLEAN MODE); + +# Only two document will be returned. +SELECT * FROM articles + WHERE MATCH (title,body) + AGAINST ('"test proximity"@3' IN BOOLEAN MODE); + +# Test with more word The last document will return, please notice there +# is no ordering requirement for proximity search. +SELECT * FROM articles + WHERE MATCH (title,body) + AGAINST ('"more test proximity"@4' IN BOOLEAN MODE); + +SELECT * FROM articles + WHERE MATCH (title,body) + AGAINST ('"more test proximity"@3' IN BOOLEAN MODE); + +# The phrase search will not require exact word ordering +SELECT * FROM articles + WHERE MATCH (title,body) + AGAINST ('"more test proximity"' IN BOOLEAN MODE); +} diff --git a/mysql-test/suite/innodb_fts/t/basic.test b/mysql-test/suite/innodb_fts/t/basic.test index 53ad978a5b13c..df2e24fae8e73 100644 --- a/mysql-test/suite/innodb_fts/t/basic.test +++ b/mysql-test/suite/innodb_fts/t/basic.test @@ -1,252 +1,33 @@ # This is the basic function tests for innodb FTS -- source include/have_innodb.inc +--let $modify_create_table= 1 +-- source include/maybe_versioning.inc -# Create FTS table ---error ER_INNODB_NO_FT_TEMP_TABLE -CREATE TEMPORARY TABLE articles ( - id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, - title VARCHAR(200), - body TEXT, - FULLTEXT (title,body) - ) ENGINE=InnoDB; +let $basic_stage= create_table; +--source basic.inc -CREATE TABLE articles ( - id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, - title VARCHAR(200), - body TEXT, - FULLTEXT (title,body) - ) ENGINE=InnoDB; - -# Insert six rows -INSERT INTO articles (title,body) VALUES - ('MySQL Tutorial','DBMS stands for DataBase ...') , - ('How To Use MySQL Well','After you went through a ...'), - ('Optimizing MySQL','In this tutorial we will show ...'), - ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), - ('MySQL vs. YourSQL','In the following database comparison ...'), - ('MySQL Security','When configured properly, MySQL ...'); +let $basic_stage= insert_1; +--source basic.inc -- disable_result_log ANALYZE TABLE articles; -- enable_result_log -# Look for 'Database' in table article -SELECT * FROM articles - WHERE MATCH (title,body) - AGAINST ('Database' IN NATURAL LANGUAGE MODE); - -SELECT COUNT(*) FROM articles - WHERE MATCH (title,body) - AGAINST ('database' IN NATURAL LANGUAGE MODE); - -SELECT * FROM articles - WHERE MATCH (title, body) - AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); - - -SELECT COUNT(IF(MATCH (title,body) - AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL)) - AS count FROM articles; - -# Select Relevance Ranking -SELECT id, body, MATCH (title,body) - AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score - FROM articles; - -# 'MySQL' treated as stopword (stopword functionality not yet supported) -SELECT * FROM articles - WHERE MATCH (title,body) - AGAINST ('MySQL' IN NATURAL LANGUAGE MODE); - -# Boolean search -# Select rows contain "MySQL" but not "YourSQL" -SELECT * FROM articles WHERE MATCH (title,body) - AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); - -# Select rows contain at least one of the two words -SELECT * FROM articles WHERE MATCH (title,body) - AGAINST ('DBMS Security' IN BOOLEAN MODE); - -# Select rows contain both "MySQL" and "YourSQL" -SELECT * FROM articles WHERE MATCH (title,body) - AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE); - -# Select rows contain "MySQL" but rank rows with "YourSQL" higher -SELECT * FROM articles WHERE MATCH (title,body) - AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE); - -# Test negation operator. Select rows contain MySQL, -# if the row contains "YourSQL", rank it lower -SELECT * FROM articles WHERE MATCH (title,body) - AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE); - -# Test wild card search operator -# Notice row with "the" will not get fetched due to -# stopword filtering -SELECT * FROM articles WHERE MATCH (title,body) - AGAINST ('t*' IN BOOLEAN MODE); - -# Test wild card search, notice row 6 with 2 "MySQL" rank first -SELECT * FROM articles WHERE MATCH (title,body) - AGAINST ('MY*' IN BOOLEAN MODE); - -# Another wild card search -SELECT * FROM articles WHERE MATCH (title,body) - AGAINST ('ru*' IN BOOLEAN MODE); - -# Test ">" and "<" Operator, the ">" operator increases -# the word relevance rank and the "<" operator decreases it -# Following test puts rows with "Well" on top and rows -# with "stands" at the bottom -SELECT * FROM articles WHERE MATCH (title,body) - AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE); - -# Test sub-expression boolean search. Find rows contain -# "MySQL" but not "Well" or "stands". -SELECT * FROM articles WHERE MATCH (title,body) - AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE); - ---error 128 -SELECT * FROM articles WHERE MATCH (title,body) AGAINST -('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))' - IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST -('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' - IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST -('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))' - IN BOOLEAN MODE); - ---error ER_PARSE_ERROR -SELECT * FROM articles WHERE MATCH (title,body) AGAINST -('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))' - IN BOOLEAN MODE); ---error ER_PARSE_ERROR -SELECT * FROM articles WHERE MATCH (title,body) AGAINST -('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' - IN BOOLEAN MODE); - -# Test sub-expression boolean search. Find rows contain -# "MySQL" and "Well" or "MySQL" and "stands". But rank the -# doc with "Well" higher, and doc with "stands" lower. -SELECT * FROM articles WHERE MATCH (title,body) - AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE); - -# Test nested sub-expression. -SELECT * FROM articles WHERE MATCH (title,body) - AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE); - -# Find rows with "MySQL" but not "Tricks", "Security" nor "YourSQL" -SELECT * FROM articles WHERE MATCH (title,body) - AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE); - -# Test non-word delimiter combined with negate "-" operator -# This should return the same result as 'mysql - (Security DBMS)' -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE); - -# Again, the operator sequence should not matter -SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE); - -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE); - -# Test query expansion -SELECT COUNT(*) FROM articles - WHERE MATCH (title,body) - AGAINST ('database' WITH QUERY EXPANSION); - -INSERT INTO articles (title,body) VALUES - ('test query expansion','for database ...'); - -# This query will return result containing word "database" as -# the query expand from "test" to words in document just -# inserted above -SELECT * FROM articles - WHERE MATCH (title,body) - AGAINST ('test' WITH QUERY EXPANSION); - -# This is to test the proximity search, search two word -# "following" and "comparison" within 19 character space -SELECT * FROM articles - WHERE MATCH (title,body) - AGAINST ('"following comparison"@3' IN BOOLEAN MODE); - -# This is to test the proximity search, search two word -# "following" and "comparison" within 19 character space -# This search should come with no return result -SELECT * FROM articles - WHERE MATCH (title,body) - AGAINST ('"following comparison"@2' IN BOOLEAN MODE); - -# This is to test the phrase search, searching phrase -# "following database" -SELECT * FROM articles - WHERE MATCH (title,body) - AGAINST ('"following database"' IN BOOLEAN MODE); - -# Insert into table with similar word of different distances -INSERT INTO articles (title,body) VALUES - ('test proximity search, test, proximity and phrase', - 'search, with proximity innodb'); - -INSERT INTO articles (title,body) VALUES - ('test my proximity fts new search, test, proximity and phrase', - 'search, with proximity innodb'); - -INSERT INTO articles (title,body) VALUES - ('test more of proximity fts search, test, more proximity and phrase', - 'search, with proximity innodb'); - -# This should only return the first document -SELECT * FROM articles - WHERE MATCH (title,body) - AGAINST ('"proximity search"@3' IN BOOLEAN MODE); - -# This would return no document -SELECT * FROM articles - WHERE MATCH (title,body) - AGAINST ('"proximity search"@2' IN BOOLEAN MODE); - -# This give you all three documents -SELECT * FROM articles - WHERE MATCH (title,body) - AGAINST ('"proximity search"@5' IN BOOLEAN MODE); - -# Similar boundary testing for the words -SELECT * FROM articles - WHERE MATCH (title,body) - AGAINST ('"test proximity"@5' IN BOOLEAN MODE); - -# No document will be returned -SELECT * FROM articles - WHERE MATCH (title,body) - AGAINST ('"test proximity"@1' IN BOOLEAN MODE); - -# All three documents will be returned -SELECT * FROM articles - WHERE MATCH (title,body) - AGAINST ('"test proximity"@4' IN BOOLEAN MODE); +let $basic_stage= select_1; +--source basic.inc -# Only two document will be returned. -SELECT * FROM articles - WHERE MATCH (title,body) - AGAINST ('"test proximity"@3' IN BOOLEAN MODE); +let $basic_stage= insert_2; +--source basic.inc -# Test with more word The last document will return, please notice there -# is no ordering requirement for proximity search. -SELECT * FROM articles - WHERE MATCH (title,body) - AGAINST ('"more test proximity"@4' IN BOOLEAN MODE); +let $basic_stage= select_2; +--source basic.inc -SELECT * FROM articles - WHERE MATCH (title,body) - AGAINST ('"more test proximity"@3' IN BOOLEAN MODE); +let $basic_stage= insert_3; +--source basic.inc -# The phrase search will not require exact word ordering -SELECT * FROM articles - WHERE MATCH (title,body) - AGAINST ('"more test proximity"' IN BOOLEAN MODE); +let $basic_stage= select_3; +--source basic.inc drop table articles; diff --git a/mysql-test/suite/innodb_fts/t/bug_32831765.test b/mysql-test/suite/innodb_fts/t/bug_32831765.test index a4551cf91ef2c..80502f7f65002 100644 --- a/mysql-test/suite/innodb_fts/t/bug_32831765.test +++ b/mysql-test/suite/innodb_fts/t/bug_32831765.test @@ -2,6 +2,7 @@ --source include/have_debug.inc --source include/big_test.inc +call mtr.add_suppression("InnoDB: Total InnoDB FTS size .* for the table .* exceeds the innodb_ft_cache_size .*"); --echo # --echo # Bug#32831765 SERVER HITS OOM CONDITION WHEN LOADING TWO --echo # INNODB TABLES WITH FTS INDEXES diff --git a/mysql-test/suite/innodb_fts/t/concurrent_insert.test b/mysql-test/suite/innodb_fts/t/concurrent_insert.test index 35debd87cea5f..9b4d9517b1a12 100644 --- a/mysql-test/suite/innodb_fts/t/concurrent_insert.test +++ b/mysql-test/suite/innodb_fts/t/concurrent_insert.test @@ -48,5 +48,33 @@ connection con1; reap; drop table t1, t2; connection default; -set DEBUG_SYNC=RESET; SET @@GLOBAL.debug_dbug = @saved_dbug; +disconnect con1; + +--echo # +--echo # MDEV-25984 Assertion `max_doc_id > 0' failed in fts_init_doc_id() +--echo # +call mtr.add_suppression("InnoDB: \\(Lock wait timeout\\) while getting next doc id for table `test`.`t1`"); + +CREATE TABLE t1(f1 CHAR(100), f2 INT, fulltext(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES("mariadb", 1), ("innodb", 1); +--source include/restart_mysqld.inc +SET DEBUG_SYNC='innodb_rollback_after_fts_lock SIGNAL insert_dml WAIT_FOR ddl_continue'; +SEND ALTER TABLE t1 ADD UNIQUE INDEX(f2); + +connect(con1,localhost,root,,,); +SET DEBUG_SYNC='now WAIT_FOR insert_dml'; +SET DEBUG_SYNC='fts_cmp_set_sync_doc_id_retry SIGNAL ddl_continue WAIT_FOR dml_finish'; +send INSERT INTO t1 VALUES("index", 2); + +connection default; +--error ER_DUP_ENTRY +reap; +SET DEBUG_SYNC="now SIGNAL dml_finish"; +connection con1; +reap; +SHOW CREATE TABLE t1; +connection default; +disconnect con1; +DROP TABLE t1; +set DEBUG_SYNC=RESET; diff --git a/mysql-test/suite/innodb_fts/t/crash_recovery.test b/mysql-test/suite/innodb_fts/t/crash_recovery.test index 702aaefad830a..cb53de4d595db 100644 --- a/mysql-test/suite/innodb_fts/t/crash_recovery.test +++ b/mysql-test/suite/innodb_fts/t/crash_recovery.test @@ -8,6 +8,7 @@ --source include/not_embedded.inc --source include/maybe_debug.inc if ($have_debug) { source include/have_debug_sync.inc; } +--source include/maybe_versioning.inc FLUSH TABLES; # Following are test for crash recovery on FTS index, the first scenario @@ -23,6 +24,16 @@ CREATE TABLE articles ( FULLTEXT (title,body) ) ENGINE=InnoDB; +let $vers= $MTR_COMBINATION_VERS + $MTR_COMBINATION_VERS_TRX; +if ($vers) +{ + --disable_query_log + INSERT INTO articles (title,body) VALUES + ('history','Deleted row ...'); + DELETE FROM articles; + --enable_query_log +} + # Drop the FTS index before more insertion. The FTS_DOC_ID should # be kept DROP INDEX title ON articles; @@ -118,6 +129,13 @@ INSERT INTO articles (title,body) VALUES # Recreate fulltext index to see if everything is OK CREATE FULLTEXT INDEX idx ON articles (title,body); +if ($vers) +{ + --disable_query_log + UPDATE articles SET id= id - 1; + --enable_query_log +} + # Should return 3 rows SELECT * FROM articles WHERE MATCH (title,body) @@ -159,6 +177,13 @@ disconnect dml; INSERT INTO articles (title,body) VALUES ('MySQL Tutorial','DBMS stands for DataBase ...'); +if ($vers) +{ + --disable_query_log + UPDATE articles SET id= id - 1 WHERE id > 8; + --enable_query_log +} + # Should return 6 rows SELECT * FROM articles WHERE MATCH (title,body) @@ -195,6 +220,15 @@ BEGIN; INSERT INTO articles VALUES (100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...'); +if ($vers) +{ + --disable_query_log + DELETE FROM articles WHERE id = 100; + INSERT INTO articles VALUES + (100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...'); + --enable_query_log +} + connect(dml2, localhost, root,,); --echo # @@ -255,4 +289,21 @@ SELECT * FROM mdev19073_2 WHERE MATCH (title, body) AGAINST ('Database' IN NATURAL LANGUAGE MODE); DROP TABLE mdev19073, mdev19073_2; +let $shutdown_timeout=; + +--echo # +--echo # MDEV-28706 Redundant InnoDB table fails during alter +--echo # + +SET @@global.innodb_file_per_table = 0; +CREATE TABLE t1 ( + col_int INTEGER, col_text TEXT, + col_text_1 TEXT +) ENGINE = InnoDB ROW_FORMAT = Redundant ; +ALTER TABLE t1 ADD FULLTEXT KEY `ftidx` ( col_text ) ; +INSERT INTO t1 VALUES ( 1255, "mariadb", "InnoDB"); +--source include/restart_mysqld.inc +ALTER TABLE t1 ADD FULLTEXT(col_text_1); +DROP TABLE t1; + SELECT * FROM information_schema.innodb_sys_tables WHERE name LIKE 'test/%'; diff --git a/mysql-test/suite/innodb_fts/t/create.test b/mysql-test/suite/innodb_fts/t/create.test index 38c93de49820d..e6a7e993f84b7 100644 --- a/mysql-test/suite/innodb_fts/t/create.test +++ b/mysql-test/suite/innodb_fts/t/create.test @@ -1,4 +1,5 @@ --source include/have_innodb.inc +--source include/maybe_versioning.inc SET NAMES utf8mb4; --echo # @@ -110,10 +111,28 @@ SET GLOBAL innodb_optimize_fulltext_only= @optimize_fulltext.save; --echo # --echo # MDEV-24403 Segfault on CREATE TABLE with explicit FTS_DOC_ID_INDEX by multiple fields --echo # ---error ER_WRONG_NAME_FOR_INDEX +--error ER_INNODB_FT_WRONG_DOCID_INDEX create table t1 ( f1 int, f2 text, FTS_DOC_ID bigint unsigned not null, unique key FTS_DOC_ID_INDEX(FTS_DOC_ID, f1), fulltext (f2)) engine=innodb; + +--echo # +--echo # MDEV-26938 Support descending indexes internally in InnoDB +--echo # + +--error ER_INNODB_FT_WRONG_DOCID_INDEX +CREATE TABLE t1(a INT PRIMARY KEY, b TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, + UNIQUE KEY FTS_DOC_ID_INDEX(FTS_DOC_ID DESC), FULLTEXT(b)) +ENGINE=InnoDB; + +CREATE TABLE t1(a INT PRIMARY KEY, b TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, + UNIQUE KEY FTS_DOC_ID_INDEX(FTS_DOC_ID DESC)) ENGINE=InnoDB; +SHOW CREATE TABLE t1; +--error ER_INNODB_FT_WRONG_DOCID_INDEX +ALTER TABLE t1 ADD FULLTEXT INDEX(b), ALGORITHM=INPLACE; +--error ER_INNODB_FT_WRONG_DOCID_INDEX +ALTER TABLE t1 ADD FULLTEXT INDEX(b), ALGORITHM=COPY; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/t/ft_result_cache_limit.test b/mysql-test/suite/innodb_fts/t/ft_result_cache_limit.test new file mode 100644 index 0000000000000..84254a182d730 --- /dev/null +++ b/mysql-test/suite/innodb_fts/t/ft_result_cache_limit.test @@ -0,0 +1,57 @@ +--echo # +--echo # Bug 1634932: Assertion failure in thread x in +--echo # file fts0que.cc +--echo # + +--source include/have_innodb.inc +--source include/have_debug.inc + +SET @saved_innodb_ft_result_cache_limit= @@global.innodb_ft_result_cache_limit; + +CREATE TABLE `t1` ( + `FTS_DOC_ID` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, + `text_content` MEDIUMTEXT, PRIMARY KEY (`FTS_DOC_ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE UNIQUE INDEX FTS_DOC_ID_INDEX ON t1(FTS_DOC_ID); + +SET autocommit=0; + +DELIMITER //; +CREATE PROCEDURE populate_t1() +BEGIN + DECLARE i INT DEFAULT 1; + WHILE (i <= 250) DO + INSERT INTO t1 (text_content) VALUES ("some_text_1234 aaa"); + SET i = i + 1; + END WHILE; +END// + +DELIMITER ;// + +CALL populate_t1; +SET autocommit=1; + +SET SESSION debug="+d,fts_instrument_result_cache_limit"; + +ALTER TABLE t1 ADD FULLTEXT INDEX `text_content_idx` (`text_content`); + +# HA_ERR_FTS_EXCEED_RESULT_CACHE_LIMIT = 188 +--error 128 +SELECT FTS_DOC_ID, text_content +FROM t1 +WHERE MATCH text_content AGAINST ('+some_text_1234' IN BOOLEAN MODE); + +--error 128 +UPDATE t1 +SET text_content='some_text_12345' +where MATCH text_content AGAINST ('+some_text_1234' IN BOOLEAN MODE); + +--error 128 +DELETE FROM t1 +WHERE MATCH text_content AGAINST ('+some_text_1234' IN BOOLEAN MODE); + +SET GLOBAL innodb_ft_result_cache_limit = @saved_innodb_ft_result_cache_limit; + +DROP TABLE t1; +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb_fts/t/fulltext.test b/mysql-test/suite/innodb_fts/t/fulltext.test index 18baf56281f44..3ddc1856b7f06 100644 --- a/mysql-test/suite/innodb_fts/t/fulltext.test +++ b/mysql-test/suite/innodb_fts/t/fulltext.test @@ -743,4 +743,63 @@ SHOW CREATE TABLE t1; DROP TABLE t1; --enable_warnings +--echo # +--echo # MDEV-25257 SEGV in fts_get_next_doc_id upon some INSERT +--echo # +SET @save = @@global.innodb_file_per_table; +SET @@global.innodb_file_per_table = 0; + +CREATE TABLE t1 ( + col_int INTEGER, col_text TEXT, + col_int_g INTEGER GENERATED ALWAYS AS (col_int) +) ENGINE = InnoDB ROW_FORMAT = Redundant ; +ALTER TABLE t1 ADD FULLTEXT KEY `ftidx` ( col_text ) ; +ALTER TABLE t1 DROP KEY `ftidx` ; +INSERT INTO t1 (col_int, col_text) VALUES ( 1255, NULL); +DROP TABLE t1; +SET @@global.innodb_file_per_table = @save; + +--echo # +--echo # MDEV-20797 FULLTEXT search with apostrophe, +--echo # and mandatory words +--echo # +CREATE TABLE t1(f1 TINYTEXT NOT NULL, FULLTEXT(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES('O''Brien'), ('O Brien'), ('�''Brien'); +INSERT INTO t1 VALUES('Brien'), ('O ''Brien'), ('O'' Brien'); +INSERT INTO t1 VALUES('Doh''nuts'); +SELECT * FROM t1 WHERE MATCH (f1) AGAINST ("+O'Brien" IN BOOLEAN MODE); +SELECT * FROM t1 WHERE MATCH (f1) AGAINST ("+Doh'nuts" IN BOOLEAN MODE); +SELECT * FROM t1 WHERE MATCH (f1) AGAINST ("+�''Brien" IN BOOLEAN MODE); +DROP TABLE t1; + +--echo # +--echo # MDEV-29058 Assertion `index->type == 32' failed +--echo # in dict_index_build_internal_fts +--echo # +call mtr.add_suppression("InnoDB: Index `f` of table `test`.`t2` is corrupted"); +call mtr.add_suppression("InnoDB: Skip adjustment of root pages for index `f`."); +let $MYSQLD_DATADIR = `SELECT @@datadir`; +CREATE TABLE t1 (f CHAR(8), FULLTEXT KEY (f)) ENGINE=InnoDB; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 DISCARD TABLESPACE; +--disable_warnings +FLUSH TABLES t1 FOR EXPORT; +--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t2.ibd +--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t2.cfg +UNLOCK TABLES; +ALTER TABLE t1 DISCARD TABLESPACE; +ALTER TABLE t2 IMPORT TABLESPACE; +--enable_warnings +DROP TABLE t2, t1; + +--echo # +--echo # MDEV-29778 Having Unique index interference with MATCH +--echo # from a FULLTEXT +--echo # +CREATE TABLE t1(f1 VARCHAR(100), FULLTEXT(f1), + UNIQUE INDEX(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES("test"); +SELECT f1, MATCH(f1) AGAINST ("test" IN BOOLEAN MODE) FROM t1; +DROP TABLE t1; + --echo # End of 10.3 tests diff --git a/mysql-test/suite/innodb_fts/t/fulltext2.test b/mysql-test/suite/innodb_fts/t/fulltext2.test index 4dd2c78827f7f..7efd9adeeac89 100644 --- a/mysql-test/suite/innodb_fts/t/fulltext2.test +++ b/mysql-test/suite/innodb_fts/t/fulltext2.test @@ -7,6 +7,7 @@ # --source include/have_innodb.inc +--source include/maybe_versioning.inc CREATE TABLE t1 ( i int(10) unsigned not null auto_increment primary key, @@ -212,7 +213,17 @@ delete from t1 limit 1; # # BUG#16489: utf8 + fulltext leads to corrupt index file. # +if ($MTR_COMBINATION_ORIG) +{ truncate table t1; +} +if (!$MTR_COMBINATION_ORIG) +{ +--disable_query_log +delete from t1; +--enable_query_log +--echo truncate table t1; +} insert into t1 values('ab c d'); update t1 set a='ab c d'; select * from t1 where match a against('ab c' in boolean mode); @@ -257,3 +268,30 @@ INSERT INTO t1 (id, first_name, last_name) VALUES analyze table t1; SELECT fts_doc_id, first_name, last_name, MATCH(first_name) AGAINST('Homer' IN BOOLEAN MODE) AS score FROM t1; DROP TABLE t1; + +# +# MDEV-28912 NON-UNIQUE FTS_DOC_ID mistaken as FTS_DOC_ID_INDEX +# +CREATE TABLE t1(a INT, b TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, + KEY FTS_DOC_ID_INDEX(FTS_DOC_ID))ENGINE=InnoDB; +ALTER TABLE t1 ADD COLUMN c INT as (a) VIRTUAL; +ALTER TABLE t1 ADD d INT NULL; +--error ER_INNODB_FT_WRONG_DOCID_INDEX +ALTER TABLE t1 ADD FULLTEXT(b); +DROP TABLE t1; + +--echo # +--echo # MDEV-29169 Using MATCH returns NULL for Virtual Column +--echo # +CREATE TABLE t (a TEXT DEFAULT NULL, + b TEXT AS (a), + c TEXT AS (concat(a, '1')), + d int AS (111) VIRTUAL, + FULLTEXT KEY `a` (`a`) +) ENGINE=InnoDB; + +INSERT INTO t (a) VALUES ('test'); +SELECT * FROM t; +SELECT * FROM t WHERE MATCH(a) AGAINST('test'); + +DROP TABLE t; diff --git a/mysql-test/suite/innodb_fts/t/fulltext3.test b/mysql-test/suite/innodb_fts/t/fulltext3.test index 9c7941d7b5c72..f28ca2c7d774e 100644 --- a/mysql-test/suite/innodb_fts/t/fulltext3.test +++ b/mysql-test/suite/innodb_fts/t/fulltext3.test @@ -3,6 +3,7 @@ # test of new fulltext search features # --source include/have_innodb.inc +--source include/maybe_versioning.inc --disable_warnings DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/innodb_fts/t/fulltext_cache.test b/mysql-test/suite/innodb_fts/t/fulltext_cache.test index fa7ad49e88131..37926c1e7f1c7 100644 --- a/mysql-test/suite/innodb_fts/t/fulltext_cache.test +++ b/mysql-test/suite/innodb_fts/t/fulltext_cache.test @@ -2,6 +2,7 @@ # Bugreport due to Roy Nasser # --source include/have_innodb.inc +--source include/maybe_versioning.inc --disable_warnings drop table if exists t1, t2; diff --git a/mysql-test/suite/innodb_fts/t/fulltext_distinct.test b/mysql-test/suite/innodb_fts/t/fulltext_distinct.test index f623270454315..bb390a0838461 100644 --- a/mysql-test/suite/innodb_fts/t/fulltext_distinct.test +++ b/mysql-test/suite/innodb_fts/t/fulltext_distinct.test @@ -3,6 +3,7 @@ # bug reported by Tibor Simko # --source include/have_innodb.inc +--source include/maybe_versioning.inc --disable_warnings DROP TABLE IF EXISTS t1, t2; diff --git a/mysql-test/suite/innodb_fts/t/fulltext_left_join.test b/mysql-test/suite/innodb_fts/t/fulltext_left_join.test index 23bbd5ddc10c4..0a1e174876929 100644 --- a/mysql-test/suite/innodb_fts/t/fulltext_left_join.test +++ b/mysql-test/suite/innodb_fts/t/fulltext_left_join.test @@ -2,6 +2,7 @@ # Test for bug from Jean-C�dric COSTA # --source include/have_innodb.inc +--source include/maybe_versioning.inc --disable_warnings drop table if exists t1, t2; diff --git a/mysql-test/suite/innodb_fts/t/fulltext_misc.test b/mysql-test/suite/innodb_fts/t/fulltext_misc.test index 25690ddc1d988..083953a44ce46 100644 --- a/mysql-test/suite/innodb_fts/t/fulltext_misc.test +++ b/mysql-test/suite/innodb_fts/t/fulltext_misc.test @@ -152,8 +152,7 @@ insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); select * from t1 where a like "abc%"; select * from t1 where a like "test%"; select * from t1 where a like "te_t"; -# InnoDB_FTS: we don't support the postfix "+0" -select * from t1 where match a against ("te*" in boolean mode)+0; +select * from t1 where match a against ("te*" in boolean mode); drop table t1; diff --git a/mysql-test/suite/innodb_fts/t/fulltext_multi.test b/mysql-test/suite/innodb_fts/t/fulltext_multi.test index 274027ea10bf0..81ab7e1b0713b 100644 --- a/mysql-test/suite/innodb_fts/t/fulltext_multi.test +++ b/mysql-test/suite/innodb_fts/t/fulltext_multi.test @@ -1,5 +1,6 @@ # several FULLTEXT indexes in one table test --source include/have_innodb.inc +--source include/maybe_versioning.inc --disable_warnings DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/innodb_fts/t/fulltext_order_by.test b/mysql-test/suite/innodb_fts/t/fulltext_order_by.test index d2194f22e2ab9..f14681b934d32 100644 --- a/mysql-test/suite/innodb_fts/t/fulltext_order_by.test +++ b/mysql-test/suite/innodb_fts/t/fulltext_order_by.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc +--source include/maybe_versioning.inc --disable_warnings DROP TABLE IF EXISTS t1,t2,t3; diff --git a/mysql-test/suite/innodb_fts/t/fulltext_update.test b/mysql-test/suite/innodb_fts/t/fulltext_update.test index 336e8de1d1b4d..bda97cd4a2149 100644 --- a/mysql-test/suite/innodb_fts/t/fulltext_update.test +++ b/mysql-test/suite/innodb_fts/t/fulltext_update.test @@ -2,6 +2,7 @@ # Test for bug by voi@ims.at # --source include/have_innodb.inc +--source include/maybe_versioning.inc --disable_warnings drop table if exists test; diff --git a/mysql-test/suite/innodb_fts/t/fulltext_var.test b/mysql-test/suite/innodb_fts/t/fulltext_var.test index 2b94aa5842450..e8e4bf9330381 100644 --- a/mysql-test/suite/innodb_fts/t/fulltext_var.test +++ b/mysql-test/suite/innodb_fts/t/fulltext_var.test @@ -2,6 +2,7 @@ # Fulltext configurable parameters # --source include/have_innodb.inc +--source include/maybe_versioning.inc # Save ft_boolean_syntax variable let $saved_ft_boolean_syntax=`select @@global.ft_boolean_syntax`; diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.opt b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.opt index e6ae8d0fe0a5b..5d5cca1c6f242 100644 --- a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.opt +++ b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.opt @@ -1 +1,2 @@ --enable-plugin-innodb-sys-tables +--innodb_ft_index_table diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test index 78494910b487e..31f10399bc230 100644 --- a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test +++ b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test @@ -1,6 +1,7 @@ # This is the DDL function tests for innodb FTS -- source include/have_innodb.inc +-- source include/maybe_versioning.inc # Create FTS table CREATE TABLE fts_test ( @@ -54,7 +55,21 @@ SELECT * FROM fts_test WHERE MATCH (title,body) AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); # Truncate table +let $vers=$MTR_COMBINATION_VERS+$MTR_COMBINATION_VERS_TRX; + +if ($vers) +{ +--disable_query_log +CREATE TABLE fts_test2 LIKE fts_test; +DROP TABLE fts_test; +RENAME TABLE fts_test2 TO fts_test; +--enable_query_log +--echo TRUNCATE TABLE fts_test; +} +if (!$vers) +{ TRUNCATE TABLE fts_test; +} DROP INDEX idx ON fts_test; @@ -333,6 +348,7 @@ CREATE TABLE t1(a TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL UNIQUE) ENGINE=InnoD let $fts_aux_file= `select concat('FTS_',right(concat(repeat('0',16), lower(hex(TABLE_ID))),16),'_BEING_DELETED.ibd') FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME='test/t1'`; write_file $MYSQLD_DATADIR/test/$fts_aux_file; EOF +--replace_regex /".*" from/"Resource temporarily unavailable" from/ --error ER_GET_ERRNO ALTER TABLE t1 ADD FULLTEXT(a), ALGORITHM=INPLACE; DROP TABLE t1; @@ -356,3 +372,28 @@ ALTER TABLE t1 ADD c SERIAL; DROP TABLE t1; --echo # End of 10.3 tests + +--echo # +--echo # MDEV-27582 Fulltext DDL decrements the FTS_DOC_ID value +--echo # +CREATE TABLE t1 ( + f1 INT NOT NULL PRIMARY KEY, + f2 VARCHAR(64), FULLTEXT ft(f2)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +connect(con1,localhost,root,,,); +START TRANSACTION WITH CONSISTENT SNAPSHOT; + +connection default; +DELETE FROM t1 WHERE f1 = 2; +ALTER TABLE t1 DROP INDEX ft; +ALTER TABLE t1 ADD FULLTEXT INDEX ft (f2); +INSERT INTO t1 VALUES (3, 'innodb fts search'); +SET GLOBAL innodb_optimize_fulltext_only=ON; +OPTIMIZE TABLE t1; +SET GLOBAL innodb_ft_aux_table = 'test/t1'; +SELECT max(DOC_ID) FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; +SELECT * FROM t1 WHERE MATCH(f2) AGAINST("+innodb +search" IN BOOLEAN MODE); +DROP TABLE t1; +disconnect con1; +SET GLOBAL innodb_optimize_fulltext_only=OFF; +SET GLOBAL innodb_ft_aux_table = default; diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-fic.test b/mysql-test/suite/innodb_fts/t/innodb-fts-fic.test index 669aa69e83510..2d94c21398ce7 100644 --- a/mysql-test/suite/innodb_fts/t/innodb-fts-fic.test +++ b/mysql-test/suite/innodb_fts/t/innodb-fts-fic.test @@ -1,6 +1,7 @@ # This is the basic function tests for innodb FTS -- source include/have_innodb.inc +-- source include/maybe_versioning.inc call mtr.add_suppression("\\[Warning\\] InnoDB: A new Doc ID must be supplied while updating FTS indexed columns."); call mtr.add_suppression("\\[Warning\\] InnoDB: FTS Doc ID must be larger than [0-9]+ for table `test`.`articles`"); diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-stopword.opt b/mysql-test/suite/innodb_fts/t/innodb-fts-stopword.opt deleted file mode 100644 index 2b0652d08c3d4..0000000000000 --- a/mysql-test/suite/innodb_fts/t/innodb-fts-stopword.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb-ft-default-stopword diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-stopword.test b/mysql-test/suite/innodb_fts/t/innodb-fts-stopword.test deleted file mode 100644 index 0f29d09254142..0000000000000 --- a/mysql-test/suite/innodb_fts/t/innodb-fts-stopword.test +++ /dev/null @@ -1,664 +0,0 @@ -# This is the basic function tests for innodb FTS - --- source include/have_innodb.inc - - -select * from information_schema.innodb_ft_default_stopword; - -# Create FTS table -CREATE TABLE articles ( - id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, - title VARCHAR(200), - body TEXT, - FULLTEXT (title,body) - ) ENGINE=InnoDB; - -# Insert six rows -INSERT INTO articles (title,body) VALUES - ('MySQL Tutorial','DBMS stands for DataBase ...') , - ('How To Use MySQL Well','After you went through a ...'), - ('Optimizing MySQL','In this tutorial we will show ...'), - ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), - ('MySQL vs. YourSQL','In the following database comparison ...'), - ('MySQL Security','When configured properly, MySQL ...'); - -# "the" is in the default stopword, it would not be selected -SELECT * FROM articles WHERE MATCH (title,body) - AGAINST ('the' IN NATURAL LANGUAGE MODE); - -let $innodb_ft_server_stopword_table_orig=`select @@innodb_ft_server_stopword_table`; -let $innodb_ft_enable_stopword_orig=`select @@innodb_ft_enable_stopword`; -let $innodb_ft_user_stopword_table_orig=`select @@innodb_ft_user_stopword_table`; - -select @@innodb_ft_server_stopword_table; -select @@innodb_ft_enable_stopword; -select @@innodb_ft_user_stopword_table; - -# Provide user defined stopword table, if not (correctly) defined, -# it will be rejected ---error 1231 -set global innodb_ft_server_stopword_table = "not_defined"; - -# Define a correct formated user stopword table -create table user_stopword(value varchar(30)) engine = innodb; - -# The set operation should be successful -set global innodb_ft_server_stopword_table = "test/user_stopword"; - -drop index title on articles; - -create fulltext index idx on articles(title, body); - -# Now we should be able to find "the" -SELECT * FROM articles WHERE MATCH (title,body) - AGAINST ('the' IN NATURAL LANGUAGE MODE); - -# Nothing inserted into the default stopword, so essentially -# nothing get screened. The new stopword could only be -# effective for table created thereafter -CREATE TABLE articles_2 ( - id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, - title VARCHAR(200), - body TEXT, - FULLTEXT (title,body) - ) ENGINE=InnoDB; - -INSERT INTO articles_2 (title, body) - VALUES ('test for stopwords','this is it...'); - -# Now we can find record with "this" -SELECT * FROM articles_2 WHERE MATCH (title,body) - AGAINST ('this' IN NATURAL LANGUAGE MODE); - -# Ok, let's instantiate some value into user supplied stop word -# table -insert into user_stopword values("this"); - -# Ok, let's repeat with the new table again. -CREATE TABLE articles_3 ( - id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, - title VARCHAR(200), - body TEXT, - FULLTEXT (title,body) - ) ENGINE=InnoDB; - -INSERT INTO articles_3 (title, body) - VALUES ('test for stopwords','this is it...'); - -# Now we should NOT find record with "this" -SELECT * FROM articles_3 WHERE MATCH (title,body) - AGAINST ('this' IN NATURAL LANGUAGE MODE); - -# Test session level stopword control "innodb_user_stopword_table" -create table user_stopword_session(value varchar(30)) engine = innodb; - -insert into user_stopword_session values("session"); - -set session innodb_ft_user_stopword_table="test/user_stopword_session"; - -CREATE TABLE articles_4 ( - id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, - title VARCHAR(200), - body TEXT, - FULLTEXT (title,body) - ) ENGINE=InnoDB; - -INSERT INTO articles_4 (title, body) - VALUES ('test for session stopwords','this should also be excluded...'); - -# "session" is excluded -SELECT * FROM articles_4 WHERE MATCH (title,body) - AGAINST ('session' IN NATURAL LANGUAGE MODE); - -# But we can find record with "this" -SELECT * FROM articles_4 WHERE MATCH (title,body) - AGAINST ('this' IN NATURAL LANGUAGE MODE); - ---connect (con1,localhost,root,,) -CREATE TABLE articles_5 ( - id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, - title VARCHAR(200), - body TEXT, - FULLTEXT (title,body) - ) ENGINE=InnoDB; - -INSERT INTO articles_5 (title, body) - VALUES ('test for session stopwords','this should also be excluded...'); - -# "session" should be found since the stopword table is session specific -SELECT * FROM articles_5 WHERE MATCH (title,body) - AGAINST ('session' IN NATURAL LANGUAGE MODE); - ---connection default -drop table articles; -drop table articles_2; -drop table articles_3; -drop table articles_4; -drop table articles_5; -drop table user_stopword; -drop table user_stopword_session; - -eval SET GLOBAL innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig; -eval SET GLOBAL innodb_ft_server_stopword_table=default; - -#--------------------------------------------------------------------------------------- -# Behavior : -# The stopword is loaded into memory at -# 1) create fulltext index time, -# 2) boot server, -# 3) first time FTs is used -# So if you already created a FTS index, and then turn off stopword -# or change stopword table content it won't affect the FTS -# that already created since the stopword list are already loaded. -# It will only affect the new FTS index created after you changed -# the settings. - -# Create FTS table -CREATE TABLE articles ( - id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, - title VARCHAR(200), - body TEXT, - FULLTEXT `idx` (title,body) - ) ENGINE=InnoDB; - -SHOW CREATE TABLE articles; - -# Insert six rows -INSERT INTO articles (title,body) VALUES - ('MySQL from Tutorial','DBMS stands for DataBase ...') , - ('when To Use MySQL Well','After that you went through a ...'), - ('where will Optimizing MySQL','In what tutorial we will show ...'), - ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), - ('MySQL vs. YourSQL','In the following database comparison ...'), - ('MySQL Security','When configured properly, MySQL ...'); - -# Case : server_stopword=default -# Try to Search default stopword from innodb, "where", "will", "what" -# and "when" are all stopwords -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); -# boolean No result expected -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); -# no result expected -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); -# no result expected -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); - -INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE); -# Not going to update as where condition can not find record -UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' -WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -# Update the record -UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' -WHERE id = 7; -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -# Delete will not work as where condition do not return -DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE id = 7; -DELETE FROM articles WHERE id = 7; - - - -# Case : Turn OFF stopword list variable and search stopword on OLD index. -# disable stopword list -#SET global innodb_ft_server_stopword_table = ""; -SET SESSION innodb_ft_enable_stopword = 0; -select @@innodb_ft_enable_stopword; -#SET global innodb_ft_user_stopword_table = ""; - -# search default stopword with innodb_ft_enable_stopword is OFF. -# No records expected even though we turned OFF stopwod filtering -# (refer Behavior (at the top of the test) for explanation ) -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); - -INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE); -# Not going to update as where condition can not find record -UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' -WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -# Update the record -UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' -WHERE id = 8; -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -SELECT * FROM articles WHERE id = 8; -# Delete will not work as where condition do not return -DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE id = 8; -DELETE FROM articles WHERE id = 8; - -# Case : Turn OFF stopword list variable and search stopword on NEW index. -# Drop index -ALTER TABLE articles DROP INDEX idx; -SHOW CREATE TABLE articles; - -# Create the FTS index Using Alter Table. -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); - -ANALYZE TABLE articles; - -# search default stopword with innodb_ft_enable_stopword is OFF. -# All records expected as stopwod filtering is OFF and we created -# new FTS index. -# (refer Behavior (at the top of the test) for explanation ) -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); - -INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE); -# Update will succeed. -UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' -WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); - -SELECT COUNT(*),max(id) FROM articles; -# Update the record - uncommet on fix -#UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' -#WHERE id = 9; -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -# Delete will succeed. -DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE id = 9; - - -DROP TABLE articles; - -eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig; -#eval SET GLOBAL innodb_ft_server_stopword_table=$innodb_ft_server_stopword_table_orig; -eval SET GLOBAL innodb_ft_server_stopword_table=default; -#eval SET GLOBAL innodb_ft_user_stopword_table=$innodb_ft_user_stopword_table_orig; -eval SET SESSION innodb_ft_user_stopword_table=default; - -#--------------------------------------------------------------------------------------- - -select @@innodb_ft_server_stopword_table; -select @@innodb_ft_enable_stopword; -select @@innodb_ft_user_stopword_table; - -# Create FTS table -CREATE TABLE articles ( - id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, - title VARCHAR(200), - body TEXT, - FULLTEXT `idx` (title,body) - ) ENGINE=InnoDB; - -# Insert six rows -INSERT INTO articles (title,body) VALUES - ('MySQL from Tutorial','DBMS stands for DataBase ...') , - ('when To Use MySQL Well','After that you went through a ...'), - ('where will Optimizing MySQL','In what tutorial we will show ...'), - ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), - ('MySQL vs. YourSQL','In the following database comparison ...'), - ('MySQL Security','When configured properly, MySQL ...'); - -# No records expeced for select -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -# Define a correct formated user stopword table -create table user_stopword(value varchar(30)) engine = innodb; -# The set operation should be successful -set session innodb_ft_user_stopword_table = "test/user_stopword"; -# Define a correct formated server stopword table -create table server_stopword(value varchar(30)) engine = innodb; -# The set operation should be successful -set global innodb_ft_server_stopword_table = "test/server_stopword"; -# Add values into user supplied stop word table -insert into user_stopword values("this"),("will"),("the"); - -# Drop existing index and create the FTS index Using Alter Table. -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); - -# Add values into server supplied stop word table -insert into server_stopword values("what"),("where"); -# Follwoing should return result as server stopword list was empty at create index time -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); - -# Delete stopword from user list -DELETE FROM user_stopword; -# Drop existing index and create the FTS index Using Alter Table. -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -# Follwoing should return result even though to server stopword list -# conatin these words. Session level stopword list takes priority -# Here user_stopword is set using innodb_ft_user_stopword_table -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); - -# Follwoing should return result as user stopword list was empty at create index time -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); - -# Add values into user supplied stop word table -insert into user_stopword values("this"),("will"),("the"); - -# Drop existing index and create the FTS index Using Alter Table. -ALTER TABLE articles DROP INDEX idx; -SET SESSION innodb_ft_enable_stopword = 0; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); - -# Session level stopword list takes priority -SET SESSION innodb_ft_enable_stopword = 1; -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); - -# Make user stopword list deafult so as to server stopword list takes priority -SET SESSION innodb_ft_enable_stopword = 1; -SET SESSION innodb_ft_user_stopword_table = default; -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); - - -DROP TABLE articles,user_stopword,server_stopword; - -# Restore Defaults -eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig; -eval SET GLOBAL innodb_ft_server_stopword_table=default; -eval SET SESSION innodb_ft_user_stopword_table=default; -select @@innodb_ft_server_stopword_table; -select @@innodb_ft_enable_stopword; -select @@innodb_ft_user_stopword_table; - -#--------------------------------------------------------------------------------------- -# Create FTS table -CREATE TABLE articles ( - id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, - title VARCHAR(200), - body TEXT, - FULLTEXT `idx` (title,body) - ) ENGINE=InnoDB; - -SHOW CREATE TABLE articles; - -# Insert six rows -INSERT INTO articles (title,body) VALUES - ('MySQL from Tutorial','DBMS stands for DataBase ...') , - ('when To Use MySQL Well','After that you went through a ...'), - ('where will Optimizing MySQL','In what tutorial we will show ...'), - ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), - ('MySQL vs. YourSQL','In the following database comparison ...'), - ('MySQL Security','When configured properly, MySQL ...'); - -# No records expeced for select -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -# Define a correct formated user stopword table -create table user_stopword(value varchar(30)) engine = innodb; -# The set operation should be successful -set session innodb_ft_user_stopword_table = "test/user_stopword"; -insert into user_stopword values("mysqld"),("DBMS"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld'); - - -# Drop existing index and create the FTS index Using Alter Table. -# user stopword list will take effect. -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld'); - -# set user stopword list empty -set session innodb_ft_user_stopword_table = default; -# Define a correct formated user stopword table -create table server_stopword(value varchar(30)) engine = innodb; -# The set operation should be successful -set global innodb_ft_server_stopword_table = "test/server_stopword"; -insert into server_stopword values("root"),("properly"); -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly'); - - -# set user stopword list empty -set session innodb_ft_user_stopword_table = "test/user_stopword"; -# The set operation should be successful -set global innodb_ft_server_stopword_table = "test/server_stopword"; -# user stopword list take effect as its session level -# Result expected for select -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly'); - -# set user stopword list -set session innodb_ft_user_stopword_table = "test/user_stopword"; -DELETE FROM user_stopword; -# The set operation should be successful -set global innodb_ft_server_stopword_table = "test/server_stopword"; -DELETE FROM server_stopword; -# user stopword list take affect as its session level -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld'); - -DROP TABLE articles,user_stopword,server_stopword; - -# Restore Values -eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig; -eval SET GLOBAL innodb_ft_server_stopword_table=default; -eval SET SESSION innodb_ft_user_stopword_table=default; - - -#------------------------------------------------------------------------------ -# FTS stopword list test - check varaibles across sessions - -# Create FTS table -CREATE TABLE articles ( - id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, - title VARCHAR(200), - body TEXT, - FULLTEXT `idx` (title,body) - ) ENGINE=InnoDB; - -SHOW CREATE TABLE articles; - -# Insert six rows -INSERT INTO articles (title,body) VALUES - ('MySQL from Tutorial','DBMS stands for DataBase ...') , - ('when To Use MySQL Well','After that you went through a ...'), - ('where will Optimizing MySQL','In what tutorial we will show ...'), - ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), - ('MySQL vs. YourSQL','In the following database comparison ...'), - ('MySQL Security','When configured properly, MySQL ...'); - -# session varaible innodb_ft_enable_stopword=0 will take effect for new FTS index -SET SESSION innodb_ft_enable_stopword = 0; -select @@innodb_ft_enable_stopword; - -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); - - ---connection con1 -select @@innodb_ft_enable_stopword; - -ANALYZE TABLE articles; - -# result expected as index created before setting innodb_ft_enable_stopword varaible off -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); - -SET SESSION innodb_ft_enable_stopword = 1; -select @@innodb_ft_enable_stopword; -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -# no result expected turned innodb_ft_enable_stopword is ON -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); - - ---connection default -select @@innodb_ft_enable_stopword; -# no result expected as word not indexed from connection 1 -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); - -INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE); - -SET SESSION innodb_ft_enable_stopword = 1; -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE); - - ---connection con1 -SET SESSION innodb_ft_enable_stopword = 1; -# Define a correct formated user stopword table -create table user_stopword(value varchar(30)) engine = innodb; -# The set operation should be successful -set session innodb_ft_user_stopword_table = "test/user_stopword"; -# Add values into user supplied stop word table -insert into user_stopword values("this"),("will"),("the"); -# Drop existing index and create the FTS index Using Alter Table. -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -# no result expected as innodb_ft_user_stopword_table filter it -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); - - ---connection default -# no result expected as innodb_ft_user_stopword_table filter it from connection1 -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -select @@innodb_ft_user_stopword_table; -# Define a correct formated user stopword table -create table user_stopword_1(value varchar(30)) engine = innodb; -# The set operation should be successful -set session innodb_ft_user_stopword_table = "test/user_stopword_1"; -insert into user_stopword_1 values("when"); -SET SESSION innodb_ft_enable_stopword = 1; -# result expected -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when'); -# Drop existing index and create the FTS index Using Alter Table. -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -# no result expected -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when'); - ---connection con1 -SET SESSION innodb_ft_enable_stopword = 1; -SET SESSION innodb_ft_user_stopword_table=default; -select @@innodb_ft_user_stopword_table; -select @@innodb_ft_server_stopword_table; -# Define a correct formated server stopword table -create table server_stopword(value varchar(30)) engine = innodb; -# The set operation should be successful -SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword"; -select @@innodb_ft_server_stopword_table; -insert into server_stopword values("when"),("the"); -# Drop existing index and create the FTS index Using Alter Table. -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -# no result expected -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the'); - -disconnect con1; ---source include/wait_until_disconnected.inc - ---connection default -SET SESSION innodb_ft_enable_stopword = 1; -SET SESSION innodb_ft_user_stopword_table=default; -select @@innodb_ft_server_stopword_table; -# result expected -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where'); -insert into server_stopword values("where"),("will"); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where'); -ALTER TABLE articles DROP INDEX idx; -ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); -# no result expected -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the'); -SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE); -SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where'); - - -DROP TABLE articles,user_stopword,user_stopword_1,server_stopword; - -# Restore Values -eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig; -eval SET GLOBAL innodb_ft_server_stopword_table=default; -eval SET SESSION innodb_ft_user_stopword_table=default; - diff --git a/mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test b/mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test index 48964aef4fd0b..f9447aada60ee 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test +++ b/mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test @@ -1,4 +1,5 @@ --source include/have_innodb.inc +--source include/maybe_versioning.inc CREATE TABLE t1 (v VARCHAR(100), FULLTEXT INDEX (v)) ENGINE=InnoDB; diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_large_records.test b/mysql-test/suite/innodb_fts/t/innodb_fts_large_records.test index e200cff6c3986..c84cd0685ed7e 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_fts_large_records.test +++ b/mysql-test/suite/innodb_fts/t/innodb_fts_large_records.test @@ -3,6 +3,7 @@ # b) more words across records --source include/have_innodb.inc +--source include/maybe_versioning.inc --disable_warnings DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test b/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test index 279cca3177a3e..b194ad20f710f 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test +++ b/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test @@ -3,6 +3,7 @@ #----------------------------------------------------------------------------- --source include/have_innodb.inc +--source include/no_valgrind_without_big.inc --source include/default_charset.inc let collation=UTF8_UNICODE_CI; --source include/have_collation.inc diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_multiple_index.test b/mysql-test/suite/innodb_fts/t/innodb_fts_multiple_index.test index c8293655d1be2..f9535c729ffed 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_fts_multiple_index.test +++ b/mysql-test/suite/innodb_fts/t/innodb_fts_multiple_index.test @@ -2,6 +2,7 @@ # Test With two FTS index on same table + alter/create/drop index + tnx #------------------------------------------------------------------------------ --source include/have_innodb.inc +--source include/maybe_versioning.inc --disable_warnings drop table if exists t1; diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test b/mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test index 643e4a08b0e52..7ff36b6f4b697 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test +++ b/mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test @@ -1,11 +1,15 @@ --source include/have_innodb.inc --source include/have_simple_parser.inc +--source include/no_valgrind_without_big.inc # Restart is not supported in embedded --source include/not_embedded.inc # Install fts parser plugin INSTALL PLUGIN simple_parser SONAME 'mypluglib'; +# Flush the table mysql.plugin in case the server shutdown would time out. +FLUSH TABLES; + -- echo # Test Part 1: Grammar Test # Create a myisam table and alter it to innodb table CREATE TABLE articles ( @@ -52,7 +56,7 @@ INSERT INTO articles (title, body) VALUES # Simple term search SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('mysql'); + MATCH(title, body) AGAINST('mysql') ORDER BY id; # Test stopword and word len less than fts_min_token_size SELECT * FROM articles WHERE @@ -90,7 +94,7 @@ ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser; # Simple term search SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('mysql'); + MATCH(title, body) AGAINST('mysql') ORDER BY id; # Test stopword and word len less than fts_min_token_size SELECT * FROM articles WHERE @@ -105,10 +109,12 @@ SELECT * FROM articles WHERE # Test query expansion SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION); + MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION) + ORDER BY id; SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION); + MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION) + ORDER BY id; # No result here, we get '"mysql' 'database"' by simple parser SELECT * FROM articles WHERE @@ -152,14 +158,16 @@ INSERT INTO articles (title, body) VALUES --source include/restart_mysqld.inc SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('MySQL'); + MATCH(title, body) AGAINST('MySQL') ORDER BY id; SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('tutorial'); + MATCH(title, body) AGAINST('tutorial') ORDER BY id; SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('Tricks'); + MATCH(title, body) AGAINST('Tricks') ORDER BY id; SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('full text search'); + MATCH(title, body) AGAINST('full text search') ORDER BY id; SELECT COUNT(*) FROM articles; + +INSERT INTO articles (title, body) VALUES ('111', '1234 1234 1234'); DROP TABLE articles; -- echo # Test Part 5: Test Uninstall Plugin After Index is Built @@ -193,7 +201,8 @@ UNINSTALL PLUGIN simple_parser; # Simple term search SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('mysql'); + MATCH(title, body) AGAINST('mysql') + ORDER BY id; # Test stopword and word len less than fts_min_token_size SELECT * FROM articles WHERE diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test b/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test index 20eee3fac2376..e3d8eb0c13b11 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test +++ b/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test @@ -1,4 +1,5 @@ --source include/have_innodb.inc +--source include/maybe_versioning.inc # This is the DDL function tests for innodb FTS # Functional testing with FTS proximity search using '@' diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_result_cache_limit.test b/mysql-test/suite/innodb_fts/t/innodb_fts_result_cache_limit.test index 669808edbf6f2..1ec37532a71d9 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_fts_result_cache_limit.test +++ b/mysql-test/suite/innodb_fts/t/innodb_fts_result_cache_limit.test @@ -4,6 +4,7 @@ # Must have debug code to use SET SESSION debug --source include/have_debug.inc +--source include/maybe_versioning.inc # Create FTS table CREATE TABLE t1 ( diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_stopword_charset.test b/mysql-test/suite/innodb_fts/t/innodb_fts_stopword_charset.test index 16ee91c30f40d..3fe99dab2c39d 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_fts_stopword_charset.test +++ b/mysql-test/suite/innodb_fts/t/innodb_fts_stopword_charset.test @@ -4,6 +4,7 @@ # Embedded server tests do not support restarting --source include/not_embedded.inc +--source include/maybe_versioning.inc SELECT @@innodb_ft_server_stopword_table; SELECT @@innodb_ft_enable_stopword; diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_transaction.test b/mysql-test/suite/innodb_fts/t/innodb_fts_transaction.test index 11571f346a221..026aeb635cd9c 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_fts_transaction.test +++ b/mysql-test/suite/innodb_fts/t/innodb_fts_transaction.test @@ -5,6 +5,7 @@ # 3) UNCOMMITTED RECORDS CAN BE SEEN WITH QURIES WHICH DO NOT USE FTS INDEX # this behavior do not break integratity of tables and "select" which do not use FTS still can view them. --source include/have_innodb.inc +--source include/maybe_versioning.inc --disable_warnings diff --git a/mysql-test/suite/innodb_fts/t/misc_debug.test b/mysql-test/suite/innodb_fts/t/misc_debug.test index 84da132026410..08581768eec14 100644 --- a/mysql-test/suite/innodb_fts/t/misc_debug.test +++ b/mysql-test/suite/innodb_fts/t/misc_debug.test @@ -7,6 +7,7 @@ --source include/have_debug.inc --source include/have_debug_sync.inc --source include/count_sessions.inc +--source include/maybe_versioning.inc # Following test is for Bug 14668777 - ASSERT ON IB_VECTOR_SIZE( # TABLE->FTS->INDEXES, ALTER TABLE @@ -87,11 +88,30 @@ DROP TABLE t1; --echo # call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)"); call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Too many concurrent transactions"); +SET @saved_debug_dbug= @@debug_dbug; CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB; SET debug_dbug='+d,ib_create_table_fail_too_many_trx'; ---error ER_GET_ERRNO +if ($MTR_COMBINATION_ORIG) +{ TRUNCATE t1; +} +if (!$MTR_COMBINATION_ORIG) +{ +--echo TRUNCATE t1; +} SET debug_dbug=@saved_debug_dbug; DROP TABLE t1; --echo # End of 10.3 tests + +# Fulltext fails in commit phase + +CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100))ENGINE=InnoDB; +SET DEBUG_DBUG="+d,stats_lock_fail"; +--error ER_LOCK_WAIT_TIMEOUT +ALTER TABLE t1 ADD FULLTEXT(f2); +SET debug_dbug=@saved_debug_dbug; +ALTER TABLE t1 DISCARD TABLESPACE; +--error ER_TABLESPACE_DISCARDED +ALTER TABLE t1 ADD FULLTEXT(f2); +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/t/misc_debug2.test b/mysql-test/suite/innodb_fts/t/misc_debug2.test index 0a9e137dd801b..946700e32291d 100644 --- a/mysql-test/suite/innodb_fts/t/misc_debug2.test +++ b/mysql-test/suite/innodb_fts/t/misc_debug2.test @@ -10,3 +10,19 @@ INSERT INTO mdev21563 VALUES('This is a test'); ALTER TABLE mdev21563 DISCARD TABLESPACE; --source include/restart_mysqld.inc DROP TABLE mdev21563; + +--echo # +--echo # MDEV-29342 Assertion failure in file que0que.cc line 728 +--echo # +CREATE TABLE t1(f1 CHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES('mysql'), ('innodb'); +SET @save_dbug=@@debug_dbug; +set debug_dbug="+d,fts_instrument_sync_request"; +INSERT INTO t1 VALUES('test'); +set debug_dbug=@save_dbug; +INSERT INTO t1 VALUES('This is a fts issue'); +--source include/restart_mysqld.inc +set debug_dbug="+d,fts_instrument_sync_request"; +UPDATE t1 SET f1="mariadb"; +set debug_dbug=@save_dbug; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/t/stopword.inc b/mysql-test/suite/innodb_fts/t/stopword.inc new file mode 100644 index 0000000000000..774501ade85a3 --- /dev/null +++ b/mysql-test/suite/innodb_fts/t/stopword.inc @@ -0,0 +1,55 @@ +if ($stopword_stage == create_table) +{ +call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist."); +call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist."); + +select * from information_schema.innodb_ft_default_stopword; + +# Create FTS table +eval CREATE TABLE $stopword_table ( + id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, + title VARCHAR(200), + body TEXT, + FULLTEXT (title,body) + )$create_options ENGINE=InnoDB; + +# Insert six rows +eval INSERT INTO $stopword_table (title,body) VALUES + ('MySQL Tutorial','DBMS stands for DataBase ...') , + ('How To Use MySQL Well','After you went through a ...'), + ('Optimizing MySQL','In this tutorial we will show ...'), + ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), + ('MySQL vs. YourSQL','In the following database comparison ...'), + ('MySQL Security','When configured properly, MySQL ...'); + +# "the" is in the default stopword, it would not be selected +eval SELECT * FROM $stopword_table WHERE MATCH (title,body) + AGAINST ('the' IN NATURAL LANGUAGE MODE); + +# Provide user defined stopword table, if not (correctly) defined, +# it will be rejected +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_ft_server_stopword_table = "not_defined"; +set global innodb_ft_server_stopword_table = NULL; + +# Define a correct formatted user stopword table +eval create table user_stopword(value varchar(30))$create_options engine = innodb; + +# The set operation should be successful +set global innodb_ft_server_stopword_table = "test/user_stopword"; + +eval drop index title on $stopword_table; + +eval create fulltext index idx on $stopword_table(title, body); +} + +if ($stopword_stage == select_1) +{ +--error 0, ER_INDEX_CORRUPT +eval SELECT * FROM $stopword_table WHERE MATCH (title,body) + AGAINST ('the' IN NATURAL LANGUAGE MODE); +--error 0, ER_INDEX_CORRUPT +eval SELECT * FROM $stopword_table WHERE MATCH (title,body) + AGAINST ('this' IN NATURAL LANGUAGE MODE); + +} diff --git a/mysql-test/suite/innodb_fts/t/stopword.test b/mysql-test/suite/innodb_fts/t/stopword.test index 5105a6d2fec7a..9f8bd89b81633 100644 --- a/mysql-test/suite/innodb_fts/t/stopword.test +++ b/mysql-test/suite/innodb_fts/t/stopword.test @@ -1,52 +1,16 @@ # This is the basic function tests for innodb FTS -- source include/have_innodb.inc - -call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist."); -call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist."); - -select * from information_schema.innodb_ft_default_stopword; - -# Create FTS table -CREATE TABLE articles ( - id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, - title VARCHAR(200), - body TEXT, - FULLTEXT (title,body) - ) ENGINE=InnoDB; - -# Insert six rows -INSERT INTO articles (title,body) VALUES - ('MySQL Tutorial','DBMS stands for DataBase ...') , - ('How To Use MySQL Well','After you went through a ...'), - ('Optimizing MySQL','In this tutorial we will show ...'), - ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), - ('MySQL vs. YourSQL','In the following database comparison ...'), - ('MySQL Security','When configured properly, MySQL ...'); - -# "the" is in the default stopword, it would not be selected -SELECT * FROM articles WHERE MATCH (title,body) - AGAINST ('the' IN NATURAL LANGUAGE MODE); +-- let $modify_create_table= 1 +-- source include/maybe_versioning.inc SET @innodb_ft_server_stopword_table_orig=@@innodb_ft_server_stopword_table; SET @innodb_ft_enable_stopword_orig=@@innodb_ft_enable_stopword; SET @innodb_ft_user_stopword_table_orig=@@innodb_ft_user_stopword_table; -# Provide user defined stopword table, if not (correctly) defined, -# it will be rejected ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_ft_server_stopword_table = "not_defined"; -set global innodb_ft_server_stopword_table = NULL; - -# Define a correct formated user stopword table -create table user_stopword(value varchar(30)) engine = innodb; - -# The set operation should be successful -set global innodb_ft_server_stopword_table = "test/user_stopword"; - -drop index title on articles; - -create fulltext index idx on articles(title, body); +let $stopword_table= articles; +let $stopword_stage= create_table; +--source stopword.inc # Now we should be able to find "the" SELECT * FROM articles WHERE MATCH (title,body) @@ -55,12 +19,12 @@ SELECT * FROM articles WHERE MATCH (title,body) # Nothing inserted into the default stopword, so essentially # nothing get screened. The new stopword could only be # effective for table created thereafter -CREATE TABLE articles_2 ( +eval CREATE TABLE articles_2 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(200), body TEXT, FULLTEXT (title,body) - ) ENGINE=InnoDB; + )$create_options ENGINE=InnoDB; INSERT INTO articles_2 (title, body) VALUES ('test for stopwords','this is it...'); @@ -71,15 +35,17 @@ SELECT * FROM articles_2 WHERE MATCH (title,body) # Ok, let's instantiate some value into user supplied stop word # table +insert into user_stopword values("the"); +delete from user_stopword; insert into user_stopword values("this"); # Ok, let's repeat with the new table again. -CREATE TABLE articles_3 ( +eval CREATE TABLE articles_3 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(200), body TEXT, FULLTEXT (title,body) - ) ENGINE=InnoDB; + )$create_options ENGINE=InnoDB; INSERT INTO articles_3 (title, body) VALUES ('test for stopwords','this is it...'); @@ -89,18 +55,20 @@ SELECT * FROM articles_3 WHERE MATCH (title,body) AGAINST ('this' IN NATURAL LANGUAGE MODE); # Test session level stopword control "innodb_user_stopword_table" -create table user_stopword_session(value varchar(30)) engine = innodb; +eval create table user_stopword_session(value varchar(30))$create_options engine = innodb; +insert into user_stopword values("this"); +delete from user_stopword; insert into user_stopword_session values("session"); set session innodb_ft_user_stopword_table="test/user_stopword_session"; -CREATE TABLE articles_4 ( +eval CREATE TABLE articles_4 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(200), body TEXT, FULLTEXT (title,body) - ) ENGINE=InnoDB; + )$create_options ENGINE=InnoDB; INSERT INTO articles_4 (title, body) VALUES ('test for session stopwords','this should also be excluded...'); @@ -114,12 +82,12 @@ SELECT * FROM articles_4 WHERE MATCH (title,body) AGAINST ('this' IN NATURAL LANGUAGE MODE); --connect (con1,localhost,root,,) -CREATE TABLE articles_5 ( +eval CREATE TABLE articles_5 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(200), body TEXT, FULLTEXT (title,body) - ) ENGINE=InnoDB; + )$create_options ENGINE=InnoDB; INSERT INTO articles_5 (title, body) VALUES ('test for session stopwords','this should also be excluded...'); @@ -153,12 +121,12 @@ SET GLOBAL innodb_ft_server_stopword_table=default; # the settings. # Create FTS table -CREATE TABLE articles ( +eval CREATE TABLE articles ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(200), body TEXT, FULLTEXT `idx` (title,body) - ) ENGINE=InnoDB; + )$create_options ENGINE=InnoDB; SHOW CREATE TABLE articles; @@ -292,12 +260,12 @@ SET GLOBAL innodb_ft_user_stopword_table=@innodb_ft_user_stopword_table_orig; SET SESSION innodb_ft_user_stopword_table=default; # Create FTS table -CREATE TABLE articles ( +eval CREATE TABLE articles ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(200), body TEXT, FULLTEXT `idx` (title,body) - ) ENGINE=InnoDB; + )$create_options ENGINE=InnoDB; # Insert six rows INSERT INTO articles (title,body) VALUES @@ -311,15 +279,17 @@ INSERT INTO articles (title,body) VALUES # No records expeced for select SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -# Define a correct formated user stopword table -create table user_stopword(value varchar(30)) engine = innodb; +# Define a correct formatted user stopword table +eval create table user_stopword(value varchar(30))$create_options engine = innodb; # The set operation should be successful set session innodb_ft_user_stopword_table = "test/user_stopword"; -# Define a correct formated server stopword table -create table server_stopword(value varchar(30)) engine = innodb; +# Define a correct formatted server stopword table +eval create table server_stopword(value varchar(30))$create_options engine = innodb; # The set operation should be successful set global innodb_ft_server_stopword_table = "test/server_stopword"; # Add values into user supplied stop word table +insert into user_stopword values("when"),("where"); +delete from user_stopword; insert into user_stopword values("this"),("will"),("the"); # Drop existing index and create the FTS index Using Alter Table. @@ -390,12 +360,12 @@ SET SESSION innodb_ft_user_stopword_table=default; #--------------------------------------------------------------------------------------- # Create FTS table -CREATE TABLE articles ( +eval CREATE TABLE articles ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(200), body TEXT, FULLTEXT `idx` (title,body) - ) ENGINE=InnoDB; + )$create_options ENGINE=InnoDB; SHOW CREATE TABLE articles; @@ -411,8 +381,8 @@ INSERT INTO articles (title,body) VALUES # No records expeced for select SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); -# Define a correct formated user stopword table -create table user_stopword(value varchar(30)) engine = innodb; +# Define a correct formatted user stopword table +eval create table user_stopword(value varchar(30))$create_options engine = innodb; # The set operation should be successful set session innodb_ft_user_stopword_table = "test/user_stopword"; insert into user_stopword values("mysqld"),("DBMS"); @@ -433,8 +403,8 @@ SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld'); # set user stopword list empty set session innodb_ft_user_stopword_table = default; -# Define a correct formated user stopword table -create table server_stopword(value varchar(30)) engine = innodb; +# Define a correct formatted user stopword table +eval create table server_stopword(value varchar(30))$create_options engine = innodb; # The set operation should be successful set global innodb_ft_server_stopword_table = "test/server_stopword"; insert into server_stopword values("root"),("properly"); @@ -487,12 +457,12 @@ SET SESSION innodb_ft_user_stopword_table=default; # FTS stopword list test - check varaibles across sessions # Create FTS table -CREATE TABLE articles ( +eval CREATE TABLE articles ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(200), body TEXT, FULLTEXT `idx` (title,body) - ) ENGINE=InnoDB; + )$create_options ENGINE=InnoDB; SHOW CREATE TABLE articles; @@ -572,8 +542,8 @@ SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOL --echo "In connection 1" --connection con1 SET SESSION innodb_ft_enable_stopword = 1; -# Define a correct formated user stopword table -create table user_stopword(value varchar(30)) engine = innodb; +# Define a correct formatted user stopword table +eval create table user_stopword(value varchar(30))$create_options engine = innodb; # The set operation should be successful set session innodb_ft_user_stopword_table = "test/user_stopword"; # Add values into user supplied stop word table @@ -592,8 +562,8 @@ SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); select @@innodb_ft_user_stopword_table; -# Define a correct formated user stopword table -create table user_stopword_1(value varchar(30)) engine = innodb; +# Define a correct formatted user stopword table +eval create table user_stopword_1(value varchar(30))$create_options engine = innodb; # The set operation should be successful set session innodb_ft_user_stopword_table = "test/user_stopword_1"; insert into user_stopword_1 values("when"); @@ -614,8 +584,8 @@ SET SESSION innodb_ft_enable_stopword = 1; SET SESSION innodb_ft_user_stopword_table=default; select @@innodb_ft_user_stopword_table; select @@innodb_ft_server_stopword_table; -# Define a correct formated server stopword table -create table server_stopword(value varchar(30)) engine = innodb; +# Define a correct formatted server stopword table +eval create table server_stopword(value varchar(30))$create_options engine = innodb; # The set operation should be successful SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword"; select @@innodb_ft_server_stopword_table; diff --git a/mysql-test/suite/innodb_fts/t/sync.test b/mysql-test/suite/innodb_fts/t/sync.test index f16953ba09f52..168309a5c925f 100644 --- a/mysql-test/suite/innodb_fts/t/sync.test +++ b/mysql-test/suite/innodb_fts/t/sync.test @@ -7,6 +7,7 @@ --source include/not_valgrind.inc --source include/not_embedded.inc --source include/not_crashrep.inc +--source include/maybe_versioning.inc connect (con1,localhost,root,,); connection default; @@ -103,7 +104,8 @@ disconnect con1; DROP TABLE t1; --echo # Case 3: Test insert crash recovery ---let $_expect_file_name=$MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect CREATE TABLE t1 ( FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, diff --git a/mysql-test/suite/innodb_fts/t/sync_ddl.test b/mysql-test/suite/innodb_fts/t/sync_ddl.test index 2950297d5bb13..6a16ececa6041 100644 --- a/mysql-test/suite/innodb_fts/t/sync_ddl.test +++ b/mysql-test/suite/innodb_fts/t/sync_ddl.test @@ -4,6 +4,7 @@ --source include/have_innodb.inc --source include/have_debug.inc +--source include/maybe_versioning.inc #-------------------------------------- # Check FTS_sync vs TRUNCATE (1) @@ -23,7 +24,16 @@ INSERT INTO t1 (value) VALUES ('By default or with the IN NATURAL LANGUAGE MODE modifier') ; +let $vers=$MTR_COMBINATION_VERS+$MTR_COMBINATION_VERS_TRX; + +if ($vers) +{ +--echo TRUNCATE TABLE t1; +} +if (!$vers) +{ TRUNCATE TABLE t1; +} DROP TABLE t1; @@ -54,7 +64,14 @@ INSERT INTO t1 (value) VALUES ('collation of latin1_bin to make it case sensitive') ; +if ($vers) +{ +--echo TRUNCATE TABLE t1; +} +if (!$vers) +{ TRUNCATE TABLE t1; +} DROP TABLE t1; diff --git a/mysql-test/suite/innodb_gis/disabled.def b/mysql-test/suite/innodb_gis/disabled.def index bf500c1cb9353..2d4d3686dd19d 100644 --- a/mysql-test/suite/innodb_gis/disabled.def +++ b/mysql-test/suite/innodb_gis/disabled.def @@ -12,3 +12,4 @@ rtree_concurrent_srch : MDEV-15284 COUNT(*) mismatch rtree_recovery : MDEV-15284 COUNT(*) mismatch +rtree_compress2 : MDEV-16269 CHECK TABLE reports wrong count diff --git a/mysql-test/suite/innodb_gis/r/0.result b/mysql-test/suite/innodb_gis/r/0.result index 6dd2cd164371b..f05c7db24bd04 100644 --- a/mysql-test/suite/innodb_gis/r/0.result +++ b/mysql-test/suite/innodb_gis/r/0.result @@ -14,7 +14,7 @@ gis_point CREATE TABLE `gis_point` ( `fid` int(11) NOT NULL AUTO_INCREMENT, `g` point DEFAULT NULL, PRIMARY KEY (`fid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW FIELDS FROM gis_point; Field Type Null Key Default Extra fid int(11) NO PRI NULL auto_increment @@ -452,9 +452,9 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field drop table t1; create table t1 (pk integer primary key auto_increment, fl geometry not null); insert into t1 (fl) values (1); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t1`.`fl` insert into t1 (fl) values (1.11); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Cannot cast 'decimal' as 'geometry' in assignment of `test`.`t1`.`fl` insert into t1 (fl) values ("qwerty"); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 (fl) values (pointfromtext('point(1,1)')); diff --git a/mysql-test/suite/innodb_gis/r/1.result b/mysql-test/suite/innodb_gis/r/1.result index f8db53a4ca904..35711a63a8a29 100644 --- a/mysql-test/suite/innodb_gis/r/1.result +++ b/mysql-test/suite/innodb_gis/r/1.result @@ -580,7 +580,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `ST_GeomFromWKB(POINT(1,3))` geometry DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo` @@ -660,9 +660,9 @@ object_id ST_geometrytype(geo) ST_ISSIMPLE(GEO) ST_ASTEXT(ST_centroid(geo)) drop table t1; create table t1 (fl geometry not null); insert into t1 values (1); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t1`.`fl` insert into t1 values (1.11); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Cannot cast 'decimal' as 'geometry' in assignment of `test`.`t1`.`fl` insert into t1 values ("qwerty"); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 values (ST_pointfromtext('point(1,1)')); @@ -1118,8 +1118,8 @@ SELECT 1 FROM g1 WHERE a >= ANY (SELECT 1 FROM g1 WHERE a = ST_geomfromtext('') OR a) ; 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' DROP TABLE g1; End of 5.5 tests DROP DATABASE IF EXISTS gis_ogs; diff --git a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result index ae9dd47233bf9..5365e7d0f8c0b 100644 --- a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result +++ b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result @@ -128,7 +128,7 @@ tab CREATE TABLE `tab` ( SPATIAL KEY `idx4` (`c4`) COMMENT 'testing spatial index on Polygon', SPATIAL KEY `idx5` (`c5`) COMMENT 'testing spatial index on Geometry', KEY `idx6` (`c4`(10)) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW INDEX FROM tab; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored tab 0 PRIMARY 1 c1 A # NULL NULL BTREE NO @@ -172,7 +172,7 @@ tab CREATE TABLE `tab` ( SPATIAL KEY `idx4` (`c44`) COMMENT 'testing spatial index on Polygon', SPATIAL KEY `idx5` (`c5`) COMMENT 'testing spatial index on Geometry', KEY `idx6` (`c44`(10)) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW INDEX FROM tab; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored tab 0 PRIMARY 1 c1 A # NULL NULL BTREE NO @@ -204,7 +204,7 @@ tab CREATE TABLE `tab` ( SPATIAL KEY `idx4` (`c4`) COMMENT 'testing spatial index on Polygon', SPATIAL KEY `idx5` (`c5`) COMMENT 'testing spatial index on Geometry', KEY `idx6` (`c4`(10)) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW INDEX FROM tab; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored tab 0 PRIMARY 1 c1 A # NULL NULL BTREE NO @@ -261,7 +261,7 @@ tab CREATE TABLE `tab` ( `c4` polygon NOT NULL, `c5` geometry NOT NULL, PRIMARY KEY (`c2`(25)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CHECK TABLE tab; Table Op Msg_type Msg_text test.tab check status OK @@ -314,7 +314,7 @@ temp_tab CREATE TEMPORARY TABLE `temp_tab` ( SPATIAL KEY `idx3` (`c3`), SPATIAL KEY `idx4` (`c4`), SPATIAL KEY `idx5` (`c5`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM temp_tab WHERE MBRContains(temp_tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c2) ST_Astext(c4) @@ -333,7 +333,7 @@ tab CREATE TABLE `tab` ( `c3` linestring NOT NULL, `c4` polygon NOT NULL, `c5` geometry NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW INDEX FROM tab; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored DELETE FROM tab; @@ -357,7 +357,7 @@ tab CREATE TABLE `tab` ( PRIMARY KEY (`c2`(25)), UNIQUE KEY `const_1` (`c2`(25)), SPATIAL KEY `idx2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW INDEX FROM tab; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored tab 0 PRIMARY 1 c2 A # 25 NULL BTREE NO @@ -391,7 +391,7 @@ tab CREATE TABLE `tab` ( PRIMARY KEY (`c5`(10)), UNIQUE KEY `const_1` (`c5`(10)), SPATIAL KEY `idx2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW INDEX FROM tab; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored tab 0 PRIMARY 1 c5 A # 10 NULL BTREE NO @@ -521,7 +521,7 @@ tab CREATE TABLE `tab` ( SPATIAL KEY `idx4` (`c4`) COMMENT 'testing spatial index on Polygon', SPATIAL KEY `idx5` (`c5`) COMMENT 'testing spatial index on Geometry', KEY `idx6` (`c4`(10)) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW INDEX FROM tab; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored tab 0 PRIMARY 1 c1 A # NULL NULL BTREE NO @@ -558,7 +558,7 @@ tab CREATE TABLE `tab` ( SPATIAL KEY `idx4` (`c4`) COMMENT 'testing spatial index on Polygon', SPATIAL KEY `idx5` (`c5`) COMMENT 'testing spatial index on Geometry', KEY `idx6` (`c4`(10)) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW INDEX FROM tab; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored tab 0 PRIMARY 1 c1 A # NULL NULL BTREE NO @@ -615,7 +615,7 @@ tab CREATE TABLE `tab` ( SPATIAL KEY `idx4` (`c4`) COMMENT 'testing spatial index on Polygon', SPATIAL KEY `idx5` (`c5`) COMMENT 'testing spatial index on Geometry', KEY `idx6` (`c4`(10)) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW INDEX FROM tab; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored tab 0 PRIMARY 1 c1 A # NULL NULL BTREE NO @@ -690,14 +690,14 @@ parent CREATE TABLE `parent` ( `id` point NOT NULL, PRIMARY KEY (`id`(25)), SPATIAL KEY `idx1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE child; Table Create Table child CREATE TABLE `child` ( `id` geometry NOT NULL, `parent_id` point NOT NULL, SPATIAL KEY `idx2` (`parent_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW INDEX FROM parent; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored parent 0 PRIMARY 1 id A 0 25 NULL BTREE NO @@ -722,14 +722,14 @@ parent CREATE TABLE `parent` ( `id` geometry NOT NULL, PRIMARY KEY (`id`(10)), SPATIAL KEY `idx1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE child; Table Create Table child CREATE TABLE `child` ( `id` geometry NOT NULL, `parent_id` geometry NOT NULL, SPATIAL KEY `idx2` (`parent_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW INDEX FROM parent; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored parent 0 PRIMARY 1 id A 0 10 NULL BTREE NO @@ -786,3 +786,23 @@ CREATE OR REPLACE TABLE t1 (a INT) ENGINE=InnoDB; ALTER TABLE t1 ADD COLUMN b POINT DEFAULT '0'; ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field DROP TABLE t1; +# +# MDEV-29520 heap-use-after-poison in row_merge_spatial_rows() +# +CREATE TABLE t +(a VARCHAR(8192), b POINT NOT NULL, PRIMARY KEY(a(8)), SPATIAL(b)) +ENGINE=InnoDB; +INSERT INTO t VALUES (REPEAT('MariaDB Corporation Ab ',351),POINT(0,0)); +ALTER TABLE t FORCE; +DROP TABLE t; +# +# MDEV-29856 heap-use-after-poison in row_merge_spatial_rows() +# with PRIMARY KEY on column prefix +# +CREATE TABLE t (id INT, f TEXT, s POINT NOT NULL, +PRIMARY KEY(id,f(1)), SPATIAL(s)) ENGINE=InnoDB; +INSERT INTO t VALUES +(1,REPEAT('x',8192),@p:=ST_GeomFromText('POINT(0 0)')),(2,'',@p); +ALTER TABLE t FORCE; +DROP TABLE t; +# End of 10.3 tests diff --git a/mysql-test/suite/innodb_gis/r/create_spatial_index.result b/mysql-test/suite/innodb_gis/r/create_spatial_index.result index 25a5a4dd2893e..d3c69294c1077 100644 --- a/mysql-test/suite/innodb_gis/r/create_spatial_index.result +++ b/mysql-test/suite/innodb_gis/r/create_spatial_index.result @@ -1253,7 +1253,7 @@ tab CREATE TABLE `tab` ( `c1` point NOT NULL, SPATIAL KEY `idx1` (`c1`), CONSTRAINT `tab_const` CHECK (cast(`c1` as char charset binary) > 0) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW INDEX FROM tab; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored tab 1 idx1 1 c1 A NULL 32 NULL SPATIAL NO diff --git a/mysql-test/suite/innodb_gis/r/geometry.result b/mysql-test/suite/innodb_gis/r/geometry.result index 437ff23e334b6..c38e9e28d854a 100644 --- a/mysql-test/suite/innodb_gis/r/geometry.result +++ b/mysql-test/suite/innodb_gis/r/geometry.result @@ -342,9 +342,9 @@ tab CREATE TABLE `tab` ( `c7` geometrycollection DEFAULT NULL, `c8` geometry DEFAULT NULL, UNIQUE KEY `idx2` (`c8`(5)), - KEY `idx1` (`c2`(5)) USING BTREE, + KEY `idx1` (`c2`(5) DESC) USING BTREE, KEY `idx3` (`c3`(5)) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci #check the data after modify SELECT ST_AsText(c1) FROM tab; ST_AsText(c1) @@ -468,7 +468,7 @@ tab2 CREATE TABLE `tab2` ( `c6` multipolygon DEFAULT NULL, `c7` geometrycollection DEFAULT NULL, `c8` geometry NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci #create a tigger and populate the values into tab2 CREATE TRIGGER geom_trigger AFTER INSERT ON tab FOR EACH ROW @@ -655,7 +655,7 @@ tab3 CREATE TABLE `tab3` ( `c6` multipolygon DEFAULT NULL, `c7` geometrycollection DEFAULT NULL, `c8` geometry DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 ALTER TABLE tab3 KEY_BLOCK_SIZE=16 ROW_FORMAT=Dynamic; #check file format SHOW CREATE TABLE tab3; @@ -669,7 +669,7 @@ tab3 CREATE TABLE `tab3` ( `c6` multipolygon DEFAULT NULL, `c7` geometrycollection DEFAULT NULL, `c8` geometry DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=16 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=16 #check information schema for all the columns refer to 14, except POINT which is 15 SELECT sc.name, sc.pos, sc.mtype FROM information_schema.innodb_sys_columns sc @@ -778,9 +778,9 @@ tab3 CREATE TABLE `tab3` ( `c7` geometrycollection DEFAULT NULL, `c8` geometry DEFAULT NULL, UNIQUE KEY `idx2` (`c8`(5)), - KEY `idx1` (`c2`(5)) USING BTREE, + KEY `idx1` (`c2`(5) DESC) USING BTREE, KEY `idx3` (`c3`(5)) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=16 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=16 #check index with WKB function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)'))); diff --git a/mysql-test/suite/innodb_gis/r/gis.result b/mysql-test/suite/innodb_gis/r/gis.result index f41fcab5bbbb1..ca37674b05f5f 100644 --- a/mysql-test/suite/innodb_gis/r/gis.result +++ b/mysql-test/suite/innodb_gis/r/gis.result @@ -581,7 +581,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `ST_GeomFromWKB(POINT(1,3))` geometry DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo` @@ -661,9 +661,9 @@ object_id ST_geometrytype(geo) ST_ISSIMPLE(GEO) ST_ASTEXT(ST_centroid(geo)) drop table t1; create table t1 (fl geometry not null); insert into t1 values (1); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t1`.`fl` insert into t1 values (1.11); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Cannot cast 'decimal' as 'geometry' in assignment of `test`.`t1`.`fl` insert into t1 values ("qwerty"); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 values (ST_pointfromtext('point(1,1)')); @@ -1120,8 +1120,8 @@ SELECT 1 FROM g1 WHERE a >= ANY (SELECT 1 FROM g1 WHERE a = ST_geomfromtext('') OR a) ; 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'a' DROP TABLE g1; End of 5.5 tests DROP DATABASE IF EXISTS gis_ogs; diff --git a/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result b/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result index 5f0187eaa30c5..4ca50fcfd9ab6 100644 --- a/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result +++ b/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result @@ -10,7 +10,7 @@ t1 CREATE TABLE `t1` ( `g` geometry NOT NULL, PRIMARY KEY (`fid`), SPATIAL KEY `g` (`g`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 (g) VALUES (GeomFromText('LineString(150 150, 150 150)')); INSERT INTO t1 (g) VALUES (GeomFromText('LineString(149 149, 151 151)')); INSERT INTO t1 (g) VALUES (GeomFromText('LineString(148 148, 152 152)')); @@ -293,7 +293,7 @@ t2 CREATE TABLE `t2` ( `g` geometry NOT NULL, PRIMARY KEY (`fid`), SPATIAL KEY `g` (`g`) -) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT count(*) FROM t2; count(*) 100 diff --git a/mysql-test/suite/innodb_gis/r/kill_server.result b/mysql-test/suite/innodb_gis/r/kill_server.result index eac4feb442fc2..97f6ff419d82b 100644 --- a/mysql-test/suite/innodb_gis/r/kill_server.result +++ b/mysql-test/suite/innodb_gis/r/kill_server.result @@ -27,7 +27,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` geometry NOT NULL, SPATIAL KEY `idx` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci check table t1; Table Op Msg_type Msg_text test.t1 check status OK diff --git a/mysql-test/suite/innodb_gis/r/point_basic.result b/mysql-test/suite/innodb_gis/r/point_basic.result index 14f07d4facfcb..f58198395e406 100644 --- a/mysql-test/suite/innodb_gis/r/point_basic.result +++ b/mysql-test/suite/innodb_gis/r/point_basic.result @@ -219,7 +219,7 @@ t1 CREATE TABLE `t1` ( `g` geometry NOT NULL, `p` point DEFAULT NULL, `p1` point DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES(ST_PointFromText('POINT(0.5 0.5)'), ST_PointFromText('POINT(0 1)'), ST_PointFromText('POINT(10 19)')); INSERT INTO t1 VALUES(ST_PointFromText('POINT(0.6 0.6)'), ST_PointFromText('POINT(1 1)'), ST_PointFromText('POINT(10 20)')); INSERT INTO t1 VALUES(ST_PointFromText('POINT(0.7 0.7)'), ST_PointFromText('POINT(1 0)'), ST_PointFromText('POINT(10 21)')); @@ -1428,7 +1428,7 @@ geom CREATE TABLE `geom` ( `i` int(11) DEFAULT NULL, `g` point NOT NULL, SPATIAL KEY `g` (`g`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT ST_AsText(g) FROM geom; ST_AsText(g) POINT(0 0) @@ -1441,7 +1441,7 @@ geom CREATE TABLE `geom` ( `i` int(11) DEFAULT NULL, `g` geometry NOT NULL, SPATIAL KEY `g` (`g`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci TRUNCATE TABLE geom; From GEOMETRY to POINT, the table is empty ALTER TABLE geom MODIFY g POINT NOT NULL; @@ -1451,7 +1451,7 @@ geom CREATE TABLE `geom` ( `i` int(11) DEFAULT NULL, `g` point NOT NULL, SPATIAL KEY `g` (`g`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT ST_AsText(g) FROM geom; ST_AsText(g) CHECK TABLE gis_point; @@ -1517,7 +1517,7 @@ t1 CREATE TABLE `t1` ( SPATIAL KEY `idx2` (`p`), SPATIAL KEY `idx3` (`l`), SPATIAL KEY `idx4` (`g`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT a, ST_AsText(p), ST_AsText(l), ST_AsText(g) FROM t1; a ST_AsText(p) ST_AsText(l) ST_AsText(g) 1 POINT(10 10) LINESTRING(1 1,5 5,10 10) POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -1551,13 +1551,13 @@ parent CREATE TABLE `parent` ( `p` point NOT NULL, PRIMARY KEY (`p`(25)), SPATIAL KEY `idx1` (`p`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE child; Table Create Table child CREATE TABLE `child` ( `p` point NOT NULL, SPATIAL KEY `idx2` (`p`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE child ADD FOREIGN KEY(p) REFERENCES parent(p); ERROR HY000: Can't create table `test`.`child` (errno: 150 "Foreign key constraint is incorrectly formed") show warnings; diff --git a/mysql-test/suite/innodb_gis/r/rt_precise.result b/mysql-test/suite/innodb_gis/r/rt_precise.result index 4929dfc99a845..04ba208c9eaf9 100644 --- a/mysql-test/suite/innodb_gis/r/rt_precise.result +++ b/mysql-test/suite/innodb_gis/r/rt_precise.result @@ -12,7 +12,7 @@ t1 CREATE TABLE `t1` ( `g` geometry NOT NULL, PRIMARY KEY (`fid`), KEY `gis_key` (`g`(5)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT count(*) FROM t1; count(*) 150 @@ -49,7 +49,7 @@ t1 CREATE TABLE `t1` ( `g` geometry NOT NULL, PRIMARY KEY (`fid`), SPATIAL KEY `g` (`g`) -) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT count(*) FROM t1; count(*) 100 diff --git a/mysql-test/suite/innodb_gis/r/rtree.result b/mysql-test/suite/innodb_gis/r/rtree.result index 9b91b9b9c1605..2fd39f9ca3264 100644 --- a/mysql-test/suite/innodb_gis/r/rtree.result +++ b/mysql-test/suite/innodb_gis/r/rtree.result @@ -141,7 +141,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`i`), SPATIAL KEY `idx` (`g`), SPATIAL KEY `idx2` (`g`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop index idx on t1; drop table t1; create table t1 (i int, i2 char(10), g geometry not null, primary key (i, i2), spatial index (g))engine=innodb; diff --git a/mysql-test/suite/innodb_gis/r/rtree_debug.result b/mysql-test/suite/innodb_gis/r/rtree_debug.result index e8d2418af57b7..7306a8b68f069 100644 --- a/mysql-test/suite/innodb_gis/r/rtree_debug.result +++ b/mysql-test/suite/innodb_gis/r/rtree_debug.result @@ -37,7 +37,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` geometry NOT NULL, SPATIAL KEY `idx` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET @save_dbug = @@SESSION.debug_dbug; SET debug_dbug='+d,row_merge_ins_spatial_fail'; create spatial index idx2 on t1(c2); @@ -49,7 +49,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` geometry NOT NULL, SPATIAL KEY `idx` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci check table t1; Table Op Msg_type Msg_text test.t1 check status OK diff --git a/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result b/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result index 948b700aa6cf5..3e6464df997f0 100644 --- a/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result +++ b/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result @@ -137,6 +137,6 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`i`), SPATIAL KEY `idx` (`g`), SPATIAL KEY `idx2` (`g`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop index idx on t1; drop table t1; diff --git a/mysql-test/suite/innodb_gis/r/rtree_split.result b/mysql-test/suite/innodb_gis/r/rtree_split.result index df88960ba3d4e..97027bde865ae 100644 --- a/mysql-test/suite/innodb_gis/r/rtree_split.result +++ b/mysql-test/suite/innodb_gis/r/rtree_split.result @@ -43,7 +43,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` geometry NOT NULL, SPATIAL KEY `idx2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci set @g1 = ST_GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))'); select count(*) from t1 where MBRWithin(t1.c2, @g1); count(*) @@ -61,3 +61,15 @@ select count(*) from t1 where MBRWithin(t1.c2, @g1); count(*) 57344 drop table t1; +# +# MDEV-30400 Assertion height == btr_page_get_level ... on INSERT +# +CREATE TABLE t1 (c POINT NOT NULL,SPATIAL (c)) ENGINE=InnoDB; +SET @save_limit=@@GLOBAL.innodb_limit_optimistic_insert_debug; +SET GLOBAL innodb_limit_optimistic_insert_debug=2; +BEGIN; +INSERT INTO t1 SELECT POINTFROMTEXT ('POINT(0 0)') FROM seq_1_to_6; +ROLLBACK; +SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit; +DROP TABLE t1; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb_gis/r/rtree_temporary.result b/mysql-test/suite/innodb_gis/r/rtree_temporary.result new file mode 100644 index 0000000000000..c34df7f2d9c29 --- /dev/null +++ b/mysql-test/suite/innodb_gis/r/rtree_temporary.result @@ -0,0 +1,24 @@ +# +# MDEV-27417 Spatial index tries to update +# change buffer bookkeeping page +# +CREATE TEMPORARY TABLE t1 (c POINT NOT NULL, SPATIAL(c)) ENGINE=InnoDB; +INSERT INTO t1 SELECT PointFromText('POINT(0 0)') FROM seq_1_to_366; +DROP TABLE t1; +# +# MDEV-28478 Assertion mtr->get_log_mode() == MTR_LOG_NO_REDO +# +CREATE TEMPORARY TABLE t1 (c POINT NOT NULL,SPATIAL (c)) ENGINE=InnoDB; +INSERT INTO t1 SELECT POINT(0,0) FROM seq_1_to_366; +INSERT INTO t1 VALUES (POINT(1e-270,1e-130)); +DROP TABLE t1; +# +# MDEV-29507 InnoDB: Failing assertion: table->n_rec_locks == 0 +# +connect con1,localhost,root,,; +CREATE TEMPORARY TABLE t (c POINT NOT NULL,SPATIAL (c)) ENGINE=InnoDB; +INSERT INTO t SELECT POINTFROMTEXT ('POINT(0 0)') FROM seq_1_to_500; +XA BEGIN 'a'; +DELETE FROM t ORDER BY c; +disconnect con1; +# End of 10.3 tests diff --git a/mysql-test/suite/innodb_gis/r/types.result b/mysql-test/suite/innodb_gis/r/types.result index a337ee10e3d94..674a4497e4362 100644 --- a/mysql-test/suite/innodb_gis/r/types.result +++ b/mysql-test/suite/innodb_gis/r/types.result @@ -4,7 +4,7 @@ Table Create Table t_wl6455 CREATE TABLE `t_wl6455` ( `i` int(11) DEFAULT NULL, `g` geometry NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t_wl6455 VALUES(1, POINT(1,1)); INSERT INTO t_wl6455 VALUES(2, POINT(2,2)); SET @mp = 'MULTIPOINT(0 0, 20 20, 60 60)'; diff --git a/mysql-test/suite/innodb_gis/t/1.test b/mysql-test/suite/innodb_gis/t/1.test index 950db3607941e..99651842795c8 100644 --- a/mysql-test/suite/innodb_gis/t/1.test +++ b/mysql-test/suite/innodb_gis/t/1.test @@ -387,9 +387,9 @@ t1 where object_id=85984; drop table t1; create table t1 (fl geometry not null); ---error 1416 +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION insert into t1 values (1); ---error 1416 +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION insert into t1 values (1.11); --error 1416 insert into t1 values ("qwerty"); diff --git a/mysql-test/suite/innodb_gis/t/alter_spatial_index.test b/mysql-test/suite/innodb_gis/t/alter_spatial_index.test index 6d1607656d3d0..6f30b38b6d44b 100644 --- a/mysql-test/suite/innodb_gis/t/alter_spatial_index.test +++ b/mysql-test/suite/innodb_gis/t/alter_spatial_index.test @@ -778,3 +778,29 @@ CREATE OR REPLACE TABLE t1 (a INT) ENGINE=InnoDB; ALTER TABLE t1 ADD COLUMN b POINT DEFAULT '0'; DROP TABLE t1; +--echo # +--echo # MDEV-29520 heap-use-after-poison in row_merge_spatial_rows() +--echo # + +CREATE TABLE t +(a VARCHAR(8192), b POINT NOT NULL, PRIMARY KEY(a(8)), SPATIAL(b)) +ENGINE=InnoDB; +INSERT INTO t VALUES (REPEAT('MariaDB Corporation Ab ',351),POINT(0,0)); +ALTER TABLE t FORCE; + +# Cleanup +DROP TABLE t; + +--echo # +--echo # MDEV-29856 heap-use-after-poison in row_merge_spatial_rows() +--echo # with PRIMARY KEY on column prefix +--echo # + +CREATE TABLE t (id INT, f TEXT, s POINT NOT NULL, + PRIMARY KEY(id,f(1)), SPATIAL(s)) ENGINE=InnoDB; +INSERT INTO t VALUES +(1,REPEAT('x',8192),@p:=ST_GeomFromText('POINT(0 0)')),(2,'',@p); +ALTER TABLE t FORCE; +DROP TABLE t; + +--echo # End of 10.3 tests diff --git a/mysql-test/suite/innodb_gis/t/gis.test b/mysql-test/suite/innodb_gis/t/gis.test index 966aea7bc7737..b27e1852d6ea0 100644 --- a/mysql-test/suite/innodb_gis/t/gis.test +++ b/mysql-test/suite/innodb_gis/t/gis.test @@ -380,9 +380,9 @@ t1 where object_id=85984; drop table t1; create table t1 (fl geometry not null); ---error 1416 +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION insert into t1 values (1); ---error 1416 +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION insert into t1 values (1.11); --error 1416 insert into t1 values ("qwerty"); diff --git a/mysql-test/suite/innodb_gis/t/multi_pk.test b/mysql-test/suite/innodb_gis/t/multi_pk.test index c90f794fe159d..1be919d165a1f 100644 --- a/mysql-test/suite/innodb_gis/t/multi_pk.test +++ b/mysql-test/suite/innodb_gis/t/multi_pk.test @@ -8,6 +8,8 @@ --source include/have_debug.inc --source include/big_test.inc --source include/not_valgrind.inc +# This test often times out with MSAN +--source include/not_msan.inc # Create table with R-tree index. create table t1 (c1 int, c2 varchar(255), c3 geometry not null, primary key(c1, c2), spatial index (c3))engine=innodb; diff --git a/mysql-test/suite/innodb_gis/t/rtree_purge.test b/mysql-test/suite/innodb_gis/t/rtree_purge.test index 60ecbe2e53a82..fc5ce2e14bcca 100644 --- a/mysql-test/suite/innodb_gis/t/rtree_purge.test +++ b/mysql-test/suite/innodb_gis/t/rtree_purge.test @@ -3,6 +3,8 @@ --source include/innodb_page_size.inc --source include/have_sequence.inc --source include/not_valgrind.inc +# This test often times out with MSAN +--source include/not_msan.inc SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; diff --git a/mysql-test/suite/innodb_gis/t/rtree_split.test b/mysql-test/suite/innodb_gis/t/rtree_split.test index 6f285187508fc..a23315dc3f30a 100644 --- a/mysql-test/suite/innodb_gis/t/rtree_split.test +++ b/mysql-test/suite/innodb_gis/t/rtree_split.test @@ -73,3 +73,18 @@ select count(*) from t1 where MBRWithin(t1.c2, @g1); # Clean up. drop table t1; + +--echo # +--echo # MDEV-30400 Assertion height == btr_page_get_level ... on INSERT +--echo # + +CREATE TABLE t1 (c POINT NOT NULL,SPATIAL (c)) ENGINE=InnoDB; +SET @save_limit=@@GLOBAL.innodb_limit_optimistic_insert_debug; +SET GLOBAL innodb_limit_optimistic_insert_debug=2; +BEGIN; +INSERT INTO t1 SELECT POINTFROMTEXT ('POINT(0 0)') FROM seq_1_to_6; +ROLLBACK; +SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit; +DROP TABLE t1; + +--echo # End of 10.6 tests diff --git a/mysql-test/suite/innodb_gis/t/rtree_temporary.test b/mysql-test/suite/innodb_gis/t/rtree_temporary.test new file mode 100644 index 0000000000000..e541d7c2698e0 --- /dev/null +++ b/mysql-test/suite/innodb_gis/t/rtree_temporary.test @@ -0,0 +1,31 @@ +--source include/have_innodb.inc +--source include/have_sequence.inc + +--echo # +--echo # MDEV-27417 Spatial index tries to update +--echo # change buffer bookkeeping page +--echo # +CREATE TEMPORARY TABLE t1 (c POINT NOT NULL, SPATIAL(c)) ENGINE=InnoDB; +INSERT INTO t1 SELECT PointFromText('POINT(0 0)') FROM seq_1_to_366; +DROP TABLE t1; + +--echo # +--echo # MDEV-28478 Assertion mtr->get_log_mode() == MTR_LOG_NO_REDO +--echo # +CREATE TEMPORARY TABLE t1 (c POINT NOT NULL,SPATIAL (c)) ENGINE=InnoDB; +INSERT INTO t1 SELECT POINT(0,0) FROM seq_1_to_366; +INSERT INTO t1 VALUES (POINT(1e-270,1e-130)); +DROP TABLE t1; + +--echo # +--echo # MDEV-29507 InnoDB: Failing assertion: table->n_rec_locks == 0 +--echo # + +connect con1,localhost,root,,; +CREATE TEMPORARY TABLE t (c POINT NOT NULL,SPATIAL (c)) ENGINE=InnoDB; +INSERT INTO t SELECT POINTFROMTEXT ('POINT(0 0)') FROM seq_1_to_500; +XA BEGIN 'a'; +DELETE FROM t ORDER BY c; +disconnect con1; + +--echo # End of 10.3 tests diff --git a/mysql-test/suite/innodb_i_s/innodb_buffer_page.result b/mysql-test/suite/innodb_i_s/innodb_buffer_page.result index fb2e9913e4799..f48b9dd7283ba 100644 --- a/mysql-test/suite/innodb_i_s/innodb_buffer_page.result +++ b/mysql-test/suite/innodb_i_s/innodb_buffer_page.result @@ -1,27 +1,27 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE; Table Create Table INNODB_BUFFER_PAGE CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE` ( - `POOL_ID` int(11) unsigned NOT NULL DEFAULT 0, - `BLOCK_ID` bigint(21) unsigned NOT NULL DEFAULT 0, - `SPACE` int(11) unsigned NOT NULL DEFAULT 0, - `PAGE_NUMBER` int(11) unsigned NOT NULL DEFAULT 0, - `PAGE_TYPE` varchar(64) DEFAULT NULL, - `FLUSH_TYPE` int(11) unsigned NOT NULL DEFAULT 0, - `FIX_COUNT` int(11) unsigned NOT NULL DEFAULT 0, - `IS_HASHED` int(1) NOT NULL DEFAULT 0, - `NEWEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT 0, - `OLDEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT 0, - `ACCESS_TIME` bigint(21) unsigned NOT NULL DEFAULT 0, - `TABLE_NAME` varchar(1024) DEFAULT NULL, - `INDEX_NAME` varchar(64) DEFAULT NULL, - `NUMBER_RECORDS` bigint(21) unsigned NOT NULL DEFAULT 0, - `DATA_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0, - `COMPRESSED_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0, + `POOL_ID` int(11) unsigned NOT NULL, + `BLOCK_ID` bigint(21) unsigned NOT NULL, + `SPACE` int(11) unsigned NOT NULL, + `PAGE_NUMBER` int(11) unsigned NOT NULL, + `PAGE_TYPE` varchar(64), + `FLUSH_TYPE` int(11) unsigned NOT NULL, + `FIX_COUNT` int(11) unsigned NOT NULL, + `IS_HASHED` int(1) NOT NULL, + `NEWEST_MODIFICATION` bigint(21) unsigned NOT NULL, + `OLDEST_MODIFICATION` bigint(21) unsigned NOT NULL, + `ACCESS_TIME` bigint(21) unsigned NOT NULL, + `TABLE_NAME` varchar(1024), + `INDEX_NAME` varchar(64), + `NUMBER_RECORDS` bigint(21) unsigned NOT NULL, + `DATA_SIZE` bigint(21) unsigned NOT NULL, + `COMPRESSED_SIZE` bigint(21) unsigned NOT NULL, `PAGE_STATE` enum('NOT_USED','MEMORY','REMOVE_HASH','FILE_PAGE') NOT NULL, `IO_FIX` enum('IO_NONE','IO_READ','IO_WRITE') NOT NULL, - `IS_OLD` int(1) NOT NULL DEFAULT 0, - `FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `IS_OLD` int(1) NOT NULL, + `FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci CREATE TEMPORARY TABLE t1 LIKE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE; DROP TEMPORARY TABLE t1; CREATE TEMPORARY TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE LIMIT 0; diff --git a/mysql-test/suite/innodb_i_s/innodb_buffer_page_lru.result b/mysql-test/suite/innodb_i_s/innodb_buffer_page_lru.result index 7954c593164aa..a8213aa7e4e43 100644 --- a/mysql-test/suite/innodb_i_s/innodb_buffer_page_lru.result +++ b/mysql-test/suite/innodb_i_s/innodb_buffer_page_lru.result @@ -1,27 +1,27 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU; Table Create Table INNODB_BUFFER_PAGE_LRU CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE_LRU` ( - `POOL_ID` int(11) unsigned NOT NULL DEFAULT 0, - `LRU_POSITION` bigint(21) unsigned NOT NULL DEFAULT 0, - `SPACE` int(11) unsigned NOT NULL DEFAULT 0, - `PAGE_NUMBER` int(11) unsigned NOT NULL DEFAULT 0, - `PAGE_TYPE` varchar(64) DEFAULT NULL, - `FLUSH_TYPE` int(11) unsigned NOT NULL DEFAULT 0, - `FIX_COUNT` int(11) unsigned NOT NULL DEFAULT 0, - `IS_HASHED` int(1) NOT NULL DEFAULT 0, - `NEWEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT 0, - `OLDEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT 0, - `ACCESS_TIME` bigint(21) unsigned NOT NULL DEFAULT 0, - `TABLE_NAME` varchar(1024) DEFAULT NULL, - `INDEX_NAME` varchar(64) DEFAULT NULL, - `NUMBER_RECORDS` bigint(21) unsigned NOT NULL DEFAULT 0, - `DATA_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0, - `COMPRESSED_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0, - `COMPRESSED` int(1) NOT NULL DEFAULT 0, + `POOL_ID` int(11) unsigned NOT NULL, + `LRU_POSITION` bigint(21) unsigned NOT NULL, + `SPACE` int(11) unsigned NOT NULL, + `PAGE_NUMBER` int(11) unsigned NOT NULL, + `PAGE_TYPE` varchar(64), + `FLUSH_TYPE` int(11) unsigned NOT NULL, + `FIX_COUNT` int(11) unsigned NOT NULL, + `IS_HASHED` int(1) NOT NULL, + `NEWEST_MODIFICATION` bigint(21) unsigned NOT NULL, + `OLDEST_MODIFICATION` bigint(21) unsigned NOT NULL, + `ACCESS_TIME` bigint(21) unsigned NOT NULL, + `TABLE_NAME` varchar(1024), + `INDEX_NAME` varchar(64), + `NUMBER_RECORDS` bigint(21) unsigned NOT NULL, + `DATA_SIZE` bigint(21) unsigned NOT NULL, + `COMPRESSED_SIZE` bigint(21) unsigned NOT NULL, + `COMPRESSED` int(1) NOT NULL, `IO_FIX` enum('IO_NONE','IO_READ','IO_WRITE') NOT NULL, - `IS_OLD` int(1) DEFAULT NULL, - `FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `IS_OLD` int(1), + `FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci CREATE TEMPORARY TABLE t1 LIKE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU; DROP TEMPORARY TABLE t1; CREATE TEMPORARY TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU LIMIT 0; diff --git a/mysql-test/suite/innodb_i_s/innodb_buffer_pool_stats.result b/mysql-test/suite/innodb_i_s/innodb_buffer_pool_stats.result index 5e0c2ae8e89e3..f7fdd38f63111 100644 --- a/mysql-test/suite/innodb_i_s/innodb_buffer_pool_stats.result +++ b/mysql-test/suite/innodb_i_s/innodb_buffer_pool_stats.result @@ -1,36 +1,36 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS; Table Create Table INNODB_BUFFER_POOL_STATS CREATE TEMPORARY TABLE `INNODB_BUFFER_POOL_STATS` ( - `POOL_ID` int(11) unsigned NOT NULL DEFAULT 0, - `POOL_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0, - `FREE_BUFFERS` bigint(21) unsigned NOT NULL DEFAULT 0, - `DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT 0, - `OLD_DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT 0, - `MODIFIED_DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT 0, - `PENDING_DECOMPRESS` bigint(21) unsigned NOT NULL DEFAULT 0, - `PENDING_READS` bigint(21) unsigned NOT NULL DEFAULT 0, - `PENDING_FLUSH_LRU` bigint(21) unsigned NOT NULL DEFAULT 0, - `PENDING_FLUSH_LIST` bigint(21) unsigned NOT NULL DEFAULT 0, - `PAGES_MADE_YOUNG` bigint(21) unsigned NOT NULL DEFAULT 0, - `PAGES_NOT_MADE_YOUNG` bigint(21) unsigned NOT NULL DEFAULT 0, - `PAGES_MADE_YOUNG_RATE` float NOT NULL DEFAULT 0, - `PAGES_MADE_NOT_YOUNG_RATE` float NOT NULL DEFAULT 0, - `NUMBER_PAGES_READ` bigint(21) unsigned NOT NULL DEFAULT 0, - `NUMBER_PAGES_CREATED` bigint(21) unsigned NOT NULL DEFAULT 0, - `NUMBER_PAGES_WRITTEN` bigint(21) unsigned NOT NULL DEFAULT 0, - `PAGES_READ_RATE` float NOT NULL DEFAULT 0, - `PAGES_CREATE_RATE` float NOT NULL DEFAULT 0, - `PAGES_WRITTEN_RATE` float NOT NULL DEFAULT 0, - `NUMBER_PAGES_GET` bigint(21) unsigned NOT NULL DEFAULT 0, - `HIT_RATE` bigint(21) unsigned NOT NULL DEFAULT 0, - `YOUNG_MAKE_PER_THOUSAND_GETS` bigint(21) unsigned NOT NULL DEFAULT 0, - `NOT_YOUNG_MAKE_PER_THOUSAND_GETS` bigint(21) unsigned NOT NULL DEFAULT 0, - `NUMBER_PAGES_READ_AHEAD` bigint(21) unsigned NOT NULL DEFAULT 0, - `NUMBER_READ_AHEAD_EVICTED` bigint(21) unsigned NOT NULL DEFAULT 0, - `READ_AHEAD_RATE` float NOT NULL DEFAULT 0, - `READ_AHEAD_EVICTED_RATE` float NOT NULL DEFAULT 0, - `LRU_IO_TOTAL` bigint(21) unsigned NOT NULL DEFAULT 0, - `LRU_IO_CURRENT` bigint(21) unsigned NOT NULL DEFAULT 0, - `UNCOMPRESS_TOTAL` bigint(21) unsigned NOT NULL DEFAULT 0, - `UNCOMPRESS_CURRENT` bigint(21) unsigned NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `POOL_ID` int(11) unsigned NOT NULL, + `POOL_SIZE` bigint(21) unsigned NOT NULL, + `FREE_BUFFERS` bigint(21) unsigned NOT NULL, + `DATABASE_PAGES` bigint(21) unsigned NOT NULL, + `OLD_DATABASE_PAGES` bigint(21) unsigned NOT NULL, + `MODIFIED_DATABASE_PAGES` bigint(21) unsigned NOT NULL, + `PENDING_DECOMPRESS` bigint(21) unsigned NOT NULL, + `PENDING_READS` bigint(21) unsigned NOT NULL, + `PENDING_FLUSH_LRU` bigint(21) unsigned NOT NULL, + `PENDING_FLUSH_LIST` bigint(21) unsigned NOT NULL, + `PAGES_MADE_YOUNG` bigint(21) unsigned NOT NULL, + `PAGES_NOT_MADE_YOUNG` bigint(21) unsigned NOT NULL, + `PAGES_MADE_YOUNG_RATE` float NOT NULL, + `PAGES_MADE_NOT_YOUNG_RATE` float NOT NULL, + `NUMBER_PAGES_READ` bigint(21) unsigned NOT NULL, + `NUMBER_PAGES_CREATED` bigint(21) unsigned NOT NULL, + `NUMBER_PAGES_WRITTEN` bigint(21) unsigned NOT NULL, + `PAGES_READ_RATE` float NOT NULL, + `PAGES_CREATE_RATE` float NOT NULL, + `PAGES_WRITTEN_RATE` float NOT NULL, + `NUMBER_PAGES_GET` bigint(21) unsigned NOT NULL, + `HIT_RATE` bigint(21) unsigned NOT NULL, + `YOUNG_MAKE_PER_THOUSAND_GETS` bigint(21) unsigned NOT NULL, + `NOT_YOUNG_MAKE_PER_THOUSAND_GETS` bigint(21) unsigned NOT NULL, + `NUMBER_PAGES_READ_AHEAD` bigint(21) unsigned NOT NULL, + `NUMBER_READ_AHEAD_EVICTED` bigint(21) unsigned NOT NULL, + `READ_AHEAD_RATE` float NOT NULL, + `READ_AHEAD_EVICTED_RATE` float NOT NULL, + `LRU_IO_TOTAL` bigint(21) unsigned NOT NULL, + `LRU_IO_CURRENT` bigint(21) unsigned NOT NULL, + `UNCOMPRESS_TOTAL` bigint(21) unsigned NOT NULL, + `UNCOMPRESS_CURRENT` bigint(21) unsigned NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_cmp.result b/mysql-test/suite/innodb_i_s/innodb_cmp.result index d06bdf1dbc482..2931eb1ab4e68 100644 --- a/mysql-test/suite/innodb_i_s/innodb_cmp.result +++ b/mysql-test/suite/innodb_i_s/innodb_cmp.result @@ -1,10 +1,10 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMP; Table Create Table INNODB_CMP CREATE TEMPORARY TABLE `INNODB_CMP` ( - `page_size` int(5) NOT NULL DEFAULT 0, - `compress_ops` int(11) NOT NULL DEFAULT 0, - `compress_ops_ok` int(11) NOT NULL DEFAULT 0, - `compress_time` int(11) NOT NULL DEFAULT 0, - `uncompress_ops` int(11) NOT NULL DEFAULT 0, - `uncompress_time` int(11) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `page_size` int(5) NOT NULL, + `compress_ops` int(11) NOT NULL, + `compress_ops_ok` int(11) NOT NULL, + `compress_time` int(11) NOT NULL, + `uncompress_ops` int(11) NOT NULL, + `uncompress_time` int(11) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_cmp_per_index.result b/mysql-test/suite/innodb_i_s/innodb_cmp_per_index.result index 5037957681a19..d94e2d5a1ca7f 100644 --- a/mysql-test/suite/innodb_i_s/innodb_cmp_per_index.result +++ b/mysql-test/suite/innodb_i_s/innodb_cmp_per_index.result @@ -1,12 +1,12 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX; Table Create Table INNODB_CMP_PER_INDEX CREATE TEMPORARY TABLE `INNODB_CMP_PER_INDEX` ( - `database_name` varchar(64) NOT NULL DEFAULT '', - `table_name` varchar(64) NOT NULL DEFAULT '', - `index_name` varchar(64) NOT NULL DEFAULT '', - `compress_ops` int(11) NOT NULL DEFAULT 0, - `compress_ops_ok` int(11) NOT NULL DEFAULT 0, - `compress_time` int(11) NOT NULL DEFAULT 0, - `uncompress_ops` int(11) NOT NULL DEFAULT 0, - `uncompress_time` int(11) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `database_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, + `index_name` varchar(64) NOT NULL, + `compress_ops` int(11) NOT NULL, + `compress_ops_ok` int(11) NOT NULL, + `compress_time` int(11) NOT NULL, + `uncompress_ops` int(11) NOT NULL, + `uncompress_time` int(11) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_cmp_per_index_reset.result b/mysql-test/suite/innodb_i_s/innodb_cmp_per_index_reset.result index d044cf077ac4a..a987997328146 100644 --- a/mysql-test/suite/innodb_i_s/innodb_cmp_per_index_reset.result +++ b/mysql-test/suite/innodb_i_s/innodb_cmp_per_index_reset.result @@ -1,12 +1,12 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX_RESET; Table Create Table INNODB_CMP_PER_INDEX_RESET CREATE TEMPORARY TABLE `INNODB_CMP_PER_INDEX_RESET` ( - `database_name` varchar(64) NOT NULL DEFAULT '', - `table_name` varchar(64) NOT NULL DEFAULT '', - `index_name` varchar(64) NOT NULL DEFAULT '', - `compress_ops` int(11) NOT NULL DEFAULT 0, - `compress_ops_ok` int(11) NOT NULL DEFAULT 0, - `compress_time` int(11) NOT NULL DEFAULT 0, - `uncompress_ops` int(11) NOT NULL DEFAULT 0, - `uncompress_time` int(11) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `database_name` varchar(64) NOT NULL, + `table_name` varchar(64) NOT NULL, + `index_name` varchar(64) NOT NULL, + `compress_ops` int(11) NOT NULL, + `compress_ops_ok` int(11) NOT NULL, + `compress_time` int(11) NOT NULL, + `uncompress_ops` int(11) NOT NULL, + `uncompress_time` int(11) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_cmp_reset.result b/mysql-test/suite/innodb_i_s/innodb_cmp_reset.result index 4a6ef8669321f..f4cc2100f2922 100644 --- a/mysql-test/suite/innodb_i_s/innodb_cmp_reset.result +++ b/mysql-test/suite/innodb_i_s/innodb_cmp_reset.result @@ -1,10 +1,10 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMP_RESET; Table Create Table INNODB_CMP_RESET CREATE TEMPORARY TABLE `INNODB_CMP_RESET` ( - `page_size` int(5) NOT NULL DEFAULT 0, - `compress_ops` int(11) NOT NULL DEFAULT 0, - `compress_ops_ok` int(11) NOT NULL DEFAULT 0, - `compress_time` int(11) NOT NULL DEFAULT 0, - `uncompress_ops` int(11) NOT NULL DEFAULT 0, - `uncompress_time` int(11) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `page_size` int(5) NOT NULL, + `compress_ops` int(11) NOT NULL, + `compress_ops_ok` int(11) NOT NULL, + `compress_time` int(11) NOT NULL, + `uncompress_ops` int(11) NOT NULL, + `uncompress_time` int(11) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_cmpmem.result b/mysql-test/suite/innodb_i_s/innodb_cmpmem.result index 4f66f491b6b9f..2cc7669d70f38 100644 --- a/mysql-test/suite/innodb_i_s/innodb_cmpmem.result +++ b/mysql-test/suite/innodb_i_s/innodb_cmpmem.result @@ -1,10 +1,10 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMPMEM; Table Create Table INNODB_CMPMEM CREATE TEMPORARY TABLE `INNODB_CMPMEM` ( - `page_size` int(5) NOT NULL DEFAULT 0, - `buffer_pool_instance` int(11) NOT NULL DEFAULT 0, - `pages_used` int(11) NOT NULL DEFAULT 0, - `pages_free` int(11) NOT NULL DEFAULT 0, - `relocation_ops` bigint(21) NOT NULL DEFAULT 0, - `relocation_time` int(11) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `page_size` int(5) NOT NULL, + `buffer_pool_instance` int(11) NOT NULL, + `pages_used` int(11) NOT NULL, + `pages_free` int(11) NOT NULL, + `relocation_ops` bigint(21) NOT NULL, + `relocation_time` int(11) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_cmpmem_reset.result b/mysql-test/suite/innodb_i_s/innodb_cmpmem_reset.result index 0f7adfc0fce6e..4f946a2dba07f 100644 --- a/mysql-test/suite/innodb_i_s/innodb_cmpmem_reset.result +++ b/mysql-test/suite/innodb_i_s/innodb_cmpmem_reset.result @@ -1,10 +1,10 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMPMEM_RESET; Table Create Table INNODB_CMPMEM_RESET CREATE TEMPORARY TABLE `INNODB_CMPMEM_RESET` ( - `page_size` int(5) NOT NULL DEFAULT 0, - `buffer_pool_instance` int(11) NOT NULL DEFAULT 0, - `pages_used` int(11) NOT NULL DEFAULT 0, - `pages_free` int(11) NOT NULL DEFAULT 0, - `relocation_ops` bigint(21) NOT NULL DEFAULT 0, - `relocation_time` int(11) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `page_size` int(5) NOT NULL, + `buffer_pool_instance` int(11) NOT NULL, + `pages_used` int(11) NOT NULL, + `pages_free` int(11) NOT NULL, + `relocation_ops` bigint(21) NOT NULL, + `relocation_time` int(11) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_being_deleted.result b/mysql-test/suite/innodb_i_s/innodb_ft_being_deleted.result index 7c2c2a4d18343..ead7446ff9c3d 100644 --- a/mysql-test/suite/innodb_i_s/innodb_ft_being_deleted.result +++ b/mysql-test/suite/innodb_i_s/innodb_ft_being_deleted.result @@ -1,5 +1,5 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED; Table Create Table INNODB_FT_BEING_DELETED CREATE TEMPORARY TABLE `INNODB_FT_BEING_DELETED` ( - `DOC_ID` bigint(21) unsigned NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `DOC_ID` bigint(21) unsigned NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_config.result b/mysql-test/suite/innodb_i_s/innodb_ft_config.result index 5d2f7ec87d54d..0abf9bdb2dc84 100644 --- a/mysql-test/suite/innodb_i_s/innodb_ft_config.result +++ b/mysql-test/suite/innodb_i_s/innodb_ft_config.result @@ -1,6 +1,6 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_CONFIG; Table Create Table INNODB_FT_CONFIG CREATE TEMPORARY TABLE `INNODB_FT_CONFIG` ( - `KEY` varchar(193) NOT NULL DEFAULT '', - `VALUE` varchar(193) NOT NULL DEFAULT '' -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `KEY` varchar(193) NOT NULL, + `VALUE` varchar(193) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_default_stopword.result b/mysql-test/suite/innodb_i_s/innodb_ft_default_stopword.result index 6f4e0012c5fc5..124888e1fe348 100644 --- a/mysql-test/suite/innodb_i_s/innodb_ft_default_stopword.result +++ b/mysql-test/suite/innodb_i_s/innodb_ft_default_stopword.result @@ -1,5 +1,5 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD; Table Create Table INNODB_FT_DEFAULT_STOPWORD CREATE TEMPORARY TABLE `INNODB_FT_DEFAULT_STOPWORD` ( - `value` varchar(18) NOT NULL DEFAULT '' -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `value` varchar(18) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_deleted.result b/mysql-test/suite/innodb_i_s/innodb_ft_deleted.result index 6224ce747af2d..3ea523939587d 100644 --- a/mysql-test/suite/innodb_i_s/innodb_ft_deleted.result +++ b/mysql-test/suite/innodb_i_s/innodb_ft_deleted.result @@ -1,5 +1,5 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_DELETED; Table Create Table INNODB_FT_DELETED CREATE TEMPORARY TABLE `INNODB_FT_DELETED` ( - `DOC_ID` bigint(21) unsigned NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `DOC_ID` bigint(21) unsigned NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_index_cache.result b/mysql-test/suite/innodb_i_s/innodb_ft_index_cache.result index a17b9446c9f9b..02f3c73171de6 100644 --- a/mysql-test/suite/innodb_i_s/innodb_ft_index_cache.result +++ b/mysql-test/suite/innodb_i_s/innodb_ft_index_cache.result @@ -1,10 +1,10 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; Table Create Table INNODB_FT_INDEX_CACHE CREATE TEMPORARY TABLE `INNODB_FT_INDEX_CACHE` ( - `WORD` varchar(337) NOT NULL DEFAULT '', - `FIRST_DOC_ID` bigint(21) unsigned NOT NULL DEFAULT 0, - `LAST_DOC_ID` bigint(21) unsigned NOT NULL DEFAULT 0, - `DOC_COUNT` bigint(21) unsigned NOT NULL DEFAULT 0, - `DOC_ID` bigint(21) unsigned NOT NULL DEFAULT 0, - `POSITION` bigint(21) unsigned NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `WORD` varchar(337) NOT NULL, + `FIRST_DOC_ID` bigint(21) unsigned NOT NULL, + `LAST_DOC_ID` bigint(21) unsigned NOT NULL, + `DOC_COUNT` bigint(21) unsigned NOT NULL, + `DOC_ID` bigint(21) unsigned NOT NULL, + `POSITION` bigint(21) unsigned NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_ft_index_table.result b/mysql-test/suite/innodb_i_s/innodb_ft_index_table.result index 8ec767ce5d13a..6122f0116e1d1 100644 --- a/mysql-test/suite/innodb_i_s/innodb_ft_index_table.result +++ b/mysql-test/suite/innodb_i_s/innodb_ft_index_table.result @@ -1,10 +1,10 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; Table Create Table INNODB_FT_INDEX_TABLE CREATE TEMPORARY TABLE `INNODB_FT_INDEX_TABLE` ( - `WORD` varchar(337) NOT NULL DEFAULT '', - `FIRST_DOC_ID` bigint(21) unsigned NOT NULL DEFAULT 0, - `LAST_DOC_ID` bigint(21) unsigned NOT NULL DEFAULT 0, - `DOC_COUNT` bigint(21) unsigned NOT NULL DEFAULT 0, - `DOC_ID` bigint(21) unsigned NOT NULL DEFAULT 0, - `POSITION` bigint(21) unsigned NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `WORD` varchar(337) NOT NULL, + `FIRST_DOC_ID` bigint(21) unsigned NOT NULL, + `LAST_DOC_ID` bigint(21) unsigned NOT NULL, + `DOC_COUNT` bigint(21) unsigned NOT NULL, + `DOC_ID` bigint(21) unsigned NOT NULL, + `POSITION` bigint(21) unsigned NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_lock_waits.result b/mysql-test/suite/innodb_i_s/innodb_lock_waits.result index 8d8c2d158a775..0a974008548c7 100644 --- a/mysql-test/suite/innodb_i_s/innodb_lock_waits.result +++ b/mysql-test/suite/innodb_i_s/innodb_lock_waits.result @@ -1,8 +1,8 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_LOCK_WAITS; Table Create Table INNODB_LOCK_WAITS CREATE TEMPORARY TABLE `INNODB_LOCK_WAITS` ( - `requesting_trx_id` bigint(21) unsigned NOT NULL DEFAULT 0, - `requested_lock_id` varchar(81) NOT NULL DEFAULT '', - `blocking_trx_id` bigint(21) unsigned NOT NULL DEFAULT 0, - `blocking_lock_id` varchar(81) NOT NULL DEFAULT '' -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `requesting_trx_id` bigint(21) unsigned NOT NULL, + `requested_lock_id` varchar(81) NOT NULL, + `blocking_trx_id` bigint(21) unsigned NOT NULL, + `blocking_lock_id` varchar(81) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_locks.result b/mysql-test/suite/innodb_i_s/innodb_locks.result index 977776ae2ec84..1a064e52e73bc 100644 --- a/mysql-test/suite/innodb_i_s/innodb_locks.result +++ b/mysql-test/suite/innodb_i_s/innodb_locks.result @@ -1,17 +1,17 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_LOCKS; Table Create Table INNODB_LOCKS CREATE TEMPORARY TABLE `INNODB_LOCKS` ( - `lock_id` varchar(81) NOT NULL DEFAULT '', - `lock_trx_id` bigint(21) unsigned NOT NULL DEFAULT 0, + `lock_id` varchar(81) NOT NULL, + `lock_trx_id` bigint(21) unsigned NOT NULL, `lock_mode` enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NOT NULL, `lock_type` enum('RECORD','TABLE') NOT NULL, - `lock_table` varchar(1024) NOT NULL DEFAULT '', - `lock_index` varchar(1024) DEFAULT NULL, - `lock_space` int(11) unsigned DEFAULT NULL, - `lock_page` int(11) unsigned DEFAULT NULL, - `lock_rec` int(11) unsigned DEFAULT NULL, - `lock_data` varchar(8192) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `lock_table` varchar(1024) NOT NULL, + `lock_index` varchar(1024), + `lock_space` int(11) unsigned, + `lock_page` int(11) unsigned, + `lock_rec` int(11) unsigned, + `lock_data` varchar(8192) +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci CREATE TEMPORARY TABLE t1 LIKE INFORMATION_SCHEMA.INNODB_LOCKS; DROP TEMPORARY TABLE t1; CREATE TEMPORARY TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS LIMIT 0; diff --git a/mysql-test/suite/innodb_i_s/innodb_metrics.result b/mysql-test/suite/innodb_i_s/innodb_metrics.result index 7687fa8fc20e2..8caa972ddd918 100644 --- a/mysql-test/suite/innodb_i_s/innodb_metrics.result +++ b/mysql-test/suite/innodb_i_s/innodb_metrics.result @@ -1,24 +1,24 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_METRICS; Table Create Table INNODB_METRICS CREATE TEMPORARY TABLE `INNODB_METRICS` ( - `NAME` varchar(193) NOT NULL DEFAULT '', - `SUBSYSTEM` varchar(193) NOT NULL DEFAULT '', - `COUNT` bigint(21) NOT NULL DEFAULT 0, - `MAX_COUNT` bigint(21) DEFAULT NULL, - `MIN_COUNT` bigint(21) DEFAULT NULL, - `AVG_COUNT` float DEFAULT NULL, - `COUNT_RESET` bigint(21) NOT NULL DEFAULT 0, - `MAX_COUNT_RESET` bigint(21) DEFAULT NULL, - `MIN_COUNT_RESET` bigint(21) DEFAULT NULL, - `AVG_COUNT_RESET` float DEFAULT NULL, - `TIME_ENABLED` datetime DEFAULT NULL, - `TIME_DISABLED` datetime DEFAULT NULL, - `TIME_ELAPSED` bigint(21) DEFAULT NULL, - `TIME_RESET` datetime DEFAULT NULL, - `ENABLED` int(1) NOT NULL DEFAULT 0, + `NAME` varchar(193) NOT NULL, + `SUBSYSTEM` varchar(193) NOT NULL, + `COUNT` bigint(21) NOT NULL, + `MAX_COUNT` bigint(21), + `MIN_COUNT` bigint(21), + `AVG_COUNT` float, + `COUNT_RESET` bigint(21) NOT NULL, + `MAX_COUNT_RESET` bigint(21), + `MIN_COUNT_RESET` bigint(21), + `AVG_COUNT_RESET` float, + `TIME_ENABLED` datetime, + `TIME_DISABLED` datetime, + `TIME_ELAPSED` bigint(21), + `TIME_RESET` datetime, + `ENABLED` int(1) NOT NULL, `TYPE` enum('value','status_counter','set_owner','set_member','counter') NOT NULL, - `COMMENT` varchar(193) NOT NULL DEFAULT '' -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `COMMENT` varchar(193) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci CREATE TEMPORARY TABLE t1 LIKE INFORMATION_SCHEMA.INNODB_METRICS; DROP TEMPORARY TABLE t1; CREATE TEMPORARY TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS LIMIT 0; diff --git a/mysql-test/suite/innodb_i_s/innodb_mutexes.result b/mysql-test/suite/innodb_i_s/innodb_mutexes.result new file mode 100644 index 0000000000000..6abd25aaac75e --- /dev/null +++ b/mysql-test/suite/innodb_i_s/innodb_mutexes.result @@ -0,0 +1,8 @@ +SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_MUTEXES; +Table Create Table +INNODB_MUTEXES CREATE TEMPORARY TABLE `INNODB_MUTEXES` ( + `NAME` varchar(4000) NOT NULL, + `CREATE_FILE` varchar(4000) NOT NULL, + `CREATE_LINE` int(11) unsigned NOT NULL, + `OS_WAITS` bigint(21) unsigned NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_columns.result b/mysql-test/suite/innodb_i_s/innodb_sys_columns.result index a4f13d198548b..3e2df356342f6 100644 --- a/mysql-test/suite/innodb_i_s/innodb_sys_columns.result +++ b/mysql-test/suite/innodb_i_s/innodb_sys_columns.result @@ -1,10 +1,10 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_COLUMNS; Table Create Table INNODB_SYS_COLUMNS CREATE TEMPORARY TABLE `INNODB_SYS_COLUMNS` ( - `TABLE_ID` bigint(21) unsigned NOT NULL DEFAULT 0, - `NAME` varchar(64) NOT NULL DEFAULT '', - `POS` bigint(21) unsigned NOT NULL DEFAULT 0, - `MTYPE` int(11) NOT NULL DEFAULT 0, - `PRTYPE` int(11) NOT NULL DEFAULT 0, - `LEN` int(11) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `TABLE_ID` bigint(21) unsigned NOT NULL, + `NAME` varchar(64) NOT NULL, + `POS` bigint(21) unsigned NOT NULL, + `MTYPE` int(11) NOT NULL, + `PRTYPE` int(11) NOT NULL, + `LEN` int(11) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_datafiles.result b/mysql-test/suite/innodb_i_s/innodb_sys_datafiles.result new file mode 100644 index 0000000000000..94d881bd5ddd3 --- /dev/null +++ b/mysql-test/suite/innodb_i_s/innodb_sys_datafiles.result @@ -0,0 +1,6 @@ +SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_DATAFILES; +Table Create Table +INNODB_SYS_DATAFILES CREATE TEMPORARY TABLE `INNODB_SYS_DATAFILES` ( + `SPACE` int(11) unsigned NOT NULL, + `PATH` varchar(4000) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_fields.result b/mysql-test/suite/innodb_i_s/innodb_sys_fields.result index d69645e139a53..eb4cb5e5774f0 100644 --- a/mysql-test/suite/innodb_i_s/innodb_sys_fields.result +++ b/mysql-test/suite/innodb_i_s/innodb_sys_fields.result @@ -1,7 +1,7 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_FIELDS; Table Create Table INNODB_SYS_FIELDS CREATE TEMPORARY TABLE `INNODB_SYS_FIELDS` ( - `INDEX_ID` bigint(21) unsigned NOT NULL DEFAULT 0, - `NAME` varchar(64) NOT NULL DEFAULT '', - `POS` int(11) unsigned NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `INDEX_ID` bigint(21) unsigned NOT NULL, + `NAME` varchar(64) NOT NULL, + `POS` int(11) unsigned NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_foreign.result b/mysql-test/suite/innodb_i_s/innodb_sys_foreign.result index 1995db45f5df7..2cba1cb74a86c 100644 --- a/mysql-test/suite/innodb_i_s/innodb_sys_foreign.result +++ b/mysql-test/suite/innodb_i_s/innodb_sys_foreign.result @@ -1,9 +1,9 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; Table Create Table INNODB_SYS_FOREIGN CREATE TEMPORARY TABLE `INNODB_SYS_FOREIGN` ( - `ID` varchar(193) NOT NULL DEFAULT '', - `FOR_NAME` varchar(193) NOT NULL DEFAULT '', - `REF_NAME` varchar(193) NOT NULL DEFAULT '', - `N_COLS` int(11) unsigned NOT NULL DEFAULT 0, - `TYPE` int(11) unsigned NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `ID` varchar(193) NOT NULL, + `FOR_NAME` varchar(193) NOT NULL, + `REF_NAME` varchar(193) NOT NULL, + `N_COLS` int(11) unsigned NOT NULL, + `TYPE` int(11) unsigned NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_foreign_cols.result b/mysql-test/suite/innodb_i_s/innodb_sys_foreign_cols.result index 48d98a371c0ff..8ba0544ac4579 100644 --- a/mysql-test/suite/innodb_i_s/innodb_sys_foreign_cols.result +++ b/mysql-test/suite/innodb_i_s/innodb_sys_foreign_cols.result @@ -1,8 +1,8 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; Table Create Table INNODB_SYS_FOREIGN_COLS CREATE TEMPORARY TABLE `INNODB_SYS_FOREIGN_COLS` ( - `ID` varchar(193) NOT NULL DEFAULT '', - `FOR_COL_NAME` varchar(64) NOT NULL DEFAULT '', - `REF_COL_NAME` varchar(64) NOT NULL DEFAULT '', - `POS` int(11) unsigned NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `ID` varchar(193) NOT NULL, + `FOR_COL_NAME` varchar(64) NOT NULL, + `REF_COL_NAME` varchar(64) NOT NULL, + `POS` int(11) unsigned NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_indexes.result b/mysql-test/suite/innodb_i_s/innodb_sys_indexes.result index 81d1447e60d8c..f898e1a978e77 100644 --- a/mysql-test/suite/innodb_i_s/innodb_sys_indexes.result +++ b/mysql-test/suite/innodb_i_s/innodb_sys_indexes.result @@ -1,12 +1,12 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_INDEXES; Table Create Table INNODB_SYS_INDEXES CREATE TEMPORARY TABLE `INNODB_SYS_INDEXES` ( - `INDEX_ID` bigint(21) unsigned NOT NULL DEFAULT 0, - `NAME` varchar(64) NOT NULL DEFAULT '', - `TABLE_ID` bigint(21) unsigned NOT NULL DEFAULT 0, - `TYPE` int(11) NOT NULL DEFAULT 0, - `N_FIELDS` int(11) NOT NULL DEFAULT 0, - `PAGE_NO` int(11) NOT NULL DEFAULT 0, - `SPACE` int(11) NOT NULL DEFAULT 0, - `MERGE_THRESHOLD` int(11) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `INDEX_ID` bigint(21) unsigned NOT NULL, + `NAME` varchar(64) NOT NULL, + `TABLE_ID` bigint(21) unsigned NOT NULL, + `TYPE` int(11) NOT NULL, + `N_FIELDS` int(11) NOT NULL, + `PAGE_NO` int(11), + `SPACE` int(11), + `MERGE_THRESHOLD` int(11) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_semaphore_waits.result b/mysql-test/suite/innodb_i_s/innodb_sys_semaphore_waits.result new file mode 100644 index 0000000000000..fef0c953d41ff --- /dev/null +++ b/mysql-test/suite/innodb_i_s/innodb_sys_semaphore_waits.result @@ -0,0 +1,24 @@ +SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_SEMAPHORE_WAITS; +Table Create Table +INNODB_SYS_SEMAPHORE_WAITS CREATE TEMPORARY TABLE `INNODB_SYS_SEMAPHORE_WAITS` ( + `THREAD_ID` bigint(21) unsigned NOT NULL, + `OBJECT_NAME` varchar(4000), + `FILE` varchar(4000), + `LINE` int(11) unsigned NOT NULL, + `WAIT_TIME` bigint(21) unsigned NOT NULL, + `WAIT_OBJECT` bigint(21) unsigned NOT NULL, + `WAIT_TYPE` varchar(16), + `HOLDER_THREAD_ID` bigint(21) unsigned NOT NULL, + `HOLDER_FILE` varchar(4000), + `HOLDER_LINE` int(11) unsigned NOT NULL, + `CREATED_FILE` varchar(4000), + `CREATED_LINE` int(11) unsigned NOT NULL, + `WRITER_THREAD` bigint(21) unsigned NOT NULL, + `RESERVATION_MODE` varchar(16), + `READERS` int(11) unsigned NOT NULL, + `WAITERS_FLAG` bigint(21) unsigned NOT NULL, + `LOCK_WORD` bigint(21) unsigned NOT NULL, + `LAST_WRITER_FILE` varchar(4000), + `LAST_WRITER_LINE` int(11) unsigned NOT NULL, + `OS_WAIT_COUNT` int(11) unsigned NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_tables.result b/mysql-test/suite/innodb_i_s/innodb_sys_tables.result index 49afc1cc4c852..08db6edb43870 100644 --- a/mysql-test/suite/innodb_i_s/innodb_sys_tables.result +++ b/mysql-test/suite/innodb_i_s/innodb_sys_tables.result @@ -1,12 +1,12 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_TABLES; Table Create Table INNODB_SYS_TABLES CREATE TEMPORARY TABLE `INNODB_SYS_TABLES` ( - `TABLE_ID` bigint(21) unsigned NOT NULL DEFAULT 0, - `NAME` varchar(655) NOT NULL DEFAULT '', - `FLAG` int(11) NOT NULL DEFAULT 0, - `N_COLS` int(11) unsigned NOT NULL DEFAULT 0, - `SPACE` int(11) unsigned NOT NULL DEFAULT 0, - `ROW_FORMAT` enum('Redundant','Compact','Compressed','Dynamic') DEFAULT NULL, - `ZIP_PAGE_SIZE` int(11) unsigned NOT NULL DEFAULT 0, - `SPACE_TYPE` enum('Single','System') DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `TABLE_ID` bigint(21) unsigned NOT NULL, + `NAME` varchar(655) NOT NULL, + `FLAG` int(11) NOT NULL, + `N_COLS` int(11) unsigned NOT NULL, + `SPACE` int(11) unsigned NOT NULL, + `ROW_FORMAT` enum('Redundant','Compact','Compressed','Dynamic'), + `ZIP_PAGE_SIZE` int(11) unsigned NOT NULL, + `SPACE_TYPE` enum('Single','System') +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_tablespaces.result b/mysql-test/suite/innodb_i_s/innodb_sys_tablespaces.result index 830ec87130fd3..01e655de47fd4 100644 --- a/mysql-test/suite/innodb_i_s/innodb_sys_tablespaces.result +++ b/mysql-test/suite/innodb_i_s/innodb_sys_tablespaces.result @@ -1,13 +1,13 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES; Table Create Table INNODB_SYS_TABLESPACES CREATE TEMPORARY TABLE `INNODB_SYS_TABLESPACES` ( - `SPACE` int(11) unsigned NOT NULL DEFAULT 0, - `NAME` varchar(655) NOT NULL DEFAULT '', - `FLAG` int(11) unsigned NOT NULL DEFAULT 0, - `ROW_FORMAT` varchar(22) DEFAULT NULL, - `PAGE_SIZE` int(11) unsigned NOT NULL DEFAULT 0, - `FILENAME` varchar(512) NOT NULL DEFAULT '', - `FS_BLOCK_SIZE` int(11) unsigned NOT NULL DEFAULT 0, - `FILE_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0, - `ALLOCATED_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `SPACE` int(11) unsigned NOT NULL, + `NAME` varchar(655) NOT NULL, + `FLAG` int(11) unsigned NOT NULL, + `ROW_FORMAT` varchar(22), + `PAGE_SIZE` int(11) unsigned NOT NULL, + `FILENAME` varchar(512) NOT NULL, + `FS_BLOCK_SIZE` int(11) unsigned NOT NULL, + `FILE_SIZE` bigint(21) unsigned NOT NULL, + `ALLOCATED_SIZE` bigint(21) unsigned NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_tablestats.result b/mysql-test/suite/innodb_i_s/innodb_sys_tablestats.result index eefe5ee83a193..98b43c63c2740 100644 --- a/mysql-test/suite/innodb_i_s/innodb_sys_tablestats.result +++ b/mysql-test/suite/innodb_i_s/innodb_sys_tablestats.result @@ -1,13 +1,13 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS; Table Create Table INNODB_SYS_TABLESTATS CREATE TEMPORARY TABLE `INNODB_SYS_TABLESTATS` ( - `TABLE_ID` bigint(21) unsigned NOT NULL DEFAULT 0, - `NAME` varchar(64) NOT NULL DEFAULT '', - `STATS_INITIALIZED` int(1) NOT NULL DEFAULT 0, - `NUM_ROWS` bigint(21) unsigned NOT NULL DEFAULT 0, - `CLUST_INDEX_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0, - `OTHER_INDEX_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0, - `MODIFIED_COUNTER` bigint(21) unsigned NOT NULL DEFAULT 0, - `AUTOINC` bigint(21) unsigned NOT NULL DEFAULT 0, - `REF_COUNT` int(11) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `TABLE_ID` bigint(21) unsigned NOT NULL, + `NAME` varchar(64) NOT NULL, + `STATS_INITIALIZED` int(1) NOT NULL, + `NUM_ROWS` bigint(21) unsigned NOT NULL, + `CLUST_INDEX_SIZE` bigint(21) unsigned NOT NULL, + `OTHER_INDEX_SIZE` bigint(21) unsigned NOT NULL, + `MODIFIED_COUNTER` bigint(21) unsigned NOT NULL, + `AUTOINC` bigint(21) unsigned NOT NULL, + `REF_COUNT` int(11) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_virtual.result b/mysql-test/suite/innodb_i_s/innodb_sys_virtual.result index 831f29faa95cd..3736c038963fb 100644 --- a/mysql-test/suite/innodb_i_s/innodb_sys_virtual.result +++ b/mysql-test/suite/innodb_i_s/innodb_sys_virtual.result @@ -1,7 +1,7 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_VIRTUAL; Table Create Table INNODB_SYS_VIRTUAL CREATE TEMPORARY TABLE `INNODB_SYS_VIRTUAL` ( - `TABLE_ID` bigint(21) unsigned NOT NULL DEFAULT 0, - `POS` int(11) unsigned NOT NULL DEFAULT 0, - `BASE_POS` int(11) unsigned NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `TABLE_ID` bigint(21) unsigned NOT NULL, + `POS` int(11) unsigned NOT NULL, + `BASE_POS` int(11) unsigned NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_tablespaces_encryption.result b/mysql-test/suite/innodb_i_s/innodb_tablespaces_encryption.result index 31a4805b2754b..013e4e67fb971 100644 --- a/mysql-test/suite/innodb_i_s/innodb_tablespaces_encryption.result +++ b/mysql-test/suite/innodb_i_s/innodb_tablespaces_encryption.result @@ -1,14 +1,14 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION; Table Create Table INNODB_TABLESPACES_ENCRYPTION CREATE TEMPORARY TABLE `INNODB_TABLESPACES_ENCRYPTION` ( - `SPACE` int(11) unsigned NOT NULL DEFAULT 0, - `NAME` varchar(655) DEFAULT NULL, - `ENCRYPTION_SCHEME` int(11) unsigned NOT NULL DEFAULT 0, - `KEYSERVER_REQUESTS` int(11) unsigned NOT NULL DEFAULT 0, - `MIN_KEY_VERSION` int(11) unsigned NOT NULL DEFAULT 0, - `CURRENT_KEY_VERSION` int(11) unsigned NOT NULL DEFAULT 0, - `KEY_ROTATION_PAGE_NUMBER` bigint(21) unsigned DEFAULT NULL, - `KEY_ROTATION_MAX_PAGE_NUMBER` bigint(21) unsigned DEFAULT NULL, - `CURRENT_KEY_ID` int(11) unsigned NOT NULL DEFAULT 0, - `ROTATING_OR_FLUSHING` int(1) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `SPACE` int(11) unsigned NOT NULL, + `NAME` varchar(655), + `ENCRYPTION_SCHEME` int(11) unsigned NOT NULL, + `KEYSERVER_REQUESTS` int(11) unsigned NOT NULL, + `MIN_KEY_VERSION` int(11) unsigned NOT NULL, + `CURRENT_KEY_VERSION` int(11) unsigned NOT NULL, + `KEY_ROTATION_PAGE_NUMBER` bigint(21) unsigned, + `KEY_ROTATION_MAX_PAGE_NUMBER` bigint(21) unsigned, + `CURRENT_KEY_ID` int(11) unsigned NOT NULL, + `ROTATING_OR_FLUSHING` int(1) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/mysql-test/suite/innodb_i_s/innodb_trx.result b/mysql-test/suite/innodb_i_s/innodb_trx.result index d4e10a99ee819..36a08d8a4564b 100644 --- a/mysql-test/suite/innodb_i_s/innodb_trx.result +++ b/mysql-test/suite/innodb_i_s/innodb_trx.result @@ -1,30 +1,48 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_TRX; Table Create Table INNODB_TRX CREATE TEMPORARY TABLE `INNODB_TRX` ( - `trx_id` bigint(21) unsigned NOT NULL DEFAULT 0, - `trx_state` varchar(13) NOT NULL DEFAULT '', - `trx_started` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `trx_requested_lock_id` varchar(81) DEFAULT NULL, - `trx_wait_started` datetime DEFAULT NULL, - `trx_weight` bigint(21) unsigned NOT NULL DEFAULT 0, - `trx_mysql_thread_id` bigint(21) unsigned NOT NULL DEFAULT 0, - `trx_query` varchar(1024) DEFAULT NULL, - `trx_operation_state` varchar(64) DEFAULT NULL, - `trx_tables_in_use` bigint(21) unsigned NOT NULL DEFAULT 0, - `trx_tables_locked` bigint(21) unsigned NOT NULL DEFAULT 0, - `trx_lock_structs` bigint(21) unsigned NOT NULL DEFAULT 0, - `trx_lock_memory_bytes` bigint(21) unsigned NOT NULL DEFAULT 0, - `trx_rows_locked` bigint(21) unsigned NOT NULL DEFAULT 0, - `trx_rows_modified` bigint(21) unsigned NOT NULL DEFAULT 0, - `trx_concurrency_tickets` bigint(21) unsigned NOT NULL DEFAULT 0, + `trx_id` bigint(21) unsigned NOT NULL, + `trx_state` varchar(13) NOT NULL, + `trx_started` datetime NOT NULL, + `trx_requested_lock_id` varchar(81), + `trx_wait_started` datetime, + `trx_weight` bigint(21) unsigned NOT NULL, + `trx_mysql_thread_id` bigint(21) unsigned NOT NULL, + `trx_query` varchar(1024), + `trx_operation_state` varchar(64), + `trx_tables_in_use` bigint(21) unsigned NOT NULL, + `trx_tables_locked` bigint(21) unsigned NOT NULL, + `trx_lock_structs` bigint(21) unsigned NOT NULL, + `trx_lock_memory_bytes` bigint(21) unsigned NOT NULL, + `trx_rows_locked` bigint(21) unsigned NOT NULL, + `trx_rows_modified` bigint(21) unsigned NOT NULL, + `trx_concurrency_tickets` bigint(21) unsigned NOT NULL, `trx_isolation_level` enum('READ UNCOMMITTED','READ COMMITTED','REPEATABLE READ','SERIALIZABLE') NOT NULL, - `trx_unique_checks` int(1) NOT NULL DEFAULT 0, - `trx_foreign_key_checks` int(1) NOT NULL DEFAULT 0, - `trx_last_foreign_key_error` varchar(256) DEFAULT NULL, - `trx_is_read_only` int(1) NOT NULL DEFAULT 0, - `trx_autocommit_non_locking` int(1) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `trx_unique_checks` int(1) NOT NULL, + `trx_foreign_key_checks` int(1) NOT NULL, + `trx_last_foreign_key_error` varchar(256), + `trx_is_read_only` int(1) NOT NULL, + `trx_autocommit_non_locking` int(1) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci CREATE TEMPORARY TABLE t1 LIKE INFORMATION_SCHEMA.INNODB_TRX; DROP TEMPORARY TABLE t1; CREATE TEMPORARY TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX LIMIT 0; DROP TEMPORARY TABLE t1; +# +# Start of 10.5 tests +# +# +# MDEV-26507 Assertion `tmp != ((long long) 0x8000000000000000LL)' failed in TIME_from_longlong_datetime_packed +# +CREATE ALGORITHM=TEMPTABLE VIEW i AS +SELECT a.trx_started +FROM INFORMATION_SCHEMA.innodb_lock_waits w +JOIN INFORMATION_SCHEMA.innodb_trx a +ORDER BY a.trx_wait_started; +SET SESSION sql_mode='ALLOW_INVALID_DATES'; +SELECT * FROM i; +SET SESSION sql_mode=DEFAULT; +DROP VIEW i; +# +# End of 10.5 tests +# diff --git a/mysql-test/suite/innodb_i_s/innodb_trx.test b/mysql-test/suite/innodb_i_s/innodb_trx.test index 90fa3467b50f2..2a66750ed9ffc 100644 --- a/mysql-test/suite/innodb_i_s/innodb_trx.test +++ b/mysql-test/suite/innodb_i_s/innodb_trx.test @@ -7,3 +7,28 @@ DROP TEMPORARY TABLE t1; CREATE TEMPORARY TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX LIMIT 0; DROP TEMPORARY TABLE t1; + + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-26507 Assertion `tmp != ((long long) 0x8000000000000000LL)' failed in TIME_from_longlong_datetime_packed +--echo # + +CREATE ALGORITHM=TEMPTABLE VIEW i AS + SELECT a.trx_started + FROM INFORMATION_SCHEMA.innodb_lock_waits w + JOIN INFORMATION_SCHEMA.innodb_trx a + ORDER BY a.trx_wait_started; +SET SESSION sql_mode='ALLOW_INVALID_DATES'; +--disable_result_log +SELECT * FROM i; +--enable_result_log +SET SESSION sql_mode=DEFAULT; +DROP VIEW i; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/suite/innodb_zip/disabled.def b/mysql-test/suite/innodb_zip/disabled.def deleted file mode 100644 index 8b137891791fe..0000000000000 --- a/mysql-test/suite/innodb_zip/disabled.def +++ /dev/null @@ -1 +0,0 @@ - diff --git a/mysql-test/suite/innodb_zip/include/innodb_create_tab_indx.inc b/mysql-test/suite/innodb_zip/include/innodb_create_tab_indx.inc index 413a026265e29..43f731a40b3e5 100644 --- a/mysql-test/suite/innodb_zip/include/innodb_create_tab_indx.inc +++ b/mysql-test/suite/innodb_zip/include/innodb_create_tab_indx.inc @@ -2,7 +2,7 @@ eval CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=$block_size; diff --git a/mysql-test/suite/innodb_zip/include/innodb_load_data.inc b/mysql-test/suite/innodb_zip/include/innodb_load_data.inc index 1bcb30131ac09..88bd67ee320d7 100644 --- a/mysql-test/suite/innodb_zip/include/innodb_load_data.inc +++ b/mysql-test/suite/innodb_zip/include/innodb_load_data.inc @@ -1,14 +1,14 @@ --echo # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); while ($i) { diff --git a/mysql-test/suite/innodb_zip/r/bug36172.result b/mysql-test/suite/innodb_zip/r/bug36172.result deleted file mode 100644 index 727f100d06497..0000000000000 --- a/mysql-test/suite/innodb_zip/r/bug36172.result +++ /dev/null @@ -1,4 +0,0 @@ -set @file_per_table=@@global.innodb_file_per_table; -SET GLOBAL innodb_file_per_table=on; -SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; -SET GLOBAL innodb_file_per_table=@file_per_table; diff --git a/mysql-test/suite/innodb_zip/r/bug52745.result b/mysql-test/suite/innodb_zip/r/bug52745.result index 20605eb274d06..7fb48b8ff4faa 100644 --- a/mysql-test/suite/innodb_zip/r/bug52745.result +++ b/mysql-test/suite/innodb_zip/r/bug52745.result @@ -1,5 +1,3 @@ -SET GLOBAL innodb_file_per_table=on; -SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; CREATE TABLE bug52745 ( a2 int(10) unsigned DEFAULT NULL, col37 time DEFAULT NULL, @@ -37,29 +35,8 @@ col68 tinyblob, col69 date DEFAULT NULL, col70 tinyint(3) unsigned zerofill DEFAULT NULL, col71 varchar(44) CHARACTER SET utf8 DEFAULT NULL, -col72 datetime DEFAULT NULL, -col73 smallint(5) unsigned zerofill DEFAULT NULL, -col74 longblob, -col75 bit(34) DEFAULT NULL, -col76 float unsigned zerofill DEFAULT NULL, -col77 year(4) DEFAULT NULL, -col78 tinyint(3) unsigned DEFAULT NULL, -col79 set('msfheowh','tbpxbgf','by','wahnrjw','myqfasxz','rsokyumrt') CHARACTER SET latin2 DEFAULT NULL, -col80 datetime DEFAULT NULL, -col81 smallint(6) DEFAULT NULL, -col82 enum('xtaurnqfqz','rifrse','kuzwpbvb','niisabk','zxavro','rbvasv','','uulrfaove','','') DEFAULT NULL, -col83 bigint(20) unsigned zerofill DEFAULT NULL, -col84 float unsigned zerofill DEFAULT NULL, -col85 double DEFAULT NULL, -col86 enum('ylannv','','vlkhycqc','snke','cxifustp','xiaxaswzp','oxl') CHARACTER SET latin1 COLLATE latin1_german2_ci DEFAULT NULL, -col87 varbinary(221) DEFAULT NULL, -col88 double unsigned DEFAULT NULL, -col89 float unsigned zerofill DEFAULT NULL, -col90 tinyblob +col72 datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; -Warnings: -Note 1291 Column 'col82' has duplicated value '' in ENUM -Note 1291 Column 'col82' has duplicated value '' in ENUM SET sql_mode = default; INSERT IGNORE INTO bug52745 SET col40='0000-00-00 00:00:00', @@ -81,21 +58,7 @@ col66='19600719080256', col68=repeat('Sagittarius\'',54), col69='38943902', col70=1232, -col71='Elora\'', -col74=repeat('zipp',11), -col75='0', -col76=23254, -col78=13247, -col79='56219', -col80='20500609035724', -col81=11632, -col82=7, -col84=-23863, -col85=6341, -col87='HZdkf.4 s7t,5Rmq 8so fmr,ruGLUG25TrtI.yQ 2SuHq0ML7rw7.4 b2yf2E5TJxOtBBZImezDnzpj,uPYfznnEUDN1e9aQoO 2DsplB7TFWy oQJ br HLF :F,eQ p4i1oWsr lL3PG,hjCz6hYqN h1QTjLCjrv:QCdSzpYBibJAtZCxLOk3l6Blsh.W', -col88=16894, -col89=6161, -col90=repeat('gale',48); +col71='Elora\''; Warnings: Warning 1265 Data truncated for column 'col53' at row 1 Warning 1264 Out of range value for column 'col54' at row 1 @@ -107,9 +70,6 @@ Warning 1264 Out of range value for column 'col66' at row 1 Warning 1265 Data truncated for column 'col68' at row 1 Warning 1265 Data truncated for column 'col69' at row 1 Warning 1264 Out of range value for column 'col70' at row 1 -Warning 1264 Out of range value for column 'col78' at row 1 -Warning 1265 Data truncated for column 'col79' at row 1 -Warning 1264 Out of range value for column 'col84' at row 1 SHOW WARNINGS; Level Code Message Warning 1265 Data truncated for column 'col53' at row 1 @@ -122,8 +82,4 @@ Warning 1264 Out of range value for column 'col66' at row 1 Warning 1265 Data truncated for column 'col68' at row 1 Warning 1265 Data truncated for column 'col69' at row 1 Warning 1264 Out of range value for column 'col70' at row 1 -Warning 1264 Out of range value for column 'col78' at row 1 -Warning 1265 Data truncated for column 'col79' at row 1 -Warning 1264 Out of range value for column 'col84' at row 1 DROP TABLE bug52745; -SET GLOBAL innodb_file_per_table=1; diff --git a/mysql-test/suite/innodb_zip/r/create_options.result b/mysql-test/suite/innodb_zip/r/create_options.result index b217388b6dc1d..a678d7a85f329 100644 --- a/mysql-test/suite/innodb_zip/r/create_options.result +++ b/mysql-test/suite/innodb_zip/r/create_options.result @@ -203,14 +203,14 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=2 ALTER TABLE t1 ADD COLUMN f1 INT; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=2 ALTER TABLE t1 ROW_FORMAT=COMPACT; ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE' SHOW WARNINGS; @@ -268,7 +268,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0; SHOW WARNINGS; Level Code Message @@ -605,7 +605,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=1 ALTER TABLE t1 ADD COLUMN f1 INT; SHOW WARNINGS; Level Code Message @@ -614,7 +614,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=1 ALTER TABLE t1 ROW_FORMAT=COMPACT; Warnings: Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. diff --git a/mysql-test/suite/innodb_zip/r/index_large_prefix.result b/mysql-test/suite/innodb_zip/r/index_large_prefix.result index 986453851eb38..ce3023277136e 100644 --- a/mysql-test/suite/innodb_zip/r/index_large_prefix.result +++ b/mysql-test/suite/innodb_zip/r/index_large_prefix.result @@ -105,7 +105,7 @@ ERROR 42000: Row size too large. The maximum row size for the used table type, n show warnings; Level Code Message Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -create index idx4 on worklog5743_1(a2(434)); +create index idx4 on worklog5743_1(a2(290)); show warnings; Level Code Message create index idx5 on worklog5743_1(a1, a2(430)); @@ -113,7 +113,7 @@ ERROR 42000: Row size too large. The maximum row size for the used table type, n show warnings; Level Code Message Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -create index idx6 on worklog5743_1(a1, a2(428)); +create index idx6 on worklog5743_1(a1, a2(283)); show warnings; Level Code Message create index idx2 on worklog5743_2(a2(4000)); @@ -127,7 +127,7 @@ ERROR 42000: Row size too large. The maximum row size for the used table type, n show warnings; Level Code Message Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -create index idx4 on worklog5743_2(a2(946)); +create index idx4 on worklog5743_2(a2(802)); show warnings; Level Code Message create index idx5 on worklog5743_2(a1, a2(942)); @@ -135,7 +135,7 @@ ERROR 42000: Row size too large. The maximum row size for the used table type, n show warnings; Level Code Message Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -create index idx6 on worklog5743_2(a1, a2(940)); +create index idx6 on worklog5743_2(a1, a2(795)); show warnings; Level Code Message create index idx2 on worklog5743_4(a2(4000)); @@ -149,7 +149,7 @@ ERROR 42000: Row size too large. The maximum row size for the used table type, n show warnings; Level Code Message Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -create index idx4 on worklog5743_4(a2(1970)); +create index idx4 on worklog5743_4(a2(1826)); show warnings; Level Code Message create index idx5 on worklog5743_4(a1, a2(1966)); @@ -157,7 +157,7 @@ ERROR 42000: Row size too large. The maximum row size for the used table type, n show warnings; Level Code Message Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -create index idx6 on worklog5743_4(a1, a2(1964)); +create index idx6 on worklog5743_4(a1, a2(1819)); show warnings; Level Code Message create index idx2 on worklog5743_8(a2(3073)); @@ -360,7 +360,7 @@ worklog5743 CREATE TABLE `worklog5743` ( KEY `idx2` (`a3`(3072)), KEY `idx3` (`a4`), KEY `idx6` (`a1`,`a6`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC insert into worklog5743 values(9, repeat("a", 20000), repeat("a", 3073), repeat("a", 3072), repeat("a", 3069), @@ -436,7 +436,7 @@ worklog5743 CREATE TABLE `worklog5743` ( `a` text NOT NULL, KEY `idx1` (`a`(3072)), KEY `idx2` (`a`(3072)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC drop table worklog5743; SET sql_mode= default; create table worklog5743(a TEXT not null) ROW_FORMAT=REDUNDANT; diff --git a/mysql-test/suite/innodb_zip/r/innochecksum.result b/mysql-test/suite/innodb_zip/r/innochecksum.result index e6525af4b5235..bb94de7a36960 100644 --- a/mysql-test/suite/innodb_zip/r/innochecksum.result +++ b/mysql-test/suite/innodb_zip/r/innochecksum.result @@ -14,7 +14,8 @@ FOUND 1 /Error: --no-check must be associated with --write option./ in my_restar FOUND 1 /unknown variable 'strict-check=innodb'/ in my_restart.err [7]: check the innochecksum with short form strict-check & no-check , an error is expected FOUND 1 /unknown option '-C'/ in my_restart.err -FOUND 1 /unknown variable 'write=crc32'/ in my_restart.err +FOUND 1 /ignoring option '--write' due to invalid value 'crc32'/ in my_restart.err +FOUND 1 /Error: --no-check must be associated with --write option/ in my_restart.err # restart SELECT * FROM tab1; c1 c2 diff --git a/mysql-test/suite/innodb_zip/r/innochecksum_2.result b/mysql-test/suite/innodb_zip/r/innochecksum_2.result index 7be6f6f9af357..681d8e1f4c7bb 100644 --- a/mysql-test/suite/innodb_zip/r/innochecksum_2.result +++ b/mysql-test/suite/innodb_zip/r/innochecksum_2.result @@ -27,6 +27,7 @@ end-page 0 page 0 no-check FALSE allow-mismatches 0 +write FALSE page-type-summary FALSE page-type-dump MYSQLTEST_VARDIR/tmp/dump.txt per-page-details FALSE @@ -54,6 +55,7 @@ See https://mariadb.com/kb/en/library/innochecksum/ for usage hints. -n, --no-check Ignore the checksum verification. -a, --allow-mismatches=# Maximum checksum mismatch allowed. + -w, --write Rewrite the checksum. -S, --page-type-summary Display a count of each page type in a tablespace. -D, --page-type-dump=name @@ -75,6 +77,7 @@ end-page 0 page 0 no-check FALSE allow-mismatches 0 +write FALSE page-type-summary FALSE page-type-dump (No default value) per-page-details FALSE diff --git a/mysql-test/suite/innodb_zip/r/innochecksum_3.result b/mysql-test/suite/innodb_zip/r/innochecksum_3.result index 280528f4200da..03a31194c6334 100644 --- a/mysql-test/suite/innodb_zip/r/innochecksum_3.result +++ b/mysql-test/suite/innodb_zip/r/innochecksum_3.result @@ -133,6 +133,7 @@ end-page 0 page 0 no-check FALSE allow-mismatches 0 +write FALSE page-type-summary FALSE page-type-dump MYSQLTEST_VARDIR/tmp/dump.txt per-page-details FALSE diff --git a/mysql-test/suite/innodb_zip/r/page_size,4k.rdiff b/mysql-test/suite/innodb_zip/r/page_size,4k.rdiff index 6848c66b5f6ef..494da214f2e65 100644 --- a/mysql-test/suite/innodb_zip/r/page_size,4k.rdiff +++ b/mysql-test/suite/innodb_zip/r/page_size,4k.rdiff @@ -1,5 +1,3 @@ ---- page_size.result -+++ page_size,4k.reject @@ -3,7 +3,7 @@ SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size'; @@ -85,8 +83,8 @@ -c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200), -c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200), -c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200), --c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(157) -+c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(76) +-c36 char(200), c37 char(200), c38 char(196) ++c06 char(200), c07 char(200), c08 char(176) ) ROW_FORMAT=compressed; DROP TABLE t1; CREATE TABLE t1 ( @@ -339,7 +337,7 @@ - `d` text NOT NULL, - PRIMARY KEY (`a`,`b`(255),`c`(255)), - KEY `b` (`b`(767)) --) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 +-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci STATS_PERSISTENT=0 -CHECK TABLE t1; -Table Op Msg_type Msg_text -test.t1 check status OK @@ -431,7 +429,7 @@ - KEY `t1st` (`s`(767),`t`(767)) + KEY `t1ut` (`u`(767)), + KEY `t1st` (`s`(767)) - ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC + ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC DROP TABLE t1; # Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZE @@ -569,27 +389,25 @@ @@ -465,5 +463,5 @@ -Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. +Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. DROP TABLE t1; - CREATE TABLE t1(c text, PRIMARY KEY (c(438))) + CREATE TABLE t1(c text, PRIMARY KEY (c(293))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; diff --git a/mysql-test/suite/innodb_zip/r/page_size,8k.rdiff b/mysql-test/suite/innodb_zip/r/page_size,8k.rdiff index f71d5f9b37e06..a22fa9e9b9580 100644 --- a/mysql-test/suite/innodb_zip/r/page_size,8k.rdiff +++ b/mysql-test/suite/innodb_zip/r/page_size,8k.rdiff @@ -1,5 +1,3 @@ ---- page_size.result -+++ page_size,8k.reject @@ -3,7 +3,7 @@ SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size'; @@ -83,8 +81,8 @@ -c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200), -c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200), -c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200), --c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(157) -+c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(103) +-c36 char(200), c37 char(200), c38 char(196) ++c16 char(200), c17 char(200), c18 char(182) ) ROW_FORMAT=compressed; DROP TABLE t1; CREATE TABLE t1 ( @@ -309,7 +307,7 @@ - `d` text NOT NULL, - PRIMARY KEY (`a`,`b`(255),`c`(255)), - KEY `b` (`b`(767)) --) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 +-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci STATS_PERSISTENT=0 -CHECK TABLE t1; -Table Op Msg_type Msg_text -test.t1 check status OK @@ -411,5 +409,5 @@ -Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. +Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. DROP TABLE t1; - CREATE TABLE t1(c text, PRIMARY KEY (c(438))) + CREATE TABLE t1(c text, PRIMARY KEY (c(293))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; diff --git a/mysql-test/suite/innodb_zip/r/page_size.result b/mysql-test/suite/innodb_zip/r/page_size.result index 8925fe3a8edf3..48b954c945b63 100644 --- a/mysql-test/suite/innodb_zip/r/page_size.result +++ b/mysql-test/suite/innodb_zip/r/page_size.result @@ -44,6 +44,7 @@ test/t1 DEFAULT DEFAULT MYSQLD_DATADIR/test/t1.ibd test/t2 DEFAULT DEFAULT MYSQLD_DATADIR/test/t2.ibd test/t3 DEFAULT 8192 MYSQLD_DATADIR/test/t3.ibd test/t4 DEFAULT DEFAULT MYSQLD_DATADIR/test/t4.ibd +innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1 DROP TABLE t1, t2, t3, t4; # Test 4) The maximum row size is dependent upon the page size. # Each row format has its own amount of overhead that @@ -101,7 +102,7 @@ c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200), c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200), c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200), c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200), -c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(157) +c36 char(200), c37 char(200), c38 char(196) ) ROW_FORMAT=compressed; DROP TABLE t1; CREATE TABLE t1 ( @@ -367,7 +368,7 @@ t1 CREATE TABLE `t1` ( `d` text NOT NULL, PRIMARY KEY (`a`,`b`(255),`c`(255)), KEY `b` (`b`(767)) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci STATS_PERSISTENT=0 CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -485,7 +486,7 @@ t1 CREATE TABLE `t1` ( KEY `t1u` (`u`(767)), KEY `t1ut` (`u`(767),`t`(767)), KEY `t1st` (`s`(767),`t`(767)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC DROP TABLE t1; # Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZE CREATE TABLE bug12547647( @@ -591,7 +592,41 @@ ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; Warnings: Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. DROP TABLE t1; -CREATE TABLE t1(c text, PRIMARY KEY (c(438))) +CREATE TABLE t1(c text, PRIMARY KEY (c(293))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512)); DROP TABLE t1; +# +# MDEV-28950 Assertion `*err == DB_SUCCESS' in btr_page_split_and_insert +# +CREATE TABLE t1(c CHAR(255) NOT NULL) ENGINE=InnoDB; +INSERT INTO t1 VALUES (''); +ALTER TABLE t1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +INSERT INTO t1 VALUES (''),(''),(''); +SET @save_innodb_compression_level= @@innodb_compression_level; +SET GLOBAL innodb_compression_level=0; +INSERT INTO t1 VALUES (''); +SET GLOBAL innodb_compression_level= @save_innodb_compression_level; +DROP TABLE t1; +# +# MDEV-31158 Assertion ...MTR_MEMO_X_LOCKED in btr_attach_half_pages() +# +SET @save_compression_level=@@GLOBAL.innodb_compression_level; +SET GLOBAL innodb_compression_level=0; +CREATE TEMPORARY TABLE t(a SERIAL, prefix VARBINARY(4), pad INT); +INSERT INTO t(prefix, pad) VALUES +(_binary 0xff,160),('',19),(_binary 0x0001,253),(_binary 0x0b11,169), +(_binary 0x0b010001,23),(_binary 0x0b100001,251),(_binary 0x0d,163), +(_binary 0xb3,254),(_binary 0x96,254),(_binary 0xeb,61), +(_binary 0xf231,253),(_binary 0x1db0,253),(_binary 0x0005,101), +(_binary 0x6370,253),(_binary 0x0b12,112),(_binary 0x0b010002,23), +(_binary 0x0b100002,80),(_binary 0x181984,163),(_binary 0x181926,168), +(_binary 0xe1,176),(_binary 0xe2,187),(_binary 0xe6,254),(_binary 0xbb,51), +(_binary 0x1c,248),(_binary 0x8a,94),(_binary 0x14,254); +CREATE TABLE u(a SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, +b VARBINARY(255), KEY(b)) ENGINE=InnoDB +KEY_BLOCK_SIZE=1 ROW_FORMAT=COMPRESSED; +INSERT INTO u SELECT a,CONCAT(prefix,REPEAT(chr(0),pad)) FROM t; +DROP TABLE u, t; +SET GLOBAL innodb_compression_level=@save_compression_level; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result b/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result index ee1121f9e208a..43a63a29e71f3 100644 --- a/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result +++ b/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result @@ -324,7 +324,7 @@ col_1_binary = REPEAT("c", 255) DROP TABLE worklog5743; CREATE TABLE worklog5743_key2 ( col_1_varchar VARCHAR (4000) , col_2_varchar VARCHAR (4000) , -PRIMARY KEY (col_1_varchar(948)) +PRIMARY KEY (col_1_varchar(801)) ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2, engine = innodb; INSERT INTO worklog5743_key2 VALUES(REPEAT("a", 4000) , REPEAT("o", 4000)); INSERT INTO worklog5743_key2 VALUES(REPEAT("b", 4000) , REPEAT("p", 4000)); @@ -348,7 +348,7 @@ col_1_varchar = REPEAT("c", 4000) DROP TABLE worklog5743_key2; CREATE TABLE worklog5743_key4 ( col_1_varchar VARCHAR (4000) , col_2_varchar VARCHAR (4000) , -PRIMARY KEY (col_1_varchar(1964)) +PRIMARY KEY (col_1_varchar(1825)) ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4, engine = innodb; INSERT INTO worklog5743_key4 VALUES(REPEAT("a", 4000) , REPEAT("o", 4000)); INSERT INTO worklog5743_key4 VALUES(REPEAT("b", 4000) , REPEAT("p", 4000)); @@ -397,7 +397,7 @@ col_1_varchar = REPEAT("c", 4000) DROP TABLE worklog5743_key8; CREATE TABLE worklog5743_key2 ( col_1_text TEXT (4000) , col_2_text TEXT (4000) , -PRIMARY KEY (col_1_text(948)) +PRIMARY KEY (col_1_text(801)) ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2, engine = innodb; INSERT INTO worklog5743_key2 VALUES(REPEAT("a", 4000) , REPEAT("o", 4000)); INSERT INTO worklog5743_key2 VALUES(REPEAT("b", 4000) , REPEAT("p", 4000)); @@ -421,7 +421,7 @@ col_1_text = REPEAT("c", 4000) DROP TABLE worklog5743_key2; CREATE TABLE worklog5743_key4 ( col_1_text TEXT (4000) , col_2_text TEXT (4000) , -PRIMARY KEY (col_1_text(1964)) +PRIMARY KEY (col_1_text(1825)) ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4, engine = innodb; INSERT INTO worklog5743_key4 VALUES(REPEAT("a", 4000) , REPEAT("o", 4000)); INSERT INTO worklog5743_key4 VALUES(REPEAT("b", 4000) , REPEAT("p", 4000)); @@ -469,7 +469,7 @@ col_1_text = REPEAT("c", 4000) DROP TABLE worklog5743_key8; CREATE TABLE worklog5743_key2 ( col_1_blob BLOB (4000) , col_2_blob BLOB (4000) , -PRIMARY KEY (col_1_blob(948)) +PRIMARY KEY (col_1_blob(801)) ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2, engine = innodb; INSERT INTO worklog5743_key2 VALUES(REPEAT("a", 4000) , REPEAT("o", 4000)); INSERT INTO worklog5743_key2 VALUES(REPEAT("b", 4000) , REPEAT("p", 4000)); @@ -493,7 +493,7 @@ col_1_blob = REPEAT("c", 4000) DROP TABLE worklog5743_key2; CREATE TABLE worklog5743_key4 ( col_1_blob BLOB (4000) , col_2_blob BLOB (4000) , -PRIMARY KEY (col_1_blob(1964)) +PRIMARY KEY (col_1_blob(1825)) ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4, engine = innodb; INSERT INTO worklog5743_key4 VALUES(REPEAT("a", 4000) , REPEAT("o", 4000)); INSERT INTO worklog5743_key4 VALUES(REPEAT("b", 4000) , REPEAT("p", 4000)); @@ -1290,7 +1290,7 @@ worklog5743 CREATE TABLE `worklog5743` ( `col_2_text` text DEFAULT NULL, PRIMARY KEY (`col_1_text`(500)), KEY `prefix_idx` (`col_1_text`(3072)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC INSERT INTO worklog5743 VALUES(REPEAT("a", 4000),REPEAT("o", 4000)); SELECT col_1_text = REPEAT("a", 4000) FROM worklog5743; col_1_text = REPEAT("a", 4000) @@ -1305,7 +1305,7 @@ col_1_text = REPEAT("c", 4000) DROP TABLE worklog5743; CREATE TABLE worklog5743 ( col_1_text TEXT (4000) , col_2_text TEXT (4000) , -PRIMARY KEY (col_1_text(948)) +PRIMARY KEY (col_1_text(801)) ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2, engine = innodb; INSERT INTO worklog5743 VALUES(REPEAT("a", 4000) , REPEAT("o", 4000)); INSERT INTO worklog5743 VALUES(REPEAT("b", 4000) , REPEAT("p", 4000)); @@ -1416,5 +1416,5 @@ worklog5743 CREATE TABLE `worklog5743` ( `col_2_varchar` varchar(4000) DEFAULT NULL, PRIMARY KEY (`col_1_varchar`(767)), KEY `prefix_idx` (`col_1_varchar`(1000)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE worklog5743; diff --git a/mysql-test/suite/innodb_zip/r/restart.result b/mysql-test/suite/innodb_zip/r/restart.result index b0cc44c73b568..eb1bfe67c5d47 100644 --- a/mysql-test/suite/innodb_zip/r/restart.result +++ b/mysql-test/suite/innodb_zip/r/restart.result @@ -23,7 +23,7 @@ t1_restart CREATE TABLE `t1_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT SELECT count(*) FROM t1_restart; count(*) 16 @@ -46,7 +46,7 @@ t2_restart CREATE TABLE `t2_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT SELECT count(*) FROM t2_restart; count(*) 16 @@ -69,7 +69,7 @@ t3_restart CREATE TABLE `t3_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 +) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 SELECT count(*) FROM t3_restart; count(*) 16 @@ -92,7 +92,7 @@ t4_restart CREATE TABLE `t4_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC SELECT count(*) FROM t4_restart; count(*) 16 @@ -115,7 +115,7 @@ t5_restart CREATE TABLE `t5_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SELECT count(*) FROM t5_restart; count(*) 16 @@ -144,7 +144,7 @@ t6_restart CREATE TABLE `t6_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 PARTITION BY HASH (`c1`) (PARTITION `p0` DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, PARTITION `p1` DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, @@ -180,7 +180,7 @@ t7_restart CREATE TABLE `t7_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC PARTITION BY RANGE (`c1`) SUBPARTITION BY HASH (`c1`) (PARTITION `p0` VALUES LESS THAN (10) @@ -223,6 +223,7 @@ test/t7_restart#p#p0#sp#s0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart test/t7_restart#p#p0#sp#s1 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd test/t7_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd test/t7_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd +innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1 # # Shutdown the server and list the tablespace OS files # @@ -276,7 +277,7 @@ t1_restart CREATE TABLE `t1_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT SHOW CREATE TABLE t2_restart; Table Create Table t2_restart CREATE TABLE `t2_restart` ( @@ -286,7 +287,7 @@ t2_restart CREATE TABLE `t2_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT SHOW CREATE TABLE t3_restart; Table Create Table t3_restart CREATE TABLE `t3_restart` ( @@ -296,7 +297,7 @@ t3_restart CREATE TABLE `t3_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 +) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 SHOW CREATE TABLE t4_restart; Table Create Table t4_restart CREATE TABLE `t4_restart` ( @@ -306,7 +307,7 @@ t4_restart CREATE TABLE `t4_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC SHOW CREATE TABLE t5_restart; Table Create Table t5_restart CREATE TABLE `t5_restart` ( @@ -316,7 +317,7 @@ t5_restart CREATE TABLE `t5_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SHOW CREATE TABLE t6_restart; Table Create Table t6_restart CREATE TABLE `t6_restart` ( @@ -326,7 +327,7 @@ t6_restart CREATE TABLE `t6_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 PARTITION BY HASH (`c1`) (PARTITION `p0` DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, PARTITION `p1` DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, @@ -340,7 +341,7 @@ t7_restart CREATE TABLE `t7_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC PARTITION BY RANGE (`c1`) SUBPARTITION BY HASH (`c1`) (PARTITION `p0` VALUES LESS THAN (10) @@ -408,6 +409,7 @@ test/t7_restart#p#p0#sp#s0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart test/t7_restart#p#p0#sp#s1 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd test/t7_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd test/t7_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd +innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1 DROP TABLE t1_restart; DROP TABLE t2_restart; DROP TABLE t3_restart; @@ -428,6 +430,7 @@ test/t5_restart DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd test/t6_restart#p#p2 DEFAULT 2048 MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd test/t7_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd test/t7_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd +innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1 INSERT INTO t5_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart); INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart); @@ -444,7 +447,7 @@ t5_restart CREATE TABLE `t5_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000012 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB AUTO_INCREMENT=1000000012 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SELECT count(*) FROM t6_restart; count(*) 21 @@ -457,7 +460,7 @@ t6_restart CREATE TABLE `t6_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 +) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 PARTITION BY HASH (`c1`) (PARTITION `p0` DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, PARTITION `p1` DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, @@ -474,7 +477,7 @@ t7_restart CREATE TABLE `t7_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC PARTITION BY RANGE (`c1`) SUBPARTITION BY HASH (`c1`) (PARTITION `p0` VALUES LESS THAN (10) @@ -533,6 +536,7 @@ test/t5_restart DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd test/t6_restart#p#p2 DEFAULT 2048 MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd test/t7_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd test/t7_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd +innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1 SELECT count(*) FROM t5_restart; count(*) 8 @@ -545,7 +549,7 @@ t5_restart CREATE TABLE `t5_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000009 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB AUTO_INCREMENT=1000000009 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SELECT count(*) FROM t6_restart; count(*) 21 @@ -558,7 +562,7 @@ t6_restart CREATE TABLE `t6_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 +) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 PARTITION BY HASH (`c1`) (PARTITION `p0` DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, PARTITION `p1` DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, @@ -575,7 +579,7 @@ t7_restart CREATE TABLE `t7_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC PARTITION BY RANGE (`c1`) SUBPARTITION BY HASH (`c1`) (PARTITION `p0` VALUES LESS THAN (10) @@ -634,6 +638,7 @@ test/t55_restart DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd test/t66_restart#p#p2 DEFAULT 2048 MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd test/t77_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd test/t77_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd +innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1 INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); SELECT count(*) FROM t55_restart; count(*) @@ -647,7 +652,7 @@ t55_restart CREATE TABLE `t55_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000024 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB AUTO_INCREMENT=1000000024 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart); SELECT count(*) FROM t66_restart; count(*) @@ -661,7 +666,7 @@ t66_restart CREATE TABLE `t66_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 +) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 PARTITION BY HASH (`c1`) (PARTITION `p0` DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, PARTITION `p1` DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, @@ -679,7 +684,7 @@ t77_restart CREATE TABLE `t77_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC PARTITION BY RANGE (`c1`) SUBPARTITION BY HASH (`c1`) (PARTITION `p0` VALUES LESS THAN (10) @@ -732,6 +737,7 @@ test/t55_restart DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd test/t66_restart#p#p2 DEFAULT 2048 MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd test/t77_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd test/t77_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd +innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1 INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); SELECT count(*) FROM t55_restart; count(*) @@ -745,7 +751,7 @@ t55_restart CREATE TABLE `t55_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000048 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +) ENGINE=InnoDB AUTO_INCREMENT=1000000048 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart); SELECT count(*) FROM t66_restart; count(*) @@ -759,7 +765,7 @@ t66_restart CREATE TABLE `t66_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 +) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 PARTITION BY HASH (`c1`) (PARTITION `p0` DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, PARTITION `p1` DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB, @@ -777,7 +783,7 @@ t77_restart CREATE TABLE `t77_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC PARTITION BY RANGE (`c1`) SUBPARTITION BY HASH (`c1`) (PARTITION `p0` VALUES LESS THAN (10) @@ -866,6 +872,7 @@ test/t55_restart DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd test/t66_restart#p#p2 DEFAULT 2048 MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p2.ibd test/t77_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s2.ibd test/t77_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s3.ibd +innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1 INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); SELECT count(*) FROM t4_restart; count(*) @@ -879,7 +886,7 @@ t4_restart CREATE TABLE `t4_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000099 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/new_dir/' +) ENGINE=InnoDB AUTO_INCREMENT=1000000099 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/new_dir/' INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); SELECT count(*) FROM t55_restart; count(*) @@ -893,7 +900,7 @@ t55_restart CREATE TABLE `t55_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000096 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/new_dir/' +) ENGINE=InnoDB AUTO_INCREMENT=1000000096 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/new_dir/' INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart); SELECT count(*) FROM t66_restart; count(*) @@ -907,7 +914,7 @@ t66_restart CREATE TABLE `t66_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=179 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 +) ENGINE=InnoDB AUTO_INCREMENT=179 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 PARTITION BY HASH (`c1`) (PARTITION `p0` DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB, PARTITION `p1` DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB, @@ -925,7 +932,7 @@ t77_restart CREATE TABLE `t77_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=73 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=73 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC PARTITION BY RANGE (`c1`) SUBPARTITION BY HASH (`c1`) (PARTITION `p0` VALUES LESS THAN (10) @@ -1004,6 +1011,7 @@ test/t55_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t55_restart.ibd test/t66_restart#p#p2 DEFAULT 2048 MYSQLD_DATADIR/test/t66_restart#p#p2.ibd test/t77_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s2.ibd test/t77_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s3.ibd +innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1 INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); SELECT count(*) FROM t4_restart; count(*) @@ -1017,7 +1025,7 @@ t4_restart CREATE TABLE `t4_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000195 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=1000000195 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); SELECT count(*) FROM t55_restart; count(*) @@ -1031,7 +1039,7 @@ t55_restart CREATE TABLE `t55_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=1000000192 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=1000000192 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart); SELECT count(*) FROM t66_restart; count(*) @@ -1045,7 +1053,7 @@ t66_restart CREATE TABLE `t66_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=347 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 +) ENGINE=InnoDB AUTO_INCREMENT=347 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 PARTITION BY HASH (`c1`) (PARTITION `p0` ENGINE = InnoDB, PARTITION `p1` ENGINE = InnoDB, @@ -1063,7 +1071,7 @@ t77_restart CREATE TABLE `t77_restart` ( `c4` date DEFAULT NULL, `c5` text DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=145 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=145 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC PARTITION BY RANGE (`c1`) SUBPARTITION BY HASH (`c1`) (PARTITION `p0` VALUES LESS THAN (10) diff --git a/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result index 86e56b4904bd2..62a28a981cdb3 100644 --- a/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result +++ b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result @@ -9,6 +9,8 @@ call mtr.add_suppression("InnoDB: Error number \\d+ means"); call mtr.add_suppression("InnoDB: Cannot open datafile .*t1\\.ibd"); call mtr.add_suppression("InnoDB: Ignoring tablespace for test/t1 "); call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` because the \\.ibd file is missing"); +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*ibdata1' page"); +call mtr.add_suppression("InnoDB: File '.*ibdata1' is corrupted"); FLUSH TABLES; SET SESSION innodb_strict_mode=1; CREATE TABLE t1 (c1 INT) ENGINE = Innodb @@ -84,7 +86,7 @@ ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure"; ALTER TABLE t1 IMPORT TABLESPACE; -ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Too many concurrent transactions +ERROR HY000: Internal error: Error importing tablespace for table `test`.`t1` : Too many concurrent transactions restore: t1 .ibd and .cfg files SET SESSION debug_dbug=@saved_debug_dbug; SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; @@ -160,7 +162,7 @@ t1 CREATE TABLE `t1` ( KEY `idx1` (`c2`), KEY `idx2` (`c3`(512)), KEY `idx3` (`c4`(512)) -) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; @@ -295,7 +297,7 @@ t1 CREATE TABLE `t1` ( KEY `idx1` (`c2`), KEY `idx2` (`c3`(512)), KEY `idx3` (`c4`(512)) -) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED DROP TABLE t1; CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; @@ -314,7 +316,7 @@ ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1"; ALTER TABLE t1 IMPORT TABLESPACE; -ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Data structure corruption +ERROR HY000: Internal error: Error importing tablespace for table `test`.`t1` : Data structure corruption SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t1; unlink: t1.ibd @@ -325,10 +327,8 @@ ALTER TABLE t1 DISCARD TABLESPACE; SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files -SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure"; ALTER TABLE t1 IMPORT TABLESPACE; -ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Data structure corruption -SET SESSION debug_dbug=@saved_debug_dbug; +Got one of the listed errors DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg @@ -365,6 +365,8 @@ SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` SET SESSION debug_dbug="+d,ib_import_create_index_failure_1"; ALTER TABLE t1 ADD INDEX idx(c1); +Warnings: +Warning 1814 Tablespace has been discarded for table `t1` SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t1; unlink: t1.ibd diff --git a/mysql-test/suite/innodb_zip/r/wl5522_zip.result b/mysql-test/suite/innodb_zip/r/wl5522_zip.result index 4d6d23a3bff07..1b044d68680fd 100644 --- a/mysql-test/suite/innodb_zip/r/wl5522_zip.result +++ b/mysql-test/suite/innodb_zip/r/wl5522_zip.result @@ -232,13 +232,13 @@ restore: t1 .ibd and .cfg files ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Schema mismatch (Index x not found in tablespace meta-data file.) ALTER TABLE t1 DROP INDEX x; +Warnings: +Warning 1814 Tablespace has been discarded for table `t1` ALTER TABLE t1 ADD INDEX idx(c2); Warnings: Warning 1814 Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files ALTER TABLE t1 IMPORT TABLESPACE; -Warnings: -Warning 1814 Tablespace has been discarded for table `t1` CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -273,7 +273,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FLUSH TABLES t1 FOR EXPORT; Warnings: Warning 1809 Table `test`.`t1` in system tablespace @@ -292,7 +292,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; @@ -320,7 +320,7 @@ SELECT * FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files ALTER TABLE t1 IMPORT TABLESPACE; -ERROR HY000: Schema mismatch (Number of columns don't match, table has 6 columns but the tablespace meta-data file has 5 columns) +ERROR HY000: Schema mismatch (Column c3 not found in tablespace.) unlink: t1.ibd unlink: t1.cfg DROP TABLE t1; @@ -370,7 +370,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED SELECT * FROM t1; c1 c2 1 1 diff --git a/mysql-test/suite/innodb_zip/r/wl6344_compress_level.result b/mysql-test/suite/innodb_zip/r/wl6344_compress_level.result index 3798d0679db36..6fa87e648d781 100644 --- a/mysql-test/suite/innodb_zip/r/wl6344_compress_level.result +++ b/mysql-test/suite/innodb_zip/r/wl6344_compress_level.result @@ -4,7 +4,7 @@ SET @save_innodb_compression_level = @@global.innodb_compression_level; SET global innodb_compression_level=0; #create table with 1K block size CREATE TABLE tab5 (col_1 CHAR (255) , -col_2 VARCHAR (255), col_3 longtext, +col_2 VARCHAR (121), col_3 longtext, col_4 longtext,col_5 longtext, col_6 longtext , col_7 longtext , col_8 longtext ,col_9 longtext , @@ -55,7 +55,7 @@ COMMIT; SET global innodb_compression_level=9; #create table with 1K block size CREATE TABLE tab6 (col_1 CHAR (255) , -col_2 VARCHAR (255), col_3 longtext, +col_2 VARCHAR (121), col_3 longtext, col_4 longtext,col_5 longtext, col_6 longtext , col_7 longtext , col_8 longtext ,col_9 longtext , diff --git a/mysql-test/suite/innodb_zip/r/wl6347_comp_indx_stat.result b/mysql-test/suite/innodb_zip/r/wl6347_comp_indx_stat.result index 3b98527250b02..05b4793eb4d87 100644 --- a/mysql-test/suite/innodb_zip/r/wl6347_comp_indx_stat.result +++ b/mysql-test/suite/innodb_zip/r/wl6347_comp_indx_stat.result @@ -19,7 +19,7 @@ SET GLOBAL innodb_compression_level=0; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -47,15 +47,15 @@ The size of the tab5.ibd file: 65536 # for deterministic reasons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -278,9 +278,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -303,9 +300,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -334,9 +328,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table # testcase : pass = 1 fail = 0 SET @comp_val=0; @@ -365,7 +356,7 @@ SET GLOBAL innodb_cmp_per_index_enabled=1; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -393,15 +384,15 @@ The size of the tab5.ibd file: 65536 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -624,9 +615,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -649,9 +637,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -680,9 +665,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table # testcase : pass = 1 fail = 0 SET @comp_val=0; @@ -711,7 +693,7 @@ SET GLOBAL innodb_cmp_per_index_enabled=1; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -739,15 +721,15 @@ The size of the tab5.ibd file: 65536 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -962,7 +944,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 163840 +The size of the tab5.ibd file: 131072 # fetch the compressed page and check the stats =============== Fetch Records @@ -970,9 +952,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -986,7 +965,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 163840 +The size of the tab5.ibd file: 131072 # fetch the compressed same page once again and check the stats # the stat figures should be same as above query =============== @@ -995,9 +974,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -1011,7 +987,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 163840 +The size of the tab5.ibd file: 131072 DROP TABLE tab5; #****************************************************************** # Test 1-8K: innodb_cmp_per_index_enabled=ON and innodb_compression_level=0 with page size 8K @@ -1024,7 +1000,7 @@ SET GLOBAL innodb_cmp_per_index_enabled=1; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -1048,19 +1024,19 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 122880 +The size of the tab5.ibd file: 106496 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -1275,7 +1251,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 212992 +The size of the tab5.ibd file: 180224 # fetch the compressed page and check the stats =============== Fetch Records @@ -1283,9 +1259,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -1299,7 +1272,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 212992 +The size of the tab5.ibd file: 180224 # fetch the compressed same page once again and check the stats # the stat figures should be same as above query =============== @@ -1308,9 +1281,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -1324,7 +1294,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 212992 +The size of the tab5.ibd file: 180224 DROP TABLE tab5; #****************************************************************** # Test 1-16K: innodb_cmp_per_index_enabled=ON and innodb_compression_level=0 with page size 16K @@ -1337,7 +1307,7 @@ SET GLOBAL innodb_cmp_per_index_enabled=1; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -1361,19 +1331,19 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 245760 +The size of the tab5.ibd file: 212992 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -1588,7 +1558,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 327680 +The size of the tab5.ibd file: 311296 # fetch the compressed page and check the stats =============== Fetch Records @@ -1596,9 +1566,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -1612,7 +1579,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 327680 +The size of the tab5.ibd file: 311296 # fetch the compressed same page once again and check the stats # the stat figures should be same as above query =============== @@ -1621,9 +1588,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -1637,7 +1601,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 327680 +The size of the tab5.ibd file: 311296 DROP TABLE tab5; #****************************************************************** # Test 2: test the interaction between wl6347 & wl6344 (2.2) @@ -1661,7 +1625,7 @@ SET GLOBAL innodb_compression_level=9; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -1690,15 +1654,15 @@ The size of the tab5.ibd file: 65536 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -1922,9 +1886,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -1947,9 +1908,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -1978,9 +1936,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table # testcase : pass = 1 fail = 0 SET @comp_val=0; @@ -2009,7 +1964,7 @@ SET GLOBAL innodb_cmp_per_index_enabled=ON; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -2038,15 +1993,15 @@ The size of the tab5.ibd file: 65536 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -2270,9 +2225,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -2295,9 +2247,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -2326,9 +2275,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table # testcase : pass = 1 fail = 0 SET @comp_val=0; @@ -2357,7 +2303,7 @@ SET GLOBAL innodb_cmp_per_index_enabled=ON; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -2386,15 +2332,15 @@ The size of the tab5.ibd file: 65536 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -2610,7 +2556,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 81920 +The size of the tab5.ibd file: 77824 # fetch the compressed page and check the stats =============== Fetch Records @@ -2618,9 +2564,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -2634,7 +2577,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 81920 +The size of the tab5.ibd file: 77824 # fetch the compressed same page once again and check the stats # the stat figures should be same as above query =============== @@ -2643,9 +2586,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -2659,7 +2599,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 81920 +The size of the tab5.ibd file: 77824 DROP TABLE tab5; #****************************************************************** # Test 2-8K: innodb_cmp_per_index_enabled=ON and innodb_compression_level=9 with page size 8K @@ -2672,7 +2612,7 @@ SET GLOBAL innodb_cmp_per_index_enabled=ON; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -2697,19 +2637,19 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 122880 +The size of the tab5.ibd file: 106496 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -2924,7 +2864,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 163840 +The size of the tab5.ibd file: 155648 # fetch the compressed page and check the stats =============== Fetch Records @@ -2932,9 +2872,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table # The size of the file with 0 compress = 212992 SET @inl_val=1; @@ -2949,7 +2886,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 163840 +The size of the tab5.ibd file: 155648 # fetch the compressed same page once again and check the stats # the stat figures should be same as above query =============== @@ -2958,9 +2895,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -2974,7 +2908,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 163840 +The size of the tab5.ibd file: 155648 DROP TABLE tab5; #****************************************************************** # Test 2-16K: innodb_cmp_per_index_enabled=ON and innodb_compression_level=9 with page size 16K @@ -2987,7 +2921,7 @@ SET GLOBAL innodb_cmp_per_index_enabled=ON; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -3012,19 +2946,19 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 245760 +The size of the tab5.ibd file: 212992 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -3239,7 +3173,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 327680 +The size of the tab5.ibd file: 311296 # fetch the compressed page and check the stats =============== Fetch Records @@ -3247,9 +3181,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table # The size of the file with 0 compress = 344064 SET @inl_val=1; @@ -3264,7 +3195,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 327680 +The size of the tab5.ibd file: 311296 # fetch the compressed same page once again and check the stats # the stat figures should be same as above query =============== @@ -3273,9 +3204,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -3289,7 +3217,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 327680 +The size of the tab5.ibd file: 311296 DROP TABLE tab5; #****************************************************************** # Test 3: test the interaction between wl6347 & wl6344 (2.3) @@ -3312,7 +3240,7 @@ SET GLOBAL innodb_compression_level=default; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -3341,15 +3269,15 @@ The size of the tab5.ibd file: 65536 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -3573,9 +3501,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -3598,9 +3523,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -3628,7 +3550,7 @@ SET GLOBAL innodb_compression_level=default; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -3657,15 +3579,15 @@ The size of the tab5.ibd file: 65536 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -3889,9 +3811,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -3919,7 +3838,7 @@ SET GLOBAL innodb_compression_level=default; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -3948,15 +3867,15 @@ The size of the tab5.ibd file: 65536 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -4172,7 +4091,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 81920 +The size of the tab5.ibd file: 77824 # fetch the compressed page and check the stats =============== Fetch Records @@ -4180,9 +4099,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -4196,7 +4112,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 81920 +The size of the tab5.ibd file: 77824 DROP TABLE tab5; #****************************************************************** # Test 3-8K: innodb_cmp_per_index_enabled=ON and innodb_compression_level=Def with page size 8K @@ -4210,7 +4126,7 @@ SET GLOBAL innodb_compression_level=default; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -4235,19 +4151,19 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 122880 +The size of the tab5.ibd file: 106496 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -4463,7 +4379,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 163840 +The size of the tab5.ibd file: 155648 # fetch the compressed page and check the stats =============== Fetch Records @@ -4471,9 +4387,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -4487,7 +4400,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 163840 +The size of the tab5.ibd file: 155648 DROP TABLE tab5; #****************************************************************** # Test 3-16K: innodb_cmp_per_index_enabled=ON and innodb_compression_level=Def with page size 16K @@ -4501,7 +4414,7 @@ SET GLOBAL innodb_compression_level=default; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -4526,19 +4439,19 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 245760 +The size of the tab5.ibd file: 212992 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -4754,7 +4667,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 327680 +The size of the tab5.ibd file: 311296 # fetch the compressed page and check the stats =============== Fetch Records @@ -4762,9 +4675,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -4778,7 +4688,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 327680 +The size of the tab5.ibd file: 311296 DROP TABLE tab5; #****************************************************************** # Test 4: test the interaction between wl6347 & wl6344 (2.5 & 2.6) @@ -4812,7 +4722,7 @@ SELECT @@innodb_compression_level; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -4840,15 +4750,15 @@ The size of the tab5.ibd file: 65536 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -5071,9 +4981,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -5096,9 +5003,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -5127,9 +5031,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table # testcase : pass = 1 fail = 0 SET @comp_val=0; @@ -5158,7 +5059,7 @@ SET GLOBAL innodb_cmp_per_index_enabled=ON; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -5186,15 +5087,15 @@ The size of the tab5.ibd file: 65536 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -5417,9 +5318,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -5442,9 +5340,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -5471,7 +5366,7 @@ SET GLOBAL innodb_cmp_per_index_enabled=ON; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -5499,15 +5394,15 @@ The size of the tab5.ibd file: 65536 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -5722,7 +5617,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 81920 +The size of the tab5.ibd file: 77824 # fetch the compressed page and check the stats =============== Fetch Records @@ -5730,9 +5625,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -5746,7 +5638,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 81920 +The size of the tab5.ibd file: 77824 # fetch the compressed same page once again and check the stats # the stat figures should be same as above query =============== @@ -5755,9 +5647,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -5771,7 +5660,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 81920 +The size of the tab5.ibd file: 77824 DROP TABLE tab5; #****************************************************************** # Test 4-8K: innodb_cmp_per_index_enabled=ON and Innodb_compression_failure_threshold_pct=0 with page size 8K @@ -5784,7 +5673,7 @@ SET GLOBAL innodb_cmp_per_index_enabled=ON; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -5808,19 +5697,19 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 122880 +The size of the tab5.ibd file: 106496 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -6035,7 +5924,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 163840 +The size of the tab5.ibd file: 155648 # fetch the compressed page and check the stats =============== Fetch Records @@ -6043,9 +5932,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -6059,7 +5945,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 163840 +The size of the tab5.ibd file: 155648 # fetch the compressed same page once again and check the stats # the stat figures should be same as above query =============== @@ -6068,9 +5954,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -6084,7 +5967,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 163840 +The size of the tab5.ibd file: 155648 DROP TABLE tab5; #****************************************************************** # Test 4-16K: innodb_cmp_per_index_enabled=ON and Innodb_compression_failure_threshold_pct=0 with page size 16K @@ -6097,7 +5980,7 @@ SET GLOBAL innodb_cmp_per_index_enabled=ON; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -6121,19 +6004,19 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 245760 +The size of the tab5.ibd file: 212992 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -6348,7 +6231,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 327680 +The size of the tab5.ibd file: 311296 # fetch the compressed page and check the stats =============== Fetch Records @@ -6356,9 +6239,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -6372,7 +6252,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 327680 +The size of the tab5.ibd file: 311296 # fetch the compressed same page once again and check the stats # the stat figures should be same as above query =============== @@ -6381,9 +6261,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -6397,7 +6274,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 327680 +The size of the tab5.ibd file: 311296 DROP TABLE tab5; #****************************************************************** # Test 5: test the interaction between wl6347 & wl6344 (2.7) @@ -6433,7 +6310,7 @@ SELECT @@innodb_compression_level; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -6461,15 +6338,15 @@ The size of the tab5.ibd file: 65536 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -6692,9 +6569,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -6717,9 +6591,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -6749,9 +6620,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table # testcase : pass = 1 fail = 0 SET @comp_val=0; @@ -6781,7 +6649,7 @@ SET GLOBAL innodb_compression_failure_threshold_pct=10; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -6809,15 +6677,15 @@ The size of the tab5.ibd file: 65536 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -7040,9 +6908,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -7065,9 +6930,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=2; # Check the stats of the table @@ -7094,7 +6956,7 @@ SET GLOBAL innodb_cmp_per_index_enabled=ON; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -7122,15 +6984,15 @@ The size of the tab5.ibd file: 65536 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -7345,7 +7207,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 81920 +The size of the tab5.ibd file: 77824 # fetch the compressed page and check the stats =============== Fetch Records @@ -7353,9 +7215,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -7369,7 +7228,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 81920 +The size of the tab5.ibd file: 77824 # fetch the compressed same page once again and check the stats # the stat figures should be same as above query =============== @@ -7378,9 +7237,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -7394,7 +7250,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 81920 +The size of the tab5.ibd file: 77824 DROP TABLE tab5; #****************************************************************** # Test 5-8K: innodb_cmp_per_index_enabled=ON and Innodb_compression_failure_threshold_pct=10 with page size 8K @@ -7408,7 +7264,7 @@ SET GLOBAL innodb_compression_failure_threshold_pct=10; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -7432,19 +7288,19 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 122880 +The size of the tab5.ibd file: 106496 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -7659,7 +7515,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 163840 +The size of the tab5.ibd file: 155648 # fetch the compressed page and check the stats =============== Fetch Records @@ -7667,9 +7523,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -7683,7 +7536,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 163840 +The size of the tab5.ibd file: 155648 # fetch the compressed same page once again and check the stats # the stat figures should be same as above query =============== @@ -7692,9 +7545,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -7708,7 +7558,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 163840 +The size of the tab5.ibd file: 155648 DROP TABLE tab5; #****************************************************************** # Test 5-16K: innodb_cmp_per_index_enabled=ON and Innodb_compression_failure_threshold_pct=10 with page size 16K @@ -7721,7 +7571,7 @@ SET GLOBAL innodb_cmp_per_index_enabled=ON; # Create table & Index CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, -col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255)) +col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(67)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; CREATE INDEX idx9 ON tab5(col_9(10)); CREATE INDEX idx8 ON tab5(col_8(10)); @@ -7745,19 +7595,19 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 245760 +The size of the tab5.ibd file: 212992 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -SET @col_1 = repeat('a', 100); -SET @col_2 = repeat('b', 100); -SET @col_3 = repeat('c', 100); -SET @col_4 = repeat('d', 100); -SET @col_5 = repeat('e', 100); -SET @col_6 = repeat('f', 100); -SET @col_7 = repeat('g', 100); -SET @col_8 = repeat('h', 100); -SET @col_9 = repeat('i', 100); +SET @col_1 = repeat('a', 67); +SET @col_2 = repeat('b', 67); +SET @col_3 = repeat('c', 67); +SET @col_4 = repeat('d', 67); +SET @col_5 = repeat('e', 67); +SET @col_6 = repeat('f', 67); +SET @col_7 = repeat('g', 67); +SET @col_8 = repeat('h', 67); +SET @col_9 = repeat('i', 67); INSERT INTO tab5 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9); INSERT INTO tab5 @@ -7972,7 +7822,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 327680 +The size of the tab5.ibd file: 311296 # fetch the compressed page and check the stats =============== Fetch Records @@ -7980,9 +7830,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -7996,7 +7843,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 327680 +The size of the tab5.ibd file: 311296 # fetch the compressed same page once again and check the stats # the stat figures should be same as above query =============== @@ -8005,9 +7852,6 @@ Fetch Records SELECT col_7,col_8,col_9 FROM tab5 WHERE col_2='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' LIMIT 1; -col_7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -col_8 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -col_9 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii # check the stats of the table & size of the table SET @inl_val=1; # Check the stats of the table @@ -8021,7 +7865,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 327680 +The size of the tab5.ibd file: 311296 DROP TABLE tab5; #****************************************************************** # Test 6: Create multiple tables & indexes having same name in 2 diff DB's diff --git a/mysql-test/suite/innodb_zip/t/bug36172.test b/mysql-test/suite/innodb_zip/t/bug36172.test deleted file mode 100644 index 1f6533d07bfef..0000000000000 --- a/mysql-test/suite/innodb_zip/t/bug36172.test +++ /dev/null @@ -1,27 +0,0 @@ ---source include/innodb_page_size_small.inc -# -# Test case for bug 36172 -# - -set @file_per_table=@@global.innodb_file_per_table; -SET GLOBAL innodb_file_per_table=on; - -SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; - -# we do not really care about what gets printed, we are only -# interested in getting success or failure according to our -# expectations - --- disable_query_log --- disable_result_log - -CREATE TABLE `table0` ( `col0` tinyint(1) DEFAULT NULL, `col1` tinyint(1) DEFAULT NULL, `col2` tinyint(4) DEFAULT NULL, `col3` date DEFAULT NULL, `col4` time DEFAULT NULL, `col5` set('test1','test2','test3') DEFAULT NULL, `col6` time DEFAULT NULL, `col7` text, `col8` decimal(10,0) DEFAULT NULL, `col9` set('test1','test2','test3') DEFAULT NULL, `col10` float DEFAULT NULL, `col11` double DEFAULT NULL, `col12` enum('test1','test2','test3') DEFAULT NULL, `col13` tinyblob, `col14` year(4) DEFAULT NULL, `col15` set('test1','test2','test3') DEFAULT NULL, `col16` decimal(10,0) DEFAULT NULL, `col17` decimal(10,0) DEFAULT NULL, `col18` blob, `col19` datetime DEFAULT NULL, `col20` double DEFAULT NULL, `col21` decimal(10,0) DEFAULT NULL, `col22` datetime DEFAULT NULL, `col23` decimal(10,0) DEFAULT NULL, `col24` decimal(10,0) DEFAULT NULL, `col25` longtext, `col26` tinyblob, `col27` time DEFAULT NULL, `col28` tinyblob, `col29` enum('test1','test2','test3') DEFAULT NULL, `col30` smallint(6) DEFAULT NULL, `col31` double DEFAULT NULL, `col32` float DEFAULT NULL, `col33` char(175) DEFAULT NULL, `col34` tinytext, `col35` tinytext, `col36` tinyblob, `col37` tinyblob, `col38` tinytext, `col39` mediumblob, `col40` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `col41` double DEFAULT NULL, `col42` smallint(6) DEFAULT NULL, `col43` longblob, `col44` varchar(80) DEFAULT NULL, `col45` mediumtext, `col46` decimal(10,0) DEFAULT NULL, `col47` bigint(20) DEFAULT NULL, `col48` date DEFAULT NULL, `col49` tinyblob, `col50` date DEFAULT NULL, `col51` tinyint(1) DEFAULT NULL, `col52` mediumint(9) DEFAULT NULL, `col53` float DEFAULT NULL, `col54` tinyblob, `col55` longtext, `col56` smallint(6) DEFAULT NULL, `col57` enum('test1','test2','test3') DEFAULT NULL, `col58` datetime DEFAULT NULL, `col59` mediumtext, `col60` varchar(232) DEFAULT NULL, `col61` decimal(10,0) DEFAULT NULL, `col62` year(4) DEFAULT NULL, `col63` smallint(6) DEFAULT NULL, `col64` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col65` blob, `col66` longblob, `col67` int(11) DEFAULT NULL, `col68` longtext, `col69` enum('test1','test2','test3') DEFAULT NULL, `col70` int(11) DEFAULT NULL, `col71` time DEFAULT NULL, `col72` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col73` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col74` varchar(170) DEFAULT NULL, `col75` set('test1','test2','test3') DEFAULT NULL, `col76` tinyblob, `col77` bigint(20) DEFAULT NULL, `col78` decimal(10,0) DEFAULT NULL, `col79` datetime DEFAULT NULL, `col80` year(4) DEFAULT NULL, `col81` decimal(10,0) DEFAULT NULL, `col82` longblob, `col83` text, `col84` char(83) DEFAULT NULL, `col85` decimal(10,0) DEFAULT NULL, `col86` float DEFAULT NULL, `col87` int(11) DEFAULT NULL, `col88` varchar(145) DEFAULT NULL, `col89` date DEFAULT NULL, `col90` decimal(10,0) DEFAULT NULL, `col91` decimal(10,0) DEFAULT NULL, `col92` mediumblob, `col93` time DEFAULT NULL, KEY `idx0` (`col69`,`col90`,`col8`), KEY `idx1` (`col60`), KEY `idx2` (`col60`,`col70`,`col74`), KEY `idx3` (`col22`,`col32`,`col72`,`col30`), KEY `idx4` (`col29`), KEY `idx5` (`col19`,`col45`(143)), KEY `idx6` (`col46`,`col48`,`col5`,`col39`(118)), KEY `idx7` (`col48`,`col61`), KEY `idx8` (`col93`), KEY `idx9` (`col31`), KEY `idx10` (`col30`,`col21`), KEY `idx11` (`col67`), KEY `idx12` (`col44`,`col6`,`col8`,`col38`(226)), KEY `idx13` (`col71`,`col41`,`col15`,`col49`(88)), KEY `idx14` (`col78`), KEY `idx15` (`col63`,`col67`,`col64`), KEY `idx16` (`col17`,`col86`), KEY `idx17` (`col77`,`col56`,`col10`,`col55`(24)), KEY `idx18` (`col62`), KEY `idx19` (`col31`,`col57`,`col56`,`col53`), KEY `idx20` (`col46`), KEY `idx21` (`col83`(54)), KEY `idx22` (`col51`,`col7`(120)), KEY `idx23` (`col7`(163),`col31`,`col71`,`col14`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2; -SET sql_mode = default; -insert ignore into `table0` set `col23` = 7887371.5084383683, `col24` = 4293854615.6906948000, `col25` = 'vitalist', `col26` = 'widespread', `col27` = '3570490', `col28` = 'habitual', `col30` = -5471, `col31` = 4286985783.6771750000, `col32` = 6354540.9826654866, `col33` = 'defoliation', `col34` = 'logarithms', `col35` = 'tegument\'s', `col36` = 'scouting\'s', `col37` = 'intermittency', `col38` = 'elongates', `col39` = 'prophecies', `col40` = '20560103035939', `col41` = 4292809130.0544143000, `col42` = 22057, `col43` = 'Hess\'s', `col44` = 'bandstand', `col45` = 'phenylketonuria', `col46` = 6338767.4018677324, `col47` = 5310247, `col48` = '12592418', `col49` = 'churchman\'s', `col50` = '32226125', `col51` = -58, `col52` = -6207968, `col53` = 1244839.3255104220, `col54` = 'robotized', `col55` = 'monotonous', `col56` = -26909, `col58` = '20720107023550', `col59` = 'suggestiveness\'s', `col60` = 'gemology', `col61` = 4287800670.2229986000, `col62` = '1944', `col63` = -16827, `col64` = '20700107212324', `col65` = 'Nicolais', `col66` = 'apteryx', `col67` = 6935317, `col68` = 'stroganoff', `col70` = 3316430, `col71` = '3277608', `col72` = '19300511045918', `col73` = '20421201003327', `col74` = 'attenuant', `col75` = '15173', `col76` = 'upstroke\'s', `col77` = 8118987, `col78` = 6791516.2735374002, `col79` = '20780701144624', `col80` = '2134', `col81` = 4290682351.3127537000, `col82` = 'unexplainably', `col83` = 'Storm', `col84` = 'Greyso\'s', `col85` = 4289119212.4306774000, `col86` = 7617575.8796655172, `col87` = -6325335, `col88` = 'fondue\'s', `col89` = '40608940', `col90` = 1659421.8093508712, `col91` = 8346904.6584368423, `col92` = 'reloads', `col93` = '5188366'; -CHECK TABLE table0 EXTENDED; -INSERT IGNORE INTO `table0` SET `col19` = '19940127002709', `col20` = 2383927.9055146948, `col21` = 4293243420.5621204000, `col22` = '20511211123705', `col23` = 4289899778.6573381000, `col24` = 4293449279.0540481000, `col25` = 'emphysemic', `col26` = 'dentally', `col27` = '2347406', `col28` = 'eruct', `col30` = 1222, `col31` = 4294372994.9941406000, `col32` = 4291385574.1173744000, `col33` = 'borrowing\'s', `col34` = 'septics', `col35` = 'ratter\'s', `col36` = 'Kaye', `col37` = 'Florentia', `col38` = 'allium', `col39` = 'barkeep', `col40` = '19510407003441', `col41` = 4293559200.4215522000, `col42` = 22482, `col43` = 'decussate', `col44` = 'Brom\'s', `col45` = 'violated', `col46` = 4925506.4635456400, `col47` = 930549, `col48` = '51296066', `col49` = 'voluminously', `col50` = '29306676', `col51` = -88, `col52` = -2153690, `col53` = 4290250202.1464887000, `col54` = 'expropriation', `col55` = 'Aberdeen\'s', `col56` = 20343, `col58` = '19640415171532', `col59` = 'extern', `col60` = 'Ubana', `col61` = 4290487961.8539081000, `col62` = '2147', `col63` = -24271, `col64` = '20750801194548', `col65` = 'Cunaxa\'s', `col66` = 'pasticcio', `col67` = 2795817, `col68` = 'Indore\'s', `col70` = 6864127, `col71` = '1817832', `col72` = '20540506114211', `col73` = '20040101012300', `col74` = 'rationalized', `col75` = '45522', `col76` = 'indene', `col77` = -6964559, `col78` = 4247535.5266884370, `col79` = '20720416124357', `col80` = '2143', `col81` = 4292060102.4466386000, `col82` = 'striving', `col83` = 'boneblack\'s', `col84` = 'redolent', `col85` = 6489697.9009369183, `col86` = 4287473465.9731131000, `col87` = 7726015, `col88` = 'perplexed', `col89` = '17153791', `col90` = 5478587.1108127078, `col91` = 4287091404.7004304000, `col92` = 'Boulez\'s', `col93` = '2931278'; -CHECK TABLE table0 EXTENDED; -DROP TABLE table0; --- enable_query_log --- enable_result_log -SET GLOBAL innodb_file_per_table=@file_per_table; diff --git a/mysql-test/suite/innodb_zip/t/bug52745.test b/mysql-test/suite/innodb_zip/t/bug52745.test index be4b5c2bfcb41..b642479f093e5 100644 --- a/mysql-test/suite/innodb_zip/t/bug52745.test +++ b/mysql-test/suite/innodb_zip/t/bug52745.test @@ -1,8 +1,5 @@ -- source include/innodb_page_size_small.inc -let $file_per_table=`select @@innodb_file_per_table`; -SET GLOBAL innodb_file_per_table=on; -SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; CREATE TABLE bug52745 ( a2 int(10) unsigned DEFAULT NULL, col37 time DEFAULT NULL, @@ -40,25 +37,7 @@ CREATE TABLE bug52745 ( col69 date DEFAULT NULL, col70 tinyint(3) unsigned zerofill DEFAULT NULL, col71 varchar(44) CHARACTER SET utf8 DEFAULT NULL, - col72 datetime DEFAULT NULL, - col73 smallint(5) unsigned zerofill DEFAULT NULL, - col74 longblob, - col75 bit(34) DEFAULT NULL, - col76 float unsigned zerofill DEFAULT NULL, - col77 year(4) DEFAULT NULL, - col78 tinyint(3) unsigned DEFAULT NULL, - col79 set('msfheowh','tbpxbgf','by','wahnrjw','myqfasxz','rsokyumrt') CHARACTER SET latin2 DEFAULT NULL, - col80 datetime DEFAULT NULL, - col81 smallint(6) DEFAULT NULL, - col82 enum('xtaurnqfqz','rifrse','kuzwpbvb','niisabk','zxavro','rbvasv','','uulrfaove','','') DEFAULT NULL, - col83 bigint(20) unsigned zerofill DEFAULT NULL, - col84 float unsigned zerofill DEFAULT NULL, - col85 double DEFAULT NULL, - col86 enum('ylannv','','vlkhycqc','snke','cxifustp','xiaxaswzp','oxl') CHARACTER SET latin1 COLLATE latin1_german2_ci DEFAULT NULL, - col87 varbinary(221) DEFAULT NULL, - col88 double unsigned DEFAULT NULL, - col89 float unsigned zerofill DEFAULT NULL, - col90 tinyblob + col72 datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; SET sql_mode = default; INSERT IGNORE INTO bug52745 SET @@ -81,24 +60,8 @@ col66='19600719080256', col68=repeat('Sagittarius\'',54), col69='38943902', col70=1232, -col71='Elora\'', -col74=repeat('zipp',11), -col75='0', -col76=23254, -col78=13247, -col79='56219', -col80='20500609035724', -col81=11632, -col82=7, -col84=-23863, -col85=6341, -col87='HZdkf.4 s7t,5Rmq 8so fmr,ruGLUG25TrtI.yQ 2SuHq0ML7rw7.4 b2yf2E5TJxOtBBZImezDnzpj,uPYfznnEUDN1e9aQoO 2DsplB7TFWy oQJ br HLF :F,eQ p4i1oWsr lL3PG,hjCz6hYqN h1QTjLCjrv:QCdSzpYBibJAtZCxLOk3l6Blsh.W', -col88=16894, -col89=6161, -col90=repeat('gale',48); +col71='Elora\''; SHOW WARNINGS; DROP TABLE bug52745; - -EVAL SET GLOBAL innodb_file_per_table=$file_per_table; diff --git a/mysql-test/suite/innodb_zip/t/index_large_prefix.test b/mysql-test/suite/innodb_zip/t/index_large_prefix.test index 2c9da76f9e834..a254c4e61eea5 100644 --- a/mysql-test/suite/innodb_zip/t/index_large_prefix.test +++ b/mysql-test/suite/innodb_zip/t/index_large_prefix.test @@ -145,14 +145,14 @@ show warnings; -- error ER_TOO_BIG_ROWSIZE create index idx3 on worklog5743_1(a2(436)); show warnings; -# Bug#13391353 Limit is one byte less on on 32bit-Linux only -create index idx4 on worklog5743_1(a2(434)); +# MDEV-27634 stricter compressBound() limit for the s390x DFLTCC instruction +create index idx4 on worklog5743_1(a2(290)); show warnings; -- error ER_TOO_BIG_ROWSIZE create index idx5 on worklog5743_1(a1, a2(430)); show warnings; -# Bug#13391353 Limit is one byte less on on 32bit-Linux only -create index idx6 on worklog5743_1(a1, a2(428)); +# MDEV-27634 stricter compressBound() limit for the s390x DFLTCC instruction +create index idx6 on worklog5743_1(a1, a2(283)); show warnings; # Test edge cases for indexes using key_block_size=2 @@ -162,14 +162,14 @@ show warnings; -- error ER_TOO_BIG_ROWSIZE create index idx3 on worklog5743_2(a2(948)); show warnings; -# Bug#13391353 Limit is one byte less on on 32bit-Linux only -create index idx4 on worklog5743_2(a2(946)); +# MDEV-27634 stricter compressBound() limit for the s390x DFLTCC instruction +create index idx4 on worklog5743_2(a2(802)); show warnings; -- error ER_TOO_BIG_ROWSIZE create index idx5 on worklog5743_2(a1, a2(942)); show warnings; -# Bug#13391353 Limit is one byte less on on 32bit-Linux only -create index idx6 on worklog5743_2(a1, a2(940)); +# MDEV-27634 stricter compressBound() limit for the s390x DFLTCC instruction +create index idx6 on worklog5743_2(a1, a2(795)); show warnings; # Test edge cases for indexes using key_block_size=4 @@ -179,14 +179,14 @@ show warnings; -- error ER_TOO_BIG_ROWSIZE create index idx3 on worklog5743_4(a2(1972)); show warnings; -# Bug#13391353 Limit is one byte less on on 32bit-Linux only -create index idx4 on worklog5743_4(a2(1970)); +# MDEV-27634 stricter compressBound() limit for the s390x DFLTCC instruction +create index idx4 on worklog5743_4(a2(1826)); show warnings; -- error ER_TOO_BIG_ROWSIZE create index idx5 on worklog5743_4(a1, a2(1966)); show warnings; -# Bug#13391353 Limit is one byte less on on 32bit-Linux only -create index idx6 on worklog5743_4(a1, a2(1964)); +# MDEV-27634 stricter compressBound() limit for the s390x DFLTCC instruction +create index idx6 on worklog5743_4(a1, a2(1819)); show warnings; # Test edge cases for indexes using key_block_size=8 diff --git a/mysql-test/suite/innodb_zip/t/innochecksum.test b/mysql-test/suite/innodb_zip/t/innochecksum.test index 60860adeac8ac..b78cd4329de54 100644 --- a/mysql-test/suite/innodb_zip/t/innochecksum.test +++ b/mysql-test/suite/innodb_zip/t/innochecksum.test @@ -57,9 +57,15 @@ let SEARCH_PATTERN= unknown option '-C'; --error 1 --exec $INNOCHECKSUM --no-check --write=crc32 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE -let SEARCH_PATTERN= unknown variable 'write=crc32'; +--let SEARCH_PATTERN= ignoring option '--write' due to invalid value 'crc32' --source include/search_pattern_in_file.inc +--error 1 +--exec $INNOCHECKSUM --no-check $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE +--let SEARCH_PATTERN= Error: --no-check must be associated with --write option +--source include/search_pattern_in_file.inc + +--exec $INNOCHECKSUM --no-check --write $MYSQLD_DATADIR/test/tab1.ibd --source include/start_mysqld.inc SELECT * FROM tab1; diff --git a/mysql-test/suite/innodb_zip/t/page_size.test b/mysql-test/suite/innodb_zip/t/page_size.test index 0faf4428f62d7..3455ef8ed949e 100644 --- a/mysql-test/suite/innodb_zip/t/page_size.test +++ b/mysql-test/suite/innodb_zip/t/page_size.test @@ -86,11 +86,11 @@ c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200), c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(156) ) ROW_FORMAT=compact; -# Compressed table; 1878 bytes with 10 CHAR fields -# Bug#13391353 Limit is 1876 on 32-Linux only +# Compressed table +# MDEV-27634 stricter compressBound() limit for the s390x DFLTCC instruction CREATE TABLE t1 ( c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200), -c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(76) +c06 char(200), c07 char(200), c08 char(176) ) ROW_FORMAT=compressed; DROP TABLE t1; --replace_regex /> [0-9]*/> max_row_size/ @@ -186,13 +186,13 @@ c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200), c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(203) ) ROW_FORMAT=compact; -# Compressed table; 3905 bytes with 20 CHAR fields -# Bug#13391353 Limit is 3903 on 32-Linux only +# Compressed table +# MDEV-27634 stricter compressBound() limit for the s390x DFLTCC instruction CREATE TABLE t1 ( c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200), c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200), c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200), -c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(103) +c16 char(200), c17 char(200), c18 char(182) ) ROW_FORMAT=compressed; DROP TABLE t1; --replace_regex /> [0-9]*/> max_row_size/ @@ -308,8 +308,8 @@ c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200), c36 char(200), c37 char(200), c38 char(200), c39 char(250), c40 char(247) ) ROW_FORMAT=compact; -# Compressed table; 7959 bytes with 40 CHAR fields -# Bug#13391353 Limit is 7957 on 32-Linux only +# Compressed table +# MDEV-27634 stricter compressBound() limit for the s390x DFLTCC instruction CREATE TABLE t1 ( c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200), c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200), @@ -318,7 +318,7 @@ c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200), c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200), c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200), c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200), -c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(157) +c36 char(200), c37 char(200), c38 char(196) ) ROW_FORMAT=compressed; DROP TABLE t1; --error ER_TOO_BIG_ROWSIZE @@ -868,7 +868,48 @@ DROP TABLE t1; CREATE TABLE t1(c text, PRIMARY KEY (c(440))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; DROP TABLE t1; -CREATE TABLE t1(c text, PRIMARY KEY (c(438))) +--disable_warnings +CREATE TABLE t1(c text, PRIMARY KEY (c(293))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; +--enable_warnings INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512)); DROP TABLE t1; + +--echo # +--echo # MDEV-28950 Assertion `*err == DB_SUCCESS' in btr_page_split_and_insert +--echo # +CREATE TABLE t1(c CHAR(255) NOT NULL) ENGINE=InnoDB; +INSERT INTO t1 VALUES (''); +ALTER TABLE t1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +INSERT INTO t1 VALUES (''),(''),(''); +SET @save_innodb_compression_level= @@innodb_compression_level; +SET GLOBAL innodb_compression_level=0; +INSERT INTO t1 VALUES (''); +SET GLOBAL innodb_compression_level= @save_innodb_compression_level; +DROP TABLE t1; + +--echo # +--echo # MDEV-31158 Assertion ...MTR_MEMO_X_LOCKED in btr_attach_half_pages() +--echo # +--source include/have_innodb.inc + +SET @save_compression_level=@@GLOBAL.innodb_compression_level; +SET GLOBAL innodb_compression_level=0; +CREATE TEMPORARY TABLE t(a SERIAL, prefix VARBINARY(4), pad INT); +INSERT INTO t(prefix, pad) VALUES +(_binary 0xff,160),('',19),(_binary 0x0001,253),(_binary 0x0b11,169), +(_binary 0x0b010001,23),(_binary 0x0b100001,251),(_binary 0x0d,163), +(_binary 0xb3,254),(_binary 0x96,254),(_binary 0xeb,61), +(_binary 0xf231,253),(_binary 0x1db0,253),(_binary 0x0005,101), +(_binary 0x6370,253),(_binary 0x0b12,112),(_binary 0x0b010002,23), +(_binary 0x0b100002,80),(_binary 0x181984,163),(_binary 0x181926,168), +(_binary 0xe1,176),(_binary 0xe2,187),(_binary 0xe6,254),(_binary 0xbb,51), +(_binary 0x1c,248),(_binary 0x8a,94),(_binary 0x14,254); +CREATE TABLE u(a SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, + b VARBINARY(255), KEY(b)) ENGINE=InnoDB + KEY_BLOCK_SIZE=1 ROW_FORMAT=COMPRESSED; +INSERT INTO u SELECT a,CONCAT(prefix,REPEAT(chr(0),pad)) FROM t; +DROP TABLE u, t; +SET GLOBAL innodb_compression_level=@save_compression_level; + +--echo # End of 10.6 tests diff --git a/mysql-test/suite/innodb_zip/t/prefix_index_liftedlimit.test b/mysql-test/suite/innodb_zip/t/prefix_index_liftedlimit.test index a020496f7554d..32d7eacd29f35 100644 --- a/mysql-test/suite/innodb_zip/t/prefix_index_liftedlimit.test +++ b/mysql-test/suite/innodb_zip/t/prefix_index_liftedlimit.test @@ -297,10 +297,9 @@ DROP TABLE worklog5743; # Prefix index with VARCHAR data type , primary/seconday index , DML ops # and COMPRESSED row format. KEY_BLOCK_SIZE is varied as 2 , 4 , 8. -# With KEY_BLOCK_SIZE = 2,prefix index limit comes around ~948 for following CREATE TABLE worklog5743_key2 ( col_1_varchar VARCHAR (4000) , col_2_varchar VARCHAR (4000) , -PRIMARY KEY (col_1_varchar(948)) +PRIMARY KEY (col_1_varchar(801)) ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2, engine = innodb; INSERT INTO worklog5743_key2 VALUES(REPEAT("a", 4000) , REPEAT("o", 4000)); #CREATE INDEX prefix_idx ON worklog5743_key2 (col_1_varchar (767)); @@ -316,10 +315,9 @@ DELETE FROM worklog5743_key2 WHERE col_1_varchar = REPEAT("b", 4000); SELECT col_1_varchar = REPEAT("c", 4000) FROM worklog5743_key2; DROP TABLE worklog5743_key2; -# With KEY_BLOCK_SIZE = 4,prefix index limit comes around ~1964 for following CREATE TABLE worklog5743_key4 ( col_1_varchar VARCHAR (4000) , col_2_varchar VARCHAR (4000) , -PRIMARY KEY (col_1_varchar(1964)) +PRIMARY KEY (col_1_varchar(1825)) ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4, engine = innodb; INSERT INTO worklog5743_key4 VALUES(REPEAT("a", 4000) , REPEAT("o", 4000)); #CREATE INDEX prefix_idx ON worklog5743_key4 (col_1_varchar (767)); @@ -358,10 +356,9 @@ DROP TABLE worklog5743_key8; # Prefix index with TEXT data type , primary/seconday index , DML ops # and COMPRESSED row format. KEY_BLOCK_SIZE is varied as 2 , 4 , 8. -# With KEY_BLOCK_SIZE = 2,prefix index limit comes around ~948 for following CREATE TABLE worklog5743_key2 ( col_1_text TEXT (4000) , col_2_text TEXT (4000) , -PRIMARY KEY (col_1_text(948)) +PRIMARY KEY (col_1_text(801)) ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2, engine = innodb; INSERT INTO worklog5743_key2 VALUES(REPEAT("a", 4000) , REPEAT("o", 4000)); #CREATE INDEX prefix_idx ON worklog5743_key2 (col_1_text (767)); @@ -377,10 +374,9 @@ DELETE FROM worklog5743_key2 WHERE col_1_text = REPEAT("b", 4000); SELECT col_1_text = REPEAT("c", 4000) FROM worklog5743_key2; DROP TABLE worklog5743_key2; -# With KEY_BLOCK_SIZE = 4,prefix index limit comes around ~1964 for following CREATE TABLE worklog5743_key4 ( col_1_text TEXT (4000) , col_2_text TEXT (4000) , -PRIMARY KEY (col_1_text(1964)) +PRIMARY KEY (col_1_text(1825)) ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4, engine = innodb; INSERT INTO worklog5743_key4 VALUES(REPEAT("a", 4000) , REPEAT("o", 4000)); #CREATE INDEX prefix_idx ON worklog5743_key4 (col_1_text (767)); @@ -418,10 +414,9 @@ DROP TABLE worklog5743_key8; # Prefix index with BLOB data type , primary/seconday index , DML ops # and COMPRESSED row format. KEY_BLOCK_SIZE is varied as 2 , 4 , 8. -# With KEY_BLOCK_SIZE = 2,prefix index limit comes around ~948 for following CREATE TABLE worklog5743_key2 ( col_1_blob BLOB (4000) , col_2_blob BLOB (4000) , -PRIMARY KEY (col_1_blob(948)) +PRIMARY KEY (col_1_blob(801)) ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2, engine = innodb; INSERT INTO worklog5743_key2 VALUES(REPEAT("a", 4000) , REPEAT("o", 4000)); #CREATE INDEX prefix_idx ON worklog5743_key2 (col_1_blob (767)); @@ -437,10 +432,9 @@ DELETE FROM worklog5743_key2 WHERE col_1_blob = REPEAT("b", 4000); SELECT col_1_blob = REPEAT("c", 4000) FROM worklog5743_key2; DROP TABLE worklog5743_key2; -# With KEY_BLOCK_SIZE = 4,prefix index limit comes around ~1964 for following CREATE TABLE worklog5743_key4 ( col_1_blob BLOB (4000) , col_2_blob BLOB (4000) , -PRIMARY KEY (col_1_blob(1964)) +PRIMARY KEY (col_1_blob(1825)) ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4, engine = innodb; INSERT INTO worklog5743_key4 VALUES(REPEAT("a", 4000) , REPEAT("o", 4000)); #CREATE INDEX prefix_idx ON worklog5743_key4 (col_1_blob (767)); @@ -1200,7 +1194,7 @@ DROP TABLE worklog5743; # For compressed row type + primary key CREATE TABLE worklog5743 ( col_1_text TEXT (4000) , col_2_text TEXT (4000) , -PRIMARY KEY (col_1_text(948)) +PRIMARY KEY (col_1_text(801)) ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2, engine = innodb; INSERT INTO worklog5743 VALUES(REPEAT("a", 4000) , REPEAT("o", 4000)); # Create index of 767 diff --git a/mysql-test/suite/innodb_zip/t/restart.test b/mysql-test/suite/innodb_zip/t/restart.test index baef95a66d324..c442b919d71ad 100644 --- a/mysql-test/suite/innodb_zip/t/restart.test +++ b/mysql-test/suite/innodb_zip/t/restart.test @@ -5,6 +5,7 @@ --source include/have_partition.inc --source include/not_embedded.inc --source include/innodb_checksum_algorithm.inc +--source include/have_symlink.inc SET default_storage_engine=InnoDB; LET $MYSQLD_DATADIR = `select @@datadir`; diff --git a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test index 1f436fafeb554..36dcd1e454be9 100644 --- a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test +++ b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test @@ -25,6 +25,8 @@ call mtr.add_suppression("InnoDB: Error number \\d+ means"); call mtr.add_suppression("InnoDB: Cannot open datafile .*t1\\.ibd"); call mtr.add_suppression("InnoDB: Ignoring tablespace for test/t1 "); call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` because the \\.ibd file is missing"); +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*ibdata1' page"); +call mtr.add_suppression("InnoDB: File '.*ibdata1' is corrupted"); FLUSH TABLES; let MYSQLD_DATADIR =`SELECT @@datadir`; @@ -435,19 +437,29 @@ ALTER TABLE t1 DISCARD TABLESPACE; SELECT COUNT(*) FROM t1; # Restore files +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; +let MYSQLD_DATADIR=`select @@datadir`; + perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test", "t1"); +my $page; +my $ps = $ENV{INNODB_PAGE_SIZE}; +my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd"; +open(FILE, "+<$file") || die "Unable to open $file"; +binmode FILE; +sysseek(FILE, 4*$ps, 0) || die "Unable to seek $file\n"; +die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps; +substr($page,24,2)='42'; +sysseek(FILE, 4*$ps, 0) || die "Unable to rewind $file\n"; +syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n"; +close(FILE) || die "Unable to close $file"; EOF -SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure"; - # Following alter is failing ---error ER_INTERNAL_ERROR +--error ER_INTERNAL_ERROR,ER_NOT_KEYFILE ALTER TABLE t1 IMPORT TABLESPACE; -SET SESSION debug_dbug=@saved_debug_dbug; - DROP TABLE t1; perl; diff --git a/mysql-test/suite/innodb_zip/t/wl6344_compress_level.test b/mysql-test/suite/innodb_zip/t/wl6344_compress_level.test index f0ddb35aa4a72..d44dbfd73b0fb 100644 --- a/mysql-test/suite/innodb_zip/t/wl6344_compress_level.test +++ b/mysql-test/suite/innodb_zip/t/wl6344_compress_level.test @@ -18,7 +18,7 @@ SET global innodb_compression_level=0; -- echo #create table with 1K block size CREATE TABLE tab5 (col_1 CHAR (255) , -col_2 VARCHAR (255), col_3 longtext, +col_2 VARCHAR (121), col_3 longtext, col_4 longtext,col_5 longtext, col_6 longtext , col_7 longtext , col_8 longtext ,col_9 longtext , @@ -62,7 +62,7 @@ SET global innodb_compression_level=9; -- echo #create table with 1K block size CREATE TABLE tab6 (col_1 CHAR (255) , -col_2 VARCHAR (255), col_3 longtext, +col_2 VARCHAR (121), col_3 longtext, col_4 longtext,col_5 longtext, col_6 longtext , col_7 longtext , col_8 longtext ,col_9 longtext , diff --git a/mysql-test/suite/jp/r/jp_alter_sjis.result b/mysql-test/suite/jp/r/jp_alter_sjis.result index 20b71952197ea..5574f5432f1a0 100644 --- a/mysql-test/suite/jp/r/jp_alter_sjis.result +++ b/mysql-test/suite/jp/r/jp_alter_sjis.result @@ -44,7 +44,7 @@ Table Create Table PRIMARY KEY (`���`), UNIQUE KEY `���` (`���`), KEY `���` (`��`) -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci ALTER TABLE `���` DROP INDEX `���`; ALTER TABLE `���` DROP PRIMARY KEY; ALTER TABLE `���` DROP INDEX `���`; @@ -63,7 +63,7 @@ SHOW CREATE TABLE ` Table Create Table ��� CREATE TABLE `���` ( `���` char(6) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci ALTER TABLE `������` ADD `������` char(1) FIRST; ALTER TABLE `������` ADD `������` char(1) AFTER `������`; ALTER TABLE `������` ADD `������` char(1); @@ -93,7 +93,7 @@ Table Create Table PRIMARY KEY (`������`), UNIQUE KEY `������` (`������`), KEY `������` (`����`) -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci ALTER TABLE `������` DROP INDEX `������`; ALTER TABLE `������` DROP PRIMARY KEY; ALTER TABLE `������` DROP INDEX `������`; @@ -112,7 +112,7 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(6) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci ALTER TABLE `�\�\�\` ADD `�\�\�\` char(1) FIRST; ALTER TABLE `�\�\�\` ADD `�\�\�\` char(1) AFTER `�\�\�\`; ALTER TABLE `�\�\�\` ADD `�\�\�\` char(1); @@ -142,7 +142,7 @@ Table Create Table PRIMARY KEY (`�\�\�\`), UNIQUE KEY `�\�\�\` (`�\�\�\`), KEY `�\�\�\` (`�\�\`) -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci ALTER TABLE `�\�\�\` DROP INDEX `�\�\�\`; ALTER TABLE `�\�\�\` DROP PRIMARY KEY; ALTER TABLE `�\�\�\` DROP INDEX `�\�\�\`; @@ -161,7 +161,7 @@ SHOW CREATE TABLE ` Table Create Table �\�\�\ CREATE TABLE `�\�\�\` ( `�\�\�\` char(6) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci DROP TABLE `���`; DROP TABLE `���`; DROP TABLE `������`; @@ -206,7 +206,7 @@ Table Create Table PRIMARY KEY (`���`), UNIQUE KEY `���` (`���`), KEY `���` (`��`) -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci ALTER TABLE `���` DROP INDEX `���`; ALTER TABLE `���` DROP PRIMARY KEY; ALTER TABLE `���` DROP INDEX `���`; @@ -225,7 +225,7 @@ SHOW CREATE TABLE ` Table Create Table ��� CREATE TABLE `���` ( `���` char(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci ALTER TABLE `������` ADD `������` char(1) FIRST; ALTER TABLE `������` ADD `������` char(1) AFTER `������`; ALTER TABLE `������` ADD `������` char(1); @@ -255,7 +255,7 @@ Table Create Table PRIMARY KEY (`������`), UNIQUE KEY `������` (`������`), KEY `������` (`����`) -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci ALTER TABLE `������` DROP INDEX `������`; ALTER TABLE `������` DROP PRIMARY KEY; ALTER TABLE `������` DROP INDEX `������`; @@ -274,7 +274,7 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci ALTER TABLE `�\�\�\` ADD `�\�\�\` char(1) FIRST; ALTER TABLE `�\�\�\` ADD `�\�\�\` char(1) AFTER `�\�\�\`; ALTER TABLE `�\�\�\` ADD `�\�\�\` char(1); @@ -304,7 +304,7 @@ Table Create Table PRIMARY KEY (`�\�\�\`), UNIQUE KEY `�\�\�\` (`�\�\�\`), KEY `�\�\�\` (`�\�\`) -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci ALTER TABLE `�\�\�\` DROP INDEX `�\�\�\`; ALTER TABLE `�\�\�\` DROP PRIMARY KEY; ALTER TABLE `�\�\�\` DROP INDEX `�\�\�\`; @@ -323,7 +323,7 @@ SHOW CREATE TABLE ` Table Create Table �\�\�\ CREATE TABLE `�\�\�\` ( `�\�\�\` char(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci DROP TABLE `���`; DROP TABLE `���`; DROP TABLE `������`; @@ -368,7 +368,7 @@ Table Create Table PRIMARY KEY (`���`), UNIQUE KEY `���` (`���`), KEY `���` (`��`) -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci ALTER TABLE `���` DROP INDEX `���`; ALTER TABLE `���` DROP PRIMARY KEY; ALTER TABLE `���` DROP INDEX `���`; @@ -387,7 +387,7 @@ SHOW CREATE TABLE ` Table Create Table ��� CREATE TABLE `���` ( `���` char(6) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci ALTER TABLE `������` ADD `������` char(1) FIRST; ALTER TABLE `������` ADD `������` char(1) AFTER `������`; ALTER TABLE `������` ADD `������` char(1); @@ -417,7 +417,7 @@ Table Create Table PRIMARY KEY (`������`), UNIQUE KEY `������` (`������`), KEY `������` (`����`) -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci ALTER TABLE `������` DROP INDEX `������`; ALTER TABLE `������` DROP PRIMARY KEY; ALTER TABLE `������` DROP INDEX `������`; @@ -436,7 +436,7 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(6) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci ALTER TABLE `�\�\�\` ADD `�\�\�\` char(1) FIRST; ALTER TABLE `�\�\�\` ADD `�\�\�\` char(1) AFTER `�\�\�\`; ALTER TABLE `�\�\�\` ADD `�\�\�\` char(1); @@ -466,7 +466,7 @@ Table Create Table PRIMARY KEY (`�\�\�\`), UNIQUE KEY `�\�\�\` (`�\�\�\`), KEY `�\�\�\` (`�\�\`) -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci ALTER TABLE `�\�\�\` DROP INDEX `�\�\�\`; ALTER TABLE `�\�\�\` DROP PRIMARY KEY; ALTER TABLE `�\�\�\` DROP INDEX `�\�\�\`; @@ -485,7 +485,7 @@ SHOW CREATE TABLE ` Table Create Table �\�\�\ CREATE TABLE `�\�\�\` ( `�\�\�\` char(6) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci DROP TABLE `���`; DROP TABLE `���`; DROP TABLE `������`; diff --git a/mysql-test/suite/jp/r/jp_alter_ucs2.result b/mysql-test/suite/jp/r/jp_alter_ucs2.result index 204913250cc9e..336bd6fec940f 100644 --- a/mysql-test/suite/jp/r/jp_alter_ucs2.result +++ b/mysql-test/suite/jp/r/jp_alter_ucs2.result @@ -45,7 +45,7 @@ Table Create Table PRIMARY KEY (`������`), UNIQUE KEY `������` (`������`), KEY `������` (`����`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci ALTER TABLE `������` DROP INDEX `������`; ALTER TABLE `������` DROP PRIMARY KEY; ALTER TABLE `������` DROP INDEX `������`; @@ -64,7 +64,7 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(6) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci ALTER TABLE `������` ADD `������` char(1) FIRST; ALTER TABLE `������` ADD `������` char(1) AFTER `������`; ALTER TABLE `������` ADD `������` char(1); @@ -94,7 +94,7 @@ Table Create Table PRIMARY KEY (`������`), UNIQUE KEY `������` (`������`), KEY `������` (`����`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci ALTER TABLE `������` DROP INDEX `������`; ALTER TABLE `������` DROP PRIMARY KEY; ALTER TABLE `������` DROP INDEX `������`; @@ -113,7 +113,7 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(6) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1) FIRST; ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1) AFTER `���������`; ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1); @@ -143,7 +143,7 @@ Table Create Table PRIMARY KEY (`���������`), UNIQUE KEY `���������` (`���������`), KEY `���������` (`������`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci ALTER TABLE `��ݏ�ݏ��` DROP INDEX `���������`; ALTER TABLE `��ݏ�ݏ��` DROP PRIMARY KEY; ALTER TABLE `��ݏ�ݏ��` DROP INDEX `���������`; @@ -162,7 +162,7 @@ SHOW CREATE TABLE ` Table Create Table ��ݏ�ݏ�� CREATE TABLE `��ݏ�ݏ��` ( `���������` char(6) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci DROP TABLE `������`; DROP TABLE `������`; DROP TABLE `������`; @@ -207,7 +207,7 @@ Table Create Table PRIMARY KEY (`������`), UNIQUE KEY `������` (`������`), KEY `������` (`����`) -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci ALTER TABLE `������` DROP INDEX `������`; ALTER TABLE `������` DROP PRIMARY KEY; ALTER TABLE `������` DROP INDEX `������`; @@ -226,7 +226,7 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci ALTER TABLE `������` ADD `������` char(1) FIRST; ALTER TABLE `������` ADD `������` char(1) AFTER `������`; ALTER TABLE `������` ADD `������` char(1); @@ -256,7 +256,7 @@ Table Create Table PRIMARY KEY (`������`), UNIQUE KEY `������` (`������`), KEY `������` (`����`) -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci ALTER TABLE `������` DROP INDEX `������`; ALTER TABLE `������` DROP PRIMARY KEY; ALTER TABLE `������` DROP INDEX `������`; @@ -275,7 +275,7 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1) FIRST; ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1) AFTER `���������`; ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1); @@ -305,7 +305,7 @@ Table Create Table PRIMARY KEY (`���������`), UNIQUE KEY `���������` (`���������`), KEY `���������` (`������`) -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci ALTER TABLE `��ݏ�ݏ��` DROP INDEX `���������`; ALTER TABLE `��ݏ�ݏ��` DROP PRIMARY KEY; ALTER TABLE `��ݏ�ݏ��` DROP INDEX `���������`; @@ -324,7 +324,7 @@ SHOW CREATE TABLE ` Table Create Table ��ݏ�ݏ�� CREATE TABLE `��ݏ�ݏ��` ( `���������` char(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci DROP TABLE `������`; DROP TABLE `������`; DROP TABLE `������`; @@ -369,7 +369,7 @@ Table Create Table PRIMARY KEY (`������`), UNIQUE KEY `������` (`������`), KEY `������` (`����`) -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci ALTER TABLE `������` DROP INDEX `������`; ALTER TABLE `������` DROP PRIMARY KEY; ALTER TABLE `������` DROP INDEX `������`; @@ -388,7 +388,7 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(6) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci ALTER TABLE `������` ADD `������` char(1) FIRST; ALTER TABLE `������` ADD `������` char(1) AFTER `������`; ALTER TABLE `������` ADD `������` char(1); @@ -418,7 +418,7 @@ Table Create Table PRIMARY KEY (`������`), UNIQUE KEY `������` (`������`), KEY `������` (`����`) -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci ALTER TABLE `������` DROP INDEX `������`; ALTER TABLE `������` DROP PRIMARY KEY; ALTER TABLE `������` DROP INDEX `������`; @@ -437,7 +437,7 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(6) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1) FIRST; ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1) AFTER `���������`; ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1); @@ -467,7 +467,7 @@ Table Create Table PRIMARY KEY (`���������`), UNIQUE KEY `���������` (`���������`), KEY `���������` (`������`) -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci ALTER TABLE `��ݏ�ݏ��` DROP INDEX `���������`; ALTER TABLE `��ݏ�ݏ��` DROP PRIMARY KEY; ALTER TABLE `��ݏ�ݏ��` DROP INDEX `���������`; @@ -486,7 +486,7 @@ SHOW CREATE TABLE ` Table Create Table ��ݏ�ݏ�� CREATE TABLE `��ݏ�ݏ��` ( `���������` char(6) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci DROP TABLE `������`; DROP TABLE `������`; DROP TABLE `������`; diff --git a/mysql-test/suite/jp/r/jp_alter_ujis.result b/mysql-test/suite/jp/r/jp_alter_ujis.result index a46da01e1cd33..a59c1e5a0517a 100644 --- a/mysql-test/suite/jp/r/jp_alter_ujis.result +++ b/mysql-test/suite/jp/r/jp_alter_ujis.result @@ -44,7 +44,7 @@ Table Create Table PRIMARY KEY (`������`), UNIQUE KEY `������` (`������`), KEY `������` (`����`) -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci ALTER TABLE `������` DROP INDEX `������`; ALTER TABLE `������` DROP PRIMARY KEY; ALTER TABLE `������` DROP INDEX `������`; @@ -63,7 +63,7 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(6) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci ALTER TABLE `������` ADD `������` char(1) FIRST; ALTER TABLE `������` ADD `������` char(1) AFTER `������`; ALTER TABLE `������` ADD `������` char(1); @@ -93,7 +93,7 @@ Table Create Table PRIMARY KEY (`������`), UNIQUE KEY `������` (`������`), KEY `������` (`����`) -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci ALTER TABLE `������` DROP INDEX `������`; ALTER TABLE `������` DROP PRIMARY KEY; ALTER TABLE `������` DROP INDEX `������`; @@ -112,7 +112,7 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(6) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1) FIRST; ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1) AFTER `���������`; ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1); @@ -142,7 +142,7 @@ Table Create Table PRIMARY KEY (`���������`), UNIQUE KEY `���������` (`���������`), KEY `���������` (`������`) -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci ALTER TABLE `��ݏ�ݏ��` DROP INDEX `���������`; ALTER TABLE `��ݏ�ݏ��` DROP PRIMARY KEY; ALTER TABLE `��ݏ�ݏ��` DROP INDEX `���������`; @@ -161,7 +161,7 @@ SHOW CREATE TABLE ` Table Create Table ��ݏ�ݏ�� CREATE TABLE `��ݏ�ݏ��` ( `���������` char(6) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci DROP TABLE `������`; DROP TABLE `������`; DROP TABLE `������`; @@ -206,7 +206,7 @@ Table Create Table PRIMARY KEY (`������`), UNIQUE KEY `������` (`������`), KEY `������` (`����`) -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci ALTER TABLE `������` DROP INDEX `������`; ALTER TABLE `������` DROP PRIMARY KEY; ALTER TABLE `������` DROP INDEX `������`; @@ -225,7 +225,7 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci ALTER TABLE `������` ADD `������` char(1) FIRST; ALTER TABLE `������` ADD `������` char(1) AFTER `������`; ALTER TABLE `������` ADD `������` char(1); @@ -255,7 +255,7 @@ Table Create Table PRIMARY KEY (`������`), UNIQUE KEY `������` (`������`), KEY `������` (`����`) -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci ALTER TABLE `������` DROP INDEX `������`; ALTER TABLE `������` DROP PRIMARY KEY; ALTER TABLE `������` DROP INDEX `������`; @@ -274,7 +274,7 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1) FIRST; ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1) AFTER `���������`; ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1); @@ -304,7 +304,7 @@ Table Create Table PRIMARY KEY (`���������`), UNIQUE KEY `���������` (`���������`), KEY `���������` (`������`) -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci ALTER TABLE `��ݏ�ݏ��` DROP INDEX `���������`; ALTER TABLE `��ݏ�ݏ��` DROP PRIMARY KEY; ALTER TABLE `��ݏ�ݏ��` DROP INDEX `���������`; @@ -323,7 +323,7 @@ SHOW CREATE TABLE ` Table Create Table ��ݏ�ݏ�� CREATE TABLE `��ݏ�ݏ��` ( `���������` char(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci DROP TABLE `������`; DROP TABLE `������`; DROP TABLE `������`; @@ -368,7 +368,7 @@ Table Create Table PRIMARY KEY (`������`), UNIQUE KEY `������` (`������`), KEY `������` (`����`) -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci ALTER TABLE `������` DROP INDEX `������`; ALTER TABLE `������` DROP PRIMARY KEY; ALTER TABLE `������` DROP INDEX `������`; @@ -387,7 +387,7 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(6) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci ALTER TABLE `������` ADD `������` char(1) FIRST; ALTER TABLE `������` ADD `������` char(1) AFTER `������`; ALTER TABLE `������` ADD `������` char(1); @@ -417,7 +417,7 @@ Table Create Table PRIMARY KEY (`������`), UNIQUE KEY `������` (`������`), KEY `������` (`����`) -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci ALTER TABLE `������` DROP INDEX `������`; ALTER TABLE `������` DROP PRIMARY KEY; ALTER TABLE `������` DROP INDEX `������`; @@ -436,7 +436,7 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(6) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1) FIRST; ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1) AFTER `���������`; ALTER TABLE `��ݏ�ݏ��` ADD `���������` char(1); @@ -466,7 +466,7 @@ Table Create Table PRIMARY KEY (`���������`), UNIQUE KEY `���������` (`���������`), KEY `���������` (`������`) -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci ALTER TABLE `��ݏ�ݏ��` DROP INDEX `���������`; ALTER TABLE `��ݏ�ݏ��` DROP PRIMARY KEY; ALTER TABLE `��ݏ�ݏ��` DROP INDEX `���������`; @@ -485,7 +485,7 @@ SHOW CREATE TABLE ` Table Create Table ��ݏ�ݏ�� CREATE TABLE `��ݏ�ݏ��` ( `���������` char(6) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci DROP TABLE `������`; DROP TABLE `������`; DROP TABLE `������`; diff --git a/mysql-test/suite/jp/r/jp_alter_utf8.result b/mysql-test/suite/jp/r/jp_alter_utf8.result index b6a6129dc092a..545b127415cef 100644 --- a/mysql-test/suite/jp/r/jp_alter_utf8.result +++ b/mysql-test/suite/jp/r/jp_alter_utf8.result @@ -44,7 +44,7 @@ Table Create Table PRIMARY KEY (`キキキ`), UNIQUE KEY `ククク` (`ククク`), KEY `カカカ` (`カカ`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ALTER TABLE `アアア` DROP INDEX `カカカ`; ALTER TABLE `アアア` DROP PRIMARY KEY; ALTER TABLE `アアア` DROP INDEX `ククク`; @@ -63,7 +63,7 @@ SHOW CREATE TABLE `アアア`; Table Create Table アアア CREATE TABLE `アアア` ( `キキキ` char(6) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ALTER TABLE `あああ` ADD `かかか` char(1) FIRST; ALTER TABLE `あああ` ADD `くくく` char(1) AFTER `ききき`; ALTER TABLE `あああ` ADD `けけけ` char(1); @@ -93,7 +93,7 @@ Table Create Table PRIMARY KEY (`ききき`), UNIQUE KEY `くくく` (`くくく`), KEY `かかか` (`かか`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ALTER TABLE `あああ` DROP INDEX `かかか`; ALTER TABLE `あああ` DROP PRIMARY KEY; ALTER TABLE `あああ` DROP INDEX `くくく`; @@ -112,7 +112,7 @@ SHOW CREATE TABLE `あああ`; Table Create Table あああ CREATE TABLE `あああ` ( `ききき` char(6) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ALTER TABLE `龖龖龖` ADD `丄丄丄` char(1) FIRST; ALTER TABLE `龖龖龖` ADD `丅丅丅` char(1) AFTER `丂丂丂`; ALTER TABLE `龖龖龖` ADD `乚乚乚` char(1); @@ -142,7 +142,7 @@ Table Create Table PRIMARY KEY (`丂丂丂`), UNIQUE KEY `丅丅丅` (`丅丅丅`), KEY `丄丄丄` (`丄丄`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ALTER TABLE `龖龖龖` DROP INDEX `丄丄丄`; ALTER TABLE `龖龖龖` DROP PRIMARY KEY; ALTER TABLE `龖龖龖` DROP INDEX `丅丅丅`; @@ -161,7 +161,7 @@ SHOW CREATE TABLE `龖龖龖`; Table Create Table 龖龖龖 CREATE TABLE `龖龖龖` ( `丂丂丂` char(6) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE `アアア`; DROP TABLE `イイイ`; DROP TABLE `あああ`; @@ -206,7 +206,7 @@ Table Create Table PRIMARY KEY (`キキキ`), UNIQUE KEY `ククク` (`ククク`), KEY `カカカ` (`カカ`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ALTER TABLE `アアア` DROP INDEX `カカカ`; ALTER TABLE `アアア` DROP PRIMARY KEY; ALTER TABLE `アアア` DROP INDEX `ククク`; @@ -225,7 +225,7 @@ SHOW CREATE TABLE `アアア`; Table Create Table アアア CREATE TABLE `アアア` ( `キキキ` char(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ALTER TABLE `あああ` ADD `かかか` char(1) FIRST; ALTER TABLE `あああ` ADD `くくく` char(1) AFTER `ききき`; ALTER TABLE `あああ` ADD `けけけ` char(1); @@ -255,7 +255,7 @@ Table Create Table PRIMARY KEY (`ききき`), UNIQUE KEY `くくく` (`くくく`), KEY `かかか` (`かか`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ALTER TABLE `あああ` DROP INDEX `かかか`; ALTER TABLE `あああ` DROP PRIMARY KEY; ALTER TABLE `あああ` DROP INDEX `くくく`; @@ -274,7 +274,7 @@ SHOW CREATE TABLE `あああ`; Table Create Table あああ CREATE TABLE `あああ` ( `ききき` char(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ALTER TABLE `龖龖龖` ADD `丄丄丄` char(1) FIRST; ALTER TABLE `龖龖龖` ADD `丅丅丅` char(1) AFTER `丂丂丂`; ALTER TABLE `龖龖龖` ADD `乚乚乚` char(1); @@ -304,7 +304,7 @@ Table Create Table PRIMARY KEY (`丂丂丂`), UNIQUE KEY `丅丅丅` (`丅丅丅`), KEY `丄丄丄` (`丄丄`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ALTER TABLE `龖龖龖` DROP INDEX `丄丄丄`; ALTER TABLE `龖龖龖` DROP PRIMARY KEY; ALTER TABLE `龖龖龖` DROP INDEX `丅丅丅`; @@ -323,7 +323,7 @@ SHOW CREATE TABLE `龖龖龖`; Table Create Table 龖龖龖 CREATE TABLE `龖龖龖` ( `丂丂丂` char(6) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE `アアア`; DROP TABLE `イイイ`; DROP TABLE `あああ`; @@ -368,7 +368,7 @@ Table Create Table PRIMARY KEY (`キキキ`), UNIQUE KEY `ククク` (`ククク`), KEY `カカカ` (`カカ`) -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ALTER TABLE `アアア` DROP INDEX `カカカ`; ALTER TABLE `アアア` DROP PRIMARY KEY; ALTER TABLE `アアア` DROP INDEX `ククク`; @@ -387,7 +387,7 @@ SHOW CREATE TABLE `アアア`; Table Create Table アアア CREATE TABLE `アアア` ( `キキキ` char(6) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ALTER TABLE `あああ` ADD `かかか` char(1) FIRST; ALTER TABLE `あああ` ADD `くくく` char(1) AFTER `ききき`; ALTER TABLE `あああ` ADD `けけけ` char(1); @@ -417,7 +417,7 @@ Table Create Table PRIMARY KEY (`ききき`), UNIQUE KEY `くくく` (`くくく`), KEY `かかか` (`かか`) -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ALTER TABLE `あああ` DROP INDEX `かかか`; ALTER TABLE `あああ` DROP PRIMARY KEY; ALTER TABLE `あああ` DROP INDEX `くくく`; @@ -436,7 +436,7 @@ SHOW CREATE TABLE `あああ`; Table Create Table あああ CREATE TABLE `あああ` ( `ききき` char(6) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ALTER TABLE `龖龖龖` ADD `丄丄丄` char(1) FIRST; ALTER TABLE `龖龖龖` ADD `丅丅丅` char(1) AFTER `丂丂丂`; ALTER TABLE `龖龖龖` ADD `乚乚乚` char(1); @@ -466,7 +466,7 @@ Table Create Table PRIMARY KEY (`丂丂丂`), UNIQUE KEY `丅丅丅` (`丅丅丅`), KEY `丄丄丄` (`丄丄`) -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ALTER TABLE `龖龖龖` DROP INDEX `丄丄丄`; ALTER TABLE `龖龖龖` DROP PRIMARY KEY; ALTER TABLE `龖龖龖` DROP INDEX `丅丅丅`; @@ -485,7 +485,7 @@ SHOW CREATE TABLE `龖龖龖`; Table Create Table 龖龖龖 CREATE TABLE `龖龖龖` ( `丂丂丂` char(6) NOT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE `アアア`; DROP TABLE `イイイ`; DROP TABLE `あああ`; diff --git a/mysql-test/suite/jp/r/jp_create_tbl_sjis.result b/mysql-test/suite/jp/r/jp_create_tbl_sjis.result index b3a5a52f0d13a..0a78d26ea0fb1 100644 --- a/mysql-test/suite/jp/r/jp_create_tbl_sjis.result +++ b/mysql-test/suite/jp/r/jp_create_tbl_sjis.result @@ -97,77 +97,77 @@ SHOW CREATE TABLE ` Table Create Table ��� CREATE TABLE `���` ( `���` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `���`; Table Create Table ��� CREATE TABLE `���` ( `���` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `���`; Table Create Table ��� CREATE TABLE `���` ( `���` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `���`; Table Create Table ��� CREATE TEMPORARY TABLE `���` ( `���` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `���`; Table Create Table ��� CREATE TEMPORARY TABLE `���` ( `���` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�\�\�\`; Table Create Table �\�\�\ CREATE TABLE `�\�\�\` ( `�\�\�\` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�\�\�\`; Table Create Table �\�\�\ CREATE TABLE `�\�\�\` ( `�\�\�\` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�\�\�\`; Table Create Table �\�\�\ CREATE TABLE `�\�\�\` ( `�\�\�\` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�\�\�\`; Table Create Table �\�\�\ CREATE TEMPORARY TABLE `�\�\�\` ( `�\�\�\` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�\�\�\`; Table Create Table �\�\�\ CREATE TEMPORARY TABLE `�\�\�\` ( `�\�\�\` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci DROP TABLE `���`; DROP TABLE `���`; DROP TABLE `���`; @@ -265,77 +265,77 @@ SHOW CREATE TABLE ` Table Create Table ��� CREATE TABLE `���` ( `���` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `���`; Table Create Table ��� CREATE TABLE `���` ( `���` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `���`; Table Create Table ��� CREATE TABLE `���` ( `���` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `���`; Table Create Table ��� CREATE TEMPORARY TABLE `���` ( `���` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `���`; Table Create Table ��� CREATE TEMPORARY TABLE `���` ( `���` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�\�\�\`; Table Create Table �\�\�\ CREATE TABLE `�\�\�\` ( `�\�\�\` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�\�\�\`; Table Create Table �\�\�\ CREATE TABLE `�\�\�\` ( `�\�\�\` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�\�\�\`; Table Create Table �\�\�\ CREATE TABLE `�\�\�\` ( `�\�\�\` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�\�\�\`; Table Create Table �\�\�\ CREATE TEMPORARY TABLE `�\�\�\` ( `�\�\�\` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�\�\�\`; Table Create Table �\�\�\ CREATE TEMPORARY TABLE `�\�\�\` ( `�\�\�\` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci DROP TABLE `���`; DROP TABLE `���`; DROP TABLE `���`; @@ -433,77 +433,77 @@ SHOW CREATE TABLE ` Table Create Table ��� CREATE TABLE `���` ( `���` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `���`; Table Create Table ��� CREATE TABLE `���` ( `���` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `���`; Table Create Table ��� CREATE TABLE `���` ( `���` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `���`; Table Create Table ��� CREATE TEMPORARY TABLE `���` ( `���` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `���`; Table Create Table ��� CREATE TEMPORARY TABLE `���` ( `���` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�\�\�\`; Table Create Table �\�\�\ CREATE TABLE `�\�\�\` ( `�\�\�\` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�\�\�\`; Table Create Table �\�\�\ CREATE TABLE `�\�\�\` ( `�\�\�\` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�\�\�\`; Table Create Table �\�\�\ CREATE TABLE `�\�\�\` ( `�\�\�\` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�\�\�\`; Table Create Table �\�\�\ CREATE TEMPORARY TABLE `�\�\�\` ( `�\�\�\` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�\�\�\`; Table Create Table �\�\�\ CREATE TEMPORARY TABLE `�\�\�\` ( `�\�\�\` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci DROP TABLE `���`; DROP TABLE `���`; DROP TABLE `���`; diff --git a/mysql-test/suite/jp/r/jp_create_tbl_ucs2.result b/mysql-test/suite/jp/r/jp_create_tbl_ucs2.result index 5ca3d84465ed1..d9dca0595504b 100644 --- a/mysql-test/suite/jp/r/jp_create_tbl_ucs2.result +++ b/mysql-test/suite/jp/r/jp_create_tbl_ucs2.result @@ -97,77 +97,77 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `��ݏ�ݏ��`; Table Create Table ��ݏ�ݏ�� CREATE TABLE `��ݏ�ݏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `��ޏ�ޏ��`; Table Create Table ��ޏ�ޏ�� CREATE TABLE `��ޏ�ޏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `��ߏ�ߏ��`; Table Create Table ��ߏ�ߏ�� CREATE TABLE `��ߏ�ߏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `���������`; Table Create Table ��������� CREATE TEMPORARY TABLE `���������` ( `���������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�������`; Table Create Table ������� CREATE TEMPORARY TABLE `�������` ( `���������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci DROP TABLE `������`; DROP TABLE `������`; DROP TABLE `������`; @@ -265,77 +265,77 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `��ݏ�ݏ��`; Table Create Table ��ݏ�ݏ�� CREATE TABLE `��ݏ�ݏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `��ޏ�ޏ��`; Table Create Table ��ޏ�ޏ�� CREATE TABLE `��ޏ�ޏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `��ߏ�ߏ��`; Table Create Table ��ߏ�ߏ�� CREATE TABLE `��ߏ�ߏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `���������`; Table Create Table ��������� CREATE TEMPORARY TABLE `���������` ( `���������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�������`; Table Create Table ������� CREATE TEMPORARY TABLE `�������` ( `���������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci DROP TABLE `������`; DROP TABLE `������`; DROP TABLE `������`; @@ -433,77 +433,77 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `��ݏ�ݏ��`; Table Create Table ��ݏ�ݏ�� CREATE TABLE `��ݏ�ݏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `��ޏ�ޏ��`; Table Create Table ��ޏ�ޏ�� CREATE TABLE `��ޏ�ޏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `��ߏ�ߏ��`; Table Create Table ��ߏ�ߏ�� CREATE TABLE `��ߏ�ߏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `���������`; Table Create Table ��������� CREATE TEMPORARY TABLE `���������` ( `���������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�������`; Table Create Table ������� CREATE TEMPORARY TABLE `�������` ( `���������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci DROP TABLE `������`; DROP TABLE `������`; DROP TABLE `������`; diff --git a/mysql-test/suite/jp/r/jp_create_tbl_ujis.result b/mysql-test/suite/jp/r/jp_create_tbl_ujis.result index f79e131ec5f60..d1f247fc5fe32 100644 --- a/mysql-test/suite/jp/r/jp_create_tbl_ujis.result +++ b/mysql-test/suite/jp/r/jp_create_tbl_ujis.result @@ -97,77 +97,77 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `��ݏ�ݏ��`; Table Create Table ��ݏ�ݏ�� CREATE TABLE `��ݏ�ݏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `��ޏ�ޏ��`; Table Create Table ��ޏ�ޏ�� CREATE TABLE `��ޏ�ޏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `��ߏ�ߏ��`; Table Create Table ��ߏ�ߏ�� CREATE TABLE `��ߏ�ߏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `���������`; Table Create Table ��������� CREATE TEMPORARY TABLE `���������` ( `���������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�������`; Table Create Table ������� CREATE TEMPORARY TABLE `�������` ( `���������` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci DROP TABLE `������`; DROP TABLE `������`; DROP TABLE `������`; @@ -265,77 +265,77 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `��ݏ�ݏ��`; Table Create Table ��ݏ�ݏ�� CREATE TABLE `��ݏ�ݏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `��ޏ�ޏ��`; Table Create Table ��ޏ�ޏ�� CREATE TABLE `��ޏ�ޏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `��ߏ�ߏ��`; Table Create Table ��ߏ�ߏ�� CREATE TABLE `��ߏ�ߏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `���������`; Table Create Table ��������� CREATE TEMPORARY TABLE `���������` ( `���������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�������`; Table Create Table ������� CREATE TEMPORARY TABLE `�������` ( `���������` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci DROP TABLE `������`; DROP TABLE `������`; DROP TABLE `������`; @@ -433,77 +433,77 @@ SHOW CREATE TABLE ` Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `������`; Table Create Table ������ CREATE TEMPORARY TABLE `������` ( `������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `��ݏ�ݏ��`; Table Create Table ��ݏ�ݏ�� CREATE TABLE `��ݏ�ݏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `��ޏ�ޏ��`; Table Create Table ��ޏ�ޏ�� CREATE TABLE `��ޏ�ޏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `��ߏ�ߏ��`; Table Create Table ��ߏ�ߏ�� CREATE TABLE `��ߏ�ߏ��` ( `���������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `���������`; Table Create Table ��������� CREATE TEMPORARY TABLE `���������` ( `���������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�������`; Table Create Table ������� CREATE TEMPORARY TABLE `�������` ( `���������` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci DROP TABLE `������`; DROP TABLE `������`; DROP TABLE `������`; diff --git a/mysql-test/suite/jp/r/jp_create_tbl_utf8.result b/mysql-test/suite/jp/r/jp_create_tbl_utf8.result index 0e528db8c583d..13958490aa745 100644 --- a/mysql-test/suite/jp/r/jp_create_tbl_utf8.result +++ b/mysql-test/suite/jp/r/jp_create_tbl_utf8.result @@ -97,77 +97,77 @@ SHOW CREATE TABLE `アアア`; Table Create Table アアア CREATE TABLE `アアア` ( `カカカ` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `イイイ`; Table Create Table イイイ CREATE TABLE `イイイ` ( `キキキ` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `ウウウ`; Table Create Table ウウウ CREATE TABLE `ウウウ` ( `ククク` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `エエエ`; Table Create Table エエエ CREATE TEMPORARY TABLE `エエエ` ( `ケケケ` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `オオオ`; Table Create Table オオオ CREATE TEMPORARY TABLE `オオオ` ( `コココ` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `あああ`; Table Create Table あああ CREATE TABLE `あああ` ( `かかか` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `いいい`; Table Create Table いいい CREATE TABLE `いいい` ( `ききき` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `ううう`; Table Create Table ううう CREATE TABLE `ううう` ( `くくく` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `えええ`; Table Create Table えええ CREATE TEMPORARY TABLE `えええ` ( `けけけ` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `おおお`; Table Create Table おおお CREATE TEMPORARY TABLE `おおお` ( `こここ` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `龖龖龖`; Table Create Table 龖龖龖 CREATE TABLE `龖龖龖` ( `丂丂丂` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `龗龗龗`; Table Create Table 龗龗龗 CREATE TABLE `龗龗龗` ( `丄丄丄` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `龞龞龞`; Table Create Table 龞龞龞 CREATE TABLE `龞龞龞` ( `丅丅丅` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `龡龡龡`; Table Create Table 龡龡龡 CREATE TEMPORARY TABLE `龡龡龡` ( `丌丌丌` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `龢龢龢`; Table Create Table 龢龢龢 CREATE TEMPORARY TABLE `龢龢龢` ( `丒丒丒` char(1) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE `アアア`; DROP TABLE `イイイ`; DROP TABLE `ウウウ`; @@ -265,77 +265,77 @@ SHOW CREATE TABLE `アアア`; Table Create Table アアア CREATE TABLE `アアア` ( `カカカ` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `イイイ`; Table Create Table イイイ CREATE TABLE `イイイ` ( `キキキ` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `ウウウ`; Table Create Table ウウウ CREATE TABLE `ウウウ` ( `ククク` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `エエエ`; Table Create Table エエエ CREATE TEMPORARY TABLE `エエエ` ( `ケケケ` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `オオオ`; Table Create Table オオオ CREATE TEMPORARY TABLE `オオオ` ( `コココ` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `あああ`; Table Create Table あああ CREATE TABLE `あああ` ( `かかか` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `いいい`; Table Create Table いいい CREATE TABLE `いいい` ( `ききき` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `ううう`; Table Create Table ううう CREATE TABLE `ううう` ( `くくく` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `えええ`; Table Create Table えええ CREATE TEMPORARY TABLE `えええ` ( `けけけ` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `おおお`; Table Create Table おおお CREATE TEMPORARY TABLE `おおお` ( `こここ` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `龖龖龖`; Table Create Table 龖龖龖 CREATE TABLE `龖龖龖` ( `丂丂丂` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `龗龗龗`; Table Create Table 龗龗龗 CREATE TABLE `龗龗龗` ( `丄丄丄` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `龞龞龞`; Table Create Table 龞龞龞 CREATE TABLE `龞龞龞` ( `丅丅丅` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `龡龡龡`; Table Create Table 龡龡龡 CREATE TEMPORARY TABLE `龡龡龡` ( `丌丌丌` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `龢龢龢`; Table Create Table 龢龢龢 CREATE TEMPORARY TABLE `龢龢龢` ( `丒丒丒` char(1) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE `アアア`; DROP TABLE `イイイ`; DROP TABLE `ウウウ`; @@ -433,77 +433,77 @@ SHOW CREATE TABLE `アアア`; Table Create Table アアア CREATE TABLE `アアア` ( `カカカ` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `イイイ`; Table Create Table イイイ CREATE TABLE `イイイ` ( `キキキ` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `ウウウ`; Table Create Table ウウウ CREATE TABLE `ウウウ` ( `ククク` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `エエエ`; Table Create Table エエエ CREATE TEMPORARY TABLE `エエエ` ( `ケケケ` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `オオオ`; Table Create Table オオオ CREATE TEMPORARY TABLE `オオオ` ( `コココ` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `あああ`; Table Create Table あああ CREATE TABLE `あああ` ( `かかか` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `いいい`; Table Create Table いいい CREATE TABLE `いいい` ( `ききき` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `ううう`; Table Create Table ううう CREATE TABLE `ううう` ( `くくく` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `えええ`; Table Create Table えええ CREATE TEMPORARY TABLE `えええ` ( `けけけ` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `おおお`; Table Create Table おおお CREATE TEMPORARY TABLE `おおお` ( `こここ` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `龖龖龖`; Table Create Table 龖龖龖 CREATE TABLE `龖龖龖` ( `丂丂丂` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `龗龗龗`; Table Create Table 龗龗龗 CREATE TABLE `龗龗龗` ( `丄丄丄` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `龞龞龞`; Table Create Table 龞龞龞 CREATE TABLE `龞龞龞` ( `丅丅丅` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `龡龡龡`; Table Create Table 龡龡龡 CREATE TEMPORARY TABLE `龡龡龡` ( `丌丌丌` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `龢龢龢`; Table Create Table 龢龢龢 CREATE TEMPORARY TABLE `龢龢龢` ( `丒丒丒` char(1) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE `アアア`; DROP TABLE `イイイ`; DROP TABLE `ウウウ`; diff --git a/mysql-test/suite/jp/r/jp_enum_sjis.result b/mysql-test/suite/jp/r/jp_enum_sjis.result index cc68c1536a050..0ea3f751333ad 100644 --- a/mysql-test/suite/jp/r/jp_enum_sjis.result +++ b/mysql-test/suite/jp/r/jp_enum_sjis.result @@ -78,55 +78,55 @@ Table Create Table �s�P CREATE TABLE `�s�P` ( `�b�P` enum('�','�','�') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�s�Q`; Table Create Table �s�Q CREATE TABLE `�s�Q` ( `�b�P` enum('��','��','��') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�s�R`; Table Create Table �s�R CREATE TABLE `�s�R` ( `�b�P` enum('�\','�\','�\') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�s�S`; Table Create Table �s�S CREATE TABLE `�s�S` ( `�b�P` enum('�','�','�') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�s�T`; Table Create Table �s�T CREATE TABLE `�s�T` ( `�b�P` enum('��','��','��') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�s�U`; Table Create Table �s�U CREATE TABLE `�s�U` ( `�b�P` enum('�\','�\','�\') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�s�V`; Table Create Table �s�V CREATE TABLE `�s�V` ( `�b�P` enum('�','�','�') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�s�W`; Table Create Table �s�W CREATE TABLE `�s�W` ( `�b�P` enum('��','��','��') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�s�X`; Table Create Table �s�X CREATE TABLE `�s�X` ( `�b�P` enum('�\','�\','�\') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci DESC `�s�P`; Field Type Null Key Default Extra �b�P enum('�','�','�') YES MUL NULL @@ -169,63 +169,63 @@ Table Create Table `�b�Q` char(1) NOT NULL, `�b�P` enum('�','�','�') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�s�Q`; Table Create Table �s�Q CREATE TABLE `�s�Q` ( `�b�Q` char(1) NOT NULL, `�b�P` enum('��','��','��') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�s�R`; Table Create Table �s�R CREATE TABLE `�s�R` ( `�b�Q` char(1) NOT NULL, `�b�P` enum('�\','�\','�\') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=InnoDB DEFAULT CHARSET=sjis +) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�s�S`; Table Create Table �s�S CREATE TABLE `�s�S` ( `�b�Q` char(1) NOT NULL, `�b�P` enum('�','�','�') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�s�T`; Table Create Table �s�T CREATE TABLE `�s�T` ( `�b�Q` char(1) NOT NULL, `�b�P` enum('��','��','��') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�s�U`; Table Create Table �s�U CREATE TABLE `�s�U` ( `�b�Q` char(1) NOT NULL, `�b�P` enum('�\','�\','�\') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=MyISAM DEFAULT CHARSET=sjis +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�s�V`; Table Create Table �s�V CREATE TABLE `�s�V` ( `�b�Q` char(1) NOT NULL, `�b�P` enum('�','�','�') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�s�W`; Table Create Table �s�W CREATE TABLE `�s�W` ( `�b�Q` char(1) NOT NULL, `�b�P` enum('��','��','��') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci SHOW CREATE TABLE `�s�X`; Table Create Table �s�X CREATE TABLE `�s�X` ( `�b�Q` char(1) NOT NULL, `�b�P` enum('�\','�\','�\') DEFAULT NULL, KEY `�b�P` (`�b�P`) -) ENGINE=MEMORY DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci CREATE TABLE t1(c1 enum('�S','�s')) default character set = sjis; INSERT INTO t1 VALUES('�S'),('�s'); SELECT * FROM t1 WHERE c1 LIKE '�S'; diff --git a/mysql-test/suite/jp/r/jp_enum_ucs2.result b/mysql-test/suite/jp/r/jp_enum_ucs2.result index cb0726cd623b4..683c0458dd830 100644 --- a/mysql-test/suite/jp/r/jp_enum_ucs2.result +++ b/mysql-test/suite/jp/r/jp_enum_ucs2.result @@ -78,55 +78,55 @@ Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('���','���','���') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('���','���','���') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('���','���','���') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci DESC `�ԣ�`; Field Type Null Key Default Extra �ã� enum('��','��','��') YES MUL NULL @@ -169,63 +169,63 @@ Table Create Table `�ã�` char(1) NOT NULL, `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` char(1) NOT NULL, `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` char(1) NOT NULL, `�ã�` enum('���','���','���') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` char(1) NOT NULL, `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` char(1) NOT NULL, `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` char(1) NOT NULL, `�ã�` enum('���','���','���') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` char(1) NOT NULL, `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` char(1) NOT NULL, `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` char(1) NOT NULL, `�ã�` enum('���','���','���') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MEMORY DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci DESC `�ԣ�`; Field Type Null Key Default Extra �ã� char(1) NO NULL diff --git a/mysql-test/suite/jp/r/jp_enum_ujis.result b/mysql-test/suite/jp/r/jp_enum_ujis.result index 217c7e0e6556b..8221c1c81bfea 100644 --- a/mysql-test/suite/jp/r/jp_enum_ujis.result +++ b/mysql-test/suite/jp/r/jp_enum_ujis.result @@ -77,55 +77,55 @@ Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('���','���','���') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('���','���','���') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` enum('���','���','���') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci DESC `�ԣ�`; Field Type Null Key Default Extra �ã� enum('��','��','��') YES MUL NULL @@ -168,63 +168,63 @@ Table Create Table `�ã�` char(1) NOT NULL, `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` char(1) NOT NULL, `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` char(1) NOT NULL, `�ã�` enum('���','���','���') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=InnoDB DEFAULT CHARSET=ujis +) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` char(1) NOT NULL, `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` char(1) NOT NULL, `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` char(1) NOT NULL, `�ã�` enum('���','���','���') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MyISAM DEFAULT CHARSET=ujis +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` char(1) NOT NULL, `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` char(1) NOT NULL, `�ã�` enum('��','��','��') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci SHOW CREATE TABLE `�ԣ�`; Table Create Table �ԣ� CREATE TABLE `�ԣ�` ( `�ã�` char(1) NOT NULL, `�ã�` enum('���','���','���') DEFAULT NULL, KEY `�ã�` (`�ã�`) -) ENGINE=MEMORY DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci DESC `�ԣ�`; Field Type Null Key Default Extra �ã� char(1) NO NULL diff --git a/mysql-test/suite/jp/r/jp_enum_utf8.result b/mysql-test/suite/jp/r/jp_enum_utf8.result index f39a2a39b9579..c6e3567e114bb 100644 --- a/mysql-test/suite/jp/r/jp_enum_utf8.result +++ b/mysql-test/suite/jp/r/jp_enum_utf8.result @@ -77,55 +77,55 @@ Table Create Table T1 CREATE TABLE `T1` ( `C1` enum('ア','イ','ウ') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `T2`; Table Create Table T2 CREATE TABLE `T2` ( `C1` enum('あ','い','う') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `T3`; Table Create Table T3 CREATE TABLE `T3` ( `C1` enum('龔','龖','龗') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `T4`; Table Create Table T4 CREATE TABLE `T4` ( `C1` enum('ア','イ','ウ') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `T5`; Table Create Table T5 CREATE TABLE `T5` ( `C1` enum('あ','い','う') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `T6`; Table Create Table T6 CREATE TABLE `T6` ( `C1` enum('龔','龖','龗') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `T7`; Table Create Table T7 CREATE TABLE `T7` ( `C1` enum('ア','イ','ウ') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `T8`; Table Create Table T8 CREATE TABLE `T8` ( `C1` enum('あ','い','う') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `T9`; Table Create Table T9 CREATE TABLE `T9` ( `C1` enum('龔','龖','龗') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DESC `T1`; Field Type Null Key Default Extra C1 enum('ア','イ','ウ') YES MUL NULL @@ -168,63 +168,63 @@ Table Create Table `C2` char(1) NOT NULL, `C1` enum('ア','イ','ウ') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `T2`; Table Create Table T2 CREATE TABLE `T2` ( `C2` char(1) NOT NULL, `C1` enum('あ','い','う') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `T3`; Table Create Table T3 CREATE TABLE `T3` ( `C2` char(1) NOT NULL, `C1` enum('龔','龖','龗') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `T4`; Table Create Table T4 CREATE TABLE `T4` ( `C2` char(1) NOT NULL, `C1` enum('ア','イ','ウ') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `T5`; Table Create Table T5 CREATE TABLE `T5` ( `C2` char(1) NOT NULL, `C1` enum('あ','い','う') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `T6`; Table Create Table T6 CREATE TABLE `T6` ( `C2` char(1) NOT NULL, `C1` enum('龔','龖','龗') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `T7`; Table Create Table T7 CREATE TABLE `T7` ( `C2` char(1) NOT NULL, `C1` enum('ア','イ','ウ') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `T8`; Table Create Table T8 CREATE TABLE `T8` ( `C2` char(1) NOT NULL, `C1` enum('あ','い','う') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE `T9`; Table Create Table T9 CREATE TABLE `T9` ( `C2` char(1) NOT NULL, `C1` enum('龔','龖','龗') DEFAULT NULL, KEY `C1` (`C1`) -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DESC `T1`; Field Type Null Key Default Extra C2 char(1) NO NULL diff --git a/mysql-test/suite/json/r/json_no_table.result b/mysql-test/suite/json/r/json_no_table.result index 6784fe6da32c6..10dd5d4b4caf3 100644 --- a/mysql-test/suite/json/r/json_no_table.result +++ b/mysql-test/suite/json/r/json_no_table.result @@ -3338,7 +3338,7 @@ OBJECT CREATE VIEW v1 AS SELECT JSON_TYPE(JSON_OBJECT()); SELECT * FROM v1; JSON_TYPE(JSON_OBJECT()) -OBJE +OBJECT drop view v1; # # Bug#21198333 SIG 6 IN ITEM_CACHE_JSON::CACHE_VALUE AT SQL/ITEM.CC:9470 diff --git a/mysql-test/suite/json/r/json_table.result b/mysql-test/suite/json/r/json_table.result index 444f7441e4bae..b71cc95a4e302 100644 --- a/mysql-test/suite/json/r/json_table.result +++ b/mysql-test/suite/json/r/json_table.result @@ -57,14 +57,14 @@ Jeans {"color": "blue", "price": 50} blue select * from t1 right join json_table(t1.item_props,'$' columns( color varchar(100) path '$.color')) as T on 1; ERROR 42S22: Unknown column 't1.item_props' in 'JSON_TABLE argument' DROP TABLE t1; -select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default '101' on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; +select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default 101 on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; a b 101 11 101 111 2 22 2 222 3 NULL -select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default '202' on error, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; +select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default 202 on error, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; a b NULL 11 NULL 111 @@ -269,8 +269,8 @@ from t1, json_table(t1.json, '$' columns (value varchar(32) PATH '$.value')) T; show create table tj1; Table Create Table tj1 CREATE TABLE `tj1` ( - `value` varchar(32) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `value` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; drop table tj1; CREATE TABLE t1(id INT, f1 JSON); @@ -957,6 +957,63 @@ converted original Warnings: Warning 1264 Out of range value for column 'converted' at row 2 Warning 1366 Incorrect integer value: 'foo' for column ``.`(temporary)`.`converted` at row 3 +select * from +json_table('[{"color": "blue", "price": { "high": 10, "low": 5}}, + {"color": "white", "price": "pretty low"}, + {"color": "yellow", "price": 256.20}, + {"color": "red", "price": { "high": 20, "low": 8}}]', +'$[*]' columns(color varchar(100) path '$.color', +price json path '$.price' + ) +) as T; +color price +blue { "high": 10, "low": 5} +white "pretty low" +yellow 256.20 +red { "high": 20, "low": 8} +# +# MDEV-27696 Json table columns accept redundant COLLATE syntax +# +SELECT * FROM json_table('[{"name":"str"}]', '$[*]' + COLUMNS ( +name BLOB COLLATE `binary` PATH '$.name' + ) +) AS jt; +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 'COLLATE `binary` PATH '$.name' + ) +) AS jt' at line 3 +SELECT * FROM json_table('[{"name":"str"}]', '$[*]' + COLUMNS ( +name VARCHAR(10) COLLATE latin1_bin COLLATE latin1_swedish_ci PATH '$.name' + ) +) AS jt; +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 'COLLATE latin1_swedish_ci PATH '$.name' + ) +) AS jt' at line 3 +SELECT * FROM json_table('[{"name":"str"}]', '$[*]' + COLUMNS ( +name VARCHAR(10) BINARY COLLATE utf8_czech_ci path '$.name' + ) +) AS jt; +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 'COLLATE utf8_czech_ci path '$.name' + ) +) AS jt' at line 3 +# +# MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition +# +SELECT * FROM json_table('[{"name":"Jeans"}]', '$[*]' + COLUMNS( +name VARCHAR(10) CHARACTER SET latin1 COLLATE DEFAULT PATH '$.name' + ) +) AS jt; +name +Jeans +# +# MDEV-28480: Assertion `0' failed in Item_row::illegal_method_call +# on SELECT FROM JSON_TABLE +# +SELECT 1 FROM JSON_TABLE (row(1,2), '$' COLUMNS (o FOR ORDINALITY)) AS j; +ERROR 21000: Operand should contain 1 column(s) # # End of 10.6 tests # diff --git a/mysql-test/suite/json/r/json_table_mysql.result b/mysql-test/suite/json/r/json_table_mysql.result index ca9ef4793a5e8..2357d9d3cf023 100644 --- a/mysql-test/suite/json/r/json_table_mysql.result +++ b/mysql-test/suite/json/r/json_table_mysql.result @@ -40,7 +40,7 @@ id jpath jsn_path jexst 2 2 2 0 3 33 {"x":33} 1 4 0 0 0 -5 66 NULL 0 +5 66 [1,2] 0 select * from json_table( '[{"a":"3"},{"a":2},{"b":1},{"a":0.33},{"a":"asd"}]', @@ -55,11 +55,11 @@ jsn_path json path '$.a' default '{"x":33}' on empty, jexst int exists path '$.b') ) as tt; id jpath_i jpath_r jsn_path jexst -1 3 3 3 0 +1 3 3 "3" 0 2 2 2 2 0 3 33 33.3 {"x":33} 1 4 0 0.33 0.33 0 -5 0 0 asd 0 +5 0 0 "asd" 0 Warnings: Warning 1366 Incorrect integer value: 'asd' for column ``.`(temporary)`.`jpath_i` at row 5 Warning 1366 Incorrect double value: 'asd' for column ``.`(temporary)`.`jpath_r` at row 5 @@ -78,7 +78,7 @@ id jpath jsn_path jexst 2 2 2 0 3 33 {"x":33} 1 4 0 0 0 -5 66 NULL 0 +5 66 [1,2] 0 select * from json_table( '[{"a":"3"},{"a":2},{"b":1},{"a":0}]', @@ -88,7 +88,7 @@ json_path json path '$.a', jexst int exists path '$.b') ) as tt; id jpath json_path jexst -1 3 3 0 +1 3 "3" 0 2 2 2 0 3 NULL NULL 1 4 0 0 0 @@ -319,24 +319,24 @@ id1 jpath jexst id2 id3 jpath_3 id4 jpath_4 1 3 0 2 1 a1 NULL NULL 1 3 0 2 2 a2 NULL NULL 1 3 0 3 1 c NULL NULL -1 3 0 NULL NULL NULL 1 NULL -1 3 0 NULL NULL NULL 2 NULL -1 3 0 NULL NULL NULL 3 NULL +1 3 0 NULL NULL NULL 1 {"ll":["b1","b2","b3"]} +1 3 0 NULL NULL NULL 2 {"ll": ["a1","a2"]} +1 3 0 NULL NULL NULL 3 {"ll":["c"]} 2 2 0 1 1 1 NULL NULL 2 2 0 1 2 11 NULL NULL 2 2 0 1 3 111 NULL NULL 2 2 0 2 1 2 NULL NULL -2 2 0 NULL NULL NULL 1 NULL -2 2 0 NULL NULL NULL 2 NULL +2 2 0 NULL NULL NULL 1 {"ll":[1,11,111]} +2 2 0 NULL NULL NULL 2 {"ll":[2]} 3 NULL 1 1 1 zzz NULL NULL -3 NULL 1 NULL NULL NULL 1 NULL +3 NULL 1 NULL NULL NULL 1 {"ll":["zzz"]} 4 0 0 1 1 0.1 NULL NULL 4 0 0 1 2 0.01 NULL NULL 4 0 0 2 1 0.02 NULL NULL 4 0 0 2 2 0.002 NULL NULL 4 0 0 2 3 0.0002 NULL NULL -4 0 0 NULL NULL NULL 1 NULL -4 0 0 NULL NULL NULL 2 NULL +4 0 0 NULL NULL NULL 1 {"ll":[0.1,0.01]} +4 0 0 NULL NULL NULL 2 {"ll":[0.02,0.002,0.0002]} ord should be 1,1,1,2, which tells that first two values of 'l' are from the same object, and next two are from different objects SELECT * @@ -555,10 +555,12 @@ JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON ERROR)) jt; 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 'NULL ON ERROR)) jt' at line 2 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON EMPTY)) jt; -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 '0 ON EMPTY)) jt' at line 2 +x +0 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON ERROR)) jt; -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 '0 ON ERROR)) jt' at line 2 +x +NULL SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x DATE PATH '$.x' @@ -608,7 +610,7 @@ SELECT * FROM JSON_TABLE('{"a":"1"}', o FOR ORDINALITY)) AS jt WHERE o = 1; jpath o -1 1 +"1" 1 # # Bug#25427982: ASSERTION `DERIVED' FAILED IN SQL/TABLE.H # @@ -1385,7 +1387,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` bigint(20) unsigned DEFAULT NULL, `value` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Bug#28255453: VIEW USING JSON_TABLE FAILS IF NO SCHEMA IS SELECTED @@ -1448,8 +1450,8 @@ PATH '$')) AS jt1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `x` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `x` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Bug#28643862 JSON_TABLE'S "COLUMNS" CLAUSE USES @@ -1461,16 +1463,16 @@ FROM JSON_TABLE('"test"', '$' COLUMNS(col VARCHAR(10) PATH '$')) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `col` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `col` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET @@SESSION.collation_connection = latin1_bin; CREATE TABLE t2 SELECT a.col FROM JSON_TABLE('"test"', '$' COLUMNS(col VARCHAR(10) PATH '$')) AS a; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `col` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `col` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; SET @@SESSION.character_set_connection = DEFAULT; # diff --git a/mysql-test/suite/json/r/rpl_json_char.result b/mysql-test/suite/json/r/rpl_json_char.result new file mode 100644 index 0000000000000..91da1cdd617e3 --- /dev/null +++ b/mysql-test/suite/json/r/rpl_json_char.result @@ -0,0 +1,22 @@ +include/master-slave.inc +[connection master] +# +# Start of 10.5 tests +# +# +# MDEV-27018 IF and COALESCE lose "json" property +# +CREATE TABLE t1 (a CHAR(100) CHECK(JSON_VALID(a))); +connection slave; +connection master; +INSERT INTO t1 VALUES (JSON_OBJECT('a','b')); +connection slave; +SELECT * FROM t1 ORDER BY a; +a +{"a": "b"} +connection master; +DROP TABLE t1; +# +# End of 10.5 tests +# +include/rpl_end.inc diff --git a/mysql-test/suite/json/r/rpl_json_longtext.result b/mysql-test/suite/json/r/rpl_json_longtext.result new file mode 100644 index 0000000000000..8d7f2a546aa9a --- /dev/null +++ b/mysql-test/suite/json/r/rpl_json_longtext.result @@ -0,0 +1,22 @@ +include/master-slave.inc +[connection master] +# +# Start of 10.5 tests +# +# +# MDEV-27018 IF and COALESCE lose "json" property +# +CREATE TABLE t1 (a LONGTEXT CHECK(JSON_VALID(a))); +connection slave; +connection master; +INSERT INTO t1 VALUES (JSON_OBJECT('a','b')); +connection slave; +SELECT * FROM t1 ORDER BY a; +a +{"a": "b"} +connection master; +DROP TABLE t1; +# +# End of 10.5 tests +# +include/rpl_end.inc diff --git a/mysql-test/suite/json/r/rpl_json_mediumtext.result b/mysql-test/suite/json/r/rpl_json_mediumtext.result new file mode 100644 index 0000000000000..4cb1a87f47325 --- /dev/null +++ b/mysql-test/suite/json/r/rpl_json_mediumtext.result @@ -0,0 +1,22 @@ +include/master-slave.inc +[connection master] +# +# Start of 10.5 tests +# +# +# MDEV-27018 IF and COALESCE lose "json" property +# +CREATE TABLE t1 (a MEDIUMTEXT CHECK(JSON_VALID(a))); +connection slave; +connection master; +INSERT INTO t1 VALUES (JSON_OBJECT('a','b')); +connection slave; +SELECT * FROM t1 ORDER BY a; +a +{"a": "b"} +connection master; +DROP TABLE t1; +# +# End of 10.5 tests +# +include/rpl_end.inc diff --git a/mysql-test/suite/json/r/rpl_json_text.result b/mysql-test/suite/json/r/rpl_json_text.result new file mode 100644 index 0000000000000..4c0bac8747103 --- /dev/null +++ b/mysql-test/suite/json/r/rpl_json_text.result @@ -0,0 +1,22 @@ +include/master-slave.inc +[connection master] +# +# Start of 10.5 tests +# +# +# MDEV-27018 IF and COALESCE lose "json" property +# +CREATE TABLE t1 (a TEXT CHECK(JSON_VALID(a))); +connection slave; +connection master; +INSERT INTO t1 VALUES (JSON_OBJECT('a','b')); +connection slave; +SELECT * FROM t1 ORDER BY a; +a +{"a": "b"} +connection master; +DROP TABLE t1; +# +# End of 10.5 tests +# +include/rpl_end.inc diff --git a/mysql-test/suite/json/r/rpl_json_tinytext.result b/mysql-test/suite/json/r/rpl_json_tinytext.result new file mode 100644 index 0000000000000..92b228c3438dc --- /dev/null +++ b/mysql-test/suite/json/r/rpl_json_tinytext.result @@ -0,0 +1,22 @@ +include/master-slave.inc +[connection master] +# +# Start of 10.5 tests +# +# +# MDEV-27018 IF and COALESCE lose "json" property +# +CREATE TABLE t1 (a TINYTEXT CHECK(JSON_VALID(a))); +connection slave; +connection master; +INSERT INTO t1 VALUES (JSON_OBJECT('a','b')); +connection slave; +SELECT * FROM t1 ORDER BY a; +a +{"a": "b"} +connection master; +DROP TABLE t1; +# +# End of 10.5 tests +# +include/rpl_end.inc diff --git a/mysql-test/suite/json/r/rpl_json_varchar.result b/mysql-test/suite/json/r/rpl_json_varchar.result new file mode 100644 index 0000000000000..3adbe3ebb48e8 --- /dev/null +++ b/mysql-test/suite/json/r/rpl_json_varchar.result @@ -0,0 +1,22 @@ +include/master-slave.inc +[connection master] +# +# Start of 10.5 tests +# +# +# MDEV-27018 IF and COALESCE lose "json" property +# +CREATE TABLE t1 (a VARCHAR(100) CHECK(JSON_VALID(a))); +connection slave; +connection master; +INSERT INTO t1 VALUES (JSON_OBJECT('a','b')); +connection slave; +SELECT * FROM t1 ORDER BY a; +a +{"a": "b"} +connection master; +DROP TABLE t1; +# +# End of 10.5 tests +# +include/rpl_end.inc diff --git a/mysql-test/suite/json/r/type_json.result b/mysql-test/suite/json/r/type_json.result new file mode 100644 index 0000000000000..333e933eda96f --- /dev/null +++ b/mysql-test/suite/json/r/type_json.result @@ -0,0 +1,2884 @@ +# +# Start of 10.5 tests +# +# +# MDEV-27361 Hybrid functions with JSON arguments do not send format metadata +# +CREATE PROCEDURE p1(tbl TEXT, expr TEXT) +BEGIN +DECLARE t1cols INT DEFAULT (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS +WHERE TABLE_NAME=tbl AND TABLE_SCHEMA='test'); +FOR a IN 0..(t1cols-1) DO +FOR b IN 0..(t1cols-1) DO +BEGIN +DECLARE query TEXT DEFAULT CONCAT('SELECT ', expr, ' FROM ', tbl); +SET query= REPLACE(query, 'olt1', a); +SET query= REPLACE(query, 'olt2', b); +EXECUTE IMMEDIATE query; +END; +END FOR; +END FOR; +END; +$$ +CREATE PROCEDURE p2(expr TEXT) +BEGIN +DECLARE t1cols INT DEFAULT (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS +WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'); +DECLARE t2cols INT DEFAULT (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS +WHERE TABLE_NAME='t2' AND TABLE_SCHEMA='test'); +FOR a IN 0..(t1cols-1) DO +FOR b IN 0..(t2cols-1) DO +BEGIN +DECLARE query TEXT DEFAULT CONCAT('SELECT ', expr, ' FROM t1, t2'); +SET query= REPLACE(query, 'olt1', a); +SET query= REPLACE(query, 'olt2', b); +EXECUTE IMMEDIATE query; +END; +END FOR; +END FOR; +END; +$$ +CREATE TABLE t1 +( +c0 CHAR(30) DEFAULT '1' CHECK(JSON_VALID(c0)), +c1 VARCHAR(30) DEFAULT '1' CHECK(JSON_VALID(c1)), +c2 TINYTEXT DEFAULT '1' CHECK(JSON_VALID(c2)), +c3 TEXT DEFAULT '1' CHECK(JSON_VALID(c3)), +c4 MEDIUMTEXT DEFAULT '1' CHECK(JSON_VALID(c4)), +c5 LONGTEXT DEFAULT '1' CHECK(JSON_VALID(c5)), +# The below data types do not have any special JSON properties. +# Just checking CHECK(JSON_VALID()) does not give any unexpected surprises. +c6 INT DEFAULT '1' CHECK(JSON_VALID(c6)), +c7 ENUM('1') DEFAULT '1' CHECK(JSON_VALID(c7)) +); +INSERT INTO t1 VALUES (); +CREATE TABLE t1c +( +c0 CHAR(30) DEFAULT '1' CHECK(JSON_VALID(c0)), +c1 VARCHAR(30) COMPRESSED DEFAULT '1' CHECK(JSON_VALID(c1)), +c2 TINYTEXT COMPRESSED DEFAULT '1' CHECK(JSON_VALID(c2)), +c3 TEXT COMPRESSED DEFAULT '1' CHECK(JSON_VALID(c3)), +c4 MEDIUMTEXT COMPRESSED DEFAULT '1' CHECK(JSON_VALID(c4)), +c5 LONGTEXT COMPRESSED DEFAULT '1' CHECK(JSON_VALID(c5)), +# The below data types do not have any special JSON properties. +# Just checking CHECK(JSON_VALID()) does not give any unexpected surprises. +c6 INT DEFAULT '1' CHECK(JSON_VALID(c6)), +c7 ENUM('1') DEFAULT '1' CHECK(JSON_VALID(c7)) +); +INSERT INTO t1c VALUES (); +CREATE TABLE t2 +( +c0 CHAR(30) DEFAULT '1', +c1 VARCHAR(30) DEFAULT '1', +c2 TINYTEXT DEFAULT '1', +c3 TEXT DEFAULT '1', +c4 MEDIUMTEXT DEFAULT '1', +c5 LONGTEXT DEFAULT '1', +c6 INT DEFAULT 1, +c7 DOUBLE DEFAULT 1, +c8 DECIMAL(10,2) DEFAULT 1.23, +c9 TIME DEFAULT '10:20:30', +c10 DATE DEFAULT '2001-01-01', +c11 DATETIME DEFAULT '2001-01-01 10:20:30', +c12 ENUM('1','2') DEFAULT '1' +); +INSERT INTO t2 VALUES (); +CALL p1('t1', 'COALESCE(colt1, colt2)'); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c0, c0) 254 (format=json) 30 1 Y 0 39 8 +COALESCE(c0, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c0, c1) 253 (format=json) 30 1 Y 0 39 8 +COALESCE(c0, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c0, c2) 249 (format=json) 255 1 Y 0 39 8 +COALESCE(c0, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c0, c3) 252 (format=json) 65535 1 Y 0 39 8 +COALESCE(c0, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c0, c4) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c0, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c0, c5) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c0, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c0, c6) 254 30 1 Y 0 39 8 +COALESCE(c0, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c0, c7) 253 30 1 Y 0 39 8 +COALESCE(c0, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c1, c0) 253 (format=json) 30 1 Y 0 39 8 +COALESCE(c1, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c1, c1) 253 (format=json) 30 1 Y 0 39 8 +COALESCE(c1, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c1, c2) 249 (format=json) 255 1 Y 0 39 8 +COALESCE(c1, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c1, c3) 252 (format=json) 65535 1 Y 0 39 8 +COALESCE(c1, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c1, c4) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c1, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c1, c5) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c1, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c1, c6) 253 30 1 Y 0 39 8 +COALESCE(c1, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c1, c7) 253 30 1 Y 0 39 8 +COALESCE(c1, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c2, c0) 249 (format=json) 255 1 Y 0 39 8 +COALESCE(c2, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c2, c1) 249 (format=json) 255 1 Y 0 39 8 +COALESCE(c2, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c2, c2) 249 (format=json) 255 1 Y 0 39 8 +COALESCE(c2, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c2, c3) 252 (format=json) 65535 1 Y 0 39 8 +COALESCE(c2, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c2, c4) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c2, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c2, c5) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c2, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c2, c6) 249 255 1 Y 0 39 8 +COALESCE(c2, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c2, c7) 249 255 1 Y 0 39 8 +COALESCE(c2, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c3, c0) 252 (format=json) 65535 1 Y 0 39 8 +COALESCE(c3, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c3, c1) 252 (format=json) 65535 1 Y 0 39 8 +COALESCE(c3, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c3, c2) 252 (format=json) 65535 1 Y 0 39 8 +COALESCE(c3, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c3, c3) 252 (format=json) 65535 1 Y 0 39 8 +COALESCE(c3, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c3, c4) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c3, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c3, c5) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c3, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c3, c6) 252 65535 1 Y 0 39 8 +COALESCE(c3, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c3, c7) 252 65535 1 Y 0 39 8 +COALESCE(c3, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c4, c0) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c4, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c4, c1) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c4, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c4, c2) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c4, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c4, c3) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c4, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c4, c4) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c4, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c4, c5) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c4, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c4, c6) 250 16777215 1 Y 0 39 8 +COALESCE(c4, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c4, c7) 250 16777215 1 Y 0 39 8 +COALESCE(c4, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c5, c0) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c5, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c5, c1) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c5, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c5, c2) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c5, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c5, c3) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c5, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c5, c4) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c5, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c5, c5) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c5, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c5, c6) 251 4294967295 1 Y 0 39 8 +COALESCE(c5, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c5, c7) 251 4294967295 1 Y 0 39 8 +COALESCE(c5, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c6, c0) 254 30 1 Y 0 39 8 +COALESCE(c6, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c6, c1) 253 30 1 Y 0 39 8 +COALESCE(c6, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c6, c2) 249 255 1 Y 0 39 8 +COALESCE(c6, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c6, c3) 252 65535 1 Y 0 39 8 +COALESCE(c6, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c6, c4) 250 16777215 1 Y 0 39 8 +COALESCE(c6, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c6, c5) 251 4294967295 1 Y 0 39 8 +COALESCE(c6, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c6, c6) 3 11 1 Y 32896 0 63 +COALESCE(c6, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c6, c7) 253 11 1 Y 0 39 8 +COALESCE(c6, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c7, c0) 253 30 1 Y 0 39 8 +COALESCE(c7, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c7, c1) 253 30 1 Y 0 39 8 +COALESCE(c7, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c7, c2) 249 255 1 Y 0 39 8 +COALESCE(c7, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c7, c3) 252 65535 1 Y 0 39 8 +COALESCE(c7, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c7, c4) 250 16777215 1 Y 0 39 8 +COALESCE(c7, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c7, c5) 251 4294967295 1 Y 0 39 8 +COALESCE(c7, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c7, c6) 253 11 1 Y 0 39 8 +COALESCE(c7, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c7, c7) 253 1 1 Y 0 39 8 +COALESCE(c7, c7) +1 +CALL p1('t1', 'LEAST(colt1, colt2)'); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c0, c0) 254 30 1 Y 0 39 8 +LEAST(c0, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c0, c1) 253 30 1 Y 0 39 8 +LEAST(c0, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c0, c2) 249 255 1 Y 0 39 8 +LEAST(c0, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c0, c3) 252 65535 1 Y 0 39 8 +LEAST(c0, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c0, c4) 250 16777215 1 Y 0 39 8 +LEAST(c0, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c0, c5) 251 4294967295 1 Y 0 39 8 +LEAST(c0, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c0, c6) 5 23 1 Y 32896 31 63 +LEAST(c0, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c0, c7) 253 30 1 Y 0 39 8 +LEAST(c0, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c1, c0) 253 30 1 Y 0 39 8 +LEAST(c1, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c1, c1) 253 30 1 Y 0 39 8 +LEAST(c1, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c1, c2) 249 255 1 Y 0 39 8 +LEAST(c1, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c1, c3) 252 65535 1 Y 0 39 8 +LEAST(c1, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c1, c4) 250 16777215 1 Y 0 39 8 +LEAST(c1, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c1, c5) 251 4294967295 1 Y 0 39 8 +LEAST(c1, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c1, c6) 5 23 1 Y 32896 31 63 +LEAST(c1, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c1, c7) 253 30 1 Y 0 39 8 +LEAST(c1, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c2, c0) 249 255 1 Y 0 39 8 +LEAST(c2, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c2, c1) 249 255 1 Y 0 39 8 +LEAST(c2, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c2, c2) 249 255 1 Y 0 39 8 +LEAST(c2, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c2, c3) 252 65535 1 Y 0 39 8 +LEAST(c2, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c2, c4) 250 16777215 1 Y 0 39 8 +LEAST(c2, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c2, c5) 251 4294967295 1 Y 0 39 8 +LEAST(c2, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c2, c6) 5 23 1 Y 32896 31 63 +LEAST(c2, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c2, c7) 249 255 1 Y 0 39 8 +LEAST(c2, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c3, c0) 252 65535 1 Y 0 39 8 +LEAST(c3, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c3, c1) 252 65535 1 Y 0 39 8 +LEAST(c3, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c3, c2) 252 65535 1 Y 0 39 8 +LEAST(c3, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c3, c3) 252 65535 1 Y 0 39 8 +LEAST(c3, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c3, c4) 250 16777215 1 Y 0 39 8 +LEAST(c3, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c3, c5) 251 4294967295 1 Y 0 39 8 +LEAST(c3, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c3, c6) 5 23 1 Y 32896 31 63 +LEAST(c3, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c3, c7) 252 65535 1 Y 0 39 8 +LEAST(c3, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c4, c0) 250 16777215 1 Y 0 39 8 +LEAST(c4, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c4, c1) 250 16777215 1 Y 0 39 8 +LEAST(c4, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c4, c2) 250 16777215 1 Y 0 39 8 +LEAST(c4, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c4, c3) 250 16777215 1 Y 0 39 8 +LEAST(c4, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c4, c4) 250 16777215 1 Y 0 39 8 +LEAST(c4, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c4, c5) 251 4294967295 1 Y 0 39 8 +LEAST(c4, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c4, c6) 5 23 1 Y 32896 31 63 +LEAST(c4, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c4, c7) 250 16777215 1 Y 0 39 8 +LEAST(c4, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c5, c0) 251 4294967295 1 Y 0 39 8 +LEAST(c5, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c5, c1) 251 4294967295 1 Y 0 39 8 +LEAST(c5, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c5, c2) 251 4294967295 1 Y 0 39 8 +LEAST(c5, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c5, c3) 251 4294967295 1 Y 0 39 8 +LEAST(c5, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c5, c4) 251 4294967295 1 Y 0 39 8 +LEAST(c5, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c5, c5) 251 4294967295 1 Y 0 39 8 +LEAST(c5, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c5, c6) 5 23 1 Y 32896 31 63 +LEAST(c5, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c5, c7) 251 4294967295 1 Y 0 39 8 +LEAST(c5, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c6, c0) 5 23 1 Y 32896 31 63 +LEAST(c6, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c6, c1) 5 23 1 Y 32896 31 63 +LEAST(c6, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c6, c2) 5 23 1 Y 32896 31 63 +LEAST(c6, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c6, c3) 5 23 1 Y 32896 31 63 +LEAST(c6, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c6, c4) 5 23 1 Y 32896 31 63 +LEAST(c6, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c6, c5) 5 23 1 Y 32896 31 63 +LEAST(c6, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c6, c6) 3 11 1 Y 32896 0 63 +LEAST(c6, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c6, c7) 5 17 1 Y 32896 0 63 +LEAST(c6, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c7, c0) 253 30 1 Y 0 39 8 +LEAST(c7, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c7, c1) 253 30 1 Y 0 39 8 +LEAST(c7, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c7, c2) 249 255 1 Y 0 39 8 +LEAST(c7, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c7, c3) 252 65535 1 Y 0 39 8 +LEAST(c7, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c7, c4) 250 16777215 1 Y 0 39 8 +LEAST(c7, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c7, c5) 251 4294967295 1 Y 0 39 8 +LEAST(c7, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c7, c6) 5 17 1 Y 32896 0 63 +LEAST(c7, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c7, c7) 253 1 1 Y 0 39 8 +LEAST(c7, c7) +1 +CALL p1('t1', 'colt1+colt2'); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0+c0 5 23 1 Y 32896 31 63 +c0+c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0+c1 5 23 1 Y 32896 31 63 +c0+c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0+c2 5 23 1 Y 32896 31 63 +c0+c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0+c3 5 23 1 Y 32896 31 63 +c0+c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0+c4 5 23 1 Y 32896 31 63 +c0+c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0+c5 5 23 1 Y 32896 31 63 +c0+c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0+c6 5 23 1 Y 32896 31 63 +c0+c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0+c7 5 23 1 Y 32896 31 63 +c0+c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1+c0 5 23 1 Y 32896 31 63 +c1+c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1+c1 5 23 1 Y 32896 31 63 +c1+c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1+c2 5 23 1 Y 32896 31 63 +c1+c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1+c3 5 23 1 Y 32896 31 63 +c1+c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1+c4 5 23 1 Y 32896 31 63 +c1+c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1+c5 5 23 1 Y 32896 31 63 +c1+c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1+c6 5 23 1 Y 32896 31 63 +c1+c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1+c7 5 23 1 Y 32896 31 63 +c1+c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c2+c0 5 23 1 Y 32896 31 63 +c2+c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c2+c1 5 23 1 Y 32896 31 63 +c2+c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c2+c2 5 23 1 Y 32896 31 63 +c2+c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c2+c3 5 23 1 Y 32896 31 63 +c2+c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c2+c4 5 23 1 Y 32896 31 63 +c2+c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c2+c5 5 23 1 Y 32896 31 63 +c2+c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c2+c6 5 23 1 Y 32896 31 63 +c2+c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c2+c7 5 23 1 Y 32896 31 63 +c2+c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c3+c0 5 23 1 Y 32896 31 63 +c3+c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c3+c1 5 23 1 Y 32896 31 63 +c3+c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c3+c2 5 23 1 Y 32896 31 63 +c3+c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c3+c3 5 23 1 Y 32896 31 63 +c3+c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c3+c4 5 23 1 Y 32896 31 63 +c3+c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c3+c5 5 23 1 Y 32896 31 63 +c3+c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c3+c6 5 23 1 Y 32896 31 63 +c3+c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c3+c7 5 23 1 Y 32896 31 63 +c3+c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c4+c0 5 23 1 Y 32896 31 63 +c4+c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c4+c1 5 23 1 Y 32896 31 63 +c4+c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c4+c2 5 23 1 Y 32896 31 63 +c4+c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c4+c3 5 23 1 Y 32896 31 63 +c4+c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c4+c4 5 23 1 Y 32896 31 63 +c4+c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c4+c5 5 23 1 Y 32896 31 63 +c4+c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c4+c6 5 23 1 Y 32896 31 63 +c4+c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c4+c7 5 23 1 Y 32896 31 63 +c4+c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c5+c0 5 23 1 Y 32896 31 63 +c5+c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c5+c1 5 23 1 Y 32896 31 63 +c5+c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c5+c2 5 23 1 Y 32896 31 63 +c5+c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c5+c3 5 23 1 Y 32896 31 63 +c5+c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c5+c4 5 23 1 Y 32896 31 63 +c5+c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c5+c5 5 23 1 Y 32896 31 63 +c5+c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c5+c6 5 23 1 Y 32896 31 63 +c5+c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c5+c7 5 23 1 Y 32896 31 63 +c5+c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c6+c0 5 23 1 Y 32896 31 63 +c6+c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c6+c1 5 23 1 Y 32896 31 63 +c6+c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c6+c2 5 23 1 Y 32896 31 63 +c6+c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c6+c3 5 23 1 Y 32896 31 63 +c6+c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c6+c4 5 23 1 Y 32896 31 63 +c6+c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c6+c5 5 23 1 Y 32896 31 63 +c6+c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c6+c6 8 12 1 Y 32896 0 63 +c6+c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c6+c7 8 12 1 Y 32896 0 63 +c6+c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c7+c0 5 23 1 Y 32896 31 63 +c7+c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c7+c1 5 23 1 Y 32896 31 63 +c7+c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c7+c2 5 23 1 Y 32896 31 63 +c7+c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c7+c3 5 23 1 Y 32896 31 63 +c7+c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c7+c4 5 23 1 Y 32896 31 63 +c7+c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c7+c5 5 23 1 Y 32896 31 63 +c7+c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c7+c6 8 12 1 Y 32896 0 63 +c7+c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c7+c7 3 3 1 Y 32896 0 63 +c7+c7 +2 +CALL p1('t1c', 'COALESCE(colt1, colt2)'); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c0, c0) 254 (format=json) 30 1 Y 0 39 8 +COALESCE(c0, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c0, c1) 253 (format=json) 31 1 Y 0 39 8 +COALESCE(c0, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c0, c2) 249 (format=json) 255 1 Y 0 39 8 +COALESCE(c0, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c0, c3) 252 (format=json) 65535 1 Y 0 39 8 +COALESCE(c0, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c0, c4) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c0, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c0, c5) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c0, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c0, c6) 254 30 1 Y 0 39 8 +COALESCE(c0, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c0, c7) 253 30 1 Y 0 39 8 +COALESCE(c0, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c1, c0) 253 (format=json) 31 1 Y 0 39 8 +COALESCE(c1, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c1, c1) 253 (format=json) 31 1 Y 0 39 8 +COALESCE(c1, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c1, c2) 249 (format=json) 255 1 Y 0 39 8 +COALESCE(c1, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c1, c3) 252 (format=json) 65535 1 Y 0 39 8 +COALESCE(c1, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c1, c4) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c1, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c1, c5) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c1, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c1, c6) 253 31 1 Y 0 39 8 +COALESCE(c1, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c1, c7) 253 31 1 Y 0 39 8 +COALESCE(c1, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c2, c0) 249 (format=json) 255 1 Y 0 39 8 +COALESCE(c2, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c2, c1) 249 (format=json) 255 1 Y 0 39 8 +COALESCE(c2, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c2, c2) 249 (format=json) 255 1 Y 0 39 8 +COALESCE(c2, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c2, c3) 252 (format=json) 65535 1 Y 0 39 8 +COALESCE(c2, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c2, c4) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c2, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c2, c5) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c2, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c2, c6) 249 255 1 Y 0 39 8 +COALESCE(c2, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c2, c7) 249 255 1 Y 0 39 8 +COALESCE(c2, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c3, c0) 252 (format=json) 65535 1 Y 0 39 8 +COALESCE(c3, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c3, c1) 252 (format=json) 65535 1 Y 0 39 8 +COALESCE(c3, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c3, c2) 252 (format=json) 65535 1 Y 0 39 8 +COALESCE(c3, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c3, c3) 252 (format=json) 65535 1 Y 0 39 8 +COALESCE(c3, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c3, c4) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c3, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c3, c5) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c3, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c3, c6) 252 65535 1 Y 0 39 8 +COALESCE(c3, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c3, c7) 252 65535 1 Y 0 39 8 +COALESCE(c3, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c4, c0) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c4, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c4, c1) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c4, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c4, c2) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c4, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c4, c3) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c4, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c4, c4) 250 (format=json) 16777215 1 Y 0 39 8 +COALESCE(c4, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c4, c5) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c4, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c4, c6) 250 16777215 1 Y 0 39 8 +COALESCE(c4, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c4, c7) 250 16777215 1 Y 0 39 8 +COALESCE(c4, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c5, c0) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c5, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c5, c1) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c5, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c5, c2) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c5, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c5, c3) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c5, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c5, c4) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c5, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c5, c5) 251 (format=json) 4294967295 1 Y 0 39 8 +COALESCE(c5, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c5, c6) 251 4294967295 1 Y 0 39 8 +COALESCE(c5, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c5, c7) 251 4294967295 1 Y 0 39 8 +COALESCE(c5, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c6, c0) 254 30 1 Y 0 39 8 +COALESCE(c6, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c6, c1) 253 31 1 Y 0 39 8 +COALESCE(c6, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c6, c2) 249 255 1 Y 0 39 8 +COALESCE(c6, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c6, c3) 252 65535 1 Y 0 39 8 +COALESCE(c6, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c6, c4) 250 16777215 1 Y 0 39 8 +COALESCE(c6, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c6, c5) 251 4294967295 1 Y 0 39 8 +COALESCE(c6, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c6, c6) 3 11 1 Y 32896 0 63 +COALESCE(c6, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c6, c7) 253 11 1 Y 0 39 8 +COALESCE(c6, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c7, c0) 253 30 1 Y 0 39 8 +COALESCE(c7, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c7, c1) 253 31 1 Y 0 39 8 +COALESCE(c7, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c7, c2) 249 255 1 Y 0 39 8 +COALESCE(c7, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c7, c3) 252 65535 1 Y 0 39 8 +COALESCE(c7, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c7, c4) 250 16777215 1 Y 0 39 8 +COALESCE(c7, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c7, c5) 251 4294967295 1 Y 0 39 8 +COALESCE(c7, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c7, c6) 253 11 1 Y 0 39 8 +COALESCE(c7, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(c7, c7) 253 1 1 Y 0 39 8 +COALESCE(c7, c7) +1 +CALL p1('t1c', 'LEAST(colt1, colt2)'); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c0, c0) 254 30 1 Y 0 39 8 +LEAST(c0, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c0, c1) 253 31 1 Y 0 39 8 +LEAST(c0, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c0, c2) 249 255 1 Y 0 39 8 +LEAST(c0, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c0, c3) 252 65535 1 Y 0 39 8 +LEAST(c0, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c0, c4) 250 16777215 1 Y 0 39 8 +LEAST(c0, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c0, c5) 251 4294967295 1 Y 0 39 8 +LEAST(c0, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c0, c6) 5 23 1 Y 32896 31 63 +LEAST(c0, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c0, c7) 253 30 1 Y 0 39 8 +LEAST(c0, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c1, c0) 253 31 1 Y 0 39 8 +LEAST(c1, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c1, c1) 253 31 1 Y 0 39 8 +LEAST(c1, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c1, c2) 249 255 1 Y 0 39 8 +LEAST(c1, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c1, c3) 252 65535 1 Y 0 39 8 +LEAST(c1, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c1, c4) 250 16777215 1 Y 0 39 8 +LEAST(c1, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c1, c5) 251 4294967295 1 Y 0 39 8 +LEAST(c1, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c1, c6) 5 23 1 Y 32896 31 63 +LEAST(c1, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c1, c7) 253 31 1 Y 0 39 8 +LEAST(c1, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c2, c0) 249 255 1 Y 0 39 8 +LEAST(c2, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c2, c1) 249 255 1 Y 0 39 8 +LEAST(c2, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c2, c2) 249 255 1 Y 0 39 8 +LEAST(c2, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c2, c3) 252 65535 1 Y 0 39 8 +LEAST(c2, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c2, c4) 250 16777215 1 Y 0 39 8 +LEAST(c2, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c2, c5) 251 4294967295 1 Y 0 39 8 +LEAST(c2, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c2, c6) 5 23 1 Y 32896 31 63 +LEAST(c2, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c2, c7) 249 255 1 Y 0 39 8 +LEAST(c2, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c3, c0) 252 65535 1 Y 0 39 8 +LEAST(c3, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c3, c1) 252 65535 1 Y 0 39 8 +LEAST(c3, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c3, c2) 252 65535 1 Y 0 39 8 +LEAST(c3, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c3, c3) 252 65535 1 Y 0 39 8 +LEAST(c3, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c3, c4) 250 16777215 1 Y 0 39 8 +LEAST(c3, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c3, c5) 251 4294967295 1 Y 0 39 8 +LEAST(c3, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c3, c6) 5 23 1 Y 32896 31 63 +LEAST(c3, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c3, c7) 252 65535 1 Y 0 39 8 +LEAST(c3, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c4, c0) 250 16777215 1 Y 0 39 8 +LEAST(c4, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c4, c1) 250 16777215 1 Y 0 39 8 +LEAST(c4, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c4, c2) 250 16777215 1 Y 0 39 8 +LEAST(c4, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c4, c3) 250 16777215 1 Y 0 39 8 +LEAST(c4, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c4, c4) 250 16777215 1 Y 0 39 8 +LEAST(c4, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c4, c5) 251 4294967295 1 Y 0 39 8 +LEAST(c4, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c4, c6) 5 23 1 Y 32896 31 63 +LEAST(c4, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c4, c7) 250 16777215 1 Y 0 39 8 +LEAST(c4, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c5, c0) 251 4294967295 1 Y 0 39 8 +LEAST(c5, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c5, c1) 251 4294967295 1 Y 0 39 8 +LEAST(c5, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c5, c2) 251 4294967295 1 Y 0 39 8 +LEAST(c5, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c5, c3) 251 4294967295 1 Y 0 39 8 +LEAST(c5, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c5, c4) 251 4294967295 1 Y 0 39 8 +LEAST(c5, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c5, c5) 251 4294967295 1 Y 0 39 8 +LEAST(c5, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c5, c6) 5 23 1 Y 32896 31 63 +LEAST(c5, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c5, c7) 251 4294967295 1 Y 0 39 8 +LEAST(c5, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c6, c0) 5 23 1 Y 32896 31 63 +LEAST(c6, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c6, c1) 5 23 1 Y 32896 31 63 +LEAST(c6, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c6, c2) 5 23 1 Y 32896 31 63 +LEAST(c6, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c6, c3) 5 23 1 Y 32896 31 63 +LEAST(c6, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c6, c4) 5 23 1 Y 32896 31 63 +LEAST(c6, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c6, c5) 5 23 1 Y 32896 31 63 +LEAST(c6, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c6, c6) 3 11 1 Y 32896 0 63 +LEAST(c6, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c6, c7) 5 17 1 Y 32896 0 63 +LEAST(c6, c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c7, c0) 253 30 1 Y 0 39 8 +LEAST(c7, c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c7, c1) 253 31 1 Y 0 39 8 +LEAST(c7, c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c7, c2) 249 255 1 Y 0 39 8 +LEAST(c7, c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c7, c3) 252 65535 1 Y 0 39 8 +LEAST(c7, c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c7, c4) 250 16777215 1 Y 0 39 8 +LEAST(c7, c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c7, c5) 251 4294967295 1 Y 0 39 8 +LEAST(c7, c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c7, c6) 5 17 1 Y 32896 0 63 +LEAST(c7, c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(c7, c7) 253 1 1 Y 0 39 8 +LEAST(c7, c7) +1 +CALL p1('t1c', 'colt1+colt2'); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0+c0 5 23 1 Y 32896 31 63 +c0+c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0+c1 5 23 1 Y 32896 31 63 +c0+c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0+c2 5 23 1 Y 32896 31 63 +c0+c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0+c3 5 23 1 Y 32896 31 63 +c0+c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0+c4 5 23 1 Y 32896 31 63 +c0+c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0+c5 5 23 1 Y 32896 31 63 +c0+c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0+c6 5 23 1 Y 32896 31 63 +c0+c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0+c7 5 23 1 Y 32896 31 63 +c0+c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1+c0 5 23 1 Y 32896 31 63 +c1+c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1+c1 5 23 1 Y 32896 31 63 +c1+c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1+c2 5 23 1 Y 32896 31 63 +c1+c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1+c3 5 23 1 Y 32896 31 63 +c1+c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1+c4 5 23 1 Y 32896 31 63 +c1+c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1+c5 5 23 1 Y 32896 31 63 +c1+c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1+c6 5 23 1 Y 32896 31 63 +c1+c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1+c7 5 23 1 Y 32896 31 63 +c1+c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c2+c0 5 23 1 Y 32896 31 63 +c2+c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c2+c1 5 23 1 Y 32896 31 63 +c2+c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c2+c2 5 23 1 Y 32896 31 63 +c2+c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c2+c3 5 23 1 Y 32896 31 63 +c2+c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c2+c4 5 23 1 Y 32896 31 63 +c2+c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c2+c5 5 23 1 Y 32896 31 63 +c2+c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c2+c6 5 23 1 Y 32896 31 63 +c2+c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c2+c7 5 23 1 Y 32896 31 63 +c2+c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c3+c0 5 23 1 Y 32896 31 63 +c3+c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c3+c1 5 23 1 Y 32896 31 63 +c3+c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c3+c2 5 23 1 Y 32896 31 63 +c3+c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c3+c3 5 23 1 Y 32896 31 63 +c3+c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c3+c4 5 23 1 Y 32896 31 63 +c3+c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c3+c5 5 23 1 Y 32896 31 63 +c3+c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c3+c6 5 23 1 Y 32896 31 63 +c3+c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c3+c7 5 23 1 Y 32896 31 63 +c3+c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c4+c0 5 23 1 Y 32896 31 63 +c4+c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c4+c1 5 23 1 Y 32896 31 63 +c4+c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c4+c2 5 23 1 Y 32896 31 63 +c4+c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c4+c3 5 23 1 Y 32896 31 63 +c4+c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c4+c4 5 23 1 Y 32896 31 63 +c4+c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c4+c5 5 23 1 Y 32896 31 63 +c4+c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c4+c6 5 23 1 Y 32896 31 63 +c4+c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c4+c7 5 23 1 Y 32896 31 63 +c4+c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c5+c0 5 23 1 Y 32896 31 63 +c5+c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c5+c1 5 23 1 Y 32896 31 63 +c5+c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c5+c2 5 23 1 Y 32896 31 63 +c5+c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c5+c3 5 23 1 Y 32896 31 63 +c5+c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c5+c4 5 23 1 Y 32896 31 63 +c5+c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c5+c5 5 23 1 Y 32896 31 63 +c5+c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c5+c6 5 23 1 Y 32896 31 63 +c5+c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c5+c7 5 23 1 Y 32896 31 63 +c5+c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c6+c0 5 23 1 Y 32896 31 63 +c6+c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c6+c1 5 23 1 Y 32896 31 63 +c6+c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c6+c2 5 23 1 Y 32896 31 63 +c6+c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c6+c3 5 23 1 Y 32896 31 63 +c6+c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c6+c4 5 23 1 Y 32896 31 63 +c6+c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c6+c5 5 23 1 Y 32896 31 63 +c6+c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c6+c6 8 12 1 Y 32896 0 63 +c6+c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c6+c7 8 12 1 Y 32896 0 63 +c6+c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c7+c0 5 23 1 Y 32896 31 63 +c7+c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c7+c1 5 23 1 Y 32896 31 63 +c7+c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c7+c2 5 23 1 Y 32896 31 63 +c7+c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c7+c3 5 23 1 Y 32896 31 63 +c7+c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c7+c4 5 23 1 Y 32896 31 63 +c7+c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c7+c5 5 23 1 Y 32896 31 63 +c7+c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c7+c6 8 12 1 Y 32896 0 63 +c7+c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c7+c7 3 3 1 Y 32896 0 63 +c7+c7 +2 +CALL p2('COALESCE(t1.colt1, t2.colt2)'); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c0, t2.c0) 254 30 1 Y 0 39 8 +COALESCE(t1.c0, t2.c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c0, t2.c1) 253 30 1 Y 0 39 8 +COALESCE(t1.c0, t2.c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c0, t2.c2) 249 255 1 Y 0 39 8 +COALESCE(t1.c0, t2.c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c0, t2.c3) 252 65535 1 Y 0 39 8 +COALESCE(t1.c0, t2.c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c0, t2.c4) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c0, t2.c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c0, t2.c5) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c0, t2.c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c0, t2.c6) 254 30 1 Y 0 39 8 +COALESCE(t1.c0, t2.c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c0, t2.c7) 254 30 1 Y 0 39 8 +COALESCE(t1.c0, t2.c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c0, t2.c8) 254 30 1 Y 0 39 8 +COALESCE(t1.c0, t2.c8) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c0, t2.c9) 254 30 1 Y 0 39 8 +COALESCE(t1.c0, t2.c9) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c0, t2.c10) 254 30 1 Y 0 39 8 +COALESCE(t1.c0, t2.c10) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c0, t2.c11) 254 30 1 Y 0 39 8 +COALESCE(t1.c0, t2.c11) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c0, t2.c12) 253 30 1 Y 0 39 8 +COALESCE(t1.c0, t2.c12) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c1, t2.c0) 253 30 1 Y 0 39 8 +COALESCE(t1.c1, t2.c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c1, t2.c1) 253 30 1 Y 0 39 8 +COALESCE(t1.c1, t2.c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c1, t2.c2) 249 255 1 Y 0 39 8 +COALESCE(t1.c1, t2.c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c1, t2.c3) 252 65535 1 Y 0 39 8 +COALESCE(t1.c1, t2.c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c1, t2.c4) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c1, t2.c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c1, t2.c5) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c1, t2.c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c1, t2.c6) 253 30 1 Y 0 39 8 +COALESCE(t1.c1, t2.c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c1, t2.c7) 253 30 1 Y 0 39 8 +COALESCE(t1.c1, t2.c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c1, t2.c8) 253 30 1 Y 0 39 8 +COALESCE(t1.c1, t2.c8) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c1, t2.c9) 253 30 1 Y 0 39 8 +COALESCE(t1.c1, t2.c9) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c1, t2.c10) 253 30 1 Y 0 39 8 +COALESCE(t1.c1, t2.c10) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c1, t2.c11) 253 30 1 Y 0 39 8 +COALESCE(t1.c1, t2.c11) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c1, t2.c12) 253 30 1 Y 0 39 8 +COALESCE(t1.c1, t2.c12) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c2, t2.c0) 249 255 1 Y 0 39 8 +COALESCE(t1.c2, t2.c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c2, t2.c1) 249 255 1 Y 0 39 8 +COALESCE(t1.c2, t2.c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c2, t2.c2) 249 255 1 Y 0 39 8 +COALESCE(t1.c2, t2.c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c2, t2.c3) 252 65535 1 Y 0 39 8 +COALESCE(t1.c2, t2.c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c2, t2.c4) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c2, t2.c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c2, t2.c5) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c2, t2.c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c2, t2.c6) 249 255 1 Y 0 39 8 +COALESCE(t1.c2, t2.c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c2, t2.c7) 249 255 1 Y 0 39 8 +COALESCE(t1.c2, t2.c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c2, t2.c8) 249 255 1 Y 0 39 8 +COALESCE(t1.c2, t2.c8) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c2, t2.c9) 249 255 1 Y 0 39 8 +COALESCE(t1.c2, t2.c9) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c2, t2.c10) 249 255 1 Y 0 39 8 +COALESCE(t1.c2, t2.c10) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c2, t2.c11) 249 255 1 Y 0 39 8 +COALESCE(t1.c2, t2.c11) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c2, t2.c12) 249 255 1 Y 0 39 8 +COALESCE(t1.c2, t2.c12) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c3, t2.c0) 252 65535 1 Y 0 39 8 +COALESCE(t1.c3, t2.c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c3, t2.c1) 252 65535 1 Y 0 39 8 +COALESCE(t1.c3, t2.c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c3, t2.c2) 252 65535 1 Y 0 39 8 +COALESCE(t1.c3, t2.c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c3, t2.c3) 252 65535 1 Y 0 39 8 +COALESCE(t1.c3, t2.c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c3, t2.c4) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c3, t2.c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c3, t2.c5) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c3, t2.c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c3, t2.c6) 252 65535 1 Y 0 39 8 +COALESCE(t1.c3, t2.c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c3, t2.c7) 252 65535 1 Y 0 39 8 +COALESCE(t1.c3, t2.c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c3, t2.c8) 252 65535 1 Y 0 39 8 +COALESCE(t1.c3, t2.c8) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c3, t2.c9) 252 65535 1 Y 0 39 8 +COALESCE(t1.c3, t2.c9) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c3, t2.c10) 252 65535 1 Y 0 39 8 +COALESCE(t1.c3, t2.c10) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c3, t2.c11) 252 65535 1 Y 0 39 8 +COALESCE(t1.c3, t2.c11) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c3, t2.c12) 252 65535 1 Y 0 39 8 +COALESCE(t1.c3, t2.c12) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c4, t2.c0) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c4, t2.c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c4, t2.c1) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c4, t2.c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c4, t2.c2) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c4, t2.c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c4, t2.c3) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c4, t2.c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c4, t2.c4) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c4, t2.c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c4, t2.c5) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c4, t2.c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c4, t2.c6) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c4, t2.c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c4, t2.c7) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c4, t2.c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c4, t2.c8) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c4, t2.c8) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c4, t2.c9) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c4, t2.c9) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c4, t2.c10) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c4, t2.c10) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c4, t2.c11) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c4, t2.c11) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c4, t2.c12) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c4, t2.c12) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c5, t2.c0) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c5, t2.c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c5, t2.c1) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c5, t2.c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c5, t2.c2) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c5, t2.c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c5, t2.c3) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c5, t2.c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c5, t2.c4) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c5, t2.c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c5, t2.c5) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c5, t2.c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c5, t2.c6) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c5, t2.c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c5, t2.c7) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c5, t2.c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c5, t2.c8) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c5, t2.c8) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c5, t2.c9) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c5, t2.c9) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c5, t2.c10) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c5, t2.c10) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c5, t2.c11) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c5, t2.c11) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c5, t2.c12) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c5, t2.c12) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c6, t2.c0) 254 30 1 Y 0 39 8 +COALESCE(t1.c6, t2.c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c6, t2.c1) 253 30 1 Y 0 39 8 +COALESCE(t1.c6, t2.c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c6, t2.c2) 249 255 1 Y 0 39 8 +COALESCE(t1.c6, t2.c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c6, t2.c3) 252 65535 1 Y 0 39 8 +COALESCE(t1.c6, t2.c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c6, t2.c4) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c6, t2.c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c6, t2.c5) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c6, t2.c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c6, t2.c6) 3 11 1 Y 32896 0 63 +COALESCE(t1.c6, t2.c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c6, t2.c7) 5 22 1 Y 32896 31 63 +COALESCE(t1.c6, t2.c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c6, t2.c8) 246 14 4 Y 32896 2 63 +COALESCE(t1.c6, t2.c8) +1.00 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c6, t2.c9) 253 11 1 Y 0 39 8 +COALESCE(t1.c6, t2.c9) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c6, t2.c10) 253 11 1 Y 0 39 8 +COALESCE(t1.c6, t2.c10) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c6, t2.c11) 253 19 1 Y 0 39 8 +COALESCE(t1.c6, t2.c11) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c6, t2.c12) 253 11 1 Y 0 39 8 +COALESCE(t1.c6, t2.c12) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c7, t2.c0) 253 30 1 Y 0 39 8 +COALESCE(t1.c7, t2.c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c7, t2.c1) 253 30 1 Y 0 39 8 +COALESCE(t1.c7, t2.c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c7, t2.c2) 249 255 1 Y 0 39 8 +COALESCE(t1.c7, t2.c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c7, t2.c3) 252 65535 1 Y 0 39 8 +COALESCE(t1.c7, t2.c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c7, t2.c4) 250 16777215 1 Y 0 39 8 +COALESCE(t1.c7, t2.c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c7, t2.c5) 251 4294967295 1 Y 0 39 8 +COALESCE(t1.c7, t2.c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c7, t2.c6) 253 11 1 Y 0 39 8 +COALESCE(t1.c7, t2.c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c7, t2.c7) 253 22 1 Y 0 39 8 +COALESCE(t1.c7, t2.c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c7, t2.c8) 253 12 1 Y 0 39 8 +COALESCE(t1.c7, t2.c8) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c7, t2.c9) 253 10 1 Y 0 39 8 +COALESCE(t1.c7, t2.c9) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c7, t2.c10) 253 10 1 Y 0 39 8 +COALESCE(t1.c7, t2.c10) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c7, t2.c11) 253 19 1 Y 0 39 8 +COALESCE(t1.c7, t2.c11) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(t1.c7, t2.c12) 253 1 1 Y 0 39 8 +COALESCE(t1.c7, t2.c12) +1 +CALL p2('LEAST(t1.colt1, t2.colt2)'); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c0, t2.c0) 254 30 1 Y 0 39 8 +LEAST(t1.c0, t2.c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c0, t2.c1) 253 30 1 Y 0 39 8 +LEAST(t1.c0, t2.c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c0, t2.c2) 249 255 1 Y 0 39 8 +LEAST(t1.c0, t2.c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c0, t2.c3) 252 65535 1 Y 0 39 8 +LEAST(t1.c0, t2.c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c0, t2.c4) 250 16777215 1 Y 0 39 8 +LEAST(t1.c0, t2.c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c0, t2.c5) 251 4294967295 1 Y 0 39 8 +LEAST(t1.c0, t2.c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c0, t2.c6) 5 23 1 Y 32896 31 63 +LEAST(t1.c0, t2.c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c0, t2.c7) 5 23 1 Y 32896 31 63 +LEAST(t1.c0, t2.c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c0, t2.c8) 5 23 1 Y 32896 31 63 +LEAST(t1.c0, t2.c8) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c0, t2.c9) 11 17 15 Y 128 6 63 +LEAST(t1.c0, t2.c9) +00:00:01.000000 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c0, t2.c10) 10 10 10 Y 128 0 63 +LEAST(t1.c0, t2.c10) +0000-00-00 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c0, t2.c11) 12 26 26 Y 128 6 63 +LEAST(t1.c0, t2.c11) +0000-00-00 00:00:00.000000 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c0, t2.c12) 253 30 1 Y 0 39 8 +LEAST(t1.c0, t2.c12) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c1, t2.c0) 253 30 1 Y 0 39 8 +LEAST(t1.c1, t2.c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c1, t2.c1) 253 30 1 Y 0 39 8 +LEAST(t1.c1, t2.c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c1, t2.c2) 249 255 1 Y 0 39 8 +LEAST(t1.c1, t2.c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c1, t2.c3) 252 65535 1 Y 0 39 8 +LEAST(t1.c1, t2.c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c1, t2.c4) 250 16777215 1 Y 0 39 8 +LEAST(t1.c1, t2.c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c1, t2.c5) 251 4294967295 1 Y 0 39 8 +LEAST(t1.c1, t2.c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c1, t2.c6) 5 23 1 Y 32896 31 63 +LEAST(t1.c1, t2.c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c1, t2.c7) 5 23 1 Y 32896 31 63 +LEAST(t1.c1, t2.c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c1, t2.c8) 5 23 1 Y 32896 31 63 +LEAST(t1.c1, t2.c8) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c1, t2.c9) 11 17 15 Y 128 6 63 +LEAST(t1.c1, t2.c9) +00:00:01.000000 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c1, t2.c10) 10 10 10 Y 128 0 63 +LEAST(t1.c1, t2.c10) +0000-00-00 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c1, t2.c11) 12 26 26 Y 128 6 63 +LEAST(t1.c1, t2.c11) +0000-00-00 00:00:00.000000 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c1, t2.c12) 253 30 1 Y 0 39 8 +LEAST(t1.c1, t2.c12) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c2, t2.c0) 249 255 1 Y 0 39 8 +LEAST(t1.c2, t2.c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c2, t2.c1) 249 255 1 Y 0 39 8 +LEAST(t1.c2, t2.c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c2, t2.c2) 249 255 1 Y 0 39 8 +LEAST(t1.c2, t2.c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c2, t2.c3) 252 65535 1 Y 0 39 8 +LEAST(t1.c2, t2.c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c2, t2.c4) 250 16777215 1 Y 0 39 8 +LEAST(t1.c2, t2.c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c2, t2.c5) 251 4294967295 1 Y 0 39 8 +LEAST(t1.c2, t2.c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c2, t2.c6) 5 23 1 Y 32896 31 63 +LEAST(t1.c2, t2.c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c2, t2.c7) 5 23 1 Y 32896 31 63 +LEAST(t1.c2, t2.c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c2, t2.c8) 5 23 1 Y 32896 31 63 +LEAST(t1.c2, t2.c8) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c2, t2.c9) 11 17 15 Y 128 6 63 +LEAST(t1.c2, t2.c9) +00:00:01.000000 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c2, t2.c10) 10 10 10 Y 128 0 63 +LEAST(t1.c2, t2.c10) +0000-00-00 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c2, t2.c11) 12 26 26 Y 128 6 63 +LEAST(t1.c2, t2.c11) +0000-00-00 00:00:00.000000 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c2, t2.c12) 249 255 1 Y 0 39 8 +LEAST(t1.c2, t2.c12) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c3, t2.c0) 252 65535 1 Y 0 39 8 +LEAST(t1.c3, t2.c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c3, t2.c1) 252 65535 1 Y 0 39 8 +LEAST(t1.c3, t2.c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c3, t2.c2) 252 65535 1 Y 0 39 8 +LEAST(t1.c3, t2.c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c3, t2.c3) 252 65535 1 Y 0 39 8 +LEAST(t1.c3, t2.c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c3, t2.c4) 250 16777215 1 Y 0 39 8 +LEAST(t1.c3, t2.c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c3, t2.c5) 251 4294967295 1 Y 0 39 8 +LEAST(t1.c3, t2.c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c3, t2.c6) 5 23 1 Y 32896 31 63 +LEAST(t1.c3, t2.c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c3, t2.c7) 5 23 1 Y 32896 31 63 +LEAST(t1.c3, t2.c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c3, t2.c8) 5 23 1 Y 32896 31 63 +LEAST(t1.c3, t2.c8) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c3, t2.c9) 11 17 15 Y 128 6 63 +LEAST(t1.c3, t2.c9) +00:00:01.000000 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c3, t2.c10) 10 10 10 Y 128 0 63 +LEAST(t1.c3, t2.c10) +0000-00-00 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c3, t2.c11) 12 26 26 Y 128 6 63 +LEAST(t1.c3, t2.c11) +0000-00-00 00:00:00.000000 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c3, t2.c12) 252 65535 1 Y 0 39 8 +LEAST(t1.c3, t2.c12) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c4, t2.c0) 250 16777215 1 Y 0 39 8 +LEAST(t1.c4, t2.c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c4, t2.c1) 250 16777215 1 Y 0 39 8 +LEAST(t1.c4, t2.c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c4, t2.c2) 250 16777215 1 Y 0 39 8 +LEAST(t1.c4, t2.c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c4, t2.c3) 250 16777215 1 Y 0 39 8 +LEAST(t1.c4, t2.c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c4, t2.c4) 250 16777215 1 Y 0 39 8 +LEAST(t1.c4, t2.c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c4, t2.c5) 251 4294967295 1 Y 0 39 8 +LEAST(t1.c4, t2.c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c4, t2.c6) 5 23 1 Y 32896 31 63 +LEAST(t1.c4, t2.c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c4, t2.c7) 5 23 1 Y 32896 31 63 +LEAST(t1.c4, t2.c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c4, t2.c8) 5 23 1 Y 32896 31 63 +LEAST(t1.c4, t2.c8) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c4, t2.c9) 11 17 15 Y 128 6 63 +LEAST(t1.c4, t2.c9) +00:00:01.000000 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c4, t2.c10) 10 10 10 Y 128 0 63 +LEAST(t1.c4, t2.c10) +0000-00-00 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c4, t2.c11) 12 26 26 Y 128 6 63 +LEAST(t1.c4, t2.c11) +0000-00-00 00:00:00.000000 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c4, t2.c12) 250 16777215 1 Y 0 39 8 +LEAST(t1.c4, t2.c12) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c5, t2.c0) 251 4294967295 1 Y 0 39 8 +LEAST(t1.c5, t2.c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c5, t2.c1) 251 4294967295 1 Y 0 39 8 +LEAST(t1.c5, t2.c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c5, t2.c2) 251 4294967295 1 Y 0 39 8 +LEAST(t1.c5, t2.c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c5, t2.c3) 251 4294967295 1 Y 0 39 8 +LEAST(t1.c5, t2.c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c5, t2.c4) 251 4294967295 1 Y 0 39 8 +LEAST(t1.c5, t2.c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c5, t2.c5) 251 4294967295 1 Y 0 39 8 +LEAST(t1.c5, t2.c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c5, t2.c6) 5 23 1 Y 32896 31 63 +LEAST(t1.c5, t2.c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c5, t2.c7) 5 23 1 Y 32896 31 63 +LEAST(t1.c5, t2.c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c5, t2.c8) 5 23 1 Y 32896 31 63 +LEAST(t1.c5, t2.c8) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c5, t2.c9) 11 17 15 Y 128 6 63 +LEAST(t1.c5, t2.c9) +00:00:01.000000 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c5, t2.c10) 10 10 10 Y 128 0 63 +LEAST(t1.c5, t2.c10) +0000-00-00 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c5, t2.c11) 12 26 26 Y 128 6 63 +LEAST(t1.c5, t2.c11) +0000-00-00 00:00:00.000000 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c5, t2.c12) 251 4294967295 1 Y 0 39 8 +LEAST(t1.c5, t2.c12) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c6, t2.c0) 5 23 1 Y 32896 31 63 +LEAST(t1.c6, t2.c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c6, t2.c1) 5 23 1 Y 32896 31 63 +LEAST(t1.c6, t2.c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c6, t2.c2) 5 23 1 Y 32896 31 63 +LEAST(t1.c6, t2.c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c6, t2.c3) 5 23 1 Y 32896 31 63 +LEAST(t1.c6, t2.c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c6, t2.c4) 5 23 1 Y 32896 31 63 +LEAST(t1.c6, t2.c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c6, t2.c5) 5 23 1 Y 32896 31 63 +LEAST(t1.c6, t2.c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c6, t2.c6) 3 11 1 Y 32896 0 63 +LEAST(t1.c6, t2.c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c6, t2.c7) 5 23 1 Y 32896 31 63 +LEAST(t1.c6, t2.c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c6, t2.c8) 246 14 4 Y 32896 2 63 +LEAST(t1.c6, t2.c8) +1.00 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c6, t2.c9) 11 10 8 Y 128 0 63 +LEAST(t1.c6, t2.c9) +00:00:01 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c6, t2.c10) 10 10 10 Y 128 0 63 +LEAST(t1.c6, t2.c10) +0000-00-00 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c6, t2.c11) 12 19 19 Y 128 0 63 +LEAST(t1.c6, t2.c11) +0000-00-00 00:00:00 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c6, t2.c12) 5 17 1 Y 32896 0 63 +LEAST(t1.c6, t2.c12) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c7, t2.c0) 253 30 1 Y 0 39 8 +LEAST(t1.c7, t2.c0) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c7, t2.c1) 253 30 1 Y 0 39 8 +LEAST(t1.c7, t2.c1) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c7, t2.c2) 249 255 1 Y 0 39 8 +LEAST(t1.c7, t2.c2) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c7, t2.c3) 252 65535 1 Y 0 39 8 +LEAST(t1.c7, t2.c3) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c7, t2.c4) 250 16777215 1 Y 0 39 8 +LEAST(t1.c7, t2.c4) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c7, t2.c5) 251 4294967295 1 Y 0 39 8 +LEAST(t1.c7, t2.c5) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c7, t2.c6) 5 17 1 Y 32896 0 63 +LEAST(t1.c7, t2.c6) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c7, t2.c7) 5 23 1 Y 32896 31 63 +LEAST(t1.c7, t2.c7) +1 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c7, t2.c8) 5 19 4 Y 32896 2 63 +LEAST(t1.c7, t2.c8) +1.00 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c7, t2.c9) 11 10 8 Y 128 0 63 +LEAST(t1.c7, t2.c9) +00:00:01 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c7, t2.c10) 10 10 10 Y 128 0 63 +LEAST(t1.c7, t2.c10) +0000-00-00 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c7, t2.c11) 12 19 19 Y 128 0 63 +LEAST(t1.c7, t2.c11) +0000-00-00 00:00:00 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(t1.c7, t2.c12) 253 1 1 Y 0 39 8 +LEAST(t1.c7, t2.c12) +1 +CALL p2('t1.colt1+t2.colt2'); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c0+t2.c0 5 23 1 Y 32896 31 63 +t1.c0+t2.c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c0+t2.c1 5 23 1 Y 32896 31 63 +t1.c0+t2.c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c0+t2.c2 5 23 1 Y 32896 31 63 +t1.c0+t2.c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c0+t2.c3 5 23 1 Y 32896 31 63 +t1.c0+t2.c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c0+t2.c4 5 23 1 Y 32896 31 63 +t1.c0+t2.c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c0+t2.c5 5 23 1 Y 32896 31 63 +t1.c0+t2.c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c0+t2.c6 5 23 1 Y 32896 31 63 +t1.c0+t2.c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c0+t2.c7 5 23 1 Y 32896 31 63 +t1.c0+t2.c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c0+t2.c8 5 23 4 Y 32896 31 63 +t1.c0+t2.c8 +2.23 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c0+t2.c9 5 23 6 Y 32896 31 63 +t1.c0+t2.c9 +102031 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c0+t2.c10 5 23 8 Y 32896 31 63 +t1.c0+t2.c10 +20010102 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c0+t2.c11 5 23 14 Y 32896 31 63 +t1.c0+t2.c11 +20010101102031 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c0+t2.c12 5 23 1 Y 32896 31 63 +t1.c0+t2.c12 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c1+t2.c0 5 23 1 Y 32896 31 63 +t1.c1+t2.c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c1+t2.c1 5 23 1 Y 32896 31 63 +t1.c1+t2.c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c1+t2.c2 5 23 1 Y 32896 31 63 +t1.c1+t2.c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c1+t2.c3 5 23 1 Y 32896 31 63 +t1.c1+t2.c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c1+t2.c4 5 23 1 Y 32896 31 63 +t1.c1+t2.c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c1+t2.c5 5 23 1 Y 32896 31 63 +t1.c1+t2.c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c1+t2.c6 5 23 1 Y 32896 31 63 +t1.c1+t2.c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c1+t2.c7 5 23 1 Y 32896 31 63 +t1.c1+t2.c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c1+t2.c8 5 23 4 Y 32896 31 63 +t1.c1+t2.c8 +2.23 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c1+t2.c9 5 23 6 Y 32896 31 63 +t1.c1+t2.c9 +102031 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c1+t2.c10 5 23 8 Y 32896 31 63 +t1.c1+t2.c10 +20010102 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c1+t2.c11 5 23 14 Y 32896 31 63 +t1.c1+t2.c11 +20010101102031 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c1+t2.c12 5 23 1 Y 32896 31 63 +t1.c1+t2.c12 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c2+t2.c0 5 23 1 Y 32896 31 63 +t1.c2+t2.c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c2+t2.c1 5 23 1 Y 32896 31 63 +t1.c2+t2.c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c2+t2.c2 5 23 1 Y 32896 31 63 +t1.c2+t2.c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c2+t2.c3 5 23 1 Y 32896 31 63 +t1.c2+t2.c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c2+t2.c4 5 23 1 Y 32896 31 63 +t1.c2+t2.c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c2+t2.c5 5 23 1 Y 32896 31 63 +t1.c2+t2.c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c2+t2.c6 5 23 1 Y 32896 31 63 +t1.c2+t2.c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c2+t2.c7 5 23 1 Y 32896 31 63 +t1.c2+t2.c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c2+t2.c8 5 23 4 Y 32896 31 63 +t1.c2+t2.c8 +2.23 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c2+t2.c9 5 23 6 Y 32896 31 63 +t1.c2+t2.c9 +102031 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c2+t2.c10 5 23 8 Y 32896 31 63 +t1.c2+t2.c10 +20010102 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c2+t2.c11 5 23 14 Y 32896 31 63 +t1.c2+t2.c11 +20010101102031 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c2+t2.c12 5 23 1 Y 32896 31 63 +t1.c2+t2.c12 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c3+t2.c0 5 23 1 Y 32896 31 63 +t1.c3+t2.c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c3+t2.c1 5 23 1 Y 32896 31 63 +t1.c3+t2.c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c3+t2.c2 5 23 1 Y 32896 31 63 +t1.c3+t2.c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c3+t2.c3 5 23 1 Y 32896 31 63 +t1.c3+t2.c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c3+t2.c4 5 23 1 Y 32896 31 63 +t1.c3+t2.c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c3+t2.c5 5 23 1 Y 32896 31 63 +t1.c3+t2.c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c3+t2.c6 5 23 1 Y 32896 31 63 +t1.c3+t2.c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c3+t2.c7 5 23 1 Y 32896 31 63 +t1.c3+t2.c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c3+t2.c8 5 23 4 Y 32896 31 63 +t1.c3+t2.c8 +2.23 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c3+t2.c9 5 23 6 Y 32896 31 63 +t1.c3+t2.c9 +102031 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c3+t2.c10 5 23 8 Y 32896 31 63 +t1.c3+t2.c10 +20010102 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c3+t2.c11 5 23 14 Y 32896 31 63 +t1.c3+t2.c11 +20010101102031 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c3+t2.c12 5 23 1 Y 32896 31 63 +t1.c3+t2.c12 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c4+t2.c0 5 23 1 Y 32896 31 63 +t1.c4+t2.c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c4+t2.c1 5 23 1 Y 32896 31 63 +t1.c4+t2.c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c4+t2.c2 5 23 1 Y 32896 31 63 +t1.c4+t2.c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c4+t2.c3 5 23 1 Y 32896 31 63 +t1.c4+t2.c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c4+t2.c4 5 23 1 Y 32896 31 63 +t1.c4+t2.c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c4+t2.c5 5 23 1 Y 32896 31 63 +t1.c4+t2.c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c4+t2.c6 5 23 1 Y 32896 31 63 +t1.c4+t2.c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c4+t2.c7 5 23 1 Y 32896 31 63 +t1.c4+t2.c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c4+t2.c8 5 23 4 Y 32896 31 63 +t1.c4+t2.c8 +2.23 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c4+t2.c9 5 23 6 Y 32896 31 63 +t1.c4+t2.c9 +102031 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c4+t2.c10 5 23 8 Y 32896 31 63 +t1.c4+t2.c10 +20010102 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c4+t2.c11 5 23 14 Y 32896 31 63 +t1.c4+t2.c11 +20010101102031 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c4+t2.c12 5 23 1 Y 32896 31 63 +t1.c4+t2.c12 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c5+t2.c0 5 23 1 Y 32896 31 63 +t1.c5+t2.c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c5+t2.c1 5 23 1 Y 32896 31 63 +t1.c5+t2.c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c5+t2.c2 5 23 1 Y 32896 31 63 +t1.c5+t2.c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c5+t2.c3 5 23 1 Y 32896 31 63 +t1.c5+t2.c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c5+t2.c4 5 23 1 Y 32896 31 63 +t1.c5+t2.c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c5+t2.c5 5 23 1 Y 32896 31 63 +t1.c5+t2.c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c5+t2.c6 5 23 1 Y 32896 31 63 +t1.c5+t2.c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c5+t2.c7 5 23 1 Y 32896 31 63 +t1.c5+t2.c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c5+t2.c8 5 23 4 Y 32896 31 63 +t1.c5+t2.c8 +2.23 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c5+t2.c9 5 23 6 Y 32896 31 63 +t1.c5+t2.c9 +102031 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c5+t2.c10 5 23 8 Y 32896 31 63 +t1.c5+t2.c10 +20010102 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c5+t2.c11 5 23 14 Y 32896 31 63 +t1.c5+t2.c11 +20010101102031 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c5+t2.c12 5 23 1 Y 32896 31 63 +t1.c5+t2.c12 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c6+t2.c0 5 23 1 Y 32896 31 63 +t1.c6+t2.c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c6+t2.c1 5 23 1 Y 32896 31 63 +t1.c6+t2.c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c6+t2.c2 5 23 1 Y 32896 31 63 +t1.c6+t2.c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c6+t2.c3 5 23 1 Y 32896 31 63 +t1.c6+t2.c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c6+t2.c4 5 23 1 Y 32896 31 63 +t1.c6+t2.c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c6+t2.c5 5 23 1 Y 32896 31 63 +t1.c6+t2.c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c6+t2.c6 8 12 1 Y 32896 0 63 +t1.c6+t2.c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c6+t2.c7 5 23 1 Y 32896 31 63 +t1.c6+t2.c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c6+t2.c8 246 15 4 Y 32896 2 63 +t1.c6+t2.c8 +2.23 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c6+t2.c9 8 12 6 Y 32896 0 63 +t1.c6+t2.c9 +102031 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c6+t2.c10 8 12 8 Y 32896 0 63 +t1.c6+t2.c10 +20010102 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c6+t2.c11 8 16 14 Y 32896 0 63 +t1.c6+t2.c11 +20010101102031 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c6+t2.c12 8 12 1 Y 32896 0 63 +t1.c6+t2.c12 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c7+t2.c0 5 23 1 Y 32896 31 63 +t1.c7+t2.c0 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c7+t2.c1 5 23 1 Y 32896 31 63 +t1.c7+t2.c1 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c7+t2.c2 5 23 1 Y 32896 31 63 +t1.c7+t2.c2 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c7+t2.c3 5 23 1 Y 32896 31 63 +t1.c7+t2.c3 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c7+t2.c4 5 23 1 Y 32896 31 63 +t1.c7+t2.c4 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c7+t2.c5 5 23 1 Y 32896 31 63 +t1.c7+t2.c5 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c7+t2.c6 8 12 1 Y 32896 0 63 +t1.c7+t2.c6 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c7+t2.c7 5 23 1 Y 32896 31 63 +t1.c7+t2.c7 +2 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c7+t2.c8 246 13 4 Y 32896 2 63 +t1.c7+t2.c8 +2.23 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c7+t2.c9 3 9 6 Y 32896 0 63 +t1.c7+t2.c9 +102031 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c7+t2.c10 8 10 8 Y 32896 0 63 +t1.c7+t2.c10 +20010102 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c7+t2.c11 8 16 14 Y 32896 0 63 +t1.c7+t2.c11 +20010101102031 +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t1.c7+t2.c12 3 3 1 Y 32896 0 63 +t1.c7+t2.c12 +2 +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP TABLE t1, t1c, t2; +# +# End of 10.5 tests +# diff --git a/mysql-test/suite/json/t/json_table.test b/mysql-test/suite/json/t/json_table.test index f250fcbf58aca..ec330046f257e 100644 --- a/mysql-test/suite/json/t/json_table.test +++ b/mysql-test/suite/json/t/json_table.test @@ -30,9 +30,9 @@ select * from t1 right join json_table(t1.item_props,'$' columns( color varchar( DROP TABLE t1; -select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default '101' on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; +select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default 101 on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; -select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default '202' on error, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; +select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default 202 on error, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; select * from JSON_TABLE( '[ {"a": [1, 2], "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default '101' on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; @@ -814,6 +814,63 @@ select * from json_table('{"a":"foo", "b":1, "c":1000}', '$.*' columns(converted select * from json_table('{"a":"foo", "b":1, "c":1000}', '$.*' columns(converted tinyint path '$', original text path '$')) as jt order by original; +select * from + json_table('[{"color": "blue", "price": { "high": 10, "low": 5}}, + {"color": "white", "price": "pretty low"}, + {"color": "yellow", "price": 256.20}, + {"color": "red", "price": { "high": 20, "low": 8}}]', + '$[*]' columns(color varchar(100) path '$.color', + price json path '$.price' + ) + ) as T; + +--echo # +--echo # MDEV-27696 Json table columns accept redundant COLLATE syntax +--echo # + +--error ER_PARSE_ERROR +SELECT * FROM json_table('[{"name":"str"}]', '$[*]' + COLUMNS ( + name BLOB COLLATE `binary` PATH '$.name' + ) +) AS jt; + + +--error ER_PARSE_ERROR +SELECT * FROM json_table('[{"name":"str"}]', '$[*]' + COLUMNS ( + name VARCHAR(10) COLLATE latin1_bin COLLATE latin1_swedish_ci PATH '$.name' + ) +) AS jt; + + +--error ER_PARSE_ERROR +SELECT * FROM json_table('[{"name":"str"}]', '$[*]' + COLUMNS ( + name VARCHAR(10) BINARY COLLATE utf8_czech_ci path '$.name' + ) +) AS jt; + + +--echo # +--echo # MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition +--echo # + +SELECT * FROM json_table('[{"name":"Jeans"}]', '$[*]' + COLUMNS( + name VARCHAR(10) CHARACTER SET latin1 COLLATE DEFAULT PATH '$.name' + ) +) AS jt; + + +--echo # +--echo # MDEV-28480: Assertion `0' failed in Item_row::illegal_method_call +--echo # on SELECT FROM JSON_TABLE +--echo # + +--error ER_OPERAND_COLUMNS +SELECT 1 FROM JSON_TABLE (row(1,2), '$' COLUMNS (o FOR ORDINALITY)) AS j; + --echo # --echo # End of 10.6 tests --echo # diff --git a/mysql-test/suite/json/t/json_table_mysql.test b/mysql-test/suite/json/t/json_table_mysql.test index aaf123c6f7c2e..9f77ad964f3f4 100644 --- a/mysql-test/suite/json/t/json_table_mysql.test +++ b/mysql-test/suite/json/t/json_table_mysql.test @@ -453,13 +453,11 @@ SELECT * FROM SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON ERROR)) jt; -# The DEFAULT value must be a string on JSON format for now. ---error 1064 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON EMPTY)) jt; ---error 1064 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON ERROR)) jt; +# We don't accept dates in DEFAULT --error 1064 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x DATE diff --git a/mysql-test/suite/json/t/rpl_json_char.test b/mysql-test/suite/json/t/rpl_json_char.test new file mode 100644 index 0000000000000..51ad345a7ab0e --- /dev/null +++ b/mysql-test/suite/json/t/rpl_json_char.test @@ -0,0 +1,27 @@ +--source include/master-slave.inc + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-27018 IF and COALESCE lose "json" property +--echo # + +CREATE TABLE t1 (a CHAR(100) CHECK(JSON_VALID(a))); + +--sync_slave_with_master + +--connection master +INSERT INTO t1 VALUES (JSON_OBJECT('a','b')); +--sync_slave_with_master +SELECT * FROM t1 ORDER BY a; + +--connection master +DROP TABLE t1; + +--echo # +--echo # End of 10.5 tests +--echo # + +--source include/rpl_end.inc diff --git a/mysql-test/suite/json/t/rpl_json_longtext.test b/mysql-test/suite/json/t/rpl_json_longtext.test new file mode 100644 index 0000000000000..0155834458cf0 --- /dev/null +++ b/mysql-test/suite/json/t/rpl_json_longtext.test @@ -0,0 +1,27 @@ +--source include/master-slave.inc + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-27018 IF and COALESCE lose "json" property +--echo # + +CREATE TABLE t1 (a LONGTEXT CHECK(JSON_VALID(a))); + +--sync_slave_with_master + +--connection master +INSERT INTO t1 VALUES (JSON_OBJECT('a','b')); +--sync_slave_with_master +SELECT * FROM t1 ORDER BY a; + +--connection master +DROP TABLE t1; + +--echo # +--echo # End of 10.5 tests +--echo # + +--source include/rpl_end.inc diff --git a/mysql-test/suite/json/t/rpl_json_mediumtext.test b/mysql-test/suite/json/t/rpl_json_mediumtext.test new file mode 100644 index 0000000000000..f4a52a19aa197 --- /dev/null +++ b/mysql-test/suite/json/t/rpl_json_mediumtext.test @@ -0,0 +1,27 @@ +--source include/master-slave.inc + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-27018 IF and COALESCE lose "json" property +--echo # + +CREATE TABLE t1 (a MEDIUMTEXT CHECK(JSON_VALID(a))); + +--sync_slave_with_master + +--connection master +INSERT INTO t1 VALUES (JSON_OBJECT('a','b')); +--sync_slave_with_master +SELECT * FROM t1 ORDER BY a; + +--connection master +DROP TABLE t1; + +--echo # +--echo # End of 10.5 tests +--echo # + +--source include/rpl_end.inc diff --git a/mysql-test/suite/json/t/rpl_json_text.test b/mysql-test/suite/json/t/rpl_json_text.test new file mode 100644 index 0000000000000..7c7def768e8e7 --- /dev/null +++ b/mysql-test/suite/json/t/rpl_json_text.test @@ -0,0 +1,27 @@ +--source include/master-slave.inc + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-27018 IF and COALESCE lose "json" property +--echo # + +CREATE TABLE t1 (a TEXT CHECK(JSON_VALID(a))); + +--sync_slave_with_master + +--connection master +INSERT INTO t1 VALUES (JSON_OBJECT('a','b')); +--sync_slave_with_master +SELECT * FROM t1 ORDER BY a; + +--connection master +DROP TABLE t1; + +--echo # +--echo # End of 10.5 tests +--echo # + +--source include/rpl_end.inc diff --git a/mysql-test/suite/json/t/rpl_json_tinytext.test b/mysql-test/suite/json/t/rpl_json_tinytext.test new file mode 100644 index 0000000000000..99a7c8c85b604 --- /dev/null +++ b/mysql-test/suite/json/t/rpl_json_tinytext.test @@ -0,0 +1,27 @@ +--source include/master-slave.inc + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-27018 IF and COALESCE lose "json" property +--echo # + +CREATE TABLE t1 (a TINYTEXT CHECK(JSON_VALID(a))); + +--sync_slave_with_master + +--connection master +INSERT INTO t1 VALUES (JSON_OBJECT('a','b')); +--sync_slave_with_master +SELECT * FROM t1 ORDER BY a; + +--connection master +DROP TABLE t1; + +--echo # +--echo # End of 10.5 tests +--echo # + +--source include/rpl_end.inc diff --git a/mysql-test/suite/json/t/rpl_json_varchar.test b/mysql-test/suite/json/t/rpl_json_varchar.test new file mode 100644 index 0000000000000..9464f6709195c --- /dev/null +++ b/mysql-test/suite/json/t/rpl_json_varchar.test @@ -0,0 +1,27 @@ +--source include/master-slave.inc + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-27018 IF and COALESCE lose "json" property +--echo # + +CREATE TABLE t1 (a VARCHAR(100) CHECK(JSON_VALID(a))); + +--sync_slave_with_master + +--connection master +INSERT INTO t1 VALUES (JSON_OBJECT('a','b')); +--sync_slave_with_master +SELECT * FROM t1 ORDER BY a; + +--connection master +DROP TABLE t1; + +--echo # +--echo # End of 10.5 tests +--echo # + +--source include/rpl_end.inc diff --git a/mysql-test/suite/json/t/type_json.test b/mysql-test/suite/json/t/type_json.test new file mode 100644 index 0000000000000..f84bef780c377 --- /dev/null +++ b/mysql-test/suite/json/t/type_json.test @@ -0,0 +1,143 @@ +--echo # +--echo # Start of 10.5 tests +--echo # + + +--echo # +--echo # MDEV-27361 Hybrid functions with JSON arguments do not send format metadata +--echo # + +# Mix all columns in the given table tbl to each other and calculate expr. + +DELIMITER $$; +CREATE PROCEDURE p1(tbl TEXT, expr TEXT) +BEGIN + DECLARE t1cols INT DEFAULT (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME=tbl AND TABLE_SCHEMA='test'); + FOR a IN 0..(t1cols-1) DO + FOR b IN 0..(t1cols-1) DO + BEGIN + DECLARE query TEXT DEFAULT CONCAT('SELECT ', expr, ' FROM ', tbl); + SET query= REPLACE(query, 'olt1', a); + SET query= REPLACE(query, 'olt2', b); + EXECUTE IMMEDIATE query; + END; + END FOR; + END FOR; +END; +$$ +DELIMITER ;$$ + + +# Mix all columns in table t1 to all columns in table t2 and calculate expr + +DELIMITER $$; +CREATE PROCEDURE p2(expr TEXT) +BEGIN + DECLARE t1cols INT DEFAULT (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'); + DECLARE t2cols INT DEFAULT (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME='t2' AND TABLE_SCHEMA='test'); + FOR a IN 0..(t1cols-1) DO + FOR b IN 0..(t2cols-1) DO + BEGIN + DECLARE query TEXT DEFAULT CONCAT('SELECT ', expr, ' FROM t1, t2'); + SET query= REPLACE(query, 'olt1', a); + SET query= REPLACE(query, 'olt2', b); + EXECUTE IMMEDIATE query; + END; + END FOR; + END FOR; +END; +$$ +DELIMITER ;$$ + + + +CREATE TABLE t1 +( + c0 CHAR(30) DEFAULT '1' CHECK(JSON_VALID(c0)), + c1 VARCHAR(30) DEFAULT '1' CHECK(JSON_VALID(c1)), + c2 TINYTEXT DEFAULT '1' CHECK(JSON_VALID(c2)), + c3 TEXT DEFAULT '1' CHECK(JSON_VALID(c3)), + c4 MEDIUMTEXT DEFAULT '1' CHECK(JSON_VALID(c4)), + c5 LONGTEXT DEFAULT '1' CHECK(JSON_VALID(c5)), +# The below data types do not have any special JSON properties. +# Just checking CHECK(JSON_VALID()) does not give any unexpected surprises. + c6 INT DEFAULT '1' CHECK(JSON_VALID(c6)), + c7 ENUM('1') DEFAULT '1' CHECK(JSON_VALID(c7)) +); +INSERT INTO t1 VALUES (); + + +CREATE TABLE t1c +( + c0 CHAR(30) DEFAULT '1' CHECK(JSON_VALID(c0)), + c1 VARCHAR(30) COMPRESSED DEFAULT '1' CHECK(JSON_VALID(c1)), + c2 TINYTEXT COMPRESSED DEFAULT '1' CHECK(JSON_VALID(c2)), + c3 TEXT COMPRESSED DEFAULT '1' CHECK(JSON_VALID(c3)), + c4 MEDIUMTEXT COMPRESSED DEFAULT '1' CHECK(JSON_VALID(c4)), + c5 LONGTEXT COMPRESSED DEFAULT '1' CHECK(JSON_VALID(c5)), +# The below data types do not have any special JSON properties. +# Just checking CHECK(JSON_VALID()) does not give any unexpected surprises. + c6 INT DEFAULT '1' CHECK(JSON_VALID(c6)), + c7 ENUM('1') DEFAULT '1' CHECK(JSON_VALID(c7)) +); +INSERT INTO t1c VALUES (); + + + +CREATE TABLE t2 +( + c0 CHAR(30) DEFAULT '1', + c1 VARCHAR(30) DEFAULT '1', + c2 TINYTEXT DEFAULT '1', + c3 TEXT DEFAULT '1', + c4 MEDIUMTEXT DEFAULT '1', + c5 LONGTEXT DEFAULT '1', + c6 INT DEFAULT 1, + c7 DOUBLE DEFAULT 1, + c8 DECIMAL(10,2) DEFAULT 1.23, + c9 TIME DEFAULT '10:20:30', + c10 DATE DEFAULT '2001-01-01', + c11 DATETIME DEFAULT '2001-01-01 10:20:30', + c12 ENUM('1','2') DEFAULT '1' +); +INSERT INTO t2 VALUES (); + + +--disable_ps_protocol +--enable_metadata +CALL p1('t1', 'COALESCE(colt1, colt2)'); +CALL p1('t1', 'LEAST(colt1, colt2)'); +CALL p1('t1', 'colt1+colt2'); +--disable_metadata +--disable_ps_protocol + + +--disable_ps_protocol +--enable_metadata +CALL p1('t1c', 'COALESCE(colt1, colt2)'); +CALL p1('t1c', 'LEAST(colt1, colt2)'); +CALL p1('t1c', 'colt1+colt2'); +--disable_metadata +--disable_ps_protocol + + +--disable_ps_protocol +--enable_metadata +CALL p2('COALESCE(t1.colt1, t2.colt2)'); +CALL p2('LEAST(t1.colt1, t2.colt2)'); +CALL p2('t1.colt1+t2.colt2'); +--disable_metadata +--disable_ps_protocol + + +DROP PROCEDURE p1; +DROP PROCEDURE p2; + +DROP TABLE t1, t1c, t2; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/suite/maria/alter.result b/mysql-test/suite/maria/alter.result index 0bb8c89c1db52..cc03542674523 100644 --- a/mysql-test/suite/maria/alter.result +++ b/mysql-test/suite/maria/alter.result @@ -36,7 +36,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 INSERT INTO t1 VALUES (1),(2); ALTER TABLE t1 ORDER BY unknown_column; ERROR 42S22: Unknown column 'unknown_column' in 'order clause' @@ -44,7 +44,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 CREATE TABLE t2 SELECT * FROM t1; DROP TABLE t1, t2; # diff --git a/mysql-test/suite/maria/aria_log_dir_path.result b/mysql-test/suite/maria/aria_log_dir_path.result new file mode 100644 index 0000000000000..0a4201544a5f3 --- /dev/null +++ b/mysql-test/suite/maria/aria_log_dir_path.result @@ -0,0 +1,29 @@ +# +# MDEV-30971 Add a new system variable aria_data_home_dir +# +# restart: --loose-aria-log-file-size=8388608 --loose-aria-log-dir-path=MYSQLTEST_VARDIR/tmp/aria_log_dir_path_1 +SET @@global.aria_log_purge_type=external; +SHOW VARIABLES LIKE 'aria_log_file_size'; +Variable_name Value +aria_log_file_size 8388608 +SELECT @@aria_log_dir_path; +@@aria_log_dir_path +MYSQLTEST_VARDIR/tmp/aria_log_dir_path_1 +SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/; +SHOW ENGINE aria logs; +Type Name Status +Aria aria_log.00000001 in use +CREATE TABLE t1 (id INT, txt LONGTEXT) ENGINE=Aria; +BEGIN NOT ATOMIC +FOR id IN 0..9 DO +INSERT INTO test.t1 (id, txt) VALUES (id, REPEAT(id,1024*1024)); +END FOR; +END; +$$ +SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/; +SHOW ENGINE aria logs; +Type Name Status +Aria aria_log.00000001 free +Aria aria_log.00000002 in use +DROP TABLE t1; +# restart diff --git a/mysql-test/suite/maria/aria_log_dir_path.test b/mysql-test/suite/maria/aria_log_dir_path.test new file mode 100644 index 0000000000000..bc0a31a76b933 --- /dev/null +++ b/mysql-test/suite/maria/aria_log_dir_path.test @@ -0,0 +1,65 @@ +--source include/have_maria.inc +--let $datadir= `SELECT @@datadir` + +--echo # +--echo # MDEV-30971 Add a new system variable aria_data_home_dir +--echo # + +--let $ARIA_LOGDIR=$MYSQLTEST_VARDIR/tmp/aria_log_dir_path_1 +--mkdir $ARIA_LOGDIR +--let $restart_parameters=--loose-aria-log-file-size=8388608 --loose-aria-log-dir-path=$ARIA_LOGDIR +--source include/restart_mysqld.inc + +# +# Test that: +# - aria_log_dir_path is set to a non-default directory. +# - New Aria log files are created in the non-default directory. +# - The contents of the log directory (according to "file_exists" commands) +# is in sync with the "SHOW ENGINE aria logs" ouput. +# + +# Prevent automatic purge +SET @@global.aria_log_purge_type=external; + +SHOW VARIABLES LIKE 'aria_log_file_size'; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +SELECT @@aria_log_dir_path; + + +SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/; +--file_exists $ARIA_LOGDIR/aria_log_control +--file_exists $ARIA_LOGDIR/aria_log.00000001 +--error 1 +--file_exists $ARIA_LOGDIR/aria_log.00000002 +--replace_regex /Size +[0-9]+ ; .+aria_log/aria_log/ +SHOW ENGINE aria logs; + + +CREATE TABLE t1 (id INT, txt LONGTEXT) ENGINE=Aria; +DELIMITER $$; +BEGIN NOT ATOMIC + FOR id IN 0..9 DO + INSERT INTO test.t1 (id, txt) VALUES (id, REPEAT(id,1024*1024)); + END FOR; +END; +$$ +DELIMITER ;$$ + + +SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/; +--file_exists $ARIA_LOGDIR/aria_log_control +--file_exists $ARIA_LOGDIR/aria_log.00000001 +--file_exists $ARIA_LOGDIR/aria_log.00000002 +--error 1 +--file_exists $ARIA_LOGDIR/aria_log.00000003 +--replace_regex /Size +[0-9]+ ; .+aria_log/aria_log/ +SHOW ENGINE aria logs; + +DROP TABLE t1; + +--let $restart_parameters= +--source include/restart_mysqld.inc +--remove_file $ARIA_LOGDIR/aria_log_control +--remove_file $ARIA_LOGDIR/aria_log.00000001 +--remove_file $ARIA_LOGDIR/aria_log.00000002 +--rmdir $ARIA_LOGDIR diff --git a/mysql-test/suite/maria/encrypt-no-key.result b/mysql-test/suite/maria/encrypt-no-key.result index 6745670dfac9e..5229158d5258b 100644 --- a/mysql-test/suite/maria/encrypt-no-key.result +++ b/mysql-test/suite/maria/encrypt-no-key.result @@ -1,15 +1,17 @@ -call mtr.add_suppression('Unknown key id 1. Can''t continue'); +call mtr.add_suppression('Unknown key id 1'); +call mtr.add_suppression('try to repair it'); +call mtr.add_suppression('Index is corrupted'); set global aria_encrypt_tables= 1; create table t1 (pk int primary key, a int, key(a)) engine=aria transactional=1; alter table t1 disable keys; insert into t1 values (1,1); alter table t1 enable keys; -ERROR HY000: Unknown key id 1. Can't continue! +ERROR HY000: Unknown key id 1 for test/t1. Can't continue! repair table t1 use_frm; Table Op Msg_type Msg_text test.t1 repair warning Number of rows changed from 0 to 1 -test.t1 repair Error Unknown key id 1. Can't continue! -test.t1 repair Error Unknown key id 1. Can't continue! +test.t1 repair Error Unknown key id 1 for test/t1. Can't continue! +test.t1 repair Error Unknown key id 1 for test/t1. Can't continue! test.t1 repair status OK drop table t1; set global aria_encrypt_tables= default; diff --git a/mysql-test/suite/maria/encrypt-no-key.test b/mysql-test/suite/maria/encrypt-no-key.test index 2d586c50695c2..1157263ca79e1 100644 --- a/mysql-test/suite/maria/encrypt-no-key.test +++ b/mysql-test/suite/maria/encrypt-no-key.test @@ -1,14 +1,20 @@ # # MDEV-18496 Crash when Aria encryption is enabled but plugin not available # -call mtr.add_suppression('Unknown key id 1. Can''t continue'); +call mtr.add_suppression('Unknown key id 1'); +call mtr.add_suppression('try to repair it'); +call mtr.add_suppression('Index is corrupted'); set global aria_encrypt_tables= 1; create table t1 (pk int primary key, a int, key(a)) engine=aria transactional=1; alter table t1 disable keys; insert into t1 values (1,1); -error 192; +--replace_result \\ / +--replace_regex /for .*test/for test/ +--error 192 alter table t1 enable keys; +--replace_result \\ / +--replace_regex /for .*test/for test/ repair table t1 use_frm; drop table t1; set global aria_encrypt_tables= default; diff --git a/mysql-test/suite/maria/fulltext2.result b/mysql-test/suite/maria/fulltext2.result index 1e4e6636ef603..6cffc5cf40474 100644 --- a/mysql-test/suite/maria/fulltext2.result +++ b/mysql-test/suite/maria/fulltext2.result @@ -84,3 +84,10 @@ select count(*) from t1 where match a against ('aaayyy' in boolean mode); count(*) 0 drop table t1; +set names utf8mb4; +create table t1 (a int, b text, fulltext (b)) charset=utf8mb4 collate=utf8mb4_unicode_ci engine=aria; +insert t1 values (1000, 'C͓̙̯͔̩ͅͅi̩̘̜̲a̯̲̬̳̜̖̤o͕͓̜͓̺̖̗,̠̬͚ ̺T͇̲h͈̱e ̬̜D̖o̦̖͔̗͖̩̘c̣̼t̝͉̫̮̗o͉̫̭r̙͎̗.͓̪̥'); +select a from t1 where match(b) against ('ciao' in boolean mode); +a +1000 +drop table t1; diff --git a/mysql-test/suite/maria/fulltext2.test b/mysql-test/suite/maria/fulltext2.test index 1fbece4fe95a5..7ebdff7bd535b 100644 --- a/mysql-test/suite/maria/fulltext2.test +++ b/mysql-test/suite/maria/fulltext2.test @@ -75,3 +75,12 @@ select count(*) from t1 where match a against ('aaaxxx' in boolean mode); select count(*) from t1 where match a against ('aaayyy' in boolean mode); drop table t1; + +# +# MDEV-11241 Certain combining marks cause MariaDB to crash when doing Full-Text searches +# +set names utf8mb4; +create table t1 (a int, b text, fulltext (b)) charset=utf8mb4 collate=utf8mb4_unicode_ci engine=aria; +insert t1 values (1000, 'C͓̙̯͔̩ͅͅi̩̘̜̲a̯̲̬̳̜̖̤o͕͓̜͓̺̖̗,̠̬͚ ̺T͇̲h͈̱e ̬̜D̖o̦̖͔̗͖̩̘c̣̼t̝͉̫̮̗o͉̫̭r̙͎̗.͓̪̥'); +select a from t1 where match(b) against ('ciao' in boolean mode); +drop table t1; diff --git a/mysql-test/suite/maria/lock.result b/mysql-test/suite/maria/lock.result index 0891e8ad24930..ed575a6da21ad 100644 --- a/mysql-test/suite/maria/lock.result +++ b/mysql-test/suite/maria/lock.result @@ -39,7 +39,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 INSERT INTO t1 VALUES (1); CREATE TABLE t2 (f2 INT) ENGINE=MyISAM; CREATE TABLE tmp (f3 INT) engine=Aria; @@ -59,7 +59,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 INSERT INTO t1 VALUES (2); CREATE TABLE t2 (f2 INT) ENGINE=MyISAM; CREATE TABLE tmp (f3 INT) transactional=0 engine=Aria; @@ -81,7 +81,7 @@ t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL, `c1` geometry NOT NULL, SPATIAL KEY `i1` (`c1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 INSERT INTO t1 VALUES (3, PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000 -66.8158332999, @@ -157,8 +157,8 @@ test.t1 optimize status OK connection default; DELETE FROM t2 WHERE c < 1; Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect DECIMAL value: 'b' connection con1; OPTIMIZE TABLE t1; Table Op Msg_type Msg_text diff --git a/mysql-test/suite/maria/maria-autoinc.result b/mysql-test/suite/maria/maria-autoinc.result index a4ae1f72c1ed1..56b7c2e840fd2 100644 --- a/mysql-test/suite/maria/maria-autoinc.result +++ b/mysql-test/suite/maria/maria-autoinc.result @@ -25,7 +25,7 @@ t1 CREATE TABLE `t1` ( `id` tinyint(4) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 id name 1 dog id name @@ -39,7 +39,7 @@ t1 CREATE TABLE `t1` ( `id` smallint(6) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 id name 1 dog id name @@ -53,7 +53,7 @@ t1 CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 id name 1 dog id name @@ -67,7 +67,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 id name 1 dog id name @@ -81,7 +81,7 @@ t1 CREATE TABLE `t1` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 id name 1 dog id name @@ -95,7 +95,7 @@ t1 CREATE TABLE `t1` ( `id` float NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 id name 1 dog id name @@ -109,7 +109,7 @@ t1 CREATE TABLE `t1` ( `id` double NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 id name 1 dog id name diff --git a/mysql-test/suite/maria/maria-gis-recovery.result b/mysql-test/suite/maria/maria-gis-recovery.result index d95b468bbf6b0..05d2f339ae770 100644 --- a/mysql-test/suite/maria/maria-gis-recovery.result +++ b/mysql-test/suite/maria/maria-gis-recovery.result @@ -45,7 +45,7 @@ t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, `shape` geometry NOT NULL, SPATIAL KEY `shape` (`shape`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 * TEST of UPDATE vs state.auto_increment connection admin; * copied t1 for feeding_recovery @@ -76,7 +76,7 @@ t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, `shape` geometry NOT NULL, SPATIAL KEY `shape` (`shape`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 drop table t1; drop database mysqltest_for_feeding_recovery; drop database mysqltest_for_comparison; diff --git a/mysql-test/suite/maria/maria-gis-rtree-dynamic.result b/mysql-test/suite/maria/maria-gis-rtree-dynamic.result index dad74e3767f1f..8811f977ec4cf 100644 --- a/mysql-test/suite/maria/maria-gis-rtree-dynamic.result +++ b/mysql-test/suite/maria/maria-gis-rtree-dynamic.result @@ -12,7 +12,7 @@ t1 CREATE TABLE `t1` ( `g` geometry NOT NULL, PRIMARY KEY (`fid`), SPATIAL KEY `g` (`g`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 ROW_FORMAT=DYNAMIC +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 ROW_FORMAT=DYNAMIC INSERT INTO t1 (g) VALUES (GeomFromText('LineString(150 150, 150 150)')); INSERT INTO t1 (g) VALUES (GeomFromText('LineString(149 149, 151 151)')); INSERT INTO t1 (g) VALUES (GeomFromText('LineString(148 148, 152 152)')); @@ -295,7 +295,7 @@ t2 CREATE TABLE `t2` ( `g` geometry NOT NULL, PRIMARY KEY (`fid`), SPATIAL KEY `g` (`g`) -) ENGINE=Aria AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 ROW_FORMAT=DYNAMIC +) ENGINE=Aria AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 ROW_FORMAT=DYNAMIC SELECT count(*) FROM t2; count(*) 100 diff --git a/mysql-test/suite/maria/maria-gis-rtree-trans.result b/mysql-test/suite/maria/maria-gis-rtree-trans.result index e118db697b222..28dd6d7fdb706 100644 --- a/mysql-test/suite/maria/maria-gis-rtree-trans.result +++ b/mysql-test/suite/maria/maria-gis-rtree-trans.result @@ -12,7 +12,7 @@ t1 CREATE TABLE `t1` ( `g` geometry NOT NULL, PRIMARY KEY (`fid`), SPATIAL KEY `g` (`g`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=1 INSERT INTO t1 (g) VALUES (GeomFromText('LineString(150 150, 150 150)')); INSERT INTO t1 (g) VALUES (GeomFromText('LineString(149 149, 151 151)')); INSERT INTO t1 (g) VALUES (GeomFromText('LineString(148 148, 152 152)')); @@ -295,7 +295,7 @@ t2 CREATE TABLE `t2` ( `g` geometry NOT NULL, PRIMARY KEY (`fid`), SPATIAL KEY `g` (`g`) -) ENGINE=Aria AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=1 +) ENGINE=Aria AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=1 SELECT count(*) FROM t2; count(*) 100 diff --git a/mysql-test/suite/maria/maria-gis-rtree.result b/mysql-test/suite/maria/maria-gis-rtree.result index 9267556bc4b08..cf189d1341565 100644 --- a/mysql-test/suite/maria/maria-gis-rtree.result +++ b/mysql-test/suite/maria/maria-gis-rtree.result @@ -12,7 +12,7 @@ t1 CREATE TABLE `t1` ( `g` geometry NOT NULL, PRIMARY KEY (`fid`), SPATIAL KEY `g` (`g`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=0 INSERT INTO t1 (g) VALUES (GeomFromText('LineString(150 150, 150 150)')); INSERT INTO t1 (g) VALUES (GeomFromText('LineString(149 149, 151 151)')); INSERT INTO t1 (g) VALUES (GeomFromText('LineString(148 148, 152 152)')); @@ -295,7 +295,7 @@ t2 CREATE TABLE `t2` ( `g` geometry NOT NULL, PRIMARY KEY (`fid`), SPATIAL KEY `g` (`g`) -) ENGINE=Aria AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=0 +) ENGINE=Aria AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=0 SELECT count(*) FROM t2; count(*) 100 diff --git a/mysql-test/suite/maria/maria-mvcc.result b/mysql-test/suite/maria/maria-mvcc.result index 050f4e410ae92..796c446d7a851 100644 --- a/mysql-test/suite/maria/maria-mvcc.result +++ b/mysql-test/suite/maria/maria-mvcc.result @@ -7,7 +7,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 insert into t1 values (0); lock tables t1 write concurrent; insert into t1 values (1); diff --git a/mysql-test/suite/maria/maria-no-logging.result b/mysql-test/suite/maria/maria-no-logging.result index e79686c4731a9..c510eb4d4bcfa 100644 --- a/mysql-test/suite/maria/maria-no-logging.result +++ b/mysql-test/suite/maria/maria-no-logging.result @@ -22,7 +22,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(100) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 show engine aria logs; Type Name Status Aria Size 16384 aria_log.00000001 unknown diff --git a/mysql-test/suite/maria/maria-page-checksum.result b/mysql-test/suite/maria/maria-page-checksum.result index fbb7ba78b250e..ce183a24e9e15 100644 --- a/mysql-test/suite/maria/maria-page-checksum.result +++ b/mysql-test/suite/maria/maria-page-checksum.result @@ -9,7 +9,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 0 ; alter table t1 engine=aria ; @@ -17,7 +17,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 2a @@ -27,7 +27,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=0 ; @@ -35,7 +35,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 3a @@ -45,7 +45,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=1 ; @@ -53,7 +53,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 4a @@ -63,7 +63,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 1 ; alter table t1 engine=aria ; @@ -71,7 +71,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 5a @@ -81,7 +81,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=0 ; @@ -89,7 +89,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 6a @@ -99,7 +99,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=1 ; @@ -107,7 +107,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 7a @@ -117,7 +117,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 0 ; alter table t1 engine=aria ; @@ -125,7 +125,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 8a @@ -135,7 +135,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=0 ; @@ -143,7 +143,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 9a @@ -153,7 +153,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=1 ; @@ -161,7 +161,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 10a @@ -171,7 +171,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 1 ; alter table t1 engine=aria ; @@ -179,7 +179,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 11a @@ -189,7 +189,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=0 ; @@ -197,7 +197,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 12a @@ -207,7 +207,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=1 ; @@ -215,7 +215,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 13a @@ -225,7 +225,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 0 ; alter table t1 engine=aria ; @@ -233,7 +233,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 14a @@ -243,7 +243,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=0 ; @@ -251,7 +251,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 15a @@ -261,7 +261,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=1 ; @@ -269,7 +269,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 16a @@ -279,7 +279,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 1 ; alter table t1 engine=aria ; @@ -287,7 +287,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 17a @@ -297,7 +297,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=0 ; @@ -305,7 +305,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 18a @@ -315,7 +315,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=1 ; @@ -323,7 +323,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 19a @@ -333,7 +333,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 0 ; alter table t1 engine=aria ; @@ -341,7 +341,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 20a @@ -351,7 +351,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=0 ; @@ -359,7 +359,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 21a @@ -369,7 +369,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=1 ; @@ -377,7 +377,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 22a @@ -387,7 +387,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 1 ; alter table t1 engine=aria ; @@ -395,7 +395,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 23a @@ -405,7 +405,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=0 ; @@ -413,7 +413,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 24a @@ -423,7 +423,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=1 ; @@ -431,7 +431,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 25a @@ -441,7 +441,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 0 ; alter table t1 engine=aria ; @@ -449,7 +449,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 26a @@ -459,7 +459,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=0 ; @@ -467,7 +467,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 27a @@ -477,7 +477,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=1 ; @@ -485,7 +485,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 28a @@ -495,7 +495,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 1 ; alter table t1 engine=aria ; @@ -503,7 +503,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 29a @@ -513,7 +513,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=0 ; @@ -521,7 +521,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 30a @@ -531,7 +531,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used set global aria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=1 ; @@ -539,7 +539,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 31a @@ -549,7 +549,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 0 ; alter table t1 engine=aria ; @@ -557,7 +557,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 32a @@ -567,7 +567,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=0 ; @@ -575,7 +575,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 33a @@ -585,7 +585,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=1 ; @@ -593,7 +593,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 34a @@ -603,7 +603,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 1 ; alter table t1 engine=aria ; @@ -611,7 +611,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 35a @@ -621,7 +621,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=0 ; @@ -629,7 +629,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 Page checksums are not used drop table t1; # iteration 36a @@ -639,7 +639,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used set global aria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=1 ; @@ -647,7 +647,7 @@ show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Page checksums are used drop table t1; # iteration 1b @@ -656,14 +656,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Crashsafe: yes alter table t1 modify a bigint ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Crashsafe: yes drop table t1; # iteration 2b @@ -672,14 +672,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Crashsafe: yes alter table t1 transactional=0 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 Crashsafe: no drop table t1; # iteration 3b @@ -688,14 +688,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Crashsafe: yes alter table t1 transactional=1 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 Crashsafe: yes drop table t1; # iteration 4b @@ -704,14 +704,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Crashsafe: yes alter table t1 engine=aria ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Crashsafe: yes drop table t1; # iteration 5b @@ -720,14 +720,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Crashsafe: yes alter table t1 engine=aria transactional=0 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 Crashsafe: no drop table t1; # iteration 6b @@ -736,14 +736,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 Crashsafe: yes alter table t1 engine=aria transactional=1 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 Crashsafe: yes drop table t1; # iteration 7b @@ -752,14 +752,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 Crashsafe: no alter table t1 modify a bigint ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 Crashsafe: no drop table t1; # iteration 8b @@ -768,14 +768,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 Crashsafe: no alter table t1 transactional=0 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 Crashsafe: no drop table t1; # iteration 9b @@ -784,14 +784,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 Crashsafe: no alter table t1 transactional=1 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 Crashsafe: yes drop table t1; # iteration 10b @@ -800,14 +800,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 Crashsafe: no alter table t1 engine=aria ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 Crashsafe: no drop table t1; # iteration 11b @@ -816,14 +816,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 Crashsafe: no alter table t1 engine=aria transactional=0 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 Crashsafe: no drop table t1; # iteration 12b @@ -832,14 +832,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 Crashsafe: no alter table t1 engine=aria transactional=1 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 Crashsafe: yes drop table t1; # iteration 13b @@ -848,14 +848,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 Crashsafe: yes alter table t1 modify a bigint ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 Crashsafe: yes drop table t1; # iteration 14b @@ -864,14 +864,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 Crashsafe: yes alter table t1 transactional=0 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 Crashsafe: no drop table t1; # iteration 15b @@ -880,14 +880,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 Crashsafe: yes alter table t1 transactional=1 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 Crashsafe: yes drop table t1; # iteration 16b @@ -896,14 +896,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 Crashsafe: yes alter table t1 engine=aria ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 Crashsafe: yes drop table t1; # iteration 17b @@ -912,14 +912,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 Crashsafe: yes alter table t1 engine=aria transactional=0 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=0 Crashsafe: no drop table t1; # iteration 18b @@ -928,13 +928,13 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 Crashsafe: yes alter table t1 engine=aria transactional=1 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 Crashsafe: yes drop table t1; diff --git a/mysql-test/suite/maria/maria-recover.result b/mysql-test/suite/maria/maria-recover.result index 8a33307b2b05c..7bb90cc0405c8 100644 --- a/mysql-test/suite/maria/maria-recover.result +++ b/mysql-test/suite/maria/maria-recover.result @@ -26,9 +26,10 @@ a ThursdayMorningsMarket ThursdayMorningsMarketb Warnings: -Error 145 t_corrupted2' is marked as crashed and should be repaired +Error 145 Got error '145 "Table was marked as crashed and should be repaired"' for 't_corrupted2' Warning 1034 1 client is using or hasn't closed the table properly -Error 1034 Wrong base information on indexpage at page: 1 +Error 176 Got error '176 "Read page with wrong checksum"' for 't_corrupted2.MAI' +Error 1034 Can't read indexpage from page: 1, error: 176 select * from t_corrupted2; a ThursdayMorningsMarket diff --git a/mysql-test/suite/maria/maria-recover.test b/mysql-test/suite/maria/maria-recover.test index 36fa41d9adbfe..5ddfd6d202eb0 100644 --- a/mysql-test/suite/maria/maria-recover.test +++ b/mysql-test/suite/maria/maria-recover.test @@ -20,8 +20,8 @@ select count(*) from mysql.proc; # account for Unix and Windows variation. call mtr.add_suppression("Checking table: '\\..mysqltest.t_corrupted2'"); call mtr.add_suppression("Recovering table: '\\..mysqltest.t_corrupted2'"); -call mtr.add_suppression("Table '\\..mysqltest.t_corrupted2' is marked as crashed and should be repaired"); -call mtr.add_suppression("Table 't_corrupted2' is marked as crashed and should be repaired"); +call mtr.add_suppression("Table was marked as crashed and should be repaired"); +call mtr.add_suppression("Read page with wrong checksum"); let $def_checkinterval=`select @@global.aria_checkpoint_interval`; @@ -78,7 +78,8 @@ perl; syswrite (FILE, $whatever) or die; close FILE; EOF -replace_regex /Table.*t_corrupted2/t_corrupted2/ ; +--replace_result \\ / +--replace_regex /for '.*t_corrupted2/for 't_corrupted2/ --enable_prepare_warnings select * from t_corrupted2; # should show corruption and repair messages --disable_prepare_warnings diff --git a/mysql-test/suite/maria/maria-recovery.result b/mysql-test/suite/maria/maria-recovery.result index 9aa9213d9bd7a..0893d3e3adf63 100644 --- a/mysql-test/suite/maria/maria-recovery.result +++ b/mysql-test/suite/maria/maria-recovery.result @@ -228,7 +228,7 @@ t1 CREATE TABLE `t1` ( `c` varchar(6) DEFAULT NULL, PRIMARY KEY (`i`), KEY `c` (`c`) -) ENGINE=Aria AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 * TEST of UPDATE vs state.auto_increment connection admin; * copied t1 for feeding_recovery @@ -260,7 +260,7 @@ t1 CREATE TABLE `t1` ( `c` varchar(6) DEFAULT NULL, PRIMARY KEY (`i`), KEY `c` (`c`) -) ENGINE=Aria AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 * TEST of INSERT's rollback vs state.auto_increment connection admin; flush table t1; @@ -289,7 +289,7 @@ t1 CREATE TABLE `t1` ( `c` varchar(6) DEFAULT NULL, PRIMARY KEY (`i`), KEY `c` (`c`) -) ENGINE=Aria AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 insert into t1 values(null, "f"); drop table t1; Test that bulk insert works with recovery diff --git a/mysql-test/suite/maria/maria-ucs2.result b/mysql-test/suite/maria/maria-ucs2.result index 5e5bc2cd31223..869930f5f0c60 100644 --- a/mysql-test/suite/maria/maria-ucs2.result +++ b/mysql-test/suite/maria/maria-ucs2.result @@ -22,9 +22,9 @@ test.t1 check status OK SHOW CREATE table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(800) CHARACTER SET ucs2 DEFAULT NULL, + `a` varchar(800) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL, KEY `a` (`a`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(1200),KEY(a)) ENGINE=Aria CHARACTER SET ucs2; Warnings: diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result index ad714f26fb64e..65e94414bf0e2 100644 --- a/mysql-test/suite/maria/maria.result +++ b/mysql-test/suite/maria/maria.result @@ -1035,7 +1035,7 @@ t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 create table t2 like t1; show create table t2; Table Create Table @@ -1043,7 +1043,7 @@ t2 CREATE TABLE `t2` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 create table t3 select * from t1; show create table t3; Table Create Table @@ -1051,7 +1051,7 @@ t3 CREATE TABLE `t3` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 alter table t1 modify c varchar(10); show create table t1; Table Create Table @@ -1059,7 +1059,7 @@ t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 alter table t1 modify v char(10); show create table t1; Table Create Table @@ -1067,7 +1067,7 @@ t1 CREATE TABLE `t1` ( `v` char(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` text DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 alter table t1 modify t varchar(10); Warnings: Note 1265 Data truncated for column 't' at row 2 @@ -1077,7 +1077,7 @@ t1 CREATE TABLE `t1` ( `v` char(10) DEFAULT NULL, `c` varchar(10) DEFAULT NULL, `t` varchar(10) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+*+*+ * @@ -1093,7 +1093,7 @@ t1 CREATE TABLE `t1` ( KEY `v` (`v`), KEY `c` (`c`), KEY `t` (`t`(10)) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 select count(*) from t1; count(*) 270 @@ -1317,7 +1317,7 @@ t1 CREATE TABLE `t1` ( KEY `c` (`c`), KEY `t` (`t`(10)), KEY `v` (`v`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 select count(*) from t1 where v='a'; count(*) 10 @@ -1397,7 +1397,7 @@ t1 CREATE TABLE `t1` ( KEY `c` (`c`), KEY `t` (`t`(10)), KEY `v` (`v`(30)) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 select count(*) from t1 where v='a'; count(*) 10 @@ -1477,7 +1477,7 @@ t1 CREATE TABLE `t1` ( KEY `c` (`c`), KEY `t` (`t`(10)), KEY `v` (`v`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -1555,14 +1555,14 @@ t1 CREATE TABLE `t1` ( KEY `v` (`v`(5)), KEY `c` (`c`(5)), KEY `t` (`t`(5)) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; create table t1 (v char(10) character set utf8); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` char(10) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 + `v` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; create table t1 (v varchar(10), c char(10)) row_format=fixed; show create table t1; @@ -1570,7 +1570,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `v` varchar(10) DEFAULT NULL, `c` char(10) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 ROW_FORMAT=FIXED +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 ROW_FORMAT=FIXED insert into t1 values('a','a'),('a ','a '); select concat('*',v,'*',c,'*') from t1; concat('*',v,'*',c,'*') @@ -1604,7 +1604,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `v` mediumtext DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; set statement sql_mode = 'NO_ENGINE_SUBSTITUTION' for create table t1 (v varchar(65530) character set utf8); @@ -1613,8 +1613,8 @@ Note 1246 Converting column 'v' from VARCHAR to TEXT show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` mediumtext CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 + `v` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; set statement sql_mode='' for create table t1 (v varchar(65535)); @@ -1624,7 +1624,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `v` text DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; set @save_concurrent_insert=@@concurrent_insert; set global concurrent_insert=1; @@ -1854,7 +1854,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=8192 -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; create table t1 (a int not null, key `a` (a) key_block_size=2048); show create table t1; @@ -1862,7 +1862,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=8192 -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; create table t1 (a varchar(4096), key `a` (a)); Warnings: @@ -1872,7 +1872,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(4096) DEFAULT NULL, KEY `a` (`a`(2300)) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; create table t1 (a varchar(4096), key `a` (a) key_block_size=1024); Warnings: @@ -1882,7 +1882,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(4096) DEFAULT NULL, KEY `a` (`a`(2300)) KEY_BLOCK_SIZE=8192 -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; create table t1 (a int not null, b varchar(4096), key (a), key(b)) key_block_size=1024; Warnings: @@ -1894,7 +1894,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(4096) DEFAULT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=8192, KEY `b` (`b`(2300)) KEY_BLOCK_SIZE=8192 -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=1024 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=1024 alter table t1 key_block_size=2048; show create table t1; Table Create Table @@ -1903,7 +1903,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(4096) DEFAULT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=8192, KEY `b` (`b`(2300)) KEY_BLOCK_SIZE=8192 -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=2048 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=2048 alter table t1 add c int, add key (c); show create table t1; Table Create Table @@ -1914,7 +1914,7 @@ t1 CREATE TABLE `t1` ( KEY `a` (`a`) KEY_BLOCK_SIZE=8192, KEY `b` (`b`(2300)) KEY_BLOCK_SIZE=8192, KEY `c` (`c`) KEY_BLOCK_SIZE=8192 -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=2048 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=2048 alter table t1 key_block_size=4096; show create table t1; Table Create Table @@ -1925,7 +1925,7 @@ t1 CREATE TABLE `t1` ( KEY `a` (`a`) KEY_BLOCK_SIZE=8192, KEY `b` (`b`(2300)) KEY_BLOCK_SIZE=8192, KEY `c` (`c`) KEY_BLOCK_SIZE=8192 -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=4096 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=4096 alter table t1 key_block_size=0; show create table t1; Table Create Table @@ -1936,7 +1936,7 @@ t1 CREATE TABLE `t1` ( KEY `a` (`a`) KEY_BLOCK_SIZE=8192, KEY `b` (`b`(2300)) KEY_BLOCK_SIZE=8192, KEY `c` (`c`) KEY_BLOCK_SIZE=8192 -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 alter table t1 add d int, add key (d); show create table t1; Table Create Table @@ -1949,7 +1949,7 @@ t1 CREATE TABLE `t1` ( KEY `b` (`b`(2300)) KEY_BLOCK_SIZE=8192, KEY `c` (`c`) KEY_BLOCK_SIZE=8192, KEY `d` (`d`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; create table t1 (a int not null, b varchar(4096), key (a), key(b)) key_block_size=8192; Warnings: @@ -1961,7 +1961,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(4096) DEFAULT NULL, KEY `a` (`a`), KEY `b` (`b`(2300)) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=8192 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=8192 drop table t1; create table t1 (a int not null, b varchar(4096), key (a) key_block_size=1024, key(b)) key_block_size=8192; Warnings: @@ -1973,7 +1973,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(4096) DEFAULT NULL, KEY `a` (`a`), KEY `b` (`b`(2300)) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=8192 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=8192 drop table t1; create table t1 (a int not null, b int, key (a) key_block_size=1024, key(b) key_block_size=8192) key_block_size=16384; show create table t1; @@ -1983,7 +1983,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=8192, KEY `b` (`b`) KEY_BLOCK_SIZE=8192 -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=16384 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=16384 drop table t1; create table t1 (a int not null, key `a` (a) key_block_size=512); show create table t1; @@ -1991,7 +1991,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=8192 -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; create table t1 (a varchar(4096), key `a` (a) key_block_size=1000000000000000000); Warnings: @@ -2001,7 +2001,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(4096) DEFAULT NULL, KEY `a` (`a`(2300)) KEY_BLOCK_SIZE=8192 -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; create table t1 (a int not null, key `a` (a) key_block_size=1025); show create table t1; @@ -2009,7 +2009,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=8192 -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; create table t1 (a int not null, key key_block_size=1024 (a)); 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 '=1024 (a))' at line 1 @@ -2248,7 +2248,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `n` int(11) NOT NULL, `c` char(1) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 TRANSACTIONAL=1 drop table t1; CREATE TABLE t1 (line LINESTRING NOT NULL) engine=aria; INSERT INTO t1 VALUES (GeomFromText("LINESTRING(0 0)")); @@ -2704,7 +2704,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; CREATE TABLE t1 ( f1 DOUBLE , f2 DOUBLE , f3 DOUBLE , f4 DOUBLE , v3 DOUBLE , v4 DOUBLE , KEY ( v3 ) , KEY ( v4 ) ) engine=maria; REPLACE t1 ( f2 , f1 ) VALUES ( f2 , 56 ) ; @@ -2793,7 +2793,7 @@ t1 CREATE TABLE `t1` ( `id` tinyint(4) NOT NULL AUTO_INCREMENT, `name` char(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 INSERT INTO t1 (name) VALUES ('dog'); UPDATE t1 SET id=-1 WHERE id=1; INSERT INTO t1 (name) VALUES ('cat'); @@ -2893,3 +2893,17 @@ key(c, a), unique(b) partition by hash (b); replace into t1 values (1, 0, 0), (2, 0, 0), (0, 0, 0); drop table t1; +# +# MDEV-28269 Assertion `save_errno' in maria_write or ER_GET_ERRNO +# +connect session1,localhost,root,,; +SET big_tables= on; +Warnings: +Warning 1287 '@@big_tables' is deprecated and will be removed in a future release +SET NAMES 'sjis'; +SELECT 'למטה' AS a UNION SELECT 'Wetter' AS a; +a +למט�? +Wetter +connection default; +disconnect session1; diff --git a/mysql-test/suite/maria/maria.test b/mysql-test/suite/maria/maria.test index 8e617eebc6232..119d005dc72e3 100644 --- a/mysql-test/suite/maria/maria.test +++ b/mysql-test/suite/maria/maria.test @@ -1437,7 +1437,7 @@ CREATE TABLE t1 ( ) ENGINE=aria DEFAULT CHARSET=utf8 PACK_KEYS=0; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR ---exec $MARIA_CHK -d $MYSQLD_DATADIR/test/t1 +--exec $MARIA_CHK -d --ignore-control-file $MYSQLD_DATADIR/test/t1 DROP TABLE t1; # Test warnings with transactional=1 with MyISAM @@ -2112,3 +2112,14 @@ partition by hash (b); replace into t1 values (1, 0, 0), (2, 0, 0), (0, 0, 0); # cleanup drop table t1; + +--echo # +--echo # MDEV-28269 Assertion `save_errno' in maria_write or ER_GET_ERRNO +--echo # + +connect (session1,localhost,root,,); +SET big_tables= on; +SET NAMES 'sjis'; +SELECT 'למטה' AS a UNION SELECT 'Wetter' AS a; +connection default; +disconnect session1; diff --git a/mysql-test/suite/maria/maria2.result b/mysql-test/suite/maria/maria2.result index b4b275120541d..c25659ae1f824 100644 --- a/mysql-test/suite/maria/maria2.result +++ b/mysql-test/suite/maria/maria2.result @@ -1,4 +1,3 @@ -drop table if exists t1,t2; CREATE TABLE t1 ( line BLOB, kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po', @@ -68,3 +67,99 @@ pk apk data 3 4 NULL 5 6 NULL drop table t1; +# +# End of 5.5 tests +# +# +# MDEV-27303 Table corruption after insert into a non-InnoDB table with DESC index +# +create table t1 ( +a bigint default 0, +b bigint default 0, +c binary(128) not null, +d datetime default '0000-00-00 00:00:00', +key (c desc,b,d,a) +) engine=aria; +insert into t1 (c) values +('xx'),('bb'),('tt'),('pp'),('mm'),('yy'),('rr'),('bb'),('yy'),('gg'), +('dd'),('fx'),('wi'),('ix'),('ox'),('mu'),('ux'),('pm'),('mx'),('xu'), +('ul'),('lp'),('px'),('lp'),('xx'),('pq'),('qs'),('se'),('ee'),('xx'), +('rv'),('ff'),('vj'),('jy'),('yn'),('nc'),('nx'),('hj'),('ji'),('ik'), +('kk'),('ww'),('xx'),('yd'),('dw'),('wk'),('kr'),('dd'),('rj'),('jf'), +('bx'),('fc'),('cp'),('pm'),('mw'),('wy'),('yl'),('li'),('ic'),('he'), +('ci'),('il'),('lz'),('zd'),('gz'),('xd'),('ze'),('dm'),('ms'),('xd'), +('sw'),('we'),('nb'),('tx'),('vr'),('xw'),('aa'),('ah'),('hd'),('jl'), +('lf'),('fw'),('wx'),('xh'),('hr'),('zx'),('vw'),('rm'),('mx'),('xt'), +('tp'),('ps'),('sh'),('ga'),('df'),('as'),('gz'),('xd'),('yy'),('xr'); +check table t1 extended; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +# +# MDEV-27309 Server crash or ASAN memcpy-param-overlap upon INSERT into Aria/MyISAM table with DESC key +# +CREATE TABLE t1 (id INT, c BINARY(80), PRIMARY KEY(id)); +ALTER TABLE t1 ADD KEY(c DESC, id); +INSERT INTO t1 VALUES (1,NULL),(2,''),(3,''); +DROP TABLE t1; +# +# MDEV-27330 Wrong sorting order with DESC index and empty strings in MyISAM/Aria table +# +create table t (id int, c char(128) not null, key (c desc)) engine=aria; +insert into t values (1,''),(2,'foo'),(3,''),(4,'bar'); +select c from t order by c; +c + + +bar +foo +drop table t; +# +# MDEV-27340 NULL gets lost (becomes empty string), SELECT hangs with DESC index on MyISAM/Aria table +# +create table t (c char(8), key(c desc)) engine=aria character set utf8mb4; +insert into t values (''),('foo'),(null),(''),('bar'); +check table t; +Table Op Msg_type Msg_text +test.t check status OK +check table t extended; +Table Op Msg_type Msg_text +test.t check status OK +select distinct c from t; +c +NULL + +bar +foo +select c from t; +c +foo +bar + + +NULL +drop table t; +# +# MDEV-27434 DESC attribute does not work with auto-increment on secondary column of multi-part index +# +create table t (a int auto_increment, b int, unique(b,a desc)) engine=aria; +insert ignore into t (b) values (10),(10),(10); +select * from t; +a b +3 10 +2 10 +1 10 +drop table t; +# +# MDEV-27585 Auto-increment on secondary column increments unexpectedly with DESC key +# +create table t (c char(16), i int auto_increment, index (c,i desc)) engine=aria collate latin1_swedish_ci; +insert into t (c) values ('ä'),('a'); +select hex(c),c,i from t order by c, i; +hex(c) c i +61 a 1 +C3A4 ä 1 +drop table t; +# +# End of 10.8 tests +# diff --git a/mysql-test/suite/maria/maria2.test b/mysql-test/suite/maria/maria2.test index df691569e0573..0f4a50ad99d28 100644 --- a/mysql-test/suite/maria/maria2.test +++ b/mysql-test/suite/maria/maria2.test @@ -1,10 +1,5 @@ --source include/have_maria.inc -# Initialise ---disable_warnings -drop table if exists t1,t2; ---enable_warnings - # Test for BUG#36319 # "Aria: table is not empty but DELETE and SELECT find no rows" @@ -109,3 +104,78 @@ select * from t1 order by pk; load data infile '../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); select * from t1 order by pk; drop table t1; + +--echo # +--echo # End of 5.5 tests +--echo # + +--echo # +--echo # MDEV-27303 Table corruption after insert into a non-InnoDB table with DESC index +--echo # +create table t1 ( + a bigint default 0, + b bigint default 0, + c binary(128) not null, + d datetime default '0000-00-00 00:00:00', + key (c desc,b,d,a) +) engine=aria; +insert into t1 (c) values + ('xx'),('bb'),('tt'),('pp'),('mm'),('yy'),('rr'),('bb'),('yy'),('gg'), + ('dd'),('fx'),('wi'),('ix'),('ox'),('mu'),('ux'),('pm'),('mx'),('xu'), + ('ul'),('lp'),('px'),('lp'),('xx'),('pq'),('qs'),('se'),('ee'),('xx'), + ('rv'),('ff'),('vj'),('jy'),('yn'),('nc'),('nx'),('hj'),('ji'),('ik'), + ('kk'),('ww'),('xx'),('yd'),('dw'),('wk'),('kr'),('dd'),('rj'),('jf'), + ('bx'),('fc'),('cp'),('pm'),('mw'),('wy'),('yl'),('li'),('ic'),('he'), + ('ci'),('il'),('lz'),('zd'),('gz'),('xd'),('ze'),('dm'),('ms'),('xd'), + ('sw'),('we'),('nb'),('tx'),('vr'),('xw'),('aa'),('ah'),('hd'),('jl'), + ('lf'),('fw'),('wx'),('xh'),('hr'),('zx'),('vw'),('rm'),('mx'),('xt'), + ('tp'),('ps'),('sh'),('ga'),('df'),('as'),('gz'),('xd'),('yy'),('xr'); +check table t1 extended; +drop table t1; + +--echo # +--echo # MDEV-27309 Server crash or ASAN memcpy-param-overlap upon INSERT into Aria/MyISAM table with DESC key +--echo # +CREATE TABLE t1 (id INT, c BINARY(80), PRIMARY KEY(id)); +ALTER TABLE t1 ADD KEY(c DESC, id); +INSERT INTO t1 VALUES (1,NULL),(2,''),(3,''); +DROP TABLE t1; + +--echo # +--echo # MDEV-27330 Wrong sorting order with DESC index and empty strings in MyISAM/Aria table +--echo # +create table t (id int, c char(128) not null, key (c desc)) engine=aria; +insert into t values (1,''),(2,'foo'),(3,''),(4,'bar'); +select c from t order by c; +drop table t; + +--echo # +--echo # MDEV-27340 NULL gets lost (becomes empty string), SELECT hangs with DESC index on MyISAM/Aria table +--echo # +create table t (c char(8), key(c desc)) engine=aria character set utf8mb4; +insert into t values (''),('foo'),(null),(''),('bar'); +check table t; +check table t extended; +select distinct c from t; +select c from t; +drop table t; + +--echo # +--echo # MDEV-27434 DESC attribute does not work with auto-increment on secondary column of multi-part index +--echo # +create table t (a int auto_increment, b int, unique(b,a desc)) engine=aria; +insert ignore into t (b) values (10),(10),(10); +select * from t; +drop table t; + +--echo # +--echo # MDEV-27585 Auto-increment on secondary column increments unexpectedly with DESC key +--echo # +create table t (c char(16), i int auto_increment, index (c,i desc)) engine=aria collate latin1_swedish_ci; +insert into t (c) values ('ä'),('a'); +select hex(c),c,i from t order by c, i; +drop table t; + +--echo # +--echo # End of 10.8 tests +--echo # diff --git a/mysql-test/suite/maria/maria3.result b/mysql-test/suite/maria/maria3.result index fa79402922661..fcdd08382a08b 100644 --- a/mysql-test/suite/maria/maria3.result +++ b/mysql-test/suite/maria/maria3.result @@ -13,7 +13,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=8192 -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; create table t1 (a varchar(4096), key `a` (a) key_block_size=1000000000000000000); Warnings: @@ -23,7 +23,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(4096) DEFAULT NULL, KEY `a` (`a`(2300)) KEY_BLOCK_SIZE=8192 -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; create table t1 (a int not null, key `a` (a) key_block_size=1025); show create table t1; @@ -31,7 +31,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, KEY `a` (`a`) KEY_BLOCK_SIZE=8192 -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; create table t1 (a int not null, key key_block_size=1024 (a)); 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 '=1024 (a))' at line 1 @@ -87,14 +87,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 TRANSACTIONAL=0 drop table t1; create table t1 (a int) row_format=dynamic transactional=0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 ROW_FORMAT=DYNAMIC TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 ROW_FORMAT=DYNAMIC TRANSACTIONAL=0 drop table t1; create table t1 (a int) row_format=dynamic transactional=1; Warnings: @@ -103,13 +103,13 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 ROW_FORMAT=PAGE TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 ROW_FORMAT=PAGE TRANSACTIONAL=1 alter table t1 row_format=PAGE; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 ROW_FORMAT=PAGE TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 ROW_FORMAT=PAGE TRANSACTIONAL=1 alter table t1 row_format=DYNAMIC; Warnings: Note 1478 Row format set to PAGE because of TRANSACTIONAL=1 option @@ -117,46 +117,46 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 ROW_FORMAT=PAGE TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 ROW_FORMAT=PAGE TRANSACTIONAL=1 alter table t1 transactional=0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 ROW_FORMAT=DYNAMIC TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 ROW_FORMAT=DYNAMIC TRANSACTIONAL=0 alter table t1 row_format=DYNAMIC; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 ROW_FORMAT=DYNAMIC TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 ROW_FORMAT=DYNAMIC TRANSACTIONAL=0 drop table t1; create table t1 (a int) row_format=PAGE; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 ROW_FORMAT=PAGE +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 ROW_FORMAT=PAGE drop table t1; create table t1 (a int) row_format=PAGE TRANSACTIONAL=DEFAULT; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 ROW_FORMAT=PAGE +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 ROW_FORMAT=PAGE alter table t1 row_format=DYNAMIC; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 ROW_FORMAT=DYNAMIC +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 ROW_FORMAT=DYNAMIC drop table t1; create table t1 (a int) transactional=0 row_format=FIXED; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 ROW_FORMAT=FIXED TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 ROW_FORMAT=FIXED TRANSACTIONAL=0 alter table t1 transactional=1; Warnings: Note 1478 Row format set to PAGE because of TRANSACTIONAL=1 option @@ -164,20 +164,20 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 ROW_FORMAT=PAGE TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 ROW_FORMAT=PAGE TRANSACTIONAL=1 alter table t1 transactional=0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 ROW_FORMAT=FIXED TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 ROW_FORMAT=FIXED TRANSACTIONAL=0 drop table t1; create table t1 (a int) transactional=0 row_format=FIXED; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 ROW_FORMAT=FIXED TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 ROW_FORMAT=FIXED TRANSACTIONAL=0 alter table t1 transactional=1; Warnings: Note 1478 Row format set to PAGE because of TRANSACTIONAL=1 option @@ -185,13 +185,13 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 ROW_FORMAT=PAGE TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 ROW_FORMAT=PAGE TRANSACTIONAL=1 alter table t1 transactional=0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 ROW_FORMAT=FIXED TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 ROW_FORMAT=FIXED TRANSACTIONAL=0 drop table t1; create table `t1` ( t1_name varchar(255) default null, @@ -311,6 +311,7 @@ aria_encrypt_tables # aria_force_start_after_recovery_failures # aria_group_commit # aria_group_commit_interval # +aria_log_dir_path # aria_log_file_size # aria_log_purge_type # aria_max_sort_file_size # @@ -396,7 +397,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 set global aria_page_checksum=0; drop table t1; set global aria_log_file_size=4294967296; @@ -516,7 +517,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `n` int(11) NOT NULL, `c` char(1) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 drop table t1; create table t1 (n int not null, c char(1)) engine=aria transactional=1; alter table t1 engine=myisam; @@ -528,7 +529,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `n` int(11) NOT NULL, `c` char(1) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 TRANSACTIONAL=1 drop table t1; create table t1 (n int not null, c char(1)) engine=myisam transactional=1; Warnings: @@ -539,7 +540,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `n` int(11) NOT NULL, `c` char(1) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 TRANSACTIONAL=1 drop table t1; create table t1 (a int, key(a)) transactional=0; insert into t1 values (0),(1),(2),(3),(4); diff --git a/mysql-test/suite/maria/max_length.result b/mysql-test/suite/maria/max_length.result index ca02eb6f4b2b3..ebb0305750448 100644 --- a/mysql-test/suite/maria/max_length.result +++ b/mysql-test/suite/maria/max_length.result @@ -10,7 +10,7 @@ t1 CREATE TABLE `t1` ( `v` varchar(2000) DEFAULT NULL, `b` blob DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=Aria DEFAULT CHARSET=latin1 MAX_ROWS=2 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MAX_ROWS=2 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE show create table t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -19,7 +19,7 @@ t2 CREATE TABLE `t2` ( `b` blob DEFAULT NULL, PRIMARY KEY (`id`), KEY `v` (`v`) -) ENGINE=Aria DEFAULT CHARSET=latin1 MAX_ROWS=20000000 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MAX_ROWS=20000000 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE lock tables t1 write,t2 write; show table status like "t_"; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary @@ -79,7 +79,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(10) unsigned DEFAULT NULL, `c2` char(80) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 MIN_ROWS=1000000 PAGE_CHECKSUM=1 ROW_FORMAT=FIXED +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MIN_ROWS=1000000 PAGE_CHECKSUM=1 ROW_FORMAT=FIXED insert into t1 select seq,seq from seq_1_to_100000; create or replace table t1 ( c1 int unsigned, @@ -90,7 +90,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(10) unsigned DEFAULT NULL, `c2` char(80) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 ROW_FORMAT=FIXED +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 ROW_FORMAT=FIXED insert into t1 select seq,seq from seq_1_to_100000; create or replace table t1 ( c1 int unsigned, @@ -101,7 +101,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(10) unsigned DEFAULT NULL, `c2` char(80) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=0 insert into t1 select seq,seq from seq_1_to_100000; create or replace table t1 ( c1 int unsigned, @@ -112,7 +112,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(10) unsigned DEFAULT NULL, `c2` char(80) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 MAX_ROWS=10 PAGE_CHECKSUM=1 ROW_FORMAT=FIXED +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MAX_ROWS=10 PAGE_CHECKSUM=1 ROW_FORMAT=FIXED insert into t1 select seq,seq from seq_1_to_100000; ERROR HY000: The table 't1' is full select count(*) from t1; @@ -127,7 +127,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(10) unsigned DEFAULT NULL, `c2` char(80) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 MAX_ROWS=10 PAGE_CHECKSUM=1 ROW_FORMAT=DYNAMIC +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MAX_ROWS=10 PAGE_CHECKSUM=1 ROW_FORMAT=DYNAMIC insert into t1 select seq,seq from seq_1_to_100000; ERROR HY000: The table 't1' is full select count(*) from t1; @@ -146,7 +146,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(10) unsigned DEFAULT NULL, `c2` char(80) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 MAX_ROWS=10 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MAX_ROWS=10 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE insert into t1 select seq,seq from seq_1_to_100000; select count(*) from t1; count(*) @@ -164,7 +164,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(10) unsigned DEFAULT NULL, `c2` char(80) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 MAX_ROWS=10 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MAX_ROWS=10 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE insert into t1 select seq,seq from seq_1_to_10000000; ERROR HY000: The table 't1' is full select count(*) from t1; diff --git a/mysql-test/suite/maria/max_length.test b/mysql-test/suite/maria/max_length.test index a5bfb0b8fd61b..02df51b33d787 100644 --- a/mysql-test/suite/maria/max_length.test +++ b/mysql-test/suite/maria/max_length.test @@ -6,6 +6,7 @@ --source include/big_test.inc # This test is too slow for valgrind --source include/not_valgrind.inc +--source include/not_msan.inc drop table if exists t1,t2; diff --git a/mysql-test/suite/maria/mrr.result b/mysql-test/suite/maria/mrr.result index a8d444d4bd4fe..066f1a50aab34 100644 --- a/mysql-test/suite/maria/mrr.result +++ b/mysql-test/suite/maria/mrr.result @@ -9,7 +9,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 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 + 10*(B.a + 10*C.a) from t1 A, t1 B, t1 C; @@ -326,10 +326,10 @@ SELECT table2 .`col_datetime_key` FROM t2 JOIN ( t1 table2 JOIN t2 table3 ON table3 .`col_varchar_key` < table2 .`col_varchar_key` ) ON table3 .`col_varchar_nokey` ; col_datetime_key Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'd' -Warning 1292 Truncated incorrect DOUBLE value: 'd' -Warning 1292 Truncated incorrect DOUBLE value: 'd' -Warning 1292 Truncated incorrect DOUBLE value: 'd' +Warning 1292 Truncated incorrect DECIMAL value: 'd' +Warning 1292 Truncated incorrect DECIMAL value: 'd' +Warning 1292 Truncated incorrect DECIMAL value: 'd' +Warning 1292 Truncated incorrect DECIMAL value: 'd' drop table t1, t2; set join_cache_level=@save_join_cache_level; CREATE TABLE t1( diff --git a/mysql-test/suite/maria/ps_maria.result b/mysql-test/suite/maria/ps_maria.result index 6f5d557569b11..5c128a32dd17c 100644 --- a/mysql-test/suite/maria/ps_maria.result +++ b/mysql-test/suite/maria/ps_maria.result @@ -1805,7 +1805,7 @@ t5 CREATE TABLE `t5` ( `param13` decimal(65,38) DEFAULT NULL, `param14` longtext DEFAULT NULL, `param15` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def test t5 t5 const01 const01 3 1 1 N 36865 0 63 diff --git a/mysql-test/suite/maria/repair.result b/mysql-test/suite/maria/repair.result index 722d9f28712c7..458b550360248 100644 --- a/mysql-test/suite/maria/repair.result +++ b/mysql-test/suite/maria/repair.result @@ -31,3 +31,34 @@ SET max_session_mem_used=50000; REPAIR LOCAL TABLE t1 USE_FRM; REPAIR LOCAL TABLE t1; DROP TABLE t1; +SET max_session_mem_used=default; + +# MDEV-17223 Assertion `thd->killed != 0' failed in +# ha_maria::enable_indexes +# +CREATE OR REPLACE TABLE t1 (c VARCHAR(1024) NOT NULL) ENGINE=Aria ROW_FORMAT FIXED; +insert into t1 select char(seq) from seq_65_to_256; +insert into t1 values ("a"); +ALTER TABLE t1 ADD PRIMARY KEY(c(67)); +ERROR 23000: Duplicate entry 'a' for key 'PRIMARY' +select count(*) from t1; +count(*) +193 +drop table t1; + +# MDEV-17223 Assertion `thd->killed != 0' failed in +# ha_maria::enable_indexes +# +SET SESSION aria_sort_buffer_size=1023; +Warnings: +Warning 1292 Truncated incorrect aria_sort_buffer_size value: '1023' +CREATE TABLE t2 (c TEXT,INDEX(c(1000))) ENGINE=Aria; +INSERT INTO t2 select char(seq) from seq_65_to_255; +SELECT COUNT(*) FROM t2; +COUNT(*) +191 +DROP TABLE t2; +SET SESSION aria_sort_buffer_size=default; +# +# End of 10.3 tests +# diff --git a/mysql-test/suite/maria/repair.test b/mysql-test/suite/maria/repair.test index 571f861c512fa..688ac076e1db7 100644 --- a/mysql-test/suite/maria/repair.test +++ b/mysql-test/suite/maria/repair.test @@ -3,6 +3,7 @@ # as memory usage is different compared to normal server. --source include/not_embedded.inc +--source include/have_sequence.inc # # MDEV-11539 test_if_reopen: Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed upon select from I_S @@ -41,3 +42,35 @@ REPAIR LOCAL TABLE t1 USE_FRM; REPAIR LOCAL TABLE t1; --enable_result_log DROP TABLE t1; +SET max_session_mem_used=default; + +--echo +--echo # MDEV-17223 Assertion `thd->killed != 0' failed in +--echo # ha_maria::enable_indexes +--echo # + +CREATE OR REPLACE TABLE t1 (c VARCHAR(1024) NOT NULL) ENGINE=Aria ROW_FORMAT FIXED; +insert into t1 select char(seq) from seq_65_to_256; +insert into t1 values ("a"); +--error ER_DUP_ENTRY +ALTER TABLE t1 ADD PRIMARY KEY(c(67)); +select count(*) from t1; +drop table t1; + +--echo +--echo # MDEV-17223 Assertion `thd->killed != 0' failed in +--echo # ha_maria::enable_indexes +--echo # + +SET SESSION aria_sort_buffer_size=1023; +CREATE TABLE t2 (c TEXT,INDEX(c(1000))) ENGINE=Aria; +--disable_warnings +INSERT INTO t2 select char(seq) from seq_65_to_255; +--enable_warnings +SELECT COUNT(*) FROM t2; +DROP TABLE t2; +SET SESSION aria_sort_buffer_size=default; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/suite/maria/rollback.result b/mysql-test/suite/maria/rollback.result index fd2e012805a1e..2e58387ce57e4 100644 --- a/mysql-test/suite/maria/rollback.result +++ b/mysql-test/suite/maria/rollback.result @@ -1,4 +1,5 @@ -call mtr.add_suppression("Table '.*' is marked as crashed and should be repaired"); +reset master; +call mtr.add_suppression("Table was marked as crashed"); call mtr.add_suppression("Checking table: .*"); create table t1 (a int primary key auto_increment, b int) engine=aria transactional= 1; create table t2 (a int primary key auto_increment, b int) engine=aria transactional= 0; @@ -54,7 +55,7 @@ a b 10 11 11 12 Warnings: -Error 145 Table './test/t2' is marked as crashed and should be repaired +Error 145 Got error '145 "Table was marked as crashed and should be repaired"' for './test/t2' Warning 1034 1 client is using or hasn't closed the table properly Note 1034 Table is fixed insert into t1 (b) values (100),(200); @@ -92,7 +93,7 @@ NEXT VALUE for s1 seq 11 3 12 4 Warnings: -Error 145 Table './test/s1' is marked as crashed and should be repaired +Error 145 Got error '145 "Table was marked as crashed and should be repaired"' for './test/s1' Warning 1034 1 client is using or hasn't closed the table properly Note 1034 Table is fixed drop table t1,t2; @@ -100,7 +101,7 @@ drop sequence s1; include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# -master-bin.000001 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Table \'.*\' is marked as crashed and should be repaired' COLLATE 'latin1_swedish_ci')) +master-bin.000001 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Table was marked as crashed' COLLATE 'latin1_swedish_ci')) master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Checking table: .*' COLLATE 'latin1_swedish_ci')) diff --git a/mysql-test/suite/maria/rollback.test b/mysql-test/suite/maria/rollback.test index 40a96b9b05bb5..d42be9274e6dd 100644 --- a/mysql-test/suite/maria/rollback.test +++ b/mysql-test/suite/maria/rollback.test @@ -3,7 +3,9 @@ # no-protocol doesn't print warnings about repaired tables --source include/no_protocol.inc -call mtr.add_suppression("Table '.*' is marked as crashed and should be repaired"); +reset master; # clear binlogs + +call mtr.add_suppression("Table was marked as crashed"); call mtr.add_suppression("Checking table: .*"); # diff --git a/mysql-test/suite/maria/truncate.result b/mysql-test/suite/maria/truncate.result index a9adcb9ae8776..63e7e0e6764b9 100644 --- a/mysql-test/suite/maria/truncate.result +++ b/mysql-test/suite/maria/truncate.result @@ -40,7 +40,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=0 TRUNCATE TABLE t1; INSERT INTO t1 (i) VALUES (1); lock table t1 write; diff --git a/mysql-test/suite/mariabackup/alter_copy_excluded.test b/mysql-test/suite/mariabackup/alter_copy_excluded.test index 195aa09b5df1a..599fb46bdd5de 100644 --- a/mysql-test/suite/mariabackup/alter_copy_excluded.test +++ b/mysql-test/suite/mariabackup/alter_copy_excluded.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_debug.inc +--source include/have_debug_sync.inc # The test demonstrates that intermediate tables (ALTER TABLE...ALGORITHM=COPY) # will not be included in a backup. diff --git a/mysql-test/suite/mariabackup/alter_copy_race.test b/mysql-test/suite/mariabackup/alter_copy_race.test index 1ee69168115b0..553643bf6671f 100644 --- a/mysql-test/suite/mariabackup/alter_copy_race.test +++ b/mysql-test/suite/mariabackup/alter_copy_race.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_debug.inc +--source include/have_debug_sync.inc # The test demonstrates that intermediate tables (ALTER TABLE...ALGORITHM=COPY) # are not always properly locked, e.g., can be dropped after diff --git a/mysql-test/suite/mariabackup/apply-log-only-incr.test b/mysql-test/suite/mariabackup/apply-log-only-incr.test index c2d23c88a3e6d..b110d12540e76 100644 --- a/mysql-test/suite/mariabackup/apply-log-only-incr.test +++ b/mysql-test/suite/mariabackup/apply-log-only-incr.test @@ -1,4 +1,5 @@ --source include/have_innodb.inc +--source include/innodb_undo_tablespaces.inc call mtr.add_suppression("InnoDB: New log files created"); diff --git a/mysql-test/suite/mariabackup/aria_log_dir_path.result b/mysql-test/suite/mariabackup/aria_log_dir_path.result new file mode 100644 index 0000000000000..1a877321bbebe --- /dev/null +++ b/mysql-test/suite/mariabackup/aria_log_dir_path.result @@ -0,0 +1,41 @@ +# +# MDEV-30968 mariadb-backup does not copy Aria logs if aria_log_dir_path is used +# +# Restart mariadbd with the test specific parameters +# restart: --aria-log-file-size=8388608 --aria-log-purge-type=external --loose-aria-log-dir-path=MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path +# Create and populate an Aria table (and Aria logs) +CREATE TABLE t1 (id INT, txt LONGTEXT) ENGINE=Aria; +BEGIN NOT ATOMIC +FOR id IN 0..9 DO +INSERT INTO test.t1 (id, txt) VALUES (id, REPEAT(id,1024*1024)); +END FOR; +END; +$$ +# Testing aria log files before --backup +SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/; +SHOW ENGINE aria logs; +Type Name Status +Aria aria_log.00000001 free +Aria aria_log.00000002 in use +# mariadb-backup --backup +# mariadb-backup --prepare +# shutdown server +# remove datadir +# remove aria-log-dir-path +# mariadb-backup --copy-back +# with parameters: --defaults-file=MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=MYSQLTEST_VARDIR/mysqld.1/data/ --target-dir=MYSQLTEST_VARDIR/tmp/backup --parallel=2 --throttle=1 --aria-log-dir-path=MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path +# starting server +# restart: --aria-log-file-size=8388608 --aria-log-purge-type=external --loose-aria-log-dir-path=MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path +# Check that the table is there after --copy-back +SELECT COUNT(*) from t1; +COUNT(*) +10 +DROP TABLE t1; +# Testing aria log files after --copy-back +SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/; +SHOW ENGINE aria logs; +Type Name Status +Aria aria_log.00000001 free +Aria aria_log.00000002 in use +# Restarting mariadbd with default parameters +# restart diff --git a/mysql-test/suite/mariabackup/aria_log_dir_path.test b/mysql-test/suite/mariabackup/aria_log_dir_path.test new file mode 100644 index 0000000000000..0178cd4eae5bc --- /dev/null +++ b/mysql-test/suite/mariabackup/aria_log_dir_path.test @@ -0,0 +1,105 @@ +--source include/have_maria.inc + +--echo # +--echo # MDEV-30968 mariadb-backup does not copy Aria logs if aria_log_dir_path is used +--echo # + +--let $datadir=`SELECT @@datadir` +--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup + +if ($ARIA_LOGDIR_MARIADB == '') +{ + --let $ARIA_LOGDIR_MARIADB=$MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path +} + +if ($ARIA_LOGDIR_FS == '') +{ + --let $ARIA_LOGDIR_FS=$MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path +} + +--let $server_parameters=--aria-log-file-size=8388608 --aria-log-purge-type=external --loose-aria-log-dir-path=$ARIA_LOGDIR_MARIADB + + +--echo # Restart mariadbd with the test specific parameters +--mkdir $ARIA_LOGDIR_FS +--let $restart_parameters=$server_parameters +--source include/restart_mysqld.inc + + +--echo # Create and populate an Aria table (and Aria logs) +CREATE TABLE t1 (id INT, txt LONGTEXT) ENGINE=Aria; +DELIMITER $$; +BEGIN NOT ATOMIC + FOR id IN 0..9 DO + INSERT INTO test.t1 (id, txt) VALUES (id, REPEAT(id,1024*1024)); + END FOR; +END; +$$ +DELIMITER ;$$ + + +--echo # Testing aria log files before --backup +SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/; +--file_exists $ARIA_LOGDIR_FS/aria_log_control +--file_exists $ARIA_LOGDIR_FS/aria_log.00000001 +--file_exists $ARIA_LOGDIR_FS/aria_log.00000002 +--error 1 +--file_exists $ARIA_LOGDIR_FS/aria_log.00000003 +--replace_regex /Size +[0-9]+ ; .+aria_log/aria_log/ +SHOW ENGINE aria logs; + + +--echo # mariadb-backup --backup +--disable_result_log +--mkdir $targetdir +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir +--enable_result_log + + +--echo # mariadb-backup --prepare +--disable_result_log +--exec $XTRABACKUP --prepare --target-dir=$targetdir +--enable_result_log + + +--echo # shutdown server +--disable_result_log +--source include/shutdown_mysqld.inc +--echo # remove datadir +--rmdir $datadir +--echo # remove aria-log-dir-path +--rmdir $ARIA_LOGDIR_FS + +--echo # mariadb-backup --copy-back +--let $mariadb_backup_parameters=--defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$datadir --target-dir=$targetdir --parallel=2 --throttle=1 --aria-log-dir-path=$ARIA_LOGDIR_MARIADB +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec echo "# with parameters: $mariadb_backup_parameters" +--exec $XTRABACKUP $mariadb_backup_parameters + +--echo # starting server +--let $restart_parameters=$server_parameters +--source include/start_mysqld.inc +--enable_result_log +--rmdir $targetdir + + +--echo # Check that the table is there after --copy-back +SELECT COUNT(*) from t1; +DROP TABLE t1; + + +--echo # Testing aria log files after --copy-back +SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/; +--file_exists $ARIA_LOGDIR_FS/aria_log_control +--file_exists $ARIA_LOGDIR_FS/aria_log.00000001 +--file_exists $ARIA_LOGDIR_FS/aria_log.00000002 +--error 1 +--file_exists $ARIA_LOGDIR_FS/aria_log.00000003 +--replace_regex /Size +[0-9]+ ; .+aria_log/aria_log/ +SHOW ENGINE aria logs; + + +--echo # Restarting mariadbd with default parameters +--let $restart_parameters= +--source include/restart_mysqld.inc +--rmdir $ARIA_LOGDIR_FS diff --git a/mysql-test/suite/mariabackup/aria_log_dir_path_rel.result b/mysql-test/suite/mariabackup/aria_log_dir_path_rel.result new file mode 100644 index 0000000000000..7fef26096e0c5 --- /dev/null +++ b/mysql-test/suite/mariabackup/aria_log_dir_path_rel.result @@ -0,0 +1,41 @@ +# +# MDEV-30968 mariadb-backup does not copy Aria logs if aria_log_dir_path is used +# +# Restart mariadbd with the test specific parameters +# restart: --aria-log-file-size=8388608 --aria-log-purge-type=external --loose-aria-log-dir-path=../../tmp/backup_aria_log_dir_path_rel +# Create and populate an Aria table (and Aria logs) +CREATE TABLE t1 (id INT, txt LONGTEXT) ENGINE=Aria; +BEGIN NOT ATOMIC +FOR id IN 0..9 DO +INSERT INTO test.t1 (id, txt) VALUES (id, REPEAT(id,1024*1024)); +END FOR; +END; +$$ +# Testing aria log files before --backup +SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/; +SHOW ENGINE aria logs; +Type Name Status +Aria aria_log.00000001 free +Aria aria_log.00000002 in use +# mariadb-backup --backup +# mariadb-backup --prepare +# shutdown server +# remove datadir +# remove aria-log-dir-path +# mariadb-backup --copy-back +# with parameters: --defaults-file=MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=MYSQLTEST_VARDIR/mysqld.1/data/ --target-dir=MYSQLTEST_VARDIR/tmp/backup --parallel=2 --throttle=1 --aria-log-dir-path=../../tmp/backup_aria_log_dir_path_rel +# starting server +# restart: --aria-log-file-size=8388608 --aria-log-purge-type=external --loose-aria-log-dir-path=../../tmp/backup_aria_log_dir_path_rel +# Check that the table is there after --copy-back +SELECT COUNT(*) from t1; +COUNT(*) +10 +DROP TABLE t1; +# Testing aria log files after --copy-back +SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/; +SHOW ENGINE aria logs; +Type Name Status +Aria aria_log.00000001 free +Aria aria_log.00000002 in use +# Restarting mariadbd with default parameters +# restart diff --git a/mysql-test/suite/mariabackup/aria_log_dir_path_rel.test b/mysql-test/suite/mariabackup/aria_log_dir_path_rel.test new file mode 100644 index 0000000000000..c8169959929b9 --- /dev/null +++ b/mysql-test/suite/mariabackup/aria_log_dir_path_rel.test @@ -0,0 +1,4 @@ +--let $ARIA_LOGDIR_MARIADB=../../tmp/backup_aria_log_dir_path_rel +--let $ARIA_LOGDIR_FS=$MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path_rel + +--source aria_log_dir_path.test diff --git a/mysql-test/suite/mariabackup/backup_grants.result b/mysql-test/suite/mariabackup/backup_grants.result index ed793e7ff1a24..56899f8d9c0a8 100644 --- a/mysql-test/suite/mariabackup/backup_grants.result +++ b/mysql-test/suite/mariabackup/backup_grants.result @@ -3,4 +3,12 @@ FOUND 1 /missing required privilege RELOAD/ in backup.log FOUND 1 /missing required privilege PROCESS/ in backup.log FOUND 1 /GRANT USAGE ON/ in backup.log GRANT RELOAD, PROCESS on *.* to backup@localhost; +NOT FOUND /missing required privilege REPLICA MONITOR/ in backup.log +GRANT REPLICA MONITOR ON *.* TO backup@localhost; +REVOKE REPLICA MONITOR ON *.* FROM backup@localhost; +GRANT CONNECTION ADMIN ON *.* TO backup@localhost; +FOUND 1 /missing required privilege REPLICATION SLAVE ADMIN/ in backup.log +NOT FOUND /missing required privilege REPLICA MONITOR/ in backup.log +GRANT REPLICATION SLAVE ADMIN ON *.* TO backup@localhost; +GRANT REPLICA MONITOR ON *.* TO backup@localhost; DROP USER backup@localhost; diff --git a/mysql-test/suite/mariabackup/backup_grants.test b/mysql-test/suite/mariabackup/backup_grants.test index eadeedd9b5f7a..894ae73aeb919 100644 --- a/mysql-test/suite/mariabackup/backup_grants.test +++ b/mysql-test/suite/mariabackup/backup_grants.test @@ -25,7 +25,62 @@ GRANT RELOAD, PROCESS on *.* to backup@localhost; --disable_result_log exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --target-dir=$targetdir; --enable_result_log +rmdir $targetdir; -DROP USER backup@localhost; -# Cleanup +# MDEV-23607 Warning: missing required privilege REPLICATION CLIENT +# --slave-info and galera info require REPLICA MONITOR +--disable_result_log +error 1; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --slave-info --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log; +--enable_result_log +rmdir $targetdir; + +--let SEARCH_PATTERN= missing required privilege REPLICA MONITOR +--source include/search_pattern_in_file.inc + +GRANT REPLICA MONITOR ON *.* TO backup@localhost; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --slave-info --target-dir=$targetdir; +--enable_result_log +rmdir $targetdir; +REVOKE REPLICA MONITOR ON *.* FROM backup@localhost; + +# TODO need a query that would delay a BACKUP STAGE START/ BACKUP STAGE BLOCK_COMMIT longer than the kill-long-queries-timeout +#--send SELECT SLEEP(9) kill_me +## kill-long-query-type=(not empty) requires CONNECTION ADMIN +#--disable_result_log +#error 1; +#--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --kill-long-query-type=all --kill-long-queries-timeout=4 --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log; +#--reap +#--enable_result_log +#rmdir $targetdir; +# +#--let SEARCH_PATTERN= missing required privilege CONNECTION ADMIN +#--source include/search_pattern_in_file.inc + +GRANT CONNECTION ADMIN ON *.* TO backup@localhost; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --kill-long-query-type=all --kill-long-queries-timeout=1 --target-dir=$targetdir; +--enable_result_log +rmdir $targetdir; + +# --safe-slave-backup requires REPLICATION SLAVE ADMIN, and REPLICA MONITOR +--disable_result_log +error 1; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --safe-slave-backup --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log; +--enable_result_log rmdir $targetdir; + +--let SEARCH_PATTERN= missing required privilege REPLICATION SLAVE ADMIN +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN= missing required privilege REPLICA MONITOR +--source include/search_pattern_in_file.inc + +GRANT REPLICATION SLAVE ADMIN ON *.* TO backup@localhost; +GRANT REPLICA MONITOR ON *.* TO backup@localhost; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --safe-slave-backup --target-dir=$targetdir; +--enable_result_log +rmdir $targetdir; + +DROP USER backup@localhost; diff --git a/mysql-test/suite/mariabackup/big_innodb_log.test b/mysql-test/suite/mariabackup/big_innodb_log.test index 247e7179c4278..85d22a8227be2 100644 --- a/mysql-test/suite/mariabackup/big_innodb_log.test +++ b/mysql-test/suite/mariabackup/big_innodb_log.test @@ -5,9 +5,10 @@ # recovery process with such numbers. --source include/have_innodb.inc --source include/have_debug.inc +--source include/no_valgrind_without_big.inc --let MYSQLD_DATADIR= `select @@datadir` -let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --debug-dbug=+d,innodb_small_log_block_no_limit; +let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --tmpdir=$MYSQL_TMP_DIR --debug-dbug=+d,innodb_small_log_block_no_limit; --source include/kill_mysqld.inc --rmdir $MYSQLD_DATADIR diff --git a/mysql-test/suite/mariabackup/binlog.result b/mysql-test/suite/mariabackup/binlog.result index 4f8ed4185cea4..7851c2ba0697c 100644 --- a/mysql-test/suite/mariabackup/binlog.result +++ b/mysql-test/suite/mariabackup/binlog.result @@ -3,6 +3,6 @@ INSERT INTO t VALUES(1); SHOW VARIABLES like 'log_bin'; Variable_name Value log_bin ON -FOUND 1 /Last binlog file .*, position .*/ in current_test +FOUND 1 /Last binlog file .+, position \d+/ in current_test # expect FOUND DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/binlog.test b/mysql-test/suite/mariabackup/binlog.test index b2f08c2d7bb52..9d62e5f8d6bb7 100644 --- a/mysql-test/suite/mariabackup/binlog.test +++ b/mysql-test/suite/mariabackup/binlog.test @@ -15,7 +15,7 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir exec $XTRABACKUP --prepare --binlog-info=1 --target-dir=$basedir ; let SEARCH_FILE=$MYSQLTEST_VARDIR/log/current_test; ---let SEARCH_PATTERN= Last binlog file .*, position .* +--let SEARCH_PATTERN= Last binlog file .+, position \d+ --source include/search_pattern_in_file.inc --echo # expect FOUND diff --git a/mysql-test/suite/mariabackup/compress_qpress.test b/mysql-test/suite/mariabackup/compress_qpress.test index f86efe44e5ded..c7762f8e55efd 100644 --- a/mysql-test/suite/mariabackup/compress_qpress.test +++ b/mysql-test/suite/mariabackup/compress_qpress.test @@ -12,6 +12,10 @@ INSERT INTO t VALUES(2); echo # xtrabackup prepare; --disable_result_log +# Because MDEV-24626 in 10.6 optimized file creation, we could end up with +# t.new.qp instead of t.ibd.qp unless a log checkpoint happened to be +# triggered between CREATE TABLE and the backup run. +--replace_result t.new t.ibd list_files $targetdir/test *.qp; exec $XTRABACKUP --decompress --remove-original --target-dir=$targetdir; list_files $targetdir/test *.qp; diff --git a/mysql-test/suite/mariabackup/compression_providers_unloaded.result b/mysql-test/suite/mariabackup/compression_providers_unloaded.result index 10c06971ab4f0..ccf3e0355a4c8 100644 --- a/mysql-test/suite/mariabackup/compression_providers_unloaded.result +++ b/mysql-test/suite/mariabackup/compression_providers_unloaded.result @@ -1,5 +1,6 @@ call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt"); call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed"); +call mtr.add_suppression("Refusing to load corrupted table"); # # Testing mariabackup with bzip2 compression # diff --git a/mysql-test/suite/mariabackup/compression_providers_unloaded.test b/mysql-test/suite/mariabackup/compression_providers_unloaded.test index 715ab4ae8c0ab..673c16d03cf5e 100644 --- a/mysql-test/suite/mariabackup/compression_providers_unloaded.test +++ b/mysql-test/suite/mariabackup/compression_providers_unloaded.test @@ -1,6 +1,7 @@ let $alg = $MTR_COMBINATIONS; call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt"); call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed"); +call mtr.add_suppression("Refusing to load corrupted table"); if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'provider_$alg' and plugin_status='active'`) { diff --git a/mysql-test/suite/mariabackup/create_with_data_directory_during_backup.test b/mysql-test/suite/mariabackup/create_with_data_directory_during_backup.test index d0cb83d069f3e..f01028b64945f 100644 --- a/mysql-test/suite/mariabackup/create_with_data_directory_during_backup.test +++ b/mysql-test/suite/mariabackup/create_with_data_directory_during_backup.test @@ -1,4 +1,5 @@ --source include/have_debug.inc +--source include/have_symlink.inc let $table_data_dir=$MYSQLTEST_VARDIR/tmp/ddir; let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; mkdir $table_data_dir; diff --git a/mysql-test/suite/mariabackup/data_directory.test b/mysql-test/suite/mariabackup/data_directory.test index 50789a34c78ec..a89b7bdccc472 100644 --- a/mysql-test/suite/mariabackup/data_directory.test +++ b/mysql-test/suite/mariabackup/data_directory.test @@ -1,3 +1,4 @@ +--source include/have_symlink.inc let $table_data_dir=$MYSQLTEST_VARDIR/ddir; mkdir $table_data_dir; --replace_result $table_data_dir table_data_dir diff --git a/mysql-test/suite/mariabackup/defer_space.result b/mysql-test/suite/mariabackup/defer_space.result new file mode 100644 index 0000000000000..6453aff5502b3 --- /dev/null +++ b/mysql-test/suite/mariabackup/defer_space.result @@ -0,0 +1,27 @@ +call mtr.add_suppression("InnoDB: Expected tablespace id .*"); +# Mariabackup --backup with page0 INIT_PAGE redo record +# and there is no FILE_CREATE for the tablespace t1 +SET @save_dbug = @@SESSION.debug_dbug; +SET DEBUG_DBUG="+d,checkpoint_after_file_create"; +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +# xtrabackup backup +# xtrabackup prepare +# shutdown server +# remove datadir +# xtrabackup move back +# restart +SELECT * FROM t1; +f1 +1 +DROP TABLE t1; +SET @@SESSION.DEBUG_DBUG= @save_debug; +# Mariabackup fails after corrupting the page0 in disk +# and there is no INIT_PAGE for page0 +CREATE TABLE t1(c INT) ENGINE=INNODB; +# Corrupt the table +# restart +# xtrabackup backup +FOUND 10 /Header page consists of zero bytes*/ in backup.log +UNLOCK TABLES; +DROP TABLE t1; diff --git a/mysql-test/suite/mariabackup/defer_space.test b/mysql-test/suite/mariabackup/defer_space.test new file mode 100644 index 0000000000000..397a1ff5dc23c --- /dev/null +++ b/mysql-test/suite/mariabackup/defer_space.test @@ -0,0 +1,68 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/not_embedded.inc +--source include/no_valgrind_without_big.inc + +call mtr.add_suppression("InnoDB: Expected tablespace id .*"); +--echo # Mariabackup --backup with page0 INIT_PAGE redo record +--echo # and there is no FILE_CREATE for the tablespace t1 +SET @save_dbug = @@SESSION.debug_dbug; +SET DEBUG_DBUG="+d,checkpoint_after_file_create"; +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); + +echo # xtrabackup backup; +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; + +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +--enable_result_log + +echo # xtrabackup prepare; +--disable_result_log +exec $XTRABACKUP --prepare --target-dir=$targetdir; +-- source include/restart_and_restore.inc +--enable_result_log + +SELECT * FROM t1; +DROP TABLE t1; +rmdir $targetdir; +SET @@SESSION.DEBUG_DBUG= @save_debug; + +--echo # Mariabackup fails after corrupting the page0 in disk +--echo # and there is no INIT_PAGE for page0 + +CREATE TABLE t1(c INT) ENGINE=INNODB; +let MYSQLD_DATADIR=`select @@datadir`; +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; +--source include/shutdown_mysqld.inc + +--echo # Corrupt the table + +perl; +my $ps = $ENV{INNODB_PAGE_SIZE}; + +my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd"; +open(FILE, "+<$file") || die "Unable to open $file"; +binmode FILE; +seek (FILE, 0, SEEK_SET) or die "seek"; +print FILE chr(0x00) x $ps; +close FILE or die "close"; +EOF + +--source include/start_mysqld.inc +echo # xtrabackup backup; +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log; +--disable_result_log +--error 1 +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --core-file > $backuplog; +--enable_result_log + +--let SEARCH_PATTERN=Header page consists of zero bytes* +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +UNLOCK TABLES; +DROP TABLE t1; +rmdir $targetdir; +remove_file $backuplog; diff --git a/mysql-test/suite/mariabackup/full_backup.opt b/mysql-test/suite/mariabackup/full_backup.opt new file mode 100644 index 0000000000000..7928cd812d0b9 --- /dev/null +++ b/mysql-test/suite/mariabackup/full_backup.opt @@ -0,0 +1 @@ +--innodb_undo_tablespaces=2 diff --git a/mysql-test/suite/mariabackup/full_backup.result b/mysql-test/suite/mariabackup/full_backup.result index 690c5e64b4a21..e69d00f86f639 100644 --- a/mysql-test/suite/mariabackup/full_backup.result +++ b/mysql-test/suite/mariabackup/full_backup.result @@ -1,6 +1,7 @@ CREATE TABLE t(i INT) ENGINE INNODB; INSERT INTO t VALUES(1); # xtrabackup backup +NOT FOUND /InnoDB: Allocated tablespace ID/ in backup.log INSERT INTO t VALUES(2); # xtrabackup prepare # shutdown server @@ -11,3 +12,18 @@ SELECT * FROM t; i 1 DROP TABLE t; +# +# MDEV-27121 mariabackup incompatible with disabled dedicated +# undo log tablespaces +# +call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces"); +# restart: --innodb_undo_tablespaces=0 +# xtrabackup backup +# xtrabackup prepare +# shutdown server +# remove datadir +# xtrabackup move back +# restart: --innodb_undo_tablespaces=0 +# Display undo log files from target directory +undo001 +undo002 diff --git a/mysql-test/suite/mariabackup/full_backup.test b/mysql-test/suite/mariabackup/full_backup.test index d1d2ea21c085f..a02435274389c 100644 --- a/mysql-test/suite/mariabackup/full_backup.test +++ b/mysql-test/suite/mariabackup/full_backup.test @@ -4,11 +4,18 @@ CREATE TABLE t(i INT) ENGINE INNODB; INSERT INTO t VALUES(1); echo # xtrabackup backup; let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +--let $backup_log=$MYSQLTEST_VARDIR/tmp/backup.log --disable_result_log -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backup_log 2>&1; --enable_result_log +# The following warning must not appear after MDEV-27343 fix +--let SEARCH_PATTERN=InnoDB: Allocated tablespace ID +--let SEARCH_FILE=$backup_log +--source include/search_pattern_in_file.inc +--remove_file $backup_log + INSERT INTO t VALUES(2); @@ -22,3 +29,27 @@ SELECT * FROM t; DROP TABLE t; rmdir $targetdir; +--echo # +--echo # MDEV-27121 mariabackup incompatible with disabled dedicated +--echo # undo log tablespaces +--echo # +call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces"); + +let $restart_parameters=--innodb_undo_tablespaces=0; +--source include/restart_mysqld.inc + +echo # xtrabackup backup; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +--enable_result_log + +echo # xtrabackup prepare; +--disable_result_log +exec $XTRABACKUP --prepare --target-dir=$targetdir; +-- source include/restart_and_restore.inc +--enable_result_log + +--echo # Display undo log files from target directory +list_files $targetdir undo*; + +rmdir $targetdir; diff --git a/mysql-test/suite/mariabackup/full_backup_win.result b/mysql-test/suite/mariabackup/full_backup_win.result new file mode 100644 index 0000000000000..940c7056d3f70 --- /dev/null +++ b/mysql-test/suite/mariabackup/full_backup_win.result @@ -0,0 +1,12 @@ +# +# MDEV-30492 Crash when use mariabackup.exe with config 'innodb_flush_method=async_unbuffered' +# +# xtrabackup backup +# xtrabackup prepare +# shutdown server +# remove datadir +# xtrabackup move back +# restart +# +# End of 10.4 tests +# diff --git a/mysql-test/suite/mariabackup/full_backup_win.test b/mysql-test/suite/mariabackup/full_backup_win.test new file mode 100644 index 0000000000000..5a1d1c380267c --- /dev/null +++ b/mysql-test/suite/mariabackup/full_backup_win.test @@ -0,0 +1,24 @@ +--source include/windows.inc + +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; + +--echo # +--echo # MDEV-30492 Crash when use mariabackup.exe with config 'innodb_flush_method=async_unbuffered' +--echo # + +echo # xtrabackup backup; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --innodb_flush_method=normal --backup --target-dir=$targetdir; +--enable_result_log + +echo # xtrabackup prepare; +--disable_result_log +exec $XTRABACKUP --prepare --innodb-flush-method=async_unbuffered --target-dir=$targetdir; +-- source include/restart_and_restore.inc +--enable_result_log + +rmdir $targetdir; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/suite/mariabackup/huge_lsn,strict_crc32.rdiff b/mysql-test/suite/mariabackup/huge_lsn,strict_crc32.rdiff index 9e516cf2ef186..29afd468751e1 100644 --- a/mysql-test/suite/mariabackup/huge_lsn,strict_crc32.rdiff +++ b/mysql-test/suite/mariabackup/huge_lsn,strict_crc32.rdiff @@ -1,9 +1,11 @@ -@@ -2,7 +2,7 @@ +@@ -1,8 +1,8 @@ + # # MDEV-13416 mariabackup fails with EFAULT "Bad Address" # - # restart --FOUND 1 /redo log from 2\.012MiB to [0-9.]*[KMGT]iB; LSN=17596481011216\b/ in mysqld.1.err +-# restart: --innodb-log-file-size=4M --innodb-encrypt-log=0 +-FOUND 1 /InnoDB: log sequence number 17596481011216/ in mysqld.1.err ++# restart +FOUND 1 /redo log: [0-9.]*[KMGT]iB; LSN=17596481010687\b/ in mysqld.1.err - CREATE TABLE t(i INT) ENGINE INNODB; + CREATE TABLE t(i INT) ENGINE=INNODB ENCRYPTED=YES; INSERT INTO t VALUES(1); # xtrabackup backup diff --git a/mysql-test/suite/mariabackup/huge_lsn.result b/mysql-test/suite/mariabackup/huge_lsn.result index 22cd346bbb540..503d13fcac442 100644 --- a/mysql-test/suite/mariabackup/huge_lsn.result +++ b/mysql-test/suite/mariabackup/huge_lsn.result @@ -1,9 +1,9 @@ # # MDEV-13416 mariabackup fails with EFAULT "Bad Address" # -# restart -FOUND 1 /redo log from 2\.012MiB to [0-9.]*[KMGT]iB; LSN=17596481011216\b/ in mysqld.1.err -CREATE TABLE t(i INT) ENGINE INNODB; +# restart: --innodb-log-file-size=4M --innodb-encrypt-log=0 +FOUND 1 /InnoDB: log sequence number 17596481011216/ in mysqld.1.err +CREATE TABLE t(i INT) ENGINE=INNODB ENCRYPTED=YES; INSERT INTO t VALUES(1); # xtrabackup backup SET GLOBAL innodb_flush_log_at_trx_commit=1; @@ -16,6 +16,14 @@ INSERT INTO t VALUES(2); SELECT * FROM t; i 1 +FLUSH TABLE t FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE t DISCARD TABLESPACE; +ALTER TABLE t IMPORT TABLESPACE; +FLUSH TABLE t FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE t DISCARD TABLESPACE; +ALTER TABLE t IMPORT TABLESPACE; DROP TABLE t; # shutdown server # remove datadir diff --git a/mysql-test/suite/mariabackup/huge_lsn.test b/mysql-test/suite/mariabackup/huge_lsn.test index 00c7e66516c83..8850e9d89547b 100644 --- a/mysql-test/suite/mariabackup/huge_lsn.test +++ b/mysql-test/suite/mariabackup/huge_lsn.test @@ -40,34 +40,40 @@ do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl"; my $file= "$ENV{MYSQLD_DATADIR}/ib_logfile0"; open(FILE, ">", $file) or die "Unable to open $file\n"; binmode FILE; -# the desired log sequence number, plus 16 my $extra_repeat = 139820; +# The desired log sequence number is 17596481011216 (0x1000fffffe10). +my $file_size=4<<20; my $lsn_hi=4096,$lsn_lo=0xfffffe00 - $extra_repeat * 15; my $polynomial = 0x82f63b78; # CRC-32C my ($header, $checkpoint, $log); -$header = "Phys" . pack("x[4]NN", $lsn_hi, $lsn_lo) . +$header = "Phys" . pack("x[4]NN", $lsn_hi, $lsn_lo - $file_size + 0x300f) . "some Perl code" . pack("x[478]"); $header .= pack("Nx[3584]", mycrc32($header, 0, $polynomial)); $checkpoint = pack("NNNNx[44]", $lsn_hi, $lsn_lo, $lsn_hi, $lsn_lo); $checkpoint .= pack("Nx[8128]", mycrc32($checkpoint, 0, $polynomial)); $log = pack("CxxNN", 0xfa, $lsn_hi, $lsn_lo); -$log .= pack("CN", 1, mycrc32($log, 0, $polynomial)); +$log .= pack("CN", 0, mycrc32($log, 0, $polynomial)); # Write more than 2MiB of FILE_MODIFY mini-transactions to exercise the parser. my $extra = pack("CCxa*", 0xb9, 127, "a/b.ibd"); -$extra .= pack("CN", 1, mycrc32($extra, 0, $polynomial)); +$extra .= pack("CN", 0, mycrc32($extra, 0, $polynomial)); -print FILE $header, $checkpoint, $extra x $extra_repeat, $log; +print FILE $header, $checkpoint, $extra x ($extra_repeat - 1), $log; +seek(FILE, $file_size - 15, 0); +$extra = pack("CCxa*", 0xb9, 127, "c/d.ibd"); +$extra .= pack("CN", 1, mycrc32($extra, 0, $polynomial)); +print FILE $extra; close(FILE) or die "Unable to close $file\n"; EOF ---let SEARCH_PATTERN= redo log from 2\\.012MiB to [0-9.]*[KMGT]iB; LSN=17596481011216\\b +--let SEARCH_PATTERN= InnoDB: log sequence number 17596481011216 +--let $restart_parameters=--innodb-log-file-size=4M --innodb-encrypt-log=0 } --source include/start_mysqld.inc let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; --source include/search_pattern_in_file.inc -CREATE TABLE t(i INT) ENGINE INNODB; +CREATE TABLE t(i INT) ENGINE=INNODB ENCRYPTED=YES; INSERT INTO t VALUES(1); echo # xtrabackup backup; @@ -80,9 +86,26 @@ INSERT INTO t VALUES(2); echo # xtrabackup prepare; --disable_result_log exec $XTRABACKUP --prepare --target-dir=$targetdir; +--let $restart_parameters= --source include/restart_and_restore.inc --enable_result_log SELECT * FROM t; +FLUSH TABLE t FOR EXPORT; +copy_file $_datadir/test/t.ibd $_datadir/test/t_copy.ibd; +copy_file $_datadir/test/t.cfg $_datadir/test/t_copy.cfg; +UNLOCK TABLES; +ALTER TABLE t DISCARD TABLESPACE; +move_file $_datadir/test/t_copy.ibd $_datadir/test/t.ibd; +move_file $_datadir/test/t_copy.cfg $_datadir/test/t.cfg; +ALTER TABLE t IMPORT TABLESPACE; +FLUSH TABLE t FOR EXPORT; +copy_file $_datadir/test/t.ibd $_datadir/test/t_copy.ibd; +copy_file $_datadir/test/t.cfg $_datadir/test/t_copy.cfg; +UNLOCK TABLES; +ALTER TABLE t DISCARD TABLESPACE; +move_file $_datadir/test/t_copy.ibd $_datadir/test/t.ibd; +move_file $_datadir/test/t_copy.cfg $_datadir/test/t.cfg; +ALTER TABLE t IMPORT TABLESPACE; DROP TABLE t; rmdir $targetdir; let $targetdir= $targetdir_old; diff --git a/mysql-test/suite/mariabackup/include/restart_and_restore.inc b/mysql-test/suite/mariabackup/include/restart_and_restore.inc index 2d1e5493957a6..aa26d28efba7a 100644 --- a/mysql-test/suite/mariabackup/include/restart_and_restore.inc +++ b/mysql-test/suite/mariabackup/include/restart_and_restore.inc @@ -4,5 +4,5 @@ echo # shutdown server; echo # remove datadir; rmdir $_datadir; echo # xtrabackup move back; -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir --target-dir=$targetdir --parallel=2 --throttle=1; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir --target-dir=$targetdir --parallel=2 --throttle=1 $backup_opts; --source include/start_mysqld.inc diff --git a/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info.inc b/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info.inc new file mode 100644 index 0000000000000..4a83c9c394e7f --- /dev/null +++ b/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info.inc @@ -0,0 +1,14 @@ +--disable_query_log +--file_exists $targetdir/xtrabackup_slave_info +CREATE TEMPORARY TABLE tmp_slave_info(lineno SERIAL, line TEXT); +--replace_result $targetdir TARGETDIR +--eval LOAD DATA LOCAL INFILE '$targetdir/xtrabackup_slave_info' INTO TABLE tmp_slave_info (line); +SELECT + lineno, + regexp_replace( + regexp_replace(line, '(?<=MASTER_LOG_POS=)[0-9]+', ''), + '[0-9]+-[0-9]+-[0-9]+', '') + AS line +FROM tmp_slave_info ORDER BY lineno; +DROP TEMPORARY TABLE tmp_slave_info; +--enable_query_log diff --git a/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info_out.inc b/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info_out.inc new file mode 100644 index 0000000000000..90b2d00b61db0 --- /dev/null +++ b/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info_out.inc @@ -0,0 +1,20 @@ +--disable_query_log +--file_exists $XTRABACKUP_OUT +CREATE TEMPORARY TABLE tmp_slave_info_out(lineno SERIAL, line TEXT); +--replace_result $targetdir TARGETDIR +--eval LOAD DATA LOCAL INFILE '$XTRABACKUP_OUT' INTO TABLE tmp_slave_info_out (line); +SELECT + replace( + regexp_replace( + regexp_replace(line, + '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]', + 'YYYY-MM-DD hh:mm:ss'), + '[0-9]+-[0-9]+-[0-9]+', ''), + '\r','' /* Remove CR on Windows */) + AS line +FROM tmp_slave_info_out +WHERE line LIKE '%MySQL slave binlog position%' + OR line LIKE '%Failed to get master binlog coordinates%' +ORDER BY lineno; +DROP TEMPORARY TABLE tmp_slave_info_out; +--enable_query_log diff --git a/mysql-test/suite/mariabackup/incremental_backup.test b/mysql-test/suite/mariabackup/incremental_backup.test index 62cdf9e6cb310..62e4f9c68758d 100644 --- a/mysql-test/suite/mariabackup/incremental_backup.test +++ b/mysql-test/suite/mariabackup/incremental_backup.test @@ -1,5 +1,6 @@ --source include/have_aria.inc --source include/innodb_page_size.inc +--source include/innodb_undo_tablespaces.inc # see suite.pm "check for exact values, in case the default changes to be small everywhere" if (`select @@max_binlog_stmt_cache_size = 4294963200 and @@innodb_page_size = 65536`) { @@ -8,6 +9,7 @@ if (`select @@max_binlog_stmt_cache_size = 4294963200 and @@innodb_page_size = 6 call mtr.add_suppression("InnoDB: New log files created"); +let $test_comp=`select @@innodb_page_size < 32768`; let basedir=$MYSQLTEST_VARDIR/tmp/backup; let incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1; @@ -16,6 +18,14 @@ CREATE TABLE t(i INT PRIMARY KEY) ENGINE INNODB; # MDEV-515 takes X-lock on the table for the first insert. # So concurrent insert won't happen on the table INSERT INTO t VALUES(100); +if ($test_comp) { + # If MDEV-28474 is not fixed, backup preparing will crash with SIGSEGV. + --disable_query_log + --disable_result_log + CREATE TABLE t_comp(i INT PRIMARY KEY) ENGINE INNODB ROW_FORMAT=COMPRESSED; + --enable_query_log + --enable_result_log +} BEGIN; INSERT INTO t VALUES(2); connect (con1,localhost,root,,); @@ -24,7 +34,7 @@ INSERT INTO t VALUES(1); echo # Create full backup , modify table, then create incremental/differential backup; --disable_result_log -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 --target-dir=$basedir; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 --target-dir=$basedir --throttle=1000; --enable_result_log BEGIN; INSERT INTO t VALUES(0); @@ -99,6 +109,13 @@ let $targetdir=$basedir; SELECT * FROM t; DROP TABLE t; +if ($test_comp) { + --disable_query_log + --disable_result_log + DROP TABLE t_comp; + --enable_query_log + --enable_result_log +} DROP TABLE t_aria; # Cleanup diff --git a/mysql-test/suite/mariabackup/incremental_backup_newdb_before_inc.result b/mysql-test/suite/mariabackup/incremental_backup_newdb_before_inc.result new file mode 100644 index 0000000000000..e3f8bb245e7ab --- /dev/null +++ b/mysql-test/suite/mariabackup/incremental_backup_newdb_before_inc.result @@ -0,0 +1,18 @@ +call mtr.add_suppression("InnoDB: New log files created"); +CREATE TABLE t1 (i INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES(0); +CREATE DATABASE test1; +CREATE TABLE test1.t1 (a INT) ENGINE=InnoDB; +INSERT INTO test1.t1 VALUES (1000); +# shutdown server +# remove datadir +# xtrabackup move back +# restart +SELECT * FROM t1; +i +0 +SELECT * FROM test1.t1; +a +1000 +DROP TABLE t1; +DROP DATABASE test1; diff --git a/mysql-test/suite/mariabackup/incremental_backup_newdb_before_inc.test b/mysql-test/suite/mariabackup/incremental_backup_newdb_before_inc.test new file mode 100644 index 0000000000000..a79d280b668d3 --- /dev/null +++ b/mysql-test/suite/mariabackup/incremental_backup_newdb_before_inc.test @@ -0,0 +1,35 @@ +--source include/have_innodb.inc + +call mtr.add_suppression("InnoDB: New log files created"); + +--let basedir=$MYSQLTEST_VARDIR/tmp/backup +--let incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1 + +CREATE TABLE t1 (i INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES(0); + +--disable_result_log +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 --target-dir=$basedir +--enable_result_log + +CREATE DATABASE test1; +CREATE TABLE test1.t1 (a INT) ENGINE=InnoDB; +INSERT INTO test1.t1 VALUES (1000); + +--disable_result_log +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=2 --ftwrl-wait-timeout=5 --ftwrl-wait-threshold=300 --ftwrl-wait-query-type=all --target-dir=$incremental_dir --incremental-basedir=$basedir +--exec $XTRABACKUP --prepare --target-dir=$basedir +--exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir +--enable_result_log + +--let $targetdir=$basedir +--source include/restart_and_restore.inc +--enable_result_log + +SELECT * FROM t1; +SELECT * FROM test1.t1; + +DROP TABLE t1; +DROP DATABASE test1; +--rmdir $basedir +--rmdir $incremental_dir diff --git a/mysql-test/suite/mariabackup/incremental_compressed.result b/mysql-test/suite/mariabackup/incremental_compressed.result index eb059cdc769ba..f8b0180864209 100644 --- a/mysql-test/suite/mariabackup/incremental_compressed.result +++ b/mysql-test/suite/mariabackup/incremental_compressed.result @@ -1,13 +1,18 @@ # -# MDEV-26794 MariaBackup does not recognize added providers upon prepare of incremental backup +# MDEV-18589 Assertion ...physical_size(flags) == info.page_size +# failed in xb_delta_open_matching_space # -CREATE TABLE t (a INT) ENGINE=InnoDB; -INSERT INTO t VALUES (1),(2); -INSTALL SONAME 'provider_snappy'; -SET GLOBAL innodb_compression_algorithm= snappy; -CREATE TABLE t_snappy (a INT) ENGINE=InnoDB page_compressed=1; -INSERT INTO t_snappy VALUES (3),(4); -# restart: --innodb_buffer_pool_load_at_startup=0 -# Prepare initial backup -# Prepare incremental backup +CREATE TABLE t (pk INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +ALTER TABLE t PARTITION BY KEY(pk); +# shutdown server +# remove datadir +# xtrabackup move back +# restart +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `pk` int(11) NOT NULL, + PRIMARY KEY (`pk`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED + PARTITION BY KEY (`pk`) DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/incremental_compressed.test b/mysql-test/suite/mariabackup/incremental_compressed.test index f6ec26cfb4698..15aff909a4349 100644 --- a/mysql-test/suite/mariabackup/incremental_compressed.test +++ b/mysql-test/suite/mariabackup/incremental_compressed.test @@ -1,38 +1,27 @@ ---echo # ---echo # MDEV-26794 MariaBackup does not recognize added providers upon prepare of incremental backup ---echo # - -if (!$PROVIDER_SNAPPY_SO) { - skip "Needs provider_snappy plugin"; -} - --source include/have_innodb.inc +--source include/have_partition.inc +--source include/innodb_undo_tablespaces.inc ---let $targetdir=$MYSQLTEST_VARDIR/tmp/backup ---let $incdir=$MYSQLTEST_VARDIR/tmp/inc - -CREATE TABLE t (a INT) ENGINE=InnoDB; -INSERT INTO t VALUES (1),(2); +let $basedir=$MYSQLTEST_VARDIR/tmp/backup; +let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1; ---exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir - -INSTALL SONAME 'provider_snappy'; - -SET GLOBAL innodb_compression_algorithm= snappy; - -CREATE TABLE t_snappy (a INT) ENGINE=InnoDB page_compressed=1; -INSERT INTO t_snappy VALUES (3),(4); +--echo # +--echo # MDEV-18589 Assertion ...physical_size(flags) == info.page_size +--echo # failed in xb_delta_open_matching_space +--echo # -# disable buffer pool load to avoid MDEV-26794 warnings ---let $restart_parameters= --innodb_buffer_pool_load_at_startup=0 ---source include/restart_mysqld.inc +CREATE TABLE t (pk INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; ---exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --incremental-basedir=$targetdir --target-dir=$incdir +--exec $XTRABACKUP --backup --target-dir=$basedir --protocol=tcp --port=$MASTER_MYPORT --user=root ---echo # Prepare initial backup ---exec $XTRABACKUP --prepare --target-dir=$targetdir +ALTER TABLE t PARTITION BY KEY(pk); ---echo # Prepare incremental backup ---exec $XTRABACKUP --prepare --target-dir=$targetdir --incremental-dir=$incdir > $MYSQLTEST_VARDIR/prepare.log 2>&1 +--exec $XTRABACKUP --backup --target-dir=$incremental_dir --incremental-basedir=$basedir --protocol=tcp --port=$MASTER_MYPORT --user=root > $incremental_dir.log 2>&1 +--exec $XTRABACKUP --prepare --target-dir=$basedir --user=root > $MYSQL_TMP_DIR/backup_prepare_0.log 2>&1 +--exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir --user=root > $MYSQL_TMP_DIR/backup_prepare_1.log +--cat_file $MYSQL_TMP_DIR/backup_prepare_1.log +let $targetdir=$basedir; +-- source include/restart_and_restore.inc +SHOW CREATE TABLE t; DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/incremental_ddl_before_backup.test b/mysql-test/suite/mariabackup/incremental_ddl_before_backup.test index f243ac1acd92f..6d34166d7b595 100644 --- a/mysql-test/suite/mariabackup/incremental_ddl_before_backup.test +++ b/mysql-test/suite/mariabackup/incremental_ddl_before_backup.test @@ -1,4 +1,5 @@ --source include/have_debug.inc +--source include/innodb_undo_tablespaces.inc call mtr.add_suppression("InnoDB: New log files created"); diff --git a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test index d7ba15c28aef2..d9c6a72b5ee53 100644 --- a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test +++ b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test @@ -1,4 +1,5 @@ --source include/have_debug.inc +--source include/innodb_undo_tablespaces.inc call mtr.add_suppression("InnoDB: New log files created"); diff --git a/mysql-test/suite/mariabackup/incremental_drop_db.result b/mysql-test/suite/mariabackup/incremental_drop_db.result new file mode 100644 index 0000000000000..3a6c89f8de04f --- /dev/null +++ b/mysql-test/suite/mariabackup/incremental_drop_db.result @@ -0,0 +1,30 @@ +call mtr.add_suppression("InnoDB: New log files created"); +# +# Start of 10.3 tests +# +# +# MDEV-23335 MariaBackup Incremental Does Not Reflect Dropped/Created Databases +# +CREATE DATABASE db1; +CREATE DATABASE db2; +CREATE TABLE db1.t1 (a INT) ENGINE=MyISAM; +CREATE TABLE db1.t2 (a INT) ENGINE=InnoDB; +# Create base backup +DROP DATABASE db1; +# Create incremental backup +# Remove incremental_dir/db2/db.opt file to make incremental_dir/db2/ empty +# Prepare base backup, apply incremental one +# shutdown server +# remove datadir +# xtrabackup move back +# restart +# Expect no 'db1' in the output, because it was really dropped. +# Expect 'db2' in the ouput, because it was not dropped! +# (its incremental directory was emptied only) +SHOW DATABASES LIKE 'db%'; +Database (db%) +db2 +DROP DATABASE db2; +# +# End of 10.3 tests +# diff --git a/mysql-test/suite/mariabackup/incremental_drop_db.test b/mysql-test/suite/mariabackup/incremental_drop_db.test new file mode 100644 index 0000000000000..de270435e9d08 --- /dev/null +++ b/mysql-test/suite/mariabackup/incremental_drop_db.test @@ -0,0 +1,68 @@ +--source include/have_innodb.inc +call mtr.add_suppression("InnoDB: New log files created"); + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-23335 MariaBackup Incremental Does Not Reflect Dropped/Created Databases +--echo # + +--let $datadir=`SELECT @@datadir` +--let $basedir=$MYSQLTEST_VARDIR/tmp/backup +--let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1 + +# Create two databases: +# - db1 is dropped normally below +# - db2 is used to cover a corner case: its db.opt file is removed + +# Incremental backup contains: +# - no directory for db1 +# - an empty directory for db2 (after we remove db2/db.opt) + + +CREATE DATABASE db1; +CREATE DATABASE db2; + +# Add some tables to db1 +CREATE TABLE db1.t1 (a INT) ENGINE=MyISAM; +CREATE TABLE db1.t2 (a INT) ENGINE=InnoDB; + +--echo # Create base backup +--disable_result_log +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir +--enable_result_log + +DROP DATABASE db1; + +--echo # Create incremental backup +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir + +--echo # Remove incremental_dir/db2/db.opt file to make incremental_dir/db2/ empty +--remove_file $incremental_dir/db2/db.opt + + +--echo # Prepare base backup, apply incremental one +--disable_result_log +--exec $XTRABACKUP --prepare --target-dir=$basedir +--exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir +--enable_result_log + +--let $targetdir=$basedir +--source include/restart_and_restore.inc +--enable_result_log + +--echo # Expect no 'db1' in the output, because it was really dropped. +--echo # Expect 'db2' in the ouput, because it was not dropped! +--echo # (its incremental directory was emptied only) + +SHOW DATABASES LIKE 'db%'; +DROP DATABASE db2; + +--rmdir $basedir +--rmdir $incremental_dir + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/suite/mariabackup/incremental_encrypted.test b/mysql-test/suite/mariabackup/incremental_encrypted.test index e618ac4f79e40..d5570f20006a5 100644 --- a/mysql-test/suite/mariabackup/incremental_encrypted.test +++ b/mysql-test/suite/mariabackup/incremental_encrypted.test @@ -1,4 +1,5 @@ --source include/innodb_page_size.inc +--source include/innodb_undo_tablespaces.inc if (!$EXAMPLE_KEY_MANAGEMENT_SO) { diff --git a/mysql-test/suite/mariabackup/incremental_newdb_while_backup.result b/mysql-test/suite/mariabackup/incremental_newdb_while_backup.result new file mode 100644 index 0000000000000..ac74893d2cf45 --- /dev/null +++ b/mysql-test/suite/mariabackup/incremental_newdb_while_backup.result @@ -0,0 +1,24 @@ +call mtr.add_suppression("InnoDB: New log files created"); +# +# Start of 10.2 tests +# +# +# MDEV-28446 mariabackup prepare fails for incrementals if a new schema is created after full backup is taken +# +CREATE TABLE t1(i INT PRIMARY KEY) ENGINE INNODB; +# Prepare full backup, apply incremental one +# shutdown server +# remove datadir +# xtrabackup move back +# restart +SELECT COUNT(*) FROM test.t1; +COUNT(*) +0 +SELECT COUNT(*) FROM test1.t1; +COUNT(*) +10000 +DROP TABLE t1; +DROP DATABASE test1; +# +# End of 10.2 tests +# diff --git a/mysql-test/suite/mariabackup/incremental_newdb_while_backup.test b/mysql-test/suite/mariabackup/incremental_newdb_while_backup.test new file mode 100644 index 0000000000000..6bd69712ed7a1 --- /dev/null +++ b/mysql-test/suite/mariabackup/incremental_newdb_while_backup.test @@ -0,0 +1,48 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/innodb_undo_tablespaces.inc + +call mtr.add_suppression("InnoDB: New log files created"); + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-28446 mariabackup prepare fails for incrementals if a new schema is created after full backup is taken +--echo # + +--let $basedir=$MYSQLTEST_VARDIR/tmp/backup +--let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1 + +CREATE TABLE t1(i INT PRIMARY KEY) ENGINE INNODB; + +--disable_result_log +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir +--enable_result_log + +--let after_load_tablespaces=BEGIN NOT ATOMIC CREATE DATABASE test1; CREATE TABLE test1.t1 ENGINE=INNODB SELECT UUID() from test.seq_1_to_10000; END + +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir --dbug=+d,mariabackup_events,mariabackup_inject_code +--let after_load_tablespaces= +--disable_result_log +--echo # Prepare full backup, apply incremental one +--exec $XTRABACKUP --prepare --target-dir=$basedir +--exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir +--enable_result_log + +--let $targetdir=$basedir +--source include/restart_and_restore.inc +--enable_result_log + +SELECT COUNT(*) FROM test.t1; +SELECT COUNT(*) FROM test1.t1; + +DROP TABLE t1; +DROP DATABASE test1; +--rmdir $basedir +--rmdir $incremental_dir + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/suite/mariabackup/incremental_page_compressed.result b/mysql-test/suite/mariabackup/incremental_page_compressed.result new file mode 100644 index 0000000000000..eb059cdc769ba --- /dev/null +++ b/mysql-test/suite/mariabackup/incremental_page_compressed.result @@ -0,0 +1,13 @@ +# +# MDEV-26794 MariaBackup does not recognize added providers upon prepare of incremental backup +# +CREATE TABLE t (a INT) ENGINE=InnoDB; +INSERT INTO t VALUES (1),(2); +INSTALL SONAME 'provider_snappy'; +SET GLOBAL innodb_compression_algorithm= snappy; +CREATE TABLE t_snappy (a INT) ENGINE=InnoDB page_compressed=1; +INSERT INTO t_snappy VALUES (3),(4); +# restart: --innodb_buffer_pool_load_at_startup=0 +# Prepare initial backup +# Prepare incremental backup +DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/incremental_page_compressed.test b/mysql-test/suite/mariabackup/incremental_page_compressed.test new file mode 100644 index 0000000000000..f6ec26cfb4698 --- /dev/null +++ b/mysql-test/suite/mariabackup/incremental_page_compressed.test @@ -0,0 +1,38 @@ +--echo # +--echo # MDEV-26794 MariaBackup does not recognize added providers upon prepare of incremental backup +--echo # + +if (!$PROVIDER_SNAPPY_SO) { + skip "Needs provider_snappy plugin"; +} + +--source include/have_innodb.inc + +--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup +--let $incdir=$MYSQLTEST_VARDIR/tmp/inc + +CREATE TABLE t (a INT) ENGINE=InnoDB; +INSERT INTO t VALUES (1),(2); + +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir + +INSTALL SONAME 'provider_snappy'; + +SET GLOBAL innodb_compression_algorithm= snappy; + +CREATE TABLE t_snappy (a INT) ENGINE=InnoDB page_compressed=1; +INSERT INTO t_snappy VALUES (3),(4); + +# disable buffer pool load to avoid MDEV-26794 warnings +--let $restart_parameters= --innodb_buffer_pool_load_at_startup=0 +--source include/restart_mysqld.inc + +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --incremental-basedir=$targetdir --target-dir=$incdir + +--echo # Prepare initial backup +--exec $XTRABACKUP --prepare --target-dir=$targetdir + +--echo # Prepare incremental backup +--exec $XTRABACKUP --prepare --target-dir=$targetdir --incremental-dir=$incdir > $MYSQLTEST_VARDIR/prepare.log 2>&1 + +DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt index 95b88d038ee8d..a0b4b58827975 100644 --- a/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt +++ b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt @@ -1 +1 @@ ---loose-innodb-log-file-size=2097152 +--loose-innodb-log-file-size=4194304 diff --git a/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.test b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.test index 22165ff29be9e..8bbd4e761a698 100644 --- a/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.test +++ b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.test @@ -1,6 +1,7 @@ --source include/have_innodb.inc --source include/have_debug.inc --source include/have_sequence.inc +--source include/no_valgrind_without_big.inc CREATE TABLE t(i INT) ENGINE=INNODB; diff --git a/mysql-test/suite/mariabackup/innodb_redo_overwrite.opt b/mysql-test/suite/mariabackup/innodb_redo_overwrite.opt index 19c08c8c945d3..a0b4b58827975 100644 --- a/mysql-test/suite/mariabackup/innodb_redo_overwrite.opt +++ b/mysql-test/suite/mariabackup/innodb_redo_overwrite.opt @@ -1 +1 @@ ---loose-innodb-log-file-size=2m +--loose-innodb-log-file-size=4194304 diff --git a/mysql-test/suite/mariabackup/innodb_redo_overwrite.result b/mysql-test/suite/mariabackup/innodb_redo_overwrite.result index abc0c57bcce08..bab5d4331e07b 100644 --- a/mysql-test/suite/mariabackup/innodb_redo_overwrite.result +++ b/mysql-test/suite/mariabackup/innodb_redo_overwrite.result @@ -1,5 +1,4 @@ -CREATE TABLE t(i INT) ENGINE=INNODB; -INSERT INTO t SELECT seq%10 FROM seq_0_to_51199; +CREATE TABLE t ENGINE=INNODB SELECT seq%10 i FROM seq_0_to_204796; # xtrabackup backup FOUND 1 /Was only able to copy log from \d+ to \d+, not \d+; try increasing innodb_log_file_size\b/ in backup.log NOT FOUND /failed: redo log block checksum does not match/ in backup.log diff --git a/mysql-test/suite/mariabackup/innodb_redo_overwrite.test b/mysql-test/suite/mariabackup/innodb_redo_overwrite.test index 7e0c1cef54f55..ab5993d232c4e 100644 --- a/mysql-test/suite/mariabackup/innodb_redo_overwrite.test +++ b/mysql-test/suite/mariabackup/innodb_redo_overwrite.test @@ -2,9 +2,9 @@ --source include/have_debug_sync.inc --source include/have_debug.inc --source include/have_sequence.inc +--source include/no_valgrind_without_big.inc -CREATE TABLE t(i INT) ENGINE=INNODB; -INSERT INTO t SELECT seq%10 FROM seq_0_to_51199; +CREATE TABLE t ENGINE=INNODB SELECT seq%10 i FROM seq_0_to_204796; --echo # xtrabackup backup --let $targetdir=$MYSQLTEST_VARDIR/tmp/backup diff --git a/mysql-test/suite/mariabackup/log_copy_interval.result b/mysql-test/suite/mariabackup/log_copy_interval.result new file mode 100644 index 0000000000000..678fc6cc0a2bc --- /dev/null +++ b/mysql-test/suite/mariabackup/log_copy_interval.result @@ -0,0 +1,2 @@ +# xtrabackup backup +NOT FOUND /sleep_after_waiting_for_lsn\n(\[\d+\] \d+-\d+-\d+ \d+:\d+:\d+ >> log scanned up to \(\d+\)\n){2}/ in backup.log diff --git a/mysql-test/suite/mariabackup/log_copy_interval.test b/mysql-test/suite/mariabackup/log_copy_interval.test new file mode 100644 index 0000000000000..5ea09c5306632 --- /dev/null +++ b/mysql-test/suite/mariabackup/log_copy_interval.test @@ -0,0 +1,18 @@ +--source include/have_debug.inc + +echo # xtrabackup backup; +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +--let $backup_log=$MYSQLTEST_VARDIR/tmp/backup.log + +--let sleep_after_waiting_for_lsn=250 +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --log-copy-interval=500 --dbug=+d,mariabackup_inject_code > $backup_log 2>&1; +--enable_result_log + +--let SEARCH_PATTERN=sleep_after_waiting_for_lsn\n(\[\d+\] \d+-\d+-\d+ \d+:\d+:\d+ >> log scanned up to \(\d+\)\n){2} +--let SEARCH_FILE=$backup_log +--source include/search_pattern_in_file.inc +--remove_file $backup_log + +rmdir $targetdir; + diff --git a/mysql-test/suite/mariabackup/log_page_corruption.result b/mysql-test/suite/mariabackup/log_page_corruption.result index 91db833622a7d..f2a88ea4bdfbb 100644 --- a/mysql-test/suite/mariabackup/log_page_corruption.result +++ b/mysql-test/suite/mariabackup/log_page_corruption.result @@ -31,13 +31,13 @@ FOUND 1 /Database page corruption detected.*/ in backup.log FOUND 1 /completed OK!/ in backup.log --- "innodb_corrupted_pages" file content: --- test/t1_corrupted -6 8 9 +4 6 7 test/t2_corrupted -7 8 10 +5 6 8 test/t4_corrupted_new 1 test/t5_corrupted_to_rename_renamed -6 +4 test/t7_corrupted_to_alter 3 ------ @@ -48,19 +48,19 @@ INSERT INTO t3_inc VALUES (3), (4), (5), (6), (7), (8), (9); # Backup must not fail, but "innodb_corrupted_pages" file must be created due to --log-innodb-page-corruption option --- "innodb_corrupted_pages" file content: --- test/t1_corrupted -6 8 9 +4 6 7 test/t1_inc_corrupted -6 8 9 +4 6 7 test/t2_corrupted -7 8 10 +5 6 8 test/t2_inc_corrupted -7 8 10 +5 6 8 test/t4_inc_corrupted_new 1 test/t5_corrupted_to_rename_renamed -6 +4 test/t5_inc_corrupted_to_rename_renamed -6 +4 test/t7_inc_corrupted_to_alter 3 ------ @@ -85,25 +85,25 @@ DROP TABLE t7_inc_corrupted_to_alter; # Full backup with --log-innodb-page-corruption --- "innodb_corrupted_pages" file content: --- test/t3 -6 8 +4 6 ------ # Extend some tablespace and corrupt extended pages for incremental backup # restart # Incremental backup --log-innodb-page-corruption --- "innodb_corrupted_pages" file content: --- test/t3 -6 8 +4 6 test/t3_inc -6 8 +4 6 ------ # Full backup prepare # "innodb_corrupted_pages" file must not exist after successful prepare -FOUND 1 /was successfuly fixed.*/ in backup.log +FOUND 1 /was successfully fixed.*/ in backup.log # Check that fixed pages are zero-filled # Incremental backup prepare # "innodb_corrupted_pages" file must not exist after successful prepare # do not remove "innodb_corrupted_pages" in incremental dir -FOUND 1 /was successfuly fixed.*/ in backup.log +FOUND 1 /was successfully fixed.*/ in backup.log # Check that fixed pages are zero-filled # shutdown server # remove datadir diff --git a/mysql-test/suite/mariabackup/log_page_corruption.test b/mysql-test/suite/mariabackup/log_page_corruption.test index 0151afb96b40a..2b10152903910 100644 --- a/mysql-test/suite/mariabackup/log_page_corruption.test +++ b/mysql-test/suite/mariabackup/log_page_corruption.test @@ -1,4 +1,6 @@ --source include/have_debug.inc +--source include/no_valgrind_without_big.inc +--source include/innodb_undo_tablespaces.inc --echo ######## --echo # Test for generating "innodb_corrupted_pages" file during full and @@ -323,7 +325,7 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir > $backuplog; --echo # "innodb_corrupted_pages" file must not exist after successful prepare --error 1 --file_exists $targetdir/innodb_corrupted_pages ---let SEARCH_PATTERN=was successfuly fixed.* +--let SEARCH_PATTERN=was successfully fixed.* --let SEARCH_FILE=$backuplog --source include/search_pattern_in_file.inc @@ -347,7 +349,7 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir --incremental-dir=$incdir > $ --file_exists $targetdir/innodb_corrupted_pages --echo # do not remove "innodb_corrupted_pages" in incremental dir --file_exists $incdir/innodb_corrupted_pages ---let SEARCH_PATTERN=was successfuly fixed.* +--let SEARCH_PATTERN=was successfully fixed.* --let SEARCH_FILE=$backuplog --source include/search_pattern_in_file.inc diff --git a/mysql-test/suite/mariabackup/mdev-14447.combinations b/mysql-test/suite/mariabackup/mdev-14447.combinations new file mode 100644 index 0000000000000..79e5f7836ed0e --- /dev/null +++ b/mysql-test/suite/mariabackup/mdev-14447.combinations @@ -0,0 +1,5 @@ +[crc32] +--innodb-checksum-algorithm=crc32 + +[full_crc32] +--innodb-checksum-algorithm=full_crc32 diff --git a/mysql-test/suite/mariabackup/mdev-14447.result b/mysql-test/suite/mariabackup/mdev-14447.result index 8f7a1a8708b9e..16d3ab561f6ee 100644 --- a/mysql-test/suite/mariabackup/mdev-14447.result +++ b/mysql-test/suite/mariabackup/mdev-14447.result @@ -1,6 +1,8 @@ call mtr.add_suppression("InnoDB: New log files created"); +SET GLOBAL innodb_file_per_table=0; CREATE TABLE t(a varchar(40) PRIMARY KEY, b varchar(40), c varchar(40), d varchar(40), index(b,c,d)) ENGINE INNODB; # Create full backup , modify table, then create incremental/differential backup +SET debug_dbug='+d,skip_page_checksum',foreign_key_checks=0,unique_checks=0; BEGIN; INSERT INTO t select uuid(), uuid(), uuid(), uuid() from seq_1_to_100000; COMMIT; diff --git a/mysql-test/suite/mariabackup/mdev-14447.test b/mysql-test/suite/mariabackup/mdev-14447.test index b6998976e8c91..79a0d07589755 100644 --- a/mysql-test/suite/mariabackup/mdev-14447.test +++ b/mysql-test/suite/mariabackup/mdev-14447.test @@ -6,6 +6,7 @@ call mtr.add_suppression("InnoDB: New log files created"); let $basedir=$MYSQLTEST_VARDIR/tmp/backup; let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1; +SET GLOBAL innodb_file_per_table=0; CREATE TABLE t(a varchar(40) PRIMARY KEY, b varchar(40), c varchar(40), d varchar(40), index(b,c,d)) ENGINE INNODB; echo # Create full backup , modify table, then create incremental/differential backup; @@ -13,6 +14,7 @@ echo # Create full backup , modify table, then create incremental/differential b exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir; --enable_result_log +SET debug_dbug='+d,skip_page_checksum',foreign_key_checks=0,unique_checks=0; BEGIN; INSERT INTO t select uuid(), uuid(), uuid(), uuid() from seq_1_to_100000; COMMIT; diff --git a/mysql-test/suite/mariabackup/partial_exclude.result b/mysql-test/suite/mariabackup/partial_exclude.result index a31197b9e9dac..f57a5f63e6819 100644 --- a/mysql-test/suite/mariabackup/partial_exclude.result +++ b/mysql-test/suite/mariabackup/partial_exclude.result @@ -8,8 +8,15 @@ CREATE DATABASE db2; USE db2; CREATE TABLE t1(i INT) ENGINE INNODB; USE test; +BEGIN; +INSERT INTO db2.t1 VALUES(20); +INSERT INTO test.t1 VALUES(20); +INSERT INTO test.t2 VALUES(20); # xtrabackup backup +COMMIT; t1.new DROP TABLE t1; DROP TABLE t2; DROP DATABASE db2; +NOT FOUND /Operating system error number/ in backup.log +NOT FOUND /Could not find a valid tablespace file for/ in backup.log diff --git a/mysql-test/suite/mariabackup/partial_exclude.test b/mysql-test/suite/mariabackup/partial_exclude.test index 3642a2c6f4610..6a1ae13b51287 100644 --- a/mysql-test/suite/mariabackup/partial_exclude.test +++ b/mysql-test/suite/mariabackup/partial_exclude.test @@ -19,6 +19,11 @@ CREATE TABLE t1(i INT) ENGINE INNODB; USE test; +BEGIN; +INSERT INTO db2.t1 VALUES(20); +INSERT INTO test.t1 VALUES(20); +INSERT INTO test.t2 VALUES(20); + echo # xtrabackup backup; let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; @@ -26,6 +31,8 @@ let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup "--tables-exclude=test.*2" "--databases-exclude=db2" --target-dir=$targetdir; --enable_result_log +COMMIT; + # check that only t1 table is in backup (t2 is excluded) list_files $targetdir/test *.new; list_files $targetdir/test *.ibd; @@ -47,4 +54,17 @@ DROP DATABASE db2; rmdir $MYSQLD_DATADIR/db3; rmdir $MYSQLD_DATADIR/db4; rmdir $MYSQLD_DATADIR/db5; + +--let $backup_log=$MYSQLTEST_VARDIR/tmp/backup.log +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --export --prepare --target-dir="$targetdir" > $backup_log; +--enable_result_log + +--let SEARCH_FILE=$backup_log +--let SEARCH_PATTERN=Operating system error number +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN=Could not find a valid tablespace file for +--source include/search_pattern_in_file.inc +--remove_file $backup_log + rmdir $targetdir; diff --git a/mysql-test/suite/mariabackup/partition_datadir.test b/mysql-test/suite/mariabackup/partition_datadir.test index c525d34a02c02..36520d331bf63 100644 --- a/mysql-test/suite/mariabackup/partition_datadir.test +++ b/mysql-test/suite/mariabackup/partition_datadir.test @@ -1,4 +1,5 @@ --source include/have_partition.inc +--source include/have_symlink.inc let $targetdir=$MYSQLTEST_VARDIR/backup; mkdir $targetdir; mkdir $MYSQLTEST_VARDIR/partitdata; diff --git a/mysql-test/suite/mariabackup/relative_path.opt b/mysql-test/suite/mariabackup/relative_path.opt new file mode 100644 index 0000000000000..3e3c33e44f85a --- /dev/null +++ b/mysql-test/suite/mariabackup/relative_path.opt @@ -0,0 +1 @@ +--innodb-undo-tablespaces=2 diff --git a/mysql-test/suite/mariabackup/relative_path.result b/mysql-test/suite/mariabackup/relative_path.result new file mode 100644 index 0000000000000..7aa0c6968f3dc --- /dev/null +++ b/mysql-test/suite/mariabackup/relative_path.result @@ -0,0 +1,20 @@ +CREATE TABLE t(i INT) ENGINE INNODB; +INSERT INTO t VALUES(1); +# xtrabackup backup +# xtrabackup prepare +# shutdown server +# remove datadir +# xtrabackup move back +# restart +# shutdown server +# remove datadir +# xtrabackup move back +# restart +# shutdown server +# remove datadir +# xtrabackup move back +# restart +SELECT * FROM t; +i +1 +DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/relative_path.test b/mysql-test/suite/mariabackup/relative_path.test new file mode 100644 index 0000000000000..bd25a217e711e --- /dev/null +++ b/mysql-test/suite/mariabackup/relative_path.test @@ -0,0 +1,35 @@ +--source include/have_innodb.inc + +CREATE TABLE t(i INT) ENGINE INNODB; +INSERT INTO t VALUES(1); + +echo # xtrabackup backup; +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +--let $backup_log=$MYSQLTEST_VARDIR/tmp/backup.log + +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backup_log 2>&1; +--enable_result_log + +echo # xtrabackup prepare; +--disable_result_log +exec $XTRABACKUP --prepare --target-dir=$targetdir; + +# If MDEV-28187 is not fixed, the following tries to copy backup to data +# directory will fail, because their destination path will be the same as +# their source path + +--let $backup_opts=--innodb_undo_directory=./ +--source include/restart_and_restore.inc + +--let $backup_opts=--innodb_log_group_home_dir=./ +--source include/restart_and_restore.inc + +--let $backup_opts=--innodb_data_home_dir=./ +--source include/restart_and_restore.inc + +--enable_result_log + +SELECT * FROM t; +DROP TABLE t; +rmdir $targetdir; diff --git a/mysql-test/suite/mariabackup/rpl_slave_info.result b/mysql-test/suite/mariabackup/rpl_slave_info.result index 13044fd6c39c5..ec27166ecfb01 100644 --- a/mysql-test/suite/mariabackup/rpl_slave_info.result +++ b/mysql-test/suite/mariabackup/rpl_slave_info.result @@ -13,6 +13,9 @@ connection slave; "using_gtid: Slave_Pos" FOUND 1 /gtid_slave_pos/ in xtrabackup_slave_info NOT FOUND /MASTER_LOG_FILE/ in xtrabackup_slave_info +lineno line +1 SET GLOBAL gtid_slave_pos = ''; +2 CHANGE MASTER TO master_use_gtid = slave_pos; ############### # If Using_Gtid != 'No' and !gtid_slave_pos, backup master position ######################## @@ -20,6 +23,8 @@ include/stop_slave.inc SET GLOBAL gtid_slave_pos=""; NOT FOUND /gtid_slave_pos/ in xtrabackup_slave_info FOUND 1 /MASTER_LOG_FILE/ in xtrabackup_slave_info +lineno line +1 CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=; ############### # If Using_Gtid == 'No', backup Exec_Master_Log_Pos ######################## @@ -31,6 +36,8 @@ connection slave; "using_gtid: No" NOT FOUND /gtid_slave_pos/ in xtrabackup_slave_info FOUND 1 /MASTER_LOG_FILE/ in xtrabackup_slave_info +lineno line +1 CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=; connection master; DROP TABLE t; connection slave; diff --git a/mysql-test/suite/mariabackup/rpl_slave_info.test b/mysql-test/suite/mariabackup/rpl_slave_info.test index ca7682d8af9e4..1c5dd89acc9bd 100644 --- a/mysql-test/suite/mariabackup/rpl_slave_info.test +++ b/mysql-test/suite/mariabackup/rpl_slave_info.test @@ -27,6 +27,7 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffi --source include/search_pattern_in_file.inc --let SEARCH_PATTERN=MASTER_LOG_FILE --source include/search_pattern_in_file.inc +--source include/show_xtrabackup_slave_info.inc rmdir $targetdir; @@ -35,7 +36,9 @@ rmdir $targetdir; --echo ######################## --source include/stop_slave.inc +--disable_warnings SET GLOBAL gtid_slave_pos=""; +--enable_warnings --let $targetdir=$MYSQLTEST_VARDIR/tmp/backup --disable_result_log @@ -47,6 +50,7 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffi --source include/search_pattern_in_file.inc --let SEARCH_PATTERN=MASTER_LOG_FILE --source include/search_pattern_in_file.inc +--source include/show_xtrabackup_slave_info.inc rmdir $targetdir; @@ -74,6 +78,7 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffi --source include/search_pattern_in_file.inc --let SEARCH_PATTERN=MASTER_LOG_FILE --source include/search_pattern_in_file.inc +--source include/show_xtrabackup_slave_info.inc rmdir $targetdir; diff --git a/mysql-test/suite/mariabackup/slave_info_norpl.result b/mysql-test/suite/mariabackup/slave_info_norpl.result new file mode 100644 index 0000000000000..9fcd67a891699 --- /dev/null +++ b/mysql-test/suite/mariabackup/slave_info_norpl.result @@ -0,0 +1,59 @@ +# +# Start of 10.2 tests +# +# +# MDEV-21037 mariabackup does not detect multi-source replication slave +# +SELECT @@global.gtid_slave_pos; +@@global.gtid_slave_pos + + +# Without any masters the file xtrabackup_slave_info is not created +line +[00] YYYY-MM-DD hh:mm:ss Failed to get master binlog coordinates from SHOW SLAVE STATUS.This means that the server is not a replication slave. Ignoring the --slave-info option + +CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=10000; +lineno line +1 CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=; +line +[00] YYYY-MM-DD hh:mm:ss MySQL slave binlog position: master '' filename '' position '0' + +CHANGE MASTER 'master2' TO MASTER_HOST='localhost', MASTER_PORT=10002; +lineno line +1 CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=; +2 CHANGE MASTER 'master2' TO MASTER_LOG_FILE='', MASTER_LOG_POS=; +line +[00] YYYY-MM-DD hh:mm:ss MySQL slave binlog position: master '' filename '' position '0'; master 'master2' filename '' position '0' + +SET GLOBAL gtid_slave_pos='1-1-1,2-2-2'; +CHANGE MASTER 'master3' TO MASTER_HOST='localhost', MASTER_PORT=10003, MASTER_USE_GTID=slave_pos; +CHANGE MASTER 'master4' TO MASTER_HOST='localhost', MASTER_PORT=10004, MASTER_USE_GTID=no; +CHANGE MASTER 'master5' TO MASTER_HOST='localhost', MASTER_PORT=10005, MASTER_USE_GTID=slave_pos; +lineno line +1 SET GLOBAL gtid_slave_pos = ','; +2 CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=; +3 CHANGE MASTER 'master2' TO MASTER_LOG_FILE='', MASTER_LOG_POS=; +4 CHANGE MASTER 'master3' TO master_use_gtid = slave_pos; +5 CHANGE MASTER 'master4' TO MASTER_LOG_FILE='', MASTER_LOG_POS=; +6 CHANGE MASTER 'master5' TO master_use_gtid = slave_pos; +line +[00] YYYY-MM-DD hh:mm:ss MySQL slave binlog position: gtid_slave_pos ','; master '' filename '' position '0'; master 'master2' filename '' position '0'; master 'master3' master_use_gtid = slave_pos; master 'master4' filename '' position '0'; master 'master5' master_use_gtid = slave_pos + +CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=10000, MASTER_USE_GTID=slave_pos; +lineno line +1 SET GLOBAL gtid_slave_pos = ','; +2 CHANGE MASTER TO master_use_gtid = slave_pos; +3 CHANGE MASTER 'master2' TO MASTER_LOG_FILE='', MASTER_LOG_POS=; +4 CHANGE MASTER 'master3' TO master_use_gtid = slave_pos; +5 CHANGE MASTER 'master4' TO MASTER_LOG_FILE='', MASTER_LOG_POS=; +6 CHANGE MASTER 'master5' TO master_use_gtid = slave_pos; +line +[00] YYYY-MM-DD hh:mm:ss MySQL slave binlog position: gtid_slave_pos ','; master '' master_use_gtid = slave_pos; master 'master2' filename '' position '0'; master 'master3' master_use_gtid = slave_pos; master 'master4' filename '' position '0'; master 'master5' master_use_gtid = slave_pos +RESET SLAVE ALL; +RESET SLAVE 'master2' ALL; +RESET SLAVE 'master3' ALL; +RESET SLAVE 'master4' ALL; +RESET SLAVE 'master5' ALL; +# +# End of 10.2 tests +# diff --git a/mysql-test/suite/mariabackup/slave_info_norpl.test b/mysql-test/suite/mariabackup/slave_info_norpl.test new file mode 100644 index 0000000000000..0d2d2ed486164 --- /dev/null +++ b/mysql-test/suite/mariabackup/slave_info_norpl.test @@ -0,0 +1,86 @@ +# +# "mariabackup --slave-info" tests that can be run without +# actually starting the replication. +# + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-21037 mariabackup does not detect multi-source replication slave +--echo # + +--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup +--let $XTRABACKUP_ARGS=--defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --slave-info --backup --databases=test --target-dir=$targetdir +--let $XTRABACKUP_OUT=$MYSQLTEST_VARDIR/tmp/xtrabackup_out + +# Should be empty by default +SELECT @@global.gtid_slave_pos; + +--echo +--echo # Without any masters the file xtrabackup_slave_info is not created + +--disable_result_log +exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT; +--enable_result_log +--error 1 +--file_exists $targetdir/xtrabackup_slave_info +--source include/show_xtrabackup_slave_info_out.inc +--remove_file $XTRABACKUP_OUT +rmdir $targetdir; + +--echo +CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=10000; +--disable_result_log +exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT; +--enable_result_log +--source include/show_xtrabackup_slave_info.inc +--source include/show_xtrabackup_slave_info_out.inc +--remove_file $XTRABACKUP_OUT +rmdir $targetdir; + +--echo +CHANGE MASTER 'master2' TO MASTER_HOST='localhost', MASTER_PORT=10002; +--disable_result_log +exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT; +--enable_result_log +--source include/show_xtrabackup_slave_info.inc +--source include/show_xtrabackup_slave_info_out.inc +--remove_file $XTRABACKUP_OUT +rmdir $targetdir; + +--echo +SET GLOBAL gtid_slave_pos='1-1-1,2-2-2'; +CHANGE MASTER 'master3' TO MASTER_HOST='localhost', MASTER_PORT=10003, MASTER_USE_GTID=slave_pos; +CHANGE MASTER 'master4' TO MASTER_HOST='localhost', MASTER_PORT=10004, MASTER_USE_GTID=no; +CHANGE MASTER 'master5' TO MASTER_HOST='localhost', MASTER_PORT=10005, MASTER_USE_GTID=slave_pos; + +--disable_result_log +exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT; +--enable_result_log +--source include/show_xtrabackup_slave_info.inc +--source include/show_xtrabackup_slave_info_out.inc +--remove_file $XTRABACKUP_OUT +rmdir $targetdir; + +--echo +CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=10000, MASTER_USE_GTID=slave_pos; +--disable_result_log +exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT; +--enable_result_log +--source include/show_xtrabackup_slave_info.inc +--source include/show_xtrabackup_slave_info_out.inc +--remove_file $XTRABACKUP_OUT +rmdir $targetdir; + +RESET SLAVE ALL; +RESET SLAVE 'master2' ALL; +RESET SLAVE 'master3' ALL; +RESET SLAVE 'master4' ALL; +RESET SLAVE 'master5' ALL; + + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/suite/mariabackup/system_versioning.result b/mysql-test/suite/mariabackup/system_versioning.result index 83e9cf0415068..f8feb08b051bb 100644 --- a/mysql-test/suite/mariabackup/system_versioning.result +++ b/mysql-test/suite/mariabackup/system_versioning.result @@ -10,7 +10,7 @@ show create table t; Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL -) ENGINE=INNODB_OR_MYISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=INNODB_OR_MYISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select * from t; a 2 @@ -38,7 +38,7 @@ t CREATE TABLE `t` ( `s` bigint(20) unsigned GENERATED ALWAYS AS ROW START INVISIBLE, `e` bigint(20) unsigned GENERATED ALWAYS AS ROW END INVISIBLE, PERIOD FOR SYSTEM_TIME (`s`, `e`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select * from t; a 2 diff --git a/mysql-test/suite/mariabackup/unsupported_redo.test b/mysql-test/suite/mariabackup/unsupported_redo.test index b02bcc3f6958b..97e1cad222d30 100644 --- a/mysql-test/suite/mariabackup/unsupported_redo.test +++ b/mysql-test/suite/mariabackup/unsupported_redo.test @@ -1,4 +1,5 @@ --source include/have_innodb.inc +--source include/innodb_undo_tablespaces.inc call mtr.add_suppression("InnoDB: New log files created"); call mtr.add_suppression("InnoDB: Operating system error number .* in a file operation"); call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified"); diff --git a/mysql-test/suite/mariabackup/xb_partition.test b/mysql-test/suite/mariabackup/xb_partition.test index 3d027b67fc199..1c8eeaa19e6b0 100644 --- a/mysql-test/suite/mariabackup/xb_partition.test +++ b/mysql-test/suite/mariabackup/xb_partition.test @@ -1,5 +1,6 @@ #--source include/innodb_page_size.inc --source include/have_partition.inc +--source include/innodb_undo_tablespaces.inc CREATE TABLE t1(a INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1), (2), (3); diff --git a/mysql-test/suite/multi_source/multi_parallel.test b/mysql-test/suite/multi_source/multi_parallel.test index a1385198b61aa..2bbb344378c6f 100644 --- a/mysql-test/suite/multi_source/multi_parallel.test +++ b/mysql-test/suite/multi_source/multi_parallel.test @@ -2,6 +2,7 @@ # Slave_non_transactional_groups, Slave_transactional_groups --source include/not_embedded.inc --source include/have_innodb.inc +--source include/no_valgrind_without_big.inc --let $rpl_server_count= 0 --connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1) diff --git a/mysql-test/suite/multi_source/multisource_for_channel.result b/mysql-test/suite/multi_source/multisource_for_channel.result index f96a5a93b973b..cb1224b416fda 100644 --- a/mysql-test/suite/multi_source/multisource_for_channel.result +++ b/mysql-test/suite/multi_source/multisource_for_channel.result @@ -279,6 +279,10 @@ Last_SQL_Errno = '0' # START SLAVE for channel 'master1'; include/wait_for_slave_to_start.inc +connection master1; +create table foo (a int); +drop table foo; +connection slave; show slave status for channel 'master1' Master_Port = 'MYPORT_1' diff --git a/mysql-test/suite/multi_source/multisource_for_channel.test b/mysql-test/suite/multi_source/multisource_for_channel.test index 9b74ea97742ee..a95b272d5b1fa 100644 --- a/mysql-test/suite/multi_source/multisource_for_channel.test +++ b/mysql-test/suite/multi_source/multisource_for_channel.test @@ -326,6 +326,15 @@ STOP SLAVE for channel 'master1'; START SLAVE for channel 'master1'; --source include/wait_for_slave_to_start.inc +# Force some data into the relay log to ensure that we get a new relay log +--connection master1 +create table foo (a int); +drop table foo; +--save_master_pos +--connection slave +--sync_with_master 0,'master1' +--source include/wait_for_sql_thread_read_all.inc + --echo --echo show slave status for channel 'master1' --let $status_items= Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test index 4e1df63b45bde..69181c3615c3f 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test @@ -4,6 +4,7 @@ --source include/have_debug.inc --source include/have_innodb.inc +--source include/no_valgrind_without_big.inc SET @saved_dbug = @@SESSION.debug_dbug; # crash requires ICP support in InnoDB diff --git a/mysql-test/suite/parts/inc/part_alter_values.inc b/mysql-test/suite/parts/inc/part_alter_values.inc index ac69169a9caa6..d3b63a4610f51 100644 --- a/mysql-test/suite/parts/inc/part_alter_values.inc +++ b/mysql-test/suite/parts/inc/part_alter_values.inc @@ -1,3 +1,5 @@ +--source include/have_symlink.inc + --echo # --echo # MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine --echo # @@ -36,12 +38,51 @@ ALTER TABLE t1 REORGANIZE PARTITION p1 INTO ); DROP TABLE t1; -# -# MDEV-15456 Server crashes upon adding or dropping a partition in ALTER under LOCK TABLE after ER_SAME_NAME_PARTITION -# +--echo # +--echo # MDEV-15456 Server crashes upon adding or dropping a partition in ALTER under LOCK TABLE after ER_SAME_NAME_PARTITION +--echo # --eval create table t1 (i int) engine=$engine partition by range(i) (partition p0 values less than (10)) lock table t1 write; --error ER_SAME_NAME_PARTITION alter table t1 add partition (partition p0 values less than (20)); alter table t1 add partition (partition p1 values less than (20)) /* comment */; drop table t1; + +--echo # +--echo # MDEV-27065 Partitioning tables with custom data directories moves data back to default directory +--echo # + +--mkdir $MYSQLTEST_VARDIR/tmp/mdev_27065 + +--disable_query_log +--eval CREATE TABLE t1 (id INT) ENGINE=$engine DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp/mdev_27065' +--enable_query_log +ALTER TABLE t1 PARTITION BY RANGE(id)( + PARTITION p0 VALUES LESS THAN (1000), + PARTITION p1 VALUES LESS THAN MAXVALUE +); +DROP TABLE t1; + +# InnoDB doesn't support INDEX DIRECTORY. +if (`SELECT IF('$engine' != 'InnoDB', 1, 0)`) +{ + --disable_query_log + --eval CREATE TABLE t2 (id INT) ENGINE=$engine INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp/mdev_27065' + --enable_query_log + ALTER TABLE t2 PARTITION BY RANGE(id)( + PARTITION p0 VALUES LESS THAN (1000), + PARTITION p1 VALUES LESS THAN MAXVALUE + ); + DROP TABLE t2; +} + +--remove_files_wildcard $MYSQLTEST_VARDIR/tmp/mdev_27065 * +--rmdir $MYSQLTEST_VARDIR/tmp/mdev_27065 + +--echo # +--echo # MDEV-26127 Assertion `err != DB_DUPLICATE_KEY' failed or InnoDB: Failing assertion: id != 0 on ALTER ... REBUILD PARTITION +--echo # +--eval CREATE TABLE t1 (c INT) ENGINE=$engine PARTITION BY KEY(c) PARTITIONS 4; +LOCK TABLES t1 WRITE, t1 AS a READ; +ALTER TABLE t1 REBUILD PARTITION p0; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/inc/partition_auto_increment.inc b/mysql-test/suite/parts/inc/partition_auto_increment.inc index 3721caeb465d7..567733edab022 100644 --- a/mysql-test/suite/parts/inc/partition_auto_increment.inc +++ b/mysql-test/suite/parts/inc/partition_auto_increment.inc @@ -873,6 +873,8 @@ SELECT LAST_INSERT_ID(); SELECT * FROM t1; DROP TABLE t1; } +--echo ############################################################################## +} if (!$skip_update) { @@ -880,11 +882,44 @@ if (!$skip_update) --echo # MDEV-19622 Assertion failures in --echo # ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table --echo # -CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a); +eval CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=$engine PARTITION BY HASH(a); INSERT INTO t1 VALUES (1,1),(2,2); UPDATE t1 SET pk = 0; DROP TABLE t1; + +--echo # +--echo # MDEV-29636 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' +--echo # failed in ha_partition::set_auto_increment_if_higher upon REPLACE +--echo # with partition pruning +--echo # +eval CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE=$engine +PARTITION BY RANGE (a) ( + PARTITION p0 VALUES LESS THAN (10), + PARTITION pn VALUES LESS THAN MAXVALUE +); +REPLACE INTO t1 PARTITION (p0) SELECT 1; +DROP TABLE t1; } ---echo ############################################################################## +if (!$skip_delete) +{ +--echo # +--echo # MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' +--echo # ha_partition::set_auto_increment_if_higher +--echo # +eval CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE=$engine PARTITION BY HASH (a) PARTITIONS 3; +REPLACE INTO t1 PARTITION (p0) VALUES (3); +DROP TABLE t1; +} + +if (!$skip_truncate) +{ +--echo # +--echo # MDEV-21310 AUTO_INCREMENT column throws range error on INSERT in partitioned table | +--echo # Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed. +--echo # +eval CREATE TABLE t1 (c INT AUTO_INCREMENT KEY) ENGINE=$engine PARTITION BY LIST (c) (PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +ALTER TABLE t1 TRUNCATE PARTITION p1; +INSERT INTO t1 PARTITION (p1) (c) SELECT 1; +DROP TABLE t1; } diff --git a/mysql-test/suite/parts/r/alter_data_directory_innodb.result b/mysql-test/suite/parts/r/alter_data_directory_innodb.result index de2da0b9a0550..8c07093f12728 100644 --- a/mysql-test/suite/parts/r/alter_data_directory_innodb.result +++ b/mysql-test/suite/parts/r/alter_data_directory_innodb.result @@ -13,7 +13,7 @@ SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( `a` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) @@ -25,7 +25,7 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) @@ -34,7 +34,7 @@ SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( `a` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) @@ -48,7 +48,7 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) @@ -65,7 +65,7 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) diff --git a/mysql-test/suite/parts/r/alter_table,list.rdiff b/mysql-test/suite/parts/r/alter_table,list.rdiff index 090eb42de84de..391216bc47c4a 100644 --- a/mysql-test/suite/parts/r/alter_table,list.rdiff +++ b/mysql-test/suite/parts/r/alter_table,list.rdiff @@ -1,6 +1,4 @@ ---- alter_table.result -+++ alter_table,list.reject -@@ -62,13 +62,13 @@ +@@ -142,13 +142,13 @@ partition pn values less than maxvalue); ERROR HY000: Partitioned tables do not support CREATE TEMPORARY TABLE create or replace table t1 (x int) @@ -21,10 +19,10 @@ insert into t1 values (2), (12), (22), (32), (42), (52); create or replace table tp2 (y int); insert tp2 values (88); -@@ -108,12 +108,12 @@ +@@ -188,12 +188,12 @@ t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL - ) ENGINE=X DEFAULT CHARSET=latin1 + ) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci - PARTITION BY RANGE (`x`) -(PARTITION `p1` VALUES LESS THAN (10) ENGINE = X, - PARTITION `p3` VALUES LESS THAN (30) ENGINE = X, @@ -40,10 +38,10 @@ select * from t1 order by x; x 2 -@@ -138,11 +138,11 @@ +@@ -218,11 +218,11 @@ t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL - ) ENGINE=X DEFAULT CHARSET=latin1 + ) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci - PARTITION BY RANGE (`x`) -(PARTITION `p1` VALUES LESS THAN (10) ENGINE = X, - PARTITION `p4` VALUES LESS THAN (40) ENGINE = X, @@ -57,10 +55,10 @@ select * from t1 order by x; x 2 -@@ -168,10 +168,10 @@ +@@ -248,10 +248,10 @@ t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL - ) ENGINE=X DEFAULT CHARSET=latin1 + ) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci - PARTITION BY RANGE (`x`) -(PARTITION `p1` VALUES LESS THAN (10) ENGINE = X, - PARTITION `p5` VALUES LESS THAN (50) ENGINE = X, @@ -72,10 +70,10 @@ select * from t1 order by x; x 2 -@@ -193,9 +193,9 @@ +@@ -273,9 +273,9 @@ t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL - ) ENGINE=X DEFAULT CHARSET=latin1 + ) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci - PARTITION BY RANGE (`x`) -(PARTITION `p1` VALUES LESS THAN (10) ENGINE = X, - PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X) diff --git a/mysql-test/suite/parts/r/alter_table.result b/mysql-test/suite/parts/r/alter_table.result index 7f81eb1794433..b887cea36f098 100644 --- a/mysql-test/suite/parts/r/alter_table.result +++ b/mysql-test/suite/parts/r/alter_table.result @@ -5,7 +5,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY KEY (`a`) (PARTITION `p0` VALUES LESS THAN (10) @@ -48,7 +48,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (0) ENGINE = X, PARTITION `p1` VALUES LESS THAN (10) ENGINE = X) @@ -59,12 +59,12 @@ show create table tp2; Table Create Table tp2 CREATE TABLE `tp2` ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (0) ENGINE = X, PARTITION `p1` VALUES LESS THAN (10) ENGINE = X) @@ -89,7 +89,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (0) ENGINE = X, PARTITION `p1` VALUES LESS THAN (10) ENGINE = X, @@ -179,7 +179,7 @@ show create table tp2; Table Create Table tp2 CREATE TABLE `tp2` ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from tp2; x 12 @@ -187,7 +187,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = X, PARTITION `p3` VALUES LESS THAN (30) ENGINE = X, @@ -209,7 +209,7 @@ show create table EXISTENT.TP3; Table Create Table TP3 CREATE TABLE `TP3`-ok ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from EXISTENT.TP3 order by x; x 22 @@ -217,7 +217,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = X, PARTITION `p4` VALUES LESS THAN (40) ENGINE = X, @@ -239,7 +239,7 @@ show create table tp4; Table Create Table tp4 CREATE TABLE `tp4` ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from tp4; x 32 @@ -247,7 +247,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = X, PARTITION `p5` VALUES LESS THAN (50) ENGINE = X, @@ -264,7 +264,7 @@ show create table tp5; Table Create Table tp5 CREATE TABLE `tp5` ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from tp5; x 42 @@ -272,7 +272,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = X, PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X) @@ -296,7 +296,7 @@ Grants for alan@% GRANT USAGE ON *.* TO `alan`@`%` GRANT INSERT, CREATE, DROP ON `test`.* TO `alan`@`%` alter table t1 convert partition p1 to table tp1; -ERROR 42000: ALTER command denied to user 'alan'@'localhost' for table 't1' +ERROR 42000: ALTER command denied to user 'alan'@'localhost' for table `test`.`t1` connection default; revoke all on test.* from alan; grant create, insert, alter on test.* to alan; @@ -307,7 +307,7 @@ Grants for alan@% GRANT USAGE ON *.* TO `alan`@`%` GRANT INSERT, CREATE, ALTER ON `test`.* TO `alan`@`%` alter table t1 convert partition p1 to table tp1; -ERROR 42000: DROP command denied to user 'alan'@'localhost' for table 't1' +ERROR 42000: DROP command denied to user 'alan'@'localhost' for table `test`.`t1` connection default; revoke all on test.* from alan; grant create, drop, alter on test.* to alan; @@ -318,7 +318,7 @@ Grants for alan@% GRANT USAGE ON *.* TO `alan`@`%` GRANT CREATE, DROP, ALTER ON `test`.* TO `alan`@`%` alter table t1 convert partition p1 to table tp1; -ERROR 42000: INSERT command denied to user 'alan'@'localhost' for table 'tp1' +ERROR 42000: INSERT command denied to user 'alan'@'localhost' for table `test`.`tp1` connection default; revoke all on test.* from alan; grant insert, drop, alter on test.* to alan; @@ -329,7 +329,7 @@ Grants for alan@% GRANT USAGE ON *.* TO `alan`@`%` GRANT INSERT, DROP, ALTER ON `test`.* TO `alan`@`%` alter table t1 convert partition p1 to table tp1; -ERROR 42000: CREATE command denied to user 'alan'@'localhost' for table 'tp1' +ERROR 42000: CREATE command denied to user 'alan'@'localhost' for table `test`.`tp1` connection default; grant create, insert, drop, alter on test.* to alan; connection alan; diff --git a/mysql-test/suite/parts/r/backup_log.result b/mysql-test/suite/parts/r/backup_log.result index 3a22049102708..be4109965bcf4 100644 --- a/mysql-test/suite/parts/r/backup_log.result +++ b/mysql-test/suite/parts/r/backup_log.result @@ -80,7 +80,7 @@ Table Create Table t42 CREATE TABLE `t42` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) PARTITIONS 2 drop table t40, t41, t42; diff --git a/mysql-test/suite/parts/r/debug_innodb_crash.result b/mysql-test/suite/parts/r/debug_innodb_crash.result index fc265b4957d1e..318ec38570047 100644 --- a/mysql-test/suite/parts/r/debug_innodb_crash.result +++ b/mysql-test/suite/parts/r/debug_innodb_crash.result @@ -30,7 +30,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -64,7 +64,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -98,7 +98,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -134,7 +134,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -168,7 +168,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -204,7 +204,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -238,7 +238,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -274,7 +274,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -308,7 +308,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -345,7 +345,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -379,7 +379,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -416,7 +416,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -450,7 +450,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -487,7 +487,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -521,7 +521,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -559,7 +559,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -594,7 +594,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -630,7 +630,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -665,7 +665,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -701,7 +701,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -738,7 +738,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -771,7 +771,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -805,7 +805,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -840,7 +840,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -874,7 +874,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -909,7 +909,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -943,7 +943,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -977,7 +977,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -1006,7 +1006,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1040,7 +1040,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -1069,7 +1069,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1103,7 +1103,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -1132,7 +1132,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1164,7 +1164,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -1193,7 +1193,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1224,7 +1224,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -1253,7 +1253,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1284,7 +1284,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -1316,7 +1316,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1351,7 +1351,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1385,7 +1385,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1422,7 +1422,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1456,7 +1456,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1493,7 +1493,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1527,7 +1527,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1566,7 +1566,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1600,7 +1600,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1639,7 +1639,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1673,7 +1673,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1712,7 +1712,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1746,7 +1746,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1786,7 +1786,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -1821,7 +1821,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1861,7 +1861,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -1896,7 +1896,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1934,7 +1934,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -1969,7 +1969,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2007,7 +2007,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -2042,7 +2042,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2079,7 +2079,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -2114,7 +2114,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2151,7 +2151,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, diff --git a/mysql-test/suite/parts/r/debug_innodb_fail.result b/mysql-test/suite/parts/r/debug_innodb_fail.result index 65d13feec62d0..b57925eb0733d 100644 --- a/mysql-test/suite/parts/r/debug_innodb_fail.result +++ b/mysql-test/suite/parts/r/debug_innodb_fail.result @@ -30,7 +30,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -58,7 +58,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -90,7 +90,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -119,7 +119,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -154,7 +154,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -182,7 +182,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -214,7 +214,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -243,7 +243,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -278,7 +278,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -306,7 +306,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -338,7 +338,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -367,7 +367,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -402,7 +402,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -430,7 +430,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -462,7 +462,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -491,7 +491,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -526,7 +526,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -554,7 +554,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -586,7 +586,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -615,7 +615,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -650,7 +650,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -678,7 +678,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -710,7 +710,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -739,7 +739,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -774,7 +774,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -802,7 +802,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -834,7 +834,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -863,7 +863,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -898,7 +898,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -927,7 +927,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -960,7 +960,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -990,7 +990,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -1026,7 +1026,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1055,7 +1055,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -1088,7 +1088,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1118,7 +1118,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -1154,7 +1154,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1183,7 +1183,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -1216,7 +1216,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1246,7 +1246,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -1284,7 +1284,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1311,7 +1311,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1343,7 +1343,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1371,7 +1371,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1406,7 +1406,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1433,7 +1433,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1465,7 +1465,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1493,7 +1493,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1528,7 +1528,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1555,7 +1555,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1587,7 +1587,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1615,7 +1615,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1650,7 +1650,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1676,7 +1676,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -1703,7 +1703,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1730,7 +1730,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -1760,7 +1760,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1786,7 +1786,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -1813,7 +1813,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1840,7 +1840,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -1870,7 +1870,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1896,7 +1896,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -1923,7 +1923,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -1950,7 +1950,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -1980,7 +1980,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2006,7 +2006,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -2033,7 +2033,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2060,7 +2060,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -2090,7 +2090,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2116,7 +2116,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -2143,7 +2143,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2170,7 +2170,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -2200,7 +2200,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2226,7 +2226,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -2253,7 +2253,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2280,7 +2280,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) SELECT * FROM t1; @@ -2313,7 +2313,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2342,7 +2342,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2374,7 +2374,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2404,7 +2404,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2439,7 +2439,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2468,7 +2468,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2500,7 +2500,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2530,7 +2530,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2565,7 +2565,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2594,7 +2594,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2626,7 +2626,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2656,7 +2656,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2691,7 +2691,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2720,7 +2720,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2752,7 +2752,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2782,7 +2782,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2817,7 +2817,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2846,7 +2846,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2878,7 +2878,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2908,7 +2908,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2943,7 +2943,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -2972,7 +2972,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -3004,7 +3004,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -3034,7 +3034,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -3069,7 +3069,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -3099,7 +3099,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -3132,7 +3132,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -3163,7 +3163,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -3199,7 +3199,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -3229,7 +3229,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -3262,7 +3262,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -3293,7 +3293,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -3329,7 +3329,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -3359,7 +3359,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -3392,7 +3392,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -3423,7 +3423,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -3459,7 +3459,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -3489,7 +3489,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -3522,7 +3522,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -3553,7 +3553,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -3589,7 +3589,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -3619,7 +3619,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -3652,7 +3652,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -3683,7 +3683,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -3719,7 +3719,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -3749,7 +3749,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, @@ -3782,7 +3782,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) @@ -3813,7 +3813,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, diff --git a/mysql-test/suite/parts/r/debug_myisam_crash.result b/mysql-test/suite/parts/r/debug_myisam_crash.result index 2b0f6973228d9..b8cd1fe57fdd8 100644 --- a/mysql-test/suite/parts/r/debug_myisam_crash.result +++ b/mysql-test/suite/parts/r/debug_myisam_crash.result @@ -29,7 +29,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -67,7 +67,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -103,7 +103,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -143,7 +143,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -179,7 +179,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -219,7 +219,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -255,7 +255,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -295,7 +295,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -331,7 +331,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -373,7 +373,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -409,7 +409,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -451,7 +451,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -487,7 +487,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -529,7 +529,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -565,7 +565,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -609,7 +609,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -646,7 +646,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -688,7 +688,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -725,7 +725,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -767,7 +767,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -806,7 +806,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -843,7 +843,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -879,7 +879,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -918,7 +918,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -954,7 +954,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -993,7 +993,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1029,7 +1029,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1066,7 +1066,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -1097,7 +1097,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1134,7 +1134,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -1165,7 +1165,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1202,7 +1202,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -1233,7 +1233,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1268,7 +1268,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -1299,7 +1299,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1332,7 +1332,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -1363,7 +1363,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1396,7 +1396,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -1430,7 +1430,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1469,7 +1469,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1505,7 +1505,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1546,7 +1546,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1582,7 +1582,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1623,7 +1623,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1659,7 +1659,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1704,7 +1704,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1740,7 +1740,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1785,7 +1785,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1821,7 +1821,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1866,7 +1866,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1902,7 +1902,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1949,7 +1949,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -1986,7 +1986,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2033,7 +2033,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -2070,7 +2070,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2115,7 +2115,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -2152,7 +2152,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2197,7 +2197,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -2234,7 +2234,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2277,7 +2277,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -2314,7 +2314,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2357,7 +2357,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, diff --git a/mysql-test/suite/parts/r/debug_myisam_fail.result b/mysql-test/suite/parts/r/debug_myisam_fail.result index 509cffe43840d..708ce22282630 100644 --- a/mysql-test/suite/parts/r/debug_myisam_fail.result +++ b/mysql-test/suite/parts/r/debug_myisam_fail.result @@ -29,7 +29,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -59,7 +59,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -93,7 +93,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -124,7 +124,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -161,7 +161,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -191,7 +191,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -225,7 +225,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -256,7 +256,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -293,7 +293,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -323,7 +323,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -357,7 +357,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -388,7 +388,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -425,7 +425,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -455,7 +455,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -489,7 +489,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -520,7 +520,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -557,7 +557,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -587,7 +587,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -621,7 +621,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -652,7 +652,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -689,7 +689,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -719,7 +719,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -753,7 +753,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -784,7 +784,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -821,7 +821,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -851,7 +851,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -885,7 +885,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -916,7 +916,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -953,7 +953,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -985,7 +985,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -1020,7 +1020,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1053,7 +1053,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -1091,7 +1091,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1123,7 +1123,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -1158,7 +1158,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1191,7 +1191,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -1229,7 +1229,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1261,7 +1261,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -1296,7 +1296,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1329,7 +1329,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -1369,7 +1369,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1398,7 +1398,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1432,7 +1432,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1462,7 +1462,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1499,7 +1499,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1528,7 +1528,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1562,7 +1562,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1592,7 +1592,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1629,7 +1629,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1658,7 +1658,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1692,7 +1692,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1722,7 +1722,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1759,7 +1759,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1786,7 +1786,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -1815,7 +1815,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1843,7 +1843,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -1875,7 +1875,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1902,7 +1902,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -1931,7 +1931,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -1959,7 +1959,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -1991,7 +1991,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2018,7 +2018,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -2047,7 +2047,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2075,7 +2075,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -2107,7 +2107,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2134,7 +2134,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -2163,7 +2163,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2191,7 +2191,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -2223,7 +2223,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2250,7 +2250,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -2279,7 +2279,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2307,7 +2307,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -2339,7 +2339,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2366,7 +2366,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -2395,7 +2395,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2423,7 +2423,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) SELECT * FROM t1; @@ -2458,7 +2458,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2489,7 +2489,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2523,7 +2523,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2555,7 +2555,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2592,7 +2592,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2623,7 +2623,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2657,7 +2657,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2689,7 +2689,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2726,7 +2726,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2757,7 +2757,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2791,7 +2791,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2823,7 +2823,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2860,7 +2860,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2891,7 +2891,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2925,7 +2925,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2957,7 +2957,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -2994,7 +2994,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3025,7 +3025,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3059,7 +3059,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3091,7 +3091,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3128,7 +3128,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3159,7 +3159,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3193,7 +3193,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3225,7 +3225,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3262,7 +3262,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3295,7 +3295,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -3330,7 +3330,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3364,7 +3364,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -3402,7 +3402,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3435,7 +3435,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -3470,7 +3470,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3504,7 +3504,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -3542,7 +3542,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3575,7 +3575,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -3610,7 +3610,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3644,7 +3644,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -3682,7 +3682,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3715,7 +3715,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -3750,7 +3750,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3784,7 +3784,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -3822,7 +3822,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3855,7 +3855,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -3890,7 +3890,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3924,7 +3924,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -3962,7 +3962,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -3995,7 +3995,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, @@ -4030,7 +4030,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) @@ -4064,7 +4064,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `p0` VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, PARTITION `p10` VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, diff --git a/mysql-test/suite/parts/r/engine_defined_part_attributes.result b/mysql-test/suite/parts/r/engine_defined_part_attributes.result new file mode 100644 index 0000000000000..fe7a89fdf52a1 --- /dev/null +++ b/mysql-test/suite/parts/r/engine_defined_part_attributes.result @@ -0,0 +1,288 @@ +# +# MDEV-5271 Support engine-defined attributes per partition +# +# partitioned tables +CREATE TABLE `t1` ( +`id` INT +) ENGINE=InnoDB ENCRYPTED="YES" PARTITION BY RANGE(id) ( +PARTITION pt1 VALUES LESS THAN (100) ENCRYPTED="NO" ENCRYPTION_KEY_ID=1, +PARTITION pt2 VALUES LESS THAN MAXVALUE ENCRYPTED="DEFAULT" ENCRYPTION_KEY_ID=1 +); +SHOW CREATE TABLE `t1`; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `ENCRYPTED`='YES' + PARTITION BY RANGE (`id`) +(PARTITION `pt1` VALUES LESS THAN (100) ENGINE = InnoDB ENCRYPTED = 'NO' ENCRYPTION_KEY_ID = 1, + PARTITION `pt2` VALUES LESS THAN MAXVALUE ENGINE = InnoDB ENCRYPTED = 'DEFAULT' ENCRYPTION_KEY_ID = 1) +INSERT INTO t1 VALUES (1), (2), (3); +DELETE FROM t1 WHERE id = 1; +UPDATE t1 SET id = 4 WHERE id = 3; +SELECT * FROM t1 WHERE id IN (2, 3); +id +2 +DROP TABLE `t1`; +CREATE TABLE `t2` ( +`id` INT +) ENGINE=InnoDB ENCRYPTED="YES" ENCRYPTION_KEY_ID=2 PARTITION BY RANGE(id) ( +PARTITION pt1 VALUES LESS THAN (100), +PARTITION pt2 VALUES LESS THAN MAXVALUE +); +ERROR HY000: Can't create table `test`.`t2` (errno: 140 "Wrong create options") +CREATE TABLE `t3` ( +`id` INT +) ENGINE=InnoDB ENCRYPTED="NO" PARTITION BY RANGE(id) ( +PARTITION pt1 VALUES LESS THAN (100) ENCRYPTED="YES" ENCRYPTION_KEY_ID=2, +PARTITION pt2 VALUES LESS THAN MAXVALUE +); +ERROR HY000: Can't create table `test`.`t3` (errno: 140 "Wrong create options") +CREATE TABLE `t4` ( +`id` INT +) ENGINE=InnoDB ENCRYPTED="NO"; +SHOW CREATE TABLE `t4`; +Table Create Table +t4 CREATE TABLE `t4` ( + `id` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `ENCRYPTED`='NO' +ALTER TABLE `t4` PARTITION BY RANGE(id) ( +PARTITION pt1 VALUES LESS THAN (100) ENCRYPTED="NO", +PARTITION pt2 VALUES LESS THAN MAXVALUE ENCRYPTED="DEFAULT" +); +SHOW CREATE TABLE `t4`; +Table Create Table +t4 CREATE TABLE `t4` ( + `id` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `ENCRYPTED`='NO' + PARTITION BY RANGE (`id`) +(PARTITION `pt1` VALUES LESS THAN (100) ENGINE = InnoDB ENCRYPTED = 'NO', + PARTITION `pt2` VALUES LESS THAN MAXVALUE ENGINE = InnoDB ENCRYPTED = 'DEFAULT') +ALTER TABLE `t4` PARTITION BY RANGE(id) ( +PARTITION pt1 VALUES LESS THAN (100), +PARTITION pt2 VALUES LESS THAN MAXVALUE +); +SHOW CREATE TABLE `t4`; +Table Create Table +t4 CREATE TABLE `t4` ( + `id` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `ENCRYPTED`='NO' + PARTITION BY RANGE (`id`) +(PARTITION `pt1` VALUES LESS THAN (100) ENGINE = InnoDB, + PARTITION `pt2` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) +ALTER TABLE `t4` PARTITION BY RANGE(id) ( +PARTITION pt1 VALUES LESS THAN (100) ENCRYPTED="YES" ENCRYPTION_KEY_ID=2, +PARTITION pt2 VALUES LESS THAN MAXVALUE ENCRYPTED="DEFAULT" +); +ERROR HY000: Can't create table `test`.`t4` (errno: 140 "Wrong create options") +DROP TABLE `t4`; +# subpartitioned tables +CREATE TABLE `t5` ( +`id` INT +) ENGINE=InnoDB ENCRYPTED="NO" PARTITION BY RANGE(id) +SUBPARTITION BY HASH(id) +SUBPARTITIONS 2 ( +PARTITION pt1 VALUES LESS THAN (100), +PARTITION pt2 VALUES LESS THAN MAXVALUE +); +SHOW CREATE TABLE `t5`; +Table Create Table +t5 CREATE TABLE `t5` ( + `id` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `ENCRYPTED`='NO' + PARTITION BY RANGE (`id`) +SUBPARTITION BY HASH (`id`) +SUBPARTITIONS 2 +(PARTITION `pt1` VALUES LESS THAN (100) ENGINE = InnoDB, + PARTITION `pt2` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) +DROP TABLE `t5`; +CREATE TABLE `t6` ( +`id` INT +) ENGINE=InnoDB PARTITION BY RANGE(id) +SUBPARTITION BY HASH(id) +SUBPARTITIONS 2 ( +PARTITION pt1 VALUES LESS THAN (100) ENCRYPTED="YES", +PARTITION pt2 VALUES LESS THAN MAXVALUE +); +ERROR HY000: Can't create table `test`.`t6` (errno: 140 "Wrong create options") +CREATE TABLE `t7` ( +id INT +) ENGINE=InnoDB PARTITION BY RANGE(id) +SUBPARTITION BY HASH(id) ( +PARTITION pt1 VALUES LESS THAN (100)( +SUBPARTITION spt1 ENCRYPTED="NO", +SUBPARTITION spt2 +), +PARTITION pt2 VALUES LESS THAN MAXVALUE ( +SUBPARTITION spt3, +SUBPARTITION spt4 +) +); +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 'ENCRYPTED="NO", +SUBPARTITION spt2 +), +PARTITION pt2 VALUES LESS THAN MAXVALUE ...' at line 6 +CREATE TABLE `t8` ( +id INT +) ENGINE=InnoDB ENCRYPTED="NO" PARTITION BY RANGE(id) +SUBPARTITION BY HASH(id) ( +PARTITION pt1 VALUES LESS THAN (100) ( +SUBPARTITION spt1, +SUBPARTITION spt2 +), +PARTITION pt2 VALUES LESS THAN MAXVALUE ( +SUBPARTITION spt3, +SUBPARTITION spt4 +) +); +SHOW CREATE TABLE `t8`; +Table Create Table +t8 CREATE TABLE `t8` ( + `id` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `ENCRYPTED`='NO' + PARTITION BY RANGE (`id`) +SUBPARTITION BY HASH (`id`) +(PARTITION `pt1` VALUES LESS THAN (100) + (SUBPARTITION `spt1` ENGINE = InnoDB, + SUBPARTITION `spt2` ENGINE = InnoDB), + PARTITION `pt2` VALUES LESS THAN MAXVALUE + (SUBPARTITION `spt3` ENGINE = InnoDB, + SUBPARTITION `spt4` ENGINE = InnoDB)) +DROP TABLE `t8`; +CREATE TABLE `t9` ( +id INT +) ENGINE=InnoDB PARTITION BY RANGE(id) +SUBPARTITION BY HASH(id) ( +PARTITION pt1 VALUES LESS THAN (100) ENCRYPTED="NO" ( +SUBPARTITION spt1, +SUBPARTITION spt2 +), +PARTITION pt2 VALUES LESS THAN MAXVALUE ( +SUBPARTITION spt3, +SUBPARTITION spt4 +) +); +SHOW CREATE TABLE `t9`; +Table Create Table +t9 CREATE TABLE `t9` ( + `id` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY RANGE (`id`) +SUBPARTITION BY HASH (`id`) +(PARTITION `pt1` VALUES LESS THAN (100) + (SUBPARTITION `spt1` ENGINE = InnoDB, + SUBPARTITION `spt2` ENGINE = InnoDB), + PARTITION `pt2` VALUES LESS THAN MAXVALUE + (SUBPARTITION `spt3` ENGINE = InnoDB, + SUBPARTITION `spt4` ENGINE = InnoDB)) +DROP TABLE `t9`; +CREATE TABLE `t10` ( +id INT +) ENGINE=InnoDB PARTITION BY RANGE(id) +SUBPARTITION BY HASH(id) ( +PARTITION pt1 VALUES LESS THAN (100) ENCRYPTED="YES" ( +SUBPARTITION spt1, +SUBPARTITION spt2 +), +PARTITION pt2 VALUES LESS THAN MAXVALUE ( +SUBPARTITION spt3, +SUBPARTITION spt4 +) +); +ERROR HY000: Can't create table `test`.`t10` (errno: 140 "Wrong create options") +CREATE TABLE `t11` ( +id INT +) ENGINE=InnoDB ENCRYPTED="YES" PARTITION BY RANGE(id) +SUBPARTITION BY HASH(id) ( +PARTITION pt1 VALUES LESS THAN (100) ENCRYPTED="NO" ( +SUBPARTITION spt1, +SUBPARTITION spt2 +), +PARTITION pt2 VALUES LESS THAN MAXVALUE ENCRYPTED="NO" ( +SUBPARTITION spt3, +SUBPARTITION spt4 +) +); +SHOW CREATE TABLE `t11`; +Table Create Table +t11 CREATE TABLE `t11` ( + `id` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `ENCRYPTED`='YES' + PARTITION BY RANGE (`id`) +SUBPARTITION BY HASH (`id`) +(PARTITION `pt1` VALUES LESS THAN (100) + (SUBPARTITION `spt1` ENGINE = InnoDB, + SUBPARTITION `spt2` ENGINE = InnoDB), + PARTITION `pt2` VALUES LESS THAN MAXVALUE + (SUBPARTITION `spt3` ENGINE = InnoDB, + SUBPARTITION `spt4` ENGINE = InnoDB)) +DROP TABLE `t11`; +# +# MDEV-27605 ALTER .. ADD PARTITION uses wrong partition-level option values +# +# restart: --innodb-sys-tablespaces +CREATE TABLE `t12` ( +id INT +) ENGINE=InnoDB PARTITION BY HASH(id) +( +pt1 PAGE_COMPRESSED=0 +); +SELECT name, flag FROM information_schema.innodb_sys_tablespaces WHERE name like 'test/t12%'; +name flag +test/t12#P#pt1 21 +ALTER TABLE `t12` ADD PARTITION ( +PARTITION pt2 PAGE_COMPRESSED=1 +); +SELECT name, flag FROM information_schema.innodb_sys_tablespaces WHERE name like 'test/t12%'; +name flag +test/t12#P#pt1 21 +test/t12#P#pt2 1610612789 +ALTER TABLE `t12` ADD PARTITION ( +PARTITION pt3 PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=3 +); +SELECT name, flag FROM information_schema.innodb_sys_tablespaces WHERE name like 'test/t12%'; +name flag +test/t12#P#pt1 21 +test/t12#P#pt2 1610612789 +test/t12#P#pt3 805306421 +DROP TABLE `t12`; +CREATE TABLE `t13` ( +`id` INT +) ENGINE=InnoDB PAGE_COMPRESSED=1 PARTITION BY RANGE(id) ( +PARTITION pt1 VALUES LESS THAN (100) PAGE_COMPRESSED=0, +PARTITION pt2 VALUES LESS THAN (200) PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=3, +PARTITION pt3 VALUES LESS THAN MAXVALUE +); +SHOW CREATE TABLE `t13`; +Table Create Table +t13 CREATE TABLE `t13` ( + `id` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `PAGE_COMPRESSED`=1 + PARTITION BY RANGE (`id`) +(PARTITION `pt1` VALUES LESS THAN (100) ENGINE = InnoDB PAGE_COMPRESSED = 0, + PARTITION `pt2` VALUES LESS THAN (200) ENGINE = InnoDB PAGE_COMPRESSED = 1 PAGE_COMPRESSION_LEVEL = 3, + PARTITION `pt3` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) +SELECT name, flag FROM information_schema.innodb_sys_tablespaces WHERE name like 'test/t13%'; +name flag +test/t13#P#pt1 21 +test/t13#P#pt2 805306421 +test/t13#P#pt3 1610612789 +ALTER TABLE `t13` PARTITION BY RANGE(id) ( +PARTITION pt1 VALUES LESS THAN (100) PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=3, +PARTITION pt2 VALUES LESS THAN (200), +PARTITION pt3 VALUES LESS THAN MAXVALUE PAGE_COMPRESSED=0 +); +SHOW CREATE TABLE `t13`; +Table Create Table +t13 CREATE TABLE `t13` ( + `id` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `PAGE_COMPRESSED`=1 + PARTITION BY RANGE (`id`) +(PARTITION `pt1` VALUES LESS THAN (100) ENGINE = InnoDB PAGE_COMPRESSED = 1 PAGE_COMPRESSION_LEVEL = 3, + PARTITION `pt2` VALUES LESS THAN (200) ENGINE = InnoDB, + PARTITION `pt3` VALUES LESS THAN MAXVALUE ENGINE = InnoDB PAGE_COMPRESSED = 0) +SELECT name, flag FROM information_schema.innodb_sys_tablespaces WHERE name like 'test/t13%'; +name flag +test/t13#P#pt1 805306421 +test/t13#P#pt2 1610612789 +test/t13#P#pt3 21 +DROP TABLE `t13`; diff --git a/mysql-test/suite/parts/r/longname.result b/mysql-test/suite/parts/r/longname.result index a54de1e295dfc..eb850d6f16c4d 100644 --- a/mysql-test/suite/parts/r/longname.result +++ b/mysql-test/suite/parts/r/longname.result @@ -45,7 +45,7 @@ SHOW CREATE TABLE mysqltest1.t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY HASH (`a`) (PARTITION `$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$` VALUES LESS THAN (10) diff --git a/mysql-test/suite/parts/r/part_ctype_tis620.result b/mysql-test/suite/parts/r/part_ctype_tis620.result new file mode 100644 index 0000000000000..48a8a95f40e78 --- /dev/null +++ b/mysql-test/suite/parts/r/part_ctype_tis620.result @@ -0,0 +1,47 @@ +# +# MDEV-27768 MDEV-25440: Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit +# +CREATE TABLE t1 ( +a CHAR +) COLLATE=tis620_thai_nopad_ci +PARTITION BY RANGE COLUMNS (a) +( +PARTITION p0 VALUES LESS THAN (''), +PARTITION p VALUES LESS THAN ('') +); +ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition +CREATE TABLE t1 ( +a CHAR +) COLLATE=tis620_thai_nopad_ci +PARTITION BY RANGE COLUMNS (a) +( +PARTITION p0 VALUES LESS THAN (''), +PARTITION p VALUES LESS THAN (' ') +); +ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition +CREATE TABLE t1 ( +a CHAR +) COLLATE=tis620_thai_nopad_ci +PARTITION BY RANGE COLUMNS (a) +( +PARTITION p0 VALUES LESS THAN (' '), +PARTITION p VALUES LESS THAN ('') +); +ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition +CREATE TABLE t1 +( +id INT NOT NULL, +data VARCHAR(2), +KEY data_id (data(1),id) +) COLLATE tis620_thai_nopad_ci ENGINE=MyISAM +PARTITION BY RANGE (id) +( +PARTITION p10 VALUES LESS THAN (10), +PARTITION p20 VALUES LESS THAN (20) +); +INSERT INTO t1 VALUES (4, 'ab'), (14, 'ab'), (19,''),(9,'') ; +SELECT id FROM t1 WHERE data='' ORDER BY id; +id +9 +19 +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result b/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result index 455ce2a3d2e24..c4e0a8e7d02fe 100644 --- a/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result +++ b/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result @@ -619,7 +619,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (abs(`col1`)) SUBPARTITIONS 5 @@ -2316,7 +2316,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (`col1` MOD 10) SUBPARTITIONS 5 @@ -3666,7 +3666,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (dayofmonth(`col1`)) SUBPARTITIONS 5 @@ -4183,7 +4183,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (dayofmonth(`col1`)) SUBPARTITIONS 5 @@ -4700,7 +4700,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (dayofweek(`col1`)) SUBPARTITIONS 5 @@ -5229,7 +5229,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (dayofyear(`col1`)) SUBPARTITIONS 5 @@ -5748,7 +5748,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (extract(month from `col1`)) SUBPARTITIONS 5 @@ -6267,7 +6267,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` time DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (hour(`col1`)) SUBPARTITIONS 5 @@ -6792,7 +6792,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` time(6) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (microsecond(`col1`)) SUBPARTITIONS 5 @@ -7313,7 +7313,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` time DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (minute(`col1`)) SUBPARTITIONS 5 @@ -7844,7 +7844,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` time DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (second(`col1`)) SUBPARTITIONS 5 @@ -8375,7 +8375,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (month(`col1`)) SUBPARTITIONS 5 @@ -8900,7 +8900,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (quarter(`col1`)) SUBPARTITIONS 5 @@ -9423,7 +9423,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (weekday(`col1`)) SUBPARTITIONS 5 @@ -9944,7 +9944,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (year(`col1`) - 1990) SUBPARTITIONS 5 @@ -10469,7 +10469,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (yearweek(`col1`,0) - 200600) SUBPARTITIONS 5 diff --git a/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result b/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result index 9697328ff25ab..b22457bc030a3 100644 --- a/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result +++ b/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result @@ -619,7 +619,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (abs(`col1`)) SUBPARTITIONS 5 @@ -2316,7 +2316,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (`col1` MOD 10) SUBPARTITIONS 5 @@ -3666,7 +3666,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (dayofmonth(`col1`)) SUBPARTITIONS 5 @@ -4183,7 +4183,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (dayofmonth(`col1`)) SUBPARTITIONS 5 @@ -4700,7 +4700,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (dayofweek(`col1`)) SUBPARTITIONS 5 @@ -5229,7 +5229,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (dayofyear(`col1`)) SUBPARTITIONS 5 @@ -5748,7 +5748,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (extract(month from `col1`)) SUBPARTITIONS 5 @@ -6267,7 +6267,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` time DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (hour(`col1`)) SUBPARTITIONS 5 @@ -6792,7 +6792,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` time(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (microsecond(`col1`)) SUBPARTITIONS 5 @@ -7313,7 +7313,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` time DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (minute(`col1`)) SUBPARTITIONS 5 @@ -7844,7 +7844,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` time DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (second(`col1`)) SUBPARTITIONS 5 @@ -8375,7 +8375,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (month(`col1`)) SUBPARTITIONS 5 @@ -8900,7 +8900,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (quarter(`col1`)) SUBPARTITIONS 5 @@ -9423,7 +9423,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (weekday(`col1`)) SUBPARTITIONS 5 @@ -9944,7 +9944,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (year(`col1`) - 1990) SUBPARTITIONS 5 @@ -10469,7 +10469,7 @@ Table Create Table t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`colint`) SUBPARTITION BY HASH (yearweek(`col1`,0) - 200600) SUBPARTITIONS 5 diff --git a/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result b/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result index 0e8db677cdfcd..c6ea707407a92 100644 --- a/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result @@ -74,7 +74,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -567,7 +567,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -1068,7 +1068,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -1574,7 +1574,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -2074,7 +2074,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -2578,7 +2578,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -3089,7 +3089,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -3598,7 +3598,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -4096,7 +4096,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -4589,7 +4589,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -5090,7 +5090,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -5596,7 +5596,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -6096,7 +6096,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -6600,7 +6600,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -7111,7 +7111,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -7620,7 +7620,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -8119,7 +8119,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -8628,7 +8628,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -9145,7 +9145,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -9667,7 +9667,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -10183,7 +10183,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -10703,7 +10703,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -11230,7 +11230,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -11755,7 +11755,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -12269,7 +12269,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -12778,7 +12778,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -13295,7 +13295,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -13817,7 +13817,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -14333,7 +14333,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -14853,7 +14853,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -15380,7 +15380,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -15905,7 +15905,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -16421,7 +16421,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -16915,7 +16915,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -17417,7 +17417,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -17924,7 +17924,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -18425,7 +18425,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -18930,7 +18930,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -19442,7 +19442,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -19952,7 +19952,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -20451,7 +20451,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -20945,7 +20945,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -21447,7 +21447,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -21954,7 +21954,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -22455,7 +22455,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -22960,7 +22960,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -23472,7 +23472,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -23982,7 +23982,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -24481,7 +24481,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -24975,7 +24975,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -25477,7 +25477,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -25984,7 +25984,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -26485,7 +26485,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -26990,7 +26990,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -27502,7 +27502,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -28012,7 +28012,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 diff --git a/mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result b/mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result index 0f12c15e4e9a7..e47487ac4a1e9 100644 --- a/mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result @@ -74,7 +74,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -592,7 +592,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -1124,7 +1124,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -1667,7 +1667,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -2200,7 +2200,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -2741,7 +2741,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -3289,7 +3289,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -3835,7 +3835,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -4372,7 +4372,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -4890,7 +4890,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -5422,7 +5422,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -5965,7 +5965,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -6498,7 +6498,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -7039,7 +7039,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -7587,7 +7587,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -8133,7 +8133,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 diff --git a/mysql-test/suite/parts/r/partition_alter1_1_innodb.result b/mysql-test/suite/parts/r/partition_alter1_1_innodb.result index 919e6344615fe..fcfa31782cf75 100644 --- a/mysql-test/suite/parts/r/partition_alter1_1_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter1_1_innodb.result @@ -392,7 +392,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -885,7 +885,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -1386,7 +1386,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -1892,7 +1892,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -2392,7 +2392,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -2898,7 +2898,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -3409,7 +3409,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -3918,7 +3918,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -4416,7 +4416,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -4909,7 +4909,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -5410,7 +5410,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -5916,7 +5916,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -6416,7 +6416,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -6922,7 +6922,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -7433,7 +7433,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -7942,7 +7942,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -8441,7 +8441,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -8950,7 +8950,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -9467,7 +9467,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -9989,7 +9989,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -10505,7 +10505,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -11027,7 +11027,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -11554,7 +11554,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -12079,7 +12079,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -12593,7 +12593,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -13102,7 +13102,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -13619,7 +13619,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -14141,7 +14141,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -14657,7 +14657,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -15179,7 +15179,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -15706,7 +15706,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -16231,7 +16231,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 diff --git a/mysql-test/suite/parts/r/partition_alter1_1_myisam.result b/mysql-test/suite/parts/r/partition_alter1_1_myisam.result index 0517639924694..837988bb8b12b 100644 --- a/mysql-test/suite/parts/r/partition_alter1_1_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter1_1_myisam.result @@ -233,7 +233,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -751,7 +751,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -1283,7 +1283,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -1826,7 +1826,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -2359,7 +2359,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -2902,7 +2902,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -3450,7 +3450,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -3996,7 +3996,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -4533,7 +4533,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -5051,7 +5051,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -5583,7 +5583,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -6126,7 +6126,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -6659,7 +6659,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -7202,7 +7202,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -7750,7 +7750,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -8296,7 +8296,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 diff --git a/mysql-test/suite/parts/r/partition_alter1_2_innodb.result b/mysql-test/suite/parts/r/partition_alter1_2_innodb.result index a71cae0ca17f4..9206bcd72d34e 100644 --- a/mysql-test/suite/parts/r/partition_alter1_2_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter1_2_innodb.result @@ -74,7 +74,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -515,7 +515,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -964,7 +964,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -1418,7 +1418,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -1866,7 +1866,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -2320,7 +2320,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -2779,7 +2779,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -3236,7 +3236,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -3682,7 +3682,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -4123,7 +4123,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -4572,7 +4572,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -5026,7 +5026,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -5474,7 +5474,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -5928,7 +5928,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -6387,7 +6387,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -6844,7 +6844,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -7290,7 +7290,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -7747,7 +7747,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -8212,7 +8212,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -8682,7 +8682,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -9146,7 +9146,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -9616,7 +9616,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -10091,7 +10091,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -10564,7 +10564,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -11030,7 +11030,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -11471,7 +11471,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -11920,7 +11920,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -12374,7 +12374,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -12822,7 +12822,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -13274,7 +13274,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -13733,7 +13733,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -14190,7 +14190,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -14636,7 +14636,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -15077,7 +15077,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -15526,7 +15526,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -15980,7 +15980,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -16428,7 +16428,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -16880,7 +16880,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -17339,7 +17339,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -17796,7 +17796,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -18243,7 +18243,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -18700,7 +18700,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -19165,7 +19165,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -19635,7 +19635,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -20099,7 +20099,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -20567,7 +20567,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -21042,7 +21042,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -21515,7 +21515,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -21977,7 +21977,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -22434,7 +22434,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -22899,7 +22899,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -23369,7 +23369,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -23833,7 +23833,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -24301,7 +24301,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -24776,7 +24776,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -25249,7 +25249,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -25712,7 +25712,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -26153,7 +26153,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -26602,7 +26602,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -27056,7 +27056,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -27504,7 +27504,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -27956,7 +27956,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -28415,7 +28415,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -28872,7 +28872,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -29318,7 +29318,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -29759,7 +29759,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -30208,7 +30208,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -30662,7 +30662,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -31110,7 +31110,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -31562,7 +31562,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -32021,7 +32021,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -32478,7 +32478,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -32924,7 +32924,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -33381,7 +33381,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -33846,7 +33846,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -34316,7 +34316,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -34780,7 +34780,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -35248,7 +35248,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -35723,7 +35723,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -36196,7 +36196,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 diff --git a/mysql-test/suite/parts/r/partition_alter1_2_myisam.result b/mysql-test/suite/parts/r/partition_alter1_2_myisam.result index ba6a7e7fbbd20..e690bc489133a 100644 --- a/mysql-test/suite/parts/r/partition_alter1_2_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter1_2_myisam.result @@ -71,7 +71,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -537,7 +537,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -1017,7 +1017,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -1508,7 +1508,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -1989,7 +1989,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -2480,7 +2480,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -2976,7 +2976,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -3470,7 +3470,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -3959,7 +3959,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -4425,7 +4425,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -4905,7 +4905,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -5396,7 +5396,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -5877,7 +5877,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -6366,7 +6366,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -6862,7 +6862,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -7356,7 +7356,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -7841,7 +7841,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -8307,7 +8307,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -8787,7 +8787,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -9278,7 +9278,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -9759,7 +9759,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -10248,7 +10248,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -10744,7 +10744,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -11238,7 +11238,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -11723,7 +11723,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -12189,7 +12189,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -12669,7 +12669,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -13160,7 +13160,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -13641,7 +13641,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -14130,7 +14130,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -14626,7 +14626,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -15120,7 +15120,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 diff --git a/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result b/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result index ff7d659613d8a..d48044c1b3d2a 100644 --- a/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result @@ -73,7 +73,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -530,7 +530,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -995,7 +995,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -1465,7 +1465,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -1929,7 +1929,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -2399,7 +2399,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -2874,7 +2874,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -3347,7 +3347,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -3811,7 +3811,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -4306,7 +4306,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -4809,7 +4809,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -5317,7 +5317,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -5819,7 +5819,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -6327,7 +6327,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -6840,7 +6840,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -7351,7 +7351,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -7851,7 +7851,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -8346,7 +8346,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -8849,7 +8849,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -9357,7 +9357,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -9859,7 +9859,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -10367,7 +10367,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -10880,7 +10880,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -11391,7 +11391,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -11892,7 +11892,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -12401,7 +12401,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -12918,7 +12918,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -13440,7 +13440,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -13956,7 +13956,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -14478,7 +14478,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -15005,7 +15005,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -15530,7 +15530,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -16044,7 +16044,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -16553,7 +16553,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -17070,7 +17070,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -17592,7 +17592,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -18108,7 +18108,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -18630,7 +18630,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -19157,7 +19157,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -19682,7 +19682,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 diff --git a/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result b/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result index a537b74201d82..a82e34a1016b2 100644 --- a/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result @@ -69,7 +69,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -526,7 +526,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -991,7 +991,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -1461,7 +1461,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -1925,7 +1925,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -2393,7 +2393,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -2868,7 +2868,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -3341,7 +3341,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -3805,7 +3805,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -4301,7 +4301,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -4805,7 +4805,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -5314,7 +5314,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -5817,7 +5817,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -6324,7 +6324,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -6838,7 +6838,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -7350,7 +7350,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -7851,7 +7851,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -8347,7 +8347,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -8851,7 +8851,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -9360,7 +9360,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -9863,7 +9863,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -10370,7 +10370,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -10884,7 +10884,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -11396,7 +11396,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -11898,7 +11898,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -12407,7 +12407,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -12924,7 +12924,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -13446,7 +13446,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -13962,7 +13962,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -14482,7 +14482,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -15009,7 +15009,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -15534,7 +15534,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -16048,7 +16048,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -16557,7 +16557,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -17074,7 +17074,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -17596,7 +17596,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -18112,7 +18112,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -18632,7 +18632,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -19159,7 +19159,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -19684,7 +19684,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 diff --git a/mysql-test/suite/parts/r/partition_alter2_1_maria.result b/mysql-test/suite/parts/r/partition_alter2_1_maria.result index 0af69f09639e7..6c42b207fc783 100644 --- a/mysql-test/suite/parts/r/partition_alter2_1_maria.result +++ b/mysql-test/suite/parts/r/partition_alter2_1_maria.result @@ -73,7 +73,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -539,7 +539,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -1019,7 +1019,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = Aria, PARTITION `part_2` VALUES IN (-2) ENGINE = Aria, @@ -1510,7 +1510,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = Aria, PARTITION `partb` VALUES LESS THAN (5) ENGINE = Aria, @@ -1991,7 +1991,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -2482,7 +2482,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -2978,7 +2978,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -3472,7 +3472,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -3959,7 +3959,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -4477,7 +4477,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -5009,7 +5009,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = Aria, PARTITION `part_2` VALUES IN (-2) ENGINE = Aria, @@ -5552,7 +5552,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = Aria, PARTITION `partb` VALUES LESS THAN (5) ENGINE = Aria, @@ -6085,7 +6085,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -6628,7 +6628,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -7176,7 +7176,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -7722,7 +7722,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -8259,7 +8259,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -8777,7 +8777,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -9309,7 +9309,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = Aria, PARTITION `part_2` VALUES IN (-2) ENGINE = Aria, @@ -9852,7 +9852,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = Aria, PARTITION `partb` VALUES LESS THAN (5) ENGINE = Aria, @@ -10385,7 +10385,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -10928,7 +10928,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -11476,7 +11476,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -12022,7 +12022,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -12563,7 +12563,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -13029,7 +13029,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -13509,7 +13509,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = Aria, PARTITION `part_2` VALUES IN (-2) ENGINE = Aria, @@ -14000,7 +14000,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = Aria, PARTITION `partb` VALUES LESS THAN (5) ENGINE = Aria, @@ -14481,7 +14481,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -14970,7 +14970,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -15466,7 +15466,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -15960,7 +15960,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -16447,7 +16447,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -16965,7 +16965,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -17497,7 +17497,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = Aria, PARTITION `part_2` VALUES IN (-2) ENGINE = Aria, @@ -18040,7 +18040,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = Aria, PARTITION `partb` VALUES LESS THAN (5) ENGINE = Aria, @@ -18573,7 +18573,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -19114,7 +19114,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -19662,7 +19662,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -20208,7 +20208,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -20745,7 +20745,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -21263,7 +21263,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -21795,7 +21795,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = Aria, PARTITION `part_2` VALUES IN (-2) ENGINE = Aria, @@ -22338,7 +22338,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = Aria, PARTITION `partb` VALUES LESS THAN (5) ENGINE = Aria, @@ -22871,7 +22871,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -23412,7 +23412,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -23960,7 +23960,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -24506,7 +24506,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 diff --git a/mysql-test/suite/parts/r/partition_alter2_1_myisam.result b/mysql-test/suite/parts/r/partition_alter2_1_myisam.result index 60cb5a2e73345..4dbcd54018ecb 100644 --- a/mysql-test/suite/parts/r/partition_alter2_1_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter2_1_myisam.result @@ -73,7 +73,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -539,7 +539,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -1019,7 +1019,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -1510,7 +1510,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -1991,7 +1991,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -2482,7 +2482,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -2978,7 +2978,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -3472,7 +3472,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -3959,7 +3959,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -4477,7 +4477,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -5009,7 +5009,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -5552,7 +5552,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -6085,7 +6085,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -6628,7 +6628,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -7176,7 +7176,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -7722,7 +7722,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -8259,7 +8259,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -8777,7 +8777,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -9309,7 +9309,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -9852,7 +9852,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -10385,7 +10385,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -10928,7 +10928,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -11476,7 +11476,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -12022,7 +12022,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -12563,7 +12563,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -13029,7 +13029,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -13509,7 +13509,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -14000,7 +14000,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -14481,7 +14481,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -14970,7 +14970,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -15466,7 +15466,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -15960,7 +15960,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -16447,7 +16447,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -16965,7 +16965,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -17497,7 +17497,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -18040,7 +18040,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -18573,7 +18573,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -19114,7 +19114,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -19662,7 +19662,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -20208,7 +20208,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -20745,7 +20745,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -21263,7 +21263,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -21795,7 +21795,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -22338,7 +22338,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -22871,7 +22871,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -23412,7 +23412,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -23960,7 +23960,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -24506,7 +24506,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 diff --git a/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result b/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result index d0d4e1602fd5a..e387906336551 100644 --- a/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result @@ -73,7 +73,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -532,7 +532,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -999,7 +999,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -1471,7 +1471,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -1935,7 +1935,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -2407,7 +2407,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -2882,7 +2882,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -3357,7 +3357,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -3822,7 +3822,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -4319,7 +4319,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -4824,7 +4824,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -5334,7 +5334,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -5836,7 +5836,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -6346,7 +6346,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -6859,7 +6859,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -7372,7 +7372,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -7874,7 +7874,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -8371,7 +8371,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -8876,7 +8876,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -9386,7 +9386,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -9888,7 +9888,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -10398,7 +10398,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -10911,7 +10911,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -11424,7 +11424,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -11927,7 +11927,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -12438,7 +12438,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -12957,7 +12957,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -13481,7 +13481,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -13997,7 +13997,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -14521,7 +14521,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -15048,7 +15048,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -15575,7 +15575,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -16091,7 +16091,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -16602,7 +16602,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -17121,7 +17121,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -17645,7 +17645,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -18161,7 +18161,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -18685,7 +18685,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -19212,7 +19212,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -19739,7 +19739,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 diff --git a/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result b/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result index 4332588fda777..c2038b0fca6b8 100644 --- a/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result @@ -68,7 +68,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -528,7 +528,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -996,7 +996,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -1469,7 +1469,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -1938,7 +1938,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -2411,7 +2411,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -2891,7 +2891,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -3367,7 +3367,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -3834,7 +3834,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -4333,7 +4333,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -4840,7 +4840,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -5352,7 +5352,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -5860,7 +5860,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -6372,7 +6372,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -6891,7 +6891,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -7406,7 +7406,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -7910,7 +7910,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -8409,7 +8409,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -8916,7 +8916,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -9428,7 +9428,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -9936,7 +9936,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -10448,7 +10448,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -10967,7 +10967,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -11482,7 +11482,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -11987,7 +11987,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -12499,7 +12499,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -13019,7 +13019,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -13544,7 +13544,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -14065,7 +14065,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -14590,7 +14590,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -15122,7 +15122,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -15650,7 +15650,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -16167,7 +16167,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -16679,7 +16679,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -17199,7 +17199,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -17724,7 +17724,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -18245,7 +18245,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -18770,7 +18770,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -19302,7 +19302,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -19830,7 +19830,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 diff --git a/mysql-test/suite/parts/r/partition_alter2_2_maria.result b/mysql-test/suite/parts/r/partition_alter2_2_maria.result index 9cc64b8239b77..fbea226893812 100644 --- a/mysql-test/suite/parts/r/partition_alter2_2_maria.result +++ b/mysql-test/suite/parts/r/partition_alter2_2_maria.result @@ -73,7 +73,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -541,7 +541,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -1023,7 +1023,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = Aria, PARTITION `part_2` VALUES IN (-2) ENGINE = Aria, @@ -1516,7 +1516,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = Aria, PARTITION `partb` VALUES LESS THAN (5) ENGINE = Aria, @@ -1997,7 +1997,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -2490,7 +2490,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -2986,7 +2986,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -3482,7 +3482,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -3971,7 +3971,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -4491,7 +4491,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -5025,7 +5025,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = Aria, PARTITION `part_2` VALUES IN (-2) ENGINE = Aria, @@ -5570,7 +5570,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = Aria, PARTITION `partb` VALUES LESS THAN (5) ENGINE = Aria, @@ -6103,7 +6103,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -6648,7 +6648,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -7196,7 +7196,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -7744,7 +7744,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -8283,7 +8283,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -8803,7 +8803,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -9337,7 +9337,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = Aria, PARTITION `part_2` VALUES IN (-2) ENGINE = Aria, @@ -9882,7 +9882,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = Aria, PARTITION `partb` VALUES LESS THAN (5) ENGINE = Aria, @@ -10415,7 +10415,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -10960,7 +10960,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -11508,7 +11508,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -12056,7 +12056,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -12598,7 +12598,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -13067,7 +13067,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -13550,7 +13550,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = Aria, PARTITION `part_2` VALUES IN (-2) ENGINE = Aria, @@ -14044,7 +14044,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = Aria, PARTITION `partb` VALUES LESS THAN (5) ENGINE = Aria, @@ -14530,7 +14530,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -15024,7 +15024,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -15525,7 +15525,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -16022,7 +16022,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -16512,7 +16512,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -17033,7 +17033,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -17568,7 +17568,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = Aria, PARTITION `part_2` VALUES IN (-2) ENGINE = Aria, @@ -18114,7 +18114,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = Aria, PARTITION `partb` VALUES LESS THAN (5) ENGINE = Aria, @@ -18652,7 +18652,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -19198,7 +19198,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -19751,7 +19751,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -20300,7 +20300,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -20840,7 +20840,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -21361,7 +21361,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -21896,7 +21896,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = Aria, PARTITION `part_2` VALUES IN (-2) ENGINE = Aria, @@ -22442,7 +22442,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = Aria, PARTITION `partb` VALUES LESS THAN (5) ENGINE = Aria, @@ -22980,7 +22980,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -23526,7 +23526,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -24079,7 +24079,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -24628,7 +24628,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 diff --git a/mysql-test/suite/parts/r/partition_alter2_2_myisam.result b/mysql-test/suite/parts/r/partition_alter2_2_myisam.result index 32a840c15770a..2649afbdf8477 100644 --- a/mysql-test/suite/parts/r/partition_alter2_2_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter2_2_myisam.result @@ -73,7 +73,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -541,7 +541,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -1023,7 +1023,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -1516,7 +1516,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -1997,7 +1997,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -2490,7 +2490,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -2986,7 +2986,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -3482,7 +3482,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -3971,7 +3971,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -4491,7 +4491,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -5025,7 +5025,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -5570,7 +5570,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -6103,7 +6103,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -6648,7 +6648,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -7196,7 +7196,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -7744,7 +7744,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -8283,7 +8283,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -8803,7 +8803,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -9337,7 +9337,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -9882,7 +9882,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -10415,7 +10415,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -10960,7 +10960,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -11508,7 +11508,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -12056,7 +12056,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -12598,7 +12598,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -13067,7 +13067,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -13550,7 +13550,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -14044,7 +14044,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -14530,7 +14530,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -15024,7 +15024,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -15525,7 +15525,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -16022,7 +16022,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -16512,7 +16512,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -17033,7 +17033,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -17568,7 +17568,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -18114,7 +18114,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -18652,7 +18652,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -19198,7 +19198,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -19751,7 +19751,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -20300,7 +20300,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int1`,`f_int2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -20840,7 +20840,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -21361,7 +21361,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -21896,7 +21896,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -22442,7 +22442,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -22980,7 +22980,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -23526,7 +23526,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -24079,7 +24079,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -24628,7 +24628,7 @@ t1 CREATE TABLE `t1` ( `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 diff --git a/mysql-test/suite/parts/r/partition_alter3_innodb.result b/mysql-test/suite/parts/r/partition_alter3_innodb.result index 66531c2b699a4..4d4fe8cd2d501 100644 --- a/mysql-test/suite/parts/r/partition_alter3_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter3_innodb.result @@ -57,7 +57,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci t1.frm t1.ibd EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; @@ -79,7 +79,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) t1#P#p0.ibd t1.frm @@ -98,7 +98,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (dayofyear(`f_date`)) t1#P#p0.ibd t1.frm @@ -115,7 +115,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) t1#P#p0.ibd t1.frm @@ -138,7 +138,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB, @@ -164,7 +164,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB, @@ -189,7 +189,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB, @@ -234,7 +234,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB, @@ -264,7 +264,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB, @@ -292,7 +292,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB, @@ -318,7 +318,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB, @@ -342,7 +342,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB, @@ -364,7 +364,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB) @@ -384,7 +384,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = InnoDB) t1#P#p0.ibd @@ -406,7 +406,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci t1.frm t1.ibd EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; @@ -447,7 +447,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci t1.frm t1.ibd EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; @@ -470,7 +470,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) t1#P#p0.ibd t1.frm @@ -496,7 +496,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB, @@ -522,7 +522,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB, @@ -550,7 +550,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB, @@ -593,7 +593,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB, @@ -626,7 +626,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB, @@ -657,7 +657,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB, @@ -686,7 +686,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB, @@ -713,7 +713,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB, @@ -738,7 +738,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = InnoDB, PARTITION `part1` ENGINE = InnoDB) @@ -761,7 +761,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = InnoDB) t1#P#p0.ibd @@ -786,7 +786,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci t1.frm t1.ibd EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; diff --git a/mysql-test/suite/parts/r/partition_alter3_myisam.result b/mysql-test/suite/parts/r/partition_alter3_myisam.result index 1a412bc27a434..fdb951e8144ee 100644 --- a/mysql-test/suite/parts/r/partition_alter3_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter3_myisam.result @@ -55,7 +55,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci t1.MYD t1.MYI t1.frm @@ -78,7 +78,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) t1#P#p0.MYD t1#P#p0.MYI @@ -98,7 +98,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (dayofyear(`f_date`)) t1#P#p0.MYD t1#P#p0.MYI @@ -116,7 +116,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) t1#P#p0.MYD t1#P#p0.MYI @@ -140,7 +140,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM, @@ -169,7 +169,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM, @@ -198,7 +198,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM, @@ -251,7 +251,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM, @@ -288,7 +288,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM, @@ -322,7 +322,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM, @@ -353,7 +353,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM, @@ -381,7 +381,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM, @@ -406,7 +406,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM) @@ -428,7 +428,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`f_date`)) (PARTITION `p0` ENGINE = MyISAM) t1#P#p0.MYD @@ -451,7 +451,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci t1.MYD t1.MYI t1.frm @@ -487,7 +487,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci t1.MYD t1.MYI t1.frm @@ -511,7 +511,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) t1#P#p0.MYD t1#P#p0.MYI @@ -538,7 +538,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM, @@ -567,7 +567,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM, @@ -599,7 +599,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM, @@ -650,7 +650,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM, @@ -690,7 +690,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM, @@ -727,7 +727,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM, @@ -761,7 +761,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM, @@ -792,7 +792,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM, @@ -820,7 +820,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = MyISAM, PARTITION `part1` ENGINE = MyISAM) @@ -845,7 +845,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p0` ENGINE = MyISAM) t1#P#p0.MYD @@ -871,7 +871,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci t1.MYD t1.MYI t1.frm diff --git a/mysql-test/suite/parts/r/partition_alter4_innodb.result b/mysql-test/suite/parts/r/partition_alter4_innodb.result index 6cfa4c137813e..aab121f2b2324 100644 --- a/mysql-test/suite/parts/r/partition_alter4_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter4_innodb.result @@ -75,7 +75,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -536,7 +536,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -1008,7 +1008,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -1481,7 +1481,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -1948,7 +1948,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -2421,7 +2421,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -2899,7 +2899,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -3375,7 +3375,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -3841,7 +3841,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -4302,7 +4302,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -4774,7 +4774,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -5247,7 +5247,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -5714,7 +5714,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -6187,7 +6187,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -6665,7 +6665,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -7141,7 +7141,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -7606,7 +7606,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -8066,7 +8066,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -8537,7 +8537,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -9009,7 +9009,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -9475,7 +9475,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -9947,7 +9947,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -10424,7 +10424,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -10899,7 +10899,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -11364,7 +11364,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -11824,7 +11824,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -12295,7 +12295,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -12767,7 +12767,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -13233,7 +13233,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -13705,7 +13705,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -14182,7 +14182,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -14657,7 +14657,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -15123,7 +15123,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -15584,7 +15584,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -16056,7 +16056,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -16529,7 +16529,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -16996,7 +16996,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -17469,7 +17469,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -17947,7 +17947,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -18423,7 +18423,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -18891,7 +18891,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -19351,7 +19351,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -19822,7 +19822,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -20294,7 +20294,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -20760,7 +20760,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -21232,7 +21232,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -21709,7 +21709,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -22184,7 +22184,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -22649,7 +22649,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -23109,7 +23109,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -23580,7 +23580,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -24052,7 +24052,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -24518,7 +24518,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -24990,7 +24990,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -25467,7 +25467,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -25942,7 +25942,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -26407,7 +26407,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -26867,7 +26867,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -27338,7 +27338,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -27810,7 +27810,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -28276,7 +28276,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -28748,7 +28748,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -29225,7 +29225,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -29700,7 +29700,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -30165,7 +30165,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -30625,7 +30625,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -31096,7 +31096,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -31568,7 +31568,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -32034,7 +32034,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -32506,7 +32506,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -32983,7 +32983,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -33458,7 +33458,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -33923,7 +33923,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -34383,7 +34383,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -34854,7 +34854,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -35326,7 +35326,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -35792,7 +35792,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -36264,7 +36264,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -36741,7 +36741,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -37216,7 +37216,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -37685,7 +37685,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -38146,7 +38146,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -38618,7 +38618,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -39091,7 +39091,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -39558,7 +39558,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -40031,7 +40031,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -40509,7 +40509,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -40985,7 +40985,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -41451,7 +41451,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -41912,7 +41912,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -42384,7 +42384,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -42857,7 +42857,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -43324,7 +43324,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -43797,7 +43797,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -44275,7 +44275,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -44751,7 +44751,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -45216,7 +45216,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -45676,7 +45676,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -46147,7 +46147,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -46619,7 +46619,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -47085,7 +47085,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -47557,7 +47557,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -48034,7 +48034,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -48509,7 +48509,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -48974,7 +48974,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -49434,7 +49434,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -49905,7 +49905,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -50377,7 +50377,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -50843,7 +50843,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -51315,7 +51315,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -51792,7 +51792,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -52267,7 +52267,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -52733,7 +52733,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -53194,7 +53194,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -53666,7 +53666,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -54139,7 +54139,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -54606,7 +54606,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -55079,7 +55079,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -55557,7 +55557,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -56033,7 +56033,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -56499,7 +56499,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -56957,7 +56957,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -57426,7 +57426,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -57896,7 +57896,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -58360,7 +58360,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -58830,7 +58830,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -59305,7 +59305,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -59778,7 +59778,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -60241,7 +60241,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -60699,7 +60699,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -61168,7 +61168,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -61638,7 +61638,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -62102,7 +62102,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -62572,7 +62572,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -63047,7 +63047,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -63520,7 +63520,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -64303,7 +64303,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -64761,7 +64761,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -65230,7 +65230,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -65700,7 +65700,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -66164,7 +66164,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -66634,7 +66634,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -67109,7 +67109,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -67582,7 +67582,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -68050,7 +68050,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -68510,7 +68510,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -68981,7 +68981,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -69453,7 +69453,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -69919,7 +69919,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -70391,7 +70391,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -70868,7 +70868,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -71343,7 +71343,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -71808,7 +71808,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -72268,7 +72268,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -72739,7 +72739,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -73211,7 +73211,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -73677,7 +73677,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -74149,7 +74149,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -74626,7 +74626,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -75101,7 +75101,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -75566,7 +75566,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -76026,7 +76026,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -76497,7 +76497,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -76969,7 +76969,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -77435,7 +77435,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -77907,7 +77907,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -78384,7 +78384,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -78859,7 +78859,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -79324,7 +79324,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -79784,7 +79784,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -80255,7 +80255,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -80727,7 +80727,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -81193,7 +81193,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -81665,7 +81665,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -82142,7 +82142,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -82617,7 +82617,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -83082,7 +83082,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB) @@ -83542,7 +83542,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = InnoDB, PARTITION `part_2` ENGINE = InnoDB, @@ -84013,7 +84013,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -84485,7 +84485,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -84951,7 +84951,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -85423,7 +85423,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -85900,7 +85900,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -86375,7 +86375,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -86841,7 +86841,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -87296,7 +87296,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -87759,7 +87759,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -88220,7 +88220,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -88679,7 +88679,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -89142,7 +89142,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -89605,7 +89605,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -90064,7 +90064,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # check prerequisites-1 success: 1 # check COUNT(*) success: 1 diff --git a/mysql-test/suite/parts/r/partition_alter4_myisam.result b/mysql-test/suite/parts/r/partition_alter4_myisam.result index a3921ea0977d9..c863d479fbb55 100644 --- a/mysql-test/suite/parts/r/partition_alter4_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter4_myisam.result @@ -75,7 +75,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -545,7 +545,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -1032,7 +1032,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -1526,7 +1526,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -2010,7 +2010,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -2504,7 +2504,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -3003,7 +3003,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -3500,7 +3500,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -3989,7 +3989,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -4459,7 +4459,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -4946,7 +4946,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -5440,7 +5440,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -5924,7 +5924,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -6418,7 +6418,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -6917,7 +6917,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -7414,7 +7414,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -7902,7 +7902,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -8371,7 +8371,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -8857,7 +8857,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -9350,7 +9350,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -9833,7 +9833,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -10326,7 +10326,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -10824,7 +10824,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -11320,7 +11320,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -11808,7 +11808,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -12277,7 +12277,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -12763,7 +12763,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -13256,7 +13256,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -13739,7 +13739,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -14232,7 +14232,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -14730,7 +14730,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -15226,7 +15226,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -15715,7 +15715,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -16185,7 +16185,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -16672,7 +16672,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -17166,7 +17166,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -17650,7 +17650,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -18144,7 +18144,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -18643,7 +18643,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -19140,7 +19140,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -19631,7 +19631,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -20100,7 +20100,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -20586,7 +20586,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -21079,7 +21079,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -21562,7 +21562,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -22055,7 +22055,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -22553,7 +22553,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -23049,7 +23049,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -23537,7 +23537,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -24006,7 +24006,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -24492,7 +24492,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -24985,7 +24985,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -25468,7 +25468,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -25961,7 +25961,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -26459,7 +26459,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -26955,7 +26955,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -27443,7 +27443,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -27912,7 +27912,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -28398,7 +28398,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -28891,7 +28891,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -29374,7 +29374,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -29867,7 +29867,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -30365,7 +30365,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -30861,7 +30861,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -31349,7 +31349,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -31818,7 +31818,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -32304,7 +32304,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -32797,7 +32797,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -33280,7 +33280,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -33773,7 +33773,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -34271,7 +34271,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -34767,7 +34767,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -35255,7 +35255,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -35724,7 +35724,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -36210,7 +36210,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -36703,7 +36703,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -37186,7 +37186,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -37679,7 +37679,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -38177,7 +38177,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -38673,7 +38673,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -39164,7 +39164,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -39633,7 +39633,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -40119,7 +40119,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -40612,7 +40612,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -41095,7 +41095,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -41588,7 +41588,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -42086,7 +42086,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -42582,7 +42582,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -43070,7 +43070,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -43539,7 +43539,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -44025,7 +44025,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -44518,7 +44518,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -45001,7 +45001,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -45494,7 +45494,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -45992,7 +45992,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -46488,7 +46488,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -46976,7 +46976,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -47445,7 +47445,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -47931,7 +47931,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -48424,7 +48424,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -48907,7 +48907,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -49400,7 +49400,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -49898,7 +49898,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -50394,7 +50394,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -50882,7 +50882,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -51351,7 +51351,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -51837,7 +51837,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -52330,7 +52330,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -52813,7 +52813,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -53306,7 +53306,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -53804,7 +53804,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -54300,7 +54300,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -54788,7 +54788,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -55257,7 +55257,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -55743,7 +55743,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -56236,7 +56236,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -56719,7 +56719,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -57212,7 +57212,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -57710,7 +57710,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -58206,7 +58206,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -58695,7 +58695,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -59162,7 +59162,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -59646,7 +59646,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -60137,7 +60137,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -60618,7 +60618,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -61109,7 +61109,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -61605,7 +61605,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -62099,7 +62099,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -62585,7 +62585,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -63052,7 +63052,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -63536,7 +63536,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -64027,7 +64027,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -64508,7 +64508,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -64999,7 +64999,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -65495,7 +65495,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -65989,7 +65989,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -66795,7 +66795,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -67262,7 +67262,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -67746,7 +67746,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -68237,7 +68237,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -68718,7 +68718,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -69209,7 +69209,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -69705,7 +69705,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -70199,7 +70199,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -70690,7 +70690,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -71159,7 +71159,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -71645,7 +71645,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -72138,7 +72138,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -72621,7 +72621,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -73114,7 +73114,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -73612,7 +73612,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -74108,7 +74108,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -74596,7 +74596,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -75065,7 +75065,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -75551,7 +75551,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -76044,7 +76044,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -76527,7 +76527,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -77020,7 +77020,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -77518,7 +77518,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -78014,7 +78014,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -78502,7 +78502,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -78971,7 +78971,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -79457,7 +79457,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -79950,7 +79950,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -80433,7 +80433,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -80926,7 +80926,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -81424,7 +81424,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -81920,7 +81920,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -82408,7 +82408,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -82877,7 +82877,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -83363,7 +83363,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -83856,7 +83856,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -84339,7 +84339,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -84832,7 +84832,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -85330,7 +85330,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -85826,7 +85826,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -86314,7 +86314,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM) @@ -86783,7 +86783,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `part_1` ENGINE = MyISAM, PARTITION `part_2` ENGINE = MyISAM, @@ -87269,7 +87269,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -87762,7 +87762,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `part_1` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -88245,7 +88245,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -88738,7 +88738,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part_1` VALUES LESS THAN (0) @@ -89236,7 +89236,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part_1` VALUES IN (0) @@ -89732,7 +89732,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -90221,7 +90221,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci unified filelist t1.MYD @@ -90682,7 +90682,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci unified filelist t1.MYD @@ -91151,7 +91151,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci unified filelist t1.MYD @@ -91618,7 +91618,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci unified filelist t1.MYD @@ -92083,7 +92083,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci unified filelist t1.MYD @@ -92552,7 +92552,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci unified filelist t1.MYD @@ -93021,7 +93021,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci unified filelist t1.MYD @@ -93486,7 +93486,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci unified filelist t1.MYD diff --git a/mysql-test/suite/parts/r/partition_alter_innodb.result b/mysql-test/suite/parts/r/partition_alter_innodb.result index f3921a1db2693..f040f266ce0fa 100644 --- a/mysql-test/suite/parts/r/partition_alter_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter_innodb.result @@ -16,7 +16,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, `d` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE COLUMNS(`d`) (PARTITION `p1` VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB) ALTER TABLE t1 REORGANIZE PARTITION p1 INTO @@ -32,7 +32,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, `d` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`id`) (PARTITION `p1` VALUES IN (1,2,3) ENGINE = InnoDB) ALTER TABLE t1 REORGANIZE PARTITION p1 INTO @@ -42,9 +42,37 @@ PARTITION p3 VALUES IN (4,5,6) ); ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition DROP TABLE t1; +# +# MDEV-15456 Server crashes upon adding or dropping a partition in ALTER under LOCK TABLE after ER_SAME_NAME_PARTITION +# create table t1 (i int) engine=InnoDB partition by range(i) (partition p0 values less than (10)); lock table t1 write; alter table t1 add partition (partition p0 values less than (20)); ERROR HY000: Duplicate partition name p0 alter table t1 add partition (partition p1 values less than (20)) /* comment */; drop table t1; +# +# MDEV-27065 Partitioning tables with custom data directories moves data back to default directory +# +ALTER TABLE t1 PARTITION BY RANGE(id)( +PARTITION p0 VALUES LESS THAN (1000), +PARTITION p1 VALUES LESS THAN MAXVALUE +); +Warnings: +Warning 1618 table option of old schema is ignored +DROP TABLE t1; +# +# MDEV-26127 Assertion `err != DB_DUPLICATE_KEY' failed or InnoDB: Failing assertion: id != 0 on ALTER ... REBUILD PARTITION +# +CREATE TABLE t1 (c INT) ENGINE=InnoDB PARTITION BY KEY(c) PARTITIONS 4;; +LOCK TABLES t1 WRITE, t1 AS a READ; +ALTER TABLE t1 REBUILD PARTITION p0; +DROP TABLE t1; +# +# MDEV-28079 Shutdown hangs after altering innodb partition fts table +# +CREATE TABLE t1(f1 INT, f2 CHAR(100))ENGINE=InnoDB PARTITION BY HASH(f1) PARTITIONS 2; +ALTER TABLE t1 ADD FULLTEXT(f2); +InnoDB 0 transactions not purged +DROP TABLE t1; +# End of 10.6 tests diff --git a/mysql-test/suite/parts/r/partition_alter_instant.result b/mysql-test/suite/parts/r/partition_alter_instant.result index e5ef57db992bb..5d904314fcbe5 100644 --- a/mysql-test/suite/parts/r/partition_alter_instant.result +++ b/mysql-test/suite/parts/r/partition_alter_instant.result @@ -13,7 +13,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `id` int(11) NOT NULL, `name` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT PARTITION BY RANGE (`id`) (PARTITION `p0` VALUES LESS THAN (50) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -24,7 +24,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `id` int(11) NOT NULL, `name` varchar(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT SET ALTER_ALGORITHM=INSTANT; ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255); ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE diff --git a/mysql-test/suite/parts/r/partition_alter_maria.result b/mysql-test/suite/parts/r/partition_alter_maria.result index 77f511d9b3bfc..5a34ec6b3083f 100644 --- a/mysql-test/suite/parts/r/partition_alter_maria.result +++ b/mysql-test/suite/parts/r/partition_alter_maria.result @@ -21,7 +21,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 TRANSACTIONAL=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci TRANSACTIONAL=1 PARTITION BY HASH (`a`) PARTITIONS 2 drop table t1; @@ -43,7 +43,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, `d` date DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE COLUMNS(`d`) (PARTITION `p1` VALUES LESS THAN (MAXVALUE) ENGINE = Aria) ALTER TABLE t1 REORGANIZE PARTITION p1 INTO @@ -59,7 +59,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, `d` date DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`id`) (PARTITION `p1` VALUES IN (1,2,3) ENGINE = Aria) ALTER TABLE t1 REORGANIZE PARTITION p1 INTO @@ -69,9 +69,36 @@ PARTITION p3 VALUES IN (4,5,6) ); ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition DROP TABLE t1; +# +# MDEV-15456 Server crashes upon adding or dropping a partition in ALTER under LOCK TABLE after ER_SAME_NAME_PARTITION +# create table t1 (i int) engine=Aria partition by range(i) (partition p0 values less than (10)); lock table t1 write; alter table t1 add partition (partition p0 values less than (20)); ERROR HY000: Duplicate partition name p0 alter table t1 add partition (partition p1 values less than (20)) /* comment */; drop table t1; +# +# MDEV-27065 Partitioning tables with custom data directories moves data back to default directory +# +ALTER TABLE t1 PARTITION BY RANGE(id)( +PARTITION p0 VALUES LESS THAN (1000), +PARTITION p1 VALUES LESS THAN MAXVALUE +); +Warnings: +Warning 1618 table option of old schema is ignored +DROP TABLE t1; +ALTER TABLE t2 PARTITION BY RANGE(id)( +PARTITION p0 VALUES LESS THAN (1000), +PARTITION p1 VALUES LESS THAN MAXVALUE +); +Warnings: +Warning 1618 table option of old schema is ignored +DROP TABLE t2; +# +# MDEV-26127 Assertion `err != DB_DUPLICATE_KEY' failed or InnoDB: Failing assertion: id != 0 on ALTER ... REBUILD PARTITION +# +CREATE TABLE t1 (c INT) ENGINE=Aria PARTITION BY KEY(c) PARTITIONS 4;; +LOCK TABLES t1 WRITE, t1 AS a READ; +ALTER TABLE t1 REBUILD PARTITION p0; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_alter_myisam.result b/mysql-test/suite/parts/r/partition_alter_myisam.result index ce3e04d6c97eb..ec6cbe92b0abe 100644 --- a/mysql-test/suite/parts/r/partition_alter_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter_myisam.result @@ -16,7 +16,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, `d` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE COLUMNS(`d`) (PARTITION `p1` VALUES LESS THAN (MAXVALUE) ENGINE = MyISAM) ALTER TABLE t1 REORGANIZE PARTITION p1 INTO @@ -32,7 +32,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, `d` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`id`) (PARTITION `p1` VALUES IN (1,2,3) ENGINE = MyISAM) ALTER TABLE t1 REORGANIZE PARTITION p1 INTO @@ -42,12 +42,39 @@ PARTITION p3 VALUES IN (4,5,6) ); ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition DROP TABLE t1; +# +# MDEV-15456 Server crashes upon adding or dropping a partition in ALTER under LOCK TABLE after ER_SAME_NAME_PARTITION +# create table t1 (i int) engine=MyISAM partition by range(i) (partition p0 values less than (10)); lock table t1 write; alter table t1 add partition (partition p0 values less than (20)); ERROR HY000: Duplicate partition name p0 alter table t1 add partition (partition p1 values less than (20)) /* comment */; drop table t1; +# +# MDEV-27065 Partitioning tables with custom data directories moves data back to default directory +# +ALTER TABLE t1 PARTITION BY RANGE(id)( +PARTITION p0 VALUES LESS THAN (1000), +PARTITION p1 VALUES LESS THAN MAXVALUE +); +Warnings: +Warning 1618 table option of old schema is ignored +DROP TABLE t1; +ALTER TABLE t2 PARTITION BY RANGE(id)( +PARTITION p0 VALUES LESS THAN (1000), +PARTITION p1 VALUES LESS THAN MAXVALUE +); +Warnings: +Warning 1618 table option of old schema is ignored +DROP TABLE t2; +# +# MDEV-26127 Assertion `err != DB_DUPLICATE_KEY' failed or InnoDB: Failing assertion: id != 0 on ALTER ... REBUILD PARTITION +# +CREATE TABLE t1 (c INT) ENGINE=MyISAM PARTITION BY KEY(c) PARTITIONS 4;; +LOCK TABLES t1 WRITE, t1 AS a READ; +ALTER TABLE t1 REBUILD PARTITION p0; +DROP TABLE t1; create table t1 ( c1 int, c2 int, c3 varchar(100)) delay_key_write=1 partition by key(c1) ( partition p01 data directory = 'MYSQL_TMP_DIR' diff --git a/mysql-test/suite/parts/r/partition_auto_increment_archive.result b/mysql-test/suite/parts/r/partition_auto_increment_archive.result index b600b45e8ef18..0da8b81a189b2 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_archive.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_archive.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; AUTO_INCREMENT @@ -60,14 +60,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FLUSH TABLE; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (4); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -75,7 +75,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (NULL); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -83,14 +83,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 ORDER BY c1; c1 4 @@ -102,7 +102,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 ORDER BY c1; c1 4 @@ -119,7 +119,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # Simple test with NULL CREATE TABLE t1 ( @@ -134,7 +134,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1; @@ -340,7 +340,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -364,7 +364,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=28 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=28 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -393,7 +393,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 DROP TABLE t1; @@ -645,7 +645,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (4); @@ -655,7 +655,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); @@ -664,7 +664,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -673,7 +673,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -688,7 +688,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); @@ -698,7 +698,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -707,7 +707,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -728,7 +728,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -737,7 +737,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1; @@ -749,7 +749,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -758,7 +758,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SET INSERT_ID = 22; @@ -783,7 +783,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 FLUSH TABLE; @@ -792,7 +792,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 VALUES (4); @@ -802,7 +802,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 VALUES (NULL); @@ -812,7 +812,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=ARCHIVE AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +) ENGINE=ARCHIVE AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; diff --git a/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result b/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result index 0276385dc2969..8c82541b98801 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; AUTO_INCREMENT @@ -63,14 +63,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FLUSH TABLE; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (4); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -78,7 +78,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (NULL); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -86,7 +86,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DELETE FROM t1; INSERT INTO t1 VALUES (NULL); SHOW CREATE TABLE t1; @@ -94,7 +94,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 ORDER BY c1; c1 TRUNCATE TABLE t1; @@ -104,7 +104,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 ORDER BY c1; c1 INSERT INTO t1 VALUES (100); @@ -118,7 +118,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a INT NULL AUTO_INCREMENT, @@ -165,7 +165,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1; @@ -323,7 +323,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -335,7 +335,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -351,7 +351,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 DROP TABLE t1; @@ -533,7 +533,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (4); @@ -542,7 +542,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); @@ -551,7 +551,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -560,7 +560,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -573,7 +573,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); @@ -582,7 +582,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -591,7 +591,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -608,7 +608,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -617,7 +617,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1; @@ -628,7 +628,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -637,7 +637,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SET INSERT_ID = 22; @@ -660,7 +660,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 FLUSH TABLE; @@ -669,7 +669,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 VALUES (4); @@ -679,7 +679,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 VALUES (NULL); @@ -689,9 +689,44 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 +) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 DROP TABLE t1; +# +# MDEV-19622 Assertion failures in +# ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table +# +CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE='Blackhole' PARTITION BY HASH(a); +INSERT INTO t1 VALUES (1,1),(2,2); +UPDATE t1 SET pk = 0; +DROP TABLE t1; +# +# MDEV-29636 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' +# failed in ha_partition::set_auto_increment_if_higher upon REPLACE +# with partition pruning +# +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='Blackhole' +PARTITION BY RANGE (a) ( +PARTITION p0 VALUES LESS THAN (10), +PARTITION pn VALUES LESS THAN MAXVALUE +); +REPLACE INTO t1 PARTITION (p0) SELECT 1; +DROP TABLE t1; +# +# MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' +# ha_partition::set_auto_increment_if_higher +# +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='Blackhole' PARTITION BY HASH (a) PARTITIONS 3; +REPLACE INTO t1 PARTITION (p0) VALUES (3); +DROP TABLE t1; +# +# MDEV-21310 AUTO_INCREMENT column throws range error on INSERT in partitioned table | +# Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed. +# +CREATE TABLE t1 (c INT AUTO_INCREMENT KEY) ENGINE='Blackhole' PARTITION BY LIST (c) (PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +ALTER TABLE t1 TRUNCATE PARTITION p1; +INSERT INTO t1 PARTITION (p1) (c) SELECT 1; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result index 7b25d4858fff4..ab237b595b50b 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; AUTO_INCREMENT @@ -76,14 +76,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FLUSH TABLE; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (4); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -91,7 +91,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (NULL); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -99,7 +99,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DELETE FROM t1; INSERT INTO t1 VALUES (NULL); SHOW CREATE TABLE t1; @@ -107,7 +107,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 ORDER BY c1; c1 6 @@ -118,7 +118,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 ORDER BY c1; c1 1 @@ -134,7 +134,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a INT NULL AUTO_INCREMENT, @@ -185,7 +185,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1; @@ -409,7 +409,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -422,7 +422,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -440,7 +440,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 DROP TABLE t1; @@ -715,7 +715,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (4); @@ -724,7 +724,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); @@ -733,7 +733,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -742,7 +742,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -758,7 +758,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); @@ -767,7 +767,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -776,7 +776,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -799,7 +799,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -808,7 +808,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1; @@ -820,7 +820,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -829,7 +829,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SET INSERT_ID = 22; @@ -853,7 +853,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 FLUSH TABLE; @@ -862,7 +862,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 VALUES (4); @@ -872,7 +872,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 VALUES (NULL); @@ -882,7 +882,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -1116,12 +1116,39 @@ SELECT * FROM t1; a 0 DROP TABLE t1; +############################################################################## # # MDEV-19622 Assertion failures in # ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table # -CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a); +CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE='InnoDB' PARTITION BY HASH(a); INSERT INTO t1 VALUES (1,1),(2,2); UPDATE t1 SET pk = 0; DROP TABLE t1; -############################################################################## +# +# MDEV-29636 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' +# failed in ha_partition::set_auto_increment_if_higher upon REPLACE +# with partition pruning +# +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='InnoDB' +PARTITION BY RANGE (a) ( +PARTITION p0 VALUES LESS THAN (10), +PARTITION pn VALUES LESS THAN MAXVALUE +); +REPLACE INTO t1 PARTITION (p0) SELECT 1; +DROP TABLE t1; +# +# MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' +# ha_partition::set_auto_increment_if_higher +# +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='InnoDB' PARTITION BY HASH (a) PARTITIONS 3; +REPLACE INTO t1 PARTITION (p0) VALUES (3); +DROP TABLE t1; +# +# MDEV-21310 AUTO_INCREMENT column throws range error on INSERT in partitioned table | +# Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed. +# +CREATE TABLE t1 (c INT AUTO_INCREMENT KEY) ENGINE='InnoDB' PARTITION BY LIST (c) (PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +ALTER TABLE t1 TRUNCATE PARTITION p1; +INSERT INTO t1 PARTITION (p1) (c) SELECT 1; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_auto_increment_maria.result b/mysql-test/suite/parts/r/partition_auto_increment_maria.result index 5a3902475a9f9..3767a278503de 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_maria.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_maria.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; AUTO_INCREMENT @@ -77,14 +77,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 FLUSH TABLE; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 INSERT INTO t1 VALUES (4); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -92,7 +92,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 INSERT INTO t1 VALUES (NULL); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -100,7 +100,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 DELETE FROM t1; INSERT INTO t1 VALUES (NULL); SHOW CREATE TABLE t1; @@ -108,7 +108,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 SELECT * FROM t1 ORDER BY c1; c1 6 @@ -119,7 +119,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 SELECT * FROM t1 ORDER BY c1; c1 1 @@ -134,7 +134,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 DROP TABLE t1; CREATE TABLE t1 (a INT NULL AUTO_INCREMENT, @@ -185,7 +185,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=Aria AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1; @@ -409,7 +409,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 +) ENGINE=Aria AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -422,7 +422,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=28 DEFAULT CHARSET=latin1 +) ENGINE=Aria AUTO_INCREMENT=28 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -439,7 +439,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 +) ENGINE=Aria AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 DROP TABLE t1; @@ -746,7 +746,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 +) ENGINE=Aria AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (4); @@ -755,7 +755,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 +) ENGINE=Aria AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); @@ -764,7 +764,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 +) ENGINE=Aria AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -773,7 +773,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 +) ENGINE=Aria AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -789,7 +789,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 +) ENGINE=Aria AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); @@ -798,7 +798,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 +) ENGINE=Aria AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -807,7 +807,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 +) ENGINE=Aria AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -830,7 +830,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -839,7 +839,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=Aria AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1; @@ -851,7 +851,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=Aria AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -860,7 +860,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 +) ENGINE=Aria AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SET INSERT_ID = 22; @@ -885,7 +885,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 FLUSH TABLE; @@ -894,7 +894,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 VALUES (4); @@ -904,7 +904,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=Aria AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 VALUES (NULL); @@ -914,7 +914,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=Aria AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +) ENGINE=Aria AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -1148,12 +1148,39 @@ SELECT * FROM t1; a 0 DROP TABLE t1; +############################################################################## # # MDEV-19622 Assertion failures in # ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table # -CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a); +CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE='Aria' PARTITION BY HASH(a); INSERT INTO t1 VALUES (1,1),(2,2); UPDATE t1 SET pk = 0; DROP TABLE t1; -############################################################################## +# +# MDEV-29636 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' +# failed in ha_partition::set_auto_increment_if_higher upon REPLACE +# with partition pruning +# +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='Aria' +PARTITION BY RANGE (a) ( +PARTITION p0 VALUES LESS THAN (10), +PARTITION pn VALUES LESS THAN MAXVALUE +); +REPLACE INTO t1 PARTITION (p0) SELECT 1; +DROP TABLE t1; +# +# MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' +# ha_partition::set_auto_increment_if_higher +# +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='Aria' PARTITION BY HASH (a) PARTITIONS 3; +REPLACE INTO t1 PARTITION (p0) VALUES (3); +DROP TABLE t1; +# +# MDEV-21310 AUTO_INCREMENT column throws range error on INSERT in partitioned table | +# Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed. +# +CREATE TABLE t1 (c INT AUTO_INCREMENT KEY) ENGINE='Aria' PARTITION BY LIST (c) (PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +ALTER TABLE t1 TRUNCATE PARTITION p1; +INSERT INTO t1 PARTITION (p1) (c) SELECT 1; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_auto_increment_memory.result b/mysql-test/suite/parts/r/partition_auto_increment_memory.result index c395f8ed0c98a..936e3e9e1cb63 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_memory.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_memory.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; AUTO_INCREMENT @@ -77,14 +77,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FLUSH TABLE; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (4); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -92,7 +92,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (NULL); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -100,7 +100,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DELETE FROM t1; INSERT INTO t1 VALUES (NULL); SHOW CREATE TABLE t1; @@ -108,7 +108,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 ORDER BY c1; c1 6 @@ -119,7 +119,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 ORDER BY c1; c1 1 @@ -134,7 +134,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a INT NULL AUTO_INCREMENT, @@ -185,7 +185,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1; @@ -409,7 +409,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -422,7 +422,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -439,7 +439,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 DROP TABLE t1; @@ -727,7 +727,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (4); @@ -736,7 +736,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); @@ -745,7 +745,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -754,7 +754,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -770,7 +770,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); @@ -779,7 +779,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -788,7 +788,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -811,7 +811,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -820,7 +820,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1; @@ -832,7 +832,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -841,7 +841,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SET INSERT_ID = 22; @@ -866,7 +866,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 FLUSH TABLE; @@ -875,7 +875,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 VALUES (4); @@ -885,7 +885,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 VALUES (NULL); @@ -895,7 +895,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MEMORY AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -1129,12 +1129,39 @@ SELECT * FROM t1; a 0 DROP TABLE t1; +############################################################################## # # MDEV-19622 Assertion failures in # ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table # -CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a); +CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE='Memory' PARTITION BY HASH(a); INSERT INTO t1 VALUES (1,1),(2,2); UPDATE t1 SET pk = 0; DROP TABLE t1; -############################################################################## +# +# MDEV-29636 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' +# failed in ha_partition::set_auto_increment_if_higher upon REPLACE +# with partition pruning +# +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='Memory' +PARTITION BY RANGE (a) ( +PARTITION p0 VALUES LESS THAN (10), +PARTITION pn VALUES LESS THAN MAXVALUE +); +REPLACE INTO t1 PARTITION (p0) SELECT 1; +DROP TABLE t1; +# +# MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' +# ha_partition::set_auto_increment_if_higher +# +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='Memory' PARTITION BY HASH (a) PARTITIONS 3; +REPLACE INTO t1 PARTITION (p0) VALUES (3); +DROP TABLE t1; +# +# MDEV-21310 AUTO_INCREMENT column throws range error on INSERT in partitioned table | +# Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed. +# +CREATE TABLE t1 (c INT AUTO_INCREMENT KEY) ENGINE='Memory' PARTITION BY LIST (c) (PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +ALTER TABLE t1 TRUNCATE PARTITION p1; +INSERT INTO t1 PARTITION (p1) (c) SELECT 1; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result index 792423096b511..475533ceb76e0 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; AUTO_INCREMENT @@ -77,14 +77,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FLUSH TABLE; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (4); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -92,7 +92,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (NULL); FLUSH TABLE; SHOW CREATE TABLE t1; @@ -100,7 +100,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DELETE FROM t1; INSERT INTO t1 VALUES (NULL); SHOW CREATE TABLE t1; @@ -108,7 +108,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 ORDER BY c1; c1 6 @@ -119,7 +119,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 ORDER BY c1; c1 1 @@ -134,7 +134,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a INT NULL AUTO_INCREMENT, @@ -185,7 +185,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1; @@ -409,7 +409,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -422,7 +422,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -439,7 +439,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 DROP TABLE t1; @@ -746,7 +746,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (4); @@ -755,7 +755,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); @@ -764,7 +764,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -773,7 +773,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -789,7 +789,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (0); @@ -798,7 +798,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -807,7 +807,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -830,7 +830,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -839,7 +839,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1; @@ -851,7 +851,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 (c1) VALUES (NULL); @@ -860,7 +860,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SET INSERT_ID = 22; @@ -885,7 +885,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 FLUSH TABLE; @@ -894,7 +894,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 VALUES (4); @@ -904,7 +904,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 INSERT INTO t1 VALUES (NULL); @@ -914,7 +914,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; @@ -1148,12 +1148,39 @@ SELECT * FROM t1; a 0 DROP TABLE t1; +############################################################################## # # MDEV-19622 Assertion failures in # ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table # -CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a); +CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE='MyISAM' PARTITION BY HASH(a); INSERT INTO t1 VALUES (1,1),(2,2); UPDATE t1 SET pk = 0; DROP TABLE t1; -############################################################################## +# +# MDEV-29636 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' +# failed in ha_partition::set_auto_increment_if_higher upon REPLACE +# with partition pruning +# +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='MyISAM' +PARTITION BY RANGE (a) ( +PARTITION p0 VALUES LESS THAN (10), +PARTITION pn VALUES LESS THAN MAXVALUE +); +REPLACE INTO t1 PARTITION (p0) SELECT 1; +DROP TABLE t1; +# +# MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' +# ha_partition::set_auto_increment_if_higher +# +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='MyISAM' PARTITION BY HASH (a) PARTITIONS 3; +REPLACE INTO t1 PARTITION (p0) VALUES (3); +DROP TABLE t1; +# +# MDEV-21310 AUTO_INCREMENT column throws range error on INSERT in partitioned table | +# Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed. +# +CREATE TABLE t1 (c INT AUTO_INCREMENT KEY) ENGINE='MyISAM' PARTITION BY LIST (c) (PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +ALTER TABLE t1 TRUNCATE PARTITION p1; +INSERT INTO t1 PARTITION (p1) (c) SELECT 1; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_basic_innodb.result b/mysql-test/suite/parts/r/partition_basic_innodb.result index 5ea1f98ddcb74..f1b524f299e73 100644 --- a/mysql-test/suite/parts/r/partition_basic_innodb.result +++ b/mysql-test/suite/parts/r/partition_basic_innodb.result @@ -72,7 +72,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -530,7 +530,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -999,7 +999,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -1476,7 +1476,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -1945,7 +1945,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -2422,7 +2422,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -2908,7 +2908,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -3388,7 +3388,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -3859,7 +3859,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -4317,7 +4317,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -4786,7 +4786,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -5263,7 +5263,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -5732,7 +5732,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -6207,7 +6207,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -6689,7 +6689,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -7169,7 +7169,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -7646,7 +7646,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -8141,7 +8141,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -8647,7 +8647,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -9161,7 +9161,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -9667,7 +9667,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -10181,7 +10181,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -10704,7 +10704,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -11221,7 +11221,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -11728,7 +11728,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -12223,7 +12223,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -12729,7 +12729,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -13243,7 +13243,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -13749,7 +13749,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -14263,7 +14263,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -14786,7 +14786,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -15303,7 +15303,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -15810,7 +15810,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -16321,7 +16321,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -16843,7 +16843,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -17373,7 +17373,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -17895,7 +17895,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -18425,7 +18425,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -18964,7 +18964,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -19497,7 +19497,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -20025,7 +20025,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -20520,7 +20520,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -21026,7 +21026,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -21540,7 +21540,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -22046,7 +22046,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -22558,7 +22558,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -23077,7 +23077,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -23594,7 +23594,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -24101,7 +24101,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -24596,7 +24596,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -25102,7 +25102,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -25616,7 +25616,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -26122,7 +26122,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -26634,7 +26634,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -27153,7 +27153,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -27670,7 +27670,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -28177,7 +28177,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -28688,7 +28688,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -29210,7 +29210,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = InnoDB, PARTITION `part_2` VALUES IN (-2) ENGINE = InnoDB, @@ -29740,7 +29740,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION `partb` VALUES LESS THAN (5) ENGINE = InnoDB, @@ -30262,7 +30262,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -30790,7 +30790,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -31325,7 +31325,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -31858,7 +31858,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 diff --git a/mysql-test/suite/parts/r/partition_basic_myisam.result b/mysql-test/suite/parts/r/partition_basic_myisam.result index 06bf043b38258..b52d67a811f90 100644 --- a/mysql-test/suite/parts/r/partition_basic_myisam.result +++ b/mysql-test/suite/parts/r/partition_basic_myisam.result @@ -72,7 +72,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -533,7 +533,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -1008,7 +1008,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -1494,7 +1494,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -1970,7 +1970,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -2456,7 +2456,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -2951,7 +2951,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -3440,7 +3440,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -3921,7 +3921,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -4382,7 +4382,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -4857,7 +4857,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -5343,7 +5343,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -5819,7 +5819,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -6303,7 +6303,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -6794,7 +6794,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -7283,7 +7283,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -7770,7 +7770,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -8284,7 +8284,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) PARTITIONS 5 @@ -8812,7 +8812,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -9351,7 +9351,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -9880,7 +9880,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -10419,7 +10419,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -10967,7 +10967,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -11509,7 +11509,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -12047,7 +12047,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) PARTITIONS 2 @@ -12561,7 +12561,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) PARTITIONS 5 @@ -13089,7 +13089,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) ENGINE = MyISAM, @@ -13628,7 +13628,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) ENGINE = MyISAM, @@ -14157,7 +14157,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -14694,7 +14694,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -15238,7 +15238,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -15780,7 +15780,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 diff --git a/mysql-test/suite/parts/r/partition_basic_symlink_innodb.result b/mysql-test/suite/parts/r/partition_basic_symlink_innodb.result index 33dcad91ff616..9d05d04cccade 100644 --- a/mysql-test/suite/parts/r/partition_basic_symlink_innodb.result +++ b/mysql-test/suite/parts/r/partition_basic_symlink_innodb.result @@ -71,7 +71,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) (PARTITION `p0` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB, PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB) @@ -84,7 +84,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) (PARTITION `p0` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = MyISAM, PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = MyISAM) @@ -111,7 +111,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) (PARTITION `p0` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB, PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB) @@ -159,7 +159,7 @@ t1 CREATE TABLE `t1` ( `myid` int(11) NOT NULL, `myval` varchar(10) DEFAULT NULL, PRIMARY KEY (`myid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`myid`) (PARTITION `p0001` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB, PARTITION `p0002` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB, @@ -196,7 +196,7 @@ t1 CREATE TABLE `t1` ( `myid` int(11) NOT NULL, `myval` varchar(10) DEFAULT NULL, PRIMARY KEY (`myid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`myid`) (PARTITION `p0001` VALUES LESS THAN (50) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = InnoDB, PARTITION `p0002` VALUES LESS THAN (150) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB, @@ -208,7 +208,7 @@ t2 CREATE TABLE `t2` ( `myid` int(11) NOT NULL, `myval` varchar(10) DEFAULT NULL, PRIMARY KEY (`myid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/mysql-test-data-dir/' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQLTEST_VARDIR/mysql-test-data-dir/' select * from t1; myid myval 2 two @@ -248,7 +248,7 @@ t1 CREATE TABLE `t1` ( `myid` int(11) NOT NULL, `myval` varchar(10) DEFAULT NULL, PRIMARY KEY (`myid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`myid`) (PARTITION `p0001` VALUES LESS THAN (50) ENGINE = InnoDB, PARTITION `p0002` VALUES LESS THAN (150) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB, @@ -260,7 +260,7 @@ t2 CREATE TABLE `t2` ( `myid` int(11) NOT NULL, `myval` varchar(10) DEFAULT NULL, PRIMARY KEY (`myid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/mysql-test-data-dir/' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQLTEST_VARDIR/mysql-test-data-dir/' select * from t1; myid myval 2 two @@ -300,7 +300,7 @@ t1 CREATE TABLE `t1` ( `myid` int(11) NOT NULL, `myval` varchar(10) DEFAULT NULL, PRIMARY KEY (`myid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`myid`) (PARTITION `p0001` VALUES LESS THAN (50) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = InnoDB, PARTITION `p0002` VALUES LESS THAN (150) ENGINE = InnoDB, @@ -312,7 +312,7 @@ t2 CREATE TABLE `t2` ( `myid` int(11) NOT NULL, `myval` varchar(10) DEFAULT NULL, PRIMARY KEY (`myid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; myid myval 2 two diff --git a/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result b/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result index df141a9303348..96acb2a22149b 100644 --- a/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result +++ b/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result @@ -82,7 +82,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) @@ -563,7 +563,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -1060,7 +1060,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -1574,7 +1574,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -2070,7 +2070,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -2576,7 +2576,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -3107,7 +3107,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -3618,7 +3618,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -4123,7 +4123,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) @@ -4604,7 +4604,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -5101,7 +5101,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -5615,7 +5615,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -6111,7 +6111,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -6615,7 +6615,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -7146,7 +7146,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -7657,7 +7657,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -8168,7 +8168,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) @@ -8702,7 +8702,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -9252,7 +9252,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -9819,7 +9819,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -10368,7 +10368,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -10927,7 +10927,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -11511,7 +11511,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) @@ -12075,7 +12075,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int1`) SUBPARTITIONS 3 @@ -12637,7 +12637,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1` + `f_int2`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) @@ -13171,7 +13171,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`f_int1`,`f_int2`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -13721,7 +13721,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST ((`f_int1` + `f_int2`) MOD 4) (PARTITION `part_3` VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -14288,7 +14288,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ((`f_int1` + `f_int2`) DIV 2) (PARTITION `parta` VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -14837,7 +14837,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int2`) SUBPARTITIONS 2 @@ -15394,7 +15394,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int2`) (PARTITION `part1` VALUES LESS THAN (0) @@ -15978,7 +15978,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int2` + 1) (PARTITION `part1` VALUES IN (0) @@ -16542,7 +16542,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 2)) SUBPARTITION BY KEY (`f_int2`) SUBPARTITIONS 3 @@ -17100,7 +17100,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `p1` INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `p2` INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM) @@ -17627,7 +17627,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = MyISAM, PARTITION `p2` INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, @@ -18172,7 +18172,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 4) (PARTITION `part_3` VALUES IN (-3) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `part_2` VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = MyISAM, @@ -18726,7 +18726,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) (PARTITION `parta` VALUES LESS THAN (0) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = MyISAM, PARTITION `partb` VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = MyISAM, @@ -19265,7 +19265,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1` DIV 2) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -19817,7 +19817,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY KEY (`f_int1`) (PARTITION `part1` VALUES LESS THAN (0) @@ -20361,7 +20361,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (abs(`f_int1` MOD 3)) SUBPARTITION BY HASH (`f_int1` + 1) (PARTITION `part1` VALUES IN (0) diff --git a/mysql-test/suite/parts/r/partition_bigint_innodb.result b/mysql-test/suite/parts/r/partition_bigint_innodb.result index 1891625d942aa..d7560d42a5f1d 100644 --- a/mysql-test/suite/parts/r/partition_bigint_innodb.result +++ b/mysql-test/suite/parts/r/partition_bigint_innodb.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -57,7 +57,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` bigint(20) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 8 insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612); @@ -89,7 +89,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` bigint(20) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 7 insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0); diff --git a/mysql-test/suite/parts/r/partition_bigint_myisam.result b/mysql-test/suite/parts/r/partition_bigint_myisam.result index 38a2216473318..123e33c8a5edd 100644 --- a/mysql-test/suite/parts/r/partition_bigint_myisam.result +++ b/mysql-test/suite/parts/r/partition_bigint_myisam.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -57,7 +57,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` bigint(20) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 8 insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612); @@ -89,7 +89,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` bigint(20) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 7 insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0); diff --git a/mysql-test/suite/parts/r/partition_bit_innodb.result b/mysql-test/suite/parts/r/partition_bit_innodb.result index b3bf1dac15e30..0874a0084e8e9 100644 --- a/mysql-test/suite/parts/r/partition_bit_innodb.result +++ b/mysql-test/suite/parts/r/partition_bit_innodb.result @@ -8,7 +8,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bit(1) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) drop table t1; create table t1 (a bit(0), primary key (a)) engine='INNODB' @@ -20,7 +20,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bit(1) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` ENGINE = InnoDB, PARTITION `pa2` ENGINE = InnoDB) @@ -32,7 +32,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bit(64) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 2 insert into t1 values @@ -60,7 +60,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bit(64) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -90,7 +90,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` bit(1) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 4 insert into t2 values (b'0'), (b'1'); @@ -103,7 +103,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` bit(1) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 4 select hex(a) from t2; @@ -116,7 +116,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` bit(1) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 4 select hex(a) from t2; @@ -135,7 +135,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` bit(8) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 2 @@ -418,7 +418,7 @@ Table Create Table t4 CREATE TABLE `t4` ( `a` bit(8) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 2 diff --git a/mysql-test/suite/parts/r/partition_bit_myisam.result b/mysql-test/suite/parts/r/partition_bit_myisam.result index 6e25ea5a8d954..abb1f23668351 100644 --- a/mysql-test/suite/parts/r/partition_bit_myisam.result +++ b/mysql-test/suite/parts/r/partition_bit_myisam.result @@ -8,7 +8,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bit(1) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) drop table t1; create table t1 (a bit(0), primary key (a)) engine='MyISAM' @@ -20,7 +20,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bit(1) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` ENGINE = MyISAM, PARTITION `pa2` ENGINE = MyISAM) @@ -32,7 +32,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bit(64) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 2 insert into t1 values @@ -60,7 +60,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bit(64) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -90,7 +90,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` bit(1) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 4 insert into t2 values (b'0'), (b'1'); @@ -103,7 +103,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` bit(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 4 select hex(a) from t2; @@ -116,7 +116,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` bit(1) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 4 select hex(a) from t2; @@ -135,7 +135,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` bit(8) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 2 @@ -418,7 +418,7 @@ Table Create Table t4 CREATE TABLE `t4` ( `a` bit(8) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 2 diff --git a/mysql-test/suite/parts/r/partition_char_innodb.result b/mysql-test/suite/parts/r/partition_char_innodb.result index d31229a1cb387..3131ba58cdf20 100644 Binary files a/mysql-test/suite/parts/r/partition_char_innodb.result and b/mysql-test/suite/parts/r/partition_char_innodb.result differ diff --git a/mysql-test/suite/parts/r/partition_char_myisam.result b/mysql-test/suite/parts/r/partition_char_myisam.result index eb9342ba2bc95..b0f17ca8b6556 100644 Binary files a/mysql-test/suite/parts/r/partition_char_myisam.result and b/mysql-test/suite/parts/r/partition_char_myisam.result differ diff --git a/mysql-test/suite/parts/r/partition_datetime_innodb.result b/mysql-test/suite/parts/r/partition_datetime_innodb.result index 883f2bb1924f1..8779bfeafa79d 100644 --- a/mysql-test/suite/parts/r/partition_datetime_innodb.result +++ b/mysql-test/suite/parts/r/partition_datetime_innodb.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -39,7 +39,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 12 insert into t2 values ('1975-01-01 0:1:1'), ('2020-12-31 10:11:12'), ('1980-10-14 13:14:15'), ('2000-06-15 14:15:16'); @@ -136,7 +136,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -166,7 +166,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` date NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 12 insert into t2 values ('1975-01-01'), ('2020-12-31'), ('1980-10-14'), ('2000-06-15'); @@ -290,7 +290,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` date NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (month(`a`)) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 3 @@ -330,7 +330,7 @@ Table Create Table t4 CREATE TABLE `t4` ( `a` date NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (month(`a`)) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 3 @@ -368,7 +368,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` time NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -398,7 +398,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` time NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 12 insert into t2 values ('0:1:1'), ('10:11:12'), ('13:14:15'), ('14:15:16'); @@ -497,7 +497,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` time NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (second(`a`)) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 3 @@ -584,7 +584,7 @@ Table Create Table t4 CREATE TABLE `t4` ( `a` time NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (second(`a`)) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 3 @@ -669,7 +669,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -699,7 +699,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 12 insert into t2 values ('1975-01-01 0:1:1'), ('2020-12-31 10:11:12'), ('1980-10-14 13:14:15'), ('2000-06-15 14:15:16'); @@ -798,7 +798,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (month(`a`)) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 3 @@ -838,7 +838,7 @@ Table Create Table t4 CREATE TABLE `t4` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (month(`a`)) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 3 @@ -876,7 +876,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` year(4) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -906,7 +906,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` year(4) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 12 insert into t2 values ('1975'), ('2020'), ('1980'), ('2000'); diff --git a/mysql-test/suite/parts/r/partition_datetime_myisam.result b/mysql-test/suite/parts/r/partition_datetime_myisam.result index 34e06b1ba30dd..0d1dcf3ec3012 100644 --- a/mysql-test/suite/parts/r/partition_datetime_myisam.result +++ b/mysql-test/suite/parts/r/partition_datetime_myisam.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -39,7 +39,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 12 insert into t2 values ('1975-01-01 0:1:1'), ('2020-12-31 10:11:12'), ('1980-10-14 13:14:15'), ('2000-06-15 14:15:16'); @@ -136,7 +136,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -166,7 +166,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` date NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 12 insert into t2 values ('1975-01-01'), ('2020-12-31'), ('1980-10-14'), ('2000-06-15'); @@ -290,7 +290,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` date NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (month(`a`)) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 3 @@ -330,7 +330,7 @@ Table Create Table t4 CREATE TABLE `t4` ( `a` date NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (month(`a`)) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 3 @@ -368,7 +368,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` time NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -398,7 +398,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` time NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 12 insert into t2 values ('0:1:1'), ('10:11:12'), ('13:14:15'), ('14:15:16'); @@ -497,7 +497,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` time NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (second(`a`)) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 3 @@ -584,7 +584,7 @@ Table Create Table t4 CREATE TABLE `t4` ( `a` time NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (second(`a`)) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 3 @@ -669,7 +669,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -699,7 +699,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 12 insert into t2 values ('1975-01-01 0:1:1'), ('2020-12-31 10:11:12'), ('1980-10-14 13:14:15'), ('2000-06-15 14:15:16'); @@ -798,7 +798,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (month(`a`)) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 3 @@ -838,7 +838,7 @@ Table Create Table t4 CREATE TABLE `t4` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (month(`a`)) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 3 @@ -876,7 +876,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` year(4) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -906,7 +906,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` year(4) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 12 insert into t2 values ('1975'), ('2020'), ('1980'), ('2000'); diff --git a/mysql-test/suite/parts/r/partition_debug.result b/mysql-test/suite/parts/r/partition_debug.result index 5afb2b45926bf..5aae648dd1c5e 100644 --- a/mysql-test/suite/parts/r/partition_debug.result +++ b/mysql-test/suite/parts/r/partition_debug.result @@ -30,7 +30,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -57,7 +57,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -104,7 +104,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -128,7 +128,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -145,7 +145,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -172,7 +172,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -219,7 +219,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -243,7 +243,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -260,7 +260,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -287,7 +287,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -334,7 +334,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -358,7 +358,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -375,7 +375,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -402,7 +402,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -440,7 +440,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -464,7 +464,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -481,7 +481,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -508,7 +508,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -546,7 +546,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -570,7 +570,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -587,7 +587,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -614,7 +614,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -652,7 +652,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -676,7 +676,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -693,7 +693,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -720,7 +720,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -758,7 +758,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -782,7 +782,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -799,7 +799,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -826,7 +826,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -873,7 +873,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -897,7 +897,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -914,7 +914,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -941,7 +941,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -988,7 +988,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1012,7 +1012,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 1 Original from partition p0 @@ -1045,7 +1045,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1068,7 +1068,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1093,7 +1093,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1117,7 +1117,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1149,7 +1149,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1172,7 +1172,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1197,7 +1197,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1221,7 +1221,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1253,7 +1253,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1276,7 +1276,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1301,7 +1301,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1325,7 +1325,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1357,7 +1357,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1380,7 +1380,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1405,7 +1405,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1429,7 +1429,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1461,7 +1461,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1484,7 +1484,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1509,7 +1509,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1533,7 +1533,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1565,7 +1565,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1588,7 +1588,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1613,7 +1613,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1637,7 +1637,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1669,7 +1669,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1692,7 +1692,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1717,7 +1717,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1741,7 +1741,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1773,7 +1773,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1796,7 +1796,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1821,7 +1821,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1845,7 +1845,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1877,7 +1877,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1900,7 +1900,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1925,7 +1925,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -1949,7 +1949,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 1 Original from partition p0 @@ -1989,7 +1989,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2004,7 +2004,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2030,7 +2030,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2046,7 +2046,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2081,7 +2081,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2096,7 +2096,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2122,7 +2122,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2138,7 +2138,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2173,7 +2173,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2188,7 +2188,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2214,7 +2214,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2230,7 +2230,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2265,7 +2265,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2280,7 +2280,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2306,7 +2306,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2322,7 +2322,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2357,7 +2357,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2372,7 +2372,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2398,7 +2398,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2414,7 +2414,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2449,7 +2449,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2464,7 +2464,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2490,7 +2490,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2506,7 +2506,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2541,7 +2541,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2556,7 +2556,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2582,7 +2582,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2598,7 +2598,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2633,7 +2633,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2648,7 +2648,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2674,7 +2674,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2690,7 +2690,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2725,7 +2725,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2740,7 +2740,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2766,7 +2766,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2782,7 +2782,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2817,7 +2817,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2832,7 +2832,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; x 32 @@ -2857,7 +2857,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2911,7 +2911,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2950,7 +2950,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -2997,7 +2997,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3037,7 +3037,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3087,7 +3087,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3126,7 +3126,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3173,7 +3173,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3213,7 +3213,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3263,7 +3263,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3302,7 +3302,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3349,7 +3349,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3389,7 +3389,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3439,7 +3439,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3478,7 +3478,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3525,7 +3525,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3565,7 +3565,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3615,7 +3615,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3654,7 +3654,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3701,7 +3701,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3741,7 +3741,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3791,7 +3791,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3830,7 +3830,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3877,7 +3877,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3917,7 +3917,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -3967,7 +3967,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4006,7 +4006,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4053,7 +4053,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4093,7 +4093,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4143,7 +4143,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4182,7 +4182,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4229,7 +4229,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4269,7 +4269,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4319,7 +4319,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4358,7 +4358,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4405,7 +4405,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4445,7 +4445,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4495,7 +4495,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4534,7 +4534,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4581,7 +4581,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4621,7 +4621,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4671,7 +4671,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4710,7 +4710,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4757,7 +4757,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4797,7 +4797,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4847,7 +4847,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4886,7 +4886,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4933,7 +4933,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -4973,7 +4973,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -5024,7 +5024,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -5064,7 +5064,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM, @@ -5112,7 +5112,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -5155,7 +5155,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM, @@ -5179,7 +5179,7 @@ Table Create Table tp2 CREATE TABLE `tp2` ( `x` int(11) NOT NULL, PRIMARY KEY (`x`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from tp2; x 12 diff --git a/mysql-test/suite/parts/r/partition_debug_innodb.result b/mysql-test/suite/parts/r/partition_debug_innodb.result index db88e714872ea..4d4538c168ec7 100644 --- a/mysql-test/suite/parts/r/partition_debug_innodb.result +++ b/mysql-test/suite/parts/r/partition_debug_innodb.result @@ -17,7 +17,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -43,7 +43,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -84,7 +84,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -108,7 +108,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -125,7 +125,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -151,7 +151,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -192,7 +192,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -216,7 +216,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -233,7 +233,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -259,7 +259,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -300,7 +300,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -324,7 +324,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -341,7 +341,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -367,7 +367,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -402,7 +402,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -426,7 +426,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -443,7 +443,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -469,7 +469,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -504,7 +504,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -528,7 +528,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -545,7 +545,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -571,7 +571,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -606,7 +606,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -630,7 +630,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -647,7 +647,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -673,7 +673,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -708,7 +708,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -732,7 +732,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -749,7 +749,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -775,7 +775,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -816,7 +816,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -840,7 +840,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -857,7 +857,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -883,7 +883,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -924,7 +924,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -948,7 +948,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 1 Original from partition p0 @@ -980,7 +980,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1003,7 +1003,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1025,7 +1025,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1049,7 +1049,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1080,7 +1080,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1103,7 +1103,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1125,7 +1125,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1149,7 +1149,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1180,7 +1180,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1203,7 +1203,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1225,7 +1225,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1249,7 +1249,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1280,7 +1280,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1303,7 +1303,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1325,7 +1325,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1349,7 +1349,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1380,7 +1380,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1403,7 +1403,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1425,7 +1425,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1449,7 +1449,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1480,7 +1480,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1503,7 +1503,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1525,7 +1525,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1549,7 +1549,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1580,7 +1580,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1603,7 +1603,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1625,7 +1625,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1649,7 +1649,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1680,7 +1680,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1703,7 +1703,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1725,7 +1725,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1749,7 +1749,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1780,7 +1780,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1803,7 +1803,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 5 Original from table t2 @@ -1825,7 +1825,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -1849,7 +1849,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` varchar(64) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a b 1 Original from partition p0 diff --git a/mysql-test/suite/parts/r/partition_debug_sync_innodb.result b/mysql-test/suite/parts/r/partition_debug_sync_innodb.result index 7388eb73ea809..3305802a288f4 100644 --- a/mysql-test/suite/parts/r/partition_debug_sync_innodb.result +++ b/mysql-test/suite/parts/r/partition_debug_sync_innodb.result @@ -50,7 +50,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) db.opt @@ -89,7 +89,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p10` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) diff --git a/mysql-test/suite/parts/r/partition_decimal_innodb.result b/mysql-test/suite/parts/r/partition_decimal_innodb.result index 648567a14ca8b..c2f00a8925e9c 100644 --- a/mysql-test/suite/parts/r/partition_decimal_innodb.result +++ b/mysql-test/suite/parts/r/partition_decimal_innodb.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(10,4) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -53,7 +53,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` decimal(18,9) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 10 insert into t2 values (999999999.999999999), (-999999999.999999999), (-1.5), (-1), (0), (1.5), (1234.567), (-1234.567); @@ -99,7 +99,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` decimal(18,9) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (floor(`a`)) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 2 @@ -126,7 +126,7 @@ Table Create Table t4 CREATE TABLE `t4` ( `a` decimal(18,9) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (ceiling(`a`)) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 2 diff --git a/mysql-test/suite/parts/r/partition_decimal_myisam.result b/mysql-test/suite/parts/r/partition_decimal_myisam.result index 149996514516b..a5175079a4bea 100644 --- a/mysql-test/suite/parts/r/partition_decimal_myisam.result +++ b/mysql-test/suite/parts/r/partition_decimal_myisam.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(10,4) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -53,7 +53,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` decimal(18,9) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 10 insert into t2 values (999999999.999999999), (-999999999.999999999), (-1.5), (-1), (0), (1.5), (1234.567), (-1234.567); @@ -99,7 +99,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` decimal(18,9) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (floor(`a`)) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 2 @@ -126,7 +126,7 @@ Table Create Table t4 CREATE TABLE `t4` ( `a` decimal(18,9) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (ceiling(`a`)) SUBPARTITION BY KEY (`a`) SUBPARTITIONS 2 diff --git a/mysql-test/suite/parts/r/partition_double_innodb.result b/mysql-test/suite/parts/r/partition_double_innodb.result index 9c6d930a49015..7563109f30b39 100644 --- a/mysql-test/suite/parts/r/partition_double_innodb.result +++ b/mysql-test/suite/parts/r/partition_double_innodb.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -47,7 +47,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` double NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 10 insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208); diff --git a/mysql-test/suite/parts/r/partition_double_myisam.result b/mysql-test/suite/parts/r/partition_double_myisam.result index 9ab32b1f84185..e9cf25e6408c0 100644 --- a/mysql-test/suite/parts/r/partition_double_myisam.result +++ b/mysql-test/suite/parts/r/partition_double_myisam.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -47,7 +47,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` double NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 10 insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208); diff --git a/mysql-test/suite/parts/r/partition_engine_innodb.result b/mysql-test/suite/parts/r/partition_engine_innodb.result index 0c10490f26393..065f629202611 100644 --- a/mysql-test/suite/parts/r/partition_engine_innodb.result +++ b/mysql-test/suite/parts/r/partition_engine_innodb.result @@ -67,7 +67,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -525,7 +525,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part1` ENGINE = InnoDB, PARTITION `part2` ENGINE = InnoDB) @@ -985,7 +985,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (10) @@ -1511,7 +1511,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (10) @@ -2013,7 +2013,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (10) @@ -2476,7 +2476,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (10) @@ -2939,7 +2939,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part1` ENGINE = InnoDB, PARTITION `part2` ENGINE = InnoDB) @@ -3399,7 +3399,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (10) @@ -3865,7 +3865,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (10) @@ -4324,7 +4324,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part1` ENGINE = InnoDB) @@ -4779,7 +4779,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (1000) diff --git a/mysql-test/suite/parts/r/partition_engine_myisam.result b/mysql-test/suite/parts/r/partition_engine_myisam.result index 4fb756b7dce94..cbe3d2b20e026 100644 --- a/mysql-test/suite/parts/r/partition_engine_myisam.result +++ b/mysql-test/suite/parts/r/partition_engine_myisam.result @@ -67,7 +67,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -534,7 +534,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part1` ENGINE = MyISAM, PARTITION `part2` ENGINE = MyISAM) @@ -1003,7 +1003,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (10) @@ -1542,7 +1542,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (10) @@ -2057,7 +2057,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (10) @@ -2533,7 +2533,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (10) @@ -3009,7 +3009,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part1` ENGINE = MyISAM, PARTITION `part2` ENGINE = MyISAM) @@ -3478,7 +3478,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (10) @@ -3957,7 +3957,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (10) @@ -4429,7 +4429,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part1` ENGINE = MyISAM) @@ -4891,7 +4891,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (1000) diff --git a/mysql-test/suite/parts/r/partition_exch_qa_1_innodb.result b/mysql-test/suite/parts/r/partition_exch_qa_1_innodb.result index 2b6d8e4dac241..5182b9b60416f 100644 --- a/mysql-test/suite/parts/r/partition_exch_qa_1_innodb.result +++ b/mysql-test/suite/parts/r/partition_exch_qa_1_innodb.result @@ -119,7 +119,7 @@ t_10 CREATE TABLE `t_10` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `a` (`a`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table tp ; Table Create Table tp CREATE TABLE `tp` ( @@ -127,7 +127,7 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `a` (`a`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN (100) ENGINE = InnoDB, @@ -144,7 +144,7 @@ t_10 CREATE TABLE `t_10` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `a` (`a`,`b`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table tp ; Table Create Table tp CREATE TABLE `tp` ( @@ -152,7 +152,7 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `a` (`a`,`b`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN (100) ENGINE = InnoDB, diff --git a/mysql-test/suite/parts/r/partition_exch_qa_1_myisam.result b/mysql-test/suite/parts/r/partition_exch_qa_1_myisam.result index 73d1775ab4ac5..fc40711d3b044 100644 --- a/mysql-test/suite/parts/r/partition_exch_qa_1_myisam.result +++ b/mysql-test/suite/parts/r/partition_exch_qa_1_myisam.result @@ -119,7 +119,7 @@ t_10 CREATE TABLE `t_10` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `a` (`a`) USING BTREE -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table tp ; Table Create Table tp CREATE TABLE `tp` ( @@ -127,7 +127,7 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `a` (`a`) USING BTREE -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN (100) ENGINE = MyISAM, @@ -144,7 +144,7 @@ t_10 CREATE TABLE `t_10` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `a` (`a`,`b`) USING BTREE -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table tp ; Table Create Table tp CREATE TABLE `tp` ( @@ -152,7 +152,7 @@ tp CREATE TABLE `tp` ( `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `a` (`a`,`b`) USING BTREE -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN (100) ENGINE = MyISAM, diff --git a/mysql-test/suite/parts/r/partition_exch_qa_5_innodb.result b/mysql-test/suite/parts/r/partition_exch_qa_5_innodb.result index 2e31fc57dd4a3..aa35364b81196 100644 --- a/mysql-test/suite/parts/r/partition_exch_qa_5_innodb.result +++ b/mysql-test/suite/parts/r/partition_exch_qa_5_innodb.result @@ -13,7 +13,7 @@ Grants for test1@localhost GRANT USAGE ON *.* TO `test1`@`localhost` GRANT SELECT, INSERT, CREATE, DROP ON `test`.* TO `test1`@`localhost` ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; -ERROR 42000: ALTER command denied to user 'test1'@'localhost' for table 'tp' +ERROR 42000: ALTER command denied to user 'test1'@'localhost' for table `test`.`tp` disconnect test1; connect test2,localhost,test2,,test,$MASTER_MYPORT,$MASTER_MYSOCK; USE test; @@ -83,7 +83,7 @@ Grants for test2@localhost GRANT USAGE ON *.* TO `test2`@`localhost` GRANT SELECT, INSERT, UPDATE, CREATE, DROP ON `test`.* TO `test2`@`localhost` ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; -ERROR 42000: ALTER command denied to user 'test2'@'localhost' for table 'tp' +ERROR 42000: ALTER command denied to user 'test2'@'localhost' for table `test`.`tp` SELECT * FROM tp WHERE a BETWEEN 0 AND 10; a b 2 Two @@ -91,11 +91,11 @@ a b 6 Six 8 Eight ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; -ERROR 42000: ALTER command denied to user 'test2'@'localhost' for table 'tp' +ERROR 42000: ALTER command denied to user 'test2'@'localhost' for table `test`.`tp` ALTER TABLE tsp EXCHANGE PARTITION sp00 WITH TABLE tsp_00; -ERROR 42000: ALTER command denied to user 'test2'@'localhost' for table 'tsp' +ERROR 42000: ALTER command denied to user 'test2'@'localhost' for table `test`.`tsp` ALTER TABLE tsp EXCHANGE PARTITION sp00 WITH TABLE tsp_00; -ERROR 42000: ALTER command denied to user 'test2'@'localhost' for table 'tsp' +ERROR 42000: ALTER command denied to user 'test2'@'localhost' for table `test`.`tsp` connection default; disconnect test2; DROP TABLE IF EXISTS t_10; diff --git a/mysql-test/suite/parts/r/partition_exch_qa_5_myisam.result b/mysql-test/suite/parts/r/partition_exch_qa_5_myisam.result index 2e31fc57dd4a3..aa35364b81196 100644 --- a/mysql-test/suite/parts/r/partition_exch_qa_5_myisam.result +++ b/mysql-test/suite/parts/r/partition_exch_qa_5_myisam.result @@ -13,7 +13,7 @@ Grants for test1@localhost GRANT USAGE ON *.* TO `test1`@`localhost` GRANT SELECT, INSERT, CREATE, DROP ON `test`.* TO `test1`@`localhost` ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; -ERROR 42000: ALTER command denied to user 'test1'@'localhost' for table 'tp' +ERROR 42000: ALTER command denied to user 'test1'@'localhost' for table `test`.`tp` disconnect test1; connect test2,localhost,test2,,test,$MASTER_MYPORT,$MASTER_MYSOCK; USE test; @@ -83,7 +83,7 @@ Grants for test2@localhost GRANT USAGE ON *.* TO `test2`@`localhost` GRANT SELECT, INSERT, UPDATE, CREATE, DROP ON `test`.* TO `test2`@`localhost` ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; -ERROR 42000: ALTER command denied to user 'test2'@'localhost' for table 'tp' +ERROR 42000: ALTER command denied to user 'test2'@'localhost' for table `test`.`tp` SELECT * FROM tp WHERE a BETWEEN 0 AND 10; a b 2 Two @@ -91,11 +91,11 @@ a b 6 Six 8 Eight ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; -ERROR 42000: ALTER command denied to user 'test2'@'localhost' for table 'tp' +ERROR 42000: ALTER command denied to user 'test2'@'localhost' for table `test`.`tp` ALTER TABLE tsp EXCHANGE PARTITION sp00 WITH TABLE tsp_00; -ERROR 42000: ALTER command denied to user 'test2'@'localhost' for table 'tsp' +ERROR 42000: ALTER command denied to user 'test2'@'localhost' for table `test`.`tsp` ALTER TABLE tsp EXCHANGE PARTITION sp00 WITH TABLE tsp_00; -ERROR 42000: ALTER command denied to user 'test2'@'localhost' for table 'tsp' +ERROR 42000: ALTER command denied to user 'test2'@'localhost' for table `test`.`tsp` connection default; disconnect test2; DROP TABLE IF EXISTS t_10; diff --git a/mysql-test/suite/parts/r/partition_exch_qa_6.result b/mysql-test/suite/parts/r/partition_exch_qa_6.result index 880886b4fac34..7917765c9dd1e 100644 --- a/mysql-test/suite/parts/r/partition_exch_qa_6.result +++ b/mysql-test/suite/parts/r/partition_exch_qa_6.result @@ -117,7 +117,7 @@ Grants for test2@localhost GRANT USAGE ON *.* TO `test2`@`localhost` GRANT SELECT, UPDATE, CREATE, DROP, ALTER ON `test`.* TO `test2`@`localhost` ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; -ERROR 42000: INSERT command denied to user 'test2'@'localhost' for table 'tp' +ERROR 42000: INSERT command denied to user 'test2'@'localhost' for table `test`.`tp` disconnect test2; connection default; GRANT INSERT ON test.* TO test2@localhost; @@ -129,7 +129,7 @@ Grants for test2@localhost GRANT USAGE ON *.* TO `test2`@`localhost` GRANT SELECT, INSERT, UPDATE, DROP, ALTER ON `test`.* TO `test2`@`localhost` ALTER TABLE tsp EXCHANGE PARTITION sp00 WITH TABLE tsp_00; -ERROR 42000: CREATE command denied to user 'test2'@'localhost' for table 'tsp' +ERROR 42000: CREATE command denied to user 'test2'@'localhost' for table `test`.`tsp` disconnect test2; connection default; GRANT CREATE ON test.* TO test2@localhost; @@ -140,7 +140,7 @@ Grants for test2@localhost GRANT USAGE ON *.* TO `test2`@`localhost` GRANT SELECT, INSERT, UPDATE, CREATE, ALTER ON `test`.* TO `test2`@`localhost` ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; -ERROR 42000: DROP command denied to user 'test2'@'localhost' for table 'tp' +ERROR 42000: DROP command denied to user 'test2'@'localhost' for table `test`.`tp` disconnect test2; connection default; DROP TABLE IF EXISTS t_10; diff --git a/mysql-test/suite/parts/r/partition_exch_qa_8_innodb.result b/mysql-test/suite/parts/r/partition_exch_qa_8_innodb.result index 2fd45be926120..842c93ac40367 100644 --- a/mysql-test/suite/parts/r/partition_exch_qa_8_innodb.result +++ b/mysql-test/suite/parts/r/partition_exch_qa_8_innodb.result @@ -62,9 +62,9 @@ connection default; REVOKE INSERT ON testdb.* FROM test2@localhost; connect test2,localhost,test2,,test,$MASTER_MYPORT,$MASTER_MYSOCK; ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE testdb.t_10; -ERROR 42000: INSERT command denied to user 'test2'@'localhost' for table 't_10' +ERROR 42000: INSERT command denied to user 'test2'@'localhost' for table `testdb`.`t_10` ALTER TABLE testdb.tp EXCHANGE PARTITION p0 WITH TABLE t_10; -ERROR 42000: INSERT command denied to user 'test2'@'localhost' for table 'tp' +ERROR 42000: INSERT command denied to user 'test2'@'localhost' for table `testdb`.`tp` disconnect test2; connection default; DROP TABLE IF EXISTS t_10; diff --git a/mysql-test/suite/parts/r/partition_exch_qa_8_myisam.result b/mysql-test/suite/parts/r/partition_exch_qa_8_myisam.result index 2fd45be926120..842c93ac40367 100644 --- a/mysql-test/suite/parts/r/partition_exch_qa_8_myisam.result +++ b/mysql-test/suite/parts/r/partition_exch_qa_8_myisam.result @@ -62,9 +62,9 @@ connection default; REVOKE INSERT ON testdb.* FROM test2@localhost; connect test2,localhost,test2,,test,$MASTER_MYPORT,$MASTER_MYSOCK; ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE testdb.t_10; -ERROR 42000: INSERT command denied to user 'test2'@'localhost' for table 't_10' +ERROR 42000: INSERT command denied to user 'test2'@'localhost' for table `testdb`.`t_10` ALTER TABLE testdb.tp EXCHANGE PARTITION p0 WITH TABLE t_10; -ERROR 42000: INSERT command denied to user 'test2'@'localhost' for table 'tp' +ERROR 42000: INSERT command denied to user 'test2'@'localhost' for table `testdb`.`tp` disconnect test2; connection default; DROP TABLE IF EXISTS t_10; diff --git a/mysql-test/suite/parts/r/partition_exchange_innodb.result b/mysql-test/suite/parts/r/partition_exchange_innodb.result index a994910d6985d..ac3c383118365 100644 --- a/mysql-test/suite/parts/r/partition_exchange_innodb.result +++ b/mysql-test/suite/parts/r/partition_exchange_innodb.result @@ -12,7 +12,7 @@ tp CREATE TABLE `tp` ( `a` int(11) NOT NULL AUTO_INCREMENT, `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) PARTITIONS 4 SHOW CREATE TABLE t; @@ -21,7 +21,7 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL AUTO_INCREMENT, `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO tp (b) VALUES ("One"), ("Two"), ("Three"), ("Four"), ("Five"), ("Six"), ("Seven"), ("Eight"), ("Nine"), ("Ten"), ("Eleven"), ("Twelwe"); INSERT INTO tp VALUES (97, "Ninety seven"); @@ -85,7 +85,7 @@ tp CREATE TABLE `tp` ( `a` int(11) NOT NULL AUTO_INCREMENT, `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=112 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=112 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) PARTITIONS 4 SHOW CREATE TABLE t; @@ -94,7 +94,7 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL AUTO_INCREMENT, `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE tp, t; CREATE TABLE t (a INT, @@ -186,14 +186,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -229,14 +229,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -304,14 +304,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -338,14 +338,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = InnoDB, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) diff --git a/mysql-test/suite/parts/r/partition_exchange_memory.result b/mysql-test/suite/parts/r/partition_exchange_memory.result index 5aa4108980c22..106d7201e097b 100644 --- a/mysql-test/suite/parts/r/partition_exchange_memory.result +++ b/mysql-test/suite/parts/r/partition_exchange_memory.result @@ -12,7 +12,7 @@ tp CREATE TABLE `tp` ( `a` int(11) NOT NULL AUTO_INCREMENT, `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) PARTITIONS 4 SHOW CREATE TABLE t; @@ -21,7 +21,7 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL AUTO_INCREMENT, `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO tp (b) VALUES ("One"), ("Two"), ("Three"), ("Four"), ("Five"), ("Six"), ("Seven"), ("Eight"), ("Nine"), ("Ten"), ("Eleven"), ("Twelwe"); INSERT INTO tp VALUES (97, "Ninety seven"); @@ -85,7 +85,7 @@ tp CREATE TABLE `tp` ( `a` int(11) NOT NULL AUTO_INCREMENT, `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY AUTO_INCREMENT=112 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=112 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) PARTITIONS 4 SHOW CREATE TABLE t; @@ -94,7 +94,7 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL AUTO_INCREMENT, `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE tp, t; CREATE TABLE t (a INT, @@ -186,14 +186,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MEMORY, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MEMORY) @@ -229,14 +229,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MEMORY, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MEMORY) @@ -304,14 +304,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MEMORY, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MEMORY) @@ -338,14 +338,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MEMORY, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MEMORY) diff --git a/mysql-test/suite/parts/r/partition_exchange_myisam.result b/mysql-test/suite/parts/r/partition_exchange_myisam.result index c30ff60ed7c8d..7df0b47584b62 100644 --- a/mysql-test/suite/parts/r/partition_exchange_myisam.result +++ b/mysql-test/suite/parts/r/partition_exchange_myisam.result @@ -12,7 +12,7 @@ tp CREATE TABLE `tp` ( `a` int(11) NOT NULL AUTO_INCREMENT, `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) PARTITIONS 4 SHOW CREATE TABLE t; @@ -21,7 +21,7 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL AUTO_INCREMENT, `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO tp (b) VALUES ("One"), ("Two"), ("Three"), ("Four"), ("Five"), ("Six"), ("Seven"), ("Eight"), ("Nine"), ("Ten"), ("Eleven"), ("Twelwe"); INSERT INTO tp VALUES (97, "Ninety seven"); @@ -85,7 +85,7 @@ tp CREATE TABLE `tp` ( `a` int(11) NOT NULL AUTO_INCREMENT, `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM AUTO_INCREMENT=112 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=112 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) PARTITIONS 4 SHOW CREATE TABLE t; @@ -94,7 +94,7 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL AUTO_INCREMENT, `b` varchar(24) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE tp, t; CREATE TABLE t (a INT, @@ -186,14 +186,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -229,14 +229,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -304,14 +304,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -338,14 +338,14 @@ t CREATE TABLE `t` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) diff --git a/mysql-test/suite/parts/r/partition_float_innodb.result b/mysql-test/suite/parts/r/partition_float_innodb.result index 1163c8dafdaa6..7cdccdb886f2c 100644 --- a/mysql-test/suite/parts/r/partition_float_innodb.result +++ b/mysql-test/suite/parts/r/partition_float_innodb.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` float NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -45,7 +45,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` float NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 10 insert into t2 values (-3.402823466E+38), (-3.402823466E+37), (-123.456), (0), (1234546.789), (123.456), (1.5); diff --git a/mysql-test/suite/parts/r/partition_float_myisam.result b/mysql-test/suite/parts/r/partition_float_myisam.result index 787e6a855c85e..ea706551afdbb 100644 --- a/mysql-test/suite/parts/r/partition_float_myisam.result +++ b/mysql-test/suite/parts/r/partition_float_myisam.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` float NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -45,7 +45,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` float NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 10 insert into t2 values (-3.402823466E+38), (-3.402823466E+37), (-123.456), (0), (1234546.789), (123.456), (1.5); diff --git a/mysql-test/suite/parts/r/partition_int_innodb.result b/mysql-test/suite/parts/r/partition_int_innodb.result index aca367070fdc3..127e3d88756bd 100644 --- a/mysql-test/suite/parts/r/partition_int_innodb.result +++ b/mysql-test/suite/parts/r/partition_int_innodb.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(10) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -45,7 +45,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(10) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 8 insert into t2 values (4294967295), (4294967294), (4294967293), (4294967292); @@ -77,7 +77,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 7 insert into t3 values (2147483647), (2147483646), (2147483645), (2147483644), (-2147483648), (-2147483647), (1), (-1), (0); diff --git a/mysql-test/suite/parts/r/partition_int_myisam.result b/mysql-test/suite/parts/r/partition_int_myisam.result index 2f5506d2b4dab..9b4861ce54182 100644 --- a/mysql-test/suite/parts/r/partition_int_myisam.result +++ b/mysql-test/suite/parts/r/partition_int_myisam.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(10) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -45,7 +45,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(10) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 8 insert into t2 values (4294967295), (4294967294), (4294967293), (4294967292); @@ -77,7 +77,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 7 insert into t3 values (2147483647), (2147483646), (2147483645), (2147483644), (-2147483648), (-2147483647), (1), (-1), (0); diff --git a/mysql-test/suite/parts/r/partition_mediumint_innodb.result b/mysql-test/suite/parts/r/partition_mediumint_innodb.result index 3e579c7449dd0..4ce65dc41bea9 100644 --- a/mysql-test/suite/parts/r/partition_mediumint_innodb.result +++ b/mysql-test/suite/parts/r/partition_mediumint_innodb.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -45,7 +45,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 8 insert into t2 values (16777215), (16777214), (16777213), (16777212); @@ -77,7 +77,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` mediumint(9) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 7 insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0); diff --git a/mysql-test/suite/parts/r/partition_mediumint_myisam.result b/mysql-test/suite/parts/r/partition_mediumint_myisam.result index f1be34338ec70..d5b17115df210 100644 --- a/mysql-test/suite/parts/r/partition_mediumint_myisam.result +++ b/mysql-test/suite/parts/r/partition_mediumint_myisam.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -45,7 +45,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 8 insert into t2 values (16777215), (16777214), (16777213), (16777212); @@ -77,7 +77,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` mediumint(9) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 7 insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0); diff --git a/mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result b/mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result index 023195e9760ef..887842247235d 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result @@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB; Table Create Table TableB CREATE TABLE `TableB` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT PARTITION_NAME, IF(TABLE_ROWS, 'YES', 'NO') AS HAVE_TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME HAVE_TABLE_ROWS parta NO @@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -270,7 +270,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -297,7 +297,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after KEY PARTITIONING test DROP TABLE TableA; # 2.0 HASH partitioning mgm @@ -363,7 +363,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -391,7 +391,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -427,7 +427,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -506,7 +506,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -533,7 +533,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after HASH PARTITIONING test DROP TABLE TableA; # 3.0 RANGE partitioning mgm @@ -588,7 +588,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partB` VALUES LESS THAN (7) ENGINE = InnoDB, @@ -619,7 +619,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partB` VALUES LESS THAN (7) ENGINE = InnoDB, @@ -657,7 +657,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = InnoDB, @@ -737,7 +737,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partB` VALUES LESS THAN (7) ENGINE = InnoDB, @@ -764,7 +764,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after RANGE PARTITIONING test DROP TABLE TableA; # 4.0 LIST partitioning mgm @@ -819,7 +819,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION `partB` VALUES IN (2,10,11) ENGINE = InnoDB, @@ -850,7 +850,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION `partB` VALUES IN (2,10,11) ENGINE = InnoDB, @@ -888,7 +888,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = InnoDB, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = InnoDB, @@ -960,7 +960,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION `partB` VALUES IN (2,10,11) ENGINE = InnoDB, @@ -984,7 +984,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after LIST PARTITIONING test DROP TABLE TableA; # Testing TRUNCATE PARTITION @@ -1003,7 +1003,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL AUTO_INCREMENT, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = InnoDB, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = InnoDB, diff --git a/mysql-test/suite/parts/r/partition_mgm_lc0_memory.result b/mysql-test/suite/parts/r/partition_mgm_lc0_memory.result index 0b5f96696b070..92457a2104325 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc0_memory.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc0_memory.result @@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB; Table Create Table TableB CREATE TABLE `TableB` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT PARTITION_NAME, IF(TABLE_ROWS, 'YES', 'NO') AS HAVE_TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME HAVE_TABLE_ROWS parta NO @@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -270,7 +270,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -297,7 +297,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after KEY PARTITIONING test DROP TABLE TableA; # 2.0 HASH partitioning mgm @@ -363,7 +363,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -391,7 +391,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -427,7 +427,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -506,7 +506,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -533,7 +533,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after HASH PARTITIONING test DROP TABLE TableA; # 3.0 RANGE partitioning mgm @@ -588,7 +588,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MEMORY, @@ -619,7 +619,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MEMORY, @@ -657,7 +657,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MEMORY, @@ -737,7 +737,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MEMORY, @@ -764,7 +764,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after RANGE PARTITIONING test DROP TABLE TableA; # 4.0 LIST partitioning mgm @@ -819,7 +819,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MEMORY, @@ -850,7 +850,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MEMORY, @@ -888,7 +888,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MEMORY, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MEMORY, @@ -960,7 +960,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MEMORY, @@ -984,7 +984,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after LIST PARTITIONING test DROP TABLE TableA; # Testing TRUNCATE PARTITION @@ -1003,7 +1003,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL AUTO_INCREMENT, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = MEMORY, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = MEMORY, diff --git a/mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result b/mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result index 8461d4136e0ac..fea80a3feb38a 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result @@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB; Table Create Table TableB CREATE TABLE `TableB` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT PARTITION_NAME, IF(TABLE_ROWS, 'YES', 'NO') AS HAVE_TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME HAVE_TABLE_ROWS parta NO @@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -270,7 +270,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -297,7 +297,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after KEY PARTITIONING test DROP TABLE TableA; # 2.0 HASH partitioning mgm @@ -363,7 +363,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -391,7 +391,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -427,7 +427,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -506,7 +506,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -533,7 +533,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after HASH PARTITIONING test DROP TABLE TableA; # 3.0 RANGE partitioning mgm @@ -588,7 +588,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MyISAM, @@ -619,7 +619,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MyISAM, @@ -657,7 +657,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MyISAM, @@ -737,7 +737,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MyISAM, @@ -764,7 +764,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after RANGE PARTITIONING test DROP TABLE TableA; # 4.0 LIST partitioning mgm @@ -819,7 +819,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MyISAM, @@ -850,7 +850,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MyISAM, @@ -888,7 +888,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MyISAM, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MyISAM, @@ -960,7 +960,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MyISAM, @@ -984,7 +984,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after LIST PARTITIONING test DROP TABLE TableA; # Testing TRUNCATE PARTITION @@ -1003,7 +1003,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL AUTO_INCREMENT, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = MyISAM, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = MyISAM, diff --git a/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result b/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result index 4c541d9467ee2..418650eb438a3 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result @@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB; Table Create Table TableB CREATE TABLE `tableb` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT PARTITION_NAME, IF(TABLE_ROWS, 'YES', 'NO') AS HAVE_TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME HAVE_TABLE_ROWS parta NO @@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -263,7 +263,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -288,7 +288,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after KEY PARTITIONING test DROP TABLE TableA; # 2.0 HASH partitioning mgm @@ -354,7 +354,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -382,7 +382,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -418,7 +418,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -490,7 +490,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -515,7 +515,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after HASH PARTITIONING test DROP TABLE TableA; # 3.0 RANGE partitioning mgm @@ -570,7 +570,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partB` VALUES LESS THAN (7) ENGINE = InnoDB, @@ -601,7 +601,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partB` VALUES LESS THAN (7) ENGINE = InnoDB, @@ -639,7 +639,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = InnoDB, @@ -712,7 +712,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = InnoDB, @@ -738,7 +738,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after RANGE PARTITIONING test DROP TABLE TableA; # 4.0 LIST partitioning mgm @@ -793,7 +793,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION `partB` VALUES IN (2,10,11) ENGINE = InnoDB, @@ -824,7 +824,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION `partB` VALUES IN (2,10,11) ENGINE = InnoDB, @@ -862,7 +862,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = InnoDB, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = InnoDB, @@ -927,7 +927,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = InnoDB, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = InnoDB, @@ -951,7 +951,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after LIST PARTITIONING test DROP TABLE TableA; # Testing TRUNCATE PARTITION @@ -970,7 +970,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL AUTO_INCREMENT, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = InnoDB, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = InnoDB, diff --git a/mysql-test/suite/parts/r/partition_mgm_lc1_memory.result b/mysql-test/suite/parts/r/partition_mgm_lc1_memory.result index 8f934506ee20f..96e72cbfb4184 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc1_memory.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc1_memory.result @@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB; Table Create Table TableB CREATE TABLE `tableb` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT PARTITION_NAME, IF(TABLE_ROWS, 'YES', 'NO') AS HAVE_TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME HAVE_TABLE_ROWS parta NO @@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -263,7 +263,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -288,7 +288,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after KEY PARTITIONING test DROP TABLE TableA; # 2.0 HASH partitioning mgm @@ -354,7 +354,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -382,7 +382,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -418,7 +418,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -490,7 +490,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -515,7 +515,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after HASH PARTITIONING test DROP TABLE TableA; # 3.0 RANGE partitioning mgm @@ -570,7 +570,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MEMORY, @@ -601,7 +601,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MEMORY, @@ -639,7 +639,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MEMORY, @@ -712,7 +712,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MEMORY, @@ -738,7 +738,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after RANGE PARTITIONING test DROP TABLE TableA; # 4.0 LIST partitioning mgm @@ -793,7 +793,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MEMORY, @@ -824,7 +824,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MEMORY, @@ -862,7 +862,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MEMORY, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MEMORY, @@ -927,7 +927,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MEMORY, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MEMORY, @@ -951,7 +951,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after LIST PARTITIONING test DROP TABLE TableA; # Testing TRUNCATE PARTITION @@ -970,7 +970,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL AUTO_INCREMENT, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = MEMORY, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = MEMORY, diff --git a/mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result b/mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result index 47e07ecc3a6bb..0ab07cdc993be 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result @@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB; Table Create Table TableB CREATE TABLE `tableb` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT PARTITION_NAME, IF(TABLE_ROWS, 'YES', 'NO') AS HAVE_TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME HAVE_TABLE_ROWS parta NO @@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -263,7 +263,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -288,7 +288,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after KEY PARTITIONING test DROP TABLE TableA; # 2.0 HASH partitioning mgm @@ -354,7 +354,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -382,7 +382,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -418,7 +418,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -490,7 +490,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -515,7 +515,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after HASH PARTITIONING test DROP TABLE TableA; # 3.0 RANGE partitioning mgm @@ -570,7 +570,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MyISAM, @@ -601,7 +601,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MyISAM, @@ -639,7 +639,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MyISAM, @@ -712,7 +712,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MyISAM, @@ -738,7 +738,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after RANGE PARTITIONING test DROP TABLE TableA; # 4.0 LIST partitioning mgm @@ -793,7 +793,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MyISAM, @@ -824,7 +824,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MyISAM, @@ -862,7 +862,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MyISAM, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MyISAM, @@ -927,7 +927,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MyISAM, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MyISAM, @@ -951,7 +951,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after LIST PARTITIONING test DROP TABLE TableA; # Testing TRUNCATE PARTITION @@ -970,7 +970,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL AUTO_INCREMENT, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = MyISAM, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = MyISAM, diff --git a/mysql-test/suite/parts/r/partition_smallint_innodb.result b/mysql-test/suite/parts/r/partition_smallint_innodb.result index dc4ed609212e2..d6e1cc2f728f1 100644 --- a/mysql-test/suite/parts/r/partition_smallint_innodb.result +++ b/mysql-test/suite/parts/r/partition_smallint_innodb.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` smallint(5) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -45,7 +45,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` smallint(5) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 8 insert into t2 values (65535), (65534), (65533), (65532); @@ -77,7 +77,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` smallint(6) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 7 insert into t3 values (32767), (32766), (32765), (32764), (-32768), (-32767), (1), (-1), (0); diff --git a/mysql-test/suite/parts/r/partition_smallint_myisam.result b/mysql-test/suite/parts/r/partition_smallint_myisam.result index dac160a5e8ca8..7b4c199dc6b9c 100644 --- a/mysql-test/suite/parts/r/partition_smallint_myisam.result +++ b/mysql-test/suite/parts/r/partition_smallint_myisam.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` smallint(5) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -45,7 +45,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` smallint(5) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 8 insert into t2 values (65535), (65534), (65533), (65532); @@ -77,7 +77,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` smallint(6) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 7 insert into t3 values (32767), (32766), (32765), (32764), (-32768), (-32767), (1), (-1), (0); diff --git a/mysql-test/suite/parts/r/partition_special_innodb.result b/mysql-test/suite/parts/r/partition_special_innodb.result index c36eda2345a2d..27f8f0a9d5c93 100644 --- a/mysql-test/suite/parts/r/partition_special_innodb.result +++ b/mysql-test/suite/parts/r/partition_special_innodb.result @@ -12,7 +12,7 @@ t1 CREATE TABLE `t1` ( `c` varchar(50) NOT NULL, `d` enum('m','w') NOT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`,`b`,`c`,`d`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -54,7 +54,7 @@ t1 CREATE TABLE `t1` ( `h` tinyint(4) NOT NULL, `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -104,7 +104,7 @@ t1 CREATE TABLE `t1` ( `h1` tinyint(4) NOT NULL, `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`a1`,`b1`,`c1`,`d1`,`e1`,`f1`,`g1`,`h1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`a1`,`b1`,`c1`,`d1`,`e1`,`f1`,`g1`,`h1`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -184,7 +184,7 @@ t1 CREATE TABLE `t1` ( `h3` tinyint(4) NOT NULL, `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`a1`,`b1`,`c1`,`d1`,`e1`,`f1`,`g1`,`h1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, diff --git a/mysql-test/suite/parts/r/partition_special_myisam.result b/mysql-test/suite/parts/r/partition_special_myisam.result index 29f3f1d61b706..f6ceef4fc7701 100644 --- a/mysql-test/suite/parts/r/partition_special_myisam.result +++ b/mysql-test/suite/parts/r/partition_special_myisam.result @@ -12,7 +12,7 @@ t1 CREATE TABLE `t1` ( `c` varchar(50) NOT NULL, `d` enum('m','w') NOT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`,`b`,`c`,`d`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -54,7 +54,7 @@ t1 CREATE TABLE `t1` ( `h` tinyint(4) NOT NULL, `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -104,7 +104,7 @@ t1 CREATE TABLE `t1` ( `h1` tinyint(4) NOT NULL, `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`a1`,`b1`,`c1`,`d1`,`e1`,`f1`,`g1`,`h1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`a1`,`b1`,`c1`,`d1`,`e1`,`f1`,`g1`,`h1`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -184,7 +184,7 @@ t1 CREATE TABLE `t1` ( `h3` tinyint(4) NOT NULL, `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`a1`,`b1`,`c1`,`d1`,`e1`,`f1`,`g1`,`h1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, diff --git a/mysql-test/suite/parts/r/partition_syntax_innodb.result b/mysql-test/suite/parts/r/partition_syntax_innodb.result index 8171141127a31..eb0f9de5cdbde 100644 --- a/mysql-test/suite/parts/r/partition_syntax_innodb.result +++ b/mysql-test/suite/parts/r/partition_syntax_innodb.result @@ -657,7 +657,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 2) (PARTITION `part1` VALUES IN (NULL) ENGINE = InnoDB, PARTITION `part3` VALUES IN (1) ENGINE = InnoDB) @@ -684,7 +684,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 2) (PARTITION `part1` VALUES IN (NULL) ENGINE = InnoDB, PARTITION `part2` VALUES IN (0) ENGINE = InnoDB, @@ -718,7 +718,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) DROP TABLE t1; @@ -740,7 +740,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part1` ENGINE = InnoDB, PARTITION `part2` ENGINE = InnoDB) @@ -825,7 +825,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (10) @@ -861,7 +861,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -886,7 +886,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -911,7 +911,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 1 @@ -936,7 +936,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 1 @@ -1680,7 +1680,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part1` ENGINE = InnoDB, PARTITION `part2` ENGINE = InnoDB) @@ -1709,7 +1709,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (1000) diff --git a/mysql-test/suite/parts/r/partition_syntax_myisam.result b/mysql-test/suite/parts/r/partition_syntax_myisam.result index 16882b33176a3..23de15e33c1cd 100644 --- a/mysql-test/suite/parts/r/partition_syntax_myisam.result +++ b/mysql-test/suite/parts/r/partition_syntax_myisam.result @@ -657,7 +657,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 2) (PARTITION `part1` VALUES IN (NULL) ENGINE = MyISAM, PARTITION `part3` VALUES IN (1) ENGINE = MyISAM) @@ -692,7 +692,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`f_int1` MOD 2) (PARTITION `part1` VALUES IN (NULL) ENGINE = MyISAM, PARTITION `part2` VALUES IN (0) ENGINE = MyISAM, @@ -736,7 +736,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) unified filelist @@ -764,7 +764,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part1` ENGINE = MyISAM, PARTITION `part2` ENGINE = MyISAM) @@ -857,7 +857,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (10) @@ -909,7 +909,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 2 @@ -942,7 +942,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 2 @@ -979,7 +979,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) PARTITIONS 1 @@ -1010,7 +1010,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) SUBPARTITIONS 1 @@ -1762,7 +1762,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f_int1`) (PARTITION `part1` ENGINE = MyISAM, PARTITION `part2` ENGINE = MyISAM) @@ -1799,7 +1799,7 @@ t1 CREATE TABLE `t1` ( `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f_int1`) SUBPARTITION BY HASH (`f_int1`) (PARTITION `part1` VALUES LESS THAN (1000) diff --git a/mysql-test/suite/parts/r/partition_tinyint_innodb.result b/mysql-test/suite/parts/r/partition_tinyint_innodb.result index 19f0e2c57c478..3dbbc4b709715 100644 --- a/mysql-test/suite/parts/r/partition_tinyint_innodb.result +++ b/mysql-test/suite/parts/r/partition_tinyint_innodb.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, @@ -45,7 +45,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 8 insert into t2 values (255), (254), (253), (252); @@ -77,7 +77,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` tinyint(4) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 7 insert into t3 values (127), (126), (125), (124), (-128), (-127), (1), (-1), (0); diff --git a/mysql-test/suite/parts/r/partition_tinyint_myisam.result b/mysql-test/suite/parts/r/partition_tinyint_myisam.result index 9ad4927697db7..7258c44e18928 100644 --- a/mysql-test/suite/parts/r/partition_tinyint_myisam.result +++ b/mysql-test/suite/parts/r/partition_tinyint_myisam.result @@ -9,7 +9,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, @@ -45,7 +45,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 8 insert into t2 values (255), (254), (253), (252); @@ -77,7 +77,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `a` tinyint(4) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) PARTITIONS 7 insert into t3 values (127), (126), (125), (124), (-128), (-127), (1), (-1), (0); diff --git a/mysql-test/suite/parts/r/reorganize_partition_innodb.result b/mysql-test/suite/parts/r/reorganize_partition_innodb.result index a0a3344a39d96..b56cb6bbaeb2e 100644 --- a/mysql-test/suite/parts/r/reorganize_partition_innodb.result +++ b/mysql-test/suite/parts/r/reorganize_partition_innodb.result @@ -13,7 +13,7 @@ SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( `a` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) @@ -25,7 +25,7 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) @@ -34,7 +34,7 @@ SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( `a` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) @@ -48,7 +48,7 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) @@ -65,7 +65,7 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) @@ -81,7 +81,7 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) @@ -97,7 +97,7 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) @@ -151,7 +151,7 @@ SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( `a` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) SUBPARTITION BY HASH (`a`) SUBPARTITIONS 2 diff --git a/mysql-test/suite/parts/r/rpl_partition.result b/mysql-test/suite/parts/r/rpl_partition.result index 41df816fcc046..0ec36a2c72af8 100644 --- a/mysql-test/suite/parts/r/rpl_partition.result +++ b/mysql-test/suite/parts/r/rpl_partition.result @@ -134,7 +134,7 @@ Create Table CREATE TABLE `t3` ( `fkid` mediumint(9) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`id`) SUBPARTITION BY HASH (`id`) SUBPARTITIONS 2 diff --git a/mysql-test/suite/parts/r/show_create.result b/mysql-test/suite/parts/r/show_create.result index c7b0ecdb6d9d1..d452628950416 100644 --- a/mysql-test/suite/parts/r/show_create.result +++ b/mysql-test/suite/parts/r/show_create.result @@ -5,14 +5,14 @@ show create table t1; Table Create Table t1 CREATE TABLE "t1" ( "select" int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ("select") (PARTITION "select" VALUES LESS THAN MAXVALUE ENGINE = MyISAM) show create table t2; Table Create Table t2 CREATE TABLE "t2" ( "f1" int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ("f1") (PARTITION "p1" VALUES LESS THAN MAXVALUE ENGINE = MyISAM) set sql_quote_show_create=0; @@ -20,14 +20,14 @@ show create table t1; Table Create Table t1 CREATE TABLE t1 ( "select" int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ("select") (PARTITION "select" VALUES LESS THAN MAXVALUE ENGINE = MyISAM) show create table t2; Table Create Table t2 CREATE TABLE t2 ( f1 int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (f1) (PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) set sql_mode=default; @@ -35,14 +35,14 @@ show create table t1; Table Create Table t1 CREATE TABLE t1 ( `select` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`select`) (PARTITION `select` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) show create table t2; Table Create Table t2 CREATE TABLE t2 ( f1 int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (f1) (PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) set sql_quote_show_create=1; @@ -50,14 +50,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `select` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`select`) (PARTITION `select` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `f1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f1`) (PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) flush tables; @@ -65,14 +65,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `select` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`select`) (PARTITION `select` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `f1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`f1`) (PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) set sql_mode=ansi_quotes; @@ -80,14 +80,14 @@ show create table t1; Table Create Table t1 CREATE TABLE "t1" ( "select" int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ("select") (PARTITION "select" VALUES LESS THAN MAXVALUE ENGINE = MyISAM) show create table t2; Table Create Table t2 CREATE TABLE "t2" ( "f1" int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE ("f1") (PARTITION "p1" VALUES LESS THAN MAXVALUE ENGINE = MyISAM) drop table t1, t2; @@ -99,7 +99,7 @@ show create table t_partition; Table Create Table t_partition CREATE TABLE `t_partition` ( `f1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`f1`) PARTITIONS 2 drop table t_partition; diff --git a/mysql-test/suite/parts/t/alter_data_directory_innodb.test b/mysql-test/suite/parts/t/alter_data_directory_innodb.test index ac15e9bec6c7a..def04e1417315 100644 --- a/mysql-test/suite/parts/t/alter_data_directory_innodb.test +++ b/mysql-test/suite/parts/t/alter_data_directory_innodb.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_partition.inc +--source include/have_symlink.inc --echo # --echo # MDEV-15953 Alter InnoDB Partitioned Table Moves Files (which were originally not in the datadir) to the datadir diff --git a/mysql-test/suite/parts/t/engine_defined_part_attributes.test b/mysql-test/suite/parts/t/engine_defined_part_attributes.test new file mode 100644 index 0000000000000..1245066300c54 --- /dev/null +++ b/mysql-test/suite/parts/t/engine_defined_part_attributes.test @@ -0,0 +1,221 @@ +--echo # +--echo # MDEV-5271 Support engine-defined attributes per partition +--echo # + +--source include/have_partition.inc +--source include/have_innodb.inc + +--echo # partitioned tables + +CREATE TABLE `t1` ( + `id` INT +) ENGINE=InnoDB ENCRYPTED="YES" PARTITION BY RANGE(id) ( + PARTITION pt1 VALUES LESS THAN (100) ENCRYPTED="NO" ENCRYPTION_KEY_ID=1, + PARTITION pt2 VALUES LESS THAN MAXVALUE ENCRYPTED="DEFAULT" ENCRYPTION_KEY_ID=1 +); +SHOW CREATE TABLE `t1`; + +INSERT INTO t1 VALUES (1), (2), (3); +DELETE FROM t1 WHERE id = 1; +UPDATE t1 SET id = 4 WHERE id = 3; +SELECT * FROM t1 WHERE id IN (2, 3); + +DROP TABLE `t1`; + +--error ER_CANT_CREATE_TABLE +CREATE TABLE `t2` ( + `id` INT +) ENGINE=InnoDB ENCRYPTED="YES" ENCRYPTION_KEY_ID=2 PARTITION BY RANGE(id) ( + PARTITION pt1 VALUES LESS THAN (100), + PARTITION pt2 VALUES LESS THAN MAXVALUE +); + +--error ER_CANT_CREATE_TABLE +CREATE TABLE `t3` ( + `id` INT +) ENGINE=InnoDB ENCRYPTED="NO" PARTITION BY RANGE(id) ( + PARTITION pt1 VALUES LESS THAN (100) ENCRYPTED="YES" ENCRYPTION_KEY_ID=2, + PARTITION pt2 VALUES LESS THAN MAXVALUE +); + +CREATE TABLE `t4` ( + `id` INT +) ENGINE=InnoDB ENCRYPTED="NO"; +SHOW CREATE TABLE `t4`; + +ALTER TABLE `t4` PARTITION BY RANGE(id) ( + PARTITION pt1 VALUES LESS THAN (100) ENCRYPTED="NO", + PARTITION pt2 VALUES LESS THAN MAXVALUE ENCRYPTED="DEFAULT" +); +SHOW CREATE TABLE `t4`; + +ALTER TABLE `t4` PARTITION BY RANGE(id) ( + PARTITION pt1 VALUES LESS THAN (100), + PARTITION pt2 VALUES LESS THAN MAXVALUE +); +SHOW CREATE TABLE `t4`; + +--error ER_CANT_CREATE_TABLE +ALTER TABLE `t4` PARTITION BY RANGE(id) ( + PARTITION pt1 VALUES LESS THAN (100) ENCRYPTED="YES" ENCRYPTION_KEY_ID=2, + PARTITION pt2 VALUES LESS THAN MAXVALUE ENCRYPTED="DEFAULT" +); + +DROP TABLE `t4`; + +--echo # subpartitioned tables + +CREATE TABLE `t5` ( + `id` INT +) ENGINE=InnoDB ENCRYPTED="NO" PARTITION BY RANGE(id) +SUBPARTITION BY HASH(id) +SUBPARTITIONS 2 ( + PARTITION pt1 VALUES LESS THAN (100), + PARTITION pt2 VALUES LESS THAN MAXVALUE +); +SHOW CREATE TABLE `t5`; + +DROP TABLE `t5`; + +--error ER_CANT_CREATE_TABLE +CREATE TABLE `t6` ( + `id` INT +) ENGINE=InnoDB PARTITION BY RANGE(id) +SUBPARTITION BY HASH(id) +SUBPARTITIONS 2 ( + PARTITION pt1 VALUES LESS THAN (100) ENCRYPTED="YES", + PARTITION pt2 VALUES LESS THAN MAXVALUE +); + +--error ER_PARSE_ERROR +CREATE TABLE `t7` ( + id INT +) ENGINE=InnoDB PARTITION BY RANGE(id) +SUBPARTITION BY HASH(id) ( + PARTITION pt1 VALUES LESS THAN (100)( + SUBPARTITION spt1 ENCRYPTED="NO", + SUBPARTITION spt2 + ), + PARTITION pt2 VALUES LESS THAN MAXVALUE ( + SUBPARTITION spt3, + SUBPARTITION spt4 + ) +); + +CREATE TABLE `t8` ( + id INT +) ENGINE=InnoDB ENCRYPTED="NO" PARTITION BY RANGE(id) +SUBPARTITION BY HASH(id) ( + PARTITION pt1 VALUES LESS THAN (100) ( + SUBPARTITION spt1, + SUBPARTITION spt2 + ), + PARTITION pt2 VALUES LESS THAN MAXVALUE ( + SUBPARTITION spt3, + SUBPARTITION spt4 + ) +); +SHOW CREATE TABLE `t8`; + +DROP TABLE `t8`; + +CREATE TABLE `t9` ( + id INT +) ENGINE=InnoDB PARTITION BY RANGE(id) +SUBPARTITION BY HASH(id) ( + PARTITION pt1 VALUES LESS THAN (100) ENCRYPTED="NO" ( + SUBPARTITION spt1, + SUBPARTITION spt2 + ), + PARTITION pt2 VALUES LESS THAN MAXVALUE ( + SUBPARTITION spt3, + SUBPARTITION spt4 + ) +); +SHOW CREATE TABLE `t9`; + +DROP TABLE `t9`; + +--error ER_CANT_CREATE_TABLE +CREATE TABLE `t10` ( + id INT +) ENGINE=InnoDB PARTITION BY RANGE(id) +SUBPARTITION BY HASH(id) ( + PARTITION pt1 VALUES LESS THAN (100) ENCRYPTED="YES" ( + SUBPARTITION spt1, + SUBPARTITION spt2 + ), + PARTITION pt2 VALUES LESS THAN MAXVALUE ( + SUBPARTITION spt3, + SUBPARTITION spt4 + ) +); + +CREATE TABLE `t11` ( + id INT +) ENGINE=InnoDB ENCRYPTED="YES" PARTITION BY RANGE(id) +SUBPARTITION BY HASH(id) ( + PARTITION pt1 VALUES LESS THAN (100) ENCRYPTED="NO" ( + SUBPARTITION spt1, + SUBPARTITION spt2 + ), + PARTITION pt2 VALUES LESS THAN MAXVALUE ENCRYPTED="NO" ( + SUBPARTITION spt3, + SUBPARTITION spt4 + ) +); +SHOW CREATE TABLE `t11`; + +DROP TABLE `t11`; + +--echo # +--echo # MDEV-27605 ALTER .. ADD PARTITION uses wrong partition-level option values +--echo # + +--let $restart_parameters= --innodb-sys-tablespaces +--source include/restart_mysqld.inc + +CREATE TABLE `t12` ( + id INT +) ENGINE=InnoDB PARTITION BY HASH(id) +( + pt1 PAGE_COMPRESSED=0 +); +--sorted_result +SELECT name, flag FROM information_schema.innodb_sys_tablespaces WHERE name like 'test/t12%'; + +ALTER TABLE `t12` ADD PARTITION ( + PARTITION pt2 PAGE_COMPRESSED=1 +); +--sorted_result +SELECT name, flag FROM information_schema.innodb_sys_tablespaces WHERE name like 'test/t12%'; + +ALTER TABLE `t12` ADD PARTITION ( + PARTITION pt3 PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=3 +); +--sorted_result +SELECT name, flag FROM information_schema.innodb_sys_tablespaces WHERE name like 'test/t12%'; + +DROP TABLE `t12`; + +CREATE TABLE `t13` ( + `id` INT +) ENGINE=InnoDB PAGE_COMPRESSED=1 PARTITION BY RANGE(id) ( + PARTITION pt1 VALUES LESS THAN (100) PAGE_COMPRESSED=0, + PARTITION pt2 VALUES LESS THAN (200) PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=3, + PARTITION pt3 VALUES LESS THAN MAXVALUE +); +SHOW CREATE TABLE `t13`; +--sorted_result +SELECT name, flag FROM information_schema.innodb_sys_tablespaces WHERE name like 'test/t13%'; + +ALTER TABLE `t13` PARTITION BY RANGE(id) ( + PARTITION pt1 VALUES LESS THAN (100) PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=3, + PARTITION pt2 VALUES LESS THAN (200), + PARTITION pt3 VALUES LESS THAN MAXVALUE PAGE_COMPRESSED=0 +); +SHOW CREATE TABLE `t13`; +--sorted_result +SELECT name, flag FROM information_schema.innodb_sys_tablespaces WHERE name like 'test/t13%'; + +DROP TABLE `t13`; diff --git a/mysql-test/suite/parts/t/part_ctype_tis620.test b/mysql-test/suite/parts/t/part_ctype_tis620.test new file mode 100644 index 0000000000000..2e5bcd651b1a7 --- /dev/null +++ b/mysql-test/suite/parts/t/part_ctype_tis620.test @@ -0,0 +1,52 @@ +--source include/have_partition.inc +--source include/have_tis620.inc + +--echo # +--echo # MDEV-27768 MDEV-25440: Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit +--echo # + +--error ER_RANGE_NOT_INCREASING_ERROR +CREATE TABLE t1 ( + a CHAR +) COLLATE=tis620_thai_nopad_ci +PARTITION BY RANGE COLUMNS (a) +( + PARTITION p0 VALUES LESS THAN (''), + PARTITION p VALUES LESS THAN ('') +); + +--error ER_RANGE_NOT_INCREASING_ERROR +CREATE TABLE t1 ( + a CHAR +) COLLATE=tis620_thai_nopad_ci +PARTITION BY RANGE COLUMNS (a) +( + PARTITION p0 VALUES LESS THAN (''), + PARTITION p VALUES LESS THAN (' ') +); + +--error ER_RANGE_NOT_INCREASING_ERROR +CREATE TABLE t1 ( + a CHAR +) COLLATE=tis620_thai_nopad_ci +PARTITION BY RANGE COLUMNS (a) +( + PARTITION p0 VALUES LESS THAN (' '), + PARTITION p VALUES LESS THAN ('') +); + + +CREATE TABLE t1 +( + id INT NOT NULL, + data VARCHAR(2), + KEY data_id (data(1),id) +) COLLATE tis620_thai_nopad_ci ENGINE=MyISAM +PARTITION BY RANGE (id) +( + PARTITION p10 VALUES LESS THAN (10), + PARTITION p20 VALUES LESS THAN (20) +); +INSERT INTO t1 VALUES (4, 'ab'), (14, 'ab'), (19,''),(9,'') ; +SELECT id FROM t1 WHERE data='' ORDER BY id; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/t/partition_alter_innodb.test b/mysql-test/suite/parts/t/partition_alter_innodb.test index 4ea3a0da88c24..844b2084531b4 100644 --- a/mysql-test/suite/parts/t/partition_alter_innodb.test +++ b/mysql-test/suite/parts/t/partition_alter_innodb.test @@ -9,3 +9,11 @@ SET GLOBAL innodb_read_only_compressed=OFF; --disable_query_log SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed; --enable_query_log +--echo # +--echo # MDEV-28079 Shutdown hangs after altering innodb partition fts table +--echo # +CREATE TABLE t1(f1 INT, f2 CHAR(100))ENGINE=InnoDB PARTITION BY HASH(f1) PARTITIONS 2; +ALTER TABLE t1 ADD FULLTEXT(f2); +--source ../innodb/include/wait_all_purged.inc +DROP TABLE t1; +--echo # End of 10.6 tests diff --git a/mysql-test/suite/parts/t/partition_alter_myisam.test b/mysql-test/suite/parts/t/partition_alter_myisam.test index 326cf52b018bf..d3abb8842e1a5 100644 --- a/mysql-test/suite/parts/t/partition_alter_myisam.test +++ b/mysql-test/suite/parts/t/partition_alter_myisam.test @@ -1,5 +1,4 @@ --source include/have_partition.inc ---source include/have_symlink.inc --let $engine=MyISAM --source inc/part_alter_values.inc diff --git a/mysql-test/suite/parts/t/partition_repair_myisam.test b/mysql-test/suite/parts/t/partition_repair_myisam.test index 3f43127a0c821..c4c05cc08d311 100644 --- a/mysql-test/suite/parts/t/partition_repair_myisam.test +++ b/mysql-test/suite/parts/t/partition_repair_myisam.test @@ -150,7 +150,7 @@ while ($i) # 2 - after _mi_mark_file_changed (only marked index as opened) # 3 - after write_record (updated datafile + not closed/updated index) # 4 - after flush_cached_blocks (updated index/datafiles, not closed index) -# 5 - (Not used) after mi_state_info_write (fully uppdated/closed index file) +# 5 - (Not used) after mi_state_info_write (fully updated/closed index file) # (this was verified to be a harmless crash, since everything was written) # 6 - partly updated datafile (insert 6 small records, delete 5,3,1, # insert one larger record (2.5 X small) and break in gdb before it has diff --git a/mysql-test/suite/parts/t/partition_special_myisam.test b/mysql-test/suite/parts/t/partition_special_myisam.test index 5a573259373c1..b6f25484f3ac2 100644 --- a/mysql-test/suite/parts/t/partition_special_myisam.test +++ b/mysql-test/suite/parts/t/partition_special_myisam.test @@ -74,6 +74,7 @@ COMMIT; --connection con3 --reap +--remove_file $MYSQLD_DATADIR/test/load.in DROP TABLE t1; --disconnect con3 diff --git a/mysql-test/suite/parts/t/reorganize_partition_innodb.test b/mysql-test/suite/parts/t/reorganize_partition_innodb.test index db73650c54bc0..77109c38c96c7 100644 --- a/mysql-test/suite/parts/t/reorganize_partition_innodb.test +++ b/mysql-test/suite/parts/t/reorganize_partition_innodb.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_partition.inc +--source include/have_symlink.inc --echo # --echo # MDEV-15953 Alter InnoDB Partitioned Table Moves Files (which were originally not in the datadir) to the datadir diff --git a/mysql-test/suite/perfschema/disabled.def b/mysql-test/suite/perfschema/disabled.def index fb97b011567f8..935548fce761d 100644 --- a/mysql-test/suite/perfschema/disabled.def +++ b/mysql-test/suite/perfschema/disabled.def @@ -53,3 +53,13 @@ show_misc: todo show_plugin: todo status_reprepare:why P_S filters out Com_* variables? + +processlist: todo +processlist_acl: todo +processlist_port: todo +processlist_no_pfs: todo +ddl_processlist: todo +dml_processlist: todo +processlist_57: todo +processlist_anonymous: todo +processlist_reg_user: todo diff --git a/mysql-test/suite/perfschema/include/processlist_load.inc b/mysql-test/suite/perfschema/include/processlist_load.inc new file mode 100644 index 0000000000000..5a14ea17d073c --- /dev/null +++ b/mysql-test/suite/perfschema/include/processlist_load.inc @@ -0,0 +1,39 @@ +# ../include/processlist_load.inc +# +# SUMMARY +# +# Execute PROCESSLIST queries, sorted by user +# +# USAGE +# +# Example: Using processlist_set.inc to set @@global.performance_schema_show_processlist +# +# let $pfs_spl = on/off +# --source ../include/processlist_set.inc +# --source ../include/processlist_load.inc +# +# Columns +# 1 2 3 4 5 6
, Syntax Rules, 2)a) # 2) If a
TPD is specified, then: # a)
shall not be specified. @@ -93,10 +93,21 @@ t CREATE TABLE `t` ( `e` date NOT NULL, PERIOD FOR `mytime` (`s`, `e`), CONSTRAINT `mytime` CHECK (`x` > 1) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert t values (2, '2001-01-01', '2001-01-01'); ERROR 23000: CONSTRAINT `mytime_1` failed for `test`.`t` show status like "Feature_application_time_periods"; Variable_name Value Feature_application_time_periods 6 drop table t; +# MDEV-29387: Period name with more than 32 symbols crashes the server +# +# test 34 symbols +create table t2 (s date, e date, +period for `abcd123456789012345678901234567890` (s,e)); +drop table t2; +# test 64 symbols +create table t2 (s date, e date, period for +`abcd123456789012345678901234567890123456789012345678901234567890` + (s,e)); +drop table t2; diff --git a/mysql-test/suite/period/r/delete.result b/mysql-test/suite/period/r/delete.result index d8dae7b2a994e..2b0a97e03d8e1 100644 --- a/mysql-test/suite/period/r/delete.result +++ b/mysql-test/suite/period/r/delete.result @@ -397,3 +397,27 @@ insert into t1 values (1,'2020-01-01','2020-02-20'); delete from t1 for portion of se from '2020-01-30' to '2020-01-31'; drop table t1; # End of 10.5 tests +# +# MDEV-19190 Assertion `part_share->auto_inc_initialized` failed in +# ha_partition::get_auto_increment +# +create table t1 (id int, s date, e date, period for app(s,e)) +partition by key(id); +insert into t1 (s,e) values ('2023-07-21','2024-06-07'); +alter table t1 modify id int auto_increment key; +delete from t1 for portion of app from '2023-07-20' to '2024-05-23'; +select * from t1; +id s e +2 2024-05-23 2024-06-07 +drop table t1; +create table t1 (id int, s date, e date, period for app(s,e)) +partition by key(id); +insert into t1 (s,e) values ('2023-07-21','2024-06-07'); +alter table t1 modify id int auto_increment key; +delete from t1 for portion of app from '2023-07-20' to '2024-05-23'; +select * from t1; +id s e +2 2024-05-23 2024-06-07 +drop table t1; +drop table log_tbl; +drop procedure log; diff --git a/mysql-test/suite/period/r/overlaps.result b/mysql-test/suite/period/r/overlaps.result index b8f23ce413c8e..78b1ac18b8da3 100644 --- a/mysql-test/suite/period/r/overlaps.result +++ b/mysql-test/suite/period/r/overlaps.result @@ -10,7 +10,7 @@ t CREATE TABLE `t` ( `e` date NOT NULL, PERIOD FOR `p` (`s`, `e`), PRIMARY KEY (`id`,`p` WITHOUT OVERLAPS) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`id`) insert into t values (1, '2003-01-01', '2003-03-01'), (1, '2003-05-01', '2003-07-01'); @@ -148,7 +148,7 @@ t CREATE TABLE `t` ( PERIOD FOR `p` (`s`, `e`), PRIMARY KEY (`id`,`p` WITHOUT OVERLAPS), UNIQUE KEY `u` (`u`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t values (1, 1, '2003-03-01', '2003-05-01'); insert into t values (1, 2, '2003-05-01', '2003-07-01'); insert into t values (1, 3, '2003-04-01', '2003-05-01'); @@ -167,7 +167,7 @@ t CREATE TABLE `t` ( PERIOD FOR `p` (`s`, `e`), PRIMARY KEY (`id`,`p` WITHOUT OVERLAPS), UNIQUE KEY `u` (`u`,`p` WITHOUT OVERLAPS) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t values (2, NULL, '2003-03-01', '2003-05-01'); insert into t values (2, NULL, '2003-03-01', '2003-05-01'); ERROR 23000: Duplicate entry '2-2003-05-01-2003-03-01' for key 'PRIMARY' @@ -211,7 +211,7 @@ t CREATE TABLE `t` ( `y` int(11) DEFAULT NULL, PERIOD FOR `p` (`s`, `e`), PRIMARY KEY (`id`,`p` WITHOUT OVERLAPS) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t drop y; create or replace table t1 like t; show create table t1; @@ -222,7 +222,7 @@ t1 CREATE TABLE `t1` ( `e` date NOT NULL, PERIOD FOR `p` (`s`, `e`), PRIMARY KEY (`id`,`p` WITHOUT OVERLAPS) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create or replace table t1 (x int, s date, e date, period for p(s,e), primary key(x, p without overlaps)); @@ -313,7 +313,7 @@ t1 CREATE TABLE `t1` ( `e` date NOT NULL, PERIOD FOR `p` (`s`, `e`), UNIQUE KEY `f` (`f`,`p` WITHOUT OVERLAPS) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME LIMIT 1000 (PARTITION `p1` HISTORY ENGINE = InnoDB, PARTITION `p2` HISTORY ENGINE = InnoDB, @@ -351,3 +351,101 @@ primary key(id, p without overlaps) ) engine=heap partition by hash(id); update t set id = 1; drop table t, t1; +# +# MDEV-30415 PERIOD false positive overlap wtih utf8mb4_unicode_nopad_ci +# +CREATE TABLE t1 ( +datetime_column_name_1 DATETIME(6) NOT NULL, +datetime_column_name_2 DATETIME(6) NOT NULL, +text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL, +PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2), +UNIQUE KEY index_name (text_column_name(191),period_name WITHOUT OVERLAPS) +) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; +INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name) +VALUES +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'), +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '); +TRUNCATE TABLE t1; +INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name) +VALUES +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '), +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'); +DROP TABLE t1; +CREATE TABLE `t1` ( +datetime_column_name_1 DATETIME(6) NOT NULL, +datetime_column_name_2 DATETIME(6) NOT NULL, +text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL, +PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2), +UNIQUE KEY index_name (text_column_name(191),period_name WITHOUT OVERLAPS) +) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; +INSERT INTO t1 VALUES +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def '), +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def'); +TRUNCATE TABLE t1; +INSERT INTO t1 VALUES +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def'), +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def '), +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def '); +SELECT *, LENGTH(text_column_name) FROM t1; +datetime_column_name_1 datetime_column_name_2 text_column_name LENGTH(text_column_name) +2000-01-01 00:00:00.000000 2001-01-01 00:00:00.000000 def 3 +2000-01-01 00:00:00.000000 2001-01-01 00:00:00.000000 def 4 +2000-01-01 00:00:00.000000 2001-01-01 00:00:00.000000 def 5 +DROP TABLE t1; +CREATE TABLE t1 ( +datetime_column_name_1 DATETIME(6) NOT NULL, +datetime_column_name_2 DATETIME(6) NOT NULL, +text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL, +PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2), +UNIQUE KEY index_name (text_column_name(3),period_name WITHOUT OVERLAPS) +) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; +INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name) +VALUES +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'), +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '); +ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name' +TRUNCATE TABLE t1; +INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name) +VALUES +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '), +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'); +ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name' +DROP TABLE t1; +CREATE TABLE t1 ( +datetime_column_name_1 DATETIME(6) NOT NULL, +datetime_column_name_2 DATETIME(6) NOT NULL, +char_column_name CHAR(255) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, +PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2), +UNIQUE KEY index_name (char_column_name(191),period_name WITHOUT OVERLAPS) +) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; +INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name) +VALUES +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'), +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '); +ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name' +TRUNCATE TABLE t1; +INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name) +VALUES +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '), +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'); +ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name' +DROP TABLE t1; +CREATE TABLE t1 ( +datetime_column_name_1 DATETIME(6) NOT NULL, +datetime_column_name_2 DATETIME(6) NOT NULL, +char_column_name CHAR(255) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, +PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2), +UNIQUE KEY index_name (char_column_name(3),period_name WITHOUT OVERLAPS) +) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; +INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name) +VALUES +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'), +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '); +ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name' +TRUNCATE TABLE t1; +INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name) +VALUES +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '), +('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'); +ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name' +DROP TABLE t1; diff --git a/mysql-test/suite/period/t/alter.test b/mysql-test/suite/period/t/alter.test index 68d9adf476ab1..fab933eca879c 100644 --- a/mysql-test/suite/period/t/alter.test +++ b/mysql-test/suite/period/t/alter.test @@ -152,6 +152,29 @@ alter table t1 add system versioning; # cleanup drop table t1; +--echo # +--echo # MDEV-18873 Server crashes in Compare_identifiers::operator or in +--echo # my_strcasecmp_utf8 upon ADD PERIOD IF NOT EXISTS with empty name +--echo # + +# When there is no table defined. +--error ER_WRONG_COLUMN_NAME +alter table t add period if not exists for `` (s,e); + +# When there is an actual table. +create table t(s DATE, e DATE); +--error ER_WRONG_COLUMN_NAME +alter table t add period if not exists for `` (s,e); + +# When the last character is space +--error ER_WRONG_COLUMN_NAME +alter table t add period if not exists for ` ` (s,e); + +# Create table with an empty period name +--error ER_WRONG_COLUMN_NAME +create table t2 (period for `` (s,e)) select * from t; +drop table t; + --echo # --echo # MDEV-21941 RENAME doesn't work for system time or period fields --echo # diff --git a/mysql-test/suite/period/t/create.test b/mysql-test/suite/period/t/create.test index 49dcc6ad3c760..0bca5b6df56e4 100644 --- a/mysql-test/suite/period/t/create.test +++ b/mysql-test/suite/period/t/create.test @@ -85,3 +85,17 @@ insert t values (2, '2001-01-01', '2001-01-01'); show status like "Feature_application_time_periods"; drop table t; + +--echo # MDEV-29387: Period name with more than 32 symbols crashes the server +--echo # + +--echo # test 34 symbols +create table t2 (s date, e date, + period for `abcd123456789012345678901234567890` (s,e)); +drop table t2; + +--echo # test 64 symbols +create table t2 (s date, e date, period for + `abcd123456789012345678901234567890123456789012345678901234567890` + (s,e)); +drop table t2; diff --git a/mysql-test/suite/period/t/delete.test b/mysql-test/suite/period/t/delete.test index 3750e064ab926..676fa256f95ed 100644 --- a/mysql-test/suite/period/t/delete.test +++ b/mysql-test/suite/period/t/delete.test @@ -1,5 +1,6 @@ source suite/period/engines.inc; source include/have_log_bin.inc; +source include/have_partition.inc; create table t (id int, s date, e date, period for apptime(s,e)); @@ -240,3 +241,30 @@ delete from t1 for portion of se from '2020-01-30' to '2020-01-31'; drop table t1; --echo # End of 10.5 tests +--echo # +--echo # MDEV-19190 Assertion `part_share->auto_inc_initialized` failed in +--echo # ha_partition::get_auto_increment +--echo # +create table t1 (id int, s date, e date, period for app(s,e)) + partition by key(id); +insert into t1 (s,e) values ('2023-07-21','2024-06-07'); +alter table t1 modify id int auto_increment key; +delete from t1 for portion of app from '2023-07-20' to '2024-05-23'; +select * from t1; +drop table t1; + +create table t1 (id int, s date, e date, period for app(s,e)) + partition by key(id); +insert into t1 (s,e) values ('2023-07-21','2024-06-07'); +alter table t1 modify id int auto_increment key; +--let $trig_table=t1 +--let $trig_cols=id, s, e +--disable_query_log +--source suite/period/create_triggers.inc +--enable_query_log + +delete from t1 for portion of app from '2023-07-20' to '2024-05-23'; +select * from t1; +drop table t1; +drop table log_tbl; +drop procedure log; diff --git a/mysql-test/suite/period/t/overlaps.test b/mysql-test/suite/period/t/overlaps.test index 6cd78769d4a40..4611aa15ddd2a 100644 --- a/mysql-test/suite/period/t/overlaps.test +++ b/mysql-test/suite/period/t/overlaps.test @@ -344,3 +344,113 @@ create or replace table t (id int, s date, e date, period for p(s,e), update t set id = 1; drop table t, t1; + +--echo # +--echo # MDEV-30415 PERIOD false positive overlap wtih utf8mb4_unicode_nopad_ci +--echo # + +# The originally reported script with a TEXT column (slightly modified) +CREATE TABLE t1 ( + datetime_column_name_1 DATETIME(6) NOT NULL, + datetime_column_name_2 DATETIME(6) NOT NULL, + text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2), + UNIQUE KEY index_name (text_column_name(191),period_name WITHOUT OVERLAPS) +) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; +INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name) +VALUES + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'), + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '); +TRUNCATE TABLE t1; +INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name) +VALUES + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '), + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'); +DROP TABLE t1; + + +# The script reported by Alice with a TEXT column +CREATE TABLE `t1` ( + datetime_column_name_1 DATETIME(6) NOT NULL, + datetime_column_name_2 DATETIME(6) NOT NULL, + text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2), + UNIQUE KEY index_name (text_column_name(191),period_name WITHOUT OVERLAPS) +) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; +INSERT INTO t1 VALUES + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def '), + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def'); +TRUNCATE TABLE t1; +INSERT INTO t1 VALUES + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def'), + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def '), + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def '); +--sorted_result +SELECT *, LENGTH(text_column_name) FROM t1; +DROP TABLE t1; + + +# A TEXT column with a short prefix +CREATE TABLE t1 ( + datetime_column_name_1 DATETIME(6) NOT NULL, + datetime_column_name_2 DATETIME(6) NOT NULL, + text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2), + UNIQUE KEY index_name (text_column_name(3),period_name WITHOUT OVERLAPS) +) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; +--error ER_DUP_ENTRY +INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name) +VALUES + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'), + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '); +TRUNCATE TABLE t1; +--error ER_DUP_ENTRY +INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name) +VALUES + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '), + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'); +DROP TABLE t1; + + +# A CHAR with a long prefix +CREATE TABLE t1 ( + datetime_column_name_1 DATETIME(6) NOT NULL, + datetime_column_name_2 DATETIME(6) NOT NULL, + char_column_name CHAR(255) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2), + UNIQUE KEY index_name (char_column_name(191),period_name WITHOUT OVERLAPS) +) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; +--error ER_DUP_ENTRY +INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name) +VALUES + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'), + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '); +TRUNCATE TABLE t1; +--error ER_DUP_ENTRY +INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name) +VALUES + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '), + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'); +DROP TABLE t1; + + +# A CHAR column with a short prefix +CREATE TABLE t1 ( + datetime_column_name_1 DATETIME(6) NOT NULL, + datetime_column_name_2 DATETIME(6) NOT NULL, + char_column_name CHAR(255) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2), + UNIQUE KEY index_name (char_column_name(3),period_name WITHOUT OVERLAPS) +) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; +--error ER_DUP_ENTRY +INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name) +VALUES + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'), + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '); +TRUNCATE TABLE t1; +--error ER_DUP_ENTRY +INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name) +VALUES + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '), + ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'); +DROP TABLE t1; diff --git a/mysql-test/suite/plugins/r/binlog-simple_plugin_check.result b/mysql-test/suite/plugins/r/binlog-simple_plugin_check.result index 6c960ee325c81..1cba628db07be 100644 --- a/mysql-test/suite/plugins/r/binlog-simple_plugin_check.result +++ b/mysql-test/suite/plugins/r/binlog-simple_plugin_check.result @@ -8,7 +8,7 @@ simple_password_check # CREATE USER user1@localhost IDENTIFIED BY 'BsG9#9.cem#!85'; CREATE USER user2@localhost IDENTIFIED BY 'bsg9#d.cem#!85'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) DROP USER user1@localhost; include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info diff --git a/mysql-test/suite/plugins/r/cracklib_password_check.result b/mysql-test/suite/plugins/r/cracklib_password_check.result index fb24ec142b86c..192d41d2ccf01 100644 --- a/mysql-test/suite/plugins/r/cracklib_password_check.result +++ b/mysql-test/suite/plugins/r/cracklib_password_check.result @@ -14,41 +14,41 @@ LOAD_OPTION ON PLUGIN_MATURITY Stable PLUGIN_AUTH_VERSION 1.0 grant select on *.* to foocar identified by 'foocar'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (cracklib_password_check) show warnings; Level Code Message Warning 1819 cracklib: it is based on your username -Error 1819 Your password does not satisfy the current policy requirements +Error 1819 Your password does not satisfy the current policy requirements (cracklib_password_check) grant select on *.* to foocar identified by 'racoof'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (cracklib_password_check) show warnings; Level Code Message Warning 1819 cracklib: it is based on your username -Error 1819 Your password does not satisfy the current policy requirements +Error 1819 Your password does not satisfy the current policy requirements (cracklib_password_check) grant select on *.* to foo@barbar identified by 'barbar'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (cracklib_password_check) show warnings; Level Code Message Warning 1819 cracklib: it does not contain enough DIFFERENT characters -Error 1819 Your password does not satisfy the current policy requirements +Error 1819 Your password does not satisfy the current policy requirements (cracklib_password_check) grant select on *.* to foobar identified by 'qwerty'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (cracklib_password_check) show warnings; Level Code Message Warning 1819 cracklib: it is based on a dictionary word -Error 1819 Your password does not satisfy the current policy requirements +Error 1819 Your password does not satisfy the current policy requirements (cracklib_password_check) grant select on *.* to foocar@localhost identified by 'localhost'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (cracklib_password_check) show warnings; Level Code Message Warning 1819 cracklib: it is based upon your password entry -Error 1819 Your password does not satisfy the current policy requirements +Error 1819 Your password does not satisfy the current policy requirements (cracklib_password_check) grant select on *.* to foocar@localhost identified by 'foocar@localhost'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (cracklib_password_check) show warnings; Level Code Message Warning 1819 cracklib: it is derived from your password entry -Error 1819 Your password does not satisfy the current policy requirements +Error 1819 Your password does not satisfy the current policy requirements (cracklib_password_check) grant select on *.* to foobar identified by 'q$%^&*rty'; drop user foobar; # @@ -56,7 +56,7 @@ drop user foobar; # when using cracklib plugin # create user 'newuser'@'localhost'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (cracklib_password_check) uninstall plugin cracklib_password_check; create user foo1 identified by 'pwd'; drop user foo1; diff --git a/mysql-test/suite/plugins/r/feedback_plugin_install.result b/mysql-test/suite/plugins/r/feedback_plugin_install.result index c7f7a5c79f3fd..d2291f20b4f5f 100644 --- a/mysql-test/suite/plugins/r/feedback_plugin_install.result +++ b/mysql-test/suite/plugins/r/feedback_plugin_install.result @@ -11,6 +11,6 @@ FEEDBACK version 1.1 FEEDBACK_HTTP_PROXY FEEDBACK_SEND_RETRY_WAIT 60 FEEDBACK_SEND_TIMEOUT 60 -FEEDBACK_URL http://mariadb.org/feedback_plugin/post +FEEDBACK_URL http://feedback.mariadb.org/rest/v1/post FEEDBACK_USER_INFO mysql-test uninstall plugin feedback; diff --git a/mysql-test/suite/plugins/r/feedback_plugin_load.result b/mysql-test/suite/plugins/r/feedback_plugin_load.result index f31c7325ca112..23376c684dd27 100644 --- a/mysql-test/suite/plugins/r/feedback_plugin_load.result +++ b/mysql-test/suite/plugins/r/feedback_plugin_load.result @@ -13,7 +13,7 @@ FEEDBACK version 1.1 FEEDBACK_HTTP_PROXY FEEDBACK_SEND_RETRY_WAIT 60 FEEDBACK_SEND_TIMEOUT 60 -FEEDBACK_URL http://mariadb.org/feedback_plugin/post +FEEDBACK_URL http://feedback.mariadb.org/rest/v1/post FEEDBACK_USER_INFO mysql-test SELECT VARIABLE_VALUE>0, VARIABLE_NAME FROM INFORMATION_SCHEMA.FEEDBACK WHERE VARIABLE_NAME LIKE 'Collation used %' diff --git a/mysql-test/suite/plugins/r/feedback_plugin_send.result b/mysql-test/suite/plugins/r/feedback_plugin_send.result index b10ea915a4fd7..1f7539978c8b3 100644 --- a/mysql-test/suite/plugins/r/feedback_plugin_send.result +++ b/mysql-test/suite/plugins/r/feedback_plugin_send.result @@ -13,7 +13,7 @@ FEEDBACK version 1.1 FEEDBACK_HTTP_PROXY FEEDBACK_SEND_RETRY_WAIT 60 FEEDBACK_SEND_TIMEOUT 60 -FEEDBACK_URL http://mariadb.org/feedback_plugin/post +FEEDBACK_URL http://feedback.mariadb.org/rest/v1/post FEEDBACK_USER_INFO mysql-test SELECT VARIABLE_VALUE>0, VARIABLE_NAME FROM INFORMATION_SCHEMA.FEEDBACK WHERE VARIABLE_NAME LIKE 'Collation used %' @@ -42,5 +42,5 @@ VARIABLE_VALUE>0 VARIABLE_NAME deallocate prepare stmt; set global sql_mode=ONLY_FULL_GROUP_BY; # restart -feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent +feedback plugin: report to 'http://feedback.mariadb.org/rest/v1/post' was sent feedback plugin: server replied 'ok' diff --git a/mysql-test/suite/plugins/r/locales.result b/mysql-test/suite/plugins/r/locales.result index 106bf22923cb2..5229b7ffaa885 100644 --- a/mysql-test/suite/plugins/r/locales.result +++ b/mysql-test/suite/plugins/r/locales.result @@ -1,3 +1,4 @@ +SET names utf8; select * from information_schema.locales; ID NAME DESCRIPTION MAX_MONTH_NAME_LENGTH MAX_DAY_NAME_LENGTH DECIMAL_POINT THOUSAND_SEP ERROR_MESSAGE_LANGUAGE 0 en_US English - United States 9 9 . , english @@ -17,7 +18,7 @@ ID NAME DESCRIPTION MAX_MONTH_NAME_LENGTH MAX_DAY_NAME_LENGTH DECIMAL_POINT THOU 14 cs_CZ Czech - Czech Republic 8 7 , czech 15 da_DK Danish - Denmark 9 7 , . danish 16 de_AT German - Austria 9 10 , german -17 es_ES Spanish - Spain 10 9 , spanish +17 es_ES Spanish - Spain 10 9 , . spanish 18 et_EE Estonian - Estonia 9 9 , estonian 19 eu_ES Basque - Basque 9 10 , english 20 fi_FI Finnish - Finland 9 11 , english @@ -52,11 +53,11 @@ ID NAME DESCRIPTION MAX_MONTH_NAME_LENGTH MAX_DAY_NAME_LENGTH DECIMAL_POINT THOU 49 ta_IN Tamil - India 10 8 . , english 50 te_IN Telugu - India 10 9 . , english 51 th_TH Thai - Thailand 10 8 . , english -52 tr_TR Turkish - Turkey 7 9 , . english +52 tr_TR Turkish - Türkiye 7 9 , . english 53 uk_UA Ukrainian - Ukraine 8 9 , . ukrainian 54 ur_PK Urdu - Pakistan 6 6 . , english 55 vi_VN Vietnamese - Vietnam 16 11 , . english -56 zh_CN Chinese - Peoples Republic of China 3 3 . , english +56 zh_CN Chinese - Peoples Republic of China 3 3 . , chinese 57 zh_TW Chinese - Taiwan 3 2 . , english 58 ar_DZ Arabic - Algeria 6 8 . , english 59 ar_EG Arabic - Egypt 6 8 . , english @@ -82,24 +83,24 @@ ID NAME DESCRIPTION MAX_MONTH_NAME_LENGTH MAX_DAY_NAME_LENGTH DECIMAL_POINT THOU 79 en_ZA English - South Africa 9 9 . , english 80 en_ZW English - Zimbabwe 9 9 . , english 81 es_AR Spanish - Argentina 10 9 , . spanish -82 es_BO Spanish - Bolivia 10 9 , spanish -83 es_CL Spanish - Chile 10 9 , spanish -84 es_CO Spanish - Columbia 10 9 , spanish -85 es_CR Spanish - Costa Rica 10 9 . spanish -86 es_DO Spanish - Dominican Republic 10 9 . spanish -87 es_EC Spanish - Ecuador 10 9 , spanish -88 es_GT Spanish - Guatemala 10 9 . spanish -89 es_HN Spanish - Honduras 10 9 . spanish -90 es_MX Spanish - Mexico 10 9 . spanish -91 es_NI Spanish - Nicaragua 10 9 . spanish -92 es_PA Spanish - Panama 10 9 . spanish -93 es_PE Spanish - Peru 10 9 . spanish -94 es_PR Spanish - Puerto Rico 10 9 . spanish -95 es_PY Spanish - Paraguay 10 9 , spanish -96 es_SV Spanish - El Salvador 10 9 . spanish +82 es_BO Spanish - Bolivia 10 9 , . spanish +83 es_CL Spanish - Chile 10 9 , . spanish +84 es_CO Spanish - Columbia 10 9 , . spanish +85 es_CR Spanish - Costa Rica 10 9 , spanish +86 es_DO Spanish - Dominican Republic 10 9 . , spanish +87 es_EC Spanish - Ecuador 10 9 , . spanish +88 es_GT Spanish - Guatemala 10 9 . , spanish +89 es_HN Spanish - Honduras 10 9 . , spanish +90 es_MX Spanish - Mexico 10 9 . , spanish +91 es_NI Spanish - Nicaragua 10 9 . , spanish +92 es_PA Spanish - Panama 10 9 . , spanish +93 es_PE Spanish - Peru 10 9 . , spanish +94 es_PR Spanish - Puerto Rico 10 9 . , spanish +95 es_PY Spanish - Paraguay 10 9 , . spanish +96 es_SV Spanish - El Salvador 10 9 . , spanish 97 es_US Spanish - United States 10 9 . , spanish -98 es_UY Spanish - Uruguay 10 9 , spanish -99 es_VE Spanish - Venezuela 10 9 , spanish +98 es_UY Spanish - Uruguay 10 9 , . spanish +99 es_VE Spanish - Venezuela 10 9 , . spanish 100 fr_BE French - Belgium 9 8 , . french 101 fr_CA French - Canada 9 8 , french 102 fr_CH French - Switzerland 9 8 , french @@ -165,11 +166,11 @@ Id Name Description Error_Message_Language 49 ta_IN Tamil - India english 50 te_IN Telugu - India english 51 th_TH Thai - Thailand english -52 tr_TR Turkish - Turkey english +52 tr_TR Turkish - Türkiye english 53 uk_UA Ukrainian - Ukraine ukrainian 54 ur_PK Urdu - Pakistan english 55 vi_VN Vietnamese - Vietnam english -56 zh_CN Chinese - Peoples Republic of China english +56 zh_CN Chinese - Peoples Republic of China chinese 57 zh_TW Chinese - Taiwan english 58 ar_DZ Arabic - Algeria english 59 ar_EG Arabic - Egypt english diff --git a/mysql-test/suite/plugins/r/multiauth,aix.rdiff b/mysql-test/suite/plugins/r/multiauth,aix.rdiff deleted file mode 100644 index 0a2570cbd89a9..0000000000000 --- a/mysql-test/suite/plugins/r/multiauth,aix.rdiff +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/mysql-test/suite/plugins/r/multiauth.result b/mysql-test/suite/plugins/r/multiauth.result -index aed46ac8964..24bb0a24f03 100644 ---- a/mysql-test/suite/plugins/r/multiauth.result -+++ b/mysql-test/suite/plugins/r/multiauth.result -@@ -181,7 +181,8 @@ show create user mysqltest1; - CREATE USER for mysqltest1@% - CREATE USER `mysqltest1`@`%` IDENTIFIED VIA ed25519 USING 'F4aF8bw7130VaRbdLCl4f/P/wkjDmgJXwWvpJ5gmsZc' - # no plugin = failure --mysqltest: Could not open connection 'default': 1045 Plugin client_ed25519 could not be loaded: /no/client_ed25519.so: cannot open shared object file: No such file or directory -+mysqltest: Could not open connection 'default': 1045 Plugin client_ed25519 could not be loaded: Could not load module /no/client_ed25519.so. -+System error: No such file or directory - alter user mysqltest1 identified via ed25519 as password("good") OR mysql_native_password as password("works"); - show create user mysqltest1; - CREATE USER for mysqltest1@% diff --git a/mysql-test/suite/plugins/r/multiauth.result b/mysql-test/suite/plugins/r/multiauth.result index 8ae45d1fb9feb..d1ecd600d8412 100644 --- a/mysql-test/suite/plugins/r/multiauth.result +++ b/mysql-test/suite/plugins/r/multiauth.result @@ -111,16 +111,13 @@ json_detailed(priv) "authentication_string": "*7D8C3DF236D9163B6C274A9D47704BC496988460", "auth_or": [ - { "plugin": "ed25519", "authentication_string": "F4aF8bw7130VaRbdLCl4f/P/wkjDmgJXwWvpJ5gmsZc" }, - { "plugin": "unix_socket" }, - { } ], @@ -181,7 +178,7 @@ show create user mysqltest1; CREATE USER for mysqltest1@% CREATE USER `mysqltest1`@`%` IDENTIFIED VIA ed25519 USING 'F4aF8bw7130VaRbdLCl4f/P/wkjDmgJXwWvpJ5gmsZc' # no plugin = failure -mysqltest: Could not open connection 'default': 1045 Plugin client_ed25519 could not be loaded: /no/client_ed25519.so: cannot open shared object file: No such file or directory +mysqltest: Could not open connection 'default': 1045 Plugin client_ed25519 could not be loaded: no such file alter user mysqltest1 identified via ed25519 as password("good") OR mysql_native_password as password("works"); show create user mysqltest1; CREATE USER for mysqltest1@% diff --git a/mysql-test/suite/plugins/r/pam.result b/mysql-test/suite/plugins/r/pam.result index 40075245d0c33..b858891616923 100644 --- a/mysql-test/suite/plugins/r/pam.result +++ b/mysql-test/suite/plugins/r/pam.result @@ -40,6 +40,35 @@ test_pam@localhost pam_test@% test # Now, the magic number! PIN: 9212 +# +# MDEV-26339 Account specifics to be handled before proxying +# +alter user pam_test account lock; +alter user pam_test require subject 'foobar'; +alter user pam_test password expire; +Now, the magic number! +PIN: 9212 +select user(), current_user(), database(); +user() current_user() database() +test_pam@localhost pam_test@% test +alter user pam_test account unlock; +alter user pam_test require none; +alter user pam_test identified by ''; +show create user pam_test; +CREATE USER for pam_test@% +CREATE USER `pam_test`@`%` +alter user test_pam account lock; +Now, the magic number! +PIN: 9212 +alter user test_pam account unlock; +alter user test_pam require subject 'foobar'; +Now, the magic number! +PIN: 9212 +alter user test_pam require none; +alter user test_pam password expire; +Now, the magic number! +PIN: 9212 +select user(), current_user(), database(); drop user test_pam; drop user pam_test; create user PAM_TEST identified via pam using 'mariadb_mtr'; @@ -62,4 +91,21 @@ select user(), current_user(), database(); user() current_user() database() PAM_TEST@localhost PAM_TEST@% test drop user PAM_TEST; +# +# MDEV-27341 Use SET PASSWORD to change PAM service +# +create user pam_test identified via pam using 'mariadb_mtr'; +Challenge input first. +Enter: ************************* +Now, the magic number! +PIN: 9225 +select user(), current_user(), database(); +user() current_user() database() +pam_test@localhost pam_test@% test +set password='foo'; +ERROR HY000: SET PASSWORD is ignored for users authenticating via pam plugin +show create user; +CREATE USER for pam_test@% +CREATE USER `pam_test`@`%` IDENTIFIED VIA pam USING 'mariadb_mtr' +drop user pam_test; uninstall plugin pam; diff --git a/mysql-test/suite/plugins/r/password_reuse_check.result b/mysql-test/suite/plugins/r/password_reuse_check.result index a9b79cf34fc9f..72f3dd5364bfd 100644 --- a/mysql-test/suite/plugins/r/password_reuse_check.result +++ b/mysql-test/suite/plugins/r/password_reuse_check.result @@ -7,17 +7,17 @@ password_reuse_check_interval 0 # insert user grant select on *.* to user_name@localhost identified by 'test_pwd'; grant select on *.* to user_name@localhost identified by 'test_pwd'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (password_reuse_check) show warnings; Level Code Message Warning 1819 password_reuse_check: The password was already used -Error 1819 Your password does not satisfy the current policy requirements +Error 1819 Your password does not satisfy the current policy requirements (password_reuse_check) alter user user_name@localhost identified by 'test_pwd'; ERROR HY000: Operation ALTER USER failed for 'user_name'@'localhost' show warnings; Level Code Message Warning 1819 password_reuse_check: The password was already used -Error 1819 Your password does not satisfy the current policy requirements +Error 1819 Your password does not satisfy the current policy requirements (password_reuse_check) Error 1396 Operation ALTER USER failed for 'user_name'@'localhost' # check exparation set global password_reuse_check_interval= 10; @@ -26,11 +26,11 @@ ERROR HY000: Operation ALTER USER failed for 'user_name'@'localhost' show warnings; Level Code Message Warning 1819 password_reuse_check: The password was already used -Error 1819 Your password does not satisfy the current policy requirements +Error 1819 Your password does not satisfy the current policy requirements (password_reuse_check) Error 1396 Operation ALTER USER failed for 'user_name'@'localhost' select hex(hash) from mysql.password_reuse_check_history; hex(hash) -6276C87127F2B65FC6B24E94E324A02FF0D393D7FB7DEAF6F5F49F0A8AB006711D5C6EF67E36A251AB6337E7E20D312F9ED66D70EB699A6EC85B1E0BC7F376C0 +B9F970DE4DA0145F842526C1BC9DBBBDB3EF80FDD7BE98061DAE3D18F492AA37668C07322DD21650C66B48FC78F0EAF6CB08245CC895BFDC43BE6921B07E5240 # emulate old password update mysql.password_reuse_check_history set time= date_sub(now(), interval 11 day); @@ -45,7 +45,7 @@ password_reuse_check_history CREATE TABLE `password_reuse_check_history` ( `time` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`hash`), KEY `tm` (`time`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 select count(*) from mysql.password_reuse_check_history; count(*) 1 @@ -58,17 +58,37 @@ Note 1051 Unknown table 'mysql.password_reuse_check_history' # test error messages create table mysql.password_reuse_check_history (wrong_structure int); grant select on *.* to user_name@localhost identified by 'test_pwd'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (password_reuse_check) show warnings; Level Code Message Warning 1105 password_reuse_check:[1054] Unknown column 'hash' in 'field list' -Error 1819 Your password does not satisfy the current policy requirements +Error 1819 Your password does not satisfy the current policy requirements (password_reuse_check) set global password_reuse_check_interval= 10; grant select on *.* to user_name@localhost identified by 'test_pwd'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (password_reuse_check) show warnings; Level Code Message Warning 1105 password_reuse_check:[1054] Unknown column 'time' in 'where clause' -Error 1819 Your password does not satisfy the current policy requirements +Error 1819 Your password does not satisfy the current policy requirements (password_reuse_check) +drop table mysql.password_reuse_check_history; +# +# MDEV-28838: password_reuse_check plugin mixes username and password +# +grant select on *.* to user_name@localhost identified by 'test_pwd'; +grant select on *.* to user_nam@localhost identified by 'etest_pwd'; +show warnings; +Level Code Message +drop user user_name@localhost; +drop user user_nam@localhost; +drop table mysql.password_reuse_check_history; +grant select on *.* to user_name@localhost identified by 'test_pwd'; +grant select on *.* to tuser_name@localhos identified by 'test_pwd'; +show warnings; +Level Code Message +drop user user_name@localhost; +drop user tuser_name@localhos; +# +# End of 10.7 tests +# drop table mysql.password_reuse_check_history; uninstall plugin password_reuse_check; diff --git a/mysql-test/suite/plugins/r/qc_info.result b/mysql-test/suite/plugins/r/qc_info.result index 41073359e935b..afab7671b5cc1 100644 --- a/mysql-test/suite/plugins/r/qc_info.result +++ b/mysql-test/suite/plugins/r/qc_info.result @@ -27,9 +27,9 @@ set time_zone=@new_time_zone,default_week_format=4,character_set_client='binary' select * from t1; set time_zone= @time_zone, default_week_format= @default_week_format, character_set_client= @character_set_client,character_set_results= @character_set_results, sql_mode= @sql_mode, div_precision_increment= @div_precision_increment, lc_time_names= @lc_time_names, autocommit= @autocommit, group_concat_max_len= @group_concat_max_len, max_sort_length= @max_sort_length; select * from information_schema.query_cache_info; -STATEMENT_SCHEMA STATEMENT_TEXT RESULT_BLOCKS_COUNT RESULT_BLOCKS_SIZE RESULT_BLOCKS_SIZE_USED LIMIT MAX_SORT_LENGTH GROUP_CONCAT_MAX_LENGTH CHARACTER_SET_CLIENT CHARACTER_SET_RESULT COLLATION TIMEZONE DEFAULT_WEEK_FORMAT DIV_PRECISION_INCREMENT SQL_MODE LC_TIME_NAMES CLIENT_LONG_FLAG CLIENT_PROTOCOL_41 PROTOCOL_TYPE MORE_RESULTS_EXISTS IN_TRANS AUTOCOMMIT PACKET_NUMBER HITS -test select * from t1 1 512 # -1 1011 513 binary utf32 utf32_bin Europe/Moscow 4 7 STRICT_ALL_TABLES ar_SD 1 1 # 0 0 0 # 0 -test select * from t1 1 512 # -1 1024 1048576 latin1 latin1 latin1_swedish_ci SYSTEM 0 4 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION en_US 1 1 # 0 0 1 # 0 +STATEMENT_SCHEMA STATEMENT_TEXT RESULT_BLOCKS_COUNT RESULT_BLOCKS_SIZE RESULT_BLOCKS_SIZE_USED LIMIT MAX_SORT_LENGTH GROUP_CONCAT_MAX_LENGTH CHARACTER_SET_CLIENT CHARACTER_SET_RESULT COLLATION TIMEZONE DEFAULT_WEEK_FORMAT DIV_PRECISION_INCREMENT SQL_MODE LC_TIME_NAMES CLIENT_LONG_FLAG CLIENT_PROTOCOL_41 CLIENT_EXTENDED_METADATA PROTOCOL_TYPE MORE_RESULTS_EXISTS IN_TRANS AUTOCOMMIT PACKET_NUMBER HITS +test select * from t1 1 512 # -1 1011 513 binary utf32 utf32_bin Europe/Moscow 4 7 STRICT_ALL_TABLES ar_SD 1 1 1 # 0 0 0 # 0 +test select * from t1 1 512 # -1 1024 1048576 latin1 latin1 latin1_swedish_ci SYSTEM 0 4 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION en_US 1 1 1 # 0 0 1 # 0 reset query cache; select * from t1; a @@ -49,7 +49,7 @@ select statement_schema, statement_text, result_blocks_count, result_blocks_size statement_schema statement_text result_blocks_count result_blocks_size set global query_cache_size = 0; select * from information_schema.query_cache_info; -STATEMENT_SCHEMA STATEMENT_TEXT RESULT_BLOCKS_COUNT RESULT_BLOCKS_SIZE RESULT_BLOCKS_SIZE_USED LIMIT MAX_SORT_LENGTH GROUP_CONCAT_MAX_LENGTH CHARACTER_SET_CLIENT CHARACTER_SET_RESULT COLLATION TIMEZONE DEFAULT_WEEK_FORMAT DIV_PRECISION_INCREMENT SQL_MODE LC_TIME_NAMES CLIENT_LONG_FLAG CLIENT_PROTOCOL_41 PROTOCOL_TYPE MORE_RESULTS_EXISTS IN_TRANS AUTOCOMMIT PACKET_NUMBER HITS +STATEMENT_SCHEMA STATEMENT_TEXT RESULT_BLOCKS_COUNT RESULT_BLOCKS_SIZE RESULT_BLOCKS_SIZE_USED LIMIT MAX_SORT_LENGTH GROUP_CONCAT_MAX_LENGTH CHARACTER_SET_CLIENT CHARACTER_SET_RESULT COLLATION TIMEZONE DEFAULT_WEEK_FORMAT DIV_PRECISION_INCREMENT SQL_MODE LC_TIME_NAMES CLIENT_LONG_FLAG CLIENT_PROTOCOL_41 CLIENT_EXTENDED_METADATA PROTOCOL_TYPE MORE_RESULTS_EXISTS IN_TRANS AUTOCOMMIT PACKET_NUMBER HITS set global query_cache_size= default; set global query_cache_type=default; show query_cache_info; diff --git a/mysql-test/suite/plugins/r/qc_info_priv.result b/mysql-test/suite/plugins/r/qc_info_priv.result index 78ea78a33b8fd..9aa15885563ab 100644 --- a/mysql-test/suite/plugins/r/qc_info_priv.result +++ b/mysql-test/suite/plugins/r/qc_info_priv.result @@ -27,9 +27,9 @@ set time_zone=@new_time_zone,default_week_format=4,character_set_client='binary' select * from t1; set time_zone= @time_zone, default_week_format= @default_week_format, character_set_client= @character_set_client,character_set_results= @character_set_results, sql_mode= @sql_mode, div_precision_increment= @div_precision_increment, lc_time_names= @lc_time_names, autocommit= @autocommit, group_concat_max_len= @group_concat_max_len, max_sort_length= @max_sort_length; select * from information_schema.query_cache_info; -STATEMENT_SCHEMA STATEMENT_TEXT RESULT_BLOCKS_COUNT RESULT_BLOCKS_SIZE RESULT_BLOCKS_SIZE_USED LIMIT MAX_SORT_LENGTH GROUP_CONCAT_MAX_LENGTH CHARACTER_SET_CLIENT CHARACTER_SET_RESULT COLLATION TIMEZONE DEFAULT_WEEK_FORMAT DIV_PRECISION_INCREMENT SQL_MODE LC_TIME_NAMES CLIENT_LONG_FLAG CLIENT_PROTOCOL_41 PROTOCOL_TYPE MORE_RESULTS_EXISTS IN_TRANS AUTOCOMMIT PACKET_NUMBER HITS -test select * from t1 1 512 # -1 1011 513 binary utf32 utf32_bin Europe/Moscow 4 7 STRICT_ALL_TABLES ar_SD 1 1 # 0 0 0 # 0 -test select * from t1 1 512 # -1 1024 1048576 latin1 latin1 latin1_swedish_ci SYSTEM 0 4 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION en_US 1 1 # 0 0 1 # 0 +STATEMENT_SCHEMA STATEMENT_TEXT RESULT_BLOCKS_COUNT RESULT_BLOCKS_SIZE RESULT_BLOCKS_SIZE_USED LIMIT MAX_SORT_LENGTH GROUP_CONCAT_MAX_LENGTH CHARACTER_SET_CLIENT CHARACTER_SET_RESULT COLLATION TIMEZONE DEFAULT_WEEK_FORMAT DIV_PRECISION_INCREMENT SQL_MODE LC_TIME_NAMES CLIENT_LONG_FLAG CLIENT_PROTOCOL_41 CLIENT_EXTENDED_METADATA PROTOCOL_TYPE MORE_RESULTS_EXISTS IN_TRANS AUTOCOMMIT PACKET_NUMBER HITS +test select * from t1 1 512 # -1 1011 513 binary utf32 utf32_bin Europe/Moscow 4 7 STRICT_ALL_TABLES ar_SD 1 1 1 # 0 0 0 # 0 +test select * from t1 1 512 # -1 1024 1048576 latin1 latin1 latin1_swedish_ci SYSTEM 0 4 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION en_US 1 1 1 # 0 0 1 # 0 create user mysqltest; connect conn1,localhost,mysqltest,,; connection conn1; diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result index 9768040aa943c..fc9d98f5d0a89 100644 --- a/mysql-test/suite/plugins/r/server_audit.result +++ b/mysql-test/suite/plugins/r/server_audit.result @@ -521,3 +521,10 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show variables like \'server_audit%\'',0 TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,plugin, TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'uninstall plugin server_audit',0 +# +# MDEV-27631 Assertion `global_status_var.global_memory_used == 0' failed in mysqld_exit +# +install plugin server_audit soname 'server_audit'; +uninstall plugin server_audit; +Warnings: +Warning 1620 Plugin is busy and will be uninstalled on shutdown diff --git a/mysql-test/suite/plugins/r/simple_password_check.result b/mysql-test/suite/plugins/r/simple_password_check.result index 0617e7872aa94..30f68ba819309 100644 --- a/mysql-test/suite/plugins/r/simple_password_check.result +++ b/mysql-test/suite/plugins/r/simple_password_check.result @@ -75,13 +75,37 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED GLOBAL_VALUE_PATH NULL create user foo1 identified by 'pwd'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) +show warnings; +Level Code Message +Warning 1819 simple_password_check: Too short password (< 8) +Warning 1819 simple_password_check: Not enough upper case letters (< 1) +Warning 1819 simple_password_check: Not enough digits (< 1) +Warning 1819 simple_password_check: Not enough special characters (< 1) +Error 1819 Your password does not satisfy the current policy requirements (simple_password_check) +Error 1396 Operation CREATE USER failed for 'foo1'@'%' create user foo1; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) +show warnings; +Level Code Message +Warning 1819 simple_password_check: The password equal to the user name +Error 1819 Your password does not satisfy the current policy requirements (simple_password_check) +Error 1396 Operation CREATE USER failed for 'foo1'@'%' grant select on *.* to foo1 identified by 'pwd'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) +show warnings; +Level Code Message +Warning 1819 simple_password_check: Too short password (< 8) +Warning 1819 simple_password_check: Not enough upper case letters (< 1) +Warning 1819 simple_password_check: Not enough digits (< 1) +Warning 1819 simple_password_check: Not enough special characters (< 1) +Error 1819 Your password does not satisfy the current policy requirements (simple_password_check) grant select on *.* to `FooBar1!` identified by 'FooBar1!'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) +show warnings; +Level Code Message +Warning 1819 simple_password_check: The password equal to the user name +Error 1819 Your password does not satisfy the current policy requirements (simple_password_check) grant select on *.* to `BarFoo1!` identified by 'FooBar1!'; drop user `BarFoo1!`; create user foo1 identified by 'aA.12345'; @@ -103,28 +127,64 @@ simple_password_check_other_characters 3 create user foo1 identified by '123:qwe:ASD!'; drop user foo1; create user foo1 identified by '-23:qwe:ASD!'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) +show warnings; +Level Code Message +Warning 1819 simple_password_check: Not enough digits (< 3) +Error 1819 Your password does not satisfy the current policy requirements (simple_password_check) +Error 1396 Operation CREATE USER failed for 'foo1'@'%' create user foo1 identified by '123:4we:ASD!'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) +show warnings; +Level Code Message +Warning 1819 simple_password_check: Not enough lower case letters (< 3) +Error 1819 Your password does not satisfy the current policy requirements (simple_password_check) +Error 1396 Operation CREATE USER failed for 'foo1'@'%' create user foo1 identified by '123:qwe:4SD!'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) +show warnings; +Level Code Message +Warning 1819 simple_password_check: Not enough upper case letters (< 3) +Error 1819 Your password does not satisfy the current policy requirements (simple_password_check) +Error 1396 Operation CREATE USER failed for 'foo1'@'%' create user foo1 identified by '123:qwe:ASD4'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) +show warnings; +Level Code Message +Warning 1819 simple_password_check: Not enough special characters (< 3) +Error 1819 Your password does not satisfy the current policy requirements (simple_password_check) +Error 1396 Operation CREATE USER failed for 'foo1'@'%' create user foo1 identified by '123:qwe:ASD!'; set password for foo1 = password('qwe:-23:ASD!'); -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) +show warnings; +Level Code Message +Warning 1819 simple_password_check: Not enough digits (< 3) +Error 1819 Your password does not satisfy the current policy requirements (simple_password_check) set password for foo1 = old_password('4we:123:ASD!'); -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) set password for foo1 = password('qwe:123:4SD!'); -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) +show warnings; +Level Code Message +Warning 1819 simple_password_check: Not enough upper case letters (< 3) +Error 1819 Your password does not satisfy the current policy requirements (simple_password_check) set password for foo1 = old_password('qwe:123:ASD4'); -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) +show warnings; +Level Code Message +Warning 1819 simple_password_check: Not enough special characters (< 3) +Error 1819 Your password does not satisfy the current policy requirements (simple_password_check) set password for foo1 = password('qwe:123:ASD!'); select @@strict_password_validation; @@strict_password_validation 1 set password for foo1 = ''; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) +show warnings; +Level Code Message +Warning 1819 simple_password_check: The password equal to the user name +Error 1819 Your password does not satisfy the current policy requirements (simple_password_check) set password for foo1 = '2222222222222222'; ERROR HY000: The MariaDB server is running with the --strict-password-validation option so it cannot execute this statement set password for foo1 = '11111111111111111111111111111111111111111'; @@ -138,15 +198,24 @@ ERROR HY000: The MariaDB server is running with the --strict-password-validation grant select on *.* to foo2 identified with mysql_old_password using '2222222222222222'; ERROR HY000: The MariaDB server is running with the --strict-password-validation option so it cannot execute this statement create user foo2 identified with mysql_native_password using ''; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) +show warnings; +Level Code Message +Warning 1819 simple_password_check: The password equal to the user name +Error 1819 Your password does not satisfy the current policy requirements (simple_password_check) +Error 1396 Operation CREATE USER failed for 'foo2'@'%' grant select on *.* to foo2 identified with mysql_old_password using ''; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) grant select on *.* to foo2 identified with mysql_old_password; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'xxx') where user='foo1'; set global strict_password_validation=0; set password for foo1 = ''; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) +show warnings; +Level Code Message +Warning 1819 simple_password_check: The password equal to the user name +Error 1819 Your password does not satisfy the current policy requirements (simple_password_check) set password for foo1 = '2222222222222222'; set password for foo1 = '11111111111111111111111111111111111111111'; create user foo2 identified by password '11111111111111111111111111111111111111111'; diff --git a/mysql-test/suite/plugins/r/test_sql_service.result b/mysql-test/suite/plugins/r/test_sql_service.result index 00f0411b665e6..e5f09b67b6b04 100644 --- a/mysql-test/suite/plugins/r/test_sql_service.result +++ b/mysql-test/suite/plugins/r/test_sql_service.result @@ -1,7 +1,28 @@ +reset master; install plugin test_sql_service soname 'test_sql_service'; show status like 'test_sql_service_passed'; Variable_name Value Test_sql_service_passed 1 +set global test_sql_service_execute_sql_global= 'create table test.t1 select 1 as a, @@SQL_LOG_BIN'; +set global test_sql_service_execute_sql_local= 'insert into test.t1 select 2 as a, @@SQL_LOG_BIN'; +set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=1'; +set global test_sql_service_execute_sql_global= 'insert into test.t1 select 3 as a, @@SQL_LOG_BIN'; +set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=0'; +set global test_sql_service_execute_sql_global= 'insert into test.t1 select 4 as a, @@SQL_LOG_BIN'; +set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=1'; +set global test_sql_service_execute_sql_global= 'insert into test.t1 select 5 as a, @@sql_auto_is_null'; +set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=0'; +set global test_sql_service_execute_sql_global= 'insert into test.t1 select 6 as a, @@sql_auto_is_null'; +select * from t1 order by a; +a @@SQL_LOG_BIN +1 0 +2 0 +3 1 +4 0 +5 1 +6 0 +drop table t1; +SET SQL_LOG_BIN=0; set global test_sql_service_run_test= 1; show status like 'test_sql_service_passed'; Variable_name Value @@ -68,3 +89,12 @@ drop table t1; uninstall plugin test_sql_service; Warnings: Warning 1620 Plugin is busy and will be uninstalled on shutdown +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # insert into test.t1 select 3 as a, @@SQL_LOG_BIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ diff --git a/mysql-test/suite/plugins/r/two_password_validations.result b/mysql-test/suite/plugins/r/two_password_validations.result index dc6bab3c2d509..4bd674baebb0c 100644 --- a/mysql-test/suite/plugins/r/two_password_validations.result +++ b/mysql-test/suite/plugins/r/two_password_validations.result @@ -5,16 +5,18 @@ install soname "cracklib_password_check"; grant select on *.* to foobar identified by 'q$%^&*R1234ty'; drop user foobar; grant select on *.* to Fff_fff1 identified by '1fff_ffF'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (cracklib_password_check) show warnings; Level Code Message Warning 1819 cracklib: it does not contain enough DIFFERENT characters -Error 1819 Your password does not satisfy the current policy requirements +Error 1819 Your password does not satisfy the current policy requirements (cracklib_password_check) grant select on *.* to foobar identified by 'q-%^&*rty'; -ERROR HY000: Your password does not satisfy the current policy requirements +ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check) show warnings; Level Code Message -Error 1819 Your password does not satisfy the current policy requirements +Warning 1819 simple_password_check: Not enough upper case letters (< 1) +Warning 1819 simple_password_check: Not enough digits (< 1) +Error 1819 Your password does not satisfy the current policy requirements (simple_password_check) uninstall plugin simple_password_check; grant select on *.* to foobar identified by 'q-%^&*rty'; drop user foobar; diff --git a/mysql-test/suite/plugins/t/false_dupes-6543.test b/mysql-test/suite/plugins/t/false_dupes-6543.test index ebdbe00e47c80..ca278685967c6 100644 --- a/mysql-test/suite/plugins/t/false_dupes-6543.test +++ b/mysql-test/suite/plugins/t/false_dupes-6543.test @@ -1,3 +1,4 @@ +source include/not_embedded.inc; # # MDEV-6543 Crash if enable 'federatedx' when 'federated' plugin already enabled, and vice-versa # diff --git a/mysql-test/suite/plugins/t/locales.test b/mysql-test/suite/plugins/t/locales.test index a3afe75046fad..2b4d56433d931 100644 --- a/mysql-test/suite/plugins/t/locales.test +++ b/mysql-test/suite/plugins/t/locales.test @@ -2,6 +2,7 @@ if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'lo { --skip LOCALES plugin is not active } +SET names utf8; select * from information_schema.locales; show locales; diff --git a/mysql-test/suite/plugins/t/multiauth.test b/mysql-test/suite/plugins/t/multiauth.test index f0eea21ee769c..86c98a5d5c328 100644 --- a/mysql-test/suite/plugins/t/multiauth.test +++ b/mysql-test/suite/plugins/t/multiauth.test @@ -1,5 +1,4 @@ --source include/not_ubsan.inc ---source include/platform.inc let $REGEX_VERSION_ID=/$mysql_get_server_version/VERSION_ID/; let $REGEX_PASSWORD_LAST_CHANGED=/password_last_changed": [0-9]*/password_last_changed": #/; @@ -187,7 +186,8 @@ eval $dreplace, mysqltest1; create user mysqltest1 identified via ed25519 as password("good"); show create user mysqltest1; --echo # no plugin = failure ---replace_result $plugindir +# covers Linux (1st re), FreeBSD (2nd), AIX (3rd and 4th) +--replace_regex /loaded: .*client_ed25519.so: cannot open shared object file: No such file or directory/loaded: no such file/ /loaded: Cannot open.*client_ed25519.so./loaded: no such file/ /loaded: .*Could not load module.*client_ed25519.so.\n/loaded: no such file/ /System error: No such file or directory// --error 1 --exec $try_auth -u mysqltest1 -pgood --plugin-dir=$plugindir/no alter user mysqltest1 identified via ed25519 as password("good") OR mysql_native_password as password("works"); diff --git a/mysql-test/suite/plugins/t/pam.test b/mysql-test/suite/plugins/t/pam.test index 2611f25ee632d..dbe108d1efaf9 100644 --- a/mysql-test/suite/plugins/t/pam.test +++ b/mysql-test/suite/plugins/t/pam.test @@ -45,7 +45,6 @@ EOF --echo # --echo # athentication is successful --echo # ---error 0 --exec $MYSQL_TEST -u test_pam -pgoodpassword < $MYSQLTEST_VARDIR/tmp/pam_good2.txt --echo # @@ -54,6 +53,36 @@ EOF --error 1 --exec $MYSQL_TEST -u test_pam -pbadpassword < $MYSQLTEST_VARDIR/tmp/pam_good2.txt +--echo # +--echo # MDEV-26339 Account specifics to be handled before proxying +--echo # + +# one can connect if the proxy account is locked +alter user pam_test account lock; +alter user pam_test require subject 'foobar'; +alter user pam_test password expire; +--error 0 +--exec $MYSQL_TEST -u test_pam -pgoodpassword < $MYSQLTEST_VARDIR/tmp/pam_good2.txt +alter user pam_test account unlock; +alter user pam_test require none; +alter user pam_test identified by ''; +show create user pam_test; + +#one cannot connect if the proxied account is locked +alter user test_pam account lock; +--error 1 +--exec $MYSQL_TEST -u test_pam -pgoodpassword < $MYSQLTEST_VARDIR/tmp/pam_good2.txt +alter user test_pam account unlock; + +alter user test_pam require subject 'foobar'; +--error 1 +--exec $MYSQL_TEST -u test_pam -pgoodpassword < $MYSQLTEST_VARDIR/tmp/pam_good2.txt +alter user test_pam require none; + +alter user test_pam password expire; +--error 1 +--exec $MYSQL_TEST -u test_pam -pgoodpassword < $MYSQLTEST_VARDIR/tmp/pam_good2.txt + drop user test_pam; drop user pam_test; create user PAM_TEST identified via pam using 'mariadb_mtr'; @@ -76,6 +105,22 @@ set global pam_winbind_workaround=1; --remove_file $MYSQLTEST_VARDIR/tmp/pam_ugly.txt drop user PAM_TEST; +--echo # +--echo # MDEV-27341 Use SET PASSWORD to change PAM service +--echo # +create user pam_test identified via pam using 'mariadb_mtr'; +--write_file $MYSQLTEST_VARDIR/tmp/setpwd.txt +not very secret challenge +9225 +select user(), current_user(), database(); +error ER_SET_PASSWORD_AUTH_PLUGIN; +set password='foo'; +show create user; +EOF +--exec $MYSQL_TEST -u pam_test < $MYSQLTEST_VARDIR/tmp/setpwd.txt +--remove_file $MYSQLTEST_VARDIR/tmp/setpwd.txt +drop user pam_test; + let $count_sessions= 1; --source include/wait_until_count_sessions.inc uninstall plugin pam; diff --git a/mysql-test/suite/plugins/t/password_reuse_check.test b/mysql-test/suite/plugins/t/password_reuse_check.test index 85811df4a2e6c..16ff21dc45431 100644 --- a/mysql-test/suite/plugins/t/password_reuse_check.test +++ b/mysql-test/suite/plugins/t/password_reuse_check.test @@ -69,5 +69,32 @@ set global password_reuse_check_interval= 10; grant select on *.* to user_name@localhost identified by 'test_pwd'; show warnings; +drop table mysql.password_reuse_check_history; + +--echo # +--echo # MDEV-28838: password_reuse_check plugin mixes username and password +--echo # + +grant select on *.* to user_name@localhost identified by 'test_pwd'; + +grant select on *.* to user_nam@localhost identified by 'etest_pwd'; +show warnings; + +drop user user_name@localhost; +drop user user_nam@localhost; +drop table mysql.password_reuse_check_history; + +grant select on *.* to user_name@localhost identified by 'test_pwd'; + +grant select on *.* to tuser_name@localhos identified by 'test_pwd'; +show warnings; + +drop user user_name@localhost; +drop user tuser_name@localhos; + +--echo # +--echo # End of 10.7 tests +--echo # + drop table mysql.password_reuse_check_history; uninstall plugin password_reuse_check; diff --git a/mysql-test/suite/plugins/t/qc_info_init.inc b/mysql-test/suite/plugins/t/qc_info_init.inc index c3f700f08d0d8..ad93e5c1547dd 100644 --- a/mysql-test/suite/plugins/t/qc_info_init.inc +++ b/mysql-test/suite/plugins/t/qc_info_init.inc @@ -30,5 +30,5 @@ select * from t1; set time_zone= @time_zone, default_week_format= @default_week_format, character_set_client= @character_set_client,character_set_results= @character_set_results, sql_mode= @sql_mode, div_precision_increment= @div_precision_increment, lc_time_names= @lc_time_names, autocommit= @autocommit, group_concat_max_len= @group_concat_max_len, max_sort_length= @max_sort_length; --sorted_result ---replace_column 5 # 19 # 23 # +--replace_column 5 # 20 # 24 # select * from information_schema.query_cache_info; diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test index d8f8b9d01651f..5048ccc2446f8 100644 --- a/mysql-test/suite/plugins/t/server_audit.test +++ b/mysql-test/suite/plugins/t/server_audit.test @@ -235,3 +235,8 @@ uninstall plugin server_audit; cat_file $MYSQLD_DATADIR/server_audit.log; remove_file $MYSQLD_DATADIR/server_audit.log; +--echo # +--echo # MDEV-27631 Assertion `global_status_var.global_memory_used == 0' failed in mysqld_exit +--echo # +install plugin server_audit soname 'server_audit'; +uninstall plugin server_audit; diff --git a/mysql-test/suite/plugins/t/simple_password_check.test b/mysql-test/suite/plugins/t/simple_password_check.test index dfb078df638f7..3ce2d86cd6835 100644 --- a/mysql-test/suite/plugins/t/simple_password_check.test +++ b/mysql-test/suite/plugins/t/simple_password_check.test @@ -15,16 +15,20 @@ select * from information_schema.system_variables where variable_name like 'simp --error ER_NOT_VALID_PASSWORD create user foo1 identified by 'pwd'; +show warnings; # Create user with no password. --error ER_NOT_VALID_PASSWORD create user foo1; +show warnings; --error ER_NOT_VALID_PASSWORD grant select on *.* to foo1 identified by 'pwd'; +show warnings; --error ER_NOT_VALID_PASSWORD grant select on *.* to `FooBar1!` identified by 'FooBar1!'; +show warnings; grant select on *.* to `BarFoo1!` identified by 'FooBar1!'; drop user `BarFoo1!`; @@ -43,25 +47,32 @@ drop user foo1; --error ER_NOT_VALID_PASSWORD create user foo1 identified by '-23:qwe:ASD!'; +show warnings; --error ER_NOT_VALID_PASSWORD create user foo1 identified by '123:4we:ASD!'; +show warnings; --error ER_NOT_VALID_PASSWORD create user foo1 identified by '123:qwe:4SD!'; +show warnings; --error ER_NOT_VALID_PASSWORD create user foo1 identified by '123:qwe:ASD4'; +show warnings; create user foo1 identified by '123:qwe:ASD!'; --error ER_NOT_VALID_PASSWORD set password for foo1 = password('qwe:-23:ASD!'); +show warnings; --error ER_NOT_VALID_PASSWORD set password for foo1 = old_password('4we:123:ASD!'); --error ER_NOT_VALID_PASSWORD set password for foo1 = password('qwe:123:4SD!'); +show warnings; --error ER_NOT_VALID_PASSWORD set password for foo1 = old_password('qwe:123:ASD4'); +show warnings; set password for foo1 = password('qwe:123:ASD!'); # now, strict_password_validation @@ -69,6 +80,7 @@ select @@strict_password_validation; --error ER_NOT_VALID_PASSWORD set password for foo1 = ''; +show warnings; --error ER_OPTION_PREVENTS_STATEMENT set password for foo1 = '2222222222222222'; --error ER_OPTION_PREVENTS_STATEMENT @@ -83,6 +95,7 @@ create user foo2 identified with mysql_native_password using '111111111111111111 grant select on *.* to foo2 identified with mysql_old_password using '2222222222222222'; --error ER_NOT_VALID_PASSWORD create user foo2 identified with mysql_native_password using ''; +show warnings; --error ER_NOT_VALID_PASSWORD grant select on *.* to foo2 identified with mysql_old_password using ''; --error ER_NOT_VALID_PASSWORD @@ -95,6 +108,7 @@ set global strict_password_validation=0; --error ER_NOT_VALID_PASSWORD set password for foo1 = ''; +show warnings; set password for foo1 = '2222222222222222'; set password for foo1 = '11111111111111111111111111111111111111111'; create user foo2 identified by password '11111111111111111111111111111111111111111'; diff --git a/mysql-test/suite/plugins/t/test_sql_service.test b/mysql-test/suite/plugins/t/test_sql_service.test index b80d78fe6e5e8..0a45cb663f405 100644 --- a/mysql-test/suite/plugins/t/test_sql_service.test +++ b/mysql-test/suite/plugins/t/test_sql_service.test @@ -1,4 +1,7 @@ --source include/not_embedded.inc +--source include/have_log_bin.inc + +reset master; # clear binlogs if (!$TEST_SQL_SERVICE_SO) { skip No TEST_SQL_SERVICE plugin; @@ -11,6 +14,20 @@ source include/wait_until_count_sessions.inc; install plugin test_sql_service soname 'test_sql_service'; show status like 'test_sql_service_passed'; +set global test_sql_service_execute_sql_global= 'create table test.t1 select 1 as a, @@SQL_LOG_BIN'; +set global test_sql_service_execute_sql_local= 'insert into test.t1 select 2 as a, @@SQL_LOG_BIN'; +set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=1'; +set global test_sql_service_execute_sql_global= 'insert into test.t1 select 3 as a, @@SQL_LOG_BIN'; +set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=0'; +set global test_sql_service_execute_sql_global= 'insert into test.t1 select 4 as a, @@SQL_LOG_BIN'; +set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=1'; +set global test_sql_service_execute_sql_global= 'insert into test.t1 select 5 as a, @@sql_auto_is_null'; +set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=0'; +set global test_sql_service_execute_sql_global= 'insert into test.t1 select 6 as a, @@sql_auto_is_null'; +select * from t1 order by a; +drop table t1; +SET SQL_LOG_BIN=0; + set global test_sql_service_run_test= 1; show status like 'test_sql_service_passed'; @@ -58,3 +75,9 @@ drop table t1; uninstall plugin test_sql_service; +# Check that statements were executed/binlogged in correct order. +source include/show_binlog_events.inc; +# --replace_column 2 # 5 # +# --replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ +# SHOW BINLOG EVENTS LIMIT 3,100; + diff --git a/mysql-test/suite/roles/definer.result b/mysql-test/suite/roles/definer.result index 66c455625aa28..8b5e36d8b3c87 100644 --- a/mysql-test/suite/roles/definer.result +++ b/mysql-test/suite/roles/definer.result @@ -50,9 +50,9 @@ a+b c current_role() select * from test.v3; ERROR 28000: Access denied for user 'foo'@'localhost' (using password: NO) create definer=role4 view test.v4 as select a+b,c from t1; -ERROR 42000: ANY command denied to user 'foo'@'localhost' for table 't1' +ERROR 42000: ANY command denied to user 'foo'@'localhost' for table `mysqltest1`.`t1` select * from t1; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysqltest1`.`t1` set role role4; select * from t1; a b c @@ -113,7 +113,7 @@ tr1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci # set role none; insert t2 values (11,22,33); -ERROR 42000: INSERT command denied to user ''@'' for table 't1' +ERROR 42000: INSERT command denied to user ''@'' for table `mysqltest1`.`t1` select * from t1; a b c 1 10 100 @@ -179,7 +179,7 @@ pr1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci set role none; call pr1(); -ERROR 42000: INSERT command denied to user ''@'' for table 't1' +ERROR 42000: INSERT command denied to user ''@'' for table `mysqltest1`.`t1` select * from t1; a b c 1 10 100 @@ -275,47 +275,42 @@ a b c 2 20 200 delete from t1 where a=111; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `test`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v1` ( - `a+b` tinyint NOT NULL, - `c` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v1` AS SELECT + 1 AS `a+b`, + 1 AS `c` */; SET character_set_client = @saved_cs_client; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v2` ( - `a+b` tinyint NOT NULL, - `c` tinyint NOT NULL, - `current_role()` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v2` AS SELECT + 1 AS `a+b`, + 1 AS `c`, + 1 AS `current_role()` */; SET character_set_client = @saved_cs_client; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v3` ( - `a+b` tinyint NOT NULL, - `c` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v3` AS SELECT + 1 AS `a+b`, + 1 AS `c` */; SET character_set_client = @saved_cs_client; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v4` ( - `a+b` tinyint NOT NULL, - `c` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v4` AS SELECT + 1 AS `a+b`, + 1 AS `c` */; SET character_set_client = @saved_cs_client; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v5` ( - `a+b` tinyint NOT NULL, - `c` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v5` AS SELECT + 1 AS `a+b`, + 1 AS `c` */; SET character_set_client = @saved_cs_client; -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `mysqltest1`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -324,7 +319,7 @@ CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` VALUES (1,10,100), @@ -335,7 +330,7 @@ CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t2` VALUES (2,20,200); @@ -441,14 +436,14 @@ DELIMITER ;; /*!50003 SET collation_connection = @saved_col_connection */ ;; DELIMITER ; /*!50106 SET TIME_ZONE= @save_time_zone */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = latin1 */ ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`role1` FUNCTION `fn1`() RETURNS int(11) return (select sum(a+b) from t1) ;; @@ -457,14 +452,14 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = latin1 */ ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`role2` FUNCTION `fn2`() RETURNS int(11) return (select sum(a+b) from t1) ;; @@ -473,14 +468,14 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = latin1 */ ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`role3`@`%` FUNCTION `fn3`() RETURNS int(11) return (select sum(a+b) from t1) ;; @@ -489,14 +484,14 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = latin1 */ ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`role1` PROCEDURE `pr1`() insert t1 values (111, 222, 333) ;; @@ -505,14 +500,14 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = latin1 */ ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`role2`@`%` PROCEDURE `pr2`() insert t1 values (111, 222, 333) ;; @@ -521,14 +516,14 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = latin1 */ ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`role3`@`%` PROCEDURE `pr3`() insert t1 values (111, 222, 333) ;; @@ -539,7 +534,7 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; USE `test`; -/*!50001 DROP TABLE IF EXISTS `v1`*/; +/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -550,7 +545,7 @@ USE `test`; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -/*!50001 DROP TABLE IF EXISTS `v2`*/; +/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -561,7 +556,7 @@ USE `test`; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -/*!50001 DROP TABLE IF EXISTS `v3`*/; +/*!50001 DROP VIEW IF EXISTS `v3`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -574,7 +569,7 @@ USE `test`; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -/*!50001 DROP TABLE IF EXISTS `v4`*/; +/*!50001 DROP VIEW IF EXISTS `v4`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -587,7 +582,7 @@ USE `test`; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -/*!50001 DROP TABLE IF EXISTS `v5`*/; +/*!50001 DROP VIEW IF EXISTS `v5`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; diff --git a/mysql-test/suite/roles/recursive.result b/mysql-test/suite/roles/recursive.result index 0d45a0e03d0c0..daacd2ed2501e 100644 --- a/mysql-test/suite/roles/recursive.result +++ b/mysql-test/suite/roles/recursive.result @@ -49,7 +49,7 @@ show status like 'debug%'; Variable_name Value connection foo; select count(*) from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` set role role10; select count(*) from mysql.roles_mapping; count(*) @@ -99,7 +99,7 @@ count(*) set role none; set role role10; select count(*) from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` set role none; connection default; grant select on mysql.* to role1; @@ -107,7 +107,7 @@ show status like 'debug%'; Variable_name Value connection foo; select count(*) from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` set role role10; select count(*) from mysql.roles_mapping; count(*) @@ -142,7 +142,7 @@ show status like 'debug%'; Variable_name Value connection foo; select count(*) from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` set role none; connection default; grant select on mysql.roles_mapping to role1; @@ -150,7 +150,7 @@ show status like 'debug%'; Variable_name Value connection foo; select count(*) from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` set role role10; select count(*) from mysql.roles_mapping; count(*) @@ -185,7 +185,7 @@ show status like 'debug%'; Variable_name Value connection foo; select count(*) from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` set role none; connection default; grant select(User) on mysql.roles_mapping to role1; @@ -193,7 +193,7 @@ show status like 'debug%'; Variable_name Value connection foo; select count(*) from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` set role role10; select count(concat(User,Host,Role)) from mysql.roles_mapping; ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'Host' in table 'roles_mapping' @@ -202,7 +202,7 @@ count(concat(User)) 22 show grants; Grants for foo@localhost -GRANT SELECT (User) ON `mysql`.`roles_mapping` TO `role1` +GRANT SELECT (`User`) ON `mysql`.`roles_mapping` TO `role1` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `role10` GRANT USAGE ON *.* TO `role1` @@ -236,8 +236,8 @@ count(concat(User,Host)) 22 show grants; Grants for foo@localhost -GRANT SELECT (Host) ON `mysql`.`roles_mapping` TO `role3` -GRANT SELECT (User) ON `mysql`.`roles_mapping` TO `role1` +GRANT SELECT (`Host`) ON `mysql`.`roles_mapping` TO `role3` +GRANT SELECT (`User`) ON `mysql`.`roles_mapping` TO `role1` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `role10` GRANT USAGE ON *.* TO `role1` @@ -275,7 +275,7 @@ show status like 'debug%'; Variable_name Value connection foo; select count(concat(Host)) from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` set role none; connection default; create procedure pr1() select "pr1"; diff --git a/mysql-test/suite/roles/recursive_dbug.result b/mysql-test/suite/roles/recursive_dbug.result index 417602c5c60ef..b94f55ae6fb0b 100644 --- a/mysql-test/suite/roles/recursive_dbug.result +++ b/mysql-test/suite/roles/recursive_dbug.result @@ -56,14 +56,14 @@ connection default; grant select on *.* to role1; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 19 +Debug_role_merges_global 20 Debug_role_merges_db 0 Debug_role_merges_table 0 Debug_role_merges_column 0 Debug_role_merges_routine 0 connection foo; select count(*) from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` set role role10; select count(*) from mysql.roles_mapping; count(*) @@ -106,7 +106,7 @@ connection default; revoke select on *.* from role1; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 +Debug_role_merges_global 29 Debug_role_merges_db 0 Debug_role_merges_table 0 Debug_role_merges_column 0 @@ -118,20 +118,20 @@ count(*) set role none; set role role10; select count(*) from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` set role none; connection default; grant select on mysql.* to role1; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 8 +Debug_role_merges_global 29 +Debug_role_merges_db 9 Debug_role_merges_table 0 Debug_role_merges_column 0 Debug_role_merges_routine 0 connection foo; select count(*) from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` set role role10; select count(*) from mysql.roles_mapping; count(*) @@ -164,27 +164,27 @@ connection default; revoke select on mysql.* from role1; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 16 +Debug_role_merges_global 29 +Debug_role_merges_db 17 Debug_role_merges_table 0 Debug_role_merges_column 0 Debug_role_merges_routine 0 connection foo; select count(*) from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` set role none; connection default; grant select on mysql.roles_mapping to role1; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 16 -Debug_role_merges_table 8 +Debug_role_merges_global 29 +Debug_role_merges_db 17 +Debug_role_merges_table 9 Debug_role_merges_column 0 Debug_role_merges_routine 0 connection foo; select count(*) from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` set role role10; select count(*) from mysql.roles_mapping; count(*) @@ -217,27 +217,27 @@ connection default; revoke select on mysql.roles_mapping from role1; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 16 -Debug_role_merges_table 16 +Debug_role_merges_global 29 +Debug_role_merges_db 17 +Debug_role_merges_table 17 Debug_role_merges_column 0 Debug_role_merges_routine 0 connection foo; select count(*) from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` set role none; connection default; grant select(User) on mysql.roles_mapping to role1; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 16 -Debug_role_merges_table 24 -Debug_role_merges_column 8 +Debug_role_merges_global 29 +Debug_role_merges_db 17 +Debug_role_merges_table 26 +Debug_role_merges_column 9 Debug_role_merges_routine 0 connection foo; select count(*) from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` set role role10; select count(concat(User,Host,Role)) from mysql.roles_mapping; ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'Host' in table 'roles_mapping' @@ -246,7 +246,7 @@ count(concat(User)) 22 show grants; Grants for foo@localhost -GRANT SELECT (User) ON `mysql`.`roles_mapping` TO `role1` +GRANT SELECT (`User`) ON `mysql`.`roles_mapping` TO `role1` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `role10` GRANT USAGE ON *.* TO `role1` @@ -272,10 +272,10 @@ connection default; grant select(Host) on mysql.roles_mapping to role3; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 16 -Debug_role_merges_table 30 -Debug_role_merges_column 14 +Debug_role_merges_global 29 +Debug_role_merges_db 17 +Debug_role_merges_table 33 +Debug_role_merges_column 16 Debug_role_merges_routine 0 connection foo; select count(concat(User,Host,Role)) from mysql.roles_mapping; @@ -285,8 +285,8 @@ count(concat(User,Host)) 22 show grants; Grants for foo@localhost -GRANT SELECT (Host) ON `mysql`.`roles_mapping` TO `role3` -GRANT SELECT (User) ON `mysql`.`roles_mapping` TO `role1` +GRANT SELECT (`Host`) ON `mysql`.`roles_mapping` TO `role3` +GRANT SELECT (`User`) ON `mysql`.`roles_mapping` TO `role1` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `role10` GRANT USAGE ON *.* TO `role1` @@ -312,10 +312,10 @@ connection default; revoke select(User) on mysql.roles_mapping from role1; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 16 -Debug_role_merges_table 38 -Debug_role_merges_column 22 +Debug_role_merges_global 29 +Debug_role_merges_db 17 +Debug_role_merges_table 41 +Debug_role_merges_column 24 Debug_role_merges_routine 0 connection foo; select count(concat(User,Host)) from mysql.roles_mapping; @@ -327,14 +327,14 @@ connection default; revoke select(Host) on mysql.roles_mapping from role3; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 16 -Debug_role_merges_table 44 -Debug_role_merges_column 28 +Debug_role_merges_global 29 +Debug_role_merges_db 17 +Debug_role_merges_table 47 +Debug_role_merges_column 30 Debug_role_merges_routine 0 connection foo; select count(concat(Host)) from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` set role none; connection default; create procedure pr1() select "pr1"; @@ -342,11 +342,11 @@ create function fn1() returns char(10) return "fn1"; grant execute on procedure test.pr1 to role1; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 16 -Debug_role_merges_table 44 -Debug_role_merges_column 28 -Debug_role_merges_routine 8 +Debug_role_merges_global 29 +Debug_role_merges_db 17 +Debug_role_merges_table 47 +Debug_role_merges_column 30 +Debug_role_merges_routine 9 connection foo; call pr1(); ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test.pr1' @@ -360,11 +360,11 @@ connection default; grant execute on function test.fn1 to role5; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 16 -Debug_role_merges_table 44 -Debug_role_merges_column 28 -Debug_role_merges_routine 13 +Debug_role_merges_global 29 +Debug_role_merges_db 17 +Debug_role_merges_table 47 +Debug_role_merges_column 30 +Debug_role_merges_routine 15 connection foo; select fn1(); fn1() @@ -373,11 +373,11 @@ connection default; revoke execute on procedure test.pr1 from role1; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 16 -Debug_role_merges_table 44 -Debug_role_merges_column 28 -Debug_role_merges_routine 21 +Debug_role_merges_global 29 +Debug_role_merges_db 17 +Debug_role_merges_table 47 +Debug_role_merges_column 30 +Debug_role_merges_routine 23 connection foo; call pr1(); ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test.pr1' @@ -388,11 +388,11 @@ connection default; revoke execute on function test.fn1 from role5; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 16 -Debug_role_merges_table 44 -Debug_role_merges_column 28 -Debug_role_merges_routine 26 +Debug_role_merges_global 29 +Debug_role_merges_db 17 +Debug_role_merges_table 47 +Debug_role_merges_column 30 +Debug_role_merges_routine 28 connection foo; select fn1(); ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test.fn1' @@ -403,67 +403,67 @@ drop function fn1; grant select on mysql.roles_mapping to role3; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 16 -Debug_role_merges_table 50 -Debug_role_merges_column 28 -Debug_role_merges_routine 26 +Debug_role_merges_global 29 +Debug_role_merges_db 17 +Debug_role_merges_table 54 +Debug_role_merges_column 30 +Debug_role_merges_routine 28 grant select on mysql.roles_mapping to role1; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 16 -Debug_role_merges_table 53 -Debug_role_merges_column 28 -Debug_role_merges_routine 26 +Debug_role_merges_global 29 +Debug_role_merges_db 17 +Debug_role_merges_table 58 +Debug_role_merges_column 30 +Debug_role_merges_routine 28 revoke select on mysql.roles_mapping from role3; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 16 -Debug_role_merges_table 54 -Debug_role_merges_column 28 -Debug_role_merges_routine 26 +Debug_role_merges_global 29 +Debug_role_merges_db 17 +Debug_role_merges_table 59 +Debug_role_merges_column 30 +Debug_role_merges_routine 28 revoke select on mysql.roles_mapping from role1; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 16 -Debug_role_merges_table 62 -Debug_role_merges_column 28 -Debug_role_merges_routine 26 +Debug_role_merges_global 29 +Debug_role_merges_db 17 +Debug_role_merges_table 67 +Debug_role_merges_column 30 +Debug_role_merges_routine 28 grant select on mysql.* to role1; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 24 -Debug_role_merges_table 62 -Debug_role_merges_column 28 -Debug_role_merges_routine 26 +Debug_role_merges_global 29 +Debug_role_merges_db 26 +Debug_role_merges_table 67 +Debug_role_merges_column 30 +Debug_role_merges_routine 28 grant select on test.* to role1; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 32 -Debug_role_merges_table 62 -Debug_role_merges_column 28 -Debug_role_merges_routine 26 +Debug_role_merges_global 29 +Debug_role_merges_db 35 +Debug_role_merges_table 67 +Debug_role_merges_column 30 +Debug_role_merges_routine 28 revoke select on mysql.* from role1; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 40 -Debug_role_merges_table 62 -Debug_role_merges_column 28 -Debug_role_merges_routine 26 +Debug_role_merges_global 29 +Debug_role_merges_db 43 +Debug_role_merges_table 67 +Debug_role_merges_column 30 +Debug_role_merges_routine 28 revoke select on test.* from role1; show status like 'debug%'; Variable_name Value -Debug_role_merges_global 27 -Debug_role_merges_db 48 -Debug_role_merges_table 62 -Debug_role_merges_column 28 -Debug_role_merges_routine 26 +Debug_role_merges_global 29 +Debug_role_merges_db 51 +Debug_role_merges_table 67 +Debug_role_merges_column 30 +Debug_role_merges_routine 28 connection default; drop user foo@localhost; drop role role1; diff --git a/mysql-test/suite/roles/rename_user.result b/mysql-test/suite/roles/rename_user.result index 9550e15953a55..367f6e4b0fe19 100644 --- a/mysql-test/suite/roles/rename_user.result +++ b/mysql-test/suite/roles/rename_user.result @@ -25,3 +25,12 @@ newhost test_user_rm test_role1 N delete from mysql.roles_mapping; delete from mysql.user where user like 'test%'; flush privileges; +# +# MDEV-29131 Assertion `status == 0' failed when renaming user after deleting table roles_mapping +# +create role r; +rename table mysql.roles_mapping to test.t1; +rename user current_user to a@a; +rename user a@a to root@localhost; +rename table test.t1 to mysql.roles_mapping; +drop role r; diff --git a/mysql-test/suite/roles/rename_user.test b/mysql-test/suite/roles/rename_user.test index 45429b7666662..8c8993528479d 100644 --- a/mysql-test/suite/roles/rename_user.test +++ b/mysql-test/suite/roles/rename_user.test @@ -36,3 +36,13 @@ delete from mysql.roles_mapping; delete from mysql.user where user like 'test%'; flush privileges; +--echo # +--echo # MDEV-29131 Assertion `status == 0' failed when renaming user after deleting table roles_mapping +--echo # +create role r; +rename table mysql.roles_mapping to test.t1; +rename user current_user to a@a; +rename user a@a to root@localhost; +rename table test.t1 to mysql.roles_mapping; +drop role r; + diff --git a/mysql-test/suite/roles/role_case_sensitive-10744.result b/mysql-test/suite/roles/role_case_sensitive-10744.result index 2f27db1525a9c..8cb45b13ae076 100644 --- a/mysql-test/suite/roles/role_case_sensitive-10744.result +++ b/mysql-test/suite/roles/role_case_sensitive-10744.result @@ -44,7 +44,7 @@ show tables from secret_db; Tables_in_secret_db t1 select * from secret_db.t1; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `secret_db`.`t1` insert into secret_db.t1 values ("|-|4><"); set role test_role; select * from secret_db.t1 order by secret; @@ -52,7 +52,7 @@ secret Some Secret P4ssw0rd |-|4>< insert into secret_db.t1 values ("|_33T|-|4><"); -ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table `secret_db`.`t1` connection default; drop role test_ROLE; drop role test_role; diff --git a/mysql-test/suite/roles/role_grant_propagate.result b/mysql-test/suite/roles/role_grant_propagate.result new file mode 100644 index 0000000000000..111fd4dbc28c7 --- /dev/null +++ b/mysql-test/suite/roles/role_grant_propagate.result @@ -0,0 +1,180 @@ +# +# MDEV-29458 Role grant commands do not propagate all grants +# +create user foo; +create database some_db; +create table some_db.t1 (a int, b int, secret int); +CREATE PROCEDURE some_db.p1 (OUT param1 INT) +BEGIN +SELECT COUNT(*) INTO param1 FROM some_db.t1; +END; +// +CREATE FUNCTION some_db.f1 (param1 INT) RETURNS INT +BEGIN +DECLARE c INT; +SET c = 100; +RETURN param1 + c; +END; +// +# +# These roles will form a two level hierarchy. +# The "select" role will have the select privilege, while +# the active role will inherit the select role. +# +# The active role will be granted a different privilege but on the same +# level (global, database, table, proc respectively) *after* the 'select' +# role has been granted its select privilege. +# +create role r_select_global; +create role r_active_global; +create role r_select_database; +create role r_active_database; +create role r_select_table; +create role r_active_table; +create role r_select_column; +create role r_active_column; +create role r_execute_proc; +create role r_active_proc; +create role r_execute_func; +create role r_active_func; +grant r_select_global to r_active_global; +grant r_select_database to r_active_database; +grant r_select_table to r_active_table; +grant r_select_column to r_active_column; +grant r_execute_proc to r_active_proc; +grant r_execute_func to r_active_func; +# +# These 3 roles form a chain, where only the upper level has select +# privileges and the middle level will receive a grant for the same level +# privilege, but different kind (for example select on upper and insert +# on middle). +# +# The lower level should inherit both rights. +# +create role upper_level; +create role middle_level; +create role lower_level; +grant upper_level to middle_level; +grant middle_level to lower_level; +grant r_active_global to foo; +grant r_active_database to foo; +grant r_active_table to foo; +grant r_active_column to foo; +grant r_active_proc to foo; +grant r_active_func to foo; +grant lower_level to foo; +grant select on *.* to r_select_global; +grant select on some_db.* to r_select_database; +grant select on some_db.t1 to r_select_table; +grant select(a) on some_db.t1 to r_select_column; +grant select on *.* to upper_level; +grant execute on procedure some_db.p1 to r_execute_proc; +grant execute on function some_db.f1 to r_execute_func; +# +# Granting a privilege different than select on the corresponding level. +# This tests that the base role correctly inherits its granted roles +# privileges. +# +grant insert on *.* to r_active_global; +grant insert on some_db.* to r_active_database; +grant insert on some_db.t1 to r_active_table; +grant insert(a) on some_db.t1 to r_active_column; +grant insert on *.* to middle_level; +grant alter routine on procedure some_db.p1 to r_active_proc; +grant alter routine on function some_db.f1 to r_active_func; +connect con1, localhost, foo,,; +select * from some_db.t1; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `some_db`.`t1` +# +# Before MDEV-29458 fix, all these commands would return +# ER_TABLEACCESS_DENIED_ERROR +# +set role r_active_global; +select * from some_db.t1; +a b secret +set role r_active_database; +select * from some_db.t1; +a b secret +set role r_active_table; +select * from some_db.t1; +a b secret +set role r_active_column; +select a from some_db.t1; +a +set role lower_level; +select * from some_db.t1; +a b secret +set role r_active_proc; +set @var=100; +call some_db.p1(@var); +set role r_active_func; +select some_db.f1(10); +some_db.f1(10) +110 +disconnect con1; +# +# Cleanup. +# +connection default; +drop database some_db; +drop role r_select_global, r_select_database, r_select_table, r_select_column; +drop role r_active_global, r_active_database, r_active_table, r_active_column; +drop role r_execute_proc, r_execute_func; +drop role r_active_proc, r_active_func; +drop role upper_level, middle_level, lower_level; +drop user foo; +# +# Test that dropping of roles clears the intermediate generated +# (such as an `acl_dbs` element with 0 init_access, but with access != 0) +# datastructures. +# +create role test_role1; +create role test_role2; +grant test_role2 to test_role1; +grant select on mysql.* to test_role2; +grant select on mysql.user to test_role2; +grant select(user) on mysql.user to test_role2; +drop role test_role1, test_role2; +create role test_role1; +drop role test_role1; +# +# MDEV-29851 Cached role privileges are not invalidated when needed +# +create role admin; +create role student; +create database crm; +grant create on crm.* to admin; +grant select on crm.* to student; +create user intern@localhost; +grant student to intern@localhost; +set default role student for intern@localhost; +connect con1, localhost, intern; +use crm; +disconnect con1; +connection default; +grant admin to student; +connect con1, localhost, intern; +use crm; +create table t1 (a int); +disconnect con1; +connection default; +drop user intern@localhost; +drop role student; +drop role admin; +drop database crm; +# +# MDEV-30526 Assertion `rights == merged->cols' failed in update_role_columns +# +create table t1 ( pk int, i int); +create role a; +grant select (i), update (pk) on t1 to a; +revoke update (pk) on t1 from a; +show grants for a; +Grants for a +GRANT USAGE ON *.* TO `a` +GRANT SELECT (`i`) ON `test`.`t1` TO `a` +drop role a; +drop table t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/suite/roles/role_grant_propagate.test b/mysql-test/suite/roles/role_grant_propagate.test new file mode 100644 index 0000000000000..02d451f0afdcb --- /dev/null +++ b/mysql-test/suite/roles/role_grant_propagate.test @@ -0,0 +1,212 @@ +--source include/not_embedded.inc + +--echo # +--echo # MDEV-29458 Role grant commands do not propagate all grants +--echo # + +create user foo; +create database some_db; +create table some_db.t1 (a int, b int, secret int); + +delimiter //; +CREATE PROCEDURE some_db.p1 (OUT param1 INT) + BEGIN + SELECT COUNT(*) INTO param1 FROM some_db.t1; + END; +// +delimiter ;// + +delimiter //; +CREATE FUNCTION some_db.f1 (param1 INT) RETURNS INT + BEGIN + DECLARE c INT; + SET c = 100; + RETURN param1 + c; + END; +// +delimiter ;// + +--echo # +--echo # These roles will form a two level hierarchy. +--echo # The "select" role will have the select privilege, while +--echo # the active role will inherit the select role. +--echo # +--echo # The active role will be granted a different privilege but on the same +--echo # level (global, database, table, proc respectively) *after* the 'select' +--echo # role has been granted its select privilege. +--echo # + +create role r_select_global; +create role r_active_global; + +create role r_select_database; +create role r_active_database; + +create role r_select_table; +create role r_active_table; + +create role r_select_column; +create role r_active_column; + +create role r_execute_proc; +create role r_active_proc; + +create role r_execute_func; +create role r_active_func; + +grant r_select_global to r_active_global; +grant r_select_database to r_active_database; +grant r_select_table to r_active_table; +grant r_select_column to r_active_column; +grant r_execute_proc to r_active_proc; +grant r_execute_func to r_active_func; + +--echo # +--echo # These 3 roles form a chain, where only the upper level has select +--echo # privileges and the middle level will receive a grant for the same level +--echo # privilege, but different kind (for example select on upper and insert +--echo # on middle). +--echo # +--echo # The lower level should inherit both rights. +--echo # +create role upper_level; +create role middle_level; +create role lower_level; + +grant upper_level to middle_level; +grant middle_level to lower_level; + +grant r_active_global to foo; +grant r_active_database to foo; +grant r_active_table to foo; +grant r_active_column to foo; +grant r_active_proc to foo; +grant r_active_func to foo; +grant lower_level to foo; + +grant select on *.* to r_select_global; +grant select on some_db.* to r_select_database; +grant select on some_db.t1 to r_select_table; +grant select(a) on some_db.t1 to r_select_column; +grant select on *.* to upper_level; + +grant execute on procedure some_db.p1 to r_execute_proc; +grant execute on function some_db.f1 to r_execute_func; + + +--echo # +--echo # Granting a privilege different than select on the corresponding level. +--echo # This tests that the base role correctly inherits its granted roles +--echo # privileges. +--echo # +grant insert on *.* to r_active_global; +grant insert on some_db.* to r_active_database; +grant insert on some_db.t1 to r_active_table; +grant insert(a) on some_db.t1 to r_active_column; +grant insert on *.* to middle_level; + +grant alter routine on procedure some_db.p1 to r_active_proc; +grant alter routine on function some_db.f1 to r_active_func; + +--connect (con1, localhost, foo,,) +--error ER_TABLEACCESS_DENIED_ERROR +select * from some_db.t1; + +--echo # +--echo # Before MDEV-29458 fix, all these commands would return +--echo # ER_TABLEACCESS_DENIED_ERROR +--echo # +set role r_active_global; +select * from some_db.t1; +set role r_active_database; +select * from some_db.t1; +set role r_active_table; +select * from some_db.t1; +set role r_active_column; +select a from some_db.t1; +set role lower_level; +select * from some_db.t1; + +set role r_active_proc; +set @var=100; +call some_db.p1(@var); + +set role r_active_func; +select some_db.f1(10); + +disconnect con1; + +--echo # +--echo # Cleanup. +--echo # +connection default; + +drop database some_db; +drop role r_select_global, r_select_database, r_select_table, r_select_column; +drop role r_active_global, r_active_database, r_active_table, r_active_column; +drop role r_execute_proc, r_execute_func; +drop role r_active_proc, r_active_func; +drop role upper_level, middle_level, lower_level; +drop user foo; + +--echo # +--echo # Test that dropping of roles clears the intermediate generated +--echo # (such as an `acl_dbs` element with 0 init_access, but with access != 0) +--echo # datastructures. +--echo # +create role test_role1; +create role test_role2; + +grant test_role2 to test_role1; +grant select on mysql.* to test_role2; +grant select on mysql.user to test_role2; +grant select(user) on mysql.user to test_role2; +drop role test_role1, test_role2; + +create role test_role1; +drop role test_role1; + +--echo # +--echo # MDEV-29851 Cached role privileges are not invalidated when needed +--echo # +create role admin; +create role student; +create database crm; +grant create on crm.* to admin; +grant select on crm.* to student; +create user intern@localhost; +grant student to intern@localhost; +set default role student for intern@localhost; + +connect con1, localhost, intern; +use crm; +disconnect con1; + +connection default; +grant admin to student; + +connect con1, localhost, intern; +use crm; +create table t1 (a int); +disconnect con1; + +connection default; +drop user intern@localhost; +drop role student; +drop role admin; +drop database crm; + +--echo # +--echo # MDEV-30526 Assertion `rights == merged->cols' failed in update_role_columns +--echo # +create table t1 ( pk int, i int); +create role a; +grant select (i), update (pk) on t1 to a; +revoke update (pk) on t1 from a; +show grants for a; +drop role a; +drop table t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/suite/roles/roles_tables_priv-29465.result b/mysql-test/suite/roles/roles_tables_priv-29465.result new file mode 100644 index 0000000000000..85ab188145eac --- /dev/null +++ b/mysql-test/suite/roles/roles_tables_priv-29465.result @@ -0,0 +1,38 @@ +create user foo; +create database some_db; +create table some_db.t1 (a int, b int, secret int); +create role r_select_column; +create role r_active_column; +grant r_select_column to r_active_column; +grant r_active_column to foo; +grant select(a) on some_db.t1 to r_select_column; +select * from mysql.tables_priv order by user; +Host Db User Table_name Grantor Timestamp Table_priv Column_priv +localhost mysql mariadb.sys global_priv root@localhost 0000-00-00 00:00:00 Select,Delete + some_db r_select_column t1 root@localhost 0000-00-00 00:00:00 Select +grant insert(a) on some_db.t1 to r_active_column; +select * from mysql.tables_priv order by user; +Host Db User Table_name Grantor Timestamp Table_priv Column_priv +localhost mysql mariadb.sys global_priv root@localhost 0000-00-00 00:00:00 Select,Delete + some_db r_active_column t1 root@localhost 0000-00-00 00:00:00 Insert + some_db r_select_column t1 root@localhost 0000-00-00 00:00:00 Select +connect con1, localhost, foo,,; +insert into some_db.t1(a) values (1); +ERROR 42000: INSERT command denied to user 'foo'@'localhost' for table `some_db`.`t1` +set role r_active_column; +insert into some_db.t1(a) values (1); +disconnect con1; +connection default; +revoke insert(a) on some_db.t1 from r_active_column; +connect con1, localhost, foo,,; +insert into some_db.t1(a) values (1); +ERROR 42000: INSERT command denied to user 'foo'@'localhost' for table `some_db`.`t1` +set role r_active_column; +insert into some_db.t1(a) values (1); +ERROR 42000: INSERT command denied to user 'foo'@'localhost' for table `some_db`.`t1` +disconnect con1; +connection default; +drop role r_select_column; +drop role r_active_column; +drop user foo; +drop database some_db; diff --git a/mysql-test/suite/roles/roles_tables_priv-29465.test b/mysql-test/suite/roles/roles_tables_priv-29465.test new file mode 100644 index 0000000000000..550b05a408aa1 --- /dev/null +++ b/mysql-test/suite/roles/roles_tables_priv-29465.test @@ -0,0 +1,40 @@ +--source include/not_embedded.inc + +create user foo; +create database some_db; +create table some_db.t1 (a int, b int, secret int); + +create role r_select_column; +create role r_active_column; +grant r_select_column to r_active_column; +grant r_active_column to foo; + +grant select(a) on some_db.t1 to r_select_column; +select * from mysql.tables_priv order by user; +grant insert(a) on some_db.t1 to r_active_column; +select * from mysql.tables_priv order by user; + +--connect (con1, localhost, foo,,) +--error ER_TABLEACCESS_DENIED_ERROR +insert into some_db.t1(a) values (1); +set role r_active_column; +insert into some_db.t1(a) values (1); +disconnect con1; + +connection default; +revoke insert(a) on some_db.t1 from r_active_column; + +--connect (con1, localhost, foo,,) +--error ER_TABLEACCESS_DENIED_ERROR +insert into some_db.t1(a) values (1); +set role r_active_column; +--error ER_TABLEACCESS_DENIED_ERROR +insert into some_db.t1(a) values (1); +disconnect con1; + +connection default; + +drop role r_select_column; +drop role r_active_column; +drop user foo; +drop database some_db; diff --git a/mysql-test/suite/roles/set_and_drop.result b/mysql-test/suite/roles/set_and_drop.result index 87ccad2b44707..e52a82bd77b33 100644 --- a/mysql-test/suite/roles/set_and_drop.result +++ b/mysql-test/suite/roles/set_and_drop.result @@ -18,7 +18,7 @@ connect foo,localhost,foo; flush tables; ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` show tables from mysqltest1; ERROR 42000: Access denied for user 'foo'@'localhost' to database 'mysqltest1' set role role1; @@ -38,7 +38,7 @@ a b 1 2 3 4 select * from mysqltest1.t2; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysqltest1`.`t2` select a from mysqltest1.t2; a 5 @@ -64,11 +64,11 @@ ROLE_NAME role1 flush tables; select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` select * from mysqltest1.t1; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysqltest1`.`t1` select a from mysqltest1.t2; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysqltest1`.`t2` set role none; connection default; grant reload on *.* to role1; @@ -92,7 +92,7 @@ a b 1 2 3 4 select * from mysqltest1.t2; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysqltest1`.`t2` select a from mysqltest1.t2; a 5 @@ -105,11 +105,11 @@ drop role role1; connection foo; flush tables; select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping` select * from mysqltest1.t1; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysqltest1`.`t1` select a from mysqltest1.t2; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2' +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysqltest1`.`t2` show grants; Grants for foo@localhost GRANT USAGE ON *.* TO `foo`@`localhost` diff --git a/mysql-test/suite/roles/set_default_role_clear.result b/mysql-test/suite/roles/set_default_role_clear.result index d8508f5d0d68a..8a3ae908435c5 100644 --- a/mysql-test/suite/roles/set_default_role_clear.result +++ b/mysql-test/suite/roles/set_default_role_clear.result @@ -8,7 +8,7 @@ GRANT `test_role` TO `test_user`@`localhost` GRANT USAGE ON *.* TO `test_user`@`localhost` set default role test_role; select user, host, default_role from mysql.user; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'user' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`user` select user, host, default_role from mysql.user where user='test_user'; User Host default_role test_user localhost test_role @@ -31,6 +31,6 @@ select user, host, default_role from mysql.user where user='test_user'; User Host default_role test_user localhost select user, host, default_role from mysql.user; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'user' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`user` drop role test_role; drop user test_user@localhost; diff --git a/mysql-test/suite/roles/set_default_role_for.result b/mysql-test/suite/roles/set_default_role_for.result index 3ddf48eb41619..57a1471126cbd 100644 --- a/mysql-test/suite/roles/set_default_role_for.result +++ b/mysql-test/suite/roles/set_default_role_for.result @@ -45,7 +45,7 @@ GRANT USAGE ON *.* TO `user_b`@`localhost` GRANT INSERT, UPDATE ON *.* TO `role_b` SET DEFAULT ROLE `role_b` FOR `user_b`@`localhost` select user, host, default_role from mysql.user where user like 'user_%'; -ERROR 42000: SELECT command denied to user 'user_b'@'localhost' for table 'user' +ERROR 42000: SELECT command denied to user 'user_b'@'localhost' for table `mysql`.`user` set default role NONE for user_a@localhost; show grants; Grants for user_a@localhost @@ -53,7 +53,7 @@ GRANT `role_a` TO `user_a`@`localhost` GRANT USAGE ON *.* TO `user_a`@`localhost` GRANT INSERT, UPDATE ON *.* TO `role_b` select user, host, default_role from mysql.user where user like 'user_%'; -ERROR 42000: SELECT command denied to user 'user_a'@'localhost' for table 'user' +ERROR 42000: SELECT command denied to user 'user_a'@'localhost' for table `mysql`.`user` drop role role_a; drop role role_b; drop user user_a@localhost; diff --git a/mysql-test/suite/roles/set_default_role_invalid.result b/mysql-test/suite/roles/set_default_role_invalid.result index eb3924dc617d6..12e2c035a7db7 100644 --- a/mysql-test/suite/roles/set_default_role_invalid.result +++ b/mysql-test/suite/roles/set_default_role_invalid.result @@ -8,14 +8,14 @@ Grants for test_user@localhost GRANT `test_role` TO `test_user`@`localhost` GRANT USAGE ON *.* TO `test_user`@`localhost` select user, host, default_role from mysql.user; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'user' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`user` set default role invalid_role; ERROR OP000: Invalid role specification `invalid_role` set default role not_granted_role; ERROR OP000: Invalid role specification `not_granted_role` set default role test_role; select user, host, default_role from mysql.user; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'user' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`user` select user, host, default_role from mysql.user where user='test_user'; User Host default_role test_user localhost test_role @@ -35,7 +35,7 @@ User Host default_role test_user localhost test_role revoke test_role from test_user@localhost; select user, host, default_role from mysql.user where user='test_user'; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'user' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`user` drop role test_role; drop role not_granted_role; drop user test_user@localhost; diff --git a/mysql-test/suite/roles/set_default_role_new_connection.result b/mysql-test/suite/roles/set_default_role_new_connection.result index 5c51b782ab771..95c712746db44 100644 --- a/mysql-test/suite/roles/set_default_role_new_connection.result +++ b/mysql-test/suite/roles/set_default_role_new_connection.result @@ -8,10 +8,10 @@ Grants for test_user@localhost GRANT `test_role` TO `test_user`@`localhost` GRANT USAGE ON *.* TO `test_user`@`localhost` select user, host, default_role from mysql.user where user = 'test_user'; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'user' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`user` set default role test_role; select user, host, default_role from mysql.user where user = 'test_user'; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'user' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`user` disconnect c1; connection default; select user, host, default_role from mysql.user where user = 'test_user'; @@ -39,7 +39,7 @@ Grants for test_user@localhost GRANT `test_role` TO `test_user`@`localhost` GRANT USAGE ON *.* TO `test_user`@`localhost` select user, host, default_role from mysql.user where user = 'test_user'; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'user' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`user` disconnect c1; connection default; select user, host, default_role from mysql.user where user = 'test_user'; diff --git a/mysql-test/suite/roles/set_role-5232.result b/mysql-test/suite/roles/set_role-5232.result index 31cb4b105ecb0..6158c95e5c0ab 100644 --- a/mysql-test/suite/roles/set_role-5232.result +++ b/mysql-test/suite/roles/set_role-5232.result @@ -8,7 +8,7 @@ select user(), current_user(); user() current_user() c@localhost @localhost select user from mysql.user group by user; -ERROR 42000: SELECT command denied to user ''@'localhost' for table 'user' +ERROR 42000: SELECT command denied to user ''@'localhost' for table `mysql`.`user` set role r1; ERROR OP000: Invalid role specification `r1` disconnect c; diff --git a/mysql-test/suite/roles/set_role-database-recursive.result b/mysql-test/suite/roles/set_role-database-recursive.result index bc3914413a382..be31e645362e7 100644 --- a/mysql-test/suite/roles/set_role-database-recursive.result +++ b/mysql-test/suite/roles/set_role-database-recursive.result @@ -24,7 +24,7 @@ user host grant select on mysql.* to test_role2; flush privileges; select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` select current_user(), current_role(); current_user() current_role() test_user@localhost NULL @@ -44,7 +44,7 @@ select current_user(), current_role(); current_user() current_role() test_user@localhost NULL select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` set role test_role2; select current_user(), current_role(); current_user() current_role() @@ -62,7 +62,7 @@ create role test_role4; grant test_role4 to test_role3; set role test_role1; delete from mysql.user where user='no such user'; -ERROR 42000: DELETE command denied to user 'test_user'@'localhost' for table 'user' +ERROR 42000: DELETE command denied to user 'test_user'@'localhost' for table `mysql`.`user` grant delete on mysql.* to test_role4; set role test_role1; delete from mysql.user where user='no such user'; diff --git a/mysql-test/suite/roles/set_role-database-simple.result b/mysql-test/suite/roles/set_role-database-simple.result index a48f04985bb2e..969a7ab10fa74 100644 --- a/mysql-test/suite/roles/set_role-database-simple.result +++ b/mysql-test/suite/roles/set_role-database-simple.result @@ -14,7 +14,7 @@ grant select on mysql.* to test_role1; grant insert, delete on mysql.roles_mapping to test_role1; grant reload on *.* to test_role1; select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` select current_user(), current_role(); current_user() current_role() test_user@localhost NULL @@ -27,7 +27,7 @@ Host User Role Admin_option localhost root test_role1 Y localhost test_user test_role1 N insert into mysql.user (user, host) values ('Dummy', 'Dummy'); -ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table 'user' +ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table `mysql`.`user` insert into mysql.roles_mapping values ('localhost', 'test_user', 'test_role2', 'N'); delete from mysql.roles_mapping where Role='test_role2'; use mysql; @@ -38,13 +38,13 @@ test_user@localhost NULL use mysql; ERROR 42000: Access denied for user 'test_user'@'localhost' to database 'mysql' select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` insert into mysql.user (user, host) values ('Dummy', 'Dummy'); -ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table 'user' +ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table `mysql`.`user` insert into mysql.roles_mapping values ('localhost', 'test_user', 'test_role2', 'N'); -ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` delete from mysql.roles_mapping where Role='test_role2'; -ERROR 42000: DELETE command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: DELETE command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` drop user 'test_user'@'localhost'; revoke select on mysql.* from test_role1; revoke insert, delete on mysql.roles_mapping from test_role1; diff --git a/mysql-test/suite/roles/set_role-multiple-role.result b/mysql-test/suite/roles/set_role-multiple-role.result index 2ddd1e8a5107d..e4cb3b8542c6f 100644 --- a/mysql-test/suite/roles/set_role-multiple-role.result +++ b/mysql-test/suite/roles/set_role-multiple-role.result @@ -22,7 +22,7 @@ grant r_drp to test_user@localhost; grant r_rld to test_user@localhost; flush privileges; select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` show grants; Grants for test_user@localhost GRANT USAGE ON *.* TO `test_user`@`localhost` @@ -83,7 +83,7 @@ GRANT `r_rld` TO `test_user`@`localhost` GRANT `r_sel` TO `test_user`@`localhost` GRANT `r_upd` TO `test_user`@`localhost` select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` insert into mysql.roles_mapping values ('', 'r_sel', 'r_rld', 'N'); flush privileges; ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation @@ -139,7 +139,7 @@ select current_user(), current_role(); current_user() current_role() test_user@localhost r_sel insert into mysql.random_test_table values (1); -ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table 'random_test_table' +ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table `mysql`.`random_test_table` drop table mysql.random_test_table; delete from mysql.user where user like 'r\_%'; delete from mysql.roles_mapping where Role like 'r\_%'; diff --git a/mysql-test/suite/roles/set_role-recursive.result b/mysql-test/suite/roles/set_role-recursive.result index 102ee392581a8..f93a731bedb7f 100644 --- a/mysql-test/suite/roles/set_role-recursive.result +++ b/mysql-test/suite/roles/set_role-recursive.result @@ -23,7 +23,7 @@ select * from mysql.user where user like 'test_role2'; 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 test_role2 Y 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 Y 0.000000 select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` show grants; Grants for test_user@localhost GRANT USAGE ON *.* TO `test_user`@`localhost` @@ -61,7 +61,7 @@ Grants for test_user@localhost GRANT USAGE ON *.* TO `test_user`@`localhost` GRANT `test_role1` TO `test_user`@`localhost` select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` show grants; Grants for test_user@localhost GRANT USAGE ON *.* TO `test_user`@`localhost` @@ -76,7 +76,7 @@ Grants for test_user@localhost GRANT USAGE ON *.* TO `test_user`@`localhost` GRANT `test_role1` TO `test_user`@`localhost` select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` show grants; Grants for test_user@localhost GRANT USAGE ON *.* TO `test_user`@`localhost` @@ -111,7 +111,7 @@ Grants for test_user@localhost GRANT USAGE ON *.* TO `test_user`@`localhost` GRANT `test_role1` TO `test_user`@`localhost` select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` delete from mysql.user where user='test_role1'; delete from mysql.user where user='test_role2'; delete from mysql.roles_mapping; diff --git a/mysql-test/suite/roles/set_role-simple.result b/mysql-test/suite/roles/set_role-simple.result index 59e61d4836acc..c603f727fd14a 100644 --- a/mysql-test/suite/roles/set_role-simple.result +++ b/mysql-test/suite/roles/set_role-simple.result @@ -15,7 +15,7 @@ select * from mysql.user where user='test_role1'; 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 test_role1 Y 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 Y 0.000000 select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` show grants; Grants for test_user@localhost GRANT USAGE ON *.* TO `test_user`@`localhost` @@ -41,7 +41,7 @@ select current_user(), current_role(); current_user() current_role() test_user@localhost NULL select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` delete from mysql.user where user='test_role1'; delete from mysql.roles_mapping where Role='test_role1'; flush privileges; diff --git a/mysql-test/suite/roles/set_role-table-column-priv.result b/mysql-test/suite/roles/set_role-table-column-priv.result index 4aaa0388170e2..a680e3ff8c40f 100644 --- a/mysql-test/suite/roles/set_role-table-column-priv.result +++ b/mysql-test/suite/roles/set_role-table-column-priv.result @@ -17,7 +17,7 @@ localhost root test_role2 Y localhost test_user test_role1 N grant select (Role) on mysql.roles_mapping to test_role2; select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` show grants; Grants for test_user@localhost GRANT USAGE ON *.* TO `test_user`@`localhost` @@ -31,7 +31,7 @@ current_user() current_role() test_user@localhost test_role1 show grants; Grants for test_user@localhost -GRANT SELECT (Role) ON `mysql`.`roles_mapping` TO `test_role2` +GRANT SELECT (`Role`) ON `mysql`.`roles_mapping` TO `test_role2` GRANT USAGE ON *.* TO `test_role1` GRANT USAGE ON *.* TO `test_role2` GRANT USAGE ON *.* TO `test_user`@`localhost` @@ -47,7 +47,7 @@ test_role2 test_role2 show grants; Grants for test_user@localhost -GRANT SELECT (Role) ON `mysql`.`roles_mapping` TO `test_role2` +GRANT SELECT (`Role`) ON `mysql`.`roles_mapping` TO `test_role2` GRANT USAGE ON *.* TO `test_role1` GRANT USAGE ON *.* TO `test_role2` GRANT USAGE ON *.* TO `test_user`@`localhost` @@ -59,7 +59,7 @@ select current_user(), current_role(); current_user() current_role() test_user@localhost NULL select Role from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` drop user 'test_user'@'localhost'; select * from mysql.tables_priv; Host Db User Table_name Grantor Timestamp Table_priv Column_priv diff --git a/mysql-test/suite/roles/set_role-table-simple.result b/mysql-test/suite/roles/set_role-table-simple.result index f33df34d85e97..3f1a68eeaa05d 100644 --- a/mysql-test/suite/roles/set_role-table-simple.result +++ b/mysql-test/suite/roles/set_role-table-simple.result @@ -17,7 +17,7 @@ localhost root test_role2 Y localhost test_user test_role1 N grant select on mysql.roles_mapping to test_role2; select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` show grants; Grants for test_user@localhost GRANT USAGE ON *.* TO `test_user`@`localhost` @@ -57,7 +57,7 @@ select current_user(), current_role(); current_user() current_role() test_user@localhost NULL select * from mysql.roles_mapping; -ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping` drop user 'test_user'@'localhost'; select * from mysql.tables_priv; Host Db User Table_name Grantor Timestamp Table_priv Column_priv diff --git a/mysql-test/suite/roles/show_create_database-10463.result b/mysql-test/suite/roles/show_create_database-10463.result index 7bebc954840e2..121aab4fe1da6 100644 --- a/mysql-test/suite/roles/show_create_database-10463.result +++ b/mysql-test/suite/roles/show_create_database-10463.result @@ -26,7 +26,7 @@ information_schema test show create database db; Database Create Database -db CREATE DATABASE `db` /*!40100 DEFAULT CHARACTER SET latin1 */ +db CREATE DATABASE `db` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ select table_schema, table_name from information_schema.tables where table_schema = 'db' order by table_name; table_schema table_name @@ -55,7 +55,7 @@ information_schema test show create database db; Database Create Database -db CREATE DATABASE `db` /*!40100 DEFAULT CHARACTER SET latin1 */ +db CREATE DATABASE `db` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ select table_schema, table_name from information_schema.tables where table_schema = 'db' order by table_name; table_schema table_name diff --git a/mysql-test/suite/rpl/disabled.def b/mysql-test/suite/rpl/disabled.def index bdc01f9efcb06..5790721069338 100644 --- a/mysql-test/suite/rpl/disabled.def +++ b/mysql-test/suite/rpl/disabled.def @@ -13,7 +13,5 @@ rpl_partition_archive : MDEV-5077 2013-09-27 svoj Cannot exchange partition with archive table rpl_row_binlog_max_cache_size : MDEV-11092 rpl_row_index_choice : MDEV-11666 -rpl_semi_sync_after_sync : fails after MDEV-16172 -rpl_semi_sync_slave_compressed_protocol : MDEV-25580 2021-05-05 Sujatha rpl_auto_increment_update_failure : disabled for now rpl_current_user : waits for MDEV-22374 fix diff --git a/mysql-test/suite/rpl/include/create_or_drop_sync_func.inc b/mysql-test/suite/rpl/include/create_or_drop_sync_func.inc new file mode 100644 index 0000000000000..74cde5de1db17 --- /dev/null +++ b/mysql-test/suite/rpl/include/create_or_drop_sync_func.inc @@ -0,0 +1,75 @@ +# Creates or drops a stored function as a part of debug-sync based +# synchronization mechanism between replication servers. +# +# Parameters: +# $create_or_drop= [create] +# $server_master = [master] +# $server_slave = [slave] +if (!$create_or_drop) +{ + --let $create_or_drop=create +} + +if (`select strcmp('$create_or_drop', 'create') = 0`) +{ + if (!$server_master) + { + --let $server_master=master + } + if (!$server_slave) + { + --let $server_slave=slave + } + + --connection $server_master + # Use a stored function to inject a debug_sync into the appropriate THD. + # The function does nothing on the master, and on the slave it injects the + # desired debug_sync action(s). + SET sql_log_bin=0; + --delimiter || + CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END + || + --delimiter ; + SET sql_log_bin=1; + + --connection $server_slave + + SET sql_log_bin=0; + --delimiter || + CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END + || + --delimiter ; +SET sql_log_bin=1; +} + +if (`select strcmp('$create_or_drop', 'drop') = 0`) +{ + if (!$server_slave) + { + --let $server_slave=slave= + } + if (!$server_master) + { + --let $server_master=master + } + --connection $server_slave + SET DEBUG_SYNC='RESET'; + + --connection $server_master + SET DEBUG_SYNC='RESET'; + DROP FUNCTION foo; +} diff --git a/mysql-test/suite/rpl/include/rpl_binlog_errors.inc b/mysql-test/suite/rpl/include/rpl_binlog_errors.inc deleted file mode 100644 index bf92736a2afbc..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_binlog_errors.inc +++ /dev/null @@ -1,438 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# -# Usage: -# --let $binlog_limit= X[,Y] # optional -# -# Semantics of the value is the same as in include/show_binlog_events.inc -# which the script calls as a part of the test flow. -# The goal is to print the event demonstrating the triggered error, -# so normally Y should be 1 (print the exact event only); -# however, depending on test-specific server options, the offset X -# can be different. -# - -# BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error -# when generating new name. -# -# WHY -# === -# -# We want to check whether error is reported or not when -# new_file_impl fails (this may happen when rotation is not -# possible because there is some problem finding an -# unique filename). -# -# HOW -# === -# -# Test cases are documented inline. - --- source include/have_innodb.inc --- source include/have_debug.inc --- source include/master-slave.inc - --- echo ####################################################################### --- echo ####################### PART 1: MASTER TESTS ########################## --- echo ####################################################################### - - -### ACTION: stopping slave as it is not needed for the first part of -### the test - --- connection slave --- source include/stop_slave.inc --- connection master - -call mtr.add_suppression("Can't generate a unique log-filename"); -call mtr.add_suppression("Writing one row to the row-based binary log failed.*"); -call mtr.add_suppression("Error writing file .*"); -call mtr.add_suppression("Could not use master-bin for logging"); - -SET @old_debug= @@global.debug_dbug; - -### ACTION: create a large file (> 4096 bytes) that will be later used -### in LOAD DATA INFILE to check binlog errors in its vacinity --- let $load_file= $MYSQLTEST_VARDIR/tmp/bug_46166.data --- let $MYSQLD_DATADIR= `select @@datadir` --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file' - -### ACTION: create a small file (< 4096 bytes) that will be later used -### in LOAD DATA INFILE to check for absence of binlog errors -### when file loading this file does not force flushing and -### rotating the binary log --- let $load_file2= $MYSQLTEST_VARDIR/tmp/bug_46166-2.data --- let $MYSQLD_DATADIR= `select @@datadir` --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2' - -RESET MASTER; - --- echo ###################### TEST #1 - -### ASSERTION: no problem flushing logs (should show two binlogs) -FLUSH LOGS; --- echo # assert: must show two binlogs --- source include/show_binary_logs.inc - --- echo ###################### TEST #2 - -### ASSERTION: check that FLUSH LOGS actually fails and reports -### failure back to the user if find_uniq_filename fails -### (should show just one binlog) - -RESET MASTER; -SET @@global.debug_dbug="d,error_unique_log_filename"; --- error ER_NO_UNIQUE_LOGFILE -FLUSH LOGS; --- echo # assert: must show one binlog --- source include/show_binary_logs.inc - -### ACTION: clean up and move to next test -SET @@global.debug_dbug=@old_debug; -RESET MASTER; - --- echo ###################### TEST #3 - -### ACTION: create some tables (t1, t2, t4) and insert some values in -### table t1 -CREATE TABLE t1 (a INT); -CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB; -CREATE TABLE t4 (a VARCHAR(16384)); -INSERT INTO t1 VALUES (1); -RESET MASTER; - -### ASSERTION: we force rotation of the binary log because it exceeds -### the max_binlog_size option (should show two binary -### logs) - --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 - -# shows two binary logs --- echo # assert: must show two binlog --- source include/show_binary_logs.inc - -# clean up the table and the binlog to be used in next part of test -SET @@global.debug_dbug=@old_debug; -DELETE FROM t2; -RESET MASTER; - --- echo ###################### TEST #4 - -### ASSERTION: load the big file into a transactional table and check -### that it reports error. The table will contain the -### changes performed despite the fact that it reported an -### error. - -SET @@global.debug_dbug="d,error_unique_log_filename"; --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- error ER_NO_UNIQUE_LOGFILE --- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 - -# show table --- echo # assert: must show one entry -SELECT count(*) FROM t2; - -# clean up the table and the binlog to be used in next part of test -SET @@global.debug_dbug=@old_debug; -DELETE FROM t2; -RESET MASTER; - --- echo ###################### TEST #5 - -### ASSERTION: load the small file into a transactional table and -### check that it succeeds - -SET @@global.debug_dbug="d,error_unique_log_filename"; --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval LOAD DATA INFILE '$load_file2' INTO TABLE t2 - -# show table --- echo # assert: must show one entry -SELECT count(*) FROM t2; - -# clean up the table and the binlog to be used in next part of test -SET @@global.debug_dbug=@old_debug; -DELETE FROM t2; -RESET MASTER; - --- echo ###################### TEST #6 - -### ASSERTION: check that even if one is using a transactional table -### and explicit transactions (no autocommit) if rotation -### fails we get the error. Transaction is not rolledback -### because rotation happens after the commit. - -SET @@global.debug_dbug="d,error_unique_log_filename"; -SET AUTOCOMMIT=0; -INSERT INTO t2 VALUES ('muse'); --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 -INSERT INTO t2 VALUES ('muse'); --- error ER_NO_UNIQUE_LOGFILE -COMMIT; - -### ACTION: Show the contents of the table after the test --- echo # assert: must show three entries -SELECT count(*) FROM t2; - -### ACTION: clean up and move to the next test -SET AUTOCOMMIT= 1; -SET @@global.debug_dbug=@old_debug; -DELETE FROM t2; -RESET MASTER; - --- echo ###################### TEST #7 - -### ASSERTION: check that on a non-transactional table, if rotation -### fails then an error is reported and an incident event -### is written to the current binary log. - -SET @@global.debug_dbug="d,error_unique_log_filename"; - -# Disable logging Annotate_rows events to preserve events count. -let $binlog_annotate_row_events_saved= `SELECT @@binlog_annotate_row_events`; -SET @@binlog_annotate_row_events= 0; - -SELECT count(*) FROM t4; --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- error ER_NO_UNIQUE_LOGFILE --- eval LOAD DATA INFILE '$load_file' INTO TABLE t4 - --- echo # assert: must show 1 entry -SELECT count(*) FROM t4; - --- echo ### check that the incident event is written to the current log -SET @@global.debug_dbug=@old_debug; -if (!$binlog_limit) -{ - -- let $binlog_limit= 4,1 -} --- source include/show_binlog_events.inc - -# clean up and move to next test -DELETE FROM t4; - ---disable_query_log -eval SET @@binlog_annotate_row_events= $binlog_annotate_row_events_saved; ---enable_query_log - -RESET MASTER; - --- echo ###################### TEST #8 - -### ASSERTION: check that statements end up in error but they succeed -### on changing the data. - -SET @@global.debug_dbug="d,error_unique_log_filename"; --- echo # must show 0 entries -SELECT count(*) FROM t4; -SELECT count(*) FROM t2; - --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- error ER_NO_UNIQUE_LOGFILE --- eval LOAD DATA INFILE '$load_file' INTO TABLE t4 --- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --- error ER_NO_UNIQUE_LOGFILE --- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 --- error ER_NO_UNIQUE_LOGFILE -INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'); - --- echo # INFO: Count(*) Before Offending DELETEs --- echo # assert: must show 1 entry -SELECT count(*) FROM t4; --- echo # assert: must show 4 entries -SELECT count(*) FROM t2; - --- error ER_NO_UNIQUE_LOGFILE -DELETE FROM t4; --- error ER_NO_UNIQUE_LOGFILE -DELETE FROM t2; - --- echo # INFO: Count(*) After Offending DELETEs --- echo # assert: must show zero entries -SELECT count(*) FROM t4; -SELECT count(*) FROM t2; - -# remove fault injection -SET @@global.debug_dbug=@old_debug; - --- echo ###################### TEST #9 - -### ASSERTION: check that if we disable binlogging, then statements -### succeed. -SET @@global.debug_dbug="d,error_unique_log_filename"; -SET SQL_LOG_BIN=0; -INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd'); -INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh'); --- echo # assert: must show four entries -SELECT count(*) FROM t2; -SELECT count(*) FROM t4; -DELETE FROM t2; -DELETE FROM t4; --- echo # assert: must show zero entries -SELECT count(*) FROM t2; -SELECT count(*) FROM t4; -SET SQL_LOG_BIN=1; -SET @@global.debug_dbug=@old_debug; - --- echo ###################### TEST #10 - -### ASSERTION: check that error is reported if there is a failure -### while registering the index file and the binary log -### file or failure to write the rotate event. - -call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); -call mtr.add_suppression("Could not use .*"); - -RESET MASTER; -SHOW WARNINGS; - -# +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open -SET @@global.debug_dbug="d,fault_injection_registering_index"; --- replace_regex /\.[\\\/]master/master/ --- error ER_CANT_OPEN_FILE -FLUSH LOGS; -SET @@global.debug_dbug=@old_debug; - --- error ER_NO_BINARY_LOGGING -SHOW BINARY LOGS; - -# issue some statements and check that they don't fail -CREATE TABLE t5 (a INT); -INSERT INTO t4 VALUES ('bbbbb'); -INSERT INTO t2 VALUES ('aaaaa'); -DELETE FROM t4; -DELETE FROM t2; -DROP TABLE t5; -flush tables; - --- echo ###################### TEST #11 - -### ASSERTION: check that error is reported if there is a failure -### while opening the index file and the binary log file or -### failure to write the rotate event. - -# restart the server so that we have binlog again ---let $rpl_server_number= 1 ---source include/rpl_restart_server.inc - -# +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file -SET @@global.debug_dbug="d,fault_injection_openning_index"; --- replace_regex /\.[\\\/]master/master/ --- error ER_CANT_OPEN_FILE -FLUSH LOGS; -SET @@global.debug_dbug=@old_debug; - --- error ER_FLUSH_MASTER_BINLOG_CLOSED -RESET MASTER; - -# issue some statements and check that they don't fail -CREATE TABLE t5 (a INT); -INSERT INTO t4 VALUES ('bbbbb'); -INSERT INTO t2 VALUES ('aaaaa'); -DELETE FROM t4; -DELETE FROM t2; -DROP TABLE t5; -flush tables; - -# restart the server so that we have binlog again ---let $rpl_server_number= 1 ---source include/rpl_restart_server.inc - --- echo ###################### TEST #12 - -### ASSERTION: check that error is reported if there is a failure -### while writing the rotate event when creating a new log -### file. - -# +d,fault_injection_new_file_rotate_event => injects fault on MYSQL_BIN_LOG::MYSQL_BIN_LOG::new_file_impl -SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event"; --- error ER_ERROR_ON_WRITE -FLUSH LOGS; -SET @@global.debug_dbug=@old_debug; - --- error ER_FLUSH_MASTER_BINLOG_CLOSED -RESET MASTER; - -# issue some statements and check that they don't fail -CREATE TABLE t5 (a INT); -INSERT INTO t4 VALUES ('bbbbb'); -INSERT INTO t2 VALUES ('aaaaa'); -DELETE FROM t4; -DELETE FROM t2; -DROP TABLE t5; -flush tables; - -# restart the server so that we have binlog again ---let $rpl_server_number= 1 ---source include/rpl_restart_server.inc - -## clean up -DROP TABLE t1, t2, t4; -RESET MASTER; - -# restart slave again --- connection slave --- source include/start_slave.inc --- connection master - --- echo ####################################################################### --- echo ####################### PART 2: SLAVE TESTS ########################### --- echo ####################################################################### - -### setup ---source include/rpl_reset.inc --- connection slave - -# slave suppressions - -call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*"); -call mtr.add_suppression("Error writing file .*"); -call mtr.add_suppression("Could not use .*"); -call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); -call mtr.add_suppression("Can't generate a unique log-filename .*"); --- echo ###################### TEST #13 - -#### ASSERTION: check against unique log filename error --- let $io_thd_injection_fault_flag= error_unique_log_filename --- let $slave_io_errno= 1595 --- let $show_slave_io_error= 1 --- source include/io_thd_fault_injection.inc - --- echo ###################### TEST #14 - -#### ASSERTION: check against rotate failing --- let $io_thd_injection_fault_flag= fault_injection_new_file_rotate_event --- let $slave_io_errno= 1595 --- let $show_slave_io_error= 1 --- source include/io_thd_fault_injection.inc - --- echo ###################### TEST #15 - -#### ASSERTION: check against relay log open failure --- let $io_thd_injection_fault_flag= fault_injection_registering_index --- let $slave_io_errno= 1595 --- let $show_slave_io_error= 1 --- source include/io_thd_fault_injection.inc - --- echo ###################### TEST #16 - -#### ASSERTION: check against relay log index open failure --- let $io_thd_injection_fault_flag= fault_injection_openning_index --- let $slave_io_errno= 1595 --- let $show_slave_io_error= 1 --- source include/io_thd_fault_injection.inc - -### clean up --- source include/stop_slave_sql.inc -RESET SLAVE; -RESET MASTER; ---remove_file $load_file ---remove_file $load_file2 ---let $rpl_only_running_threads= 1 ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test b/mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test index 4c93ad86209e6..d750554b4ec85 100644 --- a/mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test +++ b/mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test @@ -22,6 +22,8 @@ # ######################################################################################## call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +call mtr.add_suppression("Write to binary log failed: Multi-row statements required more than .max_binlog_stmt_cache_size"); +call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size"); let $old_max_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_cache_size", Value, 1); let $old_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_cache_size", Value, 1); diff --git a/mysql-test/suite/rpl/include/rpl_cant_read_event_incident.inc b/mysql-test/suite/rpl/include/rpl_cant_read_event_incident.inc deleted file mode 100644 index 7dfef023947a9..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_cant_read_event_incident.inc +++ /dev/null @@ -1,83 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - -# -# Bug#11747416 : 32228 A disk full makes binary log corrupt. -# -# -# The test demonstrates reading from binlog error propagation to slave -# and reporting there. -# Conditions for the bug include a crash at time of the last event to -# the binlog was written partly. With the fixes the event is not sent out -# any longer, but rather the dump thread sends out a sound error message. -# -# Crash is not simulated. A binlog with partly written event in its end is installed -# and replication is started from it. -# - ---source include/have_binlog_format_mixed.inc ---source include/master-slave.inc - ---connection slave -# Make sure the slave is stopped while we are messing with master. -# Otherwise we get occasional failures as the slave manages to re-connect -# to the newly started master and we get extra events applied, causing -# conflicts. ---source include/stop_slave.inc - ---connection master -call mtr.add_suppression("Error in Log_event::read_log_event()"); ---let $datadir= `SELECT @@datadir` - ---let $rpl_server_number= 1 ---source include/rpl_stop_server.inc - ---remove_file $datadir/master-bin.000001 ---copy_file $MYSQL_TEST_DIR/std_data/bug11747416_32228_binlog.000001 $datadir/master-bin.000001 - ---let $rpl_server_number= 1 ---source include/rpl_start_server.inc - ---source include/wait_until_connected_again.inc - -# evidence of the partial binlog ---error ER_ERROR_WHEN_EXECUTING_COMMAND -show binlog events; - ---connection slave -call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log"); -reset slave; -start slave; - -# ER_MASTER_FATAL_ERROR_READING_BINLOG 1236 ---let $slave_param=Last_IO_Errno ---let $slave_param_value=1236 ---source include/wait_for_slave_param.inc - ---let $slave_field_result_replace= / at [0-9]*/ at XXX/ ---let $status_items= Last_IO_Errno, Last_IO_Error ---source include/show_slave_status.inc - -# -# Cleanup -# - ---connection master -reset master; - ---connection slave -stop slave; -reset slave; -# Table was created from binlog, it may not be created if SQL thread is running -# slowly and IO thread reaches incident before SQL thread applies it. ---disable_warnings -drop table if exists t; ---enable_warnings -reset master; - ---echo End of the tests ---let $rpl_only_running_threads= 1 ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_checksum.inc b/mysql-test/suite/rpl/include/rpl_checksum.inc deleted file mode 100644 index 17a986dc30801..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_checksum.inc +++ /dev/null @@ -1,335 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - -# WL2540 replication events checksum -# Testing configuration parameters - ---source include/have_debug.inc ---source include/have_binlog_format_mixed.inc ---source include/master-slave.inc - -call mtr.add_suppression('Slave can not handle replication events with the checksum that master is configured to log'); -call mtr.add_suppression('Replication event checksum verification failed'); -# due to C failure simulation -call mtr.add_suppression('Relay log write failure: could not queue event from master'); -call mtr.add_suppression('Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process them'); - -# A. read/write access to the global vars: -# binlog_checksum master_verify_checksum slave_sql_verify_checksum - -connection master; - -set @master_save_binlog_checksum= @@global.binlog_checksum; -set @save_master_verify_checksum = @@global.master_verify_checksum; - -select @@global.binlog_checksum as 'must be CRC32 because of the command line option'; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@session.binlog_checksum as 'no session var'; - -select @@global.master_verify_checksum as 'must be zero because of default'; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@session.master_verify_checksum as 'no session var'; - -connection slave; - -set @slave_save_binlog_checksum= @@global.binlog_checksum; -set @save_slave_sql_verify_checksum = @@global.slave_sql_verify_checksum; - -select @@global.slave_sql_verify_checksum as 'must be one because of default'; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@session.slave_sql_verify_checksum as 'no session var'; - -connection master; - -source include/show_binary_logs.inc; -set @@global.binlog_checksum = NONE; -select @@global.binlog_checksum; ---echo *** must be rotations seen *** -source include/show_binary_logs.inc; - -set @@global.binlog_checksum = default; -select @@global.binlog_checksum; - -# testing lack of side-effects in non-effective update of binlog_checksum: -set @@global.binlog_checksum = CRC32; -select @@global.binlog_checksum; -set @@global.binlog_checksum = CRC32; - -set @@global.master_verify_checksum = 0; -set @@global.master_verify_checksum = default; - ---error ER_WRONG_VALUE_FOR_VAR -set @@global.binlog_checksum = ADLER32; ---error ER_WRONG_VALUE_FOR_VAR -set @@global.master_verify_checksum = 2; # the var is of bool type - -connection slave; - -set @@global.slave_sql_verify_checksum = 0; -set @@global.slave_sql_verify_checksum = default; ---error ER_WRONG_VALUE_FOR_VAR -set @@global.slave_sql_verify_checksum = 2; # the var is of bool type - -# -# B. Old Slave to New master conditions -# -# while master does not send a checksum-ed binlog the Old Slave can -# work with the New Master - -connection master; - -set @@global.binlog_checksum = NONE; -create table t1 (a int); - -# testing that binlog rotation preserves opt_binlog_checksum value -flush logs; -flush logs; --- source include/wait_for_binlog_checkpoint.inc -flush logs; - -sync_slave_with_master; -#connection slave; -# checking that rotation on the slave side leaves slave stable -flush logs; -flush logs; -flush logs; -select count(*) as zero from t1; - -source include/stop_slave.inc; - -connection master; -set @@global.binlog_checksum = CRC32; --- source include/wait_for_binlog_checkpoint.inc -insert into t1 values (1) /* will not be applied on slave due to simulation */; - -# instruction to the dump thread - -connection slave; -set @saved_dbug = @@global.debug_dbug; -set @@global.debug_dbug='d,simulate_slave_unaware_checksum'; -start slave; ---let $slave_io_errno= 1236 ---let $show_slave_io_error= 1 -source include/wait_for_slave_io_error.inc; - -select count(*) as zero from t1; - -set @@global.debug_dbug = @saved_dbug; - -connection slave; -source include/start_slave.inc; - -# -# C. checksum failure simulations -# - -# C1. Failure by a client thread -connection master; -set @@global.master_verify_checksum = 1; -set @save_dbug = @@session.debug_dbug; -set @@session.debug_dbug='d,simulate_checksum_test_failure'; ---error ER_ERROR_WHEN_EXECUTING_COMMAND -show binlog events; -SET debug_dbug= @save_dbug; -set @@global.master_verify_checksum = default; - -#connection master; -sync_slave_with_master; - -connection slave; -source include/stop_slave.inc; - -connection master; -create table t2 (a int); -let $pos_master= query_get_value(SHOW MASTER STATUS, Position, 1); - -connection slave; - -# C2. Failure by IO thread -# instruction to io thread -set @saved_dbug = @@global.debug_dbug; -set @@global.debug_dbug='d,simulate_checksum_test_failure'; -start slave io_thread; -# When the checksum error is detected, the slave sets error code 1913 -# (ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE) in queue_event(), then immediately -# sets error 1595 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE) in handle_slave_io(). -# So we usually get 1595, but it is occasionally possible to get 1913. ---let $slave_io_errno= 1595,1913 ---let $show_slave_io_error= 0 -source include/wait_for_slave_io_error.inc; -set @@global.debug_dbug = @saved_dbug; - -# to make IO thread re-read it again w/o the failure -start slave io_thread; -let $slave_param= Read_Master_Log_Pos; -let $slave_param_value= $pos_master; -source include/wait_for_slave_param.inc; - -# C3. Failure by SQL thread -# instruction to sql thread; -set @@global.slave_sql_verify_checksum = 1; - -set @@global.debug_dbug='d,simulate_checksum_test_failure'; - -start slave sql_thread; ---let $slave_sql_errno= 1593 ---let $show_slave_sql_error= 1 -source include/wait_for_slave_sql_error.inc; - -# resuming SQL thread to parse out the event w/o the failure - -set @@global.debug_dbug = @saved_dbug; -source include/start_slave.inc; - -connection master; -sync_slave_with_master; - -#connection slave; -select count(*) as 'must be zero' from t2; - -# -# D. Reset slave, Change-Master, Binlog & Relay-log rotations with -# random value on binlog_checksum on both master and slave -# -connection slave; -stop slave; -reset slave; - -# randomize slave server's own checksum policy -set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); -flush logs; - -connection master; -set @@global.binlog_checksum= CRC32; -reset master; -flush logs; -create table t3 (a int, b char(5)); - -connection slave; -source include/start_slave.inc; - -connection master; -sync_slave_with_master; - -#connection slave; -select count(*) as 'must be zero' from t3; -source include/stop_slave.inc; ---replace_result $MASTER_MYPORT MASTER_PORT -eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root'; - -connection master; -flush logs; -reset master; -insert into t3 value (1, @@global.binlog_checksum); - -connection slave; -source include/start_slave.inc; -flush logs; - -connection master; -sync_slave_with_master; - -#connection slave; -select count(*) as 'must be one' from t3; - -connection master; -set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); -insert into t3 value (1, @@global.binlog_checksum); -sync_slave_with_master; - -#connection slave; - -#clean-up - -connection master; -drop table t1, t2, t3; -set @@global.binlog_checksum = @master_save_binlog_checksum; -set @@global.master_verify_checksum = @save_master_verify_checksum; - -# -# BUG#58564: flush_read_lock fails in mysql-trunk-bugfixing after merging with WL#2540 -# -# Sanity check that verifies that no assertions are triggered because -# of old FD events (generated by versions prior to server released with -# checksums feature) -# -# There is no need for query log, if something wrong this should trigger -# an assertion - ---disable_query_log - -BINLOG ' -MfmqTA8BAAAAZwAAAGsAAAABAAQANS41LjctbTMtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAx+apMEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA== -'; - ---enable_query_log - -#connection slave; -sync_slave_with_master; - - ---echo *** Bug#59123 / MDEV-5799: INCIDENT_EVENT checksum written to error log as garbage characters *** - ---connection master - ---source include/wait_for_binlog_checkpoint.inc -CREATE TABLE t4 (a INT PRIMARY KEY); -INSERT INTO t4 VALUES (1); - -SET sql_log_bin=0; -CALL mtr.add_suppression("\\[ERROR\\] Can't generate a unique log-filename"); -SET sql_log_bin=1; -SET @old_dbug= @@GLOBAL.debug_dbug; -SET debug_dbug= '+d,binlog_inject_new_name_error'; ---error ER_NO_UNIQUE_LOGFILE -FLUSH LOGS; -SET debug_dbug= @old_dbug; - -INSERT INTO t4 VALUES (2); - ---connection slave ---let $slave_sql_errno= 1590 ---source include/wait_for_slave_sql_error.inc - -# Search the error log for the error message. -# The bug was that 4 garbage bytes were output in the middle of the error -# message; by searching for a pattern that spans that location, we can -# catch the error. -let $log_error_= `SELECT @@GLOBAL.log_error`; -if(!$log_error_) -{ - # MySQL Server on windows is started with --console and thus - # does not know the location of its .err log, use default location - let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.2.err; -} ---let SEARCH_FILE= $log_error_ ---let SEARCH_PATTERN= Slave SQL: The incident LOST_EVENTS occurred on the master\. Message: error writing to the binary log, Internal MariaDB error code: 1590 ---source include/search_pattern_in_file.inc - -SELECT * FROM t4 ORDER BY a; -STOP SLAVE IO_THREAD; -SET sql_slave_skip_counter= 1; ---source include/start_slave.inc - ---connection master ---save_master_pos - ---connection slave ---sync_with_master -SELECT * FROM t4 ORDER BY a; - - ---connection slave -set @@global.binlog_checksum = @slave_save_binlog_checksum; -set @@global.slave_sql_verify_checksum = @save_slave_sql_verify_checksum; - ---echo End of tests - ---connection master -DROP TABLE t4; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_checksum_cache.inc b/mysql-test/suite/rpl/include/rpl_checksum_cache.inc deleted file mode 100644 index e04f618b81ea1..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_checksum_cache.inc +++ /dev/null @@ -1,261 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - --- source include/have_innodb.inc --- source include/master-slave.inc - ---disable_warnings -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. .*Statement: insert into t2 set data=repeat.*'a', @act_size.*"); -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. .*Statement: insert into t1 values.* NAME_CONST.*'n',.*, @data .*"); ---enable_warnings - -connection master; -set @save_binlog_cache_size = @@global.binlog_cache_size; -set @save_binlog_checksum = @@global.binlog_checksum; -set @save_master_verify_checksum = @@global.master_verify_checksum; -set @@global.binlog_cache_size = 4096; -set @@global.binlog_checksum = CRC32; -set @@global.master_verify_checksum = 1; - -# restart slave to force the dump thread to verify events (on master side) -connection slave; -source include/stop_slave.inc; -source include/start_slave.inc; - -connection master; - -# -# Testing a critical part of checksum handling dealing with transaction cache. -# The cache's buffer size is set to be less than the transaction's footprint -# in binlog. -# -# To verify combined buffer-by-buffer read out of the file and fixing crc per event -# there are the following parts: -# -# 1. the event size is much less than the cache's buffer -# 2. the event size is bigger than the cache's buffer -# 3. the event size if approximately the same as the cache's buffer -# 4. all in above - -# -# 1. the event size is much less than the cache's buffer -# - -flush status; -show status like "binlog_cache_use"; -show status like "binlog_cache_disk_use"; ---disable_warnings -drop table if exists t1; ---enable_warnings - -# -# parameter to ensure the test slightly varies binlog content -# between different invocations -# -let $deviation_size=32; -eval create table t1 (a int PRIMARY KEY, b CHAR($deviation_size)) engine=innodb; - -# Now we are going to create transaction which is long enough so its -# transaction binlog will be flushed to disk... - -delimiter |; -create procedure test.p_init (n int, size int) -begin - while n > 0 do - select round(RAND() * size) into @act_size; - set @data = repeat('a', @act_size); - insert into t1 values(n, @data ); - set n= n-1; - end while; -end| - -delimiter ;| - -let $1 = 4000; # PB2 can run it slow to time out on following sync_slave_with_master:s - -begin; ---disable_warnings -# todo: check if it is really so. -#+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -eval call test.p_init($1, $deviation_size); ---enable_warnings -commit; - -show status like "binlog_cache_use"; ---echo *** binlog_cache_disk_use must be non-zero *** -show status like "binlog_cache_disk_use"; - -sync_slave_with_master; - -let $diff_tables=master:test.t1, slave:test.t1; -source include/diff_tables.inc; - -# undoing changes with verifying the above once again -connection master; - -begin; -delete from t1; -commit; - -sync_slave_with_master; - - -# -# 2. the event size is bigger than the cache's buffer -# -connection master; - -flush status; -let $t2_data_size= `select 3 * @@global.binlog_cache_size`; -let $t2_aver_size= `select 2 * @@global.binlog_cache_size`; -let $t2_max_rand= `select 1 * @@global.binlog_cache_size`; - -eval create table t2(a int auto_increment primary key, data VARCHAR($t2_data_size)) ENGINE=Innodb; -let $1=100; ---disable_query_log -begin; -while ($1) -{ - eval select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size; - set @data = repeat('a', @act_size); - insert into t2 set data = @data; - dec $1; -} -commit; ---enable_query_log -show status like "binlog_cache_use"; ---echo *** binlog_cache_disk_use must be non-zero *** -show status like "binlog_cache_disk_use"; - -sync_slave_with_master; - -let $diff_tables=master:test.t2, slave:test.t2; -source include/diff_tables.inc; - -# undoing changes with verifying the above once again -connection master; - -begin; -delete from t2; -commit; - -sync_slave_with_master; - -# -# 3. the event size if approximately the same as the cache's buffer -# - -connection master; - -flush status; -let $t3_data_size= `select 2 * @@global.binlog_cache_size`; -let $t3_aver_size= `select (9 * @@global.binlog_cache_size) / 10`; -let $t3_max_rand= `select (2 * @@global.binlog_cache_size) / 10`; - -eval create table t3(a int auto_increment primary key, data VARCHAR($t3_data_size)) engine=innodb; - -let $1= 300; ---disable_query_log -begin; -while ($1) -{ - eval select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size; - insert into t3 set data= repeat('a', @act_size); - dec $1; -} -commit; ---enable_query_log -show status like "binlog_cache_use"; ---echo *** binlog_cache_disk_use must be non-zero *** -show status like "binlog_cache_disk_use"; - -sync_slave_with_master; - -let $diff_tables=master:test.t3, slave:test.t3; -source include/diff_tables.inc; - -# undoing changes with verifying the above once again -connection master; - -begin; -delete from t3; -commit; - -sync_slave_with_master; - - -# -# 4. all in above -# - -connection master; -flush status; - -delimiter |; -eval create procedure test.p1 (n int) -begin - while n > 0 do - case (select (round(rand()*100) % 3) + 1) - when 1 then - select round(RAND() * $deviation_size) into @act_size; - set @data = repeat('a', @act_size); - insert into t1 values(n, @data); - when 2 then - begin - select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size; - insert into t2 set data=repeat('a', @act_size); - end; - when 3 then - begin - select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size; - insert into t3 set data= repeat('a', @act_size); - end; - end case; - set n= n-1; - end while; -end| -delimiter ;| - -let $1= 1000; -set autocommit= 0; -begin; ---disable_warnings -eval call test.p1($1); ---enable_warnings -commit; - -show status like "binlog_cache_use"; ---echo *** binlog_cache_disk_use must be non-zero *** -show status like "binlog_cache_disk_use"; - -sync_slave_with_master; - -let $diff_tables=master:test.t1, slave:test.t1; -source include/diff_tables.inc; - -let $diff_tables=master:test.t2, slave:test.t2; -source include/diff_tables.inc; - -let $diff_tables=master:test.t3, slave:test.t3; -source include/diff_tables.inc; - - -connection master; - -begin; -delete from t1; -delete from t2; -delete from t3; -commit; - -drop table t1, t2, t3; -set @@global.binlog_cache_size = @save_binlog_cache_size; -set @@global.binlog_checksum = @save_binlog_checksum; -set @@global.master_verify_checksum = @save_master_verify_checksum; -drop procedure test.p_init; -drop procedure test.p1; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_corruption.inc b/mysql-test/suite/rpl/include/rpl_corruption.inc deleted file mode 100644 index c7a913af9d7f2..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_corruption.inc +++ /dev/null @@ -1,175 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - -############################################################ -# Purpose: WL#5064 Testing with corrupted events. -# The test emulates the corruption at the vary stages -# of replication: -# - in binlog file -# - in network -# - in relay log -############################################################ - -# -# The tests intensively utilize @@global.debug. Note, -# Bug#11765758 - 58754, -# @@global.debug is read by the slave threads through dbug-interface. -# Hence, before a client thread set @@global.debug we have to ensure that: -# (a) the slave threads are stopped, or (b) the slave threads are in -# sync and waiting. - ---source include/have_debug.inc ---source include/master-slave.inc - -# Block legal errors for MTR -call mtr.add_suppression('Found invalid event in binary log'); -call mtr.add_suppression('Slave I/O: Relay log write failure: could not queue event from master'); -call mtr.add_suppression('event read from binlog did not pass crc check'); -call mtr.add_suppression('Replication event checksum verification failed'); -call mtr.add_suppression('Event crc check failed! Most likely there is event corruption'); -call mtr.add_suppression('Slave SQL: Error initializing relay log position: I/O error reading event at position .*, error.* 1593'); - -SET @old_master_verify_checksum = @@master_verify_checksum; - -# Creating test table/data and set corruption position for testing ---echo # 1. Creating test table/data and set corruption position for testing ---connection master ---echo * insert/update/delete rows in table t1 * -# Corruption algorithm modifies only the first event and -# then will be reset. To avoid checking always the first event -# from binlog (usually it is FD) we randomly execute different -# statements and set position for corruption inside events. - -CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100)); ---disable_query_log -let $i=`SELECT 3+CEILING(10*RAND())`; -let $j=1; -let $pos=0; -while ($i) { - eval INSERT INTO t1 VALUES ($j, 'a', NULL); - if (`SELECT RAND() > 0.7`) - { - eval UPDATE t1 SET c = REPEAT('a', 20) WHERE a = $j; - } - if (`SELECT RAND() > 0.8`) - { - eval DELETE FROM t1 WHERE a = $j; - } - if (!$pos) { - let $pos= query_get_value(SHOW MASTER STATUS, Position, 1); - --sync_slave_with_master - --source include/stop_slave.inc - --disable_query_log - --connection master - } - dec $i; - inc $j; -} ---enable_query_log - - -# Emulate corruption in binlog file when SHOW BINLOG EVENTS is executing ---echo # 2. Corruption in master binlog and SHOW BINLOG EVENTS -SET @saved_dbug = @@global.debug_dbug; -SET @@global.debug_dbug="d,corrupt_read_log_event_char"; ---echo SHOW BINLOG EVENTS; ---disable_query_log -send_eval SHOW BINLOG EVENTS FROM $pos; ---enable_query_log ---error ER_ERROR_WHEN_EXECUTING_COMMAND -reap; - -SET @@global.debug_dbug=@saved_dbug; - -# Emulate corruption on master with crc checking on master ---echo # 3. Master read a corrupted event from binlog and send the error to slave - -# We have a rare but nasty potential race here: if the dump thread on -# the master for the _old_ slave connection has not yet discovered -# that the slave has disconnected, we will inject the corrupt event on -# the wrong connection, and the test will fail -# (+d,corrupt_read_log_event2 corrupts only one event). -# So kill any lingering dump thread (we need to kill; otherwise dump thread -# could manage to send all events down the socket before seeing it close, and -# hang forever waiting for new binlog events to be created). -let $id= `select id from information_schema.processlist where command = "Binlog Dump"`; -if ($id) -{ - --disable_query_log - --error 0,1094 - eval kill $id; - --enable_query_log -} -let $wait_condition= - SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE command = 'Binlog Dump'; ---source include/wait_condition.inc - -SET @@global.debug_dbug="d,corrupt_read_log_event2_set"; ---connection slave -START SLAVE IO_THREAD; -let $slave_io_errno= 1236; ---let $slave_timeout= 10 ---source include/wait_for_slave_io_error.inc ---connection master -SET @@global.debug_dbug=@saved_dbug; - -# Emulate corruption on master without crc checking on master ---echo # 4. Master read a corrupted event from binlog and send it to slave ---connection master -SET GLOBAL master_verify_checksum=0; -SET @@global.debug_dbug="d,corrupt_read_log_event2_set"; ---connection slave -START SLAVE IO_THREAD; -# When the checksum error is detected, the slave sets error code 1743 -# (ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE) in queue_event(), then immediately -# sets error 1595 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE) in handle_slave_io(). -# So we usually get 1595, but it is occasionally possible to get 1743. -let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE ---source include/wait_for_slave_io_error.inc ---connection master -SET @@global.debug_dbug=@saved_dbug; -SET GLOBAL master_verify_checksum=1; - -# Emulate corruption in network ---echo # 5. Slave. Corruption in network ---connection slave -SET @saved_dbug_slave = @@GLOBAL.debug_dbug; -SET @@global.debug_dbug="d,corrupt_queue_event"; -START SLAVE IO_THREAD; -let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE ---source include/wait_for_slave_io_error.inc -SET @@global.debug_dbug=@saved_dbug_slave; - -# Emulate corruption in relay log ---echo # 6. Slave. Corruption in relay log - -SET @@global.debug_dbug="d,corrupt_read_log_event_char"; - -START SLAVE SQL_THREAD; -let $slave_sql_errno= 1593; ---source include/wait_for_slave_sql_error.inc - -SET @@global.debug_dbug=@saved_dbug_slave; - -# Start normal replication and compare same table on master -# and slave ---echo # 7. Seek diff for tables on master and slave ---connection slave ---source include/start_slave.inc ---connection master ---sync_slave_with_master -let $diff_tables= master:test.t1, slave:test.t1; ---source include/diff_tables.inc - -# Clean up ---echo # 8. Clean up ---connection master -set @@global.debug_dbug = @saved_dbug; -SET GLOBAL master_verify_checksum = @old_master_verify_checksum; -DROP TABLE t1; ---sync_slave_with_master - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_gtid_basic.inc b/mysql-test/suite/rpl/include/rpl_gtid_basic.inc deleted file mode 100644 index 68a5d05ffe947..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_gtid_basic.inc +++ /dev/null @@ -1,572 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - ---source include/have_innodb.inc ---let $rpl_topology=1->2->3->4 ---source include/rpl_init.inc - -# Set up a 4-deep replication topology, then test various fail-overs -# using GTID. -# -# A -> B -> C -> D - -connection server_1; ---source include/wait_for_binlog_checkpoint.inc ---let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1) ---let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1) ---echo *** GTID position should be empty here *** ---replace_result $binlog_file $binlog_pos -eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos); - -CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; -CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, "m1"); -INSERT INTO t1 VALUES (2, "m2"), (3, "m3"), (4, "m4"); -INSERT INTO t2 VALUES (1, "i1"); -BEGIN; -INSERT INTO t2 VALUES (2, "i2"), (3, "i3"); -INSERT INTO t2 VALUES (4, "i4"); -COMMIT; -save_master_pos; -source include/wait_for_binlog_checkpoint.inc; ---let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1) ---let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1) ---let $gtid_pos_server_1 = `SELECT @@gtid_binlog_pos` ---echo *** GTID position should be non-empty here *** ---replace_result $binlog_file $binlog_pos $gtid_pos_server_1 -eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos); - -connection server_2; -sync_with_master; -source include/wait_for_binlog_checkpoint.inc; ---let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1) ---let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1) ---echo *** GTID position should be the same as on server_1 *** ---replace_result $binlog_file $binlog_pos $gtid_pos_server_1 -eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos); -SELECT * FROM t1 ORDER BY a; -SELECT * FROM t2 ORDER BY a; -save_master_pos; - -connection server_3; -sync_with_master; -SELECT * FROM t1 ORDER BY a; -SELECT * FROM t2 ORDER BY a; -save_master_pos; - -connection server_4; -sync_with_master; -SELECT * FROM t1 ORDER BY a; -SELECT * FROM t2 ORDER BY a; - - ---echo *** Now take out D, let it fall behind a bit, and then test re-attaching it to A *** -connection server_4; ---source include/stop_slave.inc - -connection server_1; -INSERT INTO t1 VALUES (5, "m1a"); -INSERT INTO t2 VALUES (5, "i1a"); -save_master_pos; - -connection server_4; ---replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, - MASTER_USE_GTID=CURRENT_POS; ---source include/start_slave.inc -sync_with_master; -SELECT * FROM t1 ORDER BY a; -SELECT * FROM t2 ORDER BY a; - ---echo *** Now move B to D (C is still replicating from B) *** -connection server_2; ---source include/stop_slave.inc ---replace_result $SERVER_MYPORT_4 SERVER_MYPORT_4 -eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4, - MASTER_USE_GTID=CURRENT_POS; ---source include/start_slave.inc - -connection server_4; -UPDATE t2 SET b="j1a" WHERE a=5; -save_master_pos; - -connection server_2; -sync_with_master; -SELECT * FROM t1 ORDER BY a; -SELECT * FROM t2 ORDER BY a; - ---echo *** Now move C to D, after letting it fall a little behind *** -connection server_3; ---source include/stop_slave.inc - -connection server_1; -INSERT INTO t2 VALUES (6, "i6b"); -INSERT INTO t2 VALUES (7, "i7b"); ---source include/save_master_gtid.inc - -connection server_3; ---replace_result $SERVER_MYPORT_4 SERVER_MYPORT_4 -eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4, - MASTER_USE_GTID=CURRENT_POS; ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc -SELECT * FROM t2 ORDER BY a; - ---echo *** Now change everything back to what it was, to make rpl_end.inc happy -# Also check that MASTER_USE_GTID=CURRENT_POS is still enabled. -connection server_2; -# We need to sync up server_2 before switching. If it happened to have reached -# the point 'UPDATE t2 SET b="j1a" WHERE a=5' it will fail to connect to -# server_1, which is (deliberately) missing that transaction. ---source include/sync_with_master_gtid.inc ---source include/stop_slave.inc ---replace_result $MASTER_MYPORT MASTER_MYPORT -eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT; ---source include/start_slave.inc ---source include/wait_for_slave_to_start.inc - -connection server_3; ---source include/stop_slave.inc ---replace_result $SLAVE_MYPORT SLAVE_MYPORT -eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SLAVE_MYPORT; ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -connection server_4; ---source include/stop_slave.inc ---replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3 -eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_3; ---source include/start_slave.inc - -connection server_1; -DROP TABLE t1,t2; ---source include/save_master_gtid.inc - ---echo *** A few more checks for BINLOG_GTID_POS function *** ---let $valid_binlog_name = query_get_value(SHOW BINARY LOGS,Log_name,1) ---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT -SELECT BINLOG_GTID_POS(); ---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT -SELECT BINLOG_GTID_POS('a'); ---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT -SELECT BINLOG_GTID_POS('a',1,NULL); -SELECT BINLOG_GTID_POS(1,'a'); -SELECT BINLOG_GTID_POS(NULL,NULL); -SELECT BINLOG_GTID_POS('',1); -SELECT BINLOG_GTID_POS('a',1); -eval SELECT BINLOG_GTID_POS('$valid_binlog_name',-1); -eval SELECT BINLOG_GTID_POS('$valid_binlog_name',0); -eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551615); -eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551616); - - ---echo *** Some tests of @@GLOBAL.gtid_binlog_state *** ---connection server_2 ---source include/sync_with_master_gtid.inc ---source include/stop_slave.inc - ---connection server_1 -SET @old_state= @@GLOBAL.gtid_binlog_state; - ---error ER_BINLOG_MUST_BE_EMPTY -SET GLOBAL gtid_binlog_state = ''; -RESET MASTER; -SET GLOBAL gtid_binlog_state = ''; -FLUSH LOGS; ---source include/show_binary_logs.inc -SET GLOBAL gtid_binlog_state = '0-1-10,1-2-20,0-3-30'; ---source include/show_binary_logs.inc ---let $binlog_file= master-bin.000001 ---let $binlog_start= 4 ---source include/show_binlog_events.inc -#SELECT @@GLOBAL.gtid_binlog_pos; -#SELECT @@GLOBAL.gtid_binlog_state; ---error ER_BINLOG_MUST_BE_EMPTY -SET GLOBAL gtid_binlog_state = @old_state; -RESET MASTER; -SET GLOBAL gtid_binlog_state = @old_state; - -# Check that slave can reconnect again, despite the RESET MASTER, as we -# restored the state. - -CREATE TABLE t1 (a INT PRIMARY KEY); -SET gtid_seq_no=100; -INSERT INTO t1 VALUES (1); ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc -# We cannot just use sync_with_master as we've done RESET MASTER, so -# slave old-style position is wrong. -# So sync on gtid position instead. ---source include/sync_with_master_gtid.inc - -SELECT * FROM t1; -# Check that the IO gtid position in SHOW SLAVE STATUS is also correct. ---let $status_items= Gtid_IO_Pos ---source include/show_slave_status.inc - ---echo *** Test @@LAST_GTID and MASTER_GTID_WAIT() *** - ---connection server_1 -DROP TABLE t1; -CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc - ---connect (m1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SELECT @@last_gtid; -SET gtid_seq_no=110; -SELECT @@last_gtid; -BEGIN; -SELECT @@last_gtid; -INSERT INTO t1 VALUES (2); -SELECT @@last_gtid; -COMMIT; -SELECT @@last_gtid; ---let $pos= `SELECT @@gtid_binlog_pos` - ---connect (s1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -eval SET @pos= '$pos'; -# Check NULL argument. -SELECT master_gtid_wait(NULL); -# Check empty argument returns immediately. -SELECT master_gtid_wait('', NULL); -# Check this gets counted -SHOW STATUS LIKE 'Master_gtid_wait_count'; -SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; -SHOW STATUS LIKE 'Master_gtid_wait_time'; -# Let's check that we get a timeout -SELECT master_gtid_wait(@pos, 0.5); -SELECT * FROM t1 ORDER BY a; -# Now actually wait until the slave reaches the position -send SELECT master_gtid_wait(@pos); - ---connection server_2 ---source include/start_slave.inc - ---connection s1 -reap; -SELECT * FROM t1 ORDER BY a; - -# Test waiting on a domain that does not exist yet. ---source include/stop_slave.inc - ---connection server_1 -SET gtid_domain_id= 1; -INSERT INTO t1 VALUES (3); ---let $pos= `SELECT @@gtid_binlog_pos` - ---connection s1 ---replace_result $pos POS -eval SET @pos= '$pos'; -SELECT master_gtid_wait(@pos, 0); -SELECT * FROM t1 WHERE a >= 3; -send SELECT master_gtid_wait(@pos, -1); - ---connection server_2 ---source include/start_slave.inc - ---connection s1 -reap; -SELECT * FROM t1 WHERE a >= 3; -# Waiting for only part of the position. -SELECT master_gtid_wait('1-1-1', 0); - -# Now test a lot of parallel master_gtid_wait() calls, completing in different -# order, and some of which time out or get killed on the way. - ---connection s1 -send SELECT master_gtid_wait('2-1-1,1-1-4,0-1-110'); - ---connect (s2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -# This will time out. No event 0-1-1000 exists -send SELECT master_gtid_wait('0-1-1000', 0.5); - ---connect (s3,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -# This one we will kill ---let $kill1_id= `SELECT connection_id()` -send SELECT master_gtid_wait('0-1-2000'); - ---connect (s4,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -send SELECT master_gtid_wait('2-1-10'); - ---connect (s5,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -send SELECT master_gtid_wait('2-1-6', 1); - -# This one we will kill also. ---connect (s6,127.0.0.1,root,,test,$SERVER_MYPORT_2,) ---let $kill2_id= `SELECT connection_id()` -send SELECT master_gtid_wait('2-1-5'); - ---connect (s7,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -send SELECT master_gtid_wait('2-1-10'); - ---connect (s8,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -send SELECT master_gtid_wait('2-1-5,1-1-4,0-1-110'); - ---connect (s9,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -send SELECT master_gtid_wait('2-1-2'); - ---connection server_2 -# This one completes immediately. -SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; -SHOW STATUS LIKE 'Master_gtid_wait_count'; -SELECT master_gtid_wait('1-1-1'); -SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; -SHOW STATUS LIKE 'Master_gtid_wait_count'; -let $wait_time = query_get_value(SHOW STATUS LIKE 'Master_gtid_wait_time', Value, 1); ---replace_result $wait_time MASTER_GTID_WAIT_TIME -eval SET @a= $wait_time; -SELECT IF(@a <= 100*1000*1000, "OK", CONCAT("Error: wait time ", @a, " is larger than expected")) - AS Master_gtid_wait_time_as_expected; - - ---connect (s10,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -send SELECT master_gtid_wait('0-1-109'); - ---connection server_2 -# This one should time out. -SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; -SHOW STATUS LIKE 'Master_gtid_wait_count'; -SELECT master_gtid_wait('2-1-2', 0.5); -SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; -SHOW STATUS LIKE 'Master_gtid_wait_count'; -let $wait_time = query_get_value(SHOW STATUS LIKE 'Master_gtid_wait_time', Value, 1); ---replace_result $wait_time MASTER_GTID_WAIT_TIME -eval SET @a= $wait_time; -# We expect a wait time of just a bit over 0.5 seconds. But thread scheduling -# and timer inaccuracies could introduce significant jitter. So allow a -# generous interval. -SELECT IF(@a BETWEEN 0.4*1000*1000 AND 100*1000*1000, "OK", CONCAT("Error: wait time ", @a, " not as expected")) AS Master_gtid_wait_time_as_expected; - ---replace_result $kill1_id KILL_ID -eval KILL QUERY $kill1_id; ---connection s3 ---error ER_QUERY_INTERRUPTED -reap; - ---connection server_1 -SET gtid_domain_id=2; -SET gtid_seq_no=2; -INSERT INTO t1 VALUES (4); - ---connection s9 -reap; - ---connection server_2 ---replace_result $kill2_id KILL_ID -eval KILL CONNECTION $kill2_id; - ---connection s6 ---error 2013,ER_CONNECTION_KILLED -reap; - ---connection server_1 -SET gtid_domain_id=1; -SET gtid_seq_no=4; -INSERT INTO t1 VALUES (5); -SET gtid_domain_id=2; -SET gtid_seq_no=5; -INSERT INTO t1 VALUES (6); - ---connection s8 -reap; ---connection s1 -reap; ---connection s2 -reap; ---connection s5 -reap; ---connection s10 -reap; - ---connection server_1 -SET gtid_domain_id=2; -SET gtid_seq_no=10; -INSERT INTO t1 VALUES (7); - ---connection s4 -reap; ---connection s7 -reap; - - ---echo *** Test gtid_slave_pos when used with GTID *** - ---connection server_2 ---source include/stop_slave.inc - ---connection server_1 -SET gtid_domain_id=2; -SET gtid_seq_no=1000; -INSERT INTO t1 VALUES (10); -INSERT INTO t1 VALUES (11); ---save_master_pos - ---connection server_2 -SET sql_slave_skip_counter= 1; ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t1 WHERE a >= 10 ORDER BY a; -SELECT IF(LOCATE("2-1-1001", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1001 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; - ---source include/stop_slave.inc - ---connection server_1 -SET gtid_domain_id=2; -SET gtid_seq_no=1010; -INSERT INTO t1 VALUES (12); -INSERT INTO t1 VALUES (13); ---save_master_pos - ---connection server_2 -SET sql_slave_skip_counter= 2; ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t1 WHERE a >= 10 ORDER BY a; -SELECT IF(LOCATE("2-1-1011", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1011 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; - ---source include/stop_slave.inc - ---connection server_1 -SET gtid_domain_id=2; -SET gtid_seq_no=1020; -INSERT INTO t1 VALUES (14); -INSERT INTO t1 VALUES (15); -INSERT INTO t1 VALUES (16); ---save_master_pos - ---connection server_2 -SET sql_slave_skip_counter= 3; ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t1 WHERE a >= 10 ORDER BY a; -SELECT IF(LOCATE("2-1-1022", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1022 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; - ---source include/stop_slave.inc - ---connection server_1 -SET gtid_domain_id=2; -SET gtid_seq_no=1030; -# Disable logging Annotate_rows events to preserve events count. -let $binlog_annotate_row_events_saved= `SELECT @@binlog_annotate_row_events`; -SET @@binlog_annotate_row_events= 0; -INSERT INTO t1 VALUES (17); -INSERT INTO t1 VALUES (18); -INSERT INTO t1 VALUES (19); -eval SET @@binlog_annotate_row_events= $binlog_annotate_row_events_saved; ---save_master_pos - ---connection server_2 -SET sql_slave_skip_counter= 5; ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t1 WHERE a >= 10 ORDER BY a; -SELECT IF(LOCATE("2-1-1032", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1032 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; - - ---source include/stop_slave.inc - ---connection server_1 -SET gtid_domain_id=3; -SET gtid_seq_no=100; -CREATE TABLE t2 (a INT PRIMARY KEY); -DROP TABLE t2; -SET gtid_domain_id=2; -SET gtid_seq_no=1040; -INSERT INTO t1 VALUES (20); ---save_master_pos - ---connection server_2 -SET @saved_mode= @@GLOBAL.slave_ddl_exec_mode; -SET GLOBAL slave_ddl_exec_mode=STRICT; -SET sql_slave_skip_counter=1; -START SLAVE UNTIL master_gtid_pos="3-1-100"; ---let $master_pos=3-1-100 ---source include/sync_with_master_gtid.inc ---source include/wait_for_slave_to_stop.inc ---error ER_NO_SUCH_TABLE -SELECT * FROM t2; -SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; - -# Start the slave again, it should fail on the DROP TABLE as the table is not there. -SET sql_log_bin=0; -CALL mtr.add_suppression("Slave: Unknown table 'test\\.t2' Error_code: 1051"); -SET sql_log_bin=1; -START SLAVE; ---let $slave_sql_errno=1051 ---source include/wait_for_slave_sql_error.inc -SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; - -STOP SLAVE IO_THREAD; -SET sql_slave_skip_counter=2; ---source include/start_slave.inc ---sync_with_master - -SELECT * FROM t1 WHERE a >= 20 ORDER BY a; -SELECT IF(LOCATE("3-1-101", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-101 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; -SELECT IF(LOCATE("2-1-1040", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1040 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; - -SET GLOBAL slave_ddl_exec_mode= @saved_mode; - - ---echo *** Test GTID-connecting to a master with out-of-order sequence numbers in the binlog. *** - -# Create an out-of-order binlog on server 2. -# Let server 3 replicate to an out-of-order point, stop it, restart it, -# and check that it replicates correctly despite the out-of-order. - ---connection server_1 -SET gtid_domain_id= @@GLOBAL.gtid_domain_id; -INSERT INTO t1 VALUES (31); ---save_master_pos - ---connection server_2 ---sync_with_master -SET gtid_domain_id= @@GLOBAL.gtid_domain_id; -INSERT INTO t1 VALUES (32); - ---connection server_1 -INSERT INTO t1 VALUES (33); ---save_master_pos - ---connection server_2 ---sync_with_master ---save_master_pos - ---connection server_3 ---sync_with_master ---source include/stop_slave.inc - ---connection server_1 -INSERT INTO t1 VALUES (34); ---save_master_pos - ---connection server_2 ---sync_with_master ---save_master_pos - ---connection server_3 ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t1 WHERE a >= 30 ORDER BY a; ---save_master_pos - ---connection server_4 ---sync_with_master -SELECT * FROM t1 WHERE a >= 30 ORDER BY a; - - -# Clean up. ---connection server_1 -DROP TABLE t1; - - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_incident.inc b/mysql-test/suite/rpl/include/rpl_incident.inc deleted file mode 100644 index 75d28d6a6c6b0..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_incident.inc +++ /dev/null @@ -1,61 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - ---source include/have_debug.inc ---source include/master-slave.inc - -SET @old_binlog_checksum=@@binlog_checksum; -SET GLOBAL BINLOG_CHECKSUM=none; -connection slave; -SET @old_binlog_checksum=@@binlog_checksum; -SET GLOBAL BINLOG_CHECKSUM=none; -connection master; - ---echo **** On Master **** -CREATE TABLE t1 (a INT); - -INSERT INTO t1 VALUES (1),(2),(3); -SELECT * FROM t1; - -set @saved_dbug = @@global.debug_dbug; -SET GLOBAL debug_dbug= '+d,incident_database_resync_on_replace,*'; - -# This will generate an incident log event and store it in the binary -# log before the replace statement. -REPLACE INTO t1 VALUES (4); ---save_master_pos -SELECT * FROM t1; - -set @@global.debug_dbug = @saved_dbug; - -connection slave; -# Wait until SQL thread stops with error LOST_EVENT on master -call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master.* 1590"); -let $slave_sql_errno= 1590; -let $show_slave_sql_error= 1; -source include/wait_for_slave_sql_error.inc; - -# The 4 should not be inserted into the table, since the incident log -# event should have stop the slave. ---echo **** On Slave **** -SELECT * FROM t1; - -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -START SLAVE; ---sync_with_master - -# Now, we should have inserted the row into the table and the slave -# should be running. We should also have rotated to a new binary log. - -SELECT * FROM t1; -source include/check_slave_is_running.inc; - -connection master; -SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum; -DROP TABLE t1; ---sync_slave_with_master -SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum; ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_init_slave_errors.inc b/mysql-test/suite/rpl/include/rpl_init_slave_errors.inc deleted file mode 100644 index 46673ea47649f..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_init_slave_errors.inc +++ /dev/null @@ -1,96 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - -###################################################################### -# Some errors that cause the slave SQL thread to stop are not shown in -# the Slave_SQL_Error column of "SHOW SLAVE STATUS". Instead, the error -# is only in the server's error log. -# -# Two failures and their respective reporting are verified: -# -# 1 - Failures during slave thread initialization -# 2 - Failures while processing queries passed through the init_slave -# option. -# -# In order to check the first type of failure, we inject a fault in the -# SQL/IO Threads through SET GLOBAL debug. -# -# To check the second type, we set @@global.init_slave to an invalid -# command thus preventing the initialization of the SQL Thread. -# -# Obs: -# 1 - Note that testing failures while initializing the relay log position -# is hard as the same function is called before the code reaches the point -# that we want to test. -# -# 2 - This test does not target failures that are reported while applying -# events such as duplicate keys, errors while reading the relay-log.bin*, -# etc. Such errors are already checked on other tests. -###################################################################### - -###################################################################### -# Configuring the Environment -###################################################################### -source include/have_debug.inc; -source include/have_log_bin.inc; -source include/master-slave.inc; - -connection slave; - ---disable_warnings -stop slave; ---enable_warnings -reset slave; - -###################################################################### -# Injecting faults in the threads' initialization -###################################################################### -connection slave; - -# Set debug flags on slave to force errors to occur -set @saved_dbug = @@global.debug_dbug; -SET GLOBAL debug_dbug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; - -start slave; - -# -# slave is going to stop because of emulated failures -# but there won't be any crashes nor asserts hit. -# -# 1593 = ER_SLAVE_FATAL_ERROR ---let $slave_sql_errno= 1593 ---let $show_slave_sql_error= 1 ---source include/wait_for_slave_sql_error.inc - -call mtr.add_suppression("Failed during slave.* thread initialization"); - -set @@global.debug_dbug = @saved_dbug; - -###################################################################### -# Injecting faults in the init_slave option -###################################################################### -connection slave; - -reset slave; - -SET GLOBAL init_slave= "garbage"; - -start slave; -# 1064 = ER_PARSE_ERROR ---let $slave_sql_errno= 1064 ---let $show_slave_sql_error= 1 ---source include/wait_for_slave_sql_error.inc - -###################################################################### -# Clean up -###################################################################### -SET GLOBAL init_slave= ""; - -# Clean up Last_SQL_Error ---source include/stop_slave_io.inc -RESET SLAVE; ---let $rpl_only_running_threads= 1 ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_loadfile.inc b/mysql-test/suite/rpl/include/rpl_loadfile.inc deleted file mode 100644 index 9cd645306908c..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_loadfile.inc +++ /dev/null @@ -1,120 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - -############################################################################# -# Original Author: JBM # -# Original Date: Aug/18/2005 # -############################################################################# -# TEST: To test the LOAD_FILE() in rbr # -############################################################################# -# Change Author: JBM -# Change Date: 2006-01-16 -########## - -# Includes --- source include/have_binlog_format_mixed_or_row.inc --- source include/master-slave.inc - --- source suite/rpl/include/rpl_loadfile.test - -# BUG#39701: Mixed binlog format does not switch to row mode on LOAD_FILE -# -# DESCRIPTION -# -# Problem: when using load_file string function and mixed binlogging format -# there was no switch to row based binlogging format. This leads -# to scenarios on which the slave replicates the statement and it -# will try to load the file from local file system, which in most -# likely it will not exist. -# -# Solution: -# Marking this function as unsafe for statement format, makes the -# statement using it to be logged in row based format. As such, data -# replicated from the master, becomes the content of the loaded file. -# Consequently, the slave receives the necessary data to complete -# the load_file instruction correctly. -# -# IMPLEMENTATION -# -# The test is implemented as follows: -# -# On Master, -# i) write to file the desired content. -# ii) create table and stored procedure with load_file -# iii) stop slave -# iii) execute load_file -# iv) remove file -# -# On Slave, -# v) start slave -# vi) sync it with master so that it gets the updates from binlog (which -# should have bin logged in row format). -# -# If the the binlog format does not change to row, then the assertion -# done in the following step fails. This happens because tables differ -# since the file does not exist anymore, meaning that when slave -# attempts to execute LOAD_FILE statement it inserts NULL on table -# instead of the same contents that the master loaded when it executed -# the procedure (which was executed when file existed). -# -# vii) assert that the contents of master and slave -# table are the same - ---source include/rpl_reset.inc - -connection master; -let $file= $MYSQLTEST_VARDIR/tmp/bug_39701.data; - ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---eval SELECT repeat('x',20) INTO OUTFILE '$file' - -disable_warnings; -DROP TABLE IF EXISTS t1; -enable_warnings; - -CREATE TABLE t1 (t text); -DELIMITER |; -CREATE PROCEDURE p(file varchar(4096)) - BEGIN - INSERT INTO t1 VALUES (LOAD_FILE(file)); - END| -DELIMITER ;| - -# stop slave before issuing the load_file on master -connection slave; -source include/stop_slave.inc; - -connection master; - -# test: check that logging falls back to rbr. ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---eval CALL p('$file') - -# test: remove the file from the filesystem and assert that slave still -# gets the loaded file -remove_file $file; - -# now that the file is removed it is safe (regarding what we want to test) -# to start slave -connection slave; -source include/start_slave.inc; - -connection master; -sync_slave_with_master; - -# assertion: assert that the slave got the updates even -# if the file was removed before the slave started, -# meaning that contents were indeed transfered -# through binlog (in row format) -let $diff_tables= master:t1, slave:t1; -source include/diff_tables.inc; - -# CLEAN UP ---connection master -DROP TABLE t1; -DROP PROCEDURE p; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_packet.inc b/mysql-test/suite/rpl/include/rpl_packet.inc deleted file mode 100644 index cbde486bcbbda..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_packet.inc +++ /dev/null @@ -1,184 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - -# ==== Purpose ==== -# -# Check replication protocol packet size handling -# -# ==== Related bugs ==== -# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave -# BUG#23755: Replicated event larger that max_allowed_packet infinitely re-transmits -# BUG#42914: No LAST_IO_ERROR for max_allowed_packet errors -# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET - -# max-out size db name -source include/have_binlog_format_row.inc; -source include/master-slave.inc; - -call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, .*error.* 1153"); -call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet"); -let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________; -disable_warnings; -eval drop database if exists $db; -enable_warnings; -eval create database $db; - -connection master; -let $old_max_allowed_packet= `SELECT @@global.max_allowed_packet`; -let $old_net_buffer_length= `SELECT @@global.net_buffer_length`; -let $old_slave_max_allowed_packet= `SELECT @@global.slave_max_allowed_packet`; -SET @@global.max_allowed_packet=1024; -SET @@global.net_buffer_length=1024; - -sync_slave_with_master; -# Restart slave for setting to take effect -source include/stop_slave.inc; -source include/start_slave.inc; - -# Reconnect to master for new setting to take effect -disconnect master; - -# alas, can't use eval here; if db name changed apply the change here -connect (master,localhost,root,,DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________); - -connection master; -select @@net_buffer_length, @@max_allowed_packet; - -create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM; - -INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023'); -sync_slave_with_master; - -eval select count(*) from `$db`.`t1` /* must be 1 */; - -SHOW STATUS LIKE 'Slave_running'; -select * from information_schema.session_status where variable_name= 'SLAVE_RUNNING'; -connection master; -eval drop database $db; -sync_slave_with_master; - -# -# Bug #23755: Replicated event larger that max_allowed_packet infinitely re-transmits -# -# Check that a situation when the size of event on the master is greater than -# max_allowed_packet on the slave does not lead to infinite re-transmits. - -connection master; - -# Change the max packet size on master - -SET @@global.max_allowed_packet=4096; -SET @@global.net_buffer_length=4096; - -# Restart slave for new setting to take effect -connection slave; -source include/stop_slave.inc; -source include/start_slave.inc; - -# Reconnect to master for new setting to take effect -disconnect master; -connect (master, localhost, root); -connection master; - -CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM; - -sync_slave_with_master; - -connection master; - -INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048'); - - -# -# Bug#42914: The slave I/O thread must stop after trying to read the above -# event, However there is no Last_IO_Error report. -# - -# The slave I/O thread must stop after trying to read the above event -connection slave; -# 1153 = ER_NET_PACKET_TOO_LARGE ---let $slave_io_errno= 1153 ---let $show_slave_io_error= 1 ---source include/wait_for_slave_io_error.inc - -# TODO: this is needed because of BUG#55790. Remove once that is fixed. ---source include/stop_slave_sql.inc - -# -# Bug#42914: On the master, if a binary log event is larger than -# max_allowed_packet, the error message ER_MASTER_FATAL_ERROR_READING_BINLOG -# is sent to a slave when it requests a dump from the master, thus leading the -# I/O thread to stop. However, there is no Last_IO_Error reported. -# - ---let $rpl_only_running_threads= 1 ---source include/rpl_reset.inc ---connection master -DROP TABLE t1; ---sync_slave_with_master - - -connection master; -CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM; -sync_slave_with_master; - -connection master; -INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet)); - -connection slave; -# The slave I/O thread must stop after receiving -# 1153 = ER_NET_PACKET_TOO_LARGE ---let $slave_io_errno= 1153 ---let $show_slave_io_error= 1 ---source include/wait_for_slave_io_error.inc - -# Remove the bad binlog and clear error status on slave. -STOP SLAVE; -RESET SLAVE; ---connection master -RESET MASTER; - - -# -# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET -# -# In BUG#55322, @@session.max_allowed_packet increased each time SHOW -# BINLOG EVENTS was issued. To verify that this bug is fixed, we -# execute SHOW BINLOG EVENTS twice and check that max_allowed_packet -# never changes. We turn off the result log because we don't care -# about the contents of the binlog. - ---disable_result_log -SET @max_allowed_packet_0= @@session.max_allowed_packet; -SHOW BINLOG EVENTS; -SET @max_allowed_packet_1= @@session.max_allowed_packet; -SHOW BINLOG EVENTS; -SET @max_allowed_packet_2= @@session.max_allowed_packet; ---enable_result_log -if (`SELECT NOT(@max_allowed_packet_0 = @max_allowed_packet_1 AND @max_allowed_packet_1 = @max_allowed_packet_2)`) -{ - --echo ERROR: max_allowed_packet changed after executing SHOW BINLOG EVENTS - --source include/show_rpl_debug_info.inc - SELECT @max_allowed_packet_0, @max_allowed_packet_1, @max_allowed_packet_2; - --die @max_allowed_packet changed after executing SHOW BINLOG EVENTS -} - - ---echo ==== clean up ==== -connection master; -DROP TABLE t1; -eval SET @@global.max_allowed_packet= $old_max_allowed_packet; -eval SET @@global.net_buffer_length= $old_net_buffer_length; -eval SET @@global.slave_max_allowed_packet= $old_slave_max_allowed_packet; -# slave is stopped -connection slave; -DROP TABLE t1; - -# Clear Last_IO_Error -RESET SLAVE; - ---source include/rpl_end.inc -# End of tests diff --git a/mysql-test/suite/rpl/include/rpl_parallel_29322.inc b/mysql-test/suite/rpl/include/rpl_parallel_29322.inc new file mode 100644 index 0000000000000..54eb13d7f09d7 --- /dev/null +++ b/mysql-test/suite/rpl/include/rpl_parallel_29322.inc @@ -0,0 +1,111 @@ +# A "body" for rpl.rpl_parallel_29322 that runs having as input +# the master and slave @@global.explicit_defaults_for_timestamp. +# +# The Key notes +# ------------- +# On master: a sequence of binlog files is composed with +# different server versions. +# On slave: to first try enqueuing all master events. +# Due to binlog files are from different version +# servers when the new (of binlog 2) FD shows up the enqueuing +# will hiccup as workers have to +# process all events already scheduled (see wait_condition below). +# This part proves of the different server version the binlogs +# indeed are. +# After the worker is unblocked the exection proceeds. +# +# In the end compare table definitions and print table data +# to prove correctness. + +--connection slave +--source include/stop_slave.inc +reset slave; + +--connection master +--let $datadir= `SELECT @@datadir` + +reset master; # Master starts a new serious of binlog files + +create table t2 (a timestamp, b int); +show create table t2; +--save_master_pos + +--connection slave +--source include/start_slave.inc +--sync_with_master +--source include/stop_slave.inc + +# load for two $same_version_binlogs branches +--connection master +if (!$same_version_binlogs) +{ + insert into t2 values (null, 1); + flush binary logs; + flush binary logs; + insert into t2 values (null, 2); +} +if ($same_version_binlogs) +{ +--disable_query_log + --let $count=8 + while ($count) + { + --let $queries=4 + while ($queries) + { + insert into t2 values (null, 1); + --dec $queries + } + flush binary logs; + flush binary logs; + --dec $count + } +--enable_query_log +} +--save_master_pos + +if (!$same_version_binlogs) +{ + --move_file $datadir/master-bin.000002 $datadir/master-bin.000002.sav + --copy_file $MYSQL_TEST_DIR/std_data/mdev29078-mysql-bin.000001 $datadir/master-bin.000002 + --exec $MYSQL_BINLOG --short-form $datadir/master-bin.000002 + + # To demonstrate different version binlogs, hold back worker + # until the SQL thread state shows waiting. + --connection slave1 + lock table t2 write; +} + +--connection slave +--source include/start_slave.inc + +if (!$same_version_binlogs) +{ + --let $slave_waits_for=Waiting for worker threads to be idle + --let $wait_condition= SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE state = "$slave_waits_for" + --source include/wait_condition.inc + + --connection slave1 + unlock tables; + + --connection slave + --sync_with_master + show create table t1; + set statement time_zone='+2:00' for select * from t1; + drop table t1; + + --connection master + --remove_file $datadir/master-bin.000002 + --move_file $datadir/master-bin.000002.sav $datadir/master-bin.000002 +} + +--connection slave +--sync_with_master +show create table t2; +--let $diff_tables=master:t2,slave:t2 +--source include/diff_tables.inc + +--connection master +drop table t2; + +--sync_slave_with_master diff --git a/mysql-test/suite/rpl/include/rpl_parallel_analyze_table_hang.inc b/mysql-test/suite/rpl/include/rpl_parallel_analyze_table_hang.inc deleted file mode 100644 index 62a7501c36b19..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_analyze_table_hang.inc +++ /dev/null @@ -1,73 +0,0 @@ ---echo *** MDEV-7888: ANALYZE TABLE does wakeup_subsequent_commits(), causing wrong binlog order and parallel replication hang *** ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_mode='conservative'; -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep'; - ---connection server_1 -# Inject two group commits. The bug was that ANALYZE TABLE would call -# wakeup_subsequent_commits() too early, allowing the following transaction -# in the same group to run ahead and binlog and free the GCO. Then we get -# wrong binlog order and later access freed GCO, which causes lost wakeup -# of following GCO and thus replication hang. -# We injected a small sleep in ANALYZE to make the race easier to hit (this -# can only cause false negatives in versions with the bug, not false positives, -# so sleep is ok here. And it's in general not possible to trigger reliably -# the race with debug_sync, since the bugfix makes the race impossible). - -SET @old_dbug= @@SESSION.debug_dbug; -SET SESSION debug_dbug="+d,binlog_force_commit_id"; - -# Group commit with cid=10000, two event groups. -SET @commit_id= 10000; -ANALYZE TABLE t2; -INSERT INTO t3 VALUES (120, 0); - -# Group commit with cid=10001, one event group. -SET @commit_id= 10001; -INSERT INTO t3 VALUES (121, 0); - -SET SESSION debug_dbug=@old_dbug; - -SELECT * FROM t3 WHERE a >= 120 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -SELECT * FROM t3 WHERE a >= 120 ORDER BY a; - -# Clean up. ---source include/stop_slave.inc -SET GLOBAL debug_dbug= @old_dbug; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; -SET GLOBAL slave_parallel_mode=@old_parallel_mode; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t2,t3; - ---source include/rpl_end.inc - diff --git a/mysql-test/suite/rpl/include/rpl_parallel_deadlock_corrupt_binlog.inc b/mysql-test/suite/rpl/include/rpl_parallel_deadlock_corrupt_binlog.inc deleted file mode 100644 index 3a135ef5cc483..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_deadlock_corrupt_binlog.inc +++ /dev/null @@ -1,79 +0,0 @@ ---echo *** MDEV-7335: Potential parallel slave deadlock with specific binlog corruption *** ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection server_2 ---source include/stop_slave.inc -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=1; -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000"; - ---connection server_1 -INSERT INTO t2 VALUES (101); -INSERT INTO t2 VALUES (102); -INSERT INTO t2 VALUES (103); -INSERT INTO t2 VALUES (104); -INSERT INTO t2 VALUES (105); -# Inject a partial event group (missing XID at the end). The bug was that such -# partial group was not handled appropriately, leading to server deadlock. -SET gtid_seq_no=1000; -INSERT INTO t2 VALUES (106); -INSERT INTO t2 VALUES (107); -INSERT INTO t2 VALUES (108); -INSERT INTO t2 VALUES (109); -INSERT INTO t2 VALUES (110); -INSERT INTO t2 VALUES (111); -INSERT INTO t2 VALUES (112); -INSERT INTO t2 VALUES (113); -INSERT INTO t2 VALUES (114); -INSERT INTO t2 VALUES (115); -INSERT INTO t2 VALUES (116); -INSERT INTO t2 VALUES (117); -INSERT INTO t2 VALUES (118); -INSERT INTO t2 VALUES (119); -INSERT INTO t2 VALUES (120); -INSERT INTO t2 VALUES (121); -INSERT INTO t2 VALUES (122); -INSERT INTO t2 VALUES (123); -INSERT INTO t2 VALUES (124); -INSERT INTO t2 VALUES (125); -INSERT INTO t2 VALUES (126); -INSERT INTO t2 VALUES (127); -INSERT INTO t2 VALUES (128); -INSERT INTO t2 VALUES (129); -INSERT INTO t2 VALUES (130); ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc -# The partial event group (a=106) should be rolled back and thus missing. -SELECT * FROM t2 WHERE a >= 100 ORDER BY a; - -# Cleanup ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 -DROP TABLE t2; -SET DEBUG_SYNC= 'RESET'; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_domain.inc b/mysql-test/suite/rpl/include/rpl_parallel_domain.inc deleted file mode 100644 index eda08cc29168b..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_domain.inc +++ /dev/null @@ -1,87 +0,0 @@ -# Test should work with both conservative and optimistic modes - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - -# Test various aspects of parallel replication. - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---error ER_SLAVE_MUST_STOP -SET GLOBAL slave_parallel_threads=10; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; - -# Check that we do not spawn any worker threads when no slave is running. -SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; - -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - -# Check that worker threads get spawned when slave starts. -SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; -# ... and that worker threads get removed when slave stops. ---source include/stop_slave.inc -SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; ---source include/start_slave.inc -SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; - ---echo *** Test long-running query in domain 1 can run in parallel with short queries in domain 0 *** - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (1); ---save_master_pos - ---connection server_2 ---sync_with_master - -# Block the table t1 to simulate a replicated query taking a long time. ---connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -LOCK TABLE t1 WRITE; - ---connection server_1 -SET gtid_domain_id=1; -# This query will be blocked on the slave until UNLOCK TABLES. -INSERT INTO t1 VALUES (2); -SET gtid_domain_id=0; -# These t2 queries can be replicated in parallel with the prior t1 query, as -# they are in a separate replication domain. -INSERT INTO t2 VALUES (2); -INSERT INTO t2 VALUES (3); -BEGIN; -INSERT INTO t2 VALUES (4); -INSERT INTO t2 VALUES (5); -COMMIT; -INSERT INTO t2 VALUES (6); - ---connection server_2 ---let $wait_condition= SELECT COUNT(*) = 6 FROM t2 ---source include/wait_condition.inc - -SELECT * FROM t2 ORDER by a; - ---connection con_temp1 -SELECT * FROM t1; -UNLOCK TABLES; - ---connection server_2 ---let $wait_condition= SELECT COUNT(*) = 2 FROM t1 ---source include/wait_condition.inc - -SELECT * FROM t1 ORDER BY a; - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t1,t2; ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_domain_slave_single_grp.inc b/mysql-test/suite/rpl/include/rpl_parallel_domain_slave_single_grp.inc deleted file mode 100644 index 856efd065dfc4..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_domain_slave_single_grp.inc +++ /dev/null @@ -1,128 +0,0 @@ -# Test is independent of slave_parallel_mode ---echo *** Test two transactions in different domains committed in opposite order on slave but in a single group commit. *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - -# Test various aspects of parallel replication. - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (1); ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc - ---connection server_1 -# Use a stored function to inject a debug_sync into the appropriate THD. -# The function does nothing on the master, and on the slave it injects the -# desired debug_sync action(s). -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - -SET @old_format= @@SESSION.binlog_format; -SET binlog_format='statement'; -SET gtid_domain_id=1; -INSERT INTO t2 VALUES (foo(10, - 'commit_before_enqueue SIGNAL ready1 WAIT_FOR cont1', - 'commit_after_release_LOCK_prepare_ordered SIGNAL ready2')); - ---connection server_2 -FLUSH LOGS; ---source include/wait_for_binlog_checkpoint.inc -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; -SET @old_format=@@GLOBAL.binlog_format; -SET GLOBAL binlog_format=statement; -# We need to restart all parallel threads for the new global setting to -# be copied to the session-level values. -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - -# First make sure the first insert is ready to commit, but not queued yet. -SET debug_sync='now WAIT_FOR ready1'; - ---connection server_1 -SET gtid_domain_id=2; -INSERT INTO t2 VALUES (foo(11, - 'commit_before_enqueue SIGNAL ready3 WAIT_FOR cont3', - 'commit_after_release_LOCK_prepare_ordered SIGNAL ready4 WAIT_FOR cont4')); -SET gtid_domain_id=0; -SELECT * FROM t2 WHERE a >= 10 ORDER BY a; - ---connection server_2 -# Now wait for the second insert to queue itself as the leader, and then -# wait for more commits to queue up. -SET debug_sync='now WAIT_FOR ready3'; -SET debug_sync='now SIGNAL cont3'; -SET debug_sync='now WAIT_FOR ready4'; -# Now allow the first insert to queue up to participate in group commit. -SET debug_sync='now SIGNAL cont1'; -SET debug_sync='now WAIT_FOR ready2'; -# Finally allow the second insert to proceed and do the group commit. -SET debug_sync='now SIGNAL cont4'; - ---let $wait_condition= SELECT COUNT(*) = 2 FROM t2 WHERE a >= 10 ---source include/wait_condition.inc -SELECT * FROM t2 WHERE a >= 10 ORDER BY a; -# The two INSERT transactions should have been committed in opposite order, -# but in the same group commit (seen by precense of cid=# in the SHOW -# BINLOG output). ---let $binlog_file= slave-bin.000002 ---source include/show_binlog_events.inc -FLUSH LOGS; ---source include/wait_for_binlog_checkpoint.inc - - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; -SET GLOBAL binlog_format=@old_format; - ---connection server_1 -DROP function foo; -DROP TABLE t1,t2; -SET DEBUG_SYNC= 'RESET'; -SET GLOBAL binlog_format=@old_format; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_free_deferred_event.inc b/mysql-test/suite/rpl/include/rpl_parallel_free_deferred_event.inc deleted file mode 100644 index 41f372eddf855..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_free_deferred_event.inc +++ /dev/null @@ -1,67 +0,0 @@ ---echo *** MDEV-5788 Incorrect free of rgi->deferred_events in parallel replication *** - ---source include/have_innodb.inc ---source include/master-slave.inc - ---connection server_2 ---source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -# Use just two worker threads, so we are sure to get the rpl_group_info added -# to the free list, which is what triggered the bug. ---source include/stop_slave.inc -SET GLOBAL replicate_ignore_table="test.t3"; -SET GLOBAL slave_parallel_threads=2; ---source include/start_slave.inc - ---connection server_1 -INSERT INTO t3 VALUES (100, rand()); -INSERT INTO t3 VALUES (101, rand()); ---save_master_pos - ---connection server_2 ---sync_with_master - ---connection server_1 -INSERT INTO t3 VALUES (102, rand()); -INSERT INTO t3 VALUES (103, rand()); -INSERT INTO t3 VALUES (104, rand()); -INSERT INTO t3 VALUES (105, rand()); ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc -SET GLOBAL replicate_ignore_table=""; ---source include/start_slave.inc - ---connection server_1 -INSERT INTO t3 VALUES (106, rand()); -INSERT INTO t3 VALUES (107, rand()); ---save_master_pos - ---connection server_2 ---sync_with_master ---replace_column 2 # -SELECT * FROM t3 WHERE a >= 100 ORDER BY a; - - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t3; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_gco_wait_kill.inc b/mysql-test/suite/rpl/include/rpl_parallel_gco_wait_kill.inc deleted file mode 100644 index 415960e563e65..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_gco_wait_kill.inc +++ /dev/null @@ -1,370 +0,0 @@ ---echo *** Test killing thread that is waiting to start transaction until previous transaction commits *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET @old_parallel_mode= @@GLOBAL.slave_parallel_mode; ---source include/stop_slave.inc -SET sql_log_bin=0; -CALL mtr.add_suppression("Query execution was interrupted"); -CALL mtr.add_suppression("Slave: Connection was killed"); -CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); -SET sql_log_bin=1; -SET GLOBAL slave_parallel_threads=10; -SET GLOBAL slave_parallel_mode= 'conservative'; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 ---connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; -# MDEV-515 takes X-lock on the table for the first insert. -# So concurrent insert won't happen on the table -INSERT INTO t3 VALUES(100, 100); - ---save_master_pos - ---connection server_2 ---sync_with_master - ---connection server_1 -# Use a stored function to inject a debug_sync into the appropriate THD. -# The function does nothing on the master, and on the slave it injects the -# desired debug_sync action(s). -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_2 -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; -# We need to restart all parallel threads for the new global setting to -# be copied to the session-level values. ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=4; ---source include/start_slave.inc - - -# We set up four transactions T1, T2, T3, and T4 on the master. T2, T3, and T4 -# can run in parallel with each other (same group commit and commit id), -# but not in parallel with T1. -# -# We use four worker threads, each Ti will be queued on each their own -# worker thread. We will delay T1 commit, T3 will wait for T1 to begin -# commit before it can start. We will kill T3 during this wait, and -# check that everything works correctly. -# -# It is rather tricky to get the correct thread id of the worker to kill. -# We start by injecting four dummy transactions in a debug_sync-controlled -# manner to be able to get known thread ids for the workers in a pool with -# just 4 worker threads. Then we let in each of the real test transactions -# T1-T4 one at a time in a way which allows us to know which transaction -# ends up with which thread id. - ---connection server_1 -SET gtid_domain_id=2; -BEGIN; -# This debug_sync will linger on and be used to control T4 later. -INSERT INTO t3 VALUES (70, foo(70, - 'rpl_parallel_start_waiting_for_prior SIGNAL t4_waiting', '')); -INSERT INTO t3 VALUES (60, foo(60, - 'ha_write_row_end SIGNAL d2_query WAIT_FOR d2_cont2', - 'rpl_parallel_end_of_group SIGNAL d2_done WAIT_FOR d2_cont')); -COMMIT; -SET gtid_domain_id=0; - ---connection server_2 -SET debug_sync='now WAIT_FOR d2_query'; ---let $d2_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(60%' AND INFO NOT LIKE '%LIKE%'` - ---connection server_1 -SET gtid_domain_id=1; -BEGIN; -# These debug_sync's will linger on and be used to control T3 later. -INSERT INTO t3 VALUES (61, foo(61, - 'rpl_parallel_start_waiting_for_prior SIGNAL t3_waiting', - 'rpl_parallel_start_waiting_for_prior_killed SIGNAL t3_killed')); -INSERT INTO t3 VALUES (62, foo(62, - 'ha_write_row_end SIGNAL d1_query WAIT_FOR d1_cont2', - 'rpl_parallel_end_of_group SIGNAL d1_done WAIT_FOR d1_cont')); -COMMIT; -SET gtid_domain_id=0; - ---connection server_2 -SET debug_sync='now WAIT_FOR d1_query'; ---let $d1_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(62%' AND INFO NOT LIKE '%LIKE%'` - ---connection server_1 -SET gtid_domain_id=0; -INSERT INTO t3 VALUES (63, foo(63, - 'ha_write_row_end SIGNAL d0_query WAIT_FOR d0_cont2', - 'rpl_parallel_end_of_group SIGNAL d0_done WAIT_FOR d0_cont')); - ---connection server_2 -SET debug_sync='now WAIT_FOR d0_query'; ---let $d0_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(63%' AND INFO NOT LIKE '%LIKE%'` - ---connection server_1 -SET gtid_domain_id=3; -BEGIN; -# These debug_sync's will linger on and be used to control T2 later. -INSERT INTO t3 VALUES (68, foo(68, - 'rpl_parallel_start_waiting_for_prior SIGNAL t2_waiting', '')); -INSERT INTO t3 VALUES (69, foo(69, - 'ha_write_row_end SIGNAL d3_query WAIT_FOR d3_cont2', - 'rpl_parallel_end_of_group SIGNAL d3_done WAIT_FOR d3_cont')); -COMMIT; -SET gtid_domain_id=0; - ---connection server_2 -SET debug_sync='now WAIT_FOR d3_query'; ---let $d3_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(69%' AND INFO NOT LIKE '%LIKE%'` - -SET debug_sync='now SIGNAL d2_cont2'; -SET debug_sync='now WAIT_FOR d2_done'; -SET debug_sync='now SIGNAL d1_cont2'; -SET debug_sync='now WAIT_FOR d1_done'; -SET debug_sync='now SIGNAL d0_cont2'; -SET debug_sync='now WAIT_FOR d0_done'; -SET debug_sync='now SIGNAL d3_cont2'; -SET debug_sync='now WAIT_FOR d3_done'; - -# Now prepare the real transactions T1, T2, T3, T4 on the master. - ---connection con_temp3 -# Create transaction T1. -INSERT INTO t3 VALUES (64, foo(64, - 'rpl_parallel_before_mark_start_commit SIGNAL t1_waiting WAIT_FOR t1_cont', '')); - -# Create transaction T2, as a group commit leader on the master. -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2 WAIT_FOR master_cont2'; -send INSERT INTO t3 VALUES (65, foo(65, '', '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; - ---connection con_temp4 -# Create transaction T3, participating in T2's group commit. -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; -send INSERT INTO t3 VALUES (66, foo(66, '', '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued3'; - ---connection con_temp5 -# Create transaction T4, participating in group commit with T2 and T3. -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued4'; -send INSERT INTO t3 VALUES (67, foo(67, '', '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued4'; -SET debug_sync='now SIGNAL master_cont2'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; ---connection con_temp5 -REAP; - ---connection server_1 -SELECT * FROM t3 WHERE a >= 60 ORDER BY a; -SET debug_sync='RESET'; - ---connection server_2 -# Now we have the four transactions pending for replication on the slave. -# Let them be queued for our three worker threads in a controlled fashion. -# We put them at a stage where T1 is delayed and T3 is waiting for T1 to -# commit before T3 can start. Then we kill T3. - -# Make the worker D0 free, and wait for T1 to be queued in it. -SET debug_sync='now SIGNAL d0_cont'; -SET debug_sync='now WAIT_FOR t1_waiting'; - -# Make the worker D3 free, and wait for T2 to be queued in it. -SET debug_sync='now SIGNAL d3_cont'; -SET debug_sync='now WAIT_FOR t2_waiting'; - -# Now release worker D1, and wait for T3 to be queued in it. -# T3 will wait for T1 to commit before it can start. -SET debug_sync='now SIGNAL d1_cont'; -SET debug_sync='now WAIT_FOR t3_waiting'; - -# Release worker D2. Wait for T4 to be queued, so we are sure it has -# received the debug_sync signal (else we might overwrite it with the -# next debug_sync). -SET debug_sync='now SIGNAL d2_cont'; -SET debug_sync='now WAIT_FOR t4_waiting'; - -# Now we kill the waiting transaction T3 in worker D1. ---replace_result $d1_thd_id THD_ID -eval KILL $d1_thd_id; - -# Wait until T3 has reacted on the kill. -SET debug_sync='now WAIT_FOR t3_killed'; - -# Now we can allow T1 to proceed. -SET debug_sync='now SIGNAL t1_cont'; - ---let $slave_sql_errno= 1317,1927,1964 ---source include/wait_for_slave_sql_error.inc -STOP SLAVE IO_THREAD; -# Since T2, T3, and T4 run in parallel, we can not be sure if T2 will have time -# to commit or not before the stop. However, T1 should commit, and T3/T4 may -# not have committed. (After slave restart we check that all become committed -# eventually). -SELECT * FROM t3 WHERE a >= 60 AND a != 65 ORDER BY a; - -# Now we have to disable the debug_sync statements, so they do not trigger -# when the events are retried. -SET debug_sync='RESET'; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_1 -UPDATE t3 SET b=b+1 WHERE a=60; ---save_master_pos - ---connection server_2 ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t3 WHERE a >= 60 ORDER BY a; -# Restore the foo() function. -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_2 -# Respawn all worker threads to clear any left-over debug_sync or other stuff. ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - ---echo *** 5. Test killing thread that is waiting for queue of max length to shorten *** - -# Find the thread id of the driver SQL thread that we want to kill. ---let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Slave has read all relay log%' ---source include/wait_condition.inc ---let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Slave has read all relay log%'` -SET @old_max_queued= @@GLOBAL.slave_parallel_max_queued; -SET GLOBAL slave_parallel_max_queued=9000; - ---connection server_1 ---let bigstring= `SELECT REPEAT('x', 10000)` -# Create an event that will wait to be signalled. -INSERT INTO t3 VALUES (80, foo(0, - 'ha_write_row_end SIGNAL query_waiting WAIT_FOR query_cont', '')); - ---connection server_2 -SET debug_sync='now WAIT_FOR query_waiting'; -# Inject that the SQL driver thread will signal `wait_queue_ready' to debug_sync -# as it goes to wait for the event queue to become smaller than the value of -# @@slave_parallel_max_queued. -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,rpl_parallel_wait_queue_max"; - ---connection server_1 ---disable_query_log -# Create an event that will fill up the queue. -# The Xid event at the end of the event group will have to wait for the Query -# event with the INSERT to drain so the queue becomes shorter. However that in -# turn waits for the prior event group to continue. -eval INSERT INTO t3 VALUES (81, LENGTH('$bigstring')); ---enable_query_log -SELECT * FROM t3 WHERE a >= 80 ORDER BY a; - ---connection server_2 -SET debug_sync='now WAIT_FOR wait_queue_ready'; - ---replace_result $thd_id THD_ID -eval KILL $thd_id; - -SET debug_sync='now WAIT_FOR wait_queue_killed'; -SET debug_sync='now SIGNAL query_cont'; - ---let $slave_sql_errno= 1317,1927,1964 ---source include/wait_for_slave_sql_error.inc -STOP SLAVE IO_THREAD; - -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL slave_parallel_max_queued= @old_max_queued; - ---connection server_1 -INSERT INTO t3 VALUES (82,0); ---save_master_pos - ---connection server_2 -SET debug_sync='RESET'; ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t3 WHERE a >= 80 ORDER BY a; - ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_mode=@old_parallel_mode; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 -DROP function foo; -DROP TABLE t3; -SET DEBUG_SYNC= 'RESET'; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_gtid_slave_pos_update_fail.inc b/mysql-test/suite/rpl/include/rpl_parallel_gtid_slave_pos_update_fail.inc deleted file mode 100644 index da1a07d3b875c..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_gtid_slave_pos_update_fail.inc +++ /dev/null @@ -1,98 +0,0 @@ -# MDEV-6549, failing to update gtid_slave_pos for a transaction that was retried. - -# The problem was that when a transaction updates the mysql.gtid_slave_pos -# table, it clears the flag that marks that there is a GTID position that -# needs to be updated. Then, if the transaction got killed after that due -# to a deadlock, the subsequent retry would fail to notice that the GTID needs -# to be recorded in gtid_slave_pos. -# -# (In the original bug report, the symptom was an assertion; this was however -# just a side effect of the missing update of gtid_slave_pos, which also -# happened to cause a missing clear of OPTION_GTID_BEGIN). ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc -# Must use statement-based binlogging. Otherwise the transaction will not be -# binlogged at all, as it modifies no rows. ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; -INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); ---connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc - -# Create two transactions that can run in parallel on the slave but cause -# a deadlock if the second runs before the first. ---connection con1 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send UPDATE t4 SET b=NULL WHERE a=6; ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con2 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send DELETE FROM t4 WHERE b <= 1; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con1 -REAP; ---connection con2 -REAP; -SET debug_sync='RESET'; ---save_master_pos ---let $last_gtid= `SELECT @@last_gtid` - ---connection server_2 -# Disable the usual skip of gap locks for transactions that are run in -# parallel, using DBUG. This allows the deadlock to occur, and this in turn -# triggers a retry of the second transaction, and the code that was buggy and -# caused the gtid_slave_pos update to be skipped in the retry. -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,disable_thd_need_ordering_with"; ---source include/start_slave.inc ---sync_with_master -SET GLOBAL debug_dbug=@old_dbug; - -SELECT * FROM t4 ORDER BY a; -# Check that the GTID of the second transaction was correctly recorded in -# gtid_slave_pos, in the variable as well as in the table. ---replace_result $last_gtid GTID -eval SET @last_gtid= '$last_gtid'; -SELECT IF(@@gtid_slave_pos LIKE CONCAT('%',@last_gtid,'%'), "GTID found ok", - CONCAT("GTID ", @last_gtid, " not found in gtid_slave_pos=", @@gtid_slave_pos)) - AS result; -SELECT "ROW FOUND" AS `Is the row found?` - FROM mysql.gtid_slave_pos - WHERE CONCAT(domain_id, "-", server_id, "-", seq_no) = @last_gtid; - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 -DROP TABLE t4; -SET DEBUG_SYNC= 'RESET'; ---disconnect con1 ---disconnect con2 ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_ignore_error_on_rotate.inc b/mysql-test/suite/rpl/include/rpl_parallel_ignore_error_on_rotate.inc deleted file mode 100644 index 2fab9f8032bf7..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_ignore_error_on_rotate.inc +++ /dev/null @@ -1,96 +0,0 @@ ---echo *** MDEV-6551: Some replication errors are ignored if slave_parallel_threads > 0 *** - ---source include/have_innodb.inc ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc - ---connection server_2 ---source include/stop_slave.inc -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; -SET GLOBAL slave_parallel_threads=1; -CHANGE MASTER TO master_use_gtid=slave_pos; -CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; -SET gtid_domain_id=1; -INSERT INTO t2 VALUES (1); -SET gtid_domain_id=0; -SET gtid_domain_id=2; -INSERT INTO t2 VALUES (2); -SET gtid_domain_id=0; -INSERT INTO t2 VALUES (31); ---let $gtid1= `SELECT @@LAST_GTID` ---source include/save_master_gtid.inc - ---connection server_2 ---source include/sync_with_master_gtid.inc ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads= 0; ---source include/start_slave.inc - -# Force a duplicate key error on the slave. -SET sql_log_bin= 0; -INSERT INTO t2 VALUES (32); -SET sql_log_bin= 1; - ---connection server_1 -INSERT INTO t2 VALUES (32); ---let $gtid2= `SELECT @@LAST_GTID` -# Rotate the binlog; the bug is triggered when the master binlog file changes -# after the event group that causes the duplicate key error. -FLUSH LOGS; -INSERT INTO t2 VALUES (33); -INSERT INTO t2 VALUES (34); -SELECT * FROM t2 WHERE a >= 30 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---let $slave_sql_errno= 1062 ---source include/wait_for_slave_sql_error.inc - ---connection server_2 ---source include/stop_slave_io.inc -SET GLOBAL slave_parallel_threads=10; -START SLAVE; - ---let $slave_sql_errno= 1062 ---source include/wait_for_slave_sql_error.inc - -# Note: IO thread is still running at this point. -# The bug seems to have been that restarting the SQL thread after an error with -# the IO thread still running, somehow picks up a later relay log position and -# thus ends up skipping the failing event, rather than re-executing. - -START SLAVE SQL_THREAD; ---let $slave_sql_errno= 1062 ---source include/wait_for_slave_sql_error.inc - -SELECT * FROM t2 WHERE a >= 30 ORDER BY a; - -# Skip the duplicate error, so we can proceed. ---error ER_SLAVE_SKIP_NOT_IN_GTID -SET sql_slave_skip_counter= 1; ---source include/stop_slave_io.inc ---disable_query_log -eval SET GLOBAL gtid_slave_pos = REPLACE(@@gtid_slave_pos, "$gtid1", "$gtid2"); ---enable_query_log ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -SELECT * FROM t2 WHERE a >= 30 ORDER BY a; - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; -SET GLOBAL slave_parallel_mode=@old_parallel_mode; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t2; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc b/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc deleted file mode 100644 index 493385f1ae304..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc +++ /dev/null @@ -1,115 +0,0 @@ -# ==== Purpose ==== -# -# Test verifies that, in parallel replication, transaction failure notification -# is propagated to all the workers. Workers should abort the execution of -# transaction event groups, whose event positions are higher than the failing -# transaction group. -# -# ==== Implementation ==== -# -# Steps: -# 0 - Create a table t1 on master which has a primary key. Enable parallel -# replication on slave with slave_parallel_mode='optimistic' and -# slave_parallel_threads=3. -# 1 - On slave start a transaction and execute a local INSERT statement -# which will insert value 32. This is done to block the INSERT coming -# from master. -# 2 - On master execute an INSERT statement with value 32, so that it is -# blocked on slave. -# 3 - On slave enable a debug sync point such that it holds the worker thread -# execution as soon as work is scheduled to it. -# 4 - INSERT value 33 on master. It will be held on slave by other worker -# thread due to debug simulation. -# 5 - INSERT value 34 on master. -# 6 - On slave, enusre that INSERT 34 has reached a state where it waits for -# its prior transactions to commit. -# 7 - Commit the local INSERT 32 on slave server so that first worker will -# error out. -# 8 - Now send a continue signal to second worker processing 33. It should -# wakeup and propagate the error to INSERT 34. -# 9 - Upon slave stop due to error, check that no rows are found after the -# failed INSERT 32. -# -# ==== References ==== -# -# MDEV-20645: Replication consistency is broken as workers miss the error -# notification from an earlier failed group. -# - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc - ---enable_connect_log ---connection server_2 ---source include/stop_slave.inc -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; -SET @old_debug= @@GLOBAL.debug_dbug; -SET GLOBAL slave_parallel_mode='optimistic'; -SET GLOBAL slave_parallel_threads= 3; -CHANGE MASTER TO master_use_gtid=slave_pos; -CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=InnoDB; -# MDEV-515 takes X-lock on the table for the first insert. -# So concurrent insert won't happen on the table -INSERT INTO t1 VALUES(1); ---source include/save_master_gtid.inc - ---connection server_2 ---source include/sync_with_master_gtid.inc - ---connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -BEGIN; -INSERT INTO t1 VALUES (32); - ---connection server_1 -INSERT INTO t1 VALUES (32); - ---connection server_2 ---let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE info like "INSERT INTO t1 VALUES (32)" ---source include/wait_condition.inc -SET GLOBAL debug_dbug="+d,hold_worker_on_schedule"; -SET debug_sync="debug_sync_action SIGNAL reached_pause WAIT_FOR continue_worker"; - ---connection server_1 -SET gtid_seq_no=100; -INSERT INTO t1 VALUES (33); - ---connection server_2 -SET debug_sync='now WAIT_FOR reached_pause'; - ---connection server_1 -INSERT INTO t1 VALUES (34); - ---connection server_2 ---let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state like "Waiting for prior transaction to commit" ---source include/wait_condition.inc ---connection con_temp2 -COMMIT; - -# Clean up. ---connection server_2 ---source include/stop_slave.inc ---let $assert_cond= COUNT(*) = 0 FROM t1 WHERE a>32 ---let $assert_text= table t1 should have zero rows where a>32 ---source include/assert.inc -SELECT * FROM t1 WHERE a>32; -DELETE FROM t1 WHERE a=32; - -SET GLOBAL slave_parallel_threads=@old_parallel_threads; -SET GLOBAL slave_parallel_mode=@old_parallel_mode; -SET GLOBAL debug_dbug=@old_debug; -SET DEBUG_SYNC= 'RESET'; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t1; ---disable_connect_log ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_innodb_lock_conflict.inc b/mysql-test/suite/rpl/include/rpl_parallel_innodb_lock_conflict.inc deleted file mode 100644 index 90304937445e6..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_innodb_lock_conflict.inc +++ /dev/null @@ -1,107 +0,0 @@ ---echo ***MDEV-5914: Parallel replication deadlock due to InnoDB lock conflicts *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection server_2 -SET sql_log_bin=0; -CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); -SET sql_log_bin=1; -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; -INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); ---connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) - -# Create a group commit with UPDATE and DELETE, in that order. -# The bug was that while the UPDATE's row lock does not block the DELETE, the -# DELETE's gap lock _does_ block the UPDATE. This could cause a deadlock -# on the slave. ---connection con1 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send UPDATE t4 SET b=NULL WHERE a=6; ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con2 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send DELETE FROM t4 WHERE b <= 3; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con1 -REAP; ---connection con2 -REAP; -SET debug_sync='RESET'; ---save_master_pos - ---connection server_2 ---source include/start_slave.inc ---sync_with_master ---source include/stop_slave.inc - -SELECT * FROM t4 ORDER BY a; - - -# Another example, this one with INSERT vs. DELETE ---connection server_1 -DELETE FROM t4; -INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); - -# Create a group commit with INSERT and DELETE, in that order. -# The bug was that while the INSERT's insert intention lock does not block -# the DELETE, the DELETE's gap lock _does_ block the INSERT. This could cause -# a deadlock on the slave. ---connection con1 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send INSERT INTO t4 VALUES (7, NULL); ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con2 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send DELETE FROM t4 WHERE b <= 3; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con1 -REAP; ---connection con2 -REAP; -SET debug_sync='RESET'; ---save_master_pos - ---connection server_2 ---source include/start_slave.inc ---sync_with_master ---source include/stop_slave.inc - -SELECT * FROM t4 ORDER BY a; - - -# Clean up. ---connection server_2 -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 ---disconnect con1 ---disconnect con2 -DROP TABLE t4; -SET DEBUG_SYNC= 'RESET'; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_missed_error_handling.inc b/mysql-test/suite/rpl/include/rpl_parallel_missed_error_handling.inc deleted file mode 100644 index 33b1bcb11d949..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_missed_error_handling.inc +++ /dev/null @@ -1,87 +0,0 @@ ---echo *** MDEV-5921: In parallel replication, an error is not correctly signalled to the next transaction *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection server_2 ---source include/stop_slave.inc -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; -CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master - ---connection server_1 -INSERT INTO t3 VALUES (110, 1); ---save_master_pos - ---connection server_2 ---sync_with_master -SELECT * FROM t3 WHERE a >= 110 ORDER BY a; -# Inject a duplicate key error. -SET sql_log_bin=0; -INSERT INTO t3 VALUES (111, 666); -SET sql_log_bin=1; - ---connection server_1 - -# Create a group commit with two inserts, the first one conflicts with a row on the slave ---connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send INSERT INTO t3 VALUES (111, 2); ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send INSERT INTO t3 VALUES (112, 3); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con1 -REAP; ---connection con2 -REAP; -SET debug_sync='RESET'; ---save_master_pos - ---connection server_2 ---let $slave_sql_errno= 1062 ---source include/wait_for_slave_sql_error.inc ---source include/wait_for_slave_sql_to_stop.inc -# We should not see the row (112,3) here, it should be rolled back due to -# error signal from the prior transaction. -SELECT * FROM t3 WHERE a >= 110 ORDER BY a; -SET sql_log_bin=0; -DELETE FROM t3 WHERE a=111 AND b=666; -SET sql_log_bin=1; -START SLAVE SQL_THREAD; ---sync_with_master -SELECT * FROM t3 WHERE a >= 110 ORDER BY a; - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 ---disconnect con1 ---disconnect con2 -DROP TABLE t3; -SET DEBUG_SYNC= 'RESET'; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_mode.inc b/mysql-test/suite/rpl/include/rpl_parallel_mode.inc deleted file mode 100644 index 67104069e9aca..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_mode.inc +++ /dev/null @@ -1,87 +0,0 @@ ---echo *** MDEV-6676 - test syntax of @@slave_parallel_mode *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/master-slave.inc - ---connection server_2 ---source include/stop_slave.inc -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master - ---let $status_items= Parallel_Mode ---source include/show_slave_status.inc ---source include/stop_slave.inc -SET GLOBAL slave_parallel_mode='aggressive'; ---let $status_items= Parallel_Mode ---source include/show_slave_status.inc -SET GLOBAL slave_parallel_mode='conservative'; ---let $status_items= Parallel_Mode ---source include/show_slave_status.inc - ---echo *** MDEV-6676 - test that empty parallel_mode does not replicate in parallel *** ---connection server_1 -INSERT INTO t2 VALUES (1040); ---source include/save_master_gtid.inc - ---connection server_2 -SET GLOBAL slave_parallel_mode='none'; -# Test that we do not use parallel apply, by injecting an unconditional -# crash in the parallel apply code. -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,slave_crash_if_parallel_apply"; ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc -SELECT * FROM t2 WHERE a >= 1040 ORDER BY a; ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; - - ---echo *** MDEV-6676 - test disabling domain-based parallel replication *** ---connection server_1 -# Let's do a bunch of transactions that will conflict if run out-of-order in -# domain-based parallel replication mode. -SET gtid_domain_id = 1; -INSERT INTO t2 VALUES (1041); -INSERT INTO t2 VALUES (1042); -INSERT INTO t2 VALUES (1043); -INSERT INTO t2 VALUES (1044); -INSERT INTO t2 VALUES (1045); -INSERT INTO t2 VALUES (1046); -DELETE FROM t2 WHERE a >= 1041; -SET gtid_domain_id = 2; -INSERT INTO t2 VALUES (1041); -INSERT INTO t2 VALUES (1042); -INSERT INTO t2 VALUES (1043); -INSERT INTO t2 VALUES (1044); -INSERT INTO t2 VALUES (1045); -INSERT INTO t2 VALUES (1046); -SET gtid_domain_id = 0; ---source include/save_master_gtid.inc ---connection server_2 -SET GLOBAL slave_parallel_mode=minimal; ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc -SELECT * FROM t2 WHERE a >= 1040 ORDER BY a; - -# Cleanup ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; -SET GLOBAL slave_parallel_mode=@old_parallel_mode; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t2; ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_partial_binlog_trans.inc b/mysql-test/suite/rpl/include/rpl_parallel_partial_binlog_trans.inc deleted file mode 100644 index 7247925285fdd..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_partial_binlog_trans.inc +++ /dev/null @@ -1,71 +0,0 @@ ---echo *** MDEV_6435: Incorrect error handling when query binlogged partially on master with "killed" error *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc - ---connection server_2 ---source include/stop_slave.inc -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET GLOBAL slave_parallel_threads=1; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t6 (a INT) ENGINE=MyISAM; -CREATE TRIGGER tr AFTER INSERT ON t6 FOR EACH ROW SET @a = 1; ---connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) - ---connection con1 ---let $conid = `SELECT CONNECTION_ID()` -SET debug_sync='sp_head_execute_before_loop SIGNAL ready WAIT_FOR cont'; -send INSERT INTO t6 VALUES (1), (2), (3); - ---connection server_1 -SET debug_sync='now WAIT_FOR ready'; ---replace_result $conid CONID -eval KILL QUERY $conid; -SET debug_sync='now SIGNAL cont'; - ---connection con1 ---error ER_QUERY_INTERRUPTED ---reap -SET debug_sync='RESET'; ---let $after_error_gtid_pos= `SELECT @@gtid_binlog_pos` - ---connection server_1 -SET debug_sync='RESET'; - ---connection server_2 ---let $slave_sql_errno= 1317 ---source include/wait_for_slave_sql_error.inc -STOP SLAVE IO_THREAD; ---replace_result $after_error_gtid_pos AFTER_ERROR_GTID_POS -eval SET GLOBAL gtid_slave_pos= '$after_error_gtid_pos'; ---source include/start_slave.inc - ---connection server_1 -INSERT INTO t6 VALUES (4); -SELECT * FROM t6 ORDER BY a; ---save_master_pos - ---connection server_2 ---sync_with_master -SELECT * FROM t6 ORDER BY a; - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 -DROP TABLE t6; -SET DEBUG_SYNC= 'RESET'; ---disconnect con1 - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_record_gtid_wakeup.inc b/mysql-test/suite/rpl/include/rpl_parallel_record_gtid_wakeup.inc deleted file mode 100644 index 0f94d8f9943ab..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_record_gtid_wakeup.inc +++ /dev/null @@ -1,72 +0,0 @@ ---echo *** MDEV-7929: record_gtid() for non-transactional event group calls wakeup_subsequent_commits() too early, causing slave hang. *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug= '+d,inject_record_gtid_serverid_100_sleep'; - ---connection server_1 -# Inject two group commits. The bug was that record_gtid for a -# non-transactional event group would commit its own transaction, which would -# cause ha_commit_trans() to call wakeup_subsequent_commits() too early. This -# in turn lead to access to freed group_commit_orderer object, losing a wakeup -# and causing slave threads to hang. -# We inject a small sleep in the corresponding record_gtid() to make the race -# easier to hit. - -SET @old_dbug= @@SESSION.debug_dbug; -SET SESSION debug_dbug="+d,binlog_force_commit_id"; - -# Group commit with cid=10010, two event groups. -SET @old_server_id= @@SESSION.server_id; -SET SESSION server_id= 100; -SET @commit_id= 10010; -ALTER TABLE t1 COMMENT "Hulubulu!"; -SET SESSION server_id= @old_server_id; -INSERT INTO t3 VALUES (130, 0); - -# Group commit with cid=10011, one event group. -SET @commit_id= 10011; -INSERT INTO t3 VALUES (131, 0); - -SET SESSION debug_dbug=@old_dbug; - -SELECT * FROM t3 WHERE a >= 130 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -SELECT * FROM t3 WHERE a >= 130 ORDER BY a; - -# Clean up. ---source include/stop_slave.inc -SET GLOBAL debug_dbug= @old_dbug; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t1,t3; - ---source include/rpl_end.inc - diff --git a/mysql-test/suite/rpl/include/rpl_parallel_retry_deadlock.inc b/mysql-test/suite/rpl/include/rpl_parallel_retry_deadlock.inc deleted file mode 100644 index 54ac859bb33b1..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_retry_deadlock.inc +++ /dev/null @@ -1,281 +0,0 @@ ---echo *** MDEV-7326 Server deadlock in connection with parallel replication *** ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; ---source include/stop_slave.inc -# Test assumes that 'conservative' mode is in effect. i.e -# Do not start parallel execution of this event group until all prior groups -# have reached the commit phase. Refer 'rpl_parallel_start_waiting_for_prior' -# debug simumation. -SET GLOBAL slave_parallel_mode='conservative'; -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; -CREATE TABLE t6 (a INT) ENGINE=MyISAM; ---save_master_pos - ---connection server_2 ---sync_with_master - ---connection server_1 -# Use a stored function to inject a debug_sync into the appropriate THD. -# The function does nothing on the master, and on the slave it injects the -# desired debug_sync action(s). -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_2 -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - -# We use three transactions, each in a separate group commit. -# T1 does mark_start_commit(), then gets a deadlock error. -# T2 wakes up and starts running -# T1 does unmark_start_commit() -# T3 goes to wait for T2 to start its commit -# T2 does mark_start_commit() -# The bug was that at this point, T3 got deadlocked. Because T1 has unmarked(), -# T3 did not yet see the count_committing_event_groups reach its target value -# yet. But when T1 later re-did mark_start_commit(), it failed to send a wakeup -# to T3. - ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=3; -SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; ---source include/start_slave.inc - ---connection server_1 -SET @old_format= @@SESSION.binlog_format; -SET binlog_format= STATEMENT; -# This debug_sync will linger on and be used to control T3 later. -INSERT INTO t1 VALUES (foo(50, - "rpl_parallel_start_waiting_for_prior SIGNAL t3_ready", - "rpl_parallel_end_of_group SIGNAL prep_ready WAIT_FOR prep_cont")); ---save_master_pos ---connection server_2 -# Wait for the debug_sync point for T3 to be set. But let the preparation -# transaction remain hanging, so that T1 and T2 will be scheduled for the -# remaining two worker threads. -SET DEBUG_SYNC= "now WAIT_FOR prep_ready"; - ---connection server_1 -INSERT INTO t2 VALUES (foo(50, - "rpl_parallel_simulate_temp_err_xid SIGNAL t1_ready1 WAIT_FOR t1_cont1", - "rpl_parallel_retry_after_unmark SIGNAL t1_ready2 WAIT_FOR t1_cont2")); ---save_master_pos - ---connection server_2 -SET DEBUG_SYNC= "now WAIT_FOR t1_ready1"; -# T1 has now done mark_start_commit(). It will later do a rollback and retry. - ---connection server_1 -# Use a MyISAM table for T2 and T3, so they do not trigger the -# rpl_parallel_simulate_temp_err_xid DBUG insertion on XID event. -INSERT INTO t1 VALUES (foo(51, - "rpl_parallel_before_mark_start_commit SIGNAL t2_ready1 WAIT_FOR t2_cont1", - "rpl_parallel_after_mark_start_commit SIGNAL t2_ready2")); - ---connection server_2 -SET DEBUG_SYNC= "now WAIT_FOR t2_ready1"; -# T2 has now started running, but has not yet done mark_start_commit() -SET DEBUG_SYNC= "now SIGNAL t1_cont1"; -SET DEBUG_SYNC= "now WAIT_FOR t1_ready2"; -# T1 has now done unmark_start_commit() in preparation for its retry. - ---connection server_1 -INSERT INTO t1 VALUES (52); -SET BINLOG_FORMAT= @old_format; -SELECT * FROM t2 WHERE a>=50 ORDER BY a; -SELECT * FROM t1 WHERE a>=50 ORDER BY a; - ---connection server_2 -# Let the preparation transaction complete, so that the same worker thread -# can continue with the transaction T3. -SET DEBUG_SYNC= "now SIGNAL prep_cont"; -SET DEBUG_SYNC= "now WAIT_FOR t3_ready"; -# T3 has now gone to wait for T2 to start committing -SET DEBUG_SYNC= "now SIGNAL t2_cont1"; -SET DEBUG_SYNC= "now WAIT_FOR t2_ready2"; -# T2 has now done mark_start_commit(). -# Let things run, and check that T3 does not get deadlocked. -SET DEBUG_SYNC= "now SIGNAL t1_cont2"; ---sync_with_master - ---connection server_1 ---save_master_pos ---connection server_2 ---sync_with_master -SELECT * FROM t2 WHERE a>=50 ORDER BY a; -SELECT * FROM t1 WHERE a>=50 ORDER BY a; -SET DEBUG_SYNC="reset"; - -# Re-spawn the worker threads to remove any DBUG injections or DEBUG_SYNC. ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL slave_parallel_mode=@old_parallel_mode; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - - ---echo *** MDEV-7326 Server deadlock in connection with parallel replication *** -# Similar to the previous test, but with T2 and T3 in the same GCO. -# We use three transactions, T1 in one group commit and T2/T3 in another. -# T1 does mark_start_commit(), then gets a deadlock error. -# T2 wakes up and starts running -# T1 does unmark_start_commit() -# T3 goes to wait for T1 to start its commit -# T2 does mark_start_commit() -# The bug was that at this point, T3 got deadlocked. T2 increments the -# count_committing_event_groups but does not signal T3, as they are in -# the same GCO. Then later when T1 increments, it would also not signal -# T3, because now the count_committing_event_groups is not equal to the -# wait_count of T3 (it is one larger). - ---connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) - ---connection server_2 ---source include/stop_slave.inc -SET @old_parallel_mode= @@GLOBAL.slave_parallel_mode; -SET GLOBAL slave_parallel_mode='conservative'; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=3; -SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; ---source include/start_slave.inc - ---connection server_1 -SET @old_format= @@SESSION.binlog_format; -SET binlog_format= STATEMENT; -# This debug_sync will linger on and be used to control T3 later. -INSERT INTO t1 VALUES (foo(60, - "rpl_parallel_start_waiting_for_prior SIGNAL t3_ready", - "rpl_parallel_end_of_group SIGNAL prep_ready WAIT_FOR prep_cont")); ---save_master_pos ---connection server_2 -# Wait for the debug_sync point for T3 to be set. But let the preparation -# transaction remain hanging, so that T1 and T2 will be scheduled for the -# remaining two worker threads. -SET DEBUG_SYNC= "now WAIT_FOR prep_ready"; - ---connection server_1 -INSERT INTO t2 VALUES (foo(60, - "rpl_parallel_simulate_temp_err_xid SIGNAL t1_ready1 WAIT_FOR t1_cont1", - "rpl_parallel_retry_after_unmark SIGNAL t1_ready2 WAIT_FOR t1_cont2")); ---save_master_pos - ---connection server_2 -SET DEBUG_SYNC= "now WAIT_FOR t1_ready1"; -# T1 has now done mark_start_commit(). It will later do a rollback and retry. - -# Do T2 and T3 in a single group commit. -# Use a MyISAM table for T2 and T3, so they do not trigger the -# rpl_parallel_simulate_temp_err_xid DBUG insertion on XID event. ---connection con_temp3 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -SET binlog_format=statement; -send INSERT INTO t1 VALUES (foo(61, - "rpl_parallel_before_mark_start_commit SIGNAL t2_ready1 WAIT_FOR t2_cont1", - "rpl_parallel_after_mark_start_commit SIGNAL t2_ready2")); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con_temp4 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send INSERT INTO t6 VALUES (62); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; - ---connection server_1 -SET debug_sync='RESET'; -SET BINLOG_FORMAT= @old_format; -SELECT * FROM t2 WHERE a>=60 ORDER BY a; -SELECT * FROM t1 WHERE a>=60 ORDER BY a; -SELECT * FROM t6 WHERE a>=60 ORDER BY a; - ---connection server_2 -SET DEBUG_SYNC= "now WAIT_FOR t2_ready1"; -# T2 has now started running, but has not yet done mark_start_commit() -SET DEBUG_SYNC= "now SIGNAL t1_cont1"; -SET DEBUG_SYNC= "now WAIT_FOR t1_ready2"; -# T1 has now done unmark_start_commit() in preparation for its retry. - ---connection server_2 -# Let the preparation transaction complete, so that the same worker thread -# can continue with the transaction T3. -SET DEBUG_SYNC= "now SIGNAL prep_cont"; -SET DEBUG_SYNC= "now WAIT_FOR t3_ready"; -# T3 has now gone to wait for T2 to start committing -SET DEBUG_SYNC= "now SIGNAL t2_cont1"; -SET DEBUG_SYNC= "now WAIT_FOR t2_ready2"; -# T2 has now done mark_start_commit(). -# Let things run, and check that T3 does not get deadlocked. -SET DEBUG_SYNC= "now SIGNAL t1_cont2"; ---sync_with_master - ---connection server_1 ---save_master_pos ---connection server_2 ---sync_with_master -SELECT * FROM t2 WHERE a>=60 ORDER BY a; -SELECT * FROM t1 WHERE a>=60 ORDER BY a; -SELECT * FROM t6 WHERE a>=60 ORDER BY a; -SET DEBUG_SYNC="reset"; - -# Clean up. ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL slave_parallel_mode=@old_parallel_mode; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc - ---connection server_1 -DROP function foo; -DROP TABLE t1,t2,t6; ---disconnect con_temp3 ---disconnect con_temp4 -SET DEBUG_SYNC= 'RESET'; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_rollback_assert.inc b/mysql-test/suite/rpl/include/rpl_parallel_rollback_assert.inc deleted file mode 100644 index eec331b3d6436..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_rollback_assert.inc +++ /dev/null @@ -1,62 +0,0 @@ ---echo *** MDEV-8725: Assertion on ROLLBACK statement in the binary log *** ---source include/have_innodb.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master - ---connection server_1 -# Inject an event group terminated by ROLLBACK, by mixing MyISAM and InnoDB -# in a transaction. The bug was an assertion on the ROLLBACK due to -# mark_start_commit() being already called. ---disable_warnings -BEGIN; -INSERT INTO t2 VALUES (2000); -INSERT INTO t1 VALUES (2000); -INSERT INTO t2 VALUES (2001); -ROLLBACK; ---enable_warnings -SELECT * FROM t1 WHERE a>=2000 ORDER BY a; -SELECT * FROM t2 WHERE a>=2000 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---source include/sync_with_master_gtid.inc - ---connection server_1 -INSERT INTO t2 VALUES (2020); ---source include/save_master_gtid.inc - ---connection server_2 ---source include/sync_with_master_gtid.inc -SELECT * FROM t2 WHERE a>=2000 ORDER BY a; -let $rows_in_t1= `SELECT COUNT(*) FROM t1 WHERE a>=2000 ORDER BY a`; -if ($rows_in_t1 == 0) -{ ---query_vertical SHOW SLAVE STATUS -} -SELECT * FROM t1 WHERE a>=2000 ORDER BY a; - -# Clean up. ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t1,t2; - ---source include/rpl_end.inc - diff --git a/mysql-test/suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc b/mysql-test/suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc deleted file mode 100644 index cddc9286bd28d..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc +++ /dev/null @@ -1,38 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - -# BUG#13979418: SHOW BINLOG EVENTS MAY CRASH THE SERVER -# -# The function mysql_show_binlog_events has a local stack variable -# 'LOG_INFO linfo;', which is assigned to thd->current_linfo, however -# this variable goes out of scope and is destroyed before clean -# thd->current_linfo. -# -# This test case runs SHOW BINLOG EVENTS and FLUSH LOGS to make sure -# that with the fix local variable linfo is valid along all -# mysql_show_binlog_events function scope. -# ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection slave -SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR end'; ---send SHOW BINLOG EVENTS - ---connection slave1 -SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events'; -FLUSH LOGS; -SET DEBUG_SYNC= 'now SIGNAL end'; - ---connection slave ---disable_result_log ---reap ---enable_result_log -SET DEBUG_SYNC= 'RESET'; - ---connection master ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_single_grpcmt.inc b/mysql-test/suite/rpl/include/rpl_parallel_single_grpcmt.inc deleted file mode 100644 index cf4c547b73b45..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_single_grpcmt.inc +++ /dev/null @@ -1,170 +0,0 @@ ---echo *** Test that group-committed transactions on the master can replicate in parallel on the slave. *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc - -# Test various aspects of parallel replication. - ---connection server_1 -# The function does nothing on the master, and on the slave it injects the -# desired debug_sync action(s). -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_2 ---source include/stop_slave.inc -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - -# We need to restart all parallel threads for the new global setting to -# be copied to the session-level values. -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; -# Create some sentinel rows so that the rows inserted in parallel fall into -# separate gaps and do not cause gap lock conflicts. -INSERT INTO t3 VALUES (1,1), (3,3), (5,5), (7,7); ---save_master_pos ---connection server_2 ---sync_with_master - - -# We want to test that the transactions can execute out-of-order on -# the slave, but still end up committing in-order, and in a single -# group commit. -# -# The idea is to group-commit three transactions together on the master: -# A, B, and C. On the slave, C will execute the insert first, then A, -# and then B. But B manages to complete before A has time to commit, so -# all three end up committing together. -# -# So we start by setting up some row locks that will block transactions -# A and B from executing, allowing C to run first. - ---connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -BEGIN; -INSERT INTO t3 VALUES (2,102); ---connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -BEGIN; -INSERT INTO t3 VALUES (4,104); - -# On the master, queue three INSERT transactions as a single group commit. ---connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -SET binlog_format=statement; -send INSERT INTO t3 VALUES (2, foo(12, - 'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued1 WAIT_FOR slave_cont1', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -SET binlog_format=statement; -send INSERT INTO t3 VALUES (4, foo(14, - 'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued2', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; - ---connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; -SET binlog_format=statement; -send INSERT INTO t3 VALUES (6, foo(16, - 'group_commit_waiting_for_prior SIGNAL slave_queued3', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued3'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; ---connection con_temp5 -REAP; -SET debug_sync='RESET'; - ---connection server_1 -SELECT * FROM t3 ORDER BY a; ---let $binlog_file= master-bin.000001 ---source include/show_binlog_events.inc - -# First, wait until insert 3 is ready to queue up for group commit, but is -# waiting for insert 2 to commit before it can do so itself. ---connection server_2 -SET debug_sync='now WAIT_FOR slave_queued3'; - -# Next, let insert 1 proceed, and allow it to queue up as the group commit -# leader, but let it wait for insert 2 to also queue up before proceeding. ---connection con_temp1 -ROLLBACK; ---connection server_2 -SET debug_sync='now WAIT_FOR slave_queued1'; - -# Now let insert 2 proceed and queue up. ---connection con_temp2 -ROLLBACK; ---connection server_2 -SET debug_sync='now WAIT_FOR slave_queued2'; -# And finally, we can let insert 1 proceed and do the group commit with all -# three insert transactions together. -SET debug_sync='now SIGNAL slave_cont1'; - -# Wait for the commit to complete and check that all three transactions -# group-committed together (will be seen in the binlog as all three having -# cid=# on their GTID event). ---let $wait_condition= SELECT COUNT(*) = 3 FROM t3 WHERE a IN (2,4,6) ---source include/wait_condition.inc -SELECT * FROM t3 ORDER BY a; ---let $binlog_file= slave-bin.000001 ---source include/show_binlog_events.inc - - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 -DROP function foo; -DROP TABLE t3; -SET DEBUG_SYNC= 'RESET'; - ---disable_connect_log ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_slave_bgc_kill.inc b/mysql-test/suite/rpl/include/rpl_parallel_slave_bgc_kill.inc deleted file mode 100644 index efb998b044343..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_slave_bgc_kill.inc +++ /dev/null @@ -1,458 +0,0 @@ ---echo *** Test killing slave threads at various wait points *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc - -# Test various aspects of parallel replication. - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -SET GLOBAL slave_parallel_mode='conservative'; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 ---connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; -# MDEV-515 takes X-lock on the table for the first insert. -# So concurrent insert won't happen on the table -INSERT INTO t2 VALUES(100); -INSERT INTO t3 VALUES(100, 100); ---save_master_pos - ---connection server_2 ---sync_with_master - ---connection server_1 -# Use a stored function to inject a debug_sync into the appropriate THD. -# The function does nothing on the master, and on the slave it injects the -# desired debug_sync action(s). -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_2 -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---echo *** 1. Test killing transaction waiting in commit for previous transaction to commit *** - -# Set up three transactions on the master that will be group-committed -# together so they can be replicated in parallel on the slave. ---connection con_temp3 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send INSERT INTO t3 VALUES (31, foo(31, - 'commit_before_prepare_ordered WAIT_FOR t2_waiting', - 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con_temp4 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -BEGIN; -# This insert is just so we can get T2 to wait while a query is running that we -# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. -INSERT INTO t3 VALUES (32, foo(32, - 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', - '')); -# This insert sets up debug_sync points so that T2 will tell when it is at its -# wait point where we want to kill it - and when it has been killed. -INSERT INTO t3 VALUES (33, foo(33, - 'group_commit_waiting_for_prior SIGNAL t2_waiting', - 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); -send COMMIT; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; - ---connection con_temp5 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; -send INSERT INTO t3 VALUES (34, foo(34, - '', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued3'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; ---connection con_temp5 -REAP; - ---connection server_1 -SELECT * FROM t3 WHERE a >= 30 ORDER BY a; -SET debug_sync='RESET'; - ---connection server_2 -SET sql_log_bin=0; -CALL mtr.add_suppression("Query execution was interrupted"); -CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); -CALL mtr.add_suppression("Slave: Connection was killed"); -SET sql_log_bin=1; -# Wait until T2 is inside executing its insert of 32, then find it in SHOW -# PROCESSLIST to know its thread id for KILL later. -SET debug_sync='now WAIT_FOR t2_query'; ---let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(32%' AND INFO NOT LIKE '%LIKE%'` -SET debug_sync='now SIGNAL t2_cont'; - -# Wait until T2 has entered its wait for T1 to commit, and T1 has -# progressed into its commit phase. -SET debug_sync='now WAIT_FOR t1_ready'; - -# Now kill the transaction T2. ---replace_result $thd_id THD_ID -eval KILL $thd_id; - -# Wait until T2 has reacted on the kill. -SET debug_sync='now WAIT_FOR t2_killed'; - -# Now we can allow T1 to proceed. -SET debug_sync='now SIGNAL t1_cont'; - ---let $slave_sql_errno= 1317,1927,1964 ---source include/wait_for_slave_sql_error.inc -STOP SLAVE IO_THREAD; -SELECT * FROM t3 WHERE a >= 30 ORDER BY a; - -# Now we have to disable the debug_sync statements, so they do not trigger -# when the events are retried. -SET debug_sync='RESET'; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_1 -INSERT INTO t3 VALUES (39,0); ---save_master_pos - ---connection server_2 ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t3 WHERE a >= 30 ORDER BY a; -# Restore the foo() function. -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - - ---connection server_2 -# Respawn all worker threads to clear any left-over debug_sync or other stuff. ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - - ---echo *** 2. Same as (1), but without restarting IO thread after kill of SQL threads *** - -# Set up three transactions on the master that will be group-committed -# together so they can be replicated in parallel on the slave. ---connection con_temp3 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send INSERT INTO t3 VALUES (41, foo(41, - 'commit_before_prepare_ordered WAIT_FOR t2_waiting', - 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con_temp4 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -BEGIN; -# This insert is just so we can get T2 to wait while a query is running that we -# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. -INSERT INTO t3 VALUES (42, foo(42, - 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', - '')); -# This insert sets up debug_sync points so that T2 will tell when it is at its -# wait point where we want to kill it - and when it has been killed. -INSERT INTO t3 VALUES (43, foo(43, - 'group_commit_waiting_for_prior SIGNAL t2_waiting', - 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); -send COMMIT; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; - ---connection con_temp5 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; -send INSERT INTO t3 VALUES (44, foo(44, - '', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued3'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; ---connection con_temp5 -REAP; - ---connection server_1 -SELECT * FROM t3 WHERE a >= 40 ORDER BY a; -SET debug_sync='RESET'; - ---connection server_2 -# Wait until T2 is inside executing its insert of 42, then find it in SHOW -# PROCESSLIST to know its thread id for KILL later. -SET debug_sync='now WAIT_FOR t2_query'; ---let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(42%' AND INFO NOT LIKE '%LIKE%'` -SET debug_sync='now SIGNAL t2_cont'; - -# Wait until T2 has entered its wait for T1 to commit, and T1 has -# progressed into its commit phase. -SET debug_sync='now WAIT_FOR t1_ready'; - -# Now kill the transaction T2. ---replace_result $thd_id THD_ID -eval KILL $thd_id; - -# Wait until T2 has reacted on the kill. -SET debug_sync='now WAIT_FOR t2_killed'; - -# Now we can allow T1 to proceed. -SET debug_sync='now SIGNAL t1_cont'; - ---let $slave_sql_errno= 1317,1927,1964 ---source include/wait_for_slave_sql_error.inc - -# Now we have to disable the debug_sync statements, so they do not trigger -# when the events are retried. -SET debug_sync='RESET'; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_1 -INSERT INTO t3 VALUES (49,0); ---save_master_pos - ---connection server_2 -START SLAVE SQL_THREAD; ---sync_with_master -SELECT * FROM t3 WHERE a >= 40 ORDER BY a; -# Restore the foo() function. -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - - ---connection server_2 -# Respawn all worker threads to clear any left-over debug_sync or other stuff. ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - - ---echo *** 3. Same as (2), but not using gtid mode *** - ---connection server_2 ---source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=no; ---source include/start_slave.inc - ---connection server_1 -# Set up three transactions on the master that will be group-committed -# together so they can be replicated in parallel on the slave. ---connection con_temp3 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send INSERT INTO t3 VALUES (51, foo(51, - 'commit_before_prepare_ordered WAIT_FOR t2_waiting', - 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con_temp4 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -BEGIN; -# This insert is just so we can get T2 to wait while a query is running that we -# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. -INSERT INTO t3 VALUES (52, foo(52, - 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', - '')); -# This insert sets up debug_sync points so that T2 will tell when it is at its -# wait point where we want to kill it - and when it has been killed. -INSERT INTO t3 VALUES (53, foo(53, - 'group_commit_waiting_for_prior SIGNAL t2_waiting', - 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); -send COMMIT; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; - ---connection con_temp5 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; -send INSERT INTO t3 VALUES (54, foo(54, - '', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued3'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; ---connection con_temp5 -REAP; - ---connection server_1 -SELECT * FROM t3 WHERE a >= 50 ORDER BY a; -SET debug_sync='RESET'; - ---connection server_2 -# Wait until T2 is inside executing its insert of 52, then find it in SHOW -# PROCESSLIST to know its thread id for KILL later. -SET debug_sync='now WAIT_FOR t2_query'; ---let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(52%' AND INFO NOT LIKE '%LIKE%'` -SET debug_sync='now SIGNAL t2_cont'; - -# Wait until T2 has entered its wait for T1 to commit, and T1 has -# progressed into its commit phase. -SET debug_sync='now WAIT_FOR t1_ready'; - -# Now kill the transaction T2. ---replace_result $thd_id THD_ID -eval KILL $thd_id; - -# Wait until T2 has reacted on the kill. -SET debug_sync='now WAIT_FOR t2_killed'; - -# Now we can allow T1 to proceed. -SET debug_sync='now SIGNAL t1_cont'; - ---let $slave_sql_errno= 1317,1927,1964 ---source include/wait_for_slave_sql_error.inc -SELECT * FROM t3 WHERE a >= 50 ORDER BY a; - -# Now we have to disable the debug_sync statements, so they do not trigger -# when the events are retried. -SET debug_sync='RESET'; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_1 -INSERT INTO t3 VALUES (59,0); ---save_master_pos - ---connection server_2 -START SLAVE SQL_THREAD; ---sync_with_master -SELECT * FROM t3 WHERE a >= 50 ORDER BY a; - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=slave_pos; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; -SET GLOBAL slave_parallel_mode=@old_parallel_mode; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 -DROP function foo; -DROP TABLE t1,t2,t3; -SET DEBUG_SYNC= 'RESET'; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_stop_on_con_kill.inc b/mysql-test/suite/rpl/include/rpl_parallel_stop_on_con_kill.inc deleted file mode 100644 index 63c483ea6ad17..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_stop_on_con_kill.inc +++ /dev/null @@ -1,129 +0,0 @@ ---echo *** MDEV-8031: Parallel replication stops on "connection killed" error (probably incorrectly handled deadlock kill) *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; -INSERT INTO t3 VALUES (201,0), (202,0); ---source include/save_master_gtid.inc - ---connection server_2 ---source include/sync_with_master_gtid.inc ---source include/stop_slave.inc -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug= '+d,inject_mdev8031'; - ---connection server_1 -# We artificially create a situation that hopefully resembles the original -# bug which was only seen "in the wild", and only once. -# Setup a fake group commit with lots of conflicts that will lead to deadloc -# kill. The slave DBUG injection causes the slave to be deadlock killed at -# a particular point during the retry, and then later do a small sleep at -# another critical point where the prior transaction then has a chance to -# complete. Finally an extra KILL check catches an unhandled, lingering -# deadlock kill. So rather artificial, but at least it exercises the -# relevant code paths. -SET @old_dbug= @@SESSION.debug_dbug; -SET SESSION debug_dbug="+d,binlog_force_commit_id"; - -SET @commit_id= 10200; -INSERT INTO t3 VALUES (203, 1); -INSERT INTO t3 VALUES (204, 1); -INSERT INTO t3 VALUES (205, 1); -UPDATE t3 SET b=b+1 WHERE a=201; -UPDATE t3 SET b=b+1 WHERE a=201; -UPDATE t3 SET b=b+1 WHERE a=201; -UPDATE t3 SET b=b+1 WHERE a=202; -UPDATE t3 SET b=b+1 WHERE a=202; -UPDATE t3 SET b=b+1 WHERE a=202; -UPDATE t3 SET b=b+1 WHERE a=202; -UPDATE t3 SET b=b+1 WHERE a=203; -UPDATE t3 SET b=b+1 WHERE a=203; -UPDATE t3 SET b=b+1 WHERE a=204; -UPDATE t3 SET b=b+1 WHERE a=204; -UPDATE t3 SET b=b+1 WHERE a=204; -UPDATE t3 SET b=b+1 WHERE a=203; -UPDATE t3 SET b=b+1 WHERE a=205; -UPDATE t3 SET b=b+1 WHERE a=205; -SET SESSION debug_dbug=@old_dbug; - -SELECT * FROM t3 WHERE a>=200 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -SELECT * FROM t3 WHERE a>=200 ORDER BY a; ---source include/stop_slave.inc -SET GLOBAL debug_dbug= @old_dbug; ---source include/start_slave.inc - - ---echo *** Check getting deadlock killed inside open_binlog() during retry. *** - ---connection server_2 ---source include/stop_slave.inc -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug= '+d,inject_retry_event_group_open_binlog_kill'; -SET @old_max= @@GLOBAL.max_relay_log_size; -SET GLOBAL max_relay_log_size= 4096; - ---connection server_1 -SET @old_dbug= @@SESSION.debug_dbug; -SET SESSION debug_dbug="+d,binlog_force_commit_id"; - ---let $large= `SELECT REPEAT("*", 8192)` -SET @commit_id= 10210; ---echo Omit long queries that cause relaylog rotations and transaction retries... ---disable_query_log -eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */; ---enable_query_log -SET SESSION debug_dbug=@old_dbug; - -SELECT * FROM t3 WHERE a>=200 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -SELECT * FROM t3 WHERE a>=200 ORDER BY a; - -# Cleanup ---source include/stop_slave.inc -SET GLOBAL debug_dbug= @old_debg; -SET GLOBAL max_relay_log_size= @old_max; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t3; - ---source include/rpl_end.inc - diff --git a/mysql-test/suite/rpl/include/rpl_parallel_stop_slave.inc b/mysql-test/suite/rpl/include/rpl_parallel_stop_slave.inc deleted file mode 100644 index 35879e98e66fb..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_stop_slave.inc +++ /dev/null @@ -1,118 +0,0 @@ ---echo *** Test STOP SLAVE in parallel mode *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -SET GLOBAL slave_parallel_mode='conservative'; - -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc ---connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) ---connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; -# MDEV-515 takes X-lock on the table for the first insert. -# So concurrent insert won't happen on the table -INSERT INTO t2 VALUES(100); -INSERT INTO t3 VALUES(100, 100); ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc - ---connection server_1 -# Set up a couple of transactions. The first will be blocked halfway -# through on a lock, and while it is blocked we initiate STOP SLAVE. -# We then test that the halfway-initiated transaction is allowed to -# complete, but no subsequent ones. -# We have to use statement-based mode and set -# binlog_direct_non_transactional_updates=0; otherwise the binlog will -# be split into two event groups, one for the MyISAM part and one for the -# InnoDB part. -SET binlog_direct_non_transactional_updates=0; -SET sql_log_bin=0; -CALL mtr.add_suppression("Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction"); -SET sql_log_bin=1; -BEGIN; -INSERT INTO t2 VALUES (20); ---disable_warnings -INSERT INTO t1 VALUES (20); ---enable_warnings -INSERT INTO t2 VALUES (21); -INSERT INTO t3 VALUES (20, 20); -COMMIT; -INSERT INTO t3 VALUES(21, 21); -INSERT INTO t3 VALUES(22, 22); ---save_master_pos - -# Start a connection that will block the replicated transaction halfway. ---connection con_temp1 -BEGIN; -INSERT INTO t2 VALUES (21); - ---connection server_2 -START SLAVE; -# Wait for the MyISAM change to be visible, after which replication will wait -# for con_temp1 to roll back. ---let $wait_condition= SELECT COUNT(*) = 1 FROM t1 WHERE a=20 ---source include/wait_condition.inc - ---connection con_temp2 -# Initiate slave stop. It will have to wait for the current event group -# to complete. -# The dbug injection causes debug_sync to signal 'wait_for_done_waiting' -# when the SQL driver thread is ready. -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger"; -send STOP SLAVE; - ---connection con_temp1 -SET debug_sync='now WAIT_FOR wait_for_done_waiting'; -ROLLBACK; - ---connection con_temp2 -reap; -SET GLOBAL debug_dbug=@old_dbug; -SET debug_sync='RESET'; - ---connection server_2 ---source include/wait_for_slave_to_stop.inc -# We should see the first transaction applied, but not the two others. -SELECT * FROM t1 WHERE a >= 20 ORDER BY a; -SELECT * FROM t2 WHERE a >= 20 ORDER BY a; -SELECT * FROM t3 WHERE a >= 20 ORDER BY a; - ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t1 WHERE a >= 20 ORDER BY a; -SELECT * FROM t2 WHERE a >= 20 ORDER BY a; -SELECT * FROM t3 WHERE a >= 20 ORDER BY a; - ---connection server_2 -# Respawn all worker threads to clear any left-over debug_sync or other stuff. ---source include/stop_slave.inc -SET GLOBAL slave_parallel_mode=@old_parallel_mode; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; ---disconnect con_temp1 ---disconnect con_temp2 - ---connection server_1 -DROP TABLE t1,t2,t3; -SET DEBUG_SYNC= 'RESET'; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_wrong_binlog_order.inc b/mysql-test/suite/rpl/include/rpl_parallel_wrong_binlog_order.inc deleted file mode 100644 index 093693d453e82..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_wrong_binlog_order.inc +++ /dev/null @@ -1,91 +0,0 @@ ---echo *** MDEV-6775: Wrong binlog order in parallel replication *** - -# A bit tricky bug to reproduce. On the master, we binlog in statement-mode -# two transactions, an UPDATE followed by a DELETE. On the slave, we replicate -# with binlog-mode set to ROW, which means the DELETE, which modifies no rows, -# is not binlogged. Then we inject a wait in the group commit code on the -# slave, shortly before the actual commit of the UPDATE. The bug was that the -# DELETE could wake up from wait_for_prior_commit() before the commit of the -# UPDATE. So the test could see the slave position updated to after DELETE, -# while the UPDATE was still not visible. - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; -INSERT INTO t4 VALUES (1,NULL), (3,NULL), (4,4), (5, NULL), (6, 6); ---connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---source include/save_master_gtid.inc - ---connection server_2 ---source include/sync_with_master_gtid.inc ---source include/stop_slave.inc -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,inject_binlog_commit_before_get_LOCK_log"; -SET @old_format=@@GLOBAL.binlog_format; -SET GLOBAL binlog_format=ROW; -# Re-spawn the worker threads to be sure they pick up the new binlog format -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; - ---connection con1 -SET @old_format= @@binlog_format; -SET binlog_format= statement; -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send UPDATE t4 SET b=NULL WHERE a=6; ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con2 -SET @old_format= @@binlog_format; -SET binlog_format= statement; -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send DELETE FROM t4 WHERE b <= 3; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con1 -REAP; -SET binlog_format= @old_format; ---connection con2 -REAP; -SET binlog_format= @old_format; -SET debug_sync='RESET'; ---save_master_pos -SELECT * FROM t4 ORDER BY a; - ---connection server_2 ---source include/start_slave.inc -SET debug_sync= 'now WAIT_FOR waiting'; ---sync_with_master -SELECT * FROM t4 ORDER BY a; -SET debug_sync= 'now SIGNAL cont'; - -# Re-spawn the worker threads to remove any DBUG injections or DEBUG_SYNC. ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL binlog_format= @old_format; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 -DROP TABLE t4; -SET DEBUG_SYNC= 'RESET'; ---disconnect con1 ---disconnect con2 ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_wrong_exec_master_pos.inc b/mysql-test/suite/rpl/include/rpl_parallel_wrong_exec_master_pos.inc deleted file mode 100644 index 672ade57ca33a..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_wrong_exec_master_pos.inc +++ /dev/null @@ -1,56 +0,0 @@ ---echo *** MDEV-5938: Exec_master_log_pos not updated at log rotate in parallel replication *** ---source include/have_innodb.inc ---source include/master-slave.inc - ---connection server_2 ---source include/stop_slave.inc -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET GLOBAL slave_parallel_threads=1; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t5 (a INT PRIMARY KEY, b INT); -INSERT INTO t5 VALUES (1,1); -INSERT INTO t5 VALUES (2,2), (3,8); -INSERT INTO t5 VALUES (4,16); ---save_master_pos - ---connection server_2 ---sync_with_master -let $io_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1); -let $io_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); -let $sql_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1); -let $sql_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); ---disable_query_log -eval SELECT IF('$io_file' = '$sql_file', "OK", "Not ok, $io_file <> $sql_file") AS test_check; -eval SELECT IF('$io_pos' = '$sql_pos', "OK", "Not ok, $io_pos <> $sql_pos") AS test_check; ---enable_query_log - ---connection server_1 -FLUSH LOGS; ---source include/wait_for_binlog_checkpoint.inc ---save_master_pos - ---connection server_2 ---sync_with_master -let $io_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1); -let $io_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); -let $sql_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1); -let $sql_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); ---disable_query_log -eval SELECT IF('$io_file' = '$sql_file', "OK", "Not ok, $io_file <> $sql_file") AS test_check; -eval SELECT IF('$io_pos' = '$sql_pos', "OK", "Not ok, $io_pos <> $sql_pos") AS test_check; ---enable_query_log - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t5; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_relayrotate.inc b/mysql-test/suite/rpl/include/rpl_relayrotate.inc deleted file mode 100644 index 4de554d314359..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_relayrotate.inc +++ /dev/null @@ -1,18 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - -####################################################### -# Wrapper for rpl_relayrotate.test to allow multi # -# Engines to reuse test code. By JBM 2006-02-15 # -####################################################### --- source include/have_innodb.inc -# Slow test, don't run during staging part --- source include/not_staging.inc --- source include/master-slave.inc - -let $engine_type=innodb; --- source suite/rpl/include/rpl_relayrotate.test ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_row_img_sequence.inc b/mysql-test/suite/rpl/include/rpl_row_img_sequence.inc new file mode 100644 index 0000000000000..be5b7600f0ac7 --- /dev/null +++ b/mysql-test/suite/rpl/include/rpl_row_img_sequence.inc @@ -0,0 +1,90 @@ +# +# This include file validates that sequence events are properly binlogged +# and replicated. +# +# Parameters: +# expected_columns (list, in) : A list of positive integers which +# correspond to the column numbers that should be output in a binary +# log's write_rows event +# + +--echo # Create sequences with specific engines per server +--connection server_1 +--eval SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=$server_1_engine +--source include/save_master_gtid.inc + +--connection server_2 +--eval SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=$server_2_engine +--source include/sync_with_master_gtid.inc + +--connection server_3 +--eval SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=$server_3_engine +--source include/sync_with_master_gtid.inc + + +--echo # Pt.1 Ensure SETVAL replicates and binlogs correctly +--connection server_1 +SELECT SETVAL(s1, 10); +--source include/save_master_gtid.inc + +--echo # Validate SETVAL replicated correctly to other servers +--connection server_3 +--source include/sync_with_master_gtid.inc +--let $diff_tables= server_1:test.s1,server_2:test.s1,server_3:test.s1 +--source include/diff_tables.inc + +--echo # Validate server_1 binlogged SETVAL with the correct columns +--connection server_1 +--let binlog_filenamE= query_get_value(SHOW MASTER STATUS, File, 1) +FLUSH LOGS; +--source include/ensure_binlog_row_event_columns.inc + +--echo # Validate server_2 binlogged SETVAL with the correct columns +--connection server_2 +--let binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1) +FLUSH LOGS; +--source include/ensure_binlog_row_event_columns.inc + +--echo # Validate server_3 binlogged SETVAL with the correct columns +--connection server_3 +--let binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1) +FLUSH LOGS; +--source include/ensure_binlog_row_event_columns.inc + + +--echo # Pt.2 Ensure NEXTVAL replicates and binlogs correctly +--connection server_1 +SELECT NEXTVAL(s1); +--source include/save_master_gtid.inc + +--echo # Validate NEXTVAL replicated correctly to other servers +--connection server_3 +--source include/sync_with_master_gtid.inc +--let $diff_tables= server_1:test.s1,server_2:test.s1,server_3:test.s1 +--source include/diff_tables.inc + +--echo # Validate server_1 binlogged NEXTVAL with the correct columns +--connection server_1 +--let binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1) +FLUSH LOGS; +--source include/ensure_binlog_row_event_columns.inc + +--echo # Validate server_2 binlogged NEXTVAL with the correct columns +--connection server_2 +--let binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1) +FLUSH LOGS; +--source include/ensure_binlog_row_event_columns.inc + +--echo # Validate server_3 binlogged NEXTVAL with the correct columns +--connection server_3 +--let binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1) +FLUSH LOGS; +--source include/ensure_binlog_row_event_columns.inc + + +--echo # Cleanup +--connection server_1 +DROP TABLE s1; +--source include/save_master_gtid.inc +--connection server_3 +--source include/sync_with_master_gtid.inc diff --git a/mysql-test/suite/rpl/include/rpl_semi_sync.inc b/mysql-test/suite/rpl/include/rpl_semi_sync.inc deleted file mode 100644 index c3cd918b5fc5f..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_semi_sync.inc +++ /dev/null @@ -1,525 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - -source include/not_embedded.inc; -source include/have_innodb.inc; -source include/master-slave.inc; - -let $engine_type= InnoDB; - -# Suppress warnings that might be generated during the test -connection master; -call mtr.add_suppression("Timeout waiting for reply of binlog"); -call mtr.add_suppression("Read semi-sync reply"); -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); -call mtr.add_suppression("mysqld: Got an error reading communication packets"); -connection slave; -call mtr.add_suppression("Master server does not support semi-sync"); -call mtr.add_suppression("Semi-sync slave .* reply"); -call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); -connection master; - -# wait for dying connections (if any) to disappear -let $wait_condition= select count(*) = 0 from information_schema.processlist where command='killed'; ---source include/wait_condition.inc - -# After fix of BUG#45848, semi-sync slave should not create any extra -# connections on master, save the count of connections before start -# semi-sync slave for comparison below. -let $_connections_normal_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); - ---echo # ---echo # Uninstall semi-sync plugins on master and slave ---echo # -connection slave; -source include/stop_slave.inc; -reset slave; -set global rpl_semi_sync_master_enabled= 0; -set global rpl_semi_sync_slave_enabled= 0; - -connection master; -reset master; -set global rpl_semi_sync_master_enabled= 0; -set global rpl_semi_sync_slave_enabled= 0; - ---echo # ---echo # Main test of semi-sync replication start here ---echo # - -connection master; - -set global rpl_semi_sync_master_timeout= 60000; # 60s - -echo [ default state of semi-sync on master should be OFF ]; -show variables like 'rpl_semi_sync_master_enabled'; - -echo [ enable semi-sync on master ]; -set global rpl_semi_sync_master_enabled = 1; -show variables like 'rpl_semi_sync_master_enabled'; - -echo [ status of semi-sync on master should be ON even without any semi-sync slaves ]; -show status like 'Rpl_semi_sync_master_clients'; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_yes_tx'; - ---echo # ---echo # BUG#45672 Semisync repl: ActiveTranx:insert_tranx_node: transaction node allocation failed ---echo # BUG#45673 Semisynch reports correct operation even if no slave is connected ---echo # - -# BUG#45672 When semi-sync is enabled on master, it would allocate -# transaction node even without semi-sync slave connected, and would -# finally result in transaction node allocation error. -# -# Semi-sync master will pre-allocate 'max_connections' transaction -# nodes, so here we do more than that much transactions to check if it -# will fail or not. -# select @@global.max_connections + 1; -let $i= `select @@global.max_connections + 1`; -disable_query_log; -eval create table t1 (a int) engine=$engine_type; -while ($i) -{ - eval insert into t1 values ($i); - dec $i; -} -drop table t1; -enable_query_log; - -# BUG#45673 -echo [ status of semi-sync on master should be OFF ]; -show status like 'Rpl_semi_sync_master_clients'; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_yes_tx'; - -# reset master to make sure the following test will start with a clean environment -reset master; - -connection slave; - -echo [ default state of semi-sync on slave should be OFF ]; -show variables like 'rpl_semi_sync_slave_enabled'; - -echo [ enable semi-sync on slave ]; -set global rpl_semi_sync_slave_enabled = 1; -show variables like 'rpl_semi_sync_slave_enabled'; -source include/start_slave.inc; - -connection master; - -# NOTE: Rpl_semi_sync_master_client will only be updated when -# semi-sync slave has started binlog dump request -let $status_var= Rpl_semi_sync_master_clients; -let $status_var_value= 1; -source include/wait_for_status_var.inc; - -echo [ initial master state after the semi-sync slave connected ]; -show status like 'Rpl_semi_sync_master_clients'; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; - -replace_result $engine_type ENGINE_TYPE; -eval create table t1(a int) engine = $engine_type; - -echo [ master state after CREATE TABLE statement ]; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; - -# After fix of BUG#45848, semi-sync slave should not create any extra -# connections on master. -let $_connections_semisync_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); -replace_result $_connections_normal_slave CONNECTIONS_NORMAL_SLAVE $_connections_semisync_slave CONNECTIONS_SEMISYNC_SLAVE; -eval select $_connections_semisync_slave - $_connections_normal_slave as 'Should be 0'; - -echo [ insert records to table ]; -insert t1 values (10); -insert t1 values (9); -insert t1 values (8); -insert t1 values (7); -insert t1 values (6); -insert t1 values (5); -insert t1 values (4); -insert t1 values (3); -insert t1 values (2); -insert t1 values (1); - -echo [ master status after inserts ]; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; - -sync_slave_with_master; - -echo [ slave status after replicated inserts ]; -show status like 'Rpl_semi_sync_slave_status'; - -select count(distinct a) from t1; -select min(a) from t1; -select max(a) from t1; - ---echo ---echo # BUG#50157 ---echo # semi-sync replication crashes when replicating a transaction which ---echo # include 'CREATE TEMPORARY TABLE `MyISAM_t` SELECT * FROM `Innodb_t` ; - -connection master; -SET SESSION AUTOCOMMIT= 0; -CREATE TABLE t2(c1 INT) ENGINE=innodb; -sync_slave_with_master; - -connection master; -BEGIN; ---echo ---echo # Even though it is in a transaction, this statement is binlogged into binlog ---echo # file immediately. ---disable_warnings -CREATE TEMPORARY TABLE t3 SELECT c1 FROM t2 where 1=1; ---enable_warnings ---echo ---echo # These statements will not be binlogged until the transaction is committed -INSERT INTO t2 VALUES(11); -INSERT INTO t2 VALUES(22); -COMMIT; - -DROP TABLE t2, t3; -SET SESSION AUTOCOMMIT= 1; -sync_slave_with_master; - - ---echo # ---echo # Test semi-sync master will switch OFF after one transaction ---echo # timeout waiting for slave reply. ---echo # -connection slave; -source include/stop_slave.inc; - -connection master; ---source include/kill_binlog_dump_threads.inc -set global rpl_semi_sync_master_timeout= 5000; - -# The first semi-sync check should be on because after slave stop, -# there are no transactions on the master. -echo [ master status should be ON ]; - -let $status_var= Rpl_semi_sync_master_status; -let $status_var_value= ON; -source include/wait_for_status_var.inc; - -let $status_var= Rpl_semi_sync_master_clients; -let $status_var_value= 0; -source include/wait_for_status_var.inc; - -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; - -echo [ semi-sync replication of these transactions will fail ]; -insert into t1 values (500); - -# Wait for the semi-sync replication of this transaction to timeout -let $status_var= Rpl_semi_sync_master_status; -let $status_var_value= OFF; -source include/wait_for_status_var.inc; - -# The second semi-sync check should be off because one transaction -# times out during waiting. -echo [ master status should be OFF ]; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; - -# Semi-sync status on master is now OFF, so all these transactions -# will be replicated asynchronously. -delete from t1 where a=10; -delete from t1 where a=9; -delete from t1 where a=8; -delete from t1 where a=7; -delete from t1 where a=6; -delete from t1 where a=5; -delete from t1 where a=4; -delete from t1 where a=3; -delete from t1 where a=2; -delete from t1 where a=1; - -insert into t1 values (100); - -echo [ master status should be OFF ]; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; - ---echo # ---echo # Test semi-sync status on master will be ON again when slave catches up ---echo # - -# Save the master position for later use. -save_master_pos; - -connection slave; - -echo [ slave status should be OFF ]; -show status like 'Rpl_semi_sync_slave_status'; -source include/start_slave.inc; -sync_with_master; - -echo [ slave status should be ON ]; -show status like 'Rpl_semi_sync_slave_status'; - -select count(distinct a) from t1; -select min(a) from t1; -select max(a) from t1; - -connection master; - -# The master semi-sync status should be on again after slave catches up. -echo [ master status should be ON again after slave catches up ]; - -let $status_var= Rpl_semi_sync_master_status; -let $status_var_value= ON; -source include/wait_for_status_var.inc; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; -show status like 'Rpl_semi_sync_master_clients'; - ---echo # ---echo # Test disable/enable master semi-sync on the fly. ---echo # - -drop table t1; -sync_slave_with_master; - -source include/stop_slave.inc; - ---echo # ---echo # Flush status ---echo # -connection master; -echo [ Semi-sync master status variables before FLUSH STATUS ]; -SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; -SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; -# Do not write the FLUSH STATUS to binlog, to make sure we'll get a -# clean status after this. -FLUSH NO_WRITE_TO_BINLOG STATUS; -echo [ Semi-sync master status variables after FLUSH STATUS ]; -SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; -SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; - -connection master; - -source include/show_master_logs.inc; -show variables like 'rpl_semi_sync_master_enabled'; - -echo [ disable semi-sync on the fly ]; -set global rpl_semi_sync_master_enabled=0; -show variables like 'rpl_semi_sync_master_enabled'; -show status like 'Rpl_semi_sync_master_status'; - -echo [ enable semi-sync on the fly ]; -set global rpl_semi_sync_master_enabled=1; -show variables like 'rpl_semi_sync_master_enabled'; -show status like 'Rpl_semi_sync_master_status'; - ---echo # ---echo # Test RESET MASTER/SLAVE ---echo # - -connection slave; - -source include/start_slave.inc; - -connection master; - -replace_result $engine_type ENGINE_TYPE; -eval create table t1 (a int) engine = $engine_type; -drop table t1; - -sync_slave_with_master; - -echo [ test reset master ]; -connection master; - -reset master; - -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; - -connection slave; - -source include/stop_slave.inc; -reset slave; - -# Kill the dump thread on master for previous slave connection and ---source include/kill_binlog_dump_threads.inc - -connection slave; -source include/start_slave.inc; - -connection master; - -# Wait for dump thread to start, Rpl_semi_sync_master_clients will be -# 1 after dump thread started. -let $status_var= Rpl_semi_sync_master_clients; -let $status_var_value= 1; -source include/wait_for_status_var.inc; - -replace_result $engine_type ENGINE_TYPE; -eval create table t1 (a int) engine = $engine_type; -insert into t1 values (1); -insert into t1 values (2), (3); - -sync_slave_with_master; - -select * from t1; - -connection master; - -echo [ master semi-sync status should be ON ]; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; - ---echo # ---echo # Start semi-sync replication without SUPER privilege ---echo # -connection slave; -source include/stop_slave.inc; -reset slave; -connection master; -reset master; - -# Kill the dump thread on master for previous slave connection and wait for it to exit ---source include/kill_binlog_dump_threads.inc - -# Do not binlog the following statement because it will generate -# different events for ROW and STATEMENT format -set sql_log_bin=0; -grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; -flush privileges; -set sql_log_bin=1; -connection slave; -grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; -flush privileges; -change master to master_user='rpl',master_password='rpl_password'; -source include/start_slave.inc; -show status like 'Rpl_semi_sync_slave_status'; -connection master; - -# Wait for the semi-sync binlog dump thread to start -let $status_var= Rpl_semi_sync_master_clients; -let $status_var_value= 1; -source include/wait_for_status_var.inc; -echo [ master semi-sync should be ON ]; -show status like 'Rpl_semi_sync_master_clients'; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; -insert into t1 values (4); -insert into t1 values (5); -echo [ master semi-sync should be ON ]; -show status like 'Rpl_semi_sync_master_clients'; -show status like 'Rpl_semi_sync_master_status'; -show status like 'Rpl_semi_sync_master_no_tx'; -show status like 'Rpl_semi_sync_master_yes_tx'; - ---echo # ---echo # Test semi-sync slave connect to non-semi-sync master ---echo # - -# Disable semi-sync on master -connection slave; -source include/stop_slave.inc; -SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; - -connection master; - -# Kill the dump thread on master for previous slave connection and wait for it to exit ---source include/kill_binlog_dump_threads.inc - -echo [ Semi-sync status on master should be ON ]; -let $status_var= Rpl_semi_sync_master_clients; -let $status_var_value= 0; -source include/wait_for_status_var.inc; -show status like 'Rpl_semi_sync_master_status'; -let $status_var= Rpl_semi_sync_master_status; -let $status_var_value= ON; -source include/wait_for_status_var.inc; -set global rpl_semi_sync_master_enabled= 0; - -connection slave; -SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; -source include/start_slave.inc; -connection master; -insert into t1 values (8); -let $status_var= Rpl_semi_sync_master_clients; -let $status_var_value= 1; -source include/wait_for_status_var.inc; -echo [ master semi-sync clients should be 1, status should be OFF ]; -show status like 'Rpl_semi_sync_master_clients'; -show status like 'Rpl_semi_sync_master_status'; -sync_slave_with_master; -show status like 'Rpl_semi_sync_slave_status'; - -# Uninstall semi-sync plugin on master -connection slave; -source include/stop_slave.inc; -connection master; -set global rpl_semi_sync_master_enabled= 0; - -connection slave; -SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; -source include/start_slave.inc; - -connection master; -insert into t1 values (10); -sync_slave_with_master; - ---echo # ---echo # Test non-semi-sync slave connect to semi-sync master ---echo # - -connection master; -set global rpl_semi_sync_master_timeout= 5000; # 5s -set global rpl_semi_sync_master_enabled= 1; - -connection slave; -source include/stop_slave.inc; -SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; - -echo [ uninstall semi-sync slave plugin ]; -set global rpl_semi_sync_slave_enabled= 0; - -echo [ reinstall semi-sync slave plugin and disable semi-sync ]; -SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; -SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; -source include/start_slave.inc; -SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; - ---echo # ---echo # Clean up ---echo # - -connection slave; -source include/stop_slave.inc; -set global rpl_semi_sync_slave_enabled= 0; - -connection master; -set global rpl_semi_sync_master_enabled= 0; - -connection slave; -change master to master_user='root',master_password=''; -source include/start_slave.inc; - -connection master; -drop table t1; -sync_slave_with_master; - -connection master; -drop user rpl@127.0.0.1; -flush privileges; -set global rpl_semi_sync_master_timeout= default; ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_skip_replication.inc b/mysql-test/suite/rpl/include/rpl_skip_replication.inc deleted file mode 100644 index 97fc961d43856..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_skip_replication.inc +++ /dev/null @@ -1,402 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it. -# -# Usage: -# -# --let $use_remote_mysqlbinlog= 1 # optional -# --source suite/rpl/include/rpl_skip_replication.inc -# -# The script uses MYSQLBINLOG to verify certain results. -# By default, it uses binary logs directly. If it is undesirable, -# this behavior can be overridden by setting $use_remote_binlog -# as shown above. -# The value will be unset after every execution of the script, -# so if it is needed, it should be set explicitly before each call. -# - ---source include/have_innodb.inc ---source include/master-slave.inc - -connection slave; -# Test that SUPER is required to change @@replicate_events_marked_for_skip. -CREATE USER 'nonsuperuser'@'127.0.0.1'; -GRANT ALTER,CREATE,DELETE,DROP,EVENT,INSERT,PROCESS,REPLICATION SLAVE, - SELECT,UPDATE ON *.* TO 'nonsuperuser'@'127.0.0.1'; -connect(nonpriv, 127.0.0.1, nonsuperuser,, test, $SLAVE_MYPORT,); -connection nonpriv; ---error ER_SPECIFIC_ACCESS_DENIED_ERROR -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; -disconnect nonpriv; -connection slave; -DROP USER'nonsuperuser'@'127.0.0.1'; - -SELECT @@global.replicate_events_marked_for_skip; ---error ER_SLAVE_MUST_STOP -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; -SELECT @@global.replicate_events_marked_for_skip; -STOP SLAVE; ---error ER_GLOBAL_VARIABLE -SET SESSION replicate_events_marked_for_skip=FILTER_ON_MASTER; -SELECT @@global.replicate_events_marked_for_skip; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; -SELECT @@global.replicate_events_marked_for_skip; -START SLAVE; - -connection master; -SELECT @@skip_replication; ---error ER_LOCAL_VARIABLE -SET GLOBAL skip_replication=1; -SELECT @@skip_replication; - -CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=myisam; -CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=innodb; -INSERT INTO t1(a) VALUES (1); -INSERT INTO t2(a) VALUES (1); - - -# Test that master-side filtering works. -SET skip_replication=1; - -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; -INSERT INTO t1(a) VALUES (2); -INSERT INTO t2(a) VALUES (2); - -# Inject a rotate event in the binlog stream sent to slave (otherwise we will -# fail sync_slave_with_master as the last event on the master is not present -# on the slave). -FLUSH NO_WRITE_TO_BINLOG LOGS; - -sync_slave_with_master; -connection slave; -SHOW TABLES; -SELECT * FROM t1; -SELECT * FROM t2; - -connection master; -DROP TABLE t3; - -FLUSH NO_WRITE_TO_BINLOG LOGS; -sync_slave_with_master; - - -# Test that slave-side filtering works. -connection slave; -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; -START SLAVE; - -connection master; -SET skip_replication=1; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; -INSERT INTO t1(a) VALUES (3); -INSERT INTO t2(a) VALUES (3); - -# Inject a rotate event in the binlog stream sent to slave (otherwise we will -# fail sync_slave_with_master as the last event on the master is not present -# on the slave). -FLUSH NO_WRITE_TO_BINLOG LOGS; - -sync_slave_with_master; -connection slave; -SHOW TABLES; -SELECT * FROM t1; -SELECT * FROM t2; - -connection master; -DROP TABLE t3; - -FLUSH NO_WRITE_TO_BINLOG LOGS; -sync_slave_with_master; -connection slave; -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=REPLICATE; -START SLAVE; - - -# Test that events with @@skip_replication=1 are not filtered when filtering is -# not set on slave. -connection master; -SET skip_replication=1; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; -INSERT INTO t3(a) VALUES(2); -sync_slave_with_master; -connection slave; -SELECT * FROM t3; -connection master; -DROP TABLE t3; - -# -# Test that the slave will preserve the @@skip_replication flag in its -# own binlog. -# - -TRUNCATE t1; -sync_slave_with_master; -connection slave; -RESET MASTER; - -connection master; -SET skip_replication=0; -INSERT INTO t1 VALUES (1,0); -SET skip_replication=1; -INSERT INTO t1 VALUES (2,0); -SET skip_replication=0; -INSERT INTO t1 VALUES (3,0); - -sync_slave_with_master; -connection slave; -# Since slave has @@replicate_events_marked_for_skip=REPLICATE, it should have -# applied all events. -SELECT * FROM t1 ORDER by a; - -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; -let $SLAVE_DATADIR= `select @@datadir`; - -connection master; -TRUNCATE t1; - -# Now apply the slave binlog to the master, to check that both the slave -# and mysqlbinlog will preserve the @@skip_replication flag. - ---let $mysqlbinlog_args= $SLAVE_DATADIR/slave-bin.000001 -if ($use_remote_mysqlbinlog) -{ - --let $mysqlbinlog_args= --read-from-remote-server --protocol=tcp --host=127.0.0.1 --port=$SLAVE_MYPORT -uroot slave-bin.000001 - --let $use_remote_mysqlbinlog= 0 -} ---exec $MYSQL_BINLOG $mysqlbinlog_args > $MYSQLTEST_VARDIR/tmp/rpl_skip_replication.binlog ---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/rpl_skip_replication.binlog - -# The master should have all three events. -SELECT * FROM t1 ORDER by a; - -# The slave should be missing event 2, which is marked with the -# @@skip_replication flag. - -connection slave; -START SLAVE; - -connection master; -sync_slave_with_master; - -connection slave; -SELECT * FROM t1 ORDER by a; - -# -# Test that @@sql_slave_skip_counter does not count skipped @@skip_replication -# events. -# - -connection master; -TRUNCATE t1; - -sync_slave_with_master; -connection slave; -STOP SLAVE; -# We will skip two INSERTs (in addition to any skipped due to -# @@skip_replication). Since from 5.5 every statement is wrapped in -# BEGIN ... END, we need to skip 6 events for this. -SET GLOBAL sql_slave_skip_counter=6; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; -START SLAVE; - -connection master; -# Need to fix @@binlog_format to get consistent event count. -SET @old_binlog_format= @@binlog_format; -SET binlog_format= statement; -SET skip_replication=0; -INSERT INTO t1 VALUES (1,5); -SET skip_replication=1; -INSERT INTO t1 VALUES (2,5); -SET skip_replication=0; -INSERT INTO t1 VALUES (3,5); -INSERT INTO t1 VALUES (4,5); -SET binlog_format= @old_binlog_format; - -sync_slave_with_master; -connection slave; - -# The slave should have skipped the first three inserts (number 1 and 3 due -# to @@sql_slave_skip_counter=2, number 2 due to -# @@replicate_events_marked_for_skip=FILTER_ON_SLAVE). So only number 4 -# should be left. -SELECT * FROM t1; - - -# -# Check that BINLOG statement preserves the @@skip_replication flag. -# -connection slave; -# Need row @@binlog_format for BINLOG statements containing row events. ---source include/stop_slave.inc -SET @old_slave_binlog_format= @@global.binlog_format; -SET GLOBAL binlog_format= row; ---source include/start_slave.inc - -connection master; -TRUNCATE t1; - -SET @old_binlog_format= @@binlog_format; -SET binlog_format= row; -# Format description log event. -BINLOG 'wlZOTw8BAAAA8QAAAPUAAAAAAAQANS41LjIxLU1hcmlhREItZGVidWctbG9nAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAA2QAEGggAAAAICAgCAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAA371saA=='; -# INSERT INTO t1 VALUES (1,8) # with @@skip_replication=1 -BINLOG 'wlZOTxMBAAAAKgAAAGMBAAAAgCkAAAAAAAEABHRlc3QAAnQxAAIDAwAC -wlZOTxcBAAAAJgAAAIkBAAAAgCkAAAAAAAEAAv/8AQAAAAgAAAA='; -# INSERT INTO t1 VALUES (2,8) # with @@skip_replication=0 -BINLOG 'wlZOTxMBAAAAKgAAADwCAAAAACkAAAAAAAEABHRlc3QAAnQxAAIDAwAC -wlZOTxcBAAAAJgAAAGICAAAAACkAAAAAAAEAAv/8AgAAAAgAAAA='; -SET binlog_format= @old_binlog_format; - -SELECT * FROM t1 ORDER BY a; -sync_slave_with_master; -connection slave; -# Slave should have only the second insert, the first should be ignored due to -# the @@skip_replication flag. -SELECT * FROM t1 ORDER by a; - ---source include/stop_slave.inc -SET GLOBAL binlog_format= @old_slave_binlog_format; ---source include/start_slave.inc - - -# Test that it is not possible to change @@skip_replication inside a -# transaction or statement, thereby replicating only parts of statements -# or transactions. -connection master; -SET skip_replication=0; - -BEGIN; ---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET skip_replication=0; ---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET skip_replication=1; -ROLLBACK; -SET skip_replication=1; -BEGIN; ---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET skip_replication=0; ---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET skip_replication=1; -COMMIT; -SET autocommit=0; -INSERT INTO t2(a) VALUES(100); ---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET skip_replication=1; -ROLLBACK; -SET autocommit=1; - -SET skip_replication=1; ---delimiter | -CREATE FUNCTION foo (x INT) RETURNS INT BEGIN SET SESSION skip_replication=x; RETURN x; END| -CREATE PROCEDURE bar(x INT) BEGIN SET SESSION skip_replication=x; END| -CREATE FUNCTION baz (x INT) RETURNS INT BEGIN CALL bar(x); RETURN x; END| ---delimiter ; ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -SELECT foo(0); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -SELECT baz(0); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET @a= foo(1); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET @a= baz(1); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -UPDATE t2 SET b=foo(0); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -UPDATE t2 SET b=baz(0); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -INSERT INTO t1 VALUES (101, foo(1)); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -INSERT INTO t1 VALUES (101, baz(0)); -SELECT @@skip_replication; -CALL bar(0); -SELECT @@skip_replication; -CALL bar(1); -SELECT @@skip_replication; -DROP FUNCTION foo; -DROP PROCEDURE bar; -DROP FUNCTION baz; - - -# Test that master-side filtering happens on the master side, and that -# slave-side filtering happens on the slave. - -# First test that events do not reach the slave when master-side filtering -# is configured. Do this by replicating first with only the IO thread running -# and master-side filtering; then change to no filtering and start the SQL -# thread. This should still skip the events, as master-side filtering -# means the events never reached the slave. -connection master; -SET skip_replication= 0; -TRUNCATE t1; -sync_slave_with_master; -connection slave; -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; -START SLAVE IO_THREAD; -connection master; -SET skip_replication= 1; -INSERT INTO t1(a) VALUES (1); -SET skip_replication= 0; -INSERT INTO t1(a) VALUES (2); ---source include/save_master_pos.inc -connection slave; ---source include/sync_io_with_master.inc -STOP SLAVE IO_THREAD; -SET GLOBAL replicate_events_marked_for_skip=REPLICATE; -START SLAVE; -connection master; -sync_slave_with_master; -connection slave; -# Now only the second insert of (2) should be visible, as the first was -# filtered on the master, so even though the SQL thread ran without skipping -# events, it will never see the event in the first place. -SELECT * FROM t1; - -# Now tests that when slave-side filtering is configured, events _do_ reach -# the slave. -connection master; -SET skip_replication= 0; -TRUNCATE t1; -sync_slave_with_master; -connection slave; -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; -START SLAVE IO_THREAD; -connection master; -SET skip_replication= 1; -INSERT INTO t1(a) VALUES (1); -SET skip_replication= 0; -INSERT INTO t1(a) VALUES (2); ---source include/save_master_pos.inc -connection slave; ---source include/sync_io_with_master.inc -STOP SLAVE IO_THREAD; -SET GLOBAL replicate_events_marked_for_skip=REPLICATE; -START SLAVE; -connection master; -sync_slave_with_master; -connection slave; -# Now both inserts should be visible. Since filtering was configured to be -# slave-side, the event is in the relay log, and when the SQL thread ran we -# had disabled filtering again. -SELECT * FROM t1 ORDER BY a; - - -# Clean up. -connection master; -SET skip_replication=0; -DROP TABLE t1,t2; -connection slave; -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=REPLICATE; -START SLAVE; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_special_charset.inc b/mysql-test/suite/rpl/include/rpl_special_charset.inc deleted file mode 100644 index 641aa483d32b7..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_special_charset.inc +++ /dev/null @@ -1,32 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - -################################################################################ -# Bug#19855907 IO THREAD AUTHENTICATION ISSUE WITH SOME CHARACTER SETS -# Problem: IO thread fails to connect to master if servers are configured with -# special character sets like utf16, utf32, ucs2. -# -# Analysis: MySQL server does not support few special character sets like -# utf16,utf32 and ucs2 as "client's character set"(eg: utf16,utf32, ucs2). -# When IO thread is trying to connect to Master, it sets server's character -# set as client's character set. When Slave server is started with these -# special character sets, IO thread (a connection to Master) fails because -# of the above said reason. -# -# Fix: If server's character set is not supported as client's character set, -# then set default's client character set(latin1) as client's character set. -############################################################################### ---source include/master-slave.inc -call mtr.add_suppression("'utf16' can not be used as client character set"); -CREATE TABLE t1(i VARCHAR(20)); -INSERT INTO t1 VALUES (0xFFFF); ---sync_slave_with_master ---let diff_tables=master:t1, slave:t1 ---source include/diff_tables.inc -# Cleanup ---connection master -DROP TABLE t1; ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_sporadic_master.inc b/mysql-test/suite/rpl/include/rpl_sporadic_master.inc deleted file mode 100644 index ad4c44cbf7409..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_sporadic_master.inc +++ /dev/null @@ -1,32 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - -# test to see if replication can continue when master sporadically fails on -# COM_BINLOG_DUMP and additionally limits the number of events per dump - -source include/master-slave.inc; - -create table t2(n int); -create table t1(n int not null auto_increment primary key); -insert into t1 values (NULL),(NULL); -truncate table t1; -# We have to use 4 in the following to make this test work with all table types -insert into t1 values (4),(NULL); -sync_slave_with_master; ---source include/stop_slave.inc ---source include/start_slave.inc -connection master; -insert into t1 values (NULL),(NULL); -flush logs; -truncate table t1; -insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL); -sync_slave_with_master; -select * from t1 ORDER BY n; -connection master; -drop table t1,t2; -sync_slave_with_master; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_ssl.inc b/mysql-test/suite/rpl/include/rpl_ssl.inc deleted file mode 100644 index aff5499c8e577..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_ssl.inc +++ /dev/null @@ -1,115 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - -source include/have_ssl_communication.inc; -source include/master-slave.inc; - -# create a user for replication that requires ssl encryption -connection master; -create user replssl@localhost; -grant replication slave on *.* to replssl@localhost require ssl; -create table t1 (t int auto_increment, KEY(t)); - -sync_slave_with_master; - -# Set slave to use SSL for connection to master -stop slave; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval change master to - master_user='replssl', - master_password='', - master_ssl=1, - master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem', - master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem', - master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem'; -start slave; - -# Switch to master and insert one record, then sync it to slave -connection master; -insert into t1 values(1); -sync_slave_with_master; - -# The record should now be on slave -select * from t1; - -# The slave is synced and waiting/reading from master -# SHOW SLAVE STATUS will show "Waiting for master to send event" -let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Cert, Master_SSL_Key; -source include/show_slave_status.inc; -source include/check_slave_is_running.inc; - -# Stop the slave, as reported in bug#21871 it would hang -STOP SLAVE; - -select * from t1; - -# Do the same thing a number of times -disable_query_log; -disable_result_log; -# 2007-11-27 mats Bug #32756 Starting and stopping the slave in a loop can lose rows -# After discussions with Engineering, I'm disabling this part of the test to avoid it causing -# red trees. -disable_parsing; -let $i= 100; -while ($i) -{ - start slave; - connection master; - insert into t1 values (NULL); - select * from t1; # Some variance - connection slave; - select * from t1; # Some variance - stop slave; - dec $i; -} -enable_parsing; -START SLAVE; -enable_query_log; -enable_result_log; -connection master; -# INSERT one more record to make sure -# the sync has something to do -insert into t1 values (NULL); -let $master_count= `select count(*) from t1`; - -sync_slave_with_master; ---source include/wait_for_slave_to_start.inc -source include/show_slave_status.inc; -source include/check_slave_is_running.inc; - -let $slave_count= `select count(*) from t1`; - -if ($slave_count != $master_count) -{ - echo master and slave differed in number of rows; - echo master: $master_count; - echo slave: $slave_count; - - connection master; - select count(*) t1; - select * from t1; - connection slave; - select count(*) t1; - select * from t1; - query_vertical show slave status; -} - -connection master; -drop user replssl@localhost; -drop table t1; -sync_slave_with_master; - ---source include/stop_slave.inc -CHANGE MASTER TO - master_user = 'root', - master_ssl = 0, - master_ssl_ca = '', - master_ssl_cert = '', - master_ssl_key = ''; - ---echo End of 5.0 tests ---let $rpl_only_running_threads= 1 ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_stm_relay_ign_space.inc b/mysql-test/suite/rpl/include/rpl_stm_relay_ign_space.inc deleted file mode 100644 index 654a5d47cb910..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_stm_relay_ign_space.inc +++ /dev/null @@ -1,107 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - -# -# BUG#12400313 / BUG#64503 test case -# -# -# Description -# ----------- -# -# This test case starts the slave server with: -# --relay-log-space-limit=8192 --relay-log-purge --max-relay-log-size=4096 -# -# Then it issues some queries that will cause the slave to reach -# relay-log-space-limit. We lock the table so that the SQL thread is -# not able to purge the log and then we issue some more statements. -# -# The purpose is to show that the IO thread will honor the limits -# while the SQL thread is not able to purge the relay logs, which did -# not happen before this patch. In addition we assert that while -# ignoring the limit (SQL thread needs to rotate before purging), the -# IO thread does not do it in an uncontrolled manner. - ---source include/have_binlog_format_statement.inc ---source include/have_innodb.inc ---source include/master-slave.inc - ---disable_query_log -CREATE TABLE t1 (c1 TEXT) engine=InnoDB; - -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); - ---sync_slave_with_master - -# wait for the SQL thread to sleep ---let $show_statement= SHOW PROCESSLIST ---let $field= State ---let $condition= = 'Slave has read all relay log; waiting for more updates' ---source include/wait_show_condition.inc - -# now the io thread has set rli->ignore_space_limit -# lets lock the table so that once the SQL thread awakes -# it blocks there and does not set rli->ignore_space_limit -# back to zero -LOCK TABLE t1 WRITE; - -# now issue more statements that will overflow the -# rli->log_space_limit (in this case ~10K) ---connection master - -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); -INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); - ---connection slave - -# ASSERT that the IO thread waits for the SQL thread to release some -# space before continuing ---let $show_statement= SHOW PROCESSLIST ---let $field= State ---let $condition= LIKE 'Waiting for %' -# before the patch (IO would have transfered everything) -#--let $condition= = 'Waiting for master to send event' -# after the patch (now it waits for space to be freed) -#--let $condition= = 'Waiting for the slave SQL thread to free enough relay log space' ---source include/wait_show_condition.inc - -# without the patch we can uncomment the following two lines and -# watch the IO thread synchronize with the master, thus writing -# relay logs way over the space limit -#--connection master -#--source include/sync_slave_io_with_master.inc - -## ASSERT that the IO thread has honored the limit+few bytes required to be able to purge ---let $relay_log_space_while_sql_is_executing = query_get_value(SHOW SLAVE STATUS, Relay_Log_Space, 1) ---let $relay_log_space_limit = query_get_value(SHOW VARIABLES LIKE "relay_log_space_limit", Value, 1) ---let $assert_text= Assert that relay log space is close to the limit ---let $assert_cond= $relay_log_space_while_sql_is_executing <= $relay_log_space_limit * 1.15 ---source include/assert.inc - -# unlock the table and let SQL thread continue applying events -UNLOCK TABLES; - ---connection master ---sync_slave_with_master ---let $diff_tables=master:test.t1,slave:test.t1 ---source include/diff_tables.inc - ---connection master -DROP TABLE t1; ---enable_query_log ---sync_slave_with_master - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_switch_stm_row_mixed.inc b/mysql-test/suite/rpl/include/rpl_switch_stm_row_mixed.inc deleted file mode 100644 index d814a25771168..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_switch_stm_row_mixed.inc +++ /dev/null @@ -1,633 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - -# -# rpl_switch_stm_row_mixed tests covers -# -# - Master is switching explicitly between STATEMENT, ROW, and MIXED -# binlog format showing when it is possible and when not. -# - Master switching from MIXED to RBR implicitly listing all use -# cases, e.g a query invokes SYS_GUID(), thereafter to serve as the -# definition of MIXED binlog format -# - correctness of execution - - --- source include/have_binlog_format_mixed_or_row.inc --- source include/master-slave.inc - -# Since this test generates row-based events in the binary log, the -# slave SQL thread cannot be in STATEMENT mode to execute this test, -# so we only execute it for MIXED and ROW as default value of -# BINLOG_FORMAT. - -connection slave; - -connection master; ---disable_warnings -drop database if exists mysqltest1; -create database mysqltest1; ---enable_warnings -use mysqltest1; - -# Save binlog format -set @my_binlog_format= @@global.binlog_format; - -# play with switching -set session binlog_format=mixed; -show session variables like "binlog_format%"; -set session binlog_format=statement; -show session variables like "binlog_format%"; -set session binlog_format=row; -show session variables like "binlog_format%"; - -set global binlog_format=DEFAULT; -show global variables like "binlog_format%"; -set global binlog_format=MIXED; -show global variables like "binlog_format%"; -set global binlog_format=STATEMENT; -show global variables like "binlog_format%"; -set global binlog_format=ROW; -show global variables like "binlog_format%"; -show session variables like "binlog_format%"; -select @@global.binlog_format, @@session.binlog_format; - -CREATE TABLE t1 (a varchar(100)); - -prepare stmt1 from 'insert into t1 select concat(SYS_GUID(),?)'; -set @string="emergency_1_"; -insert into t1 values("work_2_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values(concat(SYS_GUID(),"work_3_")); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values(concat("for_4_",SYS_GUID())); -insert into t1 select "yesterday_5_"; - -# verify that temp tables prevent a switch to SBR -create temporary table tmp(a char(100)); -insert into tmp values("see_6_"); ---error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR -set binlog_format=statement; -insert into t1 select * from tmp; -drop temporary table tmp; - -# Now we go to SBR -set binlog_format=statement; -show global variables like "binlog_format%"; -show session variables like "binlog_format%"; -select @@global.binlog_format, @@session.binlog_format; -set global binlog_format=statement; -show global variables like "binlog_format%"; -show session variables like "binlog_format%"; -select @@global.binlog_format, @@session.binlog_format; - -prepare stmt1 from 'insert into t1 select ?'; -set @string="emergency_7_"; -insert into t1 values("work_8_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values("work_9_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values("for_10_"); -insert into t1 select "yesterday_11_"; - -# test statement (is not default after wl#3368) -set binlog_format=statement; -select @@global.binlog_format, @@session.binlog_format; -set global binlog_format=statement; -select @@global.binlog_format, @@session.binlog_format; - -prepare stmt1 from 'insert into t1 select ?'; -set @string="emergency_12_"; -insert into t1 values("work_13_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values("work_14_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values("for_15_"); -insert into t1 select "yesterday_16_"; - -# and now the mixed mode - -set global binlog_format=mixed; -select @@global.binlog_format, @@session.binlog_format; -set binlog_format=default; -select @@global.binlog_format, @@session.binlog_format; - -prepare stmt1 from 'insert into t1 select concat(SYS_GUID(),?)'; -set @string="emergency_17_"; -insert into t1 values("work_18_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values(concat(SYS_GUID(),"work_19_")); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values(concat("for_20_",SYS_GUID())); -insert into t1 select "yesterday_21_"; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values(concat(SYS_GUID(),"work_22_")); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values(concat("for_23_",SYS_GUID())); -insert into t1 select "yesterday_24_"; - -# Test of CREATE TABLE SELECT - -create table t2 ENGINE=MyISAM select rpad(SYS_GUID(),100,' '); -create table t3 select 1 union select SYS_GUID(); ---disable_warnings -SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR -create table t4 select * from t1 where 3 in (select 1 union select 2 union select SYS_GUID() union select 3); ---enable_warnings -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); -# what if SYS_GUID() is first: ---disable_warnings -insert ignore into t5 select SYS_GUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4); ---enable_warnings - -# inside a stored procedure - -delimiter |; -create procedure foo() -begin -insert into t1 values("work_25_"); -insert into t1 values(concat("for_26_",SYS_GUID())); -insert into t1 select "yesterday_27_"; -end| -create procedure foo2() -begin -insert into t1 values(concat("emergency_28_",SYS_GUID())); -insert into t1 values("work_29_"); -insert into t1 values(concat("for_30_",SYS_GUID())); -set session binlog_format=row; # accepted for stored procs -insert into t1 values("more work_31_"); -set session binlog_format=mixed; -end| -create function foo3() returns bigint unsigned -begin - set session binlog_format=row; # rejected for stored funcs - insert into t1 values("alarm"); - return 100; -end| -create procedure foo4(x varchar(100)) -begin -insert into t1 values(concat("work_250_",x)); -insert into t1 select "yesterday_270_"; -end| -delimiter ;| -call foo(); -call foo2(); -call foo4("hello"); -call foo4(SYS_GUID()); -call foo4("world"); - -# test that can't SET in a stored function ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT -select foo3(); -select * from t1 where a="alarm"; - -# Tests of stored functions/triggers/views for BUG#20930 "Mixed -# binlogging mode does not work with stored functions, triggers, -# views" - -# Function which calls procedure -drop function foo3; -delimiter |; -create function foo3() returns bigint unsigned -begin - insert into t1 values("foo3_32_"); - call foo(); - return 100; -end| -delimiter ;| -insert into t2 select foo3(); - -prepare stmt1 from 'insert into t2 select foo3()'; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - -# Test if stored function calls stored function which calls procedure -# which requires row-based. - -delimiter |; -create function foo4() returns bigint unsigned -begin - insert into t2 select foo3(); - return 100; -end| -delimiter ;| -select foo4(); - -prepare stmt1 from 'select foo4()'; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - -# A simple stored function -delimiter |; -create function foo5() returns bigint unsigned -begin - insert into t2 select SYS_GUID(); - return 100; -end| -delimiter ;| -select foo5(); - -prepare stmt1 from 'select foo5()'; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - -# A simple stored function where SYS_GUID() is in the argument -delimiter |; -create function foo6(x varchar(100)) returns bigint unsigned -begin - insert into t2 select x; - return 100; -end| -delimiter ;| -select foo6("foo6_1_"); -select foo6(concat("foo6_2_",SYS_GUID())); - -prepare stmt1 from 'select foo6(concat("foo6_3_",SYS_GUID()))'; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - - -# Test of views using SYS_GUID() - -create view v1 as select SYS_GUID(); -create table t11 (data varchar(255)); -insert into t11 select * from v1; -# Test of querying INFORMATION_SCHEMA which parses the view's body, -# to verify that it binlogs statement-based (is not polluted by -# the parsing of the view's body). -insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11'); -prepare stmt1 from "insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')"; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - -# Test of triggers with SYS_GUID() -delimiter |; -create trigger t11_bi before insert on t11 for each row -begin - set NEW.data = concat(NEW.data,SYS_GUID()); -end| -delimiter ;| -insert into t11 values("try_560_"); - -# Test that INSERT DELAYED works in mixed mode (BUG#20649) -insert delayed into t2 values("delay_1_"); -insert delayed into t2 values(concat("delay_2_",SYS_GUID())); -insert delayed into t2 values("delay_6_"); - -# Test for BUG#20633 (INSERT DELAYED RAND()/user_variable does not -# replicate fine in statement-based ; we test that in mixed mode it -# works). -insert delayed into t2 values(rand()); -set @a=2.345; -insert delayed into t2 values(@a); - -# With INSERT DELAYED, rows are written to the binlog after they are -# written to the table. Therefore, it is not enough to wait until the -# rows make it to t2 on the master (the rows may not be in the binlog -# at that time, and may still not be in the binlog when -# sync_slave_with_master is later called). Instead, we wait until the -# rows make it to t2 on the slave. We first call -# sync_slave_with_master, so that we are sure that t2 has been created -# on the slave. -sync_slave_with_master; -let $wait_condition= SELECT COUNT(*) = 19 FROM mysqltest1.t2; ---source include/wait_condition.inc -connection master; - -# If you want to do manual testing of the mixed mode regarding UDFs (not -# testable automatically as quite platform- and compiler-dependent), -# you just need to set the variable below to 1, and to -# "make udf_example.so" in sql/, and to copy sql/udf_example.so to -# MYSQL_TEST_DIR/lib/mysql. -let $you_want_to_test_UDF=0; -if ($you_want_to_test_UDF) -{ - CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so'; - prepare stmt1 from 'insert into t1 select metaphon(?)'; - set @string="emergency_133_"; - insert into t1 values("work_134_"); - execute stmt1 using @string; - deallocate prepare stmt1; - prepare stmt1 from 'insert into t1 select ?'; - insert into t1 values(metaphon("work_135_")); - execute stmt1 using @string; - deallocate prepare stmt1; - insert into t1 values(metaphon("for_136_")); - insert into t1 select "yesterday_137_"; - create table t6 select metaphon("for_138_"); - create table t7 select 1 union select metaphon("for_139_"); - create table t8 select * from t1 where 3 in (select 1 union select 2 union select metaphon("for_140_") union select 3); - create table t9 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3); -} - -create table t20 select * from t1; # save for comparing later -create table t21 select * from t2; -create table t22 select * from t3; -drop table t1,t2,t3; - -# This tests the fix to -# BUG#19630 stored function inserting into two auto_increment breaks statement-based binlog -# We verify that under the mixed binlog mode, a stored function -# modifying at least two tables having an auto_increment column, -# is binlogged row-based. Indeed in statement-based binlogging, -# only the auto_increment value generated for the first table -# is recorded in the binlog, the value generated for the 2nd table -# lacking. - -create table t1 (a int primary key auto_increment, b varchar(100)); -create table t2 (a int primary key auto_increment, b varchar(100)); -create table t3 (b varchar(100)); -delimiter |; -create function f (x varchar(100)) returns int deterministic -begin - insert into t1 values(null,x); - insert into t2 values(null,x); - return 1; -end| -delimiter ;| -select f("try_41_"); -# Two operations which compensate each other except that their net -# effect is that they advance the auto_increment counter of t2 on slave: -sync_slave_with_master; -use mysqltest1; -insert into t2 values(2,null),(3,null),(4,null); -delete from t2 where a>=2; - -connection master; -# this is the call which didn't replicate well -select f("try_42_"); -sync_slave_with_master; - -# now use prepared statement and test again, just to see that the RBB -# mode isn't set at PREPARE but at EXECUTE. - -insert into t2 values(3,null),(4,null); -delete from t2 where a>=3; - -connection master; -prepare stmt1 from 'select f(?)'; -set @string="try_43_"; -insert into t1 values(null,"try_44_"); # should be SBB -execute stmt1 using @string; # should be RBB -deallocate prepare stmt1; -sync_slave_with_master; - -# verify that if only one table has auto_inc, it does not trigger RBB -# (we'll check in binlog further below) - -connection master; -create table t12 select * from t1; # save for comparing later -drop table t1; -create table t1 (a int, b varchar(100), key(a)); -select f("try_45_"); - -# restore table's key -create table t13 select * from t1; -drop table t1; -create table t1 (a int primary key auto_increment, b varchar(100)); - -# now test if it's two functions, each of them inserts in one table - -drop function f; -# we need a unique key to have sorting of rows by mysqldump -create table t14 (unique (a)) select * from t2; -truncate table t2; -delimiter |; -create function f1 (x varchar(100)) returns int deterministic -begin - insert into t1 values(null,x); - return 1; -end| -create function f2 (x varchar(100)) returns int deterministic -begin - insert into t2 values(null,x); - return 1; -end| -delimiter ;| -select f1("try_46_"),f2("try_47_"); - -sync_slave_with_master; -insert into t2 values(2,null),(3,null),(4,null); -delete from t2 where a>=2; - -connection master; -# Test with SELECT and INSERT -select f1("try_48_"),f2("try_49_"); -insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_"))); -sync_slave_with_master; - -# verify that if f2 does only read on an auto_inc table, this does not -# switch to RBB -connection master; -drop function f2; -delimiter |; -create function f2 (x varchar(100)) returns int deterministic -begin - declare y int; - insert into t1 values(null,x); - set y = (select count(*) from t2); - return y; -end| -delimiter ;| -select f1("try_53_"),f2("try_54_"); -sync_slave_with_master; - -# And now, a normal statement with a trigger (no stored functions) - -connection master; -drop function f2; -delimiter |; -create trigger t1_bi before insert on t1 for each row -begin - insert into t2 values(null,"try_55_"); -end| -delimiter ;| -insert into t1 values(null,"try_56_"); -# and now remove one auto_increment and verify SBB -alter table t1 modify a int, drop primary key; -insert into t1 values(null,"try_57_"); -sync_slave_with_master; - -# Test for BUG#20499 "mixed mode with temporary table breaks binlog" -# Slave used to have only 2 rows instead of 3. -connection master; -CREATE TEMPORARY TABLE t15 SELECT SYS_GUID(); -create table t16 like t15; -INSERT INTO t16 SELECT * FROM t15; -# we'll verify that this one is done RBB -insert into t16 values("try_65_"); -drop table t15; -# we'll verify that this one is done SBB -insert into t16 values("try_66_"); -sync_slave_with_master; - -# and now compare: - -connection master; - -# first check that data on master is sensible -select count(*) from t1; -select count(*) from t2; -select count(*) from t3; -select count(*) from t4; -select count(*) from t5; -select count(*) from t11; -select count(*) from t20; -select count(*) from t21; -select count(*) from t22; -select count(*) from t12; -select count(*) from t13; -select count(*) from t14; -select count(*) from t16; -if ($you_want_to_test_UDF) -{ - select count(*) from t6; - select count(*) from t7; - select count(*) from t8; - select count(*) from t9; -} - -sync_slave_with_master; - -# -# Bug#20863 If binlog format is changed between update and unlock of -# tables, wrong binlog -# - -connection master; -DROP TABLE IF EXISTS t11; -SET SESSION BINLOG_FORMAT=STATEMENT; -CREATE TABLE t11 (song VARCHAR(255)); -LOCK TABLES t11 WRITE; -SET SESSION BINLOG_FORMAT=ROW; -INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict'); -SET SESSION BINLOG_FORMAT=STATEMENT; -INSERT INTO t11 VALUES('Careful With That Axe, Eugene'); -UNLOCK TABLES; - ---query_vertical SELECT * FROM t11 -sync_slave_with_master; -USE mysqltest1; ---query_vertical SELECT * FROM t11 - -connection master; -DROP TABLE IF EXISTS t12; -SET SESSION BINLOG_FORMAT=MIXED; -CREATE TABLE t12 (data LONG); -LOCK TABLES t12 WRITE; -INSERT INTO t12 VALUES(SYS_GUID()); -UNLOCK TABLES; -sync_slave_with_master; - -# -# BUG#28086: SBR of USER() becomes corrupted on slave -# - -connection master; - -# Just to get something that is non-trivial, albeit still simple, we -# stuff the result of USER() and CURRENT_USER() into a variable. ---delimiter $$ -CREATE FUNCTION my_user() - RETURNS CHAR(64) -BEGIN - DECLARE user CHAR(64); - SELECT USER() INTO user; - RETURN user; -END $$ ---delimiter ; - ---delimiter $$ -CREATE FUNCTION my_current_user() - RETURNS CHAR(64) -BEGIN - DECLARE user CHAR(64); - SELECT CURRENT_USER() INTO user; - RETURN user; -END $$ ---delimiter ; - -DROP TABLE IF EXISTS t13; -CREATE TABLE t13 (data CHAR(64)); -INSERT INTO t13 VALUES (USER()); -INSERT INTO t13 VALUES (my_user()); -INSERT INTO t13 VALUES (CURRENT_USER()); -INSERT INTO t13 VALUES (my_current_user()); - -sync_slave_with_master; - -# as we're using SYS_GUID we don't SELECT but use "diff" like in rpl_row_UUID ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql - -# Let's compare. Note: If they match test will pass, if they do not match -# the test will show that the diff statement failed and not reject file -# will be created. You will need to go to the mysql-test dir and diff -# the files your self to see what is not matching - -diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql; - -connection master; - -# Now test that mysqlbinlog works fine on a binlog generated by the -# mixed mode - -# BUG#11312 "DELIMITER is not written to the binary log that causes -# syntax error" makes that mysqlbinlog will fail if we pass it the -# text of queries; this forces us to use --base64-output here. - -# BUG#20929 "BINLOG command causes invalid free plus assertion -# failure" makes mysqld segfault when receiving --base64-output - -# So I can't enable this piece of test -# SIGH - -if ($enable_when_11312_or_20929_fixed) -{ ---exec $MYSQL_BINLOG --base64-output $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql -drop database mysqltest1; ---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql -# the old mysqldump output on slave is the same as what it was on -# master before restoring on master. -diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql; -} - -drop database mysqltest1; -sync_slave_with_master; - -connection master; -# Restore binlog format setting -set global binlog_format =@my_binlog_format; ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_sync_test.inc b/mysql-test/suite/rpl/include/rpl_sync_test.inc deleted file mode 100644 index 1e2ec2ca83b85..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_sync_test.inc +++ /dev/null @@ -1,159 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - -######################################################################################## -# This test verifies the options --sync-relay-log-info and --relay-log-recovery by -# crashing the slave in two different situations: -# (case-1) - Corrupt the relay log with changes which were not processed by -# the SQL Thread and crashes it. -# (case-2) - Corrupt the master.info with wrong coordinates and crashes it. -# -# Case 1: -# 1 - Stops the SQL Thread -# 2 - Inserts new records into the master. -# 3 - Corrupts the relay-log.bin* which most likely has such changes. -# 4 - Crashes the slave -# 5 - Verifies if the slave is sync with the master which means that the information -# loss was circumvented by the recovery process. -# -# Case 2: -# 1 - Stops the SQL/IO Threads -# 2 - Inserts new records into the master. -# 3 - Corrupts the master.info with wrong coordinates. -# 4 - Crashes the slave -# 5 - Verifies if the slave is sync with the master which means that the information -# loss was circumvented by the recovery process. -######################################################################################## - -######################################################################################## -# Configuring the environment -######################################################################################## ---echo =====Configuring the enviroment=======; ---source include/not_embedded.inc ---source include/not_valgrind.inc ---source include/have_debug.inc ---source include/have_innodb.inc ---source include/not_crashrep.inc ---source include/master-slave.inc - -call mtr.add_suppression('Attempting backtrace'); -call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001"); -# Use innodb so we do not get "table should be repaired" issues. -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -flush tables; -CREATE TABLE t1(a INT, PRIMARY KEY(a)) engine=innodb; - -insert into t1(a) values(1); -insert into t1(a) values(2); -insert into t1(a) values(3); - -######################################################################################## -# Case 1: Corrupt a relay-log.bin* -######################################################################################## ---echo =====Inserting data on the master but without the SQL Thread being running=======; -sync_slave_with_master; - -connection slave; -let $MYSQLD_SLAVE_DATADIR= `select @@datadir`; ---replace_result $MYSQLD_SLAVE_DATADIR MYSQLD_SLAVE_DATADIR ---copy_file $MYSQLD_SLAVE_DATADIR/master.info $MYSQLD_SLAVE_DATADIR/master.backup ---source include/stop_slave_sql.inc - -connection master; -insert into t1(a) values(4); -insert into t1(a) values(5); -insert into t1(a) values(6); - ---echo =====Removing relay log files and crashing/recoverying the slave=======; -connection slave; ---source include/stop_slave_io.inc - -let $file= query_get_value("SHOW SLAVE STATUS", Relay_Log_File, 1); - ---let FILE_TO_CORRUPT= $MYSQLD_SLAVE_DATADIR/$file -perl; -$file= $ENV{'FILE_TO_CORRUPT'}; -open(FILE, ">$file") || die "Unable to open $file."; -truncate(FILE,0); -print FILE "failure"; -close ($file); -EOF - ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect -SET SESSION debug_dbug="d,crash_before_rotate_relaylog"; ---error 2013 -FLUSH LOGS; - ---let $rpl_server_number= 2 ---source include/rpl_reconnect.inc - ---echo =====Dumping and comparing tables=======; ---source include/start_slave.inc - -connection master; -sync_slave_with_master; - -let $diff_tables=master:t1,slave:t1; -source include/diff_tables.inc; - -######################################################################################## -# Case 2: Corrupt a master.info -######################################################################################## ---echo =====Corrupting the master.info=======; -connection slave; ---source include/stop_slave.inc - -connection master; -FLUSH LOGS; - -insert into t1(a) values(7); -insert into t1(a) values(8); -insert into t1(a) values(9); - -connection slave; -let MYSQLD_SLAVE_DATADIR=`select @@datadir`; - ---perl -use strict; -use warnings; -my $src= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.backup"; -my $dst= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.info"; -open(FILE, "<", $src) or die; -my @content= ; -close FILE; -open(FILE, ">", $dst) or die; -binmode FILE; -print FILE @content; -close FILE; -EOF - ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect -SET SESSION debug_dbug="d,crash_before_rotate_relaylog"; ---error 2013 -FLUSH LOGS; - ---let $rpl_server_number= 2 ---source include/rpl_reconnect.inc - ---echo =====Dumping and comparing tables=======; ---source include/start_slave.inc - -connection master; -sync_slave_with_master; - -let $diff_tables=master:t1,slave:t1; -source include/diff_tables.inc; - -######################################################################################## -# Clean up -######################################################################################## ---echo =====Clean up=======; -connection master; -drop table t1; - ---remove_file $MYSQLD_SLAVE_DATADIR/master.backup ---source include/rpl_end.inc - diff --git a/mysql-test/suite/rpl/include/rpl_temporal_format_default_to_default.inc b/mysql-test/suite/rpl/include/rpl_temporal_format_default_to_default.inc deleted file mode 100644 index 6728ff55d6f5e..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_temporal_format_default_to_default.inc +++ /dev/null @@ -1,82 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption). -# Please check all dependent tests after modifying it -# - ---source include/master-slave.inc - -if ($force_master_mysql56_temporal_format) -{ - connection master; - eval SET @@global.mysql56_temporal_format=$force_master_mysql56_temporal_format; -} - -if ($force_slave_mysql56_temporal_format) -{ - connection slave; - eval SET @@global.mysql56_temporal_format=$force_slave_mysql56_temporal_format; -} - -connection master; -SELECT @@global.mysql56_temporal_format AS on_master; -connection slave; -SELECT @@global.mysql56_temporal_format AS on_slave; -connection master; - -CREATE TABLE t1 -( - c0 TIME(0), - c1 TIME(1), - c2 TIME(2), - c3 TIME(3), - c4 TIME(4), - c5 TIME(5), - c6 TIME(6) -); -CREATE TABLE t2 -( - c0 TIMESTAMP(0), - c1 TIMESTAMP(1), - c2 TIMESTAMP(2), - c3 TIMESTAMP(3), - c4 TIMESTAMP(4), - c5 TIMESTAMP(5), - c6 TIMESTAMP(6) -); - -CREATE TABLE t3 -( - c0 DATETIME(0), - c1 DATETIME(1), - c2 DATETIME(2), - c3 DATETIME(3), - c4 DATETIME(4), - c5 DATETIME(5), - c6 DATETIME(6) -); -INSERT INTO t1 VALUES ('01:01:01','01:01:01.1','01:01:01.11','01:01:01.111','01:01:01.1111','01:01:01.11111','01:01:01.111111'); -INSERT INTO t2 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111'); -INSERT INTO t3 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111'); -SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME; -sync_slave_with_master; - -connection slave; ---query_vertical SELECT * FROM t1; ---query_vertical SELECT * FROM t2; ---query_vertical SELECT * FROM t3; -SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME; - -connection master; -DROP TABLE t1; -DROP TABLE t2; -DROP TABLE t3; - -connection slave; -SET @@global.mysql56_temporal_format=DEFAULT; -connection master; -SET @@global.mysql56_temporal_format=DEFAULT; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_typeconv.inc b/mysql-test/suite/rpl/include/rpl_typeconv.inc deleted file mode 100644 index 9e5662588827e..0000000000000 --- a/mysql-test/suite/rpl/include/rpl_typeconv.inc +++ /dev/null @@ -1,78 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently rpl and binlog_encryption suite). -# Please check all dependent tests after modifying it -# - ---source include/have_binlog_format_row.inc ---source include/master-slave.inc - -connection slave; -set @saved_slave_type_conversions = @@global.slave_type_conversions; -CREATE TABLE type_conversions ( - TestNo INT AUTO_INCREMENT PRIMARY KEY, - Source TEXT, - Target TEXT, - Flags TEXT, - On_Master LONGTEXT, - On_Slave LONGTEXT, - Expected LONGTEXT, - Compare INT, - Error TEXT); - -SELECT @@global.slave_type_conversions; -SET GLOBAL SLAVE_TYPE_CONVERSIONS=''; -SELECT @@global.slave_type_conversions; -SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; -SELECT @@global.slave_type_conversions; -SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; -SELECT @@global.slave_type_conversions; -SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; -SELECT @@global.slave_type_conversions; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT'; -SELECT @@global.slave_type_conversions; - -# Checking strict interpretation of type conversions -connection slave; -SET GLOBAL SLAVE_TYPE_CONVERSIONS=''; -source suite/rpl/include/type_conversions.test; - -# Checking lossy integer type conversions -connection slave; -SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; -source suite/rpl/include/type_conversions.test; - -# Checking non-lossy integer type conversions -connection slave; -SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; -source suite/rpl/include/type_conversions.test; - -# Checking all type conversions -connection slave; -SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; -source suite/rpl/include/type_conversions.test; - -connection slave; ---echo **** Result of conversions **** -disable_query_log; -SELECT RPAD(Source, 15, ' ') AS Source_Type, - RPAD(Target, 15, ' ') AS Target_Type, - RPAD(Flags, 25, ' ') AS All_Type_Conversion_Flags, - IF(Compare IS NULL AND Error IS NOT NULL, '', - IF(Compare, '', - CONCAT("'", On_Slave, "' != '", Expected, "'"))) - AS Value_On_Slave - FROM type_conversions; -enable_query_log; -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; -DROP TABLE t1; -sync_slave_with_master; - -set global slave_type_conversions = @saved_slave_type_conversions; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_xa_empty_transaction.inc b/mysql-test/suite/rpl/include/rpl_xa_empty_transaction.inc new file mode 100644 index 0000000000000..4cb4fe8962fb0 --- /dev/null +++ b/mysql-test/suite/rpl/include/rpl_xa_empty_transaction.inc @@ -0,0 +1,10 @@ +# +# Helper file to run each empty-due-to-err XA transaction test case both with +# and without detaching from the connection when the transaction is prepared. +# + +--let $use_disconnect=0 +--source rpl_xa_empty_transaction_test_case.inc + +--let $use_disconnect=1 +--source rpl_xa_empty_transaction_test_case.inc diff --git a/mysql-test/suite/rpl/include/rpl_xa_empty_transaction_test_case.inc b/mysql-test/suite/rpl/include/rpl_xa_empty_transaction_test_case.inc new file mode 100644 index 0000000000000..6368336b8e36c --- /dev/null +++ b/mysql-test/suite/rpl/include/rpl_xa_empty_transaction_test_case.inc @@ -0,0 +1,131 @@ +# +# Helper script to create an XA transaction and validate it was not +# binlogged +# +# Parameters +# $xa_completion_action : The action to end the XA transaction, either +# COMMIT or ROLLBACK +# $trx_statements : A comma separated list specifying how to build +# the statements of the transaction. Each item in +# the list is either T (for transactional) or N +# (for non-transactional). An empty list will not +# add any statements to the transaction. +# $use_disconnect : When TRUE, disconnect after preparing the XA +# transaction to test the detach/rollback case +# + +# +# Setup +--let $generic_assert_text= should not binlog XA transaction + +--connection server_1 +--let server_1_datadir=`select @@datadir` + +--connection server_2 +--let server_2_datadir=`select @@datadir` + +--connection server_3 +--let server_3_datadir=`select @@datadir` + +--let assert_file=$MYSQLTEST_VARDIR/tmp/binlog_decoded.out + +--connection server_1 +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +--source include/save_master_gtid.inc + +--connection server_3 +--source include/sync_with_master_gtid.inc + +--connection server_1 + +if ($use_disconnect) +{ + --source include/count_sessions.inc + --connect(con1,localhost,root,,) +} + +XA START 'x'; +--let $_stmt_items= $trx_statements +--let $_ctr= 1 +while($_stmt_items) +{ + --let $_cur_stmt= `SELECT SUBSTRING_INDEX('$_stmt_items', ',', 1)` + --let $_stmt_items= `SELECT LTRIM(SUBSTRING('$_stmt_items', LENGTH('$_cur_stmt') + 2))` + + if (`SELECT strcmp("$_cur_stmt","T") = 0`) + { + --let $target_table= ti + } + + if (`SELECT strcmp("$_cur_stmt","N") = 0`) + { + --let $target_table= tm + } + + --error ER_DUP_ENTRY + --eval INSERT INTO $target_table VALUES ($_ctr),($_ctr); + inc $_ctr; + +} +XA END 'x'; +XA PREPARE 'x'; + +if ($use_disconnect) +{ + --disconnect con1 + --connection server_1 + --source include/wait_until_count_sessions.inc + XA RECOVER; + + --error ER_XA_RBROLLBACK + --eval XA $xa_completion_action 'x'; +} +if (!$use_disconnect) +{ + --eval XA $xa_completion_action 'x'; +} + +--source include/save_master_gtid.inc + +--let binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1) +FLUSH LOGS; + +--echo # MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +--exec $MYSQL_BINLOG $server_1_datadir/$binlog_filename --result-file=$assert_file + +--let assert_text= server_1 $generic_assert_text +--let assert_count= 0 +--let assert_select= XA START|XA END|XA PREPARE|XA COMMIT|XA ROLLBACK +--source include/assert_grep.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc +--let binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1) +FLUSH LOGS; + +--echo # MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +--exec $MYSQL_BINLOG $server_2_datadir/$binlog_filename --result-file=$assert_file + +--let assert_text= server_2 $generic_assert_text +--source include/assert_grep.inc + +--connection server_3 +--source include/sync_with_master_gtid.inc +--let binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1) +FLUSH LOGS; + +--echo # MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +--exec $MYSQL_BINLOG $server_3_datadir/$binlog_filename --result-file=$assert_file + +--let assert_text= server_3 $generic_assert_text +--source include/assert_grep.inc + +# +# Cleanup +--connection server_1 +DROP TABLE ti,tm; +--source include/save_master_gtid.inc + +--connection server_3 +--source include/sync_with_master_gtid.inc diff --git a/mysql-test/suite/rpl/include/start_alter_basic.inc b/mysql-test/suite/rpl/include/start_alter_basic.inc new file mode 100644 index 0000000000000..f6e4b6b325364 --- /dev/null +++ b/mysql-test/suite/rpl/include/start_alter_basic.inc @@ -0,0 +1,60 @@ +# +# Run start alter basic tests (CA/RA with given engine) +# Params:- +# $engine +# $sync_slave +# master_node and slave_node connection should be defined + +--echo # $engine +--connection master_node +--eval create table t1(a int, b int) engine=$engine; +insert into t1 values(1,1); +insert into t1 values(2,2); +--echo # Normal Alter +alter table t1 add column c int; +show create table t1; +--echo # Failed Alter +insert into t1 values(1,1, NULL); +--error ER_DUP_ENTRY +alter table t1 change a a int unique; +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; + +# The following restriction should be removed post MDEV-26005 fix. +# TODO MDEV-26130 , should be removed after fixing +#if ($engine != 'aria') +#{ +#--eval create temporary table tmp_tbl(a int, b int) engine=$engine; +#insert into tmp_tbl values(1,1); +#insert into tmp_tbl values(2,2); +#--echo # Normal Alter +#alter table tmp_tbl add column c int; +#--echo # Failed Alter +#insert into tmp_tbl values(1,1, NULL); +#--error ER_DUP_ENTRY +#alter table tmp_tbl change a a int unique ; +#show create table tmp_tbl; +#} +if ($sync_slave) +{ + --source include/save_master_gtid.inc + --connection slave_node + --source include/sync_with_master_gtid.inc + show create table t1; +} + +--connection master_node +drop table t1; +#if ($engine != 'aria') +#{ +#drop temporary table tmp_tbl; +#} +if ($sync_slave) +{ + --source include/save_master_gtid.inc + --connection slave_node + --source include/sync_with_master_gtid.inc +} diff --git a/mysql-test/suite/rpl/include/start_alter_concurrent.inc b/mysql-test/suite/rpl/include/start_alter_concurrent.inc new file mode 100644 index 0000000000000..e5472152807db --- /dev/null +++ b/mysql-test/suite/rpl/include/start_alter_concurrent.inc @@ -0,0 +1,230 @@ +# +# ==== Purpose ==== +# +# Run concurrent split alter on given storage engine +# With concurrent 10 connections +# +# ==== Usage ==== +# +# --let $alter_engine= Engine Name (myisam , innodb ...) +# --let $alter_algorithm= ... +# --let $alter_online = [][ONLINE] +# --let $domain_1= +# --let $domain_2= +# --let $M_port= //Master port +# --let $S_port= //Slave port +# --let $sync_slave= // 0/1 whether to sync slave with master or not +# + + +--connection master_node +set global debug_dbug="+d,start_alter_delay_master"; + +--let $i= 1 +while($i < 11) +{ + if($i == 1 && $domain_1) + { + --eval set gtid_domain_id= $domain_1; + } + if($i == 6 && $domain_2) + { + --eval set gtid_domain_id= $domain_2; + } + --eval create table t$i( a int primary key, b int) engine=$alter_engine + --eval insert into t$i values(1,1),(2,2) + --inc $i +} + + +if ($sync_slave) +{ + --echo # Sync slave + --source include/save_master_gtid.inc + --connection slave_node + --source include/sync_with_master_gtid.inc + --connection master_node +} + +--let $i= 1 +while($i < 21) +{ + if($i == 1 || $i == 11) + { + if($domain_1) + { + --eval set global gtid_domain_id= $domain_1; + } + } + if($i == 6 || $i == 16) + { + if($domain_2) + { + --eval set global gtid_domain_id= $domain_2; + } + } + connect(con$i,127.0.0.1,root,,$db_name, $M_port); + --inc $i +} + +--let $i= 1 +while($i < 11) +{ + --connection con$i + --send_eval alter $alter_online table t$i add column c int, force, algorithm=$alter_algorithm + --inc $i +} + +--connection master_node +set DEBUG_SYNC= "now signal alter_cont"; + +--let $i= 1 +while($i < 11) +{ + --connection con$i + --reap + --inc $i +} +--connection master_node +set DEBUG_SYNC= 'RESET'; + +if ($sync_slave) +{ + --echo # Sync slave + --source include/save_master_gtid.inc + --connection slave_node + --source include/sync_with_master_gtid.inc + --connection master_node +} + + +--echo # Concurrent DML +--let $i= 1 +while($i < 11) +{ + --connection con$i + --send_eval alter table t$i add column d int, force, algorithm=$alter_algorithm + --inc $i +} + +if ($alter_algorithm == "inplace") +{ + --sleep 1 + --let $i= 11 + --let $j= 1 + while($i < 21) + { + --connection con$i + --send_eval insert into t$j values(5,5,5); + --inc $i + --inc $j + } + + --let $i= 11 + while($i < 21) + { + --connection con$i + --reap + --inc $i + } + + if ($sync_slave) + { + --echo # Sync slave + --source include/save_master_gtid.inc + --connection slave_node + --source include/sync_with_master_gtid.inc + --connection master_node + } +} +--connection master_node +set DEBUG_SYNC= "now signal alter_cont"; +--let $i= 1 +while($i < 11) +{ + --connection con$i + --reap + --inc $i +} +--connection master_node +set DEBUG_SYNC= 'RESET'; + +if ($sync_slave) +{ + --echo # Sync slave + --source include/save_master_gtid.inc + --connection slave_node + --source include/sync_with_master_gtid.inc + --connection master_node +} + + +--echo # Rollback tests +--let $i= 1 +while($i < 11) +{ + --connection con$i + --eval insert into t$i values(3,2,1,1) + --send_eval alter table t$i change b b int unique, force, algorithm=$alter_algorithm + --inc $i +} +--connection master_node +set DEBUG_SYNC= "now signal alter_cont"; + + +--let $i= 1 +while ($i < 11) +{ + --connection con$i + --error ER_DUP_ENTRY + --reap + --inc $i +} +--connection master_node +set DEBUG_SYNC= 'RESET'; + + +if ($sync_slave) +{ + --echo # Sync slave + --source include/save_master_gtid.inc + --connection slave_node + --source include/sync_with_master_gtid.inc + --connection master_node +} + +if ($sync_slave) +{ + --enable_query_log + --echo # diff_table of master and slave , we will do only in the case when + --echo # sync_slave is on + --let $i= 1 + while($i < 11) + { + --let $diff_tables= master_node:t$i, slave_node:t$i + source include/diff_tables.inc; + --inc $i + } + --disable_query_log +} + +--connection master_node +drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; + +if ($sync_slave) +{ + --echo # Sync slave + --source include/save_master_gtid.inc + --connection slave_node + --source include/sync_with_master_gtid.inc + --connection master_node +} + +--let $i= 1 +while ($i < 21) +{ + --disconnect con$i + --inc $i +} +--connection master_node +SET GLOBAL debug_dbug= ""; diff --git a/mysql-test/suite/rpl/include/start_alter_include.inc b/mysql-test/suite/rpl/include/start_alter_include.inc new file mode 100644 index 0000000000000..c66075c0164c2 --- /dev/null +++ b/mysql-test/suite/rpl/include/start_alter_include.inc @@ -0,0 +1,64 @@ +# +# ==== Purpose ==== +# +# Run concurrent split alter on different storage engine and with sync to given +# master +# +# ==== Usage ==== +# --let $domain_1= +# --let $domain_2= +# --let $M_port= //Master port +# --let $S_port= //Slave port +# --let $sync_slave= +# --let $db_name= +# + +connect(master_node,127.0.0.1,root,,$db_name, $M_port); +if (!$sync_slave) +{ + --eval set gtid_domain_id= $domain_1; +} +connect(slave_node,127.0.0.1,root,,test, $S_port); +if (!$sync_slave) +{ + --eval set gtid_domain_id= $domain_2; +} + +--let $engine=myisam +--source include/start_alter_basic.inc + +--let $engine=innodb +--source include/start_alter_basic.inc + +--let $engine=aria +--source include/start_alter_basic.inc + +--disable_query_log +--disable_warnings +--connection master_node +--echo # concurrent alter Myisam +--let $alter_engine=myisam +--let $alter_algorithm=copy +--source include/start_alter_concurrent.inc + +--connection master_node +--echo # concurrent alter Aria +--let $alter_engine=aria +--let $alter_algorithm=copy +--source include/start_alter_concurrent.inc + +--connection master_node +--echo # concurrent alter Innodb copy +--let $alter_engine=innodb +--let $alter_algorithm=copy +--source include/start_alter_concurrent.inc + +--connection master_node +--echo # concurrent alter Innodb Inplace +--let $alter_engine=innodb +--let $alter_algorithm=inplace +--source include/start_alter_concurrent.inc +--disconnect master_node +--disconnect slave_node +--enable_warnings +--enable_query_log diff --git a/mysql-test/suite/rpl/include/start_alter_options.inc b/mysql-test/suite/rpl/include/start_alter_options.inc new file mode 100644 index 0000000000000..72c7104b114ad --- /dev/null +++ b/mysql-test/suite/rpl/include/start_alter_options.inc @@ -0,0 +1,399 @@ +# This test will test all the option related to the Alter Table command +# NOTE not all alter statements will follow alter_algorithm since for some statements +# copy is only option +# parameters +# $alter_algorithm {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT} +# $show_binlog +# +--let $force_needed= force , +# Error that is caused by a particular ALTER's option combination +--let $alter_error = 0 + +--connection slave +stop slave; +--let $gtid_strict_mode= `select @@gtid_strict_mode` +--let $slave_parallel_threads= `select @@slave_parallel_threads` +--let $slave_parallel_mode= `select @@slave_parallel_mode` +change master to master_use_gtid= current_pos; +SET GLOBAL slave_parallel_threads=4; +set global slave_parallel_mode=optimistic; +set global gtid_strict_mode=1; +start slave; +--connection master +set binlog_alter_two_phase=true; +create table t1(a int , b int) engine=innodb; +create table a1(a int , b int) engine=myisam; +create temporary table tmp_tbl(a int, b int) engine=innodb; + +# These are grammer rules for ALTER TABLE we will got through all alter table +# rules in this test. +# | ADD [COLUMN] [IF NOT EXISTS] col_name column_definition +# [FIRST | AFTER col_name ] +# | ADD [COLUMN] [IF NOT EXISTS] (col_name column_definition,...) +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_ALTER_OPERATION_NOT_SUPPORTED +} +--error 0,$alter_error +--eval alter table t1 add column if not exists c int , $force_needed algorithm=$alter_algorithm +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_ALTER_OPERATION_NOT_SUPPORTED +} +--error 0,$alter_error +--eval alter table t1 add column d int first, $force_needed algorithm=$alter_algorithm +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_BAD_FIELD_ERROR +} +--error 0,$alter_error +--eval alter table t1 add column e int after c, $force_needed algorithm=$alter_algorithm +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_BAD_FIELD_ERROR +} +--error 0,$alter_error +--eval alter table t1 add column f int after c, $force_needed add column g int first ,add column h char, algorithm=$alter_algorithm +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_CANT_DROP_FIELD_OR_KEY +} +--error 0,$alter_error +--eval alter table t1 drop column c, drop column d, drop column e, drop column f, drop column g , drop column h, $force_needed algorithm=$alter_algorithm +if ($alter_algorithm == 'copy') +{ +--eval alter table tmp_tbl add column if not exists c int , $force_needed algorithm=$alter_algorithm +--eval alter table tmp_tbl add column d int first, $force_needed algorithm=$alter_algorithm +--eval alter table tmp_tbl add column e int after c, $force_needed algorithm=$alter_algorithm +--eval alter table tmp_tbl add column f int after c, $force_needed add column g int first ,add column h char, algorithm=$alter_algorithm +--eval alter table tmp_tbl drop column c, drop column d, drop column e, drop column f, drop column g , drop column h, $force_needed algorithm=$alter_algorithm +} +--echo # show binlog and clear status +--sync_slave_with_master +if ($show_binlog) +{ + --source include/show_binlog_events.inc +} +reset master; +--connection master + + +# +# | ADD {INDEX|KEY} [IF NOT EXISTS] [index_name] +# [index_type] (index_col_name,...) [index_option] ... +# | ADD [CONSTRAINT [symbol]] +# UNIQUE [INDEX|KEY] [index_name] +# [index_type] (index_col_name,...) [index_option] ... +# +# | ADD FULLTEXT [INDEX|KEY] [index_name] +# (index_col_name,...) [index_option] ... +# | DROP [COLUMN] [IF EXISTS] col_name [RESTRICT|CASCADE] +# | DROP PRIMARY KEY +# | DROP {INDEX|KEY} [IF EXISTS] index_name +# | DROP FOREIGN KEY [IF EXISTS] fk_symbol +# | DROP CONSTRAINT [IF EXISTS] constraint_name +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_ALTER_OPERATION_NOT_SUPPORTED +} +--error 0,$alter_error +--eval alter table t1 add column f int after b, $force_needed add column g int first ,add column h varchar(100), algorithm=$alter_algorithm +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_KEY_COLUMN_DOES_NOT_EXIST +} +--error 0,$alter_error +--eval alter table t1 add index if not exists index_1(f), $force_needed algorithm=$alter_algorithm +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_CANT_DROP_FIELD_OR_KEY +} +--error 0,$alter_error +--eval alter table t1 drop index index_1, $force_needed algorithm=$alter_algorithm +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_KEY_COLUMN_DOES_NOT_EXIST +} +--error 0,$alter_error +--eval alter table t1 add unique key unique_1(g), $force_needed algorithm=$alter_algorithm +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_CANT_DROP_FIELD_OR_KEY +} +--error 0,$alter_error +--eval alter table t1 drop index unique_1, $force_needed algorithm=$alter_algorithm +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_KEY_COLUMN_DOES_NOT_EXIST +} +--error 0,$alter_error +--eval alter table t1 add fulltext key f_1(h), $force_needed algorithm=$alter_algorithm +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_CANT_DROP_FIELD_OR_KEY +} +--error 0,$alter_error +--eval alter table t1 drop column f, drop column g , $force_needed algorithm=$alter_algorithm +if ($alter_algorithm == 'copy') +{ +--eval alter table tmp_tbl add column f int after b, $force_needed add column g int first ,add column h varchar(100), algorithm=$alter_algorithm +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_KEY_COLUMN_DOES_NOT_EXIST +} +--error 0,$alter_error +--eval alter table tmp_tbl add index if not exists index_1(f), $force_needed algorithm=$alter_algorithm +--eval alter table tmp_tbl drop index index_1, $force_needed algorithm=$alter_algorithm +--eval alter table tmp_tbl add unique key unique_1(g), $force_needed algorithm=$alter_algorithm +--eval alter table tmp_tbl drop index unique_1, $force_needed algorithm=$alter_algorithm +--eval alter table tmp_tbl drop column f, drop column g , $force_needed algorithm=$alter_algorithm +} +# | ADD [CONSTRAINT [symbol]] PRIMARY KEY +# [index_type] (index_col_name,...) [index_option] ... +# primary key changes cant use inplace algorithm +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_KEY_COLUMN_DOES_NOT_EXIST +} +--error 0,$alter_error +--eval alter table t1 add primary key(h), $force_needed algorithm=copy +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_CANT_DROP_FIELD_OR_KEY +} +--error 0,$alter_error +--eval alter table t1 drop primary key, $force_needed algorithm=copy +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_CANT_DROP_FIELD_OR_KEY +} +--error 0,$alter_error +--eval alter table t1 drop column h, $force_needed algorithm=copy +if ($alter_algorithm == 'copy') +{ +--eval alter table tmp_tbl add primary key(h), $force_needed algorithm=copy +--eval alter table tmp_tbl drop primary key, $force_needed algorithm=copy +--eval alter table tmp_tbl drop column h, $force_needed algorithm=copy +} +--echo # show binlog and clear status +--sync_slave_with_master +if ($show_binlog) +{ + --source include/show_binlog_events.inc +} +reset master; +--connection master + +## NOTE force_needed and algorithm will not be used for system versioning +# | ADD PERIOD FOR SYSTEM_TIME (start_column_name, end_column_name) +# | ADD SYSTEM VERSIONING +# | DROP SYSTEM VERSIONING +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_ALTER_OPERATION_NOT_SUPPORTED +} +--error 0,$alter_error +--eval alter table t1 add column f varchar(100) after b, add column g varchar(100) first ,add column h char, $force_needed algorithm=$alter_algorithm +--eval alter table t1 add period for system_time(f,h) +--eval alter table t1 add system versioning +--eval alter table t1 drop system versioning +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_CANT_DROP_FIELD_OR_KEY +} +--error 0,$alter_error +--eval alter table t1 drop column f, drop column g , drop column h, $force_needed algorithm=$alter_algorithm +--echo # show binlog and clear status +if ($alter_algorithm == 'copy') +{ +--eval alter table tmp_tbl add column f varchar(100) after b, add column g varchar(100) first ,add column h char, $force_needed algorithm=$alter_algorithm +--eval alter table tmp_tbl drop column f, drop column g , drop column h, $force_needed algorithm=$alter_algorithm +} +--sync_slave_with_master +if ($show_binlog) +{ + --source include/show_binlog_events.inc +} +reset master; +--connection master + + +# | ALTER [COLUMN] col_name SET DEFAULT literal | (expression) +# | ALTER [COLUMN] col_name DROP DEFAULT +# | CHANGE [COLUMN] [IF EXISTS] old_col_name new_col_name column_definition +# [FIRST|AFTER col_name] +# | MODIFY [COLUMN] [IF EXISTS] col_name column_definition +# [FIRST | AFTER col_name] +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_ALTER_OPERATION_NOT_SUPPORTED +} +--error 0,$alter_error +--eval alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, $force_needed algorithm=$alter_algorithm ; +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_BAD_FIELD_ERROR +} +--error 0,$alter_error +--eval alter table t1 alter column f set default "****", $force_needed algorithm=$alter_algorithm ; +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_BAD_FIELD_ERROR +} +--error 0,$alter_error +--eval alter table t1 alter column f drop default, $force_needed algorithm=$alter_algorithm ; +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_BAD_FIELD_ERROR +} +--error 0,$alter_error +--eval alter table t1 change column g new_g char, $force_needed algorithm=copy; +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_BAD_FIELD_ERROR +} +--error 0,$alter_error +--eval alter table t1 modify column h varchar(100), $force_needed algorithm=copy; +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_CANT_DROP_FIELD_OR_KEY +} +--error 0,$alter_error +--eval alter table t1 drop column new_g ,drop column f, drop column h, $force_needed algorithm=$alter_algorithm ; +if ($alter_algorithm == 'copy') +{ +--eval alter table tmp_tbl add column f varchar(100) after b,add column g varchar(100) first ,add column h char, $force_needed algorithm=$alter_algorithm ; +--eval alter table tmp_tbl alter column f set default "****", $force_needed algorithm=$alter_algorithm ; +--eval alter table tmp_tbl alter column f drop default, $force_needed algorithm=$alter_algorithm ; +--eval alter table tmp_tbl change column g new_g char, $force_needed algorithm=copy; +--eval alter table tmp_tbl modify column h varchar(100), $force_needed algorithm=copy; +--eval alter table tmp_tbl drop column new_g ,drop column f, drop column h, $force_needed algorithm=$alter_algorithm ; +} +--echo # show binlog and clear status +--sync_slave_with_master +if ($show_binlog) +{ + --source include/show_binlog_events.inc +} +reset master; +--connection master + +# | DISABLE KEYS +# | ENABLE KEYS +# | RENAME [TO] new_tbl_name +# | ORDER BY col_name [, col_name] ... +# | RENAME COLUMN old_col_name TO new_col_name +# | RENAME {INDEX|KEY} old_index_name TO new_index_name +# | CONVERT TO CHARACTER SET charset_name [COLLATE collation_name] +# | [DEFAULT] CHARACTER SET [=] charset_name +# | [DEFAULT] COLLATE [=] collation_name +# | DISCARD TABLESPACE +# | IMPORT TABLESPACE +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_ALTER_OPERATION_NOT_SUPPORTED +} +--error 0,$alter_error +--eval alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, $force_needed algorithm=$alter_algorithm +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_KEY_COLUMN_DOES_NOT_EXIST +} +--error 0,$alter_error +--eval alter table t1 add index if not exists index_1(f), $force_needed algorithm=$alter_algorithm +--eval alter table t1 disable keys, $force_needed algorithm=copy +--eval alter table t1 enable keys, $force_needed algorithm=copy +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_ALTER_OPERATION_NOT_SUPPORTED +} +--error 0,$alter_error +--eval alter table t1 rename t2, $force_needed algorithm=$alter_algorithm +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_NO_SUCH_TABLE +} +--error 0,$alter_error +--eval alter table t2 rename t1, $force_needed algorithm=$alter_algorithm +--eval alter table a1 order by a +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_BAD_FIELD_ERROR +} +--error 0,$alter_error +--eval alter table t1 rename column f to new_f, $force_needed algorithm=copy +--eval alter table t1 convert to character set 'utf8', $force_needed algorithm=copy +--eval alter table t1 default character set 'utf8', $force_needed algorithm=copy +--eval alter table t1 default collate 'utf8_icelandic_ci', $force_needed algorithm=copy +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_CANT_DROP_FIELD_OR_KEY +} +--error 0,$alter_error +--eval alter table t1 drop column new_f ,drop column g, drop column h, $force_needed algorithm=$alter_algorithm +if ($alter_algorithm == 'copy') +{ +--eval alter table tmp_tbl add column f varchar(100) after b,add column g varchar(100) first ,add column h char, $force_needed algorithm=$alter_algorithm +--eval alter table tmp_tbl add index if not exists index_1(f), $force_needed algorithm=$alter_algorithm +--eval alter table tmp_tbl disable keys, $force_needed algorithm=copy +--eval alter table tmp_tbl enable keys, $force_needed algorithm=copy +--eval alter table a1 order by a +--eval alter table tmp_tbl rename column f to new_f, $force_needed algorithm=copy +--eval alter table tmp_tbl convert to character set 'utf8', $force_needed algorithm=copy +--eval alter table tmp_tbl default character set 'utf8', $force_needed algorithm=copy +--eval alter table tmp_tbl default collate 'utf8_icelandic_ci', $force_needed algorithm=copy +--eval alter table tmp_tbl drop column new_f ,drop column g, drop column h, $force_needed algorithm=$alter_algorithm +} +##--eval alter table t1 discard tablespace; +######--eval alter table t1 import tablespace; + +--echo # show binlog and clear status +--sync_slave_with_master +if ($show_binlog) +{ + --source include/show_binlog_events.inc +} +reset master; +--connection master + +# Only add partition and remove partition is tested +# | ADD PARTITION (partition_definition) +# | REMOVE PARTITIONING +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_ALTER_OPERATION_NOT_SUPPORTED +} +--error 0,$alter_error +--eval alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, $force_needed algorithm=$alter_algorithm +--eval alter table t1 partition by hash(b) partitions 8 +--eval alter table t1 remove partitioning +if (`select '$alter_algorithm' = 'instant' or '$alter_algorithm' = 'nocopy'`) +{ + --let $alter_error=ER_CANT_DROP_FIELD_OR_KEY +} +--error 0,$alter_error +--eval alter table t1 drop column f ,drop column g, drop column h, $force_needed algorithm=$alter_algorithm +if ($alter_algorithm == 'copy') +{ +--eval alter table tmp_tbl add column f varchar(100) after b,add column g varchar(100) first ,add column h char, $force_needed algorithm=$alter_algorithm +--eval alter table tmp_tbl drop column f ,drop column g, drop column h, $force_needed algorithm=$alter_algorithm +} +--echo # show binlog and clear status +--sync_slave_with_master +if ($show_binlog) +{ + --source include/show_binlog_events.inc +} +reset master; +--connection master + +# clean master/slave +--connection master +drop table t1, a1; +drop temporary table tmp_tbl; +--sync_slave_with_master +--source include/stop_slave.inc +--eval set global slave_parallel_threads = $slave_parallel_threads; +--eval set global slave_parallel_mode = $slave_parallel_mode; +--eval set global gtid_strict_mode = $gtid_strict_mode; +--source include/start_slave.inc diff --git a/mysql-test/suite/rpl/r/create_or_replace2.result b/mysql-test/suite/rpl/r/create_or_replace2.result index b96a0f8ae134b..adcceaf97dd34 100644 --- a/mysql-test/suite/rpl/r/create_or_replace2.result +++ b/mysql-test/suite/rpl/r/create_or_replace2.result @@ -14,7 +14,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection default; set session lock_wait_timeout=1; SELECT f1(); diff --git a/mysql-test/suite/rpl/r/create_or_replace_mix.result b/mysql-test/suite/rpl/r/create_or_replace_mix.result index 9036ab425ae06..3917b5b7c0544 100644 --- a/mysql-test/suite/rpl/r/create_or_replace_mix.result +++ b/mysql-test/suite/rpl/r/create_or_replace_mix.result @@ -123,7 +123,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `new_table` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection server_1; drop table t1; # @@ -200,7 +200,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `server_2_ver_2` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci binlog from server 2 include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info diff --git a/mysql-test/suite/rpl/r/create_or_replace_row.result b/mysql-test/suite/rpl/r/create_or_replace_row.result index 16f92b5e4b6cd..3bb998397511b 100644 --- a/mysql-test/suite/rpl/r/create_or_replace_row.result +++ b/mysql-test/suite/rpl/r/create_or_replace_row.result @@ -149,7 +149,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `new_table` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection server_1; drop table t1; # @@ -226,7 +226,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `server_2_ver_2` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci binlog from server 2 include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info diff --git a/mysql-test/suite/rpl/r/create_or_replace_statement.result b/mysql-test/suite/rpl/r/create_or_replace_statement.result index 9036ab425ae06..3917b5b7c0544 100644 --- a/mysql-test/suite/rpl/r/create_or_replace_statement.result +++ b/mysql-test/suite/rpl/r/create_or_replace_statement.result @@ -123,7 +123,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `new_table` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection server_1; drop table t1; # @@ -200,7 +200,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `server_2_ver_2` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci binlog from server 2 include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info diff --git a/mysql-test/suite/rpl/r/mdev_17588.result b/mysql-test/suite/rpl/r/mdev_17588.result index 54990a450e3d2..57c416a2c5bb0 100644 --- a/mysql-test/suite/rpl/r/mdev_17588.result +++ b/mysql-test/suite/rpl/r/mdev_17588.result @@ -18,7 +18,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t1; ERROR 42S02: Table 'test.t1' doesn't exist show create table t3; diff --git a/mysql-test/suite/rpl/r/mdev_24667.result b/mysql-test/suite/rpl/r/mdev_24667.result new file mode 100644 index 0000000000000..7c7342d63d620 --- /dev/null +++ b/mysql-test/suite/rpl/r/mdev_24667.result @@ -0,0 +1,30 @@ +include/rpl_init.inc [topology=1->2->3] +call mtr.add_suppression('Unsafe statement written to the binary log using '); +connection server_1; +set binlog_format=statement; +#first bug +create table t1 (a int); +create temporary table tmp like t1; +load data local infile 'MYSQLTEST_VARDIR/load_data' INTO TABLE tmp; +insert into t1 select * from tmp; +#second bug +create table t2 (a int); +create temporary table tmp2 like t2; +insert into tmp2 values(10); +update tmp2 set a = 20 limit 1; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted +insert into t2 select * from tmp2; +connection server_2; +connection server_3; +#t1 should have 2 rows +select count(*) = 2 from t1; +count(*) = 2 +1 +#t2 should have 1 rows with a = 20 +select * from t2; +a +20 +connection server_1; +drop table t1, t2, tmp, tmp2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/parallel_backup.result b/mysql-test/suite/rpl/r/parallel_backup.result index 9d394a220d57f..7cf72ed15e41a 100644 --- a/mysql-test/suite/rpl/r/parallel_backup.result +++ b/mysql-test/suite/rpl/r/parallel_backup.result @@ -8,6 +8,8 @@ connection master; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = innodb; INSERT INTO t1 VALUES(100); connection slave; +call mtr.add_suppression("Deadlock found when trying to get lock"); +call mtr.add_suppression("Commit failed due to failure of an earlier commit"); include/stop_slave.inc SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads; SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; @@ -31,6 +33,167 @@ connection backup_slave; BACKUP STAGE END; connection slave; include/diff_tables.inc [master:t1,slave:t1] +# MDEV-30423: dealock XA COMMIT vs BACKUP +# +# Normal XA COMMIT +connection slave; +include/stop_slave.inc +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (102); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (101); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (102); +connection master; +XA COMMIT '1'; +include/save_master_gtid.inc +connection slave; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +# +# Normal XA ROLLBACK +connection slave; +include/stop_slave.inc +Warnings: +Note 1255 Slave already has been stopped +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (104); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (103); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (104); +connection master; +XA ROLLBACK '1'; +include/save_master_gtid.inc +connection slave; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +# +# Errored out XA COMMIT +connection slave; +include/stop_slave.inc +Warnings: +Note 1255 Slave already has been stopped +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (106); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (105); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (106); +connection master; +XA COMMIT '1'; +include/save_master_gtid.inc +connection slave; +SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; +SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; +SET @@global.innodb_lock_wait_timeout =1; +SET @@global.slave_transaction_retries=0; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/stop_slave.inc +SET @@global.innodb_lock_wait_timeout = @sav_innodb_lock_wait_timeout; +SET @@global.slave_transaction_retries= @sav_slave_transaction_retries; +connection slave; +include/start_slave.inc +include/sync_with_master_gtid.inc +# +# Errored out XA ROLLBACK +connection slave; +include/stop_slave.inc +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (108); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (107); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (108); +connection master; +XA ROLLBACK '1'; +include/save_master_gtid.inc +connection slave; +SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; +SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; +SET @@global.innodb_lock_wait_timeout =1; +SET @@global.slave_transaction_retries=0; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/stop_slave.inc +SET @@global.innodb_lock_wait_timeout = @sav_innodb_lock_wait_timeout; +SET @@global.slave_transaction_retries= @sav_slave_transaction_retries; +connection slave; +include/start_slave.inc +include/sync_with_master_gtid.inc connection slave; include/stop_slave.inc SET @@global.slave_parallel_threads= @old_parallel_threads; diff --git a/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result b/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result new file mode 100644 index 0000000000000..b89cb154f241d --- /dev/null +++ b/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result @@ -0,0 +1,207 @@ +# Specialized --log-slave-updates = 0 version of parallel_backup test. +# MDEV-21953: deadlock between BACKUP STAGE BLOCK_COMMIT and parallel +# MDEV-30423: dealock XA COMMIT vs BACKUP +include/master-slave.inc +[connection master] +# +# MDEV-21953: deadlock between BACKUP STAGE BLOCK_COMMIT and parallel +# replication +# +connection master; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = innodb; +INSERT INTO t1 VALUES(100); +connection slave; +call mtr.add_suppression("Deadlock found when trying to get lock"); +call mtr.add_suppression("Commit failed due to failure of an earlier commit"); +include/stop_slave.inc +SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; +SET @@global.slave_parallel_threads= 2; +SET @@global.slave_parallel_mode = 'optimistic'; +connection master; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +connect aux_slave,127.0.0.1,root,,test,$SLAVE_MYPORT,; +BEGIN; +INSERT INTO t1 VALUES (1); +connection slave; +include/start_slave.inc +connection aux_slave; +connect backup_slave,127.0.0.1,root,,test,$SLAVE_MYPORT,; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/diff_tables.inc [master:t1,slave:t1] +# MDEV-30423: dealock XA COMMIT vs BACKUP +# +# Normal XA COMMIT +connection slave; +include/stop_slave.inc +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (102); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (101); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (102); +connection master; +XA COMMIT '1'; +include/save_master_gtid.inc +connection slave; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +# +# Normal XA ROLLBACK +connection slave; +include/stop_slave.inc +Warnings: +Note 1255 Slave already has been stopped +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (104); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (103); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (104); +connection master; +XA ROLLBACK '1'; +include/save_master_gtid.inc +connection slave; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +# +# Errored out XA COMMIT +connection slave; +include/stop_slave.inc +Warnings: +Note 1255 Slave already has been stopped +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (106); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (105); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (106); +connection master; +XA COMMIT '1'; +include/save_master_gtid.inc +connection slave; +SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; +SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; +SET @@global.innodb_lock_wait_timeout =1; +SET @@global.slave_transaction_retries=0; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/stop_slave.inc +SET @@global.innodb_lock_wait_timeout = @sav_innodb_lock_wait_timeout; +SET @@global.slave_transaction_retries= @sav_slave_transaction_retries; +connection slave; +include/start_slave.inc +include/sync_with_master_gtid.inc +# +# Errored out XA ROLLBACK +connection slave; +include/stop_slave.inc +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (108); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (107); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (108); +connection master; +XA ROLLBACK '1'; +include/save_master_gtid.inc +connection slave; +SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; +SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; +SET @@global.innodb_lock_wait_timeout =1; +SET @@global.slave_transaction_retries=0; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/stop_slave.inc +SET @@global.innodb_lock_wait_timeout = @sav_innodb_lock_wait_timeout; +SET @@global.slave_transaction_retries= @sav_slave_transaction_retries; +connection slave; +include/start_slave.inc +include/sync_with_master_gtid.inc +connection slave; +include/stop_slave.inc +SET @@global.slave_parallel_threads= @old_parallel_threads; +SET @@global.slave_parallel_mode = @old_parallel_mode; +include/start_slave.inc +connection server_1; +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result b/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result new file mode 100644 index 0000000000000..111bc7fb76fa7 --- /dev/null +++ b/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result @@ -0,0 +1,207 @@ +# Specialized --skip-log-bin slave version of parallel_backup test. +# MDEV-21953: deadlock between BACKUP STAGE BLOCK_COMMIT and parallel +# MDEV-30423: dealock XA COMMIT vs BACKUP +include/master-slave.inc +[connection master] +# +# MDEV-21953: deadlock between BACKUP STAGE BLOCK_COMMIT and parallel +# replication +# +connection master; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = innodb; +INSERT INTO t1 VALUES(100); +connection slave; +call mtr.add_suppression("Deadlock found when trying to get lock"); +call mtr.add_suppression("Commit failed due to failure of an earlier commit"); +include/stop_slave.inc +SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; +SET @@global.slave_parallel_threads= 2; +SET @@global.slave_parallel_mode = 'optimistic'; +connection master; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +connect aux_slave,127.0.0.1,root,,test,$SLAVE_MYPORT,; +BEGIN; +INSERT INTO t1 VALUES (1); +connection slave; +include/start_slave.inc +connection aux_slave; +connect backup_slave,127.0.0.1,root,,test,$SLAVE_MYPORT,; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/diff_tables.inc [master:t1,slave:t1] +# MDEV-30423: dealock XA COMMIT vs BACKUP +# +# Normal XA COMMIT +connection slave; +include/stop_slave.inc +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (102); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (101); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (102); +connection master; +XA COMMIT '1'; +include/save_master_gtid.inc +connection slave; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +# +# Normal XA ROLLBACK +connection slave; +include/stop_slave.inc +Warnings: +Note 1255 Slave already has been stopped +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (104); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (103); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (104); +connection master; +XA ROLLBACK '1'; +include/save_master_gtid.inc +connection slave; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +# +# Errored out XA COMMIT +connection slave; +include/stop_slave.inc +Warnings: +Note 1255 Slave already has been stopped +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (106); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (105); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (106); +connection master; +XA COMMIT '1'; +include/save_master_gtid.inc +connection slave; +SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; +SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; +SET @@global.innodb_lock_wait_timeout =1; +SET @@global.slave_transaction_retries=0; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/stop_slave.inc +SET @@global.innodb_lock_wait_timeout = @sav_innodb_lock_wait_timeout; +SET @@global.slave_transaction_retries= @sav_slave_transaction_retries; +connection slave; +include/start_slave.inc +include/sync_with_master_gtid.inc +# +# Errored out XA ROLLBACK +connection slave; +include/stop_slave.inc +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (108); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (107); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (108); +connection master; +XA ROLLBACK '1'; +include/save_master_gtid.inc +connection slave; +SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; +SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; +SET @@global.innodb_lock_wait_timeout =1; +SET @@global.slave_transaction_retries=0; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/stop_slave.inc +SET @@global.innodb_lock_wait_timeout = @sav_innodb_lock_wait_timeout; +SET @@global.slave_transaction_retries= @sav_slave_transaction_retries; +connection slave; +include/start_slave.inc +include/sync_with_master_gtid.inc +connection slave; +include/stop_slave.inc +SET @@global.slave_parallel_threads= @old_parallel_threads; +SET @@global.slave_parallel_mode = @old_parallel_mode; +include/start_slave.inc +connection server_1; +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rename.result b/mysql-test/suite/rpl/r/rename.result index 8220ae1f3b1b3..9244a3d1104c9 100644 --- a/mysql-test/suite/rpl/r/rename.result +++ b/mysql-test/suite/rpl/r/rename.result @@ -11,7 +11,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE VIEW v AS SELECT * FROM t1; ERROR HY000: View's SELECT refers to a temporary table 't1' RENAME TABLE t1 TO tmp, t1 TO t2; @@ -19,12 +19,12 @@ SHOW CREATE TABLE tmp; Table Create Table tmp CREATE TEMPORARY TABLE `tmp` ( `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE VIEW v AS SELECT * FROM tmp; ERROR HY000: View's SELECT refers to a temporary table 'tmp' CREATE VIEW v AS SELECT * FROM t2; diff --git a/mysql-test/suite/rpl/r/rpl_alter.result b/mysql-test/suite/rpl/r/rpl_alter.result index 4f709db96249c..773fa32d70925 100644 --- a/mysql-test/suite/rpl/r/rpl_alter.result +++ b/mysql-test/suite/rpl/r/rpl_alter.result @@ -29,7 +29,7 @@ t1 CREATE TABLE `t1` ( `a` int(10) unsigned NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 (a) values (1),((1<<32)-1); select * from t1; a b @@ -42,7 +42,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; a b 1 NULL @@ -54,7 +54,7 @@ t1 CREATE TABLE `t1` ( `a` int(10) unsigned NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; a b 1 NULL @@ -66,7 +66,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; a b 1 NULL @@ -83,7 +83,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; create table t2 (a int unsigned auto_increment primary key, b int); show create table t2; @@ -92,7 +92,7 @@ t2 CREATE TABLE `t2` ( `a` int(10) unsigned NOT NULL AUTO_INCREMENT, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t2 modify a bigint; show create table t2; Table Create Table @@ -100,7 +100,7 @@ t2 CREATE TABLE `t2` ( `a` bigint(20) NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t2 modify a bigint auto_increment; show create table t2; Table Create Table @@ -108,7 +108,7 @@ t2 CREATE TABLE `t2` ( `a` bigint(20) NOT NULL AUTO_INCREMENT, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1,t2; # # MDEV-8432: Slave cannot replicate signed integer-type values diff --git a/mysql-test/suite/rpl/r/rpl_alter_rollback.result b/mysql-test/suite/rpl/r/rpl_alter_rollback.result new file mode 100644 index 0000000000000..3bd91a516c45f --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_alter_rollback.result @@ -0,0 +1,54 @@ +# +# Test verifies that "ROLLBACK ALTER" is written to binary log upon +#ALTER command execution failure. +# +include/master-slave.inc +[connection master] +connection master; +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; +create table t1 (f1 int primary key) engine=InnoDB; +create table t2 (f1 int primary key, +constraint c1 foreign key (f1) references t1(f1), +constraint c1 foreign key (f1) references t1(f1)) engine=InnoDB; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +create table t2 (f1 int primary key, +constraint c1 foreign key (f1) references t1(f1)) engine=innodb; +alter table t2 add constraint c1 foreign key (f1) references t1(f1); +ERROR HY000: Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update") +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; create table t1 (f1 int primary key) engine=InnoDB +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; create table t2 (f1 int primary key, +constraint c1 foreign key (f1) references t1(f1)) engine=innodb +master-bin.000001 # Gtid # # GTID #-#-# START ALTER +master-bin.000001 # Query # # use `test`; alter table t2 add constraint c1 foreign key (f1) references t1(f1) +master-bin.000001 # Gtid # # GTID #-#-# ROLLBACK ALTER id=# +master-bin.000001 # Query # # use `test`; alter table t2 add constraint c1 foreign key (f1) references t1(f1) +set foreign_key_checks = 0; +alter table t2 add constraint c1 foreign key (f1) references t1(f1); +ERROR HY000: Duplicate FOREIGN KEY constraint name 'test/c1' +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; create table t1 (f1 int primary key) engine=InnoDB +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; create table t2 (f1 int primary key, +constraint c1 foreign key (f1) references t1(f1)) engine=innodb +master-bin.000001 # Gtid # # GTID #-#-# START ALTER +master-bin.000001 # Query # # use `test`; alter table t2 add constraint c1 foreign key (f1) references t1(f1) +master-bin.000001 # Gtid # # GTID #-#-# ROLLBACK ALTER id=# +master-bin.000001 # Query # # use `test`; alter table t2 add constraint c1 foreign key (f1) references t1(f1) +master-bin.000001 # Gtid # # GTID #-#-# START ALTER +master-bin.000001 # Query # # use `test`; set foreign_key_checks=1; alter table t2 add constraint c1 foreign key (f1) references t1(f1) +master-bin.000001 # Gtid # # GTID #-#-# ROLLBACK ALTER id=# +master-bin.000001 # Query # # use `test`; set foreign_key_checks=1; alter table t2 add constraint c1 foreign key (f1) references t1(f1) +connection slave; +connection master; +drop table t2, t1; +connection slave; +connection master; +set global binlog_alter_two_phase=0;; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment.result b/mysql-test/suite/rpl/r/rpl_auto_increment.result index 48617a0f71301..fcbce494afc35 100644 --- a/mysql-test/suite/rpl/r/rpl_auto_increment.result +++ b/mysql-test/suite/rpl/r/rpl_auto_increment.result @@ -251,14 +251,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection slave; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; drop table t1; include/rpl_reset.inc diff --git a/mysql-test/suite/rpl/r/rpl_binlog_rollback_cleanup.result b/mysql-test/suite/rpl/r/rpl_binlog_rollback_cleanup.result index 90446776e5b8e..c434b91f1914d 100644 --- a/mysql-test/suite/rpl/r/rpl_binlog_rollback_cleanup.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_rollback_cleanup.result @@ -3,7 +3,7 @@ include/master-slave.inc connection master; SET GLOBAL max_binlog_cache_size = 65536; CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=INNODB; -ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE; DROP TABLE t1; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result b/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result index 64e555e96e1d4..b125b6b5c6cde 100644 --- a/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result +++ b/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result @@ -200,11 +200,11 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (a INT, b INT, c INT) diff --git a/mysql-test/suite/rpl/r/rpl_bug26395.result b/mysql-test/suite/rpl/r/rpl_bug26395.result index 2eec488b3afd5..7c54e7b2e5475 100644 --- a/mysql-test/suite/rpl/r/rpl_bug26395.result +++ b/mysql-test/suite/rpl/r/rpl_bug26395.result @@ -7,7 +7,7 @@ SHOW CREATE TABLE tinnodb; Table Create Table tinnodb CREATE TABLE `tinnodb` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci set @old_debug= @@debug; set @@debug_dbug= 'd,do_not_write_xid'; ==== Test ==== diff --git a/mysql-test/suite/rpl/r/rpl_charset.result b/mysql-test/suite/rpl/r/rpl_charset.result index 5bda623172b3c..1ba23d7a3e72e 100644 --- a/mysql-test/suite/rpl/r/rpl_charset.result +++ b/mysql-test/suite/rpl/r/rpl_charset.result @@ -6,17 +6,17 @@ set @@character_set_server=latin5; create database mysqltest3; show create database mysqltest2; Database Create Database -mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */ +mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 COLLATE latin2_general_ci */ show create database mysqltest3; Database Create Database -mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */ +mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 COLLATE latin5_turkish_ci */ connection slave; show create database mysqltest2; Database Create Database -mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */ +mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 COLLATE latin2_general_ci */ show create database mysqltest3; Database Create Database -mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */ +mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 COLLATE latin5_turkish_ci */ connection master; set @@collation_server=armscii8_bin; drop database mysqltest3; @@ -135,7 +135,7 @@ connection slave; SHOW CREATE TABLE db1.t1; Table Create Table t1 CREATE TABLE `t1` ( - `CHR(0x60)` varchar(4) COLLATE latin1_bin DEFAULT NULL + `CHR(0x60)` varchar(4) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin connection master; USE test; diff --git a/mysql-test/suite/rpl/r/rpl_circular_semi_sync.result b/mysql-test/suite/rpl/r/rpl_circular_semi_sync.result new file mode 100644 index 0000000000000..5664b7913d22d --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_circular_semi_sync.result @@ -0,0 +1,163 @@ +include/master-slave.inc +[connection master] +# Master server_1 and Slave server_2 initialization ... +connection server_2; +include/stop_slave.inc +connection server_1; +RESET MASTER; +set @@session.gtid_domain_id=10; +set @@global.rpl_semi_sync_master_enabled = 1; +set @@global.rpl_semi_sync_master_wait_point=AFTER_SYNC; +connection server_2; +RESET MASTER; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +set @@session.gtid_domain_id=20; +set @@global.rpl_semi_sync_slave_enabled = 1; +# a 1948 warning is expected +set @@global.gtid_slave_pos = ""; +Warnings: +Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-1. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos +CHANGE MASTER TO master_use_gtid= slave_pos; +include/start_slave.inc +# server_1 -> server_2 semisync link is set up. +connection server_1; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT default 0) ENGINE=Innodb; +INSERT INTO t1(a) VALUES (1); +include/save_master_gtid.inc +connection server_2; +include/sync_with_master_gtid.inc +# Circular configuration server_1 -> server_2 -> server_1 ... +connection server_1; +set @@global.gtid_strict_mode = true; +set @@global.rpl_semi_sync_slave_enabled = 1; +CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_2, master_user='root', master_use_gtid=SLAVE_POS; +include/start_slave.inc +... is done. +## A. no out-of-order gtid error for own transaction made round trip +connection server_2; +set @@global.gtid_strict_mode = true; +set @@global.rpl_semi_sync_master_enabled = 1; +INSERT INTO t1(a) VALUES (2); +include/save_master_gtid.inc +connection server_1; +# +# the successful sync is a required proof +# +include/sync_with_master_gtid.inc +update t1 set b=b+1 where a=2; +include/save_master_gtid.inc +connection server_2; +include/sync_with_master_gtid.inc +# Post-execution state check on both servers synchronized with each other +connection server_1; +# ... the gtid states on server_1 +SHOW VARIABLES LIKE 'gtid_slave_pos'; +Variable_name Value +gtid_slave_pos 0-2-1,10-1-3,20-2-1 +SHOW VARIABLES LIKE 'gtid_binlog_pos'; +Variable_name Value +gtid_binlog_pos 0-2-1,10-1-3,20-2-1 +SELECT * from t1; +a b +1 0 +2 1 +connection server_2; +# The gtid states on server_2 must be equal to ... +SHOW VARIABLES LIKE 'gtid_binlog_pos'; +Variable_name Value +gtid_binlog_pos 0-2-1,10-1-3,20-2-1 +SHOW VARIABLES LIKE 'gtid_slave_pos'; +Variable_name Value +gtid_slave_pos 0-2-1,10-1-3,20-2-1 +SELECT * from t1; +a b +1 0 +2 1 +## B. out-of-order gtid error for a "foreign" server-id transaction +connection server_1; +set statement sql_log_bin=0 for call mtr.add_suppression("Slave: An attempt was made to binlog GTID 10-2-4"); +set @@session.server_id=2; +INSERT INTO t1(a) VALUES (3); +set @@session.server_id=default; +include/save_master_gtid.inc +connection server_2; +include/sync_with_master_gtid.inc +INSERT INTO t1(a) VALUES (4); +include/save_master_gtid.inc +connection server_1; +include/wait_for_slave_sql_error.inc [errno=1950] +set sql_slave_skip_counter=1; +include/start_slave.inc +include/sync_with_master_gtid.inc +connection server_2; +set statement sql_log_bin=0 for call mtr.add_suppression("Slave: An attempt was made to binlog GTID 20-1-3"); +set @@session.server_id=1; +INSERT INTO t1(a) VALUES (5); +set @@session.server_id=default; +include/save_master_gtid.inc +connection server_1; +include/sync_with_master_gtid.inc +INSERT INTO t1(a) VALUES (6); +include/save_master_gtid.inc +connection server_2; +include/wait_for_slave_sql_error.inc [errno=1950] +set sql_slave_skip_counter=1; +include/start_slave.inc +include/sync_with_master_gtid.inc +# Post-execution state check on both servers synchronized with each other +connection server_1; +# ... the gtid states on server_1 +SHOW VARIABLES LIKE 'gtid_slave_pos'; +Variable_name Value +gtid_slave_pos 0-2-1,10-1-5,20-1-3 +SHOW VARIABLES LIKE 'gtid_binlog_pos'; +Variable_name Value +gtid_binlog_pos 0-2-1,10-1-5,20-1-3 +SELECT * from t1; +a b +1 0 +2 1 +3 0 +4 0 +5 0 +6 0 +connection server_2; +include/sync_with_master_gtid.inc +# The gtid states on server_2 must be equal to ... +SHOW VARIABLES LIKE 'gtid_binlog_pos'; +Variable_name Value +gtid_binlog_pos 0-2-1,10-1-5,20-1-3 +SHOW VARIABLES LIKE 'gtid_slave_pos'; +Variable_name Value +gtid_slave_pos 0-2-1,10-1-5,20-1-3 +SELECT * from t1; +a b +1 0 +2 1 +3 0 +4 0 +5 0 +6 0 +# +# Cleanup +# +connection server_1; +DROP TABLE t1; +include/save_master_gtid.inc +connection server_2; +include/sync_with_master_gtid.inc +connection server_1; +include/stop_slave.inc +set @@global.rpl_semi_sync_master_enabled = default; +set @@global.rpl_semi_sync_slave_enabled = default; +set @@global.rpl_semi_sync_master_wait_point=default; +set @@global.gtid_ignore_duplicates = default; +set @@global.gtid_strict_mode = default; +connection server_2; +include/stop_slave.inc +set @@global.gtid_ignore_duplicates = default; +set @@global.rpl_semi_sync_master_enabled = default; +set @@global.rpl_semi_sync_slave_enabled = default; +set @@global.gtid_strict_mode = default; +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_colSize.result b/mysql-test/suite/rpl/r/rpl_colSize.result index 503bf85222e71..5d72ddcec0905 100644 --- a/mysql-test/suite/rpl/r/rpl_colSize.result +++ b/mysql-test/suite/rpl/r/rpl_colSize.result @@ -120,7 +120,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(100) DEFAULT NULL, `c` varchar(300) DEFAULT NULL, `d` char(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection slave; Insert some values and select them on slave SELECT * FROM t1; @@ -133,7 +133,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(400) DEFAULT NULL, `c` varchar(500) DEFAULT NULL, `d` char(100) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; DROP TABLE t1; Create bit table on master @@ -174,7 +174,7 @@ t1 CREATE TABLE `t1` ( `c` bit(21) DEFAULT NULL, `d` bit(11) DEFAULT NULL, `e` bit(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection slave; Insert some values and select them on master SELECT BIN(a), BIN(b), BIN(c), BIN(d), BIN(e) FROM t1; @@ -188,7 +188,7 @@ t1 CREATE TABLE `t1` ( `c` bit(54) DEFAULT NULL, `d` bit(25) DEFAULT NULL, `e` bit(13) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci *** Cleanup *** connection master; DROP TABLE t1; diff --git a/mysql-test/suite/rpl/r/rpl_create_drop_function.result b/mysql-test/suite/rpl/r/rpl_create_drop_function.result index 312175fcf0438..238d8812747d5 100644 --- a/mysql-test/suite/rpl/r/rpl_create_drop_function.result +++ b/mysql-test/suite/rpl/r/rpl_create_drop_function.result @@ -9,7 +9,7 @@ ERROR 42000: FUNCTION hello already exists connection slave; SHOW CREATE FUNCTION hello; Function sql_mode Create Function character_set_client collation_connection Database Collation -hello STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `hello`(str CHAR(20)) RETURNS char(50) CHARSET latin1 +hello STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `hello`(str CHAR(20)) RETURNS char(50) CHARSET latin1 COLLATE latin1_swedish_ci DETERMINISTIC RETURN CONCAT('Hello, ', str, '!') latin1 latin1_swedish_ci latin1_swedish_ci diff --git a/mysql-test/suite/rpl/r/rpl_create_drop_index.result b/mysql-test/suite/rpl/r/rpl_create_drop_index.result index f0d5bdf46b930..979dd0fa38a84 100644 --- a/mysql-test/suite/rpl/r/rpl_create_drop_index.result +++ b/mysql-test/suite/rpl/r/rpl_create_drop_index.result @@ -11,7 +11,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `i1` (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; SHOW CREATE TABLE t1; Table Create Table @@ -19,7 +19,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `i1` (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; connection slave; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result index fd50e98414ff8..491b27252b48d 100644 --- a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result @@ -11,18 +11,18 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, KEY `a` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `a` int(11) NOT NULL, KEY `a` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW VARIABLES LIKE 'slave_transaction_retries'; Variable_name Value slave_transaction_retries 2 diff --git a/mysql-test/suite/rpl/r/rpl_default.result b/mysql-test/suite/rpl/r/rpl_default.result index 32e93a976acf8..205e5dea57a09 100644 --- a/mysql-test/suite/rpl/r/rpl_default.result +++ b/mysql-test/suite/rpl/r/rpl_default.result @@ -11,7 +11,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT (1 + 1), `b` bigint(20) DEFAULT uuid_short(), `u` blob DEFAULT user() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci a uuid user 1 1 1 connection master; diff --git a/mysql-test/suite/rpl/r/rpl_delayed_parallel_slave_sbm.result b/mysql-test/suite/rpl/r/rpl_delayed_parallel_slave_sbm.result new file mode 100644 index 0000000000000..b00a8a5e1d736 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_delayed_parallel_slave_sbm.result @@ -0,0 +1,72 @@ +include/master-slave.inc +[connection master] +connection slave; +include/stop_slave.inc +change master to master_delay=3, master_use_gtid=Slave_Pos; +set @@GLOBAL.slave_parallel_threads=2; +include/start_slave.inc +connection master; +create table t1 (a int); +include/sync_slave_sql_with_master.inc +# +# Pt 1) Ensure SBM is updated immediately upon arrival of the next event +# Lock t1 on slave so the first received transaction does not complete/commit +connection slave; +LOCK TABLES t1 WRITE; +connection master; +# Sleep 2 to allow a buffer between events for SBM check +insert into t1 values (0); +include/save_master_gtid.inc +connection slave; +# Waiting for transaction to arrive on slave and begin SQL Delay.. +# Validating SBM is updated on event arrival.. +# ..done +connection slave; +UNLOCK TABLES; +include/sync_with_master_gtid.inc +# +# Pt 2) If the SQL thread has not entered an idle state, ensure +# following events do not update SBM +# Stop slave IO thread so it receives both events together on restart +connection slave; +include/stop_slave_io.inc +connection master; +# Sleep 2 to allow a buffer between events for SBM check +insert into t1 values (1); +# Sleep 3 to create gap between events +insert into t1 values (2); +include/save_master_pos.inc +connection slave; +LOCK TABLES t1 WRITE; +SET @@global.debug_dbug="+d,pause_sql_thread_on_next_event"; +START SLAVE IO_THREAD; +# Before we start processing the events, we ensure both transactions +# were written into the relay log. Otherwise, if the IO thread takes too +# long to queue the events, the sql thread can think it has caught up +# too quickly. +SET DEBUG_SYNC='now WAIT_FOR paused_on_event'; +include/sync_io_with_master.inc +SET @@global.debug_dbug="-d,pause_sql_thread_on_next_event"; +SET DEBUG_SYNC='now SIGNAL sql_thread_continue'; +# Wait for first transaction to complete SQL delay and begin execution.. +# Validate SBM calculation doesn't use the second transaction because SQL thread shouldn't have gone idle.. +# ..and that SBM wasn't calculated using prior committed transactions +# ..done +connection slave; +UNLOCK TABLES; +# +# Cleanup +# Reset master_delay +include/stop_slave.inc +CHANGE MASTER TO master_delay=0; +set @@GLOBAL.slave_parallel_threads=4; +SET @@global.debug_dbug=""; +SET DEBUG_SYNC='RESET'; +include/start_slave.inc +connection master; +DROP TABLE t1; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +include/rpl_end.inc +# End of rpl_delayed_parallel_slave_sbm.test diff --git a/mysql-test/suite/rpl/r/rpl_do_grant.result b/mysql-test/suite/rpl/r/rpl_do_grant.result index e4b0880028781..0d2908809b9eb 100644 --- a/mysql-test/suite/rpl/r/rpl_do_grant.result +++ b/mysql-test/suite/rpl/r/rpl_do_grant.result @@ -135,7 +135,7 @@ GRANT EXECUTE, ALTER ROUTINE ON FUNCTION `bug42217_db`.`upgrade_del_func` TO `cr USE bug42217_db; SHOW CREATE FUNCTION upgrade_del_func; Function sql_mode Create Function character_set_client collation_connection Database Collation -upgrade_del_func STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1 +upgrade_del_func STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1 COLLATE latin1_swedish_ci BEGIN RETURN "INSIDE upgrade_del_func()"; END latin1 latin1_swedish_ci latin1_swedish_ci @@ -147,7 +147,7 @@ connection create_rout_db_slave; USE bug42217_db; SHOW CREATE FUNCTION upgrade_del_func; Function sql_mode Create Function character_set_client collation_connection Database Collation -upgrade_del_func STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1 +upgrade_del_func STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1 COLLATE latin1_swedish_ci BEGIN RETURN "INSIDE upgrade_del_func()"; END latin1 latin1_swedish_ci latin1_swedish_ci @@ -176,7 +176,7 @@ INSIDE upgrade_alter_func() connection slave; SHOW CREATE FUNCTION upgrade_alter_func; Function sql_mode Create Function character_set_client collation_connection Database Collation -upgrade_alter_func STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_alter_func`() RETURNS char(30) CHARSET latin1 +upgrade_alter_func STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_alter_func`() RETURNS char(30) CHARSET latin1 COLLATE latin1_swedish_ci BEGIN RETURN "INSIDE upgrade_alter_func()"; END latin1 latin1_swedish_ci latin1_swedish_ci diff --git a/mysql-test/suite/rpl/r/rpl_empty_string_is_null.result b/mysql-test/suite/rpl/r/rpl_empty_string_is_null.result new file mode 100644 index 0000000000000..9d0b0295b0d0f --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_empty_string_is_null.result @@ -0,0 +1,16 @@ +include/master-slave.inc +[connection master] +# +# MDEV-18918 SQL mode EMPTY_STRING_IS_NULL breaks RBR upon CREATE TABLE .. SELECT +# +SET SQL_MODE= 'EMPTY_STRING_IS_NULL'; +CREATE TABLE t1 AS SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE 1 = 0; +connection slave; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `TABLE_NAME` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master; +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result b/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result index a9cbbd9fafef6..13077c08e89c9 100644 --- a/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result @@ -661,7 +661,7 @@ t16 CREATE TABLE `t16` ( `c4` blob DEFAULT NULL, `c5` char(5) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`c1`) PARTITIONS 4 *** Show table on Slave **** @@ -677,7 +677,7 @@ t16 CREATE TABLE `t16` ( `c6` int(11) DEFAULT 1, `c7` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`c1`) PARTITIONS 4 *** DROP TABLE t16 *** diff --git a/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result b/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result index 11a716f22b61e..897a87db66f42 100644 --- a/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result @@ -661,7 +661,7 @@ t16 CREATE TABLE `t16` ( `c4` blob DEFAULT NULL, `c5` char(5) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`c1`) PARTITIONS 4 *** Show table on Slave **** @@ -677,7 +677,7 @@ t16 CREATE TABLE `t16` ( `c6` int(11) DEFAULT 1, `c7` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`c1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`c1`) PARTITIONS 4 *** DROP TABLE t16 *** diff --git a/mysql-test/suite/rpl/r/rpl_filter_revoke_missing_user.result b/mysql-test/suite/rpl/r/rpl_filter_revoke_missing_user.result new file mode 100644 index 0000000000000..efd73d889645c --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_filter_revoke_missing_user.result @@ -0,0 +1,39 @@ +include/master-slave.inc +[connection master] +# +# Set replica to ignore system tables +connection slave; +include/stop_slave.inc +SET @@GLOBAL.replicate_wild_ignore_table="mysql.%"; +include/start_slave.inc +# +# Trying to execute REVOKE ALL PRIVILEGES on a non-existent user and +# DROP USER on a list of users where not all users exist should error +# and be written into the binary log +connection master; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'nonexistentuser'@'%'; +ERROR HY000: Can't revoke all privileges for one or more of the requested users +CREATE USER 'testuser'@'localhost' IDENTIFIED by ''; +DROP USER 'testuser'@'localhost', 'nonexistentuser'@'%'; +ERROR HY000: Operation DROP USER failed for 'nonexistentuser'@'%' +# +# Ensure the events exist in the primary's binary log +FLUSH BINARY LOGS; +# MYSQL_BINLOG MYSQLD_DATADIR/binlog_file > MYSQL_TMP_DIR/mysqlbinlog_out.sql +# There should be three Query events: REVOKE, CREATE USER, and DROP USER +FOUND 3 /Query/ in mysqlbinlog_out.sql +FOUND 1 /REVOKE ALL PRIVILEGES/ in mysqlbinlog_out.sql +FOUND 1 /CREATE USER/ in mysqlbinlog_out.sql +FOUND 1 /DROP USER/ in mysqlbinlog_out.sql +# +# Ensure that the replica receives the event without error +connection slave; +Last_SQL_Error = +Last_SQL_Errno = 0 +# +# Clean up +connection slave; +include/stop_slave.inc +SET @@GLOBAL.replicate_wild_ignore_table=""; +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_filter_set_var_missing_data.result b/mysql-test/suite/rpl/r/rpl_filter_set_var_missing_data.result new file mode 100644 index 0000000000000..e232edae1ed71 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_filter_set_var_missing_data.result @@ -0,0 +1,55 @@ +include/master-slave.inc +[connection master] +# +# Set replica to ignore system mysql tables +connection slave; +include/stop_slave.inc +SET @@GLOBAL.replicate_wild_ignore_table="mysql.%"; +include/start_slave.inc +# +# Execute grant-based commands on primary which modify mysql system +# tables +connection master; +CREATE ROLE journalist; +CREATE USER testuser@localhost IDENTIFIED by ''; +GRANT journalist to testuser@localhost; +# +# Execute SET commands which use the previous user/role data +SET DEFAULT ROLE journalist for testuser@localhost; +SET PASSWORD for testuser@localhost= PASSWORD('123'); +include/save_master_gtid.inc +# +# Verify primary's grant tables have the correct user/role data +select count(*)=1 from mysql.user where User='testuser'; +count(*)=1 +1 +select count(*)=1 from mysql.roles_mapping where User='testuser'; +count(*)=1 +1 +# +# Ensure that the replica receives all of the primary's events without +# error +connection slave; +include/sync_with_master_gtid.inc +Last_SQL_Error = +Last_SQL_Errno = 0 +# +# Verify that the replica did not execute the master's commands +select count(*)=0 from mysql.user where User='testuser'; +count(*)=0 +1 +select count(*)=0 from mysql.roles_mapping where User='testuser'; +count(*)=0 +1 +# +# Clean up +connection master; +DROP ROLE journalist; +DROP USER testuser@localhost; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +SET @@GLOBAL.replicate_wild_ignore_table=""; +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result b/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result index 54156685806ad..4c35d42d90a20 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result @@ -3,6 +3,7 @@ include/master-slave.inc *** Test that we check against incorrect table definition for mysql.gtid_slave_pos *** connection master; CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; +call mtr.add_suppression("Incorrect definition of table mysql.gtid_slave_pos:.*"); connection slave; connection slave; include/stop_slave.inc @@ -83,16 +84,16 @@ ERROR 25000: You are not allowed to execute this command in a transaction ROLLBACK; SET GLOBAL gtid_strict_mode= 1; SET GLOBAL gtid_slave_pos = "0-1-1"; -ERROR HY000: Specified GTID 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-11. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos +ERROR HY000: Specified GTID 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-12. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos SET GLOBAL gtid_slave_pos = ""; -ERROR HY000: Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-11. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos +ERROR HY000: Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-12. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos SET GLOBAL gtid_strict_mode= 0; SET GLOBAL gtid_slave_pos = "0-1-1"; Warnings: -Warning 1947 Specified GTID 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-11. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos +Warning 1947 Specified GTID 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-12. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos SET GLOBAL gtid_slave_pos = ""; Warnings: -Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-11. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos +Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-12. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos RESET MASTER; SET GLOBAL gtid_slave_pos = "0-1-1"; START SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_gtid_glle_no_terminate.result b/mysql-test/suite/rpl/r/rpl_gtid_glle_no_terminate.result new file mode 100644 index 0000000000000..f4d257c2668c9 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_gtid_glle_no_terminate.result @@ -0,0 +1,46 @@ +include/master-slave.inc +[connection master] +connection slave; +include/stop_slave.inc +CHANGE MASTER TO MASTER_USE_GTID=slave_pos; +# +# Initialize test data +connection master; +create table t1 (a int); +SET @@session.server_id= 3; +create table t2 (a int); +include/save_master_gtid.inc +# +# Have the replica "reconnect" and the primary will send Gtid, Glle, DDL +connection slave; +set global gtid_slave_pos="0-3-1"; +include/start_slave.inc +include/sync_with_master_gtid.inc +# +# Ensure that the replica did not error +connection slave; +include/sync_with_master_gtid.inc +Last_SQL_Error = +Last_SQL_Errno = 0 +# +# Ensure that the primary sent a Glle after a Gtid event +include/show_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000002 # Rotate # # master-bin.000001;pos=POS +slave-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000002 # Gtid_list # # [] +slave-relay-bin.000002 # Binlog_checkpoint # # master-bin.000001 +slave-relay-bin.000002 # Gtid # # GTID #-#-# +slave-relay-bin.000002 # Gtid_list # # [#-#-#] +slave-relay-bin.000002 # Query # # use `test`; create table t2 (a int) +# +# Ensure the DDL was executed on the replica +# +# Cleanup +# t1 does not make it to the replica +connection master; +set sql_log_bin=0; +DROP TABLE t1; +set sql_log_bin=1; +DROP TABLE t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_gtid_grouping.result b/mysql-test/suite/rpl/r/rpl_gtid_grouping.result new file mode 100644 index 0000000000000..ad7d6116c49d9 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_gtid_grouping.result @@ -0,0 +1,54 @@ +include/master-slave.inc +[connection master] +connection slave; +call mtr.add_suppression("Unexpected break of being relay-logged GTID 0-27697-1000"); +call mtr.add_suppression("Relay log write failure: could not queue event from master"); +call mtr.add_suppression("The current group of events starts with a non-GTID"); +include/stop_slave.inc +CHANGE MASTER TO MASTER_USE_GTID=slave_pos; +include/start_slave.inc +connection master; +CREATE TABLE t (a INT) ENGINE=innodb; +INSERT INTO t VALUES(1); +### A. Simulate an unnoticeable loss of Xid event +connection slave; +SET @@global.debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000"; +connection master; +SET @@gtid_seq_no=1000; +set @@server_id=27697; +INSERT INTO t VALUES(1000); +set @@server_id=default; +INSERT INTO t VALUES(1001); +## Prove the error occurs. +connection slave; +include/wait_for_slave_io_error.inc [errno=1595] +## Prove the slave recovers after the simulation condtion is lifted. +SET @@global.debug_dbug=default; +include/start_slave.inc +### B. Do the same to GTID event. +connection slave; +SET @@global.debug_dbug="+d,slave_discard_gtid_0_x_1002"; +connection master; +SET @@gtid_seq_no=1002; +set @@server_id=27697; +INSERT INTO t VALUES(1002); +set @@server_id=default; +INSERT INTO t VALUES(1003); +## Prove the error occurs. +connection slave; +include/wait_for_slave_io_error.inc [errno=1595] +## Prove the slave recovers after the simulation condtion is lifted. +SET @@global.debug_dbug=default; +include/start_slave.inc +connection master; +connection slave; +include/diff_tables.inc [master:t,slave:t] +"===== Clean up =====" +connection slave; +include/stop_slave.inc +CHANGE MASTER TO MASTER_USE_GTID=no; +include/start_slave.inc +connection master; +DROP TABLE t; +SET GLOBAL LOG_WARNINGS=default; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_gtid_strict.result b/mysql-test/suite/rpl/r/rpl_gtid_strict.result index 27e7d1051257f..7a1e18c4dfd4e 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_strict.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_strict.result @@ -147,7 +147,7 @@ Table t3 Create Table CREATE TABLE `t3` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES (8); connection server_1; INSERT INTO t2 VALUES (3); diff --git a/mysql-test/suite/rpl/r/rpl_gtid_until.result b/mysql-test/suite/rpl/r/rpl_gtid_until.result index 2295aad34ac0d..1032b8ddd5ced 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_until.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_until.result @@ -193,7 +193,7 @@ SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci include/start_slave.inc *** Test UNTIL condition that has not yet been logged. *** connection server_2; diff --git a/mysql-test/suite/rpl/r/rpl_hrtime.result b/mysql-test/suite/rpl/r/rpl_hrtime.result index 406b1d145d1ff..03732198e734c 100644 --- a/mysql-test/suite/rpl/r/rpl_hrtime.result +++ b/mysql-test/suite/rpl/r/rpl_hrtime.result @@ -37,11 +37,11 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1293832861/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b varchar(100), c datetime(2)) diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table.result b/mysql-test/suite/rpl/r/rpl_ignore_table.result index 3e6cdac820ed5..b7447a1958237 100644 --- a/mysql-test/suite/rpl/r/rpl_ignore_table.result +++ b/mysql-test/suite/rpl/r/rpl_ignore_table.result @@ -48,7 +48,7 @@ GRANT SELECT, INSERT, UPDATE, REFERENCES ON `test`.`t1` TO `mysqltest2`@`localho GRANT USAGE ON *.* TO `mysqltest2`@`localhost` show grants for mysqltest3@localhost; Grants for mysqltest3@localhost -GRANT SELECT (a), INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO `mysqltest3`@`localhost` +GRANT SELECT (`a`), INSERT, INSERT (`a`), UPDATE (`a`), REFERENCES (`a`) ON `test`.`t4` TO `mysqltest3`@`localhost` GRANT SELECT ON `test`.* TO `mysqltest3`@`localhost` GRANT USAGE ON *.* TO `mysqltest3`@`localhost` show grants for mysqltest4@localhost; @@ -73,7 +73,7 @@ GRANT INSERT ON `test`.`t4` TO `mysqltest2`@`localhost` GRANT USAGE ON *.* TO `mysqltest2`@`localhost` show grants for mysqltest3@localhost; Grants for mysqltest3@localhost -GRANT SELECT (a), INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO `mysqltest3`@`localhost` +GRANT SELECT (`a`), INSERT, INSERT (`a`), UPDATE (`a`), REFERENCES (`a`) ON `test`.`t4` TO `mysqltest3`@`localhost` GRANT SELECT ON `test`.* TO `mysqltest3`@`localhost` GRANT USAGE ON *.* TO `mysqltest3`@`localhost` show grants for mysqltest4@localhost; @@ -100,7 +100,7 @@ Grants for mysqltest1@localhost GRANT USAGE ON *.* TO `mysqltest1`@`localhost` show grants for mysqltest3@localhost; Grants for mysqltest3@localhost -GRANT INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO `mysqltest3`@`localhost` +GRANT INSERT, INSERT (`a`), UPDATE (`a`), REFERENCES (`a`) ON `test`.`t4` TO `mysqltest3`@`localhost` GRANT SELECT ON `test`.* TO `mysqltest3`@`localhost` GRANT USAGE ON *.* TO `mysqltest3`@`localhost` show grants for mysqltest4@localhost; @@ -114,7 +114,7 @@ show grants for mysqltest3@localhost; Grants for mysqltest3@localhost GRANT USAGE ON *.* TO `mysqltest3`@`localhost` GRANT SELECT ON `test`.* TO `mysqltest3`@`localhost` -GRANT INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO `mysqltest3`@`localhost` +GRANT INSERT, INSERT (`a`), UPDATE (`a`), REFERENCES (`a`) ON `test`.`t4` TO `mysqltest3`@`localhost` show grants for mysqltest4@localhost; Grants for mysqltest4@localhost GRANT USAGE ON *.* TO `mysqltest4`@`localhost` IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7' diff --git a/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result b/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result index 69215ecb54508..2ecc3ac159c38 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result @@ -132,7 +132,7 @@ Create Table CREATE TABLE `byrange_tbl` ( `fkid` mediumint(9) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`id`) SUBPARTITION BY HASH (`id`) SUBPARTITIONS 2 diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result index 650d0787333d0..7c31c52e3bf00 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result @@ -55,7 +55,7 @@ t1 CREATE TABLE `t1` ( `b` char(254) DEFAULT NULL, PRIMARY KEY (`a`), KEY `index1` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -63,7 +63,7 @@ t2 CREATE TABLE `t2` ( `b` char(254) DEFAULT NULL, PRIMARY KEY (`a`), KEY `index1` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection slave; USE test_rpl; SHOW CREATE TABLE t1; @@ -73,7 +73,7 @@ t1 CREATE TABLE `t1` ( `b` char(254) DEFAULT NULL, PRIMARY KEY (`a`), KEY `index1` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -81,7 +81,7 @@ t2 CREATE TABLE `t2` ( `b` char(254) DEFAULT NULL, PRIMARY KEY (`a`), KEY `index1` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; ******************** DDL for indexes ******************** @@ -95,7 +95,7 @@ t1 CREATE TABLE `t1` ( `b` char(254) DEFAULT NULL, PRIMARY KEY (`a`), KEY `index1` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -106,7 +106,7 @@ t2 CREATE TABLE `t2` ( KEY `index1` (`b`), KEY `index2` (`d`), KEY `index3` (`a`,`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection slave; USE test_rpl; SHOW CREATE TABLE t1; @@ -116,7 +116,7 @@ t1 CREATE TABLE `t1` ( `b` char(254) DEFAULT NULL, PRIMARY KEY (`a`), KEY `index1` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -127,7 +127,7 @@ t2 CREATE TABLE `t2` ( KEY `index1` (`b`), KEY `index2` (`d`), KEY `index3` (`a`,`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; ALTER TABLE t2 DROP COLUMN d; diff --git a/mysql-test/suite/rpl/r/rpl_iodku,stmt.rdiff b/mysql-test/suite/rpl/r/rpl_iodku,stmt.rdiff new file mode 100644 index 0000000000000..e31f1e5d991d5 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_iodku,stmt.rdiff @@ -0,0 +1,27 @@ +--- r/rpl_iodku.result 2022-05-04 18:51:24.956414404 +0300 ++++ r/rpl_iodku,stmt.reject 2022-05-04 18:51:49.520106231 +0300 +@@ -1,10 +1,15 @@ + include/master-slave.inc + [connection master] ++call mtr.add_suppression("Unsafe statement written to the binary log using statement"); + CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, a INT, b INT, c INT, + UNIQUE (a), UNIQUE (b)) ENGINE=innodb; + INSERT INTO t1 (`a`,`c`) VALUES (1,1), (2,1) ON DUPLICATE KEY UPDATE c = 1; ++Warnings: ++Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe + # UNSAFE + INSERT INTO t1 (`a`,`c`) VALUES (3, 1),(2,1), (1,1) ON DUPLICATE KEY UPDATE c = a * 10 + VALUES(c); ++Warnings: ++Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe + SELECT * from t1; + id a b c + 1 1 NULL 11 +@@ -17,6 +22,8 @@ + INSERT INTO t1 VALUES (1,10,1); + # eligable for the statement format run unsafe warning + INSERT INTO t1 VALUES (2,20,2) ON DUPLICATE KEY UPDATE c = 100; ++Warnings: ++Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe + # not eligable: no warning in the statement format run + INSERT INTO t1 (`a`,`c`) VALUES (3, 1) ON DUPLICATE KEY UPDATE c = 99; + SELECT * from t1; diff --git a/mysql-test/suite/rpl/r/rpl_iodku.result b/mysql-test/suite/rpl/r/rpl_iodku.result new file mode 100644 index 0000000000000..55348da14391a --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_iodku.result @@ -0,0 +1,32 @@ +include/master-slave.inc +[connection master] +CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, a INT, b INT, c INT, +UNIQUE (a), UNIQUE (b)) ENGINE=innodb; +INSERT INTO t1 (`a`,`c`) VALUES (1,1), (2,1) ON DUPLICATE KEY UPDATE c = 1; +# UNSAFE +INSERT INTO t1 (`a`,`c`) VALUES (3, 1),(2,1), (1,1) ON DUPLICATE KEY UPDATE c = a * 10 + VALUES(c); +SELECT * from t1; +id a b c +1 1 NULL 11 +2 2 NULL 21 +3 3 NULL 1 +connection slave; +include/diff_tables.inc [master:t1,slave:t1] +connection master; +CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, UNIQUE (a), UNIQUE (b)) ENGINE=innodb; +INSERT INTO t1 VALUES (1,10,1); +# eligable for the statement format run unsafe warning +INSERT INTO t1 VALUES (2,20,2) ON DUPLICATE KEY UPDATE c = 100; +# not eligable: no warning in the statement format run +INSERT INTO t1 (`a`,`c`) VALUES (3, 1) ON DUPLICATE KEY UPDATE c = 99; +SELECT * from t1; +a b c +1 10 1 +2 20 2 +3 NULL 1 +connection slave; +include/diff_tables.inc [master:t1,slave:t1] +connection master; +DROP TABLE t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result b/mysql-test/suite/rpl/r/rpl_loaddata_local.result similarity index 100% rename from mysql-test/suite/rpl/r/rpl_loaddatalocal.result rename to mysql-test/suite/rpl/r/rpl_loaddata_local.result diff --git a/mysql-test/suite/rpl/r/rpl_mdev-11092.result b/mysql-test/suite/rpl/r/rpl_mdev-11092.result index 8bc8fe4a20b30..b40f21e3b845b 100644 --- a/mysql-test/suite/rpl/r/rpl_mdev-11092.result +++ b/mysql-test/suite/rpl/r/rpl_mdev-11092.result @@ -1,7 +1,12 @@ include/master-slave.inc [connection master] call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occurred on the master. .*"); +call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occured on the master. .*"); +call mtr.add_suppression("Write to binary log failed: Multi-row statements required more than .max_binlog_stmt_cache_size.* "); +call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size.* "); +call mtr.add_suppression("Incident event write to the binary log file failed"); +call mtr.add_suppression("handlerton rollback failed"); +"*********** Annotate Event write failure **************" SET GLOBAL max_binlog_cache_size = 4096; SET GLOBAL binlog_cache_size = 4096; SET GLOBAL max_binlog_stmt_cache_size = 4096; @@ -10,12 +15,212 @@ disconnect master; connect master,127.0.0.1,root,,test,$MASTER_MYPORT,; CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MYISAM; connection master; -ERROR HY000: Writing one row to the row-based binary log failed +"#######################################################################" +"# Test Case1: Annotate event write failure for MyISAM #" +"#######################################################################" +ERROR HY000: Multi-row statements required more than 'max_binlog_stmt_cache_size' bytes of storage. +# Validating update was not binlogged.. +# ..success +# Validating that the inserted data was saved on the master.. +# ..success +connection slave; include/wait_for_slave_sql_error_and_skip.inc [errno=1590] +# Validating that the insert was not replicated to the slave.. +# ..success +"#######################################################################" +"# Test Case2: Annotate event write failure for INNODB #" +"#######################################################################" connection master; +CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=INNODB; +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again +# Validating binlog GTID position progressed from first insert.. +# ..success +# Validating that only the first insert into t2 saved.. +# ..success +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +# Validating the first insert into t2 replicated to slave.. +include/diff_tables.inc [master:test.t2,slave:test.t2] +# ..success +"#######################################################################" +"# Test Case3: Annotate event write failure for mixed engine UPDATE #" +"#######################################################################" +connection master; +ERROR HY000: Multi-row statements required more than 'max_binlog_stmt_cache_size' bytes of storage. +# Validating update was not binlogged.. +# ..success +# Validating non-transactional part of update saved.. +# ..success +# Validating transactional part of update was rolled back.. +# ..success +include/save_master_gtid.inc +connection slave; +include/wait_for_slave_sql_error_and_skip.inc [errno=1590] +# Validating the rolled-back multi-engine update did not replicate to slave at all.. +# ..success +connection master; +"****** Clean up *******" SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE; SET GLOBAL binlog_cache_size= ORIGINAL_VALUE; SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE; SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE; -DROP TABLE t1; +DROP TABLE t1,t2; +"*********** TABLE MAP Event write failure **************" +CREATE TABLE tm (f INT) ENGINE=MYISAM; +CREATE TABLE ti (f INT) ENGINE=INNODB; +INSERT INTO tm VALUES (10); +INSERT INTO ti VALUES (20); +connection slave; +"#######################################################################" +"# Test Case4: Table_map event write failure for trans engine UPDATE #" +"#######################################################################" +# Transaction should be rolled back without writing incident event +connection master; +SET debug_dbug="+d,table_map_write_error"; +UPDATE ti, tm set ti.f=30; +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again +# Validating update was not binlogged.. +# ..success +# Validating update was rolled back from storage engines.. +# ..success +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +"#######################################################################" +"# Test Case5: Table_map event write failure for mixed engine UPDATE #" +"#######################################################################" +connection master; +# In case of mixed engines if non trans table is updated write INCIDENT event +UPDATE ti,tm SET tm.f=88, ti.f=120; +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again +# Validating update was not binlogged.. +# ..success +# Validating that only the non-transactional update saved on master.. +# ..success +connection slave; +include/wait_for_slave_sql_error_and_skip.inc [errno=1590] +# Validating that neither of the updates replicated to slave.. +# ..success +"#######################################################################" +"# Test Case6: Committing a transaction consisting of two updates: +"# S1) Update transactional table +"# S2) Update transactional table +"# with a table_map event write failure on the second event should +"# roll-back only the second update without incident +"#######################################################################" +connection master; +SET debug_dbug=""; +BEGIN; +UPDATE ti, tm set ti.f=40; +SET debug_dbug="+d,table_map_write_error"; +UPDATE ti, tm set ti.f=50; +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again +COMMIT; +# Validating binlog GTID position progressed from first update.. +# ..success +# Validating the first update saved.. +# ..and that the second update did not save.. +# ..success +# Validating that only the first update replicated to slave without incident +connection master; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +include/diff_tables.inc [master:test.ti,slave:test.ti] +"#######################################################################" +"# Test Case7: Rolling back a transaction consisting of two updates: +"# S1) Update transactional table +"# S2) Update transactional table +"# with a table_map event write failure on the second event should +"# roll-back both updates without incident +"#######################################################################" +connection master; +SET debug_dbug=""; +BEGIN; +UPDATE ti, tm set ti.f=60; +SET debug_dbug="+d,table_map_write_error"; +UPDATE ti, tm set ti.f=70; +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again +ROLLBACK; +# Validating update was not binlogged.. +# ..success +# Validating that neither update saved on master.. +# ..success +# Validating the transaction did not replicate to the slave +connection master; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +include/diff_tables.inc [master:test.ti,slave:test.ti] +"#######################################################################" +"# Test Case8: Committing a transaction consisting of two updates: +"# S1) Update transactional table +"# S2) Update mixed trans/non-trans tables +"# with a table_map event write failure on the second event should +"# roll-back only the second update with incident +"#######################################################################" +connection master; +BEGIN; +SET debug_dbug=""; +UPDATE ti, tm set ti.f=80; +SET debug_dbug="+d,table_map_write_error"; +UPDATE ti, tm set ti.f=90,tm.f=99; +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again +COMMIT; +# Validating binlog GTID position progressed from first update.. +# ..success +# Validating the first update saved.. +# ..and the transactional part of the second update did not save.. +# ..whereas the non-trans part of the second update did save.. +# ..success +# Validating that the incident propagated to the slave +connection slave; +include/wait_for_slave_sql_error_and_skip.inc [errno=1590] +# Validating that the first update replicated to the slave.. +# ..and neither part of the second update replicated.. +# ..success +"#######################################################################" +"# Test Case9: Rolling back a transaction consisting of two updates: +"# S1) Update transactional table +"# S2) Update mixed trans/non-trans tables +"# with a table_map event write failure on the second event should +"# roll-back both transactional updates, preserve the non-transactional +"# update on the master (only), and write an incident event +"#######################################################################" +connection master; +SET debug_dbug=""; +BEGIN; +UPDATE ti, tm set ti.f=100; +SET debug_dbug="+d,table_map_write_error"; +UPDATE ti, tm set ti.f=110,tm.f=111; +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again +ROLLBACK; +# Validating update was not binlogged.. +# ..success +# Validating trans updates rollback, but the non-trans update stays.. +# ..success +# Validating that the incident propagated to the slave +connection slave; +include/wait_for_slave_sql_error_and_skip.inc [errno=1590] +# Validating that none of the updates replicated to the slave +include/diff_tables.inc [master:test.ti,slave:test.ti] +# ..success +"#######################################################################" +"# Test Case10: If an incident event fails to write, a specific error +"# should be logged +"# +"# Note: This test case is the same as test case 5, with the caveat of +"# the incident event failing to write. +"#######################################################################" +connection master; +SET debug_dbug="d,table_map_write_error,incident_event_write_error"; +UPDATE ti, tm set ti.f=120, tm.f=122; +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again +# Validate error message indicating incident event failed to write +FOUND 1 /Incident event write to the binary log file failed/ in mysqld.1.err +connection master; +"******** Clean Up **********" +SET GLOBAL debug_dbug = ''; +DROP TABLE tm,ti; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_mdev382.result b/mysql-test/suite/rpl/r/rpl_mdev382.result index 5ec40d81ade85..d59473439678d 100644 --- a/mysql-test/suite/rpl/r/rpl_mdev382.result +++ b/mysql-test/suite/rpl/r/rpl_mdev382.result @@ -179,11 +179,11 @@ ROLLBACK/*!*/; use `db1``; select 'oops!'`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE `t``1` (`a``1` VARCHAR(4) PRIMARY KEY, `b``2` VARCHAR(3), @@ -279,11 +279,11 @@ ROLLBACK/*!*/; use `db1``; select 'oops!'`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (a1 BIGINT PRIMARY KEY, a2 BIGINT, a3 BIGINT, a4 BIGINT UNSIGNED, b DOUBLE, c DECIMAL(65,10), d VARCHAR(100)) @@ -388,11 +388,11 @@ START TRANSACTION use `ts``et`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; INSERT INTO t1 VALUES(1) diff --git a/mysql-test/suite/rpl/r/rpl_mdev_17614.result b/mysql-test/suite/rpl/r/rpl_mdev_17614.result index 3905733492632..ba07711152251 100644 --- a/mysql-test/suite/rpl/r/rpl_mdev_17614.result +++ b/mysql-test/suite/rpl/r/rpl_mdev_17614.result @@ -1,5 +1,6 @@ include/master-slave.inc [connection master] +# Case 1: UNSAFE call mtr.add_suppression("Unsafe statement written to the binary log using statement format"); CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY , b INT, UNIQUE(b), c int) engine=innodb; @@ -37,6 +38,7 @@ drop table t1; connection slave; start slave; include/wait_for_slave_to_start.inc +# Case 2: UNSAFE connection master; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY auto_increment, b INT, UNIQUE(b), c int) engine=innodb; @@ -45,8 +47,12 @@ connection master; INSERT INTO t1 VALUES (default, 1, 1); BEGIN; INSERT INTO t1 VALUES (default, 1, 2) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe connection master1; INSERT INTO t1 VALUES(default, 2, 3) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe connection master; COMMIT; SELECT * FROM t1; @@ -62,6 +68,7 @@ a b c connection master; drop table t1; connection slave; +# Case 3A: UNSAFE connection master; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, UNIQUE(b), c int, d int ) engine=innodb; @@ -93,6 +100,67 @@ a b c d connection master; drop table t1; connection slave; +# Case 3B: UNSAFE - all column specified. +connection master; +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, +UNIQUE(b), c int, d int ) engine=innodb; +connection slave; +connection master; +INSERT INTO t1 VALUES (1, 1, 1, 1); +BEGIN; +INSERT INTO t1 VALUES (2, NULL, 2, 2) ON DUPLICATE KEY UPDATE c=VALUES(c); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe +connection master1; +INSERT INTO t1 VALUES(3, NULL, 2, 3) ON DUPLICATE KEY UPDATE c=VALUES(c); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe +connection master; +COMMIT; +SELECT * FROM t1; +a b c d +1 1 1 1 +2 NULL 2 2 +3 NULL 2 3 +connection slave; +#same data as master +SELECT * FROM t1; +a b c d +1 1 1 1 +2 NULL 2 2 +3 NULL 2 3 +connection master; +drop table t1; +connection slave; +# Case 3C: SAFE - only one unique key (PK) specified. +connection master; +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, +UNIQUE(b), c int, d int ) engine=innodb; +connection slave; +connection master; +INSERT INTO t1 VALUES (1, 1, 1, 1); +BEGIN; +INSERT INTO t1 (`a`, `c`, `d`) VALUES (2, 2, 2) ON DUPLICATE KEY UPDATE c=99; +connection master1; +INSERT INTO t1 (`a`, `c`, `d`) VALUES(3, 2, 3) ON DUPLICATE KEY UPDATE c=100; +connection master; +COMMIT; +SELECT * FROM t1; +a b c d +1 1 1 1 +2 NULL 2 2 +3 NULL 2 3 +connection slave; +#same data as master +SELECT * FROM t1; +a b c d +1 1 1 1 +2 NULL 2 2 +3 NULL 2 3 +connection master; +drop table t1; +connection slave; +# Case 4: UNSAFE connection master; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY auto_increment, b INT, UNIQUE(b), c int) engine=innodb; @@ -101,8 +169,12 @@ connection master; INSERT INTO t1 VALUES (1, 1, 1); BEGIN; INSERT INTO t1 VALUES (2, 1, 2) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe connection master1; INSERT INTO t1 VALUES(2, 2, 3) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe connection master; COMMIT; SELECT * FROM t1; diff --git a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result index 388c8e67b680a..944ad9331ad63 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result @@ -1,6 +1,8 @@ include/master-slave.inc [connection master] call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +call mtr.add_suppression("Write to binary log failed: Multi-row statements required more than .max_binlog_stmt_cache_size"); +call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size"); SET GLOBAL max_binlog_cache_size = 4096; SET GLOBAL binlog_cache_size = 4096; SET GLOBAL max_binlog_stmt_cache_size = 4096; diff --git a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result index e7b0d6f29c852..0cee79434ee50 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result @@ -40,13 +40,13 @@ t3 CREATE TABLE `t3` ( `id` int(11) NOT NULL AUTO_INCREMENT, `created` datetime DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t5; Table Create Table t5 CREATE TABLE `t5` ( `id` int(11) NOT NULL DEFAULT 0, `created` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; drop table t2,t3,t5; drop temporary table t4; diff --git a/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result index 8b6ee56a3b471..9bcd34185a666 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result @@ -227,7 +227,7 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (22) master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `fc`() RETURNS varchar(64) CHARSET latin1 +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `fc`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_swedish_ci RETURN "fc" master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (21) diff --git a/mysql-test/suite/rpl/r/rpl_multi_engine.result b/mysql-test/suite/rpl/r/rpl_multi_engine.result index a000384909c38..81a2bd9aad49f 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_engine.result +++ b/mysql-test/suite/rpl/r/rpl_multi_engine.result @@ -23,7 +23,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection slave; connection slave; alter table t1 engine=myisam; @@ -40,7 +40,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14"); select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -82,7 +82,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14"); select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -124,7 +124,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14"); select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -166,7 +166,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection slave; connection slave; alter table t1 engine=myisam; @@ -183,7 +183,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14"); select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -225,7 +225,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14"); select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -267,7 +267,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14"); select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -309,7 +309,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection slave; connection slave; alter table t1 engine=myisam; @@ -326,7 +326,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14"); select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -368,7 +368,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14"); select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -410,7 +410,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14"); select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; diff --git a/mysql-test/suite/rpl/r/rpl_mysql_manager_race_condition.result b/mysql-test/suite/rpl/r/rpl_mysql_manager_race_condition.result new file mode 100644 index 0000000000000..1172d8e39a92b --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_mysql_manager_race_condition.result @@ -0,0 +1,27 @@ +include/master-slave.inc +[connection master] +connection master; +# Create a GTID event so the binlog background thread will submit a +# mysql handler job the next time mysqld is restarted. +create table t1 (a int); +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +# Set a debug point that forces the main mysqld thread to sleep before +# anything is initialized for the mysql handle manager +# Restart the slave mysqld instance so it re-initializes with the +# binlog background thread submitting a mysql handler job and the +# mysql handler initialization suspending for a second. Without the fix +# associated with this test/patch, the following restart will error +# with a failed assertion. +include/rpl_restart_server.inc [server_number=2 parameters: --debug_dbug="+d,delay_start_handle_manager"] +include/start_slave.inc +# +# Cleanup +# +connection master; +drop table t1; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result b/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result index 730e87c63da03..f3cffb6c4d8c6 100644 --- a/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result +++ b/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result @@ -35,7 +35,7 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='Slow log' +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log' connection master; connection master; Master position has been changed @@ -57,7 +57,7 @@ slow_log CREATE TABLE `slow_log` ( `sql_text` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `rows_affected` int(11) NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COMMENT='Slow log' +) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log' SET GLOBAL general_log = 'OFF'; SET GLOBAL slow_query_log = 'OFF'; truncate mysql.slow_log; diff --git a/mysql-test/suite/rpl/r/rpl_old_master_29078.result b/mysql-test/suite/rpl/r/rpl_old_master_29078.result new file mode 100644 index 0000000000000..731585b2c4176 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_old_master_29078.result @@ -0,0 +1,92 @@ +# +# MDEV-29078 For old binary logs explicit_defaults_for_timestamp presumed to be OFF, server value ignored +# +include/master-slave.inc +[connection master] +connection slave; +include/stop_slave.inc +connection master; +flush binary logs; +create table t2 (a timestamp); +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +ROLLBACK/*!*/; +use `test`/*!*/; +SET TIMESTAMP=1658586280/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.sql_mode=1411383296/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C utf8mb3 *//*!*/; +SET @@session.character_set_client=utf8mb3,@@session.collation_connection=33,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +create table t1 (f1 timestamp, f2 timestamp) +/*!*/; +START TRANSACTION +/*!*/; +SET TIMESTAMP=1658586288/*!*/; +insert t1 values (NULL, NULL) +/*!*/; +SET TIMESTAMP=1658586288/*!*/; +COMMIT +/*!*/; +START TRANSACTION +/*!*/; +SET TIMESTAMP=1658586335/*!*/; +insert t1 () values () +/*!*/; +SET TIMESTAMP=1658586335/*!*/; +COMMIT +/*!*/; +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +connection slave; +set global explicit_defaults_for_timestamp=1; +reset slave; +include/start_slave.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` timestamp NULL DEFAULT NULL, + `f2` timestamp NULL DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` timestamp NULL DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +set time_zone='+2:00'; +select * from t1; +f1 f2 +NULL NULL +NULL NULL +drop table t1; +include/stop_slave.inc +set global explicit_defaults_for_timestamp=0; +reset slave; +include/start_slave.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `f2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +select * from t1; +f1 f2 +2022-07-23 16:24:48 2022-07-23 16:24:48 +2022-07-23 16:25:35 0000-00-00 00:00:00 +drop table t1; +connection master; +drop table t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel_29322.result b/mysql-test/suite/rpl/r/rpl_parallel_29322.result new file mode 100644 index 0000000000000..43d4a71734677 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_parallel_29322.result @@ -0,0 +1,238 @@ +# +# MDEV-29322 ASAN use-after-free options_written_to_bin_log +# +include/master-slave.inc +[connection master] +# A. set the master and slave explicit_defaults_for_timestamp values crisscross to (1,0) +connection master; +set @sav.explicit_defaults_for_timestamp = @@session.explicit_defaults_for_timestamp; +set @@session.explicit_defaults_for_timestamp = 1; +connection slave; +set @sav.explicit_defaults_for_timestamp = @@global.explicit_defaults_for_timestamp; +set global explicit_defaults_for_timestamp = 0; +set @sav.slave_parallel_workers = @@global.slave_parallel_workers; +include/stop_slave.inc +set @@global.slave_parallel_workers = 1; +include/start_slave.inc +connection slave; +include/stop_slave.inc +reset slave; +connection master; +reset master; +create table t2 (a timestamp, b int); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` timestamp NULL DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection slave; +include/start_slave.inc +include/stop_slave.inc +connection master; +insert into t2 values (null, 1); +flush binary logs; +flush binary logs; +insert into t2 values (null, 2); +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +ROLLBACK/*!*/; +use `test`/*!*/; +SET TIMESTAMP=1658586280/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.sql_mode=1411383296/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C utf8mb3 *//*!*/; +SET @@session.character_set_client=utf8mb3,@@session.collation_connection=33,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +create table t1 (f1 timestamp, f2 timestamp) +/*!*/; +START TRANSACTION +/*!*/; +SET TIMESTAMP=1658586288/*!*/; +insert t1 values (NULL, NULL) +/*!*/; +SET TIMESTAMP=1658586288/*!*/; +COMMIT +/*!*/; +START TRANSACTION +/*!*/; +SET TIMESTAMP=1658586335/*!*/; +insert t1 () values () +/*!*/; +SET TIMESTAMP=1658586335/*!*/; +COMMIT +/*!*/; +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +connection slave1; +lock table t2 write; +connection slave; +include/start_slave.inc +connection slave1; +unlock tables; +connection slave; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` timestamp NULL DEFAULT NULL, + `f2` timestamp NULL DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +set statement time_zone='+2:00' for select * from t1; +f1 f2 +NULL NULL +NULL NULL +drop table t1; +connection master; +connection slave; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` timestamp NULL DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/diff_tables.inc [master:t2,slave:t2] +connection master; +drop table t2; +connection slave; +# B. alternate the master and slave vars' values to (0,1) +connection master; +set @@session.explicit_defaults_for_timestamp = 0; +connection slave; +set @@global.explicit_defaults_for_timestamp = 1; +connection slave; +include/stop_slave.inc +reset slave; +connection master; +reset master; +create table t2 (a timestamp, b int); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection slave; +include/start_slave.inc +include/stop_slave.inc +connection master; +insert into t2 values (null, 1); +flush binary logs; +flush binary logs; +insert into t2 values (null, 2); +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +ROLLBACK/*!*/; +use `test`/*!*/; +SET TIMESTAMP=1658586280/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.sql_mode=1411383296/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C utf8mb3 *//*!*/; +SET @@session.character_set_client=utf8mb3,@@session.collation_connection=33,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +create table t1 (f1 timestamp, f2 timestamp) +/*!*/; +START TRANSACTION +/*!*/; +SET TIMESTAMP=1658586288/*!*/; +insert t1 values (NULL, NULL) +/*!*/; +SET TIMESTAMP=1658586288/*!*/; +COMMIT +/*!*/; +START TRANSACTION +/*!*/; +SET TIMESTAMP=1658586335/*!*/; +insert t1 () values () +/*!*/; +SET TIMESTAMP=1658586335/*!*/; +COMMIT +/*!*/; +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +connection slave1; +lock table t2 write; +connection slave; +include/start_slave.inc +connection slave1; +unlock tables; +connection slave; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `f2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +set statement time_zone='+2:00' for select * from t1; +f1 f2 +2022-07-23 16:24:48 2022-07-23 16:24:48 +2022-07-23 16:25:35 0000-00-00 00:00:00 +drop table t1; +connection master; +connection slave; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/diff_tables.inc [master:t2,slave:t2] +connection master; +drop table t2; +connection slave; +# C. the bug case on the same version binlogs also to demo on the patch's base +include/stop_slave.inc +set @@global.slave_parallel_workers = 4; +include/start_slave.inc +connection slave; +include/stop_slave.inc +reset slave; +connection master; +reset master; +create table t2 (a timestamp, b int); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection slave; +include/start_slave.inc +include/stop_slave.inc +connection master; +connection slave; +include/start_slave.inc +connection slave; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/diff_tables.inc [master:t2,slave:t2] +connection master; +drop table t2; +connection slave; +connection master; +set @@session.explicit_defaults_for_timestamp = @sav.explicit_defaults_for_timestamp; +connection slave; +set @@global.explicit_defaults_for_timestamp = @sav.explicit_defaults_for_timestamp; +include/stop_slave.inc +set @@global.slave_parallel_workers = @sav.slave_parallel_workers; +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel_analyze.result b/mysql-test/suite/rpl/r/rpl_parallel_analyze.result new file mode 100644 index 0000000000000..c0a2abbc1ee2f --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_parallel_analyze.result @@ -0,0 +1,76 @@ +include/master-slave.inc +[connection master] +# Initialize +connection slave; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +# Setup data +connection master; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE ta (a int); +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +connection master; +SET sql_log_bin=0; +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) +RETURNS INT DETERMINISTIC +BEGIN +RETURN x; +END +|| +SET sql_log_bin=1; +connection slave; +SET sql_log_bin=0; +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) +RETURNS INT DETERMINISTIC +BEGIN +IF d1 != '' THEN +SET debug_sync = d1; +END IF; +IF d2 != '' THEN +SET debug_sync = d2; +END IF; +RETURN x; +END +|| +SET sql_log_bin=1; +include/stop_slave.inc +SET @old_parallel_threads =@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode =@@GLOBAL.slave_parallel_mode; +SET @old_gtid_strict_mode =@@GLOBAL.gtid_strict_mode; +SET GLOBAL slave_parallel_threads=10; +SET GLOBAL slave_parallel_mode=conservative; +SET GLOBAL gtid_strict_mode=ON; +include/start_slave.inc +connection master; +SET @old_format= @@SESSION.binlog_format; +SET binlog_format=statement; +INSERT INTO t1 VALUES (foo(1, 'rpl_parallel_after_mark_start_commit WAIT_FOR sig_go', '')); +ANALYZE TABLE ta; +Table Op Msg_type Msg_text +test.ta analyze status Engine-independent statistics collected +test.ta analyze status Table is already up to date +include/save_master_gtid.inc +connection slave; +SELECT info FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit"; +info +ANALYZE TABLE ta +set @@debug_sync="now signal sig_go"; +include/sync_with_master_gtid.inc +# Cleanup +connection master; +DROP TABLE t1,ta; +connection slave; +SET DEBUG_SYNC='RESET'; +connection master; +SET DEBUG_SYNC='RESET'; +DROP FUNCTION foo; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +SET @@GLOBAL.slave_parallel_threads=@old_parallel_threads; +SET @@GLOBAL.slave_parallel_mode =@old_parallel_mode; +SET @@GLOBAL.gtid_strict_mode =@old_gtid_strict_mode; +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel_charset.result b/mysql-test/suite/rpl/r/rpl_parallel_charset.result index d85876ff2c6e7..12d03bdc7fe6d 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_charset.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_charset.result @@ -11,9 +11,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, - `b` varchar(100) CHARACTER SET utf8mb3 DEFAULT NULL, + `b` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET character_set_client=latin1; INSERT INTO t1 VALUES (1, 'R�dgr�d med fl�de 1'); INSERT INTO t1 VALUES (2, 'R�dgr�d med fl�de 2'); diff --git a/mysql-test/suite/rpl/r/rpl_parallel_deadlock_corrupt_binlog.result b/mysql-test/suite/rpl/r/rpl_parallel_deadlock_corrupt_binlog.result index 74d1d53b67c9e..f3203cfe8e62a 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_deadlock_corrupt_binlog.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_deadlock_corrupt_binlog.result @@ -15,6 +15,7 @@ include/stop_slave.inc SET GLOBAL slave_parallel_threads=1; SET @old_dbug= @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000"; +CALL mtr.add_suppression("Unexpected break of being relay-logged GTID"); connection server_1; INSERT INTO t2 VALUES (101); INSERT INTO t2 VALUES (102); diff --git a/mysql-test/suite/rpl/r/rpl_parallel_optimistic_error_stop.result b/mysql-test/suite/rpl/r/rpl_parallel_optimistic_error_stop.result new file mode 100644 index 0000000000000..48672651c3608 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_parallel_optimistic_error_stop.result @@ -0,0 +1,81 @@ +include/rpl_init.inc [topology=1->2] +call mtr.add_suppression("Slave: Commit failed due to failure of an earlier commit"); +call mtr.add_suppression("Slave: Duplicate entry '99'"); +connection server_1; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1,1); +INSERT INTO t1 VALUES(2,1); +INSERT INTO t1 VALUES(3,1); +INSERT INTO t1 VALUES(4,1); +connection server_2; +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +include/stop_slave.inc +SET @old_debug_dbug = @@global.debug_dbug; +SET @@global.debug_dbug = "d,hold_worker2_favor_worker3"; +SET GLOBAL slave_parallel_threads=4; +CHANGE MASTER TO master_use_gtid=slave_pos; +SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; +SET GLOBAL slave_parallel_mode='optimistic'; +connection server_1; +SET @@gtid_seq_no = 2001; +BEGIN; +UPDATE t1 SET b = 11 WHERE a = 4; +UPDATE t1 SET b = 11 WHERE a = 3; +UPDATE t1 SET a = 99 WHERE a = 1; +COMMIT; +UPDATE t1 SET b = 2 WHERE a = 2; +UPDATE t1 SET b = 3 WHERE a = 3; +DROP TABLE IF EXISTS phantom_1; +Warnings: +Note 1051 Unknown table 'test.phantom_1' +include/save_master_gtid.inc +connect slave_local_0, 127.0.0.1, root,, test, $SLAVE_MYPORT,; +begin; +UPDATE t1 set b = 11 where a = 4; +connect slave_local_1, 127.0.0.1, root,, test, $SLAVE_MYPORT,; +begin; +INSERT INTO t1 VALUES (99, 11); +connect slave_local_2, 127.0.0.1, root,, test, $SLAVE_MYPORT,; +begin; +UPDATE t1 SET b = 12 WHERE a = 2; +connect slave_local_3, 127.0.0.1, root,, test, $SLAVE_MYPORT,; +begin; +UPDATE t1 SET b = 13 WHERE a = 3; +connection server_2; +include/start_slave.inc +# W4 is waiting to start its DROP +connection slave_local_3; +rollback; +connection slave_local_0; +rollback; +SELECT count(*) = 0 as "W3 undid its commit state" FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit%"; +W3 undid its commit state +1 +connection slave_local_2; +rollback; +connection slave_local_1; +commit; +SELECT COUNT(*) = 1 as "W4 remains with the same status" FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to start commit%"; +W4 remains with the same status +1 +# Slave_SQL_Running YES = Yes +# while W2 is held back ... +SET DEBUG_SYNC = 'now SIGNAL cont_worker2'; +include/wait_for_slave_sql_error.inc [errno=1062] +DELETE FROM t1 WHERE a=99; +include/start_slave.inc +include/sync_with_master_gtid.inc +connection server_2; +include/stop_slave.inc +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +SET @@global.debug_dbug = @old_debug_dbug; +SET debug_sync = RESET; +include/start_slave.inc +connection server_1; +DROP TABLE t1; +include/save_master_gtid.inc +connection server_2; +include/sync_with_master_gtid.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel_seq.result b/mysql-test/suite/rpl/r/rpl_parallel_seq.result new file mode 100644 index 0000000000000..ae4041f470d69 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_parallel_seq.result @@ -0,0 +1,85 @@ +include/master-slave.inc +[connection master] +connection slave; +include/stop_slave.inc +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +# MDEV-29621 the sequence engine binlog_row_image-full events +# MDL-deadlock on the parallel slave. +connection master; +CREATE SEQUENCE s1; +SET @@session.binlog_row_image=FULL; +SET @@session.debug_dbug="+d,binlog_force_commit_id"; +SET @commit_id=7; +SET @@gtid_seq_no=100; +SELECT NEXT VALUE FOR s1; +NEXT VALUE FOR s1 +1 +INSERT INTO s1 VALUES(2, 1, 10, 1, 2, 1, 1, 0); +SET @@session.debug_dbug=""; +connection slave; +SET @@global.slave_parallel_threads=2; +SET @@global.slave_parallel_mode=optimistic; +SET @@global.debug_dbug="+d,hold_worker_on_schedule"; +include/start_slave.inc +SET DEBUG_SYNC = 'now SIGNAL continue_worker'; +connection master; +DROP SEQUENCE s1; +connection slave; +include/stop_slave.inc +# Simulate buggy 10.3.36 master to prove the parallel applier +# does not deadlock now at replaying the above master load. +connection master; +include/rpl_stop_server.inc [server_number=1] +include/rpl_start_server.inc [server_number=1] +connection slave; +RESET MASTER; +SET @@global.gtid_slave_pos=""; +CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_use_gtid=slave_pos; +START SLAVE UNTIL MASTER_GTID_POS='0-1-102'; +SET DEBUG_SYNC = 'now SIGNAL continue_worker'; +# Normal stop is expected +include/wait_for_slave_to_stop.inc +# MDEV-31077 ALTER SEQUENCE may end up in optimistic parallel slave binlog out-of-order +# The test proves ALTER-SEQUENCE binlogs first before the following transaction does so. +connection slave; +include/stop_slave.inc +Warnings: +Note 1255 Slave already has been stopped +RESET MASTER; +SET @@global.gtid_slave_pos=""; +SET @@global.gtid_strict_mode=1; +connection master; +RESET MASTER; +CREATE TABLE ti (a INT) ENGINE=innodb; +CREATE SEQUENCE s2 ENGINE=innodb; +SET @@gtid_seq_no=100; +ALTER SEQUENCE s2 restart with 1; +INSERT INTO ti SET a=1; +include/save_master_gtid.inc +SELECT @@global.gtid_binlog_state "Master gtid state"; +Master gtid state +0-1-101 +connection slave; +include/start_slave.inc +SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "no 100,101 yet in both"; +@@global.gtid_binlog_state no 100,101 yet in both +0-1-2 0-1-2 +SET DEBUG_SYNC = 'now SIGNAL continue_worker'; +# Normal sync with master proves the fixes correct +include/sync_with_master_gtid.inc +SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "all through 101 have been committed"; +@@global.gtid_binlog_state all through 101 have been committed +0-1-101 0-1-101 +connection slave; +include/stop_slave.inc +SET debug_sync = RESET; +SET @@global.slave_parallel_threads= 0; +SET @@global.slave_parallel_mode= optimistic; +SET @@global.debug_dbug = ""; +SET @@global.gtid_strict_mode=0; +include/start_slave.inc +connection master; +DROP SEQUENCE s2; +DROP TABLE ti; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel_temptable.result b/mysql-test/suite/rpl/r/rpl_parallel_temptable.result index 52efed2254194..1a1c12f836d0a 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_temptable.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_temptable.result @@ -132,8 +132,13 @@ connection server_1; INSERT INTO t1 VALUES (0, 1); include/save_master_gtid.inc connection server_2; +set @@sql_log_bin=0; +call mtr.add_suppression("Unexpected break of being relay-logged GTID 1-1-32 event group by the current GTID event 0-1-4"); +set @@sql_log_bin=1; +set @@global.debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000"; include/start_slave.inc include/sync_with_master_gtid.inc +set @@global.debug_dbug=""; SELECT * FROM t1 ORDER BY a; a b 0 1 diff --git a/mysql-test/suite/rpl/r/rpl_partition_innodb.result b/mysql-test/suite/rpl/r/rpl_partition_innodb.result index e9fa13f315b7c..4b717d8b46c62 100644 --- a/mysql-test/suite/rpl/r/rpl_partition_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_partition_innodb.result @@ -61,7 +61,7 @@ byrange_tbl CREATE TABLE `byrange_tbl` ( `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`id`) (PARTITION `pa100` VALUES LESS THAN (100) ENGINE = InnoDB, PARTITION `paMax` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -75,7 +75,7 @@ regular_tbl CREATE TABLE `regular_tbl` ( `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE test.byrange_tbl EXCHANGE PARTITION pa100 WITH TABLE test.regular_tbl; SELECT * FROM test.byrange_tbl ORDER BY fkid LIMIT 2; id dt user uuidf fkid filler @@ -105,7 +105,7 @@ byrange_tbl CREATE TABLE `byrange_tbl` ( `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`id`) (PARTITION `pa100` VALUES LESS THAN (100) ENGINE = InnoDB, PARTITION `paMax` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) @@ -119,7 +119,7 @@ regular_tbl CREATE TABLE `regular_tbl` ( `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT count(*) "Slave norm" FROM test.regular_tbl; Slave norm 99 diff --git a/mysql-test/suite/rpl/r/rpl_partition_memory.result b/mysql-test/suite/rpl/r/rpl_partition_memory.result index 8dbfd20d260a4..d37973b0d8046 100644 --- a/mysql-test/suite/rpl/r/rpl_partition_memory.result +++ b/mysql-test/suite/rpl/r/rpl_partition_memory.result @@ -61,7 +61,7 @@ byrange_tbl CREATE TABLE `byrange_tbl` ( `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MEMORY AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`id`) (PARTITION `pa100` VALUES LESS THAN (100) ENGINE = MEMORY, PARTITION `paMax` VALUES LESS THAN MAXVALUE ENGINE = MEMORY) @@ -75,7 +75,7 @@ regular_tbl CREATE TABLE `regular_tbl` ( `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MEMORY AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE test.byrange_tbl EXCHANGE PARTITION pa100 WITH TABLE test.regular_tbl; SELECT * FROM test.byrange_tbl ORDER BY fkid LIMIT 2; id dt user uuidf fkid filler @@ -105,7 +105,7 @@ byrange_tbl CREATE TABLE `byrange_tbl` ( `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MEMORY AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`id`) (PARTITION `pa100` VALUES LESS THAN (100) ENGINE = MEMORY, PARTITION `paMax` VALUES LESS THAN MAXVALUE ENGINE = MEMORY) @@ -119,7 +119,7 @@ regular_tbl CREATE TABLE `regular_tbl` ( `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MEMORY AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT count(*) "Slave norm" FROM test.regular_tbl; Slave norm 99 diff --git a/mysql-test/suite/rpl/r/rpl_partition_myisam.result b/mysql-test/suite/rpl/r/rpl_partition_myisam.result index 16a9ea8583276..57c06a7cbecb1 100644 --- a/mysql-test/suite/rpl/r/rpl_partition_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_partition_myisam.result @@ -61,7 +61,7 @@ byrange_tbl CREATE TABLE `byrange_tbl` ( `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`id`) (PARTITION `pa100` VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION `paMax` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -75,7 +75,7 @@ regular_tbl CREATE TABLE `regular_tbl` ( `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ALTER TABLE test.byrange_tbl EXCHANGE PARTITION pa100 WITH TABLE test.regular_tbl; SELECT * FROM test.byrange_tbl ORDER BY fkid LIMIT 2; id dt user uuidf fkid filler @@ -105,7 +105,7 @@ byrange_tbl CREATE TABLE `byrange_tbl` ( `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`id`) (PARTITION `pa100` VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION `paMax` VALUES LESS THAN MAXVALUE ENGINE = MyISAM) @@ -119,7 +119,7 @@ regular_tbl CREATE TABLE `regular_tbl` ( `fkid` int(11) DEFAULT NULL, `filler` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT count(*) "Slave norm" FROM test.regular_tbl; Slave norm 99 diff --git a/mysql-test/suite/rpl/r/rpl_read_only.result b/mysql-test/suite/rpl/r/rpl_read_only.result index 645411d4cf146..dbcd58a224f81 100644 --- a/mysql-test/suite/rpl/r/rpl_read_only.result +++ b/mysql-test/suite/rpl/r/rpl_read_only.result @@ -99,12 +99,12 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; insert into t1 values(1005); insert into t2 values(2005); diff --git a/mysql-test/suite/rpl/r/rpl_row_UUID.result b/mysql-test/suite/rpl/r/rpl_row_UUID.result index f54ea7f6aefaa..910f96c031d5b 100644 --- a/mysql-test/suite/rpl/r/rpl_row_UUID.result +++ b/mysql-test/suite/rpl/r/rpl_row_UUID.result @@ -31,7 +31,7 @@ t1 CREATE TABLE `t1` ( `blob_column` longblob DEFAULT NULL, `vchar_column` varchar(100) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; DROP PROCEDURE test.p1; DROP FUNCTION test.fn1; diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result b/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result index 7ced45a9eabbf..d9432a0a17fb2 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result @@ -27,7 +27,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (year(`t`)) (PARTITION `p0` VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN (1946) ENGINE = MyISAM, @@ -48,7 +48,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (year(`t`)) (PARTITION `p0` VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN (1946) ENGINE = MyISAM, @@ -115,7 +115,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (year(`t`)) (PARTITION `p0` VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN (1946) ENGINE = MyISAM, @@ -136,7 +136,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (year(`t`)) (PARTITION `p0` VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN (1946) ENGINE = MyISAM, @@ -212,7 +212,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`id`) (PARTITION `p0` VALUES IN (2,4) ENGINE = MyISAM, PARTITION `p1` VALUES IN (42,142) ENGINE = MyISAM, @@ -230,7 +230,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`id`) (PARTITION `p0` VALUES IN (2,4) ENGINE = MyISAM, PARTITION `p1` VALUES IN (42,142) ENGINE = MyISAM, @@ -294,7 +294,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`id`) (PARTITION `p0` VALUES IN (2,4) ENGINE = MyISAM, PARTITION `p1` VALUES IN (42,142) ENGINE = MyISAM, @@ -312,7 +312,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`id`) (PARTITION `p0` VALUES IN (2,4) ENGINE = MyISAM, PARTITION `p1` VALUES IN (42,142) ENGINE = MyISAM, @@ -383,7 +383,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`t`)) PARTITIONS 4 connection slave; @@ -399,7 +399,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`t`)) PARTITIONS 4 connection master; @@ -460,7 +460,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`t`)) PARTITIONS 4 connection slave; @@ -476,7 +476,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (year(`t`)) PARTITIONS 4 connection master; @@ -546,7 +546,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY () PARTITIONS 4 connection slave; @@ -563,7 +563,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY () PARTITIONS 4 connection master; @@ -626,7 +626,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY () PARTITIONS 4 connection slave; @@ -643,7 +643,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY () PARTITIONS 4 connection master; @@ -706,7 +706,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY () PARTITIONS 4 connection slave; @@ -723,7 +723,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY () PARTITIONS 4 connection master; diff --git a/mysql-test/suite/rpl/r/rpl_row_create_select.result b/mysql-test/suite/rpl/r/rpl_row_create_select.result index cbe84f20786e4..2e18f7aa84719 100644 --- a/mysql-test/suite/rpl/r/rpl_row_create_select.result +++ b/mysql-test/suite/rpl/r/rpl_row_create_select.result @@ -15,7 +15,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t2 AS SELECT CONVERT(REPEAT('A', 255) USING UCS2) DIV 1 AS a; Warnings: @@ -24,7 +24,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` bigint(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci #After the patch, no error is reported. connection slave; connection master; diff --git a/mysql-test/suite/rpl/r/rpl_row_create_table.result b/mysql-test/suite/rpl/r/rpl_row_create_table.result index 0760d5b6e8655..e63212db65e0d 100644 --- a/mysql-test/suite/rpl/r/rpl_row_create_table.result +++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result @@ -29,38 +29,38 @@ Table t1 Create Table CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t3; Table t3 Create Table CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci connection slave; SHOW CREATE TABLE t1; Table t1 Create Table CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table t2 Create Table CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t3; Table t3 Create Table CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci connection master; CREATE TABLE t5 (b INT, c INT) SELECT * FROM t3; CREATE TEMPORARY TABLE tt3 (a INT, b INT); @@ -72,7 +72,7 @@ Create Table CREATE TABLE `t5` ( `c` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t5 ORDER BY a,b,c; c a b SHOW CREATE TABLE t6; @@ -81,7 +81,7 @@ Create Table CREATE TABLE `t6` ( `c` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t6 ORDER BY a,b,c; c a b NULL 1 2 @@ -97,7 +97,7 @@ Create Table CREATE TABLE `t5` ( `c` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t5 ORDER BY a,b,c; c a b SHOW CREATE TABLE t6; @@ -106,7 +106,7 @@ Create Table CREATE TABLE `t6` ( `c` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t6 ORDER BY a,b,c; c a b NULL 1 2 @@ -188,13 +188,13 @@ Table t8 Create Table CREATE TABLE `t8` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE t9; Table t9 Create Table CREATE TABLE `t9` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# @@ -210,13 +210,13 @@ Table t8 Create Table CREATE TABLE `t8` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SHOW CREATE TABLE t9; Table t9 Create Table CREATE TABLE `t9` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; connection slave; diff --git a/mysql-test/suite/rpl/r/rpl_row_img_sequence_full.result b/mysql-test/suite/rpl/r/rpl_row_img_sequence_full.result new file mode 100644 index 0000000000000..2303911637f78 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_img_sequence_full.result @@ -0,0 +1,767 @@ +include/rpl_init.inc [topology=1->2->3] +connection server_1; +connection server_2; +connection server_3; +connection server_1; +# +# binlog_row_image=FULL should write all columns to the binary log +# +CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N' +connection server_1; +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y' +connection server_2; +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y' +connection server_3; +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +connection server_1; +### engines: MyISAM, MyISAM, MyISAM +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: MyISAM, MyISAM, InnoDB +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: MyISAM, InnoDB, MyISAM +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: MyISAM, InnoDB, InnoDB +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: InnoDB, MyISAM, MyISAM +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: InnoDB, MyISAM, InnoDB +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: InnoDB, InnoDB, MyISAM +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: InnoDB, InnoDB, InnoDB +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +include/rpl_end.inc +# End of tests diff --git a/mysql-test/suite/rpl/r/rpl_row_img_sequence_min.result b/mysql-test/suite/rpl/r/rpl_row_img_sequence_min.result new file mode 100644 index 0000000000000..eaf770f245c92 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_img_sequence_min.result @@ -0,0 +1,797 @@ +include/rpl_init.inc [topology=1->2->3] +connection server_1; +connection server_2; +connection server_3; +connection server_1; +# +# binlog_row_image=MINIMAL should write only columns 1 and 8 to the +# binary log +# +CON: 'server_1', IMG: 'MINIMAL', RESTART SLAVE: 'N' +connection server_1; +SET SESSION binlog_row_image= 'MINIMAL'; +SET GLOBAL binlog_row_image= 'MINIMAL'; +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image MINIMAL +CON: 'server_2', IMG: 'MINIMAL', RESTART SLAVE: 'Y' +connection server_2; +SET SESSION binlog_row_image= 'MINIMAL'; +SET GLOBAL binlog_row_image= 'MINIMAL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image MINIMAL +CON: 'server_3', IMG: 'MINIMAL', RESTART SLAVE: 'Y' +connection server_3; +SET SESSION binlog_row_image= 'MINIMAL'; +SET GLOBAL binlog_row_image= 'MINIMAL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image MINIMAL +connection server_1; +### engines: MyISAM, MyISAM, MyISAM +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: MyISAM, MyISAM, InnoDB +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: MyISAM, InnoDB, MyISAM +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: MyISAM, InnoDB, InnoDB +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: InnoDB, MyISAM, MyISAM +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: InnoDB, MyISAM, InnoDB +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: InnoDB, InnoDB, MyISAM +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: InnoDB, InnoDB, InnoDB +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N' +connection server_1; +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y' +connection server_2; +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y' +connection server_3; +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +connection server_3; +include/rpl_end.inc +# End of tests diff --git a/mysql-test/suite/rpl/r/rpl_row_img_sequence_noblob.result b/mysql-test/suite/rpl/r/rpl_row_img_sequence_noblob.result new file mode 100644 index 0000000000000..496bd8dc6b886 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_img_sequence_noblob.result @@ -0,0 +1,796 @@ +include/rpl_init.inc [topology=1->2->3] +connection server_1; +connection server_2; +connection server_3; +connection server_1; +# +# binlog_row_image=NOBLOB should write all columns to the binary logs +# +CON: 'server_1', IMG: 'NOBLOB', RESTART SLAVE: 'N' +connection server_1; +SET SESSION binlog_row_image= 'NOBLOB'; +SET GLOBAL binlog_row_image= 'NOBLOB'; +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image NOBLOB +CON: 'server_2', IMG: 'NOBLOB', RESTART SLAVE: 'Y' +connection server_2; +SET SESSION binlog_row_image= 'NOBLOB'; +SET GLOBAL binlog_row_image= 'NOBLOB'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image NOBLOB +CON: 'server_3', IMG: 'NOBLOB', RESTART SLAVE: 'Y' +connection server_3; +SET SESSION binlog_row_image= 'NOBLOB'; +SET GLOBAL binlog_row_image= 'NOBLOB'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image NOBLOB +connection server_1; +### engines: MyISAM, MyISAM, MyISAM +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: MyISAM, MyISAM, InnoDB +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: MyISAM, InnoDB, MyISAM +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: MyISAM, InnoDB, InnoDB +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: InnoDB, MyISAM, MyISAM +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: InnoDB, MyISAM, InnoDB +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: InnoDB, InnoDB, MyISAM +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=MyISAM; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +### engines: InnoDB, InnoDB, InnoDB +# Create sequences with specific engines per server +connection server_1; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/save_master_gtid.inc +connection server_2; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +connection server_3; +SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=InnoDB; +include/sync_with_master_gtid.inc +# Pt.1 Ensure SETVAL replicates and binlogs correctly +connection server_1; +SELECT SETVAL(s1, 10); +SETVAL(s1, 10) +10 +include/save_master_gtid.inc +# Validate SETVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged SETVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged SETVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged SETVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Pt.2 Ensure NEXTVAL replicates and binlogs correctly +connection server_1; +SELECT NEXTVAL(s1); +NEXTVAL(s1) +11 +include/save_master_gtid.inc +# Validate NEXTVAL replicated correctly to other servers +connection server_3; +include/sync_with_master_gtid.inc +include/diff_tables.inc [server_1:test.s1,server_2:test.s1,server_3:test.s1] +# Validate server_1 binlogged NEXTVAL with the correct columns +connection server_1; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_2 binlogged NEXTVAL with the correct columns +connection server_2; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Validate server_3 binlogged NEXTVAL with the correct columns +connection server_3; +FLUSH LOGS; +include/ensure_binlog_row_event_columns.inc [(1,2,3,4,5,6,7,8)] +# MYSQL_BINLOG mysqld_datadir/binlog_filename -vv > assert_file +# Verifying all expected column ids appear in binlog event output.. +# ..success +# Verifying only expected column ids appear in binlog event output.. +# ..success +# Cleanup +connection server_1; +DROP TABLE s1; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N' +connection server_1; +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y' +connection server_2; +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y' +connection server_3; +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +connection server_3; +include/rpl_end.inc +# End of tests diff --git a/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result index a6fc13c31e7f1..bb0ae5c805ed2 100644 --- a/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result +++ b/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result @@ -276,7 +276,7 @@ master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `fc`() RETURNS varchar(64) CHARSET latin1 +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `fc`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_swedish_ci RETURN "fc" master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Annotate_rows # # INSERT INTO tt_1(ddl_case) VALUES (21) diff --git a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result index baabcf65dc531..8ba705a76eee7 100644 --- a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result +++ b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result @@ -168,11 +168,11 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT) @@ -191,11 +191,11 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1(word VARCHAR(20)) @@ -306,11 +306,11 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1(word VARCHAR(20)) @@ -335,11 +335,11 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT) diff --git a/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result b/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result new file mode 100644 index 0000000000000..4eeb863bb4020 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result @@ -0,0 +1,41 @@ +include/master-slave.inc +[connection master] +connection slave; +include/stop_slave.inc +SET @save_dbug= @@GLOBAL.debug_dbug; +SET @@global.debug_dbug="+d,pause_sql_thread_on_fde"; +include/start_slave.inc +# Future events must be logged at least 2 seconds after +# the slave starts +connection master; +# Write events to ensure slave will be consistent with master +create table t1 (a int); +insert into t1 values (1); +# Flush logs on master forces slave to generate a Format description +# event in its relay log +flush logs; +connection slave; +# Ignore FDEs that happen before the CREATE/INSERT commands +SET DEBUG_SYNC='now WAIT_FOR paused_on_fde'; +SET DEBUG_SYNC='now SIGNAL sql_thread_continue'; +SET DEBUG_SYNC='now WAIT_FOR paused_on_fde'; +SET DEBUG_SYNC='now SIGNAL sql_thread_continue'; +# On the next FDE, the slave should have the master CREATE/INSERT events +SET DEBUG_SYNC='now WAIT_FOR paused_on_fde'; +select count(*)=1 from t1; +count(*)=1 +1 +# The relay log FDE has been processed - here we check to ensure it was +# not considered in Seconds_Behind_Master calculation +connection slave1; +# Safely resume slave SQL thread +# Prove SQL thread is in state "debug sync point: now" +SET @@global.debug_dbug="-d,pause_sql_thread_on_fde"; +SET DEBUG_SYNC='now SIGNAL sql_thread_continue'; +# Wait for SQL thread to continue into normal execution +SET DEBUG_SYNC='RESET'; +connection master; +DROP TABLE t1; +connection slave; +SET @@global.debug_dbug=$save_dbug; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result b/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result index 1c15b10da96ca..8956eee2d2f5e 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result @@ -70,6 +70,9 @@ INSERT INTO t1 VALUES (3, 'dummy3'); SHOW VARIABLES LIKE 'gtid_binlog_pos'; Variable_name Value gtid_binlog_pos 0-2-5 +SHOW VARIABLES LIKE 'gtid_binlog_state'; +Variable_name Value +gtid_binlog_state 0-1-4,0-2-5 SHOW VARIABLES LIKE 'gtid_slave_pos'; Variable_name Value gtid_slave_pos 0-1-4 @@ -84,12 +87,15 @@ gtid_slave_pos 0-2-5 SHOW VARIABLES LIKE 'gtid_binlog_pos'; Variable_name Value gtid_binlog_pos 0-2-5 +SHOW VARIABLES LIKE 'gtid_binlog_state'; +Variable_name Value +gtid_binlog_state 0-1-4,0-2-5 connection server_2; # # Case:2 # # CRASH the new master, and FAILOVER back to the original -# INSERT INTO t1 VALUES (4, REPEAT("x", 4100)) +# SET STATEMENT server_id=1 FOR INSERT INTO t1 VALUES (4, REPEAT("x", 4100)) # INSERT INTO t1 VALUES (5, REPEAT("x", 4100)) # Rows 4 and 5 will be in master's binlog but not committed, they get # replicated to slave and applied. On crash master should have 3 rows @@ -98,14 +104,14 @@ connection server_2; # Expected State post crash: #================================================================= # Master | Slave | -# 0-2-6 (Not commited) | 0-2-6 (Received through semi-sync | +# 0-1-6 (Not commited) | 0-1-6 (Received through semi-sync | # | replication and applied) | # 0-2-7 (Not commited) | 0-2-7 (Received through semi-sync | # | replication and applied) | #================================================================= connect conn_client,127.0.0.1,root,,test,$SERVER_MYPORT_2,; SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go"; -INSERT INTO t1 VALUES (4, REPEAT("x", 4100)); +SET STATEMENT server_id=1 FOR INSERT INTO t1 VALUES (4, REPEAT("x", 4100)); connect conn_client_2,127.0.0.1,root,,test,$SERVER_MYPORT_2,; SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; SET GLOBAL debug_dbug="d,Notify_binlog_EOF"; @@ -123,7 +129,7 @@ SELECT @@GLOBAL.gtid_current_pos; # restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 connection server_2; include/assert.inc [Table t1 should have 3 rows.] -FOUND 1 /truncated binlog file:.*slave.*000002/ in mysqld.2.err +FOUND 1 /truncated binlog file:.*slave.*000002.* to remove transactions starting from GTID 0-1-6/ in mysqld.2.err disconnect conn_client; connection server_1; set global rpl_semi_sync_master_enabled = 1; @@ -134,7 +140,7 @@ set global rpl_semi_sync_slave_enabled = 1; set @@global.gtid_slave_pos=@@global.gtid_binlog_pos; include/start_slave.inc # -# Server_1 promoted as master will send 0-2-6 and 0-2-7 to slave Server_2 +# Server_1 promoted as master will send 0-1-6 and 0-2-7 to slave Server_2 # connection server_1; INSERT INTO t1 VALUES (6, 'dummy6'); @@ -142,6 +148,9 @@ INSERT INTO t1 VALUES (6, 'dummy6'); SHOW VARIABLES LIKE 'gtid_binlog_pos'; Variable_name Value gtid_binlog_pos 0-1-8 +SHOW VARIABLES LIKE 'gtid_binlog_state'; +Variable_name Value +gtid_binlog_state 0-2-7,0-1-8 SHOW VARIABLES LIKE 'gtid_slave_pos'; Variable_name Value gtid_slave_pos 0-2-7 @@ -156,6 +165,9 @@ gtid_slave_pos 0-1-8 SHOW VARIABLES LIKE 'gtid_binlog_pos'; Variable_name Value gtid_binlog_pos 0-1-8 +SHOW VARIABLES LIKE 'gtid_binlog_state'; +Variable_name Value +gtid_binlog_state 0-2-7,0-1-8 include/diff_tables.inc [server_1:t1, server_2:t1] connection server_1; # @@ -196,7 +208,7 @@ SELECT @@GLOBAL.gtid_current_pos; # restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 connection server_1; include/assert.inc [Table t1 should have 6 rows.] -NOT FOUND /truncated binlog file:.*master.*000003/ in mysqld.1.err +FOUND 1 /truncated binlog file:.*master.*000002.* to remove transactions starting from GTID 0-1-9/ in mysqld.1.err disconnect conn_client; connection server_2; set global rpl_semi_sync_master_enabled = 1; @@ -216,6 +228,9 @@ include/save_master_gtid.inc SHOW VARIABLES LIKE 'gtid_binlog_pos'; Variable_name Value gtid_binlog_pos 0-2-10 +SHOW VARIABLES LIKE 'gtid_binlog_state'; +Variable_name Value +gtid_binlog_state 0-1-9,0-2-10 SHOW VARIABLES LIKE 'gtid_slave_pos'; Variable_name Value gtid_slave_pos 0-1-9 @@ -231,6 +246,9 @@ gtid_slave_pos 0-2-10 SHOW VARIABLES LIKE 'gtid_binlog_pos'; Variable_name Value gtid_binlog_pos 0-2-10 +SHOW VARIABLES LIKE 'gtid_binlog_state'; +Variable_name Value +gtid_binlog_state 0-1-9,0-2-10 # # Cleanup # diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_shutdown_await_ack.result b/mysql-test/suite/rpl/r/rpl_semi_sync_shutdown_await_ack.result new file mode 100644 index 0000000000000..719b61b796b9f --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_semi_sync_shutdown_await_ack.result @@ -0,0 +1,517 @@ +############################# +# Common setup for all tests +############################# +# Note: Simulated slave delay is hardcoded to 800 milliseconds +# Note: Simulated master shutdown delay is hardcoded to 500 milliseconds +include/rpl_init.inc [topology=1->2, 1->3] +connection server_1; +# Slaves which simulate an error will produce a timeout on the primary +call mtr.add_suppression("Timeout waiting"); +call mtr.add_suppression("did not exit"); +# Suppress slave errors related to the simulated error +connection server_2; +call mtr.add_suppression("reply failed"); +call mtr.add_suppression("Replication event checksum verification"); +call mtr.add_suppression("Relay log write failure"); +call mtr.add_suppression("Failed to kill the active semi-sync connection"); +connection server_3; +call mtr.add_suppression("reply failed"); +call mtr.add_suppression("Replication event checksum verification"); +call mtr.add_suppression("Relay log write failure"); +call mtr.add_suppression("Failed to kill the active semi-sync connection"); +connection server_1; +CREATE TABLE t1 (a int); +connection server_2; +connection server_3; +connect server_1_con2, localhost, root,,; +############################# +# Test cases +############################# +# +# Test Case 1) If both replicas simulate a delay that is within the +# allowed timeout, the primary should delay killing the suspended thread +# until an ACK is received (Rpl_semi_sync_master_yes_tx should be 1). +# +connection server_1; +#-- +#-- Semi-sync Setup +connection server_1; +#-- Enable semi-sync on slaves +let slave_last= 3 +connection server_2; +set global rpl_semi_sync_slave_enabled = 1; +include/stop_slave.inc +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status ON +connection server_3; +set global rpl_semi_sync_slave_enabled = 1; +include/stop_slave.inc +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status ON +#-- Enable semi-sync on master +connection server_1; +SET @@GLOBAL.rpl_semi_sync_master_enabled = 1; +set @@global.rpl_semi_sync_master_timeout= 1600; +#-- Wait for master to recognize semi-sync slaves +connection server_1; +#-- Master should have semi-sync enabled with 2 connections +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 2 +#-- Prepare servers to simulate delay or error +connection server_1; +SET @@GLOBAL.debug_dbug= ""; +connection server_2; +SET @@GLOBAL.debug_dbug= "+d,simulate_delay_semisync_slave_reply"; +connection server_3; +SET @@GLOBAL.debug_dbug= "+d,simulate_delay_semisync_slave_reply"; +#-- +#-- Test begins +connection server_1; +#-- Begin semi-sync transaction +INSERT INTO t1 VALUES (1); +connection server_1_con2; +#-- Wait until master recognizes a connection is awaiting semi-sync ACK +show status like 'Rpl_semi_sync_master_wait_sessions'; +Variable_name Value +Rpl_semi_sync_master_wait_sessions 1 +#-- Give enough time after timeout/ack received to query yes_tx/no_tx +SET @@GLOBAL.debug_dbug= "+d,delay_shutdown_phase_2_after_semisync_wait"; +#-- Begin master shutdown +SHUTDOWN WAIT FOR ALL SLAVES; +connection server_1; +#-- Ensure either ACK was received (yes_tx=1) or timeout (no_tx=1) +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 1 +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +connection server_1_con2; +# Check logs to ensure shutdown was delayed +FOUND 1 /Delaying shutdown to await semi-sync ACK/ in mysqld.1.err +# Validate slave data is in correct state +connection server_2; +select count(*)=1 from t1; +count(*)=1 +1 +connection server_3; +select count(*)=1 from t1; +count(*)=1 +1 +# +#-- Re-synchronize slaves with master and disable semi-sync +#-- Stop slaves +connection server_2; +SET @@GLOBAL.debug_dbug= ""; +SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0; +include/stop_slave.inc +connection server_3; +SET @@GLOBAL.debug_dbug= ""; +SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0; +include/stop_slave.inc +#-- Bring the master back up +connection server_1_con2; +connection default; +connection server_1; +SET @@GLOBAL.debug_dbug= ""; +SET @@GLOBAL.rpl_semi_sync_master_enabled = 0; +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status OFF +TRUNCATE TABLE t1; +#-- Bring slaves back up +connection server_2; +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +SELECT COUNT(*)=0 from t1; +COUNT(*)=0 +1 +connection server_3; +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +SELECT COUNT(*)=0 from t1; +COUNT(*)=0 +1 +# +# Test Case 2) If both replicas simulate an error before sending an ACK, +# the primary should delay killing the suspended thread until the +# timeout is reached (Rpl_semi_sync_master_no_tx should be 1). +# +connection server_1; +#-- +#-- Semi-sync Setup +connection server_1; +#-- Enable semi-sync on slaves +let slave_last= 3 +connection server_2; +set global rpl_semi_sync_slave_enabled = 1; +include/stop_slave.inc +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status ON +connection server_3; +set global rpl_semi_sync_slave_enabled = 1; +include/stop_slave.inc +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status ON +#-- Enable semi-sync on master +connection server_1; +SET @@GLOBAL.rpl_semi_sync_master_enabled = 1; +set @@global.rpl_semi_sync_master_timeout= 500; +#-- Wait for master to recognize semi-sync slaves +connection server_1; +#-- Master should have semi-sync enabled with 2 connections +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 2 +#-- Prepare servers to simulate delay or error +connection server_1; +SET @@GLOBAL.debug_dbug= "+d,mysqld_delay_kill_threads_phase_1"; +connection server_2; +SET @@GLOBAL.debug_dbug= "+d,corrupt_queue_event"; +connection server_3; +SET @@GLOBAL.debug_dbug= "+d,corrupt_queue_event"; +#-- +#-- Test begins +connection server_1; +#-- Begin semi-sync transaction +INSERT INTO t1 VALUES (1); +connection server_1_con2; +#-- Wait until master recognizes a connection is awaiting semi-sync ACK +show status like 'Rpl_semi_sync_master_wait_sessions'; +Variable_name Value +Rpl_semi_sync_master_wait_sessions 1 +#-- Give enough time after timeout/ack received to query yes_tx/no_tx +SET @@GLOBAL.debug_dbug= "+d,delay_shutdown_phase_2_after_semisync_wait"; +#-- Begin master shutdown +SHUTDOWN WAIT FOR ALL SLAVES; +connection server_1; +#-- Ensure either ACK was received (yes_tx=1) or timeout (no_tx=1) +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 0 +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 1 +connection server_1_con2; +# Check logs to ensure shutdown was delayed +FOUND 2 /Delaying shutdown to await semi-sync ACK/ in mysqld.1.err +# Validate slave data is in correct state +connection server_2; +select count(*)=0 from t1; +count(*)=0 +1 +connection server_3; +select count(*)=0 from t1; +count(*)=0 +1 +# +#-- Re-synchronize slaves with master and disable semi-sync +#-- Stop slaves +connection server_2; +SET @@GLOBAL.debug_dbug= ""; +SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0; +include/stop_slave.inc +connection server_3; +SET @@GLOBAL.debug_dbug= ""; +SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0; +include/stop_slave.inc +#-- Bring the master back up +connection server_1_con2; +connection default; +connection server_1; +SET @@GLOBAL.debug_dbug= ""; +SET @@GLOBAL.rpl_semi_sync_master_enabled = 0; +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status OFF +TRUNCATE TABLE t1; +#-- Bring slaves back up +connection server_2; +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +SELECT COUNT(*)=0 from t1; +COUNT(*)=0 +1 +connection server_3; +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +SELECT COUNT(*)=0 from t1; +COUNT(*)=0 +1 +# +# Test Case 3) If one replica simulates a delay within the allowed +# timeout and the other simulates an error before sending an ACK, the +# primary should delay killing the suspended thread until it receives an +# ACK from the delayed slave (Rpl_semi_sync_master_yes_tx should be 1). +# +connection server_1; +#-- +#-- Semi-sync Setup +connection server_1; +#-- Enable semi-sync on slaves +let slave_last= 3 +connection server_2; +set global rpl_semi_sync_slave_enabled = 1; +include/stop_slave.inc +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status ON +connection server_3; +set global rpl_semi_sync_slave_enabled = 1; +include/stop_slave.inc +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status ON +#-- Enable semi-sync on master +connection server_1; +SET @@GLOBAL.rpl_semi_sync_master_enabled = 1; +set @@global.rpl_semi_sync_master_timeout= 1600; +#-- Wait for master to recognize semi-sync slaves +connection server_1; +#-- Master should have semi-sync enabled with 2 connections +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 2 +#-- Prepare servers to simulate delay or error +connection server_1; +SET @@GLOBAL.debug_dbug= "+d,mysqld_delay_kill_threads_phase_1"; +connection server_2; +SET @@GLOBAL.debug_dbug= "+d,corrupt_queue_event"; +connection server_3; +SET @@GLOBAL.debug_dbug= "+d,simulate_delay_semisync_slave_reply"; +#-- +#-- Test begins +connection server_1; +#-- Begin semi-sync transaction +INSERT INTO t1 VALUES (1); +connection server_1_con2; +#-- Wait until master recognizes a connection is awaiting semi-sync ACK +show status like 'Rpl_semi_sync_master_wait_sessions'; +Variable_name Value +Rpl_semi_sync_master_wait_sessions 1 +#-- Give enough time after timeout/ack received to query yes_tx/no_tx +SET @@GLOBAL.debug_dbug= "+d,delay_shutdown_phase_2_after_semisync_wait"; +#-- Begin master shutdown +SHUTDOWN WAIT FOR ALL SLAVES; +connection server_1; +#-- Ensure either ACK was received (yes_tx=1) or timeout (no_tx=1) +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 1 +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +connection server_1_con2; +# Check logs to ensure shutdown was delayed +FOUND 3 /Delaying shutdown to await semi-sync ACK/ in mysqld.1.err +# Validate slave data is in correct state +connection server_2; +select count(*)=0 from t1; +count(*)=0 +1 +connection server_3; +select count(*)=1 from t1; +count(*)=1 +1 +# +#-- Re-synchronize slaves with master and disable semi-sync +#-- Stop slaves +connection server_2; +SET @@GLOBAL.debug_dbug= ""; +SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0; +include/stop_slave.inc +connection server_3; +SET @@GLOBAL.debug_dbug= ""; +SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0; +include/stop_slave.inc +#-- Bring the master back up +connection server_1_con2; +connection default; +connection server_1; +SET @@GLOBAL.debug_dbug= ""; +SET @@GLOBAL.rpl_semi_sync_master_enabled = 0; +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status OFF +TRUNCATE TABLE t1; +#-- Bring slaves back up +connection server_2; +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +SELECT COUNT(*)=0 from t1; +COUNT(*)=0 +1 +connection server_3; +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +SELECT COUNT(*)=0 from t1; +COUNT(*)=0 +1 +# +# Test Case 4) If a replica errors before sending an ACK, it will cause +# the IO thread to stop and handle the error. During error handling, if +# semi-sync is active, the replica will form a new connection with the +# primary to kill the active connection. However, if the primary is +# shutting down, it may kill the new connection, thereby leaving the +# active semi-sync connection in-tact. The slave should notice this, and +# not issue a `QUIT` command to the primary, which would otherwise be +# sent to kill an active connection. This test case validates that the +# slave does not send a `QUIT` in this case (Rpl_semi_sync_master_yes_tx +# should be 1 because server_3 will send the ACK within a valid timeout). +# +connection server_1; +#-- +#-- Semi-sync Setup +connection server_1; +#-- Enable semi-sync on slaves +let slave_last= 3 +connection server_2; +set global rpl_semi_sync_slave_enabled = 1; +include/stop_slave.inc +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status ON +connection server_3; +set global rpl_semi_sync_slave_enabled = 1; +include/stop_slave.inc +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status ON +#-- Enable semi-sync on master +connection server_1; +SET @@GLOBAL.rpl_semi_sync_master_enabled = 1; +set @@global.rpl_semi_sync_master_timeout= 1600; +#-- Wait for master to recognize semi-sync slaves +connection server_1; +#-- Master should have semi-sync enabled with 2 connections +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 2 +#-- Prepare servers to simulate delay or error +connection server_1; +SET @@GLOBAL.debug_dbug= "+d,mysqld_delay_kill_threads_phase_1"; +connection server_2; +SET @@GLOBAL.debug_dbug= "+d,corrupt_queue_event,slave_delay_killing_semisync_connection"; +connection server_3; +SET @@GLOBAL.debug_dbug= "+d,simulate_delay_semisync_slave_reply"; +#-- +#-- Test begins +connection server_1; +#-- Begin semi-sync transaction +INSERT INTO t1 VALUES (1); +connection server_1_con2; +#-- Wait until master recognizes a connection is awaiting semi-sync ACK +show status like 'Rpl_semi_sync_master_wait_sessions'; +Variable_name Value +Rpl_semi_sync_master_wait_sessions 1 +#-- Give enough time after timeout/ack received to query yes_tx/no_tx +SET @@GLOBAL.debug_dbug= "+d,delay_shutdown_phase_2_after_semisync_wait"; +#-- Begin master shutdown +SHUTDOWN WAIT FOR ALL SLAVES; +connection server_1; +#-- Ensure either ACK was received (yes_tx=1) or timeout (no_tx=1) +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 1 +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +connection server_1_con2; +# Check logs to ensure shutdown was delayed +FOUND 4 /Delaying shutdown to await semi-sync ACK/ in mysqld.1.err +# Validate slave data is in correct state +connection server_2; +select count(*)=0 from t1; +count(*)=0 +1 +connection server_3; +select count(*)=1 from t1; +count(*)=1 +1 +# +#-- Re-synchronize slaves with master and disable semi-sync +#-- Stop slaves +connection server_2; +SET @@GLOBAL.debug_dbug= ""; +SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0; +include/stop_slave.inc +connection server_3; +SET @@GLOBAL.debug_dbug= ""; +SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0; +include/stop_slave.inc +#-- Bring the master back up +connection server_1_con2; +connection default; +connection server_1; +SET @@GLOBAL.debug_dbug= ""; +SET @@GLOBAL.rpl_semi_sync_master_enabled = 0; +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status OFF +TRUNCATE TABLE t1; +#-- Bring slaves back up +connection server_2; +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +SELECT COUNT(*)=0 from t1; +COUNT(*)=0 +1 +connection server_3; +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +SELECT COUNT(*)=0 from t1; +COUNT(*)=0 +1 +############################# +# Cleanup +############################# +connection server_2; +include/stop_slave.inc +include/start_slave.inc +connection server_3; +include/stop_slave.inc +include/start_slave.inc +connection server_1; +drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_wait_point.result b/mysql-test/suite/rpl/r/rpl_semi_sync_wait_point.result index a0ea06afa89da..c303abc672c0d 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync_wait_point.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync_wait_point.result @@ -7,8 +7,6 @@ SET @@global.rpl_semi_sync_master_timeout = 60000; SET @@global.rpl_semi_sync_master_wait_no_slave = 1; # It's okay to see "Killed" but we should not see "Timeout" in the log. call mtr.add_suppression("Killed waiting for reply of binlog"); -call mtr.add_suppression("Run function 'after_commit' in plugin 'rpl_semi_sync_master' failed"); -call mtr.add_suppression("Run function 'after_sync' in plugin 'rpl_semi_sync_master' failed"); # # Test wait point = AFTER_COMMIT # diff --git a/mysql-test/suite/rpl/r/rpl_skip_error.result b/mysql-test/suite/rpl/r/rpl_skip_error.result index 0172336a99cea..eb6324ff987e4 100644 --- a/mysql-test/suite/rpl/r/rpl_skip_error.result +++ b/mysql-test/suite/rpl/r/rpl_skip_error.result @@ -61,7 +61,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `data` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET SQL_LOG_BIN=1; connection slave; call mtr.add_suppression("Slave SQL.*Could not execute .*te_rows event on table test.t.; Duplicate entry.* error.* 1062"); @@ -72,7 +72,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `data` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; INSERT INTO t1 VALUES(1, 1); INSERT INTO t1 VALUES(2, 1); @@ -96,7 +96,7 @@ t2 CREATE TABLE `t2` ( `id` int(11) NOT NULL, `data` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET SQL_LOG_BIN=1; connection slave; CREATE TABLE t2(id INT NOT NULL PRIMARY KEY, data INT) Engine=MyIsam; @@ -106,7 +106,7 @@ t2 CREATE TABLE `t2` ( `id` int(11) NOT NULL, `data` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Slave_skipped_errros = 4 connection master; INSERT INTO t2 VALUES(1, 1); diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result index dad89db8135fe..2d869787c2b3c 100644 --- a/mysql-test/suite/rpl/r/rpl_sp.result +++ b/mysql-test/suite/rpl/r/rpl_sp.result @@ -305,7 +305,7 @@ a 100 connection con1; create trigger trg before insert on t1 for each row set new.a= 10; -ERROR 42000: TRIGGER command denied to user 'zedjzlcsjhd'@'localhost' for table 't1' +ERROR 42000: TRIGGER command denied to user 'zedjzlcsjhd'@'localhost' for table `mysqltest1`.`t1` connection master; delete from t1; create trigger trg before insert on t1 for each row set new.a= 10; @@ -784,11 +784,11 @@ DELIMITER /*!*/; ROLLBACK/*!*/; SET TIMESTAMP=t/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; drop database if exists mysqltest1 diff --git a/mysql-test/suite/rpl/r/rpl_spec_variables.result b/mysql-test/suite/rpl/r/rpl_spec_variables.result index 10bb496b9d7fb..a3f1a18f291ca 100644 --- a/mysql-test/suite/rpl/r/rpl_spec_variables.result +++ b/mysql-test/suite/rpl/r/rpl_spec_variables.result @@ -74,7 +74,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection slave; CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; SHOW CREATE TABLE t1; @@ -83,14 +83,14 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) NOT NULL, `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET @@global.collation_server=latin1_swedish_ci; SET @@session.collation_server=latin1_swedish_ci; connection master; @@ -186,14 +186,14 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) NOT NULL, `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection slave; SHOW CREATE TABLE t1; Table Create Table @@ -201,21 +201,21 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) NOT NULL, `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `a` int(11) NOT NULL, `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET @@global.default_storage_engine=InnoDB; SET @@session.default_storage_engine=InnoDB; connection master; diff --git a/mysql-test/suite/rpl/r/rpl_ssl.result b/mysql-test/suite/rpl/r/rpl_ssl.result index 0b3a6cd0eca43..ce9e4d486cf8e 100644 --- a/mysql-test/suite/rpl/r/rpl_ssl.result +++ b/mysql-test/suite/rpl/r/rpl_ssl.result @@ -23,6 +23,8 @@ t Master_SSL_Allowed = 'Yes' Master_SSL_CA_Path = '' Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem' +Master_SSL_Crl = '' +Master_SSL_Crlpath = '' Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem' Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem' include/check_slave_is_running.inc @@ -37,6 +39,8 @@ include/wait_for_slave_to_start.inc Master_SSL_Allowed = 'Yes' Master_SSL_CA_Path = '' Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem' +Master_SSL_Crl = '' +Master_SSL_Crlpath = '' Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem' Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem' include/check_slave_is_running.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_1.result b/mysql-test/suite/rpl/r/rpl_start_alter_1.result new file mode 100644 index 0000000000000..9edb23216fef3 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_1.result @@ -0,0 +1,313 @@ +include/master-slave.inc +[connection master] +connection master; +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; +connection slave; +set global gtid_strict_mode=1; +# Legacy Master Slave +connect master_node,127.0.0.1,root,,$db_name, $M_port; +connect slave_node,127.0.0.1,root,,test, $S_port; +# myisam +connection master_node; +create table t1(a int, b int) engine=myisam;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# innodb +connection master_node; +create table t1(a int, b int) engine=innodb;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# aria +connection master_node; +create table t1(a int, b int) engine=aria;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# concurrent alter Myisam +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Aria +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Innodb copy +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Innodb Inplace +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +connection master; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +set global gtid_strict_mode = 0;; +connection master; +set global binlog_alter_two_phase=0;; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_2.result b/mysql-test/suite/rpl/r/rpl_start_alter_2.result new file mode 100644 index 0000000000000..a862fc5556a57 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_2.result @@ -0,0 +1,326 @@ +include/master-slave.inc +[connection master] +connection master; +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; +connection slave; +set global gtid_strict_mode=1; +connection slave; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +set global slave_parallel_mode=optimistic; +change master to master_use_gtid=slave_pos; +include/start_slave.inc +# Parallel Slave +connection master; +connect master_node,127.0.0.1,root,,$db_name, $M_port; +connect slave_node,127.0.0.1,root,,test, $S_port; +# myisam +connection master_node; +create table t1(a int, b int) engine=myisam;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# innodb +connection master_node; +create table t1(a int, b int) engine=innodb;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# aria +connection master_node; +create table t1(a int, b int) engine=aria;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# concurrent alter Myisam +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Aria +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Innodb copy +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Innodb Inplace +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +connection master; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +# cleanup +include/stop_slave.inc +set global slave_parallel_threads = 0;; +set global slave_parallel_mode = optimistic;; +set global gtid_strict_mode = 0;; +set global gtid_domain_id= 0; +include/start_slave.inc +connection master; +set global binlog_alter_two_phase=0;; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_3.result b/mysql-test/suite/rpl/r/rpl_start_alter_3.result new file mode 100644 index 0000000000000..977544014716b --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_3.result @@ -0,0 +1,326 @@ +include/master-slave.inc +[connection master] +connection master; +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; +connection slave; +set global gtid_strict_mode=1; +connection slave; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=4; +set global slave_parallel_mode=optimistic; +change master to master_use_gtid=slave_pos; +include/start_slave.inc +# Parallel Slave +connection master; +connect master_node,127.0.0.1,root,,$db_name, $M_port; +connect slave_node,127.0.0.1,root,,test, $S_port; +# myisam +connection master_node; +create table t1(a int, b int) engine=myisam;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# innodb +connection master_node; +create table t1(a int, b int) engine=innodb;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# aria +connection master_node; +create table t1(a int, b int) engine=aria;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# concurrent alter Myisam +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Aria +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Innodb copy +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Innodb Inplace +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +connection master; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +# cleanup +include/stop_slave.inc +set global slave_parallel_threads = 0;; +set global slave_parallel_mode = optimistic;; +set global gtid_strict_mode = 0;; +set global gtid_domain_id= 0; +include/start_slave.inc +connection master; +set global binlog_alter_two_phase=0;; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_4.result b/mysql-test/suite/rpl/r/rpl_start_alter_4.result new file mode 100644 index 0000000000000..9d7d6376bbaa0 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_4.result @@ -0,0 +1,327 @@ +include/master-slave.inc +[connection master] +connection master; +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; +connection slave; +set global gtid_strict_mode=1; +connection slave; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +set global slave_parallel_mode=optimistic; +change master to master_use_gtid=slave_pos; +include/start_slave.inc +# Parallel Slave +connection master; +connect master_node,127.0.0.1,root,,$db_name, $M_port; +connect slave_node,127.0.0.1,root,,test, $S_port; +# myisam +connection master_node; +create table t1(a int, b int) engine=myisam;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# innodb +connection master_node; +create table t1(a int, b int) engine=innodb;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# aria +connection master_node; +create table t1(a int, b int) engine=aria;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# concurrent alter Myisam +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Aria +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Innodb copy +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Innodb Inplace +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +connection master; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +# cleanup +include/stop_slave.inc +set global slave_parallel_threads = 0;; +set global slave_parallel_mode = optimistic;; +set global gtid_strict_mode = 0;; +set global gtid_domain_id= 0; +include/start_slave.inc +connection master; +set global binlog_alter_two_phase=0;; +set global gtid_domain_id= 0; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_5.result b/mysql-test/suite/rpl/r/rpl_start_alter_5.result new file mode 100644 index 0000000000000..4e592c1931f6f --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_5.result @@ -0,0 +1,327 @@ +include/master-slave.inc +[connection master] +connection master; +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; +connection slave; +set global gtid_strict_mode=1; +connection slave; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=4; +set global slave_parallel_mode=optimistic; +change master to master_use_gtid=slave_pos; +include/start_slave.inc +# Parallel Slave +connection master; +connect master_node,127.0.0.1,root,,$db_name, $M_port; +connect slave_node,127.0.0.1,root,,test, $S_port; +# myisam +connection master_node; +create table t1(a int, b int) engine=myisam;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# innodb +connection master_node; +create table t1(a int, b int) engine=innodb;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# aria +connection master_node; +create table t1(a int, b int) engine=aria;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# concurrent alter Myisam +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Aria +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Innodb copy +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Innodb Inplace +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +connection master; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +# cleanup +include/stop_slave.inc +set global slave_parallel_threads = 0;; +set global slave_parallel_mode = optimistic;; +set global gtid_strict_mode = 0;; +set global gtid_domain_id= 0; +include/start_slave.inc +connection master; +set global binlog_alter_two_phase=0;; +set global gtid_domain_id= 0; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_6.result b/mysql-test/suite/rpl/r/rpl_start_alter_6.result new file mode 100644 index 0000000000000..6c26d511ee2aa --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_6.result @@ -0,0 +1,329 @@ +include/master-slave.inc +[connection master] +connection master; +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; +connection slave; +set global gtid_strict_mode=1; +connection slave; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +set global slave_parallel_mode=optimistic; +set global slave_domain_parallel_threads=3; +change master to master_use_gtid=slave_pos; +include/start_slave.inc +# Parallel Slave +connection master; +connect master_node,127.0.0.1,root,,$db_name, $M_port; +connect slave_node,127.0.0.1,root,,test, $S_port; +# myisam +connection master_node; +create table t1(a int, b int) engine=myisam;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# innodb +connection master_node; +create table t1(a int, b int) engine=innodb;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# aria +connection master_node; +create table t1(a int, b int) engine=aria;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +# concurrent alter Myisam +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Aria +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Innodb copy +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# concurrent alter Innodb Inplace +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Concurrent DML +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +# diff_table of master and slave , we will do only in the case when +# sync_slave is on +include/diff_tables.inc [master_node:t1, slave_node:t1] +include/diff_tables.inc [master_node:t2, slave_node:t2] +include/diff_tables.inc [master_node:t3, slave_node:t3] +include/diff_tables.inc [master_node:t4, slave_node:t4] +include/diff_tables.inc [master_node:t5, slave_node:t5] +include/diff_tables.inc [master_node:t6, slave_node:t6] +include/diff_tables.inc [master_node:t7, slave_node:t7] +include/diff_tables.inc [master_node:t8, slave_node:t8] +include/diff_tables.inc [master_node:t9, slave_node:t9] +include/diff_tables.inc [master_node:t10, slave_node:t10] +# Sync slave +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +connection master; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +# cleanup +include/stop_slave.inc +set global slave_parallel_threads = 0;; +set global slave_parallel_mode = optimistic;; +set global gtid_strict_mode = 0;; +set global slave_domain_parallel_threads = 0;; +set global gtid_domain_id= 0; +include/start_slave.inc +connection master; +set global binlog_alter_two_phase=0;; +set global gtid_domain_id= 0; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_7.result b/mysql-test/suite/rpl/r/rpl_start_alter_7.result new file mode 100644 index 0000000000000..cfe31497179eb --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_7.result @@ -0,0 +1,368 @@ +connect server_1,127.0.0.1,root,,,$SERVER_MYPORT_1; +connect server_2,127.0.0.1,root,,,$SERVER_MYPORT_2; +connect server_3,127.0.0.1,root,,,$SERVER_MYPORT_3; +connection server_1; +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; +connection server_2; +stop slave; +Warnings: +Note 1255 Slave already has been stopped +set global binlog_alter_two_phase=true; +connection server_3; +SET GLOBAL slave_parallel_threads=8; +set global slave_parallel_mode=optimistic; +set global gtid_strict_mode=1; +connection server_1; +set gtid_domain_id= 11; +create database s1; +use s1; +connect master_node,127.0.0.1,root,,$db_name, $M_port; +set gtid_domain_id= 11;; +connect slave_node,127.0.0.1,root,,test, $S_port; +set gtid_domain_id= 11;; +# myisam +connection master_node; +create table t1(a int, b int) engine=myisam;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +# innodb +connection master_node; +create table t1(a int, b int) engine=innodb;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +# aria +connection master_node; +create table t1(a int, b int) engine=aria;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +connection master_node; +drop table t1; +# concurrent alter Myisam +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Aria +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Innodb copy +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Innodb Inplace +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +connection server_1; +drop database s1; +select @@gtid_binlog_pos; +@@gtid_binlog_pos +11-1-412 +connection server_2; +set gtid_domain_id= 12; +create database s2; +use s2; +connect master_node,127.0.0.1,root,,$db_name, $M_port; +set gtid_domain_id= 12;; +connect slave_node,127.0.0.1,root,,test, $S_port; +set gtid_domain_id= 12;; +# myisam +connection master_node; +create table t1(a int, b int) engine=myisam;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +# innodb +connection master_node; +create table t1(a int, b int) engine=innodb;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +# aria +connection master_node; +create table t1(a int, b int) engine=aria;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +connection master_node; +drop table t1; +# concurrent alter Myisam +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Aria +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Innodb copy +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Innodb Inplace +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +connection server_2; +drop database s2; +select @@gtid_binlog_pos; +@@gtid_binlog_pos +12-2-412 +connection server_3; +start all slaves; +Warnings: +Note 1937 SLAVE 'm2' started +Note 1937 SLAVE 'm1' started +set default_master_connection = 'm1'; +include/wait_for_slave_to_start.inc +set default_master_connection = 'm2'; +include/wait_for_slave_to_start.inc +set default_master_connection = 'm1'; +include/sync_with_master_gtid.inc +set default_master_connection = 'm2'; +include/sync_with_master_gtid.inc +# cleanup +connection server_3; +set default_master_connection = 'm1'; +include/stop_slave.inc +set default_master_connection = 'm2'; +include/stop_slave.inc +set global slave_parallel_threads = 0;; +set global slave_parallel_mode = optimistic;; +set global gtid_strict_mode = 0;; +set global gtid_domain_id= 0; +reset master; +RESET SLAVE ALL; +SET GLOBAL gtid_slave_pos= ''; +connection server_1; +set global binlog_alter_two_phase=0;; +set global gtid_domain_id= 0; +reset master; +connection server_2; +set global gtid_domain_id= 0; +set global binlog_alter_two_phase=0; +reset master; +disconnect server_1; +disconnect server_2; +disconnect server_3; diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_8.result b/mysql-test/suite/rpl/r/rpl_start_alter_8.result new file mode 100644 index 0000000000000..8002f295f5ce5 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_8.result @@ -0,0 +1,362 @@ +connect server_1,127.0.0.1,root,,,$SERVER_MYPORT_1; +connect server_2,127.0.0.1,root,,,$SERVER_MYPORT_2; +connect server_3,127.0.0.1,root,,,$SERVER_MYPORT_3; +connection server_1; +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; +connection server_2; +stop slave; +Warnings: +Note 1255 Slave already has been stopped +set global binlog_alter_two_phase=true; +connection server_3; +SET GLOBAL slave_parallel_threads=20; +set global slave_parallel_mode=optimistic; +set global gtid_strict_mode=1; +connection server_1; +set gtid_domain_id= 11; +create database s1; +use s1; +connect master_node,127.0.0.1,root,,$db_name, $M_port; +set gtid_domain_id= 11;; +connect slave_node,127.0.0.1,root,,test, $S_port; +set gtid_domain_id= 11;; +# myisam +connection master_node; +create table t1(a int, b int) engine=myisam;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +# innodb +connection master_node; +create table t1(a int, b int) engine=innodb;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +# aria +connection master_node; +create table t1(a int, b int) engine=aria;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +connection master_node; +drop table t1; +# concurrent alter Myisam +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Aria +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Innodb copy +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Innodb Inplace +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +connection server_1; +drop database s1; +connection server_2; +set gtid_domain_id= 12; +create database s2; +use s2; +connect master_node,127.0.0.1,root,,$db_name, $M_port; +set gtid_domain_id= 12;; +connect slave_node,127.0.0.1,root,,test, $S_port; +set gtid_domain_id= 12;; +# myisam +connection master_node; +create table t1(a int, b int) engine=myisam;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +# innodb +connection master_node; +create table t1(a int, b int) engine=innodb;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +# aria +connection master_node; +create table t1(a int, b int) engine=aria;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +connection master_node; +drop table t1; +# concurrent alter Myisam +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Aria +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Innodb copy +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Innodb Inplace +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +connection server_2; +drop database s2; +connection server_3; +start all slaves; +Warnings: +Note 1937 SLAVE 'm2' started +Note 1937 SLAVE 'm1' started +set default_master_connection = 'm1'; +include/wait_for_slave_to_start.inc +set default_master_connection = 'm2'; +include/wait_for_slave_to_start.inc +set default_master_connection = 'm1'; +include/sync_with_master_gtid.inc +set default_master_connection = 'm2'; +include/sync_with_master_gtid.inc +# cleanup +connection server_3; +set default_master_connection = 'm1'; +include/stop_slave.inc +set default_master_connection = 'm2'; +include/stop_slave.inc +set global slave_parallel_threads = 0;; +set global slave_parallel_mode = optimistic;; +set global gtid_strict_mode = 0;; +set global gtid_domain_id= 0; +reset master; +RESET SLAVE ALL; +SET GLOBAL gtid_slave_pos= ''; +connection server_1; +set global binlog_alter_two_phase=0;; +set global gtid_domain_id= 0; +reset master; +connection server_2; +set global gtid_domain_id= 0; +set global binlog_alter_two_phase=0;; +reset master; +disconnect server_1; +disconnect server_2; +disconnect server_3; diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_bugs.result b/mysql-test/suite/rpl/r/rpl_start_alter_bugs.result new file mode 100644 index 0000000000000..3fb3df27afd2b --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_bugs.result @@ -0,0 +1,33 @@ +include/master-slave.inc +[connection master] +connection master; +set global binlog_alter_two_phase=true; +connection slave; +stop slave; +SET global slave_parallel_threads=2; +set global slave_parallel_mode=optimistic; +start slave; +connection master; +CREATE TABLE t1 (i int primary key) ENGINE = InnoDB; +connection master1; +ALTER TABLE t1 DROP PRIMARY KEY; +ALTER TABLE t1 ADD UNIQUE KEY ui (i); +ALTER TABLE t1 ADD PRIMARY KEY (i); +connection slave; +connection master; +drop table t1; +CREATE TABLE t1 (a int)engine=innodb; +ALTER TABLE t1 add column b int, LOCK=EXCLUSIVE; +drop table t1; +CREATE TABLE t1 (pk int)engine=innodb; +ALTER TABLE t1 DROP FOREIGN KEY y, LOCK=EXCLUSIVE; +ERROR 42000: Can't DROP FOREIGN KEY `y`; check that it exists +drop table t1; +connection slave; +connection master; +set global binlog_alter_two_phase=false; +connection slave; +include/stop_slave.inc +SET global slave_parallel_threads=0; +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_chain_basic.result b/mysql-test/suite/rpl/r/rpl_start_alter_chain_basic.result new file mode 100644 index 0000000000000..b6c2845856175 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_chain_basic.result @@ -0,0 +1,83 @@ +include/rpl_init.inc [topology=1->2->3->4] +connection server_3; +set global gtid_strict_mode=1; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +set global slave_parallel_mode=optimistic; +change master to master_use_gtid=slave_pos; +include/start_slave.inc +connection server_1; +set global binlog_alter_two_phase=ON; +set binlog_alter_two_phase=ON; +connect master_node,127.0.0.1,root,,$db_name, $SERVER_MYPORT_1; +connect slave_node,127.0.0.1,root,,test, $SERVER_MYPORT_2; +# innodb +connection master_node; +create table t1(a int, b int) engine=innodb;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +include/save_master_gtid.inc +connection slave_node; +include/sync_with_master_gtid.inc +disconnect master_node; +disconnect slave_node; +connection server_1; +set global binlog_alter_two_phase=0; +include/rpl_sync.inc +connection server_2; +select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; +domain_id seq_no +0 12 +connection server_3; +select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; +domain_id seq_no +0 12 +include/stop_slave.inc +set global slave_parallel_threads = 0;; +set global slave_parallel_mode = optimistic;; +set global gtid_strict_mode = 0;; +include/start_slave.inc +select @@slave_parallel_threads; +@@slave_parallel_threads +0 +connection server_4; +select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; +domain_id seq_no +0 12 +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_ftwrl.result b/mysql-test/suite/rpl/r/rpl_start_alter_ftwrl.result new file mode 100644 index 0000000000000..4f22c2a1f5f1f --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_ftwrl.result @@ -0,0 +1,60 @@ +include/master-slave.inc +[connection master] +connection slave; +include/stop_slave.inc +SET @@global.slave_parallel_threads=4; +SET @@global.slave_parallel_mode=optimistic; +CHANGE MASTER TO master_use_gtid=slave_pos; +SET @@global.debug_dbug="+d,at_write_start_alter"; +include/start_slave.inc +connection master; +SET @@session.binlog_alter_two_phase=true; +CREATE TABLE t1 (a INT) ENGINE=innodb; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +connection master; +SET @@session.alter_algorithm='INSTANT'; +SET @@session.gtid_domain_id=11; +ALTER TABLE t1 ADD COLUMN b int; +# START Alter having exclusive lock is waiting for the signal +connection slave; +# FTWRL is sent first to wait for SA +connection slave1; +FLUSH TABLES WITH READ LOCK; +# SA completes +connection slave; +set DEBUG_SYNC= "now signal alter_cont"; +connection slave1; +connection slave; +# Release CA +connection slave1; +UNLOCK TABLES; +connection master; +connection slave; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) ENGINE=innodb +slave-bin.000001 # Gtid # # GTID #-#-# START ALTER +slave-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN b int +slave-bin.000001 # Gtid # # GTID #-#-# COMMIT ALTER id=# +slave-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN b int +connection master; +DROP TABLE t1; +connection slave; +# cleanup +connection slave; +set DEBUG_SYNC = RESET; +include/stop_slave.inc +set global slave_parallel_threads = 0; +set global slave_parallel_mode = optimistic; +set @@global.debug_dbug = ""; +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_instant.result b/mysql-test/suite/rpl/r/rpl_start_alter_instant.result new file mode 100644 index 0000000000000..17aaad81aa40a --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_instant.result @@ -0,0 +1,66 @@ +include/master-slave.inc +[connection master] +connection master; +set binlog_alter_two_phase=true; +CREATE OR REPLACE TABLE tab ( +a int PRIMARY KEY, +b varchar(50), +c varchar(50) +) CHARACTER SET=latin1 engine=innodb; +SET SESSION alter_algorithm='INSTANT'; +ALTER TABLE tab MODIFY COLUMN b varchar(100); +SET SESSION alter_algorithm='NOCOPY'; +ALTER TABLE tab MODIFY COLUMN c varchar(100); +SHOW CREATE TABLE tab; +Table Create Table +tab CREATE TABLE `tab` ( + `a` int(11) NOT NULL, + `b` varchar(100) DEFAULT NULL, + `c` varchar(100) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE tab ( +a int PRIMARY KEY, +b varchar(50), +c varchar(50) +) CHARACTER SET=latin1 engine=innodb +master-bin.000001 # Gtid # # GTID #-#-# START ALTER +master-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN b varchar(100) +master-bin.000001 # Gtid # # GTID #-#-# COMMIT ALTER id=# +master-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN b varchar(100) +master-bin.000001 # Gtid # # GTID #-#-# START ALTER +master-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN c varchar(100) +master-bin.000001 # Gtid # # GTID #-#-# COMMIT ALTER id=# +master-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN c varchar(100) +connection slave; +SHOW CREATE TABLE tab; +Table Create Table +tab CREATE TABLE `tab` ( + `a` int(11) NOT NULL, + `b` varchar(100) DEFAULT NULL, + `c` varchar(100) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE tab ( +a int PRIMARY KEY, +b varchar(50), +c varchar(50) +) CHARACTER SET=latin1 engine=innodb +slave-bin.000001 # Gtid # # GTID #-#-# START ALTER +slave-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN b varchar(100) +slave-bin.000001 # Gtid # # GTID #-#-# COMMIT ALTER id=# +slave-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN b varchar(100) +slave-bin.000001 # Gtid # # GTID #-#-# START ALTER +slave-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN c varchar(100) +slave-bin.000001 # Gtid # # GTID #-#-# COMMIT ALTER id=# +slave-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN c varchar(100) +connection master; +DROP TABLE tab; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result b/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result new file mode 100644 index 0000000000000..e008bbc81a78e --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result @@ -0,0 +1,172 @@ +include/master-slave.inc +[connection master] +connection master; +set global binlog_alter_two_phase=true; +connection slave; +include/stop_slave.inc +change master to master_use_gtid= current_pos; +set global gtid_strict_mode=1; +# Legacy Master Slave +connect master_node,127.0.0.1,root,,$db_name, $M_port; +set gtid_domain_id= 0;; +connect slave_node,127.0.0.1,root,,test, $S_port; +set gtid_domain_id= 0;; +# myisam +connection master_node; +create table t1(a int, b int) engine=myisam;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +# innodb +connection master_node; +create table t1(a int, b int) engine=innodb;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +# aria +connection master_node; +create table t1(a int, b int) engine=aria;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +connection master_node; +drop table t1; +# concurrent alter Myisam +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Aria +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Innodb copy +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Innodb Inplace +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +connection master; +select @@gtid_binlog_state; +@@gtid_binlog_state +0-1-410 +RESET master; +connection slave; +select @@gtid_binlog_state; +@@gtid_binlog_state +0-1-410 +set global gtid_strict_mode=0; +include/start_slave.inc +connection master; +set global binlog_alter_two_phase=false; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_2.result b/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_2.result new file mode 100644 index 0000000000000..2c1ae667fd651 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_2.result @@ -0,0 +1,419 @@ +connect server_1,127.0.0.1,root,,,$SERVER_MYPORT_1; +connect server_2,127.0.0.1,root,,,$SERVER_MYPORT_2; +connect server_3,127.0.0.1,root,,,$SERVER_MYPORT_3; +connection server_1; +SET @save_binlog_alter_two_phase= @@GLOBAL.binlog_alter_two_phase; +SET GLOBAL binlog_alter_two_phase = ON; +SET binlog_alter_two_phase = ON; +# Create table and perform CA and RA +CREATE TABLE t1( a INT, b INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1,1); +INSERT INTO t1 VALUES(2,2); +# Normal Alter +ALTER TABLE t1 ADD COLUMN c INT; +# Failed Alter +INSERT INTO t1 VALUES(1,1, NULL); +ALTER TABLE t1 CHANGE a a INT UNIQUE; +ERROR 23000: Duplicate entry '1' for key 'a' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT @@gtid_binlog_state; +@@gtid_binlog_state +0-1-8 +# apply the binlog +DROP TABLE t1; +# reset the binlog +RESET MASTER; +# execute the binlog +SELECT @@gtid_binlog_state; +@@gtid_binlog_state +0-1-8 +# Same as before +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# reset the binlog +RESET MASTER; +RESET SLAVE; +connection server_2; +SET @save_binlog_alter_two_phase= @@GLOBAL.binlog_alter_two_phase; +SET GLOBAL binlog_alter_two_phase = ON; +connection server_3; +SET @save_gtid_strict_mode= @@GLOBAL.gtid_strict_mode; +SET @slave_parallel_threads= @@GLOBAL.slave_parallel_threads; +SET @slave_parallel_mode= @@GLOBAL.slave_parallel_mode; +SET GLOBAL slave_parallel_threads=20; +SET GLOBAL slave_parallel_mode=optimistic; +SET GLOBAL gtid_strict_mode=1; +connection server_1; +SET gtid_domain_id= 11; +CREATE DATABASE s1; +USE s1; +connect master_node,127.0.0.1,root,,$db_name, $M_port; +set gtid_domain_id= 11;; +connect slave_node,127.0.0.1,root,,test, $S_port; +set gtid_domain_id= 11;; +# myisam +connection master_node; +create table t1(a int, b int) engine=myisam;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +# innodb +connection master_node; +create table t1(a int, b int) engine=innodb;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +# aria +connection master_node; +create table t1(a int, b int) engine=aria;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +connection master_node; +drop table t1; +# concurrent alter Myisam +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Aria +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Innodb copy +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Innodb Inplace +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +connection server_1; +DROP DATABASE s1; +connection server_2; +SET gtid_domain_id= 12; +CREATE DATABASE s2; +USE s2; +connect master_node,127.0.0.1,root,,$db_name, $M_port; +set gtid_domain_id= 12;; +connect slave_node,127.0.0.1,root,,test, $S_port; +set gtid_domain_id= 12;; +# myisam +connection master_node; +create table t1(a int, b int) engine=myisam;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +# innodb +connection master_node; +create table t1(a int, b int) engine=innodb;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master_node; +drop table t1; +# aria +connection master_node; +create table t1(a int, b int) engine=aria;; +insert into t1 values(1,1); +insert into t1 values(2,2); +# Normal Alter +alter table t1 add column c int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +# Failed Alter +insert into t1 values(1,1, NULL); +alter table t1 change a a int unique; +ERROR 23000: Duplicate entry '1' for key 'a' +set @@session.binlog_alter_two_phase = 0; +alter table t1 change a a int; +set @@session.binlog_alter_two_phase = 1; +alter table t1 change a a int; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +connection master_node; +drop table t1; +# concurrent alter Myisam +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Aria +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Innodb copy +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +# concurrent alter Innodb Inplace +# Concurrent DML +# Rollback tests +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +ERROR 23000: Duplicate entry '2' for key 'b' +connection server_2; +DROP DATABASE s2; +connection server_3; +START ALL SLAVES; +Warnings: +Note 1937 SLAVE 'm2' started +Note 1937 SLAVE 'm1' started +SET default_master_connection = 'm1'; +include/wait_for_slave_to_start.inc +SET default_master_connection = 'm2'; +include/wait_for_slave_to_start.inc +SET default_master_connection = 'm1'; +include/sync_with_master_gtid.inc +SET default_master_connection = 'm2'; +include/sync_with_master_gtid.inc +# Stop slaves and apply binlog +connection server_3; +SET default_master_connection = 'm1'; +include/stop_slave.inc +SET default_master_connection = 'm2'; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads = @slave_parallel_threads; +SET GLOBAL slave_parallel_mode = @slave_parallel_mode; +SET GLOBAL gtid_strict_mode = @save_gtid_strict_mode; +SET GLOBAL gtid_domain_id= 0; +SELECT @@gtid_binlog_state; +@@gtid_binlog_state +11-1-412,12-2-412 +# reset the binlog +RESET MASTER; +# execute the binlog +SELECT @@gtid_binlog_state; +@@gtid_binlog_state +11-1-412,12-2-412 +# One more time to simulate S->S case +RESET MASTER; +# execute the binlog +SELECT @@gtid_binlog_state; +@@gtid_binlog_state +11-1-412,12-2-412 +RESET MASTER; +RESET SLAVE ALL; +SET GLOBAL gtid_slave_pos= ''; +connection server_1; +SET GLOBAL binlog_alter_two_phase=@save_binlog_alter_two_phase; +SET GLOBAL gtid_domain_id= 0; +RESET MASTER; +connection server_2; +SET GLOBAL gtid_domain_id= 0; +SET GLOBAL binlog_alter_two_phase=@save_binlog_alter_two_phase; +RESET MASTER; +disconnect server_1; +disconnect server_2; +disconnect server_3; diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_optimize.result b/mysql-test/suite/rpl/r/rpl_start_alter_optimize.result new file mode 100644 index 0000000000000..24f016e93a030 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_optimize.result @@ -0,0 +1,18 @@ +include/master-slave.inc +[connection master] +connection master; +set binlog_alter_two_phase = ON; +connection master; +CREATE TABLE t1 (i int) engine=innodb; +CREATE TABLE t2 (i int) engine=innodb; +ALTER TABLE t1 DROP CONSTRAINT IF EXISTS y; +Warnings: +Note 1091 Can't DROP CONSTRAINT `y`; check that it exists +OPTIMIZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 optimize note Table does not support optimize, doing recreate + analyze instead +test.t2 optimize status OK +connection slave; +connection master; +drop table t1,t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_options.result b/mysql-test/suite/rpl/r/rpl_start_alter_options.result new file mode 100644 index 0000000000000..30854b12be16b --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_options.result @@ -0,0 +1,497 @@ +include/master-slave.inc +[connection master] +connection slave; +stop slave; +change master to master_use_gtid= current_pos; +SET GLOBAL slave_parallel_threads=4; +set global slave_parallel_mode=optimistic; +set global gtid_strict_mode=1; +start slave; +connection master; +set binlog_alter_two_phase=true; +create table t1(a int , b int) engine=innodb; +create table a1(a int , b int) engine=myisam; +create temporary table tmp_tbl(a int, b int) engine=innodb; +alter table t1 add column if not exists c int , force , algorithm=default; +alter table t1 add column d int first, force , algorithm=default; +alter table t1 add column e int after c, force , algorithm=default; +alter table t1 add column f int after c, force , add column g int first ,add column h char, algorithm=default; +alter table t1 drop column c, drop column d, drop column e, drop column f, drop column g , drop column h, force , algorithm=default; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f int after b, force , add column g int first ,add column h varchar(100), algorithm=default; +alter table t1 add index if not exists index_1(f), force , algorithm=default; +alter table t1 drop index index_1, force , algorithm=default; +alter table t1 add unique key unique_1(g), force , algorithm=default; +alter table t1 drop index unique_1, force , algorithm=default; +alter table t1 add fulltext key f_1(h), force , algorithm=default; +alter table t1 drop column f, drop column g , force , algorithm=default; +alter table t1 add primary key(h), force , algorithm=copy; +alter table t1 drop primary key, force , algorithm=copy; +alter table t1 drop column h, force , algorithm=copy; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b, add column g varchar(100) first ,add column h char, force , algorithm=default; +alter table t1 add period for system_time(f,h); +alter table t1 add system versioning; +alter table t1 drop system versioning; +alter table t1 drop column f, drop column g , drop column h, force , algorithm=default; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=default ;; +alter table t1 alter column f set default "****", force , algorithm=default ;; +alter table t1 alter column f drop default, force , algorithm=default ;; +alter table t1 change column g new_g char, force , algorithm=copy;; +alter table t1 modify column h varchar(100), force , algorithm=copy;; +alter table t1 drop column new_g ,drop column f, drop column h, force , algorithm=default ;; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=default; +alter table t1 add index if not exists index_1(f), force , algorithm=default; +alter table t1 disable keys, force , algorithm=copy; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option +alter table t1 enable keys, force , algorithm=copy; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option +alter table t1 rename t2, force , algorithm=default; +alter table t2 rename t1, force , algorithm=default; +alter table a1 order by a; +alter table t1 rename column f to new_f, force , algorithm=copy; +alter table t1 convert to character set 'utf8', force , algorithm=copy; +alter table t1 default character set 'utf8', force , algorithm=copy; +alter table t1 default collate 'utf8_icelandic_ci', force , algorithm=copy; +alter table t1 drop column new_f ,drop column g, drop column h, force , algorithm=default; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=default; +alter table t1 partition by hash(b) partitions 8; +alter table t1 remove partitioning; +alter table t1 drop column f ,drop column g, drop column h, force , algorithm=default; +# show binlog and clear status +connection slave; +reset master; +connection master; +connection master; +drop table t1, a1; +drop temporary table tmp_tbl; +connection slave; +include/stop_slave.inc +set global slave_parallel_threads = 0;; +set global slave_parallel_mode = optimistic;; +set global gtid_strict_mode = 0;; +include/start_slave.inc +connection slave; +stop slave; +change master to master_use_gtid= current_pos; +SET GLOBAL slave_parallel_threads=4; +set global slave_parallel_mode=optimistic; +set global gtid_strict_mode=1; +start slave; +connection master; +set binlog_alter_two_phase=true; +create table t1(a int , b int) engine=innodb; +create table a1(a int , b int) engine=myisam; +create temporary table tmp_tbl(a int, b int) engine=innodb; +alter table t1 add column if not exists c int , force , algorithm=inplace; +alter table t1 add column d int first, force , algorithm=inplace; +alter table t1 add column e int after c, force , algorithm=inplace; +alter table t1 add column f int after c, force , add column g int first ,add column h char, algorithm=inplace; +alter table t1 drop column c, drop column d, drop column e, drop column f, drop column g , drop column h, force , algorithm=inplace; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f int after b, force , add column g int first ,add column h varchar(100), algorithm=inplace; +alter table t1 add index if not exists index_1(f), force , algorithm=inplace; +alter table t1 drop index index_1, force , algorithm=inplace; +alter table t1 add unique key unique_1(g), force , algorithm=inplace; +alter table t1 drop index unique_1, force , algorithm=inplace; +alter table t1 add fulltext key f_1(h), force , algorithm=inplace; +alter table t1 drop column f, drop column g , force , algorithm=inplace; +alter table t1 add primary key(h), force , algorithm=copy; +alter table t1 drop primary key, force , algorithm=copy; +alter table t1 drop column h, force , algorithm=copy; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b, add column g varchar(100) first ,add column h char, force , algorithm=inplace; +alter table t1 add period for system_time(f,h); +alter table t1 add system versioning; +alter table t1 drop system versioning; +alter table t1 drop column f, drop column g , drop column h, force , algorithm=inplace; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=inplace ;; +alter table t1 alter column f set default "****", force , algorithm=inplace ;; +alter table t1 alter column f drop default, force , algorithm=inplace ;; +alter table t1 change column g new_g char, force , algorithm=copy;; +alter table t1 modify column h varchar(100), force , algorithm=copy;; +alter table t1 drop column new_g ,drop column f, drop column h, force , algorithm=inplace ;; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=inplace; +alter table t1 add index if not exists index_1(f), force , algorithm=inplace; +alter table t1 disable keys, force , algorithm=copy; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option +alter table t1 enable keys, force , algorithm=copy; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option +alter table t1 rename t2, force , algorithm=inplace; +alter table t2 rename t1, force , algorithm=inplace; +alter table a1 order by a; +alter table t1 rename column f to new_f, force , algorithm=copy; +alter table t1 convert to character set 'utf8', force , algorithm=copy; +alter table t1 default character set 'utf8', force , algorithm=copy; +alter table t1 default collate 'utf8_icelandic_ci', force , algorithm=copy; +alter table t1 drop column new_f ,drop column g, drop column h, force , algorithm=inplace; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=inplace; +alter table t1 partition by hash(b) partitions 8; +alter table t1 remove partitioning; +alter table t1 drop column f ,drop column g, drop column h, force , algorithm=inplace; +# show binlog and clear status +connection slave; +reset master; +connection master; +connection master; +drop table t1, a1; +drop temporary table tmp_tbl; +connection slave; +include/stop_slave.inc +set global slave_parallel_threads = 0;; +set global slave_parallel_mode = optimistic;; +set global gtid_strict_mode = 0;; +include/start_slave.inc +connection slave; +stop slave; +change master to master_use_gtid= current_pos; +SET GLOBAL slave_parallel_threads=4; +set global slave_parallel_mode=optimistic; +set global gtid_strict_mode=1; +start slave; +connection master; +set binlog_alter_two_phase=true; +create table t1(a int , b int) engine=innodb; +create table a1(a int , b int) engine=myisam; +create temporary table tmp_tbl(a int, b int) engine=innodb; +alter table t1 add column if not exists c int , force , algorithm=copy; +alter table t1 add column d int first, force , algorithm=copy; +alter table t1 add column e int after c, force , algorithm=copy; +alter table t1 add column f int after c, force , add column g int first ,add column h char, algorithm=copy; +alter table t1 drop column c, drop column d, drop column e, drop column f, drop column g , drop column h, force , algorithm=copy; +alter table tmp_tbl add column if not exists c int , force , algorithm=copy; +alter table tmp_tbl add column d int first, force , algorithm=copy; +alter table tmp_tbl add column e int after c, force , algorithm=copy; +alter table tmp_tbl add column f int after c, force , add column g int first ,add column h char, algorithm=copy; +alter table tmp_tbl drop column c, drop column d, drop column e, drop column f, drop column g , drop column h, force , algorithm=copy; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f int after b, force , add column g int first ,add column h varchar(100), algorithm=copy; +alter table t1 add index if not exists index_1(f), force , algorithm=copy; +alter table t1 drop index index_1, force , algorithm=copy; +alter table t1 add unique key unique_1(g), force , algorithm=copy; +alter table t1 drop index unique_1, force , algorithm=copy; +alter table t1 add fulltext key f_1(h), force , algorithm=copy; +alter table t1 drop column f, drop column g , force , algorithm=copy; +alter table tmp_tbl add column f int after b, force , add column g int first ,add column h varchar(100), algorithm=copy; +alter table tmp_tbl add index if not exists index_1(f), force , algorithm=copy; +alter table tmp_tbl drop index index_1, force , algorithm=copy; +alter table tmp_tbl add unique key unique_1(g), force , algorithm=copy; +alter table tmp_tbl drop index unique_1, force , algorithm=copy; +alter table tmp_tbl drop column f, drop column g , force , algorithm=copy; +alter table t1 add primary key(h), force , algorithm=copy; +alter table t1 drop primary key, force , algorithm=copy; +alter table t1 drop column h, force , algorithm=copy; +alter table tmp_tbl add primary key(h), force , algorithm=copy; +alter table tmp_tbl drop primary key, force , algorithm=copy; +alter table tmp_tbl drop column h, force , algorithm=copy; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b, add column g varchar(100) first ,add column h char, force , algorithm=copy; +alter table t1 add period for system_time(f,h); +alter table t1 add system versioning; +alter table t1 drop system versioning; +alter table t1 drop column f, drop column g , drop column h, force , algorithm=copy; +# show binlog and clear status +alter table tmp_tbl add column f varchar(100) after b, add column g varchar(100) first ,add column h char, force , algorithm=copy; +alter table tmp_tbl drop column f, drop column g , drop column h, force , algorithm=copy; +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=copy ;; +alter table t1 alter column f set default "****", force , algorithm=copy ;; +alter table t1 alter column f drop default, force , algorithm=copy ;; +alter table t1 change column g new_g char, force , algorithm=copy;; +alter table t1 modify column h varchar(100), force , algorithm=copy;; +alter table t1 drop column new_g ,drop column f, drop column h, force , algorithm=copy ;; +alter table tmp_tbl add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=copy ;; +alter table tmp_tbl alter column f set default "****", force , algorithm=copy ;; +alter table tmp_tbl alter column f drop default, force , algorithm=copy ;; +alter table tmp_tbl change column g new_g char, force , algorithm=copy;; +alter table tmp_tbl modify column h varchar(100), force , algorithm=copy;; +alter table tmp_tbl drop column new_g ,drop column f, drop column h, force , algorithm=copy ;; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=copy; +alter table t1 add index if not exists index_1(f), force , algorithm=copy; +alter table t1 disable keys, force , algorithm=copy; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option +alter table t1 enable keys, force , algorithm=copy; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option +alter table t1 rename t2, force , algorithm=copy; +alter table t2 rename t1, force , algorithm=copy; +alter table a1 order by a; +alter table t1 rename column f to new_f, force , algorithm=copy; +alter table t1 convert to character set 'utf8', force , algorithm=copy; +alter table t1 default character set 'utf8', force , algorithm=copy; +alter table t1 default collate 'utf8_icelandic_ci', force , algorithm=copy; +alter table t1 drop column new_f ,drop column g, drop column h, force , algorithm=copy; +alter table tmp_tbl add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=copy; +alter table tmp_tbl add index if not exists index_1(f), force , algorithm=copy; +alter table tmp_tbl disable keys, force , algorithm=copy; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`tmp_tbl` doesn't have this option +alter table tmp_tbl enable keys, force , algorithm=copy; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`tmp_tbl` doesn't have this option +alter table a1 order by a; +alter table tmp_tbl rename column f to new_f, force , algorithm=copy; +alter table tmp_tbl convert to character set 'utf8', force , algorithm=copy; +alter table tmp_tbl default character set 'utf8', force , algorithm=copy; +alter table tmp_tbl default collate 'utf8_icelandic_ci', force , algorithm=copy; +alter table tmp_tbl drop column new_f ,drop column g, drop column h, force , algorithm=copy; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=copy; +alter table t1 partition by hash(b) partitions 8; +alter table t1 remove partitioning; +alter table t1 drop column f ,drop column g, drop column h, force , algorithm=copy; +alter table tmp_tbl add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=copy; +alter table tmp_tbl drop column f ,drop column g, drop column h, force , algorithm=copy; +# show binlog and clear status +connection slave; +reset master; +connection master; +connection master; +drop table t1, a1; +drop temporary table tmp_tbl; +connection slave; +include/stop_slave.inc +set global slave_parallel_threads = 0;; +set global slave_parallel_mode = optimistic;; +set global gtid_strict_mode = 0;; +include/start_slave.inc +# Prove formal support for nocopy and instant +connection slave; +stop slave; +change master to master_use_gtid= current_pos; +SET GLOBAL slave_parallel_threads=4; +set global slave_parallel_mode=optimistic; +set global gtid_strict_mode=1; +start slave; +connection master; +set binlog_alter_two_phase=true; +create table t1(a int , b int) engine=innodb; +create table a1(a int , b int) engine=myisam; +create temporary table tmp_tbl(a int, b int) engine=innodb; +alter table t1 add column if not exists c int , force , algorithm=instant; +alter table t1 add column d int first, force , algorithm=instant; +alter table t1 add column e int after c, force , algorithm=instant; +alter table t1 add column f int after c, force , add column g int first ,add column h char, algorithm=instant; +alter table t1 drop column c, drop column d, drop column e, drop column f, drop column g , drop column h, force , algorithm=instant; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f int after b, force , add column g int first ,add column h varchar(100), algorithm=instant; +alter table t1 add index if not exists index_1(f), force , algorithm=instant; +alter table t1 drop index index_1, force , algorithm=instant; +alter table t1 add unique key unique_1(g), force , algorithm=instant; +alter table t1 drop index unique_1, force , algorithm=instant; +alter table t1 add fulltext key f_1(h), force , algorithm=instant; +alter table t1 drop column f, drop column g , force , algorithm=instant; +alter table t1 add primary key(h), force , algorithm=copy; +alter table t1 drop primary key, force , algorithm=copy; +alter table t1 drop column h, force , algorithm=copy; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b, add column g varchar(100) first ,add column h char, force , algorithm=instant; +alter table t1 add period for system_time(f,h); +alter table t1 add system versioning; +alter table t1 drop system versioning; +alter table t1 drop column f, drop column g , drop column h, force , algorithm=instant; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=instant ;; +alter table t1 alter column f set default "****", force , algorithm=instant ;; +alter table t1 alter column f drop default, force , algorithm=instant ;; +alter table t1 change column g new_g char, force , algorithm=copy;; +alter table t1 modify column h varchar(100), force , algorithm=copy;; +alter table t1 drop column new_g ,drop column f, drop column h, force , algorithm=instant ;; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=instant; +alter table t1 add index if not exists index_1(f), force , algorithm=instant; +alter table t1 disable keys, force , algorithm=copy; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option +alter table t1 enable keys, force , algorithm=copy; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option +alter table t1 rename t2, force , algorithm=instant; +alter table t2 rename t1, force , algorithm=instant; +alter table a1 order by a; +alter table t1 rename column f to new_f, force , algorithm=copy; +alter table t1 convert to character set 'utf8', force , algorithm=copy; +alter table t1 default character set 'utf8', force , algorithm=copy; +alter table t1 default collate 'utf8_icelandic_ci', force , algorithm=copy; +alter table t1 drop column new_f ,drop column g, drop column h, force , algorithm=instant; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=instant; +alter table t1 partition by hash(b) partitions 8; +alter table t1 remove partitioning; +alter table t1 drop column f ,drop column g, drop column h, force , algorithm=instant; +# show binlog and clear status +connection slave; +reset master; +connection master; +connection master; +drop table t1, a1; +drop temporary table tmp_tbl; +connection slave; +include/stop_slave.inc +set global slave_parallel_threads = 0;; +set global slave_parallel_mode = optimistic;; +set global gtid_strict_mode = 0;; +include/start_slave.inc +connection slave; +stop slave; +change master to master_use_gtid= current_pos; +SET GLOBAL slave_parallel_threads=4; +set global slave_parallel_mode=optimistic; +set global gtid_strict_mode=1; +start slave; +connection master; +set binlog_alter_two_phase=true; +create table t1(a int , b int) engine=innodb; +create table a1(a int , b int) engine=myisam; +create temporary table tmp_tbl(a int, b int) engine=innodb; +alter table t1 add column if not exists c int , force , algorithm=nocopy; +alter table t1 add column d int first, force , algorithm=nocopy; +alter table t1 add column e int after c, force , algorithm=nocopy; +alter table t1 add column f int after c, force , add column g int first ,add column h char, algorithm=nocopy; +alter table t1 drop column c, drop column d, drop column e, drop column f, drop column g , drop column h, force , algorithm=nocopy; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f int after b, force , add column g int first ,add column h varchar(100), algorithm=nocopy; +alter table t1 add index if not exists index_1(f), force , algorithm=nocopy; +alter table t1 drop index index_1, force , algorithm=nocopy; +alter table t1 add unique key unique_1(g), force , algorithm=nocopy; +alter table t1 drop index unique_1, force , algorithm=nocopy; +alter table t1 add fulltext key f_1(h), force , algorithm=nocopy; +alter table t1 drop column f, drop column g , force , algorithm=nocopy; +alter table t1 add primary key(h), force , algorithm=copy; +alter table t1 drop primary key, force , algorithm=copy; +alter table t1 drop column h, force , algorithm=copy; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b, add column g varchar(100) first ,add column h char, force , algorithm=nocopy; +alter table t1 add period for system_time(f,h); +alter table t1 add system versioning; +alter table t1 drop system versioning; +alter table t1 drop column f, drop column g , drop column h, force , algorithm=nocopy; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=nocopy ;; +alter table t1 alter column f set default "****", force , algorithm=nocopy ;; +alter table t1 alter column f drop default, force , algorithm=nocopy ;; +alter table t1 change column g new_g char, force , algorithm=copy;; +alter table t1 modify column h varchar(100), force , algorithm=copy;; +alter table t1 drop column new_g ,drop column f, drop column h, force , algorithm=nocopy ;; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=nocopy; +alter table t1 add index if not exists index_1(f), force , algorithm=nocopy; +alter table t1 disable keys, force , algorithm=copy; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option +alter table t1 enable keys, force , algorithm=copy; +Warnings: +Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option +alter table t1 rename t2, force , algorithm=nocopy; +alter table t2 rename t1, force , algorithm=nocopy; +alter table a1 order by a; +alter table t1 rename column f to new_f, force , algorithm=copy; +alter table t1 convert to character set 'utf8', force , algorithm=copy; +alter table t1 default character set 'utf8', force , algorithm=copy; +alter table t1 default collate 'utf8_icelandic_ci', force , algorithm=copy; +alter table t1 drop column new_f ,drop column g, drop column h, force , algorithm=nocopy; +# show binlog and clear status +connection slave; +reset master; +connection master; +alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=nocopy; +alter table t1 partition by hash(b) partitions 8; +alter table t1 remove partitioning; +alter table t1 drop column f ,drop column g, drop column h, force , algorithm=nocopy; +# show binlog and clear status +connection slave; +reset master; +connection master; +connection master; +drop table t1, a1; +drop temporary table tmp_tbl; +connection slave; +include/stop_slave.inc +set global slave_parallel_threads = 0;; +set global slave_parallel_mode = optimistic;; +set global gtid_strict_mode = 0;; +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_para_to_seq.result b/mysql-test/suite/rpl/r/rpl_start_alter_para_to_seq.result new file mode 100644 index 0000000000000..d93ec724372a5 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_para_to_seq.result @@ -0,0 +1,14 @@ +include/master-slave.inc +[connection master] +connection master; +CREATE TABLE t1 (a1 int, d1 int DEFAULT 0); +INSERT INTO t1 VALUES (1,1) ; +SET binlog_alter_two_phase = ON; +ALTER TABLE t1 WAIT 9 RENAME COLUMN a1 TO a2; +SET binlog_alter_two_phase = OFF; +ALTER TABLE t1 ALTER COLUMN d1 DROP DEFAULT; +connection slave; +connection master; +drop table t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_restart_master.result b/mysql-test/suite/rpl/r/rpl_start_alter_restart_master.result new file mode 100644 index 0000000000000..a2aba33aee081 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_restart_master.result @@ -0,0 +1,85 @@ +include/master-slave.inc +[connection master] +connection slave; +SET @old_debug_slave= @@global.debug; +stop slave; +SET GLOBAL slave_parallel_threads=4; +set global slave_parallel_mode=optimistic; +set global gtid_strict_mode=1; +start slave; +connection master; +call mtr.add_suppression("ALTER query started at .+ could not be completed"); +SET @old_debug_master= @@global.debug; +set binlog_alter_two_phase=true; +create table t3( a int primary key, b int) engine=innodb; +connection master; +connection slave; +include/stop_slave.inc +connection master; +SET SESSION debug_dbug="d,start_alter_kill_after_binlog"; +alter table t3 add column d int; +ERROR HY000: Lost connection to server during query +include/rpl_reconnect.inc +set binlog_alter_two_phase= true; +alter table t3 add column d int; +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'ALTER query started at .+ could not be completed' COLLATE 'latin1_swedish_ci')) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; create table t3( a int primary key, b int) engine=innodb +master-bin.000001 # Gtid # # GTID #-#-# START ALTER +master-bin.000001 # Query # # use `test`; alter table t3 add column d int +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Gtid # # GTID #-#-# START ALTER +master-bin.000002 # Query # # use `test`; alter table t3 add column d int +master-bin.000002 # Gtid # # GTID #-#-# COMMIT ALTER id=# +master-bin.000002 # Query # # use `test`; alter table t3 add column d int +connection slave; +include/start_slave.inc +connection master; +connection slave; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'ALTER query started at .+ could not be completed' COLLATE 'latin1_swedish_ci')) +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test`; create table t3( a int primary key, b int) engine=innodb +slave-bin.000001 # Gtid # # GTID #-#-# START ALTER +slave-bin.000001 # Query # # use `test`; alter table t3 add column d int +slave-bin.000001 # Gtid # # GTID #-#-# START ALTER +slave-bin.000001 # Query # # use `test`; alter table t3 add column d int +slave-bin.000001 # Gtid # # GTID #-#-# COMMIT ALTER id=# +slave-bin.000001 # Query # # use `test`; alter table t3 add column d int +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master; +SET GLOBAL debug_dbug= @old_debug_master; +drop table t3; +set global binlog_alter_two_phase = 0; +connection slave; +SET GLOBAL debug_dbug= @old_debug_slave; +stop slave; +set global slave_parallel_threads = 0;; +set global slave_parallel_mode = optimistic;; +set global gtid_strict_mode = 0;; +start slave; +connection master; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result b/mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result new file mode 100644 index 0000000000000..0a1c1f7971ebb --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result @@ -0,0 +1,119 @@ +include/master-slave.inc +[connection master] +connection slave; +SET @old_debug_slave= @@global.debug; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=4; +set global slave_parallel_mode=optimistic; +set global gtid_strict_mode=1; +set global debug_dbug="+d,rpl_slave_stop_CA_before_binlog"; +include/start_slave.inc +connection master; +SET @old_debug_master= @@global.debug; +set global debug_dbug="+d,start_alter_delay_master"; +set global binlog_alter_two_phase=true; +create table t1( a int primary key, b int) engine=myisam; +create table t2( a int primary key, b int) engine=myisam; +connect con1,localhost,root,,; +alter table t1 add column c int;; +connection master; +# Get into binlog first and wait +# master gtid state is 0-1-3 +connect con2,localhost,root,,; +alter table t2 add column c int;; +connection master; +# Get into binlog next and wait as well +# master gtid state is 0-1-4 +set DEBUG_SYNC= "now signal alter_cont"; +connection con1; +connection con2; +create table t3( a int primary key, b int) engine=innodb; +# master gtid state is 0-1-7 +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid_list 1 # [] +master-bin.000001 # Binlog_checkpoint 1 # master-bin.000001 +master-bin.000001 # Gtid 1 # GTID #-#-# +master-bin.000001 # Query 1 # use `test`; create table t1( a int primary key, b int) engine=myisam +master-bin.000001 # Gtid 1 # GTID #-#-# +master-bin.000001 # Query 1 # use `test`; create table t2( a int primary key, b int) engine=myisam +master-bin.000001 # Gtid 1 # GTID #-#-# START ALTER +master-bin.000001 # Query 1 # use `test`; alter table add column c int +master-bin.000001 # Gtid 1 # GTID #-#-# START ALTER +master-bin.000001 # Query 1 # use `test`; alter table add column c int +master-bin.000001 # Gtid 1 # GTID #-#-# COMMIT ALTER id= +master-bin.000001 # Query 1 # use `test`; alter table add column c int +master-bin.000001 # Gtid 1 # GTID #-#-# COMMIT ALTER id= +master-bin.000001 # Query 1 # use `test`; alter table add column c int +master-bin.000001 # Gtid 1 # GTID #-#-# +master-bin.000001 # Query 1 # use `test`; create table t3( a int primary key, b int) engine=innodb +# Stop Slave +# As master binlog is SA SA CA CA +# let's stop at first CA processing (in process_commit_alter) +connection slave; +include/sync_with_master_gtid.inc +connect extra_slave,127.0.0.1,root,,test,$SLAVE_MYPORT; +stop slave;; +connection slave; +connection extra_slave; +SET GLOBAL debug_dbug= @old_debug_slave; +connection slave; +include/wait_for_slave_sql_to_stop.inc +# The list of events after the slave has stopped must have just one CA: +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Gtid_list 2 # [] +slave-bin.000001 # Binlog_checkpoint 2 # slave-bin.000001 +slave-bin.000001 # Gtid 1 # GTID #-#-# +slave-bin.000001 # Query 1 # use `test`; create table t1( a int primary key, b int) engine=myisam +slave-bin.000001 # Gtid 1 # GTID #-#-# +slave-bin.000001 # Query 1 # use `test`; create table t2( a int primary key, b int) engine=myisam +slave-bin.000001 # Gtid 1 # GTID #-#-# START ALTER +slave-bin.000001 # Query 1 # use `test`; alter table add column c int +slave-bin.000001 # Gtid 1 # GTID #-#-# START ALTER +slave-bin.000001 # Query 1 # use `test`; alter table add column c int +slave-bin.000001 # Gtid 1 # GTID #-#-# COMMIT ALTER id= +slave-bin.000001 # Query 1 # use `test`; alter table add column c int +select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; +domain_id seq_no +0 5 +include/start_slave.inc +connection master; +connection slave; +# Everything from the master binlog must have been applied now: +select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; +domain_id seq_no +0 7 +# slave gtid state is 0-1-7 +# The list of events after the slave has synchronized must have both CA: +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Gtid_list 2 # [] +slave-bin.000001 # Binlog_checkpoint 2 # slave-bin.000001 +slave-bin.000001 # Gtid 1 # GTID #-#-# +slave-bin.000001 # Query 1 # use `test`; create table t1( a int primary key, b int) engine=myisam +slave-bin.000001 # Gtid 1 # GTID #-#-# +slave-bin.000001 # Query 1 # use `test`; create table t2( a int primary key, b int) engine=myisam +slave-bin.000001 # Gtid 1 # GTID #-#-# START ALTER +slave-bin.000001 # Query 1 # use `test`; alter table add column c int +slave-bin.000001 # Gtid 1 # GTID #-#-# START ALTER +slave-bin.000001 # Query 1 # use `test`; alter table add column c int +slave-bin.000001 # Gtid 1 # GTID #-#-# COMMIT ALTER id= +slave-bin.000001 # Query 1 # use `test`; alter table add column c int +slave-bin.000001 # Gtid 1 # GTID #-#-# COMMIT ALTER id= +slave-bin.000001 # Query 1 # use `test`; alter table add column c int +slave-bin.000001 # Gtid 1 # GTID #-#-# +slave-bin.000001 # Query 1 # use `test`; create table t3( a int primary key, b int) engine=innodb +connection master; +drop table t1,t2,t3; +set global binlog_alter_two_phase = 0; +SET GLOBAL debug_dbug= @old_debug_master; +set DEBUG_SYNC= 'RESET'; +connection slave; +stop slave; +set global slave_parallel_threads = 0;; +set global slave_parallel_mode = optimistic;; +set global gtid_strict_mode = 0;; +set DEBUG_SYNC= 'RESET'; +start slave; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result index 388c8e67b680a..944ad9331ad63 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result +++ b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result @@ -1,6 +1,8 @@ include/master-slave.inc [connection master] call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +call mtr.add_suppression("Write to binary log failed: Multi-row statements required more than .max_binlog_stmt_cache_size"); +call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size"); SET GLOBAL max_binlog_cache_size = 4096; SET GLOBAL binlog_cache_size = 4096; SET GLOBAL max_binlog_stmt_cache_size = 4096; diff --git a/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result index 8b6ee56a3b471..9bcd34185a666 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result +++ b/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result @@ -227,7 +227,7 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (22) master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `fc`() RETURNS varchar(64) CHARSET latin1 +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `fc`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_swedish_ci RETURN "fc" master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (21) diff --git a/mysql-test/suite/rpl/r/rpl_stm_innodb.result b/mysql-test/suite/rpl/r/rpl_stm_innodb.result index 7e37277a8251b..d95deaffb39fe 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_stm_innodb.result @@ -54,7 +54,7 @@ SHOW CREATE TABLE mysqltest1.t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection master; INSERT INTO mysqltest1.t1 SET f1= 1; DROP TEMPORARY TABLE mysqltest1.tmp; @@ -72,7 +72,7 @@ SHOW CREATE TABLE mysqltest1.tmp2; Table Create Table tmp2 CREATE TEMPORARY TABLE `tmp2` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ######### Must return no rows here ######### SELECT COUNT(*) FROM mysqltest1.t1; COUNT(*) diff --git a/mysql-test/suite/rpl/r/rpl_table_options.result b/mysql-test/suite/rpl/r/rpl_table_options.result index 7afec3fac43d7..e567102a95e43 100644 --- a/mysql-test/suite/rpl/r/rpl_table_options.result +++ b/mysql-test/suite/rpl/r/rpl_table_options.result @@ -12,20 +12,20 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12350 +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `ull`=12350 connection slave; connection slave; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /* `ull`=12350 */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci /* `ull`=12350 */ set sql_mode=ignore_bad_table_options; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `ull`=12350 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `ull`=12350 connection master; drop table t1; set default_storage_engine=default; diff --git a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result index 650d9e5c3266b..639b107abd60a 100644 --- a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result +++ b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result @@ -26,7 +26,8 @@ connection slave; include/rpl_reset.inc connection master; CREATE TABLE t1 (a int) engine=innodb; -CREATE TABLE t2 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) ); +CREATE TABLE t2 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) ) +engine=innodb; CREATE TABLE t3 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) ); CREATE TRIGGER tr1 AFTER DELETE ON t2 FOR EACH ROW INSERT INTO t3 () VALUES (); CREATE TEMPORARY TABLE t1_tmp (i1 int); @@ -59,6 +60,7 @@ slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int) engine=innodb slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Query # # use `test`; CREATE TABLE t2 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) ) +engine=innodb slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Query # # use `test`; CREATE TABLE t3 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) ) slave-bin.000001 # Gtid # # GTID #-#-# @@ -74,7 +76,7 @@ slave-bin.000001 # Gtid # # BEGIN GTID #-#-# slave-bin.000001 # Annotate_rows # # INSERT INTO t2 (i1) select * from t1 slave-bin.000001 # Table_map # # table_id: # (test.t2) slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Xid # # COMMIT /* XID */ slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t1_tmp` /* generated by server */ slave-bin.000001 # Gtid # # GTID #-#-# diff --git a/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb.result b/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb.result index ac0a419b7e50b..d86344b69972b 100644 --- a/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb.result +++ b/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb.result @@ -13,14 +13,14 @@ mysql050614_temporal0 CREATE TABLE `mysql050614_temporal0` ( `a` time DEFAULT NULL, `b` datetime DEFAULT NULL, `c` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE mysql050614_temporal1; Table Create Table mysql050614_temporal1 CREATE TABLE `mysql050614_temporal1` ( `a` time(1) DEFAULT NULL, `b` datetime(1) DEFAULT NULL, `c` timestamp(1) NOT NULL DEFAULT current_timestamp(1) ON UPDATE current_timestamp(1) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection slave; SELECT @@mysql56_temporal_format; @@mysql56_temporal_format diff --git a/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb53.result b/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb53.result index ace11d5bd6e49..d07749a68540f 100644 --- a/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb53.result +++ b/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb53.result @@ -16,14 +16,14 @@ mysql050614_temporal0 CREATE TABLE `mysql050614_temporal0` ( `a` time DEFAULT NULL, `b` datetime DEFAULT NULL, `c` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE mysql050614_temporal1; Table Create Table mysql050614_temporal1 CREATE TABLE `mysql050614_temporal1` ( `a` time(1) DEFAULT NULL, `b` datetime(1) DEFAULT NULL, `c` timestamp(1) NOT NULL DEFAULT current_timestamp(1) ON UPDATE current_timestamp(1) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection slave; SELECT @@mysql56_temporal_format; @@mysql56_temporal_format diff --git a/mysql-test/suite/rpl/r/rpl_timestamp.result b/mysql-test/suite/rpl/r/rpl_timestamp.result new file mode 100644 index 0000000000000..3ced32aa72f62 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_timestamp.result @@ -0,0 +1,48 @@ +include/master-slave.inc +[connection master] +set timestamp=1656940000; +set explicit_defaults_for_timestamp=!@@explicit_defaults_for_timestamp; +connection master; +create table t1 (f1 timestamp, f2 timestamp); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` timestamp NULL DEFAULT NULL, + `f2` timestamp NULL DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection slave; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` timestamp NULL DEFAULT NULL, + `f2` timestamp NULL DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection master; +drop table t1; +flush binary logs; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +ROLLBACK/*!*/; +use `test`/*!*/; +SET TIMESTAMP=1656940000/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.sql_mode=1411383296/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +create table t1 (f1 timestamp, f2 timestamp) +/*!*/; +SET TIMESTAMP=1656940000/*!*/; +DROP TABLE `t1` /* generated by server */ +/*!*/; +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_unsafe_statements.result b/mysql-test/suite/rpl/r/rpl_unsafe_statements.result index 27065fffaa696..941984bf3290d 100644 --- a/mysql-test/suite/rpl/r/rpl_unsafe_statements.result +++ b/mysql-test/suite/rpl/r/rpl_unsafe_statements.result @@ -1,6 +1,5 @@ include/master-slave.inc [connection master] -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); CREATE TABLE t1(id INT AUTO_INCREMENT, i INT, PRIMARY KEY (id)) ENGINE=INNODB; CREATE TABLE t2(id INT AUTO_INCREMENT, i INT, PRIMARY KEY (id)) ENGINE=INNODB; CREATE TRIGGER trig1 AFTER INSERT ON t1 @@ -50,13 +49,9 @@ connection master; DROP TABLE t1; CREATE TABLE t1(i INT, j INT, UNIQUE KEY(i), UNIQUE KEY(j)) ENGINE=INNODB; INSERT INTO t1 (i,j) VALUES (1,2) ON DUPLICATE KEY UPDATE j=j+1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe START TRANSACTION; LOCK TABLES t1 WRITE; INSERT INTO t1 (i,j) VALUES (1,2) ON DUPLICATE KEY UPDATE j=j+1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe UNLOCK TABLES; COMMIT; connection slave; diff --git a/mysql-test/suite/rpl/r/rpl_xa_empty_transaction.result b/mysql-test/suite/rpl/r/rpl_xa_empty_transaction.result new file mode 100644 index 0000000000000..f3ea53c219ae1 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_xa_empty_transaction.result @@ -0,0 +1,1169 @@ +include/rpl_init.inc [topology=1->2->3] +connection server_1; +connection server_2; +connection server_3; +connection server_1; +# +# Test Case 1: An XA transaction without any statements should not be +# binlogged +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +XA START 'x'; +XA END 'x'; +XA PREPARE 'x'; +XA COMMIT 'x';; +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connect con1,localhost,root,,; +XA START 'x'; +XA END 'x'; +XA PREPARE 'x'; +disconnect con1; +connection server_1; +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 x +XA COMMIT 'x';; +ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +XA START 'x'; +XA END 'x'; +XA PREPARE 'x'; +XA ROLLBACK 'x';; +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connect con1,localhost,root,,; +XA START 'x'; +XA END 'x'; +XA PREPARE 'x'; +disconnect con1; +connection server_1; +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 x +XA ROLLBACK 'x';; +ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +# +# Test Case 2: An XA transaction consisting of a successfully rolled back +# statement should not be binlogged +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +XA START 'x'; +INSERT INTO ti VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +XA COMMIT 'x';; +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connect con1,localhost,root,,; +XA START 'x'; +INSERT INTO ti VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +disconnect con1; +connection server_1; +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 x +XA COMMIT 'x';; +ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +XA START 'x'; +INSERT INTO ti VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +XA ROLLBACK 'x';; +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connect con1,localhost,root,,; +XA START 'x'; +INSERT INTO ti VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +disconnect con1; +connection server_1; +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 x +XA ROLLBACK 'x';; +ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +# +# Test Case 3: An XA transaction with a statement that cannot be rolled +# back should be binlogged +connection server_1; +set @sav_binlog_format = @@binlog_format; +set @@binlog_format = row; +set @@global.binlog_format = row; +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +XA START 'x'; +INSERT INTO tm VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +XA COMMIT 'x';; +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connect con1,localhost,root,,; +XA START 'x'; +INSERT INTO tm VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +disconnect con1; +connection server_1; +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 x +XA COMMIT 'x';; +ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +XA START 'x'; +INSERT INTO tm VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +XA ROLLBACK 'x';; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connect con1,localhost,root,,; +XA START 'x'; +INSERT INTO tm VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +disconnect con1; +connection server_1; +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 x +XA ROLLBACK 'x';; +ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +set @@binlog_format = @sav_binlog_format; +set @@global.binlog_format = @sav_binlog_format; +# +# Test Case 4: An XA transaction with multiple statements that can all +# be rolled back should not be binlogged +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +XA START 'x'; +INSERT INTO ti VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO ti VALUES (2),(2);; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +XA COMMIT 'x';; +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connect con1,localhost,root,,; +XA START 'x'; +INSERT INTO ti VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO ti VALUES (2),(2);; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +disconnect con1; +connection server_1; +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 x +XA COMMIT 'x';; +ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +XA START 'x'; +INSERT INTO ti VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO ti VALUES (2),(2);; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +XA ROLLBACK 'x';; +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connect con1,localhost,root,,; +XA START 'x'; +INSERT INTO ti VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO ti VALUES (2),(2);; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +disconnect con1; +connection server_1; +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 x +XA ROLLBACK 'x';; +ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +# +# Test Case 5: A mixed XA transaction consisting of one statement that +# can successfully be rolled back (first statement), and another that +# can not (second statement) should be binlogged +connection server_1; +set @sav_binlog_format = @@binlog_format; +set @@binlog_format = row; +set @@global.binlog_format = row; +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +XA START 'x'; +INSERT INTO ti VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO tm VALUES (2),(2);; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +XA COMMIT 'x';; +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connect con1,localhost,root,,; +XA START 'x'; +INSERT INTO ti VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO tm VALUES (2),(2);; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +disconnect con1; +connection server_1; +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 x +XA COMMIT 'x';; +ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +XA START 'x'; +INSERT INTO ti VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO tm VALUES (2),(2);; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +XA ROLLBACK 'x';; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connect con1,localhost,root,,; +XA START 'x'; +INSERT INTO ti VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO tm VALUES (2),(2);; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +disconnect con1; +connection server_1; +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 x +XA ROLLBACK 'x';; +ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +set @@binlog_format = @sav_binlog_format; +set @@global.binlog_format = @sav_binlog_format; +# +# Test Case 6: A mixed XA transaction consisting of one statement that +# cannot successfully be rolled back (first statement), and another that +# can (second statement) should be binlogged +connection server_1; +set @sav_binlog_format = @@binlog_format; +set @@binlog_format = row; +set @@global.binlog_format = row; +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +XA START 'x'; +INSERT INTO tm VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO ti VALUES (2),(2);; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +XA COMMIT 'x';; +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connect con1,localhost,root,,; +XA START 'x'; +INSERT INTO tm VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO ti VALUES (2),(2);; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +disconnect con1; +connection server_1; +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 x +XA COMMIT 'x';; +ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +XA START 'x'; +INSERT INTO tm VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO ti VALUES (2),(2);; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +XA ROLLBACK 'x';; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connect con1,localhost,root,,; +XA START 'x'; +INSERT INTO tm VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO ti VALUES (2),(2);; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +disconnect con1; +connection server_1; +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 x +XA ROLLBACK 'x';; +ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +set @@binlog_format = @sav_binlog_format; +set @@global.binlog_format = @sav_binlog_format; +# +# Test Case 7: An XA transaction consisting of two failed +# non-transactional statements should be binlogged +connection server_1; +set @sav_binlog_format = @@binlog_format; +set @@binlog_format = row; +set @@global.binlog_format = row; +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +XA START 'x'; +INSERT INTO tm VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO tm VALUES (2),(2);; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +XA COMMIT 'x';; +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connect con1,localhost,root,,; +XA START 'x'; +INSERT INTO tm VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO tm VALUES (2),(2);; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +disconnect con1; +connection server_1; +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 x +XA COMMIT 'x';; +ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +XA START 'x'; +INSERT INTO tm VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO tm VALUES (2),(2);; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +XA ROLLBACK 'x';; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connection server_2; +connection server_3; +connection server_1; +CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam; +CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +connect con1,localhost,root,,; +XA START 'x'; +INSERT INTO tm VALUES (1),(1);; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO tm VALUES (2),(2);; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +XA END 'x'; +XA PREPARE 'x'; +disconnect con1; +connection server_1; +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 x +XA ROLLBACK 'x';; +ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back +include/save_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_1 should not binlog XA transaction] +connection server_2; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_2 should not binlog XA transaction] +connection server_3; +include/sync_with_master_gtid.inc +FLUSH LOGS; +# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file +include/assert_grep.inc [server_3 should not binlog XA transaction] +connection server_1; +DROP TABLE ti,tm; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_1; +set @@binlog_format = @sav_binlog_format; +set @@global.binlog_format = @sav_binlog_format; +connection server_1; +include/rpl_end.inc +# End of rpl_xa_empty_transaction.test diff --git a/mysql-test/suite/rpl/r/rpl_xa_prepare_gtid_fail.result b/mysql-test/suite/rpl/r/rpl_xa_prepare_gtid_fail.result new file mode 100644 index 0000000000000..f3fecbda34953 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_xa_prepare_gtid_fail.result @@ -0,0 +1,51 @@ +include/master-slave.inc +[connection master] +connection slave; +include/stop_slave.inc +change master to master_use_gtid=slave_pos; +set @@global.slave_parallel_threads= 4; +set @@global.slave_parallel_mode= optimistic; +set @@global.gtid_strict_mode=ON; +set sql_log_bin= 0; +alter table mysql.gtid_slave_pos engine=innodb; +call mtr.add_suppression("Deadlock found.*"); +set sql_log_bin= 1; +include/start_slave.inc +connection master; +create table t1 (a int primary key, b int) engine=innodb; +insert t1 values (1,1); +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +set @@global.innodb_lock_wait_timeout= 1; +connection master; +set @@session.gtid_seq_no=100; +xa start '1'; +update t1 set b=b+10 where a=1; +xa end '1'; +xa prepare '1'; +xa commit '1'; +include/save_master_gtid.inc +connection slave; +connection slave1; +BEGIN; +SELECT * FROM mysql.gtid_slave_pos WHERE seq_no=100 FOR UPDATE; +domain_id sub_id server_id seq_no +connection slave; +include/start_slave.inc +include/wait_for_slave_sql_error.inc [errno=1942,1213] +connection slave1; +ROLLBACK; +# Cleanup +connection master; +drop table t1; +connection slave; +include/stop_slave.inc +set @@global.gtid_slave_pos= "0-1-100"; +set @@global.slave_parallel_threads= 0; +set @@global.gtid_strict_mode= 0; +set @@global.innodb_lock_wait_timeout= 50; +include/start_slave.inc +include/rpl_end.inc +# End of rpl_xa_prepare_gtid_fail.test diff --git a/mysql-test/suite/rpl/t/mdev_24667.cnf b/mysql-test/suite/rpl/t/mdev_24667.cnf new file mode 100644 index 0000000000000..58b605ad928a6 --- /dev/null +++ b/mysql-test/suite/rpl/t/mdev_24667.cnf @@ -0,0 +1,8 @@ +!include ../my.cnf + +[mysqld.3] +log-slave-updates + +[ENV] +SERVER_MYPORT_3= @mysqld.3.port +SERVER_MYSOCK_3= @mysqld.3.socket diff --git a/mysql-test/suite/rpl/t/mdev_24667.test b/mysql-test/suite/rpl/t/mdev_24667.test new file mode 100644 index 0000000000000..d8490b335dbde --- /dev/null +++ b/mysql-test/suite/rpl/t/mdev_24667.test @@ -0,0 +1,56 @@ +# +# MDEV-24667 LOAD DATA INFILE/inserted rows not written to binlog +# +# In this test we will have a replication configuration like 1->2->3 +# 1 will have statement format +# 2 and 3 will have mixed format +# We will make some updates on temporary table which are unsafe , So 2 must +# Log these queries in row format, Since it is on tmp table , It wont be logged +# So the next query which copies the data from tmp table to normal must be logged +# into the row format. Instead of checking for the binlog We will compare the +# results on the 3, If no binlog is lost(ie it is logged into row format), There +# should not be any data loss. +--let $rpl_topology=1->2->3 +--source include/rpl_init.inc +--source include/have_binlog_format_mixed.inc +call mtr.add_suppression('Unsafe statement written to the binary log using '); +--connection server_1 + +set binlog_format=statement; +--echo #first bug +create table t1 (a int); +create temporary table tmp like t1; +--write_file $MYSQLTEST_VARDIR/load_data +1 +2 +EOF +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval load data local infile '$MYSQLTEST_VARDIR/load_data' INTO TABLE tmp; +insert into t1 select * from tmp; + +--echo #second bug +create table t2 (a int); +#insert into t2 values(10); +create temporary table tmp2 like t2; +insert into tmp2 values(10); +update tmp2 set a = 20 limit 1; +insert into t2 select * from tmp2; +--save_master_pos + +--connection server_2 +--sync_with_master +--save_master_pos + +--connection server_3 +--sync_with_master +--echo #t1 should have 2 rows +select count(*) = 2 from t1; +--echo #t2 should have 1 rows with a = 20 +select * from t2; + + +# cleanup +--connection server_1 +drop table t1, t2, tmp, tmp2; +--remove_file $MYSQLTEST_VARDIR/load_data +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/parallel_backup.test b/mysql-test/suite/rpl/t/parallel_backup.test index 964e2a30309fd..4f5ffa9f29107 100644 --- a/mysql-test/suite/rpl/t/parallel_backup.test +++ b/mysql-test/suite/rpl/t/parallel_backup.test @@ -15,6 +15,9 @@ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = innodb; INSERT INTO t1 VALUES(100); --sync_slave_with_master +call mtr.add_suppression("Deadlock found when trying to get lock"); +call mtr.add_suppression("Commit failed due to failure of an earlier commit"); + --source include/stop_slave.inc SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads; SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; @@ -64,6 +67,32 @@ BACKUP STAGE END; --let $diff_tables= master:t1,slave:t1 --source include/diff_tables.inc +# +--echo # MDEV-30423: dealock XA COMMIT vs BACKUP +# Prove XA "COMPLETE" 'xid' does not dealock similary to the normal trx case. +# The slave binlog group commit leader is blocked by a local trx like in +# the above normal trx case. +# [Notice a reuse of t1,aux_conn from above.] +# +--let $complete = COMMIT +--source parallel_backup_xa.inc +--let $complete = ROLLBACK +--source parallel_backup_xa.inc + +--let $slave_ooo_error = 1 +--let $complete = COMMIT +--source parallel_backup_xa.inc +--connection slave +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +--let $slave_ooo_error = 1 +--let $complete = ROLLBACK +--source parallel_backup_xa.inc +--connection slave +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + # Clean up. --connection slave diff --git a/mysql-test/suite/rpl/t/parallel_backup_lsu_off-slave.opt b/mysql-test/suite/rpl/t/parallel_backup_lsu_off-slave.opt new file mode 100644 index 0000000000000..2f2a9c436fc2e --- /dev/null +++ b/mysql-test/suite/rpl/t/parallel_backup_lsu_off-slave.opt @@ -0,0 +1,2 @@ +--log-slave-updates=0 + diff --git a/mysql-test/suite/rpl/t/parallel_backup_lsu_off.test b/mysql-test/suite/rpl/t/parallel_backup_lsu_off.test new file mode 100644 index 0000000000000..8e2663077b29e --- /dev/null +++ b/mysql-test/suite/rpl/t/parallel_backup_lsu_off.test @@ -0,0 +1,7 @@ +# +--echo # Specialized --log-slave-updates = 0 version of parallel_backup test. +# +--echo # MDEV-21953: deadlock between BACKUP STAGE BLOCK_COMMIT and parallel +--echo # MDEV-30423: dealock XA COMMIT vs BACKUP +--let $rpl_skip_reset_master_and_slave = 1 +--source parallel_backup.test diff --git a/mysql-test/suite/rpl/t/parallel_backup_slave_binlog_off-slave.opt b/mysql-test/suite/rpl/t/parallel_backup_slave_binlog_off-slave.opt new file mode 100644 index 0000000000000..a02b6d05829ca --- /dev/null +++ b/mysql-test/suite/rpl/t/parallel_backup_slave_binlog_off-slave.opt @@ -0,0 +1 @@ +--skip-log-bin \ No newline at end of file diff --git a/mysql-test/suite/rpl/t/parallel_backup_slave_binlog_off.test b/mysql-test/suite/rpl/t/parallel_backup_slave_binlog_off.test new file mode 100644 index 0000000000000..7cefbdb3ddd62 --- /dev/null +++ b/mysql-test/suite/rpl/t/parallel_backup_slave_binlog_off.test @@ -0,0 +1,7 @@ +# +--echo # Specialized --skip-log-bin slave version of parallel_backup test. +# +--echo # MDEV-21953: deadlock between BACKUP STAGE BLOCK_COMMIT and parallel +--echo # MDEV-30423: dealock XA COMMIT vs BACKUP +--let $rpl_server_skip_log_bin= 1 +--source parallel_backup.test diff --git a/mysql-test/suite/rpl/t/parallel_backup_xa.inc b/mysql-test/suite/rpl/t/parallel_backup_xa.inc new file mode 100644 index 0000000000000..2d831199aa865 --- /dev/null +++ b/mysql-test/suite/rpl/t/parallel_backup_xa.inc @@ -0,0 +1,79 @@ +# Invoked from parallel_backup.test +# Parameters: +# $complete = COMMIT or ROLLBACK +# $slave_ooo_error = 1 means slave group commit did not succeed +# +--let $kind = Normal +if ($slave_ooo_error) +{ + --let $kind = Errored out +} +--echo # +--echo # $kind XA $complete + +--connection slave +--source include/stop_slave.inc + +--connection master +# val_0 is the first value to insert on master in prepared xa +# val_1 is the next one to insert which is the value to block on slave +--let $val_0 = `SELECT max(a)+1 FROM t1` +--let $val_1 = $val_0 +--inc $val_1 + +--connection aux_slave +BEGIN; +--eval INSERT INTO t1 VALUES ($val_1) + +--connection master +XA START '1'; +--eval INSERT INTO t1 VALUES ($val_0) +XA END '1'; +XA PREPARE '1'; +--connection master1 +--eval INSERT INTO t1 VALUES ($val_1) +--connection master +--eval XA $complete '1' +--source include/save_master_gtid.inc + +--connection slave +if ($slave_ooo_error) +{ + SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; + SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; + SET @@global.innodb_lock_wait_timeout =1; + SET @@global.slave_transaction_retries=0; +} +--source include/start_slave.inc +--connection aux_slave +--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit" +--source include/wait_condition.inc +--echo # Xid '1' must be in the output: +XA RECOVER; +--connection backup_slave + BACKUP STAGE START; +--send BACKUP STAGE BLOCK_COMMIT +--connection aux_slave + --sleep 1 + if ($slave_ooo_error) + { + --let $wait_condition= SELECT COUNT(*) = 0 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit" + --source include/wait_condition.inc + } + ROLLBACK; +--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for backup lock" +--source include/wait_condition.inc +--connection backup_slave + --reap + BACKUP STAGE END; +--connection slave +if (!$slave_ooo_error) +{ + --source include/sync_with_master_gtid.inc +} +--source include/stop_slave.inc +if ($slave_ooo_error) +{ + SET @@global.innodb_lock_wait_timeout = @sav_innodb_lock_wait_timeout; + SET @@global.slave_transaction_retries= @sav_slave_transaction_retries; +} diff --git a/mysql-test/suite/rpl/t/rpl_alter_rollback.test b/mysql-test/suite/rpl/t/rpl_alter_rollback.test new file mode 100644 index 0000000000000..c24f01ff007b9 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_alter_rollback.test @@ -0,0 +1,42 @@ +# +# MENT-662: Lag Free Alter On Slave +# + +--echo # +--echo # Test verifies that "ROLLBACK ALTER" is written to binary log upon +--echo #ALTER command execution failure. +--echo # +--source include/have_innodb.inc +--source include/master-slave.inc + +--connection master +--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase` +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; + +create table t1 (f1 int primary key) engine=InnoDB; +--error ER_CANT_CREATE_TABLE +create table t2 (f1 int primary key, +constraint c1 foreign key (f1) references t1(f1), +constraint c1 foreign key (f1) references t1(f1)) engine=InnoDB; +create table t2 (f1 int primary key, + constraint c1 foreign key (f1) references t1(f1)) engine=innodb; + +--error ER_CANT_CREATE_TABLE +alter table t2 add constraint c1 foreign key (f1) references t1(f1); +--source include/show_binlog_events.inc + +set foreign_key_checks = 0; +--error ER_DUP_CONSTRAINT_NAME +alter table t2 add constraint c1 foreign key (f1) references t1(f1); +--source include/show_binlog_events.inc +--sync_slave_with_master + +--connection master +drop table t2, t1; +--sync_slave_with_master + +--connection master +--eval set global binlog_alter_two_phase=$binlog_alter_two_phase; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_binlog_errors.test b/mysql-test/suite/rpl/t/rpl_binlog_errors.test index 30faaf7961308..bf92736a2afbc 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_errors.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_errors.test @@ -1 +1,438 @@ ---source include/rpl_binlog_errors.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# +# Usage: +# --let $binlog_limit= X[,Y] # optional +# +# Semantics of the value is the same as in include/show_binlog_events.inc +# which the script calls as a part of the test flow. +# The goal is to print the event demonstrating the triggered error, +# so normally Y should be 1 (print the exact event only); +# however, depending on test-specific server options, the offset X +# can be different. +# + +# BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error +# when generating new name. +# +# WHY +# === +# +# We want to check whether error is reported or not when +# new_file_impl fails (this may happen when rotation is not +# possible because there is some problem finding an +# unique filename). +# +# HOW +# === +# +# Test cases are documented inline. + +-- source include/have_innodb.inc +-- source include/have_debug.inc +-- source include/master-slave.inc + +-- echo ####################################################################### +-- echo ####################### PART 1: MASTER TESTS ########################## +-- echo ####################################################################### + + +### ACTION: stopping slave as it is not needed for the first part of +### the test + +-- connection slave +-- source include/stop_slave.inc +-- connection master + +call mtr.add_suppression("Can't generate a unique log-filename"); +call mtr.add_suppression("Writing one row to the row-based binary log failed.*"); +call mtr.add_suppression("Error writing file .*"); +call mtr.add_suppression("Could not use master-bin for logging"); + +SET @old_debug= @@global.debug_dbug; + +### ACTION: create a large file (> 4096 bytes) that will be later used +### in LOAD DATA INFILE to check binlog errors in its vacinity +-- let $load_file= $MYSQLTEST_VARDIR/tmp/bug_46166.data +-- let $MYSQLD_DATADIR= `select @@datadir` +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file' + +### ACTION: create a small file (< 4096 bytes) that will be later used +### in LOAD DATA INFILE to check for absence of binlog errors +### when file loading this file does not force flushing and +### rotating the binary log +-- let $load_file2= $MYSQLTEST_VARDIR/tmp/bug_46166-2.data +-- let $MYSQLD_DATADIR= `select @@datadir` +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2' + +RESET MASTER; + +-- echo ###################### TEST #1 + +### ASSERTION: no problem flushing logs (should show two binlogs) +FLUSH LOGS; +-- echo # assert: must show two binlogs +-- source include/show_binary_logs.inc + +-- echo ###################### TEST #2 + +### ASSERTION: check that FLUSH LOGS actually fails and reports +### failure back to the user if find_uniq_filename fails +### (should show just one binlog) + +RESET MASTER; +SET @@global.debug_dbug="d,error_unique_log_filename"; +-- error ER_NO_UNIQUE_LOGFILE +FLUSH LOGS; +-- echo # assert: must show one binlog +-- source include/show_binary_logs.inc + +### ACTION: clean up and move to next test +SET @@global.debug_dbug=@old_debug; +RESET MASTER; + +-- echo ###################### TEST #3 + +### ACTION: create some tables (t1, t2, t4) and insert some values in +### table t1 +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB; +CREATE TABLE t4 (a VARCHAR(16384)); +INSERT INTO t1 VALUES (1); +RESET MASTER; + +### ASSERTION: we force rotation of the binary log because it exceeds +### the max_binlog_size option (should show two binary +### logs) + +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 + +# shows two binary logs +-- echo # assert: must show two binlog +-- source include/show_binary_logs.inc + +# clean up the table and the binlog to be used in next part of test +SET @@global.debug_dbug=@old_debug; +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #4 + +### ASSERTION: load the big file into a transactional table and check +### that it reports error. The table will contain the +### changes performed despite the fact that it reported an +### error. + +SET @@global.debug_dbug="d,error_unique_log_filename"; +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 + +# show table +-- echo # assert: must show one entry +SELECT count(*) FROM t2; + +# clean up the table and the binlog to be used in next part of test +SET @@global.debug_dbug=@old_debug; +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #5 + +### ASSERTION: load the small file into a transactional table and +### check that it succeeds + +SET @@global.debug_dbug="d,error_unique_log_filename"; +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval LOAD DATA INFILE '$load_file2' INTO TABLE t2 + +# show table +-- echo # assert: must show one entry +SELECT count(*) FROM t2; + +# clean up the table and the binlog to be used in next part of test +SET @@global.debug_dbug=@old_debug; +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #6 + +### ASSERTION: check that even if one is using a transactional table +### and explicit transactions (no autocommit) if rotation +### fails we get the error. Transaction is not rolledback +### because rotation happens after the commit. + +SET @@global.debug_dbug="d,error_unique_log_filename"; +SET AUTOCOMMIT=0; +INSERT INTO t2 VALUES ('muse'); +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 +INSERT INTO t2 VALUES ('muse'); +-- error ER_NO_UNIQUE_LOGFILE +COMMIT; + +### ACTION: Show the contents of the table after the test +-- echo # assert: must show three entries +SELECT count(*) FROM t2; + +### ACTION: clean up and move to the next test +SET AUTOCOMMIT= 1; +SET @@global.debug_dbug=@old_debug; +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #7 + +### ASSERTION: check that on a non-transactional table, if rotation +### fails then an error is reported and an incident event +### is written to the current binary log. + +SET @@global.debug_dbug="d,error_unique_log_filename"; + +# Disable logging Annotate_rows events to preserve events count. +let $binlog_annotate_row_events_saved= `SELECT @@binlog_annotate_row_events`; +SET @@binlog_annotate_row_events= 0; + +SELECT count(*) FROM t4; +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t4 + +-- echo # assert: must show 1 entry +SELECT count(*) FROM t4; + +-- echo ### check that the incident event is written to the current log +SET @@global.debug_dbug=@old_debug; +if (!$binlog_limit) +{ + -- let $binlog_limit= 4,1 +} +-- source include/show_binlog_events.inc + +# clean up and move to next test +DELETE FROM t4; + +--disable_query_log +eval SET @@binlog_annotate_row_events= $binlog_annotate_row_events_saved; +--enable_query_log + +RESET MASTER; + +-- echo ###################### TEST #8 + +### ASSERTION: check that statements end up in error but they succeed +### on changing the data. + +SET @@global.debug_dbug="d,error_unique_log_filename"; +-- echo # must show 0 entries +SELECT count(*) FROM t4; +SELECT count(*) FROM t2; + +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t4 +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 +-- error ER_NO_UNIQUE_LOGFILE +INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'); + +-- echo # INFO: Count(*) Before Offending DELETEs +-- echo # assert: must show 1 entry +SELECT count(*) FROM t4; +-- echo # assert: must show 4 entries +SELECT count(*) FROM t2; + +-- error ER_NO_UNIQUE_LOGFILE +DELETE FROM t4; +-- error ER_NO_UNIQUE_LOGFILE +DELETE FROM t2; + +-- echo # INFO: Count(*) After Offending DELETEs +-- echo # assert: must show zero entries +SELECT count(*) FROM t4; +SELECT count(*) FROM t2; + +# remove fault injection +SET @@global.debug_dbug=@old_debug; + +-- echo ###################### TEST #9 + +### ASSERTION: check that if we disable binlogging, then statements +### succeed. +SET @@global.debug_dbug="d,error_unique_log_filename"; +SET SQL_LOG_BIN=0; +INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd'); +INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh'); +-- echo # assert: must show four entries +SELECT count(*) FROM t2; +SELECT count(*) FROM t4; +DELETE FROM t2; +DELETE FROM t4; +-- echo # assert: must show zero entries +SELECT count(*) FROM t2; +SELECT count(*) FROM t4; +SET SQL_LOG_BIN=1; +SET @@global.debug_dbug=@old_debug; + +-- echo ###################### TEST #10 + +### ASSERTION: check that error is reported if there is a failure +### while registering the index file and the binary log +### file or failure to write the rotate event. + +call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); +call mtr.add_suppression("Could not use .*"); + +RESET MASTER; +SHOW WARNINGS; + +# +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open +SET @@global.debug_dbug="d,fault_injection_registering_index"; +-- replace_regex /\.[\\\/]master/master/ +-- error ER_CANT_OPEN_FILE +FLUSH LOGS; +SET @@global.debug_dbug=@old_debug; + +-- error ER_NO_BINARY_LOGGING +SHOW BINARY LOGS; + +# issue some statements and check that they don't fail +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; +flush tables; + +-- echo ###################### TEST #11 + +### ASSERTION: check that error is reported if there is a failure +### while opening the index file and the binary log file or +### failure to write the rotate event. + +# restart the server so that we have binlog again +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +# +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file +SET @@global.debug_dbug="d,fault_injection_openning_index"; +-- replace_regex /\.[\\\/]master/master/ +-- error ER_CANT_OPEN_FILE +FLUSH LOGS; +SET @@global.debug_dbug=@old_debug; + +-- error ER_FLUSH_MASTER_BINLOG_CLOSED +RESET MASTER; + +# issue some statements and check that they don't fail +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; +flush tables; + +# restart the server so that we have binlog again +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +-- echo ###################### TEST #12 + +### ASSERTION: check that error is reported if there is a failure +### while writing the rotate event when creating a new log +### file. + +# +d,fault_injection_new_file_rotate_event => injects fault on MYSQL_BIN_LOG::MYSQL_BIN_LOG::new_file_impl +SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event"; +-- error ER_ERROR_ON_WRITE +FLUSH LOGS; +SET @@global.debug_dbug=@old_debug; + +-- error ER_FLUSH_MASTER_BINLOG_CLOSED +RESET MASTER; + +# issue some statements and check that they don't fail +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; +flush tables; + +# restart the server so that we have binlog again +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +## clean up +DROP TABLE t1, t2, t4; +RESET MASTER; + +# restart slave again +-- connection slave +-- source include/start_slave.inc +-- connection master + +-- echo ####################################################################### +-- echo ####################### PART 2: SLAVE TESTS ########################### +-- echo ####################################################################### + +### setup +--source include/rpl_reset.inc +-- connection slave + +# slave suppressions + +call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*"); +call mtr.add_suppression("Error writing file .*"); +call mtr.add_suppression("Could not use .*"); +call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); +call mtr.add_suppression("Can't generate a unique log-filename .*"); +-- echo ###################### TEST #13 + +#### ASSERTION: check against unique log filename error +-- let $io_thd_injection_fault_flag= error_unique_log_filename +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +-- echo ###################### TEST #14 + +#### ASSERTION: check against rotate failing +-- let $io_thd_injection_fault_flag= fault_injection_new_file_rotate_event +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +-- echo ###################### TEST #15 + +#### ASSERTION: check against relay log open failure +-- let $io_thd_injection_fault_flag= fault_injection_registering_index +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +-- echo ###################### TEST #16 + +#### ASSERTION: check against relay log index open failure +-- let $io_thd_injection_fault_flag= fault_injection_openning_index +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +### clean up +-- source include/stop_slave_sql.inc +RESET SLAVE; +RESET MASTER; +--remove_file $load_file +--remove_file $load_file2 +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_binlog_index.test b/mysql-test/suite/rpl/t/rpl_binlog_index.test index 95c49c3d5749d..6112affb3c470 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_index.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_index.test @@ -17,10 +17,6 @@ # BUG#12133 master.index file keeps mysqld from starting if bin log has been moved # BUG#42576 Relay logs in relay-log.info&localhost-relay-bin.index not processed after move -source include/master-slave.inc; -# There is no need to run this test case on all binlog format -source include/have_binlog_format_row.inc; - # Since this test relies heavily on filesystem operations (like # moving files around, backslashes and so forth) we avoid messing # around with windows access violations for not cluttering the @@ -28,6 +24,10 @@ source include/have_binlog_format_row.inc; # it is not 100% compliant. --source include/not_windows.inc +source include/master-slave.inc; +# There is no need to run this test case on all binlog format +source include/have_binlog_format_row.inc; + connection master; --let $master_datadir= `select @@datadir` connection slave; diff --git a/mysql-test/suite/rpl/t/rpl_blackhole_row_annotate.test b/mysql-test/suite/rpl/t/rpl_blackhole_row_annotate.test index 07fc1e558cbee..f7aefd625a1be 100644 --- a/mysql-test/suite/rpl/t/rpl_blackhole_row_annotate.test +++ b/mysql-test/suite/rpl/t/rpl_blackhole_row_annotate.test @@ -44,6 +44,6 @@ FLUSH LOGS; let $MYSQLD_DATADIR= `select @@datadir`; --replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /xid=\d*/xid=/ ---exec $MYSQL_BINLOG --base64-output=decode-rows $MYSQLD_DATADIR/slave-bin.000001 +--exec $MYSQL_BINLOG --base64-output=decode-rows --skip-gtid-strict-mode $MYSQLD_DATADIR/slave-bin.000001 source include/rpl_end.inc; diff --git a/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test b/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test index 573c1d111fc49..7dfef023947a9 100644 --- a/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test +++ b/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test @@ -1 +1,83 @@ ---source include/rpl_cant_read_event_incident.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# +# Bug#11747416 : 32228 A disk full makes binary log corrupt. +# +# +# The test demonstrates reading from binlog error propagation to slave +# and reporting there. +# Conditions for the bug include a crash at time of the last event to +# the binlog was written partly. With the fixes the event is not sent out +# any longer, but rather the dump thread sends out a sound error message. +# +# Crash is not simulated. A binlog with partly written event in its end is installed +# and replication is started from it. +# + +--source include/have_binlog_format_mixed.inc +--source include/master-slave.inc + +--connection slave +# Make sure the slave is stopped while we are messing with master. +# Otherwise we get occasional failures as the slave manages to re-connect +# to the newly started master and we get extra events applied, causing +# conflicts. +--source include/stop_slave.inc + +--connection master +call mtr.add_suppression("Error in Log_event::read_log_event()"); +--let $datadir= `SELECT @@datadir` + +--let $rpl_server_number= 1 +--source include/rpl_stop_server.inc + +--remove_file $datadir/master-bin.000001 +--copy_file $MYSQL_TEST_DIR/std_data/bug11747416_32228_binlog.000001 $datadir/master-bin.000001 + +--let $rpl_server_number= 1 +--source include/rpl_start_server.inc + +--source include/wait_until_connected_again.inc + +# evidence of the partial binlog +--error ER_ERROR_WHEN_EXECUTING_COMMAND +show binlog events; + +--connection slave +call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log"); +reset slave; +start slave; + +# ER_MASTER_FATAL_ERROR_READING_BINLOG 1236 +--let $slave_param=Last_IO_Errno +--let $slave_param_value=1236 +--source include/wait_for_slave_param.inc + +--let $slave_field_result_replace= / at [0-9]*/ at XXX/ +--let $status_items= Last_IO_Errno, Last_IO_Error +--source include/show_slave_status.inc + +# +# Cleanup +# + +--connection master +reset master; + +--connection slave +stop slave; +reset slave; +# Table was created from binlog, it may not be created if SQL thread is running +# slowly and IO thread reaches incident before SQL thread applies it. +--disable_warnings +drop table if exists t; +--enable_warnings +reset master; + +--echo End of the tests +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_checksum.test b/mysql-test/suite/rpl/t/rpl_checksum.test index 0edf8fda7f329..17a986dc30801 100644 --- a/mysql-test/suite/rpl/t/rpl_checksum.test +++ b/mysql-test/suite/rpl/t/rpl_checksum.test @@ -1 +1,335 @@ ---source include/rpl_checksum.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# WL2540 replication events checksum +# Testing configuration parameters + +--source include/have_debug.inc +--source include/have_binlog_format_mixed.inc +--source include/master-slave.inc + +call mtr.add_suppression('Slave can not handle replication events with the checksum that master is configured to log'); +call mtr.add_suppression('Replication event checksum verification failed'); +# due to C failure simulation +call mtr.add_suppression('Relay log write failure: could not queue event from master'); +call mtr.add_suppression('Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process them'); + +# A. read/write access to the global vars: +# binlog_checksum master_verify_checksum slave_sql_verify_checksum + +connection master; + +set @master_save_binlog_checksum= @@global.binlog_checksum; +set @save_master_verify_checksum = @@global.master_verify_checksum; + +select @@global.binlog_checksum as 'must be CRC32 because of the command line option'; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.binlog_checksum as 'no session var'; + +select @@global.master_verify_checksum as 'must be zero because of default'; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.master_verify_checksum as 'no session var'; + +connection slave; + +set @slave_save_binlog_checksum= @@global.binlog_checksum; +set @save_slave_sql_verify_checksum = @@global.slave_sql_verify_checksum; + +select @@global.slave_sql_verify_checksum as 'must be one because of default'; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.slave_sql_verify_checksum as 'no session var'; + +connection master; + +source include/show_binary_logs.inc; +set @@global.binlog_checksum = NONE; +select @@global.binlog_checksum; +--echo *** must be rotations seen *** +source include/show_binary_logs.inc; + +set @@global.binlog_checksum = default; +select @@global.binlog_checksum; + +# testing lack of side-effects in non-effective update of binlog_checksum: +set @@global.binlog_checksum = CRC32; +select @@global.binlog_checksum; +set @@global.binlog_checksum = CRC32; + +set @@global.master_verify_checksum = 0; +set @@global.master_verify_checksum = default; + +--error ER_WRONG_VALUE_FOR_VAR +set @@global.binlog_checksum = ADLER32; +--error ER_WRONG_VALUE_FOR_VAR +set @@global.master_verify_checksum = 2; # the var is of bool type + +connection slave; + +set @@global.slave_sql_verify_checksum = 0; +set @@global.slave_sql_verify_checksum = default; +--error ER_WRONG_VALUE_FOR_VAR +set @@global.slave_sql_verify_checksum = 2; # the var is of bool type + +# +# B. Old Slave to New master conditions +# +# while master does not send a checksum-ed binlog the Old Slave can +# work with the New Master + +connection master; + +set @@global.binlog_checksum = NONE; +create table t1 (a int); + +# testing that binlog rotation preserves opt_binlog_checksum value +flush logs; +flush logs; +-- source include/wait_for_binlog_checkpoint.inc +flush logs; + +sync_slave_with_master; +#connection slave; +# checking that rotation on the slave side leaves slave stable +flush logs; +flush logs; +flush logs; +select count(*) as zero from t1; + +source include/stop_slave.inc; + +connection master; +set @@global.binlog_checksum = CRC32; +-- source include/wait_for_binlog_checkpoint.inc +insert into t1 values (1) /* will not be applied on slave due to simulation */; + +# instruction to the dump thread + +connection slave; +set @saved_dbug = @@global.debug_dbug; +set @@global.debug_dbug='d,simulate_slave_unaware_checksum'; +start slave; +--let $slave_io_errno= 1236 +--let $show_slave_io_error= 1 +source include/wait_for_slave_io_error.inc; + +select count(*) as zero from t1; + +set @@global.debug_dbug = @saved_dbug; + +connection slave; +source include/start_slave.inc; + +# +# C. checksum failure simulations +# + +# C1. Failure by a client thread +connection master; +set @@global.master_verify_checksum = 1; +set @save_dbug = @@session.debug_dbug; +set @@session.debug_dbug='d,simulate_checksum_test_failure'; +--error ER_ERROR_WHEN_EXECUTING_COMMAND +show binlog events; +SET debug_dbug= @save_dbug; +set @@global.master_verify_checksum = default; + +#connection master; +sync_slave_with_master; + +connection slave; +source include/stop_slave.inc; + +connection master; +create table t2 (a int); +let $pos_master= query_get_value(SHOW MASTER STATUS, Position, 1); + +connection slave; + +# C2. Failure by IO thread +# instruction to io thread +set @saved_dbug = @@global.debug_dbug; +set @@global.debug_dbug='d,simulate_checksum_test_failure'; +start slave io_thread; +# When the checksum error is detected, the slave sets error code 1913 +# (ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE) in queue_event(), then immediately +# sets error 1595 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE) in handle_slave_io(). +# So we usually get 1595, but it is occasionally possible to get 1913. +--let $slave_io_errno= 1595,1913 +--let $show_slave_io_error= 0 +source include/wait_for_slave_io_error.inc; +set @@global.debug_dbug = @saved_dbug; + +# to make IO thread re-read it again w/o the failure +start slave io_thread; +let $slave_param= Read_Master_Log_Pos; +let $slave_param_value= $pos_master; +source include/wait_for_slave_param.inc; + +# C3. Failure by SQL thread +# instruction to sql thread; +set @@global.slave_sql_verify_checksum = 1; + +set @@global.debug_dbug='d,simulate_checksum_test_failure'; + +start slave sql_thread; +--let $slave_sql_errno= 1593 +--let $show_slave_sql_error= 1 +source include/wait_for_slave_sql_error.inc; + +# resuming SQL thread to parse out the event w/o the failure + +set @@global.debug_dbug = @saved_dbug; +source include/start_slave.inc; + +connection master; +sync_slave_with_master; + +#connection slave; +select count(*) as 'must be zero' from t2; + +# +# D. Reset slave, Change-Master, Binlog & Relay-log rotations with +# random value on binlog_checksum on both master and slave +# +connection slave; +stop slave; +reset slave; + +# randomize slave server's own checksum policy +set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); +flush logs; + +connection master; +set @@global.binlog_checksum= CRC32; +reset master; +flush logs; +create table t3 (a int, b char(5)); + +connection slave; +source include/start_slave.inc; + +connection master; +sync_slave_with_master; + +#connection slave; +select count(*) as 'must be zero' from t3; +source include/stop_slave.inc; +--replace_result $MASTER_MYPORT MASTER_PORT +eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root'; + +connection master; +flush logs; +reset master; +insert into t3 value (1, @@global.binlog_checksum); + +connection slave; +source include/start_slave.inc; +flush logs; + +connection master; +sync_slave_with_master; + +#connection slave; +select count(*) as 'must be one' from t3; + +connection master; +set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); +insert into t3 value (1, @@global.binlog_checksum); +sync_slave_with_master; + +#connection slave; + +#clean-up + +connection master; +drop table t1, t2, t3; +set @@global.binlog_checksum = @master_save_binlog_checksum; +set @@global.master_verify_checksum = @save_master_verify_checksum; + +# +# BUG#58564: flush_read_lock fails in mysql-trunk-bugfixing after merging with WL#2540 +# +# Sanity check that verifies that no assertions are triggered because +# of old FD events (generated by versions prior to server released with +# checksums feature) +# +# There is no need for query log, if something wrong this should trigger +# an assertion + +--disable_query_log + +BINLOG ' +MfmqTA8BAAAAZwAAAGsAAAABAAQANS41LjctbTMtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAx+apMEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA== +'; + +--enable_query_log + +#connection slave; +sync_slave_with_master; + + +--echo *** Bug#59123 / MDEV-5799: INCIDENT_EVENT checksum written to error log as garbage characters *** + +--connection master + +--source include/wait_for_binlog_checkpoint.inc +CREATE TABLE t4 (a INT PRIMARY KEY); +INSERT INTO t4 VALUES (1); + +SET sql_log_bin=0; +CALL mtr.add_suppression("\\[ERROR\\] Can't generate a unique log-filename"); +SET sql_log_bin=1; +SET @old_dbug= @@GLOBAL.debug_dbug; +SET debug_dbug= '+d,binlog_inject_new_name_error'; +--error ER_NO_UNIQUE_LOGFILE +FLUSH LOGS; +SET debug_dbug= @old_dbug; + +INSERT INTO t4 VALUES (2); + +--connection slave +--let $slave_sql_errno= 1590 +--source include/wait_for_slave_sql_error.inc + +# Search the error log for the error message. +# The bug was that 4 garbage bytes were output in the middle of the error +# message; by searching for a pattern that spans that location, we can +# catch the error. +let $log_error_= `SELECT @@GLOBAL.log_error`; +if(!$log_error_) +{ + # MySQL Server on windows is started with --console and thus + # does not know the location of its .err log, use default location + let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.2.err; +} +--let SEARCH_FILE= $log_error_ +--let SEARCH_PATTERN= Slave SQL: The incident LOST_EVENTS occurred on the master\. Message: error writing to the binary log, Internal MariaDB error code: 1590 +--source include/search_pattern_in_file.inc + +SELECT * FROM t4 ORDER BY a; +STOP SLAVE IO_THREAD; +SET sql_slave_skip_counter= 1; +--source include/start_slave.inc + +--connection master +--save_master_pos + +--connection slave +--sync_with_master +SELECT * FROM t4 ORDER BY a; + + +--connection slave +set @@global.binlog_checksum = @slave_save_binlog_checksum; +set @@global.slave_sql_verify_checksum = @save_slave_sql_verify_checksum; + +--echo End of tests + +--connection master +DROP TABLE t4; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_checksum_cache.test b/mysql-test/suite/rpl/t/rpl_checksum_cache.test index 59b338d25562f..e04f618b81ea1 100644 --- a/mysql-test/suite/rpl/t/rpl_checksum_cache.test +++ b/mysql-test/suite/rpl/t/rpl_checksum_cache.test @@ -1 +1,261 @@ ---source include/rpl_checksum_cache.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +-- source include/have_innodb.inc +-- source include/master-slave.inc + +--disable_warnings +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. .*Statement: insert into t2 set data=repeat.*'a', @act_size.*"); +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. .*Statement: insert into t1 values.* NAME_CONST.*'n',.*, @data .*"); +--enable_warnings + +connection master; +set @save_binlog_cache_size = @@global.binlog_cache_size; +set @save_binlog_checksum = @@global.binlog_checksum; +set @save_master_verify_checksum = @@global.master_verify_checksum; +set @@global.binlog_cache_size = 4096; +set @@global.binlog_checksum = CRC32; +set @@global.master_verify_checksum = 1; + +# restart slave to force the dump thread to verify events (on master side) +connection slave; +source include/stop_slave.inc; +source include/start_slave.inc; + +connection master; + +# +# Testing a critical part of checksum handling dealing with transaction cache. +# The cache's buffer size is set to be less than the transaction's footprint +# in binlog. +# +# To verify combined buffer-by-buffer read out of the file and fixing crc per event +# there are the following parts: +# +# 1. the event size is much less than the cache's buffer +# 2. the event size is bigger than the cache's buffer +# 3. the event size if approximately the same as the cache's buffer +# 4. all in above + +# +# 1. the event size is much less than the cache's buffer +# + +flush status; +show status like "binlog_cache_use"; +show status like "binlog_cache_disk_use"; +--disable_warnings +drop table if exists t1; +--enable_warnings + +# +# parameter to ensure the test slightly varies binlog content +# between different invocations +# +let $deviation_size=32; +eval create table t1 (a int PRIMARY KEY, b CHAR($deviation_size)) engine=innodb; + +# Now we are going to create transaction which is long enough so its +# transaction binlog will be flushed to disk... + +delimiter |; +create procedure test.p_init (n int, size int) +begin + while n > 0 do + select round(RAND() * size) into @act_size; + set @data = repeat('a', @act_size); + insert into t1 values(n, @data ); + set n= n-1; + end while; +end| + +delimiter ;| + +let $1 = 4000; # PB2 can run it slow to time out on following sync_slave_with_master:s + +begin; +--disable_warnings +# todo: check if it is really so. +#+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. +eval call test.p_init($1, $deviation_size); +--enable_warnings +commit; + +show status like "binlog_cache_use"; +--echo *** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; + +sync_slave_with_master; + +let $diff_tables=master:test.t1, slave:test.t1; +source include/diff_tables.inc; + +# undoing changes with verifying the above once again +connection master; + +begin; +delete from t1; +commit; + +sync_slave_with_master; + + +# +# 2. the event size is bigger than the cache's buffer +# +connection master; + +flush status; +let $t2_data_size= `select 3 * @@global.binlog_cache_size`; +let $t2_aver_size= `select 2 * @@global.binlog_cache_size`; +let $t2_max_rand= `select 1 * @@global.binlog_cache_size`; + +eval create table t2(a int auto_increment primary key, data VARCHAR($t2_data_size)) ENGINE=Innodb; +let $1=100; +--disable_query_log +begin; +while ($1) +{ + eval select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size; + set @data = repeat('a', @act_size); + insert into t2 set data = @data; + dec $1; +} +commit; +--enable_query_log +show status like "binlog_cache_use"; +--echo *** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; + +sync_slave_with_master; + +let $diff_tables=master:test.t2, slave:test.t2; +source include/diff_tables.inc; + +# undoing changes with verifying the above once again +connection master; + +begin; +delete from t2; +commit; + +sync_slave_with_master; + +# +# 3. the event size if approximately the same as the cache's buffer +# + +connection master; + +flush status; +let $t3_data_size= `select 2 * @@global.binlog_cache_size`; +let $t3_aver_size= `select (9 * @@global.binlog_cache_size) / 10`; +let $t3_max_rand= `select (2 * @@global.binlog_cache_size) / 10`; + +eval create table t3(a int auto_increment primary key, data VARCHAR($t3_data_size)) engine=innodb; + +let $1= 300; +--disable_query_log +begin; +while ($1) +{ + eval select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size; + insert into t3 set data= repeat('a', @act_size); + dec $1; +} +commit; +--enable_query_log +show status like "binlog_cache_use"; +--echo *** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; + +sync_slave_with_master; + +let $diff_tables=master:test.t3, slave:test.t3; +source include/diff_tables.inc; + +# undoing changes with verifying the above once again +connection master; + +begin; +delete from t3; +commit; + +sync_slave_with_master; + + +# +# 4. all in above +# + +connection master; +flush status; + +delimiter |; +eval create procedure test.p1 (n int) +begin + while n > 0 do + case (select (round(rand()*100) % 3) + 1) + when 1 then + select round(RAND() * $deviation_size) into @act_size; + set @data = repeat('a', @act_size); + insert into t1 values(n, @data); + when 2 then + begin + select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size; + insert into t2 set data=repeat('a', @act_size); + end; + when 3 then + begin + select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size; + insert into t3 set data= repeat('a', @act_size); + end; + end case; + set n= n-1; + end while; +end| +delimiter ;| + +let $1= 1000; +set autocommit= 0; +begin; +--disable_warnings +eval call test.p1($1); +--enable_warnings +commit; + +show status like "binlog_cache_use"; +--echo *** binlog_cache_disk_use must be non-zero *** +show status like "binlog_cache_disk_use"; + +sync_slave_with_master; + +let $diff_tables=master:test.t1, slave:test.t1; +source include/diff_tables.inc; + +let $diff_tables=master:test.t2, slave:test.t2; +source include/diff_tables.inc; + +let $diff_tables=master:test.t3, slave:test.t3; +source include/diff_tables.inc; + + +connection master; + +begin; +delete from t1; +delete from t2; +delete from t3; +commit; + +drop table t1, t2, t3; +set @@global.binlog_cache_size = @save_binlog_cache_size; +set @@global.binlog_checksum = @save_binlog_checksum; +set @@global.master_verify_checksum = @save_master_verify_checksum; +drop procedure test.p_init; +drop procedure test.p1; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_circular_semi_sync.cnf b/mysql-test/suite/rpl/t/rpl_circular_semi_sync.cnf new file mode 100644 index 0000000000000..be39fea91d81c --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_circular_semi_sync.cnf @@ -0,0 +1,11 @@ +!include suite/rpl/rpl_1slave_base.cnf +!include include/default_client.cnf + + +[mysqld.1] +log-slave-updates +sync-binlog=1 + +[mysqld.2] +log-slave-updates +sync-binlog=1 diff --git a/mysql-test/suite/rpl/t/rpl_circular_semi_sync.test b/mysql-test/suite/rpl/t/rpl_circular_semi_sync.test new file mode 100644 index 0000000000000..267fa62194590 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_circular_semi_sync.test @@ -0,0 +1,188 @@ +# ==== References ==== +# +# MDEV-27760 event may non stop replicate in circular semisync setup +# MDEV-28609 refine gtid-strict-mode to ignore same server-id gtid from the past +# on semisync slave +--source include/have_innodb.inc +--source include/have_binlog_format_mixed.inc +--source include/master-slave.inc + +# The following tests prove +# A. +# no out-of-order gtid error is done to the stict gtid mode semisync +# slave receives the same server-id gtid event from the past (of its gtid +# state). Such transaction is silently ignored similarly to +# replicate_same_sever_id; and +# B. +# In contrast to A. the out-of-order gtid error is thrown when a "foreign" +# server-id transaction makes its round-trip to the originator server. + +--echo # Master server_1 and Slave server_2 initialization ... +--connection server_2 +--source include/stop_slave.inc + +# Initial master +--connection server_1 +RESET MASTER; +set @@session.gtid_domain_id=10; +set @@global.rpl_semi_sync_master_enabled = 1; +set @@global.rpl_semi_sync_master_wait_point=AFTER_SYNC; + +--connection server_2 +RESET MASTER; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +set @@session.gtid_domain_id=20; +set @@global.rpl_semi_sync_slave_enabled = 1; +--echo # a 1948 warning is expected +set @@global.gtid_slave_pos = ""; +CHANGE MASTER TO master_use_gtid= slave_pos; +--source include/start_slave.inc +--echo # server_1 -> server_2 semisync link is set up. + +--connection server_1 +CREATE TABLE t1 (a INT PRIMARY KEY, b INT default 0) ENGINE=Innodb; +INSERT INTO t1(a) VALUES (1); +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc + +--echo # Circular configuration server_1 -> server_2 -> server_1 ... +--connection server_1 +set @@global.gtid_strict_mode = true; +set @@global.rpl_semi_sync_slave_enabled = 1; + +evalp CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_2, master_user='root', master_use_gtid=SLAVE_POS; +--source include/start_slave.inc +--echo ... is done. + +--echo ## A. no out-of-order gtid error for own transaction made round trip + +# A0. server_1 has already originated the transaction +--let $wait_condition=select @@gtid_slave_pos=@@gtid_binlog_pos +--source include/wait_condition.inc + +# A1. server_2 originates +--connection server_2 +set @@global.gtid_strict_mode = true; +set @@global.rpl_semi_sync_master_enabled = 1; +INSERT INTO t1(a) VALUES (2); +--source include/save_master_gtid.inc + +--connection server_1 +--echo # +--echo # the successful sync is a required proof +--echo # +--source include/sync_with_master_gtid.inc +# A2. server_1 is originating now +update t1 set b=b+1 where a=2; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc + +--echo # Post-execution state check on both servers synchronized with each other +--connection server_1 +--echo # ... the gtid states on server_1 +--let $wait_condition=select @@gtid_slave_pos=@@gtid_binlog_pos +--source include/wait_condition.inc +SHOW VARIABLES LIKE 'gtid_slave_pos'; +SHOW VARIABLES LIKE 'gtid_binlog_pos'; +SELECT * from t1; + +--connection server_2 +--echo # The gtid states on server_2 must be equal to ... +--let $wait_condition=select @@gtid_slave_pos=@@gtid_binlog_pos +--source include/wait_condition.inc +SHOW VARIABLES LIKE 'gtid_binlog_pos'; +SHOW VARIABLES LIKE 'gtid_slave_pos'; +SELECT * from t1; + +--echo ## B. out-of-order gtid error for a "foreign" server-id transaction +# B1. circulation starts from server_1 + +--connection server_1 +set statement sql_log_bin=0 for call mtr.add_suppression("Slave: An attempt was made to binlog GTID 10-2-4"); +set @@session.server_id=2; +INSERT INTO t1(a) VALUES (3); +set @@session.server_id=default; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc +INSERT INTO t1(a) VALUES (4); +--source include/save_master_gtid.inc + +--connection server_1 +--let $slave_sql_errno = 1950 +--source include/wait_for_slave_sql_error.inc +set sql_slave_skip_counter=1; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +# B2. circulation starts from server_2 +--connection server_2 +set statement sql_log_bin=0 for call mtr.add_suppression("Slave: An attempt was made to binlog GTID 20-1-3"); +set @@session.server_id=1; +INSERT INTO t1(a) VALUES (5); +set @@session.server_id=default; +--source include/save_master_gtid.inc + +--connection server_1 +--source include/sync_with_master_gtid.inc +INSERT INTO t1(a) VALUES (6); +--source include/save_master_gtid.inc + + +--connection server_2 +--let $slave_sql_errno = 1950 +--source include/wait_for_slave_sql_error.inc +set sql_slave_skip_counter=1; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +--echo # Post-execution state check on both servers synchronized with each other +--connection server_1 +--echo # ... the gtid states on server_1 +--let $wait_condition=select @@gtid_slave_pos=@@gtid_binlog_pos +--source include/wait_condition.inc +SHOW VARIABLES LIKE 'gtid_slave_pos'; +SHOW VARIABLES LIKE 'gtid_binlog_pos'; +SELECT * from t1; + +--connection server_2 +--source include/sync_with_master_gtid.inc +--echo # The gtid states on server_2 must be equal to ... +--let $wait_condition=select @@gtid_slave_pos=@@gtid_binlog_pos +--source include/wait_condition.inc +SHOW VARIABLES LIKE 'gtid_binlog_pos'; +SHOW VARIABLES LIKE 'gtid_slave_pos'; +SELECT * from t1; + +--echo # +--echo # Cleanup +--echo # +--connection server_1 +DROP TABLE t1; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc + +--connection server_1 +--source include/stop_slave.inc +set @@global.rpl_semi_sync_master_enabled = default; +set @@global.rpl_semi_sync_slave_enabled = default; +set @@global.rpl_semi_sync_master_wait_point=default; +set @@global.gtid_ignore_duplicates = default; +set @@global.gtid_strict_mode = default; + +--connection server_2 +--source include/stop_slave.inc +set @@global.gtid_ignore_duplicates = default; +set @@global.rpl_semi_sync_master_enabled = default; +set @@global.rpl_semi_sync_slave_enabled = default; +set @@global.gtid_strict_mode = default; +--source include/start_slave.inc + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_corruption.test b/mysql-test/suite/rpl/t/rpl_corruption.test index e51d1c65e9503..c7a913af9d7f2 100644 --- a/mysql-test/suite/rpl/t/rpl_corruption.test +++ b/mysql-test/suite/rpl/t/rpl_corruption.test @@ -1 +1,175 @@ ---source include/rpl_corruption.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +############################################################ +# Purpose: WL#5064 Testing with corrupted events. +# The test emulates the corruption at the vary stages +# of replication: +# - in binlog file +# - in network +# - in relay log +############################################################ + +# +# The tests intensively utilize @@global.debug. Note, +# Bug#11765758 - 58754, +# @@global.debug is read by the slave threads through dbug-interface. +# Hence, before a client thread set @@global.debug we have to ensure that: +# (a) the slave threads are stopped, or (b) the slave threads are in +# sync and waiting. + +--source include/have_debug.inc +--source include/master-slave.inc + +# Block legal errors for MTR +call mtr.add_suppression('Found invalid event in binary log'); +call mtr.add_suppression('Slave I/O: Relay log write failure: could not queue event from master'); +call mtr.add_suppression('event read from binlog did not pass crc check'); +call mtr.add_suppression('Replication event checksum verification failed'); +call mtr.add_suppression('Event crc check failed! Most likely there is event corruption'); +call mtr.add_suppression('Slave SQL: Error initializing relay log position: I/O error reading event at position .*, error.* 1593'); + +SET @old_master_verify_checksum = @@master_verify_checksum; + +# Creating test table/data and set corruption position for testing +--echo # 1. Creating test table/data and set corruption position for testing +--connection master +--echo * insert/update/delete rows in table t1 * +# Corruption algorithm modifies only the first event and +# then will be reset. To avoid checking always the first event +# from binlog (usually it is FD) we randomly execute different +# statements and set position for corruption inside events. + +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100)); +--disable_query_log +let $i=`SELECT 3+CEILING(10*RAND())`; +let $j=1; +let $pos=0; +while ($i) { + eval INSERT INTO t1 VALUES ($j, 'a', NULL); + if (`SELECT RAND() > 0.7`) + { + eval UPDATE t1 SET c = REPEAT('a', 20) WHERE a = $j; + } + if (`SELECT RAND() > 0.8`) + { + eval DELETE FROM t1 WHERE a = $j; + } + if (!$pos) { + let $pos= query_get_value(SHOW MASTER STATUS, Position, 1); + --sync_slave_with_master + --source include/stop_slave.inc + --disable_query_log + --connection master + } + dec $i; + inc $j; +} +--enable_query_log + + +# Emulate corruption in binlog file when SHOW BINLOG EVENTS is executing +--echo # 2. Corruption in master binlog and SHOW BINLOG EVENTS +SET @saved_dbug = @@global.debug_dbug; +SET @@global.debug_dbug="d,corrupt_read_log_event_char"; +--echo SHOW BINLOG EVENTS; +--disable_query_log +send_eval SHOW BINLOG EVENTS FROM $pos; +--enable_query_log +--error ER_ERROR_WHEN_EXECUTING_COMMAND +reap; + +SET @@global.debug_dbug=@saved_dbug; + +# Emulate corruption on master with crc checking on master +--echo # 3. Master read a corrupted event from binlog and send the error to slave + +# We have a rare but nasty potential race here: if the dump thread on +# the master for the _old_ slave connection has not yet discovered +# that the slave has disconnected, we will inject the corrupt event on +# the wrong connection, and the test will fail +# (+d,corrupt_read_log_event2 corrupts only one event). +# So kill any lingering dump thread (we need to kill; otherwise dump thread +# could manage to send all events down the socket before seeing it close, and +# hang forever waiting for new binlog events to be created). +let $id= `select id from information_schema.processlist where command = "Binlog Dump"`; +if ($id) +{ + --disable_query_log + --error 0,1094 + eval kill $id; + --enable_query_log +} +let $wait_condition= + SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE command = 'Binlog Dump'; +--source include/wait_condition.inc + +SET @@global.debug_dbug="d,corrupt_read_log_event2_set"; +--connection slave +START SLAVE IO_THREAD; +let $slave_io_errno= 1236; +--let $slave_timeout= 10 +--source include/wait_for_slave_io_error.inc +--connection master +SET @@global.debug_dbug=@saved_dbug; + +# Emulate corruption on master without crc checking on master +--echo # 4. Master read a corrupted event from binlog and send it to slave +--connection master +SET GLOBAL master_verify_checksum=0; +SET @@global.debug_dbug="d,corrupt_read_log_event2_set"; +--connection slave +START SLAVE IO_THREAD; +# When the checksum error is detected, the slave sets error code 1743 +# (ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE) in queue_event(), then immediately +# sets error 1595 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE) in handle_slave_io(). +# So we usually get 1595, but it is occasionally possible to get 1743. +let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE +--source include/wait_for_slave_io_error.inc +--connection master +SET @@global.debug_dbug=@saved_dbug; +SET GLOBAL master_verify_checksum=1; + +# Emulate corruption in network +--echo # 5. Slave. Corruption in network +--connection slave +SET @saved_dbug_slave = @@GLOBAL.debug_dbug; +SET @@global.debug_dbug="d,corrupt_queue_event"; +START SLAVE IO_THREAD; +let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE +--source include/wait_for_slave_io_error.inc +SET @@global.debug_dbug=@saved_dbug_slave; + +# Emulate corruption in relay log +--echo # 6. Slave. Corruption in relay log + +SET @@global.debug_dbug="d,corrupt_read_log_event_char"; + +START SLAVE SQL_THREAD; +let $slave_sql_errno= 1593; +--source include/wait_for_slave_sql_error.inc + +SET @@global.debug_dbug=@saved_dbug_slave; + +# Start normal replication and compare same table on master +# and slave +--echo # 7. Seek diff for tables on master and slave +--connection slave +--source include/start_slave.inc +--connection master +--sync_slave_with_master +let $diff_tables= master:test.t1, slave:test.t1; +--source include/diff_tables.inc + +# Clean up +--echo # 8. Clean up +--connection master +set @@global.debug_dbug = @saved_dbug; +SET GLOBAL master_verify_checksum = @old_master_verify_checksum; +DROP TABLE t1; +--sync_slave_with_master + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_delayed_parallel_slave_sbm-slave.opt b/mysql-test/suite/rpl/t/rpl_delayed_parallel_slave_sbm-slave.opt new file mode 100644 index 0000000000000..9eea6a54b6897 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_delayed_parallel_slave_sbm-slave.opt @@ -0,0 +1 @@ +--slave-parallel-threads=4 diff --git a/mysql-test/suite/rpl/t/rpl_delayed_parallel_slave_sbm.test b/mysql-test/suite/rpl/t/rpl_delayed_parallel_slave_sbm.test new file mode 100644 index 0000000000000..1ac1bc14468d7 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_delayed_parallel_slave_sbm.test @@ -0,0 +1,150 @@ +# +# This test ensures that after a delayed parallel slave has idled, i.e. +# executed everything in its relay log, the next event group that the SQL +# thread reads from the relay log will immediately be used in the +# Seconds_Behind_Master. In particular, it ensures that the calculation for +# Seconds_Behind_Master is based on the timestamp of the new transaction, +# rather than the last committed transaction. +# +# References: +# MDEV-29639: Seconds_Behind_Master is incorrect for Delayed, Parallel +# Replicas +# + +--source include/master-slave.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +--connection slave +--source include/stop_slave.inc +--let $old_debug_dbug= `SELECT @@global.debug_dbug` +--let $master_delay= 3 +--eval change master to master_delay=$master_delay, master_use_gtid=Slave_Pos +--let $old_slave_threads= `SELECT @@GLOBAL.slave_parallel_threads` +set @@GLOBAL.slave_parallel_threads=2; +--source include/start_slave.inc + +--connection master +create table t1 (a int); +--source include/sync_slave_sql_with_master.inc + +--echo # +--echo # Pt 1) Ensure SBM is updated immediately upon arrival of the next event + +--echo # Lock t1 on slave so the first received transaction does not complete/commit +--connection slave +LOCK TABLES t1 WRITE; + +--connection master +--echo # Sleep 2 to allow a buffer between events for SBM check +sleep 2; + +--let $ts_trx_before_ins= `SELECT UNIX_TIMESTAMP()` +--let insert_ctr= 0 +--eval insert into t1 values ($insert_ctr) +--inc $insert_ctr +--source include/save_master_gtid.inc + +--connection slave + +--echo # Waiting for transaction to arrive on slave and begin SQL Delay.. +--let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting until MASTER_DELAY seconds after master executed event'; +--source include/wait_condition.inc + +--echo # Validating SBM is updated on event arrival.. +--let $sbm_trx1_arrive= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1) +--let $seconds_since_idling= `SELECT UNIX_TIMESTAMP() - $ts_trx_before_ins` +if (`SELECT $sbm_trx1_arrive > ($seconds_since_idling + 1)`) +{ + --echo # SBM was $sbm_trx1_arrive yet shouldn't have been larger than $seconds_since_idling + 1 (for possible negative clock_diff_with_master) + --die Seconds_Behind_Master should reset after idling +} +--echo # ..done + +--connection slave +UNLOCK TABLES; +--source include/sync_with_master_gtid.inc + +--echo # +--echo # Pt 2) If the SQL thread has not entered an idle state, ensure +--echo # following events do not update SBM + +--echo # Stop slave IO thread so it receives both events together on restart +--connection slave +--source include/stop_slave_io.inc + +--connection master + +--echo # Sleep 2 to allow a buffer between events for SBM check +sleep 2; +--let $ts_trxpt2_before_ins= `SELECT UNIX_TIMESTAMP()` +--eval insert into t1 values ($insert_ctr) +--inc $insert_ctr +--echo # Sleep 3 to create gap between events +sleep 3; +--eval insert into t1 values ($insert_ctr) +--inc $insert_ctr +--let $ts_trx_after_ins= `SELECT UNIX_TIMESTAMP()` +--source include/save_master_pos.inc + +--connection slave +LOCK TABLES t1 WRITE; + +SET @@global.debug_dbug="+d,pause_sql_thread_on_next_event"; + +START SLAVE IO_THREAD; + +--echo # Before we start processing the events, we ensure both transactions +--echo # were written into the relay log. Otherwise, if the IO thread takes too +--echo # long to queue the events, the sql thread can think it has caught up +--echo # too quickly. +SET DEBUG_SYNC='now WAIT_FOR paused_on_event'; +--source include/sync_io_with_master.inc +SET @@global.debug_dbug="-d,pause_sql_thread_on_next_event"; +SET DEBUG_SYNC='now SIGNAL sql_thread_continue'; + +--echo # Wait for first transaction to complete SQL delay and begin execution.. +--let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting for table metadata lock%' AND command LIKE 'Slave_Worker'; +--source include/wait_condition.inc + +--echo # Validate SBM calculation doesn't use the second transaction because SQL thread shouldn't have gone idle.. +--let $sbm_after_trx_no_idle= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1) +--let $timestamp_trxpt2_arrive= `SELECT UNIX_TIMESTAMP()` +if (`SELECT $sbm_after_trx_no_idle < $timestamp_trxpt2_arrive - $ts_trx_after_ins`) +{ + --let $cmpv= `SELECT $timestamp_trxpt2_arrive - $ts_trx_after_ins` + --echo # SBM $sbm_after_trx_no_idle was more recent than time since last transaction ($cmpv seconds) + --die Seconds_Behind_Master should not have used second transaction timestamp +} +--let $seconds_since_idling= `SELECT ($timestamp_trxpt2_arrive - $ts_trxpt2_before_ins)` +--echo # ..and that SBM wasn't calculated using prior committed transactions +if (`SELECT $sbm_after_trx_no_idle > ($seconds_since_idling + 1)`) +{ + --echo # SBM was $sbm_after_trx_no_idle yet shouldn't have been larger than $seconds_since_idling + 1 (for possible negative clock_diff_with_master) + --die Seconds_Behind_Master calculation should not have used prior committed transaction +} +--echo # ..done + +--connection slave +UNLOCK TABLES; + +--echo # +--echo # Cleanup + +--echo # Reset master_delay +--source include/stop_slave.inc +--eval CHANGE MASTER TO master_delay=0 +--eval set @@GLOBAL.slave_parallel_threads=$old_slave_threads +--eval SET @@global.debug_dbug="$old_debug_dbug" +SET DEBUG_SYNC='RESET'; +--source include/start_slave.inc + +--connection master +DROP TABLE t1; +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc + +--source include/rpl_end.inc +--echo # End of rpl_delayed_parallel_slave_sbm.test diff --git a/mysql-test/suite/rpl/t/rpl_dump_request_retry_warning.test b/mysql-test/suite/rpl/t/rpl_dump_request_retry_warning.test index d750d44ae71b1..1ee043623aec4 100644 --- a/mysql-test/suite/rpl/t/rpl_dump_request_retry_warning.test +++ b/mysql-test/suite/rpl/t/rpl_dump_request_retry_warning.test @@ -43,6 +43,12 @@ START SLAVE; SET DEBUG_SYNC= 'now WAIT_FOR parked'; SET @@GLOBAL.debug_dbug = @saved_dbug; SET DEBUG_SYNC= 'now SIGNAL continue'; + +# Ensure the last DEBUG_SYNC signal was received by the target thread before +# reset; otherwise, the reset can drop the last signal before it gets +# acknowledged +let $wait_condition= select count(*)=0 from information_schema.processlist where state like "%debug%"; +source include/wait_condition.inc; SET DEBUG_SYNC= 'RESET'; --source include/wait_for_slave_io_to_start.inc diff --git a/mysql-test/suite/rpl/t/rpl_empty_string_is_null.test b/mysql-test/suite/rpl/t/rpl_empty_string_is_null.test new file mode 100644 index 0000000000000..a0fecbb54ac09 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_empty_string_is_null.test @@ -0,0 +1,15 @@ +--source include/master-slave.inc +--source include/have_binlog_format_row.inc + +--echo # +--echo # MDEV-18918 SQL mode EMPTY_STRING_IS_NULL breaks RBR upon CREATE TABLE .. SELECT +--echo # + +SET SQL_MODE= 'EMPTY_STRING_IS_NULL'; +CREATE TABLE t1 AS SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE 1 = 0; +--sync_slave_with_master +SHOW CREATE TABLE t1; +--connection master +DROP TABLE t1; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_filter_revoke_missing_user.test b/mysql-test/suite/rpl/t/rpl_filter_revoke_missing_user.test new file mode 100644 index 0000000000000..ca2c18d36e104 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_filter_revoke_missing_user.test @@ -0,0 +1,92 @@ +# +# Purpose: +# This test ensures that a binlogged Query_log_event which failed on the +# primary server does not break replication if it is ignored by Grant_tables +# on the replica. The bug reported by MDEV-28530 shows this with +# REVOKE ALL PRIVILEGES.. using a non-existent user. The primary will binlog +# the REVOKE command with an error code, and the replica will think the command +# executed with success because the replication filter will ignore the command +# while accessing the Grant_tables classes. When the replica performs an error +# check, it sees the difference between the error codes, and replication +# breaks. +# +# Methodology: +# Using a replica configured with replicate_wild_ignore_table="schema.%", +# on the primary, execute REVOKE ALL PRVILEGES using a non-existent user and +# DROP USER using a list of users where not all users exist, and ensure that +# the replica acknowledges and ignores the events without erroring. +# +# References: +# MDEV-28530: Revoking privileges from a non-existing user on a master breaks +# replication on the slave in the presence of replication filters +# + +source include/master-slave.inc; +source include/have_binlog_format_statement.inc; + +--echo # +--echo # Set replica to ignore system tables +connection slave; +let $old_filter= query_get_value(SHOW SLAVE STATUS, Replicate_Wild_Ignore_Table, 1); +source include/stop_slave.inc; +SET @@GLOBAL.replicate_wild_ignore_table="mysql.%"; +source include/start_slave.inc; + + +--echo # +--echo # Trying to execute REVOKE ALL PRIVILEGES on a non-existent user and +--echo # DROP USER on a list of users where not all users exist should error +--echo # and be written into the binary log +--connection master + +--error 1269 +REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'nonexistentuser'@'%'; + +CREATE USER 'testuser'@'localhost' IDENTIFIED by ''; +--error 1396 +DROP USER 'testuser'@'localhost', 'nonexistentuser'@'%'; +--save_master_pos + + +--echo # +--echo # Ensure the events exist in the primary's binary log +--let $MYSQLD_DATADIR= `select @@datadir` +--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1) +FLUSH BINARY LOGS; +--echo # MYSQL_BINLOG MYSQLD_DATADIR/binlog_file > MYSQL_TMP_DIR/mysqlbinlog_out.sql +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file > $MYSQL_TMP_DIR/mysqlbinlog_out.sql + +--echo # There should be three Query events: REVOKE, CREATE USER, and DROP USER +--let SEARCH_FILE= $MYSQL_TMP_DIR/mysqlbinlog_out.sql + +--let SEARCH_PATTERN= Query +--source include/search_pattern_in_file.inc + +--let SEARCH_PATTERN= REVOKE ALL PRIVILEGES +--source include/search_pattern_in_file.inc + +--let SEARCH_PATTERN= CREATE USER +--source include/search_pattern_in_file.inc + +--let SEARCH_PATTERN= DROP USER +--source include/search_pattern_in_file.inc + + +--echo # +--echo # Ensure that the replica receives the event without error +connection slave; +--sync_with_master +let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); +--echo Last_SQL_Error = $error +let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); +--echo Last_SQL_Errno = $errno + + +--echo # +--echo # Clean up +--connection slave +source include/stop_slave.inc; +--eval SET @@GLOBAL.replicate_wild_ignore_table="$old_filter" +source include/start_slave.inc; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_filter_set_var_missing_data.test b/mysql-test/suite/rpl/t/rpl_filter_set_var_missing_data.test new file mode 100644 index 0000000000000..25efb6ed66275 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_filter_set_var_missing_data.test @@ -0,0 +1,83 @@ +# +# Purpose: +# This test ensures that the SET DEFAULT ROLE and SET PASSWORD commands can +# be ignored by replica filter rules. MDEV-28294 exposed a bug in which +# SET DEFAULT ROLE would check for the existence of the given roles/user even +# when the targeted tables are ignored, resulting in errors if the targeted +# data does not exist. More specifically, when previously issued +# CREATE USER/ROLE commands are ignored by the replica because of the +# replication filtering rules, SET DEFAULT ROLE would result in an error +# because the targeted data does not exist. +# +# Methodology: +# Using a replica configured with replicate_wild_ignore_table="mysql.%", +# execute SET DEFAULT ROLE and SET PASSWORD on the primary and ensure that the +# replica neither errors nor executes the commands which the primary sends. +# +# References: +# MDEV-28294: set default role bypasses Replicate_Wild_Ignore_Table: mysql.% +# + +source include/master-slave.inc; +source include/have_binlog_format_mixed.inc; + +--echo # +--echo # Set replica to ignore system mysql tables +connection slave; +let $old_filter= query_get_value(SHOW SLAVE STATUS, Replicate_Wild_Ignore_Table, 1); +source include/stop_slave.inc; +SET @@GLOBAL.replicate_wild_ignore_table="mysql.%"; +source include/start_slave.inc; + +--echo # +--echo # Execute grant-based commands on primary which modify mysql system +--echo # tables +connection master; +CREATE ROLE journalist; +CREATE USER testuser@localhost IDENTIFIED by ''; +GRANT journalist to testuser@localhost; + +--echo # +--echo # Execute SET commands which use the previous user/role data +SET DEFAULT ROLE journalist for testuser@localhost; +SET PASSWORD for testuser@localhost= PASSWORD('123'); +--source include/save_master_gtid.inc + +--echo # +--echo # Verify primary's grant tables have the correct user/role data +select count(*)=1 from mysql.user where User='testuser'; +select count(*)=1 from mysql.roles_mapping where User='testuser'; + +--echo # +--echo # Ensure that the replica receives all of the primary's events without +--echo # error +connection slave; +--source include/sync_with_master_gtid.inc +let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); +--echo Last_SQL_Error = $error +let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); +--echo Last_SQL_Errno = $errno + +--echo # +--echo # Verify that the replica did not execute the master's commands +select count(*)=0 from mysql.user where User='testuser'; +select count(*)=0 from mysql.roles_mapping where User='testuser'; + +--echo # +--echo # Clean up + +# The master has to drop the role/user combination while the slave still has +# its filters active; otherwise, the slave would try to drop users/roles that +# were never replicated. +--connection master +DROP ROLE journalist; +DROP USER testuser@localhost; +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc +source include/stop_slave.inc; +--eval SET @@GLOBAL.replicate_wild_ignore_table="$old_filter" +source include/start_slave.inc; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_gtid_basic.test b/mysql-test/suite/rpl/t/rpl_gtid_basic.test index 004003ea52488..5975c6f03c3e3 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_basic.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_basic.test @@ -1,4 +1,575 @@ ---source include/rpl_gtid_basic.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +--source include/have_innodb.inc +--let $rpl_topology=1->2->3->4 +--source include/rpl_init.inc + +# Set up a 4-deep replication topology, then test various fail-overs +# using GTID. +# +# A -> B -> C -> D + +connection server_1; +--source include/wait_for_binlog_checkpoint.inc +--let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1) +--let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1) +--echo *** GTID position should be empty here *** +--replace_result $binlog_file $binlog_pos +eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos); + +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; +CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, "m1"); +INSERT INTO t1 VALUES (2, "m2"), (3, "m3"), (4, "m4"); +INSERT INTO t2 VALUES (1, "i1"); +BEGIN; +INSERT INTO t2 VALUES (2, "i2"), (3, "i3"); +INSERT INTO t2 VALUES (4, "i4"); +COMMIT; +save_master_pos; +source include/wait_for_binlog_checkpoint.inc; +--let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1) +--let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1) +--let $gtid_pos_server_1 = `SELECT @@gtid_binlog_pos` +--echo *** GTID position should be non-empty here *** +--replace_result $binlog_file $binlog_pos $gtid_pos_server_1 +eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos); + +connection server_2; +sync_with_master; +source include/wait_for_binlog_checkpoint.inc; +--let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1) +--let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1) +--echo *** GTID position should be the same as on server_1 *** +--replace_result $binlog_file $binlog_pos $gtid_pos_server_1 +eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos); +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; +save_master_pos; + +connection server_3; +sync_with_master; +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; +save_master_pos; + +connection server_4; +sync_with_master; +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; + + +--echo *** Now take out D, let it fall behind a bit, and then test re-attaching it to A *** +connection server_4; +--source include/stop_slave.inc + +connection server_1; +INSERT INTO t1 VALUES (5, "m1a"); +INSERT INTO t2 VALUES (5, "i1a"); +save_master_pos; + +connection server_4; +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, + MASTER_USE_GTID=CURRENT_POS; +--source include/start_slave.inc +sync_with_master; +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; + +--echo *** Now move B to D (C is still replicating from B) *** +connection server_2; +--source include/stop_slave.inc +--replace_result $SERVER_MYPORT_4 SERVER_MYPORT_4 +eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4, + MASTER_USE_GTID=CURRENT_POS; +--source include/start_slave.inc + +connection server_4; +UPDATE t2 SET b="j1a" WHERE a=5; +save_master_pos; + +connection server_2; +sync_with_master; +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; + +--echo *** Now move C to D, after letting it fall a little behind *** +connection server_3; +--source include/stop_slave.inc + +connection server_1; +INSERT INTO t2 VALUES (6, "i6b"); +INSERT INTO t2 VALUES (7, "i7b"); +--source include/save_master_gtid.inc + +connection server_3; +--replace_result $SERVER_MYPORT_4 SERVER_MYPORT_4 +eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4, + MASTER_USE_GTID=CURRENT_POS; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc +SELECT * FROM t2 ORDER BY a; + +--echo *** Now change everything back to what it was, to make rpl_end.inc happy +# Also check that MASTER_USE_GTID=CURRENT_POS is still enabled. +connection server_2; +# We need to sync up server_2 before switching. If it happened to have reached +# the point 'UPDATE t2 SET b="j1a" WHERE a=5' it will fail to connect to +# server_1, which is (deliberately) missing that transaction. +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +--replace_result $MASTER_MYPORT MASTER_MYPORT +eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT; +--source include/start_slave.inc +--source include/wait_for_slave_to_start.inc + +connection server_3; +--source include/stop_slave.inc +--replace_result $SLAVE_MYPORT SLAVE_MYPORT +eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SLAVE_MYPORT; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +connection server_4; +--source include/stop_slave.inc +--replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3 +eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_3; +--source include/start_slave.inc + +connection server_1; +DROP TABLE t1,t2; +--source include/save_master_gtid.inc + +--echo *** A few more checks for BINLOG_GTID_POS function *** +--let $valid_binlog_name = query_get_value(SHOW BINARY LOGS,Log_name,1) +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +SELECT BINLOG_GTID_POS(); +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +SELECT BINLOG_GTID_POS('a'); +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +SELECT BINLOG_GTID_POS('a',1,NULL); +SELECT BINLOG_GTID_POS(1,'a'); +SELECT BINLOG_GTID_POS(NULL,NULL); +SELECT BINLOG_GTID_POS('',1); +SELECT BINLOG_GTID_POS('a',1); +eval SELECT BINLOG_GTID_POS('$valid_binlog_name',-1); +eval SELECT BINLOG_GTID_POS('$valid_binlog_name',0); +eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551615); +eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551616); + + +--echo *** Some tests of @@GLOBAL.gtid_binlog_state *** +--connection server_2 +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc + +--connection server_1 +SET @old_state= @@GLOBAL.gtid_binlog_state; + +--error ER_BINLOG_MUST_BE_EMPTY +SET GLOBAL gtid_binlog_state = ''; +RESET MASTER; +SET GLOBAL gtid_binlog_state = ''; +FLUSH LOGS; +--source include/show_binary_logs.inc +SET GLOBAL gtid_binlog_state = '0-1-10,1-2-20,0-3-30'; +--source include/show_binary_logs.inc +--let $binlog_file= master-bin.000001 +--let $binlog_start= 4 +--source include/show_binlog_events.inc +#SELECT @@GLOBAL.gtid_binlog_pos; +#SELECT @@GLOBAL.gtid_binlog_state; +--error ER_BINLOG_MUST_BE_EMPTY +SET GLOBAL gtid_binlog_state = @old_state; +RESET MASTER; +SET GLOBAL gtid_binlog_state = @old_state; + +# Check that slave can reconnect again, despite the RESET MASTER, as we +# restored the state. + +CREATE TABLE t1 (a INT PRIMARY KEY); +SET gtid_seq_no=100; +INSERT INTO t1 VALUES (1); +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +# We cannot just use sync_with_master as we've done RESET MASTER, so +# slave old-style position is wrong. +# So sync on gtid position instead. +--source include/sync_with_master_gtid.inc + +SELECT * FROM t1; +# Check that the IO gtid position in SHOW SLAVE STATUS is also correct. +--let $status_items= Gtid_IO_Pos +--source include/show_slave_status.inc + +--echo *** Test @@LAST_GTID and MASTER_GTID_WAIT() *** + +--connection server_1 +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc + +--connect (m1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SELECT @@last_gtid; +SET gtid_seq_no=110; +SELECT @@last_gtid; +BEGIN; +SELECT @@last_gtid; +INSERT INTO t1 VALUES (2); +SELECT @@last_gtid; +COMMIT; +SELECT @@last_gtid; +--let $pos= `SELECT @@gtid_binlog_pos` + +--connect (s1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +eval SET @pos= '$pos'; +# Check NULL argument. +SELECT master_gtid_wait(NULL); +# Check empty argument returns immediately. +SELECT master_gtid_wait('', NULL); +# Check this gets counted +SHOW STATUS LIKE 'Master_gtid_wait_count'; +SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; +SHOW STATUS LIKE 'Master_gtid_wait_time'; +# Let's check that we get a timeout +SELECT master_gtid_wait(@pos, 0.5); +SELECT * FROM t1 ORDER BY a; +# Now actually wait until the slave reaches the position +send SELECT master_gtid_wait(@pos); + +--connection server_2 +--source include/start_slave.inc + +--connection s1 +reap; +SELECT * FROM t1 ORDER BY a; + +# Test waiting on a domain that does not exist yet. +--source include/stop_slave.inc + +--connection server_1 +SET gtid_domain_id= 1; +INSERT INTO t1 VALUES (3); +--let $pos= `SELECT @@gtid_binlog_pos` + +--connection s1 +--replace_result $pos POS +eval SET @pos= '$pos'; +SELECT master_gtid_wait(@pos, 0); +SELECT * FROM t1 WHERE a >= 3; +send SELECT master_gtid_wait(@pos, -1); + +--connection server_2 +--source include/start_slave.inc + +--connection s1 +reap; +SELECT * FROM t1 WHERE a >= 3; +# Waiting for only part of the position. +SELECT master_gtid_wait('1-1-1', 0); + +# Now test a lot of parallel master_gtid_wait() calls, completing in different +# order, and some of which time out or get killed on the way. + +--connection s1 +send SELECT master_gtid_wait('2-1-1,1-1-4,0-1-110'); + +--connect (s2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +# This will time out. No event 0-1-1000 exists +send SELECT master_gtid_wait('0-1-1000', 0.5); + +--connect (s3,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +# This one we will kill +--let $kill1_id= `SELECT connection_id()` +send SELECT master_gtid_wait('0-1-2000'); + +--connect (s4,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +send SELECT master_gtid_wait('2-1-10'); + +--connect (s5,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +send SELECT master_gtid_wait('2-1-6', 1); + +# This one we will kill also. +--connect (s6,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +--let $kill2_id= `SELECT connection_id()` +send SELECT master_gtid_wait('2-1-5'); + +--connect (s7,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +send SELECT master_gtid_wait('2-1-10'); + +--connect (s8,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +send SELECT master_gtid_wait('2-1-5,1-1-4,0-1-110'); + +--connect (s9,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +send SELECT master_gtid_wait('2-1-2'); + +--connection server_2 +# This one completes immediately. +SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; +SHOW STATUS LIKE 'Master_gtid_wait_count'; +SELECT master_gtid_wait('1-1-1'); +SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; +SHOW STATUS LIKE 'Master_gtid_wait_count'; +let $wait_time = query_get_value(SHOW STATUS LIKE 'Master_gtid_wait_time', Value, 1); +--replace_result $wait_time MASTER_GTID_WAIT_TIME +eval SET @a= $wait_time; +SELECT IF(@a <= 100*1000*1000, "OK", CONCAT("Error: wait time ", @a, " is larger than expected")) + AS Master_gtid_wait_time_as_expected; + + +--connect (s10,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +send SELECT master_gtid_wait('0-1-109'); + +--connection server_2 +# This one should time out. +SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; +SHOW STATUS LIKE 'Master_gtid_wait_count'; +SELECT master_gtid_wait('2-1-2', 0.5); +SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; +SHOW STATUS LIKE 'Master_gtid_wait_count'; +let $wait_time = query_get_value(SHOW STATUS LIKE 'Master_gtid_wait_time', Value, 1); +--replace_result $wait_time MASTER_GTID_WAIT_TIME +eval SET @a= $wait_time; +# We expect a wait time of just a bit over 0.5 seconds. But thread scheduling +# and timer inaccuracies could introduce significant jitter. So allow a +# generous interval. +SELECT IF(@a BETWEEN 0.4*1000*1000 AND 100*1000*1000, "OK", CONCAT("Error: wait time ", @a, " not as expected")) AS Master_gtid_wait_time_as_expected; + +--replace_result $kill1_id KILL_ID +eval KILL QUERY $kill1_id; +--connection s3 +--error ER_QUERY_INTERRUPTED +reap; + +--connection server_1 +SET gtid_domain_id=2; +SET gtid_seq_no=2; +INSERT INTO t1 VALUES (4); + +--connection s9 +reap; + +--connection server_2 +--replace_result $kill2_id KILL_ID +eval KILL CONNECTION $kill2_id; + +--connection s6 +--error 2013,ER_CONNECTION_KILLED +reap; + +--connection server_1 +SET gtid_domain_id=1; +SET gtid_seq_no=4; +INSERT INTO t1 VALUES (5); +SET gtid_domain_id=2; +SET gtid_seq_no=5; +INSERT INTO t1 VALUES (6); + +--connection s8 +reap; +--connection s1 +reap; +--connection s2 +reap; +--connection s5 +reap; +--connection s10 +reap; + +--connection server_1 +SET gtid_domain_id=2; +SET gtid_seq_no=10; +INSERT INTO t1 VALUES (7); + +--connection s4 +reap; +--connection s7 +reap; + + +--echo *** Test gtid_slave_pos when used with GTID *** + +--connection server_2 +--source include/stop_slave.inc + +--connection server_1 +SET gtid_domain_id=2; +SET gtid_seq_no=1000; +INSERT INTO t1 VALUES (10); +INSERT INTO t1 VALUES (11); +--save_master_pos + +--connection server_2 +SET sql_slave_skip_counter= 1; +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t1 WHERE a >= 10 ORDER BY a; +SELECT IF(LOCATE("2-1-1001", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1001 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; + +--source include/stop_slave.inc + +--connection server_1 +SET gtid_domain_id=2; +SET gtid_seq_no=1010; +INSERT INTO t1 VALUES (12); +INSERT INTO t1 VALUES (13); +--save_master_pos + +--connection server_2 +SET sql_slave_skip_counter= 2; +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t1 WHERE a >= 10 ORDER BY a; +SELECT IF(LOCATE("2-1-1011", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1011 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; + +--source include/stop_slave.inc + +--connection server_1 +SET gtid_domain_id=2; +SET gtid_seq_no=1020; +INSERT INTO t1 VALUES (14); +INSERT INTO t1 VALUES (15); +INSERT INTO t1 VALUES (16); +--save_master_pos + +--connection server_2 +SET sql_slave_skip_counter= 3; +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t1 WHERE a >= 10 ORDER BY a; +SELECT IF(LOCATE("2-1-1022", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1022 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; + +--source include/stop_slave.inc + +--connection server_1 +SET gtid_domain_id=2; +SET gtid_seq_no=1030; +# Disable logging Annotate_rows events to preserve events count. +let $binlog_annotate_row_events_saved= `SELECT @@binlog_annotate_row_events`; +SET @@binlog_annotate_row_events= 0; +INSERT INTO t1 VALUES (17); +INSERT INTO t1 VALUES (18); +INSERT INTO t1 VALUES (19); +eval SET @@binlog_annotate_row_events= $binlog_annotate_row_events_saved; +--save_master_pos + +--connection server_2 +SET sql_slave_skip_counter= 5; +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t1 WHERE a >= 10 ORDER BY a; +SELECT IF(LOCATE("2-1-1032", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1032 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; + + +--source include/stop_slave.inc + +--connection server_1 +SET gtid_domain_id=3; +SET gtid_seq_no=100; +CREATE TABLE t2 (a INT PRIMARY KEY); +DROP TABLE t2; +SET gtid_domain_id=2; +SET gtid_seq_no=1040; +INSERT INTO t1 VALUES (20); +--save_master_pos + +--connection server_2 +SET @saved_mode= @@GLOBAL.slave_ddl_exec_mode; +SET GLOBAL slave_ddl_exec_mode=STRICT; +SET sql_slave_skip_counter=1; +START SLAVE UNTIL master_gtid_pos="3-1-100"; +--let $master_pos=3-1-100 +--source include/sync_with_master_gtid.inc +--source include/wait_for_slave_to_stop.inc +--error ER_NO_SUCH_TABLE +SELECT * FROM t2; +SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; + +# Start the slave again, it should fail on the DROP TABLE as the table is not there. +SET sql_log_bin=0; +CALL mtr.add_suppression("Slave: Unknown table 'test\\.t2' Error_code: 1051"); +SET sql_log_bin=1; +START SLAVE; +--let $slave_sql_errno=1051 +--source include/wait_for_slave_sql_error.inc +SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; + +STOP SLAVE IO_THREAD; +SET sql_slave_skip_counter=2; +--source include/start_slave.inc +--sync_with_master + +SELECT * FROM t1 WHERE a >= 20 ORDER BY a; +SELECT IF(LOCATE("3-1-101", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-101 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; +SELECT IF(LOCATE("2-1-1040", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1040 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; + +SET GLOBAL slave_ddl_exec_mode= @saved_mode; + + +--echo *** Test GTID-connecting to a master with out-of-order sequence numbers in the binlog. *** + +# Create an out-of-order binlog on server 2. +# Let server 3 replicate to an out-of-order point, stop it, restart it, +# and check that it replicates correctly despite the out-of-order. + +--connection server_1 +SET gtid_domain_id= @@GLOBAL.gtid_domain_id; +INSERT INTO t1 VALUES (31); +--save_master_pos + +--connection server_2 +--sync_with_master +SET gtid_domain_id= @@GLOBAL.gtid_domain_id; +INSERT INTO t1 VALUES (32); + +--connection server_1 +INSERT INTO t1 VALUES (33); +--save_master_pos + +--connection server_2 +--sync_with_master +--save_master_pos + +--connection server_3 +--sync_with_master +--source include/stop_slave.inc + +--connection server_1 +INSERT INTO t1 VALUES (34); +--save_master_pos + +--connection server_2 +--sync_with_master +--save_master_pos + +--connection server_3 +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t1 WHERE a >= 30 ORDER BY a; +--save_master_pos + +--connection server_4 +--sync_with_master +SELECT * FROM t1 WHERE a >= 30 ORDER BY a; + + +# Clean up. +--connection server_1 +DROP TABLE t1; + + +--source include/rpl_end.inc --echo # --echo # Start of 10.2 tests diff --git a/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test b/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test index c02e2670c922e..412489b3ee3d4 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test @@ -5,6 +5,7 @@ --echo *** Test that we check against incorrect table definition for mysql.gtid_slave_pos *** --connection master CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; +call mtr.add_suppression("Incorrect definition of table mysql.gtid_slave_pos:.*"); --sync_slave_with_master --connection slave diff --git a/mysql-test/suite/rpl/t/rpl_gtid_glle_no_terminate.test b/mysql-test/suite/rpl/t/rpl_gtid_glle_no_terminate.test new file mode 100644 index 0000000000000..f0f38a31da6d6 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_gtid_glle_no_terminate.test @@ -0,0 +1,72 @@ +# +# Purpose: +# If a fake Glle event follows a Gtid event, we need to ensure the rest of +# the group should not terminate at the Glle event. MDEV-28550 revealed that +# a Glle would terminate the event and upon reconnect, the DDL would be lost. +# +# Methodology: +# Force the primary to send a fake GLLE event after a GTID on a "reconnect" +# and ensure that both 1) the replica does not error, and 2) the original +# command within the GTID is executed. +# +# References: +# MDEV-28550: improper handling of replication event group that contains Gtid_log_list_event + +--source include/master-slave.inc + +# Independent of binlog format +--source include/have_binlog_format_statement.inc + +--connection slave +--source include/stop_slave.inc +CHANGE MASTER TO MASTER_USE_GTID=slave_pos; + +--echo # +--echo # Initialize test data +--connection master +create table t1 (a int); +SET @@session.server_id= 3; +create table t2 (a int); +--source include/save_master_gtid.inc + +--echo # +--echo # Have the replica "reconnect" and the primary will send Gtid, Glle, DDL +--connection slave +eval set global gtid_slave_pos="0-3-1"; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +--echo # +--echo # Ensure that the replica did not error +connection slave; +--source include/sync_with_master_gtid.inc +let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); +--echo Last_SQL_Error = $error +let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); +--echo Last_SQL_Errno = $errno + +--echo # +--echo # Ensure that the primary sent a Glle after a Gtid event +let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); +let $binlog_start= $relaylog_start; +let $binlog_limit=0,10; +--source include/show_relaylog_events.inc + +--echo # +--echo # Ensure the DDL was executed on the replica +if (!`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name = 't2'`) +{ + die "t2 should exist on slave"; +} + +--echo # +--echo # Cleanup + +--echo # t1 does not make it to the replica +--connection master +set sql_log_bin=0; +DROP TABLE t1; +set sql_log_bin=1; +DROP TABLE t2; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_gtid_grouping.test b/mysql-test/suite/rpl/t/rpl_gtid_grouping.test new file mode 100644 index 0000000000000..66448c4f96cd7 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_gtid_grouping.test @@ -0,0 +1,97 @@ +# ==== Purpose ==== +# +# Test verifies that replicated transaction boundaries are set properly +# at receiving from master time. +# +# ==== Implementation ==== +# +# A. Simulate an unnoticeable loss of Xid event to observe a slave error, +# then restart slave to recover from the failure. +# B. Do the same to GTID event. +# +# ==== References ==== +# +# MDEV-27697 slave must recognize incomplete replication event group +# +--source include/have_binlog_format_mixed.inc +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/master-slave.inc + +--connection slave +call mtr.add_suppression("Unexpected break of being relay-logged GTID 0-27697-1000"); +call mtr.add_suppression("Relay log write failure: could not queue event from master"); +call mtr.add_suppression("The current group of events starts with a non-GTID"); + +--source include/stop_slave.inc +CHANGE MASTER TO MASTER_USE_GTID=slave_pos; +--source include/start_slave.inc + +--connection master +CREATE TABLE t (a INT) ENGINE=innodb; +INSERT INTO t VALUES(1); +save_master_pos; + +--echo ### A. Simulate an unnoticeable loss of Xid event +--sync_slave_with_master +SET @@global.debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000"; + +--connection master +SET @@gtid_seq_no=1000; +set @@server_id=27697; +INSERT INTO t VALUES(1000); +set @@server_id=default; +INSERT INTO t VALUES(1001); + +--echo ## Prove the error occurs. +--connection slave +# ER_SLAVE_RELAY_LOG_WRITE_FAILURE +--let $slave_io_errno = 1595 +--source include/wait_for_slave_io_error.inc +## EOP + +--echo ## Prove the slave recovers after the simulation condtion is lifted. +SET @@global.debug_dbug=default; +--source include/start_slave.inc + +--echo ### B. Do the same to GTID event. +--connection slave +SET @@global.debug_dbug="+d,slave_discard_gtid_0_x_1002"; + +--connection master +SET @@gtid_seq_no=1002; +set @@server_id=27697; +INSERT INTO t VALUES(1002); +set @@server_id=default; +INSERT INTO t VALUES(1003); + +--echo ## Prove the error occurs. +--connection slave +# ER_SLAVE_RELAY_LOG_WRITE_FAILURE +--let $slave_io_errno = 1595 +--source include/wait_for_slave_io_error.inc +## EOP + +--echo ## Prove the slave recovers after the simulation condtion is lifted. +SET @@global.debug_dbug=default; +--source include/start_slave.inc + +--connection master +save_master_pos; + +--sync_slave_with_master +## EOP + +--let $diff_tables=master:t,slave:t +--source include/diff_tables.inc + +--echo "===== Clean up =====" +--connection slave +--source include/stop_slave.inc +CHANGE MASTER TO MASTER_USE_GTID=no; +--source include/start_slave.inc + +--connection master +DROP TABLE t; +SET GLOBAL LOG_WARNINGS=default; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test index 4a1922308593f..385378109068c 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test @@ -2,6 +2,7 @@ if (`SELECT $PS_PROTOCOL != 0`) { --skip Test temporarily disabled for ps-protocol } +--source include/no_valgrind_without_big.inc --let $rpl_topology=1->2 --source include/rpl_init.inc --source include/have_innodb.inc diff --git a/mysql-test/suite/rpl/t/rpl_incident.test b/mysql-test/suite/rpl/t/rpl_incident.test index 4bb6477ca986d..75d28d6a6c6b0 100644 --- a/mysql-test/suite/rpl/t/rpl_incident.test +++ b/mysql-test/suite/rpl/t/rpl_incident.test @@ -1 +1,61 @@ ---source include/rpl_incident.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +--source include/have_debug.inc +--source include/master-slave.inc + +SET @old_binlog_checksum=@@binlog_checksum; +SET GLOBAL BINLOG_CHECKSUM=none; +connection slave; +SET @old_binlog_checksum=@@binlog_checksum; +SET GLOBAL BINLOG_CHECKSUM=none; +connection master; + +--echo **** On Master **** +CREATE TABLE t1 (a INT); + +INSERT INTO t1 VALUES (1),(2),(3); +SELECT * FROM t1; + +set @saved_dbug = @@global.debug_dbug; +SET GLOBAL debug_dbug= '+d,incident_database_resync_on_replace,*'; + +# This will generate an incident log event and store it in the binary +# log before the replace statement. +REPLACE INTO t1 VALUES (4); +--save_master_pos +SELECT * FROM t1; + +set @@global.debug_dbug = @saved_dbug; + +connection slave; +# Wait until SQL thread stops with error LOST_EVENT on master +call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master.* 1590"); +let $slave_sql_errno= 1590; +let $show_slave_sql_error= 1; +source include/wait_for_slave_sql_error.inc; + +# The 4 should not be inserted into the table, since the incident log +# event should have stop the slave. +--echo **** On Slave **** +SELECT * FROM t1; + +SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; +START SLAVE; +--sync_with_master + +# Now, we should have inserted the row into the table and the slave +# should be running. We should also have rotated to a new binary log. + +SELECT * FROM t1; +source include/check_slave_is_running.inc; + +connection master; +SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum; +DROP TABLE t1; +--sync_slave_with_master +SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test index 6f6ab7e8d7c9a..46673ea47649f 100644 --- a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test +++ b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test @@ -1 +1,96 @@ ---source include/rpl_init_slave_errors.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +###################################################################### +# Some errors that cause the slave SQL thread to stop are not shown in +# the Slave_SQL_Error column of "SHOW SLAVE STATUS". Instead, the error +# is only in the server's error log. +# +# Two failures and their respective reporting are verified: +# +# 1 - Failures during slave thread initialization +# 2 - Failures while processing queries passed through the init_slave +# option. +# +# In order to check the first type of failure, we inject a fault in the +# SQL/IO Threads through SET GLOBAL debug. +# +# To check the second type, we set @@global.init_slave to an invalid +# command thus preventing the initialization of the SQL Thread. +# +# Obs: +# 1 - Note that testing failures while initializing the relay log position +# is hard as the same function is called before the code reaches the point +# that we want to test. +# +# 2 - This test does not target failures that are reported while applying +# events such as duplicate keys, errors while reading the relay-log.bin*, +# etc. Such errors are already checked on other tests. +###################################################################### + +###################################################################### +# Configuring the Environment +###################################################################### +source include/have_debug.inc; +source include/have_log_bin.inc; +source include/master-slave.inc; + +connection slave; + +--disable_warnings +stop slave; +--enable_warnings +reset slave; + +###################################################################### +# Injecting faults in the threads' initialization +###################################################################### +connection slave; + +# Set debug flags on slave to force errors to occur +set @saved_dbug = @@global.debug_dbug; +SET GLOBAL debug_dbug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; + +start slave; + +# +# slave is going to stop because of emulated failures +# but there won't be any crashes nor asserts hit. +# +# 1593 = ER_SLAVE_FATAL_ERROR +--let $slave_sql_errno= 1593 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc + +call mtr.add_suppression("Failed during slave.* thread initialization"); + +set @@global.debug_dbug = @saved_dbug; + +###################################################################### +# Injecting faults in the init_slave option +###################################################################### +connection slave; + +reset slave; + +SET GLOBAL init_slave= "garbage"; + +start slave; +# 1064 = ER_PARSE_ERROR +--let $slave_sql_errno= 1064 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc + +###################################################################### +# Clean up +###################################################################### +SET GLOBAL init_slave= ""; + +# Clean up Last_SQL_Error +--source include/stop_slave_io.inc +RESET SLAVE; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_iodku.test b/mysql-test/suite/rpl/t/rpl_iodku.test new file mode 100644 index 0000000000000..815b927c35069 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_iodku.test @@ -0,0 +1,50 @@ +--source include/have_innodb.inc +--source include/master-slave.inc + +if (`select @@binlog_format = "statement"`) +{ + call mtr.add_suppression("Unsafe statement written to the binary log using statement"); +} + +## MDEV-28310 loss of binlog event for multi-record IODKU +# Check that the duplicate key error does not cause +# loss of replication event for IODKU that specifies values +# for at least two unique columns per record. +# "Implicit" NULL value of the auto-increment column also counts. + +CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, a INT, b INT, c INT, + UNIQUE (a), UNIQUE (b)) ENGINE=innodb; +INSERT INTO t1 (`a`,`c`) VALUES (1,1), (2,1) ON DUPLICATE KEY UPDATE c = 1; +--echo # UNSAFE +# because of two keys involved: a UK and PK even though implicitly via auto-inc +INSERT INTO t1 (`a`,`c`) VALUES (3, 1),(2,1), (1,1) ON DUPLICATE KEY UPDATE c = a * 10 + VALUES(c); +SELECT * from t1; + +--sync_slave_with_master +--let $diff_tables = master:t1,slave:t1 +--source include/diff_tables.inc + +## MDEV-21810 MBR: Unexpected "Unsafe statement" warning for unsafe IODKU +# Unnecessary unsafe statement warning is not error-logged anymore. + + +--connection master +CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, UNIQUE (a), UNIQUE (b)) ENGINE=innodb; +INSERT INTO t1 VALUES (1,10,1); +--echo # eligable for the statement format run unsafe warning +INSERT INTO t1 VALUES (2,20,2) ON DUPLICATE KEY UPDATE c = 100; +--echo # not eligable: no warning in the statement format run +INSERT INTO t1 (`a`,`c`) VALUES (3, 1) ON DUPLICATE KEY UPDATE c = 99; +SELECT * from t1; + +--sync_slave_with_master +--let $diff_tables = master:t1,slave:t1 +--source include/diff_tables.inc + +# Cleanup +--connection master +DROP TABLE t1; +--sync_slave_with_master + + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_lcase_tblnames_rewrite_db.test b/mysql-test/suite/rpl/t/rpl_lcase_tblnames_rewrite_db.test index 9c804d8206ac1..a27a50d0fc4cb 100644 --- a/mysql-test/suite/rpl/t/rpl_lcase_tblnames_rewrite_db.test +++ b/mysql-test/suite/rpl/t/rpl_lcase_tblnames_rewrite_db.test @@ -15,8 +15,8 @@ # # (iii) master and slave tables do not differ # --- source include/master-slave.inc -- source include/not_windows.inc +-- source include/master-slave.inc SET SQL_LOG_BIN=0; CREATE DATABASE B37656; diff --git a/mysql-test/suite/rpl/include/rpl_loaddata_local.inc b/mysql-test/suite/rpl/t/rpl_loaddata_local.test similarity index 100% rename from mysql-test/suite/rpl/include/rpl_loaddata_local.inc rename to mysql-test/suite/rpl/t/rpl_loaddata_local.test diff --git a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test deleted file mode 100644 index 712041467ab1c..0000000000000 --- a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test +++ /dev/null @@ -1 +0,0 @@ ---source include/rpl_loaddata_local.inc diff --git a/mysql-test/suite/rpl/t/rpl_loadfile.test b/mysql-test/suite/rpl/t/rpl_loadfile.test index 10fecf1f65354..9cd645306908c 100644 --- a/mysql-test/suite/rpl/t/rpl_loadfile.test +++ b/mysql-test/suite/rpl/t/rpl_loadfile.test @@ -1 +1,120 @@ ---source include/rpl_loadfile.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +############################################################################# +# Original Author: JBM # +# Original Date: Aug/18/2005 # +############################################################################# +# TEST: To test the LOAD_FILE() in rbr # +############################################################################# +# Change Author: JBM +# Change Date: 2006-01-16 +########## + +# Includes +-- source include/have_binlog_format_mixed_or_row.inc +-- source include/master-slave.inc + +-- source suite/rpl/include/rpl_loadfile.test + +# BUG#39701: Mixed binlog format does not switch to row mode on LOAD_FILE +# +# DESCRIPTION +# +# Problem: when using load_file string function and mixed binlogging format +# there was no switch to row based binlogging format. This leads +# to scenarios on which the slave replicates the statement and it +# will try to load the file from local file system, which in most +# likely it will not exist. +# +# Solution: +# Marking this function as unsafe for statement format, makes the +# statement using it to be logged in row based format. As such, data +# replicated from the master, becomes the content of the loaded file. +# Consequently, the slave receives the necessary data to complete +# the load_file instruction correctly. +# +# IMPLEMENTATION +# +# The test is implemented as follows: +# +# On Master, +# i) write to file the desired content. +# ii) create table and stored procedure with load_file +# iii) stop slave +# iii) execute load_file +# iv) remove file +# +# On Slave, +# v) start slave +# vi) sync it with master so that it gets the updates from binlog (which +# should have bin logged in row format). +# +# If the the binlog format does not change to row, then the assertion +# done in the following step fails. This happens because tables differ +# since the file does not exist anymore, meaning that when slave +# attempts to execute LOAD_FILE statement it inserts NULL on table +# instead of the same contents that the master loaded when it executed +# the procedure (which was executed when file existed). +# +# vii) assert that the contents of master and slave +# table are the same + +--source include/rpl_reset.inc + +connection master; +let $file= $MYSQLTEST_VARDIR/tmp/bug_39701.data; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT repeat('x',20) INTO OUTFILE '$file' + +disable_warnings; +DROP TABLE IF EXISTS t1; +enable_warnings; + +CREATE TABLE t1 (t text); +DELIMITER |; +CREATE PROCEDURE p(file varchar(4096)) + BEGIN + INSERT INTO t1 VALUES (LOAD_FILE(file)); + END| +DELIMITER ;| + +# stop slave before issuing the load_file on master +connection slave; +source include/stop_slave.inc; + +connection master; + +# test: check that logging falls back to rbr. +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval CALL p('$file') + +# test: remove the file from the filesystem and assert that slave still +# gets the loaded file +remove_file $file; + +# now that the file is removed it is safe (regarding what we want to test) +# to start slave +connection slave; +source include/start_slave.inc; + +connection master; +sync_slave_with_master; + +# assertion: assert that the slave got the updates even +# if the file was removed before the slave started, +# meaning that contents were indeed transfered +# through binlog (in row format) +let $diff_tables= master:t1, slave:t1; +source include/diff_tables.inc; + +# CLEAN UP +--connection master +DROP TABLE t1; +DROP PROCEDURE p; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test b/mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test index 3a4a24e1762e3..8c4baafe23da4 100644 --- a/mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test +++ b/mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test @@ -13,6 +13,7 @@ # during this window while forcing a rotation in the binlog. # --source include/have_debug.inc +--source include/have_debug_sync.inc --source include/master-slave.inc --connection master diff --git a/mysql-test/suite/rpl/t/rpl_mdev-11092.test b/mysql-test/suite/rpl/t/rpl_mdev-11092.test index 782d24803c779..0c020386b9871 100644 --- a/mysql-test/suite/rpl/t/rpl_mdev-11092.test +++ b/mysql-test/suite/rpl/t/rpl_mdev-11092.test @@ -1,3 +1,4 @@ +--source include/have_debug.inc --source include/have_innodb.inc --source include/not_embedded.inc --source include/not_windows.inc @@ -6,13 +7,19 @@ ######################################################################################## call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occurred on the master. .*"); +call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occured on the master. .*"); +call mtr.add_suppression("Write to binary log failed: Multi-row statements required more than .max_binlog_stmt_cache_size.* "); +call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size.* "); +call mtr.add_suppression("Incident event write to the binary log file failed"); +call mtr.add_suppression("handlerton rollback failed"); let $old_max_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_cache_size", Value, 1); let $old_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_cache_size", Value, 1); let $old_max_binlog_stmt_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_stmt_cache_size", Value, 1); let $old_binlog_stmt_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_stmt_cache_size", Value, 1); +--echo "*********** Annotate Event write failure **************" + SET GLOBAL max_binlog_cache_size = 4096; SET GLOBAL binlog_cache_size = 4096; SET GLOBAL max_binlog_stmt_cache_size = 4096; @@ -26,19 +33,162 @@ let $data = `select concat('"', repeat('a',2000), '"')`; connection master; +# Insert a huge row into MyISAM table. The row will be inserted in engine and a +# request to write to binary log will be initiated. Since row annotations are +# enabled the size of the annotate event itself will exceed the +# "max_binlog_stmt_cache_size". This will result in ER_STMT_CACHE_FULL error +# and an incident event will be written to the binary log as row update in +# engine cannot be undone. + +--echo "#######################################################################" +--echo "# Test Case1: Annotate event write failure for MyISAM #" +--echo "#######################################################################" + --disable_query_log ---error ER_BINLOG_ROW_LOGGING_FAILED +--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) +--error ER_STMT_CACHE_FULL eval INSERT INTO t1 (a, data) VALUES (2, CONCAT($data, $data, $data, $data, $data, $data)); --enable_query_log +--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) +--echo # Validating update was not binlogged.. +if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") != 0`) +{ + --die Binlog GTID position should have been unchanged after failed update +} +--echo # ..success + +--echo # Validating that the inserted data was saved on the master.. +if(`SELECT COUNT(*)!=1 FROM t1`) +{ + --die The insertion should have saved on a non-transactional table +} +--echo # ..success + +--connection slave # Incident event # 1590=ER_SLAVE_INCIDENT --let $slave_sql_errno= 1590 --source include/wait_for_slave_sql_error_and_skip.inc -connection master; +--echo # Validating that the insert was not replicated to the slave.. +if(`SELECT COUNT(*) FROM t1`) +{ + --die The insertion should not have replicated to the slave +} +--echo # ..success + +# MDEV-21087 +# Insert two huge rows in to transaction cache. Have data such that first row +# fits inside the binary log cache. While writing the annotate event for the +# second row the binary log cache size will exceed "max_binlog_cache_size". +# Hence this statement cannot be written to binary log. As DMLs in Innodb can +# be safely rolled back only an error will be reported. Slave will continue to +# work. + +--echo "#######################################################################" +--echo "# Test Case2: Annotate event write failure for INNODB #" +--echo "#######################################################################" + +--connection master +CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=INNODB; +--disable_query_log +--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) +BEGIN; +eval INSERT INTO t2 (a, data) VALUES (1, CONCAT($data, $data)); +--error ER_TRANS_CACHE_FULL +eval INSERT INTO t2 (a, data) VALUES (2, CONCAT($data, $data)); +COMMIT; +--enable_query_log + +--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) +--echo # Validating binlog GTID position progressed from first insert.. +if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") = 0`) +{ + --die Binlog GTID position should have updated +} +--echo # ..success + +--echo # Validating that only the first insert into t2 saved.. +if(`SELECT COUNT(*)!=1 FROM t2`) +{ + --die Only one row should exist in t2 from the first insert, the second should have rolled back +} +--echo # ..success +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc +--echo # Validating the first insert into t2 replicated to slave.. +--let $diff_tables= master:test.t2,slave:test.t2 +--source include/diff_tables.inc +--echo # ..success + +# Testing mixed engine UPDATE statement scenario. In the following multi +# update query 'ha_update_row' will be invoked for t1 (myisam) table. This +# intern invokes binlog_write_table_map() function call. While writing a huge +# annotate event binary log cache size will exceed max_binlog_cache_size. +# Writing to binary log fails. Since non transactional changes cannot be +# rolled back incident event will be written to binary log. + +--echo "#######################################################################" +--echo "# Test Case3: Annotate event write failure for mixed engine UPDATE #" +--echo "#######################################################################" + +--connection master +let $new_data = `select concat('"', repeat('b',2000), '"')`; +--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) +--disable_query_log +--error ER_STMT_CACHE_FULL +eval UPDATE t1,t2 SET t1.data="Hello", t2.data=CONCAT($new_data,$new_data,$new_data,$new_data,$new_data); +--enable_query_log + +--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) +--echo # Validating update was not binlogged.. +if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") != 0`) +{ + --die Binlog GTID position should have been unchanged after failed update +} +--echo # ..success + +--echo # Validating non-transactional part of update saved.. +if(`SELECT COUNT(*)!=1 from t1 where data="Hello"`) +{ + --die Non-transactional part of update should have saved +} +--echo # ..success + +--echo # Validating transactional part of update was rolled back.. +if(`SELECT COUNT(*) from t2 where data LIKE "b%"`) +{ + --die Transactional part of update should have been rolled back +} +--echo # ..success +--source include/save_master_gtid.inc + +--connection slave + +# Incident event +# 1590=ER_SLAVE_INCIDENT +--let $slave_sql_errno= 1590 +--source include/wait_for_slave_sql_error_and_skip.inc + +--echo # Validating the rolled-back multi-engine update did not replicate to slave at all.. +if(`SELECT COUNT(*) from t1 where data="Hello"`) +{ + --die Non-transactional part of update should not have replicated +} +if(`SELECT COUNT(*) from t2 where data LIKE "b%"`) +{ + --die Transactional part of update should not have replicated +} +--echo # ..success + +--connection master + +--echo "****** Clean up *******" --replace_result $old_max_binlog_cache_size ORIGINAL_VALUE --eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size --replace_result $old_binlog_cache_size ORIGINAL_VALUE @@ -48,6 +198,346 @@ connection master; --replace_result $old_binlog_stmt_cache_size ORIGINAL_VALUE --eval SET GLOBAL binlog_stmt_cache_size= $old_binlog_stmt_cache_size -DROP TABLE t1; +DROP TABLE t1,t2; + +--echo "*********** TABLE MAP Event write failure **************" + +--let $debug_save= `SELECT @@GLOBAL.debug_dbug` +CREATE TABLE tm (f INT) ENGINE=MYISAM; +CREATE TABLE ti (f INT) ENGINE=INNODB; +INSERT INTO tm VALUES (10); +INSERT INTO ti VALUES (20); +--sync_slave_with_master + +--echo "#######################################################################" +--echo "# Test Case4: Table_map event write failure for trans engine UPDATE #" +--echo "#######################################################################" +--echo # Transaction should be rolled back without writing incident event +--connection master +--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) +SET debug_dbug="+d,table_map_write_error"; +--error ER_TRANS_CACHE_FULL +UPDATE ti, tm set ti.f=30; + +--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) +--echo # Validating update was not binlogged.. +if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") != 0`) +{ + --die Binlog GTID position should have been unchanged after failed update +} +--echo # ..success + +--echo # Validating update was rolled back from storage engines.. +if(`SELECT COUNT(*) FROM ti WHERE f=130`) +{ + --die Update for InnoDB table should not have saved +} +--echo # ..success + +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc + +--echo "#######################################################################" +--echo "# Test Case5: Table_map event write failure for mixed engine UPDATE #" +--echo "#######################################################################" +--connection master +--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) +--echo # In case of mixed engines if non trans table is updated write INCIDENT event +--error ER_TRANS_CACHE_FULL +UPDATE ti,tm SET tm.f=88, ti.f=120; + +--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) +--echo # Validating update was not binlogged.. +if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") != 0`) +{ + --die Binlog GTID position should have been unchanged after failed update +} +--echo # ..success + +--echo # Validating that only the non-transactional update saved on master.. +if(`SELECT COUNT(*)!=1 FROM tm WHERE f=88`) +{ + --die Update for MyISAM table should have saved +} +if(`SELECT COUNT(*) FROM ti WHERE f=120`) +{ + --die Update for InnoDB table should not have saved +} +--echo # ..success + + +--connection slave +# Incident event +# 1590=ER_SLAVE_INCIDENT +--let $slave_sql_errno= 1590 +--source include/wait_for_slave_sql_error_and_skip.inc + +--echo # Validating that neither of the updates replicated to slave.. +if(`SELECT COUNT(*) FROM tm WHERE f=88`) +{ + --die Update for MyISAM table should not have replicated to slave +} +if(`SELECT COUNT(*) FROM ti WHERE f=120`) +{ + --die Update for InnoDB table should not have replicated to slave +} +--echo # ..success + +--echo "#######################################################################" +--echo "# Test Case6: Committing a transaction consisting of two updates: +--echo "# S1) Update transactional table +--echo "# S2) Update transactional table +--echo "# with a table_map event write failure on the second event should +--echo "# roll-back only the second update without incident +--echo "#######################################################################" +--connection master +--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) + +SET debug_dbug=""; +BEGIN; +# successful update +UPDATE ti, tm set ti.f=40; +SET debug_dbug="+d,table_map_write_error"; +--error ER_TRANS_CACHE_FULL +UPDATE ti, tm set ti.f=50; +COMMIT; + +--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) +--echo # Validating binlog GTID position progressed from first update.. +if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") = 0`) +{ + --die Binlog GTID position should have updated +} +--echo # ..success + +--echo # Validating the first update saved.. +if(`SELECT COUNT(*)!=1 FROM ti WHERE f=40`) +{ + --die The first update should have saved because it was transactional +} +--echo # ..and that the second update did not save.. +if(`SELECT COUNT(*) FROM ti WHERE f=50`) +{ + --die The second update should have rolled back because it failed +} +--echo # ..success + +--echo # Validating that only the first update replicated to slave without incident +--connection master +--source include/save_master_gtid.inc +--connection slave +--source include/sync_with_master_gtid.inc +--let $diff_tables= master:test.ti,slave:test.ti +--source include/diff_tables.inc + + +--echo "#######################################################################" +--echo "# Test Case7: Rolling back a transaction consisting of two updates: +--echo "# S1) Update transactional table +--echo "# S2) Update transactional table +--echo "# with a table_map event write failure on the second event should +--echo "# roll-back both updates without incident +--echo "#######################################################################" +--connection master +--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) + +SET debug_dbug=""; +BEGIN; +# successful update +UPDATE ti, tm set ti.f=60; +SET debug_dbug="+d,table_map_write_error"; +--error ER_TRANS_CACHE_FULL +UPDATE ti, tm set ti.f=70; +ROLLBACK; + +--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) +--echo # Validating update was not binlogged.. +if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") != 0`) +{ + --die Binlog GTID position should have been unchanged after failed update +} +--echo # ..success + +--echo # Validating that neither update saved on master.. +if(`SELECT COUNT(*) FROM ti WHERE f=60`) +{ + --die The first update should not have saved +} +if(`SELECT COUNT(*) FROM ti WHERE f=70`) +{ + --die The second update should not have saved +} +--echo # ..success + +--echo # Validating the transaction did not replicate to the slave +--connection master +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc +--let $diff_tables= master:test.ti,slave:test.ti +--source include/diff_tables.inc + + +--echo "#######################################################################" +--echo "# Test Case8: Committing a transaction consisting of two updates: +--echo "# S1) Update transactional table +--echo "# S2) Update mixed trans/non-trans tables +--echo "# with a table_map event write failure on the second event should +--echo "# roll-back only the second update with incident +--echo "#######################################################################" +--connection master +--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) + +BEGIN; +# successful update +SET debug_dbug=""; +UPDATE ti, tm set ti.f=80; +SET debug_dbug="+d,table_map_write_error"; +--error ER_TRANS_CACHE_FULL +UPDATE ti, tm set ti.f=90,tm.f=99; +COMMIT; + +--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) +--echo # Validating binlog GTID position progressed from first update.. +if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") = 0`) +{ + --die Binlog GTID position should have updated +} +--echo # ..success + +--echo # Validating the first update saved.. +if(`SELECT COUNT(*)!=1 FROM ti WHERE f=80`) +{ + --die The first update should have saved because it was transactional +} +--echo # ..and the transactional part of the second update did not save.. +if(`SELECT COUNT(*) FROM ti WHERE f=90`) +{ + --die The transactional part of the second update should have rolled back because it failed +} +--echo # ..whereas the non-trans part of the second update did save.. +if(`SELECT COUNT(*)!=1 FROM tm WHERE f=99`) +{ + --die The non-trans part from the second update should have saved +} +--echo # ..success + +--echo # Validating that the incident propagated to the slave +--connection slave +# Incident event +# 1590=ER_SLAVE_INCIDENT +--let $slave_sql_errno= 1590 +--source include/wait_for_slave_sql_error_and_skip.inc + +--echo # Validating that the first update replicated to the slave.. +if(`SELECT COUNT(*)!=1 FROM ti WHERE f=80`) +{ + --die The first update should have replicated because it was transactional +} +--echo # ..and neither part of the second update replicated.. +if(`SELECT COUNT(*) FROM ti WHERE f=90`) +{ + --die The trans part from the second update should not have replicated because it was rolled back +} +if(`SELECT COUNT(*) FROM tm WHERE f=99`) +{ + --die The non-trans part from the second update should not have replicated because it was not binlogged +} +--echo # ..success + + +--echo "#######################################################################" +--echo "# Test Case9: Rolling back a transaction consisting of two updates: +--echo "# S1) Update transactional table +--echo "# S2) Update mixed trans/non-trans tables +--echo "# with a table_map event write failure on the second event should +--echo "# roll-back both transactional updates, preserve the non-transactional +--echo "# update on the master (only), and write an incident event +--echo "#######################################################################" +--connection master +--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) + +SET debug_dbug=""; +BEGIN; +# successful update +UPDATE ti, tm set ti.f=100; +SET debug_dbug="+d,table_map_write_error"; +--error ER_TRANS_CACHE_FULL +UPDATE ti, tm set ti.f=110,tm.f=111; +ROLLBACK; + +--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1) +--echo # Validating update was not binlogged.. +if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") != 0`) +{ + --die Binlog GTID position should have been unchanged after failed update +} +--echo # ..success + +--echo # Validating trans updates rollback, but the non-trans update stays.. +if(`SELECT COUNT(*) FROM ti WHERE f=100`) +{ + --die The first update should not have saved +} +if(`SELECT COUNT(*) FROM ti WHERE f=110`) +{ + --die The transactional part of the second update should not have saved +} +if(`SELECT COUNT(*)!=1 FROM tm WHERE f=111`) +{ + --die The non-trans part of the second update should have saved +} +--echo # ..success + +--echo # Validating that the incident propagated to the slave +--connection slave +# Incident event +# 1590=ER_SLAVE_INCIDENT +--let $slave_sql_errno= 1590 +--source include/wait_for_slave_sql_error_and_skip.inc + +--echo # Validating that none of the updates replicated to the slave +--let $diff_tables= master:test.ti,slave:test.ti +--source include/diff_tables.inc +if(`SELECT COUNT(*) FROM tm WHERE f=111`) +{ + --die The non-trans part from the second update should not have replicated because it was not binlogged +} +--echo # ..success + + +--echo "#######################################################################" +--echo "# Test Case10: If an incident event fails to write, a specific error +--echo "# should be logged +--echo "# +--echo "# Note: This test case is the same as test case 5, with the caveat of +--echo "# the incident event failing to write. +--echo "#######################################################################" + +--connection master +SET debug_dbug="d,table_map_write_error,incident_event_write_error"; +--error ER_TRANS_CACHE_FULL +UPDATE ti, tm set ti.f=120, tm.f=122; + +--echo # Validate error message indicating incident event failed to write +let $log_error_= `SELECT @@GLOBAL.log_error`; +if(!$log_error_) +{ + # MySQL Server on windows is started with --console and thus + # does not know the location of its .err log, use default location + let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err; +} +--let SEARCH_PATTERN= Incident event write to the binary log file failed +--let SEARCH_FILE= $log_error_ +--source include/search_pattern_in_file.inc + + +--connection master +--echo "******** Clean Up **********" +--eval SET GLOBAL debug_dbug = '$debug_save' +DROP TABLE tm,ti; --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mdev12179.test b/mysql-test/suite/rpl/t/rpl_mdev12179.test index 2afcbf7b1e142..aa0d05211fff5 100644 --- a/mysql-test/suite/rpl/t/rpl_mdev12179.test +++ b/mysql-test/suite/rpl/t/rpl_mdev12179.test @@ -1,3 +1,4 @@ +--source include/no_valgrind_without_big.inc --source include/have_innodb.inc --let $rpl_topology=1->2 --source include/rpl_init.inc diff --git a/mysql-test/suite/rpl/t/rpl_mdev382.test b/mysql-test/suite/rpl/t/rpl_mdev382.test index 093b7b924139f..84e3c84982ddb 100644 --- a/mysql-test/suite/rpl/t/rpl_mdev382.test +++ b/mysql-test/suite/rpl/t/rpl_mdev382.test @@ -1,7 +1,7 @@ +--source include/not_windows.inc #unix shell escaping used for mysqlbinlog --source include/have_innodb.inc --source include/have_binlog_format_statement.inc --source include/master-slave.inc ---source include/not_windows.inc #unix shell escaping used for mysqlbinlog # MDEV-382: multiple SQL injections in replication code. diff --git a/mysql-test/suite/rpl/t/rpl_mdev_17614.test b/mysql-test/suite/rpl/t/rpl_mdev_17614.test index 9b86c8c15b562..c11aad3305ee4 100644 --- a/mysql-test/suite/rpl/t/rpl_mdev_17614.test +++ b/mysql-test/suite/rpl/t/rpl_mdev_17614.test @@ -2,15 +2,22 @@ source include/have_debug.inc; source include/have_innodb.inc; -- source include/have_binlog_format_statement.inc source include/master-slave.inc; -# MDEV-17614 -# INSERT on dup key update is replication unsafe -# There can be three case -# 1. 2 unique key, Replication is unsafe. -# 2. 2 unique key , with one auto increment key, Safe to replicate because Innodb will acquire gap lock -# 3. n no of unique keys (n>1) but insert is only in 1 unique key -# 4. 2 unique key , with one auto increment key(but user gives auto inc value), unsafe to replicate +# MDEV-17614 INSERT on dup key update is replication unsafe +# +# The following cases are tested below: +# 1. 2 unique key, replication is UNSAFE +# 2. 2 unique key, with one auto increment key and implicit value to it. +# It is UNSAFE because autoinc column values of being inserted records +# are revealed dynamically, so unknown at the binlog-format decision time +# and hence this pessimistic expectation +# 3. 2 unique keys +# A. insert is only in 1 unique key, still all colums are specified => UNSAFE +# B. both unique keys are specified => UNSAFE +# C. only one unique key is specified => SAFE (motivated by MDEV-28310) +# 4. 2 unique key, with one auto increment key(but user gives auto inc value) => +# UNSAFE to replicate -# Case 1 +--echo # Case 1: UNSAFE call mtr.add_suppression("Unsafe statement written to the binary log using statement format"); CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY , b INT, UNIQUE(b), c int) engine=innodb; @@ -42,7 +49,8 @@ drop table t1; connection slave; start slave; --source include/wait_for_slave_to_start.inc -# Case 2 + +--echo # Case 2: UNSAFE --connection master CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY auto_increment, b INT, UNIQUE(b), c int) engine=innodb; @@ -64,7 +72,7 @@ connection master; drop table t1; --sync_slave_with_master -# Case 3 +--echo # Case 3A: UNSAFE --connection master CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, UNIQUE(b), c int, d int ) engine=innodb; @@ -85,7 +93,50 @@ connection master; drop table t1; --sync_slave_with_master -# Case 4 +--echo # Case 3B: UNSAFE - all column specified. +--connection master +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, +UNIQUE(b), c int, d int ) engine=innodb; +sync_slave_with_master; +connection master; +INSERT INTO t1 VALUES (1, 1, 1, 1); +BEGIN; +INSERT INTO t1 VALUES (2, NULL, 2, 2) ON DUPLICATE KEY UPDATE c=VALUES(c); + --connection master1 + INSERT INTO t1 VALUES(3, NULL, 2, 3) ON DUPLICATE KEY UPDATE c=VALUES(c); +--connection master +COMMIT; +SELECT * FROM t1; +--sync_slave_with_master +--echo #same data as master +SELECT * FROM t1; +connection master; +drop table t1; +--sync_slave_with_master + + +--echo # Case 3C: SAFE - only one unique key (PK) specified. +--connection master +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, +UNIQUE(b), c int, d int ) engine=innodb; +sync_slave_with_master; +connection master; +INSERT INTO t1 VALUES (1, 1, 1, 1); +BEGIN; +INSERT INTO t1 (`a`, `c`, `d`) VALUES (2, 2, 2) ON DUPLICATE KEY UPDATE c=99; + --connection master1 + INSERT INTO t1 (`a`, `c`, `d`) VALUES(3, 2, 3) ON DUPLICATE KEY UPDATE c=100; +--connection master +COMMIT; +SELECT * FROM t1; +--sync_slave_with_master +--echo #same data as master +SELECT * FROM t1; +connection master; +drop table t1; +--sync_slave_with_master + +--echo # Case 4: UNSAFE --connection master CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY auto_increment, b INT, UNIQUE(b), c int) engine=innodb; diff --git a/mysql-test/suite/rpl/t/rpl_mysql_manager_race_condition-slave.opt b/mysql-test/suite/rpl/t/rpl_mysql_manager_race_condition-slave.opt new file mode 100644 index 0000000000000..d127ef6204334 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_mysql_manager_race_condition-slave.opt @@ -0,0 +1 @@ +--gtid-cleanup-batch-size=1 diff --git a/mysql-test/suite/rpl/t/rpl_mysql_manager_race_condition.test b/mysql-test/suite/rpl/t/rpl_mysql_manager_race_condition.test new file mode 100644 index 0000000000000..751da3158b772 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_mysql_manager_race_condition.test @@ -0,0 +1,67 @@ +# +# Purpose: +# This test ensures that, during mysqld initialization, the mysql handle +# manager starts before the binlog background thread. This is because the +# binlog background thread uses the mysql handle manager, and if the background +# thread tries to submit a job to the handle manager before it is +# initialized/started, mysqld can crash (the actual behavior is undefined). +# This race condition lead to the problem described in MDEV-26473. +# +# Methodology: +# This test ensures that the binlog background thread cannot be started +# before the mysql manager is started. Specifically, it forces a path in +# the binlog background thread to call mysql_manager_submit() by reducing +# --gtid-cleanup-batch-size to be 1 (which submits a job to delete unused rows +# from the mysql.gtid_slave_pos* tables). With this path forced, the main +# mysqld thread is suspended just before its handle manager initialization to +# allow time for the binlog thread to call mysql_manager_submit. The fix +# associated with this test should enforce that the binlog background thread is +# not created before the handle manager is initialized. +# +# References: +# MDEV-26473 mysqld got exception 0xc0000005 (rpl_slave_state/rpl_load_gtid_slave_state) +# + +--source include/have_debug.inc +--source include/master-slave.inc + +# The race condition discovered from MDEV-26473 is binlog format independent. +# We use ROW format though because it was used by the reporter. +--source include/have_binlog_format_row.inc + +--connection master + +--echo # Create a GTID event so the binlog background thread will submit a +--echo # mysql handler job the next time mysqld is restarted. +create table t1 (a int); +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc + +--echo # Set a debug point that forces the main mysqld thread to sleep before +--echo # anything is initialized for the mysql handle manager +--let $rpl_server_parameters=--debug_dbug="+d,delay_start_handle_manager" + + +--echo # Restart the slave mysqld instance so it re-initializes with the +--echo # binlog background thread submitting a mysql handler job and the +--echo # mysql handler initialization suspending for a second. Without the fix +--echo # associated with this test/patch, the following restart will error +--echo # with a failed assertion. +--source include/rpl_restart_server.inc +--source include/start_slave.inc + + +--echo # +--echo # Cleanup +--echo # + +--connection master +drop table t1; +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_old_master_29078-master.opt b/mysql-test/suite/rpl/t/rpl_old_master_29078-master.opt new file mode 100644 index 0000000000000..3efc6fb8e2904 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_old_master_29078-master.opt @@ -0,0 +1 @@ +--version=10.5.99 diff --git a/mysql-test/suite/rpl/t/rpl_old_master_29078.test b/mysql-test/suite/rpl/t/rpl_old_master_29078.test new file mode 100644 index 0000000000000..b19fd6466e558 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_old_master_29078.test @@ -0,0 +1,49 @@ +--echo # +--echo # MDEV-29078 For old binary logs explicit_defaults_for_timestamp presumed to be OFF, server value ignored +--echo # + +--source include/have_binlog_format_mixed.inc +--source include/master-slave.inc + +--connection slave +--source include/stop_slave.inc + +--connection master +--let $datadir= `SELECT @@datadir` + +flush binary logs; +create table t2 (a timestamp); + +--save_master_pos + +--remove_file $datadir/master-bin.000001 +--copy_file $MYSQL_TEST_DIR/std_data/mdev29078-mysql-bin.000001 $datadir/master-bin.000001 + +--exec $MYSQL_BINLOG --short-form $datadir/master-bin.000001 + +--connection slave + +set global explicit_defaults_for_timestamp=1; +reset slave; +--source include/start_slave.inc +--sync_with_master +show create table t1; +show create table t2; +set time_zone='+2:00'; +select * from t1; +drop table t1; +--source include/stop_slave.inc + +set global explicit_defaults_for_timestamp=0; +reset slave; +--source include/start_slave.inc +--sync_with_master +show create table t1; +show create table t2; +select * from t1; +drop table t1; + +--connection master +drop table t2; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_packet.test b/mysql-test/suite/rpl/t/rpl_packet.test index 1bf99c2366b65..cbde486bcbbda 100644 --- a/mysql-test/suite/rpl/t/rpl_packet.test +++ b/mysql-test/suite/rpl/t/rpl_packet.test @@ -1 +1,184 @@ ---source include/rpl_packet.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# ==== Purpose ==== +# +# Check replication protocol packet size handling +# +# ==== Related bugs ==== +# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave +# BUG#23755: Replicated event larger that max_allowed_packet infinitely re-transmits +# BUG#42914: No LAST_IO_ERROR for max_allowed_packet errors +# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET + +# max-out size db name +source include/have_binlog_format_row.inc; +source include/master-slave.inc; + +call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, .*error.* 1153"); +call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet"); +let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________; +disable_warnings; +eval drop database if exists $db; +enable_warnings; +eval create database $db; + +connection master; +let $old_max_allowed_packet= `SELECT @@global.max_allowed_packet`; +let $old_net_buffer_length= `SELECT @@global.net_buffer_length`; +let $old_slave_max_allowed_packet= `SELECT @@global.slave_max_allowed_packet`; +SET @@global.max_allowed_packet=1024; +SET @@global.net_buffer_length=1024; + +sync_slave_with_master; +# Restart slave for setting to take effect +source include/stop_slave.inc; +source include/start_slave.inc; + +# Reconnect to master for new setting to take effect +disconnect master; + +# alas, can't use eval here; if db name changed apply the change here +connect (master,localhost,root,,DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________); + +connection master; +select @@net_buffer_length, @@max_allowed_packet; + +create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM; + +INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023'); +sync_slave_with_master; + +eval select count(*) from `$db`.`t1` /* must be 1 */; + +SHOW STATUS LIKE 'Slave_running'; +select * from information_schema.session_status where variable_name= 'SLAVE_RUNNING'; +connection master; +eval drop database $db; +sync_slave_with_master; + +# +# Bug #23755: Replicated event larger that max_allowed_packet infinitely re-transmits +# +# Check that a situation when the size of event on the master is greater than +# max_allowed_packet on the slave does not lead to infinite re-transmits. + +connection master; + +# Change the max packet size on master + +SET @@global.max_allowed_packet=4096; +SET @@global.net_buffer_length=4096; + +# Restart slave for new setting to take effect +connection slave; +source include/stop_slave.inc; +source include/start_slave.inc; + +# Reconnect to master for new setting to take effect +disconnect master; +connect (master, localhost, root); +connection master; + +CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM; + +sync_slave_with_master; + +connection master; + +INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048'); + + +# +# Bug#42914: The slave I/O thread must stop after trying to read the above +# event, However there is no Last_IO_Error report. +# + +# The slave I/O thread must stop after trying to read the above event +connection slave; +# 1153 = ER_NET_PACKET_TOO_LARGE +--let $slave_io_errno= 1153 +--let $show_slave_io_error= 1 +--source include/wait_for_slave_io_error.inc + +# TODO: this is needed because of BUG#55790. Remove once that is fixed. +--source include/stop_slave_sql.inc + +# +# Bug#42914: On the master, if a binary log event is larger than +# max_allowed_packet, the error message ER_MASTER_FATAL_ERROR_READING_BINLOG +# is sent to a slave when it requests a dump from the master, thus leading the +# I/O thread to stop. However, there is no Last_IO_Error reported. +# + +--let $rpl_only_running_threads= 1 +--source include/rpl_reset.inc +--connection master +DROP TABLE t1; +--sync_slave_with_master + + +connection master; +CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM; +sync_slave_with_master; + +connection master; +INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet)); + +connection slave; +# The slave I/O thread must stop after receiving +# 1153 = ER_NET_PACKET_TOO_LARGE +--let $slave_io_errno= 1153 +--let $show_slave_io_error= 1 +--source include/wait_for_slave_io_error.inc + +# Remove the bad binlog and clear error status on slave. +STOP SLAVE; +RESET SLAVE; +--connection master +RESET MASTER; + + +# +# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET +# +# In BUG#55322, @@session.max_allowed_packet increased each time SHOW +# BINLOG EVENTS was issued. To verify that this bug is fixed, we +# execute SHOW BINLOG EVENTS twice and check that max_allowed_packet +# never changes. We turn off the result log because we don't care +# about the contents of the binlog. + +--disable_result_log +SET @max_allowed_packet_0= @@session.max_allowed_packet; +SHOW BINLOG EVENTS; +SET @max_allowed_packet_1= @@session.max_allowed_packet; +SHOW BINLOG EVENTS; +SET @max_allowed_packet_2= @@session.max_allowed_packet; +--enable_result_log +if (`SELECT NOT(@max_allowed_packet_0 = @max_allowed_packet_1 AND @max_allowed_packet_1 = @max_allowed_packet_2)`) +{ + --echo ERROR: max_allowed_packet changed after executing SHOW BINLOG EVENTS + --source include/show_rpl_debug_info.inc + SELECT @max_allowed_packet_0, @max_allowed_packet_1, @max_allowed_packet_2; + --die @max_allowed_packet changed after executing SHOW BINLOG EVENTS +} + + +--echo ==== clean up ==== +connection master; +DROP TABLE t1; +eval SET @@global.max_allowed_packet= $old_max_allowed_packet; +eval SET @@global.net_buffer_length= $old_net_buffer_length; +eval SET @@global.slave_max_allowed_packet= $old_slave_max_allowed_packet; +# slave is stopped +connection slave; +DROP TABLE t1; + +# Clear Last_IO_Error +RESET SLAVE; + +--source include/rpl_end.inc +# End of tests diff --git a/mysql-test/suite/rpl/t/rpl_parallel_29322.test b/mysql-test/suite/rpl/t/rpl_parallel_29322.test new file mode 100644 index 0000000000000..675960592f8b3 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_parallel_29322.test @@ -0,0 +1,64 @@ +--echo # +--echo # MDEV-29322 ASAN use-after-free options_written_to_bin_log +--echo # + +# The tests verify that at query execution slave parallel workers successfully +# find a correct options_written_to_bin_log value associated with the query. +# There are three test branches, A and B take care of different server version +# binlogs. The homogeneous binlog case of C. branch is also for how-to-reproduce +# the bug, may need few --repeat :s though. + +--source include/have_binlog_format_mixed.inc +--source include/master-slave.inc + +--echo # A. set the master and slave explicit_defaults_for_timestamp values crisscross to (1,0) +--let $same_version_binlogs=0 + +--connection master +# Configure master and slave with different values of the following variable: +set @sav.explicit_defaults_for_timestamp = @@session.explicit_defaults_for_timestamp; +set @@session.explicit_defaults_for_timestamp = 1; +--connection slave +# slave must produce the master version of the table definition and its data +set @sav.explicit_defaults_for_timestamp = @@global.explicit_defaults_for_timestamp; +set global explicit_defaults_for_timestamp = 0; +# the global var gets changed in the included file +set @sav.slave_parallel_workers = @@global.slave_parallel_workers; +--source include/stop_slave.inc +set @@global.slave_parallel_workers = 1; +--source include/start_slave.inc + +--source suite/rpl/include/rpl_parallel_29322.inc + +--echo # B. alternate the master and slave vars' values to (0,1) + +--connection master +# Configure master and slave with different values of the following variable: +set @@session.explicit_defaults_for_timestamp = 0; +--connection slave +# slave must produce the master version of the table definition and its data +set @@global.explicit_defaults_for_timestamp = 1; + +--source suite/rpl/include/rpl_parallel_29322.inc + + +--echo # C. the bug case on the same version binlogs also to demo on the patch's base +--let $same_version_binlogs=1 +# with more workers the bug shows more likeky on the patch's base slave. +--source include/stop_slave.inc +set @@global.slave_parallel_workers = 4; +--source include/start_slave.inc + +--source suite/rpl/include/rpl_parallel_29322.inc + +# cleanup +--connection master +set @@session.explicit_defaults_for_timestamp = @sav.explicit_defaults_for_timestamp; +--connection slave +set @@global.explicit_defaults_for_timestamp = @sav.explicit_defaults_for_timestamp; +--source include/stop_slave.inc +set @@global.slave_parallel_workers = @sav.slave_parallel_workers; +--source include/start_slave.inc + + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_analyze.test b/mysql-test/suite/rpl/t/rpl_parallel_analyze.test new file mode 100644 index 0000000000000..921c6f02904d4 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_parallel_analyze.test @@ -0,0 +1,84 @@ +# The test file is created to prove fixes to +# MDEV-30323 Some DDLs like ANALYZE can complete on parallel slave out of order +# Debug-sync tests aiming at parallel replication of ADMIN commands +# are welcome here. + +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--echo # Initialize +--connection slave +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; + +--echo # Setup data +--connection master +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE ta (a int); +--let $pre_load_gtid=`SELECT @@last_gtid` +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc + +--source suite/rpl/include/create_or_drop_sync_func.inc + +# configure MDEV-30323 slave +--source include/stop_slave.inc +SET @old_parallel_threads =@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode =@@GLOBAL.slave_parallel_mode; +SET @old_gtid_strict_mode =@@GLOBAL.gtid_strict_mode; +SET GLOBAL slave_parallel_threads=10; +SET GLOBAL slave_parallel_mode=conservative; +SET GLOBAL gtid_strict_mode=ON; +--source include/start_slave.inc + +# MDEV-30323 setup needs two group of events the first of which is a DML +# and ANALYZE is the 2nd. +# The latter is made to race in slave execution over the DML thanks +# to a DML latency simulation. +# In the fixed case the race-over should not be a problem: ultimately +# ANALYZE must wait for its turn to update slave@@global.gtid_binlog_pos. +# Otherwise the reported OOO error must be issued. + +--connection master +SET @old_format= @@SESSION.binlog_format; +SET binlog_format=statement; +INSERT INTO t1 VALUES (foo(1, 'rpl_parallel_after_mark_start_commit WAIT_FOR sig_go', '')); + +ANALYZE TABLE ta; +--source include/save_master_gtid.inc + +--connection slave +--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit" +--source include/wait_condition.inc + +SELECT info FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit"; +if (`select strcmp(@@global.gtid_binlog_pos, '$pre_load_gtid') <> 0 or strcmp(@@global.gtid_slave_pos, '$pre_load_gtid') <> 0`) +{ + --let $bs=`SELECT @@global.gtid_binlog_pos` + --let $es=`SELECT @@global.gtid_slave_pos` + --echo Mismatch between expected $pre_load_gtid state and the actual binlog state " @@global.gtid_binlog_pos = $bs or/and slave execution state @@global.gtid_slave_pos = $es. + --die +} + +set @@debug_sync="now signal sig_go"; +--source include/sync_with_master_gtid.inc + +--echo # Cleanup +--connection master +DROP TABLE t1,ta; +--let $create_or_drop=drop +--source suite/rpl/include/create_or_drop_sync_func.inc + +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +SET @@GLOBAL.slave_parallel_threads=@old_parallel_threads; +SET @@GLOBAL.slave_parallel_mode =@old_parallel_mode; +SET @@GLOBAL.gtid_strict_mode =@old_gtid_strict_mode; +--source include/start_slave.inc + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_analyze_table_hang.test b/mysql-test/suite/rpl/t/rpl_parallel_analyze_table_hang.test index c1f1b9bac43b4..62a7501c36b19 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_analyze_table_hang.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_analyze_table_hang.test @@ -1 +1,73 @@ ---source include/rpl_parallel_analyze_table_hang.inc +--echo *** MDEV-7888: ANALYZE TABLE does wakeup_subsequent_commits(), causing wrong binlog order and parallel replication hang *** +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_mode='conservative'; +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep'; + +--connection server_1 +# Inject two group commits. The bug was that ANALYZE TABLE would call +# wakeup_subsequent_commits() too early, allowing the following transaction +# in the same group to run ahead and binlog and free the GCO. Then we get +# wrong binlog order and later access freed GCO, which causes lost wakeup +# of following GCO and thus replication hang. +# We injected a small sleep in ANALYZE to make the race easier to hit (this +# can only cause false negatives in versions with the bug, not false positives, +# so sleep is ok here. And it's in general not possible to trigger reliably +# the race with debug_sync, since the bugfix makes the race impossible). + +SET @old_dbug= @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,binlog_force_commit_id"; + +# Group commit with cid=10000, two event groups. +SET @commit_id= 10000; +ANALYZE TABLE t2; +INSERT INTO t3 VALUES (120, 0); + +# Group commit with cid=10001, one event group. +SET @commit_id= 10001; +INSERT INTO t3 VALUES (121, 0); + +SET SESSION debug_dbug=@old_dbug; + +SELECT * FROM t3 WHERE a >= 120 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +SELECT * FROM t3 WHERE a >= 120 ORDER BY a; + +# Clean up. +--source include/stop_slave.inc +SET GLOBAL debug_dbug= @old_dbug; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t2,t3; + +--source include/rpl_end.inc + diff --git a/mysql-test/suite/rpl/t/rpl_parallel_deadlock_corrupt_binlog.test b/mysql-test/suite/rpl/t/rpl_parallel_deadlock_corrupt_binlog.test index 9ee06f5985824..592ffd3b068a9 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_deadlock_corrupt_binlog.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_deadlock_corrupt_binlog.test @@ -1 +1,80 @@ ---source include/rpl_parallel_deadlock_corrupt_binlog.inc +--echo *** MDEV-7335: Potential parallel slave deadlock with specific binlog corruption *** +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection server_2 +--source include/stop_slave.inc +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=1; +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000"; +CALL mtr.add_suppression("Unexpected break of being relay-logged GTID"); + +--connection server_1 +INSERT INTO t2 VALUES (101); +INSERT INTO t2 VALUES (102); +INSERT INTO t2 VALUES (103); +INSERT INTO t2 VALUES (104); +INSERT INTO t2 VALUES (105); +# Inject a partial event group (missing XID at the end). The bug was that such +# partial group was not handled appropriately, leading to server deadlock. +SET gtid_seq_no=1000; +INSERT INTO t2 VALUES (106); +INSERT INTO t2 VALUES (107); +INSERT INTO t2 VALUES (108); +INSERT INTO t2 VALUES (109); +INSERT INTO t2 VALUES (110); +INSERT INTO t2 VALUES (111); +INSERT INTO t2 VALUES (112); +INSERT INTO t2 VALUES (113); +INSERT INTO t2 VALUES (114); +INSERT INTO t2 VALUES (115); +INSERT INTO t2 VALUES (116); +INSERT INTO t2 VALUES (117); +INSERT INTO t2 VALUES (118); +INSERT INTO t2 VALUES (119); +INSERT INTO t2 VALUES (120); +INSERT INTO t2 VALUES (121); +INSERT INTO t2 VALUES (122); +INSERT INTO t2 VALUES (123); +INSERT INTO t2 VALUES (124); +INSERT INTO t2 VALUES (125); +INSERT INTO t2 VALUES (126); +INSERT INTO t2 VALUES (127); +INSERT INTO t2 VALUES (128); +INSERT INTO t2 VALUES (129); +INSERT INTO t2 VALUES (130); +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc +# The partial event group (a=106) should be rolled back and thus missing. +SELECT * FROM t2 WHERE a >= 100 ORDER BY a; + +# Cleanup +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +DROP TABLE t2; +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_domain.test b/mysql-test/suite/rpl/t/rpl_parallel_domain.test index f5864380f02c9..eda08cc29168b 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_domain.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_domain.test @@ -1 +1,87 @@ ---source include/rpl_parallel_domain.inc +# Test should work with both conservative and optimistic modes + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +# Test various aspects of parallel replication. + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--error ER_SLAVE_MUST_STOP +SET GLOBAL slave_parallel_threads=10; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; + +# Check that we do not spawn any worker threads when no slave is running. +SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; + +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +# Check that worker threads get spawned when slave starts. +SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; +# ... and that worker threads get removed when slave stops. +--source include/stop_slave.inc +SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; +--source include/start_slave.inc +SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; + +--echo *** Test long-running query in domain 1 can run in parallel with short queries in domain 0 *** + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); +--save_master_pos + +--connection server_2 +--sync_with_master + +# Block the table t1 to simulate a replicated query taking a long time. +--connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +LOCK TABLE t1 WRITE; + +--connection server_1 +SET gtid_domain_id=1; +# This query will be blocked on the slave until UNLOCK TABLES. +INSERT INTO t1 VALUES (2); +SET gtid_domain_id=0; +# These t2 queries can be replicated in parallel with the prior t1 query, as +# they are in a separate replication domain. +INSERT INTO t2 VALUES (2); +INSERT INTO t2 VALUES (3); +BEGIN; +INSERT INTO t2 VALUES (4); +INSERT INTO t2 VALUES (5); +COMMIT; +INSERT INTO t2 VALUES (6); + +--connection server_2 +--let $wait_condition= SELECT COUNT(*) = 6 FROM t2 +--source include/wait_condition.inc + +SELECT * FROM t2 ORDER by a; + +--connection con_temp1 +SELECT * FROM t1; +UNLOCK TABLES; + +--connection server_2 +--let $wait_condition= SELECT COUNT(*) = 2 FROM t1 +--source include/wait_condition.inc + +SELECT * FROM t1 ORDER BY a; + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t1,t2; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_domain_slave_single_grp.test b/mysql-test/suite/rpl/t/rpl_parallel_domain_slave_single_grp.test index 5ddd2af323c94..856efd065dfc4 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_domain_slave_single_grp.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_domain_slave_single_grp.test @@ -1 +1,128 @@ ---source include/rpl_parallel_domain_slave_single_grp.inc +# Test is independent of slave_parallel_mode +--echo *** Test two transactions in different domains committed in opposite order on slave but in a single group commit. *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +# Test various aspects of parallel replication. + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc + +--connection server_1 +# Use a stored function to inject a debug_sync into the appropriate THD. +# The function does nothing on the master, and on the slave it injects the +# desired debug_sync action(s). +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +SET gtid_domain_id=1; +INSERT INTO t2 VALUES (foo(10, + 'commit_before_enqueue SIGNAL ready1 WAIT_FOR cont1', + 'commit_after_release_LOCK_prepare_ordered SIGNAL ready2')); + +--connection server_2 +FLUSH LOGS; +--source include/wait_for_binlog_checkpoint.inc +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; +SET @old_format=@@GLOBAL.binlog_format; +SET GLOBAL binlog_format=statement; +# We need to restart all parallel threads for the new global setting to +# be copied to the session-level values. +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + +# First make sure the first insert is ready to commit, but not queued yet. +SET debug_sync='now WAIT_FOR ready1'; + +--connection server_1 +SET gtid_domain_id=2; +INSERT INTO t2 VALUES (foo(11, + 'commit_before_enqueue SIGNAL ready3 WAIT_FOR cont3', + 'commit_after_release_LOCK_prepare_ordered SIGNAL ready4 WAIT_FOR cont4')); +SET gtid_domain_id=0; +SELECT * FROM t2 WHERE a >= 10 ORDER BY a; + +--connection server_2 +# Now wait for the second insert to queue itself as the leader, and then +# wait for more commits to queue up. +SET debug_sync='now WAIT_FOR ready3'; +SET debug_sync='now SIGNAL cont3'; +SET debug_sync='now WAIT_FOR ready4'; +# Now allow the first insert to queue up to participate in group commit. +SET debug_sync='now SIGNAL cont1'; +SET debug_sync='now WAIT_FOR ready2'; +# Finally allow the second insert to proceed and do the group commit. +SET debug_sync='now SIGNAL cont4'; + +--let $wait_condition= SELECT COUNT(*) = 2 FROM t2 WHERE a >= 10 +--source include/wait_condition.inc +SELECT * FROM t2 WHERE a >= 10 ORDER BY a; +# The two INSERT transactions should have been committed in opposite order, +# but in the same group commit (seen by precense of cid=# in the SHOW +# BINLOG output). +--let $binlog_file= slave-bin.000002 +--source include/show_binlog_events.inc +FLUSH LOGS; +--source include/wait_for_binlog_checkpoint.inc + + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; +SET GLOBAL binlog_format=@old_format; + +--connection server_1 +DROP function foo; +DROP TABLE t1,t2; +SET DEBUG_SYNC= 'RESET'; +SET GLOBAL binlog_format=@old_format; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_free_deferred_event.test b/mysql-test/suite/rpl/t/rpl_parallel_free_deferred_event.test index e2a41d0db7eb6..41f372eddf855 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_free_deferred_event.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_free_deferred_event.test @@ -1 +1,67 @@ ---source include/rpl_parallel_free_deferred_event.inc +--echo *** MDEV-5788 Incorrect free of rgi->deferred_events in parallel replication *** + +--source include/have_innodb.inc +--source include/master-slave.inc + +--connection server_2 +--source include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +# Use just two worker threads, so we are sure to get the rpl_group_info added +# to the free list, which is what triggered the bug. +--source include/stop_slave.inc +SET GLOBAL replicate_ignore_table="test.t3"; +SET GLOBAL slave_parallel_threads=2; +--source include/start_slave.inc + +--connection server_1 +INSERT INTO t3 VALUES (100, rand()); +INSERT INTO t3 VALUES (101, rand()); +--save_master_pos + +--connection server_2 +--sync_with_master + +--connection server_1 +INSERT INTO t3 VALUES (102, rand()); +INSERT INTO t3 VALUES (103, rand()); +INSERT INTO t3 VALUES (104, rand()); +INSERT INTO t3 VALUES (105, rand()); +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc +SET GLOBAL replicate_ignore_table=""; +--source include/start_slave.inc + +--connection server_1 +INSERT INTO t3 VALUES (106, rand()); +INSERT INTO t3 VALUES (107, rand()); +--save_master_pos + +--connection server_2 +--sync_with_master +--replace_column 2 # +SELECT * FROM t3 WHERE a >= 100 ORDER BY a; + + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t3; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test b/mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test index d9dc4dfd2937f..c5d2b85cf3439 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test @@ -1 +1,369 @@ ---source include/rpl_parallel_gco_wait_kill.inc +--echo *** Test killing thread that is waiting to start transaction until previous transaction commits *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode= @@GLOBAL.slave_parallel_mode; +--source include/stop_slave.inc +SET sql_log_bin=0; +CALL mtr.add_suppression("Query execution was interrupted"); +CALL mtr.add_suppression("Slave: Connection was killed"); +CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); +SET sql_log_bin=1; +SET GLOBAL slave_parallel_threads=10; +SET GLOBAL slave_parallel_mode= 'conservative'; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +--connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +# MDEV-515 takes X-lock on the table for the first insert. +# So concurrent insert won't happen on the table +INSERT INTO t3 VALUES(100, 100); +--save_master_pos + +--connection server_2 +--sync_with_master + +--connection server_1 +# Use a stored function to inject a debug_sync into the appropriate THD. +# The function does nothing on the master, and on the slave it injects the +# desired debug_sync action(s). +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_2 +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; +# We need to restart all parallel threads for the new global setting to +# be copied to the session-level values. +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=4; +--source include/start_slave.inc + + +# We set up four transactions T1, T2, T3, and T4 on the master. T2, T3, and T4 +# can run in parallel with each other (same group commit and commit id), +# but not in parallel with T1. +# +# We use four worker threads, each Ti will be queued on each their own +# worker thread. We will delay T1 commit, T3 will wait for T1 to begin +# commit before it can start. We will kill T3 during this wait, and +# check that everything works correctly. +# +# It is rather tricky to get the correct thread id of the worker to kill. +# We start by injecting four dummy transactions in a debug_sync-controlled +# manner to be able to get known thread ids for the workers in a pool with +# just 4 worker threads. Then we let in each of the real test transactions +# T1-T4 one at a time in a way which allows us to know which transaction +# ends up with which thread id. + +--connection server_1 +SET gtid_domain_id=2; +BEGIN; +# This debug_sync will linger on and be used to control T4 later. +INSERT INTO t3 VALUES (70, foo(70, + 'rpl_parallel_start_waiting_for_prior SIGNAL t4_waiting', '')); +INSERT INTO t3 VALUES (60, foo(60, + 'ha_write_row_end SIGNAL d2_query WAIT_FOR d2_cont2', + 'rpl_parallel_end_of_group SIGNAL d2_done WAIT_FOR d2_cont')); +COMMIT; +SET gtid_domain_id=0; + +--connection server_2 +SET debug_sync='now WAIT_FOR d2_query'; +--let $d2_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(60%' AND INFO NOT LIKE '%LIKE%'` + +--connection server_1 +SET gtid_domain_id=1; +BEGIN; +# These debug_sync's will linger on and be used to control T3 later. +INSERT INTO t3 VALUES (61, foo(61, + 'rpl_parallel_start_waiting_for_prior SIGNAL t3_waiting', + 'rpl_parallel_start_waiting_for_prior_killed SIGNAL t3_killed')); +INSERT INTO t3 VALUES (62, foo(62, + 'ha_write_row_end SIGNAL d1_query WAIT_FOR d1_cont2', + 'rpl_parallel_end_of_group SIGNAL d1_done WAIT_FOR d1_cont')); +COMMIT; +SET gtid_domain_id=0; + +--connection server_2 +SET debug_sync='now WAIT_FOR d1_query'; +--let $d1_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(62%' AND INFO NOT LIKE '%LIKE%'` + +--connection server_1 +SET gtid_domain_id=0; +INSERT INTO t3 VALUES (63, foo(63, + 'ha_write_row_end SIGNAL d0_query WAIT_FOR d0_cont2', + 'rpl_parallel_end_of_group SIGNAL d0_done WAIT_FOR d0_cont')); + +--connection server_2 +SET debug_sync='now WAIT_FOR d0_query'; +--let $d0_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(63%' AND INFO NOT LIKE '%LIKE%'` + +--connection server_1 +SET gtid_domain_id=3; +BEGIN; +# These debug_sync's will linger on and be used to control T2 later. +INSERT INTO t3 VALUES (68, foo(68, + 'rpl_parallel_start_waiting_for_prior SIGNAL t2_waiting', '')); +INSERT INTO t3 VALUES (69, foo(69, + 'ha_write_row_end SIGNAL d3_query WAIT_FOR d3_cont2', + 'rpl_parallel_end_of_group SIGNAL d3_done WAIT_FOR d3_cont')); +COMMIT; +SET gtid_domain_id=0; + +--connection server_2 +SET debug_sync='now WAIT_FOR d3_query'; +--let $d3_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(69%' AND INFO NOT LIKE '%LIKE%'` + +SET debug_sync='now SIGNAL d2_cont2'; +SET debug_sync='now WAIT_FOR d2_done'; +SET debug_sync='now SIGNAL d1_cont2'; +SET debug_sync='now WAIT_FOR d1_done'; +SET debug_sync='now SIGNAL d0_cont2'; +SET debug_sync='now WAIT_FOR d0_done'; +SET debug_sync='now SIGNAL d3_cont2'; +SET debug_sync='now WAIT_FOR d3_done'; + +# Now prepare the real transactions T1, T2, T3, T4 on the master. + +--connection con_temp3 +# Create transaction T1. +INSERT INTO t3 VALUES (64, foo(64, + 'rpl_parallel_before_mark_start_commit SIGNAL t1_waiting WAIT_FOR t1_cont', '')); + +# Create transaction T2, as a group commit leader on the master. +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2 WAIT_FOR master_cont2'; +send INSERT INTO t3 VALUES (65, foo(65, '', '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connection con_temp4 +# Create transaction T3, participating in T2's group commit. +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +send INSERT INTO t3 VALUES (66, foo(66, '', '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; + +--connection con_temp5 +# Create transaction T4, participating in group commit with T2 and T3. +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued4'; +send INSERT INTO t3 VALUES (67, foo(67, '', '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued4'; +SET debug_sync='now SIGNAL master_cont2'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; +--connection con_temp5 +REAP; + +--connection server_1 +SELECT * FROM t3 WHERE a >= 60 ORDER BY a; +SET debug_sync='RESET'; + +--connection server_2 +# Now we have the four transactions pending for replication on the slave. +# Let them be queued for our three worker threads in a controlled fashion. +# We put them at a stage where T1 is delayed and T3 is waiting for T1 to +# commit before T3 can start. Then we kill T3. + +# Make the worker D0 free, and wait for T1 to be queued in it. +SET debug_sync='now SIGNAL d0_cont'; +SET debug_sync='now WAIT_FOR t1_waiting'; + +# Make the worker D3 free, and wait for T2 to be queued in it. +SET debug_sync='now SIGNAL d3_cont'; +SET debug_sync='now WAIT_FOR t2_waiting'; + +# Now release worker D1, and wait for T3 to be queued in it. +# T3 will wait for T1 to commit before it can start. +SET debug_sync='now SIGNAL d1_cont'; +SET debug_sync='now WAIT_FOR t3_waiting'; + +# Release worker D2. Wait for T4 to be queued, so we are sure it has +# received the debug_sync signal (else we might overwrite it with the +# next debug_sync). +SET debug_sync='now SIGNAL d2_cont'; +SET debug_sync='now WAIT_FOR t4_waiting'; + +# Now we kill the waiting transaction T3 in worker D1. +--replace_result $d1_thd_id THD_ID +eval KILL $d1_thd_id; + +# Wait until T3 has reacted on the kill. +SET debug_sync='now WAIT_FOR t3_killed'; + +# Now we can allow T1 to proceed. +SET debug_sync='now SIGNAL t1_cont'; + +--let $slave_sql_errno= 1317,1927,1964 +--source include/wait_for_slave_sql_error.inc +STOP SLAVE IO_THREAD; +# Since T2, T3, and T4 run in parallel, we can not be sure if T2 will have time +# to commit or not before the stop. However, T1 should commit, and T3/T4 may +# not have committed. (After slave restart we check that all become committed +# eventually). +SELECT * FROM t3 WHERE a >= 60 AND a != 65 ORDER BY a; + +# Now we have to disable the debug_sync statements, so they do not trigger +# when the events are retried. +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_1 +UPDATE t3 SET b=b+1 WHERE a=60; +--save_master_pos + +--connection server_2 +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t3 WHERE a >= 60 ORDER BY a; +# Restore the foo() function. +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_2 +# Respawn all worker threads to clear any left-over debug_sync or other stuff. +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + +--echo *** 5. Test killing thread that is waiting for queue of max length to shorten *** + +# Find the thread id of the driver SQL thread that we want to kill. +--let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Slave has read all relay log%' +--source include/wait_condition.inc +--let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Slave has read all relay log%'` +SET @old_max_queued= @@GLOBAL.slave_parallel_max_queued; +SET GLOBAL slave_parallel_max_queued=9000; + +--connection server_1 +--let bigstring= `SELECT REPEAT('x', 10000)` +# Create an event that will wait to be signalled. +INSERT INTO t3 VALUES (80, foo(0, + 'ha_write_row_end SIGNAL query_waiting WAIT_FOR query_cont', '')); + +--connection server_2 +SET debug_sync='now WAIT_FOR query_waiting'; +# Inject that the SQL driver thread will signal `wait_queue_ready' to debug_sync +# as it goes to wait for the event queue to become smaller than the value of +# @@slave_parallel_max_queued. +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,rpl_parallel_wait_queue_max"; + +--connection server_1 +--disable_query_log +# Create an event that will fill up the queue. +# The Xid event at the end of the event group will have to wait for the Query +# event with the INSERT to drain so the queue becomes shorter. However that in +# turn waits for the prior event group to continue. +eval INSERT INTO t3 VALUES (81, LENGTH('$bigstring')); +--enable_query_log +SELECT * FROM t3 WHERE a >= 80 ORDER BY a; + +--connection server_2 +SET debug_sync='now WAIT_FOR wait_queue_ready'; + +--replace_result $thd_id THD_ID +eval KILL $thd_id; + +SET debug_sync='now WAIT_FOR wait_queue_killed'; +SET debug_sync='now SIGNAL query_cont'; + +--let $slave_sql_errno= 1317,1927,1964 +--source include/wait_for_slave_sql_error.inc +STOP SLAVE IO_THREAD; + +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_max_queued= @old_max_queued; + +--connection server_1 +INSERT INTO t3 VALUES (82,0); +--save_master_pos + +--connection server_2 +SET debug_sync='RESET'; +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t3 WHERE a >= 80 ORDER BY a; + +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +DROP function foo; +DROP TABLE t3; +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_gtid_slave_pos_update_fail.test b/mysql-test/suite/rpl/t/rpl_parallel_gtid_slave_pos_update_fail.test index 0756caca08449..da1a07d3b875c 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_gtid_slave_pos_update_fail.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_gtid_slave_pos_update_fail.test @@ -1 +1,98 @@ ---source include/rpl_parallel_gtid_slave_pos_update_fail.inc +# MDEV-6549, failing to update gtid_slave_pos for a transaction that was retried. + +# The problem was that when a transaction updates the mysql.gtid_slave_pos +# table, it clears the flag that marks that there is a GTID position that +# needs to be updated. Then, if the transaction got killed after that due +# to a deadlock, the subsequent retry would fail to notice that the GTID needs +# to be recorded in gtid_slave_pos. +# +# (In the original bug report, the symptom was an assertion; this was however +# just a side effect of the missing update of gtid_slave_pos, which also +# happened to cause a missing clear of OPTION_GTID_BEGIN). +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +# Must use statement-based binlogging. Otherwise the transaction will not be +# binlogged at all, as it modifies no rows. +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; +INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); +--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc + +# Create two transactions that can run in parallel on the slave but cause +# a deadlock if the second runs before the first. +--connection con1 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send UPDATE t4 SET b=NULL WHERE a=6; +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con2 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send DELETE FROM t4 WHERE b <= 1; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +--connection con2 +REAP; +SET debug_sync='RESET'; +--save_master_pos +--let $last_gtid= `SELECT @@last_gtid` + +--connection server_2 +# Disable the usual skip of gap locks for transactions that are run in +# parallel, using DBUG. This allows the deadlock to occur, and this in turn +# triggers a retry of the second transaction, and the code that was buggy and +# caused the gtid_slave_pos update to be skipped in the retry. +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,disable_thd_need_ordering_with"; +--source include/start_slave.inc +--sync_with_master +SET GLOBAL debug_dbug=@old_dbug; + +SELECT * FROM t4 ORDER BY a; +# Check that the GTID of the second transaction was correctly recorded in +# gtid_slave_pos, in the variable as well as in the table. +--replace_result $last_gtid GTID +eval SET @last_gtid= '$last_gtid'; +SELECT IF(@@gtid_slave_pos LIKE CONCAT('%',@last_gtid,'%'), "GTID found ok", + CONCAT("GTID ", @last_gtid, " not found in gtid_slave_pos=", @@gtid_slave_pos)) + AS result; +SELECT "ROW FOUND" AS `Is the row found?` + FROM mysql.gtid_slave_pos + WHERE CONCAT(domain_id, "-", server_id, "-", seq_no) = @last_gtid; + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +DROP TABLE t4; +SET DEBUG_SYNC= 'RESET'; +--disconnect con1 +--disconnect con2 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_ignore_error_on_rotate.test b/mysql-test/suite/rpl/t/rpl_parallel_ignore_error_on_rotate.test index 92c84d497a799..2fab9f8032bf7 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_ignore_error_on_rotate.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_ignore_error_on_rotate.test @@ -1 +1,96 @@ ---source include/rpl_parallel_ignore_error_on_rotate.inc +--echo *** MDEV-6551: Some replication errors are ignored if slave_parallel_threads > 0 *** + +--source include/have_innodb.inc +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +--connection server_2 +--source include/stop_slave.inc +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; +SET GLOBAL slave_parallel_threads=1; +CHANGE MASTER TO master_use_gtid=slave_pos; +CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +SET gtid_domain_id=1; +INSERT INTO t2 VALUES (1); +SET gtid_domain_id=0; +SET gtid_domain_id=2; +INSERT INTO t2 VALUES (2); +SET gtid_domain_id=0; +INSERT INTO t2 VALUES (31); +--let $gtid1= `SELECT @@LAST_GTID` +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads= 0; +--source include/start_slave.inc + +# Force a duplicate key error on the slave. +SET sql_log_bin= 0; +INSERT INTO t2 VALUES (32); +SET sql_log_bin= 1; + +--connection server_1 +INSERT INTO t2 VALUES (32); +--let $gtid2= `SELECT @@LAST_GTID` +# Rotate the binlog; the bug is triggered when the master binlog file changes +# after the event group that causes the duplicate key error. +FLUSH LOGS; +INSERT INTO t2 VALUES (33); +INSERT INTO t2 VALUES (34); +SELECT * FROM t2 WHERE a >= 30 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc + +--connection server_2 +--source include/stop_slave_io.inc +SET GLOBAL slave_parallel_threads=10; +START SLAVE; + +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc + +# Note: IO thread is still running at this point. +# The bug seems to have been that restarting the SQL thread after an error with +# the IO thread still running, somehow picks up a later relay log position and +# thus ends up skipping the failing event, rather than re-executing. + +START SLAVE SQL_THREAD; +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc + +SELECT * FROM t2 WHERE a >= 30 ORDER BY a; + +# Skip the duplicate error, so we can proceed. +--error ER_SLAVE_SKIP_NOT_IN_GTID +SET sql_slave_skip_counter= 1; +--source include/stop_slave_io.inc +--disable_query_log +eval SET GLOBAL gtid_slave_pos = REPLACE(@@gtid_slave_pos, "$gtid1", "$gtid2"); +--enable_query_log +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +SELECT * FROM t2 WHERE a >= 30 ORDER BY a; + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t2; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test b/mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test index 90f09a76546db..493385f1ae304 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test @@ -1 +1,115 @@ ---source include/rpl_parallel_ignored_errors.inc +# ==== Purpose ==== +# +# Test verifies that, in parallel replication, transaction failure notification +# is propagated to all the workers. Workers should abort the execution of +# transaction event groups, whose event positions are higher than the failing +# transaction group. +# +# ==== Implementation ==== +# +# Steps: +# 0 - Create a table t1 on master which has a primary key. Enable parallel +# replication on slave with slave_parallel_mode='optimistic' and +# slave_parallel_threads=3. +# 1 - On slave start a transaction and execute a local INSERT statement +# which will insert value 32. This is done to block the INSERT coming +# from master. +# 2 - On master execute an INSERT statement with value 32, so that it is +# blocked on slave. +# 3 - On slave enable a debug sync point such that it holds the worker thread +# execution as soon as work is scheduled to it. +# 4 - INSERT value 33 on master. It will be held on slave by other worker +# thread due to debug simulation. +# 5 - INSERT value 34 on master. +# 6 - On slave, enusre that INSERT 34 has reached a state where it waits for +# its prior transactions to commit. +# 7 - Commit the local INSERT 32 on slave server so that first worker will +# error out. +# 8 - Now send a continue signal to second worker processing 33. It should +# wakeup and propagate the error to INSERT 34. +# 9 - Upon slave stop due to error, check that no rows are found after the +# failed INSERT 32. +# +# ==== References ==== +# +# MDEV-20645: Replication consistency is broken as workers miss the error +# notification from an earlier failed group. +# + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +--enable_connect_log +--connection server_2 +--source include/stop_slave.inc +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; +SET @old_debug= @@GLOBAL.debug_dbug; +SET GLOBAL slave_parallel_mode='optimistic'; +SET GLOBAL slave_parallel_threads= 3; +CHANGE MASTER TO master_use_gtid=slave_pos; +CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=InnoDB; +# MDEV-515 takes X-lock on the table for the first insert. +# So concurrent insert won't happen on the table +INSERT INTO t1 VALUES(1); +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc + +--connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +BEGIN; +INSERT INTO t1 VALUES (32); + +--connection server_1 +INSERT INTO t1 VALUES (32); + +--connection server_2 +--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE info like "INSERT INTO t1 VALUES (32)" +--source include/wait_condition.inc +SET GLOBAL debug_dbug="+d,hold_worker_on_schedule"; +SET debug_sync="debug_sync_action SIGNAL reached_pause WAIT_FOR continue_worker"; + +--connection server_1 +SET gtid_seq_no=100; +INSERT INTO t1 VALUES (33); + +--connection server_2 +SET debug_sync='now WAIT_FOR reached_pause'; + +--connection server_1 +INSERT INTO t1 VALUES (34); + +--connection server_2 +--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state like "Waiting for prior transaction to commit" +--source include/wait_condition.inc +--connection con_temp2 +COMMIT; + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +--let $assert_cond= COUNT(*) = 0 FROM t1 WHERE a>32 +--let $assert_text= table t1 should have zero rows where a>32 +--source include/assert.inc +SELECT * FROM t1 WHERE a>32; +DELETE FROM t1 WHERE a=32; + +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +SET GLOBAL debug_dbug=@old_debug; +SET DEBUG_SYNC= 'RESET'; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t1; +--disable_connect_log +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test b/mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test index 3838973c2017c..90304937445e6 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test @@ -1 +1,107 @@ ---source include/rpl_parallel_innodb_lock_conflict.inc +--echo ***MDEV-5914: Parallel replication deadlock due to InnoDB lock conflicts *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection server_2 +SET sql_log_bin=0; +CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); +SET sql_log_bin=1; +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; +INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); +--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) + +# Create a group commit with UPDATE and DELETE, in that order. +# The bug was that while the UPDATE's row lock does not block the DELETE, the +# DELETE's gap lock _does_ block the UPDATE. This could cause a deadlock +# on the slave. +--connection con1 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send UPDATE t4 SET b=NULL WHERE a=6; +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con2 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send DELETE FROM t4 WHERE b <= 3; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +--connection con2 +REAP; +SET debug_sync='RESET'; +--save_master_pos + +--connection server_2 +--source include/start_slave.inc +--sync_with_master +--source include/stop_slave.inc + +SELECT * FROM t4 ORDER BY a; + + +# Another example, this one with INSERT vs. DELETE +--connection server_1 +DELETE FROM t4; +INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); + +# Create a group commit with INSERT and DELETE, in that order. +# The bug was that while the INSERT's insert intention lock does not block +# the DELETE, the DELETE's gap lock _does_ block the INSERT. This could cause +# a deadlock on the slave. +--connection con1 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send INSERT INTO t4 VALUES (7, NULL); +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con2 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send DELETE FROM t4 WHERE b <= 3; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +--connection con2 +REAP; +SET debug_sync='RESET'; +--save_master_pos + +--connection server_2 +--source include/start_slave.inc +--sync_with_master +--source include/stop_slave.inc + +SELECT * FROM t4 ORDER BY a; + + +# Clean up. +--connection server_2 +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +--disconnect con1 +--disconnect con2 +DROP TABLE t4; +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test b/mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test index de9dc7f782ac0..33b1bcb11d949 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test @@ -1 +1,87 @@ ---source include/rpl_parallel_missed_error_handling.inc +--echo *** MDEV-5921: In parallel replication, an error is not correctly signalled to the next transaction *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection server_2 +--source include/stop_slave.inc +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master + +--connection server_1 +INSERT INTO t3 VALUES (110, 1); +--save_master_pos + +--connection server_2 +--sync_with_master +SELECT * FROM t3 WHERE a >= 110 ORDER BY a; +# Inject a duplicate key error. +SET sql_log_bin=0; +INSERT INTO t3 VALUES (111, 666); +SET sql_log_bin=1; + +--connection server_1 + +# Create a group commit with two inserts, the first one conflicts with a row on the slave +--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send INSERT INTO t3 VALUES (111, 2); +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send INSERT INTO t3 VALUES (112, 3); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +--connection con2 +REAP; +SET debug_sync='RESET'; +--save_master_pos + +--connection server_2 +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc +--source include/wait_for_slave_sql_to_stop.inc +# We should not see the row (112,3) here, it should be rolled back due to +# error signal from the prior transaction. +SELECT * FROM t3 WHERE a >= 110 ORDER BY a; +SET sql_log_bin=0; +DELETE FROM t3 WHERE a=111 AND b=666; +SET sql_log_bin=1; +START SLAVE SQL_THREAD; +--sync_with_master +SELECT * FROM t3 WHERE a >= 110 ORDER BY a; + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +--disconnect con1 +--disconnect con2 +DROP TABLE t3; +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_mode.test b/mysql-test/suite/rpl/t/rpl_parallel_mode.test index afd9e03891222..67104069e9aca 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_mode.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_mode.test @@ -1 +1,87 @@ ---source include/rpl_parallel_mode.inc +--echo *** MDEV-6676 - test syntax of @@slave_parallel_mode *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/master-slave.inc + +--connection server_2 +--source include/stop_slave.inc +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master + +--let $status_items= Parallel_Mode +--source include/show_slave_status.inc +--source include/stop_slave.inc +SET GLOBAL slave_parallel_mode='aggressive'; +--let $status_items= Parallel_Mode +--source include/show_slave_status.inc +SET GLOBAL slave_parallel_mode='conservative'; +--let $status_items= Parallel_Mode +--source include/show_slave_status.inc + +--echo *** MDEV-6676 - test that empty parallel_mode does not replicate in parallel *** +--connection server_1 +INSERT INTO t2 VALUES (1040); +--source include/save_master_gtid.inc + +--connection server_2 +SET GLOBAL slave_parallel_mode='none'; +# Test that we do not use parallel apply, by injecting an unconditional +# crash in the parallel apply code. +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,slave_crash_if_parallel_apply"; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc +SELECT * FROM t2 WHERE a >= 1040 ORDER BY a; +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; + + +--echo *** MDEV-6676 - test disabling domain-based parallel replication *** +--connection server_1 +# Let's do a bunch of transactions that will conflict if run out-of-order in +# domain-based parallel replication mode. +SET gtid_domain_id = 1; +INSERT INTO t2 VALUES (1041); +INSERT INTO t2 VALUES (1042); +INSERT INTO t2 VALUES (1043); +INSERT INTO t2 VALUES (1044); +INSERT INTO t2 VALUES (1045); +INSERT INTO t2 VALUES (1046); +DELETE FROM t2 WHERE a >= 1041; +SET gtid_domain_id = 2; +INSERT INTO t2 VALUES (1041); +INSERT INTO t2 VALUES (1042); +INSERT INTO t2 VALUES (1043); +INSERT INTO t2 VALUES (1044); +INSERT INTO t2 VALUES (1045); +INSERT INTO t2 VALUES (1046); +SET gtid_domain_id = 0; +--source include/save_master_gtid.inc +--connection server_2 +SET GLOBAL slave_parallel_mode=minimal; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc +SELECT * FROM t2 WHERE a >= 1040 ORDER BY a; + +# Cleanup +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t2; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_optimistic_error_stop.test b/mysql-test/suite/rpl/t/rpl_parallel_optimistic_error_stop.test new file mode 100644 index 0000000000000..27f38d47bdbfb --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_parallel_optimistic_error_stop.test @@ -0,0 +1,180 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--let $rpl_topology=1->2 +--source include/rpl_init.inc + +call mtr.add_suppression("Slave: Commit failed due to failure of an earlier commit"); +call mtr.add_suppression("Slave: Duplicate entry '99'"); + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1,1); # hit a dup entry on slave +INSERT INTO t1 VALUES(2,1); # races to "win" the last exit +INSERT INTO t1 VALUES(3,1); +INSERT INTO t1 VALUES(4,1); # make W3 race over W1 +--save_master_pos + +--connection server_2 +--sync_with_master +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--source include/stop_slave.inc +SET @old_debug_dbug = @@global.debug_dbug; +# In a group of W1,W2,W3 of the same batch W2 simulates slowness. +SET @@global.debug_dbug = "d,hold_worker2_favor_worker3"; +SET GLOBAL slave_parallel_threads=4; +CHANGE MASTER TO master_use_gtid=slave_pos; +SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; +SET GLOBAL slave_parallel_mode='optimistic'; + +# MDEV-30780 optimistic parallel slave hangs after hit an error +# Test workers hang scenario to prove it's no more neither +# out-of-order access to the active gco list. +# +# The test provides how to reproduce on the OLD version, false by default. +# That branch approximates the original hang with an assert that +# confirms the OLD version indeed could access already reclaimed gco. +--let $old_version_regression=0 + + +--connection server_1 + +# Let W1,W2,W3,W4 parallel workers that are going to execute +# the following transaction. +# W1 holds on with the 1st statement +# then crashes W3 with the 2nd into retry, +# finally hits with the 3rd a dup entry, on slave. +SET @@gtid_seq_no = 2001; +BEGIN; + UPDATE t1 SET b = 11 WHERE a = 4; + UPDATE t1 SET b = 11 WHERE a = 3; + UPDATE t1 SET a = 99 WHERE a = 1; +COMMIT; +# In the buggy version W2 races to "win" the exit last (of W1..3) +# and by that to access last a gco struct, garbage-collected. +UPDATE t1 SET b = 2 WHERE a = 2; +# W3 garbage-collects the gco struct in the buggy version. +UPDATE t1 SET b = 3 WHERE a = 3; +# W4 resides in following "singleton" batch to a W2 replacement +# in the buggy version to allow W3 reclaim the batch's gco. +DROP TABLE IF EXISTS phantom_1; + +--source include/save_master_gtid.inc + +--connect (slave_local_0, 127.0.0.1, root,, test, $SLAVE_MYPORT,) +begin; + UPDATE t1 set b = 11 where a = 4; +--connect (slave_local_1, 127.0.0.1, root,, test, $SLAVE_MYPORT,) +begin; + INSERT INTO t1 VALUES (99, 11); + +--connect (slave_local_2, 127.0.0.1, root,, test, $SLAVE_MYPORT,) +begin; + UPDATE t1 SET b = 12 WHERE a = 2; + +--connect (slave_local_3, 127.0.0.1, root,, test, $SLAVE_MYPORT,) +begin; + UPDATE t1 SET b = 13 WHERE a = 3; + +--connection server_2 +--source include/start_slave.inc + +--echo # W4 is waiting to start its DROP + +--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to start commit%" +--source include/wait_condition.inc + +--connection slave_local_3 +# make W3 to set E.cc <- 1 + rollback; +--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit%" +--source include/wait_condition.inc + +--connection slave_local_0 +# make W3 into retry and delay it to let W1 hit a dupicate error first, +# see 'commit' by slave_local_1. + rollback; +--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "debug sync point: now" +--source include/wait_condition.inc +SELECT count(*) = 0 as "W3 undid its commit state" FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit%"; + + +--connection slave_local_2 + rollback; +# wait for W2 to start committing E.cc <- 2 +--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state like "Waiting for prior transaction to commit" +--source include/wait_condition.inc + +--connection slave_local_1 + +# W1 errors out +# A. to alert W3 +# B. W3 will *not* wake up W4 in the fixed version, having to wait for W2 demise. +# C. W2 will notify W3 that releases W4 as it would do in normal cases. +commit; + +if (!$old_version_regression) +{ +# A. In the fixed version show-processlist W4 is still in the ordered waiting +SELECT COUNT(*) = 1 as "W4 remains with the same status" FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to start commit%"; +--let $status= query_get_value("show slave status", Slave_SQL_Running, 1) +--echo # Slave_SQL_Running YES = $status + +# B. In the fixed version W3 is waiting for W2,... +--let $wait_condition= SELECT count(*) = 1 as "W4 is waiting" FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit%" +--source include/wait_condition.inc +--echo # while W2 is held back ... +--let $wait_condition= SELECT count(*) = 1 as "W2 simulates slowness" FROM information_schema.processlist WHERE state LIKE "debug sync point: now" +--source include/wait_condition.inc + +# C. # ...until NOW. +SET DEBUG_SYNC = 'now SIGNAL cont_worker2'; + +} + +# To reproduce the hang on the OLD version ... +if ($old_version_regression) +{ + # replace the actual fixes block with checking W3,W4 have actually committed, + # followed by signaling to W2 like on behalf of W4 which would end up in the hang. + --let $wait_condition= SELECT COUNT(*) = 0 as "W4 has moved on" FROM information_schema.processlist WHERE state like "Waiting for prior transaction to start commit" + --source include/wait_condition.inc + --let $wait_condition= SELECT count(*) = 0 as "W3 does not wait on W2" FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit%" +--source include/wait_condition.inc + + --let $wait_condition= SELECT count(*) = 1 as "W2 simulates slowness" FROM information_schema.processlist WHERE state LIKE "debug sync point: now" + --source include/wait_condition.inc + + # Like above, but signaling is done after W4 is done to violate the commit order + # that must fire a debug assert. + SET DEBUG_SYNC = 'now SIGNAL cont_worker2'; +} + +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc + +# Restore the slave data and resume with replication +DELETE FROM t1 WHERE a=99; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +# +# Clean up. +# +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +SET @@global.debug_dbug = @old_debug_dbug; +SET debug_sync = RESET; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t1; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_partial_binlog_trans.test b/mysql-test/suite/rpl/t/rpl_parallel_partial_binlog_trans.test index 7be26edabb8c0..7247925285fdd 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_partial_binlog_trans.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_partial_binlog_trans.test @@ -1 +1,71 @@ ---source include/rpl_parallel_partial_binlog_trans.inc +--echo *** MDEV_6435: Incorrect error handling when query binlogged partially on master with "killed" error *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +--connection server_2 +--source include/stop_slave.inc +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET GLOBAL slave_parallel_threads=1; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t6 (a INT) ENGINE=MyISAM; +CREATE TRIGGER tr AFTER INSERT ON t6 FOR EACH ROW SET @a = 1; +--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) + +--connection con1 +--let $conid = `SELECT CONNECTION_ID()` +SET debug_sync='sp_head_execute_before_loop SIGNAL ready WAIT_FOR cont'; +send INSERT INTO t6 VALUES (1), (2), (3); + +--connection server_1 +SET debug_sync='now WAIT_FOR ready'; +--replace_result $conid CONID +eval KILL QUERY $conid; +SET debug_sync='now SIGNAL cont'; + +--connection con1 +--error ER_QUERY_INTERRUPTED +--reap +SET debug_sync='RESET'; +--let $after_error_gtid_pos= `SELECT @@gtid_binlog_pos` + +--connection server_1 +SET debug_sync='RESET'; + +--connection server_2 +--let $slave_sql_errno= 1317 +--source include/wait_for_slave_sql_error.inc +STOP SLAVE IO_THREAD; +--replace_result $after_error_gtid_pos AFTER_ERROR_GTID_POS +eval SET GLOBAL gtid_slave_pos= '$after_error_gtid_pos'; +--source include/start_slave.inc + +--connection server_1 +INSERT INTO t6 VALUES (4); +SELECT * FROM t6 ORDER BY a; +--save_master_pos + +--connection server_2 +--sync_with_master +SELECT * FROM t6 ORDER BY a; + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +DROP TABLE t6; +SET DEBUG_SYNC= 'RESET'; +--disconnect con1 + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_record_gtid_wakeup.test b/mysql-test/suite/rpl/t/rpl_parallel_record_gtid_wakeup.test index 4529a26810375..0f94d8f9943ab 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_record_gtid_wakeup.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_record_gtid_wakeup.test @@ -1 +1,72 @@ ---source include/rpl_parallel_record_gtid_wakeup.inc +--echo *** MDEV-7929: record_gtid() for non-transactional event group calls wakeup_subsequent_commits() too early, causing slave hang. *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug= '+d,inject_record_gtid_serverid_100_sleep'; + +--connection server_1 +# Inject two group commits. The bug was that record_gtid for a +# non-transactional event group would commit its own transaction, which would +# cause ha_commit_trans() to call wakeup_subsequent_commits() too early. This +# in turn lead to access to freed group_commit_orderer object, losing a wakeup +# and causing slave threads to hang. +# We inject a small sleep in the corresponding record_gtid() to make the race +# easier to hit. + +SET @old_dbug= @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,binlog_force_commit_id"; + +# Group commit with cid=10010, two event groups. +SET @old_server_id= @@SESSION.server_id; +SET SESSION server_id= 100; +SET @commit_id= 10010; +ALTER TABLE t1 COMMENT "Hulubulu!"; +SET SESSION server_id= @old_server_id; +INSERT INTO t3 VALUES (130, 0); + +# Group commit with cid=10011, one event group. +SET @commit_id= 10011; +INSERT INTO t3 VALUES (131, 0); + +SET SESSION debug_dbug=@old_dbug; + +SELECT * FROM t3 WHERE a >= 130 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +SELECT * FROM t3 WHERE a >= 130 ORDER BY a; + +# Clean up. +--source include/stop_slave.inc +SET GLOBAL debug_dbug= @old_dbug; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t1,t3; + +--source include/rpl_end.inc + diff --git a/mysql-test/suite/rpl/t/rpl_parallel_retry_deadlock.test b/mysql-test/suite/rpl/t/rpl_parallel_retry_deadlock.test index 50b216b6f5858..54ac859bb33b1 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_retry_deadlock.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_retry_deadlock.test @@ -1 +1,281 @@ ---source include/rpl_parallel_retry_deadlock.inc +--echo *** MDEV-7326 Server deadlock in connection with parallel replication *** +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; +--source include/stop_slave.inc +# Test assumes that 'conservative' mode is in effect. i.e +# Do not start parallel execution of this event group until all prior groups +# have reached the commit phase. Refer 'rpl_parallel_start_waiting_for_prior' +# debug simumation. +SET GLOBAL slave_parallel_mode='conservative'; +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t6 (a INT) ENGINE=MyISAM; +--save_master_pos + +--connection server_2 +--sync_with_master + +--connection server_1 +# Use a stored function to inject a debug_sync into the appropriate THD. +# The function does nothing on the master, and on the slave it injects the +# desired debug_sync action(s). +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_2 +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +# We use three transactions, each in a separate group commit. +# T1 does mark_start_commit(), then gets a deadlock error. +# T2 wakes up and starts running +# T1 does unmark_start_commit() +# T3 goes to wait for T2 to start its commit +# T2 does mark_start_commit() +# The bug was that at this point, T3 got deadlocked. Because T1 has unmarked(), +# T3 did not yet see the count_committing_event_groups reach its target value +# yet. But when T1 later re-did mark_start_commit(), it failed to send a wakeup +# to T3. + +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=3; +SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; +--source include/start_slave.inc + +--connection server_1 +SET @old_format= @@SESSION.binlog_format; +SET binlog_format= STATEMENT; +# This debug_sync will linger on and be used to control T3 later. +INSERT INTO t1 VALUES (foo(50, + "rpl_parallel_start_waiting_for_prior SIGNAL t3_ready", + "rpl_parallel_end_of_group SIGNAL prep_ready WAIT_FOR prep_cont")); +--save_master_pos +--connection server_2 +# Wait for the debug_sync point for T3 to be set. But let the preparation +# transaction remain hanging, so that T1 and T2 will be scheduled for the +# remaining two worker threads. +SET DEBUG_SYNC= "now WAIT_FOR prep_ready"; + +--connection server_1 +INSERT INTO t2 VALUES (foo(50, + "rpl_parallel_simulate_temp_err_xid SIGNAL t1_ready1 WAIT_FOR t1_cont1", + "rpl_parallel_retry_after_unmark SIGNAL t1_ready2 WAIT_FOR t1_cont2")); +--save_master_pos + +--connection server_2 +SET DEBUG_SYNC= "now WAIT_FOR t1_ready1"; +# T1 has now done mark_start_commit(). It will later do a rollback and retry. + +--connection server_1 +# Use a MyISAM table for T2 and T3, so they do not trigger the +# rpl_parallel_simulate_temp_err_xid DBUG insertion on XID event. +INSERT INTO t1 VALUES (foo(51, + "rpl_parallel_before_mark_start_commit SIGNAL t2_ready1 WAIT_FOR t2_cont1", + "rpl_parallel_after_mark_start_commit SIGNAL t2_ready2")); + +--connection server_2 +SET DEBUG_SYNC= "now WAIT_FOR t2_ready1"; +# T2 has now started running, but has not yet done mark_start_commit() +SET DEBUG_SYNC= "now SIGNAL t1_cont1"; +SET DEBUG_SYNC= "now WAIT_FOR t1_ready2"; +# T1 has now done unmark_start_commit() in preparation for its retry. + +--connection server_1 +INSERT INTO t1 VALUES (52); +SET BINLOG_FORMAT= @old_format; +SELECT * FROM t2 WHERE a>=50 ORDER BY a; +SELECT * FROM t1 WHERE a>=50 ORDER BY a; + +--connection server_2 +# Let the preparation transaction complete, so that the same worker thread +# can continue with the transaction T3. +SET DEBUG_SYNC= "now SIGNAL prep_cont"; +SET DEBUG_SYNC= "now WAIT_FOR t3_ready"; +# T3 has now gone to wait for T2 to start committing +SET DEBUG_SYNC= "now SIGNAL t2_cont1"; +SET DEBUG_SYNC= "now WAIT_FOR t2_ready2"; +# T2 has now done mark_start_commit(). +# Let things run, and check that T3 does not get deadlocked. +SET DEBUG_SYNC= "now SIGNAL t1_cont2"; +--sync_with_master + +--connection server_1 +--save_master_pos +--connection server_2 +--sync_with_master +SELECT * FROM t2 WHERE a>=50 ORDER BY a; +SELECT * FROM t1 WHERE a>=50 ORDER BY a; +SET DEBUG_SYNC="reset"; + +# Re-spawn the worker threads to remove any DBUG injections or DEBUG_SYNC. +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + + +--echo *** MDEV-7326 Server deadlock in connection with parallel replication *** +# Similar to the previous test, but with T2 and T3 in the same GCO. +# We use three transactions, T1 in one group commit and T2/T3 in another. +# T1 does mark_start_commit(), then gets a deadlock error. +# T2 wakes up and starts running +# T1 does unmark_start_commit() +# T3 goes to wait for T1 to start its commit +# T2 does mark_start_commit() +# The bug was that at this point, T3 got deadlocked. T2 increments the +# count_committing_event_groups but does not signal T3, as they are in +# the same GCO. Then later when T1 increments, it would also not signal +# T3, because now the count_committing_event_groups is not equal to the +# wait_count of T3 (it is one larger). + +--connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) + +--connection server_2 +--source include/stop_slave.inc +SET @old_parallel_mode= @@GLOBAL.slave_parallel_mode; +SET GLOBAL slave_parallel_mode='conservative'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=3; +SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; +--source include/start_slave.inc + +--connection server_1 +SET @old_format= @@SESSION.binlog_format; +SET binlog_format= STATEMENT; +# This debug_sync will linger on and be used to control T3 later. +INSERT INTO t1 VALUES (foo(60, + "rpl_parallel_start_waiting_for_prior SIGNAL t3_ready", + "rpl_parallel_end_of_group SIGNAL prep_ready WAIT_FOR prep_cont")); +--save_master_pos +--connection server_2 +# Wait for the debug_sync point for T3 to be set. But let the preparation +# transaction remain hanging, so that T1 and T2 will be scheduled for the +# remaining two worker threads. +SET DEBUG_SYNC= "now WAIT_FOR prep_ready"; + +--connection server_1 +INSERT INTO t2 VALUES (foo(60, + "rpl_parallel_simulate_temp_err_xid SIGNAL t1_ready1 WAIT_FOR t1_cont1", + "rpl_parallel_retry_after_unmark SIGNAL t1_ready2 WAIT_FOR t1_cont2")); +--save_master_pos + +--connection server_2 +SET DEBUG_SYNC= "now WAIT_FOR t1_ready1"; +# T1 has now done mark_start_commit(). It will later do a rollback and retry. + +# Do T2 and T3 in a single group commit. +# Use a MyISAM table for T2 and T3, so they do not trigger the +# rpl_parallel_simulate_temp_err_xid DBUG insertion on XID event. +--connection con_temp3 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +SET binlog_format=statement; +send INSERT INTO t1 VALUES (foo(61, + "rpl_parallel_before_mark_start_commit SIGNAL t2_ready1 WAIT_FOR t2_cont1", + "rpl_parallel_after_mark_start_commit SIGNAL t2_ready2")); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con_temp4 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send INSERT INTO t6 VALUES (62); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; + +--connection server_1 +SET debug_sync='RESET'; +SET BINLOG_FORMAT= @old_format; +SELECT * FROM t2 WHERE a>=60 ORDER BY a; +SELECT * FROM t1 WHERE a>=60 ORDER BY a; +SELECT * FROM t6 WHERE a>=60 ORDER BY a; + +--connection server_2 +SET DEBUG_SYNC= "now WAIT_FOR t2_ready1"; +# T2 has now started running, but has not yet done mark_start_commit() +SET DEBUG_SYNC= "now SIGNAL t1_cont1"; +SET DEBUG_SYNC= "now WAIT_FOR t1_ready2"; +# T1 has now done unmark_start_commit() in preparation for its retry. + +--connection server_2 +# Let the preparation transaction complete, so that the same worker thread +# can continue with the transaction T3. +SET DEBUG_SYNC= "now SIGNAL prep_cont"; +SET DEBUG_SYNC= "now WAIT_FOR t3_ready"; +# T3 has now gone to wait for T2 to start committing +SET DEBUG_SYNC= "now SIGNAL t2_cont1"; +SET DEBUG_SYNC= "now WAIT_FOR t2_ready2"; +# T2 has now done mark_start_commit(). +# Let things run, and check that T3 does not get deadlocked. +SET DEBUG_SYNC= "now SIGNAL t1_cont2"; +--sync_with_master + +--connection server_1 +--save_master_pos +--connection server_2 +--sync_with_master +SELECT * FROM t2 WHERE a>=60 ORDER BY a; +SELECT * FROM t1 WHERE a>=60 ORDER BY a; +SELECT * FROM t6 WHERE a>=60 ORDER BY a; +SET DEBUG_SYNC="reset"; + +# Clean up. +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc + +--connection server_1 +DROP function foo; +DROP TABLE t1,t2,t6; +--disconnect con_temp3 +--disconnect con_temp4 +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_rollback_assert.test b/mysql-test/suite/rpl/t/rpl_parallel_rollback_assert.test index f66375b7fb461..eec331b3d6436 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_rollback_assert.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_rollback_assert.test @@ -1 +1,62 @@ ---source include/rpl_parallel_rollback_assert.inc +--echo *** MDEV-8725: Assertion on ROLLBACK statement in the binary log *** +--source include/have_innodb.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master + +--connection server_1 +# Inject an event group terminated by ROLLBACK, by mixing MyISAM and InnoDB +# in a transaction. The bug was an assertion on the ROLLBACK due to +# mark_start_commit() being already called. +--disable_warnings +BEGIN; +INSERT INTO t2 VALUES (2000); +INSERT INTO t1 VALUES (2000); +INSERT INTO t2 VALUES (2001); +ROLLBACK; +--enable_warnings +SELECT * FROM t1 WHERE a>=2000 ORDER BY a; +SELECT * FROM t2 WHERE a>=2000 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc + +--connection server_1 +INSERT INTO t2 VALUES (2020); +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc +SELECT * FROM t2 WHERE a>=2000 ORDER BY a; +let $rows_in_t1= `SELECT COUNT(*) FROM t1 WHERE a>=2000 ORDER BY a`; +if ($rows_in_t1 == 0) +{ +--query_vertical SHOW SLAVE STATUS +} +SELECT * FROM t1 WHERE a>=2000 ORDER BY a; + +# Clean up. +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t1,t2; + +--source include/rpl_end.inc + diff --git a/mysql-test/suite/rpl/t/rpl_parallel_seq.test b/mysql-test/suite/rpl/t/rpl_parallel_seq.test new file mode 100644 index 0000000000000..2a4fd96ff34f8 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_parallel_seq.test @@ -0,0 +1,131 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--connection slave +--source include/stop_slave.inc +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; + +--echo # MDEV-29621 the sequence engine binlog_row_image-full events +--echo # MDL-deadlock on the parallel slave. +--connection master +CREATE SEQUENCE s1; +SET @@session.binlog_row_image=FULL; +SET @@session.debug_dbug="+d,binlog_force_commit_id"; +SET @commit_id=7; +SET @@gtid_seq_no=100; +SELECT NEXT VALUE FOR s1; +INSERT INTO s1 VALUES(2, 1, 10, 1, 2, 1, 1, 0); +SET @@session.debug_dbug=""; + +--connection slave +--let $slave_parallel_threads=`select @@global.slave_parallel_threads` +--let $slave_parallel_mode=`select @@global.slave_parallel_mode` +SET @@global.slave_parallel_threads=2; +SET @@global.slave_parallel_mode=optimistic; +SET @@global.debug_dbug="+d,hold_worker_on_schedule"; +--source include/start_slave.inc + +--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to start commit" +--source include/wait_condition.inc +SET DEBUG_SYNC = 'now SIGNAL continue_worker'; + +--connection master +DROP SEQUENCE s1; +--sync_slave_with_master +--source include/stop_slave.inc + +--echo # Simulate buggy 10.3.36 master to prove the parallel applier +--echo # does not deadlock now at replaying the above master load. +--connection master +--let $datadir= `SELECT @@datadir` + +--let $rpl_server_number= 1 +--source include/rpl_stop_server.inc + +--remove_file $datadir/master-bin.000001 +--copy_file $MYSQL_TEST_DIR/std_data/rpl/master-bin-seq_10.3.36.000001 $datadir/master-bin.000001 + +--let $rpl_server_number= 1 +--source include/rpl_start_server.inc + +--source include/wait_until_connected_again.inc +--save_master_pos + +--connection slave +RESET MASTER; +SET @@global.gtid_slave_pos=""; + +--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 +eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_use_gtid=slave_pos; + +START SLAVE UNTIL MASTER_GTID_POS='0-1-102'; + +--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit" +--source include/wait_condition.inc +SET DEBUG_SYNC = 'now SIGNAL continue_worker'; + +--echo # Normal stop is expected +--source include/wait_for_slave_to_stop.inc + +--echo # MDEV-31077 ALTER SEQUENCE may end up in optimistic parallel slave binlog out-of-order +--echo # The test proves ALTER-SEQUENCE binlogs first before the following transaction does so. + +--connection slave +--source include/stop_slave.inc +RESET MASTER; +SET @@global.gtid_slave_pos=""; +--let $slave_gtid_strict_mode=`select @@global.gtid_strict_mode` +SET @@global.gtid_strict_mode=1; +--connection master +RESET MASTER; + +# Load from master +CREATE TABLE ti (a INT) ENGINE=innodb; +CREATE SEQUENCE s2 ENGINE=innodb; + +SET @@gtid_seq_no=100; +ALTER SEQUENCE s2 restart with 1; +INSERT INTO ti SET a=1; +--source include/save_master_gtid.inc +SELECT @@global.gtid_binlog_state "Master gtid state"; + +--connection slave +--source include/start_slave.inc + +--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit" +--source include/wait_condition.inc + +SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "no 100,101 yet in both"; + +# DEBUG_DBUG extension point of hold_worker_on_schedule is reused +# (gets deployed) in Sql_cmd_alter_sequence::execute. +SET DEBUG_SYNC = 'now SIGNAL continue_worker'; + +--echo # Normal sync with master proves the fixes correct +--source include/sync_with_master_gtid.inc + +SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "all through 101 have been committed"; + +# +# MDEV-29621/MDEV-31077 clean up. +# +--connection slave +--source include/stop_slave.inc + +SET debug_sync = RESET; +--eval SET @@global.slave_parallel_threads= $slave_parallel_threads +--eval SET @@global.slave_parallel_mode= $slave_parallel_mode + SET @@global.debug_dbug = ""; +--eval SET @@global.gtid_strict_mode=$slave_gtid_strict_mode +--source include/start_slave.inc + +--connection master +DROP SEQUENCE s2; +DROP TABLE ti; + +--sync_slave_with_master + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test b/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test index 8c8892d53707f..cddc9286bd28d 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test @@ -1 +1,38 @@ ---source include/rpl_parallel_show_binlog_events_purge_logs.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# BUG#13979418: SHOW BINLOG EVENTS MAY CRASH THE SERVER +# +# The function mysql_show_binlog_events has a local stack variable +# 'LOG_INFO linfo;', which is assigned to thd->current_linfo, however +# this variable goes out of scope and is destroyed before clean +# thd->current_linfo. +# +# This test case runs SHOW BINLOG EVENTS and FLUSH LOGS to make sure +# that with the fix local variable linfo is valid along all +# mysql_show_binlog_events function scope. +# +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection slave +SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR end'; +--send SHOW BINLOG EVENTS + +--connection slave1 +SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events'; +FLUSH LOGS; +SET DEBUG_SYNC= 'now SIGNAL end'; + +--connection slave +--disable_result_log +--reap +--enable_result_log +SET DEBUG_SYNC= 'RESET'; + +--connection master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_single_grpcmt.test b/mysql-test/suite/rpl/t/rpl_parallel_single_grpcmt.test index 2091982394591..cf4c547b73b45 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_single_grpcmt.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_single_grpcmt.test @@ -1 +1,170 @@ ---source include/rpl_parallel_single_grpcmt.inc +--echo *** Test that group-committed transactions on the master can replicate in parallel on the slave. *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +# Test various aspects of parallel replication. + +--connection server_1 +# The function does nothing on the master, and on the slave it injects the +# desired debug_sync action(s). +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_2 +--source include/stop_slave.inc +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +# We need to restart all parallel threads for the new global setting to +# be copied to the session-level values. +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +# Create some sentinel rows so that the rows inserted in parallel fall into +# separate gaps and do not cause gap lock conflicts. +INSERT INTO t3 VALUES (1,1), (3,3), (5,5), (7,7); +--save_master_pos +--connection server_2 +--sync_with_master + + +# We want to test that the transactions can execute out-of-order on +# the slave, but still end up committing in-order, and in a single +# group commit. +# +# The idea is to group-commit three transactions together on the master: +# A, B, and C. On the slave, C will execute the insert first, then A, +# and then B. But B manages to complete before A has time to commit, so +# all three end up committing together. +# +# So we start by setting up some row locks that will block transactions +# A and B from executing, allowing C to run first. + +--connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +BEGIN; +INSERT INTO t3 VALUES (2,102); +--connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +BEGIN; +INSERT INTO t3 VALUES (4,104); + +# On the master, queue three INSERT transactions as a single group commit. +--connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +SET binlog_format=statement; +send INSERT INTO t3 VALUES (2, foo(12, + 'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued1 WAIT_FOR slave_cont1', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +SET binlog_format=statement; +send INSERT INTO t3 VALUES (4, foo(14, + 'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued2', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +SET binlog_format=statement; +send INSERT INTO t3 VALUES (6, foo(16, + 'group_commit_waiting_for_prior SIGNAL slave_queued3', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; +--connection con_temp5 +REAP; +SET debug_sync='RESET'; + +--connection server_1 +SELECT * FROM t3 ORDER BY a; +--let $binlog_file= master-bin.000001 +--source include/show_binlog_events.inc + +# First, wait until insert 3 is ready to queue up for group commit, but is +# waiting for insert 2 to commit before it can do so itself. +--connection server_2 +SET debug_sync='now WAIT_FOR slave_queued3'; + +# Next, let insert 1 proceed, and allow it to queue up as the group commit +# leader, but let it wait for insert 2 to also queue up before proceeding. +--connection con_temp1 +ROLLBACK; +--connection server_2 +SET debug_sync='now WAIT_FOR slave_queued1'; + +# Now let insert 2 proceed and queue up. +--connection con_temp2 +ROLLBACK; +--connection server_2 +SET debug_sync='now WAIT_FOR slave_queued2'; +# And finally, we can let insert 1 proceed and do the group commit with all +# three insert transactions together. +SET debug_sync='now SIGNAL slave_cont1'; + +# Wait for the commit to complete and check that all three transactions +# group-committed together (will be seen in the binlog as all three having +# cid=# on their GTID event). +--let $wait_condition= SELECT COUNT(*) = 3 FROM t3 WHERE a IN (2,4,6) +--source include/wait_condition.inc +SELECT * FROM t3 ORDER BY a; +--let $binlog_file= slave-bin.000001 +--source include/show_binlog_events.inc + + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +DROP function foo; +DROP TABLE t3; +SET DEBUG_SYNC= 'RESET'; + +--disable_connect_log +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_slave_bgc_kill.test b/mysql-test/suite/rpl/t/rpl_parallel_slave_bgc_kill.test index 7b0f9485e5e17..efb998b044343 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_slave_bgc_kill.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_slave_bgc_kill.test @@ -1 +1,458 @@ ---source include/rpl_parallel_slave_bgc_kill.inc +--echo *** Test killing slave threads at various wait points *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +# Test various aspects of parallel replication. + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +SET GLOBAL slave_parallel_mode='conservative'; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +--connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +# MDEV-515 takes X-lock on the table for the first insert. +# So concurrent insert won't happen on the table +INSERT INTO t2 VALUES(100); +INSERT INTO t3 VALUES(100, 100); +--save_master_pos + +--connection server_2 +--sync_with_master + +--connection server_1 +# Use a stored function to inject a debug_sync into the appropriate THD. +# The function does nothing on the master, and on the slave it injects the +# desired debug_sync action(s). +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_2 +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--echo *** 1. Test killing transaction waiting in commit for previous transaction to commit *** + +# Set up three transactions on the master that will be group-committed +# together so they can be replicated in parallel on the slave. +--connection con_temp3 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send INSERT INTO t3 VALUES (31, foo(31, + 'commit_before_prepare_ordered WAIT_FOR t2_waiting', + 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con_temp4 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +BEGIN; +# This insert is just so we can get T2 to wait while a query is running that we +# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. +INSERT INTO t3 VALUES (32, foo(32, + 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', + '')); +# This insert sets up debug_sync points so that T2 will tell when it is at its +# wait point where we want to kill it - and when it has been killed. +INSERT INTO t3 VALUES (33, foo(33, + 'group_commit_waiting_for_prior SIGNAL t2_waiting', + 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); +send COMMIT; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connection con_temp5 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +send INSERT INTO t3 VALUES (34, foo(34, + '', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; +--connection con_temp5 +REAP; + +--connection server_1 +SELECT * FROM t3 WHERE a >= 30 ORDER BY a; +SET debug_sync='RESET'; + +--connection server_2 +SET sql_log_bin=0; +CALL mtr.add_suppression("Query execution was interrupted"); +CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); +CALL mtr.add_suppression("Slave: Connection was killed"); +SET sql_log_bin=1; +# Wait until T2 is inside executing its insert of 32, then find it in SHOW +# PROCESSLIST to know its thread id for KILL later. +SET debug_sync='now WAIT_FOR t2_query'; +--let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(32%' AND INFO NOT LIKE '%LIKE%'` +SET debug_sync='now SIGNAL t2_cont'; + +# Wait until T2 has entered its wait for T1 to commit, and T1 has +# progressed into its commit phase. +SET debug_sync='now WAIT_FOR t1_ready'; + +# Now kill the transaction T2. +--replace_result $thd_id THD_ID +eval KILL $thd_id; + +# Wait until T2 has reacted on the kill. +SET debug_sync='now WAIT_FOR t2_killed'; + +# Now we can allow T1 to proceed. +SET debug_sync='now SIGNAL t1_cont'; + +--let $slave_sql_errno= 1317,1927,1964 +--source include/wait_for_slave_sql_error.inc +STOP SLAVE IO_THREAD; +SELECT * FROM t3 WHERE a >= 30 ORDER BY a; + +# Now we have to disable the debug_sync statements, so they do not trigger +# when the events are retried. +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_1 +INSERT INTO t3 VALUES (39,0); +--save_master_pos + +--connection server_2 +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t3 WHERE a >= 30 ORDER BY a; +# Restore the foo() function. +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + + +--connection server_2 +# Respawn all worker threads to clear any left-over debug_sync or other stuff. +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + + +--echo *** 2. Same as (1), but without restarting IO thread after kill of SQL threads *** + +# Set up three transactions on the master that will be group-committed +# together so they can be replicated in parallel on the slave. +--connection con_temp3 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send INSERT INTO t3 VALUES (41, foo(41, + 'commit_before_prepare_ordered WAIT_FOR t2_waiting', + 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con_temp4 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +BEGIN; +# This insert is just so we can get T2 to wait while a query is running that we +# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. +INSERT INTO t3 VALUES (42, foo(42, + 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', + '')); +# This insert sets up debug_sync points so that T2 will tell when it is at its +# wait point where we want to kill it - and when it has been killed. +INSERT INTO t3 VALUES (43, foo(43, + 'group_commit_waiting_for_prior SIGNAL t2_waiting', + 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); +send COMMIT; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connection con_temp5 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +send INSERT INTO t3 VALUES (44, foo(44, + '', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; +--connection con_temp5 +REAP; + +--connection server_1 +SELECT * FROM t3 WHERE a >= 40 ORDER BY a; +SET debug_sync='RESET'; + +--connection server_2 +# Wait until T2 is inside executing its insert of 42, then find it in SHOW +# PROCESSLIST to know its thread id for KILL later. +SET debug_sync='now WAIT_FOR t2_query'; +--let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(42%' AND INFO NOT LIKE '%LIKE%'` +SET debug_sync='now SIGNAL t2_cont'; + +# Wait until T2 has entered its wait for T1 to commit, and T1 has +# progressed into its commit phase. +SET debug_sync='now WAIT_FOR t1_ready'; + +# Now kill the transaction T2. +--replace_result $thd_id THD_ID +eval KILL $thd_id; + +# Wait until T2 has reacted on the kill. +SET debug_sync='now WAIT_FOR t2_killed'; + +# Now we can allow T1 to proceed. +SET debug_sync='now SIGNAL t1_cont'; + +--let $slave_sql_errno= 1317,1927,1964 +--source include/wait_for_slave_sql_error.inc + +# Now we have to disable the debug_sync statements, so they do not trigger +# when the events are retried. +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_1 +INSERT INTO t3 VALUES (49,0); +--save_master_pos + +--connection server_2 +START SLAVE SQL_THREAD; +--sync_with_master +SELECT * FROM t3 WHERE a >= 40 ORDER BY a; +# Restore the foo() function. +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + + +--connection server_2 +# Respawn all worker threads to clear any left-over debug_sync or other stuff. +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + + +--echo *** 3. Same as (2), but not using gtid mode *** + +--connection server_2 +--source include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=no; +--source include/start_slave.inc + +--connection server_1 +# Set up three transactions on the master that will be group-committed +# together so they can be replicated in parallel on the slave. +--connection con_temp3 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send INSERT INTO t3 VALUES (51, foo(51, + 'commit_before_prepare_ordered WAIT_FOR t2_waiting', + 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con_temp4 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +BEGIN; +# This insert is just so we can get T2 to wait while a query is running that we +# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. +INSERT INTO t3 VALUES (52, foo(52, + 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', + '')); +# This insert sets up debug_sync points so that T2 will tell when it is at its +# wait point where we want to kill it - and when it has been killed. +INSERT INTO t3 VALUES (53, foo(53, + 'group_commit_waiting_for_prior SIGNAL t2_waiting', + 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); +send COMMIT; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connection con_temp5 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +send INSERT INTO t3 VALUES (54, foo(54, + '', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; +--connection con_temp5 +REAP; + +--connection server_1 +SELECT * FROM t3 WHERE a >= 50 ORDER BY a; +SET debug_sync='RESET'; + +--connection server_2 +# Wait until T2 is inside executing its insert of 52, then find it in SHOW +# PROCESSLIST to know its thread id for KILL later. +SET debug_sync='now WAIT_FOR t2_query'; +--let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(52%' AND INFO NOT LIKE '%LIKE%'` +SET debug_sync='now SIGNAL t2_cont'; + +# Wait until T2 has entered its wait for T1 to commit, and T1 has +# progressed into its commit phase. +SET debug_sync='now WAIT_FOR t1_ready'; + +# Now kill the transaction T2. +--replace_result $thd_id THD_ID +eval KILL $thd_id; + +# Wait until T2 has reacted on the kill. +SET debug_sync='now WAIT_FOR t2_killed'; + +# Now we can allow T1 to proceed. +SET debug_sync='now SIGNAL t1_cont'; + +--let $slave_sql_errno= 1317,1927,1964 +--source include/wait_for_slave_sql_error.inc +SELECT * FROM t3 WHERE a >= 50 ORDER BY a; + +# Now we have to disable the debug_sync statements, so they do not trigger +# when the events are retried. +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_1 +INSERT INTO t3 VALUES (59,0); +--save_master_pos + +--connection server_2 +START SLAVE SQL_THREAD; +--sync_with_master +SELECT * FROM t3 WHERE a >= 50 ORDER BY a; + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=slave_pos; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +DROP function foo; +DROP TABLE t1,t2,t3; +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_stop_on_con_kill.test b/mysql-test/suite/rpl/t/rpl_parallel_stop_on_con_kill.test index 64b4cb77dd452..63c483ea6ad17 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_stop_on_con_kill.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_stop_on_con_kill.test @@ -1 +1,129 @@ ---source include/rpl_parallel_stop_on_con_kill.inc +--echo *** MDEV-8031: Parallel replication stops on "connection killed" error (probably incorrectly handled deadlock kill) *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +INSERT INTO t3 VALUES (201,0), (202,0); +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug= '+d,inject_mdev8031'; + +--connection server_1 +# We artificially create a situation that hopefully resembles the original +# bug which was only seen "in the wild", and only once. +# Setup a fake group commit with lots of conflicts that will lead to deadloc +# kill. The slave DBUG injection causes the slave to be deadlock killed at +# a particular point during the retry, and then later do a small sleep at +# another critical point where the prior transaction then has a chance to +# complete. Finally an extra KILL check catches an unhandled, lingering +# deadlock kill. So rather artificial, but at least it exercises the +# relevant code paths. +SET @old_dbug= @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,binlog_force_commit_id"; + +SET @commit_id= 10200; +INSERT INTO t3 VALUES (203, 1); +INSERT INTO t3 VALUES (204, 1); +INSERT INTO t3 VALUES (205, 1); +UPDATE t3 SET b=b+1 WHERE a=201; +UPDATE t3 SET b=b+1 WHERE a=201; +UPDATE t3 SET b=b+1 WHERE a=201; +UPDATE t3 SET b=b+1 WHERE a=202; +UPDATE t3 SET b=b+1 WHERE a=202; +UPDATE t3 SET b=b+1 WHERE a=202; +UPDATE t3 SET b=b+1 WHERE a=202; +UPDATE t3 SET b=b+1 WHERE a=203; +UPDATE t3 SET b=b+1 WHERE a=203; +UPDATE t3 SET b=b+1 WHERE a=204; +UPDATE t3 SET b=b+1 WHERE a=204; +UPDATE t3 SET b=b+1 WHERE a=204; +UPDATE t3 SET b=b+1 WHERE a=203; +UPDATE t3 SET b=b+1 WHERE a=205; +UPDATE t3 SET b=b+1 WHERE a=205; +SET SESSION debug_dbug=@old_dbug; + +SELECT * FROM t3 WHERE a>=200 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +SELECT * FROM t3 WHERE a>=200 ORDER BY a; +--source include/stop_slave.inc +SET GLOBAL debug_dbug= @old_dbug; +--source include/start_slave.inc + + +--echo *** Check getting deadlock killed inside open_binlog() during retry. *** + +--connection server_2 +--source include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug= '+d,inject_retry_event_group_open_binlog_kill'; +SET @old_max= @@GLOBAL.max_relay_log_size; +SET GLOBAL max_relay_log_size= 4096; + +--connection server_1 +SET @old_dbug= @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,binlog_force_commit_id"; + +--let $large= `SELECT REPEAT("*", 8192)` +SET @commit_id= 10210; +--echo Omit long queries that cause relaylog rotations and transaction retries... +--disable_query_log +eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */; +--enable_query_log +SET SESSION debug_dbug=@old_dbug; + +SELECT * FROM t3 WHERE a>=200 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +SELECT * FROM t3 WHERE a>=200 ORDER BY a; + +# Cleanup +--source include/stop_slave.inc +SET GLOBAL debug_dbug= @old_debg; +SET GLOBAL max_relay_log_size= @old_max; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t3; + +--source include/rpl_end.inc + diff --git a/mysql-test/suite/rpl/t/rpl_parallel_stop_slave.test b/mysql-test/suite/rpl/t/rpl_parallel_stop_slave.test index 131ddc2efd9d9..35879e98e66fb 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_stop_slave.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_stop_slave.test @@ -1 +1,118 @@ ---source include/rpl_parallel_stop_slave.inc +--echo *** Test STOP SLAVE in parallel mode *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +SET GLOBAL slave_parallel_mode='conservative'; + +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc +--connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +--connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +# MDEV-515 takes X-lock on the table for the first insert. +# So concurrent insert won't happen on the table +INSERT INTO t2 VALUES(100); +INSERT INTO t3 VALUES(100, 100); +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc + +--connection server_1 +# Set up a couple of transactions. The first will be blocked halfway +# through on a lock, and while it is blocked we initiate STOP SLAVE. +# We then test that the halfway-initiated transaction is allowed to +# complete, but no subsequent ones. +# We have to use statement-based mode and set +# binlog_direct_non_transactional_updates=0; otherwise the binlog will +# be split into two event groups, one for the MyISAM part and one for the +# InnoDB part. +SET binlog_direct_non_transactional_updates=0; +SET sql_log_bin=0; +CALL mtr.add_suppression("Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction"); +SET sql_log_bin=1; +BEGIN; +INSERT INTO t2 VALUES (20); +--disable_warnings +INSERT INTO t1 VALUES (20); +--enable_warnings +INSERT INTO t2 VALUES (21); +INSERT INTO t3 VALUES (20, 20); +COMMIT; +INSERT INTO t3 VALUES(21, 21); +INSERT INTO t3 VALUES(22, 22); +--save_master_pos + +# Start a connection that will block the replicated transaction halfway. +--connection con_temp1 +BEGIN; +INSERT INTO t2 VALUES (21); + +--connection server_2 +START SLAVE; +# Wait for the MyISAM change to be visible, after which replication will wait +# for con_temp1 to roll back. +--let $wait_condition= SELECT COUNT(*) = 1 FROM t1 WHERE a=20 +--source include/wait_condition.inc + +--connection con_temp2 +# Initiate slave stop. It will have to wait for the current event group +# to complete. +# The dbug injection causes debug_sync to signal 'wait_for_done_waiting' +# when the SQL driver thread is ready. +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger"; +send STOP SLAVE; + +--connection con_temp1 +SET debug_sync='now WAIT_FOR wait_for_done_waiting'; +ROLLBACK; + +--connection con_temp2 +reap; +SET GLOBAL debug_dbug=@old_dbug; +SET debug_sync='RESET'; + +--connection server_2 +--source include/wait_for_slave_to_stop.inc +# We should see the first transaction applied, but not the two others. +SELECT * FROM t1 WHERE a >= 20 ORDER BY a; +SELECT * FROM t2 WHERE a >= 20 ORDER BY a; +SELECT * FROM t3 WHERE a >= 20 ORDER BY a; + +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t1 WHERE a >= 20 ORDER BY a; +SELECT * FROM t2 WHERE a >= 20 ORDER BY a; +SELECT * FROM t3 WHERE a >= 20 ORDER BY a; + +--connection server_2 +# Respawn all worker threads to clear any left-over debug_sync or other stuff. +--source include/stop_slave.inc +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; +--disconnect con_temp1 +--disconnect con_temp2 + +--connection server_1 +DROP TABLE t1,t2,t3; +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_temptable.test b/mysql-test/suite/rpl/t/rpl_parallel_temptable.test index 04165ee475208..edb854842e1e9 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_temptable.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_temptable.test @@ -201,9 +201,16 @@ INSERT INTO t1 VALUES (0, 1); # execution of format_description event will not wait infinitely # for a commit of the incomplete group that never happens. +# Apart from the suppression, MDEV-27697 refinement to the original test needs +# an allowance to one time accept malformed event group. +set @@sql_log_bin=0; +call mtr.add_suppression("Unexpected break of being relay-logged GTID 1-1-32 event group by the current GTID event 0-1-4"); +set @@sql_log_bin=1; +set @@global.debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000"; --source include/start_slave.inc #--sync_with_master --source include/sync_with_master_gtid.inc +set @@global.debug_dbug=""; SELECT * FROM t1 ORDER BY a; SHOW STATUS LIKE 'Slave_open_temp_tables'; diff --git a/mysql-test/suite/rpl/t/rpl_parallel_wrong_binlog_order.test b/mysql-test/suite/rpl/t/rpl_parallel_wrong_binlog_order.test index 3c920e1539a9f..093693d453e82 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_wrong_binlog_order.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_wrong_binlog_order.test @@ -1 +1,91 @@ ---source include/rpl_parallel_wrong_binlog_order.inc +--echo *** MDEV-6775: Wrong binlog order in parallel replication *** + +# A bit tricky bug to reproduce. On the master, we binlog in statement-mode +# two transactions, an UPDATE followed by a DELETE. On the slave, we replicate +# with binlog-mode set to ROW, which means the DELETE, which modifies no rows, +# is not binlogged. Then we inject a wait in the group commit code on the +# slave, shortly before the actual commit of the UPDATE. The bug was that the +# DELETE could wake up from wait_for_prior_commit() before the commit of the +# UPDATE. So the test could see the slave position updated to after DELETE, +# while the UPDATE was still not visible. + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; +INSERT INTO t4 VALUES (1,NULL), (3,NULL), (4,4), (5, NULL), (6, 6); +--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,inject_binlog_commit_before_get_LOCK_log"; +SET @old_format=@@GLOBAL.binlog_format; +SET GLOBAL binlog_format=ROW; +# Re-spawn the worker threads to be sure they pick up the new binlog format +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; + +--connection con1 +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send UPDATE t4 SET b=NULL WHERE a=6; +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con2 +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send DELETE FROM t4 WHERE b <= 3; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +SET binlog_format= @old_format; +--connection con2 +REAP; +SET binlog_format= @old_format; +SET debug_sync='RESET'; +--save_master_pos +SELECT * FROM t4 ORDER BY a; + +--connection server_2 +--source include/start_slave.inc +SET debug_sync= 'now WAIT_FOR waiting'; +--sync_with_master +SELECT * FROM t4 ORDER BY a; +SET debug_sync= 'now SIGNAL cont'; + +# Re-spawn the worker threads to remove any DBUG injections or DEBUG_SYNC. +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL binlog_format= @old_format; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +DROP TABLE t4; +SET DEBUG_SYNC= 'RESET'; +--disconnect con1 +--disconnect con2 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_wrong_exec_master_pos.test b/mysql-test/suite/rpl/t/rpl_parallel_wrong_exec_master_pos.test index 9cd700f57fac9..672ade57ca33a 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_wrong_exec_master_pos.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_wrong_exec_master_pos.test @@ -1 +1,56 @@ ---source include/rpl_parallel_wrong_exec_master_pos.inc +--echo *** MDEV-5938: Exec_master_log_pos not updated at log rotate in parallel replication *** +--source include/have_innodb.inc +--source include/master-slave.inc + +--connection server_2 +--source include/stop_slave.inc +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET GLOBAL slave_parallel_threads=1; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t5 (a INT PRIMARY KEY, b INT); +INSERT INTO t5 VALUES (1,1); +INSERT INTO t5 VALUES (2,2), (3,8); +INSERT INTO t5 VALUES (4,16); +--save_master_pos + +--connection server_2 +--sync_with_master +let $io_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1); +let $io_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); +let $sql_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1); +let $sql_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); +--disable_query_log +eval SELECT IF('$io_file' = '$sql_file', "OK", "Not ok, $io_file <> $sql_file") AS test_check; +eval SELECT IF('$io_pos' = '$sql_pos', "OK", "Not ok, $io_pos <> $sql_pos") AS test_check; +--enable_query_log + +--connection server_1 +FLUSH LOGS; +--source include/wait_for_binlog_checkpoint.inc +--save_master_pos + +--connection server_2 +--sync_with_master +let $io_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1); +let $io_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); +let $sql_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1); +let $sql_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); +--disable_query_log +eval SELECT IF('$io_file' = '$sql_file', "OK", "Not ok, $io_file <> $sql_file") AS test_check; +eval SELECT IF('$io_pos' = '$sql_pos', "OK", "Not ok, $io_pos <> $sql_pos") AS test_check; +--enable_query_log + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t5; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_relay_max_extension.test b/mysql-test/suite/rpl/t/rpl_relay_max_extension.test index e1e087f2e0e59..acca2f6954cd4 100644 --- a/mysql-test/suite/rpl/t/rpl_relay_max_extension.test +++ b/mysql-test/suite/rpl/t/rpl_relay_max_extension.test @@ -28,6 +28,8 @@ # showed # +# MDEV-27721 rpl.rpl_relay_max_extension test is not FreeBSD-compatible +--source include/linux.inc --source include/have_innodb.inc --source include/have_binlog_format_row.inc --let $rpl_topology=1->2 diff --git a/mysql-test/suite/rpl/t/rpl_relayrotate.test b/mysql-test/suite/rpl/t/rpl_relayrotate.test index 720739e14c079..4de554d314359 100644 --- a/mysql-test/suite/rpl/t/rpl_relayrotate.test +++ b/mysql-test/suite/rpl/t/rpl_relayrotate.test @@ -1 +1,18 @@ ---source include/rpl_relayrotate.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +####################################################### +# Wrapper for rpl_relayrotate.test to allow multi # +# Engines to reuse test code. By JBM 2006-02-15 # +####################################################### +-- source include/have_innodb.inc +# Slow test, don't run during staging part +-- source include/not_staging.inc +-- source include/master-slave.inc + +let $engine_type=innodb; +-- source suite/rpl/include/rpl_relayrotate.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_img_sequence_full.cnf b/mysql-test/suite/rpl/t/rpl_row_img_sequence_full.cnf new file mode 100644 index 0000000000000..7104b4e450269 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_img_sequence_full.cnf @@ -0,0 +1,21 @@ +!include include/default_mysqld.cnf + +[mysqld.1] +log-slave-updates +innodb +gtid_domain_id=0 + +[mysqld.2] +log-slave-updates +innodb +gtid_domain_id=1 + +[mysqld.3] +log-slave-updates +innodb +gtid_domain_id=2 + +[ENV] +SERVER_MYPORT_1= @mysqld.1.port +SERVER_MYPORT_2= @mysqld.2.port +SERVER_MYPORT_3= @mysqld.3.port diff --git a/mysql-test/suite/rpl/t/rpl_row_img_sequence_full.test b/mysql-test/suite/rpl/t/rpl_row_img_sequence_full.test new file mode 100644 index 0000000000000..a0c6aa4dc7aad --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_img_sequence_full.test @@ -0,0 +1,48 @@ +# +# Purpose: +# The rpl_row_img_sequence group of tests verify that sequence MDL updates, +# i.e. NEXTVAL and SETVAL, respect the binlog_row_image variable value when +# written into the binary log. In particular, it ensures that only changed +# columns are written with MINIMAL image mode, and all columns are written +# otherwise. This test focuses on validating the behavior of +# binlog_row_img=FULL. +# +# Methodology +# After issuing a sequence update, ensure that both 1) it was replicated +# correctly, and 2) it was binlogged respective to the binlog_row_image value. +# The sequence table does not use caching to ensure each update is immediately +# binlogged. Each command is binlogged into its own unique log file, and the +# entirety of the file is analyzed for correctness of its sequence event. +# Specifically, mysqlbinlog is used in verbose mode so it outputs the columns +# which belong to the event, and the columns are analyzed to ensure the correct +# ones were logged. rpl_row_img_general_loop.inc is used to test with multiple +# chained replicas, varying engines between InnoDB and MyISAM. +# +# References: +# MDEV-28487: sequences not respect value of binlog_row_image with select +# nextval(seq_gen) +# + +--let $rpl_topology= 1->2->3 +--source include/rpl_init.inc +--source include/have_binlog_format_row.inc + +--connection server_1 +--source include/have_innodb.inc +--connection server_2 +--source include/have_innodb.inc +--connection server_3 +--source include/have_innodb.inc +--connection server_1 + +--echo # +--echo # binlog_row_image=FULL should write all columns to the binary log +--echo # +--let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y +--source include/rpl_row_img_set.inc +--let $expected_columns=(1,2,3,4,5,6,7,8) +--let row_img_test_script= include/rpl_row_img_sequence.inc +--source include/rpl_row_img_general_loop.inc + +--source include/rpl_end.inc +--echo # End of tests diff --git a/mysql-test/suite/rpl/t/rpl_row_img_sequence_min.cnf b/mysql-test/suite/rpl/t/rpl_row_img_sequence_min.cnf new file mode 100644 index 0000000000000..7104b4e450269 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_img_sequence_min.cnf @@ -0,0 +1,21 @@ +!include include/default_mysqld.cnf + +[mysqld.1] +log-slave-updates +innodb +gtid_domain_id=0 + +[mysqld.2] +log-slave-updates +innodb +gtid_domain_id=1 + +[mysqld.3] +log-slave-updates +innodb +gtid_domain_id=2 + +[ENV] +SERVER_MYPORT_1= @mysqld.1.port +SERVER_MYPORT_2= @mysqld.2.port +SERVER_MYPORT_3= @mysqld.3.port diff --git a/mysql-test/suite/rpl/t/rpl_row_img_sequence_min.test b/mysql-test/suite/rpl/t/rpl_row_img_sequence_min.test new file mode 100644 index 0000000000000..0a3b2827ffa25 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_img_sequence_min.test @@ -0,0 +1,52 @@ +# +# Purpose: +# The rpl_row_img_sequence group of tests verify that sequence MDL updates, +# i.e. NEXTVAL and SETVAL, respect the binlog_row_image variable value when +# written into the binary log. In particular, it ensures that only changed +# columns are written with MINIMAL image mode, and all columns are written +# otherwise. This test focuses on validating the behavior of +# binlog_row_img=MINIMAL. +# +# Methodology +# After issuing a sequence update, ensure that both 1) it was replicated +# correctly, and 2) it was binlogged respective to the binlog_row_image value. +# The sequence table does not use caching to ensure each update is immediately +# binlogged. Each command is binlogged into its own unique log file, and the +# entirety of the file is analyzed for correctness of its sequence event. +# Specifically, mysqlbinlog is used in verbose mode so it outputs the columns +# which belong to the event, and the columns are analyzed to ensure the correct +# ones were logged. rpl_row_img_general_loop.inc is used to test with multiple +# chained replicas, varying engines between InnoDB and MyISAM. +# +# References: +# MDEV-28487: sequences not respect value of binlog_row_image with select +# nextval(seq_gen) +# + +--let $rpl_topology= 1->2->3 +--source include/rpl_init.inc +--source include/have_binlog_format_row.inc + +--connection server_1 +--source include/have_innodb.inc +--connection server_2 +--source include/have_innodb.inc +--connection server_3 +--source include/have_innodb.inc +--connection server_1 + +--echo # +--echo # binlog_row_image=MINIMAL should write only columns 1 and 8 to the +--echo # binary log +--echo # +--let $row_img_set=server_1:MINIMAL:N,server_2:MINIMAL:Y,server_3:MINIMAL:Y +--source include/rpl_row_img_set.inc +--let $expected_columns=(1,8) +--let row_img_test_script= include/rpl_row_img_sequence.inc +--source include/rpl_row_img_general_loop.inc + +--let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y +--source include/rpl_row_img_set.inc + +--source include/rpl_end.inc +--echo # End of tests diff --git a/mysql-test/suite/rpl/t/rpl_row_img_sequence_noblob.cnf b/mysql-test/suite/rpl/t/rpl_row_img_sequence_noblob.cnf new file mode 100644 index 0000000000000..7104b4e450269 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_img_sequence_noblob.cnf @@ -0,0 +1,21 @@ +!include include/default_mysqld.cnf + +[mysqld.1] +log-slave-updates +innodb +gtid_domain_id=0 + +[mysqld.2] +log-slave-updates +innodb +gtid_domain_id=1 + +[mysqld.3] +log-slave-updates +innodb +gtid_domain_id=2 + +[ENV] +SERVER_MYPORT_1= @mysqld.1.port +SERVER_MYPORT_2= @mysqld.2.port +SERVER_MYPORT_3= @mysqld.3.port diff --git a/mysql-test/suite/rpl/t/rpl_row_img_sequence_noblob.test b/mysql-test/suite/rpl/t/rpl_row_img_sequence_noblob.test new file mode 100644 index 0000000000000..38ff469f22fc2 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_img_sequence_noblob.test @@ -0,0 +1,51 @@ +# +# Purpose: +# The rpl_row_img_sequence group of tests verify that sequence MDL updates, +# i.e. NEXTVAL and SETVAL, respect the binlog_row_image variable value when +# written into the binary log. In particular, it ensures that only changed +# columns are written with MINIMAL image mode, and all columns are written +# otherwise. This test focuses on validating the behavior of +# binlog_row_img=NOBLOB. +# +# Methodology +# After issuing a sequence update, ensure that both 1) it was replicated +# correctly, and 2) it was binlogged respective to the binlog_row_image value. +# The sequence table does not use caching to ensure each update is immediately +# binlogged. Each command is binlogged into its own unique log file, and the +# entirety of the file is analyzed for correctness of its sequence event. +# Specifically, mysqlbinlog is used in verbose mode so it outputs the columns +# which belong to the event, and the columns are analyzed to ensure the correct +# ones were logged. rpl_row_img_general_loop.inc is used to test with multiple +# chained replicas, varying engines between InnoDB and MyISAM. +# +# References: +# MDEV-28487: sequences not respect value of binlog_row_image with select +# nextval(seq_gen) +# + +--let $rpl_topology= 1->2->3 +--source include/rpl_init.inc +--source include/have_binlog_format_row.inc + +--connection server_1 +--source include/have_innodb.inc +--connection server_2 +--source include/have_innodb.inc +--connection server_3 +--source include/have_innodb.inc +--connection server_1 + +--echo # +--echo # binlog_row_image=NOBLOB should write all columns to the binary logs +--echo # +--let $row_img_set=server_1:NOBLOB:N,server_2:NOBLOB:Y,server_3:NOBLOB:Y +--source include/rpl_row_img_set.inc +--let $expected_columns=(1,2,3,4,5,6,7,8) +--let row_img_test_script= include/rpl_row_img_sequence.inc +--source include/rpl_row_img_general_loop.inc + +--let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y +--source include/rpl_row_img_set.inc + +--source include/rpl_end.inc +--echo # End of tests diff --git a/mysql-test/suite/rpl/t/rpl_row_lcase_tblnames.test b/mysql-test/suite/rpl/t/rpl_row_lcase_tblnames.test index 44c04dd62d3ef..7decd130a431d 100644 --- a/mysql-test/suite/rpl/t/rpl_row_lcase_tblnames.test +++ b/mysql-test/suite/rpl/t/rpl_row_lcase_tblnames.test @@ -3,10 +3,10 @@ # For details look into extra/rpl_tests/rpl_lower_case_table_names.test # --- source include/master-slave.inc --- source include/have_innodb.inc -- source include/not_windows.inc +-- source include/have_innodb.inc -- source include/have_binlog_format_row.inc +-- source include/master-slave.inc -- let $engine=InnoDB -- source include/rpl_lower_case_table_names.test diff --git a/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test b/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test new file mode 100644 index 0000000000000..d1bfbf25baed2 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test @@ -0,0 +1,103 @@ +# +# Purpose: +# This test validates that a slave's relay log format description event is +# not used to calculate the Seconds_Behind_Master time displayed by +# SHOW SLAVE STATUS. +# +# Methodology: +# Ensure that a slave's reported Seconds_Behind_Master does not point before +# a time in which we can prove that it has progressed beyond. The slave's +# relay log events are created using the timestamp at which the IO thread was +# created. Therefore, after starting the slave's IO thread, we sleep so any +# proceeding events are forced to have later timestamps. After sleeping, we run +# MDL statements on the master and save the time at which they are binlogged. +# Once the slave executes these MDL commands, we have proven that the slave has +# caught up to this saved timestamp. At this point, if the value of +# Seconds_Behind_Master points before the time in which the MDL events were +# logged, it is invalid. +# +# References: +# MDEV-16091: Seconds_Behind_Master spikes to millions of seconds +# +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_innodb.inc +--source include/master-slave.inc + +--connection slave +--source include/stop_slave.inc +SET @save_dbug= @@GLOBAL.debug_dbug; +SET @@global.debug_dbug="+d,pause_sql_thread_on_fde"; +--source include/start_slave.inc + +--let $sleep_time=2 +--echo # Future events must be logged at least $sleep_time seconds after +--echo # the slave starts +--sleep $sleep_time + +--connection master +--echo # Write events to ensure slave will be consistent with master +create table t1 (a int); +insert into t1 values (1); +--let $t_master_events_logged= `SELECT UNIX_TIMESTAMP()` + +--echo # Flush logs on master forces slave to generate a Format description +--echo # event in its relay log +flush logs; + +--connection slave +--echo # Ignore FDEs that happen before the CREATE/INSERT commands +SET DEBUG_SYNC='now WAIT_FOR paused_on_fde'; +SET DEBUG_SYNC='now SIGNAL sql_thread_continue'; +SET DEBUG_SYNC='now WAIT_FOR paused_on_fde'; +SET DEBUG_SYNC='now SIGNAL sql_thread_continue'; + +--echo # On the next FDE, the slave should have the master CREATE/INSERT events +SET DEBUG_SYNC='now WAIT_FOR paused_on_fde'; +select count(*)=1 from t1; + +--echo # The relay log FDE has been processed - here we check to ensure it was +--echo # not considered in Seconds_Behind_Master calculation +--connection slave1 +let $sbm= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1); +--let $t_now= `SELECT UNIX_TIMESTAMP()` + +# Ensure Seconds_Behind_Master does not point beyond when we have proven the +# events we have proven to have executed. The extra second is needed as a +# buffer because the recorded times are not exact with when the events were +# recorded on the master. +if(`select $sbm > $t_now - $t_master_events_logged + 1`) +{ + die "A relay log event was incorrectly used to set Seconds_Behind_Master"; +} + +--echo # Safely resume slave SQL thread + +--let $dbug_wait_state="debug sync point: now" +--echo # Prove SQL thread is in state $dbug_wait_state +--let $wait_condition= SELECT STATE=$dbug_wait_state from information_schema.PROCESSLIST where COMMAND="Slave_SQL" +--source include/wait_condition.inc + +SET @@global.debug_dbug="-d,pause_sql_thread_on_fde"; +SET DEBUG_SYNC='now SIGNAL sql_thread_continue'; + +# We have to wait for the SQL thread to acknowledge the sql_thread_continue +# signal. Otherwise the below RESET command can overwrite the signal before +# the SQL thread is notified to proceed, causing it to "permanently" become +# stuck awaiting the signal (until timeout is reached). + +--echo # Wait for SQL thread to continue into normal execution +--let $wait_condition= SELECT STATE!= $dbug_wait_state from information_schema.PROCESSLIST where COMMAND="Slave_SQL" +--source include/wait_condition.inc + +# Reset last sql_thread_continue signal +SET DEBUG_SYNC='RESET'; + +# Cleanup +--connection master +DROP TABLE t1; + +--connection slave +SET @@global.debug_dbug=$save_dbug; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test index 5c17bcb2344d1..c3cd918b5fc5f 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test @@ -1 +1,525 @@ ---source include/rpl_semi_sync.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +source include/not_embedded.inc; +source include/have_innodb.inc; +source include/master-slave.inc; + +let $engine_type= InnoDB; + +# Suppress warnings that might be generated during the test +connection master; +call mtr.add_suppression("Timeout waiting for reply of binlog"); +call mtr.add_suppression("Read semi-sync reply"); +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); +call mtr.add_suppression("mysqld: Got an error reading communication packets"); +connection slave; +call mtr.add_suppression("Master server does not support semi-sync"); +call mtr.add_suppression("Semi-sync slave .* reply"); +call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); +connection master; + +# wait for dying connections (if any) to disappear +let $wait_condition= select count(*) = 0 from information_schema.processlist where command='killed'; +--source include/wait_condition.inc + +# After fix of BUG#45848, semi-sync slave should not create any extra +# connections on master, save the count of connections before start +# semi-sync slave for comparison below. +let $_connections_normal_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); + +--echo # +--echo # Uninstall semi-sync plugins on master and slave +--echo # +connection slave; +source include/stop_slave.inc; +reset slave; +set global rpl_semi_sync_master_enabled= 0; +set global rpl_semi_sync_slave_enabled= 0; + +connection master; +reset master; +set global rpl_semi_sync_master_enabled= 0; +set global rpl_semi_sync_slave_enabled= 0; + +--echo # +--echo # Main test of semi-sync replication start here +--echo # + +connection master; + +set global rpl_semi_sync_master_timeout= 60000; # 60s + +echo [ default state of semi-sync on master should be OFF ]; +show variables like 'rpl_semi_sync_master_enabled'; + +echo [ enable semi-sync on master ]; +set global rpl_semi_sync_master_enabled = 1; +show variables like 'rpl_semi_sync_master_enabled'; + +echo [ status of semi-sync on master should be ON even without any semi-sync slaves ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +--echo # +--echo # BUG#45672 Semisync repl: ActiveTranx:insert_tranx_node: transaction node allocation failed +--echo # BUG#45673 Semisynch reports correct operation even if no slave is connected +--echo # + +# BUG#45672 When semi-sync is enabled on master, it would allocate +# transaction node even without semi-sync slave connected, and would +# finally result in transaction node allocation error. +# +# Semi-sync master will pre-allocate 'max_connections' transaction +# nodes, so here we do more than that much transactions to check if it +# will fail or not. +# select @@global.max_connections + 1; +let $i= `select @@global.max_connections + 1`; +disable_query_log; +eval create table t1 (a int) engine=$engine_type; +while ($i) +{ + eval insert into t1 values ($i); + dec $i; +} +drop table t1; +enable_query_log; + +# BUG#45673 +echo [ status of semi-sync on master should be OFF ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +# reset master to make sure the following test will start with a clean environment +reset master; + +connection slave; + +echo [ default state of semi-sync on slave should be OFF ]; +show variables like 'rpl_semi_sync_slave_enabled'; + +echo [ enable semi-sync on slave ]; +set global rpl_semi_sync_slave_enabled = 1; +show variables like 'rpl_semi_sync_slave_enabled'; +source include/start_slave.inc; + +connection master; + +# NOTE: Rpl_semi_sync_master_client will only be updated when +# semi-sync slave has started binlog dump request +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 1; +source include/wait_for_status_var.inc; + +echo [ initial master state after the semi-sync slave connected ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +replace_result $engine_type ENGINE_TYPE; +eval create table t1(a int) engine = $engine_type; + +echo [ master state after CREATE TABLE statement ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +# After fix of BUG#45848, semi-sync slave should not create any extra +# connections on master. +let $_connections_semisync_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); +replace_result $_connections_normal_slave CONNECTIONS_NORMAL_SLAVE $_connections_semisync_slave CONNECTIONS_SEMISYNC_SLAVE; +eval select $_connections_semisync_slave - $_connections_normal_slave as 'Should be 0'; + +echo [ insert records to table ]; +insert t1 values (10); +insert t1 values (9); +insert t1 values (8); +insert t1 values (7); +insert t1 values (6); +insert t1 values (5); +insert t1 values (4); +insert t1 values (3); +insert t1 values (2); +insert t1 values (1); + +echo [ master status after inserts ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +sync_slave_with_master; + +echo [ slave status after replicated inserts ]; +show status like 'Rpl_semi_sync_slave_status'; + +select count(distinct a) from t1; +select min(a) from t1; +select max(a) from t1; + +--echo +--echo # BUG#50157 +--echo # semi-sync replication crashes when replicating a transaction which +--echo # include 'CREATE TEMPORARY TABLE `MyISAM_t` SELECT * FROM `Innodb_t` ; + +connection master; +SET SESSION AUTOCOMMIT= 0; +CREATE TABLE t2(c1 INT) ENGINE=innodb; +sync_slave_with_master; + +connection master; +BEGIN; +--echo +--echo # Even though it is in a transaction, this statement is binlogged into binlog +--echo # file immediately. +--disable_warnings +CREATE TEMPORARY TABLE t3 SELECT c1 FROM t2 where 1=1; +--enable_warnings +--echo +--echo # These statements will not be binlogged until the transaction is committed +INSERT INTO t2 VALUES(11); +INSERT INTO t2 VALUES(22); +COMMIT; + +DROP TABLE t2, t3; +SET SESSION AUTOCOMMIT= 1; +sync_slave_with_master; + + +--echo # +--echo # Test semi-sync master will switch OFF after one transaction +--echo # timeout waiting for slave reply. +--echo # +connection slave; +source include/stop_slave.inc; + +connection master; +--source include/kill_binlog_dump_threads.inc +set global rpl_semi_sync_master_timeout= 5000; + +# The first semi-sync check should be on because after slave stop, +# there are no transactions on the master. +echo [ master status should be ON ]; + +let $status_var= Rpl_semi_sync_master_status; +let $status_var_value= ON; +source include/wait_for_status_var.inc; + +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 0; +source include/wait_for_status_var.inc; + +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +echo [ semi-sync replication of these transactions will fail ]; +insert into t1 values (500); + +# Wait for the semi-sync replication of this transaction to timeout +let $status_var= Rpl_semi_sync_master_status; +let $status_var_value= OFF; +source include/wait_for_status_var.inc; + +# The second semi-sync check should be off because one transaction +# times out during waiting. +echo [ master status should be OFF ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +# Semi-sync status on master is now OFF, so all these transactions +# will be replicated asynchronously. +delete from t1 where a=10; +delete from t1 where a=9; +delete from t1 where a=8; +delete from t1 where a=7; +delete from t1 where a=6; +delete from t1 where a=5; +delete from t1 where a=4; +delete from t1 where a=3; +delete from t1 where a=2; +delete from t1 where a=1; + +insert into t1 values (100); + +echo [ master status should be OFF ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +--echo # +--echo # Test semi-sync status on master will be ON again when slave catches up +--echo # + +# Save the master position for later use. +save_master_pos; + +connection slave; + +echo [ slave status should be OFF ]; +show status like 'Rpl_semi_sync_slave_status'; +source include/start_slave.inc; +sync_with_master; + +echo [ slave status should be ON ]; +show status like 'Rpl_semi_sync_slave_status'; + +select count(distinct a) from t1; +select min(a) from t1; +select max(a) from t1; + +connection master; + +# The master semi-sync status should be on again after slave catches up. +echo [ master status should be ON again after slave catches up ]; + +let $status_var= Rpl_semi_sync_master_status; +let $status_var_value= ON; +source include/wait_for_status_var.inc; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; +show status like 'Rpl_semi_sync_master_clients'; + +--echo # +--echo # Test disable/enable master semi-sync on the fly. +--echo # + +drop table t1; +sync_slave_with_master; + +source include/stop_slave.inc; + +--echo # +--echo # Flush status +--echo # +connection master; +echo [ Semi-sync master status variables before FLUSH STATUS ]; +SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; +SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; +# Do not write the FLUSH STATUS to binlog, to make sure we'll get a +# clean status after this. +FLUSH NO_WRITE_TO_BINLOG STATUS; +echo [ Semi-sync master status variables after FLUSH STATUS ]; +SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; +SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; + +connection master; + +source include/show_master_logs.inc; +show variables like 'rpl_semi_sync_master_enabled'; + +echo [ disable semi-sync on the fly ]; +set global rpl_semi_sync_master_enabled=0; +show variables like 'rpl_semi_sync_master_enabled'; +show status like 'Rpl_semi_sync_master_status'; + +echo [ enable semi-sync on the fly ]; +set global rpl_semi_sync_master_enabled=1; +show variables like 'rpl_semi_sync_master_enabled'; +show status like 'Rpl_semi_sync_master_status'; + +--echo # +--echo # Test RESET MASTER/SLAVE +--echo # + +connection slave; + +source include/start_slave.inc; + +connection master; + +replace_result $engine_type ENGINE_TYPE; +eval create table t1 (a int) engine = $engine_type; +drop table t1; + +sync_slave_with_master; + +echo [ test reset master ]; +connection master; + +reset master; + +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +connection slave; + +source include/stop_slave.inc; +reset slave; + +# Kill the dump thread on master for previous slave connection and +--source include/kill_binlog_dump_threads.inc + +connection slave; +source include/start_slave.inc; + +connection master; + +# Wait for dump thread to start, Rpl_semi_sync_master_clients will be +# 1 after dump thread started. +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 1; +source include/wait_for_status_var.inc; + +replace_result $engine_type ENGINE_TYPE; +eval create table t1 (a int) engine = $engine_type; +insert into t1 values (1); +insert into t1 values (2), (3); + +sync_slave_with_master; + +select * from t1; + +connection master; + +echo [ master semi-sync status should be ON ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +--echo # +--echo # Start semi-sync replication without SUPER privilege +--echo # +connection slave; +source include/stop_slave.inc; +reset slave; +connection master; +reset master; + +# Kill the dump thread on master for previous slave connection and wait for it to exit +--source include/kill_binlog_dump_threads.inc + +# Do not binlog the following statement because it will generate +# different events for ROW and STATEMENT format +set sql_log_bin=0; +grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; +flush privileges; +set sql_log_bin=1; +connection slave; +grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; +flush privileges; +change master to master_user='rpl',master_password='rpl_password'; +source include/start_slave.inc; +show status like 'Rpl_semi_sync_slave_status'; +connection master; + +# Wait for the semi-sync binlog dump thread to start +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 1; +source include/wait_for_status_var.inc; +echo [ master semi-sync should be ON ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; +insert into t1 values (4); +insert into t1 values (5); +echo [ master semi-sync should be ON ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +--echo # +--echo # Test semi-sync slave connect to non-semi-sync master +--echo # + +# Disable semi-sync on master +connection slave; +source include/stop_slave.inc; +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; + +connection master; + +# Kill the dump thread on master for previous slave connection and wait for it to exit +--source include/kill_binlog_dump_threads.inc + +echo [ Semi-sync status on master should be ON ]; +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 0; +source include/wait_for_status_var.inc; +show status like 'Rpl_semi_sync_master_status'; +let $status_var= Rpl_semi_sync_master_status; +let $status_var_value= ON; +source include/wait_for_status_var.inc; +set global rpl_semi_sync_master_enabled= 0; + +connection slave; +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +source include/start_slave.inc; +connection master; +insert into t1 values (8); +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 1; +source include/wait_for_status_var.inc; +echo [ master semi-sync clients should be 1, status should be OFF ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +sync_slave_with_master; +show status like 'Rpl_semi_sync_slave_status'; + +# Uninstall semi-sync plugin on master +connection slave; +source include/stop_slave.inc; +connection master; +set global rpl_semi_sync_master_enabled= 0; + +connection slave; +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +source include/start_slave.inc; + +connection master; +insert into t1 values (10); +sync_slave_with_master; + +--echo # +--echo # Test non-semi-sync slave connect to semi-sync master +--echo # + +connection master; +set global rpl_semi_sync_master_timeout= 5000; # 5s +set global rpl_semi_sync_master_enabled= 1; + +connection slave; +source include/stop_slave.inc; +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; + +echo [ uninstall semi-sync slave plugin ]; +set global rpl_semi_sync_slave_enabled= 0; + +echo [ reinstall semi-sync slave plugin and disable semi-sync ]; +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; +source include/start_slave.inc; +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; + +--echo # +--echo # Clean up +--echo # + +connection slave; +source include/stop_slave.inc; +set global rpl_semi_sync_slave_enabled= 0; + +connection master; +set global rpl_semi_sync_master_enabled= 0; + +connection slave; +change master to master_user='root',master_password=''; +source include/start_slave.inc; + +connection master; +drop table t1; +sync_slave_with_master; + +connection master; +drop user rpl@127.0.0.1; +flush privileges; +set global rpl_semi_sync_master_timeout= default; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_event.test b/mysql-test/suite/rpl/t/rpl_semi_sync_event.test index 4d96fd694ecde..d4df9b4041b96 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_event.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_event.test @@ -1,3 +1,4 @@ +source include/no_valgrind_without_big.inc; source include/not_embedded.inc; source include/have_innodb.inc; source include/master-slave.inc; diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test b/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test index 0505e88d758bf..6a691ae04f6e2 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test @@ -1,6 +1,7 @@ # ==== References ==== # -# MDEV-21117: recovery for --rpl-semi-sync-slave-enabled server +# MDEV-21117 recovery for --rpl-semi-sync-slave-enabled server +# MDEV-27760 event may non stop replicate in circular semisync setup # --source include/have_innodb.inc @@ -72,6 +73,7 @@ INSERT INTO t1 VALUES (1, 'dummy1'); --save_master_pos --echo # The gtid state on current master must be equal to ... SHOW VARIABLES LIKE 'gtid_binlog_pos'; +SHOW VARIABLES LIKE 'gtid_binlog_state'; SHOW VARIABLES LIKE 'gtid_slave_pos'; --connection server_1 @@ -80,6 +82,7 @@ SHOW VARIABLES LIKE 'gtid_slave_pos'; --echo # ... the gtid states on the slave: SHOW VARIABLES LIKE 'gtid_slave_pos'; SHOW VARIABLES LIKE 'gtid_binlog_pos'; +SHOW VARIABLES LIKE 'gtid_binlog_state'; --connection server_2 --let $case = 2 @@ -89,7 +92,9 @@ SHOW VARIABLES LIKE 'gtid_binlog_pos'; --echo # CRASH the new master, and FAILOVER back to the original # value 0 for the reverse server id 2 -> 1 failover --let $failover_to_slave=0 ---let $query_to_crash = INSERT INTO t1 VALUES (4, REPEAT("x", 4100)) +# Additionally through "foreign" server_id verify MDEV-27760's acceptance +# policy on the recient (to be promoted into master) server. +--let $query_to_crash = SET STATEMENT server_id=1 FOR INSERT INTO t1 VALUES (4, REPEAT("x", 4100)) --let $query2_to_crash= INSERT INTO t1 VALUES (5, REPEAT("x", 4100)) --echo # $query_to_crash --echo # $query2_to_crash @@ -100,18 +105,18 @@ SHOW VARIABLES LIKE 'gtid_binlog_pos'; --echo # Expected State post crash: --echo #================================================================= --echo # Master | Slave | ---echo # 0-2-6 (Not commited) | 0-2-6 (Received through semi-sync | +--echo # 0-1-6 (Not commited) | 0-1-6 (Received through semi-sync | --echo # | replication and applied) | --echo # 0-2-7 (Not commited) | 0-2-7 (Received through semi-sync | --echo # | replication and applied) | --echo #================================================================= ---let $log_search_pattern=truncated binlog file:.*slave.*000002 +--let $log_search_pattern=truncated binlog file:.*slave.*000002.* to remove transactions starting from GTID 0-1-6 --let $expected_rows_on_master= 3 --let $expected_rows_on_slave= 5 --source rpl_semi_sync_crash.inc --echo # ---echo # Server_1 promoted as master will send 0-2-6 and 0-2-7 to slave Server_2 +--echo # Server_1 promoted as master will send 0-1-6 and 0-2-7 to slave Server_2 --echo # --connection server_1 --let $rows_so_far=6 @@ -119,6 +124,7 @@ SHOW VARIABLES LIKE 'gtid_binlog_pos'; --save_master_pos --echo # The gtid state on current master must be equal to ... SHOW VARIABLES LIKE 'gtid_binlog_pos'; +SHOW VARIABLES LIKE 'gtid_binlog_state'; SHOW VARIABLES LIKE 'gtid_slave_pos'; --connection server_2 @@ -127,6 +133,7 @@ SHOW VARIABLES LIKE 'gtid_slave_pos'; --echo # ... the gtid states on the slave: SHOW VARIABLES LIKE 'gtid_slave_pos'; SHOW VARIABLES LIKE 'gtid_binlog_pos'; +SHOW VARIABLES LIKE 'gtid_binlog_state'; --let $diff_tables=server_1:t1, server_2:t1 --source include/diff_tables.inc @@ -154,7 +161,7 @@ SHOW VARIABLES LIKE 'gtid_binlog_pos'; --echo # 0-1-10 (Not commited - | | --echo # never sent to slave) | | --echo #================================================================= ---let $log_search_pattern=truncated binlog file:.*master.*000003 +--let $log_search_pattern=truncated binlog file:.*master.*000002.* to remove transactions starting from GTID 0-1-9 --let $expected_rows_on_master= 6 --let $expected_rows_on_slave= 7 --source rpl_semi_sync_crash.inc @@ -168,6 +175,7 @@ SHOW VARIABLES LIKE 'gtid_binlog_pos'; --source include/save_master_gtid.inc --echo # The gtid state on current master must be equal to ... SHOW VARIABLES LIKE 'gtid_binlog_pos'; +SHOW VARIABLES LIKE 'gtid_binlog_state'; SHOW VARIABLES LIKE 'gtid_slave_pos'; --connection server_1 @@ -176,6 +184,7 @@ SHOW VARIABLES LIKE 'gtid_slave_pos'; --echo # ... the gtid states on the slave: SHOW VARIABLES LIKE 'gtid_slave_pos'; SHOW VARIABLES LIKE 'gtid_binlog_pos'; +SHOW VARIABLES LIKE 'gtid_binlog_state'; --echo # --echo # Cleanup diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.cnf b/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.cnf new file mode 100644 index 0000000000000..2cf1b1786bd1a --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.cnf @@ -0,0 +1,14 @@ +!include ../my.cnf + +[mysqld.1] +log_warnings=9 + +[mysqld.2] +log_warnings=9 + +[mysqld.3] +log_warnings=9 + +[ENV] +SERVER_MYPORT_3= @mysqld.3.port +SERVER_MYSOCK_3= @mysqld.3.socket diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.inc b/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.inc new file mode 100644 index 0000000000000..a232f68540d5c --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.inc @@ -0,0 +1,163 @@ +# +# Helper file to ensure that a primary waits for all ACKS (or timeout) from its +# replicas before shutting down. +# +# Parameters: +# server_1_dbug (string) Debug setting for primary (server 1) +# server_2_dbug (string) Debug setting to simulate delay or error on +# the first replica (server 2) +# server_3_dbug (string) Debug setting to simulate delay or error on +# the second replica (server 3) +# semisync_timeout (int) Rpl_semi_sync_master_timeout to use +# server_2_expect_row_count (int) The number of rows expected on the first +# replica after the shutdown +# server_3_expect_row_count (int) The number of rows expected on the second +# replica after the shutdown +# + +--connection server_1 +let $log_error_file= `SELECT @@GLOBAL.log_error`; + +--echo #-- +--echo #-- Semi-sync Setup + +--connection server_1 +--save_master_pos + +echo #-- Enable semi-sync on slaves +let slave_last= 3; +--let i= 2 +while (`SELECT $i <= $slave_last`) +{ + --connection server_$i + --sync_with_master + + set global rpl_semi_sync_slave_enabled = 1; + source include/stop_slave.inc; + source include/start_slave.inc; + show status like 'Rpl_semi_sync_slave_status'; + + --inc $i +} + +--echo #-- Enable semi-sync on master +--connection server_1 +SET @@GLOBAL.rpl_semi_sync_master_enabled = 1; +--eval set @@global.rpl_semi_sync_master_timeout= $semisync_timeout + +--echo #-- Wait for master to recognize semi-sync slaves +--connection server_1 +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 2; +source include/wait_for_status_var.inc; + +--echo #-- Master should have semi-sync enabled with 2 connections +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_clients'; + +--echo #-- Prepare servers to simulate delay or error +--connection server_1 +--eval SET @@GLOBAL.debug_dbug= $server_1_dbug +--connection server_2 +--eval SET @@GLOBAL.debug_dbug= $server_2_dbug +--connection server_3 +--eval SET @@GLOBAL.debug_dbug= $server_3_dbug + +--echo #-- +--echo #-- Test begins + +--connection server_1 +--echo #-- Begin semi-sync transaction +--send INSERT INTO t1 VALUES (1) + +--connection server_1_con2 +--echo #-- Wait until master recognizes a connection is awaiting semi-sync ACK +let $status_var= Rpl_semi_sync_master_wait_sessions; +let $status_var_value= 1; +source include/wait_for_status_var.inc; +show status like 'Rpl_semi_sync_master_wait_sessions'; + +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait +EOF + +--echo #-- Give enough time after timeout/ack received to query yes_tx/no_tx +SET @@GLOBAL.debug_dbug= "+d,delay_shutdown_phase_2_after_semisync_wait"; + +--echo #-- Begin master shutdown +--send SHUTDOWN WAIT FOR ALL SLAVES + +--connection server_1 +--reap +--echo #-- Ensure either ACK was received (yes_tx=1) or timeout (no_tx=1) +show status like 'Rpl_semi_sync_master_yes_tx'; +show status like 'Rpl_semi_sync_master_no_tx'; + +--connection server_1_con2 +--reap +--source include/wait_until_disconnected.inc + +--echo # Check logs to ensure shutdown was delayed +--let SEARCH_FILE=$log_error_file +--let SEARCH_PATTERN=Delaying shutdown to await semi-sync ACK +--source include/search_pattern_in_file.inc + +--echo # Validate slave data is in correct state +--connection server_2 +--eval select count(*)=$server_2_expect_row_count from t1 +--connection server_3 +--eval select count(*)=$server_3_expect_row_count from t1 + +--echo # +--echo #-- Re-synchronize slaves with master and disable semi-sync + +--echo #-- Stop slaves + +--connection server_2 +--eval SET @@GLOBAL.debug_dbug= "$sav_server_2_dbug" +--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0 +source include/stop_slave.inc; + +--connection server_3 +--eval SET @@GLOBAL.debug_dbug= "$sav_server_3_dbug" +--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0 +source include/stop_slave.inc; + +--echo #-- Bring the master back up +--connection server_1_con2 +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart +EOF + +--enable_reconnect +--source include/wait_until_connected_again.inc + +--connection default +--enable_reconnect +--source include/wait_until_connected_again.inc + +--connection server_1 +--enable_reconnect +--source include/wait_until_connected_again.inc + +--eval SET @@GLOBAL.debug_dbug= "$sav_master_dbug" +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 0; +source include/wait_for_status_var.inc; +--eval SET @@GLOBAL.rpl_semi_sync_master_enabled = 0 +show status like 'Rpl_semi_sync_master_status'; + +TRUNCATE TABLE t1; +--save_master_pos + +--echo #-- Bring slaves back up +--let i= 2 +while (`SELECT $i <= $slave_last`) +{ + --connection server_$i + source include/start_slave.inc; + show status like 'Rpl_semi_sync_slave_status'; + --sync_with_master + SELECT COUNT(*)=0 from t1; + --inc $i +} diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.test b/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.test new file mode 100644 index 0000000000000..2ee7d0aa052c3 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.test @@ -0,0 +1,216 @@ +--source include/no_valgrind_without_big.inc + +# +# Purpose: +# This test validates that data is consistent between a primary and replica +# in semi-sync mode when the primary is issued `SHUTDOWN WAIT FOR SLAVES` +# during an active communication. More specifically, the primary should not +# kill the connection until it is sure a replica has received all binlog +# data, i.e. once the primary receives the ACK. If a primary is issued a +# shutdown before receiving an ACK, it should wait until either 1) the ACK is +# received, or 2) the configured timeout (rpl_semi_sync_master_timeout) is +# reached. +# +# Methodology: +# Using a topology consisting of one primary with two replicas, all in +# semi-sync mode, we use DEBUG_DBUG to simulate an error or delay on the +# replicas during an active communication while the primary is issued +# `SHUTDOWN WAIT FOR SLAVES`. We create four test cases to ensure the primary +# will correctly wait for the communication to finish, and use the semi-sync +# status variables Rpl_semi_sync_master_yes_tx and Rpl_semi_sync_master_no_tx +# to ensure the connection was not prematurely killed due to the shutdown. +# Test Case 1) If both replicas simulate a delay that is within the allowed +# timeout, the primary should delay killing the suspended thread +# until an ACK is received (Rpl_semi_sync_master_yes_tx should +# be 1). +# Test Case 2) If both replicas simulate an error before sending an ACK, the +# primary should delay killing the suspended thread until the +# the timeout is reached (Rpl_semi_sync_master_no_tx should be +# 1). +# Test Case 3) If one replica simulates a delay within the allowed timeout +# and the other simulates an error before sending an ACK, the +# primary should delay killing the suspended thread until it +# receives an ACK from the delayed slave +# (Rpl_semi_sync_master_yes_tx should be 1). +# Test Case 4) If a replica errors before sending an ACK, it will cause the +# IO thread to stop and handle the error. During error handling, +# if semi-sync is active, the replica will form a new connection +# with the primary to kill the active connection. However, if +# the primary is shutting down, it may kill the new connection, +# thereby leaving the active semi-sync connection in-tact. The +# slave should notice this, and not issue a `QUIT` command to +# the primary, which would otherwise be sent to kill an active +# connection. This test case validates that the slave does not +# send a `QUIT` in this case (Rpl_semi_sync_master_yes_tx should +# be 1 because server_3 will send the ACK within a valid +# timeout). +# +# References: +# MDEV-11853: semisync thread can be killed after sync binlog but before ACK +# in the sync state +# MDEV-28114: Semi-sync Master ACK Receiver Thread Can Error on COM_QUIT +# + +--echo ############################# +--echo # Common setup for all tests +--echo ############################# + +--echo # Note: Simulated slave delay is hardcoded to 800 milliseconds +--echo # Note: Simulated master shutdown delay is hardcoded to 500 milliseconds + +--source include/have_debug.inc +--let $rpl_topology=1->2, 1->3 +--source include/rpl_init.inc + +--connection server_1 + +--echo # Slaves which simulate an error will produce a timeout on the primary +call mtr.add_suppression("Timeout waiting"); +call mtr.add_suppression("did not exit"); + +--let $sav_master_timeout= `SELECT @@global.rpl_semi_sync_master_timeout` +--let $sav_enabled_master= `SELECT @@GLOBAL.rpl_semi_sync_master_enabled` +--let $sav_master_dbug= `SELECT @@GLOBAL.debug_dbug` + +--echo # Suppress slave errors related to the simulated error +--connection server_2 +call mtr.add_suppression("reply failed"); +call mtr.add_suppression("Replication event checksum verification"); +call mtr.add_suppression("Relay log write failure"); +call mtr.add_suppression("Failed to kill the active semi-sync connection"); +--let $sav_enabled_server_2=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled` +--let $sav_server_2_dbug= `SELECT @@GLOBAL.debug_dbug` + +--connection server_3 +call mtr.add_suppression("reply failed"); +call mtr.add_suppression("Replication event checksum verification"); +call mtr.add_suppression("Relay log write failure"); +call mtr.add_suppression("Failed to kill the active semi-sync connection"); +--let $sav_enabled_server_3=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled` +--let $sav_server_3_dbug= `SELECT @@GLOBAL.debug_dbug` + +--connection server_1 +CREATE TABLE t1 (a int); +--save_master_pos + +--let i= 2 +--let slave_last= 3 +while (`SELECT $i <= $slave_last`) +{ + --connection server_$i + --sync_with_master + --inc $i +} + +# Set up the connection used to issue the shutdown +--connect(server_1_con2, localhost, root,,) + + +--echo ############################# +--echo # Test cases +--echo ############################# + +--echo # +--echo # Test Case 1) If both replicas simulate a delay that is within the +--echo # allowed timeout, the primary should delay killing the suspended thread +--echo # until an ACK is received (Rpl_semi_sync_master_yes_tx should be 1). +--echo # +--let server_1_dbug= "" +--let server_2_dbug= "+d,simulate_delay_semisync_slave_reply" +--let server_3_dbug= "+d,simulate_delay_semisync_slave_reply" +--let semisync_timeout= 1600 +--let server_2_expect_row_count= 1 +--let server_3_expect_row_count= 1 +--source rpl_semi_sync_shutdown_await_ack.inc + +--echo # +--echo # Test Case 2) If both replicas simulate an error before sending an ACK, +--echo # the primary should delay killing the suspended thread until the +--echo # timeout is reached (Rpl_semi_sync_master_no_tx should be 1). +--echo # +--let server_1_dbug= "+d,mysqld_delay_kill_threads_phase_1" +--let server_2_dbug= "+d,corrupt_queue_event" +--let server_3_dbug= "+d,corrupt_queue_event" +--let semisync_timeout= 500 +--let server_2_expect_row_count= 0 +--let server_3_expect_row_count= 0 +--source rpl_semi_sync_shutdown_await_ack.inc + +--echo # +--echo # Test Case 3) If one replica simulates a delay within the allowed +--echo # timeout and the other simulates an error before sending an ACK, the +--echo # primary should delay killing the suspended thread until it receives an +--echo # ACK from the delayed slave (Rpl_semi_sync_master_yes_tx should be 1). +--echo # +--let server_1_dbug= "+d,mysqld_delay_kill_threads_phase_1" +--let server_2_dbug= "+d,corrupt_queue_event" +--let server_3_dbug= "+d,simulate_delay_semisync_slave_reply" +--let semisync_timeout= 1600 +--let server_2_expect_row_count= 0 +--let server_3_expect_row_count= 1 +--source rpl_semi_sync_shutdown_await_ack.inc + +--echo # +--echo # Test Case 4) If a replica errors before sending an ACK, it will cause +--echo # the IO thread to stop and handle the error. During error handling, if +--echo # semi-sync is active, the replica will form a new connection with the +--echo # primary to kill the active connection. However, if the primary is +--echo # shutting down, it may kill the new connection, thereby leaving the +--echo # active semi-sync connection in-tact. The slave should notice this, and +--echo # not issue a `QUIT` command to the primary, which would otherwise be +--echo # sent to kill an active connection. This test case validates that the +--echo # slave does not send a `QUIT` in this case (Rpl_semi_sync_master_yes_tx +--echo # should be 1 because server_3 will send the ACK within a valid timeout). +--echo # + +# mysqld_delay_kill_threads_phase1 ensures that server_2 will have enough time +# to start a new connection that has the intent to kill the active semi-sync +# connection +--let server_1_dbug= "+d,mysqld_delay_kill_threads_phase_1" + +# slave_delay_killing_semisync_connection ensures that the primary has force +# killed its current connection before it is able to issue `KILL` +--let server_2_dbug= "+d,corrupt_queue_event,slave_delay_killing_semisync_connection" +--let server_3_dbug= "+d,simulate_delay_semisync_slave_reply" +--let semisync_timeout= 1600 +--let server_2_expect_row_count= 0 +--let server_3_expect_row_count= 1 +--source rpl_semi_sync_shutdown_await_ack.inc + +--echo ############################# +--echo # Cleanup +--echo ############################# + +--connection server_2 +source include/stop_slave.inc; +source include/start_slave.inc; + +--disable_query_log +--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled = $sav_enabled_server_2 +--eval SET @@GLOBAL.debug_dbug= "$sav_server_2_dbug" +--enable_query_log + +--connection server_3 +source include/stop_slave.inc; +source include/start_slave.inc; + +--disable_query_log +--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled = $sav_enabled_server_3 +--eval SET @@GLOBAL.debug_dbug= "$sav_server_3_dbug" +--enable_query_log + + +--connection server_1 +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 0; +source include/wait_for_status_var.inc; + +--disable_query_log +--eval SET @@GLOBAL.rpl_semi_sync_master_timeout= $sav_master_timeout +--eval SET @@GLOBAL.rpl_semi_sync_master_enabled= $sav_enabled_master +--eval SET @@GLOBAL.debug_dbug= "$sav_master_dbug" +--enable_query_log + +drop table t1; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_wait_point.test b/mysql-test/suite/rpl/t/rpl_semi_sync_wait_point.test index dcff4030fdbb5..5eae91a55f25b 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_wait_point.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_wait_point.test @@ -23,8 +23,6 @@ SET @@global.rpl_semi_sync_master_wait_no_slave = 1; --echo # It's okay to see "Killed" but we should not see "Timeout" in the log. call mtr.add_suppression("Killed waiting for reply of binlog"); -call mtr.add_suppression("Run function 'after_commit' in plugin 'rpl_semi_sync_master' failed"); -call mtr.add_suppression("Run function 'after_sync' in plugin 'rpl_semi_sync_master' failed"); --echo # --echo # Test wait point = AFTER_COMMIT diff --git a/mysql-test/suite/rpl/t/rpl_skip_replication.test b/mysql-test/suite/rpl/t/rpl_skip_replication.test index 66fdbb8915a34..97fc961d43856 100644 --- a/mysql-test/suite/rpl/t/rpl_skip_replication.test +++ b/mysql-test/suite/rpl/t/rpl_skip_replication.test @@ -1 +1,402 @@ ---source include/rpl_skip_replication.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it. +# +# Usage: +# +# --let $use_remote_mysqlbinlog= 1 # optional +# --source suite/rpl/include/rpl_skip_replication.inc +# +# The script uses MYSQLBINLOG to verify certain results. +# By default, it uses binary logs directly. If it is undesirable, +# this behavior can be overridden by setting $use_remote_binlog +# as shown above. +# The value will be unset after every execution of the script, +# so if it is needed, it should be set explicitly before each call. +# + +--source include/have_innodb.inc +--source include/master-slave.inc + +connection slave; +# Test that SUPER is required to change @@replicate_events_marked_for_skip. +CREATE USER 'nonsuperuser'@'127.0.0.1'; +GRANT ALTER,CREATE,DELETE,DROP,EVENT,INSERT,PROCESS,REPLICATION SLAVE, + SELECT,UPDATE ON *.* TO 'nonsuperuser'@'127.0.0.1'; +connect(nonpriv, 127.0.0.1, nonsuperuser,, test, $SLAVE_MYPORT,); +connection nonpriv; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; +disconnect nonpriv; +connection slave; +DROP USER'nonsuperuser'@'127.0.0.1'; + +SELECT @@global.replicate_events_marked_for_skip; +--error ER_SLAVE_MUST_STOP +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; +SELECT @@global.replicate_events_marked_for_skip; +STOP SLAVE; +--error ER_GLOBAL_VARIABLE +SET SESSION replicate_events_marked_for_skip=FILTER_ON_MASTER; +SELECT @@global.replicate_events_marked_for_skip; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; +SELECT @@global.replicate_events_marked_for_skip; +START SLAVE; + +connection master; +SELECT @@skip_replication; +--error ER_LOCAL_VARIABLE +SET GLOBAL skip_replication=1; +SELECT @@skip_replication; + +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=myisam; +CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=innodb; +INSERT INTO t1(a) VALUES (1); +INSERT INTO t2(a) VALUES (1); + + +# Test that master-side filtering works. +SET skip_replication=1; + +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; +INSERT INTO t1(a) VALUES (2); +INSERT INTO t2(a) VALUES (2); + +# Inject a rotate event in the binlog stream sent to slave (otherwise we will +# fail sync_slave_with_master as the last event on the master is not present +# on the slave). +FLUSH NO_WRITE_TO_BINLOG LOGS; + +sync_slave_with_master; +connection slave; +SHOW TABLES; +SELECT * FROM t1; +SELECT * FROM t2; + +connection master; +DROP TABLE t3; + +FLUSH NO_WRITE_TO_BINLOG LOGS; +sync_slave_with_master; + + +# Test that slave-side filtering works. +connection slave; +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; +START SLAVE; + +connection master; +SET skip_replication=1; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; +INSERT INTO t1(a) VALUES (3); +INSERT INTO t2(a) VALUES (3); + +# Inject a rotate event in the binlog stream sent to slave (otherwise we will +# fail sync_slave_with_master as the last event on the master is not present +# on the slave). +FLUSH NO_WRITE_TO_BINLOG LOGS; + +sync_slave_with_master; +connection slave; +SHOW TABLES; +SELECT * FROM t1; +SELECT * FROM t2; + +connection master; +DROP TABLE t3; + +FLUSH NO_WRITE_TO_BINLOG LOGS; +sync_slave_with_master; +connection slave; +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=REPLICATE; +START SLAVE; + + +# Test that events with @@skip_replication=1 are not filtered when filtering is +# not set on slave. +connection master; +SET skip_replication=1; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; +INSERT INTO t3(a) VALUES(2); +sync_slave_with_master; +connection slave; +SELECT * FROM t3; +connection master; +DROP TABLE t3; + +# +# Test that the slave will preserve the @@skip_replication flag in its +# own binlog. +# + +TRUNCATE t1; +sync_slave_with_master; +connection slave; +RESET MASTER; + +connection master; +SET skip_replication=0; +INSERT INTO t1 VALUES (1,0); +SET skip_replication=1; +INSERT INTO t1 VALUES (2,0); +SET skip_replication=0; +INSERT INTO t1 VALUES (3,0); + +sync_slave_with_master; +connection slave; +# Since slave has @@replicate_events_marked_for_skip=REPLICATE, it should have +# applied all events. +SELECT * FROM t1 ORDER by a; + +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; +let $SLAVE_DATADIR= `select @@datadir`; + +connection master; +TRUNCATE t1; + +# Now apply the slave binlog to the master, to check that both the slave +# and mysqlbinlog will preserve the @@skip_replication flag. + +--let $mysqlbinlog_args= $SLAVE_DATADIR/slave-bin.000001 +if ($use_remote_mysqlbinlog) +{ + --let $mysqlbinlog_args= --read-from-remote-server --protocol=tcp --host=127.0.0.1 --port=$SLAVE_MYPORT -uroot slave-bin.000001 + --let $use_remote_mysqlbinlog= 0 +} +--exec $MYSQL_BINLOG $mysqlbinlog_args > $MYSQLTEST_VARDIR/tmp/rpl_skip_replication.binlog +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/rpl_skip_replication.binlog + +# The master should have all three events. +SELECT * FROM t1 ORDER by a; + +# The slave should be missing event 2, which is marked with the +# @@skip_replication flag. + +connection slave; +START SLAVE; + +connection master; +sync_slave_with_master; + +connection slave; +SELECT * FROM t1 ORDER by a; + +# +# Test that @@sql_slave_skip_counter does not count skipped @@skip_replication +# events. +# + +connection master; +TRUNCATE t1; + +sync_slave_with_master; +connection slave; +STOP SLAVE; +# We will skip two INSERTs (in addition to any skipped due to +# @@skip_replication). Since from 5.5 every statement is wrapped in +# BEGIN ... END, we need to skip 6 events for this. +SET GLOBAL sql_slave_skip_counter=6; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; +START SLAVE; + +connection master; +# Need to fix @@binlog_format to get consistent event count. +SET @old_binlog_format= @@binlog_format; +SET binlog_format= statement; +SET skip_replication=0; +INSERT INTO t1 VALUES (1,5); +SET skip_replication=1; +INSERT INTO t1 VALUES (2,5); +SET skip_replication=0; +INSERT INTO t1 VALUES (3,5); +INSERT INTO t1 VALUES (4,5); +SET binlog_format= @old_binlog_format; + +sync_slave_with_master; +connection slave; + +# The slave should have skipped the first three inserts (number 1 and 3 due +# to @@sql_slave_skip_counter=2, number 2 due to +# @@replicate_events_marked_for_skip=FILTER_ON_SLAVE). So only number 4 +# should be left. +SELECT * FROM t1; + + +# +# Check that BINLOG statement preserves the @@skip_replication flag. +# +connection slave; +# Need row @@binlog_format for BINLOG statements containing row events. +--source include/stop_slave.inc +SET @old_slave_binlog_format= @@global.binlog_format; +SET GLOBAL binlog_format= row; +--source include/start_slave.inc + +connection master; +TRUNCATE t1; + +SET @old_binlog_format= @@binlog_format; +SET binlog_format= row; +# Format description log event. +BINLOG 'wlZOTw8BAAAA8QAAAPUAAAAAAAQANS41LjIxLU1hcmlhREItZGVidWctbG9nAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAA2QAEGggAAAAICAgCAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAA371saA=='; +# INSERT INTO t1 VALUES (1,8) # with @@skip_replication=1 +BINLOG 'wlZOTxMBAAAAKgAAAGMBAAAAgCkAAAAAAAEABHRlc3QAAnQxAAIDAwAC +wlZOTxcBAAAAJgAAAIkBAAAAgCkAAAAAAAEAAv/8AQAAAAgAAAA='; +# INSERT INTO t1 VALUES (2,8) # with @@skip_replication=0 +BINLOG 'wlZOTxMBAAAAKgAAADwCAAAAACkAAAAAAAEABHRlc3QAAnQxAAIDAwAC +wlZOTxcBAAAAJgAAAGICAAAAACkAAAAAAAEAAv/8AgAAAAgAAAA='; +SET binlog_format= @old_binlog_format; + +SELECT * FROM t1 ORDER BY a; +sync_slave_with_master; +connection slave; +# Slave should have only the second insert, the first should be ignored due to +# the @@skip_replication flag. +SELECT * FROM t1 ORDER by a; + +--source include/stop_slave.inc +SET GLOBAL binlog_format= @old_slave_binlog_format; +--source include/start_slave.inc + + +# Test that it is not possible to change @@skip_replication inside a +# transaction or statement, thereby replicating only parts of statements +# or transactions. +connection master; +SET skip_replication=0; + +BEGIN; +--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION +SET skip_replication=0; +--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION +SET skip_replication=1; +ROLLBACK; +SET skip_replication=1; +BEGIN; +--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION +SET skip_replication=0; +--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION +SET skip_replication=1; +COMMIT; +SET autocommit=0; +INSERT INTO t2(a) VALUES(100); +--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION +SET skip_replication=1; +ROLLBACK; +SET autocommit=1; + +SET skip_replication=1; +--delimiter | +CREATE FUNCTION foo (x INT) RETURNS INT BEGIN SET SESSION skip_replication=x; RETURN x; END| +CREATE PROCEDURE bar(x INT) BEGIN SET SESSION skip_replication=x; END| +CREATE FUNCTION baz (x INT) RETURNS INT BEGIN CALL bar(x); RETURN x; END| +--delimiter ; +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION +SELECT foo(0); +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION +SELECT baz(0); +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION +SET @a= foo(1); +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION +SET @a= baz(1); +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION +UPDATE t2 SET b=foo(0); +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION +UPDATE t2 SET b=baz(0); +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION +INSERT INTO t1 VALUES (101, foo(1)); +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION +INSERT INTO t1 VALUES (101, baz(0)); +SELECT @@skip_replication; +CALL bar(0); +SELECT @@skip_replication; +CALL bar(1); +SELECT @@skip_replication; +DROP FUNCTION foo; +DROP PROCEDURE bar; +DROP FUNCTION baz; + + +# Test that master-side filtering happens on the master side, and that +# slave-side filtering happens on the slave. + +# First test that events do not reach the slave when master-side filtering +# is configured. Do this by replicating first with only the IO thread running +# and master-side filtering; then change to no filtering and start the SQL +# thread. This should still skip the events, as master-side filtering +# means the events never reached the slave. +connection master; +SET skip_replication= 0; +TRUNCATE t1; +sync_slave_with_master; +connection slave; +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; +START SLAVE IO_THREAD; +connection master; +SET skip_replication= 1; +INSERT INTO t1(a) VALUES (1); +SET skip_replication= 0; +INSERT INTO t1(a) VALUES (2); +--source include/save_master_pos.inc +connection slave; +--source include/sync_io_with_master.inc +STOP SLAVE IO_THREAD; +SET GLOBAL replicate_events_marked_for_skip=REPLICATE; +START SLAVE; +connection master; +sync_slave_with_master; +connection slave; +# Now only the second insert of (2) should be visible, as the first was +# filtered on the master, so even though the SQL thread ran without skipping +# events, it will never see the event in the first place. +SELECT * FROM t1; + +# Now tests that when slave-side filtering is configured, events _do_ reach +# the slave. +connection master; +SET skip_replication= 0; +TRUNCATE t1; +sync_slave_with_master; +connection slave; +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; +START SLAVE IO_THREAD; +connection master; +SET skip_replication= 1; +INSERT INTO t1(a) VALUES (1); +SET skip_replication= 0; +INSERT INTO t1(a) VALUES (2); +--source include/save_master_pos.inc +connection slave; +--source include/sync_io_with_master.inc +STOP SLAVE IO_THREAD; +SET GLOBAL replicate_events_marked_for_skip=REPLICATE; +START SLAVE; +connection master; +sync_slave_with_master; +connection slave; +# Now both inserts should be visible. Since filtering was configured to be +# slave-side, the event is in the relay log, and when the SQL thread ran we +# had disabled filtering again. +SELECT * FROM t1 ORDER BY a; + + +# Clean up. +connection master; +SET skip_replication=0; +DROP TABLE t1,t2; +connection slave; +STOP SLAVE; +SET GLOBAL replicate_events_marked_for_skip=REPLICATE; +START SLAVE; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_special_charset.test b/mysql-test/suite/rpl/t/rpl_special_charset.test index fa19a17b1e4f2..641aa483d32b7 100644 --- a/mysql-test/suite/rpl/t/rpl_special_charset.test +++ b/mysql-test/suite/rpl/t/rpl_special_charset.test @@ -1 +1,32 @@ ---source include/rpl_special_charset.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +################################################################################ +# Bug#19855907 IO THREAD AUTHENTICATION ISSUE WITH SOME CHARACTER SETS +# Problem: IO thread fails to connect to master if servers are configured with +# special character sets like utf16, utf32, ucs2. +# +# Analysis: MySQL server does not support few special character sets like +# utf16,utf32 and ucs2 as "client's character set"(eg: utf16,utf32, ucs2). +# When IO thread is trying to connect to Master, it sets server's character +# set as client's character set. When Slave server is started with these +# special character sets, IO thread (a connection to Master) fails because +# of the above said reason. +# +# Fix: If server's character set is not supported as client's character set, +# then set default's client character set(latin1) as client's character set. +############################################################################### +--source include/master-slave.inc +call mtr.add_suppression("'utf16' can not be used as client character set"); +CREATE TABLE t1(i VARCHAR(20)); +INSERT INTO t1 VALUES (0xFFFF); +--sync_slave_with_master +--let diff_tables=master:t1, slave:t1 +--source include/diff_tables.inc +# Cleanup +--connection master +DROP TABLE t1; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_sporadic_master.test b/mysql-test/suite/rpl/t/rpl_sporadic_master.test index 397756af3965d..ad4c44cbf7409 100644 --- a/mysql-test/suite/rpl/t/rpl_sporadic_master.test +++ b/mysql-test/suite/rpl/t/rpl_sporadic_master.test @@ -1 +1,32 @@ ---source include/rpl_sporadic_master.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# test to see if replication can continue when master sporadically fails on +# COM_BINLOG_DUMP and additionally limits the number of events per dump + +source include/master-slave.inc; + +create table t2(n int); +create table t1(n int not null auto_increment primary key); +insert into t1 values (NULL),(NULL); +truncate table t1; +# We have to use 4 in the following to make this test work with all table types +insert into t1 values (4),(NULL); +sync_slave_with_master; +--source include/stop_slave.inc +--source include/start_slave.inc +connection master; +insert into t1 values (NULL),(NULL); +flush logs; +truncate table t1; +insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL); +sync_slave_with_master; +select * from t1 ORDER BY n; +connection master; +drop table t1,t2; +sync_slave_with_master; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_ssl.test b/mysql-test/suite/rpl/t/rpl_ssl.test index c4a534b929495..0420a6c8c2d4e 100644 --- a/mysql-test/suite/rpl/t/rpl_ssl.test +++ b/mysql-test/suite/rpl/t/rpl_ssl.test @@ -1 +1,116 @@ ---source include/rpl_ssl.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +source include/no_valgrind_without_big.inc; +source include/have_ssl_communication.inc; +source include/master-slave.inc; + +# create a user for replication that requires ssl encryption +connection master; +create user replssl@localhost; +grant replication slave on *.* to replssl@localhost require ssl; +create table t1 (t int auto_increment, KEY(t)); + +sync_slave_with_master; + +# Set slave to use SSL for connection to master +stop slave; +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +eval change master to + master_user='replssl', + master_password='', + master_ssl=1, + master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem', + master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem', + master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem'; +start slave; + +# Switch to master and insert one record, then sync it to slave +connection master; +insert into t1 values(1); +sync_slave_with_master; + +# The record should now be on slave +select * from t1; + +# The slave is synced and waiting/reading from master +# SHOW SLAVE STATUS will show "Waiting for master to send event" +let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Crl, Master_SSL_Crlpath, Master_SSL_Cert, Master_SSL_Key; +source include/show_slave_status.inc; +source include/check_slave_is_running.inc; + +# Stop the slave, as reported in bug#21871 it would hang +STOP SLAVE; + +select * from t1; + +# Do the same thing a number of times +disable_query_log; +disable_result_log; +# 2007-11-27 mats Bug #32756 Starting and stopping the slave in a loop can lose rows +# After discussions with Engineering, I'm disabling this part of the test to avoid it causing +# red trees. +disable_parsing; +let $i= 100; +while ($i) +{ + start slave; + connection master; + insert into t1 values (NULL); + select * from t1; # Some variance + connection slave; + select * from t1; # Some variance + stop slave; + dec $i; +} +enable_parsing; +START SLAVE; +enable_query_log; +enable_result_log; +connection master; +# INSERT one more record to make sure +# the sync has something to do +insert into t1 values (NULL); +let $master_count= `select count(*) from t1`; + +sync_slave_with_master; +--source include/wait_for_slave_to_start.inc +source include/show_slave_status.inc; +source include/check_slave_is_running.inc; + +let $slave_count= `select count(*) from t1`; + +if ($slave_count != $master_count) +{ + echo master and slave differed in number of rows; + echo master: $master_count; + echo slave: $slave_count; + + connection master; + select count(*) t1; + select * from t1; + connection slave; + select count(*) t1; + select * from t1; + query_vertical show slave status; +} + +connection master; +drop user replssl@localhost; +drop table t1; +sync_slave_with_master; + +--source include/stop_slave.inc +CHANGE MASTER TO + master_user = 'root', + master_ssl = 0, + master_ssl_ca = '', + master_ssl_cert = '', + master_ssl_key = ''; + +--echo End of 5.0 tests +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_1.test b/mysql-test/suite/rpl/t/rpl_start_alter_1.test new file mode 100644 index 0000000000000..9ce061f1031f1 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_1.test @@ -0,0 +1,33 @@ +# +# Start Alter with Legacy Replication +# +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/master-slave.inc + +--connection master +--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase` +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; +--connection slave +--let $gtid_strict_mode= `select @@gtid_strict_mode` +set global gtid_strict_mode=1; + +--echo # Legacy Master Slave +--let $domain_1=0 +--let $domain_2=0 +--let $M_port= $MASTER_MYPORT +--let $S_port= $SLAVE_MYPORT +--let $sync_slave=1 + +--source include/start_alter_include.inc +--connection master +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc +--eval set global gtid_strict_mode = $gtid_strict_mode; + +--connection master +--eval set global binlog_alter_two_phase=$binlog_alter_two_phase; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_2.test b/mysql-test/suite/rpl/t/rpl_start_alter_2.test new file mode 100644 index 0000000000000..457409c51a6c6 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_2.test @@ -0,0 +1,53 @@ +# +# Start Alter with Parallel Replication +# 1 domain id +# |Concurrent alters| < |Parallel workers on slave| +# |x| denotes number of entities it encloses +# +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/master-slave.inc +--connection master +--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase` +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; +--connection slave +--let $gtid_strict_mode= `select @@gtid_strict_mode` +--let $slave_parallel_threads= `select @@slave_parallel_threads` +--let $slave_parallel_mode= `select @@slave_parallel_mode` +set global gtid_strict_mode=1; + + +--connection slave +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +set global slave_parallel_mode=optimistic; +change master to master_use_gtid=slave_pos; +--source include/start_slave.inc + +--echo # Parallel Slave +--connection master +--let $master_server= "master" +--let $domain_1=0 +--let $domain_2=0 +--let $M_port= $MASTER_MYPORT +--let $S_port= $SLAVE_MYPORT +--let $sync_slave=1 +--source include/start_alter_include.inc +--connection master +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc + +--echo # cleanup +--source include/stop_slave.inc +--eval set global slave_parallel_threads = $slave_parallel_threads; +--eval set global slave_parallel_mode = $slave_parallel_mode; +--eval set global gtid_strict_mode = $gtid_strict_mode; +set global gtid_domain_id= 0; +--source include/start_slave.inc + +--connection master +--eval set global binlog_alter_two_phase=$binlog_alter_two_phase; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_3.test b/mysql-test/suite/rpl/t/rpl_start_alter_3.test new file mode 100644 index 0000000000000..b280aeb9e5ef9 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_3.test @@ -0,0 +1,54 @@ +# +# Start Alter with Parallel Replication +# 1 domain id +# |Concurrent alters| >= |Parallel workers on slave| +# |x| denotes number of entities it encloses +# +--source include/have_log_bin.inc +--source include/have_innodb.inc +--source include/master-slave.inc +--source include/have_debug.inc +--connection master +--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase` +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; +--connection slave +--let $gtid_strict_mode= `select @@gtid_strict_mode` +--let $slave_parallel_threads= `select @@slave_parallel_threads` +--let $slave_parallel_mode= `select @@slave_parallel_mode` +set global gtid_strict_mode=1; + + +--connection slave +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=4; +set global slave_parallel_mode=optimistic; +change master to master_use_gtid=slave_pos; +--source include/start_slave.inc + +--echo # Parallel Slave +--connection master +--let $master_server= "master" +--let $domain_1=0 +--let $domain_2=0 +--let $M_port= $MASTER_MYPORT +--let $S_port= $SLAVE_MYPORT +--let $sync_slave=1 +--source include/start_alter_include.inc +--connection master +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc + +--echo # cleanup +--source include/stop_slave.inc +--eval set global slave_parallel_threads = $slave_parallel_threads; +--eval set global slave_parallel_mode = $slave_parallel_mode; +--eval set global gtid_strict_mode = $gtid_strict_mode; +set global gtid_domain_id= 0; +--source include/start_slave.inc + +--connection master +--eval set global binlog_alter_two_phase=$binlog_alter_two_phase; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_4.test b/mysql-test/suite/rpl/t/rpl_start_alter_4.test new file mode 100644 index 0000000000000..8c67b50a7bf21 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_4.test @@ -0,0 +1,54 @@ +# +# Start Alter with Parallel Replication +# 2 domain id +# |Concurrent alters| < |Parallel workers on slave| +# |x| denotes number of entities it encloses +# +--source include/have_log_bin.inc +--source include/have_innodb.inc +--source include/master-slave.inc +--source include/have_debug.inc +--connection master +--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase` +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; +--connection slave +--let $gtid_strict_mode= `select @@gtid_strict_mode` +--let $slave_parallel_threads= `select @@slave_parallel_threads` +--let $slave_parallel_mode= `select @@slave_parallel_mode` +set global gtid_strict_mode=1; + +--connection slave +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +set global slave_parallel_mode=optimistic; +change master to master_use_gtid=slave_pos; +--source include/start_slave.inc + +--echo # Parallel Slave +--connection master +--let $master_server= "master" +--let $domain_1=11 +--let $domain_2=12 +--let $M_port= $MASTER_MYPORT +--let $S_port= $SLAVE_MYPORT +--let $sync_slave=1 +--source include/start_alter_include.inc +--connection master +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc + +--echo # cleanup +--source include/stop_slave.inc +--eval set global slave_parallel_threads = $slave_parallel_threads; +--eval set global slave_parallel_mode = $slave_parallel_mode; +--eval set global gtid_strict_mode = $gtid_strict_mode; +set global gtid_domain_id= 0; +--source include/start_slave.inc + +--connection master +--eval set global binlog_alter_two_phase=$binlog_alter_two_phase; +set global gtid_domain_id= 0; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_5.test b/mysql-test/suite/rpl/t/rpl_start_alter_5.test new file mode 100644 index 0000000000000..10d0d523a6802 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_5.test @@ -0,0 +1,54 @@ +# +# Start Alter with Parallel Replication +# 2 domain id +# |Concurrent alters| >= |Parallel workers on slave| +# |x| denotes number of entities it encloses +# +--source include/have_log_bin.inc +--source include/have_innodb.inc +--source include/master-slave.inc +--source include/have_debug.inc +--connection master +--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase` +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; +--connection slave +--let $gtid_strict_mode= `select @@gtid_strict_mode` +--let $slave_parallel_threads= `select @@slave_parallel_threads` +--let $slave_parallel_mode= `select @@slave_parallel_mode` +set global gtid_strict_mode=1; + +--connection slave +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=4; +set global slave_parallel_mode=optimistic; +change master to master_use_gtid=slave_pos; +--source include/start_slave.inc + +--echo # Parallel Slave +--connection master +--let $master_server= "master" +--let $domain_1=11 +--let $domain_2=12 +--let $M_port= $MASTER_MYPORT +--let $S_port= $SLAVE_MYPORT +--let $sync_slave=1 +--source include/start_alter_include.inc +--connection master +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc + +--echo # cleanup +--source include/stop_slave.inc +--eval set global slave_parallel_threads = $slave_parallel_threads; +--eval set global slave_parallel_mode = $slave_parallel_mode; +--eval set global gtid_strict_mode = $gtid_strict_mode; +set global gtid_domain_id= 0; +--source include/start_slave.inc + +--connection master +--eval set global binlog_alter_two_phase=$binlog_alter_two_phase; +set global gtid_domain_id= 0; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_6.test b/mysql-test/suite/rpl/t/rpl_start_alter_6.test new file mode 100644 index 0000000000000..fc49ea4a406de --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_6.test @@ -0,0 +1,58 @@ +# +# Start Alter with Parallel Replication +# 2 domain id +# |Concurrent alters| < |Parallel workers on slave| +# |x| denotes number of entities it encloses +# slave_domain_parallel_threads < |Concurrent Alters| +# +--source include/have_log_bin.inc +--source include/have_innodb.inc +--source include/master-slave.inc +--source include/have_debug.inc +--connection master +--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase` +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; +--connection slave +--let $gtid_strict_mode= `select @@gtid_strict_mode` +--let $slave_parallel_threads= `select @@slave_parallel_threads` +--let $slave_parallel_mode= `select @@slave_parallel_mode` +--let $slave_domain_parallel_threads= `select @@slave_domain_parallel_threads` +set global gtid_strict_mode=1; + +--connection slave +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +set global slave_parallel_mode=optimistic; +set global slave_domain_parallel_threads=3; +change master to master_use_gtid=slave_pos; +--source include/start_slave.inc + +--echo # Parallel Slave +--connection master +--let $master_server= "master" +--let $domain_1=11 +--let $domain_2=12 +--let $M_port= $MASTER_MYPORT +--let $S_port= $SLAVE_MYPORT +--let $sync_slave=1 +--source include/start_alter_include.inc +--connection master +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc + +--echo # cleanup +--source include/stop_slave.inc +--eval set global slave_parallel_threads = $slave_parallel_threads; +--eval set global slave_parallel_mode = $slave_parallel_mode; +--eval set global gtid_strict_mode = $gtid_strict_mode; +--eval set global slave_domain_parallel_threads = $slave_domain_parallel_threads; +set global gtid_domain_id= 0; +--source include/start_slave.inc + +--connection master +--eval set global binlog_alter_two_phase=$binlog_alter_two_phase; +set global gtid_domain_id= 0; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_7.cnf b/mysql-test/suite/rpl/t/rpl_start_alter_7.cnf new file mode 100644 index 0000000000000..a0f6dc5710c7e --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_7.cnf @@ -0,0 +1,19 @@ +!include ../my.cnf + +[mysqld.1] +log-bin +log-slave-updates + +[mysqld.2] +log-bin +log-slave-updates + +[mysqld.3] +log-bin +log-slave-updates + + +[ENV] +SERVER_MYPORT_1= @mysqld.1.port +SERVER_MYPORT_2= @mysqld.2.port +SERVER_MYPORT_3= @mysqld.3.port diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_7.test b/mysql-test/suite/rpl/t/rpl_start_alter_7.test new file mode 100644 index 0000000000000..7225c075ea74b --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_7.test @@ -0,0 +1,112 @@ +# +# Start Alter with Parallel Replication, With 2 sources +# 2 domain id (From 2 sources) +# |Concurrent alters| >= |Parallel workers on slave| +# |x| denotes number of entities it encloses +# +--source include/have_log_bin.inc +--source include/have_innodb.inc +--source include/have_debug.inc +--connect (server_1,127.0.0.1,root,,,$SERVER_MYPORT_1) +--connect (server_2,127.0.0.1,root,,,$SERVER_MYPORT_2) +--connect (server_3,127.0.0.1,root,,,$SERVER_MYPORT_3) + +--connection server_1 +--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase` +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; + +--connection server_2 +stop slave; +set global binlog_alter_two_phase=true; + +--connection server_3 +--let $gtid_strict_mode= `select @@gtid_strict_mode` +--let $slave_parallel_threads= `select @@slave_parallel_threads` +--let $slave_parallel_mode= `select @@slave_parallel_mode` +SET GLOBAL slave_parallel_threads=8; +set global slave_parallel_mode=optimistic; +set global gtid_strict_mode=1; + + +--disable_warnings +--disable_query_log +--replace_result $SERVER_MYPORT_1 MYPORT_1 +eval change master 'm1' to master_port=$SERVER_MYPORT_1 , master_host='127.0.0.1', master_user='root', master_use_gtid=slave_pos; +--replace_result $SERVER_MYPORT_2 MYPORT_2 +eval change master 'm2' to master_port=$SERVER_MYPORT_2 , master_host='127.0.0.1', master_user='root', master_use_gtid=slave_pos; +--enable_query_log +--enable_warnings + +--connection server_1 +set gtid_domain_id= 11; +create database s1; +use s1; +--let $domain_1=11 +--let $domain_2=11 +--let $M_port= $SERVER_MYPORT_1 +--let $S_port= $SERVER_MYPORT_3 +--let $sync_slave=0 +--let $db_name=s1 +--source include/start_alter_include.inc +--connection server_1 +drop database s1; +select @@gtid_binlog_pos; +--let $master_pos_1= `SELECT @@gtid_binlog_pos` + +--connection server_2 +set gtid_domain_id= 12; +create database s2; +use s2; +--let $domain_1=12 +--let $domain_2=12 +--let $M_port= $SERVER_MYPORT_2 +--let $S_port= $SERVER_MYPORT_3 +--let $sync_slave=0 +--let $db_name=s2 +--source include/start_alter_include.inc +--connection server_2 +drop database s2; +select @@gtid_binlog_pos; +--let $master_pos_2= `SELECT @@gtid_binlog_pos` + +--connection server_3 +start all slaves; +set default_master_connection = 'm1'; +--source include/wait_for_slave_to_start.inc +set default_master_connection = 'm2'; +--source include/wait_for_slave_to_start.inc + +set default_master_connection = 'm1'; +--let $master_pos= $master_pos_1 +--source include/sync_with_master_gtid.inc +set default_master_connection = 'm2'; +--let $master_pos= $master_pos_2 +--source include/sync_with_master_gtid.inc + +--echo # cleanup +--connection server_3 +set default_master_connection = 'm1'; +--source include/stop_slave.inc +set default_master_connection = 'm2'; +--source include/stop_slave.inc +--eval set global slave_parallel_threads = $slave_parallel_threads; +--eval set global slave_parallel_mode = $slave_parallel_mode; +--eval set global gtid_strict_mode = $gtid_strict_mode; +set global gtid_domain_id= 0; +reset master; +RESET SLAVE ALL; +SET GLOBAL gtid_slave_pos= ''; + +--connection server_1 +--eval set global binlog_alter_two_phase=$binlog_alter_two_phase; +set global gtid_domain_id= 0; +reset master; +--connection server_2 +set global gtid_domain_id= 0; +--eval set global binlog_alter_two_phase=$binlog_alter_two_phase +reset master; + +--disconnect server_1 +--disconnect server_2 +--disconnect server_3 diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_8.cnf b/mysql-test/suite/rpl/t/rpl_start_alter_8.cnf new file mode 100644 index 0000000000000..a0f6dc5710c7e --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_8.cnf @@ -0,0 +1,19 @@ +!include ../my.cnf + +[mysqld.1] +log-bin +log-slave-updates + +[mysqld.2] +log-bin +log-slave-updates + +[mysqld.3] +log-bin +log-slave-updates + + +[ENV] +SERVER_MYPORT_1= @mysqld.1.port +SERVER_MYPORT_2= @mysqld.2.port +SERVER_MYPORT_3= @mysqld.3.port diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_8.test b/mysql-test/suite/rpl/t/rpl_start_alter_8.test new file mode 100644 index 0000000000000..4ab8e2b01e55f --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_8.test @@ -0,0 +1,109 @@ +# +# Start Alter with Parallel Replication, With 2 sources +# 2 domain id (From 2 sources) +# |Concurrent alters| < |Parallel workers on slave| +# |x| denotes number of entities it encloses +# +--source include/have_log_bin.inc +--source include/have_innodb.inc +--source include/have_debug.inc +--connect (server_1,127.0.0.1,root,,,$SERVER_MYPORT_1) +--connect (server_2,127.0.0.1,root,,,$SERVER_MYPORT_2) +--connect (server_3,127.0.0.1,root,,,$SERVER_MYPORT_3) + +--connection server_1 +--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase` +set global binlog_alter_two_phase = ON; +set binlog_alter_two_phase = ON; + +--connection server_2 +stop slave; +set global binlog_alter_two_phase=true; + +--connection server_3 +--let $gtid_strict_mode= `select @@gtid_strict_mode` +--let $slave_parallel_threads= `select @@slave_parallel_threads` +--let $slave_parallel_mode= `select @@slave_parallel_mode` +SET GLOBAL slave_parallel_threads=20; +set global slave_parallel_mode=optimistic; +set global gtid_strict_mode=1; + +--disable_warnings +--disable_query_log +--replace_result $SERVER_MYPORT_1 MYPORT_1 +eval change master 'm1' to master_port=$SERVER_MYPORT_1 , master_host='127.0.0.1', master_user='root', master_use_gtid=slave_pos; +--replace_result $SERVER_MYPORT_2 MYPORT_2 +eval change master 'm2' to master_port=$SERVER_MYPORT_2 , master_host='127.0.0.1', master_user='root', master_use_gtid=slave_pos; +--enable_query_log +--enable_warnings + +--connection server_1 +set gtid_domain_id= 11; +create database s1; +use s1; +--let $domain_1=11 +--let $domain_2=11 +--let $M_port= $SERVER_MYPORT_1 +--let $S_port= $SERVER_MYPORT_3 +--let $sync_slave=0 +--let $db_name=s1 +--source include/start_alter_include.inc +--connection server_1 +drop database s1; +--let $master_pos_1= `SELECT @@gtid_binlog_pos` + +--connection server_2 +set gtid_domain_id= 12; +create database s2; +use s2; +--let $domain_1=12 +--let $domain_2=12 +--let $M_port= $SERVER_MYPORT_2 +--let $S_port= $SERVER_MYPORT_3 +--let $sync_slave=0 +--let $db_name=s2 +--source include/start_alter_include.inc +--connection server_2 +drop database s2; +--let $master_pos_2= `SELECT @@gtid_binlog_pos` + +--connection server_3 +start all slaves; +set default_master_connection = 'm1'; +--source include/wait_for_slave_to_start.inc +set default_master_connection = 'm2'; +--source include/wait_for_slave_to_start.inc + +set default_master_connection = 'm1'; +--let $master_pos= $master_pos_1 +--source include/sync_with_master_gtid.inc +set default_master_connection = 'm2'; +--let $master_pos= $master_pos_2 +--source include/sync_with_master_gtid.inc + +--echo # cleanup +--connection server_3 +set default_master_connection = 'm1'; +--source include/stop_slave.inc +set default_master_connection = 'm2'; +--source include/stop_slave.inc +--eval set global slave_parallel_threads = $slave_parallel_threads; +--eval set global slave_parallel_mode = $slave_parallel_mode; +--eval set global gtid_strict_mode = $gtid_strict_mode; +set global gtid_domain_id= 0; +reset master; +RESET SLAVE ALL; +SET GLOBAL gtid_slave_pos= ''; + +--connection server_1 +--eval set global binlog_alter_two_phase=$binlog_alter_two_phase; +set global gtid_domain_id= 0; +reset master; +--connection server_2 +set global gtid_domain_id= 0; +--eval set global binlog_alter_two_phase=$binlog_alter_two_phase; +reset master; + +--disconnect server_1 +--disconnect server_2 +--disconnect server_3 diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_bugs.test b/mysql-test/suite/rpl/t/rpl_start_alter_bugs.test new file mode 100644 index 0000000000000..52eef9fbb16eb --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_bugs.test @@ -0,0 +1,47 @@ +# +# MDEV-22985 Assertion `!(thd->rgi_slave && thd->rgi_slave->did_mark_start_commit)' failed in ha_rollback_trans# +# +# + +--source include/have_log_bin.inc +--source include/have_innodb.inc +--source include/master-slave.inc + +--connection master +set global binlog_alter_two_phase=true; + +--connection slave +stop slave; +SET global slave_parallel_threads=2; +set global slave_parallel_mode=optimistic; +start slave; +--connection master + +CREATE TABLE t1 (i int primary key) ENGINE = InnoDB; +--connection master1 +ALTER TABLE t1 DROP PRIMARY KEY; +ALTER TABLE t1 ADD UNIQUE KEY ui (i); +ALTER TABLE t1 ADD PRIMARY KEY (i); + +--sync_slave_with_master + + #MENT 1274 +--connection master +drop table t1; +CREATE TABLE t1 (a int)engine=innodb; +ALTER TABLE t1 add column b int, LOCK=EXCLUSIVE; +drop table t1; +CREATE TABLE t1 (pk int)engine=innodb; +--error ER_CANT_DROP_FIELD_OR_KEY +ALTER TABLE t1 DROP FOREIGN KEY y, LOCK=EXCLUSIVE; +drop table t1; +--sync_slave_with_master +--connection master +set global binlog_alter_two_phase=false; + +--connection slave +--source include/stop_slave.inc +SET global slave_parallel_threads=0; +--source include/start_slave.inc + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_chain_basic.cnf b/mysql-test/suite/rpl/t/rpl_start_alter_chain_basic.cnf new file mode 100644 index 0000000000000..498d8ed1096da --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_chain_basic.cnf @@ -0,0 +1,24 @@ +!include ../my.cnf + +[mysqld.1] +log-slave-updates +loose-innodb + +[mysqld.2] +log-slave-updates +loose-innodb + +[mysqld.3] +log-slave-updates +binlog_alter_two_phase=1 +loose-innodb + +[mysqld.4] +loose-innodb + +[ENV] +SERVER_MYPORT_3= @mysqld.3.port +SERVER_MYSOCK_3= @mysqld.3.socket + +SERVER_MYPORT_4= @mysqld.4.port +SERVER_MYSOCK_4= @mysqld.4.socket diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_chain_basic.test b/mysql-test/suite/rpl/t/rpl_start_alter_chain_basic.test new file mode 100644 index 0000000000000..2c6f9c0fd7246 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_chain_basic.test @@ -0,0 +1,54 @@ +# +# MENT-662 Lag Free alter for slave +# In this we will see if chain replication works as +# M->S(Legacy)->S(Parallel)->S(Legacy, without log-slave-upadates) +# +--source include/have_innodb.inc +--let $rpl_topology=1->2->3->4 +--source include/rpl_init.inc + +--connection server_3 +--let $gtid_strict_mode= `select @@gtid_strict_mode` +--let $slave_parallel_threads= `select @@slave_parallel_threads` +--let $slave_parallel_mode= `select @@slave_parallel_mode` +set global gtid_strict_mode=1; + +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +set global slave_parallel_mode=optimistic; +change master to master_use_gtid=slave_pos; +--source include/start_slave.inc + + +--connection server_1 +--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase` +set global binlog_alter_two_phase=ON; +set binlog_alter_two_phase=ON; +--let $engine=innodb +--let $sync_slave= 1 +connect(master_node,127.0.0.1,root,,$db_name, $SERVER_MYPORT_1); +connect(slave_node,127.0.0.1,root,,test, $SERVER_MYPORT_2); +--source include/start_alter_basic.inc +--disconnect master_node +--disconnect slave_node +--connection server_1 +--eval set global binlog_alter_two_phase=$binlog_alter_two_phase +--source include/rpl_sync.inc + + +--connection server_2 +select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; + +--connection server_3 +select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; +--source include/stop_slave.inc +--eval set global slave_parallel_threads = $slave_parallel_threads; +--eval set global slave_parallel_mode = $slave_parallel_mode; +--eval set global gtid_strict_mode = $gtid_strict_mode; +--source include/start_slave.inc +select @@slave_parallel_threads; + +--connection server_4 +select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_ftwrl.test b/mysql-test/suite/rpl/t/rpl_start_alter_ftwrl.test new file mode 100644 index 0000000000000..a8528cc61974c --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_ftwrl.test @@ -0,0 +1,91 @@ +# +# MDEV-11675 Two phase ALTER binlogging +# +# Prove that FTWRL in the middle of START and "COMPLETE" parts of ALTER +# is safe. + +--source include/have_debug.inc +--source include/have_innodb.inc +--source include/master-slave.inc + +--connection slave +--let $slave_parallel_threads= `select @@slave_parallel_threads` +--let $slave_parallel_mode= `select @@slave_parallel_mode` +--let $debug = `SELECT @@global.debug_dbug` + +--source include/stop_slave.inc + +SET @@global.slave_parallel_threads=4; +SET @@global.slave_parallel_mode=optimistic; +CHANGE MASTER TO master_use_gtid=slave_pos; + +SET @@global.debug_dbug="+d,at_write_start_alter"; +--source include/start_slave.inc + +--connection master +SET @@session.binlog_alter_two_phase=true; + +CREATE TABLE t1 (a INT) ENGINE=innodb; +--source include/save_master_gtid.inc + +# Make sure the table exists on slave now. +--connection slave +--source include/sync_with_master_gtid.inc + +--connection master +SET @@session.alter_algorithm='INSTANT'; +SET @@session.gtid_domain_id=11; +ALTER TABLE t1 ADD COLUMN b int; + + +--echo # START Alter having exclusive lock is waiting for the signal +--connection slave +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: now' +--source include/wait_condition.inc + +--echo # FTWRL is sent first to wait for SA +--connection slave1 +--send FLUSH TABLES WITH READ LOCK + +--echo # SA completes +# First wait for the FTWRL arrival. +--connection slave +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'FLUSH TABLES WITH READ LOCK' and STATE = 'Waiting for worker threads to pause for global read lock' +--source include/wait_condition.inc + +set DEBUG_SYNC= "now signal alter_cont"; + +--connection slave1 +--reap + +# Commit ALTER is hanging now +--connection slave +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND = 'Slave_worker' AND STATE = 'Waiting for backup lock' +--source include/wait_condition.inc + +--echo # Release CA +--connection slave1 +UNLOCK TABLES; + +--connection master +--sync_slave_with_master + +SHOW CREATE TABLE t1; +--source include/show_binlog_events.inc + +--connection master +DROP TABLE t1; + +--sync_slave_with_master + +--echo # cleanup +--connection slave +set DEBUG_SYNC = RESET; +--source include/stop_slave.inc +--eval set global slave_parallel_threads = $slave_parallel_threads +--eval set global slave_parallel_mode = $slave_parallel_mode +--eval set @@global.debug_dbug = "$debug" +--source include/start_slave.inc + + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_instant.test b/mysql-test/suite/rpl/t/rpl_start_alter_instant.test new file mode 100644 index 0000000000000..ecb62e04fad85 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_instant.test @@ -0,0 +1,30 @@ +# MDEV-11675 +# Prove that "fast" ALTER options also combine with @@binlog_alter_two_phase. +--source include/have_innodb.inc +--source include/master-slave.inc + +--connection master +set binlog_alter_two_phase=true; +CREATE OR REPLACE TABLE tab ( + a int PRIMARY KEY, + b varchar(50), + c varchar(50) +) CHARACTER SET=latin1 engine=innodb; + +SET SESSION alter_algorithm='INSTANT'; +ALTER TABLE tab MODIFY COLUMN b varchar(100); +SET SESSION alter_algorithm='NOCOPY'; +ALTER TABLE tab MODIFY COLUMN c varchar(100); +SHOW CREATE TABLE tab; +--source include/show_binlog_events.inc + +--sync_slave_with_master +SHOW CREATE TABLE tab; +--source include/show_binlog_events.inc + +--connection master +DROP TABLE tab; + +--sync_slave_with_master + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test b/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test new file mode 100644 index 0000000000000..5c78eb290c8f3 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test @@ -0,0 +1,39 @@ +# +# Start Alter with binlog applied using mysqlbinlog +# single maser with only one domain id +# +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/master-slave.inc + +--connection master +set global binlog_alter_two_phase=true; +--connection slave +--source include/stop_slave.inc +change master to master_use_gtid= current_pos; +set global gtid_strict_mode=1; + +--echo # Legacy Master Slave +--let $domain_1=0 +--let $domain_2=0 +--let $M_port= $MASTER_MYPORT +--let $S_port= $SLAVE_MYPORT +--let $sync_slave=0 + +--source include/start_alter_include.inc +--connection master +--let $MYSQLD_DATADIR= `select @@datadir;` +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/master.sql +select @@gtid_binlog_state; +RESET master; + +--connection slave +--exec $MYSQL --host=127.0.0.1 --port=$SLAVE_MYPORT -e "source $MYSQLTEST_VARDIR/tmp/master.sql" +select @@gtid_binlog_state; +set global gtid_strict_mode=0; +--source include/start_slave.inc + +--connection master +set global binlog_alter_two_phase=false; +remove_file $MYSQLTEST_VARDIR/tmp/master.sql; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_2.cnf b/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_2.cnf new file mode 100644 index 0000000000000..a0f6dc5710c7e --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_2.cnf @@ -0,0 +1,19 @@ +!include ../my.cnf + +[mysqld.1] +log-bin +log-slave-updates + +[mysqld.2] +log-bin +log-slave-updates + +[mysqld.3] +log-bin +log-slave-updates + + +[ENV] +SERVER_MYPORT_1= @mysqld.1.port +SERVER_MYPORT_2= @mysqld.2.port +SERVER_MYPORT_3= @mysqld.3.port diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_2.test b/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_2.test new file mode 100644 index 0000000000000..c7d5bd66e2b28 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_2.test @@ -0,0 +1,164 @@ +# +# MENT-662 Lag Free Alter On Slave +# + +# Start Alter with Parallel Replication, With 2 sources +# 2 domain id (From 2 sources) +# |Concurrent alters| < |Parallel workers on slave| +# |x| denotes number of entities it encloses +# And then binary log from slave is replayed to slave again to check if +# binlog output is okay. +# + +--source include/have_log_bin.inc +--source include/have_innodb.inc +--source include/have_debug.inc +--connect (server_1,127.0.0.1,root,,,$SERVER_MYPORT_1) +--connect (server_2,127.0.0.1,root,,,$SERVER_MYPORT_2) +--connect (server_3,127.0.0.1,root,,,$SERVER_MYPORT_3) + +--connection server_1 +SET @save_binlog_alter_two_phase= @@GLOBAL.binlog_alter_two_phase; +SET GLOBAL binlog_alter_two_phase = ON; +SET binlog_alter_two_phase = ON; +--echo # Create table and perform CA and RA +CREATE TABLE t1( a INT, b INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1,1); +INSERT INTO t1 VALUES(2,2); +--echo # Normal Alter +ALTER TABLE t1 ADD COLUMN c INT; +--echo # Failed Alter +INSERT INTO t1 VALUES(1,1, NULL); +--error ER_DUP_ENTRY +ALTER TABLE t1 CHANGE a a INT UNIQUE; +SHOW CREATE TABLE t1; +SELECT @@gtid_binlog_state; + +--echo # apply the binlog +let MYSQLD_DATADIR= `select @@datadir;`; +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/master_1.sql +DROP TABLE t1; +--echo # reset the binlog +RESET MASTER; + +--echo # execute the binlog +--exec $MYSQL --port=$SERVER_MYPORT_1 --host=127.0.0.1 -e "source $MYSQLTEST_VARDIR/tmp/master_1.sql" +SELECT @@gtid_binlog_state; +--echo # Same as before +SHOW CREATE TABLE t1; +DROP TABLE t1; +--echo # reset the binlog +RESET MASTER; +RESET SLAVE; +remove_file $MYSQLTEST_VARDIR/tmp/master_1.sql; + +--connection server_2 +SET @save_binlog_alter_two_phase= @@GLOBAL.binlog_alter_two_phase; +SET GLOBAL binlog_alter_two_phase = ON; + +--connection server_3 +SET @save_gtid_strict_mode= @@GLOBAL.gtid_strict_mode; +SET @slave_parallel_threads= @@GLOBAL.slave_parallel_threads; +SET @slave_parallel_mode= @@GLOBAL.slave_parallel_mode; +SET GLOBAL slave_parallel_threads=20; +SET GLOBAL slave_parallel_mode=optimistic; +SET GLOBAL gtid_strict_mode=1; + +--disable_warnings +--disable_query_log +--replace_result $SERVER_MYPORT_1 MYPORT_1 +eval CHANGE MASTER 'm1' TO MASTER_PORT=$SERVER_MYPORT_1, MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_USE_GTID=slave_pos; +--replace_result $SERVER_MYPORT_2 MYPORT_2 +eval CHANGE MASTER 'm2' TO MASTER_PORT=$SERVER_MYPORT_2, MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_USE_GTID=slave_pos; +--enable_query_log +--enable_warnings + +--connection server_1 +SET gtid_domain_id= 11; +CREATE DATABASE s1; +USE s1; +--let $domain_1=11 +--let $domain_2=11 +--let $M_port= $SERVER_MYPORT_1 +--let $S_port= $SERVER_MYPORT_3 +--let $sync_slave=0 +--let $db_name=s1 +--source include/start_alter_include.inc + +--connection server_1 +DROP DATABASE s1; +--let $master_pos_1= `SELECT @@gtid_binlog_pos` + +--connection server_2 +SET gtid_domain_id= 12; +CREATE DATABASE s2; +USE s2; +--let $domain_1=12 +--let $domain_2=12 +--let $M_port= $SERVER_MYPORT_2 +--let $S_port= $SERVER_MYPORT_3 +--let $sync_slave=0 +--let $db_name=s2 +--source include/start_alter_include.inc +--connection server_2 +DROP DATABASE s2; +--let $master_pos_2= `SELECT @@gtid_binlog_pos` + +--connection server_3 +START ALL SLAVES; +SET default_master_connection = 'm1'; +--source include/wait_for_slave_to_start.inc +SET default_master_connection = 'm2'; +--source include/wait_for_slave_to_start.inc + +SET default_master_connection = 'm1'; +--let $master_pos= $master_pos_1 +--source include/sync_with_master_gtid.inc +SET default_master_connection = 'm2'; +--let $master_pos= $master_pos_2 +--source include/sync_with_master_gtid.inc + +--echo # Stop slaves and apply binlog +--connection server_3 +SET default_master_connection = 'm1'; +--source include/stop_slave.inc +SET default_master_connection = 'm2'; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads = @slave_parallel_threads; +SET GLOBAL slave_parallel_mode = @slave_parallel_mode; +SET GLOBAL gtid_strict_mode = @save_gtid_strict_mode; +SET GLOBAL gtid_domain_id= 0; +SELECT @@gtid_binlog_state; + +let MYSQLD_DATADIR= `select @@datadir;`; +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/slave_1.sql +--echo # reset the binlog +RESET MASTER; +--echo # execute the binlog +--exec $MYSQL --port=$SERVER_MYPORT_3 --host=127.0.0.1 -e "source $MYSQLTEST_VARDIR/tmp/slave_1.sql" +SELECT @@gtid_binlog_state; + +--echo # One more time to simulate S->S case +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/slave_2.sql +RESET MASTER; +--echo # execute the binlog +--exec $MYSQL --port=$SERVER_MYPORT_3 --host=127.0.0.1 -e "source $MYSQLTEST_VARDIR/tmp/slave_2.sql" +SELECT @@gtid_binlog_state; +remove_file $MYSQLTEST_VARDIR/tmp/slave_1.sql; +remove_file $MYSQLTEST_VARDIR/tmp/slave_2.sql; +RESET MASTER; +RESET SLAVE ALL; +SET GLOBAL gtid_slave_pos= ''; + +--connection server_1 +SET GLOBAL binlog_alter_two_phase=@save_binlog_alter_two_phase; +SET GLOBAL gtid_domain_id= 0; +RESET MASTER; +--connection server_2 +SET GLOBAL gtid_domain_id= 0; +SET GLOBAL binlog_alter_two_phase=@save_binlog_alter_two_phase; +RESET MASTER; + +--disconnect server_1 +--disconnect server_2 +--disconnect server_3 diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_optimize.test b/mysql-test/suite/rpl/t/rpl_start_alter_optimize.test new file mode 100644 index 0000000000000..528f2b52af7f7 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_optimize.test @@ -0,0 +1,25 @@ +# MDEV-11675 two phase logged ALTER +# +# The tests verifies execution of non-ALTER queries that are handled +# through mysql_alter_table function. + +--source include/have_log_bin.inc +--source include/have_innodb.inc +--source include/master-slave.inc + +--connection master +set binlog_alter_two_phase = ON; + +--connection master +CREATE TABLE t1 (i int) engine=innodb; +CREATE TABLE t2 (i int) engine=innodb; + +ALTER TABLE t1 DROP CONSTRAINT IF EXISTS y; +OPTIMIZE TABLE t2; + +--sync_slave_with_master + +--connection master +drop table t1,t2; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_options.test b/mysql-test/suite/rpl/t/rpl_start_alter_options.test new file mode 100644 index 0000000000000..12125b49122f1 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_options.test @@ -0,0 +1,31 @@ +# This test will test all the option related to the Alter Table command +# NOTE not all alter statements will follow alter_algorithm since for some statements +# copy is only option +# parameters +# $alter_algorithm {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT} +# $show_binlog +# + +--source include/have_partition.inc +--source include/have_innodb.inc +--source include/master-slave.inc + +--let $alter_algorithm= default +#--let $show_binlog= false +--source include/start_alter_options.inc + +--let $alter_algorithm= inplace +--source include/start_alter_options.inc + +--let $alter_algorithm= copy +--source include/start_alter_options.inc + +--echo # Prove formal support for nocopy and instant +--let $alter_algorithm= instant +--source include/start_alter_options.inc + +--let $alter_algorithm= nocopy +--source include/start_alter_options.inc + + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_para_to_seq.test b/mysql-test/suite/rpl/t/rpl_start_alter_para_to_seq.test new file mode 100644 index 0000000000000..37e253139d219 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_para_to_seq.test @@ -0,0 +1,24 @@ +# MDEV-11675 binlog_alter_two_phase +# MDEV-27511 Assertion `rgi->gtid_ev_flags_extra & Gtid_log_event::FL_COMMIT_ALTER_E1' failed +# in write_bin_log_start_alter +# +--source include/have_log_bin.inc +--source include/master-slave.inc + +# The test proves the assert is not hit anymore. +--connection master +CREATE TABLE t1 (a1 int, d1 int DEFAULT 0); +INSERT INTO t1 VALUES (1,1) ; +SET binlog_alter_two_phase = ON; +ALTER TABLE t1 WAIT 9 RENAME COLUMN a1 TO a2; +SET binlog_alter_two_phase = OFF; +ALTER TABLE t1 ALTER COLUMN d1 DROP DEFAULT; + +--sync_slave_with_master + +# Cleanup +--connection master +drop table t1; +--sync_slave_with_master + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_restart_master.test b/mysql-test/suite/rpl/t/rpl_start_alter_restart_master.test new file mode 100644 index 0000000000000..eaddaa4db6701 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_restart_master.test @@ -0,0 +1,76 @@ +# Test crashing of master after writing start alter into binary log. +# And the doing the same alter again, to test on slave if that is successful +# ====> SA Crash SA CA Case +# +--source include/have_log_bin.inc +--source include/have_binlog_format_mixed.inc +--source include/have_innodb.inc +--source include/master-slave.inc +--source include/have_debug.inc +--source include/no_valgrind_without_big.inc + +--connection slave +SET @old_debug_slave= @@global.debug; +stop slave; +--let $gtid_strict_mode= `select @@gtid_strict_mode` +--let $slave_parallel_threads= `select @@slave_parallel_threads` +--let $slave_parallel_mode= `select @@slave_parallel_mode` +SET GLOBAL slave_parallel_threads=4; +set global slave_parallel_mode=optimistic; +set global gtid_strict_mode=1; +start slave; + +--connection master +call mtr.add_suppression("ALTER query started at .+ could not be completed"); + +SET @old_debug_master= @@global.debug; +--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase` +set binlog_alter_two_phase=true; +create table t3( a int primary key, b int) engine=innodb; + +--connection master +--sync_slave_with_master +--source include/stop_slave.inc + + +--connection master +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +SET SESSION debug_dbug="d,start_alter_kill_after_binlog"; +--error 2013 +alter table t3 add column d int; + +--let $rpl_server_number= 1 +--source include/rpl_reconnect.inc +set binlog_alter_two_phase= true; +alter table t3 add column d int; +show create table t3; +--source include/show_binlog_events.inc +--let $binlog_file=master-bin.000002 +--source include/show_binlog_events.inc +--let $binlog_file= + +--connection slave +--source include/start_slave.inc + +--connection master +--sync_slave_with_master +--source include/show_binlog_events.inc +show create table t3; + + +--connection master +SET GLOBAL debug_dbug= @old_debug_master; +drop table t3; +--eval set global binlog_alter_two_phase = $binlog_alter_two_phase + +--sync_slave_with_master +SET GLOBAL debug_dbug= @old_debug_slave; +stop slave; +--eval set global slave_parallel_threads = $slave_parallel_threads; +--eval set global slave_parallel_mode = $slave_parallel_mode; +--eval set global gtid_strict_mode = $gtid_strict_mode; +start slave; +--connection master +let MYSQLD_DATADIR= `select @@datadir;`; +--remove_files_wildcard $MYSQLD_DATADIR/test #sql*.frm +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test b/mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test new file mode 100644 index 0000000000000..df028ff1820a0 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test @@ -0,0 +1,121 @@ +# This test will restart the slave in middle of start alter commit alter processing +# slave will be restarted after start alter and before binlogging of commit alter, +# Then we will recieved commit alter from the master. +# Commit alter will act like standalone alter +# =====> SA SA CA(Stop Slave before binlogging) CA +# +--source include/have_log_bin.inc +--source include/have_innodb.inc +--source include/master-slave.inc +--source include/have_debug.inc + +--connection slave +SET @old_debug_slave= @@global.debug; +--source include/stop_slave.inc +--let $gtid_strict_mode= `select @@gtid_strict_mode` +--let $slave_parallel_threads= `select @@slave_parallel_threads` +--let $slave_parallel_mode= `select @@slave_parallel_mode` +SET GLOBAL slave_parallel_threads=4; +set global slave_parallel_mode=optimistic; +set global gtid_strict_mode=1; + +set global debug_dbug="+d,rpl_slave_stop_CA_before_binlog"; + +--source include/start_slave.inc +# +# SLAVE Shutdown +--connection master +SET @old_debug_master= @@global.debug; +set global debug_dbug="+d,start_alter_delay_master"; +--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase` +set global binlog_alter_two_phase=true; +create table t1( a int primary key, b int) engine=myisam; +create table t2( a int primary key, b int) engine=myisam; + +--connect (con1,localhost,root,,) +--send alter table t1 add column c int; + +--connection master +--echo # Get into binlog first and wait +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: now'; +--source include/wait_condition.inc +--let $master_gtid_state = `select @@gtid_binlog_state` +--echo # master gtid state is $master_gtid_state + +--connect (con2,localhost,root,,) +--send alter table t2 add column c int; + +--connection master +--echo # Get into binlog next and wait as well +--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: now'; +--source include/wait_condition.inc +--let $master_gtid_state = `select @@gtid_binlog_state` +--echo # master gtid state is $master_gtid_state + +# Memorize for slave's next sync with master +--let $master_pos=$master_gtid_state + +set DEBUG_SYNC= "now signal alter_cont"; + +--connection con1 +--reap +--connection con2 +--reap +create table t3( a int primary key, b int) engine=innodb; +--let $master_gtid_state = `select @@gtid_binlog_state` +--echo # master gtid state is $master_gtid_state +--let $replace_regexp=/alter table t[12]/alter table / /id=[0-9]+/id=/ +--source include/show_binlog_events2.inc + +--echo # Stop Slave +--echo # As master binlog is SA SA CA CA +--echo # let's stop at first CA processing (in process_commit_alter) + +--connection slave +--source include/sync_with_master_gtid.inc +# set debug_sync="now wait_for CA_1_processing"; +connect(extra_slave,127.0.0.1,root,,test,$SLAVE_MYPORT); +--send stop slave; +--connection slave +# set debug_sync="now signal proceed_CA_1"; +--connection extra_slave +--reap +SET GLOBAL debug_dbug= @old_debug_slave; + +--connection slave +--source include/wait_for_slave_sql_to_stop.inc +--echo # The list of events after the slave has stopped must have just one CA: +--let $replace_regexp=/alter table t[12]/alter table / /id=[0-9]+/id=/ +--source include/show_binlog_events2.inc + +select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; +--source include/start_slave.inc +--connection master +--sync_slave_with_master +--echo # Everything from the master binlog must have been applied now: +select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; +--let $slave_gtid_state = `select @@gtid_binlog_state` +--echo # slave gtid state is $slave_gtid_state +if (`select $master_gtid_state <> $slave_gtid_state`) +{ + --echo Gtid state mismatch: $master_gtid_state <> $slave_gtid_state + --die +} +--echo # The list of events after the slave has synchronized must have both CA: +--let $replace_regexp=/alter table t[12]/alter table / /id=[0-9]+/id=/ +--source include/show_binlog_events2.inc + +--connection master +drop table t1,t2,t3; +--eval set global binlog_alter_two_phase = $binlog_alter_two_phase +SET GLOBAL debug_dbug= @old_debug_master; +set DEBUG_SYNC= 'RESET'; + +--sync_slave_with_master +stop slave; +--eval set global slave_parallel_threads = $slave_parallel_threads; +--eval set global slave_parallel_mode = $slave_parallel_mode; +--eval set global gtid_strict_mode = $gtid_strict_mode; +set DEBUG_SYNC= 'RESET'; +start slave; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test b/mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test index 619b57994c230..3809cd89e4af5 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test +++ b/mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test @@ -3,10 +3,10 @@ # For details look into extra/rpl_tests/rpl_lower_case_table_names.test # +-- source include/not_windows.inc +-- source include/have_innodb.inc -- source include/have_binlog_format_mixed_or_statement.inc -- source include/master-slave.inc --- source include/have_innodb.inc --- source include/not_windows.inc -- let $engine=InnoDB -- source include/rpl_lower_case_table_names.test diff --git a/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test b/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test index b4e5335871268..654a5d47cb910 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test +++ b/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test @@ -1 +1,107 @@ ---source include/rpl_stm_relay_ign_space.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# +# BUG#12400313 / BUG#64503 test case +# +# +# Description +# ----------- +# +# This test case starts the slave server with: +# --relay-log-space-limit=8192 --relay-log-purge --max-relay-log-size=4096 +# +# Then it issues some queries that will cause the slave to reach +# relay-log-space-limit. We lock the table so that the SQL thread is +# not able to purge the log and then we issue some more statements. +# +# The purpose is to show that the IO thread will honor the limits +# while the SQL thread is not able to purge the relay logs, which did +# not happen before this patch. In addition we assert that while +# ignoring the limit (SQL thread needs to rotate before purging), the +# IO thread does not do it in an uncontrolled manner. + +--source include/have_binlog_format_statement.inc +--source include/have_innodb.inc +--source include/master-slave.inc + +--disable_query_log +CREATE TABLE t1 (c1 TEXT) engine=InnoDB; + +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); + +--sync_slave_with_master + +# wait for the SQL thread to sleep +--let $show_statement= SHOW PROCESSLIST +--let $field= State +--let $condition= = 'Slave has read all relay log; waiting for more updates' +--source include/wait_show_condition.inc + +# now the io thread has set rli->ignore_space_limit +# lets lock the table so that once the SQL thread awakes +# it blocks there and does not set rli->ignore_space_limit +# back to zero +LOCK TABLE t1 WRITE; + +# now issue more statements that will overflow the +# rli->log_space_limit (in this case ~10K) +--connection master + +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); +INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); + +--connection slave + +# ASSERT that the IO thread waits for the SQL thread to release some +# space before continuing +--let $show_statement= SHOW PROCESSLIST +--let $field= State +--let $condition= LIKE 'Waiting for %' +# before the patch (IO would have transfered everything) +#--let $condition= = 'Waiting for master to send event' +# after the patch (now it waits for space to be freed) +#--let $condition= = 'Waiting for the slave SQL thread to free enough relay log space' +--source include/wait_show_condition.inc + +# without the patch we can uncomment the following two lines and +# watch the IO thread synchronize with the master, thus writing +# relay logs way over the space limit +#--connection master +#--source include/sync_slave_io_with_master.inc + +## ASSERT that the IO thread has honored the limit+few bytes required to be able to purge +--let $relay_log_space_while_sql_is_executing = query_get_value(SHOW SLAVE STATUS, Relay_Log_Space, 1) +--let $relay_log_space_limit = query_get_value(SHOW VARIABLES LIKE "relay_log_space_limit", Value, 1) +--let $assert_text= Assert that relay log space is close to the limit +--let $assert_cond= $relay_log_space_while_sql_is_executing <= $relay_log_space_limit * 1.15 +--source include/assert.inc + +# unlock the table and let SQL thread continue applying events +UNLOCK TABLES; + +--connection master +--sync_slave_with_master +--let $diff_tables=master:test.t1,slave:test.t1 +--source include/diff_tables.inc + +--connection master +DROP TABLE t1; +--enable_query_log +--sync_slave_with_master + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test index 2625508515b90..d814a25771168 100644 --- a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test +++ b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test @@ -1 +1,633 @@ ---source include/rpl_switch_stm_row_mixed.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +# +# rpl_switch_stm_row_mixed tests covers +# +# - Master is switching explicitly between STATEMENT, ROW, and MIXED +# binlog format showing when it is possible and when not. +# - Master switching from MIXED to RBR implicitly listing all use +# cases, e.g a query invokes SYS_GUID(), thereafter to serve as the +# definition of MIXED binlog format +# - correctness of execution + + +-- source include/have_binlog_format_mixed_or_row.inc +-- source include/master-slave.inc + +# Since this test generates row-based events in the binary log, the +# slave SQL thread cannot be in STATEMENT mode to execute this test, +# so we only execute it for MIXED and ROW as default value of +# BINLOG_FORMAT. + +connection slave; + +connection master; +--disable_warnings +drop database if exists mysqltest1; +create database mysqltest1; +--enable_warnings +use mysqltest1; + +# Save binlog format +set @my_binlog_format= @@global.binlog_format; + +# play with switching +set session binlog_format=mixed; +show session variables like "binlog_format%"; +set session binlog_format=statement; +show session variables like "binlog_format%"; +set session binlog_format=row; +show session variables like "binlog_format%"; + +set global binlog_format=DEFAULT; +show global variables like "binlog_format%"; +set global binlog_format=MIXED; +show global variables like "binlog_format%"; +set global binlog_format=STATEMENT; +show global variables like "binlog_format%"; +set global binlog_format=ROW; +show global variables like "binlog_format%"; +show session variables like "binlog_format%"; +select @@global.binlog_format, @@session.binlog_format; + +CREATE TABLE t1 (a varchar(100)); + +prepare stmt1 from 'insert into t1 select concat(SYS_GUID(),?)'; +set @string="emergency_1_"; +insert into t1 values("work_2_"); +execute stmt1 using @string; +deallocate prepare stmt1; + +prepare stmt1 from 'insert into t1 select ?'; +insert into t1 values(concat(SYS_GUID(),"work_3_")); +execute stmt1 using @string; +deallocate prepare stmt1; + +insert into t1 values(concat("for_4_",SYS_GUID())); +insert into t1 select "yesterday_5_"; + +# verify that temp tables prevent a switch to SBR +create temporary table tmp(a char(100)); +insert into tmp values("see_6_"); +--error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR +set binlog_format=statement; +insert into t1 select * from tmp; +drop temporary table tmp; + +# Now we go to SBR +set binlog_format=statement; +show global variables like "binlog_format%"; +show session variables like "binlog_format%"; +select @@global.binlog_format, @@session.binlog_format; +set global binlog_format=statement; +show global variables like "binlog_format%"; +show session variables like "binlog_format%"; +select @@global.binlog_format, @@session.binlog_format; + +prepare stmt1 from 'insert into t1 select ?'; +set @string="emergency_7_"; +insert into t1 values("work_8_"); +execute stmt1 using @string; +deallocate prepare stmt1; + +prepare stmt1 from 'insert into t1 select ?'; +insert into t1 values("work_9_"); +execute stmt1 using @string; +deallocate prepare stmt1; + +insert into t1 values("for_10_"); +insert into t1 select "yesterday_11_"; + +# test statement (is not default after wl#3368) +set binlog_format=statement; +select @@global.binlog_format, @@session.binlog_format; +set global binlog_format=statement; +select @@global.binlog_format, @@session.binlog_format; + +prepare stmt1 from 'insert into t1 select ?'; +set @string="emergency_12_"; +insert into t1 values("work_13_"); +execute stmt1 using @string; +deallocate prepare stmt1; + +prepare stmt1 from 'insert into t1 select ?'; +insert into t1 values("work_14_"); +execute stmt1 using @string; +deallocate prepare stmt1; + +insert into t1 values("for_15_"); +insert into t1 select "yesterday_16_"; + +# and now the mixed mode + +set global binlog_format=mixed; +select @@global.binlog_format, @@session.binlog_format; +set binlog_format=default; +select @@global.binlog_format, @@session.binlog_format; + +prepare stmt1 from 'insert into t1 select concat(SYS_GUID(),?)'; +set @string="emergency_17_"; +insert into t1 values("work_18_"); +execute stmt1 using @string; +deallocate prepare stmt1; + +prepare stmt1 from 'insert into t1 select ?'; +insert into t1 values(concat(SYS_GUID(),"work_19_")); +execute stmt1 using @string; +deallocate prepare stmt1; + +insert into t1 values(concat("for_20_",SYS_GUID())); +insert into t1 select "yesterday_21_"; + +prepare stmt1 from 'insert into t1 select ?'; +insert into t1 values(concat(SYS_GUID(),"work_22_")); +execute stmt1 using @string; +deallocate prepare stmt1; + +insert into t1 values(concat("for_23_",SYS_GUID())); +insert into t1 select "yesterday_24_"; + +# Test of CREATE TABLE SELECT + +create table t2 ENGINE=MyISAM select rpad(SYS_GUID(),100,' '); +create table t3 select 1 union select SYS_GUID(); +--disable_warnings +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +create table t4 select * from t1 where 3 in (select 1 union select 2 union select SYS_GUID() union select 3); +--enable_warnings +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); +# what if SYS_GUID() is first: +--disable_warnings +insert ignore into t5 select SYS_GUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4); +--enable_warnings + +# inside a stored procedure + +delimiter |; +create procedure foo() +begin +insert into t1 values("work_25_"); +insert into t1 values(concat("for_26_",SYS_GUID())); +insert into t1 select "yesterday_27_"; +end| +create procedure foo2() +begin +insert into t1 values(concat("emergency_28_",SYS_GUID())); +insert into t1 values("work_29_"); +insert into t1 values(concat("for_30_",SYS_GUID())); +set session binlog_format=row; # accepted for stored procs +insert into t1 values("more work_31_"); +set session binlog_format=mixed; +end| +create function foo3() returns bigint unsigned +begin + set session binlog_format=row; # rejected for stored funcs + insert into t1 values("alarm"); + return 100; +end| +create procedure foo4(x varchar(100)) +begin +insert into t1 values(concat("work_250_",x)); +insert into t1 select "yesterday_270_"; +end| +delimiter ;| +call foo(); +call foo2(); +call foo4("hello"); +call foo4(SYS_GUID()); +call foo4("world"); + +# test that can't SET in a stored function +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT +select foo3(); +select * from t1 where a="alarm"; + +# Tests of stored functions/triggers/views for BUG#20930 "Mixed +# binlogging mode does not work with stored functions, triggers, +# views" + +# Function which calls procedure +drop function foo3; +delimiter |; +create function foo3() returns bigint unsigned +begin + insert into t1 values("foo3_32_"); + call foo(); + return 100; +end| +delimiter ;| +insert into t2 select foo3(); + +prepare stmt1 from 'insert into t2 select foo3()'; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; + +# Test if stored function calls stored function which calls procedure +# which requires row-based. + +delimiter |; +create function foo4() returns bigint unsigned +begin + insert into t2 select foo3(); + return 100; +end| +delimiter ;| +select foo4(); + +prepare stmt1 from 'select foo4()'; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; + +# A simple stored function +delimiter |; +create function foo5() returns bigint unsigned +begin + insert into t2 select SYS_GUID(); + return 100; +end| +delimiter ;| +select foo5(); + +prepare stmt1 from 'select foo5()'; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; + +# A simple stored function where SYS_GUID() is in the argument +delimiter |; +create function foo6(x varchar(100)) returns bigint unsigned +begin + insert into t2 select x; + return 100; +end| +delimiter ;| +select foo6("foo6_1_"); +select foo6(concat("foo6_2_",SYS_GUID())); + +prepare stmt1 from 'select foo6(concat("foo6_3_",SYS_GUID()))'; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; + + +# Test of views using SYS_GUID() + +create view v1 as select SYS_GUID(); +create table t11 (data varchar(255)); +insert into t11 select * from v1; +# Test of querying INFORMATION_SCHEMA which parses the view's body, +# to verify that it binlogs statement-based (is not polluted by +# the parsing of the view's body). +insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11'); +prepare stmt1 from "insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')"; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; + +# Test of triggers with SYS_GUID() +delimiter |; +create trigger t11_bi before insert on t11 for each row +begin + set NEW.data = concat(NEW.data,SYS_GUID()); +end| +delimiter ;| +insert into t11 values("try_560_"); + +# Test that INSERT DELAYED works in mixed mode (BUG#20649) +insert delayed into t2 values("delay_1_"); +insert delayed into t2 values(concat("delay_2_",SYS_GUID())); +insert delayed into t2 values("delay_6_"); + +# Test for BUG#20633 (INSERT DELAYED RAND()/user_variable does not +# replicate fine in statement-based ; we test that in mixed mode it +# works). +insert delayed into t2 values(rand()); +set @a=2.345; +insert delayed into t2 values(@a); + +# With INSERT DELAYED, rows are written to the binlog after they are +# written to the table. Therefore, it is not enough to wait until the +# rows make it to t2 on the master (the rows may not be in the binlog +# at that time, and may still not be in the binlog when +# sync_slave_with_master is later called). Instead, we wait until the +# rows make it to t2 on the slave. We first call +# sync_slave_with_master, so that we are sure that t2 has been created +# on the slave. +sync_slave_with_master; +let $wait_condition= SELECT COUNT(*) = 19 FROM mysqltest1.t2; +--source include/wait_condition.inc +connection master; + +# If you want to do manual testing of the mixed mode regarding UDFs (not +# testable automatically as quite platform- and compiler-dependent), +# you just need to set the variable below to 1, and to +# "make udf_example.so" in sql/, and to copy sql/udf_example.so to +# MYSQL_TEST_DIR/lib/mysql. +let $you_want_to_test_UDF=0; +if ($you_want_to_test_UDF) +{ + CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so'; + prepare stmt1 from 'insert into t1 select metaphon(?)'; + set @string="emergency_133_"; + insert into t1 values("work_134_"); + execute stmt1 using @string; + deallocate prepare stmt1; + prepare stmt1 from 'insert into t1 select ?'; + insert into t1 values(metaphon("work_135_")); + execute stmt1 using @string; + deallocate prepare stmt1; + insert into t1 values(metaphon("for_136_")); + insert into t1 select "yesterday_137_"; + create table t6 select metaphon("for_138_"); + create table t7 select 1 union select metaphon("for_139_"); + create table t8 select * from t1 where 3 in (select 1 union select 2 union select metaphon("for_140_") union select 3); + create table t9 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3); +} + +create table t20 select * from t1; # save for comparing later +create table t21 select * from t2; +create table t22 select * from t3; +drop table t1,t2,t3; + +# This tests the fix to +# BUG#19630 stored function inserting into two auto_increment breaks statement-based binlog +# We verify that under the mixed binlog mode, a stored function +# modifying at least two tables having an auto_increment column, +# is binlogged row-based. Indeed in statement-based binlogging, +# only the auto_increment value generated for the first table +# is recorded in the binlog, the value generated for the 2nd table +# lacking. + +create table t1 (a int primary key auto_increment, b varchar(100)); +create table t2 (a int primary key auto_increment, b varchar(100)); +create table t3 (b varchar(100)); +delimiter |; +create function f (x varchar(100)) returns int deterministic +begin + insert into t1 values(null,x); + insert into t2 values(null,x); + return 1; +end| +delimiter ;| +select f("try_41_"); +# Two operations which compensate each other except that their net +# effect is that they advance the auto_increment counter of t2 on slave: +sync_slave_with_master; +use mysqltest1; +insert into t2 values(2,null),(3,null),(4,null); +delete from t2 where a>=2; + +connection master; +# this is the call which didn't replicate well +select f("try_42_"); +sync_slave_with_master; + +# now use prepared statement and test again, just to see that the RBB +# mode isn't set at PREPARE but at EXECUTE. + +insert into t2 values(3,null),(4,null); +delete from t2 where a>=3; + +connection master; +prepare stmt1 from 'select f(?)'; +set @string="try_43_"; +insert into t1 values(null,"try_44_"); # should be SBB +execute stmt1 using @string; # should be RBB +deallocate prepare stmt1; +sync_slave_with_master; + +# verify that if only one table has auto_inc, it does not trigger RBB +# (we'll check in binlog further below) + +connection master; +create table t12 select * from t1; # save for comparing later +drop table t1; +create table t1 (a int, b varchar(100), key(a)); +select f("try_45_"); + +# restore table's key +create table t13 select * from t1; +drop table t1; +create table t1 (a int primary key auto_increment, b varchar(100)); + +# now test if it's two functions, each of them inserts in one table + +drop function f; +# we need a unique key to have sorting of rows by mysqldump +create table t14 (unique (a)) select * from t2; +truncate table t2; +delimiter |; +create function f1 (x varchar(100)) returns int deterministic +begin + insert into t1 values(null,x); + return 1; +end| +create function f2 (x varchar(100)) returns int deterministic +begin + insert into t2 values(null,x); + return 1; +end| +delimiter ;| +select f1("try_46_"),f2("try_47_"); + +sync_slave_with_master; +insert into t2 values(2,null),(3,null),(4,null); +delete from t2 where a>=2; + +connection master; +# Test with SELECT and INSERT +select f1("try_48_"),f2("try_49_"); +insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_"))); +sync_slave_with_master; + +# verify that if f2 does only read on an auto_inc table, this does not +# switch to RBB +connection master; +drop function f2; +delimiter |; +create function f2 (x varchar(100)) returns int deterministic +begin + declare y int; + insert into t1 values(null,x); + set y = (select count(*) from t2); + return y; +end| +delimiter ;| +select f1("try_53_"),f2("try_54_"); +sync_slave_with_master; + +# And now, a normal statement with a trigger (no stored functions) + +connection master; +drop function f2; +delimiter |; +create trigger t1_bi before insert on t1 for each row +begin + insert into t2 values(null,"try_55_"); +end| +delimiter ;| +insert into t1 values(null,"try_56_"); +# and now remove one auto_increment and verify SBB +alter table t1 modify a int, drop primary key; +insert into t1 values(null,"try_57_"); +sync_slave_with_master; + +# Test for BUG#20499 "mixed mode with temporary table breaks binlog" +# Slave used to have only 2 rows instead of 3. +connection master; +CREATE TEMPORARY TABLE t15 SELECT SYS_GUID(); +create table t16 like t15; +INSERT INTO t16 SELECT * FROM t15; +# we'll verify that this one is done RBB +insert into t16 values("try_65_"); +drop table t15; +# we'll verify that this one is done SBB +insert into t16 values("try_66_"); +sync_slave_with_master; + +# and now compare: + +connection master; + +# first check that data on master is sensible +select count(*) from t1; +select count(*) from t2; +select count(*) from t3; +select count(*) from t4; +select count(*) from t5; +select count(*) from t11; +select count(*) from t20; +select count(*) from t21; +select count(*) from t22; +select count(*) from t12; +select count(*) from t13; +select count(*) from t14; +select count(*) from t16; +if ($you_want_to_test_UDF) +{ + select count(*) from t6; + select count(*) from t7; + select count(*) from t8; + select count(*) from t9; +} + +sync_slave_with_master; + +# +# Bug#20863 If binlog format is changed between update and unlock of +# tables, wrong binlog +# + +connection master; +DROP TABLE IF EXISTS t11; +SET SESSION BINLOG_FORMAT=STATEMENT; +CREATE TABLE t11 (song VARCHAR(255)); +LOCK TABLES t11 WRITE; +SET SESSION BINLOG_FORMAT=ROW; +INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict'); +SET SESSION BINLOG_FORMAT=STATEMENT; +INSERT INTO t11 VALUES('Careful With That Axe, Eugene'); +UNLOCK TABLES; + +--query_vertical SELECT * FROM t11 +sync_slave_with_master; +USE mysqltest1; +--query_vertical SELECT * FROM t11 + +connection master; +DROP TABLE IF EXISTS t12; +SET SESSION BINLOG_FORMAT=MIXED; +CREATE TABLE t12 (data LONG); +LOCK TABLES t12 WRITE; +INSERT INTO t12 VALUES(SYS_GUID()); +UNLOCK TABLES; +sync_slave_with_master; + +# +# BUG#28086: SBR of USER() becomes corrupted on slave +# + +connection master; + +# Just to get something that is non-trivial, albeit still simple, we +# stuff the result of USER() and CURRENT_USER() into a variable. +--delimiter $$ +CREATE FUNCTION my_user() + RETURNS CHAR(64) +BEGIN + DECLARE user CHAR(64); + SELECT USER() INTO user; + RETURN user; +END $$ +--delimiter ; + +--delimiter $$ +CREATE FUNCTION my_current_user() + RETURNS CHAR(64) +BEGIN + DECLARE user CHAR(64); + SELECT CURRENT_USER() INTO user; + RETURN user; +END $$ +--delimiter ; + +DROP TABLE IF EXISTS t13; +CREATE TABLE t13 (data CHAR(64)); +INSERT INTO t13 VALUES (USER()); +INSERT INTO t13 VALUES (my_user()); +INSERT INTO t13 VALUES (CURRENT_USER()); +INSERT INTO t13 VALUES (my_current_user()); + +sync_slave_with_master; + +# as we're using SYS_GUID we don't SELECT but use "diff" like in rpl_row_UUID +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql + +# Let's compare. Note: If they match test will pass, if they do not match +# the test will show that the diff statement failed and not reject file +# will be created. You will need to go to the mysql-test dir and diff +# the files your self to see what is not matching + +diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql; + +connection master; + +# Now test that mysqlbinlog works fine on a binlog generated by the +# mixed mode + +# BUG#11312 "DELIMITER is not written to the binary log that causes +# syntax error" makes that mysqlbinlog will fail if we pass it the +# text of queries; this forces us to use --base64-output here. + +# BUG#20929 "BINLOG command causes invalid free plus assertion +# failure" makes mysqld segfault when receiving --base64-output + +# So I can't enable this piece of test +# SIGH + +if ($enable_when_11312_or_20929_fixed) +{ +--exec $MYSQL_BINLOG --base64-output $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql +drop database mysqltest1; +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql +# the old mysqldump output on slave is the same as what it was on +# master before restoring on master. +diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql; +} + +drop database mysqltest1; +sync_slave_with_master; + +connection master; +# Restore binlog format setting +set global binlog_format =@my_binlog_format; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_sync.test b/mysql-test/suite/rpl/t/rpl_sync.test index bdb0d8ec4ccd8..1e2ec2ca83b85 100644 --- a/mysql-test/suite/rpl/t/rpl_sync.test +++ b/mysql-test/suite/rpl/t/rpl_sync.test @@ -1,2 +1,159 @@ ---source include/rpl_sync_test.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +######################################################################################## +# This test verifies the options --sync-relay-log-info and --relay-log-recovery by +# crashing the slave in two different situations: +# (case-1) - Corrupt the relay log with changes which were not processed by +# the SQL Thread and crashes it. +# (case-2) - Corrupt the master.info with wrong coordinates and crashes it. +# +# Case 1: +# 1 - Stops the SQL Thread +# 2 - Inserts new records into the master. +# 3 - Corrupts the relay-log.bin* which most likely has such changes. +# 4 - Crashes the slave +# 5 - Verifies if the slave is sync with the master which means that the information +# loss was circumvented by the recovery process. +# +# Case 2: +# 1 - Stops the SQL/IO Threads +# 2 - Inserts new records into the master. +# 3 - Corrupts the master.info with wrong coordinates. +# 4 - Crashes the slave +# 5 - Verifies if the slave is sync with the master which means that the information +# loss was circumvented by the recovery process. +######################################################################################## + +######################################################################################## +# Configuring the environment +######################################################################################## +--echo =====Configuring the enviroment=======; +--source include/not_embedded.inc +--source include/not_valgrind.inc +--source include/have_debug.inc +--source include/have_innodb.inc +--source include/not_crashrep.inc +--source include/master-slave.inc + +call mtr.add_suppression('Attempting backtrace'); +call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001"); +# Use innodb so we do not get "table should be repaired" issues. +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +flush tables; +CREATE TABLE t1(a INT, PRIMARY KEY(a)) engine=innodb; + +insert into t1(a) values(1); +insert into t1(a) values(2); +insert into t1(a) values(3); + +######################################################################################## +# Case 1: Corrupt a relay-log.bin* +######################################################################################## +--echo =====Inserting data on the master but without the SQL Thread being running=======; +sync_slave_with_master; + +connection slave; +let $MYSQLD_SLAVE_DATADIR= `select @@datadir`; +--replace_result $MYSQLD_SLAVE_DATADIR MYSQLD_SLAVE_DATADIR +--copy_file $MYSQLD_SLAVE_DATADIR/master.info $MYSQLD_SLAVE_DATADIR/master.backup +--source include/stop_slave_sql.inc + +connection master; +insert into t1(a) values(4); +insert into t1(a) values(5); +insert into t1(a) values(6); + +--echo =====Removing relay log files and crashing/recoverying the slave=======; +connection slave; +--source include/stop_slave_io.inc + +let $file= query_get_value("SHOW SLAVE STATUS", Relay_Log_File, 1); + +--let FILE_TO_CORRUPT= $MYSQLD_SLAVE_DATADIR/$file +perl; +$file= $ENV{'FILE_TO_CORRUPT'}; +open(FILE, ">$file") || die "Unable to open $file."; +truncate(FILE,0); +print FILE "failure"; +close ($file); +EOF + +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +SET SESSION debug_dbug="d,crash_before_rotate_relaylog"; +--error 2013 +FLUSH LOGS; + +--let $rpl_server_number= 2 +--source include/rpl_reconnect.inc + +--echo =====Dumping and comparing tables=======; +--source include/start_slave.inc + +connection master; +sync_slave_with_master; + +let $diff_tables=master:t1,slave:t1; +source include/diff_tables.inc; + +######################################################################################## +# Case 2: Corrupt a master.info +######################################################################################## +--echo =====Corrupting the master.info=======; +connection slave; +--source include/stop_slave.inc + +connection master; +FLUSH LOGS; + +insert into t1(a) values(7); +insert into t1(a) values(8); +insert into t1(a) values(9); + +connection slave; +let MYSQLD_SLAVE_DATADIR=`select @@datadir`; + +--perl +use strict; +use warnings; +my $src= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.backup"; +my $dst= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.info"; +open(FILE, "<", $src) or die; +my @content= ; +close FILE; +open(FILE, ">", $dst) or die; +binmode FILE; +print FILE @content; +close FILE; +EOF + +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +SET SESSION debug_dbug="d,crash_before_rotate_relaylog"; +--error 2013 +FLUSH LOGS; + +--let $rpl_server_number= 2 +--source include/rpl_reconnect.inc + +--echo =====Dumping and comparing tables=======; +--source include/start_slave.inc + +connection master; +sync_slave_with_master; + +let $diff_tables=master:t1,slave:t1; +source include/diff_tables.inc; + +######################################################################################## +# Clean up +######################################################################################## +--echo =====Clean up=======; +connection master; +drop table t1; + +--remove_file $MYSQLD_SLAVE_DATADIR/master.backup +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test index ca7be98e50c88..766acb14c3d36 100644 --- a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test +++ b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test @@ -91,7 +91,8 @@ sync_slave_with_master; # action: setup environment CREATE TABLE t1 (a int) engine=innodb; -CREATE TABLE t2 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) ); +CREATE TABLE t2 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) ) + engine=innodb; CREATE TABLE t3 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) ); CREATE TRIGGER tr1 AFTER DELETE ON t2 FOR EACH ROW INSERT INTO t3 () VALUES (); diff --git a/mysql-test/suite/rpl/t/rpl_temporal_format_default_to_default.test b/mysql-test/suite/rpl/t/rpl_temporal_format_default_to_default.test index d976ae3757bab..6728ff55d6f5e 100644 --- a/mysql-test/suite/rpl/t/rpl_temporal_format_default_to_default.test +++ b/mysql-test/suite/rpl/t/rpl_temporal_format_default_to_default.test @@ -1 +1,82 @@ ---source include/rpl_temporal_format_default_to_default.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption). +# Please check all dependent tests after modifying it +# + +--source include/master-slave.inc + +if ($force_master_mysql56_temporal_format) +{ + connection master; + eval SET @@global.mysql56_temporal_format=$force_master_mysql56_temporal_format; +} + +if ($force_slave_mysql56_temporal_format) +{ + connection slave; + eval SET @@global.mysql56_temporal_format=$force_slave_mysql56_temporal_format; +} + +connection master; +SELECT @@global.mysql56_temporal_format AS on_master; +connection slave; +SELECT @@global.mysql56_temporal_format AS on_slave; +connection master; + +CREATE TABLE t1 +( + c0 TIME(0), + c1 TIME(1), + c2 TIME(2), + c3 TIME(3), + c4 TIME(4), + c5 TIME(5), + c6 TIME(6) +); +CREATE TABLE t2 +( + c0 TIMESTAMP(0), + c1 TIMESTAMP(1), + c2 TIMESTAMP(2), + c3 TIMESTAMP(3), + c4 TIMESTAMP(4), + c5 TIMESTAMP(5), + c6 TIMESTAMP(6) +); + +CREATE TABLE t3 +( + c0 DATETIME(0), + c1 DATETIME(1), + c2 DATETIME(2), + c3 DATETIME(3), + c4 DATETIME(4), + c5 DATETIME(5), + c6 DATETIME(6) +); +INSERT INTO t1 VALUES ('01:01:01','01:01:01.1','01:01:01.11','01:01:01.111','01:01:01.1111','01:01:01.11111','01:01:01.111111'); +INSERT INTO t2 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111'); +INSERT INTO t3 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111'); +SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME; +sync_slave_with_master; + +connection slave; +--query_vertical SELECT * FROM t1; +--query_vertical SELECT * FROM t2; +--query_vertical SELECT * FROM t3; +SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME; + +connection master; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; + +connection slave; +SET @@global.mysql56_temporal_format=DEFAULT; +connection master; +SET @@global.mysql56_temporal_format=DEFAULT; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_timestamp.test b/mysql-test/suite/rpl/t/rpl_timestamp.test new file mode 100644 index 0000000000000..a3f4010f24aec --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_timestamp.test @@ -0,0 +1,18 @@ +source include/master-slave.inc; + +set timestamp=1656940000; +set explicit_defaults_for_timestamp=!@@explicit_defaults_for_timestamp; +connection master; + +create table t1 (f1 timestamp, f2 timestamp); +show create table t1; +sync_slave_with_master; +show create table t1; +connection master; +drop table t1; +flush binary logs; + +let $datadir=`select @@datadir`; +exec $MYSQL_BINLOG -s $datadir/master-bin.000001; + +source include/rpl_end.inc; diff --git a/mysql-test/suite/rpl/t/rpl_typeconv.test b/mysql-test/suite/rpl/t/rpl_typeconv.test index c251708625827..9e5662588827e 100644 --- a/mysql-test/suite/rpl/t/rpl_typeconv.test +++ b/mysql-test/suite/rpl/t/rpl_typeconv.test @@ -1 +1,78 @@ ---source include/rpl_typeconv.inc +# +# This include file is used by more than one test suite +# (currently rpl and binlog_encryption suite). +# Please check all dependent tests after modifying it +# + +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +connection slave; +set @saved_slave_type_conversions = @@global.slave_type_conversions; +CREATE TABLE type_conversions ( + TestNo INT AUTO_INCREMENT PRIMARY KEY, + Source TEXT, + Target TEXT, + Flags TEXT, + On_Master LONGTEXT, + On_Slave LONGTEXT, + Expected LONGTEXT, + Compare INT, + Error TEXT); + +SELECT @@global.slave_type_conversions; +SET GLOBAL SLAVE_TYPE_CONVERSIONS=''; +SELECT @@global.slave_type_conversions; +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; +SELECT @@global.slave_type_conversions; +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; +SELECT @@global.slave_type_conversions; +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; +SELECT @@global.slave_type_conversions; +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT'; +SELECT @@global.slave_type_conversions; + +# Checking strict interpretation of type conversions +connection slave; +SET GLOBAL SLAVE_TYPE_CONVERSIONS=''; +source suite/rpl/include/type_conversions.test; + +# Checking lossy integer type conversions +connection slave; +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; +source suite/rpl/include/type_conversions.test; + +# Checking non-lossy integer type conversions +connection slave; +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; +source suite/rpl/include/type_conversions.test; + +# Checking all type conversions +connection slave; +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; +source suite/rpl/include/type_conversions.test; + +connection slave; +--echo **** Result of conversions **** +disable_query_log; +SELECT RPAD(Source, 15, ' ') AS Source_Type, + RPAD(Target, 15, ' ') AS Target_Type, + RPAD(Flags, 25, ' ') AS All_Type_Conversion_Flags, + IF(Compare IS NULL AND Error IS NOT NULL, '', + IF(Compare, '', + CONCAT("'", On_Slave, "' != '", Expected, "'"))) + AS Value_On_Slave + FROM type_conversions; +enable_query_log; +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; +DROP TABLE t1; +sync_slave_with_master; + +set global slave_type_conversions = @saved_slave_type_conversions; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_unsafe_statements.test b/mysql-test/suite/rpl/t/rpl_unsafe_statements.test index 9185e566b9c67..40c9b9bb25fe0 100644 --- a/mysql-test/suite/rpl/t/rpl_unsafe_statements.test +++ b/mysql-test/suite/rpl/t/rpl_unsafe_statements.test @@ -25,7 +25,7 @@ --source include/have_innodb.inc --source include/have_binlog_format_mixed.inc --source include/master-slave.inc -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); + # Case-1: BINLOG_STMT_UNSAFE_AUTOINC_COLUMNS # Statement is unsafe because it invokes a trigger or a # stored function that inserts into an AUTO_INCREMENT column. diff --git a/mysql-test/suite/rpl/t/rpl_xa_empty_transaction.cnf b/mysql-test/suite/rpl/t/rpl_xa_empty_transaction.cnf new file mode 100644 index 0000000000000..92acd0c73a6c7 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_xa_empty_transaction.cnf @@ -0,0 +1,18 @@ +!include include/default_mysqld.cnf + +[mysqld.1] +log-slave-updates +innodb + +[mysqld.2] +log-slave-updates +innodb + +[mysqld.3] +log-slave-updates +innodb + +[ENV] +SERVER_MYPORT_1= @mysqld.1.port +SERVER_MYPORT_2= @mysqld.2.port +SERVER_MYPORT_3= @mysqld.3.port diff --git a/mysql-test/suite/rpl/t/rpl_xa_empty_transaction.test b/mysql-test/suite/rpl/t/rpl_xa_empty_transaction.test new file mode 100644 index 0000000000000..61cc0621d5a6e --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_xa_empty_transaction.test @@ -0,0 +1,175 @@ +# +# Purpose: +# This test ensures consistency in binlogging behavior for XA transactions +# that have all statements error and rollback, effectively leaving an "empty" +# transaction. In such cases, an empty XA transaction should be binlogged. The +# bug reported by MDEV-25616 revealed that an "empty" XA transaction would +# binlog an XA ROLLBACK or XA COMMIT event without a preceding setup, i.e. +# XA START through XA PREPARE. The bug presented differently for XA +# transactions consisting of transactional and non-transactional statements. +# Therefore, this test validates that an entire XA transaction is binlogged +# for different combinations of transactional or non-transactional statements. +# Note that the behavior changes when binlogging empty XA transactions +# depending on the binlog_row_format variables. That is, when the content of +# the transaction consists of errored transactional statements, in row format, +# an empty XA transaction will be binlogged; however, in mixed and statement +# formats, nothing will be written into the binary log. +# +# Methodology: +# Create XA transactions with various combinations of erroring transactional +# or non-transactional statements. The binary log is examined to ensure all +# XA components are written. Chain replication is used, i.e. +# (primary->replica->replica), to ensure replica binlogging is consistent with +# manual execution. The transactional and non-transactional tables use InnoDB +# and MyISAM, respectively. +# +# Parameters +# $expect_transactional_xa_binlog : Boolean indicating whether or not an +# errored transactional statement should result in XA statements written +# into the binary log. +# +# References: +# MDEV-25616: Binlog event for XA COMMIT is generated without matching +# XA START, replication aborts +# +--source include/have_log_bin.inc + +--let $rpl_server_count= 3 +--let $rpl_topology= 1->2->3 +--source include/rpl_init.inc + +--connection server_1 +-- source include/have_innodb.inc +--connection server_2 +-- source include/have_innodb.inc +--connection server_3 +-- source include/have_innodb.inc +--connection server_1 + +--echo # +--echo # Test Case 1: An XA transaction without any statements should not be +--echo # binlogged +--let $trx_statements= + +--let $xa_completion_action= COMMIT +--source include/rpl_xa_empty_transaction.inc + +--let $xa_completion_action= ROLLBACK +--source include/rpl_xa_empty_transaction.inc + + +--echo # +--echo # Test Case 2: An XA transaction consisting of a successfully rolled back +--echo # statement should not be binlogged +--let $trx_statements= T + +--let $xa_completion_action= COMMIT +--source include/rpl_xa_empty_transaction.inc + +--let $xa_completion_action= ROLLBACK +--source include/rpl_xa_empty_transaction.inc + + +--echo # +--echo # Test Case 3: An XA transaction with a statement that cannot be rolled +--echo # back should be binlogged + +# TODO: remove work-around MDEV-24654 when fixed. +--connection server_1 +set @sav_binlog_format = @@binlog_format; +set @@binlog_format = row; +set @@global.binlog_format = row; +--let $trx_statements= N + +--let $xa_completion_action= COMMIT +--source include/rpl_xa_empty_transaction.inc + +--let $xa_completion_action= ROLLBACK +--source include/rpl_xa_empty_transaction.inc + +--connection server_1 +set @@binlog_format = @sav_binlog_format; +set @@global.binlog_format = @sav_binlog_format; + + +--echo # +--echo # Test Case 4: An XA transaction with multiple statements that can all +--echo # be rolled back should not be binlogged +--let $trx_statements= T,T + +--let $xa_completion_action= COMMIT +--source include/rpl_xa_empty_transaction.inc + +--let $xa_completion_action= ROLLBACK +--source include/rpl_xa_empty_transaction.inc + + +--echo # +--echo # Test Case 5: A mixed XA transaction consisting of one statement that +--echo # can successfully be rolled back (first statement), and another that +--echo # can not (second statement) should be binlogged + +--connection server_1 +set @sav_binlog_format = @@binlog_format; +set @@binlog_format = row; +set @@global.binlog_format = row; +--let $trx_statements= T,N + +--let $xa_completion_action= COMMIT +--source include/rpl_xa_empty_transaction.inc + +--let $xa_completion_action= ROLLBACK +--source include/rpl_xa_empty_transaction.inc + +--connection server_1 +set @@binlog_format = @sav_binlog_format; +set @@global.binlog_format = @sav_binlog_format; + + +--echo # +--echo # Test Case 6: A mixed XA transaction consisting of one statement that +--echo # cannot successfully be rolled back (first statement), and another that +--echo # can (second statement) should be binlogged + +--connection server_1 +set @sav_binlog_format = @@binlog_format; +set @@binlog_format = row; +set @@global.binlog_format = row; +--let $trx_statements= N,T + +--let $xa_completion_action= COMMIT +--source include/rpl_xa_empty_transaction.inc + +--let $xa_completion_action= ROLLBACK +--source include/rpl_xa_empty_transaction.inc + +--connection server_1 +set @@binlog_format = @sav_binlog_format; +set @@global.binlog_format = @sav_binlog_format; + +--echo # +--echo # Test Case 7: An XA transaction consisting of two failed +--echo # non-transactional statements should be binlogged + +--connection server_1 +set @sav_binlog_format = @@binlog_format; +set @@binlog_format = row; +set @@global.binlog_format = row; +--let $trx_statements= N,N + +--let $xa_completion_action= COMMIT +--source include/rpl_xa_empty_transaction.inc + +--let $xa_completion_action= ROLLBACK +--source include/rpl_xa_empty_transaction.inc + +--connection server_1 +set @@binlog_format = @sav_binlog_format; +set @@global.binlog_format = @sav_binlog_format; + +# +# Cleanup +--connection server_1 +--source include/rpl_end.inc + +--echo # End of rpl_xa_empty_transaction.test diff --git a/mysql-test/suite/rpl/t/rpl_xa_prepare_gtid_fail.test b/mysql-test/suite/rpl/t/rpl_xa_prepare_gtid_fail.test new file mode 100644 index 0000000000000..8042b355754f5 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_xa_prepare_gtid_fail.test @@ -0,0 +1,106 @@ +# +# When handling the replication of an XA PREPARE, the commit phase is +# bifurcated. First, the prepare is handled by the relevant storage engines. +# Then second,the GTID slave state is updated as a separate autocommit +# transaction. If the second stage fails, i.e. we are unable to update the +# GTID slave state, then the slave should immediately quit in error, without +# retry. +# +# This tests validates the above behavior by simulating a deadlock on the +# GTID slave state table during the second part of XA PREPARE's commit, to +# ensure that the appropriate error is reported and the transaction was never +# retried. +# +# +# References +# MDEV-31038: Parallel Replication Breaks if XA PREPARE Fails Updating Slave +# GTID State +# +source include/master-slave.inc; +source include/have_binlog_format_row.inc; +source include/have_innodb.inc; + +--connection slave +--source include/stop_slave.inc + +--let $save_par_thds= `SELECT @@global.slave_parallel_threads` +--let $save_strict_mode= `SELECT @@global.gtid_strict_mode` +--let $save_innodb_lock_wait_timeout= `SELECT @@global.innodb_lock_wait_timeout` + +change master to master_use_gtid=slave_pos; +set @@global.slave_parallel_threads= 4; +set @@global.slave_parallel_mode= optimistic; +set @@global.gtid_strict_mode=ON; + +set sql_log_bin= 0; +alter table mysql.gtid_slave_pos engine=innodb; +call mtr.add_suppression("Deadlock found.*"); +set sql_log_bin= 1; +--source include/start_slave.inc + +--connection master +let $datadir= `select @@datadir`; +create table t1 (a int primary key, b int) engine=innodb; +insert t1 values (1,1); +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +set @@global.innodb_lock_wait_timeout= 1; + +--let $retried_tx_initial= query_get_value(SHOW ALL SLAVES STATUS, Retried_transactions, 1) + +--connection master +--let $gtid_domain_id=`SELECT @@GLOBAL.gtid_domain_id` +--let $gtid_server_id=`SELECT @@GLOBAL.server_id` +--let $xap_seq_no=100 +--eval set @@session.gtid_seq_no=$xap_seq_no +xa start '1'; +update t1 set b=b+10 where a=1; +xa end '1'; +xa prepare '1'; +--let $new_gtid= `SELECT @@global.gtid_binlog_pos` +xa commit '1'; +--source include/save_master_gtid.inc + + +--connection slave + +#--eval set statement sql_log_bin=0 for insert into mysql.gtid_slave_pos values ($gtid_domain_id, 5, $gtid_server_id, $xap_seq_no) + +--connection slave1 +BEGIN; +--eval SELECT * FROM mysql.gtid_slave_pos WHERE seq_no=$xap_seq_no FOR UPDATE + +--connection slave +--source include/start_slave.inc + +--let $slave_sql_errno= 1942,1213 +--source include/wait_for_slave_sql_error.inc + +--let $retried_tx_test= query_get_value(SHOW ALL SLAVES STATUS, Retried_transactions, 1) +if ($retried_tx_initial != $retried_tx_test) +{ + --echo Transaction was retried when a failed XA PREPARE slave GTID update should lead to immediate slave stop without retry + --die Transaction was retried when a failed XA PREPARE slave GTID update should lead to immediate slave stop without retry +} + +--connection slave1 +ROLLBACK; + +--echo # Cleanup + +--connection master +drop table t1; + +--connection slave +--source include/stop_slave.inc +--eval set @@global.gtid_slave_pos= "$new_gtid" +--eval set @@global.slave_parallel_threads= $save_par_thds +--eval set @@global.gtid_strict_mode= $save_strict_mode +--eval set @@global.innodb_lock_wait_timeout= $save_innodb_lock_wait_timeout +--source include/start_slave.inc + +--source include/rpl_end.inc +--echo # End of rpl_xa_prepare_gtid_fail.test diff --git a/mysql-test/suite/s3/alter.result b/mysql-test/suite/s3/alter.result index c6f79e8b0f98c..1a931b71e0113 100644 --- a/mysql-test/suite/s3/alter.result +++ b/mysql-test/suite/s3/alter.result @@ -10,21 +10,21 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 alter table t1 comment="hello"; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='hello' +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 COMMENT='hello' alter table t1 engine=aria; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='hello' +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 COMMENT='hello' alter table t1 engine=s3; alter table t1 engine=innodb; show create table t1; @@ -32,7 +32,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='hello' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 COMMENT='hello' select count(*), sum(a), sum(b) from t1; count(*) sum(a) sum(b) 1000 500500 510500 @@ -50,14 +50,14 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 alter table t2 rename to t3, engine=aria; show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 select count(*), sum(a), sum(b) from t3; count(*) sum(a) sum(b) 10 55 155 @@ -73,7 +73,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 `compression_algorithm`='zlib' +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 `compression_algorithm`='zlib' select count(*), sum(a), sum(b) from t1; count(*) sum(a) sum(b) 1000 500500 510500 @@ -91,7 +91,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL, `d` int(11) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 select count(*), sum(a), sum(b), sum(c), sum(d) from t1; count(*) sum(a) sum(b) sum(c) sum(d) 10 55 155 NULL NULL diff --git a/mysql-test/suite/s3/arguments.result b/mysql-test/suite/s3/arguments.result index 4a371aabc9bdc..8133af4be0831 100644 --- a/mysql-test/suite/s3/arguments.result +++ b/mysql-test/suite/s3/arguments.result @@ -11,7 +11,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `a` (`a`) -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 `s3_block_size`=819200 `compression_algorithm`='zlib' +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 `s3_block_size`=819200 `compression_algorithm`='zlib' alter table t1 engine=s3, s3_block_size=8192; ERROR HY000: Incorrect value '8192' for option 's3_block_size' alter table t1 engine=s3, s3_block_size=65536; @@ -21,7 +21,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `a` (`a`) -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 `compression_algorithm`='zlib' `s3_block_size`=65536 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 `compression_algorithm`='zlib' `s3_block_size`=65536 alter table t1 engine=s3, s3_block_size=100000; ERROR HY000: Incorrect value '100000' for option 's3_block_size' show create table t1; @@ -30,7 +30,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, KEY `a` (`a`) -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 `compression_algorithm`='zlib' `s3_block_size`=65536 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 `compression_algorithm`='zlib' `s3_block_size`=65536 alter table t1 engine=s3, compression_algorithm="wss"; ERROR HY000: Incorrect value 'wss' for option 'compression_algorithm' drop table t1; diff --git a/mysql-test/suite/s3/basic.result b/mysql-test/suite/s3/basic.result index ac391ba3574af..790806ee43c10 100644 --- a/mysql-test/suite/s3/basic.result +++ b/mysql-test/suite/s3/basic.result @@ -13,7 +13,7 @@ t1 CREATE TABLE `t1` ( `c` varchar(1000) DEFAULT NULL, KEY `a` (`a`), KEY `c` (`c`) -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 select * from information_schema.tables where table_schema="database" and table_name="t1";; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY def # t1 BASE TABLE S3 10 Page 10000 567 5677056 # 761856 0 NULL # # # latin1_swedish_ci NULL page_checksum=1 2305843009213685760 # @@ -102,7 +102,7 @@ t1 CREATE TABLE `t1` ( `c` varchar(1000) DEFAULT NULL, KEY `a` (`a`), KEY `c` (`c`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 select a,b from t1 limit 10; a b 1 11 diff --git a/mysql-test/suite/s3/encryption.result b/mysql-test/suite/s3/encryption.result index c60490d342ad3..f9be451459cb3 100644 --- a/mysql-test/suite/s3/encryption.result +++ b/mysql-test/suite/s3/encryption.result @@ -15,7 +15,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 ALTER TABLE t1 ENGINE=Aria; select * from t1; a diff --git a/mysql-test/suite/s3/innodb.result b/mysql-test/suite/s3/innodb.result index eaa9cf93c86e8..b1aaa9cc7dbd8 100644 --- a/mysql-test/suite/s3/innodb.result +++ b/mysql-test/suite/s3/innodb.result @@ -10,21 +10,21 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 alter table t1 comment="hello"; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='hello' +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 COMMENT='hello' alter table t1 engine=innodb; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='hello' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 COMMENT='hello' select count(*), sum(a), sum(b) from t1; count(*) sum(a) sum(b) 1000 500500 510500 diff --git a/mysql-test/suite/s3/mysqldump.result b/mysql-test/suite/s3/mysqldump.result index 7a14b0aac9a31..3f4c208138837 100644 --- a/mysql-test/suite/s3/mysqldump.result +++ b/mysql-test/suite/s3/mysqldump.result @@ -21,7 +21,7 @@ CREATE TABLE `t1` ( `pk` int(11) NOT NULL, `a` int(11) DEFAULT NULL, PRIMARY KEY (`pk`) -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1; +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` VALUES (1,1), diff --git a/mysql-test/suite/s3/partition.result b/mysql-test/suite/s3/partition.result index 818316bc89de3..9face3ec947b9 100644 --- a/mysql-test/suite/s3/partition.result +++ b/mysql-test/suite/s3/partition.result @@ -88,7 +88,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`c1`) SUBPARTITION BY HASH (`c2`) SUBPARTITIONS 2 @@ -108,7 +108,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`c1`) SUBPARTITION BY HASH (`c2`) SUBPARTITIONS 2 @@ -134,7 +134,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 SELECT count(*) FROM t2; count(*) 4 diff --git a/mysql-test/suite/s3/partition_move.result b/mysql-test/suite/s3/partition_move.result index e183334f08330..8bd1b53e06fcc 100644 --- a/mysql-test/suite/s3/partition_move.result +++ b/mysql-test/suite/s3/partition_move.result @@ -12,7 +12,7 @@ archive CREATE TABLE `archive` ( `c1` int(11) NOT NULL, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=S3 DEFAULT CHARSET=latin1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`c1`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = S3) CREATE TABLE t1 ( @@ -34,7 +34,7 @@ p1 CREATE TABLE `p1` ( `c1` int(11) NOT NULL, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select count(*) from p1; count(*) 100 @@ -51,7 +51,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`c1`) (PARTITION `p2` VALUES LESS THAN (300) ENGINE = InnoDB, PARTITION `p3` VALUES LESS THAN (400) ENGINE = InnoDB) @@ -61,7 +61,7 @@ archive CREATE TABLE `archive` ( `c1` int(11) NOT NULL, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=S3 DEFAULT CHARSET=latin1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`c1`) (PARTITION `p0` VALUES LESS THAN (100) ENGINE = S3, PARTITION `p1` VALUES LESS THAN (200) ENGINE = S3) diff --git a/mysql-test/suite/s3/replication_delayed.result b/mysql-test/suite/s3/replication_delayed.result index cad8b905d0ba9..706fcfe6d7e7a 100644 --- a/mysql-test/suite/s3/replication_delayed.result +++ b/mysql-test/suite/s3/replication_delayed.result @@ -42,7 +42,7 @@ show create table t100; Table Create Table t100 CREATE TABLE `t100` ( `pk` varchar(100) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 connection slave; select count(*) from t100; count(*) diff --git a/mysql-test/suite/s3/replication_mixed.result b/mysql-test/suite/s3/replication_mixed.result index 6b9b87a789188..80a32b28d8a13 100644 --- a/mysql-test/suite/s3/replication_mixed.result +++ b/mysql-test/suite/s3/replication_mixed.result @@ -21,7 +21,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 connection slave; use database; select * from t1 limit 2; @@ -84,7 +84,7 @@ t1 CREATE TABLE `t1` ( `c` int(11) DEFAULT NULL, `d` int(11) DEFAULT NULL, `e` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 # Convert S3 table to Aria with rename. Rows should be binary logged connection master; alter table t1 engine=s3; @@ -102,7 +102,7 @@ t2 CREATE TABLE `t2` ( `c` int(11) DEFAULT NULL, `d` int(11) DEFAULT NULL, `e` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 connection master; drop table t2; connection slave; @@ -154,7 +154,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 select * from t1 limit 2; a b c select * from t2 limit 2; @@ -217,7 +217,7 @@ slave-bin.000001 # Query # # use `database`; CREATE OR REPLACE TABLE `t1` ( `c` int(11) DEFAULT NULL, `d` int(11) DEFAULT NULL, `e` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 slave-bin.000001 # Annotate_rows # # alter table t1 engine=aria slave-bin.000001 # Table_map # # table_id: # (database.t1) slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F @@ -232,7 +232,7 @@ slave-bin.000001 # Query # # use `database`; CREATE OR REPLACE TABLE `t2` ( `c` int(11) DEFAULT NULL, `d` int(11) DEFAULT NULL, `e` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 slave-bin.000001 # Annotate_rows # # alter table t1 rename t2, engine=aria slave-bin.000001 # Table_map # # table_id: # (database.t2) slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F diff --git a/mysql-test/suite/s3/replication_partition.result b/mysql-test/suite/s3/replication_partition.result index 0a57a1b872d55..18f5ae7c65021 100644 --- a/mysql-test/suite/s3/replication_partition.result +++ b/mysql-test/suite/s3/replication_partition.result @@ -31,7 +31,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`c1`) PARTITIONS 9 select sum(c1) from t1; @@ -58,7 +58,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=S3 DEFAULT CHARSET=latin1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`c1`) (PARTITION `p1` VALUES LESS THAN (200) ENGINE = S3, PARTITION `p2` VALUES LESS THAN (300) ENGINE = S3, @@ -77,7 +77,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=S3 DEFAULT CHARSET=latin1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`c1`) (PARTITION `p1` VALUES LESS THAN (200) ENGINE = S3, PARTITION `p2` VALUES LESS THAN (300) ENGINE = S3, @@ -99,7 +99,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=S3 DEFAULT CHARSET=latin1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`c1`) (PARTITION `p1` VALUES LESS THAN (200) ENGINE = S3, PARTITION `p2` VALUES LESS THAN (300) ENGINE = S3, @@ -243,7 +243,7 @@ slave-bin.000001 # Query # # use `database`; CREATE OR REPLACE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`c1`) (PARTITION `p2` VALUES LESS THAN (300) ENGINE = InnoDB, PARTITION `p3` VALUES LESS THAN (400) ENGINE = InnoDB) diff --git a/mysql-test/suite/s3/replication_stmt.result b/mysql-test/suite/s3/replication_stmt.result index 4b8306687db8f..4257823bbea46 100644 --- a/mysql-test/suite/s3/replication_stmt.result +++ b/mysql-test/suite/s3/replication_stmt.result @@ -21,7 +21,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 connection slave; use database; select * from t1 limit 2; @@ -84,7 +84,7 @@ t1 CREATE TABLE `t1` ( `c` int(11) DEFAULT NULL, `d` int(11) DEFAULT NULL, `e` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 # Convert S3 table to Aria with rename. Rows should be binary logged connection master; alter table t1 engine=s3; @@ -102,7 +102,7 @@ t2 CREATE TABLE `t2` ( `c` int(11) DEFAULT NULL, `d` int(11) DEFAULT NULL, `e` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 connection master; drop table t2; connection slave; @@ -154,7 +154,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=S3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 select * from t1 limit 2; a b c select * from t2 limit 2; @@ -217,7 +217,7 @@ slave-bin.000001 # Query # # use `database`; CREATE OR REPLACE TABLE `t1` ( `c` int(11) DEFAULT NULL, `d` int(11) DEFAULT NULL, `e` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 slave-bin.000001 # Annotate_rows # # alter table t1 engine=aria slave-bin.000001 # Table_map # # table_id: # (database.t1) slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F @@ -232,7 +232,7 @@ slave-bin.000001 # Query # # use `database`; CREATE OR REPLACE TABLE `t2` ( `c` int(11) DEFAULT NULL, `d` int(11) DEFAULT NULL, `e` int(11) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 slave-bin.000001 # Annotate_rows # # alter table t1 rename t2, engine=aria slave-bin.000001 # Table_map # # table_id: # (database.t2) slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F diff --git a/mysql-test/suite/sql_sequence/alter.result b/mysql-test/suite/sql_sequence/alter.result index 612e2201d2613..90de2ebfcc0c7 100644 --- a/mysql-test/suite/sql_sequence/alter.result +++ b/mysql-test/suite/sql_sequence/alter.result @@ -29,7 +29,7 @@ select * from t1; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 3 -100 9223372036854775806 50 1 0 0 0 alter sequence t1 minvalue=100 start=100; -ERROR HY000: Sequence 'test.t1' values are conflicting +ERROR HY000: Sequence 'test.t1' has out of range value for options alter sequence t1 minvalue=100 start=100 restart=100; show create sequence t1; Table Create Table @@ -200,21 +200,20 @@ next_not_cached_value minimum_value maximum_value start_value increment cache_si drop sequence t1; CREATE SEQUENCE t1 engine=myisam; alter sequence t1 minvalue=100; -ERROR HY000: Sequence 'test.t1' values are conflicting +ERROR HY000: Sequence 'test.t1' has out of range value for options drop sequence t1; CREATE SEQUENCE t1 engine=myisam; alter sequence t1 minvalue=25 maxvalue=20; -ERROR HY000: Sequence 'test.t1' values are conflicting +ERROR HY000: Sequence 'test.t1' has out of range value for options drop sequence t1; create table t1 (a int); alter sequence t1 minvalue=100; ERROR 42S02: 'test.t1' is not a SEQUENCE drop table t1; alter sequence if exists t1 minvalue=100; -Warnings: -Note 4091 Unknown SEQUENCE: 'test.t1' +ERROR 42S02: Unknown SEQUENCE: 't1' alter sequence t1 minvalue=100; -ERROR 42S02: Table 'test.t1' doesn't exist +ERROR 42S02: Unknown SEQUENCE: 't1' create sequence t1; alter sequence 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 '' at line 1 diff --git a/mysql-test/suite/sql_sequence/alter.test b/mysql-test/suite/sql_sequence/alter.test index 53f7101833727..a5e6245d609f0 100644 --- a/mysql-test/suite/sql_sequence/alter.test +++ b/mysql-test/suite/sql_sequence/alter.test @@ -119,8 +119,9 @@ create table t1 (a int); alter sequence t1 minvalue=100; drop table t1; +--error ER_UNKNOWN_SEQUENCES alter sequence if exists t1 minvalue=100; ---error ER_NO_SUCH_TABLE +--error ER_UNKNOWN_SEQUENCES alter sequence t1 minvalue=100; create sequence t1; diff --git a/mysql-test/suite/sql_sequence/alter_notembedded.result b/mysql-test/suite/sql_sequence/alter_notembedded.result index 25b33dd742b13..f3e1f5f18cd59 100644 --- a/mysql-test/suite/sql_sequence/alter_notembedded.result +++ b/mysql-test/suite/sql_sequence/alter_notembedded.result @@ -9,12 +9,12 @@ select * from s1; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 1 1 9223372036854775806 1 1 1000 0 0 select nextval(s1); -ERROR 42000: INSERT command denied to user 'normal_1'@'localhost' for table 's1' +ERROR 42000: INSERT command denied to user 'normal_1'@'localhost' for table `s_db`.`s1` show create sequence s1; Table Create Table s1 CREATE SEQUENCE `s1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM alter sequence s1 restart 50; -ERROR 42000: ALTER command denied to user 'normal_1'@'localhost' for table 's1' +ERROR 42000: ALTER command denied to user 'normal_1'@'localhost' for table `s_db`.`s1` connection default; grant insert on s_db.s1 to normal_1@'%'; connection m_normal_1; @@ -22,7 +22,7 @@ select nextval(s1); nextval(s1) 1 alter sequence s1 restart 50; -ERROR 42000: ALTER command denied to user 'normal_1'@'localhost' for table 's1' +ERROR 42000: ALTER command denied to user 'normal_1'@'localhost' for table `s_db`.`s1` connection default; grant alter on s_db.s1 to normal_1@'%'; connection m_normal_1; @@ -31,7 +31,7 @@ select nextval(s1); nextval(s1) 50 drop sequence s1; -ERROR 42000: DROP command denied to user 'normal_1'@'localhost' for table 's1' +ERROR 42000: DROP command denied to user 'normal_1'@'localhost' for table `s_db`.`s1` connection default; disconnect m_normal_1; drop database s_db; diff --git a/mysql-test/suite/sql_sequence/aria.result b/mysql-test/suite/sql_sequence/aria.result index b39d85d58ca7f..cfc7d946772ae 100644 --- a/mysql-test/suite/sql_sequence/aria.result +++ b/mysql-test/suite/sql_sequence/aria.result @@ -53,7 +53,7 @@ next value for s1 drop sequence s1; CREATE SEQUENCE t1; alter sequence t1 minvalue=100; -ERROR HY000: Sequence 'test.t1' values are conflicting +ERROR HY000: Sequence 'test.t1' has out of range value for options alter sequence t1 minvalue=100 start=100 restart=100; rename table t1 to t2; select next value for t2; diff --git a/mysql-test/suite/sql_sequence/binlog.result b/mysql-test/suite/sql_sequence/binlog.result index f01b3234e9686..843cf74c2facf 100644 --- a/mysql-test/suite/sql_sequence/binlog.result +++ b/mysql-test/suite/sql_sequence/binlog.result @@ -12,6 +12,21 @@ select next value for s1, minimum_value from s1 where maximum_value> 4; next value for s1 minimum_value 4 1 alter sequence s1 maxvalue 1000; +optimize table s1; +Table Op Msg_type Msg_text +test.s1 optimize note The storage engine for the table doesn't support optimize +analyze table s1; +Table Op Msg_type Msg_text +test.s1 analyze status Engine-independent statistics collected +test.s1 analyze note The storage engine for the table doesn't support analyze +repair table s1; +Table Op Msg_type Msg_text +test.s1 repair status OK +check table s1; +Table Op Msg_type Msg_text +test.s1 check note The storage engine for the table doesn't support check +rename table s1 to tmp_s; +rename table tmp_s to s1; drop sequence s1; include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info @@ -30,4 +45,14 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; alter sequence s1 maxvalue 1000 master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; optimize table s1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; analyze table s1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; repair table s1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; rename table s1 to tmp_s +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; rename table tmp_s to s1 +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; DROP SEQUENCE `s1` /* generated by server */ diff --git a/mysql-test/suite/sql_sequence/binlog.test b/mysql-test/suite/sql_sequence/binlog.test index 5f2d52d7864f5..6a12e670a1edd 100644 --- a/mysql-test/suite/sql_sequence/binlog.test +++ b/mysql-test/suite/sql_sequence/binlog.test @@ -1,5 +1,5 @@ ---source include/have_udf.inc ---source include/have_log_bin.inc +--source include/have_sequence.inc +--source include/have_binlog_format_mixed_or_row.inc --source include/binlog_start_pos.inc # @@ -21,6 +21,17 @@ select next value for s1, minimum_value from s1 where maximum_value> 4; # alter sequence s1 maxvalue 1000; +# MDEV-24617 OPTIMIZE on a sequence causes unexpected +# ER_BINLOG_UNSAFE_STATEMENT The test below verifies no unsafe +# warnings anymore for any relavant commands that like OPTIMIZE can +# not produce ROW format events therefore the unsafe warning either. +optimize table s1; +analyze table s1; +repair table s1; +check table s1; +rename table s1 to tmp_s; +rename table tmp_s to s1; + drop sequence s1; --let $binlog_file = LAST diff --git a/mysql-test/suite/sql_sequence/create.result b/mysql-test/suite/sql_sequence/create.result index 6f70f335d888b..9326d7016c93e 100644 --- a/mysql-test/suite/sql_sequence/create.result +++ b/mysql-test/suite/sql_sequence/create.result @@ -167,11 +167,11 @@ drop sequence if exists t1; Warnings: Note 4090 'test.t1' is not a SEQUENCE create sequence t1 start with 10 maxvalue=9; -ERROR HY000: Sequence 'test.t1' values are conflicting +ERROR HY000: Sequence 'test.t1' has out of range value for options create sequence t1 minvalue= 100 maxvalue=10; -ERROR HY000: Sequence 'test.t1' values are conflicting +ERROR HY000: Sequence 'test.t1' has out of range value for options create sequence t1 start with 9 minvalue=10; -ERROR HY000: Sequence 'test.t1' values are conflicting +ERROR HY000: Sequence 'test.t1' has out of range value for options create or replace sequence t1 maxvalue=13, increment by -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 ' increment by -1' at line 1 create or replace sequence t1 start with= 10 maxvalue=13; @@ -183,7 +183,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp create or replace sequence t1 start with 10 min_value=1 NO MINVALUE; 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 'NO MINVALUE' at line 1 create sequence t1 start with 10 maxvalue=9223372036854775807; -ERROR HY000: Sequence 'test.t1' values are conflicting +ERROR HY000: Sequence 'test.t1' has out of range value for options create sequence t1 start with 10 minvalue=-9223372036854775808; 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 '9223372036854775808' at line 1 create sequence t1 RESTART WITH 10; @@ -477,7 +477,7 @@ next value for t1 1 drop temporary table t1; select previous value for t1; -ERROR 42S02: Table 'test.t1' doesn't exist +ERROR 42S02: Unknown SEQUENCE: 't1' CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 10; select next value for t1; next value for t1 @@ -506,7 +506,7 @@ next value for t1 1 drop temporary table t1; select previous value for t1; -ERROR 42S02: Table 'test.t1' doesn't exist +ERROR 42S02: Unknown SEQUENCE: 't1' CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 10 engine=innodb; select next value for t1; next value for t1 @@ -587,7 +587,7 @@ s CREATE TABLE `s` ( `cache` bigint(21) NOT NULL, `cycle` tinyint(1) unsigned NOT NULL, `round` bigint(21) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create table s2; Table Create Table s2 CREATE TABLE `s2` ( @@ -599,7 +599,7 @@ s2 CREATE TABLE `s2` ( `cache` bigint(21) NOT NULL, `cycle` tinyint(1) unsigned NOT NULL, `round` bigint(21) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show create sequence s; ERROR 42S02: 'test.s' is not a SEQUENCE show create sequence s2; @@ -615,7 +615,7 @@ show create table s; Table Create Table s CREATE TEMPORARY TABLE `s` ( `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table s; create or replace sequence s; create temporary sequence s; @@ -686,3 +686,33 @@ set global innodb_force_primary_key=default; ALTER TABLE s1 ADD PRIMARY KEY (next_not_cached_value); ERROR HY000: Sequence 'test.s1' table structure is invalid (Sequence tables cannot have any keys) DROP SEQUENCE s1; +# +# Beginning of 10.4 Test +# +# MDEV-13005: Fixing bugs in SEQUENCE, part 3 +# +# Task 1: +SET @x = PREVIOUS VALUE FOR x; +ERROR 42S02: Unknown SEQUENCE: 'x' +# Task 2: +CREATE SEQUENCE x START WITH 1 INCREMENT BY 123456789012345678; +ERROR HY000: Sequence 'test.x' has out of range value for options +# Task 3: +CREATE SEQUENCE seq1 START WITH 1 cache -1; +ERROR HY000: Sequence 'test.seq1' has out of range value for options +# Task 4: +CREATE TEMPORARY TABLE s1 (s1 INT); +DROP TEMPORARY SEQUENCE s1; +ERROR 42S02: Unknown SEQUENCE: 'test.s1' +DROP TEMPORARY TABLE s1; +# Task 5: +CREATE TEMPORARY TABLE s1 (s1 INT); +CREATE TEMPORARY SEQUENCE s1 (s1 INT); +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 '(s1 INT)' at line 1 +DROP TEMPORARY TABLE s1; +# Task 6: +CREATE SEQUENCE seq1 START WITH 2; +CREATE TRIGGER s1 BEFORE UPDATE ON seq1 FOR EACH ROW SET @a= 5; +ERROR HY000: Trigger's 'seq1' is a view, temporary table or sequence +DROP SEQUENCE seq1; +# End of 10.4 test diff --git a/mysql-test/suite/sql_sequence/create.test b/mysql-test/suite/sql_sequence/create.test index 61430740560be..49b39fbb40c06 100644 --- a/mysql-test/suite/sql_sequence/create.test +++ b/mysql-test/suite/sql_sequence/create.test @@ -382,7 +382,7 @@ drop view v1; CREATE TEMPORARY SEQUENCE t1; select next value for t1; drop temporary table t1; ---error ER_NO_SUCH_TABLE +--error ER_UNKNOWN_SEQUENCES select previous value for t1; CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 10; select next value for t1; @@ -398,7 +398,7 @@ drop sequence t1; CREATE TEMPORARY SEQUENCE t1 engine=innodb; select next value for t1; drop temporary table t1; ---error ER_NO_SUCH_TABLE +--error ER_UNKNOWN_SEQUENCES select previous value for t1; CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 10 engine=innodb; select next value for t1; @@ -515,3 +515,41 @@ set global innodb_force_primary_key=default; --error ER_SEQUENCE_INVALID_TABLE_STRUCTURE ALTER TABLE s1 ADD PRIMARY KEY (next_not_cached_value); DROP SEQUENCE s1; + +--echo # +--echo # Beginning of 10.4 Test +--echo # +--echo # MDEV-13005: Fixing bugs in SEQUENCE, part 3 +--echo # + +--echo # Task 1: +--error ER_UNKNOWN_SEQUENCES +SET @x = PREVIOUS VALUE FOR x; + +--echo # Task 2: +--error ER_SEQUENCE_INVALID_DATA +CREATE SEQUENCE x START WITH 1 INCREMENT BY 123456789012345678; + +--echo # Task 3: +--error ER_SEQUENCE_INVALID_DATA +CREATE SEQUENCE seq1 START WITH 1 cache -1; + +--echo # Task 4: +CREATE TEMPORARY TABLE s1 (s1 INT); +--error ER_UNKNOWN_SEQUENCES +DROP TEMPORARY SEQUENCE s1; +DROP TEMPORARY TABLE s1; + +--echo # Task 5: +CREATE TEMPORARY TABLE s1 (s1 INT); +--error ER_PARSE_ERROR +CREATE TEMPORARY SEQUENCE s1 (s1 INT); +DROP TEMPORARY TABLE s1; + +--echo # Task 6: +CREATE SEQUENCE seq1 START WITH 2; +--error ER_TRG_ON_VIEW_OR_TEMP_TABLE +CREATE TRIGGER s1 BEFORE UPDATE ON seq1 FOR EACH ROW SET @a= 5; +DROP SEQUENCE seq1; + +--echo # End of 10.4 test diff --git a/mysql-test/suite/sql_sequence/default.result b/mysql-test/suite/sql_sequence/default.result index 4969e832652f5..eecef1d3527c4 100644 --- a/mysql-test/suite/sql_sequence/default.result +++ b/mysql-test/suite/sql_sequence/default.result @@ -14,7 +14,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT nextval(`test`.`s1`), `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 SET b=1; insert into t1 SET b=2; insert into t1 (b) values (3),(4); @@ -95,7 +95,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT nextval(`test`.`s2`), `d` int(11) DEFAULT lastval(`test`.`s2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t1; a b c d 1 5 1 1 @@ -113,7 +113,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT nextval(`test`.`s2`), `d` int(11) DEFAULT lastval(`test`.`s2`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; drop sequence s1; # @@ -193,3 +193,105 @@ INSERT INTO t1 () values (); EXECUTE stmt; DROP TABLE t1; DROP SEQUENCE s; +# +# MDEV-29540 Incorrect sequence values in INSERT SELECT +# +CREATE SEQUENCE s1; +CREATE TABLE t1 ( +a BIGINT UNSIGNED NOT NULL PRIMARY KEY +DEFAULT (NEXT VALUE FOR s1), +b CHAR(1) NOT NULL +); +INSERT INTO t1 (b) VALUES ('a'); +INSERT INTO t1 (b) VALUES ('b'), ('c'); +INSERT INTO t1 (b) VALUES ('d'); +INSERT INTO t1 (b) SELECT c FROM ( +SELECT 'e' as c +UNION +SELECT 'f' + UNION +SELECT 'g' +) der; +SELECT a, b FROM t1; +a b +1 a +2 b +3 c +4 d +5 e +6 f +7 g +ALTER SEQUENCE s1 RESTART; +INSERT INTO t1 (b) SELECT c FROM ( +SELECT 'a' as c +UNION +SELECT 'b' + UNION +SELECT 'c' + UNION +SELECT 'd' + UNION +SELECT 'e' + UNION +SELECT 'f' + UNION +SELECT 'g' +) der; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +ALTER SEQUENCE s1 RESTART; +INSERT IGNORE INTO t1 (b) SELECT c FROM ( +SELECT 'a' as c +UNION +SELECT 'b' + UNION +SELECT 'c' + UNION +SELECT 'd' + UNION +SELECT 'e' + UNION +SELECT 'f' + UNION +SELECT 'g' +) der; +Warnings: +Warning 1062 Duplicate entry '1' for key 'PRIMARY' +Warning 1062 Duplicate entry '2' for key 'PRIMARY' +Warning 1062 Duplicate entry '3' for key 'PRIMARY' +Warning 1062 Duplicate entry '4' for key 'PRIMARY' +Warning 1062 Duplicate entry '5' for key 'PRIMARY' +Warning 1062 Duplicate entry '6' for key 'PRIMARY' +Warning 1062 Duplicate entry '7' for key 'PRIMARY' +SELECT a, b FROM t1; +a b +1 a +2 b +3 c +4 d +5 e +6 f +7 g +INSERT IGNORE INTO t1 (b) SELECT c FROM ( +SELECT 'h' as c +UNION +SELECT 'i' + UNION +SELECT 'j' +) der; +SELECT a, b FROM t1; +a b +1 a +2 b +3 c +4 d +5 e +6 f +7 g +8 h +9 i +10 j +DROP TABLE t1; +DROP SEQUENCE s1; +# +# End of 10.3 tests +# diff --git a/mysql-test/suite/sql_sequence/default.test b/mysql-test/suite/sql_sequence/default.test index e7c13211013c1..28eb71e39cc1f 100644 --- a/mysql-test/suite/sql_sequence/default.test +++ b/mysql-test/suite/sql_sequence/default.test @@ -135,3 +135,83 @@ EXECUTE stmt; # Cleanup DROP TABLE t1; DROP SEQUENCE s; + +--echo # +--echo # MDEV-29540 Incorrect sequence values in INSERT SELECT +--echo # + +CREATE SEQUENCE s1; +CREATE TABLE t1 ( + a BIGINT UNSIGNED NOT NULL PRIMARY KEY + DEFAULT (NEXT VALUE FOR s1), + b CHAR(1) NOT NULL +); + +INSERT INTO t1 (b) VALUES ('a'); +INSERT INTO t1 (b) VALUES ('b'), ('c'); +INSERT INTO t1 (b) VALUES ('d'); +INSERT INTO t1 (b) SELECT c FROM ( + SELECT 'e' as c + UNION + SELECT 'f' + UNION + SELECT 'g' +) der; + +SELECT a, b FROM t1; + +ALTER SEQUENCE s1 RESTART; + +--error ER_DUP_ENTRY +INSERT INTO t1 (b) SELECT c FROM ( + SELECT 'a' as c + UNION + SELECT 'b' + UNION + SELECT 'c' + UNION + SELECT 'd' + UNION + SELECT 'e' + UNION + SELECT 'f' + UNION + SELECT 'g' +) der; + +ALTER SEQUENCE s1 RESTART; + +INSERT IGNORE INTO t1 (b) SELECT c FROM ( + SELECT 'a' as c + UNION + SELECT 'b' + UNION + SELECT 'c' + UNION + SELECT 'd' + UNION + SELECT 'e' + UNION + SELECT 'f' + UNION + SELECT 'g' +) der; + +SELECT a, b FROM t1; + +INSERT IGNORE INTO t1 (b) SELECT c FROM ( + SELECT 'h' as c + UNION + SELECT 'i' + UNION + SELECT 'j' +) der; + +SELECT a, b FROM t1; + +DROP TABLE t1; +DROP SEQUENCE s1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/suite/sql_sequence/grant.result b/mysql-test/suite/sql_sequence/grant.result index 7085d54858825..0a69d69fc740a 100644 --- a/mysql-test/suite/sql_sequence/grant.result +++ b/mysql-test/suite/sql_sequence/grant.result @@ -22,9 +22,9 @@ next_not_cached_value minimum_value maximum_value start_value increment cache_si 11 1 9223372036854775806 1 1 1000 0 0 connection read_only; select next value for s1; -ERROR 42000: INSERT command denied to user 'read_only'@'localhost' for table 's1' +ERROR 42000: INSERT command denied to user 'read_only'@'localhost' for table `mysqltest_1`.`s1` alter sequence s1 restart= 11; -ERROR 42000: ALTER command denied to user 'read_only'@'localhost' for table 's1' +ERROR 42000: ALTER command denied to user 'read_only'@'localhost' for table `mysqltest_1`.`s1` select * from s1; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 11 1 9223372036854775806 1 1 1000 0 0 @@ -33,7 +33,7 @@ select next value for s1; next value for s1 11 alter sequence s1 restart= 11; -ERROR 42000: ALTER command denied to user 'read_write'@'localhost' for table 's1' +ERROR 42000: ALTER command denied to user 'read_write'@'localhost' for table `mysqltest_1`.`s1` select * from s1; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 1011 1 9223372036854775806 1 1 1000 0 0 @@ -47,10 +47,10 @@ next_not_cached_value minimum_value maximum_value start_value increment cache_si 11 1 9223372036854775806 1 1 1000 0 0 connection only_alter; select next value for s1; -ERROR 42000: INSERT command denied to user 'only_alter'@'localhost' for table 's1' +ERROR 42000: INSERT command denied to user 'only_alter'@'localhost' for table `mysqltest_1`.`s1` alter sequence s1 restart= 11; select * from s1; -ERROR 42000: SELECT command denied to user 'only_alter'@'localhost' for table 's1' +ERROR 42000: SELECT command denied to user 'only_alter'@'localhost' for table `mysqltest_1`.`s1` connection default; drop database mysqltest_1; drop user 'normal'@'%'; diff --git a/mysql-test/suite/sql_sequence/gtid.result b/mysql-test/suite/sql_sequence/gtid.result index 8ca9a397354c0..5c0003d4ea3a2 100644 --- a/mysql-test/suite/sql_sequence/gtid.result +++ b/mysql-test/suite/sql_sequence/gtid.result @@ -109,28 +109,28 @@ maxvalue 100000 increment by 1 nocache nocycle; -ERROR HY000: Sequence 's_db.s2' values are conflicting +ERROR HY000: Sequence 's_db.s2' has out of range value for options create sequence s2 start with 1 minvalue 5 maxvalue 5 increment by 1 nocache nocycle; -ERROR HY000: Sequence 's_db.s2' values are conflicting +ERROR HY000: Sequence 's_db.s2' has out of range value for options create sequence s2 start with 1 minvalue 5 maxvalue 4 increment by 1 nocache nocycle; -ERROR HY000: Sequence 's_db.s2' values are conflicting +ERROR HY000: Sequence 's_db.s2' has out of range value for options create sequence s2 start with 1 minvalue 5 maxvalue 4 increment by 0 nocache nocycle; -ERROR HY000: Sequence 's_db.s2' values are conflicting +ERROR HY000: Sequence 's_db.s2' has out of range value for options ########################################### global read lock prevent query sequence ########################################### @@ -174,9 +174,9 @@ create sequence s_db.s2; drop sequence s_db.s2; connection m_normal_2; select next value for s_db.s1; -ERROR 42000: INSERT command denied to user 'normal_2'@'localhost' for table 's1' +ERROR 42000: INSERT command denied to user 'normal_2'@'localhost' for table `s_db`.`s1` create sequence s_db.s2; -ERROR 42000: CREATE command denied to user 'normal_2'@'localhost' for table 's2' +ERROR 42000: CREATE command denied to user 'normal_2'@'localhost' for table `s_db`.`s2` connection m_normal_1; drop sequence s_db.s1; ########################################### @@ -314,7 +314,7 @@ next_not_cached_value minimum_value maximum_value start_value increment cache_si update s_t set next_not_cached_value= 11,start_value=10, minimum_value=11; ERROR HY000: Storage engine SEQUENCE of the table `s_db`.`s_t` doesn't have this option ALTER SEQUENCE s_t restart with 11 start=10 minvalue=11; -ERROR HY000: Sequence 's_db.s_t' values are conflicting +ERROR HY000: Sequence 's_db.s_t' has out of range value for options commit; create table t_1(id int); insert into t_1 value(1111); @@ -796,11 +796,11 @@ select previous value for s1; previous value for s1 NULL insert into t1 values (2); -ERROR 42000: INSERT command denied to user 'normal_5'@'localhost' for table 't1' +ERROR 42000: INSERT command denied to user 'normal_5'@'localhost' for table `test`.`t1` select next value for s1; -ERROR 42000: INSERT command denied to user 'normal_5'@'localhost' for table 's1' +ERROR 42000: INSERT command denied to user 'normal_5'@'localhost' for table `test`.`s1` do setval(s1,1000,0); -ERROR 42000: INSERT command denied to user 'normal_5'@'localhost' for table 's1' +ERROR 42000: INSERT command denied to user 'normal_5'@'localhost' for table `test`.`s1` connection master; grant insert on test.* to normal_5@'%' identified by 'pass'; disconnect m_normal_3; diff --git a/mysql-test/suite/sql_sequence/mysqldump.result b/mysql-test/suite/sql_sequence/mysqldump.result index 7da48a917ca50..0199bb7162f09 100644 --- a/mysql-test/suite/sql_sequence/mysqldump.result +++ b/mysql-test/suite/sql_sequence/mysqldump.result @@ -12,7 +12,7 @@ SELECT SETVAL(`x1`, 1, 0); CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1024; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=1024; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` VALUES (1), @@ -27,7 +27,7 @@ SELECT SETVAL(`x1`, 1, 0); CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1024; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=1024; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` VALUES (1), @@ -42,7 +42,7 @@ SELECT SETVAL(`x1`, 1, 0); CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1024; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=1024; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` VALUES (1), @@ -53,7 +53,7 @@ INSERT INTO `t1` VALUES CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1024; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=1024; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` VALUES (1), diff --git a/mysql-test/suite/sql_sequence/next.result b/mysql-test/suite/sql_sequence/next.result index 76991fbe68cd3..9d55921006b41 100644 --- a/mysql-test/suite/sql_sequence/next.result +++ b/mysql-test/suite/sql_sequence/next.result @@ -387,7 +387,7 @@ previous value for t1 1 drop sequence t1; select previous value for t1; -ERROR 42S02: Table 'test.t1' doesn't exist +ERROR 42S02: Unknown SEQUENCE: 't1' CREATE SEQUENCE t1 start with 5 minvalue 1 maxvalue 10 increment by 1 cache 5 cycle; select previous value for t1; previous value for t1 diff --git a/mysql-test/suite/sql_sequence/next.test b/mysql-test/suite/sql_sequence/next.test index 9f0eebdf774c2..a80f9fad5618d 100644 --- a/mysql-test/suite/sql_sequence/next.test +++ b/mysql-test/suite/sql_sequence/next.test @@ -166,7 +166,7 @@ select previous value for t1; flush tables; select previous value for t1; drop sequence t1; ---error ER_NO_SUCH_TABLE +--error ER_UNKNOWN_SEQUENCES select previous value for t1; CREATE SEQUENCE t1 start with 5 minvalue 1 maxvalue 10 increment by 1 cache 5 cycle; select previous value for t1; diff --git a/mysql-test/suite/sql_sequence/other.result b/mysql-test/suite/sql_sequence/other.result index 5226ce787894c..d237be635f784 100644 --- a/mysql-test/suite/sql_sequence/other.result +++ b/mysql-test/suite/sql_sequence/other.result @@ -50,9 +50,9 @@ ERROR HY000: Field 'maximum_value' doesn't have a default value insert into s1 values (next value for s1, 1,9223372036854775806,1,1,1000,0,0); ERROR HY000: Table 's1' is specified twice, both as a target for 'INSERT' and as a separate source for data insert into s1 values(1000,9223372036854775806,1,1,1,1000,0,0); -ERROR HY000: Sequence 'test.s1' values are conflicting +ERROR HY000: Sequence 'test.s1' has out of range value for options insert into s1 values(0,9223372036854775806,1,1,1,1000,0,0); -ERROR HY000: Sequence 'test.s1' values are conflicting +ERROR HY000: Sequence 'test.s1' has out of range value for options select * from s1; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 1 1 9223372036854775806 1 1 1000 0 0 @@ -67,7 +67,7 @@ select * from s1; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 2000 1 9223372036854775806 1 1 1000 0 0 insert into s2 values(0, 1, 10, 1, 2, 1, 1, 0); -ERROR HY000: Sequence 'test.s2' values are conflicting +ERROR HY000: Sequence 'test.s2' has out of range value for options select * from s1; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 2000 1 9223372036854775806 1 1 1000 0 0 diff --git a/mysql-test/suite/sql_sequence/replication.result b/mysql-test/suite/sql_sequence/replication.result index 7bf0eac8c472e..762c332dbd67e 100644 --- a/mysql-test/suite/sql_sequence/replication.result +++ b/mysql-test/suite/sql_sequence/replication.result @@ -227,28 +227,28 @@ maxvalue 100000 increment by 1 nocache nocycle; -ERROR HY000: Sequence 's_db.s2' values are conflicting +ERROR HY000: Sequence 's_db.s2' has out of range value for options create sequence s2 start with 1 minvalue 5 maxvalue 5 increment by 1 nocache nocycle; -ERROR HY000: Sequence 's_db.s2' values are conflicting +ERROR HY000: Sequence 's_db.s2' has out of range value for options create sequence s2 start with 1 minvalue 5 maxvalue 4 increment by 1 nocache nocycle; -ERROR HY000: Sequence 's_db.s2' values are conflicting +ERROR HY000: Sequence 's_db.s2' has out of range value for options create sequence s2 start with 1 minvalue 5 maxvalue 4 increment by 0 nocache nocycle; -ERROR HY000: Sequence 's_db.s2' values are conflicting +ERROR HY000: Sequence 's_db.s2' has out of range value for options ########################################### global read lock prevent query sequence ########################################### @@ -285,9 +285,9 @@ create sequence s_db.s2; drop sequence s_db.s2; connection m_normal_2; select NEXT VALUE for s_db.s1; -ERROR 42000: INSERT command denied to user 'normal_2'@'localhost' for table 's1' +ERROR 42000: INSERT command denied to user 'normal_2'@'localhost' for table `s_db`.`s1` create sequence s_db.s2; -ERROR 42000: CREATE command denied to user 'normal_2'@'localhost' for table 's2' +ERROR 42000: CREATE command denied to user 'normal_2'@'localhost' for table `s_db`.`s2` connection m_normal_1; drop sequence s_db.s1; ########################################### @@ -412,12 +412,12 @@ select * from s_t; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 16 1 20 1 1 5 1 0 alter sequence s_t minvalue=11 maxvalue=9; -ERROR HY000: Sequence 's_db.s_t' values are conflicting +ERROR HY000: Sequence 's_db.s_t' has out of range value for options select * from s_t; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 16 1 20 1 1 5 1 0 alter sequence s_t restart= 12 start=10 minvalue=11 maxvalue=20; -ERROR HY000: Sequence 's_db.s_t' values are conflicting +ERROR HY000: Sequence 's_db.s_t' has out of range value for options select * from s_t; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 16 1 20 1 1 5 1 0 diff --git a/mysql-test/suite/stress/r/deadlock_drop_table.result b/mysql-test/suite/stress/r/deadlock_drop_table.result index 326f694e8d98d..7e549157c81fd 100644 --- a/mysql-test/suite/stress/r/deadlock_drop_table.result +++ b/mysql-test/suite/stress/r/deadlock_drop_table.result @@ -19,11 +19,12 @@ a b c 1 NULL NULL set debug_sync='now SIGNAL go'; set debug_sync='now WAIT_FOR parked2'; -set debug_sync='before_wait_for_refs SIGNAL waiting WAIT_FOR go2'; +set debug_sync='before_wait_for_refs SIGNAL waiting WAIT_FOR go3'; drop table t1;; connection con2; set debug_sync='now WAIT_FOR waiting'; set debug_sync='now SIGNAL go2'; +set debug_sync='now SIGNAL go3'; connection default; connection con1; connection default; diff --git a/mysql-test/suite/stress/t/ddl_innodb.test b/mysql-test/suite/stress/t/ddl_innodb.test index 083ec43e7d742..d5e23124b4be1 100644 --- a/mysql-test/suite/stress/t/ddl_innodb.test +++ b/mysql-test/suite/stress/t/ddl_innodb.test @@ -1,3 +1,4 @@ +--source include/no_valgrind_without_big.inc ######## t/ddl_innodb.test ###### # # Stress the storage engine InnoDB with CREATE/DROP TABLE/INDEX diff --git a/mysql-test/suite/stress/t/deadlock_drop_table.test b/mysql-test/suite/stress/t/deadlock_drop_table.test index b49ca0b9fb7d6..b4f8f2201e01e 100644 --- a/mysql-test/suite/stress/t/deadlock_drop_table.test +++ b/mysql-test/suite/stress/t/deadlock_drop_table.test @@ -1,4 +1,5 @@ --source include/have_debug.inc +--source include/have_debug_sync.inc create or replace table t1 (a int primary key, b int, c int, key(b),key(c)) engine=myisam; insert into t1 (a) values(1); @@ -19,15 +20,12 @@ set debug_sync='now WAIT_FOR parked'; select * from t1; set debug_sync='now SIGNAL go'; set debug_sync='now WAIT_FOR parked2'; -set debug_sync='before_wait_for_refs SIGNAL waiting WAIT_FOR go2'; +set debug_sync='before_wait_for_refs SIGNAL waiting WAIT_FOR go3'; --send drop table t1; --connection con2 set debug_sync='now WAIT_FOR waiting'; set debug_sync='now SIGNAL go2'; - -# Write out show processlist if the debug sync point times out -let $wait_condition= select count(*)=0 from information_schema.processlist where state like "%debug%"; -source include/wait_condition.inc; +set debug_sync='now SIGNAL go3'; --connection default --reap diff --git a/mysql-test/suite/sys_vars/inc/explicit_defaults_for_timestamp.inc b/mysql-test/suite/sys_vars/inc/explicit_defaults_for_timestamp.inc index 1fea4ca5bb936..0cd8aa2c5687f 100644 --- a/mysql-test/suite/sys_vars/inc/explicit_defaults_for_timestamp.inc +++ b/mysql-test/suite/sys_vars/inc/explicit_defaults_for_timestamp.inc @@ -5,19 +5,10 @@ CREATE TABLE t1 (a TIMESTAMP NULL); SHOW CREATE TABLE t1; DROP TABLE t1; - -if (`SELECT @@explicit_defaults_for_timestamp=0`) -{ - --error ER_INVALID_DEFAULT - CREATE TABLE t1 (a TIMESTAMP DEFAULT NULL); -} - -if (`SELECT @@explicit_defaults_for_timestamp=1`) -{ - CREATE TABLE t1 (a TIMESTAMP DEFAULT NULL); - SHOW CREATE TABLE t1; - DROP TABLE t1; -} +CREATE TABLE t1 (a TIMESTAMP DEFAULT NULL); +INSERT t1 () VALUES (); +SHOW CREATE TABLE t1; +DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; @@ -110,3 +101,34 @@ SELECT * FROM t1; DROP TABLE t1; SET sql_mode=DEFAULT; SET timestamp=DEFAULT; + +--echo # +--echo # MDEV-29075 Changing explicit_defaults_for_timestamp within stored procedure works inconsistently +--echo # +set statement explicit_defaults_for_timestamp=1-@@explicit_defaults_for_timestamp for create table t1 (ts timestamp); +show create table t1; +drop table t1; + +--delimiter $ +create procedure pr() +begin + set explicit_defaults_for_timestamp= 1-@@explicit_defaults_for_timestamp; + create table t1 (ts timestamp); +end $ +--delimiter ; + +call pr(); +show create table t1; +drop procedure pr; +drop table t1; + +prepare stmt from 'create or replace table t1 (a timestamp)'; +execute stmt; +show create table t1; +set explicit_defaults_for_timestamp=1-@@explicit_defaults_for_timestamp; +execute stmt; +show create table t1; +set explicit_defaults_for_timestamp=1-@@explicit_defaults_for_timestamp; +execute stmt; +show create table t1; +drop table t1; diff --git a/mysql-test/suite/sys_vars/r/aria_log_dir_path_basic.result b/mysql-test/suite/sys_vars/r/aria_log_dir_path_basic.result new file mode 100644 index 0000000000000..8563b024a75d7 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/aria_log_dir_path_basic.result @@ -0,0 +1,36 @@ +SELECT COUNT(@@GLOBAL.aria_log_dir_path); +COUNT(@@GLOBAL.aria_log_dir_path) +1 +SET @@GLOBAL.aria_log_dir_path=1; +ERROR HY000: Variable 'aria_log_dir_path' is a read only variable +SELECT COUNT(@@GLOBAL.aria_log_dir_path); +COUNT(@@GLOBAL.aria_log_dir_path) +1 +SELECT @@GLOBAL.aria_log_dir_path = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='aria_log_dir_path'; +@@GLOBAL.aria_log_dir_path = VARIABLE_VALUE +1 +SELECT COUNT(@@GLOBAL.aria_log_dir_path); +COUNT(@@GLOBAL.aria_log_dir_path) +1 +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='aria_log_dir_path'; +COUNT(VARIABLE_VALUE) +1 +SELECT @@aria_log_dir_path = @@GLOBAL.aria_log_dir_path; +@@aria_log_dir_path = @@GLOBAL.aria_log_dir_path +1 +SELECT COUNT(@@aria_log_dir_path); +COUNT(@@aria_log_dir_path) +1 +SELECT COUNT(@@local.aria_log_dir_path); +ERROR HY000: Variable 'aria_log_dir_path' is a GLOBAL variable +SELECT COUNT(@@SESSION.aria_log_dir_path); +ERROR HY000: Variable 'aria_log_dir_path' is a GLOBAL variable +SELECT COUNT(@@GLOBAL.aria_log_dir_path); +COUNT(@@GLOBAL.aria_log_dir_path) +1 +SELECT aria_log_dir_path = @@SESSION.aria_log_dir_path; +ERROR 42S22: Unknown column 'aria_log_dir_path' in 'field list' diff --git a/mysql-test/suite/sys_vars/r/binlog_alter_two_phase.result b/mysql-test/suite/sys_vars/r/binlog_alter_two_phase.result new file mode 100644 index 0000000000000..540d1b4945880 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/binlog_alter_two_phase.result @@ -0,0 +1,53 @@ +set binlog_alter_two_phase = OFF; +select @@binlog_alter_two_phase; +@@binlog_alter_two_phase +0 +set binlog_alter_two_phase = ON; +select @@binlog_alter_two_phase; +@@binlog_alter_two_phase +1 +# wrong value +set binlog_alter_two_phase=BINLOG_OY; +ERROR 42000: Variable 'binlog_alter_two_phase' can't be set to the value of 'BINLOG_OY' +select @@binlog_alter_two_phase; +@@binlog_alter_two_phase +1 +#true and false +set binlog_alter_two_phase=false; +select @@binlog_alter_two_phase; +@@binlog_alter_two_phase +0 +set binlog_alter_two_phase=true; +select @@binlog_alter_two_phase; +@@binlog_alter_two_phase +1 +set binlog_alter_two_phase=0; +select @@binlog_alter_two_phase; +@@binlog_alter_two_phase +0 +set binlog_alter_two_phase=1; +select @@binlog_alter_two_phase; +@@binlog_alter_two_phase +1 +##wrong value +set binlog_alter_two_phase=2; +ERROR 42000: Variable 'binlog_alter_two_phase' can't be set to the value of '2' +select @@binlog_alter_two_phase; +@@binlog_alter_two_phase +1 +#Global value +set global binlog_alter_two_phase = OFF; +connect con1,localhost,root,,; +select @@binlog_alter_two_phase; +@@binlog_alter_two_phase +0 +disconnect con1; +connection default; +set global binlog_alter_two_phase = ON; +connect con1,localhost,root,,; +select @@binlog_alter_two_phase; +@@binlog_alter_two_phase +1 +disconnect con1; +connection default; +set global binlog_alter_two_phase=0; diff --git a/mysql-test/suite/sys_vars/r/character_set_database_func.result b/mysql-test/suite/sys_vars/r/character_set_database_func.result index efdb923365216..b1c2db1efc2c9 100644 --- a/mysql-test/suite/sys_vars/r/character_set_database_func.result +++ b/mysql-test/suite/sys_vars/r/character_set_database_func.result @@ -29,14 +29,14 @@ CREATE DATABASE db1; USE db1; SHOW CREATE DATABASE db1; Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 */ +db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */ CREATE TABLE t1(a INT, b VARCHAR(40)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(40) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci DROP TABLE t1; DROP DATABASE db1; '--ascii character set specified--' @@ -44,14 +44,14 @@ CREATE DATABASE db1 CHARACTER SET ascii; USE db1; SHOW CREATE DATABASE db1; Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET ascii */ +db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET ascii COLLATE ascii_general_ci */ CREATE TABLE t1(a INT, b VARCHAR(40)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(40) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=ascii +) ENGINE=MyISAM DEFAULT CHARSET=ascii COLLATE=ascii_general_ci DROP TABLE t1; DROP DATABASE db1; '------Check if load data uses character_set_database----------' diff --git a/mysql-test/suite/sys_vars/r/character_set_server_func.result b/mysql-test/suite/sys_vars/r/character_set_server_func.result index fb922afe5b92e..e1e68da78e76d 100644 --- a/mysql-test/suite/sys_vars/r/character_set_server_func.result +++ b/mysql-test/suite/sys_vars/r/character_set_server_func.result @@ -22,7 +22,7 @@ CREATE DATABASE db1; USE db1; SHOW CREATE DATABASE db1; Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */ +db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ DROP DATABASE db1; select @@character_set_database; @@character_set_database @@ -33,7 +33,7 @@ CREATE DATABASE db1; USE db1; SHOW CREATE DATABASE db1; Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 */ +db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */ DROP DATABASE db1; select @@character_set_database; @@character_set_database @@ -49,7 +49,7 @@ CREATE DATABASE db1; USE db1; SHOW CREATE DATABASE db1; Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 */ +db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */ DROP DATABASE db1; SELECT @@character_set_database; @@character_set_database @@ -59,7 +59,7 @@ CREATE DATABASE db1 character set ascii; USE db1; SHOW CREATE DATABASE db1; Database Create Database -db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET ascii */ +db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET ascii COLLATE ascii_general_ci */ DROP DATABASE db1; select @@character_set_database; @@character_set_database diff --git a/mysql-test/suite/sys_vars/r/collation_database_func.result b/mysql-test/suite/sys_vars/r/collation_database_func.result index 8cce4ffda4a96..01b3ca6ff2e6d 100644 --- a/mysql-test/suite/sys_vars/r/collation_database_func.result +++ b/mysql-test/suite/sys_vars/r/collation_database_func.result @@ -32,7 +32,7 @@ CREATE TABLE t1(a CHAR(20)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(20) COLLATE utf8mb3_roman_ci DEFAULT NULL + `a` char(20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_roman_ci '---check if updating collation_database effects new table/column---' SET @@session.collation_database = latin7_general_cs; @@ -40,7 +40,7 @@ CREATE TABLE t2(a CHAR(10)); SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` char(10) COLLATE utf8mb3_roman_ci DEFAULT NULL + `a` char(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_roman_ci DROP TABLE t1,t2; '--check value of collation and character set when current db is dropped' diff --git a/mysql-test/suite/sys_vars/r/collation_server_func.result b/mysql-test/suite/sys_vars/r/collation_server_func.result index e9acbe14eebd0..37b0c0a815a1d 100644 --- a/mysql-test/suite/sys_vars/r/collation_server_func.result +++ b/mysql-test/suite/sys_vars/r/collation_server_func.result @@ -30,7 +30,7 @@ CREATE TABLE t1(a CHAR(20)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(20) COLLATE latin1_german1_ci DEFAULT NULL + `a` char(20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci '---check if updating collation_server effects new table/column---' SET @@session.collation_server = latin1_swedish_ci; @@ -38,7 +38,7 @@ CREATE TABLE t2(a CHAR(10)); SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` char(10) COLLATE latin1_german1_ci DEFAULT NULL + `a` char(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci INSERT INTO t1 VALUES('Muffler'),('M�ller'),('MX Systems'); '---check if collation_server effects results sort order---' diff --git a/mysql-test/suite/sys_vars/r/debug_sync_basic.result b/mysql-test/suite/sys_vars/r/debug_sync_basic.result index 6ebb46dd6620a..11506cac2c228 100644 --- a/mysql-test/suite/sys_vars/r/debug_sync_basic.result +++ b/mysql-test/suite/sys_vars/r/debug_sync_basic.result @@ -2,17 +2,17 @@ select @@global.debug_sync; ERROR HY000: Variable 'debug_sync' is a SESSION variable select @@session.debug_sync; @@session.debug_sync -ON - current signal: '' +ON - current signals: '' show global variables like "debug_sync"; Variable_name Value show session variables like "debug_sync"; Variable_name Value -debug_sync ON - current signal: '' +debug_sync ON - current signals: '' select * from information_schema.global_variables where variable_name="debug_sync"; VARIABLE_NAME VARIABLE_VALUE select * from information_schema.session_variables where variable_name="debug_sync"; VARIABLE_NAME VARIABLE_VALUE -DEBUG_SYNC ON - current signal: '' +DEBUG_SYNC ON - current signals: '' set @@session.debug_sync=1; ERROR 42000: Incorrect argument type to variable 'debug_sync' set @@session.debug_sync=1.1; diff --git a/mysql-test/suite/sys_vars/r/default_tmp_storage_engine_basic.result b/mysql-test/suite/sys_vars/r/default_tmp_storage_engine_basic.result index 22056efc934e0..3c21853947226 100644 --- a/mysql-test/suite/sys_vars/r/default_tmp_storage_engine_basic.result +++ b/mysql-test/suite/sys_vars/r/default_tmp_storage_engine_basic.result @@ -105,12 +105,12 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TEMPORARY TABLE `t2` ( `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; SET default_storage_engine = MEMORY; CREATE TABLE t1 (a INT); @@ -119,12 +119,12 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TEMPORARY TABLE `t2` ( `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; SET @@global.default_tmp_storage_engine = NULL; SET @@session.default_tmp_storage_engine = NULL; @@ -135,12 +135,12 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TEMPORARY TABLE `t2` ( `b` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; SET default_storage_engine = MYISAM; CREATE TABLE t1 (a INT); @@ -149,12 +149,12 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TEMPORARY TABLE `t2` ( `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; SET default_tmp_storage_engine = DEFAULT; SET default_storage_engine = DEFAULT; @@ -164,12 +164,12 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TEMPORARY TABLE `t2` ( `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; SET @@global.default_tmp_storage_engine = @start_global_value; SELECT @@global.default_tmp_storage_engine; diff --git a/mysql-test/suite/sys_vars/r/default_tmp_storage_engine_rocksdb.result b/mysql-test/suite/sys_vars/r/default_tmp_storage_engine_rocksdb.result index 9ec7b900ccf98..19fae14579d97 100644 --- a/mysql-test/suite/sys_vars/r/default_tmp_storage_engine_rocksdb.result +++ b/mysql-test/suite/sys_vars/r/default_tmp_storage_engine_rocksdb.result @@ -12,7 +12,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 +) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TEMPORARY TABLE t2 LIKE t1; ERROR HY000: Table storage engine 'ROCKSDB' does not support the create option 'TEMPORARY' DROP TABLE t1; @@ -23,13 +23,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `t` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TEMPORARY TABLE t2 LIKE t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TEMPORARY TABLE `t2` ( `t` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t2; SET default_storage_engine = rocksdb; SET default_tmp_storage_engine = default; @@ -38,7 +38,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `t` int(11) DEFAULT NULL -) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 +) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TEMPORARY TABLE t2 LIKE t1; ERROR HY000: Table storage engine 'ROCKSDB' does not support the create option 'TEMPORARY' CREATE TEMPORARY TABLE t2 (t int); @@ -75,12 +75,12 @@ SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( `t` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `t` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t; SET GLOBAL default_tmp_storage_engine='default'; SELECT @@GLOBAL.default_tmp_storage_engine, @@GLOBAL.default_storage_engine, @@GLOBAL.storage_engine, @@SESSION.default_tmp_storage_engine, @@SESSION.default_storage_engine, @@SESSION.storage_engine; @@ -92,11 +92,11 @@ SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( `t` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `t` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1, t; SET GLOBAL default_tmp_storage_engine=NULL; diff --git a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_basic.result b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_basic.result deleted file mode 100644 index d9a9a2909ce2e..0000000000000 --- a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_basic.result +++ /dev/null @@ -1,21 +0,0 @@ -select @@global.explicit_defaults_for_timestamp; -@@global.explicit_defaults_for_timestamp -0 -select @@session.explicit_defaults_for_timestamp; -ERROR HY000: Variable 'explicit_defaults_for_timestamp' is a GLOBAL variable -show global variables like 'explicit_defaults_for_timestamp'; -Variable_name Value -explicit_defaults_for_timestamp OFF -show session variables like 'explicit_defaults_for_timestamp'; -Variable_name Value -explicit_defaults_for_timestamp OFF -select * from information_schema.global_variables where variable_name='explicit_defaults_for_timestamp'; -VARIABLE_NAME VARIABLE_VALUE -EXPLICIT_DEFAULTS_FOR_TIMESTAMP OFF -select * from information_schema.session_variables where variable_name='explicit_defaults_for_timestamp'; -VARIABLE_NAME VARIABLE_VALUE -EXPLICIT_DEFAULTS_FOR_TIMESTAMP OFF -set global explicit_defaults_for_timestamp=true; -ERROR HY000: Variable 'explicit_defaults_for_timestamp' is a read only variable -set session explicit_defaults_for_timestamp=true; -ERROR HY000: Variable 'explicit_defaults_for_timestamp' is a read only variable diff --git a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_off.result b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_off.result index e94766be8bd77..1d779352df5dd 100644 --- a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_off.result +++ b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_off.result @@ -1,88 +1,95 @@ +set @@explicit_defaults_for_timestamp=0; CREATE TABLE t1 (a TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP DEFAULT NULL); -ERROR 42000: Invalid default value for 'a' +INSERT t1 () VALUES (); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP DEFAULT '2001-01-01 10:20:30'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT '2001-01-01 10:20:30' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT '2001-01-01 10:20:30'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT '2001-01-01 10:20:30' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT '2001-01-01 10:20:30'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT '2001-01-01 10:20:30' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL); SHOW CREATE TABLE t1; @@ -90,7 +97,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL); SHOW CREATE TABLE t1; @@ -98,7 +105,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; @@ -106,7 +113,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; @@ -114,7 +121,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; @@ -122,7 +129,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; @@ -130,7 +137,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NOT NULL DEFAULT current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; @@ -138,7 +145,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NULL DEFAULT current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; @@ -146,7 +153,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NOT NULL DEFAULT current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP) AS SELECT 1 AS i; SHOW CREATE TABLE t1; @@ -154,14 +161,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `i` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 (b TIMESTAMP) AS SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a INT); @@ -171,7 +178,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-10802 TIMESTAMP NOT NULL field with explicit_defaults_for_timestamp and NO_ZERO_DATE shouldn't throw error @@ -186,3 +193,48 @@ a DROP TABLE t1; SET sql_mode=DEFAULT; SET timestamp=DEFAULT; +# +# MDEV-29075 Changing explicit_defaults_for_timestamp within stored procedure works inconsistently +# +set statement explicit_defaults_for_timestamp=1-@@explicit_defaults_for_timestamp for create table t1 (ts timestamp); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ts` timestamp NULL DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +create procedure pr() +begin +set explicit_defaults_for_timestamp= 1-@@explicit_defaults_for_timestamp; +create table t1 (ts timestamp); +end $ +call pr(); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ts` timestamp NULL DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop procedure pr; +drop table t1; +prepare stmt from 'create or replace table t1 (a timestamp)'; +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NULL DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +set explicit_defaults_for_timestamp=1-@@explicit_defaults_for_timestamp; +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +set explicit_defaults_for_timestamp=1-@@explicit_defaults_for_timestamp; +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NULL DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; diff --git a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_on.result b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_on.result index dac796b43191e..85cbfbc2962c8 100644 --- a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_on.result +++ b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_on.result @@ -1,93 +1,95 @@ +set @@explicit_defaults_for_timestamp=1; CREATE TABLE t1 (a TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP DEFAULT NULL); +INSERT t1 () VALUES (); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP DEFAULT '2001-01-01 10:20:30'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT '2001-01-01 10:20:30' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT '2001-01-01 10:20:30'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT '2001-01-01 10:20:30' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT '2001-01-01 10:20:30'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT '2001-01-01 10:20:30' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL); SHOW CREATE TABLE t1; @@ -95,7 +97,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL, `b` timestamp NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL); SHOW CREATE TABLE t1; @@ -103,7 +105,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL, `b` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; @@ -111,7 +113,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL, `b` timestamp NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; @@ -119,7 +121,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL, `b` timestamp NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; @@ -127,7 +129,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL, `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; @@ -135,7 +137,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL, `b` timestamp NULL DEFAULT current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; @@ -143,7 +145,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL, `b` timestamp NULL DEFAULT current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; @@ -151,7 +153,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL, `b` timestamp NOT NULL DEFAULT current_timestamp() -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP) AS SELECT 1 AS i; SHOW CREATE TABLE t1; @@ -159,14 +161,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL, `i` int(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 (b TIMESTAMP) AS SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `b` timestamp NULL DEFAULT NULL, `a` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a INT); @@ -176,7 +178,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` timestamp NULL DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-10802 TIMESTAMP NOT NULL field with explicit_defaults_for_timestamp and NO_ZERO_DATE shouldn't throw error @@ -193,3 +195,48 @@ a DROP TABLE t1; SET sql_mode=DEFAULT; SET timestamp=DEFAULT; +# +# MDEV-29075 Changing explicit_defaults_for_timestamp within stored procedure works inconsistently +# +set statement explicit_defaults_for_timestamp=1-@@explicit_defaults_for_timestamp for create table t1 (ts timestamp); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +create procedure pr() +begin +set explicit_defaults_for_timestamp= 1-@@explicit_defaults_for_timestamp; +create table t1 (ts timestamp); +end $ +call pr(); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop procedure pr; +drop table t1; +prepare stmt from 'create or replace table t1 (a timestamp)'; +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +set explicit_defaults_for_timestamp=1-@@explicit_defaults_for_timestamp; +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NULL DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +set explicit_defaults_for_timestamp=1-@@explicit_defaults_for_timestamp; +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; diff --git a/mysql-test/suite/sys_vars/r/group_concat_max_len_func.result b/mysql-test/suite/sys_vars/r/group_concat_max_len_func.result index 30e2639af3769..01f44ae51be67 100644 --- a/mysql-test/suite/sys_vars/r/group_concat_max_len_func.result +++ b/mysql-test/suite/sys_vars/r/group_concat_max_len_func.result @@ -94,4 +94,58 @@ DROP TABLE t1; disconnect test_con2; disconnect test_con1; connection default; +CREATE TABLE t1(val VARCHAR(100) PRIMARY KEY) CHARACTER SET utf8mb4 COLLATE utf8mb4_danish_ci; +INSERT INTO t1 VALUES('bar'); +INSERT INTO t1 VALUES('foo'); +SET group_concat_max_len = 1073741823; +SHOW VARIABLES LIKE 'group_concat_max_len'; +Variable_name Value +group_concat_max_len 1073741823 +SELECT GROUP_CONCAT(val) AS simple FROM t1; +simple +bar,foo +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; +nested +bar,foo +SET group_concat_max_len = 1073741824; +SHOW VARIABLES LIKE 'group_concat_max_len'; +Variable_name Value +group_concat_max_len 1073741824 +SELECT GROUP_CONCAT(val) AS simple FROM t1; +simple +bar,foo +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; +nested +bar,foo +SET group_concat_max_len = 1073741825; +SHOW VARIABLES LIKE 'group_concat_max_len'; +Variable_name Value +group_concat_max_len 1073741825 +SELECT GROUP_CONCAT(val) AS simple FROM t1; +simple +bar,foo +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; +nested +bar,foo +SET group_concat_max_len = 1073741826; +SHOW VARIABLES LIKE 'group_concat_max_len'; +Variable_name Value +group_concat_max_len 1073741826 +SELECT GROUP_CONCAT(val) AS simple FROM t1; +simple +bar,foo +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; +nested +bar,foo +SET group_concat_max_len = 2147483649; +SHOW VARIABLES LIKE 'group_concat_max_len'; +Variable_name Value +group_concat_max_len 2147483649 +SELECT GROUP_CONCAT(val) AS simple FROM t1; +simple +bar,foo +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; +nested +bar,foo +DROP TABLE t1; SET @@global.group_concat_max_len = @save; diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_dump_pct_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_dump_pct_basic.result index 93a85ffbf435f..d4ae7edb70e09 100644 --- a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_dump_pct_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_dump_pct_basic.result @@ -4,6 +4,11 @@ SELECT @orig; 25 SET GLOBAL innodb_buffer_pool_dump_pct=3; # Do the dump +SELECT @@global.innodb_buffer_pool_dump_now; +SELECT variable_value INTO @old_dump_status FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'; +SET GLOBAL innodb_buffer_pool_dump_now = ON; +SELECT @@global.innodb_buffer_pool_dump_now; SET GLOBAL innodb_buffer_pool_dump_pct=20; SELECT @@global.innodb_buffer_pool_dump_pct; @@global.innodb_buffer_pool_dump_pct diff --git a/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result b/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result index 92e22c6aa34df..c11f4ee617c77 100644 --- a/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result @@ -1,28 +1,28 @@ SET @start_global_value = @@global.innodb_change_buffering; SELECT @start_global_value; @start_global_value -all +none Valid values are 'all', 'deletes', 'changes', 'inserts', 'none', 'purges' select @@global.innodb_change_buffering in ('all', 'deletes', 'changes', 'inserts', 'none', 'purges'); @@global.innodb_change_buffering in ('all', 'deletes', 'changes', 'inserts', 'none', 'purges') 1 select @@global.innodb_change_buffering; @@global.innodb_change_buffering -all +none select @@session.innodb_change_buffering; ERROR HY000: Variable 'innodb_change_buffering' is a GLOBAL variable show global variables like 'innodb_change_buffering'; Variable_name Value -innodb_change_buffering all +innodb_change_buffering none show session variables like 'innodb_change_buffering'; Variable_name Value -innodb_change_buffering all +innodb_change_buffering none select * from information_schema.global_variables where variable_name='innodb_change_buffering'; VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFERING all +INNODB_CHANGE_BUFFERING none select * from information_schema.session_variables where variable_name='innodb_change_buffering'; VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFERING all +INNODB_CHANGE_BUFFERING none set global innodb_change_buffering='none'; select @@global.innodb_change_buffering; @@global.innodb_change_buffering @@ -62,4 +62,4 @@ ERROR 42000: Variable 'innodb_change_buffering' can't be set to the value of 'so SET @@global.innodb_change_buffering = @start_global_value; SELECT @@global.innodb_change_buffering; @@global.innodb_change_buffering -all +none diff --git a/mysql-test/suite/sys_vars/r/innodb_disallow_writes_basic.result b/mysql-test/suite/sys_vars/r/innodb_disallow_writes_basic.result deleted file mode 100644 index bfb6b67b5d831..0000000000000 --- a/mysql-test/suite/sys_vars/r/innodb_disallow_writes_basic.result +++ /dev/null @@ -1,45 +0,0 @@ -# -# innodb_disallow_writes -# -# save the initial value -SET @innodb_disallow_writes_global_saved = @@global.innodb_disallow_writes; -# default -SELECT @@global.innodb_disallow_writes; -@@global.innodb_disallow_writes -0 - -# scope -SELECT @@session.innodb_disallow_writes; -ERROR HY000: Variable 'innodb_disallow_writes' is a GLOBAL variable -SET @@global.innodb_disallow_writes=OFF; -SELECT @@global.innodb_disallow_writes; -@@global.innodb_disallow_writes -0 -SET @@global.innodb_disallow_writes=ON; -SELECT @@global.innodb_disallow_writes; -@@global.innodb_disallow_writes -1 - -# valid values -SET @@global.innodb_disallow_writes='OFF'; -SELECT @@global.innodb_disallow_writes; -@@global.innodb_disallow_writes -0 -SET @@global.innodb_disallow_writes=ON; -SELECT @@global.innodb_disallow_writes; -@@global.innodb_disallow_writes -1 -SET @@global.innodb_disallow_writes=default; -SELECT @@global.innodb_disallow_writes; -@@global.innodb_disallow_writes -0 - -# invalid values -SET @@global.innodb_disallow_writes=NULL; -ERROR 42000: Variable 'innodb_disallow_writes' can't be set to the value of 'NULL' -SET @@global.innodb_disallow_writes='junk'; -ERROR 42000: Variable 'innodb_disallow_writes' can't be set to the value of 'junk' - -# restore the initial value -SET @@global.innodb_disallow_writes = @innodb_disallow_writes_global_saved; -# End of test diff --git a/mysql-test/suite/sys_vars/r/innodb_ft_cache_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_ft_cache_size_basic.result index f50b6d4180cae..a7786b53e3c06 100644 --- a/mysql-test/suite/sys_vars/r/innodb_ft_cache_size_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_ft_cache_size_basic.result @@ -16,6 +16,15 @@ select * from information_schema.session_variables where variable_name='innodb_f VARIABLE_NAME VARIABLE_VALUE INNODB_FT_CACHE_SIZE 8000000 set global innodb_ft_cache_size=1; -ERROR HY000: Variable 'innodb_ft_cache_size' is a read only variable +Warnings: +Warning 1292 Truncated incorrect innodb_ft_cache_size value: '1' +SHOW VARIABLES like 'innodb_ft_cache_size'; +Variable_name Value +innodb_ft_cache_size 1600000 set session innodb_ft_cache_size=1; -ERROR HY000: Variable 'innodb_ft_cache_size' is a read only variable +ERROR HY000: Variable 'innodb_ft_cache_size' is a GLOBAL variable and should be set with SET GLOBAL +set global innodb_ft_cache_size=512*1024*1024; +SHOW VARIABLES like 'innodb_ft_cache_size'; +Variable_name Value +innodb_ft_cache_size 536870912 +set global innodb_ft_cache_size=default; diff --git a/mysql-test/suite/sys_vars/r/innodb_ft_total_cache_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_ft_total_cache_size_basic.result index ff234a1fcbf5f..3f21a57385c18 100644 --- a/mysql-test/suite/sys_vars/r/innodb_ft_total_cache_size_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_ft_total_cache_size_basic.result @@ -16,6 +16,15 @@ select * from information_schema.session_variables where variable_name='innodb_f VARIABLE_NAME VARIABLE_VALUE INNODB_FT_TOTAL_CACHE_SIZE 640000000 set global innodb_ft_total_cache_size=1; -ERROR HY000: Variable 'innodb_ft_total_cache_size' is a read only variable +Warnings: +Warning 1292 Truncated incorrect innodb_ft_total_cache_size value: '1' set session innodb_ft_total_cache_size=1; -ERROR HY000: Variable 'innodb_ft_total_cache_size' is a read only variable +ERROR HY000: Variable 'innodb_ft_total_cache_size' is a GLOBAL variable and should be set with SET GLOBAL +SHOW VARIABLES like 'innodb_ft_total_cache_size'; +Variable_name Value +innodb_ft_total_cache_size 32000000 +set global innodb_ft_total_cache_size=512*1024*1024; +show variables like 'innodb_ft_total_cache_size'; +Variable_name Value +innodb_ft_total_cache_size 536870912 +set global innodb_ft_total_cache_size=default; diff --git a/mysql-test/suite/sys_vars/r/keep_files_on_create_basic.result b/mysql-test/suite/sys_vars/r/keep_files_on_create_basic.result index b7deea88a9cfa..f7889f3f7dd1c 100644 --- a/mysql-test/suite/sys_vars/r/keep_files_on_create_basic.result +++ b/mysql-test/suite/sys_vars/r/keep_files_on_create_basic.result @@ -8,75 +8,111 @@ SELECT @start_session_value; 0 '#--------------------FN_DYNVARS_054_01-------------------------#' SET @@global.keep_files_on_create = ON; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SET @@global.keep_files_on_create = DEFAULT; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@global.keep_files_on_create; @@global.keep_files_on_create 0 SET @@session.keep_files_on_create = ON; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SET @@session.keep_files_on_create = DEFAULT; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@session.keep_files_on_create; @@session.keep_files_on_create 0 '#--------------------FN_DYNVARS_054_02-------------------------#' SET @@global.keep_files_on_create = DEFAULT; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@global.keep_files_on_create = 'OFF'; @@global.keep_files_on_create = 'OFF' 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'OFF' +Warning 1292 Truncated incorrect DECIMAL value: 'OFF' SET @@session.keep_files_on_create = DEFAULT; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@session.keep_files_on_create = 'OFF'; @@session.keep_files_on_create = 'OFF' 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'OFF' +Warning 1292 Truncated incorrect DECIMAL value: 'OFF' '#--------------------FN_DYNVARS_054_03-------------------------#' SET @@global.keep_files_on_create = ON; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@global.keep_files_on_create; @@global.keep_files_on_create 1 SET @@global.keep_files_on_create = OFF; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@global.keep_files_on_create; @@global.keep_files_on_create 0 SET @@global.keep_files_on_create = 0; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@global.keep_files_on_create; @@global.keep_files_on_create 0 SET @@global.keep_files_on_create = 1; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@global.keep_files_on_create; @@global.keep_files_on_create 1 SET @@global.keep_files_on_create = TRUE; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@global.keep_files_on_create; @@global.keep_files_on_create 1 SET @@global.keep_files_on_create = FALSE; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@global.keep_files_on_create; @@global.keep_files_on_create 0 '#--------------------FN_DYNVARS_054_04-------------------------#' SET @@session.keep_files_on_create = ON; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@session.keep_files_on_create; @@session.keep_files_on_create 1 SET @@session.keep_files_on_create = OFF; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@session.keep_files_on_create; @@session.keep_files_on_create 0 SET @@session.keep_files_on_create = 0; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@session.keep_files_on_create; @@session.keep_files_on_create 0 SET @@session.keep_files_on_create = 1; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@session.keep_files_on_create; @@session.keep_files_on_create 1 SET @@session.keep_files_on_create = TRUE; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@session.keep_files_on_create; @@session.keep_files_on_create 1 SET @@session.keep_files_on_create = FALSE; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@session.keep_files_on_create; @@session.keep_files_on_create 0 @@ -130,12 +166,18 @@ IF(@@session.keep_files_on_create, "ON", "OFF") = VARIABLE_VALUE 1 '#---------------------FN_DYNVARS_001_08----------------------#' SET @@keep_files_on_create = OFF; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SET @@global.keep_files_on_create = ON; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@keep_files_on_create = @@global.keep_files_on_create; @@keep_files_on_create = @@global.keep_files_on_create 0 '#---------------------FN_DYNVARS_001_09----------------------#' SET @@keep_files_on_create = ON; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@keep_files_on_create = @@local.keep_files_on_create; @@keep_files_on_create = @@local.keep_files_on_create 1 @@ -144,6 +186,8 @@ SELECT @@local.keep_files_on_create = @@session.keep_files_on_create; 1 '#---------------------FN_DYNVARS_001_10----------------------#' SET keep_files_on_create = 1; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@keep_files_on_create; @@keep_files_on_create 1 @@ -154,10 +198,14 @@ ERROR 42S02: Unknown table 'session' in field list SELECT keep_files_on_create = @@session.keep_files_on_create; ERROR 42S22: Unknown column 'keep_files_on_create' in 'field list' SET @@global.keep_files_on_create = @start_global_value; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@global.keep_files_on_create; @@global.keep_files_on_create 0 SET @@session.keep_files_on_create = @start_session_value; +Warnings: +Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release SELECT @@session.keep_files_on_create; @@session.keep_files_on_create 0 diff --git a/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_basic.result b/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_basic.result index 7ed1b689f5a55..411bf5a77e48b 100644 --- a/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_basic.result +++ b/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_basic.result @@ -14,7 +14,7 @@ SELECT @@global.log_bin_trust_function_creators = 'FALSE'; @@global.log_bin_trust_function_creators = 'FALSE' 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'FALSE' +Warning 1292 Truncated incorrect DECIMAL value: 'FALSE' '#--------------------FN_DYNVARS_063_03-------------------------#' SET @@global.log_bin_trust_function_creators = ON; SELECT @@global.log_bin_trust_function_creators; diff --git a/mysql-test/suite/sys_vars/r/low_priority_updates_basic.result b/mysql-test/suite/sys_vars/r/low_priority_updates_basic.result index 633dc274dec8b..53381db314830 100644 --- a/mysql-test/suite/sys_vars/r/low_priority_updates_basic.result +++ b/mysql-test/suite/sys_vars/r/low_priority_updates_basic.result @@ -23,13 +23,13 @@ SELECT @@global.low_priority_updates = 'FALSE'; @@global.low_priority_updates = 'FALSE' 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'FALSE' +Warning 1292 Truncated incorrect DECIMAL value: 'FALSE' SET @@session.low_priority_updates = DEFAULT; SELECT @@session.low_priority_updates = 'FALSE'; @@session.low_priority_updates = 'FALSE' 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'FALSE' +Warning 1292 Truncated incorrect DECIMAL value: 'FALSE' '#--------------------FN_DYNVARS_069_03-------------------------#' SET @@global.low_priority_updates = ON; SELECT @@global.low_priority_updates; diff --git a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result index 80bd2d7af5ff2..7f2e1c6586ce4 100644 --- a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result +++ b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result @@ -1,60 +1,60 @@ set @@global.optimizer_switch=@@optimizer_switch; select @@global.optimizer_switch; @@global.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=on,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,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off +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=on,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,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=off select @@session.optimizer_switch; @@session.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=on,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,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off +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=on,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,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=off show global variables like 'optimizer_switch'; Variable_name Value -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=on,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,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off +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=on,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,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=off show session variables like 'optimizer_switch'; Variable_name Value -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=on,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,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off +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=on,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,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=off select * from information_schema.global_variables where variable_name='optimizer_switch'; VARIABLE_NAME VARIABLE_VALUE -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=on,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,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off +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=on,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,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=off select * from information_schema.session_variables where variable_name='optimizer_switch'; VARIABLE_NAME VARIABLE_VALUE -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=on,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,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off +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=on,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,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=off set global optimizer_switch=4101; set session optimizer_switch=2058; select @@global.optimizer_switch; @@global.optimizer_switch -index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off +index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off select @@session.optimizer_switch; @@session.optimizer_switch -index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off +index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off set global optimizer_switch="index_merge_sort_union=on"; set session optimizer_switch="index_merge=off"; select @@global.optimizer_switch; @@global.optimizer_switch -index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off +index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off select @@session.optimizer_switch; @@session.optimizer_switch -index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off +index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off show global variables like 'optimizer_switch'; Variable_name Value -optimizer_switch index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off +optimizer_switch index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off show session variables like 'optimizer_switch'; Variable_name Value -optimizer_switch index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off +optimizer_switch index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off select * from information_schema.global_variables where variable_name='optimizer_switch'; VARIABLE_NAME VARIABLE_VALUE -OPTIMIZER_SWITCH index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off +OPTIMIZER_SWITCH index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off select * from information_schema.session_variables where variable_name='optimizer_switch'; VARIABLE_NAME VARIABLE_VALUE -OPTIMIZER_SWITCH index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off +OPTIMIZER_SWITCH index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off set session optimizer_switch="default"; select @@session.optimizer_switch; @@session.optimizer_switch -index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off +index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off set optimizer_switch = replace(@@optimizer_switch, '=off', '=on'); Warnings: Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release select @@optimizer_switch; @@optimizer_switch -index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=on,engine_condition_pushdown=on,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=on,mrr_cost_based=on,mrr_sort_keys=on,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=on,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,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=on +index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=on,engine_condition_pushdown=on,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=on,mrr_cost_based=on,mrr_sort_keys=on,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=on,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,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=on,hash_join_cardinality=on set global optimizer_switch=1.1; ERROR 42000: Incorrect argument type to variable 'optimizer_switch' set global optimizer_switch=1e1; diff --git a/mysql-test/suite/sys_vars/r/skip_replication_basic.result b/mysql-test/suite/sys_vars/r/skip_replication_basic.result index bb04df169a148..b137e24da0251 100644 --- a/mysql-test/suite/sys_vars/r/skip_replication_basic.result +++ b/mysql-test/suite/sys_vars/r/skip_replication_basic.result @@ -16,7 +16,7 @@ select @@session.skip_replication = variable_value from information_schema.sessi @@session.skip_replication = variable_value 1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'OFF' +Warning 1292 Truncated incorrect DECIMAL value: 'OFF' set session skip_replication=0; select @@session.skip_replication; @@session.skip_replication diff --git a/mysql-test/suite/sys_vars/r/sql_quote_show_create_func.result b/mysql-test/suite/sys_vars/r/sql_quote_show_create_func.result index 00c1b8e4c0488..c3021c3e090ca 100644 --- a/mysql-test/suite/sys_vars/r/sql_quote_show_create_func.result +++ b/mysql-test/suite/sys_vars/r/sql_quote_show_create_func.result @@ -6,27 +6,27 @@ CREATE TEMPORARY TABLE t1(a varchar(20), b varchar(20)); SET SESSION sql_quote_show_create = TRUE; SHOW CREATE DATABASE test; Database Create Database -test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ +test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ EXPECTING identifiers test TO BE quoted like 'test' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `a` varchar(20) DEFAULT NULL, `b` varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci EXPECTING identifiers a, b, t1 TO BE quoted like 'a','b','t1' '#-----------------------------FN_DYNVARS_163_02------------------------------------#' SET SESSION sql_quote_show_create = FALSE; SHOW CREATE DATABASE test; Database Create Database -test CREATE DATABASE test /*!40100 DEFAULT CHARACTER SET latin1 */ +test CREATE DATABASE test /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ EXPECTING identifiers test NOT TO BE quoted like 'test' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TEMPORARY TABLE t1 ( a varchar(20) DEFAULT NULL, b varchar(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci EXPECTING identifiers a, b, t1 NOT TO BE quoted like 'a','b','t1' '#----------------------------FN_DYNVARS_163_03--------------------------------------#' connect con_int1,localhost,root,,; diff --git a/mysql-test/suite/sys_vars/r/sysvars_aria.result b/mysql-test/suite/sys_vars/r/sysvars_aria.result index 8cec099d28c39..181c0de74df53 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_aria.result +++ b/mysql-test/suite/sys_vars/r/sysvars_aria.result @@ -85,6 +85,18 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME ARIA_LOG_DIR_PATH +SESSION_VALUE NULL +DEFAULT_VALUE DATADIR +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE VARCHAR +VARIABLE_COMMENT Path to the directory where to store transactional log +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY YES +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_LOG_FILE_SIZE SESSION_VALUE NULL DEFAULT_VALUE 1073741824 diff --git a/mysql-test/suite/sys_vars/r/sysvars_debug.result b/mysql-test/suite/sys_vars/r/sysvars_debug.result index 0d77b0211a1ea..fc04ac832101b 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_debug.result +++ b/mysql-test/suite/sys_vars/r/sysvars_debug.result @@ -77,7 +77,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT OPTIONAL GLOBAL_VALUE_PATH NULL VARIABLE_NAME DEBUG_SYNC -SESSION_VALUE ON - current signal: '' +SESSION_VALUE ON - current signals: '' GLOBAL_VALUE NULL GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff index 67d3897375bd9..3c6f2c3b8d93a 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff @@ -1,5 +1,3 @@ ---- sysvars_innodb.result -+++ sysvars_innodb,32bit.result @@ -49,7 +49,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 8 @@ -112,7 +110,7 @@ VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt. Value 5 can return bogus data, and 6 can permanently corrupt data. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 6 -@@ -781,7 +781,7 @@ +@@ -781,10 +781,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 8000000 VARIABLE_SCOPE GLOBAL @@ -120,7 +118,11 @@ +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT InnoDB Fulltext search cache size in bytes NUMERIC_MIN_VALUE 1600000 - NUMERIC_MAX_VALUE 80000000 +-NUMERIC_MAX_VALUE 1099511627776 ++NUMERIC_MAX_VALUE 536870912 + NUMERIC_BLOCK_SIZE 0 + ENUM_VALUE_LIST NULL + READ_ONLY NO @@ -817,7 +817,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 84 @@ -170,7 +172,7 @@ VARIABLE_COMMENT InnoDB Fulltext search parallel sort degree, will round up to nearest power of 2 number NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 16 -@@ -889,7 +889,7 @@ +@@ -889,10 +889,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 640000000 VARIABLE_SCOPE GLOBAL @@ -178,7 +180,11 @@ +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Total memory allocated for InnoDB Fulltext Search cache NUMERIC_MIN_VALUE 32000000 - NUMERIC_MAX_VALUE 1600000000 +-NUMERIC_MAX_VALUE 1099511627776 ++NUMERIC_MAX_VALUE 1600000000 + NUMERIC_BLOCK_SIZE 0 + ENUM_VALUE_LIST NULL + READ_ONLY NO @@ -937,22 +937,22 @@ SESSION_VALUE NULL DEFAULT_VALUE 200 diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 40e5596e5e275..4ded9b44ff3e3 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -2,11 +2,10 @@ select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYP where variable_name like 'innodb%' and variable_name not in ( 'innodb_version', # always the same as the server version -'innodb_disallow_writes', # only available WITH_WSREP 'innodb_numa_interleave', # only available WITH_NUMA -'innodb_sched_priority_cleaner', # linux only 'innodb_evict_tables_on_commit_debug', # one may want to override this 'innodb_use_native_aio', # default value depends on OS +'innodb_log_file_buffering', # only available on Linux and Windows 'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing order by variable_name; VARIABLE_NAME INNODB_ADAPTIVE_FLUSHING @@ -151,7 +150,7 @@ NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL -READ_ONLY NO +READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_BUFFER_POOL_LOAD_ABORT SESSION_VALUE NULL @@ -195,7 +194,7 @@ DEFAULT_VALUE 134217728 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the memory buffer InnoDB uses to cache data and indexes of its tables. -NUMERIC_MIN_VALUE 5242880 +NUMERIC_MIN_VALUE 2097152 NUMERIC_MAX_VALUE 9223372036854775807 NUMERIC_BLOCK_SIZE 1048576 ENUM_VALUE_LIST NULL @@ -227,7 +226,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_CHANGE_BUFFERING SESSION_VALUE NULL -DEFAULT_VALUE all +DEFAULT_VALUE none VARIABLE_SCOPE GLOBAL VARIABLE_TYPE ENUM VARIABLE_COMMENT Buffer changes to secondary indexes. @@ -784,10 +783,10 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT InnoDB Fulltext search cache size in bytes NUMERIC_MIN_VALUE 1600000 -NUMERIC_MAX_VALUE 80000000 +NUMERIC_MAX_VALUE 1099511627776 NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL -READ_ONLY YES +READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_FT_ENABLE_DIAG_PRINT SESSION_VALUE NULL @@ -892,10 +891,10 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Total memory allocated for InnoDB Fulltext Search cache NUMERIC_MIN_VALUE 32000000 -NUMERIC_MAX_VALUE 1600000000 +NUMERIC_MAX_VALUE 1099511627776 NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL -READ_ONLY YES +READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_FT_USER_STOPWORD_TABLE SESSION_VALUE @@ -1011,7 +1010,7 @@ DEFAULT_VALUE 100663296 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Redo log size in bytes. -NUMERIC_MIN_VALUE 1048576 +NUMERIC_MIN_VALUE 4194304 NUMERIC_MAX_VALUE 18446744073709551615 NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL @@ -1022,7 +1021,7 @@ SESSION_VALUE NULL DEFAULT_VALUE VARIABLE_SCOPE GLOBAL VARIABLE_TYPE VARCHAR -VARIABLE_COMMENT Path to InnoDB log files. +VARIABLE_COMMENT Path to ib_logfile0 NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -1367,10 +1366,10 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_READ_ONLY_COMPRESSED SESSION_VALUE NULL -DEFAULT_VALUE ON +DEFAULT_VALUE OFF VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Make ROW_FORMAT=COMPRESSED tables read-only (ON by default) +VARIABLE_COMMENT Make ROW_FORMAT=COMPRESSED tables read-only NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff index 6da30c14c7e60..a6bf0fb606af6 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff @@ -1,5 +1,3 @@ ---- ../../mysql-test/suite/sys_vars/r/sysvars_server_embedded.result 2021-05-11 19:44:57.048781628 +0530 -+++ ../../mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.reject 2021-05-12 15:26:31.616449925 +0530 @@ -34,7 +34,7 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_BLOCK_SIZE diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index fc9d8db4b9fed..8b8b9d9834ca9 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -102,6 +102,16 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME ARIA_LOG_DIR_PATH +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE VARCHAR +VARIABLE_COMMENT Path to the directory where to store transactional log +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY YES +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_LOG_FILE_SIZE VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED @@ -655,13 +665,13 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME CORE_FILE VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT write a core-file on crashes +VARIABLE_COMMENT Write core on crashes NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,ON READ_ONLY YES -COMMAND_LINE_ARGUMENT NULL +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME DATADIR VARIABLE_SCOPE GLOBAL VARIABLE_TYPE VARCHAR @@ -923,14 +933,14 @@ ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME EXPLICIT_DEFAULTS_FOR_TIMESTAMP -VARIABLE_SCOPE GLOBAL +VARIABLE_SCOPE SESSION VARIABLE_TYPE BOOLEAN VARIABLE_COMMENT This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,ON -READ_ONLY YES +READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME EXTERNAL_USER VARIABLE_SCOPE SESSION ONLY @@ -2289,7 +2299,7 @@ VARIABLE_COMMENT Fine-tune the optimizer behavior NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,split_materialized,condition_pushdown_for_subquery,rowid_filter,condition_pushdown_from_having,not_null_range_scan,default +ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,split_materialized,condition_pushdown_for_subquery,rowid_filter,condition_pushdown_from_having,not_null_range_scan,hash_join_cardinality,default READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_TRACE diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 177584cf79dc8..99857a3baf5bf 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -102,6 +102,16 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME ARIA_LOG_DIR_PATH +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE VARCHAR +VARIABLE_COMMENT Path to the directory where to store transactional log +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY YES +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_LOG_FILE_SIZE VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED @@ -322,6 +332,16 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME BINLOG_ALTER_TWO_PHASE +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT When set, split ALTER at binary logging into 2 statements: START ALTER and COMMIT/ROLLBACK ALTER +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME BINLOG_ANNOTATE_ROW_EVENTS VARIABLE_SCOPE SESSION VARIABLE_TYPE BOOLEAN @@ -655,13 +675,13 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME CORE_FILE VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT write a core-file on crashes +VARIABLE_COMMENT Write core on crashes NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,ON READ_ONLY YES -COMMAND_LINE_ARGUMENT NULL +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME DATADIR VARIABLE_SCOPE GLOBAL VARIABLE_TYPE VARCHAR @@ -943,14 +963,14 @@ ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME EXPLICIT_DEFAULTS_FOR_TIMESTAMP -VARIABLE_SCOPE GLOBAL +VARIABLE_SCOPE SESSION VARIABLE_TYPE BOOLEAN VARIABLE_COMMENT This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,ON -READ_ONLY YES +READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME EXTERNAL_USER VARIABLE_SCOPE SESSION ONLY @@ -1185,7 +1205,7 @@ COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME GTID_STRICT_MODE VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Enforce strict seq_no ordering of events in the binary log. Slave stops with an error if it encounters an event that would cause it to generate an out-of-order binlog if executed. +VARIABLE_COMMENT Enforce strict seq_no ordering of events in the binary log. Slave stops with an error if it encounters an event that would cause it to generate an out-of-order binlog if executed. When ON the same server-id semisync-replicated transactions that duplicate exising ones in binlog are ignored without error and slave interruption. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -2449,7 +2469,7 @@ VARIABLE_COMMENT Fine-tune the optimizer behavior NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,split_materialized,condition_pushdown_for_subquery,rowid_filter,condition_pushdown_from_having,not_null_range_scan,default +ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,split_materialized,condition_pushdown_for_subquery,rowid_filter,condition_pushdown_from_having,not_null_range_scan,hash_join_cardinality,default READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_TRACE diff --git a/mysql-test/suite/sys_vars/r/sysvars_star.result b/mysql-test/suite/sys_vars/r/sysvars_star.result index b8a49a089b409..b80515db23dc5 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_star.result +++ b/mysql-test/suite/sys_vars/r/sysvars_star.result @@ -60,7 +60,7 @@ VARIABLE_NAME PLUGIN_MATURITY SESSION_VALUE NULL GLOBAL_VALUE alpha GLOBAL_VALUE_ORIGIN CONFIG -DEFAULT_VALUE experimental +DEFAULT_VALUE gamma VARIABLE_SCOPE GLOBAL VARIABLE_TYPE ENUM VARIABLE_COMMENT The lowest desirable plugin maturity. Plugins less mature than that will not be installed or loaded @@ -108,6 +108,7 @@ global_value_path NULL connection default; select global_value_path from information_schema.system_variables where variable_name='plugin_maturity'; global_value_path var/my.cnf +disconnect foo; drop user foo@localhost; set global low_priority_updates=default; uninstall soname 'sql_errlog'; diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result index bc1f49195b501..ae7cce823ef2a 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result +++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result @@ -342,7 +342,7 @@ VARIABLE_COMMENT Set of WSREP features that are enabled. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST STRICT_REPLICATION,BINLOG_ROW_FORMAT_ONLY,REQUIRED_PRIMARY_KEY,REPLICATE_MYISAM,REPLICATE_ARIA,DISALLOW_LOCAL_GTID +ENUM_VALUE_LIST STRICT_REPLICATION,BINLOG_ROW_FORMAT_ONLY,REQUIRED_PRIMARY_KEY,REPLICATE_MYISAM,REPLICATE_ARIA,DISALLOW_LOCAL_GTID,BF_ABORT_MARIABACKUP READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED GLOBAL_VALUE_PATH NULL diff --git a/mysql-test/suite/sys_vars/r/tmp_disk_table_size_basic.result b/mysql-test/suite/sys_vars/r/tmp_disk_table_size_basic.result index 0acf842810081..81453d72274d2 100644 --- a/mysql-test/suite/sys_vars/r/tmp_disk_table_size_basic.result +++ b/mysql-test/suite/sys_vars/r/tmp_disk_table_size_basic.result @@ -142,5 +142,17 @@ SELECT global.tmp_disk_table_size; ERROR 42S02: Unknown table 'global' in field list SELECT tmp_disk_table_size = @@session.tmp_disk_table_size; ERROR 42S22: Unknown column 'tmp_disk_table_size' in 'field list' +# +# Beginning of 10.4 test +# +# Diagnostics_area::sql_errno() const: Assertion `m_status == DA_ERROR' +# failed on SELECT after setting tmp_disk_table_size. +# +SET @@tmp_disk_table_size=16384; +CREATE VIEW v AS SELECT 'a'; +SELECT table_name FROM INFORMATION_SCHEMA.views; +ERROR HY000: The table '(temporary)' is full +DROP VIEW v; +# End of 10.4 test SET @@global.tmp_disk_table_size = @start_global_value; SET @@session.tmp_disk_table_size = @start_session_value; diff --git a/mysql-test/suite/sys_vars/t/all_vars.test b/mysql-test/suite/sys_vars/t/all_vars.test index 06edc04d25c2e..41c89a4bed9cd 100644 --- a/mysql-test/suite/sys_vars/t/all_vars.test +++ b/mysql-test/suite/sys_vars/t/all_vars.test @@ -12,8 +12,6 @@ eval INSTALL PLUGIN federated SONAME "$HA_FEDERATEDX_SO"; eval INSTALL PLUGIN oqgraph SONAME "$HA_OQGRAPH_SO"; eval INSTALL PLUGIN sphinx SONAME "$HA_SPHINX_SO"; eval INSTALL PLUGIN innodb SONAME "$HA_INNODB_SO"; -eval INSTALL PLUGIN rpl_semi_sync_master SONAME "$SEMISYNC_MASTER_SO"; -eval INSTALL PLUGIN rpl_semi_sync_slave SONAME "$SEMISYNC_SLAVE_SO"; --enable_abort_on_error --enable_result_log --enable_query_log diff --git a/mysql-test/suite/sys_vars/t/aria_log_dir_path_basic.test b/mysql-test/suite/sys_vars/t/aria_log_dir_path_basic.test new file mode 100644 index 0000000000000..f09705e6f0d3a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/aria_log_dir_path_basic.test @@ -0,0 +1,35 @@ +--source include/have_maria.inc + +SELECT COUNT(@@GLOBAL.aria_log_dir_path); +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.aria_log_dir_path=1; + +SELECT COUNT(@@GLOBAL.aria_log_dir_path); + + +SELECT @@GLOBAL.aria_log_dir_path = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='aria_log_dir_path'; + +SELECT COUNT(@@GLOBAL.aria_log_dir_path); + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='aria_log_dir_path'; + + +SELECT @@aria_log_dir_path = @@GLOBAL.aria_log_dir_path; + + +SELECT COUNT(@@aria_log_dir_path); + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.aria_log_dir_path); + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.aria_log_dir_path); + +SELECT COUNT(@@GLOBAL.aria_log_dir_path); + +--Error ER_BAD_FIELD_ERROR +SELECT aria_log_dir_path = @@SESSION.aria_log_dir_path; diff --git a/mysql-test/suite/sys_vars/t/binlog_alter_two_phase.test b/mysql-test/suite/sys_vars/t/binlog_alter_two_phase.test new file mode 100644 index 0000000000000..bc3adf12c15eb --- /dev/null +++ b/mysql-test/suite/sys_vars/t/binlog_alter_two_phase.test @@ -0,0 +1,52 @@ +# +# binlog_alter_two_phase system variable +# Session as well as global +# Allowed values NO_SPLIT, SPLIT, BINLOG_ONLY (0,1,2) + +--source include/not_embedded.inc + +--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase` +set binlog_alter_two_phase = OFF; +select @@binlog_alter_two_phase; + +set binlog_alter_two_phase = ON; +select @@binlog_alter_two_phase; + +--echo # wrong value +--error ER_WRONG_VALUE_FOR_VAR +set binlog_alter_two_phase=BINLOG_OY; +select @@binlog_alter_two_phase; + +--echo #true and false +set binlog_alter_two_phase=false; +select @@binlog_alter_two_phase; + +set binlog_alter_two_phase=true; +select @@binlog_alter_two_phase; + +set binlog_alter_two_phase=0; +select @@binlog_alter_two_phase; + +set binlog_alter_two_phase=1; +select @@binlog_alter_two_phase; + +--echo ##wrong value +--error ER_WRONG_VALUE_FOR_VAR +set binlog_alter_two_phase=2; +select @@binlog_alter_two_phase; + + +--echo #Global value +set global binlog_alter_two_phase = OFF; +connect (con1,localhost,root,,); +select @@binlog_alter_two_phase; +disconnect con1; + +connection default; +set global binlog_alter_two_phase = ON; +connect (con1,localhost,root,,); +select @@binlog_alter_two_phase; +disconnect con1; + +connection default; +--eval set global binlog_alter_two_phase=$binlog_alter_two_phase diff --git a/mysql-test/suite/sys_vars/t/completion_type_func.test b/mysql-test/suite/sys_vars/t/completion_type_func.test index 2411cacf8bbfd..5c343cee9ab06 100644 --- a/mysql-test/suite/sys_vars/t/completion_type_func.test +++ b/mysql-test/suite/sys_vars/t/completion_type_func.test @@ -146,7 +146,7 @@ COMMIT; --echo ## Inserting rows should give error here because connection should ## --echo ## disconnect after using COMMIT ## ---Error 2006,2013,ER_QUERY_INTERRUPTED,ER_CONNECTION_KILLED +--Error 2006,2013,ER_QUERY_INTERRUPTED,ER_CONNECTION_KILLED,5014 INSERT INTO t1 VALUES(4,'Record_4'); connection test_con2; @@ -160,7 +160,7 @@ INSERT INTO t1 VALUES(12,'Record_12'); ROLLBACK; --echo ## Expect a failure due to COMMIT/ROLLBACK AND RELEASE behavior ## ---Error 2006,2013,ER_QUERY_INTERRUPTED,ER_CONNECTION_KILLED +--Error 2006,2013,ER_QUERY_INTERRUPTED,ER_CONNECTION_KILLED,5014 INSERT INTO t1 VALUES(4,'Record_4'); connection default; diff --git a/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_basic.test b/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_basic.test deleted file mode 100644 index da451aec61048..0000000000000 --- a/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_basic.test +++ /dev/null @@ -1,26 +0,0 @@ -# -# show the global and session values; -# -select @@global.explicit_defaults_for_timestamp; - -# -# Test that it's a global-only variable -# ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@session.explicit_defaults_for_timestamp; - -show global variables like 'explicit_defaults_for_timestamp'; -show session variables like 'explicit_defaults_for_timestamp'; - ---disable_warnings -select * from information_schema.global_variables where variable_name='explicit_defaults_for_timestamp'; -select * from information_schema.session_variables where variable_name='explicit_defaults_for_timestamp'; ---enable_warnings - -# -# show that it's read-only -# ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -set global explicit_defaults_for_timestamp=true; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -set session explicit_defaults_for_timestamp=true; diff --git a/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_off.test b/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_off.test index 2159b7cb6a878..3f881761504e5 100644 --- a/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_off.test +++ b/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_off.test @@ -1,8 +1,3 @@ ---disable_query_log -if (`SELECT @@explicit_defaults_for_timestamp`) -{ - Skip Need explicit-defaults-for-timestamp=off; -} ---enable_query_log +set @@explicit_defaults_for_timestamp=0; --source inc/explicit_defaults_for_timestamp.inc diff --git a/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_on-master.opt b/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_on-master.opt deleted file mode 100644 index b84d51e2ad121..0000000000000 --- a/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_on-master.opt +++ /dev/null @@ -1 +0,0 @@ ---explicit-defaults-for-timestamp=on diff --git a/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_on.test b/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_on.test index 5c03eaa28de14..67b93824eb4fe 100644 --- a/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_on.test +++ b/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_on.test @@ -1,8 +1,3 @@ ---disable_query_log -if (!`SELECT @@explicit_defaults_for_timestamp`) -{ - Skip Need explicit-defaults-for-timestamp=on; -} ---enable_query_log +set @@explicit_defaults_for_timestamp=1; --source inc/explicit_defaults_for_timestamp.inc diff --git a/mysql-test/suite/sys_vars/t/group_concat_max_len_func.test b/mysql-test/suite/sys_vars/t/group_concat_max_len_func.test index b053ee229d78b..d90fc061289c0 100644 --- a/mysql-test/suite/sys_vars/t/group_concat_max_len_func.test +++ b/mysql-test/suite/sys_vars/t/group_concat_max_len_func.test @@ -132,4 +132,35 @@ disconnect test_con1; connection default; +CREATE TABLE t1(val VARCHAR(100) PRIMARY KEY) CHARACTER SET utf8mb4 COLLATE utf8mb4_danish_ci; +INSERT INTO t1 VALUES('bar'); +INSERT INTO t1 VALUES('foo'); + +SET group_concat_max_len = 1073741823; +SHOW VARIABLES LIKE 'group_concat_max_len'; +SELECT GROUP_CONCAT(val) AS simple FROM t1; +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; + +SET group_concat_max_len = 1073741824; +SHOW VARIABLES LIKE 'group_concat_max_len'; +SELECT GROUP_CONCAT(val) AS simple FROM t1; +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; + +SET group_concat_max_len = 1073741825; +SHOW VARIABLES LIKE 'group_concat_max_len'; +SELECT GROUP_CONCAT(val) AS simple FROM t1; +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; + +SET group_concat_max_len = 1073741826; +SHOW VARIABLES LIKE 'group_concat_max_len'; +SELECT GROUP_CONCAT(val) AS simple FROM t1; +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; + +SET group_concat_max_len = 2147483649; +SHOW VARIABLES LIKE 'group_concat_max_len'; +SELECT GROUP_CONCAT(val) AS simple FROM t1; +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; + +DROP TABLE t1; + SET @@global.group_concat_max_len = @save; diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_abort_loads.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_abort_loads.test index 4a4411101e2ed..089f3072205d0 100644 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_abort_loads.test +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_abort_loads.test @@ -3,6 +3,7 @@ # --source include/have_innodb.inc --source include/have_debug.inc +--source include/no_valgrind_without_big.inc --echo --echo # innodb_buffer_pool_load_incomplete defaults 0 diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_at_shutdown_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_at_shutdown_basic.test index feb7bf0563815..072d1cec1a476 100644 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_at_shutdown_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_at_shutdown_basic.test @@ -5,6 +5,7 @@ -- source include/have_innodb.inc # include/restart_mysqld.inc does not work in embedded mode -- source include/not_embedded.inc +-- source include/no_valgrind_without_big.inc # Check the default value SET @orig = @@global.innodb_buffer_pool_dump_at_shutdown; diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test index f37e3e2e0fde7..dada2a9a45527 100644 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test @@ -25,7 +25,7 @@ --source include/have_innodb.inc let $wait_condition = - SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at ' + SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; diff --git a/mysql-test/suite/sys_vars/t/innodb_disallow_writes_basic.test b/mysql-test/suite/sys_vars/t/innodb_disallow_writes_basic.test deleted file mode 100644 index b8e5c1273776c..0000000000000 --- a/mysql-test/suite/sys_vars/t/innodb_disallow_writes_basic.test +++ /dev/null @@ -1,42 +0,0 @@ ---source include/have_innodb_disallow_writes.inc - ---echo # ---echo # innodb_disallow_writes ---echo # - ---echo # save the initial value -SET @innodb_disallow_writes_global_saved = @@global.innodb_disallow_writes; - ---echo # default -SELECT @@global.innodb_disallow_writes; - ---echo ---echo # scope ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@session.innodb_disallow_writes; -SET @@global.innodb_disallow_writes=OFF; -SELECT @@global.innodb_disallow_writes; -SET @@global.innodb_disallow_writes=ON; -SELECT @@global.innodb_disallow_writes; - ---echo ---echo # valid values -SET @@global.innodb_disallow_writes='OFF'; -SELECT @@global.innodb_disallow_writes; -SET @@global.innodb_disallow_writes=ON; -SELECT @@global.innodb_disallow_writes; -SET @@global.innodb_disallow_writes=default; -SELECT @@global.innodb_disallow_writes; - ---echo ---echo # invalid values ---error ER_WRONG_VALUE_FOR_VAR -SET @@global.innodb_disallow_writes=NULL; ---error ER_WRONG_VALUE_FOR_VAR -SET @@global.innodb_disallow_writes='junk'; - ---echo ---echo # restore the initial value -SET @@global.innodb_disallow_writes = @innodb_disallow_writes_global_saved; - ---echo # End of test diff --git a/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test b/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test index 9cff94ed5bca2..b1b2f9fdda9bb 100644 --- a/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test +++ b/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test @@ -43,7 +43,7 @@ let $counter= 80; let $mysql_errno= 0; while (!$mysql_errno) { - --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013 + --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013,5014 show status; dec $counter; diff --git a/mysql-test/suite/sys_vars/t/innodb_flush_method_func.test b/mysql-test/suite/sys_vars/t/innodb_flush_method_func.test index aad91d0f4a3ff..7293a99db41a8 100644 --- a/mysql-test/suite/sys_vars/t/innodb_flush_method_func.test +++ b/mysql-test/suite/sys_vars/t/innodb_flush_method_func.test @@ -1,6 +1,8 @@ --source include/have_innodb.inc # Embedded server tests do not support restarting. --source include/not_embedded.inc +# InnoDB: Cannot read first page of './ibdata1' I/O error +--source include/not_valgrind.inc call mtr.add_suppression("InnoDB: Failed to set .*DIRECT"); --replace_result unbuffered fsync diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_cache_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_ft_cache_size_basic.test index 30bcd08d4dda6..9def2e36137de 100644 --- a/mysql-test/suite/sys_vars/t/innodb_ft_cache_size_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_ft_cache_size_basic.test @@ -18,11 +18,12 @@ select * from information_schema.global_variables where variable_name='innodb_ft select * from information_schema.session_variables where variable_name='innodb_ft_cache_size'; --enable_warnings -# -# show that it's read-only -# ---error ER_INCORRECT_GLOBAL_LOCAL_VAR set global innodb_ft_cache_size=1; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR +SHOW VARIABLES like 'innodb_ft_cache_size'; + +--error ER_GLOBAL_VARIABLE set session innodb_ft_cache_size=1; +set global innodb_ft_cache_size=512*1024*1024; +SHOW VARIABLES like 'innodb_ft_cache_size'; +set global innodb_ft_cache_size=default; diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_total_cache_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_ft_total_cache_size_basic.test index 207ec64b70500..d032cd767712b 100644 --- a/mysql-test/suite/sys_vars/t/innodb_ft_total_cache_size_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_ft_total_cache_size_basic.test @@ -18,11 +18,11 @@ select * from information_schema.global_variables where variable_name='innodb_ft select * from information_schema.session_variables where variable_name='innodb_ft_total_cache_size'; --enable_warnings -# -# show that it's read-only -# ---error ER_INCORRECT_GLOBAL_LOCAL_VAR set global innodb_ft_total_cache_size=1; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR +--error ER_GLOBAL_VARIABLE set session innodb_ft_total_cache_size=1; +SHOW VARIABLES like 'innodb_ft_total_cache_size'; +set global innodb_ft_total_cache_size=512*1024*1024; +show variables like 'innodb_ft_total_cache_size'; +set global innodb_ft_total_cache_size=default; diff --git a/mysql-test/suite/sys_vars/t/innodb_log_checkpoint_now_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_checkpoint_now_basic.test index 331803fff86ec..f59ebf649c31c 100644 --- a/mysql-test/suite/sys_vars/t/innodb_log_checkpoint_now_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_log_checkpoint_now_basic.test @@ -1,5 +1,7 @@ --source include/have_innodb.inc --source include/have_debug.inc +# Valgrind builds may block on this one +--source include/not_valgrind.inc SET @start_global_value = @@global.innodb_log_checkpoint_now; SELECT @start_global_value; diff --git a/mysql-test/suite/sys_vars/t/sysvars_aria.test b/mysql-test/suite/sys_vars/t/sysvars_aria.test index b01e39eebf543..b042f1010f4b6 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_aria.test +++ b/mysql-test/suite/sys_vars/t/sysvars_aria.test @@ -2,7 +2,11 @@ --source include/have_aria_used_for_temp_tables.inc --source include/word_size.inc +let datadir=`select @@datadir`; + --vertical_results + +--replace_result $datadir DATADIR select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT, NUMERIC_MIN_VALUE, NUMERIC_MAX_VALUE, NUMERIC_BLOCK_SIZE, ENUM_VALUE_LIST, READ_ONLY, COMMAND_LINE_ARGUMENT from information_schema.system_variables where variable_name like 'aria%' order by variable_name; diff --git a/mysql-test/suite/sys_vars/t/sysvars_debug.test b/mysql-test/suite/sys_vars/t/sysvars_debug.test index fbdcbd683df5c..6e64d48c6cd80 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_debug.test +++ b/mysql-test/suite/sys_vars/t/sysvars_debug.test @@ -1,4 +1,5 @@ --source include/have_debug.inc +--source include/have_debug_sync.inc --source include/word_size.inc --vertical_results diff --git a/mysql-test/suite/sys_vars/t/sysvars_innodb.test b/mysql-test/suite/sys_vars/t/sysvars_innodb.test index ef52ee3264a8f..6d46c22683f34 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_innodb.test +++ b/mysql-test/suite/sys_vars/t/sysvars_innodb.test @@ -9,10 +9,9 @@ select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYP where variable_name like 'innodb%' and variable_name not in ( 'innodb_version', # always the same as the server version - 'innodb_disallow_writes', # only available WITH_WSREP 'innodb_numa_interleave', # only available WITH_NUMA - 'innodb_sched_priority_cleaner', # linux only 'innodb_evict_tables_on_commit_debug', # one may want to override this 'innodb_use_native_aio', # default value depends on OS + 'innodb_log_file_buffering', # only available on Linux and Windows 'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing order by variable_name; diff --git a/mysql-test/suite/sys_vars/t/sysvars_star.test b/mysql-test/suite/sys_vars/t/sysvars_star.test index 2f0ef5c9ab02d..8d0aefdc4c79b 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_star.test +++ b/mysql-test/suite/sys_vars/t/sysvars_star.test @@ -34,8 +34,10 @@ select global_value_path from information_schema.system_variables where variable connection default; replace_regex /\/.*\//var\//; select global_value_path from information_schema.system_variables where variable_name='plugin_maturity'; - +disconnect foo; drop user foo@localhost; set global low_priority_updates=default; disable_warnings; uninstall soname 'sql_errlog'; +let $count_sessions= 1; +source include/wait_until_count_sessions.inc; diff --git a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test index 123f522a3a465..099be3544865b 100644 --- a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test +++ b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test @@ -193,6 +193,22 @@ SELECT global.tmp_disk_table_size; --Error ER_BAD_FIELD_ERROR SELECT tmp_disk_table_size = @@session.tmp_disk_table_size; +--echo # +--echo # Beginning of 10.4 test +--echo # +--echo # Diagnostics_area::sql_errno() const: Assertion `m_status == DA_ERROR' +--echo # failed on SELECT after setting tmp_disk_table_size. +--echo # + +SET @@tmp_disk_table_size=16384; +CREATE VIEW v AS SELECT 'a'; + +--error ER_RECORD_FILE_FULL +SELECT table_name FROM INFORMATION_SCHEMA.views; + +DROP VIEW v; + +--echo # End of 10.4 test #################################### # Restore initial value # diff --git a/mysql-test/suite/sys_vars/t/wsrep_on_without_provider.test b/mysql-test/suite/sys_vars/t/wsrep_on_without_provider.test index 5bee3c9a356a4..9b32552436fe1 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_on_without_provider.test +++ b/mysql-test/suite/sys_vars/t/wsrep_on_without_provider.test @@ -1,4 +1,5 @@ --source include/not_embedded.inc +--source include/have_wsrep.inc # # @@global.wsrep_on is not allowed if there diff --git a/mysql-test/suite/sysschema/disabled.def b/mysql-test/suite/sysschema/disabled.def new file mode 100644 index 0000000000000..62df96a4663e3 --- /dev/null +++ b/mysql-test/suite/sysschema/disabled.def @@ -0,0 +1,12 @@ +############################################################################## +# +# 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. +# +############################################################################## +pr_statement_performance_analyzer : MDEV-29822 perfschema specific and Windows specific problems. diff --git a/mysql-test/suite/sysschema/r/pr_create_synonym_db.result b/mysql-test/suite/sysschema/r/pr_create_synonym_db.result index bd7e4edc6e627..8c0e8dfa9572b 100644 --- a/mysql-test/suite/sysschema/r/pr_create_synonym_db.result +++ b/mysql-test/suite/sysschema/r/pr_create_synonym_db.result @@ -50,3 +50,17 @@ DROP TABLE test.t1; DROP TABLE test.t2; DROP TABLE `is`; DROP TABLE `ab``c`; +# +# MDEV-28342: sys.create_synonym_db fails +# when a temporary table masks a base table +# +create database db; +use db; +create table a(a int); +create table t (b int); +create table b(a int); +create temporary table b (a int); +call sys.create_synonym_db('db','db_copy'); +ERROR HY000: Table`db`.`b`shadows base table. View cannot be created! Terminating! +drop database db; +drop database db_copy; diff --git a/mysql-test/suite/sysschema/r/pr_diagnostics.result b/mysql-test/suite/sysschema/r/pr_diagnostics.result index 90021f636d80d..d07295bdbe90d 100644 --- a/mysql-test/suite/sysschema/r/pr_diagnostics.result +++ b/mysql-test/suite/sysschema/r/pr_diagnostics.result @@ -6,6 +6,8 @@ SET @sys.debug = 'OFF', @sys.diagnostics.allow_i_s_tables = 'OFF', @sys.diagnostics.include_raw = 'OFF'; CALL sys.diagnostics(0, 0, 'full'); +summary +Disabled 1 thread ERROR 45000: in_max_runtime must be greater than 0 CALL sys.diagnostics(2, 0, 'full'); ERROR 45000: in_interval must be greater than 0 diff --git a/mysql-test/suite/sysschema/r/pr_execute_prepared_stmt.result b/mysql-test/suite/sysschema/r/pr_execute_prepared_stmt.result index 8341580a856b9..5cedd97066f50 100644 --- a/mysql-test/suite/sysschema/r/pr_execute_prepared_stmt.result +++ b/mysql-test/suite/sysschema/r/pr_execute_prepared_stmt.result @@ -4,7 +4,7 @@ SHOW CREATE TABLE test.t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET @sql := CONCAT('INSERT INTO test.t1 VALUES (', 1, ')'); CALL sys.execute_prepared_stmt(@sql); SELECT * FROM test.t1; diff --git a/mysql-test/suite/sysschema/r/pr_ps_trace_statement_digest.result b/mysql-test/suite/sysschema/r/pr_ps_trace_statement_digest.result index 25be758172bfd..998546651ee05 100644 --- a/mysql-test/suite/sysschema/r/pr_ps_trace_statement_digest.result +++ b/mysql-test/suite/sysschema/r/pr_ps_trace_statement_digest.result @@ -13,7 +13,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `val` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SET @digest.show = (SELECT DIGEST FROM performance_schema.events_statements_history WHERE THREAD_ID = @threadid AND SQL_TEXT LIKE 'SHOW CREATE TABLE test.t1'); CREATE SCHEMA test_sys; use test_sys; diff --git a/mysql-test/suite/sysschema/r/pr_table_exists.result b/mysql-test/suite/sysschema/r/pr_table_exists.result index 459ad1639e780..76085bd72dd7e 100644 --- a/mysql-test/suite/sysschema/r/pr_table_exists.result +++ b/mysql-test/suite/sysschema/r/pr_table_exists.result @@ -1,20 +1,37 @@ -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v_t1; CREATE TABLE t1 (id INT PRIMARY KEY); -CREATE view v_t1 AS SELECT * FROM t1; CALL sys.table_exists('test', 't1', @exists); SELECT @exists; @exists BASE TABLE +DROP TABLE t1; +CREATE view v_t1 AS SELECT 1; CALL sys.table_exists('test', 'v_t1', @exists); SELECT @exists; @exists VIEW +DROP VIEW v_t1; +CREATE TABLE tv (i int) with system versioning; +CALL sys.table_exists('test','tv',@exists); +SELECT @exists; +@exists +BASE TABLE +DROP TABLE tv; +CREATE SEQUENCE s; +CALL sys.table_exists('test','s',@exists); +SELECT @exists; +@exists +SEQUENCE +DROP SEQUENCE s; CREATE TEMPORARY TABLE t1 (id INT PRIMARY KEY); CALL sys.table_exists('test', 't1', @exists); SELECT @exists; @exists TEMPORARY +DROP TEMPORARY TABLE t1; +CALL sys.table_exists('information_schema', 'all_plugins', @exists); +SELECT @exists; +@exists +SYSTEM VIEW CALL sys.table_exists('test', 't2', @exists); SELECT @exists; @exists @@ -24,7 +41,32 @@ CALL sys.table_exists(@identifier, 't1', @exists); ERROR 22001: Data too long for column 'in_db' at row 1 CALL sys.table_exists('test', @identifier, @exists); ERROR 22001: Data too long for column 'in_table' at row 0 -DROP TEMPORARY TABLE t1; -DROP TABLE t1; -DROP VIEW v_t1; SET @identifier := NULL; +# +# MDEV-28391: table_exists procedure fails with +# Incorrect table name with backtick identifiers +# +CREATE TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CALL sys.table_exists('test', 'ab`c', @tbl_type); +SELECT @tbl_type; +@tbl_type +BASE TABLE +DROP TABLE `ab``c`; +CREATE TEMPORARY TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CALL sys.table_exists('test', 'ab`c', @tbl_type); +SELECT @tbl_type; +@tbl_type +TEMPORARY +DROP TABLE `ab``c`; +CREATE TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CREATE TEMPORARY TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CALL sys.table_exists('test', 'ab`c', @tbl_type); +SELECT @tbl_type; +@tbl_type +TEMPORARY +# We cannot send quoted identifer to the procedure, no table will be found +CALL sys.table_exists('test', '`ab``c`', @tbl_type); +SELECT @tbl_type; +@tbl_type + +DROP TABLE `ab``c`; diff --git a/mysql-test/suite/sysschema/r/v_innodb_lock_waits.result b/mysql-test/suite/sysschema/r/v_innodb_lock_waits.result index 29cf21d50a344..d8e2c496d13be 100644 --- a/mysql-test/suite/sysschema/r/v_innodb_lock_waits.result +++ b/mysql-test/suite/sysschema/r/v_innodb_lock_waits.result @@ -3,27 +3,27 @@ Field Type Null Key Default Extra wait_started datetime YES NULL wait_age time /* mariadb-5.3 */ YES NULL wait_age_secs bigint(21) YES NULL -locked_table varchar(1024) NO +locked_table varchar(1024) NO NULL locked_index varchar(1024) YES NULL locked_type enum('RECORD','TABLE') NO NULL -waiting_trx_id bigint(21) unsigned NO 0 -waiting_trx_started datetime NO 0000-00-00 00:00:00 +waiting_trx_id bigint(21) unsigned NO NULL +waiting_trx_started datetime NO NULL waiting_trx_age time /* mariadb-5.3 */ YES NULL -waiting_trx_rows_locked bigint(21) unsigned NO 0 -waiting_trx_rows_modified bigint(21) unsigned NO 0 -waiting_pid bigint(21) unsigned NO 0 +waiting_trx_rows_locked bigint(21) unsigned NO NULL +waiting_trx_rows_modified bigint(21) unsigned NO NULL +waiting_pid bigint(21) unsigned NO NULL waiting_query longtext YES NULL -waiting_lock_id varchar(81) NO +waiting_lock_id varchar(81) NO NULL waiting_lock_mode enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NO NULL -blocking_trx_id bigint(21) unsigned NO 0 -blocking_pid bigint(21) unsigned NO 0 +blocking_trx_id bigint(21) unsigned NO NULL +blocking_pid bigint(21) unsigned NO NULL blocking_query longtext YES NULL -blocking_lock_id varchar(81) NO +blocking_lock_id varchar(81) NO NULL blocking_lock_mode enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NO NULL -blocking_trx_started datetime NO 0000-00-00 00:00:00 +blocking_trx_started datetime NO NULL blocking_trx_age time /* mariadb-5.3 */ YES NULL -blocking_trx_rows_locked bigint(21) unsigned NO 0 -blocking_trx_rows_modified bigint(21) unsigned NO 0 +blocking_trx_rows_locked bigint(21) unsigned NO NULL +blocking_trx_rows_modified bigint(21) unsigned NO NULL sql_kill_blocking_query varchar(32) YES NULL sql_kill_blocking_connection varchar(26) YES NULL SELECT * FROM sys.innodb_lock_waits; @@ -32,27 +32,39 @@ Field Type Null Key Default Extra wait_started datetime YES NULL wait_age time /* mariadb-5.3 */ YES NULL wait_age_secs bigint(21) YES NULL -locked_table varchar(1024) NO +locked_table varchar(1024) NO NULL locked_index varchar(1024) YES NULL locked_type enum('RECORD','TABLE') NO NULL -waiting_trx_id bigint(21) unsigned NO 0 -waiting_trx_started datetime NO 0000-00-00 00:00:00 +waiting_trx_id bigint(21) unsigned NO NULL +waiting_trx_started datetime NO NULL waiting_trx_age time /* mariadb-5.3 */ YES NULL -waiting_trx_rows_locked bigint(21) unsigned NO 0 -waiting_trx_rows_modified bigint(21) unsigned NO 0 -waiting_pid bigint(21) unsigned NO 0 +waiting_trx_rows_locked bigint(21) unsigned NO NULL +waiting_trx_rows_modified bigint(21) unsigned NO NULL +waiting_pid bigint(21) unsigned NO NULL waiting_query varchar(1024) YES NULL -waiting_lock_id varchar(81) NO +waiting_lock_id varchar(81) NO NULL waiting_lock_mode enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NO NULL -blocking_trx_id bigint(21) unsigned NO 0 -blocking_pid bigint(21) unsigned NO 0 +blocking_trx_id bigint(21) unsigned NO NULL +blocking_pid bigint(21) unsigned NO NULL blocking_query varchar(1024) YES NULL -blocking_lock_id varchar(81) NO +blocking_lock_id varchar(81) NO NULL blocking_lock_mode enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NO NULL -blocking_trx_started datetime NO 0000-00-00 00:00:00 +blocking_trx_started datetime NO NULL blocking_trx_age time /* mariadb-5.3 */ YES NULL -blocking_trx_rows_locked bigint(21) unsigned NO 0 -blocking_trx_rows_modified bigint(21) unsigned NO 0 +blocking_trx_rows_locked bigint(21) unsigned NO NULL +blocking_trx_rows_modified bigint(21) unsigned NO NULL sql_kill_blocking_query varchar(32) YES NULL sql_kill_blocking_connection varchar(26) YES NULL SELECT * FROM sys.x$innodb_lock_waits; +# +# Start of 10.6 tests +# +# +# MDEV-26507 Assertion `tmp != ((long long) 0x8000000000000000LL)' failed in TIME_from_longlong_datetime_packed +# +SET SESSION sql_mode='ALLOW_INVALID_DATES'; +SELECT * FROM sys.x$innodb_lock_waits; +SET SESSION sql_mode=DEFAULT; +# +# End of 10.6 tests +# diff --git a/mysql-test/suite/sysschema/r/v_schema_auto_increment_columns.result b/mysql-test/suite/sysschema/r/v_schema_auto_increment_columns.result index 5eb259d3e8dbc..ef2ad76b6002a 100644 --- a/mysql-test/suite/sysschema/r/v_schema_auto_increment_columns.result +++ b/mysql-test/suite/sysschema/r/v_schema_auto_increment_columns.result @@ -1,10 +1,10 @@ DESC sys.schema_auto_increment_columns; Field Type Null Key Default Extra -table_schema varchar(64) NO -table_name varchar(64) NO -column_name varchar(64) NO -data_type varchar(64) NO -column_type longtext NO +table_schema varchar(64) NO NULL +table_name varchar(64) NO NULL +column_name varchar(64) NO NULL +data_type varchar(64) NO NULL +column_type longtext NO NULL is_signed int(1) NO 0 is_unsigned int(1) NO 0 max_value bigint(21) unsigned YES NULL diff --git a/mysql-test/suite/sysschema/r/v_schema_redundant_indexes.result b/mysql-test/suite/sysschema/r/v_schema_redundant_indexes.result index 10c04ffb69c20..2199c959cd029 100644 --- a/mysql-test/suite/sysschema/r/v_schema_redundant_indexes.result +++ b/mysql-test/suite/sysschema/r/v_schema_redundant_indexes.result @@ -1,11 +1,11 @@ DESC sys.schema_redundant_indexes; Field Type Null Key Default Extra -table_schema varchar(64) NO -table_name varchar(64) NO -redundant_index_name varchar(64) NO +table_schema varchar(64) NO NULL +table_name varchar(64) NO NULL +redundant_index_name varchar(64) NO NULL redundant_index_columns mediumtext YES NULL redundant_index_non_unique bigint(1) YES NULL -dominant_index_name varchar(64) NO +dominant_index_name varchar(64) NO NULL dominant_index_columns mediumtext YES NULL dominant_index_non_unique bigint(1) YES NULL subpart_exists int(1) YES NULL @@ -13,9 +13,9 @@ sql_drop_index varchar(223) YES NULL SELECT * FROM sys.schema_redundant_indexes; DESC sys.x$schema_flattened_keys; Field Type Null Key Default Extra -table_schema varchar(64) NO -table_name varchar(64) NO -index_name varchar(64) NO +table_schema varchar(64) NO NULL +table_name varchar(64) NO NULL +index_name varchar(64) NO NULL non_unique bigint(1) YES NULL subpart_exists bigint(1) YES NULL index_columns mediumtext YES NULL diff --git a/mysql-test/suite/sysschema/t/pr_create_synonym_db.test b/mysql-test/suite/sysschema/t/pr_create_synonym_db.test index 4fbe875938097..30c6f502e3058 100644 --- a/mysql-test/suite/sysschema/t/pr_create_synonym_db.test +++ b/mysql-test/suite/sysschema/t/pr_create_synonym_db.test @@ -50,3 +50,20 @@ DROP TABLE test.t1; DROP TABLE test.t2; DROP TABLE `is`; DROP TABLE `ab``c`; + +--echo # +--echo # MDEV-28342: sys.create_synonym_db fails +--echo # when a temporary table masks a base table +--echo # + +create database db; +use db; +create table a(a int); +create table t (b int); +create table b(a int); +create temporary table b (a int); +--error ER_SIGNAL_EXCEPTION +call sys.create_synonym_db('db','db_copy'); + +drop database db; +drop database db_copy; diff --git a/mysql-test/suite/sysschema/t/pr_diagnostics.test b/mysql-test/suite/sysschema/t/pr_diagnostics.test index 01825a1274edc..40ea90005a931 100644 --- a/mysql-test/suite/sysschema/t/pr_diagnostics.test +++ b/mysql-test/suite/sysschema/t/pr_diagnostics.test @@ -19,7 +19,6 @@ SET @sys.debug = 'ON', @sys.diagnostics.allow_i_s_tables = 'ON', @sys.diagnostics.include_raw = 'ON'; ---error ER_ILLEGAL_HA_CREATE_OPTION CALL sys.diagnostics(4, 2, 'full'); SET @sys.debug = 'OFF', diff --git a/mysql-test/suite/sysschema/t/pr_table_exists.test b/mysql-test/suite/sysschema/t/pr_table_exists.test index 06226510d324f..83e1dc0b9d990 100644 --- a/mysql-test/suite/sysschema/t/pr_table_exists.test +++ b/mysql-test/suite/sysschema/t/pr_table_exists.test @@ -1,25 +1,36 @@ -- source include/not_embedded.inc ---disable_warnings -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v_t1; ---enable_warnings # Create a base table and a view CREATE TABLE t1 (id INT PRIMARY KEY); -CREATE view v_t1 AS SELECT * FROM t1; - # Verify the base table and view is supported CALL sys.table_exists('test', 't1', @exists); SELECT @exists; +DROP TABLE t1; +CREATE view v_t1 AS SELECT 1; CALL sys.table_exists('test', 'v_t1', @exists); SELECT @exists; +DROP VIEW v_t1; + +CREATE TABLE tv (i int) with system versioning; +CALL sys.table_exists('test','tv',@exists); +SELECT @exists; +DROP TABLE tv; + +CREATE SEQUENCE s; +CALL sys.table_exists('test','s',@exists); +SELECT @exists; +DROP SEQUENCE s; # Replace the base table with a temporary table CREATE TEMPORARY TABLE t1 (id INT PRIMARY KEY); CALL sys.table_exists('test', 't1', @exists); SELECT @exists; +DROP TEMPORARY TABLE t1; + +CALL sys.table_exists('information_schema', 'all_plugins', @exists); +SELECT @exists; # Try a non-existing table CALL sys.table_exists('test', 't2', @exists); @@ -34,8 +45,25 @@ CALL sys.table_exists(@identifier, 't1', @exists); -- error 1406 CALL sys.table_exists('test', @identifier, @exists); -# Clean up -DROP TEMPORARY TABLE t1; -DROP TABLE t1; -DROP VIEW v_t1; SET @identifier := NULL; + +--echo # +--echo # MDEV-28391: table_exists procedure fails with +--echo # Incorrect table name with backtick identifiers +--echo # +CREATE TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CALL sys.table_exists('test', 'ab`c', @tbl_type); +SELECT @tbl_type; +DROP TABLE `ab``c`; +CREATE TEMPORARY TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CALL sys.table_exists('test', 'ab`c', @tbl_type); +SELECT @tbl_type; +DROP TABLE `ab``c`; +CREATE TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CREATE TEMPORARY TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CALL sys.table_exists('test', 'ab`c', @tbl_type); +SELECT @tbl_type; +--echo # We cannot send quoted identifer to the procedure, no table will be found +CALL sys.table_exists('test', '`ab``c`', @tbl_type); +SELECT @tbl_type; +DROP TABLE `ab``c`; \ No newline at end of file diff --git a/mysql-test/suite/sysschema/t/v_innodb_lock_waits.test b/mysql-test/suite/sysschema/t/v_innodb_lock_waits.test index d742f5995957e..b784587d2a6fa 100644 --- a/mysql-test/suite/sysschema/t/v_innodb_lock_waits.test +++ b/mysql-test/suite/sysschema/t/v_innodb_lock_waits.test @@ -21,3 +21,21 @@ DESC sys.x$innodb_lock_waits; SELECT * FROM sys.x$innodb_lock_waits; --enable_result_log + +--echo # +--echo # Start of 10.6 tests +--echo # + +--echo # +--echo # MDEV-26507 Assertion `tmp != ((long long) 0x8000000000000000LL)' failed in TIME_from_longlong_datetime_packed +--echo # + +SET SESSION sql_mode='ALLOW_INVALID_DATES'; +--disable_result_log +SELECT * FROM sys.x$innodb_lock_waits; +--enable_result_log +SET SESSION sql_mode=DEFAULT; + +--echo # +--echo # End of 10.6 tests +--echo # diff --git a/mysql-test/suite/vcol/r/binlog.result b/mysql-test/suite/vcol/r/binlog.result index 97d0aabb315eb..1f66a6326971b 100644 --- a/mysql-test/suite/vcol/r/binlog.result +++ b/mysql-test/suite/vcol/r/binlog.result @@ -89,7 +89,7 @@ show create table t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `UUID()` uuid DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t2 (a INT PRIMARY KEY, b TEXT, c INT GENERATED ALWAYS AS(b)); INSERT INTO t2 (a,b) VALUES (1,1); SET SESSION binlog_row_image= default; diff --git a/mysql-test/suite/vcol/r/cross_db.result b/mysql-test/suite/vcol/r/cross_db.result index c99f8e919d92f..096ad88806fda 100644 --- a/mysql-test/suite/vcol/r/cross_db.result +++ b/mysql-test/suite/vcol/r/cross_db.result @@ -5,7 +5,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, `j` int(11) GENERATED ALWAYS AS (`i`) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table mysqltest1.t1 add index (i); show create table mysqltest1.t1; Table Create Table @@ -13,5 +13,5 @@ t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL, `j` int(11) GENERATED ALWAYS AS (`i`) STORED, KEY `i` (`i`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop database mysqltest1; diff --git a/mysql-test/suite/vcol/r/innodb_autoinc_vcol.result b/mysql-test/suite/vcol/r/innodb_autoinc_vcol.result index d980c26dfb187..5349b7a050b18 100644 --- a/mysql-test/suite/vcol/r/innodb_autoinc_vcol.result +++ b/mysql-test/suite/vcol/r/innodb_autoinc_vcol.result @@ -12,5 +12,5 @@ t1 CREATE TABLE `t1` ( `c2` int(11) GENERATED ALWAYS AS (1 + 1) VIRTUAL, `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; diff --git a/mysql-test/suite/vcol/r/not_supported.result b/mysql-test/suite/vcol/r/not_supported.result index c804cf220d2c0..37ce4865dcc42 100644 --- a/mysql-test/suite/vcol/r/not_supported.result +++ b/mysql-test/suite/vcol/r/not_supported.result @@ -34,3 +34,24 @@ select * from t8; a b v 1234567890 2 2009-02-14 00:31:30 drop table t1, t3_ok, t8; +# +# Bug#33141966 - INCONSISTENT BEHAVIOR IF A COLUMN OF TYPE SERIAL IS SET AS GENERATED +# +create table t1 (a int, b serial as (a+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 'as (a+1))' at line 1 +# +# End of 10.2 tests +# +create table t1 (a int, b real as (rand()), c real as (b) stored); +ERROR HY000: Function or expression 'b' cannot be used in the GENERATED ALWAYS AS clause of `c` +create table t1 (a int, b real as (rand()), c real as (b) unique); +ERROR HY000: Function or expression 'b' cannot be used in the GENERATED ALWAYS AS clause of `c` +create table t1 (a int auto_increment primary key, +b int as (a+1), c int as (b+1) stored); +ERROR HY000: Function or expression 'b' cannot be used in the GENERATED ALWAYS AS clause of `c` +create table t1 (a int auto_increment primary key, +b int as (a+1), c int as (b+1) unique); +ERROR HY000: Function or expression 'b' cannot be used in the GENERATED ALWAYS AS clause of `c` +# +# End of 10.3 tests +# diff --git a/mysql-test/suite/vcol/r/rpl_vcol.result b/mysql-test/suite/vcol/r/rpl_vcol.result index d95ca8b1f7592..8dea4dd14f11c 100644 --- a/mysql-test/suite/vcol/r/rpl_vcol.result +++ b/mysql-test/suite/vcol/r/rpl_vcol.result @@ -8,7 +8,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert into t1 values (2,default); select * from t1; diff --git a/mysql-test/suite/vcol/r/update.result b/mysql-test/suite/vcol/r/update.result index fe235228698fd..0b0dd933214ca 100644 --- a/mysql-test/suite/vcol/r/update.result +++ b/mysql-test/suite/vcol/r/update.result @@ -17,7 +17,7 @@ t1 CREATE TABLE `t1` ( `p` varchar(20) GENERATED ALWAYS AS (rtrim(`y`)) VIRTUAL, `y` char(20) DEFAULT NULL, KEY `p` (`p`,`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 (a,y) values(1, "yyy"); update t1 set a = 100 where a = 1; check table t1; diff --git a/mysql-test/suite/vcol/r/update_binlog.result b/mysql-test/suite/vcol/r/update_binlog.result index 822381a194485..14aa50b76168a 100644 --- a/mysql-test/suite/vcol/r/update_binlog.result +++ b/mysql-test/suite/vcol/r/update_binlog.result @@ -19,7 +19,7 @@ t1 CREATE TABLE `t1` ( `p` varchar(20) GENERATED ALWAYS AS (rtrim(`y`)) VIRTUAL, `y` char(20) DEFAULT NULL, KEY `p` (`p`,`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 (a,y) values(1, "yyy"); update t1 set a = 100 where a = 1; check table t1; @@ -199,7 +199,7 @@ t1 CREATE TABLE `t1` ( `p` varchar(20) GENERATED ALWAYS AS (rtrim(`y`)) VIRTUAL, `y` char(20) DEFAULT NULL, KEY `p` (`p`,`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 (a,y) values(1, "yyy"); update t1 set a = 100 where a = 1; check table t1; diff --git a/mysql-test/suite/vcol/r/upgrade.result b/mysql-test/suite/vcol/r/upgrade.result index 527bc5f3abfe8..5393a3543dc39 100644 --- a/mysql-test/suite/vcol/r/upgrade.result +++ b/mysql-test/suite/vcol/r/upgrade.result @@ -6,9 +6,9 @@ show create table vcol_autoinc; Table Create Table vcol_autoinc CREATE TABLE `vcol_autoinc` ( `pk` int(11) NOT NULL AUTO_INCREMENT, - `v3` int(11) GENERATED ALWAYS AS (`pk`) VIRTUAL, + `v3` int(11) GENERATED ALWAYS AS (`pk`) STORED, PRIMARY KEY (`pk`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from vcol_autoinc; pk v3 insert vcol_autoinc (pk) values (1); @@ -27,7 +27,7 @@ t1 CREATE TABLE `t1` ( `Data` varbinary(2000) NOT NULL, `a` varchar(100) GENERATED ALWAYS AS (column_get(`Data`,1 as char(100) charset latin1)) VIRTUAL, PRIMARY KEY (`Date`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (to_days(`Date`)) (PARTITION `p20181029` VALUES LESS THAN (737361) ENGINE = MyISAM, PARTITION `p20181128` VALUES LESS THAN (737391) ENGINE = MyISAM) diff --git a/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result b/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result index a0f330912979f..425aa1b127f0a 100644 --- a/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result +++ b/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result @@ -191,7 +191,7 @@ create or replace table t1 (a int, b int as (stddev_pop(a))); ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` # STDDEV_SAMP() create or replace table t1 (a int, b int as (stddev_samp(a))); -ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` +ERROR HY000: Function or expression 'stddev_samp()' cannot be used in the GENERATED ALWAYS AS clause of `b` # STDDEV() create or replace table t1 (a int, b int as (stddev(a))); ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b` diff --git a/mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result b/mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result index c0008f8f1791a..965091e7cae33 100644 --- a/mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result @@ -55,7 +55,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL COMMENT 'my comment' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -68,7 +68,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL COMMENT 'my comment' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -88,7 +88,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL COMMENT 'my comment' -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t2; Field Type Null Key Default Extra a int(11) YES NULL @@ -110,7 +110,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) STORED -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -132,7 +132,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) STORED -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int, b int as (a % 2)); alter table t1 modify b int as (a % 2) persistent; @@ -142,5 +142,5 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; diff --git a/mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result b/mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result index 0aea337b0746f..bab4e501b710b 100644 --- a/mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result @@ -55,7 +55,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL COMMENT 'my comment' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -68,7 +68,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL COMMENT 'my comment' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -88,7 +88,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL COMMENT 'my comment' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t2; Field Type Null Key Default Extra a int(11) YES NULL @@ -110,7 +110,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -132,7 +132,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int, b int as (a % 2)); alter table t1 modify b int as (a % 2) persistent; @@ -142,5 +142,5 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; diff --git a/mysql-test/suite/vcol/r/vcol_keys_innodb.result b/mysql-test/suite/vcol/r/vcol_keys_innodb.result index 759de6fbb23bf..c07e00a5e20e9 100644 --- a/mysql-test/suite/vcol/r/vcol_keys_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_keys_innodb.result @@ -15,7 +15,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, UNIQUE KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -30,7 +30,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, UNIQUE KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -59,7 +59,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -72,7 +72,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, KEY `a` (`a`,`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES MUL NULL diff --git a/mysql-test/suite/vcol/r/vcol_keys_myisam.result b/mysql-test/suite/vcol/r/vcol_keys_myisam.result index 8b89da987a1f1..2e15c50263bfa 100644 --- a/mysql-test/suite/vcol/r/vcol_keys_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_keys_myisam.result @@ -15,7 +15,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, UNIQUE KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -30,7 +30,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, UNIQUE KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -59,7 +59,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, KEY `b` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES NULL @@ -72,7 +72,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` * 2) STORED, KEY `a` (`a`,`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci describe t1; Field Type Null Key Default Extra a int(11) YES MUL NULL diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result index b7bd63f662e94..17b2f2af00d76 100644 --- a/mysql-test/suite/vcol/r/vcol_misc.result +++ b/mysql-test/suite/vcol/r/vcol_misc.result @@ -1,4 +1,3 @@ -drop table if exists t1,t2; create table t1 (a int, b int, v int as (a+1), index idx(b)); insert into t1(a, b) values (4, 40), (3, 30), (5, 50), (7, 70), (8, 80), (2, 20), (1, 10); @@ -103,7 +102,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `v1` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1,t2; CREATE TABLE t1 (p int, a double NOT NULL, v double AS (ROUND(a,p)) VIRTUAL); INSERT IGNORE INTO t1 VALUES (0,1,0); @@ -130,8 +129,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(32) DEFAULT NULL, - `v` char(32) CHARACTER SET ucs2 GENERATED ALWAYS AS (`a`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `v` char(32) CHARACTER SET ucs2 COLLATE ucs2_general_ci GENERATED ALWAYS AS (`a`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a int, b int); CREATE TABLE t2 (a int, b int as (a+1) VIRTUAL); @@ -156,7 +155,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` char(2) NOT NULL, `c` enum('Y','N') GENERATED ALWAYS AS (case when `b` = 'aa' then 'Y' else 'N' end) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1(a,b) values (1,'bb'), (2,'aa'), (3,'cc'); select * from t1; a b c @@ -174,7 +173,7 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` set('y','n') GENERATED ALWAYS AS (if(`a` = 0,if(`b` = 0,'n,n','n,y'),if(`b` = 0,'y,n','y,y'))) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t2(a,b) values (7,0), (2,3), (0,1); select * from t2; a b c @@ -247,8 +246,8 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, - `b` bigint(20) GENERATED ALWAYS AS (`a` > '2') VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `b` bigint(20) GENERATED ALWAYS AS (`a` > 2) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 (a) values (1),(3); select * from t1; a b @@ -265,7 +264,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, `b` bigint(20) GENERATED ALWAYS AS (`a` between 0 and 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 (a) values (1),(3); select * from t1; a b @@ -282,7 +281,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) DEFAULT NULL, `b` char(10) GENERATED ALWAYS AS (`a` between 0 and 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 (a) values (1),(3); select * from t1; a b @@ -306,7 +305,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(32) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (`a` MOD 10) VIRTUAL, `d` varchar(5) GENERATED ALWAYS AS (left(`b`,5)) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci show columns from t1; Field Type Null Key Default Extra a int(11) NO NULL @@ -345,7 +344,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `v1` varchar(255) GENERATED ALWAYS AS (`c1`) STORED, - `c1` varchar(50) COLLATE latin1_general_ci DEFAULT NULL + `c1` varchar(50) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci drop table t1; set sql_mode='no_zero_date'; @@ -396,7 +395,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` timestamp GENERATED ALWAYS AS (cast(`a` as datetime)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a DATETIME, b TIMESTAMP AS (TIMESTAMP(a)),c TIMESTAMP); SHOW CREATE TABLE t1; @@ -405,7 +404,7 @@ t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` timestamp GENERATED ALWAYS AS (cast(`a` as datetime)) VIRTUAL, `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # MDEV-8839 COLUMN_GET() produces warnings with no data @@ -450,9 +449,6 @@ SET sql_mode=DEFAULT; # End of 10.1 tests # # -# Start of 10.2 tests -# -# # MDEV-16518 MYSQL57_GENERATED_FIELD: The code in TABLE_SHARE::init_from_binary_frm_image() is not safe # SHOW TABLES; @@ -531,5 +527,42 @@ a b DROP TABLE t1; SET sql_mode=DEFAULT; # +# CONTEXT_ANALYSIS_ONLY_VCOL_EXPR +# +call mtr.add_suppression("Charset id.*trying to replace"); +create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci, +v1 char(1) character set ucs2 collate ucs2_test_ci as (c1), +v2 int as (c1 = 'b'), +v3 int as (v1 = 'b')); +insert into t1 (c1) values ('a'); +select * from t1 where v1 = 'b'; +c1 v1 v2 v3 +a a 1 1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` char(1) CHARACTER SET ucs2 COLLATE ucs2_test_ci DEFAULT NULL, + `v1` char(1) CHARACTER SET ucs2 COLLATE ucs2_test_ci GENERATED ALWAYS AS (`c1`) VIRTUAL, + `v2` int(11) GENERATED ALWAYS AS (`c1` = 'b') VIRTUAL, + `v3` int(11) GENERATED ALWAYS AS (`v1` = 'b') VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +# # End of 10.2 tests # +# +# RAND is session func +# +create table t1 (a int, b float default rand(1)); +insert into t1 (a) values (1); +insert into t1 (a) values (2); +insert into t1 (a) values (3); +select * from t1; +a b +1 0.405404 +2 0.405404 +3 0.405404 +drop table t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/suite/vcol/r/vcol_non_stored_columns_innodb.result b/mysql-test/suite/vcol/r/vcol_non_stored_columns_innodb.result index 058c389e8853a..93d912a16c3ec 100644 --- a/mysql-test/suite/vcol/r/vcol_non_stored_columns_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_non_stored_columns_innodb.result @@ -82,7 +82,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) STORED -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 8. ALTER. Modify virtual non-stored -> virtual stored create table t1 (a int, b int as (a % 2)); @@ -93,7 +93,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 9. CREATE LIKE # - Column1: "real" @@ -132,7 +132,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` varchar(5) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 11. ALTER. Dropping a virtual stored column. # - Column1: virtual stored @@ -154,7 +154,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` char(5) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 12. ALTER. Adding a new virtual non-stored column. create table t1 (a int, b datetime); @@ -175,7 +175,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (dayofyear(`b`)) VIRTUAL, `b` datetime DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 13. ALTER. Adding a new virtual stored column. create table t1 (a int, b datetime); @@ -196,7 +196,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (dayofyear(`b`)) STORED, `b` datetime DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 14. ALTER. Changing the expression of a virtual stored column. create table t1 (a int, b datetime, c int as (week(b,0)) persistent); @@ -217,7 +217,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (week(`b`,1)) STORED -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 15. ALTER. Changing the expression of a virtual non-stored column. create table t1 (a int, b datetime, c int as (week(b,0))); @@ -238,7 +238,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (week(`b`,1)) VIRTUAL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # # MDEV-6103 - Adding/removing non-materialized virtual column triggers diff --git a/mysql-test/suite/vcol/r/vcol_non_stored_columns_myisam.result b/mysql-test/suite/vcol/r/vcol_non_stored_columns_myisam.result index bc1ba99059616..e0a009d447431 100644 --- a/mysql-test/suite/vcol/r/vcol_non_stored_columns_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_non_stored_columns_myisam.result @@ -82,7 +82,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 8. ALTER. Modify virtual non-stored -> virtual stored create table t1 (a int, b int as (a % 2)); @@ -93,7 +93,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 9. CREATE LIKE # - Column1: "real" @@ -132,7 +132,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` varchar(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 11. ALTER. Dropping a virtual stored column. # - Column1: virtual stored @@ -154,7 +154,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` char(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 12. ALTER. Adding a new virtual non-stored column. create table t1 (a int, b datetime); @@ -175,7 +175,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (dayofyear(`b`)) VIRTUAL, `b` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 13. ALTER. Adding a new virtual stored column. create table t1 (a int, b datetime); @@ -196,7 +196,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (dayofyear(`b`)) STORED, `b` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 14. ALTER. Changing the expression of a virtual stored column. create table t1 (a int, b datetime, c int as (week(b,0)) persistent); @@ -217,7 +217,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (week(`b`,1)) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # Case 15. ALTER. Changing the expression of a virtual non-stored column. create table t1 (a int, b datetime, c int as (week(b,0))); @@ -238,7 +238,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (week(`b`,1)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # # MDEV-6103 - Adding/removing non-materialized virtual column triggers diff --git a/mysql-test/suite/vcol/r/vcol_sql_mode.result b/mysql-test/suite/vcol/r/vcol_sql_mode.result index ba75aeb0e6ce0..fdbc8c6a29176 100644 --- a/mysql-test/suite/vcol/r/vcol_sql_mode.result +++ b/mysql-test/suite/vcol/r/vcol_sql_mode.result @@ -14,7 +14,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` char(5) GENERATED ALWAYS AS (`a`) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v INT AS (a) VIRTUAL, KEY(v)); SHOW CREATE TABLE t1; @@ -23,7 +23,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v TIME AS (a) VIRTUAL, KEY(v)); ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` @@ -59,7 +59,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (rtrim(`a`)) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v TEXT AS (RTRIM(a)) VIRTUAL, KEY(v(100))); SHOW CREATE TABLE t1; @@ -68,7 +68,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` text GENERATED ALWAYS AS (rtrim(`a`)) VIRTUAL, KEY `v` (`v`(100)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING ' ' FROM a)) VIRTUAL, KEY(v)); SHOW CREATE TABLE t1; @@ -77,7 +77,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (trim(trailing ' ' from `a`)) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v TEXT AS (TRIM(TRAILING ' ' FROM a)) VIRTUAL, KEY(v(100))); SHOW CREATE TABLE t1; @@ -86,7 +86,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` text GENERATED ALWAYS AS (trim(trailing ' ' from `a`)) VIRTUAL, KEY `v` (`v`(100)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH ' ' FROM a)) VIRTUAL, KEY(v)); SHOW CREATE TABLE t1; @@ -95,7 +95,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (trim(both ' ' from `a`)) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v TEXT AS (TRIM(BOTH ' ' FROM a)) VIRTUAL, KEY(v(100))); SHOW CREATE TABLE t1; @@ -104,7 +104,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` text GENERATED ALWAYS AS (trim(both ' ' from `a`)) VIRTUAL, KEY `v` (`v`(100)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING NULL FROM a)) VIRTUAL, KEY(v)); SHOW CREATE TABLE t1; @@ -113,7 +113,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (trim(trailing NULL from `a`)) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH NULL FROM a)) VIRTUAL, KEY(v)); SHOW CREATE TABLE t1; @@ -122,7 +122,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (trim(both NULL from `a`)) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # PAD_CHAR_TO_FULL_LENGTH + TRIM not resolving dependency CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(LEADING ' ' FROM a)) VIRTUAL, KEY(v)); @@ -195,7 +195,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (rpad(`a`,5,' ')) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RPAD(a,6,' ')) VIRTUAL, KEY(v)); SHOW CREATE TABLE t1; @@ -204,7 +204,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (rpad(`a`,6,' ')) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RPAD(a,6,NULL)) VIRTUAL, KEY(v)); SHOW CREATE TABLE t1; @@ -213,7 +213,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (rpad(`a`,6,NULL)) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RPAD(a,NULL,' ')) VIRTUAL, KEY(v)); SHOW CREATE TABLE t1; @@ -222,7 +222,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (rpad(`a`,NULL,' ')) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # PAD_CHAR_TO_FULL_LENGTH + RPAD not resolving dependency CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RPAD(a,4,' ')) VIRTUAL, KEY(v)); @@ -250,7 +250,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` int(11) GENERATED ALWAYS AS (`a` = 'a') VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a CHAR(5) CHARACTER SET latin1 COLLATE latin1_nopad_bin, @@ -269,7 +269,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` int(11) GENERATED ALWAYS AS (`a` like 'a%') VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v INT AS (a LIKE NULL) VIRTUAL, KEY(v)); SHOW CREATE TABLE t1; @@ -278,7 +278,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` int(11) GENERATED ALWAYS AS (`a` like NULL) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v INT AS (a LIKE 'a') VIRTUAL, KEY(v)); ERROR HY000: Function or expression '`a` like 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v` @@ -342,7 +342,7 @@ t1 CREATE TABLE `t1` ( `b` int(10) unsigned DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (cast(`a` as signed) - cast(`b` as signed)) VIRTUAL, KEY `c` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 ( a INT UNSIGNED, @@ -357,7 +357,7 @@ t1 CREATE TABLE `t1` ( `b` int(10) unsigned DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (cast(`a` as decimal(20,0)) - cast(`b` as decimal(20,0))) VIRTUAL, KEY `c` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Comnination: PAD_CHAR_TO_FULL_LENGTH + NO_UNSIGNED_SUBTRACTION @@ -427,7 +427,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (rtrim(`a`)) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # End of 10.2 tests diff --git a/mysql-test/suite/vcol/r/vcol_sql_mode_upgrade.result b/mysql-test/suite/vcol/r/vcol_sql_mode_upgrade.result index d3954770c7beb..8723e268649bb 100644 --- a/mysql-test/suite/vcol/r/vcol_sql_mode_upgrade.result +++ b/mysql-test/suite/vcol/r/vcol_sql_mode_upgrade.result @@ -8,7 +8,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (`a`) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Warnings: Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH @@ -17,14 +17,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (`a`) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FLUSH TABLES; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (`a`) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Warnings: Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH @@ -61,7 +61,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (`a`) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Warnings: Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH @@ -72,7 +72,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (`a`) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; a v 1 1 @@ -109,7 +109,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (`a`) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Warnings: Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH @@ -119,7 +119,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (rtrim(`a`)) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Opening a Maria-10.2.26 table with a virtual VARCHAR column @@ -131,7 +131,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (`a`) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Warnings: Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH @@ -141,7 +141,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (`a`) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FLUSH TABLES; SHOW CREATE TABLE t1; Table Create Table @@ -149,7 +149,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (`a`) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Warnings: Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH @@ -187,7 +187,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (`a`) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Warnings: Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH @@ -213,7 +213,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (`a`) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Warnings: Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH @@ -232,7 +232,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (`a`) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Warnings: Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH @@ -242,7 +242,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (`a`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; a v 1 1 @@ -260,7 +260,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (`a`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; a v 1 1 @@ -275,7 +275,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (`a`) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Warnings: Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH @@ -286,7 +286,7 @@ t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (rtrim(`a`)) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; a v 1 1 @@ -299,7 +299,7 @@ t2 CREATE TABLE `t2` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (rtrim(`a`)) VIRTUAL, KEY `v` (`v`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # diff --git a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result index 587ac9c150d6c..832047a8d6ca8 100644 --- a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result +++ b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result @@ -10,7 +10,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (abs(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-1, default); select * from t1; a b @@ -25,7 +25,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(acos(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1, default); insert ignore into t1 values (1.0001,default); insert into t1 values (0,default); @@ -44,7 +44,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(asin(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (0.2, default); insert ignore into t1 values (1.0001,default); select * from t1; @@ -62,7 +62,7 @@ t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, `c` double GENERATED ALWAYS AS (format(atan(`a`,`b`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-2,2,default); insert ignore into t1 values (format(PI(),6),0,default); select * from t1; @@ -78,7 +78,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `c` double GENERATED ALWAYS AS (format(atan(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-2,default); insert ignore into t1 values (format(PI(),6),default); select * from t1; @@ -96,7 +96,7 @@ t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, `c` double GENERATED ALWAYS AS (format(atan(`a`,`b`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-2,2,default); insert ignore into t1 values (format(PI(),6),0,default); select * from t1; @@ -113,7 +113,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (ceiling(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1.23,default); insert ignore into t1 values (-1.23,default); select * from t1; @@ -132,7 +132,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL, `d` varchar(10) GENERATED ALWAYS AS (conv(`a`,`b`,`c`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a',16,2,default); insert ignore into t1 values ('6e',18,8,default); insert into t1 values (-17,10,-18,default); @@ -153,7 +153,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(cos(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (format(PI(),6),default); select * from t1; a b @@ -168,7 +168,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(cot(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (12,default); insert ignore into t1 values (1,default); select * from t1; @@ -185,7 +185,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` mediumtext GENERATED ALWAYS AS (crc32(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); insert ignore into t1 values ('mysql',default); select * from t1; @@ -202,7 +202,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(degrees(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (format(PI(),6),default); insert ignore into t1 values (format(PI()/2,6),default); select * from t1; @@ -219,7 +219,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (`a` / 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); select * from t1; a b @@ -234,7 +234,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(exp(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); insert ignore into t1 values (-2,default); insert into t1 values (0,default); @@ -253,7 +253,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` mediumtext GENERATED ALWAYS AS (floor(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1.23,default); insert ignore into t1 values (-1.23,default); select * from t1; @@ -270,7 +270,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(ln(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); insert ignore into t1 values (-2,default); Warnings: @@ -292,7 +292,7 @@ t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, `c` double GENERATED ALWAYS AS (format(log(`a`,`b`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,65536,default); insert ignore into t1 values (10,100,default); insert into t1 values (1,100,default); @@ -314,7 +314,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(log(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); insert ignore into t1 values (-2,default); Warnings: @@ -335,7 +335,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(log2(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (65536,default); insert ignore into t1 values (-100,default); Warnings: @@ -356,7 +356,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(log10(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); insert ignore into t1 values (100,default); insert into t1 values (-100,default); @@ -379,7 +379,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (`a` - 1) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2,default); select * from t1; a b @@ -394,7 +394,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 10) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert ignore into t1 values (11,default); select * from t1; @@ -411,7 +411,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` MOD 10) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert ignore into t1 values (11,default); select * from t1; @@ -428,7 +428,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (conv(`a`,10,8)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (12,default); select * from t1; a b @@ -443,7 +443,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(pi() * `a` * `a`,6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); select * from t1; a b @@ -458,7 +458,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); select * from t1; a b @@ -474,7 +474,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (pow(`a`,2)) VIRTUAL, `c` int(11) GENERATED ALWAYS AS (pow(`a`,2)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default,default); insert ignore into t1 values (2,default,default); select * from t1; @@ -491,7 +491,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(radians(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (90,default); select * from t1; a b @@ -506,7 +506,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (round(`a`,0)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-1.23,default); insert ignore into t1 values (-1.58,default); insert into t1 values (1.58,default); @@ -525,7 +525,7 @@ t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (round(`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1.298,1,default); insert ignore into t1 values (1.298,0,default); insert into t1 values (23.298,-1,default); @@ -544,7 +544,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (sign(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-32,default); insert ignore into t1 values (0,default); insert into t1 values (234,default); @@ -563,7 +563,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(sin(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (format(PI()/2,6),default); select * from t1; a b @@ -578,7 +578,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(sqrt(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (4,default); insert ignore into t1 values (20,default); insert into t1 values (-16,default); @@ -597,7 +597,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (format(tan(`a`),6)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (format(PI(),6),default); insert ignore into t1 values (format(PI()+1,6),default); select * from t1; @@ -614,7 +614,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (`a` * 3) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (0,default); insert ignore into t1 values (1,default); insert into t1 values (2,default); @@ -633,7 +633,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (truncate(`a`,4)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1.223,default); insert ignore into t1 values (1.999,default); insert into t1 values (1.999,default); @@ -654,7 +654,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double GENERATED ALWAYS AS (-`a`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert ignore into t1 values (-1,default); select * from t1; @@ -674,7 +674,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(2) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (ascii(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2',default); insert ignore into t1 values (2,default); insert into t1 values ('dx',default); @@ -693,7 +693,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (conv(`a`,10,2)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (12,default); select * from t1; a b @@ -708,7 +708,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` mediumtext GENERATED ALWAYS AS (bit_length(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -723,7 +723,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` mediumtext GENERATED ALWAYS AS (char_length(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -739,7 +739,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` varbinary(10) GENERATED ALWAYS AS (char(`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (77,121,default); select * from t1; a b c @@ -754,7 +754,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` mediumtext GENERATED ALWAYS AS (char_length(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -770,7 +770,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` varchar(20) GENERATED ALWAYS AS (concat_ws(',',`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('value1','value2',default); select * from t1; a b c @@ -786,7 +786,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` varchar(20) GENERATED ALWAYS AS (concat(`a`,',',`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('value1','value2',default); select * from t1; a b c @@ -803,7 +803,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(10) DEFAULT NULL, `c` int(11) DEFAULT NULL, `d` varchar(10) GENERATED ALWAYS AS (elt(`c`,`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('value1','value2',1,default); insert ignore into t1 values ('value1','value2',2,default); select * from t1; @@ -820,7 +820,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (export_set(`a`,'1','0','',10)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (6,default); select * from t1; a b @@ -836,7 +836,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (field('aa',`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('aa','bb',default); insert ignore into t1 values ('bb','aa',default); select * from t1; @@ -854,7 +854,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (find_in_set(`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('aa','aa,bb,cc',default); insert ignore into t1 values ('aa','bb,aa,cc',default); select * from t1; @@ -871,7 +871,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` varchar(20) GENERATED ALWAYS AS (format(`a`,2)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (12332.123456,default); select * from t1; a b @@ -886,7 +886,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (hex(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (17,default); select * from t1; a b @@ -900,7 +900,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (hex(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -916,7 +916,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` varchar(20) GENERATED ALWAYS AS (insert(`a`,octet_length(`a`),octet_length(`b`),`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('start,','end',default); select * from t1; a b c @@ -932,7 +932,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (locate(`b`,`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar,','bar',default); insert ignore into t1 values ('xbar,','foobar',default); select * from t1; @@ -949,7 +949,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (lcase(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -964,7 +964,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(5) GENERATED ALWAYS AS (left(`a`,5)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar',default); select * from t1; a b @@ -979,7 +979,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (octet_length(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -994,7 +994,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` like 'H%!o' escape '!') VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); insert ignore into t1 values ('MySQL',default); select * from t1; @@ -1011,7 +1011,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (locate('bar',`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar',default); select * from t1; a b @@ -1026,7 +1026,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (lcase(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -1041,7 +1041,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (lpad(`a`,4,' ')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); insert ignore into t1 values ('M',default); select * from t1; @@ -1058,7 +1058,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (ltrim(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (' MySQL',default); insert ignore into t1 values ('MySQL',default); select * from t1; @@ -1077,7 +1077,7 @@ t1 CREATE TABLE `t1` ( `b` varchar(10) DEFAULT NULL, `c` int(11) DEFAULT NULL, `d` varchar(30) GENERATED ALWAYS AS (make_set(`c`,`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a','b',1,default); insert ignore into t1 values ('a','b',3,default); select * from t1; @@ -1094,7 +1094,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,1,2)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar',default); select * from t1; a b @@ -1109,7 +1109,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` not like 'H%o') VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); insert ignore into t1 values ('MySQL',default); select * from t1; @@ -1126,7 +1126,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (!(`a` regexp 'H.+o')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); insert ignore into t1 values ('hello',default); select * from t1; @@ -1143,7 +1143,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (octet_length(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('text',default); select * from t1; a b @@ -1158,7 +1158,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` mediumtext GENERATED ALWAYS AS (ord(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2',default); select * from t1; a b @@ -1173,7 +1173,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (locate('bar',`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar',default); select * from t1; a b @@ -1188,7 +1188,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (quote(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Don\'t',default); select * from t1; a b @@ -1203,7 +1203,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` regexp 'H.+o') VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); insert ignore into t1 values ('hello',default); select * from t1; @@ -1220,7 +1220,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(30) GENERATED ALWAYS AS (repeat(`a`,3)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -1235,7 +1235,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(30) GENERATED ALWAYS AS (replace(`a`,'aa','bb')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('maa',default); select * from t1; a b @@ -1250,7 +1250,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(30) GENERATED ALWAYS AS (reverse(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('maa',default); select * from t1; a b @@ -1265,7 +1265,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (right(`a`,4)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('foobarbar',default); select * from t1; a b @@ -1280,7 +1280,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` regexp 'H.+o') VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); insert ignore into t1 values ('MySQL',default); select * from t1; @@ -1297,7 +1297,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (rpad(`a`,4,'??')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('He',default); select * from t1; a b @@ -1312,7 +1312,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (rtrim(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello ',default); select * from t1; a b @@ -1327,7 +1327,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(20) GENERATED ALWAYS AS (soundex(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); select * from t1; a b @@ -1343,7 +1343,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (soundex(`a`) = soundex(`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello','Hello',default); insert ignore into t1 values ('Hello','MySQL',default); insert into t1 values ('Hello','hello',default); @@ -1362,7 +1362,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (concat(`a`,space(5))) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello', default); select * from t1; a b @@ -1378,7 +1378,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(9) DEFAULT NULL, `b` varchar(9) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (strcmp(`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello','Hello', default); insert ignore into t1 values ('Hello','Hello1', default); select * from t1; @@ -1395,7 +1395,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,2)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); select * from t1; a b @@ -1410,7 +1410,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (substring_index(`a`,'.',2)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('www.mysql.com',default); select * from t1; a b @@ -1425,7 +1425,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (substr(`a`,2,2)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('Hello',default); select * from t1; a b @@ -1440,7 +1440,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (trim(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (' aa ',default); select * from t1; a b @@ -1455,7 +1455,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (ucase(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -1470,7 +1470,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (unhex(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('4D7953514C',default); select * from t1; a b @@ -1485,7 +1485,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (ucase(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -1503,7 +1503,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(16) GENERATED ALWAYS AS (case `a` when NULL then 'asd' when 'b' then 'B' else `a` end) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (NULL,default); insert ignore into t1 values ('b',default); insert into t1 values ('c',default); @@ -1523,7 +1523,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (if(`a` = 1,`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,2,default); insert ignore into t1 values (3,4,default); select * from t1; @@ -1541,7 +1541,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` varchar(10) GENERATED ALWAYS AS (ifnull(`a`,'DEFAULT')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (NULL,'adf',default); insert ignore into t1 values ('a','adf',default); select * from t1; @@ -1558,7 +1558,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (nullif(`a`,'DEFAULT')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('DEFAULT',default); insert ignore into t1 values ('a',default); select * from t1; @@ -1578,7 +1578,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` > 0 and `a` < 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-1,default); insert ignore into t1 values (1,default); select * from t1; @@ -1595,7 +1595,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` between 0 and 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-1,default); insert ignore into t1 values (1,default); select * from t1; @@ -1612,7 +1612,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varbinary(10) GENERATED ALWAYS AS (cast(`a` as char charset binary)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('11',default); insert ignore into t1 values (1,default); select * from t1; @@ -1629,7 +1629,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` & 5) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert ignore into t1 values (0,default); select * from t1; @@ -1646,7 +1646,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (~`a`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); Warnings: Warning 1264 Out of range value for column 'b' at row 1 @@ -1663,7 +1663,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` | 5) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert ignore into t1 values (0,default); insert into t1 values (2,default); @@ -1682,7 +1682,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` ^ 5) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert ignore into t1 values (0,default); insert into t1 values (2,default); @@ -1701,7 +1701,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` DIV 5) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert ignore into t1 values (7,default); select * from t1; @@ -1719,7 +1719,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` <=> `b`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,1,default); insert ignore into t1 values (NULL,NULL,default); insert into t1 values (1,NULL,default); @@ -1739,7 +1739,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` = `b`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a','b',default); insert ignore into t1 values ('a','a',default); select * from t1; @@ -1757,7 +1757,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` >= `b`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a','b',default); insert ignore into t1 values ('a','a',default); select * from t1; @@ -1775,7 +1775,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` > `b`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a','b',default); insert ignore into t1 values ('a','a',default); select * from t1; @@ -1792,7 +1792,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` is not null) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert ignore into t1 values (NULL,default); select * from t1; @@ -1809,7 +1809,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` is null) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert ignore into t1 values (NULL,default); select * from t1; @@ -1826,7 +1826,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` << 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert ignore into t1 values (3,default); select * from t1; @@ -1844,7 +1844,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` <= `b`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('b','a',default); insert ignore into t1 values ('b','b',default); insert into t1 values ('b','c',default); @@ -1864,7 +1864,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` < `b`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('b','a',default); insert ignore into t1 values ('b','b',default); insert into t1 values ('b','c',default); @@ -1883,7 +1883,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` tinyint(1) GENERATED ALWAYS AS (`a` not between 0 and 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (-1,default); insert ignore into t1 values (1,default); select * from t1; @@ -1901,7 +1901,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` <> `b`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('b','a',default); insert ignore into t1 values ('b','b',default); insert into t1 values ('b','c',default); @@ -1921,7 +1921,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` tinyint(1) GENERATED ALWAYS AS (`a` <> `b`) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('b','a',default); insert ignore into t1 values ('b','b',default); insert into t1 values ('b','c',default); @@ -1940,7 +1940,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` > 5 or `a` < 3) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert ignore into t1 values (4,default); select * from t1; @@ -1957,7 +1957,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` >> 2) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (8,default); insert ignore into t1 values (3,default); select * from t1; @@ -1974,7 +1974,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` xor 5) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (0,default); insert ignore into t1 values (1,default); insert into t1 values (2,default); @@ -1996,7 +1996,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (`a` + interval 1 month) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2011,7 +2011,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (addtime(`a`,'02:00:00')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2026,7 +2026,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (convert_tz(`a`,'MET','UTC')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2041,7 +2041,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (`a` + interval 1 month) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2056,7 +2056,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (`a` - interval 1 month) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2071,7 +2071,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (cast(`a` as date)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31 02:00:00',default); select * from t1; a b @@ -2086,7 +2086,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` mediumtext GENERATED ALWAYS AS (to_days(`a`) - to_days('2000-01-01')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2101,7 +2101,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (dayofmonth(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2116,7 +2116,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (dayofmonth(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2131,7 +2131,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (dayofweek(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2146,7 +2146,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (dayofyear(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2161,7 +2161,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (extract(year from `a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2176,7 +2176,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (from_days(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (730669,default); select * from t1; a b @@ -2192,7 +2192,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (from_unixtime(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1196440219,default); select * from t1; a b @@ -2207,7 +2207,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, `b` mediumtext GENERATED ALWAYS AS (hour(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('10:05:03',default); select * from t1; a b @@ -2222,7 +2222,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (last_day(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2003-02-05',default); insert ignore into t1 values ('2003-02-32',default); Warnings: @@ -2241,7 +2241,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (makedate(`a`,1)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2001,default); select * from t1; a b @@ -2256,7 +2256,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` time GENERATED ALWAYS AS (maketime(`a`,1,3)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (12,default); select * from t1; a b @@ -2271,7 +2271,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` mediumtext GENERATED ALWAYS AS (microsecond(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2009-12-31 12:00:00.123456',default); insert ignore into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; @@ -2288,7 +2288,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (minute(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; a b @@ -2303,7 +2303,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (month(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; a b @@ -2318,7 +2318,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (period_add(`a`,2)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (200801,default); select * from t1; a b @@ -2334,7 +2334,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (period_diff(`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (200802,200703,default); select * from t1; a b c @@ -2349,7 +2349,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (quarter(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2364,7 +2364,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext DEFAULT NULL, `b` time GENERATED ALWAYS AS (sec_to_time(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (2378,default); select * from t1; a b @@ -2379,7 +2379,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (second(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('10:05:03',default); select * from t1; a b @@ -2394,7 +2394,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(64) DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (str_to_date(`a`,'%m/%d/%Y')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('04/30/2004',default); select * from t1; a b @@ -2409,7 +2409,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (`a` - interval 1 month) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2424,7 +2424,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime GENERATED ALWAYS AS (subtime(`a`,'02:00:00')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31',default); select * from t1; a b @@ -2439,7 +2439,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, `b` mediumtext GENERATED ALWAYS AS (time_to_sec(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('22:23:00',default); select * from t1; a b @@ -2454,7 +2454,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` time GENERATED ALWAYS AS (cast(`a` as time)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-08-31 02:03:04',default); select * from t1; a b @@ -2470,7 +2470,7 @@ t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime DEFAULT NULL, `c` mediumtext GENERATED ALWAYS AS (timediff(`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-12-31 23:59:59.000001','2008-12-30 01:01:01.000002',default); select * from t1; a b c @@ -2485,7 +2485,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` timestamp GENERATED ALWAYS AS (cast(`a` as datetime)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-12-31',default); select * from t1; a b @@ -2500,7 +2500,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` timestamp GENERATED ALWAYS AS (`a` + interval 1 minute) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2003-01-02',default); select * from t1; a b @@ -2516,7 +2516,7 @@ t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `c` mediumtext GENERATED ALWAYS AS (timestampdiff(MONTH,`a`,`b`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2003-02-01','2003-05-01',default); select * from t1; a b c @@ -2531,7 +2531,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` mediumtext GENERATED ALWAYS AS (to_days(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2007-10-07',default); select * from t1; a b @@ -2546,7 +2546,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (week(`a`,0)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-09-01',default); select * from t1; a b @@ -2561,7 +2561,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (weekday(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-09-01',default); select * from t1; a b @@ -2576,7 +2576,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (week(`a`,3)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-09-01',default); select * from t1; a b @@ -2591,7 +2591,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (year(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-09-01',default); select * from t1; a b @@ -2606,7 +2606,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (yearweek(`a`,0)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2008-09-01',default); select * from t1; a b @@ -2628,7 +2628,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` mediumtext GENERATED ALWAYS AS (cast(`a` as unsigned)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert ignore into t1 values (-1,default); Warnings: @@ -2649,7 +2649,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` mediumtext GENERATED ALWAYS AS (cast(`a` as unsigned)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (1,default); insert ignore into t1 values (-1,default); Warnings: @@ -2677,7 +2677,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (aes_encrypt(aes_decrypt(`a`,'adf'),'adf')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -2692,7 +2692,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (bit_count(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values (5,default); select * from t1; a b @@ -2707,7 +2707,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (uncompress(compress(`a`))) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -2722,7 +2722,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (decode(encode(`a`,'abc'),'abc')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('MySQL',default); select * from t1; a b @@ -2737,7 +2737,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT 'aaa', `b` varchar(1024) GENERATED ALWAYS AS (ifnull(`a`,default(`a`))) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('any value',default); select * from t1; a b @@ -2752,7 +2752,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (inet_ntoa(inet_aton(`a`))) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('127.0.0.1',default); select * from t1; a b @@ -2767,7 +2767,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varbinary(32) GENERATED ALWAYS AS (md5(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('testing',default); select * from t1; a b @@ -2782,7 +2782,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (old_password(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('badpwd',default); select * from t1; a b @@ -2797,7 +2797,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (password(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('badpwd',default); select * from t1; a b @@ -2812,7 +2812,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (sha(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -2827,7 +2827,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (sha(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('abc',default); select * from t1; a b @@ -2842,7 +2842,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(1) DEFAULT NULL, `b` varchar(1024) GENERATED ALWAYS AS (uncompressed_length(compress(repeat(`a`,30)))) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a',default); select * from t1; a b @@ -2857,7 +2857,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` varchar(100) GENERATED ALWAYS AS (monthname(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2010-10-10',default); select * from t1; a b @@ -2872,7 +2872,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` varchar(100) GENERATED ALWAYS AS (dayname(`a`)) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2011-11-11',default); select * from t1; a b @@ -2887,7 +2887,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` varchar(100) GENERATED ALWAYS AS (date_format(`a`,'%W %a %M %b')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2012-12-12',default); select * from t1; a b @@ -2902,7 +2902,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` varchar(100) GENERATED ALWAYS AS (date_format(`a`,'%W %a %M %b','de_DE')) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2012-12-12',default); select * from t1; a b @@ -2917,7 +2917,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(1) DEFAULT NULL, `b` varchar(32) GENERATED ALWAYS AS (current_user()) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('a', default); select * from t1; a b @@ -2932,7 +2932,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (time_format(`a`,'%H.%i.%S')) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2001-01-01 02:03:04',default); select * from t1; a b @@ -2947,7 +2947,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` varchar(10) GENERATED ALWAYS AS (time_format(`a`,'%H.%i.%S')) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci insert into t1 values ('2001-01-01 02:03:04',default); select * from t1; a b diff --git a/mysql-test/suite/vcol/r/vcol_syntax.result b/mysql-test/suite/vcol/r/vcol_syntax.result index 0063f38ea361b..b5f20b19fa4d5 100644 --- a/mysql-test/suite/vcol/r/vcol_syntax.result +++ b/mysql-test/suite/vcol/r/vcol_syntax.result @@ -5,7 +5,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int, b int as (a+1) virtual); show create table t1; @@ -13,7 +13,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; create table t1 (a int, b int generated always as (a+1) persistent); show create table t1; @@ -21,7 +21,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (`a` + 1) STORED -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; set session sql_mode='ORACLE'; create table t1 (a int, b int as (a+1)); @@ -94,6 +94,106 @@ create table t1 (a int, v_a int generated always as (a)); update t1 as x set a = 1; alter table t1 force; drop table t1; +create table t1 ( +id int not null auto_increment primary key, +order_date_time datetime not null, +order_date date generated always as (convert(order_date_time, date)), +language_id binary(16) null +); +update t1 as tx set order_date= null; +alter table t1 modify column language_id binary(16) not null; +drop table t1; # -# End of 10.2 tests +# MDEV-24176 Server crashes after insert in the table with virtual column generated using date_format() and if() # +create table t1 (d1 date not null, d2 date not null, +gd text as (concat(d1,if(d1 <> d2, date_format(d2, 'to %y-%m-%d '), ''))) ); +insert into t1(d1,d2) values +('2020-09-01','2020-09-01'),('2020-05-01','2020-09-01'); +select * from t1; +d1 d2 gd +2020-09-01 2020-09-01 2020-09-01 +2020-05-01 2020-09-01 2020-05-01to 20-09-01 +drop table t1; +# MDEV-25772 (duplicate) and LOCK TABLES case +create table t1 (d1 datetime , v_d1 tinyint(1) as (d1 < curdate())); +insert into t1 (d1) values ('2021-09-11 08:38:23'), ('2021-09-01 08:38:23'); +lock tables t1 write; +select * from t1 where v_d1=1; +d1 v_d1 +2021-09-11 08:38:23 1 +2021-09-01 08:38:23 1 +select * from t1; +d1 v_d1 +2021-09-11 08:38:23 1 +2021-09-01 08:38:23 1 +unlock tables; +drop table t1; +# MDEV-26432 (duplicate) +create table t1 (v2 int, v1 int as ((user() like 'x'))) ; +select 1 from t1 where v1=1 ; +1 +select * from t1; +v2 v1 +drop table t1; +create table t1 (v2 int as ( user () like 'x')); +select 1 from t1 order by v2 ; +1 +alter table t1 add i int; +drop table t1; +# MDEV-26437 (duplicate) +create table v0 (v2 int not null, +v1 bigint as (case 'x' when current_user() then v2 end)); +select v2 as v3 from v0 where v1 like 'x' escape 'x'; +v3 +insert into v0 (v2) values (-128); +drop table v0; +create table t1 (vi int as (case 'x' when current_user() then 1 end)); +select 1 from t1 where vi=1; +1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `vi` int(11) GENERATED ALWAYS AS (case 'x' when current_user() then 1 end) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +create table t1 (vi int as (case 'x' when current_user() then 1 end)); +select 1 from t1 where vi=1; +1 +select 1 from t1 where vi=1; +1 +drop table t1; +# MDEV-28092 (duplicate) +create table t1 (b timestamp, a int as (1 in (dayofmonth (b between 'x' and current_user) = b))); +insert into t1(b) values ('2022-03-17 14:55:37'); +select 1 from t1 x natural join t1; +1 +1 +Warnings: +Warning 1292 Truncated incorrect datetime value: 'x' +Warning 1292 Truncated incorrect datetime value: 'root@localhost' +Warning 1292 Truncated incorrect datetime value: 'x' +Warning 1292 Truncated incorrect datetime value: 'root@localhost' +drop table t1; +# MDEV-28089 (duplicate) +create table t1 (a int , b date as (1 in ('x' ,(database () = 'x' is null) ))) ; +select b from t1; +b +select a from t1 order by 'x' = b; +a +drop table t1; +create table t1 (a int , b date as (1 in ('x' ,(database ()) ))) ; +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'test' +select b from t1; +b +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'test' +select a from t1 order by 'x' = b; +a +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'test' +drop table t1; diff --git a/mysql-test/suite/vcol/r/wrong_arena.result b/mysql-test/suite/vcol/r/wrong_arena.result index cd36801f601b9..99136e7325f10 100644 --- a/mysql-test/suite/vcol/r/wrong_arena.result +++ b/mysql-test/suite/vcol/r/wrong_arena.result @@ -1,3 +1,6 @@ +# +# MDEV-9690 concurrent queries with virtual columns crash in temporal code +# create table t1 (a datetime, # get_datetime_value b int as (a > 1), # Arg_comparator @@ -18,7 +21,7 @@ t1 CREATE TABLE `t1` ( `c` int(11) GENERATED ALWAYS AS (`a` in (1,2,3)) VIRTUAL, `d` int(11) GENERATED ALWAYS AS ((`a`,`a`) in ((1,1),(2,1),(NULL,1))) VIRTUAL, `e` int(11) GENERATED ALWAYS AS ((`a`,1) in ((1,1),(2,1),(NULL,1))) VIRTUAL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Warnings: Warning 1292 Truncated incorrect datetime value: '1' Warning 1292 Truncated incorrect datetime value: '2' @@ -59,6 +62,9 @@ a b Warnings: Warning 1292 Truncated incorrect datetime value: '1' drop table t1; +# +# MDEV-13435 Crash when selecting virtual columns generated using JSON functions +# create table t1 ( id int not null , js varchar(1000) not null, @@ -68,3 +74,16 @@ select * from t1; id js t 0 {"default" : {"start": "00:00:00", "end":"23:59:50"}} NULL drop table t1; +# +# MDEV-26281 ASAN use-after-poison when complex conversion is involved in blob +# +create table t1 (v2 blob as ('a' is null), a1 int, a char(1) as (cast(a1 in (0,current_user() is null) as char(16777216) ))); +insert ignore into t1 values ('x','x',v2) ; +Warnings: +Warning 1906 The value specified for generated column 'v2' in table 't1' has been ignored +Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`a1` at row 1 +Warning 1906 The value specified for generated column 'a' in table 't1' has been ignored +drop table t1; +# +# End of 10.2 tests +# diff --git a/mysql-test/suite/vcol/t/not_supported.test b/mysql-test/suite/vcol/t/not_supported.test index 1ea7970523ac4..d58b207a7ebb6 100644 --- a/mysql-test/suite/vcol/t/not_supported.test +++ b/mysql-test/suite/vcol/t/not_supported.test @@ -39,3 +39,28 @@ select * from t1; select * from t8; drop table t1, t3_ok, t8; + +--echo # +--echo # Bug#33141966 - INCONSISTENT BEHAVIOR IF A COLUMN OF TYPE SERIAL IS SET AS GENERATED +--echo # +--error ER_PARSE_ERROR +create table t1 (a int, b serial as (a+1)); + +--echo # +--echo # End of 10.2 tests +--echo # + +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b real as (rand()), c real as (b) stored); +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b real as (rand()), c real as (b) unique); +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int auto_increment primary key, + b int as (a+1), c int as (b+1) stored); +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int auto_increment primary key, + b int as (a+1), c int as (b+1) unique); + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/suite/vcol/t/vcol_misc.opt b/mysql-test/suite/vcol/t/vcol_misc.opt new file mode 100644 index 0000000000000..fd1faea4f8edb --- /dev/null +++ b/mysql-test/suite/vcol/t/vcol_misc.opt @@ -0,0 +1 @@ +--character-sets-dir=$MYSQL_TEST_DIR/std_data/ldml/ diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test index 6f770190bb149..c3f36d93316d2 100644 --- a/mysql-test/suite/vcol/t/vcol_misc.test +++ b/mysql-test/suite/vcol/t/vcol_misc.test @@ -3,10 +3,6 @@ let $MYSQLD_DATADIR= `select @@datadir`; ---disable_warnings -drop table if exists t1,t2; ---enable_warnings - # # Bug#601164: DELETE/UPDATE with ORDER BY index and LIMIT # @@ -419,11 +415,6 @@ SET sql_mode=DEFAULT; --echo # End of 10.1 tests --echo # - ---echo # ---echo # Start of 10.2 tests ---echo # - --echo # --echo # MDEV-16518 MYSQL57_GENERATED_FIELD: The code in TABLE_SHARE::init_from_binary_frm_image() is not safe --echo # @@ -505,6 +496,35 @@ SELECT * FROM t1; DROP TABLE t1; SET sql_mode=DEFAULT; +--echo # +--echo # CONTEXT_ANALYSIS_ONLY_VCOL_EXPR +--echo # + +--source include/have_ucs2.inc +call mtr.add_suppression("Charset id.*trying to replace"); +create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci, + v1 char(1) character set ucs2 collate ucs2_test_ci as (c1), + v2 int as (c1 = 'b'), + v3 int as (v1 = 'b')); +insert into t1 (c1) values ('a'); +select * from t1 where v1 = 'b'; +show create table t1; +drop table t1; + --echo # --echo # End of 10.2 tests --echo # + +--echo # +--echo # RAND is session func +--echo # +create table t1 (a int, b float default rand(1)); +insert into t1 (a) values (1); +insert into t1 (a) values (2); +insert into t1 (a) values (3); +select * from t1; +drop table t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/suite/vcol/t/vcol_syntax.test b/mysql-test/suite/vcol/t/vcol_syntax.test index 3c8a50a7f366d..198d61a13aab2 100644 --- a/mysql-test/suite/vcol/t/vcol_syntax.test +++ b/mysql-test/suite/vcol/t/vcol_syntax.test @@ -77,7 +77,88 @@ update t1 as x set a = 1; alter table t1 force; drop table t1; +create table t1 ( + id int not null auto_increment primary key, + order_date_time datetime not null, + order_date date generated always as (convert(order_date_time, date)), + language_id binary(16) null +); + +update t1 as tx set order_date= null; +alter table t1 modify column language_id binary(16) not null; +# Cleanup +drop table t1; --echo # ---echo # End of 10.2 tests +--echo # MDEV-24176 Server crashes after insert in the table with virtual column generated using date_format() and if() --echo # +create table t1 (d1 date not null, d2 date not null, + gd text as (concat(d1,if(d1 <> d2, date_format(d2, 'to %y-%m-%d '), ''))) ); + +insert into t1(d1,d2) values + ('2020-09-01','2020-09-01'),('2020-05-01','2020-09-01'); +select * from t1; + +drop table t1; + +--echo # MDEV-25772 (duplicate) and LOCK TABLES case +create table t1 (d1 datetime , v_d1 tinyint(1) as (d1 < curdate())); +insert into t1 (d1) values ('2021-09-11 08:38:23'), ('2021-09-01 08:38:23'); + +lock tables t1 write; +select * from t1 where v_d1=1; +select * from t1; +unlock tables; + +drop table t1; + +--echo # MDEV-26432 (duplicate) +create table t1 (v2 int, v1 int as ((user() like 'x'))) ; +select 1 from t1 where v1=1 ; +select * from t1; + +drop table t1; + +create table t1 (v2 int as ( user () like 'x')); +select 1 from t1 order by v2 ; +alter table t1 add i int; +drop table t1; + +--echo # MDEV-26437 (duplicate) +create table v0 (v2 int not null, + v1 bigint as (case 'x' when current_user() then v2 end)); + +select v2 as v3 from v0 where v1 like 'x' escape 'x'; +insert into v0 (v2) values (-128); + +drop table v0; + +create table t1 (vi int as (case 'x' when current_user() then 1 end)); +select 1 from t1 where vi=1; +show create table t1; + +drop table t1; + +create table t1 (vi int as (case 'x' when current_user() then 1 end)); +select 1 from t1 where vi=1; +select 1 from t1 where vi=1; + +drop table t1; + +--echo # MDEV-28092 (duplicate) +create table t1 (b timestamp, a int as (1 in (dayofmonth (b between 'x' and current_user) = b))); +insert into t1(b) values ('2022-03-17 14:55:37'); + +select 1 from t1 x natural join t1; +drop table t1; + +--echo # MDEV-28089 (duplicate) +create table t1 (a int , b date as (1 in ('x' ,(database () = 'x' is null) ))) ; +select b from t1; +select a from t1 order by 'x' = b; +drop table t1; + +create table t1 (a int , b date as (1 in ('x' ,(database ()) ))) ; +select b from t1; +select a from t1 order by 'x' = b; +drop table t1; diff --git a/mysql-test/suite/vcol/t/wrong_arena.test b/mysql-test/suite/vcol/t/wrong_arena.test index 8ac1af5c36be0..296cb68f5c0c9 100644 --- a/mysql-test/suite/vcol/t/wrong_arena.test +++ b/mysql-test/suite/vcol/t/wrong_arena.test @@ -3,9 +3,9 @@ # not in the TABLE::expr_arena. # -# -# MDEV-9690 concurrent queries with virtual columns crash in temporal code -# +--echo # +--echo # MDEV-9690 concurrent queries with virtual columns crash in temporal code +--echo # create table t1 (a datetime, # get_datetime_value b int as (a > 1), # Arg_comparator @@ -40,9 +40,9 @@ connection default; select * from t1; drop table t1; -# -# MDEV-13435 Crash when selecting virtual columns generated using JSON functions -# +--echo # +--echo # MDEV-13435 Crash when selecting virtual columns generated using JSON functions +--echo # create table t1 ( id int not null , js varchar(1000) not null, @@ -50,3 +50,14 @@ create table t1 ( insert into t1(id,js) values (0, '{"default" : {"start": "00:00:00", "end":"23:59:50"}}'); select * from t1; drop table t1; + +--echo # +--echo # MDEV-26281 ASAN use-after-poison when complex conversion is involved in blob +--echo # +create table t1 (v2 blob as ('a' is null), a1 int, a char(1) as (cast(a1 in (0,current_user() is null) as char(16777216) ))); +insert ignore into t1 values ('x','x',v2) ; +drop table t1; + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/suite/versioning/common.inc b/mysql-test/suite/versioning/common.inc index 25adf15dd5007..0c65720fa1ac2 100644 --- a/mysql-test/suite/versioning/common.inc +++ b/mysql-test/suite/versioning/common.inc @@ -1,9 +1,9 @@ ---disable_query_log if (!$TEST_VERSIONING_SO) { --skip needs test_versioning plugin } source include/have_innodb.inc; +--disable_query_log set @@session.time_zone='+00:00'; select ifnull(max(transaction_id), 0) into @start_trx_id from mysql.transaction_registry; diff --git a/mysql-test/suite/versioning/r/alter.result b/mysql-test/suite/versioning/r/alter.result index 0cdc5945acf77..9751f7c718d13 100644 --- a/mysql-test/suite/versioning/r/alter.result +++ b/mysql-test/suite/versioning/r/alter.result @@ -8,7 +8,7 @@ show create table t; Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t drop system versioning; ERROR HY000: Table `t` is not system-versioned alter table t add system versioning; @@ -16,7 +16,7 @@ show create table t; Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t add column y int; ERROR HY000: Not allowed for system-versioned `test`.`t`. Change @@system_versioning_alter_history to proceed with ALTER. alter table t add primary key (a); @@ -30,7 +30,7 @@ show create table t; Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci set system_versioning_alter_history= keep; alter table t add system versioning; alter table t drop system versioning, drop column row_start; @@ -67,7 +67,7 @@ t CREATE TABLE `t` ( `trx_start` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE, `trx_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE, PERIOD FOR SYSTEM_TIME (`trx_start`, `trx_end`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t drop system versioning; ERROR HY000: Wrong parameters for `t`: missing 'DROP COLUMN `trx_start`' alter table t drop column trx_start, drop column trx_end; @@ -78,7 +78,7 @@ show create table t; Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t add column trx_start timestamp(6) as row start; ERROR HY000: Table `t` is not system-versioned alter table t add system versioning; @@ -86,7 +86,7 @@ show create table t; Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t add column trx_start timestamp(6) as row start; ERROR HY000: Duplicate ROW START column `trx_start` alter table t modify a int as row start; @@ -97,7 +97,7 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t add column c int; show create table t; Table Create Table @@ -105,7 +105,7 @@ t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t add column d int first; show create table t; Table Create Table @@ -114,7 +114,7 @@ t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t add column e int after d; show create table t; Table Create Table @@ -124,7 +124,7 @@ t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t drop column a; show create table t; Table Create Table @@ -133,7 +133,7 @@ t CREATE TABLE `t` ( `e` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create or replace table t ( a int, row_start timestamp(6) as row start invisible, @@ -153,7 +153,7 @@ show create table t; Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t drop column row_start; ERROR 42000: Can't DROP COLUMN `row_start`; check that it exists alter table t drop column row_end; @@ -178,7 +178,7 @@ show create table t; Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING insert into t values(2); select * from t for system_time all; a @@ -210,7 +210,7 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select * from t; a b 3 NULL @@ -230,7 +230,7 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t modify a int with system versioning; ERROR HY000: Table `t` is not system-versioned alter table t modify a int without system versioning; @@ -242,14 +242,14 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t modify a int with system versioning; show create table t; Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create or replace table t( a int ) engine=innodb; @@ -265,14 +265,14 @@ t CREATE TABLE `t` ( `trx_start` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE, `trx_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE, PERIOD FOR SYSTEM_TIME (`trx_start`, `trx_end`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING # Issue #211: drop of system columns required before drop system versioning alter table t drop column trx_start, drop column trx_end; show create table t; Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t drop system versioning; insert into t values(1); call verify_trt; @@ -292,7 +292,7 @@ t CREATE TABLE `t` ( `trx_start` bigint(20) unsigned GENERATED ALWAYS AS ROW START INVISIBLE, `trx_end` bigint(20) unsigned GENERATED ALWAYS AS ROW END INVISIBLE, PERIOD FOR SYSTEM_TIME (`trx_start`, `trx_end`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t drop column trx_start, drop column trx_end; call verify_trt; No A B C D @@ -306,7 +306,7 @@ show create table t; Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING update t set a= 2; select * from t for system_time all; a @@ -318,7 +318,7 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select * from t; a b 2 NULL @@ -329,7 +329,7 @@ show create table t; Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select * from t for system_time all; a 2 @@ -341,7 +341,7 @@ show create table t; Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci call verify_trt; No A B C D create or replace table t (a int); @@ -377,6 +377,11 @@ a b 2 NULL 3 1 4 2 +alter table t add c int, drop system versioning; +select * from t; +a b c +3 1 NULL +4 2 NULL create or replace table t (a int) with system versioning; insert into t values (1), (2), (3); delete from t where a<3; @@ -411,7 +416,7 @@ t CREATE TABLE `t` ( `c` int(11) DEFAULT NULL, PRIMARY KEY (`b`), UNIQUE KEY `c` (`c`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from t; a b c 1 2 3 @@ -462,7 +467,7 @@ show create table t; Table Create Table t CREATE TABLE `t` ( `c` text DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t add fulltext key (c); create or replace table t (a int) with system versioning; alter table t drop column a; @@ -498,7 +503,7 @@ t CREATE TABLE `t` ( `row_start` timestamp(6) GENERATED ALWAYS AS ROW START, `row_end` timestamp(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t drop column row_start, drop column row_end, @@ -508,7 +513,7 @@ show create table t; Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t drop period for system_time; ERROR HY000: Table `t` is not system-versioned create or replace table t ( @@ -572,7 +577,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) GENERATED ALWAYS AS (0) STORED -) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select * from t1; a b 1 0 @@ -588,7 +593,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING -) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select * from t1; a b 1 0 @@ -659,7 +664,7 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING, `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t change column a new_a int, drop system versioning; @@ -668,7 +673,7 @@ Table Create Table t CREATE TABLE `t` ( `new_a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci alter table t add system versioning; alter table t change column new_a a int without system versioning; show create table t; @@ -676,7 +681,7 @@ Table Create Table t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING, `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t add column c int, change column c c int without system versioning, @@ -716,7 +721,7 @@ t1 CREATE TABLE `t1` ( `row_end` timestamp(6) GENERATED ALWAYS AS ROW END, PRIMARY KEY (`b`,`row_end`), PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t1 drop column b; ERROR 42000: Key column 'b' doesn't exist in table create or replace table t1 ( @@ -734,7 +739,7 @@ t1 CREATE TABLE `t1` ( `row_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE, PRIMARY KEY (`b`,`row_end`), PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING alter table t1 drop column b; ERROR 42000: Key column 'b' doesn't exist in table drop table t1; @@ -802,6 +807,6 @@ t1 CREATE TABLE `t1` ( `x` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE, `y` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE, PERIOD FOR SYSTEM_TIME (`x`, `y`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING drop table t1; # End of 10.5 tests diff --git a/mysql-test/suite/versioning/r/create.result b/mysql-test/suite/versioning/r/create.result index cd0551abf98f9..5e68d4df2e82e 100644 --- a/mysql-test/suite/versioning/r/create.result +++ b/mysql-test/suite/versioning/r/create.result @@ -12,7 +12,7 @@ t1 CREATE TABLE `t1` ( `Sys_start` SYS_DATATYPE GENERATED ALWAYS AS ROW START INVISIBLE COMMENT 'start', `Sys_end` SYS_DATATYPE GENERATED ALWAYS AS ROW END INVISIBLE COMMENT 'end', PERIOD FOR SYSTEM_TIME (`Sys_start`, `Sys_end`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select table_catalog,table_schema,table_name,table_type,version,table_rows,data_free,auto_increment,check_time,table_collation,checksum,create_options,table_comment from information_schema.tables where table_name='t1'; table_catalog def table_schema test @@ -81,7 +81,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x2` int(10) unsigned DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create or replace table t1 ( x3 int unsigned, Sys_start timestamp(6) as row start invisible, @@ -173,7 +173,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x15` int(11) DEFAULT NULL, `B` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create or replace table t1 ( x16 int with system versioning, B int @@ -183,7 +183,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x16` int(11) DEFAULT NULL, `B` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create or replace table t1 ( x17 int, B int without system versioning @@ -197,7 +197,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x18` int(11) DEFAULT NULL, `B` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create or replace table t1 ( x19 int with system versioning, B int without system versioning @@ -207,7 +207,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x19` int(11) DEFAULT NULL, `B` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create or replace table t1 ( x20 int with system versioning, B int without system versioning @@ -217,7 +217,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x20` int(11) DEFAULT NULL, `B` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create or replace table t1 ( x21 int without system versioning ); @@ -231,7 +231,7 @@ show create table tt1; Table Create Table tt1 CREATE TABLE `tt1` ( `a` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING drop table tt1; create temporary table tt1 like t1; Warnings: @@ -241,7 +241,7 @@ show create table tt1; Table Create Table tt1 CREATE TEMPORARY TABLE `tt1` ( `a` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # CREATE TABLE ... SELECT create or replace table t1 (x23 int) with system versioning; create or replace table t0( @@ -257,7 +257,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `x23` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ### 2. all visible fields are included create or replace table t3 as select * from t0; select * from t0; @@ -268,7 +268,7 @@ t3 CREATE TABLE `t3` ( `y` int(11) DEFAULT NULL, `st` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', `en` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ## For versioned table insert into t1 values (1); select row_start from t1 into @row_start; @@ -283,7 +283,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `x23` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING #### invisible fields are not copied select * from t2; x23 @@ -298,7 +298,7 @@ t3 CREATE TABLE `t3` ( `y` int(11) DEFAULT NULL, `st` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', `en` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select * from t3 where y > 2; y st en select y from t3 where st = @st and row_start > @st; @@ -317,7 +317,7 @@ t3 CREATE TABLE `t3` ( `st` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE, `en` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE, PERIOD FOR SYSTEM_TIME (`st`, `en`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select y from t3; y 2 @@ -329,7 +329,7 @@ show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `x23` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select * from t3; x23 1 @@ -355,7 +355,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `x23` int(11) DEFAULT NULL, `y` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select * from t3 for system_time all; x23 y 1 3 @@ -387,7 +387,7 @@ t2 CREATE TABLE `t2` ( `x25` int(11) DEFAULT NULL, `row_start` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', `row_end` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t2 with system versioning as select x25, row_start rs, row_end re from t1; show create table t2; @@ -396,7 +396,7 @@ t2 CREATE TABLE `t2` ( `x25` int(11) DEFAULT NULL, `rs` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', `re` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create or replace table t1 ( x26 int, st bigint unsigned as row start, @@ -411,7 +411,7 @@ t2 CREATE TABLE `t2` ( `x26` int(11) DEFAULT NULL, `st` bigint(20) unsigned NOT NULL DEFAULT 0, `en` bigint(20) unsigned NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create or replace table t1 (x27 int, id int) with system versioning engine NON_DEFAULT_ENGINE; create or replace table t2 (b int, id int); create or replace table t3 with system versioning @@ -423,7 +423,7 @@ t3 CREATE TABLE `t3` ( `x27` int(11) DEFAULT NULL, `rs` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', `re` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING ## Errors create or replace temporary table t (x28 int) with system versioning; ERROR HY000: System-versioned tables do not support CREATE TEMPORARY TABLE @@ -462,7 +462,7 @@ t3 CREATE TABLE `t3` ( `row_end` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', `st` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', `en` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t3 ( y int, st timestamp(6) as row start invisible, @@ -480,7 +480,7 @@ t3 CREATE TABLE `t3` ( `st` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE, `en` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE, PERIOD FOR SYSTEM_TIME (`st`, `en`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING # MDEV-14828 Server crashes in JOIN::prepare / setup_fields on 2nd execution of PS [#437] create or replace table t1 (x int) with system versioning; prepare bad from 'create or replace table t2 with system versioning as select * from t1'; @@ -499,13 +499,13 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(1) NOT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create or replace table t1 (i int) with system versioning as select 1 as i; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create or replace table t1 ( a int, row_start bigint as row start, @@ -554,12 +554,12 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING show create table t2; Table Create Table t2 CREATE TEMPORARY TABLE `t2` ( `id` int(11) NOT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop temporary table t2; create or replace table t1 ( a int, @@ -584,12 +584,12 @@ t1 CREATE TABLE `t1` ( KEY `row_end` (`row_end`), KEY `row_end_2` (`row_end`,`row_start`,`a`), PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING show create table t2; Table Create Table t2 CREATE TEMPORARY TABLE `t2` ( `a` int(11) NOT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop temporary table t2; drop table t1; # @@ -609,7 +609,7 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, `x` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING drop table t1; # # MDEV-26928 Column-inclusive WITH SYSTEM VERSIONING doesn't work with explicit system fields @@ -620,7 +620,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING, `y` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create or replace table t1 ( x int, y int with system versioning, row_start timestamp(6) as row start, @@ -631,8 +631,32 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING, `y` int(11) DEFAULT NULL, - `row_start` timestamp(6) GENERATED ALWAYS AS ROW START WITHOUT SYSTEM VERSIONING, - `row_end` timestamp(6) GENERATED ALWAYS AS ROW END WITHOUT SYSTEM VERSIONING, + `row_start` timestamp(6) GENERATED ALWAYS AS ROW START, + `row_end` timestamp(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING drop table t1; +# +# MDEV-27452 TIMESTAMP(0) system field is allowed for certain creation of system-versioned table +# +create or replace table t ( +a int, +s timestamp as row start, +e timestamp as row end, +period for system_time (s, e)) +with system versioning; +ERROR HY000: `s` must be of type TIMESTAMP(6) for system-versioned table `t` +create or replace table t ( +a int with system versioning, +s timestamp as row start, +e timestamp as row end, +period for system_time (s, e)); +ERROR HY000: `s` must be of type TIMESTAMP(6) for system-versioned table `t` +create or replace table t ( +a int with system versioning, +b int with system versioning, +s timestamp(6) as row start, +e timestamp(6) as row end, +period for system_time (s, e)); +insert into t () values (),(); +drop table t; diff --git a/mysql-test/suite/versioning/r/data.result b/mysql-test/suite/versioning/r/data.result index 873f7297ad502..7fea6c3d06e64 100644 --- a/mysql-test/suite/versioning/r/data.result +++ b/mysql-test/suite/versioning/r/data.result @@ -14,7 +14,7 @@ set timestamp=default; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` VALUES (3); @@ -23,7 +23,7 @@ INSERT INTO `t1` VALUES /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` VALUES (1), @@ -31,14 +31,14 @@ INSERT INTO `t1` VALUES (3); #MYSQL_DUMP --compact --as-of="1990-08-02 00:00" --databases test -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; USE `test`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` VALUES (1), @@ -49,11 +49,11 @@ INSERT INTO `t1` VALUES /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` VALUES (2), (3); #MYSQL_DUMP --compact --as-of="1990-08-04 00:00' where 'abc" test 2>&1 -mysqldump: Incorrect DATETIME value: '1990-08-04 00:00' where 'abc' +mariadb-dump: Incorrect DATETIME value: '1990-08-04 00:00' where 'abc' drop tables t1; diff --git a/mysql-test/suite/versioning/r/debug.result b/mysql-test/suite/versioning/r/debug.result index c1c134692a243..3efddd4027548 100644 --- a/mysql-test/suite/versioning/r/debug.result +++ b/mysql-test/suite/versioning/r/debug.result @@ -3,7 +3,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create temporary table tt1 (a int) with system versioning; ERROR HY000: System-versioned tables do not support CREATE TEMPORARY TABLE set @old_dbug=@@global.debug_dbug; @@ -13,26 +13,26 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create temporary table tt2 (a int) with system versioning; show create table tt2; Table Create Table tt2 CREATE TEMPORARY TABLE `tt2` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING connect con1, localhost, root; create table t3 (a int); show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create temporary table tt3 (a int) with system versioning; show create table tt3; Table Create Table tt3 CREATE TEMPORARY TABLE `tt3` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING disconnect con1; connection default; set debug_dbug='+d,sysvers_show'; @@ -40,7 +40,7 @@ show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create table t4 (a int); show create table t4; Table Create Table @@ -49,6 +49,18 @@ t4 CREATE TABLE `t4` ( `row_start` timestamp(6) GENERATED ALWAYS AS ROW START, `row_end` timestamp(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING -set global debug_dbug=@old_dbug; +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING drop table t1, t2, t3, t4; +# +# MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_image() +# +create table t1 (x int) with system versioning; +set debug_dbug='+d,error_vers_wrong_type'; +show create table t1; +ERROR HY000: Incorrect information in file: './test/t1.frm' +show warnings; +Level Code Message +Warning 4110 `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1` +Error 1033 Incorrect information in file: './test/t1.frm' +drop table t1; +set global debug_dbug=@old_dbug; diff --git a/mysql-test/suite/versioning/r/delete.result b/mysql-test/suite/versioning/r/delete.result index 0f9e2c221307f..6f8c89217900e 100644 --- a/mysql-test/suite/versioning/r/delete.result +++ b/mysql-test/suite/versioning/r/delete.result @@ -146,6 +146,5 @@ delete from t1; select f1, f3, check_row_ts(row_start, row_end) from t1 for system_time all; f1 f3 check_row_ts(row_start, row_end) 1 1 HISTORICAL ROW -1 NULL ERROR: row_end == row_start 1 1 HISTORICAL ROW drop table t1; diff --git a/mysql-test/suite/versioning/r/delete_history.result b/mysql-test/suite/versioning/r/delete_history.result index a5a6de19bc6e2..d07c71ee9f5ca 100644 --- a/mysql-test/suite/versioning/r/delete_history.result +++ b/mysql-test/suite/versioning/r/delete_history.result @@ -1,3 +1,5 @@ +set @saved_frequency= @@global.innodb_purge_rseg_truncate_frequency; +set global innodb_purge_rseg_truncate_frequency= 1; call mtr.add_suppression("need more HISTORY partitions"); create table t (a int); delete history from t before system_time now(); @@ -62,10 +64,10 @@ partition by system_time limit 1 partitions 3; insert into t values (1); update t set a= 2; update t set a= 3; -delete history from t; Warnings: Warning 4114 Versioned table `test`.`t`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions -# The above warning is one command late (MDEV-20345) ^^^ +# You see warning above ^ +delete history from t; select * from t for system_time all; a 3 @@ -166,6 +168,8 @@ x explain extended delete history from t1 before system_time '2039-01-01 23:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 1 100.00 Using where +Warnings: +Note 1003 delete from `test`.`t1` FOR SYSTEM_TIME BEFORE TIMESTAMP '2039-01-01 23:00' where `test`.`t1`.`row_end` < '2039-01-01 23:00' and is_history(`test`.`t1`.`row_end`) create or replace procedure p() delete history from t1 before system_time '2039-01-01 23:00'; call p; select * from t1; @@ -187,3 +191,36 @@ x 1 drop prepare stmt; drop table t1; +# +# MDEV-25004 Missing row in FTS_DOC_ID_INDEX during DELETE HISTORY +# +create table t1 (a integer, c0 varchar(255), fulltext key (c0)) +with system versioning engine innodb; +set system_versioning_alter_history= keep; +alter table t1 drop system versioning; +alter table t1 add system versioning; +insert into t1 values (1, 'politician'); +update t1 set c0= 'criminal'; +InnoDB 0 transactions not purged +delete history from t1; +drop table t1; +create table t1 (id int primary key, ftx varchar(255)) +with system versioning engine innodb; +insert into t1 values (1, 'c'); +delete from t1; +alter table t1 add fulltext key(ftx); +drop table t1; +set global innodb_purge_rseg_truncate_frequency= @saved_frequency; +# +# MDEV-28201 Server crashes upon SHOW ANALYZE/EXPLAIN FORMAT=JSON +# +CREATE TABLE t1 (a INT) WITH SYSTEM VERSIONING; +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +SET optimizer_trace= 'enabled=on'; +DELETE HISTORY FROM v1 BEFORE SYSTEM_TIME '2021-01-01'; +ERROR HY000: The target table v1 of the DELETE is not updatable +DELETE HISTORY FROM v1; +ERROR HY000: The target table v1 of the DELETE is not updatable +DROP VIEW v1; +DROP TABLE t1; +# End of 10.4 tests diff --git a/mysql-test/suite/versioning/r/foreign.result b/mysql-test/suite/versioning/r/foreign.result index 3c8508507fd5a..b17deba1c1e69 100644 --- a/mysql-test/suite/versioning/r/foreign.result +++ b/mysql-test/suite/versioning/r/foreign.result @@ -445,6 +445,43 @@ pk f1 f2 left(f3, 4) check_row_ts(row_start, row_end) 1 8 8 SHOR HISTORICAL ROW 2 8 8 LONG HISTORICAL ROW drop table t1; +# Shorter case for clustered index (MDEV-25004) +create table t1 ( +y int primary key, r int, f int, key (r), +foreign key (f) references t1 (r) on delete set null) +with system versioning engine innodb; +insert into t1 values (1, 6, 6), (2, 6, 6); +delete from t1; +select *, check_row_ts(row_start, row_end) from t1 for system_time all; +y r f check_row_ts(row_start, row_end) +1 6 6 HISTORICAL ROW +2 6 6 HISTORICAL ROW +drop tables t1; +# Secondary unique index +create table t1 ( +y int unique null, r int, f int, key (r), +foreign key (f) references t1 (r) on delete set null) +with system versioning engine innodb; +insert into t1 values (1, 6, 6), (2, 6, 6); +delete from t1; +select *, check_row_ts(row_start, row_end) from t1 for system_time all; +y r f check_row_ts(row_start, row_end) +1 6 6 HISTORICAL ROW +2 6 6 HISTORICAL ROW +drop tables t1; +# Non-unique index cannot be fixed because it does not trigger duplicate error +create table t1 ( +y int, r int, f int, key (y), key (r), +foreign key (f) references t1 (r) on delete set null) +with system versioning engine innodb; +insert into t1 values (1, 6, 6), (2, 6, 6); +delete from t1; +select *, check_row_ts(row_start, row_end) from t1 for system_time all; +y r f check_row_ts(row_start, row_end) +1 6 6 HISTORICAL ROW +2 6 NULL ERROR: row_end == row_start +2 6 6 HISTORICAL ROW +drop tables t1; # # MDEV-21555 Assertion secondary index is out of sync on delete from versioned table # @@ -459,11 +496,48 @@ delete history from t1; delete from t1; drop table t1; # +# MDEV-30378 Versioned REPLACE succeeds with ON DELETE RESTRICT +# constraint +# +create table t0 (pk integer primary key) with system versioning engine=innodb; +create table t1 (pk integer primary key, +foreign key(pk) references t0(pk) +on delete restrict on update cascade) engine=innodb; +create table t2 (pk integer); +insert into t0 (pk) values (1); +insert into t1 (pk) values (1); +insert into t2 (pk) values (1); +delete from t0; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pk`) REFERENCES `t0` (`pk`) ON UPDATE CASCADE) +replace t0 values (1); +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pk`) REFERENCES `t0` (`pk`) ON UPDATE CASCADE) +select * into outfile 'load_t0' from t0 ; +load data infile 'load_t0' replace into table t0; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pk`) REFERENCES `t0` (`pk`) ON UPDATE CASCADE) +delete t0, t2 from t0 join t2; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pk`) REFERENCES `t0` (`pk`) ON UPDATE CASCADE) +select pk from t0; +pk +1 +# Cleanup +drop table t1, t0, t2; +# create_select for a temporary table didn't set up pos_in_locked_tables. +create table t (a int unique) engine=innodb +replace select 1 as a, 2 as b union select 1 as a, 3 as c; +select * from t; +a b +1 3 +drop table t; +create temporary table t (a int unique) engine=innodb +replace select 1 as a, 2 as b union select 1 as a, 3 as c; +select * from t; +a b +1 3 +drop table t; +# # MDEV-20729 Fix REFERENCES constraint in column definition # -create or replace table t1( -id int -); +create table t1(id int); # system fields can't be foreign keys: create or replace table t2( x int, @@ -496,3 +570,4 @@ foreign key (sys_end) references t1(id) ) engine innodb with system versioning; ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") drop table t1; +# End of 10.5 tests diff --git a/mysql-test/suite/versioning/r/misc.result b/mysql-test/suite/versioning/r/misc.result new file mode 100644 index 0000000000000..398e3b8be701a --- /dev/null +++ b/mysql-test/suite/versioning/r/misc.result @@ -0,0 +1,27 @@ +set time_zone='+00:00'; +# +# MDEV-29750 triggers can modify history +# +set sql_mode='', timestamp=unix_timestamp('2010-10-10 10:10:10'); +create table t (a int, b int as (a+1), s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning; +insert into t values (1,1, '2022-01-01','2023-01-01'),(2,2, '2022-02-02','2023-02-02'); +Warnings: +Warning 1906 The value specified for generated column 'b' in table 't' has been ignored +Warning 1906 The value specified for generated column 's' in table 't' has been ignored +Warning 1906 The value specified for generated column 'e' in table 't' has been ignored +Warning 1906 The value specified for generated column 'b' in table 't' has been ignored +Warning 1906 The value specified for generated column 's' in table 't' has been ignored +Warning 1906 The value specified for generated column 'e' in table 't' has been ignored +create trigger tr before insert on t for each row set new.b=1, new.s = '2022-03-03', new.e = '2023-03-03'; +insert into t (a) values (3),(4); +select * from t for system_time all; +a b s e +1 2 2010-10-10 10:10:10.000000 2038-01-19 03:14:07.999999 +2 3 2010-10-10 10:10:10.000000 2038-01-19 03:14:07.999999 +3 4 2010-10-10 10:10:10.000000 2038-01-19 03:14:07.999999 +4 5 2010-10-10 10:10:10.000000 2038-01-19 03:14:07.999999 +drop table t; +set sql_mode=default, timestamp=default; +# +# End of 10.3 tests +# diff --git a/mysql-test/suite/versioning/r/not_embedded.result b/mysql-test/suite/versioning/r/not_embedded.result new file mode 100644 index 0000000000000..b8972a483709b --- /dev/null +++ b/mysql-test/suite/versioning/r/not_embedded.result @@ -0,0 +1,72 @@ +# +# SYSTEM_VERSIONING_ASOF sysvar +# +create table t (a int) with system versioning; +set @before= UNIX_TIMESTAMP(now(6)); +insert into t values (1); +set @after= UNIX_TIMESTAMP(now(6)); +update t set a= 2; +set global system_versioning_asof= FROM_UNIXTIME(@after); +set system_versioning_asof= FROM_UNIXTIME(@after); +select * from t as nonempty; +a +1 +connect subcon,127.0.0.1,root,,,$SERVER_MYPORT_1; +connection subcon; +select * from t as nonempty; +a +1 +disconnect subcon; +connection default; +set global system_versioning_asof= FROM_UNIXTIME(@before); +select * from t as nonempty; +a +1 +connect subcon,127.0.0.1,root,,,$SERVER_MYPORT_1; +connection subcon; +select * from t as empty; +a +disconnect subcon; +connection default; +drop table t; +set global system_versioning_asof= DEFAULT; +set system_versioning_asof= DEFAULT; +# +# DELETE HISTORY and privileges +# +connect root,localhost,root,,test; +connection root; +create database mysqltest; +create user mysqltest_1@localhost; +connect user1,localhost,mysqltest_1,,test; +connection user1; +connection root; +create table mysqltest.t (a int) with system versioning; +connection user1; +show grants; +Grants for mysqltest_1@localhost +GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` +delete history from mysqltest.t before system_time now(); +ERROR 42000: DELETE HISTORY command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`t` +connection root; +grant delete history on mysqltest.* to mysqltest_1@localhost; +grant delete history on mysqltest.t to mysqltest_1@localhost; +connection user1; +show grants; +Grants for mysqltest_1@localhost +GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` +GRANT DELETE HISTORY ON `mysqltest`.* TO `mysqltest_1`@`localhost` +GRANT DELETE HISTORY ON `mysqltest`.`t` TO `mysqltest_1`@`localhost` +delete history from mysqltest.t before system_time now(); +connection root; +grant all on *.* to mysqltest_1@localhost; +show grants for mysqltest_1@localhost; +Grants for mysqltest_1@localhost +GRANT ALL PRIVILEGES ON *.* TO `mysqltest_1`@`localhost` +GRANT DELETE HISTORY ON `mysqltest`.* TO `mysqltest_1`@`localhost` +GRANT DELETE HISTORY ON `mysqltest`.`t` TO `mysqltest_1`@`localhost` +drop user mysqltest_1@localhost; +drop database mysqltest; +disconnect user1; +disconnect root; +connection default; diff --git a/mysql-test/suite/versioning/r/online.result b/mysql-test/suite/versioning/r/online.result index 62d6291342846..b247ce49e1822 100644 --- a/mysql-test/suite/versioning/r/online.result +++ b/mysql-test/suite/versioning/r/online.result @@ -107,7 +107,7 @@ t CREATE TABLE `t` ( `row_start` SYS_DATATYPE GENERATED ALWAYS AS ROW START INVISIBLE, `row_end` SYS_DATATYPE GENERATED ALWAYS AS ROW END INVISIBLE, PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select count(*) from t for system_time all; count(*) 1 diff --git a/mysql-test/suite/versioning/r/optimized.result b/mysql-test/suite/versioning/r/optimized.result index 2385a43d0a4eb..b14d8a0487637 100644 --- a/mysql-test/suite/versioning/r/optimized.result +++ b/mysql-test/suite/versioning/r/optimized.result @@ -71,5 +71,5 @@ Table Create Table t CREATE TABLE `t` ( `x` int(11) DEFAULT NULL, `y` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING -) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING drop table t; diff --git a/mysql-test/suite/versioning/r/partition,heap.rdiff b/mysql-test/suite/versioning/r/partition,heap.rdiff index f7b534bb114ea..361a74a4271b3 100644 --- a/mysql-test/suite/versioning/r/partition,heap.rdiff +++ b/mysql-test/suite/versioning/r/partition,heap.rdiff @@ -1,6 +1,4 @@ ---- partition.result -+++ partition,heap.reject -@@ -1545,82 +1545,3 @@ +@@ -1969,85 +1969,6 @@ (PARTITION `p0` HISTORY ENGINE = X, PARTITION `pn` CURRENT ENGINE = X) drop tables t1, tp1; @@ -35,7 +33,7 @@ - `x` int(11) NOT NULL AUTO_INCREMENT, - `t` timestamp(6) NOT NULL DEFAULT '2001-11-11 11:11:11.000000', - `b` blob /*!100301 COMPRESSED*/ DEFAULT NULL, -- `c` varchar(1033) CHARACTER SET utf8mb3 NOT NULL, +- `c` varchar(1033) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `u` int(11) DEFAULT NULL, - `m` enum('a','b','c') NOT NULL DEFAULT 'a' COMMENT 'absolute', - `i1` tinyint(4) DEFAULT NULL, @@ -53,14 +51,14 @@ - KEY `three` (`i1`,`i2`,`i3`), - PERIOD FOR SYSTEM_TIME (`s`, `e`), - CONSTRAINT `check_constr` CHECK (`u` > -1) --) ENGINE=X DEFAULT CHARSET=ucs2 WITH SYSTEM VERSIONING +-) ENGINE=X DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `x` int(11) NOT NULL AUTO_INCREMENT, - `t` timestamp(6) NOT NULL DEFAULT '2001-11-11 11:11:11.000000', - `b` blob /*!100301 COMPRESSED*/ DEFAULT NULL, -- `c` varchar(1033) CHARACTER SET utf8mb3 NOT NULL, +- `c` varchar(1033) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `u` int(11) DEFAULT NULL, - `m` enum('a','b','c') NOT NULL DEFAULT 'a' COMMENT 'absolute', - `i1` tinyint(4) DEFAULT NULL, @@ -78,8 +76,11 @@ - KEY `three` (`i1`,`i2`,`i3`), - PERIOD FOR SYSTEM_TIME (`s`, `e`), - CONSTRAINT `check_constr` CHECK (`u` > -1) --) ENGINE=X DEFAULT CHARSET=ucs2 WITH SYSTEM VERSIONING +-) ENGINE=X DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING - PARTITION BY RANGE (`x`) -(PARTITION `p0` VALUES LESS THAN (10) ENGINE = X, - PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X) -drop tables t1, tp1; + # + # End of 10.7 tests + # diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index 210b194d4e93c..6feee27818b1c 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -1,5 +1,5 @@ -SET @save_persistent=@@GLOBAL.innodb_stats_persistent; -SET GLOBAL innodb_stats_persistent=0; +set @save_persistent=@@global.innodb_stats_persistent; +set global innodb_stats_persistent= 0; call mtr.add_suppression("need more HISTORY partitions"); set system_versioning_alter_history=keep; # Check conventional partitioning on temporal tables @@ -96,6 +96,16 @@ with system versioning partition by system_time ( partition p0 history, partition pn current); +create or replace table t1 (a int) +partition by range (a) ( +partition p0 history, +partition p1 current); +ERROR HY000: Wrong partition type `SYSTEM_TIME` for partitioning by `RANGE` +create or replace table t1 (b int) +partition by range (a) ( +partition p0 current, +partition p1 history); +ERROR HY000: Wrong partition type `SYSTEM_TIME` for partitioning by `RANGE` ## ALTER TABLE alter table t1 add partition ( partition p1 current); @@ -108,7 +118,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME (PARTITION `p0` HISTORY ENGINE = DEFAULT_ENGINE, PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, @@ -132,7 +142,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME (PARTITION `custom_name` HISTORY ENGINE = DEFAULT_ENGINE, PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) @@ -150,7 +160,7 @@ partition by system_time limit 1; alter table t1 change x big int; create or replace table t1 (i int) engine myisam partition by hash(i) partitions 2; alter table t1 add partition (partition px history); -ERROR HY000: Wrong partitioning type, expected type: `SYSTEM_TIME` +ERROR HY000: Wrong partition type `SYSTEM_TIME` for partitioning by `HASH` ## INSERT, UPDATE, DELETE create or replace table t1 (x int) with system versioning @@ -249,7 +259,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME LIMIT 2 PARTITIONS 3 alter table t1 drop partition non_existent; @@ -265,6 +275,9 @@ x 6 delete from t1 where x < 4; delete from t1; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions +# You see warning above ^ select * from t1 partition (p0); x 1 @@ -276,12 +289,11 @@ x 5 6 insert into t1 values (7), (8); -Warnings: -Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions ### warn about full partition delete from t1; Warnings: Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions +# You see warning above ^ select * from t1 partition (p1) order by x; x 4 @@ -426,7 +438,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'2000-01-01 00:00:00' PARTITIONS 2 # Test STARTS warning @@ -437,7 +449,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'2000-01-01 00:00:00' PARTITIONS 2 create or replace table t1 (i int) with system versioning @@ -452,7 +464,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 SECOND STARTS TIMESTAMP'1999-12-15 13:33:33' PARTITIONS 2 create or replace table t1 (i int) with system versioning @@ -461,7 +473,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 MINUTE STARTS TIMESTAMP'1999-12-15 13:33:00' PARTITIONS 2 create or replace table t1 (i int) with system versioning @@ -470,7 +482,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'1999-12-15 13:00:00' PARTITIONS 2 create or replace table t1 (i int) with system versioning @@ -479,7 +491,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'1999-12-15 00:00:00' PARTITIONS 2 create or replace table t1 (i int) with system versioning @@ -488,7 +500,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 MONTH STARTS TIMESTAMP'1999-12-15 00:00:00' PARTITIONS 2 create or replace table t1 (i int) with system versioning @@ -497,7 +509,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 YEAR STARTS TIMESTAMP'1999-12-15 00:00:00' PARTITIONS 2 # seconds equivalent of 1 day does not round: @@ -507,7 +519,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 86400 SECOND STARTS TIMESTAMP'1999-12-15 13:33:33' PARTITIONS 2 # STARTS value is in local time_zone: @@ -523,14 +535,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'2000-01-01 00:00:00' PARTITIONS 2 show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `i` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'2000-01-01 00:00:00' PARTITIONS 2 set time_zone="+00:00"; @@ -538,14 +550,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'1999-12-31 21:00:00' PARTITIONS 2 show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `i` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'1999-12-31 21:00:00' PARTITIONS 2 # Test rotation @@ -637,9 +649,13 @@ x ### warn about full partition delete from t1 where x < 3; delete from t1; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions +# You see warning above ^ delete from t1; Warnings: Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions +# You see warning above ^ (no matter if nothing was deleted) select * from t1 partition (p0sp0); x 1 @@ -815,7 +831,11 @@ partition p1 history, partition p2 history, partition pn current); delete from t1 where x = 1; +# You see warning above ^ delete from t1 where x = 2; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p2`) is out of LIMIT, need more HISTORY partitions +# You see warning above ^ # # MDEV-14923 Assertion upon INSERT into locked versioned partitioned table # @@ -908,12 +928,24 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `pk` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 7 SECOND STARTS TIMESTAMP'2018-04-11 17:00:04' (PARTITION `ver_p1` HISTORY ENGINE = DEFAULT_ENGINE, PARTITION `ver_pn` CURRENT ENGINE = DEFAULT_ENGINE) set timestamp= default; # +# MDEV-18794 Assertion `!m_innodb' failed in ha_partition::cmp_ref upon SELECT from partitioned table +# +create or replace table t1 (pk int auto_increment, i int, c char(1), primary key (pk), key(i)) +engine=innodb with system versioning partition by key() partitions 2; +insert into t1 (i, c) values (1, 'a'), (2, 'b'), (null, 'c'), (null, 'b'); +alter table t1 drop system versioning; +replace into t1 select * from t1; +select * from t1 where i > 0 or pk = 1000 limit 1; +pk i c +1 1 a +drop table t1; +# # MDEV-19175 Server crashes in ha_partition::vers_can_native upon INSERT DELAYED into versioned partitioned table # create or replace table t1 (f int) with system versioning partition by hash(f); @@ -926,9 +958,13 @@ create or replace table t1 (x int) with system versioning partition by system_ti lock tables t1 write; insert into t1 values (0), (1), (2), (3); delete from t1 where x < 3; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions +# You see warning above ^ delete from t1; Warnings: Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions +# You see warning above ^ unlock tables; # # MDEV-20336 Assertion bitmap_is_set(read_partitions) upon SELECT FOR UPDATE from versioned table @@ -944,7 +980,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME PARTITIONS 2 # 2 partitions are created: p0 and pn @@ -957,7 +993,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME LIMIT 10 PARTITIONS 4 # 4 partitions are created: p0, p1, p2 and pn @@ -1052,6 +1088,7 @@ create or replace table t1 (f char(6)) engine innodb with system versioning; insert into t1 values (null); update t1 set f= 'foo'; update t1 set f= 'bar'; +# You see warning above ^ create or replace view v1 as select * from t1 for system_time all; update v1 set f = ''; ERROR HY000: Table 't1' was locked with a READ lock and can't be updated @@ -1061,6 +1098,8 @@ partition by system_time limit 1 insert into t1 values (null); update t1 set f= 'foo'; update t1 set f= 'bar'; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p2`) is out of LIMIT, need more HISTORY partitions create or replace view v1 as select * from t1 for system_time all; update v1 set f= ''; ERROR HY000: Table 't1' was locked with a READ lock and can't be updated @@ -1076,7 +1115,7 @@ drop table t1; create table t1 (a int) with system versioning partition by system_time (partition p1 history, partition pn current); alter table t1 add partition (partition p2); -ERROR HY000: Wrong partitioning type, expected type: `SYSTEM_TIME` +ERROR HY000: Wrong partition type `HASH` for partitioning by `SYSTEM_TIME` # MDEV-17891 Assertion failures in select_insert::abort_result_set and # mysql_load upon attempt to replace into a full table set @@max_heap_table_size= 1024*1024; @@ -1150,8 +1189,469 @@ alter table t1 add x serial; alter table t1 add partition (partition p1 history); alter table t1 add partition (partition p2 history); drop table t1; +# +# MDEV-27217 DELETE partition selection doesn't work for history partitions +# +create table t1 (f char) with system versioning +partition by system_time limit 10 ( +partition p0 history, +partition p1 history, +partition p2 history, +partition pn current); +delete from t1 partition (p1); +ERROR HY000: Not allowed for system-versioned table `test`.`t1` +delete from t1 partition (p0, pn); +ERROR HY000: Not allowed for system-versioned table `test`.`t1` +delete from t1 partition (p0, p1); +ERROR HY000: Not allowed for system-versioned table `test`.`t1` +delete from t1 partition (p0, p1, pn); +ERROR HY000: Not allowed for system-versioned table `test`.`t1` +drop table t1; +set timestamp=unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (i int) with system versioning +partition by system_time interval 1 day ( +partition p0 history, +partition p1 history, +partition pn current); +set timestamp=unix_timestamp('2000-01-02 00:00:00'); +insert t1 values (1); +delete from t1 partition (p0, pn); +ERROR HY000: Not allowed for system-versioned table `test`.`t1` +delete from t1 partition (p0, p1, pn); +ERROR HY000: Not allowed for system-versioned table `test`.`t1` +drop table t1; +set timestamp= default; +# +# MDEV-25546 LIMIT partitioning does not respect ROLLBACK +# +create or replace table t1 (pk int primary key) +with system versioning engine innodb +partition by system_time limit 100 ( +partition p0 history, +partition p1 history, +partition pn current); +insert into t1 select seq from seq_1_to_90; +start transaction; +replace into t1 select seq from seq_1_to_80; +replace into t1 select seq from seq_1_to_70; +replace into t1 select seq from seq_1_to_60; +select partition_name, table_rows +from information_schema.partitions +where table_name = 't1'; +partition_name table_rows +p0 150 +p1 60 +pn 90 +rollback; +select partition_name, table_rows +from information_schema.partitions +where table_name = 't1'; +partition_name table_rows +p0 0 +p1 0 +pn 90 +replace into t1 select seq from seq_1_to_10; +select partition_name, table_rows +from information_schema.partitions +where table_name = 't1'; +partition_name table_rows +p0 10 +p1 0 +pn 90 +drop table t1; +# +# MDEV-28271 Assertion on TRUNCATE PARTITION for PARTITION BY SYSTEM_TIME +# +create table t1 (x int) with system versioning +partition by system_time limit 1 ( +partition p0 history, +partition p1 history, +partition p2 history, # p2 just disables warning about p1 partition full +partition pn current); +insert into t1 values (0); +update t1 set x= x + 1; +update t1 set x= x + 1; +select * from t1 partition (p0); +x +0 +select * from t1 partition (p1); +x +1 +select * from t1 partition (pn); +x +2 +delete from t1; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p2`) is out of LIMIT, need more HISTORY partitions +delete history from t1; +select * from t1 partition (p0); +x +select * from t1 partition (p1); +x +select * from t1 partition (pn); +x +insert into t1 values (0); +update t1 set x= x + 1; +update t1 set x= x + 1; +# TRUNCATE PARTITION ALL does the same +alter table t1 truncate partition all; +select * from t1 partition (p0); +x +select * from t1 partition (p1); +x +select * from t1 partition (pn); +x +insert into t1 values (0); +update t1 set x= x + 1; +update t1 set x= x + 1; +# TRUNCATE PARTITION deletes data from HISTORY partition +alter table t1 truncate partition p1; +select * from t1 partition (p0); +x +0 +select * from t1 partition (p1); +x +select * from t1 partition (pn); +x +2 +# or from CURRENT partition +alter table t1 truncate partition pn; +select * from t1 partition (p0); +x +0 +select * from t1 partition (p1); +x +select * from t1 partition (pn); +x +drop table t1; +# +# MDEV-20077 Warning on full history partition is delayed until next DML statement +# +# DELETE +create table t1 (x int) with system versioning +partition by system_time limit 100 ( +partition p0 history, +partition p1 history, +partition pn current); +insert into t1 select seq from seq_0_to_200; +# p0 is filled with 100 records (no warnings): +delete from t1 where x <= 99; +# p1 is filled with 1 + 100 records (warning is printed): +delete from t1 where x <= 100; +delete from t1; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions +# You see warning above ^ +select count(*) from t1 partition (p0); +count(*) +100 +select count(*) from t1 partition (p1); +count(*) +101 +drop table t1; +# DELETE under LOCK TABLES +create table t1 (x int) with system versioning +partition by system_time limit 100 ( +partition p0 history, +partition p1 history, +partition pn current); +insert into t1 select seq from seq_0_to_200; +lock tables t1 write; +# (LOCK TABLES) p0 is filled with 100 records (no warnings): +delete from t1 where x <= 99; +# (LOCK TABLES) p1 is filled with 1 + 100 records (warning is printed): +delete from t1 where x <= 100; +delete from t1; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions +# You see warning above ^ +unlock tables; +select count(*) from t1 partition (p0); +count(*) +100 +select count(*) from t1 partition (p1); +count(*) +101 +drop table t1; +# DELETE multitable +create table t1 (x int) with system versioning +partition by system_time limit 100 ( +partition p0 history, +partition p1 history, +partition pn current); +create table t2 (y int); +insert into t1 select seq from seq_0_to_200; +insert into t2 select seq from seq_0_to_3; +delete t1, t2 from t1 join t2 where x < 50 and y = 0; +delete t1, t2 from t1 join t2 where x < 100 and y = 1; +delete t1, t2 from t1 join t2 where x < 150 and y = 2; +delete t1, t2 from t1 join t2; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions +# You see warning above ^ +select count(*) from t1 partition (p0); +count(*) +100 +select count(*) from t1 partition (p1); +count(*) +101 +drop table t1; +# UDPATE +create table t1 (x int) with system versioning +partition by system_time limit 100 ( +partition p0 history, +partition p1 history, +partition pn current); +insert into t1 select seq from seq_0_to_49; +update t1 set x= x + 1; +update t1 set x= x + 1; +update t1 set x= x + 1; +update t1 set x= x + 1; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions +# You see warning above ^ +select count(*) from t1 partition (p0); +count(*) +100 +select count(*) from t1 partition (p1); +count(*) +100 +drop tables t1, t2; +# UPDATE multitable +create table t1 (x int) with system versioning +partition by system_time limit 100 ( +partition p0 history, +partition p1 history, +partition pn current); +create table t2 (y int); +insert into t1 select seq from seq_0_to_49; +insert into t2 values (5); +update t1, t2 set x= x + 1; +update t1, t2 set x= x + 1; +update t1, t2 set x= x + 1; +update t1, t2 set x= x + 1; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions +# You see warning above ^ +select count(*) from t1 partition (p0); +count(*) +100 +select count(*) from t1 partition (p1); +count(*) +100 +drop tables t1, t2; +# INSERT .. ON DUPLICATE KEY UPDATE (ODKU) +create table t1 (x int primary key) with system versioning +partition by system_time limit 100 ( +partition p0 history, +partition p1 history, +partition pn current); +insert into t1 select seq from seq_0_to_100; +delete from t1 where x <= 99; +insert into t1 values (100) on duplicate key update x= 400; +select count(*) from t1 partition (p0); +count(*) +100 +select count(*) from t1 partition (p1); +count(*) +1 +drop table t1; +# INSERT .. SELECT .. ON DUPLICATE KEY UPDATE (ODKU) +create table t1 (x int primary key) with system versioning +partition by system_time limit 100 ( +partition p0 history, +partition p1 history, +partition pn current); +create table t2 (y int); +insert into t2 values (100); +insert into t1 select seq from seq_0_to_100; +delete from t1 where x <= 99; +insert into t1 select * from t2 on duplicate key update x= 500; +select count(*) from t1 partition (p0); +count(*) +100 +select count(*) from t1 partition (p1); +count(*) +1 +drop tables t1, t2; +# REPLACE +create table t1 (x int primary key) with system versioning +partition by system_time limit 100 ( +partition p0 history, +partition p1 history, +partition pn current); +insert into t1 select seq from seq_0_to_100; +delete from t1 where x < 99; +replace t1 values (100); +replace t1 values (100); +select count(*) from t1 partition (p0); +count(*) +100 +select count(*) from t1 partition (p1); +count(*) +1 +drop table t1; +# LOAD DATA .. REPLACE +create table t1 (x int primary key) with system versioning +partition by system_time limit 100 ( +partition p0 history, +partition p1 history, +partition pn current); +insert into t1 select seq from seq_0_to_49; +select x into outfile 'MDEV-20077.data' from t1; +load data infile 'MDEV-20077.data' replace into table t1 (x); +load data infile 'MDEV-20077.data' replace into table t1 (x); +load data infile 'MDEV-20077.data' replace into table t1 (x); +load data infile 'MDEV-20077.data' replace into table t1 (x); +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions +# You see warning above ^ +select count(*) from t1 partition (p0); +count(*) +100 +select count(*) from t1 partition (p1); +count(*) +100 +drop table t1; +# REPLACE .. SELECT +create table t1 (x int primary key) with system versioning +partition by system_time limit 100 ( +partition p0 history, +partition p1 history, +partition pn current); +insert into t1 select seq from seq_0_to_49; +replace t1 select * from t1; +replace t1 select * from t1; +replace t1 select * from t1; +replace t1 select * from t1; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions +# You see warning above ^ +select count(*) from t1 partition (p0); +count(*) +100 +select count(*) from t1 partition (p1); +count(*) +100 +drop table t1; +# +# MDEV-28552 Assertion `inited==RND' failed in handler::ha_rnd_end +# +create table tcount (c int unsigned); +insert into tcount values (0); +create table t (f int) with system versioning +partition by system_time limit 1000 +(partition p1 history, partition pn current); +insert into t values (1),(2); +create trigger tr before insert on t for each row update tcount set c = c + 1; +insert into t select * from t; +drop table tcount, t; +# +# MDEV-19569 Assertion `table_list->table' failed in find_field_in_table_ref and Assertion `table_ref->table || table_ref->view' in Field_iterator_table_ref::set_field_iterator +# +set timestamp=unix_timestamp('2000-01-01 00:00:00'); +create table t1 (i int); +create table t2 (i int); +alter table t1 partition by system_time +interval (select i from t2) day (partition p1 history, partition pn current); +ERROR 42000: INTERVAL does not support subqueries or stored functions +drop table t1; +create table t1 (id int) with system versioning +partition by system_time +interval (select i from t2) day (partition p1 history, partition pn current); +ERROR 42000: INTERVAL does not support subqueries or stored functions +create table t1 (id int) with system versioning +partition by system_time +interval "hello" day (partition p1 history, partition pn current); +ERROR HY000: Wrong parameters for partitioned `t1`: wrong value for 'INTERVAL' +create table t1 (id int) with system versioning +partition by system_time +interval 3.893 day (partition p1 history, partition pn current); +drop table t1, t2; +create table t1 (id int) with system versioning +partition by system_time interval "3-11" year_month (partition p1 history, partition pn current); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL '3-11' YEAR_MONTH STARTS TIMESTAMP'2000-01-01 00:00:00' +(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +drop table t1; +create table t1 (id int) with system versioning +partition by system_time interval "3 11" day_hour (partition p1 history, partition pn current); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL '3 11' DAY_HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' +(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +drop table t1; +create table t1 (id int) with system versioning +partition by system_time interval "3 11:12" day_minute (partition p1 history, partition pn current); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL '3 11:12' DAY_MINUTE STARTS TIMESTAMP'2000-01-01 00:00:00' +(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +drop table t1; +create table t1 (id int) with system versioning +partition by system_time interval "3 11:12:13" day_second (partition p1 history, partition pn current); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL '3 11:12:13' DAY_SECOND STARTS TIMESTAMP'2000-01-01 00:00:00' +(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +drop table t1; +create table t1 (id int) with system versioning +partition by system_time interval "11:12" hour_minute (partition p1 history, partition pn current); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL '11:12' HOUR_MINUTE STARTS TIMESTAMP'2000-01-01 00:00:00' +(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +drop table t1; +create table t1 (id int) with system versioning +partition by system_time interval "11:12:13" hour_second (partition p1 history, partition pn current); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL '11:12:13' HOUR_SECOND STARTS TIMESTAMP'2000-01-01 00:00:00' +(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +drop table t1; +create table t1 (id int) with system versioning +partition by system_time interval "12:13" minute_second (partition p1 history, partition pn current); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL '12:13' MINUTE_SECOND STARTS TIMESTAMP'2000-01-01 00:00:00' +(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +drop table t1; +create table t1 (id int) with system versioning +partition by system_time interval "12:13.123" minute_microsecond (partition p1 history, partition pn current); +ERROR HY000: Wrong parameters for partitioned `t1`: wrong value for 'INTERVAL' +# # End of 10.3 tests # +# # MDEV-22283 Server crashes in key_copy or unexpected error 156: The table already existed in the storage engine # create table t1 (a int primary key) engine=aria page_checksum=0 @@ -1183,8 +1683,10 @@ select * from t1 where i > 0 or pk = 1000 limit 1; pk i c 1 1 a drop table t1; +# # End of 10.4 tests # +# # MDEV-22153 ALTER add default history partitions makes table inaccessible # create or replace table t1 (x int) with system versioning partition by system_time; @@ -1195,7 +1697,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME PARTITIONS 3 alter table t1 add partition partitions 2; @@ -1205,7 +1707,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME PARTITIONS 5 alter table t1 add partition partitions 3; @@ -1215,7 +1717,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME PARTITIONS 8 drop tables t1; @@ -1229,7 +1731,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME LIMIT 1 (PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE, @@ -1239,7 +1741,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME LIMIT 1 (PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE, @@ -1259,7 +1761,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME LIMIT 1 (PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE, PARTITION `p8` HISTORY ENGINE = DEFAULT_ENGINE, @@ -1272,7 +1774,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME LIMIT 1 (PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE, PARTITION `p8` HISTORY ENGINE = DEFAULT_ENGINE, @@ -1292,8 +1794,6 @@ drop tables t1; # # End of 10.5 tests # -SET GLOBAL innodb_stats_persistent=@save_persistent; -# End of 10.6 tests # # MDEV-22166 MIGRATE PARTITION: move out partition into a table # @@ -1313,7 +1813,7 @@ show create table tp2; Table Create Table tp2 CREATE TABLE `tp2` ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select * from tp2; x 13 @@ -1325,7 +1825,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = X, PARTITION `p3` VALUES LESS THAN (30) ENGINE = X, @@ -1359,7 +1859,7 @@ show create table tp3; Table Create Table tp3 CREATE TABLE `tp3` ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select * from tp3; x 23 @@ -1367,7 +1867,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = X, PARTITION `p4` VALUES LESS THAN (40) ENGINE = X, @@ -1396,7 +1896,7 @@ show create table tp4; Table Create Table tp4 CREATE TABLE `tp4` ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select * from tp4; x 33 @@ -1404,7 +1904,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY RANGE (`x`) (PARTITION `p1` VALUES LESS THAN (10) ENGINE = X, PARTITION `p5` VALUES LESS THAN (50) ENGINE = X, @@ -1437,6 +1937,8 @@ insert into t1 values (2), (12), (22); update t1 set x= x + 1 where x = 2; update t1 set x= x + 1 where x = 12; update t1 set x= x + 1 where x = 22; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p2`) is out of LIMIT, need more HISTORY partitions select * from t1 partition (p1); x 12 @@ -1450,7 +1952,7 @@ tp1 CREATE TABLE `tp1` ( `row_start` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE, `row_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE, PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) -) ENGINE=X DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select * from tp1; x select * from tp1 for system_time all; @@ -1463,7 +1965,7 @@ t1 CREATE TABLE `t1` ( `row_start` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE, `row_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE, PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) -) ENGINE=X DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME LIMIT 1 (PARTITION `p0` HISTORY ENGINE = X, PARTITION `p2` HISTORY ENGINE = X, @@ -1519,7 +2021,7 @@ tp0 CREATE TABLE `tp0` ( `row_start` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE, `row_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE, PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) -) ENGINE=X DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING show create table tp1; Table Create Table tp1 CREATE TABLE `tp1` ( @@ -1527,7 +2029,7 @@ tp1 CREATE TABLE `tp1` ( `row_start` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE, `row_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE, PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) -) ENGINE=X DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select * from tp0; x select * from tp1; @@ -1545,7 +2047,7 @@ t1 CREATE TABLE `t1` ( `row_start` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE, `row_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE, PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) -) ENGINE=X DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 02:00:00' (PARTITION `p2` HISTORY ENGINE = X, PARTITION `pn` CURRENT ENGINE = X) @@ -1569,12 +2071,12 @@ show create table tp1; Table Create Table tp1 CREATE TABLE `tp1` ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL -) ENGINE=X DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME LIMIT 1 (PARTITION `p0` HISTORY ENGINE = X, PARTITION `pn` CURRENT ENGINE = X) @@ -1610,7 +2112,7 @@ tp1 CREATE TABLE `tp1` ( `x` int(11) NOT NULL AUTO_INCREMENT, `t` timestamp(6) NOT NULL DEFAULT '2001-11-11 11:11:11.000000', `b` blob /*!100301 COMPRESSED*/ DEFAULT NULL, - `c` varchar(1033) CHARACTER SET utf8mb3 NOT NULL, + `c` varchar(1033) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `u` int(11) DEFAULT NULL, `m` enum('a','b','c') NOT NULL DEFAULT 'a' COMMENT 'absolute', `i1` tinyint(4) DEFAULT NULL, @@ -1628,14 +2130,14 @@ tp1 CREATE TABLE `tp1` ( KEY `three` (`i1`,`i2`,`i3`), PERIOD FOR SYSTEM_TIME (`s`, `e`), CONSTRAINT `check_constr` CHECK (`u` > -1) -) ENGINE=X DEFAULT CHARSET=ucs2 WITH SYSTEM VERSIONING +) ENGINE=X DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) NOT NULL AUTO_INCREMENT, `t` timestamp(6) NOT NULL DEFAULT '2001-11-11 11:11:11.000000', `b` blob /*!100301 COMPRESSED*/ DEFAULT NULL, - `c` varchar(1033) CHARACTER SET utf8mb3 NOT NULL, + `c` varchar(1033) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `u` int(11) DEFAULT NULL, `m` enum('a','b','c') NOT NULL DEFAULT 'a' COMMENT 'absolute', `i1` tinyint(4) DEFAULT NULL, @@ -1653,8 +2155,21 @@ t1 CREATE TABLE `t1` ( KEY `three` (`i1`,`i2`,`i3`), PERIOD FOR SYSTEM_TIME (`s`, `e`), CONSTRAINT `check_constr` CHECK (`u` > -1) -) ENGINE=X DEFAULT CHARSET=ucs2 WITH SYSTEM VERSIONING +) ENGINE=X DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING PARTITION BY RANGE (`x`) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = X, PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X) drop tables t1, tp1; +# +# MDEV-29841 Partition by system_time can be converted into table but not back +# +create or replace table t (a int) with system versioning +partition by system_time limit 10 partitions 3; +alter table t convert partition p0 to table tp; +alter table t convert table tp to partition p0; +ERROR HY000: CONVERT TABLE TO PARTITION can only be used on RANGE/LIST partitions +drop tables t, tp; +# +# End of 10.7 tests +# +set global innodb_stats_persistent= @save_persistent; diff --git a/mysql-test/suite/versioning/r/rpl.result b/mysql-test/suite/versioning/r/rpl.result index 627f399149967..17372c63e99d7 100644 --- a/mysql-test/suite/versioning/r/rpl.result +++ b/mysql-test/suite/versioning/r/rpl.result @@ -128,7 +128,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING ## Case 2: ERROR on the master, it'll fail on the master, the slave won't see it connection master; set system_versioning_alter_history= ERROR; @@ -140,7 +140,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING ## Case 3: table is not versioned on the master, ALTER will work on the slave connection master; create or replace table t1 (a int); @@ -154,7 +154,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING connection master; drop table t1, t2; create table t1 (i int) with system versioning partition by system_time limit 8 ( partition p1 history, partition p2 history, partition pn current ); @@ -164,4 +164,28 @@ update t1 set i = 0; connection slave; connection master; drop table t1; +# check versioned -> versioned replication without any keys on duplicate records +connection master; +create table t1 (a INT) with system versioning; +insert into t1 values (1); +insert into t1 values (1); +delete from t1; +connection slave; +include/diff_tables.inc [master:test.t1,slave:test.t1] +connection master; +drop table t1; +connection slave; +# check unversioned -> versioned replication with non-unique keys on duplicate records +connection master; +set statement sql_log_bin=0 for create table t1 (a INT NOT NULL, b INT, INDEX(a,b)); +connection slave; +set statement sql_log_bin=0 for create table t1 (a INT NOT NULL, b INT, INDEX(a,b)) with system versioning; +connection master; +insert into t1 values (1,1); +insert into t1 values (1,1); +delete from t1; +connection slave; +include/diff_tables.inc [master:test.t1,slave:test.t1] +connection master; +drop table t1; include/rpl_end.inc diff --git a/mysql-test/suite/versioning/r/rpl_row.result b/mysql-test/suite/versioning/r/rpl_row.result index 03ac8dc9eb806..89c3ce2103350 100644 --- a/mysql-test/suite/versioning/r/rpl_row.result +++ b/mysql-test/suite/versioning/r/rpl_row.result @@ -11,4 +11,42 @@ connection slave; connection master; drop table t1; set binlog_row_image= @old_row_image; +# +# MDEV-28254 Wrong position for row_start, row_end after adding column +# to implicit versioned table +# +set @@system_versioning_alter_history= keep; +set @@session.time_zone='+00:00'; +create table t1 (x int) with system versioning engine innodb; +alter table t1 add column y int, algorithm=inplace; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +connection slave; +drop table t1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL, + `y` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING +connection master; +set timestamp= 12345; +insert t1 values (1, 1); +select *, unix_timestamp(row_start) as row_start, unix_timestamp(row_end) as row_end from t1; +x y row_start row_end +1 1 12345.000000 2147483647.999999 +set timestamp= default; +### INSERT INTO `test`.`t1` +### SET +### @1=1 +### @2=1 +### @3=12345.000000 +### @4=2147483647.999999 +connection slave; +select * from t1; +x y +1 1 +connection master; +drop table t1; include/rpl_end.inc diff --git a/mysql-test/suite/versioning/r/sysvars-notembedded.result b/mysql-test/suite/versioning/r/sysvars-notembedded.result deleted file mode 100644 index 8b1ad6cfc5854..0000000000000 --- a/mysql-test/suite/versioning/r/sysvars-notembedded.result +++ /dev/null @@ -1,30 +0,0 @@ -create table t (a int) with system versioning; -set @before= UNIX_TIMESTAMP(now(6)); -insert into t values (1); -set @after= UNIX_TIMESTAMP(now(6)); -update t set a= 2; -set global system_versioning_asof= FROM_UNIXTIME(@after); -set system_versioning_asof= FROM_UNIXTIME(@after); -select * from t as nonempty; -a -1 -connect subcon,127.0.0.1,root,,,$SERVER_MYPORT_1; -connection subcon; -select * from t as nonempty; -a -1 -disconnect subcon; -connection default; -set global system_versioning_asof= FROM_UNIXTIME(@before); -select * from t as nonempty; -a -1 -connect subcon,127.0.0.1,root,,,$SERVER_MYPORT_1; -connection subcon; -select * from t as empty; -a -disconnect subcon; -connection default; -drop table t; -set global system_versioning_asof= DEFAULT; -set system_versioning_asof= DEFAULT; diff --git a/mysql-test/suite/versioning/r/truncate_privilege.result b/mysql-test/suite/versioning/r/truncate_privilege.result deleted file mode 100644 index e2b48c494be6b..0000000000000 --- a/mysql-test/suite/versioning/r/truncate_privilege.result +++ /dev/null @@ -1,33 +0,0 @@ -connect root,localhost,root,,test; -connection root; -create database mysqltest; -create user mysqltest_1@localhost; -connect user1,localhost,mysqltest_1,,test; -connection user1; -connection root; -create table mysqltest.t (a int) with system versioning; -connection user1; -show grants; -Grants for mysqltest_1@localhost -GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` -delete history from mysqltest.t before system_time now(); -ERROR 42000: DELETE HISTORY command denied to user 'mysqltest_1'@'localhost' for table 't' -connection root; -grant delete history on mysqltest.* to mysqltest_1@localhost; -grant delete history on mysqltest.t to mysqltest_1@localhost; -connection user1; -show grants; -Grants for mysqltest_1@localhost -GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` -GRANT DELETE HISTORY ON `mysqltest`.* TO `mysqltest_1`@`localhost` -GRANT DELETE HISTORY ON `mysqltest`.`t` TO `mysqltest_1`@`localhost` -delete history from mysqltest.t before system_time now(); -connection root; -grant all on *.* to mysqltest_1@localhost; -show grants for mysqltest_1@localhost; -Grants for mysqltest_1@localhost -GRANT ALL PRIVILEGES ON *.* TO `mysqltest_1`@`localhost` -GRANT DELETE HISTORY ON `mysqltest`.* TO `mysqltest_1`@`localhost` -GRANT DELETE HISTORY ON `mysqltest`.`t` TO `mysqltest_1`@`localhost` -drop user mysqltest_1@localhost; -drop database mysqltest; diff --git a/mysql-test/suite/versioning/r/trx_id.result b/mysql-test/suite/versioning/r/trx_id.result index 1b59fc8b3fc11..9beec414fbba4 100644 --- a/mysql-test/suite/versioning/r/trx_id.result +++ b/mysql-test/suite/versioning/r/trx_id.result @@ -182,7 +182,78 @@ select x, row_start < row_end from t1 for system_time all; x row_start < row_end 4 1 2 1 +# +# MDEV-15951 system versioning by trx id doesn't work with partitioning +# currently trx_id does not support partitioning by system_time +# +create or replace table t1( +i int, +row_start bigint unsigned generated always as row start, +row_end bigint unsigned generated always as row end, +period for system_time(row_start, row_end) +) engine=InnoDB with system versioning partition by system_time ( +partition p0 history, +partition pn current +); +ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1` +create or replace table t1( +i int, +row_start bigint unsigned generated always as row start, +row_end bigint unsigned generated always as row end, +period for system_time(row_start, row_end) +) engine=InnoDB with system versioning; +alter table t1 partition by system_time ( +partition p0 history, +partition pn current +); +ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1` +drop table t1; +create or replace table t ( +a int primary key, +row_start bigint unsigned as row start invisible, +row_end bigint unsigned as row end invisible, +period for system_time(row_start, row_end) +) engine=innodb with system versioning +partition by key() ( +partition p1, +partition p2 +); +ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END +create or replace table t ( +a int primary key, +row_start bigint unsigned as row start invisible, +row_end bigint unsigned as row end invisible, +period for system_time(row_start, row_end) +) engine=innodb with system versioning +partition by key(a, row_start) ( +partition p1, +partition p2 +); +ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END +create or replace table t ( +a int primary key, +row_start bigint unsigned as row start invisible, +row_end bigint unsigned as row end invisible, +period for system_time(row_start, row_end) +) engine=innodb with system versioning +partition by hash(a + row_end * 2) ( +partition p1, +partition p2 +); +ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END +create or replace table t ( +a int primary key, +row_start bigint unsigned as row start invisible, +row_end bigint unsigned as row end invisible, +period for system_time(row_start, row_end) +) engine=innodb with system versioning +partition by range columns (a, row_start) ( +partition p1 values less than (100, 100) +); +ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END +# # MDEV-16010 Too many rows with AS OF point_in_the_past_or_NULL +# create or replace table t1 ( x int, row_start bigint unsigned as row start invisible, @@ -449,7 +520,7 @@ t CREATE TABLE `t` ( `row_end` bigint(20) unsigned GENERATED ALWAYS AS ROW END INVISIBLE, PRIMARY KEY (`a`,`row_end`), PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING # handles VIRTUAL columns too CREATE OR REPLACE TABLE t ( a INT AS (b + 1), @@ -512,3 +583,31 @@ drop table t; uninstall plugin test_versioning; select trt_begin_ts(0); ERROR 42000: FUNCTION test.trt_begin_ts does not exist +# +# MDEV-21650 Non-empty statement transaction on global rollback after TRT update error +# +create table t1 (s date, e date, period for app(s,e)) engine=innodb; +alter table t1 +add row_start bigint unsigned as row start, +add row_end bigint unsigned as row end, +add period for system_time(row_start,row_end), +with system versioning, +add period if not exists for app(x,y); +Warnings: +Note 1060 Duplicate column name 'app' +set transaction isolation level serializable; +start transaction; +insert into t1 (s,e) values ('2021-07-04','2024-08-18'); +connect con1,localhost,root,,test; +start transaction; +insert into t1 (s,e) values ('2018-06-01','2021-09-15'); +connection default; +select * from t1 for system_time as of now(); +ERROR HY000: TRX_ID ... not found in `mysql.transaction_registry` +connection con1; +set innodb_lock_wait_timeout= 1, lock_wait_timeout= 1; +alter table xx; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +disconnect con1; +connection default; +drop table t1; diff --git a/mysql-test/suite/versioning/r/update.result b/mysql-test/suite/versioning/r/update.result index 410589698017b..f6a36ec9ce156 100644 --- a/mysql-test/suite/versioning/r/update.result +++ b/mysql-test/suite/versioning/r/update.result @@ -283,6 +283,7 @@ connection default; update t1 set b = 'foo'; connection con1; update t1 set a = 'bar'; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction disconnect con1; connection default; drop table t1; @@ -399,8 +400,30 @@ a check_row(row_start, row_end) 1 CURRENT ROW drop tables t1, t2, t3; # +# MDEV-26778 row_start is not updated in current row for InnoDB +# +create or replace table t1 (x int) with system versioning; +insert t1 values (1); +update t1 set x= 1; +select row_start into @r from t1; +select check_row_ts(row_start, row_end) from t1 for system_time all where row_start = @r; +check_row_ts(row_start, row_end) +CURRENT ROW +drop table t1; +# +# MDEV-22973 Assertion in compare_record upon multi-update involving versioned table via view +# +create or replace table t1 (a int, primary key (a)) engine=myisam; +insert into t1 values (0); +create or replace table t2 (pk int, b int, primary key (pk), key(b)) engine=innodb with system versioning; +insert into t2 values (1, 0), (2, 0); +create or replace view v as select a, b from t1, t2; +update v set b= null where a = 0 order by b; +drop view v; +drop table t1, t2; +# # MDEV-24522 Assertion `inited==NONE' fails upon UPDATE on versioned table with unique blob - +# create table t1 (a int, b int, c text, unique(c), key (b)) engine=myisam with system versioning; insert into t1 values (1, 1, 'foo'), (2, 11, 'bar'); update t1 set a = 3 where b <= 9; @@ -414,3 +437,4 @@ update t1 set a = 3 where b <= 9; update t2 set a = 3 where b <= 9; update t1, t2 set t1.a = 3, t2.a = 3 where t1.b <= 10 and t2.b <= 10 and t1.b = t2.b; drop tables t1, t2; +# End of 10.4 tests diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test index 76185afd523be..61653550389d7 100644 --- a/mysql-test/suite/versioning/t/alter.test +++ b/mysql-test/suite/versioning/t/alter.test @@ -266,6 +266,8 @@ select * from t; select * from t for system_time all; insert into t values (4, 0); select * from t for system_time all; +alter table t add c int, drop system versioning; +select * from t; create or replace table t (a int) with system versioning; insert into t values (1), (2), (3); diff --git a/mysql-test/suite/versioning/t/create.test b/mysql-test/suite/versioning/t/create.test index f79d38d029b7f..6f5153b4ec179 100644 --- a/mysql-test/suite/versioning/t/create.test +++ b/mysql-test/suite/versioning/t/create.test @@ -471,3 +471,32 @@ create or replace table t1 ( show create table t1; drop table t1; + +--echo # +--echo # MDEV-27452 TIMESTAMP(0) system field is allowed for certain creation of system-versioned table +--echo # +--error ER_VERS_FIELD_WRONG_TYPE +create or replace table t ( + a int, + s timestamp as row start, + e timestamp as row end, + period for system_time (s, e)) +with system versioning; + +--error ER_VERS_FIELD_WRONG_TYPE +create or replace table t ( + a int with system versioning, + s timestamp as row start, + e timestamp as row end, + period for system_time (s, e)); + +create or replace table t ( + a int with system versioning, + b int with system versioning, + s timestamp(6) as row start, + e timestamp(6) as row end, + period for system_time (s, e)); +insert into t () values (),(); + +# cleanup +drop table t; diff --git a/mysql-test/suite/versioning/t/data.test b/mysql-test/suite/versioning/t/data.test index 4046ec609dd23..ddae66333379f 100644 --- a/mysql-test/suite/versioning/t/data.test +++ b/mysql-test/suite/versioning/t/data.test @@ -23,7 +23,7 @@ set timestamp=default; --exec $MYSQL_DUMP --compact --as-of="1990-08-04 00:00" test t1 ## Forged query protection --echo #MYSQL_DUMP --compact --as-of="1990-08-04 00:00' where 'abc" test 2>&1 ---replace_result mysqldump.exe mysqldump +--replace_result mariadb-dump.exe mariadb-dump --error 1 --exec $MYSQL_DUMP --compact --as-of="1990-08-04 00:00' where 'abc" test 2>&1 diff --git a/mysql-test/suite/versioning/t/debug.test b/mysql-test/suite/versioning/t/debug.test index 5069d7f6002fa..be58b67546d3d 100644 --- a/mysql-test/suite/versioning/t/debug.test +++ b/mysql-test/suite/versioning/t/debug.test @@ -1,5 +1,7 @@ --source include/have_debug.inc +--let $datadir=`select @@datadir` + create table t1 (a int); show create table t1; @@ -30,6 +32,18 @@ set debug_dbug='+d,sysvers_show'; show create table t3; create table t4 (a int); show create table t4; +drop table t1, t2, t3, t4; + +--echo # +--echo # MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_image() +--echo # +create table t1 (x int) with system versioning; +set debug_dbug='+d,error_vers_wrong_type'; +--replace_result $datadir ./ +--error ER_NOT_FORM_FILE +show create table t1; +--replace_result $datadir ./ +show warnings; +drop table t1; set global debug_dbug=@old_dbug; -drop table t1, t2, t3, t4; diff --git a/mysql-test/suite/versioning/t/delete_history.test b/mysql-test/suite/versioning/t/delete_history.test index e3b6001164421..042670bcfecf3 100644 --- a/mysql-test/suite/versioning/t/delete_history.test +++ b/mysql-test/suite/versioning/t/delete_history.test @@ -2,6 +2,9 @@ --source include/have_partition.inc --source suite/versioning/engines.inc +set @saved_frequency= @@global.innodb_purge_rseg_truncate_frequency; +set global innodb_purge_rseg_truncate_frequency= 1; + call mtr.add_suppression("need more HISTORY partitions"); create table t (a int); @@ -63,8 +66,8 @@ partition by system_time limit 1 partitions 3; insert into t values (1); update t set a= 2; update t set a= 3; +--echo # You see warning above ^ delete history from t; ---echo # The above warning is one command late (MDEV-20345) ^^^ select * from t for system_time all; --echo # VIEW @@ -191,4 +194,42 @@ select * from t1; drop prepare stmt; drop table t1; +--echo # +--echo # MDEV-25004 Missing row in FTS_DOC_ID_INDEX during DELETE HISTORY +--echo # +create table t1 (a integer, c0 varchar(255), fulltext key (c0)) +with system versioning engine innodb; +set system_versioning_alter_history= keep; +alter table t1 drop system versioning; +alter table t1 add system versioning; +insert into t1 values (1, 'politician'); +update t1 set c0= 'criminal'; +--source suite/innodb/include/wait_all_purged.inc +delete history from t1; +drop table t1; + +create table t1 (id int primary key, ftx varchar(255)) +with system versioning engine innodb; +insert into t1 values (1, 'c'); +delete from t1; +alter table t1 add fulltext key(ftx); +drop table t1; + +set global innodb_purge_rseg_truncate_frequency= @saved_frequency; + +--echo # +--echo # MDEV-28201 Server crashes upon SHOW ANALYZE/EXPLAIN FORMAT=JSON +--echo # +CREATE TABLE t1 (a INT) WITH SYSTEM VERSIONING; +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +SET optimizer_trace= 'enabled=on'; +--error ER_NON_UPDATABLE_TABLE +DELETE HISTORY FROM v1 BEFORE SYSTEM_TIME '2021-01-01'; +--error ER_NON_UPDATABLE_TABLE +DELETE HISTORY FROM v1; +DROP VIEW v1; +DROP TABLE t1; + +--echo # End of 10.4 tests + --source suite/versioning/common_finish.inc diff --git a/mysql-test/suite/versioning/t/foreign.test b/mysql-test/suite/versioning/t/foreign.test index 934053f83ba70..c94cff540c655 100644 --- a/mysql-test/suite/versioning/t/foreign.test +++ b/mysql-test/suite/versioning/t/foreign.test @@ -478,6 +478,39 @@ select pk, f1, f2, left(f3, 4), check_row_ts(row_start, row_end) from t1 for sys # cleanup drop table t1; +--echo # Shorter case for clustered index (MDEV-25004) +create table t1 ( + y int primary key, r int, f int, key (r), + foreign key (f) references t1 (r) on delete set null) +with system versioning engine innodb; + +insert into t1 values (1, 6, 6), (2, 6, 6); +delete from t1; +select *, check_row_ts(row_start, row_end) from t1 for system_time all; +drop tables t1; + +--echo # Secondary unique index +create table t1 ( + y int unique null, r int, f int, key (r), + foreign key (f) references t1 (r) on delete set null) +with system versioning engine innodb; + +insert into t1 values (1, 6, 6), (2, 6, 6); +delete from t1; +select *, check_row_ts(row_start, row_end) from t1 for system_time all; +drop tables t1; + +--echo # Non-unique index cannot be fixed because it does not trigger duplicate error +create table t1 ( + y int, r int, f int, key (y), key (r), + foreign key (f) references t1 (r) on delete set null) +with system versioning engine innodb; + +insert into t1 values (1, 6, 6), (2, 6, 6); +delete from t1; +select *, check_row_ts(row_start, row_end) from t1 for system_time all; +drop tables t1; + --echo # --echo # MDEV-21555 Assertion secondary index is out of sync on delete from versioned table --echo # @@ -496,12 +529,56 @@ delete from t1; # cleanup drop table t1; +--echo # +--echo # MDEV-30378 Versioned REPLACE succeeds with ON DELETE RESTRICT +--echo # constraint +--echo # +create table t0 (pk integer primary key) with system versioning engine=innodb; +create table t1 (pk integer primary key, + foreign key(pk) references t0(pk) + on delete restrict on update cascade) engine=innodb; +create table t2 (pk integer); + +insert into t0 (pk) values (1); +insert into t1 (pk) values (1); +insert into t2 (pk) values (1); + +--error ER_ROW_IS_REFERENCED_2 +delete from t0; + +--error ER_ROW_IS_REFERENCED_2 +replace t0 values (1); + +select * into outfile 'load_t0' from t0 ; +--error ER_ROW_IS_REFERENCED_2 +load data infile 'load_t0' replace into table t0; + +--error ER_ROW_IS_REFERENCED_2 +delete t0, t2 from t0 join t2; + +select pk from t0; + +--echo # Cleanup +drop table t1, t0, t2; +--let $datadir= `select @@datadir` +--remove_file $datadir/test/load_t0 + + +--echo # create_select for a temporary table didn't set up pos_in_locked_tables. +create table t (a int unique) engine=innodb + replace select 1 as a, 2 as b union select 1 as a, 3 as c; +select * from t; +drop table t; + +create temporary table t (a int unique) engine=innodb + replace select 1 as a, 2 as b union select 1 as a, 3 as c; +select * from t; +drop table t; + --echo # --echo # MDEV-20729 Fix REFERENCES constraint in column definition --echo # -create or replace table t1( - id int -); +create table t1(id int); --echo # system fields can't be foreign keys: --replace_result $sys_datatype_expl SYS_DATATYPE --error ER_PARSE_ERROR,ER_PARSE_ERROR @@ -539,4 +616,6 @@ eval create or replace table t2( ) engine innodb with system versioning; drop table t1; +--echo # End of 10.5 tests + --source suite/versioning/common_finish.inc diff --git a/mysql-test/suite/versioning/t/misc.test b/mysql-test/suite/versioning/t/misc.test new file mode 100644 index 0000000000000..dce1e0deced9d --- /dev/null +++ b/mysql-test/suite/versioning/t/misc.test @@ -0,0 +1,20 @@ +# +# simple tests that don't need to be run in multiple various combinations +# +set time_zone='+00:00'; + +--echo # +--echo # MDEV-29750 triggers can modify history +--echo # +set sql_mode='', timestamp=unix_timestamp('2010-10-10 10:10:10'); +create table t (a int, b int as (a+1), s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning; +insert into t values (1,1, '2022-01-01','2023-01-01'),(2,2, '2022-02-02','2023-02-02'); +create trigger tr before insert on t for each row set new.b=1, new.s = '2022-03-03', new.e = '2023-03-03'; +insert into t (a) values (3),(4); +select * from t for system_time all; +drop table t; +set sql_mode=default, timestamp=default; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/suite/versioning/t/not_embedded.test b/mysql-test/suite/versioning/t/not_embedded.test new file mode 100644 index 0000000000000..2afae013e7052 --- /dev/null +++ b/mysql-test/suite/versioning/t/not_embedded.test @@ -0,0 +1,79 @@ +--source include/not_embedded.inc +--source include/have_innodb.inc + +--echo # +--echo # SYSTEM_VERSIONING_ASOF sysvar +--echo # +create table t (a int) with system versioning; +set @before= UNIX_TIMESTAMP(now(6)); +insert into t values (1); +set @after= UNIX_TIMESTAMP(now(6)); +update t set a= 2; + +set global system_versioning_asof= FROM_UNIXTIME(@after); +set system_versioning_asof= FROM_UNIXTIME(@after); +select * from t as nonempty; + +--connect (subcon,127.0.0.1,root,,,$SERVER_MYPORT_1) +--connection subcon +select * from t as nonempty; +--disconnect subcon +--connection default + +set global system_versioning_asof= FROM_UNIXTIME(@before); +select * from t as nonempty; + +--connect (subcon,127.0.0.1,root,,,$SERVER_MYPORT_1) +--connection subcon +select * from t as empty; +--disconnect subcon +--connection default + +drop table t; + +set global system_versioning_asof= DEFAULT; +set system_versioning_asof= DEFAULT; + +--echo # +--echo # DELETE HISTORY and privileges +--echo # + +# Save the initial number of concurrent sessions +--source include/count_sessions.inc + +connect (root,localhost,root,,test); +connection root; + +--disable_warnings +create database mysqltest; +--enable_warnings + +create user mysqltest_1@localhost; +connect (user1,localhost,mysqltest_1,,test); +connection user1; + +connection root; +create table mysqltest.t (a int) with system versioning; + +connection user1; +show grants; +--error ER_TABLEACCESS_DENIED_ERROR +delete history from mysqltest.t before system_time now(); + +connection root; +grant delete history on mysqltest.* to mysqltest_1@localhost; +grant delete history on mysqltest.t to mysqltest_1@localhost; + +connection user1; +show grants; +delete history from mysqltest.t before system_time now(); + +connection root; +grant all on *.* to mysqltest_1@localhost; +show grants for mysqltest_1@localhost; + +drop user mysqltest_1@localhost; +drop database mysqltest; +--disconnect user1 +--disconnect root +--connection default diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index 9aae8412d6532..29de10e47389c 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -1,9 +1,10 @@ -- source include/have_partition.inc -- source suite/versioning/common.inc -- source suite/versioning/engines.inc +-- source include/have_sequence.inc -SET @save_persistent=@@GLOBAL.innodb_stats_persistent; -SET GLOBAL innodb_stats_persistent=0; +set @save_persistent=@@global.innodb_stats_persistent; +set global innodb_stats_persistent= 0; call mtr.add_suppression("need more HISTORY partitions"); @@ -105,6 +106,18 @@ partition by system_time ( partition p0 history, partition pn current); +--error ER_PARTITION_WRONG_TYPE +create or replace table t1 (a int) +partition by range (a) ( + partition p0 history, + partition p1 current); + +--error ER_PARTITION_WRONG_TYPE +create or replace table t1 (b int) +partition by range (a) ( + partition p0 current, + partition p1 history); + --echo ## ALTER TABLE @@ -238,12 +251,14 @@ insert into t1 values (1), (2), (3), (4), (5), (6); select * from t1 partition (pn); delete from t1 where x < 4; delete from t1; +--echo # You see warning above ^ select * from t1 partition (p0); select * from t1 partition (p1); insert into t1 values (7), (8); --echo ### warn about full partition delete from t1; +--echo # You see warning above ^ select * from t1 partition (p1) order by x; @@ -499,7 +514,9 @@ select * from t1 partition (pnsp1); --echo ### warn about full partition delete from t1 where x < 3; delete from t1; +--echo # You see warning above ^ delete from t1; +--echo # You see warning above ^ (no matter if nothing was deleted) select * from t1 partition (p0sp0); select * from t1 partition (p0sp1); select * from t1 partition (p1sp0); @@ -675,7 +692,9 @@ alter table t1 partition by system_time limit 1 ( partition p2 history, partition pn current); delete from t1 where x = 1; +--echo # You see warning above ^ delete from t1 where x = 2; +--echo # You see warning above ^ --echo # --echo # MDEV-14923 Assertion upon INSERT into locked versioned partitioned table @@ -776,6 +795,17 @@ partition by system_time interval column_get(column_create(7,7), 7 as int) secon show create table t1; set timestamp= default; +--echo # +--echo # MDEV-18794 Assertion `!m_innodb' failed in ha_partition::cmp_ref upon SELECT from partitioned table +--echo # +create or replace table t1 (pk int auto_increment, i int, c char(1), primary key (pk), key(i)) +engine=innodb with system versioning partition by key() partitions 2; +insert into t1 (i, c) values (1, 'a'), (2, 'b'), (null, 'c'), (null, 'b'); +alter table t1 drop system versioning; +replace into t1 select * from t1; +select * from t1 where i > 0 or pk = 1000 limit 1; +drop table t1; + --echo # --echo # MDEV-19175 Server crashes in ha_partition::vers_can_native upon INSERT DELAYED into versioned partitioned table --echo # @@ -792,7 +822,9 @@ create or replace table t1 (x int) with system versioning partition by system_ti lock tables t1 write; insert into t1 values (0), (1), (2), (3); delete from t1 where x < 3; +--echo # You see warning above ^ delete from t1; +--echo # You see warning above ^ unlock tables; --echo # @@ -907,6 +939,7 @@ create or replace table t1 (f char(6)) engine innodb with system versioning; insert into t1 values (null); update t1 set f= 'foo'; update t1 set f= 'bar'; +--echo # You see warning above ^ create or replace view v1 as select * from t1 for system_time all; --error ER_TABLE_NOT_LOCKED_FOR_WRITE @@ -1029,7 +1062,421 @@ alter table t1 add partition (partition p1 history); alter table t1 add partition (partition p2 history); drop table t1; +--echo # +--echo # MDEV-27217 DELETE partition selection doesn't work for history partitions +--echo # +create table t1 (f char) with system versioning +partition by system_time limit 10 ( + partition p0 history, + partition p1 history, + partition p2 history, + partition pn current); + +--error ER_VERS_NOT_ALLOWED +delete from t1 partition (p1); +--error ER_VERS_NOT_ALLOWED +delete from t1 partition (p0, pn); +--error ER_VERS_NOT_ALLOWED +delete from t1 partition (p0, p1); +--error ER_VERS_NOT_ALLOWED +delete from t1 partition (p0, p1, pn); +drop table t1; + +set timestamp=unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (i int) with system versioning +partition by system_time interval 1 day ( + partition p0 history, + partition p1 history, + partition pn current); +set timestamp=unix_timestamp('2000-01-02 00:00:00'); +insert t1 values (1); +--error ER_VERS_NOT_ALLOWED +delete from t1 partition (p0, pn); +--error ER_VERS_NOT_ALLOWED +delete from t1 partition (p0, p1, pn); +drop table t1; +set timestamp= default; + +--echo # +--echo # MDEV-25546 LIMIT partitioning does not respect ROLLBACK +--echo # +create or replace table t1 (pk int primary key) +with system versioning engine innodb +partition by system_time limit 100 ( + partition p0 history, + partition p1 history, + partition pn current); +insert into t1 select seq from seq_1_to_90; + +start transaction; +# Puts 80 rows into p0 +replace into t1 select seq from seq_1_to_80; +# Puts another 70 rows into p0 +replace into t1 select seq from seq_1_to_70; +# Puts 60 rows into p1 +replace into t1 select seq from seq_1_to_60; + +select partition_name, table_rows +from information_schema.partitions +where table_name = 't1'; +rollback; + +select partition_name, table_rows +from information_schema.partitions +where table_name = 't1'; + +# Should put 10 rows into the empty partition p0 +replace into t1 select seq from seq_1_to_10; +select partition_name, table_rows +from information_schema.partitions +where table_name = 't1'; + # Cleanup +drop table t1; + +--echo # +--echo # MDEV-28271 Assertion on TRUNCATE PARTITION for PARTITION BY SYSTEM_TIME +--echo # +create table t1 (x int) with system versioning +partition by system_time limit 1 ( + partition p0 history, + partition p1 history, + partition p2 history, # p2 just disables warning about p1 partition full + partition pn current); + +insert into t1 values (0); +update t1 set x= x + 1; +update t1 set x= x + 1; + +select * from t1 partition (p0); +select * from t1 partition (p1); +select * from t1 partition (pn); + +delete from t1; +delete history from t1; +select * from t1 partition (p0); +select * from t1 partition (p1); +select * from t1 partition (pn); + +insert into t1 values (0); +update t1 set x= x + 1; +update t1 set x= x + 1; + +--echo # TRUNCATE PARTITION ALL does the same +alter table t1 truncate partition all; +select * from t1 partition (p0); +select * from t1 partition (p1); +select * from t1 partition (pn); + +insert into t1 values (0); +update t1 set x= x + 1; +update t1 set x= x + 1; + +--echo # TRUNCATE PARTITION deletes data from HISTORY partition +alter table t1 truncate partition p1; +select * from t1 partition (p0); +select * from t1 partition (p1); +select * from t1 partition (pn); + +--echo # or from CURRENT partition +alter table t1 truncate partition pn; +select * from t1 partition (p0); +select * from t1 partition (p1); +select * from t1 partition (pn); + +drop table t1; + +--echo # +--echo # MDEV-20077 Warning on full history partition is delayed until next DML statement +--echo # +--echo # DELETE +create table t1 (x int) with system versioning +partition by system_time limit 100 ( + partition p0 history, + partition p1 history, + partition pn current); + +insert into t1 select seq from seq_0_to_200; + +--echo # p0 is filled with 100 records (no warnings): +delete from t1 where x <= 99; +--echo # p1 is filled with 1 + 100 records (warning is printed): +delete from t1 where x <= 100; +delete from t1; +--echo # You see warning above ^ + +select count(*) from t1 partition (p0); +select count(*) from t1 partition (p1); +drop table t1; + +--echo # DELETE under LOCK TABLES +create table t1 (x int) with system versioning +partition by system_time limit 100 ( + partition p0 history, + partition p1 history, + partition pn current); + +insert into t1 select seq from seq_0_to_200; + +lock tables t1 write; +--echo # (LOCK TABLES) p0 is filled with 100 records (no warnings): +delete from t1 where x <= 99; +--echo # (LOCK TABLES) p1 is filled with 1 + 100 records (warning is printed): +delete from t1 where x <= 100; +delete from t1; +--echo # You see warning above ^ +unlock tables; + +select count(*) from t1 partition (p0); +select count(*) from t1 partition (p1); +drop table t1; + +--echo # DELETE multitable +create table t1 (x int) with system versioning +partition by system_time limit 100 ( + partition p0 history, + partition p1 history, + partition pn current); + +create table t2 (y int); + +insert into t1 select seq from seq_0_to_200; +insert into t2 select seq from seq_0_to_3; +delete t1, t2 from t1 join t2 where x < 50 and y = 0; +delete t1, t2 from t1 join t2 where x < 100 and y = 1; +delete t1, t2 from t1 join t2 where x < 150 and y = 2; +delete t1, t2 from t1 join t2; +--echo # You see warning above ^ + +select count(*) from t1 partition (p0); +select count(*) from t1 partition (p1); +drop table t1; + +--echo # UDPATE +create table t1 (x int) with system versioning +partition by system_time limit 100 ( + partition p0 history, + partition p1 history, + partition pn current); + +insert into t1 select seq from seq_0_to_49; + +update t1 set x= x + 1; +update t1 set x= x + 1; +update t1 set x= x + 1; +update t1 set x= x + 1; +--echo # You see warning above ^ + +select count(*) from t1 partition (p0); +select count(*) from t1 partition (p1); +drop tables t1, t2; + +--echo # UPDATE multitable +create table t1 (x int) with system versioning +partition by system_time limit 100 ( + partition p0 history, + partition p1 history, + partition pn current); + +create table t2 (y int); + +insert into t1 select seq from seq_0_to_49; +insert into t2 values (5); + +update t1, t2 set x= x + 1; +update t1, t2 set x= x + 1; +update t1, t2 set x= x + 1; +update t1, t2 set x= x + 1; +--echo # You see warning above ^ + +select count(*) from t1 partition (p0); +select count(*) from t1 partition (p1); +drop tables t1, t2; + +--echo # INSERT .. ON DUPLICATE KEY UPDATE (ODKU) +create table t1 (x int primary key) with system versioning +partition by system_time limit 100 ( + partition p0 history, + partition p1 history, + partition pn current); + +insert into t1 select seq from seq_0_to_100; + +delete from t1 where x <= 99; +insert into t1 values (100) on duplicate key update x= 400; + +select count(*) from t1 partition (p0); +select count(*) from t1 partition (p1); +drop table t1; + +--echo # INSERT .. SELECT .. ON DUPLICATE KEY UPDATE (ODKU) +create table t1 (x int primary key) with system versioning +partition by system_time limit 100 ( + partition p0 history, + partition p1 history, + partition pn current); + +create table t2 (y int); +insert into t2 values (100); +insert into t1 select seq from seq_0_to_100; + +delete from t1 where x <= 99; +insert into t1 select * from t2 on duplicate key update x= 500; + +select count(*) from t1 partition (p0); +select count(*) from t1 partition (p1); +drop tables t1, t2; + +--echo # REPLACE +create table t1 (x int primary key) with system versioning +partition by system_time limit 100 ( + partition p0 history, + partition p1 history, + partition pn current); + +insert into t1 select seq from seq_0_to_100; + +delete from t1 where x < 99; +replace t1 values (100); +replace t1 values (100); + +select count(*) from t1 partition (p0); +select count(*) from t1 partition (p1); +drop table t1; + +--echo # LOAD DATA .. REPLACE +create table t1 (x int primary key) with system versioning +partition by system_time limit 100 ( + partition p0 history, + partition p1 history, + partition pn current); + +insert into t1 select seq from seq_0_to_49; +select x into outfile 'MDEV-20077.data' from t1; + +load data infile 'MDEV-20077.data' replace into table t1 (x); +load data infile 'MDEV-20077.data' replace into table t1 (x); +load data infile 'MDEV-20077.data' replace into table t1 (x); +load data infile 'MDEV-20077.data' replace into table t1 (x); +--echo # You see warning above ^ + +select count(*) from t1 partition (p0); +select count(*) from t1 partition (p1); +drop table t1; +--remove_file $datadir/test/MDEV-20077.data + +--echo # REPLACE .. SELECT +create table t1 (x int primary key) with system versioning +partition by system_time limit 100 ( + partition p0 history, + partition p1 history, + partition pn current); + +insert into t1 select seq from seq_0_to_49; +replace t1 select * from t1; +replace t1 select * from t1; +replace t1 select * from t1; +replace t1 select * from t1; +--echo # You see warning above ^ + +select count(*) from t1 partition (p0); +select count(*) from t1 partition (p1); +drop table t1; + +--echo # +--echo # MDEV-28552 Assertion `inited==RND' failed in handler::ha_rnd_end +--echo # +create table tcount (c int unsigned); +insert into tcount values (0); + +create table t (f int) with system versioning +partition by system_time limit 1000 +(partition p1 history, partition pn current); +insert into t values (1),(2); +create trigger tr before insert on t for each row update tcount set c = c + 1; + +insert into t select * from t; + +# cleanup +drop table tcount, t; + +--echo # +--echo # MDEV-19569 Assertion `table_list->table' failed in find_field_in_table_ref and Assertion `table_ref->table || table_ref->view' in Field_iterator_table_ref::set_field_iterator +--echo # +set timestamp=unix_timestamp('2000-01-01 00:00:00'); +create table t1 (i int); +create table t2 (i int); + +--error ER_SUBQUERIES_NOT_SUPPORTED +alter table t1 partition by system_time + interval (select i from t2) day (partition p1 history, partition pn current); + +drop table t1; + +--error ER_SUBQUERIES_NOT_SUPPORTED +create table t1 (id int) with system versioning + partition by system_time + interval (select i from t2) day (partition p1 history, partition pn current); + +--error ER_PART_WRONG_VALUE +create table t1 (id int) with system versioning + partition by system_time + interval "hello" day (partition p1 history, partition pn current); + +create table t1 (id int) with system versioning + partition by system_time + interval 3.893 day (partition p1 history, partition pn current); + +drop table t1, t2; + +create table t1 (id int) with system versioning + partition by system_time interval "3-11" year_month (partition p1 history, partition pn current); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +drop table t1; + +create table t1 (id int) with system versioning + partition by system_time interval "3 11" day_hour (partition p1 history, partition pn current); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +drop table t1; + +create table t1 (id int) with system versioning + partition by system_time interval "3 11:12" day_minute (partition p1 history, partition pn current); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +drop table t1; + +create table t1 (id int) with system versioning + partition by system_time interval "3 11:12:13" day_second (partition p1 history, partition pn current); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +drop table t1; + +create table t1 (id int) with system versioning + partition by system_time interval "11:12" hour_minute (partition p1 history, partition pn current); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +drop table t1; + +create table t1 (id int) with system versioning + partition by system_time interval "11:12:13" hour_second (partition p1 history, partition pn current); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +drop table t1; + +create table t1 (id int) with system versioning + partition by system_time interval "12:13" minute_second (partition p1 history, partition pn current); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +drop table t1; + +--error ER_PART_WRONG_VALUE +create table t1 (id int) with system versioning + partition by system_time interval "12:13.123" minute_microsecond (partition p1 history, partition pn current); + +--echo # --echo # End of 10.3 tests +--echo # --echo # --echo # MDEV-22283 Server crashes in key_copy or unexpected error 156: The table already existed in the storage engine @@ -1061,7 +1508,9 @@ replace into t1 select * from t1; select * from t1 where i > 0 or pk = 1000 limit 1; drop table t1; +--echo # --echo # End of 10.4 tests +--echo # --echo # --echo # MDEV-22153 ALTER add default history partitions makes table inaccessible @@ -1116,10 +1565,6 @@ drop tables t1; --echo # End of 10.5 tests --echo # -SET GLOBAL innodb_stats_persistent=@save_persistent; - ---echo # End of 10.6 tests - --echo # --echo # MDEV-22166 MIGRATE PARTITION: move out partition into a table --echo # @@ -1319,4 +1764,20 @@ show create table t1; drop tables t1, tp1; } +--echo # +--echo # MDEV-29841 Partition by system_time can be converted into table but not back +--echo # +create or replace table t (a int) with system versioning +partition by system_time limit 10 partitions 3; +alter table t convert partition p0 to table tp; +--error ER_ONLY_ON_RANGE_LIST_PARTITION +alter table t convert table tp to partition p0; +drop tables t, tp; + +--echo # +--echo # End of 10.7 tests +--echo # + +set global innodb_stats_persistent= @save_persistent; + --source suite/versioning/common_finish.inc diff --git a/mysql-test/suite/versioning/t/rpl.test b/mysql-test/suite/versioning/t/rpl.test index b5be68feece09..7d78b60e6fae6 100644 --- a/mysql-test/suite/versioning/t/rpl.test +++ b/mysql-test/suite/versioning/t/rpl.test @@ -133,4 +133,38 @@ sync_slave_with_master; connection master; drop table t1; + +# +# MDEV-30430: Enabling system versioning on tables without primary key breaks replication +# Note that bugs are only present with row binlog format +# +--echo # check versioned -> versioned replication without any keys on duplicate records +connection master; +create table t1 (a INT) with system versioning; +insert into t1 values (1); +insert into t1 values (1); +delete from t1; +sync_slave_with_master; +--let $diff_tables= master:test.t1,slave:test.t1 +--source include/diff_tables.inc +connection master; +drop table t1; +sync_slave_with_master; + +--echo # check unversioned -> versioned replication with non-unique keys on duplicate records +connection master; +set statement sql_log_bin=0 for create table t1 (a INT NOT NULL, b INT, INDEX(a,b)); +connection slave; +set statement sql_log_bin=0 for create table t1 (a INT NOT NULL, b INT, INDEX(a,b)) with system versioning; +connection master; +insert into t1 values (1,1); +insert into t1 values (1,1); +delete from t1; +sync_slave_with_master; +--let $diff_tables= master:test.t1,slave:test.t1 +--source include/diff_tables.inc + +connection master; +drop table t1; + --source include/rpl_end.inc diff --git a/mysql-test/suite/versioning/t/rpl_row.test b/mysql-test/suite/versioning/t/rpl_row.test index 17ce2dfdcf8d5..2e5d4c76f4a54 100644 --- a/mysql-test/suite/versioning/t/rpl_row.test +++ b/mysql-test/suite/versioning/t/rpl_row.test @@ -1,5 +1,6 @@ --source include/have_binlog_format_row.inc --source include/master-slave.inc +--source include/have_innodb.inc --echo # MDEV-16252: MINIMAL binlog_row_image does not work for versioned tables set @old_row_image= @@binlog_row_image; @@ -15,4 +16,44 @@ update t1 set i = 0; drop table t1; set binlog_row_image= @old_row_image; +--echo # +--echo # MDEV-28254 Wrong position for row_start, row_end after adding column +--echo # to implicit versioned table +--echo # +--let TMP= $MYSQLTEST_VARDIR/tmp +--let $MYSQLD_DATADIR= `select @@datadir` +set @@system_versioning_alter_history= keep; +set @@session.time_zone='+00:00'; + +create table t1 (x int) with system versioning engine innodb; +alter table t1 add column y int, algorithm=inplace; +check table t1; +--exec $MYSQL_DUMP --databases test > $TMP/dump.sql + +--sync_slave_with_master +drop table t1; +--exec $MYSQL_SLAVE test < $TMP/dump.sql +show create table t1; + +--connection master +set timestamp= 12345; +--let $start_pos= query_get_value("SHOW MASTER STATUS", Position, 1) +insert t1 values (1, 1); +select *, unix_timestamp(row_start) as row_start, unix_timestamp(row_end) as row_end from t1; +--let $stop_pos= query_get_value("SHOW MASTER STATUS", Position, 1) +set timestamp= default; + +# NOTE: pipe grep is not Windows-compatible +--let grep_file= $TMP/out.txt +--let grep_regex= ^### +--exec $MYSQL_BINLOG -v -j $start_pos --stop-position=$stop_pos -o 3 $MYSQLD_DATADIR/master-bin.000001 > $grep_file +--source include/grep.inc +--sync_slave_with_master +select * from t1; + +--connection master +drop table t1; +--remove_files_wildcard $TMP *.txt +--remove_files_wildcard $TMP *.sql + --source include/rpl_end.inc diff --git a/mysql-test/suite/versioning/t/sysvars-notembedded.test b/mysql-test/suite/versioning/t/sysvars-notembedded.test deleted file mode 100644 index 314972bc375a4..0000000000000 --- a/mysql-test/suite/versioning/t/sysvars-notembedded.test +++ /dev/null @@ -1,31 +0,0 @@ -source include/not_embedded.inc; - -create table t (a int) with system versioning; -set @before= UNIX_TIMESTAMP(now(6)); -insert into t values (1); -set @after= UNIX_TIMESTAMP(now(6)); -update t set a= 2; - -set global system_versioning_asof= FROM_UNIXTIME(@after); -set system_versioning_asof= FROM_UNIXTIME(@after); -select * from t as nonempty; - ---connect (subcon,127.0.0.1,root,,,$SERVER_MYPORT_1) ---connection subcon -select * from t as nonempty; ---disconnect subcon ---connection default - -set global system_versioning_asof= FROM_UNIXTIME(@before); -select * from t as nonempty; - ---connect (subcon,127.0.0.1,root,,,$SERVER_MYPORT_1) ---connection subcon -select * from t as empty; ---disconnect subcon ---connection default - -drop table t; - -set global system_versioning_asof= DEFAULT; -set system_versioning_asof= DEFAULT; diff --git a/mysql-test/suite/versioning/t/truncate_privilege.test b/mysql-test/suite/versioning/t/truncate_privilege.test deleted file mode 100644 index dcdad59039aa1..0000000000000 --- a/mysql-test/suite/versioning/t/truncate_privilege.test +++ /dev/null @@ -1,41 +0,0 @@ -# Can't test with embedded server --- source include/not_embedded.inc - ---source include/have_innodb.inc - -# Save the initial number of concurrent sessions ---source include/count_sessions.inc - -connect (root,localhost,root,,test); -connection root; - ---disable_warnings -create database mysqltest; ---enable_warnings - -create user mysqltest_1@localhost; -connect (user1,localhost,mysqltest_1,,test); -connection user1; - -connection root; -create table mysqltest.t (a int) with system versioning; - -connection user1; -show grants; ---error ER_TABLEACCESS_DENIED_ERROR -delete history from mysqltest.t before system_time now(); - -connection root; -grant delete history on mysqltest.* to mysqltest_1@localhost; -grant delete history on mysqltest.t to mysqltest_1@localhost; - -connection user1; -show grants; -delete history from mysqltest.t before system_time now(); - -connection root; -grant all on *.* to mysqltest_1@localhost; -show grants for mysqltest_1@localhost; - -drop user mysqltest_1@localhost; -drop database mysqltest; diff --git a/mysql-test/suite/versioning/t/trx_id.test b/mysql-test/suite/versioning/t/trx_id.test index 4728ce9b2d0ea..60836279f5202 100644 --- a/mysql-test/suite/versioning/t/trx_id.test +++ b/mysql-test/suite/versioning/t/trx_id.test @@ -3,6 +3,7 @@ if (!$TEST_VERSIONING_SO) --skip needs test_versioning plugin } --source include/have_innodb.inc +--source include/have_partition.inc --source include/default_charset.inc --disable_query_log @@ -161,7 +162,87 @@ update t1 set x= 4; commit; select x, row_start < row_end from t1 for system_time all; +--echo # +--echo # MDEV-15951 system versioning by trx id doesn't work with partitioning +--echo # currently trx_id does not support partitioning by system_time +--echo # +--error ER_VERS_FIELD_WRONG_TYPE +create or replace table t1( + i int, + row_start bigint unsigned generated always as row start, + row_end bigint unsigned generated always as row end, + period for system_time(row_start, row_end) +) engine=InnoDB with system versioning partition by system_time ( + partition p0 history, + partition pn current +); + +create or replace table t1( + i int, + row_start bigint unsigned generated always as row start, + row_end bigint unsigned generated always as row end, + period for system_time(row_start, row_end) +) engine=InnoDB with system versioning; + +--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ +--error ER_VERS_FIELD_WRONG_TYPE +alter table t1 partition by system_time ( + partition p0 history, + partition pn current +); + +drop table t1; + +--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED +create or replace table t ( + a int primary key, + row_start bigint unsigned as row start invisible, + row_end bigint unsigned as row end invisible, + period for system_time(row_start, row_end) +) engine=innodb with system versioning +partition by key() ( + partition p1, + partition p2 +); + +--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED +create or replace table t ( + a int primary key, + row_start bigint unsigned as row start invisible, + row_end bigint unsigned as row end invisible, + period for system_time(row_start, row_end) +) engine=innodb with system versioning +partition by key(a, row_start) ( + partition p1, + partition p2 +); + +--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED +create or replace table t ( + a int primary key, + row_start bigint unsigned as row start invisible, + row_end bigint unsigned as row end invisible, + period for system_time(row_start, row_end) +) engine=innodb with system versioning +partition by hash(a + row_end * 2) ( + partition p1, + partition p2 +); + +--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED +create or replace table t ( + a int primary key, + row_start bigint unsigned as row start invisible, + row_end bigint unsigned as row end invisible, + period for system_time(row_start, row_end) +) engine=innodb with system versioning +partition by range columns (a, row_start) ( + partition p1 values less than (100, 100) +); + +--echo # --echo # MDEV-16010 Too many rows with AS OF point_in_the_past_or_NULL +--echo # create or replace table t1 ( x int, row_start bigint unsigned as row start invisible, @@ -515,3 +596,38 @@ uninstall plugin test_versioning; select trt_begin_ts(0); --disable_prepare_warnings + +--echo # +--echo # MDEV-21650 Non-empty statement transaction on global rollback after TRT update error +--echo # +create table t1 (s date, e date, period for app(s,e)) engine=innodb; +alter table t1 + add row_start bigint unsigned as row start, + add row_end bigint unsigned as row end, + add period for system_time(row_start,row_end), + with system versioning, + add period if not exists for app(x,y); + +set transaction isolation level serializable; +start transaction; +insert into t1 (s,e) values ('2021-07-04','2024-08-18'); + +--connect (con1,localhost,root,,test) +start transaction; +insert into t1 (s,e) values ('2018-06-01','2021-09-15'); + +--connection default +--replace_regex /TRX_ID \d+/TRX_ID .../ +--error ER_VERS_NO_TRX_ID +select * from t1 for system_time as of now(); + +--connection con1 +set innodb_lock_wait_timeout= 1, lock_wait_timeout= 1; +# can be existing or non-existing table, does not matter +--error ER_LOCK_WAIT_TIMEOUT +alter table xx; + +# cleanup +--disconnect con1 +--connection default +drop table t1; diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test index df07cec33cb65..5d250bb216213 100644 --- a/mysql-test/suite/versioning/t/update.test +++ b/mysql-test/suite/versioning/t/update.test @@ -186,9 +186,7 @@ send update t1 set b = 'foo'; connection con1; let $wait_condition= select count(*) from information_schema.innodb_lock_waits; source include/wait_condition.inc; -# There must no be DEADLOCK here as con1 transaction already holds locks, and -# default's transaction lock is waiting, so the locks of the following "UPDATE" -# must not conflict with waiting lock. +error ER_LOCK_DEADLOCK; update t1 set a = 'bar'; disconnect con1; connection default; @@ -328,9 +326,32 @@ select *, check_row(row_start, row_end) from t2 for system_time all order by row # cleanup drop tables t1, t2, t3; +--echo # +--echo # MDEV-26778 row_start is not updated in current row for InnoDB +--echo # +create or replace table t1 (x int) with system versioning; +insert t1 values (1); +update t1 set x= 1; +select row_start into @r from t1; +select check_row_ts(row_start, row_end) from t1 for system_time all where row_start = @r; +drop table t1; + +--echo # +--echo # MDEV-22973 Assertion in compare_record upon multi-update involving versioned table via view +--echo # +create or replace table t1 (a int, primary key (a)) engine=myisam; +insert into t1 values (0); +create or replace table t2 (pk int, b int, primary key (pk), key(b)) engine=innodb with system versioning; +insert into t2 values (1, 0), (2, 0); +create or replace view v as select a, b from t1, t2; +update v set b= null where a = 0 order by b; +# cleanup +drop view v; +drop table t1, t2; + --echo # --echo # MDEV-24522 Assertion `inited==NONE' fails upon UPDATE on versioned table with unique blob ---echo +--echo # create table t1 (a int, b int, c text, unique(c), key (b)) engine=myisam with system versioning; insert into t1 values (1, 1, 'foo'), (2, 11, 'bar'); @@ -352,4 +373,6 @@ update t1, t2 set t1.a = 3, t2.a = 3 where t1.b <= 10 and t2.b <= 10 and t1.b = # cleanup drop tables t1, t2; +--echo # End of 10.4 tests + source suite/versioning/common_finish.inc; diff --git a/mysql-test/suite/wsrep/common.pm b/mysql-test/suite/wsrep/common.pm index 8ac3b3ea94cd3..54ce8826563d7 100644 --- a/mysql-test/suite/wsrep/common.pm +++ b/mysql-test/suite/wsrep/common.pm @@ -43,10 +43,10 @@ sub check_wsrep_support() { mtr_error("No SST scripts") unless $spath; $ENV{PATH}="$spath:$ENV{PATH}"; - # ADD mysql client library path to path so that wsrep_notify_cmd can find mysql - # client for loading the tables. (Don't assume each machine has mysql install) - my ($cpath) = grep { -f "$_/mysql"; } "$::bindir/scripts", $::path_client_bindir; - mtr_error("No scritps") unless $cpath; + # ADD mariadb client to path so that wsrep_notify_cmd can find mariadb + # client for loading the tables. (Don't assume each machine has mariadb installed) + my ($cpath) = grep { -f "$_/mariadb"; } "$::bindir/scripts", $::path_client_bindir; + mtr_error("No mariadb client found") unless $cpath; $ENV{PATH}="$cpath:$ENV{PATH}" unless $cpath eq $spath; # ADD my_print_defaults script path to path so that SST scripts can find it diff --git a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result deleted file mode 100644 index 262c75f862e3b..0000000000000 --- a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result +++ /dev/null @@ -1,150 +0,0 @@ -# -# MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above -# -# Verbose run -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=InnoDB; -ALTER TABLE time_zone_name ENGINE=InnoDB; -ALTER TABLE time_zone_transition ENGINE=InnoDB; -ALTER TABLE time_zone_transition_type ENGINE=InnoDB; -END IF| -\d ; -TRUNCATE TABLE time_zone; -TRUNCATE TABLE time_zone_name; -TRUNCATE TABLE time_zone_transition; -TRUNCATE TABLE time_zone_transition_type; -START TRANSACTION; -INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); -SET @time_zone_id= LAST_INSERT_ID(); -INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); -INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset`, Is_DST, Abbreviation) VALUES - (@time_zone_id, 0, 0, 0, 'GMT') -; -Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it. -Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/ignored.tab' as time zone. Skipping it. -INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); -SET @time_zone_id= LAST_INSERT_ID(); -INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id); -INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset`, Is_DST, Abbreviation) VALUES - (@time_zone_id, 0, 0, 0, 'GMT') -; -Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. -Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it. -Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion. -COMMIT; -ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; -ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=Aria; -ALTER TABLE time_zone_name ENGINE=Aria; -ALTER TABLE time_zone_transition ENGINE=Aria; -ALTER TABLE time_zone_transition_type ENGINE=Aria; -END IF| -\d ; -# Silent run -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=InnoDB; -ALTER TABLE time_zone_name ENGINE=InnoDB; -ALTER TABLE time_zone_transition ENGINE=InnoDB; -ALTER TABLE time_zone_transition_type ENGINE=InnoDB; -END IF| -\d ; -TRUNCATE TABLE time_zone; -TRUNCATE TABLE time_zone_name; -TRUNCATE TABLE time_zone_transition; -TRUNCATE TABLE time_zone_transition_type; -START TRANSACTION; -INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); -SET @time_zone_id= LAST_INSERT_ID(); -INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); -INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset`, Is_DST, Abbreviation) VALUES - (@time_zone_id, 0, 0, 0, 'GMT') -; -Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it. -INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); -SET @time_zone_id= LAST_INSERT_ID(); -INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id); -INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset`, Is_DST, Abbreviation) VALUES - (@time_zone_id, 0, 0, 0, 'GMT') -; -Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. -COMMIT; -ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; -ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=Aria; -ALTER TABLE time_zone_name ENGINE=Aria; -ALTER TABLE time_zone_transition ENGINE=Aria; -ALTER TABLE time_zone_transition_type ENGINE=Aria; -END IF| -\d ; -# -# Testing with explicit timezonefile -# -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=InnoDB; -ALTER TABLE time_zone_name ENGINE=InnoDB; -ALTER TABLE time_zone_transition ENGINE=InnoDB; -ALTER TABLE time_zone_transition_type ENGINE=InnoDB; -END IF| -\d ; -INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); -SET @time_zone_id= LAST_INSERT_ID(); -INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id); -INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset`, Is_DST, Abbreviation) VALUES - (@time_zone_id, 0, 0, 0, 'GMT') -; -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=Aria; -ALTER TABLE time_zone_name ENGINE=Aria; -ALTER TABLE time_zone_transition ENGINE=Aria; -ALTER TABLE time_zone_transition_type ENGINE=Aria; -END IF| -\d ; -# -# Testing --leap -# -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=InnoDB; -ALTER TABLE time_zone_name ENGINE=InnoDB; -ALTER TABLE time_zone_transition ENGINE=InnoDB; -ALTER TABLE time_zone_transition_type ENGINE=InnoDB; -END IF| -\d ; -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone_leap_second ENGINE=InnoDB; -END IF| -\d ; -TRUNCATE TABLE time_zone_leap_second; -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone_leap_second ENGINE=Aria; -END IF| -\d ; -ALTER TABLE time_zone_leap_second ORDER BY Transition_time; -\d | -IF (select count(*) from information_schema.global_variables where -variable_name='wsrep_on' and variable_value='ON') = 1 THEN -ALTER TABLE time_zone ENGINE=Aria; -ALTER TABLE time_zone_name ENGINE=Aria; -ALTER TABLE time_zone_transition ENGINE=Aria; -ALTER TABLE time_zone_transition_type ENGINE=Aria; -END IF| -\d ; diff --git a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result deleted file mode 100644 index e77afe0df7553..0000000000000 --- a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result +++ /dev/null @@ -1,78 +0,0 @@ -# -# MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above -# -# Verbose run -set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?'); -prepare set_wsrep_write_binlog from @prep1; -set @toggle=0; execute set_wsrep_write_binlog using @toggle; -TRUNCATE TABLE time_zone; -TRUNCATE TABLE time_zone_name; -TRUNCATE TABLE time_zone_transition; -TRUNCATE TABLE time_zone_transition_type; -START TRANSACTION; -INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); -SET @time_zone_id= LAST_INSERT_ID(); -INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); -INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset`, Is_DST, Abbreviation) VALUES - (@time_zone_id, 0, 0, 0, 'GMT') -; -Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it. -Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/ignored.tab' as time zone. Skipping it. -INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); -SET @time_zone_id= LAST_INSERT_ID(); -INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id); -INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset`, Is_DST, Abbreviation) VALUES - (@time_zone_id, 0, 0, 0, 'GMT') -; -Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. -Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it. -Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion. -COMMIT; -ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; -ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; -# Silent run -set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?'); -prepare set_wsrep_write_binlog from @prep1; -set @toggle=0; execute set_wsrep_write_binlog using @toggle; -TRUNCATE TABLE time_zone; -TRUNCATE TABLE time_zone_name; -TRUNCATE TABLE time_zone_transition; -TRUNCATE TABLE time_zone_transition_type; -START TRANSACTION; -INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); -SET @time_zone_id= LAST_INSERT_ID(); -INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); -INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset`, Is_DST, Abbreviation) VALUES - (@time_zone_id, 0, 0, 0, 'GMT') -; -Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it. -INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); -SET @time_zone_id= LAST_INSERT_ID(); -INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id); -INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset`, Is_DST, Abbreviation) VALUES - (@time_zone_id, 0, 0, 0, 'GMT') -; -Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. -COMMIT; -ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; -ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; -# -# Testing with explicit timezonefile -# -set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?'); -prepare set_wsrep_write_binlog from @prep1; -set @toggle=0; execute set_wsrep_write_binlog using @toggle; -INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); -SET @time_zone_id= LAST_INSERT_ID(); -INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id); -INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset`, Is_DST, Abbreviation) VALUES - (@time_zone_id, 0, 0, 0, 'GMT') -; -# -# Testing --leap -# -set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?'); -prepare set_wsrep_write_binlog from @prep1; -set @toggle=0; execute set_wsrep_write_binlog using @toggle; -TRUNCATE TABLE time_zone_leap_second; -ALTER TABLE time_zone_leap_second ORDER BY Transition_time; diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt deleted file mode 100644 index a8b72174076b1..0000000000000 --- a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt +++ /dev/null @@ -1 +0,0 @@ ---wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_on=1 --binlog_format=ROW diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test deleted file mode 100644 index 875546356662a..0000000000000 --- a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test +++ /dev/null @@ -1,41 +0,0 @@ ---source include/have_wsrep.inc ---source include/have_symlink.inc ---source include/not_windows.inc ---source include/have_innodb.inc - ---echo # ---echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above ---echo # - ---exec mkdir $MYSQLTEST_VARDIR/zoneinfo ---exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix ---copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT ---copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/garbage ---copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/ignored.tab - ---echo # Verbose run ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_TZINFO_TO_SQL --verbose $MYSQLTEST_VARDIR/zoneinfo 2>&1 - ---echo # Silent run ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1 - ---echo # ---echo # Testing with explicit timezonefile ---echo # - ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1 - ---echo # ---echo # Testing --leap ---echo # - ---exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1 - -# -# Cleanup -# - ---exec rm -rf $MYSQLTEST_VARDIR/zoneinfo diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt deleted file mode 100644 index a8b72174076b1..0000000000000 --- a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt +++ /dev/null @@ -1 +0,0 @@ ---wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_on=1 --binlog_format=ROW diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test deleted file mode 100644 index ab1f94cc1cf74..0000000000000 --- a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test +++ /dev/null @@ -1,41 +0,0 @@ ---source include/have_wsrep.inc ---source include/have_symlink.inc ---source include/not_windows.inc ---source include/have_innodb.inc - ---echo # ---echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above ---echo # - ---exec mkdir $MYSQLTEST_VARDIR/zoneinfo ---exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix ---copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT ---copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/garbage ---copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/ignored.tab - ---echo # Verbose run ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_TZINFO_TO_SQL --verbose --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>&1 - ---echo # Silent run ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>&1 - ---echo # ---echo # Testing with explicit timezonefile ---echo # - ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1 - ---echo # ---echo # Testing --leap ---echo # - ---exec $MYSQL_TZINFO_TO_SQL --leap --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1 - -# -# Cleanup -# - ---exec rm -rf $MYSQLTEST_VARDIR/zoneinfo diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index fc6d2e7ec86f7..9127bb1f962f4 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -1,5 +1,5 @@ # Copyright (c) 2005, 2015, Oracle and/or its affiliates. -# Copyright (c) 2008, 2019, MariaDB +# Copyright (c) 2008, 2022, MariaDB # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public @@ -100,137 +100,6 @@ fun:_dl_start } -# -# Warnings in libz becasue it works with aligned memory(?) -# - -{ - libz tr_flush_block - Memcheck:Cond - fun:_tr_flush_block - fun:deflate_slow - fun:deflate - fun:do_flush - fun:gzclose -} - -{ - libz tr_flush_block2 - Memcheck:Cond - fun:_tr_flush_block - fun:deflate_slow - fun:deflate - fun:compress2 -} - -{ - libz longest_match - Memcheck:Cond - fun:longest_match - fun:deflate_slow - fun:deflate - fun:do_flush -} - -{ - libz longest_match called from btr_store_big_rec_extern_fields - Memcheck:Cond - fun:longest_match - fun:deflate_slow - fun:deflate - fun:btr_store_big_rec_extern_fields -} - -{ - libz longest_match called from page_zip_compress - Memcheck:Cond - fun:longest_match - fun:deflate_slow - fun:deflate - fun:page_zip_compress -} - -{ - libz longest_match2 - Memcheck:Cond - fun:longest_match - fun:deflate_slow - fun:deflate - fun:compress2 -} - -{ - libz longest_match 3 - Memcheck:Cond - fun:longest_match - fun:deflate_slow - fun:deflate - fun:gzclose -} - -{ - libz longest_match 4 - Memcheck:Cond - fun:longest_match - fun:deflate_slow - fun:deflate - fun:gzflush -} - -{ - libz longest_match3 - Memcheck:Cond - fun:longest_match - fun:deflate_slow - fun:deflate - fun:azflush -} - -{ - libz longest_match3 - Memcheck:Cond - fun:longest_match - fun:deflate_slow - fun:deflate - fun:azclose -} - -{ - libz deflate - Memcheck:Cond - obj:*/libz.so.* - obj:*/libz.so.* - fun:deflate - fun:compress2 -} - -{ - libz deflate2 - Memcheck:Cond - obj:*/libz.so.* - obj:*/libz.so.* - fun:deflate - obj:*/libz.so.* - fun:gzflush -} - -{ - libz deflate3 - Memcheck:Cond - obj:*/libz.so.* - obj:*/libz.so.* - fun:deflate - fun:do_flush -} - -{ - libz inflatereset2 - Memcheck:Cond - fun:inflateReset2 - fun:inflateInit2_ - fun:uncompress -} - # # Warning from my_thread_init becasue mysqld dies before kill thread exists @@ -705,39 +574,6 @@ fun:buf_buddy_relocate } -{ - Bug 59874 Valgrind warning in InnoDB compression code - Memcheck:Cond - fun:* - fun:* - fun:deflate - fun:btr_store_big_rec_extern_fields_func - fun:row_ins_index_entry_low - fun:row_ins_index_entry - fun:row_ins_index_entry_step - fun:row_ins - fun:row_ins_step - fun:row_insert_for_mysql -} - -{ - In page0zip.c we have already checked that the memory is initialized before calling deflate() - Memcheck:Cond - fun:* - fun:* - fun:deflate - fun:page_zip_compress -} - -{ - In page0zip.c we have already checked that the memory is initialized before calling deflate() - Memcheck:Cond - fun:* - fun:* - fun:deflate - fun:page_zip_compress_deflate -} - { Bug 59875 Valgrind warning in buf0buddy.c Memcheck:Addr1 diff --git a/mysys/array.c b/mysys/array.c index aa2f444653f50..6e871ee6343d2 100644 --- a/mysys/array.c +++ b/mysys/array.c @@ -23,6 +23,7 @@ SYNOPSIS init_dynamic_array2() + ps_key Key to register instrumented memory array Pointer to an array element_size Size of element init_buffer Initial buffer pointer diff --git a/mysys/charset.c b/mysys/charset.c index da6180dccba76..560c713a36185 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -393,6 +393,8 @@ static int add_collation(struct charset_info_st *cs) &my_charset_utf8mb4_unicode_ci, cs); newcs->m_ctype= my_charset_utf8mb4_unicode_ci.m_ctype; + if (init_state_maps(newcs)) + return MY_XML_ERROR; newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED; #endif } diff --git a/mysys/crc32/crc32c.cc b/mysys/crc32/crc32c.cc index b48e744a66336..2bec041e278f4 100644 --- a/mysys/crc32/crc32c.cc +++ b/mysys/crc32/crc32c.cc @@ -18,7 +18,6 @@ #include #include -#include #include #include static inline uint32_t DecodeFixed32(const char *ptr) diff --git a/mysys/hash.c b/mysys/hash.c index d9132b28cd772..fccd4a243736c 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -60,8 +60,9 @@ my_hash_value_type my_hash_sort(CHARSET_INFO *cs, const uchar *key, dynamic array that is part of the hash will allocate memory as required during insertion. + @param[in] psi_key The key to register instrumented memory @param[in,out] hash The hash that is initialized - @param[in[ growth_size size incrememnt for the underlying dynarray + @param[in] growth_size size incrememnt for the underlying dynarray @param[in] charset The character set information @param[in] size The hash size @param[in] key_offest The key offset for the hash diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index bdc001fbe257b..4b0fef183d25d 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2017, MariaDB Corporation. + Copyright (c) 2017, 2022, 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 @@ -377,7 +377,7 @@ static void keycache_debug_print(const char *fmt,...); #define KEYCACHE_DBUG_ASSERT(a) DBUG_ASSERT(a) #endif /* defined(KEYCACHE_DEBUG_LOG) && defined(KEYCACHE_DEBUG) */ -#if defined(KEYCACHE_DEBUG) || !defined(DBUG_OFF) +#if defined(KEYCACHE_DEBUG) || defined(DBUG_TRACE) static long keycache_thread_id; #define KEYCACHE_THREAD_TRACE(l) \ KEYCACHE_DBUG_PRINT(l,("|thread %ld",keycache_thread_id)) @@ -393,7 +393,7 @@ static long keycache_thread_id; #define KEYCACHE_THREAD_TRACE_BEGIN(l) #define KEYCACHE_THREAD_TRACE_END(l) #define KEYCACHE_THREAD_TRACE(l) -#endif /* defined(KEYCACHE_DEBUG) || !defined(DBUG_OFF) */ +#endif /* defined(KEYCACHE_DEBUG) || defined(DBUG_TRACE) */ #define BLOCK_NUMBER(b) \ ((uint) (((char*)(b)-(char *) keycache->block_root)/sizeof(BLOCK_LINK))) @@ -701,7 +701,7 @@ int prepare_resize_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache, keycache->in_resize= 1; /* Need to flush only if keycache is enabled. */ - if (keycache->can_be_used) + if (keycache->can_be_used && keycache->disk_blocks != -1) { /* Start the flush phase. */ keycache->resize_in_flush= 1; diff --git a/mysys/mulalloc.c b/mysys/mulalloc.c index 357f9315f2b59..51f8d61b574a5 100644 --- a/mysys/mulalloc.c +++ b/mysys/mulalloc.c @@ -17,6 +17,11 @@ #include "mysys_priv.h" #include +#ifndef DBUG_OFF +/* Put a protected barrier after every element when using my_multi_malloc() */ +#define ALLOC_BARRIER +#endif + /* Malloc many pointers at the same time Only ptr1 can be free'd, and doing this will free all @@ -45,6 +50,9 @@ void* my_multi_malloc(PSI_memory_key key, myf myFlags, ...) { length=va_arg(args,uint); tot_length+=ALIGN_SIZE(length); +#ifdef ALLOC_BARRIER + tot_length+= ALIGN_SIZE(1); +#endif } va_end(args); @@ -58,6 +66,10 @@ void* my_multi_malloc(PSI_memory_key key, myf myFlags, ...) *ptr=res; length=va_arg(args,uint); res+=ALIGN_SIZE(length); +#ifdef ALLOC_BARRIER + TRASH_FREE(res, ALIGN_SIZE(1)); + res+= ALIGN_SIZE(1); +#endif } va_end(args); DBUG_RETURN((void*) start); @@ -89,6 +101,9 @@ void *my_multi_malloc_large(PSI_memory_key key, myf myFlags, ...) { length=va_arg(args,ulonglong); tot_length+=ALIGN_SIZE(length); +#ifdef ALLOC_BARRIER + tot_length+= ALIGN_SIZE(1); +#endif } va_end(args); @@ -102,6 +117,10 @@ void *my_multi_malloc_large(PSI_memory_key key, myf myFlags, ...) *ptr=res; length=va_arg(args,ulonglong); res+=ALIGN_SIZE(length); +#ifdef ALLOC_BARRIER + TRASH_FREE(res, ALIGN_SIZE(1)); + res+= ALIGN_SIZE(1); +#endif } va_end(args); DBUG_RETURN((void*) start); diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c index 86670cf1db2ba..376e73686e24c 100644 --- a/mysys/my_addr_resolve.c +++ b/mysys/my_addr_resolve.c @@ -202,7 +202,7 @@ int start_addr2line_fork(const char *binary_path) close(out[0]); close(out[1]); execlp("addr2line", "addr2line", "-C", "-f", "-e", binary_path, NULL); - exit(1); + _exit(1); } close(in[0]); @@ -239,10 +239,10 @@ static int addr_resolve(void *ptr, my_addr_loc *loc) } - /* 500 ms should be plenty of time for addr2line to issue a response. */ + /* 5000 ms should be plenty of time for addr2line to issue a response. */ /* Read in a loop till all the output from addr2line is complete. */ while (parsed == total_bytes_read && - (ret= poll(&poll_fds, 1, 500))) + (ret= poll(&poll_fds, 1, 5000))) { /* error during poll */ if (ret < 0) @@ -286,7 +286,8 @@ static int addr_resolve(void *ptr, my_addr_loc *loc) loc->line= atoi(output + line_number_start); /* Addr2line was unable to extract any meaningful information. */ - if (strcmp(loc->file, "??") == 0 && loc->func[0] == '?') + if ((strcmp(loc->file, "??") == 0 || strcmp(loc->file, "") == 0) && + (loc->func[0] == '?' || loc->line == 0)) return 6; loc->file= strip_path(loc->file); @@ -319,12 +320,20 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc) /* Save result for future comparisons. */ strnmov(addr2line_binary, info.dli_fname, sizeof(addr2line_binary)); +#ifdef _AIX + /* + info.dli_fbase is a char on AIX and casting it doesn't fool gcc. + leave backtracing broken on AIX until a real solution can be found. + */ + addr_offset= NULL; +#else /* Check if we should use info.dli_fbase as an offset or not for the base program. This is depending on if the compilation is done with PIE or not. */ addr_offset= info.dli_fbase; +#endif #ifndef __PIE__ if (strcmp(info.dli_fname, my_progname) == 0 && addr_resolve((void*) my_addr_resolve, loc) == 0 && diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index 9f230b6bbcbf0..43f26751f272a 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -28,6 +28,11 @@ #undef EXTRA_DEBUG #define EXTRA_DEBUG +#ifndef DBUG_OFF +/* Put a protected barrier after every element when using multi_alloc_root() */ +#define ALLOC_BARRIER +#endif + /* data packed in MEM_ROOT -> min_malloc */ /* Don't allocate too small blocks */ @@ -120,8 +125,8 @@ static void calculate_block_sizes(MEM_ROOT *mem_root, size_t block_size, SYNOPSIS init_alloc_root() + key - key to register instrumented memory mem_root - memory root to initialize - name - name of memroot (for debugging) block_size - size of chunks (blocks) used for memory allocation. Will be updated to next power of 2, minus internal and system memory management size. This is @@ -396,6 +401,9 @@ void *multi_alloc_root(MEM_ROOT *root, ...) { length= va_arg(args, uint); tot_length+= ALIGN_SIZE(length); +#ifdef ALLOC_BARRIER + tot_length+= ALIGN_SIZE(1); +#endif } va_end(args); @@ -409,6 +417,10 @@ void *multi_alloc_root(MEM_ROOT *root, ...) *ptr= res; length= va_arg(args, uint); res+= ALIGN_SIZE(length); +#ifdef ALLOC_BARRIER + TRASH_FREE(res, ALIGN_SIZE(1)); + res+= ALIGN_SIZE(1); +#endif } va_end(args); DBUG_RETURN((void*) start); diff --git a/mysys/my_atomic_writes.c b/mysys/my_atomic_writes.c index 42ee4e690cdfd..90d0f1d026188 100644 --- a/mysys/my_atomic_writes.c +++ b/mysys/my_atomic_writes.c @@ -118,7 +118,7 @@ static my_bool test_if_shannon_card_exists() char path[32]; struct stat stat_buff; - sprintf(path, "/dev/df%c", dev_part); + snprintf(path, sizeof(path), "/dev/df%c", dev_part); #ifdef TEST_SHANNON if (stat(path, &stat_buff) < 0) { @@ -127,8 +127,10 @@ static my_bool test_if_shannon_card_exists() } #endif shannon_devices[shannon_found_devices].st_dev= stat_buff.st_rdev; - sprintf(shannon_devices[shannon_found_devices].dev_name, "/dev/sct%c", - dev_part); + snprintf(shannon_devices[shannon_found_devices].dev_name, + sizeof(shannon_devices[shannon_found_devices].dev_name), + "/dev/sct%c", + dev_part); #ifdef TEST_SHANNON printf("%s(): i=%d, stat_buff.st_dev=0x%lx, stat_buff.st_rdev=0x%lx, st_rdev=0x%lx, dev_name=%s\n", @@ -151,13 +153,15 @@ static my_bool test_if_shannon_card_exists() for (dev_no= 1 ; dev_no < 9 ; dev_no++) { - sprintf(path, "/dev/df%c%d", dev_part, dev_no); + snprintf(path, sizeof(path), "/dev/df%c%d", dev_part, dev_no); if (stat(path, &stat_buff) < 0) break; shannon_devices[shannon_found_devices].st_dev= stat_buff.st_rdev; - sprintf(shannon_devices[shannon_found_devices].dev_name, "/dev/sct%c%d", - dev_part, dev_no); + snprintf(shannon_devices[shannon_found_devices].dev_name, + sizeof(shannon_devices[shannon_found_devices].dev_name), + "/dev/sct%c%d", + dev_part, dev_no); #ifdef TEST_SHANNON printf("%s(): i=%d, st_dev=0x%lx, st_rdev=0x%lx, dev_name=%s\n", diff --git a/mysys/my_compress.c b/mysys/my_compress.c index 11603e7ba2403..e30d42c2dbf7c 100644 --- a/mysys/my_compress.c +++ b/mysys/my_compress.c @@ -1,4 +1,5 @@ /* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2022, 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 @@ -57,35 +58,11 @@ my_bool my_compress(uchar *packet, size_t *len, size_t *complen) } -/* - Valgrind normally gives false alarms for zlib operations, in the form of - "conditional jump depends on uninitialised values" etc. The reason is - explained in the zlib FAQ (http://www.zlib.net/zlib_faq.html#faq36): - - "That is intentional for performance reasons, and the output of deflate - is not affected." - - Also discussed on a blog - (http://www.sirena.org.uk/log/2006/02/19/zlib-generating-valgrind-warnings/): - - "...loop unrolling in the zlib library causes the mentioned - “Conditional jump or move depends on uninitialised value(s)” - warnings. These are safe since the results of the comparison are - subsequently ignored..." - - "the results of the calculations are discarded by bounds checking done - after the loop exits" - - Fix by initializing the memory allocated by zlib when running under Valgrind. - - This fix is safe, since such memory is only used internally by zlib, so we - will not hide any bugs in mysql this way. -*/ void *my_az_allocator(void *dummy __attribute__((unused)), unsigned int items, unsigned int size) { return my_malloc(key_memory_my_compress_alloc, (size_t)items*(size_t)size, - IF_VALGRIND(MY_ZEROFILL, MYF(0))); + MYF(0)); } void my_az_free(void *dummy __attribute__((unused)), void *address) diff --git a/mysys/my_delete.c b/mysys/my_delete.c index 25c0f4657af59..6854033f84b2b 100644 --- a/mysys/my_delete.c +++ b/mysys/my_delete.c @@ -82,6 +82,7 @@ int my_delete(const char *name, myf MyFlags) Symbolic link are deleted without renaming. Directories are not deleted. */ #include + static int my_win_unlink(const char *name) { HANDLE handle= INVALID_HANDLE_VALUE; @@ -89,99 +90,113 @@ static int my_win_unlink(const char *name) uint last_error; char unique_filename[MAX_PATH + 35]; unsigned long long tsc; /* time stamp counter, for unique filename*/ - + int retries; DBUG_ENTER("my_win_unlink"); - attributes= GetFileAttributes(name); - if (attributes == INVALID_FILE_ATTRIBUTES) - { - last_error= GetLastError(); - DBUG_PRINT("error",("GetFileAttributes(%s) failed with %u\n", name, last_error)); - goto error; - } - if (attributes & FILE_ATTRIBUTE_DIRECTORY) - { - DBUG_PRINT("error",("can't remove %s - it is a directory\n", name)); - errno= EINVAL; - DBUG_RETURN(-1); - } - - if (attributes & FILE_ATTRIBUTE_REPARSE_POINT) + DBUG_INJECT_FILE_SHARING_VIOLATION(name); + + for (retries= FILE_SHARING_VIOLATION_RETRIES; ; retries--) { - /* Symbolic link. Delete link, the not target */ - if (!DeleteFile(name)) + attributes= GetFileAttributes(name); + if (attributes == INVALID_FILE_ATTRIBUTES) { - last_error= GetLastError(); - DBUG_PRINT("error",("DeleteFile(%s) failed with %u\n", name,last_error)); - goto error; + last_error= GetLastError(); + DBUG_PRINT("error", + ("GetFileAttributes(%s) failed with %u\n", name, last_error)); + goto error; } - DBUG_RETURN(0); - } - /* - Try Windows 10 method, delete with "posix semantics" (file is not visible, and creating - a file with the same name won't fail, even if it the fiile was open) - */ - struct - { - DWORD _Flags; - } disp={0x3}; - /* 0x3 = FILE_DISPOSITION_FLAG_DELETE | FILE_DISPOSITION_FLAG_POSIX_SEMANTICS */ + if (attributes & FILE_ATTRIBUTE_DIRECTORY) + { + DBUG_PRINT("error", ("can't remove %s - it is a directory\n", name)); + errno= EINVAL; + DBUG_RETURN(-1); + } - handle= CreateFile(name, DELETE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, - NULL, OPEN_EXISTING, 0, NULL); - if (handle != INVALID_HANDLE_VALUE) - { - BOOL ok= SetFileInformationByHandle(handle, - (FILE_INFO_BY_HANDLE_CLASS) 21, &disp, sizeof(disp)); - CloseHandle(handle); - if (ok) + if (attributes & FILE_ATTRIBUTE_REPARSE_POINT) + { + /* Symbolic link. Delete link, the not target */ + if (!DeleteFile(name)) + { + last_error= GetLastError(); + DBUG_PRINT("error", + ("DeleteFile(%s) failed with %u\n", name, last_error)); + goto error; + } DBUG_RETURN(0); - } + } - handle= CreateFile(name, DELETE, 0, NULL, OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, NULL); - if (handle != INVALID_HANDLE_VALUE) - { /* - We opened file without sharing flags (exclusive), no one else has this file - opened, thus it is save to close handle to remove it. No renaming is - necessary. + Try Windows 10 method, delete with "posix semantics" (file is not + visible, and creating a file with the same name won't fail, even if it + the file was open) */ - CloseHandle(handle); - DBUG_RETURN(0); - } + handle= CreateFile(name, DELETE, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, OPEN_EXISTING, 0, NULL); + if (handle != INVALID_HANDLE_VALUE) + { + /* 0x3 = FILE_DISPOSITION_FLAG_DELETE | FILE_DISPOSITION_FLAG_POSIX_SEMANTICS */ + struct {DWORD _Flags;} disp= {0x3}; + BOOL ok= SetFileInformationByHandle( + handle, (FILE_INFO_BY_HANDLE_CLASS) 21, &disp, sizeof(disp)); + CloseHandle(handle); + if (ok) + DBUG_RETURN(0); + } - /* - Can't open file exclusively, hence the file must be already opened by - someone else. Open it for delete (with all FILE_SHARE flags set), - rename to unique name, close. - */ - handle= CreateFile(name, DELETE, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, - NULL, OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, NULL); - if (handle == INVALID_HANDLE_VALUE) - { - last_error= GetLastError(); - DBUG_PRINT("error", - ("CreateFile(%s) with FILE_FLAG_DELETE_ON_CLOSE failed with %u\n", - name,last_error)); - goto error; - } + handle= CreateFile(name, DELETE, 0, NULL, OPEN_EXISTING, + FILE_FLAG_DELETE_ON_CLOSE, NULL); + if (handle != INVALID_HANDLE_VALUE) + { + /* + We opened file without sharing flags (exclusive), no one else has this + file opened, thus it is safe to close handle to remove it. No renaming + is necessary. + */ + CloseHandle(handle); + DBUG_RETURN(0); + } - tsc= my_timer_cycles(); - my_snprintf(unique_filename,sizeof(unique_filename),"%s.%llx.deleted", - name, tsc); - if (!MoveFile(name, unique_filename)) - { - DBUG_PRINT("warning", ("moving %s to unique filename failed, error %lu\n", - name,GetLastError())); - } + /* + Can't open file exclusively, hence the file must be already opened by + someone else. Open it for delete (with all FILE_SHARE flags set), + rename to unique name, close. + */ + handle= CreateFile(name, DELETE, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, NULL); + if (handle == INVALID_HANDLE_VALUE) + { + last_error= GetLastError(); + DBUG_PRINT( + "error", + ("CreateFile(%s) with FILE_FLAG_DELETE_ON_CLOSE failed with %u\n", + name, last_error)); + goto error; + } + + tsc= my_timer_cycles(); + my_snprintf(unique_filename, sizeof(unique_filename), "%s.%llx.deleted", + name, tsc); + if (!MoveFile(name, unique_filename)) + { + DBUG_PRINT("warning", + ("moving %s to unique filename failed, error %lu\n", name, + GetLastError())); + } + CloseHandle(handle); + DBUG_RETURN(0); - CloseHandle(handle); - DBUG_RETURN(0); - error: - my_osmaperr(last_error); - DBUG_RETURN(-1); + if (last_error != ERROR_SHARING_VIOLATION || retries == 0) + { + my_osmaperr(last_error); + DBUG_RETURN(-1); + } + DBUG_CLEAR_FILE_SHARING_VIOLATION(); + Sleep(FILE_SHARING_VIOLATION_DELAY_MS); + } } #endif diff --git a/mysys/my_gethwaddr.c b/mysys/my_gethwaddr.c index 70e1d549e1565..1f344af88fde4 100644 --- a/mysys/my_gethwaddr.c +++ b/mysys/my_gethwaddr.c @@ -23,6 +23,7 @@ #ifndef MAIN +#if defined(_AIX) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__linux__) || defined(__sun) || defined(_WIN32) static my_bool memcpy_and_test(uchar *to, uchar *from, uint len) { uint i, res= 1; @@ -32,9 +33,16 @@ static my_bool memcpy_and_test(uchar *to, uchar *from, uint len) res= 0; return res; } +#endif -#if defined(__APPLE__) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#ifdef __OpenBSD__ +#include +#include +#include +#else #include +#endif #include #include #include @@ -72,7 +80,7 @@ my_bool my_gethwaddr(uchar *to) return res; } -#elif defined(__linux__) || defined(__sun) +#elif defined(_AIX) || defined(__linux__) || defined(__sun) #include #include #include @@ -85,11 +93,15 @@ my_bool my_gethwaddr(uchar *to) my_bool my_gethwaddr(uchar *to) { int fd, res= 1; +#ifdef _AIX + struct ifhwaddr_req ifr[32]; +#else struct ifreq ifr[32]; +#endif struct ifconf ifc; DBUG_ENTER("my_gethwaddr"); - ifc.ifc_req= ifr; + ifc.ifc_req= (struct ifreq *) ifr; ifc.ifc_len= sizeof(ifr); fd = socket(AF_INET, SOCK_DGRAM, 0); @@ -104,9 +116,14 @@ my_bool my_gethwaddr(uchar *to) uint i; for (i= 0; res && i < ifc.ifc_len / sizeof(ifr[0]); i++) { -#ifdef __linux__ +#if defined(_AIX) || defined(__linux__) +#if defined(__linux__) +#define HWADDR_DATA ifr[i].ifr_hwaddr.sa_data +#else +#define HWADDR_DATA ifr[i].ifr_hwaddr +#endif if (ioctl(fd, SIOCGIFHWADDR, &ifr[i]) >= 0) - res= memcpy_and_test(to, (uchar *)&ifr[i].ifr_hwaddr.sa_data, + res= memcpy_and_test(to, (uchar *)&HWADDR_DATA, ETHER_ADDR_LEN); #else /* @@ -195,4 +212,3 @@ int main(int argc __attribute__((unused)),char **argv) return 0; } #endif - diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 653fe8440930c..9f13ca7a4246c 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -1632,7 +1632,8 @@ void my_print_help(const struct my_option *options) } } putchar('\n'); - if ((optp->var_type & GET_TYPE_MASK) == GET_BOOL) + if ((optp->var_type & GET_TYPE_MASK) == GET_BOOL || + (optp->var_type & GET_TYPE_MASK) == GET_BIT) { if (optp->def_value != 0) { diff --git a/mysys/my_largepage.c b/mysys/my_largepage.c index 9cc1e19772b27..b5193a9cd8ea2 100644 --- a/mysys/my_largepage.c +++ b/mysys/my_largepage.c @@ -376,7 +376,7 @@ uchar *my_large_malloc(size_t *size, myf my_flags) ptr= NULL; if (my_flags & MY_WME) { - if (large_page_size) + if (large_page_size && errno == ENOMEM) { my_printf_error(EE_OUTOFMEMORY, "Couldn't allocate %zu bytes (Large/HugeTLB memory " diff --git a/mysys/my_lib.c b/mysys/my_lib.c index ca50699b4c3d8..fb03f0aa5c270 100644 --- a/mysys/my_lib.c +++ b/mysys/my_lib.c @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2008, 2020, MariaDB Corporation. + Copyright (c) 2008, 2022, 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 @@ -332,6 +332,13 @@ int my_fstat(File Filedes, MY_STAT *stat_area, DBUG_PRINT("my",("fd: %d MyFlags: %lu", Filedes, MyFlags)); #ifdef _WIN32 DBUG_RETURN(my_win_fstat(Filedes, stat_area)); +#elif defined HAVE_valgrind + { + int s= fstat(Filedes, stat_area); + if (!s) + MSAN_STAT_WORKAROUND(stat_area); + DBUG_RETURN(s); + } #else DBUG_RETURN(fstat(Filedes, (struct stat *) stat_area)); #endif @@ -350,11 +357,14 @@ MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags) my_flags))) goto error; #ifndef _WIN32 - if (! stat((char *) path, (struct stat *) stat_area) ) - DBUG_RETURN(stat_area); + if (!stat((char *) path, (struct stat *) stat_area)) + { + MSAN_STAT_WORKAROUND(stat_area); + DBUG_RETURN(stat_area); + } #else - if (! my_win_stat(path, stat_area) ) - DBUG_RETURN(stat_area); + if (!my_win_stat(path, stat_area)) + DBUG_RETURN(stat_area); #endif DBUG_PRINT("error",("Got errno: %d from stat", errno)); my_errno= errno; diff --git a/mysys/my_likely.c b/mysys/my_likely.c index 2ae587be18d56..d52074f01e442 100644 --- a/mysys/my_likely.c +++ b/mysys/my_likely.c @@ -76,7 +76,7 @@ void end_my_likely(FILE *out) if (!(likely_file= out)) { char name[80]; - sprintf(name, "/tmp/unlikely-%lu.out", (ulong) getpid()); + snprintf(name, sizeof(name), "/tmp/unlikely-%lu.out", (ulong) getpid()); if ((likely_file= my_fopen(name, O_TRUNC | O_WRONLY, MYF(MY_WME)))) do_close= 1; else diff --git a/mysys/my_lockmem.c b/mysys/my_lockmem.c index a3ad7a5b76c96..1b6b68816f8cc 100644 --- a/mysys/my_lockmem.c +++ b/mysys/my_lockmem.c @@ -1,4 +1,5 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2022, 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 @@ -17,6 +18,7 @@ #include "mysys_priv.h" #include "mysys_err.h" +#include "aligned.h" #include #ifdef HAVE_MLOCK @@ -39,7 +41,7 @@ uchar *my_malloc_lock(uint size,myf MyFlags) DBUG_ENTER("my_malloc_lock"); size=((size-1) & ~(pagesize-1))+pagesize; - if (!(ptr=memalign(pagesize,size))) + if (!(ptr=aligned_malloc(size,pagesize))) { if (MyFlags & (MY_FAE+MY_WME)) my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_FATAL), size); @@ -91,7 +93,7 @@ void my_free_lock(uchar *ptr) } mysql_mutex_unlock(&THR_LOCK_malloc); my_free(element); - free(ptr); /* Free even if not locked */ + aligned_free(ptr); /* Free even if not locked */ } #endif /* HAVE_MLOCK */ diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c index b2cbb84984dbc..b8f64de589e45 100644 --- a/mysys/my_malloc.c +++ b/mysys/my_malloc.c @@ -59,6 +59,7 @@ void set_malloc_size_cb(MALLOC_SIZE_CB func) /** Allocate a sized block of memory. + @param key Key to register instrumented memory @param size The size of the memory block in bytes. @param flags Failure action modifiers (bitmasks). @@ -120,7 +121,8 @@ void *my_malloc(PSI_memory_key key, size_t size, myf my_flags) /** @brief wrapper around realloc() - @param old_point pointer to currently allocated area + @param key key to register instrumented memory + @param old_point pointer to currently allocated area @param size new size requested, must be >0 @param my_flags flags diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index 0e7668767928c..9bedfe36593d6 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -261,7 +261,6 @@ int sigwait(sigset_t *setp, int *sigp) pthread_attr_init(&thr_attr); pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS); pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED); - pthread_attr_setstacksize(&thr_attr,8196); pthread_create(&sigwait_thread_id, &thr_attr, sigwait_thread, setp); pthread_attr_destroy(&thr_attr); } diff --git a/mysys/my_rename.c b/mysys/my_rename.c index 93a59342b6cee..cc3ed7271689e 100644 --- a/mysys/my_rename.c +++ b/mysys/my_rename.c @@ -34,38 +34,24 @@ */ static BOOL win_rename_with_retries(const char *from, const char *to) { -#ifndef DBUG_OFF - FILE *fp = NULL; - DBUG_EXECUTE_IF("rename_sharing_violation", - { - fp= fopen(from, "r"); - DBUG_ASSERT(fp); - } - ); -#endif + DBUG_INJECT_FILE_SHARING_VIOLATION(from); - for (int retry= RENAME_MAX_RETRIES; retry--;) + for (int retry= FILE_SHARING_VIOLATION_RETRIES; retry--;) { - DWORD ret = MoveFileEx(from, to, + BOOL ret= MoveFileEx(from, to, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING); - DBUG_ASSERT(fp == NULL || (ret == FALSE && GetLastError() == ERROR_SHARING_VIOLATION)); + DBUG_CLEAR_FILE_SHARING_VIOLATION(); - if (!ret && (GetLastError() == ERROR_SHARING_VIOLATION)) - { -#ifndef DBUG_OFF - /* - If error was injected in via DBUG_EXECUTE_IF, close the file - that is causing ERROR_SHARING_VIOLATION, so that retry succeeds. - */ - if (fp) - { - fclose(fp); - fp= NULL; - } -#endif + if (ret) + return ret; - Sleep(10); + DWORD last_error= GetLastError(); + + if (last_error == ERROR_SHARING_VIOLATION || + last_error == ERROR_ACCESS_DENIED) + { + Sleep(FILE_SHARING_VIOLATION_DELAY_MS); } else return ret; diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c index 323ae69a39c01..8238e501e7f47 100644 --- a/mysys/my_symlink.c +++ b/mysys/my_symlink.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001, 2011, Oracle and/or its affiliates - Copyright (c) 2010, 2017, MariaDB + Copyright (c) 2010, 2022, 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 @@ -113,7 +113,10 @@ int my_is_symlink(const char *filename __attribute__((unused))) { #if defined (HAVE_LSTAT) && defined (S_ISLNK) struct stat stat_buff; - return !lstat(filename, &stat_buff) && S_ISLNK(stat_buff.st_mode); + if (lstat(filename, &stat_buff)) + return 0; + MSAN_STAT_WORKAROUND(&stat_buff); + return !!S_ISLNK(stat_buff.st_mode); #elif defined (_WIN32) DWORD dwAttr = GetFileAttributes(filename); return (dwAttr != INVALID_FILE_ATTRIBUTES) && diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index cde34e5bdb974..fd8a99c21967d 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -421,7 +421,7 @@ const char *my_thread_name(void) if (!tmp->name[0]) { my_thread_id id= my_thread_dbug_id(); - sprintf(name_buff,"T@%lu", (ulong) id); + snprintf(name_buff, sizeof(name_buff), "T@%lu", (ulong) id); strmake_buf(tmp->name, name_buff); } return tmp->name; diff --git a/mysys/my_win_popen.cc b/mysys/my_win_popen.cc index f41f54100f1bf..cceb77e901966 100644 --- a/mysys/my_win_popen.cc +++ b/mysys/my_win_popen.cc @@ -92,7 +92,7 @@ extern "C" FILE *my_win_popen(const char *cmd, const char *mode) goto error; break; default: - /* Unknown mode, �xpected "r", "rt", "w", "wt" */ + /* Unknown mode, expected "r", "rt", "w", "wt" */ abort(); } if (!SetHandleInformation(parent_pipe_end, HANDLE_FLAG_INHERIT, 0)) diff --git a/mysys/my_winfile.c b/mysys/my_winfile.c index 70131896d5979..35bc6b35399f1 100644 --- a/mysys/my_winfile.c +++ b/mysys/my_winfile.c @@ -102,6 +102,42 @@ static int my_get_open_flags(File fd) DBUG_RETURN(my_file_info[fd].oflag); } +/* + CreateFile with retry logic. + + Uses retries, to avoid or reduce CreateFile errors + with ERROR_SHARING_VIOLATION, in case the file is opened + by another process, which used incompatible sharing + flags when opening. + + See Windows' CreateFile() documentation for details. +*/ +static HANDLE my_create_file_with_retries( + LPCSTR lpFileName, DWORD dwDesiredAccess, + DWORD dwShareMode, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, + DWORD dwCreationDisposition, + DWORD dwFlagsAndAttributes, + HANDLE hTemplateFile) +{ + int retries; + DBUG_INJECT_FILE_SHARING_VIOLATION(lpFileName); + + for (retries = FILE_SHARING_VIOLATION_RETRIES;;) + { + HANDLE h= CreateFile(lpFileName, dwDesiredAccess, dwShareMode, + lpSecurityAttributes, dwCreationDisposition, + dwFlagsAndAttributes, hTemplateFile); + DBUG_CLEAR_FILE_SHARING_VIOLATION(); + + if (h != INVALID_HANDLE_VALUE || + GetLastError() != ERROR_SHARING_VIOLATION || --retries == 0) + return h; + + Sleep(FILE_SHARING_VIOLATION_DELAY_MS); + } + return INVALID_HANDLE_VALUE; +} /* Default security attributes for files and directories @@ -262,16 +298,15 @@ File my_win_sopen(const char *path, int oflag, int shflag, int pmode) fileattrib|= FILE_FLAG_RANDOM_ACCESS; /* try to open/create the file */ - if ((osfh= CreateFile(path, fileaccess, fileshare,my_win_file_secattr(), + if ((osfh= my_create_file_with_retries(path, fileaccess, fileshare,my_win_file_secattr(), filecreate, fileattrib, NULL)) == INVALID_HANDLE_VALUE) { - /* - OS call to open/create file failed! map the error, release - the lock, and return -1. note that it's not necessary to - call _free_osfhnd (it hasn't been used yet). - */ - my_osmaperr(GetLastError()); /* map error */ - DBUG_RETURN(-1); /* return error to caller */ + DWORD last_error= GetLastError(); + if (last_error == ERROR_PATH_NOT_FOUND && strlen(path) >= MAX_PATH) + errno= ENAMETOOLONG; + else + my_osmaperr(last_error); /* map error */ + DBUG_RETURN(-1); } if ((fh= my_open_osfhandle(osfh, diff --git a/mysys/mysys_priv.h b/mysys/mysys_priv.h index c5e05ec7955dd..e795dbe2f5fa8 100644 --- a/mysys/mysys_priv.h +++ b/mysys/mysys_priv.h @@ -205,6 +205,45 @@ extern int my_win_fsync(File fd); extern File my_win_dup(File fd); extern File my_win_sopen(const char *path, int oflag, int shflag, int perm); extern File my_open_osfhandle(HANDLE handle, int oflag); + + +/* + The following constants are related to retries when file operation fails with + ERROR_FILE_SHARING_VIOLATION +*/ +#define FILE_SHARING_VIOLATION_RETRIES 50 +#define FILE_SHARING_VIOLATION_DELAY_MS 10 + + +/* DBUG injecting of ERROR_FILE_SHARING_VIOLATION */ +#ifndef DBUG_OFF +/* Open file, without sharing. if specific DBUG keyword is set */ +#define DBUG_INJECT_FILE_SHARING_VIOLATION(filename) \ + FILE *fp= NULL; \ + do \ + { \ + DBUG_EXECUTE_IF("file_sharing_violation", \ + fp= _fsopen(filename, "r", _SH_DENYRW);); \ + } while (0) + +/* Close the file that causes ERROR_FILE_SHARING_VIOLATION.*/ +#define DBUG_CLEAR_FILE_SHARING_VIOLATION() \ + do \ + { \ + if (fp) \ + { \ + DWORD tmp_err= GetLastError(); \ + fclose(fp); \ + SetLastError(tmp_err); \ + fp= NULL; \ + } \ + } while (0) + +#else +#define DBUG_INJECT_FILE_SHARING_VIOLATION(filename) do {} while (0) +#define DBUG_CLEAR_FILE_SHARING_VIOLATION() do {} while (0) +#endif + #endif C_MODE_END diff --git a/mysys/psi_noop.c b/mysys/psi_noop.c index e81ad4893b714..403be3c94e9a7 100644 --- a/mysys/psi_noop.c +++ b/mysys/psi_noop.c @@ -1,17 +1,29 @@ -/* Copyright (c) 2011, 2016, Oracle and/or its affiliates. +/* Copyright (c) 2011, 2022, Oracle and/or its affiliates. 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. + it under the terms of the GNU General Public License, version 2.0, + as published by the Free Software Foundation. + + This program is also distributed with certain software (including + but not limited to OpenSSL) that is licensed under separate terms, + as designated in a particular file or component or in included license + documentation. The authors of MySQL hereby grant you an additional + permission to link the program and your derivative works with the + separately licensed software that they have included with MySQL. + + Without limiting anything contained in the foregoing, this file, + which is part of C Driver for MySQL (Connector/C), is also subject to the + Universal FOSS Exception, version 1.0, a copy of which can be found at + http://oss.oracle.com/licenses/universal-foss-exception. 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. + GNU General Public License, version 2.0, 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, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /* Always provide the noop performance interface, for plugins. @@ -262,6 +274,11 @@ static void set_thread_noop(PSI_thread* thread NNN) return; } +static void set_thread_peer_port_noop(PSI_thread * thread NNN, uint port NNN) +{ + return; +} + static void delete_current_thread_noop(void) { return; @@ -481,7 +498,7 @@ static void end_file_rename_wait_noop(PSI_file_locker *locker NNN, static PSI_stage_progress* start_stage_noop(PSI_stage_key key NNN, - const char *src_file NNN, int src_line NNN) + const char *src_file NNN, int src_line NNN) { return NULL; } @@ -776,9 +793,9 @@ digest_end_noop(PSI_digest_locker *locker NNN, } static int -set_thread_connect_attrs_noop(const char *buffer NNN, - uint length NNN, - const void *from_cs NNN) +set_thread_connect_attrs_noop(const char *buffer __attribute__ ((unused)), + uint length __attribute__ ((unused)), + const void *from_cs __attribute__ ((unused))) { return 0; } @@ -1025,7 +1042,9 @@ static PSI PSI_noop= set_metadata_lock_status_noop, destroy_metadata_lock_noop, start_metadata_wait_noop, - end_metadata_wait_noop + end_metadata_wait_noop, + + set_thread_peer_port_noop }; /** diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 844d8a0b28fca..f203bba4d8d9a 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -34,6 +34,9 @@ #include #endif +#ifdef HAVE_gcov +#include +#endif /** Default handler for printing stacktrace */ @@ -409,9 +412,6 @@ void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack, /* Produce a core for the thread */ void my_write_core(int sig) { -#ifdef HAVE_gcov - extern void __gcov_flush(void); -#endif signal(sig, SIG_DFL); #ifdef HAVE_gcov /* @@ -419,7 +419,7 @@ void my_write_core(int sig) information from this process, causing gcov output to be incomplete. So we force the writing of coverage information here before terminating. */ - __gcov_flush(); + __gcov_dump(); #endif pthread_kill(pthread_self(), sig); #if defined(P_MYID) && !defined(SCO) diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 666f444b51c4f..b98775e109911 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -106,7 +106,6 @@ void init_thr_alarm(uint max_alarms) pthread_attr_init(&thr_attr); pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS); pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED); - pthread_attr_setstacksize(&thr_attr,8196); mysql_thread_create(key_thread_alarm, &alarm_thread, &thr_attr, alarm_handler, NULL); pthread_attr_destroy(&thr_attr); diff --git a/mysys_ssl/my_crypt.cc b/mysys_ssl/my_crypt.cc index 4d7ebc7bd2765..00447e73d79d3 100644 --- a/mysys_ssl/my_crypt.cc +++ b/mysys_ssl/my_crypt.cc @@ -101,7 +101,7 @@ class MyCTX_nopad : public MyCTX uchar source_tail[MY_AES_BLOCK_SIZE]; MyCTX_nopad() : MyCTX() { } - ~MyCTX_nopad() { } + ~MyCTX_nopad() = default; int init(const EVP_CIPHER *cipher, int encrypt, const uchar *key, uint klen, const uchar *iv, uint ivlen) diff --git a/mysys_ssl/my_md5.cc b/mysys_ssl/my_md5.cc index 407dee3bc69a0..75995bccf9067 100644 --- a/mysys_ssl/my_md5.cc +++ b/mysys_ssl/my_md5.cc @@ -52,12 +52,23 @@ static void md5_result(EVP_MD_CTX *context, uchar digest[MD5_HASH_SIZE]) static void md5_init(EVP_MD_CTX *context) { +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + EVP_MD *md5; + EVP_MD_CTX_init(context); + /* Ok to ignore FIPS: MD5 is not used for crypto here */ + /* In OpenSSL 3.0.0+ it is a different EVP_MD provider */ + md5 = EVP_MD_fetch(NULL, "MD5", "fips=no"); + EVP_DigestInit_ex(context, md5, NULL); + EVP_MD_free(md5); +#else EVP_MD_CTX_init(context); #ifdef EVP_MD_CTX_FLAG_NON_FIPS_ALLOW /* Ok to ignore FIPS: MD5 is not used for crypto here */ + /* In OpenSSL 1.1.1 the non FIPS allowed flag is context specific */ EVP_MD_CTX_set_flags(context, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); #endif EVP_DigestInit_ex(context, EVP_md5(), NULL); +#endif } static void md5_input(EVP_MD_CTX *context, const uchar *buf, unsigned len) diff --git a/mysys_ssl/my_sha.ic b/mysys_ssl/my_sha.inl similarity index 100% rename from mysys_ssl/my_sha.ic rename to mysys_ssl/my_sha.inl diff --git a/mysys_ssl/my_sha1.cc b/mysys_ssl/my_sha1.cc index b53e214468de2..29563742e6b09 100644 --- a/mysys_ssl/my_sha1.cc +++ b/mysys_ssl/my_sha1.cc @@ -15,4 +15,4 @@ #define NUM 1 -#include "my_sha.ic" +#include "my_sha.inl" diff --git a/mysys_ssl/my_sha224.cc b/mysys_ssl/my_sha224.cc index 200b6ed161c09..5fffdce779406 100644 --- a/mysys_ssl/my_sha224.cc +++ b/mysys_ssl/my_sha224.cc @@ -15,4 +15,4 @@ #define NUM 224 -#include "my_sha.ic" +#include "my_sha.inl" diff --git a/mysys_ssl/my_sha256.cc b/mysys_ssl/my_sha256.cc index 1562809f91a31..59e871de12142 100644 --- a/mysys_ssl/my_sha256.cc +++ b/mysys_ssl/my_sha256.cc @@ -15,4 +15,4 @@ #define NUM 256 -#include "my_sha.ic" +#include "my_sha.inl" diff --git a/mysys_ssl/my_sha384.cc b/mysys_ssl/my_sha384.cc index 6bb6447010556..40707de0a8dbd 100644 --- a/mysys_ssl/my_sha384.cc +++ b/mysys_ssl/my_sha384.cc @@ -15,4 +15,4 @@ #define NUM 384 -#include "my_sha.ic" +#include "my_sha.inl" diff --git a/mysys_ssl/my_sha512.cc b/mysys_ssl/my_sha512.cc index 1047d0dbe4633..6a5a04d72f039 100644 --- a/mysys_ssl/my_sha512.cc +++ b/mysys_ssl/my_sha512.cc @@ -15,4 +15,4 @@ #define NUM 512 -#include "my_sha.ic" +#include "my_sha.inl" diff --git a/plugin/auth_gssapi/CMakeLists.txt b/plugin/auth_gssapi/CMakeLists.txt index 1bf727ddf2ebc..8c82d335ab2cc 100644 --- a/plugin/auth_gssapi/CMakeLists.txt +++ b/plugin/auth_gssapi/CMakeLists.txt @@ -38,6 +38,7 @@ ELSE() IF(HAVE_KRB5_XFREE) ADD_DEFINITIONS(-DHAVE_KRB5_XFREE=1) ENDIF() + MY_CHECK_AND_SET_COMPILER_FLAG(-Wl,--as-needed) ELSE() # Can't build plugin diff --git a/plugin/auth_pam/auth_pam.c b/plugin/auth_pam/auth_pam.c index 35272c6b7cd58..ffcfa019294d9 100644 --- a/plugin/auth_pam/auth_pam.c +++ b/plugin/auth_pam/auth_pam.c @@ -15,14 +15,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ +#include #include #include #include #include #include +#include #include #include "auth_pam_tool.h" -#include #ifndef DBUG_OFF static char pam_debug = 0; @@ -51,71 +52,57 @@ static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info) unsigned char field, *pkt; unsigned int n_sleep= 0; useconds_t sleep_time= 100; + posix_spawn_file_actions_t file_actions; + char toolpath[FN_REFLEN]; + size_t plugin_dir_len= strlen(opt_plugin_dir); + char *const argv[2]= {toolpath, 0}; + int res; PAM_DEBUG((stderr, "PAM: opening pipes.\n")); if (pipe(p_to_c) < 0 || pipe(c_to_p) < 0) { - /* Error creating pipes. */ + my_printf_error(ENOEXEC, "pam: cannot create pipes (errno: %M)", + ME_ERROR_LOG_ONLY, errno); return CR_ERROR; } - PAM_DEBUG((stderr, "PAM: forking.\n")); - if ((proc_id= fork()) < 0) - { - /* Error forking. */ - close(p_to_c[0]); - close(c_to_p[1]); - goto error_ret; - } - if (proc_id == 0) + if (plugin_dir_len + tool_name_len + 2 > sizeof(toolpath)) { - /* The 'sandbox' process started. */ - char toolpath[FN_REFLEN]; - size_t plugin_dir_len= strlen(opt_plugin_dir); - - PAM_DEBUG((stderr, "PAM: Child process prepares pipes.\n")); - - if (close(p_to_c[1]) < 0 || - close(c_to_p[0]) < 0 || - dup2(p_to_c[0], 0) < 0 || /* Parent's pipe to STDIN. */ - dup2(c_to_p[1], 1) < 0) /* Sandbox's pipe to STDOUT. */ - { - exit(-1); - } + my_printf_error(ENOEXEC, "pam: too long path to /%s", + ME_ERROR_LOG_ONLY, tool_name); + return CR_ERROR; + } - PAM_DEBUG((stderr, "PAM: check tool directory: %s, %s.\n", - opt_plugin_dir, tool_name)); - if (plugin_dir_len + tool_name_len + 2 > sizeof(toolpath)) - { - /* Tool path too long. */ - exit(-1); - } + memcpy(toolpath, opt_plugin_dir, plugin_dir_len); + if (plugin_dir_len && toolpath[plugin_dir_len-1] != FN_LIBCHAR) + toolpath[plugin_dir_len++]= FN_LIBCHAR; + memcpy(toolpath+plugin_dir_len, tool_name, tool_name_len+1); - memcpy(toolpath, opt_plugin_dir, plugin_dir_len); - if (plugin_dir_len && toolpath[plugin_dir_len-1] != FN_LIBCHAR) - toolpath[plugin_dir_len++]= FN_LIBCHAR; - memcpy(toolpath+plugin_dir_len, tool_name, tool_name_len+1); - - PAM_DEBUG((stderr, "PAM: execute pam sandbox [%s].\n", toolpath)); - (void) execl(toolpath, toolpath, NULL); - PAM_DEBUG((stderr, "PAM: exec() failed.\n")); - my_printf_error(1, "PAM: Cannot execute %s (errno: %M)", ME_ERROR_LOG_ONLY, - toolpath, errno); - exit(-1); - } + PAM_DEBUG((stderr, "PAM: forking %s\n", toolpath)); + res= posix_spawn_file_actions_init(&file_actions) || + posix_spawn_file_actions_addclose(&file_actions, p_to_c[1]) || + posix_spawn_file_actions_addclose(&file_actions, c_to_p[0]) || + posix_spawn_file_actions_adddup2(&file_actions, p_to_c[0], 0) || + posix_spawn_file_actions_adddup2(&file_actions, c_to_p[1], 1) || + posix_spawn(&proc_id, toolpath, &file_actions, NULL, argv, NULL); /* Parent process continues. */ + posix_spawn_file_actions_destroy(&file_actions); + close(p_to_c[0]); + close(c_to_p[1]); - PAM_DEBUG((stderr, "PAM: parent continues.\n")); - if (close(p_to_c[0]) < 0 || - close(c_to_p[1]) < 0) + if (res) + { + my_printf_error(ENOEXEC, "pam: cannot exec %s (errno: %M)", + ME_ERROR_LOG_ONLY, toolpath, errno); goto error_ret; + } /* no user name yet ? read the client handshake packet with the user name */ if (info->user_name == 0) { if ((pkt_len= vio->read_packet(vio, &pkt)) < 0) - return CR_ERROR; + goto error_ret; } else pkt= NULL; diff --git a/plugin/auth_pam/testing/pam_mariadb_mtr.c b/plugin/auth_pam/testing/pam_mariadb_mtr.c index f61a8da768269..108aeb941ac88 100644 --- a/plugin/auth_pam/testing/pam_mariadb_mtr.c +++ b/plugin/auth_pam/testing/pam_mariadb_mtr.c @@ -45,6 +45,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags __attribute__((unused)), else { free(resp); + resp= NULL; msg[0].msg_style = PAM_PROMPT_ECHO_ON; msg[0].msg = (char*)"PIN:"; pam_err = (*conv->conv)(1, msgp, &resp, conv->appdata_ptr); diff --git a/plugin/cracklib_password_check/cracklib_password_check.c b/plugin/cracklib_password_check/cracklib_password_check.c index 95f8e11fe0e89..1aaf6ba06936f 100644 --- a/plugin/cracklib_password_check/cracklib_password_check.c +++ b/plugin/cracklib_password_check/cracklib_password_check.c @@ -13,10 +13,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ +#include #include #include #include -#include #include static char *dictionary; diff --git a/plugin/disks/CMakeLists.txt b/plugin/disks/CMakeLists.txt index 446c64d0fdddf..4e40842cad0ba 100644 --- a/plugin/disks/CMakeLists.txt +++ b/plugin/disks/CMakeLists.txt @@ -1,5 +1,24 @@ -IF("${CMAKE_SYSTEM}" MATCHES "Linux") +INCLUDE (CheckIncludeFiles) + +CHECK_SYMBOL_EXISTS (getmntent "mntent.h" HAVE_GETMNTENT) +CHECK_SYMBOL_EXISTS (getmntent "sys/mnttab.h" HAVE_GETMNTENT_IN_SYS_MNTAB) +CHECK_SYMBOL_EXISTS (setmntent "mntent.h" HAVE_SETMNTENT) +CHECK_SYMBOL_EXISTS (getmntinfo "sys/types.h;sys/mount.h" HAVE_GETMNTINFO) +CHECK_SYMBOL_EXISTS (getmntinfo64 "sys/types.h;sys/mount.h" HAVE_GETMNTINFO64) + +IF (HAVE_GETMNTINFO) +CHECK_CXX_SOURCE_COMPILES(" +#include +#include +int main() +{ + struct statvfs *s; + return getmntinfo(&s, ST_WAIT); +} + " HAVE_GETMNTINFO_TAKES_statvfs) +ENDIF() +IF (HAVE_GETMNTENT OR HAVE_GETMNTENT_IN_SYS_MNTAB OR + HAVE_GETMNTINFO OR HAVE_GETMNTINFO64) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql) MYSQL_ADD_PLUGIN(DISKS information_schema_disks.cc MODULE_ONLY RECOMPILE_FOR_EMBEDDED) ENDIF() - diff --git a/plugin/disks/information_schema_disks.cc b/plugin/disks/information_schema_disks.cc index 042cfaffaa4fd..15e26dad12a1e 100644 --- a/plugin/disks/information_schema_disks.cc +++ b/plugin/disks/information_schema_disks.cc @@ -17,11 +17,45 @@ #include #include #include +#if defined(HAVE_GETMNTENT) #include +#elif !defined(HAVE_GETMNTINFO_TAKES_statvfs) +/* getmntinfo (the not NetBSD variants) */ +#include +#include +#include +#endif +#if defined(HAVE_GETMNTENT_IN_SYS_MNTAB) +#include +#define HAVE_GETMNTENT +#endif #include #include #include /* check_global_access() */ +/* + This intends to support *BSD's, macOS, Solaris, AIX, HP-UX, and Linux. + + specificly: + FreeBSD/OpenBSD/DragonFly (statfs) NetBSD (statvfs) uses getmntinfo(). + macOS uses getmntinfo64(). + Linux can use getmntent_r(), but we've just used getmntent for simplification. + Linux/Solaris/AIX/HP-UX uses setmntent()/getmntent(). + Solaris uses getmntent() with a diffent prototype, return structure, and + no setmntent(fopen instead) +*/ +#if defined(HAVE_GETMNTINFO_TAKES_statvfs) || defined(HAVE_GETMNTENT) +typedef struct statvfs st_info; +#elif defined(HAVE_GETMNTINFO64) +typedef struct statfs64 st_info; +#else // GETMNTINFO +typedef struct statfs st_info; +#endif +#ifndef MOUNTED +/* HPUX - https://docstore.mik.ua/manuals/hp-ux/en/B2355-60130/getmntent.3X.html */ +#define MOUNTED MNT_MNTTAB +#endif + bool schema_table_store_record(THD *thd, TABLE *table); @@ -41,24 +75,40 @@ ST_FIELD_INFO disks_table_fields[]= }; - -int disks_table_add_row(THD* pThd, - TABLE* pTable, - const char* zDisk, - const char* zPath, - const struct statvfs& info) +static int disks_table_add_row_stat( + THD* pThd, + TABLE* pTable, + const char* zDisk, + const char* zPath, + const st_info &info) { // From: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/statvfs.h.html + // and same for statfs: + // From: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/statfs.2.html#//apple_ref/doc/man/2/statfs + // and: https://www.freebsd.org/cgi/man.cgi?query=statfs&sektion=2&apropos=0&manpath=FreeBSD+13.1-RELEASE+and+Ports // - // f_frsize Fundamental file system block size. + // f_bsize Fundamental file system block size. // f_blocks Total number of blocks on file system in units of f_frsize. // f_bfree Total number of free blocks. // f_bavail Number of free blocks available to non-privileged process. + ulong block_size= (ulong) info.f_bsize; - ulonglong total = ((ulonglong)info.f_frsize * info.f_blocks) / 1024; - ulonglong used = ((ulonglong)info.f_frsize * + ulonglong total = ((ulonglong) block_size * info.f_blocks) / 1024; + ulonglong used = ((ulonglong) block_size * (info.f_blocks - info.f_bfree)) / 1024; - ulonglong avail = ((ulonglong)info.f_frsize * info.f_bavail) / 1024; + ulonglong avail = ((ulonglong) block_size * info.f_bavail) / 1024; + + /* skip filesystems that don't have any space */ + if (!info.f_blocks) + return 0; + + /* skip RO mounted filesystems */ +#if defined(HAVE_GETMNTINFO_TAKES_statvfs) || defined(HAVE_GETMNTENT) + if (info.f_flag & ST_RDONLY) +#else + if (info.f_flags & MNT_RDONLY) +#endif + return 0; pTable->field[0]->store(zDisk, strlen(zDisk), system_charset_info); pTable->field[1]->store(zPath, strlen(zPath), system_charset_info); @@ -70,71 +120,147 @@ int disks_table_add_row(THD* pThd, return (schema_table_store_record(pThd, pTable) != 0) ? 1 : 0; } -int disks_table_add_row(THD* pThd, TABLE* pTable, const char* zDisk, const char* zPath) + +#ifdef HAVE_GETMNTENT +static int disks_table_add_row(THD* pThd, TABLE* pTable, const char* zDisk, const char* zPath) { int rv = 0; - struct statvfs info; + st_info info; if (statvfs(zPath, &info) == 0) // We ignore failures. { - rv = disks_table_add_row(pThd, pTable, zDisk, zPath, info); + rv = disks_table_add_row_stat(pThd, pTable, zDisk, zPath, info); } return rv; } +#endif + -int disks_fill_table(THD* pThd, TABLE_LIST* pTables, Item* pCond) +#ifdef HAVE_GETMNTINFO +static int disks_fill_table(THD* pThd, TABLE_LIST* pTables, Item* pCond) { - int rv = 1; - TABLE* pTable = pTables->table; + st_info *s; + int count, rv= 0; + TABLE* pTable= pTables->table; if (check_global_access(pThd, FILE_ACL, true)) - return 0; + return 0; + +#if defined(HAVE_GETMNTINFO_TAKES_statvfs) + count= getmntinfo(&s, ST_WAIT); +#elif defined(HAVE_GETMNTINFO64) + count= getmntinfo64(&s, MNT_WAIT); +#else + count= getmntinfo(&s, MNT_WAIT); +#endif + if (count == 0) + return 1; + + while (count && rv == 0) + { + rv= disks_table_add_row_stat(pThd, pTable, s->f_mntfromname, s->f_mntonname, *s); + count--; + s++; + } + return rv; +} +#else /* HAVE_GETMNTINFO */ + +static mysql_mutex_t m_getmntent; - FILE* pFile = setmntent("/etc/mtab", "r"); +/* HAVE_GETMNTENT */ +static int disks_fill_table(THD* pThd, TABLE_LIST* pTables, Item* pCond) +{ + int rv= 1; +#ifdef HAVE_SETMNTENT + struct mntent* pEnt; +#else + struct mnttab mnttabent, *pEnt= &mnttabent; +#endif + FILE* pFile; + TABLE* pTable= pTables->table; - if (pFile) + if (check_global_access(pThd, FILE_ACL, true)) + return 0; + +#ifdef HAVE_SETMNTENT + pFile= setmntent(MOUNTED, "r"); +#else + /* Solaris */ + pFile= fopen("/etc/mnttab", "r"); +#endif + + if (!pFile) + return 1; + + rv= 0; + + /* + We lock the outer loop rather than between getmntent so the multiple + infomation_schema.disks reads don't all start blocking each other and + no-one gets any answers. + */ + mysql_mutex_lock(&m_getmntent); + + while ((rv == 0) && +#if defined(HAVE_SETMNTENT) + (pEnt = getmntent(pFile)) + +#else + getmntent(pFile, pEnt) != 0 +#endif + ) { - const size_t BUFFER_SIZE = 4096; // 4K should be sufficient. - - char* pBuffer = new (std::nothrow) char [BUFFER_SIZE]; - - if (pBuffer) - { - rv = 0; - - struct mntent ent; - struct mntent* pEnt; - - while ((rv == 0) && (pEnt = getmntent_r(pFile, &ent, pBuffer, BUFFER_SIZE))) - { - // We only report the ones that refer to physical disks. - if (pEnt->mnt_fsname[0] == '/') - { - rv = disks_table_add_row(pThd, pTable, pEnt->mnt_fsname, pEnt->mnt_dir); - } - } - - delete [] pBuffer; - } - else - { - rv = 1; - } - - endmntent(pFile); + struct stat f; + const char *path, *point; +#ifdef HAVE_SETMNTENT + path= pEnt->mnt_dir; + point= pEnt->mnt_fsname; +#else + path= pEnt->mnt_mountp; + point= pEnt->mnt_special; +#endif + // Try to keep to real storage by excluding + // read only mounts, and mount points that aren't directories + if (hasmntopt(pEnt, MNTOPT_RO) != NULL) + continue; + if (stat(path, &f)) + continue; + if (!S_ISDIR(f.st_mode)) + continue; + rv= disks_table_add_row(pThd, pTable, point, path); } + mysql_mutex_unlock(&m_getmntent); + +#ifdef HAVE_SETMNTENT + endmntent(pFile); +#else + fclose(pFile); +#endif return rv; } +#endif /* HAVE_GETMNTINFO */ -int disks_table_init(void *ptr) +static int disks_table_init(void *ptr) { ST_SCHEMA_TABLE* pSchema_table = (ST_SCHEMA_TABLE*)ptr; pSchema_table->fields_info = disks_table_fields; pSchema_table->fill_table = disks_fill_table; +#ifndef HAVE_GETMNTINFO + mysql_mutex_init(0, &m_getmntent, MY_MUTEX_INIT_SLOW); +#endif + return 0; +} + +static int disks_table_deinit(void *ptr __attribute__((unused))) +{ +#ifndef HAVE_GETMNTINFO + mysql_mutex_destroy(&m_getmntent); +#endif return 0; } @@ -148,15 +274,15 @@ maria_declare_plugin(disks) MYSQL_INFORMATION_SCHEMA_PLUGIN, &disks_table_info, /* type-specific descriptor */ "DISKS", /* table name */ - "Johan Wikman", /* author */ + "Johan Wikman, Daniel Black", /* author */ "Disk space information", /* description */ PLUGIN_LICENSE_GPL, /* license type */ Show::disks_table_init, /* init function */ - NULL, /* deinit function */ - 0x0101, /* version = 1.1 */ + Show::disks_table_deinit, /* deinit function */ + 0x0102, /* version = 1.2 */ NULL, /* no status variables */ NULL, /* no system variables */ - "1.1", /* String version representation */ + "1.2", /* String version representation */ MariaDB_PLUGIN_MATURITY_STABLE /* Maturity (see include/mysql/plugin.h)*/ } mysql_declare_plugin_end; diff --git a/plugin/disks/mysql-test/disks/disks.result b/plugin/disks/mysql-test/disks/disks.result index 9beab2f30d1b4..888f2df64f7c6 100644 --- a/plugin/disks/mysql-test/disks/disks.result +++ b/plugin/disks/mysql-test/disks/disks.result @@ -1,12 +1,12 @@ show create table information_schema.disks; Table Create Table DISKS CREATE TEMPORARY TABLE `DISKS` ( - `Disk` varchar(4096) NOT NULL DEFAULT '', - `Path` varchar(4096) NOT NULL DEFAULT '', - `Total` bigint(32) NOT NULL DEFAULT 0, - `Used` bigint(32) NOT NULL DEFAULT 0, - `Available` bigint(32) NOT NULL DEFAULT 0 -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `Disk` varchar(pathlen) NOT NULL, + `Path` varchar(pathlen) NOT NULL, + `Total` bigint(32) NOT NULL, + `Used` bigint(32) NOT NULL, + `Available` bigint(32) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks; sum(Total) > sum(Available) sum(Total)>sum(Used) 1 1 diff --git a/plugin/disks/mysql-test/disks/disks.test b/plugin/disks/mysql-test/disks/disks.test index 13a0762ae010f..7189c54834279 100644 --- a/plugin/disks/mysql-test/disks/disks.test +++ b/plugin/disks/mysql-test/disks/disks.test @@ -1,2 +1,3 @@ +--replace_regex /varchar\([0-9]+\)/varchar(pathlen)/ show create table information_schema.disks; select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks; diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc index 3b2e95f1e13b8..ba4850f4cba05 100644 --- a/plugin/feedback/feedback.cc +++ b/plugin/feedback/feedback.cc @@ -102,7 +102,6 @@ static COND* make_cond(THD *thd, TABLE_LIST *tables, LEX_STRING *filter) if (!filter->str || !nrc) return 0; - nrc->init(); nrc->resolve_in_table_list_only(tables); nrc->select_lex= tables->select_lex; @@ -367,7 +366,7 @@ static MYSQL_SYSVAR_STR(user_info, user_info, NULL, NULL, ""); static MYSQL_SYSVAR_STR(url, url, PLUGIN_VAR_READONLY | PLUGIN_VAR_RQCMDARG, "Space separated URLs to send the feedback report to.", NULL, NULL, - DEFAULT_PROTO "mariadb.org/feedback_plugin/post"); + DEFAULT_PROTO "feedback.mariadb.org/rest/v1/post"); static MYSQL_SYSVAR_ULONG(send_timeout, send_timeout, PLUGIN_VAR_RQCMDARG, "Timeout (in seconds) for the sending the report.", NULL, NULL, 60, 1, 60*60*24, 1); diff --git a/plugin/file_key_management/CMakeLists.txt b/plugin/file_key_management/CMakeLists.txt index c2f13fb9f631b..9b09da9bf20fc 100644 --- a/plugin/file_key_management/CMakeLists.txt +++ b/plugin/file_key_management/CMakeLists.txt @@ -1,4 +1,4 @@ SET(FILE_KEY_MANAGEMENT_PLUGIN_SOURCES file_key_management_plugin.cc parser.cc) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql) -MYSQL_ADD_PLUGIN(FILE_KEY_MANAGEMENT ${FILE_KEY_MANAGEMENT_PLUGIN_SOURCES}) +MYSQL_ADD_PLUGIN(FILE_KEY_MANAGEMENT ${FILE_KEY_MANAGEMENT_PLUGIN_SOURCES} MODULE_ONLY) diff --git a/plugin/file_key_management/parser.cc b/plugin/file_key_management/parser.cc index 818c026495f5e..57e0139a57df7 100644 --- a/plugin/file_key_management/parser.cc +++ b/plugin/file_key_management/parser.cc @@ -162,19 +162,28 @@ bool Parser::read_filekey(const char *filekey, char *secret) int f= open(filekey, O_RDONLY|O_BINARY); if (f == -1) { - my_error(EE_FILENOTFOUND,ME_ERROR_LOG, filekey, errno); + my_error(EE_FILENOTFOUND, ME_ERROR_LOG, filekey, errno); return 1; } - int len= read(f, secret, MAX_SECRET_SIZE); + int len= read(f, secret, MAX_SECRET_SIZE + 1); if (len <= 0) { - my_error(EE_READ,ME_ERROR_LOG, filekey, errno); + my_error(EE_READ, ME_ERROR_LOG, filekey, errno); close(f); return 1; } close(f); + while (secret[len - 1] == '\r' || secret[len - 1] == '\n') len--; + if (len > MAX_SECRET_SIZE) + { + my_printf_error(EE_READ, + "Cannot read %s, the filekey is too long, " + "max secret size is %dB ", + ME_ERROR_LOG, filekey, MAX_SECRET_SIZE); + return 1; + } secret[len]= '\0'; return 0; } diff --git a/plugin/handler_socket/handlersocket/database.cpp b/plugin/handler_socket/handlersocket/database.cpp index 937b1177ae4a2..db24e33a1411d 100644 --- a/plugin/handler_socket/handlersocket/database.cpp +++ b/plugin/handler_socket/handlersocket/database.cpp @@ -189,9 +189,7 @@ database::database(const config& c) { } -database::~database() -{ -} +database::~database() = default; dbcontext_ptr database::create_context(bool for_write) volatile @@ -226,9 +224,7 @@ dbcontext::dbcontext(volatile database *d, bool for_write) user_level_lock_timeout = d->get_conf().get_int("wrlock_timeout", 12); } -dbcontext::~dbcontext() -{ -} +dbcontext::~dbcontext() = default; namespace { diff --git a/plugin/handler_socket/handlersocket/database.hpp b/plugin/handler_socket/handlersocket/database.hpp index a4aee0874c721..ed5d00800d920 100644 --- a/plugin/handler_socket/handlersocket/database.hpp +++ b/plugin/handler_socket/handlersocket/database.hpp @@ -27,7 +27,7 @@ struct dbcontext_i; typedef std::auto_ptr dbcontext_ptr; struct database_i { - virtual ~database_i() { } + virtual ~database_i() = default; virtual dbcontext_ptr create_context(bool for_write) volatile = 0; virtual void stop() volatile = 0; virtual const config& get_conf() const volatile = 0; @@ -57,7 +57,7 @@ struct prep_stmt { }; struct dbcallback_i { - virtual ~dbcallback_i () { } + virtual ~dbcallback_i() = default; virtual void dbcb_set_prep_stmt(size_t pst_id, const prep_stmt& v) = 0; virtual const prep_stmt *dbcb_get_prep_stmt(size_t pst_id) const = 0; virtual void dbcb_resp_short(uint32_t code, const char *msg) = 0; @@ -111,7 +111,7 @@ struct cmd_exec_args { }; struct dbcontext_i { - virtual ~dbcontext_i() { } + virtual ~dbcontext_i() = default; virtual void init_thread(const void *stack_bottom, volatile int& shutdown_flag) = 0; virtual void term_thread() = 0; diff --git a/plugin/handler_socket/handlersocket/handlersocket.cpp b/plugin/handler_socket/handlersocket/handlersocket.cpp index 8133497044c5d..45c9e13b2ca83 100644 --- a/plugin/handler_socket/handlersocket/handlersocket.cpp +++ b/plugin/handler_socket/handlersocket/handlersocket.cpp @@ -185,7 +185,9 @@ static SHOW_VAR hs_status_variables[] = { {NullS, NullS, SHOW_LONG} }; -static int show_hs_vars(THD *thd, SHOW_VAR *var, char *buff) +static int show_hs_vars(THD *thd, SHOW_VAR *var, void *buff, + struct system_status_var *status_var, + enum enum_var_type var_type) { var->type= SHOW_ARRAY; var->value= (char *) &hs_status_variables; @@ -193,7 +195,7 @@ static int show_hs_vars(THD *thd, SHOW_VAR *var, char *buff) } static SHOW_VAR daemon_handlersocket_status_variables[] = { - {"Hs", (char*) show_hs_vars, SHOW_FUNC}, + SHOW_FUNC_ENTRY("Hs", &show_hs_vars), {NullS, NullS, SHOW_LONG} }; diff --git a/plugin/handler_socket/handlersocket/hstcpsvr.hpp b/plugin/handler_socket/handlersocket/hstcpsvr.hpp index 811bfa25613a6..5fbed92402b5a 100644 --- a/plugin/handler_socket/handlersocket/hstcpsvr.hpp +++ b/plugin/handler_socket/handlersocket/hstcpsvr.hpp @@ -47,7 +47,7 @@ struct hstcpsvr_i; typedef std::auto_ptr hstcpsvr_ptr; struct hstcpsvr_i { - virtual ~hstcpsvr_i() { } + virtual ~hstcpsvr_i() = default; virtual std::string start_listen() = 0; static hstcpsvr_ptr create(const config& conf); }; diff --git a/plugin/handler_socket/handlersocket/hstcpsvr_worker.cpp b/plugin/handler_socket/handlersocket/hstcpsvr_worker.cpp index 9863602af7a9e..f6bbe9004c2ea 100644 --- a/plugin/handler_socket/handlersocket/hstcpsvr_worker.cpp +++ b/plugin/handler_socket/handlersocket/hstcpsvr_worker.cpp @@ -6,7 +6,7 @@ * See COPYRIGHT.txt for details. */ -#include +#include #include #include #include @@ -17,9 +17,6 @@ #if __linux__ #include #endif -#ifdef HAVE_ALLOCA_H -#include -#endif #include "hstcpsvr_worker.hpp" #include "string_buffer.hpp" diff --git a/plugin/handler_socket/handlersocket/hstcpsvr_worker.hpp b/plugin/handler_socket/handlersocket/hstcpsvr_worker.hpp index 497581c27a741..25612adec0f63 100644 --- a/plugin/handler_socket/handlersocket/hstcpsvr_worker.hpp +++ b/plugin/handler_socket/handlersocket/hstcpsvr_worker.hpp @@ -24,7 +24,7 @@ struct hstcpsvr_worker_arg { }; struct hstcpsvr_worker_i { - virtual ~hstcpsvr_worker_i() { } + virtual ~hstcpsvr_worker_i() = default; virtual void run() = 0; static hstcpsvr_worker_ptr create(const hstcpsvr_worker_arg& arg); }; diff --git a/plugin/handler_socket/libhsclient/allocator.hpp b/plugin/handler_socket/libhsclient/allocator.hpp index dd3a28ba7bdca..9df6a1ab75243 100644 --- a/plugin/handler_socket/libhsclient/allocator.hpp +++ b/plugin/handler_socket/libhsclient/allocator.hpp @@ -11,6 +11,7 @@ #include #include +#include #if 0 extern "C" { diff --git a/plugin/handler_socket/libhsclient/hstcpcli.hpp b/plugin/handler_socket/libhsclient/hstcpcli.hpp index 11dec8ebb0b4d..fa0d4db174299 100644 --- a/plugin/handler_socket/libhsclient/hstcpcli.hpp +++ b/plugin/handler_socket/libhsclient/hstcpcli.hpp @@ -33,7 +33,7 @@ struct hstcpcli_i; typedef std::auto_ptr hstcpcli_ptr; struct hstcpcli_i { - virtual ~hstcpcli_i() { } + virtual ~hstcpcli_i() = default; virtual void close() = 0; virtual int reconnect() = 0; virtual bool stable_point() = 0; diff --git a/plugin/handler_socket/libhsclient/util.hpp b/plugin/handler_socket/libhsclient/util.hpp index 93d78cc7dc0e6..60b5441703d98 100644 --- a/plugin/handler_socket/libhsclient/util.hpp +++ b/plugin/handler_socket/libhsclient/util.hpp @@ -13,7 +13,7 @@ namespace dena { /* boost::noncopyable */ struct noncopyable { - noncopyable() { } + noncopyable() = default; private: noncopyable(const noncopyable&); noncopyable& operator =(const noncopyable&); diff --git a/plugin/password_reuse_check/CMakeLists.txt b/plugin/password_reuse_check/CMakeLists.txt index b9175eb9f7406..6c81607174702 100644 --- a/plugin/password_reuse_check/CMakeLists.txt +++ b/plugin/password_reuse_check/CMakeLists.txt @@ -1,2 +1,3 @@ -MYSQL_ADD_PLUGIN(password_reuse_check password_reuse_check.c) +MYSQL_ADD_PLUGIN(password_reuse_check password_reuse_check.c + RECOMPILE_FOR_EMBEDDED) diff --git a/plugin/password_reuse_check/password_reuse_check.c b/plugin/password_reuse_check/password_reuse_check.c index 8373b64ea8ac9..8f5973721d846 100644 --- a/plugin/password_reuse_check/password_reuse_check.c +++ b/plugin/password_reuse_check/password_reuse_check.c @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ +#include // for int2store #include // for snprintf #include // for memset #include @@ -30,6 +31,22 @@ static unsigned interval= 0; // helping string for bin_to_hex512 static char digits[]= "0123456789ABCDEF"; +/** + Store string with length + + @param to buffer where to put the length and string + @param from the string to store + + @return reference on the byte after copied string +*/ + +static char *store_str(char *to, const MYSQL_CONST_LEX_STRING *from) +{ + int2store(to, from->length); + memcpy(to + 2, from->str, from->length); + return to + 2 + from->length; +} + /** Convert string of 512 bits (64 bytes) to hex representation @@ -149,7 +166,8 @@ static int validate(const MYSQL_CONST_LEX_STRING *username, const MYSQL_CONST_LEX_STRING *hostname) { MYSQL *mysql= NULL; - size_t key_len= username->length + password->length + hostname->length; + size_t key_len= username->length + password->length + hostname->length + + (3 * 2 /* space for storing length of the strings */); size_t buff_len= (key_len > SQL_BUFF_LEN ? key_len : SQL_BUFF_LEN); size_t len; char *buff= malloc(buff_len); @@ -165,13 +183,16 @@ static int validate(const MYSQL_CONST_LEX_STRING *username, return 1; } - memcpy(buff, hostname->str, hostname->length); - memcpy(buff + hostname->length, username->str, username->length); - memcpy(buff + hostname->length + username->length, password->str, - password->length); - buff[key_len]= 0; + /* + Store: username, hostname, password + (password first to make its rewriting password in memory simplier) + */ + store_str(store_str(store_str(buff, password), username), hostname); + buff[key_len]= 0; // safety memset(hash, 0, sizeof(hash)); my_sha512(hash, buff, key_len); + // safety: rewrite password with zerows + memset(buff, 0, password->length); if (mysql_real_connect_local(mysql) == NULL) goto sql_error; @@ -232,10 +253,10 @@ maria_declare_plugin(password_reuse_check) PLUGIN_LICENSE_GPL, NULL, NULL, - 0x0100, + 0x0200, NULL, sysvars, - "1.0", - MariaDB_PLUGIN_MATURITY_BETA + "2.0", + MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; diff --git a/plugin/qc_info/qc_info.cc b/plugin/qc_info/qc_info.cc index baaa351926167..a46e2d9fbf204 100644 --- a/plugin/qc_info/qc_info.cc +++ b/plugin/qc_info/qc_info.cc @@ -72,12 +72,13 @@ bool schema_table_store_record(THD *thd, TABLE *table); #define COLUMN_CLIENT_LONG_FLAG 16 #define COLUMN_CLIENT_PROTOCOL_41 17 -#define COLUMN_PROTOCOL_TYPE 18 -#define COLUMN_MORE_RESULTS_EXISTS 19 -#define COLUMN_IN_TRANS 20 -#define COLUMN_AUTOCOMMIT 21 -#define COLUMN_PKT_NR 22 -#define COLUMN_HITS 23 +#define COLUMN_CLIENT_EXTENDED_METADATA 18 +#define COLUMN_PROTOCOL_TYPE 19 +#define COLUMN_MORE_RESULTS_EXISTS 20 +#define COLUMN_IN_TRANS 21 +#define COLUMN_AUTOCOMMIT 22 +#define COLUMN_PKT_NR 23 +#define COLUMN_HITS 24 namespace Show { @@ -103,6 +104,7 @@ static ST_FIELD_INFO qc_info_fields[]= Column("LC_TIME_NAMES", Varchar(100), NOT_NULL), Column("CLIENT_LONG_FLAG", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), Column("CLIENT_PROTOCOL_41", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), + Column("CLIENT_EXTENDED_METADATA",STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), Column("PROTOCOL_TYPE", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), Column("MORE_RESULTS_EXISTS", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), Column("IN_TRANS", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), @@ -216,6 +218,8 @@ static int qc_info_fill_table(THD *thd, TABLE_LIST *tables, table->field[COLUMN_CLIENT_LONG_FLAG]->store(flags.client_long_flag, 0); table->field[COLUMN_CLIENT_PROTOCOL_41]->store(flags.client_protocol_41, 0); + table->field[COLUMN_CLIENT_EXTENDED_METADATA]-> + store(flags.client_extended_metadata, 0); table->field[COLUMN_PROTOCOL_TYPE]->store(flags.protocol_type, 0); table->field[COLUMN_MORE_RESULTS_EXISTS]->store(flags.more_results_exists, 0); table->field[COLUMN_IN_TRANS]->store(flags.in_trans, 0); diff --git a/plugin/query_response_time/mysql-test/query_response_time/basic.result b/plugin/query_response_time/mysql-test/query_response_time/basic.result index 5bf357375b94f..48bcdfa12ca0c 100644 --- a/plugin/query_response_time/mysql-test/query_response_time/basic.result +++ b/plugin/query_response_time/mysql-test/query_response_time/basic.result @@ -6,10 +6,10 @@ query_response_time_stats OFF SHOW CREATE TABLE INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; Table Create Table QUERY_RESPONSE_TIME CREATE TEMPORARY TABLE `QUERY_RESPONSE_TIME` ( - `TIME` varchar(14) NOT NULL DEFAULT '', - `COUNT` int(11) unsigned NOT NULL DEFAULT 0, - `TOTAL` varchar(14) NOT NULL DEFAULT '' -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `TIME` varchar(14) NOT NULL, + `COUNT` int(11) unsigned NOT NULL, + `TOTAL` varchar(14) NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci SELECT PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_TYPE, PLUGIN_AUTHOR, PLUGIN_DESCRIPTION, PLUGIN_LICENSE, PLUGIN_MATURITY FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE 'query_response_time%';; PLUGIN_NAME QUERY_RESPONSE_TIME PLUGIN_VERSION 1.0 diff --git a/plugin/query_response_time/query_response_time.cc b/plugin/query_response_time/query_response_time.cc index a669f7d423608..e344f45b392c1 100644 --- a/plugin/query_response_time/query_response_time.cc +++ b/plugin/query_response_time/query_response_time.cc @@ -153,7 +153,7 @@ class time_collector public: time_collector(utility& u): m_utility(&u) { flush(); } - ~time_collector() { } + ~time_collector() = default; uint32_t count(uint index) { return m_count[index]; } uint64_t total(uint index) { return m_total[index]; } void flush() diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index eac7f77fb6b12..3c94df243d012 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -16,7 +16,7 @@ #define PLUGIN_VERSION 0x104 -#define PLUGIN_STR_VERSION "1.4.13" +#define PLUGIN_STR_VERSION "1.4.14" #define _my_thread_var loc_thread_var @@ -954,7 +954,19 @@ static unsigned long long query_counter= 1; static struct connection_info *get_loc_info(MYSQL_THD thd) { + /* + This is the original code and supposed to be returned + bach to this as the MENT-1438 is finally understood/resolved. return (struct connection_info *) THDVAR(thd, loc_info); + */ + struct connection_info *ci= (struct connection_info *) THDVAR(thd, loc_info); + if ((size_t) ci->user_length > sizeof(ci->user)) + { + ci->user_length= 0; + ci->host_length= 0; + ci->ip_length= 0; + } + return ci; } @@ -1390,6 +1402,16 @@ static size_t log_header(char *message, size_t message_len, host= userip; } + /* + That was added to find the possible cause of the MENT-1438. + Supposed to be removed after that. + */ + if (username_len > 1024) + { + username= "unknown_user"; + username_len= (unsigned int) strlen(username); + } + if (output_type == OUTPUT_SYSLOG) return my_snprintf(message, message_len, "%.*s,%.*s,%.*s,%d,%lld,%s", @@ -2368,6 +2390,9 @@ int get_db_mysql57(MYSQL_THD thd, char **name, size_t *len) #ifdef __x86_64__ db_off= 608; db_len_off= 616; +#elif __aarch64__ + db_off= 632; + db_len_off= 640; #else db_off= 0; db_len_off= 0; @@ -2378,6 +2403,9 @@ int get_db_mysql57(MYSQL_THD thd, char **name, size_t *len) #ifdef __x86_64__ db_off= 536; db_len_off= 544; +#elif __aarch64__ + db_off= 552; + db_len_off= 560; #else db_off= 0; db_len_off= 0; diff --git a/plugin/simple_password_check/simple_password_check.c b/plugin/simple_password_check/simple_password_check.c index e9d852d54ab4f..929906c6afe32 100644 --- a/plugin/simple_password_check/simple_password_check.c +++ b/plugin/simple_password_check/simple_password_check.c @@ -31,7 +31,13 @@ static int validate(const MYSQL_CONST_LEX_STRING *username, const char *ptr= password->str, *end= ptr + length; if (strncmp(password->str, username->str, length) == 0) + { + // warning used to do not change error code + my_printf_error(ER_NOT_VALID_PASSWORD, + "simple_password_check: The password equal to the user name", + ME_WARNING); return 1; + } /* everything non-ascii is the "other" character and is good for the password */ for(; ptr < end; ptr++) @@ -45,6 +51,28 @@ static int validate(const MYSQL_CONST_LEX_STRING *username, else others++; } + + // warnings used to do not change error code + if (length < min_length) + my_printf_error(ER_NOT_VALID_PASSWORD, + "simple_password_check: Too short password (< %u)", + ME_WARNING, min_length); + if (uppers < min_letters) + my_printf_error(ER_NOT_VALID_PASSWORD, + "simple_password_check: Not enough upper case " + "letters (< %u)",ME_WARNING, min_letters); + if (lowers < min_letters) + my_printf_error(ER_NOT_VALID_PASSWORD, + "simple_password_check: Not enough lower case " + "letters (< %u)",ME_WARNING, min_letters); + if (digits < min_digits) + my_printf_error(ER_NOT_VALID_PASSWORD, + "simple_password_check: Not enough digits (< %u)", + ME_WARNING, min_digits); + if (others < min_others) + my_printf_error(ER_NOT_VALID_PASSWORD, + "simple_password_check: Not enough special " + "characters (< %u)",ME_WARNING, min_others); /* remember TRUE means the password failed the validation */ return length < min_length || uppers < min_letters || diff --git a/plugin/test_sql_service/test_sql_service.c b/plugin/test_sql_service/test_sql_service.c index c2dbb93bf20b9..8b326c6fa4651 100644 --- a/plugin/test_sql_service/test_sql_service.c +++ b/plugin/test_sql_service/test_sql_service.c @@ -129,6 +129,7 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev) static int run_test(MYSQL_THD thd, struct st_mysql_sys_var *var, void *save, struct st_mysql_value *value) { + *(my_bool*) save= 0; /* Set value for sql_service_run_test */ return (test_passed= (do_tests() == 0)) == 0; } diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6-debug.result b/plugin/type_inet/mysql-test/type_inet/type_inet6-debug.result index 0e879aad58fe3..2be7aca410796 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6-debug.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6-debug.result @@ -14,5 +14,5 @@ Table Create Table t1 CREATE TABLE `t1` ( `c01` inet6 DEFAULT NULL, `c02` inet6 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.result b/plugin/type_inet/mysql-test/type_inet/type_inet6.result index 6e05d589695ba..838a7ee49d3f1 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.result @@ -8,7 +8,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` inet6 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DESCRIBE t1; Field Type Null Key Default Extra a inet6 YES NULL @@ -64,7 +64,7 @@ t1 CREATE TABLE `t1` ( `c3` inet6 DEFAULT '::', `c4` inet6 DEFAULT 'ffff::ffff', `c5` inet6 DEFAULT cast(X'ffffffffffffffffffffffffffffffff' as inet6) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DESCRIBE t1; Field Type Null Key Default Extra c1 inet6 YES :: @@ -192,9 +192,9 @@ CREATE TABLE t1 (a INET6); INSERT INTO t1 VALUES ('x'); ERROR 22007: Incorrect inet6 value: 'x' for column `test`.`t1`.`a` at row 1 INSERT INTO t1 VALUES (1); -ERROR 22007: Incorrect inet6 value: '1' for column `test`.`t1`.`a` at row 1 +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t1`.`a` INSERT INTO t1 VALUES (TIME'10:20:30'); -ERROR 22007: Incorrect inet6 value: '10:20:30' for column `test`.`t1`.`a` at row 1 +ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `test`.`t1`.`a` INSERT INTO t1 VALUES (0x00); ERROR 22007: Incorrect inet6 value: '\x00' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; @@ -222,7 +222,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `CAST('::' AS INET6)` inet6 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Text and binary formats, comparison operators @@ -428,7 +428,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(c, c_text)` inet6 DEFAULT NULL, `COALESCE(c, c_mediumtext)` inet6 DEFAULT NULL, `COALESCE(c, c_longtext)` inet6 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LEAST(c, c_char), @@ -447,7 +447,7 @@ t2 CREATE TABLE `t2` ( `LEAST(c, c_text)` inet6 DEFAULT NULL, `LEAST(c, c_mediumtext)` inet6 DEFAULT NULL, `LEAST(c, c_longtext)` inet6 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a INET6); @@ -478,7 +478,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(a, '::')` inet6 DEFAULT NULL, `LEAST(a,'::')` inet6 DEFAULT NULL, `GREATEST(a,'::')` inet6 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SELECT COALESCE(a, 0x00000000000000000000000000000000) FROM t1 ORDER BY a; COALESCE(a, 0x00000000000000000000000000000000) @@ -512,7 +512,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(a, 0x00000000000000000000000000000000)` inet6 DEFAULT NULL, `LEAST(a,0x00000000000000000000000000000000)` inet6 DEFAULT NULL, `GREATEST(a,0x00000000000000000000000000000000)` inet6 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SELECT COALESCE(a, 10) FROM t1; ERROR HY000: Illegal parameter data types inet6 and int for operation 'coalesce' @@ -720,7 +720,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(39) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a INET6); INSERT INTO t1 VALUES ('ffff::ffff'); @@ -743,7 +743,7 @@ t2 CREATE TABLE `t2` ( `CAST(a AS CHAR(66000))` mediumtext DEFAULT NULL, `CAST(a AS CHAR(16777215))` mediumtext DEFAULT NULL, `CAST(a AS CHAR(16777216))` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; CAST(a AS CHAR) ffff::ffff CAST(a AS CHAR(39)) ffff::ffff @@ -779,7 +779,7 @@ t2 CREATE TABLE `t2` ( `cb66000` mediumblob DEFAULT NULL, `cb16777215` mediumblob DEFAULT NULL, `cb16777216` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT CAST(a AS BINARY(4)) AS cb4, @@ -798,7 +798,7 @@ t2 CREATE TABLE `t2` ( `cb32` binary(32) DEFAULT NULL, `cb530` varbinary(530) DEFAULT NULL, `cb65535` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(cb4), HEX(cb), @@ -820,15 +820,15 @@ DROP TABLE t1; # CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (CAST('::' AS INET6)); -ERROR 22007: Incorrect integer value: '::' for column `test`.`t1`.`a` at row 1 +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t1`.`a` DROP TABLE t1; CREATE TABLE t1 (a DOUBLE); INSERT INTO t1 VALUES (CAST('::' AS INET6)); -ERROR 22007: Incorrect double value: '::' for column `test`.`t1`.`a` at row 1 +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t1`.`a` DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(32,0)); INSERT INTO t1 VALUES (CAST('::' AS INET6)); -ERROR 22007: Incorrect decimal value: '::' for column `test`.`t1`.`a` at row 1 +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t1`.`a` DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(64)); INSERT INTO t1 VALUES (CAST('::' AS INET6)); @@ -887,7 +887,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `MIN(a)` inet6 DEFAULT NULL, `MAX(a)` inet6 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SELECT AVG(a) FROM t1; ERROR HY000: Illegal parameter data type inet6 for operation 'avg(' @@ -953,7 +953,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` inet6 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING '::1'; EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING CAST('::2' AS INET6); EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING 0x00000000000000000000000000000003; @@ -986,7 +986,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(39) DEFAULT NULL, `c2` varchar(39) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT CONCAT(_utf8'1', a) AS c1, @@ -996,10 +996,10 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `c1` varchar(40) CHARACTER SET utf8mb3 DEFAULT NULL, - `c2` varchar(40) CHARACTER SET utf8mb3 DEFAULT NULL, - `c3` varchar(40) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(40) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c2` varchar(40) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c3` varchar(40) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT CONCAT(_latin1'1', a) AS c1, @@ -1012,7 +1012,7 @@ t2 CREATE TABLE `t2` ( `c1` varchar(40) DEFAULT NULL, `c2` varchar(40) DEFAULT NULL, `c3` varchar(40) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -1023,21 +1023,21 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` inet6 NOT NULL DEFAULT '::' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT CAST('::' AS INET6) AS c UNION SELECT '::1'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` inet6 NOT NULL DEFAULT '::' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT '::' AS c UNION SELECT CAST('::1' AS INET6); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` inet6 NOT NULL DEFAULT '::' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 AS SELECT CAST('::' AS INET6) AS c UNION SELECT 0x00000000000000000000000000000001; SELECT * FROM t1; @@ -1606,7 +1606,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b INT); INSERT INTO t1 VALUES ('ffff::ffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect integer value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -1614,7 +1614,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b DOUBLE); INSERT INTO t1 VALUES ('ffff::ffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect double value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -1622,7 +1622,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b DECIMAL(32,0)); INSERT INTO t1 VALUES ('ffff::ffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect decimal value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -1630,7 +1630,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b YEAR); INSERT INTO t1 VALUES ('ffff::ffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect integer value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'inet6' as 'year' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -1641,7 +1641,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INT, b INET6); INSERT INTO t1 VALUES (1, NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect inet6 value: '1' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -1649,7 +1649,7 @@ DROP TABLE t1; CREATE TABLE t1 (a DOUBLE, b INET6); INSERT INTO t1 VALUES (1, NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect inet6 value: '1' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -1657,7 +1657,7 @@ DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(32,0), b INET6); INSERT INTO t1 VALUES (1, NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect inet6 value: '1' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -1665,7 +1665,7 @@ DROP TABLE t1; CREATE TABLE t1 (a YEAR, b INET6); INSERT INTO t1 VALUES (1, NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect inet6 value: '2001' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'year' as 'inet6' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -1676,7 +1676,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b TIME); INSERT INTO t1 VALUES ('ffff::ffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect time value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -1684,7 +1684,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b DATE); INSERT INTO t1 VALUES ('ffff::ffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect date value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'inet6' as 'date' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -1692,7 +1692,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b DATETIME); INSERT INTO t1 VALUES ('ffff::ffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect datetime value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'inet6' as 'datetime' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -1700,7 +1700,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b TIMESTAMP NULL DEFAULT NULL); INSERT INTO t1 VALUES ('ffff::ffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect datetime value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'inet6' as 'timestamp' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -1711,7 +1711,7 @@ DROP TABLE t1; CREATE TABLE t1 (a TIME, b INET6); INSERT INTO t1 VALUES ('00:00:00', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect inet6 value: '00:00:00' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -1719,7 +1719,7 @@ DROP TABLE t1; CREATE TABLE t1 (a DATE, b INET6); INSERT INTO t1 VALUES ('2001-01:01', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect inet6 value: '2001-01-01' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'date' as 'inet6' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -1727,7 +1727,7 @@ DROP TABLE t1; CREATE TABLE t1 (a DATETIME, b INET6); INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect inet6 value: '2001-01-01 10:20:30' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'datetime' as 'inet6' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -1735,7 +1735,7 @@ DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP, b INET6); INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect inet6 value: '2001-01-01 10:20:30' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'timestamp' as 'inet6' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -1922,7 +1922,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b INT); INSERT INTO t1 (a) VALUES ('::'); UPDATE t1 SET b=a; -ERROR 22007: Incorrect integer value: '::' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t1`.`b` SELECT * FROM t1; a b :: NULL @@ -1931,7 +1931,7 @@ SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30'); CREATE TABLE t1 (a INET6, b TIMESTAMP); INSERT INTO t1 (a) VALUES ('::'); UPDATE t1 SET b=a; -ERROR 22007: Incorrect datetime value: '::' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'inet6' as 'timestamp' in assignment of `test`.`t1`.`b` SELECT * FROM t1; a b :: 2001-01-01 10:20:30 @@ -1940,7 +1940,7 @@ SET timestamp=DEFAULT; CREATE OR REPLACE TABLE t1 (a INET6); INSERT INTO t1 (a) VALUES ('::'); ALTER TABLE t1 MODIFY a DATE; -ERROR 22007: Incorrect date value: '::' for column `test`.`t1`.`a` at row 1 +ERROR HY000: Cannot cast 'inet6' as 'date' in assignment of `test`.`t1`.`a` DROP TABLE t1; # # MDEV-20818 ER_CRASHED_ON_USAGE or Assertion `length <= column->length' failed in write_block_record on temporary table @@ -2101,7 +2101,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `ca` inet6 NOT NULL, `cb` inet6 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT COALESCE(a,a), COALESCE(a,b) FROM t1; SHOW CREATE TABLE t2; @@ -2109,7 +2109,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a,a)` inet6 NOT NULL, `COALESCE(a,b)` inet6 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT a AS ca,a AS cb FROM t1 UNION SELECT a,b FROM t1; SHOW CREATE TABLE t2; @@ -2117,7 +2117,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `ca` inet6 NOT NULL DEFAULT '::', `cb` inet6 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -2141,7 +2141,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `IFNULL(c, 'foo')` inet6 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; IFNULL(c, 'foo') :: @@ -2152,7 +2152,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `IFNULL(c, '::1')` inet6 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; IFNULL(c, '::1') :: @@ -2195,6 +2195,69 @@ f :: DROP TABLE t1; # +# MDEV-28491 Uuid. "UPDATE/DELETE" not working "WHERE id IN (SELECT id FROM ..)" +# +CREATE TABLE companies (id INET6, name varchar(10)); +INSERT INTO companies (id) values ('00::01'); +CREATE TABLE divisions (company_id INET6); +INSERT INTO divisions (company_id) values ('00::01'); +SELECT * FROM companies WHERE id IN (SELECT company_id FROM divisions); +id name +::1 NULL +UPDATE companies SET name = 'value' WHERE id IN (SELECT company_id FROM divisions); +SELECT * FROM companies; +id name +::1 value +DELETE FROM companies WHERE id IN (SELECT company_id FROM divisions); +SELECT * FROM companies; +id name +DROP TABLE divisions; +DROP TABLE companies; +# +# MDEV-27099 Subquery using the ALL keyword on INET6 columns produces a wrong result +# +CREATE TABLE t1 (d INET6); +INSERT INTO t1 VALUES ('1::0'), ('12::0'); +SELECT * FROM t1 ORDER BY d; +d +1:: +12:: +SELECT * FROM t1 WHERE d <= ALL (SELECT * FROM t1); +d +1:: +SELECT * FROM t1 WHERE d >= ALL (SELECT * FROM t1); +d +12:: +DROP TABLE t1; +# +# MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle::Fbt FixedBinTypeBundle::Field_fbt::to_fbt() +# +CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a INET6(6) DEFAULT '::10'); +INSERT INTO t1(id) VALUES (1), (2), (3), (4); +INSERT INTO t1 VALUES (5,'::5'), (6,'::6'); +SELECT * FROM t1 ORDER BY a; +id a +5 ::5 +6 ::6 +1 ::10 +2 ::10 +3 ::10 +4 ::10 +CREATE VIEW v1(a, m) AS SELECT a, MIN(id) FROM t1 GROUP BY a; +CREATE TABLE t2 SELECT * FROM v1; +SELECT * FROM v1 ORDER BY a; +a m +::5 5 +::6 6 +::10 1 +SELECT * FROM t2 ORDER BY a; +a m +::5 5 +::6 6 +::10 1 +DROP VIEW v1; +DROP TABLE t1, t2; +# # MDEV-22256 Assertion `length == pack_length()' failed in Field_timestamp_with_dec::sort_string # SET sql_mode=''; @@ -2204,10 +2267,13 @@ Warning 1292 Truncated incorrect max_sort_length value: '4' CREATE TEMPORARY TABLE t1(c INET6,d DATE); INSERT INTO t1 VALUES(0,0); Warnings: +Warning 4078 Cannot cast 'int' as 'inet6' in assignment of `test`.`t1`.`c` Warning 1292 Incorrect inet6 value: '0' for column `test`.`t1`.`c` at row 1 +INSERT INTO t1 VALUES('::',0); SELECT c FROM t1 ORDER BY c; c :: +:: DROP TABLE t1; SET max_sort_length=DEFAULT; SET sql_mode=DEFAULT; @@ -2227,3 +2293,4 @@ f f::f DROP TABLE t1; SET max_sort_length=DEFAULT; +# End of 10.8 tests diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.test b/plugin/type_inet/mysql-test/type_inet/type_inet6.test index 09f7e235cd8df..857a08e7cd170 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.test +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test @@ -1,4 +1,3 @@ - --echo # --echo # Basic CREATE functionality, defaults, metadata --echo # @@ -48,9 +47,9 @@ CREATE TABLE t1 (c1 INET6 DEFAULT ''); CREATE TABLE t1 (a INET6); --error ER_TRUNCATED_WRONG_VALUE INSERT INTO t1 VALUES ('x'); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (1); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (TIME'10:20:30'); --error ER_TRUNCATED_WRONG_VALUE INSERT INTO t1 VALUES (0x00); @@ -447,17 +446,17 @@ DROP TABLE t1; --echo # CREATE TABLE t1 (a INT); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (CAST('::' AS INET6)); DROP TABLE t1; CREATE TABLE t1 (a DOUBLE); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (CAST('::' AS INET6)); DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(32,0)); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (CAST('::' AS INET6)); DROP TABLE t1; @@ -1095,28 +1094,28 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b INT); INSERT INTO t1 VALUES ('ffff::ffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a INET6, b DOUBLE); INSERT INTO t1 VALUES ('ffff::ffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a INET6, b DECIMAL(32,0)); INSERT INTO t1 VALUES ('ffff::ffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a INET6, b YEAR); INSERT INTO t1 VALUES ('ffff::ffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; @@ -1128,28 +1127,28 @@ DROP TABLE t1; CREATE TABLE t1 (a INT, b INET6); INSERT INTO t1 VALUES (1, NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a DOUBLE, b INET6); INSERT INTO t1 VALUES (1, NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(32,0), b INET6); INSERT INTO t1 VALUES (1, NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a YEAR, b INET6); INSERT INTO t1 VALUES (1, NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; @@ -1161,28 +1160,28 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b TIME); INSERT INTO t1 VALUES ('ffff::ffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a INET6, b DATE); INSERT INTO t1 VALUES ('ffff::ffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a INET6, b DATETIME); INSERT INTO t1 VALUES ('ffff::ffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a INET6, b TIMESTAMP NULL DEFAULT NULL); INSERT INTO t1 VALUES ('ffff::ffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; @@ -1194,28 +1193,28 @@ DROP TABLE t1; CREATE TABLE t1 (a TIME, b INET6); INSERT INTO t1 VALUES ('00:00:00', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a DATE, b INET6); INSERT INTO t1 VALUES ('2001-01:01', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a DATETIME, b INET6); INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP, b INET6); INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; @@ -1406,7 +1405,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b INT); INSERT INTO t1 (a) VALUES ('::'); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT * FROM t1; DROP TABLE t1; @@ -1414,7 +1413,7 @@ DROP TABLE t1; SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30'); CREATE TABLE t1 (a INET6, b TIMESTAMP); INSERT INTO t1 (a) VALUES ('::'); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT * FROM t1; DROP TABLE t1; @@ -1422,7 +1421,7 @@ SET timestamp=DEFAULT; CREATE OR REPLACE TABLE t1 (a INET6); INSERT INTO t1 (a) VALUES ('::'); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION ALTER TABLE t1 MODIFY a DATE; DROP TABLE t1; @@ -1613,6 +1612,50 @@ SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '::'; SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '::1'; DROP TABLE t1; + +--echo # +--echo # MDEV-28491 Uuid. "UPDATE/DELETE" not working "WHERE id IN (SELECT id FROM ..)" +--echo # + +CREATE TABLE companies (id INET6, name varchar(10)); +INSERT INTO companies (id) values ('00::01'); + +CREATE TABLE divisions (company_id INET6); +INSERT INTO divisions (company_id) values ('00::01'); +SELECT * FROM companies WHERE id IN (SELECT company_id FROM divisions); +UPDATE companies SET name = 'value' WHERE id IN (SELECT company_id FROM divisions); +SELECT * FROM companies; +DELETE FROM companies WHERE id IN (SELECT company_id FROM divisions); +SELECT * FROM companies; +DROP TABLE divisions; +DROP TABLE companies; + +--echo # +--echo # MDEV-27099 Subquery using the ALL keyword on INET6 columns produces a wrong result +--echo # + +CREATE TABLE t1 (d INET6); +INSERT INTO t1 VALUES ('1::0'), ('12::0'); +SELECT * FROM t1 ORDER BY d; +SELECT * FROM t1 WHERE d <= ALL (SELECT * FROM t1); +SELECT * FROM t1 WHERE d >= ALL (SELECT * FROM t1); +DROP TABLE t1; + +--echo # +--echo # MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle::Fbt FixedBinTypeBundle::Field_fbt::to_fbt() +--echo # + +CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a INET6(6) DEFAULT '::10'); +INSERT INTO t1(id) VALUES (1), (2), (3), (4); +INSERT INTO t1 VALUES (5,'::5'), (6,'::6'); +SELECT * FROM t1 ORDER BY a; +CREATE VIEW v1(a, m) AS SELECT a, MIN(id) FROM t1 GROUP BY a; +CREATE TABLE t2 SELECT * FROM v1; +SELECT * FROM v1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; +DROP VIEW v1; +DROP TABLE t1, t2; + --echo # --echo # MDEV-22256 Assertion `length == pack_length()' failed in Field_timestamp_with_dec::sort_string --echo # @@ -1621,6 +1664,7 @@ SET sql_mode=''; SET @@SESSION.max_sort_length=4; CREATE TEMPORARY TABLE t1(c INET6,d DATE); INSERT INTO t1 VALUES(0,0); +INSERT INTO t1 VALUES('::',0); SELECT c FROM t1 ORDER BY c; DROP TABLE t1; SET max_sort_length=DEFAULT; @@ -1633,3 +1677,5 @@ SELECT CASE 1 WHEN 0 THEN 'foo' ELSE a END AS f FROM t1 GROUP BY f WITH ROLLUP; SELECT CASE 1 WHEN 0 THEN 'foo' ELSE a END AS f FROM t1 GROUP BY f; DROP TABLE t1; SET max_sort_length=DEFAULT; + +--echo # End of 10.8 tests diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_csv.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_csv.result index 8e972235b0662..a2d7cea03ccd7 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6_csv.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_csv.result @@ -10,7 +10,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` inet6 NOT NULL -) ENGINE=CSV DEFAULT CHARSET=latin1 +) ENGINE=CSV DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FOR i IN 0..255 DO INSERT INTO t1 VALUES (CONCAT('::', HEX(i))); diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result index a691175174758..deb1c718b4911 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result @@ -14,7 +14,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` inet6 DEFAULT NULL, KEY `a` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FOR i IN 0..255 DO INSERT INTO t1 VALUES (CONCAT('::', HEX(i))); diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result index db4196366caf7..e805b1671362b 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result @@ -14,7 +14,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` inet6 DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FOR i IN 0..255 DO INSERT INTO t1 VALUES (CONCAT('::', HEX(i))); diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result new file mode 100644 index 0000000000000..2f715767686e7 --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result @@ -0,0 +1,353 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target INET6 DEFAULT '::0', source DECIMAL(38,0) DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` inet6 DEFAULT '::', + `source` decimal(38,0) DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 :: 0 +2 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22007: Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target decimal(38,0) +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src decimal(38,0) DEFAULT NULL; +DECLARE dst inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a inet6) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst inet6) +BEGIN +DECLARE src decimal(38,0) DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'decimal' as 'inet6' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS inet6 +BEGIN +DECLARE rc decimal(38,0) DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src decimal(38,0) DEFAULT NULL; +DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source INET6 DEFAULT '::0'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` decimal(38,0) DEFAULT 0, + `source` inet6 DEFAULT '::', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1366 Incorrect decimal value: '::' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 :: +2 0 :: +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22007: Incorrect decimal value: '::' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 :: +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target inet6 +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE dst decimal(38,0) DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a decimal(38,0)) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a decimal(38,0)) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst decimal(38,0)) +BEGIN +DECLARE src inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst decimal(38,0) DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'inet6' as 'decimal' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS decimal(38,0) +BEGIN +DECLARE rc inet6 DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE cur1 CURSOR(t decimal(38,0)) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst decimal(38,0) DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.test new file mode 100644 index 0000000000000..9696d313790b0 --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target INET6 DEFAULT '::0', source DECIMAL(38,0) DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source INET6 DEFAULT '::0'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.result new file mode 100644 index 0000000000000..5a4d9021dffed --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.result @@ -0,0 +1,353 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target INET6 DEFAULT '::0', source DOUBLE DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` inet6 DEFAULT '::', + `source` double DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 :: 0 +2 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22007: Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target double +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src double DEFAULT NULL; +DECLARE dst inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a inet6) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst inet6) +BEGIN +DECLARE src double DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'double' as 'inet6' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS inet6 +BEGIN +DECLARE rc double DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src double DEFAULT NULL; +DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target DOUBLE DEFAULT 0, source INET6 DEFAULT '::0'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` double DEFAULT 0, + `source` inet6 DEFAULT '::', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 :: +2 0 :: +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22007: Incorrect double value: '::' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 :: +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target inet6 +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE dst double DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a double) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a double) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst double) +BEGIN +DECLARE src inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst double DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'inet6' as 'double' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS double +BEGIN +DECLARE rc inet6 DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE cur1 CURSOR(t double) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst double DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.test new file mode 100644 index 0000000000000..8fc0e24d177aa --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target INET6 DEFAULT '::0', source DOUBLE DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target DOUBLE DEFAULT 0, source INET6 DEFAULT '::0'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_loose.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_loose.result new file mode 100644 index 0000000000000..261afd7ba3298 --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_loose.result @@ -0,0 +1,406 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +SET sql_mode=''; +CREATE TABLE t1 (target INET6 DEFAULT '::0', source DOUBLE DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` inet6 DEFAULT '::', + `source` double DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 :: 0 +2 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22007: Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +UPDATE t3 SET target=source; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column ``.`(temporary)`.`target` at row 1 +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target double +EXECUTE IMMEDIATE @alter; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src double DEFAULT NULL; +DECLARE dst inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +f1((SELECT source FROM t1 ORDER BY source LIMIT 1)) +NULL +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a inet6) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst inet6) +BEGIN +DECLARE src double DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `dst` +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS inet6 +BEGIN +DECLARE rc double DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +f1() +NULL +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src double DEFAULT NULL; +DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `dst` +Warning 1292 Incorrect inet6 value: '0' for column ``.``.`dst` at row 1 +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target DOUBLE DEFAULT 0, source INET6 DEFAULT '::0'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` double DEFAULT 0, + `source` inet6 DEFAULT '::', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 :: +2 0 :: +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22007: Incorrect double value: '::' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 :: +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +UPDATE t3 SET target=source; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column ``.`(temporary)`.`target` at row 1 +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target inet6 +EXECUTE IMMEDIATE @alter; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE dst double DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a double) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +f1((SELECT source FROM t1 ORDER BY source LIMIT 1)) +NULL +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a double) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst double) +BEGIN +DECLARE src inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst double DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `dst` +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS double +BEGIN +DECLARE rc inet6 DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +f1() +NULL +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE cur1 CURSOR(t double) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst double DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `dst` +Warning 1366 Incorrect double value: '::' for column ``.``.`dst` at row 1 +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_loose.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_loose.test new file mode 100644 index 0000000000000..2721d9c5643ea --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_loose.test @@ -0,0 +1,21 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +SET sql_mode=''; + +CREATE TABLE t1 (target INET6 DEFAULT '::0', source DOUBLE DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target DOUBLE DEFAULT 0, source INET6 DEFAULT '::0'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_strict_ignore.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_strict_ignore.result new file mode 100644 index 0000000000000..bd870d145052a --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_strict_ignore.result @@ -0,0 +1,400 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +SET @ignore='IGNORE'; +CREATE TABLE t1 (target INET6 DEFAULT '::0', source DOUBLE DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` inet6 DEFAULT '::', + `source` double DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT IGNORE INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT IGNORE INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 :: 0 +2 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT IGNORE INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 :: 0 +2 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT IGNORE INTO t3 SELECT id,source,source FROM t2; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +INSERT IGNORE INTO t3 (id,target,source) SELECT id,source,source FROM t2; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +Warning 1062 Duplicate entry '1' for key 'PRIMARY' +INSERT IGNORE INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +INSERT IGNORE INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +INSERT IGNORE INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +INSERT IGNORE INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +UPDATE IGNORE t3 SET target=source; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +UPDATE IGNORE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column ``.`(temporary)`.`target` at row 1 +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER IGNORE TABLE t3 MODIFY target double +EXECUTE IMMEDIATE @alter; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src double DEFAULT NULL; +DECLARE dst inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a inet6) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst inet6) +BEGIN +DECLARE src double DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'double' as 'inet6' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS inet6 +BEGIN +DECLARE rc double DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src double DEFAULT NULL; +DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target DOUBLE DEFAULT 0, source INET6 DEFAULT '::0'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` double DEFAULT 0, + `source` inet6 DEFAULT '::', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT IGNORE INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT IGNORE INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 :: +2 0 :: +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT IGNORE INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 :: +2 0 :: +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT IGNORE INTO t3 SELECT id,source,source FROM t2; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +INSERT IGNORE INTO t3 (id,target,source) SELECT id,source,source FROM t2; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +Warning 1062 Duplicate entry '1' for key 'PRIMARY' +INSERT IGNORE INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +INSERT IGNORE INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +INSERT IGNORE INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +INSERT IGNORE INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +UPDATE IGNORE t3 SET target=source; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1 +UPDATE IGNORE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +Warnings: +Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target` +Warning 1366 Incorrect double value: '::' for column ``.`(temporary)`.`target` at row 1 +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER IGNORE TABLE t3 MODIFY target inet6 +EXECUTE IMMEDIATE @alter; +Warnings: +Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target` +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1 +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE dst double DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a double) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a double) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst double) +BEGIN +DECLARE src inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst double DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'inet6' as 'double' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS double +BEGIN +DECLARE rc inet6 DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE cur1 CURSOR(t double) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst double DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_strict_ignore.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_strict_ignore.test new file mode 100644 index 0000000000000..ebb41854df22f --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_strict_ignore.test @@ -0,0 +1,21 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +SET @ignore='IGNORE'; + +CREATE TABLE t1 (target INET6 DEFAULT '::0', source DOUBLE DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target DOUBLE DEFAULT 0, source INET6 DEFAULT '::0'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.result new file mode 100644 index 0000000000000..f8f818f3ce38f --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.result @@ -0,0 +1,353 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target INET6 DEFAULT '::0', source INT DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` inet6 DEFAULT '::', + `source` int(11) DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 :: 0 +2 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22007: Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target int(11) +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(11) DEFAULT NULL; +DECLARE dst inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a inet6) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst inet6) +BEGIN +DECLARE src int(11) DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'int' as 'inet6' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS inet6 +BEGIN +DECLARE rc int(11) DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(11) DEFAULT NULL; +DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target INT DEFAULT 0, source INET6 DEFAULT '::0'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` int(11) DEFAULT 0, + `source` inet6 DEFAULT '::', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1366 Incorrect integer value: '::' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 :: +2 0 :: +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22007: Incorrect integer value: '::' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 :: +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target inet6 +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE dst int(11) DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a int(11)) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a int(11)) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst int(11)) +BEGIN +DECLARE src inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst int(11) DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'inet6' as 'int' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS int(11) +BEGIN +DECLARE rc inet6 DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE cur1 CURSOR(t int(11)) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst int(11) DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.test new file mode 100644 index 0000000000000..21a47e39f90f1 --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target INET6 DEFAULT '::0', source INT DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target INT DEFAULT 0, source INET6 DEFAULT '::0'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_json.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_json.result new file mode 100644 index 0000000000000..32aab12142728 --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_json.result @@ -0,0 +1,63 @@ +# +# MDEV-27018 IF and COALESCE lose "json" property +# +CREATE TABLE t1 (a INET6, b JSON, c LONGTEXT); +INSERT INTO t1 VALUES ('::', '{"b": "b"}', '{"c": "c"}'); +SELECT +COALESCE(a,b), COALESCE(a,c), +LEAST(a,b), LEAST(a,c) +FROM t1 LIMIT 0; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(a,b) 254 (type=inet6) 39 0 Y 32 0 8 +def COALESCE(a,c) 254 (type=inet6) 39 0 Y 32 0 8 +def LEAST(a,b) 254 (type=inet6) 39 0 Y 32 0 8 +def LEAST(a,c) 254 (type=inet6) 39 0 Y 32 0 8 +COALESCE(a,b) COALESCE(a,c) LEAST(a,b) LEAST(a,c) +CREATE TABLE t2 AS +SELECT +COALESCE(a,b), COALESCE(a,c), +LEAST(a,b), LEAST(a,c) +FROM t1 LIMIT 0; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(a,b)` inet6 DEFAULT NULL, + `COALESCE(a,c)` inet6 DEFAULT NULL, + `LEAST(a,b)` inet6 DEFAULT NULL, + `LEAST(a,c)` inet6 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2; +SELECT * FROM t1 WHERE a=b; +a b c +Warnings: +Warning 1292 Incorrect inet6 value: '{"b": "b"}' +SELECT * FROM t1 WHERE a=c; +a b c +Warnings: +Warning 1292 Incorrect inet6 value: '{"c": "c"}' +SELECT a+b FROM t1; +ERROR HY000: Illegal parameter data types inet6 and longblob/json for operation '+' +SELECT a+c FROM t1; +ERROR HY000: Illegal parameter data types inet6 and longblob for operation '+' +DROP TABLE t1; +# +# MDEV-27668 Assertion `item->type_handler()->is_traditional_scalar_type() || item->type_handler() == type_handler()' failed in Field_inet6::can_optimize_keypart_ref +# +CREATE TABLE t1 (i INET6 PRIMARY KEY); +CREATE TABLE t2 (a VARCHAR(40) CHECK (JSON_VALID(a))); +SELECT * FROM t1 JOIN t2 ON (i = a); +i a +INSERT INTO t1 VALUES ('::'),('ffff::ffff'); +INSERT INTO t2 VALUES ('{}'),('[]'); +SELECT * FROM t1 JOIN t2 ON (i = a); +i a +DROP TABLE t1, t2; +CREATE TABLE t1 (i INET6 PRIMARY KEY); +SELECT * FROM t1 WHERE itype_handler()->is_traditional_scalar_type() || item->type_handler() == type_handler()' failed in Field_inet6::can_optimize_keypart_ref +--echo # + +CREATE TABLE t1 (i INET6 PRIMARY KEY); +CREATE TABLE t2 (a VARCHAR(40) CHECK (JSON_VALID(a))); +SELECT * FROM t1 JOIN t2 ON (i = a); +INSERT INTO t1 VALUES ('::'),('ffff::ffff'); +INSERT INTO t2 VALUES ('{}'),('[]'); +SELECT * FROM t1 JOIN t2 ON (i = a); +DROP TABLE t1, t2; + +CREATE TABLE t1 (i INET6 PRIMARY KEY); +SELECT * FROM t1 WHERE i::Fbt FixedBinTypeBundle::Field_fbt::to_fbt() +# +CREATE TABLE t1 (i6 INET6, a1 TIME, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('::','09:43:12','uw'), ('70:ef59::46:c7b:f:678:bd9f','00:00:00','a'); +SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1; +GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) +:: +Warnings: +Warning 1292 Incorrect inet6 value: 'a' +DROP TABLE t1; +CREATE TABLE t1 (i6 inet6, a2 varchar(10)); +INSERT INTO t1 VALUES ('::','uw'), (null,'a'); +SELECT group_concat(coalesce(i6, a2) ORDER BY 1) FROM t1; +group_concat(coalesce(i6, a2) ORDER BY 1) +:: +Warnings: +Warning 1292 Incorrect inet6 value: 'a' +DROP TABLE t1; +CREATE TABLE t1 (a INET6); +INSERT INTO t1 VALUES(); +SELECT JSON_ARRAYAGG(a ORDER BY a DESC) FROM t1; +JSON_ARRAYAGG(a ORDER BY a DESC) +[null] +DROP TABLE t1; +CREATE TABLE t1 (i6 INET6, a1 INT, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('::',1,'uw'), ('70:ef59::46:c7b:f:678:bd9f',0,'a'); +SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1; +GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) +:: +Warnings: +Warning 1292 Incorrect inet6 value: 'a' +DROP TABLE t1; +CREATE TABLE t1 (i6 INET6, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('::',''), (NULL,NULL); +SELECT GROUP_CONCAT(COALESCE(i6, a2) ORDER BY 1) FROM t1; +GROUP_CONCAT(COALESCE(i6, a2) ORDER BY 1) +:: +DROP TABLE t1; +CREATE TABLE t1 (i6 INET6, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('::',''), (NULL,NULL); +SELECT GROUP_CONCAT(DISTINCT COALESCE(i6, a2)) FROM t1; +GROUP_CONCAT(DISTINCT COALESCE(i6, a2)) +:: +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.test new file mode 100644 index 0000000000000..71dfcebf71a62 --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.test @@ -0,0 +1,41 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle::Fbt FixedBinTypeBundle::Field_fbt::to_fbt() +--echo # + +CREATE TABLE t1 (i6 INET6, a1 TIME, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('::','09:43:12','uw'), ('70:ef59::46:c7b:f:678:bd9f','00:00:00','a'); +SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (i6 inet6, a2 varchar(10)); +INSERT INTO t1 VALUES ('::','uw'), (null,'a'); +SELECT group_concat(coalesce(i6, a2) ORDER BY 1) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a INET6); +INSERT INTO t1 VALUES(); +SELECT JSON_ARRAYAGG(a ORDER BY a DESC) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (i6 INET6, a1 INT, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('::',1,'uw'), ('70:ef59::46:c7b:f:678:bd9f',0,'a'); +SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (i6 INET6, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('::',''), (NULL,NULL); +SELECT GROUP_CONCAT(COALESCE(i6, a2) ORDER BY 1) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (i6 INET6, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('::',''), (NULL,NULL); +SELECT GROUP_CONCAT(DISTINCT COALESCE(i6, a2)) FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_inet/sql_type_inet.cc b/plugin/type_inet/sql_type_inet.cc index 6451986ea54c7..b8d2ef706a9ba 100644 --- a/plugin/type_inet/sql_type_inet.cc +++ b/plugin/type_inet/sql_type_inet.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2014 MariaDB Foundation - Copyright (c) 2019,2021 MariaDB Corporation + Copyright (c) 2019,2022 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 diff --git a/plugin/type_inet/sql_type_inet.h b/plugin/type_inet/sql_type_inet.h index b0560f1ffe012..69836ca215b59 100644 --- a/plugin/type_inet/sql_type_inet.h +++ b/plugin/type_inet/sql_type_inet.h @@ -73,8 +73,8 @@ class Inet4 memcpy(m_buffer, str, length); return false; } - // Non-initializing constructor - Inet4() { } + + Inet4() = default; public: void to_binary(char *dst, size_t dstsize) const { diff --git a/plugin/type_mysql_json/type.cc b/plugin/type_mysql_json/type.cc index d2d49b20229a5..b897f64a3b2b6 100644 --- a/plugin/type_mysql_json/type.cc +++ b/plugin/type_mysql_json/type.cc @@ -40,6 +40,18 @@ class Type_handler_mysql_json: public Type_handler_blob void Column_definition_reuse_fix_attributes(THD *thd, Column_definition *def, const Field *field) const override; + const Type_handler *type_handler_base() const override + { + /* + Override this method in the same way with what Type_handler_blob_json + does, to tell the server that MySQL JSON inherits aggregation behaviour + from the LONGBLOB data type. + This makes MariaDB JSON column and a MySQL JSON column compatible for + assignment, so "ALTER TABLE table_with_mysql_json FORCE" can run without + raising ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION. + */ + return &type_handler_long_blob; + } }; Type_handler_mysql_json type_handler_mysql_json; @@ -211,6 +223,6 @@ maria_declare_plugin(type_mysql_json) NULL, NULL, "0.1", - MariaDB_PLUGIN_MATURITY_BETA + MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; diff --git a/plugin/type_test/mysql-test/type_test/type_test_double-debug.result b/plugin/type_test/mysql-test/type_test/type_test_double-debug.result index 975decca11e32..3493fb827ba51 100644 --- a/plugin/type_test/mysql-test/type_test/type_test_double-debug.result +++ b/plugin/type_test/mysql-test/type_test/type_test_double-debug.result @@ -13,7 +13,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Warnings: Note 1105 DBUG: [0] name='a' type_info='test_double' DROP TABLE t1; diff --git a/plugin/type_test/mysql-test/type_test/type_test_double.result b/plugin/type_test/mysql-test/type_test/type_test_double.result index 19ebb6cde64ad..6241ff95b8aea 100644 --- a/plugin/type_test/mysql-test/type_test/type_test_double.result +++ b/plugin/type_test/mysql-test/type_test/type_test_double.result @@ -28,49 +28,49 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEST_DOUBLE(4)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` test_double(4,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEST_DOUBLE(10)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` test_double(10,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEST_DOUBLE(20)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` test_double(20,0) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEST_DOUBLE(4,2)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` test_double(4,2) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEST_DOUBLE(10,5)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` test_double(10,5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEST_DOUBLE(20,10)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` test_double(20,10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SELECT CAST('100' AS TEST_DOUBLE) AS cast; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -104,7 +104,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a TEST_DOUBLE); @@ -113,7 +113,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a,a)` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a TEST_DOUBLE); @@ -122,7 +122,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `LEAST(a,a)` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a TEST_DOUBLE); @@ -139,7 +139,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `MIN(a)` test_double DEFAULT NULL, `MAX(a)` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (id INT, a TEST_DOUBLE); @@ -159,7 +159,7 @@ t2 CREATE TABLE `t2` ( `id` int(11) DEFAULT NULL, `MIN(a)` test_double DEFAULT NULL, `MAX(a)` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a TEST_DOUBLE); @@ -175,7 +175,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a TEST_DOUBLE); @@ -190,7 +190,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a TEST_DOUBLE); @@ -199,7 +199,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # Testing CREATE..LIKE @@ -209,7 +209,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # Testing CREATE..SELECT @@ -219,7 +219,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # Testing ALTER @@ -234,7 +234,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; a 10 @@ -244,7 +244,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; a 10 @@ -321,7 +321,7 @@ t2 CREATE TABLE `t2` ( `c1` test_double DEFAULT NULL, `c2` test_double DEFAULT NULL, `c3` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2 ORDER BY c1; c1 c2 c3 0 0 0 @@ -355,7 +355,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(c,c_smallint)` test_double DEFAULT NULL, `COALESCE(c,c_mediumint)` test_double DEFAULT NULL, `COALESCE(c,c_bigint)` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 ( @@ -410,7 +410,7 @@ t2 CREATE TABLE `t2` ( `c1` test_double DEFAULT NULL, `c2` test_double DEFAULT NULL, `c3` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2 ORDER BY c1; c1 c2 c3 0 0 0 @@ -444,7 +444,7 @@ t2 CREATE TABLE `t2` ( `LEAST(c,c_smallint)` test_double DEFAULT NULL, `LEAST(c,c_mediumint)` test_double DEFAULT NULL, `LEAST(c,c_bigint)` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 ( @@ -499,7 +499,7 @@ t2 CREATE TABLE `t2` ( `c1` test_double DEFAULT NULL, `c2` test_double DEFAULT NULL, `c3` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2 ORDER BY c1; c1 c2 c3 1 1 1 @@ -533,7 +533,7 @@ t2 CREATE TABLE `t2` ( `c + c_smallint` test_double DEFAULT NULL, `c + c_mediumint` test_double DEFAULT NULL, `c + c_bigint` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 ( @@ -588,7 +588,7 @@ t2 CREATE TABLE `t2` ( `c1` test_double DEFAULT NULL, `c2` test_double DEFAULT NULL, `c3` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2 ORDER BY c1; c1 c2 c3 0 0 0 @@ -622,7 +622,7 @@ t2 CREATE TABLE `t2` ( `c - c_smallint` test_double DEFAULT NULL, `c - c_mediumint` test_double DEFAULT NULL, `c - c_bigint` test_double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 ( @@ -689,7 +689,7 @@ t2 CREATE TABLE `t2` ( `CAST(a AS TIME)` time DEFAULT NULL, `CAST(a AS DATETIME)` datetime DEFAULT NULL, `CAST(a AS DATE)` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a 20000102 CAST(a AS CHAR) 20000102 diff --git a/plugin/type_test/mysql-test/type_test/type_test_int8-debug.result b/plugin/type_test/mysql-test/type_test/type_test_int8-debug.result index 952a63c8476cf..c4abda7742363 100644 --- a/plugin/type_test/mysql-test/type_test/type_test_int8-debug.result +++ b/plugin/type_test/mysql-test/type_test/type_test_int8-debug.result @@ -13,7 +13,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` test_int8(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci Warnings: Note 1105 DBUG: [0] name='a' type_info='test_int8' DROP TABLE t1; diff --git a/plugin/type_test/mysql-test/type_test/type_test_int8.result b/plugin/type_test/mysql-test/type_test/type_test_int8.result index f18c990cf3bc3..75fcf1f2f5e03 100644 --- a/plugin/type_test/mysql-test/type_test/type_test_int8.result +++ b/plugin/type_test/mysql-test/type_test/type_test_int8.result @@ -28,28 +28,28 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` test_int8(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEST_INT8(4)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` test_int8(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEST_INT8(10)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` test_int8(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a TEST_INT8(20)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` test_int8(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; SELECT CAST('100' AS TEST_INT8) AS cast; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -83,7 +83,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` test_int8(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a TEST_INT8); @@ -92,7 +92,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `COALESCE(a,a)` test_int8(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a TEST_INT8); @@ -101,7 +101,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `LEAST(a,a)` test_int8(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a TEST_INT8); @@ -118,7 +118,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `MIN(a)` test_int8(20) DEFAULT NULL, `MAX(a)` test_int8(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (id INT, a TEST_INT8); @@ -138,7 +138,7 @@ t2 CREATE TABLE `t2` ( `id` int(11) DEFAULT NULL, `MIN(a)` test_int8(20) DEFAULT NULL, `MAX(a)` test_int8(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a TEST_INT8); @@ -154,7 +154,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` test_int8(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a TEST_INT8); @@ -169,7 +169,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` test_int8(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a TEST_INT8); @@ -178,7 +178,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` test_int8(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # Testing CREATE..LIKE @@ -188,7 +188,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` test_int8(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # Testing CREATE..SELECT @@ -198,7 +198,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` test_int8(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # Testing ALTER @@ -213,7 +213,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; a 10 @@ -223,7 +223,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` test_int8(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; a 10 @@ -300,7 +300,7 @@ t2 CREATE TABLE `t2` ( `c1` test_int8(20) DEFAULT NULL, `c2` decimal(20,1) DEFAULT NULL, `c3` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2 ORDER BY c1; c1 c2 c3 0 0.0 0 @@ -334,7 +334,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(c,c_smallint)` test_int8(20) DEFAULT NULL, `COALESCE(c,c_mediumint)` test_int8(20) DEFAULT NULL, `COALESCE(c,c_bigint)` test_int8(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 ( @@ -389,7 +389,7 @@ t2 CREATE TABLE `t2` ( `c1` test_int8(20) DEFAULT NULL, `c2` decimal(20,1) DEFAULT NULL, `c3` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2 ORDER BY c1; c1 c2 c3 0 0.0 0 @@ -423,7 +423,7 @@ t2 CREATE TABLE `t2` ( `LEAST(c,c_smallint)` test_int8(20) DEFAULT NULL, `LEAST(c,c_mediumint)` test_int8(20) DEFAULT NULL, `LEAST(c,c_bigint)` test_int8(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 ( @@ -478,7 +478,7 @@ t2 CREATE TABLE `t2` ( `c1` bigint(21) DEFAULT NULL, `c2` decimal(21,1) DEFAULT NULL, `c3` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2 ORDER BY c1; c1 c2 c3 1 1.0 1 @@ -512,7 +512,7 @@ t2 CREATE TABLE `t2` ( `c + c_smallint` bigint(21) DEFAULT NULL, `c + c_mediumint` bigint(21) DEFAULT NULL, `c + c_bigint` bigint(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 ( @@ -567,7 +567,7 @@ t2 CREATE TABLE `t2` ( `c1` bigint(21) DEFAULT NULL, `c2` decimal(21,1) DEFAULT NULL, `c3` double DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2 ORDER BY c1; c1 c2 c3 0 0.0 0 @@ -601,7 +601,7 @@ t2 CREATE TABLE `t2` ( `c - c_smallint` bigint(21) DEFAULT NULL, `c - c_mediumint` bigint(21) DEFAULT NULL, `c - c_bigint` bigint(21) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 ( @@ -668,7 +668,7 @@ t2 CREATE TABLE `t2` ( `CAST(a AS TIME)` time DEFAULT NULL, `CAST(a AS DATETIME)` datetime DEFAULT NULL, `CAST(a AS DATE)` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a 20000102 CAST(a AS CHAR) 20000102 diff --git a/plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.result b/plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.result index 8c78be9c6c303..716f33134caee 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.result +++ b/plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.result @@ -28,7 +28,7 @@ PLUGIN_TYPE FUNCTION PLUGIN_AUTHOR MariaDB Corporation PLUGIN_DESCRIPTION Function UUID() PLUGIN_LICENSE GPL -PLUGIN_MATURITY Gamma +PLUGIN_MATURITY Stable PLUGIN_AUTH_VERSION 1.0 # # End of 10.5 tests diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.result index 0416c39c6f916..fc0eaae262790 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.result @@ -14,5 +14,5 @@ Table Create Table t1 CREATE TABLE `t1` ( `c01` uuid DEFAULT NULL, `c02` uuid DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result index 43ef4e911dc1c..ab30c262148c5 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result @@ -11,7 +11,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` uuid DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DESCRIBE t1; Field Type Null Key Default Extra a uuid YES NULL @@ -67,7 +67,7 @@ t1 CREATE TABLE `t1` ( `c3` uuid DEFAULT '00000000-0000-0000-0000-000000000000', `c4` uuid DEFAULT 'ffffffff-ffff-ffff-ffff-ffffffffffff', `c5` uuid DEFAULT cast(X'ffffffffffffffffffffffffffffffff' as uuid) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DESCRIBE t1; Field Type Null Key Default Extra c1 uuid YES 00000000-0000-0000-0000-000000000000 @@ -195,9 +195,9 @@ CREATE TABLE t1 (a UUID); INSERT INTO t1 VALUES ('x'); ERROR 22007: Incorrect uuid value: 'x' for column `test`.`t1`.`a` at row 1 INSERT INTO t1 VALUES (1); -ERROR 22007: Incorrect uuid value: '1' for column `test`.`t1`.`a` at row 1 +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t1`.`a` INSERT INTO t1 VALUES (TIME'10:20:30'); -ERROR 22007: Incorrect uuid value: '10:20:30' for column `test`.`t1`.`a` at row 1 +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t1`.`a` INSERT INTO t1 VALUES (0x00); ERROR 22007: Incorrect uuid value: '\x00' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; @@ -225,7 +225,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `CAST('00000000-0000-0000-0000-000000000000' AS UUID)` uuid NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; # # Text and binary formats, comparison operators @@ -1509,7 +1509,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(c, c_text)` uuid DEFAULT NULL, `COALESCE(c, c_mediumtext)` uuid DEFAULT NULL, `COALESCE(c, c_longtext)` uuid DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT LEAST(c, c_char), @@ -1528,7 +1528,7 @@ t2 CREATE TABLE `t2` ( `LEAST(c, c_text)` uuid DEFAULT NULL, `LEAST(c, c_mediumtext)` uuid DEFAULT NULL, `LEAST(c, c_longtext)` uuid DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1 (a UUID); @@ -1570,7 +1570,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(a, '00000000-0000-0000-0000-000000000000')` uuid DEFAULT NULL, `LEAST(a,'00000000-0000-0000-0000-000000000000')` uuid DEFAULT NULL, `GREATEST(a,'00000000-0000-0000-0000-000000000000')` uuid DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SELECT COALESCE(a, 0x00000000000000000000000000000000) FROM t1 ORDER BY a; COALESCE(a, 0x00000000000000000000000000000000) @@ -1606,7 +1606,7 @@ t2 CREATE TABLE `t2` ( `COALESCE(a, 0x00000000000000000000000000000000)` uuid DEFAULT NULL, `LEAST(a,0x00000000000000000000000000000000)` uuid DEFAULT NULL, `GREATEST(a,0x00000000000000000000000000000000)` uuid DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; SELECT COALESCE(a, 10) FROM t1; ERROR HY000: Illegal parameter data types uuid and int for operation 'coalesce' @@ -1831,7 +1831,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(36) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; CREATE TABLE t1 (a UUID); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff'); @@ -1854,7 +1854,7 @@ t2 CREATE TABLE `t2` ( `CAST(a AS CHAR(66000))` mediumtext DEFAULT NULL, `CAST(a AS CHAR(16777215))` mediumtext DEFAULT NULL, `CAST(a AS CHAR(16777216))` longtext DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; CAST(a AS CHAR) ffffffff-ffff-ffff-ffff-ffffffffffff CAST(a AS CHAR(36)) ffffffff-ffff-ffff-ffff-ffffffffffff @@ -1890,7 +1890,7 @@ t2 CREATE TABLE `t2` ( `cb66000` mediumblob DEFAULT NULL, `cb16777215` mediumblob DEFAULT NULL, `cb16777216` longblob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT CAST(a AS BINARY(4)) AS cb4, @@ -1909,7 +1909,7 @@ t2 CREATE TABLE `t2` ( `cb32` binary(32) DEFAULT NULL, `cb530` varbinary(530) DEFAULT NULL, `cb65535` blob DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT HEX(cb4), HEX(cb), @@ -1931,15 +1931,15 @@ DROP TABLE t1; # CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); -ERROR 01000: Data truncated for column 'a' at row 1 +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t1`.`a` DROP TABLE t1; CREATE TABLE t1 (a DOUBLE); INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); -ERROR 01000: Data truncated for column 'a' at row 1 +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t1`.`a` DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(32,0)); INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); -ERROR 01000: Data truncated for column 'a' at row 1 +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t1`.`a` DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(64)); INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); @@ -2021,7 +2021,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `MIN(a)` uuid DEFAULT NULL, `MAX(a)` uuid DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; MIN(a) MAX(a) 00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000002 @@ -2084,7 +2084,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` uuid NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' USING '00000000-0000-0000-0000-000000000001'; EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' @@ -2123,7 +2123,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `c1` varchar(36) DEFAULT NULL, `c2` varchar(36) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT CONCAT(_utf8'1', LEFT(a,35)) AS c1, @@ -2133,10 +2133,10 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `c1` varchar(36) CHARACTER SET utf8mb3 DEFAULT NULL, - `c2` varchar(36) CHARACTER SET utf8mb3 DEFAULT NULL, - `c3` varchar(36) CHARACTER SET utf8mb3 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `c1` varchar(36) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c2` varchar(36) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c3` varchar(36) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; CREATE TABLE t2 AS SELECT CONCAT(_latin1'1', LEFT(a,35)) AS c1, @@ -2149,7 +2149,7 @@ t2 CREATE TABLE `t2` ( `c1` varchar(36) DEFAULT NULL, `c2` varchar(36) DEFAULT NULL, `c3` varchar(36) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t2; DROP TABLE t1; # @@ -2163,7 +2163,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 ORDER BY c; c 00000000-0000-0000-0000-000000000000 @@ -2177,7 +2177,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 ORDER BY c; c 00000000-0000-0000-0000-000000000000 @@ -2191,7 +2191,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 ORDER BY c; c 00000000-0000-0000-0000-000000000000 @@ -2205,7 +2205,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1 ORDER BY c; c 00000000-0000-0000-0000-000000000000 @@ -2762,7 +2762,7 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b INT); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect integer value: 'ffffffff-ffff-ffff-ffff-ffffffffffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -2770,7 +2770,7 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b DOUBLE); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect double value: 'ffffffff-ffff-ffff-ffff-ffffffffffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -2778,7 +2778,7 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b DECIMAL(32,0)); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect decimal value: 'ffffffff-ffff-ffff-ffff-ffffffffffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -2786,7 +2786,7 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b YEAR); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect integer value: 'ffffffff-ffff-ffff-ffff-ffffffffffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'uuid' as 'year' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -2797,7 +2797,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INT, b UUID); INSERT INTO t1 VALUES (1, NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect uuid value: '1' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -2805,7 +2805,7 @@ DROP TABLE t1; CREATE TABLE t1 (a DOUBLE, b UUID); INSERT INTO t1 VALUES (1, NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect uuid value: '1' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -2813,7 +2813,7 @@ DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(32,0), b UUID); INSERT INTO t1 VALUES (1, NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect uuid value: '1' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -2821,7 +2821,7 @@ DROP TABLE t1; CREATE TABLE t1 (a YEAR, b UUID); INSERT INTO t1 VALUES (1, NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect uuid value: '2001' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'year' as 'uuid' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -2832,7 +2832,7 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b TIME); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect time value: 'ffffffff-ffff-ffff-ffff-ffffffffffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -2840,7 +2840,7 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b DATE); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect date value: 'ffffffff-ffff-ffff-ffff-ffffffffffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'uuid' as 'date' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -2848,7 +2848,7 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b DATETIME); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect datetime value: 'ffffffff-ffff-ffff-ffff-ffffffffffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'uuid' as 'datetime' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -2856,7 +2856,7 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b TIMESTAMP NULL DEFAULT NULL); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect datetime value: 'ffffffff-ffff-ffff-ffff-ffffffffffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'uuid' as 'timestamp' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -2867,7 +2867,7 @@ DROP TABLE t1; CREATE TABLE t1 (a TIME, b UUID); INSERT INTO t1 VALUES ('00:00:00', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect uuid value: '00:00:00' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -2875,7 +2875,7 @@ DROP TABLE t1; CREATE TABLE t1 (a DATE, b UUID); INSERT INTO t1 VALUES ('2001-01:01', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect uuid value: '2001-01-01' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'date' as 'uuid' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -2883,7 +2883,7 @@ DROP TABLE t1; CREATE TABLE t1 (a DATETIME, b UUID); INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect uuid value: '2001-01-01 10:20:30' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'datetime' as 'uuid' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -2891,7 +2891,7 @@ DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP, b UUID); INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect uuid value: '2001-01-01 10:20:30' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Cannot cast 'timestamp' as 'uuid' in assignment of `test`.`t1`.`b` SELECT b FROM t1; b NULL @@ -3152,3 +3152,38 @@ f var_pop('x') Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'x' Warning 1292 Incorrect uuid value: '' +# +# MDEV-28491 Uuid. "UPDATE/DELETE" not working "WHERE id IN (SELECT id FROM ..)" +# +CREATE TABLE companies (id uuid, name varchar(10)); +INSERT INTO companies (id) values ('7bc95b06-cc6c-11ec-96c5-0242ac130002'); +CREATE TABLE divisions (company_id uuid); +INSERT INTO divisions (company_id) values ('7bc95b06-cc6c-11ec-96c5-0242ac130002'); +SELECT * FROM companies WHERE id IN (SELECT company_id FROM divisions); +id name +7bc95b06-cc6c-11ec-96c5-0242ac130002 NULL +UPDATE companies SET name = 'value' WHERE id IN (SELECT company_id FROM divisions); +SELECT * FROM companies; +id name +7bc95b06-cc6c-11ec-96c5-0242ac130002 value +DELETE FROM companies WHERE id IN (SELECT company_id FROM divisions); +SELECT * FROM companies; +id name +DROP TABLE divisions; +DROP TABLE companies; +# +# MDEV-27100 Subquery using the ALL keyword on UUID columns produces a wrong result +# +CREATE TABLE t1 (d UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-111111111111'), ('11111111-0000-0000-0000-000000000000'); +SELECT * FROM t1 ORDER BY d; +d +11111111-0000-0000-0000-000000000000 +00000000-0000-0000-0000-111111111111 +SELECT * FROM t1 WHERE d <= ALL (SELECT * FROM t1); +d +11111111-0000-0000-0000-000000000000 +SELECT * FROM t1 WHERE d >= ALL (SELECT * FROM t1); +d +00000000-0000-0000-0000-111111111111 +DROP TABLE t1; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test index 65574ac11d322..d4e34c5a74bff 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test @@ -51,9 +51,9 @@ CREATE TABLE t1 (c1 UUID DEFAULT ''); CREATE TABLE t1 (a UUID); --error ER_TRUNCATED_WRONG_VALUE INSERT INTO t1 VALUES ('x'); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (1); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (TIME'10:20:30'); --error ER_TRUNCATED_WRONG_VALUE INSERT INTO t1 VALUES (0x00); @@ -542,17 +542,17 @@ DROP TABLE t1; --echo # CREATE TABLE t1 (a INT); ---error WARN_DATA_TRUNCATED +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); DROP TABLE t1; CREATE TABLE t1 (a DOUBLE); ---error WARN_DATA_TRUNCATED +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(32,0)); ---error WARN_DATA_TRUNCATED +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); DROP TABLE t1; @@ -1250,28 +1250,28 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b INT); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a UUID, b DOUBLE); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a UUID, b DECIMAL(32,0)); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a UUID, b YEAR); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; @@ -1283,28 +1283,28 @@ DROP TABLE t1; CREATE TABLE t1 (a INT, b UUID); INSERT INTO t1 VALUES (1, NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a DOUBLE, b UUID); INSERT INTO t1 VALUES (1, NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(32,0), b UUID); INSERT INTO t1 VALUES (1, NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a YEAR, b UUID); INSERT INTO t1 VALUES (1, NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; @@ -1316,28 +1316,28 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b TIME); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a UUID, b DATE); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a UUID, b DATETIME); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a UUID, b TIMESTAMP NULL DEFAULT NULL); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; @@ -1349,28 +1349,28 @@ DROP TABLE t1; CREATE TABLE t1 (a TIME, b UUID); INSERT INTO t1 VALUES ('00:00:00', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a DATE, b UUID); INSERT INTO t1 VALUES ('2001-01:01', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a DATETIME, b UUID); INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP, b UUID); INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; @@ -1652,3 +1652,33 @@ DROP TABLE t1; --echo # SELECT uuid() AS f, var_pop('x') FROM dual HAVING f > ''; + + +--echo # +--echo # MDEV-28491 Uuid. "UPDATE/DELETE" not working "WHERE id IN (SELECT id FROM ..)" +--echo # + +CREATE TABLE companies (id uuid, name varchar(10)); +INSERT INTO companies (id) values ('7bc95b06-cc6c-11ec-96c5-0242ac130002'); + +CREATE TABLE divisions (company_id uuid); +INSERT INTO divisions (company_id) values ('7bc95b06-cc6c-11ec-96c5-0242ac130002'); +SELECT * FROM companies WHERE id IN (SELECT company_id FROM divisions); +UPDATE companies SET name = 'value' WHERE id IN (SELECT company_id FROM divisions); +SELECT * FROM companies; +DELETE FROM companies WHERE id IN (SELECT company_id FROM divisions); +SELECT * FROM companies; +DROP TABLE divisions; +DROP TABLE companies; + + +--echo # +--echo # MDEV-27100 Subquery using the ALL keyword on UUID columns produces a wrong result +--echo # + +CREATE TABLE t1 (d UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-111111111111'), ('11111111-0000-0000-0000-000000000000'); +SELECT * FROM t1 ORDER BY d; +SELECT * FROM t1 WHERE d <= ALL (SELECT * FROM t1); +SELECT * FROM t1 WHERE d >= ALL (SELECT * FROM t1); +DROP TABLE t1; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.result index 1ad371ec561da..d912244e6919b 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.result @@ -10,7 +10,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` uuid NOT NULL -) ENGINE=CSV DEFAULT CHARSET=latin1 +) ENGINE=CSV DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FOR i IN 0..255 DO INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00,15), UNHEX(HEX(i)))); diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result index f777723eefc82..d769f1a13748e 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result @@ -14,7 +14,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` uuid DEFAULT NULL, KEY `a` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FOR i IN 0..255 DO INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00, 15),CHAR(i USING BINARY))); @@ -121,7 +121,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` uuid DEFAULT NULL, KEY `a` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci BEGIN; FOR i IN 0..255 DO diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result index 9d2c27a9e2586..f2a1e27d0d033 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result @@ -14,7 +14,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` uuid DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FOR i IN 0..255 DO INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00, 15),CHAR(i USING BINARY))); @@ -188,7 +188,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` uuid DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci BEGIN; FOR i IN 0..255 DO diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result new file mode 100644 index 0000000000000..65dcabda42d3f --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result @@ -0,0 +1,353 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from UUID UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source DECIMAL(38,0) DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `source` decimal(38,0) DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +2 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22007: Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target decimal(38,0) +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src decimal(38,0) DEFAULT NULL; +DECLARE dst uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a uuid) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst uuid) +BEGIN +DECLARE src decimal(38,0) DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst uuid DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'decimal' as 'uuid' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS uuid +BEGIN +DECLARE rc decimal(38,0) DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src decimal(38,0) DEFAULT NULL; +DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst uuid DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` decimal(38,0) DEFAULT 0, + `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1265 Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +2 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 01000: Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target uuid +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE dst decimal(38,0) DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a decimal(38,0)) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a decimal(38,0)) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst decimal(38,0)) +BEGIN +DECLARE src uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst decimal(38,0) DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'uuid' as 'decimal' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS decimal(38,0) +BEGIN +DECLARE rc uuid DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE cur1 CURSOR(t decimal(38,0)) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst decimal(38,0) DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.test new file mode 100644 index 0000000000000..234e31b6565a0 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from UUID UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source DECIMAL(38,0) DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result new file mode 100644 index 0000000000000..ae19f91654443 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result @@ -0,0 +1,353 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source DOUBLE DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `source` double DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +2 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22007: Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target double +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src double DEFAULT NULL; +DECLARE dst uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a uuid) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst uuid) +BEGIN +DECLARE src double DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst uuid DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'double' as 'uuid' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS uuid +BEGIN +DECLARE rc double DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src double DEFAULT NULL; +DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst uuid DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target DOUBLE DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` double DEFAULT 0, + `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1265 Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +2 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 01000: Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target uuid +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE dst double DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a double) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a double) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst double) +BEGIN +DECLARE src uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst double DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'uuid' as 'double' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS double +BEGIN +DECLARE rc uuid DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE cur1 CURSOR(t double) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst double DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.test new file mode 100644 index 0000000000000..8e8529aeed314 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source DOUBLE DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target DOUBLE DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result new file mode 100644 index 0000000000000..c92584a8b1e80 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result @@ -0,0 +1,353 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `source` int(11) DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +2 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22007: Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target int(11) +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(11) DEFAULT NULL; +DECLARE dst uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a uuid) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst uuid) +BEGIN +DECLARE src int(11) DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst uuid DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'int' as 'uuid' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS uuid +BEGIN +DECLARE rc int(11) DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(11) DEFAULT NULL; +DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst uuid DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target INT DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` int(11) DEFAULT 0, + `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1265 Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +2 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 01000: Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target uuid +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE dst int(11) DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a int(11)) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a int(11)) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst int(11)) +BEGIN +DECLARE src uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst int(11) DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'uuid' as 'int' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS int(11) +BEGIN +DECLARE rc uuid DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE cur1 CURSOR(t int(11)) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst int(11) DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.test new file mode 100644 index 0000000000000..79a555662582b --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target INT DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result new file mode 100644 index 0000000000000..a4feb55b57797 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result @@ -0,0 +1,353 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source TIME DEFAULT '00:00:00'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `source` time DEFAULT '00:00:00', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect uuid value: '00:00:00' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 00:00:00 +2 00000000-0000-0000-0000-000000000000 00:00:00 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22007: Incorrect uuid value: '00:00:00' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 00:00:00 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target time +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src time DEFAULT NULL; +DECLARE dst uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a uuid) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst uuid) +BEGIN +DECLARE src time DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst uuid DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'time' as 'uuid' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS uuid +BEGIN +DECLARE rc time DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src time DEFAULT NULL; +DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst uuid DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target TIME DEFAULT '00:00:00', source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` time DEFAULT '00:00:00', + `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1265 Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 00:00:00 00000000-0000-0000-0000-000000000000 +2 00:00:00 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22007: Incorrect time value: '00000000-0000-0000-0000-000000000000' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00:00:00 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target uuid +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE dst time DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a time) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a time) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst time) +BEGIN +DECLARE src uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst time DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'uuid' as 'time' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS time +BEGIN +DECLARE rc uuid DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE cur1 CURSOR(t time) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst time DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.test new file mode 100644 index 0000000000000..5182d0ceebd8a --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source TIME DEFAULT '00:00:00'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target TIME DEFAULT '00:00:00', source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result new file mode 100644 index 0000000000000..252704d57ef96 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result @@ -0,0 +1,353 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT UNSIGNED DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `source` int(10) unsigned DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +2 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22007: Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target int(10) unsigned +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(10) unsigned DEFAULT NULL; +DECLARE dst uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a uuid) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst uuid) +BEGIN +DECLARE src int(10) unsigned DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst uuid DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'int unsigned' as 'uuid' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS uuid +BEGIN +DECLARE rc int(10) unsigned DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(10) unsigned DEFAULT NULL; +DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst uuid DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target INT UNSIGNED DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` int(10) unsigned DEFAULT 0, + `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1265 Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +2 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 01000: Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target uuid +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE dst int(10) unsigned DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a int(10) unsigned) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a int(10) unsigned) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst int(10) unsigned) +BEGIN +DECLARE src uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst int(10) unsigned DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'uuid' as 'int unsigned' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS int(10) unsigned +BEGIN +DECLARE rc uuid DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE cur1 CURSOR(t int(10) unsigned) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst int(10) unsigned DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.test new file mode 100644 index 0000000000000..94de2dce2d8f8 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT UNSIGNED DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target INT UNSIGNED DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result index 35cc25abfd6dd..8df2c85ae48ff 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result @@ -14,7 +14,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` uuid DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci FOR i IN 0..255 DO INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00, 15),CHAR(i USING BINARY))); @@ -121,7 +121,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` uuid DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci BEGIN; FOR i IN 0..255 DO @@ -205,7 +205,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` uuid DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PackKey PACKED DROP TABLE t1; @@ -216,7 +216,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` uuid DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PackKey PACKED DROP TABLE t1; @@ -227,7 +227,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` uuid DEFAULT NULL, KEY `a` (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PackKey NOT PACKED DROP TABLE t1; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.result index d954832ef7f2a..a8fc3ca22a631 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.result @@ -24,7 +24,7 @@ PLUGIN_TYPE DATA TYPE PLUGIN_AUTHOR MariaDB Corporation PLUGIN_DESCRIPTION Data type UUID PLUGIN_LICENSE GPL -PLUGIN_MATURITY Gamma +PLUGIN_MATURITY Stable PLUGIN_AUTH_VERSION 1.0 # # End of 10.5 tests diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.result new file mode 100644 index 0000000000000..e5d88c3df2a18 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.result @@ -0,0 +1,17 @@ +# +# Start of 10.7 tests +# +# +# MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle::Fbt FixedBinTypeBundle::Field_fbt::to_fbt() +# +CREATE TABLE t1 (i6 UUID, a1 TIME, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-fffffffffffe','09:43:12','uw'), (uuid(),'00:00:00','a'); +SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1; +GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) +ffffffff-ffff-ffff-ffff-fffffffffffe +Warnings: +Warning 1292 Incorrect uuid value: 'a' +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.test new file mode 100644 index 0000000000000..45cdf927210c4 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.test @@ -0,0 +1,17 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle::Fbt FixedBinTypeBundle::Field_fbt::to_fbt() +--echo # + +CREATE TABLE t1 (i6 UUID, a1 TIME, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-fffffffffffe','09:43:12','uw'), (uuid(),'00:00:00','a'); +SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1; +DROP TABLE t1; + + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/plugin.cc b/plugin/type_uuid/plugin.cc index 62728799ae5cb..bd320a9a897d9 100644 --- a/plugin/type_uuid/plugin.cc +++ b/plugin/type_uuid/plugin.cc @@ -87,7 +87,7 @@ maria_declare_plugin(type_uuid) NULL, // Status variables NULL, // System variables "1.0", // String version representation - MariaDB_PLUGIN_MATURITY_GAMMA // Maturity(see include/mysql/plugin.h)*/ + MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/ }, { MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h) @@ -102,7 +102,7 @@ maria_declare_plugin(type_uuid) NULL, // Status variables NULL, // System variables "1.0", // String version representation - MariaDB_PLUGIN_MATURITY_GAMMA // Maturity(see include/mysql/plugin.h)*/ + MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/ }, { MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h) @@ -117,6 +117,6 @@ maria_declare_plugin(type_uuid) NULL, // Status variables NULL, // System variables "1.0", // String version representation - MariaDB_PLUGIN_MATURITY_GAMMA // Maturity(see include/mysql/plugin.h)*/ + MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/ } maria_declare_plugin_end; diff --git a/plugin/type_uuid/sql_type_uuid.h b/plugin/type_uuid/sql_type_uuid.h index be9fea8ebc989..ee39f542f0568 100644 --- a/plugin/type_uuid/sql_type_uuid.h +++ b/plugin/type_uuid/sql_type_uuid.h @@ -64,9 +64,9 @@ class UUID: public FixedBinTypeStorage { return memcmp(a + m_memory_pos, b + m_memory_pos, m_length); } - void hash_record(const uchar *ptr, ulong *nr, ulong *nr2) const + void hash_record(const uchar *ptr, Hasher *hasher) const { - my_charset_bin.hash_sort(ptr + m_record_pos, m_length, nr, nr2); + hasher->add(&my_charset_bin, ptr + m_record_pos, m_length); } }; @@ -119,13 +119,13 @@ class UUID: public FixedBinTypeStorage put values into the same partition. */ - static void hash_record(const uchar *ptr, ulong *nr, ulong *nr2) + static void hash_record(const uchar *ptr, Hasher *hasher) { - segment(0).hash_record(ptr, nr, nr2); - segment(1).hash_record(ptr, nr, nr2); - segment(2).hash_record(ptr, nr, nr2); - segment(3).hash_record(ptr, nr, nr2); - segment(4).hash_record(ptr, nr, nr2); + segment(0).hash_record(ptr, hasher); + segment(1).hash_record(ptr, hasher); + segment(2).hash_record(ptr, hasher); + segment(3).hash_record(ptr, hasher); + segment(4).hash_record(ptr, hasher); } // Compare two in-memory values diff --git a/plugin/user_variables/mysql-test/user_variables/basic.result b/plugin/user_variables/mysql-test/user_variables/basic.result index 3acfb525ba575..07f51ee560728 100644 --- a/plugin/user_variables/mysql-test/user_variables/basic.result +++ b/plugin/user_variables/mysql-test/user_variables/basic.result @@ -11,11 +11,11 @@ PLUGIN_MATURITY Stable SHOW CREATE TABLE INFORMATION_SCHEMA.USER_VARIABLES; Table Create Table user_variables CREATE TEMPORARY TABLE `user_variables` ( - `VARIABLE_NAME` varchar(64) NOT NULL DEFAULT '', - `VARIABLE_VALUE` varchar(2048) DEFAULT NULL, - `VARIABLE_TYPE` varchar(64) NOT NULL DEFAULT '', - `CHARACTER_SET_NAME` varchar(32) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 + `VARIABLE_NAME` varchar(64) NOT NULL, + `VARIABLE_VALUE` varchar(2048), + `VARIABLE_TYPE` varchar(64) NOT NULL, + `CHARACTER_SET_NAME` varchar(32) +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci FLUSH USER_VARIABLES; SELECT COUNT(*) FROM INFORMATION_SCHEMA.USER_VARIABLES; COUNT(*) diff --git a/plugin/versioning/versioning.cc b/plugin/versioning/versioning.cc index 6275fadba4459..c970a9d656156 100644 --- a/plugin/versioning/versioning.cc +++ b/plugin/versioning/versioning.cc @@ -30,13 +30,14 @@ template class Create_func_trt : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list); static Create_func_trt s_singleton; protected: - Create_func_trt() {} - virtual ~Create_func_trt() {} + Create_func_trt() = default; + virtual ~Create_func_trt() = default; }; template @@ -44,7 +45,7 @@ Create_func_trt Create_func_trt::s_singleton; template Item* -Create_func_trt::create_native(THD *thd, LEX_CSTRING *name, +Create_func_trt::create_native(THD *thd, const LEX_CSTRING *name, List *item_list) { Item *func= NULL; @@ -103,7 +104,8 @@ template class Create_func_trt_trx_sees : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List *item_list) + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List *item_list) { Item *func= NULL; int arg_count= 0; @@ -130,8 +132,8 @@ class Create_func_trt_trx_sees : public Create_native_func static Create_func_trt_trx_sees s_singleton; protected: - Create_func_trt_trx_sees() {} - virtual ~Create_func_trt_trx_sees() {} + Create_func_trt_trx_sees() = default; + virtual ~Create_func_trt_trx_sees() = default; }; template diff --git a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm index c7d4b0adf5bd0..48c1bcccd4557 100644 --- a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm +++ b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm @@ -22,6 +22,4 @@ push @::global_suppressions, qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, ); -sub is_default { 1 } - bless { }; diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index e861eb70d20e8..9eec793c9fb9a 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -146,7 +146,7 @@ IF(UNIX) # FIND_PROC and CHECK_PID are used by mysqld_safe IF(CMAKE_SYSTEM_NAME MATCHES "Linux") SET (FIND_PROC - "ps wwwp $PID | grep -vE mariadbd-safe -vE mysqld_safe | grep -- $MYSQLD > /dev/null") + "ps wwwp $PID | grep -v mariadbd-safe | grep -v mysqld_safe | grep -- $MYSQLD > /dev/null") ENDIF() IF(NOT FIND_PROC AND CMAKE_SYSTEM_NAME MATCHES "SunOS") SET (FIND_PROC @@ -179,6 +179,7 @@ ENDIF() SET(HOSTNAME "uname -n") SET(MYSQLD_USER "mysql") +SET(MYSQLD_GROUP "mysql") ENDIF(UNIX) # Really ugly, one script, "mysql_install_db", needs prefix set to ".", @@ -296,6 +297,7 @@ ELSE() wsrep_sst_mysqldump wsrep_sst_rsync wsrep_sst_mariabackup + wsrep_sst_backup ) # The following script is sourced from other SST scripts, so it should # not be made executable. diff --git a/scripts/comp_sql.c b/scripts/comp_sql.c index 1ce7889a90f59..f72fdcb0ae35c 100644 --- a/scripts/comp_sql.c +++ b/scripts/comp_sql.c @@ -1,5 +1,5 @@ /* Copyright (c) 2004, 2010, Oracle and/or its affiliates. - Copyright (c) 2012, 2014, Monty Program Ab + Copyright (c) 2012, 2022, 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 @@ -84,7 +84,7 @@ static void print_query(FILE *out, const char *query) fprintf(out, "\""); while (*ptr) { - if(column >= MAX_COLUMN) + if (column >= MAX_COLUMN) { /* Wrap to the next line, tabulated. */ fprintf(out, "\"\n \""); diff --git a/scripts/fill_help_tables.sql b/scripts/fill_help_tables.sql index d0efb750330c5..0454f4d2f050b 100644 --- a/scripts/fill_help_tables.sql +++ b/scripts/fill_help_tables.sql @@ -33,841 +33,1220 @@ delete from help_keyword; delete from help_relation; lock tables help_topic write, help_category write, help_keyword write, help_relation write; -insert into help_category (help_category_id,name,parent_category_id,url) values (1,'Geographic',0,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (1,'Contents',0,''); insert into help_category (help_category_id,name,parent_category_id,url) values (2,'Polygon Properties',34,''); insert into help_category (help_category_id,name,parent_category_id,url) values (3,'WKT',34,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (4,'Numeric Functions',38,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (5,'Plugins',35,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (4,'Numeric Functions',37,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (5,'Plugins',1,''); insert into help_category (help_category_id,name,parent_category_id,url) values (6,'MBR',34,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (7,'Control Flow Functions',38,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (8,'Transactions',35,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (9,'Help Metadata',35,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (10,'Account Management',35,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (7,'Control Flow Functions',37,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (8,'Transactions',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (9,'Help Metadata',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (10,'Account Management',1,''); insert into help_category (help_category_id,name,parent_category_id,url) values (11,'Point Properties',34,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (12,'Encryption Functions',38,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (12,'Encryption Functions',37,''); insert into help_category (help_category_id,name,parent_category_id,url) values (13,'LineString Properties',34,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (14,'Miscellaneous Functions',38,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (15,'Logical Operators',38,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (16,'Functions and Modifiers for Use with GROUP BY',35,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (17,'Information Functions',38,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (18,'Comparison Operators',38,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (19,'Bit Functions',38,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (20,'Table Maintenance',35,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (21,'User-Defined Functions',35,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (22,'Data Types',35,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (23,'Compound Statements',35,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (24,'Geometry Constructors',34,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (25,'GeometryCollection Properties',1,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (26,'Administration',35,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (27,'Data Manipulation',35,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (28,'Utility',35,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (29,'Language Structure',35,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (14,'Miscellaneous Functions',37,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (15,'Logical Operators',47,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (16,'Functions and Modifiers for Use with GROUP BY',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (17,'Information Functions',37,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (18,'Assignment Operators',47,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (19,'Comparison Operators',47,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (20,'Bit Functions',37,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (21,'Table Maintenance',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (22,'User-Defined Functions',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (23,'Data Types',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (24,'Compound Statements',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (25,'Geometry Constructors',34,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (26,'Administration',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (27,'Data Manipulation',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (28,'Utility',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (29,'Language Structure',1,''); insert into help_category (help_category_id,name,parent_category_id,url) values (30,'Geometry Relations',34,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (31,'Date and Time Functions',38,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (31,'Date and Time Functions',37,''); insert into help_category (help_category_id,name,parent_category_id,url) values (32,'WKB',34,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (33,'Procedures',35,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (34,'Geographic Features',35,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (35,'Contents',0,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (36,'Geometry Properties',34,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (37,'String Functions',38,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (38,'Functions',35,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (39,'Data Definition',35,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (40,'Sequences',35,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (41,'JSON Functions',38,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (42,'Window Functions',38,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (43,'Spider Functions',38,''); -insert into help_category (help_category_id,name,parent_category_id,url) values (44,'Dynamic Column Functions',38,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (33,'Procedures',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (34,'Geographic Features',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (35,'Geometry Properties',34,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (36,'String Functions',37,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (37,'Functions',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (38,'Data Definition',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (39,'Sequences',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (40,'JSON Functions',37,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (41,'Window Functions',37,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (42,'Spider Functions',37,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (43,'Dynamic Column Functions',37,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (44,'Galera Functions',37,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (45,'Temporal Tables',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (46,'GeoJSON',34,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (47,'Operators',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (48,'Arithmetic Operators',47,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (49,'Replication',1,''); +insert into help_category (help_category_id,name,parent_category_id,url) values (50,'Prepared Statements',1,''); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (1,9,'HELP_DATE','This help information was generated from the MariaDB Knowledge Base\non 22 July 2019.','',''); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (2,2,'AREA','A synonym for ST_AREA.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/polygon-properties-area/','','https://mariadb.com/kb/en/library/polygon-properties-area/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (3,2,'CENTROID','A synonym for ST_CENTROID.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/centroid/','','https://mariadb.com/kb/en/library/centroid/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (4,2,'ExteriorRing','A synonym for ST_ExteriorRing.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/polygon-properties-exteriorring/','','https://mariadb.com/kb/en/library/polygon-properties-exteriorring/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (5,2,'InteriorRingN','A synonym for ST_InteriorRingN.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/polygon-properties-interiorringn/','','https://mariadb.com/kb/en/library/polygon-properties-interiorringn/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (6,2,'NumInteriorRings','A synonym for ST_NumInteriorRings.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/polygon-properties-numinteriorrings/','','https://mariadb.com/kb/en/library/polygon-properties-numinteriorrings/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (7,2,'ST_AREA','Syntax\n------ \nST_Area(poly)\nArea(poly)\n \nDescription\n----------- \nReturns as a double-precision number the area of the Polygon\nvalue poly, as measured in its spatial reference system.\n \nST_Area() and Area() are synonyms.\n \nExamples\n-------- \nSET @poly = \'Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1\n1))\';\n \nSELECT Area(GeomFromText(@poly));\n+---------------------------+\n| Area(GeomFromText(@poly)) |\n+---------------------------+\n| 4 |\n+---------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_area/','','https://mariadb.com/kb/en/library/st_area/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (8,2,'ST_CENTROID','Syntax\n------ \nST_Centroid(mpoly)\nCentroid(mpoly)\n \nDescription\n----------- \nReturns a point reflecting the mathematical centroid\n(geometric center) for the MultiPolygon mpoly. The resulting\npoint will not necessarily be on the MultiPolygon. \n \nST_Centroid() and Centroid() are synonyms.\n \nExamples\n-------- \nSET @poly = ST_GeomFromText(\'POLYGON((0 0,20 0,20 20,0 20,0\n0))\');\nSELECT ST_AsText(ST_Centroid(@poly)) AS center;\n \n+--------------+\n| center |\n+--------------+\n| POINT(10 10) |\n+--------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_centroid/','','https://mariadb.com/kb/en/library/st_centroid/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (9,2,'ST_ExteriorRing','Syntax\n------ \nST_ExteriorRing(poly)\nExteriorRing(poly)\n \nDescription\n----------- \nReturns the exterior ring of the Polygon value poly as a\nLineString.\n \nST_ExteriorRing() and ExteriorRing() are synonyms.\n \nExamples\n-------- \nSET @poly = \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2\n1,1 1))\';\n \nSELECT AsText(ExteriorRing(GeomFromText(@poly)));\n+-------------------------------------------+\n| AsText(ExteriorRing(GeomFromText(@poly))) |\n+-------------------------------------------+\n| LINESTRING(0 0,0 3,3 3,3 0,0 0) |\n+-------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_exteriorring/','','https://mariadb.com/kb/en/library/st_exteriorring/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (10,2,'ST_InteriorRingN','Syntax\n------ \nST_InteriorRingN(poly,N)\nInteriorRingN(poly,N)\n \nDescription\n----------- \nReturns the N-th interior ring for the Polygon value poly as\na LineString. Rings are numbered beginning with 1.\n \nST_InteriorRingN() and InteriorRingN() are synonyms.\n \nExamples\n-------- \nSET @poly = \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2\n1,1 1))\';\n \nSELECT AsText(InteriorRingN(GeomFromText(@poly),1));\n+----------------------------------------------+\n| AsText(InteriorRingN(GeomFromText(@poly),1)) |\n+----------------------------------------------+\n| LINESTRING(1 1,1 2,2 2,2 1,1 1) |\n+----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_interiorringn/','','https://mariadb.com/kb/en/library/st_interiorringn/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (11,2,'ST_NumInteriorRings','Syntax\n------ \nST_NumInteriorRings(poly)\nNumInteriorRings(poly)\n \nDescription\n----------- \nReturns an integer containing the number of interior rings\nin the Polygon value poly.\n \nNote that according the the OpenGIS standard, a POLYGON\nshould have exactly one ExteriorRing and all other rings\nshould lie within that ExteriorRing and thus be the\nInteriorRings. Practically, however, some systems, including\nMariaDB\'s, permit polygons to have several\n\'ExteriorRings\'. In the case of there being multiple,\nnon-overlapping exterior rings ST_NumInteriorRings() will\nreturn 1.\n \nST_NumInteriorRings() and NumInteriorRings() are synonyms.\n \nExamples\n-------- \nSET @poly = \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2\n1,1 1))\';\n \nSELECT NumInteriorRings(GeomFromText(@poly));\n+---------------------------------------+\n| NumInteriorRings(GeomFromText(@poly)) |\n+---------------------------------------+\n| 1 |\n+---------------------------------------+\n \nNon-overlapping \'polygon\':\n \nSELECT ST_NumInteriorRings(ST_PolyFromText(\'POLYGON((0 0,10\n0,10 10,0 10,0 0),\n (-1 -1,-5 -1,-5 -5,-1 -5,-1 -1))\')) AS NumInteriorRings;\n \n+------------------+\n| NumInteriorRings |\n+------------------+\n| 1 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_numinteriorrings/','','https://mariadb.com/kb/en/library/st_numinteriorrings/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (12,3,'WKT Definition','Description\n----------- \nThe Well-Known Text (WKT) representation of Geometry is\ndesigned to exchange geometry data in ASCII form. Examples\nof the basic geometry types include:\n \nGeometry Types | \n \nPOINT | \n \nLINESTRING | \n \nPOLYGON | \n \nMULTIPOINT | \n \nMULTILINESTRING | \n \nMULTIPOLYGON | \n \nGEOMETRYCOLLECTION | \n \nGEOMETRY | \n \n\n\nURL: https://mariadb.com/kb/en/library/wkt-definition/','','https://mariadb.com/kb/en/library/wkt-definition/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (13,3,'AsText','A synonym for ST_AsText().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkt-astext/','','https://mariadb.com/kb/en/library/wkt-astext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (14,3,'AsWKT','A synonym for ST_AsText().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkt-aswkt/','','https://mariadb.com/kb/en/library/wkt-aswkt/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (15,3,'GeomCollFromText','A synonym for ST_GeomCollFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkt-geomcollfromtext/','','https://mariadb.com/kb/en/library/wkt-geomcollfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (16,3,'GeometryCollectionFromText','A synonym for ST_GeomCollFromText.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometrycollectionfromtext/','','https://mariadb.com/kb/en/library/geometrycollectionfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (17,3,'GeometryFromText','A synonym for ST_GeomFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/geometryfromtext/','','https://mariadb.com/kb/en/library/geometryfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (18,3,'GeomFromText','A synonym for ST_GeomFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkt-geomfromtext/','','https://mariadb.com/kb/en/library/wkt-geomfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (19,3,'LineFromText','A synonym for ST_LineFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkt-linefromtext/','','https://mariadb.com/kb/en/library/wkt-linefromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (20,3,'LineStringFromText','A synonym for ST_LineFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/linestringfromtext/','','https://mariadb.com/kb/en/library/linestringfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (21,3,'MLineFromText','Syntax\n------ \nMLineFromText(wkt[,srid])\nMultiLineStringFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a MULTILINESTRING value using its WKT\nrepresentation and SRID.\n \nMLineFromText() and MultiLineStringFromText() are synonyms.\n \nExamples\n-------- \nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nSHOW FIELDS FROM gis_multi_line;\n \nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(\'MULTILINESTRING((10 48,10 21,10\n0),(16 0,16 23,16 48))\')),\n (MLineFromText(\'MULTILINESTRING((10 48,10 21,10 0))\')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2),\nPoint(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21,\n7))))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mlinefromtext/','','https://mariadb.com/kb/en/library/mlinefromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (22,3,'MPointFromText','Syntax\n------ \nMPointFromText(wkt[,srid])\nMultiPointFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a MULTIPOINT value using its WKT representation\nand SRID.\n \nMPointFromText() and MultiPointFromText() are synonyms.\n \nExamples\n-------- \nCREATE TABLE gis_multi_point (g MULTIPOINT);\nSHOW FIELDS FROM gis_multi_point;\n \nINSERT INTO gis_multi_point VALUES\n (MultiPointFromText(\'MULTIPOINT(0 0,10 10,10 20,20\n20)\')),\n (MPointFromText(\'MULTIPOINT(1 1,11 11,11 21,21 21)\')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4,\n10)))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mpointfromtext/','','https://mariadb.com/kb/en/library/mpointfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (23,3,'MPolyFromText','Syntax\n------ \nMPolyFromText(wkt[,srid])\nMultiPolygonFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a MULTIPOLYGON value using its WKT representation\nand SRID.\n \nMPolyFromText() and MultiPolygonFromText() are synonyms.\n \nExamples\n-------- \nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nSHOW FIELDS FROM gis_multi_polygon;\n \nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84\n42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67\n13,59 13,59 18)))\')),\n (MPolyFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28\n26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59\n13,59 18)))\')),\n (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0,\n3), Point(3, 3), Point(3, 0), Point(0, 3)))))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mpolyfromtext/','','https://mariadb.com/kb/en/library/mpolyfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (24,3,'MultiLineStringFromText','A synonym for MLineFromText.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/multilinestringfromtext/','','https://mariadb.com/kb/en/library/multilinestringfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (25,3,'MultiPointFromText','A synonym for MPointFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/multipointfromtext/','','https://mariadb.com/kb/en/library/multipointfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (26,3,'MultiPolygonFromText','A synonym for MPolyFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/multipolygonfromtext/','','https://mariadb.com/kb/en/library/multipolygonfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (27,3,'PointFromText','A synonym for ST_PointFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkt-pointfromtext/','','https://mariadb.com/kb/en/library/wkt-pointfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (28,3,'PolyFromText','A synonym for ST_PolyFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkt-polyfromtext/','','https://mariadb.com/kb/en/library/wkt-polyfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (29,3,'PolygonFromText','A synonym for ST_PolyFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/polygonfromtext/','','https://mariadb.com/kb/en/library/polygonfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (30,3,'ST_AsText','Syntax\n------ \nST_AsText(g)\nAsText(g)\nST_AsWKT(g)\nAsWKT(g)\n \nDescription\n----------- \nConverts a value in internal geometry format to its WKT\nrepresentation and returns the string result.\n \nST_AsText(), AsText(), ST_AsWKT() and AsWKT() are all\nsynonyms.\n \nExamples\n-------- \nSET @g = \'LineString(1 1,4 4,6 6)\';\n \nSELECT ST_AsText(ST_GeomFromText(@g));\n+--------------------------------+\n| ST_AsText(ST_GeomFromText(@g)) |\n+--------------------------------+\n| LINESTRING(1 1,4 4,6 6) |\n+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_astext/','','https://mariadb.com/kb/en/library/st_astext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (31,3,'ST_ASWKT','A synonym for ST_ASTEXT().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_aswkt/','','https://mariadb.com/kb/en/library/st_aswkt/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (32,3,'ST_GeomCollFromText','Syntax\n------ \nST_GeomCollFromText(wkt[,srid])\nST_GeometryCollectionFromText(wkt[,srid])\nGeomCollFromText(wkt[,srid])\nGeometryCollectionFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a GEOMETRYCOLLECTION value using its WKT \nrepresentation and SRID.\n \nST_GeomCollFromText(), ST_GeometryCollectionFromText(),\nGeomCollFromText() and GeometryCollectionFromText() are all\nsynonyms.\n \nExample\n \nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\n \nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText(\'GEOMETRYCOLLECTION(POINT(0 0),\nLINESTRING(0 0,10 10))\')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText(\'GeometryCollection()\')),\n (GeomFromText(\'GeometryCollection EMPTY\'));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_geomcollfromtext/','','https://mariadb.com/kb/en/library/st_geomcollfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (33,3,'ST_GeometryCollectionFromText','A synonym for ST_GeomCollFromText.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/st_geometrycollectionfromtext/','','https://mariadb.com/kb/en/library/st_geometrycollectionfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (34,3,'ST_GeometryFromText','A synonym for ST_GeomFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_geometryfromtext/','','https://mariadb.com/kb/en/library/st_geometryfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (35,3,'ST_GeomFromText','Syntax\n------ \nST_GeomFromText(wkt[,srid])\nST_GeometryFromText(wkt[,srid])\nGeomFromText(wkt[,srid])\nGeometryFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a geometry value of any type using its WKT\nrepresentation and SRID.\n \nGeomFromText(), GeometryFromText(), ST_GeomFromText() and\nST_GeometryFromText() are all synonyms.\n \nExample\n \nSET @g = ST_GEOMFROMTEXT(\'POLYGON((1 1,1 5,4 9,6 9,9 3,7\n2,1 1))\');\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_geomfromtext/','','https://mariadb.com/kb/en/library/st_geomfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (36,3,'ST_LineFromText','Syntax\n------ \nST_LineFromText(wkt[,srid])\nST_LineStringFromText(wkt[,srid])\nLineFromText(wkt[,srid])\nLineStringFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a LINESTRING value using its WKT representation\nand SRID.\n \nST_LineFromText(), ST_LineStringFromText(),\nST_LineFromText() and ST_LineStringFromText() are all\nsynonyms.\n \nExamples\n-------- \nCREATE TABLE gis_line (g LINESTRING);\nSHOW FIELDS FROM gis_line;\n \nINSERT INTO gis_line VALUES\n (LineFromText(\'LINESTRING(0 0,0 10,10 0)\')),\n (LineStringFromText(\'LINESTRING(10 10,20 10,20 20,10 20,10\n10)\')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10),\nPoint(40, 10)))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_linefromtext/','','https://mariadb.com/kb/en/library/st_linefromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (37,3,'ST_LineStringFromText','A synonym for ST_LineFromText.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/st_linestringfromtext/','','https://mariadb.com/kb/en/library/st_linestringfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (38,3,'ST_PointFromText','Syntax\n------ \nST_PointFromText(wkt[,srid])\nPointFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a POINT value using its WKT representation and\nSRID.\n \nST_PointFromText() and PointFromText() are synonyms.\n \nExamples\n-------- \nCREATE TABLE gis_point (g POINT);\nSHOW FIELDS FROM gis_point;\n \nINSERT INTO gis_point VALUES\n (PointFromText(\'POINT(10 10)\')),\n (PointFromText(\'POINT(20 10)\')),\n (PointFromText(\'POINT(20 20)\')),\n (PointFromWKB(AsWKB(PointFromText(\'POINT(10 20)\'))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_pointfromtext/','','https://mariadb.com/kb/en/library/st_pointfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (39,3,'ST_PolyFromText','Syntax\n------ \nST_PolyFromText(wkt[,srid])\nST_PolygonFromText(wkt[,srid])\nPolyFromText(wkt[,srid])\nPolygonFromText(wkt[,srid])\n \nDescription\n----------- \nConstructs a POLYGON value using its WKT representation and\nSRID.\n \nST_PolyFromText(), ST_PolygonFromText(), PolyFromText() and\nST_PolygonFromText() are all synonyms.\n \nExamples\n-------- \nCREATE TABLE gis_polygon (g POLYGON);\nINSERT INTO gis_polygon VALUES\n (PolygonFromText(\'POLYGON((10 10,20 10,20 20,10 20,10\n10))\')),\n (PolyFromText(\'POLYGON((0 0,50 0,50 50,0 50,0 0), (10\n10,20 10,20 20,10 20,10 10))\'));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_polyfromtext/','','https://mariadb.com/kb/en/library/st_polyfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (40,3,'ST_PolygonFromText','A synonym for ST_PolyFromText.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_polygonfromtext/','','https://mariadb.com/kb/en/library/st_polygonfromtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (41,4,'Addition Operator (+)','Syntax\n------ \n+\n \nDescription\n----------- \nAddition.\n \nIf both operands are integers, the result is calculated with\nBIGINT precision. If either integer is unsigned, the result\nis also an unsigned integer.\n \nFor real or string operands, the operand with the highest\nprecision determines the result precision.\n \nExamples\n-------- \nSELECT 3+5;\n \n+-----+\n| 3+5 |\n+-----+\n| 8 |\n+-----+\n \n\n\nURL: https://mariadb.com/kb/en/library/addition-operator/','','https://mariadb.com/kb/en/library/addition-operator/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (42,4,'Subtraction Operator (-)','Syntax\n------ \n-\n \nDescription\n----------- \nSubtraction. The operator is also used as the unary minus\nfor changing sign.\n \nIf both operands are integers, the result is calculated with\nBIGINT precision. If either integer is unsigned, the result\nis also an unsigned integer, unless the\nNO_UNSIGNED_SUBTRACTION SQL_MODE is enabled, in which case\nthe result is always signed.\n \nFor real or string operands, the operand with the highest\nprecision determines the result precision.\n \nExamples\n-------- \nSELECT 96-9;\n \n+------+\n| 96-9 |\n+------+\n| 87 |\n+------+\n \nSELECT 15-17;\n \n+-------+\n| 15-17 |\n+-------+\n| -2 |\n+-------+\n \nSELECT 3.66 + 1.333;\n \n+--------------+\n| 3.66 + 1.333 |\n+--------------+\n| 4.993 |\n+--------------+\n \nUnary minus:\n \n SELECT - (3+5);\n+---------+\n| - (3+5) |\n+---------+\n| -8 |\n+---------+\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/subtraction-operator-/','','https://mariadb.com/kb/en/library/subtraction-operator-/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (43,4,'Division Operator (/)','Syntax\n------ \n/\n \nDescription\n----------- \nDivision operator. Dividing by zero will return NULL. By\ndefault, returns four digits after the decimal. This is\ndetermined by the server system variable\ndiv_precision_increment which by default is four. It can be\nset from 0 to 30.\n \nDividing by zero returns NULL. If the\nERROR_ON_DIVISION_BY_ZERO SQL_MODE is used (the default\nsince MariaDB 10.2.4), a division by zero also produces a\nwarning.\n \nExamples\n-------- \nSELECT 4/5;\n \n+--------+\n| 4/5 |\n+--------+\n| 0.8000 |\n+--------+\n \nSELECT 300/(2-2);\n+-----------+\n| 300/(2-2) |\n+-----------+\n| NULL |\n+-----------+\n \nSELECT 300/7;\n \n+---------+\n| 300/7 |\n+---------+\n| 42.8571 |\n+---------+\n \nChanging div_precision_increment for the session from the\ndefault of four to six:\n \nSET div_precision_increment = 6;\n \nSELECT 300/7;\n \n+-----------+\n| 300/7 |\n+-----------+\n| 42.857143 |\n+-----------+\n \nSELECT 300/7;\n \n+-----------+\n| 300/7 |\n+-----------+\n| 42.857143 |\n+-----------+\n \n\n\nURL: https://mariadb.com/kb/en/library/division-operator/','','https://mariadb.com/kb/en/library/division-operator/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (44,4,'Multiplication Operator (*)','Syntax\n------ \n*\n \nDescription\n----------- \nMultiplication operator.\n \nExamples\n-------- \nSELECT 7*6;\n \n+-----+\n| 7*6 |\n+-----+\n| 42 |\n+-----+\n \nSELECT 1234567890*9876543210;\n \n+-----------------------+\n| 1234567890*9876543210 |\n+-----------------------+\n| -6253480962446024716 |\n+-----------------------+\n \nSELECT 18014398509481984*18014398509481984.0;\n \n+---------------------------------------+\n| 18014398509481984*18014398509481984.0 |\n+---------------------------------------+\n| 324518553658426726783156020576256.0 |\n+---------------------------------------+\n \nSELECT 18014398509481984*18014398509481984;\n \n+-------------------------------------+\n| 18014398509481984*18014398509481984 |\n+-------------------------------------+\n| 0 |\n+-------------------------------------+\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/multiplication-operator/','','https://mariadb.com/kb/en/library/multiplication-operator/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (45,4,'Modulo Operator (%)','Syntax\n------ \nN % M\n \nDescription\n----------- \nModulo operator. Returns the remainder of N divided by M.\nSee also MOD.\n \nExamples\n-------- \nSELECT 1042 % 50;\n \n+-----------+\n| 1042 % 50 |\n+-----------+\n| 42 |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/modulo-operator/','','https://mariadb.com/kb/en/library/modulo-operator/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (46,4,'DIV','Syntax\n------ \nDIV\n \nDescription\n----------- \nInteger division. Similar to FLOOR(), but is safe with\nBIGINT values.\nIncorrect results may occur for non-integer operands that\nexceed BIGINT range.\n \nIf the ERROR_ON_DIVISION_BY_ZERO SQL_MODE is used, a\ndivision by zero produces an error. Otherwise, it returns\nNULL.\n \nThe remainder of a division can be obtained using the MOD\noperator.\n \nExamples\n-------- \nSELECT 300 DIV 7;\n \n+-----------+\n| 300 DIV 7 |\n+-----------+\n| 42 |\n+-----------+\n \nSELECT 300 DIV 0;\n \n+-----------+\n| 300 DIV 0 |\n+-----------+\n| NULL |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/div/','','https://mariadb.com/kb/en/library/div/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (47,4,'ABS','Syntax\n------ \nABS(X)\n \nDescription\n----------- \nReturns the absolute (non-negative) value of X. If X is not\na number, it is converted to a numeric type.\n \nExamples\n-------- \nSELECT ABS(42);\n+---------+\n| ABS(42) |\n+---------+\n| 42 |\n+---------+\n \nSELECT ABS(-42);\n+----------+\n| ABS(-42) |\n+----------+\n| 42 |\n+----------+\n \nSELECT ABS(DATE \'1994-01-01\');\n+------------------------+\n| ABS(DATE \'1994-01-01\') |\n+------------------------+\n| 19940101 |\n+------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/abs/','','https://mariadb.com/kb/en/library/abs/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (48,4,'ACOS','Syntax\n------ \nACOS(X)\n \nDescription\n----------- \nReturns the arc cosine of X, that is, the value whose cosine\nis X.\nReturns NULL if X is not in the range -1 to 1.\n \nExamples\n-------- \nSELECT ACOS(1);\n+---------+\n| ACOS(1) |\n+---------+\n| 0 |\n+---------+\n \nSELECT ACOS(1.0001);\n+--------------+\n| ACOS(1.0001) |\n+--------------+\n| NULL |\n+--------------+\n \nSELECT ACOS(0);\n+-----------------+\n| ACOS(0) |\n+-----------------+\n| 1.5707963267949 |\n+-----------------+\n \nSELECT ACOS(0.234);\n+------------------+\n| ACOS(0.234) |\n+------------------+\n| 1.33460644244679 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/acos/','','https://mariadb.com/kb/en/library/acos/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (49,4,'ASIN','Syntax\n------ \nASIN(X)\n \nDescription\n----------- \nReturns the arc sine of X, that is, the value whose sine is\nX. Returns\nNULL if X is not in the range -1 to 1.\n \nExamples\n-------- \nSELECT ASIN(0.2);\n+--------------------+\n| ASIN(0.2) |\n+--------------------+\n| 0.2013579207903308 |\n+--------------------+\n \nSELECT ASIN(\'foo\');\n+-------------+\n| ASIN(\'foo\') |\n+-------------+\n| 0 |\n+-------------+\n \nSHOW WARNINGS;\n \n+---------+------+-----------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------+\n| Warning | 1292 | Truncated incorrect DOUBLE value: \'foo\'\n|\n+---------+------+-----------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/asin/','','https://mariadb.com/kb/en/library/asin/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (50,4,'ATAN','Syntax\n------ \nATAN(X)\n \nDescription\n----------- \nReturns the arc tangent of X, that is, the value whose\ntangent is X.\n \nExamples\n-------- \nSELECT ATAN(2);\n+--------------------+\n| ATAN(2) |\n+--------------------+\n| 1.1071487177940904 |\n+--------------------+\n \nSELECT ATAN(-2);\n+---------------------+\n| ATAN(-2) |\n+---------------------+\n| -1.1071487177940904 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/atan/','','https://mariadb.com/kb/en/library/atan/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (51,4,'ATAN2','Syntax\n------ \nATAN(Y,X), ATAN2(Y,X)\n \nDescription\n----------- \nReturns the arc tangent of the two variables X and Y. It is\nsimilar to\ncalculating the arc tangent of Y / X, except that the signs\nof both\narguments are used to determine the quadrant of the result.\n \nExamples\n-------- \nSELECT ATAN(-2,2);\n+---------------------+\n| ATAN(-2,2) |\n+---------------------+\n| -0.7853981633974483 |\n+---------------------+\n \nSELECT ATAN2(PI(),0);\n+--------------------+\n| ATAN2(PI(),0) |\n+--------------------+\n| 1.5707963267948966 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/atan2/','','https://mariadb.com/kb/en/library/atan2/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (52,4,'CEIL','Syntax\n------ \nCEIL(X)\n \nDescription\n----------- \nCEIL() is a synonym for CEILING().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/ceil/','','https://mariadb.com/kb/en/library/ceil/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (53,4,'CEILING','Syntax\n------ \nCEILING(X)\n \nDescription\n----------- \nReturns the smallest integer value not less than X.\n \nExamples\n-------- \nSELECT CEILING(1.23);\n+---------------+\n| CEILING(1.23) |\n+---------------+\n| 2 |\n+---------------+\n \nSELECT CEILING(-1.23);\n+----------------+\n| CEILING(-1.23) |\n+----------------+\n| -1 |\n+----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/ceiling/','','https://mariadb.com/kb/en/library/ceiling/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (54,4,'CONV','Syntax\n------ \nCONV(N,from_base,to_base)\n \nDescription\n----------- \nConverts numbers between different number bases. Returns a\nstring\nrepresentation of the number N, converted from base\nfrom_base\nto base to_base.\n \nReturns NULL if any argument is NULL, or if the second or\nthird argument are not in the allowed range.\n \nThe argument N is interpreted as an integer, but may be\nspecified as an\ninteger or a string. The minimum base is 2 and the maximum\nbase is 36. If\nto_base is a negative number, N is regarded as a signed\nnumber.\nOtherwise, N is treated as unsigned. CONV() works with\n64-bit\nprecision.\n \nSome shortcuts for this function are also available: BIN(),\nOCT(), HEX(), UNHEX(). Also, MariaDB allows binary literal\nvalues and hexadecimal literal values.\n \nExamples\n-------- \nSELECT CONV(\'a\',16,2);\n+----------------+\n| CONV(\'a\',16,2) |\n+----------------+\n| 1010 |\n+----------------+\n \nSELECT CONV(\'6E\',18,8);\n+-----------------+\n| CONV(\'6E\',18,8) |\n+-----------------+\n| 172 |\n+-----------------+\n \nSELECT CONV(-17,10,-18);\n+------------------+\n| CONV(-17,10,-18) |\n+------------------+\n| -H |\n+------------------+\n \nSELECT CONV(12+\'10\'+\'10\'+0xa,10,10);\n+------------------------------+\n| CONV(12+\'10\'+\'10\'+0xa,10,10) |\n+------------------------------+\n| 42 |\n+------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/conv/','','https://mariadb.com/kb/en/library/conv/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (55,4,'COS','Syntax\n------ \nCOS(X)\n \nDescription\n----------- \nReturns the cosine of X, where X is given in radians.\n \nExamples\n-------- \nSELECT COS(PI());\n+-----------+\n| COS(PI()) |\n+-----------+\n| -1 |\n+-----------\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/cos/','','https://mariadb.com/kb/en/library/cos/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (56,4,'COT','Syntax\n------ \nCOT(X)\n \nDescription\n----------- \nReturns the cotangent of X.\n \nExamples\n-------- \nSELECT COT(42);\n+--------------------+\n| COT(42) |\n+--------------------+\n| 0.4364167060752729 |\n+--------------------+\n \nSELECT COT(12);\n+---------------------+\n| COT(12) |\n+---------------------+\n| -1.5726734063976893 |\n+---------------------+\n \nSELECT COT(0);\nERROR 1690 (22003): DOUBLE value is out of range in\n\'cot(0)\'\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/cot/','','https://mariadb.com/kb/en/library/cot/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (57,4,'CRC32','Syntax\n------ \nCRC32(expr)\n \nDescription\n----------- \nComputes a cyclic redundancy check value and returns a\n32-bit unsigned\nvalue. The result is NULL if the argument is NULL. The\nargument is\nexpected to be a string and (if possible) is treated as one\nif it is\nnot.\n \nExamples\n-------- \nSELECT CRC32(\'MariaDB\');\n+------------------+\n| CRC32(\'MariaDB\') |\n+------------------+\n| 4227209140 |\n+------------------+\n \nSELECT CRC32(\'mariadb\');\n+------------------+\n| CRC32(\'mariadb\') |\n+------------------+\n| 2594253378 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/crc32/','','https://mariadb.com/kb/en/library/crc32/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (58,4,'DEGREES','Syntax\n------ \nDEGREES(X)\n \nDescription\n----------- \nReturns the argument X, converted from radians to degrees.\n \nThis is the converse of the RADIANS() function.\n \nExamples\n-------- \nSELECT DEGREES(PI());\n+---------------+\n| DEGREES(PI()) |\n+---------------+\n| 180 |\n+---------------+\n \nSELECT DEGREES(PI() / 2);\n+-------------------+\n| DEGREES(PI() / 2) |\n+-------------------+\n| 90 |\n+-------------------+\n \nSELECT DEGREES(45);\n+-----------------+\n| DEGREES(45) |\n+-----------------+\n| 2578.3100780887 |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/degrees/','','https://mariadb.com/kb/en/library/degrees/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (59,4,'EXP','Syntax\n------ \nEXP(X)\n \nDescription\n----------- \nReturns the value of e (the base of natural logarithms)\nraised to the\npower of X. The inverse of this function is LOG() (using a\nsingle\nargument only) or LN().\n \nIf X is NULL, this function returns NULL.\n \nExamples\n-------- \nSELECT EXP(2);\n+------------------+\n| EXP(2) |\n+------------------+\n| 7.38905609893065 |\n+------------------+\n \nSELECT EXP(-2);\n+--------------------+\n| EXP(-2) |\n+--------------------+\n| 0.1353352832366127 |\n+--------------------+\n \nSELECT EXP(0);\n+--------+\n| EXP(0) |\n+--------+\n| 1 |\n+--------+\n \nSELECT EXP(NULL);\n+-----------+\n| EXP(NULL) |\n+-----------+\n| NULL |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/exp/','','https://mariadb.com/kb/en/library/exp/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (60,4,'FLOOR','Syntax\n------ \nFLOOR(X)\n \nDescription\n----------- \nReturns the largest integer value not greater than X.\n \nExamples\n-------- \nSELECT FLOOR(1.23);\n+-------------+\n| FLOOR(1.23) |\n+-------------+\n| 1 |\n+-------------+\n \nSELECT FLOOR(-1.23);\n+--------------+\n| FLOOR(-1.23) |\n+--------------+\n| -2 |\n+--------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/floor/','','https://mariadb.com/kb/en/library/floor/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (61,4,'LN','Syntax\n------ \nLN(X)\n \nDescription\n----------- \nReturns the natural logarithm of X; that is, the base-e\nlogarithm of X.\nIf X is less than or equal to 0, or NULL, then NULL is\nreturned.\n \nThe inverse of this function is EXP().\n \nExamples\n-------- \nSELECT LN(2);\n+-------------------+\n| LN(2) |\n+-------------------+\n| 0.693147180559945 |\n+-------------------+\n \nSELECT LN(-2);\n+--------+\n| LN(-2) |\n+--------+\n| NULL |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/ln/','','https://mariadb.com/kb/en/library/ln/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (62,4,'LOG','Syntax\n------ \nLOG(X), LOG(B,X)\n \nDescription\n----------- \nIf called with one parameter, this function returns the\nnatural\nlogarithm of X. If X is less than or equal to 0, then NULL\nis\nreturned.\n \nIf called with two parameters, it returns the logarithm of X\nto the base B. If B is \n\nURL: https://mariadb.com/kb/en/library/log/','','https://mariadb.com/kb/en/library/log/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (63,4,'LOG10','Syntax\n------ \nLOG10(X)\n \nDescription\n----------- \nReturns the base-10 logarithm of X.\n \nExamples\n-------- \nSELECT LOG10(2);\n+-------------------+\n| LOG10(2) |\n+-------------------+\n| 0.301029995663981 |\n+-------------------+\n \nSELECT LOG10(100);\n+------------+\n| LOG10(100) |\n+------------+\n| 2 |\n+------------+\n \nSELECT LOG10(-100);\n+-------------+\n| LOG10(-100) |\n+-------------+\n| NULL |\n+-------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/log10/','','https://mariadb.com/kb/en/library/log10/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (64,4,'LOG2','Syntax\n------ \nLOG2(X)\n \nDescription\n----------- \nReturns the base-2 logarithm of X.\n \nExamples\n-------- \nSELECT LOG2(4398046511104);\n+---------------------+\n| LOG2(4398046511104) |\n+---------------------+\n| 42 |\n+---------------------+\n \nSELECT LOG2(65536);\n+-------------+\n| LOG2(65536) |\n+-------------+\n| 16 |\n+-------------+\n \nSELECT LOG2(-100);\n+------------+\n| LOG2(-100) |\n+------------+\n| NULL |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/log2/','','https://mariadb.com/kb/en/library/log2/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (65,4,'MOD','Syntax\n------ \nMOD(N,M), N % M, N MOD M\n \nDescription\n----------- \nModulo operation. Returns the remainder of N divided by M.\nSee also Modulo Operator.\n \nIf the ERROR_ON_DIVISION_BY_ZERO SQL_MODE is used, any\nnumber modulus zero produces an error. Otherwise, it returns\nNULL.\n \nThe integer part of a division can be obtained using DIV.\n \nExamples\n-------- \nSELECT 1042 % 50;\n \n+-----------+\n| 1042 % 50 |\n+-----------+\n| 42 |\n+-----------+\n \nSELECT MOD(234, 10);\n+--------------+\n| MOD(234, 10) |\n+--------------+\n| 4 |\n+--------------+\n \nSELECT 253 % 7;\n \n+---------+\n| 253 % 7 |\n+---------+\n| 1 |\n+---------+\n \nSELECT MOD(29,9);\n+-----------+\n| MOD(29,9) |\n+-----------+\n| 2 |\n+-----------+\n \nSELECT 29 MOD 9;\n \n+----------+\n| 29 MOD 9 |\n+----------+\n| 2 |\n+----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mod/','','https://mariadb.com/kb/en/library/mod/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (66,4,'OCT','Syntax\n------ \nOCT(N)\n \nDescription\n----------- \nReturns a string representation of the octal value of N,\nwhere N is a longlong (BIGINT) number. This is equivalent to\nCONV(N,10,8). Returns NULL if N is NULL.\n \nExamples\n-------- \nSELECT OCT(34);\n+---------+\n| OCT(34) |\n+---------+\n| 42 |\n+---------+\n \nSELECT OCT(12);\n+---------+\n| OCT(12) |\n+---------+\n| 14 |\n+---------+\n \n\n\nURL: https://mariadb.com/kb/en/library/oct/','','https://mariadb.com/kb/en/library/oct/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (67,4,'PI','Syntax\n------ \nPI()\n \nDescription\n----------- \nReturns the value of π (pi). The default number of decimal\nplaces\ndisplayed is six, but MariaDB uses the full double-precision\nvalue\ninternally.\n \nExamples\n-------- \nSELECT PI();\n+----------+\n| PI() |\n+----------+\n| 3.141593 |\n+----------+\n \nSELECT PI()+0.0000000000000000000000;\n \n+-------------------------------+\n| PI()+0.0000000000000000000000 |\n+-------------------------------+\n| 3.1415926535897931159980 |\n+-------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/pi/','','https://mariadb.com/kb/en/library/pi/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (68,4,'POW','Syntax\n------ \nPOW(X,Y)\n \nDescription\n----------- \nReturns the value of X raised to the power of Y.\n \nPOWER() is a synonym.\n \nExamples\n-------- \nSELECT POW(2,3);\n+----------+\n| POW(2,3) |\n+----------+\n| 8 |\n+----------+\n \nSELECT POW(2,-2);\n+-----------+\n| POW(2,-2) |\n+-----------+\n| 0.25 |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/pow/','','https://mariadb.com/kb/en/library/pow/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (69,4,'POWER','Syntax\n------ \nPOWER(X,Y)\n \nDescription\n----------- \nThis is a synonym for POW(), which returns the value of X\nraised to the power of Y.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/power/','','https://mariadb.com/kb/en/library/power/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (70,4,'RADIANS','Syntax\n------ \nRADIANS(X)\n \nDescription\n----------- \nReturns the argument X, converted from degrees to radians.\nNote that\nπ radians equals 180 degrees. \n \nThis is the converse of the DEGREES() function.\n \nExamples\n-------- \nSELECT RADIANS(45);\n+-------------------+\n| RADIANS(45) |\n+-------------------+\n| 0.785398163397448 |\n+-------------------+\n \nSELECT RADIANS(90);\n+-----------------+\n| RADIANS(90) |\n+-----------------+\n| 1.5707963267949 |\n+-----------------+\n \nSELECT RADIANS(PI());\n+--------------------+\n| RADIANS(PI()) |\n+--------------------+\n| 0.0548311355616075 |\n+--------------------+\n \nSELECT RADIANS(180);\n+------------------+\n| RADIANS(180) |\n+------------------+\n| 3.14159265358979 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/radians/','','https://mariadb.com/kb/en/library/radians/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (71,4,'RAND','Syntax\n------ \nRAND(), RAND(N)\n \nDescription\n----------- \nReturns a random DOUBLE precision floating point value v in\nthe range 0 \n\nURL: https://mariadb.com/kb/en/library/rand/','','https://mariadb.com/kb/en/library/rand/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (72,4,'ROUND','Syntax\n------ \nROUND(X), ROUND(X,D)\n \nDescription\n----------- \nRounds the argument X to D decimal places. The rounding\nalgorithm\ndepends on the data type of X. D defaults to 0 if not\nspecified.\nD can be negative to cause D digits left of the decimal\npoint of the\nvalue X to become zero.\n \nExamples\n-------- \nSELECT ROUND(-1.23);\n+--------------+\n| ROUND(-1.23) |\n+--------------+\n| -1 |\n+--------------+\n \nSELECT ROUND(-1.58);\n+--------------+\n| ROUND(-1.58) |\n+--------------+\n| -2 |\n+--------------+\n \nSELECT ROUND(1.58); \n+-------------+\n| ROUND(1.58) |\n+-------------+\n| 2 |\n+-------------+\n \nSELECT ROUND(1.298, 1);\n+-----------------+\n| ROUND(1.298, 1) |\n+-----------------+\n| 1.3 |\n+-----------------+\n \nSELECT ROUND(1.298, 0);\n+-----------------+\n| ROUND(1.298, 0) |\n+-----------------+\n| 1 |\n+-----------------+\n \nSELECT ROUND(23.298, -1);\n+-------------------+\n| ROUND(23.298, -1) |\n+-------------------+\n| 20 |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/round/','','https://mariadb.com/kb/en/library/round/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (73,4,'SIGN','Syntax\n------ \nSIGN(X)\n \nDescription\n----------- \nReturns the sign of the argument as -1, 0, or 1, depending\non whether\nX is negative, zero, or positive.\n \nExamples\n-------- \nSELECT SIGN(-32);\n+-----------+\n| SIGN(-32) |\n+-----------+\n| -1 |\n+-----------+\n \nSELECT SIGN(0);\n+---------+\n| SIGN(0) |\n+---------+\n| 0 |\n+---------+\n \nSELECT SIGN(234);\n+-----------+\n| SIGN(234) |\n+-----------+\n| 1 |\n+-----------+\n \n\n\nURL: https://mariadb.com/kb/en/library/sign/','','https://mariadb.com/kb/en/library/sign/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (74,4,'SIN','Syntax\n------ \nSIN(X)\n \nDescription\n----------- \nReturns the sine of X, where X is given in radians.\n \nExamples\n-------- \nSELECT SIN(1.5707963267948966);\n+-------------------------+\n| SIN(1.5707963267948966) |\n+-------------------------+\n| 1 |\n+-------------------------+\n \nSELECT SIN(PI());\n+----------------------+\n| SIN(PI()) |\n+----------------------+\n| 1.22460635382238e-16 |\n+----------------------+\n \nSELECT ROUND(SIN(PI()));\n+------------------+\n| ROUND(SIN(PI())) |\n+------------------+\n| 0 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/sin/','','https://mariadb.com/kb/en/library/sin/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (75,4,'SQRT','Syntax\n------ \nSQRT(X)\n \nDescription\n----------- \nReturns the square root of X. If X is negative, NULL is\nreturned.\n \nExamples\n-------- \nSELECT SQRT(4);\n+---------+\n| SQRT(4) |\n+---------+\n| 2 |\n+---------+\n \nSELECT SQRT(20);\n+------------------+\n| SQRT(20) |\n+------------------+\n| 4.47213595499958 |\n+------------------+\n \nSELECT SQRT(-16);\n+-----------+\n| SQRT(-16) |\n+-----------+\n| NULL |\n+-----------+\n \nSELECT SQRT(1764);\n+------------+\n| SQRT(1764) |\n+------------+\n| 42 |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/sqrt/','','https://mariadb.com/kb/en/library/sqrt/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (76,4,'TAN','Syntax\n------ \nTAN(X)\n \nDescription\n----------- \nReturns the tangent of X, where X is given in radians.\n \nExamples\n-------- \nSELECT TAN(0.7853981633974483);\n+-------------------------+\n| TAN(0.7853981633974483) |\n+-------------------------+\n| 0.9999999999999999 |\n+-------------------------+\n \nSELECT TAN(PI());\n+-----------------------+\n| TAN(PI()) |\n+-----------------------+\n| -1.22460635382238e-16 |\n+-----------------------+\n \nSELECT TAN(PI()+1);\n+-----------------+\n| TAN(PI()+1) |\n+-----------------+\n| 1.5574077246549 |\n+-----------------+\n \nSELECT TAN(RADIANS(PI()));\n+--------------------+\n| TAN(RADIANS(PI())) |\n+--------------------+\n| 0.0548861508080033 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/tan/','','https://mariadb.com/kb/en/library/tan/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (77,4,'TRUNCATE','This page documents the TRUNCATE function. See TRUNCATE\nTABLE for the DDL statement.\n \nSyntax\n------ \nTRUNCATE(X,D)\n \nDescription\n----------- \nReturns the number X, truncated to D decimal places. If D is\n0, the\nresult has no decimal point or fractional part. D can be\nnegative to\ncause D digits left of the decimal point of the value X to\nbecome\nzero.\n \nExamples\n-------- \nSELECT TRUNCATE(1.223,1);\n+-------------------+\n| TRUNCATE(1.223,1) |\n+-------------------+\n| 1.2 |\n+-------------------+\n \nSELECT TRUNCATE(1.999,1);\n+-------------------+\n| TRUNCATE(1.999,1) |\n+-------------------+\n| 1.9 |\n+-------------------+\n \nSELECT TRUNCATE(1.999,0); \n+-------------------+\n| TRUNCATE(1.999,0) |\n+-------------------+\n| 1 |\n+-------------------+\n \nSELECT TRUNCATE(-1.999,1);\n+--------------------+\n| TRUNCATE(-1.999,1) |\n+--------------------+\n| -1.9 |\n+--------------------+\n \nSELECT TRUNCATE(122,-2);\n+------------------+\n| TRUNCATE(122,-2) |\n+------------------+\n| 100 |\n+------------------+\n \nSELECT TRUNCATE(10.28*100,0);\n+-----------------------+\n| TRUNCATE(10.28*100,0) |\n+-----------------------+\n| 1028 |\n+-----------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/truncate/','','https://mariadb.com/kb/en/library/truncate/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (78,5,'Plugin Overview','Plugins are server components that enhance MariaDB in some\nway. These can be anything from new storage engines, plugins\nfor enhancing full-text parsing, or even small enhancements,\nsuch as a plugin to get a timestamp as an integer.\n \nQuerying Plugin Information\n \nThere are a number of ways to see which plugins are\ncurrently active.\n \nA server almost always has a large number of active plugins,\nbecause the server contains a large number of built-in\nplugins, which are active by default and cannot be\nuninstalled.\n \nQuerying Plugin Information with SHOW PLUGINS\n \nThe SHOW PLUGINS statement can be used to query information\nabout all active plugins.\n \nFor example:\n \nSHOW PLUGINS;\n \n+----------------------------+----------+--------------------+---------+---------+\n| Name | Status | Type | Library | License |\n+----------------------------+----------+--------------------+---------+---------+\n...\n| mysql_native_password | ACTIVE | AUTHENTICATION | NULL |\nGPL |\n| mysql_old_password | ACTIVE | AUTHENTICATION | NULL | GPL\n|\n| MRG_MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |\n...\n+----------------------------+----------+--------------------+---------+---------+\n \nIf a plugin\'s Library column has the NULL value, then the\nplugin is built-in, and it cannot be uninstalled.\n \nQuerying Plugin Information with information_schema.PLUGINS\n \nThe information_schema.PLUGINS table can be queried to get\nmore detailed information about plugins.\n \nFor example:\n \nSELECT * FROM information_schema.PLUGINS\\G\n...\n*************************** 6. row\n***************************\n PLUGIN_NAME: CSV\n PLUGIN_VERSION: 1.0\n PLUGIN_STATUS: ACTIVE\n PLUGIN_TYPE: STORAGE ENGINE\n PLUGIN_TYPE_VERSION: 100003.0\n PLUGIN_LIBRARY: NULL\nPLUGIN_LIBRARY_VERSION: NULL\n PLUGIN_AUTHOR: Brian Aker, MySQL AB\n PLUGIN_DESCRIPTION: CSV storage engine\n PLUGIN_LICENSE: GPL\n LOAD_OPTION: FORCE\n PLUGIN_MATURITY: Stable\n PLUGIN_AUTH_VERSION: 1.0\n*************************** 7. row\n***************************\n PLUGIN_NAME: MEMORY\n PLUGIN_VERSION: 1.0\n PLUGIN_STATUS: ACTIVE\n PLUGIN_TYPE: STORAGE ENGINE\n PLUGIN_TYPE_VERSION: 100003.0\n PLUGIN_LIBRARY: NULL\nPLUGIN_LIBRARY_VERSION: NULL\n PLUGIN_AUTHOR: MySQL AB\n PLUGIN_DESCRIPTION: Hash based, stored in memory, useful\nfor temporary tables\n PLUGIN_LICENSE: GPL\n LOAD_OPTION: FORCE\n PLUGIN_MATURITY: Stable\n PLUGIN_AUTH_VERSION: 1.0\n...\n \nIf a plugin\'s PLUGIN_LIBRARY column has the NULL value,\nthen the plugin is built-in, and it cannot be uninstalled.\n \nQuerying Plugin Information with mysql.plugin\n \nThe mysql.plugin table can be queried to get information\nabout installed plugins.\n \nThis table only contains information about plugins that have\nbeen installed via the following methods:\nThe INSTALL SONAME statement.\nThe INSTALL PLUGIN statement.\nThe mysql_plugin utility.\n \nThis table does not contain information about:\nBuilt-in plugins.\nPlugins loaded with the --plugin-load-add option.\nPlugins loaded with the --plugin-load option.\n \nThis table only contains enough information to reload the\nplugin when the server is restarted, which means it only\ncontains the plugin name and the plugin library.\n \nFor example:\n \nSELECT * FROM mysql.plugin;\n \n+------+------------+\n| name | dl |\n+------+------------+\n| PBXT | libpbxt.so |\n+------+------------+\n \nInstalling a Plugin\n \nThere are three primary ways to install a plugin:\nA plugin can be installed dynamically with an SQL statement.\nA plugin can be installed with a mysqld option, but it\nrequires a server restart.\nA plugin can be installed with the mysql_plugin utility,\nwhile the server is completely offline.\n \nWhen you are installing a plugin, you also have to ensure\nthat:\nThe server\'s plugin directory is properly configured, and\nthe plugin\'s library is in the plugin directory.\nThe server\'s minimum plugin maturity is properly\nconfigured, and the plugin is mature enough to be installed.\n \nInstalling a Plugin Dynamically\n \nA plugin can be installed dynamically by executing either\nthe INSTALL SONAME or the INSTALL PLUGIN statement.\n \nIf a plugin is installed with one of these statements, then\na record will be added to the mysql.plugins table for the\nplugin. This means that the plugin will automatically be\nloaded every time the server restarts, unless specifically\nuninstalled or deactivated.\n \nInstalling a Plugin with INSTALL SONAME\n \nYou can install a plugin dynamically by executing the\nINSTALL SONAME statement. INSTALL SONAME installs all\nplugins from the given plugin library. This could be\nrequired for some plugin libraries.\n \nFor example, to install all plugins in the server_audit\nplugin library (which is currently only the server_audit\naudit plugin), you could execute the following:\n \nINSTALL SONAME \'server_audit\';\n \nInstalling a Plugin with INSTALL PLUGIN\n \nYou can install a plugin dynamically by executing the\nINSTALL PLUGIN statement. INSTALL PLUGIN installs a single\nplugin from the given plugin library.\n \nFor example, to install the server_audit audit plugin from\nthe server_audit plugin library, you could execute the\nfollowing:\n \nINSTALL PLUGIN server_audit SONAME \'server_audit\';\n \nInstalling a Plugin with Plugin Load Options\n \nA plugin can be installed with a mysqld option by providing\neither the --plugin-load-add or the --plugin-load option.\n \nIf a plugin is installed with one of these options, then a\nrecord will not be added to the mysql.plugins table for the\nplugin. This means that if the server is restarted without\nthe same option set, then the plugin will not automatically\nbe loaded.\n \nInstalling a Plugin with --plugin-load-add\n \nYou can install a plugin with the --plugin-load-add option\nby specifying the option as a command-line argument to\nmysqld or by specifying the option in a relevant server\noption group in an option file.\n \nThe --plugin-load-add option uses the following format:\nPlugins can be specified in the format name=library, where\nname is the plugin name and library is the plugin library.\nThis format installs a single plugin from the given plugin\nlibrary.\nPlugins can also be specified in the format library, where\nlibrary is the plugin library. This format installs all\nplugins from the given plugin library.\nMultiple plugins can be specified by separating them with\nsemicolons.\n \nFor example, to install all plugins in the server_audit\nplugin library (which is currently only the server_audit\naudit plugin) and also the ed25519 authentication plugin\nfrom the auth_ed25519 plugin library, you could set the\noption to the following values on the command-line:\n \n$ mysqld --user=mysql --plugin-load-add=\'server_audit\'\n--plugin-load-add=\'ed25519=auth_ed25519\'\n \nYou could also set the option to the same values in an\noption file:\n \n[mariadb]\n...\nplugin_load_add = server_audit\nplugin_load_add = ed25519=auth_ed25519\n \nSpecial care must be taken when specifying both the\n--plugin-load option and the --plugin-load-add option\ntogether. The --plugin-load option resets the plugin load\nlist, and this can cause unexpected problems if you are not\naware. The --plugin-load-add option does not reset the\nplugin load list, so it is much safer to use. See Specifying\nMultiple Plugin Load Options for more information.\n \nInstalling a Plugin with --plugin-load\n \nYou can install a plugin with the --plugin-load option by\nspecifying the option as a command-line argument to mysqld\nor by specifying the option in a relevant server option\ngroup in an option file.\n \nThe --plugin-load option uses the following format:\nPlugins can be specified in the format name=library, where\nname is the plugin name and library is the plugin library.\nThis format installs a single plugin from the given plugin\nlibrary.\nPlugins can also be specified in the format library, where\nlibrary is the plugin library. This format installs all\nplugins from the given plugin library.\nMultiple plugins can be specified by separating them with\nsemicolons.\n \nFor example, to install all plugins in the server_audit\nplugin library (which is currently only the server_audit\naudit plugin) and also the ed25519 authentication plugin\nfrom the auth_ed25519 plugin library, you could set the\noption to the following values on the command-line:\n \n$ mysqld --user=mysql\n--plugin-load=\'server_audit;ed25519=auth_ed25519\'\n \nYou could also set the option to the same values in an\noption file:\n \n[mariadb]\n...\nplugin_load = server_audit;ed25519=auth_ed25519\n \nSpecial care must be taken when specifying the --plugin-load\noption multiple times, or when specifying both the\n--plugin-load option and the --plugin-load-add option\ntogether. The --plugin-load option resets the plugin load\nlist, and this can cause unexpected problems if you are not\naware. The --plugin-load-add option does not reset the\nplugin load list, so it is much safer to use. See Specifying\nMultiple Plugin Load Options for more information.\n \nSpecifying Multiple Plugin Load Options\n \nSpecial care must be taken when specifying the --plugin-load\noption multiple times, or when specifying both the\n--plugin-load option and the --plugin-load-add option. The\n--plugin-load option resets the plugin load list, and this\ncan cause unexpected problems if you are not aware. The\n--plugin-load-add option does not reset the plugin load\nlist, so it is much safer to use.\n \nThis can have the following consequences:\nIf the --plugin-load option is specified multiple times,\nthen only the last instance will have any effect. For\nexample, in the following case, the first instance of the\noption is reset:\n \n[mariadb]\n...\nplugin_load = server_audit\nplugin_load = ed25519=auth_ed25519\nIf the --plugin-load option is specified after the\n--plugin-load-add option, then it will also reset the\nchanges made by that option. For example, in the following\ncase, the --plugin-load-add option does not do anything,\nbecause the subsequent --plugin-load option resets the\nplugin load list:\n \n[mariadb]\n...\nplugin_load_add = server_audit\nplugin_load = ed25519=auth_ed25519\nIn contrast, if the --plugin-load option is specified before\nthe --plugin-load-add option, then it will work fine,\nbecause the --plugin-load-add option does not reset the\nplugin load list. For example, in the following case, both\nplugins are properly loaded:\n \n[mariadb]\n...\nplugin_load = server_audit\nplugin_load_add = ed25519=auth_ed25519\n \nInstalling a Plugin with mysql_plugin\n \nA plugin can be installed with the mysql_plugin utility if\nthe server is completely offline. \n \nThe syntax is:\n \nmysql_plugin [options] \n ENABLE|DISABLE\n \nFor example, to install the server_audit audit plugin, you\ncould execute the following:\n \nmysql_plugin server_audit ENABLE\n \nIf a plugin is installed with this utility, then a record\nwill be added to the mysql.plugins table for the plugin.\nThis means that the plugin will automatically be loaded\nevery time the server restarts, unless specifically\nuninstalled or deactivated.\n \nConfiguring the Plugin Directory\n \nWhen a plugin is being installed, the server looks for the\nplugin\'s library in the server\'s plugin directory. This\ndirectory is configured by the plugin_dir system variable.\nThis can be specified as a command-line argument to mysqld\nor it can be specified in a relevant server option group in\nan option file. For example:\n \n[mariadb]\n...\nplugin_dir = /usr/lib64/mysql/plugin\n \nConfiguring the Minimum Plugin Maturity\n \nWhen a plugin is being installed, the server compares the\nplugin\'s maturity level against the server\'s minimum\nallowed plugin maturity. This can help prevent users from\nusing unstable plugins on production servers. This minimum\nplugin maturity is configured by the plugin_maturity system\nvariable. This can be specified as a command-line argument\nto mysqld or it can be specified in a relevant server option\ngroup in an option file. For example:\n \n[mariadb]\n...\nplugin_maturity = stable\n \nConfiguring Plugin Activation at Server Startup\n \nA plugin will be loaded by default when the server starts\nif:\nThe plugin was installed with the INSTALL SONAME statement.\nThe plugin was installed with the INSTALL PLUGIN statement.\nThe plugin was installed with the mysql_plugin utility.\nThe server is configured to load the plugin with the\n--plugin-load-add option.\nThe server is configured to load the plugin with the\n--plugin-load option.\n \nThis behavior can be changed with special options that take\nthe form --plugin-name. For example, for the server_audit\naudit plugin, the special option is called --server-audit.\n \nThe possible values for these special options are:\n \nOption Value | Description | \n \nOFF | Disables the plugin without removing it from the\nmysql.plugins table. | \n \nON | Enables the plugin. If the plugin cannot be\ninitialized, then the server will still continue starting\nup, but the plugin will be disabled. | \n \nFORCE | Enables the plugin. If the plugin cannot be\ninitialized, then the server will fail to start with an\nerror. | \n \nFORCE_PLUS_PERMANENT | Enables the plugin. If the plugin\ncannot be initialized, then the server will fail to start\nwith an error. In addition, the plugin cannot be uninstalled\nwith UNINSTALL SONAME or UNINSTALL PLUGIN while the server\nis running. | \n \nA plugin\'s status can be found by looking at the\nPLUGIN_STATUS column of the information_schema.PLUGINS\ntable.\n \nUninstalling Plugins\n \nPlugins that are found in the mysql.plugin table, that is\nthose that were installed with INSTALL SONAME, INSTALL\nPLUGIN or mysql_plugin can be uninstalled in one of two\nways:\nThe UNINSTALL SONAME or the UNINSTALL PLUGIN statement while\nthe server is running\nWith mysql_plugin while the server is offline.\n \nPlugins that were enabled as a --plugin-load option do not\nneed to be uninstalled. If --plugin-load is omitted the next\ntime the server starts, or the plugin is not listed as one\nof the --plugin-load entries, the plugin will not be loaded.\n \nUNINSTALL PLUGIN uninstalls a single installed plugin, while\nUNINSTALL SONAME uninstalls all plugins belonging to a given\nlibrary.\n \n\n\nURL: https://mariadb.com/kb/en/library/plugin-overview/','','https://mariadb.com/kb/en/library/plugin-overview/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (79,5,'INSTALL PLUGIN','Syntax\n------ \nINSTALL PLUGIN [IF NOT EXISTS] plugin_name SONAME\n\'plugin_library\'\n \nDescription\n----------- \nThis statement installs an individual plugin from the\nspecified library. To install the whole library (which could\nbe required), use INSTALL SONAME.\n \nplugin_name is the name of the plugin as defined in the\nplugin declaration structure contained in the library file.\nPlugin names are\nnot case sensitive. For maximal compatibility, plugin names\nshould be limited\nto ASCII letters, digits, and underscore, because they are\nused in C source\nfiles, shell command lines, M4 and Bourne shell scripts, and\nSQL environments.\n \nplugin_library is the name of the shared library that\ncontains the plugin code. Before MariaDB 5.5.21, the name\nshould include the file name extension (for\nexample, libmyplugin.so or libmyplugin.dll). Starting from\nMariaDB 5.5.21, the file name extension can be omitted\n(which makes the statement look the same on all\narchitectures).\n \nThe shared library must be located in the plugin directory\n(that is,\nthe directory named by the plugin_dir system variable). The\nlibrary must be in the plugin directory itself, not in a\nsubdirectory. By\ndefault, plugin_dir is plugin directory under the directory\nnamed by\nthe pkglibdir configuration variable, but it can be changed\nby setting\nthe value of plugin_dir at server startup. For example, set\nits value in a my.cnf file:\n \n[mysqld]\nplugin_dir=/path/to/plugin/directory\nIf the value of plugin_dir is a relative path name, it is\ntaken to be relative to the MySQL base directory (the value\nof the basedir\nsystem variable).\n \nINSTALL PLUGIN adds a line to the mysql.plugin table that\ndescribes the plugin. This table contains the plugin name\nand library file\nname.\n \nINSTALL PLUGIN causes the server to read\noption (my.cnf) files just as during server startup. This\nenables the plugin to\npick up any relevant options from those files. It is\npossible to add plugin\noptions to an option file even before loading a plugin (if\nthe loose prefix is\nused). It is also possible to uninstall a plugin, edit\nmy.cnf, and install the\nplugin again. Restarting the plugin this way enables it to\nthe new option\nvalues without a server restart.\n \nBefore MySQL 5.1.33, a plugin was started with each option\nset to its\ndefault value.\n \nINSTALL PLUGIN also loads and initializes the plugin code to\nmake the plugin available for use. A plugin is initialized\nby executing its\ninitialization function, which handles any setup that the\nplugin must perform\nbefore it can be used.\n \nTo use INSTALL PLUGIN, you must have the\nINSERT privilege for the mysql.plugin table.\n \nAt server startup, the server loads and initializes any\nplugin that is\nlisted in the mysql.plugin table. This means that a plugin\nis installed\nwith INSTALL PLUGIN only once, not every time the server\nstarts. Plugin loading at startup does not occur if the\nserver is started with\nthe --skip-grant-tables option.\n \nWhen the server shuts down, it executes the deinitialization\nfunction\nfor each plugin that is loaded so that the plugin has a\nchance to\nperform any final cleanup.\n \nIf you need to load plugins for a single server startup when\nthe\n--skip-grant-tables option is given (which tells the server\nnot to read system tables), use the \n--plugin-load mysqld option.\n \nIF NOT EXISTS\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nnote instead of an error if the specified plugin already\nexists. See SHOW WARNINGS.\n \nExamples\n-------- \nINSTALL PLUGIN sphinx SONAME \'ha_sphinx.so\';\n \nStarting from MariaDB 5.5.21, the extension can be omitted:\n \nINSTALL PLUGIN innodb SONAME \'ha_xtradb\';\n \nFrom MariaDB 10.4.0:\n \nINSTALL PLUGIN IF NOT EXISTS example SONAME \'ha_example\';\n \nQuery OK, 0 rows affected (0.104 sec)\n \nINSTALL PLUGIN IF NOT EXISTS example SONAME \'ha_example\';\n \nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------+\n| Note | 1968 | Plugin \'example\' already installed |\n+-------+------+------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/install-plugin/','','https://mariadb.com/kb/en/library/install-plugin/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (80,5,'UNINSTALL PLUGIN','Syntax\n------ \nUNINSTALL PLUGIN [IF EXISTS] plugin_name\n \nDescription\n----------- \nThis statement removes a single installed plugin. To\nuninstall the whole library which contains the plugin, use\nUNINSTALL SONAME. You cannot uninstall a plugin if any table\nthat uses it is open.\n \nplugin_name must be the name of some plugin that is listed\nin the mysql.plugin table. The server executes the plugin\'s\ndeinitialization\nfunction and removes the row for the plugin from the\nmysql.plugin\ntable, so that subsequent server restarts will not load and\ninitialize\nthe plugin. UNINSTALL PLUGIN does not remove the plugin\'s\nshared library file.\n \nTo use UNINSTALL PLUGIN, you must have the\nDELETE privilege for the mysql.plugin table.\n \nIF EXISTS\n \nIf the IF EXISTS clause is used, MariaDB will return a note\ninstead of an error if the plugin does not exist. See SHOW\nWARNINGS.\n \nExamples\n-------- \nUNINSTALL PLUGIN example;\n \nFrom MariaDB 10.4.0:\n \nUNINSTALL PLUGIN IF EXISTS example;\n \nQuery OK, 0 rows affected (0.099 sec)\n \nUNINSTALL PLUGIN IF EXISTS example;\n \nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n \nSHOW WARNINGS;\n \n+-------+------+-------------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------------+\n| Note | 1305 | PLUGIN example does not exist |\n+-------+------+-------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/uninstall-plugin/','','https://mariadb.com/kb/en/library/uninstall-plugin/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (81,5,'INSTALL SONAME','INSTALL SONAME has been supported since MariaDB 5.5.21.\n \nSyntax\n------ \nINSTALL SONAME \'plugin_library\'\n \nDescription\n----------- \nThis statement is a variant of INSTALL PLUGIN. It installs\nall plugins from a given plugin_library. See INSTALL PLUGIN\nfor details.\n \nplugin_library is the name of the shared library that\ncontains the plugin code. The file name extension (for\nexample, libmyplugin.so or libmyplugin.dll) can be omitted\n(which makes the statement look the same on all\narchitectures).\n \nThe shared library must be located in the plugin directory\n(that is,\nthe directory named by the plugin_dir system variable). The\nlibrary must be in the plugin directory itself, not in a\nsubdirectory. By\ndefault, plugin_dir is plugin directory under the directory\nnamed by\nthe pkglibdir configuration variable, but it can be changed\nby setting\nthe value of plugin_dir at server startup. For example, set\nits value in a my.cnf file:\n \n[mysqld]\nplugin_dir=/path/to/plugin/directory\nIf the value of plugin_dir is a relative path name, it is\ntaken to be relative to the MySQL base directory (the value\nof the basedir\nsystem variable).\n \nINSTALL SONAME adds one or more lines to the mysql.plugin\ntable that\ndescribes the plugin. This table contains the plugin name\nand library file\nname.\n \nINSTALL SONAME causes the server to read\noption (my.cnf) files just as during server startup. This\nenables the plugin to\npick up any relevant options from those files. It is\npossible to add plugin\noptions to an option file even before loading a plugin (if\nthe loose prefix is\nused). It is also possible to uninstall a plugin, edit\nmy.cnf, and install the\nplugin again. Restarting the plugin this way enables it to\nthe new option\nvalues without a server restart.\n \nINSTALL SONAME also loads and initializes the plugin code to\nmake the plugin available for use. A plugin is initialized\nby executing its\ninitialization function, which handles any setup that the\nplugin must perform\nbefore it can be used.\n \nTo use INSTALL SONAME, you must have the\nINSERT privilege for the mysql.plugin table.\n \nAt server startup, the server loads and initializes any\nplugin that is\nlisted in the mysql.plugin table. This means that a plugin\nis installed\nwith INSTALL SONAME only once, not every time the server\nstarts. Plugin loading at startup does not occur if the\nserver is started with\nthe --skip-grant-tables option.\n \nWhen the server shuts down, it executes the deinitialization\nfunction\nfor each plugin that is loaded so that the plugin has a\nchance to\nperform any final cleanup.\n \nIf you need to load plugins for a single server startup when\nthe\n--skip-grant-tables option is given (which tells the server\nnot to read system tables), use the \n--plugin-load mysqld option.\n \nIf you need to install only one plugin from a library, use\nthe INSTALL PLUGIN statement.\n \nExamples\n-------- \nTo load the XtraDB storage engine and all of its\ninformation_schema tables with one statement, use\n \nINSTALL SONAME \'ha_xtradb\';\n \nThis statement can be used instead of INSTALL PLUGIN even\nwhen the library contains only one plugin:\n \nINSTALL SONAME \'ha_sequence\';\n \n\n\nURL: https://mariadb.com/kb/en/library/install-soname/','','https://mariadb.com/kb/en/library/install-soname/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (82,5,'UNINSTALL SONAME','UNINSTALL SONAMEhas been supported since MariaDB 5.5.21.\n \nSyntax\n------ \nUNINSTALL SONAME [IF EXISTS] \'plugin_library\'\n \nDescription\n----------- \nThis statement is a variant of UNINSTALL PLUGIN statement,\nthat removes all plugins belonging to a specified\nplugin_library. See UNINSTALL PLUGIN for details.\n \nplugin_library is the name of the shared library that\ncontains the plugin code. The file name extension (for\nexample, libmyplugin.so or libmyplugin.dll) can be omitted\n(which makes the statement look the same on all\narchitectures).\n \nTo use UNINSTALL SONAME, you must have the\nDELETE privilege for the mysql.plugin table.\n \nIF EXISTS\n \nIf the IF EXISTS clause is used, MariaDB will return a note\ninstead of an error if the plugin library does not exist.\nSee SHOW WARNINGS.\n \nExamples\n-------- \nTo uninstall the XtraDB plugin and all of its\ninformation_schema tables with one statement, use\n \nUNINSTALL SONAME \'ha_xtradb\';\n \nFrom MariaDB 10.4.0:\n \nUNINSTALL SONAME IF EXISTS \'ha_example\';\n \nQuery OK, 0 rows affected (0.099 sec)\n \nUNINSTALL SONAME IF EXISTS \'ha_example\';\n \nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n \nSHOW WARNINGS;\n \n+-------+------+-------------------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------------------+\n| Note | 1305 | SONAME ha_example.so does not exist |\n+-------+------+-------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/uninstall-soname/','','https://mariadb.com/kb/en/library/uninstall-soname/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (83,6,'MBR Definition','Description\n----------- \nThe MBR (Minimum Bounding Rectangle), or Envelope is the\nbounding\ngeometry, formed by the minimum and maximum (X,Y)\ncoordinates:\n \nExamples\n-------- \n((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mbr-definition/','','https://mariadb.com/kb/en/library/mbr-definition/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (84,6,'MBRContains','Syntax\n------ \nMBRContains(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangle of\ng1 contains the Minimum Bounding Rectangle of g2. This tests\nthe\nopposite relationship as MBRWithin().\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\n \nSET @g2 = GeomFromText(\'Point(1 1)\');\n \nSELECT MBRContains(@g1,@g2), MBRContains(@g2,@g1);\n+----------------------+----------------------+\n| MBRContains(@g1,@g2) | MBRContains(@g2,@g1) |\n+----------------------+----------------------+\n| 1 | 0 |\n+----------------------+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mbrcontains/','','https://mariadb.com/kb/en/library/mbrcontains/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (85,6,'MBRDisjoint','Syntax\n------ \nMBRDisjoint(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of the two geometries g1 and g2 are disjoint. Two\ngeometries are disjoint if they do not intersect, that is\ntouch or overlap.\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((4 4,4 7,7 7,7 4,4 4))\');\nSELECTmbrdisjoint(@g1,@g2);\n+----------------------+\n| mbrdisjoint(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbrdisjoint(@g1,@g2);\n+----------------------+\n| mbrdisjoint(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mbrdisjoint/','','https://mariadb.com/kb/en/library/mbrdisjoint/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (86,6,'MBREqual','Syntax\n------ \nMBREqual(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of\nthe two geometries g1 and g2 are the same.\n \nExamples\n-------- \nSET @g1=GEOMFROMTEXT(\'LINESTRING(0 0, 1 2)\');\nSET @g2=GEOMFROMTEXT(\'POLYGON((0 0, 0 2, 1 2, 1 0, 0\n0))\');\nSELECT MbrEqual(@g1,@g2);\n+-------------------+\n| MbrEqual(@g1,@g2) |\n+-------------------+\n| 1 |\n+-------------------+\n \nSET @g1=GEOMFROMTEXT(\'LINESTRING(0 0, 1 3)\');\nSET @g2=GEOMFROMTEXT(\'POLYGON((0 0, 0 2, 1 4, 1 0, 0\n0))\');\nSELECT MbrEqual(@g1,@g2);\n+-------------------+\n| MbrEqual(@g1,@g2) |\n+-------------------+\n| 0 |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mbrequal/','','https://mariadb.com/kb/en/library/mbrequal/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (87,6,'MBRIntersects','Syntax\n------ \nMBRIntersects(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of the two geometries g1 and g2 intersect.\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbrintersects(@g1,@g2);\n+------------------------+\n| mbrintersects(@g1,@g2) |\n+------------------------+\n| 1 |\n+------------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((4 4,4 7,7 7,7 4,4 4))\');\nSELECT mbrintersects(@g1,@g2);\n+------------------------+\n| mbrintersects(@g1,@g2) |\n+------------------------+\n| 0 |\n+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mbrintersects/','','https://mariadb.com/kb/en/library/mbrintersects/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (88,6,'MBROverlaps','Syntax\n------ \nMBROverlaps(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of\nthe two geometries g1 and g2 overlap. The term spatially\noverlaps is\nused if two geometries intersect and their intersection\nresults in a\ngeometry of the same dimension but not equal to either of\nthe given\ngeometries.\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((4 4,4 7,7 7,7 4,4 4))\');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 4,4 4,4 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mbroverlaps/','','https://mariadb.com/kb/en/library/mbroverlaps/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (89,6,'MBRTouches','Syntax\n------ \nMBRTouches(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangles of\nthe two geometries g1 and g2 touch. Two geometries spatially\ntouch if\nthe interiors of the geometries do not intersect, but the\nboundary of\none of the geometries intersects either the boundary or the\ninterior\nof the other.\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((4 4,4 7,7 7,7 4,4 4))\');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 1 |\n+---------------------+\n \nSET @g1 = GeomFromText(\'Polygon((0 0,0 4,4 4,4 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mbrtouches/','','https://mariadb.com/kb/en/library/mbrtouches/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (90,6,'MBRWithin','Syntax\n------ \nMBRWithin(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether the Minimum Bounding\nRectangle of\ng1 is within the Minimum Bounding Rectangle of g2. This\ntests the\nopposite relationship as MBRContains().\n \nExamples\n-------- \nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((0 0,0 5,5 5,5 0,0 0))\');\nSELECT MBRWithin(@g1,@g2), MBRWithin(@g2,@g1);\n+--------------------+--------------------+\n| MBRWithin(@g1,@g2) | MBRWithin(@g2,@g1) |\n+--------------------+--------------------+\n| 1 | 0 |\n+--------------------+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mbrwithin/','','https://mariadb.com/kb/en/library/mbrwithin/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (91,7,'CASE OPERATOR','Syntax\n------ \nCASE value WHEN [compare_value] THEN result [WHEN\n[compare_value] THEN\nresult ...] [ELSE result] END\n \nCASE WHEN [condition] THEN result [WHEN [condition] THEN\nresult ...]\n[ELSE result] END\n \nDescription\n----------- \nThe first version returns the result where\nvalue=compare_value. The\nsecond version returns the result for the first condition\nthat is\ntrue. If there was no matching result value, the result\nafter ELSE is\nreturned, or NULL if there is no ELSE part.\n \nThere is also a CASE statement, which differs from the CASE\noperator described here.\n \nExamples\n-------- \nSELECT CASE 1 WHEN 1 THEN \'one\' WHEN 2 THEN \'two\' ELSE\n\'more\' END;\n \n+------------------------------------------------------------+\n| CASE 1 WHEN 1 THEN \'one\' WHEN 2 THEN \'two\' ELSE\n\'more\' END |\n+------------------------------------------------------------+\n| one |\n+------------------------------------------------------------+\n \nSELECT CASE WHEN 1>0 THEN \'true\' ELSE \'false\' END;\n \n+--------------------------------------------+\n| CASE WHEN 1>0 THEN \'true\' ELSE \'false\' END |\n+--------------------------------------------+\n| true |\n+--------------------------------------------+\n \nSELECT CASE BINARY \'B\' WHEN \'a\' THEN 1 WHEN \'b\' THEN 2\nEND;\n \n+-----------------------------------------------------+\n| CASE BINARY \'B\' WHEN \'a\' THEN 1 WHEN \'b\' THEN 2 END\n|\n+-----------------------------------------------------+\n| NULL |\n+-----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/case-operator/','','https://mariadb.com/kb/en/library/case-operator/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (92,7,'IF Function','Syntax\n------ \nIF(expr1,expr2,expr3)\n \nDescription\n----------- \nIf expr1 is TRUE (expr1 0 and expr1 NULL) then IF()\nreturns expr2; otherwise it returns expr3. IF() returns a\nnumeric\nor string value, depending on the context in which it is\nused.\n \nNote: There is also an IF statement which differs from the\nIF() function described here.\n \nExamples\n-------- \nSELECT IF(1>2,2,3);\n+-------------+\n| IF(1>2,2,3) |\n+-------------+\n| 3 |\n+-------------+\n \nSELECT IF(1\n\nURL: https://mariadb.com/kb/en/library/if-function/','','https://mariadb.com/kb/en/library/if-function/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (93,7,'IFNULL','Syntax\n------ \nIFNULL(expr1,expr2)\n \nDescription\n----------- \nIf expr1 is not NULL, IFNULL() returns expr1; otherwise it\nreturns\nexpr2. IFNULL() returns a numeric or string value, depending\non the\ncontext in which it is used.\n \nExamples\n-------- \nSELECT IFNULL(1,0); \n+-------------+\n| IFNULL(1,0) |\n+-------------+\n| 1 |\n+-------------+\n \nSELECT IFNULL(NULL,10);\n+-----------------+\n| IFNULL(NULL,10) |\n+-----------------+\n| 10 |\n+-----------------+\n \nSELECT IFNULL(1/0,10);\n+----------------+\n| IFNULL(1/0,10) |\n+----------------+\n| 10.0000 |\n+----------------+\n \nSELECT IFNULL(1/0,\'yes\');\n+-------------------+\n| IFNULL(1/0,\'yes\') |\n+-------------------+\n| yes |\n+-------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/ifnull/','','https://mariadb.com/kb/en/library/ifnull/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (94,7,'NULLIF','Syntax\n------ \nNULLIF(expr1,expr2)\n \nDescription\n----------- \nReturns NULL if expr1 = expr2 is true, otherwise returns\nexpr1. This is\nthe same as CASE WHEN expr1 = expr2 THEN NULL ELSE expr1\nEND.\n \nExamples\n-------- \nSELECT NULLIF(1,1);\n+-------------+\n| NULLIF(1,1) |\n+-------------+\n| NULL |\n+-------------+\n \nSELECT NULLIF(1,2);\n+-------------+\n| NULLIF(1,2) |\n+-------------+\n| 1 |\n+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/nullif/','','https://mariadb.com/kb/en/library/nullif/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (95,8,'CHANGE MASTER TO','Syntax\n------ \nCHANGE MASTER [\'connection_name\'] TO master_def [,\nmaster_def] ...\n \nmaster_def:\n MASTER_BIND = \'interface_name\'\n | MASTER_HOST = \'host_name\'[\n | MASTER_USER = \'user_name\'\n | MASTER_PASSWORD = \'password\'\n | MASTER_PORT = port_num\n | MASTER_CONNECT_RETRY = interval\n | MASTER_HEARTBEAT_PERIOD = interval\n | MASTER_LOG_FILE = \'master_log_name\'\n | MASTER_LOG_POS = master_log_pos\n | RELAY_LOG_FILE = \'relay_log_name\'\n | RELAY_LOG_POS = relay_log_pos\n | MASTER_DELAY = interval\n | MASTER_SSL = {0|1}\n | MASTER_SSL_CA = \'ca_file_name\'\n | MASTER_SSL_CAPATH = \'ca_directory_name\'\n | MASTER_SSL_CERT = \'cert_file_name\'\n | MASTER_SSL_CRL = \'crl_file_name\'\n | MASTER_SSL_CRLPATH = \'crl_directory_name\'\n | MASTER_SSL_KEY = \'key_file_name\'\n | MASTER_SSL_CIPHER = \'cipher_list\'\n | MASTER_SSL_VERIFY_SERVER_CERT = {0|1}\n | MASTER_USE_GTID = {current_pos|slave_pos|no}\n | IGNORE_SERVER_IDS = (server_id_list)\n | DO_DOMAIN_IDS = ([N,..])\n | IGNORE_DOMAIN_IDS = ([N,..])\n \nDescription\n----------- \nThe CHANGE MASTER statement sets the options that a\nreplication slave uses to connect to and replicate from a\nreplication master. \n \nMariaDB until 10.0.7\n \nIn MariaDB 10.0.7 and before, the relay_log_purge system\nvariable was silently set to 0 when CHANGE MASTER was\nexecuted.\n \nMulti-Source Replication\n \nMulti-source replication was added in MariaDB 10.0.1.\n \nIf you are using multi-source replication, then you need to\nspecify a connection name when you execute CHANGE MASTER.\nThere are two ways to do this:\nSetting the default_master_connection system variable prior\nto executing CHANGE MASTER.\nSetting the connection_name parameter when executing CHANGE\nMASTER.\n \ndefault_master_connection\n \nSET default_master_connection = \'gandalf\';\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\n \nSTART SLAVE;\n \nconnection_name\n \nSTOP SLAVE \'gandalf\';\n \nCHANGE MASTER \'gandalf\' TO \n MASTER_PASSWORD=\'new3cret\';\n \nSTART SLAVE \'gandalf\';\n \nOptions\n \nConnection Options\n \nMASTER_USER\n \nThe MASTER_USER option for CHANGE MASTER defines the user\naccount that the replication slave will use to connect to\nthe replication master.\n \nThis user account will need the REPLICATION SLAVE privilege\non the master.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_USER=\'repl\',\n MASTER_PASSWORD=\'new3cret\';\n \nSTART SLAVE;\n \nMASTER_PASSWORD\n \nThe MASTER_USER option for CHANGE MASTER defines the\npassword that the replication slave will use to connect to\nthe replication master as the user account defined by the\nMASTER_USER option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\n \nSTART SLAVE;\n \nMASTER_HOST\n \nThe MASTER_HOST option for CHANGE MASTER defines the\nhostname or IP address of the replication master.\n \nIf you set the value of the MASTER_HOST option to the empty\nstring, then that is not the same as not setting the\noption\'s value at all. In MariaDB 5.5 and later, if you set\nthe value of the MASTER_HOST option to the empty string,\nthen the CHANGE MASTER command will fail with an error. In\nMariaDB 5.3 and before, if you set the value of the\nMASTER_HOST option to the empty string, then the CHANGE\nMASTER command would succeed, but the subsequent START SLAVE\ncommand would fail.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_HOST=\'dbserver1.example.com\',\n MASTER_USER=\'repl\',\n MASTER_PASSWORD=\'new3cret\',\n MASTER_USE_GTID=slave_pos;\n \nSTART SLAVE;\n \nIf you set the value of the MASTER_HOST option in a CHANGE\nMASTER command, then the slave assumes that the master is\ndifferent from before, even if you set the value of this\noption to the same value it had previously. In this\nscenario, the slave will consider the old values for the\nmaster\'s binary\nlog file name and position to be invalid for the new master.\nAs a side effect, if you do not explicitly set the values of\nthe MASTER_LOG_FILE and MASTER_LOG_POS options in the\nstatement, then the statement will be implicitly appended\nwith MASTER_LOG_FILE=\'\' and MASTER_LOG_POS=4. However, if\nyou enable GTID mode for replication by setting the\nMASTER_USE_GTID option to some value other than no in the\nstatement, then these values will effectively be ignored\nanyway.\n \nReplication slaves cannot connect to replication masters\nusing Unix socket files or Windows named pipes. The\nreplication slave must connect to the replication master\nusing TCP/IP.\n \nMASTER_PORT\n \nThe MASTER_PORT option for CHANGE MASTER defines the TCP/IP\nport of the replication master.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_HOST=\'dbserver1.example.com\',\n MASTER_PORT=3307,\n MASTER_USER=\'repl\',\n MASTER_PASSWORD=\'new3cret\',\n MASTER_USE_GTID=slave_pos;\n \nSTART SLAVE;\n \nIf you set the value of the MASTER_PORT option in a CHANGE\nMASTER command, then the slave assumes that the master is\ndifferent from before, even if you set the value of this\noption to the same value it had previously. In this\nscenario, the slave will consider the old values for the\nmaster\'s binary\nlog file name and position to be invalid for the new master.\nAs a side effect, if you do not explicitly set the values of\nthe MASTER_LOG_FILE and MASTER_LOG_POS options in the\nstatement, then the statement will be implicitly appended\nwith MASTER_LOG_FILE=\'\' and MASTER_LOG_POS=4. However, if\nyou enable GTID mode for replication by setting the\nMASTER_USE_GTID option to some value other than no in the\nstatement, then these values will effectively be ignored\nanyway.\n \nReplication slaves cannot connect to replication masters\nusing Unix socket files or Windows named pipes. The\nreplication slave must connect to the replication master\nusing TCP/IP.\n \nMASTER_CONNECT_RETRY\n \nThe MASTER_CONNECT_RETRY option for CHANGE MASTER defines\nhow many seconds that the slave will wait between connection\nretries. The default is 60.\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n MASTER_CONNECT_RETRY=20;\n \nSTART SLAVE;\n \nThe number of connection attempts is limited by the\nmaster_retry_count option. It can be set either on the\ncommand-line or in a server option group in an option file\nprior to starting up the server. For example:\n \n[mariadb]\n...\nmaster_retry_count=4294967295\n \nMASTER_BIND\n \nThe MASTER_BIND option for CHANGE MASTER is only supported\nby MySQL 5.6.2 and later and by MySQL NDB Cluster 7.3.1 and\nlater. This option is not yet supported by MariaDB. See\nMDEV-19248 for more information.\n \nThe MASTER_BIND option for CHANGE MASTER can be used on\nreplication slaves that have multiple network interfaces to\nchoose which network interface the slave will use to connect\nto the master.\n \nMASTER_HEARTBEAT_PERIOD\n \nThe MASTER_HEARTBEAT_PERIOD option for CHANGE MASTER can be\nused to set the interval in seconds between replication\nheartbeats. Whenever the master\'s binary log is updated\nwith an event, the waiting period for the next heartbeat is\nreset.\n \nThis option\'s interval argument has the following\ncharacteristics:\nIt is a decimal value with a range of 0 to 4294967 seconds.\nIt has a resolution of hundredths of a second.\nIts smallest valid non-zero value is 0.001.\nIts default value is the value of the slave_net_timeout\nsystem variable divided by 2.\nIf it\'s set to 0, then heartbeats are disabled.\n \nHeartbeats are sent by the master only if there are no\nunsent events in the binary log file for a period longer\nthan the interval.\n \nIf the RESET SLAVE statement is executed, then the heartbeat\ninterval is reset to the default.\n \nIf the slave_net_timeout system variable is set to a value\nthat is lower than the current heartbeat interval, then a\nwarning will be issued.\n \nTLS Options\n \nThe TLS options are used for providing information about\nTLS. The options can be set even on slaves that are compiled\nwithout TLS support. The TLS options are saved to either the\ndefault master.info file or the file that is configured by\nthe master_info_file option, but these TLS options are\nignored unless the slave supports TLS.\n \nSee Replication with Secure Connections for more\ninformation.\n \nMASTER_SSL\n \nThe MASTER_SSL option for CHANGE MASTER tells the slave\nwhether to force TLS for the connection. The valid values\nare 0 or 1.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL=1;\n \nSTART SLAVE;\n \nMASTER_SSL_CA\n \nThe MASTER_SSL_CA option for CHANGE MASTER defines a path to\na PEM file that should contain one or more X509 certificates\nfor trusted Certificate Authorities (CAs) to use for TLS.\nThis option requires that you use the absolute path, not a\nrelative path. This option implies the MASTER_SSL option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\n \nSTART SLAVE;\n \nSee Secure Connections Overview: Certificate Authorities\n(CAs) for more information.\n \nMASTER_SSL_CAPATH\n \nThe MASTER_SSL_CAPATH option for CHANGE MASTER defines a\npath to a directory that contains one or more PEM files that\nshould each contain one X509 certificate for a trusted\nCertificate Authority (CA) to use for TLS. This option\nrequires that you use the absolute path, not a relative\npath. The directory specified by this option needs to be run\nthrough the openssl rehash command. This option implies the\nMASTER_SSL option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CAPATH=\'/etc/my.cnf.d/certificates/ca/\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\n \nSTART SLAVE;\n \nSee Secure Connections Overview: Certificate Authorities\n(CAs) for more information.\n \nMASTER_SSL_CERT\n \nThe MASTER_SSL_CERT option for CHANGE MASTER defines a path\nto the X509 certificate file to use for TLS. This option\nrequires that you use the absolute path, not a relative\npath. This option implies the MASTER_SSL option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\n \nSTART SLAVE;\n \nMASTER_SSL_CRL\n \nThe MASTER_SSL_CRL option for CHANGE MASTER defines a path\nto a PEM file that should contain one or more revoked X509\ncertificates to use for TLS. This option requires that you\nuse the absolute path, not a relative path.\n \nThis option is only supported if the server was built with\nOpenSSL. If the server was built with yaSSL, then this\noption is not supported. See TLS and Cryptography Libraries\nUsed by MariaDB for more information about which libraries\nare used on which platforms.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1,\n MASTER_SSL_CRL=\'/etc/my.cnf.d/certificates/crl.pem\';\n \nSTART SLAVE;\n \nSee Secure Connections Overview: Certificate Revocation\nLists (CRLs) for more information.\n \nMASTER_SSL_CRLPATH\n \nThe MASTER_SSL_CRLPATH option for CHANGE MASTER defines a\npath to a directory that contains one or more PEM files that\nshould each contain one revoked X509 certificate to use for\nTLS. This option requires that you use the absolute path,\nnot a relative path. The directory specified by this\nvariable needs to be run through the openssl rehash command.\n \nThis option is only supported if the server was built with\nOpenSSL. If the server was built with yaSSL, then this\noption is not supported. See TLS and Cryptography Libraries\nUsed by MariaDB for more information about which libraries\nare used on which platforms.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1,\n MASTER_SSL_CRLPATH=\'/etc/my.cnf.d/certificates/crl/\';\n \nSTART SLAVE;\n \nSee Secure Connections Overview: Certificate Revocation\nLists (CRLs) for more information.\n \nMASTER_SSL_KEY\n \nThe MASTER_SSL_KEY option for CHANGE MASTER defines a path\nto a private key file to use for TLS. This option requires\nthat you use the absolute path, not a relative path. This\noption implies the MASTER_SSL option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\n \nSTART SLAVE;\n \nMASTER_SSL_CIPHER\n \nThe MASTER_SSL_CIPHER option for CHANGE MASTER defines the\nlist of permitted ciphers or cipher suites to use for TLS.\nBesides cipher names, if MariaDB was compiled with OpenSSL,\nthis option could be set to \"SSLv3\" or \"TLSv1.2\" to\nallow all SSLv3 or all TLSv1.2 ciphers. Note that the\nTLSv1.3 ciphers cannot be excluded when using OpenSSL, even\nby using this option. See Using TLSv1.3 for details. This\noption implies the MASTER_SSL option.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1,\n MASTER_SSL_CIPHER=\'TLSv1.2\';\n \nSTART SLAVE;\n \nMASTER_SSL_VERIFY_SERVER_CERT\n \nThe MASTER_SSL_VERIFY_SERVER_CERT option for CHANGE MASTER\nenables server certificate verification. This option is\ndisabled by default.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\n \nSTART SLAVE;\n \nSee Secure Connections Overview: Server Certificate\nVerification for more information.\n \nBinary Log Options\n \nThese options are related to the binary log position on the\nmaster.\n \nMASTER_LOG_FILE\n \nThe MASTER_LOG_FILE option for CHANGE MASTER can be used\nalong with MASTER_LOG_POS to specify the coordinates at\nwhich the slave\'s I/O thread should begin reading from the\nmaster\'s binary logs the next time the thread starts.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\n \nSTART SLAVE;\n \nThe MASTER_LOG_FILE and MASTER_LOG_POS options cannot be\nspecified if the RELAY_LOG_FILE and RELAY_LOG_POS options\nwere also specified.\n \nThe MASTER_LOG_FILE and MASTER_LOG_POS options are\neffectively ignored if you enable GTID mode for replication\nby setting the MASTER_USE_GTID option to some value other\nthan no in the statement.\n \nMASTER_LOG_POS\n \nThe MASTER_LOG_POS option for CHANGE MASTER can be used\nalong with MASTER_LOG_FILE to specify the coordinates at\nwhich the slave\'s I/O thread should begin reading from the\nmaster\'s binary logs the next time the thread starts.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\n \nSTART SLAVE;\n \nThe MASTER_LOG_FILE and MASTER_LOG_POS options cannot be\nspecified if the RELAY_LOG_FILE and RELAY_LOG_POS options\nwere also specified.\n \nThe MASTER_LOG_FILE and MASTER_LOG_POS options are\neffectively ignored if you enable GTID mode for replication\nby setting the MASTER_USE_GTID option to some value other\nthan no in the statement.\n \nRelay Log Options\n \nThese options are related to the relay log position on the\nslave.\n \nRELAY_LOG_FILE\n \nThe RELAY_LOG_FILE option for CHANGE MASTER can be used\nalong with the RELAY_LOG_POS option to specify the\ncoordinates at which the slave\'s SQL thread should begin\nreading from the relay log the next time the thread starts.\n \nThe CHANGE MASTER statement usually deletes all relay log\nfiles. However, if the RELAY_LOG_FILE and/or RELAY_LOG_POS\noptions are specified, then existing relay log files are\nkept.\n \nWhen you want to change the relay log position, you only\nneed to stop the slave\'s SQL thread. The slave\'s I/O\nthread can continue running. The STOP SLAVE and START SLAVE\nstatements support the SQL_THREAD option for this scenario.\nFor example:\n \nSTOP SLAVE SQL_THREAD;\n \nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\n \nSTART SLAVE SQL_THREAD;\n \nWhen the value of this option is changed, the metadata about\nthe slave\'s SQL thread\'s position in the relay logs will\nalso be changed in the relay-log.info file or the file that\nis configured by the relay_log_info_file system variable.\n \nThe RELAY_LOG_FILE and RELAY_LOG_POS options cannot be\nspecified if the MASTER_LOG_FILE and MASTER_LOG_POS options\nwere also specified.\n \nRELAY_LOG_POS\n \nThe RELAY_LOG_POS option for CHANGE MASTER can be used along\nwith the RELAY_LOG_FILE option to specify the coordinates at\nwhich the slave\'s SQL thread should begin reading from the\nrelay log the next time the thread starts.\n \nThe CHANGE MASTER statement usually deletes all relay log\nfiles. However, if the RELAY_LOG_FILE and/or RELAY_LOG_POS\noptions are specified, then existing relay log files are\nkept.\n \nWhen you want to change the relay log position, you only\nneed to stop the slave\'s SQL thread. The slave\'s I/O\nthread can continue running. The STOP SLAVE and START SLAVE\nstatements support the SQL_THREAD option for this scenario.\nFor example:\n \nSTOP SLAVE SQL_THREAD;\n \nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\n \nSTART SLAVE SQL_THREAD;\n \nWhen the value of this option is changed, the metadata about\nthe slave\'s SQL thread\'s position in the relay logs will\nalso be changed in the relay-log.info file or the file that\nis configured by the relay_log_info_file system variable.\n \nThe RELAY_LOG_FILE and RELAY_LOG_POS options cannot be\nspecified if the MASTER_LOG_FILE and MASTER_LOG_POS options\nwere also specified.\n \nGTID Options\n \nMASTER_USE_GTID\n \nThe MASTER_USE_GTID option for CHANGE MASTER was first added\nin MariaDB 10.0.2 to enable replication with Global\nTransaction IDs (GTIDs).\n \nThe MASTER_USE_GTID option for CHANGE MASTER can be used to\nconfigure the slave to use the global transaction ID (GTID)\nwhen connecting to a master. The possible values are:\ncurrent_pos - Replicate in GTID mode and use\ngtid_current_pos as the position to start downloading\ntransactions from the master.\nslave_pos - Replicate in GTID mode and use gtid_slave_pos as\nthe position to start downloading transactions from the\nmaster.\nno - Don\'t replicate in GTID mode.\n \nFor example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO\n MASTER_USE_GTID = current_pos;\n \nSTART SLAVE;\n \nOr:\n \nSTOP SLAVE;\n \nSET GLOBAL gtid_slave_pos=\'0-1-153\';\n \nCHANGE MASTER TO\n MASTER_USE_GTID = slave','','https://mariadb.com/kb/en/library/change-master-to/'); -update help_topic set description = CONCAT(description, '_pos;\n \nSTART SLAVE;\n \nReplication Filter Options\n \nIGNORE_SERVER_IDS\n \nThe IGNORE_SERVER_IDS option for CHANGE MASTER can be used\nto configure a replication slave to ignore binary log events\nthat originated from certain servers. Filtered binary log\nevents will not get logged to the slave’s relay log, and\nthey will not be applied by the slave.\n \nThe option\'s value can be specified by providing a\ncomma-separated list of server_id values. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n IGNORE_SERVER_IDS = (3,5);\nSTART SLAVE;\n \nIf you would like to clear a previously set list, then you\ncan set the value to an empty list. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n IGNORE_SERVER_IDS = ();\nSTART SLAVE;\n \nDO_DOMAIN_IDS\n \nThe DO_DOMAIN_IDS option for CHANGE MASTER was first added\nin MariaDB 10.1.2.\n \nThe DO_DOMAIN_IDS option for CHANGE MASTER can be used to\nconfigure a replication slave to only apply binary log\nevents if the transaction\'s GTID is in a specific\ngtid_domain_id value. Filtered binary log events will not\nget logged to the slave’s relay log, and they will not be\napplied by the slave.\n \nThe option\'s value can be specified by providing a\ncomma-separated list of gtid_domain_id values. Duplicate\nvalues are automatically ignored. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n DO_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n \nIf you would like to clear a previously set list, then you\ncan set the value to an empty list. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n DO_DOMAIN_IDS = ();\nSTART SLAVE;\n \nThe DO_DOMAIN_IDS option and the IGNORE_DOMAIN_IDS option\ncannot both be set to non-empty values at the same time. If\nyou want to set the DO_DOMAIN_IDS option, and the\nIGNORE_DOMAIN_IDS option was previously set, then you need\nto clear the value of the IGNORE_DOMAIN_IDS option. For\nexample:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = (), \n DO_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n \nThe DO_DOMAIN_IDS option can only be specified if the slave\nis replicating in GTID mode. Therefore, the MASTER_USE_GTID\noption must also be set to some value other than no in order\nto use this option.\n \nIGNORE_DOMAIN_IDS\n \nThe IGNORE_DOMAIN_IDS option for CHANGE MASTER was first\nadded in MariaDB 10.1.2.\n \nThe IGNORE_DOMAIN_IDS option for CHANGE MASTER can be used\nto configure a replication slave to ignore binary log events\nif the transaction\'s GTID is in a specific gtid_domain_id\nvalue. Filtered binary log events will not get logged to the\nslave’s relay log, and they will not be applied by the\nslave.\n \nThe option\'s value can be specified by providing a\ncomma-separated list of gtid_domain_id values. Duplicate\nvalues are automatically ignored. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n \nIf you would like to clear a previously set list, then you\ncan set the value to an empty list. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = ();\nSTART SLAVE;\n \nThe DO_DOMAIN_IDS option and the IGNORE_DOMAIN_IDS option\ncannot both be set to non-empty values at the same time. If\nyou want to set the IGNORE_DOMAIN_IDS option, and the\nDO_DOMAIN_IDS option was previously set, then you need to\nclear the value of the DO_DOMAIN_IDS option. For example:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n DO_DOMAIN_IDS = (), \n IGNORE_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n \nThe IGNORE_DOMAIN_IDS option can only be specified if the\nslave is replicating in GTID mode. Therefore, the\nMASTER_USE_GTID option must also be set to some value other\nthan no in order to use this option.\n \nDelayed Replication Options\n \nMASTER_DELAY\n \nThe MASTER_DELAY option for CHANGE MASTER was first added in\nMariaDB 10.2.3 to enable delayed replication.\n \nThe MASTER_DELAY option for CHANGE MASTER can be used to\nenable delayed replication. This option specifies the time\nin seconds (at least) that a replication slave should lag\nbehind the master. Before executing an event, the slave will\nfirst wait, if necessary, until the given time has passed\nsince the event was created on the master. The result is\nthat the slave will reflect the state of the master some\ntime back in the past. The default is zero, no delay.\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n MASTER_DELAY=3600;\n \nSTART SLAVE;\n \nChanging Option Values\n \nIf you don\'t specify a given option when executing the\nCHANGE MASTER statement, then the option keeps its old value\nin most cases. Most of the time, there is no need to specify\nthe options that do not need to change. For example, if the\npassword for the user account that the slave uses to connect\nto its master has changed, but no other options need to\nchange, then you can just change the MASTER_PASSWORD option\nby executing the following commands:\n \nSTOP SLAVE;\n \nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\n \nSTART SLAVE;\n \nThere are some cases where options are implicitly reset,\nsuch as when the MASTER_HOST and MASTER_PORT options are\nchanged.\n \nOption Persistence\n \nThe values of the MASTER_LOG_FILE and MASTER_LOG_POS options\n(i.e. the binary log position on the master) and most other\noptions are written to either the default master.info file\nor the file that is configured by the master_info_file\noption. The slave\'s I/O thread keeps this binary log\nposition updated as it downloads events only when\nMASTER_USE_GTID option\n is set to NO. Otherwise the file is not updated on a per\nevent basis.\n \nThe master_info_file option can be set either on the\ncommand-line or in a server option group in an option file\nprior to starting up the server. For example:\n \n[mariadb]\n...\nmaster_info_file=/mariadb/myserver1-master.info\n \nThe values of the RELAY_LOG_FILE and RELAY_LOG_POS options\n(i.e. the relay log position) are written to either the\ndefault relay-log.info file or the file that is configured\nby the relay_log_info_file system variable. The slave\'s SQL\nthread keeps this relay log position updated as it applies\nevents.\n \nThe relay_log_info_file system variable can be set either on\nthe command-line or in a server option group in an option\nfile prior to starting up the server. For example:\n \n[mariadb]\n...\nrelay_log_info_file=/mariadb/myserver1-relay-log.info\n \nGTID Persistence\n \nIf the slave is replicating binary log events that contain\nGTIDs, then the slave\'s SQL thread will write every GTID\nthat it applies to the mysql.gtid_slave_pos table. This GTID\ncan be inspected and modified through the gtid_slave_pos\nsystem variable.\n \nIf the slave has the log_slave_updates system variable\nenabled and if the slave has the binary log enabled, then\nevery write by the slave\'s SQL thread will also go into the\nslave\'s binary log. This means that GTIDs of replicated\ntransactions would be reflected in the value of the\ngtid_binlog_pos system variable.\n \nCreating a Slave from a Backup\n \nThe CHANGE MASTER statement is useful for setting up a slave\nwhen you have a backup of the master and you also have the\nbinary log position or GTID position corresponding to the\nbackup.\n \nAfter restoring the backup on the slave, you could execute\nsomething like this to use the binary log position:\n \nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\n \nSTART SLAVE;\n \nOr you could execute something like this to use the GTID\nposition:\n \nSET GLOBAL gtid_slave_pos=\'0-1-153\';\n \nCHANGE MASTER TO\n MASTER_USE_GTID=slave_pos;\n \nSTART SLAVE;\n \nSee Setting up a Replication Slave with Mariabackup for more\ninformation on how to do this with Mariabackup.\n \nExample\n \nThe following example changes the master and master\'s\nbinary log coordinates.\nThis is used when you want to set up the slave to replicate\nthe master:\n \nCHANGE MASTER TO\n MASTER_HOST=\'master2.mycompany.com\',\n MASTER_USER=\'replication\',\n MASTER_PASSWORD=\'bigs3cret\',\n MASTER_PORT=3306,\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4,\n MASTER_CONNECT_RETRY=10;\n \nSTART SLAVE;\n \n\n\nURL: https://mariadb.com/kb/en/library/change-master-to/') WHERE help_topic_id = 95; -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (96,8,'COMMIT','The COMMIT statement ends a transaction, saving any changes\nto the data so that they become visible to subsequent\ntransactions. Also, unlocks metadata changed by current\ntransaction. If autocommit is set to 1, an implicit commit\nis performed after each statement. Otherwise, all\ntransactions which don\'t end with an explicit COMMIT are\nimplicitly rollbacked and the changes are lost. The ROLLBACK\nstatement can be used to do this explicitly.\n \nThe required syntax for the COMMIT statement is as follows:\n \nCOMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\n \nCOMMIT is the more important transaction terminator, as well\nas the more interesting one. The basic form of the COMMIT\nstatement is simply the keyword COMMIT (the keyword WORK is\nsimply noise and can be omitted without changing the\neffect).\n \nThe optional AND CHAIN clause is a convenience for\ninitiating a new transaction as soon as the old transaction\nterminates. If AND CHAIN is specified, then there is\neffectively nothing between the old and new transactions,\nalthough they remain separate. The characteristics of the\nnew transaction will be the same as the characteristics of\nthe old one — that is, the new transaction will have the\nsame access mode, isolation level and diagnostics area size\n(we\'ll discuss all of these shortly) as the transaction\njust terminated. \n \nRELEASE tells the server to disconnect the client\nimmediately after the current transaction.\n \nThere are NO RELEASE and AND NO CHAIN options. By default,\ncommits do not RELEASE or CHAIN, but it\'s possible to\nchange this default behavior with the completion_type server\nsystem variable. In this case, the AND NO CHAIN and NO\nRELEASE options override the server default.\n \n\n\nURL: https://mariadb.com/kb/en/library/commit/','','https://mariadb.com/kb/en/library/commit/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (97,8,'DEALLOCATE / DROP PREPARE','Syntax\n------ \n{DEALLOCATE | DROP} PREPARE stmt_name\n \nDescription\n----------- \nTo deallocate a prepared statement produced with PREPARE,\nuse a\nDEALLOCATE PREPARE statement that refers to the prepared\nstatement\nname.\n \nA prepared statement is implicitly deallocated when a new\nPREPARE command is issued. In that case, there is no need to\nuse DEALLOCATE.\n \nAttempting to execute a prepared statement after\ndeallocating it\nresults in an error, as if it was not prepared at all:\n \nERROR 1243 (HY000): Unknown prepared statement handler\n(stmt_name) given to EXECUTE\n \nIf the specified statement has not been PREPAREd, an error\nsimilar to the following will be produced:\n \nERROR 1243 (HY000): Unknown prepared statement handler\n(stmt_name) given to DEALLOCATE PREPARE\n \nExample\n \nSee example in PREPARE.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/deallocate-drop-prepared-statement/','','https://mariadb.com/kb/en/library/deallocate-drop-prepared-statement/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (98,8,'EXECUTE Statement','Syntax\n------ \nEXECUTE stmt_name\n [USING expression[, expression] ...]\n \nEXECUTE with expression as parameters was introduced in\nMariaDB 10.2.3. Before that one could only use variables\n(@var_name) as parameters.\n \nDescription\n----------- \nAfter preparing a statement with PREPARE, you execute it\nwith an\nEXECUTE statement that refers to the prepared statement\nname. If the\nprepared statement contains any parameter markers, you must\nsupply a\nUSING clause that lists user variables containing the values\nto be\nbound to the parameters. Parameter values can be supplied\nonly by user\nvariables, and the USING clause must name exactly as many\nvariables as\nthe number of parameter markers in the statement.\n \nYou can execute a given prepared statement multiple times,\npassing\ndifferent variables to it or setting the variables to\ndifferent values\nbefore each execution.\n \nIf the specified statement has not been PREPAREd, an error\nsimilar to the following is produced:\n \nERROR 1243 (HY000): Unknown prepared statement handler\n(stmt_name) given to EXECUTE\n \nExample\n \nSee example in PREPARE.\n \n\n\nURL: https://mariadb.com/kb/en/library/execute-statement/','','https://mariadb.com/kb/en/library/execute-statement/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (99,8,'EXECUTE IMMEDIATE','EXECUTE IMMEDIATE was introduced in MariaDB 10.2.3.\n \nSyntax\n------ \nEXECUTE IMMEDIATE statement\n \nDescription\n----------- \nEXECUTE IMMEDIATE executes a dynamic SQL statement created\non the fly, which can reduce performance overhead.\n \nFor example:\n \nEXECUTE IMMEDIATE \'SELECT 1\' \n \nwhich is shorthand for:\n \nprepare stmt from \"select 1\";\n \nexecute stmt;\n \ndeallocate prepare stmt;\n \nEXECUTE IMMEDIATE supports complex expressions as prepare\nsource and parameters:\n \nEXECUTE IMMEDIATE CONCAT(\'SELECT COUNT(*) FROM \', \'t1\',\n\' WHERE a=?\') USING 5+5;\n \nLimitations: subselects and stored function calls are not\nsupported as a prepare source.\n \nThe following examples return an error:\n \nCREATE OR REPLACE FUNCTION f1() RETURNS VARCHAR(64) RETURN\n\'SELECT * FROM t1\';\nEXECUTE IMMEDIATE f1();\nERROR 1970 (42000): EXECUTE IMMEDIATE does not support\nsubqueries or stored functions\n \nEXECUTE IMMEDIATE (SELECT \'SELECT * FROM t1\');\nERROR 1064 (42000): You have an error in your SQL syntax;\ncheck the manual that \n corresponds to your MariaDB server version for the right\nsyntax to use near \n \'SELECT \'SELECT * FROM t1\')\' at line 1\n \nCREATE OR REPLACE FUNCTION f1() RETURNS INT RETURN 10;\nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING f1();\nERROR 1970 (42000): EXECUTE..USING does not support\nsubqueries or stored functions\n \nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING\n(SELECT 10);\nERROR 1064 (42000): You have an error in your SQL syntax;\ncheck the manual that \n corresponds to your MariaDB server version for the right\nsyntax to use near \n \'SELECT 10)\' at line 1\n \nOne can use a user or an SP variable as a workaround:\n \nCREATE OR REPLACE FUNCTION f1() RETURNS VARCHAR(64) RETURN\n\'SELECT * FROM t1\';\nSET @stmt=f1();\nEXECUTE IMMEDIATE @stmt;\n \nSET @stmt=(SELECT \'SELECT 1\');\nEXECUTE IMMEDIATE @stmt;\n \nCREATE OR REPLACE FUNCTION f1() RETURNS INT RETURN 10;\nSET @param=f1();\nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING\n@param;\n \nSET @param=(SELECT 10);\nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING\n@param;\n \nEXECUTE IMMEDIATE supports user variables and SP variables\nas OUT parameters\n \nDELIMITER $$\nCREATE OR REPLACE PROCEDURE p1(OUT a INT)\nBEGIN\n SET a:= 10;\nEND;\n$$\nDELIMITER ;\nSET @a=2;\nEXECUTE IMMEDIATE \'CALL p1(?)\' USING @a;\nSELECT @a;\n+------+\n| @a |\n+------+\n| 10 |\n+------+\n \nSimilar to PREPARE, EXECUTE IMMEDIATE is allowed in stored\nprocedures but is not allowed in stored functions.\n \nThis example uses EXECUTE IMMEDIATE inside a stored\nprocedure:\n \nDELIMITER $$\nCREATE OR REPLACE PROCEDURE p1()\nBEGIN\n EXECUTE IMMEDIATE \'SELECT 1\';\nEND;\n$$\nDELIMITER ;\nCALL p1;\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n \nThis script returns an error:\n \nDELIMITER $$\nCREATE FUNCTION f1() RETURNS INT\nBEGIN\n EXECUTE IMMEDIATE \'DO 1\';\n RETURN 1;\nEND;\n$$\nERROR 1336 (0A000): Dynamic SQL is not allowed in stored\nfunction or trigger\n \nEXECUTE IMMEDIATE can use DEFAULT and IGNORE indicators as\nbind parameters:\n \nCREATE OR REPLACE TABLE t1 (a INT DEFAULT 10);\nEXECUTE IMMEDIATE \'INSERT INTO t1 VALUES (?)\' USING\nDEFAULT;\nSELECT * FROM t1;\n+------+\n| a |\n+------+\n| 10 |\n+------+\n \nEXECUTE IMMEDIATE increments the Com_execute_immediate\nstatus variable, as well as the Com_stmt_prepare,\nCom_stmt_execute and Com_stmt_close status variables.\n \nNote, EXECUTE IMMEDIATE does not increment the\nCom_execute_sql status variable. Com_execute_sql is used\nonly for PREPARE..EXECUTE.\n \nThis session screenshot demonstrates how EXECUTE IMMEDIATE\naffects status variables:\n \nSELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE\nVARIABLE_NAME RLIKE \n (\'COM_(EXECUTE|STMT_PREPARE|STMT_EXECUTE|STMT_CLOSE)\');\n \n+-----------------------+----------------+\n| VARIABLE_NAME | VARIABLE_VALUE |\n+-----------------------+----------------+\n| COM_EXECUTE_IMMEDIATE | 0 |\n| COM_EXECUTE_SQL | 0 |\n| COM_STMT_CLOSE | 0 |\n| COM_STMT_EXECUTE | 0 |\n| COM_STMT_PREPARE | 0 |\n+-----------------------+----------------+\n \nEXECUTE IMMEDIATE \'SELECT 1\';\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n \nSELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE\nVARIABLE_NAME RLIKE \n (\'COM_(EXECUTE|STMT_PREPARE|STMT_EXECUTE|STMT_CLOSE)\');\n+-----------------------+----------------+\n| VARIABLE_NAME | VARIABLE_VALUE |\n+-----------------------+----------------+\n| COM_EXECUTE_IMMEDIATE | 1 |\n| COM_EXECUTE_SQL | 0 |\n| COM_STMT_CLOSE | 1 |\n| COM_STMT_EXECUTE | 1 |\n| COM_STMT_PREPARE | 1 |\n+-----------------------+----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/execute-immediate/','','https://mariadb.com/kb/en/library/execute-immediate/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (100,8,'LOCK TABLES','Syntax\n------ \nLOCK TABLE[S]\n tbl_name [[AS] alias] lock_type\n [, tbl_name [[AS] alias] lock_type] ...\n [WAIT n|NOWAIT]\n \nlock_type:\n READ [LOCAL]\n | [LOW_PRIORITY] WRITE\n | WRITE CONCURRENT\n \nUNLOCK TABLES\n \nDescription\n----------- \nThe lock_type can be one of:\n \nOption | Description | \n \nREAD | Read lock, no writes allowed | \n \nREAD LOCAL | Read lock, but allow concurrent inserts | \n \nWRITE | Exclusive write lock. No other connections can read\nor write to this table | \n \nLOW_PRIORITY WRITE | Exclusive write lock, but allow new\nread locks on the table until we get the write lock. | \n \nWRITE CONCURRENT | Exclusive write lock, but allow READ\nLOCAL locks to the table. | \n \nMariaDB enables client sessions to acquire table locks\nexplicitly for the\npurpose of cooperating with other sessions for access to\ntables, or to\nprevent other sessions from modifying tables during periods\nwhen a\nsession requires exclusive access to them. A session can\nacquire or\nrelease locks only for itself. One session cannot acquire\nlocks for\nanother session or release locks held by another session.\n \nLocks may be used to emulate transactions or to get more\nspeed when\nupdating tables.\n \nLOCK TABLES explicitly acquires table locks for the current\nclient session.\nTable locks can be acquired for base tables or views. To use\nLOCK TABLES,\nyou must have the LOCK TABLES privilege, and the SELECT\nprivilege for\neach object to be locked. See GRANT\n \nFor view locking, LOCK TABLES adds all base tables used in\nthe view to the\nset of tables to be locked and locks them automatically. If\nyou lock a table\nexplicitly with LOCK TABLES, any tables used in triggers are\nalso locked\nimplicitly, as described in Triggers and Implicit Locks.\n \nUNLOCK TABLES explicitly releases any table locks held by\nthe\ncurrent session.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nLimitations\n \nLOCK TABLES doesn\'t work when using Galera cluster. You may\nexperience crashes or locks when used with Galera.\n \nLOCK TABLES works on XtraDB/InnoDB tables only if the\ninnodb_table_locks system variable is set to 1 (the default)\nand autocommit is set to 0 (1 is default). Please note that\nno error message will be returned on LOCK TABLES with\ninnodb_table_locks = 0.\n \nLOCK TABLES implicitly commits the active transaction, if\nany. Also, starting a transaction always releases all table\nlocks acquired with LOCK TABLES. This means that there is no\nway to have table locks and an active transaction at the\nsame time. The only exceptions are the transactions in\nautocommit mode. To preserve the data integrity between\ntransactional and non-transactional tables, the GET_LOCK()\nfunction can be used.\n \nWhile a connection holds an explicit read lock on a table,\nit cannot modify it. If you try, the following error will be\nproduced:\n \nERROR 1099 (HY000): Table \'tab_name\' was locked with a\nREAD lock and can\'t be updated\n \nWhile a connection holds an explicit lock on a table, it\ncannot access a non-locked table. If you try, the following\nerror will be produced:\n \nERROR 1100 (HY000): Table \'tab_name\' was not locked with\nLOCK TABLES\n \nWhile a connection holds an explicit lock on a table, it\ncannot issue the following: INSERT DELAYED, CREATE TABLE,\nCREATE TABLE ... LIKE, and DDL statements involving stored\nprograms and views (except for triggers). If you try, the\nfollowing error will be produced:\n \nERROR 1192 (HY000): Can\'t execute the given command because\nyou have active locked tables or an active transaction\n \nLOCK TABLES can not be used in stored routines - if you try,\nthe following error will be produced on creation:\n \nERROR 1314 (0A000): LOCK is not allowed in stored procedures\n \n\n\nURL: https://mariadb.com/kb/en/library/lock-tables/','','https://mariadb.com/kb/en/library/lock-tables/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (101,8,'ROLLBACK','The ROLLBACK statement rolls back (ends) a transaction,\ndestroying any changes to SQL-data so that they never become\nvisible to subsequent transactions. The required syntax for\nthe ROLLBACK statement is as follows. \n \nROLLBACK [ WORK ] [ AND [ NO ] CHAIN ] \n[ TO [ SAVEPOINT ] { | } ]\n \nThe ROLLBACK statement will either end a transaction,\ndestroying all data changes that happened during any of the\ntransaction, or it will just destroy any data changes that\nhappened since you established a savepoint. The basic form\nof the ROLLBACK statement is just the keyword ROLLBACK (the\nkeyword WORK is simply noise and can be omitted without\nchanging the effect). \n \nThe optional AND CHAIN clause is a convenience for\ninitiating a new transaction as soon as the old transaction\nterminates. If AND CHAIN is specified, then there is\neffectively nothing between the old and new transactions,\nalthough they remain separate. The characteristics of the\nnew transaction will be the same as the characteristics of\nthe old one — that is, the new transaction will have the\nsame access mode, isolation level and diagnostics area size\n(we\'ll discuss all of these shortly) as the transaction\njust terminated. The AND NO CHAIN option just tells your\nDBMS to end the transaction — that is, these four SQL\nstatements are equivalent: \n \nROLLBACK;\n \nROLLBACK WORK;\n \nROLLBACK AND NO CHAIN;\n \nROLLBACK WORK AND NO CHAIN;\n \nAll of them end a transaction without saving any transaction\ncharacteristics. The only other options, the equivalent\nstatements: \n \nROLLBACK AND CHAIN;\n \nROLLBACK WORK AND CHAIN;\n \nboth tell your DBMS to end a transaction, but to save that\ntransaction\'s characteristics for the next transaction. \n \nROLLBACK is much simpler than COMMIT: it may involve no more\nthan a few deletions (of Cursors, locks, prepared SQL\nstatements and log-file entries). It\'s usually assumed that\nROLLBACK can\'t fail, although such a thing is conceivable\n(for example, an encompassing transaction might reject an\nattempt to ROLLBACK because it\'s lining up for a COMMIT). \n \nROLLBACK cancels all effects of a transaction. It does not\ncancel effects on objects outside the DBMS\'s control (for\nexample the values in host program variables or the settings\nmade by some SQL/CLI function calls). But in general, it is\na convenient statement for those situations when you say\n\"oops, this isn\'t working\" or when you simply don\'t care\nwhether your temporary work becomes permanent or not.\n \nHere is a moot question. If all you\'ve been doing is\nSELECTs, so that there have been no data changes, should you\nend the transaction with ROLLBACK or COMMIT? It shouldn\'t\nreally matter because both ROLLBACK and COMMIT do the same\ntransaction-terminating job. However, the popular conception\nis that ROLLBACK implies failure, so after a successful\nseries of SELECT statements the convention is to end the\ntransaction with COMMIT rather than ROLLBACK.\n \nMariaDB (and most other DBMSs) supports rollback of SQL-data\nchange statements, but not of SQL-Schema statements. This\nmeans that if you use any of CREATE, ALTER, DROP, GRANT,\nREVOKE, you are implicitly committing at execution time.\n \nINSERT INTO Table_2 VALUES(5); \nDROP TABLE Table_3 CASCADE;\n \nROLLBACK;\n \nThe result will be that both the INSERT and the DROP will go\nthrough as separate transactions so the ROLLBACK will have\nno effect. \n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/rollback/','','https://mariadb.com/kb/en/library/rollback/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (102,8,'SAVEPOINT','Syntax\n------ \nSAVEPOINT identifier\nROLLBACK [WORK] TO [SAVEPOINT] identifier\nRELEASE SAVEPOINT identifier\n \nDescription\n----------- \nInnoDB supports the SQL statements SAVEPOINT,\nROLLBACK TO SAVEPOINT, RELEASE SAVEPOINT\nand the optional WORK keyword for\nROLLBACK.\n \nEach savepoint must have a legal MariaDB identifier. A\nsavepoint is a named sub-transaction.\n \nNormally ROLLBACK undoes the changes performed by the whole\ntransaction. When used with the TO clause, it undoes the\nchanges performed after the specified savepoint, and erases\nall subsequent savepoints. However, all locks that have been\nacquired after the save point will survive. RELEASE\nSAVEPOINT does not rollback or commit any changes, but\nremoves the specified savepoint.\n \nWhen the execution of a trigger or a stored function begins,\nit is not possible to use statements which reference a\nsavepoint which was defined from out of that stored program.\n \nWhen a COMMIT (including implicit commits) or a ROLLBACK\nstatement (with no TO clause) is performed, they act on the\nwhole transaction, and all savepoints are removed.\n \nErrors\n \nIf COMMIT or ROLLBACK is issued and no transaction was\nstarted, no error is reported.\n \nIf SAVEPOINT is issued and no transaction was started, no\nerror is reported but no savepoint is created. When ROLLBACK\nTO SAVEPOINT or RELEASE SAVEPOINT is called for a savepoint\nthat does not exist, an error like this is issued:\n \nERROR 1305 (42000): SAVEPOINT svp_name does not exist\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/savepoint/','','https://mariadb.com/kb/en/library/savepoint/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (103,8,'Metadata Locking','Metadata locking has been supported since MariaDB 5.5. This\nmeans that when a transaction (including XA transactions)\nuses a table, it locks its metadata until the end of\ntransaction. Non-transactional tables are also locked, as\nwell as views and objects which are related to locked\ntables/views (stored functions, triggers, etc). When a\nconnection tries to use a DDL statement (like an ALTER\nTABLE) which modifies a table that is locked, that\nconnection is queued, and has to wait until it\'s unlocked.\nUsing savepoints and performing a partial rollback does not\nrelease metadata locks.\n \nLOCK TABLES ... WRITE are also queued. Some wrong statements\nwhich produce an error may not need to wait for the lock to\nbe freed.\n \nMetadata lock\'s timeout is determined by the value of the\nlock_wait_timeout server system variable (in seconds).\nHowever, note that its default value is 31536000 (1 year).\nIf this timeout exceeds, the following error is returned:\n \nERROR 1205 (HY000): Lock wait timeout exceeded;\n try restarting transaction\n \nIf the metadata_lock_info plugin is installed, the\nInformation Schema metadata_lock_info table stores\ninformation about existing metadata locks.\n \nExample\n \nLet\'s use the following MEMORY (non-transactional) table:\n \nCREATE TABLE t (a INT) ENGINE = MEMORY;\n \nConnection 1 starts a transaction, and INSERTs a row into t:\n \nSTART TRANSACTION;\n \nINSERT INTO t SET a=1;\n \nt\'s metadata is now locked by connection 1. Connection 2\ntries to alter t, but has to wait:\n \nALTER TABLE t ADD COLUMN b INT;\n \nConnection 2\'s prompt is blocked now.\n \nNow connection 1 ends the transaction:\n \nCOMMIT;\n \n...and connection 2 finally gets the output of its command:\n \nQuery OK, 1 row affected (35.23 sec)\nRecords: 1 Duplicates: 0 Warnings: 0\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/metadata-locking/','','https://mariadb.com/kb/en/library/metadata-locking/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (104,8,'PREPARE Statement','Syntax\n------ \nPREPARE stmt_name FROM preparable_stmt\n \nDescription\n----------- \nThe PREPARE statement prepares a statement and assigns it a\nname,\nstmt_name, by which to refer to the statement later.\nStatement names\nare not case sensitive. preparable_stmt is either a string\nliteral or a user variable (not a local variable, an SQL\nexpression or a subquery) that contains the text of the\nstatement. The text must \nrepresent a single SQL statement, not multiple statements.\nWithin the\nstatement, \"?\" characters can be used as parameter markers\nto indicate\nwhere data values are to be bound to the query later when\nyou execute\nit. The \"?\" characters should not be enclosed within\nquotes, even if\nyou intend to bind them to string values. Parameter markers\ncan be used\nonly where data values should appear, not for SQL keywords,\nidentifiers, and so forth.\n \nThe scope of a prepared statement is the session within\nwhich it is\ncreated. Other sessions cannot see it.\n \nIf a prepared statement with the given name already exists,\nit is\ndeallocated implicitly before the new statement is prepared.\nThis means\nthat if the new statement contains an error and cannot be\nprepared, an\nerror is returned and no statement with the given name\nexists.\n \nPrepared statements can be PREPAREd and EXECUTEd in a stored\nprocedure, but not in a stored function or trigger. Also,\neven if the statement is PREPAREd in a procedure, it will\nnot be deallocated when the procedure execution ends.\n \nA prepared statement can access user-defined variables, but\nnot local variables or procedure\'s parameters.\n \nIf the prepared statement contains a syntax error, PREPARE\nwill fail. As a side effect, stored procedures can use it to\ncheck if a statement is valid. For example:\n \nCREATE PROCEDURE `test_stmt`(IN sql_text TEXT)\nBEGIN\n DECLARE EXIT HANDLER FOR SQLEXCEPTION\n BEGIN\n SELECT CONCAT(sql_text, \' is not valid\');\n END;\n SET @SQL := sql_text;\n PREPARE stmt FROM @SQL;\n DEALLOCATE PREPARE stmt;\nEND;\n \nThe FOUND_ROWS() and ROW_COUNT() functions, if called\nimmediatly after EXECUTE, return the number of rows read or\naffected by the prepared statements; however, if they are\ncalled after DEALLOCATE PREPARE, they provide information\nabout this statement. If the prepared statement produces\nerrors or warnings, GET DIAGNOSTICS return information about\nthem. DEALLOCATE PREPARE shouldn\'t clear the diagnostics\narea, unless it produces an error.\n \nA prepared statement is executed with EXECUTE and released \nwith DEALLOCATE PREPARE.\n \nThe max_prepared_stmt_count server system variable\ndetermines the number of allowed prepared statements that\ncan be prepared on the server. If it is set to 0, prepared\nstatements are not allowed. If the limit is reached, an\nerror similar to the following will be produced:\n \nERROR 1461 (42000): Can\'t create more than\nmax_prepared_stmt_count statements \n (current value: 0)\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, PREPARE stmt FROM \'SELECT\n:1, :2\' is used, instead of ?.\n \nPermitted Statements\n \nNot all statements can be prepared. Only the following SQL\ncommands are permitted:\nALTER TABLE\nANALYZE TABLE\nBINLOG\nCACHE INDEX\nCALL\nCHANGE MASTER\nCHECKSUM {TABLE | TABLES}\nCOMMIT\n{CREATE | DROP} DATABASE\n{CREATE | DROP} INDEX\n{CREATE | RENAME | DROP} TABLE\n{CREATE | RENAME | DROP} USER\n{CREATE | DROP} VIEW\nDELETE\nDESCRIBE\nDO\nEXPLAIN\nFLUSH {TABLE | TABLES | TABLES WITH READ LOCK | HOSTS |\nPRIVILEGES | LOGS | STATUS | \n MASTER | SLAVE | DES_KEY_FILE | USER_RESOURCES | QUERY\nCACHE | TABLE_STATISTICS | \n INDEX_STATISTICS | USER_STATISTICS | CLIENT_STATISTICS}\nGRANT\nINSERT\nINSTALL {PLUGIN | SONAME}\nHANDLER READ\nKILL\nLOAD INDEX INTO CACHE\nOPTIMIZE TABLE\nREPAIR TABLE\nREPLACE\nRESET {MASTER | SLAVE | QUERY CACHE}\nREVOKE\nROLLBACK\nSELECT\nSET\nSET GLOBAL SQL_SLAVE_SKIP_COUNTER\nSET ROLE\nSET SQL_LOG_BIN\nSET TRANSACTION ISOLATION LEVEL\nSHOW EXPLAIN\nSHOW {DATABASES | TABLES | OPEN TABLES | TABLE STATUS |\nCOLUMNS | INDEX | TRIGGERS | \n EVENTS | GRANTS | CHARACTER SET | COLLATION | ENGINES |\nPLUGINS [SONAME] | PRIVILEGES | \n PROCESSLIST | PROFILE | PROFILES | VARIABLES | STATUS |\nWARNINGS | ERRORS | \n TABLE_STATISTICS | INDEX_STATISTICS | USER_STATISTICS |\nCLIENT_STATISTICS | AUTHORS | \n CONTRIBUTORS}\nSHOW CREATE {DATABASE | TABLE | VIEW | PROCEDURE | FUNCTION\n| TRIGGER | EVENT}\nSHOW {FUNCTION | PROCEDURE} CODE\nSHOW BINLOG EVENTS\nSHOW SLAVE HOSTS\nSHOW {MASTER | BINARY} LOGS\nSHOW {MASTER | SLAVE | TABLES | INNODB | FUNCTION |\nPROCEDURE} STATUS\nSLAVE {START | STOP}\nTRUNCATE TABLE\nSHUTDOWN\nUNINSTALL {PLUGIN | SONAME}\nUPDATE\n \nSynonyms are not listed here, but can be used. For example,\nDESC can be used instead of DESCRIBE.\n \nCompound statements can be prepared too.\n \nNote that if a statement can be run in a stored routine, it\nwill work even if it is called by a prepared statement. For\nexample, SIGNAL can\'t be directly prepared. However, it is\nallowed in stored routines. If the x() procedure contains\nSIGNAL, you can still prepare and execute the \'CALL x();\'\nprepared statement.\n \nPREPARE now supports most kinds of expressions as well, for\nexample:\n \nPREPARE stmt FROM CONCAT(\'SELECT * FROM \', table_name);\n \nWhen PREPARE is used with a statement which is not\nsupported, the following error is produced:\n \nERROR 1295 (HY000): This command is not supported in the\nprepared statement protocol yet\n \nExample\n \ncreate table t1 (a int,b char(10));\ninsert into t1 values (1,\"one\"),(2,\n\"two\"),(3,\"three\");\nprepare test from \"select * from t1 where a=?\";\nset @param=2;\nexecute test using @param;\n+------+------+\n| a | b |\n+------+------+\n| 2 | two |\n+------+------+\nset @param=3;\nexecute test using @param;\n+------+-------+\n| a | b |\n+------+-------+\n| 3 | three |\n+------+-------+\ndeallocate prepare test;\n \nSince identifiers are not permitted as prepared statements\nparameters, sometimes it is necessary to dynamically compose\nan SQL statement. This technique is called dynamic SQL). The\nfollowing example shows how to use dynamic SQL:\n \nCREATE PROCEDURE test.stmt_test(IN tab_name VARCHAR(64))\nBEGIN\n SET @sql = CONCAT(\'SELECT COUNT(*) FROM \', tab_name);\n PREPARE stmt FROM @sql;\n EXECUTE stmt;\n DEALLOCATE PREPARE stmt;\nEND;\n \nCALL test.stmt_test(\'mysql.user\');\n+----------+\n| COUNT(*) |\n+----------+\n| 4 |\n+----------+\n \nUse of variables in prepared statements:\n \nPREPARE stmt FROM \'SELECT @x;\';\n \nSET @x = 1;\n \nEXECUTE stmt;\n+------+\n| @x |\n+------+\n| 1 |\n+------+\n \nSET @x = 0;\n \nEXECUTE stmt;\n+------+\n| @x |\n+------+\n| 0 |\n+------+\n \nDEALLOCATE PREPARE stmt;\n \n\n\nURL: https://mariadb.com/kb/en/library/prepare-statement/','','https://mariadb.com/kb/en/library/prepare-statement/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (105,8,'PURGE BINARY LOGS','Syntax\n------ \nPURGE { BINARY | MASTER } LOGS\n { TO \'log_name\' | BEFORE datetime_expr }\n \nDescription\n----------- \nThe PURGE BINARY LOGS statement deletes all the binary log\nfiles listed in the log index file prior to the specified\nlog file name or\ndate. BINARY and MASTER are synonyms.\nDeleted log files also are removed from the list recorded in\nthe index file, so\nthat the given log file becomes the first in the list.\n \nThe datetime expression is in the format \'YYYY-MM-DD\nhh:mm:ss\'. \n \nIf a slave is active but has yet to read from a binary log\nfile you attempt to delete, the statement will fail with an\nerror. However, if the slave is not connected and has yet to\nread from a log file you delete, the file will be deleted,\nbut the slave will be unable to continue replicating once it\nconnects again.\n \nThis statement has no effect if the server was not started\nwith the\n--log-bin option to enable binary logging.\n \nTo list the binary log files on the server, use SHOW BINARY\nLOGS. To see which files they are reading, use SHOW SLAVE\nSTATUS. You can only delete the files that are older than\nthe oldest file that is used by the slaves.\n \nTo delete all binary log files, use RESET MASTER.\nTo move to a new log file (for example if you want to remove\nthe current log file), use FLUSH LOGS before you execute\nPURGE LOGS.\n \nIf the expire_logs_days server system variable is not set to\n0, the server automatically deletes binary log files after\nthe given number of days.\n \nExamples\n-------- \nPURGE BINARY LOGS TO \'mariadb-bin.000063\';\n \nPURGE BINARY LOGS BEFORE \'2013-04-21\';\n \nPURGE BINARY LOGS BEFORE \'2013-04-22 09:55:22\';\n \n\n\nURL: https://mariadb.com/kb/en/library/purge-binary-logs/','','https://mariadb.com/kb/en/library/purge-binary-logs/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (106,8,'RESET MASTER','RESET MASTER [TO #]\n \nDeletes all binary log files listed in the index file,\nresets the\nbinary log index file to be empty, and creates a new binary\nlog file with a suffix of .000001.\n \nIf TO # is given, then the first new binary log file will\nstart from number #.\n \nThis statement is for use only when the master is started\nfor the first time, and should never be used if any slaves\nare actively replicating from the binary log.\n \n\n\nURL: https://mariadb.com/kb/en/library/reset-master/','','https://mariadb.com/kb/en/library/reset-master/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (107,8,'RESET SLAVE','RESET SLAVE [\"connection_name\"] [ALL] \n \nRESET SLAVE makes the slave forget its replication position\nin the\nmaster\'s binary log. This statement is meant to be used for\na clean\nstart. It deletes the master.info and relay-log.info files,\nall the\nrelay log files, and starts a new relay log file. To use\nRESET SLAVE,\nthe slave replication threads must be stopped (use STOP\nSLAVE if\nnecessary).\n \nNote: All relay log files are deleted, even if they have not\nbeen\ncompletely executed by the slave SQL thread. (This is a\ncondition\nlikely to exist on a replication slave if you have issued a\nSTOP SLAVE\nstatement or if the slave is highly loaded.)\n \nConnection information stored in the master.info file is\nimmediately\nreset using any values specified in the corresponding\nstartup options.\nThis information includes values such as master host, master\nport,\nmaster user, and master password. If the slave SQL thread\nwas in the\nmiddle of replicating temporary tables when it was stopped,\nand RESET\nSLAVE is issued, these replicated temporary tables are\ndeleted on the\nslave.\n \nThe ALL also resets the PORT, HOST, USER and PASSWORD\nparameters for the slave. If you are using a connection\nname, it will permanently delete it and it will not show up\nanymore in SHOW ALL SLAVES STATUS.\n \nconnection_name\n \nThe connection_name option was added as part of multi-source\nreplication added in MariaDB 10.0\n \nIf there is only one nameless master, or the default master\n(as specified by the default_master_connection system\nvariable) is intended, connection_name can be omitted. If\nprovided, the RESET SLAVE statement will apply to the\nspecified master. connection_name is case-insensitive.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/reset-slave-connection_name/','','https://mariadb.com/kb/en/library/reset-slave-connection_name/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (108,8,'SET TRANSACTION','Syntax\n------ \nSET [GLOBAL | SESSION] TRANSACTION\n transaction_property [, transaction_property] ...\n \ntransaction_property:\n ISOLATION LEVEL level\n | READ WRITE\n | READ ONLY\n \nlevel:\n REPEATABLE READ\n | READ COMMITTED\n | READ UNCOMMITTED\n | SERIALIZABLE\n \nDescription\n----------- \nThis statement sets the transaction isolation level or the\ntransaction access mode globally, for the current session,\nor for the next transaction:\nWith the GLOBAL keyword, the statement sets the default\n transaction level globally for all subsequent sessions.\nExisting sessions are\n unaffected.\nWith the SESSION keyword, the statement sets the default\n transaction level for all subsequent transactions performed\nwithin the\n current session.\nWithout any SESSION or GLOBAL keyword,\n the statement sets the isolation level for the next (not\nstarted) transaction\n performed within the current session.\n \nA change to the global default isolation level requires the \nSUPER privilege. Any session is free to change its\nsession isolation level (even in the middle of a\ntransaction), or the isolation\nlevel for its next transaction.\n \nIsolation Level\n \nTo set the global default isolation level at server startup,\nuse the\n--transaction-isolation=level option on the command line or\nin an option file. Values of level for this option use\ndashes\nrather than spaces, so the allowable values are\nREAD-UNCOMMITTED,\nREAD-COMMITTED, REPEATABLE-READ, or\nSERIALIZABLE. For example, to set the default isolation\nlevel to REPEATABLE READ, use these lines in the [mysqld]\nsection of an option file:\n \n[mysqld]\ntransaction-isolation = REPEATABLE-READ\nTo determine the global and session transaction isolation\nlevels at\nruntime, check the value of the tx_isolation system\nvariable:\n \nSELECT @@GLOBAL.tx_isolation, @@tx_isolation;\n \nInnoDB supports each of the translation isolation levels\ndescribed here\nusing different locking strategies. The default level is \nREPEATABLE READ. For additional information about InnoDB\nrecord-level locks and how it uses them to execute various\ntypes of statements,\nsee XtraDB/InnoDB Lock Modes,\nand\nhttp://dev.mysql.com/doc/refman/en/innodb-locks-set.html.\n \nIsolation Levels\n \nThe following sections describe how MariaDB supports the\ndifferent transaction levels.\n \nREAD UNCOMMITTED\n \nSELECT statements are performed in a non-locking fashion,\nbut a possible earlier version of a row might be used. Thus,\nusing this\nisolation level, such reads are not consistent. This is also\ncalled a \"dirty\nread.\" Otherwise, this isolation level works like \nREAD COMMITTED.\n \nREAD COMMITTED\n \nA somewhat Oracle-like isolation level with respect to\nconsistent\n(non-locking) reads: Each consistent read, even within the\nsame\ntransaction, sets and reads its own fresh snapshot. See\nhttp://dev.mysql.com/doc/refman/en/innodb-consistent-read.html.\n \nFor locking reads (SELECT with FOR UPDATE\nor LOCK IN SHARE MODE), InnoDB locks only index records, not\nthe gaps before them, and thus allows the free insertion of\nnew records next to\nlocked records. For UPDATE and DELETE\nstatements, locking depends on whether the statement uses a\nunique index with a\nunique search condition (such as WHERE id = 100), or a\nrange-type search condition (such as WHERE id > 100). For a\nunique index with a unique search condition, InnoDB locks\nonly the index record\nfound, not the gap before it. For range-type searches,\nInnoDB locks the index\nrange scanned, using gap locks or next-key (gap plus\nindex-record) locks to\nblock insertions by other sessions into the gaps covered by\nthe range. This is\nnecessary because \"phantom rows\" must be blocked for MySQL\nreplication and\nrecovery to work.\n \nNote: Since MariaDB 5.1, if the READ COMMITTED isolation\nlevel is used or the innodb_locks_unsafe_for_binlog system\nvariable is enabled,\nthere is no InnoDB gap locking except for foreign-key\nconstraint checking and\nduplicate-key checking. Also, record locks for non-matching\nrows are released\nafter MariaDB has evaluated the WHERE condition. As of\nMariaDB/MySQL\n5.1, if you use READ COMMITTED or enable\ninnodb_locks_unsafe_for_binlog, you must use row-based\nbinary logging.\n \nREPEATABLE READ\n \nThis is the default isolation level for InnoDB. For\nconsistent reads,\nthere is an important difference from the READ COMMITTED\nisolation level: All consistent reads within the same\ntransaction read the\nsnapshot established by the first read. This convention\nmeans that if you issue\nseveral plain (non-locking) SELECT statements within the\nsame transaction, these SELECT statements are consistent\nalso with respect to each other. See\nhttp://dev.mysql.com/doc/refman/en/innodb-consistent-read.html.\n \nFor locking reads (SELECT with FOR UPDATE or LOCK IN SHARE\nMODE),\nUPDATE, and DELETE statements, locking depends on whether\nthe\nstatement uses a unique index with a unique search\ncondition, or a\nrange-type search condition. For a unique index with a\nunique search\ncondition, InnoDB locks only the index record found, not the\ngap\nbefore it. For other search conditions, InnoDB locks the\nindex range\nscanned, using gap locks or next-key (gap plus index-record)\nlocks to\nblock insertions by other sessions into the gaps covered by\nthe range.\n \nThis is the minimum isolation level for non-distributed XA\ntransactions.\n \nSERIALIZABLE\n \nThis level is like REPEATABLE READ, but InnoDB implicitly\nconverts all\nplain SELECT statements to SELECT ... LOCK IN SHARE MODE if\nautocommit\nis disabled. If autocommit is enabled, the SELECT is its own\ntransaction. It therefore is known to be read only and can\nbe\nserialized if performed as a consistent (non-locking) read\nand need\nnot block for other transactions. (This means that to force\na plain\nSELECT to block if other transactions have modified the\nselected rows,\nyou should disable autocommit.)\n \nDistributed XA transactions should always use this isolation\nlevel.\n \nAccess Mode\n \nThese clauses appeared in MariaDB 10.0.\n \nThe access mode specifies whether the transaction is allowed\nto write data or not. By default, transactions are in READ\nWRITE mode (see the tx_read_only system variable). READ ONLY\nmode allows the storage engine to apply optimizations that\ncannot be used for transactions which write data. The only\nexception to this rule is that read only transactions can\nperform DDL statements on temporary tables.\n \nIt is not permitted to specify both READ WRITE and READ ONLY\nin the same statement.\n \nREAD WRITE and READ ONLY can also be specified in the START\nTRANSACTION statement, in which case the specified mode is\nonly valid for one transaction.\n \nExamples\n-------- \nSET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE;\n \nAttempting to set the isolation level within an existing\ntransaction without specifying GLOBAL or SESSION.\n \nSTART TRANSACTION;\n \nSET TRANSACTION ISOLATION LEVEL SERIALIZABLE;\nERROR 1568 (25001): Transaction characteristics can\'t be\nchanged while a transaction is in progress\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/set-transaction/','','https://mariadb.com/kb/en/library/set-transaction/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (109,8,'START SLAVE','Syntax\n------ \nSTART SLAVE [\"connection_name\"] [thread_type [,\nthread_type] ... ]\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL \n MASTER_LOG_FILE = \'log_name\', MASTER_LOG_POS = log_pos\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL\n RELAY_LOG_FILE = \'log_name\', RELAY_LOG_POS = log_pos\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL\n MASTER_GTID_POS = \nSTART ALL SLAVES [thread_type [, thread_type]]\nthread_type: IO_THREAD | SQL_THREAD\n \nDescription\n----------- \nSTART SLAVE with no thread_type options starts both of the\nslave\nthreads (see replication). The I/O thread reads events from\nthe master server and stores\nthem in the relay log. The SQL thread reads events from the\nrelay log\nand executes them. START SLAVE requires the SUPER privilege.\n \nIf START SLAVE succeeds in starting the slave threads, it\nreturns\nwithout any error. However, even in that case, it might be\nthat the\nslave threads start and then later stop (for example,\nbecause they do\nnot manage to connect to the master or read its binary log,\nor some\nother problem). START SLAVE does not warn you about this.\nYou must\ncheck the slave\'s error log for error messages generated by\nthe slave\nthreads, or check that they are running satisfactorily with\nSHOW SLAVE\nSTATUS.\n \nSTART SLAVE UNTIL\n \nSTART SLAVE UNTIL refers to the SQL_THREAD slave position at\nwhich the SQL_THREAD replication will halt. If SQL_THREAD\nisn\'t specified both threads are started.\n \nSince version 10.0.2, START SLAVE UNTIL master_gtid_pos=xxx\nhas also been supported. See Global Transaction ID/START\nSLAVE UNTIL master_gtid_pos=xxx for more details.\n \nconnection_name\n \nThe connection_name option was added as part of multi-source\nreplication added in MariaDB 10.0\n \nIf there is only one nameless master, or the default master\n(as specified by the default_master_connection system\nvariable) is intended, connection_name can be omitted. If\nprovided, the START SLAVE statement will apply to the\nspecified master. connection_name is case-insensitive.\n \nSTART ALL SLAVES\n \nSTART ALL SLAVES starts all configured slaves (slaves with\nmaster_host not empty) that were not started before. It will\ngive a note for all started connections. You can check the\nnotes with SHOW WARNINGS.\n \n\n\nURL: https://mariadb.com/kb/en/library/start-slave/','','https://mariadb.com/kb/en/library/start-slave/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (110,8,'START TRANSACTION','Syntax\n------ \nSTART TRANSACTION [transaction_property [,\ntransaction_property] ...] | BEGIN [WORK]\nCOMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nROLLBACK [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nSET autocommit = {0 | 1}\n \ntransaction_property:\n WITH CONSISTENT SNAPSHOT\n | READ WRITE\n | READ ONLY\n \nDescription\n----------- \nThe START TRANSACTION or BEGIN statement\nbegins a new transaction. COMMIT commits the current\ntransaction, making its changes permanent. ROLLBACK rolls\nback the current transaction, canceling its changes. The SET\nautocommit statement disables or enables the default\nautocommit mode for the current session.\n \nSTART TRANSACTION and SET autocommit = 1 implicitly commit\nthe current transaction, if any.\n \nThe optional WORK keyword is supported for\nCOMMIT and ROLLBACK, as are the\nCHAIN and RELEASE clauses.\nCHAIN and RELEASE can be used for\nadditional control over transaction completion. The value of\nthe\ncompletion_type system variable determines the default\ncompletion behavior.\n \nThe AND CHAIN clause causes a new transaction to begin as\nsoon as the current one ends, and the new transaction has\nthe same isolation\nlevel as the just-terminated transaction. The RELEASE clause\ncauses the server to disconnect the current client session\nafter terminating\nthe current transaction. Including the NO keyword suppresses\nCHAIN or RELEASE completion, which can be\nuseful if the completion_type system variable is set to\ncause chaining or release completion by default.\n \nAccess Mode\n \nThese clauses appeared in MariaDB 10.0.\n \nThe access mode specifies whether the transaction is allowed\nto write data or not. By default, transactions are in READ\nWRITE mode (see the tx_read_only system variable). READ ONLY\nmode allows the storage engine to apply optimizations that\ncannot be used for transactions which write data. The only\nexception to this rule is that read only transactions can\nperform DDL statements on temporary tables.\n \nIt is not permitted to specify both READ WRITE and READ ONLY\nin the same statement.\n \nREAD WRITE and READ ONLY can also be specified in the SET\nTRANSACTION statement, in which case the specified mode is\nvalid for all sessions, or for all subsequent transaction\nused by the current session.\n \nautocommit\n \nBy default, MariaDB runs with autocommit mode enabled. This\nmeans that as soon as you execute a statement that updates\n(modifies) a table, MariaDB stores the update on disk to\nmake it permanent. To disable autocommit mode, use the\nfollowing statement:\n \nSET autocommit=0;\n \nAfter disabling autocommit mode by setting the autocommit\nvariable to zero, changes to transaction-safe tables (such\nas those for InnoDB or\nNDBCLUSTER) are not made permanent immediately. You must use\nCOMMIT to store your changes to disk or ROLLBACK to ignore\nthe changes.\n \nTo disable autocommit mode for a single series of\nstatements, use the START TRANSACTION statement.\n \nDDL Statements\n \nDDL statements (CREATE, ALTER, DROP) and administrative\nstatements (FLUSH, RESET, OPTIMIZE, ANALYZE, CHECK, REPAIR,\nCACHE INDEX), and LOAD DATA INFILE, cause an implicit COMMIT\nand start a new transaction. An exception to this rule are\nthe DDL that operate on temporary tables: you can CREATE,\nALTER and DROP them without causing any COMMIT, but those\nactions cannot be rolled back. This means that if you call\nROLLBACK, the temporary tables you created in the\ntransaction will remain, while the rest of the transaction\nwill be rolled back.\n \nTransactions cannot be used in Stored Functions or Triggers.\nIn Stored Procedures and Events BEGIN is not allowed, so you\nshould use START TRANSACTION instead.\n \nA transaction acquires a metadata lock on every table it\naccesses to prevent other connections from altering their\nstructure. The lock is released at the end of the\ntransaction. This happens even with non-transactional\nstorage engines (like MEMORY or CONNECT), so it makes sense\nto use transactions with non-transactional tables.\n \nin_transaction\n \nThe in_transaction system variable appeared in MariaDB 5.3.\n \nIt is a session-only, read-only variable that returns 1\ninside a transaction, and 0 if not in a transaction.\n \nWITH CONSISTENT SNAPSHOT\n \nThe WITH CONSISTENT SNAPSHOT option starts a consistent read\nfor storage engines such as XtraDB and InnoDB that can do\nso, the same as if a START TRANSACTION followed by a SELECT\nfrom any InnoDB table was issued. \n \nMariaDB 5.3 introduced enhancements to this feature. See\nEnhancements for START TRANSACTION WITH CONSISTENT SNAPSHOT.\n \nExamples\n-------- \nSTART TRANSACTION;\n \nSELECT @A:=SUM(salary) FROM table1 WHERE type=1;\n \nUPDATE table2 SET summary=@A WHERE type=1;\n \nCOMMIT;\n \n\n\nURL: https://mariadb.com/kb/en/library/start-transaction/','','https://mariadb.com/kb/en/library/start-transaction/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (111,8,'STOP SLAVE','Syntax\n------ \nSTOP SLAVE [\"connection_name\"] [thread_type [,\nthread_type] ... ]\n \nSTOP ALL SLAVES [thread_type [, thread_type]]\n \nthread_type: IO_THREAD | SQL_THREAD\n \nDescription\n----------- \nStops the slave threads. STOP SLAVE requires the SUPER\nprivilege.\n \nLike START SLAVE, this statement may be used with the\nIO_THREAD and\nSQL_THREAD options to name the thread or threads to be\nstopped. In almost all cases, one never need to use the\nthread_type options.\n \nSTOP SLAVE waits until any current replication event group\naffecting\none or more non-transactional tables has finished executing\n(if there\nis any such replication group), or until the user issues a\nKILL QUERY or KILL CONNECTION statement.\n \nNote that STOP SLAVE doesn\'t delete the connection\npermanently. Next time you execute START SLAVE or the\nMariaDB server restarts, the slave connection is restored\nwith it\'s original arguments. If you want to delete a\nconnection, you should execute RESET SLAVE.\n \nSTOP ALL SLAVES\n \nSTOP ALL SLAVES stops all your running slaves. It will give\nyou a note for every stopped connection. You can check the\nnotes with SHOW WARNINGS.\n \nconnection_name\n \nThe connection_name option was added as part of multi-source\nreplication added in MariaDB 10.0\n \nIf there is only one nameless master, or the default master\n(as specified by the default_master_connection system\nvariable) is intended, connection_name can be omitted. If\nprovided, the STOP SLAVE statement will apply to the\nspecified master. connection_name is case-insensitive.\n \n\n\nURL: https://mariadb.com/kb/en/library/stop-slave/','','https://mariadb.com/kb/en/library/stop-slave/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (112,8,'Transaction Timeouts','MariaDB has always had the wait_timeout and\ninteractive_timeout settings, which close connections after\na certain period of inactivity.\n \nHowever, these are by default set to a long wait period. In\nsituations where transactions may be started, but not\ncommitted or rolled back, more granular control and a\nshorter timeout may be desirable so as to avoid locks being\nheld for too long.\n \nMariaDB 10.3 introduced three new variables to handle this\nsituation.\nidle_transaction_timeout (all transactions)\nidle_write_transaction_timeout (write transactions - called\nidle_readwrite_transaction_timeout until MariaDB 10.3.2)\nidle_readonly_transaction_timeout (read transactions)\n \nThese accept a time in seconds to time out, by closing the\nconnection, transactions that are idle for longer than this\nperiod. By default all are set to zero, or no timeout.\n \nidle_transaction_timeout affects all transactions,\nidle_write_transaction_timeout affects write transactions\nonly and idle_readonly_transaction_timeout affects read\ntransactions only. The latter two variables work\nindependently. However, if either is set along with\nidle_transaction_timeout, the settings for\nidle_write_transaction_timeout or\nidle_readonly_transaction_timeout will take precedence.\n \nExamples\n-------- \nSET SESSION idle_transaction_timeout=2;\n \nBEGIN;\n \nSELECT * FROM t;\n \nEmpty set (0.000 sec)\n## wait 3 seconds\nSELECT * FROM t;\n \nERROR 2006 (HY000): MySQL server has gone away\n \nSET SESSION idle_write_transaction_timeout=2;\n \nBEGIN;\n \nSELECT * FROM t;\n \nEmpty set (0.000 sec)\n## wait 3 seconds\nSELECT * FROM t;\n \nEmpty set (0.000 sec)\nINSERT INTO t VALUES(1);\n## wait 3 seconds\nSELECT * FROM t;\n \nERROR 2006 (HY000): MySQL server has gone away\n \nSET SESSION idle_transaction_timeout=2, SESSION\nidle_readonly_transaction_timeout=10;\n \nBEGIN;\n \nSELECT * FROM t;\n \nEmpty set (0.000 sec)\n ## wait 3 seconds\nSELECT * FROM t;\n \nEmpty set (0.000 sec)\n## wait 11 seconds\nSELECT * FROM t;\n \nERROR 2006 (HY000): MySQL server has gone away\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/transaction-timeouts/','','https://mariadb.com/kb/en/library/transaction-timeouts/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (113,8,'UNLOCK TABLES','Syntax\n------ \nUNLOCK TABLES\n \nDescription\n----------- \nUNLOCK TABLES explicitly releases any table locks held by\nthe\ncurrent session. See LOCK TABLES for more information.\n \nIn addition to releasing table locks acquired by the LOCK\nTABLES statement, the UNLOCK TABLES statement also releases\nthe global read lock acquired by the FLUSH TABLES WITH READ\nLOCK statement. The FLUSH TABLES WITH READ LOCK statement is\nvery useful for performing backups. See FLUSH for more\ninformation about FLUSH TABLES WITH READ LOCK.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/transactions-unlock-tables/','','https://mariadb.com/kb/en/library/transactions-unlock-tables/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (114,8,'WAIT and NOWAIT','MariaDB 10.3.0 introduced extended syntax so that it is\npossible to set innodb_lock_wait_timeout and\nlock_wait_timeout for the following statements:\n \nSyntax\n------ \nALTER TABLE tbl_name [WAIT n|NOWAIT] ...\nCREATE ... INDEX ON tbl_name (index_col_name, ...) [WAIT\nn|NOWAIT] ...\nDROP INDEX ... [WAIT n|NOWAIT]\nDROP TABLE tbl_name [WAIT n|NOWAIT] ...\nLOCK TABLE ... [WAIT n|NOWAIT]\nOPTIMIZE TABLE tbl_name [WAIT n|NOWAIT]\nRENAME TABLE tbl_name [WAIT n|NOWAIT] ...\nSELECT ... FOR UPDATE [WAIT n|NOWAIT]\nSELECT ... LOCK IN SHARE MODE [WAIT n|NOWAIT]\nTRUNCATE TABLE tbl_name [WAIT n|NOWAIT]\n \nDescription\n----------- \nThe lock wait timeout can be explicitly set in the statement\nby using either WAIT n (to set the wait in seconds) or\nNOWAIT, in which case the statement will immediately fail if\nthe lock cannot be obtained. WAIT 0 is equivalent to NOWAIT.\n \n\n\nURL: https://mariadb.com/kb/en/library/wait-and-nowait/','','https://mariadb.com/kb/en/library/wait-and-nowait/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (115,8,'XA Transactions','Overview\n \nThe MariaDB XA implementation is based on the X/Open CAE\ndocument Distributed Transaction Processing: The XA\nSpecification. This document is published by The Open Group\nand available at\nhttp://www.opengroup.org/public/pubs/catalog/c193.htm.\n \nXA transactions are designed to allow distributed\ntransactions, where a transaction manager (the application)\ncontrols a transaction which involves multiple resources.\nSuch resources are usually DBMSs, but could be resources of\nany type. The whole set of required transactional operations\nis called a global transaction. Each subset of operations\nwhich involve a single resource is called a local\ntransaction. XA used a 2-phases commit (2PC). With the first\ncommit, the transaction manager tells each resource to\nprepare an effective commit, and waits for a confirm\nmessage. The changes are not still made effective at this\npoint. If any of the resources encountered an error, the\ntransaction manager will rollback the global transaction. If\nall resources communicate that the first commit is\nsuccessful, the transaction manager can require a second\ncommit, which makes the changes effective.\n \nIn MariaDB, XA transactions can only be used with storage\nengines that support them. At least InnoDB, TokuDB, SPIDER\nand MyRocks support them. For InnoDB, XA transactions can be\ndisabled by setting the innodb_support_xa server system\nvariable to 0. \n \nLike regular transactions, XA transactions create metadata\nlocks on accessed tables.\n \nXA transactions require REPEATABLE READ as a minimum\nisolation level. However, distributed transactions should\nalways use SERIALIZABLE.\n \nTrying to start more than one XA transaction at the same\ntime produces a 1400 error (SQLSTATE \'XAE09\'). The same\nerror is produced when attempting to start an XA transaction\nwhile a regular transaction is in effect. Trying to start a\nregular transaction while an XA transaction is in effect\nproduces a 1399 error (SQLSTATE \'XAE07\').\n \nThe statements that cause an implicit COMMIT for regular\ntransactions produce a 1400 error (SQLSTATE \'XAE09\') if a\nXA transaction is in effect.\n \nInternal XA vs External XA\n \nXA transactions are an overloaded term in MariaDB. If a\nstorage engine is XA-capable, it can mean one or both of\nthese:\nIt supports MariaDB\'s internal two-phase commit API. This\nis transparent to the user. Sometimes this is called\n\"internal XA\", since MariaDB\'s internal transaction\ncoordinator log can handle coordinating these transactions.\n \nIt supports XA transactions, with the XA START, XA PREPARE,\nXA COMMIT, etc. statements. Sometimes this is called\n\"external XA\", since it requires the use of an external\ntransaction coordinator to use this feature properly.\n \nTransaction Coordinator Log\n \nIf you have two or more XA-capable storage engines enabled,\nthen a transaction coordinator log must be available.\n \nThere are currently two implementations of the transaction\ncoordinator log:\nBinary log-based transaction coordinator log\nMemory-mapped file-based transaction coordinator log\n \nIf the binary log is enabled on a server, then the server\nwill use the binary log-based transaction coordinator log.\nOtherwise, it will use the memory-mapped file-based\ntransaction coordinator log.\n \nSee Transaction Coordinator Log for more information.\n \nSyntax\n------ \nXA {START|BEGIN} xid [JOIN|RESUME]\n \nXA END xid [SUSPEND [FOR MIGRATE]]\n \nXA PREPARE xid\n \nXA COMMIT xid [ONE PHASE]\n \nXA ROLLBACK xid\n \nXA RECOVER [FORMAT=[\'RAW\'|\'SQL\']]\n \nxid: gtrid [, bqual [, formatID ]]\n \nThe interface to XA transactions is a set of SQL statements\nstarting with XA. Each statement changes a transaction\'s\nstate, determining which actions it can perform. A\ntransaction which does not exist is in the NON-EXISTING\nstate.\n \nXA START (or BEGIN) starts a transaction and defines its xid\n(a transaction identifier). The JOIN or RESUME keywords have\nno effect. The new transaction will be in ACTIVE state.\n \nThe xid can have 3 components, though only the first one is\nmandatory. gtrid is a quoted string representing a global\ntransaction identifier. bqual is a quoted string\nrepresenting a local transaction identifier. formatID is an\nunsigned integer indicating the format used for the first\ntwo components; if not specified, defaults to 1. MariaDB\ndoes not interpret in any way these components, and only\nuses them to identify a transaction. xids of transactions in\neffect must be unique.\n \nXA END declares that the specified ACTIVE transaction is\nfinished and it changes its state to IDLE. SUSPEND [FOR\nMIGRATE] has no effect.\n \nXA PREPARE prepares an IDLE transaction for commit, changing\nits state to PREPARED. This is the first commit.\n \nXA COMMIT definitely commits and terminates a transaction\nwhich has already been PREPARED. If the ONE PHASE clause is\nspecified, this statements performs a 1-phase commit on an\nIDLE transaction.\n \nXA ROLLBACK rolls back and terminates an IDLE or PREPARED\ntransaction.\n \nXA RECOVER shows information about all PREPARED\ntransactions.\n \nWhen trying to execute an operation which is not allowed for\nthe transaction\'s current state, an error is produced:\n \nXA COMMIT \'test\' ONE PHASE;\n \nERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be\nexecuted when global transaction is in the ACTIVE state\n \nXA COMMIT \'test2\';\n \nERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be\nexecuted when global transaction is in the NON-EXISTING\nstate\n \nXA RECOVER\n \nThe XA RECOVER statement shows information about all\ntransactions which are in the PREPARED state. It does not\nmatter which connection created the transaction: if it has\nbeen PREPARED, it appears. But this does not mean that a\nconnection can commit or rollback a transaction which was\nstarted by another connection. Note that transactions using\na 1-phase commit are never in the PREPARED state, so they\ncannot be shown by XA RECOVER.\n \nXA RECOVER produces four columns:\n \nXA RECOVER;\n \n+----------+--------------+--------------+------+\n| formatID | gtrid_length | bqual_length | data |\n+----------+--------------+--------------+------+\n| 1 | 4 | 0 | test |\n+----------+--------------+--------------+------+\n \nYou can use XA RECOVER FORMAT=\'SQL\' to get the data in a\nhuman readable\nform that can be directly copy-pasted into XA COMMIT or XA\nROLLBACK. This is particularly useful for binary xid\ngenerated by some transaction coordinators.\n \nformatID is the formatID part of xid.\n \ndata are the gtrid and bqual parts of xid, concatenated.\n \ngtrid_length and bqual_length are the lengths of gtrid and\nbqual, respectevely.\n \nExamples\n-------- \n2-phases commit:\n \nXA START \'test\';\n \nINSERT INTO t VALUES (1,2);\n \nXA END \'test\';\n \nXA PREPARE \'test\';\n \nXA COMMIT \'test\';\n \n1-phase commit:\n \nXA START \'test\';\n \nINSERT INTO t VALUES (1,2);\n \nXA END \'test\';\n \nXA COMMIT \'test\' ONE PHASE;\n \nHuman-readable:\n \nxa start \'12\\r34\\t67\\v78\', \'abc\\ndef\', 3;\n \ninsert t1 values (40);\n \nxa end \'12\\r34\\t67\\v78\', \'abc\\ndef\', 3;\n \nxa prepare \'12\\r34\\t67\\v78\', \'abc\\ndef\', 3;\n \nxa recover format=\'RAW\';\n \n+----------+--------------+--------------+--------------------+\n| formatID | gtrid_length | bqual_length | data |\n+----------+--------------+--------------+--------------------+\n34 67v78abc 11 | 7 | 12\ndef |\n+----------+--------------+--------------+--------------------+\n \nxa recover format=\'SQL\';\n \n+----------+--------------+--------------+-----------------------------------------------+\n| formatID | gtrid_length | bqual_length | data |\n+----------+--------------+--------------+-----------------------------------------------+\n| 3 | 11 | 7 |\nX\'31320d3334093637763738\',X\'6162630a646566\',3 |\n+----------+--------------+--------------+-----------------------------------------------+\n \nxa rollback\nX\'31320d3334093637763738\',X\'6162630a646566\',3;\n \nKnown Issues\n \nMariaDB Galera Cluster\n \nMariaDB Galera Cluster does not support XA transactions. See\nMDEV-10532 for more information on that. The request to\nimplement that feature is being tracked at MDEV-17099.\n \nHowever, MariaDB Galera Cluster builds include a built-in\nplugin called wsrep. Prior to MariaDB 10.4.3, this plugin\nwas internally considered an XA-capable storage engine.\nConsequently, these MariaDB Galera Cluster builds have\nmultiple XA-capable storage engines by default, even if the\nonly \"real\" storage engine that supports external XA\ntransactions enabled on these builds by default is InnoDB.\nTherefore, when using one these builds MariaDB would be\nforced to use a transaction coordinator log by default,\nwhich could have performance implications.\n \nSee Transaction Coordinator Log Overview: MariaDB Galera\nCluster for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/xa-transactions/','','https://mariadb.com/kb/en/library/xa-transactions/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (116,10,'Account Locking','Account locking was introduced in MariaDB 10.4.2.\n \nDescription\n----------- \nAccount locking permits privileged administrators to\nlock/unlock user accounts. No new client connections will be\npermitted if an account is locked (existing connections are\nnot affected).\n \nUser accounts can be locked at creation, with the CREATE\nUSER statement, or modified after creation with the ALTER\nUSER statement. For example:\n \nCREATE USER \'lorin\'@\'localhost\' ACCOUNT LOCK;\n \nor\n \nALTER USER \'marijn\'@\'localhost\' ACCOUNT LOCK;\n \nThe server will return an ER_ACCOUNT_HAS_BEEN_LOCKED error\nwhen locked users attempt to connect:\n \nmysql -ulorin\n ERROR 4151 (HY000): Access denied, this account is locked\n \nThe ALTER USER statement is also used to unlock a user:\n \nALTER USER \'lorin\'@\'localhost\' ACCOUNT UNLOCK;\n \nThe SHOW CREATE USER statement will show whether the account\nis locked:\n \nSHOW CREATE USER \'marijn\'@\'localhost\';\n \n+-----------------------------------------------+\n| CREATE USER for marijn@localhost |\n+-----------------------------------------------+\n| CREATE USER \'marijn\'@\'localhost\' ACCOUNT LOCK |\n+-----------------------------------------------+\n \nas well as querying the mysql.global_priv table:\n \nSELECT CONCAT(user, \'@\', host, \' => \',\nJSON_DETAILED(priv)) FROM mysql.global_priv \n WHERE user=\'marijn\';\n+--------------------------------------------------------------------------------------+\n| CONCAT(user, \'@\', host, \' => \', JSON_DETAILED(priv)) |\n+--------------------------------------------------------------------------------------+\n| marijn@localhost => {\n \"access\": 0,\n \"plugin\": \"mysql_native_password\",\n \"authentication_string\": \"\",\n \"account_locked\": true,\n \"password_last_changed\": 1558017158\n} |\n+--------------------------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/account-locking/','','https://mariadb.com/kb/en/library/account-locking/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (117,10,'Authentication from MariaDB 10.4','MariaDB 10.4 introduces a number of changes to the\nauthentication process, intended to make things easier and\nmore intuitive.\n \nOverview\n \nThere are four main changes relating to authentication:\nIt is possible to use more than one authentication plugin\nfor each user account. For example, this can be useful to\nslowly migrate users to the more secure ed25519\nauthentication plugin over time, while allowing the old\nmysql_native_password authentication plugin as an\nalternative for the transitional period.\nThe root@localhost user account created by mysql_install_db\nis created with the ability to use two authentication\nplugins.\nFirst, it is configured to try to use the unix_socket\nauthentication plugin. This allows the the root@localhost\nuser to login without a password via the local Unix socket\nfile defined by the socket system variable, as long as the\nlogin is attempted from a process owned by the operating\nsystem root user account.\nSecond, if authentication fails with the unix_socket\nauthentication plugin, then it is configured to try to use\nthe mysql_native_password authentication plugin. However, an\ninvalid password is initially set, so in order to\nauthenticate this way, a password must be set with SET\nPASSWORD.\nHowever, just using the unix_socket authentication plugin\nmay be fine for many users, and it is very secure. You may\nwant to try going without password authentication to see how\nwell it works for you. Remember, the best way to keep your\npassword safe is not to have one!\n \nAll user accounts, passwords, and global privileges are now\nstored in the mysql.global_priv table. The mysql.user table\nstill exists and has exactly the same set of columns as\nbefore, but it’s now a view that references the\nmysql.global_priv table. Tools that analyze the mysql.user\ntable should continue to workas before.\nMariaDB 10.4 supports User Password Expiry, which is not\nactive by default.\n \nDescription\n----------- \nAs a result of the above changes, the open-for-everyone\nall-powerful root account is finally gone. And installation\nscripts will no longer demand that you “PLEASE REMEMBER TO\nSET A PASSWORD FOR THE MariaDB root USER !”, because the\nroot account is securely created automatically.\n \nTwo all-powerful accounts are created by default — root\nand the OS user that owns the data directory, typically\nmysql. They are created as:\n \nCREATE USER root@localhost IDENTIFIED VIA unix_socket OR\nmysql_native_password USING \'invalid\'\nCREATE USER mysql@localhost IDENTIFIED VIA unix_socket OR\nmysql_native_password USING \'invalid\'\n \nUsing unix_socket means that if you are the system root\nuser, you can login as root@locahost without a password.\nThis technique was pioneered by Otto Kekäläinen in Debian\nMariaDB packages and has been successfully used in Debian\nsince as early as MariaDB 10.0. \n \nIt is based on a simple fact that asking the system root for\na password adds no extra security — root has full access\nto all the data files and all process memory anyway. But not\nasking for a password means, there is no root password to\nforget (no need for the numerous tutorials on “how to\nreset MariaDB root password”). And if you want to script\nsome tedious database work, there is no need to store the\nroot password in plain text for the scipt to use (no need\nfor debian-sys-maint user).\n \nStill, some users may wish to log in as MariaDB root without\nusing sudo. Hence the old authentication method —\nconventional MariaDB password — is still available. By\ndefault it is disabled (“invalid” is not a valid\npassword hash), but one can set the password with a usual\nSET PASSWORD statement. And still retain the password-less\naccess via sudo.\n \nIf you install MariaDB locally (say from a tarball, you\nwould not want to use sudo to be able to login. This is why\nMariaDB creates a second all-powerful user with the same\nname as a system user that owns the data directory. In local\n(not system-wide) installations, this will be the user who\ninstalled MariaDB — they automatically get convenient\npassword-less root-like access, because they can access all\nthe data files anyway.\n \nEven if MariaDB is installed system-wide, you may not want\nto run your database maintenance scripts as system root —\nnow you can run them as system mysql user. And you will know\nthat they will never destroy your entire system, even if you\nmake a typo in a shell script.\n \nHowever, seasoned MariaDB DBAs who are used to the old ways\ndo need to makes some changes. See the examples below for\ncommon tasks. \n \nCookbook\n \nAfter installing MariaDB system-wide the first thing\nyou’ve got used to doing is logging in into the\nunprotected root account and protecting it, that is, setting\nthe root password:\n \n$ sudo dnf install MariaDB-server\n$ mysql -uroot\n...\nMariaDB> set password = password(\"XH4VmT3_jt\");\n \nThis is not only unnecessary now, it will simply not work\n— there is no unprotected root account. To login as root\nuse\n \n$ sudo dnf install MariaDB-server\n$ sudo mysql\n \nNote that it implies you are connecting via the unix socket,\nnot tcp. If you happen to have protocol=tcp in a system-wide\n/etc/my.cnf file, use sudo mysql --protocol=socket.\n \nAfter installing MariaDB locally you’ve also used to\nconnect to the unprotected root account using mysql -uroot.\nThis will not work either, simply use mysql without\nspecifying a username.\n \nIf you\'ve forgotten your root password, no problem — you\ncan still connect using sudo and change the password. And if\nyou\'ve also removed unix_socket authentication, to restore\naccess do as follows:\nrestart MariaDB with --skip-grant-tables\nlogin into the unprotected server\nrun FLUSH PRIVILEGES (note, before 10.4 this would’ve been\nthe last step, not anymore). This disables\n--skip-grant-tables and allows you to change the stored\nauthentication method.\nrun SET PASSWORD FOR root@localhost to change the root\npassword\n \nTo view inside privilege tables, the old mysql.user table\nstill exists. You can select from it as before, although you\ncannot update it anymore. It doesn’t show alternative\nauthentication plugins and this was one of the reasons for\nswitching to the mysql.global_priv table — complex\nauthentication rules did not fit into rigid structure of a\nrelational table. You can select from the new table, for\nexample: \n \nselect concat(user, \'@\', host, \' => \',\njson_detailed(priv)) from mysql.global_priv;\n \nReverting to the Previous Authentication Method for\nroot@localhost\n \nIf you don\'t want the root@localhost user account created\nby mysql_install_db to use unix_socket authentication by\ndefault, then there are a few ways to revert to the previous\nmysql_native_password authentication method for this user\naccount.\n \nConfiguring mysql_install_db to Revert to the Previous\nAuthentication Method\n \nOne way to revert to the previous mysql_native_password\nauthentication method for the root@localhost user account is\nto execute mysql_install_db with a special option. If\nmysql_install_db is executed while\n--auth-root-authentication-method=normal is specified, then\nit will create the default user accounts using the default\nbehavior of MariaDB 10.3 and before.\n \nThis means that the root@localhost user account will use\nmysql_native_password authentication by default. There are\nsome other differences as well. See mysql_install_db: User\nAccounts Created by Default for more information.\n \nFor example, the option can be set on the command-line while\nrunning mysql_install_db:\n \nmysql_install_db --user=mysql --datadir=/var/lib/mysql\n--auth-root-authentication-method=normal\n \nThe option can also be set in an option file in an option\ngroup supported by mysql_install_db. For example:\n \n[mysql_install_db]\nauth_root_authentication_method=normal\n \nIf the option is set in an option file and if\nmysql_install_db is executed, then mysql_install_db will\nread this option from the option file, and it will\nautomatically set this option.\n \nAltering the User Account to Revert to the Previous\nAuthentication Method\n \nIf you have already installed MariaDB, and if the\nroot@localhost user account is already using unix_socket\nauthentication, then you can revert to the old\nmysql_native_password authentication method for the user\naccount by executing the following:\n \nALTER USER root@localhost IDENTIFIED VIA\nmysql_native_password USING PASSWORD(\"verysecret\")\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/authentication-from-mariadb-104/','','https://mariadb.com/kb/en/library/authentication-from-mariadb-104/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (118,10,'CREATE USER','Syntax\n------ \nCREATE [OR REPLACE] USER [IF NOT EXISTS] \n user_specification [,user_specification ...] \n [REQUIRE {NONE | tls_option [[AND] tls_option ...] }]\n [WITH resource_option [resource_option ...] ]\n [password_option | lock_option] \n \nuser_specification:\n username [authentication_option]\n \nauthentication_option:\n IDENTIFIED BY \'password\' \n | IDENTIFIED BY PASSWORD \'password_hash\'\n | IDENTIFIED {VIA|WITH} authentication_rule [OR\nauthentication_rule ...]\n \nauthentication_rule:\n authentication_plugin\n | authentication_plugin {USING|AS}\n\'authentication_string\'\n | authentication_plugin {USING|AS} PASSWORD(\'password\')\n \ntls_option:\n SSL \n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n \nresource_option:\n MAX_QUERIES_PER_HOUR count\n | MAX_UPDATES_PER_HOUR count\n | MAX_CONNECTIONS_PER_HOUR count\n | MAX_USER_CONNECTIONS count\n | MAX_STATEMENT_TIME time\n \npassword_option:\n PASSWORD EXPIRE\n | PASSWORD EXPIRE DEFAULT\n | PASSWORD EXPIRE NEVER\n | PASSWORD EXPIRE INTERVAL N DAY\n \nlock_option:\n ACCOUNT LOCK\n | ACCOUNT UNLOCK\n}\n \nDescription\n----------- \nThe CREATE USER statement creates new MariaDB accounts. To\nuse it, you must have the global CREATE USER privilege or\nthe INSERT privilege for the mysql database. For each\naccount, CREATE USER creates a new row in\nthe mysql.user table that has no privileges.\n \nIf any of the specified accounts, or any permissions for the\nspecified accounts, already exist, then the server returns\nERROR 1396 (HY000). If an error occurs, CREATE USER will\nstill create the accounts that do not result in an error.\nOnly one error is produced for all users which have not been\ncreated:\n \nERROR 1396 (HY000): \n Operation CREATE USER failed for \'u1\'@\'%\',\'u2\'@\'%\'\n \nCREATE USER, DROP USER, CREATE ROLE, and DROP ROLE all\nproduce the\nsame error code when they fail.\n \nSee Account Names below for details on how account names are\nspecified. \n \nOR REPLACE\n \nIf the optional OR REPLACE clause is used, it is basically a\nshortcut for:\n \nDROP USER IF EXISTS name;\n \nCREATE USER name ...;\n \nFor example:\n \nCREATE USER foo2@test IDENTIFIED BY \'password\';\n \nERROR 1396 (HY000): Operation CREATE USER failed for\n\'foo2\'@\'test\'\n \nCREATE OR REPLACE USER foo2@test IDENTIFIED BY \'password\';\n \nQuery OK, 0 rows affected (0.00 sec)\n \nIF NOT EXISTS\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the specified user already\nexists.\n \nFor example:\n \nCREATE USER foo2@test IDENTIFIED BY \'password\';\n \nERROR 1396 (HY000): Operation CREATE USER failed for\n\'foo2\'@\'test\'\n \nCREATE USER IF NOT EXISTS foo2@test IDENTIFIED BY\n\'password\';\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+----------------------------------------------------+\n| Level | Code | Message |\n+-------+------+----------------------------------------------------+\n| Note | 1973 | Can\'t create user \'foo2\'@\'test\';\n it already exists |\n+-------+------+----------------------------------------------------+\n1 row in set (0.00 sec\n \nAuthentication Options\n \nIDENTIFIED BY \'password\'\n \nThe optional IDENTIFIED BY clause can be used to provide an\naccount with a password. The password should be specified in\nplain text. It will be hashed by the PASSWORD function prior\nto being stored to the mysql.user table.\n \nFor example, if our password is mariadb, then we can create\nthe user with:\n \nCREATE USER foo2@test IDENTIFIED BY \'mariadb\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED BY PASSWORD \'password_hash\'\n \nThe optional IDENTIFIED BY PASSWORD clause can be used to\nprovide an account with a password that has already been\nhashed. The password should be specified as a hash that was\nprovided by the PASSWORD function. It will be stored to the\nmysql.user table as-is.\n \nFor example, if our password is mariadb, then we can find\nthe hash with:\n \nSELECT PASSWORD(\'mariadb\');\n+-------------------------------------------+\n| PASSWORD(\'mariadb\') |\n+-------------------------------------------+\n| *54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n1 row in set (0.00 sec)\n \nAnd then we can create a user with the hash:\n \nCREATE USER foo2@test IDENTIFIED BY PASSWORD\n\'*54958E764CE10E50764C2EECBB71D01F08549980\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED {VIA|WITH} authentication_plugin\n \nThe optional IDENTIFIED VIA authentication_plugin allows you\nto specify that the account should be authenticated by a\nspecific authentication plugin. The plugin name must be an\nactive authentication plugin as per SHOW PLUGINS. If it\ndoesn\'t show up in that output, then you will need to\ninstall it with INSTALL PLUGIN or INSTALL SONAME.\n \nFor example, this could be used with the PAM authentication\nplugin:\n \nCREATE USER foo2@test IDENTIFIED VIA pam;\n \nSome authentication plugins allow additional arguments to be\nspecified after a USING or AS keyword. For example, the PAM\nauthentication plugin accepts a service name:\n \nCREATE USER foo2@test IDENTIFIED VIA pam USING \'mariadb\';\n \nThe exact meaning of the additional argument would depend on\nthe specific authentication plugin.\n \nThe USING or AS keyword can also be used to provide a\nplain-text password to a plugin if it\'s provided as an\nargument to the PASSWORD() function. This is only valid for\nauthentication plugins that have implemented a hook for the\nPASSWORD() function. For example, the ed25519 authentication\nplugin supports this:\n \nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 USING\nPASSWORD(\'secret\');\n \nOne can specify many authentication plugins, they all works\nas alternatives ways of authenticating a user:\n \nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 USING\nPASSWORD(\'secret\') OR unix_socket;\n \nTLS Options\n \nBy default, MariaDB transmits data between the server and\nclients without encrypting it. This is generally acceptable\nwhen the server and client run on the same host or in\nnetworks where security is guaranteed through other means.\nHowever, in cases where the server and client exist on\nseparate networks or they are in a high-risk network, the\nlack of encryption does introduce security concerns as a\nmalicious actor could potentially eavesdrop on the traffic\nas it is sent over the network between them.\n \nTo mitigate this concern, MariaDB allows you to encrypt data\nin transit between the server and clients using the\nTransport Layer Security (TLS) protocol. TLS was formerly\nknown as Secure Socket Layer (SSL), but strictly speaking\nthe SSL protocol is a predecessor to TLS and, that version\nof the protocol is now considered insecure. The\ndocumentation still uses the term SSL often and for\ncompatibility reasons TLS-related server system and status\nvariables still use the prefix ssl_, but internally, MariaDB\nonly supports its secure successors.\n \nSee Secure Connections Overview for more information about\nhow to determine whether your MariaDB server has TLS\nsupport.\n \nYou can set certain TLS-related restrictions for specific\nuser accounts. For instance, you might use this with user\naccounts that require access to sensitive data while sending\nit across networks that you do not control. These\nrestrictions can be enabled for a user account with the\nCREATE USER, ALTER USER, or GRANT statements. The following\noptions are available:\n \nOption | Description | \n \nREQUIRE NONE | TLS is not required for this account, but can\nstill be used. | \n \nREQUIRE SSL | The account must use TLS, but no valid X509\ncertificate is required. This option cannot be combined with\nother TLS options. | \n \nREQUIRE X509 | The account must use TLS and must have a\nvalid X509 certificate. This option implies REQUIRE SSL.\nThis option cannot be combined with other TLS options. | \n \nREQUIRE ISSUER \'issuer\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the Certificate\nAuthority must be the one specified via the string issuer.\nThis option implies REQUIRE X509. This option can be\ncombined with the SUBJECT, and CIPHER options in any order.\n| \n \nREQUIRE SUBJECT \'subject\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the certificate\'s\nSubject must be the one specified via the string subject.\nThis option implies REQUIRE X509. This option can be\ncombined with the ISSUER, and CIPHER options in any order. |\n\n \nREQUIRE CIPHER \'cipher\' | The account must use TLS, but no\nvalid X509 certificate is required. Also, the encryption\nused for the connection must use one of the methods\nspecified in the string cipher. This option implies REQUIRE\nSSL. This option can be combined with the ISSUER, and\nSUBJECT options in any order. | \n \nThe REQUIRE keyword must be used only once for all specified\noptions, and the AND keyword can be used to separate\nindividual options, but it is not required.\n \nFor example, you can create a user account that requires\nthese TLS options with the following:\n \nCREATE USER \'alice\'@\'%\'\n REQUIRE SUBJECT \'/CN=alice/O=My Dom,\nInc./C=US/ST=Oregon/L=Portland\'\n AND ISSUER \'/C=FI/ST=Somewhere/L=City/ O=Some\nCompany/CN=Peter Parker/emailAddress=p.parker@marvel.com\'\n AND CIPHER \'TLSv1.2\';\n \nIf any of these options are set for a specific user account,\nthen any client who tries to connect with that user account\nwill have to be configured to connect with TLS.\n \nSee Securing Connections for Client and Server for\ninformation on how to enable TLS on the client and server.\n \nResource Limit Options\n \nMariaDB 10.2.0 introduced a number of resource limit\noptions.\n \nIt is possible to set per-account limits for certain server\nresources. The following table shows the values that can be\nset per account:\n \nLimit Type | Decription | \n \nMAX_QUERIES_PER_HOUR | Number of statements that the account\ncan issue per hour (including updates) | \n \nMAX_UPDATES_PER_HOUR | Number of updates (not queries) that\nthe account can issue per hour | \n \nMAX_CONNECTIONS_PER_HOUR | Number of connections that the\naccount can start per hour | \n \nMAX_USER_CONNECTIONS | Number of simultaneous connections\nthat can be accepted from the same account; if it is 0,\nmax_connections will be used instead; if max_connections is\n0, there is no limit for this account\'s simultaneous\nconnections. | \n \nMAX_STATEMENT_TIME | Timeout, in seconds, for statements\nexecuted by the user. See also Aborting Statements that\nExceed a Certain Time to Execute. | \n \nIf any of these limits are set to 0, then there is no limit\nfor that resource for that user.\n \nHere is an example showing how to create a user with\nresource limits:\n \nCREATE USER \'someone\'@\'localhost\' WITH\n MAX_USER_CONNECTIONS 10\n MAX_QUERIES_PER_HOUR 200;\n \nThe resources are tracked per account, which means\n\'user\'@\'server\'; not per user name or per connection.\n \nThe count can be reset for all users using FLUSH\nUSER_RESOURCES, FLUSH PRIVILEGES or mysqladmin reload.\n \nPer account resource limits are stored in the user table, in\nthe mysql database. Columns used for resources limits are\nnamed max_questions, max_updates, max_connections (for\nMAX_CONNECTIONS_PER_HOUR), and max_user_connections (for\nMAX_USER_CONNECTIONS).\n \nAccount Names\n \nAccount names have both a user name component and a host\nname component, and are specified as\n\'user_name\'@\'host_name\'.\n \nThe user name and host name may be unquoted, quoted as\nstrings using double quotes (\") or\nsingle quotes (\'), or quoted as identifiers using backticks\n(`). You must use quotes\nwhen using special characters (such as a hyphen) or wildcard\ncharacters. If you quote, you \nmust quote the user name and host name separately (for\nexample \'user_name\'@\'host_name\').\n \nHost Name Component\n \nIf the host name is not provided, it is assumed to be \'%\'.\n \nHost names may contain the wildcard characters % and _. They\nare matched as if by\nthe LIKE clause. If you need to use a wildcard character\nliterally (for example, to\nmatch a domain name with an underscore), prefix the\ncharacter with a backslash. See LIKE\nfor more information on escaping wildcard characters.\n \nHost name matches are case-insensitive. Host names can match\neither domain names or IP\naddresses. Use \'localhost\' as the host name to allow only\nlocal client connections.\n \nYou can use a netmask to match a range of IP addresses using\n\'base_ip/netmask\' as the\nhost name. A user with an IP address ip_addr will be allowed\nto connect if the following\ncondition is true:\n \nip_addr & netmask = base_ip\n \nYou can only use netmasks that specify a multiple of 8 bits\nof the address to match. That is,\nonly the following netmasks are allowed:\n \n255.0.0.0\n255.255.0.0\n255.255.255.0\n255.255.255.255\n \nUsing 255.255.255.255 is equivalent to not using a netmask\nat all.\n \nUser Name Component\n \nUser names must match exactly, including case. A user name\nthat is empty is known as an anonymous account and is\nallowed to match a login attempt with any user name\ncomponent. These are described more in the next section.\n \nFor valid identifiers to use as user names, see Identifier\nNames.\n \nIt is possible for more than one account to match when a\nuser connects. MariaDB selects\nthe first matching account after sorting according to the\nfollowing criteria:\nAccounts with an exact host name are sorted before accounts\nusing a wildcard in the\nhost name. Host names using a netmask are considered to be\nexact for sorting.\nAccounts with a wildcard in the host name are sorted\naccording to the position of\nthe first wildcard character. Those with a wildcard\ncharacter later in the host name\nsort before those with a wildcard character earlier in the\nhost name.\nAccounts with a non-empty user name sort before accounts\nwith an empty user name.\nAccounts with an empty user name are sorted last. As\nmentioned previously, these are known as anonymous accounts.\nThese are described more in the next section.\n \nThe following table shows a list of example account as\nsorted by these criteria:\n \n+---------+-------------+\n| User | Host |\n+---------+-------------+\n| joffrey | 192.168.0.3 |\n| | 192.168.0.% |\n| joffrey | 192.168.% |\n| | 192.168.% |\n+---------+-------------+\n \nOnce connected, you only have the privileges granted to the\naccount that matched,\nnot all accounts that could have matched. For example,\nconsider the following\ncommands:\n \nCREATE USER \'joffrey\'@\'192.168.0.3\';\n \nCREATE USER \'joffrey\'@\'%\';\n \nGRANT SELECT ON test.t1 to \'joffrey\'@\'192.168.0.3\';\n \nGRANT SELECT ON test.t2 to \'joffrey\'@\'%\';\n \nIf you connect as joffrey from 192.168.0.3, you will have\nthe SELECT\nprivilege on the table test.t1, but not on the table\ntest.t2. If you connect as joffrey from any other IP\naddress, you will have the SELECT privilege on the table\ntest.t2, but not\non the table test.t1.\n \nBeginning with MariaDB 5.5.31, usernames can be up to 80\ncharacters long. From MariaDB 10.0 the system tables are all\nby default this length. However, in order to enable this\nfeature in MariaDB 5.5, the following schema changes must be\nmade:\n \nALTER TABLE mysql.user MODIFY User CHAR(80) BINARY NOT NULL\nDEFAULT \'\';\n \nALTER TABLE mysql.db MODIFY User CHAR(80) BINARY NOT NULL\nDEFAULT \'\';\n \nALTER TABLE mysql.tables_priv MODIFY User CHAR(80) BINARY\nNOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.columns_priv MODIFY User CHAR(80) BINARY\nNOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.procs_priv MODIFY User CHAR(80) BINARY NOT\nNULL DEFAULT \'\';\n \nALTER TABLE mysql.proc MODIFY definer CHAR(141) COLLATE\nutf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.event MODIFY definer CHAR(141) COLLATE\nutf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.proxies_priv MODIFY User CHAR(80) COLLATE\nutf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.proxies_priv MODIFY Proxied_user CHAR(80)\nCOLLATE utf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.proxies_priv MODIFY Grantor CHAR(141)\nCOLLATE utf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.servers MODIFY Username CHAR(80) NOT NULL\nDEFAULT \'\';\n \nALTER TABLE mysql.procs_priv MODIFY Grantor CHAR(141)\nCOLLATE utf8_bin NOT NULL DEFAULT \'\';\n \nALTER TABLE mysql.tables_priv MODIFY Grantor CHAR(141)\nCOLLATE utf8_bin NOT NULL DEFAULT \'\';\n \nFLUSH PRIVILEGES;\n \nAnonymous Accounts\n \nAnonymous accounts are accounts where the user name portion\nof the account name is empty. These accounts act as special\ncatch-all accounts. If a user attempts to log into the\nsystem from a host, and an anonymous account exists with a\nhost name portion that matches the user\'s host, then the\nuser will log in as the anonymous account if there is no\nmore specific account match for the user name that the user\nentered.\n \nFor example, here are some anonymous accounts:\n \nCREATE USER \'\'@\'localhost\';\n \nCREATE USER \'\'@\'192.168.0.3\';\n \nFixing a Legacy Default Anonymous Account\n \nOn some systems, the mysql.db table has some entries for the\n\'\'@\'%\' anonymous account by default. Unfortunately,\nthere is no matching entry in the mysql.user table, which\nmeans that this anonymous account doesn\'t exactly exist,\nbut it does have privileges--usually on the default test\ndatabase created by mysql_install_db. These account-less\nprivileges are a legacy that is leftover from a time when\nMySQL\'s privilege system was less advanced.\n \nThis situation means that you will run into errors if you\ntry to create a \'\'@\'%\' account. For example:\n \nCREATE USER \'\'@\'%\';\n \nERROR 1396 (HY000): Operation CREATE USER failed for\n\'\'@\'%\'\n \nThe fix is to DELETE the row in the mysql.db table and then\nexecute FLUSH PRIVILEGES:\n \nDELETE FROM mysql.db WHERE User=\'\' AND Host=\'%\';\n \nFLUSH PRIVILEGES;\n \nAnd then the account can be created:\n \nCREATE USER \'\'@\'%\';\n \nQuery OK, 0 rows affected (0.01 sec)\n \nSee MDEV-13486 for more information.\n \nPassword Expiry\n \nBesides automatic password expiry, as determined by\ndefault_password_lifetime, password expiry times can be set\non an individual user basis, overriding the global setting,\nfor example:\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nSee User Password Expiry for more details.\n \nAccount Locking\n \nAccount locking permits privileged administrators to\nlock/unlock user accounts. No new client connections will be\npermitted if an account is locked (existing connections are\nnot affected). For example:\n \nCREATE USER \'marijn\'@\'localhost\' ACCOUNT LOCK;\n \nSee Account Locking','','https://mariadb.com/kb/en/library/create-user/'); -update help_topic set description = CONCAT(description, ' for more details.\n \n\n\nURL: https://mariadb.com/kb/en/library/create-user/') WHERE help_topic_id = 118; -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (119,10,'ALTER USER','The ALTER USER statement was introduced in MariaDB 10.2.0.\n \nSyntax\n------ \nALTER USER [IF EXISTS] \n user_specification [,user_specification] ...\n [REQUIRE {NONE | tls_option [[AND] tls_option] ...}]\n [WITH resource_option [resource_option] ...]\n [password_option | lock_option] \n \nuser_specification:\n username [authentication_option]\n \nauthentication_option:\n IDENTIFIED BY \'password\' \n | IDENTIFIED BY PASSWORD \'password_hash\'\n | IDENTIFIED {VIA|WITH} authentication_plugin\n | IDENTIFIED {VIA|WITH} authentication_plugin {USING|AS}\n\'authentication_string\'\n | IDENTIFIED {VIA|WITH} authentication_plugin {USING|AS}\nPASSWORD(\'password\')\n \ntls_option\n SSL \n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n \nresource_option\n MAX_QUERIES_PER_HOUR count\n | MAX_UPDATES_PER_HOUR count\n | MAX_CONNECTIONS_PER_HOUR count\n | MAX_USER_CONNECTIONS count\n | MAX_STATEMENT_TIME time\n \npassword_option:\n PASSWORD EXPIRE\n | PASSWORD EXPIRE DEFAULT\n | PASSWORD EXPIRE NEVER\n | PASSWORD EXPIRE INTERVAL N DAY\n \nlock_option:\n ACCOUNT LOCK\n | ACCOUNT UNLOCK\n}\n \nDescription\n----------- \nThe ALTER USER statement modifies existing MariaDB accounts.\nTo use it, you must have the global CREATE USER privilege or\nthe UPDATE privilege for the mysql database. The global\nSUPER privilege is also required if the read_only system\nvariable is enabled.\n \nIf any of the specified user accounts do not yet exist, an\nerror results. If an error occurs, ALTER USER will still\nmodify the accounts that do not result in an error. Only one\nerror is produced for all users which have not been\nmodified.\n \nIF EXISTS\n \nWhen the IF EXISTS clause is used, MariaDB will return a\nwarning instead of an error for each specified user that\ndoes not exist.\n \nAccount Names\n \nFor ALTER USER statements, account names are specified as\nthe username argument in the same way as they are for CREATE\nUSER statements. See account names from the CREATE USER page\nfor details on how account names are specified.\n \nCURRENT_USER or CURRENT_USER() can also be used to alter the\naccount logged into the current session. For example, to\nchange the current user\'s password to mariadb:\n \nALTER USER CURRENT_USER() IDENTIFIED BY \'mariadb\';\n \nAuthentication Options\n \nIDENTIFIED BY \'password\'\n \nThe optional IDENTIFIED BY clause can be used to provide an\naccount with a password. The password should be specified in\nplain text. It will be hashed by the PASSWORD function prior\nto being stored to the mysql.user table.\n \nFor example, if our password is mariadb, then we can set the\naccount\'s password with:\n \nALTER USER foo2@test IDENTIFIED BY \'mariadb\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED BY PASSWORD \'password_hash\'\n \nThe optional IDENTIFIED BY PASSWORD clause can be used to\nprovide an account with a password that has already been\nhashed. The password should be specified as a hash that was\nprovided by the PASSWORD function. It will be stored to the\nmysql.user table as-is.\n \nFor example, if our password is mariadb, then we can find\nthe hash with:\n \nSELECT PASSWORD(\'mariadb\');\n+-------------------------------------------+\n| PASSWORD(\'mariadb\') |\n+-------------------------------------------+\n| *54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n1 row in set (0.00 sec)\n \nAnd then we can set an account\'s password with the hash:\n \nALTER USER foo2@test IDENTIFIED BY PASSWORD\n\'*54958E764CE10E50764C2EECBB71D01F08549980\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED {VIA|WITH} authentication_plugin\n \nThe optional IDENTIFIED VIA authentication_plugin allows you\nto specify that the account should be authenticated by a\nspecific authentication plugin. The plugin name must be an\nactive authentication plugin as per SHOW PLUGINS. If it\ndoesn\'t show up in that output, then you will need to\ninstall it with INSTALL PLUGIN or INSTALL SONAME.\n \nFor example, this could be used with the PAM authentication\nplugin:\n \nALTER USER foo2@test IDENTIFIED VIA pam;\n \nSome authentication plugins allow additional arguments to be\nspecified after a USING or AS keyword. For example, the PAM\nauthentication plugin accepts a service name:\n \nALTER USER foo2@test IDENTIFIED VIA pam USING \'mariadb\';\n \nThe exact meaning of the additional argument would depend on\nthe specific authentication plugin.\n \nIn MariaDB 10.4 and later, the USING or AS keyword can also\nbe used to provide a plain-text password to a plugin if\nit\'s provided as an argument to the PASSWORD() function.\nThis is only valid for authentication plugins that have\nimplemented a hook for the PASSWORD() function. For example,\nthe ed25519 authentication plugin supports this:\n \nALTER USER safe@\'%\' IDENTIFIED VIA ed25519 USING\nPASSWORD(\'secret\');\n \nTLS Options\n \nBy default, MariaDB transmits data between the server and\nclients without encrypting it. This is generally acceptable\nwhen the server and client run on the same host or in\nnetworks where security is guaranteed through other means.\nHowever, in cases where the server and client exist on\nseparate networks or they are in a high-risk network, the\nlack of encryption does introduce security concerns as a\nmalicious actor could potentially eavesdrop on the traffic\nas it is sent over the network between them.\n \nTo mitigate this concern, MariaDB allows you to encrypt data\nin transit between the server and clients using the\nTransport Layer Security (TLS) protocol. TLS was formerly\nknown as Secure Socket Layer (SSL), but strictly speaking\nthe SSL protocol is a predecessor to TLS and, that version\nof the protocol is now considered insecure. The\ndocumentation still uses the term SSL often and for\ncompatibility reasons TLS-related server system and status\nvariables still use the prefix ssl_, but internally, MariaDB\nonly supports its secure successors.\n \nSee Secure Connections Overview for more information about\nhow to determine whether your MariaDB server has TLS\nsupport.\n \nYou can set certain TLS-related restrictions for specific\nuser accounts. For instance, you might use this with user\naccounts that require access to sensitive data while sending\nit across networks that you do not control. These\nrestrictions can be enabled for a user account with the\nCREATE USER, ALTER USER, or GRANT statements. The following\noptions are available:\n \nOption | Description | \n \nREQUIRE NONE | TLS is not required for this account, but can\nstill be used. | \n \nREQUIRE SSL | The account must use TLS, but no valid X509\ncertificate is required. This option cannot be combined with\nother TLS options. | \n \nREQUIRE X509 | The account must use TLS and must have a\nvalid X509 certificate. This option implies REQUIRE SSL.\nThis option cannot be combined with other TLS options. | \n \nREQUIRE ISSUER \'issuer\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the Certificate\nAuthority must be the one specified via the string issuer.\nThis option implies REQUIRE X509. This option can be\ncombined with the SUBJECT, and CIPHER options in any order.\n| \n \nREQUIRE SUBJECT \'subject\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the certificate\'s\nSubject must be the one specified via the string subject.\nThis option implies REQUIRE X509. This option can be\ncombined with the ISSUER, and CIPHER options in any order. |\n\n \nREQUIRE CIPHER \'cipher\' | The account must use TLS, but no\nvalid X509 certificate is required. Also, the encryption\nused for the connection must use one of the methods\nspecified in the string cipher. This option implies REQUIRE\nSSL. This option can be combined with the ISSUER, and\nSUBJECT options in any order. | \n \nThe REQUIRE keyword must be used only once for all specified\noptions, and the AND keyword can be used to separate\nindividual options, but it is not required.\n \nFor example, you can alter a user account to require these\nTLS options with the following:\n \nALTER USER \'alice\'@\'%\'\n REQUIRE SUBJECT \'/CN=alice/O=My Dom,\nInc./C=US/ST=Oregon/L=Portland\'\n AND ISSUER \'/C=FI/ST=Somewhere/L=City/ O=Some\nCompany/CN=Peter Parker/emailAddress=p.parker@marvel.com\'\n AND CIPHER \'TLSv1.2\';\n \nIf any of these options are set for a specific user account,\nthen any client who tries to connect with that user account\nwill have to be configured to connect with TLS.\n \nSee Securing Connections for Client and Server for\ninformation on how to enable TLS on the client and server.\n \nResource Limit Options\n \nMariaDB 10.2.0 introduced a number of resource limit\noptions.\n \nIt is possible to set per-account limits for certain server\nresources. The following table shows the values that can be\nset per account:\n \nLimit Type | Decription | \n \nMAX_QUERIES_PER_HOUR | Number of statements that the account\ncan issue per hour (including updates) | \n \nMAX_UPDATES_PER_HOUR | Number of updates (not queries) that\nthe account can issue per hour | \n \nMAX_CONNECTIONS_PER_HOUR | Number of connections that the\naccount can start per hour | \n \nMAX_USER_CONNECTIONS | Number of simultaneous connections\nthat can be accepted from the same account; if it is 0,\nmax_connections will be used instead; if max_connections is\n0, there is no limit for this account\'s simultaneous\nconnections. | \n \nMAX_STATEMENT_TIME | Timeout, in seconds, for statements\nexecuted by the user. See also Aborting Statements that\nExceed a Certain Time to Execute. | \n \nIf any of these limits are set to 0, then there is no limit\nfor that resource for that user.\n \nHere is an example showing how to set an account\'s resource\nlimits:\n \nALTER USER \'someone\'@\'localhost\' WITH\n MAX_USER_CONNECTIONS 10\n MAX_QUERIES_PER_HOUR 200;\n \nThe resources are tracked per account, which means\n\'user\'@\'server\'; not per user name or per connection.\n \nThe count can be reset for all users using FLUSH\nUSER_RESOURCES, FLUSH PRIVILEGES or mysqladmin reload.\n \nPer account resource limits are stored in the user table, in\nthe mysql database. Columns used for resources limits are\nnamed max_questions, max_updates, max_connections (for\nMAX_CONNECTIONS_PER_HOUR), and max_user_connections (for\nMAX_USER_CONNECTIONS).\n \nPassword Expiry\n \nBesides automatic password expiry, as determined by\ndefault_password_lifetime, password expiry times can be set\non an individual user basis, overriding the global setting,\nfor example:\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE NEVER;\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n \nSee User Password Expiry for more details.\n \nAccount Locking\n \nAccount locking permits privileged administrators to\nlock/unlock user accounts. No new client connections will be\npermitted if an account is locked (existing connections are\nnot affected). For example:\n \nALTER USER \'marijn\'@\'localhost\' ACCOUNT LOCK;\n \nSee Account Locking for more details.\n \n\n\nURL: https://mariadb.com/kb/en/library/alter-user/','','https://mariadb.com/kb/en/library/alter-user/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (120,10,'DROP USER','Syntax\n------ \nDROP USER [IF EXISTS] user_name [, user_name] ...\n \nDescription\n----------- \nThe DROP USER statement removes one or more MariaDB\naccounts. It removes\nprivilege rows for the account from all grant tables. To use\nthis statement,\nyou must have the global CREATE USER privilege\nor the DELETE privilege for the mysql database.\nEach account is named using the same format as for the\nCREATE USER\nstatement; for example, \'jeffrey\'@\'localhost\'. If you\nspecify\nonly the user name part of the account name, a host name\npart of \'%\' is\nused. For additional information about specifying account\nnames, see\nCREATE USER.\n \nNote that, if you specify an account that is currently\nconnected, it will not\nbe deleted until the connection is closed. The connection\nwill not be\nautomatically closed.\n \nIf any of the specified user accounts do not exist, ERROR\n1396 (HY000)\nresults. If an error occurs, DROP USER will still drop the\naccounts that do\nnot result in an error. Only one error is produced for all\nusers which have not\nbeen dropped:\n \nERROR 1396 (HY000): Operation DROP USER failed for\n\'u1\'@\'%\',\'u2\'@\'%\'\n \nFailed CREATE or DROP operations, for both users and roles,\nproduce the\nsame error code.\n \nIF EXISTS\n \nThe IF EXISTS clause was added in MariaDB 10.1.3\n \nIf the IF EXISTS clause is used, MariaDB will return a note\ninstead of an error if the user does not exist.\n \nExamples\n-------- \nDROP USER bob;\n \nIF EXISTS:\n \nDROP USER bob;\n \nERROR 1396 (HY000): Operation DROP USER failed for\n\'bob\'@\'%\'\n \nDROP USER IF EXISTS bob;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+---------------------------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------------------------+\n| Note | 1974 | Can\'t drop user \'bob\'@\'%\'; it doesn\'t\nexist |\n+-------+------+---------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-user/','','https://mariadb.com/kb/en/library/drop-user/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (121,10,'GRANT','Syntax\n------ \nGRANT\n priv_type [(column_list)]\n [, priv_type [(column_list)]] ...\n ON [object_type] priv_level\n TO user_specification [ user_options ...]\n \nuser_specification:\n username [authentication_option]\n \nauthentication_option:\n IDENTIFIED BY \'password\' \n | IDENTIFIED BY PASSWORD \'password_hash\'\n | IDENTIFIED {VIA|WITH} authentication_rule [OR\nauthentication_rule ...]\n \nauthentication_rule:\n authentication_plugin\n | authentication_plugin {USING|AS}\n\'authentication_string\'\n | authentication_plugin {USING|AS} PASSWORD(\'password\')\n \nGRANT PROXY ON username\n TO username [, username] ...\n [WITH GRANT OPTION]\n \nuser_options:\n [REQUIRE {NONE | tls_option [[AND] tls_option] ...}]\n [WITH with_option [with_option] ...]\n \nobject_type:\n TABLE\n | FUNCTION\n | PROCEDURE\n \npriv_level:\n *\n | *.*\n | db_name.*\n | db_name.tbl_name\n | tbl_name\n | db_name.routine_name\n \nwith_option:\n GRANT OPTION\n | resource_option\n \nresource_option:\n MAX_QUERIES_PER_HOUR count\n | MAX_UPDATES_PER_HOUR count\n | MAX_CONNECTIONS_PER_HOUR count\n | MAX_USER_CONNECTIONS count\n | MAX_STATEMENT_TIME time\n \ntls_option:\n SSL \n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n \nDescription\n----------- \nThe GRANT statement allows you to grant privileges or roles\nto accounts. To use GRANT, you must have the GRANT OPTION\nprivilege, and you must have the privileges that you are\ngranting.\n \nUse the REVOKE statement to revoke privileges granted with\nthe GRANT statement.\n \nUse the SHOW GRANTS statement to determine what privileges\nan account has.\n \nAccount Names\n \nFor GRANT statements, account names are specified as the\nusername argument in the same way as they are for CREATE\nUSER statements. See account names from the CREATE USER page\nfor details on how account names are specified.\n \nImplicit Account Creation\n \nThe GRANT statement also allows you to implicitly create\naccounts in some cases.\n \nIf the account does not yet exist, then GRANT can implicitly\ncreate it. To implicitly create an account with GRANT, a\nuser is required to have the same privileges that would be\nrequired to explicitly create the account with the CREATE\nUSER statement.\n \nIf the NO_AUTO_CREATE_USER SQL_MODE is set, then accounts\ncan only be created if authentication information is\nspecified, or with a CREATE USER statement. If no\nauthentication information is provided, GRANT will produce\nan error when the specified account does not exist, for\nexample:\n \nshow variables like \'%sql_mode%\' ;\n+---------------+--------------------------------------------+\n| Variable_name | Value |\n+---------------+--------------------------------------------+\n| sql_mode | NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |\n+---------------+--------------------------------------------+\n \nGRANT USAGE ON *.* TO \'user123\'@\'%\' IDENTIFIED BY \'\';\nERROR 1133 (28000): Can\'t find any matching row in the user\ntable\n \nGRANT USAGE ON *.* TO \'user123\'@\'%\' IDENTIFIED VIA PAM\nusing \'mariadb\' require ssl ;\nQuery OK, 0 rows affected (0.00 sec)\n \nselect host, user from mysql.user where user=\'user123\' ;\n \n+------+----------+\n| host | user |\n+------+----------+\n| % | user123 |\n+------+----------+\n \nPrivilege Levels\n \nPrivileges can be set globally, for an entire database, for\na table or routine,\nor for individual columns in a table. Certain privileges can\nonly be set at\ncertain levels.\nGlobal privileges are granted using *.* for\npriv_level. Global privileges include privileges to\nadminister the database\nand manage user accounts, as well as privileges for all\ntables, functions, and\nprocedures. Global privileges are stored in the mysql.user\ntable.\nDatabase privileges are granted using db_name.*\nfor priv_level, or using just * to use default database.\nDatabase\nprivileges include privileges to create tables and\nfunctions, as well as\nprivileges for all tables, functions, and procedures in the\ndatabase. Database privileges are stored in the mysql.db\ntable.\nTable privileges are granted using db_name.tbl_name\nfor priv_level, or using just tbl_name to specify a table in\nthe default\ndatabase. The TABLE keyword is optional. Table privileges\ninclude the\nability to select and change data in the table. Certain\ntable privileges can\nbe granted for individual columns.\nColumn privileges are granted by specifying a table for\npriv_level and providing a column list after the privilege\ntype. They allow\nyou to control exactly which columns in a table users can\nselect and change.\nFunction privileges are granted using FUNCTION\ndb_name.routine_name\nfor priv_level, or using just FUNCTION routine_name to\nspecify a function\nin the default database.\nProcedure privileges are granted using PROCEDURE\ndb_name.routine_name\nfor priv_level, or using just PROCEDURE routine_name to\nspecify a procedure\nin the default database.\n \nThe USAGE Privilege\n \nThe USAGE privilege grants no real privileges. The SHOW\nGRANTS\nstatement will show a global USAGE privilege for a\nnewly-created user. You\ncan use USAGE with the GRANT statement to change options\nlike GRANT OPTION\nand MAX_USER_CONNECTIONS without changing any account\nprivileges.\n \nThe ALL PRIVILEGES Privilege\n \nThe ALL PRIVILEGES privilege grants all available\nprivileges. Granting all\nprivileges only affects the given privilege level. For\nexample, granting all\nprivileges on a table does not grant any privileges on the\ndatabase or globally.\n \nUsing ALL PRIVILEGES does not grant the special GRANT OPTION\nprivilege.\n \nYou can use ALL instead of ALL PRIVILEGES.\n \nThe GRANT OPTION Privilege\n \nUse the WITH GRANT OPTION clause to give users the ability\nto grant privileges\nto other users at the given privilege level. Users with the\nGRANT OPTION privilege can\nonly grant privileges they have. They cannot grant\nprivileges at a higher privilege level than\nthey have the GRANT OPTION privilege.\n \nThe GRANT OPTION privilege cannot be set for individual\ncolumns.\nIf you use WITH GRANT OPTION when specifying column\nprivileges,\nthe GRANT OPTION privilege will be granted for the entire\ntable.\n \nUsing the WITH GRANT OPTION clause is equivalent to listing\nGRANT OPTION\nas a privilege.\n \nGlobal Privileges\n \nThe following table lists the privileges that can be granted\nglobally. You can\nalso grant all database, table, and function privileges\nglobally. When granted\nglobally, these privileges apply to all databases, tables,\nor functions,\nincluding those created later.\n \nTo set a global privilege, use *.* for priv_level.\n \nPrivilege | Description | \n \nCREATE USER | Create a user using the CREATE USER statement,\nor implicitly create a user with the GRANT statement. | \n \nFILE | Read and write files on the server, using statements\nlike LOAD DATA INFILE or functions like LOAD_FILE(). Also\nneeded to create CONNECT outward tables. MariaDB server must\nhave the permissions to access those files. | \n \nGRANT OPTION | Grant global privileges. You can only grant\nprivileges that you have. | \n \nPROCESS | Show information about the active processes, via\nSHOW PROCESSLIST or mysqladmin processlist. | \n \nRELOAD | Execute FLUSH statements or equivalent mysqladmin\ncommands. | \n \nREPLICATION CLIENT | Execute SHOW MASTER STATUS and SHOW\nSLAVE STATUS informative statements. | \n \nREPLICATION SLAVE | Accounts used by slave servers on the\nmaster need this privilege. This is needed to get the\nupdates made on the master. | \n \nSHOW DATABASES | List all databases using the SHOW DATABASES\nstatement. Without the SHOW DATABASES privilege, you can\nstill issue the SHOW DATABASES statement, but it will only\nlist databases containing tables on which you have\nprivileges. | \n \nSHUTDOWN | Shut down the server using SHUTDOWN or the\nmysqladmin shutdown command. | \n \nSUPER | Execute superuser statements: CHANGE MASTER TO, KILL\n(users who do not have this privilege can only KILL their\nown threads), PURGE LOGS, SET global system variables, or\nthe mysqladmin debug command. Also, this permission allows\nthe user to write data even if the read_only startup option\nis set, enable or disable logging, enable or disable\nreplication on slaves, specify a DEFINER for statements that\nsupport that clause, connect once after reaching the\nMAX_CONNECTIONS. If a statement has been specified for the\ninit-connect mysqld option, that command will not be\nexecuted when a user with SUPER privileges connects to the\nserver. | \n \nDatabase Privileges\n \nThe following table lists the privileges that can be granted\nat the database\nlevel. You can also grant all table and function privileges\nat the database\nlevel. Table and function privileges on a database apply to\nall tables or\nfunctions in that database, including those created later.\n \nTo set a privilege for a database, specify the database\nusing\ndb_name.* for priv_level, or just use *\nto specify the default database.\n \nPrivilege | Description | \n \nCREATE | Create a database using the CREATE DATABASE\nstatement, when the privilege is granted for a database. You\ncan grant the CREATE privilege on databases that do not yet\nexist. This also grants the CREATE privilege on all tables\nin the database. | \n \nCREATE ROUTINE | Create Stored Programs using the CREATE\nPROCEDURE and CREATE FUNCTION statements. | \n \nCREATE TEMPORARY TABLES | Create temporary tables with the\nCREATE TEMPORARY TABLE statement. This privilege enable\nwriting and dropping those temporary tables | \n \nDROP | Drop a database using the DROP DATABASE statement,\nwhen the privilege is granted for a database. This also\ngrants the DROP privilege on all tables in the database. | \n \nEVENT | Create, drop and alter EVENTs. Added in MySQL 5.1.6.\n| \n \nGRANT OPTION | Grant database privileges. You can only grant\nprivileges that you have. | \n \nLOCK TABLES | Acquire explicit locks using the LOCK TABLES\nstatement; you also need to have the SELECT privilege on a\ntable, in order to lock it. | \n \nTable Privileges\n \nPrivilege | Description | \n \nALTER | Change the structure of an existing table using the\nALTER TABLE statement. | \n \nCREATE | Create a table using the CREATE TABLE statement.\nYou can grant the CREATE privilege on tables that do not yet\nexist. | \n \nCREATE VIEW | Create a view using the CREATE_VIEW statement.\n| \n \nDELETE | Remove rows from a table using the DELETE\nstatement. | \n \nDELETE HISTORY | Remove historical rows from a table using\nthe DELETE HISTORY statement. Displays as DELETE VERSIONING\nROWS when running SHOW GRANTS (MDEV-17655). From MariaDB\n10.3.4. From MariaDB 10.3.5, if a user has the SUPER\nprivilege but not this privilege, running mysql_upgrade will\ngrant this privilege as well. | \n \nDROP | Drop a table using the DROP TABLE statement or a view\nusing the DROP VIEW statement. Also required to execute the\nTRUNCATE TABLE statement. | \n \nGRANT OPTION | Grant table privileges. You can only grant\nprivileges that you have. | \n \nINDEX | Create an index on a table using the CREATE INDEX\nstatement. Without the INDEX privilege, you can still create\nindexes when creating a table using the CREATE TABLE\nstatement if the you have the CREATE privilege, and you can\ncreate indexes using the ALTER TABLE statement if you have\nthe ALTER privilege. | \n \nINSERT | Add rows to a table using the INSERT statement. The\nINSERT privilege can also be set on individual columns; see\nColumn Privileges below for details. | \n \nREFERENCES | Unused. | \n \nSELECT | Read data from a table using the SELECT statement.\nThe SELECT privilege can also be set on individual columns;\nsee Column Privileges below for details. | \n \nSHOW VIEW | Show the CREATE VIEW statement to create a view\nusing the SHOW CREATE VIEW statement. | \n \nTRIGGER | Execute triggers associated to tables you update,\nexecute the CREATE TRIGGER and DROP TRIGGER statements. You\nwill still be able to see triggers. | \n \nUPDATE | Update existing rows in a table using the UPDATE\nstatement. UPDATE statements usually include a WHERE clause\nto update only certain rows. You must have SELECT privileges\non the table or the appropriate columns for the WHERE\nclause. The UPDATE privilege can also be set on individual\ncolumns; see Column Privileges below for details. | \n \nColumn Privileges\n \nSome table privileges can be set for individual columns of a\ntable. To use\ncolumn privileges, specify the table explicitly and provide\na list of column\nnames after the privilege type. For example, the following\nstatement would allow\nthe user to read the names and positions of employees, but\nnot other information\nfrom the same table, such as salaries.\n \nGRANT SELECT (name, position) on Employee to\n\'jeffrey\'@\'localhost\';\n \nPrivilege | Description | \n \nINSERT (column_list) | Add rows specifying values in columns\nusing the INSERT statement. If you only have column-level\nINSERT privileges, you must specify the columns you are\nsetting in the INSERT statement. All other columns will be\nset to their default values, or NULL. | \n \nREFERENCES (column_list) | Unused. | \n \nSELECT (column_list) | Read values in columns using the\nSELECT statement. You cannot access or query any columns for\nwhich you do not have SELECT privileges, including in WHERE,\nON, GROUP BY, and ORDER BY clauses. | \n \nUPDATE (column_list) | Update values in columns of existing\nrows using the UPDATE statement. UPDATE statements usually\ninclude a WHERE clause to update only certain rows. You must\nhave SELECT privileges on the table or the appropriate\ncolumns for the WHERE clause. | \n \nFunction Privileges\n \nPrivilege | Description | \n \nALTER ROUTINE | Change the characteristics of a stored\nfunction using the ALTER FUNCTION statement. | \n \nEXECUTE | Use a stored function. You need SELECT privileges\nfor any tables or columns accessed by the function. | \n \nGRANT OPTION | Grant function privileges. You can only grant\nprivileges that you have. | \n \nProcedure Privileges\n \nPrivilege | Description | \n \nALTER ROUTINE | Change the characteristics of a stored\nprocedure using the ALTER PROCEDURE statement. | \n \nEXECUTE | Execute a stored procedure using the CALL\nstatement. The privilege to call a procedure may allow you\nto perform actions you wouldn\'t otherwise be able to do,\nsuch as insert rows into a table. | \n \nGRANT OPTION | Grant procedure privileges. You can only\ngrant privileges that you have. | \n \nProxy Privileges\n \nPrivilege | Description | \n \nPROXY | Permits one user to be a proxy for another. | \n \nThe PROXY privilege allows one user to proxy as another\nuser, which means their privileges change to that of the\nproxy user, and the CURRENT_USER() function returns the user\nname of the proxy user.\n \nThe PROXY privilege only works with authentication plugins\nthat support it. The default mysql_native_password\nauthentication plugin does not support proxy users.\n \nThe pam authentication plugin is the only plugin included\nwith MariaDB that currently supports proxy users. The PROXY\nprivilege is commonly used with the pam authentication\nplugin to enable user and group mapping with PAM.\n \nFor example, to grant the PROXY privilege to an anonymous\naccount that authenticates with the pam authentication\nplugin, you could execute the following:\n \nCREATE USER \'dba\'@\'%\' IDENTIFIED BY \'strongpassword\';\n \nGRANT ALL PRIVILEGES ON *.* TO \'dba\'@\'%\' ;\n \nCREATE USER \'\'@\'%\' IDENTIFIED VIA pam USING \'mariadb\';\n \nGRANT PROXY ON \'dba\'@\'%\' TO \'\'@\'%\';\n \nA user account can only grant the PROXY privilege for a\nspecific user account if the granter also has the PROXY\nprivilege for that specific user account, and if that\nprivilege is defined WITH GRANT OPTION. For example, the\nfollowing example fails because the granter does not have\nthe PROXY privilege for that specific user account at all:\n \nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n \nSHOW GRANTS;\n \n+-----------------------------------------------------------------------------------------------------------------------+\n| Grants for alice@localhost |\n+-----------------------------------------------------------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\'\nIDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' |\n+-----------------------------------------------------------------------------------------------------------------------+\n \nGRANT PROXY ON \'dba\'@\'localhost\' TO\n\'bob\'@\'localhost\';\n \nERROR 1698 (28000): Access denied for user\n\'alice\'@\'localhost\'\n \nAnd the following example fails because the granter does\nhave the PROXY privilege for that specific user account, but\nit is not defined WITH GRANT OPTION:\n \nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n \nSHOW GRANTS;\n \n+-----------------------------------------------------------------------------------------------------------------------+\n| Grants for alice@localhost |\n+-----------------------------------------------------------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\'\nIDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' |\n| GRANT PROXY ON \'dba\'@\'localhost\' TO\n\'alice\'@\'localhost\' |\n+-----------------------------------------------------------------------------------------------------------------------+\n \nMariaDB [(none)]> GRANT PROXY ON \'dba\'@\'localhost\' TO\n\'bob\'@\'localhost\';\n \nERROR 1698 (28000): Access denied for user\n\'alice\'@\'localhost\'\n \nBut the following example succeeds because the granter does\nhave the PROXY privilege for that specific user account, and\nit is defined WITH GRANT OPTION:\n \nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n \nSHOW GRANTS;\n \n+-----------------------------------------------------------------------------------------------------------------------------------------+\n| Grants for alice@localhost |\n+-----------------------------------------------------------------------------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\'\nIDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' WITH GRANT\nOPTION |\n| GRANT PROXY ON \'dba\'@\'localhost\' TO\n\'alice\'@\'localhost\' WITH GRANT OPTION |\n+-----------------------------------------------------------------------------------------------------------------------------------------+\n \nGRANT PROXY ON \'dba\'@\'localhost\' TO\n\'bob\'@\'localhost\';\n \nQuery OK, 0 rows affected (0.004 sec)\n \nA user account can grant the PROXY privilege for any other\nuser account if the granter has the PROXY privilege for the\n\'\'@\'%\' anonymous user account, like this:\n \nGR','','https://mariadb.com/kb/en/library/grant/'); -update help_topic set description = CONCAT(description, 'ANT PROXY ON \'\'@\'%\' TO \'dba\'@\'localhost\' WITH\nGRANT OPTION;\n \nFor example, the following example succeeds because the user\ncan grant the PROXY privilege for any other user account:\n \nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n \nSHOW GRANTS;\n \n+-----------------------------------------------------------------------------------------------------------------------------------------+\n| Grants for alice@localhost |\n+-----------------------------------------------------------------------------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\'\nIDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' WITH GRANT\nOPTION |\n| GRANT PROXY ON \'\'@\'%\' TO \'alice\'@\'localhost\' WITH\nGRANT OPTION |\n+-----------------------------------------------------------------------------------------------------------------------------------------+\n \nGRANT PROXY ON \'app1_dba\'@\'localhost\' TO\n\'bob\'@\'localhost\';\n \nQuery OK, 0 rows affected (0.004 sec)\n \nGRANT PROXY ON \'app2_dba\'@\'localhost\' TO\n\'carol\'@\'localhost\';\n \nQuery OK, 0 rows affected (0.004 sec)\n \nThe default root user accounts created by mysql_install_db\nhave this privilege. For example:\n \nGRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH\nGRANT OPTION;\n \nGRANT PROXY ON \'\'@\'%\' TO \'root\'@\'localhost\' WITH\nGRANT OPTION;\n \nThis allows the default root user accounts to grant the\nPROXY privilege for any other user account, and it also\nallows the default root user accounts to grant others the\nprivilege to do the same.\n \nAuthentication Options\n \nThe authentication options for the GRANT statement are the\nsame as those for the CREATE USER statement.\n \nIDENTIFIED BY \'password\'\n \nThe optional IDENTIFIED BY clause can be used to provide an\naccount with a password. The password should be specified in\nplain text. It will be hashed by the PASSWORD function prior\nto being stored to the mysql.user table.\n \nFor example, if our password is mariadb, then we can create\nthe user with:\n \nGRANT USAGE ON *.* TO foo2@test IDENTIFIED BY \'mariadb\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nIf the user account already exists and if you provide the\nIDENTIFIED BY clause, then the user\'s password will be\nchanged. You must have the privileges needed for the SET\nPASSWORD\nstatement to change a user\'s password with GRANT.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED BY PASSWORD \'password_hash\'\n \nThe optional IDENTIFIED BY PASSWORD clause can be used to\nprovide an account with a password that has already been\nhashed. The password should be specified as a hash that was\nprovided by the PASSWORD function. It will be stored to the\nmysql.user table as-is.\n \nFor example, if our password is mariadb, then we can find\nthe hash with:\n \nSELECT PASSWORD(\'mariadb\');\n+-------------------------------------------+\n| PASSWORD(\'mariadb\') |\n+-------------------------------------------+\n| *54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n1 row in set (0.00 sec)\n \nAnd then we can create a user with the hash:\n \nGRANT USAGE ON *.* TO foo2@test IDENTIFIED BY PASSWORD\n\'*54958E764CE10E50764C2EECBB71D01F08549980\';\n \nIf you do not specify a password with the IDENTIFIED BY\nclause, the user\nwill be able to connect without a password. A blank password\nis not a wildcard\nto match any password. The user must connect without\nproviding a password if no\npassword is set.\n \nIf the user account already exists and if you provide the\nIDENTIFIED BY clause, then the user\'s password will be\nchanged. You must have the privileges needed for the SET\nPASSWORD\nstatement to change a user\'s password with GRANT.\n \nThe only authentication plugins that this clause supports\nare mysql_native_password and mysql_old_password.\n \nIDENTIFIED {VIA|WITH} authentication_plugin\n \nThe optional IDENTIFIED VIA authentication_plugin allows you\nto specify that the account should be authenticated by a\nspecific authentication plugin. The plugin name must be an\nactive authentication plugin as per SHOW PLUGINS. If it\ndoesn\'t show up in that output, then you will need to\ninstall it with INSTALL PLUGIN or INSTALL SONAME.\n \nFor example, this could be used with the PAM authentication\nplugin:\n \nGRANT USAGE ON *.* TO foo2@test IDENTIFIED VIA pam;\n \nSome authentication plugins allow additional arguments to be\nspecified after a USING or AS keyword. For example, the PAM\nauthentication plugin accepts a service name:\n \nGRANT USAGE ON *.* TO foo2@test IDENTIFIED VIA pam USING\n\'mariadb\';\n \nThe exact meaning of the additional argument would depend on\nthe specific authentication plugin.\n \nThe USING or AS keyword can also be used to provide a\nplain-text password to a plugin if it\'s provided as an\nargument to the PASSWORD() function. This is only valid for\nauthentication plugins that have implemented a hook for the\nPASSWORD() function. For example, the ed25519 authentication\nplugin supports this:\n \nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 USING\nPASSWORD(\'secret\');\n \nOne can specify many authentication plugins, they all works\nas alternatives ways of authenticating a user:\n \nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 USING\nPASSWORD(\'secret\') OR unix_socket;\n \nResource Limit Options\n \nMariaDB 10.2.0 introduced a number of resource limit\noptions.\n \nIt is possible to set per-account limits for certain server\nresources. The following table shows the values that can be\nset per account:\n \nLimit Type | Decription | \n \nMAX_QUERIES_PER_HOUR | Number of statements that the account\ncan issue per hour (including updates) | \n \nMAX_UPDATES_PER_HOUR | Number of updates (not queries) that\nthe account can issue per hour | \n \nMAX_CONNECTIONS_PER_HOUR | Number of connections that the\naccount can start per hour | \n \nMAX_USER_CONNECTIONS | Number of simultaneous connections\nthat can be accepted from the same account; if it is 0,\nmax_connections will be used instead; if max_connections is\n0, there is no limit for this account\'s simultaneous\nconnections. | \n \nMAX_STATEMENT_TIME | Timeout, in seconds, for statements\nexecuted by the user. See also Aborting Statements that\nExceed a Certain Time to Execute. | \n \nIf any of these limits are set to 0, then there is no limit\nfor that resource for that user.\n \nTo set resource limits for an account, if you do not want to\nchange that account\'s privileges, you can issue a GRANT\nstatement with the USAGE privilege, which has no meaning.\nThe statement can name some or all limit types, in any\norder.\n \nHere is an example showing how to set resource limits:\n \nGRANT USAGE ON *.* TO \'someone\'@\'localhost\' WITH\n MAX_USER_CONNECTIONS 0\n MAX_QUERIES_PER_HOUR 200;\n \nThe resources are tracked per account, which means\n\'user\'@\'server\'; not per user name or per connection.\n \nThe count can be reset for all users using FLUSH\nUSER_RESOURCES, FLUSH PRIVILEGES or mysqladmin reload.\n \nPer account resource limits are stored in the user table, in\nthe mysql database. Columns used for resources limits are\nnamed max_questions, max_updates, max_connections (for\nMAX_CONNECTIONS_PER_HOUR), and max_user_connections (for\nMAX_USER_CONNECTIONS).\n \nTLS Options\n \nBy default, MariaDB transmits data between the server and\nclients without encrypting it. This is generally acceptable\nwhen the server and client run on the same host or in\nnetworks where security is guaranteed through other means.\nHowever, in cases where the server and client exist on\nseparate networks or they are in a high-risk network, the\nlack of encryption does introduce security concerns as a\nmalicious actor could potentially eavesdrop on the traffic\nas it is sent over the network between them.\n \nTo mitigate this concern, MariaDB allows you to encrypt data\nin transit between the server and clients using the\nTransport Layer Security (TLS) protocol. TLS was formerly\nknown as Secure Socket Layer (SSL), but strictly speaking\nthe SSL protocol is a predecessor to TLS and, that version\nof the protocol is now considered insecure. The\ndocumentation still uses the term SSL often and for\ncompatibility reasons TLS-related server system and status\nvariables still use the prefix ssl_, but internally, MariaDB\nonly supports its secure successors.\n \nSee Secure Connections Overview for more information about\nhow to determine whether your MariaDB server has TLS\nsupport.\n \nYou can set certain TLS-related restrictions for specific\nuser accounts. For instance, you might use this with user\naccounts that require access to sensitive data while sending\nit across networks that you do not control. These\nrestrictions can be enabled for a user account with the\nCREATE USER, ALTER USER, or GRANT statements. The following\noptions are available:\n \nOption | Description | \n \nREQUIRE NONE | TLS is not required for this account, but can\nstill be used. | \n \nREQUIRE SSL | The account must use TLS, but no valid X509\ncertificate is required. This option cannot be combined with\nother TLS options. | \n \nREQUIRE X509 | The account must use TLS and must have a\nvalid X509 certificate. This option implies REQUIRE SSL.\nThis option cannot be combined with other TLS options. | \n \nREQUIRE ISSUER \'issuer\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the Certificate\nAuthority must be the one specified via the string issuer.\nThis option implies REQUIRE X509. This option can be\ncombined with the SUBJECT, and CIPHER options in any order.\n| \n \nREQUIRE SUBJECT \'subject\' | The account must use TLS and\nmust have a valid X509 certificate. Also, the certificate\'s\nSubject must be the one specified via the string subject.\nThis option implies REQUIRE X509. This option can be\ncombined with the ISSUER, and CIPHER options in any order. |\n\n \nREQUIRE CIPHER \'cipher\' | The account must use TLS, but no\nvalid X509 certificate is required. Also, the encryption\nused for the connection must use one of the methods\nspecified in the string cipher. This option implies REQUIRE\nSSL. This option can be combined with the ISSUER, and\nSUBJECT options in any order. | \n \nThe REQUIRE keyword must be used only once for all specified\noptions, and the AND keyword can be used to separate\nindividual options, but it is not required.\n \nFor example, you can create a user account that requires\nthese TLS options with the following:\n \nGRANT USAGE ON *.* TO \'alice\'@\'%\'\n REQUIRE SUBJECT \'/CN=alice/O=My Dom,\nInc./C=US/ST=Oregon/L=Portland\'\n AND ISSUER \'/C=FI/ST=Somewhere/L=City/ O=Some\nCompany/CN=Peter Parker/emailAddress=p.parker@marvel.com\'\n AND CIPHER \'TLSv1.2\';\n \nIf any of these options are set for a specific user account,\nthen any client who tries to connect with that user account\nwill have to be configured to connect with TLS.\n \nSee Securing Connections for Client and Server for\ninformation on how to enable TLS on the client and server.\n \nRoles\n \nRoles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nGRANT role TO grantee [, grantee2 ... ]\n[ WITH ADMIN OPTION ]\n \nThe GRANT statement is also used to grant the use a role to\none or more users or other roles. In order to be able to\ngrant a role, the grantor doing so must have permission to\ndo so (see WITH ADMIN in the CREATE ROLE article).\n \nSpecifying the WITH ADMIN OPTION permits the grantee to in\nturn grant the role to another.\n \nFor example, the following commands show how to grant the\nsame role to a couple different users.\n \nGRANT journalist TO hulda;\n \nGRANT journalist TO berengar WITH ADMIN OPTION;\n \nIf a user has been granted a role, they do not automatically\nobtain all permissions associated with that role. These\npermissions are only in use when the user activates the role\nwith the SET ROLE statement.\n \nGrant Examples\n \nGranting Root-like Privileges\n \nYou can create a user that has privileges similar to the\ndefault root accounts by executing the following:\n \nCREATE USER \'alexander\'@\'localhost\';\n \nGRANT ALL PRIVILEGES ON *.* to \'alexander\'@\'localhost\'\nWITH GRANT OPTION;\n \n\n\nURL: https://mariadb.com/kb/en/library/grant/') WHERE help_topic_id = 121; -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (122,10,'User Password Expiry','User password expiry was introduced in MariaDB 10.4.3.\n \nPassword expiry permits administrators to expire user\npasswords, either manually or automatically. \n \nSystem Variables\n \nThere are two system variables which affect password expiry:\ndefault_password_lifetime, which determines the amount of\ntime between requiring the user to change their password. 0,\nthe default, means automatic password expiry is not active.\n \nThe second variable, disconnect_on_expired_password\ndetermines whether a client is permitted to connect if their\npassword has expired, or whether they are permitted to\nconnect in sandbox mode, able to perform a limited subset of\nqueries related to resetting the password, in particular SET\nPASSWORD and SET.\n \nSetting a Password Expiry Limit for a User\n \nBesides automatic password expiry, as determined by\ndefault_password_lifetime, password expiry times can be set\non an individual user basis, overriding the global using the\nCREATE USER or ALTER USER statements, for example:\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nLimits can be disabled by use of the NEVER keyword, for\nexample:\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE NEVER;\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE NEVER;\n \nA manually set limit can be restored the system default by\nuse of DEFAULT, for example:\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n \nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n \nSHOW CREATE USER\n \nThe SHOW CREATE USER statement will display information\nabout the password expiry status of the user. Unlike MySQL,\nit will not display if the user is unlocked, or if the\npassword expiry is set to default.\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nCREATE USER \'konstantin\'@\'localhost\' PASSWORD EXPIRE\nNEVER;\n \nCREATE USER \'amse\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n \nSHOW CREATE USER \'monty\'@\'localhost\';\n \n+------------------------------------------------------------------+\n| CREATE USER for monty@localhost |\n+------------------------------------------------------------------+\n| CREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE\nINTERVAL 120 DAY |\n+------------------------------------------------------------------+\n \nSHOW CREATE USER \'konstantin\'@\'localhost\';\n \n+------------------------------------------------------------+\n| CREATE USER for konstantin@localhost |\n+------------------------------------------------------------+\n| CREATE USER \'konstantin\'@\'localhost\' PASSWORD EXPIRE\nNEVER |\n+------------------------------------------------------------+\n \nSHOW CREATE USER \'amse\'@\'localhost\';\n \n+--------------------------------+\n| CREATE USER for amse@localhost |\n+--------------------------------+\n| CREATE USER \'amse\'@\'localhost\' |\n+--------------------------------+\n \n--connect-expired-password Client Option\n \nThe mysql client --connect-expired-password option notifies\nthe server that the client is prepared to handle expired\npassword sandbox mode (even if the --batch option was\nspecified).\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/user-password-expiry/','','https://mariadb.com/kb/en/library/user-password-expiry/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (123,10,'RENAME USER','Syntax\n------ \nRENAME USER old_user TO new_user\n [, old_user TO new_user] ...\n \nDescription\n----------- \nThe RENAME USER statement renames existing MariaDB accounts.\nTo use it,\nyou must have the global CREATE USER privilege\nor the UPDATE privilege for the mysql database.\nEach account is named using the same format as for the\nCREATE USER\nstatement; for example, \'jeffrey\'@\'localhost\'.\nIf you specify only the user name part of the account name,\na host\nname part of \'%\' is used.\n \nIf any of the old user accounts do not exist or any of the\nnew user accounts already\nexist, ERROR 1396 (HY000) results. If an error occurs,\nRENAME USER\nwill still rename the accounts that do not result in an\nerror.\n \nExamples\n-------- \nCREATE USER \'donald\', \'mickey\';\n \nRENAME USER \'donald\' TO \'duck\'@\'localhost\', \'mickey\'\nTO \'mouse\'@\'localhost\';\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/rename-user/','','https://mariadb.com/kb/en/library/rename-user/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (124,10,'REVOKE','Privileges\n \nSyntax\n------ \nREVOKE \n priv_type [(column_list)]\n [, priv_type [(column_list)]] ...\n ON [object_type] priv_level\n FROM user [, user] ...\n \nREVOKE ALL PRIVILEGES, GRANT OPTION\n FROM user [, user] ...\n \nDescription\n----------- \nThe REVOKE statement enables system administrators to revoke\nprivileges (or roles - see section below) from MariaDB\naccounts. Each account is named using the same format\nas for the GRANT statement; for example,\n\'jeffrey\'@\'localhost\'. If you specify only the user name\npart\nof the account name, a host name part of \'%\' is used. For\ndetails on the levels at which privileges exist, the\nallowable\npriv_type and priv_level values, and the\nsyntax for specifying users and passwords, see GRANT.\n \nTo use the first REVOKE syntax, you must have the\nGRANT OPTION privilege, and you must have the privileges\nthat\nyou are revoking.\n \nTo revoke all privileges, use the second syntax, which drops\nall\nglobal, database, table, column, and routine privileges for\nthe named\nuser or users:\n \nREVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...\n \nTo use this REVOKE syntax, you must have the global\nCREATE USER privilege or the\nUPDATE privilege for the mysql database. See\nGRANT.\n \nExamples\n-------- \nREVOKE SUPER ON *.* FROM \'alexander\'@\'localhost\';\n \nRoles\n \nRoles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nREVOKE role [, role ...]\n FROM grantee [, grantee2 ... ]\n \nDescription\n----------- \nREVOKE is also used to remove a role from a user or another\nrole that it\'s previously been assigned to. If a role has\npreviously been set as a default role, REVOKE does not\nremove the record of the default role from the mysql.user\ntable. If the role is subsequently granted again, it will\nagain be the user\'s default. Use SET DEFAULT ROLE NONE to\nexplicitly remove this.\n \nBefore MariaDB 10.1.13, the REVOKE role statement was not\npermitted in prepared statements.\n \nExample\n \nREVOKE journalist FROM hulda\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/revoke/','','https://mariadb.com/kb/en/library/revoke/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (125,10,'SET PASSWORD','Syntax\n------ \nSET PASSWORD [FOR user] =\n {\n PASSWORD(\'some password\')\n | OLD_PASSWORD(\'some password\')\n | \'encrypted password\'\n }\n \nDescription\n----------- \nThe SET PASSWORD statement assigns a password to an existing\nMariaDB user\naccount.\n \nIf the password is specified using the PASSWORD() or\nOLD_PASSWORD()\nfunction, the literal text of the password should be given.\nIf the\npassword is specified without using either function, the\npassword\nshould be the already-encrypted password value as returned\nby\nPASSWORD().\n \nOLD_PASSWORD() should only be used if your MariaDB/MySQL\nclients are very old (< 4.0.0).\n \nWith no FOR clause, this statement sets the password for the\ncurrent\nuser. Any client that has connected to the server using a\nnon-anonymous\naccount can change the password for that account.\n \nWith a FOR clause, this statement sets the password for a\nspecific\naccount on the current server host. Only clients that have\nthe UPDATE\nprivilege for the mysql database can do this. The user value\nshould be\ngiven in user_name@host_name format, where user_name and\nhost_name are\nexactly as they are listed in the User and Host columns of\nthe\nmysql.user table entry. \n \nThe argument to PASSWORD() and the password given to MariaDB\nclients can be of arbitrary length.\n \nAuthentication Plugin Support\n \nIn MariaDB 10.4 and later, SET PASSWORD (with or without\nPASSWORD()) works for accounts authenticated via any\nauthentication plugin that supports passwords stored in the\nmysql.global_priv table.\n \nThe ed25519, mysql_native_password, and mysql_old_password\nauthentication plugins store passwords in the\nmysql.global_priv table.\n \nIf you run SET PASSWORD on an account that authenticates\nwith one of these authentication plugins that stores\npasswords in the mysql.global_priv table, then the\nPASSWORD() function is evaluated by the specific\nauthentication plugin used by the account. The\nauthentication plugin hashes the password with a method that\nis compatible with that specific authentication plugin.\n \nThe unix_socket, named_pipe, gssapi, and pam authentication\nplugins do not store passwords in the mysql.global_priv\ntable. These authentication plugins rely on other methods to\nauthenticate the user.\n \nIf you attempt to run SET PASSWORD on an account that\nauthenticates with one of these authentication plugins that\ndoesn\'t store a password in the mysql.global_priv table,\nthen MariaDB Server will raise a warning like the following:\n \nSET PASSWORD is ignored for users authenticating via\nunix_socket plugin\n \nSee Authentication from MariaDB 10.4 for an overview of\nauthentication changes in MariaDB 10.4.\n \nMariaDB until 10.3\n \nIn MariaDB 10.3 and before, SET PASSWORD (with or without\nPASSWORD()) only works for accounts authenticated via\nmysql_native_password or mysql_old_password authentication\nplugins\n \nPasswordless User Accounts\n \nUser accounts do not always require passwords to login.\n \nThe unix_socket and named_pipe authentication plugins do not\nrequire a password to authenticate the user.\n \nThe gssapi and pam authentication plugins may or may not\nrequire a password to authenticate the user, depending on\nthe specific configuration.\n \nThe mysql_native_password and mysql_old_password\nauthentication plugins require passwords for authentication,\nbut the password can be blank. In that case, no password is\nrequired.\n \nIf you provide a password while attempting to log into the\nserver as an account that doesn\'t require a password, then\nMariaDB server will simply ignore the password.\n \nIn MariaDB 10.4 and later, a user account can be defined to\nuse multiple authentication plugins in a specific order of\npreference. This specific scenario may be more noticeable in\nthese versions, since an account could be associated with\nsome authentication plugins that require a password, and\nsome that do not.\n \nExample\n \nFor example, if you had an entry with User and\nHost column values of \'bob\' and \n\'%.loc.gov\', you would write the\nstatement like this:\n \nSET PASSWORD FOR \'bob\'@\'%.loc.gov\' =\nPASSWORD(\'newpass\');\n \n\n\nURL: https://mariadb.com/kb/en/library/set-password/','','https://mariadb.com/kb/en/library/set-password/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (126,10,'Roles Overview','Roles were introduced in MariaDB 10.0.5.\n \nDescription\n----------- \nA role bundles a number of privileges together. It assists\nlarger organizations where, typically, a number of users\nwould have the same privileges, and, previously, the only\nway to change the privileges for a group of users was by\nchanging each user\'s privileges individually. \n \nAlternatively, multiple external users could have been\nassigned the same user, and there would have been no way to\nsee which actual user was responsible for which action.\n \nWith roles, managing this is easy. For example, there could\nbe a number of users assigned to a journalist role, with\nidentical privileges. Changing the privileges for all the\njournalists is a matter of simply changing the role\'s\nprivileges, while the individual user is still linked with\nany changes that take place.\n \nRoles are created with the CREATE ROLE statement, and\ndropped with the DROP ROLE statement. Roles are then\nassigned to a user with an extension to the GRANT statement,\nwhile privileges are assigned to a role in the regular way\nwith GRANT. Similarly, the REVOKE statement can be used to\nboth revoke a role from a user, or revoke a privilege from a\nrole.\n \nOnce a user has connected, he can obtain all privileges\nassociated with a role by setting a role with the SET ROLE\nstatement. The CURRENT_ROLE function returns the currently\nset role for the session, if any.\n \nOnly roles granted directly to a user can be set, roles\ngranted to other roles cannot. Instead the privileges\ngranted to a role, which is, in turn, granted to another\nrole (grantee), will be immediately available to any user\nwho sets this second grantee role.\n \nRoles were implemented as a GSoC 2013 project by Vicentiu\nCiorbaru. \n \nThe SET DEFAULT ROLE statement allows one to set a default\nrole for a user. A default role is automatically enabled\nwhen a user connects (an implicit SET ROLE statement is\nexecuted immediately after a connection is established).\n \nSystem Tables\n \nInformation about roles and who they\'ve been granted to can\nbe found in the Information Schema APPLICABLE_ROLES table as\nwell as the mysql.ROLES_MAPPING table.\n \nThe Information Schema ENABLED_ROLES table shows the enabled\nroles for the current session.\n \nExamples\n-------- \nCreating a role and granting a privilege:\n \nCREATE ROLE journalist;\n \nGRANT SHOW DATABASES ON *.* TO journalist;\n \nGRANT journalist to hulda;\n \nNote, that hulda has no SHOW DATABASES privilege, even\nthough she was granted the journalist role. She needs to set\nthe role first:\n \nSHOW DATABASES;\n \n+--------------------+\n| Database |\n+--------------------+\n| information_schema |\n+--------------------+\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n \nSET ROLE journalist;\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| journalist |\n+--------------+\n \nSHOW DATABASES;\n \n+--------------------+\n| Database |\n+--------------------+\n| ... |\n| information_schema |\n| mysql |\n| performance_schema |\n| test |\n| ... |\n+--------------------+\n \nSET ROLE NONE;\n \nRoles can be granted to roles:\n \nCREATE ROLE writer;\n \nGRANT SELECT ON data.* TO writer;\n \nGRANT writer TO journalist;\n \nBut one does not need to set a role granted to a role. For\nexample, hulda will automatically get all writer privileges\nwhen she sets the journalist role:\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n \nSHOW TABLES FROM data;\n \nEmpty set (0.01 sec)\n \nSET ROLE journalist;\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| journalist |\n+--------------+\n \nSHOW TABLES FROM data;\n \n+------------------------------+\n| Tables_in_data |\n+------------------------------+\n| set1 |\n| ... |\n+------------------------------+\n \nRoles and Views (and Stored Routines)\n \nWhen a user sets a role, he, in a sense, has two identities\nwith two associated sets of privileges.\nBut a view (or a stored routine) can have only one definer.\nSo, when a view (or a stored routine) is created with the\nSQL SECURITY DEFINER, one can specify whether the definer\nshould be CURRENT_USER (and the view will have none of the\nprivileges of the user\'s role) or CURRENT_ROLE (in this\ncase, the view will use role\'s privileges, but none of the\nuser\'s privileges). As a result, sometimes one can create a\nview that is impossible to use.\n \nCREATE ROLE r1;\n \nGRANT ALL ON db1.* TO r1;\n \nGRANT r1 TO foo@localhost;\n \nGRANT ALL ON db.* TO foo@localhost;\n \nSELECT CURRENT_USER\n+---------------+\n| current_user |\n+---------------+\n| foo@localhost |\n+---------------+\n \nSET ROLE r1;\n \nCREATE TABLE db1.t1 (i int);\n \nCREATE VIEW db.v1 AS SELECT * FROM db1.t1;\n \nSHOW CREATE VIEW db.v1;\n \n+------+------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n| View | Create View | character_set_client |\ncollation_connection |\n+------+------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n| v1 | CREATE ALGORITHM=UNDEFINED DEFINER=`foo`@`localhost`\nSQL SECURITY DEFINER VIEW `db`.`v1` AS SELECT `db1`.`t1`.`i`\nAS `i` from `db1`.`t1` | utf8 | utf8_general_ci |\n+------+------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n \nCREATE DEFINER=CURRENT_ROLE VIEW db.v2 AS SELECT * FROM\ndb1.t1;\n \nSHOW CREATE VIEW db.b2;\n \n+------+-----------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n| View | Create View | character_set_client |\ncollation_connection |\n+------+-----------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n| v2 | CREATE ALGORITHM=UNDEFINED DEFINER=`r1` SQL SECURITY\nDEFINER VIEW `db`.`v2` AS select `db1`.`t1`.`a` AS `a` from\n`db1`.`t1` | utf8 | utf8_general_ci |\n+------+-----------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+\n \nOther Resources\n \nRoles Review by Peter Gulutzan\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/roles_overview/','','https://mariadb.com/kb/en/library/roles_overview/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (127,10,'CREATE ROLE','Roles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nCREATE [OR REPLACE] ROLE [IF NOT EXISTS] role \n [WITH ADMIN \n {CURRENT_USER | CURRENT_ROLE | user | role}]\n \nDescription\n----------- \nThe CREATE ROLE statement creates one or more MariaDB roles.\nTo\nuse it, you must have the global CREATE USER\nprivilege or the INSERT privilege for the mysql\ndatabase. For each account, CREATE ROLE creates a new row in\nthe\nmysql.user table that has no privileges, and with the\ncorresponding is_role field set to Y. It also creates a\nrecord in the\nmysql.roles_mapping table.\n \nIf any of the specified roles already exist, ERROR 1396\n(HY000) results. If\nan error occurs, CREATE ROLE will still create the roles\nthat do not result\nin an error. The maximum length for a role is 128\ncharacters. Role names can be\nquoted, as explained in the Identifier names page. Only\none error is produced for all roles which have not been\ncreated:\n \nERROR 1396 (HY000): Operation CREATE ROLE failed for\n\'a\',\'b\',\'c\'\n \nFailed CREATE or DROP operations, for both users and roles,\nproduce the\nsame error code.\n \nPUBLIC and NONE are reserved, and cannot be used as role\nnames.\n \nBefore MariaDB 10.1.13, the CREATE ROLE statement was not\npermitted in prepared statements.\n \nFor valid identifiers to use as role names, see Identifier\nNames.\n \nWITH ADMIN\n \nThe optional WITH ADMIN clause determines whether the\ncurrent user, the\ncurrent role or another user or role has use of the newly\ncreated role. If the\nclause is omitted, WITH ADMIN CURRENT_USER is treated as the\ndefault, which\nmeans that the current user will be able to GRANT this role\nto\nusers.\n \nOR REPLACE\n \nThe OR REPLACE clause was added in MariaDB 10.1.3\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP ROLE IF EXISTS name;\n \nCREATE ROLE name ...;\n \nIF NOT EXISTS\n \nThe IF NOT EXISTS clause was added in MariaDB 10.1.3\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the specified role already\nexists. Cannot be used together with the OR REPLACE clause.\n \nExamples\n-------- \nCREATE ROLE journalist;\n \nCREATE ROLE developer WITH ADMIN lorinda;\n \nThe OR REPLACE and IF NOT EXISTS clauses:\n \nCREATE ROLE journalist;\nERROR 1396 (HY000): Operation CREATE ROLE failed for\n\'journalist\'\n \nCREATE OR REPLACE ROLE journalist;\nQuery OK, 0 rows affected (0.00 sec)\n \nCREATE ROLE IF NOT EXISTS journalist;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n+-------+------+---------------------------------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------------------------------+\n| Note | 1975 | Can\'t create role \'journalist\'; it\nalready exists |\n+-------+------+---------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/create-role/','','https://mariadb.com/kb/en/library/create-role/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (128,10,'DROP ROLE','Roles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nDROP ROLE [IF EXISTS] role_name [,role_name ...]\n \nDescription\n----------- \nThe DROP ROLE statement removes one or more MariaDB roles.\nTo use this\nstatement, you must have the global CREATE USER privilege or\nthe DELETE privilege for the mysql database.\n \nDROP ROLE does not disable roles for connections which\nselected them with SET ROLE. If a role has previously been\nset as a default role, DROP ROLE does not remove the record\nof the default role from the mysql.user table. If the role\nis subsequently recreated and granted, it will again be the\nuser\'s default. Use SET DEFAULT ROLE NONE to explicitly\nremove this.\n \nIf any of the specified user accounts do not exist, ERROR\n1396 (HY000)\nresults. If an error occurs, DROP ROLE will still drop the\nroles that\ndo not result in an error. Only one error is produced for\nall roles which have not been dropped:\n \nERROR 1396 (HY000): Operation DROP ROLE failed for\n\'a\',\'b\',\'c\'\n \nFailed CREATE or DROP operations, for both users and roles,\nproduce the same error code.\n \nBefore MariaDB 10.1.13, the DROP ROLE statement was not\npermitted in prepared statements.\n \nIF EXISTS\n \nThe IF EXISTS clause was added in MariaDB 10.1.3\n \nIf the IF EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the role does not exist.\n \nExamples\n-------- \nDROP ROLE journalist;\n \nThe same thing using the optional IF EXISTS clause:\n \nDROP ROLE journalist;\n \nERROR 1396 (HY000): Operation DROP ROLE failed for\n\'journalist\'\n \nDROP ROLE IF EXISTS journalist;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nNote (Code 1975): Can\'t drop role \'journalist\'; it\ndoesn\'t exist\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-role/','','https://mariadb.com/kb/en/library/drop-role/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (129,10,'SET ROLE','Roles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nSET ROLE { role | NONE }\n \nDescription\n----------- \nThe SET ROLE statement enables a role, along with all of its\nassociated permissions, for the current session. To unset a\nrole, use NONE .\n \nIf a role that doesn\'t exist, or to which the user has not\nbeen assigned, is specified, an ERROR 1959 (OP000): Invalid\nrole specification error occurs.\n \nFrom MariaDB 10.1.1, an automatic SET ROLE is implicitly\nperformed when a user connects if that user has been\nassigned a default role. See SET DEFAULT ROLE.\n \nExample\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n \nSET ROLE staff;\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| staff |\n+--------------+\n \nSET ROLE NONE;\n \nQuery OK, 0 rows affected (0.00 sec)\n \nSELECT CURRENT_ROLE();\n+----------------+\n| CURRENT_ROLE() |\n+----------------+\n| NULL |\n+----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/set-role/','','https://mariadb.com/kb/en/library/set-role/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (130,10,'SET DEFAULT ROLE','Default roles were implemented in MariaDB 10.1.1.\n \nSyntax\n------ \nSET DEFAULT ROLE { role | NONE } [ FOR user@host ]\n \nDescription\n----------- \nThe SET DEFAULT ROLE statement sets a default role for a\nspecified (or current) user. A default role is automatically\nenabled when a user connects (an implicit SET ROLE statement\nis executed immediately after a connection is established).\n \nTo be able to set a role as a default, one needs the\nprivileges to enable this role (if you cannot do SET ROLE X,\nyou won\'t be able to do SET DEFAULT ROLE X). To set a\ndefault role for another user one needs to have write access\nto the mysql database.\n \nTo remove a user\'s default role, use SET DEFAULT ROLE NONE\n[ FOR user@host ]. The record of the default role is not\nremoved if the role is dropped or revoked, so if the role is\nsubsequently re-created or granted, it will again be the\nuser\'s default role.\n \nThe default role is stored in a new column in the mysql.user\ntable, and currently viewing this table is the only way to\nsee which role has been assigned to a user as the default. \n \nExamples\n-------- \nSetting a default role for the current user:\n \nSET DEFAULT ROLE journalist;\n \nRemoving a default role from the current user:\n \nSET DEFAULT ROLE NONE;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/set-default-role/','','https://mariadb.com/kb/en/library/set-default-role/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (131,11,'ST_X','Syntax\n------ \nST_X(p)\nX(p)\n \nDescription\n----------- \nReturns the X-coordinate value for the point p as a\ndouble-precision number.\n \nST_X() and X() are synonyms.\n \nExamples\n-------- \nSET @pt = \'Point(56.7 53.34)\';\n \nSELECT X(GeomFromText(@pt));\n+----------------------+\n| X(GeomFromText(@pt)) |\n+----------------------+\n| 56.7 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_x/','','https://mariadb.com/kb/en/library/st_x/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (132,11,'ST_Y','Syntax\n------ \nST_Y(p)\nY(p)\n \nDescription\n----------- \nReturns the Y-coordinate value for the point p as a\ndouble-precision number.\n \nST_Y() and Y() are synonyms.\n \nExamples\n-------- \nSET @pt = \'Point(56.7 53.34)\';\n \nSELECT Y(GeomFromText(@pt));\n+----------------------+\n| Y(GeomFromText(@pt)) |\n+----------------------+\n| 53.34 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_y/','','https://mariadb.com/kb/en/library/st_y/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (133,11,'X','A synonym for ST_X.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/point-properties-x/','','https://mariadb.com/kb/en/library/point-properties-x/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (134,11,'Y','A synonym for ST_Y.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/point-properties-y/','','https://mariadb.com/kb/en/library/point-properties-y/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (135,12,'AES_DECRYPT','Syntax\n------ \nAES_DECRYPT(crypt_str,key_str)\n \nDescription\n----------- \nThis function allows decryption of data using the official\nAES\n(Advanced Encryption Standard) algorithm. For more\ninformation, see\nthe description of AES_ENCRYPT().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/aes_decrypt/','','https://mariadb.com/kb/en/library/aes_decrypt/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (136,12,'AES_ENCRYPT','Syntax\n------ \nAES_ENCRYPT(str,key_str)\n \nDescription\n----------- \nAES_ENCRYPT() and AES_DECRYPT() allow encryption and\ndecryption of\ndata using the official AES (Advanced Encryption Standard)\nalgorithm,\npreviously known as \"Rijndael.\" Encoding with a 128-bit\nkey length is\nused, but you can extend it up to 256 bits by modifying the\nsource. We\nchose 128 bits because it is much faster and it is secure\nenough for\nmost purposes.\n \nAES_ENCRYPT() encrypts a string str using the key key_str,\nand returns a binary string.\n \nAES_DECRYPT() decrypts the encrypted string and returns the\noriginal\nstring.\n \nThe input arguments may be any length. If either argument is\nNULL, the result of this function is also NULL.\n \nBecause AES is a block-level algorithm, padding is used to\nencode\nuneven length strings and so the result string length may be\ncalculated using this formula:\n \n16 x (trunc(string_length / 16) + 1)\n \nIf AES_DECRYPT() detects invalid data or incorrect padding,\nit returns\nNULL. However, it is possible for AES_DECRYPT() to return a\nnon-NULL\nvalue (possibly garbage) if the input data or the key is\ninvalid.\n \nExamples\n-------- \nINSERT INTO t VALUES\n(AES_ENCRYPT(\'text\',SHA2(\'password\',512)));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/aes_encrypt/','','https://mariadb.com/kb/en/library/aes_encrypt/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (137,12,'COMPRESS','Syntax\n------ \nCOMPRESS(string_to_compress)\n \nDescription\n----------- \nCompresses a string and returns the result as a binary\nstring. This\nfunction requires MariaDB to have been compiled with a\ncompression\nlibrary such as zlib. Otherwise, the return value is always\nNULL. The\ncompressed string can be uncompressed with UNCOMPRESS().\n \nThe have_compress server system variable indicates whether a\ncompression library is present. \n \nExamples\n-------- \nSELECT LENGTH(COMPRESS(REPEAT(\'a\',1000)));\n+------------------------------------+\n| LENGTH(COMPRESS(REPEAT(\'a\',1000))) |\n+------------------------------------+\n| 21 |\n+------------------------------------+\n \nSELECT LENGTH(COMPRESS(\'\'));\n+----------------------+\n| LENGTH(COMPRESS(\'\')) |\n+----------------------+\n| 0 |\n+----------------------+\n \nSELECT LENGTH(COMPRESS(\'a\'));\n+-----------------------+\n| LENGTH(COMPRESS(\'a\')) |\n+-----------------------+\n| 13 |\n+-----------------------+\n \nSELECT LENGTH(COMPRESS(REPEAT(\'a\',16)));\n+----------------------------------+\n| LENGTH(COMPRESS(REPEAT(\'a\',16))) |\n+----------------------------------+\n| 15 |\n+----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/compress/','','https://mariadb.com/kb/en/library/compress/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (138,12,'DECODE','Syntax\n------ \nDECODE(crypt_str,pass_str)\n \nDescription\n----------- \nDecrypts the encrypted string crypt_str using pass_str as\nthe\npassword. crypt_str should be a string returned from\nENCODE(). The resulting string will be the original string\nonly if pass_str is the same.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/decode/','','https://mariadb.com/kb/en/library/decode/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (139,12,'DES_DECRYPT','Syntax\n------ \nDES_DECRYPT(crypt_str[,key_str])\n \nDescription\n----------- \nDecrypts a string encrypted with DES_ENCRYPT(). If an error\noccurs,\nthis function returns NULL.\n \nThis function works only if MariaDB has been configured with\nTLS\nsupport.\n \nIf no key_str argument is given, DES_DECRYPT() examines the\nfirst byte\nof the encrypted string to determine the DES key number that\nwas used\nto encrypt the original string, and then reads the key from\nthe DES\nkey file to decrypt the message. For this to work, the user\nmust have\nthe SUPER privilege. The key file can be specified with the\n--des-key-file server option.\n \nIf you pass this function a key_str argument, that string is\nused as\nthe key for decrypting the message.\n \nIf the crypt_str argument does not appear to be an encrypted\nstring,\nMariaDB returns the given crypt_str.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/des_decrypt/','','https://mariadb.com/kb/en/library/des_decrypt/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (140,12,'DES_ENCRYPT','Syntax\n------ \nDES_ENCRYPT(str[,{key_num|key_str}])\n \nDescription\n----------- \nEncrypts the string with the given key using the Triple-DES\nalgorithm.\n \nThis function works only if MariaDB has been configured with\nTLS support.\n \nThe encryption key to use is chosen based on the second\nargument to\nDES_ENCRYPT(), if one was given. With no argument, the first\nkey from\nthe DES key file is used. With a key_num argument, the given\nkey \nnumber (0-9) from the DES key file is used. With a key_str\nargument,\nthe given key string is used to encrypt str. \n \nThe key file can be specified with the --des-key-file server\noption.\n \nThe return string is a binary string where the first\ncharacter is \nCHAR(128 | key_num). If an error occurs, DES_ENCRYPT()\nreturns NULL.\n \nThe 128 is added to make it easier to recognize an encrypted\nkey. If\nyou use a string key, key_num is 127.\n \nThe string length for the result is given by this formula:\n \nnew_len = orig_len + (8 - (orig_len % 8)) + 1\n \nEach line in the DES key file has the following format:\n \nkey_num des_key_str\n \nEach key_num value must be a number in the range from 0 to\n9. Lines in\nthe file may be in any order. des_key_str is the string that\nis used\nto encrypt the message. There should be at least one space\nbetween the\nnumber and the key. The first key is the default key that is\nused if\nyou do not specify any key argument to DES_ENCRYPT().\n \nYou can tell MariaDB to read new key values from the key\nfile with the\nFLUSH DES_KEY_FILE statement. This requires the RELOAD\nprivilege.\n \nOne benefit of having a set of default keys is that it gives\napplications a way to check for the existence of encrypted\ncolumn\nvalues, without giving the end user the right to decrypt\nthose values.\n \nExamples\n-------- \nSELECT customer_address FROM customer_table \n WHERE crypted_credit_card =\nDES_ENCRYPT(\'credit_card_number\');\n \n\n\nURL: https://mariadb.com/kb/en/library/des_encrypt/','','https://mariadb.com/kb/en/library/des_encrypt/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (141,12,'ENCODE','Syntax\n------ \nENCODE(str,pass_str)\n \nDescription\n----------- \nENCODE is not considered cryptographically secure, and\nshould not be used for password encryption.\n \nEncrypt str using pass_str as the password. To decrypt the\nresult, use\nDECODE().\n \nThe result is a binary string of the same length as str.\n \nThe strength of the encryption is based on how good the\nrandom generator is. \n \nIt is not recommended to rely on the encryption performed by\nthe ENCODE function. Using a salt value (changed when a\npassword is updated) will improve matters somewhat, but for\nstoring passwords, consider a more cryptographically secure\nfunction, such as SHA2().\n \nExamples\n-------- \nENCODE(\'not so secret text\',\nCONCAT(\'random_salt\',\'password\'))\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/encode/','','https://mariadb.com/kb/en/library/encode/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (142,12,'ENCRYPT','Syntax\n------ \nENCRYPT(str[,salt])\n \nDescription\n----------- \nEncrypts a string using the Unix crypt() system call,\nreturning an encrypted binary string. The salt argument\nshould be a string with at least two characters or the\nreturned result will be NULL. If no salt argument is given,\na random value of sufficient length is used.\n \nIt is not recommended to use ENCRYPT() with utf16, utf32 or\nucs2 multi-byte character sets because the crypt() system\ncall expects a string terminated with a zero byte.\n \nNote that the underlying crypt() system call may have some\nlimitations, such as ignoring all but the first eight\ncharacters.\n \nIf the have_crypt system variable is set to NO (because the\ncrypt() system call is not available), the ENCRYPT function\nwill always return NULL.\n \nExamples\n-------- \nSELECT ENCRYPT(\'encrypt me\');\n+-----------------------+\n| ENCRYPT(\'encrypt me\') |\n+-----------------------+\n| 4I5BsEx0lqTDk |\n+-----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/encrypt/','','https://mariadb.com/kb/en/library/encrypt/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (143,12,'MD5','Syntax\n------ \nMD5(str)\n \nDescription\n----------- \nCalculates an MD5 128-bit checksum for the string. \n \nThe return value is a 32-hex digit string, and as of MariaDB\n5.5, is a nonbinary string in the connection character set\nand collation, determined by the values of the\ncharacter_set_connection and collation_connection system\nvariables. Before 5.5, the return value was a binary string.\n \nNULL is returned if the argument was NULL. \n \nExamples\n-------- \nSELECT MD5(\'testing\');\n+----------------------------------+\n| MD5(\'testing\') |\n+----------------------------------+\n| ae2b1fca515949e5d54fb22b8ed95575 |\n+----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/md5/','','https://mariadb.com/kb/en/library/md5/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (144,12,'OLD_PASSWORD','Syntax\n------ \nOLD_PASSWORD(str)\n \nDescription\n----------- \nOLD_PASSWORD() was added to MySQL when the implementation of\n\nPASSWORD() was changed to improve security. OLD_PASSWORD()\nreturns the\nvalue of the old (pre-MySQL 4.1) implementation of\nPASSWORD() as a\nstring, and is intended to permit you to reset passwords for\nany\npre-4.1 clients that need to connect to a more recent MySQL\nserver version, or any version of MariaDB,\nwithout locking them out.\n \nAs of MariaDB 5.5, the return value is a nonbinary string in\nthe connection character set and collation, determined by\nthe values of the character_set_connection and\ncollation_connection system variables. Before 5.5, the\nreturn value was a binary string.\n \nThe return value is 16 bytes in length, or NULL if the\nargument was NULL.\n \n\n\nURL: https://mariadb.com/kb/en/library/old_password/','','https://mariadb.com/kb/en/library/old_password/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (145,12,'PASSWORD','Syntax\n------ \nPASSWORD(str)\n \nDescription\n----------- \nThe PASSWORD() function is used for hashing passwords for\nuse in authentication by the MariaDB server. It is not\nintended for use in other applications.\n \nCalculates and returns a hashed password string from the\nplaintext password str. Returns an empty string (>= MariaDB\n10.0.4) or NULL (\n\nURL: https://mariadb.com/kb/en/library/password/','','https://mariadb.com/kb/en/library/password/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (146,12,'SHA1','Syntax\n------ \nSHA1(str), SHA(str)\n \nDescription\n----------- \nCalculates an SHA-1 160-bit checksum for the string str, as\ndescribed in\nRFC 3174 (Secure Hash Algorithm).\n \nThe value is returned as a string of 40 hex digits, or NULL\nif the argument was NULL. As of MariaDB 5.5, the return\nvalue is a nonbinary string in the connection character set\nand collation, determined by the values of the\ncharacter_set_connection and collation_connection system\nvariables. Before 5.5, the return value was a binary string.\n \nExamples\n-------- \nSELECT SHA1(\'some boring text\');\n+------------------------------------------+\n| SHA1(\'some boring text\') |\n+------------------------------------------+\n| af969fc2085b1bb6d31e517d5c456def5cdd7093 |\n+------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/sha1/','','https://mariadb.com/kb/en/library/sha1/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (147,12,'SHA2','SHA2() was introduced in MariaDB 5.5\n \nSyntax\n------ \nSHA2(str,hash_len)\n \nDescription\n----------- \nGiven a string str, calculates an SHA-2 checksum, which is\nconsidered more cryptographically secure than its SHA-1\nequivalent. The SHA-2 family includes SHA-224, SHA-256,\nSHA-384, and SHA-512, and the hash_len must correspond to\none of these, i.e. 224, 256, 384 or 512. 0 is equivalent to\n256.\n \nThe return value is a nonbinary string in the connection\ncharacter set and collation, determined by the values of the\ncharacter_set_connection and collation_connection system\nvariables. \n \nNULL is returned if the hash length is not valid, or the\nstring str is NULL.\n \nSHA2 will only work if MariaDB was has been configured with\nTLS support. \n \nExamples\n-------- \nSELECT SHA2(\'Maria\',224);\n+----------------------------------------------------------+\n| SHA2(\'Maria\',224) |\n+----------------------------------------------------------+\n| 6cc67add32286412efcab9d0e1675a43a5c2ef3cec8879f81516ff83 |\n+----------------------------------------------------------+\n \nSELECT SHA2(\'Maria\',256);\n+------------------------------------------------------------------+\n| SHA2(\'Maria\',256) |\n+------------------------------------------------------------------+\n|\n9ff18ebe7449349f358e3af0b57cf7a032c1c6b2272cb2656ff85eb112232f16\n|\n+------------------------------------------------------------------+\n \nSELECT SHA2(\'Maria\',0);\n+------------------------------------------------------------------+\n| SHA2(\'Maria\',0) |\n+------------------------------------------------------------------+\n|\n9ff18ebe7449349f358e3af0b57cf7a032c1c6b2272cb2656ff85eb112232f16\n|\n+------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/sha2/','','https://mariadb.com/kb/en/library/sha2/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (148,12,'UNCOMPRESS','Syntax\n------ \nUNCOMPRESS(string_to_uncompress)\n \nDescription\n----------- \nUncompresses a string compressed by the COMPRESS() function.\nIf the\nargument is not a compressed value, the result is NULL. This\nfunction\nrequires MariaDB to have been compiled with a compression\nlibrary such\nas zlib. Otherwise, the return value is always NULL. The\nhave_compress server system variable indicates whether a\ncompression library is present. \n \nExamples\n-------- \nSELECT UNCOMPRESS(COMPRESS(\'a string\'));\n+----------------------------------+\n| UNCOMPRESS(COMPRESS(\'a string\')) |\n+----------------------------------+\n| a string |\n+----------------------------------+\n \nSELECT UNCOMPRESS(\'a string\');\n+------------------------+\n| UNCOMPRESS(\'a string\') |\n+------------------------+\n| NULL |\n+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/uncompress/','','https://mariadb.com/kb/en/library/uncompress/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (149,12,'UNCOMPRESSED_LENGTH','Syntax\n------ \nUNCOMPRESSED_LENGTH(compressed_string)\n \nDescription\n----------- \nReturns the length that the compressed string had before\nbeing\ncompressed with COMPRESS().\n \nUNCOMPRESSED_LENGTH() returns NULL or an incorrect result if\nthe string is not compressed.\n \nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or\nbigint(10), in all cases. From MariaDB 10.3.1, returns\nMYSQL_TYPE_LONG, or int(10), when the result would fit\nwithin 32-bits.\n \nExamples\n-------- \nSELECT UNCOMPRESSED_LENGTH(COMPRESS(REPEAT(\'a\',30)));\n+-----------------------------------------------+\n| UNCOMPRESSED_LENGTH(COMPRESS(REPEAT(\'a\',30))) |\n+-----------------------------------------------+\n| 30 |\n+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/uncompressed_length/','','https://mariadb.com/kb/en/library/uncompressed_length/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (150,13,'ENDPOINT','A synonym for ST_ENDPOINT.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/linestring-properties-endpoint/','','https://mariadb.com/kb/en/library/linestring-properties-endpoint/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (151,13,'GLENGTH','Syntax\n------ \nGLength(ls)\n \nDescription\n----------- \nReturns as a double-precision number the length of the\nLineString value ls in its associated spatial reference.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT GLength(GeomFromText(@ls));\n+----------------------------+\n| GLength(GeomFromText(@ls)) |\n+----------------------------+\n| 2.82842712474619 |\n+----------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/glength/','','https://mariadb.com/kb/en/library/glength/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (152,13,'NumPoints','A synonym for ST_NumPoints.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/linestring-properties-numpoints/','','https://mariadb.com/kb/en/library/linestring-properties-numpoints/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (153,13,'PointN','A synonym for ST_PointN.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/linestring-properties-pointn/','','https://mariadb.com/kb/en/library/linestring-properties-pointn/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (154,13,'STARTPOINT','A synonym for ST_STARTPOINT.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/linestring-properties-startpoint/','','https://mariadb.com/kb/en/library/linestring-properties-startpoint/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (155,13,'ST_ENDPOINT','Syntax\n------ \nST_EndPoint(ls)\nEndPoint(ls)\n \nDescription\n----------- \nReturns the Point that is the endpoint of the\nLineString value ls.\n \nST_EndPoint() and EndPoint() are synonyms.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_endpoint/','','https://mariadb.com/kb/en/library/st_endpoint/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (156,13,'ST_NUMPOINTS','Syntax\n------ \nST_NumPoints(ls)\nNumPoints(ls)\n \nDescription\n----------- \nReturns the number of Point objects in the LineString\nvalue ls.\n \nST_NumPoints() and NumPoints() are synonyms.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT NumPoints(GeomFromText(@ls));\n+------------------------------+\n| NumPoints(GeomFromText(@ls)) |\n+------------------------------+\n| 3 |\n+------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_numpoints/','','https://mariadb.com/kb/en/library/st_numpoints/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (157,13,'ST_POINTN','Syntax\n------ \nST_PointN(ls,N)\nPointN(ls,N)\n \nDescription\n----------- \nReturns the N-th Point in the LineString value ls.\nPoints are numbered beginning with 1.\n \nST_PointN() and PointN() are synonyms.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT AsText(PointN(GeomFromText(@ls),2));\n+-------------------------------------+\n| AsText(PointN(GeomFromText(@ls),2)) |\n+-------------------------------------+\n| POINT(2 2) |\n+-------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_pointn/','','https://mariadb.com/kb/en/library/st_pointn/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (158,14,'GET_LOCK','Syntax\n------ \nGET_LOCK(str,timeout)\n \nDescription\n----------- \nTries to obtain a lock with a name given by the string str,\nusing a timeout of timeout seconds. Returns 1 if the lock\nwas obtained successfully, 0 if the attempt timed out (for\nexample, because another client has previously locked the\nname), or NULL if an error occurred (such as running out of\nmemory or the thread was killed with mysqladmin kill).\n \nA lock is released with RELEASE_LOCK(), when the connection\nterminates (either normally or abnormally), or before\nMariaDB 10.0.2, when the connection executes another\nGET_LOCK statement. From MariaDB 10.0.2, a connection can\nhold multiple locks at the same time, so a lock that is no\nlonger needed needs to be explicitly released.\n \nThe IS_FREE_LOCK function returns whether a specified lock a\nfree or not, and the IS_USED_LOCK whether the function is in\nuse or not.\n \nLocks obtained with GET_LOCK() do not interact with\ntransactions. That is, committing a transaction does not\nrelease any such locks obtained during the transaction.\n \nFrom MariaDB 10.0.2, it is also possible to recursively set\nthe same lock. If a lock with the same name is set n times,\nit needs to be released n times as well. \n \nstr is case insensitive for GET_LOCK() and related\nfunctions. If str is an empty string or NULL, GET_LOCK()\nreturns NULL and does nothing. From MariaDB 10.2.2, timeout\nsupports microseconds. Before then, it was rounded to the\nclosest integer.\n \nIf the metadata_lock_info plugin is installed, locks\nacquired with this function are visible in the Information\nSchema METADATA_LOCK_INFO table.\n \nThis function can be used to implement application locks or\nto simulate record locks. Names are locked on a server-wide\nbasis. If a name has been locked by one client, GET_LOCK()\nblocks any request by another client for a lock with the\nsame name. This allows clients that agree on a given lock\nname to use the name to perform cooperative advisory\nlocking. But be aware that it also allows a client that is\nnot among the set of cooperating clients to lock a name,\neither inadvertently or deliberately, and thus prevent any\nof the cooperating clients from locking that name. One way\nto reduce the likelihood of this is to use lock names that\nare database-specific or application-specific. For example,\nuse lock names of the form db_name.str or app_name.str.\n \nStatements using the GET_LOCK() function are not safe for\nreplication.\n \nThe patch to permit multiple locks was contributed by\nKonstantin \"Kostja\" Osipov (MDEV-3917).\n \nExamples\n-------- \nSELECT GET_LOCK(\'lock1\',10);\n+----------------------+\n| GET_LOCK(\'lock1\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT IS_FREE_LOCK(\'lock1\'), IS_USED_LOCK(\'lock1\');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(\'lock1\') | IS_USED_LOCK(\'lock1\') |\n+-----------------------+-----------------------+\n| 0 | 46 |\n+-----------------------+-----------------------+\n \nSELECT IS_FREE_LOCK(\'lock2\'), IS_USED_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(\'lock2\') | IS_USED_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| 1 | NULL |\n+-----------------------+-----------------------+\n \nFrom MariaDB 10.0.2, multiple locks can be held:\n \nSELECT GET_LOCK(\'lock2\',10);\n+----------------------+\n| GET_LOCK(\'lock2\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT IS_FREE_LOCK(\'lock1\'), IS_FREE_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(\'lock1\') | IS_FREE_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| 0 | 0 |\n+-----------------------+-----------------------+\n \nSELECT RELEASE_LOCK(\'lock1\'), RELEASE_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| RELEASE_LOCK(\'lock1\') | RELEASE_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| 1 | 1 |\n+-----------------------+-----------------------+\n \nBefore MariaDB 10.0.2, a connection could only hold a single\nlock:\n \nSELECT GET_LOCK(\'lock2\',10);\n+----------------------+\n| GET_LOCK(\'lock2\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT IS_FREE_LOCK(\'lock1\'), IS_FREE_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(\'lock1\') | IS_FREE_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| 1 | 0 |\n+-----------------------+-----------------------+\n \nSELECT RELEASE_LOCK(\'lock1\'), RELEASE_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| RELEASE_LOCK(\'lock1\') | RELEASE_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| NULL | 1 |\n+-----------------------+-----------------------+\n \nFrom MariaDB 10.0.2, it is possible to hold the same lock\nrecursively. This example is viewed using the\nmetadata_lock_info plugin:\n \nSELECT GET_LOCK(\'lock3\',10);\n+----------------------+\n| GET_LOCK(\'lock3\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT GET_LOCK(\'lock3\',10);\n+----------------------+\n| GET_LOCK(\'lock3\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \n+-----------+---------------------+---------------+-----------+--------------+------------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE |\nTABLE_SCHEMA | TABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n \nSELECT RELEASE_LOCK(\'lock3\');\n+-----------------------+\n| RELEASE_LOCK(\'lock3\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \n+-----------+---------------------+---------------+-----------+--------------+------------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE |\nTABLE_SCHEMA | TABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n \nSELECT RELEASE_LOCK(\'lock3\');\n+-----------------------+\n| RELEASE_LOCK(\'lock3\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \nEmpty set (0.000 sec)\n \nTimeout example: Connection 1:\n \nSELECT GET_LOCK(\'lock4\',10);\n+----------------------+\n| GET_LOCK(\'lock4\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 2:\n \nSELECT GET_LOCK(\'lock4\',10);\n \nAfter 10 seconds...\n \n+----------------------+\n| GET_LOCK(\'lock4\',10) |\n+----------------------+\n| 0 |\n+----------------------+\n \nDeadlocks are automatically detected and resolved.\nConnection 1:\n \nSELECT GET_LOCK(\'lock5\',10); \n+----------------------+\n| GET_LOCK(\'lock5\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 2:\n \nSELECT GET_LOCK(\'lock6\',10);\n+----------------------+\n| GET_LOCK(\'lock6\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 1:\n \nSELECT GET_LOCK(\'lock6\',10); \n+----------------------+\n| GET_LOCK(\'lock6\',10) |\n+----------------------+\n| 0 |\n+----------------------+\n \nConnection 2:\n \nSELECT GET_LOCK(\'lock5\',10);\nERROR 1213 (40001): Deadlock found when trying to get lock;\n try restarting transaction\n \n\n\nURL: https://mariadb.com/kb/en/library/get_lock/','','https://mariadb.com/kb/en/library/get_lock/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (159,14,'INET6_ATON','INET6_ATON() has been available since MariaDB 10.0.12.\n \nSyntax\n------ \nINET6_ATON(expr)\n \nDescription\n----------- \nGiven an IPv6 or IPv4 network address as a string, returns a\nbinary string that represents the numeric value of the\naddress.\n \nNo trailing zone ID\'s or traling network masks are\npermitted. For IPv4 addresses, or IPv6 addresses with IPv4\naddress parts, no classful addresses or trailing port\nnumbers are permitted and octal numbers are not supported.\n \nThe returned binary string will be VARBINARY(16) or\nVARBINARY(4) for IPv6 and IPv4 addresses respectively.\n \nReturns NULL if the argument is not understood.\n \nExamples\n-------- \nSELECT HEX(INET6_ATON(\'10.0.1.1\'));\n+-----------------------------+\n| HEX(INET6_ATON(\'10.0.1.1\')) |\n+-----------------------------+\n| 0A000101 |\n+-----------------------------+\n \nSELECT HEX(INET6_ATON(\'48f3::d432:1431:ba23:846f\'));\n+----------------------------------------------+\n| HEX(INET6_ATON(\'48f3::d432:1431:ba23:846f\')) |\n+----------------------------------------------+\n| 48F3000000000000D4321431BA23846F |\n+----------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/inet6_aton/','','https://mariadb.com/kb/en/library/inet6_aton/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (160,14,'INET6_NTOA','INET6_NTOA() has been available from MariaDB 10.0.12.\n \nSyntax\n------ \nINET6_NTOA(expr)\n \nDescription\n----------- \nGiven an IPv6 or IPv4 network address as a numeric binary\nstring, returns the address as a nonbinary string in the\nconnection character set.\n \nThe return string is lowercase, and is platform independent,\nsince it does not use functions specific to the operating\nsystem. It has a maximum length of 39 characters.\n \nReturns NULL if the argument is not understood.\n \nExamples\n-------- \nSELECT INET6_NTOA(UNHEX(\'0A000101\'));\n+-------------------------------+\n| INET6_NTOA(UNHEX(\'0A000101\')) |\n+-------------------------------+\n| 10.0.1.1 |\n+-------------------------------+\n \nSELECT\nINET6_NTOA(UNHEX(\'48F3000000000000D4321431BA23846F\'));\n+-------------------------------------------------------+\n| INET6_NTOA(UNHEX(\'48F3000000000000D4321431BA23846F\')) |\n+-------------------------------------------------------+\n| 48f3::d432:1431:ba23:846f |\n+-------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/inet6_ntoa/','','https://mariadb.com/kb/en/library/inet6_ntoa/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (161,14,'INET_ATON','Syntax\n------ \nINET_ATON(expr)\n \nDescription\n----------- \nGiven the dotted-quad representation of an IPv4 network\naddress as a string,\nreturns an integer that represents the numeric value of the\naddress.\nAddresses may be 4- or 8-byte addresses.\n \nReturns NULL if the argument is not understood.\n \nExamples\n-------- \nSELECT INET_ATON(\'192.168.1.1\');\n+--------------------------+\n| INET_ATON(\'192.168.1.1\') |\n+--------------------------+\n| 3232235777 |\n+--------------------------+\n \nThis is calculated as follows: 192 x 2563 + 168 x 256 2 + 1\nx 256 + 1\n \n\n\nURL: https://mariadb.com/kb/en/library/inet_aton/','','https://mariadb.com/kb/en/library/inet_aton/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (162,14,'INET_NTOA','Syntax\n------ \nINET_NTOA(expr)\n \nDescription\n----------- \nGiven a numeric IPv4 network address in network byte order\n(4 or 8 byte),\nreturns the dotted-quad representation of the address as a\nstring.\n \nExamples\n-------- \nSELECT INET_NTOA(3232235777);\n+-----------------------+\n| INET_NTOA(3232235777) |\n+-----------------------+\n| 192.168.1.1 |\n+-----------------------+\n \n192.168.1.1 corresponds to 3232235777 since 192 x 2563 + 168\nx 256 2 + 1 x 256 + 1 = 3232235777\n \n\n\nURL: https://mariadb.com/kb/en/library/inet_ntoa/','','https://mariadb.com/kb/en/library/inet_ntoa/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (163,14,'IS_FREE_LOCK','Syntax\n------ \nIS_FREE_LOCK(str)\n \nDescription\n----------- \nChecks whether the lock named str is free to use (that is,\nnot locked).\nReturns 1 if the lock is free (no one is using the lock),\n 0 if the lock is in use, and NULL if an\nerror occurs (such as an incorrect argument, like an empty\nstring or NULL). str is case insensitive.\n \nIf the metadata_lock_info plugin is installed, the\nInformation Schema metadata_lock_info table contains\ninformation about locks of this kind (as well as metadata\nlocks).\n \nStatements using the IS_FREE_LOCK() function are not safe\nfor replication.\n \n\n\nURL: https://mariadb.com/kb/en/library/is_free_lock/','','https://mariadb.com/kb/en/library/is_free_lock/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (164,14,'IS_IPV4','IS_IPV4() has been available since MariaDB 10.0.12.\n \nSyntax\n------ \nIS_IPV4(expr)\n \nDescription\n----------- \nIf the expression is a valid IPv4 address, returns 1,\notherwise returns 0.\n \nIS_IPV4() is stricter than INET_ATON(), but as strict as\nINET6_ATON(), in determining the validity of an IPv4\naddress. This implies that if IS_IPV4 returns 1, the same\nexpression will always return a non-NULL result when passed\nto INET_ATON(), but that the reverse may not apply.\n \nExamples\n-------- \nSELECT IS_IPV4(\'1110.0.1.1\');\n+-----------------------+\n| IS_IPV4(\'1110.0.1.1\') |\n+-----------------------+\n| 0 |\n+-----------------------+\n \nSELECT IS_IPV4(\'48f3::d432:1431:ba23:846f\');\n+--------------------------------------+\n| IS_IPV4(\'48f3::d432:1431:ba23:846f\') |\n+--------------------------------------+\n| 0 |\n+--------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/is_ipv4/','','https://mariadb.com/kb/en/library/is_ipv4/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (165,14,'IS_IPV4_COMPAT','IS_IPV4_COMPAT() has been available since MariaDB 10.0.12.\n \nSyntax\n------ \nIS_IPV4_COMPAT(expr)\n \nDescription\n----------- \nReturns 1 if a given numeric binary string IPv6 address,\nsuch as returned by INET6_ATON(), is IPv4-compatible,\notherwise returns 0. \n \nExamples\n-------- \nSELECT IS_IPV4_COMPAT(INET6_ATON(\'::10.0.1.1\'));\n+------------------------------------------+\n| IS_IPV4_COMPAT(INET6_ATON(\'::10.0.1.1\')) |\n+------------------------------------------+\n| 1 |\n+------------------------------------------+\n \nSELECT\nIS_IPV4_COMPAT(INET6_ATON(\'::48f3::d432:1431:ba23:846f\'));\n+-----------------------------------------------------------+\n|\nIS_IPV4_COMPAT(INET6_ATON(\'::48f3::d432:1431:ba23:846f\'))\n|\n+-----------------------------------------------------------+\n| 0 |\n+-----------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/is_ipv4_compat/','','https://mariadb.com/kb/en/library/is_ipv4_compat/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (166,14,'IS_IPV4_MAPPED','IS_IPV4_MAPPED() has been available since MariaDB 10.0.12.\n \nSyntax\n------ \nIS_IPV4_MAPPED(expr)\n \nDescription\n----------- \nReturns 1 if a given a numeric binary string IPv6 address,\nsuch as returned by INET6_ATON(), is a valid IPv4-mapped\naddress, otherwise returns 0.\n \nExamples\n-------- \nSELECT IS_IPV4_MAPPED(INET6_ATON(\'::10.0.1.1\'));\n+------------------------------------------+\n| IS_IPV4_MAPPED(INET6_ATON(\'::10.0.1.1\')) |\n+------------------------------------------+\n| 0 |\n+------------------------------------------+\n \nSELECT IS_IPV4_MAPPED(INET6_ATON(\'::ffff:10.0.1.1\'));\n+-----------------------------------------------+\n| IS_IPV4_MAPPED(INET6_ATON(\'::ffff:10.0.1.1\')) |\n+-----------------------------------------------+\n| 1 |\n+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/is_ipv4_mapped/','','https://mariadb.com/kb/en/library/is_ipv4_mapped/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (167,14,'IS_IPV6','IS_IPV6() has been available since MariaDB 10.0.12.\n \nSyntax\n------ \nIS_IPV6(expr)\n \nDescription\n----------- \nReturns 1 if the expression is a valid IPv6 address\nspecified as a string, otherwise returns 0. Does not\nconsider IPv4 addresses to be valid IPv6 addresses.\n \nExamples\n-------- \n SELECT IS_IPV6(\'48f3::d432:1431:ba23:846f\');\n+--------------------------------------+\n| IS_IPV6(\'48f3::d432:1431:ba23:846f\') |\n+--------------------------------------+\n| 1 |\n+--------------------------------------+\n1 row in set (0.02 sec)\n \nSELECT IS_IPV6(\'10.0.1.1\');\n+---------------------+\n| IS_IPV6(\'10.0.1.1\') |\n+---------------------+\n| 0 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/is_ipv6/','','https://mariadb.com/kb/en/library/is_ipv6/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (168,14,'IS_USED_LOCK','Syntax\n------ \nIS_USED_LOCK(str)\n \nDescription\n----------- \nChecks whether the lock named str is in use (that is,\nlocked). If so,\nit returns the connection identifier of the client that\nholds the\nlock. Otherwise, it returns NULL. str is case insensitive.\n \nIf the metadata_lock_info plugin is installed, the\nInformation Schema metadata_lock_info table contains\ninformation about locks of this kind (as well as metadata\nlocks).\n \nStatements using the IS_USED_LOCK() function are not safe\nfor replication.\n \n\n\nURL: https://mariadb.com/kb/en/library/is_used_lock/','','https://mariadb.com/kb/en/library/is_used_lock/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (169,14,'MASTER_GTID_WAIT','MASTER_GTID_WAIT() was included in MariaDB 10.0.9.\n \nSyntax\n------ \nMASTER_GTID_WAIT(gtid-list[, timeout)\n \nDescription\n----------- \nThis function takes a string containing a comma-separated\nlist of global transaction id\'s\n(similar to the value of, for example, gtid_binlog_pos). It\nwaits until the value of gtid_slave_pos has the same or\nhigher seq_no within all replication domains specified in\nthe gtid-list; in other words, it waits until the slave has\nreached the specified GTID position.\n \nAn optional second argument gives a timeout in seconds. If\nthe timeout\nexpires before the specified GTID position is reached, then\nthe function\nreturns -1. Passing NULL or a negative number for the\ntimeout means no timeout, and the function will wait\nindefinitely.\n \n If the wait completes without a timeout, 0 is returned.\nPassing NULL for the\n gtid-list makes the function return NULL immediately,\nwithout waiting.\n \nThe gtid-list may be the empty string, in which case\nMASTER_GTID_WAIT()\nreturns immediately. If the gtid-list contains fewer domains\nthan\ngtid_slave_pos, then only those domains are waited upon. If\ngtid-list\ncontains a domain that is not present in @@gtid_slave_pos,\nthen\nMASTER_GTID_WAIT() will wait until an event containing such\ndomain_id arrives\non the slave (or until timed out or killed).\n \nMASTER_GTID_WAIT() can be useful to ensure that a slave has\ncaught up to\na master. Simply take the value of gtid_binlog_pos on the\nmaster, and use it in a MASTER_GTID_WAIT() call on the\nslave; when the call completes, the slave\nwill have caught up with that master position.\n \nMASTER_GTID_WAIT() can also be used in client applications\ntogether with the\nlast_gtid session variable. This is useful in a\nread-scaleout replication setup, where the application\nwrites to a single master but divides the\nreads out to a number of slaves to distribute the load. In\nsuch a setup, there\nis a risk that an application could first do an update on\nthe master, and then\na bit later do a read on a slave, and if the slave is not\nfast enough, the\ndata read from the slave might not include the update just\nmade, possibly\nconfusing the application and/or the end-user. One way to\navoid this is to\nrequest the value of last_gtid on the master just after the\nupdate. Then\nbefore doing the read on the slave, do a MASTER_GTID_WAIT()\non the value\nobtained from the master; this will ensure that the read is\nnot performed\nuntil the slave has replicated sufficiently far for the\nupdate to have become\nvisible.\n \nNote that MASTER_GTID_WAIT() can be used even if the slave\nis configured not\nto use GTID for connections (CHANGE MASTER TO\nmaster_use_gtid=no). This is\nbecause from MariaDB 10, GTIDs are always logged on the\nmaster server, and\nalways recorded on the slave servers.\n \nDifferences to MASTER_POS_WAIT()\n \nMASTER_GTID_WAIT() is global; it waits for any master\nconnection to reach\n the specified GTID position. MASTER_POS_WAIT() works only\nagainst a\n specific connection. This also means that while\nMASTER_POS_WAIT() aborts if\n its master connection is terminated with STOP SLAVE or due\nto an error,\n MASTER_GTID_WAIT() continues to wait while slaves are\nstopped.\n \nMASTER_GTID_WAIT() can take its timeout as a floating-point\nvalue, so a\n timeout in fractional seconds is supported, eg.\nMASTER_GTID_WAIT(\"0-1-100\",\n 0.5). (The minimum wait is one microsecond, 0.000001\nseconds).\n \nMASTER_GTID_WAIT() allows one to specify a timeout of zero\nin order to do a\n non-blocking check to see if the slaves have progressed to\na specific GTID position\n (MASTER_POS_WAIT() takes a zero timeout as meaning an\ninfinite wait). To do\n an infinite MASTER_GTID_WAIT(), specify a negative timeout,\nor omit the\n timeout argument.\n \nMASTER_GTID_WAIT() does not return the number of events\nexecuted since the\n wait started, nor does it return NULL if a slave thread is\nstopped. It\n always returns either 0 for successful wait completed, or\n-1 for timeout\n reached (or NULL if the specified gtid-pos is NULL).\n \nSince MASTER_GTID_WAIT() looks only at the seq_no part of\nthe GTIDs, not the\nserver_id, care is needed if a slave becomes diverged from\nanother server so\nthat two different GTIDs with the same seq_no (in the same\ndomain) arrive at\nthe same server. This situation is in any case best avoided;\nsetting\ngtid_strict_mode is recommended, as this will prevent any\nsuch out-of-order sequence numbers from ever being\nreplicated on a slave.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/master_gtid_wait/','','https://mariadb.com/kb/en/library/master_gtid_wait/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (170,14,'MASTER_POS_WAIT','MASTER_POS_WAIT was introduced in MariaDB 10.0.9.\n \nSyntax\n------ \nMASTER_POS_WAIT(log_name,log_pos[,timeout,[\"connection_name\"]])\n \nDescription\n----------- \nThis function is useful in replication for controlling\nmaster/slave synchronization. It blocks until the slave has\nread and applied all updates up to the specified position\n(log_name,log_pos) in the master log. The return value is\nthe number of log events the slave had to wait for to\nadvance to the specified position. The function returns NULL\nif\nthe slave SQL thread is not started, the slave\'s master\ninformation is not\ninitialized, the arguments are incorrect, or an error\noccurs. It returns -1 if\nthe timeout has been exceeded. If the slave SQL thread stops\nwhile\n MASTER_POS_WAIT() is waiting, the function returns NULL. If\nthe slave is past the specified position, the function\nreturns immediately.\n \nIf a timeout value is specified, MASTER_POS_WAIT() stops\nwaiting when timeout seconds have elapsed. timeout must be\ngreater than 0; a\nzero or negative timeout means no timeout.\n \nThe connection_name is used when you are using\nmulti-source-replication. If you don\'t specify it, it\'s\nset to the value of the default_master_connection system\nvariable.\n \nStatements using the MASTER_POS_WAIT() function are not safe\nfor replication.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/master_pos_wait/','','https://mariadb.com/kb/en/library/master_pos_wait/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (171,14,'NAME_CONST','Syntax\n------ \nNAME_CONST(name,value)\n \nDescription\n----------- \nReturns the given value. When used to produce a result set\ncolumn,\n NAME_CONST() causes the column to have the given name. The\narguments should be constants.\n \nThis function is used internally when replicating stored\nprocedures. It makes little sense to use it explicitly in\nSQL statements, and it was not supposed to be used like\nthat.\n \nSELECT NAME_CONST(\'myname\', 14);\n+--------+\n| myname |\n+--------+\n| 14 |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/name_const/','','https://mariadb.com/kb/en/library/name_const/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (172,14,'RELEASE_LOCK','Syntax\n------ \nRELEASE_LOCK(str)\n \nDescription\n----------- \nReleases the lock named by the string str that was obtained\nwith GET_LOCK(). Returns 1 if the lock was released, 0 if\nthe lock was not established by this thread (in which case\nthe lock is not\nreleased), and NULL if the named lock did not exist. The\nlock does not exist if it was never obtained by a call to\nGET_LOCK() or if it has previously been released.\n \nMariaDB until 10.0.1\n \nBefore 10.0.2, GET_LOCK() released the existing lock, if\nany. Since 10.0.2 this does not happen, because multiple\nlocks are allowed.\n \nstr is case insensitive. If str is an empty string or NULL,\nRELEASE_LOCK() returns NULL and does nothing.\n \nStatements using the RELEASE_LOCK() function are not safe\nfor replication.\n \nThe DO statement is convenient to use with RELEASE_LOCK().\n \nExamples\n-------- \nConnection1:\n \nSELECT GET_LOCK(\'lock1\',10);\n+----------------------+\n| GET_LOCK(\'lock1\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 2:\n \nSELECT GET_LOCK(\'lock2\',10);\n+----------------------+\n| GET_LOCK(\'lock2\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nConnection 1:\n \nSELECT RELEASE_LOCK(\'lock1\'), RELEASE_LOCK(\'lock2\'),\nRELEASE_LOCK(\'lock3\');\n+-----------------------+-----------------------+-----------------------+\n| RELEASE_LOCK(\'lock1\') | RELEASE_LOCK(\'lock2\') |\nRELEASE_LOCK(\'lock3\') |\n+-----------------------+-----------------------+-----------------------+\n| 1 | 0 | NULL |\n+-----------------------+-----------------------+-----------------------+\n \nFrom MariaDB 10.0.2, it is possible to hold the same lock\nrecursively. This example is viewed using the\nmetadata_lock_info plugin:\n \nSELECT GET_LOCK(\'lock3\',10);\n+----------------------+\n| GET_LOCK(\'lock3\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT GET_LOCK(\'lock3\',10);\n+----------------------+\n| GET_LOCK(\'lock3\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \n+-----------+---------------------+---------------+-----------+--------------+------------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE |\nTABLE_SCHEMA | TABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n \nSELECT RELEASE_LOCK(\'lock3\');\n+-----------------------+\n| RELEASE_LOCK(\'lock3\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \n+-----------+---------------------+---------------+-----------+--------------+------------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE |\nTABLE_SCHEMA | TABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |\n+-----------+---------------------+---------------+-----------+--------------+------------+\n \nSELECT RELEASE_LOCK(\'lock3\');\n+-----------------------+\n| RELEASE_LOCK(\'lock3\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n \nEmpty set (0.000 sec)\n \n\n\nURL: https://mariadb.com/kb/en/library/release_lock/','','https://mariadb.com/kb/en/library/release_lock/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (173,14,'SLEEP','Syntax\n------ \nSLEEP(duration)\n \nDescription\n----------- \nSleeps (pauses) for the number of seconds given by the\nduration argument, then\nreturns 0. If SLEEP() is interrupted, it\nreturns 1. The duration may have a fractional part given in\nmicroseconds.\n \nStatements using the SLEEP() function are not safe for\nreplication.\n \nExample\n \nSELECT SLEEP(5.5);\n+------------+\n| SLEEP(5.5) |\n+------------+\n| 0 |\n+------------+\n1 row in set (5.50 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/sleep/','','https://mariadb.com/kb/en/library/sleep/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (174,14,'UUID','Syntax\n------ \nUUID()\n \nDescription\n----------- \nReturns a Universal Unique Identifier (UUID) generated\naccording to \"DCE 1.1:\nRemote Procedure Call\" (Appendix A) CAE (Common\nApplications Environment)\nSpecifications published by The Open Group in October\n1997 \n(Document Number C706).\n \nA UUID is designed as a number that is globally unique in\nspace and time. Two\ncalls to UUID() are expected to generate two different\nvalues, even if these calls are performed on two separate\ncomputers that are\nnot connected to each other.\n \nA UUID is a 128-bit number represented by a utf8 string of\nfive\nhexadecimal numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\nformat:\nThe first three numbers are generated from a timestamp.\nThe fourth number preserves temporal uniqueness in case the\ntimestamp value\n loses monotonicity (for example, due to daylight saving\ntime).\nThe fifth number is an IEEE 802 node number that provides\nspatial uniqueness.\n A random number is substituted if the latter is not\navailable (for example,\n because the host computer has no Ethernet card, or we do\nnot know how to find\n the hardware address of an interface on your operating\nsystem). In this case,\n spatial uniqueness cannot be guaranteed. Nevertheless, a\ncollision should\n have very low probability.\n \nCurrently, the MAC address of an interface is taken into\naccount only on FreeBSD and Linux. On other operating\nsystems, MariaDB uses a randomly generated 48-bit number.\n \nStatements using the UUID() function are not safe for\nreplication.\n \nUUID() results are intended to be unique, but cannot always\nbe relied upon to unpredictable and unguessable, so should\nnot be relied upon for these purposes.\n \nExamples\n-------- \nSELECT UUID();\n+--------------------------------------+\n| UUID() |\n+--------------------------------------+\n| cd41294a-afb0-11df-bc9b-00241dd75637 |\n+--------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/uuid/','','https://mariadb.com/kb/en/library/uuid/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (175,14,'UUID_SHORT','Syntax\n------ \nUUID_SHORT()\n \nDescription\n----------- \nReturns a \"short\" universal identifier as a 64-bit\nunsigned integer (rather\nthan a string-form 128-bit identifier as returned by the\nUUID() function).\n \nThe value of UUID_SHORT() is guaranteed to be unique if the\nfollowing conditions hold:\nThe server_id of the current host is unique among your set\nof master and\n slave servers\nserver_id is between 0 and 255\nYou don\'t set back your system time for your server between\nmysqld restarts\nYou do not invoke UUID_SHORT() on average more than 16\n million times per second between mysqld restarts\n \nThe UUID_SHORT() return value is constructed this way:\n \n (server_id & 255) \n\nURL: https://mariadb.com/kb/en/library/uuid_short/','','https://mariadb.com/kb/en/library/uuid_short/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (176,14,'VALUES / VALUE','Syntax\n------ \nVALUE(col_name) \n \nMariaDB until 10.3.2\n \nVALUES(col_name) \n \nDescription\n----------- \nIn an INSERT ... ON DUPLICATE KEY UPDATE statement, you can\nuse the VALUES(col_name) function in the UPDATE clause to\nrefer to column values from the INSERT portion of the\nstatement. In other words, VALUES(col_name) in the UPDATE\nclause refers to the value of col_name that would be\ninserted, had no duplicate-key conflict occurred. This\nfunction is especially useful in multiple-row inserts.\n \nThe VALUES() function is meaningful only in INSERT ... ON\nDUPLICATE KEY UPDATE statements and returns NULL otherwise.\n \nIn MariaDB 10.3.3 this function was renamed to VALUE(),\nbecause it\'s incompatible with the standard Table Value\nConstructors syntax, implemented in MariaDB 10.3.3.\n \nThe VALUES() function can still be used even from MariaDB\n10.3.3, but only in INSERT ... ON DUPLICATE KEY UPDATE\nstatements; it\'s a syntax error otherwise.\n \nExamples\n-------- \nINSERT INTO t (a,b,c) VALUES (1,2,3),(4,5,6)\n ON DUPLICATE KEY UPDATE c=VALUE(a)+VALUE(b);\n \nMariaDB until 10.3.2\n \nINSERT INTO t (a,b,c) VALUES (1,2,3),(4,5,6)\n ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/values-value/','','https://mariadb.com/kb/en/library/values-value/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (177,15,'!','Syntax\n------ \nNOT, !\n \nDescription\n----------- \nLogical NOT. Evaluates to 1 if the operand is 0, to 0 if the\noperand\nis non-zero, and NOT NULL returns NULL.\n \nBy default, the ! operator has a higher precedence. If the\nHIGH_NOT_PRECEDENCE SQL_MODE flag is set, NOT and ! have the\nsame precedence.\n \nExamples\n-------- \nSELECT NOT 10;\n \n+--------+\n| NOT 10 |\n+--------+\n| 0 |\n+--------+\n \nSELECT NOT 0;\n \n+-------+\n| NOT 0 |\n+-------+\n| 1 |\n+-------+\n \nSELECT NOT NULL;\n \n+----------+\n| NOT NULL |\n+----------+\n| NULL |\n+----------+\n \nSELECT ! (1+1);\n+---------+\n| ! (1+1) |\n+---------+\n| 0 |\n+---------+\n \nSELECT ! 1+1;\n \n+-------+\n| ! 1+1 |\n+-------+\n| 1 |\n+-------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/not/','','https://mariadb.com/kb/en/library/not/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (178,15,'&&','Syntax\n------ \nAND, &&\n \nDescription\n----------- \nLogical AND. Evaluates to 1 if all operands are non-zero and\nnot NULL,\nto 0 if one or more operands are 0, otherwise NULL is\nreturned.\n \nFor this operator, short-circuit evaluation can be used.\n \nExamples\n-------- \nSELECT 1 && 1;\n \n+--------+\n| 1 && 1 |\n+--------+\n| 1 |\n+--------+\n \nSELECT 1 && 0;\n \n+--------+\n| 1 && 0 |\n+--------+\n| 0 |\n+--------+\n \nSELECT 1 && NULL;\n \n+-----------+\n| 1 && NULL |\n+-----------+\n| NULL |\n+-----------+\n \nSELECT 0 && NULL;\n \n+-----------+\n| 0 && NULL |\n+-----------+\n| 0 |\n+-----------+\n \nSELECT NULL && 0;\n \n+-----------+\n| NULL && 0 |\n+-----------+\n| 0 |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/and/','','https://mariadb.com/kb/en/library/and/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (179,15,'||','Syntax\n------ \nOR, ||\n \nDescription\n----------- \nLogical OR. When both operands are non-NULL, the result is 1\nif any\noperand is non-zero, and 0 otherwise. With a NULL operand,\nthe result\nis 1 if the other operand is non-zero, and NULL otherwise.\nIf both\noperands are NULL, the result is NULL.\n \nFor this operator, short-circuit evaluation can be used.\n \nNote that, if the PIPES_AS_CONCAT SQL_MODE is set, || is\nused as a string concatenation operator. This means that a\n|| b is the same as CONCAT(a,b). See CONCAT() for details.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, || ignores NULL.\n \nExamples\n-------- \nSELECT 1 || 1;\n \n+--------+\n| 1 || 1 |\n+--------+\n| 1 |\n+--------+\n \nSELECT 1 || 0;\n \n+--------+\n| 1 || 0 |\n+--------+\n| 1 |\n+--------+\n \nSELECT 0 || 0;\n \n+--------+\n| 0 || 0 |\n+--------+\n| 0 |\n+--------+\n \nSELECT 0 || NULL;\n \n+-----------+\n| 0 || NULL |\n+-----------+\n| NULL |\n+-----------+\n \nSELECT 1 || NULL;\n \n+-----------+\n| 1 || NULL |\n+-----------+\n| 1 |\n+-----------+\n \nIn Oracle mode, from MariaDB 10.3:\n \nSELECT 0 || NULL;\n \n+-----------+\n| 0 || NULL |\n+-----------+\n| 0 |\n+-----------+\n \n\n\nURL: https://mariadb.com/kb/en/library/or/','','https://mariadb.com/kb/en/library/or/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (180,15,'XOR','Syntax\n------ \nXOR\n \nDescription\n----------- \nXOR stands for eXclusive OR. Returns NULL if either operand\nis NULL. For non-NULL\noperands, evaluates to 1 if an odd number of operands is\nnon-zero,\notherwise 0 is returned.\n \nExamples\n-------- \nSELECT 1 XOR 1;\n \n+---------+\n| 1 XOR 1 |\n+---------+\n| 0 |\n+---------+\n \nSELECT 1 XOR 0;\n \n+---------+\n| 1 XOR 0 |\n+---------+\n| 1 |\n+---------+\n \nSELECT 1 XOR NULL;\n \n+------------+\n| 1 XOR NULL |\n+------------+\n| NULL |\n+------------+\n \nIn the following example, the right 1 XOR 1 is evaluated\nfirst, and returns 0. Then, 1 XOR 0 is evaluated, and 1 is\nreturned.\n \nSELECT 1 XOR 1 XOR 1;\n \n+---------------+\n| 1 XOR 1 XOR 1 |\n+---------------+\n| 1 |\n+---------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/xor/','','https://mariadb.com/kb/en/library/xor/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (181,15,'Assignment Operator (=)','Syntax\n------ \nidentifier = expr\n \nDescription\n----------- \nThe equal sign is used as both an assignment operator in\ncertain contexts, and as a comparison operator. When used as\nassignment operator, the value on the right is assigned to\nthe variable (or column, in some contexts) on the left.\n \nSince its use can be ambiguous, unlike the := assignment\noperator, the = assignment operator cannot be used in all\ncontexts, and is only valid as part of a SET statement, or\nthe SET clause of an UPDATE statement\n \nThis operator works with both user-defined variables and\nlocal variables.\n \nExamples\n-------- \nUPDATE table_name SET x = 2 WHERE x > 100;\n \nSET @x = 1, @y := 2;\n \n\n \n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/assignment-operators-assignment-operator/','','https://mariadb.com/kb/en/library/assignment-operators-assignment-operator/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (182,15,'Assignment Operator (:=)','Syntax\n------ \nvar_name := expr\n \nDescription\n----------- \nAssignment operator for assigning a value. The value on the\nright is assigned to the variable on left.\n \nUnlike the = operator, := can always be used to assign a\nvalue to a variable.\n \nThis operator works with both user-defined variables and\nlocal variables.\n \nWhen assigning the same value to several variables,\nLAST_VALUE() can be useful.\n \nExamples\n-------- \n SELECT @x := 10;\n \n+----------+\n| @x := 10 |\n+----------+\n| 10 |\n+----------+\n \nSELECT @x, @y := @x;\n \n+------+----------+\n| @x | @y := @x |\n+------+----------+\n| 10 | 10 |\n+------+----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/assignment-operator/','','https://mariadb.com/kb/en/library/assignment-operator/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (183,16,'Stored Aggregate Functions','The ability to create stored aggregate functions was added\nin MariaDB 10.3.3.\n \nAggregate functions are functions that are computed over a\nsequence of rows and return one result for the sequence of\nrows.\n \nCreating a custom aggregate function is done using the\nCREATE FUNCTION statement with two main differences:\nThe addition of the AGGREGATE keyword, so CREATE AGGREGATE\nFUNCTION\nThe FETCH GROUP NEXT ROW instruction inside the loop\nOracle PL/SQL compatibility using SQL/PL is provided\n \nStandard Syntax\n \nCREATE AGGREGATE FUNCTION function_name (parameters) RETURNS\nreturn_type\nBEGIN\n All types of declarations\n DECLARE CONTINUE HANDLER FOR NOT FOUND RETURN return_val;\n LOOP\n FETCH GROUP NEXT ROW; // fetches next row from table\n other instructions\n END LOOP;\nEND\n \nStored aggregate functions were a 2016 Google Summer of Code\nproject by Varun Gupta.\n \nUsing SQL/PL\n \nSET sql_mode=Oracle;\nDELIMITER //\n \nCREATE AGGREGATE FUNCTION function_name (parameters) RETURN\nreturn_type\n declarations\nBEGIN\n LOOP\n FETCH GROUP NEXT ROW; -- fetches next row from table\n -- other instructions\n \n END LOOP;\nEXCEPTION\n WHEN NO_DATA_FOUND THEN\n RETURN return_val;\nEND //\n \nDELIMITER ;\n \nExamples\n-------- \nFirst a simplified example:\n \nCREATE TABLE marks(stud_id INT, grade_count INT);\n \nINSERT INTO marks VALUES (1,6), (2,4), (3,7), (4,5), (5,8);\n \nSELECT * FROM marks;\n \n+---------+-------------+\n| stud_id | grade_count |\n+---------+-------------+\n| 1 | 6 |\n| 2 | 4 |\n| 3 | 7 |\n| 4 | 5 |\n| 5 | 8 |\n+---------+-------------+\n \nDELIMITER //\nCREATE AGGREGATE FUNCTION IF NOT EXISTS aggregate_count(x\nINT) RETURNS INT\nBEGIN\n DECLARE count_students INT DEFAULT 0;\n \n DECLARE CONTINUE HANDLER FOR NOT FOUND\n RETURN count_students;\n \n LOOP\n FETCH GROUP NEXT ROW;\n \n IF x THEN\n SET count_students = count_students+1;\n \n END IF;\n \n END LOOP;\n \nEND //\nDELIMITER ;\n \nA non-trivial example that cannot easily be rewritten using\nexisting functions:\n \nDELIMITER //\nCREATE AGGREGATE FUNCTION medi_int(x INT) RETURNS DOUBLE\nBEGIN\n DECLARE CONTINUE HANDLER FOR NOT FOUND\n BEGIN\n DECLARE res DOUBLE;\n \n DECLARE cnt INT DEFAULT (SELECT COUNT(*) FROM tt);\n DECLARE lim INT DEFAULT (cnt-1) DIV 2;\n \n IF cnt % 2 = 0 THEN\n SET res = (SELECT AVG(a) FROM (SELECT a FROM tt ORDER BY a\nLIMIT lim,2) ttt);\n ELSE\n SET res = (SELECT a FROM tt ORDER BY a LIMIT lim,1);\n END IF;\n \n DROP TEMPORARY TABLE tt;\n \n RETURN res;\n \n END;\n \n CREATE TEMPORARY TABLE tt (a INT);\n LOOP\n FETCH GROUP NEXT ROW;\n \n INSERT INTO tt VALUES (x);\n END LOOP;\n \nEND //\nDELIMITER ;\n \nSQL/PL Example\n \nThis uses the same marks table as created above.\n \nSET sql_mode=Oracle;\n \nDELIMITER //\n \nCREATE AGGREGATE FUNCTION aggregate_count(x INT) RETURN INT\nAS count_students INT DEFAULT 0;\n \nBEGIN\n LOOP\n FETCH GROUP NEXT ROW;\n \n IF x THEN\n SET count_students := count_students+1;\n \n END IF;\n \n END LOOP;\n \nEXCEPTION\n WHEN NO_DATA_FOUND THEN\n RETURN count_students;\n \nEND aggregate_count //\nDELIMITER ;\n \nSELECT aggregate_count(stud_id) FROM marks;\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/stored-aggregate-functions/','','https://mariadb.com/kb/en/library/stored-aggregate-functions/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (184,16,'AVG','Syntax\n------ \nAVG([DISTINCT] expr)\n \nDescription\n----------- \nReturns the average value of expr. The DISTINCT option can\nbe used to return the average of the distinct values of\nexpr. NULL values are ignored. It is an aggregate function,\nand so can be used with the GROUP BY clause.\n \nAVG() returns NULL if there were no matching rows.\n \nFrom MariaDB 10.2.0, AVG() can be used as a window function.\n \nExamples\n-------- \nCREATE TABLE sales (sales_value INT);\n \nINSERT INTO sales VALUES(10),(20),(20),(40);\n \nSELECT AVG(sales_value) FROM sales;\n \n+------------------+\n| AVG(sales_value) |\n+------------------+\n| 22.5000 |\n+------------------+\n \nSELECT AVG(DISTINCT(sales_value)) FROM sales;\n \n+----------------------------+\n| AVG(DISTINCT(sales_value)) |\n+----------------------------+\n| 23.3333 |\n+----------------------------+\n \nCommonly, AVG() is used with a GROUP BY clause:\n \nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n \nSELECT name, AVG(score) FROM student GROUP BY name;\n \n+---------+------------+\n| name | AVG(score) |\n+---------+------------+\n| Chun | 74.0000 |\n| Esben | 37.0000 |\n| Kaolin | 72.0000 |\n| Tatiana | 85.0000 |\n+---------+------------+\n \nBe careful to avoid this common mistake, not grouping\ncorrectly and returning mismatched data: \n \nSELECT name,test,AVG(score) FROM student;\n \n+------+------+------------+\n| name | test | MIN(score) |\n+------+------+------------+\n| Chun | SQL | 31 |\n+------+------+------------+\n \nAs a window function:\n \nCREATE TABLE student_test (name CHAR(10), test CHAR(10),\nscore TINYINT); \n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n \nSELECT name, test, score, AVG(score) OVER (PARTITION BY\ntest) \n AS average_by_test FROM student_test;\n \n+---------+--------+-------+-----------------+\n| name | test | score | average_by_test |\n+---------+--------+-------+-----------------+\n| Chun | SQL | 75 | 65.2500 |\n| Chun | Tuning | 73 | 68.7500 |\n| Esben | SQL | 43 | 65.2500 |\n| Esben | Tuning | 31 | 68.7500 |\n| Kaolin | SQL | 56 | 65.2500 |\n| Kaolin | Tuning | 88 | 68.7500 |\n| Tatiana | SQL | 87 | 65.2500 |\n| Tatiana | Tuning | 83 | 68.7500 |\n+---------+--------+-------+-----------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/avg/','','https://mariadb.com/kb/en/library/avg/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (185,16,'BIT_AND','Syntax\n------ \nBIT_AND(expr)\n \nDescription\n----------- \nReturns the bitwise AND of all bits in expr. The calculation\nis performed with 64-bit (BIGINT) precision. It is an\naggregate function, and so can be used with the GROUP BY\nclause.\n \nFrom MariaDB 10.2.0, BIT_AND() can be used as a window\nfunction.\n \nExamples\n-------- \nCREATE TABLE vals (x INT);\n \nINSERT INTO vals VALUES(111),(110),(100);\n \nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n \n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n \nAs an aggregate function:\n \nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n \nINSERT INTO vals2 VALUES\n (\'a\',111),(\'a\',110),(\'a\',100),\n (\'b\',\'000\'),(\'b\',001),(\'b\',011);\n \nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n \n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/bit_and/','','https://mariadb.com/kb/en/library/bit_and/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (186,16,'BIT_OR','Syntax\n------ \nBIT_OR(expr)\n \nDescription\n----------- \nReturns the bitwise OR of all bits in expr. The calculation\nis performed with 64-bit (BIGINT) precision. It is an\naggregate function, and so can be used with the GROUP BY\nclause.\n \nFrom MariaDB 10.2.0, BIT_OR can be used as a window\nfunction.\n \nExamples\n-------- \nCREATE TABLE vals (x INT);\n \nINSERT INTO vals VALUES(111),(110),(100);\n \nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n \n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n \nAs an aggregate function:\n \nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n \nINSERT INTO vals2 VALUES\n (\'a\',111),(\'a\',110),(\'a\',100),\n (\'b\',\'000\'),(\'b\',001),(\'b\',011);\n \nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n \n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/bit_or/','','https://mariadb.com/kb/en/library/bit_or/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (187,16,'BIT_XOR','Syntax\n------ \nBIT_XOR(expr)\n \nDescription\n----------- \nReturns the bitwise XOR of all bits in expr. The calculation\nis performed with 64-bit (BIGINT) precision. It is an\naggregate function, and so can be used with the GROUP BY\nclause.\n \nFrom MariaDB 10.2.0, BIT_XOR() can be used as a window\nfunction.\n \nExamples\n-------- \nCREATE TABLE vals (x INT);\n \nINSERT INTO vals VALUES(111),(110),(100);\n \nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n \n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n \nAs an aggregate function:\n \nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n \nINSERT INTO vals2 VALUES\n (\'a\',111),(\'a\',110),(\'a\',100),\n (\'b\',\'000\'),(\'b\',001),(\'b\',011);\n \nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n \n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/bit_xor/','','https://mariadb.com/kb/en/library/bit_xor/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (188,16,'COUNT','Syntax\n------ \nCOUNT(expr)\n \nDescription\n----------- \nReturns a count of the number of non-NULL values of expr in\nthe rows retrieved by a SELECT statement. The result is a\nBIGINT value. It is an aggregate function, and so can be\nused with the GROUP BY clause.\n \nCOUNT(*) counts the total number of rows in a table.\n \nCOUNT() returns 0 if there were no matching rows.\n \nFrom MariaDB 10.2.0, COUNT() can be used as a window\nfunction.\n \nExamples\n-------- \nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n \nSELECT COUNT(*) FROM student;\n \n+----------+\n| COUNT(*) |\n+----------+\n| 8 |\n+----------+\n \nCOUNT(DISTINCT) example:\n \nSELECT COUNT(DISTINCT (name)) FROM student;\n \n+------------------------+\n| COUNT(DISTINCT (name)) |\n+------------------------+\n| 4 |\n+------------------------+\n \nAs a window function\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, COUNT(score) OVER (PARTITION BY\nname) \n AS tests_written FROM student_test;\n \n+---------+--------+-------+---------------+\n| name | test | score | tests_written |\n+---------+--------+-------+---------------+\n| Chun | SQL | 75 | 2 |\n| Chun | Tuning | 73 | 2 |\n| Esben | SQL | 43 | 2 |\n| Esben | Tuning | 31 | 2 |\n| Kaolin | SQL | 56 | 2 |\n| Kaolin | Tuning | 88 | 2 |\n| Tatiana | SQL | 87 | 1 |\n+---------+--------+-------+---------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/count/','','https://mariadb.com/kb/en/library/count/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (189,16,'GROUP_CONCAT','Syntax\n------ \nGROUP_CONCAT(expr)\n \nDescription\n----------- \nThis function returns a string result with the concatenated\nnon-NULL\nvalues from a group. It returns NULL if there are no\nnon-NULL values.\n \nThe maximum returned length in bytes is determined by the\ngroup_concat_max_len server system variable, which defaults\nto 1M (>= MariaDB 10.2.4) or 1K (\n\nURL: https://mariadb.com/kb/en/library/group_concat/','','https://mariadb.com/kb/en/library/group_concat/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (190,16,'MAX','Syntax\n------ \nMAX([DISTINCT] expr)\n \nDescription\n----------- \nReturns the largest, or maximum, value of expr. MAX() can\nalso take a string\nargument in which case it returns the maximum string value.\nThe DISTINCT\nkeyword can be used to find the maximum of the distinct\nvalues of expr,\nhowever, this produces the same result as omitting DISTINCT.\n \nNote that SET and ENUM fields are currently compared by\ntheir string value rather than their relative position in\nthe set, so MAX() may produce a different highest result\nthan ORDER BY DESC.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, MAX() can be used as a window function.\n \nMAX() returns NULL if there were no matching rows.\n \nExamples\n-------- \nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n \nSELECT name, MAX(score) FROM student GROUP BY name;\n \n+---------+------------+\n| name | MAX(score) |\n+---------+------------+\n| Chun | 75 |\n| Esben | 43 |\n| Kaolin | 88 |\n| Tatiana | 87 |\n+---------+------------+\n \nMAX string:\n \nSELECT MAX(name) FROM student;\n \n+-----------+\n| MAX(name) |\n+-----------+\n| Tatiana |\n+-----------+\n \nBe careful to avoid this common mistake, not grouping\ncorrectly and returning mismatched data: \n \nSELECT name,test,MAX(SCORE) FROM student;\n \n+------+------+------------+\n| name | test | MAX(SCORE) |\n+------+------+------------+\n| Chun | SQL | 88 |\n+------+------+------------+\n \nDifference between ORDER BY DESC and MAX():\n \nCREATE TABLE student2(name CHAR(10),grade\nENUM(\'b\',\'c\',\'a\'));\n \nINSERT INTO student2\nVALUES(\'Chun\',\'b\'),(\'Esben\',\'c\'),(\'Kaolin\',\'a\');\n \nSELECT MAX(grade) FROM student2;\n \n+------------+\n| MAX(grade) |\n+------------+\n| c |\n+------------+\n \nSELECT grade FROM student2 ORDER BY grade DESC LIMIT 1;\n \n+-------+\n| grade |\n+-------+\n| a |\n+-------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, MAX(score) \n OVER (PARTITION BY name) AS highest_score FROM\nstudent_test;\n \n+---------+--------+-------+---------------+\n| name | test | score | highest_score |\n+---------+--------+-------+---------------+\n| Chun | SQL | 75 | 75 |\n| Chun | Tuning | 73 | 75 |\n| Esben | SQL | 43 | 43 |\n| Esben | Tuning | 31 | 43 |\n| Kaolin | SQL | 56 | 88 |\n| Kaolin | Tuning | 88 | 88 |\n| Tatiana | SQL | 87 | 87 |\n+---------+--------+-------+---------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/max/','','https://mariadb.com/kb/en/library/max/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (191,16,'MIN','Syntax\n------ \nMIN([DISTINCT] expr)\n \nDescription\n----------- \nReturns the minimum value of expr. MIN() may take a string\nargument, in which case it returns the minimum string value.\nThe DISTINCT\nkeyword can be used to find the minimum of the distinct\nvalues of expr,\nhowever, this produces the same result as omitting DISTINCT.\n \nNote that SET and ENUM fields are currently compared by\ntheir string value rather than their relative position in\nthe set, so MIN() may produce a different lowest result than\nORDER BY ASC.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, MIN() can be used as a window function.\n \nMIN() returns NULL if there were no matching rows.\n \nExamples\n-------- \nCREATE TABLE student (name CHAR(10), test CHAR(10), score\nTINYINT); \n \nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n \nSELECT name, MIN(score) FROM student GROUP BY name;\n \n+---------+------------+\n| name | MIN(score) |\n+---------+------------+\n| Chun | 73 |\n| Esben | 31 |\n| Kaolin | 56 |\n| Tatiana | 83 |\n+---------+------------+\n \nMIN() with a string:\n \nSELECT MIN(name) FROM student;\n \n+-----------+\n| MIN(name) |\n+-----------+\n| Chun |\n+-----------+\n \nBe careful to avoid this common mistake, not grouping\ncorrectly and returning mismatched data: \n \nSELECT name,test,MIN(score) FROM student;\n \n+------+------+------------+\n| name | test | MIN(score) |\n+------+------+------------+\n| Chun | SQL | 31 |\n+------+------+------------+\n \nDifference between ORDER BY ASC and MIN():\n \nCREATE TABLE student2(name CHAR(10),grade\nENUM(\'b\',\'c\',\'a\'));\n \nINSERT INTO student2\nVALUES(\'Chun\',\'b\'),(\'Esben\',\'c\'),(\'Kaolin\',\'a\');\n \nSELECT MIN(grade) FROM student2;\n \n+------------+\n| MIN(grade) |\n+------------+\n| a |\n+------------+\n \nSELECT grade FROM student2 ORDER BY grade ASC LIMIT 1;\n \n+-------+\n| grade |\n+-------+\n| b |\n+-------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, MIN(score) \n OVER (PARTITION BY name) AS lowest_score FROM student_test;\n \n+---------+--------+-------+--------------+\n| name | test | score | lowest_score |\n+---------+--------+-------+--------------+\n| Chun | SQL | 75 | 73 |\n| Chun | Tuning | 73 | 73 |\n| Esben | SQL | 43 | 31 |\n| Esben | Tuning | 31 | 31 |\n| Kaolin | SQL | 56 | 56 |\n| Kaolin | Tuning | 88 | 56 |\n| Tatiana | SQL | 87 | 87 |\n+---------+--------+-------+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/min/','','https://mariadb.com/kb/en/library/min/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (192,16,'STD','Syntax\n------ \nSTD(expr)\n \nDescription\n----------- \nReturns the population standard deviation of expr. This is\nan extension\nto standard SQL. The standard SQL function STDDEV_POP() can\nbe used instead. \n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, STD() can be used as a window function.\n \nThis function returns NULL if there were no matching rows.\n \nExamples\n-------- \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM\nstudent_test;\n \n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n| Kaolin | SQL | 56 | 16.9466 |\n| Kaolin | Tuning | 88 | 24.1247 |\n| Tatiana | SQL | 87 | 16.9466 |\n+---------+--------+-------+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/std/','','https://mariadb.com/kb/en/library/std/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (193,16,'STDDEV','Syntax\n------ \nSTDDEV(expr)\n \nDescription\n----------- \nReturns the population standard deviation of expr. This\nfunction is\nprovided for compatibility with Oracle. The standard SQL\nfunction\nSTDDEV_POP() can be used instead.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, STDDEV() can be used as a window\nfunction.\n \nThis function returns NULL if there were no matching rows.\n \nExamples\n-------- \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM\nstudent_test;\n \n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n| Kaolin | SQL | 56 | 16.9466 |\n| Kaolin | Tuning | 88 | 24.1247 |\n| Tatiana | SQL | 87 | 16.9466 |\n+---------+--------+-------+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/stddev/','','https://mariadb.com/kb/en/library/stddev/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (194,16,'STDDEV_POP','Syntax\n------ \nSTDDEV_POP(expr)\n \nDescription\n----------- \nReturns the population standard deviation of expr (the\nsquare root of\nVAR_POP()). You can also use STD() or\nSTDDEV(), which are equivalent but not standard SQL.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, STDDEV_POP() can be used as a window\nfunction.\n \nSTDDEV_POP() returns NULL if there were no matching rows.\n \nExamples\n-------- \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM\nstudent_test;\n \n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n| Kaolin | SQL | 56 | 16.9466 |\n| Kaolin | Tuning | 88 | 24.1247 |\n| Tatiana | SQL | 87 | 16.9466 |\n+---------+--------+-------+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/stddev_pop/','','https://mariadb.com/kb/en/library/stddev_pop/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (195,16,'STDDEV_SAMP','Syntax\n------ \nSTDDEV_SAMP(expr)\n \nDescription\n----------- \nReturns the sample standard deviation of expr (the square\nroot of VAR_SAMP()).\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, STDDEV_SAMP() can be used as a window\nfunction.\n \nSTDDEV_SAMP() returns NULL if there were no matching rows.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/stddev_samp/','','https://mariadb.com/kb/en/library/stddev_samp/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (196,16,'SUM','Syntax\n------ \nSUM([DISTINCT] expr)\n \nDescription\n----------- \nReturns the sum of expr. If the return set has no rows,\nSUM() returns\nNULL. The DISTINCT keyword can be used to sum only the\ndistinct values\nof expr.\n \nFrom MariaDB 10.2.0, SUM() can be used as a window function,\nalthough not with the DISTINCT specifier.\n \nExamples\n-------- \nCREATE TABLE sales (sales_value INT);\nINSERT INTO sales VALUES(10),(20),(20),(40);\n \nSELECT SUM(sales_value) FROM sales;\n \n+------------------+\n| SUM(sales_value) |\n+------------------+\n| 90 |\n+------------------+\n \nSELECT SUM(DISTINCT(sales_value)) FROM sales;\n \n+----------------------------+\n| SUM(DISTINCT(sales_value)) |\n+----------------------------+\n| 70 |\n+----------------------------+\n \nCommonly, SUM is used with a GROUP BY clause:\n \nCREATE TABLE sales (name CHAR(10), month CHAR(10), units\nINT);\n \nINSERT INTO sales VALUES \n (\'Chun\', \'Jan\', 75), (\'Chun\', \'Feb\', 73),\n (\'Esben\', \'Jan\', 43), (\'Esben\', \'Feb\', 31),\n (\'Kaolin\', \'Jan\', 56), (\'Kaolin\', \'Feb\', 88),\n (\'Tatiana\', \'Jan\', 87), (\'Tatiana\', \'Feb\', 83);\n \nSELECT name, SUM(units) FROM sales GROUP BY name;\n \n+---------+------------+\n| name | SUM(units) |\n+---------+------------+\n| Chun | 148 |\n| Esben | 74 |\n| Kaolin | 144 |\n| Tatiana | 170 |\n+---------+------------+\n \nThe GROUP BY clause is required when using an aggregate\nfunction along with regular column data, otherwise the\nresult will be a mismatch, as in the following common type\nof mistake:\n \nSELECT name,SUM(units) FROM sales\n;\n+------+------------+\n| name | SUM(units) |\n+------+------------+\n| Chun | 536 |\n+------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, SUM(score) OVER (PARTITION BY\nname) AS total_score FROM student_test;\n \n+---------+--------+-------+-------------+\n| name | test | score | total_score |\n+---------+--------+-------+-------------+\n| Chun | SQL | 75 | 148 |\n| Chun | Tuning | 73 | 148 |\n| Esben | SQL | 43 | 74 |\n| Esben | Tuning | 31 | 74 |\n| Kaolin | SQL | 56 | 144 |\n| Kaolin | Tuning | 88 | 144 |\n| Tatiana | SQL | 87 | 87 |\n+---------+--------+-------+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/sum/','','https://mariadb.com/kb/en/library/sum/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (197,16,'VARIANCE','Syntax\n------ \nVARIANCE(expr) \n \nDescription\n----------- \nReturns the population standard variance of expr. This is an\nextension to\nstandard SQL. The standard SQL function VAR_POP() can be\nused\ninstead.\n \nVariance is calculated by\nworking out the mean for the set\nfor each number, subtracting the mean and squaring the\nresult\ncalculate the average of the resulting differences\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, VARIANCE() can be used as a window\nfunction.\n \nVARIANCE() returns NULL if there were no matching rows.\n \nExamples\n-------- \nCREATE TABLE v(i tinyint);\n \nINSERT INTO v VALUES(101),(99);\n \nSELECT VARIANCE(i) FROM v;\n \n+-------------+\n| VARIANCE(i) |\n+-------------+\n| 1.0000 |\n+-------------+\n \nINSERT INTO v VALUES(120),(80);\n \nSELECT VARIANCE(i) FROM v;\n \n+-------------+\n| VARIANCE(i) |\n+-------------+\n| 200.5000 |\n+-------------+\n \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, VAR_POP(score) \n OVER (PARTITION BY test) AS variance_results FROM\nstudent_test;\n \n+---------+--------+-------+------------------+\n| name | test | score | variance_results |\n+---------+--------+-------+------------------+\n| Chun | SQL | 75 | 287.1875 |\n| Chun | Tuning | 73 | 582.0000 |\n| Esben | SQL | 43 | 287.1875 |\n| Esben | Tuning | 31 | 582.0000 |\n| Kaolin | SQL | 56 | 287.1875 |\n| Kaolin | Tuning | 88 | 582.0000 |\n| Tatiana | SQL | 87 | 287.1875 |\n+---------+--------+-------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/variance/','','https://mariadb.com/kb/en/library/variance/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (198,16,'VAR_POP','Syntax\n------ \nVAR_POP(expr)\n \nDescription\n----------- \nReturns the population standard variance of expr. It\nconsiders rows as\nthe whole population, not as a sample, so it has the number\nof rows as\nthe denominator. You can also use VARIANCE(), which is\nequivalent but\nis not standard SQL.\n \nVariance is calculated by\nworking out the mean for the set\nfor each number, subtracting the mean and squaring the\nresult\ncalculate the average of the resulting differences\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, VAR_POP() can be used as a window\nfunction.\n \nVAR_POP() returns NULL if there were no matching rows.\n \nExamples\n-------- \nCREATE TABLE v(i tinyint);\n \nINSERT INTO v VALUES(101),(99);\n \nSELECT VAR_POP(i) FROM v;\n \n+------------+\n| VAR_POP(i) |\n+------------+\n| 1.0000 |\n+------------+\n \nINSERT INTO v VALUES(120),(80);\n \nSELECT VAR_POP(i) FROM v;\n \n+------------+\n| VAR_POP(i) |\n+------------+\n| 200.5000 |\n+------------+\n \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, VAR_POP(score) \n OVER (PARTITION BY test) AS variance_results FROM\nstudent_test;\n \n+---------+--------+-------+------------------+\n| name | test | score | variance_results |\n+---------+--------+-------+------------------+\n| Chun | SQL | 75 | 287.1875 |\n| Chun | Tuning | 73 | 582.0000 |\n| Esben | SQL | 43 | 287.1875 |\n| Esben | Tuning | 31 | 582.0000 |\n| Kaolin | SQL | 56 | 287.1875 |\n| Kaolin | Tuning | 88 | 582.0000 |\n| Tatiana | SQL | 87 | 287.1875 |\n+---------+--------+-------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/var_pop/','','https://mariadb.com/kb/en/library/var_pop/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (199,16,'VAR_SAMP','Syntax\n------ \nVAR_SAMP(expr)\n \nDescription\n----------- \nReturns the sample variance of expr. That is, the\ndenominator is the number of rows minus one.\n \nIt is an aggregate function, and so can be used with the\nGROUP BY clause.\n \nFrom MariaDB 10.2.2, VAR_SAMP() can be used as a window\nfunction.\n \nVAR_SAMP() returns NULL if there were no matching rows.\n \nExamples\n-------- \nAs an aggregate function:\n \nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n \nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n \nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n \n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n \nAs a window function:\n \nCREATE OR REPLACE TABLE student_test (name CHAR(10), test\nCHAR(10), score TINYINT);\n \nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73), \n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31), \n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88), \n (\'Tatiana\', \'SQL\', 87);\n \nSELECT name, test, score, VAR_SAMP(score) \n OVER (PARTITION BY test) AS variance_results FROM\nstudent_test;\n \n+---------+--------+-------+------------------+\n| name | test | score | variance_results |\n+---------+--------+-------+------------------+\n| Chun | SQL | 75 | 382.9167 |\n| Chun | Tuning | 73 | 873.0000 |\n| Esben | SQL | 43 | 382.9167 |\n| Esben | Tuning | 31 | 873.0000 |\n| Kaolin | SQL | 56 | 382.9167 |\n| Kaolin | Tuning | 88 | 873.0000 |\n| Tatiana | SQL | 87 | 382.9167 |\n+---------+--------+-------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/var_samp/','','https://mariadb.com/kb/en/library/var_samp/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (200,17,'BENCHMARK','Syntax\n------ \nBENCHMARK(count,expr)\n \nDescription\n----------- \nThe BENCHMARK() function executes the expression expr\nrepeatedly count\ntimes. It may be used to time how quickly MariaDB processes\nthe\nexpression. The result value is always 0. The intended use\nis from\nwithin the mysql client, which reports query execution\ntimes.\n \nExamples\n-------- \nSELECT BENCHMARK(1000000,ENCODE(\'hello\',\'goodbye\'));\n+----------------------------------------------+\n| BENCHMARK(1000000,ENCODE(\'hello\',\'goodbye\')) |\n+----------------------------------------------+\n| 0 |\n+----------------------------------------------+\n1 row in set (0.21 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/benchmark/','','https://mariadb.com/kb/en/library/benchmark/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (201,17,'BINLOG_GTID_POS','From version 10.0.2, MariaDB supports global transaction IDs\nfor replication.\n \nSyntax\n------ \nBINLOG_GTID_POS(binlog_filename,binlog_offset)\n \nDescription\n----------- \nThe BINLOG_GTID_POS() function takes as input an old-style\nbinary log position in the form of a file name and a file\noffset. It looks up the position in the current binlog, and\nreturns a string representation of the corresponding GTID\nposition. If the position is not found in the current\nbinlog, NULL is returned.\n \nExamples\n-------- \nSELECT BINLOG_GTID_POS(\"master-bin.000001\", 600);\n \n\n\nURL: https://mariadb.com/kb/en/library/binlog_gtid_pos/','','https://mariadb.com/kb/en/library/binlog_gtid_pos/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (202,17,'CHARSET','Syntax\n------ \nCHARSET(str)\n \nDescription\n----------- \nReturns the character set of the string argument. If str is\nnot a string, it is considered as a binary string (so the\nfunction returns \'binary\'). This applies to NULL, too. The\nreturn value is a string in the utf8 character set.\n \nExamples\n-------- \nSELECT CHARSET(\'abc\');\n+----------------+\n| CHARSET(\'abc\') |\n+----------------+\n| latin1 |\n+----------------+\n \nSELECT CHARSET(CONVERT(\'abc\' USING utf8));\n+------------------------------------+\n| CHARSET(CONVERT(\'abc\' USING utf8)) |\n+------------------------------------+\n| utf8 |\n+------------------------------------+\n \nSELECT CHARSET(USER());\n+-----------------+\n| CHARSET(USER()) |\n+-----------------+\n| utf8 |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/charset/','','https://mariadb.com/kb/en/library/charset/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (203,17,'COERCIBILITY','Syntax\n------ \nCOERCIBILITY(str)\n \nDescription\n----------- \nReturns the collation coercibility value of the string\nargument. Coercibility defines what will be converted to\nwhat in case of collation conflict, with an expression with\nhigher coercibility being converted to the collation of an\nexpression with lower coercibility.\n \nCoercibility | Description | Example | \n \n0 | Explicit | Value using a COLLATE clause | \n \n1 | No collation | Concatenated strings using different\ncollations | \n \n2 | Implicit | Column value | \n \n3 | Constant | USER() return value | \n \n4 | Coercible | Literal string | \n \n5 | Ignorable | NULL or derived from NULL | \n \nExamples\n-------- \nSELECT COERCIBILITY(\'abc\' COLLATE latin1_swedish_ci);\n+-----------------------------------------------+\n| COERCIBILITY(\'abc\' COLLATE latin1_swedish_ci) |\n+-----------------------------------------------+\n| 0 |\n+-----------------------------------------------+\n \nSELECT COERCIBILITY(USER());\n+----------------------+\n| COERCIBILITY(USER()) |\n+----------------------+\n| 3 |\n+----------------------+\n \nSELECT COERCIBILITY(\'abc\');\n+---------------------+\n| COERCIBILITY(\'abc\') |\n+---------------------+\n| 4 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/coercibility/','','https://mariadb.com/kb/en/library/coercibility/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (204,17,'COLLATION','Syntax\n------ \nCOLLATION(str)\n \nDescription\n----------- \nReturns the collation of the string argument. If str is not\na string, it is considered as a binary string (so the\nfunction returns \'binary\'). This applies to NULL, too. The\nreturn value is a string in the utf8 character set.\n \nSee Character Sets and Collations.\n \nExamples\n-------- \nSELECT COLLATION(\'abc\');\n+-------------------+\n| COLLATION(\'abc\') |\n+-------------------+\n| latin1_swedish_ci |\n+-------------------+\n \nSELECT COLLATION(_utf8\'abc\');\n+-----------------------+\n| COLLATION(_utf8\'abc\') |\n+-----------------------+\n| utf8_general_ci |\n+-----------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/collation/','','https://mariadb.com/kb/en/library/collation/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (205,17,'CONNECTION_ID','Syntax\n------ \nCONNECTION_ID()\n \nDescription\n----------- \nReturns the connection ID (thread ID) for the connection.\nEvery\nthread (including events) has an ID that is unique among the\nset of currently\nconnected clients.\n \nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or\nbigint(10), in all cases. From MariaDB 10.3.1, returns\nMYSQL_TYPE_LONG, or int(10), when the result would fit\nwithin 32-bits.\n \nExamples\n-------- \nSELECT CONNECTION_ID();\n+-----------------+\n| CONNECTION_ID() |\n+-----------------+\n| 3 |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/connection_id/','','https://mariadb.com/kb/en/library/connection_id/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (206,17,'CURRENT_ROLE','Roles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nCURRENT_ROLE, CURRENT_ROLE()\n \nDescription\n----------- \nReturns the current role name. This determines your access\nprivileges. The return value is a string in the\nutf8 character set.\n \nIf there is no current role, NULL is returned.\n \nThe output of SELECT CURRENT_ROLE is equivalent to the\ncontents of the ENABLED_ROLES Information Schema table.\n \nUSER() returns the combination of user and host used to\nlogin. CURRENT_USER() returns the account used to determine\ncurrent connection\'s privileges.\n \nExamples\n-------- \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n \nSET ROLE staff;\n \nSELECT CURRENT_ROLE;\n \n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| staff |\n+--------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/current_role/','','https://mariadb.com/kb/en/library/current_role/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (207,17,'CURRENT_USER','Syntax\n------ \nCURRENT_USER, CURRENT_USER()\n \nDescription\n----------- \nReturns the user name and host name combination for the\nMariaDB account\nthat the server used to authenticate the current client.\nThis account\ndetermines your access privileges. The return value is a\nstring in the\nutf8 character set.\n \nThe value of CURRENT_USER() can differ from the value of\nUSER(). CURRENT_ROLE() returns the current active role.\n \nExamples\n-------- \nshell> mysql --user=\"anonymous\"\n \nMariaDB [(none)]> select user(),current_user();\n+---------------------+----------------+\n| user() | current_user() |\n+---------------------+----------------+\n| anonymous@localhost | @localhost |\n+---------------------+----------------+\n \nWhen calling CURRENT_USER() in a stored procedure, it\nreturns the owner of the stored procedure, as defined with\nDEFINER.\n \n\n\nURL: https://mariadb.com/kb/en/library/current_user/','','https://mariadb.com/kb/en/library/current_user/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (208,17,'DATABASE','Syntax\n------ \nDATABASE()\n \nDescription\n----------- \nReturns the default (current) database name as a string in\nthe utf8 character set. If there is no default database,\nDATABASE() returns NULL. Within a stored routine, the\ndefault database is the database that the routine is\nassociated with, which is not necessarily the same as the\ndatabase that is the default in the calling context.\n \nSCHEMA() is a synonym for DATABASE().\n \nTo select a default database, the USE statement can be run.\nAnother way to set the default database is specifying its\nname at mysql command line client startup.\n \nExamples\n-------- \nSELECT DATABASE();\n+------------+\n| DATABASE() |\n+------------+\n| NULL |\n+------------+\n \nUSE test;\n \nDatabase changed\n \nSELECT DATABASE();\n+------------+\n| DATABASE() |\n+------------+\n| test |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/database/','','https://mariadb.com/kb/en/library/database/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (209,17,'DECODE_HISTOGRAM','DECODE_HISTOGRAM() was introduced in MariaDB 10.0.2\n \nSyntax\n------ \nDECODE_HISTOGRAM(hist_type,histogram)\n \nNote: Before MariaDB 10.0.10 the arguments were reversed.\n \nDescription\n----------- \nReturns a string of comma separated numeric values\ncorresponding to a probability distribution represented by\nthe histogram of type hist_type (SINGLE_PREC_HB or\nDOUBLE_PREC_HB). The hist_type and histogram would be\ncommonly used from the mysql.column_stats table.\n \nSee Histogram Based Statistics for details.\n \nExamples\n-------- \nCREATE TABLE origin (\n i INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\n v INT UNSIGNED NOT NULL\n);\n \nINSERT INTO origin(v) VALUES \n (1),(2),(3),(4),(5),(10),(20),\n (30),(40),(50),(60),(70),(80),\n (90),(100),(200),(400),(800);\n \nSET histogram_size=10,histogram_type=SINGLE_PREC_HB;\n \nANALYZE TABLE origin PERSISTENT FOR ALL;\n \n+-------------+---------+----------+-----------------------------------------+\n| Table | Op | Msg_type | Msg_text |\n+-------------+---------+----------+-----------------------------------------+\n| test.origin | analyze | status | Engine-independent\nstatistics collected |\n| test.origin | analyze | status | OK |\n+-------------+---------+----------+-----------------------------------------+\n \nSELECT db_name,table_name,column_name,hist_type,\n hex(histogram),decode_histogram(hist_type,histogram) \n FROM mysql.column_stats WHERE db_name=\'test\' and\ntable_name=\'origin\';\n \n+---------+------------+-------------+----------------+----------------------+-------------------------------------------------------------------+\n| db_name | table_name | column_name | hist_type |\nhex(histogram) | decode_histogram(hist_type,histogram) |\n+---------+------------+-------------+----------------+----------------------+-------------------------------------------------------------------+\n| test | origin | i | SINGLE_PREC_HB | 0F2D3C5A7887A5C3D2F0\n|\n0.059,0.118,0.059,0.118,0.118,0.059,0.118,0.118,0.059,0.118,0.059\n|\n| test | origin | v | SINGLE_PREC_HB | 000001060C0F161C1F7F\n|\n0.000,0.000,0.004,0.020,0.024,0.012,0.027,0.024,0.012,0.376,0.502\n|\n+---------+------------+-------------+----------------+----------------------+-------------------------------------------------------------------+\n \nSET histogram_size=20,histogram_type=DOUBLE_PREC_HB;\n \nANALYZE TABLE origin PERSISTENT FOR ALL;\n \n+-------------+---------+----------+-----------------------------------------+\n| Table | Op | Msg_type | Msg_text |\n+-------------+---------+----------+-----------------------------------------+\n| test.origin | analyze | status | Engine-independent\nstatistics collected |\n| test.origin | analyze | status | OK |\n+-------------+---------+----------+-----------------------------------------+\n \nSELECT db_name,table_name,column_name,\n hist_type,hex(histogram),decode_histogram(hist_type,histogram)\n\n FROM mysql.column_stats WHERE db_name=\'test\' and\ntable_name=\'origin\';\n \n+---------+------------+-------------+----------------+------------------------------------------+-----------------------------------------------------------------------------------------+\n| db_name | table_name | column_name | hist_type |\nhex(histogram) | decode_histogram(hist_type,histogram) |\n+---------+------------+-------------+----------------+------------------------------------------+-----------------------------------------------------------------------------------------+\n| test | origin | i | DOUBLE_PREC_HB |\n0F0F2D2D3C3C5A5A78788787A5A5C3C3D2D2F0F0 |\n0.05882,0.11765,0.05882,0.11765,0.11765,0.05882,0.11765,0.11765,0.05882,0.11765,0.05882\n|\n| test | origin | v | DOUBLE_PREC_HB |\n5200F600480116067E0CB30F1B16831CB81FD67F |\n0.00125,0.00250,0.00125,0.01877,0.02502,0.01253,0.02502,0.02502,0.01253,0.37546,0.50063\n|\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/decode_histogram/','','https://mariadb.com/kb/en/library/decode_histogram/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (210,17,'DEFAULT','Syntax\n------ \nDEFAULT(col_name)\n \nDescription\n----------- \nReturns the default value for a table column. If the column\nhas no default value, NULL is returned.\nFor integer columns using AUTO_INCREMENT, 0 is returned.\n \nWhen using DEFAULT as a value to set in an INSERT or UPDATE\nstatement, you can use the bare keyword DEFAULT without the\nparentheses and argument to\nrefer to the column in context. You can only use DEFAULT as\na bare keyword if you are using it\nalone without a surrounding expression or function.\n \nExamples\n-------- \nSelect only non-default values for a column:\n \nSELECT i FROM t WHERE i != DEFAULT(i);\n \nUpdate values to be one greater than the default value:\n \nUPDATE t SET i = DEFAULT(i)+1 WHERE i \n\nURL: https://mariadb.com/kb/en/library/default/','','https://mariadb.com/kb/en/library/default/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (211,17,'FOUND_ROWS','Syntax\n------ \nFOUND_ROWS()\n \nDescription\n----------- \nA SELECT statement may include a LIMIT clause to restrict\nthe number\nof rows the server returns to the client. In some cases, it\nis\ndesirable to know how many rows the statement would have\nreturned\nwithout the LIMIT, but without running the statement again.\nTo obtain\nthis row count, include a SQL_CALC_FOUND_ROWS option in the\nSELECT\nstatement, and then invoke FOUND_ROWS() afterwards.\n \nYou can also use FOUND_ROWS() to obtain the number of rows\nreturned by a SELECT which does not contain a LIMIT clause.\nIn this case you don\'t need to use the SQL_CALC_FOUND_ROWS\noption. This can be useful for example in a stored\nprocedure.\n \nAlso, this function works with some other statements which\nreturn a resultset, including SHOW, DESC and HELP. For\nDELETE ... RETURNING you should use ROW_COUNT(). It also\nworks as a prepared statement, or after executing a prepared\nstatement.\n \nStatements which don\'t return any results don\'t affect\nFOUND_ROWS() - the previous value will still be returned.\n \nWarning: When used after a CALL statement, this function\nreturns the number of rows selected by the last query in the\nprocedure, not by the whole procedure.\n \nStatements using the FOUND_ROWS() function are not safe for\nreplication.\n \nExamples\n-------- \nSHOW ENGINES;\n \n+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+\n| Engine | Support | Comment | Transactions | XA |\nSavepoints |\n+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+\n| InnoDB | DEFAULT | Supports transactions, row-level\nlocking, and foreign keys | YES | YES | YES |\n...\n| SPHINX | YES | Sphinx storage engine | NO | NO | NO |\n+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+\n11 rows in set (0.01 sec)\n \nSELECT FOUND_ROWS();\n+--------------+\n| FOUND_ROWS() |\n+--------------+\n| 11 |\n+--------------+\n \nSELECT SQL_CALC_FOUND_ROWS * FROM tbl_name WHERE id > 100\nLIMIT 10;\n \nSELECT FOUND_ROWS();\n+--------------+\n| FOUND_ROWS() |\n+--------------+\n| 23 |\n+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/found_rows/','','https://mariadb.com/kb/en/library/found_rows/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (212,17,'LAST_INSERT_ID','Syntax\n------ \nLAST_INSERT_ID(), LAST_INSERT_ID(expr)\n \nDescription\n----------- \nLAST_INSERT_ID() (no arguments) returns\nthe first automatically generated value successfully\ninserted for an\nAUTO_INCREMENT column as a result of the most recently\nexecuted INSERT\nstatement. The value of LAST_INSERT_ID() remains unchanged\nif no rows\nare successfully inserted.\n \nIf one gives an argument to LAST_INSERT_ID(), then it will\nreturn the value of the expression and\nthe next call to LAST_INSERT_ID() will return the same\nvalue. The value will also be sent to the client\nand can be accessed by the mysql_insert_id function.\n \nFor example, after inserting a row that generates an\nAUTO_INCREMENT\nvalue, you can get the value like this:\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 9 |\n+------------------+\n \nYou can also use LAST_INSERT_ID() to delete the last\ninserted row:\n \nDELETE FROM product WHERE id = LAST_INSERT_ID();\n \nIf no rows were successfully inserted, LAST_INSERT_ID()\nreturns 0.\n \nThe value of LAST_INSERT_ID() will be consistent across all\nversions\nif all rows in the INSERT or UPDATE statement were\nsuccessful.\n \nThe currently executing statement does not affect the value\nof\nLAST_INSERT_ID(). Suppose that you generate an\nAUTO_INCREMENT value\nwith one statement, and then refer to LAST_INSERT_ID() in a\nmultiple-row INSERT statement that inserts rows into a table\nwith its\nown AUTO_INCREMENT column. The value of LAST_INSERT_ID()\nwill remain\nstable in the second statement; its value for the second and\nlater\nrows is not affected by the earlier row insertions.\n(However, if you\nmix references to LAST_INSERT_ID() and LAST_INSERT_ID(expr),\nthe\neffect is undefined.)\n \nIf the previous statement returned an error, the value of\nLAST_INSERT_ID() is undefined. For transactional tables, if\nthe\nstatement is rolled back due to an error, the value of\nLAST_INSERT_ID() is left undefined. For manual ROLLBACK, the\nvalue of\nLAST_INSERT_ID() is not restored to that before the\ntransaction; it\nremains as it was at the point of the ROLLBACK.\n \nWithin the body of a stored routine (procedure or function)\nor a\ntrigger, the value of LAST_INSERT_ID() changes the same way\nas for\nstatements executed outside the body of these kinds of\nobjects. The\neffect of a stored routine or trigger upon the value of\nLAST_INSERT_ID() that is seen by following statements\ndepends on the\nkind of routine:\nIf a stored procedure executes statements that change the\nvalue of LAST_INSERT_ID(), the new value will be seen by\nstatements that follow the procedure call.\n \nFor stored functions and triggers that change the value, the\nvalue is restored when the function or trigger ends, so\nfollowing statements will not see a changed value.\n \nExamples\n-------- \nCREATE TABLE t (\n id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY, \n f VARCHAR(1)) \nENGINE = InnoDB;\n \nINSERT INTO t(f) VALUES(\'a\');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 1 |\n+------------------+\n \nINSERT INTO t(f) VALUES(\'b\');\n \nINSERT INTO t(f) VALUES(\'c\');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 3 |\n+------------------+\n \nINSERT INTO t(f) VALUES(\'d\'),(\'e\');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 4 |\n+------------------+\n \nSELECT * FROM t;\n \n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n+----+------+\n \nSELECT LAST_INSERT_ID(12);\n+--------------------+\n| LAST_INSERT_ID(12) |\n+--------------------+\n| 12 |\n+--------------------+\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 12 |\n+------------------+\n \nINSERT INTO t(f) VALUES(\'f\');\n \nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 6 |\n+------------------+\n \nSELECT * FROM t;\n \n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n| 6 | f |\n+----+------+\n \nSELECT LAST_INSERT_ID(12);\n+--------------------+\n| LAST_INSERT_ID(12) |\n+--------------------+\n| 12 |\n+--------------------+\n \nINSERT INTO t(f) VALUES(\'g\');\n \nSELECT * FROM t;\n \n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n| 6 | f |\n| 7 | g |\n+----+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/last_insert_id/','','https://mariadb.com/kb/en/library/last_insert_id/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (213,17,'LAST_VALUE','Syntax\n------ \nLAST_VALUE(expr,[expr,...])\n \nLAST_VALUE(expr) OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n) \n \nDescription\n----------- \nLAST_VALUE() evaluates all expressions and returns the last.\n \nThis is useful together with setting user variables to a\nvalue with @var:=expr, for example when you want to get data\nof rows updated/deleted without having to do two queries\nagainst the table.\n \nSince MariaDB 10.2.2, LAST_VALUE can be used as a window\nfunction.\n \nReturns NULL if no last value exists.\n \nExamples\n-------- \nCREATE TABLE t1 (a int, b int);\nINSERT INTO t1 VALUES(1,10),(2,20);\nDELETE FROM t1 WHERE a=1 AND last_value(@a:=a,@b:=b,1);\nSELECT @a,@b;\n \n+------+------+\n| @a | @b |\n+------+------+\n| 1 | 10 |\n+------+------+\n \nAs a window function:\n \nCREATE TABLE t1 (\n pk int primary key,\n a int,\n b int,\n c char(10),\n d decimal(10, 3),\n e real\n);\n \nINSERT INTO t1 VALUES\n( 1, 0, 1, \'one\', 0.1, 0.001),\n( 2, 0, 2, \'two\', 0.2, 0.002),\n( 3, 0, 3, \'three\', 0.3, 0.003),\n( 4, 1, 2, \'three\', 0.4, 0.004),\n( 5, 1, 1, \'two\', 0.5, 0.005),\n( 6, 1, 1, \'one\', 0.6, 0.006),\n( 7, 2, NULL, \'n_one\', 0.5, 0.007),\n( 8, 2, 1, \'n_two\', NULL, 0.008),\n( 9, 2, 2, NULL, 0.7, 0.009),\n(10, 2, 0, \'n_four\', 0.8, 0.010),\n(11, 2, 10, NULL, 0.9, NULL);\n \nSELECT pk, FIRST_VALUE(pk) OVER (ORDER BY pk) AS first_asc,\n LAST_VALUE(pk) OVER (ORDER BY pk) AS last_asc,\n FIRST_VALUE(pk) OVER (ORDER BY pk DESC) AS first_desc,\n LAST_VALUE(pk) OVER (ORDER BY pk DESC) AS last_desc\nFROM t1\nORDER BY pk DESC;\n \n+----+-----------+----------+------------+-----------+\n| pk | first_asc | last_asc | first_desc | last_desc |\n+----+-----------+----------+------------+-----------+\n| 11 | 1 | 11 | 11 | 11 |\n| 10 | 1 | 10 | 11 | 10 |\n| 9 | 1 | 9 | 11 | 9 |\n| 8 | 1 | 8 | 11 | 8 |\n| 7 | 1 | 7 | 11 | 7 |\n| 6 | 1 | 6 | 11 | 6 |\n| 5 | 1 | 5 | 11 | 5 |\n| 4 | 1 | 4 | 11 | 4 |\n| 3 | 1 | 3 | 11 | 3 |\n| 2 | 1 | 2 | 11 | 2 |\n| 1 | 1 | 1 | 11 | 1 |\n+----+-----------+----------+------------+-----------+\n \nCREATE OR REPLACE TABLE t1 (i int);\nINSERT INTO t1 VALUES\n(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);\n \nSELECT i,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW\nand 1 FOLLOWING) AS f_1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and\n1 FOLLOWING) AS l_1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING\nAND 1 FOLLOWING) AS f_1p1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND\n1 FOLLOWING) AS f_1p1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING\nAND 1 PRECEDING) AS f_2p1p,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND\n1 PRECEDING) AS f_2p1p,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING\nAND 2 FOLLOWING) AS f_1f2f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND\n2 FOLLOWING) AS f_1f2f\nFROM t1;\n \n+------+------+------+--------+--------+--------+--------+--------+--------+\n| i | f_1f | l_1f | f_1p1f | f_1p1f | f_2p1p | f_2p1p |\nf_1f2f | f_1f2f |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n| 1 | 1 | 2 | 1 | 2 | NULL | NULL | 2 | 3 |\n| 2 | 2 | 3 | 1 | 3 | 1 | 1 | 3 | 4 |\n| 3 | 3 | 4 | 2 | 4 | 1 | 2 | 4 | 5 |\n| 4 | 4 | 5 | 3 | 5 | 2 | 3 | 5 | 6 |\n| 5 | 5 | 6 | 4 | 6 | 3 | 4 | 6 | 7 |\n| 6 | 6 | 7 | 5 | 7 | 4 | 5 | 7 | 8 |\n| 7 | 7 | 8 | 6 | 8 | 5 | 6 | 8 | 9 |\n| 8 | 8 | 9 | 7 | 9 | 6 | 7 | 9 | 10 |\n| 9 | 9 | 10 | 8 | 10 | 7 | 8 | 10 | 10 |\n| 10 | 10 | 10 | 9 | 10 | 8 | 9 | NULL | NULL |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n \n\n\nURL: https://mariadb.com/kb/en/library/last_value/','','https://mariadb.com/kb/en/library/last_value/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (214,17,'PROCEDURE ANALYSE','Syntax\n------ \nanalyse([max_elements[,max_memory]])\n \nDescription\n----------- \nThis procedure is defined in the sql/sql_analyse.cc file. It\nexamines\nthe result from a query and returns an analysis of the\nresults that\nsuggests optimal data types for each column. To obtain this\nanalysis,\nappend PROCEDURE ANALYSE to the end of a SELECT statement:\n \nSELECT ... FROM ... WHERE ... PROCEDURE\nANALYSE([max_elements,[max_memory]])\n \nFor example:\n \nSELECT col1, col2 FROM table1 PROCEDURE ANALYSE(10, 2000);\n \nThe results show some statistics for the values returned by\nthe query,\nand propose an optimal data type for the columns. This can\nbe helpful\nfor checking your existing tables, or after importing new\ndata. You\nmay need to try different settings for the arguments so that\nPROCEDURE\nANALYSE() does not suggest the ENUM data type when it is not\nappropriate.\n \nThe arguments are optional and are used as follows:\nmax_elements (default 256) is the maximum number of distinct\nvalues that analyse notices per column. This is used by\nanalyse to check whether the optimal data type should be of\ntype ENUM; if there are more than max_elements distinct\nvalues, then ENUM is not a suggested type.\nmax_memory (default 8192) is the maximum amount of memory\nthat analyse should allocate per column while trying to find\nall distinct values.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/procedure-analyse/','','https://mariadb.com/kb/en/library/procedure-analyse/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (215,17,'ROW_COUNT','Syntax\n------ \nROW_COUNT()\n \nDescription\n----------- \nROW_COUNT() returns the number of rows updated, inserted or\ndeleted\nby the preceding statement. This is the same as the row\ncount that the\nmysql client displays and the value from the\nmysql_affected_rows() C\nAPI function.\n \nGenerally:\nFor statements which return a result set (such as SELECT,\nSHOW, DESC or HELP), returns -1, even when the result set is\nempty. This is also true for administrative statements, such\nas OPTIMIZE.\nFor DML statements other than SELECT and for ALTER TABLE,\nreturns the number of affected rows.\nFor DDL statements (including TRUNCATE) and for other\nstatements which don\'t return any result set (such as USE,\nDO, SIGNAL or DEALLOCATE PREPARE), returns 0.\n \nFor UPDATE, affected rows is by default the number of rows\nthat were actually changed. If the CLIENT_FOUND_ROWS flag to\nmysql_real_connect() is specified when connecting to mysqld,\naffected rows is instead the number of rows matched by the\nWHERE clause. \n \nFor REPLACE, deleted rows are also counted. So, if REPLACE\ndeletes a row and adds a new row, ROW_COUNT() returns 2.\n \nFor INSERT ... ON DUPLICATE KEY, updated rows are counted\ntwice. So, if INSERT adds a new rows and modifies another\nrow, ROW_COUNT() returns 3.\n \nROW_COUNT() does not take into account rows that are not\ndirectly deleted/updated by the last statement. This means\nthat rows deleted by foreign keys or triggers are not\ncounted.\n \nWarning: You can use ROW_COUNT() with prepared statements,\nbut you need to call it after EXECUTE, not after DEALLOCATE\nPREPARE, because the row count for allocate prepare is\nalways 0.\n \nWarning: When used after a CALL statement, this function\nreturns the number of rows affected by the last statement in\nthe procedure, not by the whole procedure.\n \nWarning: After INSERT DELAYED, ROW_COUNT() returns the\nnumber of the rows you tried to insert, not the number of\nthe successful writes.\n \nThis information can also be found in the diagnostics area.\n \nStatements using the ROW_COUNT() function are not safe for\nreplication.\n \nExamples\n-------- \nCREATE TABLE t (A INT);\n \nINSERT INTO t VALUES(1),(2),(3);\n \nSELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 3 |\n+-------------+\n \nDELETE FROM t WHERE A IN(1,2);\n \nSELECT ROW_COUNT(); \n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 2 |\n+-------------+\n \nExample with prepared statements:\n \nSET @q = \'INSERT INTO t VALUES(1),(2),(3);\';\n \nPREPARE stmt FROM @q;\n \nEXECUTE stmt;\n \nQuery OK, 3 rows affected (0.39 sec)\nRecords: 3 Duplicates: 0 Warnings: 0\n \nSELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 3 |\n+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/row_count/','','https://mariadb.com/kb/en/library/row_count/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (216,17,'SCHEMA','Syntax\n------ \nSCHEMA()\n \nDescription\n----------- \nThis function is a synonym for DATABASE().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/schema/','','https://mariadb.com/kb/en/library/schema/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (217,17,'SESSION_USER','Syntax\n------ \nSESSION_USER()\n \nDescription\n----------- \nSESSION_USER() is a synonym for USER().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/session_user/','','https://mariadb.com/kb/en/library/session_user/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (218,17,'SYSTEM_USER','Syntax\n------ \nSYSTEM_USER()\n \nDescription\n----------- \nSYSTEM_USER() is a synonym for USER().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/system_user/','','https://mariadb.com/kb/en/library/system_user/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (219,17,'USER','Syntax\n------ \nUSER()\n \nDescription\n----------- \nReturns the current MariaDB user name and host name, given\nwhen authenticating to MariaDB, as a string in the utf8\ncharacter set.\n \nNote that the value of USER() may differ from the value of\nCURRENT_USER(), which is the user used to authenticate the\ncurrent client. \nCURRENT_ROLE() returns the current active role.\n \nSYSTEM_USER() and SESSION_USER are synonyms for USER().\n \nStatements using the USER() function or one of its synonyms\nare not safe for statement level replication.\n \nExamples\n-------- \nshell> mysql --user=\"anonymous\"\n \nMariaDB [(none)]> select user(),current_user();\n+---------------------+----------------+\n| user() | current_user() |\n+---------------------+----------------+\n| anonymous@localhost | @localhost |\n+---------------------+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/user/','','https://mariadb.com/kb/en/library/user/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (220,17,'VERSION','Syntax\n------ \nVERSION()\n \nDescription\n----------- \nReturns a string that indicates the MariaDB server version.\nThe string\nuses the utf8 character set.\n \nExamples\n-------- \nSELECT VERSION();\n+------------------------------+\n| VERSION() |\n+------------------------------+\n| 10.0.3-MariaDB-1~precise-log |\n+------------------------------+\n \nThe VERSION() string may have one or more of the following\nsuffixes:\n \nSuffix | Description | \n \n-embedded | The server is an embedded server (libmysqld). | \n \n-log | General logging, slow logging or binary (replication)\nlogging is enabled. | \n \n-debug | The server is compiled for debugging. | \n \n-valgrind |  The server is compiled to be instrumented with\nvalgrind. | \n \nChanging the Version String\n \nSome old legacy code may break because they are parsing the\nVERSION string and expecting a MySQL string or a simple\nversion\nstring like Joomla til API17, see MDEV-7780.\n \nIn MariaDB 10.2 one can fool these applications by setting\nthe version string from the command line or the my.cnf files\nwith --version=....\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/version/','','https://mariadb.com/kb/en/library/version/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (221,18,'!=','Syntax\n------ \n, !=\n \nDescription\n----------- \nNot equal operator. Evaluates both SQL expressions and\nreturns 1 if they are not equal and 0 if they are equal, or\nNULL if either expression is NULL. If the expressions return\ndifferent data types, (for instance, a number and a string),\nperforms type conversion.\n \nWhen used in row comparisons these two queries return the\nsame results:\n \nSELECT (t1.a, t1.b) != (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n \nSELECT (t1.a != t2.x) OR (t1.b != t2.y)\nFROM t1 INNER JOIN t2;\n \nExamples\n-------- \nSELECT \'.01\' \'0.01\';\n \n+-----------------+\n| \'.01\' \'0.01\' |\n+-----------------+\n| 1 |\n+-----------------+\n \nSELECT .01 \'0.01\';\n \n+---------------+\n| .01 \'0.01\' |\n+---------------+\n| 0 |\n+---------------+\n \nSELECT \'zapp\' \'zappp\';\n \n+-------------------+\n| \'zapp\' \'zappp\' |\n+-------------------+\n| 1 |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/not-equal/','','https://mariadb.com/kb/en/library/not-equal/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (222,18,'<','Syntax\n------ \n\n\nURL: https://mariadb.com/kb/en/library/less-than/','','https://mariadb.com/kb/en/library/less-than/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (223,18,'<=','Syntax\n------ \n\n\nURL: https://mariadb.com/kb/en/library/less-than-or-equal/','','https://mariadb.com/kb/en/library/less-than-or-equal/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (224,18,'<=>','Syntax\n------ \n\n \nDescription\n----------- \nNULL-safe equal operator. It performs an equality comparison\nlike\nthe = operator, but returns 1 rather than NULL if both\noperands are\nNULL, and 0 rather than NULL if one operand is NULL.\n \na b is equivalent to a = b OR (a IS NULL AND b IS NULL).\n \nWhen used in row comparisons these two queries return the\nsame results:\n \nSELECT (t1.a, t1.b) (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n \nSELECT (t1.a t2.x) AND (t1.b t2.y)\nFROM t1 INNER JOIN t2;\n \nSee also NULL Values in MariaDB.\n \nExamples\n-------- \nSELECT 1 1, NULL NULL, 1 NULL;\n \n+---------+---------------+------------+\n| 1 1 | NULL NULL | 1 NULL |\n+---------+---------------+------------+\n| 1 | 1 | 0 |\n+---------+---------------+------------+\n \nSELECT 1 = 1, NULL = NULL, 1 = NULL;\n \n+-------+-------------+----------+\n| 1 = 1 | NULL = NULL | 1 = NULL |\n+-------+-------------+----------+\n| 1 | NULL | NULL |\n+-------+-------------+----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/null-safe-equal/','','https://mariadb.com/kb/en/library/null-safe-equal/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (225,18,'=','Syntax\n------ \nleft_expr = right_expr\n \nDescription\n----------- \nEqual operator. Evaluates both SQL expressions and returns 1\nif they are equal, 0 if they are not equal, or NULL if\neither expression is NULL. If the expressions return\ndifferent data types (for example, a number and a string), a\ntype conversion is performed.\n \nWhen used in row comparisons these two queries are\nsynonymous and return the same results:\n \nSELECT (t1.a, t1.b) = (t2.x, t2.y) FROM t1 INNER JOIN t2;\n \nSELECT (t1.a = t2.x) AND (t1.b = t2.y) FROM t1 INNER JOIN\nt2;\n \nTo perform a NULL-safe comparison, use the operator.\n \n= can also be used as an assignment operator.\n \nExamples\n-------- \nSELECT 1 = 0;\n \n+-------+\n| 1 = 0 |\n+-------+\n| 0 |\n+-------+\n \nSELECT \'0\' = 0;\n \n+---------+\n| \'0\' = 0 |\n+---------+\n| 1 |\n+---------+\n \nSELECT \'0.0\' = 0;\n \n+-----------+\n| \'0.0\' = 0 |\n+-----------+\n| 1 |\n+-----------+\n \nSELECT \'0.01\' = 0;\n \n+------------+\n| \'0.01\' = 0 |\n+------------+\n| 0 |\n+------------+\n \nSELECT \'.01\' = 0.01;\n \n+--------------+\n| \'.01\' = 0.01 |\n+--------------+\n| 1 |\n+--------------+\n \nSELECT (5 * 2) = CONCAT(\'1\', \'0\');\n+----------------------------+\n| (5 * 2) = CONCAT(\'1\', \'0\') |\n+----------------------------+\n| 1 |\n+----------------------------+\n \nSELECT 1 = NULL;\n \n+----------+\n| 1 = NULL |\n+----------+\n| NULL |\n+----------+\n \nSELECT NULL = NULL;\n \n+-------------+\n| NULL = NULL |\n+-------------+\n| NULL |\n+-------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/equal/','','https://mariadb.com/kb/en/library/equal/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (226,18,'>','Syntax\n------ \n>\n \nDescription\n----------- \nGreater than operator. Evaluates both SQL expressions and\nreturns 1 if the left value is greater than the right value\nand 0 if it is not, or NULL if either expression is NULL. If\nthe expressions return different data types, (for instance,\na number and a string), performs type conversion.\n \nWhen used in row comparisons these two queries return the\nsame results:\n \nSELECT (t1.a, t1.b) > (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n \nSELECT (t1.a > t2.x) OR ((t1.a = t2.x) AND (t1.b > t2.y))\nFROM t1 INNER JOIN t2;\n \nExamples\n-------- \nSELECT 2 > 2;\n \n+-------+\n| 2 > 2 |\n+-------+\n| 0 |\n+-------+\n \nSELECT \'b\' > \'a\';\n \n+-----------+\n| \'b\' > \'a\' |\n+-----------+\n| 1 |\n+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/greater-than/','','https://mariadb.com/kb/en/library/greater-than/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (227,18,'>=','Syntax\n------ \n>=\n \nDescription\n----------- \nGreater than or equal operator. Evaluates both SQL\nexpressions and returns 1 if the left value is greater than\nor equal to the right value and 0 if it is not, or NULL if\neither expression is NULL. If the expressions return\ndifferent data types, (for instance, a number and a string),\nperforms type conversion.\n \nWhen used in row comparisons these two queries return the\nsame results:\n \nSELECT (t1.a, t1.b) >= (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n \nSELECT (t1.a > t2.x) OR ((t1.a = t2.x) AND (t1.b >= t2.y))\nFROM t1 INNER JOIN t2;\n \nExamples\n-------- \nSELECT 2 >= 2;\n \n+--------+\n| 2 >= 2 |\n+--------+\n| 1 |\n+--------+\n \nSELECT \'A\' >= \'a\';\n \n+------------+\n| \'A\' >= \'a\' |\n+------------+\n| 1 |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/greater-than-or-equal/','','https://mariadb.com/kb/en/library/greater-than-or-equal/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (228,18,'BETWEEN AND','Syntax\n------ \nexpr BETWEEN min AND max\n \nDescription\n----------- \nIf expr is greater than or equal to min and expr is less\nthan or equal\nto max, BETWEEN returns 1, otherwise it returns 0. This is\nequivalent\nto the expression (min \n\nURL: https://mariadb.com/kb/en/library/between-and/','','https://mariadb.com/kb/en/library/between-and/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (229,18,'COALESCE','Syntax\n------ \nCOALESCE(value,...)\n \nDescription\n----------- \nReturns the first non-NULL value in the list, or NULL if\nthere are no\nnon-NULL values. At least one parameter must be passed.\n \nSee also NULL Values in MariaDB.\n \nExamples\n-------- \nSELECT COALESCE(NULL,1);\n+------------------+\n| COALESCE(NULL,1) |\n+------------------+\n| 1 |\n+------------------+\n \nSELECT COALESCE(NULL,NULL,NULL);\n+--------------------------+\n| COALESCE(NULL,NULL,NULL) |\n+--------------------------+\n| NULL |\n+--------------------------+\n \nWhen two arguments are given, COALESCE() is the same as\nIFNULL():\n \nSET @a=NULL, @b=1;\n \nSELECT COALESCE(@a, @b), IFNULL(@a, @b);\n+------------------+----------------+\n| COALESCE(@a, @b) | IFNULL(@a, @b) |\n+------------------+----------------+\n| 1 | 1 |\n+------------------+----------------+\n \nHex type confusion:\n \nCREATE TABLE t1 (a INT, b VARCHAR(10));\nINSERT INTO t1 VALUES (0x31, 0x61),(COALESCE(0x31),\nCOALESCE(0x61));\n \nSELECT * FROM t1;\n \n+------+------+\n| a | b |\n+------+------+\n| 49 | a |\n| 1 | a |\n+------+------+\n \nThe reason for the differing results above is that when 0x31\nis inserted directly to the column, it\'s treated as a\nnumber (see Hexadecimal Literals), while when 0x31 is passed\nto COALESCE(), it\'s treated as a string, because:\nHEX values have a string data type by default.\nCOALESCE() has the same data type as the argument. \n \n\n\nURL: https://mariadb.com/kb/en/library/coalesce/','','https://mariadb.com/kb/en/library/coalesce/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (230,18,'GREATEST','Syntax\n------ \nGREATEST(value1,value2,...)\n \nDescription\n----------- \nWith two or more arguments, returns the largest\n(maximum-valued)\nargument. The arguments are compared using the same rules as\nfor\nLEAST().\n \nExamples\n-------- \nSELECT GREATEST(2,0);\n+---------------+\n| GREATEST(2,0) |\n+---------------+\n| 2 |\n+---------------+\n \nSELECT GREATEST(34.0,3.0,5.0,767.0);\n+------------------------------+\n| GREATEST(34.0,3.0,5.0,767.0) |\n+------------------------------+\n| 767.0 |\n+------------------------------+\n \nSELECT GREATEST(\'B\',\'A\',\'C\');\n+-----------------------+\n| GREATEST(\'B\',\'A\',\'C\') |\n+-----------------------+\n| C |\n+-----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/greatest/','','https://mariadb.com/kb/en/library/greatest/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (231,18,'IN','Syntax\n------ \nexpr IN (value,...)\n \nDescription\n----------- \nReturns 1 if expr is equal to any of the values in the IN\nlist, else\nreturns 0. If all values are constants, they are evaluated\naccording\nto the type of expr and sorted. The search for the item then\nis done\nusing a binary search. This means IN is very quick if the IN\nvalue\nlist consists entirely of constants. Otherwise, type\nconversion takes\nplace according to the rules described at Type Conversion,\nbut\napplied to all the arguments.\n \nIf expr is NULL, IN always returns NULL. If at least one of\nthe values in the list is NULL, and one of the comparisons\nis true, the result is 1. If at least one of the values in\nthe list is NULL and none of the comparisons is true, the\nresult is NULL.\n \nExamples\n-------- \nSELECT 2 IN (0,3,5,7);\n+----------------+\n| 2 IN (0,3,5,7) |\n+----------------+\n| 0 |\n+----------------+\n \nSELECT \'wefwf\' IN (\'wee\',\'wefwf\',\'weg\');\n+----------------------------------+\n| \'wefwf\' IN (\'wee\',\'wefwf\',\'weg\') |\n+----------------------------------+\n| 1 |\n+----------------------------------+ \n \nType conversion:\n \nSELECT 1 IN (\'1\', \'2\', \'3\');\n+----------------------+\n| 1 IN (\'1\', \'2\', \'3\') |\n+----------------------+\n| 1 |\n+----------------------+\n \nSELECT NULL IN (1, 2, 3);\n+-------------------+\n| NULL IN (1, 2, 3) |\n+-------------------+\n| NULL |\n+-------------------+\n \nMariaDB [(none)]> SELECT 1 IN (1, 2, NULL);\n+-------------------+\n| 1 IN (1, 2, NULL) |\n+-------------------+\n| 1 |\n+-------------------+\n \nMariaDB [(none)]> SELECT 5 IN (1, 2, NULL);\n+-------------------+\n| 5 IN (1, 2, NULL) |\n+-------------------+\n| NULL |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/in/','','https://mariadb.com/kb/en/library/in/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (232,18,'INTERVAL','Syntax\n------ \nINTERVAL(N,N1,N2,N3,...)\n \nDescription\n----------- \nReturns the index of the last argument that is less than the\nfirst argument or is NULL. \n \nReturns 0 if N < N1, 1 if N < N2, 2 if N < N3 and so on or\n-1 if N is NULL. All\narguments are treated as integers. It is required that N1 <\nN2 < N3 \n\nURL: https://mariadb.com/kb/en/library/interval/','','https://mariadb.com/kb/en/library/interval/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (233,18,'IS','Syntax\n------ \nIS boolean_value\n \nDescription\n----------- \nTests a value against a boolean value, where boolean_value\ncan be\nTRUE, FALSE, or UNKNOWN.\n \nThere is an important difference between using IS TRUE or\ncomparing a value with TRUE using =. When using =, only 1\nequals to TRUE. But when using IS TRUE, all values which are\nlogically true (like a number > 1) return TRUE.\n \nExamples\n-------- \nSELECT 1 IS TRUE, 0 IS FALSE, NULL IS UNKNOWN;\n+-----------+------------+-----------------+\n| 1 IS TRUE | 0 IS FALSE | NULL IS UNKNOWN |\n+-----------+------------+-----------------+\n| 1 | 1 | 1 |\n+-----------+------------+-----------------+\n \nDifference between = and IS TRUE:\n \nSELECT 2 = TRUE, 2 IS TRUE;\n+----------+-----------+\n| 2 = TRUE | 2 IS TRUE |\n+----------+-----------+\n| 0 | 1 |\n+----------+-----------+\n \n\n\nURL: https://mariadb.com/kb/en/library/is/','','https://mariadb.com/kb/en/library/is/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (234,18,'IS NOT','Syntax\n------ \nIS NOT boolean_value\n \nDescription\n----------- \nTests a value against a boolean value, where boolean_value\ncan be\nTRUE, FALSE, or UNKNOWN. \n \nExamples\n-------- \nSELECT 1 IS NOT UNKNOWN, 0 IS NOT UNKNOWN, NULL IS NOT\nUNKNOWN;\n+------------------+------------------+---------------------+\n| 1 IS NOT UNKNOWN | 0 IS NOT UNKNOWN | NULL IS NOT UNKNOWN\n|\n+------------------+------------------+---------------------+\n| 1 | 1 | 0 |\n+------------------+------------------+---------------------+\n \nSELECT NULL IS NOT TRUE, NULL IS NOT FALSE;\n+------------------+-------------------+\n| NULL IS NOT TRUE | NULL IS NOT FALSE |\n+------------------+-------------------+\n| 1 | 1 |\n+------------------+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/is-not/','','https://mariadb.com/kb/en/library/is-not/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (235,18,'IS NOT NULL','Syntax\n------ \nIS NOT NULL\n \nDescription\n----------- \nTests whether a value is not NULL. See also NULL Values in\nMariaDB.\n \nExamples\n-------- \nSELECT 1 IS NOT NULL, 0 IS NOT NULL, NULL IS NOT NULL;\n+---------------+---------------+------------------+\n| 1 IS NOT NULL | 0 IS NOT NULL | NULL IS NOT NULL |\n+---------------+---------------+------------------+\n| 1 | 1 | 0 |\n+---------------+---------------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/is-not-null/','','https://mariadb.com/kb/en/library/is-not-null/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (236,18,'IS NULL','Syntax\n------ \nIS NULL\n \nDescription\n----------- \nTests whether a value is NULL. See also NULL Values in\nMariaDB.\n \nExamples\n-------- \nSELECT 1 IS NULL, 0 IS NULL, NULL IS NULL;\n+-----------+-----------+--------------+\n| 1 IS NULL | 0 IS NULL | NULL IS NULL |\n+-----------+-----------+--------------+\n| 0 | 0 | 1 |\n+-----------+-----------+--------------+\n \nCompatibility\n \nSome ODBC applications use the syntax auto_increment_field\nIS NOT NULL to find the latest row that was inserted with an\nautogenerated key value. If your applications need this, you\ncan set the sql_auto_is_null variable to 1.\n \nSET @@sql_auto_is_null=1;\nCREATE TABLE t1 (auto_increment_column INT NOT NULL\nAUTO_INCREMENT PRIMARY KEY);\nINSERT INTO t1 VALUES (NULL);\nSELECT * FROM t1 WHERE auto_increment_column IS NULL;\n \n+-----------------------+\n| auto_increment_column |\n+-----------------------+\n| 1 |\n+-----------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/is-null/','','https://mariadb.com/kb/en/library/is-null/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (237,18,'ISNULL','Syntax\n------ \nISNULL(expr)\n \nDescription\n----------- \nIf expr is NULL, ISNULL() returns 1, otherwise it returns 0.\n \nSee also NULL Values in MariaDB.\n \nExamples\n-------- \nSELECT ISNULL(1+1);\n+-------------+\n| ISNULL(1+1) |\n+-------------+\n| 0 |\n+-------------+\n \nSELECT ISNULL(1/0);\n+-------------+\n| ISNULL(1/0) |\n+-------------+\n| 1 |\n+-------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/isnull/','','https://mariadb.com/kb/en/library/isnull/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (238,18,'LEAST','Syntax\n------ \nLEAST(value1,value2,...)\n \nDescription\n----------- \nWith two or more arguments, returns the smallest\n(minimum-valued)\nargument. The arguments are compared using the following\nrules:\nIf the return value is used in an INTEGER context or all\narguments are integer-valued, they are compared as integers.\nIf the return value is used in a REAL context or all\narguments are real-valued, they are compared as reals.\nIf any argument is a case-sensitive string, the arguments\nare compared as case-sensitive strings.\nIn all other cases, the arguments are compared as\ncase-insensitive strings.\n \nLEAST() returns NULL if any argument is NULL.\n \nExamples\n-------- \nSELECT LEAST(2,0);\n+------------+\n| LEAST(2,0) |\n+------------+\n| 0 |\n+------------+\n \nSELECT LEAST(34.0,3.0,5.0,767.0);\n+---------------------------+\n| LEAST(34.0,3.0,5.0,767.0) |\n+---------------------------+\n| 3.0 |\n+---------------------------+\n \nSELECT LEAST(\'B\',\'A\',\'C\');\n+--------------------+\n| LEAST(\'B\',\'A\',\'C\') |\n+--------------------+\n| A |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/least/','','https://mariadb.com/kb/en/library/least/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (239,18,'NOT BETWEEN','Syntax\n------ \nexpr NOT BETWEEN min AND max\n \nDescription\n----------- \nThis is the same as NOT (expr BETWEEN min AND max).\n \nNote that the meaning of the alternative form NOT expr\nBETWEEN min AND max is affected by the HIGH_NOT_PRECEDENCE\nSQL_MODE flag.\n \nExamples\n-------- \nSELECT 1 NOT BETWEEN 2 AND 3;\n+-----------------------+\n| 1 NOT BETWEEN 2 AND 3 |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT \'b\' NOT BETWEEN \'a\' AND \'c\';\n+-----------------------------+\n| \'b\' NOT BETWEEN \'a\' AND \'c\' |\n+-----------------------------+\n| 0 |\n+-----------------------------+\n \nNULL:\n \nSELECT 1 NOT BETWEEN 1 AND NULL;\n+--------------------------+\n| 1 NOT BETWEEN 1 AND NULL |\n+--------------------------+\n| NULL |\n+--------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/not-between/','','https://mariadb.com/kb/en/library/not-between/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (240,18,'NOT IN','Syntax\n------ \nexpr NOT IN (value,...)\n \nDescription\n----------- \nThis is the same as NOT (expr IN (value,...)).\n \nExamples\n-------- \nSELECT 2 NOT IN (0,3,5,7);\n+--------------------+\n| 2 NOT IN (0,3,5,7) |\n+--------------------+\n| 1 |\n+--------------------+\n \nSELECT \'wefwf\' NOT IN (\'wee\',\'wefwf\',\'weg\');\n+--------------------------------------+\n| \'wefwf\' NOT IN (\'wee\',\'wefwf\',\'weg\') |\n+--------------------------------------+\n| 0 |\n+--------------------------------------+\n \nSELECT 1 NOT IN (\'1\', \'2\', \'3\');\n+--------------------------+\n| 1 NOT IN (\'1\', \'2\', \'3\') |\n+--------------------------+\n| 0 |\n+--------------------------+\n \nNULL:\n \nSELECT NULL NOT IN (1, 2, 3);\n+-----------------------+\n| NULL NOT IN (1, 2, 3) |\n+-----------------------+\n| NULL |\n+-----------------------+\n \nSELECT 1 NOT IN (1, 2, NULL);\n+-----------------------+\n| 1 NOT IN (1, 2, NULL) |\n+-----------------------+\n| 0 |\n+-----------------------+\n \nSELECT 5 NOT IN (1, 2, NULL);\n+-----------------------+\n| 5 NOT IN (1, 2, NULL) |\n+-----------------------+\n| NULL |\n+-----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/not-in/','','https://mariadb.com/kb/en/library/not-in/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (241,19,'Operator Precedence','The precedence is the order in which the SQL operators are\nevaluated.\n \nThe following list shows the SQL operator precedence.\nOperators that appear first in the list have a higher\nprecedence. Operators which are listed together have the\nsame precedence.\nINTERVAL\nBINARY, COLLATE\n!\n- (unary minus), [[bitwise-not|]] (unary bit inversion)\n|| (string concatenation)\n^\n*, /, DIV, %, MOD\n-, +\n \n&\n|\n= (comparison), , >=, >, \n\nURL: https://mariadb.com/kb/en/library/operator-precedence/','','https://mariadb.com/kb/en/library/operator-precedence/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (242,19,'&','Syntax\n------ \n&\n \nDescription\n----------- \nBitwise AND. Converts the values to binary and compares\nbits. Only if both the corresponding bits are 1 is the\nresulting bit also 1.\n \nSee also bitwise OR.\n \nExamples\n-------- \nSELECT 2&1;\n+-----+\n| 2&1 |\n+-----+\n| 0 |\n+-----+\n \nSELECT 3&1;\n+-----+\n| 3&1 |\n+-----+\n| 1 |\n+-----+\n \nSELECT 29 & 15;\n+---------+\n| 29 & 15 |\n+---------+\n| 13 |\n+---------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/bitwise_and/','','https://mariadb.com/kb/en/library/bitwise_and/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (243,19,'<<','Syntax\n------ \nvalue1 \n\nURL: https://mariadb.com/kb/en/library/shift-left/','','https://mariadb.com/kb/en/library/shift-left/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (244,19,'>>','Syntax\n------ \nvalue1 >> value2\n \nDescription\n----------- \nConverts a longlong (BIGINT) number (value1) to binary and\nshifts value2 units to the right.\n \nExamples\n-------- \nSELECT 4 >> 2;\n+--------+\n| 4 >> 2 |\n+--------+\n| 1 |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/shift-right/','','https://mariadb.com/kb/en/library/shift-right/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (245,19,'BIT_COUNT','Syntax\n------ \nBIT_COUNT(N)\n \nDescription\n----------- \nReturns the number of bits that are set in the argument N.\n \nExamples\n-------- \nSELECT BIT_COUNT(29), BIT_COUNT(b\'101010\');\n+---------------+----------------------+\n| BIT_COUNT(29) | BIT_COUNT(b\'101010\') |\n+---------------+----------------------+\n| 4 | 3 |\n+---------------+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/bit_count/','','https://mariadb.com/kb/en/library/bit_count/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (246,19,'^','Syntax\n------ \n^\n \nDescription\n----------- \nBitwise XOR. Converts the values to binary and compares\nbits. If one (and only one) of the corresponding bits is 1\nis the resulting bit also 1.\n \nExamples\n-------- \nSELECT 1 ^ 1;\n+-------+\n| 1 ^ 1 |\n+-------+\n| 0 |\n+-------+\n \nSELECT 1 ^ 0;\n+-------+\n| 1 ^ 0 |\n+-------+\n| 1 |\n+-------+\n \nSELECT 11 ^ 3;\n+--------+\n| 11 ^ 3 |\n+--------+\n| 8 |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/bitwise-xor/','','https://mariadb.com/kb/en/library/bitwise-xor/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (247,19,'|','Syntax\n------ \n|\n \nDescription\n----------- \nBitwise OR. Converts the values to binary and compares bits.\nIf either of the corresponding bits has a value of 1, the\nresulting bit is also 1.\n \nSee also bitwise AND.\n \nExamples\n-------- \nSELECT 2|1;\n+-----+\n| 2|1 |\n+-----+\n| 3 |\n+-----+\n \nSELECT 29 | 15;\n+---------+\n| 29 | 15 |\n+---------+\n| 31 |\n+---------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/bitwise-or/','','https://mariadb.com/kb/en/library/bitwise-or/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (248,19,'~','Syntax\n------ \n~\n \nDescription\n----------- \nBitwise NOT. Converts the value to 4 bytes binary and\ninverts all bits.\n \nExamples\n-------- \nSELECT 3 & ~1;\n+--------+\n| 3 & ~1 |\n+--------+\n| 2 |\n+--------+\n \nSELECT 5 & ~1;\n+--------+\n| 5 & ~1 |\n+--------+\n| 4 |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/bitwise-not/','','https://mariadb.com/kb/en/library/bitwise-not/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (249,19,'Parentheses','Parentheses are sometimes called precedence operators - this\nmeans that they can be used to change the other operator\'s\nprecedence in an expression. The expressions that are\nwritten between parentheses are computed before the\nexpressions that are written outside. Parentheses must\nalways contain an expression (that is, they cannot be\nempty), and can be nested.\n \nFor example, the following expressions could return\ndifferent results:\nNOT a OR b\nNOT (a OR b)\n \nIn the first case, NOT applies to a, so if a is FALSE or b\nis TRUE, the expression returns TRUE. In the second case,\nNOT applies to the result of a OR b, so if at least one of a\nor b is TRUE, the expression is TRUE.\n \nWhen the precedence of operators is not intuitive, you can\nuse parentheses to make it immediately clear for whoever\nreads the statement.\n \nThe precedence of the NOT operator can also be affected by\nthe HIGH_NOT_PRECEDENCE SQL_MODE flag.\n \nOther uses\n \nParentheses must always be used to enclose subqueries.\n \nParentheses can also be used in a JOIN statement between\nmultiple tables to determine which tables must be joined\nfirst.\n \nAlso, parentheses are used to enclose the list of parameters\nto be passed to built-in functions, user-defined functions\nand stored routines. However, when no parameter is passed to\na stored procedure, parentheses are optional. For builtin\nfunctions and user-defined functions, spaces are not allowed\nbetween the function name and the open parenthesis, unless\nthe IGNORE_SPACE SQL_MODE is set. For stored routines (and\nfor functions if IGNORE_SPACE is set) spaces are allowed\nbefore the open parenthesis, including tab characters and\nnew line characters.\n \nSyntax errors\n \nIf there are more open parentheses than closed parentheses,\nthe error usually looks like this:\n \nERROR 1064 (42000): You have an error in your SQL syntax;\ncheck the manual that\ncorresponds to your MariaDB server version for the right\nsyntax to use near \'\' a\nt line 1\n \nNote the empty string.\n \nIf there are more closed parentheses than open parentheses,\nthe error usually looks like this:\n \nERROR 1064 (42000): You have an error in your SQL syntax;\ncheck the manual that\ncorresponds to your MariaDB server version for the right\nsyntax to use near \')\'\nat line 1\n \nNote the quoted closed parenthesis.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/parentheses/','','https://mariadb.com/kb/en/library/parentheses/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (250,19,'TRUE FALSE','Description\n----------- \nThe constants TRUE and FALSE evaluate to 1 and 0,\nrespectively. The\nconstant names can be written in any lettercase.\n \nExamples\n-------- \nSELECT TRUE, true, FALSE, false;\n \n+------+------+-------+-------+\n| TRUE | TRUE | FALSE | FALSE |\n+------+------+-------+-------+\n| 1 | 1 | 0 | 0 |\n+------+------+-------+-------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/true-false/','','https://mariadb.com/kb/en/library/true-false/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (251,20,'ANALYZE TABLE','Syntax\n------ \nANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE tbl_name\n[,tbl_name ...] \n [PERSISTENT FOR [ALL|COLUMNS ([col_name [,col_name ...]])] \n [INDEXES ([index_name [,index_name ...]])]] \n \nDescription\n----------- \nANALYZE TABLE analyzes and stores the key distribution for a\ntable (index statistics). During the analysis, the table is\nlocked with a read lock. This statement works with MyISAM,\nAria and InnoDB tables. For MyISAM tables, this statement is\nequivalent\nto using myisamchk --analyze.\n \nFor more information on how the analysis works within\nInnoDB, see\nInnoDB Limitations.\n \nMariaDB uses the stored key distribution to decide the order\nin which\ntables should be joined when you perform a join on something\nother than\na constant. In addition, key distributions can be used when\ndeciding\nwhich indexes to use for a specific table within a query.\n \nThis statement requires SELECT and INSERT privileges for the\ntable.\n \nBy default, ANALYZE TABLE statements are written to the\nbinary log and will be replicated. The NO_WRITE_TO_BINLOG\nkeyword (LOCAL is an alias) will ensure the statement is not\nwritten to the binary log. \n \nANALYZE TABLE is also supported for partitioned tables. You\ncan use ALTER TABLE ... ANALYZE PARTITION to analyze one or\nmore partitions.\n \nEngine-Independent Statistics\n \nMariaDB 10.0.1 extended ANALYZE TABLE to support\nengine-independent statistics.\n \nEngine-independent statistics are collected by doing full\ntable and full index scans, and collecting can be quite\nexpensive. \n \nANALYZE TABLE behavior depends on the value of the\nuse_stat_tables system variable.\n \nIf use_stat_tables is set to never (default in = MariaDB\n10.4.1), ANALYZE TABLE t will collect storage engine\nstatistics, and not engine-independent statistics.\n \nIf use_stat_tables is set to complementary or preferably,\nANALYZE TABLE t will collect engine-independent statistics. \n \nIn order to collect engine-independent statistics when\nuse_stat_tables is not set to one of the above two values\n(it is not by default), the extended form of ANALYZE TABLE,\nusing PERSISTENT FOR, must be used. This also allows one to\ncollect statistics only for particular columns or indexes.\nNote that engine-independent statistics are used by default\nfrom MariaDB 10.4 (use_stat_tables=preferably_for_queries),\nso you will probably want to use PERSISTENT FOR.\n \nIt is recommended to collect engine-independent statistics\non as-needed basis, so typically one will not have\nengine-independent statistics for all indexes/all columns. \n \nNote that statistics for blob and text columns are not\ncollected. If explicitly specified, a warning is returned.\n \n-- update all engine-independent statistics for all columns\nand indexes\nANALYZE TABLE tbl PERSISTENT FOR ALL;\n \n-- update specific columns and indexes:\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS (col1,col2,...)\nINDEXES (idx1,idx2,...);\n \n-- empty lists are allowed:\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS (col1,col2,...)\nINDEXES ();\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS () INDEXES\n(idx1,idx2,...);\n \n-- the following will only update mysql.table_stat fields:\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS () INDEXES ();\n \n-- with use_stat_tables = COMPLEMENTARY, a simple ANALYZE\nTABLE \n-- collects engine-independent statistics for all columns\nand indexes.\nSET SESSION use_stat_tables=\'COMPLEMENTARY\';\n \nANALYZE TABLE tbl;\n \nThe PERSISTENT FOR is required to update the\nengine-independent statistics even if the table has the\noption STATS_PERSISTENT=1 (which refers to InnoDB Persistent\nStatistics).\n \nThe Aria storage engine supports progress reporting for the\nANALYZE TABLE statement.\n \n\n\nURL: https://mariadb.com/kb/en/library/analyze-table/','','https://mariadb.com/kb/en/library/analyze-table/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (252,20,'CHECK TABLE','Syntax\n------ \nCHECK TABLE tbl_name [, tbl_name] ... [option] ...\n \noption = {FOR UPGRADE | QUICK | FAST | MEDIUM | EXTENDED |\nCHANGED}\n \nDescription\n----------- \nCHECK TABLE checks a table or tables for errors. CHECK TABLE\nworks for\nArchive, Aria, CSV, InnoDB, and MyISAM tables. For Aria and\nMyISAM tables, the\nkey statistics are updated as well. For CSV, see also\nChecking and Repairing CSV Tables.\n \nAs an alternative, myisamchk is a commandline tool for\nchecking MyISAM tables when the tables are not being\naccessed.\n \nFor checking dynamic columns integrity, COLUMN_CHECK() can\nbe used.\n \nCHECK TABLE can also check views for problems, such as\ntables\nthat are referenced in the view definition that no longer\nexist.\n \nCHECK TABLE is also supported for partitioned tables. You\ncan\nuse ALTER TABLE ... CHECK PARTITION \nto check one or more partitions.\n \nThe meaning of the different options are as follows - note\nthat this can vary a bit between\nstorage engines:\n \nFOR UPGRADE | Do a very quick check if the storage format\nfor the table has changed so that one needs to do a REPAIR.\nThis is only needed when one upgrades between major versions\nof MariaDB or MySQL. This is usually done by running\nmysql_upgrade. | \n \nFAST | Only check tables that has not been closed properly\nor are marked as corrupt. Only supported by the MyISAM and\nAria engines. For other engines the table is checked\nnormally | \n \nCHANGED | Check only tables that has changed since last\nREPAIR / CHECK. Only supported by the MyISAM and Aria\nengines. For other engines the table is checked normally. | \n \nQUICK | Do a fast check. For MyISAM and Aria engine this\nmeans we skip checking the delete link chain which may take\nsome time. | \n \nMEDIUM | Scan also the data files. Checks integrity between\ndata and index files with checksums. In most cases this\nshould find all possible errors. | \n \nEXTENDED | Does a full check to verify every possible error.\nFor MyISAM and Aria we verify for each row that all it keys\nexists and points to the row. This may take a long time on\nbig tables! | \n \nFor most cases running CHECK TABLE without options or MEDIUM\nshould be\ngood enough.\n \nSince MariaDB 5.3, the Aria storage engine supports progress\nreporting for this statement.\n \nIf you want to know if two tables are identical, take a look\nat CHECKSUM TABLE.\n \nXtraDB/InnoDB\n \nIf CHECK TABLE finds an error in an InnoDB table, MariaDB\nmight shutdown to prevent the error propagation. In this\ncase, the problem will be reported in the error log.\nOtherwise, since MariaDB 5.5, the table or an index might be\nmarked as corrupted, to prevent use. This does not happen\nwith some minor problems, like a wrong number of entries in\na secondary index. Those problems are reported in the output\nof CHECK TABLE.\n \nEach tablespace contains a header with metadata. This header\nis not checked by this statement.\n \nDuring the execution of CHECK TABLE, other threads may be\nblocked.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/sql-commands-check-table/','','https://mariadb.com/kb/en/library/sql-commands-check-table/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (253,20,'CHECK VIEW','CHECK VIEW was introduced in MariaDB 10.0.18.\n \nSyntax\n------ \nCHECK VIEW view_name\n \nDescription\n----------- \nThe CHECK VIEW statement was introduced in MariaDB 10.0.18\nto assist with fixing MDEV-6916, an issue introduced in\nMariaDB 5.2 where the view algorithms were swapped. It\nchecks whether the view algorithm is correct. It is run as\npart of mysql_upgrade, and should not normally be required\nin regular use.\n \n\n\nURL: https://mariadb.com/kb/en/library/check-view/','','https://mariadb.com/kb/en/library/check-view/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (254,20,'CHECKSUM TABLE','Syntax\n------ \nCHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED\n]\n \nDescription\n----------- \nCHECKSUM TABLE reports a table checksum. This is very\nuseful if you want to know if two tables are the same (for\nexample on a master\nand slave).\n \nWith QUICK, the live table checksum is reported if it is\navailable, or NULL otherwise. This is very fast. A live\nchecksum is enabled by specifying the CHECKSUM=1 table\noption when you create the table; currently, this is\nsupported\nonly for Aria and MyISAM tables.\n \nWith EXTENDED, the entire table is read row by row and the\nchecksum is calculated. This can be very slow for large\ntables.\n \nIf neither QUICK nor EXTENDED is\nspecified, MariaDB returns a live checksum if the table\nstorage engine supports\nit and scans the table otherwise.\n \nCHECKSUM TABLE requires the SELECT privilege for the table.\n \nFor a nonexistent table, CHECKSUM TABLE returns\nNULL and generates a warning.\n \nThe table row format affects the checksum value. If the row\nformat changes, the checksum will change. This means that\nwhen a table created with a MariaDB/MySQL version is\nupgraded to another version, the checksum value will\nprobably change.\n \nTwo identical tables should always match to the same\nchecksum value; however, also for non-identical tables there\nis a very slight chance that they will return the same value\nas the hashing algorithm is not completely collision-free.\n \nDifferences Between MariaDB and MySQL\n \nCHECKSUM TABLE may give a different result as MariaDB\ndoesn\'t\nignore NULLs in the columns as MySQL 5.1 does (Later MySQL\nversions should calculate checksums the same way as\nMariaDB). You can get the\n\'old style\' checksum in MariaDB by starting mysqld with\nthe\n--old option. Note however that that the MyISAM and Aria\nstorage engines in MariaDB are using the new checksum\ninternally, so if you are\nusing --old, the CHECKSUM command will be\nslower as it needs to calculate the checksum row by row.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/checksum-table/','','https://mariadb.com/kb/en/library/checksum-table/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (255,20,'OPTIMIZE TABLE','Syntax\n------ \nOPTIMIZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n [WAIT n | NOWAIT]\n \nDescription\n----------- \nOPTIMIZE TABLE has two main functions. It can either be used\nto defragment tables, or to update the InnoDB fulltext\nindex.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nDefragmenting\n \nOPTIMIZE TABLE works for InnoDB (before MariaDB 10.1.1, only\nif the innodb_file_per_table server system variable is set),\nAria, MyISAM and ARCHIVE tables, and should be used if you\nhave deleted a large part of a table or if you have made\nmany changes to a table with variable-length\nrows (tables that have VARCHAR, VARBINARY, BLOB, or TEXT\ncolumns). Deleted rows are maintained in a\nlinked list and subsequent INSERT operations reuse old row\npositions.\n \nThis statement requires SELECT and INSERT privileges for the\ntable.\n \nBy default, OPTIMIZE TABLE statements are written to the\nbinary log and will be replicated. The NO_WRITE_TO_BINLOG\nkeyword (LOCAL is an alias) will ensure the statement is not\nwritten to the binary log. \n \nOPTIMIZE TABLE is also supported for partitioned tables. You\ncan use \nALTER TABLE ... OPTIMIZE PARTITION \nto optimize one or more partitions.\n \nYou can use OPTIMIZE TABLE to reclaim the unused\nspace and to defragment the data file. With other storage\nengines, OPTIMIZE TABLE does nothing by default, and returns\nthis message: \" The storage engine for the table doesn\'t\nsupport optimize\". However, if the server has been started\nwith the --skip-new option, OPTIMIZE TABLE is linked to\nALTER TABLE, and recreates the table. This operation frees\nthe unused space and updates index statistics.\n \nSince MariaDB 5.3, the Aria storage engine supports progress\nreporting for this statement.\n \nIf a MyISAM table is fragmented, concurrent inserts will not\nbe performed until an OPTIMIZE TABLE statement is executed\non that table, unless the concurrent_insert server system\nvariable is set to ALWAYS.\n \nUpdating an InnoDB fulltext index\n \nWhen rows are added or deleted to an InnoDB fulltext index,\nthe index is not immediately re-organized, as this can be an\nexpensive operation. Change statistics are stored in a\nseparate location . The fulltext index is only fully\nre-organized when an OPTIMIZE TABLE statement is run.\n \nBy default, an OPTIMIZE TABLE will defragment a table. In\norder to use it to update fulltext index statistics, the\ninnodb_optimize_fulltext_only system variable must be set to\n1. This is intended to be a temporary setting, and should be\nreset to 0 once the fulltext index has been re-organized.\n \nSince fulltext re-organization can take a long time, the\ninnodb_ft_num_word_optimize variable limits the\nre-organization to a number of words (2000 by default). You\ncan run multiple OPTIMIZE statements to fully re-organize\nthe index.\n \nDefragmenting InnoDB tablespaces\n \nMariaDB 10.1.1 merged the Facebook/Kakao defragmentation\npatch \n \nMariaDB 10.1.1 merged the Facebook/Kakao defragmentation\npatch, allowing one to use OPTIMIZE TABLE to defragment\nInnoDB tablespaces. For this functionality to be enabled,\nthe innodb_defragment system variable must be enabled. No\nnew tables are created and there is no need to copy data\nfrom old tables to new tables. Instead, this feature loads n\npages (determined by innodb-defragment-n-pages) and tries to\nmove records so that pages would be full of records and then\nfrees pages that are fully empty after the operation. Note\nthat tablespace files (including ibdata1) will not shrink as\nthe result of defragmentation, but one will get better\nmemory utilization in the InnoDB buffer pool as there are\nfewer data pages in use.\n \nSee Defragmenting InnoDB Tablespaces for more details.\n \n\n\nURL: https://mariadb.com/kb/en/library/optimize-table/','','https://mariadb.com/kb/en/library/optimize-table/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (256,20,'REPAIR TABLE','Syntax\n------ \nREPAIR [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n [QUICK] [EXTENDED] [USE_FRM]\n \nDescription\n----------- \nREPAIR TABLE repairs a possibly corrupted table. By default,\nit has the same effect as\n \nmyisamchk --recover tbl_name\n \nor\n \naria_chk --recover tbl_name\n \nSee aria_chk and myisamchk for more.\n \nREPAIR TABLE works for Archive, Aria, CSV and MyISAM tables.\nFor XtraDB/InnoDB, see recovery modes. For CSV, see also\nChecking and Repairing CSV Tables. For Archive, this\nstatement also improves compression. If the storage engine\ndoes not support this statement, a warning is issued.\n \nThis statement requires SELECT and INSERT privileges for the\ntable.\n \nBy default, REPAIR TABLE statements are written to the\nbinary log and will be replicated. The NO_WRITE_TO_BINLOG\nkeyword (LOCAL is an alias) will ensure the statement is not\nwritten to the binary log.\n \nWhen an index is recreated, the storage engine may use a\nconfigurable buffer in the process. Incrementing the buffer\nspeeds up the index creation. Aria and MyISAM allocate a\nbuffer whose size is defined by aria_sort_buffer_size or\nmyisam_sort_buffer_size, also used for ALTER TABLE.\n \nREPAIR TABLE is also supported for partitioned tables.\nHowever, the USE_FRM option cannot be used with this\nstatement\non a partitioned table.\n \n ALTER TABLE ... REPAIR PARTITION can be used\nto repair one or more partitions.\n \nThe Aria storage engine supports progress reporting for this\nstatement.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/repair-table/','','https://mariadb.com/kb/en/library/repair-table/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (257,20,'REPAIR VIEW','REPAIR VIEW was introduced in MariaDB 10.0.18 and MariaDB\n5.5.43.\n \nSyntax\n------ \nREPAIR [NO_WRITE_TO_BINLOG | LOCAL] VIEW view_name[,\nview_name] ... [FROM MYSQL]\n \nDescription\n----------- \nThe REPAIR VIEW statement was introduced to assist with\nfixing MDEV-6916, an issue introduced in MariaDB 5.2 where\nthe view algorithms were swapped compared to their MySQL on\ndisk representation. It checks whether the view algorithm is\ncorrect. It is run as part of mysql_upgrade, and should not\nnormally be required in regular use.\n \nBy default it corrects the checksum and if necessary adds\nthe mariadb-version field. If the optional FROM MYSQL clause\nis used, and no mariadb-version field is present, the MERGE\nand TEMPTABLE algorithms are toggled.\n \nBy default, REPAIR VIEW statements are written to the binary\nlog and will be replicated. The NO_WRITE_TO_BINLOG keyword\n(LOCAL is an alias) will ensure the statement is not written\nto the binary log.\n \nNote that REPAIR VIEW in MariaDB 10.0.18 and MariaDB 5.5.43\ncould crash the server (see MDEV-8115). Upgrade to a later\nversion.\n \n\n\nURL: https://mariadb.com/kb/en/library/repair-view/','','https://mariadb.com/kb/en/library/repair-view/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (258,21,'CREATE FUNCTION UDF','Syntax\n------ \nCREATE [OR REPLACE] [AGGREGATE] FUNCTION [IF NOT EXISTS]\nfunction_name\n RETURNS {STRING|INTEGER|REAL|DECIMAL}\n SONAME shared_library_name\n \nDescription\n----------- \nA user-defined function (UDF) is a way to extend MariaDB\nwith a new function\nthat works like a native (built-in) MariaDB function such as\nABS() or\nCONCAT().\n \nfunction_name is the name that should be used in SQL\nstatements to invoke\nthe function. \n \nTo create a function, you must have the INSERT privilege for\nthe\nmysql database. This is necessary because CREATE FUNCTION\nadds a row to the\nmysql.func system table that records the function\'s name,\ntype, and shared library name. If you do not have this\ntable, you should run\nthe mysql_upgrade command to create it.\n \nUDFs need to be written in C, C++ or another language that\nuses C calling\nconventions, MariaDB needs to have been dynamically\ncompiled, and your\noperating system must support dynamic loading.\n \nFor an example, see sql/udf_example.cc in the source tree.\nFor a collection of existing UDFs see\nhttp://www.mysqludf.org/.\n \nStatements making use of user-defined functions are not\nsafe for replication.\n \nFor creating a stored function as opposed to a user-defined\nfunction, see\nCREATE FUNCTION.\n \nFor valid identifiers to use as function names, see\nIdentifier Names.\n \nRETURNS\n \nThe RETURNS clause indicates the type of the function\'s\nreturn value, and can be one of STRING, INTEGER, REAL or\nDECIMAL. DECIMAL functions currently return string values\nand should be written like STRING functions.\n \nshared_library_name\n \nshared_library_name is the basename of the shared object\nfile that contains\nthe code that implements the function. The file must be\nlocated in the plugin\ndirectory. This directory is given by the value of the\nplugin_dir system variable. Note that\nbefore MariaDB/MySQL 5.1, the shared object could be located\nin any directory\nthat was searched by your system\'s dynamic linker.\n \nAGGREGATE\n \nAggregate functions are summary functions such as SUM() and\nAVG().\n \nAggregate UDF functions can be used as window functions.\n \nOR REPLACE\n \nThe OR REPLACE clause was added in MariaDB 10.1.3\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP FUNCTION IF EXISTS function_name;\n \nCREATE FUNCTION name ...;\n \nIF NOT EXISTS\n \nThe IF NOT EXISTS clause was added in MariaDB 10.1.3\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the specified function\nalready exists. Cannot be used together with OR REPLACE.\n \nUpgrading a UDF\n \nTo upgrade the UDF\'s shared library, first run a\nDROP FUNCTION statement, then upgrade the shared library and\nfinally run the CREATE FUNCTION statement. If you upgrade\nwithout following\nthis process, you may crash the server.\n \nExamples\n-------- \nCREATE FUNCTION jsoncontains_path RETURNS integer SONAME\n\'ha_connect.so\';\n \nQuery OK, 0 rows affected (0.00 sec)\n \nOR REPLACE and IF NOT EXISTS:\n \nCREATE FUNCTION jsoncontains_path RETURNS integer SONAME\n\'ha_connect.so\';\n \nERROR 1125 (HY000): Function \'jsoncontains_path\' already\nexists\n \nCREATE OR REPLACE FUNCTION jsoncontains_path RETURNS integer\nSONAME \'ha_connect.so\';\n \nQuery OK, 0 rows affected (0.00 sec)\n \nCREATE FUNCTION IF NOT EXISTS jsoncontains_path RETURNS\ninteger SONAME \'ha_connect.so\';\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+---------------------------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------------------------+\n| Note | 1125 | Function \'jsoncontains_path\' already\nexists |\n+-------+------+---------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/create-function-udf/','','https://mariadb.com/kb/en/library/create-function-udf/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (259,21,'DROP FUNCTION UDF','Syntax\n------ \nDROP FUNCTION [IF EXISTS] function_name\n \nDescription\n----------- \nThis statement drops the user-defined function (UDF) named\nfunction_name.\n \nTo drop a function, you must have the DELETE privilege for\nthe mysql database. This is because DROP FUNCTION removes\nthe row from the mysql.func system table that records the\nfunction\'s name, type and shared library name.\n \nFor dropping a stored function, see DROP FUNCTION.\n \nUpgrading a UDF\n \nTo upgrade the UDF\'s shared library, first run a DROP\nFUNCTION statement, then upgrade the shared library and\nfinally run the CREATE FUNCTION statement. If you upgrade\nwithout following this process, you may crash the server.\n \nExamples\n-------- \nDROP FUNCTION jsoncontains_path;\n \nIF EXISTS:\n \nDROP FUNCTION jsoncontains_path;\n \nERROR 1305 (42000): FUNCTION test.jsoncontains_path does not\nexist\n \nDROP FUNCTION IF EXISTS jsoncontains_path;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------------------+\n| Note | 1305 | FUNCTION test.jsoncontains_path does not\nexist |\n+-------+------+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/drop-function-udf/','','https://mariadb.com/kb/en/library/drop-function-udf/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (260,21,'Creating User-Defined Functions','User-defined functions allow MariaDB to be extended with a\nnew function that works like a native (built-in) MariaDB\nfunction such as ABS() or CONCAT(). There are alternative\nways to add a new function: writing a native function (which\nrequires modifying and compiling the server source code), or\nwriting a stored function.\n \nStatements making use of user-defined functions are not safe\nfor replication.\n \nFunctions are written in C or C++, and to make use of them,\nthe operating system must support dynamic loading. \n \nEach new SQL function requires corresponding functions\nwritten in C/C++. In the list below, at least the main\nfunction - x() - and one other, are required. x should be\nreplaced by the name of the function you are creating.\n \nAll functions need to be thread-safe, so not global or\nstatic variables that change can be allocated. Memory is\nallocated in x_init()/ and freed in x_deinit(). \n \nSimple Functions\n \nx()\n \nRequired for all UDF\'s, this is where the results are\ncalculated.\n \nC/C++ type | SQL type | \n \nchar * | STRING | \n \nlong long | INTEGER | \n \ndouble | REAL | \n \nDECIMAL functions return string values, and so should be\nwritten accordingly. It is not possible to create ROW\nfunctions.\n \nx_init()\n \nInitialization function for x(). Can be used for the\nfollowing:\nCheck the number of arguments to X() (the SQL equivalent).\nVerify the argument types, or to force arguments to be of a\nparticular type after the function is called.\nSpecify whether the result can be NULL.\nSpecify the maximum result length.\nFor REAL functions, specify the maximum number of decimals\nfor the result.\nAllocate any required memory.\n To verify that the arguments are of a required type or,\nalternatively, to tell MySQL to coerce arguments to the\nrequired types when the main function is called.\n \nx_deinit()\n \nDe-initialization function for x(). Used to de-allocate\nmemory that was allocated in x_init().\n \nDescription\n----------- \nEach time the SQL function X() is called:\nMariaDB will first call the C/C++ initialization function,\nx_init(), assuming it exists. All setup will be performed,\nand if it returns an error, the SQL statement is aborted and\nno further functions are called.\nIf there is no x_init() function, or it has been called and\ndid not return an error, x() is then called once per row.\nAfter all rows have finished processing, x_deinit() is\ncalled, if present, to clean up by de-allocating any memory\nthat was allocated in x_init().\nSee User-defined Functions Calling Sequences for more\ndetails on the functions.\n \nAggregate Functions\n \nThe following functions are required for aggregate\nfunctions, such as AVG() and SUM(). \n \nx_clear()\n \nUsed to reset the current aggregate, but without inserting\nthe argument as the initial aggregate value for the new\ngroup.\n \nx_add()\n \nUsed to add the argument to the current aggregate. \n \nx_remove()\n \nStaring from MariaDB 10.4 it improves the support of window\nfunctions (so it is not obligatory to add it) and should\nremove the argument from the current aggregate.\n \nDescription\n----------- \nEach time the aggregate SQL function X() is called:\nMariaDB will first call the C/C++ initialization function,\nx_init(), assuming it exists. All setup will be performed,\nand if it returns an error, the SQL statement is aborted and\nno further functions are called.\nIf there is no x_init() function, or it has been called and\ndid not return an error, x() is then called once per row.\nAfter all rows have finished processing, x_deinit() is\ncalled, if present, to clean up by de-allocating any memory\nthat was allocated in x_init().\n \nMariaDB will first call the C/C++ initialization function,\nx_init(), assuming it exists. All setup will be performed,\nand if it returns an error, the SQL statement is aborted and\nno further functions are called.\nThe table is sorted according to the GROUP BY expression.\nx_clear() is called for the first row of each new group.\nx_add() is called once per row for each row in the same\ngroup.\nx() is called when the group changes, or after the last row,\nto get the aggregate result. \nThe latter three steps are repeated until all rows have been\nprocessed.\nAfter all rows have finished processing, x_deinit() is\ncalled, if present, to clean up by de-allocating any memory\nthat was allocated in x_init().\n \nExamples\n-------- \nFor an example, see sql/udf_example.cc in the source tree.\nFor a collection of existing UDFs see\nhttps://github.com/mysqludf.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/creating-user-defined-functions/','','https://mariadb.com/kb/en/library/creating-user-defined-functions/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (261,21,'User-Defined Functions Calling Sequences','The functions described in Creating User-defined Functions\nare expanded on this page. They are declared as follows:\n \nSimple Functions\n \nx()\n \nIf x() returns an integer, it is declared as follows:\n \nlong long x(UDF_INIT *initid, UDF_ARGS *args,\n char *is_null, char *error);\n \nIf x() returns a string (DECIMAL functions also return\nstring values), it is declared as follows:\n \nchar *x(UDF_INIT *initid, UDF_ARGS *args,\n char *result, unsigned long *length,\n char *is_null, char *error);\n \nIf x() returns a real, it is declared as follows:\n \ndouble x(UDF_INIT *initid, UDF_ARGS *args,\n char *is_null, char *error);\n \nx_init()\n \nmy_bool x_init(UDF_INIT *initid, UDF_ARGS *args, char\n*message);\n \nx_deinit()\n \nvoid x_deinit(UDF_INIT *initid);\n \nDescription\n----------- \ninitid is a parameter passed to all three functions that\npoints to a UDF_INIT structure, used for communicating\ninformation between the functions. Its structure members\nare:\nmy_bool maybe_null\nmaybe_null should be set to 1 if x_init can return a NULL\nvalue, Defaults to 1 if any arguments are declared\nmaybe_null.\n \nunsigned int decimals\nNumber of decimals after the decimal point. The default, if\nan explicit number of decimals is passed in the arguments to\nthe main function, is the maximum number of decimals, so if\n9.5, 9.55 and 9.555 are passed to the function, the default\nwould be three (based on 9.555, the maximum). If there are\nno explicit number of decimals, the default is set to 31, or\none more than the maximum for the DOUBLE, FLOAT and DECIMAL\ntypes. This default can be changed in the function to suit\nthe actual calculation.\n \nunsigned int max_length\nMaximum length of the result. For integers, the default is\n21. For strings, the length of the longest argument. For\nreals, the default is 13 plus the number of decimals\nindicated by initid->decimals. The length includes any signs\nor decimal points. Can also be set to 65KB or 16MB in order\nto return a BLOB. The memory remains unallocated, but this\nis used to decide on the data type to use if the data needs\nto be temporarily stored.\n \nchar *ptr\nA pointer for use as required by the function. Commonly,\ninitid->ptr is used to communicate allocated memory, with\nx_init() allocating the memory and assigning it to this\npointer, x() using it, and x_deinit() de-allocating it.\n \nmy_bool const_item\nShould be set to 1 in x_init() if x() always returns the\nsame value, otherwise 0.\n \n\nAggregate Functions\n \nx_clear()\n \nx_clear() is a required function for aggregate functions,\nand is declared as follows:\n \nvoid x_clear(UDF_INIT *initid, char *is_null, char *error);\n \nIt is called when the summary results need to be reset, that\nis at the beginning of each new group. but also to reset the\nvalues when there were no matching rows.\n \nis_null is set to point to CHAR(0) before calling x_clear().\n \nIn the case of an error, you can store the value to which\nthe error argument points (a single-byte variable, not a\nstring string buffer) in the variable.\n \nx_reset()\n \nx_reset() is declared as follows:\n \nvoid x_reset(UDF_INIT *initid, UDF_ARGS *args,\n char *is_null, char *error);\n \nIt is called on finding the first row in a new group. Should\nreset the summary variables, and then use UDF_ARGS as the\nfirst value in the group\'s internal summary value. The\nfunction is not required if the UDF interface uses\nx_clear().\n \nx_add()\n \nx_add() is declared as follows:\n \nvoid x_add(UDF_INIT *initid, UDF_ARGS *args,\n char *is_null, char *error);\n \nIt is called for all rows belonging to the same group, and\nshould be used to add the value in UDF_ARGS to the internal\nsummary variable.\n \nx_remove()\n \nx_remove() was added in MariaDB 10.4 and is declared as\nfollows (same as x_add()):\n \nvoid x_remove(UDF_INIT* initid, UDF_ARGS* args,\n char* is_null, char *error );\n \nIt adds more efficient support of aggregate UDFs as window\nfunctions. x_remove() should \"subtract\" the row (reverse\nx_add()). In MariaDB 10.4 aggregate UDFs will work as WINDOW\nfunctions without x_remove() but it will not be so\nefficient.\n \nIf x_remove() supported (defined) detected automatically.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/user-defined-functions-calling-sequences/','','https://mariadb.com/kb/en/library/user-defined-functions-calling-sequences/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (262,21,'User-Defined Functions Security','The MariaDB server imposes a number of limitations on\nuser-defined functions for security purposes.\nThe INSERT privilege for the mysql database is required to\nrun CREATE FUNCTION, as a record will be added to the\nmysql.func-table.\nThe DELETE privilege for the mysql database is required to\nrun DROP FUNCTION as the corresponding record will be\nremoved from the mysql.func-table.\nUDF object files can only be placed in the plugin directory,\nas specified by the value of the plugin_dir system variable.\nAt least one symbol, beyond the required x() - corresponding\nto an SQL function X()) - is required. These can be\nx_init(), x_deinit(), xxx_reset(), x_clear() and x_add()\nfunctions (see Creating User-defined Functions). The\nallow-suspicious-udfs mysqld option (by default unset)\nprovides a workaround, permitting only one symbol to be\nused. This is not recommended, as it opens the possibility\nof loading shared objects that are not legitimate\nuser-defined functions.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/user-defined-functions-security/','','https://mariadb.com/kb/en/library/user-defined-functions-security/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (263,21,'mysql.func Table','The mysql.func table stores information about user-defined\nfunctions (UDFs) created with the CREATE FUNCTION UDF\nstatement.\n \nIn MariaDB 10.4 and later, this table uses the Aria storage\nengine.\n \nMariaDB until 10.3\n \nIn MariaDB 10.3 and before, this table uses the MyISAM\nstorage engine.\n \nThe mysql.func table contains the following fields:\n \nField | Type | Null | Key | Default | Description | \n \nname | char(64) | NO | PRI | | UDF name | \n \nret | tinyint(1) | NO | | 0 | | \n \ndl | char(128) | NO | | | Shared library name | \n \ntype | enum(\'function\',\'aggregate\') | NO | | NULL |\nType, either function or aggregate. Aggregate functions are\nsummary functions such as SUM() and AVG(). | \n \nExample\n \nSELECT * FROM mysql.func;\n+------------------------------+-----+--------------+-----------+\n| name | ret | dl | type |\n+------------------------------+-----+--------------+-----------+\n| spider_direct_sql | 2 | ha_spider.so | function |\n| spider_bg_direct_sql | 2 | ha_spider.so | aggregate |\n| spider_ping_table | 2 | ha_spider.so | function |\n| spider_copy_tables | 2 | ha_spider.so | function |\n| spider_flush_table_mon_cache | 2 | ha_spider.so | function\n|\n+------------------------------+-----+--------------+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mysqlfunc-table/','','https://mariadb.com/kb/en/library/mysqlfunc-table/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (264,22,'AUTO_INCREMENT','Description\n----------- \nThe AUTO_INCREMENT attribute can be used to generate a\nunique identity for new rows. When you insert a new record\nto the table, and the auto_increment field is NULL or\nDEFAULT, the value will automatically be incremented. This\nalso applies to 0, unless the NO_AUTO_VALUE_ON_ZERO SQL_MODE\nis enabled.\n \nAUTO_INCREMENT columns start from 1 by default. The\nautomatically generated value can never be lower than 0.\n \nEach table can have only one AUTO_INCREMENT column. It must\ndefined as a key (not necessarily the PRIMARY KEY or UNIQUE\nkey). In some storage engines (including the default\nInnoDB), if the key consists of multiple columns, the\nAUTO_INCREMENT column must be the first column. Storage\nengines that permit the column to be placed elsewhere are\nAria, MyISAM, MERGE, Spider, TokuDB, BLACKHOLE, FederatedX\nand Federated.\n \nCREATE TABLE animals (\n id MEDIUMINT NOT NULL AUTO_INCREMENT,\n name CHAR(30) NOT NULL,\n PRIMARY KEY (id)\n );\n \nINSERT INTO animals (name) VALUES\n (\'dog\'),(\'cat\'),(\'penguin\'),\n (\'fox\'),(\'whale\'),(\'ostrich\');\n \nSELECT * FROM animals;\n \n+----+---------+\n| id | name |\n+----+---------+\n| 1 | dog |\n| 2 | cat |\n| 3 | penguin |\n| 4 | fox |\n| 5 | whale |\n| 6 | ostrich |\n+----+---------+\n \nSERIAL is an alias for BIGINT UNSIGNED NOT NULL\nAUTO_INCREMENT UNIQUE.\n \nCREATE TABLE t (id SERIAL, c CHAR(1)) ENGINE=InnoDB;\n \nSHOW CREATE TABLE t \\G\n*************************** 1. row\n***************************\n Table: t\nCreate Table: CREATE TABLE `t` (\n `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n `c` char(1) DEFAULT NULL,\n UNIQUE KEY `id` (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n \nSetting or Changing the Auto_Increment Value\n \nYou can use an ALTER TABLE statement to assign a new value\nto the auto_increment table option, or set the insert_id\nserver system variable to change the next AUTO_INCREMENT\nvalue inserted by the current session.\n \nLAST_INSERT_ID() can be used to see the last AUTO_INCREMENT\nvalue inserted by the current session.\n \nALTER TABLE animals AUTO_INCREMENT=8;\n \nINSERT INTO animals (name) VALUES (\'aardvark\');\n \nSELECT * FROM animals;\n \n+----+-----------+\n| id | name |\n+----+-----------+\n| 1 | dog |\n| 2 | cat |\n| 3 | penguin |\n| 4 | fox |\n| 5 | whale |\n| 6 | ostrich |\n| 8 | aardvark |\n+----+-----------+\n \nSET insert_id=12;\n \nINSERT INTO animals (name) VALUES (\'gorilla\');\n \nSELECT * FROM animals;\n \n+----+-----------+\n| id | name |\n+----+-----------+\n| 1 | dog |\n| 2 | cat |\n| 3 | penguin |\n| 4 | fox |\n| 5 | whale |\n| 6 | ostrich |\n| 8 | aardvark |\n| 12 | gorilla |\n+----+-----------+\n \nInnoDB/XtraDB\n \nUntil MariaDB 10.2.3, InnoDB and XtraDB used an\nauto-increment counter that is stored in memory. When the\nserver restarts, the counter is re-initialized to the\nhighest value used in the table, which cancels the effects\nof any AUTO_INCREMENT = N option in the table statements.\n \nFrom MariaDB 10.2.4, this restriction has been lifted and\nAUTO_INCREMENT is persistent.\n \nSee also AUTO_INCREMENT Handling in XtraDB/InnoDB.\n \nSetting Explicit Values\n \nIt is possible to specify a value for an AUTO_INCREMENT\ncolumn. The value must not exist in the key.\n \nIf the new value is higher than the current maximum value,\nthe AUTO_INCREMENT value is updated, so the next value will\nbe higher. If the new value is lower than the current\nmaximum value, the AUTO_INCREMENT value remains unchanged.\n \nThe following example demonstrates these behaviours:\n \nCREATE TABLE t (id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY\nKEY) ENGINE = InnoDB;\n \nINSERT INTO t VALUES (NULL);\nSELECT id FROM t;\n \n+----+\n| id |\n+----+\n| 1 |\n+----+\n \nINSERT INTO t VALUES (10); -- higher value\nSELECT id FROM t;\n \n+----+\n| id |\n+----+\n| 1 |\n| 10 |\n+----+\n \nINSERT INTO t VALUES (2); -- lower value\nINSERT INTO t VALUES (NULL); -- auto value\nSELECT id FROM t;\n \n+----+\n| id |\n+----+\n| 1 |\n| 2 |\n| 10 |\n| 11 |\n+----+\n \nThe ARCHIVE storage engine does not allow to insert a value\nthat is lower than the current maximum.\n \nMissing Values\n \nAn AUTO_INCREMENT column normally has missing values. This\nhappens because if a row is deleted, or an AUTO_INCREMENT\nvalue is explicitly updated, old values are never re-used.\nThe REPLACE statement also deletes a row, and its value is\nwasted. With InnoDB, values can be reserved by a\ntransaction; but if the transaction fails (for example,\nbecause of a ROLLBACK) the reserved value will be lost.\n \nThus AUTO_INCREMENT values can be used to sort results in a\nchronological order, but not to create a numeric sequence.\n \nReplication\n \nTo make master-master or Galera safe to use AUTO_INCREMENT\none should use the system variables \n auto_increment_increment and auto_increment_offset to\ngenerate unique values for each server.\n \nCHECK Constraints, DEFAULT Values and Virtual Columns\n \nFrom MariaDB 10.2.6 auto_increment columns are no longer\npermitted in CHECK constraints, DEFAULT value expressions\nand virtual columns. They were permitted in earlier\nversions, but did not work correctly. See MDEV-11117.\n \n\n\nURL: https://mariadb.com/kb/en/library/auto_increment/','','https://mariadb.com/kb/en/library/auto_increment/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (265,22,'BIGINT','Syntax\n------ \nBIGINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA large integer. The signed range is -9223372036854775808 to\n9223372036854775807. The unsigned range is 0 to\n18446744073709551615.\n \nIf a column has been set to ZEROFILL, all values will be\nprepended by zeros so that the BIGINT value contains a\nnumber of M digits.\n \nNote: If the ZEROFILL attribute has been specified, the\ncolumn will automatically become UNSIGNED.\n \nFor more details on the attributes, see Numeric Data Type\nOverview.\n \nSERIAL is an alias for:\n \nBIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE\n \nExamples\n-------- \nCREATE TABLE bigints (a BIGINT,b BIGINT UNSIGNED,c BIGINT\nZEROFILL);\n \nINSERT INTO bigints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.08 sec)\nWarning (Code 1264): Out of range value for column \'b\' at\nrow 1\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO bigints VALUES (-10,10,-10);Query OK, 1 row\naffected, 1 warning (0.08 sec)\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO bigints VALUES (-10,10,10);\n \nINSERT INTO bigints VALUES\n(9223372036854775808,9223372036854775808,9223372036854775808);\nQuery OK, 1 row affected, 1 warning (0.07 sec)\nWarning (Code 1264): Out of range value for column \'a\' at\nrow 1\n \nINSERT INTO bigints VALUES\n(9223372036854775807,9223372036854775808,9223372036854775808);\n \nSELECT * FROM bigints;\n+---------------------+---------------------+----------------------+\n| a | b | c |\n+---------------------+---------------------+----------------------+\n| -10 | 0 | 00000000000000000000 |\n| -10 | 10 | 00000000000000000000 |\n| -10 | 10 | 00000000000000000010 |\n| 9223372036854775807 | 9223372036854775808 |\n09223372036854775808 |\n| 9223372036854775807 | 9223372036854775808 |\n09223372036854775808 |\n+---------------------+---------------------+----------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/bigint/','','https://mariadb.com/kb/en/library/bigint/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (266,22,'BINARY','Syntax\n------ \nBINARY(M)\n \nDescription\n----------- \nThe BINARY type is similar to the CHAR type, but stores\nbinary\nbyte strings rather than non-binary character strings. M\nrepresents the\ncolumn length in bytes.\n \nIt contains no character set, and comparison and sorting are\nbased on the numeric value of the bytes.\n \nIf the maximum length is exceeded, and SQL strict mode is\nnot enabled , the extra characters will be dropped with a\nwarning. If strict mode is enabled, an error will occur.\n \nBINARY values are right-padded with 0x00 (the zero byte) to\nthe specified length when inserted. The padding is not\nremoved on select, so this needs to be taken into account\nwhen sorting and comparing, where all bytes are significant.\nThe zero byte, 0x00 is less than a space for comparison\npurposes.\n \nExamples\n-------- \nInserting too many characters, first with strict mode off,\nthen with it on:\n \nCREATE TABLE bins (a BINARY(10));\n \nINSERT INTO bins VALUES(\'12345678901\');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n \nSELECT * FROM bins;\n \n+------------+\n| a |\n+------------+\n| 1234567890 |\n+------------+\n \nSET sql_mode=\'STRICT_ALL_TABLES\';\n \nINSERT INTO bins VALUES(\'12345678901\');\nERROR 1406 (22001): Data too long for column \'a\' at row 1\n \nSorting is performed with the byte value:\n \nTRUNCATE bins;\n \nINSERT INTO bins VALUES(\'A\'),(\'B\'),(\'a\'),(\'b\');\n \nSELECT * FROM bins ORDER BY a;\n \n+------+\n| a |\n+------+\n| A |\n| B |\n| a |\n| b |\n+------+\n \nUsing CAST to sort as a CHAR instead:\n \nSELECT * FROM bins ORDER BY CAST(a AS CHAR);\n+------+\n| a |\n+------+\n| a |\n| A |\n| b |\n| B |\n+------+\n \nThe field is a BINARY(10), so padding of two \'\\0\'s are\ninserted, causing comparisons that don\'t take this into\naccount to fail:\n \nTRUNCATE bins;\n \nINSERT INTO bins VALUES(\'12345678\');\n \nSELECT a = \'12345678\', a = \'12345678\\0\\0\' from bins;\n \n+----------------+--------------------+\n| a = \'12345678\' | a = \'12345678\\0\\0\' |\n+----------------+--------------------+\n| 0 | 1 |\n+----------------+--------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/binary/','','https://mariadb.com/kb/en/library/binary/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (267,22,'BIT','Syntax\n------ \nBIT[(M)]\n \nDescription\n----------- \nA bit-field type. M indicates the number of bits per value,\nfrom 1 to\n64. The default is 1 if M is omitted.\n \nBit values can be inserted with b\'value\' notation, where\nvalue is the bit value in 0\'s and 1\'s.\n \nBit fields are automatically zero-padded from the left to\nthe full length of the bit, so for example in a BIT(4)\nfield, \'10\' is equivalent to \'0010\'.\n \nBits are returned as binary, so to display them, either add\n0, or use a function such as HEX, OCT or BIN to convert\nthem.\n \nExamples\n-------- \nCREATE TEMPORARY TABLE b ( b1 BIT(8) );\nINSERT INTO b VALUES\n(b\'11111111\'),(b\'01010101\'),(b\'1111111111111\');\nQuery OK, 3 rows affected, 1 warning (0.10 sec)\nRecords: 3 Duplicates: 0 Warnings: 1\n \nSHOW WARNINGS;\n+---------+------+---------------------------------------------+\n| Level | Code | Message |\n+---------+------+---------------------------------------------+\n| Warning | 1264 | Out of range value for column \'b1\' at\nrow 3 |\n+---------+------+---------------------------------------------+\n \nSELECT b1+0, HEX(b1), OCT(b1), BIN(b1) FROM b;\n+------+---------+---------+----------+\n| b1+0 | HEX(b1) | OCT(b1) | BIN(b1) |\n+------+---------+---------+----------+\n| 255 | FF | 377 | 11111111 |\n| 85 | 55 | 125 | 1010101 |\n| 255 | FF | 377 | 11111111 |\n+------+---------+---------+----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/bit/','','https://mariadb.com/kb/en/library/bit/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (268,22,'BLOB','Syntax\n------ \nBLOB[(M)]\n \nDescription\n----------- \nA BLOB column with a maximum length of 65,535 (216 - 1)\nbytes. Each\nBLOB value is stored using a two-byte length prefix that\nindicates the\nnumber of bytes in the value.\n \nAn optional length M can be given for this type. If this is\ndone,\nMariaDB creates the column as the smallest BLOB type large\nenough to\nhold values M bytes long.\n \nBLOBS can also be used to store dynamic columns.\n \nBefore MariaDB 10.2.1, BLOB and TEXT columns could not be\nassigned a DEFAULT value. This restriction was lifted in\nMariaDB 10.2.1.\n \nIndexing\n \nIn MariaDB 10.4, it is possible to set a Unique index on a\ncolumn that uses the BLOB data type. In previous releases\nthis was not possible, as the index would only guarantee the\nuniqueness of a fixed number of characters.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, BLOB is a synonym for\nLONGBLOB.\n \n\n\nURL: https://mariadb.com/kb/en/library/blob/','','https://mariadb.com/kb/en/library/blob/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (269,22,'BLOB and TEXT Data Types','Description\n----------- \nA BLOB is a binary large object that can hold a variable\namount of\ndata. The four BLOB types are \nTINYBLOB,\nBLOB, \nMEDIUMBLOB, and\nLONGBLOB.\n \nThese differ only in the maximum length of the values they\ncan hold. \n \nThe TEXT types are \nTINYTEXT,\nTEXT,\nMEDIUMTEXT, and\nLONGTEXT.\nJSON (alias for LONGTEXT)\n \nThese correspond to the four BLOB types and have the same\nmaximum lengths and storage requirements.\n \nStarting from MariaDB 10.2.1, BLOB and TEXT columns can have\na DEFAULT value.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/blob-and-text-data-types/','','https://mariadb.com/kb/en/library/blob-and-text-data-types/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (270,22,'BOOLEAN','Syntax\n------ \nBOOL, BOOLEAN\n \nDescription\n----------- \nThese types are synonyms for TINYINT(1). \nA value of zero is considered false. Non-zero values are\nconsidered true:\n \nmysql> SELECT IF(0, \'true\', \'false\');\n+------------------------+\n| IF(0, \'true\', \'false\') |\n+------------------------+\n| false |\n+------------------------+\n \nmysql> SELECT IF(1, \'true\', \'false\');\n+------------------------+\n| IF(1, \'true\', \'false\') |\n+------------------------+\n| true |\n+------------------------+\n \nmysql> SELECT IF(2, \'true\', \'false\');\n+------------------------+\n| IF(2, \'true\', \'false\') |\n+------------------------+\n| true |\n+------------------------+\n \nHowever, the values TRUE and FALSE are merely aliases for 1\nand 0,\nrespectively, as shown here:\n \nmysql> SELECT IF(0 = FALSE, \'true\', \'false\');\n \n+--------------------------------+\n| IF(0 = FALSE, \'true\', \'false\') |\n+--------------------------------+\n| true |\n+--------------------------------+\n \nmysql> SELECT IF(1 = TRUE, \'true\', \'false\');\n+-------------------------------+\n| IF(1 = TRUE, \'true\', \'false\') |\n+-------------------------------+\n| true |\n+-------------------------------+\n \nmysql> SELECT IF(2 = TRUE, \'true\', \'false\');\n+-------------------------------+\n| IF(2 = TRUE, \'true\', \'false\') |\n+-------------------------------+\n| false |\n+-------------------------------+\n \nmysql> SELECT IF(2 = FALSE, \'true\', \'false\');\n+--------------------------------+\n| IF(2 = FALSE, \'true\', \'false\') |\n+--------------------------------+\n| false |\n+--------------------------------+\n \nUNKNOWN is an alias for NULL.\n \nThe last two statements display the results shown because 2\nis equal\nto neither 1 nor 0.\n \n\n\nURL: https://mariadb.com/kb/en/library/boolean/','','https://mariadb.com/kb/en/library/boolean/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (271,22,'CHAR','This article covers the CHAR data type. See CHAR Function\nfor the function.\n \nSyntax\n------ \n[NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA fixed-length string that is always right-padded with\nspaces to the specified\nlength when stored. M represents the column length in\ncharacters. The range\nof M is 0 to 255. If M is omitted, the length is 1.\n \nCHAR(0) columns can contain 2 values: an empty string or\nNULL. Such columns cannot be part of an index. The CONNECT\nstorage engine does not support CHAR(0).\n \nNote: Trailing spaces are removed when CHAR values are\nretrieved\nunless the PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.\n \nBefore MariaDB 10.2, all collations were of type PADSPACE,\nmeaning that CHAR (as well as VARCHAR and TEXT) values are\ncompared without regard for trailing spaces. This does not\napply to the LIKE pattern-matching operator, which takes\ninto account trailing spaces.\n \nIf a unique index consists of a column where trailing pad\ncharacters are stripped or ignored, inserts into that column\nwhere values differ only by the number of trailing pad\ncharacters will result in a duplicate-key error.\n \nExamples\n-------- \nTrailing spaces:\n \nCREATE TABLE strtest (c CHAR(10));\nINSERT INTO strtest VALUES(\'Maria \');\n \nSELECT c=\'Maria\',c=\'Maria \' FROM strtest;\n \n+-----------+--------------+\n| c=\'Maria\' | c=\'Maria \' |\n+-----------+--------------+\n| 1 | 1 |\n+-----------+--------------+\n \nSELECT c LIKE \'Maria\',c LIKE \'Maria \' FROM strtest;\n \n+----------------+-------------------+\n| c LIKE \'Maria\' | c LIKE \'Maria \' |\n+----------------+-------------------+\n| 1 | 0 |\n+----------------+-------------------+\n \nNO PAD Collations\n \nNO PAD collations regard trailing spaces as normal\ncharacters. You can get a list of all NO PAD collations by\nquerying the Information Schema Collations table, for\nexample:\n \nSELECT collation_name FROM information_schema.collations \n WHERE collation_name LIKE \"%nopad%\";\n \n+------------------------------+\n| collation_name |\n+------------------------------+\n| big5_chinese_nopad_ci |\n| big5_nopad_bin |\n...\n \n\n\nURL: https://mariadb.com/kb/en/library/char/','','https://mariadb.com/kb/en/library/char/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (272,22,'CHAR BYTE','Description\n----------- \nThe CHAR BYTE data type is an alias for the \nBINARY data type. This is a\ncompatibility feature.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/char-byte/','','https://mariadb.com/kb/en/library/char-byte/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (273,22,'DATE','Syntax\n------ \nDATE\n \nDescription\n----------- \nA date. The supported range is \'1000-01-01\' to\n\'9999-12-31\'. MariaDB\ndisplays DATE values in \'YYYY-MM-DD\' format, but can be\nassigned dates in looser formats, including strings or\nnumbers, as long as they make sense. These include a short\nyear, YY-MM-DD, no delimiters, YYMMDD, or any other\nacceptable delimiter, for example YYYY/MM/DD. For details,\nsee date and time literals.\n \n\'0000-00-00\' is a permitted special value (zero-date),\nunless the NO_ZERO_DATE SQL_MODE is used. Also, individual\ncomponents of a date can be set to 0 (for example:\n\'2015-00-12\'), unless the NO_ZERO_IN_DATE SQL_MODE is\nused. In many cases, the result of en expression involving a\nzero-date, or a date with zero-parts, is NULL. If the\nALLOW_INVALID_DATES SQL_MODE is enabled, if the day part is\nin the range between 1 and 31, the date does not produce any\nerror, even for months that have less than 31 days.\n \nExamples\n-------- \nCREATE TABLE t1 (d DATE);\n \nINSERT INTO t1 VALUES (\"2010-01-12\"), (\"2011-2-28\"),\n(\'120314\'),(\'13*04*21\');\n \nSELECT * FROM t1;\n \n+------------+\n| d |\n+------------+\n| 2010-01-12 |\n| 2011-02-28 |\n| 2012-03-14 |\n| 2013-04-21 |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/date/','','https://mariadb.com/kb/en/library/date/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (274,22,'DATETIME','Syntax\n------ \nDATETIME [(microsecond precision)]\n \nDescription\n----------- \nA date and time combination. The supported range is\n\'1000-01-01 00:00:00.000000\' to \'9999-12-31\n23:59:59.999999\'.\nMariaDB displays DATETIME values in \'YYYY-MM-DD HH:MM:SS\'\nformat, but\nallows assignment of values to DATETIME columns using either\nstrings or\nnumbers. For details, see date and time literals.\n \nThe microsecond precision can be from 0-6. If not specified\n0 is used.\n \n\'0000-00-00\' is a permitted special value (zero-date),\nunless the NO_ZERO_DATE SQL_MODE is used. Also, individual\ncomponents of a date can be set to 0 (for example:\n\'2015-00-12\'), unless the NO_ZERO_IN_DATE SQL_MODE is\nused. In many cases, the result of en expression involving a\nzero-date, or a date with zero-parts, is NULL. If the\nALLOW_INVALID_DATES SQL_MODE is enabled, if the day part is\nin the range between 1 and 31, the date does not produce any\nerror, even for months that have less than 31 days.\n \nSince MariaDB 10.0.1, DATETIME columns also accept\nCURRENT_TIMESTAMP as the default value.\n \nMariaDB 10.1.2 introduced the --mysql56-temporal-format\noption, on by default, which allows MariaDB to store\nDATETMEs using the same low-level format MySQL 5.6 uses. For\nmore information, see Internal Format, below.\n \nFor storage requirements, see Data Type Storage\nRequirements.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, DATE with a time portion\nis a synonym for DATETIME.\n \nInternal Format\n \nIn MariaDB 10.1.2 a new temporal format was introduced from\nMySQL 5.6 that alters how the TIME, DATETIME and TIMESTAMP\ncolumns operate at lower levels. These changes allow these\ntemporal data types to have fractional parts and negative\nvalues. You can disable this feature using the\nmysql56_temporal_format system variable.\n \nTables that include TIMESTAMP values that were created on an\nolder version of MariaDB or that were created while the\nmysql56_temporal_format system variable was disabled\ncontinue to store data using the older data type format.\n \nIn order to update table columns from the older format to\nthe newer format, execute an ALTER TABLE... MODIFY COLUMN\nstatement that changes the column to the *same* data type.\nThis change may be needed if you want to export the table\'s\ntablespace and import it onto a server that has\nmysql56_temporal_format=ON set (see MDEV-15225).\n \nFor instance, if you have a DATETIME column in your table: \n \nSHOW VARIABLES LIKE \'mysql56_temporal_format\';\n \n+-------------------------+-------+\n| Variable_name | Value |\n+-------------------------+-------+\n| mysql56_temporal_format | ON |\n+-------------------------+-------+\n \nALTER TABLE example_table MODIFY ts_col DATETIME;\n \nWhen MariaDB executes the ALTER TABLE statement, it converts\nthe data from the older temporal format to the newer one. \n \nIn the event that you have several tables and columns using\ntemporal data types that you want to switch over to the new\nformat, make sure the system variable is enabled, then\nperform a dump and restore using mysqldump. The columns\nusing relevant temporal data types are restored using the\nnew temporal format.\n \nExamples\n-------- \nCREATE TABLE t1 (d DATETIME);\n \nINSERT INTO t1 VALUES (\"2011-03-11\"), (\"2012-04-19\n13:08:22\"),\n (\"2013-07-18 13:44:22.123456\");\n \nSELECT * FROM t1;\n \n+---------------------+\n| d |\n+---------------------+\n| 2011-03-11 00:00:00 |\n| 2012-04-19 13:08:22 |\n| 2013-07-18 13:44:22 |\n+---------------------+\n \nCREATE TABLE t2 (d DATETIME(6));\n \nINSERT INTO t2 VALUES (\"2011-03-11\"), (\"2012-04-19\n13:08:22\"),\n (\"2013-07-18 13:44:22.123456\");\n \nSELECT * FROM t2;\n \n+----------------------------+\n| d |\n+----------------------------+\n| 2011-03-11 00:00:00.000000 |\n| 2012-04-19 13:08:22.000000 |\n| 2013-07-18 13:44:22.123456 |\n+----------------------------++\n \nStrings used in datetime context are automatically converted\nto datetime(6). If you want to have a datetime without\nseconds, you should use CONVERT(..,datetime).\n \nSELECT CONVERT(\'2007-11-30 10:30:19\',datetime);\n+-----------------------------------------+\n| CONVERT(\'2007-11-30 10:30:19\',datetime) |\n+-----------------------------------------+\n| 2007-11-30 10:30:19 |\n+-----------------------------------------+\n \nSELECT CONVERT(\'2007-11-30 10:30:19\',datetime(6));\n+--------------------------------------------+\n| CONVERT(\'2007-11-30 10:30:19\',datetime(6)) |\n+--------------------------------------------+\n| 2007-11-30 10:30:19.000000 |\n+--------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/datetime/','','https://mariadb.com/kb/en/library/datetime/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (275,22,'DECIMAL','Syntax\n------ \nDECIMAL[(M[,D])] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA packed \"exact\" fixed-point number. M is the total number\nof digits (the\nprecision) and D is the number of digits after the decimal\npoint (the\nscale). The decimal point and (for negative numbers) the\n\"-\" sign are not\ncounted in M. If D is 0, values have no decimal point or\nfractional\npart and on INSERT the value will be rounded to the nearest\nDECIMAL. The maximum number of digits (M) for DECIMAL is 65.\nThe maximum number of supported decimals (D) is 30 before\nMariadB 10.2.1 and 38 afterwards. If D is omitted, the\ndefault is 0. If M is omitted, the default is 10.\n \nUNSIGNED, if specified, disallows negative values.\n \nZEROFILL, if specified, pads the number with zeros, up to\nthe total number\nof digits specified by M.\n \nAll basic calculations (+, -, *, /) with DECIMAL columns are\ndone with\na precision of 65 digits.\n \nFor more details on the attributes, see Numeric Data Type\nOverview.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, NUMBER is a synonym.\n \nExamples\n-------- \nCREATE TABLE t1 (d DECIMAL UNSIGNED ZEROFILL);\n \nINSERT INTO t1 VALUES (1),(2),(3),(4.0),(5.2),(5.7);\nQuery OK, 6 rows affected, 2 warnings (0.16 sec)\nRecords: 6 Duplicates: 0 Warnings: 2\n \nNote (Code 1265): Data truncated for column \'d\' at row 5\nNote (Code 1265): Data truncated for column \'d\' at row 6\n \nSELECT * FROM t1;\n \n+------------+\n| d |\n+------------+\n| 0000000001 |\n| 0000000002 |\n| 0000000003 |\n| 0000000004 |\n| 0000000005 |\n| 0000000006 |\n+------------+\n \nINSERT INTO t1 VALUES (-7);\nERROR 1264 (22003): Out of range value for column \'d\' at\nrow 1\n \n\n\nURL: https://mariadb.com/kb/en/library/decimal/','','https://mariadb.com/kb/en/library/decimal/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (276,22,'ENUM','Syntax\n------ \nENUM(\'value1\',\'value2\',...) [CHARACTER SET charset_name]\n[COLLATE collation_name]\n \nDescription\n----------- \nAn enumeration. A string object that can have only one\nvalue, chosen\nfrom the list of values \'value1\', \'value2\', ..., NULL or\nthe special \n\'\' error value. In theory, an ENUM column can have a\nmaximum of 65,535 distinct\nvalues; in practice, the real maximum depends on many\nfactors. ENUM values are represented internally as integers.\n \nTrailing spaces are automatically stripped from ENUM values\non table creation.\n \nENUMs require relatively little storage space compared to\nstrings, either one or two bytes depending on the number of\nenumeration values.\n \nNULL and empty values\n \nAn ENUM can also contain NULL and empty values. If the ENUM\ncolumn is declared to permit NULL values, NULL becomes a\nvalid value, as well as the default value (see below). If\nstrict SQL Mode is not enabled, and an invalid value is\ninserted into an ENUM, a special empty string, with an index\nvalue of zero (see Numeric index, below), is inserted, with\na warning. This may be confusing, because the empty string\nis also a possible value, and the only difference if that in\nthis case its index is not 0. Inserting will fail with an\nerror if strict mode is active.\n \nIf a DEFAULT clause is missing, the default value will be:\nNULL is the column is nullable;\notherwise, the first value in the enumaration.\n \nNumeric index\n \nENUM values are indexed numerically in the order they are\ndefined, and sorting will be performed in this numeric\norder. We suggest not using ENUM to store numerals, as there\nis little to no storage space benefit, and it is easy to\nconfuse the enum integer with the enum numeral value by\nleaving out the quotes.\n \nAn ENUM defined as ENUM(\'apple\',\'orange\',\'pear\') would\nhave the following index values:\n \nIndex | Value | \n \nNULL | NULL | \n \n0 | \'\' | \n \n1 | \'apple\' | \n \n2 | \'orange\' | \n \n3 | \'pear\' | \n \nExamples\n-------- \nCREATE TABLE fruits (\n id INT NOT NULL auto_increment PRIMARY KEY,\n fruit ENUM(\'apple\',\'orange\',\'pear\'),\n bushels INT);\n \nDESCRIBE fruits;\n \n+---------+-------------------------------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+---------+-------------------------------+------+-----+---------+----------------+\n| id | int(11) | NO | PRI | NULL | auto_increment |\n| fruit | enum(\'apple\',\'orange\',\'pear\') | YES | | NULL\n| |\n| bushels | int(11) | YES | | NULL | |\n+---------+-------------------------------+------+-----+---------+----------------+\n \nINSERT INTO fruits\n (fruit,bushels) VALUES\n (\'pear\',20),\n (\'apple\',100),\n (\'orange\',25);\n \nINSERT INTO fruits\n (fruit,bushels) VALUES\n (\'avocado\',10);\nERROR 1265 (01000): Data truncated for column \'fruit\' at\nrow 1\n \nSELECT * FROM fruits;\n \n+----+--------+---------+\n| id | fruit | bushels |\n+----+--------+---------+\n| 1 | pear | 20 |\n| 2 | apple | 100 |\n| 3 | orange | 25 |\n+----+--------+---------+\n \nSelecting by numeric index:\n \nSELECT * FROM fruits WHERE fruit=2;\n \n+----+--------+---------+\n| id | fruit | bushels |\n+----+--------+---------+\n| 3 | orange | 25 |\n+----+--------+---------+\n \nSorting is according to the index value:\n \nCREATE TABLE enums (a ENUM(\'2\',\'1\'));\n \nINSERT INTO enums VALUES (\'1\'),(\'2\');\n \nSELECT * FROM enums ORDER BY a ASC;\n \n+------+\n| a |\n+------+\n| 2 |\n| 1 |\n+------+\n \nIt\'s easy to get confused between returning the enum\ninteger with the stored value, so we don\'t suggest using\nENUM to store numerals. The first example returns the 1st\nindexed field (\'2\' has an index value of 1, as it\'s\ndefined first), while the second example returns the string\nvalue \'1\'.\n \nSELECT * FROM enums WHERE a=1;\n \n+------+\n| a |\n+------+\n| 2 |\n+------+\n \nSELECT * FROM enums WHERE a=\'1\';\n \n+------+\n| a |\n+------+\n| 1 |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/enum/','','https://mariadb.com/kb/en/library/enum/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (277,22,'DOUBLE','Syntax\n------ \nDOUBLE[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\nDOUBLE PRECISION[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\nREAL[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA normal-size (double-precision) floating-point number (see\nFLOAT for a single-precision floating-point number).\n \nAllowable values are:\n-1.7976931348623157E+308 to -2.2250738585072014E-308\n0\n2.2250738585072014E-308 to 1.7976931348623157E+308\n \nThese are the theoretical limits, based on the IEEE\nstandard. The actual range\nmight be slightly smaller depending on your hardware or\noperating system.\n \nM is the total number of digits and D is the number of\ndigits\nfollowing the decimal point. If M and D are omitted, values\nare stored\nto the limits allowed by the hardware. A double-precision\nfloating-point number is accurate to approximately 15\ndecimal places.\n \nUNSIGNED, if specified, disallows negative values.\n \nZEROFILL, if specified, pads the number with zeros, up to\nthe total number\nof digits specified by M.\n \nREAL and DOUBLE PRECISION are synonyms, unless the\nREAL_AS_FLOAT SQL mode is enabled, in which case REAL is a\nsynonym for FLOAT rather than DOUBLE.\n \nSee Floating Point Accuracy for issues when using\nfloating-point numbers.\n \nFor more details on the attributes, see Numeric Data Type\nOverview.\n \nExamples\n-------- \nCREATE TABLE t1 (d DOUBLE(5,0) zerofill);\n \nINSERT INTO t1 VALUES (1),(2),(3),(4);\n \nSELECT * FROM t1;\n \n+-------+\n| d |\n+-------+\n| 00001 |\n| 00002 |\n| 00003 |\n| 00004 |\n+-------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/double/','','https://mariadb.com/kb/en/library/double/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (278,22,'FLOAT','Syntax\n------ \nFLOAT[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA small (single-precision) floating-point number (see DOUBLE\nfor a regular-size floating point number). Allowable values\nare:\n-3.402823466E+38 to -1.175494351E-38\n0\n1.175494351E-38 to 3.402823466E+38. \n \nThese are the theoretical limits, based on the IEEE \nstandard. The actual range might be slightly smaller\ndepending on your\nhardware or operating system.\n \nM is the total number of digits and D is the number of\ndigits\nfollowing the decimal point. If M and D are omitted, values\nare stored\nto the limits allowed by the hardware. A single-precision\nfloating-point number is accurate to approximately 7 decimal\nplaces.\n \nUNSIGNED, if specified, disallows negative values.\n \nUsing FLOAT might give you some unexpected problems because\nall\ncalculations in MariaDB are done with double precision. See\nFloating Point Accuracy.\n \nFor more details on the attributes, see Numeric Data Type\nOverview.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/float/','','https://mariadb.com/kb/en/library/float/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (279,22,'Geometry Types','Description\n----------- \nMariaDB provides a standard way of creating spatial columns\nfor geometry types,\nfor example, with CREATE TABLE or ALTER TABLE.\nCurrently, spatial columns are supported for MyISAM, InnoDB,\nNDB, and ARCHIVE\ntables. See also SPATIAL INDEX.\n \nThe basic geometry type is GEOMETRY. But the type can be\nmore specific. The following types are supported:\n \nGeometry Types | \n \nPOINT | \n \nLINESTRING | \n \nPOLYGON | \n \nMULTIPOINT | \n \nMULTILINESTRING | \n \nMULTIPOLYGON | \n \nGEOMETRYCOLLECTION | \n \nGEOMETRY | \n \nExamples\n-------- \nNote: For clarity, only one type is listed per table in the\nexamples below, but a table\nrow can contain multiple types. For example:\n \nCREATE TABLE object (shapeA POLYGON, shapeB LINESTRING);\n \nPOINT\n \nCREATE TABLE gis_point (g POINT);\nSHOW FIELDS FROM gis_point;\n \nINSERT INTO gis_point VALUES\n (PointFromText(\'POINT(10 10)\')),\n (PointFromText(\'POINT(20 10)\')),\n (PointFromText(\'POINT(20 20)\')),\n (PointFromWKB(AsWKB(PointFromText(\'POINT(10 20)\'))));\n \nLINESTRING\n \nCREATE TABLE gis_line (g LINESTRING);\nSHOW FIELDS FROM gis_line;\n \nINSERT INTO gis_line VALUES\n (LineFromText(\'LINESTRING(0 0,0 10,10 0)\')),\n (LineStringFromText(\'LINESTRING(10 10,20 10,20 20,10 20,10\n10)\')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10),\nPoint(40, 10)))));\n \nPOLYGON\n \nCREATE TABLE gis_polygon (g POLYGON);\nSHOW FIELDS FROM gis_polygon;\n \nINSERT INTO gis_polygon VALUES\n (PolygonFromText(\'POLYGON((10 10,20 10,20 20,10 20,10\n10))\')),\n (PolyFromText(\'POLYGON((0 0,50 0,50 50,0 50,0 0), (10\n10,20 10,20 20,10 20,10 10))\')),\n (PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0),\nPoint(30, 0), Point(30, 30), Point(0, 0))))));\n \nMULTIPOINT\n \nCREATE TABLE gis_multi_point (g MULTIPOINT);\nSHOW FIELDS FROM gis_multi_point;\n \nINSERT INTO gis_multi_point VALUES\n (MultiPointFromText(\'MULTIPOINT(0 0,10 10,10 20,20\n20)\')),\n (MPointFromText(\'MULTIPOINT(1 1,11 11,11 21,21 21)\')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4,\n10)))));\n \nMULTILINESTRING\n \nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nSHOW FIELDS FROM gis_multi_line;\n \nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(\'MULTILINESTRING((10 48,10 21,10\n0),(16 0,16 23,16 48))\')),\n (MLineFromText(\'MULTILINESTRING((10 48,10 21,10 0))\')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2),\nPoint(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21,\n7))))));\n \nMULTIPOLYGON\n \nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nSHOW FIELDS FROM gis_multi_polygon;\n \nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84\n42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67\n13,59 13,59 18)))\')),\n (MPolyFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28\n26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59\n13,59 18)))\')),\n (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0,\n3), Point(3, 3), Point(3, 0), Point(0, 3)))))));\n \nGEOMETRYCOLLECTION\n \nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\n \nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText(\'GEOMETRYCOLLECTION(POINT(0 0),\nLINESTRING(0 0,10 10))\')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText(\'GeometryCollection()\')),\n (GeomFromText(\'GeometryCollection EMPTY\'));\n \nGEOMETRY\n \nCREATE TABLE gis_geometry (g GEOMETRY);\nSHOW FIELDS FROM gis_geometry;\n \nINSERT into gis_geometry SELECT * FROM gis_point;\n \nINSERT into gis_geometry SELECT * FROM gis_line;\n \nINSERT into gis_geometry SELECT * FROM gis_polygon;\n \nINSERT into gis_geometry SELECT * FROM gis_multi_point;\n \nINSERT into gis_geometry SELECT * FROM gis_multi_line;\n \nINSERT into gis_geometry SELECT * FROM gis_multi_polygon;\n \nINSERT into gis_geometry SELECT * FROM\ngis_geometrycollection;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/geometry-types/','','https://mariadb.com/kb/en/library/geometry-types/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (280,22,'JSON Data Type','The JSON alias was added in MariaDB 10.2.7. This was done to\nmake it possible to use JSON columns in statement based\nreplication from MySQL to MariaDB and to make it possible\nfor MariaDB to read mysqldumps from MySQL.\n \nJSON is an alias for LONGTEXT introduced for compatibility\nreasons with MySQL\'s JSON data type. MariaDB implements\nthis as a LONGTEXT rather, as the JSON data type contradicts\nthe SQL standard, and MariaDB\'s benchmarks indicate that\nperformance is at least equivalent.\n \nIn order to ensure that a a valid json document is inserted,\nthe JSON_VALID function can be used as a CHECK constraint.\nThis constraint is automatically included for types using\nthe JSON alias from MariaDB 10.4.3.\n \nExamples\n-------- \nCREATE TABLE t (j JSON);\n \nDESC t;\n+-------+----------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+----------+------+-----+---------+-------+\n| j | longtext | YES | | NULL | |\n+-------+----------+------+-----+---------+-------+\n \nWith validation:\n \nCREATE TABLE t2 (\n j JSON \n CHECK (JSON_VALID(j))\n);\n \nINSERT INTO t2 VALUES (\'invalid\');\nERROR 4025 (23000): CONSTRAINT `j` failed for `test`.`t2`\n \nINSERT INTO t2 VALUES (\'{\"id\": 1, \"name\":\n\"Monty\"}\');\nQuery OK, 1 row affected (0.13 sec)\n \nReplicating JSON Data Between MySQL and MariaDB\n \nThe JSON type in MySQL stores the JSON object in a compact\nform, not as LONGTEXT as in MariaDB.\nThis means that row based replication will not work for JSON\ntypes from MySQL to MariaDB.\n \nThere are a a few different ways to solve this:\nUse statement based replication.\nChange the JSON column to type TEXT in MySQL\n \nConverting a MySQL TABLE with JSON Fields to MariaDB\n \nMariaDB can\'t directly access MySQL JSON format.\n \nThere is a a few different ways to move the table to\nMariaDB:\nChange the JSON column to type TEXT in MySQL. After this\nMariaDB can directly use the table without any need for a\ndump and restore.\nUse mysqldump to copy the table.\n \nDifferences Between MySQL JSON Strings and MariaDB JSON\nStrings\n \nIn MySQL, JSON is an object and is compared according to\njson values. In MariaDB JSON strings are normal strings and\ncompared as strings. One exception is when using\nJSON_EXTRACT() in which case strings are unescaped before\ncomparison.\n \n\n\nURL: https://mariadb.com/kb/en/library/json-data-type/','','https://mariadb.com/kb/en/library/json-data-type/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (281,22,'LONGBLOB','Syntax\n------ \nLONGBLOB\n \nDescription\n----------- \nA BLOB column with a \nmaximum length of 4,294,967,295 bytes or 4GB (232 - 1). The\neffective maximum length of LONGBLOB columns depends on the\nconfigured maximum packet size in the client/server protocol\nand\navailable memory. Each LONGBLOB value is stored using a\nfour-byte\nlength prefix that indicates the number of bytes in the\nvalue.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, BLOB is a synonym for\nLONGBLOB.\n \n\n\nURL: https://mariadb.com/kb/en/library/longblob/','','https://mariadb.com/kb/en/library/longblob/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (282,22,'LONGTEXT','Syntax\n------ \nLONGTEXT [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA TEXT column with a maximum length of 4,294,967,295 or 4GB\n(232 - 1) characters. The effective maximum length is less\nif the value contains multi-byte characters. The effective\nmaximum length of LONGTEXT columns also depends on the\nconfigured maximum packet size in the client/server protocol\nand available memory. Each LONGTEXT value is stored using a\nfour-byte length prefix that indicates the number of bytes\nin the value.\n \nFrom MariaDB 10.2.7, JSON is an alias for LONGTEXT. See JSON\nData Type for details.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, CLOB is a synonym for\nLONGTEXT.\n \n\n\nURL: https://mariadb.com/kb/en/library/longtext/','','https://mariadb.com/kb/en/library/longtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (283,22,'MEDIUMBLOB','Syntax\n------ \nMEDIUMBLOB\n \nDescription\n----------- \nA BLOB column with a maximum\nlength of 16,777,215 (224 - 1) bytes.\nEach MEDIUMBLOB value is stored using a three-byte length\nprefix that\nindicates the number of bytes in the value. \n \n\n\nURL: https://mariadb.com/kb/en/library/mediumblob/','','https://mariadb.com/kb/en/library/mediumblob/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (284,22,'MEDIUMINT','Syntax\n------ \nMEDIUMINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA medium-sized integer. The signed range is -8388608 to\n8388607. The\nunsigned range is 0 to 16777215.\n \nZEROFILL pads the integer with zeroes and assumes UNSIGNED\n(even if UNSIGNED is not specified).\n \nFor details on the attributes, see Numeric Data Type\nOverview.\n \nExamples\n-------- \nCREATE TABLE mediumints (a MEDIUMINT,b MEDIUMINT UNSIGNED,c\nMEDIUMINT ZEROFILL);\n \nDESCRIBE mediumints;\n+-------+--------------------------------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+--------------------------------+------+-----+---------+-------+\n| a | mediumint(9) | YES | | NULL | |\n| b | mediumint(8) unsigned | YES | | NULL | |\n| c | mediumint(8) unsigned zerofill | YES | | NULL | |\n+-------+--------------------------------+------+-----+---------+-------+\n \nINSERT INTO mediumints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.05 sec)\nWarning (Code 1264): Out of range value for column \'b\' at\nrow 1\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO mediumints VALUES (-10,10,-10);\nQuery OK, 1 row affected, 1 warning (0.08 sec)\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO mediumints VALUES (-10,10,10);\n \nINSERT INTO mediumints VALUES (8388608,8388608,8388608);\nQuery OK, 1 row affected, 1 warning (0.05 sec)\nWarning (Code 1264): Out of range value for column \'a\' at\nrow 1\n \nINSERT INTO mediumints VALUES (8388607,8388608,8388608);\n \nSELECT * FROM mediumints;\n+---------+---------+----------+\n| a | b | c |\n+---------+---------+----------+\n| -10 | 0 | 00000000 |\n| -10 | 0 | 00000000 |\n| -10 | 10 | 00000000 |\n| -10 | 10 | 00000010 |\n| 8388607 | 8388608 | 08388608 |\n| 8388607 | 8388608 | 08388608 |\n+---------+---------+----------+\n \n\n\nURL: https://mariadb.com/kb/en/library/mediumint/','','https://mariadb.com/kb/en/library/mediumint/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (285,22,'MEDIUMTEXT','Syntax\n------ \nMEDIUMTEXT [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA TEXT column with a \nmaximum length of 16,777,215 (224 - 1)\ncharacters. The effective maximum length is less if the\nvalue\ncontains multi-byte characters. Each MEDIUMTEXT value is\nstored using\na three-byte length prefix that indicates the number of\nbytes in the\nvalue.\n \n\n\nURL: https://mariadb.com/kb/en/library/mediumtext/','','https://mariadb.com/kb/en/library/mediumtext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (286,22,'Numeric Data Type Overview','There are a number of numeric data types:\nTINYINT\nBOOLEAN - Synonym for TINYINT(1)\nSMALLINT\nMEDIUMINT\nINT, INTEGER\nBIGINT\nDECIMAL, DEC, NUMERIC, FIXED\nFLOAT\nDOUBLE, DOUBLE PRECISION, REAL\nBIT\n \nSee the specific articles for detailed information on each.\n \nSIGNED, UNSIGNED and ZEROFILL\n \nMost numeric types can be defined as SIGNED, UNSIGNED or\nZEROFILL, for example:\n \nTINYINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n \nIf SIGNED, or no attribute, is specified, a portion of the\nnumeric type will be reserved for the sign (plus or minus).\nFor example, a TINYINT SIGNED can range from -128 to 127. \n \nIf UNSIGNED is specified, no portion of the numeric type is\nreserved for the sign, so for integer types range can be\nlarger. For example, a TINYINT UNSIGNED can range from 0 to\n255. Floating point and fixed-point types also can be\nUNSIGNED, but this only prevents negative values from being\nstored and doesn\'t alter the range. \n \nIf ZEROFILL is specified, the column will be set to UNSIGNED\nand the spaces used by default to pad the field are replaced\nwith zeros. ZEROFILL is ignored in expressions or as part of\na UNION. ZEROFILL is a non-standard MySQL and MariaDB\nenhancement.\n \nNote that although the preferred syntax indicates that the\nattributes are exclusive, more than one attribute can be\nspecified.\n \nUntil MariaDB 10.2.7 (MDEV-8659), any combination of the\nattributes could be used in any order, with duplicates. In\nthis case:\nthe presence of ZEROFILL makes the column UNSIGNED ZEROFILL.\nthe presence of UNSIGNED makes the column UNSIGNED.\n \nFrom MariaDB 10.2.8, only the following combinations are\nsupported:\nSIGNED\nUNSIGNED\nZEROFILL\nUNSIGNED ZEROFILL\nZEROFILL UNSIGNED\n \nThe latter two should be replaced with simply ZEROFILL, but\nare still accepted by the parser.\n \nExamples\n-------- \nCREATE TABLE zf (\n i1 TINYINT SIGNED,\n i2 TINYINT UNSIGNED,\n i3 TINYINT ZEROFILL\n);\n \nINSERT INTO zf VALUES (2,2,2);\n \nSELECT * FROM zf;\n \n+------+------+------+\n| i1 | i2 | i3 |\n+------+------+------+\n| 2 | 2 | 002 |\n+------+------+------+\n \nRange\n \nWhen attempting to add a value that is out of the valid\nrange for the numeric type, MariaDB will react depending on\nthe strict SQL_MODE setting.\n \nIf strict_mode has been set (the default from MariaDB\n10.2.4), MariaDB will return an error.\n \nIf strict_mode has not been set (the default until MariaDB\n10.2.3), MariaDB will adjust the number to fit in the field,\nreturning a warning.\n \nExamples\n-------- \nWith strict_mode set:\n \nSHOW VARIABLES LIKE \'sql_mode\';\n \n+---------------+-------------------------------------------------------------------------------------------+\n| Variable_name | Value |\n+---------------+-------------------------------------------------------------------------------------------+\n| sql_mode |\nSTRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION\n|\n+---------------+-------------------------------------------------------------------------------------------+\n \nCREATE TABLE ranges (i1 TINYINT, i2 SMALLINT, i3 TINYINT\nUNSIGNED);\n \nINSERT INTO ranges VALUES (257,257,257);\nERROR 1264 (22003): Out of range value for column \'i1\' at\nrow 1\n \nSELECT * FROM ranges;\n \nEmpty set (0.10 sec)\n \nWith strict_mode unset:\n \nSHOW VARIABLES LIKE \'sql_mode%\';\n \n+---------------+-------+\n| Variable_name | Value |\n+---------------+-------+\n| sql_mode | |\n+---------------+-------+\n \nCREATE TABLE ranges (i1 TINYINT, i2 SMALLINT, i3 TINYINT\nUNSIGNED);\n \nINSERT INTO ranges VALUES (257,257,257);\nQuery OK, 1 row affected, 2 warnings (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+---------------------------------------------+\n| Level | Code | Message |\n+---------+------+---------------------------------------------+\n| Warning | 1264 | Out of range value for column \'i1\' at\nrow 1 |\n| Warning | 1264 | Out of range value for column \'i3\' at\nrow 1 |\n+---------+------+---------------------------------------------+\n2 rows in set (0.00 sec)\n \nSELECT * FROM ranges;\n \n+------+------+------+\n| i1 | i2 | i3 |\n+------+------+------+\n| 127 | 257 | 255 |\n+------+------+------+\n \nAuto_increment\n \nThe AUTO_INCREMENT attribute can be used to generate a\nunique identity for new rows. For more details, see\nauto_increment.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/numeric-data-type-overview/','','https://mariadb.com/kb/en/library/numeric-data-type-overview/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (287,22,'ROW','The ROW data type was introduced in MariaDB 10.3.0.\n \nSyntax\n------ \nROW ( [{, }... ])\n \nDescription\n----------- \nROW is a data type for stored procedure variables.\n \nFeatures\n \nROW fields as normal variables\n \nROW fields (members) act as normal variables, and are able\nto appear in all\nquery parts where a stored procedure variable is allowed:\nAssignment is using the := operator and the SET command:\n \na.x:= 10;\n \na.x:= b.x;\n \nSET a.x= 10, a.y=20, a.z= b.z;\n \nPassing to functions and operators:\n \nSELECT f1(rec.a), rec.a\n\nURL: https://mariadb.com/kb/en/library/row/','','https://mariadb.com/kb/en/library/row/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (288,22,'SET Data Type','Syntax\n------ \nSET(\'value1\',\'value2\',...) [CHARACTER SET charset_name]\n[COLLATE collation_name]\n \nDescription\n----------- \nA set. A string object that can have zero or more values,\neach of\nwhich must be chosen from the list of values \'value1\',\n\'value2\', ... A\nSET column can have a maximum of 64 members. SET values are\nrepresented internally as integers.\n \n\n\nURL: https://mariadb.com/kb/en/library/set-data-type/','','https://mariadb.com/kb/en/library/set-data-type/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (289,22,'SMALLINT','Syntax\n------ \nSMALLINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA small integer. The signed range is -32768 to 32767. The\nunsigned range is 0 to 65535.\n \nIf a column has been set to ZEROFILL, all values will be\nprepended by zeros so that the SMALLINT value contains a\nnumber of M digits.\n \nNote: If the ZEROFILL attribute has been specified, the\ncolumn will automatically become UNSIGNED.\n \nFor more details on the attributes, see Numeric Data Type\nOverview.\n \nExamples\n-------- \nCREATE TABLE smallints (a SMALLINT,b SMALLINT UNSIGNED,c\nSMALLINT ZEROFILL);\n \nINSERT INTO smallints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.09 sec)\nWarning (Code 1264): Out of range value for column \'b\' at\nrow 1\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO smallints VALUES (-10,10,-10);\nQuery OK, 1 row affected, 1 warning (0.08 sec)\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO smallints VALUES (-10,10,10);\n \nINSERT INTO smallints VALUES (32768,32768,32768);\nQuery OK, 1 row affected, 1 warning (0.04 sec)\nWarning (Code 1264): Out of range value for column \'a\' at\nrow 1\n \nINSERT INTO smallints VALUES (32767,32768,32768);\n \nSELECT * FROM smallints;\n+-------+-------+-------+\n| a | b | c |\n+-------+-------+-------+\n| -10 | 0 | 00000 |\n| -10 | 10 | 00000 |\n| -10 | 10 | 00010 |\n| 32767 | 32768 | 32768 |\n| 32767 | 32768 | 32768 |\n+-------+-------+-------+\n \n\n\nURL: https://mariadb.com/kb/en/library/smallint/','','https://mariadb.com/kb/en/library/smallint/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (290,22,'String Literals','Strings are sequences of characters and are enclosed with\nquotes.\n \nThe syntax is:\n \n[_charset_name]\'string\' [COLLATE collation_name]\n \nFor example:\n \n\'The MariaDB Foundation\'\n_utf8 \'Foundation\' COLLATE utf8_unicode_ci;\n \nStrings can either be enclosed in single quotes or in double\nquotes (the same character must be used to both open and\nclose the string).\n \nThe ANSI SQL-standard does not permit double quotes for\nenclosing strings, and although MariaDB does by default, if\nthe MariaDB server has enabled the ANSI_QUOTES_SQL SQL_MODE,\ndouble quotes will be treated as being used for identifiers\ninstead of strings.\n \nStrings that are next to each other are automatically\nconcatenated. For example:\n \n\'The \' \'MariaDB \' \'Foundation\'\n \nand\n \n\'The MariaDB Foundation\'\n \nare equivalent.\n \nThe \\ (backslash character) is used to escape characters.\nFor example:\n \n\'MariaDB\'s new features\'\n \nis not a valid string because of the single quote in the\nmiddle of the string, which is treated as if it closes the\nstring, but is actually meant as part of the string, an\napostrophe. The backslash character helps in situations like\nthis:\n \n\'MariaDB\\\'s new features\'\n \nis now a valid string, and if displayed, will appear without\nthe backslash.\n \nSELECT \'MariaDB\\\'s new features\';\n+------------------------+\n| MariaDB\'s new features |\n+------------------------+\n| MariaDB\'s new features |\n+------------------------+\n \nAnother way to escape the quoting character is repeating it\ntwice:\n \nSELECT \'I\'\'m here\', \"\"\"Double\"\"\";\n+----------+----------+\n| I\'m here | \"Double\" |\n+----------+----------+\n| I\'m here | \"Double\" |\n+----------+----------+\n \nEscape sequences\n \nThere are other escape sequences also. Here is a full list:\n \nEscape sequence | Character | \n \n\\0 | ASCII NUL (0x00). | \n \n\\\' | Single quote (“\'”). | \n \n\\\" | Double quote (“\"”). | \n \n\\b | Backspace. | \n \n\\n | Newline, or linefeed,. | \n \n\\r | Carriage return. | \n \n\\t | Tab. | \n \n\\Z | ASCII 26 (Control+Z). See note following the table. | \n \n\\\\ | Backslash (“\\”). | \n \n\\% | “%” character. See note following the table. | \n \n\\_ | A “_” character. See note following the table. | \n \nEscaping the % and _ characters can be necessary when using\nthe LIKE operator, which treats them as special characters.\n \nThe ASCII 26 character (\\Z) needs to be escaped when\nincluded in a batch file which needs to be executed in\nWindows. The reason is that ASCII 26, in Windows, is the end\nof file (EOF).\n \nBackslash (\\), if not used as an escape character, must\nalways be escaped. When followed by a character that is not\nin the above table, backslashes will simply be ignored.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/string-literals/','','https://mariadb.com/kb/en/library/string-literals/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (291,22,'TEXT','Syntax\n------ \nTEXT[(M)] [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA TEXT column with a maximum length of 65,535 (216 - 1)\ncharacters. The effective maximum length is less if the\nvalue contains\nmulti-byte characters. Each TEXT value is stored using a\ntwo-byte length\nprefix that indicates the number of bytes in the value. If\nyou need a bigger storage, consider using MEDIUMTEXT\ninstead.\n \nAn optional length M can be given for this type. If this is\ndone, MariaDB\ncreates the column as the smallest TEXT type large enough to\nhold values\nM characters long.\n \nBefore MariaDB 10.2, all MariaDB collations were of type\nPADSPACE, meaning that TEXT (as well as VARCHAR and CHAR\nvalues) are compared without regard for trailing spaces.\nThis does not apply to the LIKE pattern-matching operator,\nwhich takes into account trailing spaces.\n \nBefore MariaDB 10.2.1, BLOB and TEXT columns could not be\nassigned a DEFAULT value. This restriction was lifted in\nMariaDB 10.2.1.\n \nExamples\n-------- \nTrailing spaces:\n \nCREATE TABLE strtest (d TEXT(10));\nINSERT INTO strtest VALUES(\'Maria \');\n \nSELECT d=\'Maria\',d=\'Maria \' FROM strtest;\n+-----------+--------------+\n| d=\'Maria\' | d=\'Maria \' |\n+-----------+--------------+\n| 1 | 1 |\n+-----------+--------------+\n \nSELECT d LIKE \'Maria\',d LIKE \'Maria \' FROM strtest;\n+----------------+-------------------+\n| d LIKE \'Maria\' | d LIKE \'Maria \' |\n+----------------+-------------------+\n| 0 | 1 |\n+----------------+-------------------+\n \nDifference between VARCHAR and TEXT\n \nVARCHAR columns can be fully indexed. TEXT columns can only\nbe indexed over a specified length.\nUsing TEXT or BLOB in a SELECT query that uses temporary\ntables for storing intermediate results will force the\ntemporary table to be disk based (using the Aria storage\nengine instead of the memory storage engine, which is a bit\nslower. This is not that bad as the Aria storage engine\ncaches the rows in memory. To get the benefit of this, one\nshould ensure that the aria_pagecache_buffer_size variable\nis big enough to hold most of the row and index data for\ntemporary tables.\n \nFor Storage Engine Developers\n \nInternally the full length of the VARCHAR column is\nallocated inside each TABLE objects record[] structure. As\nthere are three such buffers, each open table will allocate\n3 times max-length-to-store-varchar bytes of memory.\nTEXT and BLOB columns are stored with a pointer (4 or 8\nbytes) + a 1-4 bytes length. The TEXT data is only stored\nonce. This means that internally TEXT uses less memory for\neach open table but instead has the additional overhead that\neach TEXT object needs to be allocated and freed for each\nrow access (with some caching in between).\n \n\n\nURL: https://mariadb.com/kb/en/library/text/','','https://mariadb.com/kb/en/library/text/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (292,22,'TIME','Syntax\n------ \nTIME [()]\n \nDescription\n----------- \nA time. The range is \'-838:59:59.999999\' to\n\'838:59:59.999999\'. Microsecond precision can be from 0-6;\nif not specified 0 is used. Microseconds have been available\nsince MariaDB 5.3. \n \nMariaDB displays TIME values in \'HH:MM:SS.ssssss\' format,\nbut allows assignment of times in looser formats, including\n\'D HH:MM:SS\', \'HH:MM:SS\', \'HH:MM\', \'D HH:MM\', \'D\nHH\', \'SS\', or \'HHMMSS\', as well as permitting dropping\nof any leading zeros when a delimiter is provided, for\nexample \'3:9:10\'. For details, see date and time literals.\n \nMariaDB 10.1.2 introduced the --mysql56-temporal-format\noption, on by default, which allows MariaDB to store TIMEs\nusing the same low-level format MySQL 5.6 uses.\n \nInternal Format\n \nIn MariaDB 10.1.2 a new temporal format was introduced from\nMySQL 5.6 that alters how the TIME, DATETIME and TIMESTAMP\ncolumns operate at lower levels. These changes allow these\ntemporal data types to have fractional parts and negative\nvalues. You can disable this feature using the\nmysql56_temporal_format system variable.\n \nTables that include TIMESTAMP values that were created on an\nolder version of MariaDB or that were created while the\nmysql56_temporal_format system variable was disabled\ncontinue to store data using the older data type format.\n \nIn order to update table columns from the older format to\nthe newer format, execute an ALTER TABLE... MODIFY COLUMN\nstatement that changes the column to the *same* data type.\nThis change may be needed if you want to export the table\'s\ntablespace and import it onto a server that has\nmysql56_temporal_format=ON set (see MDEV-15225).\n \nFor instance, if you have a TIME column in your table: \n \nSHOW VARIABLES LIKE \'mysql56_temporal_format\';\n \n+-------------------------+-------+\n| Variable_name | Value |\n+-------------------------+-------+\n| mysql56_temporal_format | ON |\n+-------------------------+-------+\n \nALTER TABLE example_table MODIFY ts_col TIME;\n \nWhen MariaDB executes the ALTER TABLE statement, it converts\nthe data from the older temporal format to the newer one. \n \nIn the event that you have several tables and columns using\ntemporal data types that you want to switch over to the new\nformat, make sure the system variable is enabled, then\nperform a dump and restore using mysqldump. The columns\nusing relevant temporal data types are restored using the\nnew temporal format.\n \nExamples\n-------- \nINSERT INTO time VALUES (\'90:00:00\'), (\'800:00:00\'),\n(800), (22), (151413), (\'9:6:3\'), (\'12 09\');\n \nSELECT * FROM time;\n+-----------+\n| t |\n+-----------+\n| 90:00:00 |\n| 800:00:00 |\n| 00:08:00 |\n| 00:00:22 |\n| 15:14:13 |\n| 09:06:03 |\n| 297:00:00 |\n+-----------+\n \n\n\nURL: https://mariadb.com/kb/en/library/time/','','https://mariadb.com/kb/en/library/time/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (293,22,'TIMESTAMP','Syntax\n------ \nTIMESTAMP [(\n\nURL: https://mariadb.com/kb/en/library/timestamp/','','https://mariadb.com/kb/en/library/timestamp/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (294,22,'TINYBLOB','Syntax\n------ \nTINYBLOB\n \nDescription\n----------- \nA BLOB column with a maximum length of \n255 (28 - 1) bytes. Each\nTINYBLOB value is stored using a one-byte length prefix that\nindicates\nthe number of bytes in the value.\n \n\n\nURL: https://mariadb.com/kb/en/library/tinyblob/','','https://mariadb.com/kb/en/library/tinyblob/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (295,22,'TINYINT','Syntax\n------ \nTINYINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n \nDescription\n----------- \nA very small integer. The signed range is -128 to 127. The\nunsigned range is 0 to 255. For details on the attributes,\nsee Numeric Data Type Overview.\n \nExamples\n-------- \nCREATE TABLE tinyints (a TINYINT,b TINYINT UNSIGNED,c\nTINYINT ZEROFILL);\nQuery OK, 0 rows affected (0.43 sec)\n \nINSERT INTO tinyints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.08 sec)\nWarning (Code 1264): Out of range value for column \'b\' at\nrow 1\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO tinyints VALUES (-10,10,-10);\nQuery OK, 1 row affected, 1 warning (0.11 sec)\nWarning (Code 1264): Out of range value for column \'c\' at\nrow 1\n \nINSERT INTO tinyints VALUES (-10,10,10);\n \nSELECT * FROM tinyints;\n+------+------+------+\n| a | b | c |\n+------+------+------+\n| -10 | 0 | 000 |\n| -10 | 10 | 000 |\n| -10 | 10 | 010 |\n+------+------+------+\n \nINSERT INTO tinyints VALUES (128,128,128);\nQuery OK, 1 row affected, 1 warning (0.19 sec)\nWarning (Code 1264): Out of range value for column \'a\' at\nrow 1\n \nINSERT INTO tinyints VALUES (127,128,128);\n \nSELECT * FROM tinyints;\n+------+------+------+\n| a | b | c |\n+------+------+------+\n| -10 | 0 | 000 |\n| -10 | 10 | 000 |\n| -10 | 10 | 010 |\n| 127 | 128 | 128 |\n| 127 | 128 | 128 |\n+------+------+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/tinyint/','','https://mariadb.com/kb/en/library/tinyint/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (296,22,'TINYTEXT','Syntax\n------ \nTINYTEXT [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA TEXT column with a maximum length of 255 (28 - 1)\ncharacters. The effective maximum length is less if the\nvalue contains multi-byte characters. Each TINYTEXT value is\nstored using a one-byte length prefix that indicates the\nnumber of bytes in the value.\n \n\n\nURL: https://mariadb.com/kb/en/library/tinytext/','','https://mariadb.com/kb/en/library/tinytext/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (297,22,'VARBINARY','Syntax\n------ \nVARBINARY(M)\n \nDescription\n----------- \nThe VARBINARY type is similar to the VARCHAR type, but\nstores binary byte strings rather than non-binary character\nstrings. M represents the maximum column length in bytes. \n \nIt contains no character set, and comparison and sorting are\nbased on the numeric value of the bytes.\n \nIf the maximum length is exceeded, and SQL strict mode is\nnot enabled , the extra characters will be dropped with a\nwarning. If strict mode is enabled, an error will occur.\n \nUnlike BINARY values, VARBINARYs are not right-padded when\ninserting.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, RAW is a synonym for\nVARBINARY.\n \nExamples\n-------- \nInserting too many characters, first with strict mode off,\nthen with it on:\n \nCREATE TABLE varbins (a VARBINARY(10));\n \nINSERT INTO varbins VALUES(\'12345678901\');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n \nSELECT * FROM varbins;\n \n+------------+\n| a |\n+------------+\n| 1234567890 |\n+------------+\n \nSET sql_mode=\'STRICT_ALL_TABLES\';\n \nINSERT INTO varbins VALUES(\'12345678901\');\nERROR 1406 (22001): Data too long for column \'a\' at row 1\n \nSorting is performed with the byte value:\n \nTRUNCATE varbins;\n \nINSERT INTO varbins VALUES(\'A\'),(\'B\'),(\'a\'),(\'b\');\n \nSELECT * FROM varbins ORDER BY a;\n \n+------+\n| a |\n+------+\n| A |\n| B |\n| a |\n| b |\n+------+\n \nUsing CAST to sort as a CHAR instead:\n \nSELECT * FROM varbins ORDER BY CAST(a AS CHAR);\n+------+\n| a |\n+------+\n| a |\n| A |\n| b |\n| B |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/varbinary/','','https://mariadb.com/kb/en/library/varbinary/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (298,22,'VARCHAR','Syntax\n------ \n[NATIONAL] VARCHAR(M) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n \nDescription\n----------- \nA variable-length string. M represents the maximum column\nlength in\ncharacters. The range of M is 0 to 65,532. The effective\nmaximum\nlength of a VARCHAR is subject to the maximum row size and\nthe character set used. For\nexample, utf8 characters can require up to three bytes per\ncharacter,\nso a VARCHAR column that uses the utf8 character set can be\ndeclared\nto be a maximum of 21,844 characters.\n \nMariaDB stores VARCHAR values as a one-byte or two-byte\nlength prefix\nplus data. The length prefix indicates the number of bytes\nin the\nvalue. A VARCHAR column uses one length byte if values\nrequire no more\nthan 255 bytes, two length bytes if values may require more\nthan 255\nbytes.\n \nNote: MariaDB 5.1 and later follow the standard SQL\nspecification, \nand do not remove trailing spaces from VARCHAR values.\n \nVARCHAR(0) columns can contain 2 values: an empty string or\nNULL. Such columns cannot be part of an index. The CONNECT\nstorage engine does not support VARCHAR(0).\n \nVARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR\nis the\nstandard SQL way to define that a VARCHAR column should use\nsome\npredefined character set. MariaDB uses utf8 as this\npredefined character set, as does MySQL 4.1 and up.\nNVARCHAR is shorthand for NATIONAL VARCHAR.\n \nBefore MariaDB 10.2, all MariaDB collations were of type\nPADSPACE, meaning that VARCHAR (as well as CHAR and TEXT\nvalues) are compared without regard for trailing spaces.\nThis does not apply to the LIKE pattern-matching operator,\nwhich takes into account trailing spaces. From MariaDB 10.2,\na number of NO PAD collations are available.\n \nIf a unique index consists of a column where trailing pad\ncharacters are stripped or ignored, inserts into that column\nwhere values differ only by the number of trailing pad\ncharacters will result in a duplicate-key error.\n \nExamples\n-------- \nThe following are equivalent:\n \nVARCHAR(30) CHARACTER SET utf8\nNATIONAL VARCHAR(30)\nNVARCHAR(30)\nNCHAR VARCHAR(30)\nNATIONAL CHARACTER VARYING(30)\nNATIONAL CHAR VARYING(30)\n \nTrailing spaces:\n \nCREATE TABLE strtest (v VARCHAR(10));\nINSERT INTO strtest VALUES(\'Maria \');\n \nSELECT v=\'Maria\',v=\'Maria \' FROM strtest;\n+-----------+--------------+\n| v=\'Maria\' | v=\'Maria \' |\n+-----------+--------------+\n| 1 | 1 |\n+-----------+--------------+\n \nSELECT v LIKE \'Maria\',v LIKE \'Maria \' FROM strtest;\n+----------------+-------------------+\n| v LIKE \'Maria\' | v LIKE \'Maria \' |\n+----------------+-------------------+\n| 0 | 1 |\n+----------------+-------------------+\n \nTruncation\n \nDepending on whether or not strict sql mode is set, you will\neither get a warning or an error if you try to insert a\nstring that is too long into a VARCHAR column. If the extra\ncharacters are spaces, the spaces that can\'t fit will be\nremoved and you will always get a warning, regardless of the\nsql mode setting.\n \nDifference Between VARCHAR and TEXT\n \nVARCHAR columns can be fully indexed. TEXT columns can only\nbe indexed over a specified length.\nUsing TEXT or BLOB in a SELECT query that uses temporary\ntables for storing intermediate results will force the\ntemporary table to be disk based (using the Aria storage\nengine instead of the memory storage engine, which is a bit\nslower. This is not that bad as the Aria storage engine\ncaches the rows in memory. To get the benefit of this, one\nshould ensure that the aria_pagecache_buffer_size variable\nis big enough to hold most of the row and index data for\ntemporary tables.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, VARCHAR2 is a synonym.\n \nFor Storage Engine Developers\n \nInternally the full length of the VARCHAR column is\nallocated inside each TABLE objects record[] structure. As\nthere are three such buffers, each open table will allocate\n3 times max-length-to-store-varchar bytes of memory.\nTEXT and BLOB columns are stored with a pointer (4 or 8\nbytes) + a 1-4 bytes length. The TEXT data is only stored\nonce. This means that internally TEXT uses less memory for\neach open table but instead has the additional overhead that\neach TEXT object needs to be allocated and freed for each\nrow access (with some caching in between).\n \n\n\nURL: https://mariadb.com/kb/en/library/varchar/','','https://mariadb.com/kb/en/library/varchar/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (299,22,'YEAR Data Type','Syntax\n------ \nYEAR[(4)]\n \nDescription\n----------- \nA year in two-digit or four-digit format. The default is\nfour-digit format. Note that the two-digit format has been\ndeprecated since 5.5.27. \n \nIn four-digit format, the allowable values are 1901 to 2155,\nand 0000. In two-digit format, the allowable values are 70\nto 69,\nrepresenting years from 1970 to 2069. MariaDB displays YEAR\nvalues in\nYYYY format, but allows you to assign values to YEAR columns\nusing\neither strings or numbers.\n \nInserting numeric zero has a different result for YEAR(4)\nand YEAR(2). For YEAR(2), the value 00 reflects the year\n2000. For YEAR(4), the value 0000 reflects the year zero.\nThis only applies to numeric zero. String zero always\nreflects the year 2000.\n \nExamples\n-------- \nAccepting a string or a number:\n \nCREATE TABLE y(y YEAR);\n \nINSERT INTO y VALUES (1990),(\'2012\');\n \nSELECT * FROM y;\n+------+\n| y |\n+------+\n| 1990 |\n| 2012 |\n+------+\n \nOut of range:\n \nINSERT INTO y VALUES (1005),(\'3080\');\nQuery OK, 2 rows affected, 2 warnings (0.05 sec)\nRecords: 2 Duplicates: 0 Warnings: 2\n \nSHOW WARNINGS;\n+---------+------+--------------------------------------------+\n| Level | Code | Message |\n+---------+------+--------------------------------------------+\n| Warning | 1264 | Out of range value for column \'y\' at\nrow 1 |\n| Warning | 1264 | Out of range value for column \'y\' at\nrow 2 |\n+---------+------+--------------------------------------------+\n \nSELECT * FROM y;\n+------+\n| y |\n+------+\n| 1990 |\n| 2012 |\n| 0000 |\n| 0000 |\n+------+\n \nTruncating:\n \nINSERT INTO y VALUES (\'2013-12-12\');\nQuery OK, 1 row affected, 1 warning (0.05 sec)\n \nSHOW WARNINGS;\n+---------+------+----------------------------------------+\n| Level | Code | Message |\n+---------+------+----------------------------------------+\n| Warning | 1265 | Data truncated for column \'y\' at row 1\n|\n+---------+------+----------------------------------------+\n \nSELECT * FROM y;\n+------+\n| y |\n+------+\n| 1990 |\n| 2012 |\n| 0000 |\n| 0000 |\n| 2013 |\n+------+\n \nDifference between YEAR(2) and YEAR(4), and string and\nnumeric zero:\n \nCREATE TABLE y2(y YEAR(4), y2 YEAR(2));\nQuery OK, 0 rows affected, 1 warning (0.40 sec)\n \nNote (Code 1287): \'YEAR(2)\' is deprecated and will be\nremoved in a future release. Please use YEAR(4) instead\n \nINSERT INTO y2 VALUES(0,0),(\'0\',\'0\');\n \nSELECT YEAR(y),YEAR(y2) FROM y;\n+---------+----------+\n| YEAR(y) | YEAR(y2) |\n+---------+----------+\n| 0 | 2000 |\n| 2000 | 2000 |\n+---------+----------+\n \n\n\nURL: https://mariadb.com/kb/en/library/year-data-type/','','https://mariadb.com/kb/en/library/year-data-type/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (300,23,'BEGIN END','Syntax\n------ \n[begin_label:] BEGIN [NOT ATOMIC]\n [statement_list]\nEND [end_label]\n \nNOT ATOMIC is required when used outside of a stored\nprocedure. Inside stored procedures or within an anonymous\nblock, BEGIN alone starts a new anonymous block.\n \nDescription\n----------- \nBEGIN ... END syntax is used for writing compound\nstatements. A compound statement can contain multiple\nstatements, enclosed by the BEGIN and END keywords.\nstatement_list represents a list of one or more statements,\neach\nterminated by a semicolon (i.e., ;) statement delimiter.\nstatement_list is\noptional, which means that the empty compound statement\n(BEGIN END) is\nlegal.\n \nNote that END will perform a commit. If you are running in\nautocommit mode, every statement will be committed\nseparately. If you are not running in autocommit mode, you\nmust execute a COMMIT or ROLLBACK after END to get the\ndatabase up to date.\n \nUse of multiple statements requires that a client is able to\nsend statement strings containing the ; statement delimiter.\nThis is handled in the mysql command-line client with the\nDELIMITER command.\nChanging the ; end-of-statement delimiter (for example, to\n//) allows ; to be used in a program body.\n \nA compound statement within a stored program can be\nlabeled. end_label cannot be given unless begin_label also\nis present. If both are present, they must be the same.\n \nBEGIN ... END constructs can be nested. Each block can\ndefine its own variables, a CONDITION, a HANDLER and a\nCURSOR, which don\'t exist in the outer blocks. The most\nlocal declarations override the outer objects which use the\nsame name (see example below).\n \nThe declarations order is the following:\nDECLARE local variables;\nDECLARE CONDITIONs;\nDECLARE CURSORs;\nDECLARE HANDLERs;\n \nNote that DECLARE HANDLER contains another BEGIN ... END\nconstruct.\n \nHere is an example of a very simple, anonymous block:\n \nBEGIN NOT ATOMIC\nSET @a=1;\n \nCREATE TABLE test.t1(a INT);\nEND|\n \nBelow is an example of nested blocks in a stored procedure:\n \nCREATE PROCEDURE t( )\nBEGIN\n DECLARE x TINYINT UNSIGNED DEFAULT 1;\n \n BEGIN\n DECLARE x CHAR(2) DEFAULT \'02\';\n \n DECLARE y TINYINT UNSIGNED DEFAULT 10;\n \n SELECT x, y;\n \n END;\n \n SELECT x;\n \nEND;\n \nIn this example, a TINYINT variable, x is declared in the\noutter block. But in the inner block x is re-declared as a\nCHAR and an y variable is declared. The inner SELECT shows\nthe \"new\" value of x, and the value of y. But when x is\nselected in the outer block, the \"old\" value is returned.\nThe final SELECT doesn\'t try to read y, because it doesn\'t\nexist in that context.\n \n\n\nURL: https://mariadb.com/kb/en/library/begin-end/','','https://mariadb.com/kb/en/library/begin-end/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (301,23,'CASE Statement','Syntax\n------ \nCASE case_value\n WHEN when_value THEN statement_list\n [WHEN when_value THEN statement_list] ...\n [ELSE statement_list]\nEND CASE\n \nOr:\n \nCASE\n WHEN search_condition THEN statement_list\n [WHEN search_condition THEN statement_list] ...\n [ELSE statement_list] \nEND CASE\n \nDescription\n----------- \nThe CASE statement for stored programs implements a complex\nconditional\nconstruct. If a search_condition evaluates to true, the\ncorresponding SQL\nstatement list is executed. If no search condition matches,\nthe statement list\nin the ELSE clause is executed. Each statement_list consists\nof one or\nmore statements.\n \nIf no when_value or search_condition matches the value\ntested and the CASE\nstatement contains no ELSE clause, a Case not found for CASE\nstatement\nerror results.\n \nEach statement_list consists of one or more statements; an\nempty\nstatement_list is not allowed. To handle situations where no\nvalue is\nmatched by any WHEN clause, use an ELSE containing an\nempty BEGIN ... END block, as shown in this example:\n \nDELIMITER |\nCREATE PROCEDURE p()\nBEGIN\n DECLARE v INT DEFAULT 1;\n \n CASE v\n WHEN 2 THEN SELECT v;\n \n WHEN 3 THEN SELECT 0;\n \n ELSE BEGIN END;\n \n END CASE;\n \nEND;\n \n|\n \nThe indentation used here in the ELSE clause is for purposes\nof clarity only,\nand is not otherwise significant. See Delimiters in the\nmysql client for more on the use of the delimiter command.\n \nNote: The syntax of the CASE statement used inside stored\nprograms\ndiffers slightly from that of the SQL CASE expression\ndescribed in\nCASE OPERATOR.\nThe CASE statement cannot have an ELSE NULL clause, and it\nis\nterminated with END CASE instead of END.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/case-statement/','','https://mariadb.com/kb/en/library/case-statement/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (302,23,'CLOSE','Syntax\n------ \nCLOSE cursor_name\n \nDescription\n----------- \nThis statement closes a previously opened cursor. The cursor\nmust have been previously opened or else an error occurs.\n \nIf not closed explicitly, a cursor is closed at the end of\nthe\ncompound statement in which it was declared.\n \nSee Cursor Overview for an example.\n \n\n\nURL: https://mariadb.com/kb/en/library/close/','','https://mariadb.com/kb/en/library/close/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (303,23,'DECLARE CONDITION','Syntax\n------ \nDECLARE condition_name CONDITION FOR condition_value\n \ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | mysql_error_code\n \nDescription\n----------- \nThe DECLARE ... CONDITION statement defines a named error\ncondition.\nIt specifies a condition that needs specific handling and\nassociates a\nname with that condition. Later, the name can be used in a\nDECLARE ... HANDLER, SIGNAL or RESIGNAL statement (as long\nas the statement is located in the same BEGIN ... END\nblock).\n \nConditions must be declared after local variables, but\nbefore CURSORs and HANDLERs.\n \nA condition_value for DECLARE ... CONDITION can be an\nSQLSTATE value (a\n5-character string literal) or a MySQL error code (a\nnumber). You should not\nuse SQLSTATE value \'00000\' or MySQL error code 0, because\nthose indicate sucess\nrather than an error condition. If you try, or if you\nspecify an invalid SQLSTATE value, an error like this is\nproduced:\n \nERROR 1407 (42000): Bad SQLSTATE: \'00000\'\n \nFor a list of SQLSTATE values and MariaDB error\ncodes, see MariaDB Error Codes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/declare-condition/','','https://mariadb.com/kb/en/library/declare-condition/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (304,23,'DECLARE CURSOR','Syntax\n------ \n\n\nURL: https://mariadb.com/kb/en/library/declare-cursor/','','https://mariadb.com/kb/en/library/declare-cursor/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (305,23,'DECLARE HANDLER','Syntax\n------ \nDECLARE handler_type HANDLER\n FOR condition_value [, condition_value] ...\n statement\n \nhandler_type:\n CONTINUE\n | EXIT \n | UNDO\n \ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | condition_name\n | SQLWARNING\n | NOT FOUND\n | SQLEXCEPTION\n | mariadb_error_code\n \nDescription\n----------- \nThe DECLARE ... HANDLER statement specifies handlers that\neach may\ndeal with one or more conditions. If one of these conditions\noccurs,\nthe specified statement is executed. statement can be a\nsimple\nstatement (for example, SET var_name = value), or it can be\na compound\nstatement written using BEGIN and END.\n \nHandlers must be declared after local variables, a CONDITION\nand a CURSOR.\n \nFor a CONTINUE handler, execution of the current program\ncontinues\nafter execution of the handler statement. For an EXIT\nhandler,\nexecution terminates for the BEGIN ... END compound\nstatement in which\nthe handler is declared. (This is true even if the condition\noccurs in\nan inner block.) The UNDO handler type statement is not\nsupported.\n \nIf a condition occurs for which no handler has been\ndeclared, the\ndefault action is EXIT.\n \nA condition_value for DECLARE ... HANDLER can be any of the\nfollowing\nvalues:\nAn SQLSTATE value (a 5-character string literal) or a\nMariaDB error\ncode (a number). You should not use SQLSTATE value \'00000\'\nor MariaDB\nerror code 0, because those indicate sucess rather than an\nerror\ncondition. For a list of SQLSTATE values and MariaDB error\ncodes, see\nMariaDB Error Codes.\nA condition name previously specified with DECLARE ...\nCONDITION. It must be in the same stored program. See\nDECLARE CONDITION.\nSQLWARNING is shorthand for the class of SQLSTATE values\nthat begin\nwith \'01\'.\nNOT FOUND is shorthand for the class of SQLSTATE values that\nbegin\nwith \'02\'. This is relevant only the context of cursors\nand is used to\ncontrol what happens when a cursor reaches the end of a data\nset. If\nno more rows are available, a No Data condition occurs with\nSQLSTATE\nvalue 02000. To detect this condition, you can set up a\nhandler for it\n(or for a NOT FOUND condition). An example is shown in\nCursor Overview. This condition also occurs for SELECT ...\nINTO var_list statements that retrieve no\nrows.\nSQLEXCEPTION is shorthand for the class of SQLSTATE values\nthat do\nnot begin with \'00\', \'01\', or \'02\'.\n \nWhen an error raises, in some cases it could be handled by\nmultiple HANDLERs. For example, there may be an handler for\n1050 error, a separate handler for the 42S01 SQLSTATE, and\nanother separate handler for the SQLEXCEPTION class: in\ntheory all occurrences of HANDLER may catch the 1050 error,\nbut MariaDB chooses the HANDLER with the highest precedence.\nHere are the precedence rules:\nHandlers which refer to an error code have the highest\nprecedence.\nHandlers which refer to a SQLSTATE come next.\nHandlers which refer to an error class have the lowest\nprecedence.\n \nIn some cases, a statement could produce multiple errors. If\nthis happens, in some cases multiple handlers could have the\nhighest precedence. In such cases, the choice of the handler\nis indeterminate.\n \nNote that if an error occurs within a CONTINUE HANDLER\nblock, it can be handled by another HANDLER. However, a\nHANDLER which is already in the stack (that is, it has been\ncalled to handle an error and its execution didn\'t finish\nyet) cannot handle new errors—this prevents endless loops.\nFor example, suppose that a stored procedure contains a\nCONTINUE HANDLER for SQLWARNING and another CONTINUE HANDLER\nfor NOT FOUND. At some point, a NOT FOUND error occurs, and\nthe execution enters the NOT FOUND HANDLER. But within that\nhandler, a warning occurs, and the execution enters the\nSQLWARNING HANDLER. If another NOT FOUND error occurs, it\ncannot be handled again by the NOT FOUND HANDLER, because\nits execution is not finished.\n \nWhen a DECLARE HANDLER block can handle more than one error\ncondition, it may be useful to know which errors occurred.\nTo do so, you can use the GET DIAGNOSTICS statement.\n \nAn error that is handled by a DECLARE HANDLER construct can\nbe issued again using the RESIGNAL statement.\n \nBelow is an example using DECLARE HANDLER:\n \nCREATE TABLE test.t (s1 INT, PRIMARY KEY (s1));\n \nDELIMITER //\n \nCREATE PROCEDURE handlerdemo ( )\n BEGIN\n DECLARE CONTINUE HANDLER FOR SQLSTATE \'23000\' SET @x2 =\n1;\n \n SET @x = 1;\n \n INSERT INTO test.t VALUES (1);\n SET @x = 2;\n \n INSERT INTO test.t VALUES (1);\n SET @x = 3;\n \n END;\n \n //\n \nDELIMITER ;\n \nCALL handlerdemo( );\n \nSELECT @x;\n \n+------+\n| @x |\n+------+\n| 3 |\n+------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/declare-handler/','','https://mariadb.com/kb/en/library/declare-handler/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (306,23,'DECLARE Variable','Syntax\n------ \nDECLARE var_name [, var_name] ... [[ROW] TYPE OF]] type\n[DEFAULT value]\n \nDescription\n----------- \nThis statement is used to declare local variables within\nstored programs. To\nprovide a default value for the variable, include a DEFAULT\nclause. The\nvalue can be specified as an expression (even subqueries are\npermitted); it need not be a constant. If the\nDEFAULT clause is missing, the initial value is NULL.\n \nLocal variables are treated like stored routine parameters\nwith respect to data\ntype and overflow checking. See CREATE PROCEDURE.\n \nLocal variables must be declared before CONDITIONs, CURSORs\nand HANDLERs.\n \nLocal variable names are not case sensitive.\n \nThe scope of a local variable is within the BEGIN ... END\nblock where it is\ndeclared. The variable can be referred to in blocks nested\nwithin the declaring\nblock, except those blocks that declare a variable with the\nsame name.\n \nTYPE OF / ROW TYPE OF\n \nTYPE OF and ROW TYPE OF anchored data types for stored\nroutines were introduced in MariaDB 10.3.\n \nAnchored data types allow a data type to be defined based on\nanother object, such as a table row, rather than\nspecifically set in the declaration. If the anchor object\nchanges, so will the anchored data type. This can lead to\nroutines being easier to maintain, so that if the data type\nin the table is changed, it will automatically be changed in\nthe routine as well.\n \nVariables declared with ROW TYPE OF will have the same\nfeatures as implicit ROW variables. It is not possible to\nuse ROW TYPE OF variables in a LIMIT clause.\n \nThe real data type of TYPE OF and ROW TYPE OF table_name\nwill become known at the very beginning of the stored\nroutine call. ALTER TABLE or DROP TABLE statements performed\ninside the current routine on the tables that appear in\nanchors won\'t affect the data type of the anchored\nvariables, even if the variable is declared after an ALTER\nTABLE or DROP TABLE statement.\n \nThe real data type of a ROW TYPE OF cursor_name variable\nwill become known when execution enters into the block where\nthe variable is declared. Data type instantiation will\nhappen only once. In a cursor ROW TYPE OF variable that is\ndeclared inside a loop, its data type will become known on\nthe very first iteration and won\'t change on further loop\niterations.\n \nThe tables referenced in TYPE OF and ROW TYPE OF\ndeclarations will be checked for existence at the beginning\nof the stored routine call. CREATE PROCEDURE or CREATE\nFUNCTION will not check the referenced tables for existence.\n \nExamples\n-------- \nTYPE OF and ROW TYPE OF from MariaDB 10.3:\n \nDECLARE tmp TYPE OF t1.a;\n -- Get the data type from the column {{a}} in the table\n{{t1}}\n \nDECLARE rec1 ROW TYPE OF t1;\n -- Get the row data type from the table {{t1}}\n \nDECLARE rec2 ROW TYPE OF cur1;\n -- Get the row data type from the cursor {{cur1}}\n \n\n\nURL: https://mariadb.com/kb/en/library/declare-variable/','','https://mariadb.com/kb/en/library/declare-variable/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (307,23,'FETCH','Syntax\n------ \nFETCH cursor_name INTO var_name [, var_name] ...\n \nDescription\n----------- \nThis statement fetches the next row (if a row exists) using\nthe\nspecified open cursor, and advances the cursor pointer.\n \nvar_name can be a local variable, but not a user-defined\nvariable.\n \nIf no more rows are available, a No Data condition occurs\nwith\nSQLSTATE value 02000. To detect this condition, you can set\nup a\nhandler for it (or for a NOT FOUND condition).\n \nSee Cursor Overview for an example.\n \n\n\nURL: https://mariadb.com/kb/en/library/fetch/','','https://mariadb.com/kb/en/library/fetch/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (308,23,'FOR','FOR loops were introduced in MariaDB 10.3.\n \nSyntax\n------ \nInteger range FOR loop:\n \n[begin_label:]\nFOR var_name IN [ REVERSE ] lower_bound .. upper_bound\nDO statement_list\nEND FOR [ end_label ]\n \nExplicit cursor FOR loop\n \n[begin_label:]\nFOR record_name IN cursor_name [ (\ncursor_actual_parameter_list)]\nDO statement_list\nEND FOR [ end_label ]\n \nExplicit cursor FOR loop (Oracle mode)\n \n[begin_label:]\nFOR record_name IN cursor_name [ (\ncursor_actual_parameter_list)]\nLOOP\n statement_list\nEND LOOP [ end_label ]\n \nImplicit cursor FOR loop\n \n[begin_label:]\nFOR record_name IN ( select_statement )\nDO statement_list\nEND FOR [ end_label ]\n \nDescription\n----------- \nFOR loops allow code to be executed a fixed number of times.\n \nIn an integer range FOR loop, MariaDB will compare the lower\nbound and upper bound values, and assign the lower bound\nvalue to a counter. If REVERSE is not specified, and the\nupper bound value is greater than or equal to the counter,\nthe counter will be incremented and the statement will\ncontinue, after which the loop is entered again. If the\nupper bound value is greater than the counter, the loop will\nbe exited.\n \nIf REVERSE is specified, the counter is decremented, and the\nupper bound value needs to be less than or equal for the\nloop to continue.\n \nExamples\n-------- \nIntger range FOR loop:\n \nCREATE TABLE t1 (a INT);\n \nDELIMITER //\n \nFOR i IN 1..3\nDO\n INSERT INTO t1 VALUES (i);\nEND FOR;\n \n//\n \nDELIMITER ;\n \nSELECT * FROM t1;\n \n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n+------+\n \nREVERSE integer range FOR loop:\n \nCREATE OR REPLACE TABLE t1 (a INT);\n \nDELIMITER //\nFOR i IN REVERSE 12..4\n DO\n INSERT INTO t1 VALUES (i);\nEND FOR;\n \n//\nQuery OK, 9 rows affected (0.422 sec)\n \nDELIMITER ;\n \nSELECT * FROM t1;\n \n+------+\n| a |\n+------+\n| 12 |\n| 11 |\n| 10 |\n| 9 |\n| 8 |\n| 7 |\n| 6 |\n| 5 |\n| 4 |\n+------+\n \nExplicit cursor in Oracle mode:\n \nSET sql_mode=ORACLE;\n \nCREATE OR REPLACE TABLE t1 (a INT, b VARCHAR(32));\n \nINSERT INTO t1 VALUES (10,\'b0\');\nINSERT INTO t1 VALUES (11,\'b1\');\nINSERT INTO t1 VALUES (12,\'b2\');\n \nDELIMITER //\n \nCREATE OR REPLACE PROCEDURE p1(pa INT) AS \n CURSOR cur(va INT) IS\n SELECT a, b FROM t1 WHERE a=va;\n \nBEGIN\n FOR rec IN cur(pa)\n LOOP\n SELECT rec.a, rec.b;\n \n END LOOP;\n \nEND;\n \n//\n \nDELIMITER ;\n \nCALL p1(10);\n+-------+-------+\n| rec.a | rec.b |\n+-------+-------+\n| 10 | b0 |\n+-------+-------+\n \nCALL p1(11);\n+-------+-------+\n| rec.a | rec.b |\n+-------+-------+\n| 11 | b1 |\n+-------+-------+\n \nCALL p1(12);\n+-------+-------+\n| rec.a | rec.b |\n+-------+-------+\n| 12 | b2 |\n+-------+-------+\n \nCALL p1(13);\nQuery OK, 0 rows affected (0.000 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/for/','','https://mariadb.com/kb/en/library/for/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (309,23,'GOTO','The GOTO statement was introduced in MariaDB 10.3 for Oracle\ncompatibility.\n \nSyntax\n------ \nGOTO label\n \nDescription\n----------- \nThe GOTO statement causes the code to jump to the specified\nlabel, and continue operating from there. It is only\naccepted when in Oracle mode.\n \nExample\n \nSET sql_mode=ORACLE;\n \nDELIMITER //\n \nCREATE OR REPLACE PROCEDURE p1 AS\n \nBEGIN\n \n SELECT 1;\n \n GOTO label;\n \n SELECT 2;\n \n SELECT 3;\n \nEND;\n \n//\n \nDELIMITER \n \ncall p1();\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n1 row in set (0.000 sec)\n \n+---+\n| 3 |\n+---+\n| 3 |\n+---+\n1 row in set (0.000 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/goto/','','https://mariadb.com/kb/en/library/goto/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (310,23,'IF','Syntax\n------ \nIF search_condition THEN statement_list\n [ELSEIF search_condition THEN statement_list] ...\n [ELSE statement_list]\nEND IF;\n \nDescription\n----------- \nIF implements a basic conditional construct. If the\nsearch_condition\nevaluates to true, the corresponding SQL statement list is\nexecuted.\nIf no search_condition matches, the statement list in the\nELSE clause\nis executed. Each statement_list consists of one or more\nstatements.\n \n\n\nURL: https://mariadb.com/kb/en/library/if/','','https://mariadb.com/kb/en/library/if/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (311,23,'ITERATE','Syntax\n------ \nITERATE label\n \nITERATE can appear only within LOOP, REPEAT, and WHILE\nstatements.\nITERATE means \"do the loop again\", and uses the\nstatement\'s label to determine which statements to repeat.\nThe label must be in the same stored program, not in a\ncaller procedure.\n \nIf you try to use ITERATE with a non-existing label, or if\nthe label is associated to a construct which is not a loop,\nthe following error will be produced:\n \nERROR 1308 (42000): ITERATE with no matching label: \n \nBelow is an example of how ITERATE might be used:\n \nCREATE PROCEDURE doiterate(p1 INT)\nBEGIN\n label1: LOOP\n SET p1 = p1 + 1;\n \n IF p1 \n\nURL: https://mariadb.com/kb/en/library/iterate/','','https://mariadb.com/kb/en/library/iterate/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (312,23,'Labels','Syntax\n------ \nlabel: \n[label]\n \nLabels are MariaDB identifiers which can be used to identify\na BEGIN ... END construct or a loop. They have a maximum\nlength of 16 characters and can be quoted with backticks\n(i.e.., `).\n \nLabels have a start part and an end part. The start part\nmust precede the portion of code it refers to, must be\nfollowed by a colon (:) and can be on the same or different\nline. The end part is optional and adds nothing, but can\nmake the code more readable. If used, the end part must\nprecede the construct\'s delimiter (;). Constructs\nidentified by a label can be nested. Each construct can be\nidentified by only one label.\n \nLabels need not be unique in the stored program they belong\nto. However, a label for an inner loop cannot be identical\nto a label for an outer loop. In this case, the following\nerror would be produced:\n \nERROR 1309 (42000): Redefining label \n \nLEAVE and ITERATE statements can be used to exit or repeat a\nportion of code identified by a label. They must be in the\nsame Stored Routine, Trigger or Event which contains the\ntarget label.\n \nBelow is an example using a simple label that is used to\nexit a LOOP:\n \nCREATE PROCEDURE `test_sp`()\nBEGIN\n `my_label`:\n LOOP\n SELECT \'looping\';\n \n LEAVE `my_label`;\n \n END LOOP;\n \n SELECT \'out of loop\';\n \nEND;\n \nThe following label is used to exit a procedure, and has an\nend part:\n \nCREATE PROCEDURE `test_sp`()\n`my_label`:\nBEGIN\n IF @var = 1 THEN\n LEAVE `my_label`;\n \n END IF;\n \n DO something();\nEND `my_label`;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/labels/','','https://mariadb.com/kb/en/library/labels/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (313,23,'LEAVE','Syntax\n------ \nLEAVE label\n \nThis statement is used to exit the flow control construct\nthat has the\ngiven label. The label must be in the same stored program,\nnot in a caller procedure. LEAVE can be used within BEGIN\n... END or loop constructs\n(LOOP, REPEAT, WHILE). In Stored Procedures, Triggers and\nEvents, LEAVE can refer to the outmost BEGIN ... END\nconstruct; in that case, the program exits the procedure. In\nStored Functions, RETURN can be used instead.\n \nNote that LEAVE cannot be used to exit a DECLARE HANDLER\nblock.\n \nIf you try to LEAVE a non-existing label, or if you try to\nLEAVE a HANDLER block, the following error will be produced:\n \nERROR 1308 (42000): LEAVE with no matching label: \n \nThe following example uses LEAVE to exit the procedure if a\ncondition is true:\n \nCREATE PROCEDURE proc(IN p TINYINT)\nCONTAINS SQL\n`whole_proc`:\nBEGIN\n SELECT 1;\n \n IF p \n\nURL: https://mariadb.com/kb/en/library/leave/','','https://mariadb.com/kb/en/library/leave/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (314,23,'LOOP','Syntax\n------ \n[begin_label:] LOOP\n statement_list\nEND LOOP [end_label]\n \nDescription\n----------- \nLOOP implements a simple loop construct, enabling repeated\nexecution\nof the statement list, which consists of one or more\nstatements, each\nterminated by a semicolon (i.e., ;) statement delimiter. The\nstatements\nwithin the loop are repeated until the loop is exited;\nusually this is\naccomplished with a LEAVE statement.\n \nA LOOP statement can be labeled. end_label cannot be given\nunless\nbegin_label also is present. If both are present, they must\nbe the\nsame.\n \nSee Delimiters in the mysql client for more on delimiter\nusage in the client.\n \n\n\nURL: https://mariadb.com/kb/en/library/loop/','','https://mariadb.com/kb/en/library/loop/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (315,23,'OPEN','Syntax\n------ \n\n\nURL: https://mariadb.com/kb/en/library/open/','','https://mariadb.com/kb/en/library/open/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (316,23,'REPEAT LOOP','Syntax\n------ \n[begin_label:] REPEAT\n statement_list\nUNTIL search_condition\nEND REPEAT [end_label]\n \nThe statement list within a REPEAT statement is repeated\nuntil the\nsearch_condition is true. Thus, a REPEAT always enters the\nloop at\nleast once. statement_list consists of one or more\nstatements, each\nterminated by a semicolon (i.e., ;) statement delimiter.\n \nA REPEAT statement can be labeled. end_label cannot be given\nunless\nbegin_label also is present. If both are present, they must\nbe the\nsame.\n \nSee Delimiters in the mysql client for more on client\ndelimiter usage.\n \nDELIMITER //\n \nCREATE PROCEDURE dorepeat(p1 INT)\n BEGIN\n SET @x = 0;\n \n REPEAT SET @x = @x + 1;\n UNTIL @x > p1 END REPEAT;\n \n END\n//\n \nCALL dorepeat(1000)//\n \nSELECT @x//\n+------+\n| @x |\n+------+\n| 1001 |\n+------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/repeat-loop/','','https://mariadb.com/kb/en/library/repeat-loop/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (317,23,'RESIGNAL','SIGNAL and RESIGNAL were both introduced in MariaDB 5.5.\n \nSyntax\n------ \nRESIGNAL [error_condition]\n [SET error_property\n [, error_property] ...]\n \nerror_condition:\n SQLSTATE [VALUE] \'sqlstate_value\'\n | condition_name\n \nerror_property:\n error_property_name = \n \nerror_property_name:\n CLASS_ORIGIN\n | SUBCLASS_ORIGIN\n | MESSAGE_TEXT\n | MYSQL_ERRNO\n | CONSTRAINT_CATALOG\n | CONSTRAINT_SCHEMA\n | CONSTRAINT_NAME\n | CATALOG_NAME\n | SCHEMA_NAME\n | TABLE_NAME\n | COLUMN_NAME\n | CURSOR_NAME\n \nDescription\n----------- \nThe syntax of RESIGNAL and its semantics are very similar to\nSIGNAL. This statement can only be used within an error\nHANDLER. It produces an error, like SIGNAL. RESIGNAL clauses\nare the same as SIGNAL, except that they all are optional,\neven SQLSTATE. All the properties which are not specified in\nRESIGNAL, will be identical to the properties of the error\nthat was received by the error HANDLER. For a description of\nthe clauses, see diagnostics area.\n \nNote that RESIGNAL does not empty the diagnostics area: it\njust appends another error condition.\n \nRESIGNAL, without any clauses, produces an error which is\nidentical to the error that was received by HANDLER.\n \nIf used out of a HANDLER construct, RESIGNAL produces the\nfollowing error:\n \nERROR 1645 (0K000): RESIGNAL when handler not active\n \nIn MariaDB 5.5, if a HANDLER contained a CALL to another\nprocedure, that procedure could use RESIGNAL. Since MariaDB\n10.0, trying to do this raises the above error.\n \nFor a list of SQLSTATE values and MariaDB error codes, see\nMariaDB Error Codes.\n \nThe following procedure tries to query two tables which\ndon\'t exist, producing a 1146 error in both cases. Those\nerrors will trigger the HANDLER. The first time the error\nwill be ignored and the client will not receive it, but the\nsecond time, the error is re-signaled, so the client will\nreceive it.\n \nCREATE PROCEDURE test_error( )\nBEGIN\n DECLARE CONTINUE HANDLER\n FOR 1146\n BEGIN\n IF @hide_errors IS FALSE THEN\n RESIGNAL;\n \n END IF;\n \n END;\n \n SET @hide_errors = TRUE;\n \n SELECT \'Next error will be ignored\' AS msg;\n \n SELECT `c` FROM `temptab_one`;\n \n SELECT \'Next error won\'\'t be ignored\' AS msg;\n \n SET @hide_errors = FALSE;\n \n SELECT `c` FROM `temptab_two`;\n \nEND;\n \nCALL test_error( );\n \n+----------------------------+\n| msg |\n+----------------------------+\n| Next error will be ignored |\n+----------------------------+\n \n+-----------------------------+\n| msg |\n+-----------------------------+\n| Next error won\'t be ignored |\n+-----------------------------+\n \nERROR 1146 (42S02): Table \'test.temptab_two\' doesn\'t\nexist\n \nThe following procedure re-signals an error, modifying only\nthe error message to clarify the cause of the problem.\n \nCREATE PROCEDURE test_error()\nBEGIN\n DECLARE CONTINUE HANDLER\n FOR 1146\n BEGIN\n RESIGNAL SET\n MESSAGE_TEXT = \'`temptab` does not exist\';\n \n END;\n \n SELECT `c` FROM `temptab`;\n \nEND;\n \nCALL test_error( );\nERROR 1146 (42S02): `temptab` does not exist\n \nAs explained above, this works on MariaDB 5.5, but produces\na 1645 error since 10.0.\n \nCREATE PROCEDURE handle_error()\nBEGIN\n RESIGNAL;\n \nEND;\n \nCREATE PROCEDURE p()\nBEGIN\n DECLARE EXIT HANDLER FOR SQLEXCEPTION CALL p();\n SIGNAL SQLSTATE \'45000\';\n \nEND;\n \n\n\nURL: https://mariadb.com/kb/en/library/resignal/','','https://mariadb.com/kb/en/library/resignal/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (318,23,'RETURN','Syntax\n------ \nRETURN expr \n \nThe RETURN statement terminates execution of a stored\nfunction and\nreturns the value expr to the function caller. There must be\nat least\none RETURN statement in a stored function. If the function\nhas multiple exit points, all exit points must have a\nRETURN.\n \nThis statement is not used in stored procedures, triggers,\nor events. LEAVE can be used instead.\n \nThe following example shows that RETURN can return the\nresult of a scalar subquery:\n \nCREATE FUNCTION users_count() RETURNS BOOL\n READS SQL DATA\nBEGIN\n RETURN (SELECT COUNT(DISTINCT User) FROM mysql.user);\nEND;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/return/','','https://mariadb.com/kb/en/library/return/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (319,23,'SELECT INTO','Syntax\n------ \nSELECT col_name [, col_name] ...\n INTO var_name [, var_name] ...\n table_expr\n \nDescription\n----------- \nSELECT ... INTO enables selected columns to be stored\ndirectly\ninto variables. No resultset is produced. The query should\nreturn a single row. If the query\nreturns no rows, a warning with error code 1329 occurs (No\ndata), and\nthe variable values remain unchanged. If the query returns\nmultiple\nrows, error 1172 occurs (Result consisted of more than one\nrow). If it\nis possible that the statement may retrieve multiple rows,\nyou can use\nLIMIT 1 to limit the result set to a single row.\n \nThe INTO clause can also be specified at the end of the\nstatement.\n \nIn the context of such statements that occur as part of\nevents\nexecuted by the Event Scheduler, diagnostics messages (not\nonly\nerrors, but also warnings) are written to the error log,\nand, on\nWindows, to the application event log.\n \nThis statement can be used with both local variables and\nuser-defined variables.\n \nFor the complete syntax, see SELECT.\n \nAnother way to set a variable\'s value is the SET statement.\n \nSELECT ... INTO results are not stored in the query cache\neven if SQL_CACHE is specified.\n \nExamples\n-------- \nSELECT id, data INTO @x,@y \nFROM test.t1 LIMIT 1;\n \n\n\nURL: https://mariadb.com/kb/en/library/selectinto/','','https://mariadb.com/kb/en/library/selectinto/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (320,23,'SIGNAL','SIGNAL and RESIGNAL were both introduced in MariaDB 5.5.\n \nSyntax\n------ \nSIGNAL error_condition\n [SET error_property\n [, error_property] ...]\n \nerror_condition:\n SQLSTATE [VALUE] \'sqlstate_value\'\n | condition_name\n \nerror_property:\n error_property_name = \n \nerror_property_name:\n CLASS_ORIGIN\n | SUBCLASS_ORIGIN\n | MESSAGE_TEXT\n | MYSQL_ERRNO\n | CONSTRAINT_CATALOG\n | CONSTRAINT_SCHEMA\n | CONSTRAINT_NAME\n | CATALOG_NAME\n | SCHEMA_NAME\n | TABLE_NAME\n | COLUMN_NAME\n | CURSOR_NAME\n \nSIGNAL empties the diagnostics area and produces a custom\nerror. This statement can be used anywhere, but is generally\nuseful when used inside a stored program. When the error is\nproduced, it can be caught by a HANDLER. If not, the current\nstored program, or the current statement, will terminate\nwith the specified error.\n \nSometimes an error HANDLER just needs to SIGNAL the same\nerror it received, optionally with some changes. Usually the\nRESIGNAL statement is the most convenient way to do this.\n \nerror_condition can be an SQLSTATE value or a named error\ncondition defined via DECLARE CONDITION. SQLSTATE must be a\nconstant string consisting of five characters. These codes\nare standard to ODBC and ANSI SQL. For customized errors,\nthe recommended SQLSTATE is \'45000\'. For a list of\nSQLSTATE values used by MariaDB, see the MariaDB Error Codes\npage. The SQLSTATE can be read via the API method\nmysql_sqlstate( ). \n \nTo specify error properties user-defined variables and local\nvariables can be used, as well as character set conversions\n(but you can\'t set a collation).\n \nThe error properties, their type and their default values\nare explained in the diagnostics area page.\n \nErrors\n \nIf the SQLSTATE is not valid, the following error like this\nwill be produced:\n \nERROR 1407 (42000): Bad SQLSTATE: \'123456\'\n \nIf a property is specified more than once, an error like\nthis will be produced:\n \nERROR 1641 (42000): Duplicate condition information item\n\'MESSAGE_TEXT\'\n \nIf you specify a condition name which is not declared, an\nerror like this will be produced:\n \nERROR 1319 (42000): Undefined CONDITION: cond_name\n \nIf MYSQL_ERRNO is out of range, you will get an error like\nthis:\n \nERROR 1231 (42000): Variable \'MYSQL_ERRNO\' can\'t be set\nto the value of \'0\'\n \nExamples\n-------- \nHere\'s what happens if SIGNAL is used in the client to\ngenerate errors:\n \nSIGNAL SQLSTATE \'01000\';\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+------------------------------------------+\n| Level | Code | Message |\n+---------+------+------------------------------------------+\n| Warning | 1642 | Unhandled user-defined warning condition\n|\n+---------+------+------------------------------------------+\n1 row in set (0.06 sec)\n \nSIGNAL SQLSTATE \'02000\';\n \nERROR 1643 (02000): Unhandled user-defined not found\ncondition\n \nHow to specify MYSQL_ERRNO and MESSAGE_TEXT properties:\n \nSIGNAL SQLSTATE \'45000\' SET MYSQL_ERRNO=30001,\nMESSAGE_TEXT=\'H\nello, world!\';\n \nERROR 30001 (45000): Hello, world!\n \nThe following code shows how to use user variables, local\nvariables and character set conversion with SIGNAL:\n \nCREATE PROCEDURE test_error(x INT)\nBEGIN\n DECLARE errno SMALLINT UNSIGNED DEFAULT 31001;\n \n SET @errmsg = \'Hello, world!\';\n \n IF x = 1 THEN\n SIGNAL SQLSTATE \'45000\' SET\n MYSQL_ERRNO = errno,\n MESSAGE_TEXT = @errmsg;\n \n ELSE\n SIGNAL SQLSTATE \'45000\' SET\n MYSQL_ERRNO = errno,\n MESSAGE_TEXT = _utf8\'Hello, world!\';\n \n END IF;\n \nEND;\n \nHow to use named error conditions:\n \nCREATE PROCEDURE test_error(n INT)\nBEGIN\n DECLARE `too_big` CONDITION FOR SQLSTATE \'45000\';\n \n IF n > 10 THEN\n SIGNAL `too_big`;\n \n END IF;\n \nEND;\n \nIn this example, we\'ll define a HANDLER for an error code.\nWhen the error occurs, we SIGNAL a more informative error\nwhich makes sense for our procedure:\n \nCREATE PROCEDURE test_error()\nBEGIN\n DECLARE EXIT HANDLER\n FOR 1146\n BEGIN\n SIGNAL SQLSTATE \'45000\' SET\n MESSAGE_TEXT = \'Temporary tables not found; did you call\ninit() procedure?\';\n \n END;\n \n -- this will produce a 1146 error\n SELECT `c` FROM `temptab`;\n \nEND;\n \n\n\nURL: https://mariadb.com/kb/en/library/signal/','','https://mariadb.com/kb/en/library/signal/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (321,23,'WHILE','Syntax\n------ \n[begin_label:] WHILE search_condition DO\n statement_list\nEND WHILE [end_label]\n \nDescription\n----------- \nThe statement list within a WHILE statement is repeated as\nlong as the\nsearch_condition is true. statement_list consists of one or\nmore\nstatements. If the loop must be executed at least once,\nREPEAT ... LOOP can be used instead.\n \nA WHILE statement can be labeled. end_label cannot be given\nunless\nbegin_label also is present. If both are present, they must\nbe the\nsame.\n \nExamples\n-------- \nCREATE PROCEDURE dowhile()\nBEGIN\n DECLARE v1 INT DEFAULT 5;\n \n WHILE v1 > 0 DO\n ...\n SET v1 = v1 - 1;\n \n END WHILE;\n \nEND\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/while/','','https://mariadb.com/kb/en/library/while/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (322,24,'BUFFER','A synonym for ST_BUFFER.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/buffer/','','https://mariadb.com/kb/en/library/buffer/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (323,24,'CONVEXHULL','A synonym for ST_CONVEXHULL.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/convexhull/','','https://mariadb.com/kb/en/library/convexhull/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (324,24,'GEOMETRYCOLLECTION','Syntax\n------ \nGeometryCollection(g1,g2,...)\n \nDescription\n----------- \nConstructs a WKB GeometryCollection. If any argument is not\na well-formed WKB representation of a geometry, the return\nvalue is NULL.\n \nExamples\n-------- \nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\n \nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText(\'GEOMETRYCOLLECTION(POINT(0 0),\nLINESTRING(0 0,10 10))\')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText(\'GeometryCollection()\')),\n (GeomFromText(\'GeometryCollection EMPTY\'));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/geometrycollection/','','https://mariadb.com/kb/en/library/geometrycollection/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (325,24,'LINESTRING','Syntax\n------ \nLineString(pt1,pt2,...)\n \nDescription\n----------- \nConstructs a WKB LineString value from a number of WKB Point\narguments. If any argument is not a WKB Point, the return\nvalue is\nNULL. If the number of Point arguments is less than two, the\nreturn value is NULL.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+\n \nCREATE TABLE gis_line (g LINESTRING);\nINSERT INTO gis_line VALUES\n (LineFromText(\'LINESTRING(0 0,0 10,10 0)\')),\n (LineStringFromText(\'LINESTRING(10 10,20 10,20 20,10 20,10\n10)\')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10),\nPoint(40, 10)))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/linestring/','','https://mariadb.com/kb/en/library/linestring/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (326,24,'MULTILINESTRING','Syntax\n------ \nMultiLineString(ls1,ls2,...)\n \nDescription\n----------- \nConstructs a WKB MultiLineString value using WKB LineString\narguments. If any argument is not a WKB LineString, the\nreturn value is\nNULL.\n \nExample\n \nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(\'MULTILINESTRING((10 48,10 21,10\n0),(16 0,16 23,16 48))\')),\n (MLineFromText(\'MULTILINESTRING((10 48,10 21,10 0))\')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2),\nPoint(3, 5)), LineString(Point(2, 5),Point(5, 8),Point(21,\n7))))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/multilinestring/','','https://mariadb.com/kb/en/library/multilinestring/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (327,24,'MULTIPOINT','Syntax\n------ \nMultiPoint(pt1,pt2,...)\n \nDescription\n----------- \nConstructs a WKB MultiPoint value using WKB Point arguments.\nIf any argument is not a WKB Point, the return value is\nNULL.\n \nExamples\n-------- \nSET @g = ST_GEOMFROMTEXT(\'MultiPoint( 1 1, 2 2, 5 3, 7 2, 9\n3, 8 4, 6 6, 6 9, 4 9, 1 5 )\');\n \nCREATE TABLE gis_multi_point (g MULTIPOINT);\nINSERT INTO gis_multi_point VALUES\n (MultiPointFromText(\'MULTIPOINT(0 0,10 10,10 20,20\n20)\')),\n (MPointFromText(\'MULTIPOINT(1 1,11 11,11 21,21 21)\')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4,\n10)))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/multipoint/','','https://mariadb.com/kb/en/library/multipoint/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (328,24,'MULTIPOLYGON','Syntax\n------ \nMultiPolygon(poly1,poly2,...)\n \nDescription\n----------- \nConstructs a WKB MultiPolygon value from a set of WKB\nPolygon arguments. If any argument is not a WKB Polygon, the\nreturn value is NULL.\n \nExample\n \nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84\n42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67\n13,59 13,59 18)))\')),\n (MPolyFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28\n26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59\n13,59 18)))\')),\n (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0,\n3), Point(3, 3), Point(3, 0), Point(0, 3)))))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/multipolygon/','','https://mariadb.com/kb/en/library/multipolygon/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (329,24,'POINT','Syntax\n------ \nPoint(x,y)\n \nDescription\n----------- \nConstructs a WKB Point using the given coordinates.\n \nExamples\n-------- \nSET @g = ST_GEOMFROMTEXT(\'Point(1 1)\');\n \nCREATE TABLE gis_point (g POINT);\nINSERT INTO gis_point VALUES\n (PointFromText(\'POINT(10 10)\')),\n (PointFromText(\'POINT(20 10)\')),\n (PointFromText(\'POINT(20 20)\')),\n (PointFromWKB(AsWKB(PointFromText(\'POINT(10 20)\'))));\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/point/','','https://mariadb.com/kb/en/library/point/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (330,24,'PointOnSurface','A synonym for ST_PointOnSurface.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/pointonsurface/','','https://mariadb.com/kb/en/library/pointonsurface/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (331,24,'POLYGON','Syntax\n------ \nPolygon(ls1,ls2,...)\n \nDescription\n----------- \nConstructs a WKB Polygon value from a number of WKB\nLineString\narguments. If any argument does not represent the WKB of a\nLinearRing (that is,\nnot a closed and simple LineString) the return value is\nNULL.\n \nNote that according to the OpenGIS standard, a POLYGON\nshould have exactly one ExteriorRing and all other rings\nshould lie within that ExteriorRing and thus be the\nInteriorRings. Practically, however, some systems, including\nMariaDB\'s, permit polygons to have several\n\'ExteriorRings\'. In the case of there being multiple,\nnon-overlapping exterior rings ST_NUMINTERIORRINGS() will\nreturn 1.\n \nExamples\n-------- \nSET @g = ST_GEOMFROMTEXT(\'POLYGON((1 1,1 5,4 9,6 9,9 3,7\n2,1 1))\');\n \nCREATE TABLE gis_polygon (g POLYGON);\nINSERT INTO gis_polygon VALUES\n (PolygonFromText(\'POLYGON((10 10,20 10,20 20,10 20,10\n10))\')),\n (PolyFromText(\'POLYGON((0 0,50 0,50 50,0 50,0 0), (10\n10,20 10,20 20,10 20,10 10))\')),\n (PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0),\nPoint(30, 0), Point(30, 30), Point(0, 0))))));\n \nNon-overlapping \'polygon\':\n \nSELECT ST_NumInteriorRings(ST_PolyFromText(\'POLYGON((0 0,10\n0,10 10,0 10,0 0),\n (-1 -1,-5 -1,-5 -5,-1 -5,-1 -1))\')) AS NumInteriorRings;\n \n+------------------+\n| NumInteriorRings |\n+------------------+\n| 1 |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/polygon/','','https://mariadb.com/kb/en/library/polygon/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (332,24,'ST_BUFFER','Syntax\n------ \nST_BUFFER(g1,r)\nBUFFER(g1,r)\n \nDescription\n----------- \nReturns a geometry that represents all points whose distance\nfrom geometry g1 is less than or equal to distance, or\nradius, r.\n \nUses for this function could include creating for example a\nnew geometry representing a buffer zone around an island.\n \nBUFFER() is a synonym.\n \nExamples\n-------- \nDetermining whether a point is within a buffer zone:\n \nSET @g1 = ST_GEOMFROMTEXT(\'POLYGON((10 10, 10 20, 20 20, 20\n10, 10 10))\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'POINT(8 8)\');\n \nSELECT ST_WITHIN(@g2,ST_BUFFER(@g1,5));\n+---------------------------------+\n| ST_WITHIN(@g2,ST_BUFFER(@g1,5)) |\n+---------------------------------+\n| 1 |\n+---------------------------------+\n \nSELECT ST_WITHIN(@g2,ST_BUFFER(@g1,1));\n+---------------------------------+\n| ST_WITHIN(@g2,ST_BUFFER(@g1,1)) |\n+---------------------------------+\n| 0 |\n+---------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_buffer/','','https://mariadb.com/kb/en/library/st_buffer/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (333,24,'ST_CONVEXHULL','ST_ConvexHull() was introduced in MariaDB 10.1.2\n \nSyntax\n------ \nST_ConvexHull(g)\nConvexHull(g)\n \nDescription\n----------- \nGiven a geometry, returns a geometry that is the minimum\nconvex geometry enclosing all geometries within the set.\nReturns NULL if the geometry value is NULL or an empty\nvalue.\n \nST_ConvexHull() and ConvexHull() are synonyms.\n \nExamples\n-------- \nThe ConvexHull of a single point is simply the single point:\n \nSET @g = ST_GEOMFROMTEXT(\'Point(0 0)\');\n \nSELECT ST_ASTEXT(ST_CONVEXHULL(@g));\n+------------------------------+\n| ST_ASTEXT(ST_CONVEXHULL(@g)) |\n+------------------------------+\n| POINT(0 0) |\n+------------------------------+\n \nSET @g = ST_GEOMFROMTEXT(\'MultiPoint(0 0, 1 2, 2 3)\');\n \nSELECT ST_ASTEXT(ST_CONVEXHULL(@g));\n+------------------------------+\n| ST_ASTEXT(ST_CONVEXHULL(@g)) |\n+------------------------------+\n| POLYGON((0 0,1 2,2 3,0 0)) |\n+------------------------------+\n \nSET @g = ST_GEOMFROMTEXT(\'MultiPoint( 1 1, 2 2, 5 3, 7 2, 9\n3, 8 4, 6 6, 6 9, 4 9, 1 5 )\');\n \nSELECT ST_ASTEXT(ST_CONVEXHULL(@g));\n+----------------------------------------+\n| ST_ASTEXT(ST_CONVEXHULL(@g)) |\n+----------------------------------------+\n| POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1)) |\n+----------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_convexhull/','','https://mariadb.com/kb/en/library/st_convexhull/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (334,24,'ST_INTERSECTION','Syntax\n------ \nST_INTERSECTION(g1,g2)\n \nDescription\n----------- \nReturns a geometry that is the intersection, or shared\nportion, of geometry g1 and geometry g2.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(2 1)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(2 1, 0 2)\');\n \nSELECT ASTEXT(ST_INTERSECTION(@g1,@g2));\n+----------------------------------+\n| ASTEXT(ST_INTERSECTION(@g1,@g2)) |\n+----------------------------------+\n| POINT(2 1) |\n+----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_intersection/','','https://mariadb.com/kb/en/library/st_intersection/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (335,24,'ST_POINTONSURFACE','ST_POINTONSURFACE() was introduced in MariaDB 10.1.2\n \nSyntax\n------ \nST_PointOnSurface(g)\nPointOnSurface(g)\n \nDescription\n----------- \nGiven a geometry, returns a POINT guaranteed to intersect a\nsurface. However, see MDEV-7514.\n \nST_PointOnSurface() and PointOnSurface() are synonyms.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_pointonsurface/','','https://mariadb.com/kb/en/library/st_pointonsurface/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (336,24,'ST_SYMDIFFERENCE','Syntax\n------ \nST_SYMDIFFERENCE(g1,g2)\n \nDescription\n----------- \nReturns a geometry that represents the portions of geometry\ng1 and geometry g2 that don\'t intersect.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'LINESTRING(10 20, 10 40)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(10 15, 10 25)\');\n \nSELECT ASTEXT(ST_SYMDIFFERENCE(@g1,@g2));\n+----------------------------------------------+\n| ASTEXT(ST_SYMDIFFERENCE(@g1,@g2)) |\n+----------------------------------------------+\n| MULTILINESTRING((10 15,10 20),(10 25,10 40)) |\n+----------------------------------------------+\n \nSET @g2 = ST_GeomFromText(\'LINESTRING(10 20, 10 41)\');\n \nSELECT ASTEXT(ST_SYMDIFFERENCE(@g1,@g2));\n+-----------------------------------+\n| ASTEXT(ST_SYMDIFFERENCE(@g1,@g2)) |\n+-----------------------------------+\n| LINESTRING(10 40,10 41) |\n+-----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_symdifference/','','https://mariadb.com/kb/en/library/st_symdifference/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (337,24,'ST_UNION','Syntax\n------ \nST_UNION(g1,g2)\n \nDescription\n----------- \nReturns a geometry that is the union of the geometry g1 and\ngeometry g2.\n \nExamples\n-------- \nSET @g1 = GEOMFROMTEXT(\'POINT (0 2)\');\n \nSET @g2 = GEOMFROMTEXT(\'POINT (2 0)\');\n \nSELECT ASTEXT(ST_UNION(@g1,@g2));\n+---------------------------+\n| ASTEXT(ST_UNION(@g1,@g2)) |\n+---------------------------+\n| MULTIPOINT(2 0,0 2) |\n+---------------------------+\n \nSET @g1 = GEOMFROMTEXT(\'POLYGON((0 0,0 3,3 3,3 0,0 0))\');\n \nSET @g2 = GEOMFROMTEXT(\'POLYGON((2 2,4 2,4 4,2 4,2 2))\');\n \nSELECT ASTEXT(ST_UNION(@g1,@g2));\n+------------------------------------------------+\n| ASTEXT(ST_UNION(@g1,@g2)) |\n+------------------------------------------------+\n| POLYGON((0 0,0 3,2 3,2 4,4 4,4 2,3 2,3 0,0 0)) |\n+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_union/','','https://mariadb.com/kb/en/library/st_union/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (338,26,'BINLOG','Syntax\n------ \nBINLOG \'str\'\n \nDescription\n----------- \nBINLOG is an internal-use statement. It is generated by the\nmysqlbinlog program as the printable representation of\ncertain events\nin binary log files. The \'str\' value is a base 64-encoded\nstring the that server decodes to determine the data change\nindicated by the\ncorresponding event. This statement requires the SUPER\nprivilege. It was added in MySQL 5.1.5.\n \n\n\nURL: https://mariadb.com/kb/en/library/binlog/','','https://mariadb.com/kb/en/library/binlog/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (339,26,'CACHE INDEX','Syntax\n------ \nCACHE INDEX \n tbl_index_list [, tbl_index_list] ...\n IN key_cache_name \n \ntbl_index_list:\n tbl_name [[INDEX|KEY] (index_name[, index_name] ...)]\n \nDescription\n----------- \nThe CACHE INDEX statement assigns table indexes to a\nspecific key\ncache. It is used only for MyISAM tables.\n \nA default key cache exists and cannot be destroyed. To\ncreate more key caches, the key_buffer_size server system\nvariable.\n \nThe associations between tables indexes and key caches are\nlost on server restart. To recreate them automatically, it\nis necessary to configure caches in a configuration file and\ninclude some CACHE INDEX (and optionally LOAD INDEX)\nstatements in the init file.\n \nExamples\n-------- \nThe following statement assigns indexes from the tables t1,\nt2, and t3\nto the key cache named hot_cache:\n \nCACHE INDEX t1, t2, t3 IN hot_cache;\n+---------+--------------------+----------+----------+\n| Table | Op | Msg_type | Msg_text |\n+---------+--------------------+----------+----------+\n| test.t1 | assign_to_keycache | status | OK |\n| test.t2 | assign_to_keycache | status | OK |\n| test.t3 | assign_to_keycache | status | OK |\n+---------+--------------------+----------+----------+\n \nImplementation (for MyISAM)\n \nNormally CACHE INDEX should not take a long time to execute.\nInternally it\'s implemented the following way:\nFind the right key cache (under\nLOCK_global_system_variables)\nOpen the table with a TL_READ_NO_INSERT lock.\nFlush the original key cache for the given file (under key\ncache lock)\nFlush the new key cache for the given file (safety)\nMove the file to the new key cache (under file share lock)\n \nThe only possible long operations are getting the locks for\nthe table and flushing the original key cache, if there were\nmany key blocks for the file in it.\n \nWe plan to also add CACHE INDEX for Aria tables if there is\na need for this.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/cache-index/','','https://mariadb.com/kb/en/library/cache-index/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (340,26,'FLUSH','Syntax\n------ \nFLUSH [NO_WRITE_TO_BINLOG | LOCAL]\n flush_option [, flush_option] ...\n \nor when flushing tables:\n \nFLUSH [NO_WRITE_TO_BINLOG | LOCAL] TABLES [table_list]\n[table_flush_option]\n \nwhere table_list is a list of tables separated by , (comma).\n \nDescription\n----------- \nThe FLUSH statement clears or reloads various internal\ncaches used by\nMariaDB. To execute FLUSH, you must have the RELOAD\nprivilege. See GRANT.\n \nThe RESET statement is similar to FLUSH. See\nRESET.\n \nYou cannot issue a FLUSH statement from within a stored\nfunction or a trigger. Doing so within a stored procedure is\npermitted, as long as it is not called by a stored function\nor trigger. See Stored Routine Limitations, Stored Function\nLimitations and Trigger Limitations.\n \nIf a listed table is a view, an error like the following\nwill be produced:\n \nERROR 1347 (HY000): \'test.v\' is not BASE TABLE\n \nBy default, FLUSH statements are written to the binary log\nand will be replicated. The NO_WRITE_TO_BINLOG keyword\n(LOCAL is an alias) will ensure the statement is not written\nto the binary log. \n \nThe different flush options are:\n \nOption | Description | \n \nCHANGED_PAGE_BITMAPS | Internal command used for backup\npurposes. See the Information Schema CHANGED_PAGE_BITMAPS\nTable. | \n \nCLIENT_STATISTICS | Reset client statistics (see SHOW\nCLIENT_STATISTICS). | \n \nDES_KEY_FILE | Reloads the DES key file (Specified with the\n--des-key-file startup option). | \n \nHOSTS | Flush the hostname cache (used for converting ip to\nhost names and for unblocking blocked hosts. See\nmax_connect_errors) | \n \nINDEX_STATISTICS | Reset index statistics (see SHOW\nINDEX_STATISTICS). | \n \n[ERROR | ENGINE | GENERAL | SLOW | BINARY | RELAY] LOGS |\nClose and reopen the specified log type, or all log types if\nnone are specified. FLUSH RELAY LOGS [connection-name] can\nbe used to flush the relay logs for a specific connection.\nOnly one connection can be specified per FLUSH command. See\nMulti-source replication. FLUSH ENGINE LOGS will delete all\nunneeded Aria redo logs. | \n \nMASTER | Deprecated option, use RESET MASTER instead. | \n \nPRIVILEGES | Reload all privileges from the privilege tables\nin the mysql database. If the server is started with\n--skip-grant-table option, this will activate the privilege\ntables again. | \n \nQUERY CACHE | Defragment the query cache to better utilize\nits memory. If you want to reset the query cache, you can do\nit with RESET QUERY CACHE. | \n \nQUERY_RESPONSE_TIME | See the QUERY_RESPONSE_TIME plugin. | \n \nSLAVE | Deprecated option, use RESET SLAVE instead. | \n \nSSL | Used to dynamically reinitialize the server\'s TLS\ncontext by reloading the files defined by several TLS system\nvariables. See FLUSH SSL for more information. This command\nwas first added in MariaDB 10.4.1. | \n \nSTATUS | Resets all server status variables that can be\nreset to 0. Not all global status variables support this, so\nnot all global values are reset. See FLUSH STATUS for more\ninformation. | \n \nTABLE | Close tables given as options or all open tables if\nno table list was used. From MariaDB 10.4.1, using without\nany table list will only close tables not in use, and tables\nnot locked by the FLUSH TABLES connection. If there are no\nlocked tables, FLUSH TABLES will be instant and will not\ncause any waits, as it no longer waits for tables in use.\nWhen a table list is provided, from MariaDB 10.4.1, the\nserver will wait for the end of any transactions that are\nusing the tables. Previously, FLUSH TABLES only waited for\nthe statements to complete. | \n \nTABLES | Same as FLUSH TABLE. | \n \nTABLES ... FOR EXPORT | For InnoDB tables, flushes table\nchanges to disk to permit binary table copies while the\nserver is running. Introduced in MariaDB 10.0.8. See FLUSH\nTABLES ... FOR EXPORT for more. | \n \nTABLES WITH READ LOCK | Closes all open tables. New tables\nare only allowed to be opened with read locks until an\nUNLOCK TABLES is given. | \n \nTABLES WITH READ LOCK AND DISABLE CHECKPOINT | As TABLES\nWITH READ LOCK but also disable all checkpoint writes by\ntransactional table engines. This is useful when doing a\ndisk snapshot of all tables. | \n \nTABLE_STATISTICS | Reset table statistics (see SHOW\nTABLE_STATISTICS). | \n \nUSER_RESOURCES | Resets all per hour user resources. This\nenables clients that have exhausted their resources to\nconnect again. | \n \nUSER_STATISTICS | Reset user statistics (see SHOW\nUSER_STATISTICS). | \n \nYou can also use the mysqladmin client to flush things. Use\nmysqladmin --help to examine what flush commands it\nsupports.\n \nFLUSH STATUS\n \nServer status variables can be reset by executing the\nfollowing:\n \nFLUSH STATUS;\n \nGlobal Status Variables that Support FLUSH STATUS\n \nNot all global status variables support being reset by FLUSH\nSTATUS. Currently, the following status variables are reset\nby FLUSH STATUS:\nAborted_clients\nAborted_connects\nAria_pagecache_blocks_not_flushed\nAria_pagecache_blocks_unused\nAria_pagecache_blocks_used\nBinlog_cache_disk_use\nBinlog_cache_use\nBinlog_stmt_cache_disk_use\nBinlog_stmt_cache_use\nConnection_errors_accept\nConnection_errors_internal\nConnection_errors_max_connections\nConnection_errors_peer_address\nConnection_errors_select\nConnection_errors_tcpwrap\nCreated_tmp_files\nDelayed_errors\nDelayed_writes\nFeature_check_constraint\nFeature_delay_key_write\nMax_used_connections\nOpened_plugin_libraries\nPerformance_schema_accounts_lost\nPerformance_schema_cond_instances_lost\nPerformance_schema_digest_lost\nPerformance_schema_file_handles_lost\nPerformance_schema_file_instances_lost\nPerformance_schema_hosts_lost\nPerformance_schema_locker_lost\nPerformance_schema_mutex_instances_lost\nPerformance_schema_rwlock_instances_lost\nPerformance_schema_session_connect_attrs_lost\nPerformance_schema_socket_instances_lost\nPerformance_schema_stage_classes_lost\nPerformance_schema_statement_classes_lost\nPerformance_schema_table_handles_lost\nPerformance_schema_table_instances_lost\nPerformance_schema_thread_instances_lost\nPerformance_schema_users_lost\nQcache_hits\nQcache_inserts\nQcache_lowmem_prunes\nQcache_not_cached\nRpl_semi_sync_master_no_times\nRpl_semi_sync_master_no_tx\nRpl_semi_sync_master_timefunc_failures\nRpl_semi_sync_master_wait_pos_backtraverse\nRpl_semi_sync_master_yes_tx\nRpl_transactions_multi_engine\nServer_audit_writes_failed\nSlave_retried_transactions\nSlow_launch_threads\nSsl_accept_renegotiates\nSsl_accepts\nSsl_callback_cache_hits\nSsl_client_connects\nSsl_connect_renegotiates\nSsl_ctx_verify_depth\nSsl_ctx_verify_mode\nSsl_finished_accepts\nSsl_finished_connects\nSsl_session_cache_hits\nSsl_session_cache_misses\nSsl_session_cache_overflows\nSsl_session_cache_size\nSsl_session_cache_timeouts\nSsl_sessions_reused\nSsl_used_session_cache_entries\nSubquery_cache_hit\nSubquery_cache_miss\nTable_locks_immediate\nTable_locks_waited\nTc_log_max_pages_used\nTc_log_page_waits\nTransactions_gtid_foreign_engine\nTransactions_multi_engine\n \nFLUSH SSL\n \nThe FLUSH SSL command was first added in MariaDB 10.4.\n \nIn MariaDB 10.4 and later, the FLUSH SSL command can be used\nto dynamically reinitialize the server\'s TLS context. This\nis most useful if you need to replace a certificate that is\nabout to expire without restarting the server.\n \nThis operation is performed by reloading the files defined\nby the following TLS system variables:\nssl_cert\nssl_key\nssl_ca\nssl_capath\nssl_crl\nssl_crlpath\n \nThese TLS system variables are not dynamic, so their values\ncan not be changed without restarting the server.\n \nIf you want to dynamically reinitialize the server\'s TLS\ncontext, then you need to change the certificate and key\nfiles at the relevant paths defined by these TLS system\nvariables, without actually changing the values of the\nvariables. See MDEV-19341 for more information.\n \nReducing Memory Usage\n \nTo flush some of the global caches that take up memory, you\ncould execute the following command:\n \nFLUSH LOCAL HOSTS,\n QUERY CACHE, \n TABLE_STATISTICS, \n INDEX_STATISTICS, \n USER_STATISTICS;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/flush/','','https://mariadb.com/kb/en/library/flush/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (341,26,'FLUSH QUERY CACHE','Description\n----------- \nYou can defragment the query cache to better utilize its\nmemory with\nthe FLUSH QUERY CACHE statement. The statement does not\nremove any queries from the cache.\n \nThe RESET QUERY CACHE statement removes all query results\nfrom the query cache.\nThe FLUSH TABLES statement also does this.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/flush-query-cache/','','https://mariadb.com/kb/en/library/flush-query-cache/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (342,26,'FLUSH TABLES FOR EXPORT','FLUSH TABLES ... FOR EXPORT was introduced in MariaDB\n10.0.8.\n \nSyntax\n------ \nFLUSH TABLES table_name [, table_name] FOR EXPORT\n \nDescription\n----------- \nFLUSH TABLES ... FOR EXPORT flushes changes to the specified\ntables to disk so that binary copies can be made while the\nserver is still running. This works for Archive, Aria, CSV,\nInnoDB, MyISAM, MERGE, and XtraDB tables.\n \nThe table is read locked until one has issued UNLOCK TABLES.\n \nIf a storage engine does not support FLUSH TABLES FOR\nEXPORT, a 1031 error (SQLSTATE \'HY000\') is produced.\n \nIf FLUSH TABLES ... FOR EXPORT is in effect in the session,\nthe following statements will produce an error if attempted:\nFLUSH TABLES WITH READ LOCK\nFLUSH TABLES ... WITH READ LOCK\nFLUSH TABLES ... FOR EXPORT\nAny statement trying to update any table\n \nIf any of the following statements is in effect in the\nsession, attempting FLUSH TABLES ... FOR EXPORT will\nproduce an error.\nFLUSH TABLES ... WITH READ LOCK\nFLUSH TABLES ... FOR EXPORT\nLOCK TABLES ... READ\nLOCK TABLES ... WRITE\n \nFLUSH FOR EXPORT is not written to the binary log.\n \nThis statement requires the RELOAD and the LOCK TABLES\nprivileges.\n \nIf one of the specified tables cannot be locked, none of the\ntables will be locked.\n \nIf a table does not exist, an error like the following will\nbe produced:\n \nERROR 1146 (42S02): Table \'test.xxx\' doesn\'t exist\n \nIf a table is a view, an error like the following will be\nproduced:\n \nERROR 1347 (HY000): \'test.v\' is not BASE TABLE\n \nExample\n \nFLUSH TABLES test.t1 FOR EXPORT;\n# Copy files related to the table (see below)\nUNLOCK TABLES;\n \nFor a full description, please see copying MariaDB tables.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/flush-tables-for-export/','','https://mariadb.com/kb/en/library/flush-tables-for-export/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (343,26,'HELP Command','Syntax\n------ \nHELP search_string\n \nDescription\n----------- \nThe HELP command can be used in any MariaDB client, such as\nthe mysql command-line client, to get basic syntax help and\na short description for most commands and functions. \n \nIf you provide an argument to the HELP command, the mysql\nclient uses it as a search string to access server-side\nhelp. The proper operation of this command requires that the\nhelp tables in the mysql database be initialized with help\ntopic information.\n \nIf there is no match for the search string, the search\nfails. Use help contents to see a list of the help\ncategories:\n \nHELP contents\nYou asked for help about help category: \"Contents\"\nFor more information, type \'help \', where is one of the\nfollowing\ncategories:\n \n Account Management\n Administration\n Compound Statements\n Data Definition\n Data Manipulation\n Data Types\n Functions\n Functions and Modifiers for Use with GROUP BY\n Geographic Features\n Language Structure\n Plugins\n Table Maintenance\n Transactions\n User-Defined Functions\n Utility\n \nIf a search string matches multiple items, MariaDB shows a\nlist of matching topics:\n \nHELP create\nMany help items for your request exist.\nTo make a more specific request, please type \'help \',\nwhere is one of the following\ntopics:\n CREATE DATABASE\n CREATE EVENT\n CREATE FUNCTION\n CREATE FUNCTION UDF\n CREATE INDEX\n CREATE PROCEDURE\n CREATE SERVER\n CREATE TABLE\n CREATE TABLESPACE\n CREATE TRIGGER\n CREATE USER\n CREATE VIEW\n SHOW\n SHOW CREATE DATABASE\n SHOW CREATE EVENT\n SHOW CREATE FUNCTION\n SHOW CREATE PROCEDURE\n SHOW CREATE TABLE\n SPATIAL\n \nThen you can enter a topic as the search string to see the\nhelp entry for that topic.\n \nThe help is provided with the MariaDB server and makes use\nof four help tables found in the mysql database:\nhelp_relation, help_topic, help_category and help_keyword.\nThese tables are populated by the mysql_install_db or\nfill_help_table.sql scripts which currently contain data\ngenerated from an old version of MySQL.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/help-command/','','https://mariadb.com/kb/en/library/help-command/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (344,26,'KILL [CONNECTION | QUERY]','Syntax\n------ \nKILL [HARD | SOFT] [CONNECTION | QUERY [ID] ] [thread_id |\nUSER user_name | query_id]\n \nMariaDB 5.3.2\n \nThe options HARD | SOFT and USER username were introduced in\nMariaDB 5.3.2\n \nMariaDB 10.0.5\n \nKILL QUERY ID query_id, which permits killing a query by\nquery id rather than thread id, was introduced in MariaDB\n10.0.5.\n \nDescription\n----------- \nEach connection to mysqld runs in a separate thread. You can\nsee which threads\nare running with the SHOW PROCESSLIST statement and kill a\nthread with the KILL thread_id statement. \nKILL allows the optional CONNECTION or\nQUERY modifier:\nKILL CONNECTION is the same as KILL with no\n modifier: It terminates the connection associated with the\ngiven thread or query id.\nKILL QUERY terminates the statement that the connection\nthread_id is\n currently executing, but leaves the connection itself\nintact.\nKILL QUERY ID (introduced in MariaDB 10.0.5) terminates the\nquery by query_id, leaving the connection intact.\n \nIf a connection is terminated that has an active\ntransaction, the transaction will be rolled back. If only a\nquery is killed, the current transaction will stay active.\nSee also idle_transaction_timeout.\n \nIf you have the PROCESS privilege, you can see all threads.\nIf\nyou have the SUPER privilege, you can kill all threads and\nstatements. Otherwise, you can see and kill only your own\nthreads and\nstatements.\n \nKilling queries that repair or create indexes on MyISAM and\nAria tables may result in corrupted tables. Use the SOFT\noption to avoid this!\n \nThe HARD option (default) kills a command as soon as\npossible. If you use\nSOFT, then critical operations that may leave a table in an\ninconsistent state will not be interrupted. Such operations\ninclude REPAIR and INDEX creation for MyISAM and Aria tables\n(REPAIR TABLE, OPTIMIZE TABLE).\n \nKILL ... USER username will kill all connections/queries for\na\ngiven user. USER can be specified one of the following ways:\nusername (Kill without regard to hostname)\nusername@hostname\nCURRENT_USER or CURRENT_USER()\n \nIf you specify a thread id and that thread does not exist,\nyou get the following error:\n \nERROR 1094 (HY000): Unknown thread id: \n \nIf you specify a query id that doesn\'t exist, you get the\nfollowing error:\n \nERROR 1957 (HY000): Unknown query id: \n \nHowever, if you specify a user name, no error is issued for\nnon-connected (or even non-existing) users. To check if the\nconnection/query has been killed, you can use the\nROW_COUNT() function.\n \nA client whose connection is killed receives the following\nerror:\n \nERROR 1317 (70100): Query execution was interrupted\n \nTo obtain a list of existing sessions, use the SHOW\nPROCESSLIST statement or query the Information Schema\nPROCESSLIST table.\n \nNote: You cannot use KILL with the Embedded MySQL Server\nlibrary because the embedded server merely runs inside the\nthreads of the host\napplication. It does not create any connection threads of\nits own.\n \nNote: You can also use \nmysqladmin kill thread_id [,thread_id...]\nto kill connections. To get a list of running queries,\nuse mysqladmin processlist. See mysqladmin.\n \nPercona Toolkit contains a program, pt-kill that can be used\nto automatically kill connections that match certain\ncriteria. For example, it can be used to terminate idle\nconnections, or connections that have been busy for more\nthan 60 seconds.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/data-manipulation-kill-connection-query/','','https://mariadb.com/kb/en/library/data-manipulation-kill-connection-query/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (345,26,'LOAD INDEX','Syntax\n------ \nLOAD INDEX INTO CACHE\n tbl_index_list [, tbl_index_list] ...\n \ntbl_index_list:\n tbl_name\n [[INDEX|KEY] (index_name[, index_name] ...)]\n [IGNORE LEAVES]\n \nDescription\n----------- \nThe LOAD INDEX INTO CACHE statement preloads a table index\ninto the key\ncache to which it has been assigned by an explicit CACHE\nINDEX\nstatement, or into the default key cache otherwise. \nLOAD INDEX INTO CACHE is used only for MyISAM or Aria\ntables. Until MariaDB 5.3, it was not supported for tables\nhaving user-defined partitioning, but this limitation was\nremoved in MariaDB 5.5.\n \nThe IGNORE LEAVES modifier causes only blocks for the\nnonleaf nodes of\nthe index to be preloaded.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/load-index/','','https://mariadb.com/kb/en/library/load-index/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (346,26,'RESET','Syntax\n------ \nRESET reset_option [, reset_option] ...\n \nDescription\n----------- \nThe RESET statement is used to clear the state of various\nserver\noperations. You must have the RELOAD privilege to execute\nRESET.\n \nRESET acts as a stronger version of the FLUSH statement.\n \nThe different RESET options are:\n \nOption | Description | \n \nSLAVE [\"connection_name\"] [ALL] | Deletes all relay logs\nfrom the slave and reset the replication position in the\nmaster binary log. | \n \nMASTER | Deletes all old binary logs, makes the binary index\nfile (--log-bin-index) empty and creates a new binary log\nfile. This is useful when you want to reset the master to an\ninitial state. If you want to just delete old, not used\nbinary logs, you should use the PURGE BINARY LOGS command. |\n\n \nQUERY CACHE | Removes all queries from the query cache. See\nalso FLUSH QUERY CACHE. | \n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/reset/','','https://mariadb.com/kb/en/library/reset/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (347,26,'SET','Syntax\n------ \nSET variable_assignment [, variable_assignment] ...\n \nvariable_assignment:\n user_var_name = expr\n | [GLOBAL | SESSION] system_var_name = expr\n | [@@global. | @@session. | @@]system_var_name = expr\n \nOne can also set a user variable in any expression with this\nsyntax:\n \nuser_var_name:= expr\n \nDescription\n----------- \nThe SET statement assigns values to different types of\nvariables that affect the operation of the server or your\nclient. Older\nversions of MySQL employed SET OPTION, but this syntax was\ndeprecated in favor of SET without OPTION, and was removed\nin MariaDB 10.0.\n \nChanging a system variable by using the SET statement does\nnot make the change permanently. To do so, the change must\nbe made in a configuration file.\n \nFor setting variables on a per-query basis (from MariaDB\n10.1.2), see SET STATEMENT.\n \nSee SHOW VARIABLES for documentation on viewing server\nsystem variables.\n \nSee Server System Variables for a list of all the system\nvariables.\n \nGLOBAL / SESSION\n \nWhen setting a system variable, the scope can be specified\nas either GLOBAL or SESSION.\n \nA global variable change affects all new sessions. It does\nnot affect any currently open sessions, including the one\nthat made the change. \n \nA session variable change affects the current session only.\n \nIf the variable has a session value, not specifying either\nGLOBAL or SESSION will be the same as specifying SESSION. If\nthe variable only has a global value, not specifying GLOBAL\nor SESSION will apply to the change to the global value.\n \nDEFAULT\n \nSetting a global variable to DEFAULT will restore it to the\nserver default, and setting a session variable to DEFAULT\nwill restore it to the current global value.\n \nExamples\n-------- \ninnodb_sync_spin_loops is a global variable.\nskip_parallel_replication is a session variable.\nmax_error_count is both global and session.\n \nSELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM\n INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE \n VARIABLE_NAME LIKE \'max_error_count\' OR \n VARIABLE_NAME LIKE \'skip_parallel_replication\' OR \n VARIABLE_NAME LIKE \'innodb_sync_spin_loops\';\n \n+---------------------------+---------------+--------------+\n| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |\n+---------------------------+---------------+--------------+\n| MAX_ERROR_COUNT | 64 | 64 |\n| SKIP_PARALLEL_REPLICATION | OFF | NULL |\n| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |\n+---------------------------+---------------+--------------+\n \nSetting the session values:\n \nSET max_error_count=128;\nQuery OK, 0 rows affected (0.000 sec)\n \nSET skip_parallel_replication=ON;\nQuery OK, 0 rows affected (0.000 sec)\n \nSET innodb_sync_spin_loops=60;\n \nERROR 1229 (HY000): Variable \'innodb_sync_spin_loops\' is a\nGLOBAL variable \n and should be set with SET GLOBAL\n \nSELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM\n INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE \n VARIABLE_NAME LIKE \'max_error_count\' OR \n VARIABLE_NAME LIKE \'skip_parallel_replication\' OR \n VARIABLE_NAME LIKE \'innodb_sync_spin_loops\';\n \n+---------------------------+---------------+--------------+\n| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |\n+---------------------------+---------------+--------------+\n| MAX_ERROR_COUNT | 128 | 64 |\n| SKIP_PARALLEL_REPLICATION | ON | NULL |\n| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |\n+---------------------------+---------------+--------------+\n \nSetting the global values:\n \nSET GLOBAL max_error_count=256;\n \nSET GLOBAL skip_parallel_replication=ON;\n \nERROR 1228 (HY000): Variable \'skip_parallel_replication\'\nis a SESSION variable \n and can\'t be used with SET GLOBAL\n \nSET GLOBAL innodb_sync_spin_loops=120;\n \nSELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM\n INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE \n VARIABLE_NAME LIKE \'max_error_count\' OR \n VARIABLE_NAME LIKE \'skip_parallel_replication\' OR \n VARIABLE_NAME LIKE \'innodb_sync_spin_loops\';\n \n+---------------------------+---------------+--------------+\n| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |\n+---------------------------+---------------+--------------+\n| MAX_ERROR_COUNT | 128 | 256 |\n| SKIP_PARALLEL_REPLICATION | ON | NULL |\n| INNODB_SYNC_SPIN_LOOPS | NULL | 120 |\n+---------------------------+---------------+--------------+\n \nSHOW VARIABLES will by default return the session value\nunless the variable is global only.\n \nSHOW VARIABLES LIKE \'max_error_count\';\n \n+-----------------+-------+\n| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 128 |\n+-----------------+-------+\n \nSHOW VARIABLES LIKE \'skip_parallel_replication\';\n \n+---------------------------+-------+\n| Variable_name | Value |\n+---------------------------+-------+\n| skip_parallel_replication | ON |\n+---------------------------+-------+\n \nSHOW VARIABLES LIKE \'innodb_sync_spin_loops\';\n \n+------------------------+-------+\n| Variable_name | Value |\n+------------------------+-------+\n| innodb_sync_spin_loops | 120 |\n+------------------------+-------+\n \nUsing the inplace syntax:\n \nSELECT (@a:=1);\n+---------+\n| (@a:=1) |\n+---------+\n| 1 |\n+---------+\n \nSELECT @a;\n \n+------+\n| @a |\n+------+\n| 1 |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/set/','','https://mariadb.com/kb/en/library/set/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (348,26,'About SHOW','SHOW has many forms that provide information about\ndatabases, tables, columns, or status information about the\nserver. These include:\nSHOW AUTHORS\nSHOW CHARACTER SET [like_or_where]\nSHOW COLLATION [like_or_where]\nSHOW [FULL] COLUMNS FROM tbl_name [FROM db_name]\n[like_or_where]\nSHOW CONTRIBUTORS\nSHOW CREATE DATABASE db_name\nSHOW CREATE EVENT event_name\nSHOW CREATE PACKAGE package_name\nSHOW CREATE PACKAGE BODY package_name\nSHOW CREATE PROCEDURE proc_name\nSHOW CREATE TABLE tbl_name\nSHOW CREATE TRIGGER trigger_name\nSHOW CREATE VIEW view_name\nSHOW DATABASES [like_or_where]\nSHOW ENGINE engine_name {STATUS | MUTEX}\nSHOW [STORAGE] ENGINES\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW [FULL] EVENTS\nSHOW FUNCTION CODE func_name\nSHOW FUNCTION STATUS [like_or_where]\nSHOW GRANTS FOR user\nSHOW INDEX FROM tbl_name [FROM db_name]\nSHOW INNODB STATUS\nSHOW OPEN TABLES [FROM db_name] [like_or_where]\nSHOW PLUGINS\nSHOW PROCEDURE CODE proc_name\nSHOW PROCEDURE STATUS [like_or_where]\nSHOW PRIVILEGES\nSHOW [FULL] PROCESSLIST\nSHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]\nSHOW PROFILES\nSHOW [GLOBAL | SESSION] STATUS [like_or_where]\nSHOW TABLE STATUS [FROM db_name] [like_or_where]\nSHOW TABLES [FROM db_name] [like_or_where]\nSHOW TRIGGERS [FROM db_name] [like_or_where]\nSHOW [GLOBAL | SESSION] VARIABLES [like_or_where]\nSHOW WARNINGS [LIMIT [offset,] row_count]\n \nlike_or_where:\n LIKE \'pattern\'\n | WHERE expr\n \nIf the syntax for a given SHOW statement includes a\nLIKE \'pattern\' part, \'pattern\' is a\nstring that can contain the SQL \"%\" and\n\"_\" wildcard characters. The pattern is useful for\nrestricting statement output to matching values.\n \nSeveral SHOW statements also accept a\nWHERE clause that provides more flexibility in specifying\nwhich rows to display. See Extended Show.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/about-show/','','https://mariadb.com/kb/en/library/about-show/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (349,26,'SHOW AUTHORS','Syntax\n------ \nSHOW AUTHORS\n \nDescription\n----------- \nThe SHOW AUTHORS statement displays information about the\npeople who work on MariaDB. For each author, it displays\nName, Location, and\nComment values. All columns are encoded as latin1.\n \nIn MariaDB 5.5 this is in somewhat random order.\n \nIn MariaDB 10.0.5 and later you have:\nFirst the active people in MariaDB are listed.\nThen the active people in MySQL.\nLast the people that has contributed to MariaDB/MySQL in the\npast.\n \nThe order is somewhat related to importance of the\ncontribution given to the MariaDB project, but this is not\n100% accurate. There is still room for improvements and\ndebate...\n \nExample\n \nSHOW AUTHORS;\n+--------------------------------+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+\n| Name | Location | Comment |\n+--------------------------------+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+\n| Michael (Monty) Widenius | Tusby, Finland | Lead developer\nand main author |\n| Sergei Golubchik | Kerpen, Germany | Architect, Full-text\nsearch, precision math, plugin framework, merges etc |\n| Igor Babaev | Bellevue, USA | Optimizer, keycache, core\nwork |\n| Sergey Petrunia | St. Petersburg, Russia | Optimizer |\n| Oleksandr Byelkin | Lugansk, Ukraine | Query Cache (4.0),\nSubqueries (4.1), Views (5.0) |\n| Timour Katchaounov | Sofia , Bulgaria | Optimizer |\n| Kristian Nielsen | Copenhagen, Denmark | Replication,\nAsync client prototocol, General buildbot stuff |\n| Alexander (Bar) Barkov | Izhevsk, Russia | Unicode and\ncharacter sets |\n| Alexey Botchkov (Holyfoot) | Izhevsk, Russia | GIS\nextensions, embedded server, precision math |\n| Daniel Bartholomew | Raleigh, USA | MariaDB documentation\n|\n| Colin Charles | Selangor, Malesia | MariaDB documentation,\ntalks at a LOT of conferences |\n| Sergey Vojtovich | Izhevsk, Russia | initial\nimplementation of plugin architecture, maintained native\nstorage engines (MyISAM, MEMORY, ARCHIVE, etc), rewrite of\ntable cache |\n| Vladislav Vaintroub | Mannheim, Germany | MariaDB Java\nconnector, new thread pool, Windows optimizations |\n| Elena Stepanova | Sankt Petersburg, Russia | QA, test\ncases |\n| Georg Richter | Heidelberg, Germany | New LGPL C\nconnector, PHP connector |\n| Jan Lindström | Ylämylly, Finland | Working on InnoDB |\n| Lixun Peng | Hangzhou, China | Multi Source replication |\n| Percona | CA, USA | XtraDB, microslow patches, extensions\nto slow log \n...\n \nSee Also\n \nSHOW CONTRIBUTORS. This list all members and sponsors of the\nMariaDB Foundation and other sponsors.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-authors/','','https://mariadb.com/kb/en/library/show-authors/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (350,26,'SHOW BINARY LOGS','Syntax\n------ \nSHOW BINARY LOGS\nSHOW MASTER LOGS\n \nDescription\n----------- \nLists the binary log files on the server. This statement is\nused as part of the\nprocedure described in \nPURGE BINARY LOGS, that shows how to\ndetermine which logs can be purged.\n \nExamples\n-------- \nSHOW BINARY LOGS;\n+--------------------+-----------+\n| Log_name | File_size |\n+--------------------+-----------+\n| mariadb-bin.000001 | 19039 |\n| mariadb-bin.000002 | 717389 |\n| mariadb-bin.000003 | 300 |\n| mariadb-bin.000004 | 333 |\n| mariadb-bin.000005 | 899 |\n| mariadb-bin.000006 | 125 |\n| mariadb-bin.000007 | 18907 |\n| mariadb-bin.000008 | 19530 |\n| mariadb-bin.000009 | 151 |\n| mariadb-bin.000010 | 151 |\n| mariadb-bin.000011 | 125 |\n| mariadb-bin.000012 | 151 |\n| mariadb-bin.000013 | 151 |\n| mariadb-bin.000014 | 125 |\n| mariadb-bin.000015 | 151 |\n| mariadb-bin.000016 | 314 |\n+--------------------+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-binary-logs/','','https://mariadb.com/kb/en/library/show-binary-logs/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (351,26,'SHOW BINLOG EVENTS','Syntax\n------ \nSHOW BINLOG EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n \nDescription\n----------- \nShows the events in the binary log. If you do not specify\n\'log_name\',\nthe first binary log is displayed.\n \nExample\n \nSHOW BINLOG EVENTS IN \'mysql_sandbox10019-bin.000002\';\n+-------------------------------+-----+-------------------+-----------+-------------+------------------------------------------------+\n| Log_name | Pos | Event_type | Server_id | End_log_pos |\nInfo |\n+-------------------------------+-----+-------------------+-----------+-------------+------------------------------------------------+\n| mysql_sandbox10019-bin.000002 | 4 | Format_desc | 1 | 248\n| Server ver: 10.0.19-MariaDB-log, Binlog ver: 4 |\n| mysql_sandbox10019-bin.000002 | 248 | Gtid_list | 1 | 273\n| [] |\n| mysql_sandbox10019-bin.000002 | 273 | Binlog_checkpoint |\n1 | 325 | mysql_sandbox10019-bin.000002 |\n| mysql_sandbox10019-bin.000002 | 325 | Gtid | 1 | 363 |\nGTID 0-1-1 |\n| mysql_sandbox10019-bin.000002 | 363 | Query | 1 | 446 |\nCREATE DATABASE blog |\n| mysql_sandbox10019-bin.000002 | 446 | Gtid | 1 | 484 |\nGTID 0-1-2 |\n| mysql_sandbox10019-bin.000002 | 484 | Query | 1 | 571 |\nuse `blog`; CREATE TABLE bb (id INT) |\n+-------------------------------+-----+-------------------+-----------+-------------+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-binlog-events/','','https://mariadb.com/kb/en/library/show-binlog-events/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (352,26,'SHOW CHARACTER SET','Syntax\n------ \nSHOW CHARACTER SET\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThe SHOW CHARACTER SET statement shows all available\ncharacter sets. The LIKE clause, if present on its own,\nindicates which character\nset names to match. The WHERE and LIKE clauses can be given\nto select rows using more general conditions, as discussed\nin Extended SHOW.\n \nThe same information can be queried from the\ninformation_schema.CHARACTER_SETS table.\n \nSee Setting Character Sets and Collations for details on\nspecifying the character set at the server, database, table\nand column levels.\n \nExamples\n-------- \nSHOW CHARACTER SET LIKE \'latin%\';\n+---------+-----------------------------+-------------------+--------+\n| Charset | Description | Default collation | Maxlen |\n+---------+-----------------------------+-------------------+--------+\n| latin1 | cp1252 West European | latin1_swedish_ci | 1 |\n| latin2 | ISO 8859-2 Central European | latin2_general_ci |\n1 |\n| latin5 | ISO 8859-9 Turkish | latin5_turkish_ci | 1 |\n| latin7 | ISO 8859-13 Baltic | latin7_general_ci | 1 |\n+---------+-----------------------------+-------------------+--------+\n \nSHOW CHARACTER SET WHERE Maxlen LIKE \'2\';\n+---------+---------------------------+-------------------+--------+\n| Charset | Description | Default collation | Maxlen |\n+---------+---------------------------+-------------------+--------+\n| big5 | Big5 Traditional Chinese | big5_chinese_ci | 2 |\n| sjis | Shift-JIS Japanese | sjis_japanese_ci | 2 |\n| euckr | EUC-KR Korean | euckr_korean_ci | 2 |\n| gb2312 | GB2312 Simplified Chinese | gb2312_chinese_ci | 2\n|\n| gbk | GBK Simplified Chinese | gbk_chinese_ci | 2 |\n| ucs2 | UCS-2 Unicode | ucs2_general_ci | 2 |\n| cp932 | SJIS for Windows Japanese | cp932_japanese_ci | 2\n|\n+---------+---------------------------+-------------------+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-character-set/','','https://mariadb.com/kb/en/library/show-character-set/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (353,26,'SHOW CLIENT_STATISTICS','MariaDB 5.2 introduced the User Statistics feature.\n \nSyntax\n------ \nSHOW CLIENT_STATISTICS\n \nDescription\n----------- \nThe SHOW CLIENT_STATISTICS statement was introduced in\nMariaDB 5.2 as part of the User Statistics feature. It was\nremoved as a separate statement in MariaDB 10.1.1, but\neffectively replaced by the generic SHOW\ninformation_schema_table statement. The\ninformation_schema.CLIENT_STATISTICS table holds statistics\nabout client connections.\n \nThe userstat system variable must be set to 1 to activate\nthis feature. See the User Statistics and\ninformation_schema.CLIENT_STATISTICS articles for more\ninformation.\n \nExample\n \nFrom MariaDB 10.0:\n \nSHOW CLIENT_STATISTICS\\G\n*************************** 1. row\n***************************\n Client: localhost\n Total_connections: 35\nConcurrent_connections: 0\n Connected_time: 708\n Busy_time: 2.5557979999999985\n Cpu_time: 0.04123740000000002\n Bytes_received: 3883\n Bytes_sent: 21595\n Binlog_bytes_written: 0\n Rows_read: 18\n Rows_sent: 115\n Rows_deleted: 0\n Rows_inserted: 0\n Rows_updated: 0\n Select_commands: 70\n Update_commands: 0\n Other_commands: 0\n Commit_transactions: 1\n Rollback_transactions: 0\n Denied_connections: 0\n Lost_connections: 0\n Access_denied: 0\n Empty_queries: 35\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/show-client-statistics/','','https://mariadb.com/kb/en/library/show-client-statistics/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (354,26,'SHOW COLLATION','Syntax\n------ \nSHOW COLLATION\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThe output from SHOW COLLATION includes all available\ncollations. The LIKE clause, if present on its own,\nindicates which collation names to match. The WHERE and LIKE\nclauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n \nThe same information can be queried from the\ninformation_schema.COLLATIONS table.\n \nSee Setting Character Sets and Collations for details on\nspecifying the collation at the server, database, table and\ncolumn levels.\n \nExamples\n-------- \nSHOW COLLATION LIKE \'latin1%\';\n+-------------------+---------+----+---------+----------+---------+\n| Collation | Charset | Id | Default | Compiled | Sortlen |\n+-------------------+---------+----+---------+----------+---------+\n| latin1_german1_ci | latin1 | 5 | | Yes | 1 |\n| latin1_swedish_ci | latin1 | 8 | Yes | Yes | 1 |\n| latin1_danish_ci | latin1 | 15 | | Yes | 1 |\n| latin1_german2_ci | latin1 | 31 | | Yes | 2 |\n| latin1_bin | latin1 | 47 | | Yes | 1 |\n| latin1_general_ci | latin1 | 48 | | Yes | 1 |\n| latin1_general_cs | latin1 | 49 | | Yes | 1 |\n| latin1_spanish_ci | latin1 | 94 | | Yes | 1 |\n+-------------------+---------+----+---------+----------+---------+\n \nSHOW COLLATION WHERE Sortlen LIKE \'8\' AND Charset LIKE\n\'utf8\';\n+--------------------+---------+-----+---------+----------+---------+\n| Collation | Charset | Id | Default | Compiled | Sortlen |\n+--------------------+---------+-----+---------+----------+---------+\n| utf8_unicode_ci | utf8 | 192 | | Yes | 8 |\n| utf8_icelandic_ci | utf8 | 193 | | Yes | 8 |\n| utf8_latvian_ci | utf8 | 194 | | Yes | 8 |\n| utf8_romanian_ci | utf8 | 195 | | Yes | 8 |\n| utf8_slovenian_ci | utf8 | 196 | | Yes | 8 |\n| utf8_polish_ci | utf8 | 197 | | Yes | 8 |\n| utf8_estonian_ci | utf8 | 198 | | Yes | 8 |\n| utf8_spanish_ci | utf8 | 199 | | Yes | 8 |\n| utf8_swedish_ci | utf8 | 200 | | Yes | 8 |\n| utf8_turkish_ci | utf8 | 201 | | Yes | 8 |\n| utf8_czech_ci | utf8 | 202 | | Yes | 8 |\n| utf8_danish_ci | utf8 | 203 | | Yes | 8 |\n| utf8_lithuanian_ci | utf8 | 204 | | Yes | 8 |\n| utf8_slovak_ci | utf8 | 205 | | Yes | 8 |\n| utf8_spanish2_ci | utf8 | 206 | | Yes | 8 |\n| utf8_roman_ci | utf8 | 207 | | Yes | 8 |\n| utf8_persian_ci | utf8 | 208 | | Yes | 8 |\n| utf8_esperanto_ci | utf8 | 209 | | Yes | 8 |\n| utf8_hungarian_ci | utf8 | 210 | | Yes | 8 |\n| utf8_sinhala_ci | utf8 | 211 | | Yes | 8 |\n| utf8_croatian_ci | utf8 | 213 | | Yes | 8 |\n+--------------------+---------+-----+---------+----------+---------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-collation/','','https://mariadb.com/kb/en/library/show-collation/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (355,26,'SHOW COLUMNS','Syntax\n------ \nSHOW [FULL] {COLUMNS | FIELDS} FROM tbl_name [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nSHOW COLUMNS displays information about the columns in a\ngiven table. It also works for views. The LIKE clause, if\npresent on its own, indicates which column names to match.\nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nIf the data types differ from what you expect them to be\nbased on a\nCREATE TABLE statement, note that MariaDB sometimes changes\ndata types when you create or alter a table. The conditions\nunder which this\noccurs are described in the Silent Column Changes article.\n \nThe FULL keyword causes the output to include the column\ncollation and comments, as well as the privileges you have\nfor each column.\n \nYou can use db_name.tbl_name as an alternative to the\ntbl_name FROM db_name syntax. In other words, these two\nstatements are equivalent:\n \nSHOW COLUMNS FROM mytable FROM mydb;\nSHOW COLUMNS FROM mydb.mytable;\n \nSHOW COLUMNS displays the following values for each table\ncolumn:\n \nField indicates the column name.\n \nType indicates the column data type.\n \nCollation indicates the collation for non-binary string\ncolumns, or\nNULL for other columns. This value is displayed only if you\nuse the\nFULL keyword.\n \nThe Null field contains YES if NULL values can be stored in\nthe column,\nNO if not.\n \nThe Key field indicates whether the column is indexed:\nIf Key is empty, the column either is not indexed or is\nindexed only as a\n secondary column in a multiple-column, non-unique index.\nIf Key is PRI, the column is a PRIMARY KEY or\n is one of the columns in a multiple-column PRIMARY KEY.\nIf Key is UNI, the column is the first column of a\nunique-valued\n index that cannot contain NULL values.\nIf Key is MUL, multiple occurrences of a given value are\nallowed\n within the column. The column is the first column of a\nnon-unique index or a\n unique-valued index that can contain NULL values.\n \nIf more than one of the Key values applies to a given column\nof a\ntable, Key displays the one with the highest priority, in\nthe order\nPRI, UNI, MUL.\n \nA UNIQUE index may be displayed as PRI if\nit cannot contain NULL values and there is no\nPRIMARY KEY in the table. A UNIQUE index\nmay display as MUL if several columns form a composite\nUNIQUE index; although the combination of the columns is\nunique, each column can still hold multiple occurrences of a\ngiven value.\n \nThe Default field indicates the default value that is\nassigned to the\ncolumn.\n \nThe Extra field contains any additional information that is\navailable about a given column.\n \nValue | Description | \n \nAUTO_INCREMENT | The column was created with the\nAUTO_INCREMENT keyword. | \n \nPERSISTENT | The column was created with the PERSISTENT\nkeyword. (New in 5.3) | \n \nVIRTUAL | The column was created with the VIRTUAL keyword.\n(New in 5.3) | \n \non update CURRENT_TIMESTAMP | The column is a TIMESTAMP\ncolumn that is automatically updated on INSERT and UPDATE. |\n\n \nPrivileges indicates the privileges you have for the column.\nThis\nvalue is displayed only if you use the FULL keyword.\n \nComment indicates any comment the column has. This value is\ndisplayed\nonly if you use the FULL keyword.\n \nSHOW FIELDS is a synonym for\nSHOW COLUMNS. Also DESCRIBE and EXPLAIN can be used as\nshortcuts.\n \nYou can also list a table\'s columns with: \n \nmysqlshow db_name tbl_name\n \nSee the mysqlshow command for more details.\n \nThe DESCRIBE statement provides information similar to SHOW\nCOLUMNS. The information_schema.COLUMNS table provides\nsimilar, but more complete, information.\n \nThe SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX\nstatements also provide information about tables.\n \nExamples\n-------- \nSHOW COLUMNS FROM city;\n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | NO | | | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | NO | | 0 | |\n+------------+----------+------+-----+---------+----------------+\n \nSHOW COLUMNS FROM employees WHERE Type LIKE \'Varchar%\';\n+---------------+-------------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+---------------+-------------+------+-----+---------+-------+\n| first_name | varchar(30) | NO | MUL | NULL | |\n| last_name | varchar(40) | NO | | NULL | |\n| position | varchar(25) | NO | | NULL | |\n| home_address | varchar(50) | NO | | NULL | |\n| home_phone | varchar(12) | NO | | NULL | |\n| employee_code | varchar(25) | NO | UNI | NULL | |\n+---------------+-------------+------+-----+---------+-------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-columns/','','https://mariadb.com/kb/en/library/show-columns/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (356,26,'SHOW CONTRIBUTORS','Syntax\n------ \nSHOW CONTRIBUTORS\n \nDescription\n----------- \nThe SHOW CONTRIBUTORS statement displays information about\nthe companies and people who financially contribute to\nMariaDB. For each contributor, it displays Name, Location,\nand Comment values. All columns are encoded as latin1.\n \nIn MariaDB 5.5 this is in somewhat random order, and the\nfeature was deprecated.\n \nIn MariaDB 10.0.5 it was un-deprecated, and since then\ndisplays all members and sponsors of the MariaDB Foundation\nas well as other financial contributors.\n \nExample\n \nSHOW CONTRIBUTORS;\n+---------------------+-------------------------------+-------------------------------------------------------------+\n| Name | Location | Comment |\n+---------------------+-------------------------------+-------------------------------------------------------------+\n| Booking.com | https://www.booking.com | Founding member,\nPlatinum Sponsor of the MariaDB Foundation |\n| Alibaba Cloud | https://www.alibabacloud.com/ | Platinum\nSponsor of the MariaDB Foundation |\n| Tencent Cloud | https://cloud.tencent.com | Platinum\nSponsor of the MariaDB Foundation |\n| Microsoft | https://microsoft.com/ | Platinum Sponsor of\nthe MariaDB Foundation |\n| MariaDB Corporation | https://mariadb.com | Founding\nmember, Platinum Sponsor of the MariaDB Foundation |\n| Visma | https://visma.com | Gold Sponsor of the MariaDB\nFoundation |\n| DBS | https://dbs.com | Gold Sponsor of the MariaDB\nFoundation |\n| IBM | https://www.ibm.com | Gold Sponsor of the MariaDB\nFoundation |\n| Tencent Games | http://game.qq.com/ | Gold Sponsor of the\nMariaDB Foundation |\n| Nexedi | https://www.nexedi.com | Silver Sponsor of the\nMariaDB Foundation |\n| Acronis | https://www.acronis.com | Silver Sponsor of the\nMariaDB Foundation |\n| Verkkokauppa.com | https://www.verkkokauppa.com | Bronze\nSponsor of the MariaDB Foundation |\n| Virtuozzo | https://virtuozzo.com | Bronze Sponsor of the\nMariaDB Foundation |\n| Tencent Game DBA | http://tencentdba.com/about | Bronze\nSponsor of the MariaDB Foundation |\n| Tencent TDSQL | http://tdsql.org | Bronze Sponsor of the\nMariaDB Foundation |\n| Percona | https://www.percona.com/ | Bronze Sponsor of the\nMariaDB Foundation |\n| Google | USA | Sponsoring encryption, parallel replication\nand GTID |\n| Facebook | USA | Sponsoring non-blocking API, LIMIT ROWS\nEXAMINED etc |\n| Ronald Bradford | Brisbane, Australia | EFF contribution\nfor UC2006 Auction |\n| Sheeri Kritzer | Boston, Mass. USA | EFF contribution for\nUC2006 Auction |\n| Mark Shuttleworth | London, UK. | EFF contribution for\nUC2006 Auction |\n+---------------------+-------------------------------+-------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-contributors/','','https://mariadb.com/kb/en/library/show-contributors/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (357,26,'SHOW CREATE DATABASE','Syntax\n------ \nSHOW CREATE {DATABASE | SCHEMA} db_name\n \nDescription\n----------- \nShows the CREATE DATABASE statement that\ncreates the given database. SHOW CREATE SCHEMA is a synonym\nfor SHOW CREATE DATABASE. SHOW CREATE DATABASE quotes\ndatabase names according to the value of the\nsql_quote_show_create server system variable.\n \nExamples\n-------- \nSHOW CREATE DATABASE test;\n+----------+-----------------------------------------------------------------+\n| Database | Create Database |\n+----------+-----------------------------------------------------------------+\n| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER\nSET latin1 */ |\n+----------+-----------------------------------------------------------------+\n \nSHOW CREATE SCHEMA test;\n+----------+-----------------------------------------------------------------+\n| Database | Create Database |\n+----------+-----------------------------------------------------------------+\n| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER\nSET latin1 */ |\n+----------+-----------------------------------------------------------------+\n \nWith sql_quote_show_create off:\n \nSHOW CREATE DATABASE test;\n+----------+---------------------------------------------------------------+\n| Database | Create Database |\n+----------+---------------------------------------------------------------+\n| test | CREATE DATABASE test /*!40100 DEFAULT CHARACTER SET\nlatin1 */ |\n+----------+---------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-create-database/','','https://mariadb.com/kb/en/library/show-create-database/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (358,26,'SHOW CREATE EVENT','Syntax\n------ \nSHOW CREATE EVENT event_name\n \nDescription\n----------- \nThis statement displays the CREATE EVENT\nstatement needed to re-create a given event, as well as the\nSQL_MODE that was used when the trigger has been created and\nthe character set used by the connection.. To find out which\nevents are present, use SHOW EVENTS.\n \nThe output of this statement is unreliably affected by the\nsql_quote_show_create server system variable - see\nhttp://bugs.mysql.com/bug.php?id=12719\n \nThe information_schema.EVENTS table provides similar, but\nmore complete, information.\n \nExamples\n-------- \nSHOW CREATE EVENT test.e_daily\\G\n*************************** 1. row\n***************************\n Event: e_daily\n sql_mode: \n time_zone: SYSTEM\n Create Event: CREATE EVENT `e_daily`\n ON SCHEDULE EVERY 1 DAY\n STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR\n ON COMPLETION NOT PRESERVE\n ENABLE\n COMMENT \'Saves total number of sessions then\n clears the table each day\'\n DO BEGIN\n INSERT INTO site_activity.totals (time, total)\n SELECT CURRENT_TIMESTAMP, COUNT(*) \n FROM site_activity.sessions;\n DELETE FROM site_activity.sessions;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL: https://mariadb.com/kb/en/library/show-create-event/','','https://mariadb.com/kb/en/library/show-create-event/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (359,26,'SHOW CREATE FUNCTION','Syntax\n------ \nSHOW CREATE FUNCTION func_name\n \nDescription\n----------- \nThis statement is similar to \nSHOW CREATE PROCEDURE but for\nstored functions.\n \nThe output of this statement is unreliably affected by the\nsql_quote_show_create server system variable - see\nhttp://bugs.mysql.com/bug.php?id=12719\n \nExample\n \nMariaDB [test]> SHOW CREATE FUNCTION VatCents\\G\n*************************** 1. row\n***************************\n Function: VatCents\n sql_mode: \n Create Function: CREATE DEFINER=`root`@`localhost` FUNCTION\n`VatCents`(price DECIMAL(10,2)) RETURNS int(11)\n DETERMINISTIC\nBEGIN\n DECLARE x INT;\n SET x = price * 114;\n RETURN x;\nEND\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL: https://mariadb.com/kb/en/library/show-create-function/','','https://mariadb.com/kb/en/library/show-create-function/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (360,26,'SHOW CREATE PACKAGE','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nSHOW CREATE PACKAGE [ db_name . ] package_name\n \nDescription\n----------- \nThe SHOW CREATE PACKAGE statement can be used when Oracle\nSQL_MODE is set.\n \nShows the CREATE statement that creates the given package\nspecification.\n \nExamples\n-------- \nSHOW CREATE PACKAGE employee_tools\\G\n*************************** 1. row\n***************************\n Package: employee_tools\n sql_mode:\nPIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER\n Create Package: CREATE DEFINER=\"root\"@\"localhost\"\nPACKAGE \"employee_tools\" AS\n FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);\n PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));\n PROCEDURE raiseSalaryStd(eid INT);\n PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));\nEND\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL: https://mariadb.com/kb/en/library/show-create-package/','','https://mariadb.com/kb/en/library/show-create-package/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (361,26,'SHOW CREATE PACKAGE BODY','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nSHOW CREATE PACKAGE BODY [ db_name . ] package_name\n \nDescription\n----------- \nThe SHOW CREATE PACKAGE BODY statement can be used when\nOracle SQL_MODE is set.\n \nShows the CREATE statement that creates the given package\nbody (i.e. the implementation).\n \nExamples\n-------- \nSHOW CREATE PACKAGE BODY employee_tools\\G\n*************************** 1. row\n***************************\n Package body: employee_tools\n sql_mode:\nPIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER\n Create Package Body: CREATE DEFINER=\"root\"@\"localhost\"\nPACKAGE BODY \"employee_tools\" AS\n \n stdRaiseAmount DECIMAL(10,2):=500;\n \n PROCEDURE log (eid INT, ecmnt TEXT) AS\n BEGIN\n INSERT INTO employee_log (id, cmnt) VALUES (eid, ecmnt);\n END;\n \n PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2)) AS\n eid INT;\n BEGIN\n INSERT INTO employee (name, salary) VALUES (ename,\nesalary);\n eid:= last_insert_id();\n log(eid, \'hire \' || ename);\n END;\n \n FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2) AS\n nSalary DECIMAL(10,2);\n BEGIN\n SELECT salary INTO nSalary FROM employee WHERE id=eid;\n log(eid, \'getSalary id=\' || eid || \' salary=\' ||\nnSalary);\n RETURN nSalary;\n END;\n \n PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2)) AS\n BEGIN\n UPDATE employee SET salary=salary+amount WHERE id=eid;\n log(eid, \'raiseSalary id=\' || eid || \' amount=\' ||\namount);\n END;\n \n PROCEDURE raiseSalaryStd(eid INT) AS\n BEGIN\n raiseSalary(eid, stdRaiseAmount);\n log(eid, \'raiseSalaryStd id=\' || eid);\n END;\n \nBEGIN \n log(0, \'Session \' || connection_id() || \' \' ||\ncurrent_user || \' started\');\nEND\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/show-create-package-body/','','https://mariadb.com/kb/en/library/show-create-package-body/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (362,26,'SHOW CREATE PROCEDURE','Syntax\n------ \nSHOW CREATE PROCEDURE proc_name\n \nDescription\n----------- \nThis statement is a MariaDB extension. It returns the exact\nstring that\ncan be used to re-create the named stored procedure, as well\nas the SQL_MODE that was used when the trigger has been\ncreated and the character set used by the connection.. A\nsimilar\nstatement, SHOW CREATE FUNCTION,\ndisplays information about stored functions.\n \nBoth statements require that you are the owner of the\nroutine or have the SELECT privilege on the mysql.proc\ntable. When neither is true, the statements display NULL for\nthe Create Procedure or Create Function field.\n \nWarning Users with SELECT privileges on mysql.proc or USAGE\nprivileges on *.* can view the text of routines, even when\nthey do not have privileges for the function or procedure\nitself.\n \nThe output of these statements is unreliably affected by the\nsql_quote_show_create server system variable - see\nhttp://bugs.mysql.com/bug.php?id=12719\n \nExamples\n-------- \nHere\'s a comparison of the SHOW CREATE PROCEDURE and SHOW\nCREATE FUNCTION statements.\n \nSHOW CREATE PROCEDURE test.simpleproc\\G\n*************************** 1. row\n***************************\n Procedure: simpleproc\n sql_mode: \n Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1\nINT)\n BEGIN\n SELECT COUNT(*) INTO param1 FROM t;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n \nSHOW CREATE FUNCTION test.hello\\G\n*************************** 1. row\n***************************\n Function: hello\n sql_mode:\n Create Function: CREATE FUNCTION `hello`(s CHAR(20))\n RETURNS CHAR(50)\n RETURN CONCAT(\'Hello, \',s,\'!\')\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n \nWhen the user issuing the statement does not have privileges\non the routine, attempting to CALL the procedure raises\nError 1370.\n \nCALL test.prc1();\nError 1370 (42000): execute command denieed to user\n\'test_user\'@\'localhost\' for routine \'test\'.\'prc1\'\n \nIf the user neither has privilege to the routine nor the\nSELECT privilege on mysql.proc table, it raises Error 1305,\ninforming them that the procedure does not exist.\n \nSHOW CREATE TABLES test.prc1\\G\nError 1305 (42000): PROCEDURE prc1 does not exist\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/show-create-procedure/','','https://mariadb.com/kb/en/library/show-create-procedure/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (363,26,'SHOW CREATE SEQUENCE','Sequences were introduced in MariaDB 10.3.\n \nSyntax\n------ \nSHOW CREATE SEQUENCE sequence_name;\n \nDescription\n----------- \nShows the CREATE SEQUENCE statement that created the given\nsequence. The statement requires the SELECT privilege for\nthe table.\n \nExample\n \nCREATE SEQUENCE s1 START WITH 50;\n \nSHOW CREATE SEQUENCE s1\\G;\n \n*************************** 1. row\n***************************\n Table: t1\nCreate Table: CREATE SEQUENCE `s1` start with 50 minvalue 1\nmaxvalue 9223372036854775806\nincrement by 1 cache 1000 nocycle ENGINE=Aria\n \nNotes\n \nIf you want to see the underlying table structure used for\nthe SEQUENCE\nyou can use SHOW CREATE TABLE on the SEQUENCE. You can also\nuse SELECT to read the current recorded state of the\nSEQUENCE:\n \nCREATE SEQUENCE t1;\n \nSHOW CREATE TABLE s1\\G\n*************************** 1. row\n***************************\n Table: s1\nCreate Table: CREATE TABLE `s1` (\n `next_value` bigint(21) NOT NULL COMMENT \'next not cached\nvalue\',\n `min_value` bigint(21) NOT NULL COMMENT \'min value\',\n `max_value` bigint(21) NOT NULL COMMENT \'max value\',\n `start` bigint(21) NOT NULL COMMENT \'start value\',\n `increment` bigint(21) NOT NULL COMMENT \'increment\nvalue\',\n `cache` bigint(21) NOT NULL COMMENT \'cache size\',\n `cycle` tinyint(1) unsigned NOT NULL COMMENT \'cycle\nstate\',\n `round` bigint(21) NOT NULL COMMENT \'How many cycles has\nbeen done\'\n) ENGINE=Aria SEQUENCE=1\n \nSELECT * FROM s1;\n \n+------------+-----------+---------------------+-------+-----------+-------+-------+-------+\n| next_value | min_value | max_value | start | increment |\ncache | cycle | round |\n+------------+-----------+---------------------+-------+-----------+-------+-------+-------+\n| 1 | 1 | 9223372036854775806 | 1 | 1 | 1000 | 0 | 0 |\n+------------+-----------+---------------------+-------+-----------+-------+-------+-------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-create-sequence/','','https://mariadb.com/kb/en/library/show-create-sequence/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (364,26,'SHOW CREATE TABLE','Syntax\n------ \nSHOW CREATE TABLE tbl_name\n \nDescription\n----------- \nShows the CREATE TABLE statement that created the given\ntable. The statement requires the SELECT privilege for the\ntable. This statement also works with views and SEQUENCE.\n \nSHOW CREATE TABLE quotes table and\ncolumn names according to the value of the\nsql_quote_show_create server system variable.\n \nMariaDB and MySQL-specific table options, column options,\nand index options are not included in the output of this\nstatement if the NO_TABLE_OPTIONS, NO_FIELD_OPTIONS and\nNO_KEY_OPTIONS SQL_MODE flags are used.\n \nInvalid table options, column options and index options are\nnormally commented out (note, that it is possible to create\na table with invalid options, by altering a table of a\ndifferent engine, where these options were valid). To have\nthem uncommented, enable IGNORE_BAD_TABLE_OPTIONS SQL_MODE.\nRemember that replaying a CREATE TABLE statement with\nuncommented invalid options will fail with an error, unless\nIGNORE_BAD_TABLE_OPTIONS SQL_MODE is in effect.\n \nNote that SHOW CREATE TABLE is not meant to provide metadata\nabout a table. It provides information about how the table\nwas declared, but the real table structure could differ a\nbit. For example, if an index has been declared as HASH, the\nCREATE TABLE statement returned by SHOW CREATE TABLE will\ndeclare that index as HASH; however, it is possible that the\nindex is in fact a BTREE, because the storage engine does\nnot support HASH.\n \nMariaDB 10.2.1 permits TEXT and BLOB data types to be\nassigned a DEFAULT value. As a result, from MariaDB 10.2.1,\nSHOW CREATE TABLE will append a DEFAULT NULL to nullable\nTEXT or BLOB fields if no specific default is provided. \n \nFrom MariaDB 10.2.2, numbers are no longer quoted in the\nDEFAULT clause in SHOW CREATE statement. Previously, MariaDB\nquoted numbers. \n \nExamples\n-------- \nSHOW CREATE TABLE t\\G\n*************************** 1. row\n***************************\n Table: t\nCreate Table: CREATE TABLE `t` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `s` char(60) DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n \nWith sql_quote_show_create off:\n \nSHOW CREATE TABLE t\\G\n*************************** 1. row\n***************************\n Table: t\nCreate Table: CREATE TABLE t (\n id int(11) NOT NULL AUTO_INCREMENT,\n s char(60) DEFAULT NULL,\n PRIMARY KEY (id)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n \nUnquoted numeric DEFAULTs, from MariaDB 10.2.2:\n \nCREATE TABLE td (link TINYINT DEFAULT 1);\n \nSHOW CREATE TABLE td\\G\n*************************** 1. row\n***************************\n Table: td\nCreate Table: CREATE TABLE `td` (\n `link` tinyint(4) DEFAULT 1\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n \nQuoted numeric DEFAULTs, until MariaDB 10.2.1:\n \nCREATE TABLE td (link TINYINT DEFAULT 1);\n \nSHOW CREATE TABLE td\\G\n*************************** 1. row\n***************************\n Table: td\nCreate Table: CREATE TABLE `td` (\n `link` tinyint(4) DEFAULT \'1\'\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n \n\n\nURL: https://mariadb.com/kb/en/library/show-create-table/','','https://mariadb.com/kb/en/library/show-create-table/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (365,26,'SHOW CREATE TRIGGER','Syntax\n------ \nSHOW CREATE TRIGGER trigger_name\n \nDescription\n----------- \nThis statement shows a CREATE TRIGGER\nstatement that creates the given trigger, as well as the\nSQL_MODE that was used when the trigger has been created and\nthe character set used by the connection.\n \nThe output of this statement is unreliably affected by the\nsql_quote_show_create server system variable - see\nhttp://bugs.mysql.com/bug.php?id=12719\n \nExamples\n-------- \nSHOW CREATE TRIGGER example\\G\n*************************** 1. row\n***************************\n Trigger: example\n sql_mode:\nONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,STRICT_ALL_TABLES\n,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_\nENGINE_SUBSTITUTION\nSQL Original Statement: CREATE DEFINER=`root`@`localhost`\nTRIGGER example BEFORE\n INSERT ON t FOR EACH ROW\nBEGIN\n SET NEW.c = NEW.c * 2;\nEND\n character_set_client: cp850\n collation_connection: cp850_general_ci\n Database Collation: utf8_general_ci\n Created: 2016-09-29 13:53:34.35\n \nThe Created column was added in MySQL 5.7 and MariaDB 10.2.3\nas part of introducing multiple trigger events per action.\n \n\n\nURL: https://mariadb.com/kb/en/library/show-create-trigger/','','https://mariadb.com/kb/en/library/show-create-trigger/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (366,26,'SHOW CREATE USER','SHOW CREATE USER was introduced in MariaDB 10.2.0\n \nSyntax\n------ \nSHOW CREATE USER user_name\n \nDescription\n----------- \nShows the CREATE USER statement that created the given\nuser. The statement requires the SELECT privilege for the\nmysql database, except for the current user.\n \nExamples\n-------- \nCREATE USER foo4@test require cipher \'text\' \n issuer \'foo_issuer\' subject \'foo_subject\';\n \nSHOW CREATE USER foo4@test\\G\n*************************** 1. row\n***************************\nCREATE USER \'foo4\'@\'test\' \n REQUIRE ISSUER \'foo_issuer\' \n SUBJECT \'foo_subject\' \n CIPHER \'text\'\n \nUser Password Expiry:\n \nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL\n120 DAY;\n \nSHOW CREATE USER \'monty\'@\'localhost\';\n \n+------------------------------------------------------------------+\n| CREATE USER for monty@localhost |\n+------------------------------------------------------------------+\n| CREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE\nINTERVAL 120 DAY |\n+------------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-create-user/','','https://mariadb.com/kb/en/library/show-create-user/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (367,26,'SHOW CREATE VIEW','Syntax\n------ \nSHOW CREATE VIEW view_name\n \nDescription\n----------- \nThis statement shows a CREATE VIEW statement that creates\nthe given view, as well as the character set used by the\nconnection when the view was created. This statement\nalso works with views.\n \nSHOW CREATE VIEW quotes table, column and stored function\nnames according to the value of the sql_quote_show_create\nserver system variable.\n \nExamples\n-------- \nSHOW CREATE VIEW example\\G\n*************************** 1. row\n***************************\n View: example\n Create View: CREATE ALGORITHM=UNDEFINED\nDEFINER=`root`@`localhost` SQL\nSECURITY DEFINER VIEW `example` AS (select `t`.`id` AS\n`id`,`t`.`s` AS `s` from\n`t`)\ncharacter_set_client: cp850\ncollation_connection: cp850_general_ci\n \nWith sql_quote_show_create off:\n \nSHOW CREATE VIEW example\\G\n*************************** 1. row\n***************************\n View: example\n Create View: CREATE ALGORITHM=UNDEFINED\nDEFINER=root@localhost SQL SECU\nRITY DEFINER VIEW example AS (select t.id AS id,t.s AS s\nfrom t)\ncharacter_set_client: cp850\ncollation_connection: cp850_general_ci\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-create-view/','','https://mariadb.com/kb/en/library/show-create-view/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (368,26,'SHOW DATABASES','Syntax\n------ \nSHOW {DATABASES | SCHEMAS}\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nSHOW DATABASES lists the databases on the MariaDB server\nhost.\nSHOW SCHEMAS is a synonym for \nSHOW DATABASES. The LIKE clause, if\npresent on its own, indicates which database names to match.\nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nYou see only those databases for which you have some kind of\nprivilege, unless you have the global \nSHOW DATABASES privilege. You\ncan also get this list using the mysqlshow command.\n \nIf the server was started with the --skip-show-database\noption, you cannot use this statement at all unless you have\nthe\nSHOW DATABASES privilege.\n \nExample\n \nSHOW DATABASES;\n+--------------------+\n| Database |\n+--------------------+\n| information_schema |\n| mysql |\n| performance_schema |\n| test |\n+--------------------+\n \nSHOW DATABASES LIKE \'m%\';\n+---------------+\n| Database (m%) |\n+---------------+\n| mysql |\n+---------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-databases/','','https://mariadb.com/kb/en/library/show-databases/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (369,26,'SHOW ENGINE','Syntax\n------ \nSHOW ENGINE engine_name {STATUS | MUTEX}\n \nDescription\n----------- \nSHOW ENGINE displays operational information about a storage\nengine. The following statements currently are supported:\n \nSHOW ENGINE INNODB STATUS\nSHOW ENGINE INNODB MUTEX\nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\n \nIf the Sphinx Storage Engine is installed, the following is\nalso supported:\n \nSHOW ENGINE SPHINX STATUS\n \nSee SHOW ENGINE SPHINX STATUS.\n \nOlder (and now removed) synonyms were SHOW INNODB STATUS\nfor SHOW ENGINE INNODB STATUS and \nSHOW MUTEX STATUS for \nSHOW ENGINE INNODB MUTEX.\n \nSHOW ENGINE BDB LOGS formerly displayed status information\nabout BDB log files. It was deprecated in MySQL 5.1.12 and\nremoved in MariaDB and MySQL 5.5, so now produces an error.\n \nSHOW ENGINE INNODB STATUS\n \nSHOW ENGINE INNODB STATUS displays extensive information\nfrom the standard InnoDB Monitor about the state of the\nInnoDB storage engine.\nSee SHOW ENGINE INNODB STATUS for more.\n \nSHOW ENGINE INNODB MUTEX\n \nSHOW ENGINE INNODB MUTEX displays InnoDB mutex statistics.\n \nThe statement displays the following output fields:\nType: Always InnoDB.\nName: The source file where the mutex is implemented, and\nthe line number\n in the file where the mutex is created. The line number is\ndependent on the MariaDB version.\nStatus: This field displays the following values if\nUNIV_DEBUG was defined at compilation time (for example, in\ninclude/univ.h in the InnoDB part of the source tree). Only\nthe os_waits value is displayed if UNIV_DEBUG was not\ndefined. Without UNIV_DEBUG, the information on which the\noutput is based is insufficient to distinguish regular\nmutexes and mutexes that protect\n rw-locks (which allow multiple readers or a single writer).\nConsequently, the\n output may appear to contain multiple rows for the same\nmutex.\ncount indicates how many times the mutex was requested.\nspin_waits indicates how many times the spinlock had to run.\nspin_rounds indicates the number of spinlock rounds.\n(spin_rounds divided by\n spin_waits provides the average round count.)\nos_waits indicates the number of operating system waits.\nThis occurs when\n the spinlock did not work (the mutex was not locked during\nthe spinlock and\n it was necessary to yield to the operating system and\nwait).\nos_yields indicates the number of times a the thread trying\nto lock a mutex\n gave up its timeslice and yielded to the operating system\n(on the\n presumption that allowing other threads to run will free\nthe mutex so that\n it can be locked).\nos_wait_times indicates the amount of time (in ms) spent in\noperating system\n waits, if the timed_mutexes system variable is 1 (ON). If\ntimed_mutexes is 0\n (OFF), timing is disabled, so os_wait_times is 0.\ntimed_mutexes is off by\n default.\n \nInformation from this statement can be used to diagnose\nsystem problems. For\nexample, large values of spin_waits and spin_rounds may\nindicate scalability\nproblems.\n \nThe information_schema.INNODB_MUTEXES table provides similar\ninformation.\n \nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\n \nThis statement shows how much memory is used for\nperformance_schema tables and internal buffers.\n \nThe output contains the following fields:\nType: Always performance_schema.\nName: The name of a table, the name of an internal buffer,\nor the performance_schema word, followed by a dot and an\nattribute. Internal buffers names are enclosed by\nparenthesis. performance_schema means that the attribute\nrefers to the whole database (it is a total). \nStatus: The value for the attribute.\n \nThe following attributes are shown, in this order, for all\ntables:\nrow_size: The memory used for an individual record. This\nvalue will never change.\nrow_count: The number of rows in the table or buffer. For\nsome tables, this value depends on a server system variable.\nmemory: For tables and performance_schema, this is the\nresult of row_size * row_count.\n \nFor internal buffers, the attributes are:\ncount\nsize\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-engine/','','https://mariadb.com/kb/en/library/show-engine/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (370,26,'SHOW ENGINE INNODB STATUS','SHOW ENGINE INNODB STATUS is a specific form of the SHOW\nENGINE statement that displays the InnoDB Monitor output,\nwhich is extensive InnoDB information which can be useful in\ndiagnosing problems.\n \nThe following sections are displayed\nStatus: Shows the timestamp, monitor name and the number of\nseconds, or the elapsed time between the current time and\nthe time the InnoDB Monitor output was last displayed. The\nper-second averages are based upon this time.\nBACKGROUND THREAD: srv_master_thread lines show work\nperformed by the main background thread.\nSEMAPHORES: Threads waiting for a semaphore and stats on how\nthe number of times threads have needed a spin or a wait on\na mutex or rw-lock semaphore. If this number of threads is\nlarge, there may be I/O or contention issues. Reducing the\nsize of the innodb_thread_concurrency system variable may\nhelp if contention is related to thread scheduling. Spin\nrounds per wait shows the number of spinlock rounds per OS\nwait for a mutex. \nLATEST FOREIGN KEY ERROR: Only shown if there has been a\nforeign key constraint error, it displays the failed\nstatement and information about the constraint and the\nrelated tables.\nLATEST DETECTED DEADLOCK: Only shown if there has been a\ndeadlock, it displays the transactions involved in the\ndeadlock and the statements being executed, held and\nrequired locked and the transaction rolled back to.\nTRANSACTIONS: The output of this section can help identify\nlock contention, as well as reasons for the deadlocks.\nFILE I/O: InnoDB thread information as well as pending I/O\noperations and I/O performance statistics.\nINSERT BUFFER AND ADAPTIVE HASH INDEX: InnoDB insert buffer\nand adaptive hash index status information, including the\nnumber of each type of operation performed, and adaptive\nhash index performance.\nLOG: InnoDB log information, including current log sequence\nnumber, how far the log has been flushed to disk, the\nposition at which InnoDB last took a checkpoint, pending\nwrites and write performance statistics.\nBUFFER POOL AND MEMORY: Information on buffer pool pages\nread and written, which allows you to see the number of data\nfile I/O operations performed by your queries. See InnoDB\nBuffer Pool for more. Similar information is also available\nfrom the INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS table.\nROW OPERATIONS:Information about the main thread, including\nthe number and performance rate for each type of row\noperation. \n \nIf the innodb_status_output_locks system variable is set to\n1, extended lock information will be displayed.\n \nExample output:\n \n=====================================\n2016-09-12 04:42:15 7f226145fb00 INNODB MONITOR OUTPUT\n=====================================\nPer second averages calculated from the last 29 seconds\n-----------------\nBACKGROUND THREAD\n-----------------\nsrv_master_thread loops: 0 srv_active, 0 srv_shutdown, 527\nsrv_idle\nsrv_master_thread log flush and writes: 527\n----------\nSEMAPHORES\n----------\nOS WAIT ARRAY INFO: reservation count 4\nOS WAIT ARRAY INFO: signal count 4\nMutex spin waits 2, rounds 60, OS waits 2\nRW-shared spins 2, rounds 60, OS waits 2\nRW-excl spins 0, rounds 0, OS waits 0\nSpin rounds per wait: 30.00 mutex, 30.00 RW-shared, 0.00\nRW-excl\n------------\nTRANSACTIONS\n------------\nTrx id counter 2308\nPurge done for trx\'s n:o < 0 undo n:o < 0 state: running\nbut idle\nHistory list length 0\nLIST OF TRANSACTIONS FOR EACH SESSION:\n---TRANSACTION 0, not started\nMySQL thread id 3, OS thread handle 0x7f226145fb00, query id\n4 localhost root init\nSHOW ENGINE INNODB STATUS\n--------\nFILE I/O\n--------\nI/O thread 0 state: waiting for completed aio requests\n(insert buffer thread)\nI/O thread 1 state: waiting for completed aio requests (log\nthread)\nI/O thread 2 state: waiting for completed aio requests (read\nthread)\nI/O thread 3 state: waiting for completed aio requests (read\nthread)\nI/O thread 4 state: waiting for completed aio requests (read\nthread)\nI/O thread 5 state: waiting for completed aio requests (read\nthread)\nI/O thread 6 state: waiting for completed aio requests\n(write thread)\nI/O thread 7 state: waiting for completed aio requests\n(write thread)\nI/O thread 8 state: waiting for completed aio requests\n(write thread)\nI/O thread 9 state: waiting for completed aio requests\n(write thread)\nPending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0,\n0, 0, 0] ,\n ibuf aio reads: 0, log i/o\'s: 0, sync i/o\'s: 0\nPending flushes (fsync) log: 0; buffer pool: 0\n172 OS file reads, 5 OS file writes, 5 OS fsyncs\n0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s\n-------------------------------------\nINSERT BUFFER AND ADAPTIVE HASH INDEX\n-------------------------------------\nIbuf: size 1, free list len 0, seg size 2, 0 merges\nmerged operations:\n insert 0, delete mark 0, delete 0\ndiscarded operations:\n insert 0, delete mark 0, delete 0\n0.00 hash searches/s, 0.00 non-hash searches/s\n---\nLOG\n---\nLog sequence number 1616829\nLog flushed up to 1616829\nPages flushed up to 1616829\nLast checkpoint at 1616829\nMax checkpoint age 80826164\nCheckpoint age target 78300347\nModified age 0\nCheckpoint age 0\n0 pending log writes, 0 pending chkp writes\n8 log i/o\'s done, 0.00 log i/o\'s/second\n----------------------\nBUFFER POOL AND MEMORY\n----------------------\nTotal memory allocated 140771328; in additional pool\nallocated 0\nTotal memory allocated by read views 88\nInternal hash tables (constant factor + variable factor)\n Adaptive hash index 2217568 (2213368 + 4200)\n Page hash 139112 (buffer pool 0 only)\n Dictionary cache 630703 (554768 + 75935)\n File system 817648 (812272 + 5376)\n Lock system 333232 (332872 + 360)\n Recovery system 0 (0 + 0)\nDictionary memory allocated 75935\nBuffer pool size 8191\nBuffer pool size, bytes 134201344\nFree buffers 8037\nDatabase pages 154\nOld database pages 0\nModified db pages 0\nPercent of dirty pages(LRU & free pages): 0.000\nMax dirty pages percent: 75.000\nPending reads 0\nPending writes: LRU 0, flush list 0, single page 0\nPages made young 0, not young 0\n0.00 youngs/s, 0.00 non-youngs/s\nPages read 154, created 0, written 1\n0.00 reads/s, 0.00 creates/s, 0.00 writes/s\nNo buffer pool page gets since the last printout\nPages read ahead 0.00/s, evicted without access 0.00/s,\nRandom read ahead 0.00/s\nLRU len: 154, unzip_LRU len: 0\nI/O sum[0]:cur[0], unzip sum[0]:cur[0]\n--------------\nROW OPERATIONS\n--------------\n0 queries inside InnoDB, 0 queries in queue\n0 read views open inside InnoDB\n0 RW transactions active inside InnoDB\n0 RO transactions active inside InnoDB\n0 out of 1000 descriptors used\nMain thread process no. 3337, id 139784957703936, state:\nsleeping\nNumber of rows inserted 0, updated 0, deleted 0, read 0\n0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s\nNumber of system rows inserted 0, updated 0, deleted 0, read\n0\n0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s\n----------------------------\nEND OF INNODB MONITOR OUTPUT\n============================\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/show-engine-innodb-status/','','https://mariadb.com/kb/en/library/show-engine-innodb-status/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (371,26,'SHOW ENGINES','Syntax\n------ \nSHOW [STORAGE] ENGINES\n \nDescription\n----------- \nSHOW ENGINES displays status information about the server\'s\nstorage engines. This is particularly useful for checking\nwhether a storage\nengine is supported, or to see what the default engine is. \nSHOW TABLE TYPES is a deprecated synonym.\n \nThe information_schema.ENGINES table provides the same\ninformation.\n \nSince storage engines are plugins, different information\nabout them is also shown in the information_schema.PLUGINS\ntable and by the SHOW PLUGINS statement.\n \nNote that both MySQL\'s InnoDB and Percona\'s XtraDB\nreplacement are labeled as InnoDB. However, if XtraDB is in\nuse, it will be specified in the COMMENT field. See XtraDB\nand InnoDB. The same applies to FederatedX.\n \nThe output consists of the following columns:\nEngine indicates the engine\'s name.\nSupport indicates whether the engine is installed, and\nwhether it is the default engine for the current session.\nComment is a brief description.\nTransactions, XA and Savepoints indicate whether\ntransactions, XA transactions and transaction savepoints are\nsupported by the engine.\n \nExamples\n-------- \nSHOW ENGINES\\G\n*************************** 1. row\n***************************\n Engine: InnoDB\n Support: DEFAULT\n Comment: Supports transactions, row-level locking, and\nforeign keys\nTransactions: YES\n XA: YES\n Savepoints: YES\n*************************** 2. row\n***************************\n Engine: CSV\n Support: YES\n Comment: CSV storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 3. row\n***************************\n Engine: MyISAM\n Support: YES\n Comment: MyISAM storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 4. row\n***************************\n Engine: BLACKHOLE\n Support: YES\n Comment: /dev/null storage engine (anything you write to it\ndisappears)\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 5. row\n***************************\n Engine: FEDERATED\n Support: YES\n Comment: FederatedX pluggable storage engine\nTransactions: YES\n XA: NO\n Savepoints: YES\n*************************** 6. row\n***************************\n Engine: MRG_MyISAM\n Support: YES\n Comment: Collection of identical MyISAM tables\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 7. row\n***************************\n Engine: ARCHIVE\n Support: YES\n Comment: Archive storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 8. row\n***************************\n Engine: MEMORY\n Support: YES\n Comment: Hash based, stored in memory, useful for temporary\ntables\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 9. row\n***************************\n Engine: PERFORMANCE_SCHEMA\n Support: YES\n Comment: Performance Schema\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 10. row\n***************************\n Engine: Aria\n Support: YES\n Comment: Crash-safe tables with MyISAM heritage\nTransactions: NO\n XA: NO\n Savepoints: NO\n10 rows in set (0.00 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-engines/','','https://mariadb.com/kb/en/library/show-engines/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (372,26,'SHOW ERRORS','Syntax\n------ \nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW ERRORS [LIMIT row_count OFFSET offset]\nSHOW COUNT(*) ERRORS\n \nDescription\n----------- \nThis statement is similar to SHOW WARNINGS, except that\ninstead of\ndisplaying errors, warnings, and notes, it displays only\nerrors.\n \nThe LIMIT clause has the same syntax as for the\nSELECT statement.\n \nThe SHOW COUNT(*) ERRORS statement displays the number of\nerrors. You can also retrieve this number from the\nerror_count variable.\n \nSHOW COUNT(*) ERRORS;\nSELECT @@error_count;\n \nThe value of error_count might be greater than the number of\nmessages displayed by SHOW WARNINGS if the max_error_count\nsystem variable is set so low that not all messages are\nstored.\n \nFor a list of MariaDB error codes, see MariaDB Error Codes.\n \nExamples\n-------- \nSELECT f();\nERROR 1305 (42000): FUNCTION f does not exist\n \nSHOW COUNT(*) ERRORS;\n \n+-----------------------+\n| @@session.error_count |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSHOW ERRORS;\n \n+-------+------+---------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------+\n| Error | 1305 | FUNCTION f does not exist |\n+-------+------+---------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-errors/','','https://mariadb.com/kb/en/library/show-errors/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (373,26,'SHOW EVENTS','Syntax\n------ \nSHOW EVENTS [{FROM | IN} schema_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nShows information about Event Manager events (created with\nCREATE EVENT). Requires the EVENT privilege. Without any\narguments, SHOW EVENTS lists all of the events in the\ncurrent schema:\n \nSELECT CURRENT_USER(), SCHEMA();\n+----------------+----------+\n| CURRENT_USER() | SCHEMA() |\n+----------------+----------+\n| jon@ghidora | myschema |\n+----------------+----------+\n \nSHOW EVENTS\\G\n*************************** 1. row\n***************************\n Db: myschema\n Name: e_daily\n Definer: jon@ghidora\n Time zone: SYSTEM\n Type: RECURRING\n Execute at: NULL\n Interval value: 10\n Interval field: SECOND\n Starts: 2006-02-09 10:41:23\n Ends: NULL\n Status: ENABLED\n Originator: 0\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n \nTo see the event action, use SHOW CREATE EVENT instead, or\nlook at the information_schema.EVENTS table.\n \nTo see events for a specific schema, use the FROM clause.\nFor example, to see events for the test schema, use the\nfollowing statement:\n \nSHOW EVENTS FROM test;\n \nThe LIKE clause, if present, indicates which event names to\nmatch. The WHERE clause can be given to select rows using\nmore general conditions, as discussed in Extended Show.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-events/','','https://mariadb.com/kb/en/library/show-events/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (374,26,'SHOW EXPLAIN','The SHOW EXPLAIN command is a new feature in MariaDB 10.0.0.\n \nCommand description\n \nThe SHOW EXPLAIN command allows one to get an EXPLAIN (that\nis, a\ndescription of a query plan) of a query running in a certain\nthread.\n \nThe syntax is:\n \nSHOW EXPLAIN FOR ;\n \nwhich will produce an EXPLAIN output for the query that\nthread number thread_id is running. The thread id can be\nobtained with SHOW PROCESSLIST.\n \nSHOW EXPLAIN FOR 1;\n \n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n| id | select_type | table | type | possible_keys | key |\nkey_len | ref | rows | Extra |\n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n| 1 | SIMPLE | tbl | index | NULL | a | 5 | NULL | 1000107 |\nUsing index |\n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n1 row in set, 1 warning (0.00 sec)\n \nThe output is always accompanied with a warning which shows\nthe query the\ntarget thread is running (this shows what the EXPLAIN is\nfor):\n \nSHOW WARNINGS;\n \n+-------+------+------------------------+\n| Level | Code | Message |\n+-------+------+------------------------+\n| Note | 1003 | select sum(a) from tbl |\n+-------+------+------------------------+\n1 row in set (0.00 sec)\n \nPossible errors\n \nThe output can be only produced if the target thread is\ncurrently running a\nquery, which has a ready query plan. If this is not the\ncase, the output will\nbe:\n \nSHOW EXPLAIN FOR 2;\n \nERROR 1932 (HY000): Target is not running an EXPLAINable\ncommand\n \nYou will get this error when:\nthe target thread is not running a command for which one can\nrun EXPLAIN\nthe target thread is running a command for which one can run\nEXPLAIN, but\nthere is no query plan yet (for example, tables are open and\nlocks are\n acquired before the query plan is produced)\n \n\nDifferences between SHOW EXPLAIN and EXPLAIN outputs\n \nBackground\n \nIn MySQL, EXPLAIN execution takes a slightly different route\nfrom the way\nthe real query (typically the SELECT) is optimized. This is\nunfortunate,\nand has caused a number of bugs in EXPLAIN. (For example,\nsee\nMDEV-326, MDEV-410, and\nlp:1013343.\nlp:992942 is not directly\nabout EXPLAIN, but it also would not have existed if MySQL\ndidn\'t try to delete\nparts of a query plan in the middle of the query) \n \nSHOW EXPLAIN examines a running SELECT, and hence its output\nmay be\nslightly different from what EXPLAIN SELECT would produce.\nWe did our best\nto make sure that either the difference is negligible, or\nSHOW EXPLAIN\'s\noutput is closer to reality than EXPLAIN\'s output.\n \nList of recorded differences\n \nSHOW EXPLAIN may have Extra=\'no matching row in const\ntable\', where EXPLAIN would produce Extra=\'Impossible\nWHERE ...\'\nFor queries with subqueries, SHOW EXPLAIN may print\nselect_type==PRIMARY where regular EXPLAIN used to print\nselect_type==SIMPLE, or vice versa.\n \nRequired permissions\n \nRunning SHOW EXPLAIN requires the same permissions as\nrunning SHOW PROCESSLIST would.\n \n\n\nURL: https://mariadb.com/kb/en/library/show-explain/','','https://mariadb.com/kb/en/library/show-explain/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (375,26,'SHOW FUNCTION CODE','Syntax\n------ \nSHOW FUNCTION CODE func_name\n \nDescription\n----------- \nSHOW FUNCTION CODE shows a representation of the internal\nimplementation of the stored function.\n \nIt is similar to SHOW PROCEDURE CODE but for stored\nfunctions.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-function-code/','','https://mariadb.com/kb/en/library/show-function-code/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (376,26,'SHOW FUNCTION STATUS','Syntax\n------ \nSHOW FUNCTION STATUS\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThis statement is similar to \nSHOW PROCEDURE STATUS but for\nstored functions.\n \nThe LIKE clause, if present on its own, indicates which\nfunction names to match. \n \nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nThe information_schema.ROUTINES table contains more detailed\ninformation.\n \nExamples\n-------- \nShowing all stored functions:\n \nSHOW FUNCTION STATUS\\G\n*************************** 1. row\n***************************\n Db: test\n Name: VatCents\n Type: FUNCTION\n Definer: root@localhost\n Modified: 2013-06-01 12:40:31\n Created: 2013-06-01 12:40:31\n Security_type: DEFINER\n Comment: \ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \nStored functions whose name starts with \'V\': \n \nSHOW FUNCTION STATUS LIKE \'V%\' \\G\n*************************** 1. row\n***************************\n Db: test\n Name: VatCents\n Type: FUNCTION\n Definer: root@localhost\n Modified: 2013-06-01 12:40:31\n Created: 2013-06-01 12:40:31\n Security_type: DEFINER\n Comment: \ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \nStored functions with a security type of \'DEFINER\':\n \nSHOW FUNCTION STATUS WHERE Security_type LIKE \'DEFINER\'\n\\G\n*************************** 1. row\n***************************\n Db: test\n Name: VatCents\n Type: FUNCTION\n Definer: root@localhost\n Modified: 2013-06-01 12:40:31\n Created: 2013-06-01 12:40:31\n Security_type: DEFINER\n Comment: \ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-function-status/','','https://mariadb.com/kb/en/library/show-function-status/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (377,26,'SHOW GRANTS','Users\n \nSyntax\n------ \nSHOW GRANTS [FOR user]\n \nDescription\n----------- \nThis statement lists the GRANT statement or\nstatements that must be issued to duplicate the privileges\nthat are granted to\na MariaDB user account. The account is named using the same\nformat as for the\nGRANT statement; for example,\n\'jeffrey\'@\'localhost\'. If you specify only the user name\npart\nof the account name, a host name part of \'%\' is used. For\nadditional information about specifying account names, see\nGRANT.\n \nSHOW GRANTS FOR \'root\'@\'localhost\';\n+---------------------------------------------------------------------+\n| Grants for root@localhost |\n+---------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH\nGRANT OPTION |\n+---------------------------------------------------------------------+\n \nTo list the privileges granted to the account that you are\nusing to\nconnect to the server, you can use any of the following\nstatements:\n \nSHOW GRANTS;\n \nSHOW GRANTS FOR CURRENT_USER;\n \nSHOW GRANTS FOR CURRENT_USER();\n \nIf SHOW GRANTS FOR CURRENT_USER (or any\nof the equivalent syntaxes) is used in DEFINER context (such\nas within a stored procedure that is defined with \n SQL SECURITY DEFINER), the grants displayed are those of\nthe\ndefiner and not the invoker.\n \nNote that the DELETE HISTORY privilege, introduced in\nMariaDB 10.3.4, is displayed as DELETE VERSIONING ROWS when\nrunning SHOW GRANTS (MDEV-17655).\n \nRoles\n \nRoles were introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nSHOW GRANTS [FOR role]\n \nDescription\n----------- \nFrom MariaDB 10.0.5, SHOW GRANTS can also be used to view\nthe privileges granted to a role.\n \nExample\n \nSHOW GRANTS FOR journalist;\n+------------------------------------------+\n| Grants for journalist |\n+------------------------------------------+\n| GRANT USAGE ON *.* TO \'journalist\' |\n| GRANT DELETE ON `test`.* TO \'journalist\' |\n+------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-grants/','','https://mariadb.com/kb/en/library/show-grants/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (378,26,'SHOW INDEX','Syntax\n------ \nSHOW {INDEX | INDEXES | KEYS} \n FROM tbl_name [FROM db_name]\n [WHERE expr]\n \nDescription\n----------- \nSHOW INDEX returns table index information. The format\nresembles that of the SQLStatistics call in ODBC.\n \nYou can use db_name.tbl_name as an alternative to the\n tbl_name FROM db_name syntax. These two statements are\n equivalent:\n \nSHOW INDEX FROM mytable FROM mydb;\nSHOW INDEX FROM mydb.mytable;\n \nSHOW KEYS and SHOW INDEXES are synonyms for SHOW INDEX.\n \nYou can also list a table\'s indexes with the following\ncommand: \n \nmysqlshow -k db_name tbl_name\n \nSee mysqlshow for more details.\n \nThe information_schema.STATISTICS table stores similar\ninformation.\n \nThe following fields are returned by SHOW INDEX.\n \nField | Description | \n \nTable | Table name | \n \nNon_unique | 1 if the index permits duplicate values, 0 if\nvalues must be unique. | \n \nKey_name | Index name. The primary key is always named\nPRIMARY. | \n \nSeq_in_index | The column\'s sequence in the index,\nbeginning with 1. | \n \nColumn_name | Column name. | \n \nCollation | Either A, if the column is sorted in ascending\norder in the index, or NULL if it\'s not sorted. | \n \nCardinality | Estimated number of unique values in the\nindex. The cardinality statistics are calculated at various\ntimes, and can help the optimizer make improved decisions. |\n\n \nSub_part | NULL if the entire column is included in the\nindex, or the number of included characters if not. | \n \nPacked | NULL if the index is not packed, otherwise how the\nindex is packed. | \n \nNull | NULL if NULL values are permitted in the column, an\nempty string if NULL\'s are not permitted. | \n \nIndex_type | The index type, which can be BTREE, FULLTEXT,\nHASH or RTREE. See Storage Engine Index Types. | \n \nComment | Other information, such as whether the index is\ndisabled. | \n \nIndex_comment | Contents of the COMMENT attribute when the\nindex was created. | \n \nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nExamples\n-------- \nCREATE TABLE IF NOT EXISTS `employees_example` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `first_name` varchar(30) NOT NULL,\n `last_name` varchar(40) NOT NULL,\n `position` varchar(25) NOT NULL,\n `home_address` varchar(50) NOT NULL,\n `home_phone` varchar(12) NOT NULL,\n `employee_code` varchar(25) NOT NULL,\n PRIMARY KEY (`id`),\n UNIQUE KEY `employee_code` (`employee_code`),\n KEY `first_name` (`first_name`,`last_name`)\n) ENGINE=Aria;\n \nINSERT INTO `employees_example` (`first_name`, `last_name`,\n`position`, `home_address`, `home_phone`, `employee_code`)\n VALUES\n (\'Mustapha\', \'Mond\', \'Chief Executive Officer\', \'692\nPromiscuous Plaza\', \'326-555-3492\', \'MM1\'),\n (\'Henry\', \'Foster\', \'Store Manager\', \'314 Savage\nCircle\', \'326-555-3847\', \'HF1\'),\n (\'Bernard\', \'Marx\', \'Cashier\', \'1240 Ambient\nAvenue\', \'326-555-8456\', \'BM1\'),\n (\'Lenina\', \'Crowne\', \'Cashier\', \'281 Bumblepuppy\nBoulevard\', \'328-555-2349\', \'LC1\'),\n (\'Fanny\', \'Crowne\', \'Restocker\', \'1023 Bokanovsky\nLane\', \'326-555-6329\', \'FC1\'),\n (\'Helmholtz\', \'Watson\', \'Janitor\', \'944 Soma\nCourt\', \'329-555-2478\', \'HW1\');\n \nSHOW INDEXES FROM employees_example;\n \n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n| Table | Non_unique | Key_name | Seq_in_index | Column_name\n| Collation | Cardinality | Sub_part | Packed | Null |\nIndex_type | Comment | Index_comment |\n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n| employees_example | 0 | PRIMARY | 1 | id | A | 7 | NULL |\nNULL | | BTREE | | |\n| employees_example | 0 | employee_code | 1 | employee_code\n| A | 7 | NULL | NULL | | BTREE | | |\n| employees_example | 1 | first_name | 1 | first_name | A |\nNULL | NULL | NULL | | BTREE | | |\n| employees_example | 1 | first_name | 2 | last_name | A |\nNULL | NULL | NULL | | BTREE | | |\n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-index/','','https://mariadb.com/kb/en/library/show-index/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (379,26,'SHOW LOCALES','SHOW LOCALES was introduced as part of the Information\nSchema plugin extension in MariaDB 10.1.1.\n \nSHOW LOCALES is used to return locales information as part\nof the Locales plugin. While the information_schema.LOCALES\ntable has 8 columns, the SHOW LOCALES statement will only\ndisplay 4 of them:\n \nExample\n \nSHOW LOCALES;\n+-----+-------+-------------------------------------+------------------------+\n| Id | Name | Description | Error_Message_Language |\n+-----+-------+-------------------------------------+------------------------+\n| 0 | en_US | English - United States | english |\n| 1 | en_GB | English - United Kingdom | english |\n| 2 | ja_JP | Japanese - Japan | japanese |\n| 3 | sv_SE | Swedish - Sweden | swedish |\n...\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-locales/','','https://mariadb.com/kb/en/library/show-locales/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (380,26,'SHOW MASTER STATUS','Syntax\n------ \nSHOW MASTER STATUS\n \nDescription\n----------- \nProvides status information about the binary log files of\nthe master.\n \nThis statement requires the SUPER or the REPLICATION_CLIENT\nprivilege.\n \nTo see information about the current GTIDs in the binary\nlog, use the\ngtid_binlog_pos variable.\n \nExample\n \nSHOW MASTER STATUS;\n+--------------------+----------+--------------+------------------+\n| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |\n+--------------------+----------+--------------+------------------+\n| mariadb-bin.000016 | 475 | | |\n+--------------------+----------+--------------+------------------+\nSELECT @@global.gtid_binlog_pos;\n+--------------------------+\n| @@global.gtid_binlog_pos |\n+--------------------------+\n| 0-1-2 |\n+--------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-master-status/','','https://mariadb.com/kb/en/library/show-master-status/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (381,26,'SHOW OPEN TABLES','Syntax\n------ \nSHOW OPEN TABLES [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \n SHOW OPEN TABLES lists the non-TEMPORARY\ntables that are currently open in the table cache. See\nhttp://dev.mysql.com/doc/refman/5.1/en/table-cache.html.\n \nThe FROM and LIKE clauses may be used.\n \nThe FROM\nclause, if present, restricts the tables shown to those\npresent in the\ndb_name database. \n \nThe LIKE clause, if\npresent on its own, indicates which table names to match.\nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nThe following information is returned:\n \nColumn | Description | \n \nDatabase | Database name. | \n \nName | Table name. | \n \nIn_use | Number of table instances being used. | \n \nName_locked | 1 if the table is name-locked, e.g. if it is\nbeing dropped or renamed, otherwise 0. | \n \nBefore MariaDB 5.5, each use of, for example, LOCK TABLE ...\nWRITE would increment In_use for that table. With the\nimplementation of the metadata locking improvements in\nMariaDB 5.5, LOCK TABLE... WRITE acquires a strong MDL lock,\nand concurrent connections will wait on this MDL lock, so\nany subsequent LOCK TABLE... WRITE will not increment\nIn_use.\n \nExample\n \nSHOW OPEN TABLES;\n \n+----------+---------------------------+--------+-------------+\n| Database | Table | In_use | Name_locked |\n+----------+---------------------------+--------+-------------+\n...\n| test | xjson | 0 | 0 |\n| test | jauthor | 0 | 0 |\n| test | locks | 1 | 0 |\n...\n+----------+---------------------------+--------+-------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-open-tables/','','https://mariadb.com/kb/en/library/show-open-tables/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (382,26,'SHOW PACKAGE BODY STATUS','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nSHOW PACKAGE BODY STATUS\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThe SHOW PACKAGE BODY STATUS statement returns\ncharacteristics of stored package bodies (implementations),\nsuch as the database, name, type, creator, creation and\nmodification dates, and character set information. A similar\nstatement, SHOW PACKAGE STATUS, displays information about\nstored package specifications.\n \nThe LIKE clause, if present, indicates which package names\nto match. The WHERE and LIKE clauses can be given to select\nrows using more general conditions, as discussed in Extended\nSHOW.\n \nThe ROUTINES table in the INFORMATION_SCHEMA database\ncontains more detailed information.\n \nExamples\n-------- \nSHOW PACKAGE BODY STATUS LIKE \'pkg1\'\\G\n*************************** 1. row\n***************************\n Db: test\n Name: pkg1\n Type: PACKAGE BODY\n Definer: root@localhost\n Modified: 2018-02-27 14:44:14\n Created: 2018-02-27 14:44:14\n Security_type: DEFINER\n Comment: This is my first package body\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/show-package-body-status/','','https://mariadb.com/kb/en/library/show-package-body-status/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (383,26,'SHOW PACKAGE STATUS','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nSHOW PACKAGE STATUS\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThe SHOW PACKAGE STATUS statement returns characteristics of\nstored package specifications, such as the database, name,\ntype, creator, creation and modification dates, and\ncharacter set information. A similar statement, SHOW PACKAGE\nBODY STATUS, displays information about stored package\nbodies (i.e. implementations).\n \nThe LIKE clause, if present, indicates which package names\nto match. The WHERE and LIKE clauses can be given to select\nrows using more general conditions, as discussed in Extended\nSHOW.\n \nThe ROUTINES table in the INFORMATION_SCHEMA database\ncontains more detailed information.\n \nExamples\n-------- \nSHOW PACKAGE STATUS LIKE \'pkg1\'\\G\n*************************** 1. row\n***************************\n Db: test\n Name: pkg1\n Type: PACKAGE\n Definer: root@localhost\n Modified: 2018-02-27 14:38:15\n Created: 2018-02-27 14:38:15\n Security_type: DEFINER\n Comment: This is my first package\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL: https://mariadb.com/kb/en/library/show-package-status/','','https://mariadb.com/kb/en/library/show-package-status/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (384,26,'SHOW PLUGINS','Syntax\n------ \nSHOW PLUGINS;\n \nDescription\n----------- \n SHOW PLUGINS displays information about installed plugins.\nThe Library column indicates the plugin library - if it is\nNULL, the plugin is built-in and cannot be uninstalled.\n \nThe PLUGINS table in the information_schema database\ncontains more detailed information.\n \nFor specific information about storage engines (a particular\ntype of plugin), see the information_schema.ENGINES table\nand the SHOW ENGINES statement.\n \nExamples\n-------- \nSHOW PLUGINS;\n+----------------------------+----------+--------------------+-------------+---------+\n| Name | Status | Type | Library | License |\n+----------------------------+----------+--------------------+-------------+---------+\n| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| mysql_native_password | ACTIVE | AUTHENTICATION | NULL |\nGPL |\n| mysql_old_password | ACTIVE | AUTHENTICATION | NULL | GPL\n|\n| MRG_MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| FEDERATED | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL\n|\n| Aria | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |\n...\n| INNODB_SYS_FOREIGN | ACTIVE | INFORMATION SCHEMA | NULL |\nGPL |\n| INNODB_SYS_FOREIGN_COLS | ACTIVE | INFORMATION SCHEMA |\nNULL | GPL |\n| SPHINX | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| FEEDBACK | DISABLED | INFORMATION SCHEMA | NULL | GPL |\n| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |\n| pam | ACTIVE | AUTHENTICATION | auth_pam.so | GPL |\n+----------------------------+----------+--------------------+-------------+---------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-plugins/','','https://mariadb.com/kb/en/library/show-plugins/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (385,26,'SHOW PLUGINS SONAME','MariaDB 10.0.2\n \nSHOW PLUGINS SONAME was introduced in MariaDB 10.0.2\n \nSyntax\n------ \nSHOW PLUGINS SONAME { library | LIKE \'pattern\' | WHERE\nexpr };\n \nDescription\n----------- \nSHOW PLUGINS SONAME displays information about compiled-in\nand all server plugins in the plugin_dir directory,\nincluding plugins that haven\'t been installed.\n \nExamples\n-------- \nSHOW PLUGINS SONAME \'ha_example.so\';\n+----------+---------------+----------------+---------------+---------+\n| Name | Status | Type | Library | License |\n+----------+---------------+----------------+---------------+---------+\n| EXAMPLE | NOT INSTALLED | STORAGE ENGINE | ha_example.so |\nGPL |\n| UNUSABLE | NOT INSTALLED | DAEMON | ha_example.so | GPL |\n+----------+---------------+----------------+---------------+---------+\n \nThere is also a corresponding information_schema table,\ncalled ALL_PLUGINS, which contains more complete\ninformation.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-plugins-soname/','','https://mariadb.com/kb/en/library/show-plugins-soname/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (386,26,'SHOW PRIVILEGES','Syntax\n------ \nSHOW PRIVILEGES\n \nDescription\n----------- \n SHOW PRIVILEGES shows the list of system privileges that\nthe MariaDB server supports. The exact list of privileges\ndepends on the version of your server.\n \nExamples\n-------- \nSHOW PRIVILEGES;\n+-------------------------+---------------------------------------+-------------------------------------------------------+\n| Privilege | Context | Comment |\n+-------------------------+---------------------------------------+-------------------------------------------------------+\n| Alter | Tables | To alter the table |\n| Alter routine | Functions,Procedures | To alter or drop\nstored functions/procedures |\n| Create | Databases,Tables,Indexes | To create new\ndatabases and tables |\n| Create routine | Databases | To use CREATE\nFUNCTION/PROCEDURE |\n| Create temporary tables | Databases | To use CREATE\nTEMPORARY TABLE |\n| Create view | Tables | To create new views |\n| Create user | Server Admin | To create new users |\n| Delete | Tables | To delete existing rows |\n| Drop | Databases,Tables | To drop databases, tables, and\nviews |\n| Event | Server Admin | To create, alter, drop and execute\nevents |\n| Execute | Functions,Procedures | To execute stored\nroutines |\n| File | File access on server | To read and write files on\nthe server |\n| Grant option | Databases,Tables,Functions,Procedures | To\ngive to other users those privileges you possess |\n| Index | Tables | To create or drop indexes |\n| Insert | Tables | To insert data into tables |\n| Lock tables | Databases | To use LOCK TABLES (together\nwith SELECT privilege) |\n| Process | Server Admin | To view the plain text of\ncurrently executing queries |\n| Proxy | Server Admin | To make proxy user possible |\n| References | Databases,Tables | To have references on\ntables |\n| Reload | Server Admin | To reload or refresh tables, logs\nand privileges |\n| Replication client | Server Admin | To ask where the slave\nor master servers are |\n| Replication slave | Server Admin | To read binary log\nevents from the master |\n| Select | Tables | To retrieve rows from table |\n| Show databases | Server Admin | To see all databases with\nSHOW DATABASES |\n| Show view | Tables | To see views with SHOW CREATE VIEW |\n| Shutdown | Server Admin | To shut down the server |\n| Super | Server Admin | To use KILL thread, SET GLOBAL,\nCHANGE MASTER, etc. |\n| Trigger | Tables | To use triggers |\n| Create tablespace | Server Admin | To create/alter/drop\ntablespaces |\n| Update | Tables | To update existing rows |\n| Usage | Server Admin | No privileges - allow connect only\n|\n+-------------------------+---------------------------------------+-------------------------------------------------------+\n31 rows in set (0.07 sec)\n \n\n\nURL: https://mariadb.com/kb/en/library/show-privileges/','','https://mariadb.com/kb/en/library/show-privileges/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (387,26,'SHOW PROCEDURE CODE','Syntax\n------ \nSHOW PROCEDURE CODE proc_name\n \nDescription\n----------- \nThis statement is a MariaDB extension that is available only\nfor servers that\nhave been built with debugging support. It displays a\nrepresentation of the\ninternal implementation of the named stored procedure. A\nsimilar statement,\n SHOW FUNCTION CODE, displays\ninformation about stored functions.\n \nBoth statements require that you be the owner of the routine\nor have\n SELECT access to the mysql.proc table.\n \nIf the named routine is available, each statement produces a\nresult\nset. Each row in the result set corresponds to one\n\"instruction\" in\nthe routine. The first column is Pos, which is an ordinal\nnumber\nbeginning with 0. The second column is Instruction, which\ncontains an\nSQL statement (usually changed from the original source), or\na\ndirective which has meaning only to the stored-routine\nhandler.\n \nExamples\n-------- \nDELIMITER //\n \nCREATE PROCEDURE p1 ()\n BEGIN\n DECLARE fanta INT DEFAULT 55;\n DROP TABLE t2;\n LOOP\n INSERT INTO t3 VALUES (fanta);\n END LOOP;\n END//\nQuery OK, 0 rows affected (0.00 sec)\n \nSHOW PROCEDURE CODE p1//\n+-----+----------------------------------------+\n| Pos | Instruction |\n+-----+----------------------------------------+\n| 0 | set fanta@0 55 |\n| 1 | stmt 9 \"DROP TABLE t2\" |\n| 2 | stmt 5 \"INSERT INTO t3 VALUES (fanta)\" |\n| 3 | jump 2 |\n+-----+----------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-procedure-code/','','https://mariadb.com/kb/en/library/show-procedure-code/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (388,26,'SHOW PROCEDURE STATUS','Syntax\n------ \nSHOW PROCEDURE STATUS\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nThis statement is a MariaDB extension. It returns\ncharacteristics of a stored\nprocedure, such as the database, name, type, creator,\ncreation and modification\ndates, and character set information. A similar statement, \n SHOW FUNCTION STATUS, displays\ninformation about stored functions.\n \nThe LIKE clause, if present, indicates which procedure or\nfunction names to match. The WHERE and LIKE clauses can be\ngiven to select rows using more general conditions, as\ndiscussed in Extended SHOW.\n \nThe ROUTINES table in the INFORMATION_SCHEMA database\ncontains more detailed information.\n \nExamples\n-------- \nSHOW PROCEDURE STATUS LIKE \'p1\'\\G\n*************************** 1. row\n***************************\n Db: test\n Name: p1\n Type: PROCEDURE\n Definer: root@localhost\n Modified: 2010-08-23 13:23:03\n Created: 2010-08-23 13:23:03\n Security_type: DEFINER\n Comment: \ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/show-procedure-status/','','https://mariadb.com/kb/en/library/show-procedure-status/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (389,26,'SHOW PROCESSLIST','Syntax\n------ \nSHOW [FULL] PROCESSLIST\n \nDescription\n----------- \n SHOW PROCESSLIST shows you which threads are running. You\ncan also get this information from the\ninformation_schema.PROCESSLIST table or the mysqladmin\nprocesslist command. If you have the \nPROCESS privilege, you can see all threads.\nOtherwise, you can see only your own threads (that is,\nthreads associated with\nthe MariaDB account that you are using). If you do not use\nthe\nFULL keyword, only the first 100 characters of each\nstatement are shown in the Info field.\n \nThe columns shown in SHOW PROCESSLIST\n are:\n \nName | Description | Introduced | \n \nID | The client\'s process ID. | | \n \nUSER | The username associated with the process. | | \n \nHOST | The host the client is connected to. | | \n \nDB | The default database of the process (NULL if no\ndefault). | | \n \nCOMMAND | The command type. See Thread Command Values. | | \n \nTIME | The amount of time, in seconds, the process has been\nin its current state. For a slave SQL thread before MariaDB\n10.1, this is the time in seconds between the last\nreplicated event\'s timestamp and the slave machine\'s real\ntime. | | \n \nSTATE | See Thread States. | | \n \nINFO | The statement being executed. | | \n \nPROGRESS | The total progress of the process (0-100%) (see\nProgress Reporting). | MariaDB 5.3 | \n \nSee TIME_MS column in information_schema.PROCESSLIST for\ndifferences in the TIME column between MariaDB and MySQL.\n \nThe information_schema.PROCESSLIST table contains the\nfollowing additional columns:\n \nName | Description | Introduced | \n \nTIME_MS | The amount of time, in milliseconds, the process\nhas been in its current state. | MariaDB 5.1 | \n \nSTAGE | The stage the process is currently in. |\nMariaDB 5.3 | \n \nMAX_STAGE | The maximum number of stages. | MariaDB 5.3 | \n \nPROGRESS | The progress of the process within the current\nstage (0-100%). | MariaDB 5.3 | \n \nMEMORY_USED | The amount of memory used by the process. |\nMariaDB 10.0.1 | \n \nEXAMINED_ROWS | The number of rows the process has examined.\n| MariaDB 10.0.1 | \n \nQUERY_ID | Query ID. | MariaDB 10.0.5 | \n \nNote that the PROGRESS field from the information schema,\nand the PROGRESS field from SHOW PROCESSLIST display\ndifferent results. SHOW PROCESSLIST shows the total\nprogress, while the information schema shows the progress\nfor the current stage only.\n \nThreads can be killed using their thread_id, or, since\nMariaDB 10.0.5, their query_id, with the KILL statement.\n \nSince queries on this table are locking, if the\nperformance_schema is enabled, you may want to query the\nTHREADS table instead.\n \nExamples\n-------- \nFrom MariaDB 5.1.x\n \nSHOW FULL PROCESSLIST;\n+---------+-------+-----------+------+---------+------+-------+-----------------------+\n| Id | User | Host | db | Command | Time | State | Info |\n+---------+-------+-----------+------+---------+------+-------+-----------------------+\n| 1988880 | dbart | localhost | NULL | Query | 0 | NULL |\nSHOW FULL PROCESSLIST |\n+---------+-------+-----------+------+---------+------+-------+-----------------------+\n \nSELECT * FROM information_schema.processlist;\n+---------+-------+-----------+------+---------+------+-----------+----------------------------------------------+---------+\n| ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO |\nTIME_MS |\n+---------+-------+-----------+------+---------+------+-----------+----------------------------------------------+---------+\n| 1988880 | dbart | localhost | NULL | Query | 0 | executing\n| SELECT * FROM information_schema.processlist | 0.444 |\n+---------+-------+-----------+------+---------+------+-----------+----------------------------------------------+---------+\n \nFrom MariaDB 5.5.x\n \nSHOW FULL PROCESSLIST;\n+-----+------+-----------+------+---------+------+-------+-----------------------+----------+\n| Id | User | Host | db | Command | Time | State | Info |\nProgress |\n+-----+------+-----------+------+---------+------+-------+-----------------------+----------+\n| 126 | root | localhost | NULL | Query | 0 | NULL | SHOW\nFULL PROCESSLIST | 0.000 |\n+-----+------+-----------+------+---------+------+-------+-----------------------+----------+\n \nSELECT * FROM information_schema.processlist;\n+-----+--------+-----------+------+---------+------+-----------+----------------------------------------------+---------+-------+-----------+----------+\n| ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO |\nTIME_MS | STAGE | MAX_STAGE | PROGRESS |\n+-----+--------+-----------+------+---------+------+-----------+----------------------------------------------+---------+-------+-----------+----------+\n| 126 | root | localhost | NULL | Query | 0 | executing |\nSELECT * FROM information_schema.processlist | 344.718 | 0 |\n0 | 0.000 |\n+-----+--------+-----------+------+---------+------+-----------+----------------------------------------------+---------+-------+-----------+----------+\n \nFrom MariaDB 10.0.x\n \nSHOW PROCESSLIST;\n+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+\n| Id | User | Host | db | Command | Time | State | Info |\nProgress |\n+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+\n| 2 | event_scheduler | localhost | NULL | Daemon | 2693 |\nWaiting on empty queue | NULL | 0.000 |\n| 4 | root | localhost | NULL | Query | 0 | Table lock |\nSHOW PROCESSLIST | 0.000 |\n+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-processlist/','','https://mariadb.com/kb/en/library/show-processlist/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (390,26,'SHOW PROFILE','Syntax\n------ \nSHOW PROFILE [type [, type] ... ]\n [FOR QUERY n]\n [LIMIT row_count [OFFSET offset]]\n \ntype:\n ALL\n | BLOCK IO\n | CONTEXT SWITCHES\n | CPU\n | IPC\n | MEMORY\n | PAGE FAULTS\n | SOURCE\n | SWAPS\n \nDescription\n----------- \nThe SHOW PROFILE and \nSHOW PROFILES statements display profiling\ninformation that indicates resource usage for statements\nexecuted during the\ncourse of the current session.\n \nProfiling is controlled by the profiling session variable,\nwhich has a default value of 0 (OFF). Profiling is enabled\nby setting profiling to 1 or ON:\n \nSET profiling = 1;\n \nSHOW PROFILES displays a list of the most recent statements\nsent to the master. The size of the list is controlled by\nthe\nprofiling_history_size session variable, which has a default\nvalue of 15. The maximum value is 100. Setting the value to\n0 has the practical effect of disabling profiling.\n \nAll statements are profiled except SHOW PROFILES and \nSHOW PROFILE, so you will find neither of those statements\nin the profile list. Malformed statements are profiled. For\nexample, \n SHOW PROFILING is an illegal statement, and a syntax error\noccurs if you try to execute it, but it will show up in the\nprofiling list.\n \n SHOW PROFILE displays detailed information about a single\nstatement. Without the FOR QUERY n clause, the output\npertains to the most recently executed statement. If \n FOR QUERY n is included,\n SHOW PROFILE displays information for statement n. The\nvalues of n correspond to\nthe Query_ID values displayed by SHOW PROFILES.\n \nThe LIMIT row_count clause may be given to limit the\noutput to row_count rows. If LIMIT is given, \n OFFSET offset may be added to begin the output offset\nrows into the full set of rows.\n \nBy default, SHOW PROFILE displays Status and Duration\ncolumns. The Status values are like the State values\ndisplayed by \nSHOW PROCESSLIST,\nalthough there might be some minor differences in\ninterpretation for\nthe two statements for some status values (see\nhttp://dev.mysql.com/doc/refman/5.6/en/thread-information.html).\n \nOptional type values may be specified to display specific\nadditional\ntypes of information:\nALL displays all information\nBLOCK IO displays counts for block input and output\noperations\nCONTEXT SWITCHES displays counts for voluntary and\ninvoluntary context switches\nCPU displays user and system CPU usage times\nIPC displays counts for messages sent and received\nMEMORY is not currently implemented\nPAGE FAULTS displays counts for major and minor page faults\nSOURCE displays the names of functions from the source code,\ntogether with the name and line number of the file in which\nthe function occurs\nSWAPS displays swap counts\n \nProfiling is enabled per session. When a session ends, its\nprofiling information is lost.\n \nThe information_schema.PROFILING table contains similar\ninformation.\n \nExamples\n-------- \nSELECT @@profiling;\n+-------------+\n| @@profiling |\n+-------------+\n| 0 |\n+-------------+\n \nSET profiling = 1;\n \nUSE test;\n \nDROP TABLE IF EXISTS t1;\n \nCREATE TABLE T1 (id INT);\n \nSHOW PROFILES;\n+----------+------------+--------------------------+\n| Query_ID | Duration | Query |\n+----------+------------+--------------------------+\n| 1 | 0.00009200 | SELECT DATABASE() |\n| 2 | 0.00023800 | show databases |\n| 3 | 0.00018900 | show tables |\n| 4 | 0.00014700 | DROP TABLE IF EXISTS t1 |\n| 5 | 0.24476900 | CREATE TABLE T1 (id INT) |\n+----------+------------+--------------------------+\n \nSHOW PROFILE;\n+----------------------+----------+\n| Status | Duration |\n+----------------------+----------+\n| starting | 0.000042 |\n| checking permissions | 0.000044 |\n| creating table | 0.244645 |\n| After create | 0.000013 |\n| query end | 0.000003 |\n| freeing items | 0.000016 |\n| logging slow query | 0.000003 |\n| cleaning up | 0.000003 |\n+----------------------+----------+\n \nSHOW PROFILE FOR QUERY 4;\n+--------------------+----------+\n| Status | Duration |\n+--------------------+----------+\n| starting | 0.000126 |\n| query end | 0.000004 |\n| freeing items | 0.000012 |\n| logging slow query | 0.000003 |\n| cleaning up | 0.000002 |\n+--------------------+----------+\n \nSHOW PROFILE CPU FOR QUERY 5;\n+----------------------+----------+----------+------------+\n| Status | Duration | CPU_user | CPU_system |\n+----------------------+----------+----------+------------+\n| starting | 0.000042 | 0.000000 | 0.000000 |\n| checking permissions | 0.000044 | 0.000000 | 0.000000 |\n| creating table | 0.244645 | 0.000000 | 0.000000 |\n| After create | 0.000013 | 0.000000 | 0.000000 |\n| query end | 0.000003 | 0.000000 | 0.000000 |\n| freeing items | 0.000016 | 0.000000 | 0.000000 |\n| logging slow query | 0.000003 | 0.000000 | 0.000000 |\n| cleaning up | 0.000003 | 0.000000 | 0.000000 |\n+----------------------+----------+----------+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-profile/','','https://mariadb.com/kb/en/library/show-profile/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (391,26,'SHOW PROFILES','Syntax\n------ \nSHOW PROFILES\n \nDescription\n----------- \nThe SHOW PROFILES statement displays profiling information\nthat indicates resource usage for statements executed during\nthe course of the\ncurrent session. It is used together with \nSHOW PROFILE.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-profiles/','','https://mariadb.com/kb/en/library/show-profiles/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (392,26,'SHOW QUERY_RESPONSE_TIME','SHOW QUERY_RESPONSE_TIME was introduced in MariaDB 10.1.1.\n \nStarting with MariaDB 10.1.1, which introduced the\nInformation Schema plugin extension, it is possible to use\nSHOW QUERY_RESPONSE_TIME as an alternative for retrieving\ninformation from the QUERY_RESPONSE_TIME plugin.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/show-query_response_time/','','https://mariadb.com/kb/en/library/show-query_response_time/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (393,26,'SHOW RELAYLOG EVENTS','Syntax\n------ \nSHOW RELAYLOG [\'connection_name\'] EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n \nDescription\n----------- \nOn replication slaves this command shows the events in the\nrelay log. If \'log_name\' is not specified, the first relay\nlog is shown.\n \nSyntax for the LIMIT clause is the same as for SELECT ...\nLIMIT.\n \nUsing the LIMIT clause is highly recommended because the\nSHOW RELAYLOG EVENTS command returns the complete contents\nof the relay log, which can be quite large.\n \nThis command does not return events related to setting user\nand system variables. If you need those, use mysqlbinlog.\n \nOn the replication master, this command does nothing.\n \nconnection_name\n \nconnection_name was added as part of multi-source\nreplication added in MariaDB 10.0.1\n \nIf there is only one nameless master, or the default master\n(as specified by the default_master_connection system\nvariable) is intended, connection_name can be omitted. If\nprovided, the SHOW RELAYLOG statement will apply to the\nspecified master. connection_name is case-insensitive.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-relaylog-events/','','https://mariadb.com/kb/en/library/show-relaylog-events/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (394,26,'SHOW SLAVE HOSTS','Syntax\n------ \nSHOW SLAVE HOSTS\n \nDescription\n----------- \nThis command is run on the master and displays a list of\nreplication slaves that are currently registered with it.\nOnly slaves started with the --report-host=host_name option\nare visible in this list.\n \nThe list is displayed on any server (not just the master\nserver). The output\nlooks like this:\n \nSHOW SLAVE HOSTS;\n+------------+-----------+------+-----------+\n| Server_id | Host | Port | Master_id |\n+------------+-----------+------+-----------+\n| 192168010 | iconnect2 | 3306 | 192168011 |\n| 1921680101 | athena | 3306 | 192168011 |\n+------------+-----------+------+-----------+\nServer_id: The unique server ID of the slave server, as\nconfigured in the server\'s option file, or on the command\nline with --server-id=value.\nHost: The host name of the slave server, as configured in\nthe server\'s option file, or on the command line with\n--report-host=host_name. Note that this can differ from the\nmachine name as configured in the operating system.\nPort: The port the slave server is listening on.\nMaster_id: The unique server ID of the master server that\nthe slave server is replicating from.\n \nSome MariaDB and MySQL versions report another variable,\nrpl_recovery_rank. This\nvariable was never used, and was eventually removed in\nMariaDB 10.1.2 and MySQL 5.6.\n \n\n\nURL: https://mariadb.com/kb/en/library/show-slave-hosts/','','https://mariadb.com/kb/en/library/show-slave-hosts/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (395,26,'SHOW SLAVE STATUS','Syntax\n------ \nSHOW SLAVE [\"connection_name\"] STATUS\n \nor\n \nSHOW ALL SLAVES STATUS\n \nDescription\n----------- \nThis statement is to be run on a slave and provides status\ninformation on essential parameters of the replication slave\nthreads.\n \nThis statement requires the SUPER or the REPLICATION_CLIENT\nprivilege.\n \nMulti-source\n \nMariaDB 10.0 introduced the FULL and \"connection_name\"\noptions to\nallow you to connect to many masters at the same time.\n \nALL SLAVES gives you a list of all connections to the\nmaster.\n \nThe rows will be sorted according to Connection_name.\n \nIf you specify a connection_name, you only get the\ninformation about that\nconnection. If connection_name is not used, then the name\nset by default_master_connection is used. If the connection\nname doesn\'t exist you will get an error:\nThere is no master connection for \'xxx\'.\n \nColumn descriptions\n \nName | Description | Added | \n \nConnection_name | Name of the master connection. Returned\nwith SHOW ALL SLAVES STATUS only. | MariaDB 10.0 | \n \nSlave_SQL_State | State of SQL thread. Returned with SHOW\nALL SLAVES STATUS only. See Slave SQL Thread States. |\nMariaDB 10.0 | \n \nSlave_IO_State | State of I/O thread. See Slave I/O Thread\nStates. | MariaDB 10.0 | \n \nMaster_host | Master host that the slave is connected to. | \n| \n \nMaster_user | Account user name being used to connect to the\nmaster. | | \n \nMaster_port | The port being used to connect to the master.\n| | \n \nConnect_Retry | Time in seconds between retries to connect.\nThe default is 60. The CHANGE MASTER TO statement can set\nthis. The master-retry-count option determines the maximum\nnumber of reconnection attempts. | | \n \nMaster_Log_File | Name of the master binary log file that\nthe I/O thread is currently reading from. | | \n \nRead_Master_Log_Pos | Position up to which the I/O thread\nhas read in the current master binary log file. | | \n \nRelay_Log_File | Name of the relay log file that the SQL\nthread is currently processing. | | \n \nRelay_Log_Pos | Position up to which the SQL thread has\nfinished processing in the current relay log file. | | \n \nRelay_Master_Log_File | Name of the master binary log file\nthat contains the most recent event executed by the SQL\nthread. | | \n \nSlave_IO_Running | Whether the slave I/O thread is running\nand connected (Yes), running but not connected to a master\n(Connecting) or not running (No). | | \n \nSlave_SQL_Running | Whether or not the SQL thread is\nrunning. | | \n \nReplicate_Do_DB | Databases specified for replicating with\nthe replicate_do_db option. | | \n \nReplicate_Ignore_DB | Databases specified for ignoring with\nthe replicate_ignore_db option. | | \n \nReplicate_Do_Table | Tables specified for replicating with\nthe replicate_do_table option. | | \n \nReplicate_Ignore_Table | Tables specified for ignoring with\nthe replicate_ignore_table option. | | \n \nReplicate_Wild_Do_Table | Tables specified for replicating\nwith the replicate_wild_do_table option. | | \n \nReplicate_Wild_Ignore_Table | Tables specified for ignoring\nwith the replicate_wild_ignore_table option. | | \n \nLast_Errno | Alias for Last_SQL_Errno (see below) | | \n \nLast Error | Alias for Last_SQL_Error (see below) | | \n \nSkip_Counter | Number of events that a slave skips from the\nmaster, as recorded in the sql_slave_skip_counter system\nvariable. | | \n \nExec_Master_Log_Pos | Position up to which the SQL thread\nhas processed in the current master binary log file. Can be\nused to start a new slave from a current slave with the\nCHANGE MASTER TO ... MASTER_LOG_POS option. | | \n \nRelay_Log_Space | Total size of all relay log files\ncombined. | | \n \nUntil_Condition | | | \n \nUntil_Log_File | The MASTER_LOG_FILE value of the START\nSLAVE UNTIL condition. | | \n \nUntil_Log_Pos | The MASTER_LOG_POS value of the START SLAVE\nUNTIL condition. | | \n \nMaster_SSL_Allowed | Whether an SSL connection is permitted\n(Yes), not permitted (No) or permitted but without the slave\nhaving SSL support enabled (Ignored) | | \n \nMaster_SSL_CA_File | The MASTER_SSL_CA option of the CHANGE\nMASTER TO statement. | | \n \nMaster_SSL_CA_Path | The MASTER_SSL_CAPATH option of the\nCHANGE MASTER TO statement. | | \n \nMaster_SSL_Cert | The MASTER_SSL_CERT option of the CHANGE\nMASTER TO statement. | | \n \nMaster_SSL_Cipher | The MASTER_SSL_CIPHER option of the\nCHANGE MASTER TO statement. | | \n \nMaster_SSL_Key | The MASTER_SSL_KEY option of the CHANGE\nMASTER TO statement. | | \n \nSeconds_Behind_Master | Difference between the timestamp\nlogged on the master for the event that the slave is\ncurrently processing, and the current timestamp on the\nslave. Zero if the slave is not currently processing an\nevent. From MariaDB 10.0.23 and MariaDB 10.1.9, with\nparallel replication, seconds_behind_master is updated only\nafter transactions commit. | | \n \nMaster_SSL_Verify_Server_Cert | The\nMASTER_SSL_VERIFY_SERVER_CERT option of the CHANGE MASTER TO\nstatement. | | \n \nLast_IO_Errno | Error code of the most recent error that\ncaused the I/O thread to stop (also recorded in the slave\'s\nerror log). 0 means no error. RESET SLAVE or RESET MASTER\nwill reset this value. | | \n \nLast_IO_Error | Error message of the most recent error that\ncaused the I/O thread to stop (also recorded in the slave\'s\nerror log). An empty string means no error. RESET SLAVE or\nRESET MASTER will reset this value. | | \n \nLast_SQL_Errno | Error code of the most recent error that\ncaused the SQL thread to stop (also recorded in the slave\'s\nerror log). 0 means no error. RESET SLAVE or RESET MASTER\nwill reset this value. | | \n \nLast_SQL_Error | Error message of the most recent error that\ncaused the SQL thread to stop (also recorded in the slave\'s\nerror log). An empty string means no error. RESET SLAVE or\nRESET MASTER will reset this value. | | \n \nReplicate_Ignore_Server_Ids | List of server_ids that are\ncurrently being ignored for replication purposes, or an\nempty string for none, as specified in the IGNORE_SERVER_IDS\noption of the CHANGE MASTER TO statement. | | \n \nMaster_Server_Id | The master\'s server_id value. | | \n \nMaster_SSL_Crl | The MASTER_SSL_CRL option of the CHANGE\nMASTER TO statement. | MariaDB 10.0 | \n \nMaster_SSL_Crlpath | The MASTER_SSL_CRLPATH option of the\nCHANGE MASTER TO statement. | MariaDB 10.0 | \n \nUsing_Gtid | Whether or not global transaction ID\'s are\nbeing used for replication (can be No, Slave_Pos, or\nCurrent_Pos). | MariaDB 10.0.2 | \n \nGtid_IO_Pos | Current global transaction ID value. | MariaDB\n10.0.2 | \n \nRetried_transactions | Number of retried transactions for\nthis connection. Returned with SHOW ALL SLAVES STATUS only.\n| MariaDB 10.0 | \n \nMax_relay_log_size | Max relay log size for this connection.\nReturned with SHOW ALL SLAVES STATUS only. | MariaDB 10.0 | \n \nExecuted_log_entries | How many log entries the slave has\nexecuted. Returned with SHOW ALL SLAVES STATUS only. |\nMariaDB 10.0 | \n \nSlave_received_heartbeats | How many heartbeats we have got\nfrom the master. Returned with SHOW ALL SLAVES STATUS only.\n| MariaDB 10.0 | \n \nSlave_heartbeat_period | How often to request a heartbeat\npacket from the master (in seconds). Returned with SHOW ALL\nSLAVES STATUS only. | MariaDB 10.0 | \n \nGtid_Slave_Pos | GTID of the last event group replicated on\na slave server, for each replication domain, as stored in\nthe gtid_slave_pos system variable. Returned with SHOW ALL\nSLAVES STATUS only. | MariaDB 10.0 | \n \nSQL_Delay | Value specified by MASTER_DELAY in CHANGE MASTER\n(or 0 if none). | MariaDB 10.2.3 | \n \nSQL_Remaining_Delay | When the slave is delaying the\nexecution of an event due to MASTER_DELAY, this is the\nnumber of seconds of delay remaining before the event will\nbe applied. Otherwise, the value is NULL. | MariaDB 10.2.3 |\n\n \nSlave_SQL_Running_State | The state of the SQL driver\nthreads, same as in SHOW PROCESSLIST. When the slave is\ndelaying the execution of an event due to MASTER_DELAY, this\nfield displays: \"Waiting until MASTER_DELAY seconds after\nmaster executed event\". | MariaDB 10.2.3 | \n \nExamples\n-------- \nIf you issue this statement using the mysql client,\nyou can use a \\G statement terminator rather than a\nsemicolon to\nobtain a more readable vertical layout.\n \nSHOW SLAVE STATUS\\G\n*************************** 1. row\n***************************\n Slave_IO_State: Waiting for master to send event\n Master_Host: db01.example.com\n Master_User: replicant\n Master_Port: 3306\n Connect_Retry: 60\n Master_Log_File: mariadb-bin.000010\n Read_Master_Log_Pos: 548\n Relay_Log_File: relay-bin.000004\n Relay_Log_Pos: 837\n Relay_Master_Log_File: mariadb-bin.000010\n Slave_IO_Running: Yes\n Slave_SQL_Running: Yes\n Replicate_Do_DB: \n Replicate_Ignore_DB: \n Replicate_Do_Table: \n Replicate_Ignore_Table: \n Replicate_Wild_Do_Table: \n Replicate_Wild_Ignore_Table: \n Last_Errno: 0\n Last_Error: \n Skip_Counter: 0\n Exec_Master_Log_Pos: 548\n Relay_Log_Space: 1497\n Until_Condition: None\n Until_Log_File: \n Until_Log_Pos: 0\n Master_SSL_Allowed: No\n Master_SSL_CA_File: \n Master_SSL_CA_Path: \n Master_SSL_Cert: \n Master_SSL_Cipher: \n Master_SSL_Key: \n Seconds_Behind_Master: 0\nMaster_SSL_Verify_Server_Cert: No\n Last_IO_Errno: 0\n Last_IO_Error: \n Last_SQL_Errno: 0\n Last_SQL_Error: \n Replicate_Ignore_Server_Ids: \n Master_Server_Id: 101\n Master_SSL_Crl: \n Master_SSL_Crlpath: \n Using_Gtid: No\n Gtid_IO_Pos: \n \nMariaDB [(none)]> SHOW ALL SLAVES STATUS\\G\n*************************** 1. row\n***************************\n Connection_name: \n Slave_SQL_State: Slave has read all relay log; waiting for\nthe slave I/O thread to update it\n Slave_IO_State: Waiting for master to send event\n Master_Host: db01.example.com\n Master_User: replicant\n Master_Port: 3306\n Connect_Retry: 60\n Master_Log_File: mariadb-bin.000010\n Read_Master_Log_Pos: 3608\n Relay_Log_File: relay-bin.000004\n Relay_Log_Pos: 3897\n Relay_Master_Log_File: mariadb-bin.000010\n Slave_IO_Running: Yes\n Slave_SQL_Running: Yes\n Replicate_Do_DB: \n Replicate_Ignore_DB: \n Replicate_Do_Table: \n Replicate_Ignore_Table: \n Replicate_Wild_Do_Table: \n Replicate_Wild_Ignore_Table: \n Last_Errno: 0\n Last_Error: \n Skip_Counter: 0\n Exec_Master_Log_Pos: 3608\n Relay_Log_Space: 4557\n Until_Condition: None\n Until_Log_File: \n Until_Log_Pos: 0\n Master_SSL_Allowed: No\n Master_SSL_CA_File: \n Master_SSL_CA_Path: \n Master_SSL_Cert: \n Master_SSL_Cipher: \n Master_SSL_Key: \n Seconds_Behind_Master: 0\nMaster_SSL_Verify_Server_Cert: No\n Last_IO_Errno: 0\n Last_IO_Error: \n Last_SQL_Errno: 0\n Last_SQL_Error: \n Replicate_Ignore_Server_Ids: \n Master_Server_Id: 101\n Master_SSL_Crl: \n Master_SSL_Crlpath: \n Using_Gtid: No\n Gtid_IO_Pos:\n Retried_transactions: 0\n Max_relay_log_size: 104857600\n Executed_log_entries: 40\n Slave_received_heartbeats: 11\n Slave_heartbeat_period: 1800.000\n Gtid_Slave_Pos: 0-101-2320\n \nYou can also access some of the variables directly from\nstatus variables:\n \nSET @@default_master_connection=\"test\" ;\nshow status like \"%slave%\"\n \nVariable_name Value\nCom_show_slave_hosts 0\nCom_show_slave_status 0\nCom_start_all_slaves 0\nCom_start_slave 0\nCom_stop_all_slaves 0\nCom_stop_slave 0\nRpl_semi_sync_slave_status OFF\nSlave_connections 0\nSlave_heartbeat_period 1800.000\nSlave_open_temp_tables 0\nSlave_received_heartbeats 0\nSlave_retried_transactions 0\nSlave_running OFF\nSlaves_connected 0\nSlaves_running 1\n \n\n\nURL: https://mariadb.com/kb/en/library/show-slave-status/','','https://mariadb.com/kb/en/library/show-slave-status/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (396,26,'SHOW STATUS','Syntax\n------ \nSHOW [GLOBAL | SESSION] STATUS\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nSHOW STATUS provides server status information. This\ninformation also can be obtained using the mysqladmin\nextended-status command, or by querying the Information\nSchema GLOBAL_STATUS and SESSION_STATUS tables.\nThe LIKE clause, if present, indicates which variable names\nto match. The WHERE clause can be given to select rows using\nmore general conditions.\n \nWith the GLOBAL modifier, SHOW STATUS\ndisplays the status values for all connections to MariaDB.\nWith\nSESSION, it displays the status values\nfor the current connection. If no modifier is present, the\ndefault is\n SESSION. LOCAL is a synonym for\n SESSION. If you see a lot of 0 values, the reason is\nprobably that you have used SHOW STATUS with a new\nconnection instead of SHOW GLOBAL STATUS.\n \nSome status variables have only a global value. For these,\nyou get the\nsame value for both GLOBAL and SESSION.\n \nSee Server Status Variables for a full list, scope and\ndescription of the variables that can be viewed with SHOW\nSTATUS.\n \nThe LIKE clause, if present on its own, indicates which\nvariable name to match.\n \nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nExamples\n-------- \nFull output from MariaDB 10.1.17:\n \nSHOW GLOBAL STATUS;\n \n+--------------------------------------------------------------+----------------------------------------+\n| Variable_name | Value |\n+--------------------------------------------------------------+----------------------------------------+\n| Aborted_clients | 0 |\n| Aborted_connects | 0 |\n| Access_denied_errors | 0 |\n| Acl_column_grants | 0 |\n| Acl_database_grants | 2 |\n| Acl_function_grants | 0 |\n| Acl_procedure_grants | 0 |\n| Acl_proxy_users | 2 |\n| Acl_role_grants | 0 |\n| Acl_roles | 0 |\n| Acl_table_grants | 0 |\n| Acl_users | 6 |\n| Aria_pagecache_blocks_not_flushed | 0 |\n| Aria_pagecache_blocks_unused | 15706 |\n| Aria_pagecache_blocks_used | 0 |\n| Aria_pagecache_read_requests | 0 |\n| Aria_pagecache_reads | 0 |\n| Aria_pagecache_write_requests | 0 |\n| Aria_pagecache_writes | 0 |\n| Aria_transaction_log_syncs | 0 |\n| Binlog_commits | 0 |\n| Binlog_group_commits | 0 |\n| Binlog_group_commit_trigger_count | 0 |\n| Binlog_group_commit_trigger_lock_wait | 0 |\n| Binlog_group_commit_trigger_timeout | 0 |\n| Binlog_snapshot_file | |\n| Binlog_snapshot_position | 0 |\n| Binlog_bytes_written | 0 |\n| Binlog_cache_disk_use | 0 |\n| Binlog_cache_use | 0 |\n| Binlog_stmt_cache_disk_use | 0 |\n| Binlog_stmt_cache_use | 0 |\n| Busy_time | 0.000000 |\n| Bytes_received | 432 |\n| Bytes_sent | 15183 |\n| Com_admin_commands | 1 |\n| Com_alter_db | 0 |\n| Com_alter_db_upgrade | 0 |\n| Com_alter_event | 0 |\n| Com_alter_function | 0 |\n| Com_alter_procedure | 0 |\n| Com_alter_server | 0 |\n| Com_alter_table | 0 |\n| Com_alter_tablespace | 0 |\n| Com_analyze | 0 |\n| Com_assign_to_keycache | 0 |\n| Com_begin | 0 |\n| Com_binlog | 0 |\n| Com_call_procedure | 0 |\n| Com_change_db | 0 |\n| Com_change_master | 0 |\n| Com_check | 0 |\n| Com_checksum | 0 |\n| Com_commit | 0 |\n| Com_compound_sql | 0 |\n| Com_create_db | 0 |\n| Com_create_event | 0 |\n| Com_create_function | 0 |\n| Com_create_index | 0 |\n| Com_create_procedure | 0 |\n| Com_create_role | 0 |\n| Com_create_server | 0 |\n| Com_create_table | 0 |\n| Com_create_temporary_table | 0 |\n| Com_create_trigger | 0 |\n| Com_create_udf | 0 |\n| Com_create_user | 0 |\n| Com_create_view | 0 |\n| Com_dealloc_sql | 0 |\n| Com_delete | 0 |\n| Com_delete_multi | 0 |\n| Com_do | 0 |\n| Com_drop_db | 0 |\n| Com_drop_event | 0 |\n| Com_drop_function | 0 |\n| Com_drop_index | 0 |\n| Com_drop_procedure | 0 |\n| Com_drop_role | 0 |\n| Com_drop_server | 0 |\n| Com_drop_table | 0 |\n| Com_drop_temporary_table | 0 |\n| Com_drop_trigger | 0 |\n| Com_drop_user | 0 |\n| Com_drop_view | 0 |\n| Com_empty_query | 0 |\n| Com_execute_sql | 0 |\n| Com_flush | 0 |\n| Com_get_diagnostics | 0 |\n| Com_grant | 0 |\n| Com_grant_role | 0 |\n| Com_ha_close | 0 |\n| Com_ha_open | 0 |\n| Com_ha_read | 0 |\n| Com_help | 0 |\n| Com_insert | 0 |\n| Com_insert_select | 0 |\n| Com_install_plugin | 0 |\n| Com_kill | 0 |\n| Com_load | 0 |\n| Com_lock_tables | 0 |\n| Com_optimize | 0 |\n| Com_preload_keys | 0 |\n| Com_prepare_sql | 0 |\n| Com_purge | 0 |\n| Com_purge_before_date | 0 |\n| Com_release_savepoint | 0 |\n| Com_rename_table | 0 |\n| Com_rename_user | 0 |\n| Com_repair | 0 |\n| Com_replace | 0 |\n| Com_replace_select | 0 |\n| Com_reset | 0 |\n| Com_resignal | 0 |\n| Com_revoke | 0 |\n| Com_revoke_all | 0 |\n| Com_revoke_role | 0 |\n| Com_rollback | 0 |\n| Com_rollback_to_savepoint | 0 |\n| Com_savepoint | 0 |\n| Com_select | 1 |\n| Com_set_option | 0 |\n| Com_show_authors | 0 |\n| Com_show_binlog_events | 0 |\n| Com_show_binlogs | 0 |\n| Com_show_charsets | 0 |\n| Com_show_collations | 0 |\n| Com_show_contributors | 0 |\n| Com_show_create_db | 0 |\n| Com_show_create_event | 0 |\n| Com_show_create_func | 0 |\n| Com_show_create_proc | 0 |\n| Com_show_create_table | 0 |\n| Com_show_create_trigger | 0 |\n| Com_show_databases | 0 |\n| Com_show_engine_logs | 0 |\n| Com_show_engine_mutex | 0 |\n| Com_show_engine_status | 0 |\n| Com_show_errors | 0 |\n| Com_show_events | 0 |\n| Com_show_explain | 0 |\n| Com_show_fields | 0 |\n| Com_show_function_status | 0 |\n| Com_show_generic | 0 |\n| Com_show_grants | 0 |\n| Com_show_keys | 0 |\n| Com_show_master_status | 0 |\n| Com_show_open_tables | 0 |\n| Com_show_plugins | 0 |\n| Com_show_privileges | 0 |\n| Com_show_procedure_status | 0 |\n| Com_show_processlist | 0 |\n| Com_show_profile | 0 |\n| Com_show_profiles | 0 |\n| Com_show_relaylog_events | 0 |\n| Com_show_slave_hosts | 0 |\n| Com_show_slave_status | 0 |\n| Com_show_status | 2 |\n| Com_show_storage_engines | 0 |\n| Com_show_table_status | 0 |\n| Com_show_tables | 0 |\n| Com_show_triggers | 0 |\n| Com_show_variables | 0 |\n| Com_show_warnings | 0 |\n| Com_shutdown | 0 |\n| Com_signal | 0 |\n| Com_start_all_slaves | 0 |\n| Com_start_slave | 0 |\n| Com_stmt_close | 0 |\n| Com_stmt_execute | 0 |\n| Com_stmt_fetch | 0 |\n| Com_stmt_prepare | 0 |\n| Com_stmt_reprepare | 0 |\n| Com_stmt_reset | 0 |\n| Com_stmt_send_long_data | 0 |\n| Com_stop_all_slaves | 0 |\n| Com_stop_slave | 0 |\n| Com_truncate | 0 |\n| Com_uninstall_plugin | 0 |\n| Com_unlock_tables | 0 |\n| Com_update | 0 |\n| Com_update_multi | 0 |\n| Com_xa_commit | 0 |\n| Com_xa_end | 0 |\n| Com_xa_prepare | 0 |\n| Com_xa_recover | 0 |\n| Com_xa_rollback | 0 |\n| Com_xa_start | 0 |\n| Compression | OFF |\n| Connection_errors_accept | 0 |\n| Connection_errors_internal | 0 |\n| Connection_errors_max_connections | 0 |\n| Connection_errors_peer_address | 0 |\n| Connection_errors_select | 0 |\n| Connection_errors_tcpwrap | 0 |\n| Connections | 4 |\n| Cpu_time | 0.000000 |\n| Created_tmp_disk_tables | 0 |\n| Created_tmp_files | 6 |\n| Created_tmp_tables | 2 |\n| Delayed_errors | 0 |\n| Delayed_insert_threads | 0 |\n| Delayed_writes | 0 |\n| Delete_scan | 0 |\n| Empty_queries | 0 |\n| Executed_events | 0 |\n| Executed_triggers | 0 |\n| Feature_delay_key_write | 0 |\n| Feature_dynamic_columns | 0 |\n| Feature_fulltext | 0 |\n| Feature_gis | 0 |\n| Feature_locale | 0 |\n| Feature_subquery | 0 |\n| Feature_timezone | 0 |\n| Feature_trigger | 0 |\n| Feature_xml | 0 |\n| Flush_commands | 1 |\n| Handler_commit | 1 |\n| Handler_delete | 0 |\n| Handler_discover | 0 |\n| Handler_external_lock | 0 |\n| Handler_icp_attempts | 0 |\n| Handler_icp_match | 0 |\n| Handler_mrr_init | 0 |\n| Handler_mrr_key_refills | 0 |\n| Handler_mrr_rowid_refills | 0 |\n| Handler_prepare | 0 |\n| Handler_read_first | 3 |\n| Handler_read_key | 0 |\n| Handler_read_last | 0 |\n| Handler_read_next | 0 |\n| Handler_read_prev | 0 |\n| Handler_read_retry | 0 |\n| Handler_read_rnd | 0 |\n| Handler_read_rnd_deleted | 0 |\n| Handler_read_rnd_next | 537 |\n| Handler_rollback | 0 |\n| Handler_savepoint | 0 |\n| Handler_savepoint_rollback | 0 |\n| Handler_tmp_update | 0 |\n| Handler_tmp_write | 516 |\n| Handler_update | 0 |\n| Handler_write | 0 |\n| Innodb_available_undo_logs | 128 |\n| Innodb_background_log_sync | 222 |\n| Innodb_buffer_pool_bytes_data | 2523136 |\n| Innodb_buffer_pool_bytes_dirty | 0 |\n| Innodb_buffer_pool_dump_status | Dumping buffer pool(s)\nnot yet started |\n| Innodb_buffer_pool_load_status | Loading buffer pool(s)\nnot yet started |\n| Innodb_buffer_pool_pages_data | 154 |\n| Innodb_buffer_pool_pages_dirty | 0 |\n| Innodb_buffer_pool_pages_flushed | 1 |\n| Innodb_buffer_pool_pages_free | 8037 |\n| Innodb_buffer_pool_pages_lru_flushed | 0 |\n| Innodb_buffer_pool_pages_made_not_young | 0 |\n| Innodb_buffer_pool_pages_made_young | 0 |\n| Innodb_buffer_pool_pages_misc | 0 |\n| Innodb_buffer_pool_pages_old | 0 |\n| Innodb_buffer_pool_pages_total | 8191 |\n| Innodb_buffer_pool_read_ahead | 0 |\n| Innodb_buffer_pool_read_ahead_evicted | 0 |\n| Innodb_buffer_pool_read_ahead_rnd | 0 |\n| Innodb_buffer_pool_read_requests | 558 |\n| Innodb_buffer_pool_reads | 155 |\n| Innodb_buffer_pool_wait_free | 0 |\n| Innodb_buffer_pool_write_requests | 1 |\n| Innodb_checkpoint_age | 0 |\n| Innodb_checkpoint_max_age | 80826164 |\n| Innodb_data_fsyncs | 5 |\n| Innodb_data_pending_fsyncs | 0 |\n| Innodb_data_pending_reads | 0 |\n| Innodb_data_pending_writes | 0 |\n| Innodb_data_read | 2609664 |\n| Innodb_data_reads | 172 |\n| Innodb_data_writes | 5 |\n| Innodb_data_written | 34304 |\n| Innodb_dblwr_pages_written | 1 |\n| Innodb_dblwr_writes | 1 |\n| Innodb_deadlocks | 0 |\n| Innodb_have_atomic_builtins | ON |\n| Innodb_history_list_length | 0 |\n| Innodb_ibuf_discarded_delete_marks | 0 |\n| Innodb_ibuf_discarded_deletes | 0 |\n| Innodb_ibuf_discarded_inserts | 0 |\n| Innodb_ibuf_free_list | 0 |\n| Innodb_ibuf_merged_delete_marks | 0 |\n| Innodb_ibuf_merged_deletes | 0 |\n| Innodb_ibuf_merged_inserts | 0 |\n| Innodb_ibuf_merges | 0 |\n| Innodb_ibuf_segment_size | 2 |\n| Innodb_ibuf_size | 1 |\n| Innodb_log_waits | 0 |\n| Innodb_log_write_requests | 0 |\n| Innodb_log_writes | 1 |\n| Innodb_lsn_current | 1616829 |\n| Innodb_lsn_flushed | 1616829 |\n| Innodb_lsn_last_checkpoint | 1616829 |\n| Innodb_master_thread_active_loops | 0 |\n| Innodb_master_thread_idle_loops | 222 |\n| Innodb_max_trx_id | 2308 |\n| Innodb_mem_adaptive_hash | 2217568 |\n| Innodb_mem_dictionary | 630703 |\n| Innodb_mem_total | 140771328 |\n| Innodb_mutex_os_waits | 1 |\n| Innodb_mutex_spin_rounds | 30 |\n| Innodb_mutex_spin_waits | 1 |\n| Innodb_oldest_view_low_limit_trx_id | 0 |\n| Innodb_os_log_fsyncs | 3 |\n| Innodb_os_log_pending_fsyncs | 0 |\n| Innodb_os_log_pending_writes | 0 |\n| Innodb_os_log_written | 512 |\n| Innodb_page_size | 16384 |\n| Innodb_pages_created | 0 |\n| Innodb_pages_read | 154 |\n| Innodb_pages_written | 1 |\n| Innodb_purge_trx_id | 0 |\n| Innodb_purge_undo_no | 0 |\n| Innodb_read_views_memory | 88 |\n| Innodb_row_lock_current_waits | 0 |\n| Innodb_row_lock_time | 0 |\n| Innodb_row_lock_time_avg | 0 |\n| Innodb_row_lock_time_max | 0 |\n| Innodb_row_lock_waits | 0 |\n| Innodb_rows_deleted | 0 |\n| Innodb_rows_inserted | 0 |\n| Innodb_rows_read | 0 |\n| Innodb_rows_updated | 0 |\n| Innodb_system_rows_deleted | 0 |\n| Innodb_system_rows_inserted | 0 |\n| Innodb_system_rows_read | 0 |\n| Innodb_system_rows_updated | 0 |\n| Innodb_s_lock_os_waits | 2 |\n| Innodb_s_lock_spin_rounds | 60 |\n| Innodb_s_lock_spin_waits | 2 |\n| Innodb_truncated_status_writes | 0 |\n| Innodb_x_lock_os_waits | 0 |\n| Innodb_x_lock_spin_rounds | 0 |\n| Innodb_x_lock_spin_waits | 0 |\n| Innodb_page_compression_saved | 0 |\n| Innodb_page_compression_trim_sect512 | 0 |\n| Innodb_page_compression_trim_sect1024 | 0 |\n| Innodb_page_compression_trim_sect2048 | 0 |\n| Innodb_page_compression_trim_sect4096 | 0 |\n| Innodb_page_compression_trim_sect8192 | 0 |\n| Innodb_page_compression_trim_sect16384 | 0 |\n| Innodb_page_compression_trim_sect32768 | 0 |\n| Innodb_num_index_pages_written | 0 |\n| Innodb_num_non_index_pages_written | 5 |\n| Innodb_num_pages_page_compressed | 0 |\n| Innodb_num_page_compressed_trim_op | 0 |\n| Innodb_num_page_compressed_trim_op_saved | 0 |\n| Innodb_num_pages_page_decompressed | 0 |\n| Innodb_num_pages_page_compression_error | 0 |\n| Innodb_num_pages_encrypted | 0 |\n| Innodb_num_pages_decrypted | 0 |\n| Innodb_have_lz4 | OFF |\n| Innodb_have_lzo | OFF |\n| Innodb_have_lzma | OFF |\n| Innodb_have_bzip2 | OFF |\n| Innodb_have_snappy | OFF |\n| Innodb_defragment_compression_failures | 0 |\n| Innodb_defragment_failures | 0 |\n| Innodb_defragment_count | 0 |\n| Innodb_onlineddl_rowlog_rows | 0 |\n| Innodb_onlineddl_rowlog_pct_used | 0 |\n| Innodb_onlineddl_pct_progress | 0 |\n| Innodb_secondary_index_triggered_cluster_reads | 0 |\n| Innodb_secondary_index_triggered_cluster_reads_avoided | 0\n|\n| Innodb_encryption_rotation_pages_read_from_cache | 0 |\n| Innodb_encryption_rotation_pages_read_from_disk | 0 |\n| Innodb_encryption_rotation_pages_modified | 0 |\n| Innodb_encryption_rotation_pages_flushed | 0 |\n| Innodb_encryption_rotation_estimated_iops | 0 |\n| Innodb_scrub_background_page_reorganizations | 0 |\n| Innodb_scrub_background_page_splits | 0 |\n| Innodb_scrub_background_page_split_failures_underflow | 0\n|\n|\nInnodb_scrub_background_page_split_failures_out_of_filespace\n| 0 |\n| Innodb_scrub_background_page_split_failures_missing_index\n| 0 |\n| Innodb_scrub_background_page_split_failures_unknown | 0 |\n| Key_blocks_not_flushed | 0 |\n| Key_blocks_unused | 107163 |\n| Key_blocks_used | 0 |\n| Key_blocks_warm | 0 |\n| Key_read_requests | 0 |\n| Key_reads | 0 |\n| Key_write_requests | 0 |\n| Key_writes | 0 |\n| Last_query_cost | 0.000000 |\n| Master_gtid_wait_count | 0 |\n| Master_gtid_wait_time | 0 |\n| Master_gtid_wait_timeouts | 0 |\n| Max_statement_time_exceeded | 0 |\n| Max_used_connections | 1 |\n| Memory_used | 273614696 |\n| Not_flushed_delayed_rows | 0 |\n| Open_files | 25 |\n| Open_streams | 0 |\n| Open_table_definitions | 18 |\n| Open_tables | 11 |\n| Opened_files | 77 |\n| Opened_plugin_libraries | 0 |\n| Opened_table_definitions | 18 |\n| Opened_tables | 18 |\n| Opened_views | 0 |\n| Performance_schema_accounts_lost | 0 |\n| Performance_schema_cond_classes_lost | 0 |\n| Performance_schema_cond_instances_lost | 0 |\n| Performance_schema_digest_lost | 0 |\n| Performance_schema_file_classes_lost | 0 |\n| Performance_schema_file_handles_lost | 0 |\n| Performance_schema_file_instances_lost | 0 |\n| Performance_schema_hosts_lost | 0 |\n| Performance_schema_locker_lost | 0 |\n| Performance_schema_mutex_classes_lost | 0 |\n| Performance_schema_mutex_instances_lost | 0 |\n| Performance_schema_rwlock_classes_lost | 0 |\n| Performance_schema_rwlock_instances_lost | 0 |\n| Performance_schema_session_connect_attrs_lost | 0 |\n| Performance_schema_socket_classes_lost | 0 |\n| Performance_schema_socket_instances_lost | 0 |\n| Performance_schema_stage_classes_lost | 0 |\n| Performance_schema_statement_classes_lost | 0 |\n| Performance_schema_table_handles_lost | 0 |\n| Performance_schema_table_instances_lost | 0 |\n| Performance_schema_thread_classes_lost | 0 |\n| Performance_schema_thread_instances_lost | 0 |\n| Performance_schema_users_lost | 0 |\n| Prepared_stmt_count | 0 |\n| Qcache_free_blocks | 1 |\n| Qcache_free_memory | 1031336 |\n| Qcache_hits | 0 |\n| Qcache_inserts | 0 |\n| Qcache_lowmem_prunes | 0 |\n| Qcache_not_cached | 0 |\n| Qcache_queries_in_cache | 0 |\n| Qcache_total_blocks | 1 |\n| Queries | 4 |\n| Questions | 4 |\n| Rows_read | 10 |\n| Rows_sent | 517 |\n| Rows_tmp_read | 516 |\n| Rpl_status | AUTH_MASTER |\n| Select_full_join | 0 |\n| Select_full_range_join | 0 |\n| Select_range | 0 |\n| Select_range_check | 0 |\n| Select_scan | 2 |\n| Slave_connections | 0 |\n| Slave_heartbeat_period | 0.000 |\n| Slave_open_temp_tables | 0 |\n| Slave_received_heartbeats | 0 |\n| Slave_retried_transactions | 0 |\n| Slave_running | OFF |\n| Slave_skipped_errors | 0 |\n| Slaves_connected | 0 |\n| Slaves_running | 0 |\n| Slow_launch_threads | 0 |\n| Slow_queries | 0 |\n| Sort_merge_passes | 0 |\n| Sort_priority_queue_sorts | 0 |\n| Sort_range | 0 |\n| Sort_rows | 0 |\n| Sort_scan | 0 |\n| Ssl_accept_renegotiates | 0 |\n| Ssl_accepts | 0 |\n| Ssl_callback_cache_hits | 0 |\n| Ssl_cipher | |\n| Ssl_cipher_list | |\n| Ssl_client_connects | 0 |\n| Ssl_connect_renegotiates | 0 |\n| Ssl_ctx_verify_depth | 0 |\n| Ssl_ctx_verify_mode | 0 |\n| Ssl_default_timeout | 0 |\n| Ssl_finished_accepts | 0 |\n| Ssl_finished_connects | 0 |\n| Ssl_server_not_after | |\n| Ssl_server_not_before | |\n| Ssl_session_cache_hits | 0 |\n| Ssl_session_cache_misses | 0 |\n| Ssl_session_cache_mode | NONE |\n| Ssl_session_cache_overflows | 0 |\n| Ssl_session_cache_size | 0 |\n| Ssl_session_cache_timeouts | 0 |\n| Ssl_sessions_reused | 0 |\n| Ssl_used_session_cache_entries | 0 |\n| Ssl_verify_depth | 0 |\n| Ssl_verify_mode | 0 |\n| Ssl_version | |\n| Subquery_cache_hit | 0 |\n| Subquery_cache_miss | 0 |\n| Syncs | 2 |\n| Table_locks_immediate | 21 |\n| Table_locks_waited | 0 |\n| Tc_log_max_pages_used | 0 |\n| Tc_log_page_size | 4096 |\n| Tc_log_page_waits | 0 |\n| Threadpool_idle_threads | 0 |\n| Threadpool_threads | 0 |\n| Threads_cached | 0 |\n| Threads_connected | 1 |\n| Threads_created | 2 |\n| Threads_running | 1 |\n| Update_scan | 0 |\n| Uptime | 223 |\n| Uptime_since_flush_status | 223 |\n| wsrep_cluster_conf_id | 18446744073709551615 |\n| wsrep_cluster_size | 0 |\n| wsrep_cluster_state_uuid | |\n| wsrep_cluster_status | Disconnected |\n| wsrep_connected | OFF |\n| wsrep_local_bf_aborts | 0 |\n| wsrep_local_index | 18446744073709551615 |\n| wsrep_provider_name | |\n| wsrep_provider_vendor | |\n| wsrep_provider_version | |\n| wsrep_ready | OFF |\n| wsrep_thread_count | 0 |\n+--------------------------------------------------------------+----------------------------------------+\n516 rows in set (0.00 sec)\n \nExample of filtered output:\n \nSHOW STATUS LIKE \'Key%\';\n \n+------------------------+--------+\n| Variable_name | Value |\n+------------------------+--------+\n| Key_blocks_not_flushed | 0 |\n| Key_blocks_unused | 107163 |\n| Key_blocks_used | 0 |\n| Key_blocks_warm | 0 |\n| Key_read_requests | 0 |\n| Key_reads | 0 |\n| Key_write_requests | 0 |\n| Key_writes | 0 |\n+------------------------+--------+\n8 rows in set (0.00 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-status/','','https://mariadb.com/kb/en/library/show-status/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (397,26,'SHOW TABLE STATUS','Syntax\n------ \nSHOW TABLE STATUS [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \n SHOW TABLE STATUS works like \n SHOW TABLES, but provides more extensive information about\neach non-TEMPORARY table.\n \nThe LIKE clause, if present on its own, indicates which\ntable names to\nmatch. The WHERE and LIKE clauses can be given to select\nrows using more general conditions, as discussed in Extended\nSHOW.\n \nThe following information is returned:\n \nColumn | Description | \n \nName | Table name. | \n \nEngine | Table storage engine. | \n \nVersion | Version number from the table\'s .frm file. | \n \nRow_format | Row format (see InnoDB, Aria and MyISAM row\nformats). | \n \nRows | Number of rows in the table. Some engines, such as\nXtraDB and InnoDB may store an estimate. | \n \nAvg_row_length | Average row length in the table. | \n \nData_length | For InnoDB/XtraDB, the index size, in pages,\nmultiplied by the page size. For Aria and MyISAM, length of\nthe data file, in bytes. For MEMORY, the approximate\nallocated memory. | \n \nMax_data_length | Maximum length of the data file, ie the\ntotal number of bytes that could be stored in the table. Not\nused in XtraDB and InnoDB. | \n \nIndex_length | Length of the index file. | \n \nData_free | Bytes allocated but unused. For InnoDB tables in\na shared tablespace, the free space of the shared tablespace\nwith small safety margin. An estimate in the case of\npartitioned tables - see the PARTITIONS table. | \n \nAuto_increment | Next AUTO_INCREMENT value. | \n \nCreate_time | Time the table was created. | \n \nUpdate_time | Time the table was last updated. On Windows,\nthe timestamp is not updated on update, so MyISAM values\nwill be inaccurate. In InnoDB, if shared tablespaces are\nused, will be NULL, while buffering can also delay the\nupdate, so the value will differ from the actual time of the\nlast UPDATE, INSERT or DELETE. | \n \nCheck_time | Time the table was last checked. Not kept by\nall storage engines, in which case will be NULL. | \n \nCollation | Character set and collation. | \n \nChecksum | Live checksum value, if any. | \n \nCreate_options | Extra CREATE TABLE options. | \n \nComment | Table comment provided when MariaDB created the\ntable. | \n \nSimilar information can be found in the\ninformation_schema.TABLES table as well as by using\nmysqlshow:\n \nmysqlshow --status db_name\n \nExample\n \nshow table status\\G\n*************************** 1. row\n***************************\n Name: bus_routes\n Engine: InnoDB\n Version: 10\n Row_format: Dynamic\n Rows: 5\n Avg_row_length: 3276\n Data_length: 16384\nMax_data_length: 0\n Index_length: 0\n Data_free: 0\n Auto_increment: NULL\n Create_time: 2017-05-24 11:17:46\n Update_time: NULL\n Check_time: NULL\n Collation: latin1_swedish_ci\n Checksum: NULL\n Create_options: \n Comment:\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-table-status/','','https://mariadb.com/kb/en/library/show-table-status/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (398,26,'SHOW TABLES','Syntax\n------ \nSHOW [FULL] TABLES [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nSHOW TABLES lists the non-TEMPORARY tables, sequences and\nviews in a given database. \n \nThe LIKE clause, if present on its own, indicates which\ntable names to match. The WHERE and LIKE clauses can be\ngiven to select rows using more general conditions, as\ndiscussed in Extended SHOW. For example, when searching for\ntables in the test database, the column name for use in the\nWHERE and LIKE clauses will be Tables_in_test\n \nThe FULL modifier is supported such that SHOW FULL TABLES\ndisplays a second output column. Values for the second\ncolumn. Table_type, are BASE TABLE for a table, VIEW for a\nview and SEQUENCE for a sequence.\n \nYou can also get this information using:\n \nmysqlshow db_name\n \nSee mysqlshow for more details.\n \nIf you have no privileges for a base table or view, it does\nnot show up in the output from SHOW TABLES or mysqlshow\ndb_name.\n \nThe information_schema.TABLES table, as well as the SHOW\nTABLE STATUS statement, provide extended information about\ntables.\n \nExamples\n-------- \nSHOW TABLES;\n+----------------------+\n| Tables_in_test |\n+----------------------+\n| animal_count |\n| animals |\n| are_the_mooses_loose |\n| aria_test2 |\n| t1 |\n| view1 |\n+----------------------+\n \nShowing the tables beginning with a only.\n \nSHOW TABLES WHERE Tables_in_test LIKE \'a%\';\n+----------------------+\n| Tables_in_test |\n+----------------------+\n| animal_count |\n| animals |\n| are_the_mooses_loose |\n| aria_test2 |\n+----------------------+\n \nShowing tables and table types:\n \nSHOW FULL TABLES;\n+----------------+------------+\n| Tables_in_test | Table_type |\n+----------------+------------+\n| s1 | SEQUENCE |\n| student | BASE TABLE |\n| v1 | VIEW |\n+----------------+------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/show-tables/','','https://mariadb.com/kb/en/library/show-tables/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (399,26,'SHOW TABLE_STATISTICS','MariaDB 5.2 introduced the User Statistics feature.\n \nSyntax\n------ \nSHOW TABLE_STATISTICS\n \nDescription\n----------- \nThe SHOW TABLE_STATISTICS statement was introduced in\nMariaDB 5.2 as part of the User Statistics feature. It was\nremoved as a separate statement in MariaDB 10.1.1, but\neffectively replaced by the generic SHOW\ninformation_schema_table statement. The\ninformation_schema.TABLE_STATISTICS table shows statistics\non table usage\n \nThe userstat system variable must be set to 1 to activate\nthis feature. See the User Statistics and\ninformation_schema.TABLE_STATISTICS articles for more\ninformation.\n \nExample\n \nFrom MariaDB 10.0\n \nSHOW TABLE_STATISTICS\\G\n*************************** 1. row\n***************************\n Table_schema: mysql\n Table_name: proxies_priv\n Rows_read: 2\n Rows_changed: 0\nRows_changed_x_#indexes: 0\n*************************** 2. row\n***************************\n Table_schema: test\n Table_name: employees_example\n Rows_read: 7\n Rows_changed: 0\nRows_changed_x_#indexes: 0\n*************************** 3. row\n***************************\n Table_schema: mysql\n Table_name: user\n Rows_read: 16\n Rows_changed: 0\nRows_changed_x_#indexes: 0\n*************************** 4. row\n***************************\n Table_schema: mysql\n Table_name: db\n Rows_read: 2\n Rows_changed: 0\nRows_changed_x_#indexes: 0\n \n\n \n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/show-table-statistics/','','https://mariadb.com/kb/en/library/show-table-statistics/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (400,26,'SHOW TRIGGERS','Syntax\n------ \nSHOW TRIGGERS [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \n SHOW TRIGGERS lists the triggers currently defined for\ntables in a database (the default database unless a FROM\nclause is given). This statement requires the\nTRIGGER privilege (prior to MySQL\n5.1.22, it required the SUPER privilege). \n \nThe LIKE clause, if present on its own, indicates which\ntable names to\nmatch and causes the statement to display triggers for those\ntables. The WHERE and LIKE clauses can be given to select\nrows using more general conditions, as discussed in Extended\nSHOW.\n \nSimilar information is stored in the\ninformation_schema.TRIGGERS table.\n \nIf there are multiple triggers for the same action, then the\ntriggers are shown in action order.\n \nExamples\n-------- \nFor the trigger defined at Trigger Overview:\n \nSHOW triggers Like \'animals\' \\G\n*************************** 1. row\n***************************\n Trigger: the_mooses_are_loose\n Event: INSERT\n Table: animals\n Statement: BEGIN\n IF NEW.name = \'Moose\' THEN\n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+100;\n ELSE \n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n END IF;\nEND\n Timing: AFTER\n Created: 2016-09-29 13:53:34.35\n sql_mode: \n Definer: root@localhost\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \nListing all triggers associated with a certain table:\n \nSHOW TRIGGERS FROM test WHERE `Table` = \'user\' \\G\n*************************** 1. row\n***************************\n Trigger: user_ai\n Event: INSERT\n Table: user\n Statement: BEGIN END\n Timing: AFTER\n Created: 2016-09-29 13:53:34.35\n sql_mode: \n Definer: root@%\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n \nSHOW triggers WHERE Event Like \'Insert\' \\G\n*************************** 1. row\n***************************\n Trigger: the_mooses_are_loose\n Event: INSERT\n Table: animals\n Statement: BEGIN\n IF NEW.name = \'Moose\' THEN\n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+100;\n ELSE \n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n END IF;\nEND\n Timing: AFTER\n Created: 2016-09-29 13:53:34.35\n sql_mode: \n Definer: root@localhost\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\ncharacter_set_client is the session value of the\ncharacter_set_client system variable when the trigger was\ncreated. \ncollation_connection is the session value of the\ncollation_connection system variable when the trigger was\n created. \nDatabase Collation is the collation of the database \n with which the trigger is associated.\n \nThese columns were added in MariaDB/MySQL 5.1.21.\n \nOld triggers created before MySQL 5.7 and MariaDB 10.2.3 has\nNULL in the Created column.\n \n\n\nURL: https://mariadb.com/kb/en/library/show-triggers/','','https://mariadb.com/kb/en/library/show-triggers/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (401,26,'SHOW USER_STATISTICS','MariaDB 5.2 introduced the User Statistics feature.\n \nSyntax\n------ \nSHOW USER_STATISTICS\n \nDescription\n----------- \nThe SHOW USER_STATISTICS statement was introduced in MariaDB\n5.2 as part of the User Statistics feature. It was removed\nas a separate statement in MariaDB 10.1.1, but effectively\nreplaced by the generic SHOW information_schema_table\nstatement. The information_schema.USER_STATISTICS table\nholds statistics about user activity. You can use this table\nto find out such things as which user is causing the most\nload and which users are being abusive. You can also use\nthis table to measure how close to capacity the server may\nbe.\n \nThe userstat system variable must be set to 1 to activate\nthis feature. See the User Statistics and\ninformation_schema.USER_STATISTICS table for more\ninformation.\n \nExample\n \nFrom MariaDB 10.0:\n \nSHOW USER_STATISTICS\\G\n*************************** 1. row\n***************************\n User: root\n Total_connections: 1\nConcurrent_connections: 0\n Connected_time: 3297\n Busy_time: 0.14113400000000006\n Cpu_time: 0.017637000000000003\n Bytes_received: 969\n Bytes_sent: 22355\n Binlog_bytes_written: 0\n Rows_read: 10\n Rows_sent: 67\n Rows_deleted: 0\n Rows_inserted: 0\n Rows_updated: 0\n Select_commands: 7\n Update_commands: 0\n Other_commands: 0\n Commit_transactions: 1\n Rollback_transactions: 0\n Denied_connections: 0\n Lost_connections: 0\n Access_denied: 0\n Empty_queries: 7\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-user-statistics/','','https://mariadb.com/kb/en/library/show-user-statistics/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (402,26,'SHOW VARIABLES','Syntax\n------ \nSHOW [GLOBAL | SESSION] VARIABLES\n [LIKE \'pattern\' | WHERE expr]\n \nDescription\n----------- \nSHOW VARIABLES shows the values of MariaDB system variables.\nThis\ninformation also can be obtained using the mysqladmin\nvariables\ncommand. The LIKE clause, if present, indicates which\nvariable names\nto match. The WHERE clause can be given to select rows using\nmore\ngeneral conditions.\n \nWith the GLOBAL modifier, SHOW VARIABLES displays the values\nthat are\nused for new connections to MariaDB. With SESSION, it\ndisplays the\nvalues that are in effect for the current connection. If no\nmodifier\nis present, the default is SESSION. LOCAL is a synonym for\nSESSION.\nWith a LIKE clause, the statement displays only rows for\nthose\nvariables with names that match the pattern. To obtain the\nrow for a\nspecific variable, use a LIKE clause as shown:\n \nSHOW VARIABLES LIKE \'maria_group_commit\';\n \nSHOW SESSION VARIABLES LIKE \'maria_group_commit\';\n \nTo get a list of variables whose name match a pattern, use\nthe \"%\"\nwildcard character in a LIKE clause:\n \nSHOW VARIABLES LIKE \'%maria%\';\n \nSHOW GLOBAL VARIABLES LIKE \'%maria%\';\n \nWildcard characters can be used in any position within the\npattern to\nbe matched. Strictly speaking, because \"_\" is a wildcard\nthat matches\nany single character, you should escape it as \"\\_\" to\nmatch it\nliterally. In practice, this is rarely necessary.\n \nThe WHERE and LIKE clauses can be given to select rows using\nmore general conditions, as discussed in Extended SHOW.\n \nSee SET for information on setting server system variables.\n \nSee Server System Variables for a list of all the variables\nthat can be set.\n \nYou can also see the server variables by querying the\nInformation Schema GLOBAL_VARIABLES and SESSION_VARIABLES\ntables.\n \nExamples\n-------- \nSHOW VARIABLES LIKE \'aria%\';\n \n+------------------------------------------+---------------------+\n| Variable_name | Value |\n+------------------------------------------+---------------------+\n| aria_block_size | 8192 |\n| aria_checkpoint_interval | 30 |\n| aria_checkpoint_log_activity | 1048576 |\n| aria_force_start_after_recovery_failures | 0 |\n| aria_group_commit | none |\n| aria_group_commit_interval | 0 |\n| aria_log_file_size | 1073741824 |\n| aria_log_purge_type | immediate |\n| aria_max_sort_file_size | 9223372036853727232 |\n| aria_page_checksum | ON |\n| aria_pagecache_age_threshold | 300 |\n| aria_pagecache_buffer_size | 134217728 |\n| aria_pagecache_division_limit | 100 |\n| aria_recover | NORMAL |\n| aria_repair_threads | 1 |\n| aria_sort_buffer_size | 134217728 |\n| aria_stats_method | nulls_unequal |\n| aria_sync_log_dir | NEWFILE |\n| aria_used_for_temp_tables | ON |\n+------------------------------------------+---------------------+\n \nSELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM\n INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE\n VARIABLE_NAME LIKE \'max_error_count\' OR\n VARIABLE_NAME LIKE \'innodb_sync_spin_loops\';\n \n+---------------------------+---------------+--------------+\n| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |\n+---------------------------+---------------+--------------+\n| MAX_ERROR_COUNT | 64 | 64 |\n| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |\n+---------------------------+---------------+--------------+\n \nSET GLOBAL max_error_count=128;\n \nSELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM\n INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE\n VARIABLE_NAME LIKE \'max_error_count\' OR\n VARIABLE_NAME LIKE \'innodb_sync_spin_loops\';\n \n+---------------------------+---------------+--------------+\n| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |\n+---------------------------+---------------+--------------+\n| MAX_ERROR_COUNT | 64 | 128 |\n| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |\n+---------------------------+---------------+--------------+\n \nSET GLOBAL max_error_count=128;\n \nSHOW VARIABLES LIKE \'max_error_count\';\n \n+-----------------+-------+\n| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 64 |\n+-----------------+-------+\n \nSHOW GLOBAL VARIABLES LIKE \'max_error_count\';\n \n+-----------------+-------+\n| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 128 |\n+-----------------+-------+\n \nBecause the following variable only has a global scope, the\nglobal value is returned even when specifying SESSION (in\nthis case by default):\n \nSHOW VARIABLES LIKE \'innodb_sync_spin_loops\';\n \n+------------------------+-------+\n| Variable_name | Value |\n+------------------------+-------+\n| innodb_sync_spin_loops | 30 |\n+------------------------+-------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-variables/','','https://mariadb.com/kb/en/library/show-variables/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (403,26,'SHOW WARNINGS','Syntax\n------ \nSHOW WARNINGS [LIMIT [offset,] row_count]\nSHOW ERRORS [LIMIT row_count OFFSET offset]\nSHOW COUNT(*) WARNINGS\n \nDescription\n----------- \n SHOW WARNINGS shows the error, warning, and note messages\nthat resulted from the last statement that generated\nmessages in the\ncurrent session. It shows nothing if the last statement used\na table\nand generated no messages. (That is, a statement that uses a\ntable but\ngenerates no messages clears the message list.) Statements\nthat do not\nuse tables and do not generate messages have no effect on\nthe message\nlist.\n \nA note is different to a warning in that it only appears if\nthe sql_notes variable is set to 1 (the default), and is not\nconverted to an error if strict mode is enabled.\n \nA related statement, SHOW ERRORS, shows only the errors.\n \nThe SHOW COUNT(*) WARNINGS statement displays the total\nnumber of errors, warnings, and notes. You can also retrieve\nthis number from\nthe warning_count variable:\n \nSHOW COUNT(*) WARNINGS;\nSELECT @@warning_count;\n \nThe value of warning_count might be greater than the number\nof messages displayed by SHOW WARNINGS if the\nmax_error_count system variable is set so low that not all\nmessages are stored.\n \nThe LIMIT clause has the same syntax as for the\n SELECT statement.\n \nSHOW WARNINGS can be used after EXPLAIN EXTENDED to see how\na query is internally rewritten by MariaDB.\n \nIf the sql_notes server variable is set to 1, Notes are\nincluded in the output of SHOW WARNINGS; if it is set to 0,\nthis statement will not show (or count) Notes.\n \nThe results of SHOW WARNINGS and SHOW COUNT(*) WARNINGS are\ndirectly sent to the client. If you need to access those\ninformation in a stored program, you can use the GET\nDIAGNOSTICS statement instead.\n \nFor a list of MariaDB error codes, see MariaDB Error Codes.\n \nThe mysql client also has a number of options related to\nwarnings. The \\W command will show warnings after every\nstatement, while \\w will disable this. Starting the client\nwith the --show-warnings option will show warnings after\nevery statement.\n \nMariaDB 10.3.1 implements a stored routine error stack\ntrace. SHOW WARNINGS can also be used to show more\ninformation. See the example below.\n \nExamples\n-------- \nSELECT 1/0;\n+------+\n| 1/0 |\n+------+\n| NULL |\n+------+\n \nSHOW COUNT(*) WARNINGS;\n+-------------------------+\n| @@session.warning_count |\n+-------------------------+\n| 1 |\n+-------------------------+\n \nSHOW WARNINGS;\n+---------+------+---------------+\n| Level | Code | Message |\n+---------+------+---------------+\n| Warning | 1365 | Division by 0 |\n+---------+------+---------------+\n \nStack Trace\n \nFrom MariaDB 10.3.1, displaying a stack trace:\n \nDELIMITER $$\nCREATE OR REPLACE PROCEDURE p1()\n BEGIN\n DECLARE c CURSOR FOR SELECT * FROM not_existing;\n OPEN c;\n CLOSE c;\n END;\n$$\nCREATE OR REPLACE PROCEDURE p2()\n BEGIN\n CALL p1;\n END;\n$$\nDELIMITER ;\nCALL p2;\nERROR 1146 (42S02): Table \'test.not_existing\' doesn\'t\nexist\n \nSHOW WARNINGS;\n+-------+------+-----------------------------------------+\n| Level | Code | Message |\n+-------+------+-----------------------------------------+\n| Error | 1146 | Table \'test.not_existing\' doesn\'t exist\n|\n| Note | 4091 | At line 6 in test.p1 |\n| Note | 4091 | At line 4 in test.p2 |\n+-------+------+-----------------------------------------+\n \nSHOW WARNINGS displays a stack trace, showing where the\nerror actually happened:\nLine 4 in test.p1 is the OPEN command which actually raised\nthe error\nLine 3 in test.p2 is the CALL statement, calling p1 from p2.\n \n\n\nURL: https://mariadb.com/kb/en/library/show-warnings/','','https://mariadb.com/kb/en/library/show-warnings/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (404,26,'SHOW WSREP_MEMBERSHIP','MariaDB 10.1.2\n \nSHOW WSREP_MEMBERSHIP was introduced with the WSREP_INFO\nplugin in MariaDB 10.1.2.\n \nSyntax\n------ \nSHOW WSREP_MEMBERSHIP\n \nDescription\n----------- \nThe SHOW WSREP_MEMBERSHIP statement returns Galera node\ncluster membership information. It returns the same\ninformation as found in the\ninformation_schema.WSREP_MEMBERSHIP table. Only users with\nthe SUPER privilege can access this information.\n \nExamples\n-------- \nSHOW WSREP_MEMBERSHIP;\n+-------+--------------------------------------+----------+-----------------+\n| Index | Uuid | Name | Address |\n+-------+--------------------------------------+----------+-----------------+\n| 0 | 19058073-8940-11e4-8570-16af7bf8fced | my_node1 |\n10.0.2.15:16001 |\n| 1 | 19f2b0e0-8942-11e4-9cb8-b39e8ee0b5dd | my_node3 |\n10.0.2.15:16003 |\n| 2 | d85e62db-8941-11e4-b1ef-4bc9980e476d | my_node2 |\n10.0.2.15:16002 |\n+-------+--------------------------------------+----------+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/show-wsrep_membership/','','https://mariadb.com/kb/en/library/show-wsrep_membership/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (405,26,'SHOW WSREP_STATUS','MariaDB 10.1.2\n \nSHOW WSREP_STATUS was introduced with the WSREP_INFO plugin\nin MariaDB 10.1.2.\n \nSyntax\n------ \nSHOW WSREP_STATUS\n \nDescription\n----------- \nThe SHOW WSREP_STATUS statement returns Galera node and\ncluster status information. It returns the same information\nas found in the information_schema.WSREP_STATUS table. Only\nusers with the SUPER privilege can access this information.\n \nExamples\n-------- \nSHOW WSREP_STATUS;\n+------------+-------------+----------------+--------------+\n| Node_Index | Node_Status | Cluster_Status | Cluster_Size |\n+------------+-------------+----------------+--------------+\n| 0 | Synced | Primary | 3 |\n+------------+-------------+----------------+--------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/show-wsrep_status/','','https://mariadb.com/kb/en/library/show-wsrep_status/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (406,27,'CALL','Syntax\n------ \nCALL sp_name([parameter[,...]])\nCALL sp_name[()]\n \nDescription\n----------- \nThe CALL statement invokes a stored procedure that was\ndefined previously with CREATE PROCEDURE. \n \nStored procedure names can be specified as\ndatabase_name.procedure_name. Procedure names and database\nnames can be quoted with backticks (). This is necessary if\nthey are reserved words, or contain special characters. See\nidentifier qualifiers for details.\n \nBefore MySQL 5.1.13, stored procedures that take no\narguments required parentheses. In current releases of\nMariaDB, CALL p() and CALL p are equivalent.\n \nIf parentheses are used, any number of spaces, tab\ncharacters and new line characters is allowed between the\nprocedure\'s name and the open parenthesis.\n \nCALL can pass back values to its caller using parameters\nthat are declared as OUT or INOUT\nparameters. If no value is assigned to an OUT parameter,\nNULL is assigned (and its former value is lost). To pass\nsuch values from another stored program you can use\nuser-defined variables, local variables or routine\'s\nparameters; in other contexts, you can only use user-defined\nvariables. \n \nCALL can also be executed as a prepared statement.\nPlaceholders can be used for IN parameters in all versions\nof MariaDB; for OUT and INOUT parameters, placeholders can\nbe used since MariaDB 5.5.\n \nWhen the procedure returns, a client program can also obtain\nthe\nnumber of rows affected for the final statement executed\nwithin the routine: At\nthe SQL level, call the ROW_COUNT() function; from the C\nAPI, call the mysql_affected_rows() function.\n \nIf the CLIENT_MULTI_RESULTS API flag is set, CALL can return\nany number of resultsets and the called stored procedure can\nexecute prepared statements. If it is not set, at most one\nresultset can be returned and prepared statements cannot be\nused within procedures.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/call/','','https://mariadb.com/kb/en/library/call/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (407,27,'Concurrent Inserts','The MyISAM storage engine supports concurrent inserts. This\nfeature allows SELECT statements to be executed during\nINSERT operations, reducing contention.\n \nWhether concurrent inserts can be used or not depends on the\nvalue of the concurrent_insert server system variable:\nNEVER (0) disables concurrent inserts.\nAUTO (1) allows concurrent inserts only when the target\ntable has no free blocks (no data in the middle of the table\nhas been deleted after the last OPTIMIZE TABLE). This is the\ndefault.\nALWAYS (2) always enables concurrent inserts.\n \nIf the binary log is used, CREATE TABLE ... SELECT and\nINSERT ... SELECT statements cannot use concurrent inserts.\nThese statements acquire a read lock on the table, so\nconcurrent inserts will need to wait. This way the log can\nbe safely used to restore data.\n \nConcurrent inserts is not used by slaves with the row based\nreplication (see binary log formats).\n \nIf an INSERT statement contain the HIGH_PRIORITY clause,\nconcurrent inserts cannot be used. INSERT ... DELAYED is\nusually unneeded if concurrent inserts are enabled.\n \nLOAD DATA INFILE uses concurrent inserts if the CONCURRENT\nkeyword is specified and concurrent_insert is not NEVER.\nThis makes the statement slower (even if no other sessions\naccess the table) but reduces contention.\n \nLOCK TABLES allows non-conflicting concurrent inserts if a\nREAD LOCAL lock is used. Concurrent inserts are not allowed\nif the LOCAL keyword is omitted.\n \nNotes\n \nThe decision to enable concurrent insert for a table is done\nwhen the table is opened. If you change the value of\nconcurrent_insert it will only affect new opened tables. If\nyou want it to work for also for tables in use or cached,\nyou should do FLUSH TABLES after setting the variable.\n \n\n\nURL: https://mariadb.com/kb/en/library/concurrent-inserts/','','https://mariadb.com/kb/en/library/concurrent-inserts/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (408,27,'DELETE','Syntax\n------ \nSingle-table syntax:\n \nDELETE [LOW_PRIORITY] [QUICK] [IGNORE] \n FROM tbl_name [PARTITION (partition_list)]\n [WHERE where_condition]\n [ORDER BY ...]\n [LIMIT row_count]\n [RETURNING select_expr \n [, select_expr ...]]\n \nMultiple-table syntax:\n \nDELETE [LOW_PRIORITY] [QUICK] [IGNORE]\n tbl_name[.*] [, tbl_name[.*]] ...\n FROM table_references\n [WHERE where_condition]\n \nOr:\n \nDELETE [LOW_PRIORITY] [QUICK] [IGNORE]\n FROM tbl_name[.*] [, tbl_name[.*]] ...\n USING table_references\n [WHERE where_condition]\n \nTrimming history:\n \nDELETE HISTORY\n FROM tbl_name [PARTITION (partition_list)]\n [BEFORE SYSTEM_TIME [TIMESTAMP|TRANSACTION] expression]\n \nDescription\n----------- \nOption | Description | \n \nLOW_PRIORITY | Wait until all SELECT\'s are done before\nstarting the statement. Used with storage engines that uses\ntable locking (MyISAM, Aria etc). See HIGH_PRIORITY and\nLOW_PRIORITY clauses for details. | \n \nQUICK | Signal the storage engine that it should expect that\na lot of rows are deleted. The storage engine engine can do\nthings to speed up the DELETE like ignoring merging of data\nblocks until all rows are deleted from the block (instead of\nwhen a block is half full). This speeds up things at the\nexpanse of lost space in data blocks. At least MyISAM and\nAria support this feature. | \n \nIGNORE | Don\'t stop the query even if a not-critical error\noccurs (like data overflow). See How IGNORE works for a full\ndescription. | \n \nFor the single-table syntax, the DELETE statement deletes\nrows\nfrom tbl_name and returns a count of the number of deleted\nrows. This count can\nbe obtained by calling the ROW_COUNT() function. The\nWHERE clause, if given, specifies the conditions that\nidentify\nwhich rows to delete. With no WHERE clause, all rows are\ndeleted. If the ORDER BY clause is specified, the rows are\ndeleted in the order that is specified. The LIMIT clause\nplaces a limit on the number of rows that can be deleted.\n \nFor the multiple-table syntax, DELETE deletes from each\ntbl_name the rows that satisfy the conditions. In this case,\nORDER BY and LIMIT> cannot be used. A DELETE can also\nreference tables which are located in different databases;\nsee Identifier Qualifiers for the syntax.\n \nwhere_condition is an expression that evaluates to true for\neach row to be deleted. It is specified as described in\nSELECT.\n \nCurrently, you cannot delete from a table and select from\nthe same\ntable in a subquery.\n \nYou need the DELETE privilege on a table to delete rows from\nit. You need only the SELECT privilege for any columns that\nare only read, such as those named in the WHERE clause. See\nGRANT.\n \nThe PARTITION clause was introduced in MariaDB 10.0. See\nPartition Pruning and Selection for details.\n \nAs stated, a DELETE statement with no WHERE\nclause deletes all rows. A faster way to do this, when you\ndo not need to know\nthe number of deleted rows, is to use TRUNCATE TABLE.\nHowever,\nwithin a transaction or if you have a lock on the table, \nTRUNCATE TABLE cannot be used whereas DELETE\ncan. See TRUNCATE TABLE, and\nLOCK.\n \nFrom MariaDB 10.0.5, it is possible to return a resultset of\nthe deleted rows for a single table to the client by using\nthe syntax DELETE ... RETURNING select_expr [, select_expr2\n...]]\n \nAny of SQL expression that can be calculated from a single\nrow fields is allowed. Subqueries are allowed. The AS\nkeyword is allowed, so it is possible to use aliases.\n \nThe use of aggregate functions is not allowed. RETURNING\ncannot be used in multi-table DELETEs.\n \nSame Source and Target Table\n \nUntil MariaDB 10.3.1, deleting from a table with the same\nsource and target was not possible. From MariaDB 10.3.1,\nthis is now possible. For example:\n \nDELETE FROM t1 WHERE c1 IN (SELECT b.c1 FROM t1 b WHERE\nb.c2=0);\n \nOne can use DELETE HISTORY to delete historical information\nfrom System-versioned tables.\n \nExamples\n-------- \nHow to use the ORDER BY and LIMIT clauses:\n \nDELETE FROM page_hit ORDER BY timestamp LIMIT 1000000;\n \nHow to use the RETURNING clause:\n \nDELETE FROM t RETURNING f1;\n \n+------+\n| f1 |\n+------+\n| 5 |\n| 50 |\n| 500 |\n+------+ \n \nThe following statement joins two tables: one is only used\nto satisfy a WHERE condition, but no row is deleted from it;\nrows from the other table are deleted, instead.\n \nDELETE post FROM blog INNER JOIN post WHERE blog.id =\npost.blog_id;\n \nDeleting from the Same Source and Target\n \nCREATE TABLE t1 (c1 INT, c2 INT);\nDELETE FROM t1 WHERE c1 IN (SELECT b.c1 FROM t1 b WHERE\nb.c2=0);\n \nUntil MariaDB 10.3.1, this returned:\n \nERROR 1093 (HY000): Table \'t1\' is specified twice, both as\na target for \'DELETE\' \n and as a separate source for\n \nFrom MariaDB 10.3.1:\n \nQuery OK, 0 rows affected (0.00 sec)\n \n\n\nURL: https://mariadb.com/kb/en/library/delete/','','https://mariadb.com/kb/en/library/delete/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (409,27,'DO','Syntax\n------ \nDO expr [, expr] ...\n \nDescription\n----------- \n DO executes the expressions but does not return any\nresults. In most respects, DO is shorthand for\n SELECT expr, ..., but has the advantage that it is slightly\nfaster when you do not care about the result.\n \n DO is useful primarily with functions that have side\n effects, such as RELEASE_LOCK().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/do/','','https://mariadb.com/kb/en/library/do/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (410,27,'DUAL','Description\n----------- \nYou are allowed to specify DUAL as a dummy table name in\nsituations where no tables are referenced, such as the\nfollowing SELECT statement:\n \nSELECT 1 + 1 FROM DUAL;\n \n+-------+\n| 1 + 1 |\n+-------+\n| 2 |\n+-------+\n \n DUAL is purely for the convenience of people who require\n that all SELECT statements should have\n FROM and possibly other clauses. MariaDB ignores the\n clauses. MariaDB does not require FROM DUAL if no tables\n are referenced.\n \nFROM DUAL could be used when you only SELECT computed\nvalues, but require a WHERE clause, perhaps to test that a\nscript correctly handles empty resultsets:\n \nSELECT 1 FROM DUAL WHERE FALSE;\n \nEmpty set (0.00 sec)\n \n\n\nURL: https://mariadb.com/kb/en/library/dual/','','https://mariadb.com/kb/en/library/dual/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (411,27,'EXCEPT','EXCEPT was introduced in MariaDB 10.3.0.\n \nThe result of EXCEPT is all records of the left SELECT\nresult set except records which are in right SELECT result\nset, i.e. it is subtraction of two result sets.\n \nSyntax\n------ \nSELECT ...\n(INTERSECT | EXCEPT | UNION [ALL | DISTINCT]) SELECT ...\n[(INTERSECT | EXCEPT | UNION [ALL | DISTINCT]) SELECT ...]\n[ORDER BY [column [, column ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n \nPlease note:\nALL is not supported by EXCEPT (and it is difficult to make\nsense of ALL with EXCEPT).\nBrackets for explicit operation precedence are not\nsupported; use a subquery in the FROM clause as a\nworkaround).\n \nDescription\n----------- \nMariaDB has supported EXCEPT and INTERSECT in addition to\nUNION since MariaDB 10.3.\n \nAll behavior for naming columns, ORDER BY and LIMIT is the\nsame as for UNION.\n \nEXCEPT implicitly supposes a DISTINCT operation.\n \nThe result of EXCEPT is all records of the left SELECT\nresult except records which are in right SELECT result set,\ni.e. it is subtraction of two result sets.\n \nEXCEPT and UNION have the same operation precedence.\n \n\nParentheses\n \nFrom MariaDB 10.4.0, parentheses can be used to specify\nprecedence. Before this, a syntax error would be returned.\n \nExamples\n-------- \nShow customers which are not employees:\n \n(SELECT e_name AS name, email FROM customers)\nEXCEPT\n(SELECT c_name AS name, email FROM employees);\n \nDifference between UNION, EXCEPT and INTERSECT:\n \nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(3),(4),(5),(6);\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 3 |\n+------+\n \nParentheses for specifying precedence, from MariaDB 10.4.0\n \nCREATE OR REPLACE TABLE t1 (a INT);\nCREATE OR REPLACE TABLE t2 (b INT);\nCREATE OR REPLACE TABLE t3 (c INT);\n \nINSERT INTO t1 VALUES (1),(2),(3),(4);\nINSERT INTO t2 VALUES (5),(6);\nINSERT INTO t3 VALUES (1),(6);\n \n((SELECT a FROM t1) UNION (SELECT b FROM t2)) EXCEPT (SELECT\nc FROM t3);\n+------+\n| a |\n+------+\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n+------+\n \n(SELECT a FROM t1) UNION ((SELECT b FROM t2) EXCEPT (SELECT\nc FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/except/','','https://mariadb.com/kb/en/library/except/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (412,27,'FOR UPDATE','The FOR UPDATE clause of SELECT applies only when autocommit\nis set to 0 or the SELECT is enclosed in a transaction. A\nlock is acquired on the rows, and other transactions are\nprevented from writing the rows, acquire locks, and from\nreading them (unless their isolation level is READ\nUNCOMMITTED).\n \nIf autocommit is set to 1, the LOCK IN SHARE MODE and FOR\nUPDATE clauses have no effect.\n \nIf the isolation level is set to SERIALIZABLE, all plain\nSELECT statements are converted to SELECT ... LOCK IN SHARE\nMODE.\n \nExample\n \nSELECT * FROM trans WHERE period=2001 FOR UPDATE;\n \n\n\nURL: https://mariadb.com/kb/en/library/for-update/','','https://mariadb.com/kb/en/library/for-update/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (413,27,'GROUP BY','Use the GROUP BY clause in a SELECT statement to group rows\ntogether that have the same value in one or more column, or\nthe same computed value using expressions with any\nfunctions and operators except\ngrouping functions. When you\nuse a GROUP BY clause, you will get a single result row for\neach group of rows\nthat have the same value for the expression given in GROUP\nBY.\n \nWhen grouping rows, grouping values are compared as if by\nthe = operator.\nFor string values, the = operator ignores trailing\nwhitespace and may normalize\ncharacters and ignore case, depending on the collation in\nuse.\n \nYou can use any of the grouping functions in your select\nexpression. Their values will\nbe calculated based on all the rows that have been grouped\ntogether for each result\nrow. If you select a non-grouped column or a value computed\nfrom a non-grouped\ncolumn, it is undefined which row the returned value is\ntaken from. This is not permitted if the ONLY_FULL_GROUP_BY\nSQL_MODE is used.\n \nYou can use multiple expressions in the GROUP BY clause,\nseparated by commas.\nRows are grouped together if they match on each of the\nexpressions.\n \nYou can also use a single integer as the grouping\nexpression. If you use an integer n,\nthe results will be grouped by the nth column in the select\nexpression.\n \nThe WHERE clause is applied before the GROUP BY clause. It\nfilters non-aggregated\nrows before the rows are grouped together. To filter grouped\nrows based on aggregate values,\nuse the HAVING clause. The HAVING clause takes any\nexpression and evaluates it as\na boolean, just like the WHERE clause. You can use grouping\nfunctions in the HAVING\nclause. As with the select expression, if you reference\nnon-grouped columns in the HAVING\nclause, the behavior is undefined.\n \nBy default, if a GROUP BY clause is present, the rows in the\noutput will be sorted by the expressions used in the GROUP\nBY. You can also specify ASC or DESC (ascending, descending)\nafter those expressions, like in ORDER BY. The default is\nASC.\n \nIf you want the rows to be sorted by another field, you can\nadd an explicit ORDER BY. If you don\'t want the result to\nbe ordered, you can add ORDER BY NULL.\n \nWITH ROLLUP\n \nThe WITH ROLLUP modifer adds extra rows to the resultset\nthat represent super-aggregate summaries. For a full\ndescription with examples, see SELECT WITH ROLLUP.\n \nGROUP BY Examples\n \nConsider the following table that records how many times\neach user has played and won a game:\n \nCREATE TABLE plays (name VARCHAR(16), plays INT, wins INT);\nINSERT INTO plays VALUES \n (\"John\", 20, 5), \n (\"Robert\", 22, 8), \n (\"Wanda\", 32, 8), \n (\"Susan\", 17, 3);\n \nGet a list of win counts along with a count:\n \nSELECT wins, COUNT(*) FROM plays GROUP BY wins;\n \n+------+----------+\n| wins | COUNT(*) |\n+------+----------+\n| 3 | 1 |\n| 5 | 1 |\n| 8 | 2 |\n+------+----------+\n3 rows in set (0.00 sec)\n \nThe GROUP BY expression can be a computed value, and can\nrefer back to an identifer\nspecified with AS. Get a list of win averages along with a\ncount:\n \nSELECT (wins / plays) AS winavg, COUNT(*) FROM plays GROUP\nBY winavg;\n \n+--------+----------+\n| winavg | COUNT(*) |\n+--------+----------+\n| 0.1765 | 1 |\n| 0.2500 | 2 |\n| 0.3636 | 1 |\n+--------+----------+\n3 rows in set (0.00 sec)\n \nYou can use any grouping function\nin the select expression. For each win average as above, get\na list of the average play\ncount taken to get that average:\n \nSELECT (wins / plays) AS winavg, AVG(plays) FROM plays \n GROUP BY winavg;\n \n+--------+------------+\n| winavg | AVG(plays) |\n+--------+------------+\n| 0.1765 | 17.0000 |\n| 0.2500 | 26.0000 |\n| 0.3636 | 22.0000 |\n+--------+------------+\n3 rows in set (0.00 sec)\n \nYou can filter on aggregate information using the HAVING\nclause. The HAVING\nclause is applied after GROUP BY and allows you to filter on\naggregate data that is\nnot available to the WHERE clause. Restrict the above\nexample to results that involve\nan average number of plays over 20:\n \nSELECT (wins / plays) AS winavg, AVG(plays) FROM plays \n GROUP BY winavg HAVING AVG(plays) > 20;\n \n+--------+------------+\n| winavg | AVG(plays) |\n+--------+------------+\n| 0.2500 | 26.0000 |\n| 0.3636 | 22.0000 |\n+--------+------------+\n2 rows in set (0.00 sec)\n \nSee Also\n \nSELECT\nJoins and Subqueries\nLIMIT\nORDER BY\nCommon Table Expressions\nSELECT WITH ROLLUP\nSELECT INTO OUTFILE\nSELECT INTO DUMPFILE\nFOR UPDATE\nLOCK IN SHARE MODE\nOptimizer Hints\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/group-by/','','https://mariadb.com/kb/en/library/group-by/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (414,27,'HANDLER Commands','Syntax\n------ \nHANDLER tbl_name OPEN [ [AS] alias]\nHANDLER tbl_name READ index_name { = | >= | = | \n\nURL: https://mariadb.com/kb/en/library/handler-commands/','','https://mariadb.com/kb/en/library/handler-commands/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (415,27,'HIGH_PRIORITY and LOW_PRIORITY','The XtraDB/InnoDB storage engine uses row-level locking to\nensure data integrity. However some storage engines (such as\nMEMORY, MyISAM, Aria and MERGE) lock the whole table to\nprevent conflicts. These storage engines use two separate\nqueues to remember pending statements; one is for SELECTs\nand the other one is for write statements (INSERT, DELETE,\nUPDATE). By default, the latter has a higher priority.\n \nTo give write operations a lower priority, the\nlow_priority_updates server system variable can be set to\nON. The option is available on both the global and session\nlevels, and it can be set at startup or via the SET\nstatement.\n \nWhen too many table locks have been set by write statements,\nsome pending SELECTs are executed. The maximum number of\nwrite locks that can be acquired before this happens is\ndetermined by the max_write_lock_count server system\nvariable, which is dynamic.\n \nIf write statements have a higher priority (default), the\npriority of individual write statements (INSERT, REPLACE,\nUPDATE, DELETE) can be changed via the LOW_PRIORITY\nattribute, and the priority of a SELECT statement can be\nraised via the HIGH_PRIORITY attribute. Also, LOCK TABLES\nsupports a LOW_PRIORITY attribute for WRITE locks.\n \nIf read statements have a higher priority, the priority of\nan INSERT can be changed via the HIGH_PRIORITY attribute.\nHowever, the priority of other write statements cannot be\nraised individually.\n \nThe use of LOW_PRIORITY or HIGH_PRIORITY for an INSERT\nprevents Concurrent Inserts from being used.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/high_priority-and-low_priority/','','https://mariadb.com/kb/en/library/high_priority-and-low_priority/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (416,27,'IGNORE','The IGNORE option tells the server to ignore some common\nerrors.\n \nIGNORE can be used with the following statements:\nDELETE\nINSERT (see also INSERT IGNORE)\nLOAD DATA INFILE\nUPDATE\nALTER TABLE\nCREATE TABLE ... SELECT\nINSERT ... SELECT\n \nThe logic used:\nVariables out of ranges are replaced with the\nmaximum/minimum value.\n \nSQL_MODEs STRICT_TRANS_TABLES, STRICT_ALL_TABLES,\nNO_ZERO_IN_DATE, NO_ZERO_DATE are ignored.\n \nInserting NULL in a NOT NULL field will insert 0 ( in a\nnumerical\n field), 0000-00-00 ( in a date field) or an empty string (\nin a character\n field).\n \nRows that cause a duplicate key error or break a foreign key\nconstraint are\n not inserted, updated, or deleted.\n \nThe following errors are ignored:\n \nError number | Symbolic error name | Description | \n \n1022 | ER_DUP_KEY | Can\'t write; duplicate key in table\n\'%s\' | \n \n1048 | ER_BAD_NULL_ERROR | Column \'%s\' cannot be null | \n \n1062 | ER_DUP_ENTRY | Duplicate entry \'%s\' for key %d | \n \n1242 | ER_SUBQUERY_NO_1_ROW | Subquery returns more than 1\nrow | \n \n1264 | ER_WARN_DATA_OUT_OF_RANGE | Out of range value for\ncolumn \'%s\' at row %ld | \n \n1265 | WARN_DATA_TRUNCATED | Data truncated for column\n\'%s\' at row %ld | \n \n1292 | ER_TRUNCATED_WRONG_VALUE | Truncated incorrect %s\nvalue: \'%s\' | \n \n1366 | ER_TRUNCATED_WRONG_VALUE_FOR_FIELD | Incorrect\ninteger value | \n \n1369 | ER_VIEW_CHECK_FAILED | CHECK OPTION failed \'%s.%s\'\n| \n \n1451 | ER_ROW_IS_REFERENCED_2 | Cannot delete or update a\nparent row | \n \n1452 | ER_NO_REFERENCED_ROW_2 | Cannot add or update a child\nrow: a foreign key constraint fails (%s) | \n \n1526 | ER_NO_PARTITION_FOR_GIVEN_VALUE | Table has no\npartition for value %s | \n \n1586 | ER_DUP_ENTRY_WITH_KEY_NAME | Duplicate entry \'%s\'\nfor key \'%s\' | \n \n1591 | ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT | Table has no\npartition for some existing values | \n \n1748 | ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET | Found a\nrow not matching the given partition set | \n \nIgnored errors normally generate a warning.\n \nA property of the IGNORE clause consists in causing\ntransactional engines and non-transactional engines (like\nXtraDB and Aria) to behave the same way. For example,\nnormally a multi-row insert which tries to violate a UNIQUE\ncontraint is completely rolled back on XtraDB/InnoDB, but\nmight be partially executed on Aria. With the IGNORE clause,\nthe statement will be partially executed in both engines.\n \nStarting from MariaDB 5.5.28 duplicate key errors also\ngenerate warnings. The OLD_MODE server variable can be used\nto prevent this.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/ignore/','','https://mariadb.com/kb/en/library/ignore/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (417,27,'INSERT','Syntax\n------ \nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nOr:\n \nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nOr:\n \nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nThe INSERT statement is used to insert new rows into an\nexisting table. The INSERT ... VALUES\nand INSERT ... SET forms of the statement insert rows based\non explicitly specified values. The INSERT ... SELECT form\ninserts rows selected from another table or tables. INSERT\n... SELECT is discussed further in the INSERT ... SELECT\narticle.\n \nThe table name can be specified in the form db_name.tbl_name\nor, if a default database is selected, in the form tbl_name\n(see Identifier Qualifiers). This allows to use INSERT ...\nSELECT to copy rows between different databases.\n \nThe PARTITION clause was introduced in MariaDB 10.0. It can\nbe used in both the INSERT and the SELECT part. See\nPartition Pruning and Selection for details.\n \nThe columns list is optional. It specifies which values are\nexplicitly inserted, and in which order. If this clause is\nnot specified, all values must be explicitly specified, in\nthe same order they are listed in the table definition.\n \nThe list of value follow the VALUES or VALUE keyword (which\nare interchangeable, regardless how much values you want to\ninsert), and is wrapped by parenthesis. The values must be\nlisted in the same order as the columns list. It is possible\nto specify more than one list to insert more than one rows\nwith a single statement. If many rows are inserted, this is\na speed optimization.\n \nFor one-row statements, the SET clause may be more simple,\nbecause you don\'t need to remember the columns order. All\nvalues are specified in the form col = expr.\n \nValues can also be specified in the form of a SQL expression\nor subquery. However, the subquery cannot access the same\ntable that is named in the INTO clause.\n \nIf you use the LOW_PRIORITY keyword, execution of the INSERT\nis delayed until no other clients are reading from the\ntable. If you use the HIGH_PRIORITY keyword, the statement\nhas the same priority as SELECTs. This affects only storage\nengines that use only table-level locking (MyISAM, MEMORY,\nMERGE). However, if one of these keywords is specified,\nconcurrent inserts cannot be used. See HIGH_PRIORITY and\nLOW_PRIORITY clauses for details.\n \nINSERT DELAYED\n \nFor more details on the DELAYED option, see INSERT DELAYED.\n \nHIGH PRIORITY and LOW PRIORITY\n \nSee HIGH_PRIORITY and LOW_PRIORITY.\n \nDefaults and Duplicate Values\n \nSee INSERT - Default & Duplicate Values for details..\n \nINSERT IGNORE\n \nSee INSERT IGNORE.\n \nINSERT ON DUPLICATE KEY UPDATE\n \nSee INSERT ON DUPLICATE KEY UPDATE.\n \nExamples\n-------- \nSpecifying the column names:\n \nINSERT INTO person (first_name, last_name) VALUES (\'John\',\n\'Doe\');\n \nInserting more than 1 row at a time:\n \nINSERT INTO tbl_name VALUES (1, \"row 1\"), (2, \"row 2\");\n \nUsing the SET clause:\n \nINSERT INTO person SET first_name = \'John\', last_name =\n\'Doe\';\n \nSELECTing from another table:\n \nINSERT INTO contractor SELECT * FROM person WHERE status =\n\'c\';\n \nSee INSERT ON DUPLICATE KEY UPDATE and INSERT IGNORE for\nfurther examples.\n \n\n\nURL: https://mariadb.com/kb/en/library/insert/','','https://mariadb.com/kb/en/library/insert/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (418,27,'INSERT - Default & Duplicate Values','Default Values\n \nIf the SQL_MODE contains STRICT_TRANS_TABLES and you are\ninserting into a transactional table (like InnoDB), or if\nthe SQL_MODE contains STRICT_ALL_TABLES, all NOT NULL\ncolumns which does not have a DEFAULT value (and is not\nAUTO_INCREMENT) must be explicitly referenced in INSERT\nstatements. If not, an error like this is produced:\n \nERROR 1364 (HY000): Field \'col\' doesn\'t have a default\nvalue\n \nIn all other cases, if a NOT NULL column without a DEFAULT\nvalue is not referenced, an empty value will be inserted\n(for example, 0 for INTEGER columns and \'\' for CHAR\ncolumns). See NULL Values in MariaDB:Inserting for examples.\n \nIf a NOT NULL column having a DEFAULT value is not\nreferenced, NULL will be inserted.\n \nIf a NULL column having a DEFAULT value is not referenced,\nits default value will be inserted. It is also possible to\nexplicitly assign the default value using the DEFAULT\nkeyword or the DEFAULT() function.\n \nIf the DEFAULT keyword is used but the column does not have\na DEFAULT value, an error like this is produced:\n \nERROR 1364 (HY000): Field \'col\' doesn\'t have a default\nvalue\n \nDuplicate Values\n \nBy default, if you try to insert a duplicate row and there\nis a UNIQUE index, INSERT stops and an error like this is\nproduced:\n \nERROR 1062 (23000): Duplicate entry \'dup_value\' for key\n\'col\'\n \nTo handle duplicates you can use the IGNORE clause, INSERT\nON DUPLICATE KEY UPDATE or the REPLACE statement. Note that\nthe IGNORE and DELAYED options are ignored when you use ON\nDUPLICATE KEY UPDATE.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/insert-default-duplicate-values/','','https://mariadb.com/kb/en/library/insert-default-duplicate-values/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (419,27,'INSERT DELAYED','Syntax\n------ \nINSERT DELAYED ...\n \nDescription\n----------- \nThe DELAYED option for the INSERT\nstatement is a MariaDB/MySQL extension to standard SQL that\nis very useful if you have\nclients that cannot or need not wait for the INSERT to\ncomplete. This is a common situation when you use MariaDB\nfor logging and you\nalso periodically run SELECT and UPDATE\nstatements that take a long time to complete.\n \nWhen a client uses INSERT DELAYED, it gets an okay from the\nserver at once, and the row is queued to be inserted when\nthe table is not in\nuse by any other thread.\n \nAnother major benefit of using INSERT DELAYED is that\ninserts from many clients are bundled together and written\nin one block. This\nis much faster than performing many separate inserts.\n \nNote that INSERT DELAYED is slower than a normal\n INSERT if the table is not otherwise in use. There is also\nthe additional overhead for the server to handle a separate\nthread for each\ntable for which there are delayed rows. This means that you\nshould use\nINSERT DELAYED only when you are really sure that you need\nit.\n \nThe queued rows are held only in memory until they are\ninserted into the table.\nThis means that if you terminate mysqld forcibly (for\nexample, with kill -9) or\nif mysqld dies unexpectedly, any queued rows that have not\nbeen written to disk\nare lost.\n \nThe number of concurrent INSERT DELAYED threads is limited\nby the max_delayed_threads server system variables. If it is\nset to 0, INSERT DELAYED is disabled. The session value can\nbe equal to the global value, or 0 to disable this statement\nfor the current session. If this limit has been reached, the\nDELAYED clause will be silently ignore for subsequent\nstatements (no error will be produced).\n \nThere are some constraints on the use of DELAYED:\nINSERT DELAYED works only with MyISAM, MEMORY, ARCHIVE,\n and BLACKHOLE tables. If you execute INSERT DELAYED with\nanother storage engine, you will get an error like this:\nERROR 1616 (HY000): DELAYED option not supported for table\n\'tab_name\'\nFor MyISAM tables, if there are no free blocks in the middle\nof the data\n file, concurrent SELECT and INSERT statements are\nsupported. Under these\n circumstances, you very seldom need to use INSERT DELAYED\n with MyISAM.\nINSERT DELAYED should be used only for\n INSERT statements that specify value lists. The server\n ignores DELAYED for INSERT ... SELECT\n or INSERT ... ON DUPLICATE KEY UPDATE statements.\nBecause the INSERT DELAYED statement returns immediately,\n before the rows are inserted, you cannot use\n LAST_INSERT_ID() to get the\n AUTO_INCREMENT value that the statement might generate.\nDELAYED rows are not visible to SELECT\n statements until they actually have been inserted.\nAfter INSERT DELAYED, ROW_COUNT() returns the number of the\nrows you tried to insert, not the number of the successful\nwrites.\nDELAYED is ignored on slave replication servers, so that \n INSERT DELAYED is treated as a normal\n INSERT on slaves. This is because\n DELAYED could cause the slave to have different data than\n the master. INSERT DELAYED statements are not safe for\nreplication.\nPending INSERT DELAYED statements are lost if a table is\n write locked and ALTER TABLE is used to modify the table\nstructure.\nINSERT DELAYED is not supported for views. If you try, you\nwill get an error like this: ERROR 1347 (HY000):\n\'view_name\' is not BASE TABLE\nINSERT DELAYED is not supported for partitioned tables.\nINSERT DELAYED is not supported within stored programs.\n \n\n\nURL: https://mariadb.com/kb/en/library/insert-delayed/','','https://mariadb.com/kb/en/library/insert-delayed/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (420,27,'INSERT IGNORE','Ignoring Errors\n \nNormally INSERT stops and rolls back when it encounters an\nerror.\n \nBy using the IGNORE keyword all errors are converted to\nwarnings, which will not stop inserts of additional rows.\n \nThe IGNORE and DELAYED options are ignored when you use ON\nDUPLICATE KEY UPDATE.\n \nIncompatibilities\n \nMariaDB until 5.5.28\nMySQL and MariaDB before 5.5.28 didn\'t give warnings for\nduplicate key errors when using IGNORE.\nYou can get the old behaviour if you set OLD_MODE to\nNO_DUP_KEY_WARNINGS_WITH_IGNORE\n \nExamples\n-------- \nCREATE TABLE t1 (x INT UNIQUE);\n \nINSERT INTO t1 VALUES(1),(2);\n \nINSERT INTO t1 VALUES(2),(3);\nERROR 1062 (23000): Duplicate entry \'2\' for key \'x\'\nSELECT * FROM t1;\n \n+------+\n| x |\n+------+\n| 1 |\n| 2 |\n+------+\n2 rows in set (0.00 sec)\n \nINSERT IGNORE INTO t1 VALUES(2),(3);\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n \nSHOW WARNINGS;\n \n+---------+------+---------------------------------+\n| Level | Code | Message |\n+---------+------+---------------------------------+\n| Warning | 1062 | Duplicate entry \'2\' for key \'x\' |\n+---------+------+---------------------------------+\n \nSELECT * FROM t1;\n \n+------+\n| x |\n+------+\n| 1 |\n| 2 |\n| 3 |\n+------+\n \nSee INSERT ON DUPLICATE KEY UPDATE for further examples\nusing that syntax.\n \n\n\nURL: https://mariadb.com/kb/en/library/insert-ignore/','','https://mariadb.com/kb/en/library/insert-ignore/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (421,27,'INSERT ON DUPLICATE KEY UPDATE','Syntax\n------ \nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nOr:\n \nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nOr:\n \nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n \nDescription\n----------- \nINSERT ... ON DUPLICATE KEY UPDATE is a MariaDB/MySQL\nextension to the INSERT statement that, if it finds a\nduplicate unique or primary key, will instead perform an\nUPDATE.\n \nThe row/s affected value is reported as 1 if a row is\ninserted, and 2 if a row is updated, unless the API\'s\nCLIENT_FOUND_ROWS flag is set.\n \nIf more than one unique index is matched, only the first is\nupdated. It is not recommended to use this statement on\ntables with more than one unique index.\n \nIf the table has an AUTO_INCREMENT primary key and the\nstatement inserts or updates a row, the LAST_INSERT_ID()\nfunction returns its AUTO_INCREMENT value.\n \nThe VALUES() function can only be used in a ON DUPLICATE KEY\nUPDATE clause and has no meaning in any other context. It\nreturns the column values from the INSERT portion of the\nstatement. This function is particularly useful for\nmulti-rows inserts.\n \nThe IGNORE and DELAYED options are ignored when you use ON\nDUPLICATE KEY UPDATE.\n \nThe PARTITION clause was introduced in MariaDB 10.0. See\nPartition Pruning and Selection for details.\n \nThis statement activates INSERT and UPDATE triggers. See\nTrigger Overview for details.\n \nSee also a similar statement, REPLACE.\n \nExamples\n-------- \nCREATE TABLE ins_duplicate (id INT PRIMARY KEY, animal\nVARCHAR(30));\nINSERT INTO ins_duplicate VALUES (1,\'Aardvark\'),\n(2,\'Cheetah\'), (3,\'Zebra\');\n \nIf there is no existing key, the statement runs as a regular\nINSERT:\n \nINSERT INTO ins_duplicate VALUES (4,\'Gorilla\') ON\nDUPLICATE KEY UPDATE animal=\'Gorilla\';\nQuery OK, 1 row affected (0.07 sec)\n \nSELECT * FROM ins_duplicate;\n+----+----------+\n| id | animal |\n+----+----------+\n| 1 | Aardvark |\n| 2 | Cheetah |\n| 3 | Zebra |\n| 4 | Gorilla |\n+----+----------+\n \nA regular INSERT with a primary key value of 1 will fail,\ndue to the existing key:\n \nINSERT INTO ins_duplicate VALUES (1,\'Antelope\');\nERROR 1062 (23000): Duplicate entry \'1\' for key\n\'PRIMARY\'\n \nHowever, we can use an INSERT ON DUPLICATE KEY UPDATE\ninstead:\n \nINSERT INTO ins_duplicate VALUES (1,\'Antelope\') ON\nDUPLICATE KEY UPDATE animal=\'Antelope\';\nQuery OK, 2 rows affected (0.09 sec)\n \nNote that there are two rows reported as affected, but this\nrefers only to the UPDATE.\n \nSELECT * FROM ins_duplicate;\n+----+----------+\n| id | animal |\n+----+----------+\n| 1 | Antelope |\n| 2 | Cheetah |\n| 3 | Zebra |\n| 4 | Gorilla |\n+----+----------+\n \nAdding a second unique column:\n \nALTER TABLE ins_duplicate ADD id2 INT;\nUPDATE ins_duplicate SET id2=id+10;\nALTER TABLE ins_duplicate ADD UNIQUE KEY(id2);\n \nWhere two rows match the unique keys match, only the first\nis updated. This can be unsafe and is not recommended unless\nyou are certain what you are doing. Note that the warning\nshown below appears in MariaDB 5.5 and before, but has been\nremoved in MariaDB 10.0, as MariaDB now assumes that the\nkeys are checked in order, as shown in SHOW CREATE TABLE.\n \nINSERT INTO ins_duplicate VALUES (2,\'Lion\',13) ON\nDUPLICATE KEY UPDATE animal=\'Lion\';\nQuery OK, 2 rows affected, 1 warning (0.06 sec)\n \nSHOW WARNINGS;\n+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| Note | 1592 | Unsafe statement written to the binary log\nusing statement format since BINLOG_FORMAT = STATEMENT.\nINSERT... ON DUPLICATE KEY UPDATE on a table with more than\none UNIQUE KEY is unsafe |\n+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n \nSELECT * FROM ins_duplicate;\n+----+----------+------+\n| id | animal | id2 |\n+----+----------+------+\n| 1 | Antelope | 11 |\n| 2 | Lion | 12 |\n| 3 | Zebra | 13 |\n| 4 | Gorilla | 14 |\n+----+----------+------+\n \nAlthough the third row with an id of 3 has an id2 of 13,\nwhich also matched, it was not updated.\n \nChanging id to an auto_increment field. If a new row is\nadded, the auto_increment is moved forward. If the row is\nupdated, it remains the same.\n \nALTER TABLE `ins_duplicate` CHANGE `id` `id` INT( 11 ) NOT\nNULL AUTO_INCREMENT;\nALTER TABLE ins_duplicate DROP id2;\nSELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES WHERE\nTABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 5 |\n+----------------+\n \nINSERT INTO ins_duplicate VALUES (2,\'Leopard\') ON\nDUPLICATE KEY UPDATE animal=\'Leopard\';\nQuery OK, 2 rows affected (0.00 sec)\n \nSELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES WHERE\nTABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 5 |\n+----------------+\n \nINSERT INTO ins_duplicate VALUES (5,\'Wild Dog\') ON\nDUPLICATE KEY UPDATE animal=\'Wild Dog\';\nQuery OK, 1 row affected (0.09 sec)\n \nSELECT * FROM ins_duplicate;\n+----+----------+\n| id | animal |\n+----+----------+\n| 1 | Antelope |\n| 2 | Leopard |\n| 3 | Zebra |\n| 4 | Gorilla |\n| 5 | Wild Dog |\n+----+----------+\n \nSELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES WHERE\nTABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 6 |\n+----------------+\n \nRefering to column values from the INSERT portion of the\nstatement: \n \nINSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6)\n ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);\n \nSee the VALUES() function for more.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/insert-on-duplicate-key-update/','','https://mariadb.com/kb/en/library/insert-on-duplicate-key-update/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (422,27,'INSERT SELECT','Syntax\n------ \nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]\n \nDescription\n----------- \nWith INSERT ... SELECT, you can quickly insert many rows\ninto a table from one or more other tables. For example:\n \nINSERT INTO tbl_temp2 (fld_id)\n SELECT tbl_temp1.fld_order_id\n FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;\n \ntbl_name can also be specified in the form db_name.tbl_name\n(see Identifier Qualifiers). This allows to copy rows\nbetween different databases.\n \nIf the new table has a primary key or UNIQUE indexes, you\ncan use IGNORE to handle duplicate key errors during the\nquery. The newer values will not be inserted if an identical\nvalue already exists.\n \nREPLACE can be used instead of INSERT to prevent duplicates\non UNIQUE indexes by deleting old values. In that case, ON\nDUPLICATE KEY UPDATE cannot be used.\n \nINSERT ... SELECT works for tables which already exist. To\ncreate a table for a given resultset, you can use CREATE\nTABLE ... SELECT.\n \n\n\nURL: https://mariadb.com/kb/en/library/insert-select/','','https://mariadb.com/kb/en/library/insert-select/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (423,27,'INTERSECT','INTERSECT was introduced in MariaDB 10.3.0.\n \nThe result of an intersect is the intersection of right and\nleft SELECT results, i.e. only records that are present in\nboth result sets will be included in the result of the\noperation.\n \nSyntax\n------ \nSELECT ...\n(INTERSECT | EXCEPT | UNION [ALL | DISTINCT]) SELECT ...\n[(INTERSECT | EXCEPT | UNION [ALL | DISTINCT]) SELECT ...]\n[ORDER BY [column [, column ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n \nPlease note:\nALL is not supported by INTERSECT (and it is difficult to\nmake sense of ALL with INTERSECT).\nBrackets for explicit operation precedence are not\nsupported; use a subquery in the FROM clause as a\nworkaround).\n \nDescription\n----------- \nMariaDB has supported INTERSECT (as well as EXCEPT) in\naddition to UNION since MariaDB 10.3.\n \nAll behavior for naming columns, ORDER BY and LIMIT is the\nsame as for UNION.\n \nINTERSECT implicitly supposes a DISTINCT operation.\n \nThe result of an intersect is the intersection of right and\nleft SELECT results, i.e. only records that are present in\nboth result sets will be included in the result of the\noperation.\n \nINTERSECT has higher precedence than UNION and EXCEPT. If\npossible it will be executed linearly but if not it will be\ntranslated to a subquery in the FROM clause:\n \n(select a,b from t1)\nunion\n(select c,d from t2)\nintersect\n(select e,f from t3)\nunion\n(select 4,4);\n \nwill be translated to:\n \n(select a,b from t1)\nunion\nselect c,d from\n ((select c,d from t2)\n intersect\n (select e,f from t3)) dummy_subselect\nunion\n(select 4,4)\n \n\n \nParentheses\n \nFrom MariaDB 10.4.0, parentheses can be used to specify\nprecedence. Before this, a syntax error would be returned.\n \nExamples\n-------- \nShow customers which are employees:\n \n(SELECT e_name AS name, email FROM employees)\nINTERSECT\n(SELECT c_name AS name, email FROM customers);\n \nDifference between UNION, EXCEPT and INTERSECT:\n \nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(3),(4),(5),(6);\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 3 |\n+------+\n \nParentheses for specifying precedence, from MariaDB 10.4.0\n \nCREATE OR REPLACE TABLE t1 (a INT);\nCREATE OR REPLACE TABLE t2 (b INT);\nCREATE OR REPLACE TABLE t3 (c INT);\n \nINSERT INTO t1 VALUES (1),(2),(3),(4);\nINSERT INTO t2 VALUES (5),(6);\nINSERT INTO t3 VALUES (1),(6);\n \n((SELECT a FROM t1) UNION (SELECT b FROM t2)) INTERSECT\n(SELECT c FROM t3);\n+------+\n| a |\n+------+\n| 1 |\n| 6 |\n+------+\n \n(SELECT a FROM t1) UNION ((SELECT b FROM t2) INTERSECT\n(SELECT c FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 6 |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/intersect/','','https://mariadb.com/kb/en/library/intersect/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (424,27,'JOIN Syntax','Description\n----------- \nMariaDB supports the following JOIN syntaxes for\nthe table_references part of SELECT statements and\nmultiple-table DELETE and UPDATE statements:\n \ntable_references:\n table_reference [, table_reference] ...\n \ntable_reference:\n table_factor\n | join_table\n \ntable_factor:\n tbl_name [PARTITION (partition_list)]\n [query_system_time_period_specification] [[AS] alias]\n[index_hint_list]\n | table_subquery [query_system_time_period_specification]\n[AS] alias\n | ( table_references )\n | { ON table_reference LEFT OUTER JOIN table_reference\n ON conditional_expr }\n \njoin_table:\n table_reference [INNER | CROSS] JOIN table_factor\n[join_condition]\n | table_reference STRAIGHT_JOIN table_factor\n | table_reference STRAIGHT_JOIN table_factor ON\nconditional_expr\n | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference\njoin_condition\n | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN\ntable_factor\n \njoin_condition:\n ON conditional_expr\n | USING (column_list)\n \nquery_system_time_period_specification:\n FOR SYSTEM_TIME AS OF point_in_time\n | FOR SYSTEM_TIME BETWEEN point_in_time AND point_in_time\n | FOR SYSTEM_TIME FROM point_in_time TO point_in_time\n | FOR SYSTEM_TIME ALL\n \npoint_in_time:\n [TIMESTAMP] expression\n | TRANSACTION expression\n \nindex_hint_list:\n index_hint [, index_hint] ...\n \nindex_hint:\n USE {INDEX|KEY}\n [{FOR {JOIN|ORDER BY|GROUP BY}] ([index_list])\n | IGNORE {INDEX|KEY}\n [{FOR {JOIN|ORDER BY|GROUP BY}] (index_list)\n | FORCE {INDEX|KEY}\n [{FOR {JOIN|ORDER BY|GROUP BY}] (index_list)\n \nindex_list:\n index_name [, index_name] ...\n \nA table reference is also known as a join expression.\n \nEach table can also be specified as db_name.tabl_name. This\nallows to write queries which involve multiple databases.\nSee Identifier Qualifiers for syntax details.\n \nThe syntax of table_factor is extended in comparison with\nthe\nSQL Standard. The latter accepts only table_reference, not a\nlist of them inside a pair of parentheses.\n \nThis is a conservative extension if we consider each comma\nin a list of\ntable_reference items as equivalent to an inner join. For\nexample:\n \nSELECT * FROM t1 LEFT JOIN (t2, t3, t4)\n ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n \nis equivalent to:\n \nSELECT * FROM t1 LEFT JOIN (t2 CROSS JOIN t3 CROSS JOIN t4)\n ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n \nIn MariaDB, CROSS JOIN is a syntactic equivalent to\nINNER JOIN (they can replace each other). In standard SQL,\nthey are not equivalent. INNER JOIN is used with an\nON clause, CROSS JOIN is used otherwise.\n \nIn general, parentheses can be ignored in join expressions\ncontaining only\ninner join operations. MariaDB also supports nested joins\n(see\nhttp://dev.mysql.com/doc/refman/5.1/en/nested-join-optimization.html).\n \nSee System-versioned tables for more information\nabout FOR SYSTEM_TIME syntax.\n \nIndex hints can be specified to affect how the MariaDB\noptimizer makes\nuse of indexes. For more information, see How to force query\nplans.\n \nExamples\n-------- \nSELECT left_tbl.*\n FROM left_tbl LEFT JOIN right_tbl ON left_tbl.id =\nright_tbl.id\n WHERE right_tbl.id IS NULL;\n \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/join-syntax/','','https://mariadb.com/kb/en/library/join-syntax/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (425,27,'LIMIT','Description\n----------- \nUse the LIMIT clause to restrict the number of returned\nrows. When you use a single\ninteger n with LIMIT, the first n rows will be returned. Use\nthe ORDER BY\nclause to control which rows come first. You can also select\na number of rows after an offset\nusing either of the following:\n \nLIMIT offset, row_count\nLIMIT row_count OFFSET offset\n \nWhen you provide an offset m with a limit n, the first m\nrows will be ignored, and the\nfollowing n rows will be returned.\n \nExecuting an UPDATE with the LIMIT clause is not safe for\nreplication.\n \nSince MariaDB 10.0.11, LIMIT 0 has been an exception to this\nrule (see MDEV-6170).\n \nBeginning in MariaDB 5.5.21, there is a LIMIT ROWS EXAMINED\noptimization which provides the\nmeans to terminate the execution of SELECT statements which\nexamine too\nmany rows, and thus use too many resources. See LIMIT ROWS\nEXAMINED.\n \nMulti-Table Updates\n \nUntil MariaDB 10.3.1, it was not possible to use LIMIT (or\nORDER BY) in a multi-table UPDATE statement. This\nrestriction was lifted in MariaDB 10.3.2.\n \nGROUP_CONCAT\n \nStarting from MariaDB 10.3.3, it is possible to use LIMIT\nwith GROUP_CONCAT().\n \nExamples\n-------- \nCREATE TABLE members (name VARCHAR(20));\nINSERT INTO members\nVALUES(\'Jagdish\'),(\'Kenny\'),(\'Rokurou\'),(\'Immaculada\');\n \nSELECT * FROM members;\n \n+------------+\n| name |\n+------------+\n| Jagdish |\n| Kenny |\n| Rokurou |\n| Immaculada |\n+------------+\n \nSelect the first two names (no ordering specified):\n \nSELECT * FROM members LIMIT 2;\n \n+---------+\n| name |\n+---------+\n| Jagdish |\n| Kenny |\n+---------+\n \nAll the names in alphabetical order:\n \nSELECT * FROM members ORDER BY name;\n \n+------------+\n| name |\n+------------+\n| Immaculada |\n| Jagdish |\n| Kenny |\n| Rokurou |\n+------------+\n \nThe first two names, ordered alphabetically:\n \nSELECT * FROM members ORDER BY name LIMIT 2;\n \n+------------+\n| name |\n+------------+\n| Immaculada |\n| Jagdish |\n+------------+\n \nThe third name, ordered alphabetically (the first name would\nbe offset zero, so the third is offset two):\n \nSELECT * FROM members ORDER BY name LIMIT 2,1;\n \n+-------+\n| name |\n+-------+\n| Kenny |\n+-------+\n \nFrom MariaDB 10.3.2, LIMIT can be used in a multi-table\nupdate:\n \nCREATE TABLE warehouse (product_id INT, qty INT);\nINSERT INTO warehouse VALUES\n(1,100),(2,100),(3,100),(4,100);\n \nCREATE TABLE store (product_id INT, qty INT);\nINSERT INTO store VALUES (1,5),(2,5),(3,5),(4,5);\n \nUPDATE warehouse,store SET warehouse.qty = warehouse.qty-2,\nstore.qty = store.qty+2 \n WHERE (warehouse.product_id = store.product_id AND\nstore.product_id >= 1) \n ORDER BY store.product_id DESC LIMIT 2;\n \nSELECT * FROM warehouse;\n \n+------------+------+\n| product_id | qty |\n+------------+------+\n| 1 | 100 |\n| 2 | 100 |\n| 3 | 98 |\n| 4 | 98 |\n+------------+------+\n \nSELECT * FROM store;\n \n+------------+------+\n| product_id | qty |\n+------------+------+\n| 1 | 5 |\n| 2 | 5 |\n| 3 | 7 |\n| 4 | 7 |\n+------------+------+\n \nFrom MariaDB 10.3.3, LIMIT can be used with GROUP_CONCAT,\nso, for example, given the following table:\n \nCREATE TABLE d (dd DATE, cc INT);\n \nINSERT INTO d VALUES (\'2017-01-01\',1);\nINSERT INTO d VALUES (\'2017-01-02\',2);\nINSERT INTO d VALUES (\'2017-01-04\',3);\n \nthe following query:\n \nSELECT SUBSTRING_INDEX(GROUP_CONCAT(CONCAT_WS(\":\",dd,cc)\nORDER BY cc DESC),\",\",1) FROM d;\n \n+----------------------------------------------------------------------------+\n| SUBSTRING_INDEX(GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER\nBY cc DESC),\",\",1) |\n+----------------------------------------------------------------------------+\n| 2017-01-04:3 |\n+----------------------------------------------------------------------------+\n \ncan be more simply rewritten as:\n \nSELECT GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY cc DESC\nLIMIT 1) FROM d;\n \n+-------------------------------------------------------------+\n| GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY cc DESC LIMIT\n1) |\n+-------------------------------------------------------------+\n| 2017-01-04:3 |\n+-------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/limit/','','https://mariadb.com/kb/en/library/limit/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (426,27,'LOAD DATA INFILE','Syntax\n------ \nLOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE\n\'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE tbl_name\n [CHARACTER SET charset_name]\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n [IGNORE number LINES]\n [(col_name_or_user_var,...)]\n [SET col_name = expr,...]\n \nDescription\n----------- \nReads rows from a text file into the designated table on the\ndatabase at a very high speed. The file name must be given\nas a literal string. \n \nFiles are written to disk using the SELECT INTO OUTFILE\nstatement. You can then read the files back into a table\nusing the LOAD DATA INFILE statement. The FIELDS and LINES\nclauses are the same in both statements. These clauses are\noptional, but if both are specified then the FIELDS clause\nmust precede LINES.\n \nIn releases after MariaDB 5.5, LOAD DATA INFILE is unsafe\nfor statement-based replication.\n \nExecuting this statement activates INSERT triggers.\n \nREPLACE and IGNORE\n \nIn cases where you load data from a file into a table that\nalready contains data and has a Primary Key, you may\nencounter issues where the statement attempts to insert a\nrow with a Primary Key that already exists. When this\nhappens, the statement fails with Error 1064, protecting the\ndata already on the table. In cases where you want MariaDB\nto overwrite duplicates, use the REPLACE keyword.\n \nThe REPLACE keyword works like the REPLACE statement. Here,\nthe statement attempts to load the data from the file. If\nthe row does not exist, it adds it to the table. If the row\ncontains an existing Primary Key, it replaces the table\ndata. That is, in the event of a conflict, it assumes the\nfile contains the desired row. \n \nThis operation can cause a degradation in load speed by a\nfactor of 20 or more if the part that has already been\nloaded is larger than the capacity of the InnoDB Buffer\nPool. This happens because it causes a lot of turnaround in\nthe Buffer Pool.\n \nUse the IGNORE keyword when you want to skip any rows that\ncontain a conflicting Primary Key. Here, the statement\nattempts to load the data from the file. If the row does not\nexist, it adds it to the table. If the row contains an\nexisting Primary Key, it ignores the addition request and\nmoves on to the next. That is, in the event of a conflict,\nit assumes the table contains the desired row.\n \nLOCAL\n \nWhen you issue this statement, the Server attempts to read\nfiles from the host file system. Using the LOCAL keyword,\nthe statement instead attempts to read files from the\nclient. This allows you to insert files from the client\'s\nlocal file system into the database.\n \nIn the event that you don\'t want the server to permit this\noperation, (such as for security reasons), you can disable\nsupport using local_infile. When this system variable is set\nto 0, MariaDB rejects LOAD DATA LOCAL INFILE statements,\nfailing with an error message.\n \nCharacter-sets\n \nWhen the statement opens the file, it attempts to read the\ncontents using the default character-set, as defined by the\ncharacter_set_database system variable. \n \nIn the cases where the file was written using a\ncharacter-set other than the default, you can specify the\ncharacter-set to use with the CHARACTER SET clause in the\nstatement. It ignores character-sets specified by the SET\nNAMES statement and by the character_set_client system\nvariable. Setting the CHARACTER SET clause to a value of\nbinary indicates \"no conversion.\"\n \nThe statement interprets all fields in the file as having\nthe same character-set, regardless of the column data type.\nTo properly interpret file contents, you must ensure that it\nwas written with the correct character-set. If you write a\ndata file with mysqldump -T or with the SELECT INTO OUTFILE\nstatement with the mysql client, be sure to use the\n--default-character-set option, so that the output is\nwritten with the desired character-set.\n \nWhen using mixed character sets, use the CHARACTER SET\nclause in both SELECT INTO OUTFILE and LOAD DATA INFILE to\nensure that MariaDB correctly interprets the escape\nsequences.\n \nThe character_set_filesystem system variable controls the\ninterpretation of the filename.\n \nIt is currently not possible to load data files that use the\nucs2 character set.\n \nPriority and Concurrency\n \nIn loading data from a file, there\'s a risk that the\nstatement will attempt insertions concurrent with reads from\nanother client, which can result in the read serving a\nresult-set that contains only part of the update from the\nLOAD DATA INFILE statement.\n \nUsing the LOW_PRIORITY keyword, MariaDB delays insertions\nuntil no other clients are reading from the table.\nAlternatively, you can use the CONCURRENT keyword to perform\nconcurrent insertion.\n \nThe LOW_PRIORITY and CONCURRENT keywords are mutually\nexclusive. They cannot be used in the same statement.\n \nProgress Reporting\n \nSince MariaDB 5.3, the LOAD DATA INFILE statement supports\nprogress reporting. You may find this useful when dealing\nwith long-running operations. Using another client you can\nissue a SHOW PROCESSLIST query to check the progress of the\ndata load.\n \nUsing mysqlimport\n \nMariaDB ships with a separate utility for loading data from\nfiles: mysqlimport. It operates by sending LOAD DATA INFILE\nstatements to the server.\n \nUsing mysqlimport you can compress the file using the\n--compress option, to get better performance over slow\nnetworks, providing both the client and server support the\ncompressed protocol. Use the --local option to load from the\nlocal file system.\n \nIndexing\n \nIn cases where the storage engine supports ALTER TABLE...\nDISABLE KEYS statements, the LOAD DATA INFILE statement\nautomatically disables indexes during the execution.\n \n\n\nURL: https://mariadb.com/kb/en/library/load-data-infile/','','https://mariadb.com/kb/en/library/load-data-infile/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (427,27,'LOAD XML','Syntax\n------ \nLOAD XML [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE\n\'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE [db_name.]tbl_name\n [CHARACTER SET charset_name]\n [ROWS IDENTIFIED BY \'\']\n [IGNORE number {LINES | ROWS}]\n [(column_or_user_var,...)]\n [SET col_name = expr,...]\n \nDescription\n----------- \nThe LOAD XML statement reads data from an XML file into a\ntable. The\nfile_name must be given as a literal string. The tagname in\nthe\noptional ROWS IDENTIFIED BY clause must also be given as a\nliteral\nstring, and must be surrounded by angle brackets (< and >).\n \nLOAD XML acts as the complement of running the mysql client\nin XML\noutput mode (that is, starting the client with the --xml\noption). To\nwrite data from a table to an XML file, use a command such\nas the\nfollowing one from the system shell:\n \nshell> mysql --xml -e \'SELECT * FROM mytable\' > file.xml\n \nTo read the file back into a table, use LOAD XML INFILE. By\ndefault,\nthe element is considered to be the equivalent of a\ndatabase\ntable row; this can be changed using the ROWS IDENTIFIED BY\nclause.\n \nThis statement supports three different XML formats:\nColumn names as attributes and column values as attribute\nvalues:\n \nColumn names as tags and column values as the content of\nthese tags:\n \n value1\n value2\n \nColumn names are the name attributes of tags, and values\nare\n the contents of these tags:\n \n value1\n value2\n \n This is the format used by other tools, such as mysqldump.\n \nAll 3 formats can be used in the same XML file; the import\nroutine\nautomatically detects the format for each row and interprets\nit\ncorrectly. Tags are matched based on the tag or attribute\nname and the\ncolumn name.\n \nThe following clauses work essentially the same way for LOAD\nXML as\nthey do for LOAD DATA:\nLOW_PRIORITY or CONCURRENT\nLOCAL\nREPLACE or IGNORE\nCHARACTER SET\n(column_or_user_var,...)\nSET\n \nSee LOAD DATA for more information about these clauses.\n \nThe IGNORE number LINES or IGNORE number ROWS clause causes\nthe first\nnumber rows in the XML file to be skipped. It is analogous\nto the LOAD\nDATA statement\'s IGNORE ... LINES clause.\n \nIf the LOW_PRIORITY keyword is used, insertions are delayed\nuntil no other clients are reading from the table. The\nCONCURRENT keyword allowes the use of concurrent inserts.\nThese clauses cannot be specified together.\n \nThis statement activates INSERT triggers.\n \n\n\nURL: https://mariadb.com/kb/en/library/load-xml/','','https://mariadb.com/kb/en/library/load-xml/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (428,27,'LOCK IN SHARE MODE','When LOCK IN SHARE MODE is specified in a SELECT statement,\nMariaDB will wait until all transactions that have modified\nthe rows are committed. Then, a write lock is acquired. All\ntransactions can read the rows, but if they want to modify\nthem, they have to wait until your transaction is committed.\n \nInnoDB/XtraDB supports row-level locking. selected rows can\nbe locked using LOCK IN SHARE MODE or FOR UPDATE. In both\ncases, a lock is acquired on the rows read by the query, and\nit will be released when the current transaction is\ncommitted.\n \nIf autocommit is set to 1, the LOCK IN SHARE MODE and FOR\nUPDATE clauses have no effect.\n \n\n\nURL: https://mariadb.com/kb/en/library/lock-in-share-mode/','','https://mariadb.com/kb/en/library/lock-in-share-mode/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (429,27,'Non-Recursive Common Table Expressions Overview','Common Table Expressions (CTEs) are a standard SQL feature,\nand are essentially temporary named result sets. There are\ntwo kinds of CTEs: Non-Recursive, which this article covers;\nand Recursive.\n \nCommon table expressions were introduced in MariaDB 10.2.1.\n \nNon-Recursive CTEs\n \nThe WITH keyword signifies a CTE. It is given a name,\nfollowed by a body (the main query) as follows:\n \nCTEs are similar to derived tables. For example\n \nWITH engineers AS \n ( SELECT * FROM employees\n WHERE dept = \'Engineering\' )\n \nSELECT * FROM engineers\nWHERE ...\n \nSELECT * FROM\n ( SELECT * FROM employees\n WHERE dept = \'Engineering\' ) AS engineers\nWHERE\n...\n \nA non-recursive CTE is basically a query-local VIEW. There\nare several advantages and caveats to them. The syntax is\nmore readable than nested FROM (SELECT ...).\nA CTE can refer to another and it can be referenced from\nmultiple places.\n \nA CTE referencing Another CTE\n \nUsing this format makes for a more readable SQL than a\nnested FROM(SELECT ...) clause. Below is an example of this:\n \nWITH engineers AS (\nSELECT * FROM employees\nWHERE dept IN(\'Development\',\'Support\') ),\neu_engineers AS ( SELECT * FROM engineers WHERE country\nIN(\'NL\',...) )\nSELECT\n...\nFROM eu_engineers;\n \nMultiple Uses of a CTE\n \nThis can be an \'anti-self join\', for example:\n \nWITH engineers AS (\nSELECT * FROM employees\nWHERE dept IN(\'Development\',\'Support\') )\n \nSELECT * FROM engineers E1\nWHERE NOT EXISTS\n (SELECT 1 FROM engineers E2\n WHERE E2.country=E1.country\n AND E2.name E1.name );\n \nOr, for year-over-year comparisons, for example:\n \nWITH sales_product_year AS (\nSELECT product, YEAR(ship_date) AS year,\nSUM(price) AS total_amt\nFROM item_sales\nGROUP BY product, year )\n \nSELECT *\nFROM sales_product_year CUR,\nsales_product_year PREV,\nWHERE CUR.product=PREV.product \nAND CUR.year=PREV.year + 1 \nAND CUR.total_amt > PREV.total_amt\n \nAnother use is to compare individuals against their group.\nBelow is an example of how this might be executed:\n \nWITH sales_product_year AS (\nSELECT product,\nYEAR(ship_date) AS year,\nSUM(price) AS total_amt\nFROM item_sales\nGROUP BY product, year\n)\n \nSELECT * \nFROM sales_product_year S1\nWHERE\ntotal_amt > \n (SELECT 0.1 * SUM(total_amt)\n FROM sales_product_year S2\n WHERE S2.year = S1.year)\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/non-recursive-common-table-expressions-overview/','','https://mariadb.com/kb/en/library/non-recursive-common-table-expressions-overview/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (430,27,'ORDER BY','Description\n----------- \nUse the ORDER BY clause to order a resultset, such as that\nare returned from a SELECT\nstatement. You can specify just a column or use any\nexpression with functions. If you are\nusing the GROUP BY clause, you can use grouping functions in\nORDER BY.\nOrdering is done after grouping.\n \nYou can use multiple ordering expressions, separated by\ncommas. Rows will be sorted by\nthe first expression, then by the second expression if they\nhave the same value for the\nfirst, and so on.\n \nYou can use the keywords ASC and DESC after each ordering\nexpression to\nforce that ordering to be ascending or descending,\nrespectively. Ordering is ascending\nby default.\n \nYou can also use a single integer as the ordering\nexpression. If you use an integer n,\nthe results will be ordered by the nth column in the select\nexpression.\n \nWhen string values are compared, they are compared as if by\nthe STRCMP\nfunction. STRCMP ignores trailing whitespace and may\nnormalize\ncharacters and ignore case, depending on the collation in\nuse.\n \nStarting from MariaDB 5.5.35 duplicated entries in the ORDER\nBY clause are removed. MySQL 5.6 also removes duplicated\nfields.\n \nORDER BY can also be used to order the activities of a\nDELETE or UPDATE statement (usually with the LIMIT clause). \n \nUntil MariaDB 10.3.1, it was not possible to use ORDER BY\n(or LIMIT) in a multi-table UPDATE statement. This\nrestriction was lifted in MariaDB 10.3.2.\n \nExamples\n-------- \nCREATE TABLE seq (i INT, x VARCHAR(1));\nINSERT INTO seq VALUES (1,\'a\'), (2,\'b\'), (3,\'b\'),\n(4,\'f\'), (5,\'e\');\n \nSELECT * FROM seq ORDER BY i;\n \n+------+------+\n| i | x |\n+------+------+\n| 1 | a |\n| 2 | b |\n| 3 | b |\n| 4 | f |\n| 5 | e |\n+------+------+\n \nSELECT * FROM seq ORDER BY i DESC;\n \n+------+------+\n| i | x |\n+------+------+\n| 5 | e |\n| 4 | f |\n| 3 | b |\n| 2 | b |\n| 1 | a |\n+------+------+\n \nSELECT * FROM seq ORDER BY x,i;\n \n+------+------+\n| i | x |\n+------+------+\n| 1 | a |\n| 2 | b |\n| 3 | b |\n| 5 | e |\n| 4 | f |\n+------+------+\n \nORDER BY in an UPDATE statement, in conjunction with LIMIT:\n \nUPDATE seq SET x=\'z\' WHERE x=\'b\' ORDER BY i DESC LIMIT\n1;\n \nSELECT * FROM seq;\n \n+------+------+\n| i | x |\n+------+------+\n| 1 | a |\n| 2 | b |\n| 3 | z |\n| 4 | f |\n| 5 | e |\n+------+------+\n \nFrom MariaDB 10.3.2, ORDER BY can be used in a multi-table\nupdate:\n \nCREATE TABLE warehouse (product_id INT, qty INT);\nINSERT INTO warehouse VALUES\n(1,100),(2,100),(3,100),(4,100);\n \nCREATE TABLE store (product_id INT, qty INT);\nINSERT INTO store VALUES (1,5),(2,5),(3,5),(4,5);\n \nUPDATE warehouse,store SET warehouse.qty = warehouse.qty-2,\nstore.qty = store.qty+2 \n WHERE (warehouse.product_id = store.product_id AND\nstore.product_id >= 1) \n ORDER BY store.product_id DESC LIMIT 2;\n \nSELECT * FROM warehouse;\n \n+------------+------+\n| product_id | qty |\n+------------+------+\n| 1 | 100 |\n| 2 | 100 |\n| 3 | 98 |\n| 4 | 98 |\n+------------+------+\n \nSELECT * FROM store;\n \n+------------+------+\n| product_id | qty |\n+------------+------+\n| 1 | 5 |\n| 2 | 5 |\n| 3 | 7 |\n| 4 | 7 |\n+------------+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/order-by/','','https://mariadb.com/kb/en/library/order-by/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (431,27,'PROCEDURE','The PROCEDURE clause of SELECT passes the whole result set\nto a Procedure which will process it. These Procedures are\nnot Stored Procedures, and can only be written in the C\nlanguage, so it is necessary to recompile the server.\n \nCurrently, the only available procedure is ANALYSE, which\nexamines the resultset and suggests the optimal datatypes\nfor each column. It is defined in the sql/sql_analyse.cc\nfile, and can be used as an example to create more\nProcedures.\n \nThis clause cannot be used in a view\'s definition.\n \n\n\nURL: https://mariadb.com/kb/en/library/procedure/','','https://mariadb.com/kb/en/library/procedure/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (432,27,'Recursive Common Table Expressions Overview','Recursive Common Table Expressions have been supported since\nMariaDB 10.2.2.\n \nCommon Table Expressions (CTEs) are a standard SQL feature,\nand are essentially temporary named result sets. CTEs first\nappeared in the SQL standard in 1999, and the first\nimplementations began appearing in 2007.\n \nThere are two kinds of CTEs:\nNon-recursive\nRecursive, which this article covers.\n \nSQL is generally poor at recursive structures.\n \nCTEs permit a query to reference itself. A recursive CTE\nwill repeatedly execute subsets of the data until it obtains\nthe complete result set. This makes it particularly useful\nfor handing hierarchical or tree-structured data.\n \nSyntax example\n \nWITH RECURSIVE signifies a recursive CTE. It is given a\nname, followed by a body (the main query) as follows:\n \n\nComputation\n \nGiven the following structure:\n \nFirst execute the anchor part of the query:\n \nNext, execute the recursive part of the query:\n \n\n \n\nSummary so far\n \nwith recursive R as (\n select anchor_data\n union [all]\n select recursive_part\n from R, ...\n)\nselect ...\nCompute anchor_data\nCompute recursive_part to get the new data\nif (new data is non-empty) goto 2;\n \nCAST to avoid truncating data\n \nAs currently implemented by MariaDB and by the SQL Standard,\ndata may be truncated if not correctly cast. It is necessary\nto CAST the column to the correct width if the CTE\'s\nrecursive part produces wider values for a column than the\nCTE\'s nonrecursive part. Some other DBMS give an error in\nthis situation, and MariaDB\'s behavior may change in future\n- see MDEV-12325. See the examples below.\n \nExamples\n-------- \nTransitive closure - determining bus destinations\n \nSample data:\n \nCREATE TABLE bus_routes (origin varchar(50), dst\nvarchar(50));\nINSERT INTO bus_routes VALUES \n (\'New York\', \'Boston\'), \n (\'Boston\', \'New York\'), \n (\'New York\', \'Washington\'), \n (\'Washington\', \'Boston\'), \n (\'Washington\', \'Raleigh\');\n \nNow, we want to return the bus destinations with New York as\nthe origin:\n \nWITH RECURSIVE bus_dst as ( \n SELECT origin as dst FROM bus_routes WHERE origin=\'New\nYork\' \n UNION\n SELECT bus_routes.dst FROM bus_routes, bus_dst WHERE\nbus_dst.dst= bus_routes.origin \n) \nSELECT * FROM bus_dst;\n \n+------------+\n| dst |\n+------------+\n| New York |\n| Boston |\n| Washington |\n| Raleigh |\n+------------+\n \nThe above example is computed as follows:\n \nFirst, the anchor data is calculated:\nStarting from New York\nBoston and Washington are added\n \nNext, the recursive part:\nStarting from Boston and then Washington\nRaleigh is added\nUNION excludes nodes that are already present.\n \nComputing paths - determining bus routes\n \nThis time, we are trying to get bus routes such as “New\nYork -> Washington -> Raleigh”.\n \nUsing the same sample data as the previous example:\n \nWITH RECURSIVE paths (cur_path, cur_dest) AS (\n SELECT origin, origin FROM bus_routes WHERE origin=\'New\nYork\' \n UNION\n SELECT CONCAT(paths.cur_path, \',\', bus_routes.dst),\nbus_routes.dst \n FROM paths, bus_routes \n WHERE paths.cur_dest = bus_routes.origin AND \n LOCATE(bus_routes.dst, paths.cur_path)=0 \n) \nSELECT * FROM paths;\n \n+-----------------------------+------------+\n| cur_path | cur_dest |\n+-----------------------------+------------+\n| New York | New York |\n| New York,Boston | Boston |\n| New York,Washington | Washington |\n| New York,Washington,Boston | Boston |\n| New York,Washington,Raleigh | Raleigh |\n+-----------------------------+------------+\n \nCAST to avoid data truncation\n \nIn the following example, data is truncated because the\nresults are not specifically cast to a wide enough type:\n \nWITH RECURSIVE tbl AS (\n SELECT NULL AS col\n UNION\n SELECT \"THIS NEVER SHOWS UP\" AS col FROM tbl\n)\n+------+\n| col |\n+------+\n| NULL |\n| |\n+------+\n \nExplicitly use CAST to overcome this:\n \nWITH RECURSIVE tbl AS (\n SELECT CAST(NULL AS CHAR(50)) AS col\n UNION SELECT \"THIS NEVER SHOWS UP\" AS col FROM tbl\n) \nSELECT * FROM tbl;\n \n+---------------------+\n| col |\n+---------------------+\n| NULL |\n| THIS NEVER SHOWS UP |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/recursive-common-table-expressions-overview/','','https://mariadb.com/kb/en/library/recursive-common-table-expressions-overview/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (433,27,'REPLACE','Syntax\n------ \nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n \nOr:\n \nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n \nOr:\n \nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n \nDescription\n----------- \n REPLACE works exactly like\n INSERT, except that if an old row in the table\n has the same value as a new row for a PRIMARY KEY or a\n UNIQUE index, the old row is deleted before the new row is\n inserted. If the table has more than one UNIQUE keys, it is\npossible that the new row conflicts with more than one row.\nIn this case, all conflicting rows will be deleted.\n \nThe table name can be specified in the form db_name.tbl_name\nor, if a default database is selected, in the form tbl_name\n(see Identifier Qualifiers). This allows to use REPLACE ...\nSELECT to copy rows between different databases.\n \nBasically it works like this:\n \nBEGIN;\nSELECT 1 FROM t1 WHERE key=# FOR UPDATE;\nIF found-row\n DELETE FROM t1 WHERE key=# ;\n INSERT INTO t1 VALUES (...);\nENDIF\nEND;\n \nThe above can be replaced with:\n \nREPLACE INTO t1 VALUES (...)\n \n REPLACE is a MariaDB/MySQL extension to the SQL standard.\nIt\n either inserts, or deletes and inserts. For other\nMariaDB/MySQL extensions to\n standard SQL --- that also handle duplicate values --- see\nIGNORE and INSERT ON DUPLICATE KEY UPDATE.\n \nNote that unless the table has a PRIMARY KEY or\n UNIQUE index, using a REPLACE statement\nmakes no sense. It becomes equivalent to INSERT, because\nthere is no index to be used to determine whether a new row\nduplicates another.\n \nValues for all columns are taken from the values specified\nin the\n REPLACE statement. Any missing columns are set to their\ndefault values, just as happens for INSERT. You cannot refer\nto values from the current row and use them in the new row.\nIf you use an\nassignment such as \'SET col = col + 1\', the\nreference to the column name on the right hand side is\ntreated as\n DEFAULT(col), so the assignment is equivalent to\n \'SET col = DEFAULT(col) + 1\'.\n \nTo use REPLACE, you must have both the\n INSERT and DELETE privileges\nfor the table.\n \nThere are some gotchas you should be aware of, before using\nREPLACE:\nIf there is an AUTO_INCREMENT field, a new value will be\ngenerated.\nIf there are foreign keys, ON DELETE action will be\nactivated by REPLACE.\nTriggers on DELETE and INSERT will be activated by REPLACE.\n \nTo avoid some of these behaviors, you can use INSERT ... ON\nDUPLICATE KEY UPDATE.\n \nThe PARTITION clause was introduced in MariaDB 10.0. See\nPartition Pruning and Selection for details.\n \nThis statement activates INSERT and DELETE triggers. See\nTrigger Overview for details.\n \n\n\nURL: https://mariadb.com/kb/en/library/replace/','','https://mariadb.com/kb/en/library/replace/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (434,27,'SELECT','Syntax\n------ \nSELECT\n [ALL | DISTINCT | DISTINCTROW]\n [HIGH_PRIORITY]\n [STRAIGHT_JOIN]\n [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]\n [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]\n select_expr [, select_expr ...]\n [ FROM table_references\n [WHERE where_condition]\n [GROUP BY {col_name | expr | position} [ASC | DESC], ...\n[WITH ROLLUP]]\n [HAVING where_condition]\n [ORDER BY {col_name | expr | position} [ASC | DESC], ...]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}]\n [PROCEDURE procedure_name(argument_list)]\n [INTO OUTFILE \'file_name\' [CHARACTER SET charset_name]\n[export_options]\n \nINTO DUMPFILE \'file_name\' | INTO var_name [, var_name] ] |\n\n \n [[FOR UPDATE | LOCK IN SHARE MODE] [WAIT n | NOWAIT] ] ]\n \nexport_options:\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n \nDescription\n----------- \nSELECT is used to retrieve rows selected from one or more\ntables, and can include UNION statements and subqueries.\nEach select_expr expression indicates a column or data that\nyou want to retrieve. You\nmust have at least one select expression. See Select\nExpressions below.\n \nThe FROM clause indicates the table or tables from which to\nretrieve rows.\nUse either a single table name or a JOIN expression. See\nJOIN\nfor details. If no table is involved, FROM DUAL can be\nspecified.\n \nThe PARTITION clause was introduced in MariaDB 10.0. See\nPartition Pruning and Selection for details.\nEach table can also be specified as db_name.tabl_name. Each\ncolumn can also be specified as tbl_name.col_name or even\ndb_name.tbl_name.col_name. This allows to write queries\nwhich involve multiple databases. See Identifier Qualifiers\nfor syntax details.\n \nThe WHERE clause, if given, indicates the condition or\n conditions that rows must satisfy to be selected.\n where_condition is an expression that evaluates to true for\n each row to be selected. The statement selects all rows if\nthere is no WHERE\n clause.\nIn the WHERE clause, you can use any of the functions and\n operators that MariaDB supports, except for aggregate\n(summary) functions. See Functions and Operators and\nFunctions and Modifiers for use with GROUP BY (aggregate).\n \nUse the ORDER BY clause to order the results.\n \nUse the LIMIT clause allows you to restrict the results to\nonly\na certain number of rows, optionally with an offset.\n \nUse the GROUP BY and HAVING clauses to group\nrows together when they have columns or computed values in\ncommon.\n \nSELECT can also be used to retrieve rows computed without\nreference to\nany table.\n \nSelect Expressions\n \nA SELECT statement must contain one or more select\nexpressions, separated\nby commas. Each select expression can be one of the\nfollowing:\nThe name of a column.\nAny expression using functions and operators.\n* to select all columns from all tables in the FROM clause.\ntbl_name.* to select all columns from just the table\ntbl_name.\n \nWhen specifying a column, you can either use just the column\nname or qualify the column\nname with the name of the table using tbl_name.col_name. The\nqualified form is\nuseful if you are joining multiple tables in the FROM\nclause. If you do not qualify the\ncolumn names when selecting from multiple tables, MariaDB\nwill try to find the column in\neach table. It is an error if that column name exists in\nmultiple tables.\n \nYou can quote column names using backticks. If you are\nqualifying column names\nwith table names, quote each part separately as\n`tbl_name`.`col_name`.\n \nIf you use any grouping functions\nin any of the select expressions, all rows in your results\nwill be implicitly grouped, as if\nyou had used GROUP BY NULL.\n \nDISTINCT\n \nA query may produce some identical rows. By default, all\nrows are retrieved, even when their values are the same. To\nexplicitly specify that you want to retrieve identical rows,\nuse the ALL option. If you want duplicates to be removed\nfrom the resultset, use the DISTINCT option. DISTINCTROW is\na synonym for DISTINCT. See also COUNT DISTINCT and SELECT\nUNIQUE in Oracle mode.\n \nINTO\n \nThe INTO clause is used to specify that the query results\nshould be written to a file or variable.\nSELECT INTO OUTFILE - formatting and writing the result to\nan external file.\nSELECT INTO DUMPFILE - binary-safe writing of the\nunformatted results to an external file.\nSELECT INTO Variable - selecting and setting variables.\n \nThe reverse of SELECT INTO OUTFILE is LOAD DATA.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \n\nmax_statement_time clause\n \nBy using max_statement_time in conjunction with SET\nSTATEMENT, it is possible to limit the execution time of\nindividual queries. For example:\n \nSET STATEMENT max_statement_time=100 FOR \n SELECT field1 FROM table_name ORDER BY field1;\n \n\n\nURL: https://mariadb.com/kb/en/library/select/','','https://mariadb.com/kb/en/library/select/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (435,27,'SELECT INTO DUMPFILE','Syntax\n------ \nSELECT ... INTO DUMPFILE \'file_path\'\n \nDescription\n----------- \nSELECT ... INTO DUMPFILE is a SELECT clause which writes the\nresultset into a single unformatted row, without any\nseparators, in a file. The results will not be returned to\nthe client.\n \nfile_path can be an absolute path, or a relative path\nstarting from the data directory. It can only be specified\nas a string literal, not as a variable. However, the\nstatement can be dynamically composed and executed as a\nprepared statement to work around this limitation.\n \nThis statement is binary-safe and so is particularly useful\nfor writing BLOB values to file. It can be used, for\nexample, to copy an image or an audio document from the\ndatabase to a file. SELECT ... INTO FILE can be used to save\na text file.\n \nThe file must not exist. It cannot be overwritten. A user\nneeds the FILE privilege to run this statement. Also,\nMariaDB needs permission to write files in the specified\nlocation. If the secure_file_priv system variable is set to\na non-empty directory name, the file can only be written to\nthat directory.\n \nSince MariaDB 5.1, the character_set_filesystem system\nvariable has controlled interpretation of file names that\nare given as literal strings.\n \nExample\n \nSELECT _utf8\'Hello world!\' INTO DUMPFILE \'/tmp/world\';\n \nSELECT LOAD_FILE(\'/tmp/world\') AS world;\n \n+--------------+\n| world |\n+--------------+\n| Hello world! |\n+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/select-into-dumpfile/','','https://mariadb.com/kb/en/library/select-into-dumpfile/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (436,27,'SELECT INTO OUTFILE','Syntax\n------ \nSELECT ... INTO OUTFILE \'file_name\'\n [CHARACTER SET charset_name]\n [export_options]\n \nexport_options:\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n \nDescription\n----------- \nSELECT INTO OUTFILE writes the resulting rows to a file, and\nallows the use of column and row terminators to specify a\nparticular output format. The default is to terminate fields\nwith tabs (\\t) and lines with newlines (\\n).\n \nThe file must not exist. It cannot be overwritten. A user\nneeds the FILE privilege to run this statement. Also,\nMariaDB needs permission to write files in the specified\nlocation. If the secure_file_priv system variable is set to\na non-empty directory name, the file can only be written to\nthat directory.\n \nThe LOAD DATA INFILE statement complements SELECT INTO\nOUTFILE.\n \nCharacter-sets\n \nThe CHARACTER SET clause specifies the character set in\nwhich the results are to be written. Without the clause, no\nconversion takes place (the binary character set). In this\ncase, if there are multiple character sets, the output will\ncontain these too, and may not easily be able to be\nreloaded.\n \nIn cases where you have two servers using different\ncharacter-sets, using SELECT INTO OUTFILE to transfer data\nfrom one to the other can have unexpected results. To ensure\nthat MariaDB correctly interprets the escape sequences, use\nthe CHARACTER SET clause on both the SELECT INTO OUTFILE\nstatement and the subsequent LOAD DATA INFILE statement.\n \nExample\n \nThe following example produces a file in the CSV format:\n \nSELECT customer_id, firstname, surname INTO OUTFILE\n\'/exportdata/customers.txt\'\n FIELDS TERMINATED BY \',\' OPTIONALLY ENCLOSED BY \'\"\'\n LINES TERMINATED BY \'\\n\'\n FROM customers;\n \n\n\nURL: https://mariadb.com/kb/en/library/select-into-outfile/','','https://mariadb.com/kb/en/library/select-into-outfile/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (437,27,'SELECT WITH ROLLUP','Syntax\n------ \nSee SELECT for the full syntax.\n \nDescription\n----------- \nThe WITH ROLLUP modifier adds extra rows to the resultset\nthat represent super-aggregate summaries. The\nsuper-aggregated column is represented by a NULL value.\nMultiple aggregates over different columns will be added if\nthere are multiple GROUP BY columns.\n \nThe LIMIT clause can be used at the same time, and is\napplied after the WITH ROLLUP rows have been added.\n \nWITH ROLLUP cannot be used with ORDER BY. Some sorting is\nstill possible by using ASC or DESC clauses with the GROUP\nBY column, although the super-aggregate rows will always be\nadded last.\n \nExamples\n-------- \nThese examples use the following sample table\n \nCREATE TABLE booksales ( \n country VARCHAR(35), genre\nENUM(\'fiction\',\'non-fiction\'), year YEAR, sales INT);\n \nINSERT INTO booksales VALUES\n (\'Senegal\',\'fiction\',2014,12234),\n(\'Senegal\',\'fiction\',2015,15647),\n (\'Senegal\',\'non-fiction\',2014,64980),\n(\'Senegal\',\'non-fiction\',2015,78901),\n (\'Paraguay\',\'fiction\',2014,87970),\n(\'Paraguay\',\'fiction\',2015,76940),\n (\'Paraguay\',\'non-fiction\',2014,8760),\n(\'Paraguay\',\'non-fiction\',2015,9030);\n \nThe addition of the WITH ROLLUP modifier in this example\nadds an extra row that aggregates both years:\n \nSELECT year, SUM(sales) FROM booksales GROUP BY year;\n \n+------+------------+\n| year | SUM(sales) |\n+------+------------+\n| 2014 | 173944 |\n| 2015 | 180518 |\n+------+------------+\n2 rows in set (0.08 sec)\n \nSELECT year, SUM(sales) FROM booksales GROUP BY year WITH\nROLLUP;\n \n+------+------------+\n| year | SUM(sales) |\n+------+------------+\n| 2014 | 173944 |\n| 2015 | 180518 |\n| NULL | 354462 |\n+------+------------+\n \nIn the following example, each time the genre, the year or\nthe country change, another super-aggregate row is added:\n \nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year, genre;\n \n+----------+------+-------------+------------+\n| country | year | genre | SUM(sales) |\n+----------+------+-------------+------------+\n| Paraguay | 2014 | fiction | 87970 |\n| Paraguay | 2014 | non-fiction | 8760 |\n| Paraguay | 2015 | fiction | 76940 |\n| Paraguay | 2015 | non-fiction | 9030 |\n| Senegal | 2014 | fiction | 12234 |\n| Senegal | 2014 | non-fiction | 64980 |\n| Senegal | 2015 | fiction | 15647 |\n| Senegal | 2015 | non-fiction | 78901 |\n+----------+------+-------------+------------+\n \nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year, genre WITH ROLLUP;\n \n+----------+------+-------------+------------+\n| country | year | genre | SUM(sales) |\n+----------+------+-------------+------------+\n| Paraguay | 2014 | fiction | 87970 |\n| Paraguay | 2014 | non-fiction | 8760 |\n| Paraguay | 2014 | NULL | 96730 |\n| Paraguay | 2015 | fiction | 76940 |\n| Paraguay | 2015 | non-fiction | 9030 |\n| Paraguay | 2015 | NULL | 85970 |\n| Paraguay | NULL | NULL | 182700 |\n| Senegal | 2014 | fiction | 12234 |\n| Senegal | 2014 | non-fiction | 64980 |\n| Senegal | 2014 | NULL | 77214 |\n| Senegal | 2015 | fiction | 15647 |\n| Senegal | 2015 | non-fiction | 78901 |\n| Senegal | 2015 | NULL | 94548 |\n| Senegal | NULL | NULL | 171762 |\n| NULL | NULL | NULL | 354462 |\n+----------+------+-------------+------------+\n \nThe LIMIT clause, applied after WITH ROLLUP:\n \nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year, genre WITH ROLLUP\nLIMIT 4;\n \n+----------+------+-------------+------------+\n| country | year | genre | SUM(sales) |\n+----------+------+-------------+------------+\n| Paraguay | 2014 | fiction | 87970 |\n| Paraguay | 2014 | non-fiction | 8760 |\n| Paraguay | 2014 | NULL | 96730 |\n| Paraguay | 2015 | fiction | 76940 |\n+----------+------+-------------+------------+\n \nSorting by year descending:\n \nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year DESC, genre WITH\nROLLUP;\n \n+----------+------+-------------+------------+\n| country | year | genre | SUM(sales) |\n+----------+------+-------------+------------+\n| Paraguay | 2015 | fiction | 76940 |\n| Paraguay | 2015 | non-fiction | 9030 |\n| Paraguay | 2015 | NULL | 85970 |\n| Paraguay | 2014 | fiction | 87970 |\n| Paraguay | 2014 | non-fiction | 8760 |\n| Paraguay | 2014 | NULL | 96730 |\n| Paraguay | NULL | NULL | 182700 |\n| Senegal | 2015 | fiction | 15647 |\n| Senegal | 2015 | non-fiction | 78901 |\n| Senegal | 2015 | NULL | 94548 |\n| Senegal | 2014 | fiction | 12234 |\n| Senegal | 2014 | non-fiction | 64980 |\n| Senegal | 2014 | NULL | 77214 |\n| Senegal | NULL | NULL | 171762 |\n| NULL | NULL | NULL | 354462 |\n+----------+------+-------------+------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/select-with-rollup/','','https://mariadb.com/kb/en/library/select-with-rollup/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (438,27,'UNION','UNION is used to combine the results from multiple SELECT\nstatements into a single result set.\n \nSyntax\n------ \nSELECT ...\nUNION [ALL | DISTINCT] SELECT ...\n[UNION [ALL | DISTINCT] SELECT ...]\n[ORDER BY [column [, column ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n \nDescription\n----------- \nUNION is used to combine the results from multiple SELECT\nstatements into a single result set.\n \nThe column names from the first SELECT statement are used as\nthe column names for the results returned. Selected columns\nlisted in corresponding positions of each SELECT statement\nshould have the same data type. (For example, the first\ncolumn selected by the first statement should have the same\ntype as the first column selected by the other statements.)\n \nIf they don\'t, the type and length of the columns in the\nresult take into account the values returned by all of the\nSELECTs, so there is no need for explicit casting. Note that\ncurrently this is not the case for recursive CTEs - see\nMDEV-12325.\n \nTable names can be specified as db_name.tbl_name. This\npermits writing UNIONs which involve multiple databases. See\nIdentifier Qualifiers for syntax details.\n \nUNION queries cannot be used with aggregate functions.\n \nALL/DISTINCT\n \nThe ALL keyword causes duplicate rows to be preserved. The\nDISTINCT keyword (the default if the keyword is omitted)\ncauses duplicate rows to be removed by the results.\n \nUNION ALL and UNION DISTINCT can both be present in a query.\nIn this case, UNION DISTINCT will override any UNION ALLs to\nits left.\n \nUntil MariaDB 10.1.1, all UNION ALL statements required the\nserver to create a temporary table. Since MariaDB 10.1.1,\nthe server can in most cases execute UNION ALL without\ncreating a temporary table, improving performance (see\nMDEV-334).\n \nORDER BY and LIMIT\n \nIndividual SELECTs can contain their own ORDER BY and LIMIT\nclauses. In this case, the individual queries need to be\nwrapped between parentheses. However, this does not affect\nthe order of the UNION, so they only are useful to limit the\nrecord read by one SELECT.\n \nThe UNION can have global ORDER BY and LIMIT clauses, which\naffect the whole resultset. If the columns retrieved by\nindividual SELECT statements have an alias (AS), the ORDER\nBY must use that alias, not the real column names.\n \nHIGH_PRIORITY\n \nSpecifying a query as HIGH_PRIORITY will not work inside a\nUNION. If applied to the first SELECT, it will be ignored.\nApplying to a later SELECT results in a syntax error:\n \nERROR 1234 (42000): Incorrect usage/placement of\n\'HIGH_PRIORITY\'\n \nSELECT ... INTO ...\n \nIndividual SELECTs cannot be written INTO DUMPFILE or INTO\nOUTFILE. If the last SELECT statement specifies INTO\nDUMPFILE or INTO OUTFILE, the entire result of the UNION\nwill be written. Placing the clause after any other SELECT\nwill result in a syntax error.\n \nIf the result is a single row, SELECT ... INTO @var_name can\nalso be used.\n \n\nParentheses\n \nFrom MariaDB 10.4.0, parentheses can be used to specify\nprecedence. Before this, a syntax error would be returned.\n \nExamples\n-------- \nUNION between tables having different column names:\n \n(SELECT e_name AS name, email FROM employees)\nUNION\n(SELECT c_name AS name, email FROM customers);\n \nSpecifying the UNION\'s global order and limiting total\nrows:\n \n(SELECT name, email FROM employees)\nUNION\n(SELECT name, email FROM customers)\nORDER BY name LIMIT 10;\n \nAdding a constant row:\n \n(SELECT \'John Doe\' AS name, \'john.doe@example.net\' AS\nemail)\nUNION\n(SELECT name, email FROM customers);\n \nDiffering types:\n \nSELECT CAST(\'x\' AS CHAR(1)) UNION SELECT REPEAT(\'y\',4);\n+----------------------+\n| CAST(\'x\' AS CHAR(1)) |\n+----------------------+\n| x |\n| yyyy |\n+----------------------+\n \nReturning the results in order of each individual SELECT by\nuse of a sort column:\n \n(SELECT 1 AS sort_column, e_name AS name, email FROM\nemployees)\nUNION\n(SELECT 2, c_name AS name, email FROM customers) ORDER BY\nsort_column;\n \nDifference between UNION, EXCEPT and INTERSECT:\n \nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(3),(4),(5),(6);\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n \nSELECT i FROM seqs WHERE i =3;\n \n+------+\n| i |\n+------+\n| 3 |\n+------+\n \nParentheses for specifying precedence, from MariaDB 10.4.0\n \nCREATE OR REPLACE TABLE t1 (a INT);\nCREATE OR REPLACE TABLE t2 (b INT);\nCREATE OR REPLACE TABLE t3 (c INT);\n \nINSERT INTO t1 VALUES (1),(2),(3),(4);\nINSERT INTO t2 VALUES (5),(6);\nINSERT INTO t3 VALUES (1),(6);\n \n((SELECT a FROM t1) UNION (SELECT b FROM t2)) INTERSECT\n(SELECT c FROM t3);\n+------+\n| a |\n+------+\n| 1 |\n| 6 |\n+------+\n \n(SELECT a FROM t1) UNION ((SELECT b FROM t2) INTERSECT\n(SELECT c FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 6 |\n+------+\n \n\n\nURL: https://mariadb.com/kb/en/library/union/','','https://mariadb.com/kb/en/library/union/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (439,27,'UPDATE','Syntax\n------ \nSingle-table syntax:\n \nUPDATE [LOW_PRIORITY] [IGNORE] table_reference \n [PARTITION (partition_list)]\n SET col1={expr1|DEFAULT} [,col2={expr2|DEFAULT}] ...\n [WHERE where_condition]\n [ORDER BY ...]\n [LIMIT row_count]\n \nMultiple-table syntax:\n \nUPDATE [LOW_PRIORITY] [IGNORE] table_references\n SET col1={expr1|DEFAULT} [, col2={expr2|DEFAULT}] ...\n [WHERE where_condition]\n \nDescription\n----------- \nFor the single-table syntax, the UPDATE statement updates\ncolumns of existing rows in the named table with new values.\nThe\nSET clause indicates which columns to modify and the values\nthey should be given. Each value can be given as an\nexpression, or the keyword\nDEFAULT to set a column explicitly to its default value. The\nWHERE clause, if given, specifies the conditions that\nidentify\nwhich rows to update. With no WHERE clause, all rows are\nupdated. If the ORDER BY clause is specified, the rows are\nupdated in the order that is specified. The LIMIT clause\nplaces a limit on the number of rows that can be updated.\n \nThe PARTITION clause was introduced in MariaDB 10.0. See\nPartition Pruning and Selection for details.\n \nUntil MariaDB 10.3.2, for the multiple-table syntax, UPDATE\nupdates rows in each\ntable named in table_references that satisfy the conditions.\nIn this case,\nORDER BY and LIMIT cannot be used. This restriction was\nlifted in MariaDB 10.3.2 and both clauses can be used with\nmultiple-table updates. An UPDATE can also reference tables\nwhich are located in different databases; see Identifier\nQualifiers for the syntax.\n \nwhere_condition is an expression that evaluates to true for\neach row to be updated.\n \ntable_references and where_condition are as\nspecified as described in SELECT.\n \nAssignments are evaluated in left-to-right order, unless the\nSIMULTANEOUS_ASSIGNMENT sql_mode (available from MariaDB\n10.3.5) is set, in which case the UPDATE statement evaluates\nall assignments simultaneously. \n \nYou need the UPDATE privilege only for columns referenced in\nan UPDATE that are actually updated. You need only the\nSELECT privilege for any columns that are read but\nnot modified. See GRANT.\n \nThe UPDATE statement supports the following modifiers:\nIf you use the LOW_PRIORITY keyword, execution of\n the UPDATE is delayed until no other clients are reading\nfrom\n the table. This affects only storage engines that use only\ntable-level\n locking (MyISAM, MEMORY, MERGE). See HIGH_PRIORITY and\nLOW_PRIORITY clauses for details.\nIf you use the IGNORE keyword, the update statement does \n not abort even if errors occur during the update. Rows for\nwhich\n duplicate-key conflicts occur are not updated. Rows for\nwhich columns are\n updated to values that would cause data conversion errors\nare updated to the\n closest valid values instead.\n \nUPDATE Statements With the Same Source and Target\n \nFrom MariaDB 10.3.2, UPDATE statements may have the same\nsource and target.\n \nFor example, given the following table:\n \nDROP TABLE t1;\n \nCREATE TABLE t1 (c1 INT, c2 INT);\nINSERT INTO t1 VALUES (10,10), (20,20);\n \nUntil MariaDB 10.3.1, the following UPDATE statement would\nnot work:\n \nUPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1);\nERROR 1093 (HY000): Table \'t1\' is specified twice, \n both as a target for \'UPDATE\' and as a separate source\nfor data\n \nFrom MariaDB 10.3.2, the statement executes successfully:\n \nUPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1);\n \nSELECT * FROM t1;\n \n+------+------+\n| c1 | c2 |\n+------+------+\n| 10 | 10 |\n| 21 | 20 |\n+------+------+\n \nExample\n \nSingle-table syntax:\n \nUPDATE table_name SET column1 = value1, column2 = value2\nWHERE id=100;\n \nMultiple-table syntax:\n \nUPDATE tab1, tab2 SET tab1.column1 = value1, tab1.column2 =\nvalue2 WHERE tab1.id = tab2.id;\n \n\n\nURL: https://mariadb.com/kb/en/library/update/','','https://mariadb.com/kb/en/library/update/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (440,27,'WITH','The WITH keyword signifies a Common Table Expression (CTE).\nIt allows you to refer to a subquery expression many times\nin a query, as if having a temporary table that only exists\nfor the duration of a query.\n \nThere are two kinds of CTEs:\nNon-Recursive\nRecursive\n \nCommon Table Expression WITH was introduced in MariaDB\n10.2.1.\n \nRecursive WITH has been supported since MariaDB 10.2.2.\n \nSyntax\n------ \nWITH [RECURSIVE] table_reference as (SELECT ...)\n SELECT ...\n \nYou can use table_reference as any normal table in the\nexternal SELECT part. You can also use WITH in sub queries.\nWITH can also be used with EXPLAIN and SELECT.\n \nBelow is an example with the WITH at the top level:\n \nWITH t AS (SELECT a FROM t1 WHERE b >= \'c\') \n SELECT * FROM t2, t WHERE t2.c = t.a;\n \nThe example below uses WITH in a subquery:\n \nSELECT t1.a, t1.b FROM t1, t2\n WHERE t1.a > t2.c \n AND t2.c IN(WITH t AS (SELECT * FROM t1 WHERE t1.a \n\nURL: https://mariadb.com/kb/en/library/with/','','https://mariadb.com/kb/en/library/with/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (441,28,'DESCRIBE','Syntax\n------ \n{DESCRIBE | DESC} tbl_name [col_name | wild]\n \nDescription\n----------- \nDESCRIBE provides information about the columns in a table.\nIt is a shortcut for SHOW COLUMNS FROM.\nThese statements also display information for views.\n \ncol_name can be a column name, or a string containing the\nSQL \"%\" and \"_\" wildcard characters to\nobtain output only for the columns with names matching the\nstring. There is no\nneed to enclose the string within quotes unless it contains\nspaces or other\nspecial characters.\n \nDESCRIBE city;\n \n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | YES | | NULL | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | YES | | NULL | |\n+------------+----------+------+-----+---------+----------------+\n \nThe description for SHOW COLUMNS provides\nmore information about the output columns.\n \n\n\nURL: https://mariadb.com/kb/en/library/describe/','','https://mariadb.com/kb/en/library/describe/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (442,28,'EXPLAIN','Syntax\n------ \nEXPLAIN tbl_name\n \nOr\n \nEXPLAIN [EXTENDED | PARTITIONS] \n {SELECT select_options | UPDATE update_options | DELETE\ndelete_options}\n \nDescription\n----------- \nThe EXPLAIN statement can be used either as a synonym for\nDESCRIBE or as a way to obtain information about how MariaDB\nexecutes a SELECT (as well as UPDATE and DELETE since\nMariaDB 10.0.5) statement:\n\'EXPLAIN tbl_name\' is synonymous with \n \'DESCRIBE tbl_name\' or \n \'SHOW COLUMNS FROM tbl_name\'.\nWhen you precede a SELECT statement (or, since MariaDB\n10.0.5, an UPDATE or a DELETE as well) with the keyword \n EXPLAIN, MariaDB displays information from the optimizer\n about the query execution plan. That is, MariaDB explains\nhow it would\n process the SELECT, UPDATE or DELETE, including information\nabout how tables\n are joined and in which order. EXPLAIN EXTENDED can be\n used to provide additional information.\nEXPLAIN PARTITIONS has been available since MySQL 5.1.5. It\nis useful only when examining queries involving partitioned\ntables. For details, see Partition pruning and selection.\nANALYZE statement, which performs the query as well as\nproducing EXPLAIN output, and provides actual as well as\nestimated statistics, has been available from MariaDB\n10.1.0.\nSince MariaDB 10.0.5, it has been possible to have EXPLAIN\noutput printed in the slow query log. See EXPLAIN in the\nSlow Query Log for details.\n \nSince MariaDB 10.0, SHOW EXPLAIN shows the output of a\nrunning statement. In some cases, its output can be closer\nto reality than EXPLAIN.\n \nSince MariaDB 10.1, the ANALYZE statement runs a statement\nand returns information about its execution plan. It also\nshows additional columns, to check how much the optimizer\'s\nestimation about filtering and found rows are close to\nreality.\n \nThere is an online EXPLAIN Analyzer that you can use to\nshare EXPLAIN and EXPLAIN EXTENDED output with others.\n \nEXPLAIN can acquire metadata locks in the same way that\nSELECT does, as it needs to know table metadata and,\nsometimes, data as well.\n \nThe columns in EXPLAIN ... SELECT\n \nColumn name | Description | \n \nid | Sequence number that shows in which order tables are\njoined. | \n \nselect_type | What kind of SELECT the table comes from. | \n \ntable | Alias name of table. Materialized temporary tables\nfor sub queries are named | \n \ntype | How rows are found from the table (join type). | \n \npossible_keys | keys in table that could be used to find\nrows in the table | \n \nkey | The name of the key that is used to retrieve rows.\nNULL is no key was used. | \n \nkey_len | How many bytes of the key that was used (shows if\nwe are using only parts of the multi-column key). | \n \nref | The reference that is used to as the key value. | \n \nrows | An estimate of how many rows we will find in the\ntable for each key lookup. | \n \nExtra | Extra information about this join. | \n \nHere are descriptions of the values for some of the more\ncomplex columns in EXPLAIN ... SELECT:\n \n\"select_type\" column\n \nThe select_type column can have the following values:\n \nValue | Description | \n \nDEPENDENT SUBQUERY | The SUBQUERY is DEPENDENT. | \n \nDEPENDENT UNION | The UNION is DEPENDENT. | \n \nDERIVED | The SELECT is DERIVED from the PRIMARY. | \n \nMATERIALIZED | The SUBQUERY is MATERIALIZED. | \n \nPRIMARY | The SELECT is a PRIMARY one. | \n \nSIMPLE | The SELECT is a SIMPLE one. | \n \nSUBQUERY | The SELECT is a SUBQUERY of the PRIMARY. | \n \nUNCACHEABLE SUBQUERY | The SUBQUERY is UNCACHEABLE. | \n \nUNCACHEABLE UNION | The UNION is UNCACHEABLE. | \n \nUNION | The SELECT is a UNION of the PRIMARY. | \n \nUNION RESULT | The result of the UNION. | \n \n\"Type\" column\n \nThis column contains information on how the table is\naccessed.\n \nValue | Description | \n \nALL | A full table scan is done for the table (all rows are\nread). This is bad if the table is large and the table is\njoined against a previous table! This happens when the\noptimizer could not find any usable index to access rows. | \n \nconst | There is only one possibly matching row in the\ntable. The row is read before the optimization phase and all\ncolumns in the table are treated as constants. | \n \neq_ref | A unique index is used to find the rows. This is\nthe best possible plan to find the row. | \n \nfulltext | A fulltext index is used to access the rows. | \n \nindex_merge | A \'range\' access is done for for several\nindex and the found rows are merged. The key column shows\nwhich keys are used. | \n \nindex_subquery | This is similar as ref, but used for sub\nqueries that are transformed to key lookups. | \n \nindex | A full scan over the used index. Better than ALL but\nstill bad if index is large and the table is joined against\na previous table. | \n \nrange | The table will be accessed with a key over one or\nmore value ranges. | \n \nref_or_null | Like \'ref\' but in addition another search\nfor the \'null\' value is done if the first value was not\nfound. This happens usually with sub queries. | \n \nref | A non unique index or prefix of an unique index is\nused to find the rows. Good if the prefix doesn\'t match\nmany rows. | \n \nsystem | The table has 0 or 1 rows. | \n \nunique_subquery | This is similar as eq_ref, but used for\nsub queries that are transformed to key lookups | \n \n\"Extra\" column\n \nThis column consists of one or more of the following values,\nseparated by \';\'\n \n Note that some of these values are detected after the\noptimization phase.\n \nThe optimization phase can do the following changes to the\nWHERE clause:\nAdd the expressions from the ON and USING clauses to the\nWHERE\n clause.\nConstant propagation: If there is column=constant, replace\nall column\n instances with this constant.\nReplace all columns from \'const\' tables with their values.\nRemove the used key columns from the WHERE (as this will be\ntested as\n part of the key lookup).\nRemove impossible constant sub expressions.\n For example WHERE \'(a=1 and a=2) OR b=1\' becomes \'b=1\'.\nReplace columns with other columns that has identical\nvalues:\n Example: WHERE a=b and a=c may be treated\n as \'WHERE a=b and a=c and b=c\'.\nAdd extra conditions to detect impossible row conditions\nearlier. This\n happens mainly with OUTER JOIN where we in some cases add\ndetection\n of NULL values in the WHERE (Part of \'Not exists\'\noptimization).\n This can cause an unexpected \'Using where\' in the Extra\ncolumn.\nFor each table level we remove expressions that have already\nbeen tested when\n we read the previous row. Example: When joining tables t1\nwith t2\n using the following WHERE \'t1.a=1 and t1.a=t2.b\', we\ndon\'t have to\n test \'t1.a=1\' when checking rows in t2 as we already know\nthat this\n expression is true. \n \nValue | Description | \n \nconst row not found | The table was a system table (a table\nwith should exactly one row), but no row was found. | \n \nDistinct | If distinct optimization (remove duplicates) was\nused. This is marked only for the last table in the SELECT.\n| \n \nFull scan on NULL key | The table is a part of the sub query\nand if the value that is used to match the sub query will be\nNULL, we will do a full table scan. | \n \nImpossible HAVING | The used HAVING clause is always false\nso the SELECT will return no rows. | \n \nImpossible WHERE noticed after reading const tables. | The\nused WHERE clause is always false so the SELECT will return\nno rows. This case was detected after we had read all\n\'const\' tables and used the column values as constant in\nthe WHERE clause. For example: WHERE const_column=5 and\nconst_column had a value of 4. | \n \nImpossible WHERE | The used WHERE clause is always false so\nthe SELECT will return no rows. For example: WHERE 1=2 | \n \nNo matching min/max row | During early optimization of\nMIN()/MAX() values it was detected that no row could match\nthe WHERE clause. The MIN()/MAX() function will return NULL.\n| \n \nno matching row in const table | The table was a const table\n(a table with only one possible matching row), but no row\nwas found. | \n \nNo tables used | The SELECT was a sub query that did not use\nany tables. For example a there was no FROM clause or a FROM\nDUAL clause. | \n \nNot exists | Stop searching after more row if we find one\nsingle matching row. This optimization is used with LEFT\nJOIN where one is explicitly searching for rows that\ndoesn\'t exists in the LEFT JOIN TABLE. Example: SELECT *\nFROM t1 LEFT JOIN t2 on (...) WHERE t2.not_null_column IS\nNULL. As t2.not_null_column can only be NULL if there was no\nmatching row for on condition, we can stop searching if we\nfind a single matching row. | \n \nOpen_frm_only | For information_schema tables. Only the frm\n(table definition file was opened) was opened for each\nmatching row. | \n \nOpen_full_table | For information_schema tables. A full\ntable open for each matching row is done to retrieve the\nrequested information. (Slow) | \n \nOpen_trigger_only | For information_schema tables. Only the\ntrigger file definition was opened for each matching row. | \n \nRange checked for each record (index map: ...) | This only\nhappens when there was no good default index to use but\nthere may some index that could be used when we can treat\nall columns from previous table as constants. For each row\ncombination the optimizer will decide which index to use (if\nany) to fetch a row from this table. This is not fast, but\nfaster than a full table scan that is the only other choice.\nThe index map is a bitmask that shows which index are\nconsidered for each row condition. | \n \nScanned 0/1/all databases | For information_schema tables.\nShows how many times we had to do a directory scan. | \n \nSelect tables optimized away | All tables in the join was\noptimized away. This happens when we are only using\nCOUNT(*), MIN() and MAX() functions in the SELECT and we\nwhere able to replace all of these with constants. | \n \nSkip_open_table | For information_schema tables. The queried\ntable didn\'t need to be opened. | \n \nunique row not found | The table was detected to be a const\ntable (a table with only one possible matching row) during\nthe early optimization phase, but no row was found. | \n \nUsing filesort | Filesort is needed to resolve the query.\nThis means an extra phase where we first collect all columns\nto sort, sort them with a disk based merge sort and then use\nthe sorted set to retrieve the rows in sorted order. If the\ncolumn set is small, we store all the columns in the sort\nfile to not have to go to the database to retrieve them\nagain. | \n \nUsing index | Only the index is used to retrieve the needed\ninformation from the table. There is no need to perform an\nextra seek to retrieve the actual record. | \n \nUsing index condition | Like \'Using where\' but the where\ncondition is pushed down to the table engine for internal\noptimization at the index level. | \n \nUsing index condition(BKA) | Like \'Using index condition\'\nbut in addition we use batch key access to retrieve rows. | \n \nUsing index for group-by | The index is being used to\nresolve a GROUP BY or DISTINCT query. The rows are not read.\nThis is very efficient if the table has a lot of identical\nindex entries as duplicates are quickly jumped over. | \n \nUsing intersect(...) | For index_merge joins. Shows which\nindex are part of the intersect. | \n \nUsing join buffer | We store previous row combinations in a\nrow buffer to be able to match each row against all of the\nrows combinations in the join buffer at one go. | \n \nUsing sort_union(...) | For index_merge joins. Shows which\nindex are part of the union. | \n \nUsing temporary | A temporary table is created to hold the\nresult. This typically happens if you are using GROUP BY,\nDISTINCT or ORDER BY. | \n \nUsing where | A WHERE expression (in additional to the\npossible key lookup) is used to check if the row should be\naccepted. If you don\'t have \'Using where\' together with a\njoin type of ALL, you are probably doing something wrong! | \n \nUsing where with pushed condition | Like \'Using where\' but\nthe where condition is pushed down to the table engine for\ninternal optimization at the row level. | \n \nUsing buffer | The UPDATE statement will first buffer the\nrows, and then run the updates, rather than do updates on\nthe fly. See Using Buffer UPDATE Algorithm for a detailed\nexplanation. | \n \nEXPLAIN EXTENDED\n \nThe EXTENDED keyword adds another column, filtered, to the\noutput. This is a percentage estimate of the table rows that\nwill be filtered by the condition.\n \nAn EXPLAIN EXTENDED will always throw a warning, as it adds\nextra Message information to a subsequent SHOW WARNINGS\nstatement. This includes what the SELECT query would look\nlike after optimizing and rewriting rules are applied and\nhow the optimizer qualifies columns and tables.\n \nExamples\n-------- \nAs synonym for DESCRIBE or SHOW COLUMNS FROM:\n \nDESCRIBE city;\n \n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | YES | | NULL | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | YES | | NULL | |\n+------------+----------+------+-----+---------+----------------+\n \nA simple set of examples to see how EXPLAIN can identify\npoor index usage:\n \nCREATE TABLE IF NOT EXISTS `employees_example` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `first_name` varchar(30) NOT NULL,\n `last_name` varchar(40) NOT NULL,\n `position` varchar(25) NOT NULL,\n `home_address` varchar(50) NOT NULL,\n `home_phone` varchar(12) NOT NULL,\n `employee_code` varchar(25) NOT NULL,\n PRIMARY KEY (`id`),\n UNIQUE KEY `employee_code` (`employee_code`),\n KEY `first_name` (`first_name`,`last_name`)\n) ENGINE=Aria;\n \nINSERT INTO `employees_example` (`first_name`, `last_name`,\n`position`, `home_address`, `home_phone`, `employee_code`)\n VALUES\n (\'Mustapha\', \'Mond\', \'Chief Executive Officer\', \'692\nPromiscuous Plaza\', \'326-555-3492\', \'MM1\'),\n (\'Henry\', \'Foster\', \'Store Manager\', \'314 Savage\nCircle\', \'326-555-3847\', \'HF1\'),\n (\'Bernard\', \'Marx\', \'Cashier\', \'1240 Ambient\nAvenue\', \'326-555-8456\', \'BM1\'),\n (\'Lenina\', \'Crowne\', \'Cashier\', \'281 Bumblepuppy\nBoulevard\', \'328-555-2349\', \'LC1\'),\n (\'Fanny\', \'Crowne\', \'Restocker\', \'1023 Bokanovsky\nLane\', \'326-555-6329\', \'FC1\'),\n (\'Helmholtz\', \'Watson\', \'Janitor\', \'944 Soma\nCourt\', \'329-555-2478\', \'HW1\');\n \nSHOW INDEXES FROM employees_example;\n \n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n| Table | Non_unique | Key_name | Seq_in_index | Column_name\n| Collation | Cardinality | Sub_part | Packed | Null |\nIndex_type | Comment | Index_comment |\n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n| employees_example | 0 | PRIMARY | 1 | id | A | 7 | NULL |\nNULL | | BTREE | | |\n| employees_example | 0 | employee_code | 1 | employee_code\n| A | 7 | NULL | NULL | | BTREE | | |\n| employees_example | 1 | first_name | 1 | first_name | A |\nNULL | NULL | NULL | | BTREE | | |\n| employees_example | 1 | first_name | 2 | last_name | A |\nNULL | NULL | NULL | | BTREE | | |\n+-------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+\n \nSELECT on a primary key:\n \nEXPLAIN SELECT * FROM employees_example WHERE id=1;\n \n+------+-------------+-------------------+-------+---------------+---------+---------+-------+------+-------+\n| id | select_type | table | type | possible_keys | key |\nkey_len | ref | rows | Extra |\n+------+-------------+-------------------+-------+---------------+---------+---------+-------+------+-------+\n| 1 | SIMPLE | employees_example | const | PRIMARY | PRIMARY\n| 4 | const | 1 | |\n+------+-------------+-------------------+-------+---------------+---------+---------+-------+------+-------+\n \nThe type is const, which means that only one possible result\ncould be returned. \nNow, returning the same record but searching by their phone\nnumber:\n \nEXPLAIN SELECT * FROM employees_example WHERE\nhome_phone=\'326-555-3492\';\n \n+------+-------------+-------------------+------+---------------+------+---------+------+------+-------------+\n| id | select_type | table | type | possible_keys | key |\nkey_len | ref | rows | Extra |\n+------+-------------+-------------------+------+---------------+------+---------+------+------+-------------+\n| 1 | SIMPLE | employees_example | ALL | NULL | NULL | NULL\n| NULL | 6 | Using where |\n+------+-------------+-------------------+------+---------------+------+---------+------+------+-------------+\n \nHere, the type is All, which means no index could be used.\nLooking at the rows count, a full table scan (all six rows)\nhad to be performed in order to retrieve the record. If\nit\'s a requirement to search by phone number, an index will\nhave to be created.\n \nSHOW EXPLAIN example:\n \nSHOW EXPLAIN FOR 1;\n \n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n| id | select_type | table | type | possible_keys | key |\nkey_len | ref | rows | Extra |\n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n| 1 | SIMPLE | tbl | index | NULL | a | 5 | NULL | 1000107 |\nUsing index |\n+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+\n1 row in set, 1 warning (0.00 sec)\n \nExample of ref_or_null optimization\n \nSELECT * FROM table_name\n WHERE key_column=expr OR key_column IS NULL;\n \nref_or_null is something that often happens when you use\nsubqueries with NOT IN as then one has to do an extra check\nfor NULL values if the first value didn\'t have a matching\nrow. \n \n\n\nURL: https://mariadb.com/kb/en/library/explain/','','https://mariadb.com/kb/en/library/explain/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (443,28,'EXPLAIN ANALYZE','The syntax for the EXPLAIN ANALYZE feature was changed to\nANALYZE statement, available since MariaDB 10.1.0. See\nANALYZE statement. \n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/explain-analyze/','','https://mariadb.com/kb/en/library/explain-analyze/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (444,28,'ANALYZE FORMAT=JSON','ANALYZE FORMAT=JSON is a mix of the EXPLAIN FORMAT=JSON and\nANALYZE statement features. ANALYZE FORMAT=JSON $statement\nwill execute $statement, and then print the output of\nEXPLAIN FORMAT=JSON, amended with the data from query\nexecution.\n \nBasic Execution Data\n \nYou can get the following also from tabular ANALYZE\nstatement form:\nr_rows is provided for any node that reads rows. It shows\nhow many rows were read, on average \nr_filtered is provided whenever there is a condition that is\nchecked. It shows the percentage of rows left after checking\nthe condition.\n \nAdvanced Execution Data\n \nThe most important data that is not available in tabula\nANALYZE statement are:\nr_loops field. This shows how many times the node was\nexecuted. Most query plan elements have this field.\nr_total_time_ms field. It shows how much time in total was\nspent executing this node. If the node has subnodes, their\nexecution time is included.\nr_buffer_size field. Query plan nodes that make use of\nbuffers report the size of buffer that was was used.\n \nData About Individual Query Plan Nodes\n \nfilesort node reports whether sorting was done with LIMIT n\nparameter, and how many rows were in the sort result. \nblock-nl-join node has r_loops field, which allows to tell\nwhether Using join buffer was efficient \nrange-checked-for-each-record reports counters that show the\nresult of the check. \nexpression-cache is used for subqueries, and it reports how\nmany times the cache was used, and what cache hit ratio was.\nunion_result node has r_rows so one can see how many rows\nwere produced after UNION operation\nand so forth\n \nUse Cases\n \nSee Examples of ANALYZE FORMAT=JSON.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/analyze-format-json/','','https://mariadb.com/kb/en/library/analyze-format-json/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (445,28,'ANALYZE FORMAT=JSON Examples','Example #1\n \nCustomers who have ordered more than 1M goods.\n \nANALYZE FORMAT=JSON\nSELECT CONT(*)\nFROM customer\nWHERE\n (SELECT SUM(o_totalprice) FROM orders WHERE\no_custkey=c_custkey) > 1000*1000;\n \nThe query takes 40 seconds over cold cache\n \nEXPLAIN: {\n \"query_block\": {\n \"select_id\": 1,\n \"r_loops\": 1,\n \"r_total_time_ms\": 39872,\n \"table\": {\n \"table_name\": \"customer\",\n \"access_type\": \"index\",\n \"key\": \"i_c_nationkey\",\n \"key_length\": \"5\",\n \"used_key_parts\": [\"c_nationkey\"],\n \"r_loops\": 1,\n \"rows\": 150303,\n \"r_rows\": 150000,\n \"r_total_time_ms\": 270.3,\n \"filtered\": 100,\n \"r_filtered\": 60.691,\n \"attached_condition\": \"((subquery#2) > ((1000 *\n1000)))\",\n \"using_index\": true\n },\n \"subqueries\": [\n {\n \"query_block\": {\n \"select_id\": 2,\n \"r_loops\": 150000,\n \"r_total_time_ms\": 39531,\n \"table\": {\n \"table_name\": \"orders\",\n \"access_type\": \"ref\",\n \"possible_keys\": [\"i_o_custkey\"],\n \"key\": \"i_o_custkey\",\n \"key_length\": \"5\",\n \"used_key_parts\": [\"o_custkey\"],\n \"ref\": [\"dbt3sf1.customer.c_custkey\"],\n \"r_loops\": 150000,\n \"rows\": 7,\n \"r_rows\": 10,\n \"r_total_time_ms\": 39208,\n \"filtered\": 100,\n \"r_filtered\": 100\n }\n }\n }\n ]\n }\n}\nANALYZE shows that 39.2 seconds were spent in the subquery,\nwhich was executed 150K times (for every row of outer\ntable).\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/analyze-formatjson-examples/','','https://mariadb.com/kb/en/library/analyze-formatjson-examples/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (446,30,'CONTAINS','Syntax\n------ \nContains(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether a geometry g1 completely\ncontains geometry g2. CONTAINS() is based on the original\nMySQL implementation and uses object bounding rectangles,\nwhile ST_CONTAINS() uses object shapes. \n \nThis tests the opposite relationship to Within().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/contains/','','https://mariadb.com/kb/en/library/contains/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (447,30,'CROSSES','Syntax\n------ \nCrosses(g1,g2)\n \nDescription\n----------- \nReturns 1 if g1 spatially crosses g2. Returns NULL if g1 is\na Polygon or a MultiPolygon, or if g2 is a\nPoint or a MultiPoint. Otherwise, returns 0.\n \nThe term spatially crosses denotes a spatial relation\nbetween two\ngiven geometries that has the following properties:\nThe two geometries intersect\nTheir intersection results in a geometry that has a\ndimension that is one\n less than the maximum dimension of the two given geometries\nTheir intersection is not equal to either of the two given\ngeometries\n \nCROSSES() is based on the original MySQL implementation, and\nuses object bounding rectangles, while ST_CROSSES() uses\nobject shapes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/crosses/','','https://mariadb.com/kb/en/library/crosses/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (448,30,'DISJOINT','Syntax\n------ \nDisjoint(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether g1 is spatially disjoint\nfrom\n(does not intersect) g2.\n \nDISJOINT() tests the opposite relationship to INTERSECTS().\n \nDISJOINT() is based on the original MySQL implementation and\nuses object bounding rectangles, while ST_DISJOINT() uses\nobject shapes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/disjoint/','','https://mariadb.com/kb/en/library/disjoint/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (449,30,'EQUALS','Syntax\n------ \nEquals(g1,g2)\n \nFrom MariaDB 10.2.3:\n \nMBREQUALS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether g1 is spatially equal to\ng2.\n \nEQUALS() is based on the original MySQL implementation and\nuses object bounding rectangles, while ST_EQUALS() uses\nobject shapes.\n \nFrom MariaDB 10.2.3, MBREQUALS is a synonym for Equals.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/equals/','','https://mariadb.com/kb/en/library/equals/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (450,30,'INTERSECTS','Syntax\n------ \nINTERSECTS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 spatially\nintersects geometry g2.\n \nINTERSECTS() is based on the original MySQL implementation\nand uses object bounding rectangles, while ST_INTERSECTS()\nuses object shapes.\n \nINTERSECTS() tests the opposite relationship to DISJOINT().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/intersects/','','https://mariadb.com/kb/en/library/intersects/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (451,30,'OVERLAPS','Syntax\n------ \nOVERLAPS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether g1 spatially overlaps g2.\nThe term spatially overlaps is used if two geometries\nintersect and their\nintersection results in a geometry of the same dimension but\nnot equal to\neither of the given geometries.\n \nOVERLAPS() is based on the original MySQL implementation and\nuses object bounding rectangles, while ST_OVERLAPS() uses\nobject shapes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/overlaps/','','https://mariadb.com/kb/en/library/overlaps/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (452,30,'ST_CONTAINS','Syntax\n------ \nST_CONTAINS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether a geometry g1 completely\ncontains geometry g2.\n \nST_CONTAINS() uses object shapes, while CONTAINS(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \nST_CONTAINS tests the opposite relationship to ST_WITHIN().\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60,\n125 100, 175 150))\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'POINT(174 149)\');\n \nSELECT ST_CONTAINS(@g1,@g2);\n+----------------------+\n| ST_CONTAINS(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSET @g2 = ST_GEOMFROMTEXT(\'POINT(175 151)\');\n \nSELECT ST_CONTAINS(@g1,@g2);\n+----------------------+\n| ST_CONTAINS(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st-contains/','','https://mariadb.com/kb/en/library/st-contains/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (453,30,'ST_CROSSES','Syntax\n------ \nST_CROSSES(g1,g2)\n \nDescription\n----------- \nReturns 1 if geometry g1 spatially crosses geometry g2.\nReturns NULL if g1 is a Polygon or a MultiPolygon, or if g2\nis a\nPoint or a MultiPoint. Otherwise, returns 0.\n \nThe term spatially crosses denotes a spatial relation\nbetween two\ngiven geometries that has the following properties:\nThe two geometries intersect\nTheir intersection results in a geometry that has a\ndimension that is one\n less than the maximum dimension of the two given geometries\nTheir intersection is not equal to either of the two given\ngeometries\n \nST_CROSSES() uses object shapes, while CROSSES(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'LINESTRING(174 149, 176 151)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60,\n125 100, 175 150))\');\n \nSELECT ST_CROSSES(@g1,@g2);\n+---------------------+\n| ST_CROSSES(@g1,@g2) |\n+---------------------+\n| 1 |\n+---------------------+\n \nSET @g1 = ST_GEOMFROMTEXT(\'LINESTRING(176 149, 176 151)\');\n \nSELECT ST_CROSSES(@g1,@g2);\n+---------------------+\n| ST_CROSSES(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st-crosses/','','https://mariadb.com/kb/en/library/st-crosses/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (454,30,'ST_DIFFERENCE','Syntax\n------ \nST_DIFFERENCE(g1,g2)\n \nDescription\n----------- \nReturns a geometry representing the point set difference of\nthe given geometry values.\n \nExample\n \nSET @g1 = POINT(10,10), @g2 = POINT(20,20);\n \nSELECT ST_AsText(ST_Difference(@g1, @g2));\n+------------------------------------+\n| ST_AsText(ST_Difference(@g1, @g2)) |\n+------------------------------------+\n| POINT(10 10) |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_difference/','','https://mariadb.com/kb/en/library/st_difference/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (455,30,'ST_DISJOINT','Syntax\n------ \nST_DISJOINT(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 is spatially\ndisjoint from\n(does not intersect with) geometry g2.\n \nST_DISJOINT() uses object shapes, while DISJOINT(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \nST_DISJOINT() tests the opposite relationship to\nST_INTERSECTS().\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(0 0)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(2 0, 0 2)\');\n \nSELECT ST_DISJOINT(@g1,@g2);\n+----------------------+\n| ST_DISJOINT(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(0 0, 0 2)\');\n \nSELECT ST_DISJOINT(@g1,@g2);\n+----------------------+\n| ST_DISJOINT(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_disjoint/','','https://mariadb.com/kb/en/library/st_disjoint/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (456,30,'ST_DISTANCE','ST_DISTANCE() was introduced in MariaDB 5.3.3.\n \nSyntax\n------ \nST_DISTANCE(g1,g2)\n \nDescription\n----------- \nReturns the distance between two geometries, or null if not\ngiven valid inputs.\n \nExample\n \nSELECT ST_Distance(POINT(1,2),POINT(2,2));\n+------------------------------------+\n| ST_Distance(POINT(1,2),POINT(2,2)) |\n+------------------------------------+\n| 1 |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_distance/','','https://mariadb.com/kb/en/library/st_distance/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (457,30,'ST_EQUALS','Syntax\n------ \nST_EQUALS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 is spatially\nequal to geometry g2.\n \nST_EQUALS() uses object shapes, while EQUALS(), based on the\noriginal MySQL implementation, uses object bounding\nrectangles.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'LINESTRING(174 149, 176 151)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(176 151, 174 149)\');\n \nSELECT ST_EQUALS(@g1,@g2);\n+--------------------+\n| ST_EQUALS(@g1,@g2) |\n+--------------------+\n| 1 |\n+--------------------+\n \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(0 2)\');\n \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(2 0)\');\n \nSELECT ST_EQUALS(@g1,@g2);\n+--------------------+\n| ST_EQUALS(@g1,@g2) |\n+--------------------+\n| 0 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st-equals/','','https://mariadb.com/kb/en/library/st-equals/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (458,30,'ST_INTERSECTS','Syntax\n------ \nST_INTERSECTS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 spatially\nintersects geometry g2.\n \nST_INTERSECTS() uses object shapes, while INTERSECTS(),\nbased on the original MySQL implementation, uses object\nbounding rectangles.\n \nST_INTERSECTS() tests the opposite relationship to\nST_DISJOINT().\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(0 0)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(0 0, 0 2)\');\n \nSELECT ST_INTERSECTS(@g1,@g2);\n+------------------------+\n| ST_INTERSECTS(@g1,@g2) |\n+------------------------+\n| 1 |\n+------------------------+\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(2 0, 0 2)\');\n \nSELECT ST_INTERSECTS(@g1,@g2);\n+------------------------+\n| ST_INTERSECTS(@g1,@g2) |\n+------------------------+\n| 0 |\n+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st-intersects/','','https://mariadb.com/kb/en/library/st-intersects/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (459,30,'ST_LENGTH','Syntax\n------ \nST_LENGTH(ls)\n \nDescription\n----------- \nReturns as a double-precision number the length of the\nLineString value ls in its associated spatial reference.\n \nExamples\n-------- \nSET @ls = \'LineString(1 1,2 2,3 3)\';\n \nSELECT ST_LENGTH(ST_GeomFromText(@ls));\n+---------------------------------+\n| ST_LENGTH(ST_GeomFromText(@ls)) |\n+---------------------------------+\n| 2.82842712474619 |\n+---------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_length/','','https://mariadb.com/kb/en/library/st_length/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (460,30,'ST_OVERLAPS','Syntax\n------ \nST_OVERLAPS(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 spatially\noverlaps geometry g2.\n \nThe term spatially overlaps is used if two geometries\nintersect and their\nintersection results in a geometry of the same dimension but\nnot equal to\neither of the given geometries.\n \nST_OVERLAPS() uses object shapes, while OVERLAPS(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st-overlaps/','','https://mariadb.com/kb/en/library/st-overlaps/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (461,30,'ST_TOUCHES','Syntax\n------ \nST_TOUCHES(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 spatially\ntouches geometry g2. Two geometries spatially touch if the\ninteriors of the geometries do not intersect,\nbut the boundary of one of the geometries intersects either\nthe boundary or the\ninterior of the other.\n \nST_TOUCHES() uses object shapes, while TOUCHES(), based on\nthe original MySQL implementation, uses object bounding\nrectangles.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(2 0)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'LINESTRING(2 0, 0 2)\');\n \nSELECT ST_TOUCHES(@g1,@g2);\n+---------------------+\n| ST_TOUCHES(@g1,@g2) |\n+---------------------+\n| 1 |\n+---------------------+\n \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(2 1)\');\n \nSELECT ST_TOUCHES(@g1,@g2);\n+---------------------+\n| ST_TOUCHES(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st-touches/','','https://mariadb.com/kb/en/library/st-touches/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (462,30,'ST_WITHIN','Syntax\n------ \nST_WITHIN(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether geometry g1 is spatially\nwithin geometry g2.\n \nThis tests the opposite relationship as ST_CONTAINS().\n \nST_WITHIN() uses object shapes, while WITHIN(), based on the\noriginal MySQL implementation, uses object bounding\nrectangles.\n \nExamples\n-------- \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(174 149)\');\n \nSET @g2 = ST_GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60,\n125 100, 175 150))\');\n \nSELECT ST_WITHIN(@g1,@g2);\n+--------------------+\n| ST_WITHIN(@g1,@g2) |\n+--------------------+\n| 1 |\n+--------------------+\n \nSET @g1 = ST_GEOMFROMTEXT(\'POINT(176 151)\');\n \nSELECT ST_WITHIN(@g1,@g2);\n+--------------------+\n| ST_WITHIN(@g1,@g2) |\n+--------------------+\n| 0 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st-within/','','https://mariadb.com/kb/en/library/st-within/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (463,30,'TOUCHES','Syntax\n------ \nTouches(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether g1 spatially touches g2.\nTwo\ngeometries spatially touch if the interiors of the\ngeometries do not intersect,\nbut the boundary of one of the geometries intersects either\nthe boundary or the\ninterior of the other.\n \nTOUCHES() is based on the original MySQL implementation and\nuses object bounding rectangles, while ST_TOUCHES() uses\nobject shapes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/touches/','','https://mariadb.com/kb/en/library/touches/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (464,30,'WITHIN','Syntax\n------ \nWithin(g1,g2)\n \nDescription\n----------- \nReturns 1 or 0 to indicate whether g1 is spatially within\ng2.\nThis tests the opposite relationship as Contains().\n \nWITHIN() is based on the original MySQL implementation, and\nuses object bounding rectangles, while ST_WITHIN() uses\nobject shapes.\n \nExamples\n-------- \nSET @g1 = GEOMFROMTEXT(\'POINT(174 149)\');\nSET @g2 = GEOMFROMTEXT(\'POINT(176 151)\');\nSET @g3 = GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60, 125\n100, 175 150))\');\n \nSELECT within(@g1,@g3);\n+-----------------+\n| within(@g1,@g3) |\n+-----------------+\n| 1 |\n+-----------------+\n \nSELECT within(@g2,@g3);\n+-----------------+\n| within(@g2,@g3) |\n+-----------------+\n| 0 |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/within/','','https://mariadb.com/kb/en/library/within/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (465,31,'ADDDATE','Syntax\n------ \nADDDATE(date,INTERVAL expr unit), ADDDATE(expr,days)\n \nDescription\n----------- \nWhen invoked with the INTERVAL form of the second argument,\nADDDATE()\nis a synonym for DATE_ADD(). The related function\nSUBDATE() is a synonym for DATE_SUB(). For\ninformation on the INTERVAL unit argument, see the\ndiscussion for\nDATE_ADD().\n \nWhen invoked with the days form of the second argument,\nMariaDB treats it as an\ninteger number of days to be added to expr.\n \nExamples\n-------- \nSELECT DATE_ADD(\'2008-01-02\', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_ADD(\'2008-01-02\', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 2008-02-02 |\n+-----------------------------------------+\n \nSELECT ADDDATE(\'2008-01-02\', INTERVAL 31 DAY);\n+----------------------------------------+\n| ADDDATE(\'2008-01-02\', INTERVAL 31 DAY) |\n+----------------------------------------+\n| 2008-02-02 |\n+----------------------------------------+\n \nSELECT ADDDATE(\'2008-01-02\', 31);\n+---------------------------+\n| ADDDATE(\'2008-01-02\', 31) |\n+---------------------------+\n| 2008-02-02 |\n+---------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d, ADDDATE(d, 10) from t1;\n \n+---------------------+---------------------+\n| d | ADDDATE(d, 10) |\n+---------------------+---------------------+\n| 2007-01-30 21:31:07 | 2007-02-09 21:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-25 06:42:51 |\n| 2011-04-21 12:34:56 | 2011-05-01 12:34:56 |\n| 2011-10-30 06:31:41 | 2011-11-09 06:31:41 |\n| 2011-01-30 14:03:25 | 2011-02-09 14:03:25 |\n| 2004-10-07 11:19:34 | 2004-10-17 11:19:34 |\n+---------------------+---------------------+\n \nSELECT d, ADDDATE(d, INTERVAL 10 HOUR) from t1;\n \n+---------------------+------------------------------+\n| d | ADDDATE(d, INTERVAL 10 HOUR) |\n+---------------------+------------------------------+\n| 2007-01-30 21:31:07 | 2007-01-31 07:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-15 16:42:51 |\n| 2011-04-21 12:34:56 | 2011-04-21 22:34:56 |\n| 2011-10-30 06:31:41 | 2011-10-30 16:31:41 |\n| 2011-01-30 14:03:25 | 2011-01-31 00:03:25 |\n| 2004-10-07 11:19:34 | 2004-10-07 21:19:34 |\n+---------------------+------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/adddate/','','https://mariadb.com/kb/en/library/adddate/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (466,31,'ADDTIME','Syntax\n------ \nADDTIME(expr1,expr2)\n \nDescription\n----------- \nADDTIME() adds expr2 to expr1 and returns the result. expr1\nis a time\nor datetime expression, and expr2 is a time expression.\n \nExamples\n-------- \nSELECT ADDTIME(\'2007-12-31 23:59:59.999999\', \'1\n1:1:1.000002\');\n+---------------------------------------------------------+\n| ADDTIME(\'2007-12-31 23:59:59.999999\', \'1\n1:1:1.000002\') |\n+---------------------------------------------------------+\n| 2008-01-02 01:01:01.000001 |\n+---------------------------------------------------------+\n \nSELECT ADDTIME(\'01:00:00.999999\', \'02:00:00.999998\');\n+-----------------------------------------------+\n| ADDTIME(\'01:00:00.999999\', \'02:00:00.999998\') |\n+-----------------------------------------------+\n| 03:00:01.999997 |\n+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/addtime/','','https://mariadb.com/kb/en/library/addtime/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (467,31,'CONVERT_TZ','Syntax\n------ \nCONVERT_TZ(dt,from_tz,to_tz)\n \nDescription\n----------- \nCONVERT_TZ() converts a datetime value dt from the time zone\ngiven by from_tz to the time zone given by to_tz and returns\nthe resulting value.\n \nIn order to use named time zones, such as GMT, MET or\nAfrica/Johannesburg, the time_zone tables must be loaded\n(see mysql_tzinfo_to_sql).\n \nNo conversion will take place if the value falls outside of\nthe supported TIMESTAMP range (\'1970-01-01 00:00:01\' to\n\'2038-01-19 05:14:07\' UTC) when converted from from_tz to\nUTC.\n \nThis function returns NULL if the arguments are invalid (or\nnamed time zones have not been loaded).\n \nSee time zones for more information.\n \nExamples\n-------- \nSELECT CONVERT_TZ(\'2016-01-01\n12:00:00\',\'+00:00\',\'+10:00\');\n+-----------------------------------------------------+\n| CONVERT_TZ(\'2016-01-01 12:00:00\',\'+00:00\',\'+10:00\')\n|\n+-----------------------------------------------------+\n| 2016-01-01 22:00:00 |\n+-----------------------------------------------------+\n \nUsing named time zones (with the time zone tables loaded):\n \nSELECT CONVERT_TZ(\'2016-01-01\n12:00:00\',\'GMT\',\'Africa/Johannesburg\');\n+---------------------------------------------------------------+\n| CONVERT_TZ(\'2016-01-01\n12:00:00\',\'GMT\',\'Africa/Johannesburg\') |\n+---------------------------------------------------------------+\n| 2016-01-01 14:00:00 |\n+---------------------------------------------------------------+\n \nThe value is out of the TIMESTAMP range, so no conversion\ntakes place:\n \nSELECT CONVERT_TZ(\'1969-12-31\n22:00:00\',\'+00:00\',\'+10:00\');\n+-----------------------------------------------------+\n| CONVERT_TZ(\'1969-12-31 22:00:00\',\'+00:00\',\'+10:00\')\n|\n+-----------------------------------------------------+\n| 1969-12-31 22:00:00 |\n+-----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/convert_tz/','','https://mariadb.com/kb/en/library/convert_tz/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (468,31,'CURDATE','Syntax\n------ \nCURDATE()\n \nDescription\n----------- \nReturns the current date as a value in \'YYYY-MM-DD\' or\nYYYYMMDD\nformat, depending on whether the function is used in a\nstring or\nnumeric context.\n \nExamples\n-------- \nSELECT CURDATE();\n+------------+\n| CURDATE() |\n+------------+\n| 2019-03-05 |\n+------------+\n \nIn a numeric context (note this is not performing date\ncalculations):\n \nSELECT CURDATE() +0;\n \n+--------------+\n| CURDATE() +0 |\n+--------------+\n| 20190305 |\n+--------------+\n \nData calculation:\n \nSELECT CURDATE() - INTERVAL 5 DAY;\n \n+----------------------------+\n| CURDATE() - INTERVAL 5 DAY |\n+----------------------------+\n| 2019-02-28 |\n+----------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/curdate/','','https://mariadb.com/kb/en/library/curdate/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (469,31,'CURRENT_DATE','Syntax\n------ \nCURRENT_DATE, CURRENT_DATE()\n \nDescription\n----------- \nCURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/current_date/','','https://mariadb.com/kb/en/library/current_date/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (470,31,'CURRENT_TIME','Syntax\n------ \nCURRENT_TIME\nCURRENT_TIME([precision])\n \nDescription\n----------- \nCURRENT_TIME and CURRENT_TIME() are synonyms for CURTIME().\n \n\n\nURL: https://mariadb.com/kb/en/library/current_time/','','https://mariadb.com/kb/en/library/current_time/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (471,31,'CURRENT_TIMESTAMP','Syntax\n------ \nCURRENT_TIMESTAMP\nCURRENT_TIMESTAMP([precision])\n \nDescription\n----------- \nCURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for\nNOW().\n \n\n\nURL: https://mariadb.com/kb/en/library/current_timestamp/','','https://mariadb.com/kb/en/library/current_timestamp/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (472,31,'CURTIME','Syntax\n------ \nCURTIME([precision])\n \nDescription\n----------- \nReturns the current time as a value in \'HH:MM:SS\' or\nHHMMSS.uuuuuu format, depending on whether the function is\nused in a string or numeric context. The value is expressed\nin the current time zone.\n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nExamples\n-------- \nSELECT CURTIME();\n+-----------+\n| CURTIME() |\n+-----------+\n| 12:45:39 |\n+-----------+\n \nSELECT CURTIME() + 0;\n \n+---------------+\n| CURTIME() + 0 |\n+---------------+\n| 124545.000000 |\n+---------------+\n \nWith precision:\n \nSELECT CURTIME(2);\n+-------------+\n| CURTIME(2) |\n+-------------+\n| 09:49:08.09 |\n+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/curtime/','','https://mariadb.com/kb/en/library/curtime/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (473,31,'DATE FUNCTION','Syntax\n------ \nDATE(expr)\n \nDescription\n----------- \nExtracts the date part of the date or datetime expression\nexpr.\n \nExamples\n-------- \nSELECT DATE(\'2013-07-18 12:21:32\');\n+-----------------------------+\n| DATE(\'2013-07-18 12:21:32\') |\n+-----------------------------+\n| 2013-07-18 |\n+-----------------------------+\n \nError Handling\n \nUntil MariaDB 5.5.32, some versions of MariaDB returned\n0000-00-00 when passed an invalid date. From 5.5.32, NULL is\nreturned.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/date-function/','','https://mariadb.com/kb/en/library/date-function/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (474,31,'DATEDIFF','Syntax\n------ \nDATEDIFF(expr1,expr2)\n \nDescription\n----------- \nDATEDIFF() returns (expr1 – expr2) expressed\nas a value in days from one date to the other. expr1 and\nexpr2 are date\nor date-and-time expressions. Only the date parts of the\nvalues are used in the\ncalculation.\n \nExamples\n-------- \nSELECT DATEDIFF(\'2007-12-31 23:59:59\',\'2007-12-30\');\n+----------------------------------------------+\n| DATEDIFF(\'2007-12-31 23:59:59\',\'2007-12-30\') |\n+----------------------------------------------+\n| 1 |\n+----------------------------------------------+\n \nSELECT DATEDIFF(\'2010-11-30 23:59:59\',\'2010-12-31\');\n+----------------------------------------------+\n| DATEDIFF(\'2010-11-30 23:59:59\',\'2010-12-31\') |\n+----------------------------------------------+\n| -31 |\n+----------------------------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT NOW();\n+---------------------+\n| NOW() |\n+---------------------+\n| 2011-05-23 10:56:05 |\n+---------------------+\n \nSELECT d, DATEDIFF(NOW(),d) FROM t1;\n \n+---------------------+-------------------+\n| d | DATEDIFF(NOW(),d) |\n+---------------------+-------------------+\n| 2007-01-30 21:31:07 | 1574 |\n| 1983-10-15 06:42:51 | 10082 |\n| 2011-04-21 12:34:56 | 32 |\n| 2011-10-30 06:31:41 | -160 |\n| 2011-01-30 14:03:25 | 113 |\n| 2004-10-07 11:19:34 | 2419 |\n+---------------------+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/datediff/','','https://mariadb.com/kb/en/library/datediff/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (475,31,'DATE_ADD','Syntax\n------ \nDATE_ADD(date,INTERVAL expr unit)\n \nDescription\n----------- \nPerforms date arithmetic. The date argument specifies the\nstarting date or datetime value. expr is an expression\nspecifying the\ninterval value to be added or subtracted from the starting\ndate. expr is a\nstring; it may start with a \"-\" for negative intervals.\nunit is a\nkeyword indicating the units in which the expression should\nbe interpreted. See Date and Time Units for a complete list\nof permitted units. \n \nSee also DATE_SUB().\n \nExamples\n-------- \nSELECT \'2008-12-31 23:59:59\' + INTERVAL 1 SECOND;\n \n+-------------------------------------------+\n| \'2008-12-31 23:59:59\' + INTERVAL 1 SECOND |\n+-------------------------------------------+\n| 2009-01-01 00:00:00 |\n+-------------------------------------------+\n \nSELECT INTERVAL 1 DAY + \'2008-12-31\';\n \n+-------------------------------+\n| INTERVAL 1 DAY + \'2008-12-31\' |\n+-------------------------------+\n| 2009-01-01 |\n+-------------------------------+\n \nSELECT \'2005-01-01\' - INTERVAL 1 SECOND;\n \n+----------------------------------+\n| \'2005-01-01\' - INTERVAL 1 SECOND |\n+----------------------------------+\n| 2004-12-31 23:59:59 |\n+----------------------------------+\n \nSELECT DATE_ADD(\'2000-12-31 23:59:59\', INTERVAL 1 SECOND);\n+----------------------------------------------------+\n| DATE_ADD(\'2000-12-31 23:59:59\', INTERVAL 1 SECOND) |\n+----------------------------------------------------+\n| 2001-01-01 00:00:00 |\n+----------------------------------------------------+\n \nSELECT DATE_ADD(\'2010-12-31 23:59:59\', INTERVAL 1 DAY);\n+-------------------------------------------------+\n| DATE_ADD(\'2010-12-31 23:59:59\', INTERVAL 1 DAY) |\n+-------------------------------------------------+\n| 2011-01-01 23:59:59 |\n+-------------------------------------------------+\n \nSELECT DATE_ADD(\'2100-12-31 23:59:59\', INTERVAL \'1:1\'\nMINUTE_SECOND);\n+---------------------------------------------------------------+\n| DATE_ADD(\'2100-12-31 23:59:59\', INTERVAL \'1:1\'\nMINUTE_SECOND) |\n+---------------------------------------------------------------+\n| 2101-01-01 00:01:00 |\n+---------------------------------------------------------------+\n \nSELECT DATE_ADD(\'1900-01-01 00:00:00\', INTERVAL \'-1 10\'\nDAY_HOUR);\n+------------------------------------------------------------+\n| DATE_ADD(\'1900-01-01 00:00:00\', INTERVAL \'-1 10\'\nDAY_HOUR) |\n+------------------------------------------------------------+\n| 1899-12-30 14:00:00 |\n+------------------------------------------------------------+\n \nSELECT DATE_ADD(\'1992-12-31 23:59:59.000002\', INTERVAL\n\'1.999999\' SECOND_MICROSECOND);\n+--------------------------------------------------------------------------------+\n| DATE_ADD(\'1992-12-31 23:59:59.000002\', INTERVAL\n\'1.999999\' SECOND_MICROSECOND) |\n+--------------------------------------------------------------------------------+\n| 1993-01-01 00:00:01.000001 |\n+--------------------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/date_add/','','https://mariadb.com/kb/en/library/date_add/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (476,31,'DATE_FORMAT','Syntax\n------ \nDATE_FORMAT(date, format[, locale])\n \nDescription\n----------- \nFormats the date value according to the format string. \n \nThe language used for the names is controlled by the value\nof the lc_time_names system variable. See server locale for\nmore on the supported locales.\n \nThe options that can be used by DATE_FORMAT(), as well as\nits inverse STR_TO_DATE() and the FROM_UNIXTIME() function,\nare:\n \nOption | Description | \n \n%a | Short weekday name in current locale (Variable\nlc_time_names). | \n \n%b | Short form month name in current locale. For locale\nen_US this is one of:\nJan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov or Dec. | \n \n%c | Month with 1 or 2 digits. | \n \n%D | Day with English suffix \'th\', \'nd\', \'st\' or\n\'rd\'\'. (1st, 2nd, 3rd...). | \n \n%d | Day with 2 digits. | \n \n%e | Day with 1 or 2 digits. | \n \n%f | Sub seconds 6 digits. | \n \n%H | Hour with 2 digits between 00-23. | \n \n%h | Hour with 2 digits between 01-12. | \n \n%I | Hour with 2 digits between 01-12. | \n \n%i | Minute with 2 digits. | \n \n%j | Day of the year (001-366) | \n \n%k | Hour with 1 digits between 0-23. | \n \n%l | Hour with 1 digits between 1-12. | \n \n%M | Full month name in current locale (Variable\nlc_time_names). | \n \n%m | Month with 2 digits. | \n \n%p | AM/PM according to current locale (Variable\nlc_time_names). | \n \n%r | Time in 12 hour format, followed by AM/PM. Short for\n\'%I:%i:%S %p\'. | \n \n%S | Seconds with 2 digits. | \n \n%s | Seconds with 2 digits. | \n \n%T | Time in 24 hour format. Short for \'%H:%i:%S\'. | \n \n%U | Week number (00-53), when first day of the week is\nSunday. | \n \n%u | Week number (00-53), when first day of the week is\nMonday. | \n \n%V | Week number (01-53), when first day of the week is\nSunday. Used with %X. | \n \n%v | Week number (01-53), when first day of the week is\nMonday. Used with %x. | \n \n%W | Full weekday name in current locale (Variable\nlc_time_names). | \n \n%w | Day of the week. 0 = Sunday, 6 = Saturday. | \n \n%X | Year with 4 digits when first day of the week is\nSunday. Used with %V. | \n \n%x | Year with 4 digits when first day of the week is\nMonday. Used with %v. | \n \n%Y | Year with 4 digits. | \n \n%y | Year with 2 digits. | \n \n%# | For str_to_date(), skip all numbers. | \n \n%. | For str_to_date(), skip all punctation characters. | \n \n%@ | For str_to_date(), skip all alpha characters. | \n \n%% | A literal % character. | \n \nTo get a date in one of the standard formats, GET_FORMAT()\ncan be used.\n \nExamples\n-------- \nSELECT DATE_FORMAT(\'2009-10-04 22:23:00\', \'%W %M %Y\');\n+------------------------------------------------+\n| DATE_FORMAT(\'2009-10-04 22:23:00\', \'%W %M %Y\') |\n+------------------------------------------------+\n| Sunday October 2009 |\n+------------------------------------------------+\n \nSELECT DATE_FORMAT(\'2007-10-04 22:23:00\', \'%H:%i:%s\');\n+------------------------------------------------+\n| DATE_FORMAT(\'2007-10-04 22:23:00\', \'%H:%i:%s\') |\n+------------------------------------------------+\n| 22:23:00 |\n+------------------------------------------------+\n \nSELECT DATE_FORMAT(\'1900-10-04 22:23:00\', \'%D %y %a %d %m\n%b %j\');\n+------------------------------------------------------------+\n| DATE_FORMAT(\'1900-10-04 22:23:00\', \'%D %y %a %d %m %b\n%j\') |\n+------------------------------------------------------------+\n| 4th 00 Thu 04 10 Oct 277 |\n+------------------------------------------------------------+\n \nSELECT DATE_FORMAT(\'1997-10-04 22:23:00\', \'%H %k %I %r %T\n%S %w\');\n+------------------------------------------------------------+\n| DATE_FORMAT(\'1997-10-04 22:23:00\', \'%H %k %I %r %T %S\n%w\') |\n+------------------------------------------------------------+\n| 22 22 10 10:23:00 PM 22:23:00 00 6 |\n+------------------------------------------------------------+\n \nSELECT DATE_FORMAT(\'1999-01-01\', \'%X %V\');\n+------------------------------------+\n| DATE_FORMAT(\'1999-01-01\', \'%X %V\') |\n+------------------------------------+\n| 1998 52 |\n+------------------------------------+\n \nSELECT DATE_FORMAT(\'2006-06-00\', \'%d\');\n+---------------------------------+\n| DATE_FORMAT(\'2006-06-00\', \'%d\') |\n+---------------------------------+\n| 00 |\n+---------------------------------+\n \nOptionally, the locale can be explicitly specified as the\nthird DATE_FORMAT() argument. Doing so makes the function\nindependent from the session settings, and the three\nargument version of DATE_FORMAT() can be used in virtual\nindexed and persistent generated-columns:\n \nSELECT DATE_FORMAT(\'2006-01-01\', \'%W\', \'el_GR\');\n+------------------------------------------+\n| DATE_FORMAT(\'2006-01-01\', \'%W\', \'el_GR\') |\n+------------------------------------------+\n| Κυριακή |\n+------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/date_format/','','https://mariadb.com/kb/en/library/date_format/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (477,31,'DATE_SUB','Syntax\n------ \nDATE_SUB(date,INTERVAL expr unit)\n \nDescription\n----------- \nPerforms date arithmetic. The date argument specifies the\nstarting date or datetime value. expr is an expression\nspecifying the\ninterval value to be added or subtracted from the starting\ndate. expr is a\nstring; it may start with a \"-\" for negative intervals.\nunit is a\nkeyword indicating the units in which the expression should\nbe interpreted. See Date and Time Units for a complete list\nof permitted units. \n \nSee also DATE_ADD().\n \nExamples\n-------- \nSELECT DATE_SUB(\'1998-01-02\', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_SUB(\'1998-01-02\', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 1997-12-02 |\n+-----------------------------------------+\n \nSELECT DATE_SUB(\'2005-01-01 00:00:00\', INTERVAL \'1\n1:1:1\' DAY_SECOND);\n+----------------------------------------------------------------+\n| DATE_SUB(\'2005-01-01 00:00:00\', INTERVAL \'1 1:1:1\'\nDAY_SECOND) |\n+----------------------------------------------------------------+\n| 2004-12-30 22:58:59 |\n+----------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/date_sub/','','https://mariadb.com/kb/en/library/date_sub/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (478,31,'DAY','Syntax\n------ \nDAY(date)\n \nDescription\n----------- \nDAY() is a synonym for DAYOFMONTH().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/day/','','https://mariadb.com/kb/en/library/day/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (479,31,'DAYNAME','Syntax\n------ \nDAYNAME(date)\n \nDescription\n----------- \nReturns the name of the weekday for date. The language used\nfor the name is controlled by the value\nof the lc_time_names system variable. See server locale for\nmore on the supported locales.\n \nExamples\n-------- \nSELECT DAYNAME(\'2007-02-03\');\n+-----------------------+\n| DAYNAME(\'2007-02-03\') |\n+-----------------------+\n| Saturday |\n+-----------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d, DAYNAME(d) FROM t1;\n \n+---------------------+------------+\n| d | DAYNAME(d) |\n+---------------------+------------+\n| 2007-01-30 21:31:07 | Tuesday |\n| 1983-10-15 06:42:51 | Saturday |\n| 2011-04-21 12:34:56 | Thursday |\n| 2011-10-30 06:31:41 | Sunday |\n| 2011-01-30 14:03:25 | Sunday |\n| 2004-10-07 11:19:34 | Thursday |\n+---------------------+------------+\n \nChanging the locale:\n \nSET lc_time_names = \'fr_CA\';\n \nSELECT DAYNAME(\'2013-04-01\');\n+-----------------------+\n| DAYNAME(\'2013-04-01\') |\n+-----------------------+\n| lundi |\n+-----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/dayname/','','https://mariadb.com/kb/en/library/dayname/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (480,31,'DAYOFMONTH','Syntax\n------ \nDAYOFMONTH(date)\n \nDescription\n----------- \nReturns the day of the month for date, in the range 1 to 31,\nor 0\nfor dates such as \'0000-00-00\' or \'2008-00-00\' which\nhave a zero day\npart.\n \nDAY() is a synonym.\n \nExamples\n-------- \nSELECT DAYOFMONTH(\'2007-02-03\');\n+--------------------------+\n| DAYOFMONTH(\'2007-02-03\') |\n+--------------------------+\n| 3 |\n+--------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d FROM t1 where DAYOFMONTH(d) = 30;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/dayofmonth/','','https://mariadb.com/kb/en/library/dayofmonth/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (481,31,'DAYOFWEEK','Syntax\n------ \nDAYOFWEEK(date)\n \nDescription\n----------- \nReturns the day of the week index for the date (1 = Sunday,\n2 = Monday, ..., 7 =\nSaturday). These index values correspond to the ODBC\nstandard.\n \nThis contrasts with WEEKDAY() which follows a different\nindex numbering\n(0 = Monday, 1 = Tuesday, ... 6 = Sunday).\n \nExamples\n-------- \nSELECT DAYOFWEEK(\'2007-02-03\');\n+-------------------------+\n| DAYOFWEEK(\'2007-02-03\') |\n+-------------------------+\n| 7 |\n+-------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d, DAYNAME(d), DAYOFWEEK(d), WEEKDAY(d) from t1;\n \n+---------------------+------------+--------------+------------+\n| d | DAYNAME(d) | DAYOFWEEK(d) | WEEKDAY(d) |\n+---------------------+------------+--------------+------------+\n| 2007-01-30 21:31:07 | Tuesday | 3 | 1 |\n| 1983-10-15 06:42:51 | Saturday | 7 | 5 |\n| 2011-04-21 12:34:56 | Thursday | 5 | 3 |\n| 2011-10-30 06:31:41 | Sunday | 1 | 6 |\n| 2011-01-30 14:03:25 | Sunday | 1 | 6 |\n| 2004-10-07 11:19:34 | Thursday | 5 | 3 |\n+---------------------+------------+--------------+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/dayofweek/','','https://mariadb.com/kb/en/library/dayofweek/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (482,31,'DAYOFYEAR','Syntax\n------ \nDAYOFYEAR(date)\n \nDescription\n----------- \nReturns the day of the year for date, in the range 1 to 366.\n \nExamples\n-------- \nSELECT DAYOFYEAR(\'2018-02-16\');\n+-------------------------+\n| DAYOFYEAR(\'2018-02-16\') |\n+-------------------------+\n| 47 |\n+-------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/dayofyear/','','https://mariadb.com/kb/en/library/dayofyear/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (483,31,'EXTRACT','Syntax\n------ \nEXTRACT(unit FROM date)\n \nDescription\n----------- \nThe EXTRACT() function extracts the required unit from the\ndate. See Date and Time Units for a complete list of\npermitted units.\n \nIn MariaDB 10.0.7 and MariaDB 5.5.35, EXTRACT (HOUR FROM\n...) was changed to return a value from 0 to 23, adhering to\nthe SQL standard. Until MariaDB 10.0.6 and MariaDB 5.5.34,\nand in all versions of MySQL at least as of MySQL 5.7, it\ncould return a value > 23. HOUR() is not a standard\nfunction, so continues to adhere to the old behaviour\ninherited from MySQL.\n \nExamples\n-------- \nSELECT EXTRACT(YEAR FROM \'2009-07-02\');\n+---------------------------------+\n| EXTRACT(YEAR FROM \'2009-07-02\') |\n+---------------------------------+\n| 2009 |\n+---------------------------------+\n \nSELECT EXTRACT(YEAR_MONTH FROM \'2009-07-02 01:02:03\');\n+------------------------------------------------+\n| EXTRACT(YEAR_MONTH FROM \'2009-07-02 01:02:03\') |\n+------------------------------------------------+\n| 200907 |\n+------------------------------------------------+\n \nSELECT EXTRACT(DAY_MINUTE FROM \'2009-07-02 01:02:03\');\n+------------------------------------------------+\n| EXTRACT(DAY_MINUTE FROM \'2009-07-02 01:02:03\') |\n+------------------------------------------------+\n| 20102 |\n+------------------------------------------------+\n \nSELECT EXTRACT(MICROSECOND FROM \'2003-01-02\n10:30:00.000123\');\n+--------------------------------------------------------+\n| EXTRACT(MICROSECOND FROM \'2003-01-02 10:30:00.000123\') |\n+--------------------------------------------------------+\n| 123 |\n+--------------------------------------------------------+\n \nFrom MariaDB 10.0.7 and MariaDB 5.5.35, EXTRACT (HOUR\nFROM...) returns a value from 0 to 23, as per the SQL\nstandard. HOUR is not a standard function, so continues to\nadhere to the old behaviour inherited from MySQL.\n \nSELECT EXTRACT(HOUR FROM \'26:30:00\'), HOUR(\'26:30:00\');\n+-------------------------------+------------------+\n| EXTRACT(HOUR FROM \'26:30:00\') | HOUR(\'26:30:00\') |\n+-------------------------------+------------------+\n| 2 | 26 |\n+-------------------------------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/extract/','','https://mariadb.com/kb/en/library/extract/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (484,31,'FROM_DAYS','Syntax\n------ \nFROM_DAYS(N)\n \nDescription\n----------- \nGiven a day number N, returns a DATE value. The day count is\nbased on the number of days from the start of the standard\ncalendar (0000-00-00). \n \nThe function is not designed for use with dates before the\nadvent of the Gregorian calendar in October 1582. Results\nwill not be reliable since it doesn\'t account for the lost\ndays when the calendar changed from the Julian calendar.\n \nThis is the converse of the TO_DAYS() function.\n \nExamples\n-------- \nSELECT FROM_DAYS(730669);\n+-------------------+\n| FROM_DAYS(730669) |\n+-------------------+\n| 2000-07-03 |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/from_days/','','https://mariadb.com/kb/en/library/from_days/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (485,31,'FROM_UNIXTIME','Syntax\n------ \nFROM_UNIXTIME(unix_timestamp),\nFROM_UNIXTIME(unix_timestamp,format)\n \nDescription\n----------- \nReturns a representation of the unix_timestamp argument as a\nvalue in\n\'YYYY-MM-DD HH:MM:SS\' or YYYYMMDDHHMMSS.uuuuuu format,\ndepending on\nwhether the function is used in a string or numeric context.\nThe value\nis expressed in the current time zone. unix_timestamp is an\ninternal\ntimestamp value such as is produced by the UNIX_TIMESTAMP()\nfunction.\n \nIf format is given, the result is formatted according to the\nformat\nstring, which is used the same way as listed in the entry\nfor the\nDATE_FORMAT() function.\n \nTimestamps in MariaDB have a maximum value of 2147483647,\nequivalent to 2038-01-19 05:14:07. This is due to the\nunderlying 32-bit limitation. Using the function on a\ntimestamp beyond this will result in NULL being returned.\nUse DATETIME as a storage type if you require dates beyond\nthis.\n \nThe options that can be used by FROM_UNIXTIME(), as well as\nDATE_FORMAT() and STR_TO_DATE(), are:\n \nOption | Description | \n \n%a | Short weekday name in current locale (Variable\nlc_time_names). | \n \n%b | Short form month name in current locale. For locale\nen_US this is one of:\nJan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov or Dec. | \n \n%c | Month with 1 or 2 digits. | \n \n%D | Day with English suffix \'th\', \'nd\', \'st\' or\n\'rd\'\'. (1st, 2nd, 3rd...). | \n \n%d | Day with 2 digits. | \n \n%e | Day with 1 or 2 digits. | \n \n%f | Sub seconds 6 digits. | \n \n%H | Hour with 2 digits between 00-23. | \n \n%h | Hour with 2 digits between 01-12. | \n \n%I | Hour with 2 digits between 01-12. | \n \n%i | Minute with 2 digits. | \n \n%j | Day of the year (001-366) | \n \n%k | Hour with 1 digits between 0-23. | \n \n%l | Hour with 1 digits between 1-12. | \n \n%M | Full month name in current locale (Variable\nlc_time_names). | \n \n%m | Month with 2 digits. | \n \n%p | AM/PM according to current locale (Variable\nlc_time_names). | \n \n%r | Time in 12 hour format, followed by AM/PM. Short for\n\'%I:%i:%S %p\'. | \n \n%S | Seconds with 2 digits. | \n \n%s | Seconds with 2 digits. | \n \n%T | Time in 24 hour format. Short for \'%H:%i:%S\'. | \n \n%U | Week number (00-53), when first day of the week is\nSunday. | \n \n%u | Week number (00-53), when first day of the week is\nMonday. | \n \n%V | Week number (01-53), when first day of the week is\nSunday. Used with %X. | \n \n%v | Week number (01-53), when first day of the week is\nMonday. Used with %x. | \n \n%W | Full weekday name in current locale (Variable\nlc_time_names). | \n \n%w | Day of the week. 0 = Sunday, 1 = Saturday. | \n \n%X | Year with 4 digits when first day of the week is\nSunday. Used with %V. | \n \n%x | Year with 4 digits when first day of the week is\nSunday. Used with %v. | \n \n%Y | Year with 4 digits. | \n \n%y | Year with 2 digits. | \n \n%# | For str_to_date(), skip all numbers. | \n \n%. | For str_to_date(), skip all punctation characters. | \n \n%@ | For str_to_date(), skip all alpha characters. | \n \n%% | A literal % character. | \n \nPerformance Considerations\n \nIf your session time zone is set to SYSTEM (the default),\nFROM_UNIXTIME() will call the OS function to convert the\ndata using the system time zone. At least on Linux, the\ncorresponding function (localtime_r) uses a global mutex\ninside glibc that can cause contention under high concurrent\nload.\n \nSet your time zone to a named time zone to avoid this issue.\nSee mysql time zone tables for details on how to do this.\n \nExamples\n-------- \nSELECT FROM_UNIXTIME(1196440219);\n+---------------------------+\n| FROM_UNIXTIME(1196440219) |\n+---------------------------+\n| 2007-11-30 11:30:19 |\n+---------------------------+\n \nSELECT FROM_UNIXTIME(1196440219) + 0;\n \n+-------------------------------+\n| FROM_UNIXTIME(1196440219) + 0 |\n+-------------------------------+\n| 20071130113019.000000 |\n+-------------------------------+\n \nSELECT FROM_UNIXTIME(UNIX_TIMESTAMP(), \'%Y %D %M %h:%i:%s\n%x\');\n+---------------------------------------------------------+\n| FROM_UNIXTIME(UNIX_TIMESTAMP(), \'%Y %D %M %h:%i:%s %x\')\n|\n+---------------------------------------------------------+\n| 2010 27th March 01:03:47 2010 |\n+---------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/from_unixtime/','','https://mariadb.com/kb/en/library/from_unixtime/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (486,31,'GET_FORMAT','Syntax\n------ \nGET_FORMAT({DATE|DATETIME|TIME},\n{\'EUR\'|\'USA\'|\'JIS\'|\'ISO\'|\'INTERNAL\'})\n \nDescription\n----------- \nReturns a format string. This function is useful in\ncombination with\nthe DATE_FORMAT() and the STR_TO_DATE() functions.\n \nPossible result formats are:\n \nFunction Call | Result Format | \n \nGET_FORMAT(DATE,\'EUR\') | \'%d.%m.%Y\' | \n \nGET_FORMAT(DATE,\'USA\') | \'%m.%d.%Y\' | \n \nGET_FORMAT(DATE,\'JIS\') | \'%Y-%m-%d\' | \n \nGET_FORMAT(DATE,\'ISO\') | \'%Y-%m-%d\' | \n \nGET_FORMAT(DATE,\'INTERNAL\') | \'%Y%m%d\' | \n \nGET_FORMAT(DATETIME,\'EUR\') | \'%Y-%m-%d %H.%i.%s\' | \n \nGET_FORMAT(DATETIME,\'USA\') | \'%Y-%m-%d %H.%i.%s\' | \n \nGET_FORMAT(DATETIME,\'JIS\') | \'%Y-%m-%d %H:%i:%s\' | \n \nGET_FORMAT(DATETIME,\'ISO\') | \'%Y-%m-%d %H:%i:%s\' | \n \nGET_FORMAT(DATETIME,\'INTERNAL\') | \'%Y%m%d%H%i%s\' | \n \nGET_FORMAT(TIME,\'EUR\') | \'%H.%i.%s\' | \n \nGET_FORMAT(TIME,\'USA\') | \'%h:%i:%s %p\' | \n \nGET_FORMAT(TIME,\'JIS\') | \'%H:%i:%s\' | \n \nGET_FORMAT(TIME,\'ISO\') | \'%H:%i:%s\' | \n \nGET_FORMAT(TIME,\'INTERNAL\') | \'%H%i%s\' | \n \nExamples\n-------- \nObtaining the string matching to the standard European date\nformat:\n \nSELECT GET_FORMAT(DATE, \'EUR\');\n+-------------------------+\n| GET_FORMAT(DATE, \'EUR\') |\n+-------------------------+\n| %d.%m.%Y |\n+-------------------------+\n \nUsing the same string to format a date:\n \nSELECT DATE_FORMAT(\'2003-10-03\',GET_FORMAT(DATE,\'EUR\'));\n+--------------------------------------------------+\n| DATE_FORMAT(\'2003-10-03\',GET_FORMAT(DATE,\'EUR\')) |\n+--------------------------------------------------+\n| 03.10.2003 |\n+--------------------------------------------------+\n \nSELECT STR_TO_DATE(\'10.31.2003\',GET_FORMAT(DATE,\'USA\'));\n+--------------------------------------------------+\n| STR_TO_DATE(\'10.31.2003\',GET_FORMAT(DATE,\'USA\')) |\n+--------------------------------------------------+\n| 2003-10-31 |\n+--------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/get_format/','','https://mariadb.com/kb/en/library/get_format/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (487,31,'HOUR','Syntax\n------ \nHOUR(time)\n \nDescription\n----------- \nReturns the hour for time. The range of the return value is\n0 to 23\nfor time-of-day values. However, the range of TIME values\nactually is\nmuch larger, so HOUR can return values greater than 23.\n \nThe return value is always positive, even if a negative TIME\nvalue is provided.\n \nExamples\n-------- \nSELECT HOUR(\'10:05:03\');\n+------------------+\n| HOUR(\'10:05:03\') |\n+------------------+\n| 10 |\n+------------------+\n \nSELECT HOUR(\'272:59:59\');\n+-------------------+\n| HOUR(\'272:59:59\') |\n+-------------------+\n| 272 |\n+-------------------+\n \nDifference between EXTRACT (HOUR FROM ...) (>= MariaDB\n10.0.7 and MariaDB 5.5.35) and HOUR:\n \nSELECT EXTRACT(HOUR FROM \'26:30:00\'), HOUR(\'26:30:00\');\n+-------------------------------+------------------+\n| EXTRACT(HOUR FROM \'26:30:00\') | HOUR(\'26:30:00\') |\n+-------------------------------+------------------+\n| 2 | 26 |\n+-------------------------------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/hour/','','https://mariadb.com/kb/en/library/hour/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (488,31,'LAST_DAY','Syntax\n------ \nLAST_DAY(date)\n \nDescription\n----------- \nTakes a date or datetime value and returns the corresponding\nvalue for\nthe last day of the month. Returns NULL if the argument is\ninvalid.\n \nExamples\n-------- \nSELECT LAST_DAY(\'2003-02-05\');\n+------------------------+\n| LAST_DAY(\'2003-02-05\') |\n+------------------------+\n| 2003-02-28 |\n+------------------------+\n \nSELECT LAST_DAY(\'2004-02-05\');\n+------------------------+\n| LAST_DAY(\'2004-02-05\') |\n+------------------------+\n| 2004-02-29 |\n+------------------------+\n \nSELECT LAST_DAY(\'2004-01-01 01:01:01\');\n+---------------------------------+\n| LAST_DAY(\'2004-01-01 01:01:01\') |\n+---------------------------------+\n| 2004-01-31 |\n+---------------------------------+\n \nSELECT LAST_DAY(\'2003-03-32\');\n+------------------------+\n| LAST_DAY(\'2003-03-32\') |\n+------------------------+\n| NULL |\n+------------------------+\n1 row in set, 1 warning (0.00 sec)\n \nWarning (Code 1292): Incorrect datetime value:\n\'2003-03-32\'\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/last_day/','','https://mariadb.com/kb/en/library/last_day/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (489,31,'LOCALTIME','Syntax\n------ \nLOCALTIME\nLOCALTIME([precision])\n \nDescription\n----------- \nLOCALTIME and LOCALTIME() are synonyms for NOW().\n \n\n\nURL: https://mariadb.com/kb/en/library/localtime/','','https://mariadb.com/kb/en/library/localtime/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (490,31,'LOCALTIMESTAMP','Syntax\n------ \nLOCALTIMESTAMP\nLOCALTIMESTAMP([precision])\n \nDescription\n----------- \nLOCALTIMESTAMP and LOCALTIMESTAMP() are synonyms for NOW().\n \n\n\nURL: https://mariadb.com/kb/en/library/localtimestamp/','','https://mariadb.com/kb/en/library/localtimestamp/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (491,31,'MAKEDATE','Syntax\n------ \nMAKEDATE(year,dayofyear)\n \nDescription\n----------- \nReturns a date, given year and day-of-year values. dayofyear\nmust be\ngreater than 0 or the result is NULL.\n \nExamples\n-------- \nSELECT MAKEDATE(2011,31), MAKEDATE(2011,32);\n+-------------------+-------------------+\n| MAKEDATE(2011,31) | MAKEDATE(2011,32) |\n+-------------------+-------------------+\n| 2011-01-31 | 2011-02-01 |\n+-------------------+-------------------+\n \nSELECT MAKEDATE(2011,365), MAKEDATE(2014,365);\n+--------------------+--------------------+\n| MAKEDATE(2011,365) | MAKEDATE(2014,365) |\n+--------------------+--------------------+\n| 2011-12-31 | 2014-12-31 |\n+--------------------+--------------------+\n \nSELECT MAKEDATE(2011,0);\n+------------------+\n| MAKEDATE(2011,0) |\n+------------------+\n| NULL |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/makedate/','','https://mariadb.com/kb/en/library/makedate/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (492,31,'MAKETIME','Syntax\n------ \nMAKETIME(hour,minute,second)\n \nDescription\n----------- \nReturns a time value calculated from the hour, minute, and\nsecond arguments.\n \nIf minute or second are out of the range 0 to 60, NULL is\nreturned. The hour can be in the range -838 to 838, outside\nof which the value is truncated with a warning.\n \nExamples\n-------- \nSELECT MAKETIME(13,57,33);\n+--------------------+\n| MAKETIME(13,57,33) |\n+--------------------+\n| 13:57:33 |\n+--------------------+\n \nSELECT MAKETIME(-13,57,33);\n+---------------------+\n| MAKETIME(-13,57,33) |\n+---------------------+\n| -13:57:33 |\n+---------------------+\n \nSELECT MAKETIME(13,67,33);\n+--------------------+\n| MAKETIME(13,67,33) |\n+--------------------+\n| NULL |\n+--------------------+\n \nSELECT MAKETIME(-1000,57,33);\n+-----------------------+\n| MAKETIME(-1000,57,33) |\n+-----------------------+\n| -838:59:59 |\n+-----------------------+\n1 row in set, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+-----------------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value:\n\'-1000:57:33\' |\n+---------+------+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/maketime/','','https://mariadb.com/kb/en/library/maketime/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (493,31,'MICROSECOND','Syntax\n------ \nMICROSECOND(expr)\n \nDescription\n----------- \nReturns the microseconds from the time or datetime\nexpression expr as a number in the range from 0 to 999999.\n \nIf expr is a time with no microseconds, zero is returned,\nwhile if expr is a date with no time, zero with a warning is\nreturned.\n \nExamples\n-------- \nSELECT MICROSECOND(\'12:00:00.123456\');\n+--------------------------------+\n| MICROSECOND(\'12:00:00.123456\') |\n+--------------------------------+\n| 123456 |\n+--------------------------------+\n \nSELECT MICROSECOND(\'2009-12-31 23:59:59.000010\');\n+-------------------------------------------+\n| MICROSECOND(\'2009-12-31 23:59:59.000010\') |\n+-------------------------------------------+\n| 10 |\n+-------------------------------------------+\n \nSELECT MICROSECOND(\'2013-08-07 12:13:14\');\n+------------------------------------+\n| MICROSECOND(\'2013-08-07 12:13:14\') |\n+------------------------------------+\n| 0 |\n+------------------------------------+\n \nSELECT MICROSECOND(\'2013-08-07\');\n+---------------------------+\n| MICROSECOND(\'2013-08-07\') |\n+---------------------------+\n| 0 |\n+---------------------------+\n1 row in set, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+----------------------------------------------+\n| Level | Code | Message |\n+---------+------+----------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value:\n\'2013-08-07\' |\n+---------+------+----------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/microsecond/','','https://mariadb.com/kb/en/library/microsecond/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (494,31,'MINUTE','Syntax\n------ \nMINUTE(time)\n \nDescription\n----------- \nReturns the minute for time, in the range 0 to 59. \n \nExamples\n-------- \nSELECT MINUTE(\'2013-08-03 11:04:03\');\n+-------------------------------+\n| MINUTE(\'2013-08-03 11:04:03\') |\n+-------------------------------+\n| 4 |\n+-------------------------------+\n \n SELECT MINUTE (\'23:12:50\');\n+---------------------+\n| MINUTE (\'23:12:50\') |\n+---------------------+\n| 12 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/minute/','','https://mariadb.com/kb/en/library/minute/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (495,31,'MONTH','Syntax\n------ \nMONTH(date)\n \nDescription\n----------- \nReturns the month for date in the range 1 to 12 for January\nto\nDecember, or 0 for dates such as \'0000-00-00\' or\n\'2008-00-00\' that\nhave a zero month part.\n \nExamples\n-------- \nSELECT MONTH(\'2019-01-03\');\n+---------------------+\n| MONTH(\'2019-01-03\') |\n+---------------------+\n| 1 |\n+---------------------+\n \nSELECT MONTH(\'2019-00-03\');\n+---------------------+\n| MONTH(\'2019-00-03\') |\n+---------------------+\n| 0 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/month/','','https://mariadb.com/kb/en/library/month/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (496,31,'MONTHNAME','Syntax\n------ \nMONTHNAME(date)\n \nDescription\n----------- \nReturns the full name of the month for date. The language\nused for the name is controlled by the value of the\nlc_time_names system variable. See server locale for more on\nthe supported locales.\n \nExamples\n-------- \nSELECT MONTHNAME(\'2019-02-03\');\n+-------------------------+\n| MONTHNAME(\'2019-02-03\') |\n+-------------------------+\n| February |\n+-------------------------+\n \nChanging the locale:\n \nSET lc_time_names = \'fr_CA\';\n \nSELECT MONTHNAME(\'2019-05-21\');\n+-------------------------+\n| MONTHNAME(\'2019-05-21\') |\n+-------------------------+\n| mai |\n+-------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/monthname/','','https://mariadb.com/kb/en/library/monthname/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (497,31,'NOW','Syntax\n------ \nNOW([precision])\nCURRENT_TIMESTAMP\nCURRENT_TIMESTAMP([precision])\nLOCALTIME, LOCALTIME([precision])\nLOCALTIMESTAMP\nLOCALTIMESTAMP([precision])\n \nDescription\n----------- \nReturns the current date and time as a value in \'YYYY-MM-DD\nHH:MM:SS\'\nor YYYYMMDDHHMMSS.uuuuuu format, depending on whether the\nfunction is\nused in a string or numeric context. The value is expressed\nin the\ncurrent time zone.\n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nNOW() (or its synonyms) can be used as the default value for\nTIMESTAMP columns as well as, since MariaDB 10.0.1, DATETIME\ncolumns. Before MariaDB 10.0.1, it was only possible for a\nsingle TIMESTAMP column per table to contain the\nCURRENT_TIMESTAMP as its default.\n \nWhen displayed in the INFORMATION_SCHEMA.COLUMNS table, a\ndefault CURRENT TIMESTAMP is displayed as CURRENT_TIMESTAMP\nup until MariaDB 10.2.2, and as current_timestamp() from\nMariaDB 10.2.3, due to to MariaDB 10.2 accepting expressions\nin the DEFAULT clause.\n \nExamples\n-------- \nSELECT NOW();\n+---------------------+\n| NOW() |\n+---------------------+\n| 2010-03-27 13:13:25 |\n+---------------------+\n \nSELECT NOW() + 0;\n \n+-----------------------+\n| NOW() + 0 |\n+-----------------------+\n| 20100327131329.000000 |\n+-----------------------+\n \nWith precision:\n \nSELECT CURRENT_TIMESTAMP(2);\n+------------------------+\n| CURRENT_TIMESTAMP(2) |\n+------------------------+\n| 2018-07-10 09:47:26.24 |\n+------------------------+\n \nUsed as a default TIMESTAMP:\n \nCREATE TABLE t (createdTS TIMESTAMP NOT NULL DEFAULT\nCURRENT_TIMESTAMP);\n \nFrom MariaDB 10.2.2:\n \nSELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE\nTABLE_SCHEMA=\'test\'\n AND COLUMN_NAME LIKE \'%ts%\'\\G\n*************************** 1. row\n***************************\n TABLE_CATALOG: def\n TABLE_SCHEMA: test\n TABLE_NAME: t\n COLUMN_NAME: ts\n ORDINAL_POSITION: 1\n COLUMN_DEFAULT: current_timestamp()\n...\n \n\n\nURL: https://mariadb.com/kb/en/library/now/','','https://mariadb.com/kb/en/library/now/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (498,31,'PERIOD_ADD','Syntax\n------ \nPERIOD_ADD(P,N)\n \nDescription\n----------- \nAdds N months to period P. P is in the format YYMM or\nYYYYMM, and is not a date value. If P contains a two-digit\nyear, values from 00 to 69 are converted to from 2000 to\n2069, while values from 70 are converted to 1970 upwards.\n \nReturns a value in the format YYYYMM.\n \nExamples\n-------- \nSELECT PERIOD_ADD(200801,2);\n+----------------------+\n| PERIOD_ADD(200801,2) |\n+----------------------+\n| 200803 |\n+----------------------+\n \nSELECT PERIOD_ADD(6910,2);\n+--------------------+\n| PERIOD_ADD(6910,2) |\n+--------------------+\n| 206912 |\n+--------------------+\n \nSELECT PERIOD_ADD(7010,2);\n+--------------------+\n| PERIOD_ADD(7010,2) |\n+--------------------+\n| 197012 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/period_add/','','https://mariadb.com/kb/en/library/period_add/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (499,31,'PERIOD_DIFF','Syntax\n------ \nPERIOD_DIFF(P1,P2)\n \nDescription\n----------- \nReturns the number of months between periods P1 and P2. P1\nand P2 \ncan be in the format YYMM or YYYYMM, and are not date\nvalues.\n \nIf P1 or P2 contains a two-digit year, values from 00 to 69\nare converted to from 2000 to 2069, while values from 70 are\nconverted to 1970 upwards.\n \nExamples\n-------- \nSELECT PERIOD_DIFF(200802,200703);\n+----------------------------+\n| PERIOD_DIFF(200802,200703) |\n+----------------------------+\n| 11 |\n+----------------------------+\n \nSELECT PERIOD_DIFF(6902,6803);\n+------------------------+\n| PERIOD_DIFF(6902,6803) |\n+------------------------+\n| 11 |\n+------------------------+\n \nSELECT PERIOD_DIFF(7002,6803);\n+------------------------+\n| PERIOD_DIFF(7002,6803) |\n+------------------------+\n| -1177 |\n+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/period_diff/','','https://mariadb.com/kb/en/library/period_diff/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (500,31,'QUARTER','Syntax\n------ \nQUARTER(date)\n \nDescription\n----------- \nReturns the quarter of the year for date, in the range 1 to\n4. Returns 0 if month contains a zero value, or NULL if the\ngiven value is not otherwise a valid date (zero values are\naccepted).\n \nExamples\n-------- \nSELECT QUARTER(\'2008-04-01\');\n+-----------------------+\n| QUARTER(\'2008-04-01\') |\n+-----------------------+\n| 2 |\n+-----------------------+\n \nSELECT QUARTER(\'2019-00-01\');\n+-----------------------+\n| QUARTER(\'2019-00-01\') |\n+-----------------------+\n| 0 |\n+-----------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/quarter/','','https://mariadb.com/kb/en/library/quarter/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (501,31,'SECOND','Syntax\n------ \nSECOND(time)\n \nDescription\n----------- \nReturns the second for a given time (which can include\nmicroseconds), in the range 0 to 59, or NULL if not given a\nvalid time value.\n \nExamples\n-------- \nSELECT SECOND(\'10:05:03\');\n+--------------------+\n| SECOND(\'10:05:03\') |\n+--------------------+\n| 3 |\n+--------------------+\n \nSELECT SECOND(\'10:05:01.999999\');\n+---------------------------+\n| SECOND(\'10:05:01.999999\') |\n+---------------------------+\n| 1 |\n+---------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/second/','','https://mariadb.com/kb/en/library/second/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (502,31,'SEC_TO_TIME','Syntax\n------ \nSEC_TO_TIME(seconds)\n \nDescription\n----------- \nReturns the seconds argument, converted to hours, minutes,\nand\nseconds, as a TIME value. The range of the result is\nconstrained to\nthat of the TIME data type. A warning occurs if the argument\ncorresponds to a value outside that range.\n \nThe time will be returned in the format hh:mm:ss, or hhmmss\nif used in a numeric calculation.\n \nExamples\n-------- \nSELECT SEC_TO_TIME(12414);\n+--------------------+\n| SEC_TO_TIME(12414) |\n+--------------------+\n| 03:26:54 |\n+--------------------+\n \nSELECT SEC_TO_TIME(12414)+0;\n \n+----------------------+\n| SEC_TO_TIME(12414)+0 |\n+----------------------+\n| 32654 |\n+----------------------+\n \nSELECT SEC_TO_TIME(9999999);\n+----------------------+\n| SEC_TO_TIME(9999999) |\n+----------------------+\n| 838:59:59 |\n+----------------------+\n1 row in set, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+-------------------------------------------+\n| Level | Code | Message |\n+---------+------+-------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value:\n\'9999999\' |\n+---------+------+-------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/sec_to_time/','','https://mariadb.com/kb/en/library/sec_to_time/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (503,31,'STR_TO_DATE','Syntax\n------ \nSTR_TO_DATE(str,format)\n \nDescription\n----------- \nThis is the inverse of the DATE_FORMAT() function. It takes\na string str and a format string format. STR_TO_DATE()\nreturns a\nDATETIME value if the format string contains both date and\ntime parts, or a\nDATE or TIME value if the string contains only date or time\nparts.\n \nThe date, time, or datetime values contained in str should\nbe given in the format indicated by format. If str contains\nan illegal date, time, or datetime value, STR_TO_DATE()\nreturns NULL. An illegal value also produces a warning.\n \nThe options that can be used by STR_TO_DATE(), as well as\nits inverse DATE_FORMAT() and the FROM_UNIXTIME() function,\nare:\n \nOption | Description | \n \n%a | Short weekday name in current locale (Variable\nlc_time_names). | \n \n%b | Short form month name in current locale. For locale\nen_US this is one of:\nJan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov or Dec. | \n \n%c | Month with 1 or 2 digits. | \n \n%D | Day with English suffix \'th\', \'nd\', \'st\' or\n\'rd\'\'. (1st, 2nd, 3rd...). | \n \n%d | Day with 2 digits. | \n \n%e | Day with 1 or 2 digits. | \n \n%f | Sub seconds 6 digits. | \n \n%H | Hour with 2 digits between 00-23. | \n \n%h | Hour with 2 digits between 01-12. | \n \n%I | Hour with 2 digits between 01-12. | \n \n%i | Minute with 2 digits. | \n \n%j | Day of the year (001-366) | \n \n%k | Hour with 1 digits between 0-23. | \n \n%l | Hour with 1 digits between 1-12. | \n \n%M | Full month name in current locale (Variable\nlc_time_names). | \n \n%m | Month with 2 digits. | \n \n%p | AM/PM according to current locale (Variable\nlc_time_names). | \n \n%r | Time in 12 hour format, followed by AM/PM. Short for\n\'%I:%i:%S %p\'. | \n \n%S | Seconds with 2 digits. | \n \n%s | Seconds with 2 digits. | \n \n%T | Time in 24 hour format. Short for \'%H:%i:%S\'. | \n \n%U | Week number (00-53), when first day of the week is\nSunday. | \n \n%u | Week number (00-53), when first day of the week is\nMonday. | \n \n%V | Week number (01-53), when first day of the week is\nSunday. Used with %X. | \n \n%v | Week number (01-53), when first day of the week is\nMonday. Used with %x. | \n \n%W | Full weekday name in current locale (Variable\nlc_time_names). | \n \n%w | Day of the week. 0 = Sunday, 6 = Saturday. | \n \n%X | Year with 4 digits when first day of the week is\nSunday. Used with %V. | \n \n%x | Year with 4 digits when first day of the week is\nMonday. Used with %v. | \n \n%Y | Year with 4 digits. | \n \n%y | Year with 2 digits. | \n \n%# | For str_to_date(), skip all numbers. | \n \n%. | For str_to_date(), skip all punctation characters. | \n \n%@ | For str_to_date(), skip all alpha characters. | \n \n%% | A literal % character. | \n \nExamples\n-------- \nSELECT STR_TO_DATE(\'Wednesday, June 2, 2014\', \'%W, %M %e,\n%Y\');\n+---------------------------------------------------------+\n| STR_TO_DATE(\'Wednesday, June 2, 2014\', \'%W, %M %e,\n%Y\') |\n+---------------------------------------------------------+\n| 2014-06-02 |\n+---------------------------------------------------------+\n \nSELECT STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W,\n%M %e, %Y\');\n+--------------------------------------------------------------+\n| STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W, %M %e,\n%Y\') |\n+--------------------------------------------------------------+\n| NULL |\n+--------------------------------------------------------------+\n1 row in set, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+---------+------+-----------------------------------------------------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------------------------------------------------+\n| Warning | 1411 | Incorrect datetime value:\n\'Wednesday23423, June 2, 2014\' for function str_to_date |\n+---------+------+-----------------------------------------------------------------------------------+\n \nSELECT STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W%#,\n%M %e, %Y\');\n+----------------------------------------------------------------+\n| STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W%#, %M\n%e, %Y\') |\n+----------------------------------------------------------------+\n| 2014-06-02 |\n+----------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/str_to_date/','','https://mariadb.com/kb/en/library/str_to_date/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (504,31,'SUBDATE','Syntax\n------ \nSUBDATE(date,INTERVAL expr unit), SUBDATE(expr,days)\n \nDescription\n----------- \nWhen invoked with the INTERVAL form of the second argument,\nSUBDATE()\nis a synonym for DATE_SUB(). See Date and Time Units for a\ncomplete list of permitted units. \n \nThe second form allows the use of an integer value for days.\nIn such\ncases, it is interpreted as the number of days to be\nsubtracted from\nthe date or datetime expression expr.\n \nExamples\n-------- \nSELECT DATE_SUB(\'2008-01-02\', INTERVAL 31 DAY);\n+-----------------------------------------+\n| DATE_SUB(\'2008-01-02\', INTERVAL 31 DAY) |\n+-----------------------------------------+\n| 2007-12-02 |\n+-----------------------------------------+\n \nSELECT SUBDATE(\'2008-01-02\', INTERVAL 31 DAY);\n+----------------------------------------+\n| SUBDATE(\'2008-01-02\', INTERVAL 31 DAY) |\n+----------------------------------------+\n| 2007-12-02 |\n+----------------------------------------+\n \nSELECT SUBDATE(\'2008-01-02 12:00:00\', 31);\n+------------------------------------+\n| SUBDATE(\'2008-01-02 12:00:00\', 31) |\n+------------------------------------+\n| 2007-12-02 12:00:00 |\n+------------------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d, SUBDATE(d, 10) from t1;\n \n+---------------------+---------------------+\n| d | SUBDATE(d, 10) |\n+---------------------+---------------------+\n| 2007-01-30 21:31:07 | 2007-01-20 21:31:07 |\n| 1983-10-15 06:42:51 | 1983-10-05 06:42:51 |\n| 2011-04-21 12:34:56 | 2011-04-11 12:34:56 |\n| 2011-10-30 06:31:41 | 2011-10-20 06:31:41 |\n| 2011-01-30 14:03:25 | 2011-01-20 14:03:25 |\n| 2004-10-07 11:19:34 | 2004-09-27 11:19:34 |\n+---------------------+---------------------+\n \nSELECT d, SUBDATE(d, INTERVAL 10 MINUTE) from t1;\n \n+---------------------+--------------------------------+\n| d | SUBDATE(d, INTERVAL 10 MINUTE) |\n+---------------------+--------------------------------+\n| 2007-01-30 21:31:07 | 2007-01-30 21:21:07 |\n| 1983-10-15 06:42:51 | 1983-10-15 06:32:51 |\n| 2011-04-21 12:34:56 | 2011-04-21 12:24:56 |\n| 2011-10-30 06:31:41 | 2011-10-30 06:21:41 |\n| 2011-01-30 14:03:25 | 2011-01-30 13:53:25 |\n| 2004-10-07 11:19:34 | 2004-10-07 11:09:34 |\n+---------------------+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/subdate/','','https://mariadb.com/kb/en/library/subdate/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (505,31,'SUBTIME','Syntax\n------ \nSUBTIME(expr1,expr2)\n \nDescription\n----------- \nSUBTIME() returns expr1 - expr2 expressed as a value in the\nsame\nformat as expr1. expr1 is a time or datetime expression, and\nexpr2 is\na time expression.\n \nExamples\n-------- \nSELECT SUBTIME(\'2007-12-31 23:59:59.999999\',\'1\n1:1:1.000002\');\n+--------------------------------------------------------+\n| SUBTIME(\'2007-12-31 23:59:59.999999\',\'1 1:1:1.000002\')\n|\n+--------------------------------------------------------+\n| 2007-12-30 22:58:58.999997 |\n+--------------------------------------------------------+\n \nSELECT SUBTIME(\'01:00:00.999999\', \'02:00:00.999998\');\n+-----------------------------------------------+\n| SUBTIME(\'01:00:00.999999\', \'02:00:00.999998\') |\n+-----------------------------------------------+\n| -00:59:59.999999 |\n+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/subtime/','','https://mariadb.com/kb/en/library/subtime/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (506,31,'SYSDATE','Syntax\n------ \nSYSDATE([precision])\n \nDescription\n----------- \nReturns the current date and time as a value in \'YYYY-MM-DD\nHH:MM:SS\'\nor YYYYMMDDHHMMSS.uuuuuu format, depending on whether the\nfunction is\nused in a string or numeric context.\n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nSYSDATE() returns the time at which it executes. This\ndiffers from the\nbehavior for NOW(), which returns a constant time that\nindicates the\ntime at which the statement began to execute. (Within a\nstored routine\nor trigger, NOW() returns the time at which the routine or\ntriggering\nstatement began to execute.)\n \nIn addition, changing the timestamp system variable with a\nSET timestamp statement affects the value returned by\nNOW() but not by SYSDATE(). This means that timestamp\nsettings in the\nbinary log have no effect on invocations of SYSDATE().\n \nBecause SYSDATE() can return different values even within\nthe same\nstatement, and is not affected by SET TIMESTAMP, it is\nnon-deterministic and therefore unsafe for replication if\nstatement-based binary logging is used. If that is a\nproblem, you can\nuse row-based logging, or start the server with the mysqld\noption --sysdate-is-now to cause SYSDATE() to be an alias\nfor NOW(). The non-deterministic nature of SYSDATE() also\nmeans that indexes cannot be used for evaluating expressions\nthat refer to it, and that statements using the SYSDATE()\nfunction are unsafe for statement-based replication.\n \nExamples\n-------- \nDifference between NOW() and SYSDATE():\n \nSELECT NOW(), SLEEP(2), NOW();\n+---------------------+----------+---------------------+\n| NOW() | SLEEP(2) | NOW() |\n+---------------------+----------+---------------------+\n| 2010-03-27 13:23:40 | 0 | 2010-03-27 13:23:40 |\n+---------------------+----------+---------------------+\n \nSELECT SYSDATE(), SLEEP(2), SYSDATE();\n+---------------------+----------+---------------------+\n| SYSDATE() | SLEEP(2) | SYSDATE() |\n+---------------------+----------+---------------------+\n| 2010-03-27 13:23:52 | 0 | 2010-03-27 13:23:54 |\n+---------------------+----------+---------------------+\n \nWith precision:\n \nSELECT SYSDATE(4);\n+--------------------------+\n| SYSDATE(4) |\n+--------------------------+\n| 2018-07-10 10:17:13.1689 |\n+--------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/sysdate/','','https://mariadb.com/kb/en/library/sysdate/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (507,31,'TIME Function','Syntax\n------ \nTIME(expr)\n \nDescription\n----------- \nExtracts the time part of the time or datetime expression\nexpr and\nreturns it as a string.\n \nExamples\n-------- \nSELECT TIME(\'2003-12-31 01:02:03\');\n+-----------------------------+\n| TIME(\'2003-12-31 01:02:03\') |\n+-----------------------------+\n| 01:02:03 |\n+-----------------------------+\n \nSELECT TIME(\'2003-12-31 01:02:03.000123\');\n+------------------------------------+\n| TIME(\'2003-12-31 01:02:03.000123\') |\n+------------------------------------+\n| 01:02:03.000123 |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/time-function/','','https://mariadb.com/kb/en/library/time-function/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (508,31,'TIMEDIFF','Syntax\n------ \nTIMEDIFF(expr1,expr2)\n \nDescription\n----------- \nTIMEDIFF() returns expr1 - expr2 expressed as a time value.\nexpr1 and\nexpr2 are time or date-and-time expressions, but both must\nbe of the\nsame type.\n \nExamples\n-------- \nSELECT TIMEDIFF(\'2000:01:01 00:00:00\', \'2000:01:01\n00:00:00.000001\');\n+---------------------------------------------------------------+\n| TIMEDIFF(\'2000:01:01 00:00:00\', \'2000:01:01\n00:00:00.000001\') |\n+---------------------------------------------------------------+\n| -00:00:00.000001 |\n+---------------------------------------------------------------+\n \nSELECT TIMEDIFF(\'2008-12-31 23:59:59.000001\', \'2008-12-30\n01:01:01.000002\');\n+----------------------------------------------------------------------+\n| TIMEDIFF(\'2008-12-31 23:59:59.000001\', \'2008-12-30\n01:01:01.000002\') |\n+----------------------------------------------------------------------+\n| 46:58:57.999999 |\n+----------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/timediff/','','https://mariadb.com/kb/en/library/timediff/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (509,31,'TIMESTAMP FUNCTION','Syntax\n------ \nTIMESTAMP(expr), TIMESTAMP(expr1,expr2)\n \nDescription\n----------- \nWith a single argument, this function returns the date or\ndatetime\nexpression expr as a datetime value. With two arguments, it\nadds the\ntime expression expr2 to the date or datetime expression\nexpr1 and\nreturns the result as a datetime value.\n \nExamples\n-------- \nSELECT TIMESTAMP(\'2003-12-31\');\n+-------------------------+\n| TIMESTAMP(\'2003-12-31\') |\n+-------------------------+\n| 2003-12-31 00:00:00 |\n+-------------------------+\n \nSELECT TIMESTAMP(\'2003-12-31 12:00:00\',\'6:30:00\');\n+--------------------------------------------+\n| TIMESTAMP(\'2003-12-31 12:00:00\',\'6:30:00\') |\n+--------------------------------------------+\n| 2003-12-31 18:30:00 |\n+--------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/timestamp-function/','','https://mariadb.com/kb/en/library/timestamp-function/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (510,31,'TIMESTAMPADD','Syntax\n------ \nTIMESTAMPADD(unit,interval,datetime_expr)\n \nDescription\n----------- \nAdds the integer expression interval to the date or datetime\nexpression datetime_expr. The unit for interval is given by\nthe unit\nargument, which should be one of the following values:\nMICROSECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH,\nQUARTER, or YEAR.\n \nThe unit value may be specified using one of keywords as\nshown, or\nwith a prefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY\nboth are\nlegal.\n \nBefore MariaDB 5.5, FRAC_SECOND was permitted as a synonym\nfor MICROSECOND.\n \nExamples\n-------- \nSELECT TIMESTAMPADD(MINUTE,1,\'2003-01-02\');\n+-------------------------------------+\n| TIMESTAMPADD(MINUTE,1,\'2003-01-02\') |\n+-------------------------------------+\n| 2003-01-02 00:01:00 |\n+-------------------------------------+\n \nSELECT TIMESTAMPADD(WEEK,1,\'2003-01-02\');\n+-----------------------------------+\n| TIMESTAMPADD(WEEK,1,\'2003-01-02\') |\n+-----------------------------------+\n| 2003-01-09 |\n+-----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/timestampadd/','','https://mariadb.com/kb/en/library/timestampadd/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (511,31,'TIMESTAMPDIFF','Syntax\n------ \nTIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2)\n \nDescription\n----------- \nReturns datetime_expr2 - datetime_expr1, where\ndatetime_expr1 and\ndatetime_expr2 are date or datetime expressions. One\nexpression may be\na date and the other a datetime; a date value is treated as\na datetime\nhaving the time part \'00:00:00\' where necessary. The unit\nfor the\nresult (an integer) is given by the unit argument. The legal\nvalues\nfor unit are the same as those listed in the description of\nthe\nTIMESTAMPADD() function, i.e MICROSECOND, SECOND, MINUTE,\nHOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.\n \nTIMESTAMPDIFF can also be used to calculate age.\n \nExamples\n-------- \nSELECT TIMESTAMPDIFF(MONTH,\'2003-02-01\',\'2003-05-01\');\n+------------------------------------------------+\n| TIMESTAMPDIFF(MONTH,\'2003-02-01\',\'2003-05-01\') |\n+------------------------------------------------+\n| 3 |\n+------------------------------------------------+\n \nSELECT TIMESTAMPDIFF(YEAR,\'2002-05-01\',\'2001-01-01\');\n+-----------------------------------------------+\n| TIMESTAMPDIFF(YEAR,\'2002-05-01\',\'2001-01-01\') |\n+-----------------------------------------------+\n| -1 |\n+-----------------------------------------------+\n \nSELECT TIMESTAMPDIFF(MINUTE,\'2003-02-01\',\'2003-05-01\n12:05:55\');\n+----------------------------------------------------------+\n| TIMESTAMPDIFF(MINUTE,\'2003-02-01\',\'2003-05-01\n12:05:55\') |\n+----------------------------------------------------------+\n| 128885 |\n+----------------------------------------------------------+\n \nCalculating age:\n \nSELECT CURDATE();\n+------------+\n| CURDATE() |\n+------------+\n| 2019-05-27 |\n+------------+\n \nSELECT TIMESTAMPDIFF(YEAR, \'1971-06-06\', CURDATE()) AS\nage;\n \n+------+\n| age |\n+------+\n| 47 |\n+------+\n \nSELECT TIMESTAMPDIFF(YEAR, \'1971-05-06\', CURDATE()) AS\nage;\n \n+------+\n| age |\n+------+\n| 48 |\n+------+\n \nAge as of 2014-08-02:\n \nSELECT name, date_of_birth,\nTIMESTAMPDIFF(YEAR,date_of_birth,\'2014-08-02\') AS age \n FROM student_details;\n \n+---------+---------------+------+\n| name | date_of_birth | age |\n+---------+---------------+------+\n| Chun | 1993-12-31 | 20 |\n| Esben | 1946-01-01 | 68 |\n| Kaolin | 1996-07-16 | 18 |\n| Tatiana | 1988-04-13 | 26 |\n+---------+---------------+------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/timestampdiff/','','https://mariadb.com/kb/en/library/timestampdiff/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (512,31,'TIME_FORMAT','Syntax\n------ \nTIME_FORMAT(time,format)\n \nDescription\n----------- \nThis is used like the DATE_FORMAT() function, but the format\nstring\nmay contain format specifiers only for hours, minutes, and\nseconds.\nOther specifiers produce a NULL value or 0.\n \nExamples\n-------- \nSELECT TIME_FORMAT(\'100:00:00\', \'%H %k %h %I %l\');\n+--------------------------------------------+\n| TIME_FORMAT(\'100:00:00\', \'%H %k %h %I %l\') |\n+--------------------------------------------+\n| 100 100 04 04 4 |\n+--------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/time_format/','','https://mariadb.com/kb/en/library/time_format/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (513,31,'TIME_TO_SEC','Syntax\n------ \nTIME_TO_SEC(time)\n \nDescription\n----------- \nReturns the time argument, converted to seconds.\n \nThe value returned by TIME_TO_SEC is of type DOUBLE. Before\nMariaDB 5.3 (and MySQL 5.6), the type was INT. See\nMicroseconds in MariaDB.\n \nExamples\n-------- \nSELECT TIME_TO_SEC(\'22:23:00\');\n+-------------------------+\n| TIME_TO_SEC(\'22:23:00\') |\n+-------------------------+\n| 80580 |\n+-------------------------+\n \nSELECT TIME_TO_SEC(\'00:39:38\');\n+-------------------------+\n| TIME_TO_SEC(\'00:39:38\') |\n+-------------------------+\n| 2378 |\n+-------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/time_to_sec/','','https://mariadb.com/kb/en/library/time_to_sec/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (514,31,'TO_DAYS','Syntax\n------ \nTO_DAYS(date)\n \nDescription\n----------- \nGiven a date date, returns the number of days since the\nstart of the current calendar (0000-00-00).\n \nThe function is not designed for use with dates before the\nadvent of the Gregorian calendar in October 1582. Results\nwill not be reliable since it doesn\'t account for the lost\ndays when the calendar changed from the Julian calendar.\n \nThis is the converse of the FROM_DAYS() function.\n \nExamples\n-------- \nSELECT TO_DAYS(\'2007-10-07\');\n+-----------------------+\n| TO_DAYS(\'2007-10-07\') |\n+-----------------------+\n| 733321 |\n+-----------------------+\n \nSELECT TO_DAYS(\'0000-01-01\');\n+-----------------------+\n| TO_DAYS(\'0000-01-01\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nSELECT TO_DAYS(950501);\n+-----------------+\n| TO_DAYS(950501) |\n+-----------------+\n| 728779 |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/to_days/','','https://mariadb.com/kb/en/library/to_days/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (515,31,'TO_SECONDS','Syntax\n------ \nTO_SECONDS(expr)\n \nDescription\n----------- \nReturns the number of seconds from year 0 till expr, or NULL\nif expr is not a valid date or datetime.\n \nExamples\n-------- \nSELECT TO_SECONDS(\'2013-06-13\');\n+--------------------------+\n| TO_SECONDS(\'2013-06-13\') |\n+--------------------------+\n| 63538300800 |\n+--------------------------+\n \nSELECT TO_SECONDS(\'2013-06-13 21:45:13\');\n+-----------------------------------+\n| TO_SECONDS(\'2013-06-13 21:45:13\') |\n+-----------------------------------+\n| 63538379113 |\n+-----------------------------------+\n \nSELECT TO_SECONDS(NOW());\n+-------------------+\n| TO_SECONDS(NOW()) |\n+-------------------+\n| 63543530875 |\n+-------------------+\n \nSELECT TO_SECONDS(20130513);\n+----------------------+\n| TO_SECONDS(20130513) |\n+----------------------+\n| 63535622400 |\n+----------------------+\n1 row in set (0.00 sec)\n \nSELECT TO_SECONDS(130513);\n+--------------------+\n| TO_SECONDS(130513) |\n+--------------------+\n| 63535622400 |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/to_seconds/','','https://mariadb.com/kb/en/library/to_seconds/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (516,31,'UNIX_TIMESTAMP','Syntax\n------ \nUNIX_TIMESTAMP()\nUNIX_TIMESTAMP(date)\n \nDescription\n----------- \nIf called with no argument, returns a Unix timestamp\n(seconds since\n\'1970-01-01 00:00:00\' UTC) as an unsigned integer. If\nUNIX_TIMESTAMP()\nis called with a date argument, it returns the value of the\nargument as seconds\nsince \'1970-01-01 00:00:00\' UTC. date may be a DATE\nstring, a\nDATETIME string, a TIMESTAMP, or a number in\nthe format YYMMDD or YYYYMMDD. The server interprets date as\na value in the\ncurrent time zone and converts it to an internal value in\nUTC. Clients can set\ntheir time zone as described in time zones.\n \nThe inverse function of UNIX_TIMESTAMP() is FROM_UNIXTIME()\n \nUNIX_TIMESTAMP() supports microseconds.\n \nTimestamps in MariaDB have a maximum value of 2147483647,\nequivalent to 2038-01-19 05:14:07. This is due to the\nunderlying 32-bit limitation. Using the function on a date\nbeyond this will result in NULL being returned. Use DATETIME\nas a storage type if you require dates beyond this.\n \nError Handling\n \nReturns NULL for wrong arguments to UNIX_TIMESTAMP(). In\nMySQL and MariaDB before 5.3 wrong arguments to\nUNIX_TIMESTAMP() returned 0. \n \nCompatibility\n \nAs you can see in the examples above,\nUNIX_TIMESTAMP(constant-date-string) returns a timestamp\nwith 6 decimals while MariaDB 5.2 and before returns it\nwithout decimals. This can cause a problem if you are using\nUNIX_TIMESTAMP() as a partitioning function. You can fix\nthis by using FLOOR(UNIX_TIMESTAMP(..)) or changing the date\nstring to a date number, like 20080101000000. \n \nExamples\n-------- \nSELECT UNIX_TIMESTAMP();\n+------------------+\n| UNIX_TIMESTAMP() |\n+------------------+\n| 1269711082 |\n+------------------+\n \nSELECT UNIX_TIMESTAMP(\'2007-11-30 10:30:19\');\n+---------------------------------------+\n| UNIX_TIMESTAMP(\'2007-11-30 10:30:19\') |\n+---------------------------------------+\n| 1196436619.000000 |\n+---------------------------------------+\n \nSELECT UNIX_TIMESTAMP(\"2007-11-30 10:30:19.123456\");\n+----------------------------------------------+\n| unix_timestamp(\"2007-11-30 10:30:19.123456\") |\n+----------------------------------------------+\n| 1196411419.123456 |\n+----------------------------------------------+\n \nSELECT FROM_UNIXTIME(UNIX_TIMESTAMP(\'2007-11-30\n10:30:19\'));\n+------------------------------------------------------+\n| FROM_UNIXTIME(UNIX_TIMESTAMP(\'2007-11-30 10:30:19\')) |\n+------------------------------------------------------+\n| 2007-11-30 10:30:19.000000 |\n+------------------------------------------------------+\n \nSELECT FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(\'2007-11-30\n10:30:19\')));\n+-------------------------------------------------------------+\n| FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(\'2007-11-30\n10:30:19\'))) |\n+-------------------------------------------------------------+\n| 2007-11-30 10:30:19 |\n+-------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/unix_timestamp/','','https://mariadb.com/kb/en/library/unix_timestamp/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (517,31,'UTC_DATE','Syntax\n------ \nUTC_DATE, UTC_DATE()\n \nDescription\n----------- \nReturns the current UTC date as a value in \'YYYY-MM-DD\' or\nYYYYMMDD\nformat, depending on whether the function is used in a\nstring or numeric context. \n \nExamples\n-------- \nSELECT UTC_DATE(), UTC_DATE() + 0;\n \n+------------+----------------+\n| UTC_DATE() | UTC_DATE() + 0 |\n+------------+----------------+\n| 2010-03-27 | 20100327 |\n+------------+----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/utc_date/','','https://mariadb.com/kb/en/library/utc_date/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (518,31,'UTC_TIME','Syntax\n------ \nUTC_TIME\nUTC_TIME([precision])\n \nDescription\n----------- \nReturns the current UTC time as a value in \'HH:MM:SS\' or\nHHMMSS.uuuuuu format, depending on whether the function is\nused in a string or numeric context. \n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nExamples\n-------- \nSELECT UTC_TIME(), UTC_TIME() + 0;\n \n+------------+----------------+\n| UTC_TIME() | UTC_TIME() + 0 |\n+------------+----------------+\n| 17:32:34 | 173234.000000 |\n+------------+----------------+\n \nWith precision:\n \nSELECT UTC_TIME(5);\n+----------------+\n| UTC_TIME(5) |\n+----------------+\n| 07:52:50.78369 |\n+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/utc_time/','','https://mariadb.com/kb/en/library/utc_time/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (519,31,'UTC_TIMESTAMP','Syntax\n------ \nUTC_TIMESTAMP\nUTC_TIMESTAMP([precision])\n \nDescription\n----------- \nReturns the current UTC date and time as a value in\n\'YYYY-MM-DD\nHH:MM:SS\' or YYYYMMDDHHMMSS.uuuuuu format, depending on\nwhether the\nfunction is used in a string or numeric context.\n \nThe optional precision determines the microsecond precision.\nSee Microseconds in MariaDB.\n \nExamples\n-------- \nSELECT UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0;\n \n+---------------------+-----------------------+\n| UTC_TIMESTAMP() | UTC_TIMESTAMP() + 0 |\n+---------------------+-----------------------+\n| 2010-03-27 17:33:16 | 20100327173316.000000 |\n+---------------------+-----------------------+\n \nWith precision:\n \nSELECT UTC_TIMESTAMP(4);\n+--------------------------+\n| UTC_TIMESTAMP(4) |\n+--------------------------+\n| 2018-07-10 07:51:09.1019 |\n+--------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/utc_timestamp/','','https://mariadb.com/kb/en/library/utc_timestamp/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (520,31,'WEEK','Syntax\n------ \nWEEK(date[,mode])\n \nDescription\n----------- \nThis function returns the week number for date. The\ntwo-argument form of\nWEEK() allows you to specify whether the week starts on\nSunday or Monday\nand whether the return value should be in the range from 0\nto 53 or from 1 to\n53. If the mode argument is omitted, the value of the\ndefault_week_format system variable is used.\n \nModes\n \nMode | 1st day of week | Range | Week 1 is the 1st week with\n| \n \n0 | Sunday | 0-53 | a Sunday in this year | \n \n1 | Monday | 0-53 | more than 3 days this year | \n \n2 | Sunday | 1-53 | a Sunday in this year | \n \n3 | Monday | 1-53 | more than 3 days this year | \n \n4 | Sunday | 0-53 | more than 3 days this year | \n \n5 | Monday | 0-53 | a Monday in this year | \n \n6 | Sunday | 1-53 | more than 3 days this year | \n \n7 | Monday | 1-53 | a Monday in this year | \n \nExamples\n-------- \nSELECT WEEK(\'2008-02-20\');\n+--------------------+\n| WEEK(\'2008-02-20\') |\n+--------------------+\n| 7 |\n+--------------------+\n \nSELECT WEEK(\'2008-02-20\',0);\n+----------------------+\n| WEEK(\'2008-02-20\',0) |\n+----------------------+\n| 7 |\n+----------------------+\n \nSELECT WEEK(\'2008-02-20\',1);\n+----------------------+\n| WEEK(\'2008-02-20\',1) |\n+----------------------+\n| 8 |\n+----------------------+\n \nSELECT WEEK(\'2008-12-31\',0);\n+----------------------+\n| WEEK(\'2008-12-31\',0) |\n+----------------------+\n| 52 |\n+----------------------+\n \nSELECT WEEK(\'2008-12-31\',1);\n+----------------------+\n| WEEK(\'2008-12-31\',1) |\n+----------------------+\n| 53 |\n+----------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d, WEEK(d,0), WEEK(d,1) from t1;\n \n+---------------------+-----------+-----------+\n| d | WEEK(d,0) | WEEK(d,1) |\n+---------------------+-----------+-----------+\n| 2007-01-30 21:31:07 | 4 | 5 |\n| 1983-10-15 06:42:51 | 41 | 41 |\n| 2011-04-21 12:34:56 | 16 | 16 |\n| 2011-10-30 06:31:41 | 44 | 43 |\n| 2011-01-30 14:03:25 | 5 | 4 |\n| 2004-10-07 11:19:34 | 40 | 41 |\n+---------------------+-----------+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/week/','','https://mariadb.com/kb/en/library/week/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (521,31,'WEEKDAY','Syntax\n------ \nWEEKDAY(date)\n \nDescription\n----------- \nReturns the weekday index for date \n(0 = Monday, 1 = Tuesday, ... 6 = Sunday).\n \nThis contrasts with DAYOFWEEK() which follows the ODBC\nstandard\n(1 = Sunday, 2 = Monday, ..., 7 = Saturday).\n \nExamples\n-------- \nSELECT WEEKDAY(\'2008-02-03 22:23:00\');\n+--------------------------------+\n| WEEKDAY(\'2008-02-03 22:23:00\') |\n+--------------------------------+\n| 6 |\n+--------------------------------+\n \nSELECT WEEKDAY(\'2007-11-06\');\n+-----------------------+\n| WEEKDAY(\'2007-11-06\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT d FROM t1 where WEEKDAY(d) = 6;\n \n+---------------------+\n| d |\n+---------------------+\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/weekday/','','https://mariadb.com/kb/en/library/weekday/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (522,31,'WEEKOFYEAR','Syntax\n------ \nWEEKOFYEAR(date)\n \nDescription\n----------- \nReturns the calendar week of the date as a number in the\nrange from 1\nto 53. WEEKOFYEAR() is a compatibility function that is\nequivalent to\nWEEK(date,3).\n \nExamples\n-------- \nSELECT WEEKOFYEAR(\'2008-02-20\');\n+--------------------------+\n| WEEKOFYEAR(\'2008-02-20\') |\n+--------------------------+\n| 8 |\n+--------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \n select * from t1;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 1983-10-15 06:42:51 |\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n| 2004-10-07 11:19:34 |\n+---------------------+\n \nSELECT d, WEEKOFYEAR(d), WEEK(d,3) from t1;\n \n+---------------------+---------------+-----------+\n| d | WEEKOFYEAR(d) | WEEK(d,3) |\n+---------------------+---------------+-----------+\n| 2007-01-30 21:31:07 | 5 | 5 |\n| 1983-10-15 06:42:51 | 41 | 41 |\n| 2011-04-21 12:34:56 | 16 | 16 |\n| 2011-10-30 06:31:41 | 43 | 43 |\n| 2011-01-30 14:03:25 | 4 | 4 |\n| 2004-10-07 11:19:34 | 41 | 41 |\n+---------------------+---------------+-----------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/weekofyear/','','https://mariadb.com/kb/en/library/weekofyear/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (523,31,'YEAR','Syntax\n------ \nYEAR(date)\n \nDescription\n----------- \nReturns the year for the given date, in the range 1000 to\n9999, or 0 for the\n\"zero\" date.\n \nExamples\n-------- \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT * FROM t1;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 1983-10-15 06:42:51 |\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n| 2004-10-07 11:19:34 |\n+---------------------+\n \nSELECT * FROM t1 WHERE YEAR(d) = 2011;\n \n+---------------------+\n| d |\n+---------------------+\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n+---------------------+\n \nSELECT YEAR(\'1987-01-01\');\n+--------------------+\n| YEAR(\'1987-01-01\') |\n+--------------------+\n| 1987 |\n+--------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/year/','','https://mariadb.com/kb/en/library/year/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (524,31,'YEARWEEK','Syntax\n------ \nYEARWEEK(date), YEARWEEK(date,mode)\n \nDescription\n----------- \nReturns year and week for a date. The mode argument works\nexactly like the mode\nargument to WEEK(). The year in the result may be different\nfrom the\nyear in the date argument for the first and the last week of\nthe year.\n \nExamples\n-------- \nSELECT YEARWEEK(\'1987-01-01\');\n+------------------------+\n| YEARWEEK(\'1987-01-01\') |\n+------------------------+\n| 198652 |\n+------------------------+\n \nCREATE TABLE t1 (d DATETIME);\nINSERT INTO t1 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\n \nSELECT * FROM t1;\n \n+---------------------+\n| d |\n+---------------------+\n| 2007-01-30 21:31:07 |\n| 1983-10-15 06:42:51 |\n| 2011-04-21 12:34:56 |\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\n| 2004-10-07 11:19:34 |\n+---------------------+\n6 rows in set (0.02 sec)\n \nSELECT YEARWEEK(d) FROM t1 WHERE YEAR(d) = 2011;\n \n+-------------+\n| YEARWEEK(d) |\n+-------------+\n| 201116 |\n| 201144 |\n| 201105 |\n+-------------+\n3 rows in set (0.03 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/yearweek/','','https://mariadb.com/kb/en/library/yearweek/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (525,32,'Well-Known Binary (WKB) Format','WKB stands for Well-Known Binary, a format for representing\ngeographical and geometrical data.\n \nWKB uses 1-byte unsigned integers, 4-byte unsigned integers,\nand 8-byte double-precision numbers.\nThe first byte indicates the byte order. 00 for big endian,\nor 01 for little endian.\nThe next 4 bytes indicate the geometry type. Values from 1\nto 7 indicate whether the type is Point, LineString,\nPolygon, MultiPoint, MultiLineString, MultiPolygon, or\nGeometryCollection respectively. \nThe 8-byte floats represent the co-ordinates.\n \nTake the following example, a sequence of 21 bytes each\nrepresented by two hex digits:\n \n000000000140000000000000004010000000000000\nIt\'s big endian\n000000000140000000000000004010000000000000\n \nIt\'s a POINT\n000000000140000000000000004010000000000000\n \nThe X co-ordinate is 2.0\n000000000140000000000000004010000000000000\n \nThe Y-co-ordinate is 4.0\n000000000140000000000000004010000000000000\n \n\n \n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/well-known-binary-wkb-format/','','https://mariadb.com/kb/en/library/well-known-binary-wkb-format/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (526,32,'AsBinary','A synonym for ST_AsBinary().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkb-asbinary/','','https://mariadb.com/kb/en/library/wkb-asbinary/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (527,32,'AsWKB','A synonym for ST_AsBinary().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/aswkb/','','https://mariadb.com/kb/en/library/aswkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (528,32,'MLineFromWKB','Syntax\n------ \nMLineFromWKB(wkb[,srid])\nMultiLineStringFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a MULTILINESTRING value using its WKB\nrepresentation and SRID.\n \nMLineFromWKB() and MultiLineStringFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(MLineFromText(\'MULTILINESTRING((10\n48,10 21,10 0),(16 0,16 23,16 48))\'));\n \nSELECT ST_AsText(MLineFromWKB(@g));\n+--------------------------------------------------------+\n| ST_AsText(MLineFromWKB(@g)) |\n+--------------------------------------------------------+\n| MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) |\n+--------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mlinefromwkb/','','https://mariadb.com/kb/en/library/mlinefromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (529,32,'MPointFromWKB','Syntax\n------ \nMPointFromWKB(wkb[,srid])\nMultiPointFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a MULTIPOINT value using its WKB representation\nand SRID.\n \nMPointFromWKB() and MultiPointFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(MPointFromText(\'MultiPoint( 1 1, 2 2,\n5 3, 7 2, 9 3, 8 4, 6 6, 6 9, 4 9, 1 5 )\'));\n \nSELECT ST_AsText(MPointFromWKB(@g));\n+-----------------------------------------------------+\n| ST_AsText(MPointFromWKB(@g)) |\n+-----------------------------------------------------+\n| MULTIPOINT(1 1,2 2,5 3,7 2,9 3,8 4,6 6,6 9,4 9,1 5) |\n+-----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mpointfromwkb/','','https://mariadb.com/kb/en/library/mpointfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (530,32,'MPolyFromWKB','Syntax\n------ \nMPolyFromWKB(wkb[,srid])\nMultiPolygonFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a MULTIPOLYGON value using its WKB representation\nand SRID.\n \nMPolyFromWKB() and MultiPolygonFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(MPointFromText(\'MULTIPOLYGON(((28\n26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52\n18)),((59 18,67 18,67 13,59 13,59 18)))\'));\n \nSELECT ST_AsText(MPolyFromWKB(@g));\n+---------------------------------------------------------------------------------------------------------------+\n| ST_AsText(MPolyFromWKB(@g)) |\n+---------------------------------------------------------------------------------------------------------------+\n| MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66\n23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) |\n+---------------------------------------------------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mpolyfromwkb/','','https://mariadb.com/kb/en/library/mpolyfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (531,32,'GeomCollFromWKB','A synonym for ST_GeomCollFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkb-geomcollfromwkb/','','https://mariadb.com/kb/en/library/wkb-geomcollfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (532,32,'GeometryCollectionFromWKB','A synonym for ST_GeomCollFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometrycollectionfromwkb/','','https://mariadb.com/kb/en/library/geometrycollectionfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (533,32,'GeometryFromWKB','A synonym for ST_GeomFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/geometryfromwkb/','','https://mariadb.com/kb/en/library/geometryfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (534,32,'GeomFromWKB','A synonym for ST_GeomFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkb-geomfromwkb/','','https://mariadb.com/kb/en/library/wkb-geomfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (535,32,'LineFromWKB','A synonym for ST_LineFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkb-linefromwkb/','','https://mariadb.com/kb/en/library/wkb-linefromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (536,32,'LineStringFromWKB','A synonym for ST_LineFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/linestringfromwkb/','','https://mariadb.com/kb/en/library/linestringfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (537,32,'MultiLineStringFromWKB','A synonym for MLineFromWKB().\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/multilinestringfromwkb/','','https://mariadb.com/kb/en/library/multilinestringfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (538,32,'MultiPointFromWKB','A synonym for MPointFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/multipointfromwkb/','','https://mariadb.com/kb/en/library/multipointfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (539,32,'MultiPolygonFromWKB','Synonym for MPolyFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/multipolygonfromwkb/','','https://mariadb.com/kb/en/library/multipolygonfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (540,32,'PointFromWKB','A synonym for ST_PointFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkb-pointfromwkb/','','https://mariadb.com/kb/en/library/wkb-pointfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (541,32,'PolyFromWKB','A synonym for ST_PolyFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/wkb-polyfromwkb/','','https://mariadb.com/kb/en/library/wkb-polyfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (542,32,'PolygonFromWKB','A synonym for ST_PolyFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/polygonfromwkb/','','https://mariadb.com/kb/en/library/polygonfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (543,32,'ST_AsBinary','Syntax\n------ \nST_AsBinary(g)\nAsBinary(g)\nST_AsWKB(g)\nAsWKB(g)\n \nDescription\n----------- \nConverts a value in internal geometry format to its WKB\nrepresentation and returns the binary result.\n \nST_AsBinary(), AsBinary(), ST_AsWKB() and AsWKB() are\nsynonyms,\n \nExamples\n-------- \nSET @poly = ST_GeomFromText(\'POLYGON((0 0,0 1,1 1,1 0,0\n0))\');\nSELECT ST_AsBinary(@poly);\n \nSELECT ST_AsText(ST_GeomFromWKB(ST_AsWKB(@poly)));\n+--------------------------------------------+\n| ST_AsText(ST_GeomFromWKB(ST_AsWKB(@poly))) |\n+--------------------------------------------+\n| POLYGON((0 0,0 1,1 1,1 0,0 0)) |\n+--------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_asbinary/','','https://mariadb.com/kb/en/library/st_asbinary/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (544,32,'ST_AsWKB','A synonym for ST_AsBinary().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_aswkb/','','https://mariadb.com/kb/en/library/st_aswkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (545,32,'ST_GeomCollFromWKB','Syntax\n------ \nST_GeomCollFromWKB(wkb[,srid])\nST_GeometryCollectionFromWKB(wkb[,srid])\nGeomCollFromWKB(wkb[,srid])\nGeometryCollectionFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a GEOMETRYCOLLECTION value using its WKB\nrepresentation and SRID.\n \nST_GeomCollFromWKB(), ST_GeometryCollectionFromWKB(),\nGeomCollFromWKB() and GeometryCollectionFromWKB() are\nsynonyms.\n \nExamples\n-------- \nSET @g =\nST_AsBinary(ST_GeomFromText(\'GEOMETRYCOLLECTION(POLYGON((5\n5,10 5,10 10,5 5)),POINT(10 10))\'));\n \nSELECT ST_AsText(ST_GeomCollFromWKB(@g));\n+----------------------------------------------------------------+\n| ST_AsText(ST_GeomCollFromWKB(@g)) |\n+----------------------------------------------------------------+\n| GEOMETRYCOLLECTION(POLYGON((5 5,10 5,10 10,5 5)),POINT(10\n10)) |\n+----------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_geomcollfromwkb/','','https://mariadb.com/kb/en/library/st_geomcollfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (546,32,'ST_GeometryCollectionFromWKB','A synonym for ST_GeomCollFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/st_geometrycollectionfromwkb/','','https://mariadb.com/kb/en/library/st_geometrycollectionfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (547,32,'ST_GeometryFromWKB','A synonym for ST_GeomFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_geometryfromwkb/','','https://mariadb.com/kb/en/library/st_geometryfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (548,32,'ST_GeomFromWKB','Syntax\n------ \nST_GeomFromWKB(wkb[,srid])\nST_GeometryFromWKB(wkb[,srid])\nGeomFromWKB(wkb[,srid])\nGeometryFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a geometry value of any type using its WKB\nrepresentation and SRID.\n \nST_GeomFromWKB(), ST_GeometryFromWKB(), GeomFromWKB() and\nGeometryFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(ST_LineFromText(\'LINESTRING(0 4, 4\n6)\'));\n \nSELECT ST_AsText(ST_GeomFromWKB(@g));\n+-------------------------------+\n| ST_AsText(ST_GeomFromWKB(@g)) |\n+-------------------------------+\n| LINESTRING(0 4,4 6) |\n+-------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_geomfromwkb/','','https://mariadb.com/kb/en/library/st_geomfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (549,32,'ST_LineFromWKB','Syntax\n------ \nST_LineFromWKB(wkb[,srid])\nLineFromWKB(wkb[,srid])\nST_LineStringFromWKB(wkb[,srid])\nLineStringFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a LINESTRING value using its WKB representation\nand SRID.\n \nST_LineFromWKB(), LineFromWKB(), ST_LineStringFromWKB(), and\nLineStringFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(ST_LineFromText(\'LineString(0 4,4\n6)\'));\n \nSELECT ST_AsText(ST_LineFromWKB(@g)) AS l;\n \n+---------------------+\n| l |\n+---------------------+\n| LINESTRING(0 4,4 6) |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_linefromwkb/','','https://mariadb.com/kb/en/library/st_linefromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (550,32,'ST_LineStringFromWKB','A synonym for ST_LineFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_linestringfromwkb/','','https://mariadb.com/kb/en/library/st_linestringfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (551,32,'ST_PointFromWKB','Syntax\n------ \nST_PointFromWKB(wkb[,srid])\nPointFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a POINT value using its WKB representation and\nSRID.\n \nST_PointFromWKB() and PointFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(ST_PointFromText(\'POINT(0 4)\'));\n \nSELECT ST_AsText(ST_PointFromWKB(@g)) AS p;\n \n+------------+\n| p |\n+------------+\n| POINT(0 4) |\n+------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_pointfromwkb/','','https://mariadb.com/kb/en/library/st_pointfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (552,32,'ST_PolyFromWKB','Syntax\n------ \nST_PolyFromWKB(wkb[,srid])\nST_PolygonFromWKB(wkb[,srid])\nPolyFromWKB(wkb[,srid])\nPolygonFromWKB(wkb[,srid])\n \nDescription\n----------- \nConstructs a POLYGON value using its WKB representation and\nSRID.\n \nST_PolyFromWKB(), ST_PolygonFromWKB(), PolyFromWKB() and\nPolygonFromWKB() are synonyms.\n \nExamples\n-------- \nSET @g = ST_AsBinary(ST_PolyFromText(\'POLYGON((1 1,1 5,4\n9,6 9,9 3,7 2,1 1))\'));\n \nSELECT ST_AsText(ST_PolyFromWKB(@g)) AS p;\n \n+----------------------------------------+\n| p |\n+----------------------------------------+\n| POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1)) |\n+----------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_polyfromwkb/','','https://mariadb.com/kb/en/library/st_polyfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (553,32,'ST_PolygonFromWKB','A synonym for ST_PolyFromWKB.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_polygonfromwkb/','','https://mariadb.com/kb/en/library/st_polygonfromwkb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (554,36,'BOUNDARY','A synonym for ST_BOUNDARY.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometry-properties-boundary/','','https://mariadb.com/kb/en/library/geometry-properties-boundary/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (555,36,'DIMENSION','A synonym for ST_DIMENSION.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/dimension/','','https://mariadb.com/kb/en/library/dimension/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (556,36,'ENVELOPE','A synonym for ST_ENVELOPE.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometry-properties-envelope/','','https://mariadb.com/kb/en/library/geometry-properties-envelope/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (557,36,'GeometryN','A synonym for ST_GeometryN.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometry-properties-geometryn/','','https://mariadb.com/kb/en/library/geometry-properties-geometryn/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (558,36,'GeometryType','A synonym for ST_GeometryType.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometry-properties-geometrytype/','','https://mariadb.com/kb/en/library/geometry-properties-geometrytype/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (559,36,'IsClosed','A synonym for ST_IsClosed.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/isclosed/','','https://mariadb.com/kb/en/library/isclosed/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (560,36,'IsEmpty','A synonym for ST_IsEmpty.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometry-properties-isempty/','','https://mariadb.com/kb/en/library/geometry-properties-isempty/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (561,36,'IsRing','A synonym for ST_IsRing.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/isring/','','https://mariadb.com/kb/en/library/isring/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (562,36,'IsSimple','A synonym for ST_IsSImple.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometry-properties-issimple/','','https://mariadb.com/kb/en/library/geometry-properties-issimple/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (563,36,'NumGeometries','A synonym for ST_NumGeometries.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometry-properties-numgeometries/','','https://mariadb.com/kb/en/library/geometry-properties-numgeometries/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (564,36,'SRID','A synonym for ST_SRID.\n \n\n \n \n \n \n \n \n \n\nURL:\nhttps://mariadb.com/kb/en/library/geometry-properties-srid/','','https://mariadb.com/kb/en/library/geometry-properties-srid/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (565,36,'ST_BOUNDARY','The ST_BOUNDARY function was introduced in MariaDB 10.1.2\n \nSyntax\n------ \nST_BOUNDARY(g)\nBOUNDARY(g)\n \nDescription\n----------- \nReturns a geometry that is the closure of the combinatorial\nboundary of the geometry value g.\n \nBOUNDARY() is a synonym.\n \nExamples\n-------- \nSELECT ST_AsText(ST_Boundary(ST_GeomFromText(\'LINESTRING(3\n3,0 0, -3 3)\')));\n+----------------------------------------------------------------------+\n| ST_AsText(ST_Boundary(ST_GeomFromText(\'LINESTRING(3 3,0\n0, -3 3)\'))) |\n+----------------------------------------------------------------------+\n| MULTIPOINT(3 3,-3 3) |\n+----------------------------------------------------------------------+\n \nSELECT ST_AsText(ST_Boundary(ST_GeomFromText(\'POLYGON((3\n3,0 0, -3 3, 3 3))\')));\n+--------------------------------------------------------------------------+\n| ST_AsText(ST_Boundary(ST_GeomFromText(\'POLYGON((3 3,0 0,\n-3 3, 3 3))\'))) |\n+--------------------------------------------------------------------------+\n| LINESTRING(3 3,0 0,-3 3,3 3) |\n+--------------------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_boundary/','','https://mariadb.com/kb/en/library/st_boundary/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (566,36,'ST_DIMENSION','Syntax\n------ \nST_Dimension(g)\nDimension(g)\n \nDescription\n----------- \nReturns the inherent dimension of the geometry value g. The\nresult can\nbe\n \nDimension | Definition | \n \n -1 | empty geometry | \n \n 0 | geometry with no length or area | \n \n 1 | geometry with no area but nonzero length | \n \n 2 | geometry with nonzero area | \n \nST_Dimension() and Dimension() are synonyms.\n \nExamples\n-------- \nSELECT Dimension(GeomFromText(\'LineString(1 1,2 2)\'));\n+------------------------------------------------+\n| Dimension(GeomFromText(\'LineString(1 1,2 2)\')) |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_dimension/','','https://mariadb.com/kb/en/library/st_dimension/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (567,36,'ST_ENVELOPE','Syntax\n------ \nST_ENVELOPE(g)\nENVELOPE(g)\n \nDescription\n----------- \nReturns the Minimum Bounding Rectangle (MBR) for the\ngeometry value g. The result is returned as a Polygon value.\n \nThe polygon is defined by the corner points of the bounding\nbox:\n \nPOLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX\nMINY))\n \nST_ENVELOPE() and ENVELOPE() are synonyms.\n \nExamples\n-------- \nSELECT AsText(ST_ENVELOPE(GeomFromText(\'LineString(1 1,4\n4)\')));\n+----------------------------------------------------------+\n| AsText(ST_ENVELOPE(GeomFromText(\'LineString(1 1,4 4)\')))\n|\n+----------------------------------------------------------+\n| POLYGON((1 1,4 1,4 4,1 4,1 1)) |\n+----------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_envelope/','','https://mariadb.com/kb/en/library/st_envelope/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (568,36,'ST_GEOMETRYN','Syntax\n------ \nST_GeometryN(gc,N)\nGeometryN(gc,N)\n \nDescription\n----------- \nReturns the N-th geometry in the GeometryCollection gc.\nGeometries are numbered beginning with 1.\n \nST_GeometryN() and GeometryN() are synonyms.\n \nExample\n \nSET @gc = \'GeometryCollection(Point(1 1),LineString(12 14,\n9 11))\';\n \nSELECT AsText(GeometryN(GeomFromText(@gc),1));\n+----------------------------------------+\n| AsText(GeometryN(GeomFromText(@gc),1)) |\n+----------------------------------------+\n| POINT(1 1) |\n+----------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_geometryn/','','https://mariadb.com/kb/en/library/st_geometryn/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (569,36,'ST_GEOMETRYTYPE','Syntax\n------ \nST_GeometryType(g)\nGeometryType(g)\n \nDescription\n----------- \nReturns as a string the name of the geometry type of which\nthe\ngeometry instance g is a member. The name corresponds to one\nof the\ninstantiable Geometry subclasses.\n \nST_GeometryType() and GeometryType() are synonyms.\n \nExamples\n-------- \nSELECT GeometryType(GeomFromText(\'POINT(1 1)\'));\n+------------------------------------------+\n| GeometryType(GeomFromText(\'POINT(1 1)\')) |\n+------------------------------------------+\n| POINT |\n+------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_geometrytype/','','https://mariadb.com/kb/en/library/st_geometrytype/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (570,36,'ST_ISCLOSED','Syntax\n------ \nST_IsClosed(g)\nIsClosed(g)\n \nDescription\n----------- \nReturns 1 if a given LINESTRING\'s start and end points are\nthe same, or 0 if they are not the same. Before MariaDB\n10.1.5, returns NULL if not given a LINESTRING. After\nMariaDB 10.1.5, returns -1.\n \nST_IsClosed() and IsClosed() are synonyms.\n \nExamples\n-------- \nSET @ls = \'LineString(0 0, 0 4, 4 4, 0 0)\';\n \nSELECT ST_ISCLOSED(GEOMFROMTEXT(@ls));\n+--------------------------------+\n| ST_ISCLOSED(GEOMFROMTEXT(@ls)) |\n+--------------------------------+\n| 1 |\n+--------------------------------+\n \nSET @ls = \'LineString(0 0, 0 4, 4 4, 0 1)\';\n \nSELECT ST_ISCLOSED(GEOMFROMTEXT(@ls));\n+--------------------------------+\n| ST_ISCLOSED(GEOMFROMTEXT(@ls)) |\n+--------------------------------+\n| 0 |\n+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_isclosed/','','https://mariadb.com/kb/en/library/st_isclosed/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (571,36,'ST_ISEMPTY','Syntax\n------ \nST_IsEmpty(g)\nIsEmpty(g)\n \nDescription\n----------- \nIsEmpty is a function defined by the OpenGIS specification,\nbut is not fully implemented by MariaDB or MySQL. \n \nSince MariaDB and MySQL do not support GIS EMPTY values such\nas POINT EMPTY, as implemented it simply returns 1 if the\ngeometry value g is invalid, 0 if it is valid, and NULL if\nthe argument is NULL.\n \nST_IsEmpty() and IsEmpty() are synonyms.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_isempty/','','https://mariadb.com/kb/en/library/st_isempty/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (572,36,'ST_IsRing','The ST_IsRing function was introduced in MariaDB 10.1.2\n \nSyntax\n------ \nST_IsRing(g)\nIsRing(g)\n \nDescription\n----------- \nReturns true if a given LINESTRING is a ring, that is, both\nST_IsClosed and ST_IsSimple. A simple curve does not pass\nthrough the same point more than once. However, see\nMDEV-7510.\n \nSt_IsRing() and IsRing() are synonyms.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_isring/','','https://mariadb.com/kb/en/library/st_isring/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (573,36,'ST_IsSimple','Syntax\n------ \nST_IsSimple(g)\nIsSimple(g)\n \nDescription\n----------- \nReturns true if the given Geometry has no anomalous\ngeometric points, false if it does, or NULL if given a NULL\nvalue.\n \nST_IsSimple() and IsSimple() are synonyms.\n \nExamples\n-------- \nA POINT is always simple.\n \nSET @g = \'Point(1 2)\';\n \nSELECT ST_ISSIMPLE(GEOMFROMTEXT(@g));\n+-------------------------------+\n| ST_ISSIMPLE(GEOMFROMTEXT(@g)) |\n+-------------------------------+\n| 1 |\n+-------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_issimple/','','https://mariadb.com/kb/en/library/st_issimple/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (574,36,'ST_NUMGEOMETRIES','Syntax\n------ \nST_NumGeometries(gc)\nNumGeometries(gc)\n \nDescription\n----------- \nReturns the number of geometries in the GeometryCollection\ngc.\n \nST_NumGeometries() and NumGeometries() are synonyms.\n \nExample\n \nSET @gc = \'GeometryCollection(Point(1 1),LineString(2 2, 3\n3))\';\n \nSELECT NUMGEOMETRIES(GeomFromText(@gc));\n+----------------------------------+\n| NUMGEOMETRIES(GeomFromText(@gc)) |\n+----------------------------------+\n| 2 |\n+----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_numgeometries/','','https://mariadb.com/kb/en/library/st_numgeometries/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (575,36,'ST_RELATE','The ST_RELATE() function was introduced in MariaDB 10.1.2\n \nSyntax\n------ \nST_Relate(g1, g2, i)\n \nDescription\n----------- \nReturns true if Geometry g1 is spatially related to\nGeometryg2 by testing for intersections between the\ninterior, boundary and exterior of the two geometries as\nspecified by the values in intersection matrix pattern i.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_relate/','','https://mariadb.com/kb/en/library/st_relate/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (576,36,'ST_SRID','Syntax\n------ \nST_SRID(g)\nSRID(g)\n \nDescription\n----------- \nReturns an integer indicating the Spatial Reference System\nID for the\ngeometry value g.\n \nIn MariaDB, the SRID value is just an integer associated\nwith the\ngeometry value. All calculations are done assuming Euclidean\n(planar)\ngeometry.\n \nST_SRID() and SRID() are synonyms.\n \nExamples\n-------- \nSELECT SRID(GeomFromText(\'LineString(1 1,2 2)\',101));\n+-----------------------------------------------+\n| SRID(GeomFromText(\'LineString(1 1,2 2)\',101)) |\n+-----------------------------------------------+\n| 101 |\n+-----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/st_srid/','','https://mariadb.com/kb/en/library/st_srid/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (577,37,'ASCII','Syntax\n------ \nASCII(str)\n \nDescription\n----------- \nReturns the numeric ASCII value of the leftmost character of\nthe string argument. Returns 0 if the given string is empty\nand NULL if it is NULL.\n \nASCII() works for 8-bit characters.\n \nExamples\n-------- \nSELECT ASCII(9);\n+----------+\n| ASCII(9) |\n+----------+\n| 57 |\n+----------+\n \nSELECT ASCII(\'9\');\n+------------+\n| ASCII(\'9\') |\n+------------+\n| 57 |\n+------------+\n \nSELECT ASCII(\'abc\');\n+--------------+\n| ASCII(\'abc\') |\n+--------------+\n| 97 |\n+--------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/ascii/','','https://mariadb.com/kb/en/library/ascii/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (578,37,'BIN','Syntax\n------ \nBIN(N)\n \nDescription\n----------- \nReturns a string representation of the binary value of the\ngiven longlong (that is, BIGINT) number. This is equivalent\nto CONV(N,10,2). The argument should be positive. If it is a\nFLOAT, it will be truncated. Returns NULL if the argument is\nNULL.\n \nExamples\n-------- \nSELECT BIN(12);\n+---------+\n| BIN(12) |\n+---------+\n| 1100 |\n+---------+\n \n\n\nURL: https://mariadb.com/kb/en/library/bin/','','https://mariadb.com/kb/en/library/bin/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (579,37,'BINARY Operator','Syntax\n------ \nBINARY\n \nDescription\n----------- \nThe BINARY operator casts the string following it to a\nbinary string. This is an easy way to force a column\ncomparison to be done byte by byte rather than character by\ncharacter. This causes the comparison to be case sensitive\neven if the column isn\'t defined as BINARY or BLOB. \n \nBINARY also causes trailing spaces to be significant.\n \nExamples\n-------- \nSELECT \'a\' = \'A\';\n \n+-----------+\n| \'a\' = \'A\' |\n+-----------+\n| 1 |\n+-----------+\n \nSELECT BINARY \'a\' = \'A\';\n \n+------------------+\n| BINARY \'a\' = \'A\' |\n+------------------+\n| 0 |\n+------------------+\n \nSELECT \'a\' = \'a \';\n \n+------------+\n| \'a\' = \'a \' |\n+------------+\n| 1 |\n+------------+\n \nSELECT BINARY \'a\' = \'a \';\n \n+-------------------+\n| BINARY \'a\' = \'a \' |\n+-------------------+\n| 0 |\n+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/binary-operator/','','https://mariadb.com/kb/en/library/binary-operator/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (580,37,'BIT_LENGTH','Syntax\n------ \nBIT_LENGTH(str)\n \nDescription\n----------- \nReturns the length of the given string argument in bits. If\nthe argument is not a string, it will be converted to\nstring. If the argument is NULL, it returns NULL.\n \nExamples\n-------- \nSELECT BIT_LENGTH(\'text\');\n+--------------------+\n| BIT_LENGTH(\'text\') |\n+--------------------+\n| 32 |\n+--------------------+\n \nSELECT BIT_LENGTH(\'\');\n+----------------+\n| BIT_LENGTH(\'\') |\n+----------------+\n| 0 |\n+----------------+\n \nCompatibility\n \nPostgreSQL and Sybase support BIT_LENGTH().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/bit_length/','','https://mariadb.com/kb/en/library/bit_length/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (581,37,'CAST','Syntax\n------ \nCAST(expr AS type)\n \nDescription\n----------- \nThe CAST() function takes a value of one type and produces a\nvalue of another type, similar to the CONVERT() function.\nFor more information, see the description of CONVERT(). \n \nThe main difference between the CAST() and CONVERT() is that\nCONVERT(expr,type) is ODBC syntax while CAST(expr as type)\nand CONVERT(... USING ...) are SQL92 syntax.\n \nIn MariaDB 10.4 and later, you can use the CAST() function\nwith the INTERVAL keyword.\n \nUntil MariaDB 5.5.31, X\'HHHH\', the standard SQL syntax for\nbinary string literals, erroneously worked in the same way\nas 0xHHHH. In 5.5.31 it was intentionally changed to behave\nas a string in all contexts (and never as a number).\n \nThis introduces an incompatibility with previous versions of\nMariaDB, and all versions of MySQL (see the example below). \n \nExamples\n-------- \nSimple casts:\n \nSELECT CAST(\"abc\" AS BINARY);\nSELECT CAST(\"1\" AS UNSIGNED INTEGER);\nSELECT CAST(123 AS CHAR CHARACTER SET utf8)\n \nNote that when one casts to CHAR without specifying the\ncharacter set, the collation_connection character set\ncollation will be used. When used with CHAR CHARACTER SET,\nthe default collation for that character set will be used.\n \nSELECT COLLATION(CAST(123 AS CHAR));\n+------------------------------+\n| COLLATION(CAST(123 AS CHAR)) |\n+------------------------------+\n| latin1_swedish_ci |\n+------------------------------+\n \nSELECT COLLATION(CAST(123 AS CHAR CHARACTER SET utf8));\n+-------------------------------------------------+\n| COLLATION(CAST(123 AS CHAR CHARACTER SET utf8)) |\n+-------------------------------------------------+\n| utf8_general_ci |\n+-------------------------------------------------+\n \nIf you also want to change the collation, you have to use\nthe COLLATE operator:\n \nSELECT COLLATION(CAST(123 AS CHAR CHARACTER SET utf8) \n COLLATE utf8_unicode_ci);\n+-------------------------------------------------------------------------+\n| COLLATION(CAST(123 AS CHAR CHARACTER SET utf8) COLLATE\nutf8_unicode_ci) |\n+-------------------------------------------------------------------------+\n| utf8_unicode_ci |\n+-------------------------------------------------------------------------+\n \nUsing CAST() to order an ENUM field as a CHAR rather than\nthe internal numerical value:\n \nCREATE TABLE enum_list (enum_field enum(\'c\',\'a\',\'b\'));\n \nINSERT INTO enum_list (enum_field) \nVALUES(\'c\'),(\'a\'),(\'c\'),(\'b\');\n \nSELECT * FROM enum_list \nORDER BY enum_field;\n \n+------------+\n| enum_field |\n+------------+\n| c |\n| c |\n| a |\n| b |\n+------------+\n \nSELECT * FROM enum_list \nORDER BY CAST(enum_field AS CHAR);\n+------------+\n| enum_field |\n+------------+\n| a |\n| b |\n| c |\n| c |\n+------------+\n \nFrom MariaDB 5.5.31, the following will trigger warnings,\nsince x\'aa\' and \'X\'aa\' no longer behave as a number.\nPreviously, and in all versions of MySQL, no warnings are\ntriggered since they did erroneously behave as a number:\n \nSELECT CAST(0xAA AS UNSIGNED), CAST(x\'aa\' AS UNSIGNED),\nCAST(X\'aa\' AS UNSIGNED);\n+------------------------+-------------------------+-------------------------+\n| CAST(0xAA AS UNSIGNED) | CAST(x\'aa\' AS UNSIGNED) |\nCAST(X\'aa\' AS UNSIGNED) |\n+------------------------+-------------------------+-------------------------+\n| 170 | 0 | 0 |\n+------------------------+-------------------------+-------------------------+\n1 row in set, 2 warnings (0.00 sec)\n \nWarning (Code 1292): Truncated incorrect INTEGER value:\n\'\\xAA\'\nWarning (Code 1292): Truncated incorrect INTEGER value:\n\'\\xAA\'\n \nCasting to intervals:\n \nSELECT CAST(2019-01-04 INTERVAL AS DAY_SECOND(2)) AS\n\"Cast\";\n \n+-------------+\n| Cast |\n+-------------+\n| 00:20:17.00 |\n+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/cast/','','https://mariadb.com/kb/en/library/cast/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (582,37,'CHAR Function','Syntax\n------ \nCHAR(N,... [USING charset_name])\n \nDescription\n----------- \nCHAR() interprets each argument as an INT and returns a\nstring consisting of the characters given by the code values\nof those integers. NULL values are skipped. By default,\nCHAR() returns a binary string. To produce a string in a\ngiven character set, use the optional USING clause:\n \nSELECT CHARSET(CHAR(0x65)), CHARSET(CHAR(0x65 USING utf8));\n+---------------------+--------------------------------+\n| CHARSET(CHAR(0x65)) | CHARSET(CHAR(0x65 USING utf8)) |\n+---------------------+--------------------------------+\n| binary | utf8 |\n+---------------------+--------------------------------+\n \nIf USING is given and the result string is illegal for the\ngiven character set, a warning is issued. Also, if strict\nSQL mode is enabled, the result from CHAR() becomes NULL.\n \nExamples\n-------- \nSELECT CHAR(77,97,114,\'105\',97,\'68\',66);\n+----------------------------------+\n| CHAR(77,97,114,\'105\',97,\'68\',66) |\n+----------------------------------+\n| MariaDB |\n+----------------------------------+\n \nSELECT CHAR(77,77.3,\'77.3\');\n+----------------------+\n| CHAR(77,77.3,\'77.3\') |\n+----------------------+\n| MMM |\n+----------------------+\n1 row in set, 1 warning (0.00 sec)\n \nWarning (Code 1292): Truncated incorrect INTEGER value:\n\'77.3\'\n \n\n\nURL: https://mariadb.com/kb/en/library/char-function/','','https://mariadb.com/kb/en/library/char-function/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (583,37,'CHARACTER_LENGTH','Syntax\n------ \nCHARACTER_LENGTH(str)\n \nDescription\n----------- \nCHARACTER_LENGTH() is a synonym for CHAR_LENGTH().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/character_length/','','https://mariadb.com/kb/en/library/character_length/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (584,37,'CHAR_LENGTH','Syntax\n------ \nCHAR_LENGTH(str)\n \nDescription\n----------- \nReturns the length of the given string argument, measured in\ncharacters. A multi-byte character counts as a single\ncharacter. This means that for a string containing five\ntwo-byte characters, LENGTH() (or OCTET_LENGTH() in Oracle\nmode) returns 10, whereas CHAR_LENGTH() returns 5. If the\nargument is NULL, it returns NULL. \n \nIf the argument is not a string value, it is converted into\na string.\n \nIt is synonymous with the CHARACTER_LENGTH() function.\n \nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or\nbigint(10), in all cases. From MariaDB 10.3.1, returns\nMYSQL_TYPE_LONG, or int(10), when the result would fit\nwithin 32-bits.\n \nExamples\n-------- \nSELECT CHAR_LENGTH(\'MariaDB\');\n+------------------------+\n| CHAR_LENGTH(\'MariaDB\') |\n+------------------------+\n| 7 |\n+------------------------+\n \nSELECT CHAR_LENGTH(\'π\');\n+-------------------+\n| CHAR_LENGTH(\'π\') |\n+-------------------+\n| 1 |\n+-------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/char_length/','','https://mariadb.com/kb/en/library/char_length/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (585,37,'CHR','The CHR() function was introduced in MariaDB 10.3.1 to\nprovide Oracle compatibility\n \nSyntax\n------ \nCHR(N)\n \nDescription\n----------- \nCHR() interprets each argument N as an integer and returns a\nVARCHAR(1) string consisting of the character given by the\ncode values of the integer. The character set and collation\nof the string are set according to the values of the\ncharacter_set_database and collation_database system\nvariables.\n \nCHR() is similar to the CHAR() function, but only accepts a\nsingle argument.\n \nCHR() is available in all sql_modes.\n \nExamples\n-------- \nSELECT CHR(67);\n+---------+\n| CHR(67) |\n+---------+\n| C |\n+---------+\n \nSELECT CHR(\'67\');\n+-----------+\n| CHR(\'67\') |\n+-----------+\n| C |\n+-----------+\n \nSELECT CHR(\'C\');\n+----------+\n| CHR(\'C\') |\n+----------+\n| |\n+----------+\n1 row in set, 1 warning (0.000 sec)\n \nSHOW WARNINGS;\n \n+---------+------+----------------------------------------+\n| Level | Code | Message |\n+---------+------+----------------------------------------+\n| Warning | 1292 | Truncated incorrect INTEGER value: \'C\'\n|\n+---------+------+----------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/chr/','','https://mariadb.com/kb/en/library/chr/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (586,37,'CONCAT','Syntax\n------ \nCONCAT(str1,str2,...)\n \nDescription\n----------- \nReturns the string that results from concatenating the\narguments. May have one or more arguments. If all arguments\nare non-binary strings, the result is a non-binary string.\nIf the arguments include any binary strings, the result is a\nbinary string. A numeric argument is converted to its\nequivalent binary string form; if you want to avoid that,\nyou can use an explicit type cast, as in this example:\n \nSELECT CONCAT(CAST(int_col AS CHAR), char_col);\n \nCONCAT() returns NULL if any argument is NULL.\n \nA NULL parameter hides all information contained in other\nparameters from the result. Sometimes this is not desirable;\nto avoid this, you can:\nUse the CONCAT_WS() function with an empty separator,\nbecause that function is NULL-safe.\nUse IFNULL() to turn NULLs into empty strings.\n \nOracle Mode\n \nIn Oracle mode from MariaDB 10.3, CONCAT ignores NULL.\n \nExamples\n-------- \nSELECT CONCAT(\'Ma\', \'ria\', \'DB\');\n+---------------------------+\n| CONCAT(\'Ma\', \'ria\', \'DB\') |\n+---------------------------+\n| MariaDB |\n+---------------------------+\n \nSELECT CONCAT(\'Ma\', \'ria\', NULL, \'DB\');\n+---------------------------------+\n| CONCAT(\'Ma\', \'ria\', NULL, \'DB\') |\n+---------------------------------+\n| NULL |\n+---------------------------------+\n \nSELECT CONCAT(42.0);\n+--------------+\n| CONCAT(42.0) |\n+--------------+\n| 42.0 |\n+--------------+\n \nUsing IFNULL() to handle NULLs:\n \nSELECT CONCAT(\'The value of @v is: \', IFNULL(@v, \'\'));\n+------------------------------------------------+\n| CONCAT(\'The value of @v is: \', IFNULL(@v, \'\')) |\n+------------------------------------------------+\n| The value of @v is: |\n+------------------------------------------------+\n \nIn Oracle mode, from MariaDB 10.3:\n \nSELECT CONCAT(\'Ma\', \'ria\', NULL, \'DB\');\n+---------------------------------+\n| CONCAT(\'Ma\', \'ria\', NULL, \'DB\') |\n+---------------------------------+\n| MariaDB |\n+---------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/concat/','','https://mariadb.com/kb/en/library/concat/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (587,37,'CONCAT_WS','Syntax\n------ \nCONCAT_WS(separator,str1,str2,...)\n \nDescription\n----------- \nCONCAT_WS() stands for Concatenate With Separator and is a\nspecial form of CONCAT(). The first argument is the\nseparator for the rest of the arguments. The separator is\nadded between the strings to be concatenated. The separator\ncan be a string, as can the rest of the arguments.\n \nIf the separator is NULL, the result is NULL; all other NULL\nvalues are skipped. This makes CONCAT_WS() suitable when you\nwant to concatenate some values and avoid losing all\ninformation if one of them is NULL.\n \nExamples\n-------- \nSELECT CONCAT_WS(\',\',\'First name\',\'Second name\',\'Last\nName\');\n+-------------------------------------------------------+\n| CONCAT_WS(\',\',\'First name\',\'Second name\',\'Last\nName\') |\n+-------------------------------------------------------+\n| First name,Second name,Last Name |\n+-------------------------------------------------------+\n \nSELECT CONCAT_WS(\'-\',\'Floor\',NULL,\'Room\');\n+------------------------------------+\n| CONCAT_WS(\'-\',\'Floor\',NULL,\'Room\') |\n+------------------------------------+\n| Floor-Room |\n+------------------------------------+\n \nIn some cases, remember to include a space in the separator\nstring:\n \nSET @a = \'gnu\', @b = \'penguin\', @c = \'sea lion\';\n \nQuery OK, 0 rows affected (0.00 sec)\n \nSELECT CONCAT_WS(\', \', @a, @b, @c);\n+-----------------------------+\n| CONCAT_WS(\', \', @a, @b, @c) |\n+-----------------------------+\n| gnu, penguin, sea lion |\n+-----------------------------+\n \nUsing CONCAT_WS() to handle NULLs:\n \nSET @a = \'a\', @b = NULL, @c = \'c\';\n \nSELECT CONCAT_WS(\'\', @a, @b, @c);\n+---------------------------+\n| CONCAT_WS(\'\', @a, @b, @c) |\n+---------------------------+\n| ac |\n+---------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/concat_ws/','','https://mariadb.com/kb/en/library/concat_ws/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (588,37,'CONVERT','Syntax\n------ \nCONVERT(expr,type), CONVERT(expr USING transcoding_name)\n \nDescription\n----------- \nThe CONVERT() and CAST() functions take a value of one type\nand produce a value of another type.\n \nThe type can be one of the following values:\nBINARY\nCHAR\nDATE\nDATETIME \nDECIMAL[(M[,D])]\nDOUBLE \nFLOAT — From MariaDB 10.4.5\nINTEGER \nShort for SIGNED INTEGER\n \nSIGNED [INTEGER]\nTIME \nUNSIGNED [INTEGER]\n \nNote that in MariaDB, INT and INTEGER are the same thing.\n \nBINARY produces a string with the BINARY data type. If the\noptional length is given, BINARY(N) causes the cast to use\nno more than N bytes of the argument. Values shorter than\nthe given number in bytes are padded with 0x00 bytes to make\nthem equal the length value.\n \nCHAR(N) causes the cast to use no more than the number of\ncharacters given in the argument.\n \nThe main difference between the CAST() and CONVERT() is that\nCONVERT(expr,type) is ODBC syntax while CAST(expr as type)\nand CONVERT(... USING ...) are SQL92 syntax.\n \nCONVERT() with USING is used to convert data between\ndifferent character sets. In MariaDB, transcoding names are\nthe same as the\ncorresponding character set names. For example, this\nstatement\nconverts the string \'abc\' in the default character set to\nthe\ncorresponding string in the utf8 character set:\n \nSELECT CONVERT(\'abc\' USING utf8);\n \nExamples\n-------- \nSELECT enum_col FROM tbl_name \nORDER BY CAST(enum_col AS CHAR);\n \nConverting a BINARY to string to permit the LOWER function\nto work:\n \nSET @x = \'AardVark\';\n \nSET @x = BINARY \'AardVark\';\n \nSELECT LOWER(@x), LOWER(CONVERT (@x USING latin1));\n+-----------+----------------------------------+\n| LOWER(@x) | LOWER(CONVERT (@x USING latin1)) |\n+-----------+----------------------------------+\n| AardVark | aardvark |\n+-----------+----------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/convert/','','https://mariadb.com/kb/en/library/convert/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (589,37,'ELT','Syntax\n------ \nELT(N, str1[, str2, str3,...])\n \nDescription\n----------- \nTakes a numeric argument and a series of string arguments.\nReturns the string that corresponds to the given numeric\nposition. For instance, it returns str1 if N is 1, str2 if N\nis 2, and so on. If the numeric argument is a FLOAT, MariaDB\nrounds it to the nearest INTEGER. If the numeric argument is\nless than 1, greater than the total number of arguments, or\nnot a number, ELT() returns NULL. It must have at least two\narguments.\n \nIt is complementary to the FIELD() function.\n \nExamples\n-------- \nSELECT ELT(1, \'ej\', \'Heja\', \'hej\', \'foo\');\n+------------------------------------+\n| ELT(1, \'ej\', \'Heja\', \'hej\', \'foo\') |\n+------------------------------------+\n| ej |\n+------------------------------------+\n \nSELECT ELT(4, \'ej\', \'Heja\', \'hej\', \'foo\');\n+------------------------------------+\n| ELT(4, \'ej\', \'Heja\', \'hej\', \'foo\') |\n+------------------------------------+\n| foo |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/elt/','','https://mariadb.com/kb/en/library/elt/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (590,37,'EXPORT_SET','Syntax\n------ \nEXPORT_SET(bits, on, off[, separator[, number_of_bits]])\n \nDescription\n----------- \nTakes a minimum of three arguments. Returns a string where\neach bit in the given bits argument is returned, with the\nstring values given for on and off. \n \nBits are examined from right to left, (from low-order to\nhigh-order bits). Strings are added to the result from left\nto right, separated by a separator string (defaults as\n\',\'). You can optionally limit the number of bits the\nEXPORT_SET() function examines using the number_of_bits\noption. \n \nIf any of the arguments are set as NULL, the function\nreturns NULL.\n \nExamples\n-------- \nSELECT EXPORT_SET(5,\'Y\',\'N\',\',\',4);\n+-----------------------------+\n| EXPORT_SET(5,\'Y\',\'N\',\',\',4) |\n+-----------------------------+\n| Y,N,Y,N |\n+-----------------------------+\n \nSELECT EXPORT_SET(6,\'1\',\'0\',\',\',10);\n+------------------------------+\n| EXPORT_SET(6,\'1\',\'0\',\',\',10) |\n+------------------------------+\n| 0,1,1,0,0,0,0,0,0,0 |\n+------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/export_set/','','https://mariadb.com/kb/en/library/export_set/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (591,37,'EXTRACTVALUE','Syntax\n------ \nEXTRACTVALUE(xml_frag, xpath_expr)\n \nDescription\n----------- \nThe EXTRACTVALUE() function takes two string arguments: a\nfragment of XML markup and an XPath expression, (also known\nas a locator). It returns the text (That is, CDDATA), of the\nfirst text node which is a child of the element or elements\nmatching the XPath expression. \n \nIn cases where a valid XPath expression does not match any\ntext nodes in a valid XML fragment, (including the implicit\n/text() expression), the EXTRACTVALUE() function returns an\nempty string.\n \nInvalid Arguments\n \nWhen either the XML fragment or the XPath expression is\nNULL, the EXTRACTVALUE() function returns NULL. When the XML\nfragment is invalid, it raises a warning Code 1525:\n \nWarning (Code 1525): Incorrect XML value: \'parse error at\nline 1 pos 11: unexpected END-OF-INPUT\'\n \nWhen the XPath value is invalid, it generates an Error 1105:\n \nERROR 1105 (HY000): XPATH syntax error: \')\'\n \nExplicit text() Expressions\n \nThis function is the equivalent of performing a match using\nthe XPath expression after appending /text(). In other\nwords:\n \nSELECT\n EXTRACTVALUE(\'example\', \'/cases/case\') AS \'Base\nExample\',\n EXTRACTVALUE(\'example\', \'/cases/case/text()\') AS\n\'text() Example\';\n \n+--------------+----------------+\n| Base Example | text() Example |\n+--------------+----------------+\n| example | example |\n+--------------+----------------+\n \nCount Matches\n \nWhen EXTRACTVALUE() returns multiple matches, it returns the\ncontent of the first child text node of each matching\nelement, in the matched order, as a single, space-delimited\nstring.\n \nBy design, the EXTRACTVALUE() function makes no distinction\nbetween a match on an empty element and no match at all. If\nyou need to determine whether no matching element was found\nin the XML fragment or if an element was found that\ncontained no child text nodes, use the XPath count()\nfunction. \n \nFor instance, when looking for a value that exists, but\ncontains no child text nodes, you would get a count of the\nnumber of matching instances:\n \nSELECT\n EXTRACTVALUE(\'\', \'/cases/case\') AS \'Empty Example\',\n EXTRACTVALUE(\'\', \'/cases/case/count()\') AS \'count()\nExample\';\n \n+---------------+-----------------+\n| Empty Example | count() Example |\n+---------------+-----------------+\n| | 1 |\n+---------------+-----------------+\n \nAlternatively, when looking for a value that doesn\'t exist,\ncount() returns 0.\n \nSELECT\n EXTRACTVALUE(\'\', \'/cases/person\') AS \'No Match\nExample\',\n EXTRACTVALUE(\'\', \'/cases/person/count()\') AS \'count()\nExample\';\n \n+------------------+-----------------+\n| No Match Example | count() Example |\n+------------------+-----------------+\n| | 0|\n+------------------+-----------------+\n \nMatches\n \nImportant: The EXTRACTVALUE() function only returns CDDATA.\nIt does not return tags that the element might contain or\nthe text that these child elements contain.\n \nSELECT EXTRACTVALUE(\'Personx@example.com\', \'/cases\') AS\nCase;\n \n+--------+\n| Case |\n+--------+\n| Person |\n+--------+\n \nNote, in the above example, while the XPath expression\nmatches to the parent instance, it does not return the\ncontained tag or its content.\n \nExamples\n-------- \nSELECT\n ExtractValue(\'cccddd\', \'/a\') AS val1,\n ExtractValue(\'cccddd\', \'/a/b\') AS val2,\n ExtractValue(\'cccddd\', \'//b\') AS val3,\n ExtractValue(\'cccddd\', \'/b\') AS val4,\n ExtractValue(\'cccdddeee\', \'//b\') AS val5;\n \n+------+------+------+------+---------+\n| val1 | val2 | val3 | val4 | val5 |\n+------+------+------+------+---------+\n| ccc | ddd | ddd | | ddd eee |\n+------+------+------+------+---------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/extractvalue/','','https://mariadb.com/kb/en/library/extractvalue/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (592,37,'FIELD','Syntax\n------ \nFIELD(pattern, str1[,str2,...])\n \nDescription\n----------- \nReturns the index position of the string or number matching\nthe given pattern. Returns 0 in the event that none of the\narguments match the pattern. Raises an Error 1582 if not\ngiven at least two arguments.\n \nWhen all arguments given to the FIELD() function are\nstrings, they are treated as case-insensitive. When all the\narguments are numbers, they are treated as numbers.\nOtherwise, they are treated as doubles. \n \nIf the given pattern occurs more than once, the FIELD()\nfunction only returns the index of the first instance. If\nthe given pattern is NULL, the function returns 0, as a NULL\npattern always fails to match.\n \nThis function is complementary to the ELT() function.\n \nExamples\n-------- \nSELECT FIELD(\'ej\', \'Hej\', \'ej\', \'Heja\', \'hej\',\n\'foo\') \n AS \'Field Results\';\n \n+---------------+\n| Field Results | \n+---------------+\n| 2 |\n+---------------+\n \nSELECT FIELD(\'fo\', \'Hej\', \'ej\', \'Heja\', \'hej\',\n\'foo\')\n AS \'Field Results\';\n \n+---------------+\n| Field Results | \n+---------------+\n| 0 |\n+---------------+\n \nSELECT FIELD(1, 2, 3, 4, 5, 1) AS \'Field Results\';\n \n+---------------+\n| Field Results |\n+---------------+\n| 5 |\n+---------------+\n \nSELECT FIELD(NULL, 2, 3) AS \'Field Results\';\n \n+---------------+\n| Field Results |\n+---------------+\n| 0 |\n+---------------+\n \nSELECT FIELD(\'fail\') AS \'Field Results\';\n \nError 1582 (42000): Incorrect parameter count in call\nto native function \'field\'\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/field/','','https://mariadb.com/kb/en/library/field/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (593,37,'FIND_IN_SET','Syntax\n------ \nFIND_IN_SET(pattern, strlist)\n \nDescription\n----------- \nReturns the index position where the given pattern occurs in\na string list. The first argument is the pattern you want to\nsearch for. The second argument is a string containing\ncomma-separated variables. If the second argument is of the\nSET data-type, the function is optimized to use bit\narithmetic.\n \nIf the pattern does not occur in the string list or if the\nstring list is an empty string, the function returns 0. If\neither argument is NULL, the function returns NULL. The\nfunction does not return the correct result if the pattern\ncontains a comma (\",\") character.\n \nExamples\n-------- \nSELECT FIND_IN_SET(\'b\',\'a,b,c,d\') AS \"Found Results\";\n \n+---------------+\n| Found Results |\n+---------------+\n| 2 |\n+---------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/find_in_set/','','https://mariadb.com/kb/en/library/find_in_set/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (594,37,'FORMAT','Syntax\n------ \nFORMAT(num, decimal_position[, locale])\n \nDescription\n----------- \nFormats the given number for display as a string, adding\nseparators to appropriate position and rounding the results\nto the given decimal position. For instance, it would format\n15233.345 to 15,233.35.\n \nIf the given decimal position is 0, it rounds to return no\ndecimal point or fractional part. You can optionally specify\na locale value to format numbers to the pattern appropriate\nfor the given region.\n \nExamples\n-------- \nSELECT FORMAT(1234567890.09876543210, 4) AS \'Format\';\n \n+--------------------+\n| Format |\n+--------------------+\n| 1,234,567,890.0988 |\n+--------------------+\n \nSELECT FORMAT(1234567.89, 4) AS \'Format\';\n \n+----------------+\n| Format |\n+----------------+\n| 1,234,567.8900 |\n+----------------+\n \nSELECT FORMAT(1234567.89, 0) AS \'Format\';\n \n+-----------+\n| Format |\n+-----------+\n| 1,234,568 |\n+-----------+\n \nSELECT FORMAT(123456789,2,\'rm_CH\') AS \'Format\';\n \n+----------------+\n| Format |\n+----------------+\n| 123\'456\'789,00 |\n+----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/format/','','https://mariadb.com/kb/en/library/format/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (595,37,'FROM_BASE64','The FROM_BASE64() function was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nFROM_BASE64(str)\n \nDescription\n----------- \nDecodes the given base-64 encode string, returning the\nresult as a binary string. Returns NULL if the given string\nis NULL or if it\'s invalid.\n \nIt is the reverse of the TO_BASE64 function.\n \nThere are numerous methods to base-64 encode a string.\nMariaDB uses the following:\nIt encodes alphabet value 64 as \'+\'.\nIt encodes alphabet value 63 as \'/\'.\nIt codes output in groups of four printable characters. Each\nthree byte of data encoded uses four characters. If the\nfinal group is incomplete, it pads the difference with the\n\'=\' character.\nIt divides long output, adding a new line very 76\ncharacters.\nIn decoding, it recognizes and ignores newlines, carriage\nreturns, tabs and space whitespace characters.\n \nSELECT TO_BASE64(\'Maria\') AS \'Input\';\n \n+-----------+\n| Input |\n+-----------+\n| TWFyaWE= |\n+-----------+\n \nSELECT FROM_BASE64(\'TWFyaWE=\') AS \'Output\';\n \n+--------+\n| Output |\n+--------+\n| Maria |\n+--------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/from_base64/','','https://mariadb.com/kb/en/library/from_base64/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (596,37,'HEX','Syntax\n------ \nHEX(N_or_S)\n \nDescription\n----------- \nIf N_or_S is a number, returns a string representation of\nthe hexadecimal\nvalue of N, where N is a longlong (BIGINT) number. This is\nequivalent to CONV(N,10,16).\n \nIf N_or_S is a string, returns a hexadecimal string\nrepresentation of\nN_or_S where each byte of each character in N_or_S is\nconverted to two hexadecimal\ndigits. If N_or_S is NULL, returns NULL. The inverse of this\noperation is performed by the UNHEX()\nfunction.\n \nExamples\n-------- \nSELECT HEX(255);\n+----------+\n| HEX(255) |\n+----------+\n| FF |\n+----------+\n \nSELECT 0x4D617269614442;\n \n+------------------+\n| 0x4D617269614442 |\n+------------------+\n| MariaDB |\n+------------------+\n \nSELECT HEX(\'MariaDB\');\n+----------------+\n| HEX(\'MariaDB\') |\n+----------------+\n| 4D617269614442 |\n+----------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/hex/','','https://mariadb.com/kb/en/library/hex/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (597,37,'INSERT Function','Syntax\n------ \nINSERT(str,pos,len,newstr)\n \nDescription\n----------- \nReturns the string str, with the substring beginning at\nposition pos\nand len characters long replaced by the string newstr.\nReturns the\noriginal string if pos is not within the length of the\nstring.\nReplaces the rest of the string from position pos if len is\nnot within\nthe length of the rest of the string. Returns NULL if any\nargument is\nNULL.\n \nExamples\n-------- \nSELECT INSERT(\'Quadratic\', 3, 4, \'What\');\n+-----------------------------------+\n| INSERT(\'Quadratic\', 3, 4, \'What\') |\n+-----------------------------------+\n| QuWhattic |\n+-----------------------------------+\n \nSELECT INSERT(\'Quadratic\', -1, 4, \'What\');\n+------------------------------------+\n| INSERT(\'Quadratic\', -1, 4, \'What\') |\n+------------------------------------+\n| Quadratic |\n+------------------------------------+\n \nSELECT INSERT(\'Quadratic\', 3, 100, \'What\');\n+-------------------------------------+\n| INSERT(\'Quadratic\', 3, 100, \'What\') |\n+-------------------------------------+\n| QuWhat |\n+-------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/insert-function/','','https://mariadb.com/kb/en/library/insert-function/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (598,37,'INSTR','Syntax\n------ \nINSTR(str,substr)\n \nDescription\n----------- \nReturns the position of the first occurrence of substring\nsubstr in\nstring str. This is the same as the two-argument form of\nLOCATE(),\nexcept that the order of the arguments is reversed.\n \nINSTR() performs a case-insensitive search.\n \nIf any argument is NULL, returns NULL.\n \nExamples\n-------- \nSELECT INSTR(\'foobarbar\', \'bar\');\n+---------------------------+\n| INSTR(\'foobarbar\', \'bar\') |\n+---------------------------+\n| 4 |\n+---------------------------+\n \nSELECT INSTR(\'My\', \'Maria\');\n+----------------------+\n| INSTR(\'My\', \'Maria\') |\n+----------------------+\n| 0 |\n+----------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/instr/','','https://mariadb.com/kb/en/library/instr/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (599,37,'LCASE','Syntax\n------ \nLCASE(str)\n \nDescription\n----------- \nLCASE() is a synonym for LOWER().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/lcase/','','https://mariadb.com/kb/en/library/lcase/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (600,37,'LEFT','Syntax\n------ \nLEFT(str,len)\n \nDescription\n----------- \nReturns the leftmost len characters from the string str, or\nNULL if\nany argument is NULL.\n \nExamples\n-------- \nSELECT LEFT(\'MariaDB\', 5);\n+--------------------+\n| LEFT(\'MariaDB\', 5) |\n+--------------------+\n| Maria |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/left/','','https://mariadb.com/kb/en/library/left/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (601,37,'LENGTH','Syntax\n------ \nLENGTH(str)\n \nDescription\n----------- \nReturns the length of the string str, measured in bytes. A\nmulti-byte\ncharacter counts as multiple bytes. This means that for a\nstring\ncontaining five two-byte characters, LENGTH() returns 10,\nwhereas\nCHAR_LENGTH() returns 5. \n \nIf str is not a string value, it is converted into a string.\nIf str is NULL, the function returns NULL.\n \nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or\nbigint(10), in all cases. From MariaDB 10.3.1, returns\nMYSQL_TYPE_LONG, or int(10), when the result would fit\nwithin 32-bits.\n \nOracle Mode\n \nWhen running Oracle mode from MariaDB 10.3, LENGTH() is a\nsynonym for CHAR_LENGTH().\n \nExamples\n-------- \nSELECT LENGTH(\'MariaDB\');\n+-------------------+\n| LENGTH(\'MariaDB\') |\n+-------------------+\n| 7 |\n+-------------------+\n \nSELECT LENGTH(\'π\');\n+--------------+\n| LENGTH(\'π\') |\n+--------------+\n| 2 |\n+--------------+\n \nIn Oracle mode from MariaDB 10.3:\n \nSELECT LENGTH(\'π\');\n+--------------+\n| LENGTH(\'π\') |\n+--------------+\n| 1 |\n+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/length/','','https://mariadb.com/kb/en/library/length/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (602,37,'LENGTHB','Introduced in MariaDB 10.3.1 as part of the Oracle\ncompatibility enhancements.\n \nSyntax\n------ \nLENGTHB(str)\n \nDescription\n----------- \nLENGTHB() is a synonym for LENGTH().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/lengthb/','','https://mariadb.com/kb/en/library/lengthb/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (603,37,'LIKE','Syntax\n------ \nexpr LIKE pat [ESCAPE \'escape_char\']\nexpr NOT LIKE pat [ESCAPE \'escape_char\']\n \nDescription\n----------- \nTests whether expr matches the pattern pat. Returns either 1\n(TRUE) or 0 (FALSE).\nBoth expr and pat may be any valid expression and are\nevaluated to strings.\nPatterns may use the following wildcard characters:\n% matches any number of characters, including zero.\n_ matches any single character.\n \nUse NOT LIKE to test if a string does not match a pattern.\nThis is equivalent to using\nthe NOT operator on the entire LIKE expression.\n \nIf either the expression or the pattern is NULL, the result\nis NULL.\n \nLIKE performs case-insensitive substring matches if the\ncollation for the\nexpression and pattern is case-insensitive. For\ncase-sensitive matches, declare either argument\nto use a binary collation using COLLATE, or coerce either of\nthem to a BINARY\nstring using CAST. Use SHOW COLLATION to get a list of\navailable collations. Collations ending in _bin are\ncase-sensitive.\n \nNumeric arguments are coerced to binary strings.\n \nThe _ wildcard matches a single character, not byte. It will\nonly match a multi-byte character\nif it is valid in the expression\'s character set. For\nexample, _ will match _utf8\"€\", but it\nwill not match _latin1\"€\" because the Euro sign is not a\nvalid latin1 character. If necessary,\nuse CONVERT to use the expression in a different character\nset.\n \nIf you need to match the characters _ or %, you must escape\nthem. By default,\nyou can prefix the wildcard characters the backslash\ncharacter \\ to escape them.\nThe backslash is used both to encode special characters like\nnewlines when a string is\nparsed as well as to escape wildcards in a pattern after\nparsing. Thus, to match an\nactual backslash, you sometimes need to double-escape it as\n\"\\\\\\\\\".\n \nTo avoid difficulties with the backslash character, you can\nchange the wildcard escape\ncharacter using ESCAPE in a LIKE expression. The argument to\nESCAPE\nmust be a single-character string.\n \nExamples\n-------- \nSelect the days that begin with \"T\":\n \nCREATE TABLE t1 (d VARCHAR(16));\nINSERT INTO t1 VALUES (\"Monday\"), (\"Tuesday\"),\n(\"Wednesday\"), (\"Thursday\"), (\"Friday\"),\n(\"Saturday\"), (\"Sunday\");\nSELECT * FROM t1 WHERE d LIKE \"T%\";\n \nSELECT * FROM t1 WHERE d LIKE \"T%\";\n+----------+\n| d |\n+----------+\n| Tuesday |\n| Thursday |\n+----------+\n \nSelect the days that contain the substring \"es\":\n \nSELECT * FROM t1 WHERE d LIKE \"%es%\";\n \nSELECT * FROM t1 WHERE d LIKE \"%es%\";\n+-----------+\n| d |\n+-----------+\n| Tuesday |\n| Wednesday |\n+-----------+\n \nSelect the six-character day names:\n \nSELECT * FROM t1 WHERE d like \"___day\";\n \nSELECT * FROM t1 WHERE d like \"___day\";\n+---------+\n| d |\n+---------+\n| Monday |\n| Friday |\n| Sunday |\n+---------+\n \nWith the default collations, LIKE is case-insensitive:\n \nSELECT * FROM t1 where d like \"t%\";\n \nSELECT * FROM t1 where d like \"t%\";\n+----------+\n| d |\n+----------+\n| Tuesday |\n| Thursday |\n+----------+\n \nUse COLLATE to specify a binary collation, forcing\ncase-sensitive matches:\n \nSELECT * FROM t1 WHERE d like \"t%\" COLLATE latin1_bin;\n \nSELECT * FROM t1 WHERE d like \"t%\" COLLATE latin1_bin;\nEmpty set (0.00 sec)\n \nYou can include functions and operators in the expression to\nmatch. Select dates\nbased on their day name:\n \nCREATE TABLE t2 (d DATETIME);\nINSERT INTO t2 VALUES\n (\"2007-01-30 21:31:07\"),\n (\"1983-10-15 06:42:51\"),\n (\"2011-04-21 12:34:56\"),\n (\"2011-10-30 06:31:41\"),\n (\"2011-01-30 14:03:25\"),\n (\"2004-10-07 11:19:34\");\nSELECT * FROM t2 WHERE DAYNAME(d) LIKE \"T%\";\n \nSELECT * FROM t2 WHERE DAYNAME(d) LIKE \"T%\";\n+------------------+\n| d |\n+------------------+\n| 2007-01-30 21:31 |\n| 2011-04-21 12:34 |\n| 2004-10-07 11:19 |\n+------------------+\n3 rows in set, 7 warnings (0.00 sec)\n \nOptimizing LIKE\n \nMariaDB can use indexes for LIKE on string columns in the\ncase where the LIKE doesn\'t start with % or _.\nStarting from MariaDB 10.0, one can set the\noptimizer_use_condition_selectivity variable to 5. If this\nis done, then the optimizer will read\noptimizer_selectivity_sampling_limit rows to calculate the\nselectivity of the LIKE expression before starting to\ncalculate the query plan. This can help speed up some LIKE\nqueries by providing the optimizer with more information\nabout your data.\n \n\n\nURL: https://mariadb.com/kb/en/library/like/','','https://mariadb.com/kb/en/library/like/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (604,37,'LOAD_FILE','Syntax\n------ \nLOAD_FILE(file_name)\n \nDescription\n----------- \nReads the file and returns the file contents as a string. To\nuse this function, the file must be located on the server\nhost, you must specify the full path name to the file, and\nyou must have the FILE privilege. The file must be readable\nby all and it must be less than the size, in bytes, of the\nmax_allowed_packet system variable. If the secure_file_priv\nsystem variable is set to a non-empty directory name, the\nfile to be loaded must be located in that directory.\n \nIf the file does not exist or cannot be read because one of\nthe preceding conditions is not satisfied, the function\nreturns NULL.\n \nSince MariaDB 5.1, the character_set_filesystem system\nvariable has controlled interpretation of file names that\nare given as literal strings.\n \nStatements using the LOAD_FILE() function are not safe for\nstatement based replication. This is because the slave will\nexecute the LOAD_FILE() command itself. If the file doesn\'t\nexist on the slave, the function will return NULL.\n \nExamples\n-------- \nUPDATE t SET blob_col=LOAD_FILE(\'/tmp/picture\') WHERE\nid=1;\n \n\n\nURL: https://mariadb.com/kb/en/library/load_file/','','https://mariadb.com/kb/en/library/load_file/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (605,37,'LOCATE','Syntax\n------ \nLOCATE(substr,str), LOCATE(substr,str,pos)\n \nDescription\n----------- \nThe first syntax returns the position of the first\noccurrence of\nsubstring substr in string str. The second syntax returns\nthe position\nof the first occurrence of substring substr in string str,\nstarting at\nposition pos. Returns 0 if substr is not in str.\n \nLOCATE() performs a case-insensitive search.\n \nIf any argument is NULL, returns NULL.\n \nINSTR() is a synonym of LOCATE() without the third argument.\n \nExamples\n-------- \nSELECT LOCATE(\'bar\', \'foobarbar\');\n+----------------------------+\n| LOCATE(\'bar\', \'foobarbar\') |\n+----------------------------+\n| 4 |\n+----------------------------+\n \nSELECT LOCATE(\'My\', \'Maria\');\n+-----------------------+\n| LOCATE(\'My\', \'Maria\') |\n+-----------------------+\n| 0 |\n+-----------------------+\n \nSELECT LOCATE(\'bar\', \'foobarbar\', 5);\n+-------------------------------+\n| LOCATE(\'bar\', \'foobarbar\', 5) |\n+-------------------------------+\n| 7 |\n+-------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/locate/','','https://mariadb.com/kb/en/library/locate/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (606,37,'LOWER','Syntax\n------ \nLOWER(str)\n \nDescription\n----------- \nReturns the string str with all characters changed to\nlowercase\naccording to the current character set mapping. The default\nis latin1\n(cp1252 West European).\n \nExamples\n-------- \n SELECT LOWER(\'QUADRATICALLY\');\n+------------------------+\n| LOWER(\'QUADRATICALLY\') |\n+------------------------+\n| quadratically |\n+------------------------+\n \nLOWER() (and UPPER()) are ineffective when applied to binary\nstrings (BINARY, VARBINARY, BLOB). \nTo perform lettercase conversion, CONVERT the string to a\nnon-binary string:\n \nSET @str = BINARY \'North Carolina\';\n \nSELECT LOWER(@str), LOWER(CONVERT(@str USING latin1));\n+----------------+-----------------------------------+\n| LOWER(@str) | LOWER(CONVERT(@str USING latin1)) |\n+----------------+-----------------------------------+\n| North Carolina | north carolina |\n+----------------+-----------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/lower/','','https://mariadb.com/kb/en/library/lower/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (607,37,'LPAD','Syntax\n------ \nLPAD(str, len [,padstr])\n \nDescription\n----------- \nReturns the string str, left-padded with the string padstr\nto a length\nof len characters. If str is longer than len, the return\nvalue is\nshortened to len characters. If padstr is omitted, the LPAD\nfunction pads spaces.\n \nPrior to MariaDB 10.3.1, the padstr parameter was mandatory.\n \nReturns NULL if given a NULL argument. If the result is\nempty (zero length), returns either an empty string or, from\nMariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using LPAD_ORACLE as the function\nname.\n \nExamples\n-------- \nSELECT LPAD(\'hello\',10,\'.\');\n+----------------------+\n| LPAD(\'hello\',10,\'.\') |\n+----------------------+\n| .....hello |\n+----------------------+\n \nSELECT LPAD(\'hello\',2,\'.\');\n+---------------------+\n| LPAD(\'hello\',2,\'.\') |\n+---------------------+\n| he |\n+---------------------+\n \nFrom MariaDB 10.3.1, with the pad string defaulting to\nspace.\n \nSELECT LPAD(\'hello\',10);\n+------------------+\n| LPAD(\'hello\',10) |\n+------------------+\n| hello |\n+------------------+\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT LPAD(\'\',0),LPAD_ORACLE(\'\',0);\n+------------+-------------------+\n| LPAD(\'\',0) | LPAD_ORACLE(\'\',0) |\n+------------+-------------------+\n| | NULL |\n+------------+-------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/lpad/','','https://mariadb.com/kb/en/library/lpad/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (608,37,'LTRIM','Syntax\n------ \nLTRIM(str)\n \nDescription\n----------- \nReturns the string str with leading space characters\nremoved.\n \nReturns NULL if given a NULL argument. If the result is\nempty, returns either an empty string, or, from MariaDB\n10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using LTRIM_ORACLE as the function\nname.\n \nExamples\n-------- \nSELECT QUOTE(LTRIM(\' MariaDB \'));\n+-------------------------------+\n| QUOTE(LTRIM(\' MariaDB \')) |\n+-------------------------------+\n| \'MariaDB \' |\n+-------------------------------+\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT LTRIM(\'\'),LTRIM_ORACLE(\'\');\n+-----------+------------------+\n| LTRIM(\'\') | LTRIM_ORACLE(\'\') |\n+-----------+------------------+\n| | NULL |\n+-----------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/ltrim/','','https://mariadb.com/kb/en/library/ltrim/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (609,37,'MAKE_SET','Syntax\n------ \nMAKE_SET(bits,str1,str2,...)\n \nDescription\n----------- \nReturns a set value (a string containing substrings\nseparated by \",\"\ncharacters) consisting of the strings that have the\ncorresponding bit\nin bits set. str1 corresponds to bit 0, str2 to bit 1, and\nso on. NULL\nvalues in str1, str2, ... are not appended to the result.\n \nExamples\n-------- \nSELECT MAKE_SET(1,\'a\',\'b\',\'c\');\n+-------------------------+\n| MAKE_SET(1,\'a\',\'b\',\'c\') |\n+-------------------------+\n| a |\n+-------------------------+\n \nSELECT MAKE_SET(1 | 4,\'hello\',\'nice\',\'world\');\n+----------------------------------------+\n| MAKE_SET(1 | 4,\'hello\',\'nice\',\'world\') |\n+----------------------------------------+\n| hello,world |\n+----------------------------------------+\n \nSELECT MAKE_SET(1 | 4,\'hello\',\'nice\',NULL,\'world\');\n+---------------------------------------------+\n| MAKE_SET(1 | 4,\'hello\',\'nice\',NULL,\'world\') |\n+---------------------------------------------+\n| hello |\n+---------------------------------------------+\n \nSELECT QUOTE(MAKE_SET(0,\'a\',\'b\',\'c\'));\n+--------------------------------+\n| QUOTE(MAKE_SET(0,\'a\',\'b\',\'c\')) |\n+--------------------------------+\n| \'\' |\n+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/make_set/','','https://mariadb.com/kb/en/library/make_set/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (610,37,'MATCH AGAINST','Syntax\n------ \nMATCH (col1,col2,...) AGAINST (expr [search_modifier])\n \nDescription\n----------- \nA special construct used to perform a fulltext search on a\nfulltext index.\n \nSee Fulltext Index Overview for a full description, and\nFull-text Indexes for more articles on the topic.\n \nExamples\n-------- \nCREATE TABLE ft_myisam(copy TEXT,FULLTEXT(copy))\nENGINE=MyISAM;\n \nINSERT INTO ft_myisam(copy) VALUES (\'Once upon a time\'),\n(\'There was a wicked witch\'), \n (\'Who ate everybody up\');\n \nSELECT * FROM ft_myisam WHERE MATCH(copy)\nAGAINST(\'wicked\');\n+--------------------------+\n| copy |\n+--------------------------+\n| There was a wicked witch |\n+--------------------------+\n \nSELECT id, body, MATCH (title,body) AGAINST\n (\'Security implications of running MySQL as root\'\n IN NATURAL LANGUAGE MODE) AS score\n FROM articles WHERE MATCH (title,body) AGAINST\n (\'Security implications of running MySQL as root\'\n IN NATURAL LANGUAGE MODE);\n+----+-------------------------------------+-----------------+\n| id | body | score |\n+----+-------------------------------------+-----------------+\n| 4 | 1. Never run mysqld as root. 2. ... | 1.5219271183014\n|\n| 6 | When configured properly, MySQL ... | 1.3114095926285\n|\n+----+-------------------------------------+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/match-against/','','https://mariadb.com/kb/en/library/match-against/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (611,37,'MID','Syntax\n------ \nMID(str,pos,len)\n \nDescription\n----------- \nMID(str,pos,len) is a synonym for SUBSTRING(str,pos,len).\n \nExamples\n-------- \nSELECT MID(\'abcd\',4,1);\n+-----------------+\n| MID(\'abcd\',4,1) |\n+-----------------+\n| d |\n+-----------------+\n \nSELECT MID(\'abcd\',2,2);\n+-----------------+\n| MID(\'abcd\',2,2) |\n+-----------------+\n| bc |\n+-----------------+\n \nA negative starting position:\n \nSELECT MID(\'abcd\',-2,4);\n+------------------+\n| MID(\'abcd\',-2,4) |\n+------------------+\n| cd |\n+------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/mid/','','https://mariadb.com/kb/en/library/mid/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (612,37,'NOT LIKE','Syntax\n------ \nexpr NOT LIKE pat [ESCAPE \'escape_char\']\n \nDescription\n----------- \nThis is the same as NOT (expr LIKE pat [ESCAPE\n\'escape_char\']).\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/not-like/','','https://mariadb.com/kb/en/library/not-like/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (613,37,'NOT REGEXP','Syntax\n------ \nexpr NOT REGEXP pat, expr NOT RLIKE pat\n \nDescription\n----------- \nThis is the same as NOT (expr REGEXP pat).\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/not-regexp/','','https://mariadb.com/kb/en/library/not-regexp/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (614,37,'OCTET_LENGTH','Syntax\n------ \nOCTET_LENGTH(str)\n \nDescription\n----------- \nOCTET_LENGTH() is normally a synonym for LENGTH(). When\nrunning Oracle mode from MariaDB 10.3, they are not\nsynonyms, but OCTET_LENGTH() behaves as LENGTH() would when\nnot in Oracle mode.\n \n\n\nURL: https://mariadb.com/kb/en/library/octet_length/','','https://mariadb.com/kb/en/library/octet_length/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (615,37,'ORD','Syntax\n------ \nORD(str)\n \nDescription\n----------- \nIf the leftmost character of the string str is a multi-byte\ncharacter,\nreturns the code for that character, calculated from the\nnumeric\nvalues of its constituent bytes using this formula:\n \n (1st byte code)\n+ (2nd byte code x 256)\n+ (3rd byte code x 256 x 256) ...\n \nIf the leftmost character is not a multi-byte character,\nORD() returns\nthe same value as the ASCII() function.\n \nExamples\n-------- \nSELECT ORD(\'2\');\n+----------+\n| ORD(\'2\') |\n+----------+\n| 50 |\n+----------+\n \n\n\nURL: https://mariadb.com/kb/en/library/ord/','','https://mariadb.com/kb/en/library/ord/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (616,37,'POSITION','Syntax\n------ \nPOSITION(substr IN str)\n \nDescription\n----------- \nPOSITION(substr IN str) is a synonym for LOCATE(substr,str).\n \nIt\'s part of ODBC 3.0.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/position/','','https://mariadb.com/kb/en/library/position/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (617,37,'QUOTE','Syntax\n------ \nQUOTE(str)\n \nDescription\n----------- \nQuotes a string to produce a result that can be used as a\nproperly escaped data\nvalue in an SQL statement. The string is returned enclosed\nby single quotes and\nwith each instance of single quote (\"\'\"), backslash\n(\"\\\"),\nASCII NUL, and Control-Z preceded by a backslash. If the\nargument\nis NULL, the return value is the word \"NULL\" without\nenclosing single\nquotes.\n \nExamples\n-------- \nSELECT QUOTE(\"Don\'t!\");\n+-----------------+\n| QUOTE(\"Don\'t!\") |\n+-----------------+\n| \'Don\\\'t!\' |\n+-----------------+\n \nSELECT QUOTE(NULL); \n+-------------+\n| QUOTE(NULL) |\n+-------------+\n| NULL |\n+-------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/quote/','','https://mariadb.com/kb/en/library/quote/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (618,37,'REGEXP_INSTR','REGEXP_INSTR was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nREGEXP_INSTR(subject, pattern)\n \nReturns the position of the first occurrence of the regular\nexpression pattern in the string subject, or 0 if pattern\nwas not found.\n \nThe positions start with 1 and are measured in characters\n(i.e. not in bytes), which is important for multi-byte\ncharacter sets. You can cast a multi-byte character set to\nBINARY to get offsets in bytes.\n \nThe function follows the case sensitivity rules of the\neffective collation. Matching is performed case\ninsensitively for case insensitive collations, and case\nsensitively for case sensitive collations and for binary\ndata.\n \nThe collation case sensitivity can be overwritten using the\n(?i) and (?-i) PCRE flags.\n \nMariaDB 10.0.5 switched to the PCRE regular expression\nlibrary for enhanced regular expression performance, and\nREGEXP_INSTR was introduced as part of this enhancement.\n \nExamples\n-------- \nSELECT REGEXP_INSTR(\'abc\',\'b\');\n-> 2\n \nSELECT REGEXP_INSTR(\'abc\',\'x\');\n-> 0\n \nSELECT REGEXP_INSTR(\'BJÖRN\',\'N\');\n-> 5\n \nCasting a multi-byte character set as BINARY to get offsets\nin bytes:\n \nSELECT REGEXP_INSTR(BINARY \'BJÖRN\',\'N\') AS\ncast_utf8_to_binary;\n-> 6\n \nCase sensitivity:\n \nSELECT REGEXP_INSTR(\'ABC\',\'b\');\n-> 2\n \nSELECT REGEXP_INSTR(\'ABC\' COLLATE utf8_bin,\'b\');\n-> 0\n \nSELECT REGEXP_INSTR(BINARY\'ABC\',\'b\');\n-> 0\n \nSELECT REGEXP_INSTR(\'ABC\',\'(?-i)b\');\n-> 0\n \nSELECT REGEXP_INSTR(\'ABC\' COLLATE utf8_bin,\'(?i)b\');\n-> 2\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/regexp_instr/','','https://mariadb.com/kb/en/regexp_instr/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (619,37,'REGEXP_REPLACE','REGEXP_REPLACE was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nREGEXP_REPLACE(subject, pattern, replace)\n \nDescription\n----------- \nREGEXP_REPLACE returns the string subject with all\noccurrences of the regular expression pattern replaced by\nthe string replace. If no occurrences are found, then\nsubject is returned as is.\n \nThe replace string can have backreferences to the\nsubexpressions in the form \\N, where N is a number from 1\nto 9.\n \nThe function follows the case sensitivity rules of the\neffective collation. Matching is performed case\ninsensitively for case insensitive collations, and case\nsensitively for case sensitive collations and for binary\ndata.\n \nThe collation case sensitivity can be overwritten using the\n(?i) and (?-i) PCRE flags.\n \nMariaDB 10.0.5 switched to the PCRE regular expression\nlibrary for enhanced regular expression performance, and\nREGEXP_REPLACE was introduced as part of this enhancement.\n \nMariaDB 10.0.11 introduced the default_regex_flags variable\nto address the remaining compatibilities between PCRE and\nthe old regex library. \n \nExamples\n-------- \nSELECT REGEXP_REPLACE(\'ab12cd\',\'[0-9]\',\'\') AS\nremove_digits;\n-> abcd\n \nSELECT REGEXP_REPLACE(\'titlebody\', \'\',\' \')\nAS strip_html;\n-> title body\n \nBackreferences to the subexpressions in the form \\N, where\nN is a number from 1 to 9:\n \nSELECT REGEXP_REPLACE(\'James Bond\',\'^(.*)\n(.*)$\',\'\\\\2, \\\\1\') AS reorder_name;\n-> Bond, James\n \nCase insensitive and case sensitive matches:\n \nSELECT REGEXP_REPLACE(\'ABC\',\'b\',\'-\') AS\ncase_insensitive;\n-> A-C\n \nSELECT REGEXP_REPLACE(\'ABC\' COLLATE utf8_bin,\'b\',\'-\')\nAS case_sensitive;\n-> ABC\n \nSELECT REGEXP_REPLACE(BINARY \'ABC\',\'b\',\'-\') AS\nbinary_data;\n-> ABC\n \nOverwriting the collation case sensitivity using the (?i)\nand (?-i) PCRE flags.\n \nSELECT REGEXP_REPLACE(\'ABC\',\'(?-i)b\',\'-\') AS\nforce_case_sensitive;\n-> ABC\n \nSELECT REGEXP_REPLACE(BINARY \'ABC\',\'(?i)b\',\'-\') AS\nforce_case_insensitive;\n-> A-C\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/regexp_replace/','','https://mariadb.com/kb/en/regexp_replace/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (620,37,'REGEXP_SUBSTR','REGEXP_SUBSTR was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nREGEXP_SUBSTR(subject,pattern)\n \nDescription\n----------- \nReturns the part of the string subject that matches the\nregular expression pattern, or an empty string if pattern\nwas not found.\n \nThe function follows the case sensitivity rules of the\neffective collation. Matching is performed case\ninsensitively for case insensitive collations, and case\nsensitively for case sensitive collations and for binary\ndata.\n \nThe collation case sensitivity can be overwritten using the\n(?i) and (?-i) PCRE flags.\n \nMariaDB 10.0.5 switched to the PCRE regular expression\nlibrary for enhanced regular expression performance, and\nREGEXP_SUBSTR was introduced as part of this enhancement.\n \nMariaDB 10.0.11 introduced the default_regex_flags variable\nto address the remaining compatibilities between PCRE and\nthe old regex library. \n \nExamples\n-------- \nSELECT REGEXP_SUBSTR(\'ab12cd\',\'[0-9]+\');\n-> 12\n \nSELECT REGEXP_SUBSTR(\n \'See https://mariadb.org/en/foundation/ for details\',\n \'https?://[^/]*\');\n-> https://mariadb.org\n \nSELECT REGEXP_SUBSTR(\'ABC\',\'b\');\n-> B\n \nSELECT REGEXP_SUBSTR(\'ABC\' COLLATE utf8_bin,\'b\');\n->\n \nSELECT REGEXP_SUBSTR(BINARY\'ABC\',\'b\');\n->\n \nSELECT REGEXP_SUBSTR(\'ABC\',\'(?i)b\');\n-> B\n \nSELECT REGEXP_SUBSTR(\'ABC\' COLLATE utf8_bin,\'(?+i)b\');\n-> B\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/regexp_substr/','','https://mariadb.com/kb/en/regexp_substr/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (621,37,'REPEAT Function','Syntax\n------ \nREPEAT(str,count)\n \nDescription\n----------- \nReturns a string consisting of the string str repeated count\ntimes. If\ncount is less than 1, returns an empty string. Returns NULL\nif str or\ncount are NULL.\n \nExamples\n-------- \nSELECT QUOTE(REPEAT(\'MariaDB \',4));\n+------------------------------------+\n| QUOTE(REPEAT(\'MariaDB \',4)) |\n+------------------------------------+\n| \'MariaDB MariaDB MariaDB MariaDB \' |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/repeat-function/','','https://mariadb.com/kb/en/library/repeat-function/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (622,37,'REPLACE Function','Syntax\n------ \nREPLACE(str,from_str,to_str)\n \nDescription\n----------- \nReturns the string str with all occurrences of the string\nfrom_str\nreplaced by the string to_str. REPLACE() performs a\ncase-sensitive\nmatch when searching for from_str.\n \nExamples\n-------- \nSELECT REPLACE(\'www.mariadb.org\', \'w\', \'Ww\');\n+---------------------------------------+\n| REPLACE(\'www.mariadb.org\', \'w\', \'Ww\') |\n+---------------------------------------+\n| WwWwWw.mariadb.org |\n+---------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/replace-function/','','https://mariadb.com/kb/en/library/replace-function/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (623,37,'REVERSE','Syntax\n------ \nREVERSE(str)\n \nDescription\n----------- \nReturns the string str with the order of the characters\nreversed.\n \nExamples\n-------- \nSELECT REVERSE(\'desserts\');\n+---------------------+\n| REVERSE(\'desserts\') |\n+---------------------+\n| stressed |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/reverse/','','https://mariadb.com/kb/en/library/reverse/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (624,37,'RIGHT','Syntax\n------ \nRIGHT(str,len)\n \nDescription\n----------- \nReturns the rightmost len characters from the string str, or\nNULL if\nany argument is NULL.\n \nExamples\n-------- \nSELECT RIGHT(\'MariaDB\', 2);\n+---------------------+\n| RIGHT(\'MariaDB\', 2) |\n+---------------------+\n| DB |\n+---------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/right/','','https://mariadb.com/kb/en/library/right/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (625,37,'RPAD','Syntax\n------ \nRPAD(str, len [, padstr])\n \nDescription\n----------- \nReturns the string str, right-padded with the string padstr\nto a\nlength of len characters. If str is longer than len, the\nreturn value\nis shortened to len characters. If padstr is omitted, the\nRPAD function pads spaces.\n \nPrior to MariaDB 10.3.1, the padstr parameter was mandatory.\n \nReturns NULL if given a NULL argument. If the result is\nempty (a length of zero), returns either an empty string,\nor, from MariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using RPAD_ORACLE as the function\nname.\n \nExamples\n-------- \nSELECT RPAD(\'hello\',10,\'.\');\n+----------------------+\n| RPAD(\'hello\',10,\'.\') |\n+----------------------+\n| hello..... |\n+----------------------+\n \nSELECT RPAD(\'hello\',2,\'.\');\n+---------------------+\n| RPAD(\'hello\',2,\'.\') |\n+---------------------+\n| he |\n+---------------------+\n \nFrom MariaDB 10.3.1, with the pad string defaulting to\nspace.\n \nSELECT RPAD(\'hello\',30);\n+--------------------------------+\n| RPAD(\'hello\',30) |\n+--------------------------------+\n| hello |\n+--------------------------------+\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT RPAD(\'\',0),RPAD_ORACLE(\'\',0);\n+------------+-------------------+\n| RPAD(\'\',0) | RPAD_ORACLE(\'\',0) |\n+------------+-------------------+\n| | NULL |\n+------------+-------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/rpad/','','https://mariadb.com/kb/en/library/rpad/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (626,37,'RTRIM','Syntax\n------ \nRTRIM(str)\n \nDescription\n----------- \nReturns the string str with trailing space characters\nremoved.\n \nReturns NULL if given a NULL argument. If the result is\nempty, returns either an empty string, or, from MariaDB\n10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using RTRIM_ORACLE as the function\nname.\n \nExamples\n-------- \nSELECT QUOTE(RTRIM(\'MariaDB \'));\n+-----------------------------+\n| QUOTE(RTRIM(\'MariaDB \')) |\n+-----------------------------+\n| \'MariaDB\' |\n+-----------------------------+\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT RTRIM(\'\'),RTRIM_ORACLE(\'\');\n+-----------+------------------+\n| RTRIM(\'\') | RTRIM_ORACLE(\'\') |\n+-----------+------------------+\n| | NULL |\n+-----------+------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/rtrim/','','https://mariadb.com/kb/en/library/rtrim/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (627,37,'SOUNDEX','Syntax\n------ \nSOUNDEX(str)\n \nDescription\n----------- \nReturns a soundex string from str. Two strings that sound\nalmost the\nsame should have identical soundex strings. A standard\nsoundex string is four\ncharacters long, but the SOUNDEX() function returns an\narbitrarily long\nstring. You can use SUBSTRING() on the result to get a\nstandard soundex\nstring. All non-alphabetic characters in str are ignored.\nAll\ninternational alphabetic characters outside the A-Z range\nare treated as\nvowels.\n \nImportant: When using SOUNDEX(), you should be aware of the\nfollowing limitations:\nThis function, as currently implemented, is intended to work\nwell with\n strings that are in the English language only. Strings in\nother languages may\n not produce reliable results.\n \nExamples\n-------- \nSOUNDEX(\'Hello\');\n+------------------+\n| SOUNDEX(\'Hello\') |\n+------------------+\n| H400 |\n+------------------+\n \nSELECT SOUNDEX(\'MariaDB\');\n+--------------------+\n| SOUNDEX(\'MariaDB\') |\n+--------------------+\n| M631 |\n+--------------------+\n \nSELECT SOUNDEX(\'Knowledgebase\');\n+--------------------------+\n| SOUNDEX(\'Knowledgebase\') |\n+--------------------------+\n| K543212 |\n+--------------------------+\n \nSELECT givenname, surname FROM users WHERE\nSOUNDEX(givenname) = SOUNDEX(\"robert\");\n+-----------+---------+\n| givenname | surname |\n+-----------+---------+\n| Roberto | Castro |\n+-----------+---------+\n \n\n\nURL: https://mariadb.com/kb/en/library/soundex/','','https://mariadb.com/kb/en/library/soundex/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (628,37,'SOUNDS LIKE','Syntax\n------ \nexpr1 SOUNDS LIKE expr2\n \nDescription\n----------- \nThis is the same as SOUNDEX(expr1) = SOUNDEX(expr2).\n \nExample\n \nSELECT givenname, surname FROM users WHERE givenname SOUNDS\nLIKE \"robert\";\n \n+-----------+---------+\n| givenname | surname |\n+-----------+---------+\n| Roberto | Castro |\n+-----------+---------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/sounds-like/','','https://mariadb.com/kb/en/library/sounds-like/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (629,37,'SPACE','Syntax\n------ \nSPACE(N)\n \nDescription\n----------- \nReturns a string consisting of N space characters. If N is\nNULL, returns NULL.\n \nExamples\n-------- \nSELECT QUOTE(SPACE(6));\n+-----------------+\n| QUOTE(SPACE(6)) |\n+-----------------+\n| \' \' |\n+-----------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/space/','','https://mariadb.com/kb/en/library/space/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (630,37,'STRCMP','Syntax\n------ \nSTRCMP(expr1,expr2)\n \nDescription\n----------- \nSTRCMP() returns 0 if the strings are the same, -1 if the\nfirst\nargument is smaller than the second according to the current\nsort order,\nand 1 otherwise.\n \nExamples\n-------- \nSELECT STRCMP(\'text\', \'text2\');\n+-------------------------+\n| STRCMP(\'text\', \'text2\') |\n+-------------------------+\n| -1 |\n+-------------------------+\n \nSELECT STRCMP(\'text2\', \'text\');\n+-------------------------+\n| STRCMP(\'text2\', \'text\') |\n+-------------------------+\n| 1 |\n+-------------------------+\n \nSELECT STRCMP(\'text\', \'text\');\n+------------------------+\n| STRCMP(\'text\', \'text\') |\n+------------------------+\n| 0 |\n+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/strcmp/','','https://mariadb.com/kb/en/library/strcmp/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (631,37,'SUBSTR','Description\n----------- \nSUBSTR() is a synonym for SUBSTRING().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/substr/','','https://mariadb.com/kb/en/library/substr/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (632,37,'SUBSTRING','Syntax\n------ \nSUBSTRING(str,pos), \nSUBSTRING(str FROM pos), \nSUBSTRING(str,pos,len),\nSUBSTRING(str FROM pos FOR len)\n \nSUBSTR(str,pos), \nSUBSTR(str FROM pos), \nSUBSTR(str,pos,len),\nSUBSTR(str FROM pos FOR len)\n \nDescription\n----------- \nThe forms without a len argument return a substring from\nstring str starting at position pos.\n \nThe forms with a len argument return a substring len\ncharacters long from string str, starting at position pos.\n \nThe forms that use FROM are standard SQL syntax.\n \nIt is also possible to use a negative value for pos. In this\ncase, the beginning of the substring is pos characters from\nthe end of the string, rather than the beginning. A negative\nvalue may be used for pos in any of the forms of this\nfunction.\n \nBy default, the position of the first character in the\nstring from which the substring is to be extracted is\nreckoned as 1. For Oracle-compatibility, from MariaDB\n10.3.3, when sql_mode is set to \'oracle\', position zero is\ntreated as position 1 (although the first character is still\nreckoned as 1).\n \nIf any argument is NULL, returns NULL.\n \nExamples\n-------- \nSELECT SUBSTRING(\'Knowledgebase\',5);\n+------------------------------+\n| SUBSTRING(\'Knowledgebase\',5) |\n+------------------------------+\n| ledgebase |\n+------------------------------+\n \nSELECT SUBSTRING(\'MariaDB\' FROM 6);\n+-----------------------------+\n| SUBSTRING(\'MariaDB\' FROM 6) |\n+-----------------------------+\n| DB |\n+-----------------------------+\n \nSELECT SUBSTRING(\'Knowledgebase\',3,7);\n+--------------------------------+\n| SUBSTRING(\'Knowledgebase\',3,7) |\n+--------------------------------+\n| owledge |\n+--------------------------------+\n \nSELECT SUBSTRING(\'Knowledgebase\', -4);\n+--------------------------------+\n| SUBSTRING(\'Knowledgebase\', -4) |\n+--------------------------------+\n| base |\n+--------------------------------+\n \nSELECT SUBSTRING(\'Knowledgebase\', -8, 4);\n+-----------------------------------+\n| SUBSTRING(\'Knowledgebase\', -8, 4) |\n+-----------------------------------+\n| edge |\n+-----------------------------------+\n \nSELECT SUBSTRING(\'Knowledgebase\' FROM -8 FOR 4);\n+------------------------------------------+\n| SUBSTRING(\'Knowledgebase\' FROM -8 FOR 4) |\n+------------------------------------------+\n| edge |\n+------------------------------------------+\n \nOracle mode from MariaDB 10.3.3:\n \nSELECT SUBSTR(\'abc\',0,3);\n+-------------------+\n| SUBSTR(\'abc\',0,3) |\n+-------------------+\n| |\n+-------------------+\n \nSELECT SUBSTR(\'abc\',1,2);\n+-------------------+\n| SUBSTR(\'abc\',1,2) |\n+-------------------+\n| ab |\n+-------------------+\n \nSET sql_mode=\'oracle\';\n \nSELECT SUBSTR(\'abc\',0,3);\n+-------------------+\n| SUBSTR(\'abc\',0,3) |\n+-------------------+\n| abc |\n+-------------------+\n \nSELECT SUBSTR(\'abc\',1,2);\n+-------------------+\n| SUBSTR(\'abc\',1,2) |\n+-------------------+\n| ab |\n+-------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/substring/','','https://mariadb.com/kb/en/library/substring/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (633,37,'SUBSTRING_INDEX','Syntax\n------ \nSUBSTRING_INDEX(str,delim,count)\n \nDescription\n----------- \nReturns the substring from string str before count\noccurrences of the\ndelimiter delim. If count is positive, everything to the\nleft\nof the final delimiter (counting from the left) is returned.\nIf count\nis negative, everything to the right of the final delimiter\n(counting from the\nright) is returned. SUBSTRING_INDEX() performs a\ncase-sensitive match when\nsearching for delim.\n \nIf any argument is NULL, returns NULL.\n \nExamples\n-------- \nSELECT SUBSTRING_INDEX(\'www.mariadb.org\', \'.\', 2);\n+--------------------------------------------+\n| SUBSTRING_INDEX(\'www.mariadb.org\', \'.\', 2) |\n+--------------------------------------------+\n| www.mariadb |\n+--------------------------------------------+\n \nSELECT SUBSTRING_INDEX(\'www.mariadb.org\', \'.\', -2);\n+---------------------------------------------+\n| SUBSTRING_INDEX(\'www.mariadb.org\', \'.\', -2) |\n+---------------------------------------------+\n| mariadb.org |\n+---------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/substring_index/','','https://mariadb.com/kb/en/library/substring_index/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (634,37,'TO_BASE64','The TO_BASE64() function was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nTO_BASE64(str)\n \nDescription\n----------- \nConverts the string argument str to its base-64 encoded\nform, returning the result as a character string in the\nconnection character set and collation.\n \nThe argument str will be converted to string first if it is\nnot a string. A NULL argument will return a NULL result.\n \nThe reverse function, FROM_BASE64(), decodes an encoded\nbase-64 string.\n \nThere are a numerous different methods to base-64 encode a\nstring. The following are used by MariaDB and MySQL:\nAlphabet value 64 is encoded as \'+\'.\nAlphabet value 63 is encoded as \'/\'.\nEncoding output is made up of groups of four printable\ncharacters, with each three bytes of data encoded using four\ncharacters. If the final group is not complete, it is padded\nwith \'=\' characters to make up a length of four.\nTo divide long output, a newline is added after every 76\ncharacters.\nDecoding will recognize and ignore newlines, carriage\nreturns, tabs, and spaces. \n \nExamples\n-------- \nSELECT TO_BASE64(\'Maria\');\n+--------------------+\n| TO_BASE64(\'Maria\') |\n+--------------------+\n| TWFyaWE= |\n+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/to_base64/','','https://mariadb.com/kb/en/library/to_base64/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (635,37,'TRIM','Syntax\n------ \nTRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str),\nTRIM([remstr FROM] str)\n \nDescription\n----------- \nReturns the string str with all remstr prefixes or suffixes\nremoved. If none of the specifiers BOTH, LEADING, or\nTRAILING is given, BOTH is assumed. remstr is optional and,\nif not specified, spaces are removed.\n \nReturns NULL if given a NULL argument. If the result is\nempty, returns either an empty string, or, from MariaDB\n10.3.6 with SQL_MODE=Oracle, NULL.\n \nThe Oracle mode version of the function can be accessed\noutside of Oracle mode by using TRIM_ORACLE as the function\nname.\n \nExamples\n-------- \nSELECT TRIM(\' bar \')\\G\n*************************** 1. row\n***************************\nTRIM(\' bar \'): bar\n \nSELECT TRIM(LEADING \'x\' FROM \'xxxbarxxx\')\\G\n*************************** 1. row\n***************************\nTRIM(LEADING \'x\' FROM \'xxxbarxxx\'): barxxx\n \nSELECT TRIM(BOTH \'x\' FROM \'xxxbarxxx\')\\G\n*************************** 1. row\n***************************\nTRIM(BOTH \'x\' FROM \'xxxbarxxx\'): bar\n \nSELECT TRIM(TRAILING \'xyz\' FROM \'barxxyz\')\\G\n*************************** 1. row\n***************************\nTRIM(TRAILING \'xyz\' FROM \'barxxyz\'): barx\n \nOracle mode version from MariaDB 10.3.6:\n \nSELECT TRIM(\'\'),TRIM_ORACLE(\'\');\n+----------+-----------------+\n| TRIM(\'\') | TRIM_ORACLE(\'\') |\n+----------+-----------------+\n| | NULL |\n+----------+-----------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/trim/','','https://mariadb.com/kb/en/library/trim/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (636,37,'UCASE','Syntax\n------ \nUCASE(str)\n \nDescription\n----------- \nUCASE() is a synonym for UPPER().\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/ucase/','','https://mariadb.com/kb/en/library/ucase/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (637,37,'UNHEX','Syntax\n------ \nUNHEX(str)\n \nDescription\n----------- \nPerforms the inverse operation of HEX(str). That is, it\ninterprets\neach pair of hexadecimal digits in the argument as a number\nand\nconverts it to the character represented by the number. The\nresulting\ncharacters are returned as a binary string.\n \nIf str is NULL, UNHEX() returns NULL.\n \nExamples\n-------- \nSELECT HEX(\'MariaDB\');\n+----------------+\n| HEX(\'MariaDB\') |\n+----------------+\n| 4D617269614442 |\n+----------------+\n \nSELECT UNHEX(\'4D617269614442\');\n+-------------------------+\n| UNHEX(\'4D617269614442\') |\n+-------------------------+\n| MariaDB |\n+-------------------------+\n \nSELECT 0x4D617269614442;\n \n+------------------+\n| 0x4D617269614442 |\n+------------------+\n| MariaDB |\n+------------------+\n \nSELECT UNHEX(HEX(\'string\'));\n+----------------------+\n| UNHEX(HEX(\'string\')) |\n+----------------------+\n| string |\n+----------------------+\n \nSELECT HEX(UNHEX(\'1267\'));\n+--------------------+\n| HEX(UNHEX(\'1267\')) |\n+--------------------+\n| 1267 |\n+--------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/unhex/','','https://mariadb.com/kb/en/library/unhex/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (638,37,'UPDATEXML','Syntax\n------ \nUpdateXML(xml_target, xpath_expr, new_xml)\n \nDescription\n----------- \nThis function replaces a single portion of a given fragment\nof XML markup\nxml_target with a new XML fragment new_xml, and then returns\nthe\nchanged XML. The portion of xml_target that is replaced\nmatches an XPath\nexpression xpath_expr supplied by the user. If no expression\nmatching\nxpath_expr is found, or if multiple matches are found, the\nfunction returns\nthe original xml_target XML fragment. All three arguments\nshould be\nstrings.\n \nExamples\n-------- \nSELECT\n UpdateXML(\'ccc\', \'/a\', \'fff\') AS val1,\n UpdateXML(\'ccc\', \'/b\', \'fff\') AS val2,\n UpdateXML(\'ccc\', \'//b\', \'fff\') AS val3,\n UpdateXML(\'ccc\', \'/a/d\', \'fff\') AS val4,\n UpdateXML(\'ccc\', \'/a/d\', \'fff\') AS val5\n \\G\n*************************** 1. row\n***************************\nval1: fff\nval2: ccc\nval3: fff\nval4: cccfff\nval5: ccc\n1 row in set (0.00 sec)\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/updatexml/','','https://mariadb.com/kb/en/library/updatexml/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (639,37,'UPPER','Syntax\n------ \nUPPER(str)\n \nDescription\n----------- \nReturns the string str with all characters changed to\nuppercase\naccording to the current character set mapping. The default\nis latin1\n(cp1252 West European).\n \nSELECT UPPER(surname), givenname FROM users ORDER BY\nsurname;\n \n+----------------+------------+\n| UPPER(surname) | givenname |\n+----------------+------------+\n| ABEL | Jacinto |\n| CASTRO | Robert |\n| COSTA | Phestos |\n| MOSCHELLA | Hippolytos |\n+----------------+------------+\n \nUPPER() is ineffective when applied to binary strings\n(BINARY,\nVARBINARY, BLOB). The description of \nLOWER() shows how to\nperform lettercase conversion of binary strings.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/upper/','','https://mariadb.com/kb/en/library/upper/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (640,37,'WEIGHT_STRING','The WEIGHT_STRING function was introduced in MariaDB 10.0.5.\n \nSyntax\n------ \nWEIGHT_STRING(str [AS {CHAR|BINARY}(N)] [LEVEL levels]\n[flags])\n levels: N [ASC|DESC|REVERSE] [, N [ASC|DESC|REVERSE]] ... \n \nDescription\n----------- \nReturns a binary string representing the string\'s sorting\nand comparison value. A string with a lower result means\nthat for sorting purposes the string appears before a string\nwith a higher result.\n \nWEIGHT_STRING() is particularly useful when adding new\ncollations, for testing purposes.\n \nIf str is a non-binary string (CHAR, VARCHAR or TEXT),\nWEIGHT_STRING returns the string\'s collation weight. If str\nis a binary string (BINARY, VARBINARY or BLOB), the return\nvalue is simply the input value, since the weight for each\nbyte in a binary string is the byte value.\n \nWEIGHT_STRING() returns NULL if given a NULL input. \n \nThe optional AS clause permits casting the input string to a\nbinary or non-binary string, as well as to a particular\nlength.\n \nAS BINARY(N) measures the length in bytes rather than\ncharacters, and right pads with 0x00 bytes to the desired\nlength. \n \nAS CHAR(N) measures the length in characters, and right pads\nwith spaces to the desired length.\n \nN has a minimum value of 1, and if it is less than the\nlength of the input string, the string is truncated without\nwarning.\n \nThe optional LEVEL clause specifies that the return value\nshould contain weights for specific collation levels. The\nlevels specifier can either be a single integer, a\ncomma-separated list of integers, or a range of integers\nseparated by a dash (whitespace is ignored). Integers can\nrange from 1 to a maximum of 6, dependent on the collation,\nand need to be listed in ascending order.\n \nIf the LEVEL clause is no provided, a default of 1 to the\nmaximum for the collation is assumed.\n \nIf the LEVEL is specified without using a range, an optional\nmodifier is permitted.\n \nASC, the default, returns the weights without any\nmodification.\n \nDESC returns bitwise-inverted weights.\n \nREVERSE returns the weights in reverse order.\n \nExamples\n-------- \nThe examples below use the HEX() function to represent\nnon-printable results in hexadecimal format.\n \nSELECT HEX(WEIGHT_STRING(\'x\'));\n+-------------------------+\n| HEX(WEIGHT_STRING(\'x\')) |\n+-------------------------+\n| 0058 |\n+-------------------------+\n \nSELECT HEX(WEIGHT_STRING(\'x\' AS BINARY(4)));\n+--------------------------------------+\n| HEX(WEIGHT_STRING(\'x\' AS BINARY(4))) |\n+--------------------------------------+\n| 78000000 |\n+--------------------------------------+\n \nSELECT HEX(WEIGHT_STRING(\'x\' AS CHAR(4)));\n+------------------------------------+\n| HEX(WEIGHT_STRING(\'x\' AS CHAR(4))) |\n+------------------------------------+\n| 0058002000200020 |\n+------------------------------------+\n \nSELECT HEX(WEIGHT_STRING(0xaa22ee LEVEL 1));\n+--------------------------------------+\n| HEX(WEIGHT_STRING(0xaa22ee LEVEL 1)) |\n+--------------------------------------+\n| AA22EE |\n+--------------------------------------+\n \nSELECT HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 DESC));\n+-------------------------------------------+\n| HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 DESC)) |\n+-------------------------------------------+\n| 55DD11 |\n+-------------------------------------------+\n \nSELECT HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 REVERSE));\n+----------------------------------------------+\n| HEX(WEIGHT_STRING(0xaa22ee LEVEL 1 REVERSE)) |\n+----------------------------------------------+\n| EE22AA |\n+----------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/weight_string/','','https://mariadb.com/kb/en/library/weight_string/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (641,39,'ALTER DATABASE','Modifies a database, changing its overall characteristics.\n \nSyntax\n------ \nALTER {DATABASE | SCHEMA} [db_name]\n alter_specification ...\nALTER {DATABASE | SCHEMA} db_name\n UPGRADE DATA DIRECTORY NAME\n \nalter_specification:\n [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n \nDescription\n----------- \nALTER DATABASE enables you to change the overall\ncharacteristics of a\ndatabase. These characteristics are stored in the db.opt\nfile in the\ndatabase directory. To use ALTER DATABASE, you need the\nALTER\nprivilege on the database. ALTER SCHEMA is a synonym for\nALTER\nDATABASE.\n \nThe CHARACTER SET clause changes the default database\ncharacter set.\nThe COLLATE clause changes the default database collation.\nSee Character Sets and Collations for more.\n \nYou can see what character sets and collations are available\nusing,\nrespectively, the SHOW CHARACTER SET and SHOW COLLATION\nstatements.\n \nChanging the default character set/collation of a database\ndoes not change the character set/collation of any stored\nprocedures or stored functions that were previously created,\nand relied on the defaults. These need to be dropped and\nrecreated in order to apply the character set/collation\nchanges.\n \nThe database name can be omitted from the first syntax, in\nwhich case\nthe statement applies to the default database.\n \nThe syntax that includes the UPGRADE DATA DIRECTORY NAME\nclause was\nadded in MySQL 5.1.23. It updates the name of the directory\nassociated\nwith the database to use the encoding implemented in MySQL\n5.1 for\nmapping database names to database directory names (see\nIdentifier to File Name Mapping). This\nclause is for use under these conditions:\nIt is intended when upgrading MySQL to 5.1 or later from\nolder versions.\nIt is intended to update a database directory name to the\ncurrent encoding format if the name contains special\ncharacters that need encoding.\nThe statement is used by mysqlcheck (as invoked by\nmysql_upgrade).\n \nFor example,if a database in MySQL 5.0 has a name of a-b-c,\nthe name\ncontains instance of the `-\' character. In 5.0, the\ndatabase directory\nis also named a-b-c, which is not necessarily safe for all\nfile\nsystems. In MySQL 5.1 and up, the same database name is\nencoded as\na@002db@002dc to produce a file system-neutral directory\nname.\n \nWhen a MySQL installation is upgraded to MySQL 5.1 or later\nfrom an\nolder version,the server displays a name such as a-b-c\n(which is in\nthe old format) as #mysql50#a-b-c, and you must refer to the\nname\nusing the #mysql50# prefix. Use UPGRADE DATA DIRECTORY NAME\nin this\ncase to explicitly tell the server to re-encode the database\ndirectory\nname to the current encoding format:\n \nALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;\n \nAfter executing this statement, you can refer to the\ndatabase as a-b-c\nwithout the special #mysql50# prefix.\n \nExamples\n-------- \nALTER DATABASE test CHARACTER SET = \'utf8\' COLLATE =\n\'utf8_bin\';\n \n\n\nURL: https://mariadb.com/kb/en/library/alter-database/','','https://mariadb.com/kb/en/library/alter-database/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (642,39,'ALTER EVENT','Modifies one or more characteristics of an existing event.\n \nSyntax\n------ \nALTER\n [DEFINER = { user | CURRENT_USER }]\n EVENT event_name\n [ON SCHEDULE schedule]\n [ON COMPLETION [NOT] PRESERVE]\n [RENAME TO new_event_name]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n [DO sql_statement]\n \nDescription\n----------- \nThe ALTER EVENT statement is used to change one or more of\nthe\ncharacteristics of an existing event without the need to\ndrop and recreate it.\nThe syntax for each of the DEFINER, ON SCHEDULE, ON\nCOMPLETION,\nCOMMENT, ENABLE / DISABLE, and DO clauses is exactly the\nsame as when used with CREATE EVENT.\n \nThis statement requires the EVENT privilege.\nWhen a user executes a successful ALTER EVENT statement,\nthat user becomes\nthe definer for the affected event.\n \n(In MySQL 5.1.11 and earlier, an event could be altered only\nby its definer, or\nby a user having the SUPER privilege.)\n \nALTER EVENT works only with an existing event:\n \nALTER EVENT no_such_event ON SCHEDULE EVERY \'2:3\'\nDAY_HOUR;\nERROR 1539 (HY000): Unknown event \'no_such_event\'\n \nExamples\n-------- \nALTER EVENT myevent \n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 2 HOUR \n DO \n UPDATE myschema.mytable SET mycol = mycol + 1;\n \n\n\nURL: https://mariadb.com/kb/en/library/alter-event/','','https://mariadb.com/kb/en/library/alter-event/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (643,39,'ALTER FUNCTION','Syntax\n------ \nALTER FUNCTION func_name [characteristic ...]\n \ncharacteristic:\n { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL\nDATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n \nDescription\n----------- \nThis statement can be used to change the characteristics of\na stored\nfunction. More than one change may be specified in an ALTER\nFUNCTION\nstatement. However, you cannot change the parameters or body\nof a\nstored function using this statement; to make such changes,\nyou must\ndrop and re-create the function using DROP FUNCTION and\nCREATE FUNCTION.\n \nYou must have the ALTER ROUTINE privilege for the function.\n(That\nprivilege is granted automatically to the function creator.)\nIf binary\nlogging is enabled, the ALTER FUNCTION statement might also\nrequire\nthe SUPER privilege, as described in Binary Logging of\nStored Routines.\n \nExample\n \nALTER FUNCTION hello SQL SECURITY INVOKER;\n \n\n\nURL: https://mariadb.com/kb/en/library/alter-function/','','https://mariadb.com/kb/en/library/alter-function/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (644,39,'ALTER LOGFILE GROUP','Syntax\n------ \nALTER LOGFILE GROUP logfile_group\n ADD UNDOFILE \'file_name\'\n [INITIAL_SIZE [=] size]\n [WAIT]\n ENGINE [=] engine_name\n \nThe ALTER LOGFILE GROUP statement is not supported by\nMariaDB. It was originally inherited from MySQL NDB Cluster.\nSee MDEV-19295 for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/alter-logfile-group/','','https://mariadb.com/kb/en/library/alter-logfile-group/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (645,39,'ALTER PROCEDURE','Syntax\n------ \nALTER PROCEDURE proc_name [characteristic ...]\n \ncharacteristic:\n { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL\nDATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n \nDescription\n----------- \nThis statement can be used to change the characteristics of\na stored\nprocedure. More than one change may be specified in an ALTER\nPROCEDURE\nstatement. However, you cannot change the parameters or body\nof a\nstored procedure using this statement. To make such changes,\nyou must\ndrop and re-create the procedure using either CREATE OR\nREPLACE PROCEDURE (since MariaDB 10.1.3) or DROP PROCEDURE\nand CREATE PROCEDURE (MariaDB 10.1.2 and before).\n \nYou must have the ALTER ROUTINE privilege for the procedure.\nBy default, that privilege is granted automatically to the\nprocedure creator. See Stored Routine Privileges.\n \nExample\n \nALTER PROCEDURE simpleproc SQL SECURITY INVOKER;\n \n\n\nURL: https://mariadb.com/kb/en/library/alter-procedure/','','https://mariadb.com/kb/en/library/alter-procedure/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (646,39,'ALTER SERVER','Syntax\n------ \nALTER SERVER server_name\n OPTIONS (option [, option] ...)\n \nDescription\n----------- \nAlters the server information for server_name, adjusting the\nspecified\noptions as per the CREATE SERVER command. The corresponding\nfields in the mysql.servers table are updated accordingly.\nThis statement requires the SUPER privilege.\n \nExamples\n-------- \nALTER SERVER s OPTIONS (USER \'sally\');\n \n\n\nURL: https://mariadb.com/kb/en/library/alter-server/','','https://mariadb.com/kb/en/library/alter-server/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (647,39,'ALTER TABLE','Syntax\n------ \nALTER [ONLINE] [IGNORE] TABLE tbl_name\n [WAIT n | NOWAIT]\n alter_specification [, alter_specification] ...\n \nalter_specification:\n table_option ...\n | ADD [COLUMN] [IF NOT EXISTS] col_name column_definition\n [FIRST | AFTER col_name ]\n | ADD [COLUMN] [IF NOT EXISTS] (col_name\ncolumn_definition,...)\n | ADD {INDEX|KEY} [IF NOT EXISTS] [index_name]\n [index_type] (index_col_name,...) [index_option] ...\n | ADD [CONSTRAINT [symbol]] PRIMARY KEY\n [index_type] (index_col_name,...) [index_option] ...\n | ADD [CONSTRAINT [symbol]]\n UNIQUE [INDEX|KEY] [index_name]\n [index_type] (index_col_name,...) [index_option] ...\n | ADD FULLTEXT [INDEX|KEY] [index_name]\n (index_col_name,...) [index_option] ...\n | ADD SPATIAL [INDEX|KEY] [index_name]\n (index_col_name,...) [index_option] ...\n | ADD [CONSTRAINT [symbol]]\n FOREIGN KEY [IF NOT EXISTS] [index_name]\n(index_col_name,...)\n reference_definition\n | ADD PERIOD FOR SYSTEM_TIME (start_column_name,\nend_column_name)\n | ALTER [COLUMN] col_name SET DEFAULT literal\n| (expression)\n | ALTER [COLUMN] col_name DROP DEFAULT\n | CHANGE [COLUMN] [IF EXISTS] old_col_name new_col_name\ncolumn_definition\n [FIRST|AFTER col_name]\n | MODIFY [COLUMN] [IF EXISTS] col_name column_definition\n [FIRST | AFTER col_name]\n | DROP [COLUMN] [IF EXISTS] col_name [RESTRICT|CASCADE]\n | DROP PRIMARY KEY\n | DROP {INDEX|KEY} [IF EXISTS] index_name\n | DROP FOREIGN KEY [IF EXISTS] fk_symbol\n | DROP CONSTRAINT [IF EXISTS] constraint_name\n | DISABLE KEYS\n | ENABLE KEYS\n | RENAME [TO] new_tbl_name\n | ORDER BY col_name [, col_name] ...\n | CONVERT TO CHARACTER SET charset_name [COLLATE\ncollation_name]\n | [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n | DISCARD TABLESPACE\n | IMPORT TABLESPACE\n | ALGORITHM [=] {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT}\n | LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}\n | FORCE\n | partition_options\n | ADD PARTITION (partition_definition)\n | DROP PARTITION partition_names\n | COALESCE PARTITION number\n | REORGANIZE PARTITION [partition_names INTO\n(partition_definitions)]\n | ANALYZE PARTITION partition_names\n | CHECK PARTITION partition_names\n | OPTIMIZE PARTITION partition_names\n | REBUILD PARTITION partition_names\n | REPAIR PARTITION partition_names\n | EXCHANGE PARTITION partition_name WITH TABLE tbl_name\n | REMOVE PARTITIONING\n | ADD SYSTEM VERSIONING\n | DROP SYSTEM VERSIONING\n \nindex_col_name:\n col_name [(length)] [ASC | DESC]\n \nindex_type:\n USING {BTREE | HASH | RTREE}\n \nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n | CLUSTERING={YES| NO}\n \ntable_options:\n table_option [[,] table_option] ...\nIn MariaDB 10.0.2 and later, IF EXISTS and IF NOT EXISTS\nclauses have been added for the following:\n \nADD COLUMN [IF NOT EXISTS]\nADD INDEX [IF NOT EXISTS]\nADD FOREIGN KEY [IF NOT EXISTS]\nADD PARTITION [IF NOT EXISTS]\nCREATE INDEX [IF NOT EXISTS]\n \nDROP COLUMN [IF EXISTS]\nDROP INDEX [IF EXISTS]\nDROP FOREIGN KEY [IF EXISTS]\nDROP PARTITION [IF EXISTS]\nCHANGE COLUMN [IF EXISTS]\nMODIFY COLUMN [IF EXISTS]\nDROP INDEX [IF EXISTS]\nWhen IF EXISTS and IF NOT EXISTS are used in clauses,\nqueries will not\nreport errors when the condition is triggered for that\nclause. A warning with\nthe same message text will be issued and the ALTER will move\non to the next\nclause in the statement (or end if finished).\n \nThis was done in MDEV-318.\n \nDescription\n----------- \nALTER TABLE enables you to change the structure of an\nexisting table.\nFor example, you can add or delete columns, create or\ndestroy indexes,\nchange the type of existing columns, or rename columns or\nthe table\nitself. You can also change the comment for the table and\nthe storage engine of the\ntable.\n \nIf another connection is using the table, a metadata lock is\nactive, and this statement will wait until the lock is\nreleased. This is also true for non-transactional tables.\n \nWhen adding a UNIQUE index on a column (or a set of columns)\nwhich have duplicated values, an error will be produced and\nthe statement will be stopped. To suppress the error and\nforce the creation of UNIQUE indexes, discarding duplicates,\nthe IGNORE option can be specified. This can be useful if a\ncolumn (or a set of columns) should be UNIQUE but it\ncontains duplicate values; however, this technique provides\nno control on which rows are preserved and which are\ndeleted. Also, note that IGNORE is accepted but ignored in\nALTER TABLE ... EXCHANGE PARTITION statements.\n \nThis statement can also be used to rename a table. For\ndetails see RENAME TABLE.\n \nWhen an index is created, the storage engine may use a\nconfigurable buffer in the process. Incrementing the buffer\nspeeds up the index creation. Aria and MyISAM allocate a\nbuffer whose size is defined by aria_sort_buffer_size or\nmyisam_sort_buffer_size, also used for REPAIR TABLE.\nInnoDB/XtraDB allocates three buffers whose size is defined\nby innodb_sort_buffer_size.\n \nPrivileges\n \nExecuting the ALTER TABLE statement generally requires at\nleast the ALTER privilege for the table or the database..\n \nIf you are renaming a table, then it also requires the DROP,\nCREATE and INSERT privileges for the table or the database\nas well.\n \nOnline DDL\n \nIn MariaDB 10.0 and later, online DDL is supported with the\nALGORITHM and LOCK clauses.\n \nSee InnoDB Online DDL Overview for more information on\nonline DDL with InnoDB.\n \nALTER ONLINE TABLE\n \nALTER ONLINE TABLE has also worked for partitioned tables\nsince MariaDB 10.0.11.\n \nOnline ALTER TABLE is available by executing the following:\n \nALTER ONLINE TABLE ...;\n \nThis statement has the following semantics:\n \nIn MariaDB 10.0.12 and later, this statement is equivalent\nto the following:\n \nALTER TABLE ... LOCK=NONE;\n \nSee the LOCK alter specification for more information.\n \nIn MariaDB 10.0.11, this statement is equivalent to the\nfollowing:\n \nALTER TABLE ... ALGORITHM=INPLACE;\n \nSee the ALGORITHM alter specification for more information.\n \nMariaDB until 10.0.10\n \nIn MariaDB 10.0.10 and before, this statement ensures that\nthe ALTER TABLE statement does not make a copy of the table.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nColumn Definitions\n \nSee CREATE TABLE: Column Definitions for information about\ncolumn definitions.\n \nIndex Definitions\n \nSee CREATE TABLE: Index Definitions for information about\nindex definitions.\n \nThe CREATE INDEX and DROP INDEX statements can also be used\nto add or remove an index.\n \nCharacter Sets and Collations\n \nCONVERT TO CHARACTER SET charset_name [COLLATE\ncollation_name]\n[DEFAULT] CHARACTER SET [=] charset_name\n[DEFAULT] COLLATE [=] collation_name\nSee Setting Character Sets and Collations for details on\nsetting the character sets and collations.\n \nAlter Specifications\n \nTable Options\n \nSee CREATE TABLE: Table Options for information about table\noptions.\n \nADD COLUMN\n \n... ADD COLUMN [IF NOT EXISTS] (col_name\ncolumn_definition,...)\nAdds a column to the table. The syntax is the same as in\nCREATE TABLE.\nIf you are using IF NOT_EXISTS the column will not be added\nif it was not there already. This is very useful when doing\nscripts to modify tables.\n \nThe FIRST and AFTER clauses affect the physical order of\ncolumns in the datafile. Use FIRST to add a column in the\nfirst (leftmost) position, or AFTER followed by a column\nname to add the new column in any other position. Note that,\nnowadays, the physical position of a column is usually\nirrelevant.\n \nSee also Instant ADD COLUMN for InnoDB.\n \nDROP COLUMN\n \n... DROP COLUMN [IF EXISTS] col_name [CASCADE|RESTRICT]\nDrops the column from the table.\nIf you are using IF EXISTS you will not get an error if the\ncolumn didn\'t exist.\nIf the column is part of any index, the column will be\ndropped from them, except if you add a new column with\nidentical name at the same time. The index will be dropped\nif all columns from the index were dropped.\nIf the column was used in a view or trigger, you will get an\nerror next time the view or trigger is accessed.\n \nDropping a column that is part of a multi-column UNIQUE\nconstraint is not permitted. For example:\n \nCREATE TABLE a (\n a int,\n b int,\n primary key (a,b)\n);\n \nALTER TABLE x DROP COLUMN a;\n[42000][1072] Key column \'A\' doesn\'t exist in table\n \nThe reason is that dropping column a would result in the new\nconstraint that all values in column b be unique. In order\nto drop the column, an explicit DROP PRIMARY KEY and ADD\nPRIMARY KEY would be required. Up until MariaDB 10.2.7, the\ncolumn was dropped and the additional constraint applied,\nresulting in the following structure:\n \nALTER TABLE x DROP COLUMN a;\nQuery OK, 0 rows affected (0.46 sec)\n \nDESC x;\n+-------+---------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+---------+------+-----+---------+-------+\n| b | int(11) | NO | PRI | NULL | |\n+-------+---------+------+-----+---------+-------+\n \nMariaDB 10.4.0 supports instant DROP COLUMN. DROP COLUMN of\nan indexed column would imply DROP INDEX (and in the case of\na non-UNIQUE multi-column index, possibly ADD INDEX). These\nwill not be allowed with ALGORITHM=INSTANT, but unlike\nbefore, they can be allowed with ALGORITHM=NOCOPY\n \nRESTRICT and CASCADE are allowed to make porting from other\ndatabase systems easier. In MariaDB, they do nothing.\n \nMODIFY COLUMN\n \nAllows you to modify the type of a column. The column will\nbe at the same place as the original column and all indexes\non the column will be kept. Note that when modifying column,\nyou should specify all attributes for the new column.\n \nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, PRIMARY\nKEY((a));\nALTER TABLE t1 MODIFY a BIGINT UNSIGNED AUTO_INCREMENT;\n \nCHANGE COLUMN\n \nWorks like MODIFY COLUMN except that you can also change the\nname of the column. The column will be at the same place as\nthe original column and all index on the column will be\nkept.\n \nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, PRIMARY\nKEY(a));\nALTER TABLE t1 CHANGE a b BIGINT UNSIGNED AUTO_INCREMENT;\n \nALTER COLUMN\n \nThis lets you change column options.\n \nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, b\nvarchar(50), PRIMARY KEY(a));\nALTER TABLE t1 ALTER b SET DEFAULT \'hello\';\n \nADD PRIMARY KEY\n \nAdd a primary key.\n \nFor PRIMARY KEY indexes, you can specify a name for the\nindex, but it is silently ignored, and the name of the index\nis always PRIMARY.\n \nSee Getting Started with Indexes: Primary Key for more\ninformation.\n \nDROP PRIMARY KEY\n \nDrop a primary key.\n \nFor PRIMARY KEY indexes, you can specify a name for the\nindex, but it is silently ignored, and the name of the index\nis always PRIMARY.\n \nSee Getting Started with Indexes: Primary Key for more\ninformation.\n \nADD FOREIGN KEY\n \nAdd a foreign key.\n \nFor FOREIGN KEY indexes, a reference definition must be\nprovided.\n \nFor FOREIGN KEY indexes, you can specify a name for the\nconstraint, using the CONSTRAINT keyword. That name will be\nused in error messages.\n \nFirst, you have to specify the name of the target (parent)\ntable and a column or a column list which must be indexed\nand whose values must match to the foreign key\'s values.\nThe MATCH clause is accepted to improve the compatibility\nwith other DBMS\'s, but has no meaning in MariaDB. The ON\nDELETE and ON UPDATE clauses specify what must be done when\na DELETE (or a REPLACE) statements attempts to delete a\nreferenced row from the parent table, and when an UPDATE\nstatement attempts to modify the referenced foreign key\ncolumns in a parent table row, respectively. The following\noptions are allowed:\nRESTRICT: The delete/update operation is not performed. The\nstatement terminates with a 1451 error (SQLSTATE \'2300\').\nNO ACTION: Synonym for RESTRICT.\nCASCADE: The delete/update operation is performed in both\ntables.\nSET NULL: The update or delete goes ahead in the parent\ntable, and the corresponding foreign key fields in the child\ntable are set to NULL. (They must not be defined as NOT NULL\nfor this to succeed).\n \nMariaDB until 5.3\nSET DEFAULT: This option is currently implemented only for\nthe PBXT storage engine, which is disabled by default and no\nlonger maintained. It sets the child table\'s foreign key\nfields to their DEFAULT values when the referenced parent\ntable key entries are updated or deleted.\n \nIf either clause is omitted, the default behavior for the\nomitted clause is RESTRICT.\n \nSee Foreign Keys for more information.\n \nDROP FOREIGN KEY\n \nDrop a foreign key.\n \nSee Foreign Keys for more information.\n \nADD INDEX\n \nAdd a plain index.\n \nPlain indexes are regular indexes that are not unique, and\nare not acting as a primary key or a foreign key. They are\nalso not the \"specialized\" FULLTEXT or SPATIAL indexes.\n \nSee Getting Started with Indexes: Plain Indexes for more\ninformation.\n \nDROP INDEX\n \nDrop a plain index.\n \nPlain indexes are regular indexes that are not unique, and\nare not acting as a primary key or a foreign key. They are\nalso not the \"specialized\" FULLTEXT or SPATIAL indexes.\n \nSee Getting Started with Indexes: Plain Indexes for more\ninformation.\n \nADD UNIQUE INDEX\n \nAdd a unique index.\n \nThe UNIQUE keyword means that the index will not accept\nduplicated values, except for NULLs. An error will raise if\nyou try to insert duplicate values in a UNIQUE index.\n \nFor UNIQUE indexes, you can specify a name for the\nconstraint, using the CONSTRAINT keyword. That name will be\nused in error messages.\n \nSee Getting Started with Indexes: Unique Index for more\ninformation.\n \nDROP UNIQUE INDEX\n \nDrop a unique index.\n \nThe UNIQUE keyword means that the index will not accept\nduplicated values, except for NULLs. An error will raise if\nyou try to insert duplicate values in a UNIQUE index.\n \nFor UNIQUE indexes, you can specify a name for the\nconstraint, using the CONSTRAINT keyword. That name will be\nused in error messages.\n \nSee Getting Started with Indexes: Unique Index for more\ninformation.\n \nADD FULLTEXT INDEX\n \nAdd a FULLTEXT index.\n \nSee Full-Text Indexes for more information.\n \nDROP FULLTEXT INDEX\n \nDrop a FULLTEXT index.\n \nSee Full-Text Indexes for more information.\n \nADD SPATIAL INDEX\n \nAdd a SPATIAL index.\n \nSee SPATIAL INDEX for more information.\n \nDROP SPATIAL INDEX\n \nDrop a SPATIAL index.\n \nSee SPATIAL INDEX for more information.\n \nENABLE/ DISABLE KEYS\n \nDISABLE KEYS will disable all non unique keys for the table\nfor storage engines that support this (at least MyISAM and\nAria). This can be used to speed up inserts into empty\ntables.\n \nENABLE KEYS will enable all disabled keys.\n \nRENAME TO\n \nRenames the table. See also RENAME TABLE.\n \nADD CONSTRAINT\n \nModifies the table adding a constraint on a particular\ncolumn or columns.\n \nMariaDB 10.2.1 introduced new ways to define a constraint.\n \nNote: Before MariaDB 10.2.1, constraint expressions were\naccepted in syntax, but ignored.\n \nALTER TABLE table_name \nADD CONSTRAINT [constraint_name] CHECK(expression);\nBefore a row is inserted or updated, all constraints are\nevaluated in the order they are defined. If any constraint\nfails, then the row will not be updated. One can use most\ndeterministic functions in a constraint, including UDF\'s.\n \nCREATE TABLE account_ledger (\n id INT PRIMARY KEY AUTO_INCREMENT,\n transaction_name VARCHAR(100),\n credit_account VARCHAR(100),\n credit_amount INT,\n debit_account VARCHAR(100),\n debit_amount INT);\n \nALTER TABLE account_ledger \nADD CONSTRAINT is_balanced \n CHECK((debit_amount + credit_amount) = 0);\n \nThe constraint_name is optional. If you don\'t provide one\nin the ALTER TABLE statement, MariaDB auto-generates a name\nfor you. This is done so that you can remove it later using\nDROP CONSTRAINT clause.\n \nYou can disable all constraint expression checks by setting\nthe variable check_constraint_checks to OFF. You may find\nthis useful when loading a table that violates some\nconstraints that you want to later find and fix in SQL.\n \nTo view constraints on a table, query\ninformation_schema.TABLE_CONSTRAINTS:\n \nSELECT CONSTRAINT_NAME, TABLE_NAME, CONSTRAINT_TYPE \nFROM information_schema.TABLE_CONSTRAINTS\nWHERE TABLE_NAME = \'account_ledger\';\n \n+-----------------+----------------+-----------------+\n| CONSTRAINT_NAME | TABLE_NAME | CONSTRAINT_TYPE |\n+-----------------+----------------+-----------------+\n| is_balanced | account_ledger | CHECK |\n+-----------------+----------------+-----------------+\n \nDROP CONSTRAINT\n \nDROP CONSTRAINT for UNIQUE and FOREIGN KEY constraints was\nintroduced in MariaDB 10.2.22 and MariaDB 10.3.13.\n \nDROP CONSTRAINT for CHECK constraints was introduced in\nMariaDB 10.2.1\n \nModifies the table, removing the given constraint.\n \nALTER TABLE table_name\nDROP CONSTRAINT constraint_name;\n \nWhen you add a constraint to a table, whether through a\nCREATE TABLE or ALTER TABLE...ADD CONSTRAINT statement, you\ncan either set a constraint_name yourself, or allow MariaDB\nto auto-generate one for you. To view constraints on a\ntable, query information_schema.TABLE_CONSTRAINTS. For\ninstance,\n \nCREATE TABLE t (\n a INT,\n b INT,\n c INT,\n CONSTRAINT CHECK(a > b),\n CONSTRAINT check_equals CHECK(a = c)); \n \nSELECT CONSTRAINT_NAME, TABLE_NAME, CONSTRAINT_TYPE \nFROM information_schema.TABLE_CONSTRAINTS\nWHERE TABLE_NAME = \'t\';\n \n+-----------------+----------------+-----------------+\n| CONSTRAINT_NAME | TABLE_NAME | CONSTRAINT_TYPE |\n+-----------------+----------------+-----------------+\n| check_equals | t | CHECK |\n| CONSTRAINT_1 | t | CHECK |\n+-----------------+----------------+-----------------+\n \nTo remove a constraint from the table, issue an ALTER\nTABLE...DROP CONSTRAINT statement. For example,\n \nALTER TABLE t DROP CONSTRAINT is_unique;\n \nADD SYSTEM VERSIONING\n \nSystem-versioned tables was added in MariaDB 10.3.4.\n \nAdd system versioning.\n \nDROP SYSTEM VERSIONING\n \nSystem-versioned tables was added in MariaDB 10.3.4.\n \nDrop system versioning.\n \nADD PERIOD FOR SYSTEM_TIME\n \nSystem-versioned tables was added in MariaDB 10.3.4.\n \nFORCE\n \nALTER TABLE ... FORCE can force MariaDB to re-build the\ntable.\n \nIn MariaDB 5.5 and before, this could only be done by\nsetting the ENGINE table option to its old value. For\nexample, for an InnoDB table, one could execute the\nfollowing:\n \nALTER TABLE tab_name ENGINE = InnoDB;\n \nIn MariaDB 10.0 and later, the FORCE option can be used\ninstead. For example, :\n \nALTER TABLE tab_name FORCE;\n \nWith InnoDB, the table rebuild will only reclaim unused\nspace (i.e. the space previously used for deleted rows) if\nthe innodb_file_per_table system variable is set to ON. If\nthe system variable is OFF, then the space will not be\nreclaimed, but it will be-re-used for new data that\'s later\nadded.\n \nEXCHANGE PARTITION\n \nALTER TABLE ... EXCHANGE PARTITION was introduced in MariaDB\n10.0.4\n \nThis is used to exchange the tablespace files between a\npartition and another table.\n \nSee copying InnoDB\'s transportable tablespaces for more\ninformation.\n \nDISCARD TABLESPACE\n \nThis is used to discard an InnoDB table\'s tablespace.\n \nSee copying I','','https://mariadb.com/kb/en/library/alter-table/'); -update help_topic set description = CONCAT(description, 'nnoDB\'s transportable tablespaces for more\ninformation.\n \nIMPORT TABLESPACE\n \nThis is used to import an InnoDB table\'s tablespace. The\ntablespace should have been copied from its original server\nafter executing FLUSH TABLES FOR EXPORT.\n \nSee copying InnoDB\'s transportable tablespaces for more\ninformation.\n \nALTER TABLE ... IMPORT only applies to InnoDB tables. Most\nother popular storage engines, such as Aria and MyISAM, will\nrecognize their data files as soon as they\'ve been placed\nin the proper directory under the datadir, and no special\nDDL is required to import them.\n \nALGORITHM\n \nIn MariaDB 5.5 and before, ALTER TABLE operations required\nmaking a temporary copy of the table, which can be slow for\nlarge tables.\n \nIn MariaDB 10.0 and later, the ALTER TABLE statement\nsupports the ALGORITHM clause. This clause is one of the\nclauses that is used to implement online DDL. ALTER TABLE\nsupports several different algorithms. An algorithm can be\nexplicitly chosen for an ALTER TABLE operation by setting\nthe ALGORITHM clause. The supported values are:\nALGORITHM=DEFAULT - This implies the default behavior for\nthe specific statement, such as if no ALGORITHM clause is\nspecified.\nALGORITHM=COPY\nALGORITHM=INPLACE\nALGORITHM=NOCOPY - This was added in MariaDB 10.3.7.\nALGORITHM=INSTANT - This was added in MariaDB 10.3.7.\n \nSee InnoDB Online DDL Overview: ALGORITHM for information on\nhow the ALGORITHM clause affects InnoDB.\n \nALGORITHM=DEFAULT\n \nThe default behavior, which occurs if ALGORITHM=DEFAULT is\nspecified, or if ALGORITHM is not specified at all, usually\nonly makes a copy if the operation doesn\'t support being\ndone in-place at all. In this case, the most efficient\navailable algorithm will usually be used.\n \nHowever, in MariaDB 10.3.6 and before, if the value of the\nold_alter_table system variable is set to ON, then the\ndefault behavior is to perform ALTER TABLE operations by\nmaking a copy of the table using the old algorithm.\n \nIn MariaDB 10.3.7 and later, the old_alter_table system\nvariable is deprecated. Instead, the alter_algorithm system\nvariable defines the default algorithm for ALTER TABLE\noperations.\n \nALGORITHM=COPY\n \nALGORITHM=COPY was introduced in MariaDB 10.0 as the name\nfor the original ALTER TABLE algorithm.\n \nWhen ALGORITHM=INPLACE is set, MariaDB essentially does the\nfollowing operations:\n \n-- Create a temporary table with the new definition\nCREATE TEMPORARY TABLE tmp_tab (\n...\n);\n \n-- Copy the data from the original table\nINSERT INTO tmp_tab\n SELECT * FROM original_tab;\n \n-- Drop the original table\nDROP TABLE original_tab;\n \n-- Rename the temporary table, so that it replaces the\noriginal one\nRENAME TABLE tmp_tab TO original_tab;\n \nThis algorithm is very inefficient, but it is generic, so it\nworks for all storage engines.\n \nIf ALGORITHM=COPY is specified, then the copy algorithm will\nbe used even if it is not necessary. This can result in a\nlengthy table copy. If multiple ALTER TABLE operations are\nrequired that each require the table to be rebuilt, then it\nis best to specify all operations in a single ALTER TABLE\nstatement, so that the table is only rebuilt once.\n \nALGORITHM=INPLACE\n \nALGORITHM=INPLACE was introduced in MariaDB 10.0.\n \nALGORITHM=COPY can be incredibly slow, because the whole\ntable has to be copied and rebuilt. ALGORITHM=INPLACE was\nintroduced as a way to avoid this by performing operations\nin-place and avoiding the table copy and rebuild, when\npossible.\n \nWhen ALGORITHM=INPLACE is set, the underlying storage engine\nuses optimizations to perform the operation while avoiding\nthe table copy and rebuild. However, INPLACE is a bit of a\nmisnomer, since some operations may still require the table\nto be rebuilt for some storage engines. Regardless, several\noperations can be performed without a full copy of the table\nfor some storage engines.\n \nA more accurate name would have been ALGORITHM=ENGINE, where\nENGINE refers to an \"engine-specific\" algorithm.\n \nIf an ALTER TABLE operation supports ALGORITHM=INPLACE, then\nit can be performed using optimizations by the underlying\nstorage engine, but it may rebuilt.\n \nSee InnoDB Online DDL Operations with ALGORITHM=INPLACE for\nmore.\n \nALGORITHM=NOCOPY\n \nALGORITHM=NOCOPY was introduced in MariaDB 10.3.7.\n \nALGORITHM=INPLACE can sometimes be surprisingly slow in\ninstances where it has to rebuild the clustered index,\nbecause when the clustered index has to be rebuilt, the\nwhole table has to be rebuilt. ALGORITHM=NOCOPY was\nintroduced as a way to avoid this. \n \nIf an ALTER TABLE operation supports ALGORITHM=NOCOPY, then\nit can be performed without rebuilding the clustered index.\n \nIf ALGORITHM=NOCOPY is specified for an ALTER TABLE\noperation that does not support ALGORITHM=NOCOPY, then an\nerror will be raised. In this case, raising an error is\npreferable, if the alternative is for the operation to\nrebuild the clustered index, and perform unexpectedly\nslowly.\n \nSee InnoDB Online DDL Operations with ALGORITHM=NOCOPY for\nmore.\n \nALGORITHM=INSTANT\n \nALGORITHM=INSTANT was introduced in MariaDB 10.3.7.\n \nALGORITHM=INPLACE can sometimes be surprisingly slow in\ninstances where it has to modify data files.\nALGORITHM=INSTANT was introduced as a way to avoid this.\n \nIf an ALTER TABLE operation supports ALGORITHM=INSTANT, then\nit can be performed without modifying any data files.\n \nIf ALGORITHM=INSTANT is specified for an ALTER TABLE\noperation that does not support ALGORITHM=INSTANT, then an\nerror will be raised. In this case, raising an error is\npreferable, if the alternative is for the operation to\nmodify data files, and perform unexpectedly slowly.\n \nSee InnoDB Online DDL Operations with ALGORITHM=INSTANT for\nmore.\n \nLOCK\n \nIn MariaDB 10.0 and later, the ALTER TABLE statement\nsupports the LOCK clause. This clause is one of the clauses\nthat is used to implement online DDL. ALTER TABLE supports\nseveral different locking strategies. A locking strategy can\nbe explicitly chosen for an ALTER TABLE operation by setting\nthe LOCK clause. The supported values are:\nDEFAULT: Acquire the least restrictive lock on the table\nthat is supported for the specific operation. Permit the\nmaximum amount of concurrency that is supported for the\nspecific operation.\nNONE: Acquire no lock on the table. Permit all concurrent\nDML. If this locking strategy is not permitted for an\noperation, then an error is raised.\nSHARED: Acquire a read lock on the table. Permit read-only\nconcurrent DML. If this locking strategy is not permitted\nfor an operation, then an error is raised.\nEXCLUSIVE: Acquire a write lock on the table. Do not permit\nconcurrent DML.\n \nDifferent storage engines support different locking\nstrategies for different operations. If a specific locking\nstrategy is chosen for an ALTER TABLE operation, and that\ntable\'s storage engine does not support that locking\nstrategy for that specific operation, then an error will be\nraised.\n \nIf the LOCK clause is not explicitly set, then the operation\nuses LOCK=DEFAULT.\n \nALTER ONLINE TABLE is equivalent to LOCK=NONE. Therefore,\nthe ALTER ONLINE TABLE statement can be used to ensure that\nyour ALTER TABLE operation allows all concurrent DML.\n \nSee InnoDB Online DDL Overview: LOCK for information on how\nthe LOCK clause affects InnoDB.\n \nProgress Reporting\n \nMariaDB provides progress reporting for ALTER TABLE\nstatement for clients\nthat support the new progress reporting protocol. For\nexample, if you were using the mysql client, then the\nprogress report might look like this::\n \nALTER TABLE test ENGINE=Aria;\nStage: 1 of 2 \'copy to tmp table\' 46% of stage\n \nThe progress report is also shown in the output of the SHOW\nPROCESSLIST statement and in the contents of the\ninformation_schema.PROCESSLIST table.\n \nSee Progress Reporting for more information.\n \nAborting ALTER TABLE Operations\n \nIf an ALTER TABLE operation is being performed and the\nconnection is killed, the changes will be rolled back in a\ncontrolled manner. The rollback can be a slow operation as\nthe time it takes is relative to how far the operation has\nprogressed.\n \nAborting ALTER TABLE ... ALGORITHM=COPY was made faster by\nremoving excessive undo logging (MDEV-11415). This\nsignificantly shortens the time it takes to abort a running\nALTER TABLE operation.\n \nExamples\n-------- \nAdding a new column:\n \nALTER TABLE t1 ADD x INT;\n \nDropping a column:\n \nALTER TABLE t1 DROP x;\n \nModifying the type of a column:\n \nALTER TABLE t1 MODIFY x bigint unsigned;\n \nChanging the name and type of a column:\n \nALTER TABLE t1 CHANGE a b bigint unsigned auto_increment;\n \nCombining multiple clauses in a single ALTER TABLE\nstatement, separated by commas:\n \nALTER TABLE t1 DROP x, ADD x2 INT, CHANGE y y2 INT;\n \nChanging the storage engine:\n \nALTER TABLE t1 ENGINE = InnoDB;\n \nRebuilding the table (the previous example will also rebuild\nthe table if it was already InnoDB):\n \nALTER TABLE t1 FORCE;\n \n\n\nURL: https://mariadb.com/kb/en/library/alter-table/') WHERE help_topic_id = 647; -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (648,39,'ALTER TABLESPACE','The ALTER TABLESPACE statement is not supported by MariaDB.\nIt was originally inherited from MySQL NDB Cluster. In MySQL\n5.7 and later, the statement is also supported for InnoDB.\nHowever, MariaDB has chosen not to include that specific\nfeature. See MDEV-19294 for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/alter-tablespace/','','https://mariadb.com/kb/en/library/alter-tablespace/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (649,39,'ALTER VIEW','Syntax\n------ \nALTER\n [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]\n [DEFINER = { user | CURRENT_USER }]\n [SQL SECURITY { DEFINER | INVOKER }]\n VIEW view_name [(column_list)]\n AS select_statement\n [WITH [CASCADED | LOCAL] CHECK OPTION]\n \nDescription\n----------- \nThis statement changes the definition of a view, which must\nexist. The\nsyntax is similar to that for CREATE VIEW and the effect is\nthe same\nas for CREATE OR REPLACE VIEW if the view exists. This\nstatement\nrequires the CREATE VIEW and DROP privileges for the view,\nand some\nprivilege for each column referred to in the SELECT\nstatement. As of\nMariaDB 5.1.23, ALTER VIEW is allowed only to the definer or\nusers with\nthe SUPER privilege.\n \nExample\n \nALTER VIEW v AS SELECT a, a*3 AS a2 FROM t;\n \n\n\nURL: https://mariadb.com/kb/en/library/alter-view/','','https://mariadb.com/kb/en/library/alter-view/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (650,39,'CONSTRAINT','MariaDB supports the implementation of constraints at the\ntable-level using either CREATE TABLE or ALTER TABLE\nstatements. A table constraint restricts the data you can\nadd to the table. If you attempt to insert invalid data on a\ncolumn, MariaDB throws an error. \n \nSyntax\n------ \n[CONSTRAINT [symbol]] constraint_expression\n \nconstraint_expression:\n | PRIMARY KEY [index_type] (index_col_name, ...)\n[index_option] ...\n | FOREIGN KEY [index_name] (index_col_name, ...) \n REFERENCES tbl_name (index_col_name, ...)\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n | UNIQUE [INDEX|KEY] [index_name]\n [index_type] (index_col_name, ...) [index_option] ...\n | CHECK (check_constraints)\n \nindex_type:\n USING {BTREE | HASH | RTREE}\n \nindex_col_name:\n col_name [(length)] [ASC | DESC]\n \nindex_option:\n | KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n | CLUSTERING={YES|NO}\n \nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT\n \nDescription\n----------- \nConstraints provide restrictions on the data you can add to\na table. This allows you to enforce data integrity from\nMariaDB, rather than through application logic. When a\nstatement violates a constraint, MariaDB throws an error.\n \nThere are four types of table constraints:\n \nConstraint | Description | \n \nPRIMARY KEY | Sets the column for referencing rows. Values\nmust be unique and not null. | \n \nFOREIGN KEY | Sets the column to reference the primary key\non another table. | \n \nUNIQUE | Requires values in column or columns only occur\nonce in the table. | \n \nCHECK | Checks whether the data meets the given condition. |\n\n \nFOREIGN KEY Constraints\n \nInnoDB supports foreign key constraints. The syntax for a\nforeign key\nconstraint definition in InnoDB looks like this:\n \n[CONSTRAINT [symbol]] FOREIGN KEY\n [index_name] (index_col_name, ...)\n REFERENCES tbl_name (index_col_name,...)\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n \nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n \nCHECK Constraints\n \nFrom MariaDB 10.2.1, constraints are enforced. Before\nMariaDB 10.2.1 constraint expressions were accepted in the\nsyntax but ignored.\n \nIn MariaDB 10.2.1 you can define constraints in 2 different\nways:\nCHECK(expression) given as part of a column definition.\nCONSTRAINT [constraint_name] CHECK (expression)\n \nBefore a row is inserted or updated, all constraints are\nevaluated in the order they are defined. If any constraint\nexpression returns false, then the row will not be inserted\nor updated.\nOne can use most deterministic functions in a constraint,\nincluding UDFs.\n \nCREATE TABLE t1 (a INT CHECK (a>2), b INT CHECK (b>2),\nCONSTRAINT a_greater CHECK (a>b));\n \nIf you use the second format and you don\'t give a name to\nthe constraint, then the constraint will get an\nautomatically generated name. This is done so that you can\nlater delete the constraint with ALTER TABLE DROP\nconstraint_name.\n \nOne can disable all constraint expression checks by setting\nthe check_constraint_checks variable to OFF. This is useful\nfor example when loading a table that violates some\nconstraints that you want to later find and fix in SQL.\n \nReplication\n \nIn row-based replication, only the master checks\nconstraints, and failed statements will not be replicated.\nIn statement-based replication, the slaves will also check\nconstraints. Constraints should therefore be identical, as\nwell as deterministic, in a replication environment.\n \nAuto_increment\n \nFrom MariaDB 10.2.6, auto_increment columns are no longer\npermitted in check constraints. Previously they were\npermitted, but would not work correctly. See MDEV-11117.\n \nExamples\n-------- \nCREATE TABLE product (category INT NOT NULL, id INT NOT\nNULL,\n price DECIMAL,\n PRIMARY KEY(category, id)) ENGINE=INNODB;\n \nCREATE TABLE customer (id INT NOT NULL,\n PRIMARY KEY (id)) ENGINE=INNODB;\n \nCREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT,\n product_category INT NOT NULL,\n product_id INT NOT NULL,\n customer_id INT NOT NULL,\n PRIMARY KEY(no),\n INDEX (product_category, product_id),\n FOREIGN KEY (product_category, product_id)\n REFERENCES product(category, id)\n ON UPDATE CASCADE ON DELETE RESTRICT,\n INDEX (customer_id),\n FOREIGN KEY (customer_id)\n REFERENCES customer(id)) ENGINE=INNODB;\n \nThe following examples will work from MariaDB 10.2.1\nonwards.\n \nNumeric constraints and comparisons:\n \nCREATE TABLE t1 (a INT CHECK (a>2), b INT CHECK (b>2),\nCONSTRAINT a_greater CHECK (a>b));\n \nINSERT INTO t1(a) VALUES (1);\nERROR 4022 (23000): CONSTRAINT `a` failed for `test`.`t1`\n \nINSERT INTO t1(a,b) VALUES (3,4);\nERROR 4022 (23000): CONSTRAINT `a_greater` failed for\n`test`.`t1`\n \nINSERT INTO t1(a,b) VALUES (4,3);\nQuery OK, 1 row affected (0.04 sec)\n \nDropping a constraint:\n \nALTER TABLE t1 DROP CONSTRAINT a_greater;\n \nAdding a constraint:\n \nALTER TABLE t1 ADD CONSTRAINT a_greater CHECK (a>b);\n \nDate comparisons and character length:\n \nCREATE TABLE t2 (name VARCHAR(30) CHECK\n(CHAR_LENGTH(name)>2), start_date DATE, \n end_date DATE CHECK (start_date IS NULL OR end_date IS NULL\nOR start_date2)), start_date DATE, \n end_date DATE CHECK (start_date IS NULL OR end_date IS NULL\nOR start_date2 is very different to CHAR_LENGTH(name>2) as\nthe latter mistakenly performs a numeric comparison on the\nname field, leading to unexpected results.\n \n\n\nURL: https://mariadb.com/kb/en/library/constraint/','','https://mariadb.com/kb/en/library/constraint/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (651,39,'CREATE DATABASE','Syntax\n------ \nCREATE [OR REPLACE] {DATABASE | SCHEMA} [IF NOT EXISTS]\ndb_name\n [create_specification] ...\n \ncreate_specification:\n [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n \nDescription\n----------- \nCREATE DATABASE creates a database with the given name. To\nuse this statement, you need the CREATE privilege for the\ndatabase. CREATE SCHEMA is a synonym for CREATE DATABASE.\n \nFor valid identifiers to use as database names, see\nIdentifier Names.\n \nOR REPLACE\n \nThe OR REPLACE clause was added in MariaDB 10.1.3\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP DATABASE IF EXISTS db_name;\n \nCREATE DATABASE db_name ...;\n \nIF NOT EXISTS\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the specified database\nalready exists.\n \nExamples\n-------- \nCREATE DATABASE db1;\n \nQuery OK, 1 row affected (0.18 sec)\n \nCREATE DATABASE db1;\n \nERROR 1007 (HY000): Can\'t create database \'db1\'; database\nexists\n \nCREATE OR REPLACE DATABASE db1;\nQuery OK, 2 rows affected (0.00 sec)\n \nCREATE DATABASE IF NOT EXISTS db1;\nQuery OK, 1 row affected, 1 warning (0.01 sec)\n \nSHOW WARNINGS;\n+-------+------+----------------------------------------------+\n| Level | Code | Message |\n+-------+------+----------------------------------------------+\n| Note | 1007 | Can\'t create database \'db1\';\n database exists |\n+-------+------+----------------------------------------------+\n \nSetting the character sets and collation. See Setting\nCharacter Sets and Collations for more details.\n \nCREATE DATABASE czech_slovak_names \n CHARACTER SET = \'keybcs2\'\n COLLATE = \'keybcs2_bin\';\n \n\n\nURL: https://mariadb.com/kb/en/library/create-database/','','https://mariadb.com/kb/en/library/create-database/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (652,39,'CREATE EVENT','Syntax\n------ \nCREATE [OR REPLACE]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n EVENT \n [IF NOT EXISTS]\n event_name \n ON SCHEDULE schedule\n [ON COMPLETION [NOT] PRESERVE]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n DO sql_statement;\n \nschedule:\n AT timestamp [+ INTERVAL interval] ...\n | EVERY interval \n [STARTS timestamp [+ INTERVAL interval] ...] \n [ENDS timestamp [+ INTERVAL interval] ...]\n \ninterval:\n quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE |\n WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE |\n DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND}\n \nDescription\n----------- \nThis statement creates and schedules a new event. It\nrequires the\nEVENT privilege for the schema in which the event is to be\ncreated.\n \nThe minimum requirements for a valid CREATE EVENT statement\nare as\nfollows:\nThe keywords CREATE EVENT plus an event name, which uniquely\nidentifies\n the event in the current schema. (Prior to MySQL 5.1.12,\nthe event name\n needed to be unique only among events created by the same\nuser on a given\n database.)\nAn ON SCHEDULE clause, which determines when and how often\nthe event\n executes.\nA DO clause, which contains the SQL statement to be executed\nby an\n event.\n \nHere is an example of a minimal CREATE EVENT statement:\n \nCREATE EVENT myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\n \nThe previous statement creates an event named myevent. This\nevent executes once\n— one hour following its creation\n— by running an SQL statement that increments the\nvalue of the myschema.mytable table\'s mycol column by 1.\n \nThe event_name must be a valid MariaDB identifier with a\nmaximum length\nof 64 characters. It may be delimited using back ticks, and\nmay be\nqualified with the name of a database schema. An event is\nassociated\nwith both a MariaDB user (the definer) and a schema, and its\nname must\nbe unique among names of events within that schema. In\ngeneral, the\nrules governing event names are the same as those for names\nof stored\nroutines. See Identifier Names.\n \nIf no schema is indicated as part of event_name, the default\n(current)\nschema is assumed.\n \nFor valid identifiers to use as event names, see Identifier\nNames.\n \nOR REPLACE\n \nThe OR REPLACE clause was included in MariaDB 10.1.4. If\nused and the event already exists, instead of an error being\nreturned, the existing event will be dropped and replaced by\nthe newly defined event.\n \nIF NOT EXISTS\n \nIf the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the event already exists.\nCannot be used together with OR REPLACE.\n \nON SCHEDULE\n \nThe ON SCHEDULE clause can be used to specify when the event\nmust be triggered.\n \nAT\n \nIf you want to execute the event only once (one time event),\nyou can use the AT keyword, followed by a timestamp. If you\nuse CURRENT_TIMESTAMP, the event acts as soon as it is\ncreated. As a convenience, you can add one or more intervals\nto that timestamp. You can also specify a timestamp in the\npast, so that the event is stored but not triggered, until\nyou modify it via ALTER EVENT.\n \nThe following example shows how to create an event that will\nbe triggered tomorrow at a certain time:\n \nCREATE EVENT example\nON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY + INTERVAL\n3 HOUR\nDO something;\n \nYou can also specify that an event must be triggered at a\nregular interval (recurring event). In such cases, use the\nEVERY clause followed by the interval.\n \nIf an event is recurring, you can specify when the first\nexecution must happen via the STARTS clause and a maximum\ntime for the last execution via the ENDS clause. STARTS and\nENDS clauses are followed by a timestamp and, optionally,\none or more intervals. The ENDS clause can specify a\ntimestamp in the past, so that the event is stored but not\nexecuted until you modify it via ALTER EVENT.\n \nIn the following example, next month a recurring event will\nbe triggered hourly for a week:\n \nCREATE EVENT example\nON SCHEDULE EVERY 1 HOUR\nSTARTS CURRENT_TIMESTAMP + INTERVAL 1 MONTH\nENDS CURRENT_TIMESTAMP + INTERVAL 1 MONTH + INTERVAL 1 WEEK\nDO some_task;\n \nIntervals consist of a quantity and a time unit. The time\nunits are the same used for other staments and time\nfunctions, except that you can\'t use microseconds for\nevents. For simple time units, like HOUR or MINUTE, the\nquantity is an integer number, for example \'10 MINUTE\'.\nFor composite time units, like HOUR_MINUTE or HOUR_SECOND,\nthe quantity must be a string with all involved simple\nvalues and their separators, for example \'2:30\' or\n\'2:30:30\'.\n \nON COMPLETION [NOT] PRESERVE\n \nThe ON COMPLETION clause can be used to specify if the event\nmust be deleted after its last execution (that is, after its\nAT or ENDS timestamp is past). By default, events are\ndropped when they are expired. To explicitly state that this\nis the desired behaviour, you can use ON COMPLETION NOT\nPRESERVE. Instead, if you want the event to be preserved,\nyou can use ON COMPLETION PRESERVE.\n \nIn you specify ON COMPLETION NOT PRESERVE, and you specify a\ntimestamp in the past for AT or ENDS clause, the event will\nbe immediatly dropped. In such cases, you will get a Note\n1558: \"Event execution time is in the past and ON\nCOMPLETION NOT PRESERVE is set. The event was dropped\nimmediately after creation\".\n \nENABLE/DISABLE/DISABLE ON SLAVE\n \nEvents are ENABLEd by default. If you want to stop MariaDB\nfrom executing\nan event, you may specify DISABLE. When it is ready to be\nactivated, you\nmay enable it using ALTER EVENT. Another option is\nDISABLE ON SLAVE, which indicates that an event was created\non a master and has been replicated to the slave, which is\nprevented from executing the event. If DISABLE ON SLAVE is\nspecifically set, the event will not be executed.\n \nCOMMENT\n \nThe COMMENT clause may be used to set a comment for the\nevent. Maximum\nlength for comments is 64 characters. The comment is a\nstring, so it must be\nquoted. To see events comments, you can query the\nINFORMATION_SCHEMA.EVENTS table (the column is named\nEVENT_COMMENT).\n \nExamples\n-------- \nMinimal CREATE EVENT statement:\n \nCREATE EVENT myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\n \nAn event that will be triggered tomorrow at a certain time:\n \nCREATE EVENT example\nON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY + INTERVAL\n3 HOUR\nDO something;\n \nNext month a recurring event will be triggered hourly for a\nweek:\n \nCREATE EVENT example\nON SCHEDULE EVERY 1 HOUR\nSTARTS CURRENT_TIMESTAMP + INTERVAL 1 MONTH\nENDS CURRENT_TIMESTAMP + INTERVAL 1 MONTH + INTERVAL 1 WEEK\nDO some_task;\n \nOR REPLACE and IF NOT EXISTS:\n \nCREATE EVENT myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\n \nERROR 1537 (HY000): Event \'myevent\' already exists\n \nCREATE OR REPLACE EVENT myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;;\nQuery OK, 0 rows affected (0.00 sec)\n \nCREATE EVENT IF NOT EXISTS myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \n SHOW WARNINGS;\n \n+-------+------+--------------------------------+\n| Level | Code | Message |\n+-------+------+--------------------------------+\n| Note | 1537 | Event \'myevent\' already exists |\n+-------+------+--------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/create-event/','','https://mariadb.com/kb/en/library/create-event/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (653,39,'CREATE FUNCTION','Syntax\n------ \nCREATE [OR REPLACE]\n [DEFINER = {user | CURRENT_USER | role | CURRENT_ROLE }]\n [AGGREGATE] FUNCTION [IF NOT EXISTS] func_name\n([func_parameter[,...]])\n RETURNS type\n [characteristic ...]\n RETURN func_body\n \nfunc_parameter:\n param_name type\n \ntype:\n Any valid MariaDB data type\n \ncharacteristic:\n LANGUAGE SQL\n | [NOT] DETERMINISTIC\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL\nDATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n \nfunc_body:\n Valid SQL procedure statement\n \nDescription\n----------- \nUse the CREATE FUNCTION statement to create a new stored\nfunction. You must have\nthe CREATE ROUTINE database privilege to use CREATE\nFUNCTION.\nA function takes any number of arguments and returns a value\nfrom the function body. The\nfunction body can be any valid SQL expression as you would\nuse, for example, in any select\nexpression. If you have the appropriate privileges, you can\ncall the function exactly as you\nwould any built-in function. See Security below for details\non privileges.\n \nYou can also use a variant of the CREATE FUNCTION statement\nto install a user-defined\nfunction (UDF) defined by a plugin. See CREATE FUNCTION\n(UDF)\nfor details.\n \nYou can use a SELECT statement for the function body by\nenclosing it in\nparentheses, exactly as you would to use a subselect for any\nother expression. The SELECT\nstatement must return a single value. If more than one\ncolumn is returned when the function is called,\nerror 1241 results. If more than one row is returned when\nthe function is called, error 1242\nresults. Use a LIMIT clause to ensure only one row is\nreturned.\n \nYou can also replace the RETURN clause with a BEGIN...END\ncompound\nstatement. The compound statement must contain a RETURN\nstatement. When the function is\ncalled, the RETURN statement immediately returns its result,\nand any statements after RETURN\nare effectively ignored.\n \nBy default, a function is associated with the default\ndatabase. To associate the function explicitly\nwith a given database, specify the fully-qualified name as\ndb_name.func_name\nwhen you create it. If the function name is the same as the\nname of a built-in function, you must\nuse the fully qualified name when you call it.\n \nThe parameter list enclosed within parentheses must always\nbe present.\nIf there are no parameters, an empty parameter list of ()\nshould be\nused. Parameter names are not case sensitive.\n \nEach parameter can be declared to use any valid data type,\nexcept that\nthe COLLATE attribute cannot be used.\n \nFor valid identifiers to use as function names, see\nIdentifier Names.\n \nAGGREGATE\n \nFrom MariaDB 10.3.3, it is possible to create stored\naggregate functions as well. See Stored Aggregate Functions\nfor details.\n \nRETURNS\n \nThe RETURNS clause specifies the return type of the\nfunction. NULL values are permitted with all return types.\n \nWhat happens if the RETURN clause returns a value of a\ndifferent type? It depends on the SQL_MODE in effect at the\nmoment of the function creation.\n \nIf the SQL_MODE is strict (STRICT_ALL_TABLES or\nSTRICT_TRANS_TABLES flags are specified), a 1366 error will\nbe produced.\n \nOtherwise, the value is coerced to the proper type. For\nexample, if a function\nspecifies an ENUM or SET value in the RETURNS clause, but\nthe RETURN\nclause returns an integer, the value returned from the\nfunction is the string for the corresponding ENUM\nmember of set of SET members.\n \nMariaDB stores the SQL_MODE system variable setting that is\nin effect at the\ntime a routine is created, and always executes the routine\nwith this setting in\nforce, regardless of the server SQL mode in effect when the\nroutine is invoked.\n \nLANGUAGE SQL\n \nLANGUAGE SQL is a standard SQL clause, and it can be used in\nMariaDB for portability. However that clause has no meaning,\nbecause SQL is the only supported language for stored\nfunctions.\n \nA function is deterministic if it can produce only one\nresult for a given list of parameters. If the result may be\naffected by stored data, server variables, random numbers or\nany value that is not explicitly passed, then the function\nis not deterministic. Also, a function is non-deterministic\nif it uses non-deterministic functions like NOW() or\nCURRENT_TIMESTAMP(). The optimizer may choose a faster\nexecution plan if it known that the function is\ndeterministic. In such cases, you should declare the routine\nusing the DETERMINISTIC keyword. If you want to explicitly\nstate that the function is not deterministic (which is the\ndefault) you can use the NOT DETERMINISTIC keywords.\n \nIf you declare a non-deterministic function as\nDETERMINISTIC, you may get incorrect results. If you declare\na deterministic function as NOT DETERMINISTIC, in some cases\nthe queries will be slower.\n \nOR REPLACE\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP FUNCTION IF EXISTS function_name;\n \nCREATE FUNCTION function_name ...;\n \nwith the exception that any existing privileges for the\nfunction are not dropped.\n \nIF NOT EXISTS\n \nIf the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the function already exists.\nCannot be used together with OR REPLACE.\n \n[NOT] DETERMINISTIC\n \nThe [NOT] DETERMINISTIC clause also affects binary logging,\nbecause the STATEMENT format can not be used to store or\nreplicate non-deterministic statements.\n \nCONTAINS SQL, NO SQL, READS SQL DATA, and MODIFIES SQL DATA\nare informative clauses that tell the server what the\nfunction does. MariaDB does not check in any way whether the\nspecified clause is correct. If none of these clauses are\nspecified, CONTAINS SQL is used by default.\n \nMODIFIES SQL DATA\n \nMODIFIES SQL DATA means that the function contains\nstatements that may modify data stored in databases. This\nhappens if the function contains statements like DELETE,\nUPDATE, INSERT, REPLACE or DDL.\n \nREADS SQL DATA\n \nREADS SQL DATA means that the function reads data stored in\ndatabases, but does not modify any data. This happens if\nSELECT statements are used, but there no write operations\nare executed.\n \nCONTAINS SQL\n \nCONTAINS SQL means that the function contains at least one\nSQL statement, but it does not read or write any data stored\nin a database. Examples include SET or DO.\n \nNO SQL\n \nNO SQL means nothing, because MariaDB does not currently\nsupport any language other than SQL.\n \nOracle Mode\n \nFrom MariaDB 10.3, a subset of Oracle\'s PL/SQL language has\nbeen supported in addition to the traditional SQL/PSM-based\nMariaDB syntax. See Oracle mode from MariaDB 10.3 for\ndetails on changes when running Oracle mode.\n \nSecurity\n \nYou must have the EXECUTE privilege on a function to call\nit.\nMariaDB automatically grants the EXECUTE and ALTER ROUTINE\nprivileges to the\naccount that called CREATE FUNCTION, even if the DEFINER\nclause was used.\n \nEach function has an account associated as the definer. By\ndefault, the definer is the account\nthat created the function. Use the DEFINER clause to specify\na different account as the\ndefiner. You must have the SUPER privilege to use the\nDEFINER\nclause. See Account Names for details on specifying\naccounts.\n \nThe SQL SECURITY clause specifies what privileges are used\nwhen a function is called.\nIf SQL SECURITY is INVOKER, the function body will be\nevaluated using the privileges\nof the user calling the function. If SQL SECURITY is\nDEFINER, the function body is\nalways evaluated using the privileges of the definer\naccount. DEFINER is the default.\n \nThis allows you to create functions that grant limited\naccess to certain data. For example, say\nyou have a table that stores some employee information, and\nthat you\'ve granted SELECT\nprivileges only on certain columns to the user account\nroger.\n \nCREATE TABLE employees (name TINYTEXT, dept TINYTEXT, salary\nINT);\nGRANT SELECT (name, dept) ON employees TO roger;\n \nTo allow the user the get the maximum salary for a\ndepartment, define a function and grant\nthe EXECUTE privilege:\n \nCREATE FUNCTION max_salary (dept TINYTEXT) RETURNS INT\nRETURN\n (SELECT MAX(salary) FROM employees WHERE employees.dept =\ndept);\nGRANT EXECUTE ON FUNCTION max_salary TO roger;\n \nSince SQL SECURITY defaults to DEFINER, whenever the user\nroger calls\nthis function, the subselect will execute with your\nprivileges. As long as you have privileges to\nselect the salary of each employee, the caller of the\nfunction will be able to get the maximum\nsalary for each department without being able to see\nindividual salaries.\n \nCharacter sets and collations\n \nFunction return types can be declared to use any valid\ncharacter set and collation. If used, the COLLATE attribute\nneeds to be preceded by a CHARACTER SET attribute.\n \nIf the character set and collation are not specifically set\nin the statement, the database defaults at the time of\ncreation will be used. If the database defaults change at a\nlater stage, the stored function character set/collation\nwill not be changed at the same time; the stored function\nneeds to be dropped and recreated to ensure the same\ncharacter set/collation as the database is used.\n \nExamples\n-------- \nThe following example function takes a parameter, performs\nan operation using\nan SQL function, and returns the result.\n \nCREATE FUNCTION hello (s CHAR(20))\n RETURNS CHAR(50) DETERMINISTIC\n RETURN CONCAT(\'Hello, \',s,\'!\');\n \nSELECT hello(\'world\');\n+----------------+\n| hello(\'world\') |\n+----------------+\n| Hello, world! |\n+----------------+\n \nYou can use a compound statement in a function to manipulate\ndata with statements\nlike INSERT and UPDATE. The following example creates a\ncounter function\nthat uses a temporary table to store the current value.\nBecause the compound statement\ncontains statements terminated with semicolons, you have to\nfirst change the statement\ndelimiter with the DELIMITER statement to allow the\nsemicolon to be used in the\nfunction body. See Delimiters in the mysql client for more.\n \nCREATE TEMPORARY TABLE counter (c INT);\nINSERT INTO counter VALUES (0);\nDELIMITER //\nCREATE FUNCTION counter () RETURNS INT\n BEGIN\n UPDATE counter SET c = c + 1;\n \n RETURN (SELECT c FROM counter LIMIT 1);\n END //\nDELIMITER ;\n \nCharacter set and collation:\n \nCREATE FUNCTION hello2 (s CHAR(20))\n RETURNS CHAR(50) CHARACTER SET \'utf8\' COLLATE\n\'utf8_bin\' DETERMINISTIC\n RETURN CONCAT(\'Hello, \',s,\'!\');\n \n\n\nURL: https://mariadb.com/kb/en/library/create-function/','','https://mariadb.com/kb/en/library/create-function/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (654,39,'CREATE INDEX','Syntax\n------ \nCREATE [OR REPLACE] [UNIQUE|FULLTEXT|SPATIAL] INDEX \n [IF NOT EXISTS] index_name\n [index_type]\n ON tbl_name (index_col_name,...)\n [WAIT n | NOWAIT]\n [index_option]\n [algorithm_option | lock_option] ...\n \nindex_col_name:\n col_name [(length)] [ASC | DESC]\n \nindex_type:\n USING {BTREE | HASH | RTREE}\n \nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n \nalgorithm_option:\n ALGORITHM [=] {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT}\n \nlock_option:\n LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}\n \nDescription\n----------- \nCREATE INDEX is mapped to an ALTER TABLE statement to create\nindexes.\nSee ALTER TABLE. CREATE INDEX cannot be used to create a\nPRIMARY KEY; use ALTER TABLE instead.\n \nIf another connection is using the table, a metadata lock is\nactive, and this statement will wait until the lock is\nreleased. This is also true for non-transactional tables.\n \nAnother shortcut, DROP INDEX, allows the removal of an\nindex.\n \nFor valid identifiers to use as index names, see Identifier\nNames.\n \nNote that KEY_BLOCK_SIZE is currently ignored in CREATE\nINDEX, although it is included in the output of SHOW CREATE\nTABLE.\n \nPrivileges\n \nExecuting the CREATE INDEX statement requires the INDEX\nprivilege for the table or the database.\n \nOnline DDL\n \nIn MariaDB 10.0 and later, online DDL is supported with the\nALGORITHM and LOCK clauses.\n \nSee InnoDB Online DDL Overview for more information on\nonline DDL with InnoDB.\n \nCREATE OR REPLACE INDEX ...\n \nThe OR REPLACE clause was added in MariaDB 10.1.4.\n \nIf the OR REPLACE clause is used and if the index already\nexists, then instead of returning an error, the server will\ndrop the existing index and replace it with the newly\ndefined index.\n \nCREATE INDEX IF NOT EXISTS ...\n \nIf the IF NOT EXISTS clause is used, then the index will\nonly be created if an index with the same name does not\nalready exist. If the index already exists, then a warning\nwill be triggered by default.\n \nIndex Definitions\n \nSee CREATE TABLE: Index Definitions for information about\nindex definitions.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nALGORITHM\n \nSee ALTER TABLE: ALGORITHM for more information.\n \nLOCK\n \nSee ALTER TABLE: LOCK for more information.\n \nProgress Reporting\n \nMariaDB provides progress reporting for CREATE INDEX\nstatement for clients\nthat support the new progress reporting protocol. For\nexample, if you were using the mysql client, then the\nprogress report might look like this::\n \nCREATE INDEX ON tab (num);;\nStage: 1 of 2 \'copy to tmp table\' 46% of stage\n \nThe progress report is also shown in the output of the SHOW\nPROCESSLIST statement and in the contents of the\ninformation_schema.PROCESSLIST table.\n \nSee Progress Reporting for more information.\n \nExamples\n-------- \nCreating a unique index:\n \nCREATE UNIQUE INDEX HomePhone ON Employees(Home_Phone);\n \nOR REPLACE and IF NOT EXISTS:\n \nCREATE INDEX xi ON xx5 (x);\nQuery OK, 0 rows affected (0.03 sec)\n \nCREATE INDEX xi ON xx5 (x);\nERROR 1061 (42000): Duplicate key name \'xi\'\n \nCREATE OR REPLACE INDEX xi ON xx5 (x);\nQuery OK, 0 rows affected (0.03 sec)\n \nCREATE INDEX IF NOT EXISTS xi ON xx5 (x);\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+-------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------+\n| Note | 1061 | Duplicate key name \'xi\' |\n+-------+------+-------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/create-index/','','https://mariadb.com/kb/en/library/create-index/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (655,39,'CREATE PACKAGE','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nCREATE\n [ OR REPLACE]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n PACKAGE [ IF NOT EXISTS ]\n [ db_name . ] package_name\n [ package_characteristic ... ]\n{ AS | IS }\n [ package_specification_element ... ]\nEND [ package_name ]\n \npackage_characteristic:\n COMMENT \'string\'\n | SQL SECURITY { DEFINER | INVOKER }\n \npackage_specification_element:\n FUNCTION_SYM package_specification_function ;\n | PROCEDURE_SYM package_specification_procedure ;\n \npackage_specification_function:\n func_name [ ( func_param [, func_param]... ) ]\n RETURNS func_return_type\n [ package_routine_characteristic... ]\n \npackage_specification_procedure:\n proc_name [ ( proc_param [, proc_param]... ) ]\n [ package_routine_characteristic... ]\n \nfunc_return_type:\n type\n \nfunc_param:\n param_name type\n \nproc_param:\n param_name { IN | OUT | INOUT | IN OUT } type\n \ntype:\n Any valid MariaDB explicit or anchored data type\n \npackage_routine_characteristic:\n COMMENT \'string\'\n | LANGUAGE SQL\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL\nDATA }\n | SQL SECURITY { DEFINER | INVOKER }\n \nDescription\n----------- \nThe CREATE PACKAGE statement can be used when Oracle\nSQL_MODE is set.\n \nThe CREATE PACKAGE creates the specification for a stored\npackage (a collection of logically related stored objects).\nA stored package specification declares public routines\n(procedures and functions) of the package, but does not\nimplement these routines.\n \nA package whose specification was created by the CREATE\nPACKAGE statement, should later be implemented using the\nCREATE PACKAGE BODY statement.\n \nExamples\n-------- \nSET sql_mode=ORACLE;\nDELIMITER $$\nCREATE OR REPLACE PACKAGE employee_tools AS\n FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);\n PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));\n PROCEDURE raiseSalaryStd(eid INT);\n PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));\nEND;\n$$\nDELIMITER ;\n \n\n\nURL: https://mariadb.com/kb/en/library/create-package/','','https://mariadb.com/kb/en/library/create-package/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (656,39,'CREATE PACKAGE BODY','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nCREATE [ OR REPLACE ]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n PACKAGE BODY\n [ IF NOT EXISTS ]\n [ db_name . ] package_name\n [ package_characteristic... ]\n{ AS | IS }\n package_implementation_declare_section\n package_implementation_executable_section\nEND [ package_name]\n \npackage_implementation_declare_section:\n package_implementation_item_declaration\n [ package_implementation_item_declaration... ]\n [ package_implementation_routine_definition... ]\n | package_implementation_routine_definition\n [ package_implementation_routine_definition...]\n \npackage_implementation_item_declaration:\n variable_declaration ;\n \nvariable_declaration:\n variable_name[,...] type [:= expr ]\n \npackage_implementation_routine_definition:\n FUNCTION package_specification_function\n [ package_implementation_function_body ] ;\n | PROCEDURE package_specification_procedure\n [ package_implementation_procedure_body ] ;\n \npackage_implementation_function_body:\n { AS | IS } package_routine_body [func_name]\n \npackage_implementation_procedure_body:\n { AS | IS } package_routine_body [proc_name]\n \npackage_routine_body:\n [ package_routine_declarations ]\n BEGIN\n statements [ EXCEPTION exception_handlers ]\n END\n \npackage_routine_declarations:\n package_routine_declaration \';\'\n[package_routine_declaration \';\']...\n \npackage_routine_declaration:\n variable_declaration\n | condition_name CONDITION FOR condition_value\n | user_exception_name EXCEPTION\n | CURSOR_SYM cursor_name\n [ ( cursor_formal_parameters ) ]\n IS select_statement\n ;\n \npackage_implementation_executable_section:\n END\n | BEGIN\n statement ; [statement ; ]...\n [EXCEPTION exception_handlers]\n END\n \nexception_handlers:\n exception_handler [exception_handler...]\n \nexception_handler:\n WHEN_SYM condition_value [, condition_value]...\n THEN_SYM statement ; [statement ;]...\n \ncondition_value:\n condition_name\n | user_exception_name\n | SQLWARNING\n | SQLEXCEPTION\n | NOT FOUND\n | OTHERS_SYM\n | SQLSTATE [VALUE] sqlstate_value\n | mariadb_error_code\n \n\nDescription\n----------- \nThe CREATE PACKAGE BODY statement can be used when Oracle\nSQL_MODE is set.\n \nThe CREATE PACKAGE BODY statement creates the package body\nfor a stored package. The package specification must be\npreviously created using the CREATE PACKAGE statement.\n \nA package body provides implementations of the package\npublic routines and can optionally have:\npackage-wide private variables\npackage private routines\nforward declarations for private routines\nan executable initialization section\n \nExamples\n-------- \nSET sql_mode=ORACLE;\nDELIMITER $$\nCREATE OR REPLACE PACKAGE employee_tools AS\n FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);\n PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));\n PROCEDURE raiseSalaryStd(eid INT);\n PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));\nEND;\n$$\nCREATE PACKAGE BODY employee_tools AS\n -- package body variables\n stdRaiseAmount DECIMAL(10,2):=500;\n \n -- private routines\n PROCEDURE log (eid INT, ecmnt TEXT) AS\n BEGIN\n INSERT INTO employee_log (id, cmnt) VALUES (eid, ecmnt);\n END;\n \n -- public routines\n PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2)) AS\n eid INT;\n BEGIN\n INSERT INTO employee (name, salary) VALUES (ename,\nesalary);\n eid:= last_insert_id();\n log(eid, \'hire \' || ename);\n END;\n \n FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2) AS\n nSalary DECIMAL(10,2);\n BEGIN\n SELECT salary INTO nSalary FROM employee WHERE id=eid;\n log(eid, \'getSalary id=\' || eid || \' salary=\' ||\nnSalary);\n RETURN nSalary;\n END;\n \n PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2)) AS\n BEGIN\n UPDATE employee SET salary=salary+amount WHERE id=eid;\n log(eid, \'raiseSalary id=\' || eid || \' amount=\' ||\namount);\n END;\n \n PROCEDURE raiseSalaryStd(eid INT) AS\n BEGIN\n raiseSalary(eid, stdRaiseAmount);\n log(eid, \'raiseSalaryStd id=\' || eid);\n END;\n \nBEGIN\n -- This code is executed when the current session\n -- accesses any of the package routines for the first time\n log(0, \'Session \' || connection_id() || \' \' ||\ncurrent_user || \' started\');\nEND;\n$$\n \nDELIMITER ;\n \n\n\nURL: https://mariadb.com/kb/en/library/create-package-body/','','https://mariadb.com/kb/en/library/create-package-body/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (657,39,'CREATE PROCEDURE','Syntax\n------ \nCREATE\n [OR REPLACE]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n PROCEDURE sp_name ([proc_parameter[,...]])\n [characteristic ...] routine_body\n \nproc_parameter:\n [ IN | OUT | INOUT ] param_name type\n \ntype:\n Any valid MariaDB data type\n \ncharacteristic:\n LANGUAGE SQL\n | [NOT] DETERMINISTIC\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL\nDATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n \nroutine_body:\n Valid SQL procedure statement\n \nDescription\n----------- \nCreates a stored procedure. By default, a routine is\nassociated with the default database. To associate the\nroutine\nexplicitly with a given database, specify the name as\ndb_name.sp_name\nwhen you create it.\n \nWhen the routine is invoked, an implicit USE db_name is\nperformed (and\nundone when the routine terminates). The causes the routine\nto have\nthe given default database while it executes. USE statements\nwithin\nstored routines are disallowed.\n \nWhen a stored procedure has been created, you invoke it by\nusing the CALL statement (see CALL).\n \nTo execute the CREATE PROCEDURE statement, it is\nnecessary to have the CREATE ROUTINE privilege. By default,\nMariaDB\nautomatically grants the ALTER ROUTINE and EXECUTE\nprivileges to the\nroutine creator. See also Stored Routine Privileges.\n \nThe DEFINER and SQL SECURITY clauses specify the security\ncontext to\nbe used when checking access privileges at routine execution\ntime, as\ndescribed later.\n \nIf the routine name is the same as the name of a built-in\nSQL\nfunction, you must use a space between the name and the\nfollowing\nparenthesis when defining the routine, or a syntax error\noccurs. This\nis also true when you invoke the routine later. For this\nreason, we\nsuggest that it is better to avoid re-using the names of\nexisting SQL\nfunctions for your own stored routines.\n \nThe IGNORE_SPACE SQL mode applies to built-in functions, not\nto stored\nroutines. It is always allowable to have spaces after a\nroutine name,\nregardless of whether IGNORE_SPACE is enabled.\n \nThe parameter list enclosed within parentheses must always\nbe present.\nIf there are no parameters, an empty parameter list of ()\nshould be\nused. Parameter names are not case sensitive.\n \nEach parameter can be declared to use any valid data type,\nexcept that\nthe COLLATE attribute cannot be used.\n \nFor valid identifiers to use as procedure names, see\nIdentifier Names.\n \nIN/OUT/INOUT\n \nEach parameter is an IN parameter by default. To specify\notherwise for\na parameter, use the keyword OUT or INOUT before the\nparameter name.\n \nAn IN parameter passes a value into a procedure. The\nprocedure might\nmodify the value, but the modification is not visible to the\ncaller\nwhen the procedure returns. An OUT parameter passes a value\nfrom the\nprocedure back to the caller. Its initial value is NULL\nwithin the\nprocedure, and its value is visible to the caller when the\nprocedure\nreturns. An INOUT parameter is initialized by the caller,\ncan be\nmodified by the procedure, and any change made by the\nprocedure is\nvisible to the caller when the procedure returns.\n \nFor each OUT or INOUT parameter, pass a user-defined\nvariable in the\nCALL statement that invokes the procedure so that you can\nobtain its\nvalue when the procedure returns. If you are calling the\nprocedure\nfrom within another stored procedure or function, you can\nalso pass a\nroutine parameter or local routine variable as an IN or\nINOUT\nparameter.\n \nDETERMINISTIC/NOT DETERMINISTIC\n \nDETERMINISTIC and NOT DETERMINISTIC apply only to functions.\nSpecifying DETERMINISTC or NON-DETERMINISTIC in procedures\nhas no effect. The default value is NOT DETERMINISTIC.\nFunctions are DETERMINISTIC when they always return the same\nvalue for the same input. For example, a truncate or\nsubstring function. Any function involving data, therefore,\nis always NOT DETERMINISTIC.\n \nCONTAINS SQL/NO SQL/READS SQL DATA/MODIFIES SQL DATA\n \nCONTAINS SQL, NO SQL, READS SQL DATA, and MODIFIES SQL DATA\nare informative clauses that tell the server what the\nfunction does. MariaDB does not check in any way whether the\nspecified clause is correct. If none of these clauses are\nspecified, CONTAINS SQL is used by default.\n \nMODIFIES SQL DATA means that the function contains\nstatements that may modify data stored in databases. This\nhappens if the function contains statements like DELETE,\nUPDATE, INSERT, REPLACE or DDL.\n \nREADS SQL DATA means that the function reads data stored in\ndatabases, but does not modify any data. This happens if\nSELECT statements are used, but there no write operations\nare executed.\n \nCONTAINS SQL means that the function contains at least one\nSQL statement, but it does not read or write any data stored\nin a database. Examples include SET or DO.\n \nNO SQL means nothing, because MariaDB does not currently\nsupport any language other than SQL.\n \nThe routine_body consists of a valid SQL procedure\nstatement. This can\nbe a simple statement such as SELECT or INSERT, or it can be\na\ncompound statement written using BEGIN and END. Compound\nstatements\ncan contain declarations, loops, and other control structure\nstatements. See Programmatic and Compound Statements for\nsyntax details.\n \nMariaDB allows routines to contain DDL statements, such as\nCREATE and\nDROP. MariaDB also allows stored procedures (but not stored\nfunctions)\nto contain SQL transaction statements such as COMMIT.\n \nFor additional information about statements that are not\nallowed in\nstored routines, see Stored Routine Limitations.\n \nInvoking stored procedure from within programs\n \nFor information about invoking stored procedures from within\nprograms written in a language that has a MariaDB/MySQL\ninterface, see CALL.\n \nOR REPLACE\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP PROCEDURE IF EXISTS name;\n \nCREATE PROCEDURE name ...;\n \nwith the exception that any existing privileges for the\nprocedure are not dropped.\n \nsql_mode\n \nMariaDB stores the sql_mode system variable setting that is\nin effect at the time a routine is created, and always\nexecutes the routine with this setting in force, regardless\nof the server SQL mode in effect when the routine is\ninvoked.\n \nCharacter Sets and Collations\n \nProcedure parameters can be declared with any character\nset/collation. If the character set and collation are not\nspecifically set, the database defaults at the time of\ncreation will be used. If the database defaults change at a\nlater stage, the stored procedure character set/collation\nwill not be changed at the same time; the stored procedure\nneeds to be dropped and recreated to ensure the same\ncharacter set/collation as the database is used.\n \nOracle Mode\n \nFrom MariaDB 10.3, a subset of Oracle\'s PL/SQL language has\nbeen supported in addition to the traditional SQL/PSM-based\nMariaDB syntax. See Oracle mode from MariaDB 10.3 for\ndetails on changes when running Oracle mode.\n \nExamples\n-------- \nThe following example shows a simple stored procedure that\nuses an OUT\nparameter. It uses the DELIMITER command to set a new\ndelimiter for the duration of the process — see Delimiters\nin the mysql client.\n \nDELIMITER //\n \nCREATE PROCEDURE simpleproc (OUT param1 INT)\n BEGIN\n SELECT COUNT(*) INTO param1 FROM t;\n END;\n//\n \nDELIMITER ;\n \nCALL simpleproc(@a);\n \nSELECT @a;\n+------+\n| @a |\n+------+\n| 1 |\n+------+\n \nCharacter set and collation:\n \nDELIMITER //\n \nCREATE PROCEDURE simpleproc2 (\n OUT param1 CHAR(10) CHARACTER SET \'utf8\' COLLATE\n\'utf8_bin\'\n)\n BEGIN\n SELECT CONCAT(\'a\'),f1 INTO param1 FROM t;\n END;\n//\n \nDELIMITER ;\n \nCREATE OR REPLACE:\n \nDELIMITER //\n \nCREATE PROCEDURE simpleproc2 (\n OUT param1 CHAR(10) CHARACTER SET \'utf8\' COLLATE\n\'utf8_bin\'\n)\n BEGIN\n SELECT CONCAT(\'a\'),f1 INTO param1 FROM t;\n \n END;\n \n//\nERROR 1304 (42000): PROCEDURE simpleproc2 already exists\n \nDELIMITER ;\n \nDELIMITER //\n \nCREATE OR REPLACE PROCEDURE simpleproc2 (\n OUT param1 CHAR(10) CHARACTER SET \'utf8\' COLLATE\n\'utf8_bin\'\n)\n BEGIN\n SELECT CONCAT(\'a\'),f1 INTO param1 FROM t;\n \n END;\n \n//\nERROR 1304 (42000): PROCEDURE simpleproc2 already exists\n \nDELIMITER ;\n \nQuery OK, 0 rows affected (0.03 sec)\n \n\n\nURL: https://mariadb.com/kb/en/library/create-procedure/','','https://mariadb.com/kb/en/library/create-procedure/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (658,39,'CREATE SEQUENCE','CREATE SEQUENCE was introduced in MariaDB 10.3.\n \nSyntax\n------ \nCREATE [OR REPLACE] [TEMPORARY] SEQUENCE [IF NOT EXISTS]\nsequence_name\n[ INCREMENT [ BY | = ] increment ]\n[ MINVALUE [=] minvalue | NO MINVALUE | NOMINVALUE ]\n[ MAXVALUE [=] maxvalue | NO MAXVALUE | NOMAXVALUE ]\n[ START [ WITH | = ] start ] \n[ CACHE [=] cache | NOCACHE ] [ CYCLE | NOCYCLE] \n[table_options]\n \nThe options for CREATE SEQUENCE can be given in any order,\noptionally followed by table_options.\n \ntable_options can be any of the normal table options in\nCREATE TABLE but the most usable ones are ENGINE=... and\nCOMMENT=.\n \nNOMAXVALUE and NOMINVALUE are there to allow one to create\nSEQUENCEs using the Oracle syntax.\n \nDescription\n----------- \nCREATE SEQUENCE will create a sequence that generates new\nvalues when called with NEXT VALUE FOR sequence_name. It\'s\nan alternative to AUTO INCREMENT when one wants to have more\ncontrol of how the numbers are generated. As the SEQUENCE\ncaches values (up to CACHE) it can in some cases be much\nfaster than AUTO INCREMENT. Another benefit is that one can\naccess the last value generated by all used sequences, which\nsolves one of the limitations with LAST_INSERT_ID().\n \nCREATE SEQUENCE requires the CREATE privilege.\n \nDROP SEQUENCE can be used to drop a sequence, and ALTER\nSEQUENCE to change it.\n \nArguments to Create\n \nThe following options may be used:\n \nOption | Default value |  Description | \n \nINCREMENT |  1 | Increment to use for values. May be\nnegative. Setting an increment of 0 causes the sequence to\nuse the value of the auto_increment_increment system\nvariable at the time of creation, which is always a positive\nnumber. (see MDEV-16035). | \n \nMINVALUE | 1 if INCREMENT > 0 and -9223372036854775807 if\nINCREMENT < 0 | Minimum value for the sequence | \n \nMAXVALUE | 9223372036854775806 if INCREMENT > 0 and -1 if\nINCREMENT < 0 | Max value for sequence | \n \nSTART | MINVALUE if INCREMENT > 0 and MAX_VALUE if\nINCREMENT< 0 | First value that the sequence will generate |\n\n \nCACHE | 1000 |  Number of values that should be cached. 0\nif no CACHE. The underlying table will be updated first time\na new sequence number is generated and each time the cache\nruns out. | \n \nIf CYCLE is used then the sequence should start again from\nMINVALUE after it has run out of values. Default value is\nNOCYCLE.\n \nConstraints on Create Arguments\n \nTo be able to create a legal sequence, the following must\nhold:\nMAXVALUE >= start\nMAXVALUE > MINVALUE\nSTART >= MINVALUE\nMAXVALUE = -9223372036854775807 (LONGLONG_MIN+1)\n \nNote that sequences can\'t generate the maximum/minimum 64\nbit number because of the constraint of\nMINVALUE and MAXVALUE. \n \nExamples\n-------- \nCREATE SEQUENCE s START WITH 100 INCREMENT BY 10;\n \nCREATE SEQUENCE s2 START WITH -100 INCREMENT BY -10;\n \nThe following statement fails, as the increment conflicts\nwith the defaults\n \nCREATE SEQUENCE s3 START WITH -100 INCREMENT BY 10;\n \nERROR 4082 (HY000): Sequence \'test.s3\' values are\nconflicting\n \nThe sequence can be created by specifying workable minimum\nand maximum values:\n \nCREATE SEQUENCE s3 START WITH -100 INCREMENT BY 10\nMINVALUE=-100 MAXVALUE=1000;\n \n\n\nURL: https://mariadb.com/kb/en/library/create-sequence/','','https://mariadb.com/kb/en/library/create-sequence/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (659,39,'CREATE SERVER','Syntax\n------ \nCREATE [OR REPLACE] SERVER [IF NOT EXISTS] server_name\n FOREIGN DATA WRAPPER wrapper_name\n OPTIONS (option [, option] ...)\n \noption:\n { HOST character-literal\n | DATABASE character-literal\n | USER character-literal\n | PASSWORD character-literal\n | SOCKET character-literal\n | OWNER character-literal\n | PORT numeric-literal }\n \nDescription\n----------- \nThis statement creates the definition of a server for use\nwith the Spider,\nFEDERATED or FederatedX storage\nengine. The CREATE SERVER statement creates a new row within\nthe\nservers table within the mysql database. This statement\nrequires the SUPER privilege.\n \nThe server_name should be a unique reference to the server.\nServer definitions\nare global within the scope of the server, it is not\npossible to qualify the\nserver definition to a specific database. server_name has a\nmaximum length of\n64 characters (names longer than 64 characters are silently\ntruncated), and is\ncase insensitive. You may specify the name as a quoted\nstring.\n \nThe wrapper_name should be mysql, and may be quoted with\nsingle quotes.\nOther values for wrapper_name are not currently supported.\n \nFor each option you must specify either a character literal\nor numeric literal.\nCharacter literals are UTF-8, support a maximum length of 64\ncharacters and\ndefault to a blank (empty) string. String literals are\nsilently truncated to 64\ncharacters. Numeric literals must be a number between 0 and\n9999, default value\nis 0.\n \nNote: The OWNER option is currently not applied, and has no\neffect on\nthe ownership or operation of the server connection that is\ncreated.\n \nThe CREATE SERVER statement creates an entry in the\nmysql.servers table that can later be used with the\nCREATE TABLE statement when creating a Spider, FederatedX or\nFEDERATED table. The options that you specify will\nbe used to populate the columns in the mysql.servers table.\nThe table columns\nare Server_name, Host, Db, Username, Password, Port and\nSocket.\n \n DROP SERVER removes a previously created server definition.\n\n \nCREATE SERVER is not written to the binary log, irrespective\nof\nthe binary log format being used.\n \nFor valid identifiers to use as server names, see Identifier\nNames.\n \nOR REPLACE\n \nIf the optional OR REPLACE clause is used, it acts as a\nshortcut for:\n \nDROP SERVER IF EXISTS name;\n \nCREATE SERVER server_name ...;\n \nIF NOT EXISTS\n \nIf the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the server already exists.\nCannot be used together with OR REPLACE.\n \nExamples\n-------- \nCREATE SERVER s\nFOREIGN DATA WRAPPER mysql\nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE\n\'test\');\n \nOR REPLACE and IF NOT EXISTS:\n \nCREATE SERVER s \nFOREIGN DATA WRAPPER mysql \nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE\n\'test\');\nERROR 1476 (HY000): The foreign server, s, you are trying to\ncreate already exists\n \nCREATE OR REPLACE SERVER s \nFOREIGN DATA WRAPPER mysql \nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE\n\'test\');\nQuery OK, 0 rows affected (0.00 sec)\n \nCREATE SERVER IF NOT EXISTS s \nFOREIGN DATA WRAPPER mysql \nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE\n\'test\');\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+----------------------------------------------------------------+\n| Level | Code | Message |\n+-------+------+----------------------------------------------------------------+\n| Note | 1476 | The foreign server, s, you are trying to\ncreate already exists |\n+-------+------+----------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/create-server/','','https://mariadb.com/kb/en/library/create-server/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (660,39,'CREATE TABLE','Syntax\n------ \nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS]\ntbl_name\n (create_definition,...) [table_options ]...\n[partition_options]\nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS]\ntbl_name\n [(create_definition,...)] [table_options ]...\n[partition_options]\n select_statement\nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS]\ntbl_name\n { LIKE old_table_name | (LIKE old_table_name) }\n \nselect_statement:\n [IGNORE | REPLACE] [AS] SELECT ... (Some legal select\nstatement)\n \nDescription\n----------- \nUse the CREATE TABLE statement to create a table with the\ngiven name.\n \nIn its most basic form, the CREATE TABLE statement provides\na table name\nfollowed by a list of columns, indexes, and constraints. By\ndefault, the table\nis created in the default database. Specify a database with\ndb_name.tbl_name.\nIf you quote the table name, you must quote the database\nname and table name\nseparately as `db_name`.`tbl_name`. This is particularly\nuseful for CREATE TABLE ... SELECT, because it allows to\ncreate a table into a database, which contains data from\nother databases. See Identifier Qualifiers.\n \nIf a table with the same name exists, error 1050 results.\nUse IF NOT EXISTS\nto suppress this error and issue a note instead. Use SHOW\nWARNINGS\nto see notes.\n \nThe CREATE TABLE statement automatically commits the current\ntransaction,\nexcept when using the TEMPORARY keyword.\n \nFor valid identifiers to use as table names, see Identifier\nNames.\n \nNote: if the default_storage_engine is set to ColumnStore\nthen it needs setting on all UMs. Otherwise when the tables\nusing the default engine are replicated across UMs they will\nuse the wrong engine. You should therefore not use this\noption as a session variable with ColumnStore.\n \nMicrosecond precision can be between 0-6. If no precision is\nspecified it is assumed to be 0, for backward compatibility\nreasons.\n \nPrivileges\n \nExecuting the CREATE TABLE statement requires the CREATE\nprivilege for the table or the database.\n \nCREATE OR REPLACE TABLE ...\n \nThe OR REPLACE clause was added in MariaDB 10.0.8.\n \nIf the OR REPLACE clause is used and if the table already\nexists, then instead of returning an error, the server will\ndrop the existing table and replace it with the newly\ndefined table.\n \nThis syntax was originally added to make replication more\nrobust if it has to rollback and repeat statements such as\nCREATE ... SELECT on slaves.\n \nCREATE OR REPLACE TABLE table_name (a int);\n \nis basically the same as:\n \nDROP TABLE IF EXISTS table_name;\nCREATE TABLE table_name (a int);\n \nwith the following exceptions:\nIf table_name was locked with LOCK TABLES it will continue\nto be locked after the statement.\nTemporary tables are only dropped if the TEMPORARY keyword\nwas used. (With DROP TABLE, temporary tables are preferred\nto be dropped before normal tables).\n \nThings to be Aware of With CREATE OR REPLACE\n \nThe table is dropped first (if it existed), after that the\nCREATE is done. Because of this, if the CREATE fails, then\nthe table will not exist anymore after the statement. If the\ntable was used with LOCK TABLES it will be unlocked.\nOne can\'t use OR REPLACE together with IF EXISTS.\nSlaves in replication will by default use CREATE OR REPLACE\nwhen replicating CREATE statements that don\'\'t use IF\nEXISTS. This can be changed by setting the variable\nslave-ddl-exec-mode to STRICT.\n \nCREATE TABLE IF NOT EXISTS ...\n \nIf the IF NOT EXISTS clause is used, then the index will\nonly be created if an index with the same name does not\nalready exist. If the index already exists, then a warning\nwill be triggered by default.\n \nCREATE TEMPORARY TABLE ...\n \nUse the TEMPORARY keyword to create a temporary table that\nis only available to your current session. Temporary tables\nare dropped when the your session ends. Temporary table\nnames are specific to your session. They will not conflict\nwith other temporary tables from other session even if they\nshare the same name. They will shadow names of non-temporary\ntables or views, if they are identical. A temporary table\ncan have the same name as a non-temporary table which is\nlocated in the same database. In that case, their name will\nreference the temporary table when used in SQL statements.\nYou must have the CREATE TEMPORARY TABLES privilege on the\ndatabase to create temporary tables. If no storage engine is\nspecified, the default_tmp_storage_engine setting will\ndetermine the engine.\n \nCREATE TABLE ... LIKE\n \nUse the LIKE clause instead of a full table definition to\ncreate a table with the same definition as another table,\nincluding columns, indexes, and table options. Foreign key\ndefinitions, as well as any DATA DIRECTORY or INDEX\nDIRECTORY table options specified on the original table,\nwill not be created.\n \nCREATE TABLE ... SELECT\n \nYou can create a table containing data from other tables\nusing the CREATE ... SELECT statement. Columns will be\ncreated in the table for each field returned by the SELECT\nquery.\n \nYou can also define some columns normally and add other\ncolumns from a SELECT. You can also create columns in the\nnormal way and assign them some values using the query, this\nis done to force a certain type or other field\ncharacteristics. The columns that are not named in the query\nwill be placed before the others. For example:\n \nCREATE TABLE test (a INT NOT NULL, b CHAR(10)) ENGINE=MyISAM\n SELECT 5 AS b, c, d FROM another_table;\n \nRemember that the query just returns data. If you want to\nuse the same indexes, or the same columns attributes ([NOT]\nNULL, DEFAULT, AUTO_INCREMENT) in the new table, you need to\nspecify them manually. Types and sizes are not automatically\npreserved if no data returned by the SELECT requires the\nfull size, and VARCHAR could be converted into CHAR. The\nCAST() function can be used to forcee the new table to use\ncertain types.\n \nAliases (AS) are taken into account, and they should always\nbe used when you SELECT an expression (function,\narithmetical operation, etc).\n \nIf an error occurs during the query, the table will not be\ncreated at all.\n \nIf the new table has a primary key or UNIQUE indexes, you\ncan use the IGNORE or REPLACE keywords to handle duplicate\nkey errors during the query. IGNORE means that the newer\nvalues must not be inserted an identical value exists in the\nindex. REPLACE means that older values must be overwritten.\n \nIf the columns in the new table are more than the rows\nreturned by the query, the columns populated by the query\nwill be placed after other columns. Note that if the strict\nSQL_MODE is on, and the columns that are not names in the\nquery do not have a DEFAULT value, an error will raise and\nno rows will be copied.\n \nConcurrent inserts are not used during the execution of a\nCREATE ... SELECT.\n \nIf the table already exists, an error similar to the\nfollowing will be returned:\n \nERROR 1050 (42S01): Table \'t\' already exists\n \nIf the IF NOT EXISTS clause is used and the table exists, a\nnote will be produced instead of an error.\n \nTo insert rows from a query into an existing table, INSERT\n... SELECT can be used.\n \nColumn Definitions\n \ncreate_definition:\n { col_name column_definition | index_definition |\nperiod_definition | CHECK (expr) }\n \ncolumn_definition:\n data_type\n [NOT NULL | NULL] [DEFAULT default_value | (expression)]\n [AUTO_INCREMENT] [ZEROFILL] [UNIQUE [KEY] | [PRIMARY] KEY]\n [INVISIBLE] [{WITH|WITHOUT} SYSTEM VERSIONING]\n [COMMENT \'string\']\n [COLUMN_FORMAT {FIXED|DYNAMIC|DEFAULT}]\n [reference_definition]\n | data_type [GENERATED ALWAYS] AS { { ROW {START|END} } | {\n(expression) [VIRTUAL | PERSISTENT | STORED] } }\n [UNIQUE [KEY]] [COMMENT \'string\']\n \nconstraint_definition:\n CONSTRAINT [constraint_name] CHECK (expression)\nNote: MariaDB accepts the REFERENCES clause in ALTER TABLE\nand CREATE TABLE column definitions, but that syntax does\nnothing. MariaDB simply parses it without returning any\nerror or warning, for compatibility with other DBMS\'s.\nBefore MariaDB 10.2.1 this was also true for CHECK\nconstraints. Only the syntax for indexes described below\ncreates foreign keys.\n \nEach definition either creates a column in the table or\nspecifies and index or\nconstraint on one or more columns. See Indexes below for\ndetails\non creating indexes.\n \nCreate a column by specifying a column name and a data type,\noptionally\nfollowed by column options. See Data Types for a full list\nof data types allowed in MariaDB.\n \nNULL and NOT NULL\n \nUse the NULL or NOT NULL options to specify that values in\nthe column\nmay or may not be NULL, respectively. By default, values may\nbe NULL. See also NULL Values in MariaDB.\n \nDEFAULT Column Option\n \nThe DEFAULT clause was enhanced in MariaDB 10.2.1. Some\nenhancements include\nBLOB and TEXT columns now support DEFAULT.\nThe DEFAULT clause can now be used with an expression or\nfunction.\n \nSpecify a default value using the DEFAULT clause. If you\ndon\'t specify DEFAULT then the following rules apply:\nIf the column is not defined with NOT NULL, AUTO_INCREMENT\nor TIMESTAMP, an explicit DEFAULT NULL will be added.\nNote that in MySQL and in MariaDB before 10.1.6, you may get\nan explicit DEFAULT for primary key parts, if not specified\nwith NOT NULL.\n \nThe default value will be used if you INSERT a row without\nspecifying a value for that column, or if you specify\nDEFAULT for that column.\nBefore MariaDB 10.2.1 you couldn\'t usually provide an\nexpression or function to evaluate at\ninsertion time. You had to provide a constant default value\ninstead. The one\nexception is that you may use CURRENT_TIMESTAMP as\nthe default value for a TIMESTAMP column to use the current\ntimestamp at insertion time.\n \nCURRENT_TIMESTAMP may also be used as\nthe default value for a DATETIME\n \nFrom MariaDB 10.2.1 you can use most functions in DEFAULT.\nExpressions should have parentheses around them. If you use\na non deterministic function in DEFAULT then all inserts to\nthe table will be replicated in row mode. You can even refer\nto earlier columns in the DEFAULT expression:\n \nCREATE TABLE t1 (a int DEFAULT (1+1), b int DEFAULT (a+1));\nCREATE TABLE t2 (a bigint primary key DEFAULT UUID_SHORT());\n \nThe DEFAULT clause cannot contain any stored functions or\nsubqueries, and a column used in the clause must already\nhave been defined earlier in the statement.\n \nSince MariaDB 10.2.1, it is possible to assign BLOB or TEXT\ncolumns a DEFAULT value. In earlier versions, assigning a\ndefault to these columns was not possible.\n \nStarting from 10.3.3 you can also use DEFAULT (NEXT VALUE\nFOR sequence)\n \nAUTO_INCREMENT Column Option\n \nUse AUTO_INCREMENT to create a column whose value can\ncan be set automatically from a simple counter. You can only\nuse AUTO_INCREMENT\non a column with an integer type. The column must be a key,\nand there can only be\none AUTO_INCREMENT column in a table. If you insert a row\nwithout specifying\na value for that column (or if you specify 0, NULL, or\nDEFAULT\nas the value), the actual value will be taken from the\ncounter, with each insertion\nincrementing the counter by one. You can still insert a\nvalue explicitly. If you\ninsert a value that is greater than the current counter\nvalue, the counter is\nset based on the new value. An AUTO_INCREMENT column is\nimplicitly NOT NULL.\nUse LAST_INSERT_ID to get the AUTO_INCREMENT value\nmost recently used by an INSERT statement.\n \nZEROFILL Column Option\n \nIf the ZEROFILL column option is specified for a column\nusing a numeric data type, then the column will be set to\nUNSIGNED and the spaces used by default to pad the field are\nreplaced with zeros. ZEROFILL is ignored in expressions or\nas part of a UNION. ZEROFILL is a non-standard MySQL and\nMariaDB enhancement.\n \nPRIMARY KEY Column Option\n \nUse PRIMARY KEY (or just KEY) to make a column a primary\nkey. A primary key is a special type of a unique key. There\ncan be at most one primary key per table, and it is\nimplicitly NOT NULL.\n \nSpecifying a column as a unique key creates a unique index\non that column. See the Index Definitions section below for\nmore information.\n \nUNIQUE KEY Column Option\n \nUse UNIQUE KEY (or just UNIQUE) to specify that all values\nin the column\nmust be distinct from each other. Unless the column is NOT\nNULL, there may be\nmultiple rows with NULL in the column. \n \nSpecifying a column as a unique key creates a unique index\non that column. See the Index Definitions section below for\nmore information.\n \nCOMMENT Column Option\n \nYou can provide a comment for each column using the COMMENT\nclause. The maximum length is 1024 characters (it was 255\ncharacters before MariaDB 5.5). Use\nthe SHOW FULL COLUMNS statement to see column comments.\n \nGenerated Columns\n \nA generated column is a column in a table that cannot\nexplicitly be set to a specific value in a DML query.\nInstead, its value is automatically generated based on an\nexpression. This expression might generate the value based\non the values of other columns in the table, or it might\ngenerate the value by calling built-in functions or\nuser-defined functions (UDFs).\n \nThere are two types of generated columns:\nPERSISTENT or STORED: This type\'s value is actually stored\nin the table.\nVIRTUAL: This type\'s value is not stored at all. Instead,\nthe value is generated dynamically when the table is\nqueried. This type is the default.\n \nGenerated columns are also sometimes called computed columns\nor virtual columns.\n \nFor a complete description about generated columns and their\nlimitations, see Generated (Virtual and Persistent/Stored)\nColumns.\n \nCOLUMN_FORMAT\n \nCOLUMN_FORMAT is only used by MySQL Cluster, and is silently\nignored in MariaDB.\n \nCOMPRESSED\n \nCertain columns may be compressed. See Storage-Engine\nIndependent Column Compression.\n \nINVISIBLE\n \nColumns may be made invisible, and hidden in certain\ncontexts. See Invisible Columns.\n \nWITH SYSTEM VERSIONING Column Option\n \nColumns may be explicitly marked as included from system\nversioning. See System-versioned tables for details.\n \nWITHOUT SYSTEM VERSIONING Column Option\n \nColumns may be explicitly marked as excluded from system\nversioning. See System-versioned tables for details.\n \nIndex Definitions\n \nindex_definition:\n {INDEX|KEY} [index_name] [index_type] (index_col_name,...)\n[index_option] ...\n | {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name]\n(index_col_name,...) [index_option] ...\n | [CONSTRAINT [symbol]] PRIMARY KEY [index_type]\n(index_col_name,...) [index_option] ...\n | [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY] [index_name]\n[index_type] (index_col_name,...) [index_option] ...\n | [CONSTRAINT [symbol]] FOREIGN KEY [index_name]\n(index_col_name,...) reference_definition\n \nindex_col_name:\n col_name [(length)] [ASC | DESC]\n \nindex_type:\n USING {BTREE | HASH | RTREE}\n \nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n | CLUSTERING={YES| NO}\n \nreference_definition:\n REFERENCES tbl_name (index_col_name,...)\n [MATCH FULL | MATCH PARTIAL | MATCH SIMPLE]\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n \nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\nINDEX and KEY are synonyms. \n \nIndex names are optional, if not specified an automatic name\nwill be assigned. Index name are needed to drop indexes and\nappear in error messages when a constraint is violated.\n \nIndex Categories\n \nPlain Indexes\n \nPlain indexes are regular indexes that are not unique, and\nare not acting as a primary key or a foreign key. They are\nalso not the \"specialized\" FULLTEXT or SPATIAL indexes.\n \nSee Getting Started with Indexes: Plain Indexes for more\ninformation.\n \nPRIMARY KEY\n \nFor PRIMARY KEY indexes, you can specify a name for the\nindex, but it is silently ignored, and the name of the index\nis always PRIMARY.\n \nSee Getting Started with Indexes: Primary Key for more\ninformation.\n \nUNIQUE\n \nThe UNIQUE keyword means that the index will not accept\nduplicated values, except for NULLs. An error will raise if\nyou try to insert duplicate values in a UNIQUE index.\n \nFor UNIQUE indexes, you can specify a name for the\nconstraint, using the CONSTRAINT keyword. That name will be\nused in error messages.\n \nSee Getting Started with Indexes: Unique Index for more\ninformation.\n \nFOREIGN KEY\n \nFor FOREIGN KEY indexes, a reference definition must be\nprovided.\n \nFor FOREIGN KEY indexes, you can specify a name for the\nconstraint, using the CONSTRAINT keyword. That name will be\nused in error messages.\n \nFirst, you have to specify the name of the target (parent)\ntable and a column or a column list which must be indexed\nand whose values must match to the foreign key\'s values.\nThe MATCH clause is accepted to improve the compatibility\nwith other DBMS\'s, but has no meaning in MariaDB. The ON\nDELETE and ON UPDATE clauses specify what must be done when\na DELETE (or a REPLACE) statements attempts to delete a\nreferenced row from the parent table, and when an UPDATE\nstatement attempts to modify the referenced foreign key\ncolumns in a parent table row, respectively. The following\noptions are allowed:\nRESTRICT: The delete/update operation is not performed. The\nstatement terminates with a 1451 error (SQLSTATE \'2300\').\nNO ACTION: Synonym for RESTRICT.\nCASCADE: The delete/update operation is performed in both\ntables.\nSET NULL: The update or delete goes ahead in the parent\ntable, and the corresponding foreign key fields in the child\ntable are set to NULL. (They must not be defined as NOT NULL\nfor this to succeed).\nSET DEFAULT: This option is currently implemented only for\nthe PBXT storage engine, which is disabled by default and no\nlonger maintained. It sets the child table\'s foreign key\nfields to their DEFAULT values when the referenced parent\ntable key entries are updated or deleted.\n \nIf either clause is omitted, the default behavior for the\nomitted clause is RESTRICT.\n \nSee Foreign Keys for more information.\n \nFULLTEXT\n \nUse the FULLTEXT keyword to create full-text indexes.\n \nSee Full-Text Indexes for more information.\n \nSPATIAL\n \nUse the SPATIAL keyword to create geometric indexes.\n \nSee SPATIAL INDEX for more information.\n \nIndex Options\n \nKEY_BLOCK_SIZE Index Option\n \nThe KEY_BLOCK_SIZE index option is similar to the\nKEY_BLOCK_SIZE table option.\n \nWith the InnoDB storage engine, if you specify a non-zero\nvalue for the KEY_BLOCK_SIZE table option for the whole\ntable, then the table will implicitly be created with the\nROW_FORMAT table option set to COMPRESSED. However, this\ndoes not happen if you just set the KEY_BLOCK_SIZE index\noption for one or more indexes in the table. The InnoDB\nstorage engine ignores the KEY_BLOCK_SIZE index option.\nHowever, the SHOW CREATE TABLE statement may still report it\nfor the index.\n \nFor information about the KEY_BLOCK_SIZE index option, see\nthe KEY_BLOCK_SIZE table option below.\n \nIndex Types\n \nEach storage engine supports some or all index types. See\nStorage Engine Index Types for details on permitted index\ntypes for each storage engine.\n \nDifferent index types are optimized for different kind of\noperations:\nBTREE is the default type, a','','https://mariadb.com/kb/en/library/create-table/'); -update help_topic set description = CONCAT(description, 'nd normally is the best choice.\nIt is supported by all storage engines. It can be used to\ncompare a column\'s value with a value using the =, >, >=,\n0) ,b int check (b> 0), constraint abc check (a>b));\n \nIf you use the second format and you don\'t give a name to\nthe constraint, then the constraint will get a auto\ngenerated name. This is done so that you can later delete\nthe constraint with ALTER TABLE DROP constraint_name.\n \nOne can disable all constraint expression checks by setting\nthe variable check_constraint_checks to OFF. This is useful\nfor example when loading a table that violates some\nconstraints that you want to later find and fix in SQL.\n \nSee CONSTRAINT for more information.\n \nTable Options\n \nFor each individual table you create (or alter), you can set\nsome table options. The general syntax for setting options\nis:\n \n = , [ = ...]\n \nThe equal sign is optional.\n \nSome options are supported by the server and can be used for\nall tables, no matter what storage engine they use; other\noptions can be specified for all storage engines, but have a\nmeaning only for some engines. Also, engines can extend\nCREATE TABLE with new options.\n \nIf the IGNORE_BAD_TABLE_OPTIONS SQL_MODE is enabled, wrong\ntable options generate a warning; otherwise, they generate\nan error.\n \ntable_option: \n [STORAGE] ENGINE [=] engine_name\n | AUTO_INCREMENT [=] value\n | AVG_ROW_LENGTH [=] value\n | [DEFAULT] CHARACTER SET [=] charset_name\n | CHECKSUM [=] {0 | 1}\n | [DEFAULT] COLLATE [=] collation_name\n | COMMENT [=] \'string\'\n | CONNECTION [=] \'connect_string\'\n | DATA DIRECTORY [=] \'absolute path to directory\'\n | DELAY_KEY_WRITE [=] {0 | 1}\n | ENCRYPTED [=] {YES | NO}\n | ENCRYPTION_KEY_ID [=] value\n | IETF_QUOTES [=] {YES | NO}\n | INDEX DIRECTORY [=] \'absolute path to directory\'\n | INSERT_METHOD [=] { NO | FIRST | LAST }\n | KEY_BLOCK_SIZE [=] value\n | MAX_ROWS [=] value\n | MIN_ROWS [=] value\n | PACK_KEYS [=] {0 | 1 | DEFAULT}\n | PAGE_CHECKSUM [=] {0 | 1}\n | PAGE_COMPRESSED [=] {0 | 1}\n | PAGE_COMPRESSION_LEVEL [=] {0 .. 9}\n | PASSWORD [=] \'string\'\n | ROW_FORMAT [=]\n{DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT|PAGE}\n | SEQUENCE [=] {0|1}\n | STATS_AUTO_RECALC [=] {DEFAULT|0|1}\n | STATS_PERSISTENT [=] {DEFAULT|0|1}\n | STATS_SAMPLE_PAGES [=] {DEFAULT|value}\n | TABLESPACE tablespace_name\n | TRANSACTIONAL [=] {0 | 1}\n | UNION [=] (tbl_name[,tbl_name]...)\n | WITH SYSTEM VERSIONING\n \n[STORAGE] ENGINE\n \n[STORAGE] ENGINE specifies a storage engine for the table.\nIf this option is not used, the default storage engine is\nused instead. That is, the default_storage_engine session option\nvalue if it is set, or the value specified for the\n--default-storage-engine mysqld startup options, or InnoDB.\nIf the specified storage engine is not installed and active,\nthe default value will be used, unless the\nNO_ENGINE_SUBSTITUTION SQL MODE is set (default since\nMariaDB 10.0). This is only true for CREATE TABLE, not for\nALTER TABLE. For a list of storage engines that are present\nin your server, issue a SHOW ENGINES.\n \nAUTO_INCREMENT\n \nAUTO_INCREMENT specifies the initial value for the\nAUTO_INCREMENT primary key. This works for MyISAM, Aria,\nInnoDB/XtraDB, MEMORY, and ARCHIVE tables. You can change\nthis option with ALTER TABLE, but in that case the new value\nmust be higher than the highest value which is present in\nthe AUTO_INCREMENT column. If the storage engine does not\nsupport this option, you can insert (and then delete) a row\nhaving the wanted value - 1 in the AUTO_INCREMENT column.\n \nAVG_ROW_LENGTH\n \nAVG_ROW_LENGTH is the average rows size. It only applies to\ntables using MyISAM and Aria storage engines that have the\nROW_FORMAT table option set to FIXED format.\n \nMyISAM uses MAX_ROWS and AVG_ROW_LENGTH to decide the\nmaximum size of a table (default: 256TB, or the maximum file\nsize allowed by the system).\n \n[DEFAULT] CHARACTER SET/CHARSET\n \n[DEFAULT] CHARACTER SET (or [DEFAULT] CHARSET) is used to\nset a default character set for the table. This is the\ncharacter set used for all columns where an explicit\ncharacter set is not specified. If this option is omitted or\nDEFAULT is specified, database\'s default character set will\nbe used. See Setting Character Sets and Collations for\ndetails on setting the character sets.\n \nCHECKSUM/TABLE_CHECKSUM\n \nCHECKSUM (or TABLE_CHECKSUM) can be set to 1 to maintain a\nlive checksum for all table\'s rows. This makes write\noperations slower, but CHECKSUM TABLE will be very fast.\nThis option is only supported for MyISAM and Aria tables.\n \n[DEFAULT] COLLATE\n \n[DEFAULT] COLLATE is used to set a default collation for the\ntable. This is the collation used for all columns where an\nexplicit character set is not specified. If this option is\nomitted or DEFAULT is specified, database\'s default option\nwill be used. See Setting Character Sets and Collations for\ndetails on setting the collations\n \nCOMMENT\n \nCOMMENT is a comment for the table. Maximum length is 2048\ncharacters (before mariaDB 5.5 it was 60 characters). Also\nused to define table parameters when creating a Spider\ntable.\n \nCONNECTION\n \nCONNECTION is used to specify a server name or a connection\nstring for a Spider, CONNECT, Federated or FederatedX table.\n \nDATA DIRECTORY/INDEX DIRECTORY\n \nDATA DIRECTORY and INDEX DIRECTORY were only supported for\nMyISAM and Aria, before MariaDB 5.5. Since 5.5, DATA\nDIRECTORY has also been supported by InnoDB if the\ninnodb_file_per_table server system variable is enabled, but\nonly in CREATE TABLE, not in ALTER TABLE. So, carefully\nchoose a path for InnoDB tables at creation time, because it\ncannot be changed without dropping and re-creating the\ntable. These options specify the paths for data files and\nindex files, respectively. If these options are omitted, the\ndatabase\'s directory will be used to store data files and\nindex files. Note that these table options do not work for\npartitioned tables (use the partition options instead), or\nif the server has been invoked with the\n--skip-symbolic-links startup option. To avoid the\noverwriting of old files with the same name that could be\npresent in the directories, you can use the\n--keep_files_on_create option (an error will be issued if\nfiles already exist). These options are ignored if the\nNO_DIR_IN_CREATE SQL_MODE is enabled (useful for replication\nslaves). Also note that symbolic links cannot be used for\nInnoDB tables.\n \nDATA DIRECTORY works by creating symlinks from where the\ntable would normally have been (inside the datadir) to where\nthe option specifies. For security reasons, to avoid\nbypassing the privilege system, the server does not permit\nsymlinks inside the datadir. Therefore, DATA DIRECTORY\ncannot be used to specify a location inside the datadir. An\nattempt to do so will result in an error 1210 (HY000)\nIncorrect arguments to DATA DIRECTORY.\n \nDELAY_KEY_WRITE\n \nDELAY_KEY_WRITE is supported by MyISAM and Aria, and can be\nset to 1 to speed up write operations. In that case, when\ndata are modified, the indexes are not updated until the\ntable is closed. Writing the changes to the index file\naltogether can be much faster. However, note that this\noption is applied only if the delay_key_write server\nvariable is set to \'ON\'. If it is \'OFF\' the delayed\nindex writes are always disabled, and if it is \'ALL\' the\ndelayed index writes are always used, disregarding the value\nof DELAY_KEY_WRITE.\n \nENCRYPTED\n \nThe ENCRYPTED table option was added in MariaDB 10.1.4\n \nThe ENCRYPTED table option can be used to manually set the\nencryption status of an InnoDB table. See InnoDB / XtraDB\nEncryption for more information.\n \nAria does not currently support the ENCRYPTED table option.\nSee MDEV-18049 about that.\n \nSee Data-at-Rest Encryption for more information.\n \nENCRYPTION_KEY_ID\n \nThe ENCRYPTION_KEY_ID table option was added in MariaDB\n10.1.4\n \nThe ENCRYPTION_KEY_ID table option can be used to manually\nset the encryption key of an InnoDB table. See InnoDB /\nXtraDB Encryption for more information.\n \nAria does not currently support the ENCRYPTION_KEY_ID table\noption. See MDEV-18049 about that.\n \nSee Data-at-Rest Encryption for more information.\n \nIETF_QUOTES\n \nThe IETF_QUOTES option was added in MariaDB 10.1.8\n \nFor the CSV storage engine, the IETF_QUOTES option, when set\nto YES, enables IETF-compatible parsing of embedded quote\nand comma characters. Enabling this option for a table\nimproves compatibility with other tools that use CSV, but is\nnot compatible with MySQL CSV tables, or MariaDB CSV tables\ncreated without this option. Disabled by default.\n \nINSERT_METHOD\n \nINSERT_METHOD is only used with MERGE tables. This option\ndetermines in which underlying table the new rows should be\ninserted. If you set it to \'NO\' (which is the default) no\nnew rows can be added to the table (but you will still be\nable to perform INSERTs directly against the underlying\ntables). FIRST means that the rows are inserted into the\nfirst table, and LAST means that thet are inserted into the\nlast table.\n \nKEY_BLOCK_SIZE\n \nKEY_BLOCK_SIZE is used to determine the size of key blocks,\nin bytes or kilobytes. However, this value is just a hint,\nand the storage engine could modify or ignore it. If\nKEY_BLOCK_SIZE is set to 0, the storage engine\'s default\nvalue will be used.\n \nWith the InnoDB storage engine, if you specify a non-zero\nvalue for the KEY_BLOCK_SIZE table option for the whole\ntable, then the table will implicitly be created with the\nROW_FORMAT table option set to COMPRESSED.\n \nMIN_ROWS/MAX_ROWS\n \nMIN_ROWS and MAX_ROWS let the storage engine know how many\nrows you are planning to store as a minimum and as a\nmaximum. These values will not be used as real limits, but\nthey help the storage engine to optimize the table. MIN_ROWS\nis only used by MEMORY storage engine to decide the minimum\nmemory that is always allocated. MAX_ROWS is used to decide\nthe minimum size for indexes.\n \nPACK_KEYS\n \nPACK_KEYS can be used to determine whether the indexes will\nbe compressed. Set it to 1 to compress all keys. With a\nvalue of 0, compression will not be used. With the DEFAULT\nvalue, only long strings will be compressed. Uncompressed\nkeys are faster.\n \nPAGE_CHECKSUM\n \nPAGE_CHECKSUM is only applicable to Aria tables, and\ndetermines whether indexes and data should use page\nchecksums for extra safety. \n \nPAGE_COMPRESSED\n \nPAGE_COMPRESSED is used to enable InnoDB page compression\nfor InnoDB tables.\n \nPAGE_COMPRESSION_LEVEL\n \nPAGE_COMPRESSION_LEVEL is used to set the compression level\nfor InnoDB page compression for InnoDB tables. The table\nmust also have the PAGE_COMPRESSED table option set to 1.\n \nValid values for PAGE_COMPRESSION_LEVEL are 1 (the best\nspeed) through 9 (the best compression), .\n \nPASSWORD\n \nPASSWORD is unused.\n \nRAID_TYPE\n \nRAID_TYPE is an obsolete option, as the raid support has\nbeen disabled since MySQL 5.0.\n \nROW_FORMAT\n \nThe ROW_FORMAT table option specifies the row format for the\ndata file. Possible values are engine-dependent.\n \nSupported MyISAM Row Formats\n \nFor MyISAM, the supported row formats are: \nFIXED\nDYNAMIC\nCOMPRESSED\n \nThe COMPRESSED row format can only be set by the myisampack\ncommand line tool.\n \nSee MyISAM Storage Formats for more information.\n \nSupported Aria Row Formats\n \nFor Aria, the supported row formats are:\nPAGE\nFIXED\nDYNAMIC.\n \nSee Aria Storage Formats for more information.\n \nSupported InnoDB Row Formats\n \nFor InnoDB/XtraDB, the supported row formats are:\nCOMPACT\nREDUNDANT\nCOMPRESSED\nDYNAMIC.\n \nIf the ROW_FORMAT table option is set to FIXED for an InnoDB\ntable, then the server will either return an error or a\nwarning depending on the value of the innodb_strict_mode\nsystem variable. If the innodb_strict_mode system variable\nis set to OFF, then a warning is issued, and MariaDB will\ncreate the table using the default row format for the\nspecific MariaDB server version. If the innodb_strict_mode\nsystem variable is set to ON, then an error will be raised.\n \nSee XtraDB/InnoDB Storage Formats for more information.\n \nOther Storage Engines and ROW_FORMAT\n \nOther storage engines do not support the ROW_FORMAT table\noption.\n \nSEQUENCE\n \nIf the table is a sequence, then it will have the SEQUENCE\nset to 1.\n \nSTATS_AUTO_RECALC\n \nSTATS_AUTO_RECALC is available only in MariaDB 10.0+. It\nindicates whether to automatically recalculate persistent\nstatistics (see STATS_PERSISTENT, below) for an InnoDB\ntable.\nIf set to 1, statistics will be recalculated when more than\n10% of the data has changed. When set to 0, stats will be\nrecalculated only when an ANALYZE TABLE is run. If set to\nDEFAULT, or left out, the value set by the\ninnodb_stats_auto_recalc system variable applies. See InnoDB\nPersistent Statistics.\n \nSTATS_PERSISTENT\n \nSTATS_PERSISTENT is available only in MariaDB 10.0+. It\nindicates whether the InnoDB statistics created by ANALYZE\nTABLE will remain on disk or not. It can be set to 1 (on\ndisk), 0 (not on disk, the pre-MariaDB 10 behavior), or\nDEFAULT (the same as leaving out the option), in which case\nthe value set by the innodb_stats_persistent system variable\nwill apply. Persistent statistics stored on disk allow the\nstatistics to survive server restarts, and provide better\nquery plan stability. See InnoDB Persistent Statistics.\n \nSTATS_SAMPLE_PAGES\n \nSTATS_SAMPLE_PAGES is available only in MariaDB 10.0+. It\nindicates how many pages are used to sample index\nstatistics. If 0 or DEFAULT, the default value, the\ninnodb_stats_sample_pages value is used. See InnoDB\nPersistent Statistics.\n \nTRANSACTIONAL\n \nTRANSACTIONAL is only applicable for Aria tables. In future\nAria tables created with this option will be fully\ntransactional, but currently this provides a form of crash\nprotection. See Aria Storage Engine for more details.\n \nUNION\n \nUNION must be specified when you create a MERGE table. This\noption contains a comma-separated list of MyISAM tables\nwhich are accessed by the new table. The list is enclosed\nbetween parenthesis. Example: UNION = (t1,t2)\n \nWITH SYSTEM VERSIONING\n \nWITH SYSTEM VERSIONING is used for creating System-versioned\ntables.\n \nPartitions\n \npartition_options:\n PARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list)\n | RANGE(expr)\n | LIST(expr)\n | SYSTEM_TIME [INTERVAL time_quantity time_unit] [LIMIT\nnum] }\n [PARTITIONS num]\n [SUBPARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list) }\n [SUBPARTITIONS num]\n ]\n [(partition_definition [, partition_definition] ...)]\n \npartition_definition:\n PARTITION partition_name\n [VALUES {LESS THAN {(expr) | MAXVALUE} | IN (value_list)}]\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n [(subpartition_definition [, subpartition_definition] ...)]\n \nsubpartition_definition:\n SUBPARTITION logical_name\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\nIf the PARTITION BY clause is used, the table will be\npartitioned. A partition method must be explicitly indicated\nfor partitions and subpartitions. Partition methods are:\n[LINEAR] HASH creates a hash key which will be used to read\nand write rows. The partition function can be any valid SQL\nexpression which returns an INTEGER number. Thus, it is\npossible to use the HASH method on an integer column, or on\nfunctions which accept integer columns as an argument.\nHowever, VALUES LESS THAN and VALUES IN clauses can not be\nused with HASH. An example:\n \nCREATE TABLE t1 (a INT, b CHAR(5), c DATETIME)\n PARTITION BY HASH ( YEAR(c) );\n \n [LINEAR] HASH can be used for subpartitions, too.\n[LINEAR] KEY is similar to HASH, but the index has an even\ndistribution of data. Also, the expression can only be a\ncolumn or a list of columns. VALUES LESS THAN and VALUES IN\nclauses can not be used with KEY.\nRANGE partitions the rows using on a range of values, using\nthe VALUES LESS THAN operator. VALUES IN is not allowed with\nRANGE. The partition function can be any valid SQL\nexpression which returns a single value.\nLIST assignes partitions based on a table\'s column with a\nrestricted set of possible values. It is similar to RANGE,\nbut VALUES IN must be used for at least 1 columns, and\nVALUES LESS THAN is disallowed.\nSYSTEM_TIME partitioning is used for System-versioned tables\nto store historical data separately from current data.\n \nOnly HASH and KEY can be used for subpartitions, and they\ncan be [LINEAR].\n \nIt is possible to define up to 1024 partitions and\nsubpartitions.\n \nThe number of defined partitions can be optionally specified\nas PARTITION count. This can be done to avoid specifying all\npartitions individually. But you can also declare each\nindividual partition and, additionally, specify a PARTITIONS\ncount clause; in the case, the number of PARTITIONs must\nequal count.\n \nAlso see Partitioning Types Overview.\n \nSequences\n \nCREATE TABLE can also be used to create a SEQUENCE. See\nCREATE SEQUENCE and Sequence Overview.\n \nExamples\n-------- \ncreate table if not exists test (\na bigint auto_increment primary key,\nname varchar(128) charset utf8,\nkey name (name(32))\n) engine=InnoDB default charset latin1;\n \nThis example shows a couple of things:\nUsage of IF NOT EXISTS; If the table already existed, it\nwill not be created. There will not be any error for the\nclient, just a warning.\nHow to create a PRIMARY KEY that is automatically generated.\nHow to specify a table-specific character set and another\nfor a column.\nHow to create an index (name) that is only partly indexed\n(to save space).\n \nThe following clauses will work from MariaDB 10.2.1 only.\n \nCREATE TABLE t1(\n a int DEFAULT (1+1),\n b int DEFAULT (a+1),\n expires DATETIME DEFAULT(NOW() + INTERVAL 1 YEAR),\n x BLOB DEFAULT USER()\n);\n \n\n\nURL: https://mariadb.com/kb/en/library/create-table/') WHERE help_topic_id = 660; -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (661,39,'CREATE TABLESPACE','The CREATE TABLESPACE statement is not supported by MariaDB.\nIt was originally inherited from MySQL NDB Cluster. In MySQL\n5.7 and later, the statement is also supported for InnoDB.\nHowever, MariaDB has chosen not to include that specific\nfeature. See MDEV-19294 for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/create-tablespace/','','https://mariadb.com/kb/en/library/create-tablespace/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (662,39,'CREATE TRIGGER','Syntax\n------ \nCREATE [OR REPLACE]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n TRIGGER [IF NOT EXISTS] trigger_name trigger_time\ntrigger_event\n ON tbl_name FOR EACH ROW\n [{ FOLLOWS | PRECEDES } other_trigger_name ]\n trigger_stmt\n \nDescription\n----------- \nThis statement creates a new trigger. A trigger is a named\ndatabase\nobject that is associated with a table, and that activates\nwhen a\nparticular event occurs for the table. The trigger becomes\nassociated\nwith the table named tbl_name, which must refer to a\npermanent table.\nYou cannot associate a trigger with a TEMPORARY table or a\nview.\n \nCREATE TRIGGER requires the TRIGGER privilege for the table\nassociated\nwith the trigger. (Before MySQL 5.1.6, this statement\nrequires the\nSUPER privilege.)\n \nYou can have multiple triggers for the same trigger_time and\ntrigger_event.\n \nFor valid identifiers to use as trigger names, see\nIdentifier Names.\n \nOR REPLACE\n \nIf used and the trigger already exists, instead of an error\nbeing returned, the existing trigger will be dropped and\nreplaced by the newly defined trigger.\n \nDEFINER\n \nThe DEFINER clause determines the security context to be\nused when\nchecking access privileges at trigger activation time.\n \nIF NOT EXISTS\n \nIf the IF NOT EXISTS clause is used, the trigger will only\nbe created if a trigger of the same name does not exist. If\nthe trigger already exists, by default a warning will be\nreturned.\n \ntrigger_time\n \ntrigger_time is the trigger action time. It can be BEFORE or\nAFTER to\nindicate that the trigger activates before or after each row\nto be\nmodified.\n \ntrigger_event\n \ntrigger_event indicates the kind of statement that activates\nthe\ntrigger. The trigger_event can be one of the following:\nINSERT: The trigger is activated whenever a new row is\ninserted into the table; for example, through INSERT, LOAD\nDATA, and REPLACE statements.\nUPDATE: The trigger is activated whenever a row is modified;\nfor example, through UPDATE statements.\nDELETE: The trigger is activated whenever a row is deleted\nfrom the table; for example, through DELETE and REPLACE\nstatements. However, DROP TABLE and TRUNCATE statements on\nthe table do not activate this trigger, because they do not\nuse DELETE. Dropping a partition does not activate DELETE\ntriggers, either.\n \nFOLLOWS/PRECEDES other_trigger_name\n \nThe FOLLOWS other_trigger_name and PRECEDES\nother_trigger_name options were added in MariaDB 10.2.3 as\npart of supporting multiple triggers per action time.\nThis is the same syntax used by MySQL 5.7, although MySQL\n5.7 does not have multi-trigger support.\n \nFOLLOWS adds the new trigger after another trigger while\nPRECEDES adds the new trigger before another trigger. If\nneither option is used, the new trigger is added last for\nthe given action and time.\n \nFOLLOWS and PRECEDES are not stored in the trigger\ndefinition. However the trigger order is guaranteed to not\nchange over time. mysqldump and other backup methods will\nnot change trigger order.\nYou can verify the trigger order from the ACTION_ORDER\ncolumn in INFORMATION_SCHEMA.TRIGGERS table.\n \nSELECT trigger_name, action_order FROM\ninformation_schema.triggers \n WHERE event_object_table=\'t1\';\n \nExamples\n-------- \nCREATE DEFINER=`root`@`localhost` TRIGGER increment_animal\n AFTER INSERT ON animals FOR EACH ROW \n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n \nOR REPLACE and IF NOT EXISTS\n \nCREATE DEFINER=`root`@`localhost` TRIGGER increment_animal\n AFTER INSERT ON animals FOR EACH ROW\n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n \nERROR 1359 (HY000): Trigger already exists\n \nCREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER\nincrement_animal\n AFTER INSERT ON animals FOR EACH ROW\n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n \nQuery OK, 0 rows affected (0.12 sec)\n \nCREATE DEFINER=`root`@`localhost` TRIGGER IF NOT EXISTS\nincrement_animal\n AFTER INSERT ON animals FOR EACH ROW\n UPDATE animal_count SET animal_count.animals =\nanimal_count.animals+1;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------+\n| Level | Code | Message |\n+-------+------+------------------------+\n| Note | 1359 | Trigger already exists |\n+-------+------+------------------------+\n1 row in set (0.00 sec)\n \n\n\nURL: https://mariadb.com/kb/en/library/create-trigger/','','https://mariadb.com/kb/en/library/create-trigger/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (663,39,'CREATE VIEW','Syntax\n------ \nCREATE\n [OR REPLACE]\n [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n [SQL SECURITY { DEFINER | INVOKER }]\n VIEW [IF NOT EXISTS] view_name [(column_list)]\n AS select_statement\n [WITH [CASCADED | LOCAL] CHECK OPTION]\n \nDescription\n----------- \nThe CREATE VIEW statement creates a new view, or replaces an\nexisting\none if the OR REPLACE clause is given. If the view does not\nexist, CREATE OR\nREPLACE VIEW is the same as CREATE VIEW. If the view does\nexist, CREATE OR\nREPLACE VIEW is the same as ALTER VIEW.\n \nThe select_statement is a SELECT statement that provides the\ndefinition of\nthe view. (When you select from the view, you select in\neffect using the SELECT\nstatement.) select_statement can select from base tables or\nother views.\n \nThe view definition is \"frozen\" at creation time, so\nchanges to the underlying\ntables afterwards do not affect the view definition. For\nexample, if a view is\ndefined as SELECT * on a table, new columns added to the\ntable later do not\nbecome part of the view. A SHOW CREATE VIEW shows that\nsuch queries are rewritten and column names are included in\nthe view\ndefinition.\n \nThe view definition must be a query that does not return\nerrors at view\ncreation times. However, the base tables used by the views\nmight be altered\nlater and the query may not be valid anymore. In this case,\nquerying the view\nwill result in an error. CHECK TABLE helps in finding this\nkind\nof problems.\n \nThe ALGORITHM clause affects how MariaDB processes the\nview. The DEFINER and SQL SECURITY clauses specify the\nsecurity context to be\nused when checking access privileges at view invocation\ntime. The WITH CHECK\nOPTION clause can be given to constrain inserts or updates\nto rows in tables\nreferenced by the view. These clauses are described later in\nthis section.\n \nThe CREATE VIEW statement requires the CREATE VIEW privilege\nfor the\nview, and some privilege for each column selected by the\nSELECT\nstatement. For columns used elsewhere in the SELECT\nstatement you must\nhave the SELECT privilege. If the OR REPLACE clause is\npresent, you\nmust also have the DROP privilege for the view.\n \nA view belongs to a database. By default, a new view is\ncreated in the\ndefault database. To create the view explicitly in a given\ndatabase,\nspecify the name as db_name.view_name when you create it.\n \nCREATE VIEW test.v AS SELECT * FROM t;\n \nBase tables and views share the same namespace within a\ndatabase, so a\ndatabase cannot contain a base table and a view that have\nthe same\nname.\n \nViews must have unique column names with no duplicates, just\nlike base\ntables. By default, the names of the columns retrieved by\nthe SELECT\nstatement are used for the view column names. To define\nexplicit names\nfor the view columns, the optional column_list clause can be\ngiven as\na list of comma-separated identifiers. The number of names\nin\ncolumn_list must be the same as the number of columns\nretrieved by the\nSELECT statement.\n \nMySQL until 5.1.28\n \nPrior to MySQL 5.1.29, When you modify an existing view, the\ncurrent view definition is backed up and saved. It is stored\nin that\ntable\'s database directory, in a subdirectory named arc.\nThe backup\nfile for a view v is named v.frm-00001. If you alter the\nview again,\nthe next backup is named v.frm-00002. The three latest view\nbackup\ndefinitions are stored. Backed up view definitions are not\npreserved\nby mysqldump, or any other such programs, but you can retain\nthem\nusing a file copy operation. However, they are not needed\nfor anything\nbut to provide you with a backup of your previous view\ndefinition. It\nis safe to remove these backup definitions, but only while\nmysqld is\nnot running. If you delete the arc subdirectory or its files\nwhile\nmysqld is running, you will receive an error the next time\nyou try to\nalter the view: \n \nMariaDB [test]> ALTER VIEW v AS SELECT * FROM t; \nERROR 6 (HY000): Error on delete of\n\'.\\test\\arc/v.frm-0004\' (Errcode: 2)\n \nColumns retrieved by the SELECT statement can be simple\nreferences to\ntable columns. They can also be expressions that use\nfunctions,\nconstant values, operators, and so forth.\n \nUnqualified table or view names in the SELECT statement are\ninterpreted with respect to the default database. A view can\nrefer to\ntables or views in other databases by qualifying the table\nor view\nname with the proper database name.\n \nA view can be created from many kinds of SELECT statements.\nIt can\nrefer to base tables or other views. It can use joins,\nUNION, and\nsubqueries. The SELECT need not even refer to any tables.\nThe\nfollowing example defines a view that selects two columns\nfrom another\ntable, as well as an expression calculated from those\ncolumns:\n \nCREATE TABLE t (qty INT, price INT);\n \nINSERT INTO t VALUES(3, 50);\n \nCREATE VIEW v AS SELECT qty, price, qty*price AS value FROM\nt;\n \nSELECT * FROM v;\n+------+-------+-------+\n| qty | price | value |\n+------+-------+-------+\n| 3 | 50 | 150 |\n+------+-------+-------+\n \nA view definition is subject to the following restrictions:\nThe SELECT statement cannot contain a subquery in the FROM\nclause.\nThe SELECT statement cannot refer to system or user\nvariables.\nWithin a stored program, the definition cannot refer to\nprogram parameters or local variables.\nThe SELECT statement cannot refer to prepared statement\nparameters.\nAny table or view referred to in the definition must exist.\nHowever, after a view has been created, it is possible to\ndrop a table or view that the definition refers to. In this\ncase, use of the view results in an error. To check a view\ndefinition for problems of this kind, use the CHECK TABLE\nstatement.\nThe definition cannot refer to a TEMPORARY table, and you\ncannot create a TEMPORARY view.\nAny tables named in the view definition must exist at\ndefinition time.\nYou cannot associate a trigger with a view.\nFor valid identifiers to use as view names, see Identifier\nNames.\n \nORDER BY is allowed in a view definition, but it is ignored\nif you\nselect from a view using a statement that has its own ORDER\nBY.\n \nFor other options or clauses in the definition, they are\nadded to the\noptions or clauses of the statement that references the\nview, but the\neffect is undefined. For example, if a view definition\nincludes a\nLIMIT clause, and you select from the view using a statement\nthat has\nits own LIMIT clause, it is undefined which limit applies.\nThis same\nprinciple applies to options such as ALL, DISTINCT, or\nSQL_SMALL_RESULT that follow the SELECT keyword, and to\nclauses such\nas INTO, FOR UPDATE, and LOCK IN SHARE MODE.\n \nThe PROCEDURE clause cannot be used in a view definition,\nand it cannot be used if a view is referenced in the FROM\nclause.\n \nIf you create a view and then change the query processing\nenvironment\nby changing system variables, that may affect the results\nthat you get\nfrom the view:\n \nCREATE VIEW v (mycol) AS SELECT \'abc\';\n \nSET sql_mode = \'\';\n \nSELECT \"mycol\" FROM v;\n+-------+\n| mycol |\n+-------+\n| mycol | \n+-------+\n \nSET sql_mode = \'ANSI_QUOTES\';\n \nSELECT \"mycol\" FROM v;\n+-------+\n| mycol |\n+-------+\n| abc | \n+-------+\n \nThe DEFINER and SQL SECURITY clauses determine which MariaDB\naccount to\nuse when checking access privileges for the view when a\nstatement is\nexecuted that references the view. They were added in MySQL\n5.1.2.\nThe legal SQL SECURITY characteristic values are DEFINER and\nINVOKER.\nThese indicate that the required privileges must be held by\nthe user\nwho defined or invoked the view, respectively. The default\nSQL\nSECURITY value is DEFINER.\n \nIf a user value is given for the DEFINER clause, it should\nbe a MariaDB\naccount in \'user_name\'@\'host_name\' format (the same\nformat used in the\nGRANT statement). The user_name and host_name values both\nare\nrequired. The definer can also be given as CURRENT_USER or\nCURRENT_USER(). The default DEFINER value is the user who\nexecutes the\nCREATE VIEW statement. This is the same as specifying\nDEFINER =\nCURRENT_USER explicitly.\n \nIf you specify the DEFINER clause, these rules determine the\nlegal\nDEFINER user values:\nIf you do not have the SUPER privilege, the only legal user\nvalue is your own account, either specified literally or by\nusing CURRENT_USER. You cannot set the definer to some other\naccount.\nIf you have the SUPER privilege, you can specify any\nsyntactically legal account name. If the account does not\nactually exist, a warning is generated.\nIf the SQL SECURITY value is DEFINER but the definer account\ndoes not exist when the view is referenced, an error occurs.\n \nWithin a view definition, CURRENT_USER returns the view\'s\nDEFINER\nvalue by default. Before MySQL 5.1.12, and for views\ndefined with the SQL SECURITY INVOKER characteristic,\nCURRENT_USER\nreturns the account for the view\'s invoker. For information\nabout user\nauditing within views, see\nhttp://dev.mysql.com/doc/refman/5.1/en/account-activity-auditing.html.\n \nWithin a stored routine that is defined with the SQL\nSECURITY DEFINER\ncharacteristic, CURRENT_USER returns the routine\'s DEFINER\nvalue. This\nalso affects a view defined within such a program, if the\nview\ndefinition contains a DEFINER value of CURRENT_USER.\n \nView privileges are checked like this:\nAt view definition time, the view creator must have the\nprivileges needed to use the top-level objects accessed by\nthe view. For example, if the view definition refers to\ntable columns, the creator must have privileges for the\ncolumns, as described previously. If the definition refers\nto a stored function, only the privileges needed to invoke\nthe function can be checked. The privileges required when\nthe function runs can be checked only as it executes: For\ndifferent invocations of the function, different execution\npaths within the function might be taken.\nWhen a view is referenced, privileges for objects accessed\nby the view are checked against the privileges held by the\nview creator or invoker, depending on whether the SQL\nSECURITY characteristic is DEFINER or INVOKER, respectively.\nIf reference to a view causes execution of a stored\nfunction, privilege checking for statements executed within\nthe function depend on whether the function is defined with\na SQL SECURITY characteristic of DEFINER or INVOKER. If the\nsecurity characteristic is DEFINER, the function runs with\nthe privileges of its creator. If the characteristic is\nINVOKER, the function runs with the privileges determined by\nthe view\'s SQL SECURITY characteristic.\n \nMySQL until 5.1.1\n \nPrior to MySQL 5.1.2 (before the DEFINER and SQL SECURITY\nclauses were\nimplemented), privileges required for objects used in a view\nare\nchecked at view creation time.\n \nExample: A view might depend on a stored function, and that\nfunction\nmight invoke other stored routines. For example, the\nfollowing view\ninvokes a stored function f():\n \nCREATE VIEW v AS SELECT * FROM t WHERE t.id = f(t.name);\n \nSuppose that f() contains a statement such as this:\n \nIF name IS NULL then\n CALL p1();\nELSE\n CALL p2();\nEND IF;\n \nThe privileges required for executing statements within f()\nneed to be\nchecked when f() executes. This might mean that privileges\nare needed\nfor p1() or p2(), depending on the execution path within\nf(). Those\nprivileges must be checked at runtime, and the user who must\npossess\nthe privileges is determined by the SQL SECURITY values of\nthe view v\nand the function f().\n \nThe DEFINER and SQL SECURITY clauses for views are\nextensions to\nstandard SQL. In standard SQL, views are handled using the\nrules for\nSQL SECURITY INVOKER.\n \nIf you invoke a view that was created before MySQL 5.1.2, it\nis\ntreated as though it was created with a SQL SECURITY DEFINER\nclause\nand with a DEFINER value that is the same as your account.\nHowever,\nbecause the actual definer is unknown, MySQL issues a\nwarning. To make\nthe warning go away, it is sufficient to re-create the view\nso that\nthe view definition includes a DEFINER clause.\n \nThe optional ALGORITHM clause is an extension to standard\nSQL. It\naffects how MariaDB processes the view. ALGORITHM takes\nthree values:\nMERGE, TEMPTABLE, or UNDEFINED. The default algorithm is\nUNDEFINED if\nno ALGORITHM clause is present. See View Algorithms for more\ninformation.\n \nSome views are updatable. That is, you can use them in\nstatements such\nas UPDATE, DELETE, or INSERT to update the contents of the\nunderlying\ntable. For a view to be updatable, there must be a\none-to-one\nrelationship between the rows in the view and the rows in\nthe\nunderlying table. There are also certain other constructs\nthat make a\nview non-updatable. See Inserting and Updating with Views.\n \nWITH CHECK OPTION\n \nThe WITH CHECK OPTION clause can be given for an updatable\nview to\nprevent inserts or updates to rows except those for which\nthe WHERE\nclause in the select_statement is true.\n \nIn a WITH CHECK OPTION clause for an updatable view, the\nLOCAL and\nCASCADED keywords determine the scope of check testing when\nthe view\nis defined in terms of another view. The LOCAL keyword\nrestricts the\nCHECK OPTION only to the view being defined. CASCADED causes\nthe\nchecks for underlying views to be evaluated as well. When\nneither\nkeyword is given, the default is CASCADED.\n \nFor more information about updatable views and the WITH\nCHECK OPTION\nclause, see\nInserting and Updating with Views.\n \nIF NOT EXISTS\n \nThe IF NOT EXISTS clause was added in MariaDB 10.1.3\n \nWhen the IF NOT EXISTS clause is used, MariaDB will return a\nwarning instead of an error if the specified view already\nexists. Cannot be used together with the OR REPLACE clause.\n \nExamples\n-------- \nCREATE TABLE t (a INT, b INT) ENGINE = InnoDB;\n \nINSERT INTO t VALUES (1,1), (2,2), (3,3);\n \nCREATE VIEW v AS SELECT a, a*2 AS a2 FROM t;\n \nSELECT * FROM v;\n \n+------+------+\n| a | a2 |\n+------+------+\n| 1 | 2 |\n| 2 | 4 |\n| 3 | 6 |\n+------+------+\n \nOR REPLACE and IF NOT EXISTS:\n \nCREATE VIEW v AS SELECT a, a*2 AS a2 FROM t;\n \nERROR 1050 (42S01): Table \'v\' already exists\n \nCREATE OR REPLACE VIEW v AS SELECT a, a*2 AS a2 FROM t;\n \nQuery OK, 0 rows affected (0.04 sec)\n \nCREATE VIEW IF NOT EXISTS v AS SELECT a, a*2 AS a2 FROM t;\n \nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n \nSHOW WARNINGS;\n \n+-------+------+--------------------------+\n| Level | Code | Message |\n+-------+------+--------------------------+\n| Note | 1050 | Table \'v\' already exists |\n+-------+------+--------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/create-view/','','https://mariadb.com/kb/en/library/create-view/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (664,39,'DROP DATABASE','Syntax\n------ \nDROP {DATABASE | SCHEMA} [IF EXISTS] db_name\n \nDescription\n----------- \nDROP DATABASE drops all tables in the database and deletes\nthe database. Be very careful with this statement! To use\nDROP DATABASE,\nyou need the DROP privilege on the database. DROP SCHEMA is\na synonym for DROP DATABASE.\n \nImportant: When a database is dropped, user privileges on\nthe database are not automatically dropped. See GRANT.\n \nIF EXISTS\n \nUse IF EXISTS to prevent an error from occurring for\ndatabases that do not exist. A NOTE is generated for each\nnon-existent database when using IF EXISTS. See SHOW\nWARNINGS.\n \nExamples\n-------- \nDROP DATABASE bufg;\n \nQuery OK, 0 rows affected (0.39 sec)\n \nDROP DATABASE bufg;\n \nERROR 1008 (HY000): Can\'t drop database \'bufg\'; database\ndoesn\'t exist\n \n \\W\nShow warnings enabled.\n \nDROP DATABASE IF EXISTS bufg;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\nNote (Code 1008): Can\'t drop database \'bufg\'; database\ndoesn\'t exist\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-database/','','https://mariadb.com/kb/en/library/drop-database/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (665,39,'DROP EVENT','Syntax\n------ \nDROP EVENT [IF EXISTS] event_name\n \nDescription\n----------- \nThis statement drops the event named event_name. The event\nimmediately\nceases being active, and is deleted completely from the\nserver.\n \nIf the event does not exist, the error\nERROR 1517 (HY000): Unknown event \'event_name\'\nresults. You can override this and cause the\nstatement to generate a NOTE for non-existent events instead\nby using\nIF EXISTS. See SHOW WARNINGS.\n \nThis statement requires the EVENT privilege. In MySQL 5.1.11\nand earlier, an event could be dropped only\nby its definer, or by a user having the SUPER privilege.\n \nExamples\n-------- \nDROP EVENT myevent3;\n \nUsing the IF EXISTS clause:\n \nDROP EVENT IF EXISTS myevent3;\n \nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n \nSHOW WARNINGS;\n \n+-------+------+-------------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------------+\n| Note | 1305 | Event myevent3 does not exist |\n+-------+------+-------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-event/','','https://mariadb.com/kb/en/library/drop-event/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (666,39,'DROP FUNCTION','Syntax\n------ \nDROP FUNCTION [IF EXISTS] f_name\n \nDescription\n----------- \nThe DROP FUNCTION statement is used to drop a stored\nfunction or a user-defined function (UDF). That is, the\nspecified routine is removed from the server, along with all\nprivileges specific to the function. You must have the ALTER\nROUTINE privilege for the routine in order to drop it. If\nthe automatic_sp_privileges server system variable is set,\nboth the ALTER ROUTINE and EXECUTE privileges are granted\nautomatically to the routine creator - see Stored Routine\nPrivileges.\n \nIF EXISTS\n \nThe IF EXISTS clause is a MySQL/MariaDB extension. It\nprevents an error from occurring if the function does not\nexist. A\nNOTE is produced that can be viewed with SHOW WARNINGS.\n \nFor dropping a user-defined functions (UDF), see DROP\nFUNCTION UDF.\n \nExamples\n-------- \nDROP FUNCTION hello;\n \nQuery OK, 0 rows affected (0.042 sec)\n \nDROP FUNCTION hello;\n \nERROR 1305 (42000): FUNCTION test.hello does not exist\n \nDROP FUNCTION IF EXISTS hello;\n \nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------+\n| Note | 1305 | FUNCTION test.hello does not exist |\n+-------+------+------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-function/','','https://mariadb.com/kb/en/library/drop-function/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (667,39,'DROP INDEX','Syntax\n------ \nDROP INDEX [IF EXISTS] index_name ON tbl_name \n [WAIT n |NOWAIT]\n [algorithm_option | lock_option] ...\n \nalgorithm_option:\n ALGORITHM [=] {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT}\n \nlock_option:\n LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}\n \nDescription\n----------- \nDROP INDEX drops the index named index_name from the table\ntbl_name.\nThis statement is mapped to an ALTER TABLE statement to drop\nthe\nindex.\n \nIf another connection is using the table, a metadata lock is\nactive, and this statement will wait until the lock is\nreleased. This is also true for non-transactional tables.\n \nSee ALTER TABLE.\n \nAnother shortcut, CREATE INDEX, allows the creation of an\nindex.\n \nTo remove the primary key, `PRIMARY` must be specified as\nindex_name. Note that the quotes are necessary, because\nPRIMARY is a keyword.\n \nPrivileges\n \nExecuting the DROP INDEX statement requires the INDEX\nprivilege for the table or the database.\n \nOnline DDL\n \nIn MariaDB 10.0 and later, online DDL is supported with the\nALGORITHM and LOCK clauses.\n \nSee InnoDB Online DDL Overview for more information on\nonline DDL with InnoDB.\n \nDROP INDEX IF EXISTS ...\n \nThe IF EXISTS clause was added in MariaDB 10.1.4.\n \nIf the IF EXISTS clause is used, then MariaDB will return a\nwarning instead of an error if the index does not exist.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nALGORITHM\n \nSee ALTER TABLE: ALGORITHM for more information.\n \nLOCK\n \nSee ALTER TABLE: LOCK for more information.\n \nProgress Reporting\n \nMariaDB provides progress reporting for DROP INDEX statement\nfor clients\nthat support the new progress reporting protocol. For\nexample, if you were using the mysql client, then the\nprogress report might look like this::\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-index/','','https://mariadb.com/kb/en/library/drop-index/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (668,39,'DROP PACKAGE','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nDROP PACKAGE [IF EXISTS] [ db_name . ] package_name\n \nDescription\n----------- \nThe DROP PACKAGE statement can be used when Oracle SQL_MODE\nis set.\n \nThe DROP PACKAGE statement drops a stored package entirely:\nDrops the package specification (earlier created using the\nCREATE PACKAGE statement).\nDrops the package implementation, if the implementation was\nalready created using the CREATE PACKAGE BODY statement.\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-package/','','https://mariadb.com/kb/en/library/drop-package/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (669,39,'DROP PACKAGE BODY','Oracle-style packages were introduced in MariaDB 10.3.5.\n \nSyntax\n------ \nDROP PACKAGE BODY [IF EXISTS] [ db_name . ] package_name\n \nDescription\n----------- \nThe DROP PACKAGE BODY statement can be used when Oracle\nSQL_MODE is set.\n \nThe DROP PACKAGE BODY statement drops the package body (i.e\nthe implementation), previously created using the CREATE\nPACKAGE BODY statement.\n \nNote, DROP PACKAGE BODY drops only the package\nimplementation, but does not drop the package specification.\nUse DROP PACKAGE to drop the package entirely (i.e. both\nimplementation and specification).\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-package-body/','','https://mariadb.com/kb/en/library/drop-package-body/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (670,39,'DROP PROCEDURE','Syntax\n------ \nDROP PROCEDURE [IF EXISTS] sp_name\n \nDescription\n----------- \nThis statement is used to drop a stored procedure. That is,\nthe\nspecified routine is removed from the server along with all\nprivileges specific to the procedure. You must have the\nALTER ROUTINE privilege for the routine. If the\nautomatic_sp_privileges server system variable is set, that\nprivilege and EXECUTE are granted automatically to the\nroutine creator - see Stored Routine Privileges.\n \nThe IF EXISTS clause is a MySQL/MariaDB extension. It\nprevents an error from occurring if the procedure or\nfunction does not exist. A\nNOTE is produced that can be viewed with SHOW WARNINGS.\n \nWhile this statement takes effect immediately, threads which\nare executing a procedure can continue execution.\n \nExamples\n-------- \nDROP PROCEDURE simpleproc;\n \nIF EXISTS:\n \nDROP PROCEDURE simpleproc;\n \nERROR 1305 (42000): PROCEDURE test.simpleproc does not exist\n \nDROP PROCEDURE IF EXISTS simpleproc;\n \nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------------+\n| Note | 1305 | PROCEDURE test.simpleproc does not exist |\n+-------+------+------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-procedure/','','https://mariadb.com/kb/en/library/drop-procedure/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (671,39,'DROP SEQUENCE','DROP SEQUENCE was introduced in MariaDB 10.3.\n \nSyntax\n------ \nDROP [TEMPORARY] SEQUENCE [IF EXISTS] [/*COMMENT TO SAVE*/]\n sequence_name [, sequence_name] ...\n \nDescription\n----------- \nDROP SEQUENCE removes one or more sequences created with\nCREATE SEQUENCE. You must have the DROP privilege for each\nsequence. MariaDB returns an error indicating by name which\nnon-existing tables it was unable to drop, but it also drops\nall of the tables in the list that do exist.\n \nImportant: When a table is dropped, user privileges on the\ntable are not automatically dropped. See GRANT.\n \nIf another connection is using the sequence, a metadata lock\nis active, and this statement will wait until the lock is\nreleased. This is also true for non-transactional tables.\n \nFor each referenced sequence, DROP SEQUENCE drops a\ntemporary sequence with that name, if it exists. If it does\nnot exist, and the TEMPORARY keyword is not used, it drops a\nnon-temporary sequence with the same name, if it exists. The\nTEMPORARY keyword ensures that a non-temporary sequence will\nnot accidentally be dropped.\n \nUse IF EXISTS to prevent an error from occurring for\nsequences that do not exist. A NOTE is generated for each\nnon-existent sequence when using IF EXISTS. See SHOW\nWARNINGS.\n \nDROP SEQUENCE requires the DROP privilege.\n \nNotes\n \nDROP SEQUENCE only removes sequences, not tables. However,\nDROP TABLE can remove both sequences and tables.\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-sequence/','','https://mariadb.com/kb/en/library/drop-sequence/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (672,39,'DROP SERVER','Syntax\n------ \nDROP SERVER [ IF EXISTS ] server_name\n \nDescription\n----------- \nDrops the server definition for the server named\nserver_name. The\ncorresponding row within the mysql.servers table will be\ndeleted. This\nstatement requires the SUPER privilege. \n \nDropping a server for a table does not affect any\nFederatedX, FEDERATED or Spider tables that used this\nconnection information when they were created. \n \nIF EXISTS\n \nIf the IF EXISTS clause is used, MariaDB will not return an\nerror if the server does not exist. Unlike all other\nstatements, DROP SERVER IF EXISTS does not issue a note if\nthe server does not exist. See MDEV-9400.\n \nExamples\n-------- \nDROP SERVER s;\n \nIF EXISTS:\n \nDROP SERVER s;\n \nERROR 1477 (HY000): The foreign server name you are trying\nto reference \n does not exist. Data source error: s\n \nDROP SERVER IF EXISTS s;\n \nQuery OK, 0 rows affected (0.00 sec)\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-server/','','https://mariadb.com/kb/en/library/drop-server/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (673,39,'DROP TABLE','Syntax\n------ \nDROP [TEMPORARY] TABLE [IF EXISTS] [/*COMMENT TO SAVE*/]\n tbl_name [, tbl_name] ...\n [WAIT n|NOWAIT]\n [RESTRICT | CASCADE]\n \nDescription\n----------- \nDROP TABLE removes one or more tables. You must have the\nDROP privilege\nfor each table. All table data and the table definition are\nremoved, as well as triggers associated to the table, so be\ncareful with this statement! If any of the tables named in\nthe argument list do\nnot exist, MariaDB returns an error indicating by name which\nnon-existing tables\nit was unable to drop, but it also drops all of the tables\nin the list that do\nexist.\n \nImportant: When a table is dropped, user privileges on the\ntable are not\nautomatically dropped. See GRANT.\n \nIf another connection is using the table, a metadata lock is\nactive, and this statement will wait until the lock is\nreleased. This is also true for non-transactional tables.\n \nNote that for a partitioned table, DROP TABLE permanently\nremoves the table\ndefinition, all of its partitions, and all of the data which\nwas stored in\nthose partitions. It also removes the partitioning\ndefinition (.par) file\nassociated with the dropped table.\n \nFor each referenced table, DROP TABLE drops a temporary\ntable with that name, if it exists. If it does not exist,\nand the TEMPORARY keyword is not used, it drops a\nnon-temporary table with the same name, if it exists. The\nTEMPORARY keyword ensures that a non-temporary table will\nnot accidentally be dropped.\n \nUse IF EXISTS to prevent an error from occurring for tables\nthat do not\nexist. A NOTE is generated for each non-existent table when\nusing\nIF EXISTS. See SHOW WARNINGS.\n \nIf a foreign key references this table, the table cannot be\ndropped. In this case, it is necessary to drop the foreign\nkey first.\n \nRESTRICT and CASCADE are allowed to make porting from other\ndatabase systems easier. In MariaDB, they do nothing.\n \nSince MariaDB 5.5.27, the comment before the tablenames\n(that /*COMMENT TO SAVE*/) is stored in the binary log. That\nfeature can be used by replication tools to send their\ninternal messages.\n \nIt is possible to specify table names as db_name.tab_name.\nThis is useful to delete tables from multiple databases with\none statement. See Identifier Qualifiers for details.\n \nThe DROP privilege is required to use DROP TABLE on\nnon-temporary tables. For temporary tables, no privilege is\nrequired, because such tables are only visible for the\ncurrent session.\n \nNote: DROP TABLE automatically commits the current active\ntransaction,\nunless you use the TEMPORARY keyword.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nDROP TABLE in replication\n \nDROP TABLE has the following characteristics in replication:\nDROP TABLE IF EXISTS are always logged.\nDROP TABLE without IF EXISTS for tables that don\'t exist\nare not written to the binary log.\nDropping of TEMPORARY tables are prefixed in the log with\nTEMPORARY. These drops are only logged when running\nstatement or mixed mode replication.\nOne DROP TABLE statement can be logged with up to 3\ndifferent DROP statements:\nDROP TEMPORARY TABLE\nlist_of_non_transactional_temporary_tables\nDROP TEMPORARY TABLE list_of_transactional_temporary_tables\nDROP TABLE list_of_normal_tables\n \nStarting from MariaDB 10.0.8, DROP TABLE on the master is\ntreated on the slave as DROP TABLE IF EXISTS. You can change\nthat by setting slave-ddl-exec-mode to STRICT.\n \nDropping an Internal #sql-... Table\n \nIf the mysqld process is killed during an ALTER TABLE you\nmay find a table named #sql-... in your data directory. In\nMariaDB 10.3, InnoDB tables with this prefix will de deleted\nautomatically during startup.\nIn MariaDB 10.4 we will ensure that these temporary tables\nwill always be deleted automatically.\n \nIf you want to delete one of these tables explicitly you can\ndo so by using the following syntax:\n \nDROP TABLE `#mysql50##sql-...`;\n \nWhen running an ALTER TABLE…ALGORITHM=INPLACE that\nrebuilds the table, InnoDB will create an internal #sql-ib\ntable. For these tables, the .frm file will be called\nsomething else. In order to drop such a table after a server\ncrash, you must rename the #sql*.frm file to match the\n#sql-ib*.ibd file.\n \nExamples\n-------- \nDROP TABLE Employees, Customers;\n \nNotes\n \nBeware that DROP TABLE can drop both tables and sequences.\nThis is mainly done to allow old tools like mysqldump to\nwork with sequences.\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-table/','','https://mariadb.com/kb/en/library/drop-table/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (674,39,'DROP TABLESPACE','The DROP TABLESPACE statement is not supported by MariaDB.\nIt was originally inherited from MySQL NDB Cluster. In MySQL\n5.7 and later, the statement is also supported for InnoDB.\nHowever, MariaDB has chosen not to include that specific\nfeature. See MDEV-19294 for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/drop-tablespace/','','https://mariadb.com/kb/en/library/drop-tablespace/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (675,39,'DROP TRIGGER','Syntax\n------ \nDROP TRIGGER [IF EXISTS] [schema_name.]trigger_name\n \nDescription\n----------- \nThis statement drops a trigger. The schema (database) name\nis optional. If the\nschema is omitted, the trigger is dropped from the default\nschema.\nIts use requires the TRIGGER privilege for the table\nassociated with the trigger.\n \nUse IF EXISTS to prevent an error from occurring for a\ntrigger that does not exist. A NOTE is generated for a\nnon-existent trigger\nwhen using IF EXISTS. See SHOW WARNINGS.\n \nNote: Triggers for a table are also dropped if you drop the\ntable.\n \nExamples\n-------- \nDROP TRIGGER test.example_trigger;\n \nUsing the IF EXISTS clause:\n \nDROP TRIGGER IF EXISTS test.example_trigger;\n \nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n \nSHOW WARNINGS;\n \n+-------+------+------------------------+\n| Level | Code | Message |\n+-------+------+------------------------+\n| Note | 1360 | Trigger does not exist |\n+-------+------+------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-trigger/','','https://mariadb.com/kb/en/library/drop-trigger/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (676,39,'DROP VIEW','Syntax\n------ \nDROP VIEW [IF EXISTS]\n view_name [, view_name] ...\n [RESTRICT | CASCADE]\n \nDescription\n----------- \nDROP VIEW removes one or more views. You must have the DROP\nprivilege for\neach view. If any of the views named in the argument list do\nnot exist, MariaDB\nreturns an error indicating by name which non-existing views\nit was unable to\ndrop, but it also drops all of the views in the list that do\nexist.\n \nThe IF EXISTS clause prevents an error from occurring for\nviews that don\'t\nexist. When this clause is given, a NOTE is generated for\neach non-existent\nview. See SHOW WARNINGS.\n \nRESTRICT and CASCADE, if given, are parsed and ignored.\n \nIt is possible to specify view names as db_name.view_name.\nThis is useful to delete views from multiple databases with\none statement. See Identifier Qualifiers for details.\n \nThe DROP privilege is required to use DROP TABLE on\nnon-temporary tables. For temporary tables, no privilege is\nrequired, because such tables are only visible for the\ncurrent session.\n \nIf a view references another view, it will be possible to\ndrop the referenced view. However, the other view will\nreference a view which does not exist any more. Thus,\nquerying it will produce an error similar to the following:\n \nERROR 1356 (HY000): View \'db_name.view_name\' references\ninvalid table(s) or \ncolumn(s) or function(s) or definer/invoker of view lack\nrights to use them\n \nThis problem is reported in the output of CHECK TABLE.\n \nNote that it is not necessary to use DROP VIEW to replace an\nexisting view, because CREATE VIEW has an OR REPLACE clause.\n \nExamples\n-------- \nDROP VIEW v,v2;\n \nGiven views v and v2, but no view v3\n \nDROP VIEW v,v2,v3;\nERROR 1051 (42S02): Unknown table \'v3\'\n \nDROP VIEW IF EXISTS v,v2,v3;\nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n \nSHOW WARNINGS;\n+-------+------+-------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------+\n| Note | 1051 | Unknown table \'test.v3\' |\n+-------+------+-------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/drop-view/','','https://mariadb.com/kb/en/library/drop-view/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (677,39,'MERGE','Description\n----------- \nThe MERGE storage engine, also known as the MRG_MyISAM\nengine, is a\ncollection of identical MyISAM tables that can be used as\none.\n\"Identical\" means that all tables have identical column\nand index\ninformation. You cannot merge MyISAM tables in which the\ncolumns are\nlisted in a different order, do not have exactly the same\ncolumns, or\nhave the indexes in different order. However, any or all of\nthe MyISAM\ntables can be compressed with myisampack. Columns names and\nindexes names can be different, as long as data types and\nNULL/NOT NULL clauses are the same. Differences in\ntable options such as AVG_ROW_LENGTH, MAX_ROWS, or PACK_KEYS\ndo not\nmatter.\n \nEach index in a MERGE table must match an index in\nunderlying MyISAM tables, but the opposite is not true.\nAlso, a MERGE table cannot have a PRIMARY KEY or UNIQUE\nindexes, because it cannot enforce uniqueness over all\nunderlying tables.\n \nThe following options are meaningful for MERGE tables:\nUNION. This option specifies the list of the underlying\nMyISAM tables. The list is enclosed between parentheses and\nseparated with commas.\nINSERT_METHOD. This options specifies whether, and how,\nINSERTs are allowed for the table. Allowed values are: NO\n(INSERTs are not allowed), FIRST (new rows will be written\ninto the first table specified in the UNION list), LAST (new\nrows will be written into the last table specified in the\nUNION list). The default value is NO.\n \nIf you define a MERGE table with a definition which is\ndifferent from the underlying MyISAM tables, or one of the\nunderlying tables is not MyISAM, the CREATE TABLE statement\nwill not return any error. But any statement which involves\nthe table will produce an error like the following:\n \nERROR 1168 (HY000): Unable to open underlying table which is\ndifferently defined \n or of non-MyISAM type or doesn\'t exist\n \nA CHECK TABLE will show more information about the problem.\n \nThe error is also produced if the table is properly define,\nbut an underlying table\'s definition changes at some point\nin time.\n \nIf you try to insert a new row into a MERGE table with\nINSERT_METHOD=NO, you will get an error like the following:\n \nERROR 1036 (HY000): Table \'tbl_name\' is read only\n \nIt is possible to build a MERGE table on MyISAM tables which\nhave one or more virtual columns. MERGE itself does not\nsupport virtual columns, thus such columns will be seen as\nregular columns. The data types and sizes will still need to\nbe identical, and they cannot be NOT NULL.\n \nExamples\n-------- \nCREATE TABLE t1 (\n a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n message CHAR(20)) ENGINE=MyISAM;\n \nCREATE TABLE t2 (\n a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n message CHAR(20)) ENGINE=MyISAM;\n \nINSERT INTO t1 (message) VALUES\n(\'Testing\'),(\'table\'),(\'t1\');\n \nINSERT INTO t2 (message) VALUES\n(\'Testing\'),(\'table\'),(\'t2\');\n \nCREATE TABLE total (\n a INT NOT NULL AUTO_INCREMENT,\n message CHAR(20), INDEX(a))\n ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;\n \nSELECT * FROM total;\n \n+---+---------+\n| a | message |\n+---+---------+\n| 1 | Testing |\n| 2 | table |\n| 3 | t1 |\n| 1 | Testing |\n| 2 | table |\n| 3 | t2 |\n+---+---------+\n \nIn the following example, we\'ll create three MyISAM tables,\nand then a MERGE table on them. However, one of them uses a\ndifferent data type for the column b, so a SELECT will\nproduce an error:\n \nCREATE TABLE t1 (\n a INT,\n b INT\n) ENGINE = MyISAM;\n \nCREATE TABLE t2 (\n a INT,\n b INT\n) ENGINE = MyISAM;\n \nCREATE TABLE t3 (\n a INT,\n b TINYINT\n) ENGINE = MyISAM;\n \nCREATE TABLE t_mrg (\n a INT,\n b INT\n) ENGINE = MERGE,UNION=(t1,t2,t3);\n \nSELECT * FROM t_mrg;\n \nERROR 1168 (HY000): Unable to open underlying table which is\ndifferently defined\n or of non-MyISAM type or doesn\'t exist\n \nTo find out what\'s wrong, we\'ll use a CHECK TABLE:\n \nCHECK TABLE t_mrg;\n \n+------------+-------+----------+-----------------------------------------------------------------------------------------------------+\n| Table | Op | Msg_type | Msg_text |\n+------------+-------+----------+-----------------------------------------------------------------------------------------------------+\n| test.t_mrg | check | Error | Table \'test.t3\' is\ndifferently defined or of non-MyISAM type or doesn\'t exist\n|\n| test.t_mrg | check | Error | Unable to open underlying\ntable which is differently defined or of non-MyISAM type or\ndoesn\'t exist |\n| test.t_mrg | check | error | Corrupt |\n+------------+-------+----------+-----------------------------------------------------------------------------------------------------+\n \nNow, we know that the problem is in t3\'s definition.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/merge/','','https://mariadb.com/kb/en/library/merge/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (678,39,'RENAME TABLE','Syntax\n------ \nRENAME TABLE tbl_name \n [WAIT n | NOWAIT]\n TO new_tbl_name\n [, tbl_name2 TO new_tbl_name2] ...\n \nDescription\n----------- \nThis statement renames one or more tables or views, but not\nthe privileges associated to them.\n \nThe rename operation is done atomically, which means that no\nother session can\naccess any of the tables while the rename is running. For\nexample, if you have\nan existing table old_table, you can create another table\nnew_table that has the same structure but is empty, and then\nreplace the existing table with the empty one as follows\n(assuming that\nbackup_table does not already exist):\n \nCREATE TABLE new_table (...);\nRENAME TABLE old_table TO backup_table, new_table TO\nold_table;\n \ntbl_name can optionally be specified as db_name.tbl_name.\nSee Identifier Qualifiers. This allows to use RENAME to move\na table from a database to another (as long as they are on\nthe same filesystem):\n \nRENAME TABLE db1.t TO db2.t;\n \nNote that moving a table to another database is not possible\nif it has some triggers. Trying to do so produces the\nfollowing error:\n \nERROR 1435 (HY000): Trigger in wrong schema\n \nAlso, views cannot be moved to another database:\n \nERROR 1450 (HY000): Changing schema from \'old_db\' to\n\'new_db\' is not allowed.\n \nIf a RENAME TABLE renames more than one table and one\nrenaming fails, all renames executed by the same statement\nare rolled back.\n \nRenames are always executed in the specified order. Knowing\nthis, it is also possible to swap two tables\' names:\n \nRENAME TABLE t1 TO tmp_table,\n t2 TO t1,\n tmp_table TO t2;\n \nPrivileges\n \nExecuting the RENAME TABLE statement requires the DROP,\nCREATE and INSERT privileges for the table or the database.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/rename-table/','','https://mariadb.com/kb/en/library/rename-table/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (679,39,'TRUNCATE TABLE','Syntax\n------ \nTRUNCATE [TABLE] tbl_name\n [WAIT n | NOWAIT]\n \nDescription\n----------- \nTRUNCATE TABLE empties a table completely. It requires the\nDROP privilege. See GRANT.\n \ntbl_name can also be specified in the form db_name.tbl_name\n(see Identifier Qualifiers).\n \nLogically, TRUNCATE TABLE is equivalent to a DELETE\nstatement that deletes all rows, but there are practical\ndifferences under some circumstances.\n \nTRUNCATE TABLE will fail for an InnoDB table if any FOREIGN\nKEY constraints from other tables reference the table,\nreturning the error:\n \nERROR 1701 (42000): Cannot truncate a table referenced in a\nforeign key constraint\n \nForeign Key constraints between columns in the same table\nare permitted.\n \nFor an InnoDB table, if there are no FOREIGN KEY\nconstraints, InnoDB performs fast truncation by dropping the\noriginal table and creating an empty one with the same\ndefinition, which is much faster than deleting rows one by\none. The AUTO_INCREMENT counter is reset by TRUNCATE TABLE,\nregardless of whether there is a FOREIGN KEY constraint.\n \nThe count of rows affected by TRUNCATE TABLE is accurate\nonly\nwhen it is mapped to a DELETE statement.\n \nFor other storage engines, TRUNCATE TABLE differs from\nDELETE in the following ways:\nTruncate operations drop and re-create the table, which is\nmuch\n faster than deleting rows one by one, particularly for\nlarge tables.\nTruncate operations cause an implicit commit.\nTruncation operations cannot be performed if the session\nholds an\n active table lock.\nTruncation operations do not return a meaningful value for\nthe number\n of deleted rows. The usual result is \"0 rows affected,\"\nwhich should\n be interpreted as \"no information.\"\nAs long as the table format file tbl_name.frm is valid, the\n table can be re-created as an empty table\n with TRUNCATE TABLE, even if the data or index files have\nbecome\n corrupted.\nThe table handler does not remember the last\n used AUTO_INCREMENT value, but starts counting\n from the beginning. This is true even for MyISAM and\nInnoDB, which normally\n do not reuse sequence values.\nWhen used with partitioned tables, TRUNCATE TABLE preserves\n the partitioning; that is, the data and index files are\ndropped and\n re-created, while the partition definitions (.par) file is\n unaffected.\nSince truncation of a table does not make any use of DELETE,\n the TRUNCATE statement does not invoke ON DELETE triggers.\nTRUNCATE TABLE will only reset the values in the Performance\nSchema summary tables to zero or null, and will not remove\nthe rows.\n \nFor the purposes of binary logging and replication, TRUNCATE\nTABLE is treated as DROP TABLE followed by CREATE TABLE (DDL\nrather than DML).\n \nTRUNCATE TABLE does not work on views. Currently, TRUNCATE\nTABLE drops all historical records from a system-versioned\ntable.\n \nWAIT/NOWAIT\n \nSet the lock wait timeout. See WAIT and NOWAIT.\n \nOracle-mode\n \nOracle-mode from MariaDB 10.3 permits the optional keywords\nREUSE STORAGE or DROP STORAGE to be used.\n \nTRUNCATE [TABLE] tbl_name [{DROP | REUSE} STORAGE]\n \nThese have no effect on the operation.\n \nPerformance\n \nTRUNCATE TABLE is faster than DELETE, because it drops and\nre-creates a table.\n \nWith XtraDB/InnoDB, TRUNCATE TABLE is slower if\ninnodb_file_per_table=ON is set (the default since MariaDB\n5.5). This is because TRUNCATE TABLE unlinks the underlying\ntablespace file, which can be an expensive operation. See\nMDEV-8069 for more details.\n \nThe performance issues with innodb_file_per_table=ON can be\nexacerbated in cases where the InnoDB buffer pool is very\nlarge and innodb_adaptive_hash_index=ON is set. In that\ncase, using DROP TABLE followed by CREATE TABLE instead of\nTRUNCATE TABLE may perform better. Setting\ninnodb_adaptive_hash_index=OFF can also help. In MariaDB\n10.2.19 and later, this performance can also be improved by\nsetting innodb_safe_truncate=OFF. See MDEV-9459 for more\ndetails.\n \nSetting innodb_adaptive_hash_index=OFF can also improve\nTRUNCATE TABLE performance in general. See MDEV-16796 for\nmore details.\n \n\n\nURL: https://mariadb.com/kb/en/library/truncate-table/','','https://mariadb.com/kb/en/library/truncate-table/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (680,40,'LASTVAL','LASTVAL is a synonym for PREVIOUS VALUE for sequence_name.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/lastval/','','https://mariadb.com/kb/en/library/lastval/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (681,40,'NEXT VALUE for sequence_name','SEQUENCEs were introduced in MariaDB 10.3\n \nSyntax\n------ \nNEXT VALUE FOR sequence\n \nor\n \nNEXTVAL(sequence_name)\n \nor in Oracle mode (SQL_MODE=ORACLE)\n \nsequence_name.nextval\n \nNEXT VALUE FOR is ANSI SQL syntax while NEXTVAL() is\nPostgreSQL syntax.\n \nDescription\n----------- \nGenerate next value for a SEQUENCE.\nYou can greatly speed up NEXT VALUE by creating the sequence\nwith the CACHE option. If not, every NEXT VALUE usage will\ncause changes in the stored SEQUENCE table.\nWhen using NEXT VALUE the value will be reserved at once and\nwill not be reused, except if the SEQUENCE was created with\nCYCLE. This means that when you are using SEQUENCEs you have\nto expect gaps in the generated sequence numbers.\nIf one updates the SEQUENCE with SETVAL() or ALTER SEQUENCE\n... RESTART, NEXT VALUE FOR will notice this and start from\nthe next requested value.\nFLUSH TABLES will close the sequence and the next sequence\nnumber generated will be according to what\'s stored in the\nSEQUENCE object. In effect, this will discard the cached\nvalues.\nNEXT VALUE requires the INSERT privilege.\n \nYou can also use NEXT VALUE FOR sequence for column DEFAULT.\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/next-value-for-sequence_name/','','https://mariadb.com/kb/en/library/next-value-for-sequence_name/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (682,40,'NEXTVAL','NEXTVAL is a synonym for NEXT VALUE for sequence_name.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/library/nextval/','','https://mariadb.com/kb/en/library/nextval/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (683,40,'PREVIOUS VALUE FOR sequence_name','SEQUENCEs were introduced in MariaDB 10.3.\n \nSyntax\n------ \nPREVIOUS VALUE FOR sequence_name\n \nor\n \nLASTVAL(sequence_name)\n \nor in Oracle mode (SQL_MODE=ORACLE)\n \nsequence_name.currval\n \nPREVIOUS VALUE FOR is IBM DB2 syntax while LASTVAL() is\nPostgreSQL syntax.\n \nDescription\n----------- \nGet last value in the current connection generated from a\nsequence.\nIf the sequence has not yet been used by the connection,\nPREVIOUS VALUE FOR returns NULL\nIf a SEQUENCE has been dropped and re-created then it\'s\ntreated as a new SEQUENCE and PREVIOUS VALUE FOR will return\nNULL.\nFLUSH TABLES has no effect on PREVIOUS VALUE FOR.\nPrevious values for all used sequences are stored per\nconnection until connection ends.\n \nPREVIOUS VALUE FOR requires the SELECT privilege.\n \nExample\n \nSELECT PREVIOUS VALUE FOR s;\n \n+----------------------+\n| PREVIOUS VALUE FOR s |\n+----------------------+\n| 100 |\n+----------------------+\n \n\n\nURL:\nhttps://mariadb.com/kb/en/library/previous-value-for-sequence_name/','','https://mariadb.com/kb/en/library/previous-value-for-sequence_name/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (684,40,'Sequence Overview','Sequences were introduced in MariaDB 10.3.\n \nIntroduction\n \nA sequence is an object that generates a sequence of numeric\nvalues, as specified by the CREATE SEQUENCE statement. \n \nCREATE SEQUENCE will create a sequence that generates new\nvalues when called with NEXT VALUE FOR sequence_name. It\'s\nan alternative to AUTO INCREMENT when one wants to have more\ncontrol of how the numbers are generated. As the SEQUENCE\ncaches values (up to the CACHE value in the CREATE SEQUENCE\nstatement, by default 1000) it can in some cases be much\nfaster than AUTO INCREMENT. Another benefit is that one can\naccess the last value generated by all used sequences, which\nsolves one of the limitations with LAST_INSERT_ID().\n \nCreating a Sequence\n \nThe CREATE SEQUENCE statement is used to create a sequence.\nHere is an example of a sequence starting at 100,\nincrementing by 10 each time:\n \nCREATE SEQUENCE s START WITH 100 INCREMENT BY 10;\n \nThe CREATE SEQUENCE statement, along with defaults, can be\nviewd with the SHOW CREATE SEQUENCE STATEMENT, for example:\n \nSHOW CREATE SEQUENCE s\\G\n*************************** 1. row\n***************************\n Table: s\nCreate Table: CREATE SEQUENCE `s` start with 100 minvalue 1\nmaxvalue 9223372036854775806 \n increment by 10 cache 1000 nocycle ENGINE=InnoDB\n \nUsing Sequence Objects\n \nTo get the next value from a sequence, use\n \nNEXT VALUE FOR sequence_name\n \nor\n \nNEXTVAL(sequence_name)\n \nor in Oracle mode (SQL_MODE=ORACLE)\n \nsequence_name.nextval\n \nFor retrieving the last value used by the current connection\nfrom a sequence\nuse:\n \nPREVIOUS VALUE FOR sequence_name\n \nor\n \nLASTVAL(sequence_name)\n \nor in Oracle mode (SQL_MODE=ORACLE)\n \nsequence_name.currval\n \nFor example:\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 100 |\n+------------+\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 110 |\n+------------+\n \nSELECT LASTVAL(s);\n+------------+\n| LASTVAL(s) |\n+------------+\n| 110 |\n+------------+\n \nUsing Sequences in DEFAULT\n \nStarting from 10.3.3 you can use Sequences in DEFAULT:\n \ncreate sequence s1;\n \ncreate table t1 (a int primary key default (next value for\ns1), b int);\ninsert into t1 (b) values (1),(2);\nselect * from t1;\n \n+---+------+\n| a | b |\n+---+------+\n| 1 | 1 |\n| 2 | 2 |\n+---+------+\n \nChanging a Sequence\n \nThe ALTER SEQUENCE statement is used for changing sequences.\nFor example, to restart the sequence at another value:\n \nALTER SEQUENCE s RESTART 50;\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 50 |\n+------------+\n \nThe SETVAL function can also be used to set the next value\nto be returned for a SEQUENCE, for example:\n \nSELECT SETVAL(s, 100);\n+----------------+\n| SETVAL(s, 100) |\n+----------------+\n| 100 |\n+----------------+\n \nSETVAL can only be used to increase the sequence value.\nAttempting to set a lower value will fail, returning NULL:\n \nSELECT SETVAL(s, 50);\n+---------------+\n| SETVAL(s, 50) |\n+---------------+\n| NULL |\n+---------------+\n \nDropping a Sequence\n \nThe DROP SEQUENCE statement is used to drop a sequence, for\nexample:\n \nDROP SEQUENCE s;\n \nReplication\n \nIf one wants to use Sequences in a master-master setup or\nwith Galera one\nshould use INCREMENT=0. This will tell the Sequence to use\nauto_increment_increment and auto_increment_offset to\ngenerate unique values for each server.\n \nStandards Compliance\n \nMariaDB 10.3 supports both ANSI SQL and Oracle syntax for\nsequences.\n \nHowever as SEQUENCE is implemented as a special kind of\ntable, it uses the same namespace as tables. The benefits\nare that sequences show up in SHOW TABLES, and one can also\ncreate a sequence with CREATE TABLE and drop it with DROP\nTABLE. One can SELECT from it as from any other table. This\nensures that all old tools that work with tables should work\nwith sequences.\n \nSince sequence objects act as regular tables in many\ncontexts, they will be affected by LOCK TABLES. This is not\nthe case in other DBMS, such as Oracle, where LOCK TABLE\ndoes not affect sequences.\n \nNotes\n \nOne of the goals with the Sequence implementation is that\nall old\ntools, such as mysqldump, should work unchanged, while still\nkeeping the\nnormal usage of sequence standard compatibly.\n \nTo make this possible, sequence is currently implemented as\na table with a few exclusive properties.\n \nThe special properties for sequence tables are:\nA sequence table has always one row.\nWhen one creates a sequence, either with CREATE TABLE or\nCREATE SEQUENCE, one row will be inserted.\nIf one tries to insert into a sequence table, the single row\nwill be updated. This allows mysqldump to work but also\ngives the additional benefit that one can change all\nproperties of a sequence with a single insert. New\napplications should of course also use ALTER SEQUENCE.\nUPDATE or DELETE can\'t be performed on Sequence objects.\nDoing a select on the sequence shows the current state of\nthe sequence, except the values that are reserved in the\ncache. The next_value column shows the next value not\nreserved by the cache.\nFLUSH TABLES will close the sequence and the next sequence\nnumber generated will be according to what\'s stored in the\nSequence object. In effect, this will discard the cached\nvalues.\nA number of normal table operations work on Sequence tables.\nSee next section.\n \nTable Operations that Work with Sequences\n \nSHOW CREATE TABLE sequence_name. This shows the table\nstructure that is behind the SEQUENCE including the field\nnames that can be used with SELECT or even CREATE TABLE.\nCREATE TABLE sequence-structure ... SEQUENCE=1\nALTER TABLE sequence RENAME TO sequence2\nRENAME TABLE sequence_name TO new_sequence_name\nDROP TABLE sequence_name. This is allowed mainly to get old\ntools like mysqldump to work with sequence tables.\nSHOW TABLES\n \nImplementation\n \nInternally, sequence tables are created as a normal table\nwithout\nrollback (the InnoDB, Aria and MySAM engines support this),\nwrapped by a\nsequence engine object. This allowed us to create sequences\nwith\nalmost no performance impact for normal tables. (The cost is\none \'if\'\nper insert if the binary log is enabled).\n \nUnderlying Table Structure\n \nThe following example shows the table structure of sequences\nand how it\ncan be used as a table.\n(Output of results are slightly edited to make them easier\nto read)\n \ncreate sequence t1;\nshow create sequence t1\\G\n***** 1. row *****\n CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue\n9223372036854775806\n increment by 1 cache 1000 nocycle ENGINE=InnoDB\n \nshow create table t1\\G\n***** 1. row *****\nCreate Table: CREATE TABLE `t1` (\n `next_not_cached_value` bigint(21) NOT NULL,\n `minimum_value` bigint(21) NOT NULL,\n `maximum_value` bigint(21) NOT NULL,\n `start_value` bigint(21) NOT NULL COMMENT \'start value\nwhen sequences is created or value if RESTART is used\',\n `increment` bigint(21) NOT NULL COMMENT \'increment\nvalue\',\n `cache_size` bigint(21) unsigned NOT NULL,\n `cycle_option` tinyint(1) unsigned NOT NULL COMMENT \'0 if\nno cycles are allowed, 1 if the sequence should begin a new\ncycle when maximum_value is passed\',\n `cycle_count` bigint(21) NOT NULL COMMENT \'How many cycles\nhave been done\'\n) ENGINE=InnoDB SEQUENCE=1\n \nselect * from t1\\G\nnext_not_cached_value: 1\n minimum_value: 1\n maximum_value: 9223372036854775806\n start_value: 1\n increment: 1\n cache_size: 1000\n cycle_option: 0\n cycle_count: 0\nThe cycle_count column is incremented every time the\nsequence wraps around.\n \nCredits\n \nThanks to Jianwe Zhao from Aliyun for his work on SEQUENCE\nin AliSQL, which gave ideas and inspiration for this work.\nThanks to Peter Gulutzan,who helped test and gave useful\ncomments about the implementation.\n \n\n\nURL: https://mariadb.com/kb/en/library/sequence-overview/','','https://mariadb.com/kb/en/library/sequence-overview/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (685,40,'SETVAL()','SEQUENCEs were introduced in MariaDB 10.3.\n \nSyntax\n------ \nSETVAL(sequence_name, next_value, [is_used, [round]])\n \nDescription\n----------- \nSet the next value to be returned for a SEQUENCE.\n \nThis function is compatible with PostgreSQL syntax, extended\nwith the round argument.\n \nIf the is_used argument is not given or is 1 or true, then\nthe next used value will\none after the given value. If is_used is 0 or false then the\nnext generated value\nwill be the given value.\n \nIf round is used then it will set the round value (or the\ninternal cycle count, starting at zero) for the sequence.\nIf round is not used, it\'s assumed to be 0.\n \nnext_value must be an integer literal.\n \nFor SEQUENCE tables defined with CYCLE (see CREATE SEQUENCE)\none should use both next_value and round to define the next\nvalue. In this case the\ncurrent sequence value is defined to be round, next_value.\n \nThe result returned by SETVAL() is next_value or NULL if the\ngiven next_value and round is smaller than the current\nvalue.\n \nSETVAL() will not set the SEQUENCE value to a something that\nis less than\nits current value. This is needed to ensure that SETVAL()\nis replication safe. If you want to set the SEQUENCE to a\nsmaller number\nuse ALTER SEQUENCE.\n \nIf CYCLE is used, first round and then next_value are\ncompared\nto see if the value is bigger than the current value.\n \nInternally, in the MariaDB server, SETVAL() is used to\ninform\nslaves that a SEQUENCE has changed value. The slave may get\nSETVAL() statements out of order, but this is ok as only the\nbiggest one will have an effect.\n \nSETVAL requires the INSERT privilege.\n \nExamples\n-------- \nSELECT setval(foo, 42); -- Next nextval will return 43\nSELECT setval(foo, 42, true); -- Same as above\nSELECT setval(foo, 42, false); -- Next nextval will return\n42\n \nSETVAL setting higher and lower values on a sequence with an\nincrement of 10:\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 50 |\n+------------+\n \nSELECT SETVAL(s, 100);\n+----------------+\n| SETVAL(s, 100) |\n+----------------+\n| 100 |\n+----------------+\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 110 |\n+------------+\n \nSELECT SETVAL(s, 50);\n+---------------+\n| SETVAL(s, 50) |\n+---------------+\n| NULL |\n+---------------+\n \nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 120 |\n+------------+\n \nExample demonstrating round:\n \nCREATE OR REPLACE SEQUENCE s1\n START WITH 1\n MINVALUE 1\n MAXVALUE 99\n INCREMENT BY 1 \n CACHE 20 \n CYCLE;\n \nSELECT SETVAL(s1, 99, 1, 0);\n+----------------------+\n| SETVAL(s1, 99, 1, 0) |\n+----------------------+\n| 99 |\n+----------------------+\n \nSELECT NEXTVAL(s1);\n+-------------+\n| NEXTVAL(s1) |\n+-------------+\n| 1 |\n+-------------+\n \nThe following statement returns NULL, as the given\nnext_value and round is smaller than the current value.\n \nSELECT SETVAL(s1, 99, 1, 0);\n+----------------------+\n| SETVAL(s1, 99, 1, 0) |\n+----------------------+\n| NULL |\n+----------------------+\n \nSELECT NEXTVAL(s1);\n+-------------+\n| NEXTVAL(s1) |\n+-------------+\n| 2 |\n+-------------+\n \nIncreasing the round from zero to 1 will allow next_value to\nbe returned.\n \nSELECT SETVAL(s1, 99, 1, 1);\n+----------------------+\n| SETVAL(s1, 99, 1, 1) |\n+----------------------+\n| 99 |\n+----------------------+\n \nSELECT NEXTVAL(s1);\n+-------------+\n| NEXTVAL(s1) |\n+-------------+\n| 1 |\n+-------------+\n \n\n\nURL: https://mariadb.com/kb/en/library/setval/','','https://mariadb.com/kb/en/library/setval/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (686,41,'JSON_ARRAY','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_ARRAY([value[, value2] ...])\n \nDescription\n----------- \nReturns a JSON array containing the listed values. The list\ncan be empty.\n \nExample\n \nSELECT Json_Array(56, 3.1416, \'My name is \"Foo\"\', NULL);\n+--------------------------------------------------+\n| Json_Array(56, 3.1416, \'My name is \"Foo\"\', NULL) |\n+--------------------------------------------------+\n| [56, 3.1416, \"My name is \\\"Foo\\\"\", null] |\n+--------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_array/','','https://mariadb.com/kb/en/json_array/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (687,41,'JSON_ARRAY_APPEND','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_ARRAY_APPEND(json_doc, path, value[, path, value] ...)\n \nDescription\n----------- \nAppends values to the end of the specified arrays within a\nJSON document, returning the result, or NULL if any of the\narguments are NULL.\n \nEvaluation is performed from left to right, with the\nresulting document from the previous pair becoming the new\nvalue against which the next pair is evaluated.\n \nIf the json_doc is not a valid JSON document, or if any of\nthe paths are not valid, or contain a * or ** wildcard, an\nerror is returned.\n \nExamples\n-------- \nSET @json = \'[1, 2, [3, 4]]\';\n \nSELECT JSON_ARRAY_APPEND(@json, \'$[0]\', 5)\n+-------------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$[0]\', 5) |\n+-------------------------------------+\n| [[1, 5], 2, [3, 4]] |\n+-------------------------------------+\n \nSELECT JSON_ARRAY_APPEND(@json, \'$[1]\', 6);\n+-------------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$[1]\', 6) |\n+-------------------------------------+\n| [1, [2, 6], [3, 4]] |\n+-------------------------------------+\n \nSELECT JSON_ARRAY_APPEND(@json, \'$[1]\', 6, \'$[2]\', 7);\n+------------------------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$[1]\', 6, \'$[2]\', 7) |\n+------------------------------------------------+\n| [1, [2, 6], [3, 4, 7]] |\n+------------------------------------------------+\n \nSELECT JSON_ARRAY_APPEND(@json, \'$\', 5);\n+----------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$\', 5) |\n+----------------------------------+\n| [1, 2, [3, 4], 5] |\n+----------------------------------+\n \nSET @json = \'{\"A\": 1, \"B\": [2], \"C\": [3, 4]}\';\n \nSELECT JSON_ARRAY_APPEND(@json, \'$.B\', 5);\n+------------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$.B\', 5) |\n+------------------------------------+\n| {\"A\": 1, \"B\": [2, 5], \"C\": [3, 4]} |\n+------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_array_append/','','https://mariadb.com/kb/en/json_array_append/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (688,41,'JSON_ARRAY_INSERT','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_ARRAY_INSERT(json_doc, path, value[, path, value] ...)\n \nDescription\n----------- \nInserts a value into a JSON document, returning the modified\ndocument, or NULL if any of the arguments are NULL.\n \nEvaluation is performed from left to right, with the\nresulting document from the previous pair becoming the new\nvalue against which the next pair is evaluated.\n \nIf the json_doc is not a valid JSON document, or if any of\nthe paths are not valid, or contain a * or ** wildcard, an\nerror is returned.\n \nExamples\n-------- \nSET @json = \'[1, 2, [3, 4]]\';\n \nSELECT JSON_ARRAY_INSERT(@json, \'$[0]\', 5);\n+-------------------------------------+\n| JSON_ARRAY_INSERT(@json, \'$[0]\', 5) |\n+-------------------------------------+\n| [5, 1, 2, [3, 4]] |\n+-------------------------------------+\n \nSELECT JSON_ARRAY_INSERT(@json, \'$[1]\', 6);\n+-------------------------------------+\n| JSON_ARRAY_INSERT(@json, \'$[1]\', 6) |\n+-------------------------------------+\n| [1, 6, 2, [3, 4]] |\n+-------------------------------------+\n \nSELECT JSON_ARRAY_INSERT(@json, \'$[1]\', 6, \'$[2]\', 7);\n+------------------------------------------------+\n| JSON_ARRAY_INSERT(@json, \'$[1]\', 6, \'$[2]\', 7) |\n+------------------------------------------------+\n| [1, 6, 7, 2, [3, 4]] |\n+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_array_insert/','','https://mariadb.com/kb/en/json_array_insert/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (689,41,'JSON_COMPACT','This function was added in MariaDB 10.2.4.\n \nSyntax\n------ \nJSON_COMPACT(json_doc)\n \nDescription\n----------- \nRemoves all unnecessary spaces so the json document is as\nshort as possible.\n \nExample\n \nSET @j = \'{ \"A\": 1, \"B\": [2, 3]}\';\n \nSELECT JSON_COMPACT(@j), @j;\n+-------------------+------------------------+\n| JSON_COMPACT(@j) | @j |\n+-------------------+------------------------+\n| {\"A\":1,\"B\":[2,3]} | { \"A\": 1, \"B\": [2, 3]} |\n+-------------------+------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_compact/','','https://mariadb.com/kb/en/json_compact/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (690,41,'JSON_CONTAINS','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_CONTAINS(json_doc, val[, path])\n \nDescription\n----------- \nReturns whether or not the specified value is found in the\ngiven JSON document or, optionally, at the specified path\nwithin the document. Returns 1 if it does, 0 if not and NULL\nif any of the arguments are null. An error occurs if the\ndocument or path is not valid, or contains the * or **\nwildcards.\n \nExamples\n-------- \nSET @json = \'{\"A\": 0, \"B\": {\"C\": 1}, \"D\": 2}\';\n \nSELECT JSON_CONTAINS(@json, \'2\', \'$.A\');\n+----------------------------------+\n| JSON_CONTAINS(@json, \'2\', \'$.A\') |\n+----------------------------------+\n| 0 |\n+----------------------------------+\n \nSELECT JSON_CONTAINS(@json, \'2\', \'$.D\');\n+----------------------------------+\n| JSON_CONTAINS(@json, \'2\', \'$.D\') |\n+----------------------------------+\n| 1 |\n+----------------------------------+\n \nSELECT JSON_CONTAINS(@json, \'{\"C\": 1}\', \'$.A\');\n+-----------------------------------------+\n| JSON_CONTAINS(@json, \'{\"C\": 1}\', \'$.A\') |\n+-----------------------------------------+\n| 0 |\n+-----------------------------------------+\n \nSELECT JSON_CONTAINS(@json, \'{\"C\": 1}\', \'$.B\');\n+-----------------------------------------+\n| JSON_CONTAINS(@json, \'{\"C\": 1}\', \'$.B\') |\n+-----------------------------------------+\n| 1 |\n+-----------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_contains/','','https://mariadb.com/kb/en/json_contains/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (691,41,'JSON_CONTAINS_PATH','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_CONTAINS_PATH(json_doc, return_arg, path[, path] ...)\n \nDescription\n----------- \nIndicates whether the given JSON document contains data at\nthe specified path or paths. Returns 1 if it does, 0 if not\nand NULL if any of the arguments are null.\n \nThe return_arg can be one or all:\none - Returns 1 if at least one path exists within the JSON\ndocument. \nall - Returns 1 only if all paths exist within the JSON\ndocument.\n \nExamples\n-------- \nSET @json = \'{\"A\": 1, \"B\": [2], \"C\": [3, 4]}\';\n \nSELECT JSON_CONTAINS_PATH(@json, \'one\', \'$.A\', \'$.D\');\n+------------------------------------------------+\n| JSON_CONTAINS_PATH(@json, \'one\', \'$.A\', \'$.D\') |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+\n1 row in set (0.00 sec)\n \nSELECT JSON_CONTAINS_PATH(@json, \'all\', \'$.A\', \'$.D\');\n+------------------------------------------------+\n| JSON_CONTAINS_PATH(@json, \'all\', \'$.A\', \'$.D\') |\n+------------------------------------------------+\n| 0 |\n+------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_contains_path/','','https://mariadb.com/kb/en/json_contains_path/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (692,41,'JSON_DEPTH','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_DEPTH(json_doc)\n \nDescription\n----------- \nReturns the maximum depth of the given JSON document, or\nNULL if the argument is null. An error will occur if the\nargument is an invalid JSON document.\nScalar values or empty arrays or objects have a depth of 1.\nArrays or objects that are not empty but contain only\nelements or member values of depth 1 will have a depth of 2.\nIn other cases, the depth will be greater than 2.\n \nExamples\n-------- \nSELECT JSON_DEPTH(\'[]\'), JSON_DEPTH(\'true\'),\nJSON_DEPTH(\'{}\');\n+------------------+--------------------+------------------+\n| JSON_DEPTH(\'[]\') | JSON_DEPTH(\'true\') |\nJSON_DEPTH(\'{}\') |\n+------------------+--------------------+------------------+\n| 1 | 1 | 1 |\n+------------------+--------------------+------------------+\n \nSELECT JSON_DEPTH(\'[1, 2, 3]\'), JSON_DEPTH(\'[[], {},\n[]]\');\n+-------------------------+----------------------------+\n| JSON_DEPTH(\'[1, 2, 3]\') | JSON_DEPTH(\'[[], {}, []]\') |\n+-------------------------+----------------------------+\n| 2 | 2 |\n+-------------------------+----------------------------+\n \nSELECT JSON_DEPTH(\'[1, 2, [3, 4, 5, 6], 7]\');\n+---------------------------------------+\n| JSON_DEPTH(\'[1, 2, [3, 4, 5, 6], 7]\') |\n+---------------------------------------+\n| 3 |\n+---------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_depth/','','https://mariadb.com/kb/en/json_depth/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (693,41,'JSON_DETAILED','This function was added in MariaDB 10.2.4.\n \nSyntax\n------ \nJSON_DETAILED(json_doc[, tab_size])\n \nDescription\n----------- \nRepresents JSON in the most understandable way emphasizing\nnested structures.\n \nExample\n \nSET @j = \'{ \"A\":1,\"B\":[2,3]}\';\n \nSELECT @j;\n+--------------------+\n| @j |\n+--------------------+\n| { \"A\":1,\"B\":[2,3]} |\n+--------------------+\n \nSELECT JSON_DETAILED(@j);\n+------------------------------------------------------------+\n| JSON_DETAILED(@j) |\n+------------------------------------------------------------+\n| {\n \"A\": 1,\n \"B\": \n [\n 2,\n 3\n ]\n} |\n+------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_detailed/','','https://mariadb.com/kb/en/json_detailed/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (694,41,'JSON_EXISTS','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nDescription\n----------- \nDetermines whether a specified JSON value exists in the\ngiven data. Returns 1 if found, 0 if not, or NULL if any of\nthe inputs were NULL.\n \nExamples\n-------- \nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2,\n3]}\', \"$.key2\");\n+------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\',\n\"$.key2\") |\n+------------------------------------------------------------+\n| 1 |\n+------------------------------------------------------------+\n \nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2,\n3]}\', \"$.key3\");\n+------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\',\n\"$.key3\") |\n+------------------------------------------------------------+\n| 0 |\n+------------------------------------------------------------+\n \nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2,\n3]}\', \"$.key2[1]\");\n+---------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\',\n\"$.key2[1]\") |\n+---------------------------------------------------------------+\n| 1 |\n+---------------------------------------------------------------+\n \nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2,\n3]}\', \"$.key2[10]\");\n+----------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\',\n\"$.key2[10]\") |\n+----------------------------------------------------------------+\n| 0 |\n+----------------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_exists/','','https://mariadb.com/kb/en/json_exists/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (695,41,'JSON_EXTRACT','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_EXTRACT(json_doc, path[, path] ...)\n \nDescription\n----------- \nExtracts data from a JSON document. The extracted data is\nselected from the parts matching the path arguments. Returns\nall matched values; either as a single matched value, or, if\nthe arguments could return multiple values, a result\nautowrapped as an array in the matching order.\n \nReturns NULL if no paths match or if any of the arguments\nare NULL. \n \nAn error will occur if any path argument is not a valid\npath, or if the json_doc argument is not a valid JSON\ndocument.\n \nExamples\n-------- \nSET @json = \'[1, 2, [3, 4]]\';\n \nSELECT JSON_EXTRACT(@json, \'$[1]\');\n+-----------------------------+\n| JSON_EXTRACT(@json, \'$[1]\') |\n+-----------------------------+\n| 2 |\n+-----------------------------+\n \nSELECT JSON_EXTRACT(@json, \'$[2]\');\n+-----------------------------+\n| JSON_EXTRACT(@json, \'$[2]\') |\n+-----------------------------+\n| [3, 4] |\n+-----------------------------+\n \nSELECT JSON_EXTRACT(@json, \'$[2][1]\');\n+--------------------------------+\n| JSON_EXTRACT(@json, \'$[2][1]\') |\n+--------------------------------+\n| 4 |\n+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_extract/','','https://mariadb.com/kb/en/json_extract/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (696,41,'JSON_INSERT','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_INSERT(json_doc, path, val[, path, val] ...)\n \nDescription\n----------- \nInserts data into a JSON document, returning the resulting\ndocument or NULL if any argument is null. \n \nAn error will occur if the JSON document is not invalid, or\nif any of the paths are invalid or contain a * or **\nwildcard.\n \nJSON_INSERT can only insert data while JSON_REPLACE can only\nupdate. JSON_SET can update or insert data. \n \nExamples\n-------- \nSET @json = \'{ \"A\": 0, \"B\": [1, 2]}\';\n \nSELECT JSON_INSERT(@json, \'$.C\', \'[3, 4]\');\n+--------------------------------------+\n| JSON_INSERT(@json, \'$.C\', \'[3, 4]\') |\n+--------------------------------------+\n| { \"A\": 0, \"B\": [1, 2], \"C\":\"[3, 4]\"} |\n+--------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_insert/','','https://mariadb.com/kb/en/json_insert/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (697,41,'JSON_KEYS','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_KEYS(json_doc[, path])\n \nDescription\n----------- \nReturns the keys as a JSON array from the top-level value of\na JSON object or, if the optional path argument is provided,\nthe top-level keys from the path. \n \nExcludes keys from nested sub-objects in the top level\nvalue. The resulting array will be empty if the selected\nobject is empty.\n \nReturns NULL if any of the arguments are null, a given path\ndoes not locate an object, or if the json_doc argument is\nnot an object.\n \nAn error will occur if JSON document is invalid, the path is\ninvalid or if the path contains a * or ** wildcard.\n \nExamples\n-------- \nSELECT JSON_KEYS(\'{\"A\": 1, \"B\": {\"C\": 2}}\');\n+--------------------------------------+\n| JSON_KEYS(\'{\"A\": 1, \"B\": {\"C\": 2}}\') |\n+--------------------------------------+\n| [\"A\", \"B\"] |\n+--------------------------------------+\n \nSELECT JSON_KEYS(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\":\n3}}\', \'$.C\');\n+-----------------------------------------------------+\n| JSON_KEYS(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\": 3}}\',\n\'$.C\') |\n+-----------------------------------------------------+\n| [\"D\"] |\n+-----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_keys/','','https://mariadb.com/kb/en/json_keys/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (698,41,'JSON_LENGTH','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_LENGTH(json_doc[, path])\n \nDescription\n----------- \nReturns the length of a JSON document, or, if the optional\npath argument is given, the length of the value within the\ndocument specified by the path. \n \nReturns NULL if any of the arguments argument are null or\nthe path argument does not identify a value in the document.\n\n \nAn error will occur if the JSON document is invalid, the\npath is invalid or if the path contains a * or ** wildcard.\n \nLength will be determined as follow:\nA scalar\'s length is always 1.\nIf an array, the number of elements in the array.\nIf an object, the number of members in the object.\n \nThe length of nested arrays or objects are not counted.\n \nExamples\n-------- \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_length/','','https://mariadb.com/kb/en/json_length/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (699,41,'JSON_LOOSE','This function was added in MariaDB 10.2.4.\n \nSyntax\n------ \nJSON_LOOSE(json_doc)\n \nDescription\n----------- \nAdds spaces to a JSON document to make it look more\nreadable.\n \nExample\n \nSET @j = \'{ \"A\":1,\"B\":[2,3]}\';\n \nSELECT JSON_LOOSE(@j), @j;\n+-----------------------+--------------------+\n| JSON_LOOSE(@j) | @j |\n+-----------------------+--------------------+\n| {\"A\": 1, \"B\": [2, 3]} | { \"A\":1,\"B\":[2,3]} |\n+-----------------------+--------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_loose/','','https://mariadb.com/kb/en/json_loose/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (700,41,'JSON_MERGE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_MERGE(json_doc, json_doc[, json_doc] ...)\n \nDescription\n----------- \nMerges the given JSON documents.\n \nReturns the merged result,or NULL if any argument is NULL.\n \nAn error occurs if any of the arguments are not valid JSON\ndocuments.\n \nExample\n \nSET @json1 = \'[1, 2]\';\n \nSET @json2 = \'[3, 4]\';\n \nSELECT JSON_MERGE(@json1,@json2);\n+---------------------------+\n| JSON_MERGE(@json1,@json2) |\n+---------------------------+\n| [1, 2, 3, 4] |\n+---------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_merge/','','https://mariadb.com/kb/en/json_merge/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (701,41,'JSON_OBJECT','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_OBJECT([key, value[, key, value] ...])\n \nDescription\n----------- \nReturns a JSON object containing the given key/value pairs.\nThe key/value list can be empty.\n \nAn error will occur if there are an odd number of arguments,\nor any key name is NULL.\n \nExample\n \nSELECT JSON_OBJECT(\"id\", 1, \"name\", \"Monty\");\n+---------------------------------------+\n| JSON_OBJECT(\"id\", 1, \"name\", \"Monty\") |\n+---------------------------------------+\n| {\"id\": 1, \"name\": \"Monty\"} |\n+---------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_object/','','https://mariadb.com/kb/en/json_object/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (702,41,'JSON_QUERY','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_QUERY(json_doc, path)\n \nDescription\n----------- \nGiven a JSON document, returns an object or array specified\nby the path. Returns NULL if not given a valid JSON\ndocument, or if there is no match.\n \nExamples\n-------- \nselect json_query(\'{\"key1\":{\"a\":1, \"b\":[1,2]}}\',\n\'$.key1\');\n+-----------------------------------------------------+\n| json_query(\'{\"key1\":{\"a\":1, \"b\":[1,2]}}\',\n\'$.key1\') |\n+-----------------------------------------------------+\n| {\"a\":1, \"b\":[1,2]} |\n+-----------------------------------------------------+\n \nselect json_query(\'{\"key1\":123, \"key1\": [1,2,3]}\',\n\'$.key1\');\n+-------------------------------------------------------+\n| json_query(\'{\"key1\":123, \"key1\": [1,2,3]}\',\n\'$.key1\') |\n+-------------------------------------------------------+\n| [1,2,3] |\n+-------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_query/','','https://mariadb.com/kb/en/json_query/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (703,41,'JSON_QUOTE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_QUOTE(json_value)\n \nDescription\n----------- \nQuotes a string as a JSON value, usually for producing valid\nJSON string literals for inclusion in JSON documents. Wraps\nthe string with double quote characters and escapes interior\nquotes and other special characters, returning a utf8mb4\nstring. \n \nReturns NULL if the argument is NULL.\n \nExamples\n-------- \nSELECT JSON_QUOTE(\'A\'), JSON_QUOTE(\"B\"),\nJSON_QUOTE(\'\"C\"\');\n+-----------------+-----------------+-------------------+\n| JSON_QUOTE(\'A\') | JSON_QUOTE(\"B\") |\nJSON_QUOTE(\'\"C\"\') |\n+-----------------+-----------------+-------------------+\n| \"A\" | \"B\" | \"\\\"C\\\"\" |\n+-----------------+-----------------+-------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_quote/','','https://mariadb.com/kb/en/json_quote/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (704,41,'JSON_REMOVE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_REMOVE(json_doc, path[, path] ...)\n \nDescription\n----------- \nRemoves data from a JSON document returning the result, or\nNULL if any of the arguments are null. If the element does\nnot exist in the document, no changes are made.\n \nAn error will occur if JSON document is invalid, the path is\ninvalid or if the path contains a * or ** wildcard.\n \nPath arguments are evaluated from left to right, with the\nresult from the earlier evaluation being used as the value\nfor the next.\n \nExamples\n-------- \nSELECT JSON_REMOVE(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\":\n3}}\', \'$.C\');\n+-------------------------------------------------------+\n| JSON_REMOVE(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\": 3}}\',\n\'$.C\') |\n+-------------------------------------------------------+\n| {\"A\": 1, \"B\": 2} |\n+-------------------------------------------------------+\n \nSELECT JSON_REMOVE(\'[\"A\", \"B\", [\"C\", \"D\"],\n\"E\"]\', \'$[1]\');\n+----------------------------------------------------+\n| JSON_REMOVE(\'[\"A\", \"B\", [\"C\", \"D\"], \"E\"]\',\n\'$[1]\') |\n+----------------------------------------------------+\n| [\"A\", [\"C\", \"D\"], \"E\"] |\n+----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_remove/','','https://mariadb.com/kb/en/json_remove/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (705,41,'JSON_REPLACE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_REPLACE(json_doc, path, val[, path, val] ...)\n \nDescription\n----------- \nReplaces existing values in a JSON document, returning the\nresult, or NULL if any of the arguments are NULL. \n \nAn error will occur if the JSON document is invalid, the\npath is invalid or if the path contains a * or ** wildcard.\n \nPaths and values are evaluated from left to right, with the\nresult from the earlier evaluation being used as the value\nfor the next.\n \nJSON_REPLACE can only update data, while JSON_INSERT can\nonly insert. JSON_SET can update or insert data. \n \nExamples\n-------- \nSELECT JSON_REPLACE(\'{ \"A\": 1, \"B\": [2, 3]}\',\n\'$.B[1]\', 4);\n+-----------------------------------------------------+\n| JSON_REPLACE(\'{ \"A\": 1, \"B\": [2, 3]}\', \'$.B[1]\',\n4) |\n+-----------------------------------------------------+\n| { \"A\": 1, \"B\": [2, 4]} |\n+-----------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_replace/','','https://mariadb.com/kb/en/json_replace/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (706,41,'JSON_SEARCH','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_SEARCH(json_doc, return_arg, search_str[, escape_char[,\npath] ...])\n \nDescription\n----------- \nReturns the path to the given string within a JSON document,\nor NULL if any of json_doc, search_str or a path argument is\nNULL; if the search string is not found, or if no path\nexists within the document. \n \nA warning will occur if the JSON document is not valid, any\nof the path arguments are not valid, if return_arg is\nneither one nor all, or if the escape character is not a\nconstant. NULL will be returned.\n \nreturn_arg can be one of two values:\n\'one: Terminates after finding the first match, so will\nreturn one path string. If there is more than one match, it\nis undefined which is considered first.\nall: Returns all matching path strings, without duplicates.\nMultiple strings are autowrapped as an array. The order is\nundefined.\n \nExamples\n-------- \nSET @json = \'[\"A\", [{\"B\": \"1\"}], {\"C\":\"AB\"},\n{\"D\":\"BC\"}]\';\n \nSELECT JSON_SEARCH(@json, \'one\', \'AB\');\n+---------------------------------+\n| JSON_SEARCH(@json, \'one\', \'AB\') |\n+---------------------------------+\n| \"$[2].C\" |\n+---------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_search/','','https://mariadb.com/kb/en/json_search/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (707,41,'JSON_SET','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_SET(json_doc, path, val[, path, val] ...)\n \nDescription\n----------- \nUpdates or inserts data into a JSON document, returning the\nresult, or NULL if any of the arguments are NULL or the\noptional path fails to find an object.\n \nAn error will occur if the JSON document is invalid, the\npath is invalid or if the path contains a * or wildcard.\n \nJSON_SET can update or insert data, while JSON_REPLACE can\nonly update, and JSON_INSERT only insert. \n \nExamples\n-------- \n\n \n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_set/','','https://mariadb.com/kb/en/json_set/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (708,41,'JSON_TYPE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_TYPE(json_val)\n \nDescription\n----------- \nReturns the type of a JSON value, or NULL if the argument is\nnull.\n \nAn error will occur if the argument is an invalid JSON\nvalue.\n \nThe following is a complete list of the possible return\ntypes:\n \nReturn type | Value | \n \nARRAY | JSON array | \n \nBIT | MariaDB BIT scalar | \n \nBLOB | MariaDB binary types (BINARY, VARBINARY or BLOB) | \n \nBOOLEAN | JSON true/false literals | \n \nDATE | MariaDB DATE scalar | \n \nDATETIME | MariaDB DATETIME or TIMESTAMP scalar | \n \nDECIMAL | MariaDB DECIMAL or NUMERIC scalar | \n \nDOUBLE | MariaDB DOUBLE FLOAT scalar | \n \nINTEGER | MariaDB integer types (TINYINT, SMALLINT,\nMEDIUMINT, INT or BIGINT) | \n \nNULL | JSON null literal or NULL argument | \n \nOBJECT | JSON object | \n \nOPAQUE | Any valid JSON value that is not one of the other\ntypes. | \n \nSTRING | MariaDB character types (CHAR, VARCHAR, TEXT, ENUM\nor SET) | \n \nTIME | MariaDB TIME scalar | \n \nExamples\n-------- \nSELECT JSON_TYPE(\'{\"A\": 1, \"B\": 2, \"C\": 3}\');\n+---------------------------------------+\n| JSON_TYPE(\'{\"A\": 1, \"B\": 2, \"C\": 3}\') |\n+---------------------------------------+\n| OBJECT |\n+---------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_type/','','https://mariadb.com/kb/en/json_type/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (709,41,'JSON_UNQUOTE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_UNQUOTE(val)\n \nDescription\n----------- \nUnquotes a JSON value, returning a string, or NULL if the\nargument is null. \n \nAn error will occur if the given value begins and ends with\ndouble quotes and is an invalid JSON string literal.\n \nCertain character sequences have special meanings within a\nstring. Usually, a backspace is ignored, but the escape\nsequences in the table below are recognised by MariaDB,\nunless the SQL Mode is set to NO_BACKSLASH_ESCAPES SQL.\n \nEscape sequence | Character | \n \n\\\" | Double quote (\") | \n \n\\b | Backspace | \n \n\\f | Formfeed | \n \n\\n | Newline (linefeed) | \n \n\\r | Carriage return | \n \n\\t | Tab | \n \n\\\\ | Backslash (\\) | \n \n\\uXXXX | UTF-8 bytes for Unicode value XXXX | \n \nExamples\n-------- \nSELECT JSON_UNQUOTE(\'\"Monty\"\');\n+-------------------------+\n| JSON_UNQUOTE(\'\"Monty\"\') |\n+-------------------------+\n| Monty |\n+-------------------------+\n \nWith the default SQL Mode:\n \nSELECT JSON_UNQUOTE(\'Si\\bng\\ting\');\n+-----------------------------+\n| JSON_UNQUOTE(\'Si\\bng\\ting\') |\n+-----------------------------+\n| Sng ing |\n+-----------------------------+\n \nSetting NO_BACKSLASH_ESCAPES:\n \nSET @@sql_mode = \'NO_BACKSLASH_ESCAPES\';\n \nSELECT JSON_UNQUOTE(\'Si\\bng\\ting\');\n+-----------------------------+\n| JSON_UNQUOTE(\'Si\\bng\\ting\') |\n+-----------------------------+\n| Si\\bng\\ting |\n+-----------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_unquote/','','https://mariadb.com/kb/en/json_unquote/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (710,41,'JSON_VALID','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_VALID(value)\n \nDescription\n----------- \nIndicates whether the given value is a valid JSON document\nor not. Returns 1 if valid, 0 if not, and NULL if the\nargument is NULL.\n \nFrom MariaDB 10.4.3, the JSON_VALID function is\nautomatically used as a CHECK constraint for the JSON data\ntype alias in order to ensure that a valid json document is\ninserted. \n \nExamples\n-------- \nSELECT JSON_VALID(\'{\"id\": 1, \"name\": \"Monty\"}\');\n+------------------------------------------+\n| JSON_VALID(\'{\"id\": 1, \"name\": \"Monty\"}\') |\n+------------------------------------------+\n| 1 |\n+------------------------------------------+\n \nSELECT JSON_VALID(\'{\"id\": 1, \"name\": \"Monty\",\n\"oddfield\"}\');\n+------------------------------------------------------+\n| JSON_VALID(\'{\"id\": 1, \"name\": \"Monty\",\n\"oddfield\"}\') |\n+------------------------------------------------------+\n| 0 |\n+------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_valid/','','https://mariadb.com/kb/en/json_valid/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (711,41,'JSON_VALUE','JSON functions were added in MariaDB 10.2.3.\n \nSyntax\n------ \nJSON_VALUE(json_doc, path)\n \nDescription\n----------- \nGiven a JSON document, returns the scalar specified by the\npath. Returns NULL if not given a valid JSON document, or if\nthere is no match.\n \nExamples\n-------- \nselect json_value(\'{\"key1\":123}\', \'$.key1\');\n+--------------------------------------+\n| json_value(\'{\"key1\":123}\', \'$.key1\') |\n+--------------------------------------+\n| 123 |\n+--------------------------------------+\n \nselect json_value(\'{\"key1\": [1,2,3], \"key1\":123}\',\n\'$.key1\');\n+-------------------------------------------------------+\n| json_value(\'{\"key1\": [1,2,3], \"key1\":123}\',\n\'$.key1\') |\n+-------------------------------------------------------+\n| 123 |\n+-------------------------------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/json_value/','','https://mariadb.com/kb/en/json_value/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (712,42,'CUME_DIST','The CUME_DIST() function was first introduced with window\nfunctions in MariaDB 10.2.0.\n \nSyntax\n------ \nCUME_DIST() OVER ( \n [ PARTITION BY partition_expression ] \n [ ORDER BY order_list ]\n)\n \nDescription\n----------- \nCUME_DIST() is a window function that returns the cumulative\ndistribution of a given row. The following formula is used\nto calculate the value:\n \n(number of rows \n\nURL: https://mariadb.com/kb/en/cume_dist/','','https://mariadb.com/kb/en/cume_dist/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (713,42,'DENSE_RANK','The DENSE_RANK() function was first introduced with window\nfunctions in MariaDB 10.2.0.\n \nSyntax\n------ \nDENSE_RANK() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n) \n \nDescription\n----------- \nDENSE_RANK() is a window function that displays the number\nof a given row, starting at one and following the ORDER BY\nsequence of the window function, with identical values\nreceiving the same result. Unlike the RANK() function, there\nare no skipped values if the preceding results are\nidentical. It is also similar to the ROW_NUMBER() function\nexcept that in that function, identical values will receive\na different row number for each result.\n \nExamples\n-------- \nThe distinction between DENSE_RANK(), RANK() and\nROW_NUMBER():\n \nCREATE TABLE student(course VARCHAR(10), mark int, name\nvarchar(10));\n \nINSERT INTO student VALUES \n (\'Maths\', 60, \'Thulile\'),\n (\'Maths\', 60, \'Pritha\'),\n (\'Maths\', 70, \'Voitto\'),\n (\'Maths\', 55, \'Chun\'),\n (\'Biology\', 60, \'Bilal\'),\n (\'Biology\', 70, \'Roger\');\n \nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS\nrank, \n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC)\nAS dense_rank, \n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC)\nAS row_num, \n course, mark, name \nFROM student ORDER BY course, mark DESC;\n \n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+\n \n\n\nURL: https://mariadb.com/kb/en/dense_rank/','','https://mariadb.com/kb/en/dense_rank/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (714,42,'FIRST_VALUE','The FIRST_VALUE() function was first introduced with other\nwindow functions in MariaDB 10.2.\n \nSyntax\n------ \nFIRST_VALUE(expr) OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n) \n \nDescription\n----------- \nFIRST_VALUE returns the first result from an ordered set, or\nNULL if no such result exists.\n \nExamples\n-------- \nCREATE TABLE t1 (\n pk int primary key,\n a int,\n b int,\n c char(10),\n d decimal(10, 3),\n e real\n);\n \nINSERT INTO t1 VALUES\n( 1, 0, 1, \'one\', 0.1, 0.001),\n( 2, 0, 2, \'two\', 0.2, 0.002),\n( 3, 0, 3, \'three\', 0.3, 0.003),\n( 4, 1, 2, \'three\', 0.4, 0.004),\n( 5, 1, 1, \'two\', 0.5, 0.005),\n( 6, 1, 1, \'one\', 0.6, 0.006),\n( 7, 2, NULL, \'n_one\', 0.5, 0.007),\n( 8, 2, 1, \'n_two\', NULL, 0.008),\n( 9, 2, 2, NULL, 0.7, 0.009),\n(10, 2, 0, \'n_four\', 0.8, 0.010),\n(11, 2, 10, NULL, 0.9, NULL);\n \nSELECT pk, FIRST_VALUE(pk) OVER (ORDER BY pk) AS first_asc,\n LAST_VALUE(pk) OVER (ORDER BY pk) AS last_asc,\n FIRST_VALUE(pk) OVER (ORDER BY pk DESC) AS first_desc,\n LAST_VALUE(pk) OVER (ORDER BY pk DESC) AS last_desc\nFROM t1\nORDER BY pk DESC;\n \n+----+-----------+----------+------------+-----------+\n| pk | first_asc | last_asc | first_desc | last_desc |\n+----+-----------+----------+------------+-----------+\n| 11 | 1 | 11 | 11 | 11 |\n| 10 | 1 | 10 | 11 | 10 |\n| 9 | 1 | 9 | 11 | 9 |\n| 8 | 1 | 8 | 11 | 8 |\n| 7 | 1 | 7 | 11 | 7 |\n| 6 | 1 | 6 | 11 | 6 |\n| 5 | 1 | 5 | 11 | 5 |\n| 4 | 1 | 4 | 11 | 4 |\n| 3 | 1 | 3 | 11 | 3 |\n| 2 | 1 | 2 | 11 | 2 |\n| 1 | 1 | 1 | 11 | 1 |\n+----+-----------+----------+------------+-----------+\n \nCREATE OR REPLACE TABLE t1 (i int);\nINSERT INTO t1 VALUES\n(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);\n \nSELECT i,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW\nand 1 FOLLOWING) AS f_1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and\n1 FOLLOWING) AS l_1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING\nAND 1 FOLLOWING) AS f_1p1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND\n1 FOLLOWING) AS f_1p1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING\nAND 1 PRECEDING) AS f_2p1p,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND\n1 PRECEDING) AS f_2p1p,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING\nAND 2 FOLLOWING) AS f_1f2f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND\n2 FOLLOWING) AS f_1f2f\nFROM t1;\n \n+------+------+------+--------+--------+--------+--------+--------+--------+\n| i | f_1f | l_1f | f_1p1f | f_1p1f | f_2p1p | f_2p1p |\nf_1f2f | f_1f2f |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n| 1 | 1 | 2 | 1 | 2 | NULL | NULL | 2 | 3 |\n| 2 | 2 | 3 | 1 | 3 | 1 | 1 | 3 | 4 |\n| 3 | 3 | 4 | 2 | 4 | 1 | 2 | 4 | 5 |\n| 4 | 4 | 5 | 3 | 5 | 2 | 3 | 5 | 6 |\n| 5 | 5 | 6 | 4 | 6 | 3 | 4 | 6 | 7 |\n| 6 | 6 | 7 | 5 | 7 | 4 | 5 | 7 | 8 |\n| 7 | 7 | 8 | 6 | 8 | 5 | 6 | 8 | 9 |\n| 8 | 8 | 9 | 7 | 9 | 6 | 7 | 9 | 10 |\n| 9 | 9 | 10 | 8 | 10 | 7 | 8 | 10 | 10 |\n| 10 | 10 | 10 | 9 | 10 | 8 | 9 | NULL | NULL |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n \n\n\nURL: https://mariadb.com/kb/en/first_value/','','https://mariadb.com/kb/en/first_value/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (715,42,'LAG','The LAG() function was first introduced with other window\nfunctions in MariaDB 10.2.\n \nSyntax\n------ \nLAG (expr[, offset]) OVER ( \n [ PARTITION BY partition_expression ] \n < ORDER BY order_list >\n)\n \nDescription\n----------- \nThe LAG function accesses data from a previous row according\nto the ORDER BY clause without the need for a self-join. The\nspecific row is determined by the offset (default 1), which\nspecifies the number of rows behind the current row to use.\nAn offset of 0 is the current row.\n \nExamples\n-------- \nCREATE TABLE t1 (pk int primary key, a int, b int, c\nchar(10), d decimal(10, 3), e real);\n \nINSERT INTO t1 VALUES\n ( 1, 0, 1, \'one\', 0.1, 0.001),\n ( 2, 0, 2, \'two\', 0.2, 0.002),\n ( 3, 0, 3, \'three\', 0.3, 0.003),\n ( 4, 1, 2, \'three\', 0.4, 0.004),\n ( 5, 1, 1, \'two\', 0.5, 0.005),\n ( 6, 1, 1, \'one\', 0.6, 0.006),\n ( 7, 2, NULL, \'n_one\', 0.5, 0.007),\n ( 8, 2, 1, \'n_two\', NULL, 0.008),\n ( 9, 2, 2, NULL, 0.7, 0.009),\n (10, 2, 0, \'n_four\', 0.8, 0.010),\n (11, 2, 10, NULL, 0.9, NULL);\n \nSELECT pk, LAG(pk) OVER (ORDER BY pk) AS l,\n LAG(pk,1) OVER (ORDER BY pk) AS l1,\n LAG(pk,2) OVER (ORDER BY pk) AS l2,\n LAG(pk,0) OVER (ORDER BY pk) AS l0,\n LAG(pk,-1) OVER (ORDER BY pk) AS lm1,\n LAG(pk,-2) OVER (ORDER BY pk) AS lm2 \nFROM t1;\n \n+----+------+------+------+------+------+------+\n| pk | l | l1 | l2 | l0 | lm1 | lm2 |\n+----+------+------+------+------+------+------+\n| 1 | NULL | NULL | NULL | 1 | 2 | 3 |\n| 2 | 1 | 1 | NULL | 2 | 3 | 4 |\n| 3 | 2 | 2 | 1 | 3 | 4 | 5 |\n| 4 | 3 | 3 | 2 | 4 | 5 | 6 |\n| 5 | 4 | 4 | 3 | 5 | 6 | 7 |\n| 6 | 5 | 5 | 4 | 6 | 7 | 8 |\n| 7 | 6 | 6 | 5 | 7 | 8 | 9 |\n| 8 | 7 | 7 | 6 | 8 | 9 | 10 |\n| 9 | 8 | 8 | 7 | 9 | 10 | 11 |\n| 10 | 9 | 9 | 8 | 10 | 11 | NULL |\n| 11 | 10 | 10 | 9 | 11 | NULL | NULL |\n+----+------+------+------+------+------+------+\n \n\n\nURL: https://mariadb.com/kb/en/lag/','','https://mariadb.com/kb/en/lag/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (717,42,'MEDIAN','The MEDIAN() window function was first introduced with in\nMariaDB 10.3.3.\n \nSyntax\n------ \nMEDIAN(median expression) OVER (\n [ PARTITION BY partition_expression ] \n)\n \nDescription\n----------- \nMEDIAN() is a window function that returns the median value\nof a range of values.\n \nIt is a specific case of PERCENTILE_CONT, with an argument\nof 0.5 and the ORDER BY column the one in MEDIAN\'s\nargument. \n \nMEDIAN() OVER ( [ PARTITION BY partition_expression] )\n \nIs equivalent to:\n \nPERCENTILE_CONT(0.5) WITHIN \n GROUP (ORDER BY ) OVER ( [ PARTITION BY\npartition_expression ])\n \nExamples\n-------- \nCREATE TABLE book_rating (name CHAR(30), star_rating\nTINYINT);\n \nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n5);\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n3);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 1);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 2);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 5);\n \nSELECT name, median(star_rating) OVER (PARTITION BY name)\nFROM book_rating;\n \n+-----------------------+----------------------------------------------+\n| name | median(star_rating) OVER (PARTITION BY name) |\n+-----------------------+----------------------------------------------+\n| Lord of the Ladybirds | 4.0000000000 |\n| Lord of the Ladybirds | 4.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n+-----------------------+----------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/median/','','https://mariadb.com/kb/en/median/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (718,42,'NTH_VALUE','The NTH_VALUE() function was first introduced with other\nwindow functions in MariaDB 10.2.\n \nSyntax\n------ \nNTH_VALUE (expr[, num_row]) OVER ( \n [ PARTITION BY partition_expression ] \n [ ORDER BY order_list ]\n)\n \nDescription\n----------- \nThe NTH_VALUE function returns the value evaluated at row\nnumber num_row of the window frame, starting from 1, or NULL\nif the row does not exist.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/nth_value/','','https://mariadb.com/kb/en/nth_value/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (719,42,'NTILE','The NTILE() function was first introduced with window\nfunctions in MariaDB 10.2.0.\n \nSyntax\n------ \nNTILE (expr) OVER ( \n [ PARTITION BY partition_expression ] \n [ ORDER BY order_list ]\n)\n \nDescription\n----------- \nNTILE() is a window function that returns an integer\nindicating which group a given row falls into. The number of\ngroups is specified in the argument (expr), starting at one.\nOrdered rows in the partition are divided into the specified\nnumber of groups with as equal a size as possible. \n \nExamples\n-------- \ncreate table t1 (\n pk int primary key,\n a int,\n b int\n );\n \ninsert into t1 values\n (11 , 0, 10),\n (12 , 0, 10),\n (13 , 1, 10),\n (14 , 1, 10),\n (18 , 2, 10),\n (15 , 2, 20),\n (16 , 2, 20),\n (17 , 2, 20),\n (19 , 4, 20),\n (20 , 4, 20);\n \nselect pk, a, b,\n ntile(1) over (order by pk)\n from t1;\n \n+----+------+------+-----------------------------+\n| pk | a | b | ntile(1) over (order by pk) |\n+----+------+------+-----------------------------+\n| 11 | 0 | 10 | 1 |\n| 12 | 0 | 10 | 1 |\n| 13 | 1 | 10 | 1 |\n| 14 | 1 | 10 | 1 |\n| 15 | 2 | 20 | 1 |\n| 16 | 2 | 20 | 1 |\n| 17 | 2 | 20 | 1 |\n| 18 | 2 | 10 | 1 |\n| 19 | 4 | 20 | 1 |\n| 20 | 4 | 20 | 1 |\n+----+------+------+-----------------------------+\n \nselect pk, a, b,\n ntile(4) over (order by pk)\n from t1;\n \n+----+------+------+-----------------------------+\n| pk | a | b | ntile(4) over (order by pk) |\n+----+------+------+-----------------------------+\n| 11 | 0 | 10 | 1 |\n| 12 | 0 | 10 | 1 |\n| 13 | 1 | 10 | 1 |\n| 14 | 1 | 10 | 2 |\n| 15 | 2 | 20 | 2 |\n| 16 | 2 | 20 | 2 |\n| 17 | 2 | 20 | 3 |\n| 18 | 2 | 10 | 3 |\n| 19 | 4 | 20 | 4 |\n| 20 | 4 | 20 | 4 |\n+----+------+------+-----------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/ntile/','','https://mariadb.com/kb/en/ntile/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (720,42,'PERCENT_RANK','The PERCENT_RANK() function was first introduced with window\nfunctions in MariaDB 10.2.0.\n \nSyntax\n------ \nPERCENT_RANK() OVER (\n [ PARTITION BY partition_expression ] \n [ ORDER BY order_list ]\n)\n \nDescription\n----------- \nPERCENT_RANK() is a window function that returns the\nrelative percent rank of a given row. The following formula\nis used to calculate the percent rank:\n \n(rank - 1) / (number of rows in the window or partition - 1)\n \nExamples\n-------- \ncreate table t1 (\n pk int primary key,\n a int,\n b int\n);\n \ninsert into t1 values\n( 1 , 0, 10),\n( 2 , 0, 10),\n( 3 , 1, 10),\n( 4 , 1, 10),\n( 8 , 2, 10),\n( 5 , 2, 20),\n( 6 , 2, 20),\n( 7 , 2, 20),\n( 9 , 4, 20),\n(10 , 4, 20);\n \nselect pk, a, b,\n rank() over (order by a) as rank,\n percent_rank() over (order by a) as pct_rank,\n cume_dist() over (order by a) as cume_dist\nfrom t1;\n \n+----+------+------+------+--------------+--------------+\n| pk | a | b | rank | pct_rank | cume_dist |\n+----+------+------+------+--------------+--------------+\n| 1 | 0 | 10 | 1 | 0.0000000000 | 0.2000000000 |\n| 2 | 0 | 10 | 1 | 0.0000000000 | 0.2000000000 |\n| 3 | 1 | 10 | 3 | 0.2222222222 | 0.4000000000 |\n| 4 | 1 | 10 | 3 | 0.2222222222 | 0.4000000000 |\n| 5 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 6 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 7 | 2 | 20 | 5 | 0.4444444444 | 0.8000000000 |\n| 8 | 2 | 10 | 5 | 0.4444444444 | 0.8000000000 |\n| 9 | 4 | 20 | 9 | 0.8888888889 | 1.0000000000 |\n| 10 | 4 | 20 | 9 | 0.8888888889 | 1.0000000000 |\n+----+------+------+------+--------------+--------------+\n \nselect pk, a, b,\n percent_rank() over (order by pk) as pct_rank,\n cume_dist() over (order by pk) as cume_dist\nfrom t1 order by pk;\n \n+----+------+------+--------------+--------------+\n| pk | a | b | pct_rank | cume_dist |\n+----+------+------+--------------+--------------+\n| 1 | 0 | 10 | 0.0000000000 | 0.1000000000 |\n| 2 | 0 | 10 | 0.1111111111 | 0.2000000000 |\n| 3 | 1 | 10 | 0.2222222222 | 0.3000000000 |\n| 4 | 1 | 10 | 0.3333333333 | 0.4000000000 |\n| 5 | 2 | 20 | 0.4444444444 | 0.5000000000 |\n| 6 | 2 | 20 | 0.5555555556 | 0.6000000000 |\n| 7 | 2 | 20 | 0.6666666667 | 0.7000000000 |\n| 8 | 2 | 10 | 0.7777777778 | 0.8000000000 |\n| 9 | 4 | 20 | 0.8888888889 | 0.9000000000 |\n| 10 | 4 | 20 | 1.0000000000 | 1.0000000000 |\n+----+------+------+--------------+--------------+\n \nselect pk, a, b,\n percent_rank() over (partition by a order by a) as\npct_rank,\n cume_dist() over (partition by a order by a) as cume_dist\nfrom t1;\n \n+----+------+------+--------------+--------------+\n| pk | a | b | pct_rank | cume_dist |\n+----+------+------+--------------+--------------+\n| 1 | 0 | 10 | 0.0000000000 | 1.0000000000 |\n| 2 | 0 | 10 | 0.0000000000 | 1.0000000000 |\n| 3 | 1 | 10 | 0.0000000000 | 1.0000000000 |\n| 4 | 1 | 10 | 0.0000000000 | 1.0000000000 |\n| 5 | 2 | 20 | 0.0000000000 | 1.0000000000 |\n| 6 | 2 | 20 | 0.0000000000 | 1.0000000000 |\n| 7 | 2 | 20 | 0.0000000000 | 1.0000000000 |\n| 8 | 2 | 10 | 0.0000000000 | 1.0000000000 |\n| 9 | 4 | 20 | 0.0000000000 | 1.0000000000 |\n| 10 | 4 | 20 | 0.0000000000 | 1.0000000000 |\n+----+------+------+--------------+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/percent_rank/','','https://mariadb.com/kb/en/percent_rank/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (721,42,'PERCENTILE_CONT','The PERCENTILE_CONT() window function was first introduced\nwith in MariaDB 10.3.3.\n \nSyntax\n------ \nDescription\n----------- \nPERCENTILE_CONT() (standing for continuous percentile) is a\nwindow function which returns a value which corresponds to\nthe given fraction in the sort order. If required, it will\ninterpolate between adjacent input items.\n \nEssentially, the following process is followed to find the\nvalue to return:\nGet the number of rows in the partition, denoted by N\nRN = p*(N-1), where p denotes the argument to the\nPERCENTILE_CONT function\ncalculate the FRN(floor row number) and CRN(column row\nnumber for the group( FRN= floor(RN) and CRN = ceil(RN))\nlook up rows FRN and CRN\nIf (CRN = FRN = RN) then the result is (value of expression\nfrom row at RN)\nOtherwise the result is\n(CRN - RN) * (value of expression for row at FRN) +\n(RN - FRN) * (value of expression for row at CRN)\n \nThe MEDIAN function is a specific case of PERCENTILE_CONT,\nequivalent to PERCENTILE_CONT(0.5).\n \nExamples\n-------- \nCREATE TABLE book_rating (name CHAR(30), star_rating\nTINYINT);\n \nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n5);\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n3);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 1);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 2);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 5);\n \nSELECT name, PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc \n FROM book_rating;\n \n+-----------------------+--------------+\n| name | pc |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 4.0000000000 |\n| Lord of the Ladybirds | 4.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n| Lady of the Flies | 2.0000000000 |\n+-----------------------+--------------+\n \nSELECT name, PERCENTILE_CONT(1) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc \n FROM book_rating;\n \n+-----------------------+--------------+\n| name | pc |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 5.0000000000 |\n| Lord of the Ladybirds | 5.0000000000 |\n| Lady of the Flies | 5.0000000000 |\n| Lady of the Flies | 5.0000000000 |\n| Lady of the Flies | 5.0000000000 |\n+-----------------------+--------------+\n \nSELECT name, PERCENTILE_CONT(0) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc \n FROM book_rating;\n \n+-----------------------+--------------+\n| name | pc |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 3.0000000000 |\n| Lord of the Ladybirds | 3.0000000000 |\n| Lady of the Flies | 1.0000000000 |\n| Lady of the Flies | 1.0000000000 |\n| Lady of the Flies | 1.0000000000 |\n+-----------------------+--------------+\n \nSELECT name, PERCENTILE_CONT(0.6) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc \n FROM book_rating;\n \n+-----------------------+--------------+\n| name | pc |\n+-----------------------+--------------+\n| Lord of the Ladybirds | 4.2000000000 |\n| Lord of the Ladybirds | 4.2000000000 |\n| Lady of the Flies | 2.6000000000 |\n| Lady of the Flies | 2.6000000000 |\n| Lady of the Flies | 2.6000000000 |\n+-----------------------+--------------+\n \n\n\nURL: https://mariadb.com/kb/en/percentile_cont/','','https://mariadb.com/kb/en/percentile_cont/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (722,42,'PERCENTILE_DISC','The PERCENTILE_DISC() window function was first introduced\nwith in MariaDB 10.3.3.\n \nSyntax\n------ \n\nDescription\n----------- \nPERCENTILE_DISC() (standing for discrete percentile) is a\nwindow function which returns the first value in the set\nwhose ordered position is the same or more than the\nspecified fraction.\n \nEssentially, the following process is followed to find the\nvalue to return:\nGet the number of rows in the partition.\nWalk through the partition, in order, until finding the the\nfirst row with CUME_DIST() > function_argument.\n \nExamples\n-------- \nCREATE TABLE book_rating (name CHAR(30), star_rating\nTINYINT);\n \nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n5);\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\',\n3);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 1);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 2);\nINSERT INTO book_rating VALUES (\'Lady of the Flies\', 5);\n \nSELECT name, PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY\nstar_rating)\n OVER (PARTITION BY name) AS pc FROM book_rating;\n \n+-----------------------+------+\n| name | pc |\n+-----------------------+------+\n| Lord of the Ladybirds | 3 |\n| Lord of the Ladybirds | 3 |\n| Lady of the Flies | 2 |\n| Lady of the Flies | 2 |\n| Lady of the Flies | 2 |\n+-----------------------+------+\n5 rows in set (0.000 sec)\n \nSELECT name, PERCENTILE_DISC(0) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\n \n+-----------------------+------+\n| name | pc |\n+-----------------------+------+\n| Lord of the Ladybirds | 3 |\n| Lord of the Ladybirds | 3 |\n| Lady of the Flies | 1 |\n| Lady of the Flies | 1 |\n| Lady of the Flies | 1 |\n+-----------------------+------+\n5 rows in set (0.000 sec)\n \nSELECT name, PERCENTILE_DISC(1) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\n \n+-----------------------+------+\n| name | pc |\n+-----------------------+------+\n| Lord of the Ladybirds | 5 |\n| Lord of the Ladybirds | 5 |\n| Lady of the Flies | 5 |\n| Lady of the Flies | 5 |\n| Lady of the Flies | 5 |\n+-----------------------+------+\n5 rows in set (0.000 sec)\n \nSELECT name, PERCENTILE_DISC(0.6) WITHIN GROUP (ORDER BY\nstar_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\n \n+-----------------------+------+\n| name | pc |\n+-----------------------+------+\n| Lord of the Ladybirds | 5 |\n| Lord of the Ladybirds | 5 |\n| Lady of the Flies | 2 |\n| Lady of the Flies | 2 |\n| Lady of the Flies | 2 |\n+-----------------------+------\n \n\n\nURL: https://mariadb.com/kb/en/percentile_disc/','','https://mariadb.com/kb/en/percentile_disc/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (723,42,'RANK','The RANK() function was first introduced with window\nfunctions in MariaDB 10.2.0.\n \nSyntax\n------ \nRANK() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n) \n \nDescription\n----------- \nRANK() is a window function that displays the number of a\ngiven row, starting at one and following the ORDER BY\nsequence of the window function, with identical values\nreceiving the same result. It is similar to the ROW_NUMBER()\nfunction except that in that function, identical values will\nreceive a different row number for each result.\n \nExamples\n-------- \nThe distinction between DENSE_RANK(), RANK() and\nROW_NUMBER():\n \nCREATE TABLE student(course VARCHAR(10), mark int, name\nvarchar(10));\n \nINSERT INTO student VALUES \n (\'Maths\', 60, \'Thulile\'),\n (\'Maths\', 60, \'Pritha\'),\n (\'Maths\', 70, \'Voitto\'),\n (\'Maths\', 55, \'Chun\'),\n (\'Biology\', 60, \'Bilal\'),\n (\'Biology\', 70, \'Roger\');\n \nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS\nrank, \n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC)\nAS dense_rank, \n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC)\nAS row_num, \n course, mark, name \nFROM student ORDER BY course, mark DESC;\n \n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+\n \n\n\nURL: https://mariadb.com/kb/en/rank/','','https://mariadb.com/kb/en/rank/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (724,42,'ROW_NUMBER','ROW_NUMBER() was first introduced with window functions in\nMariaDB 10.2.0.\n \nSyntax\n------ \nROW_NUMBER() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n) \n \nDescription\n----------- \nROW_NUMBER() is a window function that displays the number\nof a given row, starting at one and following the ORDER BY\nsequence of the window function, with identical values\nreceiving different row numbers. It is similar to the RANK()\nand DENSE_RANK() functions except that in that function,\nidentical values will receive the same rank for each result.\n \nExamples\n-------- \nThe distinction between DENSE_RANK(), RANK() and\nROW_NUMBER():\n \nCREATE TABLE student(course VARCHAR(10), mark int, name\nvarchar(10));\n \nINSERT INTO student VALUES \n (\'Maths\', 60, \'Thulile\'),\n (\'Maths\', 60, \'Pritha\'),\n (\'Maths\', 70, \'Voitto\'),\n (\'Maths\', 55, \'Chun\'),\n (\'Biology\', 60, \'Bilal\'),\n (\'Biology\', 70, \'Roger\');\n \nSELECT \n RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS\nrank, \n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC)\nAS dense_rank, \n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC)\nAS row_num, \n course, mark, name \nFROM student ORDER BY course, mark DESC;\n \n+------+------------+---------+---------+------+---------+\n| rank | dense_rank | row_num | course | mark | name |\n+------+------------+---------+---------+------+---------+\n| 1 | 1 | 1 | Biology | 70 | Roger |\n| 2 | 2 | 2 | Biology | 60 | Bilal |\n| 1 | 1 | 1 | Maths | 70 | Voitto |\n| 2 | 2 | 2 | Maths | 60 | Thulile |\n| 2 | 2 | 3 | Maths | 60 | Pritha |\n| 4 | 3 | 4 | Maths | 55 | Chun |\n+------+------------+---------+---------+------+---------+\n \n\n\nURL: https://mariadb.com/kb/en/row_number/','','https://mariadb.com/kb/en/row_number/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (725,43,'SPIDER_BG_DIRECT_SQL','Syntax\n------ \nSPIDER_BG_DIRECT_SQL(\'sql\', \'tmp_table_list\',\n\'parameters\')\n \nDescription\n----------- \nExecutes the given SQL statement in the background on the\nremote server, as defined in the parameters listing. If the\nquery returns a result-set, it sttores the results in the\ngiven temporary table. When the given SQL statement executes\nsuccessfully, this function returns the number of called\nUDF\'s. It returns 0 when the given SQL statement fails.\n \nThis function is a UDF installed with the Spider storage\nengine.\n \nExamples\n-------- \nSELECT SPIDER_BG_DIRECT_SQL(\'SELECT * FROM example_table\',\n\'\', \n \'srv \"node1\", port \"8607\"\') AS \"Direct Query\";\n+--------------+\n| Direct Query | \n+--------------+\n| 1 |\n+--------------+\n \nParameters\n \nerror_rw_mode\n \nDescription: Returns empty results on network error.\n0 : Return error on getting network error.\n1: Return 0 records on getting network error.\n \nDefault Table Value: 0\nDSN Parameter Name: erwm\n \n\n\nURL: https://mariadb.com/kb/en/spider_bg_direct_sql/','','https://mariadb.com/kb/en/spider_bg_direct_sql/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (726,43,'SPIDER_COPY_TABLES','Syntax\n------ \nSPIDER_COPY_TABLES(spider_table_name, \n source_link_id, destination_link_id_list [,parameters])\n \nDescription\n----------- \nA UDF installed with the Spider Storage Engine, this\nfunction copies table data from source_link_id to\ndestination_link_id_list. The service does not need to be\nstopped in order to copy.\n \nIf the Spider table is partitioned, the name must be of the\nformat table_name#P#partition_name. The partition name can\nbe viewed in the mysql.spider_tables table, for example:\n \nSELECT table_name FROM mysql.spider_tables;\n+-------------+\n| table_name |\n+-------------+\n| spt_a#P#pt1 |\n| spt_a#P#pt2 |\n| spt_a#P#pt3 |\n+-------------+\n \nReturns 1 if the data was copied successfully, or 0 if\ncopying the data failed.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/spider_copy_tables/','','https://mariadb.com/kb/en/spider_copy_tables/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (727,43,'SPIDER_DIRECT_SQL','Syntax\n------ \nSPIDER_DIRECT_SQL(\'sql\', \'tmp_table_list\',\n\'parameters\')\n \nDescription\n----------- \nA UDF installed with the Spider Storage Engine, this\nfunction is used to execute the SQL string sql on the remote\nserver, as defined in parameters. If any resultsets are\nreturned, they are stored in the tmp_table_list.\n \nThe function returns 1 if the SQL executes successfully, or\n0 if it fails.\n \nExamples\n-------- \nSELECT SPIDER_DIRECT_SQL(\'SELECT * FROM s\', \'\', \'srv\n\"node1\", port \"8607\"\');\n+----------------------------------------------------------------------+\n| SPIDER_DIRECT_SQL(\'SELECT * FROM s\', \'\', \'srv\n\"node1\", port \"8607\"\') |\n+----------------------------------------------------------------------+\n| 1 |\n+----------------------------------------------------------------------+\n \n\n\nURL: https://mariadb.com/kb/en/spider_direct_sql/','','https://mariadb.com/kb/en/spider_direct_sql/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (728,43,'SPIDER_FLUSH_TABLE_MON_CACHE','Syntax\n------ \nSPIDER_FLUSH_TABLE_MON_CACHE()\n \nDescription\n----------- \nA UDF installed with the Spider Storage Engine, this\nfunction is used for refreshing monitoring server\ninformation. It returns a value of 1.\n \nExamples\n-------- \nSELECT SPIDER_FLUSH_TABLE_MON_CACHE();\n+--------------------------------+\n| SPIDER_FLUSH_TABLE_MON_CACHE() |\n+--------------------------------+\n| 1 |\n+--------------------------------+\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/spider_flush_table_mon_cache/','','https://mariadb.com/kb/en/spider_flush_table_mon_cache/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (729,44,'COLUMN_ADD','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_ADD(dyncol_blob, column_nr, value [as type],\n[column_nr, value [as type]]...);\nCOLUMN_ADD(dyncol_blob, column_name, value [as type],\n[column_name, value [as type]]...);\n \nDescription\n----------- \nAdds or updates dynamic columns.\ndyncol_blob must be either a valid dynamic columns blob (for\nexample, COLUMN_CREATE returns such blob), or an empty\nstring.\ncolumn_name specifies the name of the column to be added. If\ndyncol_blob already has a column with this name, it will be\noverwritten.\nvalue specifies the new value for the column. Passing a NULL\nvalue will cause the column to be deleted.\nas type is optional. See #datatypes section for a discussion\nabout types.\n \nThe return value is a dynamic column blob after the\nmodifications.\n \nExamples\n-------- \n-- MariaDB 5.3+:\nUPDATE tbl SET dyncol_blob=COLUMN_ADD(dyncol_blob, 1\n/*column id*/, \"value\") WHERE id=1;\n \n-- MariaDB 10.0.1+:\nUPDATE t1 SET dyncol_blob=COLUMN_ADD(dyncol_blob,\n\"column_name\", \"value\") WHERE id=1;\n \nNote: COLUMN_ADD() is a regular function (just like\nCONCAT()), hence, in order to update the value in the table\nyou have to use the UPDATE ... SET\ndynamic_col=COLUMN_ADD(dynamic_col,\n....) pattern.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_add/','','https://mariadb.com/kb/en/column_add/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (730,44,'COLUMN_CHECK','The COLUMN_CHECK function was added in MariaDB 10.0.1.\n \nSyntax\n------ \nCOLUMN_CHECK(dyncol_blob);\n \nDescription\n----------- \nCheck if dyncol_blob is a valid packed dynamic columns blob.\nReturn value of 1 means the blob is valid, return value of 0\nmeans it is not.\n \nRationale:\nNormally, one works with valid dynamic column blobs.\nFunctions like COLUMN_CREATE, COLUMN_ADD, COLUMN_DELETE\nalways return valid dynamic column blobs. However, if a\ndynamic column blob is accidentally truncated, or transcoded\nfrom one character set to another, it will be corrupted.\nThis function can be used to check if a value in a blob\nfield is a valid dynamic column blob.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_check/','','https://mariadb.com/kb/en/column_check/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (731,44,'COLUMN_CREATE','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_CREATE(column_nr, value [as type], [column_nr, value\n[as type]]...);\nCOLUMN_CREATE(column_name, value [as type], [column_name,\nvalue [as type]]...);\n \nDescription\n----------- \nReturns a dynamic columns blob that stores the specified\ncolumns with values.\n \nThe return value is suitable for \nstoring in a table\nfurther modification with other dynamic columns functions\n \nThe as type part allows one to specify the value type. In\nmost cases,\nthis is redundant because MariaDB will be able to deduce the\ntype of the\nvalue. Explicit type specification may be needed when the\ntype of the value is\nnot apparent. For example, a literal \'2012-12-01\' has a\nCHAR type by\ndefault, one will need to specify \'2012-12-01\' AS DATE to\nhave it stored as\na date. See Dynamic Columns:Datatypes for further details.\n \nExamples\n-------- \n-- MariaDB 5.3+:\nINSERT INTO tbl SET dyncol_blob=COLUMN_CREATE(1 /*column\nid*/, \"value\");\n-- MariaDB 10.0.1+:\nINSERT INTO tbl SET\ndyncol_blob=COLUMN_CREATE(\"column_name\", \"value\");\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_create/','','https://mariadb.com/kb/en/column_create/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (732,44,'COLUMN_DELETE','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_DELETE(dyncol_blob, column_nr, column_nr...);\nCOLUMN_DELETE(dyncol_blob, column_name, column_name...);\n \nDescription\n----------- \nDeletes a dynamic column with the specified name. Multiple\nnames can be given. The return value is a dynamic column\nblob after the modification.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_delete/','','https://mariadb.com/kb/en/column_delete/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (733,44,'COLUMN_EXISTS','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_EXISTS(dyncol_blob, column_nr);\nCOLUMN_EXISTS(dyncol_blob, column_name);\n \nDescription\n----------- \nChecks if a column with name column_name exists in\ndyncol_blob. If yes, return 1, otherwise return 0. See\ndynamic columns for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_exists/','','https://mariadb.com/kb/en/column_exists/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (734,44,'COLUMN_GET','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_GET(dyncol_blob, column_nr as type);\nCOLUMN_GET(dyncol_blob, column_name as type);\n \nDescription\n----------- \nGets the value of a dynamic column by its name. If no column\nwith the given name exists, NULL will be returned.\n \ncolumn_name as type requires that one specify the datatype\nof the dynamic column they are reading. \n \nThis may seem counter-intuitive: why would one need to\nspecify which datatype they\'re retrieving? Can\'t the\ndynamic columns system figure the datatype from the data\nbeing stored?\n \nThe answer is: SQL is a statically-typed language. The SQL\ninterpreter needs to know the datatypes of all expressions\nbefore the query is run (for example, when one is using\nprepared statements and runs \"select COLUMN_GET(...)\", the\nprepared statement API requires the server to inform the\nclient about the datatype of the column being read before\nthe query is executed and the server can see what datatype\nthe column actually has).\n \nA note about lengths\n \nIf you\'re running queries like:\n \nSELECT COLUMN_GET(blob, \'colname\' as CHAR) ...\n \nwithout specifying a maximum length (i.e. using #as CHAR#,\nnot as CHAR(n)), MariaDB will report the maximum length of\nthe resultset column to be 53,6870,911 for MariaDB\n5.3-10.0.0 and 16,777,216 for MariaDB 10.0.1+. This may\ncause excessive memory usage in some client libraries,\nbecause they try to pre-allocate a buffer of maximum\nresultset width. To avoid this problem, use CHAR(n) whenever\nyou\'re using COLUMN_GET in the select list.\n \nSee Dynamic Columns:Datatypes for more information about\ndatatypes.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_get/','','https://mariadb.com/kb/en/column_get/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (735,44,'COLUMN_JSON','COLUMN_JSON was introduced in MariaDB 10.0.1\n \nSyntax\n------ \nCOLUMN_JSON(dyncol_blob)\n \nDescription\n----------- \nReturns a JSON representation of data in dyncol_blob. Can\nalso be used to display nested columns. See dynamic columns\nfor more information.\n \nExample\n \nselect item_name, COLUMN_JSON(dynamic_cols) from assets;\n+-----------------+----------------------------------------+\n| item_name | COLUMN_JSON(dynamic_cols) |\n+-----------------+----------------------------------------+\n| MariaDB T-shirt | {\"size\":\"XL\",\"color\":\"blue\"} |\n| Thinkpad Laptop | {\"color\":\"black\",\"warranty\":\"3\nyears\"} |\n+-----------------+----------------------------------------+\n \nLimitation: COLUMN_JSON will decode nested dynamic columns\nat a nesting level of not more than 10 levels deep. Dynamic\ncolumns that are nested deeper than 10 levels will be shown\nas BINARY string, without encoding.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_json/','','https://mariadb.com/kb/en/column_json/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (736,44,'COLUMN_LIST','The Dynamic columns feature was introduced in MariaDB 5.3.\n \nSyntax\n------ \nCOLUMN_LIST(dyncol_blob);\n \nDescription\n----------- \nSince MariaDB 10.0.1, this function returns a\ncomma-separated list of column names. The names are quoted\nwith backticks.\n \nBefore MariaDB 10.0.1, it returned a comma-separated list of\ncolumn numbers, not names.\n \nSee dynamic columns for more information.\n \n\n \n \n \n \n \n \n \n\nURL: https://mariadb.com/kb/en/column_list/','','https://mariadb.com/kb/en/column_list/'); -insert into help_keyword values (1,'master_ssl_verify_cert'); -insert into help_keyword values (2,'drop prepare'); -insert into help_keyword values (3,'work'); -insert into help_keyword values (4,'drop'); -insert into help_keyword values (5,'returns'); -insert into help_keyword values (6,'value'); -insert into help_keyword values (7,'nchar'); -insert into help_keyword values (8,'repeat'); -insert into help_keyword values (9,'columns'); -insert into help_keyword values (10,'sql_big_result'); -insert into help_keyword values (11,'escape'); -insert into help_keyword values (12,'mode'); -insert into help_keyword values (13,'schedule'); -insert into help_keyword values (14,'starts'); -insert into help_keyword values (15,'host'); -insert into help_keyword values (16,'row_format'); -insert into help_relation values (95,1); -insert into help_relation values (97,2); -insert into help_relation values (110,3); -insert into help_relation values (120,4); -insert into help_relation values (128,4); -insert into help_relation values (258,5); -insert into help_relation values (259,4); -insert into help_relation values (264,6); -insert into help_relation values (271,7); -insert into help_relation values (316,8); -insert into help_relation values (317,6); -insert into help_relation values (320,6); -insert into help_relation values (355,9); -insert into help_relation values (417,6); -insert into help_relation values (433,6); -insert into help_relation values (434,10); -insert into help_relation values (603,11); -insert into help_relation values (610,12); -insert into help_relation values (621,8); -insert into help_relation values (642,13); -insert into help_relation values (647,4); -insert into help_relation values (652,14); -insert into help_relation values (659,15); -insert into help_relation values (660,16); -insert into help_relation values (664,4); -insert into help_relation values (665,4); -insert into help_relation values (666,4); -insert into help_relation values (667,4); -insert into help_relation values (668,4); -insert into help_relation values (669,4); -insert into help_relation values (670,4); -insert into help_relation values (671,4); -insert into help_relation values (672,4); -insert into help_relation values (673,4); -insert into help_relation values (675,4); -insert into help_relation values (676,4); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (1,9,'HELP_DATE','Help Contents generated from the MariaDB Knowledge Base on 23 January 2023.','',''); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (2,9,'HELP_VERSION','Help Contents generated for MariaDB 10.8 from the MariaDB Knowledge Base on 23 January 2023.','',''); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (3,2,'AREA','A synonym for ST_AREA.\n\nURL: https://mariadb.com/kb/en/polygon-properties-area/','','https://mariadb.com/kb/en/polygon-properties-area/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (4,2,'CENTROID','A synonym for ST_CENTROID.\n\nURL: https://mariadb.com/kb/en/centroid/','','https://mariadb.com/kb/en/centroid/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (5,2,'ExteriorRing','A synonym for ST_ExteriorRing.\n\nURL: https://mariadb.com/kb/en/polygon-properties-exteriorring/','','https://mariadb.com/kb/en/polygon-properties-exteriorring/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (6,2,'InteriorRingN','A synonym for ST_InteriorRingN.\n\nURL: https://mariadb.com/kb/en/polygon-properties-interiorringn/','','https://mariadb.com/kb/en/polygon-properties-interiorringn/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (7,2,'NumInteriorRings','A synonym for ST_NumInteriorRings.\n\nURL: https://mariadb.com/kb/en/polygon-properties-numinteriorrings/','','https://mariadb.com/kb/en/polygon-properties-numinteriorrings/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (8,2,'ST_AREA','Syntax\n------\n\nST_Area(poly)\nArea(poly)\n\nDescription\n-----------\n\nReturns as a double-precision number the area of the Polygon value poly, as\nmeasured in its spatial reference system.\n\nST_Area() and Area() are synonyms.\n\nExamples\n--------\n\nSET @poly = \'Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1 1))\';\n\nSELECT Area(GeomFromText(@poly));\n+---------------------------+\n| Area(GeomFromText(@poly)) |\n+---------------------------+\n| 4 |\n+---------------------------+\n\nURL: https://mariadb.com/kb/en/st_area/','','https://mariadb.com/kb/en/st_area/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (9,2,'ST_CENTROID','Syntax\n------\n\nST_Centroid(mpoly)\nCentroid(mpoly)\n\nDescription\n-----------\n\nReturns a point reflecting the mathematical centroid (geometric center) for\nthe MultiPolygon mpoly. The resulting point will not necessarily be on the\nMultiPolygon.\n\nST_Centroid() and Centroid() are synonyms.\n\nExamples\n--------\n\nSET @poly = ST_GeomFromText(\'POLYGON((0 0,20 0,20 20,0 20,0 0))\');\nSELECT ST_AsText(ST_Centroid(@poly)) AS center;\n+--------------+\n| center |\n+--------------+\n| POINT(10 10) |\n+--------------+\n\nURL: https://mariadb.com/kb/en/st_centroid/','','https://mariadb.com/kb/en/st_centroid/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (10,2,'ST_ExteriorRing','Syntax\n------\n\nST_ExteriorRing(poly)\nExteriorRing(poly)\n\nDescription\n-----------\n\nReturns the exterior ring of the Polygon value poly as a LineString.\n\nST_ExteriorRing() and ExteriorRing() are synonyms.\n\nExamples\n--------\n\nSET @poly = \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))\';\n\nSELECT AsText(ExteriorRing(GeomFromText(@poly)));\n+-------------------------------------------+\n| AsText(ExteriorRing(GeomFromText(@poly))) |\n+-------------------------------------------+\n| LINESTRING(0 0,0 3,3 3,3 0,0 0) |\n+-------------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_exteriorring/','','https://mariadb.com/kb/en/st_exteriorring/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (11,2,'ST_InteriorRingN','Syntax\n------\n\nST_InteriorRingN(poly,N)\nInteriorRingN(poly,N)\n\nDescription\n-----------\n\nReturns the N-th interior ring for the Polygon value poly as a LineString.\nRings are numbered beginning with 1.\n\nST_InteriorRingN() and InteriorRingN() are synonyms.\n\nExamples\n--------\n\nSET @poly = \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))\';\n\nSELECT AsText(InteriorRingN(GeomFromText(@poly),1));\n+----------------------------------------------+\n| AsText(InteriorRingN(GeomFromText(@poly),1)) |\n+----------------------------------------------+\n| LINESTRING(1 1,1 2,2 2,2 1,1 1) |\n+----------------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_interiorringn/','','https://mariadb.com/kb/en/st_interiorringn/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (12,2,'ST_NumInteriorRings','Syntax\n------\n\nST_NumInteriorRings(poly)\nNumInteriorRings(poly)\n\nDescription\n-----------\n\nReturns an integer containing the number of interior rings in the Polygon\nvalue poly.\n\nNote that according the the OpenGIS standard, a POLYGON should have exactly\none ExteriorRing and all other rings should lie within that ExteriorRing and\nthus be the InteriorRings. Practically, however, some systems, including\nMariaDB\'s, permit polygons to have several \'ExteriorRings\'. In the case of\nthere being multiple, non-overlapping exterior rings ST_NumInteriorRings()\nwill return 1.\n\nST_NumInteriorRings() and NumInteriorRings() are synonyms.\n\nExamples\n--------\n\nSET @poly = \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))\';\n\nSELECT NumInteriorRings(GeomFromText(@poly));\n+---------------------------------------+\n| NumInteriorRings(GeomFromText(@poly)) |\n+---------------------------------------+\n| 1 |\n+---------------------------------------+\n\nNon-overlapping \'polygon\':\n\nSELECT ST_NumInteriorRings(ST_PolyFromText(\'POLYGON((0 0,10 0,10 10,0 10,0 0),\n (-1 -1,-5 -1,-5 -5,-1 -5,-1 -1))\')) AS NumInteriorRings;\n+------------------+\n| NumInteriorRings |\n+------------------+\n| 1 |\n+------------------+\n\nURL: https://mariadb.com/kb/en/st_numinteriorrings/','','https://mariadb.com/kb/en/st_numinteriorrings/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (13,3,'WKT Definition','Description\n-----------\n\nThe Well-Known Text (WKT) representation of Geometry is designed to exchange\ngeometry data in ASCII form. Examples of the basic geometry types include:\n\n+-----------------------------------------------------------------------------+\n| Geometry Types |\n+-----------------------------------------------------------------------------+\n| POINT |\n+-----------------------------------------------------------------------------+\n| LINESTRING |\n+-----------------------------------------------------------------------------+\n| POLYGON |\n+-----------------------------------------------------------------------------+\n| MULTIPOINT |\n+-----------------------------------------------------------------------------+\n| MULTILINESTRING |\n+-----------------------------------------------------------------------------+\n| MULTIPOLYGON |\n+-----------------------------------------------------------------------------+\n| GEOMETRYCOLLECTION |\n+-----------------------------------------------------------------------------+\n| GEOMETRY |\n+-----------------------------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/wkt-definition/','','https://mariadb.com/kb/en/wkt-definition/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (14,3,'AsText','A synonym for ST_AsText().\n\nURL: https://mariadb.com/kb/en/wkt-astext/','','https://mariadb.com/kb/en/wkt-astext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (15,3,'AsWKT','A synonym for ST_AsText().\n\nURL: https://mariadb.com/kb/en/wkt-aswkt/','','https://mariadb.com/kb/en/wkt-aswkt/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (16,3,'GeomCollFromText','A synonym for ST_GeomCollFromText.\n\nURL: https://mariadb.com/kb/en/wkt-geomcollfromtext/','','https://mariadb.com/kb/en/wkt-geomcollfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (17,3,'GeometryCollectionFromText','A synonym for ST_GeomCollFromText.\n\nURL: https://mariadb.com/kb/en/geometrycollectionfromtext/','','https://mariadb.com/kb/en/geometrycollectionfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (18,3,'GeometryFromText','A synonym for ST_GeomFromText.\n\nURL: https://mariadb.com/kb/en/geometryfromtext/','','https://mariadb.com/kb/en/geometryfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (19,3,'GeomFromText','A synonym for ST_GeomFromText.\n\nURL: https://mariadb.com/kb/en/wkt-geomfromtext/','','https://mariadb.com/kb/en/wkt-geomfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (20,3,'LineFromText','A synonym for ST_LineFromText.\n\nURL: https://mariadb.com/kb/en/wkt-linefromtext/','','https://mariadb.com/kb/en/wkt-linefromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (21,3,'LineStringFromText','A synonym for ST_LineFromText.\n\nURL: https://mariadb.com/kb/en/linestringfromtext/','','https://mariadb.com/kb/en/linestringfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (22,3,'MLineFromText','Syntax\n------\n\nMLineFromText(wkt[,srid])\nMultiLineStringFromText(wkt[,srid])\n\nDescription\n-----------\n\nConstructs a MULTILINESTRING value using its WKT representation and SRID.\n\nMLineFromText() and MultiLineStringFromText() are synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nSHOW FIELDS FROM gis_multi_line;\nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(\'MULTILINESTRING((10 48,10 21,10 0),(16 0,16\n23,16 48))\')),\n (MLineFromText(\'MULTILINESTRING((10 48,10 21,10 0))\')),\n (MLineFromWKB(AsWKB(MultiLineString(\n LineString(Point(1, 2), Point(3, 5)),\n LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));\n\nURL: https://mariadb.com/kb/en/mlinefromtext/','','https://mariadb.com/kb/en/mlinefromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (23,3,'MPointFromText','Syntax\n------\n\nMPointFromText(wkt[,srid])\nMultiPointFromText(wkt[,srid])\n\nDescription\n-----------\n\nConstructs a MULTIPOINT value using its WKT representation and SRID.\n\nMPointFromText() and MultiPointFromText() are synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_multi_point (g MULTIPOINT);\nSHOW FIELDS FROM gis_multi_point;\nINSERT INTO gis_multi_point VALUES\n (MultiPointFromText(\'MULTIPOINT(0 0,10 10,10 20,20 20)\')),\n (MPointFromText(\'MULTIPOINT(1 1,11 11,11 21,21 21)\')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));\n\nURL: https://mariadb.com/kb/en/mpointfromtext/','','https://mariadb.com/kb/en/mpointfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (24,3,'MPolyFromText','Syntax\n------\n\nMPolyFromText(wkt[,srid])\nMultiPolygonFromText(wkt[,srid])\n\nDescription\n-----------\n\nConstructs a MULTIPOLYGON value using its WKT representation and SRID.\n\nMPolyFromText() and MultiPolygonFromText() are synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nSHOW FIELDS FROM gis_multi_polygon;\nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText(\'MULTIPOLYGON(\n ((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),\n ((59 18,67 18,67 13,59 13,59 18)))\')),\n (MPolyFromText(\'MULTIPOLYGON(\n ((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),\n ((59 18,67 18,67 13,59 13,59 18)))\')),\n (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(\n LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));\n\nURL: https://mariadb.com/kb/en/mpolyfromtext/','','https://mariadb.com/kb/en/mpolyfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (25,3,'MultiLineStringFromText','A synonym for MLineFromText.\n\nURL: https://mariadb.com/kb/en/multilinestringfromtext/','','https://mariadb.com/kb/en/multilinestringfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (26,3,'MultiPointFromText','A synonym for MPointFromText.\n\nURL: https://mariadb.com/kb/en/multipointfromtext/','','https://mariadb.com/kb/en/multipointfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (27,3,'MultiPolygonFromText','A synonym for MPolyFromText.\n\nURL: https://mariadb.com/kb/en/multipolygonfromtext/','','https://mariadb.com/kb/en/multipolygonfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (28,3,'PointFromText','A synonym for ST_PointFromText.\n\nURL: https://mariadb.com/kb/en/wkt-pointfromtext/','','https://mariadb.com/kb/en/wkt-pointfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (29,3,'PolyFromText','A synonym for ST_PolyFromText.\n\nURL: https://mariadb.com/kb/en/wkt-polyfromtext/','','https://mariadb.com/kb/en/wkt-polyfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (30,3,'PolygonFromText','A synonym for ST_PolyFromText.\n\nURL: https://mariadb.com/kb/en/polygonfromtext/','','https://mariadb.com/kb/en/polygonfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (31,3,'ST_AsText','Syntax\n------\n\nST_AsText(g)\nAsText(g)\nST_AsWKT(g)\nAsWKT(g)\n\nDescription\n-----------\n\nConverts a value in internal geometry format to its WKT representation and\nreturns the string result.\n\nST_AsText(), AsText(), ST_AsWKT() and AsWKT() are all synonyms.\n\nExamples\n--------\n\nSET @g = \'LineString(1 1,4 4,6 6)\';\n\nSELECT ST_AsText(ST_GeomFromText(@g));\n+--------------------------------+\n| ST_AsText(ST_GeomFromText(@g)) |\n+--------------------------------+\n| LINESTRING(1 1,4 4,6 6) |\n+--------------------------------+\n\nURL: https://mariadb.com/kb/en/st_astext/','','https://mariadb.com/kb/en/st_astext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (32,3,'ST_ASWKT','A synonym for ST_ASTEXT().\n\nURL: https://mariadb.com/kb/en/st_aswkt/','','https://mariadb.com/kb/en/st_aswkt/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (33,3,'ST_GeomCollFromText','Syntax\n------\n\nST_GeomCollFromText(wkt[,srid])\nST_GeometryCollectionFromText(wkt[,srid])\nGeomCollFromText(wkt[,srid])\nGeometryCollectionFromText(wkt[,srid])\n\nDescription\n-----------\n\nConstructs a GEOMETRYCOLLECTION value using its WKT representation and SRID.\n\nST_GeomCollFromText(), ST_GeometryCollectionFromText(), GeomCollFromText() and\nGeometryCollectionFromText() are all synonyms.\n\nExample\n-------\n\nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText(\'GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10\n10))\')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText(\'GeometryCollection()\')),\n (GeomFromText(\'GeometryCollection EMPTY\'));\n\nURL: https://mariadb.com/kb/en/st_geomcollfromtext/','','https://mariadb.com/kb/en/st_geomcollfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (34,3,'ST_GeometryCollectionFromText','A synonym for ST_GeomCollFromText.\n\nURL: https://mariadb.com/kb/en/st_geometrycollectionfromtext/','','https://mariadb.com/kb/en/st_geometrycollectionfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (35,3,'ST_GeometryFromText','A synonym for ST_GeomFromText.\n\nURL: https://mariadb.com/kb/en/st_geometryfromtext/','','https://mariadb.com/kb/en/st_geometryfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (36,3,'ST_GeomFromText','Syntax\n------\n\nST_GeomFromText(wkt[,srid])\nST_GeometryFromText(wkt[,srid])\nGeomFromText(wkt[,srid])\nGeometryFromText(wkt[,srid])\n\nDescription\n-----------\n\nConstructs a geometry value of any type using its WKT representation and SRID.\n\nGeomFromText(), GeometryFromText(), ST_GeomFromText() and\nST_GeometryFromText() are all synonyms.\n\nExample\n-------\n\nSET @g = ST_GEOMFROMTEXT(\'POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1))\');\n\nURL: https://mariadb.com/kb/en/st_geomfromtext/','','https://mariadb.com/kb/en/st_geomfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (37,3,'ST_LineFromText','Syntax\n------\n\nST_LineFromText(wkt[,srid])\nST_LineStringFromText(wkt[,srid])\nLineFromText(wkt[,srid])\nLineStringFromText(wkt[,srid])\n\nDescription\n-----------\n\nConstructs a LINESTRING value using its WKT representation and SRID.\n\nST_LineFromText(), ST_LineStringFromText(), ST_LineFromText() and\nST_LineStringFromText() are all synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_line (g LINESTRING);\nSHOW FIELDS FROM gis_line;\nINSERT INTO gis_line VALUES\n (LineFromText(\'LINESTRING(0 0,0 10,10 0)\')),\n (LineStringFromText(\'LINESTRING(10 10,20 10,20 20,10 20,10 10)\')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));\n\nURL: https://mariadb.com/kb/en/st_linefromtext/','','https://mariadb.com/kb/en/st_linefromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (38,3,'ST_LineStringFromText','A synonym for ST_LineFromText.\n\nURL: https://mariadb.com/kb/en/st_linestringfromtext/','','https://mariadb.com/kb/en/st_linestringfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (39,3,'ST_PointFromText','Syntax\n------\n\nST_PointFromText(wkt[,srid])\nPointFromText(wkt[,srid])\n\nDescription\n-----------\n\nConstructs a POINT value using its WKT representation and SRID.\n\nST_PointFromText() and PointFromText() are synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_point (g POINT);\nSHOW FIELDS FROM gis_point;\nINSERT INTO gis_point VALUES\n (PointFromText(\'POINT(10 10)\')),\n (PointFromText(\'POINT(20 10)\')),\n (PointFromText(\'POINT(20 20)\')),\n (PointFromWKB(AsWKB(PointFromText(\'POINT(10 20)\'))));\n\nURL: https://mariadb.com/kb/en/st_pointfromtext/','','https://mariadb.com/kb/en/st_pointfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (40,3,'ST_PolyFromText','Syntax\n------\n\nST_PolyFromText(wkt[,srid])\nST_PolygonFromText(wkt[,srid])\nPolyFromText(wkt[,srid])\nPolygonFromText(wkt[,srid])\n\nDescription\n-----------\n\nConstructs a POLYGON value using its WKT representation and SRID.\n\nST_PolyFromText(), ST_PolygonFromText(), PolyFromText() and\nST_PolygonFromText() are all synonyms.\n\nExamples\n--------\n\nCREATE TABLE gis_polygon (g POLYGON);\nINSERT INTO gis_polygon VALUES\n (PolygonFromText(\'POLYGON((10 10,20 10,20 20,10 20,10 10))\')),\n (PolyFromText(\'POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10\n20,10 10))\'));\n\nURL: https://mariadb.com/kb/en/st_polyfromtext/','','https://mariadb.com/kb/en/st_polyfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (41,3,'ST_PolygonFromText','A synonym for ST_PolyFromText.\n\nURL: https://mariadb.com/kb/en/st_polygonfromtext/','','https://mariadb.com/kb/en/st_polygonfromtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (42,4,'DIV','Syntax\n------\n\nDIV\n\nDescription\n-----------\n\nInteger division. Similar to FLOOR(), but is safe with BIGINT values.\nIncorrect results may occur for non-integer operands that exceed BIGINT range.\n\nIf the ERROR_ON_DIVISION_BY_ZERO SQL_MODE is used, a division by zero produces\nan error. Otherwise, it returns NULL.\n\nThe remainder of a division can be obtained using the MOD operator.\n\nExamples\n--------\n\nSELECT 300 DIV 7;\n+-----------+\n| 300 DIV 7 |\n+-----------+\n| 42 |\n+-----------+\n\nSELECT 300 DIV 0;\n+-----------+\n| 300 DIV 0 |\n+-----------+\n| NULL |\n+-----------+\n\nURL: https://mariadb.com/kb/en/div/','','https://mariadb.com/kb/en/div/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (43,4,'ABS','Syntax\n------\n\nABS(X)\n\nDescription\n-----------\n\nReturns the absolute (non-negative) value of X. If X is not a number, it is\nconverted to a numeric type.\n\nExamples\n--------\n\nSELECT ABS(42);\n+---------+\n| ABS(42) |\n+---------+\n| 42 |\n+---------+\n\nSELECT ABS(-42);\n+----------+\n| ABS(-42) |\n+----------+\n| 42 |\n+----------+\n\nSELECT ABS(DATE \'1994-01-01\');\n+------------------------+\n| ABS(DATE \'1994-01-01\') |\n+------------------------+\n| 19940101 |\n+------------------------+\n\nURL: https://mariadb.com/kb/en/abs/','','https://mariadb.com/kb/en/abs/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (44,4,'ACOS','Syntax\n------\n\nACOS(X)\n\nDescription\n-----------\n\nReturns the arc cosine of X, that is, the value whose cosine is X. Returns\nNULL if X is not in the range -1 to 1.\n\nExamples\n--------\n\nSELECT ACOS(1);\n+---------+\n| ACOS(1) |\n+---------+\n| 0 |\n+---------+\n\nSELECT ACOS(1.0001);\n+--------------+\n| ACOS(1.0001) |\n+--------------+\n| NULL |\n+--------------+\n\nSELECT ACOS(0);\n+-----------------+\n| ACOS(0) |\n+-----------------+\n| 1.5707963267949 |\n+-----------------+\n\nSELECT ACOS(0.234);\n+------------------+\n| ACOS(0.234) |\n+------------------+\n| 1.33460644244679 |\n+------------------+\n\nURL: https://mariadb.com/kb/en/acos/','','https://mariadb.com/kb/en/acos/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (45,4,'ASIN','Syntax\n------\n\nASIN(X)\n\nDescription\n-----------\n\nReturns the arc sine of X, that is, the value whose sine is X. Returns NULL if\nX is not in the range -1 to 1.\n\nExamples\n--------\n\nSELECT ASIN(0.2);\n+--------------------+\n| ASIN(0.2) |\n+--------------------+\n| 0.2013579207903308 |\n+--------------------+\n\nSELECT ASIN(\'foo\');\n+-------------+\n| ASIN(\'foo\') |\n+-------------+\n| 0 |\n+-------------+\n\nSHOW WARNINGS;\n+---------+------+-----------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------+\n| Warning | 1292 | Truncated incorrect DOUBLE value: \'foo\' |\n+---------+------+-----------------------------------------+\n\nURL: https://mariadb.com/kb/en/asin/','','https://mariadb.com/kb/en/asin/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (46,4,'ATAN','Syntax\n------\n\nATAN(X)\n\nDescription\n-----------\n\nReturns the arc tangent of X, that is, the value whose tangent is X.\n\nExamples\n--------\n\nSELECT ATAN(2);\n+--------------------+\n| ATAN(2) |\n+--------------------+\n| 1.1071487177940904 |\n+--------------------+\n\nSELECT ATAN(-2);\n+---------------------+\n| ATAN(-2) |\n+---------------------+\n| -1.1071487177940904 |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/atan/','','https://mariadb.com/kb/en/atan/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (47,4,'ATAN2','Syntax\n------\n\nATAN(Y,X), ATAN2(Y,X)\n\nDescription\n-----------\n\nReturns the arc tangent of the two variables X and Y. It is similar to\ncalculating the arc tangent of Y / X, except that the signs of both arguments\nare used to determine the quadrant of the result.\n\nExamples\n--------\n\nSELECT ATAN(-2,2);\n+---------------------+\n| ATAN(-2,2) |\n+---------------------+\n| -0.7853981633974483 |\n+---------------------+\n\nSELECT ATAN2(PI(),0);\n+--------------------+\n| ATAN2(PI(),0) |\n+--------------------+\n| 1.5707963267948966 |\n+--------------------+\n\nURL: https://mariadb.com/kb/en/atan2/','','https://mariadb.com/kb/en/atan2/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (48,4,'CEIL','Syntax\n------\n\nCEIL(X)\n\nDescription\n-----------\n\nCEIL() is a synonym for CEILING().\n\nURL: https://mariadb.com/kb/en/ceil/','','https://mariadb.com/kb/en/ceil/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (49,4,'CEILING','Syntax\n------\n\nCEILING(X)\n\nDescription\n-----------\n\nReturns the smallest integer value not less than X.\n\nExamples\n--------\n\nSELECT CEILING(1.23);\n+---------------+\n| CEILING(1.23) |\n+---------------+\n| 2 |\n+---------------+\n\nSELECT CEILING(-1.23);\n+----------------+\n| CEILING(-1.23) |\n+----------------+\n| -1 |\n+----------------+\n\nURL: https://mariadb.com/kb/en/ceiling/','','https://mariadb.com/kb/en/ceiling/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (50,4,'CONV','Syntax\n------\n\nCONV(N,from_base,to_base)\n\nDescription\n-----------\n\nConverts numbers between different number bases. Returns a string\nrepresentation of the number N, converted from base from_base to base to_base.\n\nReturns NULL if any argument is NULL, or if the second or third argument are\nnot in the allowed range.\n\nThe argument N is interpreted as an integer, but may be specified as an\ninteger or a string. The minimum base is 2 and the maximum base is 36. If\nto_base is a negative number, N is regarded as a signed number. Otherwise, N\nis treated as unsigned. CONV() works with 64-bit precision.\n\nSome shortcuts for this function are also available: BIN(), OCT(), HEX(),\nUNHEX(). Also, MariaDB allows binary literal values and hexadecimal literal\nvalues.\n\nExamples\n--------\n\nSELECT CONV(\'a\',16,2);\n+----------------+\n| CONV(\'a\',16,2) |\n+----------------+\n| 1010 |\n+----------------+\n\nSELECT CONV(\'6E\',18,8);\n+-----------------+\n| CONV(\'6E\',18,8) |\n+-----------------+\n| 172 |\n+-----------------+\n\nSELECT CONV(-17,10,-18);\n+------------------+\n| CONV(-17,10,-18) |\n+------------------+\n| -H |\n+------------------+\n\nSELECT CONV(12+\'10\'+\'10\'+0xa,10,10);\n+------------------------------+\n| CONV(12+\'10\'+\'10\'+0xa,10,10) |\n+------------------------------+\n| 42 |\n+------------------------------+\n\nURL: https://mariadb.com/kb/en/conv/','','https://mariadb.com/kb/en/conv/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (51,4,'COS','Syntax\n------\n\nCOS(X)\n\nDescription\n-----------\n\nReturns the cosine of X, where X is given in radians.\n\nExamples\n--------\n\nSELECT COS(PI());\n+-----------+\n| COS(PI()) |\n+-----------+\n| -1 |\n+-----------+\n\nURL: https://mariadb.com/kb/en/cos/','','https://mariadb.com/kb/en/cos/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (52,4,'COT','Syntax\n------\n\nCOT(X)\n\nDescription\n-----------\n\nReturns the cotangent of X.\n\nExamples\n--------\n\nSELECT COT(42);\n+--------------------+\n| COT(42) |\n+--------------------+\n| 0.4364167060752729 |\n+--------------------+\n\nSELECT COT(12);\n+---------------------+\n| COT(12) |\n+---------------------+\n| -1.5726734063976893 |\n+---------------------+\n\nSELECT COT(0);\nERROR 1690 (22003): DOUBLE value is out of range in \'cot(0)\'\n\nURL: https://mariadb.com/kb/en/cot/','','https://mariadb.com/kb/en/cot/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (53,4,'CRC32','Syntax\n------\n\n<= MariaDB 10.7\n\nCRC32(expr)\n\nFrom MariaDB 10.8\n\nCRC32([par,]expr)\n\nDescription\n-----------\n\nComputes a cyclic redundancy check (CRC) value and returns a 32-bit unsigned\nvalue. The result is NULL if the argument is NULL. The argument is expected to\nbe a string and (if possible) is treated as one if it is not.\n\nUses the ISO 3309 polynomial that used by zlib and many others. MariaDB 10.8\nintroduced the CRC32C() function, which uses the alternate Castagnoli\npolynomia.\n\nMariaDB starting with 10.8\n--------------------------\nOften, CRC is computed in pieces. To facilitate this, MariaDB 10.8.0\nintroduced an optional parameter: CRC32(\'MariaDB\')=CRC32(CRC32(\'Maria\'),\'DB\').\n\nExamples\n--------\n\nSELECT CRC32(\'MariaDB\');\n+------------------+\n| CRC32(\'MariaDB\') |\n+------------------+\n| 4227209140 |\n+------------------+\n\nSELECT CRC32(\'mariadb\');\n+------------------+\n| CRC32(\'mariadb\') |\n+------------------+\n| 2594253378 |\n+------------------+\n\nFrom MariaDB 10.8.0\n\nSELECT CRC32(CRC32(\'Maria\'),\'DB\');\n+----------------------------+\n| CRC32(CRC32(\'Maria\'),\'DB\') |\n+----------------------------+\n| 4227209140 |\n+----------------------------+\n\nURL: https://mariadb.com/kb/en/crc32/','','https://mariadb.com/kb/en/crc32/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (54,4,'CRC32C','MariaDB starting with 10.8\n--------------------------\nIntroduced in MariaDB 10.8.0 to compute a cyclic redundancy check (CRC) value\nusing the Castagnoli polynomial.\n\nSyntax\n------\n\nCRC32C([par,]expr)\n\nDescription\n-----------\n\nMariaDB has always included a native unary function CRC32() that computes the\nCRC-32 of a string using the ISO 3309 polynomial that used by zlib and many\nothers.\n\nInnoDB and MyRocks use a different polynomial, which was implemented in SSE4.2\ninstructions that were introduced in the Intel Nehalem microarchitecture. This\nis commonly called CRC-32C (Castagnoli).\n\nThe CRC32C function uses the Castagnoli polynomial.\n\nThis allows SELECT…INTO DUMPFILE to be used for the creation of files with\nvalid checksums, such as a logically empty InnoDB redo log file ib_logfile0\ncorresponding to a particular log sequence number.\n\nThe optional parameter allows the checksum to be computed in pieces:\nCRC32C(\'MariaDB\')=CRC32C(CRC32C(\'Maria\'),\'DB\').\n\nExamples\n--------\n\nSELECT CRC32C(\'MariaDB\');\n+-------------------+\n| CRC32C(\'MariaDB\') |\n+-------------------+\n| 809606978 |\n+-------------------+\n\nSELECT CRC32C(CRC32C(\'Maria\'),\'DB\');\n+------------------------------+\n| CRC32C(CRC32C(\'Maria\'),\'DB\') |\n+------------------------------+\n| 809606978 |\n+------------------------------+\n\nURL: https://mariadb.com/kb/en/crc32c/','','https://mariadb.com/kb/en/crc32c/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (55,4,'DEGREES','Syntax\n------\n\nDEGREES(X)\n\nDescription\n-----------\n\nReturns the argument X, converted from radians to degrees.\n\nThis is the converse of the RADIANS() function.\n\nExamples\n--------\n\nSELECT DEGREES(PI());\n+---------------+\n| DEGREES(PI()) |\n+---------------+\n| 180 |\n+---------------+\n\nSELECT DEGREES(PI() / 2);\n+-------------------+\n| DEGREES(PI() / 2) |\n+-------------------+\n| 90 |\n+-------------------+\n\nSELECT DEGREES(45);\n+-----------------+\n| DEGREES(45) |\n+-----------------+\n| 2578.3100780887 |\n+-----------------+\n\nURL: https://mariadb.com/kb/en/degrees/','','https://mariadb.com/kb/en/degrees/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (56,4,'EXP','Syntax\n------\n\nEXP(X)\n\nDescription\n-----------\n\nReturns the value of e (the base of natural logarithms) raised to the power of\nX. The inverse of this function is LOG() (using a single argument only) or\nLN().\n\nIf X is NULL, this function returns NULL.\n\nExamples\n--------\n\nSELECT EXP(2);\n+------------------+\n| EXP(2) |\n+------------------+\n| 7.38905609893065 |\n+------------------+\n\nSELECT EXP(-2);\n+--------------------+\n| EXP(-2) |\n+--------------------+\n| 0.1353352832366127 |\n+--------------------+\n\nSELECT EXP(0);\n+--------+\n| EXP(0) |\n+--------+\n| 1 |\n+--------+\n\nSELECT EXP(NULL);\n+-----------+\n| EXP(NULL) |\n+-----------+\n| NULL |\n+-----------+\n\nURL: https://mariadb.com/kb/en/exp/','','https://mariadb.com/kb/en/exp/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (57,4,'FLOOR','Syntax\n------\n\nFLOOR(X)\n\nDescription\n-----------\n\nReturns the largest integer value not greater than X.\n\nExamples\n--------\n\nSELECT FLOOR(1.23);\n+-------------+\n| FLOOR(1.23) |\n+-------------+\n| 1 |\n+-------------+\n\nSELECT FLOOR(-1.23);\n+--------------+\n| FLOOR(-1.23) |\n+--------------+\n| -2 |\n+--------------+\n\nURL: https://mariadb.com/kb/en/floor/','','https://mariadb.com/kb/en/floor/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (58,4,'LN','Syntax\n------\n\nLN(X)\n\nDescription\n-----------\n\nReturns the natural logarithm of X; that is, the base-e logarithm of X. If X\nis less than or equal to 0, or NULL, then NULL is returned.\n\nThe inverse of this function is EXP().\n\nExamples\n--------\n\nSELECT LN(2);\n+-------------------+\n| LN(2) |\n+-------------------+\n| 0.693147180559945 |\n+-------------------+\n\nSELECT LN(-2);\n+--------+\n| LN(-2) |\n+--------+\n| NULL |\n+--------+\n\nURL: https://mariadb.com/kb/en/ln/','','https://mariadb.com/kb/en/ln/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (59,4,'LOG','Syntax\n------\n\nLOG(X), LOG(B,X)\n\nDescription\n-----------\n\nIf called with one parameter, this function returns the natural logarithm of\nX. If X is less than or equal to 0, then NULL is returned.\n\nIf called with two parameters, it returns the logarithm of X to the base B. If\nB is <= 1 or X <= 0, the function returns NULL.\n\nIf any argument is NULL, the function returns NULL.\n\nThe inverse of this function (when called with a single argument) is the EXP()\nfunction.\n\nExamples\n--------\n\nLOG(X):\n\nSELECT LOG(2);\n+-------------------+\n| LOG(2) |\n+-------------------+\n| 0.693147180559945 |\n+-------------------+\n\nSELECT LOG(-2);\n+---------+\n| LOG(-2) |\n+---------+\n| NULL |\n+---------+\n\nLOG(B,X)\n\nSELECT LOG(2,16);\n+-----------+\n| LOG(2,16) |\n+-----------+\n| 4 |\n+-----------+\n\nSELECT LOG(3,27);\n+-----------+\n| LOG(3,27) |\n+-----------+\n| 3 |\n+-----------+\n\nSELECT LOG(3,1);\n+----------+\n| LOG(3,1) |\n+----------+\n| 0 |\n+----------+\n\nSELECT LOG(3,0);\n+----------+\n| LOG(3,0) |\n+----------+\n| NULL |\n+----------+\n\nURL: https://mariadb.com/kb/en/log/','','https://mariadb.com/kb/en/log/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (60,4,'LOG10','Syntax\n------\n\nLOG10(X)\n\nDescription\n-----------\n\nReturns the base-10 logarithm of X.\n\nExamples\n--------\n\nSELECT LOG10(2);\n+-------------------+\n| LOG10(2) |\n+-------------------+\n| 0.301029995663981 |\n+-------------------+\n\nSELECT LOG10(100);\n+------------+\n| LOG10(100) |\n+------------+\n| 2 |\n+------------+\n\nSELECT LOG10(-100);\n+-------------+\n| LOG10(-100) |\n+-------------+\n| NULL |\n+-------------+\n\nURL: https://mariadb.com/kb/en/log10/','','https://mariadb.com/kb/en/log10/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (61,4,'LOG2','Syntax\n------\n\nLOG2(X)\n\nDescription\n-----------\n\nReturns the base-2 logarithm of X.\n\nExamples\n--------\n\nSELECT LOG2(4398046511104);\n+---------------------+\n| LOG2(4398046511104) |\n+---------------------+\n| 42 |\n+---------------------+\n\nSELECT LOG2(65536);\n+-------------+\n| LOG2(65536) |\n+-------------+\n| 16 |\n+-------------+\n\nSELECT LOG2(-100);\n+------------+\n| LOG2(-100) |\n+------------+\n| NULL |\n+------------+\n\nURL: https://mariadb.com/kb/en/log2/','','https://mariadb.com/kb/en/log2/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (62,4,'MOD','Syntax\n------\n\nMOD(N,M), N % M, N MOD M\n\nDescription\n-----------\n\nModulo operation. Returns the remainder of N divided by M. See also Modulo\nOperator.\n\nIf the ERROR_ON_DIVISION_BY_ZERO SQL_MODE is used, any number modulus zero\nproduces an error. Otherwise, it returns NULL.\n\nThe integer part of a division can be obtained using DIV.\n\nExamples\n--------\n\nSELECT 1042 % 50;\n+-----------+\n| 1042 % 50 |\n+-----------+\n| 42 |\n+-----------+\n\nSELECT MOD(234, 10);\n+--------------+\n| MOD(234, 10) |\n+--------------+\n| 4 |\n+--------------+\n\nSELECT 253 % 7;\n+---------+\n| 253 % 7 |\n+---------+\n| 1 |\n+---------+\n\nSELECT MOD(29,9);\n+-----------+\n| MOD(29,9) |\n+-----------+\n| 2 |\n+-----------+\n\nSELECT 29 MOD 9;\n+----------+\n| 29 MOD 9 |\n+----------+\n| 2 |\n+----------+\n\nURL: https://mariadb.com/kb/en/mod/','','https://mariadb.com/kb/en/mod/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (63,4,'OCT','Syntax\n------\n\nOCT(N)\n\nDescription\n-----------\n\nReturns a string representation of the octal value of N, where N is a longlong\n(BIGINT) number. This is equivalent to CONV(N,10,8). Returns NULL if N is NULL.\n\nExamples\n--------\n\nSELECT OCT(34);\n+---------+\n| OCT(34) |\n+---------+\n| 42 |\n+---------+\n\nSELECT OCT(12);\n+---------+\n| OCT(12) |\n+---------+\n| 14 |\n+---------+\n\nURL: https://mariadb.com/kb/en/oct/','','https://mariadb.com/kb/en/oct/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (64,4,'PI','Syntax\n------\n\nPI()\n\nDescription\n-----------\n\nReturns the value of π (pi). The default number of decimal places displayed is\nsix, but MariaDB uses the full double-precision value internally.\n\nExamples\n--------\n\nSELECT PI();\n+----------+\n| PI() |\n+----------+\n| 3.141593 |\n+----------+\n\nSELECT PI()+0.0000000000000000000000;\n+-------------------------------+\n| PI()+0.0000000000000000000000 |\n+-------------------------------+\n| 3.1415926535897931159980 |\n+-------------------------------+\n\nURL: https://mariadb.com/kb/en/pi/','','https://mariadb.com/kb/en/pi/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (65,4,'POW','Syntax\n------\n\nPOW(X,Y)\n\nDescription\n-----------\n\nReturns the value of X raised to the power of Y.\n\nPOWER() is a synonym.\n\nExamples\n--------\n\nSELECT POW(2,3);\n+----------+\n| POW(2,3) |\n+----------+\n| 8 |\n+----------+\n\nSELECT POW(2,-2);\n+-----------+\n| POW(2,-2) |\n+-----------+\n| 0.25 |\n+-----------+\n\nURL: https://mariadb.com/kb/en/pow/','','https://mariadb.com/kb/en/pow/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (66,4,'POWER','Syntax\n------\n\nPOWER(X,Y)\n\nDescription\n-----------\n\nThis is a synonym for POW(), which returns the value of X raised to the power\nof Y.\n\nURL: https://mariadb.com/kb/en/power/','','https://mariadb.com/kb/en/power/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (67,4,'RADIANS','Syntax\n------\n\nRADIANS(X)\n\nDescription\n-----------\n\nReturns the argument X, converted from degrees to radians. Note that π radians\nequals 180 degrees.\n\nThis is the converse of the DEGREES() function.\n\nExamples\n--------\n\nSELECT RADIANS(45);\n+-------------------+\n| RADIANS(45) |\n+-------------------+\n| 0.785398163397448 |\n+-------------------+\n\nSELECT RADIANS(90);\n+-----------------+\n| RADIANS(90) |\n+-----------------+\n| 1.5707963267949 |\n+-----------------+\n\nSELECT RADIANS(PI());\n+--------------------+\n| RADIANS(PI()) |\n+--------------------+\n| 0.0548311355616075 |\n+--------------------+\n\nSELECT RADIANS(180);\n+------------------+\n| RADIANS(180) |\n+------------------+\n| 3.14159265358979 |\n+------------------+\n\nURL: https://mariadb.com/kb/en/radians/','','https://mariadb.com/kb/en/radians/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (68,4,'RAND','Syntax\n------\n\nRAND(), RAND(N)\n\nDescription\n-----------\n\nReturns a random DOUBLE precision floating point value v in the range 0 <= v <\n1.0. If a constant integer argument N is specified, it is used as the seed\nvalue, which produces a repeatable sequence of column values. In the example\nbelow, note that the sequences of values produced by RAND(3) is the same both\nplaces where it occurs.\n\nIn a WHERE clause, RAND() is evaluated each time the WHERE is executed.\n\nStatements using the RAND() function are not safe for statement-based\nreplication.\n\nPractical uses\n--------------\n\nThe expression to get a random integer from a given range is the following:\n\nFLOOR(min_value + RAND() * (max_value - min_value +1))\n\nRAND() is often used to read random rows from a table, as follows:\n\nSELECT * FROM my_table ORDER BY RAND() LIMIT 10;\n\nNote, however, that this technique should never be used on a large table as it\nwill be extremely slow. MariaDB will read all rows in the table, generate a\nrandom value for each of them, order them, and finally will apply the LIMIT\nclause.\n\nExamples\n--------\n\nCREATE TABLE t (i INT);\n\nINSERT INTO t VALUES(1),(2),(3);\n\nSELECT i, RAND() FROM t;\n+------+-------------------+\n| i | RAND() |\n+------+-------------------+\n| 1 | 0.255651095188829 |\n| 2 | 0.833920199269355 |\n| 3 | 0.40264774151393 |\n+------+-------------------+\n\nSELECT i, RAND(3) FROM t;\n+------+-------------------+\n| i | RAND(3) |\n+------+-------------------+\n| 1 | 0.90576975597606 |\n| 2 | 0.373079058130345 |\n| 3 | 0.148086053457191 |\n+------+-------------------+\n\nSELECT i, RAND() FROM t;\n+------+-------------------+\n| i | RAND() |\n+------+-------------------+\n| 1 | 0.511478140495232 |\n| 2 | 0.349447508668012 |\n| 3 | 0.212803152588013 |\n+------+-------------------+\n\nUsing the same seed, the same sequence will be returned:\n\nSELECT i, RAND(3) FROM t;\n+------+-------------------+\n| i | RAND(3) |\n+------+-------------------+\n| 1 | 0.90576975597606 |\n| 2 | 0.373079058130345 |\n| 3 | 0.148086053457191 |\n+------+-------------------+\n\nGenerating a random number from 5 to 15:\n\nSELECT FLOOR(5 + (RAND() * 11));\n\nURL: https://mariadb.com/kb/en/rand/','','https://mariadb.com/kb/en/rand/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (69,4,'ROUND','Syntax\n------\n\nROUND(X), ROUND(X,D)\n\nDescription\n-----------\n\nRounds the argument X to D decimal places. D defaults to 0 if not specified. D\ncan be negative to cause D digits left of the decimal point of the value X to\nbecome zero.\n\nThe rounding algorithm depends on the data type of X:\n\n* for floating point types (FLOAT, DOUBLE) the C libraries rounding function\nis used, so the behavior *may* differ between operating systems\n* for fixed point types (DECIMAL, DEC/NUMBER/FIXED) the \"round half up\" rule\nis used, meaning that e.g. a value ending in exactly .5 is always rounded up.\n\nExamples\n--------\n\nSELECT ROUND(-1.23);\n+--------------+\n| ROUND(-1.23) |\n+--------------+\n| -1 |\n+--------------+\n\nSELECT ROUND(-1.58);\n+--------------+\n| ROUND(-1.58) |\n+--------------+\n| -2 |\n+--------------+\n\nSELECT ROUND(1.58); \n+-------------+\n| ROUND(1.58) |\n+-------------+\n| 2 |\n+-------------+\n\nSELECT ROUND(1.298, 1);\n+-----------------+\n| ROUND(1.298, 1) |\n+-----------------+\n| 1.3 |\n+-----------------+\n\nSELECT ROUND(1.298, 0);\n+-----------------+\n| ROUND(1.298, 0) |\n+-----------------+\n| 1 |\n+-----------------+\n\nSELECT ROUND(23.298, -1);\n+-------------------+\n| ROUND(23.298, -1) |\n+-------------------+\n| 20 |\n+-------------------+\n\nURL: https://mariadb.com/kb/en/round/','','https://mariadb.com/kb/en/round/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (70,4,'SIGN','Syntax\n------\n\nSIGN(X)\n\nDescription\n-----------\n\nReturns the sign of the argument as -1, 0, or 1, depending on whether X is\nnegative, zero, or positive.\n\nExamples\n--------\n\nSELECT SIGN(-32);\n+-----------+\n| SIGN(-32) |\n+-----------+\n| -1 |\n+-----------+\n\nSELECT SIGN(0);\n+---------+\n| SIGN(0) |\n+---------+\n| 0 |\n+---------+\n\nSELECT SIGN(234);\n+-----------+\n| SIGN(234) |\n+-----------+\n| 1 |\n+-----------+\n\nURL: https://mariadb.com/kb/en/sign/','','https://mariadb.com/kb/en/sign/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (71,4,'SIN','Syntax\n------\n\nSIN(X)\n\nDescription\n-----------\n\nReturns the sine of X, where X is given in radians.\n\nExamples\n--------\n\nSELECT SIN(1.5707963267948966);\n+-------------------------+\n| SIN(1.5707963267948966) |\n+-------------------------+\n| 1 |\n+-------------------------+\n\nSELECT SIN(PI());\n+----------------------+\n| SIN(PI()) |\n+----------------------+\n| 1.22460635382238e-16 |\n+----------------------+\n\nSELECT ROUND(SIN(PI()));\n+------------------+\n| ROUND(SIN(PI())) |\n+------------------+\n| 0 |\n+------------------+\n\nURL: https://mariadb.com/kb/en/sin/','','https://mariadb.com/kb/en/sin/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (72,4,'SQRT','Syntax\n------\n\nSQRT(X)\n\nDescription\n-----------\n\nReturns the square root of X. If X is negative, NULL is returned.\n\nExamples\n--------\n\nSELECT SQRT(4);\n+---------+\n| SQRT(4) |\n+---------+\n| 2 |\n+---------+\n\nSELECT SQRT(20);\n+------------------+\n| SQRT(20) |\n+------------------+\n| 4.47213595499958 |\n+------------------+\n\nSELECT SQRT(-16);\n+-----------+\n| SQRT(-16) |\n+-----------+\n| NULL |\n+-----------+\n\nSELECT SQRT(1764);\n+------------+\n| SQRT(1764) |\n+------------+\n| 42 |\n+------------+\n\nURL: https://mariadb.com/kb/en/sqrt/','','https://mariadb.com/kb/en/sqrt/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (73,4,'TAN','Syntax\n------\n\nTAN(X)\n\nDescription\n-----------\n\nReturns the tangent of X, where X is given in radians.\n\nExamples\n--------\n\nSELECT TAN(0.7853981633974483);\n+-------------------------+\n| TAN(0.7853981633974483) |\n+-------------------------+\n| 0.9999999999999999 |\n+-------------------------+\n\nSELECT TAN(PI());\n+-----------------------+\n| TAN(PI()) |\n+-----------------------+\n| -1.22460635382238e-16 |\n+-----------------------+\n\nSELECT TAN(PI()+1);\n+-----------------+\n| TAN(PI()+1) |\n+-----------------+\n| 1.5574077246549 |\n+-----------------+\n\nSELECT TAN(RADIANS(PI()));\n+--------------------+\n| TAN(RADIANS(PI())) |\n+--------------------+\n| 0.0548861508080033 |\n+--------------------+\n\nURL: https://mariadb.com/kb/en/tan/','','https://mariadb.com/kb/en/tan/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (74,4,'TRUNCATE','This page documents the TRUNCATE function. See TRUNCATE TABLE for the DDL\nstatement.\n\nSyntax\n------\n\nTRUNCATE(X,D)\n\nDescription\n-----------\n\nReturns the number X, truncated to D decimal places. If D is 0, the result has\nno decimal point or fractional part. D can be negative to cause D digits left\nof the decimal point of the value X to become zero.\n\nExamples\n--------\n\nSELECT TRUNCATE(1.223,1);\n+-------------------+\n| TRUNCATE(1.223,1) |\n+-------------------+\n| 1.2 |\n+-------------------+\n\nSELECT TRUNCATE(1.999,1);\n+-------------------+\n| TRUNCATE(1.999,1) |\n+-------------------+\n| 1.9 |\n+-------------------+\n\nSELECT TRUNCATE(1.999,0); \n+-------------------+\n| TRUNCATE(1.999,0) |\n+-------------------+\n| 1 |\n+-------------------+\n\nSELECT TRUNCATE(-1.999,1);\n+--------------------+\n| TRUNCATE(-1.999,1) |\n+--------------------+\n| -1.9 |\n+--------------------+\n\nSELECT TRUNCATE(122,-2);\n+------------------+\n| TRUNCATE(122,-2) |\n+------------------+\n| 100 |\n+------------------+\n\nSELECT TRUNCATE(10.28*100,0);\n+-----------------------+\n| TRUNCATE(10.28*100,0) |\n+-----------------------+\n| 1028 |\n+-----------------------+\n\nURL: https://mariadb.com/kb/en/truncate/','','https://mariadb.com/kb/en/truncate/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (75,5,'INSTALL PLUGIN','Syntax\n------\n\nINSTALL PLUGIN [IF NOT EXISTS] plugin_name SONAME \'plugin_library\'\n\nDescription\n-----------\n\nThis statement installs an individual plugin from the specified library. To\ninstall the whole library (which could be required), use INSTALL SONAME. See\nalso Installing a Plugin.\n\nplugin_name is the name of the plugin as defined in the plugin declaration\nstructure contained in the library file. Plugin names are not case sensitive.\nFor maximal compatibility, plugin names should be limited to ASCII letters,\ndigits, and underscore, because they are used in C source files, shell command\nlines, M4 and Bourne shell scripts, and SQL environments.\n\nplugin_library is the name of the shared library that contains the plugin\ncode. The file name extension can be omitted (which makes the statement look\nthe same on all architectures).\n\nThe shared library must be located in the plugin directory (that is, the\ndirectory named by the plugin_dir system variable). The library must be in the\nplugin directory itself, not in a subdirectory. By default, plugin_dir is\nplugin directory under the directory named by the pkglibdir configuration\nvariable, but it can be changed by setting the value of plugin_dir at server\nstartup. For example, set its value in a my.cnf file:\n\n[mysqld]\nplugin_dir=/path/to/plugin/directory\nIf the value of plugin_dir is a relative path name, it is taken to be relative\nto the MySQL base directory (the value of the basedir system variable).\n\nINSTALL PLUGIN adds a line to the mysql.plugin table that describes the\nplugin. This table contains the plugin name and library file name.\n\nINSTALL PLUGIN causes the server to read option (my.cnf) files just as during\nserver startup. This enables the plugin to pick up any relevant options from\nthose files. It is possible to add plugin options to an option file even\nbefore loading a plugin (if the loose prefix is used). It is also possible to\nuninstall a plugin, edit my.cnf, and install the plugin again. Restarting the\nplugin this way enables it to the new option values without a server restart.\n\nINSTALL PLUGIN also loads and initializes the plugin code to make the plugin\navailable for use. A plugin is initialized by executing its initialization\nfunction, which handles any setup that the plugin must perform before it can\nbe used.\n\nTo use INSTALL PLUGIN, you must have the INSERT privilege for the mysql.plugin\ntable.\n\nAt server startup, the server loads and initializes any plugin that is listed\nin the mysql.plugin table. This means that a plugin is installed with INSTALL\nPLUGIN only once, not every time the server starts. Plugin loading at startup\ndoes not occur if the server is started with the --skip-grant-tables option.\n\nWhen the server shuts down, it executes the de-initialization function for\neach plugin that is loaded so that the plugin has a chance to perform any\nfinal cleanup.\n\nIf you need to load plugins for a single server startup when the\n--skip-grant-tables option is given (which tells the server not to read system\ntables), use the --plugin-load mysqld option.\n\nMariaDB starting with 10.4.0\n----------------------------\n\nIF NOT EXISTS\n-------------\n\nWhen the IF NOT EXISTS clause is used, MariaDB will return a note instead of\nan error if the specified plugin already exists. See SHOW WARNINGS.\n\nExamples\n--------\n\nINSTALL PLUGIN sphinx SONAME \'ha_sphinx.so\';\n\nThe extension can also be omitted:\n\nINSTALL PLUGIN innodb SONAME \'ha_xtradb\';\n\nFrom MariaDB 10.4.0:\n\nINSTALL PLUGIN IF NOT EXISTS example SONAME \'ha_example\';\nQuery OK, 0 rows affected (0.104 sec)\n\nINSTALL PLUGIN IF NOT EXISTS example SONAME \'ha_example\';\nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n\nSHOW WARNINGS;\n+-------+------+------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------+\n| Note | 1968 | Plugin \'example\' already installed |\n+-------+------+------------------------------------+\n\nURL: https://mariadb.com/kb/en/install-plugin/','','https://mariadb.com/kb/en/install-plugin/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (76,5,'UNINSTALL PLUGIN','Syntax\n------\n\nUNINSTALL PLUGIN [IF EXISTS] plugin_name\n\nDescription\n-----------\n\nThis statement removes a single installed plugin. To uninstall the whole\nlibrary which contains the plugin, use UNINSTALL SONAME. You cannot uninstall\na plugin if any table that uses it is open.\n\nplugin_name must be the name of some plugin that is listed in the mysql.plugin\ntable. The server executes the plugin\'s deinitialization function and removes\nthe row for the plugin from the mysql.plugin table, so that subsequent server\nrestarts will not load and initialize the plugin. UNINSTALL PLUGIN does not\nremove the plugin\'s shared library file.\n\nTo use UNINSTALL PLUGIN, you must have the DELETE privilege for the\nmysql.plugin table.\n\nMariaDB starting with 10.4.0\n----------------------------\n\nIF EXISTS\n---------\n\nIf the IF EXISTS clause is used, MariaDB will return a note instead of an\nerror if the plugin does not exist. See SHOW WARNINGS.\n\nExamples\n--------\n\nUNINSTALL PLUGIN example;\n\nFrom MariaDB 10.4.0:\n\nUNINSTALL PLUGIN IF EXISTS example;\nQuery OK, 0 rows affected (0.099 sec)\n\nUNINSTALL PLUGIN IF EXISTS example;\nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n\nSHOW WARNINGS;\n+-------+------+-------------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------------+\n| Note | 1305 | PLUGIN example does not exist |\n+-------+------+-------------------------------+\n\nURL: https://mariadb.com/kb/en/uninstall-plugin/','','https://mariadb.com/kb/en/uninstall-plugin/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (77,5,'INSTALL SONAME','Syntax\n------\n\nINSTALL SONAME \'plugin_library\'\n\nDescription\n-----------\n\nThis statement is a variant of INSTALL PLUGIN. It installs all plugins from a\ngiven plugin_library. See INSTALL PLUGIN for details.\n\nplugin_library is the name of the shared library that contains the plugin\ncode. The file name extension (for example, libmyplugin.so or libmyplugin.dll)\ncan be omitted (which makes the statement look the same on all architectures).\n\nThe shared library must be located in the plugin directory (that is, the\ndirectory named by the plugin_dir system variable). The library must be in the\nplugin directory itself, not in a subdirectory. By default, plugin_dir is\nplugin directory under the directory named by the pkglibdir configuration\nvariable, but it can be changed by setting the value of plugin_dir at server\nstartup. For example, set its value in a my.cnf file:\n\n[mysqld]\nplugin_dir=/path/to/plugin/directory\nIf the value of plugin_dir is a relative path name, it is taken to be relative\nto the MySQL base directory (the value of the basedir system variable).\n\nINSTALL SONAME adds one or more lines to the mysql.plugin table that describes\nthe plugin. This table contains the plugin name and library file name.\n\nINSTALL SONAME causes the server to read option (my.cnf) files just as during\nserver startup. This enables the plugin to pick up any relevant options from\nthose files. It is possible to add plugin options to an option file even\nbefore loading a plugin (if the loose prefix is used). It is also possible to\nuninstall a plugin, edit my.cnf, and install the plugin again. Restarting the\nplugin this way enables it to the new option values without a server restart.\n\nINSTALL SONAME also loads and initializes the plugin code to make the plugin\navailable for use. A plugin is initialized by executing its initialization\nfunction, which handles any setup that the plugin must perform before it can\nbe used.\n\nTo use INSTALL SONAME, you must have the INSERT privilege for the mysql.plugin\ntable.\n\nAt server startup, the server loads and initializes any plugin that is listed\nin the mysql.plugin table. This means that a plugin is installed with INSTALL\nSONAME only once, not every time the server starts. Plugin loading at startup\ndoes not occur if the server is started with the --skip-grant-tables option.\n\nWhen the server shuts down, it executes the de-initialization function for\neach plugin that is loaded so that the plugin has a chance to perform any\nfinal cleanup.\n\nIf you need to load plugins for a single server startup when the\n--skip-grant-tables option is given (which tells the server not to read system\ntables), use the --plugin-load mysqld option.\n\nIf you need to install only one plugin from a library, use the INSTALL PLUGIN\nstatement.\n\nExamples\n--------\n\nTo load the XtraDB storage engine and all of its information_schema tables\nwith one statement, use\n\nINSTALL SONAME \'ha_xtradb\';\n\nThis statement can be used instead of INSTALL PLUGIN even when the library\ncontains only one plugin:\n\nINSTALL SONAME \'ha_sequence\';\n\nURL: https://mariadb.com/kb/en/install-soname/','','https://mariadb.com/kb/en/install-soname/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (78,5,'UNINSTALL SONAME','Syntax\n------\n\nUNINSTALL SONAME [IF EXISTS] \'plugin_library\'\n\nDescription\n-----------\n\nThis statement is a variant of UNINSTALL PLUGIN statement, that removes all\nplugins belonging to a specified plugin_library. See UNINSTALL PLUGIN for\ndetails.\n\nplugin_library is the name of the shared library that contains the plugin\ncode. The file name extension (for example, libmyplugin.so or libmyplugin.dll)\ncan be omitted (which makes the statement look the same on all architectures).\n\nTo use UNINSTALL SONAME, you must have the DELETE privilege for the\nmysql.plugin table.\n\nMariaDB starting with 10.4.0\n----------------------------\n\nIF EXISTS\n---------\n\nIf the IF EXISTS clause is used, MariaDB will return a note instead of an\nerror if the plugin library does not exist. See SHOW WARNINGS.\n\nExamples\n--------\n\nTo uninstall the XtraDB plugin and all of its information_schema tables with\none statement, use\n\nUNINSTALL SONAME \'ha_xtradb\';\n\nFrom MariaDB 10.4.0:\n\nUNINSTALL SONAME IF EXISTS \'ha_example\';\nQuery OK, 0 rows affected (0.099 sec)\n\nUNINSTALL SONAME IF EXISTS \'ha_example\';\nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n\nSHOW WARNINGS;\n+-------+------+-------------------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------------------+\n| Note | 1305 | SONAME ha_example.so does not exist |\n+-------+------+-------------------------------------+\n\nURL: https://mariadb.com/kb/en/uninstall-soname/','','https://mariadb.com/kb/en/uninstall-soname/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (79,5,'Plugin Overview','Plugins are server components that enhance MariaDB in some way. These can be\nanything from new storage engines, plugins for enhancing full-text parsing, or\neven small enhancements, such as a plugin to get a timestamp as an integer.\n\nQuerying Plugin Information\n---------------------------\n\nThere are a number of ways to see which plugins are currently active.\n\nA server almost always has a large number of active plugins, because the\nserver contains a large number of built-in plugins, which are active by\ndefault and cannot be uninstalled.\n\nQuerying Plugin Information with SHOW PLUGINS\n---------------------------------------------\n\nThe SHOW PLUGINS statement can be used to query information about all active\nplugins.\n\nFor example:\n\nSHOW PLUGINS\\G;\n********************** 1. row **********************\n Name: binlog\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n********************** 2. row **********************\n Name: mysql_native_password\n Status: ACTIVE\n Type: AUTHENTICATION\nLibrary: NULL\nLicense: GPL\n********************** 3. row **********************\n Name: mysql_old_password\n Status: ACTIVE\n Type: AUTHENTICATION\nLibrary: NULL\nLicense: GPL\n...\n\nIf a plugin\'s Library column has a NULL value, then the plugin is built-in,\nand it cannot be uninstalled.\n\nQuerying Plugin Information with information_schema.PLUGINS\n-----------------------------------------------------------\n\nThe information_schema.PLUGINS table can be queried to get more detailed\ninformation about plugins.\n\nFor example:\n\nSELECT * FROM information_schema.PLUGINS\\G\n...\n*************************** 6. row ***************************\n PLUGIN_NAME: CSV\n PLUGIN_VERSION: 1.0\n PLUGIN_STATUS: ACTIVE\n PLUGIN_TYPE: STORAGE ENGINE\n PLUGIN_TYPE_VERSION: 100003.0\n PLUGIN_LIBRARY: NULL\nPLUGIN_LIBRARY_VERSION: NULL\n PLUGIN_AUTHOR: Brian Aker, MySQL AB\n PLUGIN_DESCRIPTION: CSV storage engine\n PLUGIN_LICENSE: GPL\n LOAD_OPTION: FORCE\n PLUGIN_MATURITY: Stable\n PLUGIN_AUTH_VERSION: 1.0\n*************************** 7. row ***************************\n PLUGIN_NAME: MEMORY\n PLUGIN_VERSION: 1.0\n PLUGIN_STATUS: ACTIVE\n PLUGIN_TYPE: STORAGE ENGINE\n PLUGIN_TYPE_VERSION: 100003.0\n PLUGIN_LIBRARY: NULL\nPLUGIN_LIBRARY_VERSION: NULL\n PLUGIN_AUTHOR: MySQL AB\n PLUGIN_DESCRIPTION: Hash based, stored in memory, useful for temporary\ntables\n PLUGIN_LICENSE: GPL\n LOAD_OPTION: FORCE\n PLUGIN_MATURITY: Stable\n PLUGIN_AUTH_VERSION: 1.0\n...\n\nIf a plugin\'s PLUGIN_LIBRARY column has the NULL value, then the plugin is\nbuilt-in, and it cannot be uninstalled.\n\nQuerying Plugin Information with mysql.plugin\n---------------------------------------------\n\nThe mysql.plugin table can be queried to get information about installed\nplugins.\n\nThis table only contains information about plugins that have been installed\nvia the following methods:\n\n* The INSTALL SONAME statement.\n* The INSTALL PLUGIN statement.\n* The mysql_plugin utility.\n\nThis table does not contain information about:\n\n* Built-in plugins.\n* Plugins loaded with the --plugin-load-add option.\n* Plugins loaded with the --plugin-load option.\n\nThis table only contains enough information to reload the plugin when the\nserver is restarted, which means it only contains the plugin name and the\nplugin library.\n\nFor example:\n\nSELECT * FROM mysql.plugin;\n\n+------+------------+\n| name | dl |\n+------+------------+\n| PBXT | libpbxt.so |\n+------+------------+\n\nInstalling a Plugin\n-------------------\n\nThere are three primary ways to install a plugin:\n\n* A plugin can be installed dynamically with an SQL statement.\n* A plugin can be installed with a mysqld option, but it requires a server\nrestart.\n* A plugin can be installed with the mysql_plugin utility, while the server is\ncompletely offline.\n\nWhen you are installing a plugin, you also have to ensure that:\n\n* The server\'s plugin directory is properly configured, and the plugin\'s\nlibrary is in the plugin directory.\n* The server\'s minimum plugin maturity is properly configured, and the plugin\nis mature enough to be installed.\n\nInstalling a Plugin Dynamically\n-------------------------------\n\nA plugin can be installed dynamically by executing either the INSTALL SONAME\nor the INSTALL PLUGIN statement.\n\nIf a plugin is installed with one of these statements, then a record will be\nadded to the mysql.plugins table for the plugin. This means that the plugin\nwill automatically be loaded every time the server restarts, unless\nspecifically uninstalled or deactivated.\n\nInstalling a Plugin with INSTALL SONAME\n---------------------------------------\n\nYou can install a plugin dynamically by executing the INSTALL SONAME\nstatement. INSTALL SONAME installs all plugins from the given plugin library.\nThis could be required for some plugin libraries.\n\nFor example, to install all plugins in the server_audit plugin library (which\nis currently only the server_audit audit plugin), you could execute the\nfollowing:\n\nINSTALL SONAME \'server_audit\';\n\nInstalling a Plugin with INSTALL PLUGIN\n---------------------------------------\n\nYou can install a plugin dynamically by executing the INSTALL PLUGIN\nstatement. INSTALL PLUGIN installs a single plugin from the given plugin\nlibrary.\n\nFor example, to install the server_audit audit plugin from the server_audit\nplugin library, you could execute the following:\n\nINSTALL PLUGIN server_audit SONAME \'server_audit\';\n\nInstalling a Plugin with Plugin Load Options\n--------------------------------------------\n\nA plugin can be installed with a mysqld option by providing either the\n--plugin-load-add or the --plugin-load option.\n\nIf a plugin is installed with one of these options, then a record will not be\nadded to the mysql.plugins table for the plugin. This means that if the server\nis restarted without the same option set, then the plugin will not\nautomatically be loaded.\n\nInstalling a Plugin with --plugin-load-add\n------------------------------------------\n\nYou can install a plugin with the --plugin-load-add option by specifying the\noption as a command-line argument to mysqld or by specifying the option in a\nrelevant server option group in an option file.\n\nThe --plugin-load-add option uses the following format:\n\n* Plugins can be specified in the format name=library, where name is the\nplugin name and library is the plugin library. This format installs a single\nplugin from the given plugin library.\n* Plugins can also be specified in the format library, where library is the\nplugin library. This format installs all plugins from the given plugin library.\n* Multiple plugins can be specified by separating them with semicolons.\n\nFor example, to install all plugins in the server_audit plugin library (which\nis currently only the server_audit audit plugin) and also the ed25519\nauthentication plugin from the auth_ed25519 plugin library, you could set the\noption to the following values on the command-line:\n\n$ mysqld --user=mysql --plugin-load-add=\'server_audit\'\n--plugin-load-add=\'ed25519=auth_ed25519\'\n\nYou could also set the option to the same values in an option file:\n\n[mariadb]\n...\nplugin_load_add = server_audit\nplugin_load_add = ed25519=auth_ed25519\n\nSpecial care must be taken when specifying both the --plugin-load option and\nthe --plugin-load-add option together. The --plugin-load option resets the\nplugin load list, and this can cause unexpected problems if you are not aware.\nThe --plugin-load-add option does not reset the plugin load list, so it is\nmuch safer to use. See Specifying Multiple Plugin Load Options for more\ninformation.\n\nInstalling a Plugin with --plugin-load\n--------------------------------------\n\nYou can install a plugin with the --plugin-load option by specifying the\noption as a command-line argument to mysqld or by specifying the option in a\nrelevant server option group in an option file.\n\nThe --plugin-load option uses the following format:\n\n* Plugins can be specified in the format name=library, where name is the\nplugin name and library is the plugin library. This format installs a single\nplugin from the given plugin library.\n* Plugins can also be specified in the format library, where library is the\nplugin library. This format installs all plugins from the given plugin library.\n* Multiple plugins can be specified by separating them with semicolons.\n\nFor example, to install all plugins in the server_audit plugin library (which\nis currently only the server_audit audit plugin) and also the ed25519\nauthentication plugin from the auth_ed25519 plugin library, you could set the\noption to the following values on the command-line:\n\n$ mysqld --user=mysql --plugin-load=\'server_audit;ed25519=auth_ed25519\'\n\nYou could also set the option to the same values in an option file:\n\n[mariadb]\n...\nplugin_load = server_audit;ed25519=auth_ed25519\n\nSpecial care must be taken when specifying the --plugin-load option multiple\ntimes, or when specifying both the --plugin-load option and the\n--plugin-load-add option together. The --plugin-load option resets the plugin\nload list, and this can cause unexpected problems if you are not aware. The\n--plugin-load-add option does not reset the plugin load list, so it is much\nsafer to use. See Specifying Multiple Plugin Load Options for more information.\n\nSpecifying Multiple Plugin Load Options\n---------------------------------------\n\nSpecial care must be taken when specifying the --plugin-load option multiple\ntimes, or when specifying both the --plugin-load option and the\n--plugin-load-add option. The --plugin-load option resets the plugin load\nlist, and this can cause unexpected problems if you are not aware. The\n--plugin-load-add option does not reset the plugin load list, so it is much\nsafer to use.\n\nThis can have the following consequences:\n\n* If the --plugin-load option is specified multiple times, then only the last\ninstance will have any effect. For example, in the following case, the first\ninstance of the option is reset:\n\n[mariadb]\n...\nplugin_load = server_audit\nplugin_load = ed25519=auth_ed25519\n\n* If the --plugin-load option is specified after the --plugin-load-add option,\nthen it will also reset the changes made by that option. For example, in the\nfollowing case, the --plugin-load-add option does not do anything, because the\nsubsequent --plugin-load option resets the plugin load list:\n\n[mariadb]\n...\nplugin_load_add = server_audit\nplugin_load = ed25519=auth_ed25519\n\n* In contrast, if the --plugin-load option is specified before the\n--plugin-load-add option, then it will work fine, because the\n--plugin-load-add option does not reset the plugin load list. For example, in\nthe following case, both plugins are properly loaded:\n\n[mariadb]\n...\nplugin_load = server_audit\nplugin_load_add = ed25519=auth_ed25519\n\nInstalling a Plugin with mysql_plugin\n-------------------------------------\n\nA plugin can be installed with the mysql_plugin utility if the server is\ncompletely offline.\n\nThe syntax is:\n\nmysql_plugin [options] ENABLE|DISABLE\n\nFor example, to install the server_audit audit plugin, you could execute the\nfollowing:\n\nmysql_plugin server_audit ENABLE\n\nIf a plugin is installed with this utility, then a record will be added to the\nmysql.plugins table for the plugin. This means that the plugin will\nautomatically be loaded every time the server restarts, unless specifically\nuninstalled or deactivated.\n\nConfiguring the Plugin Directory\n--------------------------------\n\nWhen a plugin is being installed, the server looks for the plugin\'s library in\nthe server\'s plugin directory. This directory is configured by the plugin_dir\nsystem variable. This can be specified as a command-line argument to mysqld or\nit can be specified in a relevant server option group in an option file. For\nexample:\n\n[mariadb]\n...\nplugin_dir = /usr/lib64/mysql/plugin\n\nConfiguring the Minimum Plugin Maturity\n---------------------------------------\n\nWhen a plugin is being installed, the server compares the plugin\'s maturity\nlevel against the server\'s minimum allowed plugin maturity. This can help\nprevent users from using unstable plugins on production servers. This minimum\nplugin maturity is configured by the plugin_maturity system variable. This can\nbe specified as a command-line argument to mysqld or it can be specified in a\nrelevant server option group in an option file. For example:\n\n[mariadb]\n...\nplugin_maturity = stable\n\nConfiguring Plugin Activation at Server Startup\n-----------------------------------------------\n\nA plugin will be loaded by default when the server starts if:\n\n* The plugin was installed with the INSTALL SONAME statement.\n* The plugin was installed with the INSTALL PLUGIN statement.\n* The plugin was installed with the mysql_plugin utility.\n* The server is configured to load the plugin with the --plugin-load-add\noption.\n* The server is configured to load the plugin with the --plugin-load option.\n\nThis behavior can be changed with special options that take the form\n--plugin-name. For example, for the server_audit audit plugin, the special\noption is called --server-audit.\n\nThe possible values for these special options are:\n\n+---------------------------------------+------------------------------------+\n| Option Value | Description |\n+---------------------------------------+------------------------------------+\n| OFF | Disables the plugin without |\n| | removing it from the |\n| | mysql.plugins table. |\n+---------------------------------------+------------------------------------+\n| ON | Enables the plugin. If the plugin |\n| | cannot be initialized, then the |\n| | server will still continue |\n| | starting up, but the plugin will |\n| | be disabled. |\n+---------------------------------------+------------------------------------+\n| FORCE | Enables the plugin. If the plugin |','','https://mariadb.com/kb/en/plugin-overview/'); +update help_topic set description = CONCAT(description, '\n| | cannot be initialized, then the |\n| | server will fail to start with an |\n| | error. |\n+---------------------------------------+------------------------------------+\n| FORCE_PLUS_PERMANENT | Enables the plugin. If the plugin |\n| | cannot be initialized, then the |\n| | server will fail to start with an |\n| | error. In addition, the plugin |\n| | cannot be uninstalled with |\n| | UNINSTALL SONAME or UNINSTALL |\n| | PLUGIN while the server is |\n| | running. |\n+---------------------------------------+------------------------------------+\n\nA plugin\'s status can be found by looking at the PLUGIN_STATUS column of the\ninformation_schema.PLUGINS table.\n\nUninstalling Plugins\n--------------------\n\nPlugins that are found in the mysql.plugin table, that is those that were\ninstalled with INSTALL SONAME, INSTALL PLUGIN or mysql_plugin can be\nuninstalled in one of two ways:\n\n* The UNINSTALL SONAME or the UNINSTALL PLUGIN statement while the server is\nrunning\n* With mysql_plugin while the server is offline.\n\nPlugins that were enabled as a --plugin-load option do not need to be\nuninstalled. If --plugin-load is omitted the next time the server starts, or\nthe plugin is not listed as one of the --plugin-load entries, the plugin will\nnot be loaded.\n\nUNINSTALL PLUGIN uninstalls a single installed plugin, while UNINSTALL SONAME\nuninstalls all plugins belonging to a given library.\n\nURL: https://mariadb.com/kb/en/plugin-overview/') WHERE help_topic_id = 79; +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (80,6,'MBR Definition','Description\n-----------\n\nThe MBR (Minimum Bounding Rectangle), or Envelope is the bounding geometry,\nformed by the minimum and maximum (X,Y) coordinates:\n\nExamples\n--------\n\n((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n\nURL: https://mariadb.com/kb/en/mbr-definition/','','https://mariadb.com/kb/en/mbr-definition/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (81,6,'MBRContains','Syntax\n------\n\nMBRContains(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1\ncontains the Minimum Bounding Rectangle of g2. This tests the opposite\nrelationship as MBRWithin().\n\nExamples\n--------\n\nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\n\nSET @g2 = GeomFromText(\'Point(1 1)\');\n\nSELECT MBRContains(@g1,@g2), MBRContains(@g2,@g1);\n+----------------------+----------------------+\n| MBRContains(@g1,@g2) | MBRContains(@g2,@g1) |\n+----------------------+----------------------+\n| 1 | 0 |\n+----------------------+----------------------+\n\nURL: https://mariadb.com/kb/en/mbrcontains/','','https://mariadb.com/kb/en/mbrcontains/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (82,6,'MBRDisjoint','Syntax\n------\n\nMBRDisjoint(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of the two\ngeometries g1 and g2 are disjoint. Two geometries are disjoint if they do not\nintersect, that is touch or overlap.\n\nExamples\n--------\n\nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((4 4,4 7,7 7,7 4,4 4))\');\nSELECTmbrdisjoint(@g1,@g2);\n+----------------------+\n| mbrdisjoint(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n\nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbrdisjoint(@g1,@g2);\n+----------------------+\n| mbrdisjoint(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n\nURL: https://mariadb.com/kb/en/mbrdisjoint/','','https://mariadb.com/kb/en/mbrdisjoint/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (83,6,'MBREqual','Syntax\n------\n\nMBREqual(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of the two\ngeometries g1 and g2 are the same.\n\nExamples\n--------\n\nSET @g1=GEOMFROMTEXT(\'LINESTRING(0 0, 1 2)\');\nSET @g2=GEOMFROMTEXT(\'POLYGON((0 0, 0 2, 1 2, 1 0, 0 0))\');\nSELECT MbrEqual(@g1,@g2);\n+-------------------+\n| MbrEqual(@g1,@g2) |\n+-------------------+\n| 1 |\n+-------------------+\n\nSET @g1=GEOMFROMTEXT(\'LINESTRING(0 0, 1 3)\');\nSET @g2=GEOMFROMTEXT(\'POLYGON((0 0, 0 2, 1 4, 1 0, 0 0))\');\nSELECT MbrEqual(@g1,@g2);\n+-------------------+\n| MbrEqual(@g1,@g2) |\n+-------------------+\n| 0 |\n+-------------------+\n\nURL: https://mariadb.com/kb/en/mbrequal/','','https://mariadb.com/kb/en/mbrequal/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (84,6,'MBRIntersects','Syntax\n------\n\nMBRIntersects(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of the two\ngeometries g1 and g2 intersect.\n\nExamples\n--------\n\nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbrintersects(@g1,@g2);\n+------------------------+\n| mbrintersects(@g1,@g2) |\n+------------------------+\n| 1 |\n+------------------------+\n\nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((4 4,4 7,7 7,7 4,4 4))\');\nSELECT mbrintersects(@g1,@g2);\n+------------------------+\n| mbrintersects(@g1,@g2) |\n+------------------------+\n| 0 |\n+------------------------+\n\nURL: https://mariadb.com/kb/en/mbrintersects/','','https://mariadb.com/kb/en/mbrintersects/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (85,6,'MBROverlaps','Syntax\n------\n\nMBROverlaps(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of the two\ngeometries g1 and g2 overlap. The term spatially overlaps is used if two\ngeometries intersect and their intersection results in a geometry of the same\ndimension but not equal to either of the given geometries.\n\nExamples\n--------\n\nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((4 4,4 7,7 7,7 4,4 4))\');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n\nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 0 |\n+----------------------+\n\nSET @g1 = GeomFromText(\'Polygon((0 0,0 4,4 4,4 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbroverlaps(@g1,@g2);\n+----------------------+\n| mbroverlaps(@g1,@g2) |\n+----------------------+\n| 1 |\n+----------------------+\n\nURL: https://mariadb.com/kb/en/mbroverlaps/','','https://mariadb.com/kb/en/mbroverlaps/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (86,6,'MBRTouches','Syntax\n------\n\nMBRTouches(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of the two\ngeometries g1 and g2 touch. Two geometries spatially touch if the interiors of\nthe geometries do not intersect, but the boundary of one of the geometries\nintersects either the boundary or the interior of the other.\n\nExamples\n--------\n\nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((4 4,4 7,7 7,7 4,4 4))\');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n\nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 1 |\n+---------------------+\n\nSET @g1 = GeomFromText(\'Polygon((0 0,0 4,4 4,4 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((3 3,3 6,6 6,6 3,3 3))\');\nSELECT mbrtouches(@g1,@g2);\n+---------------------+\n| mbrtouches(@g1,@g2) |\n+---------------------+\n| 0 |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/mbrtouches/','','https://mariadb.com/kb/en/mbrtouches/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (87,6,'MBRWithin','Syntax\n------\n\nMBRWithin(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1 is\nwithin the Minimum Bounding Rectangle of g2. This tests the opposite\nrelationship as MBRContains().\n\nExamples\n--------\n\nSET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nSET @g2 = GeomFromText(\'Polygon((0 0,0 5,5 5,5 0,0 0))\');\nSELECT MBRWithin(@g1,@g2), MBRWithin(@g2,@g1);\n+--------------------+--------------------+\n| MBRWithin(@g1,@g2) | MBRWithin(@g2,@g1) |\n+--------------------+--------------------+\n| 1 | 0 |\n+--------------------+--------------------+\n\nURL: https://mariadb.com/kb/en/mbrwithin/','','https://mariadb.com/kb/en/mbrwithin/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (88,7,'CASE OPERATOR','Syntax\n------\n\nCASE value WHEN [compare_value] THEN result [WHEN [compare_value] THEN\nresult ...] [ELSE result] END\n\nCASE WHEN [condition] THEN result [WHEN [condition] THEN result ...]\n[ELSE result] END\n\nDescription\n-----------\n\nThe first version returns the result where value=compare_value. The second\nversion returns the result for the first condition that is true. If there was\nno matching result value, the result after ELSE is returned, or NULL if there\nis no ELSE part.\n\nThere is also a CASE statement, which differs from the CASE operator described\nhere.\n\nExamples\n--------\n\nSELECT CASE 1 WHEN 1 THEN \'one\' WHEN 2 THEN \'two\' ELSE \'more\' END;\n+------------------------------------------------------------+\n| CASE 1 WHEN 1 THEN \'one\' WHEN 2 THEN \'two\' ELSE \'more\' END |\n+------------------------------------------------------------+\n| one |\n+------------------------------------------------------------+\n\nSELECT CASE WHEN 1>0 THEN \'true\' ELSE \'false\' END;\n+--------------------------------------------+\n| CASE WHEN 1>0 THEN \'true\' ELSE \'false\' END |\n+--------------------------------------------+\n| true |\n+--------------------------------------------+\n\nSELECT CASE BINARY \'B\' WHEN \'a\' THEN 1 WHEN \'b\' THEN 2 END;\n+-----------------------------------------------------+\n| CASE BINARY \'B\' WHEN \'a\' THEN 1 WHEN \'b\' THEN 2 END |\n+-----------------------------------------------------+\n| NULL |\n+-----------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/case-operator/','','https://mariadb.com/kb/en/case-operator/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (89,7,'IF Function','Syntax\n------\n\nIF(expr1,expr2,expr3)\n\nDescription\n-----------\n\nIf expr1 is TRUE (expr1 <> 0 and expr1 <> NULL) then IF() returns expr2;\notherwise it returns expr3. IF() returns a numeric or string value, depending\non the context in which it is used.\n\nNote: There is also an IF statement which differs from the IF() function\ndescribed here.\n\nExamples\n--------\n\nSELECT IF(1>2,2,3);\n+-------------+\n| IF(1>2,2,3) |\n+-------------+\n| 3 |\n+-------------+\n\nSELECT IF(1<2,\'yes\',\'no\');\n+--------------------+\n| IF(1<2,\'yes\',\'no\') |\n+--------------------+\n| yes |\n+--------------------+\n\nSELECT IF(STRCMP(\'test\',\'test1\'),\'no\',\'yes\');\n+---------------------------------------+\n| IF(STRCMP(\'test\',\'test1\'),\'no\',\'yes\') |\n+---------------------------------------+\n| no |\n+---------------------------------------+\n\nURL: https://mariadb.com/kb/en/if-function/','','https://mariadb.com/kb/en/if-function/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (90,7,'IFNULL','Syntax\n------\n\nIFNULL(expr1,expr2)\nNVL(expr1,expr2)\n\nDescription\n-----------\n\nIf expr1 is not NULL, IFNULL() returns expr1; otherwise it returns expr2.\nIFNULL() returns a numeric or string value, depending on the context in which\nit is used.\n\nFrom MariaDB 10.3, NVL() is an alias for IFNULL().\n\nExamples\n--------\n\nSELECT IFNULL(1,0); \n+-------------+\n| IFNULL(1,0) |\n+-------------+\n| 1 |\n+-------------+\n\nSELECT IFNULL(NULL,10);\n+-----------------+\n| IFNULL(NULL,10) |\n+-----------------+\n| 10 |\n+-----------------+\n\nSELECT IFNULL(1/0,10);\n+----------------+\n| IFNULL(1/0,10) |\n+----------------+\n| 10.0000 |\n+----------------+\n\nSELECT IFNULL(1/0,\'yes\');\n+-------------------+\n| IFNULL(1/0,\'yes\') |\n+-------------------+\n| yes |\n+-------------------+\n\nURL: https://mariadb.com/kb/en/ifnull/','','https://mariadb.com/kb/en/ifnull/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (91,7,'NULLIF','Syntax\n------\n\nNULLIF(expr1,expr2)\n\nDescription\n-----------\n\nReturns NULL if expr1 = expr2 is true, otherwise returns expr1. This is the\nsame as CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END.\n\nExamples\n--------\n\nSELECT NULLIF(1,1);\n+-------------+\n| NULLIF(1,1) |\n+-------------+\n| NULL |\n+-------------+\n\nSELECT NULLIF(1,2);\n+-------------+\n| NULLIF(1,2) |\n+-------------+\n| 1 |\n+-------------+\n\nURL: https://mariadb.com/kb/en/nullif/','','https://mariadb.com/kb/en/nullif/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (92,7,'NVL','MariaDB starting with 10.3\n--------------------------\nFrom MariaDB 10.3, NVL is a synonym for IFNULL.\n\nURL: https://mariadb.com/kb/en/nvl/','','https://mariadb.com/kb/en/nvl/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (93,7,'NVL2','MariaDB starting with 10.3\n--------------------------\nThe NLV2 function was introduced in MariaDB 10.3.0.\n\nSyntax\n------\n\nNVL2(expr1,expr2,expr3)\n\nDescription\n-----------\n\nThe NVL2 function returns a value based on whether a specified expression is\nNULL or not. If expr1 is not NULL, then NVL2 returns expr2. If expr1 is NULL,\nthen NVL2 returns expr3.\n\nExamples\n--------\n\nSELECT NVL2(NULL,1,2);\n+----------------+\n| NVL2(NULL,1,2) |\n+----------------+\n| 2 |\n+----------------+\n\nSELECT NVL2(\'x\',1,2);\n+---------------+\n| NVL2(\'x\',1,2) |\n+---------------+\n| 1 |\n+---------------+\n\nURL: https://mariadb.com/kb/en/nvl2/','','https://mariadb.com/kb/en/nvl2/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (94,8,'SET TRANSACTION','Syntax\n------\n\nSET [GLOBAL | SESSION] TRANSACTION\n transaction_property [, transaction_property] ...\n\ntransaction_property:\n ISOLATION LEVEL level\n | READ WRITE\n | READ ONLY\n\nlevel:\n REPEATABLE READ\n | READ COMMITTED\n | READ UNCOMMITTED\n | SERIALIZABLE\n\nDescription\n-----------\n\nThis statement sets the transaction isolation level or the transaction access\nmode globally, for the current session, or for the next transaction:\n\n* With the GLOBAL keyword, the statement sets the default\n transaction level globally for all subsequent sessions. Existing sessions are\n unaffected.\n* With the SESSION keyword, the statement sets the default\n transaction level for all subsequent transactions performed within the\n current session.\n* Without any SESSION or GLOBAL keyword,\n the statement sets the isolation level for the next (not started) transaction\n performed within the current session.\n\nA change to the global default isolation level requires the SUPER privilege.\nAny session is free to change its session isolation level (even in the middle\nof a transaction), or the isolation level for its next transaction.\n\nIsolation Level\n---------------\n\nTo set the global default isolation level at server startup, use the\n--transaction-isolation=level option on the command line or in an option file.\nValues of level for this option use dashes rather than spaces, so the\nallowable values are READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, or\nSERIALIZABLE. For example, to set the default isolation level to REPEATABLE\nREAD, use these lines in the [mysqld] section of an option file:\n\n[mysqld]\ntransaction-isolation = REPEATABLE-READ\nTo determine the global and session transaction isolation levels at runtime,\ncheck the value of the tx_isolation system variable:\n\nSELECT @@GLOBAL.tx_isolation, @@tx_isolation;\n\nInnoDB supports each of the translation isolation levels described here using\ndifferent locking strategies. The default level is REPEATABLE READ. For\nadditional information about InnoDB record-level locks and how it uses them to\nexecute various types of statements, see InnoDB Lock Modes, and\nhttp://dev.mysql.com/doc/refman/en/innodb-locks-set.html.\n\nIsolation Levels\n----------------\n\nThe following sections describe how MariaDB supports the different transaction\nlevels.\n\nREAD UNCOMMITTED\n----------------\n\nSELECT statements are performed in a non-locking fashion, but a possible\nearlier version of a row might be used. Thus, using this isolation level, such\nreads are not consistent. This is also called a \"dirty read.\" Otherwise, this\nisolation level works like READ COMMITTED.\n\nREAD COMMITTED\n--------------\n\nA somewhat Oracle-like isolation level with respect to consistent\n(non-locking) reads: Each consistent read, even within the same transaction,\nsets and reads its own fresh snapshot. See\nhttp://dev.mysql.com/doc/refman/en/innodb-consistent-read.html.\n\nFor locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE), InnoDB locks\nonly index records, not the gaps before them, and thus allows the free\ninsertion of new records next to locked records. For UPDATE and DELETE\nstatements, locking depends on whether the statement uses a unique index with\na unique search condition (such as WHERE id = 100), or a range-type search\ncondition (such as WHERE id > 100). For a unique index with a unique search\ncondition, InnoDB locks only the index record found, not the gap before it.\nFor range-type searches, InnoDB locks the index range scanned, using gap locks\nor next-key (gap plus index-record) locks to block insertions by other\nsessions into the gaps covered by the range. This is necessary because\n\"phantom rows\" must be blocked for MySQL replication and recovery to work.\n\nNote: If the READ COMMITTED isolation level is used or the\ninnodb_locks_unsafe_for_binlog system variable is enabled, there is no InnoDB\ngap locking except for foreign-key constraint checking and duplicate-key\nchecking. Also, record locks for non-matching rows are released after MariaDB\nhas evaluated the WHERE condition.If you use READ COMMITTED or enable\ninnodb_locks_unsafe_for_binlog, you must use row-based binary logging.\n\nREPEATABLE READ\n---------------\n\nThis is the default isolation level for InnoDB. For consistent reads, there is\nan important difference from the READ COMMITTED isolation level: All\nconsistent reads within the same transaction read the snapshot established by\nthe first read. This convention means that if you issue several plain\n(non-locking) SELECT statements within the same transaction, these SELECT\nstatements are consistent also with respect to each other. See\nhttp://dev.mysql.com/doc/refman/en/innodb-consistent-read.html.\n\nFor locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE), UPDATE, and\nDELETE statements, locking depends on whether the statement uses a unique\nindex with a unique search condition, or a range-type search condition. For a\nunique index with a unique search condition, InnoDB locks only the index\nrecord found, not the gap before it. For other search conditions, InnoDB locks\nthe index range scanned, using gap locks or next-key (gap plus index-record)\nlocks to block insertions by other sessions into the gaps covered by the range.\n\nThis is the minimum isolation level for non-distributed XA transactions.\n\nSERIALIZABLE\n------------\n\nThis level is like REPEATABLE READ, but InnoDB implicitly converts all plain\nSELECT statements to SELECT ... LOCK IN SHARE MODE if autocommit is disabled.\nIf autocommit is enabled, the SELECT is its own transaction. It therefore is\nknown to be read only and can be serialized if performed as a consistent\n(non-locking) read and need not block for other transactions. (This means that\nto force a plain SELECT to block if other transactions have modified the\nselected rows, you should disable autocommit.)\n\nDistributed XA transactions should always use this isolation level.\n\nAccess Mode\n-----------\n\nThe access mode specifies whether the transaction is allowed to write data or\nnot. By default, transactions are in READ WRITE mode (see the tx_read_only\nsystem variable). READ ONLY mode allows the storage engine to apply\noptimizations that cannot be used for transactions which write data. The only\nexception to this rule is that read only transactions can perform DDL\nstatements on temporary tables.\n\nIt is not permitted to specify both READ WRITE and READ ONLY in the same\nstatement.\n\nREAD WRITE and READ ONLY can also be specified in the START TRANSACTION\nstatement, in which case the specified mode is only valid for one transaction.\n\nExamples\n--------\n\nSET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE;\n\nAttempting to set the isolation level within an existing transaction without\nspecifying GLOBAL or SESSION.\n\nSTART TRANSACTION;\n\nSET TRANSACTION ISOLATION LEVEL SERIALIZABLE;\nERROR 1568 (25001): Transaction characteristics can\'t be changed while a\ntransaction is in progress\n\nURL: https://mariadb.com/kb/en/set-transaction/','','https://mariadb.com/kb/en/set-transaction/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (95,8,'START TRANSACTION','Syntax\n------\n\nSTART TRANSACTION [transaction_property [, transaction_property] ...] | BEGIN\n[WORK]\nCOMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nROLLBACK [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nSET autocommit = {0 | 1}\n\ntransaction_property:\n WITH CONSISTENT SNAPSHOT\n | READ WRITE\n | READ ONLY\n\nDescription\n-----------\n\nThe START TRANSACTION or BEGIN statement begins a new transaction. COMMIT\ncommits the current transaction, making its changes permanent. ROLLBACK rolls\nback the current transaction, canceling its changes. The SET autocommit\nstatement disables or enables the default autocommit mode for the current\nsession.\n\nSTART TRANSACTION and SET autocommit = 1 implicitly commit the current\ntransaction, if any.\n\nThe optional WORK keyword is supported for COMMIT and ROLLBACK, as are the\nCHAIN and RELEASE clauses. CHAIN and RELEASE can be used for additional\ncontrol over transaction completion. The value of the completion_type system\nvariable determines the default completion behavior.\n\nThe AND CHAIN clause causes a new transaction to begin as soon as the current\none ends, and the new transaction has the same isolation level as the\njust-terminated transaction. The RELEASE clause causes the server to\ndisconnect the current client session after terminating the current\ntransaction. Including the NO keyword suppresses CHAIN or RELEASE completion,\nwhich can be useful if the completion_type system variable is set to cause\nchaining or release completion by default.\n\nAccess Mode\n-----------\n\nThe access mode specifies whether the transaction is allowed to write data or\nnot. By default, transactions are in READ WRITE mode (see the tx_read_only\nsystem variable). READ ONLY mode allows the storage engine to apply\noptimizations that cannot be used for transactions which write data. The only\nexception to this rule is that read only transactions can perform DDL\nstatements on temporary tables.\n\nIt is not permitted to specify both READ WRITE and READ ONLY in the same\nstatement.\n\nREAD WRITE and READ ONLY can also be specified in the SET TRANSACTION\nstatement, in which case the specified mode is valid for all sessions, or for\nall subsequent transaction used by the current session.\n\nautocommit\n----------\n\nBy default, MariaDB runs with autocommit mode enabled. This means that as soon\nas you execute a statement that updates (modifies) a table, MariaDB stores the\nupdate on disk to make it permanent. To disable autocommit mode, use the\nfollowing statement:\n\nSET autocommit=0;\n\nAfter disabling autocommit mode by setting the autocommit variable to zero,\nchanges to transaction-safe tables (such as those for InnoDB or NDBCLUSTER)\nare not made permanent immediately. You must use COMMIT to store your changes\nto disk or ROLLBACK to ignore the changes.\n\nTo disable autocommit mode for a single series of statements, use the START\nTRANSACTION statement.\n\nDDL Statements\n--------------\n\nDDL statements (CREATE, ALTER, DROP) and administrative statements (FLUSH,\nRESET, OPTIMIZE, ANALYZE, CHECK, REPAIR, CACHE INDEX), transaction management\nstatements (BEGIN, START TRANSACTION) and LOAD DATA INFILE, cause an implicit\nCOMMIT and start a new transaction. An exception to this rule are the DDL that\noperate on temporary tables: you can CREATE, ALTER and DROP them without\ncausing any COMMIT, but those actions cannot be rolled back. This means that\nif you call ROLLBACK, the temporary tables you created in the transaction will\nremain, while the rest of the transaction will be rolled back.\n\nTransactions cannot be used in Stored Functions or Triggers. In Stored\nProcedures and Events BEGIN is not allowed, so you should use START\nTRANSACTION instead.\n\nA transaction acquires a metadata lock on every table it accesses to prevent\nother connections from altering their structure. The lock is released at the\nend of the transaction. This happens even with non-transactional storage\nengines (like MEMORY or CONNECT), so it makes sense to use transactions with\nnon-transactional tables.\n\nin_transaction\n--------------\n\nThe in_transaction system variable is a session-only, read-only variable that\nreturns 1 inside a transaction, and 0 if not in a transaction.\n\nWITH CONSISTENT SNAPSHOT\n------------------------\n\nThe WITH CONSISTENT SNAPSHOT option starts a consistent read for storage\nengines such as InnoDB that can do so, the same as if a START TRANSACTION\nfollowed by a SELECT from any InnoDB table was issued.\n\nSee Enhancements for START TRANSACTION WITH CONSISTENT SNAPSHOT.\n\nExamples\n--------\n\nSTART TRANSACTION;\nSELECT @A:=SUM(salary) FROM table1 WHERE type=1;\nUPDATE table2 SET summary=@A WHERE type=1;\nCOMMIT;\n\nURL: https://mariadb.com/kb/en/start-transaction/','','https://mariadb.com/kb/en/start-transaction/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (96,8,'COMMIT','The COMMIT statement ends a transaction, saving any changes to the data so\nthat they become visible to subsequent transactions. Also, unlocks metadata\nchanged by current transaction. If autocommit is set to 1, an implicit commit\nis performed after each statement. Otherwise, all transactions which don\'t end\nwith an explicit COMMIT are implicitly rollbacked and the changes are lost.\nThe ROLLBACK statement can be used to do this explicitly.\n\nThe required syntax for the COMMIT statement is as follows:\n\nCOMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\n\nCOMMIT is the more important transaction terminator, as well as the more\ninteresting one. The basic form of the COMMIT statement is simply the keyword\nCOMMIT (the keyword WORK is simply noise and can be omitted without changing\nthe effect).\n\nThe optional AND CHAIN clause is a convenience for initiating a new\ntransaction as soon as the old transaction terminates. If AND CHAIN is\nspecified, then there is effectively nothing between the old and new\ntransactions, although they remain separate. The characteristics of the new\ntransaction will be the same as the characteristics of the old one — that is,\nthe new transaction will have the same access mode, isolation level and\ndiagnostics area size (we\'ll discuss all of these shortly) as the transaction\njust terminated.\n\nRELEASE tells the server to disconnect the client immediately after the\ncurrent transaction.\n\nThere are NO RELEASE and AND NO CHAIN options. By default, commits do not\nRELEASE or CHAIN, but it\'s possible to change this default behavior with the\ncompletion_type server system variable. In this case, the AND NO CHAIN and NO\nRELEASE options override the server default.\n\nURL: https://mariadb.com/kb/en/commit/','','https://mariadb.com/kb/en/commit/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (97,8,'ROLLBACK','The ROLLBACK statement rolls back (ends) a transaction, destroying any changes\nto SQL-data so that they never become visible to subsequent transactions. The\nrequired syntax for the ROLLBACK statement is as follows.\n\nROLLBACK [ WORK ] [ AND [ NO ] CHAIN ] \n[ TO [ SAVEPOINT ] { | } ]\n\nThe ROLLBACK statement will either end a transaction, destroying all data\nchanges that happened during any of the transaction, or it will just destroy\nany data changes that happened since you established a savepoint. The basic\nform of the ROLLBACK statement is just the keyword ROLLBACK (the keyword WORK\nis simply noise and can be omitted without changing the effect).\n\nThe optional AND CHAIN clause is a convenience for initiating a new\ntransaction as soon as the old transaction terminates. If AND CHAIN is\nspecified, then there is effectively nothing between the old and new\ntransactions, although they remain separate. The characteristics of the new\ntransaction will be the same as the characteristics of the old one — that is,\nthe new transaction will have the same access mode, isolation level and\ndiagnostics area size (we\'ll discuss all of these shortly) as the transaction\njust terminated. The AND NO CHAIN option just tells your DBMS to end the\ntransaction — that is, these four SQL statements are equivalent:\n\nROLLBACK; \nROLLBACK WORK; \nROLLBACK AND NO CHAIN; \nROLLBACK WORK AND NO CHAIN;\n\nAll of them end a transaction without saving any transaction characteristics.\nThe only other options, the equivalent statements:\n\nROLLBACK AND CHAIN;\nROLLBACK WORK AND CHAIN;\n\nboth tell your DBMS to end a transaction, but to save that transaction\'s\ncharacteristics for the next transaction.\n\nROLLBACK is much simpler than COMMIT: it may involve no more than a few\ndeletions (of Cursors, locks, prepared SQL statements and log-file entries).\nIt\'s usually assumed that ROLLBACK can\'t fail, although such a thing is\nconceivable (for example, an encompassing transaction might reject an attempt\nto ROLLBACK because it\'s lining up for a COMMIT).\n\nROLLBACK cancels all effects of a transaction. It does not cancel effects on\nobjects outside the DBMS\'s control (for example the values in host program\nvariables or the settings made by some SQL/CLI function calls). But in\ngeneral, it is a convenient statement for those situations when you say \"oops,\nthis isn\'t working\" or when you simply don\'t care whether your temporary work\nbecomes permanent or not.\n\nHere is a moot question. If all you\'ve been doing is SELECTs, so that there\nhave been no data changes, should you end the transaction with ROLLBACK or\nCOMMIT? It shouldn\'t really matter because both ROLLBACK and COMMIT do the\nsame transaction-terminating job. However, the popular conception is that\nROLLBACK implies failure, so after a successful series of SELECT statements\nthe convention is to end the transaction with COMMIT rather than ROLLBACK.\n\nMariaDB (and most other DBMSs) supports rollback of SQL-data change\nstatements, but not of SQL-Schema statements. This means that if you use any\nof CREATE, ALTER, DROP, GRANT, REVOKE, you are implicitly committing at\nexecution time.\n\nINSERT INTO Table_2 VALUES(5); \nDROP TABLE Table_3 CASCADE; \nROLLBACK;\n\nThe result will be that both the INSERT and the DROP will go through as\nseparate transactions so the ROLLBACK will have no effect.\n\nURL: https://mariadb.com/kb/en/rollback/','','https://mariadb.com/kb/en/rollback/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (98,8,'LOCK TABLES','Syntax\n------\n\nLOCK TABLE[S]\n tbl_name [[AS] alias] lock_type\n [, tbl_name [[AS] alias] lock_type] ...\n [WAIT n|NOWAIT]\n\nlock_type:\n READ [LOCAL]\n | [LOW_PRIORITY] WRITE\n | WRITE CONCURRENT\n\nUNLOCK TABLES\n\nDescription\n-----------\n\nThe lock_type can be one of:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| READ | Read lock, no writes allowed |\n+---------------------------+------------------------------------------------+\n| READ LOCAL | Read lock, but allow concurrent inserts |\n+---------------------------+------------------------------------------------+\n| WRITE | Exclusive write lock. No other connections |\n| | can read or write to this table |\n+---------------------------+------------------------------------------------+\n| LOW_PRIORITY WRITE | Exclusive write lock, but allow new read |\n| | locks on the table until we get the write |\n| | lock. |\n+---------------------------+------------------------------------------------+\n| WRITE CONCURRENT | Exclusive write lock, but allow READ LOCAL |\n| | locks to the table. |\n+---------------------------+------------------------------------------------+\n\nMariaDB enables client sessions to acquire table locks explicitly for the\npurpose of cooperating with other sessions for access to tables, or to prevent\nother sessions from modifying tables during periods when a session requires\nexclusive access to them. A session can acquire or release locks only for\nitself. One session cannot acquire locks for another session or release locks\nheld by another session.\n\nLocks may be used to emulate transactions or to get more speed when updating\ntables.\n\nLOCK TABLES explicitly acquires table locks for the current client session.\nTable locks can be acquired for base tables or views. To use LOCK TABLES, you\nmust have the LOCK TABLES privilege, and the SELECT privilege for each object\nto be locked. See GRANT\n\nFor view locking, LOCK TABLES adds all base tables used in the view to the set\nof tables to be locked and locks them automatically. If you lock a table\nexplicitly with LOCK TABLES, any tables used in triggers are also locked\nimplicitly, as described in Triggers and Implicit Locks.\n\nUNLOCK TABLES explicitly releases any table locks held by the current session.\n\nMariaDB starting with 10.3.0\n----------------------------\n\nWAIT/NOWAIT\n-----------\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nLimitations\n-----------\n\n* LOCK TABLES doesn\'t work when using Galera cluster. You may experience\ncrashes or locks when used with Galera.\n* LOCK TABLES works on XtraDB/InnoDB tables only if the innodb_table_locks\nsystem variable is set to 1 (the default) and autocommit is set to 0 (1 is\ndefault). Please note that no error message will be returned on LOCK TABLES\nwith innodb_table_locks = 0.\n* LOCK TABLES implicitly commits the active transaction, if any. Also,\nstarting a transaction always releases all table locks acquired with LOCK\nTABLES. This means that there is no way to have table locks and an active\ntransaction at the same time. The only exceptions are the transactions in\nautocommit mode. To preserve the data integrity between transactional and\nnon-transactional tables, the GET_LOCK() function can be used.\n* When using LOCK TABLES on a TEMPORARY table, it will always be locked with a\nWRITE lock.\n* While a connection holds an explicit read lock on a table, it cannot modify\nit. If you try, the following error will be produced:\n\nERROR 1099 (HY000): Table \'tab_name\' was locked with a READ lock and can\'t be\nupdated\n\n* While a connection holds an explicit lock on a table, it cannot access a\nnon-locked table. If you try, the following error will be produced:\n\nERROR 1100 (HY000): Table \'tab_name\' was not locked with LOCK TABLES\n\n* While a connection holds an explicit lock on a table, it cannot issue the\nfollowing: INSERT DELAYED, CREATE TABLE, CREATE TABLE ... LIKE, and DDL\nstatements involving stored programs and views (except for triggers). If you\ntry, the following error will be produced:\n\nERROR 1192 (HY000): Can\'t execute the given command because you have active\nlocked tables or an active transaction\n\n* LOCK TABLES can not be used in stored routines - if you try, the following\nerror will be produced on creation. This restriction was removed in MariaDB\n10.6.2:\n\nERROR 1314 (0A000): LOCK is not allowed in stored procedures\n\nURL: https://mariadb.com/kb/en/lock-tables/','','https://mariadb.com/kb/en/lock-tables/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (99,8,'SAVEPOINT','Syntax\n------\n\nSAVEPOINT identifier\nROLLBACK [WORK] TO [SAVEPOINT] identifier\nRELEASE SAVEPOINT identifier\n\nDescription\n-----------\n\nInnoDB supports the SQL statements SAVEPOINT, ROLLBACK TO SAVEPOINT, RELEASE\nSAVEPOINT and the optional WORK keyword for ROLLBACK.\n\nEach savepoint must have a legal MariaDB identifier. A savepoint is a named\nsub-transaction.\n\nNormally ROLLBACK undoes the changes performed by the whole transaction. When\nused with the TO clause, it undoes the changes performed after the specified\nsavepoint, and erases all subsequent savepoints. However, all locks that have\nbeen acquired after the save point will survive. RELEASE SAVEPOINT does not\nrollback or commit any changes, but removes the specified savepoint.\n\nWhen the execution of a trigger or a stored function begins, it is not\npossible to use statements which reference a savepoint which was defined from\nout of that stored program.\n\nWhen a COMMIT (including implicit commits) or a ROLLBACK statement (with no TO\nclause) is performed, they act on the whole transaction, and all savepoints\nare removed.\n\nErrors\n------\n\nIf COMMIT or ROLLBACK is issued and no transaction was started, no error is\nreported.\n\nIf SAVEPOINT is issued and no transaction was started, no error is reported\nbut no savepoint is created. When ROLLBACK TO SAVEPOINT or RELEASE SAVEPOINT\nis called for a savepoint that does not exist, an error like this is issued:\n\nERROR 1305 (42000): SAVEPOINT svp_name does not exist\n\nURL: https://mariadb.com/kb/en/savepoint/','','https://mariadb.com/kb/en/savepoint/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (100,8,'Metadata Locking','MariaDB supports metadata locking. This means that when a transaction\n(including XA transactions) uses a table, it locks its metadata until the end\nof transaction. Non-transactional tables are also locked, as well as views and\nobjects which are related to locked tables/views (stored functions, triggers,\netc). When a connection tries to use a DDL statement (like an ALTER TABLE)\nwhich modifies a table that is locked, that connection is queued, and has to\nwait until it\'s unlocked. Using savepoints and performing a partial rollback\ndoes not release metadata locks.\n\nLOCK TABLES ... WRITE are also queued. Some wrong statements which produce an\nerror may not need to wait for the lock to be freed.\n\nThe metadata lock\'s timeout is determined by the value of the\nlock_wait_timeout server system variable (in seconds). However, note that its\ndefault value is 31536000 (1 year, MariaDB <= 10.2.3), or 86400 (1 day,\nMariaDB >= 10.2.4). If this timeout is exceeded, the following error is\nreturned:\n\nERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction\n\nIf the metadata_lock_info plugin is installed, the Information Schema\nmetadata_lock_info table stores information about existing metadata locks.\n\nMariaDB starting with 10.5.2\n----------------------------\nFrom MariaDB 10.5, the Performance Schema metadata_locks table contains\nmetadata lock information.\n\nExample\n-------\n\nLet\'s use the following MEMORY (non-transactional) table:\n\nCREATE TABLE t (a INT) ENGINE = MEMORY;\n\nConnection 1 starts a transaction, and INSERTs a row into t:\n\nSTART TRANSACTION;\n\nINSERT INTO t SET a=1;\n\nt\'s metadata is now locked by connection 1. Connection 2 tries to alter t, but\nhas to wait:\n\nALTER TABLE t ADD COLUMN b INT;\n\nConnection 2\'s prompt is blocked now.\n\nNow connection 1 ends the transaction:\n\nCOMMIT;\n\n...and connection 2 finally gets the output of its command:\n\nQuery OK, 1 row affected (35.23 sec)\nRecords: 1 Duplicates: 0 Warnings: 0\n\nURL: https://mariadb.com/kb/en/metadata-locking/','','https://mariadb.com/kb/en/metadata-locking/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (101,8,'Transaction Timeouts','MariaDB has always had the wait_timeout and interactive_timeout settings,\nwhich close connections after a certain period of inactivity.\n\nHowever, these are by default set to a long wait period. In situations where\ntransactions may be started, but not committed or rolled back, more granular\ncontrol and a shorter timeout may be desirable so as to avoid locks being held\nfor too long.\n\nMariaDB 10.3 introduced three new variables to handle this situation.\n\n* idle_transaction_timeout (all transactions)\n* idle_write_transaction_timeout (write transactions - called\nidle_readwrite_transaction_timeout until MariaDB 10.3.2)\n* idle_readonly_transaction_timeout (read transactions)\n\nThese accept a time in seconds to time out, by closing the connection,\ntransactions that are idle for longer than this period. By default all are set\nto zero, or no timeout.\n\nidle_transaction_timeout affects all transactions,\nidle_write_transaction_timeout affects write transactions only and\nidle_readonly_transaction_timeout affects read transactions only. The latter\ntwo variables work independently. However, if either is set along with\nidle_transaction_timeout, the settings for idle_write_transaction_timeout or\nidle_readonly_transaction_timeout will take precedence.\n\nExamples\n--------\n\nSET SESSION idle_transaction_timeout=2;\nBEGIN;\nSELECT * FROM t;\nEmpty set (0.000 sec)\n## wait 3 seconds\nSELECT * FROM t;\nERROR 2006 (HY000): MySQL server has gone away\n\nSET SESSION idle_write_transaction_timeout=2;\nBEGIN;\nSELECT * FROM t;\nEmpty set (0.000 sec)\n## wait 3 seconds\nSELECT * FROM t;\nEmpty set (0.000 sec)\nINSERT INTO t VALUES(1);\n## wait 3 seconds\nSELECT * FROM t;\nERROR 2006 (HY000): MySQL server has gone away\n\nSET SESSION idle_transaction_timeout=2, SESSION\nidle_readonly_transaction_timeout=10;\nBEGIN;\nSELECT * FROM t;\nEmpty set (0.000 sec)\n ## wait 3 seconds\nSELECT * FROM t;\nEmpty set (0.000 sec)\n## wait 11 seconds\nSELECT * FROM t;\nERROR 2006 (HY000): MySQL server has gone away\n\nURL: https://mariadb.com/kb/en/transaction-timeouts/','','https://mariadb.com/kb/en/transaction-timeouts/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (102,8,'UNLOCK TABLES','Syntax\n------\n\nUNLOCK TABLES\n\nDescription\n-----------\n\nUNLOCK TABLES explicitly releases any table locks held by the current session.\nSee LOCK TABLES for more information.\n\nIn addition to releasing table locks acquired by the LOCK TABLES statement,\nthe UNLOCK TABLES statement also releases the global read lock acquired by the\nFLUSH TABLES WITH READ LOCK statement. The FLUSH TABLES WITH READ LOCK\nstatement is very useful for performing backups. See FLUSH for more\ninformation about FLUSH TABLES WITH READ LOCK.\n\nURL: https://mariadb.com/kb/en/transactions-unlock-tables/','','https://mariadb.com/kb/en/transactions-unlock-tables/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (103,8,'WAIT and NOWAIT','MariaDB starting with 10.3.0\n----------------------------\nMariaDB 10.3.0 introduced extended syntax so that it is possible to set\ninnodb_lock_wait_timeout and lock_wait_timeout for the following statements:\n\nSyntax\n------\n\nALTER TABLE tbl_name [WAIT n|NOWAIT] ...\nCREATE ... INDEX ON tbl_name (index_col_name, ...) [WAIT n|NOWAIT] ...\nDROP INDEX ... [WAIT n|NOWAIT]\nDROP TABLE tbl_name [WAIT n|NOWAIT] ...\nLOCK TABLE ... [WAIT n|NOWAIT]\nOPTIMIZE TABLE tbl_name [WAIT n|NOWAIT]\nRENAME TABLE tbl_name [WAIT n|NOWAIT] ...\nSELECT ... FOR UPDATE [WAIT n|NOWAIT]\nSELECT ... LOCK IN SHARE MODE [WAIT n|NOWAIT]\nTRUNCATE TABLE tbl_name [WAIT n|NOWAIT]\n\nDescription\n-----------\n\nThe lock wait timeout can be explicitly set in the statement by using either\nWAIT n (to set the wait in seconds) or NOWAIT, in which case the statement\nwill immediately fail if the lock cannot be obtained. WAIT 0 is equivalent to\nNOWAIT.\n\nURL: https://mariadb.com/kb/en/wait-and-nowait/','','https://mariadb.com/kb/en/wait-and-nowait/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (104,8,'XA Transactions','Overview\n--------\n\nThe MariaDB XA implementation is based on the X/Open CAE document Distributed\nTransaction Processing: The XA Specification. This document is published by\nThe Open Group and available at\nhttp://www.opengroup.org/public/pubs/catalog/c193.htm.\n\nXA transactions are designed to allow distributed transactions, where a\ntransaction manager (the application) controls a transaction which involves\nmultiple resources. Such resources are usually DBMSs, but could be resources\nof any type. The whole set of required transactional operations is called a\nglobal transaction. Each subset of operations which involve a single resource\nis called a local transaction. XA used a 2-phases commit (2PC). With the first\ncommit, the transaction manager tells each resource to prepare an effective\ncommit, and waits for a confirm message. The changes are not still made\neffective at this point. If any of the resources encountered an error, the\ntransaction manager will rollback the global transaction. If all resources\ncommunicate that the first commit is successful, the transaction manager can\nrequire a second commit, which makes the changes effective.\n\nIn MariaDB, XA transactions can only be used with storage engines that support\nthem. At least InnoDB, TokuDB, SPIDER and MyRocks support them. For InnoDB,\nuntil MariaDB 10.2, XA transactions can be disabled by setting the\ninnodb_support_xa server system variable to 0. From MariaDB 10.3, XA\ntransactions are always supported.\n\nLike regular transactions, XA transactions create metadata locks on accessed\ntables.\n\nXA transactions require REPEATABLE READ as a minimum isolation level. However,\ndistributed transactions should always use SERIALIZABLE.\n\nTrying to start more than one XA transaction at the same time produces a 1400\nerror (SQLSTATE \'XAE09\'). The same error is produced when attempting to start\nan XA transaction while a regular transaction is in effect. Trying to start a\nregular transaction while an XA transaction is in effect produces a 1399 error\n(SQLSTATE \'XAE07\').\n\nThe statements that cause an implicit COMMIT for regular transactions produce\na 1400 error (SQLSTATE \'XAE09\') if a XA transaction is in effect.\n\nInternal XA vs External XA\n--------------------------\n\nXA transactions are an overloaded term in MariaDB. If a storage engine is\nXA-capable, it can mean one or both of these:\n\n* It supports MariaDB\'s internal two-phase commit API. This is transparent to\nthe user. Sometimes this is called \"internal XA\", since MariaDB\'s internal\ntransaction coordinator log can handle coordinating these transactions.\n\n* It supports XA transactions, with the XA START, XA PREPARE, XA COMMIT, etc.\nstatements. Sometimes this is called \"external XA\", since it requires the use\nof an external transaction coordinator to use this feature properly.\n\nTransaction Coordinator Log\n---------------------------\n\nIf you have two or more XA-capable storage engines enabled, then a transaction\ncoordinator log must be available.\n\nThere are currently two implementations of the transaction coordinator log:\n\n* Binary log-based transaction coordinator log\n* Memory-mapped file-based transaction coordinator log\n\nIf the binary log is enabled on a server, then the server will use the binary\nlog-based transaction coordinator log. Otherwise, it will use the\nmemory-mapped file-based transaction coordinator log.\n\nSee Transaction Coordinator Log for more information.\n\nSyntax\n------\n\nXA {START|BEGIN} xid [JOIN|RESUME]\n\nXA END xid [SUSPEND [FOR MIGRATE]]\n\nXA PREPARE xid\n\nXA COMMIT xid [ONE PHASE]\n\nXA ROLLBACK xid\n\nXA RECOVER [FORMAT=[\'RAW\'|\'SQL\']]\n\nxid: gtrid [, bqual [, formatID ]]\n\nThe interface to XA transactions is a set of SQL statements starting with XA.\nEach statement changes a transaction\'s state, determining which actions it can\nperform. A transaction which does not exist is in the NON-EXISTING state.\n\nXA START (or BEGIN) starts a transaction and defines its xid (a transaction\nidentifier). The JOIN or RESUME keywords have no effect. The new transaction\nwill be in ACTIVE state.\n\nThe xid can have 3 components, though only the first one is mandatory. gtrid\nis a quoted string representing a global transaction identifier. bqual is a\nquoted string representing a local transaction identifier. formatID is an\nunsigned integer indicating the format used for the first two components; if\nnot specified, defaults to 1. MariaDB does not interpret in any way these\ncomponents, and only uses them to identify a transaction. xids of transactions\nin effect must be unique.\n\nXA END declares that the specified ACTIVE transaction is finished and it\nchanges its state to IDLE. SUSPEND [FOR MIGRATE] has no effect.\n\nXA PREPARE prepares an IDLE transaction for commit, changing its state to\nPREPARED. This is the first commit.\n\nXA COMMIT definitely commits and terminates a transaction which has already\nbeen PREPARED. If the ONE PHASE clause is specified, this statements performs\na 1-phase commit on an IDLE transaction.\n\nXA ROLLBACK rolls back and terminates an IDLE or PREPARED transaction.\n\nXA RECOVER shows information about all PREPARED transactions.\n\nWhen trying to execute an operation which is not allowed for the transaction\'s\ncurrent state, an error is produced:\n\nXA COMMIT \'test\' ONE PHASE;\nERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global\ntransaction is in the ACTIVE state\n\nXA COMMIT \'test2\';\nERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global\ntransaction is in the NON-EXISTING state\n\nXA RECOVER\n----------\n\nThe XA RECOVER statement shows information about all transactions which are in\nthe PREPARED state. It does not matter which connection created the\ntransaction: if it has been PREPARED, it appears. But this does not mean that\na connection can commit or rollback a transaction which was started by another\nconnection. Note that transactions using a 1-phase commit are never in the\nPREPARED state, so they cannot be shown by XA RECOVER.\n\nXA RECOVER produces four columns:\n\nXA RECOVER;\n+----------+--------------+--------------+------+\n| formatID | gtrid_length | bqual_length | data |\n+----------+--------------+--------------+------+\n| 1 | 4 | 0 | test |\n+----------+--------------+--------------+------+\n\nMariaDB starting with 10.3.3\n----------------------------\nYou can use XA RECOVER FORMAT=\'SQL\' to get the data in a human readable form\nthat can be directly copy-pasted into XA COMMIT or XA ROLLBACK. This is\nparticularly useful for binary xid generated by some transaction coordinators.\n\nformatID is the formatID part of xid.\n\ndata are the gtrid and bqual parts of xid, concatenated.\n\ngtrid_length and bqual_length are the lengths of gtrid and bqual, respectevely.\n\nExamples\n--------\n\n2-phases commit:\n\nXA START \'test\';\n\nINSERT INTO t VALUES (1,2);\n\nXA END \'test\';\n\nXA PREPARE \'test\';\n\nXA COMMIT \'test\';\n\n1-phase commit:\n\nXA START \'test\';\n\nINSERT INTO t VALUES (1,2);\n\nXA END \'test\';\n\nXA COMMIT \'test\' ONE PHASE;\n\nHuman-readable:\n\nxa start \'12\\r34\\t67\\v78\', \'abc\\ndef\', 3;\n\ninsert t1 values (40);\n\nxa end \'12\\r34\\t67\\v78\', \'abc\\ndef\', 3;\n\nxa prepare \'12\\r34\\t67\\v78\', \'abc\\ndef\', 3;\n\nxa recover format=\'RAW\';\n+----------+--------------+--------------+--------------------+\n| formatID | gtrid_length | bqual_length | data |\n+----------+--------------+--------------+--------------------+\n34 67v78abc 11 | 7 | 12\ndef |\n+----------+--------------+--------------+--------------------+\n\nxa recover format=\'SQL\';\n+----------+--------------+--------------+-------------------------------------\n---------+\n| formatID | gtrid_length | bqual_length | data \n |\n+----------+--------------+--------------+-------------------------------------\n---------+\n| 3 | 11 | 7 |\nX\'31320d3334093637763738\',X\'6162630a646566\',3 |\n+----------+--------------+--------------+-------------------------------------\n---------+\n\nxa rollback X\'31320d3334093637763738\',X\'6162630a646566\',3;\n\nKnown Issues\n------------\n\nMariaDB Galera Cluster\n----------------------\n\nMariaDB Galera Cluster does not support XA transactions.\n\nHowever, MariaDB Galera Cluster builds include a built-in plugin called wsrep.\nPrior to MariaDB 10.4.3, this plugin was internally considered an XA-capable\nstorage engine. Consequently, these MariaDB Galera Cluster builds have\nmultiple XA-capable storage engines by default, even if the only \"real\"\nstorage engine that supports external XA transactions enabled on these builds\nby default is InnoDB. Therefore, when using one these builds MariaDB would be\nforced to use a transaction coordinator log by default, which could have\nperformance implications.\n\nSee Transaction Coordinator Log Overview: MariaDB Galera Cluster for more\ninformation.\n\nURL: https://mariadb.com/kb/en/xa-transactions/','','https://mariadb.com/kb/en/xa-transactions/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (105,10,'CREATE USER','Syntax\n------\n\nCREATE [OR REPLACE] USER [IF NOT EXISTS] \n user_specification [,user_specification ...] \n [REQUIRE {NONE | tls_option [[AND] tls_option ...] }]\n [WITH resource_option [resource_option ...] ]\n [lock_option] [password_option]\n\nuser_specification:\n username [authentication_option]\n\nauthentication_option:\n IDENTIFIED BY \'password\'\n | IDENTIFIED BY PASSWORD \'password_hash\'\n | IDENTIFIED {VIA|WITH} authentication_rule [OR authentication_rule ...]\n\nauthentication_rule:\n authentication_plugin\n | authentication_plugin {USING|AS} \'authentication_string\'\n | authentication_plugin {USING|AS} PASSWORD(\'password\')\n\ntls_option:\n SSL\n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n\nresource_option:\n MAX_QUERIES_PER_HOUR count\n | MAX_UPDATES_PER_HOUR count\n | MAX_CONNECTIONS_PER_HOUR count\n | MAX_USER_CONNECTIONS count\n | MAX_STATEMENT_TIME time\n\npassword_option:\n PASSWORD EXPIRE\n | PASSWORD EXPIRE DEFAULT\n | PASSWORD EXPIRE NEVER\n | PASSWORD EXPIRE INTERVAL N DAY\n\nlock_option:\n ACCOUNT LOCK\n | ACCOUNT UNLOCK\n}\n\nDescription\n-----------\n\nThe CREATE USER statement creates new MariaDB accounts. To use it, you must\nhave the global CREATE USER privilege or the INSERT privilege for the mysql\ndatabase. For each account, CREATE USER creates a new row in mysql.user (until\nMariaDB 10.3 this is a table, from MariaDB 10.4 it\'s a view) or\nmysql.global_priv_table (from MariaDB 10.4) that has no privileges.\n\nIf any of the specified accounts, or any permissions for the specified\naccounts, already exist, then the server returns ERROR 1396 (HY000). If an\nerror occurs, CREATE USER will still create the accounts that do not result in\nan error. Only one error is produced for all users which have not been created:\n\nERROR 1396 (HY000): \n Operation CREATE USER failed for \'u1\'@\'%\',\'u2\'@\'%\'\n\nCREATE USER, DROP USER, CREATE ROLE, and DROP ROLE all produce the same error\ncode when they fail.\n\nSee Account Names below for details on how account names are specified.\n\nOR REPLACE\n----------\n\nIf the optional OR REPLACE clause is used, it is basically a shortcut for:\n\nDROP USER IF EXISTS name;\nCREATE USER name ...;\n\nFor example:\n\nCREATE USER foo2@test IDENTIFIED BY \'password\';\nERROR 1396 (HY000): Operation CREATE USER failed for \'foo2\'@\'test\'\n\nCREATE OR REPLACE USER foo2@test IDENTIFIED BY \'password\';\nQuery OK, 0 rows affected (0.00 sec)\n\nIF NOT EXISTS\n-------------\n\nWhen the IF NOT EXISTS clause is used, MariaDB will return a warning instead\nof an error if the specified user already exists.\n\nFor example:\n\nCREATE USER foo2@test IDENTIFIED BY \'password\';\nERROR 1396 (HY000): Operation CREATE USER failed for \'foo2\'@\'test\'\n\nCREATE USER IF NOT EXISTS foo2@test IDENTIFIED BY \'password\';\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+-------+------+----------------------------------------------------+\n| Level | Code | Message |\n+-------+------+----------------------------------------------------+\n| Note | 1973 | Can\'t create user \'foo2\'@\'test\'; it already exists |\n+-------+------+----------------------------------------------------+\n\nAuthentication Options\n----------------------\n\nIDENTIFIED BY \'password\'\n------------------------\n\nThe optional IDENTIFIED BY clause can be used to provide an account with a\npassword. The password should be specified in plain text. It will be hashed by\nthe PASSWORD function prior to being stored in the\nmysql.user/mysql.global_priv_table table.\n\nFor example, if our password is mariadb, then we can create the user with:\n\nCREATE USER foo2@test IDENTIFIED BY \'mariadb\';\n\nIf you do not specify a password with the IDENTIFIED BY clause, the user will\nbe able to connect without a password. A blank password is not a wildcard to\nmatch any password. The user must connect without providing a password if no\npassword is set.\n\nThe only authentication plugins that this clause supports are\nmysql_native_password and mysql_old_password.\n\nIDENTIFIED BY PASSWORD \'password_hash\'\n--------------------------------------\n\nThe optional IDENTIFIED BY PASSWORD clause can be used to provide an account\nwith a password that has already been hashed. The password should be specified\nas a hash that was provided by the PASSWORD function. It will be stored in the\nmysql.user/mysql.global_priv_table table as-is.\n\nFor example, if our password is mariadb, then we can find the hash with:\n\nSELECT PASSWORD(\'mariadb\');\n+-------------------------------------------+\n| PASSWORD(\'mariadb\') |\n+-------------------------------------------+\n| *54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n1 row in set (0.00 sec)\n\nAnd then we can create a user with the hash:\n\nCREATE USER foo2@test IDENTIFIED BY PASSWORD\n\'*54958E764CE10E50764C2EECBB71D01F08549980\';\n\nIf you do not specify a password with the IDENTIFIED BY clause, the user will\nbe able to connect without a password. A blank password is not a wildcard to\nmatch any password. The user must connect without providing a password if no\npassword is set.\n\nThe only authentication plugins that this clause supports are\nmysql_native_password and mysql_old_password.\n\nIDENTIFIED {VIA|WITH} authentication_plugin\n-------------------------------------------\n\nThe optional IDENTIFIED VIA authentication_plugin allows you to specify that\nthe account should be authenticated by a specific authentication plugin. The\nplugin name must be an active authentication plugin as per SHOW PLUGINS. If it\ndoesn\'t show up in that output, then you will need to install it with INSTALL\nPLUGIN or INSTALL SONAME.\n\nFor example, this could be used with the PAM authentication plugin:\n\nCREATE USER foo2@test IDENTIFIED VIA pam;\n\nSome authentication plugins allow additional arguments to be specified after a\nUSING or AS keyword. For example, the PAM authentication plugin accepts a\nservice name:\n\nCREATE USER foo2@test IDENTIFIED VIA pam USING \'mariadb\';\n\nThe exact meaning of the additional argument would depend on the specific\nauthentication plugin.\n\nMariaDB starting with 10.4.0\n----------------------------\nThe USING or AS keyword can also be used to provide a plain-text password to a\nplugin if it\'s provided as an argument to the PASSWORD() function. This is\nonly valid for authentication plugins that have implemented a hook for the\nPASSWORD() function. For example, the ed25519 authentication plugin supports\nthis:\n\nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 USING PASSWORD(\'secret\');\n\nMariaDB starting with 10.4.3\n----------------------------\nOne can specify many authentication plugins, they all work as alternatives\nways of authenticating a user:\n\nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 USING PASSWORD(\'secret\') OR\nunix_socket;\n\nBy default, when you create a user without specifying an authentication\nplugin, MariaDB uses the mysql_native_password plugin.\n\nTLS Options\n-----------\n\nBy default, MariaDB transmits data between the server and clients without\nencrypting it. This is generally acceptable when the server and client run on\nthe same host or in networks where security is guaranteed through other means.\nHowever, in cases where the server and client exist on separate networks or\nthey are in a high-risk network, the lack of encryption does introduce\nsecurity concerns as a malicious actor could potentially eavesdrop on the\ntraffic as it is sent over the network between them.\n\nTo mitigate this concern, MariaDB allows you to encrypt data in transit\nbetween the server and clients using the Transport Layer Security (TLS)\nprotocol. TLS was formerly known as Secure Socket Layer (SSL), but strictly\nspeaking the SSL protocol is a predecessor to TLS and, that version of the\nprotocol is now considered insecure. The documentation still uses the term SSL\noften and for compatibility reasons TLS-related server system and status\nvariables still use the prefix ssl_, but internally, MariaDB only supports its\nsecure successors.\n\nSee Secure Connections Overview for more information about how to determine\nwhether your MariaDB server has TLS support.\n\nYou can set certain TLS-related restrictions for specific user accounts. For\ninstance, you might use this with user accounts that require access to\nsensitive data while sending it across networks that you do not control. These\nrestrictions can be enabled for a user account with the CREATE USER, ALTER\nUSER, or GRANT statements. The following options are available:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| REQUIRE NONE | TLS is not required for this account, but can |\n| | still be used. |\n+---------------------------+------------------------------------------------+\n| REQUIRE SSL | The account must use TLS, but no valid X509 |\n| | certificate is required. This option cannot |\n| | be combined with other TLS options. |\n+---------------------------+------------------------------------------------+\n| REQUIRE X509 | The account must use TLS and must have a |\n| | valid X509 certificate. This option implies |\n| | REQUIRE SSL. This option cannot be combined |\n| | with other TLS options. |\n+---------------------------+------------------------------------------------+\n| REQUIRE ISSUER \'issuer\' | The account must use TLS and must have a |\n| | valid X509 certificate. Also, the Certificate |\n| | Authority must be the one specified via the |\n| | string issuer. This option implies REQUIRE |\n| | X509. This option can be combined with the |\n| | SUBJECT, and CIPHER options in any order. |\n+---------------------------+------------------------------------------------+\n| REQUIRE SUBJECT \'subject\' | The account must use TLS and must have a |\n| | valid X509 certificate. Also, the |\n| | certificate\'s Subject must be the one |\n| | specified via the string subject. This option |\n| | implies REQUIRE X509. This option can be |\n| | combined with the ISSUER, and CIPHER options |\n| | in any order. |\n+---------------------------+------------------------------------------------+\n| REQUIRE CIPHER \'cipher\' | The account must use TLS, but no valid X509 |\n| | certificate is required. Also, the encryption |\n| | used for the connection must use a specific |\n| | cipher method specified in the string cipher. |\n| | This option implies REQUIRE SSL. This option |\n| | can be combined with the ISSUER, and SUBJECT |\n| | options in any order. |\n+---------------------------+------------------------------------------------+\n\nThe REQUIRE keyword must be used only once for all specified options, and the\nAND keyword can be used to separate individual options, but it is not required.\n\nFor example, you can create a user account that requires these TLS options\nwith the following:\n\nCREATE USER \'alice\'@\'%\'\n REQUIRE SUBJECT \'/CN=alice/O=My Dom, Inc./C=US/ST=Oregon/L=Portland\'\n AND ISSUER \'/C=FI/ST=Somewhere/L=City/ O=Some Company/CN=Peter\nParker/emailAddress=p.parker@marvel.com\'\n AND CIPHER \'SHA-DES-CBC3-EDH-RSA\';\n\nIf any of these options are set for a specific user account, then any client\nwho tries to connect with that user account will have to be configured to\nconnect with TLS.\n\nSee Securing Connections for Client and Server for information on how to\nenable TLS on the client and server.\n\nResource Limit Options\n----------------------\n\nIt is possible to set per-account limits for certain server resources. The\nfollowing table shows the values that can be set per account:\n\n+--------------------------------------+--------------------------------------+\n| Limit Type | Decription |\n+--------------------------------------+--------------------------------------+\n| MAX_QUERIES_PER_HOUR | Number of statements that the |\n| | account can issue per hour |\n| | (including updates) |\n+--------------------------------------+--------------------------------------+\n| MAX_UPDATES_PER_HOUR | Number of updates (not queries) |\n| | that the account can issue per hour |\n+--------------------------------------+--------------------------------------+\n| MAX_CONNECTIONS_PER_HOUR | Number of connections that the |\n| | account can start per hour |\n+--------------------------------------+--------------------------------------+\n| MAX_USER_CONNECTIONS | Number of simultaneous connections |\n| | that can be accepted from the same |\n| | account; if it is 0, |\n| | max_connections will be used |\n| | instead; if max_connections is 0, |\n| | there is no limit for this |\n| | account\'s simultaneous connections. |\n+--------------------------------------+--------------------------------------+\n| MAX_STATEMENT_TIME | Timeout, in seconds, for statements |','','https://mariadb.com/kb/en/create-user/'); +update help_topic set description = CONCAT(description, '\n| | executed by the user. See also |\n| | Aborting Statements that Exceed a |\n| | Certain Time to Execute. |\n+--------------------------------------+--------------------------------------+\n\nIf any of these limits are set to 0, then there is no limit for that resource\nfor that user.\n\nHere is an example showing how to create a user with resource limits:\n\nCREATE USER \'someone\'@\'localhost\' WITH\n MAX_USER_CONNECTIONS 10\n MAX_QUERIES_PER_HOUR 200;\n\nThe resources are tracked per account, which means \'user\'@\'server\'; not per\nuser name or per connection.\n\nThe count can be reset for all users using FLUSH USER_RESOURCES, FLUSH\nPRIVILEGES or mysqladmin reload.\n\nPer account resource limits are stored in the user table, in the mysql\ndatabase. Columns used for resources limits are named max_questions,\nmax_updates, max_connections (for MAX_CONNECTIONS_PER_HOUR), and\nmax_user_connections (for MAX_USER_CONNECTIONS).\n\nAccount Names\n-------------\n\nAccount names have both a user name component and a host name component, and\nare specified as \'user_name\'@\'host_name\'.\n\nThe user name and host name may be unquoted, quoted as strings using double\nquotes (\") or single quotes (\'), or quoted as identifiers using backticks (`).\nYou must use quotes when using special characters (such as a hyphen) or\nwildcard characters. If you quote, you must quote the user name and host name\nseparately (for example \'user_name\'@\'host_name\').\n\nHost Name Component\n-------------------\n\nIf the host name is not provided, it is assumed to be \'%\'.\n\nHost names may contain the wildcard characters % and _. They are matched as if\nby the LIKE clause. If you need to use a wildcard character literally (for\nexample, to match a domain name with an underscore), prefix the character with\na backslash. See LIKE for more information on escaping wildcard characters.\n\nHost name matches are case-insensitive. Host names can match either domain\nnames or IP addresses. Use \'localhost\' as the host name to allow only local\nclient connections.\n\nYou can use a netmask to match a range of IP addresses using \'base_ip/netmask\'\nas the host name. A user with an IP address ip_addr will be allowed to connect\nif the following condition is true:\n\nip_addr & netmask = base_ip\n\nFor example, given a user:\n\nCREATE USER \'maria\'@\'247.150.130.0/255.255.255.0\';\n\nthe IP addresses satisfying this condition range from 247.150.130.0 to\n247.150.130.255.\n\nUsing 255.255.255.255 is equivalent to not using a netmask at all. Netmasks\ncannot be used for IPv6 addresses.\n\nNote that the credentials added when creating a user with the \'%\' wildcard\nhost will not grant access in all cases. For example, some systems come with\nan anonymous localhost user, and when connecting from localhost this will take\nprecedence.\n\nBefore MariaDB 10.6, the host name component could be up to 60 characters in\nlength. Starting from MariaDB 10.6, it can be up to 255 characters.\n\nUser Name Component\n-------------------\n\nUser names must match exactly, including case. A user name that is empty is\nknown as an anonymous account and is allowed to match a login attempt with any\nuser name component. These are described more in the next section.\n\nFor valid identifiers to use as user names, see Identifier Names.\n\nIt is possible for more than one account to match when a user connects.\nMariaDB selects the first matching account after sorting according to the\nfollowing criteria:\n\n* Accounts with an exact host name are sorted before accounts using a wildcard\nin the\nhost name. Host names using a netmask are considered to be exact for sorting.\n* Accounts with a wildcard in the host name are sorted according to the\nposition of\nthe first wildcard character. Those with a wildcard character later in the\nhost name\nsort before those with a wildcard character earlier in the host name.\n* Accounts with a non-empty user name sort before accounts with an empty user\nname.\n* Accounts with an empty user name are sorted last. As mentioned previously,\nthese are known as anonymous accounts. These are described more in the next\nsection.\n\nThe following table shows a list of example account as sorted by these\ncriteria:\n\n+---------+-------------+\n| User | Host |\n+---------+-------------+\n| joffrey | 192.168.0.3 |\n| | 192.168.0.% |\n| joffrey | 192.168.% |\n| | 192.168.% |\n+---------+-------------+\n\nOnce connected, you only have the privileges granted to the account that\nmatched, not all accounts that could have matched. For example, consider the\nfollowing commands:\n\nCREATE USER \'joffrey\'@\'192.168.0.3\';\nCREATE USER \'joffrey\'@\'%\';\nGRANT SELECT ON test.t1 to \'joffrey\'@\'192.168.0.3\';\nGRANT SELECT ON test.t2 to \'joffrey\'@\'%\';\n\nIf you connect as joffrey from 192.168.0.3, you will have the SELECT privilege\non the table test.t1, but not on the table test.t2. If you connect as joffrey\nfrom any other IP address, you will have the SELECT privilege on the table\ntest.t2, but not on the table test.t1.\n\nUsernames can be up to 80 characters long before 10.6 and starting from 10.6\nit can be 128 characters long.\n\nAnonymous Accounts\n------------------\n\nAnonymous accounts are accounts where the user name portion of the account\nname is empty. These accounts act as special catch-all accounts. If a user\nattempts to log into the system from a host, and an anonymous account exists\nwith a host name portion that matches the user\'s host, then the user will log\nin as the anonymous account if there is no more specific account match for the\nuser name that the user entered.\n\nFor example, here are some anonymous accounts:\n\nCREATE USER \'\'@\'localhost\';\nCREATE USER \'\'@\'192.168.0.3\';\n\nFixing a Legacy Default Anonymous Account\n-----------------------------------------\n\nOn some systems, the mysql.db table has some entries for the \'\'@\'%\' anonymous\naccount by default. Unfortunately, there is no matching entry in the\nmysql.user/mysql.global_priv_table table, which means that this anonymous\naccount doesn\'t exactly exist, but it does have privileges--usually on the\ndefault test database created by mysql_install_db. These account-less\nprivileges are a legacy that is leftover from a time when MySQL\'s privilege\nsystem was less advanced.\n\nThis situation means that you will run into errors if you try to create a\n\'\'@\'%\' account. For example:\n\nCREATE USER \'\'@\'%\';\nERROR 1396 (HY000): Operation CREATE USER failed for \'\'@\'%\'\n\nThe fix is to DELETE the row in the mysql.db table and then execute FLUSH\nPRIVILEGES:\n\nDELETE FROM mysql.db WHERE User=\'\' AND Host=\'%\';\nFLUSH PRIVILEGES;\n\nAnd then the account can be created:\n\nCREATE USER \'\'@\'%\';\nQuery OK, 0 rows affected (0.01 sec)\n\nSee MDEV-13486 for more information.\n\nPassword Expiry\n---------------\n\nMariaDB starting with 10.4.3\n----------------------------\nBesides automatic password expiry, as determined by default_password_lifetime,\npassword expiry times can be set on an individual user basis, overriding the\nglobal setting, for example:\n\nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL 120 DAY;\n\nSee User Password Expiry for more details.\n\nAccount Locking\n---------------\n\nMariaDB starting with 10.4.2\n----------------------------\nAccount locking permits privileged administrators to lock/unlock user\naccounts. No new client connections will be permitted if an account is locked\n(existing connections are not affected). For example:\n\nCREATE USER \'marijn\'@\'localhost\' ACCOUNT LOCK;\n\nSee Account Locking for more details.\n\nFrom MariaDB 10.4.7 and MariaDB 10.5.8, the lock_option and password_option\nclauses can occur in either order.\n\nURL: https://mariadb.com/kb/en/create-user/') WHERE help_topic_id = 105; +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (106,10,'ALTER USER','Syntax\n------\n\nALTER USER [IF EXISTS] \n user_specification [,user_specification] ...\n [REQUIRE {NONE | tls_option [[AND] tls_option] ...}]\n [WITH resource_option [resource_option] ...]\n [lock_option] [password_option]\n\nuser_specification:\n username [authentication_option]\n\nauthentication_option:\n IDENTIFIED BY \'password\'\n | IDENTIFIED BY PASSWORD \'password_hash\'\n | IDENTIFIED {VIA|WITH} authentication_rule [OR authentication_rule] ...\n\nauthentication_rule:\n authentication_plugin\n | authentication_plugin {USING|AS} \'authentication_string\'\n | authentication_plugin {USING|AS} PASSWORD(\'password\')\n\ntls_option\n SSL\n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n\nresource_option\n MAX_QUERIES_PER_HOUR count\n | MAX_UPDATES_PER_HOUR count\n | MAX_CONNECTIONS_PER_HOUR count\n | MAX_USER_CONNECTIONS count\n | MAX_STATEMENT_TIME time\n\npassword_option:\n PASSWORD EXPIRE\n | PASSWORD EXPIRE DEFAULT\n | PASSWORD EXPIRE NEVER\n | PASSWORD EXPIRE INTERVAL N DAY\n\nlock_option:\n ACCOUNT LOCK\n | ACCOUNT UNLOCK\n}\n\nDescription\n-----------\n\nThe ALTER USER statement modifies existing MariaDB accounts. To use it, you\nmust have the global CREATE USER privilege or the UPDATE privilege for the\nmysql database. The global SUPER privilege is also required if the read_only\nsystem variable is enabled.\n\nIf any of the specified user accounts do not yet exist, an error results. If\nan error occurs, ALTER USER will still modify the accounts that do not result\nin an error. Only one error is produced for all users which have not been\nmodified.\n\nIF EXISTS\n---------\n\nWhen the IF EXISTS clause is used, MariaDB will return a warning instead of an\nerror for each specified user that does not exist.\n\nAccount Names\n-------------\n\nFor ALTER USER statements, account names are specified as the username\nargument in the same way as they are for CREATE USER statements. See account\nnames from the CREATE USER page for details on how account names are specified.\n\nCURRENT_USER or CURRENT_USER() can also be used to alter the account logged\ninto the current session. For example, to change the current user\'s password\nto mariadb:\n\nALTER USER CURRENT_USER() IDENTIFIED BY \'mariadb\';\n\nAuthentication Options\n----------------------\n\nMariaDB starting with 10.4\n--------------------------\nFrom MariaDB 10.4, it is possible to use more than one authentication plugin\nfor each user account. For example, this can be useful to slowly migrate users\nto the more secure ed25519 authentication plugin over time, while allowing the\nold mysql_native_password authentication plugin as an alternative for the\ntransitional period. See Authentication from MariaDB 10.4 for more.\n\nWhen running ALTER USER, not specifying an authentication option in the\nIDENTIFIED VIA clause will remove that authentication method. (However this\nwas not the case before MariaDB 10.4.13, see MDEV-21928)\n\nFor example, a user is created with the ability to authenticate via both a\npassword and unix_socket:\n\nCREATE USER \'bob\'@\'localhost\' \n IDENTIFIED VIA mysql_native_password USING PASSWORD(\'pwd\')\n OR unix_socket;\n\nSHOW CREATE USER \'bob\'@\'localhost\'\\G\n*************************** 1. row ***************************\nCREATE USER for bob@localhost: CREATE USER `bob`@`localhost` \n IDENTIFIED VIA mysql_native_password\n USING \'*975B2CD4FF9AE554FE8AD33168FBFC326D2021DD\'\n OR unix_socket\n\nIf the user\'s password is updated, but unix_socket authentication is not\nspecified in the IDENTIFIED VIA clause, unix_socket authentication will no\nlonger be permitted.\n\nALTER USER \'bob\'@\'localhost\' IDENTIFIED VIA mysql_native_password \n USING PASSWORD(\'pwd2\');\n\nSHOW CREATE USER \'bob\'@\'localhost\'\\G\n*************************** 1. row ***************************\nCREATE USER for bob@localhost: CREATE USER `bob`@`localhost` \n IDENTIFIED BY PASSWORD \'*38366FDA01695B6A5A9DD4E428D9FB8F7EB75512\'\n\nIDENTIFIED BY \'password\'\n------------------------\n\nThe optional IDENTIFIED BY clause can be used to provide an account with a\npassword. The password should be specified in plain text. It will be hashed by\nthe PASSWORD function prior to being stored to the mysql.user table.\n\nFor example, if our password is mariadb, then we can set the account\'s\npassword with:\n\nALTER USER foo2@test IDENTIFIED BY \'mariadb\';\n\nIf you do not specify a password with the IDENTIFIED BY clause, the user will\nbe able to connect without a password. A blank password is not a wildcard to\nmatch any password. The user must connect without providing a password if no\npassword is set.\n\nThe only authentication plugins that this clause supports are\nmysql_native_password and mysql_old_password.\n\nIDENTIFIED BY PASSWORD \'password_hash\'\n--------------------------------------\n\nThe optional IDENTIFIED BY PASSWORD clause can be used to provide an account\nwith a password that has already been hashed. The password should be specified\nas a hash that was provided by the PASSWORD#function. It will be stored to the\nmysql.user table as-is.\n\nFor example, if our password is mariadb, then we can find the hash with:\n\nSELECT PASSWORD(\'mariadb\');\n+-------------------------------------------+\n| PASSWORD(\'mariadb\') |\n+-------------------------------------------+\n| *54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n\nAnd then we can set an account\'s password with the hash:\n\nALTER USER foo2@test \n IDENTIFIED BY PASSWORD \'*54958E764CE10E50764C2EECBB71D01F08549980\';\n\nIf you do not specify a password with the IDENTIFIED BY clause, the user will\nbe able to connect without a password. A blank password is not a wildcard to\nmatch any password. The user must connect without providing a password if no\npassword is set.\n\nThe only authentication plugins that this clause supports are\nmysql_native_password and mysql_old_password.\n\nIDENTIFIED {VIA|WITH} authentication_plugin\n-------------------------------------------\n\nThe optional IDENTIFIED VIA authentication_plugin allows you to specify that\nthe account should be authenticated by a specific authentication plugin. The\nplugin name must be an active authentication plugin as per SHOW PLUGINS. If it\ndoesn\'t show up in that output, then you will need to install it with INSTALL\nPLUGIN or INSTALL SONAME.\n\nFor example, this could be used with the PAM authentication plugin:\n\nALTER USER foo2@test IDENTIFIED VIA pam;\n\nSome authentication plugins allow additional arguments to be specified after a\nUSING or AS keyword. For example, the PAM authentication plugin accepts a\nservice name:\n\nALTER USER foo2@test IDENTIFIED VIA pam USING \'mariadb\';\n\nThe exact meaning of the additional argument would depend on the specific\nauthentication plugin.\n\nIn MariaDB 10.4 and later, the USING or AS keyword can also be used to provide\na plain-text password to a plugin if it\'s provided as an argument to the\nPASSWORD() function. This is only valid for authentication plugins that have\nimplemented a hook for the PASSWORD() function. For example, the ed25519\nauthentication plugin supports this:\n\nALTER USER safe@\'%\' IDENTIFIED VIA ed25519 USING PASSWORD(\'secret\');\n\nTLS Options\n-----------\n\nBy default, MariaDB transmits data between the server and clients without\nencrypting it. This is generally acceptable when the server and client run on\nthe same host or in networks where security is guaranteed through other means.\nHowever, in cases where the server and client exist on separate networks or\nthey are in a high-risk network, the lack of encryption does introduce\nsecurity concerns as a malicious actor could potentially eavesdrop on the\ntraffic as it is sent over the network between them.\n\nTo mitigate this concern, MariaDB allows you to encrypt data in transit\nbetween the server and clients using the Transport Layer Security (TLS)\nprotocol. TLS was formerly known as Secure Socket Layer (SSL), but strictly\nspeaking the SSL protocol is a predecessor to TLS and, that version of the\nprotocol is now considered insecure. The documentation still uses the term SSL\noften and for compatibility reasons TLS-related server system and status\nvariables still use the prefix ssl_, but internally, MariaDB only supports its\nsecure successors.\n\nSee Secure Connections Overview for more information about how to determine\nwhether your MariaDB server has TLS support.\n\nYou can set certain TLS-related restrictions for specific user accounts. For\ninstance, you might use this with user accounts that require access to\nsensitive data while sending it across networks that you do not control. These\nrestrictions can be enabled for a user account with the CREATE USER, ALTER\nUSER, or GRANT statements. The following options are available:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| REQUIRE NONE | TLS is not required for this account, but can |\n| | still be used. |\n+---------------------------+------------------------------------------------+\n| REQUIRE SSL | The account must use TLS, but no valid X509 |\n| | certificate is required. This option cannot |\n| | be combined with other TLS options. |\n+---------------------------+------------------------------------------------+\n| REQUIRE X509 | The account must use TLS and must have a |\n| | valid X509 certificate. This option implies |\n| | REQUIRE SSL. This option cannot be combined |\n| | with other TLS options. |\n+---------------------------+------------------------------------------------+\n| REQUIRE ISSUER \'issuer\' | The account must use TLS and must have a |\n| | valid X509 certificate. Also, the Certificate |\n| | Authority must be the one specified via the |\n| | string issuer. This option implies REQUIRE |\n| | X509. This option can be combined with the |\n| | SUBJECT, and CIPHER options in any order. |\n+---------------------------+------------------------------------------------+\n| REQUIRE SUBJECT \'subject\' | The account must use TLS and must have a |\n| | valid X509 certificate. Also, the |\n| | certificate\'s Subject must be the one |\n| | specified via the string subject. This option |\n| | implies REQUIRE X509. This option can be |\n| | combined with the ISSUER, and CIPHER options |\n| | in any order. |\n+---------------------------+------------------------------------------------+\n| REQUIRE CIPHER \'cipher\' | The account must use TLS, but no valid X509 |\n| | certificate is required. Also, the encryption |\n| | used for the connection must use a specific |\n| | cipher method specified in the string cipher. |\n| | This option implies REQUIRE SSL. This option |\n| | can be combined with the ISSUER, and SUBJECT |\n| | options in any order. |\n+---------------------------+------------------------------------------------+\n\nThe REQUIRE keyword must be used only once for all specified options, and the\nAND keyword can be used to separate individual options, but it is not required.\n\nFor example, you can alter a user account to require these TLS options with\nthe following:\n\nALTER USER \'alice\'@\'%\'\n REQUIRE SUBJECT \'/CN=alice/O=My Dom, Inc./C=US/ST=Oregon/L=Portland\' AND\n ISSUER \'/C=FI/ST=Somewhere/L=City/ O=Some Company/CN=Peter\nParker/emailAddress=p.parker@marvel.com\'\n AND CIPHER \'SHA-DES-CBC3-EDH-RSA\';\n\nIf any of these options are set for a specific user account, then any client\nwho tries to connect with that user account will have to be configured to\nconnect with TLS.\n\nSee Securing Connections for Client and Server for information on how to\nenable TLS on the client and server.\n\nResource Limit Options\n----------------------\n\nIt is possible to set per-account limits for certain server resources. The\nfollowing table shows the values that can be set per account:\n\n+------------------------------------+---------------------------------------+\n| Limit Type | Description |\n+------------------------------------+---------------------------------------+\n| MAX_QUERIES_PER_HOUR | Number of statements that the |\n| | account can issue per hour |\n| | (including updates) |\n+------------------------------------+---------------------------------------+\n| MAX_UPDATES_PER_HOUR | Number of updates (not queries) that |\n| | the account can issue per hour |\n+------------------------------------+---------------------------------------+\n| MAX_CONNECTIONS_PER_HOUR | Number of connections that the |\n| | account can start per hour |\n+------------------------------------+---------------------------------------+\n| MAX_USER_CONNECTIONS | Number of simultaneous connections |\n| | that can be accepted from the same |\n| | account; if it is 0, max_connections |\n| | will be used instead; if |\n| | max_connections is 0, there is no |\n| | limit for this account\'s |\n| | simultaneous connections. |','','https://mariadb.com/kb/en/alter-user/'); +update help_topic set description = CONCAT(description, '\n+------------------------------------+---------------------------------------+\n| MAX_STATEMENT_TIME | Timeout, in seconds, for statements |\n| | executed by the user. See also |\n| | Aborting Statements that Exceed a |\n| | Certain Time to Execute. |\n+------------------------------------+---------------------------------------+\n\nIf any of these limits are set to 0, then there is no limit for that resource\nfor that user.\n\nHere is an example showing how to set an account\'s resource limits:\n\nALTER USER \'someone\'@\'localhost\' WITH\n MAX_USER_CONNECTIONS 10\n MAX_QUERIES_PER_HOUR 200;\n\nThe resources are tracked per account, which means \'user\'@\'server\'; not per\nuser name or per connection.\n\nThe count can be reset for all users using FLUSH USER_RESOURCES, FLUSH\nPRIVILEGES or mysqladmin reload.\n\nPer account resource limits are stored in the user table, in the mysql\ndatabase. Columns used for resources limits are named max_questions,\nmax_updates, max_connections (for MAX_CONNECTIONS_PER_HOUR), and\nmax_user_connections (for MAX_USER_CONNECTIONS).\n\nPassword Expiry\n---------------\n\nMariaDB starting with 10.4.3\n----------------------------\nBesides automatic password expiry, as determined by default_password_lifetime,\npassword expiry times can be set on an individual user basis, overriding the\nglobal setting, for example:\n\nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL 120 DAY;\nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE NEVER;\nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n\nSee User Password Expiry for more details.\n\nAccount Locking\n---------------\n\nMariaDB starting with 10.4.2\n----------------------------\nAccount locking permits privileged administrators to lock/unlock user\naccounts. No new client connections will be permitted if an account is locked\n(existing connections are not affected). For example:\n\nALTER USER \'marijn\'@\'localhost\' ACCOUNT LOCK;\n\nSee Account Locking for more details.\n\nFrom MariaDB 10.4.7 and MariaDB 10.5.8, the lock_option and password_option\nclauses can occur in either order.\n\nURL: https://mariadb.com/kb/en/alter-user/') WHERE help_topic_id = 106; +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (107,10,'DROP USER','Syntax\n------\n\nDROP USER [IF EXISTS] user_name [, user_name] ...\n\nDescription\n-----------\n\nThe DROP USER statement removes one or more MariaDB accounts. It removes\nprivilege rows for the account from all grant tables. To use this statement,\nyou must have the global CREATE USER privilege or the DELETE privilege for the\nmysql database. Each account is named using the same format as for the CREATE\nUSER statement; for example, \'jeffrey\'@\'localhost\'. If you specify only the\nuser name part of the account name, a host name part of \'%\' is used. For\nadditional information about specifying account names, see CREATE USER.\n\nNote that, if you specify an account that is currently connected, it will not\nbe deleted until the connection is closed. The connection will not be\nautomatically closed.\n\nIf any of the specified user accounts do not exist, ERROR 1396 (HY000)\nresults. If an error occurs, DROP USER will still drop the accounts that do\nnot result in an error. Only one error is produced for all users which have\nnot been dropped:\n\nERROR 1396 (HY000): Operation DROP USER failed for \'u1\'@\'%\',\'u2\'@\'%\'\n\nFailed CREATE or DROP operations, for both users and roles, produce the same\nerror code.\n\nIF EXISTS\n---------\n\nIf the IF EXISTS clause is used, MariaDB will return a note instead of an\nerror if the user does not exist.\n\nExamples\n--------\n\nDROP USER bob;\n\nDROP USER foo2@localhost,foo2@\'127.%\';\n\nIF EXISTS:\n\nDROP USER bob;\nERROR 1396 (HY000): Operation DROP USER failed for \'bob\'@\'%\'\n\nDROP USER IF EXISTS bob;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+-------+------+---------------------------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------------------------+\n| Note | 1974 | Can\'t drop user \'bob\'@\'%\'; it doesn\'t exist |\n+-------+------+---------------------------------------------+\n\nURL: https://mariadb.com/kb/en/drop-user/','','https://mariadb.com/kb/en/drop-user/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (108,10,'GRANT','Syntax\n------\n\nGRANT\n priv_type [(column_list)]\n [, priv_type [(column_list)]] ...\n ON [object_type] priv_level\n TO user_specification [ user_options ...]\n\nuser_specification:\n username [authentication_option]\n | PUBLIC\nauthentication_option:\n IDENTIFIED BY \'password\'\n | IDENTIFIED BY PASSWORD \'password_hash\'\n | IDENTIFIED {VIA|WITH} authentication_rule [OR authentication_rule ...]\n\nauthentication_rule:\n authentication_plugin\n | authentication_plugin {USING|AS} \'authentication_string\'\n | authentication_plugin {USING|AS} PASSWORD(\'password\')\n\nGRANT PROXY ON username\n TO user_specification [, user_specification ...]\n [WITH GRANT OPTION]\n\nGRANT rolename TO grantee [, grantee ...]\n [WITH ADMIN OPTION]\n\ngrantee:\n rolename\n username [authentication_option]\n\nuser_options:\n [REQUIRE {NONE | tls_option [[AND] tls_option] ...}]\n [WITH with_option [with_option] ...]\n\nobject_type:\n TABLE\n | FUNCTION\n | PROCEDURE\n | PACKAGE\n\npriv_level:\n *\n | *.*\n | db_name.*\n | db_name.tbl_name\n | tbl_name\n | db_name.routine_name\n\nwith_option:\n GRANT OPTION\n | resource_option\n\nresource_option:\n MAX_QUERIES_PER_HOUR count\n | MAX_UPDATES_PER_HOUR count\n | MAX_CONNECTIONS_PER_HOUR count\n | MAX_USER_CONNECTIONS count\n | MAX_STATEMENT_TIME time\n\ntls_option:\n SSL\n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n\nDescription\n-----------\n\nThe GRANT statement allows you to grant privileges or roles to accounts. To\nuse GRANT, you must have the GRANT OPTION privilege, and you must have the\nprivileges that you are granting.\n\nUse the REVOKE statement to revoke privileges granted with the GRANT statement.\n\nUse the SHOW GRANTS statement to determine what privileges an account has.\n\nAccount Names\n-------------\n\nFor GRANT statements, account names are specified as the username argument in\nthe same way as they are for CREATE USER statements. See account names from\nthe CREATE USER page for details on how account names are specified.\n\nImplicit Account Creation\n-------------------------\n\nThe GRANT statement also allows you to implicitly create accounts in some\ncases.\n\nIf the account does not yet exist, then GRANT can implicitly create it. To\nimplicitly create an account with GRANT, a user is required to have the same\nprivileges that would be required to explicitly create the account with the\nCREATE USER statement.\n\nIf the NO_AUTO_CREATE_USER SQL_MODE is set, then accounts can only be created\nif authentication information is specified, or with a CREATE USER statement.\nIf no authentication information is provided, GRANT will produce an error when\nthe specified account does not exist, for example:\n\nshow variables like \'%sql_mode%\' ;\n+---------------+--------------------------------------------+\n| Variable_name | Value |\n+---------------+--------------------------------------------+\n| sql_mode | NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |\n+---------------+--------------------------------------------+\n\nGRANT USAGE ON *.* TO \'user123\'@\'%\' IDENTIFIED BY \'\';\nERROR 1133 (28000): Can\'t find any matching row in the user table\n\nGRANT USAGE ON *.* TO \'user123\'@\'%\' \n IDENTIFIED VIA PAM using \'mariadb\' require ssl ;\nQuery OK, 0 rows affected (0.00 sec)\n\nselect host, user from mysql.user where user=\'user123\' ;\n\n+------+----------+\n| host | user |\n+------+----------+\n| % | user123 |\n+------+----------+\n\nPrivilege Levels\n----------------\n\nPrivileges can be set globally, for an entire database, for a table or\nroutine, or for individual columns in a table. Certain privileges can only be\nset at certain levels.\n\n* Global privileges priv_type are granted using *.* for\npriv_level. Global privileges include privileges to administer the database\nand manage user accounts, as well as privileges for all tables, functions, and\nprocedures. Global privileges are stored in the mysql.user table prior to\nMariaDB 10.4, and in mysql.global_priv table afterwards.\n* Database privileges priv_type are granted using db_name.*\nfor priv_level, or using just * to use default database. Database\nprivileges include privileges to create tables and functions, as well as\nprivileges for all tables, functions, and procedures in the database. Database\nprivileges are stored in the mysql.db table.\n* Table privileges priv_type are granted using db_name.tbl_name\nfor priv_level, or using just tbl_name to specify a table in the default\ndatabase. The TABLE keyword is optional. Table privileges include the\nability to select and change data in the table. Certain table privileges can\nbe granted for individual columns.\n* Column privileges priv_type are granted by specifying a table for\npriv_level and providing a column list after the privilege type. They allow\nyou to control exactly which columns in a table users can select and change.\n* Function privileges priv_type are granted using FUNCTION db_name.routine_name\nfor priv_level, or using just FUNCTION routine_name to specify a function\nin the default database.\n* Procedure privileges priv_type are granted using PROCEDURE\ndb_name.routine_name\nfor priv_level, or using just PROCEDURE routine_name to specify a procedure\nin the default database.\n\nThe USAGE Privilege\n-------------------\n\nThe USAGE privilege grants no real privileges. The SHOW GRANTS statement will\nshow a global USAGE privilege for a newly-created user. You can use USAGE with\nthe GRANT statement to change options like GRANT OPTION and\nMAX_USER_CONNECTIONS without changing any account privileges.\n\nThe ALL PRIVILEGES Privilege\n----------------------------\n\nThe ALL PRIVILEGES privilege grants all available privileges. Granting all\nprivileges only affects the given privilege level. For example, granting all\nprivileges on a table does not grant any privileges on the database or\nglobally.\n\nUsing ALL PRIVILEGES does not grant the special GRANT OPTION privilege.\n\nYou can use ALL instead of ALL PRIVILEGES.\n\nThe GRANT OPTION Privilege\n--------------------------\n\nUse the WITH GRANT OPTION clause to give users the ability to grant privileges\nto other users at the given privilege level. Users with the GRANT OPTION\nprivilege can only grant privileges they have. They cannot grant privileges at\na higher privilege level than they have the GRANT OPTION privilege.\n\nThe GRANT OPTION privilege cannot be set for individual columns. If you use\nWITH GRANT OPTION when specifying column privileges, the GRANT OPTION\nprivilege will be granted for the entire table.\n\nUsing the WITH GRANT OPTION clause is equivalent to listing GRANT OPTION as a\nprivilege.\n\nGlobal Privileges\n-----------------\n\nThe following table lists the privileges that can be granted globally. You can\nalso grant all database, table, and function privileges globally. When granted\nglobally, these privileges apply to all databases, tables, or functions,\nincluding those created later.\n\nTo set a global privilege, use *.* for priv_level.\n\nBINLOG ADMIN\n------------\n\nEnables administration of the binary log, including the PURGE BINARY LOGS\nstatement and setting the system variables:\n\n* binlog_annotate_row_events\n* binlog_cache_size\n* binlog_commit_wait_count\n* binlog_commit_wait_usec\n* binlog_direct_non_transactional_updates\n* binlog_expire_logs_seconds\n* binlog_file_cache_size\n* binlog_format\n* binlog_row_image\n* binlog_row_metadata\n* binlog_stmt_cache_size\n* expire_logs_days\n* log_bin_compress\n* log_bin_compress_min_len\n* log_bin_trust_function_creators\n* max_binlog_cache_size\n* max_binlog_size\n* max_binlog_stmt_cache_size\n* sql_log_bin and\n* sync_binlog.\n\nAdded in MariaDB 10.5.2.\n\nBINLOG MONITOR\n--------------\n\nNew name for REPLICATION CLIENT from MariaDB 10.5.2, (REPLICATION CLIENT still\nsupported as an alias for compatibility purposes). Permits running SHOW\ncommands related to the binary log, in particular the SHOW BINLOG STATUS and\nSHOW BINARY LOGS statements. Unlike REPLICATION CLIENT prior to MariaDB 10.5,\nSHOW REPLICA STATUS isn\'t included in this privilege, and REPLICA MONITOR is\nrequired.\n\nBINLOG REPLAY\n-------------\n\nEnables replaying the binary log with the BINLOG statement (generated by\nmariadb-binlog), executing SET timestamp when secure_timestamp is set to\nreplication, and setting the session values of system variables usually\nincluded in BINLOG output, in particular:\n\n* gtid_domain_id\n* gtid_seq_no\n* pseudo_thread_id\n* server_id.\n\nAdded in MariaDB 10.5.2\n\nCONNECTION ADMIN\n----------------\n\nEnables administering connection resource limit options. This includes\nignoring the limits specified by:\n\n* max_connections\n* max_user_connections and\n* max_password_errors.\n\nThe statements specified in init_connect are not executed, killing connections\nand queries owned by other users is permitted. The following\nconnection-related system variables can be changed:\n\n* connect_timeout\n* disconnect_on_expired_password\n* extra_max_connections\n* init_connect\n* max_connections\n* max_connect_errors\n* max_password_errors\n* proxy_protocol_networks\n* secure_auth\n* slow_launch_time\n* thread_pool_exact_stats\n* thread_pool_dedicated_listener\n* thread_pool_idle_timeout\n* thread_pool_max_threads\n* thread_pool_min_threads\n* thread_pool_oversubscribe\n* thread_pool_prio_kickup_timer\n* thread_pool_priority\n* thread_pool_size, and\n* thread_pool_stall_limit.\n\nAdded in MariaDB 10.5.2.\n\nCREATE USER\n-----------\n\nCreate a user using the CREATE USER statement, or implicitly create a user\nwith the GRANT statement.\n\nFEDERATED ADMIN\n---------------\n\nExecute CREATE SERVER, ALTER SERVER, and DROP SERVER statements. Added in\nMariaDB 10.5.2.\n\nFILE\n----\n\nRead and write files on the server, using statements like LOAD DATA INFILE or\nfunctions like LOAD_FILE(). Also needed to create CONNECT outward tables.\nMariaDB server must have the permissions to access those files.\n\nGRANT OPTION\n------------\n\nGrant global privileges. You can only grant privileges that you have.\n\nPROCESS\n-------\n\nShow information about the active processes, for example via SHOW PROCESSLIST\nor mysqladmin processlist. If you have the PROCESS privilege, you can see all\nthreads. Otherwise, you can see only your own threads (that is, threads\nassociated with the MariaDB account that you are using).\n\nREAD_ONLY ADMIN\n---------------\n\nUser can set the read_only system variable and allows the user to perform\nwrite operations, even when the read_only option is active. Added in MariaDB\n10.5.2.\n\nFrom MariaDB 10.11.0, the READ_ONLY ADMIN privilege has been removed from\nSUPER. The benefit of this is that one can remove the READ_ONLY ADMIN\nprivilege from all users and ensure that no one can make any changes on any\nnon-temporary tables. This is useful on replicas when one wants to ensure that\nthe replica is kept identical to the primary.\n\nRELOAD\n------\n\nExecute FLUSH statements or equivalent mariadb-admin/mysqladmin commands.\n\nREPLICATION CLIENT\n------------------\n\nExecute SHOW MASTER STATUS and SHOW BINARY LOGS informative statements.\nRenamed to BINLOG MONITOR in MariaDB 10.5.2 (but still supported as an alias\nfor compatibility reasons). SHOW SLAVE STATUS was part of REPLICATION CLIENT\nprior to MariaDB 10.5.\n\nREPLICATION MASTER ADMIN\n------------------------\n\nPermits administration of primary servers, including the SHOW REPLICA HOSTS\nstatement, and setting the gtid_binlog_state, gtid_domain_id,\nmaster_verify_checksum and server_id system variables. Added in MariaDB 10.5.2.\n\nREPLICA MONITOR\n---------------\n\nPermit SHOW REPLICA STATUS and SHOW RELAYLOG EVENTS. From MariaDB 10.5.9.\n\nWhen a user would upgrade from an older major release to a MariaDB 10.5 minor\nrelease prior to MariaDB 10.5.9, certain user accounts would lose\ncapabilities. For example, a user account that had the REPLICATION CLIENT\nprivilege in older major releases could run SHOW REPLICA STATUS, but after\nupgrading to a MariaDB 10.5 minor release prior to MariaDB 10.5.9, they could\nno longer run SHOW REPLICA STATUS, because that statement was changed to\nrequire the REPLICATION REPLICA ADMIN privilege.\n\nThis issue is fixed in MariaDB 10.5.9 with this new privilege, which now\ngrants the user the ability to execute SHOW [ALL] (SLAVE | REPLICA) STATUS.\n\nWhen a database is upgraded from an older major release to MariaDB Server\n10.5.9 or later, any user accounts with the REPLICATION CLIENT or REPLICATION\nSLAVE privileges will automatically be granted the new REPLICA MONITOR\nprivilege. The privilege fix occurs when the server is started up, not when\nmariadb-upgrade is performed.\n\nHowever, when a database is upgraded from an early 10.5 minor release to\n10.5.9 and later, the user will have to fix any user account privileges\nmanually.\n\nREPLICATION REPLICA\n-------------------\n\nSynonym for REPLICATION SLAVE. From MariaDB 10.5.1.\n\nREPLICATION SLAVE\n-----------------\n\nAccounts used by replica servers on the primary need this privilege. This is\nneeded to get the updates made on the master. From MariaDB 10.5.1, REPLICATION\nREPLICA is an alias for REPLICATION SLAVE.\n\nREPLICATION SLAVE ADMIN\n-----------------------\n\nPermits administering replica servers, including START REPLICA/SLAVE, STOP\nREPLICA/SLAVE, CHANGE MASTER, SHOW REPLICA/SLAVE STATUS, SHOW RELAYLOG EVENTS\nstatements, replaying the binary log with the BINLOG statement (generated by\nmariadb-binlog), and setting the system variables:\n\n* gtid_cleanup_batch_size\n* gtid_ignore_duplicates\n* gtid_pos_auto_engines\n* gtid_slave_pos\n* gtid_strict_mode\n* init_slave\n* read_binlog_speed_limit\n* relay_log_purge\n* relay_log_recovery\n* replicate_do_db\n* replicate_do_table\n* replicate_events_marked_for_skip\n* replicate_ignore_db\n* replicate_ignore_table\n* replicate_wild_do_table\n* replicate_wild_ignore_table\n* slave_compressed_protocol\n* slave_ddl_exec_mode\n* slave_domain_parallel_threads\n* slave_exec_mode\n* slave_max_allowed_packet\n* slave_net_timeout\n* slave_parallel_max_queued\n* slave_parallel_mode\n* slave_parallel_threads\n* slave_parallel_workers\n* slave_run_triggers_for_rbr\n* slave_sql_verify_checksum\n* slave_transaction_retry_interval\n* slave_type_conversions\n* sync_master_info\n* sync_relay_log, and\n* sync_relay_log_info.\n\nAdded in MariaDB 10.5.2.\n\nSET USER\n--------\n','','https://mariadb.com/kb/en/grant/'); +update help_topic set description = CONCAT(description, '\nEnables setting the DEFINER when creating triggers, views, stored functions\nand stored procedures. Added in MariaDB 10.5.2.\n\nSHOW DATABASES\n--------------\n\nList all databases using the SHOW DATABASES statement. Without the SHOW\nDATABASES privilege, you can still issue the SHOW DATABASES statement, but it\nwill only list databases containing tables on which you have privileges.\n\nSHUTDOWN\n--------\n\nShut down the server using SHUTDOWN or the mysqladmin shutdown command.\n\nSUPER\n-----\n\nExecute superuser statements: CHANGE MASTER TO, KILL (users who do not have\nthis privilege can only KILL their own threads), PURGE LOGS, SET global system\nvariables, or the mysqladmin debug command. Also, this permission allows the\nuser to write data even if the read_only startup option is set, enable or\ndisable logging, enable or disable replication on replica, specify a DEFINER\nfor statements that support that clause, connect once reaching the\nMAX_CONNECTIONS. If a statement has been specified for the init-connect mysqld\noption, that command will not be executed when a user with SUPER privileges\nconnects to the server.\n\nThe SUPER privilege has been split into multiple smaller privileges from\nMariaDB 10.5.2 to allow for more fine-grained privileges, although it remains\nan alias for these smaller privileges.\n\nFrom MariaDB 10.11.0, the READ_ONLY ADMIN privilege has been removed from\nSUPER. The benefit of this is that one can remove the READ_ONLY ADMIN\nprivilege from all users and ensure that no one can make any changes on any\nnon-temporary tables. This is useful on replicas when one wants to ensure that\nthe replica is kept identical to the primary.\n\nDatabase Privileges\n-------------------\n\nThe following table lists the privileges that can be granted at the database\nlevel. You can also grant all table and function privileges at the database\nlevel. Table and function privileges on a database apply to all tables or\nfunctions in that database, including those created later.\n\nTo set a privilege for a database, specify the database using db_name.* for\npriv_level, or just use * to specify the default database.\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |\n+----------------------------------+-----------------------------------------+\n| CREATE | Create a database using the CREATE |\n| | DATABASE statement, when the privilege |\n| | is granted for a database. You can |\n| | grant the CREATE privilege on |\n| | databases that do not yet exist. This |\n| | also grants the CREATE privilege on |\n| | all tables in the database. |\n+----------------------------------+-----------------------------------------+\n| CREATE ROUTINE | Create Stored Programs using the |\n| | CREATE PROCEDURE and CREATE FUNCTION |\n| | statements. |\n+----------------------------------+-----------------------------------------+\n| CREATE TEMPORARY TABLES | Create temporary tables with the |\n| | CREATE TEMPORARY TABLE statement. This |\n| | privilege enable writing and dropping |\n| | those temporary tables |\n+----------------------------------+-----------------------------------------+\n| DROP | Drop a database using the DROP |\n| | DATABASE statement, when the privilege |\n| | is granted for a database. This also |\n| | grants the DROP privilege on all |\n| | tables in the database. |\n+----------------------------------+-----------------------------------------+\n| EVENT | Create, drop and alter EVENTs. |\n+----------------------------------+-----------------------------------------+\n| GRANT OPTION | Grant database privileges. You can |\n| | only grant privileges that you have. |\n+----------------------------------+-----------------------------------------+\n| LOCK TABLES | Acquire explicit locks using the LOCK |\n| | TABLES statement; you also need to |\n| | have the SELECT privilege on a table, |\n| | in order to lock it. |\n+----------------------------------+-----------------------------------------+\n\nTable Privileges\n----------------\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |\n+----------------------------------+-----------------------------------------+\n| ALTER | Change the structure of an existing |\n| | table using the ALTER TABLE statement. |\n+----------------------------------+-----------------------------------------+\n| CREATE | Create a table using the CREATE TABLE |\n| | statement. You can grant the CREATE |\n| | privilege on tables that do not yet |\n| | exist. |\n+----------------------------------+-----------------------------------------+\n| CREATE VIEW | Create a view using the CREATE_VIEW |\n| | statement. |\n+----------------------------------+-----------------------------------------+\n| DELETE | Remove rows from a table using the |\n| | DELETE statement. |\n+----------------------------------+-----------------------------------------+\n| DELETE HISTORY | Remove historical rows from a table |\n| | using the DELETE HISTORY statement. |\n| | Displays as DELETE VERSIONING ROWS |\n| | when running SHOW GRANTS until MariaDB |\n| | 10.3.15 and until MariaDB 10.4.5 |\n| | (MDEV-17655), or when running SHOW |\n| | PRIVILEGES until MariaDB 10.5.2, |\n| | MariaDB 10.4.13 and MariaDB 10.3.23 |\n| | (MDEV-20382). From MariaDB 10.3.4. |\n| | From MariaDB 10.3.5, if a user has the |\n| | SUPER privilege but not this |\n| | privilege, running mysql_upgrade will |\n| | grant this privilege as well. |\n+----------------------------------+-----------------------------------------+\n| DROP | Drop a table using the DROP TABLE |\n| | statement or a view using the DROP |\n| | VIEW statement. Also required to |\n| | execute the TRUNCATE TABLE statement. |\n+----------------------------------+-----------------------------------------+\n| GRANT OPTION | Grant table privileges. You can only |\n| | grant privileges that you have. |\n+----------------------------------+-----------------------------------------+\n| INDEX | Create an index on a table using the |\n| | CREATE INDEX statement. Without the |\n| | INDEX privilege, you can still create |\n| | indexes when creating a table using |\n| | the CREATE TABLE statement if the you |\n| | have the CREATE privilege, and you can |\n| | create indexes using the ALTER TABLE |\n| | statement if you have the ALTER |\n| | privilege. |\n+----------------------------------+-----------------------------------------+\n| INSERT | Add rows to a table using the INSERT |\n| | statement. The INSERT privilege can |\n| | also be set on individual columns; see |\n| | Column Privileges below for details. |\n+----------------------------------+-----------------------------------------+\n| REFERENCES | Unused. |\n+----------------------------------+-----------------------------------------+\n| SELECT | Read data from a table using the |\n| | SELECT statement. The SELECT privilege |\n| | can also be set on individual columns; |\n| | see Column Privileges below for |\n| | details. |\n+----------------------------------+-----------------------------------------+\n| SHOW VIEW | Show the CREATE VIEW statement to |\n| | create a view using the SHOW CREATE |\n| | VIEW statement. |\n+----------------------------------+-----------------------------------------+\n| TRIGGER | Execute triggers associated to tables |\n| | you update, execute the CREATE TRIGGER |\n| | and DROP TRIGGER statements. You will |\n| | still be able to see triggers. |\n+----------------------------------+-----------------------------------------+\n| UPDATE | Update existing rows in a table using |\n| | the UPDATE statement. UPDATE |\n| | statements usually include a WHERE |\n| | clause to update only certain rows. |\n| | You must have SELECT privileges on the |\n| | table or the appropriate columns for |\n| | the WHERE clause. The UPDATE privilege |\n| | can also be set on individual columns; |\n| | see Column Privileges below for |\n| | details. |\n+----------------------------------+-----------------------------------------+\n\nColumn Privileges\n-----------------\n\nSome table privileges can be set for individual columns of a table. To use\ncolumn privileges, specify the table explicitly and provide a list of column\nnames after the privilege type. For example, the following statement would\nallow the user to read the names and positions of employees, but not other\ninformation from the same table, such as salaries.\n\nGRANT SELECT (name, position) on Employee to \'jeffrey\'@\'localhost\';\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |\n+----------------------------------+-----------------------------------------+\n| INSERT (column_list) | Add rows specifying values in columns |\n| | using the INSERT statement. If you |\n| | only have column-level INSERT |\n| | privileges, you must specify the |\n| | columns you are setting in the INSERT |\n| | statement. All other columns will be |\n| | set to their default values, or NULL. |\n+----------------------------------+-----------------------------------------+\n| REFERENCES (column_list) | Unused. |\n+----------------------------------+-----------------------------------------+\n| SELECT (column_list) | Read values in columns using the |\n| | SELECT statement. You cannot access or |\n| | query any columns for which you do not |\n| | have SELECT privileges, including in |\n| | WHERE, ON, GROUP BY, and ORDER BY |\n| | clauses. |\n+----------------------------------+-----------------------------------------+\n| UPDATE (column_list) | Update values in columns of existing |\n| | rows using the UPDATE statement. |\n| | UPDATE statements usually include a |\n| | WHERE clause to update only certain |\n| | rows. You must have SELECT privileges |\n| | on the table or the appropriate |\n| | columns for the WHERE clause. |\n+----------------------------------+-----------------------------------------+\n\nFunction Privileges\n-------------------\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |') WHERE help_topic_id = 108; +update help_topic set description = CONCAT(description, '\n+----------------------------------+-----------------------------------------+\n| ALTER ROUTINE | Change the characteristics of a stored |\n| | function using the ALTER FUNCTION |\n| | statement. |\n+----------------------------------+-----------------------------------------+\n| EXECUTE | Use a stored function. You need SELECT |\n| | privileges for any tables or columns |\n| | accessed by the function. |\n+----------------------------------+-----------------------------------------+\n| GRANT OPTION | Grant function privileges. You can |\n| | only grant privileges that you have. |\n+----------------------------------+-----------------------------------------+\n\nProcedure Privileges\n--------------------\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |\n+----------------------------------+-----------------------------------------+\n| ALTER ROUTINE | Change the characteristics of a stored |\n| | procedure using the ALTER PROCEDURE |\n| | statement. |\n+----------------------------------+-----------------------------------------+\n| EXECUTE | Execute a stored procedure using the |\n| | CALL statement. The privilege to call |\n| | a procedure may allow you to perform |\n| | actions you wouldn\'t otherwise be able |\n| | to do, such as insert rows into a |\n| | table. |\n+----------------------------------+-----------------------------------------+\n| GRANT OPTION | Grant procedure privileges. You can |\n| | only grant privileges that you have. |\n+----------------------------------+-----------------------------------------+\n\nGRANT EXECUTE ON PROCEDURE mysql.create_db TO maintainer;\n\nProxy Privileges\n----------------\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |\n+----------------------------------+-----------------------------------------+\n| PROXY | Permits one user to be a proxy for |\n| | another. |\n+----------------------------------+-----------------------------------------+\n\nThe PROXY privilege allows one user to proxy as another user, which means\ntheir privileges change to that of the proxy user, and the CURRENT_USER()\nfunction returns the user name of the proxy user.\n\nThe PROXY privilege only works with authentication plugins that support it.\nThe default mysql_native_password authentication plugin does not support proxy\nusers.\n\nThe pam authentication plugin is the only plugin included with MariaDB that\ncurrently supports proxy users. The PROXY privilege is commonly used with the\npam authentication plugin to enable user and group mapping with PAM.\n\nFor example, to grant the PROXY privilege to an anonymous account that\nauthenticates with the pam authentication plugin, you could execute the\nfollowing:\n\nCREATE USER \'dba\'@\'%\' IDENTIFIED BY \'strongpassword\';\nGRANT ALL PRIVILEGES ON *.* TO \'dba\'@\'%\' ;\n\nCREATE USER \'\'@\'%\' IDENTIFIED VIA pam USING \'mariadb\';\nGRANT PROXY ON \'dba\'@\'%\' TO \'\'@\'%\';\n\nA user account can only grant the PROXY privilege for a specific user account\nif the granter also has the PROXY privilege for that specific user account,\nand if that privilege is defined WITH GRANT OPTION. For example, the following\nexample fails because the granter does not have the PROXY privilege for that\nspecific user account at all:\n\nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n\nSHOW GRANTS;\n+------------------------------------------------------------------------------\n----------------------------------------+\n| Grants for alice@localhost \n |\n+------------------------------------------------------------------------------\n----------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\' IDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' |\n+------------------------------------------------------------------------------\n----------------------------------------+\n\nGRANT PROXY ON \'dba\'@\'localhost\' TO \'bob\'@\'localhost\';\nERROR 1698 (28000): Access denied for user \'alice\'@\'localhost\'\n\nAnd the following example fails because the granter does have the PROXY\nprivilege for that specific user account, but it is not defined WITH GRANT\nOPTION:\n\nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n\nSHOW GRANTS;\n+------------------------------------------------------------------------------\n----------------------------------------+\n| Grants for alice@localhost \n |\n+------------------------------------------------------------------------------\n----------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\' IDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' |\n| GRANT PROXY ON \'dba\'@\'localhost\' TO \'alice\'@\'localhost\' \n |\n+------------------------------------------------------------------------------\n----------------------------------------+\n\nGRANT PROXY ON \'dba\'@\'localhost\' TO \'bob\'@\'localhost\';\nERROR 1698 (28000): Access denied for user \'alice\'@\'localhost\'\n\nBut the following example succeeds because the granter does have the PROXY\nprivilege for that specific user account, and it is defined WITH GRANT OPTION:\n\nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n\nSHOW GRANTS;\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n| Grants for alice@localhost \n |\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\' IDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' WITH GRANT OPTION |\n| GRANT PROXY ON \'dba\'@\'localhost\' TO \'alice\'@\'localhost\' WITH GRANT OPTION \n |\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n\nGRANT PROXY ON \'dba\'@\'localhost\' TO \'bob\'@\'localhost\';\n\nA user account can grant the PROXY privilege for any other user account if the\ngranter has the PROXY privilege for the \'\'@\'%\' anonymous user account, like\nthis:\n\nGRANT PROXY ON \'\'@\'%\' TO \'dba\'@\'localhost\' WITH GRANT OPTION;\n\nFor example, the following example succeeds because the user can grant the\nPROXY privilege for any other user account:\n\nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n\nSHOW GRANTS;\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n| Grants for alice@localhost \n |\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\' IDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' WITH GRANT OPTION |\n| GRANT PROXY ON \'\'@\'%\' TO \'alice\'@\'localhost\' WITH GRANT OPTION \n |\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n\nGRANT PROXY ON \'app1_dba\'@\'localhost\' TO \'bob\'@\'localhost\';\nQuery OK, 0 rows affected (0.004 sec)\n\nGRANT PROXY ON \'app2_dba\'@\'localhost\' TO \'carol\'@\'localhost\';\nQuery OK, 0 rows affected (0.004 sec)\n\nThe default root user accounts created by mysql_install_db have this\nprivilege. For example:\n\nGRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH GRANT OPTION;\nGRANT PROXY ON \'\'@\'%\' TO \'root\'@\'localhost\' WITH GRANT OPTION;\n\nThis allows the default root user accounts to grant the PROXY privilege for\nany other user account, and it also allows the default root user accounts to\ngrant others the privilege to do the same.\n\nAuthentication Options\n----------------------\n\nThe authentication options for the GRANT statement are the same as those for\nthe CREATE USER statement.\n\nIDENTIFIED BY \'password\'\n------------------------\n\nThe optional IDENTIFIED BY clause can be used to provide an account with a\npassword. The password should be specified in plain text. It will be hashed by\nthe PASSWORD function prior to being stored.\n\nFor example, if our password is mariadb, then we can create the user with:\n\nGRANT USAGE ON *.* TO foo2@test IDENTIFIED BY \'mariadb\';\n\nIf you do not specify a password with the IDENTIFIED BY clause, the user will\nbe able to connect without a password. A blank password is not a wildcard to\nmatch any password. The user must connect without providing a password if no\npassword is set.\n\nIf the user account already exists and if you provide the IDENTIFIED BY\nclause, then the user\'s password will be changed. You must have the privileges\nneeded for the SET PASSWORD statement to change a user\'s password with GRANT.\n\nThe only authentication plugins that this clause supports are\nmysql_native_password and mysql_old_password.\n\nIDENTIFIED BY PASSWORD \'password_hash\'\n--------------------------------------\n\nThe optional IDENTIFIED BY PASSWORD clause can be used to provide an account\nwith a password that has already been hashed. The password should be specified\nas a hash that was provided by the PASSWORD function. It will be stored as-is.\n\nFor example, if our password is mariadb, then we can find the hash with:\n\nSELECT PASSWORD(\'mariadb\');\n+-------------------------------------------+\n| PASSWORD(\'mariadb\') |\n+-------------------------------------------+\n| *54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n1 row in set (0.00 sec)\n\nAnd then we can create a user with the hash:\n\nGRANT USAGE ON *.* TO foo2@test IDENTIFIED BY \n PASSWORD \'*54958E764CE10E50764C2EECBB71D01F08549980\';\n\nIf you do not specify a password with the IDENTIFIED BY clause, the user will\nbe able to connect without a password. A blank password is not a wildcard to\nmatch any password. The user must connect without providing a password if no\npassword is set.\n\nIf the user account already exists and if you provide the IDENTIFIED BY\nclause, then the user\'s password will be changed. You must have the privileges\nneeded for the SET PASSWORD statement to change a user\'s password with GRANT.\n\nThe only authentication plugins that this clause supports are\nmysql_native_password and mysql_old_password.\n\nIDENTIFIED {VIA|WITH} authentication_plugin\n-------------------------------------------\n\nThe optional IDENTIFIED VIA authentication_plugin allows you to specify that\nthe account should be authenticated by a specific authentication plugin. The\nplugin name must be an active authentication plugin as per SHOW PLUGINS. If it\ndoesn\'t show up in that output, then you will need to install it with INSTALL\nPLUGIN or INSTALL SONAME.\n\nFor example, this could be used with the PAM authentication plugin:\n\nGRANT USAGE ON *.* TO foo2@test IDENTIFIED VIA pam;\n\nSome authentication plugins allow additional arguments to be specified after a\nUSING or AS keyword. For example, the PAM authentication plugin accepts a\nservice name:\n\nGRANT USAGE ON *.* TO foo2@test IDENTIFIED VIA pam USING \'mariadb\';\n\nThe exact meaning of the additional argument would depend on the specific\nauthentication plugin.\n\nMariaDB starting with 10.4.0\n----------------------------\nThe USING or AS keyword can also be used to provide a plain-text password to a\nplugin if it\'s provided as an argument to the PASSWORD() function. This is\nonly valid for authentication plugins that have implemented a hook for the\nPASSWORD() function. For example, the ed25519 authentication plugin supports\nthis:\n\nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 \n USING PASSWORD(\'secret\');\n\nMariaDB starting with 10.4.3\n----------------------------\nOne can specify many authentication plugins, they all work as alternatives\nways of authenticating a user:\n\nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 \n USING PASSWORD(\'secret\') OR unix_socket;\n\nBy default, when you create a user without specifying an authentication\nplugin, MariaDB uses the mysql_native_password plugin.\n\nResource Limit Options\n----------------------\n\nIt is possible to set per-account limits for certain server resources. The\nfollowing table shows the values that can be set per account:\n\n+--------------------------------------+--------------------------------------+') WHERE help_topic_id = 108; +update help_topic set description = CONCAT(description, '\n| Limit Type | Decription |\n+--------------------------------------+--------------------------------------+\n| MAX_QUERIES_PER_HOUR | Number of statements that the |\n| | account can issue per hour |\n| | (including updates) |\n+--------------------------------------+--------------------------------------+\n| MAX_UPDATES_PER_HOUR | Number of updates (not queries) |\n| | that the account can issue per hour |\n+--------------------------------------+--------------------------------------+\n| MAX_CONNECTIONS_PER_HOUR | Number of connections that the |\n| | account can start per hour |\n+--------------------------------------+--------------------------------------+\n| MAX_USER_CONNECTIONS | Number of simultaneous connections |\n| | that can be accepted from the same |\n| | account; if it is 0, |\n| | max_connections will be used |\n| | instead; if max_connections is 0, |\n| | there is no limit for this |\n| | account\'s simultaneous connections. |\n+--------------------------------------+--------------------------------------+\n| MAX_STATEMENT_TIME | Timeout, in seconds, for statements |\n| | executed by the user. See also |\n| | Aborting Statements that Exceed a |\n| | Certain Time to Execute. |\n+--------------------------------------+--------------------------------------+\n\nIf any of these limits are set to 0, then there is no limit for that resource\nfor that user.\n\nTo set resource limits for an account, if you do not want to change that\naccount\'s privileges, you can issue a GRANT statement with the USAGE\nprivilege, which has no meaning. The statement can name some or all limit\ntypes, in any order.\n\nHere is an example showing how to set resource limits:\n\nGRANT USAGE ON *.* TO \'someone\'@\'localhost\' WITH\n MAX_USER_CONNECTIONS 0\n MAX_QUERIES_PER_HOUR 200;\n\nThe resources are tracked per account, which means \'user\'@\'server\'; not per\nuser name or per connection.\n\nThe count can be reset for all users using FLUSH USER_RESOURCES, FLUSH\nPRIVILEGES or mysqladmin reload.\n\nUsers with the CONNECTION ADMIN privilege (in MariaDB 10.5.2 and later) or the\nSUPER privilege are not restricted by max_user_connections, max_connections,\nor max_password_errors.\n\nPer account resource limits are stored in the user table, in the mysql\ndatabase. Columns used for resources limits are named max_questions,\nmax_updates, max_connections (for MAX_CONNECTIONS_PER_HOUR), and\nmax_user_connections (for MAX_USER_CONNECTIONS).\n\nTLS Options\n-----------\n\nBy default, MariaDB transmits data between the server and clients without\nencrypting it. This is generally acceptable when the server and client run on\nthe same host or in networks where security is guaranteed through other means.\nHowever, in cases where the server and client exist on separate networks or\nthey are in a high-risk network, the lack of encryption does introduce\nsecurity concerns as a malicious actor could potentially eavesdrop on the\ntraffic as it is sent over the network between them.\n\nTo mitigate this concern, MariaDB allows you to encrypt data in transit\nbetween the server and clients using the Transport Layer Security (TLS)\nprotocol. TLS was formerly known as Secure Socket Layer (SSL), but strictly\nspeaking the SSL protocol is a predecessor to TLS and, that version of the\nprotocol is now considered insecure. The documentation still uses the term SSL\noften and for compatibility reasons TLS-related server system and status\nvariables still use the prefix ssl_, but internally, MariaDB only supports its\nsecure successors.\n\nSee Secure Connections Overview for more information about how to determine\nwhether your MariaDB server has TLS support.\n\nYou can set certain TLS-related restrictions for specific user accounts. For\ninstance, you might use this with user accounts that require access to\nsensitive data while sending it across networks that you do not control. These\nrestrictions can be enabled for a user account with the CREATE USER, ALTER\nUSER, or GRANT statements. The following options are available:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| REQUIRE NONE | TLS is not required for this account, but can |\n| | still be used. |\n+---------------------------+------------------------------------------------+\n| REQUIRE SSL | The account must use TLS, but no valid X509 |\n| | certificate is required. This option cannot |\n| | be combined with other TLS options. |\n+---------------------------+------------------------------------------------+\n| REQUIRE X509 | The account must use TLS and must have a |\n| | valid X509 certificate. This option implies |\n| | REQUIRE SSL. This option cannot be combined |\n| | with other TLS options. |\n+---------------------------+------------------------------------------------+\n| REQUIRE ISSUER \'issuer\' | The account must use TLS and must have a |\n| | valid X509 certificate. Also, the Certificate |\n| | Authority must be the one specified via the |\n| | string issuer. This option implies REQUIRE |\n| | X509. This option can be combined with the |\n| | SUBJECT, and CIPHER options in any order. |\n+---------------------------+------------------------------------------------+\n| REQUIRE SUBJECT \'subject\' | The account must use TLS and must have a |\n| | valid X509 certificate. Also, the |\n| | certificate\'s Subject must be the one |\n| | specified via the string subject. This option |\n| | implies REQUIRE X509. This option can be |\n| | combined with the ISSUER, and CIPHER options |\n| | in any order. |\n+---------------------------+------------------------------------------------+\n| REQUIRE CIPHER \'cipher\' | The account must use TLS, but no valid X509 |\n| | certificate is required. Also, the encryption |\n| | used for the connection must use a specific |\n| | cipher method specified in the string cipher. |\n| | This option implies REQUIRE SSL. This option |\n| | can be combined with the ISSUER, and SUBJECT |\n| | options in any order. |\n+---------------------------+------------------------------------------------+\n\nThe REQUIRE keyword must be used only once for all specified options, and the\nAND keyword can be used to separate individual options, but it is not required.\n\nFor example, you can create a user account that requires these TLS options\nwith the following:\n\nGRANT USAGE ON *.* TO \'alice\'@\'%\'\n REQUIRE SUBJECT \'/CN=alice/O=My Dom, Inc./C=US/ST=Oregon/L=Portland\'\n AND ISSUER \'/C=FI/ST=Somewhere/L=City/ O=Some Company/CN=Peter\nParker/emailAddress=p.parker@marvel.com\'\n AND CIPHER \'SHA-DES-CBC3-EDH-RSA\';\n\nIf any of these options are set for a specific user account, then any client\nwho tries to connect with that user account will have to be configured to\nconnect with TLS.\n\nSee Securing Connections for Client and Server for information on how to\nenable TLS on the client and server.\n\nRoles\n-----\n\nSyntax\n------\n\nGRANT role TO grantee [, grantee ... ]\n[ WITH ADMIN OPTION ]\n\ngrantee:\n rolename\n username [authentication_option]\n\nThe GRANT statement is also used to grant the use of a role to one or more\nusers or other roles. In order to be able to grant a role, the grantor doing\nso must have permission to do so (see WITH ADMIN in the CREATE ROLE article).\n\nSpecifying the WITH ADMIN OPTION permits the grantee to in turn grant the role\nto another.\n\nFor example, the following commands show how to grant the same role to a\ncouple different users.\n\nGRANT journalist TO hulda;\n\nGRANT journalist TO berengar WITH ADMIN OPTION;\n\nIf a user has been granted a role, they do not automatically obtain all\npermissions associated with that role. These permissions are only in use when\nthe user activates the role with the SET ROLE statement.\n\nTO PUBLIC\n---------\n\nMariaDB starting with 10.11\n---------------------------\n\nSyntax\n------\n\nGRANT ON . TO PUBLIC;\nREVOKE ON . FROM PUBLIC;\n\nGRANT ... TO PUBLIC grants privileges to all users with access to the server.\nThe privileges also apply to users created after the privileges are granted.\nThis can be useful when one only wants to state once that all users need to\nhave a certain set of privileges.\n\nWhen running SHOW GRANTS, a user will also see all privileges inherited from\nPUBLIC. SHOW GRANTS FOR PUBLIC will only show TO PUBLIC grants.\n\nGrant Examples\n--------------\n\nGranting Root-like Privileges\n-----------------------------\n\nYou can create a user that has privileges similar to the default root accounts\nby executing the following:\n\nCREATE USER \'alexander\'@\'localhost\';\nGRANT ALL PRIVILEGES ON *.* to \'alexander\'@\'localhost\' WITH GRANT OPTION;\n\nURL: https://mariadb.com/kb/en/grant/') WHERE help_topic_id = 108; +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (109,10,'RENAME USER','Syntax\n------\n\nRENAME USER old_user TO new_user\n [, old_user TO new_user] ...\n\nDescription\n-----------\n\nThe RENAME USER statement renames existing MariaDB accounts. To use it, you\nmust have the global CREATE USER privilege or the UPDATE privilege for the\nmysql database. Each account is named using the same format as for the CREATE\nUSER statement; for example, \'jeffrey\'@\'localhost\'. If you specify only the\nuser name part of the account name, a host name part of \'%\' is used.\n\nIf any of the old user accounts do not exist or any of the new user accounts\nalready exist, ERROR 1396 (HY000) results. If an error occurs, RENAME USER\nwill still rename the accounts that do not result in an error.\n\nExamples\n--------\n\nCREATE USER \'donald\', \'mickey\';\nRENAME USER \'donald\' TO \'duck\'@\'localhost\', \'mickey\' TO \'mouse\'@\'localhost\';\n\nURL: https://mariadb.com/kb/en/rename-user/','','https://mariadb.com/kb/en/rename-user/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (110,10,'REVOKE','Privileges\n----------\n\nSyntax\n------\n\nREVOKE \n priv_type [(column_list)]\n [, priv_type [(column_list)]] ...\n ON [object_type] priv_level\n FROM user [, user] ...\n\nREVOKE ALL PRIVILEGES, GRANT OPTION\n FROM user [, user] ...\n\nDescription\n-----------\n\nThe REVOKE statement enables system administrators to revoke privileges (or\nroles - see section below) from MariaDB accounts. Each account is named using\nthe same format as for the GRANT statement; for example,\n\'jeffrey\'@\'localhost\'. If you specify only the user name part of the account\nname, a host name part of \'%\' is used. For details on the levels at which\nprivileges exist, the allowable priv_type and priv_level values, and the\nsyntax for specifying users and passwords, see GRANT.\n\nTo use the first REVOKE syntax, you must have the GRANT OPTION privilege, and\nyou must have the privileges that you are revoking.\n\nTo revoke all privileges, use the second syntax, which drops all global,\ndatabase, table, column, and routine privileges for the named user or users:\n\nREVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...\n\nTo use this REVOKE syntax, you must have the global CREATE USER privilege or\nthe UPDATE privilege for the mysql database. See GRANT.\n\nExamples\n--------\n\nREVOKE SUPER ON *.* FROM \'alexander\'@\'localhost\';\n\nRoles\n-----\n\nSyntax\n------\n\nREVOKE role [, role ...]\n FROM grantee [, grantee2 ... ]\n\nREVOKE ADMIN OPTION FOR role FROM grantee [, grantee2]\n\nDescription\n-----------\n\nREVOKE is also used to remove a role from a user or another role that it\'s\npreviously been assigned to. If a role has previously been set as a default\nrole, REVOKE does not remove the record of the default role from the\nmysql.user table. If the role is subsequently granted again, it will again be\nthe user\'s default. Use SET DEFAULT ROLE NONE to explicitly remove this.\n\nBefore MariaDB 10.1.13, the REVOKE role statement was not permitted in\nprepared statements.\n\nExample\n-------\n\nREVOKE journalist FROM hulda\n\nURL: https://mariadb.com/kb/en/revoke/','','https://mariadb.com/kb/en/revoke/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (111,10,'SET PASSWORD','Syntax\n------\n\nSET PASSWORD [FOR user] =\n {\n PASSWORD(\'some password\')\n | OLD_PASSWORD(\'some password\')\n | \'encrypted password\'\n }\n\nDescription\n-----------\n\nThe SET PASSWORD statement assigns a password to an existing MariaDB user\naccount.\n\nIf the password is specified using the PASSWORD() or OLD_PASSWORD() function,\nthe literal text of the password should be given. If the password is specified\nwithout using either function, the password should be the already-encrypted\npassword value as returned by PASSWORD().\n\nOLD_PASSWORD() should only be used if your MariaDB/MySQL clients are very old\n(< 4.0.0).\n\nWith no FOR clause, this statement sets the password for the current user. Any\nclient that has connected to the server using a non-anonymous account can\nchange the password for that account.\n\nWith a FOR clause, this statement sets the password for a specific account on\nthe current server host. Only clients that have the UPDATE privilege for the\nmysql database can do this. The user value should be given in\nuser_name@host_name format, where user_name and host_name are exactly as they\nare listed in the User and Host columns of the mysql.user table (or view in\nMariaDB-10.4 onwards) entry.\n\nThe argument to PASSWORD() and the password given to MariaDB clients can be of\narbitrary length.\n\nAuthentication Plugin Support\n-----------------------------\n\nMariaDB starting with 10.4\n--------------------------\nIn MariaDB 10.4 and later, SET PASSWORD (with or without PASSWORD()) works for\naccounts authenticated via any authentication plugin that supports passwords\nstored in the mysql.global_priv table.\n\nThe ed25519, mysql_native_password, and mysql_old_password authentication\nplugins store passwords in the mysql.global_priv table.\n\nIf you run SET PASSWORD on an account that authenticates with one of these\nauthentication plugins that stores passwords in the mysql.global_priv table,\nthen the PASSWORD() function is evaluated by the specific authentication\nplugin used by the account. The authentication plugin hashes the password with\na method that is compatible with that specific authentication plugin.\n\nThe unix_socket, named_pipe, gssapi, and pam authentication plugins do not\nstore passwords in the mysql.global_priv table. These authentication plugins\nrely on other methods to authenticate the user.\n\nIf you attempt to run SET PASSWORD on an account that authenticates with one\nof these authentication plugins that doesn\'t store a password in the\nmysql.global_priv table, then MariaDB Server will raise a warning like the\nfollowing:\n\nSET PASSWORD is ignored for users authenticating via unix_socket plugin\n\nSee Authentication from MariaDB 10.4 for an overview of authentication changes\nin MariaDB 10.4.\n\nMariaDB until 10.3\n------------------\nIn MariaDB 10.3 and before, SET PASSWORD (with or without PASSWORD()) only\nworks for accounts authenticated via mysql_native_password or\nmysql_old_password authentication plugins\n\nPasswordless User Accounts\n--------------------------\n\nUser accounts do not always require passwords to login.\n\nThe unix_socket , named_pipe and gssapi authentication plugins do not require\na password to authenticate the user.\n\nThe pam authentication plugin may or may not require a password to\nauthenticate the user, depending on the specific configuration.\n\nThe mysql_native_password and mysql_old_password authentication plugins\nrequire passwords for authentication, but the password can be blank. In that\ncase, no password is required.\n\nIf you provide a password while attempting to log into the server as an\naccount that doesn\'t require a password, then MariaDB server will simply\nignore the password.\n\nMariaDB starting with 10.4\n--------------------------\nIn MariaDB 10.4 and later, a user account can be defined to use multiple\nauthentication plugins in a specific order of preference. This specific\nscenario may be more noticeable in these versions, since an account could be\nassociated with some authentication plugins that require a password, and some\nthat do not.\n\nExample\n-------\n\nFor example, if you had an entry with User and Host column values of \'bob\' and\n\'%.loc.gov\', you would write the statement like this:\n\nSET PASSWORD FOR \'bob\'@\'%.loc.gov\' = PASSWORD(\'newpass\');\n\nIf you want to delete a password for a user, you would do:\n\nSET PASSWORD FOR \'bob\'@localhost = PASSWORD(\"\");\n\nURL: https://mariadb.com/kb/en/set-password/','','https://mariadb.com/kb/en/set-password/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (112,10,'CREATE ROLE','Syntax\n------\n\nCREATE [OR REPLACE] ROLE [IF NOT EXISTS] role \n [WITH ADMIN\n {CURRENT_USER | CURRENT_ROLE | user | role}]\n\nDescription\n-----------\n\nThe CREATE ROLE statement creates one or more MariaDB roles. To use it, you\nmust have the global CREATE USER privilege or the INSERT privilege for the\nmysql database. For each account, CREATE ROLE creates a new row in the\nmysql.user table that has no privileges, and with the corresponding is_role\nfield set to Y. It also creates a record in the mysql.roles_mapping table.\n\nIf any of the specified roles already exist, ERROR 1396 (HY000) results. If an\nerror occurs, CREATE ROLE will still create the roles that do not result in an\nerror. The maximum length for a role is 128 characters. Role names can be\nquoted, as explained in the Identifier names page. Only one error is produced\nfor all roles which have not been created:\n\nERROR 1396 (HY000): Operation CREATE ROLE failed for \'a\',\'b\',\'c\'\n\nFailed CREATE or DROP operations, for both users and roles, produce the same\nerror code.\n\nPUBLIC and NONE are reserved, and cannot be used as role names. NONE is used\nto unset a role and PUBLIC has a special use in other systems, such as Oracle,\nso is reserved for compatibility purposes.\n\nFor valid identifiers to use as role names, see Identifier Names.\n\nWITH ADMIN\n----------\n\nThe optional WITH ADMIN clause determines whether the current user, the\ncurrent role or another user or role has use of the newly created role. If the\nclause is omitted, WITH ADMIN CURRENT_USER is treated as the default, which\nmeans that the current user will be able to GRANT this role to users.\n\nOR REPLACE\n----------\n\nIf the optional OR REPLACE clause is used, it acts as a shortcut for:\n\nDROP ROLE IF EXISTS name;\nCREATE ROLE name ...;\n\nIF NOT EXISTS\n-------------\n\nWhen the IF NOT EXISTS clause is used, MariaDB will return a warning instead\nof an error if the specified role already exists. Cannot be used together with\nthe OR REPLACE clause.\n\nExamples\n--------\n\nCREATE ROLE journalist;\n\nCREATE ROLE developer WITH ADMIN lorinda@localhost;\n\nGranting the role to another user. Only user lorinda@localhost has permission\nto grant the developer role:\n\nSELECT USER();\n+-------------------+\n| USER() |\n+-------------------+\n| henning@localhost |\n+-------------------+\n...\nGRANT developer TO ian@localhost;\nAccess denied for user \'henning\'@\'localhost\'\n\nSELECT USER();\n+-------------------+\n| USER() |\n+-------------------+\n| lorinda@localhost |\n+-------------------+\n\nGRANT m_role TO ian@localhost;\n\nThe OR REPLACE and IF NOT EXISTS clauses. The journalist role already exists:\n\nCREATE ROLE journalist;\nERROR 1396 (HY000): Operation CREATE ROLE failed for \'journalist\'\n\nCREATE OR REPLACE ROLE journalist;\nQuery OK, 0 rows affected (0.00 sec)\n\nCREATE ROLE IF NOT EXISTS journalist;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+-------+------+---------------------------------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------------------------------+\n| Note | 1975 | Can\'t create role \'journalist\'; it already exists |\n+-------+------+---------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/create-role/','','https://mariadb.com/kb/en/create-role/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (113,10,'DROP ROLE','Syntax\n------\n\nDROP ROLE [IF EXISTS] role_name [,role_name ...]\n\nDescription\n-----------\n\nThe DROP ROLE statement removes one or more MariaDB roles. To use this\nstatement, you must have the global CREATE USER privilege or the DELETE\nprivilege for the mysql database.\n\nDROP ROLE does not disable roles for connections which selected them with SET\nROLE. If a role has previously been set as a default role, DROP ROLE does not\nremove the record of the default role from the mysql.user table. If the role\nis subsequently recreated and granted, it will again be the user\'s default.\nUse SET DEFAULT ROLE NONE to explicitly remove this.\n\nIf any of the specified user accounts do not exist, ERROR 1396 (HY000)\nresults. If an error occurs, DROP ROLE will still drop the roles that do not\nresult in an error. Only one error is produced for all roles which have not\nbeen dropped:\n\nERROR 1396 (HY000): Operation DROP ROLE failed for \'a\',\'b\',\'c\'\n\nFailed CREATE or DROP operations, for both users and roles, produce the same\nerror code.\n\nIF EXISTS\n---------\n\nIf the IF EXISTS clause is used, MariaDB will return a warning instead of an\nerror if the role does not exist.\n\nExamples\n--------\n\nDROP ROLE journalist;\n\nThe same thing using the optional IF EXISTS clause:\n\nDROP ROLE journalist;\nERROR 1396 (HY000): Operation DROP ROLE failed for \'journalist\'\n\nDROP ROLE IF EXISTS journalist;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nNote (Code 1975): Can\'t drop role \'journalist\'; it doesn\'t exist\n\nURL: https://mariadb.com/kb/en/drop-role/','','https://mariadb.com/kb/en/drop-role/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (114,10,'SET ROLE','Syntax\n------\n\nSET ROLE { role | NONE }\n\nDescription\n-----------\n\nThe SET ROLE statement enables a role, along with all of its associated\npermissions, for the current session. To unset a role, use NONE .\n\nIf a role that doesn\'t exist, or to which the user has not been assigned, is\nspecified, an ERROR 1959 (OP000): Invalid role specification error occurs.\n\nAn automatic SET ROLE is implicitly performed when a user connects if that\nuser has been assigned a default role. See SET DEFAULT ROLE.\n\nExample\n-------\n\nSELECT CURRENT_ROLE;\n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n\nSET ROLE staff;\n\nSELECT CURRENT_ROLE;\n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| staff |\n+--------------+\n\nSET ROLE NONE;\n\nSELECT CURRENT_ROLE();\n+----------------+\n| CURRENT_ROLE() |\n+----------------+\n| NULL |\n+----------------+\n\nURL: https://mariadb.com/kb/en/set-role/','','https://mariadb.com/kb/en/set-role/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (115,10,'SET DEFAULT ROLE','Syntax\n------\n\nSET DEFAULT ROLE { role | NONE } [ FOR user@host ]\n\nDescription\n-----------\n\nThe SET DEFAULT ROLE statement sets a default role for a specified (or\ncurrent) user. A default role is automatically enabled when a user connects\n(an implicit SET ROLE statement is executed immediately after a connection is\nestablished).\n\nTo be able to set a role as a default, the role must already have been granted\nto that user, and one needs the privileges to enable this role (if you cannot\ndo SET ROLE X, you won\'t be able to do SET DEFAULT ROLE X). To set a default\nrole for another user one needs to have write access to the mysql database.\n\nTo remove a user\'s default role, use SET DEFAULT ROLE NONE [ FOR user@host ].\nThe record of the default role is not removed if the role is dropped or\nrevoked, so if the role is subsequently re-created or granted, it will again\nbe the user\'s default role.\n\nThe default role is stored in the default_role column in the mysql.user\ntable/view, as well as in the Information Schema APPLICABLE_ROLES table, so\nthese can be viewed to see which role has been assigned to a user as the\ndefault.\n\nExamples\n--------\n\nSetting a default role for the current user:\n\nSET DEFAULT ROLE journalist;\n\nRemoving a default role from the current user:\n\nSET DEFAULT ROLE NONE;\n\nSetting a default role for another user. The role has to have been granted to\nthe user before it can be set as default:\n\nCREATE ROLE journalist;\nCREATE USER taniel;\n\nSET DEFAULT ROLE journalist FOR taniel;\nERROR 1959 (OP000): Invalid role specification `journalist`\n\nGRANT journalist TO taniel;\nSET DEFAULT ROLE journalist FOR taniel;\n\nViewing mysql.user:\n\nselect * from mysql.user where user=\'taniel\'\\G\n*************************** 1. row ***************************\n Host: %\n User: taniel\n...\n is_role: N\n default_role: journalist\n...\n\nRemoving a default role for another user\n\nSET DEFAULT ROLE NONE FOR taniel;\n\nURL: https://mariadb.com/kb/en/set-default-role/','','https://mariadb.com/kb/en/set-default-role/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (116,10,'Roles Overview','Description\n-----------\n\nA role bundles a number of privileges together. It assists larger\norganizations where, typically, a number of users would have the same\nprivileges, and, previously, the only way to change the privileges for a group\nof users was by changing each user\'s privileges individually.\n\nAlternatively, multiple external users could have been assigned the same user,\nand there would have been no way to see which actual user was responsible for\nwhich action.\n\nWith roles, managing this is easy. For example, there could be a number of\nusers assigned to a journalist role, with identical privileges. Changing the\nprivileges for all the journalists is a matter of simply changing the role\'s\nprivileges, while the individual user is still linked with any changes that\ntake place.\n\nRoles are created with the CREATE ROLE statement, and dropped with the DROP\nROLE statement. Roles are then assigned to a user with an extension to the\nGRANT statement, while privileges are assigned to a role in the regular way\nwith GRANT. Similarly, the REVOKE statement can be used to both revoke a role\nfrom a user, or revoke a privilege from a role.\n\nOnce a user has connected, he can obtain all privileges associated with a role\nby setting a role with the SET ROLE statement. The CURRENT_ROLE function\nreturns the currently set role for the session, if any.\n\nOnly roles granted directly to a user can be set, roles granted to other roles\ncannot. Instead the privileges granted to a role, which is, in turn, granted\nto another role (grantee), will be immediately available to any user who sets\nthis second grantee role.\n\nThe SET DEFAULT ROLE statement allows one to set a default role for a user. A\ndefault role is automatically enabled when a user connects (an implicit SET\nROLE statement is executed immediately after a connection is established).\n\nRoles were implemented as a GSoC 2013 project by Vicentiu Ciorbaru.\n\nSystem Tables\n-------------\n\nInformation about roles and who they\'ve been granted to can be found in the\nInformation Schema APPLICABLE_ROLES table as well as the mysql.ROLES_MAPPING\ntable.\n\nThe Information Schema ENABLED_ROLES table shows the enabled roles for the\ncurrent session.\n\nExamples\n--------\n\nCreating a role and granting a privilege:\n\nCREATE ROLE journalist;\n\nGRANT SHOW DATABASES ON *.* TO journalist;\n\nGRANT journalist to hulda;\n\nNote, that hulda has no SHOW DATABASES privilege, even though she was granted\nthe journalist role. She needs to set the role first:\n\nSHOW DATABASES;\n+--------------------+\n| Database |\n+--------------------+\n| information_schema |\n+--------------------+\n\nSELECT CURRENT_ROLE;\n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n\nSET ROLE journalist;\n\nSELECT CURRENT_ROLE;\n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| journalist |\n+--------------+\n\nSHOW DATABASES;\n+--------------------+\n| Database |\n+--------------------+\n| ... |\n| information_schema |\n| mysql |\n| performance_schema |\n| test |\n| ... |\n+--------------------+\n\nSET ROLE NONE;\n\nRoles can be granted to roles:\n\nCREATE ROLE writer;\n\nGRANT SELECT ON data.* TO writer;\n\nGRANT writer TO journalist;\n\nBut one does not need to set a role granted to a role. For example, hulda will\nautomatically get all writer privileges when she sets the journalist role:\n\nSELECT CURRENT_ROLE;\n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n\nSHOW TABLES FROM data;\nEmpty set (0.01 sec)\n\nSET ROLE journalist;\n\nSELECT CURRENT_ROLE;\n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| journalist |\n+--------------+\n\nSHOW TABLES FROM data;\n+------------------------------+\n| Tables_in_data |\n+------------------------------+\n| set1 |\n| ... |\n+------------------------------+\n\nRoles and Views (and Stored Routines)\n-------------------------------------\n\nWhen a user sets a role, he, in a sense, has two identities with two\nassociated sets of privileges. But a view (or a stored routine) can have only\none definer. So, when a view (or a stored routine) is created with the SQL\nSECURITY DEFINER, one can specify whether the definer should be CURRENT_USER\n(and the view will have none of the privileges of the user\'s role) or\nCURRENT_ROLE (in this case, the view will use role\'s privileges, but none of\nthe user\'s privileges). As a result, sometimes one can create a view that is\nimpossible to use.\n\nCREATE ROLE r1;\n\nGRANT ALL ON db1.* TO r1;\n\nGRANT r1 TO foo@localhost;\n\nGRANT ALL ON db.* TO foo@localhost;\n\nSELECT CURRENT_USER\n+---------------+\n| current_user |\n+---------------+\n| foo@localhost |\n+---------------+\n\nSET ROLE r1;\n\nCREATE TABLE db1.t1 (i int);\n\nCREATE VIEW db.v1 AS SELECT * FROM db1.t1;\n\nSHOW CREATE VIEW db.v1;\n+------+-----------------------------------------------------------------------\n------------------------------------------------------------------+------------\n---------+----------------------+\n| View | Create View \n |\ncharacter_set_client | collation_connection |\n+------+-----------------------------------------------------------------------\n------------------------------------------------------------------+------------\n---------+----------------------+\n| v1 | CREATE ALGORITHM=UNDEFINED DEFINER=`foo`@`localhost` SQL SECURITY\nDEFINER VIEW `db`.`v1` AS SELECT `db1`.`t1`.`i` AS `i` from `db1`.`t1` | utf8 \n | utf8_general_ci |\n+------+-----------------------------------------------------------------------\n------------------------------------------------------------------+------------\n---------+----------------------+\n\nCREATE DEFINER=CURRENT_ROLE VIEW db.v2 AS SELECT * FROM db1.t1;\n\nSHOW CREATE VIEW db.b2;\n+------+-----------------------------------------------------------------------\n-----------------------------------------------------+----------------------+--\n-------------------+\n| View | Create View \n | character_set_client |\ncollation_connection |\n+------+-----------------------------------------------------------------------\n-----------------------------------------------------+----------------------+--\n-------------------+\n| v2 | CREATE ALGORITHM=UNDEFINED DEFINER=`r1` SQL SECURITY DEFINER VIEW\n`db`.`v2` AS select `db1`.`t1`.`a` AS `a` from `db1`.`t1` | utf8 \n | utf8_general_ci |\n+------+-----------------------------------------------------------------------\n-----------------------------------------------------+----------------------+--\n-------------------+\n\nOther Resources\n---------------\n\n* Roles Review by Peter Gulutzan\n\nURL: https://mariadb.com/kb/en/roles_overview/','','https://mariadb.com/kb/en/roles_overview/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (117,10,'Account Locking','MariaDB starting with 10.4.2\n----------------------------\nAccount locking was introduced in MariaDB 10.4.2.\n\nDescription\n-----------\n\nAccount locking permits privileged administrators to lock/unlock user\naccounts. No new client connections will be permitted if an account is locked\n(existing connections are not affected).\n\nUser accounts can be locked at creation, with the CREATE USER statement, or\nmodified after creation with the ALTER USER statement. For example:\n\nCREATE USER \'lorin\'@\'localhost\' ACCOUNT LOCK;\n\nor\n\nALTER USER \'marijn\'@\'localhost\' ACCOUNT LOCK;\n\nThe server will return an ER_ACCOUNT_HAS_BEEN_LOCKED error when locked users\nattempt to connect:\n\nmysql -ulorin\n ERROR 4151 (HY000): Access denied, this account is locked\n\nThe ALTER USER statement is also used to unlock a user:\n\nALTER USER \'lorin\'@\'localhost\' ACCOUNT UNLOCK;\n\nThe SHOW CREATE USER statement will show whether the account is locked:\n\nSHOW CREATE USER \'marijn\'@\'localhost\';\n+-----------------------------------------------+\n| CREATE USER for marijn@localhost |\n+-----------------------------------------------+\n| CREATE USER \'marijn\'@\'localhost\' ACCOUNT LOCK |\n+-----------------------------------------------+\n\nas well as querying the mysql.global_priv table:\n\nSELECT CONCAT(user, \'@\', host, \' => \', JSON_DETAILED(priv)) FROM\nmysql.global_priv \n WHERE user=\'marijn\';\n+------------------------------------------------------------------------------\n-------+\n| CONCAT(user, \'@\', host, \' => \', JSON_DETAILED(priv)) \n |\n+------------------------------------------------------------------------------\n-------+\n| marijn@localhost => {\n \"access\": 0,\n \"plugin\": \"mysql_native_password\",\n \"authentication_string\": \"\",\n \"account_locked\": true,\n \"password_last_changed\": 1558017158\n} |\n+------------------------------------------------------------------------------\n-------+\n\nURL: https://mariadb.com/kb/en/account-locking/','','https://mariadb.com/kb/en/account-locking/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (118,10,'Authentication from MariaDB 10.4','MariaDB starting with 10.4\n--------------------------\nMariaDB 10.4 introduced a number of changes to the authentication process,\nintended to make things easier and more intuitive.\n\nOverview\n--------\n\nThere are four new main features in 10.4 relating to authentication:\n\n* It is possible to use more than one authentication plugin for each user\naccount. For example, this can be useful to slowly migrate users to the more\nsecure ed25519 authentication plugin over time, while allowing the old\nmysql_native_password authentication plugin as an alternative for the\ntransitional period.\n* The root@localhost user account created by mysql_install_db is created with\nthe ability to use two authentication plugins.\nFirst, it is configured to try to use the unix_socket authentication plugin.\nThis allows the root@localhost user to login without a password via the local\nUnix socket file defined by the socket system variable, as long as the login\nis attempted from a process owned by the operating system root user account.\nSecond, if authentication fails with the unix_socket authentication plugin,\nthen it is configured to try to use the mysql_native_password authentication\nplugin. However, an invalid password is initially set, so in order to\nauthenticate this way, a password must be set with SET PASSWORD.\nHowever, just using the unix_socket authentication plugin may be fine for many\nusers, and it is very secure. You may want to try going without password\nauthentication to see how well it works for you. Remember, the best way to\nkeep your password safe is not to have one!\n\n* All user accounts, passwords, and global privileges are now stored in the\nmysql.global_priv table. The mysql.user table still exists and has exactly the\nsame set of columns as before, but it’s now a view that references the\nmysql.global_priv table. Tools that analyze the mysql.user table should\ncontinue to work as before. From MariaDB 10.4.13, the dedicated mariadb.sys\nuser is created as the definer of this view. Previously root was the definer,\nwhich resulted in privilege problems when this username was changed.\n* MariaDB 10.4 adds supports for User Password Expiry, which is not active by\ndefault.\n\nDescription\n-----------\n\nAs a result of the above changes, the open-for-everyone all-powerful root\naccount is finally gone. And installation scripts will no longer demand that\nyou \"PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !\", because\nthe root account is securely created automatically.\n\nTwo all-powerful accounts are created by default — root and the OS user that\nowns the data directory, typically mysql. They are created as:\n\nCREATE USER root@localhost IDENTIFIED VIA unix_socket OR mysql_native_password\nUSING \'invalid\'\nCREATE USER mysql@localhost IDENTIFIED VIA unix_socket OR\nmysql_native_password USING \'invalid\'\n\nUsing unix_socket means that if you are the system root user, you can login as\nroot@locahost without a password. This technique was pioneered by Otto\nKekäläinen in Debian MariaDB packages and has been successfully used in Debian\nsince as early as MariaDB 10.0.\n\nIt is based on a simple fact that asking the system root for a password adds\nno extra security — root has full access to all the data files and all process\nmemory anyway. But not asking for a password means, there is no root password\nto forget (no need for the numerous tutorials on \"how to reset MariaDB root\npassword\"). And if you want to script some tedious database work, there is no\nneed to store the root password in plain text for the script to use (no need\nfor debian-sys-maint user).\n\nStill, some users may wish to log in as MariaDB root without using sudo. Hence\nthe old authentication method — conventional MariaDB password — is still\navailable. By default it is disabled (\"invalid\" is not a valid password hash),\nbut one can set the password with a usual SET PASSWORD statement. And still\nretain the password-less access via sudo.\n\nIf you install MariaDB locally (say from a tarball), you would not want to use\nsudo to be able to login. This is why MariaDB creates a second all-powerful\nuser with the same name as a system user that owns the data directory. In\nlocal (not system-wide) installations, this will be the user who installed\nMariaDB — they automatically get convenient password-less root-like access,\nbecause they can access all the data files anyway.\n\nEven if MariaDB is installed system-wide, you may not want to run your\ndatabase maintenance scripts as system root — now you can run them as system\nmysql user. And you will know that they will never destroy your entire system,\neven if you make a typo in a shell script.\n\nHowever, seasoned MariaDB DBAs who are used to the old ways do need to make\nsome changes. See the examples below for common tasks.\n\nCookbook\n--------\n\nAfter installing MariaDB system-wide the first thing you’ve got used to doing\nis logging in into the unprotected root account and protecting it, that is,\nsetting the root password:\n\n$ sudo dnf install MariaDB-server\n$ mysql -uroot\n...\nMariaDB> set password = password(\"XH4VmT3_jt\");\n\nThis is not only unnecessary now, it will simply not work — there is no\nunprotected root account. To login as root use\n\n$ sudo dnf install MariaDB-server\n$ sudo mysql\n\nNote that it implies you are connecting via the unix socket, not tcp. If you\nhappen to have protocol=tcp in a system-wide /etc/my.cnf file, use sudo mysql\n--protocol=socket.\n\nAfter installing MariaDB locally you’ve also used to connect to the\nunprotected root account using mysql -uroot. This will not work either, simply\nuse mysql without specifying a username.\n\nIf you\'ve forgotten your root password, no problem — you can still connect\nusing sudo and change the password. And if you\'ve also removed unix_socket\nauthentication, to restore access do as follows:\n\n* restart MariaDB with --skip-grant-tables\n* login into the unprotected server\n* run FLUSH PRIVILEGES (note, before 10.4 this would’ve been the last step,\nnot anymore). This disables --skip-grant-tables and allows you to change the\nstored authentication method\n* run SET PASSWORD FOR root@localhost to change the root password.\n\nTo view inside privilege tables, the old mysql.user table still exists. You\ncan select from it as before, although you cannot update it anymore. It\ndoesn’t show alternative authentication plugins and this was one of the\nreasons for switching to the mysql.global_priv table — complex authentication\nrules did not fit into rigid structure of a relational table. You can select\nfrom the new table, for example:\n\nselect concat(user, \'@\', host, \' => \', json_detailed(priv)) from\nmysql.global_priv;\n\nReverting to the Previous Authentication Method for root@localhost\n------------------------------------------------------------------\n\nIf you don\'t want the root@localhost user account created by mysql_install_db\nto use unix_socket authentication by default, then there are a few ways to\nrevert to the previous mysql_native_password authentication method for this\nuser account.\n\nConfiguring mysql_install_db to Revert to the Previous Authentication Method\n----------------------------------------------------------------------------\n\nOne way to revert to the previous mysql_native_password authentication method\nfor the root@localhost user account is to execute mysql_install_db with a\nspecial option. If mysql_install_db is executed while\n--auth-root-authentication-method=normal is specified, then it will create the\ndefault user accounts using the default behavior of MariaDB 10.3 and before.\n\nThis means that the root@localhost user account will use mysql_native_password\nauthentication by default. There are some other differences as well. See\nmysql_install_db: User Accounts Created by Default for more information.\n\nFor example, the option can be set on the command-line while running\nmysql_install_db:\n\nmysql_install_db --user=mysql --datadir=/var/lib/mysql\n--auth-root-authentication-method=normal\n\nThe option can also be set in an option file in an option group supported by\nmysql_install_db. For example:\n\n[mysql_install_db]\nauth_root_authentication_method=normal\n\nIf the option is set in an option file and if mysql_install_db is executed,\nthen mysql_install_db will read this option from the option file, and it will\nautomatically set this option.\n\nAltering the User Account to Revert to the Previous Authentication Method\n-------------------------------------------------------------------------\n\nIf you have already installed MariaDB, and if the root@localhost user account\nis already using unix_socket authentication, then you can revert to the old\nmysql_native_password authentication method for the user account by executing\nthe following:\n\nALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING\nPASSWORD(\"verysecret\")\n\nURL: https://mariadb.com/kb/en/authentication-from-mariadb-104/','','https://mariadb.com/kb/en/authentication-from-mariadb-104/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (119,10,'User Password Expiry','MariaDB starting with 10.4.3\n----------------------------\nUser password expiry was introduced in MariaDB 10.4.3.\n\nPassword expiry permits administrators to expire user passwords, either\nmanually or automatically.\n\nSystem Variables\n----------------\n\nThere are two system variables which affect password expiry:\ndefault_password_lifetime, which determines the amount of time between\nrequiring the user to change their password. 0, the default, means automatic\npassword expiry is not active.\n\nThe second variable, disconnect_on_expired_password determines whether a\nclient is permitted to connect if their password has expired, or whether they\nare permitted to connect in sandbox mode, able to perform a limited subset of\nqueries related to resetting the password, in particular SET PASSWORD and SET.\n\nSetting a Password Expiry Limit for a User\n------------------------------------------\n\nBesides automatic password expiry, as determined by default_password_lifetime,\npassword expiry times can be set on an individual user basis, overriding the\nglobal using the CREATE USER or ALTER USER statements, for example:\n\nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL 120 DAY;\n\nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL 120 DAY;\n\nLimits can be disabled by use of the NEVER keyword, for example:\n\nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE NEVER;\n\nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE NEVER;\n\nA manually set limit can be restored the system default by use of DEFAULT, for\nexample:\n\nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n\nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n\nSHOW CREATE USER\n----------------\n\nThe SHOW CREATE USER statement will display information about the password\nexpiry status of the user. Unlike MySQL, it will not display if the user is\nunlocked, or if the password expiry is set to default.\n\nCREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL 120 DAY;\nCREATE USER \'konstantin\'@\'localhost\' PASSWORD EXPIRE NEVER;\nCREATE USER \'amse\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n\nSHOW CREATE USER \'monty\'@\'localhost\';\n+------------------------------------------------------------------+\n| CREATE USER for monty@localhost |\n+------------------------------------------------------------------+\n| CREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL 120 DAY |\n+------------------------------------------------------------------+\n\nSHOW CREATE USER \'konstantin\'@\'localhost\';\n+------------------------------------------------------------+\n| CREATE USER for konstantin@localhost |\n+------------------------------------------------------------+\n| CREATE USER \'konstantin\'@\'localhost\' PASSWORD EXPIRE NEVER |\n+------------------------------------------------------------+\n\nSHOW CREATE USER \'amse\'@\'localhost\';\n+--------------------------------+\n| CREATE USER for amse@localhost |\n+--------------------------------+\n| CREATE USER \'amse\'@\'localhost\' |\n+--------------------------------+\n\nChecking When Passwords Expire\n------------------------------\n\nThe following query can be used to check when the current passwords expire for\nall users:\n\nWITH password_expiration_info AS (\n SELECT User, Host,\n IF(\n IFNULL(JSON_EXTRACT(Priv, \'$.password_lifetime\'), -1) = -1,\n @@global.default_password_lifetime,\n JSON_EXTRACT(Priv, \'$.password_lifetime\')\n ) AS password_lifetime,\n JSON_EXTRACT(Priv, \'$.password_last_changed\') AS password_last_changed\n FROM mysql.global_priv\n)\nSELECT pei.User, pei.Host,\n pei.password_lifetime,\n FROM_UNIXTIME(pei.password_last_changed) AS password_last_changed_datetime,\n FROM_UNIXTIME(\n pei.password_last_changed +\n (pei.password_lifetime * 60 * 60 * 24)\n ) AS password_expiration_datetime\n FROM password_expiration_info pei\n WHERE pei.password_lifetime != 0\n AND pei.password_last_changed IS NOT NULL\nUNION\nSELECT pei.User, pei.Host,\n pei.password_lifetime,\n FROM_UNIXTIME(pei.password_last_changed) AS password_last_changed_datetime,\n 0 AS password_expiration_datetime\n FROM password_expiration_info pei\n WHERE pei.password_lifetime = 0\n OR pei.password_last_changed IS NULL;\n\n--connect-expired-password Client Option\n----------------------------------------\n\nThe mysql client --connect-expired-password option notifies the server that\nthe client is prepared to handle expired password sandbox mode (even if the\n--batch option was specified).\n\nURL: https://mariadb.com/kb/en/user-password-expiry/','','https://mariadb.com/kb/en/user-password-expiry/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (120,11,'ST_X','Syntax\n------\n\nST_X(p)\nX(p)\n\nDescription\n-----------\n\nReturns the X-coordinate value for the point p as a double-precision number.\n\nST_X() and X() are synonyms.\n\nExamples\n--------\n\nSET @pt = \'Point(56.7 53.34)\';\n\nSELECT X(GeomFromText(@pt));\n+----------------------+\n| X(GeomFromText(@pt)) |\n+----------------------+\n| 56.7 |\n+----------------------+\n\nURL: https://mariadb.com/kb/en/st_x/','','https://mariadb.com/kb/en/st_x/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (121,11,'ST_Y','Syntax\n------\n\nST_Y(p)\nY(p)\n\nDescription\n-----------\n\nReturns the Y-coordinate value for the point p as a double-precision number.\n\nST_Y() and Y() are synonyms.\n\nExamples\n--------\n\nSET @pt = \'Point(56.7 53.34)\';\n\nSELECT Y(GeomFromText(@pt));\n+----------------------+\n| Y(GeomFromText(@pt)) |\n+----------------------+\n| 53.34 |\n+----------------------+\n\nURL: https://mariadb.com/kb/en/st_y/','','https://mariadb.com/kb/en/st_y/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (122,11,'X','A synonym for ST_X.\n\nURL: https://mariadb.com/kb/en/point-properties-x/','','https://mariadb.com/kb/en/point-properties-x/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (123,11,'Y','A synonym for ST_Y.\n\nURL: https://mariadb.com/kb/en/point-properties-y/','','https://mariadb.com/kb/en/point-properties-y/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (124,12,'UNCOMPRESS','Syntax\n------\n\nUNCOMPRESS(string_to_uncompress)\n\nDescription\n-----------\n\nUncompresses a string compressed by the COMPRESS() function. If the argument\nis not a compressed value, the result is NULL. This function requires MariaDB\nto have been compiled with a compression library such as zlib. Otherwise, the\nreturn value is always NULL. The have_compress server system variable\nindicates whether a compression library is present.\n\nExamples\n--------\n\nSELECT UNCOMPRESS(COMPRESS(\'a string\'));\n+----------------------------------+\n| UNCOMPRESS(COMPRESS(\'a string\')) |\n+----------------------------------+\n| a string |\n+----------------------------------+\n\nSELECT UNCOMPRESS(\'a string\');\n+------------------------+\n| UNCOMPRESS(\'a string\') |\n+------------------------+\n| NULL |\n+------------------------+\n\nURL: https://mariadb.com/kb/en/uncompress/','','https://mariadb.com/kb/en/uncompress/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (125,12,'DECODE','Syntax\n------\n\nDECODE(crypt_str,pass_str)\n\nIn Oracle mode from MariaDB 10.3.2:\n\nDECODE(expr, search_expr, result_expr [, search_expr2, result_expr2 ...]\n[default_expr])\n\nIn all modes from MariaDB 10.3.2:\n\nDECODE_ORACLE(expr, search_expr, result_expr [, search_expr2, result_expr2\n...] [default_expr])\n\nDescription\n-----------\n\nIn the default mode, DECODE decrypts the encrypted string crypt_str using\npass_str as the password. crypt_str should be a string returned from ENCODE().\nThe resulting string will be the original string only if pass_str is the same.\n\nIn Oracle mode from MariaDB 10.3.2, DECODE compares expr to the search\nexpressions, in order. If it finds a match, the corresponding result\nexpression is returned. If no matches are found, the default expression is\nreturned, or NULL if no default is provided.\n\nNULLs are treated as equivalent.\n\nDECODE_ORACLE is a synonym for the Oracle-mode version of the function, and is\navailable in all modes.\n\nExamples\n--------\n\nFrom MariaDB 10.3.2:\n\nSELECT DECODE_ORACLE(2+1,3*1,\'found1\',3*2,\'found2\',\'default\');\n+--------------------------------------------------------+\n| DECODE_ORACLE(2+1,3*1,\'found1\',3*2,\'found2\',\'default\') |\n+--------------------------------------------------------+\n| found1 |\n+--------------------------------------------------------+\n\nSELECT DECODE_ORACLE(2+4,3*1,\'found1\',3*2,\'found2\',\'default\');\n+--------------------------------------------------------+\n| DECODE_ORACLE(2+4,3*1,\'found1\',3*2,\'found2\',\'default\') |\n+--------------------------------------------------------+\n| found2 |\n+--------------------------------------------------------+\n\nSELECT DECODE_ORACLE(2+2,3*1,\'found1\',3*2,\'found2\',\'default\');\n+--------------------------------------------------------+\n| DECODE_ORACLE(2+2,3*1,\'found1\',3*2,\'found2\',\'default\') |\n+--------------------------------------------------------+\n| default |\n+--------------------------------------------------------+\n\nNulls are treated as equivalent:\n\nSELECT DECODE_ORACLE(NULL,NULL,\'Nulls are equivalent\',\'Nulls are not\nequivalent\');\n+----------------------------------------------------------------------------+\n| DECODE_ORACLE(NULL,NULL,\'Nulls are equivalent\',\'Nulls are not equivalent\') |\n+----------------------------------------------------------------------------+\n| Nulls are equivalent |\n+----------------------------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/decode/','','https://mariadb.com/kb/en/decode/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (126,12,'DECODE_ORACLE','MariaDB starting with 10.3.2\n----------------------------\nDECODE_ORACLE is a synonym for the Oracle mode version of the DECODE function,\nand is available in all modes.\n\nURL: https://mariadb.com/kb/en/decode_oracle/','','https://mariadb.com/kb/en/decode_oracle/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (127,12,'AES_DECRYPT','Syntax\n------\n\nAES_DECRYPT(crypt_str,key_str)\n\nDescription\n-----------\n\nThis function allows decryption of data using the official AES (Advanced\nEncryption Standard) algorithm. For more information, see the description of\nAES_ENCRYPT().\n\nURL: https://mariadb.com/kb/en/aes_decrypt/','','https://mariadb.com/kb/en/aes_decrypt/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (128,12,'AES_ENCRYPT','Syntax\n------\n\nAES_ENCRYPT(str,key_str)\n\nDescription\n-----------\n\nAES_ENCRYPT() and AES_DECRYPT() allow encryption and decryption of data using\nthe official AES (Advanced Encryption Standard) algorithm, previously known as\n\"Rijndael.\" Encoding with a 128-bit key length is used, but you can extend it\nup to 256 bits by modifying the source. We chose 128 bits because it is much\nfaster and it is secure enough for most purposes.\n\nAES_ENCRYPT() encrypts a string str using the key key_str, and returns a\nbinary string.\n\nAES_DECRYPT() decrypts the encrypted string and returns the original string.\n\nThe input arguments may be any length. If either argument is NULL, the result\nof this function is also NULL.\n\nBecause AES is a block-level algorithm, padding is used to encode uneven\nlength strings and so the result string length may be calculated using this\nformula:\n\n16 x (trunc(string_length / 16) + 1)\n\nIf AES_DECRYPT() detects invalid data or incorrect padding, it returns NULL.\nHowever, it is possible for AES_DECRYPT() to return a non-NULL value (possibly\ngarbage) if the input data or the key is invalid.\n\nExamples\n--------\n\nINSERT INTO t VALUES (AES_ENCRYPT(\'text\',SHA2(\'password\',512)));\n\nURL: https://mariadb.com/kb/en/aes_encrypt/','','https://mariadb.com/kb/en/aes_encrypt/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (129,12,'COMPRESS','Syntax\n------\n\nCOMPRESS(string_to_compress)\n\nDescription\n-----------\n\nCompresses a string and returns the result as a binary string. This function\nrequires MariaDB to have been compiled with a compression library such as\nzlib. Otherwise, the return value is always NULL. The compressed string can be\nuncompressed with UNCOMPRESS().\n\nThe have_compress server system variable indicates whether a compression\nlibrary is present.\n\nExamples\n--------\n\nSELECT LENGTH(COMPRESS(REPEAT(\'a\',1000)));\n+------------------------------------+\n| LENGTH(COMPRESS(REPEAT(\'a\',1000))) |\n+------------------------------------+\n| 21 |\n+------------------------------------+\n\nSELECT LENGTH(COMPRESS(\'\'));\n+----------------------+\n| LENGTH(COMPRESS(\'\')) |\n+----------------------+\n| 0 |\n+----------------------+\n\nSELECT LENGTH(COMPRESS(\'a\'));\n+-----------------------+\n| LENGTH(COMPRESS(\'a\')) |\n+-----------------------+\n| 13 |\n+-----------------------+\n\nSELECT LENGTH(COMPRESS(REPEAT(\'a\',16)));\n+----------------------------------+\n| LENGTH(COMPRESS(REPEAT(\'a\',16))) |\n+----------------------------------+\n| 15 |\n+----------------------------------+\n\nURL: https://mariadb.com/kb/en/compress/','','https://mariadb.com/kb/en/compress/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (130,12,'DES_DECRYPT','DES_DECRYPT has been deprecated from MariaDB 10.10.0, and will be removed in a\nfuture release.\n\nSyntax\n------\n\nDES_DECRYPT(crypt_str[,key_str])\n\nDescription\n-----------\n\nDecrypts a string encrypted with DES_ENCRYPT(). If an error occurs, this\nfunction returns NULL.\n\nThis function works only if MariaDB has been configured with TLS support.\n\nIf no key_str argument is given, DES_DECRYPT() examines the first byte of the\nencrypted string to determine the DES key number that was used to encrypt the\noriginal string, and then reads the key from the DES key file to decrypt the\nmessage. For this to work, the user must have the SUPER privilege. The key\nfile can be specified with the --des-key-file server option.\n\nIf you pass this function a key_str argument, that string is used as the key\nfor decrypting the message.\n\nIf the crypt_str argument does not appear to be an encrypted string, MariaDB\nreturns the given crypt_str.\n\nURL: https://mariadb.com/kb/en/des_decrypt/','','https://mariadb.com/kb/en/des_decrypt/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (131,12,'DES_ENCRYPT','DES_ENCRYPT has been deprecated from MariaDB 10.10.0, and will be removed in a\nfuture release.\n\nSyntax\n------\n\nDES_ENCRYPT(str[,{key_num|key_str}])\n\nDescription\n-----------\n\nEncrypts the string with the given key using the Triple-DES algorithm.\n\nThis function works only if MariaDB has been configured with TLS support.\n\nThe encryption key to use is chosen based on the second argument to\nDES_ENCRYPT(), if one was given. With no argument, the first key from the DES\nkey file is used. With a key_num argument, the given key number (0-9) from the\nDES key file is used. With a key_str argument, the given key string is used to\nencrypt str.\n\nThe key file can be specified with the --des-key-file server option.\n\nThe return string is a binary string where the first character is CHAR(128 |\nkey_num). If an error occurs, DES_ENCRYPT() returns NULL.\n\nThe 128 is added to make it easier to recognize an encrypted key. If you use a\nstring key, key_num is 127.\n\nThe string length for the result is given by this formula:\n\nnew_len = orig_len + (8 - (orig_len % 8)) + 1\n\nEach line in the DES key file has the following format:\n\nkey_num des_key_str\n\nEach key_num value must be a number in the range from 0 to 9. Lines in the\nfile may be in any order. des_key_str is the string that is used to encrypt\nthe message. There should be at least one space between the number and the\nkey. The first key is the default key that is used if you do not specify any\nkey argument to DES_ENCRYPT().\n\nYou can tell MariaDB to read new key values from the key file with the FLUSH\nDES_KEY_FILE statement. This requires the RELOAD privilege.\n\nOne benefit of having a set of default keys is that it gives applications a\nway to check for the existence of encrypted column values, without giving the\nend user the right to decrypt those values.\n\nExamples\n--------\n\nSELECT customer_address FROM customer_table \n WHERE crypted_credit_card = DES_ENCRYPT(\'credit_card_number\');\n\nURL: https://mariadb.com/kb/en/des_encrypt/','','https://mariadb.com/kb/en/des_encrypt/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (132,12,'ENCODE','Syntax\n------\n\nENCODE(str,pass_str)\n\nDescription\n-----------\n\nENCODE is not considered cryptographically secure, and should not be used for\npassword encryption.\n\nEncrypt str using pass_str as the password. To decrypt the result, use\nDECODE().\n\nThe result is a binary string of the same length as str.\n\nThe strength of the encryption is based on how good the random generator is.\n\nIt is not recommended to rely on the encryption performed by the ENCODE\nfunction. Using a salt value (changed when a password is updated) will improve\nmatters somewhat, but for storing passwords, consider a more cryptographically\nsecure function, such as SHA2().\n\nExamples\n--------\n\nENCODE(\'not so secret text\', CONCAT(\'random_salt\',\'password\'))\n\nURL: https://mariadb.com/kb/en/encode/','','https://mariadb.com/kb/en/encode/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (133,12,'ENCRYPT','Syntax\n------\n\nENCRYPT(str[,salt])\n\nDescription\n-----------\n\nEncrypts a string using the Unix crypt() system call, returning an encrypted\nbinary string. The salt argument should be a string with at least two\ncharacters or the returned result will be NULL. If no salt argument is given,\na random value of sufficient length is used.\n\nIt is not recommended to use ENCRYPT() with utf16, utf32 or ucs2 multi-byte\ncharacter sets because the crypt() system call expects a string terminated\nwith a zero byte.\n\nNote that the underlying crypt() system call may have some limitations, such\nas ignoring all but the first eight characters.\n\nIf the have_crypt system variable is set to NO (because the crypt() system\ncall is not available), the ENCRYPT function will always return NULL.\n\nExamples\n--------\n\nSELECT ENCRYPT(\'encrypt me\');\n+-----------------------+\n| ENCRYPT(\'encrypt me\') |\n+-----------------------+\n| 4I5BsEx0lqTDk |\n+-----------------------+\n\nURL: https://mariadb.com/kb/en/encrypt/','','https://mariadb.com/kb/en/encrypt/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (134,12,'MD5','Syntax\n------\n\nMD5(str)\n\nDescription\n-----------\n\nCalculates an MD5 128-bit checksum for the string.\n\nThe return value is a 32-hex digit string, and as of MariaDB 5.5, is a\nnonbinary string in the connection character set and collation, determined by\nthe values of the character_set_connection and collation_connection system\nvariables. Before 5.5, the return value was a binary string.\n\nNULL is returned if the argument was NULL.\n\nExamples\n--------\n\nSELECT MD5(\'testing\');\n+----------------------------------+\n| MD5(\'testing\') |\n+----------------------------------+\n| ae2b1fca515949e5d54fb22b8ed95575 |\n+----------------------------------+\n\nURL: https://mariadb.com/kb/en/md5/','','https://mariadb.com/kb/en/md5/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (135,12,'OLD_PASSWORD','Syntax\n------\n\nOLD_PASSWORD(str)\n\nDescription\n-----------\n\nOLD_PASSWORD() was added to MySQL when the implementation of PASSWORD() was\nchanged to improve security. OLD_PASSWORD() returns the value of the old\n(pre-MySQL 4.1) implementation of PASSWORD() as a string, and is intended to\npermit you to reset passwords for any pre-4.1 clients that need to connect to\na more recent MySQL server version, or any version of MariaDB, without locking\nthem out.\n\nAs of MariaDB 5.5, the return value is a nonbinary string in the connection\ncharacter set and collation, determined by the values of the\ncharacter_set_connection and collation_connection system variables. Before\n5.5, the return value was a binary string.\n\nThe return value is 16 bytes in length, or NULL if the argument was NULL.\n\nURL: https://mariadb.com/kb/en/old_password/','','https://mariadb.com/kb/en/old_password/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (136,12,'PASSWORD','Syntax\n------\n\nPASSWORD(str)\n\nDescription\n-----------\n\nThe PASSWORD() function is used for hashing passwords for use in\nauthentication by the MariaDB server. It is not intended for use in other\napplications.\n\nCalculates and returns a hashed password string from the plaintext password\nstr. Returns an empty string (>= MariaDB 10.0.4) if the argument was NULL.\n\nThe return value is a nonbinary string in the connection character set and\ncollation, determined by the values of the character_set_connection and\ncollation_connection system variables.\n\nThis is the function that is used for hashing MariaDB passwords for storage in\nthe Password column of the user table (see privileges), usually used with the\nSET PASSWORD statement. It is not intended for use in other applications.\n\nUntil MariaDB 10.3, the return value is 41-bytes in length, and the first\ncharacter is always \'*\'. From MariaDB 10.4, the function takes into account\nthe authentication plugin where applicable (A CREATE USER or SET PASSWORD\nstatement). For example, when used in conjunction with a user authenticated by\nthe ed25519 plugin, the statement will create a longer hash:\n\nCREATE USER edtest@localhost IDENTIFIED VIA ed25519 USING PASSWORD(\'secret\');\n\nCREATE USER edtest2@localhost IDENTIFIED BY \'secret\';\n\nSELECT CONCAT(user, \'@\', host, \' => \', JSON_DETAILED(priv)) FROM\nmysql.global_priv\n WHERE user LIKE \'edtest%\'\\G\n*************************** 1. row ***************************\nCONCAT(user, \'@\', host, \' => \', JSON_DETAILED(priv)): edtest@localhost => {\n...\n \"plugin\": \"ed25519\",\n \"authentication_string\": \"ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY\",\n...\n}\n*************************** 2. row ***************************\nCONCAT(user, \'@\', host, \' => \', JSON_DETAILED(priv)): edtest2@localhost => {\n...\n \"plugin\": \"mysql_native_password\",\n \"authentication_string\": \"*14E65567ABDB5135D0CFD9A70B3032C179A49EE7\",\n...\n}\n\nThe behavior of this function is affected by the value of the old_passwords\nsystem variable. If this is set to 1 (0 is default), MariaDB reverts to using\nthe mysql_old_password authentication plugin by default for newly created\nusers and passwords.\n\nExamples\n--------\n\nSELECT PASSWORD(\'notagoodpwd\');\n+-------------------------------------------+\n| PASSWORD(\'notagoodpwd\') |\n+-------------------------------------------+\n| *3A70EE9FC6594F88CE9E959CD51C5A1C002DC937 |\n+-------------------------------------------+\n\nSET PASSWORD FOR \'bob\'@\'%.loc.gov\' = PASSWORD(\'newpass\');\n\nURL: https://mariadb.com/kb/en/password/','','https://mariadb.com/kb/en/password/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (137,12,'SHA1','Syntax\n------\n\nSHA1(str), SHA(str)\n\nDescription\n-----------\n\nCalculates an SHA-1 160-bit checksum for the string str, as described in RFC\n3174 (Secure Hash Algorithm).\n\nThe value is returned as a string of 40 hex digits, or NULL if the argument\nwas NULL. As of MariaDB 5.5, the return value is a nonbinary string in the\nconnection character set and collation, determined by the values of the\ncharacter_set_connection and collation_connection system variables. Before\n5.5, the return value was a binary string.\n\nExamples\n--------\n\nSELECT SHA1(\'some boring text\');\n+------------------------------------------+\n| SHA1(\'some boring text\') |\n+------------------------------------------+\n| af969fc2085b1bb6d31e517d5c456def5cdd7093 |\n+------------------------------------------+\n\nURL: https://mariadb.com/kb/en/sha1/','','https://mariadb.com/kb/en/sha1/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (138,12,'SHA2','Syntax\n------\n\nSHA2(str,hash_len)\n\nDescription\n-----------\n\nGiven a string str, calculates an SHA-2 checksum, which is considered more\ncryptographically secure than its SHA-1 equivalent. The SHA-2 family includes\nSHA-224, SHA-256, SHA-384, and SHA-512, and the hash_len must correspond to\none of these, i.e. 224, 256, 384 or 512. 0 is equivalent to 256.\n\nThe return value is a nonbinary string in the connection character set and\ncollation, determined by the values of the character_set_connection and\ncollation_connection system variables.\n\nNULL is returned if the hash length is not valid, or the string str is NULL.\n\nSHA2 will only work if MariaDB was has been configured with TLS support.\n\nExamples\n--------\n\nSELECT SHA2(\'Maria\',224);\n+----------------------------------------------------------+\n| SHA2(\'Maria\',224) |\n+----------------------------------------------------------+\n| 6cc67add32286412efcab9d0e1675a43a5c2ef3cec8879f81516ff83 |\n+----------------------------------------------------------+\n\nSELECT SHA2(\'Maria\',256);\n+------------------------------------------------------------------+\n| SHA2(\'Maria\',256) |\n+------------------------------------------------------------------+\n| 9ff18ebe7449349f358e3af0b57cf7a032c1c6b2272cb2656ff85eb112232f16 |\n+------------------------------------------------------------------+\n\nSELECT SHA2(\'Maria\',0);\n+------------------------------------------------------------------+\n| SHA2(\'Maria\',0) |\n+------------------------------------------------------------------+\n| 9ff18ebe7449349f358e3af0b57cf7a032c1c6b2272cb2656ff85eb112232f16 |\n+------------------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/sha2/','','https://mariadb.com/kb/en/sha2/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (139,13,'ENDPOINT','A synonym for ST_ENDPOINT.\n\nURL: https://mariadb.com/kb/en/linestring-properties-endpoint/','','https://mariadb.com/kb/en/linestring-properties-endpoint/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (140,13,'GLENGTH','Syntax\n------\n\nGLength(ls)\n\nDescription\n-----------\n\nReturns as a double-precision number the length of the LineString value ls in\nits associated spatial reference.\n\nExamples\n--------\n\nSET @ls = \'LineString(1 1,2 2,3 3)\';\n\nSELECT GLength(GeomFromText(@ls));\n+----------------------------+\n| GLength(GeomFromText(@ls)) |\n+----------------------------+\n| 2.82842712474619 |\n+----------------------------+\n\nURL: https://mariadb.com/kb/en/glength/','','https://mariadb.com/kb/en/glength/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (141,13,'NumPoints','A synonym for ST_NumPoints.\n\nURL: https://mariadb.com/kb/en/linestring-properties-numpoints/','','https://mariadb.com/kb/en/linestring-properties-numpoints/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (142,13,'PointN','A synonym for ST_PointN.\n\nURL: https://mariadb.com/kb/en/linestring-properties-pointn/','','https://mariadb.com/kb/en/linestring-properties-pointn/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (143,13,'STARTPOINT','A synonym for ST_STARTPOINT.\n\nURL: https://mariadb.com/kb/en/linestring-properties-startpoint/','','https://mariadb.com/kb/en/linestring-properties-startpoint/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (144,13,'ST_ENDPOINT','Syntax\n------\n\nST_EndPoint(ls)\nEndPoint(ls)\n\nDescription\n-----------\n\nReturns the Point that is the endpoint of the LineString value ls.\n\nST_EndPoint() and EndPoint() are synonyms.\n\nExamples\n--------\n\nSET @ls = \'LineString(1 1,2 2,3 3)\';\n\nSELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_endpoint/','','https://mariadb.com/kb/en/st_endpoint/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (145,13,'ST_NUMPOINTS','Syntax\n------\n\nST_NumPoints(ls)\nNumPoints(ls)\n\nDescription\n-----------\n\nReturns the number of Point objects in the LineString value ls.\n\nST_NumPoints() and NumPoints() are synonyms.\n\nExamples\n--------\n\nSET @ls = \'LineString(1 1,2 2,3 3)\';\n\nSELECT NumPoints(GeomFromText(@ls));\n+------------------------------+\n| NumPoints(GeomFromText(@ls)) |\n+------------------------------+\n| 3 |\n+------------------------------+\n\nURL: https://mariadb.com/kb/en/st_numpoints/','','https://mariadb.com/kb/en/st_numpoints/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (146,13,'ST_POINTN','Syntax\n------\n\nST_PointN(ls,N)\nPointN(ls,N)\n\nDescription\n-----------\n\nReturns the N-th Point in the LineString value ls. Points are numbered\nbeginning with 1.\n\nST_PointN() and PointN() are synonyms.\n\nExamples\n--------\n\nSET @ls = \'LineString(1 1,2 2,3 3)\';\n\nSELECT AsText(PointN(GeomFromText(@ls),2));\n+-------------------------------------+\n| AsText(PointN(GeomFromText(@ls),2)) |\n+-------------------------------------+\n| POINT(2 2) |\n+-------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_pointn/','','https://mariadb.com/kb/en/st_pointn/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (147,13,'ST_STARTPOINT','Syntax\n------\n\nST_StartPoint(ls)\nStartPoint(ls)\n\nDescription\n-----------\n\nReturns the Point that is the start point of the LineString value ls.\n\nST_StartPoint() and StartPoint() are synonyms.\n\nExamples\n--------\n\nSET @ls = \'LineString(1 1,2 2,3 3)\';\n\nSELECT AsText(StartPoint(GeomFromText(@ls)));\n+---------------------------------------+\n| AsText(StartPoint(GeomFromText(@ls))) |\n+---------------------------------------+\n| POINT(1 1) |\n+---------------------------------------+\n\nURL: https://mariadb.com/kb/en/st_startpoint/','','https://mariadb.com/kb/en/st_startpoint/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (148,14,'GET_LOCK','Syntax\n------\n\nGET_LOCK(str,timeout)\n\nDescription\n-----------\n\nTries to obtain a lock with a name given by the string str, using a timeout of\ntimeout seconds. Returns 1 if the lock was obtained successfully, 0 if the\nattempt timed out (for example, because another client has previously locked\nthe name), or NULL if an error occurred (such as running out of memory or the\nthread was killed with mysqladmin kill).\n\nA lock is released with RELEASE_LOCK(), when the connection terminates (either\nnormally or abnormally). A connection can hold multiple locks at the same\ntime, so a lock that is no longer needed needs to be explicitly released.\n\nThe IS_FREE_LOCK function returns whether a specified lock a free or not, and\nthe IS_USED_LOCK whether the function is in use or not.\n\nLocks obtained with GET_LOCK() do not interact with transactions. That is,\ncommitting a transaction does not release any such locks obtained during the\ntransaction.\n\nIt is also possible to recursively set the same lock. If a lock with the same\nname is set n times, it needs to be released n times as well.\n\nstr is case insensitive for GET_LOCK() and related functions. If str is an\nempty string or NULL, GET_LOCK() returns NULL and does nothing. From MariaDB\n10.2.2, timeout supports microseconds. Before then, it was rounded to the\nclosest integer.\n\nIf the metadata_lock_info plugin is installed, locks acquired with this\nfunction are visible in the Information Schema METADATA_LOCK_INFO table.\n\nThis function can be used to implement application locks or to simulate record\nlocks. Names are locked on a server-wide basis. If a name has been locked by\none client, GET_LOCK() blocks any request by another client for a lock with\nthe same name. This allows clients that agree on a given lock name to use the\nname to perform cooperative advisory locking. But be aware that it also allows\na client that is not among the set of cooperating clients to lock a name,\neither inadvertently or deliberately, and thus prevent any of the cooperating\nclients from locking that name. One way to reduce the likelihood of this is to\nuse lock names that are database-specific or application-specific. For\nexample, use lock names of the form db_name.str or app_name.str.\n\nStatements using the GET_LOCK function are not safe for statement-based\nreplication.\n\nThe patch to permit multiple locks was contributed by Konstantin \"Kostja\"\nOsipov (MDEV-3917).\n\nExamples\n--------\n\nSELECT GET_LOCK(\'lock1\',10);\n+----------------------+\n| GET_LOCK(\'lock1\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n\nSELECT IS_FREE_LOCK(\'lock1\'), IS_USED_LOCK(\'lock1\');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(\'lock1\') | IS_USED_LOCK(\'lock1\') |\n+-----------------------+-----------------------+\n| 0 | 46 |\n+-----------------------+-----------------------+\n\nSELECT IS_FREE_LOCK(\'lock2\'), IS_USED_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(\'lock2\') | IS_USED_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| 1 | NULL |\n+-----------------------+-----------------------+\n\nMultiple locks can be held:\n\nSELECT GET_LOCK(\'lock2\',10);\n+----------------------+\n| GET_LOCK(\'lock2\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n\nSELECT IS_FREE_LOCK(\'lock1\'), IS_FREE_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| IS_FREE_LOCK(\'lock1\') | IS_FREE_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| 0 | 0 |\n+-----------------------+-----------------------+\n\nSELECT RELEASE_LOCK(\'lock1\'), RELEASE_LOCK(\'lock2\');\n+-----------------------+-----------------------+\n| RELEASE_LOCK(\'lock1\') | RELEASE_LOCK(\'lock2\') |\n+-----------------------+-----------------------+\n| 1 | 1 |\n+-----------------------+-----------------------+\n\nIt is possible to hold the same lock recursively. This example is viewed using\nthe metadata_lock_info plugin:\n\nSELECT GET_LOCK(\'lock3\',10);\n+----------------------+\n| GET_LOCK(\'lock3\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n\nSELECT GET_LOCK(\'lock3\',10);\n+----------------------+\n| GET_LOCK(\'lock3\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n\nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n+-----------+---------------------+---------------+-----------+--------------+-\n----------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE | TABLE_SCHEMA |\nTABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+-\n----------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 |\n |\n+-----------+---------------------+---------------+-----------+--------------+-\n----------+\n\nSELECT RELEASE_LOCK(\'lock3\');\n+-----------------------+\n| RELEASE_LOCK(\'lock3\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n\nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n+-----------+---------------------+---------------+-----------+--------------+-\n----------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE | TABLE_SCHEMA |\nTABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+-\n----------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 |\n |\n+-----------+---------------------+---------------+-----------+--------------+-\n----------+\n\nSELECT RELEASE_LOCK(\'lock3\');\n+-----------------------+\n| RELEASE_LOCK(\'lock3\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n\nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\nEmpty set (0.000 sec)\n\nTimeout example: Connection 1:\n\nSELECT GET_LOCK(\'lock4\',10);\n+----------------------+\n| GET_LOCK(\'lock4\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n\nConnection 2:\n\nSELECT GET_LOCK(\'lock4\',10);\n\nAfter 10 seconds...\n\n+----------------------+\n| GET_LOCK(\'lock4\',10) |\n+----------------------+\n| 0 |\n+----------------------+\n\nDeadlocks are automatically detected and resolved. Connection 1:\n\nSELECT GET_LOCK(\'lock5\',10); \n+----------------------+\n| GET_LOCK(\'lock5\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n\nConnection 2:\n\nSELECT GET_LOCK(\'lock6\',10);\n+----------------------+\n| GET_LOCK(\'lock6\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n\nConnection 1:\n\nSELECT GET_LOCK(\'lock6\',10); \n+----------------------+\n| GET_LOCK(\'lock6\',10) |\n+----------------------+\n| 0 |\n+----------------------+\n\nConnection 2:\n\nSELECT GET_LOCK(\'lock5\',10);\nERROR 1213 (40001): Deadlock found when trying to get lock; try restarting\ntransaction\n\nURL: https://mariadb.com/kb/en/get_lock/','','https://mariadb.com/kb/en/get_lock/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (149,14,'INET6_ATON','Syntax\n------\n\nINET6_ATON(expr)\n\nDescription\n-----------\n\nGiven an IPv6 or IPv4 network address as a string, returns a binary string\nthat represents the numeric value of the address.\n\nNo trailing zone ID\'s or traling network masks are permitted. For IPv4\naddresses, or IPv6 addresses with IPv4 address parts, no classful addresses or\ntrailing port numbers are permitted and octal numbers are not supported.\n\nThe returned binary string will be VARBINARY(16) or VARBINARY(4) for IPv6 and\nIPv4 addresses respectively.\n\nReturns NULL if the argument is not understood.\n\nMariaDB starting with 10.5.0\n----------------------------\nFrom MariaDB 10.5.0, INET6_ATON can take INET6 as an argument.\n\nExamples\n--------\n\nSELECT HEX(INET6_ATON(\'10.0.1.1\'));\n+-----------------------------+\n| HEX(INET6_ATON(\'10.0.1.1\')) |\n+-----------------------------+\n| 0A000101 |\n+-----------------------------+\n\nSELECT HEX(INET6_ATON(\'48f3::d432:1431:ba23:846f\'));\n+----------------------------------------------+\n| HEX(INET6_ATON(\'48f3::d432:1431:ba23:846f\')) |\n+----------------------------------------------+\n| 48F3000000000000D4321431BA23846F |\n+----------------------------------------------+\n\nURL: https://mariadb.com/kb/en/inet6_aton/','','https://mariadb.com/kb/en/inet6_aton/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (150,14,'INET6_NTOA','Syntax\n------\n\nINET6_NTOA(expr)\n\nDescription\n-----------\n\nGiven an IPv6 or IPv4 network address as a numeric binary string, returns the\naddress as a nonbinary string in the connection character set.\n\nThe return string is lowercase, and is platform independent, since it does not\nuse functions specific to the operating system. It has a maximum length of 39\ncharacters.\n\nReturns NULL if the argument is not understood.\n\nExamples\n--------\n\nSELECT INET6_NTOA(UNHEX(\'0A000101\'));\n+-------------------------------+\n| INET6_NTOA(UNHEX(\'0A000101\')) |\n+-------------------------------+\n| 10.0.1.1 |\n+-------------------------------+\n\nSELECT INET6_NTOA(UNHEX(\'48F3000000000000D4321431BA23846F\'));\n+-------------------------------------------------------+\n| INET6_NTOA(UNHEX(\'48F3000000000000D4321431BA23846F\')) |\n+-------------------------------------------------------+\n| 48f3::d432:1431:ba23:846f |\n+-------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/inet6_ntoa/','','https://mariadb.com/kb/en/inet6_ntoa/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (151,14,'INET_ATON','Syntax\n------\n\nINET_ATON(expr)\n\nDescription\n-----------\n\nGiven the dotted-quad representation of an IPv4 network address as a string,\nreturns an integer that represents the numeric value of the address. Addresses\nmay be 4- or 8-byte addresses.\n\nReturns NULL if the argument is not understood.\n\nExamples\n--------\n\nSELECT INET_ATON(\'192.168.1.1\');\n+--------------------------+\n| INET_ATON(\'192.168.1.1\') |\n+--------------------------+\n| 3232235777 |\n+--------------------------+\n\nThis is calculated as follows: 192 x 2563 + 168 x 256 2 + 1 x 256 + 1\n\nURL: https://mariadb.com/kb/en/inet_aton/','','https://mariadb.com/kb/en/inet_aton/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (152,14,'INET_NTOA','Syntax\n------\n\nINET_NTOA(expr)\n\nDescription\n-----------\n\nGiven a numeric IPv4 network address in network byte order (4 or 8 byte),\nreturns the dotted-quad representation of the address as a string.\n\nExamples\n--------\n\nSELECT INET_NTOA(3232235777);\n+-----------------------+\n| INET_NTOA(3232235777) |\n+-----------------------+\n| 192.168.1.1 |\n+-----------------------+\n\n192.168.1.1 corresponds to 3232235777 since 192 x 2563 + 168 x 256 2 + 1 x 256\n+ 1 = 3232235777\n\nURL: https://mariadb.com/kb/en/inet_ntoa/','','https://mariadb.com/kb/en/inet_ntoa/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (153,14,'IS_FREE_LOCK','Syntax\n------\n\nIS_FREE_LOCK(str)\n\nDescription\n-----------\n\nChecks whether the lock named str is free to use (that is, not locked).\nReturns 1 if the lock is free (no one is using the lock), 0 if the lock is in\nuse, and NULL if an error occurs (such as an incorrect argument, like an empty\nstring or NULL). str is case insensitive.\n\nIf the metadata_lock_info plugin is installed, the Information Schema\nmetadata_lock_info table contains information about locks of this kind (as\nwell as metadata locks).\n\nStatements using the IS_FREE_LOCK function are not safe for statement-based\nreplication.\n\nURL: https://mariadb.com/kb/en/is_free_lock/','','https://mariadb.com/kb/en/is_free_lock/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (154,14,'IS_IPV4','Syntax\n------\n\nIS_IPV4(expr)\n\nDescription\n-----------\n\nIf the expression is a valid IPv4 address, returns 1, otherwise returns 0.\n\nIS_IPV4() is stricter than INET_ATON(), but as strict as INET6_ATON(), in\ndetermining the validity of an IPv4 address. This implies that if IS_IPV4\nreturns 1, the same expression will always return a non-NULL result when\npassed to INET_ATON(), but that the reverse may not apply.\n\nExamples\n--------\n\nSELECT IS_IPV4(\'1110.0.1.1\');\n+-----------------------+\n| IS_IPV4(\'1110.0.1.1\') |\n+-----------------------+\n| 0 |\n+-----------------------+\n\nSELECT IS_IPV4(\'48f3::d432:1431:ba23:846f\');\n+--------------------------------------+\n| IS_IPV4(\'48f3::d432:1431:ba23:846f\') |\n+--------------------------------------+\n| 0 |\n+--------------------------------------+\n\nURL: https://mariadb.com/kb/en/is_ipv4/','','https://mariadb.com/kb/en/is_ipv4/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (155,14,'IS_IPV4_COMPAT','Syntax\n------\n\nIS_IPV4_COMPAT(expr)\n\nDescription\n-----------\n\nReturns 1 if a given numeric binary string IPv6 address, such as returned by\nINET6_ATON(), is IPv4-compatible, otherwise returns 0.\n\nMariaDB starting with 10.5.0\n----------------------------\nFrom MariaDB 10.5.0, when the argument is not INET6, automatic implicit CAST\nto INET6 is applied. As a consequence, IS_IPV4_COMPAT now understands\narguments in both text representation and binary(16) representation. Before\nMariaDB 10.5.0, the function understood only binary(16) representation.\n\nExamples\n--------\n\nSELECT IS_IPV4_COMPAT(INET6_ATON(\'::10.0.1.1\'));\n+------------------------------------------+\n| IS_IPV4_COMPAT(INET6_ATON(\'::10.0.1.1\')) |\n+------------------------------------------+\n| 1 |\n+------------------------------------------+\n\nSELECT IS_IPV4_COMPAT(INET6_ATON(\'::48f3::d432:1431:ba23:846f\'));\n+-----------------------------------------------------------+\n| IS_IPV4_COMPAT(INET6_ATON(\'::48f3::d432:1431:ba23:846f\')) |\n+-----------------------------------------------------------+\n| 0 |\n+-----------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/is_ipv4_compat/','','https://mariadb.com/kb/en/is_ipv4_compat/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (156,14,'IS_IPV4_MAPPED','Syntax\n------\n\nIS_IPV4_MAPPED(expr)\n\nDescription\n-----------\n\nReturns 1 if a given a numeric binary string IPv6 address, such as returned by\nINET6_ATON(), is a valid IPv4-mapped address, otherwise returns 0.\n\nMariaDB starting with 10.5.0\n----------------------------\nFrom MariaDB 10.5.0, when the argument is not INET6, automatic implicit CAST\nto INET6 is applied. As a consequence, IS_IPV4_MAPPED now understands\narguments in both text representation and binary(16) representation. Before\nMariaDB 10.5.0, the function understood only binary(16) representation.\n\nExamples\n--------\n\nSELECT IS_IPV4_MAPPED(INET6_ATON(\'::10.0.1.1\'));\n+------------------------------------------+\n| IS_IPV4_MAPPED(INET6_ATON(\'::10.0.1.1\')) |\n+------------------------------------------+\n| 0 |\n+------------------------------------------+\n\nSELECT IS_IPV4_MAPPED(INET6_ATON(\'::ffff:10.0.1.1\'));\n+-----------------------------------------------+\n| IS_IPV4_MAPPED(INET6_ATON(\'::ffff:10.0.1.1\')) |\n+-----------------------------------------------+\n| 1 |\n+-----------------------------------------------+\n\nURL: https://mariadb.com/kb/en/is_ipv4_mapped/','','https://mariadb.com/kb/en/is_ipv4_mapped/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (157,14,'IS_IPV6','Syntax\n------\n\nIS_IPV6(expr)\n\nDescription\n-----------\n\nReturns 1 if the expression is a valid IPv6 address specified as a string,\notherwise returns 0. Does not consider IPv4 addresses to be valid IPv6\naddresses.\n\nExamples\n--------\n\nSELECT IS_IPV6(\'48f3::d432:1431:ba23:846f\');\n+--------------------------------------+\n| IS_IPV6(\'48f3::d432:1431:ba23:846f\') |\n+--------------------------------------+\n| 1 |\n+--------------------------------------+\n1 row in set (0.02 sec)\n\nSELECT IS_IPV6(\'10.0.1.1\');\n+---------------------+\n| IS_IPV6(\'10.0.1.1\') |\n+---------------------+\n| 0 |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/is_ipv6/','','https://mariadb.com/kb/en/is_ipv6/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (158,14,'IS_USED_LOCK','Syntax\n------\n\nIS_USED_LOCK(str)\n\nDescription\n-----------\n\nChecks whether the lock named str is in use (that is, locked). If so, it\nreturns the connection identifier of the client that holds the lock.\nOtherwise, it returns NULL. str is case insensitive.\n\nIf the metadata_lock_info plugin is installed, the Information Schema\nmetadata_lock_info table contains information about locks of this kind (as\nwell as metadata locks).\n\nStatements using the IS_USED_LOCK function are not safe for statement-based\nreplication.\n\nURL: https://mariadb.com/kb/en/is_used_lock/','','https://mariadb.com/kb/en/is_used_lock/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (159,14,'MASTER_GTID_WAIT','Syntax\n------\n\nMASTER_GTID_WAIT(gtid-list[, timeout)\n\nDescription\n-----------\n\nThis function takes a string containing a comma-separated list of global\ntransaction id\'s (similar to the value of, for example, gtid_binlog_pos). It\nwaits until the value of gtid_slave_pos has the same or higher seq_no within\nall replication domains specified in the gtid-list; in other words, it waits\nuntil the slave has reached the specified GTID position.\n\nAn optional second argument gives a timeout in seconds. If the timeout expires\nbefore the specified GTID position is reached, then the function returns -1.\nPassing NULL or a negative number for the timeout means no timeout, and the\nfunction will wait indefinitely.\n\nIf the wait completes without a timeout, 0 is returned. Passing NULL for the\ngtid-list makes the function return NULL immediately, without waiting.\n\nThe gtid-list may be the empty string, in which case MASTER_GTID_WAIT()\nreturns immediately. If the gtid-list contains fewer domains than\ngtid_slave_pos, then only those domains are waited upon. If gtid-list contains\na domain that is not present in @@gtid_slave_pos, then MASTER_GTID_WAIT() will\nwait until an event containing such domain_id arrives on the slave (or until\ntimed out or killed).\n\nMASTER_GTID_WAIT() can be useful to ensure that a slave has caught up to a\nmaster. Simply take the value of gtid_binlog_pos on the master, and use it in\na MASTER_GTID_WAIT() call on the slave; when the call completes, the slave\nwill have caught up with that master position.\n\nMASTER_GTID_WAIT() can also be used in client applications together with the\nlast_gtid session variable. This is useful in a read-scaleout replication\nsetup, where the application writes to a single master but divides the reads\nout to a number of slaves to distribute the load. In such a setup, there is a\nrisk that an application could first do an update on the master, and then a\nbit later do a read on a slave, and if the slave is not fast enough, the data\nread from the slave might not include the update just made, possibly confusing\nthe application and/or the end-user. One way to avoid this is to request the\nvalue of last_gtid on the master just after the update. Then before doing the\nread on the slave, do a MASTER_GTID_WAIT() on the value obtained from the\nmaster; this will ensure that the read is not performed until the slave has\nreplicated sufficiently far for the update to have become visible.\n\nNote that MASTER_GTID_WAIT() can be used even if the slave is configured not\nto use GTID for connections (CHANGE MASTER TO master_use_gtid=no). This is\nbecause from MariaDB 10, GTIDs are always logged on the master server, and\nalways recorded on the slave servers.\n\nDifferences to MASTER_POS_WAIT()\n--------------------------------\n\n* MASTER_GTID_WAIT() is global; it waits for any master connection to reach\n the specified GTID position. MASTER_POS_WAIT() works only against a\n specific connection. This also means that while MASTER_POS_WAIT() aborts if\n its master connection is terminated with STOP SLAVE or due to an error,\n MASTER_GTID_WAIT() continues to wait while slaves are stopped.\n\n* MASTER_GTID_WAIT() can take its timeout as a floating-point value, so a\n timeout in fractional seconds is supported, eg. MASTER_GTID_WAIT(\"0-1-100\",\n 0.5). (The minimum wait is one microsecond, 0.000001 seconds).\n\n* MASTER_GTID_WAIT() allows one to specify a timeout of zero in order to do a\n non-blocking check to see if the slaves have progressed to a specific GTID\nposition\n (MASTER_POS_WAIT() takes a zero timeout as meaning an infinite wait). To do\n an infinite MASTER_GTID_WAIT(), specify a negative timeout, or omit the\n timeout argument.\n\n* MASTER_GTID_WAIT() does not return the number of events executed since the\n wait started, nor does it return NULL if a slave thread is stopped. It\n always returns either 0 for successful wait completed, or -1 for timeout\n reached (or NULL if the specified gtid-pos is NULL).\n\nSince MASTER_GTID_WAIT() looks only at the seq_no part of the GTIDs, not the\nserver_id, care is needed if a slave becomes diverged from another server so\nthat two different GTIDs with the same seq_no (in the same domain) arrive at\nthe same server. This situation is in any case best avoided; setting\ngtid_strict_mode is recommended, as this will prevent any such out-of-order\nsequence numbers from ever being replicated on a slave.\n\nURL: https://mariadb.com/kb/en/master_gtid_wait/','','https://mariadb.com/kb/en/master_gtid_wait/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (160,14,'MASTER_POS_WAIT','Syntax\n------\n\nMASTER_POS_WAIT(log_name,log_pos[,timeout,[\"connection_name\"]])\n\nDescription\n-----------\n\nThis function is useful in replication for controlling primary/replica\nsynchronization. It blocks until the replica has read and applied all updates\nup to the specified position (log_name,log_pos) in the primary log. The return\nvalue is the number of log events the replica had to wait for to advance to\nthe specified position. The function returns NULL if the replica SQL thread is\nnot started, the replica\'s primary information is not initialized, the\narguments are incorrect, or an error occurs. It returns -1 if the timeout has\nbeen exceeded. If the replica SQL thread stops while MASTER_POS_WAIT() is\nwaiting, the function returns NULL. If the replica is past the specified\nposition, the function returns immediately.\n\nIf a timeout value is specified, MASTER_POS_WAIT() stops waiting when timeout\nseconds have elapsed. timeout must be greater than 0; a zero or negative\ntimeout means no timeout.\n\nThe connection_name is used when you are using multi-source-replication. If\nyou don\'t specify it, it\'s set to the value of the default_master_connection\nsystem variable.\n\nStatements using the MASTER_POS_WAIT() function are not safe for replication.\n\nURL: https://mariadb.com/kb/en/master_pos_wait/','','https://mariadb.com/kb/en/master_pos_wait/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (161,14,'NAME_CONST','Syntax\n------\n\nNAME_CONST(name,value)\n\nDescription\n-----------\n\nReturns the given value. When used to produce a result set column,\nNAME_CONST() causes the column to have the given name. The arguments should be\nconstants.\n\nThis function is used internally when replicating stored procedures. It makes\nlittle sense to use it explicitly in SQL statements, and it was not supposed\nto be used like that.\n\nSELECT NAME_CONST(\'myname\', 14);\n+--------+\n| myname |\n+--------+\n| 14 |\n+--------+\n\nURL: https://mariadb.com/kb/en/name_const/','','https://mariadb.com/kb/en/name_const/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (162,14,'RELEASE_ALL_LOCKS','MariaDB until 10.5.2\n--------------------\nRELEASE_ALL_LOCKS was added in MariaDB 10.5.2.\n\nSyntax\n------\n\nRELEASE_ALL_LOCKS()\n\nDescription\n-----------\n\nReleases all named locks held by the current session. Returns the number of\nlocks released, or 0 if none were held.\n\nStatements using the RELEASE_ALL_LOCKS function are not safe for\nstatement-based replication.\n\nExamples\n--------\n\nSELECT RELEASE_ALL_LOCKS();\n+---------------------+\n| RELEASE_ALL_LOCKS() | \n+---------------------+\n| 0 |\n+---------------------+\n\nSELECT GET_LOCK(\'lock1\',10);\n+----------------------+\n| GET_LOCK(\'lock1\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n\nSELECT RELEASE_ALL_LOCKS();\n+---------------------+\n| RELEASE_ALL_LOCKS() | \n+---------------------+\n| 1 |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/release_all_locks/','','https://mariadb.com/kb/en/release_all_locks/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (163,14,'RELEASE_LOCK','Syntax\n------\n\nRELEASE_LOCK(str)\n\nDescription\n-----------\n\nReleases the lock named by the string str that was obtained with GET_LOCK().\nReturns 1 if the lock was released, 0 if the lock was not established by this\nthread (in which case the lock is not released), and NULL if the named lock\ndid not exist. The lock does not exist if it was never obtained by a call to\nGET_LOCK() or if it has previously been released.\n\nstr is case insensitive. If str is an empty string or NULL, RELEASE_LOCK()\nreturns NULL and does nothing.\n\nStatements using the RELEASE_LOCK() function are not safe for replication.\n\nThe DO statement is convenient to use with RELEASE_LOCK().\n\nExamples\n--------\n\nConnection1:\n\nSELECT GET_LOCK(\'lock1\',10);\n+----------------------+\n| GET_LOCK(\'lock1\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n\nConnection 2:\n\nSELECT GET_LOCK(\'lock2\',10);\n+----------------------+\n| GET_LOCK(\'lock2\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n\nConnection 1:\n\nSELECT RELEASE_LOCK(\'lock1\'), RELEASE_LOCK(\'lock2\'), RELEASE_LOCK(\'lock3\');\n+-----------------------+-----------------------+-----------------------+\n| RELEASE_LOCK(\'lock1\') | RELEASE_LOCK(\'lock2\') | RELEASE_LOCK(\'lock3\') |\n+-----------------------+-----------------------+-----------------------+\n| 1 | 0 | NULL |\n+-----------------------+-----------------------+-----------------------+\n\nFrom MariaDB 10.0.2, it is possible to hold the same lock recursively. This\nexample is viewed using the metadata_lock_info plugin:\n\nSELECT GET_LOCK(\'lock3\',10);\n+----------------------+\n| GET_LOCK(\'lock3\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n\nSELECT GET_LOCK(\'lock3\',10);\n+----------------------+\n| GET_LOCK(\'lock3\',10) |\n+----------------------+\n| 1 |\n+----------------------+\n\nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n+-----------+---------------------+---------------+-----------+--------------+-\n----------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE | TABLE_SCHEMA |\nTABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+-\n----------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 |\n |\n+-----------+---------------------+---------------+-----------+--------------+-\n----------+\n\nSELECT RELEASE_LOCK(\'lock3\');\n+-----------------------+\n| RELEASE_LOCK(\'lock3\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n\nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\n+-----------+---------------------+---------------+-----------+--------------+-\n----------+\n| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE | TABLE_SCHEMA |\nTABLE_NAME |\n+-----------+---------------------+---------------+-----------+--------------+-\n----------+\n| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 |\n |\n+-----------+---------------------+---------------+-----------+--------------+-\n----------+\n\nSELECT RELEASE_LOCK(\'lock3\');\n+-----------------------+\n| RELEASE_LOCK(\'lock3\') |\n+-----------------------+\n| 1 |\n+-----------------------+\n\nSELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;\nEmpty set (0.000 sec)\n\nURL: https://mariadb.com/kb/en/release_lock/','','https://mariadb.com/kb/en/release_lock/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (164,14,'SLEEP','Syntax\n------\n\nSLEEP(duration)\n\nDescription\n-----------\n\nSleeps (pauses) for the number of seconds given by the duration argument, then\nreturns 0. If SLEEP() is interrupted, it returns 1. The duration may have a\nfractional part given in microseconds.\n\nStatements using the SLEEP() function are not safe for replication.\n\nExample\n-------\n\nSELECT SLEEP(5.5);\n+------------+\n| SLEEP(5.5) |\n+------------+\n| 0 |\n+------------+\n1 row in set (5.50 sec)\n\nURL: https://mariadb.com/kb/en/sleep/','','https://mariadb.com/kb/en/sleep/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (165,14,'SYS_GUID','MariaDB starting with 10.6.1\n----------------------------\nThe SYS_GUID function was introduced in MariaDB 10.6.1 to enhance Oracle\ncompatibility. Similar functionality can be achieved with the UUID function.\n\nSyntax\n------\n\nSYS_GUID()\n\nDescription\n-----------\n\nReturns a 16-byte globally unique identifier (GUID), similar to the UUID\nfunction, but without the - character.\n\nExample\n-------\n\nSELECT SYS_GUID();\n+----------------------------------+\n| SYS_GUID() |\n+----------------------------------+\n| 2C574E45BA2811EBB265F859713E4BE4 |\n+----------------------------------+\n\nURL: https://mariadb.com/kb/en/sys_guid/','','https://mariadb.com/kb/en/sys_guid/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (166,14,'UUID','Syntax\n------\n\nUUID()\n\nDescription\n-----------\n\nReturns a Universally Unique Identifier (UUID).\n\nA UUID is designed as a number that is globally unique in space and time. Two\ncalls to UUID() are expected to generate two different values, even if these\ncalls are performed on two separate computers that are not connected to each\nother.\n\nUUID() results are intended to be unique, but cannot always be relied upon to\nunpredictable and unguessable, so should not be relied upon for these purposes.\n\nA UUID is a 128-bit number represented by a utf8 string of five hexadecimal\nnumbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee format:\n\n* The first three numbers are generated from a timestamp.\n* The fourth number preserves temporal uniqueness in case the timestamp value\n loses monotonicity (for example, due to daylight saving time).\n* The fifth number is an IEEE 802 node number that provides spatial uniqueness.\n A random number is substituted if the latter is not available (for example,\n because the host computer has no Ethernet card, or we do not know how to find\n the hardware address of an interface on your operating system). In this case,\n spatial uniqueness cannot be guaranteed. Nevertheless, a collision should\n have very low probability.\n\nCurrently, the MAC address of an interface is taken into account only on\nFreeBSD and Linux. On other operating systems, MariaDB uses a randomly\ngenerated 48-bit number.\n\nStatements using the UUID() function are not safe for replication.\n\nThe results are generated according to the \"DCE 1.1:Remote Procedure Call\"\n(Appendix A) CAE (Common Applications Environment) Specifications published by\nThe Open Group in October 1997 (Document Number C706).\n\nExamples\n--------\n\nSELECT UUID();\n+--------------------------------------+\n| UUID() |\n+--------------------------------------+\n| cd41294a-afb0-11df-bc9b-00241dd75637 |\n+--------------------------------------+\n\nURL: https://mariadb.com/kb/en/uuid/','','https://mariadb.com/kb/en/uuid/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (167,14,'UUID_SHORT','Syntax\n------\n\nUUID_SHORT()\n\nDescription\n-----------\n\nReturns a \"short\" universally unique identifier as a 64-bit unsigned integer\n(rather than a string-form 128-bit identifier as returned by the UUID()\nfunction).\n\nThe value of UUID_SHORT() is guaranteed to be unique if the following\nconditions hold:\n\n* The server_id of the current host is unique among your set of master and\n slave servers\n* server_id is between 0 and 255\n* You don\'t set back your system time for your server between mysqld restarts\n* You do not invoke UUID_SHORT() on average more than 16\n million times per second between mysqld restarts\n\nThe UUID_SHORT() return value is constructed this way:\n\n(server_id & 255) << 56\n+ (server_startup_time_in_seconds << 24)\n+ incremented_variable++;\n\nStatements using the UUID_SHORT() function are not safe for statement-based\nreplication.\n\nExamples\n--------\n\nSELECT UUID_SHORT();\n+-------------------+\n| UUID_SHORT() |\n+-------------------+\n| 21517162376069120 |\n+-------------------+\n\ncreate table t1 (a bigint unsigned default(uuid_short()) primary key);\ninsert into t1 values(),();\nselect * from t1;\n+-------------------+\n| a |\n+-------------------+\n| 98113699159474176 |\n| 98113699159474177 |\n+-------------------+\n\nURL: https://mariadb.com/kb/en/uuid_short/','','https://mariadb.com/kb/en/uuid_short/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (168,14,'VALUES / VALUE','Syntax\n------\n\nMariaDB starting with 10.3.3\n----------------------------\n\nVALUE(col_name)\n\nMariaDB until 10.3.2\n--------------------\n\nVALUES(col_name)\n\nDescription\n-----------\n\nIn an INSERT ... ON DUPLICATE KEY UPDATE statement, you can use the\nVALUES(col_name) function in the UPDATE clause to refer to column values from\nthe INSERT portion of the statement. In other words, VALUES(col_name) in the\nUPDATE clause refers to the value of col_name that would be inserted, had no\nduplicate-key conflict occurred. This function is especially useful in\nmultiple-row inserts.\n\nThe VALUES() function is meaningful only in INSERT ... ON DUPLICATE KEY UPDATE\nstatements and returns NULL otherwise.\n\nIn MariaDB 10.3.3 this function was renamed to VALUE(), because it\'s\nincompatible with the standard Table Value Constructors syntax, implemented in\nMariaDB 10.3.3.\n\nThe VALUES() function can still be used even from MariaDB 10.3.3, but only in\nINSERT ... ON DUPLICATE KEY UPDATE statements; it\'s a syntax error otherwise.\n\nExamples\n--------\n\nMariaDB starting with 10.3.3\n----------------------------\n\nINSERT INTO t (a,b,c) VALUES (1,2,3),(4,5,6)\n ON DUPLICATE KEY UPDATE c=VALUE(a)+VALUE(b);\n\nMariaDB until 10.3.2\n--------------------\n\nINSERT INTO t (a,b,c) VALUES (1,2,3),(4,5,6)\n ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);\n\nURL: https://mariadb.com/kb/en/values-value/','','https://mariadb.com/kb/en/values-value/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (169,15,'!','Syntax\n------\n\nNOT, !\n\nDescription\n-----------\n\nLogical NOT. Evaluates to 1 if the operand is 0, to 0 if the operand is\nnon-zero, and NOT NULL returns NULL.\n\nBy default, the ! operator has a higher precedence. If the HIGH_NOT_PRECEDENCE\nSQL_MODE flag is set, NOT and ! have the same precedence.\n\nExamples\n--------\n\nSELECT NOT 10;\n+--------+\n| NOT 10 |\n+--------+\n| 0 |\n+--------+\n\nSELECT NOT 0;\n+-------+\n| NOT 0 |\n+-------+\n| 1 |\n+-------+\n\nSELECT NOT NULL;\n+----------+\n| NOT NULL |\n+----------+\n| NULL |\n+----------+\n\nSELECT ! (1+1);\n+---------+\n| ! (1+1) |\n+---------+\n| 0 |\n+---------+\n\nSELECT ! 1+1;\n+-------+\n| ! 1+1 |\n+-------+\n| 1 |\n+-------+\n\nURL: https://mariadb.com/kb/en/not/','','https://mariadb.com/kb/en/not/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (170,15,'&&','Syntax\n------\n\nAND, &&\n\nDescription\n-----------\n\nLogical AND. Evaluates to 1 if all operands are non-zero and not NULL, to 0 if\none or more operands are 0, otherwise NULL is returned.\n\nFor this operator, short-circuit evaluation can be used.\n\nExamples\n--------\n\nSELECT 1 && 1;\n+--------+\n| 1 && 1 |\n+--------+\n| 1 |\n+--------+\n\nSELECT 1 && 0;\n+--------+\n| 1 && 0 |\n+--------+\n| 0 |\n+--------+\n\nSELECT 1 && NULL;\n+-----------+\n| 1 && NULL |\n+-----------+\n| NULL |\n+-----------+\n\nSELECT 0 && NULL;\n+-----------+\n| 0 && NULL |\n+-----------+\n| 0 |\n+-----------+\n\nSELECT NULL && 0;\n+-----------+\n| NULL && 0 |\n+-----------+\n| 0 |\n+-----------+\n\nURL: https://mariadb.com/kb/en/and/','','https://mariadb.com/kb/en/and/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (171,15,'XOR','Syntax\n------\n\nXOR\n\nDescription\n-----------\n\nXOR stands for eXclusive OR. Returns NULL if either operand is NULL. For\nnon-NULL operands, evaluates to 1 if an odd number of operands is non-zero,\notherwise 0 is returned.\n\nExamples\n--------\n\nSELECT 1 XOR 1;\n+---------+\n| 1 XOR 1 |\n+---------+\n| 0 |\n+---------+\n\nSELECT 1 XOR 0;\n+---------+\n| 1 XOR 0 |\n+---------+\n| 1 |\n+---------+\n\nSELECT 1 XOR NULL;\n+------------+\n| 1 XOR NULL |\n+------------+\n| NULL |\n+------------+\n\nIn the following example, the right 1 XOR 1 is evaluated first, and returns 0.\nThen, 1 XOR 0 is evaluated, and 1 is returned.\n\nSELECT 1 XOR 1 XOR 1;\n+---------------+\n| 1 XOR 1 XOR 1 |\n+---------------+\n| 1 |\n+---------------+\n\nURL: https://mariadb.com/kb/en/xor/','','https://mariadb.com/kb/en/xor/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (172,15,'||','Syntax\n------\n\nOR, ||\n\nDescription\n-----------\n\nLogical OR. When both operands are non-NULL, the result is 1 if any operand is\nnon-zero, and 0 otherwise. With a NULL operand, the result is 1 if the other\noperand is non-zero, and NULL otherwise. If both operands are NULL, the result\nis NULL.\n\nFor this operator, short-circuit evaluation can be used.\n\nNote that, if the PIPES_AS_CONCAT SQL_MODE is set, || is used as a string\nconcatenation operator. This means that a || b is the same as CONCAT(a,b). See\nCONCAT() for details.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, || ignores NULL.\n\nExamples\n--------\n\nSELECT 1 || 1;\n+--------+\n| 1 || 1 |\n+--------+\n| 1 |\n+--------+\n\nSELECT 1 || 0;\n+--------+\n| 1 || 0 |\n+--------+\n| 1 |\n+--------+\n\nSELECT 0 || 0;\n+--------+\n| 0 || 0 |\n+--------+\n| 0 |\n+--------+\n\nSELECT 0 || NULL;\n+-----------+\n| 0 || NULL |\n+-----------+\n| NULL |\n+-----------+\n\nSELECT 1 || NULL;\n+-----------+\n| 1 || NULL |\n+-----------+\n| 1 |\n+-----------+\n\nIn Oracle mode, from MariaDB 10.3:\n\nSELECT 0 || NULL;\n+-----------+\n| 0 || NULL |\n+-----------+\n| 0 |\n+-----------+\n\nURL: https://mariadb.com/kb/en/or/','','https://mariadb.com/kb/en/or/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (173,16,'Stored Aggregate Functions','MariaDB starting with 10.3.3\n----------------------------\nThe ability to create stored aggregate functions was added in MariaDB 10.3.3.\n\nAggregate functions are functions that are computed over a sequence of rows\nand return one result for the sequence of rows.\n\nCreating a custom aggregate function is done using the CREATE FUNCTION\nstatement with two main differences:\n\n* The addition of the AGGREGATE keyword, so CREATE AGGREGATE FUNCTION\n* The FETCH GROUP NEXT ROW instruction inside the loop\n* Oracle PL/SQL compatibility using SQL/PL is provided\n\nStandard Syntax\n---------------\n\nCREATE AGGREGATE FUNCTION function_name (parameters) RETURNS return_type\nBEGIN\n All types of declarations\n DECLARE CONTINUE HANDLER FOR NOT FOUND RETURN return_val;\n LOOP\n FETCH GROUP NEXT ROW; // fetches next row from table\n other instructions\n END LOOP;\nEND\n\nStored aggregate functions were a 2016 Google Summer of Code project by Varun\nGupta.\n\nUsing SQL/PL\n------------\n\nSET sql_mode=Oracle;\nDELIMITER //\n\nCREATE AGGREGATE FUNCTION function_name (parameters) RETURN return_type\n declarations\nBEGIN\n LOOP\n FETCH GROUP NEXT ROW; -- fetches next row from table\n -- other instructions\n\nEND LOOP;\nEXCEPTION\n WHEN NO_DATA_FOUND THEN\n RETURN return_val;\nEND //\n\nDELIMITER ;\n\nExamples\n--------\n\nFirst a simplified example:\n\nCREATE TABLE marks(stud_id INT, grade_count INT);\n\nINSERT INTO marks VALUES (1,6), (2,4), (3,7), (4,5), (5,8);\n\nSELECT * FROM marks;\n+---------+-------------+\n| stud_id | grade_count |\n+---------+-------------+\n| 1 | 6 |\n| 2 | 4 |\n| 3 | 7 |\n| 4 | 5 |\n| 5 | 8 |\n+---------+-------------+\n\nDELIMITER //\nCREATE AGGREGATE FUNCTION IF NOT EXISTS aggregate_count(x INT) RETURNS INT\nBEGIN\n DECLARE count_students INT DEFAULT 0;\n DECLARE CONTINUE HANDLER FOR NOT FOUND\n RETURN count_students;\n LOOP\n FETCH GROUP NEXT ROW;\n IF x THEN\n SET count_students = count_students+1;\n END IF;\n END LOOP;\nEND //\nDELIMITER ;\n\nA non-trivial example that cannot easily be rewritten using existing functions:\n\nDELIMITER //\nCREATE AGGREGATE FUNCTION medi_int(x INT) RETURNS DOUBLE\nBEGIN\n DECLARE CONTINUE HANDLER FOR NOT FOUND\n BEGIN\n DECLARE res DOUBLE;\n DECLARE cnt INT DEFAULT (SELECT COUNT(*) FROM tt);\n DECLARE lim INT DEFAULT (cnt-1) DIV 2;\n IF cnt % 2 = 0 THEN\n SET res = (SELECT AVG(a) FROM (SELECT a FROM tt ORDER BY a LIMIT\nlim,2) ttt);\n ELSE\n SET res = (SELECT a FROM tt ORDER BY a LIMIT lim,1);\n END IF;\n DROP TEMPORARY TABLE tt;\n RETURN res;\n END;\n CREATE TEMPORARY TABLE tt (a INT);\n LOOP\n FETCH GROUP NEXT ROW;\n INSERT INTO tt VALUES (x);\n END LOOP;\nEND //\nDELIMITER ;\n\nSQL/PL Example\n--------------\n\nThis uses the same marks table as created above.\n\nSET sql_mode=Oracle;\nDELIMITER //\n\nCREATE AGGREGATE FUNCTION aggregate_count(x INT) RETURN INT AS count_students\nINT DEFAULT 0;\nBEGIN\n LOOP\n FETCH GROUP NEXT ROW;\n IF x THEN\n SET count_students := count_students+1;\n END IF;\n END LOOP;\nEXCEPTION\n WHEN NO_DATA_FOUND THEN\n RETURN count_students;\nEND aggregate_count //\nDELIMITER ;\n\nSELECT aggregate_count(stud_id) FROM marks;\n\nURL: https://mariadb.com/kb/en/stored-aggregate-functions/','','https://mariadb.com/kb/en/stored-aggregate-functions/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (174,16,'AVG','Syntax\n------\n\nAVG([DISTINCT] expr)\n\nDescription\n-----------\n\nReturns the average value of expr. The DISTINCT option can be used to return\nthe average of the distinct values of expr. NULL values are ignored. It is an\naggregate function, and so can be used with the GROUP BY clause.\n\nAVG() returns NULL if there were no matching rows.\n\nAVG() can be used as a window function.\n\nExamples\n--------\n\nCREATE TABLE sales (sales_value INT);\n\nINSERT INTO sales VALUES(10),(20),(20),(40);\n\nSELECT AVG(sales_value) FROM sales;\n+------------------+\n| AVG(sales_value) |\n+------------------+\n| 22.5000 |\n+------------------+\n\nSELECT AVG(DISTINCT(sales_value)) FROM sales;\n+----------------------------+\n| AVG(DISTINCT(sales_value)) |\n+----------------------------+\n| 23.3333 |\n+----------------------------+\n\nCommonly, AVG() is used with a GROUP BY clause:\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT);\n\nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n\nSELECT name, AVG(score) FROM student GROUP BY name;\n+---------+------------+\n| name | AVG(score) |\n+---------+------------+\n| Chun | 74.0000 |\n| Esben | 37.0000 |\n| Kaolin | 72.0000 |\n| Tatiana | 85.0000 |\n+---------+------------+\n\nBe careful to avoid this common mistake, not grouping correctly and returning\nmismatched data:\n\nSELECT name,test,AVG(score) FROM student;\n+------+------+------------+\n| name | test | MIN(score) |\n+------+------+------------+\n| Chun | SQL | 31 |\n+------+------+------------+\n\nAs a window function:\n\nCREATE TABLE student_test (name CHAR(10), test CHAR(10), score TINYINT);\n\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n\nSELECT name, test, score, AVG(score) OVER (PARTITION BY test) \n AS average_by_test FROM student_test;\n+---------+--------+-------+-----------------+\n| name | test | score | average_by_test |\n+---------+--------+-------+-----------------+\n| Chun | SQL | 75 | 65.2500 |\n| Chun | Tuning | 73 | 68.7500 |\n| Esben | SQL | 43 | 65.2500 |\n| Esben | Tuning | 31 | 68.7500 |\n| Kaolin | SQL | 56 | 65.2500 |\n| Kaolin | Tuning | 88 | 68.7500 |\n| Tatiana | SQL | 87 | 65.2500 |\n| Tatiana | Tuning | 83 | 68.7500 |\n+---------+--------+-------+-----------------+\n\nURL: https://mariadb.com/kb/en/avg/','','https://mariadb.com/kb/en/avg/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (175,16,'BIT_AND','Syntax\n------\n\nBIT_AND(expr) [over_clause]\n\nDescription\n-----------\n\nReturns the bitwise AND of all bits in expr. The calculation is performed with\n64-bit (BIGINT) precision. It is an aggregate function, and so can be used\nwith the GROUP BY clause.\n\nIf no rows match, BIT_AND will return a value with all bits set to 1. NULL\nvalues have no effect on the result unless all results are NULL, which is\ntreated as no match.\n\nBIT_AND can be used as a window function with the addition of the over_clause.\n\nExamples\n--------\n\nCREATE TABLE vals (x INT);\n\nINSERT INTO vals VALUES(111),(110),(100);\n\nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n\nAs an aggregate function:\n\nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n\nINSERT INTO vals2 VALUES\n (\'a\',111),(\'a\',110),(\'a\',100),\n (\'b\',\'000\'),(\'b\',001),(\'b\',011);\n\nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+\n\nNo match:\n\nSELECT BIT_AND(NULL);\n+----------------------+\n| BIT_AND(NULL) |\n+----------------------+\n| 18446744073709551615 |\n+----------------------+\n\nURL: https://mariadb.com/kb/en/bit_and/','','https://mariadb.com/kb/en/bit_and/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (176,16,'BIT_OR','Syntax\n------\n\nBIT_OR(expr) [over_clause]\n\nDescription\n-----------\n\nReturns the bitwise OR of all bits in expr. The calculation is performed with\n64-bit (BIGINT) precision. It is an aggregate function, and so can be used\nwith the GROUP BY clause.\n\nIf no rows match, BIT_OR will return a value with all bits set to 0. NULL\nvalues have no effect on the result unless all results are NULL, which is\ntreated as no match.\n\nBIT_OR can be used as a window function with the addition of the over_clause.\n\nExamples\n--------\n\nCREATE TABLE vals (x INT);\n\nINSERT INTO vals VALUES(111),(110),(100);\n\nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n\nAs an aggregate function:\n\nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n\nINSERT INTO vals2 VALUES\n (\'a\',111),(\'a\',110),(\'a\',100),\n (\'b\',\'000\'),(\'b\',001),(\'b\',011);\n\nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+\n\nNo match:\n\nSELECT BIT_OR(NULL);\n+--------------+\n| BIT_OR(NULL) |\n+--------------+\n| 0 |\n+--------------+\n\nURL: https://mariadb.com/kb/en/bit_or/','','https://mariadb.com/kb/en/bit_or/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (177,16,'BIT_XOR','Syntax\n------\n\nBIT_XOR(expr) [over_clause]\n\nDescription\n-----------\n\nReturns the bitwise XOR of all bits in expr. The calculation is performed with\n64-bit (BIGINT) precision. It is an aggregate function, and so can be used\nwith the GROUP BY clause.\n\nIf no rows match, BIT_XOR will return a value with all bits set to 0. NULL\nvalues have no effect on the result unless all results are NULL, which is\ntreated as no match.\n\nBIT_XOR can be used as a window function with the addition of the over_clause.\n\nExamples\n--------\n\nCREATE TABLE vals (x INT);\n\nINSERT INTO vals VALUES(111),(110),(100);\n\nSELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;\n+------------+-----------+------------+\n| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+------------+-----------+------------+\n| 100 | 111 | 101 |\n+------------+-----------+------------+\n\nAs an aggregate function:\n\nCREATE TABLE vals2 (category VARCHAR(1), x INT);\n\nINSERT INTO vals2 VALUES\n (\'a\',111),(\'a\',110),(\'a\',100),\n (\'b\',\'000\'),(\'b\',001),(\'b\',011);\n\nSELECT category, BIT_AND(x), BIT_OR(x), BIT_XOR(x) \n FROM vals GROUP BY category;\n+----------+------------+-----------+------------+\n| category | BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |\n+----------+------------+-----------+------------+\n| a | 100 | 111 | 101 |\n| b | 0 | 11 | 10 |\n+----------+------------+-----------+------------+\n\nNo match:\n\nSELECT BIT_XOR(NULL);\n+---------------+\n| BIT_XOR(NULL) |\n+---------------+\n| 0 |\n+---------------+\n\nURL: https://mariadb.com/kb/en/bit_xor/','','https://mariadb.com/kb/en/bit_xor/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (178,16,'COUNT','Syntax\n------\n\nCOUNT(expr)\n\nDescription\n-----------\n\nReturns a count of the number of non-NULL values of expr in the rows retrieved\nby a SELECT statement. The result is a BIGINT value. It is an aggregate\nfunction, and so can be used with the GROUP BY clause.\n\nCOUNT(*) counts the total number of rows in a table.\n\nCOUNT() returns 0 if there were no matching rows.\n\nCOUNT() can be used as a window function.\n\nExamples\n--------\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT);\n\nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n\nSELECT COUNT(*) FROM student;\n+----------+\n| COUNT(*) |\n+----------+\n| 8 |\n+----------+\n\nCOUNT(DISTINCT) example:\n\nSELECT COUNT(DISTINCT (name)) FROM student;\n+------------------------+\n| COUNT(DISTINCT (name)) |\n+------------------------+\n| 4 |\n+------------------------+\n\nAs a window function\n\nCREATE OR REPLACE TABLE student_test (name CHAR(10), test CHAR(10), score\nTINYINT);\n\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87);\n\nSELECT name, test, score, COUNT(score) OVER (PARTITION BY name) \n AS tests_written FROM student_test;\n+---------+--------+-------+---------------+\n| name | test | score | tests_written |\n+---------+--------+-------+---------------+\n| Chun | SQL | 75 | 2 |\n| Chun | Tuning | 73 | 2 |\n| Esben | SQL | 43 | 2 |\n| Esben | Tuning | 31 | 2 |\n| Kaolin | SQL | 56 | 2 |\n| Kaolin | Tuning | 88 | 2 |\n| Tatiana | SQL | 87 | 1 |\n+---------+--------+-------+---------------+\n\nURL: https://mariadb.com/kb/en/count/','','https://mariadb.com/kb/en/count/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (179,16,'COUNT DISTINCT','Syntax\n------\n\nCOUNT(DISTINCT expr,[expr...])\n\nDescription\n-----------\n\nReturns a count of the number of different non-NULL values.\n\nCOUNT(DISTINCT) returns 0 if there were no matching rows.\n\nAlthough, from MariaDB 10.2.0, COUNT can be used as a window function, COUNT\nDISTINCT cannot be.\n\nExamples\n--------\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT);\n\nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n\nSELECT COUNT(*) FROM student;\n+----------+\n| COUNT(*) |\n+----------+\n| 8 |\n+----------+\n\nSELECT COUNT(DISTINCT (name)) FROM student;\n+------------------------+\n| COUNT(DISTINCT (name)) |\n+------------------------+\n| 4 |\n+------------------------+\n\nURL: https://mariadb.com/kb/en/count-distinct/','','https://mariadb.com/kb/en/count-distinct/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (180,16,'GROUP_CONCAT','Syntax\n------\n\nGROUP_CONCAT(expr)\n\nDescription\n-----------\n\nThis function returns a string result with the concatenated non-NULL values\nfrom a group. It returns NULL if there are no non-NULL values.\n\nThe maximum returned length in bytes is determined by the group_concat_max_len\nserver system variable, which defaults to 1M (>= MariaDB 10.2.4) or 1K (<=\nMariaDB 10.2.3).\n\nIf group_concat_max_len <= 512, the return type is VARBINARY or VARCHAR;\notherwise, the return type is BLOB or TEXT. The choice between binary or\nnon-binary types depends from the input.\n\nThe full syntax is as follows:\n\nGROUP_CONCAT([DISTINCT] expr [,expr ...]\n [ORDER BY {unsigned_integer | col_name | expr}\n [ASC | DESC] [,col_name ...]]\n [SEPARATOR str_val]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}])\n\nDISTINCT eliminates duplicate values from the output string.\n\nORDER BY determines the order of returned values.\n\nSEPARATOR specifies a separator between the values. The default separator is a\ncomma (,). It is possible to avoid using a separator by specifying an empty\nstring.\n\nLIMIT\n-----\n\nMariaDB starting with 10.3.3\n----------------------------\nUntil MariaDB 10.3.2, it was not possible to use the LIMIT clause with\nGROUP_CONCAT. This restriction was lifted in MariaDB 10.3.3.\n\nExamples\n--------\n\nSELECT student_name,\n GROUP_CONCAT(test_score)\n FROM student\n GROUP BY student_name;\n\nGet a readable list of MariaDB users from the mysql.user table:\n\nSELECT GROUP_CONCAT(DISTINCT User ORDER BY User SEPARATOR \'\\n\')\n FROM mysql.user;\n\nIn the former example, DISTINCT is used because the same user may occur more\nthan once. The new line (\\n) used as a SEPARATOR makes the results easier to\nread.\n\nGet a readable list of hosts from which each user can connect:\n\nSELECT User, GROUP_CONCAT(Host ORDER BY Host SEPARATOR \', \') \n FROM mysql.user GROUP BY User ORDER BY User;\n\nThe former example shows the difference between the GROUP_CONCAT\'s ORDER BY\n(which sorts the concatenated hosts), and the SELECT\'s ORDER BY (which sorts\nthe rows).\n\nFrom MariaDB 10.3.3, LIMIT can be used with GROUP_CONCAT, so, for example,\ngiven the following table:\n\nCREATE TABLE d (dd DATE, cc INT);\n\nINSERT INTO d VALUES (\'2017-01-01\',1);\nINSERT INTO d VALUES (\'2017-01-02\',2);\nINSERT INTO d VALUES (\'2017-01-04\',3);\n\nthe following query:\n\nSELECT SUBSTRING_INDEX(GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY cc\nDESC),\",\",1) FROM d;\n+----------------------------------------------------------------------------+\n| SUBSTRING_INDEX(GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY cc DESC),\",\",1) |\n+----------------------------------------------------------------------------+\n| 2017-01-04:3 |\n+----------------------------------------------------------------------------+\n\ncan be more simply rewritten as:\n\nSELECT GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY cc DESC LIMIT 1) FROM d;\n+-------------------------------------------------------------+\n| GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY cc DESC LIMIT 1) |\n+-------------------------------------------------------------+\n| 2017-01-04:3 |\n+-------------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/group_concat/','','https://mariadb.com/kb/en/group_concat/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (181,16,'MAX','Syntax\n------\n\nMAX([DISTINCT] expr)\n\nDescription\n-----------\n\nReturns the largest, or maximum, value of expr. MAX() can also take a string\nargument in which case it returns the maximum string value. The DISTINCT\nkeyword can be used to find the maximum of the distinct values of expr,\nhowever, this produces the same result as omitting DISTINCT.\n\nNote that SET and ENUM fields are currently compared by their string value\nrather than their relative position in the set, so MAX() may produce a\ndifferent highest result than ORDER BY DESC.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nMAX() can be used as a window function.\n\nMAX() returns NULL if there were no matching rows.\n\nExamples\n--------\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT);\n\nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n\nSELECT name, MAX(score) FROM student GROUP BY name;\n+---------+------------+\n| name | MAX(score) |\n+---------+------------+\n| Chun | 75 |\n| Esben | 43 |\n| Kaolin | 88 |\n| Tatiana | 87 |\n+---------+------------+\n\nMAX string:\n\nSELECT MAX(name) FROM student;\n+-----------+\n| MAX(name) |\n+-----------+\n| Tatiana |\n+-----------+\n\nBe careful to avoid this common mistake, not grouping correctly and returning\nmismatched data:\n\nSELECT name,test,MAX(SCORE) FROM student;\n+------+------+------------+\n| name | test | MAX(SCORE) |\n+------+------+------------+\n| Chun | SQL | 88 |\n+------+------+------------+\n\nDifference between ORDER BY DESC and MAX():\n\nCREATE TABLE student2(name CHAR(10),grade ENUM(\'b\',\'c\',\'a\'));\n\nINSERT INTO student2 VALUES(\'Chun\',\'b\'),(\'Esben\',\'c\'),(\'Kaolin\',\'a\');\n\nSELECT MAX(grade) FROM student2;\n+------------+\n| MAX(grade) |\n+------------+\n| c |\n+------------+\n\nSELECT grade FROM student2 ORDER BY grade DESC LIMIT 1;\n+-------+\n| grade |\n+-------+\n| a |\n+-------+\n\nAs a window function:\n\nCREATE OR REPLACE TABLE student_test (name CHAR(10), test CHAR(10), score\nTINYINT);\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87);\n\nSELECT name, test, score, MAX(score) \n OVER (PARTITION BY name) AS highest_score FROM student_test;\n+---------+--------+-------+---------------+\n| name | test | score | highest_score |\n+---------+--------+-------+---------------+\n| Chun | SQL | 75 | 75 |\n| Chun | Tuning | 73 | 75 |\n| Esben | SQL | 43 | 43 |\n| Esben | Tuning | 31 | 43 |\n| Kaolin | SQL | 56 | 88 |\n| Kaolin | Tuning | 88 | 88 |\n| Tatiana | SQL | 87 | 87 |\n+---------+--------+-------+---------------+\n\nURL: https://mariadb.com/kb/en/max/','','https://mariadb.com/kb/en/max/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (182,16,'MIN','Syntax\n------\n\nMIN([DISTINCT] expr)\n\nDescription\n-----------\n\nReturns the minimum value of expr. MIN() may take a string argument, in which\ncase it returns the minimum string value. The DISTINCT keyword can be used to\nfind the minimum of the distinct values of expr, however, this produces the\nsame result as omitting DISTINCT.\n\nNote that SET and ENUM fields are currently compared by their string value\nrather than their relative position in the set, so MIN() may produce a\ndifferent lowest result than ORDER BY ASC.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nMIN() can be used as a window function.\n\nMIN() returns NULL if there were no matching rows.\n\nExamples\n--------\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT);\n\nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n\nSELECT name, MIN(score) FROM student GROUP BY name;\n+---------+------------+\n| name | MIN(score) |\n+---------+------------+\n| Chun | 73 |\n| Esben | 31 |\n| Kaolin | 56 |\n| Tatiana | 83 |\n+---------+------------+\n\nMIN() with a string:\n\nSELECT MIN(name) FROM student;\n+-----------+\n| MIN(name) |\n+-----------+\n| Chun |\n+-----------+\n\nBe careful to avoid this common mistake, not grouping correctly and returning\nmismatched data:\n\nSELECT name,test,MIN(score) FROM student;\n+------+------+------------+\n| name | test | MIN(score) |\n+------+------+------------+\n| Chun | SQL | 31 |\n+------+------+------------+\n\nDifference between ORDER BY ASC and MIN():\n\nCREATE TABLE student2(name CHAR(10),grade ENUM(\'b\',\'c\',\'a\'));\n\nINSERT INTO student2 VALUES(\'Chun\',\'b\'),(\'Esben\',\'c\'),(\'Kaolin\',\'a\');\n\nSELECT MIN(grade) FROM student2;\n+------------+\n| MIN(grade) |\n+------------+\n| a |\n+------------+\n\nSELECT grade FROM student2 ORDER BY grade ASC LIMIT 1;\n+-------+\n| grade |\n+-------+\n| b |\n+-------+\n\nAs a window function:\n\nCREATE OR REPLACE TABLE student_test (name CHAR(10), test CHAR(10), score\nTINYINT);\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87);\n\nSELECT name, test, score, MIN(score) \n OVER (PARTITION BY name) AS lowest_score FROM student_test;\n+---------+--------+-------+--------------+\n| name | test | score | lowest_score |\n+---------+--------+-------+--------------+\n| Chun | SQL | 75 | 73 |\n| Chun | Tuning | 73 | 73 |\n| Esben | SQL | 43 | 31 |\n| Esben | Tuning | 31 | 31 |\n| Kaolin | SQL | 56 | 56 |\n| Kaolin | Tuning | 88 | 56 |\n| Tatiana | SQL | 87 | 87 |\n+---------+--------+-------+--------------+\n\nURL: https://mariadb.com/kb/en/min/','','https://mariadb.com/kb/en/min/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (183,16,'STD','Syntax\n------\n\nSTD(expr)\n\nDescription\n-----------\n\nReturns the population standard deviation of expr. This is an extension to\nstandard SQL. The standard SQL function STDDEV_POP() can be used instead.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nSTD() can be used as a window function.\n\nThis function returns NULL if there were no matching rows.\n\nExamples\n--------\n\nAs an aggregate function:\n\nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n\nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n\nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n\nAs a window function:\n\nCREATE OR REPLACE TABLE student_test (name CHAR(10), test CHAR(10), score\nTINYINT);\n\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87);\n\nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM student_test;\n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n| Kaolin | SQL | 56 | 16.9466 |\n| Kaolin | Tuning | 88 | 24.1247 |\n| Tatiana | SQL | 87 | 16.9466 |\n+---------+--------+-------+----------------+\n\nURL: https://mariadb.com/kb/en/std/','','https://mariadb.com/kb/en/std/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (184,16,'STDDEV','Syntax\n------\n\nSTDDEV(expr)\n\nDescription\n-----------\n\nReturns the population standard deviation of expr. This function is provided\nfor compatibility with Oracle. The standard SQL function STDDEV_POP() can be\nused instead.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nSTDDEV() can be used as a window function.\n\nThis function returns NULL if there were no matching rows.\n\nExamples\n--------\n\nAs an aggregate function:\n\nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n\nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n\nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n\nAs a window function:\n\nCREATE OR REPLACE TABLE student_test (name CHAR(10), test CHAR(10), score\nTINYINT);\n\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87);\n\nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM student_test;\n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n| Kaolin | SQL | 56 | 16.9466 |\n| Kaolin | Tuning | 88 | 24.1247 |\n| Tatiana | SQL | 87 | 16.9466 |\n+---------+--------+-------+----------------+\n\nURL: https://mariadb.com/kb/en/stddev/','','https://mariadb.com/kb/en/stddev/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (185,16,'STDDEV_POP','Syntax\n------\n\nSTDDEV_POP(expr)\n\nDescription\n-----------\n\nReturns the population standard deviation of expr (the square root of\nVAR_POP()). You can also use STD() or STDDEV(), which are equivalent but not\nstandard SQL.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nSTDDEV_POP() can be used as a window function.\n\nSTDDEV_POP() returns NULL if there were no matching rows.\n\nExamples\n--------\n\nAs an aggregate function:\n\nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n\nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n\nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n\nAs a window function:\n\nCREATE OR REPLACE TABLE student_test (name CHAR(10), test CHAR(10), score\nTINYINT);\n\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87);\n\nSELECT name, test, score, STDDEV_POP(score) \n OVER (PARTITION BY test) AS stddev_results FROM student_test;\n+---------+--------+-------+----------------+\n| name | test | score | stddev_results |\n+---------+--------+-------+----------------+\n| Chun | SQL | 75 | 16.9466 |\n| Chun | Tuning | 73 | 24.1247 |\n| Esben | SQL | 43 | 16.9466 |\n| Esben | Tuning | 31 | 24.1247 |\n| Kaolin | SQL | 56 | 16.9466 |\n| Kaolin | Tuning | 88 | 24.1247 |\n| Tatiana | SQL | 87 | 16.9466 |\n+---------+--------+-------+----------------+\n\nURL: https://mariadb.com/kb/en/stddev_pop/','','https://mariadb.com/kb/en/stddev_pop/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (186,16,'STDDEV_SAMP','Syntax\n------\n\nSTDDEV_SAMP(expr)\n\nDescription\n-----------\n\nReturns the sample standard deviation of expr (the square root of VAR_SAMP()).\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nSTDDEV_SAMP() can be used as a window function.\n\nSTDDEV_SAMP() returns NULL if there were no matching rows.\n\nURL: https://mariadb.com/kb/en/stddev_samp/','','https://mariadb.com/kb/en/stddev_samp/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (187,16,'SUM','Syntax\n------\n\nSUM([DISTINCT] expr)\n\nDescription\n-----------\n\nReturns the sum of expr. If the return set has no rows, SUM() returns NULL.\nThe DISTINCT keyword can be used to sum only the distinct values of expr.\n\nSUM() can be used as a window function, although not with the DISTINCT\nspecifier.\n\nExamples\n--------\n\nCREATE TABLE sales (sales_value INT);\nINSERT INTO sales VALUES(10),(20),(20),(40);\n\nSELECT SUM(sales_value) FROM sales;\n+------------------+\n| SUM(sales_value) |\n+------------------+\n| 90 |\n+------------------+\n\nSELECT SUM(DISTINCT(sales_value)) FROM sales;\n+----------------------------+\n| SUM(DISTINCT(sales_value)) |\n+----------------------------+\n| 70 |\n+----------------------------+\n\nCommonly, SUM is used with a GROUP BY clause:\n\nCREATE TABLE sales (name CHAR(10), month CHAR(10), units INT);\n\nINSERT INTO sales VALUES \n (\'Chun\', \'Jan\', 75), (\'Chun\', \'Feb\', 73),\n (\'Esben\', \'Jan\', 43), (\'Esben\', \'Feb\', 31),\n (\'Kaolin\', \'Jan\', 56), (\'Kaolin\', \'Feb\', 88),\n (\'Tatiana\', \'Jan\', 87), (\'Tatiana\', \'Feb\', 83);\n\nSELECT name, SUM(units) FROM sales GROUP BY name;\n+---------+------------+\n| name | SUM(units) |\n+---------+------------+\n| Chun | 148 |\n| Esben | 74 |\n| Kaolin | 144 |\n| Tatiana | 170 |\n+---------+------------+\n\nThe GROUP BY clause is required when using an aggregate function along with\nregular column data, otherwise the result will be a mismatch, as in the\nfollowing common type of mistake:\n\nSELECT name,SUM(units) FROM sales\n;+------+------------+\n| name | SUM(units) |\n+------+------------+\n| Chun | 536 |\n+------+------------+\n\nAs a window function:\n\nCREATE OR REPLACE TABLE student_test (name CHAR(10), test CHAR(10), score\nTINYINT);\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87);\n\nSELECT name, test, score, SUM(score) OVER (PARTITION BY name) AS total_score\nFROM student_test;\n+---------+--------+-------+-------------+\n| name | test | score | total_score |\n+---------+--------+-------+-------------+\n| Chun | SQL | 75 | 148 |\n| Chun | Tuning | 73 | 148 |\n| Esben | SQL | 43 | 74 |\n| Esben | Tuning | 31 | 74 |\n| Kaolin | SQL | 56 | 144 |\n| Kaolin | Tuning | 88 | 144 |\n| Tatiana | SQL | 87 | 87 |\n+---------+--------+-------+-------------+\n\nURL: https://mariadb.com/kb/en/sum/','','https://mariadb.com/kb/en/sum/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (188,16,'VARIANCE','Syntax\n------\n\nVARIANCE(expr)\n\nDescription\n-----------\n\nReturns the population standard variance of expr. This is an extension to\nstandard SQL. The standard SQL function VAR_POP() can be used instead.\n\nVariance is calculated by\n\n* working out the mean for the set\n* for each number, subtracting the mean and squaring the result\n* calculate the average of the resulting differences\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nVARIANCE() can be used as a window function.\n\nVARIANCE() returns NULL if there were no matching rows.\n\nExamples\n--------\n\nCREATE TABLE v(i tinyint);\n\nINSERT INTO v VALUES(101),(99);\n\nSELECT VARIANCE(i) FROM v;\n+-------------+\n| VARIANCE(i) |\n+-------------+\n| 1.0000 |\n+-------------+\n\nINSERT INTO v VALUES(120),(80);\n\nSELECT VARIANCE(i) FROM v;\n+-------------+\n| VARIANCE(i) |\n+-------------+\n| 200.5000 |\n+-------------+\n\nAs an aggregate function:\n\nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n\nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n\nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n\nAs a window function:\n\nCREATE OR REPLACE TABLE student_test (name CHAR(10), test CHAR(10), score\nTINYINT);\n\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87);\n\nSELECT name, test, score, VAR_POP(score) \n OVER (PARTITION BY test) AS variance_results FROM student_test;\n+---------+--------+-------+------------------+\n| name | test | score | variance_results |\n+---------+--------+-------+------------------+\n| Chun | SQL | 75 | 287.1875 |\n| Chun | Tuning | 73 | 582.0000 |\n| Esben | SQL | 43 | 287.1875 |\n| Esben | Tuning | 31 | 582.0000 |\n| Kaolin | SQL | 56 | 287.1875 |\n| Kaolin | Tuning | 88 | 582.0000 |\n| Tatiana | SQL | 87 | 287.1875 |\n+---------+--------+-------+------------------+\n\nURL: https://mariadb.com/kb/en/variance/','','https://mariadb.com/kb/en/variance/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (189,16,'VAR_POP','Syntax\n------\n\nVAR_POP(expr)\n\nDescription\n-----------\n\nReturns the population standard variance of expr. It considers rows as the\nwhole population, not as a sample, so it has the number of rows as the\ndenominator. You can also use VARIANCE(), which is equivalent but is not\nstandard SQL.\n\nVariance is calculated by\n\n* working out the mean for the set\n* for each number, subtracting the mean and squaring the result\n* calculate the average of the resulting differences\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nVAR_POP() can be used as a window function.\n\nVAR_POP() returns NULL if there were no matching rows.\n\nExamples\n--------\n\nCREATE TABLE v(i tinyint);\n\nINSERT INTO v VALUES(101),(99);\n\nSELECT VAR_POP(i) FROM v;\n+------------+\n| VAR_POP(i) |\n+------------+\n| 1.0000 |\n+------------+\n\nINSERT INTO v VALUES(120),(80);\n\nSELECT VAR_POP(i) FROM v;\n+------------+\n| VAR_POP(i) |\n+------------+\n| 200.5000 |\n+------------+\n\nAs an aggregate function:\n\nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n\nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n\nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n\nAs a window function:\n\nCREATE OR REPLACE TABLE student_test (name CHAR(10), test CHAR(10), score\nTINYINT);\n\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87);\n\nSELECT name, test, score, VAR_POP(score) \n OVER (PARTITION BY test) AS variance_results FROM student_test;\n+---------+--------+-------+------------------+\n| name | test | score | variance_results |\n+---------+--------+-------+------------------+\n| Chun | SQL | 75 | 287.1875 |\n| Esben | SQL | 43 | 287.1875 |\n| Kaolin | SQL | 56 | 287.1875 |\n| Tatiana | SQL | 87 | 287.1875 |\n| Chun | Tuning | 73 | 582.0000 |\n| Esben | Tuning | 31 | 582.0000 |\n| Kaolin | Tuning | 88 | 582.0000 |\n+---------+--------+-------+------------------+\n\nURL: https://mariadb.com/kb/en/var_pop/','','https://mariadb.com/kb/en/var_pop/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (190,16,'VAR_SAMP','Syntax\n------\n\nVAR_SAMP(expr)\n\nDescription\n-----------\n\nReturns the sample variance of expr. That is, the denominator is the number of\nrows minus one.\n\nIt is an aggregate function, and so can be used with the GROUP BY clause.\n\nVAR_SAMP() can be used as a window function.\n\nVAR_SAMP() returns NULL if there were no matching rows.\n\nExamples\n--------\n\nAs an aggregate function:\n\nCREATE OR REPLACE TABLE stats (category VARCHAR(2), x INT);\n\nINSERT INTO stats VALUES \n (\'a\',1),(\'a\',2),(\'a\',3),\n (\'b\',11),(\'b\',12),(\'b\',20),(\'b\',30),(\'b\',60);\n\nSELECT category, STDDEV_POP(x), STDDEV_SAMP(x), VAR_POP(x) \n FROM stats GROUP BY category;\n+----------+---------------+----------------+------------+\n| category | STDDEV_POP(x) | STDDEV_SAMP(x) | VAR_POP(x) |\n+----------+---------------+----------------+------------+\n| a | 0.8165 | 1.0000 | 0.6667 |\n| b | 18.0400 | 20.1693 | 325.4400 |\n+----------+---------------+----------------+------------+\n\nAs a window function:\n\nCREATE OR REPLACE TABLE student_test (name CHAR(10), test CHAR(10), score\nTINYINT);\n\nINSERT INTO student_test VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87);\n\nSELECT name, test, score, VAR_SAMP(score) \n OVER (PARTITION BY test) AS variance_results FROM student_test;\n+---------+--------+-------+------------------+\n| name | test | score | variance_results |\n+---------+--------+-------+------------------+\n| Chun | SQL | 75 | 382.9167 |\n| Chun | Tuning | 73 | 873.0000 |\n| Esben | SQL | 43 | 382.9167 |\n| Esben | Tuning | 31 | 873.0000 |\n| Kaolin | SQL | 56 | 382.9167 |\n| Kaolin | Tuning | 88 | 873.0000 |\n| Tatiana | SQL | 87 | 382.9167 |\n+---------+--------+-------+------------------+\n\nURL: https://mariadb.com/kb/en/var_samp/','','https://mariadb.com/kb/en/var_samp/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (191,17,'BENCHMARK','Syntax\n------\n\nBENCHMARK(count,expr)\n\nDescription\n-----------\n\nThe BENCHMARK() function executes the expression expr repeatedly count times.\nIt may be used to time how quickly MariaDB processes the expression. The\nresult value is always 0. The intended use is from within the mysql client,\nwhich reports query execution times.\n\nExamples\n--------\n\nSELECT BENCHMARK(1000000,ENCODE(\'hello\',\'goodbye\'));\n+----------------------------------------------+\n| BENCHMARK(1000000,ENCODE(\'hello\',\'goodbye\')) |\n+----------------------------------------------+\n| 0 |\n+----------------------------------------------+\n1 row in set (0.21 sec)\n\nURL: https://mariadb.com/kb/en/benchmark/','','https://mariadb.com/kb/en/benchmark/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (192,17,'BINLOG_GTID_POS','Syntax\n------\n\nBINLOG_GTID_POS(binlog_filename,binlog_offset)\n\nDescription\n-----------\n\nThe BINLOG_GTID_POS() function takes as input an old-style binary log position\nin the form of a file name and a file offset. It looks up the position in the\ncurrent binlog, and returns a string representation of the corresponding GTID\nposition. If the position is not found in the current binlog, NULL is returned.\n\nExamples\n--------\n\nSELECT BINLOG_GTID_POS(\"master-bin.000001\", 600);\n\nURL: https://mariadb.com/kb/en/binlog_gtid_pos/','','https://mariadb.com/kb/en/binlog_gtid_pos/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (193,17,'CHARSET','Syntax\n------\n\nCHARSET(str)\n\nDescription\n-----------\n\nReturns the character set of the string argument. If str is not a string, it\nis considered as a binary string (so the function returns \'binary\'). This\napplies to NULL, too. The return value is a string in the utf8 character set.\n\nExamples\n--------\n\nSELECT CHARSET(\'abc\');\n+----------------+\n| CHARSET(\'abc\') |\n+----------------+\n| latin1 |\n+----------------+\n\nSELECT CHARSET(CONVERT(\'abc\' USING utf8));\n+------------------------------------+\n| CHARSET(CONVERT(\'abc\' USING utf8)) |\n+------------------------------------+\n| utf8 |\n+------------------------------------+\n\nSELECT CHARSET(USER());\n+-----------------+\n| CHARSET(USER()) |\n+-----------------+\n| utf8 |\n+-----------------+\n\nURL: https://mariadb.com/kb/en/charset/','','https://mariadb.com/kb/en/charset/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (194,17,'COERCIBILITY','Syntax\n------\n\nCOERCIBILITY(str)\n\nDescription\n-----------\n\nReturns the collation coercibility value of the string argument. Coercibility\ndefines what will be converted to what in case of collation conflict, with an\nexpression with higher coercibility being converted to the collation of an\nexpression with lower coercibility.\n\n+-----------------------------+---------------------------+------------------+\n| Coercibility | Description | Example |\n+-----------------------------+---------------------------+------------------+\n| 0 | Explicit | Value using a |\n| | | COLLATE clause |\n+-----------------------------+---------------------------+------------------+\n| 1 | No collation | Concatenated |\n| | | strings using |\n| | | different |\n| | | collations |\n+-----------------------------+---------------------------+------------------+\n| 2 | Implicit | Column value |\n+-----------------------------+---------------------------+------------------+\n| 3 | Constant | USER() return |\n| | | value |\n+-----------------------------+---------------------------+------------------+\n| 4 | Coercible | Literal string |\n+-----------------------------+---------------------------+------------------+\n| 5 | Ignorable | NULL or derived |\n| | | from NULL |\n+-----------------------------+---------------------------+------------------+\n\nExamples\n--------\n\nSELECT COERCIBILITY(\'abc\' COLLATE latin1_swedish_ci);\n+-----------------------------------------------+\n| COERCIBILITY(\'abc\' COLLATE latin1_swedish_ci) |\n+-----------------------------------------------+\n| 0 |\n+-----------------------------------------------+\n\nSELECT COERCIBILITY(USER());\n+----------------------+\n| COERCIBILITY(USER()) |\n+----------------------+\n| 3 |\n+----------------------+\n\nSELECT COERCIBILITY(\'abc\');\n+---------------------+\n| COERCIBILITY(\'abc\') |\n+---------------------+\n| 4 |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/coercibility/','','https://mariadb.com/kb/en/coercibility/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (195,17,'COLLATION','Syntax\n------\n\nCOLLATION(str)\n\nDescription\n-----------\n\nReturns the collation of the string argument. If str is not a string, it is\nconsidered as a binary string (so the function returns \'binary\'). This applies\nto NULL, too. The return value is a string in the utf8 character set.\n\nSee Character Sets and Collations.\n\nExamples\n--------\n\nSELECT COLLATION(\'abc\');\n+-------------------+\n| COLLATION(\'abc\') |\n+-------------------+\n| latin1_swedish_ci |\n+-------------------+\n\nSELECT COLLATION(_utf8\'abc\');\n+-----------------------+\n| COLLATION(_utf8\'abc\') |\n+-----------------------+\n| utf8_general_ci |\n+-----------------------+\n\nURL: https://mariadb.com/kb/en/collation/','','https://mariadb.com/kb/en/collation/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (196,17,'CONNECTION_ID','Syntax\n------\n\nCONNECTION_ID()\n\nDescription\n-----------\n\nReturns the connection ID for the connection. Every connection (including\nevents) has an ID that is unique among the set of currently connected clients.\n\nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or bigint(10), in all\ncases. From MariaDB 10.3.1, returns MYSQL_TYPE_LONG, or int(10), when the\nresult would fit within 32-bits.\n\nExamples\n--------\n\nSELECT CONNECTION_ID();\n+-----------------+\n| CONNECTION_ID() |\n+-----------------+\n| 3 |\n+-----------------+\n\nURL: https://mariadb.com/kb/en/connection_id/','','https://mariadb.com/kb/en/connection_id/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (197,17,'CURRENT_ROLE','Syntax\n------\n\nCURRENT_ROLE, CURRENT_ROLE()\n\nDescription\n-----------\n\nReturns the current role name. This determines your access privileges. The\nreturn value is a string in the utf8 character set.\n\nIf there is no current role, NULL is returned.\n\nThe output of SELECT CURRENT_ROLE is equivalent to the contents of the\nENABLED_ROLES Information Schema table.\n\nUSER() returns the combination of user and host used to login. CURRENT_USER()\nreturns the account used to determine current connection\'s privileges.\n\nExamples\n--------\n\nSELECT CURRENT_ROLE;\n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| NULL |\n+--------------+\n\nSET ROLE staff;\n\nSELECT CURRENT_ROLE;\n+--------------+\n| CURRENT_ROLE |\n+--------------+\n| staff |\n+--------------+\n\nURL: https://mariadb.com/kb/en/current_role/','','https://mariadb.com/kb/en/current_role/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (198,17,'CURRENT_USER','Syntax\n------\n\nCURRENT_USER, CURRENT_USER()\n\nDescription\n-----------\n\nReturns the user name and host name combination for the MariaDB account that\nthe server used to authenticate the current client. This account determines\nyour access privileges. The return value is a string in the utf8 character set.\n\nThe value of CURRENT_USER() can differ from the value of USER().\nCURRENT_ROLE() returns the current active role.\n\nExamples\n--------\n\nshell> mysql --user=\"anonymous\"\n\nselect user(),current_user();\n+---------------------+----------------+\n| user() | current_user() |\n+---------------------+----------------+\n| anonymous@localhost | @localhost |\n+---------------------+----------------+\n\nWhen calling CURRENT_USER() in a stored procedure, it returns the owner of the\nstored procedure, as defined with DEFINER.\n\nURL: https://mariadb.com/kb/en/current_user/','','https://mariadb.com/kb/en/current_user/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (199,17,'DATABASE','Syntax\n------\n\nDATABASE()\n\nDescription\n-----------\n\nReturns the default (current) database name as a string in the utf8 character\nset. If there is no default database, DATABASE() returns NULL. Within a stored\nroutine, the default database is the database that the routine is associated\nwith, which is not necessarily the same as the database that is the default in\nthe calling context.\n\nSCHEMA() is a synonym for DATABASE().\n\nTo select a default database, the USE statement can be run. Another way to set\nthe default database is specifying its name at mysql command line client\nstartup.\n\nExamples\n--------\n\nSELECT DATABASE();\n+------------+\n| DATABASE() |\n+------------+\n| NULL |\n+------------+\n\nUSE test;\nDatabase changed\n\nSELECT DATABASE();\n+------------+\n| DATABASE() |\n+------------+\n| test |\n+------------+\n\nURL: https://mariadb.com/kb/en/database/','','https://mariadb.com/kb/en/database/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (200,17,'DECODE_HISTOGRAM','Syntax\n------\n\nDECODE_HISTOGRAM(hist_type,histogram)\n\nDescription\n-----------\n\nReturns a string of comma separated numeric values corresponding to a\nprobability distribution represented by the histogram of type hist_type\n(SINGLE_PREC_HB or DOUBLE_PREC_HB). The hist_type and histogram would be\ncommonly used from the mysql.column_stats table.\n\nSee Histogram Based Statistics for details.\n\nExamples\n--------\n\nCREATE TABLE origin (\n i INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\n v INT UNSIGNED NOT NULL\n);\n\nINSERT INTO origin(v) VALUES \n (1),(2),(3),(4),(5),(10),(20),\n (30),(40),(50),(60),(70),(80),\n (90),(100),(200),(400),(800);\n\nSET histogram_size=10,histogram_type=SINGLE_PREC_HB;\n\nANALYZE TABLE origin PERSISTENT FOR ALL;\n+-------------+---------+----------+-----------------------------------------+\n| Table | Op | Msg_type | Msg_text |\n+-------------+---------+----------+-----------------------------------------+\n| test.origin | analyze | status | Engine-independent statistics collected |\n| test.origin | analyze | status | OK |\n+-------------+---------+----------+-----------------------------------------+\n\nSELECT db_name,table_name,column_name,hist_type,\n hex(histogram),decode_histogram(hist_type,histogram)\n FROM mysql.column_stats WHERE db_name=\'test\' and table_name=\'origin\';\n+---------+------------+-------------+----------------+----------------------+-\n-----------------------------------------------------------------+\n| db_name | table_name | column_name | hist_type | hex(histogram) |\ndecode_histogram(hist_type,histogram) |\n+---------+------------+-------------+----------------+----------------------+-\n-----------------------------------------------------------------+\n| test | origin | i | SINGLE_PREC_HB | 0F2D3C5A7887A5C3D2F0 |\n0.059,0.118,0.059,0.118,0.118,0.059,0.118,0.118,0.059,0.118,0.059 |\n| test | origin | v | SINGLE_PREC_HB | 000001060C0F161C1F7F |\n0.000,0.000,0.004,0.020,0.024,0.012,0.027,0.024,0.012,0.376,0.502 |\n+---------+------------+-------------+----------------+----------------------+-\n-----------------------------------------------------------------+\n\nSET histogram_size=20,histogram_type=DOUBLE_PREC_HB;\n\nANALYZE TABLE origin PERSISTENT FOR ALL;\n+-------------+---------+----------+-----------------------------------------+\n| Table | Op | Msg_type | Msg_text |\n+-------------+---------+----------+-----------------------------------------+\n| test.origin | analyze | status | Engine-independent statistics collected |\n| test.origin | analyze | status | OK |\n+-------------+---------+----------+-----------------------------------------+\n\nSELECT db_name,table_name,column_name,\n hist_type,hex(histogram),decode_histogram(hist_type,histogram)\n FROM mysql.column_stats WHERE db_name=\'test\' and table_name=\'origin\';\n+---------+------------+-------------+----------------+------------------------\n-----------------+-------------------------------------------------------------\n---------------------------+\n| db_name | table_name | column_name | hist_type | hex(histogram) \n | decode_histogram(hist_type,histogram)\n |\n+---------+------------+-------------+----------------+------------------------\n-----------------+-------------------------------------------------------------\n---------------------------+\n| test | origin | i | DOUBLE_PREC_HB |\n0F0F2D2D3C3C5A5A78788787A5A5C3C3D2D2F0F0 |\n0.05882,0.11765,0.05882,0.11765,0.11765,0.05882,0.11765,0.11765,0.05882,0.11765\n0.05882 |\n| test | origin | v | DOUBLE_PREC_HB |\n5200F600480116067E0CB30F1B16831CB81FD67F |\n0.00125,0.00250,0.00125,0.01877,0.02502,0.01253,0.02502,0.02502,0.01253,0.37546\n0.50063 |\n\nURL: https://mariadb.com/kb/en/decode_histogram/','','https://mariadb.com/kb/en/decode_histogram/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (201,17,'DEFAULT','Syntax\n------\n\nDEFAULT(col_name)\n\nDescription\n-----------\n\nReturns the default value for a table column. If the column has no default\nvalue (and is not NULLABLE - NULLABLE fields have a NULL default), an error is\nreturned.\n\nFor integer columns using AUTO_INCREMENT, 0 is returned.\n\nWhen using DEFAULT as a value to set in an INSERT or UPDATE statement, you can\nuse the bare keyword DEFAULT without the parentheses and argument to refer to\nthe column in context. You can only use DEFAULT as a bare keyword if you are\nusing it alone without a surrounding expression or function.\n\nExamples\n--------\n\nSelect only non-default values for a column:\n\nSELECT i FROM t WHERE i != DEFAULT(i);\n\nUpdate values to be one greater than the default value:\n\nUPDATE t SET i = DEFAULT(i)+1 WHERE i < 100;\n\nWhen referring to the default value exactly in UPDATE or INSERT, you can omit\nthe argument:\n\nINSERT INTO t (i) VALUES (DEFAULT);\nUPDATE t SET i = DEFAULT WHERE i < 100;\n\nCREATE OR REPLACE TABLE t (\n i INT NOT NULL AUTO_INCREMENT,\n j INT NOT NULL,\n k INT DEFAULT 3,\n l INT NOT NULL DEFAULT 4,\n m INT,\n PRIMARY KEY (i)\n);\n\nDESC t;\n+-------+---------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+---------+------+-----+---------+----------------+\n| i | int(11) | NO | PRI | NULL | auto_increment |\n| j | int(11) | NO | | NULL | |\n| k | int(11) | YES | | 3 | |\n| l | int(11) | NO | | 4 | |\n| m | int(11) | YES | | NULL | |\n+-------+---------+------+-----+---------+----------------+\n\nINSERT INTO t (j) VALUES (1);\nINSERT INTO t (j,m) VALUES (2,2);\nINSERT INTO t (j,l,m) VALUES (3,3,3);\n\nSELECT * FROM t;\n+---+---+------+---+------+\n| i | j | k | l | m |\n+---+---+------+---+------+\n| 1 | 1 | 3 | 4 | NULL |\n| 2 | 2 | 3 | 4 | 2 |\n| 3 | 3 | 3 | 3 | 3 |\n+---+---+------+---+------+\n\nSELECT DEFAULT(i), DEFAULT(k), DEFAULT (l), DEFAULT(m) FROM t;\n+------------+------------+-------------+------------+\n| DEFAULT(i) | DEFAULT(k) | DEFAULT (l) | DEFAULT(m) |\n+------------+------------+-------------+------------+\n| 0 | 3 | 4 | NULL |\n| 0 | 3 | 4 | NULL |\n| 0 | 3 | 4 | NULL |\n+------------+------------+-------------+------------+\n\nSELECT DEFAULT(i), DEFAULT(k), DEFAULT (l), DEFAULT(m), DEFAULT(j) FROM t;\nERROR 1364 (HY000): Field \'j\' doesn\'t have a default value\n\nSELECT * FROM t WHERE i = DEFAULT(i);\nEmpty set (0.001 sec)\n\nSELECT * FROM t WHERE j = DEFAULT(j);\nERROR 1364 (HY000): Field \'j\' doesn\'t have a default value\n\nSELECT * FROM t WHERE k = DEFAULT(k);\n+---+---+------+---+------+\n| i | j | k | l | m |\n+---+---+------+---+------+\n| 1 | 1 | 3 | 4 | NULL |\n| 2 | 2 | 3 | 4 | 2 |\n| 3 | 3 | 3 | 3 | 3 |\n+---+---+------+---+------+\n\nSELECT * FROM t WHERE l = DEFAULT(l);\n+---+---+------+---+------+\n| i | j | k | l | m |\n+---+---+------+---+------+\n| 1 | 1 | 3 | 4 | NULL |\n| 2 | 2 | 3 | 4 | 2 |\n+---+---+------+---+------+\n\nSELECT * FROM t WHERE m = DEFAULT(m);\nEmpty set (0.001 sec)\n\nSELECT * FROM t WHERE m <=> DEFAULT(m);\n+---+---+------+---+------+\n| i | j | k | l | m |\n+---+---+------+---+------+\n| 1 | 1 | 3 | 4 | NULL |\n+---+---+------+---+------+\n\nURL: https://mariadb.com/kb/en/default/','','https://mariadb.com/kb/en/default/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (202,17,'FOUND_ROWS','Syntax\n------\n\nFOUND_ROWS()\n\nDescription\n-----------\n\nA SELECT statement may include a LIMIT clause to restrict the number of rows\nthe server returns to the client. In some cases, it is desirable to know how\nmany rows the statement would have returned without the LIMIT, but without\nrunning the statement again. To obtain this row count, include a\nSQL_CALC_FOUND_ROWS option in the SELECT statement, and then invoke\nFOUND_ROWS() afterwards.\n\nYou can also use FOUND_ROWS() to obtain the number of rows returned by a\nSELECT which does not contain a LIMIT clause. In this case you don\'t need to\nuse the SQL_CALC_FOUND_ROWS option. This can be useful for example in a stored\nprocedure.\n\nAlso, this function works with some other statements which return a resultset,\nincluding SHOW, DESC and HELP. For DELETE ... RETURNING you should use\nROW_COUNT(). It also works as a prepared statement, or after executing a\nprepared statement.\n\nStatements which don\'t return any results don\'t affect FOUND_ROWS() - the\nprevious value will still be returned.\n\nWarning: When used after a CALL statement, this function returns the number of\nrows selected by the last query in the procedure, not by the whole procedure.\n\nStatements using the FOUND_ROWS() function are not safe for replication.\n\nExamples\n--------\n\nSHOW ENGINES\\G\n*************************** 1. row ***************************\n Engine: CSV\n Support: YES\n Comment: Stores tables as CSV files\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 2. row ***************************\n Engine: MRG_MyISAM\n Support: YES\n Comment: Collection of identical MyISAM tables\nTransactions: NO\n XA: NO\n Savepoints: NO\n\n...\n\n*************************** 8. row ***************************\n Engine: PERFORMANCE_SCHEMA\n Support: YES\n Comment: Performance Schema\nTransactions: NO\n XA: NO\n Savepoints: NO\n8 rows in set (0.000 sec)\n\nSELECT FOUND_ROWS();\n+--------------+\n| FOUND_ROWS() |\n+--------------+\n| 8 |\n+--------------+\n\nSELECT SQL_CALC_FOUND_ROWS * FROM tbl_name WHERE id > 100 LIMIT 10;\n\nSELECT FOUND_ROWS();\n+--------------+\n| FOUND_ROWS() |\n+--------------+\n| 23 |\n+--------------+\n\nURL: https://mariadb.com/kb/en/found_rows/','','https://mariadb.com/kb/en/found_rows/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (203,17,'LAST_INSERT_ID','Syntax\n------\n\nLAST_INSERT_ID(), LAST_INSERT_ID(expr)\n\nDescription\n-----------\n\nLAST_INSERT_ID() (no arguments) returns the first automatically generated\nvalue successfully inserted for an AUTO_INCREMENT column as a result of the\nmost recently executed INSERT statement. The value of LAST_INSERT_ID() remains\nunchanged if no rows are successfully inserted.\n\nIf one gives an argument to LAST_INSERT_ID(), then it will return the value of\nthe expression and the next call to LAST_INSERT_ID() will return the same\nvalue. The value will also be sent to the client and can be accessed by the\nmysql_insert_id function.\n\nFor example, after inserting a row that generates an AUTO_INCREMENT value, you\ncan get the value like this:\n\nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 9 |\n+------------------+\n\nYou can also use LAST_INSERT_ID() to delete the last inserted row:\n\nDELETE FROM product WHERE id = LAST_INSERT_ID();\n\nIf no rows were successfully inserted, LAST_INSERT_ID() returns 0.\n\nThe value of LAST_INSERT_ID() will be consistent across all versions if all\nrows in the INSERT or UPDATE statement were successful.\n\nThe currently executing statement does not affect the value of\nLAST_INSERT_ID(). Suppose that you generate an AUTO_INCREMENT value with one\nstatement, and then refer to LAST_INSERT_ID() in a multiple-row INSERT\nstatement that inserts rows into a table with its own AUTO_INCREMENT column.\nThe value of LAST_INSERT_ID() will remain stable in the second statement; its\nvalue for the second and later rows is not affected by the earlier row\ninsertions. (However, if you mix references to LAST_INSERT_ID() and\nLAST_INSERT_ID(expr), the effect is undefined.)\n\nIf the previous statement returned an error, the value of LAST_INSERT_ID() is\nundefined. For transactional tables, if the statement is rolled back due to an\nerror, the value of LAST_INSERT_ID() is left undefined. For manual ROLLBACK,\nthe value of LAST_INSERT_ID() is not restored to that before the transaction;\nit remains as it was at the point of the ROLLBACK.\n\nWithin the body of a stored routine (procedure or function) or a trigger, the\nvalue of LAST_INSERT_ID() changes the same way as for statements executed\noutside the body of these kinds of objects. The effect of a stored routine or\ntrigger upon the value of LAST_INSERT_ID() that is seen by following\nstatements depends on the kind of routine:\n\n* If a stored procedure executes statements that change the value of\nLAST_INSERT_ID(), the new value will be seen by statements that follow the\nprocedure call.\n\n* For stored functions and triggers that change the value, the value is\nrestored when the function or trigger ends, so following statements will not\nsee a changed value.\n\nExamples\n--------\n\nCREATE TABLE t (\n id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY,\n f VARCHAR(1))\nENGINE = InnoDB;\n\nINSERT INTO t(f) VALUES(\'a\');\n\nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 1 |\n+------------------+\n\nINSERT INTO t(f) VALUES(\'b\');\n\nINSERT INTO t(f) VALUES(\'c\');\n\nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 3 |\n+------------------+\n\nINSERT INTO t(f) VALUES(\'d\'),(\'e\');\n\nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 4 |\n+------------------+\n\nSELECT * FROM t;\n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n+----+------+\n\nSELECT LAST_INSERT_ID(12);\n+--------------------+\n| LAST_INSERT_ID(12) |\n+--------------------+\n| 12 |\n+--------------------+\n\nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 12 |\n+------------------+\n\nINSERT INTO t(f) VALUES(\'f\');\n\nSELECT LAST_INSERT_ID();\n+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n| 6 |\n+------------------+\n\nSELECT * FROM t;\n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n| 6 | f |\n+----+------+\n\nSELECT LAST_INSERT_ID(12);\n+--------------------+\n| LAST_INSERT_ID(12) |\n+--------------------+\n| 12 |\n+--------------------+\n\nINSERT INTO t(f) VALUES(\'g\');\n\nSELECT * FROM t;\n+----+------+\n| id | f |\n+----+------+\n| 1 | a |\n| 2 | b |\n| 3 | c |\n| 4 | d |\n| 5 | e |\n| 6 | f |\n| 7 | g |\n+----+------+\n\nURL: https://mariadb.com/kb/en/last_insert_id/','','https://mariadb.com/kb/en/last_insert_id/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (204,17,'LAST_VALUE','Syntax\n------\n\nLAST_VALUE(expr,[expr,...])\n\nLAST_VALUE(expr) OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nLAST_VALUE() evaluates all expressions and returns the last.\n\nThis is useful together with setting user variables to a value with\n@var:=expr, for example when you want to get data of rows updated/deleted\nwithout having to do two queries against the table.\n\nLAST_VALUE can be used as a window function.\n\nReturns NULL if no last value exists.\n\nExamples\n--------\n\nCREATE TABLE t1 (a int, b int);\nINSERT INTO t1 VALUES(1,10),(2,20);\nDELETE FROM t1 WHERE a=1 AND last_value(@a:=a,@b:=b,1);\nSELECT @a,@b;\n+------+------+\n| @a | @b |\n+------+------+\n| 1 | 10 |\n+------+------+\n\nAs a window function:\n\nCREATE TABLE t1 (\n pk int primary key,\n a int,\n b int,\n c char(10),\n d decimal(10, 3),\n e real\n);\n\nINSERT INTO t1 VALUES\n( 1, 0, 1, \'one\', 0.1, 0.001),\n( 2, 0, 2, \'two\', 0.2, 0.002),\n( 3, 0, 3, \'three\', 0.3, 0.003),\n( 4, 1, 2, \'three\', 0.4, 0.004),\n( 5, 1, 1, \'two\', 0.5, 0.005),\n( 6, 1, 1, \'one\', 0.6, 0.006),\n( 7, 2, NULL, \'n_one\', 0.5, 0.007),\n( 8, 2, 1, \'n_two\', NULL, 0.008),\n( 9, 2, 2, NULL, 0.7, 0.009),\n(10, 2, 0, \'n_four\', 0.8, 0.010),\n(11, 2, 10, NULL, 0.9, NULL);\n\nSELECT pk, FIRST_VALUE(pk) OVER (ORDER BY pk) AS first_asc,\n LAST_VALUE(pk) OVER (ORDER BY pk) AS last_asc,\n FIRST_VALUE(pk) OVER (ORDER BY pk DESC) AS first_desc,\n LAST_VALUE(pk) OVER (ORDER BY pk DESC) AS last_desc\nFROM t1\nORDER BY pk DESC;\n\n+----+-----------+----------+------------+-----------+\n| pk | first_asc | last_asc | first_desc | last_desc |\n+----+-----------+----------+------------+-----------+\n| 11 | 1 | 11 | 11 | 11 |\n| 10 | 1 | 10 | 11 | 10 |\n| 9 | 1 | 9 | 11 | 9 |\n| 8 | 1 | 8 | 11 | 8 |\n| 7 | 1 | 7 | 11 | 7 |\n| 6 | 1 | 6 | 11 | 6 |\n| 5 | 1 | 5 | 11 | 5 |\n| 4 | 1 | 4 | 11 | 4 |\n| 3 | 1 | 3 | 11 | 3 |\n| 2 | 1 | 2 | 11 | 2 |\n| 1 | 1 | 1 | 11 | 1 |\n+----+-----------+----------+------------+-----------+\n\nCREATE OR REPLACE TABLE t1 (i int);\nINSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);\n\nSELECT i,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and 1 FOLLOWING) AS\nf_1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and 1 FOLLOWING) AS\nl_1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS\nf_1p1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS\nf_1p1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND 1 PRECEDING) AS\nf_2p1p,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND 1 PRECEDING) AS\nf_2p1p,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND 2 FOLLOWING) AS\nf_1f2f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND 2 FOLLOWING) AS\nf_1f2f\nFROM t1;\n\n+------+------+------+--------+--------+--------+--------+--------+--------+\n| i | f_1f | l_1f | f_1p1f | f_1p1f | f_2p1p | f_2p1p | f_1f2f | f_1f2f |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n| 1 | 1 | 2 | 1 | 2 | NULL | NULL | 2 | 3 |\n| 2 | 2 | 3 | 1 | 3 | 1 | 1 | 3 | 4 |\n| 3 | 3 | 4 | 2 | 4 | 1 | 2 | 4 | 5 |\n| 4 | 4 | 5 | 3 | 5 | 2 | 3 | 5 | 6 |\n| 5 | 5 | 6 | 4 | 6 | 3 | 4 | 6 | 7 |\n| 6 | 6 | 7 | 5 | 7 | 4 | 5 | 7 | 8 |\n| 7 | 7 | 8 | 6 | 8 | 5 | 6 | 8 | 9 |\n| 8 | 8 | 9 | 7 | 9 | 6 | 7 | 9 | 10 |\n| 9 | 9 | 10 | 8 | 10 | 7 | 8 | 10 | 10 |\n| 10 | 10 | 10 | 9 | 10 | 8 | 9 | NULL | NULL |\n+------+------+------+--------+--------+--------+--------+--------+--------+\n\nURL: https://mariadb.com/kb/en/last_value/','','https://mariadb.com/kb/en/last_value/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (205,17,'PROCEDURE ANALYSE','Syntax\n------\n\nanalyse([max_elements[,max_memory]])\n\nDescription\n-----------\n\nThis procedure is defined in the sql/sql_analyse.cc file. It examines the\nresult from a query and returns an analysis of the results that suggests\noptimal data types for each column. To obtain this analysis, append PROCEDURE\nANALYSE to the end of a SELECT statement:\n\nSELECT ... FROM ... WHERE ... PROCEDURE ANALYSE([max_elements,[max_memory]])\n\nFor example:\n\nSELECT col1, col2 FROM table1 PROCEDURE ANALYSE(10, 2000);\n\nThe results show some statistics for the values returned by the query, and\npropose an optimal data type for the columns. This can be helpful for checking\nyour existing tables, or after importing new data. You may need to try\ndifferent settings for the arguments so that PROCEDURE ANALYSE() does not\nsuggest the ENUM data type when it is not appropriate.\n\nThe arguments are optional and are used as follows:\n\n* max_elements (default 256) is the maximum number of distinct values that\nanalyse notices per column. This is used by analyse to check whether the\noptimal data type should be of type ENUM; if there are more than max_elements\ndistinct values, then ENUM is not a suggested type.\n* max_memory (default 8192) is the maximum amount of memory that analyse\nshould allocate per column while trying to find all distinct values.\n\nURL: https://mariadb.com/kb/en/procedure-analyse/','','https://mariadb.com/kb/en/procedure-analyse/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (206,17,'ROWNUM','MariaDB starting with 10.6.1\n----------------------------\nFrom MariaDB 10.6.1, the ROWNUM() function is supported.\n\nSyntax\n------\n\nROWNUM()\n\nIn Oracle mode one can just use ROWNUM, without the parentheses.\n\nDescription\n-----------\n\nROWNUM() returns the current number of accepted rows in the current context.\nIt main purpose is to emulate the ROWNUM pseudo column in Oracle. For MariaDB\nnative applications, we recommend the usage of LIMIT, as it is easier to use\nand gives more predictable results than the usage of ROWNUM().\n\nThe main difference between using LIMIT and ROWNUM() to limit the rows in the\nresult is that LIMIT works on the result set while ROWNUM works on the number\nof accepted rows (before any ORDER or GROUP BY clauses).\n\nThe following queries will return the same results:\n\nSELECT * from t1 LIMIT 10;\nSELECT * from t1 WHERE ROWNUM() <= 10;\n\nWhile the following may return different results based on in which orders the\nrows are found:\n\nSELECT * from t1 ORDER BY a LIMIT 10;\nSELECT * from t1 ORDER BY a WHERE ROWNUM() <= 10;\n\nThe recommended way to use ROWNUM to limit the number of returned rows and get\npredictable results is to have the query in a subquery and test for ROWNUM()\nin the outer query:\n\nSELECT * FROM (select * from t1 ORDER BY a) WHERE ROWNUM() <= 10;\n\nROWNUM() can be used in the following contexts:\n\n* SELECT\n* INSERT\n* UPDATE\n* DELETE\n* LOAD DATA INFILE\n\nUsed in other contexts, ROWNUM() will return 0.\n\nExamples\n--------\n\nINSERT INTO t1 VALUES (1,ROWNUM()),(2,ROWNUM()),(3,ROWNUM());\n\nINSERT INTO t1 VALUES (1),(2) returning a, ROWNUM();\n\nUPDATE t1 SET row_num_column=ROWNUM();\n\nDELETE FROM t1 WHERE a < 10 AND ROWNUM() < 2;\n\nLOAD DATA INFILE \'filename\' into table t1 fields terminated by \',\' \n lines terminated by \"\\r\\n\" (a,b) set c=ROWNUM();\n\nOptimizations\n-------------\n\nIn many cases where ROWNUM() is used, MariaDB will use the same optimizations\nit uses with LIMIT.\n\nLIMIT optimization is possible when using ROWNUM in the following manner:\n\n* When one is in a top level WHERE clause comparing ROWNUM() with a numerical\nconstant using any of the following expressions:\nROWNUM() < number\nROWNUM() <= number\nROWNUM() = 1\nROWNUM() can be also be the right argument to the comparison function.\n\nIn the above cases, LIMIT optimization can be done in the following cases:\n\n* For the current sub query when the ROWNUM comparison is done on the top\nlevel:\n\nSELECT * from t1 WHERE ROWNUM() <= 2 AND t1.a > 0\n\n* For an inner sub query, when the upper level has only a ROWNUM() comparison\nin the WHERE clause:\n\nSELECT * from (select * from t1) as t WHERE ROWNUM() <= 2\n\nOther Changes Related to ROWNUM\n-------------------------------\n\nWhen ROWNUM() is used anywhere in a query, the optimization to ignore ORDER BY\nin subqueries are disabled.\n\nThis was done to get the following common Oracle query to work as expected:\n\nselect * from (select * from t1 order by a desc) as t where rownum() <= 2;\n\nBy default MariaDB ignores any ORDER BY in subqueries both because the SQL\nstandard defines results sets in subqueries to be un-ordered and because of\nperformance reasons (especially when using views in subqueries). See MDEV-3926\n\"Wrong result with GROUP BY ... WITH ROLLUP\" for a discussion of this topic.\n\nOther Considerations\n--------------------\n\nWhile MariaDB tries to emulate Oracle\'s usage of ROWNUM() as closely as\npossible, there are cases where the result is different:\n\n* When the optimizer finds rows in a different order (because of different\nstorage methods or optimization). This may also happen in Oracle if one adds\nor deletes an index, in which case the rows may be found in a different order.\n\nNote that usage of ROWNUM() in functions or stored procedures will use their\nown context, not the caller\'s context.\n\nURL: https://mariadb.com/kb/en/rownum/','','https://mariadb.com/kb/en/rownum/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (207,17,'ROW_COUNT','Syntax\n------\n\nROW_COUNT()\n\nDescription\n-----------\n\nROW_COUNT() returns the number of rows updated, inserted or deleted by the\npreceding statement. This is the same as the row count that the mysql client\ndisplays and the value from the mysql_affected_rows() C API function.\n\nGenerally:\n\n* For statements which return a result set (such as SELECT, SHOW, DESC or\nHELP), returns -1, even when the result set is empty. This is also true for\nadministrative statements, such as OPTIMIZE.\n* For DML statements other than SELECT and for ALTER TABLE, returns the number\nof affected rows.\n* For DDL statements (including TRUNCATE) and for other statements which don\'t\nreturn any result set (such as USE, DO, SIGNAL or DEALLOCATE PREPARE), returns\n0.\n\nFor UPDATE, affected rows is by default the number of rows that were actually\nchanged. If the CLIENT_FOUND_ROWS flag to mysql_real_connect() is specified\nwhen connecting to mysqld, affected rows is instead the number of rows matched\nby the WHERE clause.\n\nFor REPLACE, deleted rows are also counted. So, if REPLACE deletes a row and\nadds a new row, ROW_COUNT() returns 2.\n\nFor INSERT ... ON DUPLICATE KEY, updated rows are counted twice. So, if INSERT\nadds a new rows and modifies another row, ROW_COUNT() returns 3.\n\nROW_COUNT() does not take into account rows that are not directly\ndeleted/updated by the last statement. This means that rows deleted by foreign\nkeys or triggers are not counted.\n\nWarning: You can use ROW_COUNT() with prepared statements, but you need to\ncall it after EXECUTE, not after DEALLOCATE PREPARE, because the row count for\nallocate prepare is always 0.\n\nWarning: When used after a CALL statement, this function returns the number of\nrows affected by the last statement in the procedure, not by the whole\nprocedure.\n\nWarning: After INSERT DELAYED, ROW_COUNT() returns the number of the rows you\ntried to insert, not the number of the successful writes.\n\nThis information can also be found in the diagnostics area.\n\nStatements using the ROW_COUNT() function are not safe for replication.\n\nExamples\n--------\n\nCREATE TABLE t (A INT);\n\nINSERT INTO t VALUES(1),(2),(3);\n\nSELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 3 |\n+-------------+\n\nDELETE FROM t WHERE A IN(1,2);\n\nSELECT ROW_COUNT(); \n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 2 |\n+-------------+\n\nExample with prepared statements:\n\nSET @q = \'INSERT INTO t VALUES(1),(2),(3);\';\n\nPREPARE stmt FROM @q;\n\nEXECUTE stmt;\nQuery OK, 3 rows affected (0.39 sec)\nRecords: 3 Duplicates: 0 Warnings: 0\n\nSELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 3 |\n+-------------+\n\nURL: https://mariadb.com/kb/en/row_count/','','https://mariadb.com/kb/en/row_count/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (208,17,'SCHEMA','Syntax\n------\n\nSCHEMA()\n\nDescription\n-----------\n\nThis function is a synonym for DATABASE().\n\nURL: https://mariadb.com/kb/en/schema/','','https://mariadb.com/kb/en/schema/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (209,17,'SESSION_USER','Syntax\n------\n\nSESSION_USER()\n\nDescription\n-----------\n\nSESSION_USER() is a synonym for USER().\n\nURL: https://mariadb.com/kb/en/session_user/','','https://mariadb.com/kb/en/session_user/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (210,17,'SYSTEM_USER','Syntax\n------\n\nSYSTEM_USER()\n\nDescription\n-----------\n\nSYSTEM_USER() is a synonym for USER().\n\nURL: https://mariadb.com/kb/en/system_user/','','https://mariadb.com/kb/en/system_user/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (211,17,'USER','Syntax\n------\n\nUSER()\n\nDescription\n-----------\n\nReturns the current MariaDB user name and host name, given when authenticating\nto MariaDB, as a string in the utf8 character set.\n\nNote that the value of USER() may differ from the value of CURRENT_USER(),\nwhich is the user used to authenticate the current client. CURRENT_ROLE()\nreturns the current active role.\n\nSYSTEM_USER() and SESSION_USER are synonyms for USER().\n\nStatements using the USER() function or one of its synonyms are not safe for\nstatement level replication.\n\nExamples\n--------\n\nshell> mysql --user=\"anonymous\"\n\nSELECT USER(),CURRENT_USER();\n+---------------------+----------------+\n| USER() | CURRENT_USER() |\n+---------------------+----------------+\n| anonymous@localhost | @localhost |\n+---------------------+----------------+\n\nTo select only the IP address, use SUBSTRING_INDEX(),\n\nSELECT SUBSTRING_INDEX(USER(), \'@\', -1);\n+----------------------------------+\n| SUBSTRING_INDEX(USER(), \'@\', -1) |\n+----------------------------------+\n| 192.168.0.101 |\n+----------------------------------+\n\nURL: https://mariadb.com/kb/en/user/','','https://mariadb.com/kb/en/user/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (212,17,'VERSION','Syntax\n------\n\nVERSION()\n\nDescription\n-----------\n\nReturns a string that indicates the MariaDB server version. The string uses\nthe utf8 character set.\n\nExamples\n--------\n\nSELECT VERSION();\n+----------------+\n| VERSION() |\n+----------------+\n| 10.4.7-MariaDB |\n+----------------+\n\nThe VERSION() string may have one or more of the following suffixes:\n\n+---------------------------+------------------------------------------------+\n| Suffix | Description |\n+---------------------------+------------------------------------------------+\n| -embedded | The server is an embedded server (libmysqld). |\n+---------------------------+------------------------------------------------+\n| -log | General logging, slow logging or binary |\n| | (replication) logging is enabled. |\n+---------------------------+------------------------------------------------+\n| -debug | The server is compiled for debugging. |\n+---------------------------+------------------------------------------------+\n| -valgrind | The server is compiled to be instrumented |\n| | with valgrind. |\n+---------------------------+------------------------------------------------+\n\nChanging the Version String\n---------------------------\n\nSome old legacy code may break because they are parsing the VERSION string and\nexpecting a MySQL string or a simple version string like Joomla til API17, see\nMDEV-7780.\n\nFrom MariaDB 10.2, one can fool these applications by setting the version\nstring from the command line or the my.cnf files with --version=....\n\nURL: https://mariadb.com/kb/en/version/','','https://mariadb.com/kb/en/version/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (213,18,'Assignment Operator (:=)','Syntax\n------\n\nvar_name := expr\n\nDescription\n-----------\n\nAssignment operator for assigning a value. The value on the right is assigned\nto the variable on left.\n\nUnlike the = operator, := can always be used to assign a value to a variable.\n\nThis operator works with both user-defined variables and local variables.\n\nWhen assigning the same value to several variables, LAST_VALUE() can be useful.\n\nExamples\n--------\n\nSELECT @x := 10;\n+----------+\n| @x := 10 |\n+----------+\n| 10 |\n+----------+\n\nSELECT @x, @y := @x;\n+------+----------+\n| @x | @y := @x |\n+------+----------+\n| 10 | 10 |\n+------+----------+\n\nURL: https://mariadb.com/kb/en/assignment-operator/','','https://mariadb.com/kb/en/assignment-operator/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (214,18,'Assignment Operator (=)','Syntax\n------\n\nidentifier = expr\n\nDescription\n-----------\n\nThe equal sign is used as both an assignment operator in certain contexts, and\nas a comparison operator. When used as assignment operator, the value on the\nright is assigned to the variable (or column, in some contexts) on the left.\n\nSince its use can be ambiguous, unlike the := assignment operator, the =\nassignment operator cannot be used in all contexts, and is only valid as part\nof a SET statement, or the SET clause of an UPDATE statement\n\nThis operator works with both user-defined variables and local variables.\n\nExamples\n--------\n\nUPDATE table_name SET x = 2 WHERE x > 100;\n\nSET @x = 1, @y := 2;\n\nURL: https://mariadb.com/kb/en/assignment-operators-assignment-operator/','','https://mariadb.com/kb/en/assignment-operators-assignment-operator/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (215,19,'Not Equal Operator','Syntax\n------\n\n<>, !=\n\nDescription\n-----------\n\nNot equal operator. Evaluates both SQL expressions and returns 1 if they are\nnot equal and 0 if they are equal, or NULL if either expression is NULL. If\nthe expressions return different data types, (for instance, a number and a\nstring), performs type conversion.\n\nWhen used in row comparisons these two queries return the same results:\n\nSELECT (t1.a, t1.b) != (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n\nSELECT (t1.a != t2.x) OR (t1.b != t2.y)\nFROM t1 INNER JOIN t2;\n\nExamples\n--------\n\nSELECT \'.01\' <> \'0.01\';\n+-----------------+\n| \'.01\' <> \'0.01\' |\n+-----------------+\n| 1 |\n+-----------------+\n\nSELECT .01 <> \'0.01\';\n+---------------+\n| .01 <> \'0.01\' |\n+---------------+\n| 0 |\n+---------------+\n\nSELECT \'zapp\' <> \'zappp\';\n+-------------------+\n| \'zapp\' <> \'zappp\' |\n+-------------------+\n| 1 |\n+-------------------+\n\nURL: https://mariadb.com/kb/en/not-equal/','','https://mariadb.com/kb/en/not-equal/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (216,19,'<','Syntax\n------\n\n<\n\nDescription\n-----------\n\nLess than operator. Evaluates both SQL expressions and returns 1 if the left\nvalue is less than the right value and 0 if it is not, or NULL if either\nexpression is NULL. If the expressions return different data types, (for\ninstance, a number and a string), performs type conversion.\n\nWhen used in row comparisons these two queries return the same results:\n\nSELECT (t1.a, t1.b) < (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n\nSELECT (t1.a < t2.x) OR ((t1.a = t2.x) AND (t1.b < t2.y))\nFROM t1 INNER JOIN t2;\n\nExamples\n--------\n\nSELECT 2 < 2;\n+-------+\n| 2 < 2 |\n+-------+\n| 0 |\n+-------+\n\nType conversion:\n\nSELECT 3<\'4\';\n+-------+\n| 3<\'4\' |\n+-------+\n| 1 |\n+-------+\n\nCase insensitivity - see Character Sets and Collations:\n\nSELECT \'a\'<\'A\';\n+---------+\n| \'a\'<\'A\' |\n+---------+\n| 0 |\n+---------+\n\nURL: https://mariadb.com/kb/en/less-than/','','https://mariadb.com/kb/en/less-than/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (217,19,'<=','Syntax\n------\n\n<=\n\nDescription\n-----------\n\nLess than or equal operator. Evaluates both SQL expressions and returns 1 if\nthe left value is less than or equal to the right value and 0 if it is not, or\nNULL if either expression is NULL. If the expressions return different data\ntypes, (for instance, a number and a string), performs type conversion.\n\nWhen used in row comparisons these two queries return the same results:\n\nSELECT (t1.a, t1.b) <= (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n\nSELECT (t1.a < t2.x) OR ((t1.a = t2.x) AND (t1.b <= t2.y))\nFROM t1 INNER JOIN t2;\n\nExamples\n--------\n\nSELECT 0.1 <= 2;\n+----------+\n| 0.1 <= 2 |\n+----------+\n| 1 |\n+----------+\n\nSELECT \'a\'<=\'A\';\n+----------+\n| \'a\'<=\'A\' |\n+----------+\n| 1 |\n+----------+\n\nURL: https://mariadb.com/kb/en/less-than-or-equal/','','https://mariadb.com/kb/en/less-than-or-equal/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (218,19,'<=>','Syntax\n------\n\n<=>\n\nDescription\n-----------\n\nNULL-safe equal operator. It performs an equality comparison like the =\noperator, but returns 1 rather than NULL if both operands are NULL, and 0\nrather than NULL if one operand is NULL.\n\na <=> b is equivalent to a = b OR (a IS NULL AND b IS NULL).\n\nWhen used in row comparisons these two queries return the same results:\n\nSELECT (t1.a, t1.b) <=> (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n\nSELECT (t1.a <=> t2.x) AND (t1.b <=> t2.y)\nFROM t1 INNER JOIN t2;\n\nSee also NULL Values in MariaDB.\n\nExamples\n--------\n\nSELECT 1 <=> 1, NULL <=> NULL, 1 <=> NULL;\n+---------+---------------+------------+\n| 1 <=> 1 | NULL <=> NULL | 1 <=> NULL |\n+---------+---------------+------------+\n| 1 | 1 | 0 |\n+---------+---------------+------------+\n\nSELECT 1 = 1, NULL = NULL, 1 = NULL;\n+-------+-------------+----------+\n| 1 = 1 | NULL = NULL | 1 = NULL |\n+-------+-------------+----------+\n| 1 | NULL | NULL |\n+-------+-------------+----------+\n\nURL: https://mariadb.com/kb/en/null-safe-equal/','','https://mariadb.com/kb/en/null-safe-equal/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (219,19,'=','Syntax\n------\n\nleft_expr = right_expr\n\nDescription\n-----------\n\nEqual operator. Evaluates both SQL expressions and returns 1 if they are\nequal, 0 if they are not equal, or NULL if either expression is NULL. If the\nexpressions return different data types (for example, a number and a string),\na type conversion is performed.\n\nWhen used in row comparisons these two queries are synonymous and return the\nsame results:\n\nSELECT (t1.a, t1.b) = (t2.x, t2.y) FROM t1 INNER JOIN t2;\n\nSELECT (t1.a = t2.x) AND (t1.b = t2.y) FROM t1 INNER JOIN t2;\n\nTo perform a NULL-safe comparison, use the <=> operator.\n\n= can also be used as an assignment operator.\n\nExamples\n--------\n\nSELECT 1 = 0;\n+-------+\n| 1 = 0 |\n+-------+\n| 0 |\n+-------+\n\nSELECT \'0\' = 0;\n+---------+\n| \'0\' = 0 |\n+---------+\n| 1 |\n+---------+\n\nSELECT \'0.0\' = 0;\n+-----------+\n| \'0.0\' = 0 |\n+-----------+\n| 1 |\n+-----------+\n\nSELECT \'0.01\' = 0;\n+------------+\n| \'0.01\' = 0 |\n+------------+\n| 0 |\n+------------+\n\nSELECT \'.01\' = 0.01;\n+--------------+\n| \'.01\' = 0.01 |\n+--------------+\n| 1 |\n+--------------+\n\nSELECT (5 * 2) = CONCAT(\'1\', \'0\');\n+----------------------------+\n| (5 * 2) = CONCAT(\'1\', \'0\') |\n+----------------------------+\n| 1 |\n+----------------------------+\n\nSELECT 1 = NULL;\n+----------+\n| 1 = NULL |\n+----------+\n| NULL |\n+----------+\n\nSELECT NULL = NULL;\n+-------------+\n| NULL = NULL |\n+-------------+\n| NULL |\n+-------------+\n\nURL: https://mariadb.com/kb/en/equal/','','https://mariadb.com/kb/en/equal/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (220,19,'>','Syntax\n------\n\n>\n\nDescription\n-----------\n\nGreater than operator. Evaluates both SQL expressions and returns 1 if the\nleft value is greater than the right value and 0 if it is not, or NULL if\neither expression is NULL. If the expressions return different data types,\n(for instance, a number and a string), performs type conversion.\n\nWhen used in row comparisons these two queries return the same results:\n\nSELECT (t1.a, t1.b) > (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n\nSELECT (t1.a > t2.x) OR ((t1.a = t2.x) AND (t1.b > t2.y))\nFROM t1 INNER JOIN t2;\n\nExamples\n--------\n\nSELECT 2 > 2;\n+-------+\n| 2 > 2 |\n+-------+\n| 0 |\n+-------+\n\nSELECT \'b\' > \'a\';\n+-----------+\n| \'b\' > \'a\' |\n+-----------+\n| 1 |\n+-----------+\n\nURL: https://mariadb.com/kb/en/greater-than/','','https://mariadb.com/kb/en/greater-than/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (221,19,'>=','Syntax\n------\n\n>=\n\nDescription\n-----------\n\nGreater than or equal operator. Evaluates both SQL expressions and returns 1\nif the left value is greater than or equal to the right value and 0 if it is\nnot, or NULL if either expression is NULL. If the expressions return different\ndata types, (for instance, a number and a string), performs type conversion.\n\nWhen used in row comparisons these two queries return the same results:\n\nSELECT (t1.a, t1.b) >= (t2.x, t2.y) \nFROM t1 INNER JOIN t2;\n\nSELECT (t1.a > t2.x) OR ((t1.a = t2.x) AND (t1.b >= t2.y))\nFROM t1 INNER JOIN t2;\n\nExamples\n--------\n\nSELECT 2 >= 2;\n+--------+\n| 2 >= 2 |\n+--------+\n| 1 |\n+--------+\n\nSELECT \'A\' >= \'a\';\n+------------+\n| \'A\' >= \'a\' |\n+------------+\n| 1 |\n+------------+\n\nURL: https://mariadb.com/kb/en/greater-than-or-equal/','','https://mariadb.com/kb/en/greater-than-or-equal/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (222,19,'BETWEEN AND','Syntax\n------\n\nexpr BETWEEN min AND max\n\nDescription\n-----------\n\nIf expr is greater than or equal to min and expr is less than or equal to max,\nBETWEEN returns 1, otherwise it returns 0. This is equivalent to the\nexpression (min <= expr AND expr <= max) if all the arguments are of the same\ntype. Otherwise type conversion takes place according to the rules described\nat Type Conversion, but applied to all the three arguments.\n\nExamples\n--------\n\nSELECT 1 BETWEEN 2 AND 3;\n+-------------------+\n| 1 BETWEEN 2 AND 3 |\n+-------------------+\n| 0 |\n+-------------------+\n\nSELECT \'b\' BETWEEN \'a\' AND \'c\';\n+-------------------------+\n| \'b\' BETWEEN \'a\' AND \'c\' |\n+-------------------------+\n| 1 |\n+-------------------------+\n\nSELECT 2 BETWEEN 2 AND \'3\';\n+---------------------+\n| 2 BETWEEN 2 AND \'3\' |\n+---------------------+\n| 1 |\n+---------------------+\n\nSELECT 2 BETWEEN 2 AND \'x-3\';\n+-----------------------+\n| 2 BETWEEN 2 AND \'x-3\' |\n+-----------------------+\n| 0 |\n+-----------------------+\n1 row in set, 1 warning (0.00 sec)\n\nWarning (Code 1292): Truncated incorrect DOUBLE value: \'x-3\'\n\nNULL:\n\nSELECT 1 BETWEEN 1 AND NULL;\n+----------------------+\n| 1 BETWEEN 1 AND NULL |\n+----------------------+\n| NULL |\n+----------------------+\n\nDATE, DATETIME and TIMESTAMP examples. Omitting the time component compares\nagainst 00:00, so later times on the same date are not returned:\n\nCREATE TABLE `x` (\n a date ,\n b datetime,\n c timestamp\n)\n\nINSERT INTO x VALUES \n (\'2018-11-11\', \'2018-11-11 05:15\', \'2018-11-11 05:15\'), \n (\'2018-11-12\', \'2018-11-12 05:15\', \'2018-11-12 05:15\');\n\nSELECT * FROM x WHERE a BETWEEN \'2018-11-11\' AND \'2018-11-12\';\n+------------+---------------------+---------------------+\n| a | b | c |\n+------------+---------------------+---------------------+\n| 2018-11-11 | 2018-11-11 05:15:00 | 2018-11-11 05:15:00 |\n| 2018-11-12 | 2018-11-12 05:15:00 | 2018-11-12 05:15:00 |\n+------------+---------------------+---------------------+\n\nSELECT * FROM x WHERE b BETWEEN \'2018-11-11\' AND \'2018-11-12\';\n+------------+---------------------+---------------------+\n| a | b | c |\n+------------+---------------------+---------------------+\n| 2018-11-11 | 2018-11-11 05:15:00 | 2018-11-11 05:15:00 |\n+------------+---------------------+---------------------+\n\nSELECT * FROM x WHERE c BETWEEN \'2018-11-11\' AND \'2018-11-12\';\n+------------+---------------------+---------------------+\n| a | b | c |\n+------------+---------------------+---------------------+\n| 2018-11-11 | 2018-11-11 05:15:00 | 2018-11-11 05:15:00 |\n+------------+---------------------+---------------------+\n\nURL: https://mariadb.com/kb/en/between-and/','','https://mariadb.com/kb/en/between-and/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (223,19,'COALESCE','Syntax\n------\n\nCOALESCE(value,...)\n\nDescription\n-----------\n\nReturns the first non-NULL value in the list, or NULL if there are no non-NULL\nvalues. At least one parameter must be passed.\n\nThe function is useful when substituting a default value for null values when\ndisplaying data.\n\nSee also NULL Values in MariaDB.\n\nExamples\n--------\n\nSELECT COALESCE(NULL,1);\n+------------------+\n| COALESCE(NULL,1) |\n+------------------+\n| 1 |\n+------------------+\n\nSELECT COALESCE(NULL,NULL,NULL);\n+--------------------------+\n| COALESCE(NULL,NULL,NULL) |\n+--------------------------+\n| NULL |\n+--------------------------+\n\nWhen two arguments are given, COALESCE() is the same as IFNULL():\n\nSET @a=NULL, @b=1;\n\nSELECT COALESCE(@a, @b), IFNULL(@a, @b);\n+------------------+----------------+\n| COALESCE(@a, @b) | IFNULL(@a, @b) |\n+------------------+----------------+\n| 1 | 1 |\n+------------------+----------------+\n\nHex type confusion:\n\nCREATE TABLE t1 (a INT, b VARCHAR(10));\nINSERT INTO t1 VALUES (0x31, 0x61),(COALESCE(0x31), COALESCE(0x61));\n\nSELECT * FROM t1;\n+------+------+\n| a | b |\n+------+------+\n| 49 | a |\n| 1 | a |\n+------+------+\n\nThe reason for the differing results above is that when 0x31 is inserted\ndirectly to the column, it\'s treated as a number (see Hexadecimal Literals),\nwhile when 0x31 is passed to COALESCE(), it\'s treated as a string, because:\n\n* HEX values have a string data type by default.\n* COALESCE() has the same data type as the argument.\n\nSubstituting zero for NULL (in this case when the aggregate function returns\nNULL after finding no rows):\n\nSELECT SUM(score) FROM student;\n+------------+\n| SUM(score) |\n+------------+\n| NULL |\n+------------+\n\nSELECT COALESCE(SUM(score),0) FROM student;\n+------------------------+\n| COALESCE(SUM(score),0) |\n+------------------------+\n| 0 |\n+------------------------+\n\nURL: https://mariadb.com/kb/en/coalesce/','','https://mariadb.com/kb/en/coalesce/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (224,19,'GREATEST','Syntax\n------\n\nGREATEST(value1,value2,...)\n\nDescription\n-----------\n\nWith two or more arguments, returns the largest (maximum-valued) argument. The\narguments are compared using the same rules as for LEAST().\n\nExamples\n--------\n\nSELECT GREATEST(2,0);\n+---------------+\n| GREATEST(2,0) |\n+---------------+\n| 2 |\n+---------------+\n\nSELECT GREATEST(34.0,3.0,5.0,767.0);\n+------------------------------+\n| GREATEST(34.0,3.0,5.0,767.0) |\n+------------------------------+\n| 767.0 |\n+------------------------------+\n\nSELECT GREATEST(\'B\',\'A\',\'C\');\n+-----------------------+\n| GREATEST(\'B\',\'A\',\'C\') |\n+-----------------------+\n| C |\n+-----------------------+\n\nURL: https://mariadb.com/kb/en/greatest/','','https://mariadb.com/kb/en/greatest/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (225,19,'IN','Syntax\n------\n\nexpr IN (value,...)\n\nDescription\n-----------\n\nReturns 1 if expr is equal to any of the values in the IN list, else returns\n0. If all values are constants, they are evaluated according to the type of\nexpr and sorted. The search for the item then is done using a binary search.\nThis means IN is very quick if the IN value list consists entirely of\nconstants. Otherwise, type conversion takes place according to the rules\ndescribed at Type Conversion, but applied to all the arguments.\n\nIf expr is NULL, IN always returns NULL. If at least one of the values in the\nlist is NULL, and one of the comparisons is true, the result is 1. If at least\none of the values in the list is NULL and none of the comparisons is true, the\nresult is NULL.\n\nExamples\n--------\n\nSELECT 2 IN (0,3,5,7);\n+----------------+\n| 2 IN (0,3,5,7) |\n+----------------+\n| 0 |\n+----------------+\n\nSELECT \'wefwf\' IN (\'wee\',\'wefwf\',\'weg\');\n+----------------------------------+\n| \'wefwf\' IN (\'wee\',\'wefwf\',\'weg\') |\n+----------------------------------+\n| 1 |\n+----------------------------------+\n\nType conversion:\n\nSELECT 1 IN (\'1\', \'2\', \'3\');\n+----------------------+\n| 1 IN (\'1\', \'2\', \'3\') |\n+----------------------+\n| 1 |\n+----------------------+\n\nSELECT NULL IN (1, 2, 3);\n+-------------------+\n| NULL IN (1, 2, 3) |\n+-------------------+\n| NULL |\n+-------------------+\n\nSELECT 1 IN (1, 2, NULL);\n+-------------------+\n| 1 IN (1, 2, NULL) |\n+-------------------+\n| 1 |\n+-------------------+\n\nSELECT 5 IN (1, 2, NULL);\n+-------------------+\n| 5 IN (1, 2, NULL) |\n+-------------------+\n| NULL |\n+-------------------+\n\nURL: https://mariadb.com/kb/en/in/','','https://mariadb.com/kb/en/in/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (226,19,'INTERVAL','Syntax\n------\n\nINTERVAL(N,N1,N2,N3,...)\n\nDescription\n-----------\n\nReturns the index of the last argument that is less than the first argument or\nis NULL.\n\nReturns 0 if N < N1, 1 if N < N2, 2 if N < N3 and so on or -1 if N is NULL.\nAll arguments are treated as integers. It is required that N1 < N2 < N3 < ...\n< Nn for this function to work correctly. This is because a fast binary search\nis used.\n\nExamples\n--------\n\nSELECT INTERVAL(23, 1, 15, 17, 30, 44, 200);\n+--------------------------------------+\n| INTERVAL(23, 1, 15, 17, 30, 44, 200) |\n+--------------------------------------+\n| 3 |\n+--------------------------------------+\n\nSELECT INTERVAL(10, 1, 10, 100, 1000);\n+--------------------------------+\n| INTERVAL(10, 1, 10, 100, 1000) |\n+--------------------------------+\n| 2 |\n+--------------------------------+\n\nSELECT INTERVAL(22, 23, 30, 44, 200);\n+-------------------------------+\n| INTERVAL(22, 23, 30, 44, 200) |\n+-------------------------------+\n| 0 |\n+-------------------------------+\n\nSELECT INTERVAL(10, 2, NULL);\n+-----------------------+\n| INTERVAL(10, 2, NULL) |\n+-----------------------+\n| 2 |\n+-----------------------+\n\nURL: https://mariadb.com/kb/en/interval/','','https://mariadb.com/kb/en/interval/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (227,19,'IS','Syntax\n------\n\nIS boolean_value\n\nDescription\n-----------\n\nTests a value against a boolean value, where boolean_value can be TRUE, FALSE,\nor UNKNOWN.\n\nThere is an important difference between using IS TRUE or comparing a value\nwith TRUE using =. When using =, only 1 equals to TRUE. But when using IS\nTRUE, all values which are logically true (like a number > 1) return TRUE.\n\nExamples\n--------\n\nSELECT 1 IS TRUE, 0 IS FALSE, NULL IS UNKNOWN;\n+-----------+------------+-----------------+\n| 1 IS TRUE | 0 IS FALSE | NULL IS UNKNOWN |\n+-----------+------------+-----------------+\n| 1 | 1 | 1 |\n+-----------+------------+-----------------+\n\nDifference between = and IS TRUE:\n\nSELECT 2 = TRUE, 2 IS TRUE;\n+----------+-----------+\n| 2 = TRUE | 2 IS TRUE |\n+----------+-----------+\n| 0 | 1 |\n+----------+-----------+\n\nURL: https://mariadb.com/kb/en/is/','','https://mariadb.com/kb/en/is/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (228,19,'IS NOT','Syntax\n------\n\nIS NOT boolean_value\n\nDescription\n-----------\n\nTests a value against a boolean value, where boolean_value can be TRUE, FALSE,\nor UNKNOWN.\n\nExamples\n--------\n\nSELECT 1 IS NOT UNKNOWN, 0 IS NOT UNKNOWN, NULL IS NOT UNKNOWN;\n+------------------+------------------+---------------------+\n| 1 IS NOT UNKNOWN | 0 IS NOT UNKNOWN | NULL IS NOT UNKNOWN |\n+------------------+------------------+---------------------+\n| 1 | 1 | 0 |\n+------------------+------------------+---------------------+\n\nSELECT NULL IS NOT TRUE, NULL IS NOT FALSE;\n+------------------+-------------------+\n| NULL IS NOT TRUE | NULL IS NOT FALSE |\n+------------------+-------------------+\n| 1 | 1 |\n+------------------+-------------------+\n\nURL: https://mariadb.com/kb/en/is-not/','','https://mariadb.com/kb/en/is-not/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (229,19,'IS NOT NULL','Syntax\n------\n\nIS NOT NULL\n\nDescription\n-----------\n\nTests whether a value is not NULL. See also NULL Values in MariaDB.\n\nExamples\n--------\n\nSELECT 1 IS NOT NULL, 0 IS NOT NULL, NULL IS NOT NULL;\n+---------------+---------------+------------------+\n| 1 IS NOT NULL | 0 IS NOT NULL | NULL IS NOT NULL |\n+---------------+---------------+------------------+\n| 1 | 1 | 0 |\n+---------------+---------------+------------------+\n\nURL: https://mariadb.com/kb/en/is-not-null/','','https://mariadb.com/kb/en/is-not-null/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (230,19,'IS NULL','Syntax\n------\n\nIS NULL\n\nDescription\n-----------\n\nTests whether a value is NULL. See also NULL Values in MariaDB.\n\nExamples\n--------\n\nSELECT 1 IS NULL, 0 IS NULL, NULL IS NULL;\n+-----------+-----------+--------------+\n| 1 IS NULL | 0 IS NULL | NULL IS NULL |\n+-----------+-----------+--------------+\n| 0 | 0 | 1 |\n+-----------+-----------+--------------+\n\nCompatibility\n-------------\n\nSome ODBC applications use the syntax auto_increment_field IS NOT NULL to find\nthe latest row that was inserted with an autogenerated key value. If your\napplications need this, you can set the sql_auto_is_null variable to 1.\n\nSET @@sql_auto_is_null=1;\nCREATE TABLE t1 (auto_increment_column INT NOT NULL AUTO_INCREMENT PRIMARY\nKEY);\nINSERT INTO t1 VALUES (NULL);\nSELECT * FROM t1 WHERE auto_increment_column IS NULL;\n\n+-----------------------+\n| auto_increment_column |\n+-----------------------+\n| 1 |\n+-----------------------+\n\nURL: https://mariadb.com/kb/en/is-null/','','https://mariadb.com/kb/en/is-null/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (231,19,'ISNULL','Syntax\n------\n\nISNULL(expr)\n\nDescription\n-----------\n\nIf expr is NULL, ISNULL() returns 1, otherwise it returns 0.\n\nSee also NULL Values in MariaDB.\n\nExamples\n--------\n\nSELECT ISNULL(1+1);\n+-------------+\n| ISNULL(1+1) |\n+-------------+\n| 0 |\n+-------------+\n\nSELECT ISNULL(1/0);\n+-------------+\n| ISNULL(1/0) |\n+-------------+\n| 1 |\n+-------------+\n\nURL: https://mariadb.com/kb/en/isnull/','','https://mariadb.com/kb/en/isnull/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (232,19,'LEAST','Syntax\n------\n\nLEAST(value1,value2,...)\n\nDescription\n-----------\n\nWith two or more arguments, returns the smallest (minimum-valued) argument.\nThe arguments are compared using the following rules:\n\n* If the return value is used in an INTEGER context or all arguments are\ninteger-valued, they are compared as integers.\n* If the return value is used in a REAL context or all arguments are\nreal-valued, they are compared as reals.\n* If any argument is a case-sensitive string, the arguments are compared as\ncase-sensitive strings.\n* In all other cases, the arguments are compared as case-insensitive strings.\n\nLEAST() returns NULL if any argument is NULL.\n\nExamples\n--------\n\nSELECT LEAST(2,0);\n+------------+\n| LEAST(2,0) |\n+------------+\n| 0 |\n+------------+\n\nSELECT LEAST(34.0,3.0,5.0,767.0);\n+---------------------------+\n| LEAST(34.0,3.0,5.0,767.0) |\n+---------------------------+\n| 3.0 |\n+---------------------------+\n\nSELECT LEAST(\'B\',\'A\',\'C\');\n+--------------------+\n| LEAST(\'B\',\'A\',\'C\') |\n+--------------------+\n| A |\n+--------------------+\n\nURL: https://mariadb.com/kb/en/least/','','https://mariadb.com/kb/en/least/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (233,19,'NOT BETWEEN','Syntax\n------\n\nexpr NOT BETWEEN min AND max\n\nDescription\n-----------\n\nThis is the same as NOT (expr BETWEEN min AND max).\n\nNote that the meaning of the alternative form NOT expr BETWEEN min AND max is\naffected by the HIGH_NOT_PRECEDENCE SQL_MODE flag.\n\nExamples\n--------\n\nSELECT 1 NOT BETWEEN 2 AND 3;\n+-----------------------+\n| 1 NOT BETWEEN 2 AND 3 |\n+-----------------------+\n| 1 |\n+-----------------------+\n\nSELECT \'b\' NOT BETWEEN \'a\' AND \'c\';\n+-----------------------------+\n| \'b\' NOT BETWEEN \'a\' AND \'c\' |\n+-----------------------------+\n| 0 |\n+-----------------------------+\n\nNULL:\n\nSELECT 1 NOT BETWEEN 1 AND NULL;\n+--------------------------+\n| 1 NOT BETWEEN 1 AND NULL |\n+--------------------------+\n| NULL |\n+--------------------------+\n\nURL: https://mariadb.com/kb/en/not-between/','','https://mariadb.com/kb/en/not-between/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (234,19,'NOT IN','Syntax\n------\n\nexpr NOT IN (value,...)\n\nDescription\n-----------\n\nThis is the same as NOT (expr IN (value,...)).\n\nExamples\n--------\n\nSELECT 2 NOT IN (0,3,5,7);\n+--------------------+\n| 2 NOT IN (0,3,5,7) |\n+--------------------+\n| 1 |\n+--------------------+\n\nSELECT \'wefwf\' NOT IN (\'wee\',\'wefwf\',\'weg\');\n+--------------------------------------+\n| \'wefwf\' NOT IN (\'wee\',\'wefwf\',\'weg\') |\n+--------------------------------------+\n| 0 |\n+--------------------------------------+\n\nSELECT 1 NOT IN (\'1\', \'2\', \'3\');\n+--------------------------+\n| 1 NOT IN (\'1\', \'2\', \'3\') |\n+--------------------------+\n| 0 |\n+--------------------------+\n\nNULL:\n\nSELECT NULL NOT IN (1, 2, 3);\n+-----------------------+\n| NULL NOT IN (1, 2, 3) |\n+-----------------------+\n| NULL |\n+-----------------------+\n\nSELECT 1 NOT IN (1, 2, NULL);\n+-----------------------+\n| 1 NOT IN (1, 2, NULL) |\n+-----------------------+\n| 0 |\n+-----------------------+\n\nSELECT 5 NOT IN (1, 2, NULL);\n+-----------------------+\n| 5 NOT IN (1, 2, NULL) |\n+-----------------------+\n| NULL |\n+-----------------------+\n\nURL: https://mariadb.com/kb/en/not-in/','','https://mariadb.com/kb/en/not-in/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (235,20,'&','Syntax\n------\n\n&\n\nDescription\n-----------\n\nBitwise AND. Converts the values to binary and compares bits. Only if both the\ncorresponding bits are 1 is the resulting bit also 1.\n\nSee also bitwise OR.\n\nExamples\n--------\n\nSELECT 2&1;\n+-----+\n| 2&1 |\n+-----+\n| 0 |\n+-----+\n\nSELECT 3&1;\n+-----+\n| 3&1 |\n+-----+\n| 1 |\n+-----+\n\nSELECT 29 & 15;\n+---------+\n| 29 & 15 |\n+---------+\n| 13 |\n+---------+\n\nURL: https://mariadb.com/kb/en/bitwise_and/','','https://mariadb.com/kb/en/bitwise_and/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (236,20,'<<','Syntax\n------\n\nvalue1 << value2\n\nDescription\n-----------\n\nConverts a longlong (BIGINT) number (value1) to binary and shifts value2 units\nto the left.\n\nExamples\n--------\n\nSELECT 1 << 2;\n+--------+\n| 1 << 2 |\n+--------+\n| 4 |\n+--------+\n\nURL: https://mariadb.com/kb/en/shift-left/','','https://mariadb.com/kb/en/shift-left/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (237,20,'>>','Syntax\n------\n\nvalue1 >> value2\n\nDescription\n-----------\n\nConverts a longlong (BIGINT) number (value1) to binary and shifts value2 units\nto the right.\n\nExamples\n--------\n\nSELECT 4 >> 2;\n+--------+\n| 4 >> 2 |\n+--------+\n| 1 |\n+--------+\n\nURL: https://mariadb.com/kb/en/shift-right/','','https://mariadb.com/kb/en/shift-right/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (238,20,'BIT_COUNT','Syntax\n------\n\nBIT_COUNT(N)\n\nDescription\n-----------\n\nReturns the number of bits that are set in the argument N.\n\nExamples\n--------\n\nSELECT BIT_COUNT(29), BIT_COUNT(b\'101010\');\n+---------------+----------------------+\n| BIT_COUNT(29) | BIT_COUNT(b\'101010\') |\n+---------------+----------------------+\n| 4 | 3 |\n+---------------+----------------------+\n\nURL: https://mariadb.com/kb/en/bit_count/','','https://mariadb.com/kb/en/bit_count/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (239,20,'^','Syntax\n------\n\n^\n\nDescription\n-----------\n\nBitwise XOR. Converts the values to binary and compares bits. If one (and only\none) of the corresponding bits is 1 is the resulting bit also 1.\n\nExamples\n--------\n\nSELECT 1 ^ 1;\n+-------+\n| 1 ^ 1 |\n+-------+\n| 0 |\n+-------+\n\nSELECT 1 ^ 0;\n+-------+\n| 1 ^ 0 |\n+-------+\n| 1 |\n+-------+\n\nSELECT 11 ^ 3;\n+--------+\n| 11 ^ 3 |\n+--------+\n| 8 |\n+--------+\n\nURL: https://mariadb.com/kb/en/bitwise-xor/','','https://mariadb.com/kb/en/bitwise-xor/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (240,20,'|','Syntax\n------\n\n|\n\nDescription\n-----------\n\nBitwise OR. Converts the values to binary and compares bits. If either of the\ncorresponding bits has a value of 1, the resulting bit is also 1.\n\nSee also bitwise AND.\n\nExamples\n--------\n\nSELECT 2|1;\n+-----+\n| 2|1 |\n+-----+\n| 3 |\n+-----+\n\nSELECT 29 | 15;\n+---------+\n| 29 | 15 |\n+---------+\n| 31 |\n+---------+\n\nURL: https://mariadb.com/kb/en/bitwise-or/','','https://mariadb.com/kb/en/bitwise-or/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (241,20,'~','Syntax\n------\n\n~\n\nDescription\n-----------\n\nBitwise NOT. Converts the value to 4 bytes binary and inverts all bits.\n\nExamples\n--------\n\nSELECT 3 & ~1;\n+--------+\n| 3 & ~1 |\n+--------+\n| 2 |\n+--------+\n\nSELECT 5 & ~1;\n+--------+\n| 5 & ~1 |\n+--------+\n| 4 |\n+--------+\n\nURL: https://mariadb.com/kb/en/bitwise-not/','','https://mariadb.com/kb/en/bitwise-not/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (242,20,'Parentheses','Parentheses are sometimes called precedence operators - this means that they\ncan be used to change the other operator\'s precedence in an expression. The\nexpressions that are written between parentheses are computed before the\nexpressions that are written outside. Parentheses must always contain an\nexpression (that is, they cannot be empty), and can be nested.\n\nFor example, the following expressions could return different results:\n\n* NOT a OR b\n* NOT (a OR b)\n\nIn the first case, NOT applies to a, so if a is FALSE or b is TRUE, the\nexpression returns TRUE. In the second case, NOT applies to the result of a OR\nb, so if at least one of a or b is TRUE, the expression is TRUE.\n\nWhen the precedence of operators is not intuitive, you can use parentheses to\nmake it immediately clear for whoever reads the statement.\n\nThe precedence of the NOT operator can also be affected by the\nHIGH_NOT_PRECEDENCE SQL_MODE flag.\n\nOther uses\n----------\n\nParentheses must always be used to enclose subqueries.\n\nParentheses can also be used in a JOIN statement between multiple tables to\ndetermine which tables must be joined first.\n\nAlso, parentheses are used to enclose the list of parameters to be passed to\nbuilt-in functions, user-defined functions and stored routines. However, when\nno parameter is passed to a stored procedure, parentheses are optional. For\nbuiltin functions and user-defined functions, spaces are not allowed between\nthe function name and the open parenthesis, unless the IGNORE_SPACE SQL_MODE\nis set. For stored routines (and for functions if IGNORE_SPACE is set) spaces\nare allowed before the open parenthesis, including tab characters and new line\ncharacters.\n\nSyntax errors\n-------------\n\nIf there are more open parentheses than closed parentheses, the error usually\nlooks like this:\n\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual that\ncorresponds to your MariaDB server version for the right syntax to use near \'\'\na\nt line 1\n\nNote the empty string.\n\nIf there are more closed parentheses than open parentheses, the error usually\nlooks like this:\n\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual that\ncorresponds to your MariaDB server version for the right syntax to use near \')\'\nat line 1\n\nNote the quoted closed parenthesis.\n\nURL: https://mariadb.com/kb/en/parentheses/','','https://mariadb.com/kb/en/parentheses/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (243,20,'TRUE FALSE','Description\n-----------\n\nThe constants TRUE and FALSE evaluate to 1 and 0, respectively. The constant\nnames can be written in any lettercase.\n\nExamples\n--------\n\nSELECT TRUE, true, FALSE, false;\n+------+------+-------+-------+\n| TRUE | TRUE | FALSE | FALSE |\n+------+------+-------+-------+\n| 1 | 1 | 0 | 0 |\n+------+------+-------+-------+\n\nURL: https://mariadb.com/kb/en/true-false/','','https://mariadb.com/kb/en/true-false/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (244,21,'ANALYZE TABLE','Syntax\n------\n\nANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE tbl_name [,tbl_name ...] \n [PERSISTENT FOR [ALL|COLUMNS ([col_name [,col_name ...]])]\n [INDEXES ([index_name [,index_name ...]])]]\n\nDescription\n-----------\n\nANALYZE TABLE analyzes and stores the key distribution for a table (index\nstatistics). This statement works with MyISAM, Aria and InnoDB tables. During\nthe analysis, InnoDB will allow reads/writes, and MyISAM/Aria reads/inserts.\nFor MyISAM tables, this statement is equivalent to using myisamchk --analyze.\n\nFor more information on how the analysis works within InnoDB, see InnoDB\nLimitations.\n\nMariaDB uses the stored key distribution to decide the order in which tables\nshould be joined when you perform a join on something other than a constant.\nIn addition, key distributions can be used when deciding which indexes to use\nfor a specific table within a query.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nBy default, ANALYZE TABLE statements are written to the binary log and will be\nreplicated. The NO_WRITE_TO_BINLOG keyword (LOCAL is an alias) will ensure the\nstatement is not written to the binary log.\n\nFrom MariaDB 10.3.19, ANALYZE TABLE statements are not logged to the binary\nlog if read_only is set. See also Read-Only Replicas.\n\nANALYZE TABLE is also supported for partitioned tables. You can use ALTER\nTABLE ... ANALYZE PARTITION to analyze one or more partitions.\n\nThe Aria storage engine supports progress reporting for the ANALYZE TABLE\nstatement.\n\nEngine-Independent Statistics\n-----------------------------\n\nANALYZE TABLE supports engine-independent statistics. See Engine-Independent\nTable Statistics: Collecting Statistics with the ANALYZE TABLE Statement for\nmore information.\n\nUseful Variables\n----------------\n\nFor calculating the number of duplicates, ANALYZE TABLE uses a buffer of\nsort_buffer_size bytes per column. You can slightly increase the speed of\nANALYZE TABLE by increasing this variable.\n\nURL: https://mariadb.com/kb/en/analyze-table/','','https://mariadb.com/kb/en/analyze-table/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (245,21,'CHECK TABLE','Syntax\n------\n\nCHECK TABLE tbl_name [, tbl_name] ... [option] ...\n\noption = {FOR UPGRADE | QUICK | FAST | MEDIUM | EXTENDED | CHANGED}\n\nDescription\n-----------\n\nCHECK TABLE checks a table or tables for errors. CHECK TABLE works for\nArchive, Aria, CSV, InnoDB and MyISAM tables. For Aria and MyISAM tables, the\nkey statistics are updated as well. For CSV, see also Checking and Repairing\nCSV Tables.\n\nAs an alternative, myisamchk is a commandline tool for checking MyISAM tables\nwhen the tables are not being accessed. For Aria tables, there is a similar\ntool: aria_chk.\n\nFor checking dynamic columns integrity, COLUMN_CHECK() can be used.\n\nCHECK TABLE can also check views for problems, such as tables that are\nreferenced in the view definition that no longer exist.\n\nCHECK TABLE is also supported for partitioned tables. You can use ALTER TABLE\n... CHECK PARTITION to check one or more partitions.\n\nThe meaning of the different options are as follows - note that this can vary\na bit between storage engines:\n\n+-----+----------------------------------------------------------------------+\n| FOR | Do a very quick check if the storage format for the table has |\n| UPG | changed so that one needs to do a REPAIR. This is only needed when |\n| ADE | one upgrades between major versions of MariaDB or MySQL. This is |\n| | usually done by running mysql_upgrade. |\n+-----+----------------------------------------------------------------------+\n| FAS | Only check tables that has not been closed properly or are marked |\n| | as corrupt. Only supported by the MyISAM and Aria engines. For |\n| | other engines the table is checked normally |\n+-----+----------------------------------------------------------------------+\n| CHA | Check only tables that has changed since last REPAIR / CHECK. Only |\n| GED | supported by the MyISAM and Aria engines. For other engines the |\n| | table is checked normally. |\n+-----+----------------------------------------------------------------------+\n| QUI | Do a fast check. For MyISAM and Aria, this means skipping the check |\n| K | of the delete link chain, which may take some time. |\n+-----+----------------------------------------------------------------------+\n| MED | Scan also the data files. Checks integrity between data and index |\n| UM | files with checksums. In most cases this should find all possible |\n| | errors. |\n+-----+----------------------------------------------------------------------+\n| EXT | Does a full check to verify every possible error. For MyISAM and |\n| NDE | Aria, verify for each row that all it keys exists and points to the |\n| | row. This may take a long time on large tables. Ignored by InnoDB |\n| | before MariaDB 10.6.11, MariaDB 10.7.7, MariaDB 10.8.6 and MariaDB |\n| | 10.9.4. |\n+-----+----------------------------------------------------------------------+\n\nFor most cases running CHECK TABLE without options or MEDIUM should be good\nenough.\n\nThe Aria storage engine supports progress reporting for this statement.\n\nIf you want to know if two tables are identical, take a look at CHECKSUM TABLE.\n\nInnoDB\n------\n\nIf CHECK TABLE finds an error in an InnoDB table, MariaDB might shutdown to\nprevent the error propagation. In this case, the problem will be reported in\nthe error log. Otherwise the table or an index might be marked as corrupted,\nto prevent use. This does not happen with some minor problems, like a wrong\nnumber of entries in a secondary index. Those problems are reported in the\noutput of CHECK TABLE.\n\nEach tablespace contains a header with metadata. This header is not checked by\nthis statement.\n\nDuring the execution of CHECK TABLE, other threads may be blocked.\n\nURL: https://mariadb.com/kb/en/check-table/','','https://mariadb.com/kb/en/check-table/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (246,21,'CHECK VIEW','Syntax\n------\n\nCHECK VIEW view_name\n\nDescription\n-----------\n\nThe CHECK VIEW statement was introduced in MariaDB 10.0.18 to assist with\nfixing MDEV-6916, an issue introduced in MariaDB 5.2 where the view algorithms\nwere swapped. It checks whether the view algorithm is correct. It is run as\npart of mysql_upgrade, and should not normally be required in regular use.\n\nURL: https://mariadb.com/kb/en/check-view/','','https://mariadb.com/kb/en/check-view/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (247,21,'CHECKSUM TABLE','Syntax\n------\n\nCHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED ]\n\nDescription\n-----------\n\nCHECKSUM TABLE reports a table checksum. This is very useful if you want to\nknow if two tables are the same (for example on a master and slave).\n\nWith QUICK, the live table checksum is reported if it is available, or NULL\notherwise. This is very fast. A live checksum is enabled by specifying the\nCHECKSUM=1 table option when you create the table; currently, this is\nsupported only for Aria and MyISAM tables.\n\nWith EXTENDED, the entire table is read row by row and the checksum is\ncalculated. This can be very slow for large tables.\n\nIf neither QUICK nor EXTENDED is specified, MariaDB returns a live checksum if\nthe table storage engine supports it and scans the table otherwise.\n\nCHECKSUM TABLE requires the SELECT privilege for the table.\n\nFor a nonexistent table, CHECKSUM TABLE returns NULL and generates a warning.\n\nThe table row format affects the checksum value. If the row format changes,\nthe checksum will change. This means that when a table created with a\nMariaDB/MySQL version is upgraded to another version, the checksum value will\nprobably change.\n\nTwo identical tables should always match to the same checksum value; however,\nalso for non-identical tables there is a very slight chance that they will\nreturn the same value as the hashing algorithm is not completely\ncollision-free.\n\nIdentical Tables\n----------------\n\nIdentical tables mean that the CREATE statement is identical and that the\nfollowing variable, which affects the storage formats, was the same when the\ntables were created:\n\n* mysql56-temporal-format\n\nDifferences Between MariaDB and MySQL\n-------------------------------------\n\nCHECKSUM TABLE may give a different result as MariaDB doesn\'t ignore NULLs in\nthe columns as MySQL 5.1 does (Later MySQL versions should calculate checksums\nthe same way as MariaDB). You can get the \'old style\' checksum in MariaDB by\nstarting mysqld with the --old option. Note however that that the MyISAM and\nAria storage engines in MariaDB are using the new checksum internally, so if\nyou are using --old, the CHECKSUM command will be slower as it needs to\ncalculate the checksum row by row. Starting from MariaDB Server 10.9, --old is\ndeprecated and will be removed in a future release. Set --old-mode or OLD_MODE\nto COMPAT_5_1_CHECKSUM to get \'old style\' checksum.\n\nURL: https://mariadb.com/kb/en/checksum-table/','','https://mariadb.com/kb/en/checksum-table/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (248,21,'OPTIMIZE TABLE','Syntax\n------\n\nOPTIMIZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n [WAIT n | NOWAIT]\n\nDescription\n-----------\n\nOPTIMIZE TABLE has two main functions. It can either be used to defragment\ntables, or to update the InnoDB fulltext index.\n\nMariaDB starting with 10.3.0\n----------------------------\n\nWAIT/NOWAIT\n-----------\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nDefragmenting\n-------------\n\nOPTIMIZE TABLE works for InnoDB (before MariaDB 10.1.1, only if the\ninnodb_file_per_table server system variable is set), Aria, MyISAM and ARCHIVE\ntables, and should be used if you have deleted a large part of a table or if\nyou have made many changes to a table with variable-length rows (tables that\nhave VARCHAR, VARBINARY, BLOB, or TEXT columns). Deleted rows are maintained\nin a linked list and subsequent INSERT operations reuse old row positions.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nBy default, OPTIMIZE TABLE statements are written to the binary log and will\nbe replicated. The NO_WRITE_TO_BINLOG keyword (LOCAL is an alias) will ensure\nthe statement is not written to the binary log.\n\nFrom MariaDB 10.3.19, OPTIMIZE TABLE statements are not logged to the binary\nlog if read_only is set. See also Read-Only Replicas.\n\nOPTIMIZE TABLE is also supported for partitioned tables. You can use ALTER\nTABLE ... OPTIMIZE PARTITION to optimize one or more partitions.\n\nYou can use OPTIMIZE TABLE to reclaim the unused space and to defragment the\ndata file. With other storage engines, OPTIMIZE TABLE does nothing by default,\nand returns this message: \" The storage engine for the table doesn\'t support\noptimize\". However, if the server has been started with the --skip-new option,\nOPTIMIZE TABLE is linked to ALTER TABLE, and recreates the table. This\noperation frees the unused space and updates index statistics.\n\nThe Aria storage engine supports progress reporting for this statement.\n\nIf a MyISAM table is fragmented, concurrent inserts will not be performed\nuntil an OPTIMIZE TABLE statement is executed on that table, unless the\nconcurrent_insert server system variable is set to ALWAYS.\n\nUpdating an InnoDB fulltext index\n---------------------------------\n\nWhen rows are added or deleted to an InnoDB fulltext index, the index is not\nimmediately re-organized, as this can be an expensive operation. Change\nstatistics are stored in a separate location . The fulltext index is only\nfully re-organized when an OPTIMIZE TABLE statement is run.\n\nBy default, an OPTIMIZE TABLE will defragment a table. In order to use it to\nupdate fulltext index statistics, the innodb_optimize_fulltext_only system\nvariable must be set to 1. This is intended to be a temporary setting, and\nshould be reset to 0 once the fulltext index has been re-organized.\n\nSince fulltext re-organization can take a long time, the\ninnodb_ft_num_word_optimize variable limits the re-organization to a number of\nwords (2000 by default). You can run multiple OPTIMIZE statements to fully\nre-organize the index.\n\nDefragmenting InnoDB tablespaces\n--------------------------------\n\nMariaDB 10.1.1 merged the Facebook/Kakao defragmentation patch, allowing one\nto use OPTIMIZE TABLE to defragment InnoDB tablespaces. For this functionality\nto be enabled, the innodb_defragment system variable must be enabled. No new\ntables are created and there is no need to copy data from old tables to new\ntables. Instead, this feature loads n pages (determined by\ninnodb-defragment-n-pages) and tries to move records so that pages would be\nfull of records and then frees pages that are fully empty after the operation.\nNote that tablespace files (including ibdata1) will not shrink as the result\nof defragmentation, but one will get better memory utilization in the InnoDB\nbuffer pool as there are fewer data pages in use.\n\nSee Defragmenting InnoDB Tablespaces for more details.\n\nURL: https://mariadb.com/kb/en/optimize-table/','','https://mariadb.com/kb/en/optimize-table/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (249,21,'REPAIR TABLE','Syntax\n------\n\nREPAIR [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n [QUICK] [EXTENDED] [USE_FRM]\n\nDescription\n-----------\n\nREPAIR TABLE repairs a possibly corrupted table. By default, it has the same\neffect as\n\nmyisamchk --recover tbl_name\n\nor\n\naria_chk --recover tbl_name\n\nSee aria_chk and myisamchk for more.\n\nREPAIR TABLE works for Archive, Aria, CSV and MyISAM tables. For InnoDB, see\nrecovery modes. For CSV, see also Checking and Repairing CSV Tables. For\nArchive, this statement also improves compression. If the storage engine does\nnot support this statement, a warning is issued.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nBy default, REPAIR TABLE statements are written to the binary log and will be\nreplicated. The NO_WRITE_TO_BINLOG keyword (LOCAL is an alias) will ensure the\nstatement is not written to the binary log.\n\nFrom MariaDB 10.3.19, REPAIR TABLE statements are not logged to the binary log\nif read_only is set. See also Read-Only Replicas.\n\nWhen an index is recreated, the storage engine may use a configurable buffer\nin the process. Incrementing the buffer speeds up the index creation. Aria and\nMyISAM allocate a buffer whose size is defined by aria_sort_buffer_size or\nmyisam_sort_buffer_size, also used for ALTER TABLE.\n\nREPAIR TABLE is also supported for partitioned tables. However, the USE_FRM\noption cannot be used with this statement on a partitioned table.\n\nALTER TABLE ... REPAIR PARTITION can be used to repair one or more partitions.\n\nThe Aria storage engine supports progress reporting for this statement.\n\nURL: https://mariadb.com/kb/en/repair-table/','','https://mariadb.com/kb/en/repair-table/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (250,21,'REPAIR VIEW','Syntax\n------\n\nREPAIR [NO_WRITE_TO_BINLOG | LOCAL] VIEW view_name[, view_name] ... [FROM\nMYSQL]\n\nDescription\n-----------\n\nThe REPAIR VIEW statement was introduced to assist with fixing MDEV-6916, an\nissue introduced in MariaDB 5.2 where the view algorithms were swapped\ncompared to their MySQL on disk representation. It checks whether the view\nalgorithm is correct. It is run as part of mysql_upgrade, and should not\nnormally be required in regular use.\n\nBy default it corrects the checksum and if necessary adds the mariadb-version\nfield. If the optional FROM MYSQL clause is used, and no mariadb-version field\nis present, the MERGE and TEMPTABLE algorithms are toggled.\n\nBy default, REPAIR VIEW statements are written to the binary log and will be\nreplicated. The NO_WRITE_TO_BINLOG keyword (LOCAL is an alias) will ensure the\nstatement is not written to the binary log.\n\nURL: https://mariadb.com/kb/en/repair-view/','','https://mariadb.com/kb/en/repair-view/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (251,22,'mysql.func Table','The mysql.func table stores information about user-defined functions (UDFs)\ncreated with the CREATE FUNCTION UDF statement.\n\nMariaDB starting with 10.4\n--------------------------\nIn MariaDB 10.4 and later, this table uses the Aria storage engine.\n\nMariaDB until 10.3\n------------------\nIn MariaDB 10.3 and before, this table uses the MyISAM storage engine.\n\nThe mysql.func table contains the following fields:\n\n+----------+---------+---------+-------+--------------+---------------------+\n| Field | Type | Null | Key | Default | Description |\n+----------+---------+---------+-------+--------------+---------------------+\n| name | char(64 | NO | PRI | | UDF name |\n| | | | | | |\n+----------+---------+---------+-------+--------------+---------------------+\n| ret | tinyint | NO | | 0 | |\n| | 1) | | | | |\n+----------+---------+---------+-------+--------------+---------------------+\n| dl | char(12 | NO | | | Shared library name |\n| | ) | | | | |\n+----------+---------+---------+-------+--------------+---------------------+\n| type | enum(\'f | NO | | NULL | Type, either |\n| | nction\' | | | | function or |\n| | \'aggreg | | | | aggregate. |\n| | te\') | | | | Aggregate |\n| | | | | | functions are |\n| | | | | | summary functions |\n| | | | | | such as SUM() and |\n| | | | | | AVG(). |\n+----------+---------+---------+-------+--------------+---------------------+\n\nExample\n-------\n\nSELECT * FROM mysql.func;\n+------------------------------+-----+--------------+-----------+\n| name | ret | dl | type |\n+------------------------------+-----+--------------+-----------+\n| spider_direct_sql | 2 | ha_spider.so | function |\n| spider_bg_direct_sql | 2 | ha_spider.so | aggregate |\n| spider_ping_table | 2 | ha_spider.so | function |\n| spider_copy_tables | 2 | ha_spider.so | function |\n| spider_flush_table_mon_cache | 2 | ha_spider.so | function |\n+------------------------------+-----+--------------+-----------+\n\nURL: https://mariadb.com/kb/en/mysqlfunc-table/','','https://mariadb.com/kb/en/mysqlfunc-table/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (252,22,'CREATE FUNCTION UDF','Syntax\n------\n\nCREATE [OR REPLACE] [AGGREGATE] FUNCTION [IF NOT EXISTS] function_name\n RETURNS {STRING|INTEGER|REAL|DECIMAL}\n SONAME shared_library_name\n\nDescription\n-----------\n\nA user-defined function (UDF) is a way to extend MariaDB with a new function\nthat works like a native (built-in) MariaDB function such as ABS() or CONCAT().\n\nfunction_name is the name that should be used in SQL statements to invoke the\nfunction.\n\nTo create a function, you must have the INSERT privilege for the mysql\ndatabase. This is necessary becauseCREATE FUNCTION adds a row to the\nmysql.func system table that records the function\'s name, type, and shared\nlibrary name. If you do not have this table, you should run the mysql_upgrade\ncommand to create it.\n\nUDFs need to be written in C, C++ or another language that uses C calling\nconventions, MariaDB needs to have been dynamically compiled, and your\noperating system must support dynamic loading.\n\nFor an example, see sql/udf_example.cc in the source tree. For a collection of\nexisting UDFs see http://www.mysqludf.org/.\n\nStatements making use of user-defined functions are not safe for replication.\n\nFor creating a stored function as opposed to a user-defined function, see\nCREATE FUNCTION.\n\nFor valid identifiers to use as function names, see Identifier Names.\n\nRETURNS\n-------\n\nThe RETURNS clause indicates the type of the function\'s return value, and can\nbe one of STRING, INTEGER, REAL or DECIMAL. DECIMAL functions currently return\nstring values and should be written like STRING functions.\n\nshared_library_name\n-------------------\n\nshared_library_name is the basename of the shared object file that contains\nthe code that implements the function. The file must be located in the plugin\ndirectory. This directory is given by the value of the plugin_dir system\nvariable. Note that before MariaDB/MySQL 5.1, the shared object could be\nlocated in any directory that was searched by your system\'s dynamic linker.\n\nAGGREGATE\n---------\n\nAggregate functions are summary functions such as SUM() and AVG().\n\nMariaDB starting with 10.4\n--------------------------\nAggregate UDF functions can be used as window functions.\n\nOR REPLACE\n----------\n\nMariaDB starting with 10.1.3\n----------------------------\nThe OR REPLACE clause was added in MariaDB 10.1.3\n\nIf the optional OR REPLACE clause is used, it acts as a shortcut for:\n\nDROP FUNCTION IF EXISTS function_name;\nCREATE FUNCTION name ...;\n\nIF NOT EXISTS\n-------------\n\nMariaDB starting with 10.1.3\n----------------------------\nThe IF NOT EXISTS clause was added in MariaDB 10.1.3\n\nWhen the IF NOT EXISTS clause is used, MariaDB will return a warning instead\nof an error if the specified function already exists. Cannot be used together\nwith OR REPLACE.\n\nUpgrading a UDF\n---------------\n\nTo upgrade the UDF\'s shared library, first run a DROP FUNCTION statement, then\nupgrade the shared library and finally run the CREATE FUNCTION statement. If\nyou upgrade without following this process, you may crash the server.\n\nExamples\n--------\n\nCREATE FUNCTION jsoncontains_path RETURNS integer SONAME \'ha_connect.so\';\nQuery OK, 0 rows affected (0.00 sec)\n\nOR REPLACE and IF NOT EXISTS:\n\nCREATE FUNCTION jsoncontains_path RETURNS integer SONAME \'ha_connect.so\';\nERROR 1125 (HY000): Function \'jsoncontains_path\' already exists\n\nCREATE OR REPLACE FUNCTION jsoncontains_path RETURNS integer SONAME\n\'ha_connect.so\';\nQuery OK, 0 rows affected (0.00 sec)\n\nCREATE FUNCTION IF NOT EXISTS jsoncontains_path RETURNS integer SONAME\n\'ha_connect.so\';\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+-------+------+---------------------------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------------------------+\n| Note | 1125 | Function \'jsoncontains_path\' already exists |\n+-------+------+---------------------------------------------+\n\nURL: https://mariadb.com/kb/en/create-function-udf/','','https://mariadb.com/kb/en/create-function-udf/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (253,22,'DROP FUNCTION UDF','Syntax\n------\n\nDROP FUNCTION [IF EXISTS] function_name\n\nDescription\n-----------\n\nThis statement drops the user-defined function (UDF) named function_name.\n\nTo drop a function, you must have the DELETE privilege for the mysql database.\nThis is because DROP FUNCTION removes the row from the mysql.func system table\nthat records the function\'s name, type and shared library name.\n\nFor dropping a stored function, see DROP FUNCTION.\n\nUpgrading a UDF\n---------------\n\nTo upgrade the UDF\'s shared library, first run a DROP FUNCTION statement, then\nupgrade the shared library and finally run the CREATE FUNCTION statement. If\nyou upgrade without following this process, you may crash the server.\n\nExamples\n--------\n\nDROP FUNCTION jsoncontains_path;\n\nIF EXISTS:\n\nDROP FUNCTION jsoncontains_path;\nERROR 1305 (42000): FUNCTION test.jsoncontains_path does not exist\n\nDROP FUNCTION IF EXISTS jsoncontains_path;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+-------+------+------------------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------------------+\n| Note | 1305 | FUNCTION test.jsoncontains_path does not exist |\n+-------+------+------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/drop-function-udf/','','https://mariadb.com/kb/en/drop-function-udf/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (254,22,'Creating User-Defined Functions','User-defined functions allow MariaDB to be extended with a new function that\nworks like a native (built-in) MariaDB function such as ABS() or CONCAT().\nThere are alternative ways to add a new function: writing a native function\n(which requires modifying and compiling the server source code), or writing a\nstored function.\n\nStatements making use of user-defined functions are not safe for replication.\n\nFunctions are written in C or C++, and to make use of them, the operating\nsystem must support dynamic loading.\n\nEach new SQL function requires corresponding functions written in C/C++. In\nthe list below, at least the main function - x() - and one other, are\nrequired. x should be replaced by the name of the function you are creating.\n\nAll functions need to be thread-safe, so not global or static variables that\nchange can be allocated. Memory is allocated in x_init()/ and freed in\nx_deinit().\n\nSimple Functions\n----------------\n\nx()\n---\n\nRequired for all UDFs; this is where the results are calculated.\n\n+------------------------------------------+----------------------------------+\n| C/C++ type | SQL type |\n+------------------------------------------+----------------------------------+\n| char * | STRING |\n+------------------------------------------+----------------------------------+\n| long long | INTEGER |\n+------------------------------------------+----------------------------------+\n| double | REAL |\n+------------------------------------------+----------------------------------+\n\nDECIMAL functions return string values, and so should be written accordingly.\nIt is not possible to create ROW functions.\n\nx_init()\n--------\n\nInitialization function for x(). Can be used for the following:\n\n* Check the number of arguments to X() (the SQL equivalent).\n* Verify the argument types, or to force arguments to be of a particular type\nafter the function is called.\n* Specify whether the result can be NULL.\n* Specify the maximum result length.\n* For REAL functions, specify the maximum number of decimals for the result.\n* Allocate any required memory.\n\nx_deinit()\n----------\n\nDe-initialization function for x(). Used to de-allocate memory that was\nallocated in x_init().\n\nDescription\n-----------\n\nEach time the SQL function X() is called:\n\n* MariaDB will first call the C/C++ initialization function, x_init(),\nassuming it exists. All setup will be performed, and if it returns an error,\nthe SQL statement is aborted and no further functions are called.\n* If there is no x_init() function, or it has been called and did not return\nan error, x() is then called once per row.\n* After all rows have finished processing, x_deinit() is called, if present,\nto clean up by de-allocating any memory that was allocated in x_init().\n* See User-defined Functions Calling Sequences for more details on the\nfunctions.\n\nAggregate Functions\n-------------------\n\nThe following functions are required for aggregate functions, such as AVG()\nand SUM(). When using CREATE FUNCTION, the AGGREGATE keyword is required.\n\nx_clear()\n---------\n\nUsed to reset the current aggregate, but without inserting the argument as the\ninitial aggregate value for the new group.\n\nx_add()\n-------\n\nUsed to add the argument to the current aggregate.\n\nx_remove()\n----------\n\nStarting from MariaDB 10.4, improves the support of window functions (so it is\nnot obligatory to add it) and should remove the argument from the current\naggregate.\n\nDescription\n-----------\n\nEach time the aggregate SQL function X() is called:\n\n* MariaDB will first call the C/C++ initialization function, x_init(),\nassuming it exists. All setup will be performed, and if it returns an error,\nthe SQL statement is aborted and no further functions are called.\n* If there is no x_init() function, or it has been called and did not return\nan error, x() is then called once per row.\n* After all rows have finished processing, x_deinit() is called, if present,\nto clean up by de-allocating any memory that was allocated in x_init().\n\n* MariaDB will first call the C/C++ initialization function, x_init(),\nassuming it exists. All setup will be performed, and if it returns an error,\nthe SQL statement is aborted and no further functions are called.\n* The table is sorted according to the GROUP BY expression.\n* x_clear() is called for the first row of each new group.\n* x_add() is called once per row for each row in the same group.\n* x() is called when the group changes, or after the last row, to get the\naggregate result. \n* The latter three steps are repeated until all rows have been processed.\n* After all rows have finished processing, x_deinit() is called, if present,\nto clean up by de-allocating any memory that was allocated in x_init().\n\nExamples\n--------\n\nFor an example, see sql/udf_example.cc in the source tree. For a collection of\nexisting UDFs see https://github.com/mysqludf.\n\nURL: https://mariadb.com/kb/en/creating-user-defined-functions/','','https://mariadb.com/kb/en/creating-user-defined-functions/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (255,22,'User-Defined Functions Calling Sequences','The functions described in Creating User-defined Functions are expanded on\nthis page. They are declared as follows:\n\nSimple Functions\n----------------\n\nx()\n---\n\nIf x() returns an integer, it is declared as follows:\n\nlong long x(UDF_INIT *initid, UDF_ARGS *args,\n char *is_null, char *error);\n\nIf x() returns a string (DECIMAL functions also return string values), it is\ndeclared as follows:\n\nchar *x(UDF_INIT *initid, UDF_ARGS *args,\n char *result, unsigned long *length,\n char *is_null, char *error);\n\nIf x() returns a real, it is declared as follows:\n\ndouble x(UDF_INIT *initid, UDF_ARGS *args,\n char *is_null, char *error);\n\nx_init()\n--------\n\nmy_bool x_init(UDF_INIT *initid, UDF_ARGS *args, char *message);\n\nx_deinit()\n----------\n\nvoid x_deinit(UDF_INIT *initid);\n\nDescription\n-----------\n\ninitid is a parameter passed to all three functions that points to a UDF_INIT\nstructure, used for communicating information between the functions. Its\nstructure members are:\n\n* my_bool maybe_null\nmaybe_null should be set to 1 if x_init can return a NULL value, Defaults to 1\nif any arguments are declared maybe_null.\n\n* unsigned int decimals\nNumber of decimals after the decimal point. The default, if an explicit number\nof decimals is passed in the arguments to the main function, is the maximum\nnumber of decimals, so if 9.5, 9.55 and 9.555 are passed to the function, the\ndefault would be three (based on 9.555, the maximum). If there are no\nexplicit number of decimals, the default is set to 31, or one more than the\nmaximum for the DOUBLE, FLOAT and DECIMAL types. This default can be changed\nin the function to suit the actual calculation.\n\n* unsigned int max_length\nMaximum length of the result. For integers, the default is 21. For strings,\nthe length of the longest argument. For reals, the default is 13 plus the\nnumber of decimals indicated by initid->decimals. The length includes any\nsigns or decimal points. Can also be set to 65KB or 16MB in order to return a\nBLOB. The memory remains unallocated, but this is used to decide on the data\ntype to use if the data needs to be temporarily stored.\n\n* char *ptr\nA pointer for use as required by the function. Commonly, initid->ptr is used\nto communicate allocated memory, with x_init() allocating the memory and\nassigning it to this pointer, x() using it, and x_deinit() de-allocating it.\n\n* my_bool const_item\nShould be set to 1 in x_init() if x() always returns the same value, otherwise\n0.\n\nAggregate Functions\n-------------------\n\nx_clear()\n---------\n\nx_clear() is a required function for aggregate functions, and is declared as\nfollows:\n\nvoid x_clear(UDF_INIT *initid, char *is_null, char *error);\n\nIt is called when the summary results need to be reset, that is at the\nbeginning of each new group. but also to reset the values when there were no\nmatching rows.\n\nis_null is set to point to CHAR(0) before calling x_clear().\n\nIn the case of an error, you can store the value to which the error argument\npoints (a single-byte variable, not a string string buffer) in the variable.\n\nx_reset()\n---------\n\nx_reset() is declared as follows:\n\nvoid x_reset(UDF_INIT *initid, UDF_ARGS *args,\n char *is_null, char *error);\n\nIt is called on finding the first row in a new group. Should reset the summary\nvariables, and then use UDF_ARGS as the first value in the group\'s internal\nsummary value. The function is not required if the UDF interface uses\nx_clear().\n\nx_add()\n-------\n\nx_add() is declared as follows:\n\nvoid x_add(UDF_INIT *initid, UDF_ARGS *args,\n char *is_null, char *error);\n\nIt is called for all rows belonging to the same group, and should be used to\nadd the value in UDF_ARGS to the internal summary variable.\n\nx_remove()\n----------\n\nx_remove() was added in MariaDB 10.4 and is declared as follows (same as\nx_add()):\n\nvoid x_remove(UDF_INIT* initid, UDF_ARGS* args,\n char* is_null, char *error );\n\nIt adds more efficient support of aggregate UDFs as window functions.\nx_remove() should \"subtract\" the row (reverse x_add()). In MariaDB 10.4\naggregate UDFs will work as WINDOW functions without x_remove() but it will\nnot be so efficient.\n\nIf x_remove() supported (defined) detected automatically.\n\nURL: https://mariadb.com/kb/en/user-defined-functions-calling-sequences/','','https://mariadb.com/kb/en/user-defined-functions-calling-sequences/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (256,22,'User-Defined Functions Security','The MariaDB server imposes a number of limitations on user-defined functions\nfor security purposes.\n\n* The INSERT privilege for the mysql database is required to run CREATE\nFUNCTION, as a record will be added to the mysql.func-table.\n* The DELETE privilege for the mysql database is required to run DROP FUNCTION\nas the corresponding record will be removed from the mysql.func-table.\n* UDF object files can only be placed in the plugin directory, as specified by\nthe value of the plugin_dir system variable.\n* At least one symbol, beyond the required x() - corresponding to an SQL\nfunction X()) - is required. These can be x_init(), x_deinit(), xxx_reset(),\nx_clear() and x_add() functions (see Creating User-defined Functions). The\nallow-suspicious-udfs mysqld option (by default unset) provides a workaround,\npermitting only one symbol to be used. This is not recommended, as it opens\nthe possibility of loading shared objects that are not legitimate user-defined\nfunctions.\n\nURL: https://mariadb.com/kb/en/user-defined-functions-security/','','https://mariadb.com/kb/en/user-defined-functions-security/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (257,23,'Numeric Data Type Overview','There are a number of numeric data types:\n\n* TINYINT\n* BOOLEAN - Synonym for TINYINT(1)\n* INT1 - Synonym for TINYINT\n* SMALLINT\n* INT2 - Synonym for SMALLINT\n* MEDIUMINT\n* INT3 - Synonym for MEDIUMINT\n* INT, INTEGER\n* INT4 - Synonym for INT\n* BIGINT\n* INT8 - Synonym for BIGINT\n* DECIMAL, DEC, NUMERIC, FIXED\n* FLOAT\n* DOUBLE, DOUBLE PRECISION, REAL\n* BIT\n\nSee the specific articles for detailed information on each.\n\nSIGNED, UNSIGNED and ZEROFILL\n-----------------------------\n\nMost numeric types can be defined as SIGNED, UNSIGNED or ZEROFILL, for example:\n\nTINYINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nIf SIGNED, or no attribute, is specified, a portion of the numeric type will\nbe reserved for the sign (plus or minus). For example, a TINYINT SIGNED can\nrange from -128 to 127.\n\nIf UNSIGNED is specified, no portion of the numeric type is reserved for the\nsign, so for integer types range can be larger. For example, a TINYINT\nUNSIGNED can range from 0 to 255. Floating point and fixed-point types also\ncan be UNSIGNED, but this only prevents negative values from being stored and\ndoesn\'t alter the range.\n\nIf ZEROFILL is specified, the column will be set to UNSIGNED and the spaces\nused by default to pad the field are replaced with zeros. ZEROFILL is ignored\nin expressions or as part of a UNION. ZEROFILL is a non-standard MySQL and\nMariaDB enhancement.\n\nNote that although the preferred syntax indicates that the attributes are\nexclusive, more than one attribute can be specified.\n\nUntil MariaDB 10.2.7 (MDEV-8659), any combination of the attributes could be\nused in any order, with duplicates. In this case:\n\n* the presence of ZEROFILL makes the column UNSIGNED ZEROFILL.\n* the presence of UNSIGNED makes the column UNSIGNED.\n\nFrom MariaDB 10.2.8, only the following combinations are supported:\n\n* SIGNED\n* UNSIGNED\n* ZEROFILL\n* UNSIGNED ZEROFILL\n* ZEROFILL UNSIGNED\n\nThe latter two should be replaced with simply ZEROFILL, but are still accepted\nby the parser.\n\nExamples\n--------\n\nCREATE TABLE zf (\n i1 TINYINT SIGNED,\n i2 TINYINT UNSIGNED,\n i3 TINYINT ZEROFILL\n);\n\nINSERT INTO zf VALUES (2,2,2);\n\nSELECT * FROM zf;\n+------+------+------+\n| i1 | i2 | i3 |\n+------+------+------+\n| 2 | 2 | 002 |\n+------+------+------+\n\nRange\n-----\n\nWhen attempting to add a value that is out of the valid range for the numeric\ntype, MariaDB will react depending on the strict SQL_MODE setting.\n\nIf strict_mode has been set (the default from MariaDB 10.2.4), MariaDB will\nreturn an error.\n\nIf strict_mode has not been set (the default until MariaDB 10.2.3), MariaDB\nwill adjust the number to fit in the field, returning a warning.\n\nExamples\n--------\n\nWith strict_mode set:\n\nSHOW VARIABLES LIKE \'sql_mode\';\n+---------------+--------------------------------------------------------------\n----------------------------+\n| Variable_name | Value \n |\n+---------------+--------------------------------------------------------------\n----------------------------+\n| sql_mode |\nSTRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SU\nSTITUTION |\n+---------------+--------------------------------------------------------------\n----------------------------+\n\nCREATE TABLE ranges (i1 TINYINT, i2 SMALLINT, i3 TINYINT UNSIGNED);\n\nINSERT INTO ranges VALUES (257,257,257);\nERROR 1264 (22003): Out of range value for column \'i1\' at row 1\n\nSELECT * FROM ranges;\nEmpty set (0.10 sec)\n\nWith strict_mode unset:\n\nSHOW VARIABLES LIKE \'sql_mode%\';\n+---------------+-------+\n| Variable_name | Value |\n+---------------+-------+\n| sql_mode | |\n+---------------+-------+\n\nCREATE TABLE ranges (i1 TINYINT, i2 SMALLINT, i3 TINYINT UNSIGNED);\n\nINSERT INTO ranges VALUES (257,257,257);\nQuery OK, 1 row affected, 2 warnings (0.00 sec)\n\nSHOW WARNINGS;\n+---------+------+---------------------------------------------+\n| Level | Code | Message |\n+---------+------+---------------------------------------------+\n| Warning | 1264 | Out of range value for column \'i1\' at row 1 |\n| Warning | 1264 | Out of range value for column \'i3\' at row 1 |\n+---------+------+---------------------------------------------+\n2 rows in set (0.00 sec)\n\nSELECT * FROM ranges;\n+------+------+------+\n| i1 | i2 | i3 |\n+------+------+------+\n| 127 | 257 | 255 |\n+------+------+------+\n\nAuto_increment\n--------------\n\nThe AUTO_INCREMENT attribute can be used to generate a unique identity for new\nrows. For more details, see auto_increment.\n\nURL: https://mariadb.com/kb/en/numeric-data-type-overview/','','https://mariadb.com/kb/en/numeric-data-type-overview/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (258,23,'TINYINT','Syntax\n------\n\nTINYINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA very small integer. The signed range is -128 to 127. The unsigned range is 0\nto 255. For details on the attributes, see Numeric Data Type Overview.\n\nINT1 is a synonym for TINYINT. BOOL and BOOLEAN are synonyms for TINYINT(1).\n\nExamples\n--------\n\nCREATE TABLE tinyints (a TINYINT,b TINYINT UNSIGNED,c TINYINT ZEROFILL);\n\nWith strict_mode set, the default from MariaDB 10.2.4:\n\nINSERT INTO tinyints VALUES (-10,-10,-10);\nERROR 1264 (22003): Out of range value for column \'b\' at row 1\n\nINSERT INTO tinyints VALUES (-10,10,-10);\nERROR 1264 (22003): Out of range value for column \'c\' at row 1\n\nINSERT INTO tinyints VALUES (-10,10,10);\n\nSELECT * FROM tinyints;\n+------+------+------+\n| a | b | c |\n+------+------+------+\n| -10 | 10 | 010 |\n+------+------+------+\n\nINSERT INTO tinyints VALUES (128,128,128);\nERROR 1264 (22003): Out of range value for column \'a\' at row 1\n\nINSERT INTO tinyints VALUES (127,128,128);\n\nSELECT * FROM tinyints;\n+------+------+------+\n| a | b | c |\n+------+------+------+\n| -10 | 10 | 010 |\n| 127 | 128 | 128 |\n+------+------+------+\n\nWith strict_mode unset, the default until MariaDB 10.2.3:\n\nINSERT INTO tinyints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.08 sec)\nWarning (Code 1264): Out of range value for column \'b\' at row 1\nWarning (Code 1264): Out of range value for column \'c\' at row 1\n\nINSERT INTO tinyints VALUES (-10,10,-10);\nQuery OK, 1 row affected, 1 warning (0.11 sec)\nWarning (Code 1264): Out of range value for column \'c\' at row 1\n\nINSERT INTO tinyints VALUES (-10,10,10);\n\nSELECT * FROM tinyints;\n+------+------+------+\n| a | b | c |\n+------+------+------+\n| -10 | 0 | 000 |\n| -10 | 10 | 000 |\n| -10 | 10 | 010 |\n+------+------+------+\n\nINSERT INTO tinyints VALUES (128,128,128);\nQuery OK, 1 row affected, 1 warning (0.19 sec)\nWarning (Code 1264): Out of range value for column \'a\' at row 1\n\nINSERT INTO tinyints VALUES (127,128,128);\n\nSELECT * FROM tinyints;\n+------+------+------+\n| a | b | c |\n+------+------+------+\n| -10 | 0 | 000 |\n| -10 | 10 | 000 |\n| -10 | 10 | 010 |\n| 127 | 128 | 128 |\n| 127 | 128 | 128 |\n+------+------+------+\n\nURL: https://mariadb.com/kb/en/tinyint/','','https://mariadb.com/kb/en/tinyint/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (259,23,'BOOLEAN','Syntax\n------\n\nBOOL, BOOLEAN\n\nDescription\n-----------\n\nThese types are synonyms for TINYINT(1). A value of zero is considered false.\nNon-zero values are considered true.\n\nHowever, the values TRUE and FALSE are merely aliases for 1 and 0. See Boolean\nLiterals, as well as the IS operator for testing values against a boolean.\n\nExamples\n--------\n\nCREATE TABLE boo (i BOOLEAN);\n\nDESC boo;\n+-------+------------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+------------+------+-----+---------+-------+\n| i | tinyint(1) | YES | | NULL | |\n+-------+------------+------+-----+---------+-------+\n\nSELECT IF(0, \'true\', \'false\');\n+------------------------+\n| IF(0, \'true\', \'false\') |\n+------------------------+\n| false |\n+------------------------+\n\nSELECT IF(1, \'true\', \'false\');\n+------------------------+\n| IF(1, \'true\', \'false\') |\n+------------------------+\n| true |\n+------------------------+\n\nSELECT IF(2, \'true\', \'false\');\n+------------------------+\n| IF(2, \'true\', \'false\') |\n+------------------------+\n| true |\n+------------------------+\n\nTRUE and FALSE as aliases for 1 and 0:\n\nSELECT IF(0 = FALSE, \'true\', \'false\');\n\n+--------------------------------+\n| IF(0 = FALSE, \'true\', \'false\') |\n+--------------------------------+\n| true |\n+--------------------------------+\n\nSELECT IF(1 = TRUE, \'true\', \'false\');\n+-------------------------------+\n| IF(1 = TRUE, \'true\', \'false\') |\n+-------------------------------+\n| true |\n+-------------------------------+\n\nSELECT IF(2 = TRUE, \'true\', \'false\');\n+-------------------------------+\n| IF(2 = TRUE, \'true\', \'false\') |\n+-------------------------------+\n| false |\n+-------------------------------+\n\nSELECT IF(2 = FALSE, \'true\', \'false\');\n+--------------------------------+\n| IF(2 = FALSE, \'true\', \'false\') |\n+--------------------------------+\n| false |\n+--------------------------------+\n\nThe last two statements display the results shown because 2 is equal to\nneither 1 nor 0.\n\nURL: https://mariadb.com/kb/en/boolean/','','https://mariadb.com/kb/en/boolean/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (260,23,'SMALLINT','Syntax\n------\n\nSMALLINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA small integer. The signed range is -32768 to 32767. The unsigned range is 0\nto 65535.\n\nIf a column has been set to ZEROFILL, all values will be prepended by zeros so\nthat the SMALLINT value contains a number of M digits.\n\nNote: If the ZEROFILL attribute has been specified, the column will\nautomatically become UNSIGNED.\n\nINT2 is a synonym for SMALLINT.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE smallints (a SMALLINT,b SMALLINT UNSIGNED,c SMALLINT ZEROFILL);\n\nWith strict_mode set, the default from MariaDB 10.2.4:\n\nINSERT INTO smallints VALUES (-10,-10,-10);\nERROR 1264 (22003): Out of range value for column \'b\' at row 1\n\nINSERT INTO smallints VALUES (-10,10,-10);\nERROR 1264 (22003): Out of range value for column \'c\' at row 1\n\nINSERT INTO smallints VALUES (-10,10,10);\n\nINSERT INTO smallints VALUES (32768,32768,32768);\nERROR 1264 (22003): Out of range value for column \'a\' at row 1\n\nINSERT INTO smallints VALUES (32767,32768,32768);\n\nSELECT * FROM smallints;\n+-------+-------+-------+\n| a | b | c |\n+-------+-------+-------+\n| -10 | 10 | 00010 |\n| 32767 | 32768 | 32768 |\n+-------+-------+-------+\n\nWith strict_mode unset, the default until MariaDB 10.2.3:\n\nINSERT INTO smallints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.09 sec)\nWarning (Code 1264): Out of range value for column \'b\' at row 1\nWarning (Code 1264): Out of range value for column \'c\' at row 1\n\nINSERT INTO smallints VALUES (-10,10,-10);\nQuery OK, 1 row affected, 1 warning (0.08 sec)\nWarning (Code 1264): Out of range value for column \'c\' at row 1\n\nINSERT INTO smallints VALUES (-10,10,10);\n\nINSERT INTO smallints VALUES (32768,32768,32768);\nQuery OK, 1 row affected, 1 warning (0.04 sec)\nWarning (Code 1264): Out of range value for column \'a\' at row 1\n\nINSERT INTO smallints VALUES (32767,32768,32768);\n\nSELECT * FROM smallints;\n+-------+-------+-------+\n| a | b | c |\n+-------+-------+-------+\n| -10 | 0 | 00000 |\n| -10 | 10 | 00000 |\n| -10 | 10 | 00010 |\n| 32767 | 32768 | 32768 |\n| 32767 | 32768 | 32768 |\n+-------+-------+-------+\n\nURL: https://mariadb.com/kb/en/smallint/','','https://mariadb.com/kb/en/smallint/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (261,23,'MEDIUMINT','Syntax\n------\n\nMEDIUMINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA medium-sized integer. The signed range is -8388608 to 8388607. The unsigned\nrange is 0 to 16777215.\n\nZEROFILL pads the integer with zeroes and assumes UNSIGNED (even if UNSIGNED\nis not specified).\n\nINT3 is a synonym for MEDIUMINT.\n\nFor details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE mediumints (a MEDIUMINT,b MEDIUMINT UNSIGNED,c MEDIUMINT\nZEROFILL);\n\nDESCRIBE mediumints;\n+-------+--------------------------------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+--------------------------------+------+-----+---------+-------+\n| a | mediumint(9) | YES | | NULL | |\n| b | mediumint(8) unsigned | YES | | NULL | |\n| c | mediumint(8) unsigned zerofill | YES | | NULL | |\n+-------+--------------------------------+------+-----+---------+-------+\n\nWith strict_mode set, the default from MariaDB 10.2.4:\n\nINSERT INTO mediumints VALUES (-10,-10,-10);\nERROR 1264 (22003): Out of range value for column \'b\' at row 1\n\nINSERT INTO mediumints VALUES (-10,10,-10);\nERROR 1264 (22003): Out of range value for column \'c\' at row 1\n\nINSERT INTO mediumints VALUES (-10,10,10);\n\nINSERT INTO mediumints VALUES (8388608,8388608,8388608);\nERROR 1264 (22003): Out of range value for column \'a\' at row 1\n\nINSERT INTO mediumints VALUES (8388607,8388608,8388608);\n\nSELECT * FROM mediumints;\n+---------+---------+----------+\n| a | b | c |\n+---------+---------+----------+\n| -10 | 10 | 00000010 |\n| 8388607 | 8388608 | 08388608 |\n+---------+---------+----------+\n\nWith strict_mode unset, the default until MariaDB 10.2.3:\n\nINSERT INTO mediumints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.05 sec)\nWarning (Code 1264): Out of range value for column \'b\' at row 1\nWarning (Code 1264): Out of range value for column \'c\' at row 1\n\nINSERT INTO mediumints VALUES (-10,10,-10);\nQuery OK, 1 row affected, 1 warning (0.08 sec)\nWarning (Code 1264): Out of range value for column \'c\' at row 1\n\nINSERT INTO mediumints VALUES (-10,10,10);\n\nINSERT INTO mediumints VALUES (8388608,8388608,8388608);\nQuery OK, 1 row affected, 1 warning (0.05 sec)\nWarning (Code 1264): Out of range value for column \'a\' at row 1\n\nINSERT INTO mediumints VALUES (8388607,8388608,8388608);\n\nSELECT * FROM mediumints;\n+---------+---------+----------+\n| a | b | c |\n+---------+---------+----------+\n| -10 | 0 | 00000000 |\n| -10 | 0 | 00000000 |\n| -10 | 10 | 00000000 |\n| -10 | 10 | 00000010 |\n| 8388607 | 8388608 | 08388608 |\n| 8388607 | 8388608 | 08388608 |\n+---------+---------+----------+\n\nURL: https://mariadb.com/kb/en/mediumint/','','https://mariadb.com/kb/en/mediumint/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (262,23,'INT','Syntax\n------\n\nINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\nINTEGER[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA normal-size integer. When marked UNSIGNED, it ranges from 0 to 4294967295,\notherwise its range is -2147483648 to 2147483647 (SIGNED is the default). If a\ncolumn has been set to ZEROFILL, all values will be prepended by zeros so that\nthe INT value contains a number of M digits. INTEGER is a synonym for INT.\n\nNote: If the ZEROFILL attribute has been specified, the column will\nautomatically become UNSIGNED.\n\nINT4 is a synonym for INT.\n\nFor details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE ints (a INT,b INT UNSIGNED,c INT ZEROFILL);\n\nWith strict_mode set, the default from MariaDB 10.2.4:\n\nINSERT INTO ints VALUES (-10,-10,-10);\nERROR 1264 (22003): Out of range value for column \'b\' at row 1\n\nINSERT INTO ints VALUES (-10,10,-10);\nERROR 1264 (22003): Out of range value for column \'c\' at row 1\n\nINSERT INTO ints VALUES (-10,10,10);\n\nINSERT INTO ints VALUES (2147483648,2147483648,2147483648);\nERROR 1264 (22003): Out of range value for column \'a\' at row 1\n\nINSERT INTO ints VALUES (2147483647,2147483648,2147483648);\n\nSELECT * FROM ints;\n+------------+------------+------------+\n| a | b | c |\n+------------+------------+------------+\n| -10 | 10 | 0000000010 |\n| 2147483647 | 2147483648 | 2147483648 |\n+------------+------------+------------+\n\nWith strict_mode unset, the default until MariaDB 10.2.3:\n\nINSERT INTO ints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.10 sec)\nWarning (Code 1264): Out of range value for column \'b\' at row 1\nWarning (Code 1264): Out of range value for column \'c\' at row 1\n\nINSERT INTO ints VALUES (-10,10,-10);\nQuery OK, 1 row affected, 1 warning (0.08 sec)\nWarning (Code 1264): Out of range value for column \'c\' at row 1\n\nINSERT INTO ints VALUES (-10,10,10);\n\nINSERT INTO ints VALUES (2147483648,2147483648,2147483648);\nQuery OK, 1 row affected, 1 warning (0.07 sec)\nWarning (Code 1264): Out of range value for column \'a\' at row 1\n\nINSERT INTO ints VALUES (2147483647,2147483648,2147483648);\n\nSELECT * FROM ints;\n+------------+------------+------------+\n| a | b | c |\n+------------+------------+------------+\n| -10 | 0 | 0000000000 |\n| -10 | 10 | 0000000000 |\n| -10 | 10 | 0000000010 |\n| 2147483647 | 2147483648 | 2147483648 |\n| 2147483647 | 2147483648 | 2147483648 |\n+------------+------------+------------+\n\nURL: https://mariadb.com/kb/en/int/','','https://mariadb.com/kb/en/int/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (263,23,'BIGINT','Syntax\n------\n\nBIGINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA large integer. The signed range is -9223372036854775808 to\n9223372036854775807. The unsigned range is 0 to 18446744073709551615.\n\nIf a column has been set to ZEROFILL, all values will be prepended by zeros so\nthat the BIGINT value contains a number of M digits.\n\nNote: If the ZEROFILL attribute has been specified, the column will\nautomatically become UNSIGNED.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nSERIAL is an alias for:\n\nBIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE\n\nINT8 is a synonym for BIGINT.\n\nExamples\n--------\n\nCREATE TABLE bigints (a BIGINT,b BIGINT UNSIGNED,c BIGINT ZEROFILL);\n\nWith strict_mode set, the default from MariaDB 10.2.4:\n\nINSERT INTO bigints VALUES (-10,-10,-10);\nERROR 1264 (22003): Out of range value for column \'b\' at row 1\n\nINSERT INTO bigints VALUES (-10,10,-10);\nERROR 1264 (22003): Out of range value for column \'c\' at row 1\n\nINSERT INTO bigints VALUES (-10,10,10);\n\nINSERT INTO bigints VALUES\n(9223372036854775808,9223372036854775808,9223372036854775808);\nERROR 1264 (22003): Out of range value for column \'a\' at row 1\n\nINSERT INTO bigints VALUES\n(9223372036854775807,9223372036854775808,9223372036854775808);\n\nSELECT * FROM bigints;\n+---------------------+---------------------+----------------------+\n| a | b | c |\n+---------------------+---------------------+----------------------+\n| -10 | 10 | 00000000000000000010 |\n| 9223372036854775807 | 9223372036854775808 | 09223372036854775808 |\n+---------------------+---------------------+----------------------+\n\nWith strict_mode unset, the default until MariaDB 10.2.3:\n\nINSERT INTO bigints VALUES (-10,-10,-10);\nQuery OK, 1 row affected, 2 warnings (0.08 sec)\nWarning (Code 1264): Out of range value for column \'b\' at row 1\nWarning (Code 1264): Out of range value for column \'c\' at row 1\n\nINSERT INTO bigints VALUES (-10,10,-10);\nQuery OK, 1 row affected, 1 warning (0.08 sec)\nWarning (Code 1264): Out of range value for column \'c\' at row 1\n\nINSERT INTO bigints VALUES (-10,10,10);\n\nINSERT INTO bigints VALUES\n(9223372036854775808,9223372036854775808,9223372036854775808);\nQuery OK, 1 row affected, 1 warning (0.07 sec)\nWarning (Code 1264): Out of range value for column \'a\' at row 1\n\nINSERT INTO bigints VALUES\n(9223372036854775807,9223372036854775808,9223372036854775808);\n\nSELECT * FROM bigints;\n+---------------------+---------------------+----------------------+\n| a | b | c |\n+---------------------+---------------------+----------------------+\n| -10 | 0 | 00000000000000000000 |\n| -10 | 10 | 00000000000000000000 |\n| -10 | 10 | 00000000000000000010 |\n| 9223372036854775807 | 9223372036854775808 | 09223372036854775808 |\n| 9223372036854775807 | 9223372036854775808 | 09223372036854775808 |\n+---------------------+---------------------+----------------------+\n\nURL: https://mariadb.com/kb/en/bigint/','','https://mariadb.com/kb/en/bigint/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (264,23,'DECIMAL','Syntax\n------\n\nDECIMAL[(M[,D])] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA packed \"exact\" fixed-point number. M is the total number of digits (the\nprecision) and D is the number of digits after the decimal point (the scale).\n\n* The decimal point and (for negative numbers) the \"-\" sign are not\ncounted in M. \n* If D is 0, values have no decimal point or fractional\npart and on INSERT the value will be rounded to the nearest DECIMAL. \n* The maximum number of digits (M) for DECIMAL is 65. \n* The maximum number of supported decimals (D) is 30 before MariadB 10.2.1 and\n38 afterwards. \n* If D is omitted, the default is 0. If M is omitted, the default is 10.\n\nUNSIGNED, if specified, disallows negative values.\n\nZEROFILL, if specified, pads the number with zeros, up to the total number of\ndigits specified by M.\n\nAll basic calculations (+, -, *, /) with DECIMAL columns are done with a\nprecision of 65 digits.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nDEC, NUMERIC and FIXED are synonyms, as well as NUMBER in Oracle mode from\nMariaDB 10.3.\n\nExamples\n--------\n\nCREATE TABLE t1 (d DECIMAL UNSIGNED ZEROFILL);\n\nINSERT INTO t1 VALUES (1),(2),(3),(4.0),(5.2),(5.7);\nQuery OK, 6 rows affected, 2 warnings (0.16 sec)\nRecords: 6 Duplicates: 0 Warnings: 2\n\nNote (Code 1265): Data truncated for column \'d\' at row 5\nNote (Code 1265): Data truncated for column \'d\' at row 6\n\nSELECT * FROM t1;\n+------------+\n| d |\n+------------+\n| 0000000001 |\n| 0000000002 |\n| 0000000003 |\n| 0000000004 |\n| 0000000005 |\n| 0000000006 |\n+------------+\n\nWith strict_mode set, the default from MariaDB 10.2.4:\n\nINSERT INTO t1 VALUES (-7);\nERROR 1264 (22003): Out of range value for column \'d\' at row 1\n\nWith strict_mode unset, the default until MariaDB 10.2.3:\n\nINSERT INTO t1 VALUES (-7);\nQuery OK, 1 row affected, 1 warning (0.02 sec)\nWarning (Code 1264): Out of range value for column \'d\' at row 1\n\nSELECT * FROM t1;\n+------------+\n| d |\n+------------+\n| 0000000001 |\n| 0000000002 |\n| 0000000003 |\n| 0000000004 |\n| 0000000005 |\n| 0000000006 |\n| 0000000000 |\n+------------+\n\nURL: https://mariadb.com/kb/en/decimal/','','https://mariadb.com/kb/en/decimal/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (265,23,'FLOAT','Syntax\n------\n\nFLOAT[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA small (single-precision) floating-point number (see DOUBLE for a\nregular-size floating point number). Allowable values are:\n\n* -3.402823466E+38 to -1.175494351E-38\n* 0\n* 1.175494351E-38 to 3.402823466E+38.\n\nThese are the theoretical limits, based on the IEEE standard. The actual range\nmight be slightly smaller depending on your hardware or operating system.\n\nM is the total number of digits and D is the number of digits following the\ndecimal point. If M and D are omitted, values are stored to the limits allowed\nby the hardware. A single-precision floating-point number is accurate to\napproximately 7 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nUsing FLOAT might give you some unexpected problems because all calculations\nin MariaDB are done with double precision. See Floating Point Accuracy.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nURL: https://mariadb.com/kb/en/float/','','https://mariadb.com/kb/en/float/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (266,23,'DOUBLE','Syntax\n------\n\nDOUBLE[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\nDOUBLE PRECISION[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\nREAL[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA normal-size (double-precision) floating-point number (see FLOAT for a\nsingle-precision floating-point number).\n\nAllowable values are:\n\n* -1.7976931348623157E+308 to -2.2250738585072014E-308\n* 0\n* 2.2250738585072014E-308 to 1.7976931348623157E+308\n\nThese are the theoretical limits, based on the IEEE standard. The actual range\nmight be slightly smaller depending on your hardware or operating system.\n\nM is the total number of digits and D is the number of digits following the\ndecimal point. If M and D are omitted, values are stored to the limits allowed\nby the hardware. A double-precision floating-point number is accurate to\napproximately 15 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nZEROFILL, if specified, pads the number with zeros, up to the total number of\ndigits specified by M.\n\nREAL and DOUBLE PRECISION are synonyms, unless the REAL_AS_FLOAT SQL mode is\nenabled, in which case REAL is a synonym for FLOAT rather than DOUBLE.\n\nSee Floating Point Accuracy for issues when using floating-point numbers.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE t1 (d DOUBLE(5,0) zerofill);\n\nINSERT INTO t1 VALUES (1),(2),(3),(4);\n\nSELECT * FROM t1;\n+-------+\n| d |\n+-------+\n| 00001 |\n| 00002 |\n| 00003 |\n| 00004 |\n+-------+\n\nURL: https://mariadb.com/kb/en/double/','','https://mariadb.com/kb/en/double/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (267,23,'BIT','Syntax\n------\n\nBIT[(M)]\n\nDescription\n-----------\n\nA bit-field type. M indicates the number of bits per value, from 1 to 64. The\ndefault is 1 if M is omitted.\n\nBit values can be inserted with b\'value\' notation, where value is the bit\nvalue in 0\'s and 1\'s.\n\nBit fields are automatically zero-padded from the left to the full length of\nthe bit, so for example in a BIT(4) field, \'10\' is equivalent to \'0010\'.\n\nBits are returned as binary, so to display them, either add 0, or use a\nfunction such as HEX, OCT or BIN to convert them.\n\nExamples\n--------\n\nCREATE TABLE b ( b1 BIT(8) );\n\nWith strict_mode set, the default from MariaDB 10.2.4:\n\nINSERT INTO b VALUES (b\'11111111\');\n\nINSERT INTO b VALUES (b\'01010101\');\n\nINSERT INTO b VALUES (b\'1111111111111\');\nERROR 1406 (22001): Data too long for column \'b1\' at row 1\n\nSELECT b1+0, HEX(b1), OCT(b1), BIN(b1) FROM b;\n+------+---------+---------+----------+\n| b1+0 | HEX(b1) | OCT(b1) | BIN(b1) |\n+------+---------+---------+----------+\n| 255 | FF | 377 | 11111111 |\n| 85 | 55 | 125 | 1010101 |\n+------+---------+---------+----------+\n\nWith strict_mode unset, the default until MariaDB 10.2.3:\n\nINSERT INTO b VALUES (b\'11111111\'),(b\'01010101\'),(b\'1111111111111\');\nQuery OK, 3 rows affected, 1 warning (0.10 sec)\nRecords: 3 Duplicates: 0 Warnings: 1\n\nSHOW WARNINGS;\n+---------+------+---------------------------------------------+\n| Level | Code | Message |\n+---------+------+---------------------------------------------+\n| Warning | 1264 | Out of range value for column \'b1\' at row 3 |\n+---------+------+---------------------------------------------+\n\nSELECT b1+0, HEX(b1), OCT(b1), BIN(b1) FROM b;\n+------+---------+---------+----------+\n| b1+0 | HEX(b1) | OCT(b1) | BIN(b1) |\n+------+---------+---------+----------+\n| 255 | FF | 377 | 11111111 |\n| 85 | 55 | 125 | 1010101 |\n| 255 | FF | 377 | 11111111 |\n+------+---------+---------+----------+\n\nURL: https://mariadb.com/kb/en/bit/','','https://mariadb.com/kb/en/bit/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (268,23,'Floating-point Accuracy','Due to their nature, not all floating-point numbers can be stored with exact\nprecision. Hardware architecture, the CPU or even the compiler version and\noptimization level may affect the precision.\n\nIf you are comparing DOUBLEs or FLOATs with numeric decimals, it is not safe\nto use the equality operator.\n\nSometimes, changing a floating-point number from single-precision (FLOAT) to\ndouble-precision (DOUBLE) will fix the problem.\n\nExample\n-------\n\nf1, f2 and f3 have seemingly identical values across each row, but due to\nfloating point accuracy, the results may be unexpected.\n\nCREATE TABLE fpn (id INT, f1 FLOAT, f2 DOUBLE, f3 DECIMAL (10,3));\nINSERT INTO fpn VALUES (1,2,2,2),(2,0.1,0.1,0.1);\n\nSELECT * FROM fpn WHERE f1*f1 = f2*f2;\n+------+------+------+-------+\n| id | f1 | f2 | f3 |\n+------+------+------+-------+\n| 1 | 2 | 2 | 2.000 |\n+------+------+------+-------+\n\nThe reason why only one instead of two rows was returned becomes clear when we\nsee how the floating point squares were evaluated.\n\nSELECT f1*f1, f2*f2, f3*f3 FROM fpn;\n+----------------------+----------------------+----------+\n| f1*f1 | f2*f2 | f3*f3 |\n+----------------------+----------------------+----------+\n| 4 | 4 | 4.000000 |\n| 0.010000000298023226 | 0.010000000000000002 | 0.010000 |\n+----------------------+----------------------+----------+\n\nURL: https://mariadb.com/kb/en/floating-point-accuracy/','','https://mariadb.com/kb/en/floating-point-accuracy/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (269,23,'BINARY','This page describes the BINARY data type. For details about the operator, see\nBinary Operator.\n\nSyntax\n------\n\nBINARY(M)\n\nDescription\n-----------\n\nThe BINARY type is similar to the CHAR type, but stores binary byte strings\nrather than non-binary character strings. M represents the column length in\nbytes.\n\nIt contains no character set, and comparison and sorting are based on the\nnumeric value of the bytes.\n\nIf the maximum length is exceeded, and SQL strict mode is not enabled , the\nextra characters will be dropped with a warning. If strict mode is enabled, an\nerror will occur.\n\nBINARY values are right-padded with 0x00 (the zero byte) to the specified\nlength when inserted. The padding is not removed on select, so this needs to\nbe taken into account when sorting and comparing, where all bytes are\nsignificant. The zero byte, 0x00 is less than a space for comparison purposes.\n\nExamples\n--------\n\nInserting too many characters, first with strict mode off, then with it on:\n\nCREATE TABLE bins (a BINARY(10));\n\nINSERT INTO bins VALUES(\'12345678901\');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n\nSELECT * FROM bins;\n+------------+\n| a |\n+------------+\n| 1234567890 |\n+------------+\n\nSET sql_mode=\'STRICT_ALL_TABLES\';\n\nINSERT INTO bins VALUES(\'12345678901\');\nERROR 1406 (22001): Data too long for column \'a\' at row 1\n\nSorting is performed with the byte value:\n\nTRUNCATE bins;\n\nINSERT INTO bins VALUES(\'A\'),(\'B\'),(\'a\'),(\'b\');\n\nSELECT * FROM bins ORDER BY a;\n+------+\n| a |\n+------+\n| A |\n| B |\n| a |\n| b |\n+------+\n\nUsing CAST to sort as a CHAR instead:\n\nSELECT * FROM bins ORDER BY CAST(a AS CHAR);\n+------+\n| a |\n+------+\n| a |\n| A |\n| b |\n| B |\n+------+\n\nThe field is a BINARY(10), so padding of two \'\\0\'s are inserted, causing\ncomparisons that don\'t take this into account to fail:\n\nTRUNCATE bins;\n\nINSERT INTO bins VALUES(\'12345678\');\n\nSELECT a = \'12345678\', a = \'12345678\\0\\0\' from bins;\n+----------------+--------------------+\n| a = \'12345678\' | a = \'12345678\\0\\0\' |\n+----------------+--------------------+\n| 0 | 1 |\n+----------------+--------------------+\n\nURL: https://mariadb.com/kb/en/binary/','','https://mariadb.com/kb/en/binary/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (270,23,'BLOB','Syntax\n------\n\nBLOB[(M)]\n\nDescription\n-----------\n\nA BLOB column with a maximum length of 65,535 (216 - 1) bytes. Each BLOB value\nis stored using a two-byte length prefix that indicates the number of bytes in\nthe value.\n\nAn optional length M can be given for this type. If this is done, MariaDB\ncreates the column as the smallest BLOB type large enough to hold values M\nbytes long.\n\nBLOBS can also be used to store dynamic columns.\n\nBefore MariaDB 10.2.1, BLOB and TEXT columns could not be assigned a DEFAULT\nvalue. This restriction was lifted in MariaDB 10.2.1.\n\nIndexing\n--------\n\nMariaDB starting with 10.4\n--------------------------\nFrom MariaDB 10.4, it is possible to set a unique index on a column that uses\nthe BLOB data type. In previous releases this was not possible, as the index\nwould only guarantee the uniqueness of a fixed number of characters.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, BLOB is a synonym for LONGBLOB.\n\nURL: https://mariadb.com/kb/en/blob/','','https://mariadb.com/kb/en/blob/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (271,23,'BLOB and TEXT Data Types','Description\n-----------\n\nA BLOB is a binary large object that can hold a variable amount of data. The\nfour BLOB types are\n\n* TINYBLOB,\n* BLOB, \n* MEDIUMBLOB, and\n* LONGBLOB.\n\nThese differ only in the maximum length of the values they can hold.\n\nThe TEXT types are\n\n* TINYTEXT,\n* TEXT,\n* MEDIUMTEXT, and\n* LONGTEXT.\n* JSON (alias for LONGTEXT)\n\nThese correspond to the four BLOB types and have the same maximum lengths and\nstorage requirements.\n\nMariaDB starting with 10.2.1\n----------------------------\nStarting from MariaDB 10.2.1, BLOB and TEXT columns can have a DEFAULT value.\n\nMariaDB starting with 10.4.3\n----------------------------\nFrom MariaDB 10.4, it is possible to set a unique index on columns that use\nthe BLOB or TEXT data types.\n\nURL: https://mariadb.com/kb/en/blob-and-text-data-types/','','https://mariadb.com/kb/en/blob-and-text-data-types/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (272,23,'CHAR','This article covers the CHAR data type. See CHAR Function for the function.\n\nSyntax\n------\n\n[NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA fixed-length string that is always right-padded with spaces to the specified\nlength when stored. M represents the column length in characters. The range of\nM is 0 to 255. If M is omitted, the length is 1.\n\nCHAR(0) columns can contain 2 values: an empty string or NULL. Such columns\ncannot be part of an index. The CONNECT storage engine does not support\nCHAR(0).\n\nNote: Trailing spaces are removed when CHAR values are retrieved unless the\nPAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.\n\nBefore MariaDB 10.2, all collations were of type PADSPACE, meaning that CHAR\n(as well as VARCHAR and TEXT) values are compared without regard for trailing\nspaces. This does not apply to the LIKE pattern-matching operator, which takes\ninto account trailing spaces.\n\nIf a unique index consists of a column where trailing pad characters are\nstripped or ignored, inserts into that column where values differ only by the\nnumber of trailing pad characters will result in a duplicate-key error.\n\nExamples\n--------\n\nTrailing spaces:\n\nCREATE TABLE strtest (c CHAR(10));\nINSERT INTO strtest VALUES(\'Maria \');\n\nSELECT c=\'Maria\',c=\'Maria \' FROM strtest;\n+-----------+--------------+\n| c=\'Maria\' | c=\'Maria \' |\n+-----------+--------------+\n| 1 | 1 |\n+-----------+--------------+\n\nSELECT c LIKE \'Maria\',c LIKE \'Maria \' FROM strtest;\n+----------------+-------------------+\n| c LIKE \'Maria\' | c LIKE \'Maria \' |\n+----------------+-------------------+\n| 1 | 0 |\n+----------------+-------------------+\n\nNO PAD Collations\n-----------------\n\nNO PAD collations regard trailing spaces as normal characters. You can get a\nlist of all NO PAD collations by querying the Information Schema Collations\ntable, for example:\n\nSELECT collation_name FROM information_schema.collations \n WHERE collation_name LIKE \"%nopad%\";\n+------------------------------+\n| collation_name |\n+------------------------------+\n| big5_chinese_nopad_ci |\n| big5_nopad_bin |\n...\n\nURL: https://mariadb.com/kb/en/char/','','https://mariadb.com/kb/en/char/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (273,23,'CHAR BYTE','Description\n-----------\n\nThe CHAR BYTE data type is an alias for the BINARY data type. This is a\ncompatibility feature.\n\nURL: https://mariadb.com/kb/en/char-byte/','','https://mariadb.com/kb/en/char-byte/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (274,23,'ENUM','Syntax\n------\n\nENUM(\'value1\',\'value2\',...) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nDescription\n-----------\n\nAn enumeration. A string object that can have only one value, chosen from the\nlist of values \'value1\', \'value2\', ..., NULL or the special \'\' error value. In\ntheory, an ENUM column can have a maximum of 65,535 distinct values; in\npractice, the real maximum depends on many factors. ENUM values are\nrepresented internally as integers.\n\nTrailing spaces are automatically stripped from ENUM values on table creation.\n\nENUMs require relatively little storage space compared to strings, either one\nor two bytes depending on the number of enumeration values.\n\nNULL and empty values\n---------------------\n\nAn ENUM can also contain NULL and empty values. If the ENUM column is declared\nto permit NULL values, NULL becomes a valid value, as well as the default\nvalue (see below). If strict SQL Mode is not enabled, and an invalid value is\ninserted into an ENUM, a special empty string, with an index value of zero\n(see Numeric index, below), is inserted, with a warning. This may be\nconfusing, because the empty string is also a possible value, and the only\ndifference if that is this case its index is not 0. Inserting will fail with\nan error if strict mode is active.\n\nIf a DEFAULT clause is missing, the default value will be:\n\n* NULL if the column is nullable;\n* otherwise, the first value in the enumeration.\n\nNumeric index\n-------------\n\nENUM values are indexed numerically in the order they are defined, and sorting\nwill be performed in this numeric order. We suggest not using ENUM to store\nnumerals, as there is little to no storage space benefit, and it is easy to\nconfuse the enum integer with the enum numeral value by leaving out the quotes.\n\nAn ENUM defined as ENUM(\'apple\',\'orange\',\'pear\') would have the following\nindex values:\n\n+--------------------------------------+--------------------------------------+\n| Index | Value |\n+--------------------------------------+--------------------------------------+\n| NULL | NULL |\n+--------------------------------------+--------------------------------------+\n| 0 | \'\' |\n+--------------------------------------+--------------------------------------+\n| 1 | \'apple\' |\n+--------------------------------------+--------------------------------------+\n| 2 | \'orange\' |\n+--------------------------------------+--------------------------------------+\n| 3 | \'pear\' |\n+--------------------------------------+--------------------------------------+\n\nExamples\n--------\n\nCREATE TABLE fruits (\n id INT NOT NULL auto_increment PRIMARY KEY,\n fruit ENUM(\'apple\',\'orange\',\'pear\'),\n bushels INT);\n\nDESCRIBE fruits;\n+---------+-------------------------------+------+-----+---------+-------------\n--+\n| Field | Type | Null | Key | Default | Extra \n |\n+---------+-------------------------------+------+-----+---------+-------------\n--+\n| id | int(11) | NO | PRI | NULL |\nauto_increment |\n| fruit | enum(\'apple\',\'orange\',\'pear\') | YES | | NULL | \n |\n| bushels | int(11) | YES | | NULL | \n |\n+---------+-------------------------------+------+-----+---------+-------------\n--+\n\nINSERT INTO fruits\n (fruit,bushels) VALUES\n (\'pear\',20),\n (\'apple\',100),\n (\'orange\',25);\n\nINSERT INTO fruits\n (fruit,bushels) VALUES\n (\'avocado\',10);\nERROR 1265 (01000): Data truncated for column \'fruit\' at row 1\n\nSELECT * FROM fruits;\n+----+--------+---------+\n| id | fruit | bushels |\n+----+--------+---------+\n| 1 | pear | 20 |\n| 2 | apple | 100 |\n| 3 | orange | 25 |\n+----+--------+---------+\n\nSelecting by numeric index:\n\nSELECT * FROM fruits WHERE fruit=2;\n+----+--------+---------+\n| id | fruit | bushels |\n+----+--------+---------+\n| 3 | orange | 25 |\n+----+--------+---------+\n\nSorting is according to the index value:\n\nCREATE TABLE enums (a ENUM(\'2\',\'1\'));\n\nINSERT INTO enums VALUES (\'1\'),(\'2\');\n\nSELECT * FROM enums ORDER BY a ASC;\n+------+\n| a |\n+------+\n| 2 |\n| 1 |\n+------+\n\nIt\'s easy to get confused between returning the enum integer with the stored\nvalue, so we don\'t suggest using ENUM to store numerals. The first example\nreturns the 1st indexed field (\'2\' has an index value of 1, as it\'s defined\nfirst), while the second example returns the string value \'1\'.\n\nSELECT * FROM enums WHERE a=1;\n+------+\n| a |\n+------+\n| 2 |\n+------+\n\nSELECT * FROM enums WHERE a=\'1\';\n+------+\n| a |\n+------+\n| 1 |\n+------+\n\nURL: https://mariadb.com/kb/en/enum/','','https://mariadb.com/kb/en/enum/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (275,23,'INET6','MariaDB starting with 10.5.0\n----------------------------\nThe INET6 data type was added in MariaDB 10.5.0\n\nSyntax\n------\n\nINET6\n\nDescription\n-----------\n\nThe INET6 data type is intended for storage of IPv6 addresses, as well as IPv4\naddresses assuming conventional mapping of IPv4 addresses into IPv6 addresses.\n\nBoth short and long IPv6 notation are permitted, according to RFC-5952.\n\n* Values are stored as a 16-byte fixed length binary string, with most\nsignificant byte first.\n* Storage engines see INET6 as BINARY(16).\n* Clients see INET6 as CHAR(39) and get text representation on retrieval.\n\nThe IPv4-compatible notation is considered as deprecated. It is supported for\ncompatibility with the INET6_ATON function, which also understands this\nformat. It\'s recommended to use the mapped format to store IPv4 addresses in\nINET6.\n\nWhen an IPv4 mapped (or compatible) value is stored in INET6, it still\noccupies 16 bytes:\n\nRetrieval\n---------\n\nOn retrieval, in the client-server text protocol, INET6 values are converted\nto the short text representation, according to RFC-5952, that is with all\nleading zeroes in each group removed and with consequent zero groups\ncompressed.\n\nBesides creating one\'s own stored function, there is no a way to retrieve an\nINET6 value using long text representation.\n\nCasting\n-------\n\n* CAST from a character string to INET6 understands addresses in short or long\ntext notation (including IPv4 mapped and compatible addresses). NULL is\nreturned if the format is not understood.\n* CAST from a binary string to INET6 requires a 16-byte string as an argument.\nNULL is returned if the argument length is not equal to 16.\n* CAST from other data types to INET6 first converts data to a character\nstring, then CAST from character string to INET6 is applied.\n* CAST from INET6 to CHAR returns short text address notation.\n* CAST from INET6 to BINARY returns its 16-byte binary string representation.\n* CAST from INET6 to data types other than CHAR (e.g. SIGNED, UNSIGNED, TIME,\netc) returns an error.\n\nComparisons\n-----------\n\nAn INET6 expression can be compared to:\n\n* another INET6 expression\n* a character string expression with a text (short or long) address\nrepresentation:\n* a 16-byte binary string expression:\n\nAttempting to compare INET6 to an expression of any other data type returns an\nerror.\n\nMixing INET6 Values for Result\n------------------------------\n\nAn INET6 expression can be mixed for result (i.e. UNION, CASE..THEN, COALESCE\netc) with:\n\n* another INET6 expression. The resulting data type is INET6.\n* a character string in text (short or long) address representation. The\nresult data type is INET6. The character string counterpart is automatically\nconverted to INET6. If the string format is not understood, it\'s converted\nwith a warning to either NULL or to \'::\', depending on the NULL-ability of the\nresult.\n* a 16-byte binary string. The resulting data type is INET6. The binary string\ncounterpart is automatically converted to INET6. If the length of the binary\nstring is not equal to 16, it\'s converted with a warning to NULL or to \'::\'\ndepending on the NULL-ability of the result.\n\nAttempts to mix INET6 for result with other data types will return an error.\n\nMixing INET6 with other data types for LEAST and GREATEST, when mixing for\ncomparison and mixing for result are involved at the same time, uses the same\nrules with mixing for result, described in the previous paragraphs.\n\nFunctions and Operators\n-----------------------\n\n* HEX() with an INET6 argument returns a hexadecimal representation of the\nunderlying 16-byte binary string\n* Arithmetic operators (+,-,*,/,MOD,DIV) are not supported for INET6. This may\nchange in the future.\n* The INET6_ATON function now understands INET6 values as an argument\n* The prototypes of the IS_IPV4_COMPAT and IS_IPV4_MAPPED functions have\nchanged from a BINARY(16) to a INET6,\n* When the argument for these two functions is not INET6, automatic implicit\nCAST to INET6 is applied. As a consequence, both functions now understand\narguments in both text representation and binary(16) representation. Before\nMariaDB 10.5.0, these functions understood only binary(16) representation.\n\nPrepared Statement Parameters\n-----------------------------\n\nINET6 understands both text and binary(16) address representation in prepared\nstatement parameters (PREPARE..EXECUTE and EXECUTE IMMEDIATE statements).\n\nMigration between BINARY(16) and INET6\n---------------------------------------\n\nBefore MariaDB 10.5.0, you may have used BINARY(16) as a storage for IPv6\ninternet addresses, in combination with INET6_ATON and INET6_NTOA to\nrespectively insert and retrieve data.\n\nFrom 10.5, you can ALTER BINARY(16) columns storing IPv6 addresses to INET6.\nAfter such an alter, there is no a need to use INET6_ATON() and INET6_NTOA().\nAddresses can be inserted and retrieved directly.\n\nIt is also possible to convert INET6 columns to BINARY(16) and continue using\nthe data in combination with INET6_NTOA() and INET6_ATON().\n\nExamples\n--------\n\nCREATE TABLE t1 (a INET6);\n\nInserting using short text address notation:\n\nINSERT INTO t1 VALUES (\'2001:db8::ff00:42:8329\');\n\nLong text address notation:\n\nINSERT INTO t1 VALUES (\'2001:0db8:0000:0000:0000:ff00:0042:8329\');\n\n16-byte binary string notation:\n\nINSERT INTO t1 VALUES (0x20010DB8000000000000FF0000428329);\nINSERT INTO t1 VALUES (UNHEX(\'20010DB8000000000000FF0000428329\'));\n\nIPv4 addresses, using IPv4-mapped and IPv4-compatible notations:\n\nINSERT INTO t1 VALUES (\'::ffff:192.0.2.128\'); -- mapped\nINSERT INTO t1 VALUES (\'::192.0.2.128\'); -- compatible\n\nSELECT * FROM t1;\n+------------------------+\n| a |\n+------------------------+\n| 2001:db8::ff00:42:8329 |\n| 2001:db8::ff00:42:8329 |\n| 2001:db8::ff00:42:8329 |\n| 2001:db8::ff00:42:8329 |\n| ::ffff:192.0.2.128 |\n| ::192.0.2.128 |\n+------------------------+\n\nIPv4 mapped (or compatible) values still occupy 16 bytes:\n\nCREATE OR REPLACE TABLE t1 (a INET6);\n\nINSERT INTO t1 VALUES (\'::ffff:192.0.2.128\');\n\nSELECT * FROM t1;\n+--------------------+\n| a |\n+--------------------+\n| ::ffff:192.0.2.128 |\n+--------------------+\n\nSELECT HEX(a) FROM t1;\n+----------------------------------+\n| HEX(a) |\n+----------------------------------+\n| 00000000000000000000FFFFC0000280 |\n+----------------------------------+\n\nCasting from INET6 to anything other than CHAR returns an error:\n\nSELECT CAST(a AS DECIMAL) FROM t1;\n\nERROR 4079 (HY000): Illegal parameter data type inet6 for operation\n\'decimal_typecast\'\n\nComparison Examples\n-------------------\n\nComparison with another INET6 expression:\n\nCREATE OR REPLACE TABLE t1 (a INET6);\n CREATE OR REPLACE TABLE t2 (a INET6);\n\nINSERT INTO t1 VALUES\n(\'2001:db8::ff00:42:8328\'),(\'2001:db8::ff00:42:8329\');\n INSERT INTO t2 VALUES\n(\'2001:db8::ff00:42:832a\'),(\'2001:db8::ff00:42:8329\');\n\nSELECT t1.* FROM t1,t2 WHERE t1.a=t2.a;\n +------------------------+\n | a |\n +------------------------+\n | 2001:db8::ff00:42:8329 |\n +------------------------+\n\nWith a character string expression with a text (short or long) address\nrepresentation:\n\nCREATE OR REPLACE TABLE t1 (a INET6);\n\nINSERT INTO t1 VALUES (\'2001:db8::ff00:42:8329\');\n\nSELECT * FROM t1 WHERE a=\'2001:db8::ff00:42:8329\';\n +------------------------+\n | a |\n +------------------------+\n | 2001:db8::ff00:42:8329 |\n +------------------------+\n\nWith a 16-byte binary string expression:\n\nCREATE OR REPLACE TABLE t1 (a INET6);\n\nINSERT INTO t1 VALUES (\'2001:db8::ff00:42:8329\');\n\nSELECT * FROM t1 WHERE a=X\'20010DB8000000000000FF0000428329\';\n +------------------------+\n | a |\n +------------------------+\n | 2001:db8::ff00:42:8329 |\n +------------------------+\n\nWith an expression of another data type:\n\nSELECT * FROM t1 WHERE a=1;\nERROR 4078 (HY000): Illegal parameter data types inet6 and int for operation\n\'=\'\n\nMixing for Result Examples\n--------------------------\n\nMixed with another INET6 expression, returning an INET6 data type:\n\nCREATE OR REPLACE TABLE t1 (a INET6, b INET6);\n\nINSERT INTO t1 VALUES (NULL,\'2001:db8::ff00:42:8329\');\n\nSELECT a FROM t1 UNION SELECT b FROM t1;\n +------------------------+\n | a |\n +------------------------+\n | NULL |\n | 2001:db8::ff00:42:8329 |\n +------------------------+\n\nSELECT COALESCE(a, b) FROM t1;\n +------------------------+\n | COALESCE(a, b) |\n +------------------------+\n | 2001:db8::ff00:42:8329 |\n +------------------------+\n\nMixed with a character string in text (short or long) address representation:\n\nCREATE OR REPLACE TABLE t1 (a INET6, b VARCHAR(64));\n\nINSERT INTO t1 VALUES (NULL,\'2001:db8::ff00:42:8328\');\n\nINSERT INTO t1 VALUES (NULL,\'2001:db8::ff00:42:832a garbage\');\n\nSELECT COALESCE(a,b) FROM t1;\n +------------------------+\n | COALESCE(a,b) |\n +------------------------+\n | 2001:db8::ff00:42:8328 |\n | NULL |\n +------------------------+\n 2 rows in set, 1 warning (0.001 sec)\n\nSHOW WARNINGS;\n\n+---------+------+---------------------------------------------------------+\n | Level | Code | Message\n|\n\n+---------+------+---------------------------------------------------------+\n | Warning | 1292 | Incorrect inet6 value: \'2001:db8::ff00:42:832a garbage\'\n|\n\n+---------+------+---------------------------------------------------------+\n\nMixed with a 16-byte binary string:\n\nCREATE OR REPLACE TABLE t1 (a INET6, b VARBINARY(16));\n\nINSERT INTO t1 VALUES (NULL,CONCAT(0xFFFF,REPEAT(0x0000,6),0xFFFF));\n\nINSERT INTO t1 VALUES (NULL,0x00/*garbage*/);\n\nSELECT COALESCE(a,b) FROM t1;\n +---------------+\n | COALESCE(a,b) |\n +---------------+\n | ffff::ffff |\n | NULL |\n +---------------+\n 2 rows in set, 1 warning (0.001 sec)\n\nSHOW WARNINGS;\n +---------+------+-------------------------------+\n | Level | Code | Message |\n +---------+------+-------------------------------+\n | Warning | 1292 | Incorrect inet6 value: \'\\x00\' |\n +---------+------+-------------------------------+\n\nMixing with other data types:\n\nSELECT CAST(\'ffff::ffff\' AS INET6) UNION SELECT 1;\nERROR 4078 (HY000): Illegal parameter data types inet6 and int for operation\n\'UNION\'\n\nFunctions and Operators Examples\n--------------------------------\n\nHEX with an INET6 argument returning a hexadecimal representation:\n\nSELECT HEX(CAST(\'2001:db8::ff00:42:8329\' AS INET6));\n +----------------------------------------------+\n | HEX(CAST(\'2001:db8::ff00:42:8329\' AS INET6)) |\n +----------------------------------------------+\n | 20010DB8000000000000FF0000428329 |\n +----------------------------------------------+\n\nINET6_ATON now understands INET6 values as an argument:\n\nCREATE OR REPLACE TABLE t1 (a INET6);\n\nINSERT INTO t1 VALUES (\'2001:db8::ff00:42:8329\');\n\nSELECT a, HEX(INET6_ATON(a)) FROM t1;\n +------------------------+----------------------------------+\n | a | HEX(INET6_ATON(a)) |\n +------------------------+----------------------------------+\n | 2001:db8::ff00:42:8329 | 20010DB8000000000000FF0000428329 |\n +------------------------+----------------------------------+\n\nIS_IPV4_COMPAT and IS_IPV4_MAPPED prototype now a BINARY(16)):\n\nCREATE OR REPLACE TABLE t1 (a INET6);\n\nINSERT INTO t1 VALUES (\'2001:db8::ff00:42:8329\');\n INSERT INTO t1 VALUES (\'::ffff:192.168.0.1\');\n INSERT INTO t1 VALUES (\'::192.168.0.1\');\n\nSELECT a, IS_IPV4_MAPPED(a), IS_IPV4_COMPAT(a) FROM t1;\n +------------------------+-------------------+-------------------+\n | a | IS_IPV4_MAPPED(a) | IS_IPV4_COMPAT(a) |\n +------------------------+-------------------+-------------------+\n | 2001:db8::ff00:42:8329 | 0 | 0 |\n | ::ffff:192.168.0.1 | 1 | 0 |\n | ::192.168.0.1 | 0 | 1 |\n +------------------------+-------------------+-------------------+\n\nAutomatic implicit CAST to INET6:\n\nCREATE OR REPLACE TABLE t1 (\n a INET6,\n b VARCHAR(39) DEFAULT a\n );\n\nINSERT INTO t1 (a) VALUES (\'ffff::ffff\'),(\'::ffff:192.168.0.1\');\n\nSELECT a, IS_IPV4_MAPPED(a), b, IS_IPV4_MAPPED(b) FROM t1;\n\n+--------------------+-------------------+--------------------+----------------\n--+\n | a | IS_IPV4_MAPPED(a) | b |\nIS_IPV4_MAPPED(b) |\n\n+--------------------+-------------------+--------------------+----------------\n--+\n | ffff::ffff | 0 | ffff::ffff |\n 0 |\n | ::ffff:192.168.0.1 | 1 | ::ffff:192.168.0.1 |\n 1 |\n\n+--------------------+-------------------+--------------------+----------------\n--+\n\nCREATE OR REPLACE TABLE t1 (\n a INET6,\n b BINARY(16) DEFAULT UNHEX(HEX(a))\n );\n\nINSERT INTO t1 (a) VALUES (\'ffff::ffff\'),(\'::ffff:192.168.0.1\');\n\nSELECT a, IS_IPV4_MAPPED(a), HEX(b), IS_IPV4_MAPPED(b) FROM t1;\n\n+--------------------+-------------------+----------------------------------+--\n----------------+\n | a | IS_IPV4_MAPPED(a) | HEX(b)\n | IS_IPV4_MAPPED(b) |\n\n+--------------------+-------------------+----------------------------------+--\n----------------+\n | ffff::ffff | 0 |\nFFFF000000000000000000000000FFFF | 0 |\n | ::ffff:192.168.0.1 | 1 |\n00000000000000000000FFFFC0A80001 | 1 |\n\n+--------------------+-------------------+----------------------------------+--\n----------------+\n\nPrepared Statement Parameters Examples\n--------------------------------------\n\nCREATE OR REPLACE TABLE t1 (a INET6);\n\nEXECUTE IMMEDIATE \'INSERT INTO t1 VALUES (?)\' USING \'ffff::fffe\';\nEXECUTE IMMEDIATE \'INSERT INTO t1 VALUES (?)\' USING\nX\'FFFF000000000000000000000000FFFF\';\n\nSELECT * FROM t1;\n+------------+\n| a |\n+------------+\n| ffff::fffe |\n| ffff::ffff |\n+------------+\n\nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING \'ffff::fffe\';\n+------------+\n| a |\n+------------+\n| ffff::fffe |\n+------------+\n\nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING','','https://mariadb.com/kb/en/inet6/'); +update help_topic set description = CONCAT(description, '\nX\'FFFF000000000000000000000000FFFF\';\n+------------+\n| a |\n+------------+\n| ffff::ffff |\n+------------+\n\nMigration between BINARY(16) and INET6 Examples\n-----------------------------------------------\n\nBefore MariaDB 10.5:\n\nCREATE OR REPLACE TABLE t1 (a BINARY(16));\n\nINSERT INTO t1 VALUES (INET6_ATON(\'ffff::ffff\'));\n\nSELECT INET6_NTOA(a) FROM t1;\n+---------------+\n| INET6_NTOA(a) |\n+---------------+\n| ffff::ffff |\n+---------------+\n\nMigrating to INET6, from MariaDB 10.5:\n\nALTER TABLE t1 MODIFY a INET6;\n\nINSERT INTO t1 VALUES (\'ffff::fffe\');\n\nSELECT * FROM t1;\n+------------+\n| a |\n+------------+\n| ffff::ffff |\n| ffff::fffe |\n+------------+\n\nMigration from INET6 to BINARY(16):\n\nCREATE OR REPLACE TABLE t1 (a INET6);\n\nINSERT INTO t1 VALUES (\'2001:db8::ff00:42:8329\');\nINSERT INTO t1 VALUES (\'::ffff:192.168.0.1\');\nINSERT INTO t1 VALUES (\'::192.168.0.1\');\n\nALTER TABLE t1 MODIFY a BINARY(16);\n\nSELECT INET6_NTOA(a) FROM t1;\n+------------------------+\n| INET6_NTOA(a) |\n+------------------------+\n| 2001:db8::ff00:42:8329 |\n| ::ffff:192.168.0.1 |\n| ::192.168.0.1 |\n+------------------------+\n\nURL: https://mariadb.com/kb/en/inet6/') WHERE help_topic_id = 275; +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (276,23,'JSON Data Type','MariaDB starting with 10.2.7\n----------------------------\nThe JSON alias was added in MariaDB 10.2.7. This was done to make it possible\nto use JSON columns in statement based replication from MySQL to MariaDB and\nto make it possible for MariaDB to read mysqldumps from MySQL.\n\nJSON is an alias for LONGTEXT introduced for compatibility reasons with\nMySQL\'s JSON data type. MariaDB implements this as a LONGTEXT rather, as the\nJSON data type contradicts the SQL standard, and MariaDB\'s benchmarks indicate\nthat performance is at least equivalent.\n\nIn order to ensure that a a valid json document is inserted, the JSON_VALID\nfunction can be used as a CHECK constraint. This constraint is automatically\nincluded for types using the JSON alias from MariaDB 10.4.3.\n\nExamples\n--------\n\nCREATE TABLE t (j JSON);\n\nDESC t;\n+-------+----------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+----------+------+-----+---------+-------+\n| j | longtext | YES | | NULL | |\n+-------+----------+------+-----+---------+-------+\n\nWith validation:\n\nCREATE TABLE t2 (\n j JSON\n CHECK (JSON_VALID(j))\n);\n\nINSERT INTO t2 VALUES (\'invalid\');\nERROR 4025 (23000): CONSTRAINT `j` failed for `test`.`t2`\n\nINSERT INTO t2 VALUES (\'{\"id\": 1, \"name\": \"Monty\"}\');\nQuery OK, 1 row affected (0.13 sec)\n\nReplicating JSON Data Between MySQL and MariaDB\n-----------------------------------------------\n\nThe JSON type in MySQL stores the JSON object in a compact form, not as\nLONGTEXT as in MariaDB. This means that row based replication will not work\nfor JSON types from MySQL to MariaDB.\n\nThere are a a few different ways to solve this:\n\n* Use statement based replication.\n* Change the JSON column to type TEXT in MySQL\n* If you must use row-based replication and cannot change the MySQL master\nfrom JSON to TEXT, you can try to introduce an intermediate MySQL slave and\nchange the column type from JSON to TEXT on it. Then you replicate from this\nintermediate slave to MariaDB.\n\nConverting a MySQL TABLE with JSON Fields to MariaDB\n----------------------------------------------------\n\nMariaDB can\'t directly access MySQL\'s JSON format.\n\nThere are a a few different ways to move the table to MariaDB:\n\n* From MariaDB 10.5.7, see the you can use the mysql_json plugin. See Making\nMariaDB understand MySQL JSON.\n* Change the JSON column to type TEXT in MySQL. After this, MariaDB can\ndirectly use the table without any need for a dump and restore.\n* Use mariadb-dump/mysqldump to copy the table.\n\nDifferences Between MySQL JSON Strings and MariaDB JSON Strings\n---------------------------------------------------------------\n\n* In MySQL, JSON is an object and is compared according to json values. In\nMariaDB JSON strings are normal strings and compared as strings. One exception\nis when using JSON_EXTRACT() in which case strings are unescaped before\ncomparison.\n\nURL: https://mariadb.com/kb/en/json-data-type/','','https://mariadb.com/kb/en/json-data-type/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (277,23,'MEDIUMBLOB','Syntax\n------\n\nMEDIUMBLOB\n\nDescription\n-----------\n\nA BLOB column with a maximum length of 16,777,215 (224 - 1) bytes. Each\nMEDIUMBLOB value is stored using a three-byte length prefix that indicates the\nnumber of bytes in the value.\n\nURL: https://mariadb.com/kb/en/mediumblob/','','https://mariadb.com/kb/en/mediumblob/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (278,23,'MEDIUMTEXT','Syntax\n------\n\nMEDIUMTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA TEXT column with a maximum length of 16,777,215 (224 - 1) characters. The\neffective maximum length is less if the value contains multi-byte characters.\nEach MEDIUMTEXT value is stored using a three-byte length prefix that\nindicates the number of bytes in the value.\n\nURL: https://mariadb.com/kb/en/mediumtext/','','https://mariadb.com/kb/en/mediumtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (279,23,'LONGBLOB','Syntax\n------\n\nLONGBLOB\n\nDescription\n-----------\n\nA BLOB column with a maximum length of 4,294,967,295 bytes or 4GB (232 - 1).\nThe effective maximum length of LONGBLOB columns depends on the configured\nmaximum packet size in the client/server protocol and available memory. Each\nLONGBLOB value is stored using a four-byte length prefix that indicates the\nnumber of bytes in the value.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, BLOB is a synonym for LONGBLOB.\n\nURL: https://mariadb.com/kb/en/longblob/','','https://mariadb.com/kb/en/longblob/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (280,23,'LONGTEXT','Syntax\n------\n\nLONGTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA TEXT column with a maximum length of 4,294,967,295 or 4GB (232 - 1)\ncharacters. The effective maximum length is less if the value contains\nmulti-byte characters. The effective maximum length of LONGTEXT columns also\ndepends on the configured maximum packet size in the client/server protocol\nand available memory. Each LONGTEXT value is stored using a four-byte length\nprefix that indicates the number of bytes in the value.\n\nFrom MariaDB 10.2.7, JSON is an alias for LONGTEXT. See JSON Data Type for\ndetails.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, CLOB is a synonym for LONGTEXT.\n\nURL: https://mariadb.com/kb/en/longtext/','','https://mariadb.com/kb/en/longtext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (281,23,'ROW','MariaDB starting with 10.3.0\n----------------------------\nThe ROW data type was introduced in MariaDB 10.3.0.\n\nSyntax\n------\n\nROW ( [{, }... ])\n\nDescription\n-----------\n\nROW is a data type for stored procedure variables.\n\nFeatures\n--------\n\nROW fields as normal variables\n------------------------------\n\nROW fields (members) act as normal variables, and are able to appear in all\nquery parts where a stored procedure variable is allowed:\n\n* Assignment is using the := operator and the SET command:\n\na.x:= 10;\na.x:= b.x;\nSET a.x= 10, a.y=20, a.z= b.z;\n\n* Passing to functions and operators:\n\nSELECT f1(rec.a), rec.a<10;\n\n* Clauses (select list, WHERE, HAVING, LIMIT, etc...,):\n\nSELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c;\n\n* INSERT values:\n\nINSERT INTO t1 VALUES (rec.a, rec.b, rec.c);\n\n* SELECT .. INTO targets\n\nSELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10;\n\n* Dynamic SQL out parameters (EXECUTE and EXECUTE IMMEDIATE)\n\nEXECUTE IMMEDIATE \'CALL proc_with_out_param(?)\' USING rec.a;\n\nROW type variables as FETCH targets\n-----------------------------------\n\nROW type variables are allowed as FETCH targets:\n\nFETCH cur INTO rec;\n\nwhere cur is a CURSOR and rec is a ROW type stored procedure variable.\n\nNote, currently an attempt to use FETCH for a ROW type variable returns this\nerror:\n\nERROR 1328 (HY000): Incorrect number of FETCH variables\n\nFETCH from a cursor cur into a ROW variable rec works as follows:\n\n* The number of fields in cur must match the number of fields in rec.\n Otherwise, an error is reported.\n\n* Assignment is done from left to right. The first cursor field is assigned to\n the first variable field, the second cursor field is assigned to the second\n variable field, etc.\n\n* Field names in rec are not important and can differ from field names\n in cur.\n\nSee FETCH Examples (below) for examples of using this with sql_mode=ORACLE and\nsql_mode=DEFAULT.\n\nROW type variables as SELECT...INTO targets\n-------------------------------------------\n\nROW type variables are allowed as SELECT..INTO targets with some differences\ndepending on which sql_mode is in use.\n\n* When using sql_mode=ORACLE, table%ROWTYPE and cursor%ROWTYPE\n variables can be used as SELECT...INTO targets.\n\n* Using multiple ROW variables in the SELECT..INTO list will report an\n error.\n\n* Using ROW variables with a different column count than in\n the SELECT..INTO list will report an error.\n\nSee SELECT...INTO Examples (below) for examples of using this with\nsql_mode=ORACLE and sql_mode=DEFAULT.\n\nFeatures not implemented\n------------------------\n\nThe following features are planned, but not implemented yet:\n\n* Returning a ROW type expression from a stored function (see MDEV-12252).\nThis will need some grammar change to support field names after parentheses:\n\nSELECT f1().x FROM DUAL;\n\n* Returning a ROW type expression from a built-in hybrid type function, such\nas CASE, IF, etc. \n* ROW of ROWs\n\nExamples\n--------\n\nDeclaring a ROW in a stored procedure\n-------------------------------------\n\nDELIMITER $$\nCREATE PROCEDURE p1()\nBEGIN\n DECLARE r ROW (c1 INT, c2 VARCHAR(10));\n SET r.c1= 10;\n SET r.c2= \'test\';\n INSERT INTO t1 VALUES (r.c1, r.c2);\nEND;\n$$\nDELIMITER ;\nCALL p1();\n\nFETCH Examples\n--------------\n\nA complete FETCH example for sql_mode=ORACLE:\n\nDROP TABLE IF EXISTS t1;\nCREATE TABLE t1 (a INT, b VARCHAR(32));\nINSERT INTO t1 VALUES (10,\'b10\');\nINSERT INTO t1 VALUES (20,\'b20\');\nINSERT INTO t1 VALUES (30,\'b30\');\n\nSET sql_mode=oracle;\nDROP PROCEDURE IF EXISTS p1;\nDELIMITER $$\nCREATE PROCEDURE p1 AS\n rec ROW(a INT, b VARCHAR(32));\n CURSOR c IS SELECT a,b FROM t1;\nBEGIN\n OPEN c;\n LOOP\n FETCH c INTO rec;\n EXIT WHEN c%NOTFOUND;\n SELECT (\'rec=(\' || rec.a ||\',\'|| rec.b||\')\');\n END LOOP;\n CLOSE c;\nEND;\n$$\nDELIMITER ;\nCALL p1();\n\nA complete FETCH example for sql_mode=DEFAULT:\n\nDROP TABLE IF EXISTS t1;\nCREATE TABLE t1 (a INT, b VARCHAR(32));\nINSERT INTO t1 VALUES (10,\'b10\');\nINSERT INTO t1 VALUES (20,\'b20\');\nINSERT INTO t1 VALUES (30,\'b30\');\n\nSET sql_mode=DEFAULT;\nDROP PROCEDURE IF EXISTS p1;\nDELIMITER $$\nCREATE PROCEDURE p1()\nBEGIN\n DECLARE done INT DEFAULT FALSE;\n DECLARE rec ROW(a INT, b VARCHAR(32));\n DECLARE c CURSOR FOR SELECT a,b FROM t1;\n DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;\n OPEN c;\nread_loop:\n LOOP\n FETCH c INTO rec;\n IF done THEN\n LEAVE read_loop;\n END IF;\n SELECT CONCAT(\'rec=(\',rec.a,\',\',rec.b,\')\');\n END LOOP;\n CLOSE c;\nEND;\n$$\nDELIMITER ;\nCALL p1();\n\nSELECT...INTO Examples\n----------------------\n\nA SELECT...INTO example for sql_mode=DEFAULT:\n\nSET sql_mode=DEFAULT;\nDROP TABLE IF EXISTS t1;\nDROP PROCEDURE IF EXISTS p1;\nCREATE TABLE t1 (a INT, b VARCHAR(32));\nINSERT INTO t1 VALUES (10,\'b10\');\nDELIMITER $$\nCREATE PROCEDURE p1()\nBEGIN\n DECLARE rec1 ROW(a INT, b VARCHAR(32));\n SELECT * FROM t1 INTO rec1;\n SELECT rec1.a, rec1.b;\nEND;\n$$\nDELIMITER ;\nCALL p1();\n\nThe above example returns:\n\n+--------+--------+\n| rec1.a | rec1.b |\n+--------+--------+\n| 10 | b10 |\n+--------+--------+\n\nA SELECT...INTO example for sql_mode=ORACLE:\n\nSET sql_mode=ORACLE;\nDROP TABLE IF EXISTS t1;\nDROP PROCEDURE IF EXISTS p1;\nCREATE TABLE t1 (a INT, b VARCHAR(32));\nINSERT INTO t1 VALUES (10,\'b10\');\nDELIMITER $$\nCREATE PROCEDURE p1 AS\n rec1 ROW(a INT, b VARCHAR(32));\nBEGIN\n SELECT * FROM t1 INTO rec1;\n SELECT rec1.a, rec1.b;\nEND;\n$$\nDELIMITER ;\nCALL p1();\n\nThe above example returns:\n\n+--------+--------+\n| rec1.a | rec1.b |\n+--------+--------+\n| 10 | b10 |\n+--------+--------+\n\nAn example for sql_mode=ORACLE using table%ROWTYPE variables as SELECT..INTO\ntargets:\n\nSET sql_mode=ORACLE;\nDROP TABLE IF EXISTS t1;\nDROP PROCEDURE IF EXISTS p1;\nCREATE TABLE t1 (a INT, b VARCHAR(32));\nINSERT INTO t1 VALUES (10,\'b10\');\nDELIMITER $$\nCREATE PROCEDURE p1 AS\n rec1 t1%ROWTYPE;\nBEGIN\n SELECT * FROM t1 INTO rec1;\n SELECT rec1.a, rec1.b;\nEND;\n$$\nDELIMITER ;\nCALL p1();\n\nThe above example returns:\n\n+--------+--------+\n| rec1.a | rec1.b |\n+--------+--------+\n| 10 | b10 |\n+--------+--------+\n\nAn example for sql_mode=ORACLE using cursor%ROWTYPE variables as SELECT..INTO\ntargets:\n\nSET sql_mode=ORACLE;\nDROP TABLE IF EXISTS t1;\nDROP PROCEDURE IF EXISTS p1;\nCREATE TABLE t1 (a INT, b VARCHAR(32));\nINSERT INTO t1 VALUES (10,\'b10\');\nDELIMITER $$\nCREATE PROCEDURE p1 AS\n CURSOR cur1 IS SELECT * FROM t1;\n rec1 cur1%ROWTYPE;\nBEGIN\n SELECT * FROM t1 INTO rec1;\n SELECT rec1.a, rec1.b;\nEND;\n$$\nDELIMITER ;\nCALL p1();\n\nThe above example returns:\n\n+--------+--------+\n| rec1.a | rec1.b |\n+--------+--------+\n| 10 | b10 |\n+--------+--------+\n\nURL: https://mariadb.com/kb/en/row/','','https://mariadb.com/kb/en/row/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (282,23,'TEXT','Syntax\n------\n\nTEXT[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA TEXT column with a maximum length of 65,535 (216 - 1) characters. The\neffective maximum length is less if the value contains multi-byte characters.\nEach TEXT value is stored using a two-byte length prefix that indicates the\nnumber of bytes in the value. If you need a bigger storage, consider using\nMEDIUMTEXT instead.\n\nAn optional length M can be given for this type. If this is done, MariaDB\ncreates the column as the smallest TEXT type large enough to hold values M\ncharacters long.\n\nBefore MariaDB 10.2, all MariaDB collations were of type PADSPACE, meaning\nthat TEXT (as well as VARCHAR and CHAR values) are compared without regard for\ntrailing spaces. This does not apply to the LIKE pattern-matching operator,\nwhich takes into account trailing spaces.\n\nBefore MariaDB 10.2.1, BLOB and TEXT columns could not be assigned a DEFAULT\nvalue. This restriction was lifted in MariaDB 10.2.1.\n\nExamples\n--------\n\nTrailing spaces:\n\nCREATE TABLE strtest (d TEXT(10));\nINSERT INTO strtest VALUES(\'Maria \');\n\nSELECT d=\'Maria\',d=\'Maria \' FROM strtest;\n+-----------+--------------+\n| d=\'Maria\' | d=\'Maria \' |\n+-----------+--------------+\n| 1 | 1 |\n+-----------+--------------+\n\nSELECT d LIKE \'Maria\',d LIKE \'Maria \' FROM strtest;\n+----------------+-------------------+\n| d LIKE \'Maria\' | d LIKE \'Maria \' |\n+----------------+-------------------+\n| 0 | 1 |\n+----------------+-------------------+\n\nIndexing\n--------\n\nTEXT columns can only be indexed over a specified length. This means that they\ncannot be used as the primary key of a table norm until MariaDB 10.4, can a\nunique index be created on them.\n\nMariaDB starting with 10.4\n--------------------------\nStarting with MariaDB 10.4, a unique index can be created on a TEXT column.\n\nInternally, this uses hash indexing to quickly check the values and if a hash\ncollision is found, the actual stored values are compared in order to retain\nthe uniqueness.\n\nDifference between VARCHAR and TEXT\n-----------------------------------\n\n* VARCHAR columns can be fully indexed. TEXT columns can only be indexed over\na specified length.\n* Using TEXT or BLOB in a SELECT query that uses temporary tables for storing\nintermediate results will force the temporary table to be disk based (using\nthe Aria storage engine instead of the memory storage engine, which is a bit\nslower. This is not that bad as the Aria storage engine caches the rows in\nmemory. To get the benefit of this, one should ensure that the\naria_pagecache_buffer_size variable is big enough to hold most of the row and\nindex data for temporary tables.\n\nFor Storage Engine Developers\n-----------------------------\n\n* Internally the full length of the VARCHAR column is allocated inside each\nTABLE objects record[] structure. As there are three such buffers, each open\ntable will allocate 3 times max-length-to-store-varchar bytes of memory.\n* TEXT and BLOB columns are stored with a pointer (4 or 8 bytes) + a 1-4 bytes\nlength. The TEXT data is only stored once. This means that internally TEXT\nuses less memory for each open table but instead has the additional overhead\nthat each TEXT object needs to be allocated and freed for each row access\n(with some caching in between).\n\nURL: https://mariadb.com/kb/en/text/','','https://mariadb.com/kb/en/text/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (283,23,'TINYBLOB','Syntax\n------\n\nTINYBLOB\n\nDescription\n-----------\n\nA BLOB column with a maximum length of 255 (28 - 1) bytes. Each TINYBLOB value\nis stored using a one-byte length prefix that indicates the number of bytes in\nthe value.\n\nURL: https://mariadb.com/kb/en/tinyblob/','','https://mariadb.com/kb/en/tinyblob/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (284,23,'TINYTEXT','Syntax\n------\n\nTINYTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA TEXT column with a maximum length of 255 (28 - 1) characters. The effective\nmaximum length is less if the value contains multi-byte characters. Each\nTINYTEXT value is stored using a one-byte length prefix that indicates the\nnumber of bytes in the value.\n\nURL: https://mariadb.com/kb/en/tinytext/','','https://mariadb.com/kb/en/tinytext/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (285,23,'VARBINARY','Syntax\n------\n\nVARBINARY(M)\n\nDescription\n-----------\n\nThe VARBINARY type is similar to the VARCHAR type, but stores binary byte\nstrings rather than non-binary character strings. M represents the maximum\ncolumn length in bytes.\n\nIt contains no character set, and comparison and sorting are based on the\nnumeric value of the bytes.\n\nIf the maximum length is exceeded, and SQL strict mode is not enabled , the\nextra characters will be dropped with a warning. If strict mode is enabled, an\nerror will occur.\n\nUnlike BINARY values, VARBINARYs are not right-padded when inserting.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, RAW is a synonym for VARBINARY.\n\nExamples\n--------\n\nInserting too many characters, first with strict mode off, then with it on:\n\nCREATE TABLE varbins (a VARBINARY(10));\n\nINSERT INTO varbins VALUES(\'12345678901\');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n\nSELECT * FROM varbins;\n+------------+\n| a |\n+------------+\n| 1234567890 |\n+------------+\n\nSET sql_mode=\'STRICT_ALL_TABLES\';\n\nINSERT INTO varbins VALUES(\'12345678901\');\nERROR 1406 (22001): Data too long for column \'a\' at row 1\n\nSorting is performed with the byte value:\n\nTRUNCATE varbins;\n\nINSERT INTO varbins VALUES(\'A\'),(\'B\'),(\'a\'),(\'b\');\n\nSELECT * FROM varbins ORDER BY a;\n+------+\n| a |\n+------+\n| A |\n| B |\n| a |\n| b |\n+------+\n\nUsing CAST to sort as a CHAR instead:\n\nSELECT * FROM varbins ORDER BY CAST(a AS CHAR);\n+------+\n| a |\n+------+\n| a |\n| A |\n| b |\n| B |\n+------+\n\nURL: https://mariadb.com/kb/en/varbinary/','','https://mariadb.com/kb/en/varbinary/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (286,23,'VARCHAR','Syntax\n------\n\n[NATIONAL] VARCHAR(M) [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA variable-length string. M represents the maximum column length in\ncharacters. The range of M is 0 to 65,532. The effective maximum length of a\nVARCHAR is subject to the maximum row size and the character set used. For\nexample, utf8 characters can require up to three bytes per character, so a\nVARCHAR column that uses the utf8 character set can be declared to be a\nmaximum of 21,844 characters.\n\nNote: For the ColumnStore engine, M represents the maximum column length in\nbytes.\n\nMariaDB stores VARCHAR values as a one-byte or two-byte length prefix plus\ndata. The length prefix indicates the number of bytes in the value. A VARCHAR\ncolumn uses one length byte if values require no more than 255 bytes, two\nlength bytes if values may require more than 255 bytes.\n\nMariaDB follows the standard SQL specification, and does not remove trailing\nspaces from VARCHAR values.\n\nVARCHAR(0) columns can contain 2 values: an empty string or NULL. Such columns\ncannot be part of an index. The CONNECT storage engine does not support\nVARCHAR(0).\n\nVARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR is the standard\nSQL way to define that a VARCHAR column should use some predefined character\nset. MariaDB uses utf8 as this predefined character set, as does MySQL 4.1 and\nup. NVARCHAR is shorthand for NATIONAL VARCHAR.\n\nBefore MariaDB 10.2, all MariaDB collations were of type PADSPACE, meaning\nthat VARCHAR (as well as CHAR and TEXT values) are compared without regard for\ntrailing spaces. This does not apply to the LIKE pattern-matching operator,\nwhich takes into account trailing spaces. From MariaDB 10.2, a number of NO\nPAD collations are available.\n\nIf a unique index consists of a column where trailing pad characters are\nstripped or ignored, inserts into that column where values differ only by the\nnumber of trailing pad characters will result in a duplicate-key error.\n\nExamples\n--------\n\nThe following are equivalent:\n\nVARCHAR(30) CHARACTER SET utf8\nNATIONAL VARCHAR(30)\nNVARCHAR(30)\nNCHAR VARCHAR(30)\nNATIONAL CHARACTER VARYING(30)\nNATIONAL CHAR VARYING(30)\n\nTrailing spaces:\n\nCREATE TABLE strtest (v VARCHAR(10));\nINSERT INTO strtest VALUES(\'Maria \');\n\nSELECT v=\'Maria\',v=\'Maria \' FROM strtest;\n+-----------+--------------+\n| v=\'Maria\' | v=\'Maria \' |\n+-----------+--------------+\n| 1 | 1 |\n+-----------+--------------+\n\nSELECT v LIKE \'Maria\',v LIKE \'Maria \' FROM strtest;\n+----------------+-------------------+\n| v LIKE \'Maria\' | v LIKE \'Maria \' |\n+----------------+-------------------+\n| 0 | 1 |\n+----------------+-------------------+\n\nTruncation\n----------\n\n* Depending on whether or not strict sql mode is set, you will either get a\nwarning or an error if you try to insert a string that is too long into a\nVARCHAR column. If the extra characters are spaces, the spaces that can\'t fit\nwill be removed and you will always get a warning, regardless of the sql mode\nsetting.\n\nDifference Between VARCHAR and TEXT\n-----------------------------------\n\n* VARCHAR columns can be fully indexed. TEXT columns can only be indexed over\na specified length.\n* Using TEXT or BLOB in a SELECT query that uses temporary tables for storing\nintermediate results will force the temporary table to be disk based (using\nthe Aria storage engine instead of the memory storage engine, which is a bit\nslower. This is not that bad as the Aria storage engine caches the rows in\nmemory. To get the benefit of this, one should ensure that the\naria_pagecache_buffer_size variable is big enough to hold most of the row and\nindex data for temporary tables.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, VARCHAR2 is a synonym.\n\nFor Storage Engine Developers\n-----------------------------\n\n* Internally the full length of the VARCHAR column is allocated inside each\nTABLE objects record[] structure. As there are three such buffers, each open\ntable will allocate 3 times max-length-to-store-varchar bytes of memory.\n* TEXT and BLOB columns are stored with a pointer (4 or 8 bytes) + a 1-4 bytes\nlength. The TEXT data is only stored once. This means that internally TEXT\nuses less memory for each open table but instead has the additional overhead\nthat each TEXT object needs to be allocated and freed for each row access\n(with some caching in between).\n\nURL: https://mariadb.com/kb/en/varchar/','','https://mariadb.com/kb/en/varchar/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (287,23,'SET Data Type','Syntax\n------\n\nSET(\'value1\',\'value2\',...) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nDescription\n-----------\n\nA set. A string object that can have zero or more values, each of which must\nbe chosen from the list of values \'value1\', \'value2\', ... A SET column can\nhave a maximum of 64 members. SET values are represented internally as\nintegers.\n\nSET values cannot contain commas.\n\nIf a SET contains duplicate values, an error will be returned if strict mode\nis enabled, or a warning if strict mode is not enabled.\n\nURL: https://mariadb.com/kb/en/set-data-type/','','https://mariadb.com/kb/en/set-data-type/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (288,23,'UUID Data Type','MariaDB starting with 10.7.0\n----------------------------\nThe UUID data type was added in a MariaDB 10.7.0 preview.\n\nSyntax\n------\n\nUUID\n\nDescription\n-----------\n\nThe UUID data type is intended for the storage of 128-bit UUID (Universally\nUnique Identifier) data. See the UUID function page for more details on UUIDs\nthemselves.\n\nRetrieval\n---------\n\nData retrieved by this data type is in the string representation defined in\nRFC4122.\n\nCasting\n-------\n\nString literals of hexadecimal characters and CHAR/VARCHAR/TEXT can be cast to\nthe UUID data type. Likewise hexadecimal literals, binary-literals, and\nBINARY/VARBINARY/BLOB types can also be cast to UUID.\n\nThe data type will not accept a short UUID generated with the UUID_SHORT\nfunction, but will accept a value without the - character generated by the\nSYS_GUID function (or inserted directly). Hyphens can be partially omitted as\nwell, or included after any group of two digits.\n\nThe type does not accept UUIDs in braces, permitted by some implementations.\n\nStorage\n-------\n\nUUID are stored in an index friendly manner, the order of a UUID of\nllllllll-mmmm-Vhhh-vsss-nnnnnnnnnnnn is stored as:\n\nnnnnnnnnnnnn-vsss-Vhhh-mmmm-llllllll\n\nThis provides a sorting order, if a UUIDv1 (node and timestamp) is used, of\nthe node, followed by the timestamp.\n\nExamples\n--------\n\nCREATE TABLE t1 (id UUID);\n\nDirectly Inserting via string literals:\n\nINSERT INTO t1 VALUES(\'123e4567-e89b-12d3-a456-426655440000\');\n\nDirectly Inserting via hexadecimal literals:\n\nINSERT INTO t1 VALUES (x\'fffffffffffffffffffffffffffffffe\');\n\nGenerating and inserting via the UUID function.\n\nINSERT INTO t1 VALUES (UUID());\n\nRetrieval:\n\nSELECT * FROM t1;\n+--------------------------------------+\n| id |\n+--------------------------------------+\n| 123e4567-e89b-12d3-a456-426655440000 |\n| ffffffff-ffff-ffff-ffff-fffffffffffe |\n| 93aac041-1a14-11ec-ab4e-f859713e4be4 |\n+--------------------------------------+\n\nThe UUID_SHORT function does not generate valid full-length UUID:\n\nINSERT INTO t1 VALUES (UUID_SHORT());\nERROR 1292 (22007): Incorrect uuid value: \'99440417627439104\' \n for column `test`.`t1`.`id` at row 1\n\nAccepting a value without the - character, either directly or generated by the\nSYS_GUID function:\n\nINSERT INTO t1 VALUES (SYS_GUID());\n\nSELECT * FROM t1;\n+--------------------------------------+\n| id |\n+--------------------------------------+\n| 123e4567-e89b-12d3-a456-426655440000 |\n| ffffffff-ffff-ffff-ffff-fffffffffffe |\n| 93aac041-1a14-11ec-ab4e-f859713e4be4 |\n| ea0368d3-1a14-11ec-ab4e-f859713e4be4 |\n+--------------------------------------+\n\nSELECT SYS_GUID();\n+----------------------------------+\n| SYS_GUID() |\n+----------------------------------+\n| ff5b6bcc1a1411ecab4ef859713e4be4 |\n+----------------------------------+\n\nINSERT INTO t1 VALUES (\'ff5b6bcc1a1411ecab4ef859713e4be4\');\n\nSELECT * FROM t1;\n+--------------------------------------+\n| id |\n+--------------------------------------+\n| 123e4567-e89b-12d3-a456-426655440000 |\n| ffffffff-ffff-ffff-ffff-fffffffffffe |\n| 93aac041-1a14-11ec-ab4e-f859713e4be4 |\n| ea0368d3-1a14-11ec-ab4e-f859713e4be4 |\n| ff5b6bcc-1a14-11ec-ab4e-f859713e4be4 |\n+--------------------------------------+\n\nValid and invalid hyphen and brace usage:\n\nTRUNCATE t1;\n\nINSERT INTO t1 VALUES (\'f8aa-ed66-1a1b-11ec-ab4e-f859-713e-4be4\');\n\nINSERT INTO t1 VALUES (\'1b80667f1a1c-11ecab4ef859713e4be4\');\n\nINSERT INTO t1 VALUES (\'2fd6c945-1a-1c-11ec-ab4e-f859713e4be4\');\n\nINSERT INTO t1 VALUES (\'49-c9-f9-59-1a-1c-11ec-ab4e-f859713e4be4\');\n\nINSERT INTO t1 VALUES (\'57-96-da-c1-1a-1c-11-ec-ab-4e-f8-59-71-3e-4b-e4\');\n\nINSERT INTO t1 VALUES (\'6-eb74f8f-1a1c-11ec-ab4e-f859713e4be4\');\n\nINSERT INTO t1 VALUES (\'{29bad136-1a1d-11ec-ab4e-f859713e4be4}\');\nERROR 1292 (22007): Incorrect uuid value:\n\'{29bad136-1a1d-11ec-ab4e-f859713e4be4}\' \n for column `test`.`t1`.`id` at row 1\n\nSELECT * FROM t1;\n+--------------------------------------+\n| id |\n+--------------------------------------+\n| f8aaed66-1a1b-11ec-ab4e-f859713e4be4 |\n| 1b80667f-1a1c-11ec-ab4e-f859713e4be4 |\n| 2fd6c945-1a1c-11ec-ab4e-f859713e4be4 |\n| 49c9f959-1a1c-11ec-ab4e-f859713e4be4 |\n| 5796dac1-1a1c-11ec-ab4e-f859713e4be4 |\n| 6eb74f8f-1a1c-11ec-ab4e-f859713e4be4 |\n+--------------------------------------+\n\nURL: https://mariadb.com/kb/en/uuid-data-type/','','https://mariadb.com/kb/en/uuid-data-type/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (289,23,'DATE','Syntax\n------\n\nDATE\n\nDescription\n-----------\n\nA date. The supported range is \'1000-01-01\' to \'9999-12-31\'. MariaDB displays\nDATE values in \'YYYY-MM-DD\' format, but can be assigned dates in looser\nformats, including strings or numbers, as long as they make sense. These\ninclude a short year, YY-MM-DD, no delimiters, YYMMDD, or any other acceptable\ndelimiter, for example YYYY/MM/DD. For details, see date and time literals.\n\n\'0000-00-00\' is a permitted special value (zero-date), unless the NO_ZERO_DATE\nSQL_MODE is used. Also, individual components of a date can be set to 0 (for\nexample: \'2015-00-12\'), unless the NO_ZERO_IN_DATE SQL_MODE is used. In many\ncases, the result of en expression involving a zero-date, or a date with\nzero-parts, is NULL. If the ALLOW_INVALID_DATES SQL_MODE is enabled, if the\nday part is in the range between 1 and 31, the date does not produce any\nerror, even for months that have less than 31 days.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, DATE with a time portion is a synonym for\nDATETIME. See also mariadb_schema.\n\nExamples\n--------\n\nCREATE TABLE t1 (d DATE);\n\nINSERT INTO t1 VALUES (\"2010-01-12\"), (\"2011-2-28\"), (\'120314\'),(\'13*04*21\');\n\nSELECT * FROM t1;\n+------------+\n| d |\n+------------+\n| 2010-01-12 |\n| 2011-02-28 |\n| 2012-03-14 |\n| 2013-04-21 |\n+------------+\n\nURL: https://mariadb.com/kb/en/date/','','https://mariadb.com/kb/en/date/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (290,23,'TIME','Syntax\n------\n\nTIME [()]\n\nDescription\n-----------\n\nA time. The range is \'-838:59:59.999999\' to \'838:59:59.999999\'. Microsecond\nprecision can be from 0-6; if not specified 0 is used. Microseconds have been\navailable since MariaDB 5.3.\n\nMariaDB displays TIME values in \'HH:MM:SS.ssssss\' format, but allows\nassignment of times in looser formats, including \'D HH:MM:SS\', \'HH:MM:SS\',\n\'HH:MM\', \'D HH:MM\', \'D HH\', \'SS\', or \'HHMMSS\', as well as permitting dropping\nof any leading zeros when a delimiter is provided, for example \'3:9:10\'. For\ndetails, see date and time literals.\n\nMariaDB starting with 10.1.2\n----------------------------\nMariaDB 10.1.2 introduced the --mysql56-temporal-format option, on by default,\nwhich allows MariaDB to store TIMEs using the same low-level format MySQL 5.6\nuses.\n\nInternal Format\n---------------\n\nIn MariaDB 10.1.2 a new temporal format was introduced from MySQL 5.6 that\nalters how the TIME, DATETIME and TIMESTAMP columns operate at lower levels.\nThese changes allow these temporal data types to have fractional parts and\nnegative values. You can disable this feature using the\nmysql56_temporal_format system variable.\n\nTables that include TIMESTAMP values that were created on an older version of\nMariaDB or that were created while the mysql56_temporal_format system variable\nwas disabled continue to store data using the older data type format.\n\nIn order to update table columns from the older format to the newer format,\nexecute an ALTER TABLE... MODIFY COLUMN statement that changes the column to\nthe *same* data type. This change may be needed if you want to export the\ntable\'s tablespace and import it onto a server that has\nmysql56_temporal_format=ON set (see MDEV-15225).\n\nFor instance, if you have a TIME column in your table:\n\nSHOW VARIABLES LIKE \'mysql56_temporal_format\';\n\n+-------------------------+-------+\n| Variable_name | Value |\n+-------------------------+-------+\n| mysql56_temporal_format | ON |\n+-------------------------+-------+\n\nALTER TABLE example_table MODIFY ts_col TIME;\n\nWhen MariaDB executes the ALTER TABLE statement, it converts the data from the\nolder temporal format to the newer one.\n\nIn the event that you have several tables and columns using temporal data\ntypes that you want to switch over to the new format, make sure the system\nvariable is enabled, then perform a dump and restore using mysqldump. The\ncolumns using relevant temporal data types are restored using the new temporal\nformat.\n\nStarting from MariaDB 10.5.1 columns with old temporal formats are marked with\na /* mariadb-5.3 */ comment in the output of SHOW CREATE TABLE, SHOW COLUMNS,\nDESCRIBE statements, as well as in the COLUMN_TYPE column of the\nINFORMATION_SCHEMA.COLUMNS Table.\n\nSHOW CREATE TABLE mariadb5312_time\\G\n*************************** 1. row ***************************\n Table: mariadb5312_time\nCreate Table: CREATE TABLE `mariadb5312_time` (\n `t0` time /* mariadb-5.3 */ DEFAULT NULL,\n `t6` time(6) /* mariadb-5.3 */ DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=latin1\n\nNote, columns with the current format are not marked with a comment.\n\nExamples\n--------\n\nINSERT INTO time VALUES (\'90:00:00\'), (\'800:00:00\'), (800), (22), (151413),\n(\'9:6:3\'), (\'12 09\');\n\nSELECT * FROM time;\n+-----------+\n| t |\n+-----------+\n| 90:00:00 |\n| 800:00:00 |\n| 00:08:00 |\n| 00:00:22 |\n| 15:14:13 |\n| 09:06:03 |\n| 297:00:00 |\n+-----------+\n\nURL: https://mariadb.com/kb/en/time/','','https://mariadb.com/kb/en/time/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (291,23,'DATETIME','Syntax\n------\n\nDATETIME [(microsecond precision)]\n\nDescription\n-----------\n\nA date and time combination.\n\nMariaDB displays DATETIME values in \'YYYY-MM-DD HH:MM:SS.ffffff\' format, but\nallows assignment of values to DATETIME columns using either strings or\nnumbers. For details, see date and time literals.\n\nDATETIME columns also accept CURRENT_TIMESTAMP as the default value.\n\nMariaDB 10.1.2 introduced the --mysql56-temporal-format option, on by default,\nwhich allows MariaDB to store DATETMEs using the same low-level format MySQL\n5.6 uses. For more information, see Internal Format, below.\n\nFor storage requirements, see Data Type Storage Requirements.\n\nSupported Values\n----------------\n\nMariaDB stores values that use the DATETIME data type in a format that\nsupports values between 1000-01-01 00:00:00.000000 and 9999-12-31\n23:59:59.999999.\n\nMariaDB can also store microseconds with a precision between 0 and 6. If no\nmicrosecond precision is specified, then 0 is used by default.\n\nMariaDB also supports \'0000-00-00\' as a special zero-date value, unless\nNO_ZERO_DATE is specified in the SQL_MODE. Similarly, individual components of\na date can be set to 0 (for example: \'2015-00-12\'), unless NO_ZERO_IN_DATE is\nspecified in the SQL_MODE. In many cases, the result of en expression\ninvolving a zero-date, or a date with zero-parts, is NULL. If the\nALLOW_INVALID_DATES SQL_MODE is enabled, if the day part is in the range\nbetween 1 and 31, the date does not produce any error, even for months that\nhave less than 31 days.\n\nTime Zones\n----------\n\nIf a column uses the DATETIME data type, then any inserted values are stored\nas-is, so no automatic time zone conversions are performed.\n\nMariaDB also does not currently support time zone literals that contain time\nzone identifiers. See MDEV-11829 for more information.\n\nMariaDB validates DATETIME literals against the session\'s time zone. For\nexample, if a specific time range never occurred in a specific time zone due\nto daylight savings time, then DATETIME values within that range would be\ninvalid for that time zone.\n\nFor example, daylight savings time started on March 10, 2019 in the US, so the\ntime range between 02:00:00 and 02:59:59 is invalid for that day in US time\nzones:\n\nSET time_zone = \'America/New_York\';\nQuery OK, 0 rows affected (0.000 sec)\n\nINSERT INTO timestamp_test VALUES (\'2019-03-10 02:55:05\');\nERROR 1292 (22007): Incorrect datetime value: \'2019-03-10 02:55:05\' for column\n`db1`.`timestamp_test`.`timestamp_test` at row 1\n\nBut that same time range is fine in other time zones, such as Coordinated\nUniversal Time (UTC). For example:\n\nSET time_zone = \'UTC\';\nQuery OK, 0 rows affected (0.000 sec)\n\nINSERT INTO timestamp_test VALUES (\'2019-03-10 02:55:05\');\nQuery OK, 1 row affected (0.002 sec)\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, DATE with a time portion is a synonym for\nDATETIME. See also mariadb_schema.\n\nInternal Format\n---------------\n\nIn MariaDB 10.1.2 a new temporal format was introduced from MySQL 5.6 that\nalters how the TIME, DATETIME and TIMESTAMP columns operate at lower levels.\nThese changes allow these temporal data types to have fractional parts and\nnegative values. You can disable this feature using the\nmysql56_temporal_format system variable.\n\nTables that include TIMESTAMP values that were created on an older version of\nMariaDB or that were created while the mysql56_temporal_format system variable\nwas disabled continue to store data using the older data type format.\n\nIn order to update table columns from the older format to the newer format,\nexecute an ALTER TABLE... MODIFY COLUMN statement that changes the column to\nthe *same* data type. This change may be needed if you want to export the\ntable\'s tablespace and import it onto a server that has\nmysql56_temporal_format=ON set (see MDEV-15225).\n\nFor instance, if you have a DATETIME column in your table:\n\nSHOW VARIABLES LIKE \'mysql56_temporal_format\';\n\n+-------------------------+-------+\n| Variable_name | Value |\n+-------------------------+-------+\n| mysql56_temporal_format | ON |\n+-------------------------+-------+\n\nALTER TABLE example_table MODIFY ts_col DATETIME;\n\nWhen MariaDB executes the ALTER TABLE statement, it converts the data from the\nolder temporal format to the newer one.\n\nIn the event that you have several tables and columns using temporal data\ntypes that you want to switch over to the new format, make sure the system\nvariable is enabled, then perform a dump and restore using mysqldump. The\ncolumns using relevant temporal data types are restored using the new temporal\nformat.\n\nStarting from MariaDB 10.5.1 columns with old temporal formats are marked with\na /* mariadb-5.3 */ comment in the output of SHOW CREATE TABLE, SHOW COLUMNS,\nDESCRIBE statements, as well as in the COLUMN_TYPE column of the\nINFORMATION_SCHEMA.COLUMNS Table.\n\nSHOW CREATE TABLE mariadb5312_datetime\\G\n*************************** 1. row ***************************\n Table: mariadb5312_datetime\nCreate Table: CREATE TABLE `mariadb5312_datetime` (\n `dt0` datetime /* mariadb-5.3 */ DEFAULT NULL,\n `dt6` datetime(6) /* mariadb-5.3 */ DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=latin1\n\nExamples\n--------\n\nCREATE TABLE t1 (d DATETIME);\n\nINSERT INTO t1 VALUES (\"2011-03-11\"), (\"2012-04-19 13:08:22\"),\n (\"2013-07-18 13:44:22.123456\");\n\nSELECT * FROM t1;\n+---------------------+\n| d |\n+---------------------+\n| 2011-03-11 00:00:00 |\n| 2012-04-19 13:08:22 |\n| 2013-07-18 13:44:22 |\n+---------------------+\n\nCREATE TABLE t2 (d DATETIME(6));\n\nINSERT INTO t2 VALUES (\"2011-03-11\"), (\"2012-04-19 13:08:22\"),\n (\"2013-07-18 13:44:22.123456\");\n\nSELECT * FROM t2;\n+----------------------------+\n| d |\n+----------------------------+\n| 2011-03-11 00:00:00.000000 |\n| 2012-04-19 13:08:22.000000 |\n| 2013-07-18 13:44:22.123456 |\n+----------------------------++\n\nStrings used in datetime context are automatically converted to datetime(6).\nIf you want to have a datetime without seconds, you should use\nCONVERT(..,datetime).\n\nSELECT CONVERT(\'2007-11-30 10:30:19\',datetime);\n+-----------------------------------------+\n| CONVERT(\'2007-11-30 10:30:19\',datetime) |\n+-----------------------------------------+\n| 2007-11-30 10:30:19 |\n+-----------------------------------------+\n\nSELECT CONVERT(\'2007-11-30 10:30:19\',datetime(6));\n+--------------------------------------------+\n| CONVERT(\'2007-11-30 10:30:19\',datetime(6)) |\n+--------------------------------------------+\n| 2007-11-30 10:30:19.000000 |\n+--------------------------------------------+\n\nURL: https://mariadb.com/kb/en/datetime/','','https://mariadb.com/kb/en/datetime/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (292,23,'TIMESTAMP','Syntax\n------\n\nTIMESTAMP [(0) THEN BEGIN NOT ATOMIC SELECT 1; END ; END IF;;\n\nExample of how to use WHILE loop:\n\nDELIMITER |\nBEGIN NOT ATOMIC\n DECLARE x INT DEFAULT 0;\n WHILE x <= 10 DO\n SET x = x + 1;\n SELECT x;\n END WHILE;\nEND|\nDELIMITER ;\n\nURL:\nhttps://mariadb.com/kb/en/using-compound-statements-outside-of-stored-programs/','','https://mariadb.com/kb/en/using-compound-statements-outside-of-stored-programs/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (296,24,'BEGIN END','Syntax\n------\n\n[begin_label:] BEGIN [NOT ATOMIC]\n [statement_list]\nEND [end_label]\n\nNOT ATOMIC is required when used outside of a stored procedure. Inside stored\nprocedures or within an anonymous block, BEGIN alone starts a new anonymous\nblock.\n\nDescription\n-----------\n\nBEGIN ... END syntax is used for writing compound statements. A compound\nstatement can contain multiple statements, enclosed by the BEGIN and END\nkeywords. statement_list represents a list of one or more statements, each\nterminated by a semicolon (i.e., ;) statement delimiter. statement_list is\noptional, which means that the empty compound statement (BEGIN END) is legal.\n\nNote that END will perform a commit. If you are running in autocommit mode,\nevery statement will be committed separately. If you are not running in\nautocommit mode, you must execute a COMMIT or ROLLBACK after END to get the\ndatabase up to date.\n\nUse of multiple statements requires that a client is able to send statement\nstrings containing the ; statement delimiter. This is handled in the mysql\ncommand-line client with the DELIMITER command. Changing the ;\nend-of-statement delimiter (for example, to //) allows ; to be used in a\nprogram body.\n\nA compound statement within a stored program can be labeled. end_label cannot\nbe given unless begin_label also is present. If both are present, they must be\nthe same.\n\nBEGIN ... END constructs can be nested. Each block can define its own\nvariables, a CONDITION, a HANDLER and a CURSOR, which don\'t exist in the outer\nblocks. The most local declarations override the outer objects which use the\nsame name (see example below).\n\nThe declarations order is the following:\n\n* DECLARE local variables;\n* DECLARE CONDITIONs;\n* DECLARE CURSORs;\n* DECLARE HANDLERs;\n\nNote that DECLARE HANDLER contains another BEGIN ... END construct.\n\nHere is an example of a very simple, anonymous block:\n\nBEGIN NOT ATOMIC\nSET @a=1;\nCREATE TABLE test.t1(a INT);\nEND|\n\nBelow is an example of nested blocks in a stored procedure:\n\nCREATE PROCEDURE t( )\nBEGIN\n DECLARE x TINYINT UNSIGNED DEFAULT 1;\n BEGIN\n DECLARE x CHAR(2) DEFAULT \'02\';\n DECLARE y TINYINT UNSIGNED DEFAULT 10;\n SELECT x, y;\n END;\n SELECT x;\nEND;\n\nIn this example, a TINYINT variable, x is declared in the outter block. But in\nthe inner block x is re-declared as a CHAR and an y variable is declared. The\ninner SELECT shows the \"new\" value of x, and the value of y. But when x is\nselected in the outer block, the \"old\" value is returned. The final SELECT\ndoesn\'t try to read y, because it doesn\'t exist in that context.\n\nURL: https://mariadb.com/kb/en/begin-end/','','https://mariadb.com/kb/en/begin-end/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (297,24,'CASE Statement','Syntax\n------\n\nCASE case_value\n WHEN when_value THEN statement_list\n [WHEN when_value THEN statement_list] ...\n [ELSE statement_list]\nEND CASE\n\nOr:\n\nCASE\n WHEN search_condition THEN statement_list\n [WHEN search_condition THEN statement_list] ...\n [ELSE statement_list]\nEND CASE\n\nDescription\n-----------\n\nThe text on this page describes the CASE statement for stored programs. See\nthe CASE OPERATOR for details on the CASE operator outside of stored programs.\n\nThe CASE statement for stored programs implements a complex conditional\nconstruct. If a search_condition evaluates to true, the corresponding SQL\nstatement list is executed. If no search condition matches, the statement list\nin the ELSE clause is executed. Each statement_list consists of one or more\nstatements.\n\nThe CASE statement cannot have an ELSE NULL clause, and it is terminated with\nEND CASE instead of END. implements a complex conditional construct. If a\nsearch_condition evaluates to true, the corresponding SQL statement list is\nexecuted. If no search condition matches, the statement list in the ELSE\nclause is executed. Each statement_list consists of one or more statements.\n\nIf no when_value or search_condition matches the value tested and the CASE\nstatement contains no ELSE clause, a Case not found for CASE statement error\nresults.\n\nEach statement_list consists of one or more statements; an empty\nstatement_list is not allowed. To handle situations where no value is matched\nby any WHEN clause, use an ELSE containing an empty BEGIN ... END block, as\nshown in this example:\n\nDELIMITER |\nCREATE PROCEDURE p()\nBEGIN\n DECLARE v INT DEFAULT 1;\n CASE v\n WHEN 2 THEN SELECT v;\n WHEN 3 THEN SELECT 0;\n ELSE BEGIN END;\n END CASE;\nEND;\n|\n\nThe indentation used here in the ELSE clause is for purposes of clarity only,\nand is not otherwise significant. See Delimiters in the mysql client for more\non the use of the delimiter command.\n\nNote: The syntax of the CASE statement used inside stored programs differs\nslightly from that of the SQL CASE expression described in CASE OPERATOR. The\nCASE statement cannot have an ELSE NULL clause, and it is terminated with END\nCASE instead of END.\n\nURL: https://mariadb.com/kb/en/case-statement/','','https://mariadb.com/kb/en/case-statement/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (298,24,'DECLARE CONDITION','Syntax\n------\n\nDECLARE condition_name CONDITION FOR condition_value\n\ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | mysql_error_code\n\nDescription\n-----------\n\nThe DECLARE ... CONDITION statement defines a named error condition. It\nspecifies a condition that needs specific handling and associates a name with\nthat condition. Later, the name can be used in a DECLARE ... HANDLER, SIGNAL\nor RESIGNAL statement (as long as the statement is located in the same BEGIN\n... END block).\n\nConditions must be declared after local variables, but before CURSORs and\nHANDLERs.\n\nA condition_value for DECLARE ... CONDITION can be an SQLSTATE value (a\n5-character string literal) or a MySQL error code (a number). You should not\nuse SQLSTATE value \'00000\' or MySQL error code 0, because those indicate\nsucess rather than an error condition. If you try, or if you specify an\ninvalid SQLSTATE value, an error like this is produced:\n\nERROR 1407 (42000): Bad SQLSTATE: \'00000\'\n\nFor a list of SQLSTATE values and MariaDB error codes, see MariaDB Error Codes.\n\nURL: https://mariadb.com/kb/en/declare-condition/','','https://mariadb.com/kb/en/declare-condition/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (299,24,'DECLARE HANDLER','Syntax\n------\n\nDECLARE handler_type HANDLER\n FOR condition_value [, condition_value] ...\n statement\n\nhandler_type:\n CONTINUE\n | EXIT\n | UNDO\n\ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | condition_name\n | SQLWARNING\n | NOT FOUND\n | SQLEXCEPTION\n | mariadb_error_code\n\nDescription\n-----------\n\nThe DECLARE ... HANDLER statement specifies handlers that each may deal with\none or more conditions. If one of these conditions occurs, the specified\nstatement is executed. statement can be a simple statement (for example, SET\nvar_name = value), or it can be a compound statement written using BEGIN and\nEND.\n\nHandlers must be declared after local variables, a CONDITION and a CURSOR.\n\nFor a CONTINUE handler, execution of the current program continues after\nexecution of the handler statement. For an EXIT handler, execution terminates\nfor the BEGIN ... END compound statement in which the handler is declared.\n(This is true even if the condition occurs in an inner block.) The UNDO\nhandler type statement is not supported.\n\nIf a condition occurs for which no handler has been declared, the default\naction is EXIT.\n\nA condition_value for DECLARE ... HANDLER can be any of the following values:\n\n* An SQLSTATE value (a 5-character string literal) or a MariaDB error\ncode (a number). You should not use SQLSTATE value \'00000\' or MariaDB\nerror code 0, because those indicate sucess rather than an error\ncondition. For a list of SQLSTATE values and MariaDB error codes, see\nMariaDB Error Codes.\n* A condition name previously specified with DECLARE ... CONDITION. It must be\nin the same stored program. See DECLARE CONDITION.\n* SQLWARNING is shorthand for the class of SQLSTATE values that begin\nwith \'01\'.\n* NOT FOUND is shorthand for the class of SQLSTATE values that begin\nwith \'02\'. This is relevant only the context of cursors and is used to\ncontrol what happens when a cursor reaches the end of a data set. If\nno more rows are available, a No Data condition occurs with SQLSTATE\nvalue 02000. To detect this condition, you can set up a handler for it\n(or for a NOT FOUND condition). An example is shown in Cursor Overview. This\ncondition also occurs for SELECT ... INTO var_list statements that retrieve no\nrows.\n* SQLEXCEPTION is shorthand for the class of SQLSTATE values that do\nnot begin with \'00\', \'01\', or \'02\'.\n\nWhen an error raises, in some cases it could be handled by multiple HANDLERs.\nFor example, there may be an handler for 1050 error, a separate handler for\nthe 42S01 SQLSTATE, and another separate handler for the SQLEXCEPTION class:\nin theory all occurrences of HANDLER may catch the 1050 error, but MariaDB\nchooses the HANDLER with the highest precedence. Here are the precedence rules:\n\n* Handlers which refer to an error code have the highest precedence.\n* Handlers which refer to a SQLSTATE come next.\n* Handlers which refer to an error class have the lowest precedence.\n\nIn some cases, a statement could produce multiple errors. If this happens, in\nsome cases multiple handlers could have the highest precedence. In such cases,\nthe choice of the handler is indeterminate.\n\nNote that if an error occurs within a CONTINUE HANDLER block, it can be\nhandled by another HANDLER. However, a HANDLER which is already in the stack\n(that is, it has been called to handle an error and its execution didn\'t\nfinish yet) cannot handle new errors—this prevents endless loops. For example,\nsuppose that a stored procedure contains a CONTINUE HANDLER for SQLWARNING and\nanother CONTINUE HANDLER for NOT FOUND. At some point, a NOT FOUND error\noccurs, and the execution enters the NOT FOUND HANDLER. But within that\nhandler, a warning occurs, and the execution enters the SQLWARNING HANDLER. If\nanother NOT FOUND error occurs, it cannot be handled again by the NOT FOUND\nHANDLER, because its execution is not finished.\n\nWhen a DECLARE HANDLER block can handle more than one error condition, it may\nbe useful to know which errors occurred. To do so, you can use the GET\nDIAGNOSTICS statement.\n\nAn error that is handled by a DECLARE HANDLER construct can be issued again\nusing the RESIGNAL statement.\n\nBelow is an example using DECLARE HANDLER:\n\nCREATE TABLE test.t (s1 INT, PRIMARY KEY (s1));\n\nDELIMITER //\n\nCREATE PROCEDURE handlerdemo ( )\n BEGIN\n DECLARE CONTINUE HANDLER FOR SQLSTATE \'23000\' SET @x2 = 1;\n SET @x = 1;\n INSERT INTO test.t VALUES (1);\n SET @x = 2;\n INSERT INTO test.t VALUES (1);\n SET @x = 3;\n END;\n //\n\nDELIMITER ;\n\nCALL handlerdemo( );\n\nSELECT @x;\n+------+\n| @x |\n+------+\n| 3 |\n+------+\n\nURL: https://mariadb.com/kb/en/declare-handler/','','https://mariadb.com/kb/en/declare-handler/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (300,24,'DECLARE Variable','Syntax\n------\n\nDECLARE var_name [, var_name] ... [[ROW] TYPE OF]] type [DEFAULT value]\n\nDescription\n-----------\n\nThis statement is used to declare local variables within stored programs. To\nprovide a default value for the variable, include a DEFAULT clause. The value\ncan be specified as an expression (even subqueries are permitted); it need not\nbe a constant. If the DEFAULT clause is missing, the initial value is NULL.\n\nLocal variables are treated like stored routine parameters with respect to\ndata type and overflow checking. See CREATE PROCEDURE.\n\nLocal variables must be declared before CONDITIONs, CURSORs and HANDLERs.\n\nLocal variable names are not case sensitive.\n\nThe scope of a local variable is within the BEGIN ... END block where it is\ndeclared. The variable can be referred to in blocks nested within the\ndeclaring block, except those blocks that declare a variable with the same\nname.\n\nTYPE OF / ROW TYPE OF\n---------------------\n\nMariaDB starting with 10.3\n--------------------------\nTYPE OF and ROW TYPE OF anchored data types for stored routines were\nintroduced in MariaDB 10.3.\n\nAnchored data types allow a data type to be defined based on another object,\nsuch as a table row, rather than specifically set in the declaration. If the\nanchor object changes, so will the anchored data type. This can lead to\nroutines being easier to maintain, so that if the data type in the table is\nchanged, it will automatically be changed in the routine as well.\n\nVariables declared with ROW TYPE OF will have the same features as implicit\nROW variables. It is not possible to use ROW TYPE OF variables in a LIMIT\nclause.\n\nThe real data type of TYPE OF and ROW TYPE OF table_name will become known at\nthe very beginning of the stored routine call. ALTER TABLE or DROP TABLE\nstatements performed inside the current routine on the tables that appear in\nanchors won\'t affect the data type of the anchored variables, even if the\nvariable is declared after an ALTER TABLE or DROP TABLE statement.\n\nThe real data type of a ROW TYPE OF cursor_name variable will become known\nwhen execution enters into the block where the variable is declared. Data type\ninstantiation will happen only once. In a cursor ROW TYPE OF variable that is\ndeclared inside a loop, its data type will become known on the very first\niteration and won\'t change on further loop iterations.\n\nThe tables referenced in TYPE OF and ROW TYPE OF declarations will be checked\nfor existence at the beginning of the stored routine call. CREATE PROCEDURE or\nCREATE FUNCTION will not check the referenced tables for existence.\n\nExamples\n--------\n\nTYPE OF and ROW TYPE OF from MariaDB 10.3:\n\nDECLARE tmp TYPE OF t1.a; -- Get the data type from the column {{a}} in the\ntable {{t1}}\n\nDECLARE rec1 ROW TYPE OF t1; -- Get the row data type from the table {{t1}}\n\nDECLARE rec2 ROW TYPE OF cur1; -- Get the row data type from the cursor\n{{cur1}}\n\nURL: https://mariadb.com/kb/en/declare-variable/','','https://mariadb.com/kb/en/declare-variable/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (301,24,'FOR','MariaDB starting with 10.3\n--------------------------\nFOR loops were introduced in MariaDB 10.3.\n\nSyntax\n------\n\nInteger range FOR loop:\n\n[begin_label:]\nFOR var_name IN [ REVERSE ] lower_bound .. upper_bound\nDO statement_list\nEND FOR [ end_label ]\n\nExplicit cursor FOR loop\n\n[begin_label:]\nFOR record_name IN cursor_name [ ( cursor_actual_parameter_list)]\nDO statement_list\nEND FOR [ end_label ]\n\nExplicit cursor FOR loop (Oracle mode)\n\n[begin_label:]\nFOR record_name IN cursor_name [ ( cursor_actual_parameter_list)]\nLOOP\n statement_list\nEND LOOP [ end_label ]\n\nImplicit cursor FOR loop\n\n[begin_label:]\nFOR record_name IN ( select_statement )\nDO statement_list\nEND FOR [ end_label ]\n\nDescription\n-----------\n\nFOR loops allow code to be executed a fixed number of times.\n\nIn an integer range FOR loop, MariaDB will compare the lower bound and upper\nbound values, and assign the lower bound value to a counter. If REVERSE is not\nspecified, and the upper bound value is greater than or equal to the counter,\nthe counter will be incremented and the statement will continue, after which\nthe loop is entered again. If the upper bound value is greater than the\ncounter, the loop will be exited.\n\nIf REVERSE is specified, the counter is decremented, and the upper bound value\nneeds to be less than or equal for the loop to continue.\n\nExamples\n--------\n\nIntger range FOR loop:\n\nCREATE TABLE t1 (a INT);\n\nDELIMITER //\n\nFOR i IN 1..3\nDO\n INSERT INTO t1 VALUES (i);\nEND FOR;\n//\n\nDELIMITER ;\n\nSELECT * FROM t1;\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n+------+\n\nREVERSE integer range FOR loop:\n\nCREATE OR REPLACE TABLE t1 (a INT);\n\nDELIMITER //\nFOR i IN REVERSE 4..12\n DO\n INSERT INTO t1 VALUES (i);\nEND FOR;\n//\nQuery OK, 9 rows affected (0.422 sec)\n\nDELIMITER ;\n\nSELECT * FROM t1;\n+------+\n| a |\n+------+\n| 12 |\n| 11 |\n| 10 |\n| 9 |\n| 8 |\n| 7 |\n| 6 |\n| 5 |\n| 4 |\n+------+\n\nExplicit cursor in Oracle mode:\n\nSET sql_mode=ORACLE;\n\nCREATE OR REPLACE TABLE t1 (a INT, b VARCHAR(32));\n\nINSERT INTO t1 VALUES (10,\'b0\');\nINSERT INTO t1 VALUES (11,\'b1\');\nINSERT INTO t1 VALUES (12,\'b2\');\n\nDELIMITER //\n\nCREATE OR REPLACE PROCEDURE p1(pa INT) AS \n CURSOR cur(va INT) IS\n SELECT a, b FROM t1 WHERE a=va;\nBEGIN\n FOR rec IN cur(pa)\n LOOP\n SELECT rec.a, rec.b;\n END LOOP;\nEND;\n//\n\nDELIMITER ;\n\nCALL p1(10);\n+-------+-------+\n| rec.a | rec.b |\n+-------+-------+\n| 10 | b0 |\n+-------+-------+\n\nCALL p1(11);\n+-------+-------+\n| rec.a | rec.b |\n+-------+-------+\n| 11 | b1 |\n+-------+-------+\n\nCALL p1(12);\n+-------+-------+\n| rec.a | rec.b |\n+-------+-------+\n| 12 | b2 |\n+-------+-------+\n\nCALL p1(13);\nQuery OK, 0 rows affected (0.000 sec)\n\nURL: https://mariadb.com/kb/en/for/','','https://mariadb.com/kb/en/for/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (302,24,'GOTO','MariaDB starting with 10.3\n--------------------------\nThe GOTO statement was introduced in MariaDB 10.3 for Oracle compatibility.\n\nSyntax\n------\n\nGOTO label\n\nDescription\n-----------\n\nThe GOTO statement causes the code to jump to the specified label, and\ncontinue operating from there. It is only accepted when in Oracle mode.\n\nExample\n-------\n\nSET sql_mode=ORACLE;\n\nDELIMITER //\n\nCREATE OR REPLACE PROCEDURE p1 AS\n\nBEGIN\n\nSELECT 1;\n GOTO label;\n SELECT 2;\n <
\n\n* scalar_expression may be any expression that evaluates to a single\nvalue\n* comparison_operator may be any one of: =, >, <, >=, <=, <> or !=\n\nALL returns:\n\n* NULL if the comparison operator returns NULL for at least one row returned\nby the Table subquery or scalar_expression returns NULL.\n* FALSE if the comparison operator returns FALSE for at least one row returned\nby the Table subquery.\n* TRUE if the comparison operator returns TRUE for all rows returned by the\nTable subquery, or if Table subquery returns no rows.\n\nNOT IN is an alias for <> ALL.\n\nExamples\n--------\n\nCREATE TABLE sq1 (num TINYINT);\n\nCREATE TABLE sq2 (num2 TINYINT);\n\nINSERT INTO sq1 VALUES(100);\n\nINSERT INTO sq2 VALUES(40),(50),(60);\n\nSELECT * FROM sq1 WHERE num > ALL (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nSince 100 > all of 40,50 and 60, the evaluation is true and the row is returned\n\nAdding a second row to sq1, where the evaluation for that record is false:\n\nINSERT INTO sq1 VALUES(30);\n\nSELECT * FROM sq1 WHERE num > ALL (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nAdding a new row to sq2, causing all evaluations to be false:\n\nINSERT INTO sq2 VALUES(120);\n\nSELECT * FROM sq1 WHERE num > ALL (SELECT * FROM sq2);\nEmpty set (0.00 sec)\n\nWhen the subquery returns no results, the evaluation is still true:\n\nSELECT * FROM sq1 WHERE num > ALL (SELECT * FROM sq2 WHERE num2 > 300);\n+------+\n| num |\n+------+\n| 100 |\n| 30 |\n+------+\n\nEvaluating against a NULL will cause the result to be unknown, or not true,\nand therefore return no rows:\n\nINSERT INTO sq2 VALUES (NULL);\n\nSELECT * FROM sq1 WHERE num > ALL (SELECT * FROM sq2);\n\nURL: https://mariadb.com/kb/en/subqueries-and-all/','','https://mariadb.com/kb/en/subqueries-and-all/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (423,27,'Subqueries and ANY','Subqueries using the ANY keyword will return true if the comparison returns\ntrue for at least one row returned by the subquery.\n\nSyntax\n------\n\nThe required syntax for an ANY or SOME quantified comparison is:\n\nscalar_expression comparison_operator ANY
\n\nOr:\n\nscalar_expression comparison_operator SOME
\n\n* scalar_expression may be any expression that evaluates to a\nsingle value.\n* comparison_operator may be any one of =, >, <, >=, <=, <> or !=.\n\nANY returns:\n\n* TRUE if the comparison operator returns TRUE for at least one row returned\nby the Table subquery.\n* FALSE if the comparison operator returns FALSE for all rows returned by the\nTable subquery, or Table subquery has zero rows.\n* NULL if the comparison operator returns NULL for at least one row returned\nby the Table subquery and doesn\'t returns TRUE for any of them, or if\nscalar_expression returns NULL.\n\nSOME is a synmonym for ANY, and IN is a synonym for = ANY\n\nExamples\n--------\n\nCREATE TABLE sq1 (num TINYINT);\n\nCREATE TABLE sq2 (num2 TINYINT);\n\nINSERT INTO sq1 VALUES(100);\n\nINSERT INTO sq2 VALUES(40),(50),(120);\n\nSELECT * FROM sq1 WHERE num > ANY (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\n100 is greater than two of the three values, and so the expression evaluates\nas true.\n\nSOME is a synonym for ANY:\n\nSELECT * FROM sq1 WHERE num < SOME (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nIN is a synonym for = ANY, and here there are no matches, so no results are\nreturned:\n\nSELECT * FROM sq1 WHERE num IN (SELECT * FROM sq2);\nEmpty set (0.00 sec)\n\nINSERT INTO sq2 VALUES(100);\nQuery OK, 1 row affected (0.05 sec)\n\nSELECT * FROM sq1 WHERE num <> ANY (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nReading this query, the results may be counter-intuitive. It may seem to read\nas \"SELECT * FROM sq1 WHERE num does not match any results in sq2. Since it\ndoes match 100, it could seem that the results are incorrect. However, the\nquery returns a result if the match does not match any of sq2. Since 100\nalready does not match 40, the expression evaluates to true immediately,\nregardless of the 100\'s matching. It may be more easily readable to use SOME\nin a case such as this:\n\nSELECT * FROM sq1 WHERE num <> SOME (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nURL: https://mariadb.com/kb/en/subqueries-and-any/','','https://mariadb.com/kb/en/subqueries-and-any/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (424,27,'Subqueries and EXISTS','Syntax\n------\n\nSELECT ... WHERE EXISTS
\n\nDescription\n-----------\n\nSubqueries using the EXISTS keyword will return true if the subquery returns\nany rows. Conversely, subqueries using NOT EXISTS will return true only if the\nsubquery returns no rows from the table.\n\nEXISTS subqueries ignore the columns specified by the SELECT of the subquery,\nsince they\'re not relevant. For example,\n\nSELECT col1 FROM t1 WHERE EXISTS (SELECT * FROM t2);\n\nand\n\nSELECT col1 FROM t1 WHERE EXISTS (SELECT col2 FROM t2);\n\nproduce identical results.\n\nExamples\n--------\n\nCREATE TABLE sq1 (num TINYINT);\n\nCREATE TABLE sq2 (num2 TINYINT);\n\nINSERT INTO sq1 VALUES(100);\n\nINSERT INTO sq2 VALUES(40),(50),(60);\n\nSELECT * FROM sq1 WHERE EXISTS (SELECT * FROM sq2 WHERE num2>50);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nSELECT * FROM sq1 WHERE NOT EXISTS (SELECT * FROM sq2 GROUP BY num2 HAVING\nMIN(num2)=40);\nEmpty set (0.00 sec)\n\nURL: https://mariadb.com/kb/en/subqueries-and-exists/','','https://mariadb.com/kb/en/subqueries-and-exists/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (425,27,'Subqueries in a FROM Clause','Although subqueries are more commonly placed in a WHERE clause, they can also\nform part of the FROM clause. Such subqueries are commonly called derived\ntables.\n\nIf a subquery is used in this way, you must also use an AS clause to name the\nresult of the subquery.\n\nORACLE mode\n-----------\n\nMariaDB starting with 10.6.0\n----------------------------\nFrom MariaDB 10.6.0, anonymous subqueries in a FROM clause (no AS clause) are\npermitted in ORACLE mode.\n\nExamples\n--------\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT);\n\nINSERT INTO student VALUES \n (\'Chun\', \'SQL\', 75), (\'Chun\', \'Tuning\', 73),\n (\'Esben\', \'SQL\', 43), (\'Esben\', \'Tuning\', 31),\n (\'Kaolin\', \'SQL\', 56), (\'Kaolin\', \'Tuning\', 88),\n (\'Tatiana\', \'SQL\', 87), (\'Tatiana\', \'Tuning\', 83);\n\nAssume that, given the data above, you want to return the average total for\nall students. In other words, the average of Chun\'s 148 (75+73), Esben\'s 74\n(43+31), etc.\n\nYou cannot do the following:\n\nSELECT AVG(SUM(score)) FROM student GROUP BY name;\nERROR 1111 (HY000): Invalid use of group function\n\nA subquery in the FROM clause is however permitted:\n\nSELECT AVG(sq_sum) FROM (SELECT SUM(score) AS sq_sum FROM student GROUP BY\nname) AS t;\n+-------------+\n| AVG(sq_sum) |\n+-------------+\n| 134.0000 |\n+-------------+\n\nFrom MariaDB 10.6 in ORACLE mode, the following is permitted:\n\nSELECT * FROM (SELECT 1 FROM DUAL), (SELECT 2 FROM DUAL);\n\nURL: https://mariadb.com/kb/en/subqueries-in-a-from-clause/','','https://mariadb.com/kb/en/subqueries-in-a-from-clause/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (426,27,'Subqueries and JOINs','A subquery can quite often, but not in all cases, be rewritten as a JOIN.\n\nRewriting Subqueries as JOINS\n-----------------------------\n\nA subquery using IN can be rewritten with the DISTINCT keyword, for example:\n\nSELECT * FROM table1 WHERE col1 IN (SELECT col1 FROM table2);\n\ncan be rewritten as:\n\nSELECT DISTINCT table1.* FROM table1, table2 WHERE table1.col1=table2.col1;\n\nNOT IN or NOT EXISTS queries can also be rewritten. For example, these two\nqueries returns the same result:\n\nSELECT * FROM table1 WHERE col1 NOT IN (SELECT col1 FROM table2);\nSELECT * FROM table1 WHERE NOT EXISTS (SELECT col1 FROM table2 WHERE\ntable1.col1=table2.col1);\n\nand both can be rewritten as:\n\nSELECT table1.* FROM table1 LEFT JOIN table2 ON table1.id=table2.id WHERE\ntable2.id IS NULL;\n\nSubqueries that can be rewritten as a LEFT JOIN are sometimes more efficient.\n\nUsing Subqueries instead of JOINS\n---------------------------------\n\nThere are some scenarios, though, which call for subqueries rather than joins:\n\n* When you want duplicates, but not false duplicates. Suppose Table_1\n has three rows — {1,1,2}\n — and Table_2 has two rows\n — {1,2,2}. If you need to list the rows\n in Table_1 which are also in Table_2, only this\n subquery-based SELECT statement will give the right answer\n (1,1,2):\n\nSELECT Table_1.column_1 \nFROM Table_1 \nWHERE Table_1.column_1 IN \n (SELECT Table_2.column_1\n FROM Table_2);\n\n* This SQL statement won\'t work:\n\nSELECT Table_1.column_1 \nFROM Table_1,Table_2 \nWHERE Table_1.column_1 = Table_2.column_1;\n\n* because the result will be {1,1,2,2}\n — and the duplication of 2 is an error. This SQL\n statement won\'t work either:\n\nSELECT DISTINCT Table_1.column_1 \nFROM Table_1,Table_2 \nWHERE Table_1.column_1 = Table_2.column_1;\n\n* because the result will be {1,2} — and\n the removal of the duplicated 1 is an error too.\n\n* When the outermost statement is not a query. The SQL statement:\n\nUPDATE Table_1 SET column_1 = (SELECT column_1 FROM Table_2);\n\n* can\'t be expressed using a join unless some rare SQL3 features are used.\n\n* When the join is over an expression. The SQL statement:\n\nSELECT * FROM Table_1 \nWHERE column_1 + 5 =\n (SELECT MAX(column_1) FROM Table_2);\n\n* is hard to express with a join. In fact, the only way we can think of is\n this SQL statement:\n\nSELECT Table_1.*\nFROM Table_1, \n (SELECT MAX(column_1) AS max_column_1 FROM Table_2) AS Table_2\nWHERE Table_1.column_1 + 5 = Table_2.max_column_1;\n\n* which still involves a parenthesized query, so nothing is gained from the\n transformation.\n\n* When you want to see the exception. For example, suppose the question is:\n what books are longer than Das Kapital? These two queries are effectively\n almost the same:\n\nSELECT DISTINCT Bookcolumn_1.* \nFROM Books AS Bookcolumn_1 JOIN Books AS Bookcolumn_2 USING(page_count) \nWHERE title = \'Das Kapital\';\n\nSELECT DISTINCT Bookcolumn_1.* \nFROM Books AS Bookcolumn_1 \nWHERE Bookcolumn_1.page_count > \n (SELECT DISTINCT page_count\n FROM Books AS Bookcolumn_2\n WHERE title = \'Das Kapital\');\n\n* The difference is between these two SQL statements is, if there are two\n editions of Das Kapital (with different page counts), then the self-join\n example will return the books which are longer than the shortest edition\n of Das Kapital. That might be the wrong answer, since the original\n question didn\'t ask for \"... longer than ANY book named Das Kapital\"\n (it seems to contain a false assumption that there\'s only one edition).\n\nURL: https://mariadb.com/kb/en/subqueries-and-joins/','','https://mariadb.com/kb/en/subqueries-and-joins/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (427,27,'Subquery Limitations','There are a number of limitations regarding subqueries, which are discussed\nbelow. The following tables and data will be used in the examples that follow:\n\nCREATE TABLE staff(name VARCHAR(10),age TINYINT);\n\nCREATE TABLE customer(name VARCHAR(10),age TINYINT);\n\nINSERT INTO staff VALUES \n(\'Bilhah\',37), (\'Valerius\',61), (\'Maia\',25);\n\nINSERT INTO customer VALUES \n(\'Thanasis\',48), (\'Valerius\',61), (\'Brion\',51);\n\nORDER BY and LIMIT\n------------------\n\nTo use ORDER BY or limit LIMIT in subqueries both must be used.. For example:\n\nSELECT * FROM staff WHERE name IN (SELECT name FROM customer ORDER BY name);\n+----------+------+\n| name | age |\n+----------+------+\n| Valerius | 61 |\n+----------+------+\n\nis valid, but\n\nSELECT * FROM staff WHERE name IN (SELECT NAME FROM customer ORDER BY name\nLIMIT 1);\nERROR 1235 (42000): This version of MariaDB doesn\'t \n yet support \'LIMIT & IN/ALL/ANY/SOME subquery\'\n\nis not.\n\nModifying and Selecting from the Same Table\n-------------------------------------------\n\nIt\'s not possible to both modify and select from the same table in a subquery.\nFor example:\n\nDELETE FROM staff WHERE name = (SELECT name FROM staff WHERE age=61);\nERROR 1093 (HY000): Table \'staff\' is specified twice, both \n as a target for \'DELETE\' and as a separate source for data\n\nRow Comparison Operations\n-------------------------\n\nThere is only partial support for row comparison operations. The expression in\n\nexpr op {ALL|ANY|SOME} subquery,\n\nmust be scalar and the subquery can only return a single column.\n\nHowever, because of the way IN is implemented (it is rewritten as a sequence\nof = comparisons and AND), the expression in\n\nexpression [NOT] IN subquery\n\nis permitted to be an n-tuple and the subquery can return rows of n-tuples.\n\nFor example:\n\nSELECT * FROM staff WHERE (name,age) NOT IN (\n SELECT name,age FROM customer WHERE age >=51]\n);\n+--------+------+\n| name | age |\n+--------+------+\n| Bilhah | 37 |\n| Maia | 25 |\n+--------+------+\n\nis permitted, but\n\nSELECT * FROM staff WHERE (name,age) = ALL (\n SELECT name,age FROM customer WHERE age >=51\n);\nERROR 1241 (21000): Operand should contain 1 column(s)\n\nis not.\n\nCorrelated Subqueries\n---------------------\n\nSubqueries in the FROM clause cannot be correlated subqueries. They cannot be\nevaluated for each row of the outer query since they are evaluated to produce\na result set during when the query is executed.\n\nStored Functions\n----------------\n\nA subquery can refer to a stored function which modifies data. This is an\nextension to the SQL standard, but can result in indeterminate outcomes. For\nexample, take:\n\nSELECT ... WHERE x IN (SELECT f() ...);\n\nwhere f() inserts rows. The function f() could be executed a different number\nof times depending on how the optimizer chooses to handle the query.\n\nThis sort of construct is therefore not safe to use in replication that is not\nrow-based, as there could be different results on the master and the slave.\n\nURL: https://mariadb.com/kb/en/subquery-limitations/','','https://mariadb.com/kb/en/subquery-limitations/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (428,27,'UNION','UNION is used to combine the results from multiple SELECT statements into a\nsingle result set.\n\nSyntax\n------\n\nSELECT ...\nUNION [ALL | DISTINCT] SELECT ...\n[UNION [ALL | DISTINCT] SELECT ...]\n[ORDER BY [column [, column ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n\nDescription\n-----------\n\nUNION is used to combine the results from multiple SELECT statements into a\nsingle result set.\n\nThe column names from the first SELECT statement are used as the column names\nfor the results returned. Selected columns listed in corresponding positions\nof each SELECT statement should have the same data type. (For example, the\nfirst column selected by the first statement should have the same type as the\nfirst column selected by the other statements.)\n\nIf they don\'t, the type and length of the columns in the result take into\naccount the values returned by all of the SELECTs, so there is no need for\nexplicit casting. Note that currently this is not the case for recursive CTEs\n- see MDEV-12325.\n\nTable names can be specified as db_name.tbl_name. This permits writing UNIONs\nwhich involve multiple databases. See Identifier Qualifiers for syntax details.\n\nUNION queries cannot be used with aggregate functions.\n\nEXCEPT and UNION have the same operation precedence and INTERSECT has a higher\nprecedence, unless running in Oracle mode, in which case all three have the\nsame precedence.\n\nALL/DISTINCT\n------------\n\nThe ALL keyword causes duplicate rows to be preserved. The DISTINCT keyword\n(the default if the keyword is omitted) causes duplicate rows to be removed by\nthe results.\n\nUNION ALL and UNION DISTINCT can both be present in a query. In this case,\nUNION DISTINCT will override any UNION ALLs to its left.\n\nMariaDB starting with 10.1.1\n----------------------------\nUntil MariaDB 10.1.1, all UNION ALL statements required the server to create a\ntemporary table. Since MariaDB 10.1.1, the server can in most cases execute\nUNION ALL without creating a temporary table, improving performance (see\nMDEV-334).\n\nORDER BY and LIMIT\n------------------\n\nIndividual SELECTs can contain their own ORDER BY and LIMIT clauses. In this\ncase, the individual queries need to be wrapped between parentheses. However,\nthis does not affect the order of the UNION, so they only are useful to limit\nthe record read by one SELECT.\n\nThe UNION can have global ORDER BY and LIMIT clauses, which affect the whole\nresultset. If the columns retrieved by individual SELECT statements have an\nalias (AS), the ORDER BY must use that alias, not the real column names.\n\nHIGH_PRIORITY\n-------------\n\nSpecifying a query as HIGH_PRIORITY will not work inside a UNION. If applied\nto the first SELECT, it will be ignored. Applying to a later SELECT results in\na syntax error:\n\nERROR 1234 (42000): Incorrect usage/placement of \'HIGH_PRIORITY\'\n\nSELECT ... INTO ...\n-------------------\n\nIndividual SELECTs cannot be written INTO DUMPFILE or INTO OUTFILE. If the\nlast SELECT statement specifies INTO DUMPFILE or INTO OUTFILE, the entire\nresult of the UNION will be written. Placing the clause after any other SELECT\nwill result in a syntax error.\n\nIf the result is a single row, SELECT ... INTO @var_name can also be used.\n\nMariaDB starting with 10.4.0\n----------------------------\n\nParentheses\n-----------\n\nFrom MariaDB 10.4.0, parentheses can be used to specify precedence. Before\nthis, a syntax error would be returned.\n\nExamples\n--------\n\nUNION between tables having different column names:\n\n(SELECT e_name AS name, email FROM employees)\nUNION\n(SELECT c_name AS name, email FROM customers);\n\nSpecifying the UNION\'s global order and limiting total rows:\n\n(SELECT name, email FROM employees)\nUNION\n(SELECT name, email FROM customers)\nORDER BY name LIMIT 10;\n\nAdding a constant row:\n\n(SELECT \'John Doe\' AS name, \'john.doe@example.net\' AS email)\nUNION\n(SELECT name, email FROM customers);\n\nDiffering types:\n\nSELECT CAST(\'x\' AS CHAR(1)) UNION SELECT REPEAT(\'y\',4);\n+----------------------+\n| CAST(\'x\' AS CHAR(1)) |\n+----------------------+\n| x |\n| yyyy |\n+----------------------+\n\nReturning the results in order of each individual SELECT by use of a sort\ncolumn:\n\n(SELECT 1 AS sort_column, e_name AS name, email FROM employees)\nUNION\n(SELECT 2, c_name AS name, email FROM customers) ORDER BY sort_column;\n\nDifference between UNION, EXCEPT and INTERSECT. INTERSECT ALL and EXCEPT ALL\nare available from MariaDB 10.5.0.\n\nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(2),(3),(3),(4),(5),(6);\n\nSELECT i FROM seqs WHERE i <= 3 UNION SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 UNION ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n| 3 |\n| 3 |\n| 3 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\n| 3 |\n+------+\n\nParentheses for specifying precedence, from MariaDB 10.4.0\n\nCREATE OR REPLACE TABLE t1 (a INT);\nCREATE OR REPLACE TABLE t2 (b INT);\nCREATE OR REPLACE TABLE t3 (c INT);\n\nINSERT INTO t1 VALUES (1),(2),(3),(4);\nINSERT INTO t2 VALUES (5),(6);\nINSERT INTO t3 VALUES (1),(6);\n\n((SELECT a FROM t1) UNION (SELECT b FROM t2)) INTERSECT (SELECT c FROM t3);\n+------+\n| a |\n+------+\n| 1 |\n| 6 |\n+------+\n\n(SELECT a FROM t1) UNION ((SELECT b FROM t2) INTERSECT (SELECT c FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 6 |\n+------+\n\nURL: https://mariadb.com/kb/en/union/','','https://mariadb.com/kb/en/union/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (429,27,'EXCEPT','MariaDB starting with 10.3.0\n----------------------------\nEXCEPT was introduced in MariaDB 10.3.0.\n\nThe result of EXCEPT is all records of the left SELECT result set except\nrecords which are in right SELECT result set, i.e. it is subtraction of two\nresult sets. From MariaDB 10.6.1, MINUS is a synonym.\n\nSyntax\n------\n\nSELECT ...\n(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL |\nDISTINCT]) SELECT ...\n[(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL |\nDISTINCT]) SELECT ...]\n[ORDER BY [{col_name | expr | position} [ASC | DESC] [, {col_name | expr |\nposition} [ASC | DESC] ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}\n| OFFSET start { ROW | ROWS }\n| FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } { ONLY | WITH TIES } ]\n\nPlease note:\n\n* Brackets for explicit operation precedence are not supported; use a subquery\nin the FROM clause as a workaround).\n\nDescription\n-----------\n\nMariaDB has supported EXCEPT and INTERSECT in addition to UNION since MariaDB\n10.3.\n\nThe queries before and after EXCEPT must be SELECT or VALUES statements.\n\nAll behavior for naming columns, ORDER BY and LIMIT is the same as for UNION.\nNote that the alternative SELECT ... OFFSET ... FETCH syntax is only\nsupported. This allows us to use the WITH TIES clause.\n\nEXCEPT implicitly supposes a DISTINCT operation.\n\nThe result of EXCEPT is all records of the left SELECT result except records\nwhich are in right SELECT result set, i.e. it is subtraction of two result\nsets.\n\nEXCEPT and UNION have the same operation precedence and INTERSECT has a higher\nprecedence, unless running in Oracle mode, in which case all three have the\nsame precedence.\n\nMariaDB starting with 10.4.0\n----------------------------\n\nParentheses\n-----------\n\nFrom MariaDB 10.4.0, parentheses can be used to specify precedence. Before\nthis, a syntax error would be returned.\n\nMariaDB starting with 10.5.0\n----------------------------\n\nALL/DISTINCT\n------------\n\nEXCEPT ALL and EXCEPT DISTINCT were introduced in MariaDB 10.5.0. The ALL\noperator leaves duplicates intact, while the DISTINCT operator removes\nduplicates. DISTINCT is the default behavior if neither operator is supplied,\nand the only behavior prior to MariaDB 10.5.\n\nExamples\n--------\n\nShow customers which are not employees:\n\n(SELECT e_name AS name, email FROM customers)\nEXCEPT\n(SELECT c_name AS name, email FROM employees);\n\nDifference between UNION, EXCEPT and INTERSECT. INTERSECT ALL and EXCEPT ALL\nare available from MariaDB 10.5.0.\n\nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(2),(3),(3),(4),(5),(6);\n\nSELECT i FROM seqs WHERE i <= 3 UNION SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 UNION ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n| 3 |\n| 3 |\n| 3 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\n| 3 |\n+------+\n\nParentheses for specifying precedence, from MariaDB 10.4.0\n\nCREATE OR REPLACE TABLE t1 (a INT);\nCREATE OR REPLACE TABLE t2 (b INT);\nCREATE OR REPLACE TABLE t3 (c INT);\n\nINSERT INTO t1 VALUES (1),(2),(3),(4);\nINSERT INTO t2 VALUES (5),(6);\nINSERT INTO t3 VALUES (1),(6);\n\n((SELECT a FROM t1) UNION (SELECT b FROM t2)) EXCEPT (SELECT c FROM t3);\n+------+\n| a |\n+------+\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n+------+\n\n(SELECT a FROM t1) UNION ((SELECT b FROM t2) EXCEPT (SELECT c FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n+------+\n\nHere is an example that makes use of the SEQUENCE storage engine and the\nVALUES statement, to generate a numeric sequence and remove some arbitrary\nnumbers from it:\n\n(SELECT seq FROM seq_1_to_10) EXCEPT VALUES (2), (3), (4);\n+-----+\n| seq |\n+-----+\n| 1 |\n| 5 |\n| 6 |\n| 7 |\n| 8 |\n| 9 |\n| 10 |\n+-----+\n\nURL: https://mariadb.com/kb/en/except/','','https://mariadb.com/kb/en/except/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (430,27,'INTERSECT','MariaDB starting with 10.3.0\n----------------------------\nINTERSECT was introduced in MariaDB 10.3.0.\n\nThe result of an intersect is the intersection of right and left SELECT\nresults, i.e. only records that are present in both result sets will be\nincluded in the result of the operation.\n\nSyntax\n------\n\nSELECT ...\n(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL |\nDISTINCT]) SELECT ...\n[(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL |\nDISTINCT]) SELECT ...]\n[ORDER BY [column [, column ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n\nDescription\n-----------\n\nMariaDB has supported INTERSECT (as well as EXCEPT) in addition to UNION since\nMariaDB 10.3.\n\nAll behavior for naming columns, ORDER BY and LIMIT is the same as for UNION.\n\nINTERSECT implicitly supposes a DISTINCT operation.\n\nThe result of an intersect is the intersection of right and left SELECT\nresults, i.e. only records that are present in both result sets will be\nincluded in the result of the operation.\n\nINTERSECT has higher precedence than UNION and EXCEPT (unless running running\nin Oracle mode, in which case all three have the same precedence). If possible\nit will be executed linearly but if not it will be translated to a subquery in\nthe FROM clause:\n\n(select a,b from t1)\nunion\n(select c,d from t2)\nintersect\n(select e,f from t3)\nunion\n(select 4,4);\n\nwill be translated to:\n\n(select a,b from t1)\nunion\nselect c,d from\n ((select c,d from t2)\n intersect\n (select e,f from t3)) dummy_subselect\nunion\n(select 4,4)\n\nMariaDB starting with 10.4.0\n----------------------------\n\nParentheses\n-----------\n\nFrom MariaDB 10.4.0, parentheses can be used to specify precedence. Before\nthis, a syntax error would be returned.\n\nMariaDB starting with 10.5.0\n----------------------------\n\nALL/DISTINCT\n------------\n\nINTERSECT ALL and INTERSECT DISTINCT were introduced in MariaDB 10.5.0. The\nALL operator leaves duplicates intact, while the DISTINCT operator removes\nduplicates. DISTINCT is the default behavior if neither operator is supplied,\nand the only behavior prior to MariaDB 10.5.\n\nExamples\n--------\n\nShow customers which are employees:\n\n(SELECT e_name AS name, email FROM employees)\nINTERSECT\n(SELECT c_name AS name, email FROM customers);\n\nDifference between UNION, EXCEPT and INTERSECT. INTERSECT ALL and EXCEPT ALL\nare available from MariaDB 10.5.0.\n\nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(2),(3),(3),(4),(5),(6);\n\nSELECT i FROM seqs WHERE i <= 3 UNION SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 UNION ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n| 3 |\n| 3 |\n| 3 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\n| 3 |\n+------+\n\nParentheses for specifying precedence, from MariaDB 10.4.0\n\nCREATE OR REPLACE TABLE t1 (a INT);\nCREATE OR REPLACE TABLE t2 (b INT);\nCREATE OR REPLACE TABLE t3 (c INT);\n\nINSERT INTO t1 VALUES (1),(2),(3),(4);\nINSERT INTO t2 VALUES (5),(6);\nINSERT INTO t3 VALUES (1),(6);\n\n((SELECT a FROM t1) UNION (SELECT b FROM t2)) INTERSECT (SELECT c FROM t3);\n+------+\n| a |\n+------+\n| 1 |\n| 6 |\n+------+\n\n(SELECT a FROM t1) UNION ((SELECT b FROM t2) INTERSECT (SELECT c FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 6 |\n+------+\n\nURL: https://mariadb.com/kb/en/intersect/','','https://mariadb.com/kb/en/intersect/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (431,27,'Precedence Control in Table Operations','MariaDB starting with 10.4.0\n----------------------------\nBeginning in MariaDB 10.4, you can control the ordering of execution on table\noperations using parentheses.\n\nSyntax\n------\n\n( expression )\n[ORDER BY [column[, column...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n\nDescription\n-----------\n\nUsing parentheses in your SQL allows you to control the order of execution for\nSELECT statements and Table Value Constructor, including UNION, EXCEPT, and\nINTERSECT operations. MariaDB executes the parenthetical expression before the\nrest of the statement. You can then use ORDER BY and LIMIT clauses the further\norganize the result-set.\n\nNote: In practice, the Optimizer may rearrange the exact order in which\nMariaDB executes different parts of the statement. When it calculates the\nresult-set, however, it returns values as though the parenthetical expression\nwere executed first.\n\nExample\n-------\n\nCREATE TABLE test.t1 (num INT);\n\nINSERT INTO test.t1 VALUES (1),(2),(3);\n\n(SELECT * FROM test.t1 \n UNION \n VALUES (10)) \nINTERSECT \nVALUES (1),(3),(10),(11);\n+------+\n| num |\n+------+\n| 1 |\n| 3 |\n| 10 |\n+------+\n\n((SELECT * FROM test.t1 \n UNION\n VALUES (10))\n INTERSECT \n VALUES (1),(3),(10),(11)) \nORDER BY 1 DESC;\n+------+\n| num |\n+------+\n| 10 |\n| 3 |\n| 1 |\n+------+\n\nURL: https://mariadb.com/kb/en/precedence-control-in-table-operations/','','https://mariadb.com/kb/en/precedence-control-in-table-operations/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (432,27,'LIMIT','Description\n-----------\n\nUse the LIMIT clause to restrict the number of returned rows. When you use a\nsingle integer n with LIMIT, the first n rows will be returned. Use the ORDER\nBY clause to control which rows come first. You can also select a number of\nrows after an offset using either of the following:\n\nLIMIT offset, row_count\nLIMIT row_count OFFSET offset\n\nWhen you provide an offset m with a limit n, the first m rows will be ignored,\nand the following n rows will be returned.\n\nExecuting an UPDATE with the LIMIT clause is not safe for replication. LIMIT 0\nis an exception to this rule (see MDEV-6170).\n\nThere is a LIMIT ROWS EXAMINED optimization which provides the means to\nterminate the execution of SELECT statements which examine too many rows, and\nthus use too many resources. See LIMIT ROWS EXAMINED.\n\nMulti-Table Updates\n-------------------\n\nMariaDB starting with 10.3.2\n----------------------------\nUntil MariaDB 10.3.1, it was not possible to use LIMIT (or ORDER BY) in a\nmulti-table UPDATE statement. This restriction was lifted in MariaDB 10.3.2.\n\nGROUP_CONCAT\n------------\n\nMariaDB starting with 10.3.2\n----------------------------\nStarting from MariaDB 10.3.3, it is possible to use LIMIT with GROUP_CONCAT().\n\nExamples\n--------\n\nCREATE TABLE members (name VARCHAR(20));\nINSERT INTO members VALUES(\'Jagdish\'),(\'Kenny\'),(\'Rokurou\'),(\'Immaculada\');\n\nSELECT * FROM members;\n+------------+\n| name |\n+------------+\n| Jagdish |\n| Kenny |\n| Rokurou |\n| Immaculada |\n+------------+\n\nSelect the first two names (no ordering specified):\n\nSELECT * FROM members LIMIT 2;\n+---------+\n| name |\n+---------+\n| Jagdish |\n| Kenny |\n+---------+\n\nAll the names in alphabetical order:\n\nSELECT * FROM members ORDER BY name;\n+------------+\n| name |\n+------------+\n| Immaculada |\n| Jagdish |\n| Kenny |\n| Rokurou |\n+------------+\n\nThe first two names, ordered alphabetically:\n\nSELECT * FROM members ORDER BY name LIMIT 2;\n+------------+\n| name |\n+------------+\n| Immaculada |\n| Jagdish |\n+------------+\n\nThe third name, ordered alphabetically (the first name would be offset zero,\nso the third is offset two):\n\nSELECT * FROM members ORDER BY name LIMIT 2,1;\n+-------+\n| name |\n+-------+\n| Kenny |\n+-------+\n\nFrom MariaDB 10.3.2, LIMIT can be used in a multi-table update:\n\nCREATE TABLE warehouse (product_id INT, qty INT);\nINSERT INTO warehouse VALUES (1,100),(2,100),(3,100),(4,100);\n\nCREATE TABLE store (product_id INT, qty INT);\nINSERT INTO store VALUES (1,5),(2,5),(3,5),(4,5);\n\nUPDATE warehouse,store SET warehouse.qty = warehouse.qty-2, store.qty =\nstore.qty+2 \n WHERE (warehouse.product_id = store.product_id AND store.product_id >= 1)\n ORDER BY store.product_id DESC LIMIT 2;\n\nSELECT * FROM warehouse;\n+------------+------+\n| product_id | qty |\n+------------+------+\n| 1 | 100 |\n| 2 | 100 |\n| 3 | 98 |\n| 4 | 98 |\n+------------+------+\n\nSELECT * FROM store;\n+------------+------+\n| product_id | qty |\n+------------+------+\n| 1 | 5 |\n| 2 | 5 |\n| 3 | 7 |\n| 4 | 7 |\n+------------+------+\n\nFrom MariaDB 10.3.3, LIMIT can be used with GROUP_CONCAT, so, for example,\ngiven the following table:\n\nCREATE TABLE d (dd DATE, cc INT);\n\nINSERT INTO d VALUES (\'2017-01-01\',1);\nINSERT INTO d VALUES (\'2017-01-02\',2);\nINSERT INTO d VALUES (\'2017-01-04\',3);\n\nthe following query:\n\nSELECT SUBSTRING_INDEX(GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY cc\nDESC),\",\",1) FROM d;\n+----------------------------------------------------------------------------+\n| SUBSTRING_INDEX(GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY cc DESC),\",\",1) |\n+----------------------------------------------------------------------------+\n| 2017-01-04:3 |\n+----------------------------------------------------------------------------+\n\ncan be more simply rewritten as:\n\nSELECT GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY cc DESC LIMIT 1) FROM d;\n+-------------------------------------------------------------+\n| GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY cc DESC LIMIT 1) |\n+-------------------------------------------------------------+\n| 2017-01-04:3 |\n+-------------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/limit/','','https://mariadb.com/kb/en/limit/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (433,27,'ORDER BY','Description\n-----------\n\nUse the ORDER BY clause to order a resultset, such as that are returned from a\nSELECT statement. You can specify just a column or use any expression with\nfunctions. If you are using the GROUP BY clause, you can use grouping\nfunctions in ORDER BY. Ordering is done after grouping.\n\nYou can use multiple ordering expressions, separated by commas. Rows will be\nsorted by the first expression, then by the second expression if they have the\nsame value for the first, and so on.\n\nYou can use the keywords ASC and DESC after each ordering expression to force\nthat ordering to be ascending or descending, respectively. Ordering is\nascending by default.\n\nYou can also use a single integer as the ordering expression. If you use an\ninteger n, the results will be ordered by the nth column in the select\nexpression.\n\nWhen string values are compared, they are compared as if by the STRCMP\nfunction. STRCMP ignores trailing whitespace and may normalize characters and\nignore case, depending on the collation in use.\n\nDuplicated entries in the ORDER BY clause are removed.\n\nORDER BY can also be used to order the activities of a DELETE or UPDATE\nstatement (usually with the LIMIT clause).\n\nMariaDB starting with 10.3.2\n----------------------------\nUntil MariaDB 10.3.1, it was not possible to use ORDER BY (or LIMIT) in a\nmulti-table UPDATE statement. This restriction was lifted in MariaDB 10.3.2.\n\nMariaDB starting with 10.5\n--------------------------\nFrom MariaDB 10.5, MariaDB allows packed sort keys and values of non-sorted\nfields in the sort buffer. This can make filesort temporary files much smaller\nwhen VARCHAR, CHAR or BLOBs are used, notably speeding up some ORDER BY sorts.\n\nExamples\n--------\n\nCREATE TABLE seq (i INT, x VARCHAR(1));\nINSERT INTO seq VALUES (1,\'a\'), (2,\'b\'), (3,\'b\'), (4,\'f\'), (5,\'e\');\n\nSELECT * FROM seq ORDER BY i;\n+------+------+\n| i | x |\n+------+------+\n| 1 | a |\n| 2 | b |\n| 3 | b |\n| 4 | f |\n| 5 | e |\n+------+------+\n\nSELECT * FROM seq ORDER BY i DESC;\n+------+------+\n| i | x |\n+------+------+\n| 5 | e |\n| 4 | f |\n| 3 | b |\n| 2 | b |\n| 1 | a |\n+------+------+\n\nSELECT * FROM seq ORDER BY x,i;\n+------+------+\n| i | x |\n+------+------+\n| 1 | a |\n| 2 | b |\n| 3 | b |\n| 5 | e |\n| 4 | f |\n+------+------+\n\nORDER BY in an UPDATE statement, in conjunction with LIMIT:\n\nUPDATE seq SET x=\'z\' WHERE x=\'b\' ORDER BY i DESC LIMIT 1;\n\nSELECT * FROM seq;\n+------+------+\n| i | x |\n+------+------+\n| 1 | a |\n| 2 | b |\n| 3 | z |\n| 4 | f |\n| 5 | e |\n+------+------+\n\nFrom MariaDB 10.3.2, ORDER BY can be used in a multi-table update:\n\nCREATE TABLE warehouse (product_id INT, qty INT);\nINSERT INTO warehouse VALUES (1,100),(2,100),(3,100),(4,100);\n\nCREATE TABLE store (product_id INT, qty INT);\nINSERT INTO store VALUES (1,5),(2,5),(3,5),(4,5);\n\nUPDATE warehouse,store SET warehouse.qty = warehouse.qty-2, store.qty =\nstore.qty+2 \n WHERE (warehouse.product_id = store.product_id AND store.product_id >= 1)\n ORDER BY store.product_id DESC LIMIT 2;\n\nSELECT * FROM warehouse;\n+------------+------+\n| product_id | qty |\n+------------+------+\n| 1 | 100 |\n| 2 | 100 |\n| 3 | 98 |\n| 4 | 98 |\n+------------+------+\n\nSELECT * FROM store;\n+------------+------+\n| product_id | qty |\n+------------+------+\n| 1 | 5 |\n| 2 | 5 |\n| 3 | 7 |\n| 4 | 7 |\n+------------+------+\n\nURL: https://mariadb.com/kb/en/order-by/','','https://mariadb.com/kb/en/order-by/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (434,27,'GROUP BY','Use the GROUP BY clause in a SELECT statement to group rows together that have\nthe same value in one or more column, or the same computed value using\nexpressions with any functions and operators except grouping functions. When\nyou use a GROUP BY clause, you will get a single result row for each group of\nrows that have the same value for the expression given in GROUP BY.\n\nWhen grouping rows, grouping values are compared as if by the = operator. For\nstring values, the = operator ignores trailing whitespace and may normalize\ncharacters and ignore case, depending on the collation in use.\n\nYou can use any of the grouping functions in your select expression. Their\nvalues will be calculated based on all the rows that have been grouped\ntogether for each result row. If you select a non-grouped column or a value\ncomputed from a non-grouped column, it is undefined which row the returned\nvalue is taken from. This is not permitted if the ONLY_FULL_GROUP_BY SQL_MODE\nis used.\n\nYou can use multiple expressions in the GROUP BY clause, separated by commas.\nRows are grouped together if they match on each of the expressions.\n\nYou can also use a single integer as the grouping expression. If you use an\ninteger n, the results will be grouped by the nth column in the select\nexpression.\n\nThe WHERE clause is applied before the GROUP BY clause. It filters\nnon-aggregated rows before the rows are grouped together. To filter grouped\nrows based on aggregate values, use the HAVING clause. The HAVING clause takes\nany expression and evaluates it as a boolean, just like the WHERE clause. You\ncan use grouping functions in the HAVING clause. As with the select\nexpression, if you reference non-grouped columns in the HAVING clause, the\nbehavior is undefined.\n\nBy default, if a GROUP BY clause is present, the rows in the output will be\nsorted by the expressions used in the GROUP BY. You can also specify ASC or\nDESC (ascending, descending) after those expressions, like in ORDER BY. The\ndefault is ASC.\n\nIf you want the rows to be sorted by another field, you can add an explicit\nORDER BY. If you don\'t want the result to be ordered, you can add ORDER BY\nNULL.\n\nWITH ROLLUP\n-----------\n\nThe WITH ROLLUP modifer adds extra rows to the resultset that represent\nsuper-aggregate summaries. For a full description with examples, see SELECT\nWITH ROLLUP.\n\nGROUP BY Examples\n-----------------\n\nConsider the following table that records how many times each user has played\nand won a game:\n\nCREATE TABLE plays (name VARCHAR(16), plays INT, wins INT);\nINSERT INTO plays VALUES \n (\"John\", 20, 5),\n (\"Robert\", 22, 8),\n (\"Wanda\", 32, 8),\n (\"Susan\", 17, 3);\n\nGet a list of win counts along with a count:\n\nSELECT wins, COUNT(*) FROM plays GROUP BY wins;\n+------+----------+\n| wins | COUNT(*) |\n+------+----------+\n| 3 | 1 |\n| 5 | 1 |\n| 8 | 2 |\n+------+----------+\n3 rows in set (0.00 sec)\n\nThe GROUP BY expression can be a computed value, and can refer back to an\nidentifer specified with AS. Get a list of win averages along with a count:\n\nSELECT (wins / plays) AS winavg, COUNT(*) FROM plays GROUP BY winavg;\n+--------+----------+\n| winavg | COUNT(*) |\n+--------+----------+\n| 0.1765 | 1 |\n| 0.2500 | 2 |\n| 0.3636 | 1 |\n+--------+----------+\n3 rows in set (0.00 sec)\n\nYou can use any grouping function in the select expression. For each win\naverage as above, get a list of the average play count taken to get that\naverage:\n\nSELECT (wins / plays) AS winavg, AVG(plays) FROM plays \n GROUP BY winavg;\n+--------+------------+\n| winavg | AVG(plays) |\n+--------+------------+\n| 0.1765 | 17.0000 |\n| 0.2500 | 26.0000 |\n| 0.3636 | 22.0000 |\n+--------+------------+\n3 rows in set (0.00 sec)\n\nYou can filter on aggregate information using the HAVING clause. The HAVING\nclause is applied after GROUP BY and allows you to filter on aggregate data\nthat is not available to the WHERE clause. Restrict the above example to\nresults that involve an average number of plays over 20:\n\nSELECT (wins / plays) AS winavg, AVG(plays) FROM plays \n GROUP BY winavg HAVING AVG(plays) > 20;\n+--------+------------+\n| winavg | AVG(plays) |\n+--------+------------+\n| 0.2500 | 26.0000 |\n| 0.3636 | 22.0000 |\n+--------+------------+\n2 rows in set (0.00 sec)\n\nURL: https://mariadb.com/kb/en/group-by/','','https://mariadb.com/kb/en/group-by/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (435,27,'WITH','MariaDB starting with 10.2.1\n----------------------------\nCommon Table Expressions were introduced in MariaDB 10.2.1.\n\nSyntax\n------\n\nWITH [RECURSIVE] table_reference [(columns_list)] AS (\n SELECT ...\n)\n[CYCLE cycle_column_list RESTRICT]\nSELECT ...\n\nDescription\n-----------\n\nThe WITH keyword signifies a Common Table Expression (CTE). It allows you to\nrefer to a subquery expression many times in a query, as if having a temporary\ntable that only exists for the duration of a query.\n\nThere are two kinds of CTEs:\n\n* Non-Recursive\n* Recursive (signified by the RECURSIVE keyword, supported since MariaDB\n10.2.2)\n\nYou can use table_reference as any normal table in the external SELECT part.\nYou can also use WITH in subqueries, as well as with EXPLAIN and SELECT.\n\nPoorly-formed recursive CTEs can in theory cause infinite loops. The\nmax_recursive_iterations system variable limits the number of recursions.\n\nCYCLE ... RESTRICT\n------------------\n\nMariaDB starting with 10.5.2\n----------------------------\nThe CYCLE clause enables CTE cycle detection, avoiding excessive or infinite\nloops, MariaDB supports a relaxed, non-standard grammar.\n\nThe SQL Standard permits a CYCLE clause, as follows:\n\nWITH RECURSIVE ... (\n ...\n)\nCYCLE \nSET TO DEFAULT \nUSING \n\nwhere all clauses are mandatory.\n\nMariaDB does not support this, but from 10.5.2 permits a non-standard relaxed\ngrammar, as follows:\n\nWITH RECURSIVE ... (\n ...\n)\nCYCLE RESTRICT\n\nWith the use of CYCLE ... RESTRICT it makes no difference whether the CTE uses\nUNION ALL or UNION DISTINCT anymore. UNION ALL means \"all rows, but without\ncycles\", which is exactly what the CYCLE clause enables. And UNION DISTINCT\nmeans all rows should be different, which, again, is what will happen — as\nuniqueness is enforced over a subset of columns, complete rows will\nautomatically all be different.\n\nExamples\n--------\n\nBelow is an example with the WITH at the top level:\n\nWITH t AS (SELECT a FROM t1 WHERE b >= \'c\') \n SELECT * FROM t2, t WHERE t2.c = t.a;\n\nThe example below uses WITH in a subquery:\n\nSELECT t1.a, t1.b FROM t1, t2\n WHERE t1.a > t2.c\n AND t2.c IN(WITH t AS (SELECT * FROM t1 WHERE t1.a < 5)\n SELECT t2.c FROM t2, t WHERE t2.c = t.a);\n\nBelow is an example of a Recursive CTE:\n\nWITH RECURSIVE ancestors AS \n ( SELECT * FROM folks\n WHERE name=\"Alex\"\n UNION\n SELECT f.*\n FROM folks AS f, ancestors AS a\n WHERE f.id = a.father OR f.id = a.mother )\nSELECT * FROM ancestors;\n\nTake the following structure, and data,\n\nCREATE TABLE t1 (from_ int, to_ int);\nINSERT INTO t1 VALUES (1,2), (1,100), (2,3), (3,4), (4,1);\nSELECT * FROM t1;\n+-------+------+\n| from_ | to_ |\n+-------+------+\n| 1 | 2 |\n| 1 | 100 |\n| 2 | 3 |\n| 3 | 4 |\n| 4 | 1 |\n+-------+------+\n\nGiven the above, the following query would theoretically result in an infinite\nloop due to the last record in t1 (note that max_recursive_iterations is set\nto 10 for the purposes of this example, to avoid the excessive number of\ncycles):\n\nSET max_recursive_iterations=10;\n\nWITH RECURSIVE cte (depth, from_, to_) AS ( \n SELECT 0,1,1 UNION DISTINCT SELECT depth+1, t1.from_, t1.to_\n FROM t1, cte WHERE t1.from_ = cte.to_\n) \nSELECT * FROM cte;\n+-------+-------+------+\n| depth | from_ | to_ |\n+-------+-------+------+\n| 0 | 1 | 1 |\n| 1 | 1 | 2 |\n| 1 | 1 | 100 |\n| 2 | 2 | 3 |\n| 3 | 3 | 4 |\n| 4 | 4 | 1 |\n| 5 | 1 | 2 |\n| 5 | 1 | 100 |\n| 6 | 2 | 3 |\n| 7 | 3 | 4 |\n| 8 | 4 | 1 |\n| 9 | 1 | 2 |\n| 9 | 1 | 100 |\n| 10 | 2 | 3 |\n+-------+-------+------+\n\nHowever, the CYCLE ... RESTRICT clause (from MariaDB 10.5.2) can overcome this:\n\nWITH RECURSIVE cte (depth, from_, to_) AS ( \n SELECT 0,1,1 UNION SELECT depth+1, t1.from_, t1.to_\n FROM t1, cte WHERE t1.from_ = cte.to_\n) \nCYCLE from_, to_ RESTRICT \nSELECT * FROM cte;\n+-------+-------+------+\n| depth | from_ | to_ |\n+-------+-------+------+\n| 0 | 1 | 1 |\n| 1 | 1 | 2 |\n| 1 | 1 | 100 |\n| 2 | 2 | 3 |\n| 3 | 3 | 4 |\n| 4 | 4 | 1 |\n+-------+-------+------+\n\nURL: https://mariadb.com/kb/en/with/','','https://mariadb.com/kb/en/with/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (436,27,'Non-Recursive Common Table Expressions Overview','Common Table Expressions (CTEs) are a standard SQL feature, and are\nessentially temporary named result sets. There are two kinds of CTEs:\nNon-Recursive, which this article covers; and Recursive.\n\nMariaDB starting with 10.2.1\n----------------------------\nCommon table expressions were introduced in MariaDB 10.2.1.\n\nNon-Recursive CTEs\n------------------\n\nThe WITH keyword signifies a CTE. It is given a name, followed by a body (the\nmain query) as follows:\n\nCTEs are similar to derived tables. For example\n\nWITH engineers AS \n ( SELECT * FROM employees\n WHERE dept = \'Engineering\' )\n\nSELECT * FROM engineers\nWHERE ...\n\nSELECT * FROM\n ( SELECT * FROM employees\n WHERE dept = \'Engineering\' ) AS engineers\nWHERE\n...\n\nA non-recursive CTE is basically a query-local VIEW. There are several\nadvantages and caveats to them. The syntax is more readable than nested FROM\n(SELECT ...). A CTE can refer to another and it can be referenced from\nmultiple places.\n\nA CTE referencing Another CTE\n-----------------------------\n\nUsing this format makes for a more readable SQL than a nested FROM(SELECT ...)\nclause. Below is an example of this:\n\nWITH engineers AS (\nSELECT * FROM employees\nWHERE dept IN(\'Development\',\'Support\') ),\neu_engineers AS ( SELECT * FROM engineers WHERE country IN(\'NL\',...) )\nSELECT\n...\nFROM eu_engineers;\n\nMultiple Uses of a CTE\n----------------------\n\nThis can be an \'anti-self join\', for example:\n\nWITH engineers AS (\nSELECT * FROM employees\nWHERE dept IN(\'Development\',\'Support\') )\n\nSELECT * FROM engineers E1\nWHERE NOT EXISTS\n (SELECT 1 FROM engineers E2\n WHERE E2.country=E1.country\n AND E2.name <> E1.name );\n\nOr, for year-over-year comparisons, for example:\n\nWITH sales_product_year AS (\nSELECT product, YEAR(ship_date) AS year,\nSUM(price) AS total_amt\nFROM item_sales\nGROUP BY product, year )\n\nSELECT *\nFROM sales_product_year CUR,\nsales_product_year PREV,\nWHERE CUR.product=PREV.product \nAND CUR.year=PREV.year + 1 \nAND CUR.total_amt > PREV.total_amt\n\nAnother use is to compare individuals against their group. Below is an example\nof how this might be executed:\n\nWITH sales_product_year AS (\nSELECT product,\nYEAR(ship_date) AS year,\nSUM(price) AS total_amt\nFROM item_sales\nGROUP BY product, year\n)\n\nSELECT * \nFROM sales_product_year S1\nWHERE\ntotal_amt > \n (SELECT 0.1 * SUM(total_amt)\n FROM sales_product_year S2\n WHERE S2.year = S1.year)\n\nURL: https://mariadb.com/kb/en/non-recursive-common-table-expressions-overview/','','https://mariadb.com/kb/en/non-recursive-common-table-expressions-overview/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (437,27,'Recursive Common Table Expressions Overview','MariaDB starting with 10.2.2\n----------------------------\nRecursive Common Table Expressions have been supported since MariaDB 10.2.2.\n\nCommon Table Expressions (CTEs) are a standard SQL feature, and are\nessentially temporary named result sets. CTEs first appeared in the SQL\nstandard in 1999, and the first implementations began appearing in 2007.\n\nThere are two kinds of CTEs:\n\n* Non-recursive\n* Recursive, which this article covers.\n\nSQL is generally poor at recursive structures.\n\nCTEs permit a query to reference itself. A recursive CTE will repeatedly\nexecute subsets of the data until it obtains the complete result set. This\nmakes it particularly useful for handing hierarchical or tree-structured data.\nmax_recursive_iterations avoids infinite loops.\n\nSyntax example\n--------------\n\nWITH RECURSIVE signifies a recursive CTE. It is given a name, followed by a\nbody (the main query) as follows:\n\nComputation\n-----------\n\nGiven the following structure:\n\nFirst execute the anchor part of the query:\n\nNext, execute the recursive part of the query:\n\nSummary so far\n--------------\n\nwith recursive R as (\n select anchor_data\n union [all]\n select recursive_part\n from R, ...\n)\nselect ...\n\n* Compute anchor_data\n* Compute recursive_part to get the new data\n* if (new data is non-empty) goto 2;\n\nCAST to avoid truncating data\n-----------------------------\n\nAs currently implemented by MariaDB and by the SQL Standard, data may be\ntruncated if not correctly cast. It is necessary to CAST the column to the\ncorrect width if the CTE\'s recursive part produces wider values for a column\nthan the CTE\'s nonrecursive part. Some other DBMS give an error in this\nsituation, and MariaDB\'s behavior may change in future - see MDEV-12325. See\nthe examples below.\n\nExamples\n--------\n\nTransitive closure - determining bus destinations\n-------------------------------------------------\n\nSample data:\n\nCREATE TABLE bus_routes (origin varchar(50), dst varchar(50));\nINSERT INTO bus_routes VALUES \n (\'New York\', \'Boston\'),\n (\'Boston\', \'New York\'),\n (\'New York\', \'Washington\'),\n (\'Washington\', \'Boston\'),\n (\'Washington\', \'Raleigh\');\n\nNow, we want to return the bus destinations with New York as the origin:\n\nWITH RECURSIVE bus_dst as ( \n SELECT origin as dst FROM bus_routes WHERE origin=\'New York\'\n UNION\n SELECT bus_routes.dst FROM bus_routes JOIN bus_dst ON bus_dst.dst=\nbus_routes.origin \n) \nSELECT * FROM bus_dst;\n+------------+\n| dst |\n+------------+\n| New York |\n| Boston |\n| Washington |\n| Raleigh |\n+------------+\n\nThe above example is computed as follows:\n\nFirst, the anchor data is calculated:\n\n* Starting from New York\n* Boston and Washington are added\n\nNext, the recursive part:\n\n* Starting from Boston and then Washington\n* Raleigh is added\n* UNION excludes nodes that are already present.\n\nComputing paths - determining bus routes\n----------------------------------------\n\nThis time, we are trying to get bus routes such as \"New York -> Washington ->\nRaleigh\".\n\nUsing the same sample data as the previous example:\n\nWITH RECURSIVE paths (cur_path, cur_dest) AS (\n SELECT origin, origin FROM bus_routes WHERE origin=\'New York\'\n UNION\n SELECT CONCAT(paths.cur_path, \',\', bus_routes.dst), bus_routes.dst\n FROM paths\n JOIN bus_routes\n ON paths.cur_dest = bus_routes.origin AND\n NOT FIND_IN_SET(bus_routes.dst, paths.cur_path)\n) \nSELECT * FROM paths;\n+-----------------------------+------------+\n| cur_path | cur_dest |\n+-----------------------------+------------+\n| New York | New York |\n| New York,Boston | Boston |\n| New York,Washington | Washington |\n| New York,Washington,Boston | Boston |\n| New York,Washington,Raleigh | Raleigh |\n+-----------------------------+------------+\n\nCAST to avoid data truncation\n-----------------------------\n\nIn the following example, data is truncated because the results are not\nspecifically cast to a wide enough type:\n\nWITH RECURSIVE tbl AS (\n SELECT NULL AS col\n UNION\n SELECT \"THIS NEVER SHOWS UP\" AS col FROM tbl\n)\nSELECT col FROM tbl\n+------+\n| col |\n+------+\n| NULL |\n| |\n+------+\n\nExplicitly use CAST to overcome this:\n\nWITH RECURSIVE tbl AS (\n SELECT CAST(NULL AS CHAR(50)) AS col\n UNION SELECT \"THIS NEVER SHOWS UP\" AS col FROM tbl\n) \nSELECT * FROM tbl;\n+---------------------+\n| col |\n+---------------------+\n| NULL |\n| THIS NEVER SHOWS UP |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/recursive-common-table-expressions-overview/','','https://mariadb.com/kb/en/recursive-common-table-expressions-overview/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (438,27,'SELECT WITH ROLLUP','Syntax\n------\n\nSee SELECT for the full syntax.\n\nDescription\n-----------\n\nThe WITH ROLLUP modifier adds extra rows to the resultset that represent\nsuper-aggregate summaries. The super-aggregated column is represented by a\nNULL value. Multiple aggregates over different columns will be added if there\nare multiple GROUP BY columns.\n\nThe LIMIT clause can be used at the same time, and is applied after the WITH\nROLLUP rows have been added.\n\nWITH ROLLUP cannot be used with ORDER BY. Some sorting is still possible by\nusing ASC or DESC clauses with the GROUP BY column, although the\nsuper-aggregate rows will always be added last.\n\nExamples\n--------\n\nThese examples use the following sample table\n\nCREATE TABLE booksales ( \n country VARCHAR(35), genre ENUM(\'fiction\',\'non-fiction\'), year YEAR, sales\nINT);\n\nINSERT INTO booksales VALUES\n (\'Senegal\',\'fiction\',2014,12234), (\'Senegal\',\'fiction\',2015,15647),\n (\'Senegal\',\'non-fiction\',2014,64980), (\'Senegal\',\'non-fiction\',2015,78901),\n (\'Paraguay\',\'fiction\',2014,87970), (\'Paraguay\',\'fiction\',2015,76940),\n (\'Paraguay\',\'non-fiction\',2014,8760), (\'Paraguay\',\'non-fiction\',2015,9030);\n\nThe addition of the WITH ROLLUP modifier in this example adds an extra row\nthat aggregates both years:\n\nSELECT year, SUM(sales) FROM booksales GROUP BY year;\n+------+------------+\n| year | SUM(sales) |\n+------+------------+\n| 2014 | 173944 |\n| 2015 | 180518 |\n+------+------------+\n2 rows in set (0.08 sec)\n\nSELECT year, SUM(sales) FROM booksales GROUP BY year WITH ROLLUP;\n+------+------------+\n| year | SUM(sales) |\n+------+------------+\n| 2014 | 173944 |\n| 2015 | 180518 |\n| NULL | 354462 |\n+------+------------+\n\nIn the following example, each time the genre, the year or the country change,\nanother super-aggregate row is added:\n\nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year, genre;\n+----------+------+-------------+------------+\n| country | year | genre | SUM(sales) |\n+----------+------+-------------+------------+\n| Paraguay | 2014 | fiction | 87970 |\n| Paraguay | 2014 | non-fiction | 8760 |\n| Paraguay | 2015 | fiction | 76940 |\n| Paraguay | 2015 | non-fiction | 9030 |\n| Senegal | 2014 | fiction | 12234 |\n| Senegal | 2014 | non-fiction | 64980 |\n| Senegal | 2015 | fiction | 15647 |\n| Senegal | 2015 | non-fiction | 78901 |\n+----------+------+-------------+------------+\n\nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year, genre WITH ROLLUP;\n+----------+------+-------------+------------+\n| country | year | genre | SUM(sales) |\n+----------+------+-------------+------------+\n| Paraguay | 2014 | fiction | 87970 |\n| Paraguay | 2014 | non-fiction | 8760 |\n| Paraguay | 2014 | NULL | 96730 |\n| Paraguay | 2015 | fiction | 76940 |\n| Paraguay | 2015 | non-fiction | 9030 |\n| Paraguay | 2015 | NULL | 85970 |\n| Paraguay | NULL | NULL | 182700 |\n| Senegal | 2014 | fiction | 12234 |\n| Senegal | 2014 | non-fiction | 64980 |\n| Senegal | 2014 | NULL | 77214 |\n| Senegal | 2015 | fiction | 15647 |\n| Senegal | 2015 | non-fiction | 78901 |\n| Senegal | 2015 | NULL | 94548 |\n| Senegal | NULL | NULL | 171762 |\n| NULL | NULL | NULL | 354462 |\n+----------+------+-------------+------------+\n\nThe LIMIT clause, applied after WITH ROLLUP:\n\nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year, genre WITH ROLLUP LIMIT 4;\n+----------+------+-------------+------------+\n| country | year | genre | SUM(sales) |\n+----------+------+-------------+------------+\n| Paraguay | 2014 | fiction | 87970 |\n| Paraguay | 2014 | non-fiction | 8760 |\n| Paraguay | 2014 | NULL | 96730 |\n| Paraguay | 2015 | fiction | 76940 |\n+----------+------+-------------+------------+\n\nSorting by year descending:\n\nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year DESC, genre WITH ROLLUP;\n+----------+------+-------------+------------+\n| country | year | genre | SUM(sales) |\n+----------+------+-------------+------------+\n| Paraguay | 2015 | fiction | 76940 |\n| Paraguay | 2015 | non-fiction | 9030 |\n| Paraguay | 2015 | NULL | 85970 |\n| Paraguay | 2014 | fiction | 87970 |\n| Paraguay | 2014 | non-fiction | 8760 |\n| Paraguay | 2014 | NULL | 96730 |\n| Paraguay | NULL | NULL | 182700 |\n| Senegal | 2015 | fiction | 15647 |\n| Senegal | 2015 | non-fiction | 78901 |\n| Senegal | 2015 | NULL | 94548 |\n| Senegal | 2014 | fiction | 12234 |\n| Senegal | 2014 | non-fiction | 64980 |\n| Senegal | 2014 | NULL | 77214 |\n| Senegal | NULL | NULL | 171762 |\n| NULL | NULL | NULL | 354462 |\n+----------+------+-------------+------------+\n\nURL: https://mariadb.com/kb/en/select-with-rollup/','','https://mariadb.com/kb/en/select-with-rollup/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (439,27,'SELECT INTO OUTFILE','Syntax\n------\n\nSELECT ... INTO OUTFILE \'file_name\'\n [CHARACTER SET charset_name]\n [export_options]\n\nexport_options:\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n\nDescription\n-----------\n\nSELECT INTO OUTFILE writes the resulting rows to a file, and allows the use of\ncolumn and row terminators to specify a particular output format. The default\nis to terminate fields with tabs (\\t) and lines with newlines (\\n).\n\nThe file must not exist. It cannot be overwritten. A user needs the FILE\nprivilege to run this statement. Also, MariaDB needs permission to write files\nin the specified location. If the secure_file_priv system variable is set to a\nnon-empty directory name, the file can only be written to that directory.\n\nThe LOAD DATA INFILE statement complements SELECT INTO OUTFILE.\n\nCharacter-sets\n--------------\n\nThe CHARACTER SET clause specifies the character set in which the results are\nto be written. Without the clause, no conversion takes place (the binary\ncharacter set). In this case, if there are multiple character sets, the output\nwill contain these too, and may not easily be able to be reloaded.\n\nIn cases where you have two servers using different character-sets, using\nSELECT INTO OUTFILE to transfer data from one to the other can have unexpected\nresults. To ensure that MariaDB correctly interprets the escape sequences, use\nthe CHARACTER SET clause on both the SELECT INTO OUTFILE statement and the\nsubsequent LOAD DATA INFILE statement.\n\nExample\n-------\n\nThe following example produces a file in the CSV format:\n\nSELECT customer_id, firstname, surname from customer\n INTO OUTFILE \'/exportdata/customers.txt\'\n FIELDS TERMINATED BY \',\' OPTIONALLY ENCLOSED BY \'\"\'\n LINES TERMINATED BY \'\\n\';\n\nThe following ANSI syntax is also supported for simple SELECT without UNION\n\nSELECT customer_id, firstname, surname INTO OUTFILE \'/exportdata/customers.txt\'\n FIELDS TERMINATED BY \',\' OPTIONALLY ENCLOSED BY \'\"\'\n LINES TERMINATED BY \'\\n\'\n FROM customers;\n\nIf you want to use the ANSI syntax with UNION or similar construct you have to\nuse the syntax:\n\nSELECT * INTO OUTFILE \"/tmp/skr3\" FROM (SELECT * FROM t1 UNION SELECT * FROM\nt1);\n\nURL: https://mariadb.com/kb/en/select-into-outfile/','','https://mariadb.com/kb/en/select-into-outfile/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (440,27,'SELECT INTO DUMPFILE','Syntax\n------\n\nSELECT ... INTO DUMPFILE \'file_path\'\n\nDescription\n-----------\n\nSELECT ... INTO DUMPFILE is a SELECT clause which writes the resultset into a\nsingle unformatted row, without any separators, in a file. The results will\nnot be returned to the client.\n\nfile_path can be an absolute path, or a relative path starting from the data\ndirectory. It can only be specified as a string literal, not as a variable.\nHowever, the statement can be dynamically composed and executed as a prepared\nstatement to work around this limitation.\n\nThis statement is binary-safe and so is particularly useful for writing BLOB\nvalues to file. It can be used, for example, to copy an image or an audio\ndocument from the database to a file. SELECT ... INTO FILE can be used to save\na text file.\n\nThe file must not exist. It cannot be overwritten. A user needs the FILE\nprivilege to run this statement. Also, MariaDB needs permission to write files\nin the specified location. If the secure_file_priv system variable is set to a\nnon-empty directory name, the file can only be written to that directory.\n\nSince MariaDB 5.1, the character_set_filesystem system variable has controlled\ninterpretation of file names that are given as literal strings.\n\nExample\n-------\n\nSELECT _utf8\'Hello world!\' INTO DUMPFILE \'/tmp/world\';\n\nSELECT LOAD_FILE(\'/tmp/world\') AS world;\n+--------------+\n| world |\n+--------------+\n| Hello world! |\n+--------------+\n\nURL: https://mariadb.com/kb/en/select-into-dumpfile/','','https://mariadb.com/kb/en/select-into-dumpfile/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (441,27,'FOR UPDATE','InnoDB supports row-level locking. Selected rows can be locked using LOCK IN\nSHARE MODE or FOR UPDATE. In both cases, a lock is acquired on the rows read\nby the query, and it will be released when the current transaction is\ncommitted.\n\nThe FOR UPDATE clause of SELECT applies only when autocommit is set to 0 or\nthe SELECT is enclosed in a transaction. A lock is acquired on the rows, and\nother transactions are prevented from writing the rows, acquire locks, and\nfrom reading them (unless their isolation level is READ UNCOMMITTED).\n\nIf autocommit is set to 1, the LOCK IN SHARE MODE and FOR UPDATE clauses have\nno effect.\n\nIf the isolation level is set to SERIALIZABLE, all plain SELECT statements are\nconverted to SELECT ... LOCK IN SHARE MODE.\n\nExample\n-------\n\nSELECT * FROM trans WHERE period=2001 FOR UPDATE;\n\nURL: https://mariadb.com/kb/en/for-update/','','https://mariadb.com/kb/en/for-update/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (442,27,'LOCK IN SHARE MODE','InnoDB supports row-level locking. Selected rows can be locked using LOCK IN\nSHARE MODE or FOR UPDATE. In both cases, a lock is acquired on the rows read\nby the query, and it will be released when the current transaction is\ncommitted.\n\nWhen LOCK IN SHARE MODE is specified in a SELECT statement, MariaDB will wait\nuntil all transactions that have modified the rows are committed. Then, a\nwrite lock is acquired. All transactions can read the rows, but if they want\nto modify them, they have to wait until your transaction is committed.\n\nIf autocommit is set to 1, the LOCK IN SHARE MODE and FOR UPDATE clauses have\nno effect.\n\nURL: https://mariadb.com/kb/en/lock-in-share-mode/','','https://mariadb.com/kb/en/lock-in-share-mode/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (443,27,'Optimizer Hints','Optimizer hints\n---------------\n\nThere are some options available in SELECT to affect the execution plan. These\nare known as optimizer hints.\n\nHIGH PRIORITY\n-------------\n\nHIGH_PRIORITY gives the statement a higher priority. If the table is locked,\nhigh priority SELECTs will be executed as soon as the lock is released, even\nif other statements are queued. HIGH_PRIORITY applies only if the storage\nengine only supports table-level locking (MyISAM, MEMORY, MERGE). See\nHIGH_PRIORITY and LOW_PRIORITY clauses for details.\n\nSQL_CACHE / SQL_NO_CACHE\n------------------------\n\nIf the query_cache_type system variable is set to 2 or DEMAND, and the current\nstatement is cacheable, SQL_CACHE causes the query to be cached and\nSQL_NO_CACHE causes the query not to be cached. For UNIONs, SQL_CACHE or\nSQL_NO_CACHE should be specified for the first query. See also The Query Cache\nfor more detail and a list of the types of statements that aren\'t cacheable.\n\nSQL_BUFFER_RESULT\n-----------------\n\nSQL_BUFFER_RESULT forces the optimizer to use a temporary table to process the\nresult. This is useful to free locks as soon as possible.\n\nSQL_SMALL_RESULT / SQL_BIG_RESULT\n---------------------------------\n\nSQL_SMALL_RESULT and SQL_BIG_RESULT tell the optimizer whether the result is\nvery big or not. Usually, GROUP BY and DISTINCT operations are performed using\na temporary table. Only if the result is very big, using a temporary table is\nnot convenient. The optimizer automatically knows if the result is too big,\nbut you can force the optimizer to use a temporary table with\nSQL_SMALL_RESULT, or avoid the temporary table using SQL_BIG_RESULT.\n\nSTRAIGHT_JOIN\n-------------\n\nSTRAIGHT_JOIN applies to the JOIN queries, and tells the optimizer that the\ntables must be read in the order they appear in the SELECT. For const and\nsystem table this options is sometimes ignored.\n\nSQL_CALC_FOUND_ROWS\n-------------------\n\nSQL_CALC_FOUND_ROWS is only applied when using the LIMIT clause. If this\noption is used, MariaDB will count how many rows would match the query,\nwithout the LIMIT clause. That number can be retrieved in the next query,\nusing FOUND_ROWS().\n\nUSE/FORCE/IGNORE INDEX\n----------------------\n\nUSE INDEX, FORCE INDEX and IGNORE INDEX constrain the query planning to a\nspecific index.\n\nFor further information about some of these options, see How to force query\nplans.\n\nURL: https://mariadb.com/kb/en/optimizer-hints/','','https://mariadb.com/kb/en/optimizer-hints/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (444,27,'PROCEDURE','The PROCEDURE clause of SELECT passes the whole result set to a Procedure\nwhich will process it. These Procedures are not Stored Procedures, and can\nonly be written in the C language, so it is necessary to recompile the server.\n\nCurrently, the only available procedure is ANALYSE, which examines the\nresultset and suggests the optimal datatypes for each column. It is defined in\nthe sql/sql_analyse.cc file, and can be used as an example to create more\nProcedures.\n\nThis clause cannot be used in a view\'s definition.\n\nURL: https://mariadb.com/kb/en/procedure/','','https://mariadb.com/kb/en/procedure/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (445,27,'DUAL','Description\n-----------\n\nYou are allowed to specify DUAL as a dummy table name in situations where no\ntables are referenced, such as the following SELECT statement:\n\nSELECT 1 + 1 FROM DUAL;\n+-------+\n| 1 + 1 |\n+-------+\n| 2 |\n+-------+\n\nDUAL is purely for the convenience of people who require that all SELECT\nstatements should have FROM and possibly other clauses. MariaDB ignores the\nclauses. MariaDB does not require FROM DUAL if no tables are referenced.\n\nFROM DUAL could be used when you only SELECT computed values, but require a\nWHERE clause, perhaps to test that a script correctly handles empty resultsets:\n\nSELECT 1 FROM DUAL WHERE FALSE;\nEmpty set (0.00 sec)\n\nURL: https://mariadb.com/kb/en/dual/','','https://mariadb.com/kb/en/dual/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (446,27,'SELECT ... OFFSET ... FETCH','MariaDB starting with 10.6.0\n----------------------------\nSELECT ... OFFSET ... FETCH was introduced in MariaDB 10.6.\n\nSyntax\n------\n\nOFFSET start { ROW | ROWS }\nFETCH { FIRST | NEXT } [ count ] { ROW | ROWS } { ONLY | WITH TIES }\n\nDescription\n-----------\n\nThe OFFSET clause allows one to return only those elements of a resultset that\ncome after a specified offset. The FETCH clause specifies the number of rows\nto return, while ONLY or WITH TIES specifies whether or not to also return any\nfurther results that tie for last place according to the ordered resultset.\n\nEither the singular ROW or the plural ROWS can be used after the OFFSET and\nFETCH clauses; the choice has no impact on the results.\n\nIn the case of WITH TIES, an ORDER BY clause is required, otherwise an ERROR\nwill be returned.\n\nSELECT i FROM t1 FETCH FIRST 2 ROWS WITH TIES;\nERROR 4180 (HY000): FETCH ... WITH TIES requires ORDER BY clause to be present\n\nExamples\n--------\n\nGiven a table with 6 rows:\n\nCREATE OR REPLACE TABLE t1 (i INT);\nINSERT INTO t1 VALUES (1),(2),(3),(4), (4), (5);\nSELECT i FROM t1 ORDER BY i ASC;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 4 |\n| 5 |\n+------+\n\nOFFSET 2 allows one to skip the first two results.\n\nSELECT i FROM t1 ORDER BY i ASC OFFSET 2 ROWS;\n+------+\n| i |\n+------+\n| 3 |\n| 4 |\n| 4 |\n| 5 |\n+------+\n\nFETCH FIRST 3 ROWS ONLY limits the results to three rows only\n\nSELECT i FROM t1 ORDER BY i ASC OFFSET 1 ROWS FETCH FIRST 3 ROWS ONLY;\n+------+\n| i |\n+------+\n| 2 |\n| 3 |\n| 4 |\n+------+\n\nThe same outcome can also be achieved with the LIMIT clause:\n\nSELECT i FROM t1 ORDER BY i ASC LIMIT 3 OFFSET 1;\n+------+\n| i |\n+------+\n| 2 |\n| 3 |\n| 4 |\n+------+\n\nWITH TIES ensures the tied result 4 is also returned.\n\nSELECT i FROM t1 ORDER BY i ASC OFFSET 1 ROWS FETCH FIRST 3 ROWS WITH TIES;\n+------+\n| i |\n+------+\n| 2 |\n| 3 |\n| 4 |\n| 4 |\n+------+\n\nURL: https://mariadb.com/kb/en/select-offset-fetch/','','https://mariadb.com/kb/en/select-offset-fetch/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (447,27,'INSERT','Syntax\n------\n\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ] [RETURNING select_expr\n [, select_expr ...]]\n\nOr:\n\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ] [RETURNING select_expr\n [, select_expr ...]]\n\nOr:\n\nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ] [RETURNING select_expr\n [, select_expr ...]]\n\nThe INSERT statement is used to insert new rows into an existing table. The\nINSERT ... VALUES and INSERT ... SET forms of the statement insert rows based\non explicitly specified values. The INSERT ... SELECT form inserts rows\nselected from another table or tables. INSERT ... SELECT is discussed further\nin the INSERT ... SELECT article.\n\nThe table name can be specified in the form db_name.tbl_name or, if a default\ndatabase is selected, in the form tbl_name (see Identifier Qualifiers). This\nallows to use INSERT ... SELECT to copy rows between different databases.\n\nThe PARTITION clause can be used in both the INSERT and the SELECT part. See\nPartition Pruning and Selection for details.\n\nMariaDB starting with 10.5\n--------------------------\nThe RETURNING clause was introduced in MariaDB 10.5.\n\nThe columns list is optional. It specifies which values are explicitly\ninserted, and in which order. If this clause is not specified, all values must\nbe explicitly specified, in the same order they are listed in the table\ndefinition.\n\nThe list of value follow the VALUES or VALUE keyword (which are\ninterchangeable, regardless how much values you want to insert), and is\nwrapped by parenthesis. The values must be listed in the same order as the\ncolumns list. It is possible to specify more than one list to insert more than\none rows with a single statement. If many rows are inserted, this is a speed\noptimization.\n\nFor one-row statements, the SET clause may be more simple, because you don\'t\nneed to remember the columns order. All values are specified in the form col =\nexpr.\n\nValues can also be specified in the form of a SQL expression or subquery.\nHowever, the subquery cannot access the same table that is named in the INTO\nclause.\n\nIf you use the LOW_PRIORITY keyword, execution of the INSERT is delayed until\nno other clients are reading from the table. If you use the HIGH_PRIORITY\nkeyword, the statement has the same priority as SELECTs. This affects only\nstorage engines that use only table-level locking (MyISAM, MEMORY, MERGE).\nHowever, if one of these keywords is specified, concurrent inserts cannot be\nused. See HIGH_PRIORITY and LOW_PRIORITY clauses for details.\n\nINSERT DELAYED\n--------------\n\nFor more details on the DELAYED option, see INSERT DELAYED.\n\nHIGH PRIORITY and LOW PRIORITY\n------------------------------\n\nSee HIGH_PRIORITY and LOW_PRIORITY.\n\nDefaults and Duplicate Values\n-----------------------------\n\nSee INSERT - Default & Duplicate Values for details..\n\nINSERT IGNORE\n-------------\n\nSee INSERT IGNORE.\n\nINSERT ON DUPLICATE KEY UPDATE\n------------------------------\n\nSee INSERT ON DUPLICATE KEY UPDATE.\n\nExamples\n--------\n\nSpecifying the column names:\n\nINSERT INTO person (first_name, last_name) VALUES (\'John\', \'Doe\');\n\nInserting more than 1 row at a time:\n\nINSERT INTO tbl_name VALUES (1, \"row 1\"), (2, \"row 2\");\n\nUsing the SET clause:\n\nINSERT INTO person SET first_name = \'John\', last_name = \'Doe\';\n\nSELECTing from another table:\n\nINSERT INTO contractor SELECT * FROM person WHERE status = \'c\';\n\nSee INSERT ON DUPLICATE KEY UPDATE and INSERT IGNORE for further examples.\n\nINSERT ... RETURNING\n--------------------\n\nINSERT ... RETURNING returns a resultset of the inserted rows.\n\nThis returns the listed columns for all the rows that are inserted, or\nalternatively, the specified SELECT expression. Any SQL expressions which can\nbe calculated can be used in the select expression for the RETURNING clause,\nincluding virtual columns and aliases, expressions which use various operators\nsuch as bitwise, logical and arithmetic operators, string functions, date-time\nfunctions, numeric functions, control flow functions, secondary functions and\nstored functions. Along with this, statements which have subqueries and\nprepared statements can also be used.\n\nExamples\n--------\n\nSimple INSERT statement\n\nINSERT INTO t2 VALUES (1,\'Dog\'),(2,\'Lion\'),(3,\'Tiger\'),(4,\'Leopard\') \nRETURNING id2,id2+id2,id2&id2,id2||id2;\n+-----+---------+---------+----------+\n| id2 | id2+id2 | id2&id2 | id2||id2 |\n+-----+---------+---------+----------+\n| 1 | 2 | 1 | 1 |\n| 2 | 4 | 2 | 1 |\n| 3 | 6 | 3 | 1 |\n| 4 | 8 | 4 | 1 |\n+-----+---------+---------+----------+\n\nUsing stored functions in RETURNING\n\nDELIMITER |\nCREATE FUNCTION f(arg INT) RETURNS INT\n BEGIN\n RETURN (SELECT arg+arg);\n END|\n\nDELIMITER ;\n\nPREPARE stmt FROM \"INSERT INTO t1 SET id1=1, animal1=\'Bear\' RETURNING f(id1),\nUPPER(animal1)\";\n\nEXECUTE stmt;\n+---------+----------------+\n| f(id1) | UPPER(animal1) |\n+---------+----------------+\n| 2 | BEAR |\n+---------+----------------+\n\nSubqueries in the RETURNING clause that return more than one row or column\ncannot be used.\n\nAggregate functions cannot be used in the RETURNING clause. Since aggregate\nfunctions work on a set of values, and if the purpose is to get the row count,\nROW_COUNT() with SELECT can be used or it can be used in\nINSERT...SELECT...RETURNING if the table in the RETURNING clause is not the\nsame as the INSERT table.\n\nURL: https://mariadb.com/kb/en/insert/','','https://mariadb.com/kb/en/insert/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (448,27,'INSERT DELAYED','Syntax\n------\n\nINSERT DELAYED ...\n\nDescription\n-----------\n\nThe DELAYED option for the INSERT statement is a MariaDB/MySQL extension to\nstandard SQL that is very useful if you have clients that cannot or need not\nwait for the INSERT to complete. This is a common situation when you use\nMariaDB for logging and you also periodically run SELECT and UPDATE statements\nthat take a long time to complete.\n\nWhen a client uses INSERT DELAYED, it gets an okay from the server at once,\nand the row is queued to be inserted when the table is not in use by any other\nthread.\n\nAnother major benefit of using INSERT DELAYED is that inserts from many\nclients are bundled together and written in one block. This is much faster\nthan performing many separate inserts.\n\nNote that INSERT DELAYED is slower than a normal INSERT if the table is not\notherwise in use. There is also the additional overhead for the server to\nhandle a separate thread for each table for which there are delayed rows. This\nmeans that you should use INSERT DELAYED only when you are really sure that\nyou need it.\n\nThe queued rows are held only in memory until they are inserted into the\ntable. This means that if you terminate mysqld forcibly (for example, with\nkill -9) or if mysqld dies unexpectedly, any queued rows that have not been\nwritten to disk are lost.\n\nThe number of concurrent INSERT DELAYED threads is limited by the\nmax_delayed_threads server system variables. If it is set to 0, INSERT DELAYED\nis disabled. The session value can be equal to the global value, or 0 to\ndisable this statement for the current session. If this limit has been\nreached, the DELAYED clause will be silently ignore for subsequent statements\n(no error will be produced).\n\nLimitations\n-----------\n\nThere are some limitations on the use of DELAYED:\n\n* INSERT DELAYED works only with MyISAM, MEMORY, ARCHIVE,\n and BLACKHOLE tables. If you execute INSERT DELAYED with another storage\nengine, you will get an error like this: ERROR 1616 (HY000): DELAYED option\nnot supported for table \'tab_name\'\n* For MyISAM tables, if there are no free blocks in the middle of the data\n file, concurrent SELECT and INSERT statements are supported. Under these\n circumstances, you very seldom need to use INSERT DELAYED\n with MyISAM.\n* INSERT DELAYED should be used only for\n INSERT statements that specify value lists. The server\n ignores DELAYED for INSERT ... SELECT\n or INSERT ... ON DUPLICATE KEY UPDATE statements.\n* Because the INSERT DELAYED statement returns immediately,\n before the rows are inserted, you cannot use\n LAST_INSERT_ID() to get the\n AUTO_INCREMENT value that the statement might generate.\n* DELAYED rows are not visible to SELECT\n statements until they actually have been inserted.\n* After INSERT DELAYED, ROW_COUNT() returns the number of the rows you tried\nto insert, not the number of the successful writes.\n* DELAYED is ignored on slave replication servers, so that \n INSERT DELAYED is treated as a normal\n INSERT on slaves. This is because\n DELAYED could cause the slave to have different data than\n the master. INSERT DELAYED statements are not safe for replication.\n* Pending INSERT DELAYED statements are lost if a table is\n write locked and ALTER TABLE is used to modify the table structure.\n* INSERT DELAYED is not supported for views. If you try, you will get an error\nlike this: ERROR 1347 (HY000): \'view_name\' is not BASE TABLE\n* INSERT DELAYED is not supported for partitioned tables.\n* INSERT DELAYED is not supported within stored programs.\n* INSERT DELAYED does not work with triggers.\n* INSERT DELAYED does not work if there is a check constraint in place.\n* INSERT DELAYED does not work if skip-new mode is active.\n\nURL: https://mariadb.com/kb/en/insert-delayed/','','https://mariadb.com/kb/en/insert-delayed/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (449,27,'INSERT SELECT','Syntax\n------\n\nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]\n\nDescription\n-----------\n\nWith INSERT ... SELECT, you can quickly insert many rows into a table from one\nor more other tables. For example:\n\nINSERT INTO tbl_temp2 (fld_id)\n SELECT tbl_temp1.fld_order_id\n FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;\n\ntbl_name can also be specified in the form db_name.tbl_name (see Identifier\nQualifiers). This allows to copy rows between different databases.\n\nIf the new table has a primary key or UNIQUE indexes, you can use IGNORE to\nhandle duplicate key errors during the query. The newer values will not be\ninserted if an identical value already exists.\n\nREPLACE can be used instead of INSERT to prevent duplicates on UNIQUE indexes\nby deleting old values. In that case, ON DUPLICATE KEY UPDATE cannot be used.\n\nINSERT ... SELECT works for tables which already exist. To create a table for\na given resultset, you can use CREATE TABLE ... SELECT.\n\nURL: https://mariadb.com/kb/en/insert-select/','','https://mariadb.com/kb/en/insert-select/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (450,27,'LOAD DATA INFILE','Syntax\n------\n\nLOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE tbl_name\n [CHARACTER SET charset_name]\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n [IGNORE number LINES]\n [(col_name_or_user_var,...)]\n [SET col_name = expr,...]\n\nDescription\n-----------\n\nLOAD DATA INFILE is unsafe for statement-based replication.\n\nReads rows from a text file into the designated table on the database at a\nvery high speed. The file name must be given as a literal string.\n\nFiles are written to disk using the SELECT INTO OUTFILE statement. You can\nthen read the files back into a table using the LOAD DATA INFILE statement.\nThe FIELDS and LINES clauses are the same in both statements. These clauses\nare optional, but if both are specified then the FIELDS clause must precede\nLINES.\n\nExecuting this statement activates INSERT triggers.\n\nOne must have the FILE privilege to be able to execute LOAD DATA INFILE. This\nis to ensure normal users cannot read system files. LOAD DATA LOCAL INFILE\ndoes not have this requirement.\n\nIf the secure_file_priv system variable is set (by default it is not), the\nloaded file must be present in the specified directory.\n\nNote that MariaDB\'s systemd unit file restricts access to /home, /root, and\n/run/user by default. See Configuring access to home directories.\n\nLOAD DATA LOCAL INFILE\n----------------------\n\nWhen you execute the LOAD DATA INFILE statement, MariaDB Server attempts to\nread the input file from its own file system. By contrast, when you execute\nthe LOAD DATA LOCAL INFILE statement, the client attempts to read the input\nfile from its file system, and it sends the contents of the input file to the\nMariaDB Server. This allows you to load files from the client\'s local file\nsystem into the database.\n\nIf you don\'t want to permit this operation (perhaps for security reasons), you\ncan disable the LOAD DATA LOCAL INFILE statement on either the server or the\nclient.\n\n* The LOAD DATA LOCAL INFILE statement can be disabled on the server by\nsetting the local_infile system variable to 0.\n* The LOAD DATA LOCAL INFILE statement can be disabled on the client. If you\nare using MariaDB Connector/C, this can be done by unsetting the\nCLIENT_LOCAL_FILES capability flag with the mysql_real_connect function or by\nunsetting the MYSQL_OPT_LOCAL_INFILE option with mysql_optionsv function. If\nyou are using a different client or client library, then see the documentation\nfor your specific client or client library to determine how it handles the\nLOAD DATA LOCAL INFILE statement.\n\nIf the LOAD DATA LOCAL INFILE statement is disabled by either the server or\nthe client and if the user attempts to execute it, then the server will cause\nthe statement to fail with the following error message:\n\nThe used command is not allowed with this MariaDB version\n\nNote that it is not entirely accurate to say that the MariaDB version does not\nsupport the command. It would be more accurate to say that the MariaDB\nconfiguration does not support the command. See MDEV-20500 for more\ninformation.\n\nFrom MariaDB 10.5.2, the error message is more accurate:\n\nThe used command is not allowed because the MariaDB server or client \n has disabled the local infile capability\n\nREPLACE and IGNORE\n------------------\n\nIf you load data from a file into a table that already contains data and has a\nprimary key, you may encounter issues where the statement attempts to insert a\nrow with a primary key that already exists. When this happens, the statement\nfails with Error 1064, protecting the data already on the table. If you want\nMariaDB to overwrite duplicates, use the REPLACE keyword.\n\nThe REPLACE keyword works like the REPLACE statement. Here, the statement\nattempts to load the data from the file. If the row does not exist, it adds it\nto the table. If the row contains an existing primary key, it replaces the\ntable data. That is, in the event of a conflict, it assumes the file contains\nthe desired row.\n\nThis operation can cause a degradation in load speed by a factor of 20 or more\nif the part that has already been loaded is larger than the capacity of the\nInnoDB Buffer Pool. This happens because it causes a lot of turnaround in the\nbuffer pool.\n\nUse the IGNORE keyword when you want to skip any rows that contain a\nconflicting primary key. Here, the statement attempts to load the data from\nthe file. If the row does not exist, it adds it to the table. If the row\ncontains an existing primary key, it ignores the addition request and moves on\nto the next. That is, in the event of a conflict, it assumes the table\ncontains the desired row.\n\nCharacter-sets\n--------------\n\nWhen the statement opens the file, it attempts to read the contents using the\ndefault character-set, as defined by the character_set_database system\nvariable.\n\nIn the cases where the file was written using a character-set other than the\ndefault, you can specify the character-set to use with the CHARACTER SET\nclause in the statement. It ignores character-sets specified by the SET NAMES\nstatement and by the character_set_client system variable. Setting the\nCHARACTER SET clause to a value of binary indicates \"no conversion.\"\n\nThe statement interprets all fields in the file as having the same\ncharacter-set, regardless of the column data type. To properly interpret file\ncontents, you must ensure that it was written with the correct character-set.\nIf you write a data file with mysqldump -T or with the SELECT INTO OUTFILE\nstatement with the mysql client, be sure to use the --default-character-set\noption, so that the output is written with the desired character-set.\n\nWhen using mixed character sets, use the CHARACTER SET clause in both SELECT\nINTO OUTFILE and LOAD DATA INFILE to ensure that MariaDB correctly interprets\nthe escape sequences.\n\nThe character_set_filesystem system variable controls the interpretation of\nthe filename.\n\nIt is currently not possible to load data files that use the ucs2 character\nset.\n\nPreprocessing Inputs\n--------------------\n\ncol_name_or_user_var can be a column name, or a user variable. In the case of\na variable, the SET statement can be used to preprocess the value before\nloading into the table.\n\nPriority and Concurrency\n------------------------\n\nIn storage engines that perform table-level locking (MyISAM, MEMORY and\nMERGE), using the LOW_PRIORITY keyword, MariaDB delays insertions until no\nother clients are reading from the table. Alternatively, when using the MyISAM\nstorage engine, you can use the CONCURRENT keyword to perform concurrent\ninsertion.\n\nThe LOW_PRIORITY and CONCURRENT keywords are mutually exclusive. They cannot\nbe used in the same statement.\n\nProgress Reporting\n------------------\n\nThe LOAD DATA INFILE statement supports progress reporting. You may find this\nuseful when dealing with long-running operations. Using another client you can\nissue a SHOW PROCESSLIST query to check the progress of the data load.\n\nUsing mariadb-import/mysqlimport\n--------------------------------\n\nMariaDB ships with a separate utility for loading data from files:\nmariadb-import (or mysqlimport before MariaDB 10.5). It operates by sending\nLOAD DATA INFILE statements to the server.\n\nUsing mariadb-import/mysqlimport you can compress the file using the\n--compress option, to get better performance over slow networks, providing\nboth the client and server support the compressed protocol. Use the --local\noption to load from the local file system.\n\nIndexing\n--------\n\nIn cases where the storage engine supports ALTER TABLE... DISABLE KEYS\nstatements (MyISAM and Aria), the LOAD DATA INFILE statement automatically\ndisables indexes during the execution.\n\nExamples\n--------\n\nYou have a file with this content (note the the separator is \',\', not tab,\nwhich is the default):\n\n2,2\n3,3\n4,4\n5,5\n6,8\n\nCREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY (a));\nLOAD DATA LOCAL INFILE \n \'/tmp/loaddata7.dat\' INTO TABLE t1 FIELDS TERMINATED BY \',\' (a,b) SET c=a+b;\nSELECT * FROM t1;\n+------+------+------+\n| a | b | c |\n+------+------+------+\n| 2 | 2 | 4 |\n| 3 | 3 | 6 |\n| 4 | 4 | 8 |\n| 5 | 5 | 10 |\n| 6 | 8 | 14 |\n+------+------+------+\n\nAnother example, given the following data (the separator is a tab):\n\n1 a\n2 b\n\nThe value of the first column is doubled before loading:\n\nLOAD DATA INFILE \'ld.txt\' INTO TABLE ld (@i,v) SET i=@i*2;\n\nSELECT * FROM ld;\n+------+------+\n| i | v |\n+------+------+\n| 2 | a |\n| 4 | b |\n+------+------+\n\nURL: https://mariadb.com/kb/en/load-data-infile/','','https://mariadb.com/kb/en/load-data-infile/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (451,27,'LOAD XML','Syntax\n------\n\nLOAD XML [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE [db_name.]tbl_name\n [CHARACTER SET charset_name]\n [ROWS IDENTIFIED BY \'\']\n [IGNORE number {LINES | ROWS}]\n [(column_or_user_var,...)]\n [SET col_name = expr,...]\n\nDescription\n-----------\n\nThe LOAD XML statement reads data from an XML file into a table. The file_name\nmust be given as a literal string. The tagname in the optional ROWS IDENTIFIED\nBY clause must also be given as a literal string, and must be surrounded by\nangle brackets (< and >).\n\nLOAD XML acts as the complement of running the mysql client in XML output mode\n(that is, starting the client with the --xml option). To write data from a\ntable to an XML file, use a command such as the following one from the system\nshell:\n\nshell> mysql --xml -e \'SELECT * FROM mytable\' > file.xml\n\nTo read the file back into a table, use LOAD XML INFILE. By default, the \nelement is considered to be the equivalent of a database table row; this can\nbe changed using the ROWS IDENTIFIED BY clause.\n\nThis statement supports three different XML formats:\n\n* Column names as attributes and column values as attribute values:\n\n\n\n* Column names as tags and column values as the content of these tags:\n\n\n value1\n value2\n\n\n* Column names are the name attributes of tags, and values are\n the contents of these tags:\n\n\n value1\n value2\n\n\nThis is the format used by other tools, such as mysqldump.\n\nAll 3 formats can be used in the same XML file; the import routine\nautomatically detects the format for each row and interprets it correctly.\nTags are matched based on the tag or attribute name and the column name.\n\nThe following clauses work essentially the same way for LOAD XML as they do\nfor LOAD DATA:\n\n* LOW_PRIORITY or CONCURRENT\n* LOCAL\n* REPLACE or IGNORE\n* CHARACTER SET\n* (column_or_user_var,...)\n* SET\n\nSee LOAD DATA for more information about these clauses.\n\nThe IGNORE number LINES or IGNORE number ROWS clause causes the first number\nrows in the XML file to be skipped. It is analogous to the LOAD DATA\nstatement\'s IGNORE ... LINES clause.\n\nIf the LOW_PRIORITY keyword is used, insertions are delayed until no other\nclients are reading from the table. The CONCURRENT keyword allowes the use of\nconcurrent inserts. These clauses cannot be specified together.\n\nThis statement activates INSERT triggers.\n\nURL: https://mariadb.com/kb/en/load-xml/','','https://mariadb.com/kb/en/load-xml/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (452,27,'Concurrent Inserts','The MyISAM storage engine supports concurrent inserts. This feature allows\nSELECT statements to be executed during INSERT operations, reducing contention.\n\nWhether concurrent inserts can be used or not depends on the value of the\nconcurrent_insert server system variable:\n\n* NEVER (0) disables concurrent inserts.\n* AUTO (1) allows concurrent inserts only when the target table has no free\nblocks (no data in the middle of the table has been deleted after the last\nOPTIMIZE TABLE). This is the default.\n* ALWAYS (2) always enables concurrent inserts, in which case new rows are\nadded at the end of a table if the table is being used by another thread.\n\nIf the binary log is used, CREATE TABLE ... SELECT and INSERT ... SELECT\nstatements cannot use concurrent inserts. These statements acquire a read lock\non the table, so concurrent inserts will need to wait. This way the log can be\nsafely used to restore data.\n\nConcurrent inserts are not used by replicas with the row based replication\n(see binary log formats).\n\nIf an INSERT statement contain the HIGH_PRIORITY clause, concurrent inserts\ncannot be used. INSERT ... DELAYED is usually unneeded if concurrent inserts\nare enabled.\n\nLOAD DATA INFILE uses concurrent inserts if the CONCURRENT keyword is\nspecified and concurrent_insert is not NEVER. This makes the statement slower\n(even if no other sessions access the table) but reduces contention.\n\nLOCK TABLES allows non-conflicting concurrent inserts if a READ LOCAL lock is\nused. Concurrent inserts are not allowed if the LOCAL keyword is omitted.\n\nNotes\n-----\n\nThe decision to enable concurrent insert for a table is done when the table is\nopened. If you change the value of concurrent_insert it will only affect new\nopened tables. If you want it to work for also for tables in use or cached,\nyou should do FLUSH TABLES after setting the variable.\n\nURL: https://mariadb.com/kb/en/concurrent-inserts/','','https://mariadb.com/kb/en/concurrent-inserts/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (453,27,'HIGH_PRIORITY and LOW_PRIORITY','The InnoDB storage engine uses row-level locking to ensure data integrity.\nHowever some storage engines (such as MEMORY, MyISAM, Aria and MERGE) lock the\nwhole table to prevent conflicts. These storage engines use two separate\nqueues to remember pending statements; one is for SELECTs and the other one is\nfor write statements (INSERT, DELETE, UPDATE). By default, the latter has a\nhigher priority.\n\nTo give write operations a lower priority, the low_priority_updates server\nsystem variable can be set to ON. The option is available on both the global\nand session levels, and it can be set at startup or via the SET statement.\n\nWhen too many table locks have been set by write statements, some pending\nSELECTs are executed. The maximum number of write locks that can be acquired\nbefore this happens is determined by the max_write_lock_count server system\nvariable, which is dynamic.\n\nIf write statements have a higher priority (default), the priority of\nindividual write statements (INSERT, REPLACE, UPDATE, DELETE) can be changed\nvia the LOW_PRIORITY attribute, and the priority of a SELECT statement can be\nraised via the HIGH_PRIORITY attribute. Also, LOCK TABLES supports a\nLOW_PRIORITY attribute for WRITE locks.\n\nIf read statements have a higher priority, the priority of an INSERT can be\nchanged via the HIGH_PRIORITY attribute. However, the priority of other write\nstatements cannot be raised individually.\n\nThe use of LOW_PRIORITY or HIGH_PRIORITY for an INSERT prevents Concurrent\nInserts from being used.\n\nURL: https://mariadb.com/kb/en/high_priority-and-low_priority/','','https://mariadb.com/kb/en/high_priority-and-low_priority/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (454,27,'INSERT - Default & Duplicate Values','Default Values\n--------------\n\nIf the SQL_MODE contains STRICT_TRANS_TABLES and you are inserting into a\ntransactional table (like InnoDB), or if the SQL_MODE contains\nSTRICT_ALL_TABLES, all NOT NULL columns which do not have a DEFAULT value (and\nare not AUTO_INCREMENT) must be explicitly referenced in INSERT statements. If\nnot, an error like this is produced:\n\nERROR 1364 (HY000): Field \'col\' doesn\'t have a default value\n\nIn all other cases, if a NOT NULL column without a DEFAULT value is not\nreferenced, an empty value will be inserted (for example, 0 for INTEGER\ncolumns and \'\' for CHAR columns). See NULL Values in MariaDB:Inserting for\nexamples.\n\nIf a NOT NULL column having a DEFAULT value is not referenced, NULL will be\ninserted.\n\nIf a NULL column having a DEFAULT value is not referenced, its default value\nwill be inserted. It is also possible to explicitly assign the default value\nusing the DEFAULT keyword or the DEFAULT() function.\n\nIf the DEFAULT keyword is used but the column does not have a DEFAULT value,\nan error like this is produced:\n\nERROR 1364 (HY000): Field \'col\' doesn\'t have a default value\n\nDuplicate Values\n----------------\n\nBy default, if you try to insert a duplicate row and there is a UNIQUE index,\nINSERT stops and an error like this is produced:\n\nERROR 1062 (23000): Duplicate entry \'dup_value\' for key \'col\'\n\nTo handle duplicates you can use the IGNORE clause, INSERT ON DUPLICATE KEY\nUPDATE or the REPLACE statement. Note that the IGNORE and DELAYED options are\nignored when you use ON DUPLICATE KEY UPDATE.\n\nURL: https://mariadb.com/kb/en/insert-default-duplicate-values/','','https://mariadb.com/kb/en/insert-default-duplicate-values/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (455,27,'INSERT IGNORE','Ignoring Errors\n---------------\n\nNormally INSERT stops and rolls back when it encounters an error.\n\nBy using the IGNORE keyword all errors are converted to warnings, which will\nnot stop inserts of additional rows.\n\nThe IGNORE and DELAYED options are ignored when you use ON DUPLICATE KEY\nUPDATE.\n\nPrior to MySQL and MariaDB 5.5.28, no warnings were issued for duplicate key\nerrors when using IGNORE. You can get the old behavior if you set OLD_MODE to\nNO_DUP_KEY_WARNINGS_WITH_IGNORE.\n\nExamples\n--------\n\nCREATE TABLE t1 (x INT UNIQUE);\n\nINSERT INTO t1 VALUES(1),(2);\n\nINSERT INTO t1 VALUES(2),(3);\nERROR 1062 (23000): Duplicate entry \'2\' for key \'x\'\nSELECT * FROM t1;\n+------+\n| x |\n+------+\n| 1 |\n| 2 |\n+------+\n2 rows in set (0.00 sec)\n\nINSERT IGNORE INTO t1 VALUES(2),(3);\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n\nSHOW WARNINGS;\n+---------+------+---------------------------------+\n| Level | Code | Message |\n+---------+------+---------------------------------+\n| Warning | 1062 | Duplicate entry \'2\' for key \'x\' |\n+---------+------+---------------------------------+\n\nSELECT * FROM t1;\n+------+\n| x |\n+------+\n| 1 |\n| 2 |\n| 3 |\n+------+\n\nSee INSERT ON DUPLICATE KEY UPDATE for further examples using that syntax.\n\nURL: https://mariadb.com/kb/en/insert-ignore/','','https://mariadb.com/kb/en/insert-ignore/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (456,27,'INSERT ON DUPLICATE KEY UPDATE','Syntax\n------\n\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n\nOr:\n\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n\nOr:\n\nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ]\n\nDescription\n-----------\n\nINSERT ... ON DUPLICATE KEY UPDATE is a MariaDB/MySQL extension to the INSERT\nstatement that, if it finds a duplicate unique or primary key, will instead\nperform an UPDATE.\n\nThe row/s affected value is reported as 1 if a row is inserted, and 2 if a row\nis updated, unless the API\'s CLIENT_FOUND_ROWS flag is set.\n\nIf more than one unique index is matched, only the first is updated. It is not\nrecommended to use this statement on tables with more than one unique index.\n\nIf the table has an AUTO_INCREMENT primary key and the statement inserts or\nupdates a row, the LAST_INSERT_ID() function returns its AUTO_INCREMENT value.\n\nThe VALUES() function can only be used in a ON DUPLICATE KEY UPDATE clause and\nhas no meaning in any other context. It returns the column values from the\nINSERT portion of the statement. This function is particularly useful for\nmulti-rows inserts.\n\nThe IGNORE and DELAYED options are ignored when you use ON DUPLICATE KEY\nUPDATE.\n\nSee Partition Pruning and Selection for details on the PARTITION clause.\n\nThis statement activates INSERT and UPDATE triggers. See Trigger Overview for\ndetails.\n\nSee also a similar statement, REPLACE.\n\nExamples\n--------\n\nCREATE TABLE ins_duplicate (id INT PRIMARY KEY, animal VARCHAR(30));\nINSERT INTO ins_duplicate VALUES (1,\'Aardvark\'), (2,\'Cheetah\'), (3,\'Zebra\');\n\nIf there is no existing key, the statement runs as a regular INSERT:\n\nINSERT INTO ins_duplicate VALUES (4,\'Gorilla\') \n ON DUPLICATE KEY UPDATE animal=\'Gorilla\';\nQuery OK, 1 row affected (0.07 sec)\n\nSELECT * FROM ins_duplicate;\n+----+----------+\n| id | animal |\n+----+----------+\n| 1 | Aardvark |\n| 2 | Cheetah |\n| 3 | Zebra |\n| 4 | Gorilla |\n+----+----------+\n\nA regular INSERT with a primary key value of 1 will fail, due to the existing\nkey:\n\nINSERT INTO ins_duplicate VALUES (1,\'Antelope\');\nERROR 1062 (23000): Duplicate entry \'1\' for key \'PRIMARY\'\n\nHowever, we can use an INSERT ON DUPLICATE KEY UPDATE instead:\n\nINSERT INTO ins_duplicate VALUES (1,\'Antelope\') \n ON DUPLICATE KEY UPDATE animal=\'Antelope\';\nQuery OK, 2 rows affected (0.09 sec)\n\nNote that there are two rows reported as affected, but this refers only to the\nUPDATE.\n\nSELECT * FROM ins_duplicate;\n+----+----------+\n| id | animal |\n+----+----------+\n| 1 | Antelope |\n| 2 | Cheetah |\n| 3 | Zebra |\n| 4 | Gorilla |\n+----+----------+\n\nAdding a second unique column:\n\nALTER TABLE ins_duplicate ADD id2 INT;\nUPDATE ins_duplicate SET id2=id+10;\nALTER TABLE ins_duplicate ADD UNIQUE KEY(id2);\n\nWhere two rows match the unique keys match, only the first is updated. This\ncan be unsafe and is not recommended unless you are certain what you are doing.\n\nINSERT INTO ins_duplicate VALUES (2,\'Lion\',13) \n ON DUPLICATE KEY UPDATE animal=\'Lion\';\nQuery OK, 2 rows affected (0.004 sec)\n\nSELECT * FROM ins_duplicate;\n+----+----------+------+\n| id | animal | id2 |\n+----+----------+------+\n| 1 | Antelope | 11 |\n| 2 | Lion | 12 |\n| 3 | Zebra | 13 |\n| 4 | Gorilla | 14 |\n+----+----------+------+\n\nAlthough the third row with an id of 3 has an id2 of 13, which also matched,\nit was not updated.\n\nChanging id to an auto_increment field. If a new row is added, the\nauto_increment is moved forward. If the row is updated, it remains the same.\n\nALTER TABLE `ins_duplicate` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT;\nALTER TABLE ins_duplicate DROP id2;\nSELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES \n WHERE TABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 5 |\n+----------------+\n\nINSERT INTO ins_duplicate VALUES (2,\'Leopard\') \n ON DUPLICATE KEY UPDATE animal=\'Leopard\';\nQuery OK, 2 rows affected (0.00 sec)\n\nSELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES \n WHERE TABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 5 |\n+----------------+\n\nINSERT INTO ins_duplicate VALUES (5,\'Wild Dog\') \n ON DUPLICATE KEY UPDATE animal=\'Wild Dog\';\nQuery OK, 1 row affected (0.09 sec)\n\nSELECT * FROM ins_duplicate;\n+----+----------+\n| id | animal |\n+----+----------+\n| 1 | Antelope |\n| 2 | Leopard |\n| 3 | Zebra |\n| 4 | Gorilla |\n| 5 | Wild Dog |\n+----+----------+\n\nSELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES \n WHERE TABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 6 |\n+----------------+\n\nRefering to column values from the INSERT portion of the statement:\n\nINSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6)\n ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);\n\nSee the VALUES() function for more.\n\nURL: https://mariadb.com/kb/en/insert-on-duplicate-key-update/','','https://mariadb.com/kb/en/insert-on-duplicate-key-update/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (457,27,'INSERT...RETURNING','MariaDB starting with 10.5.0\n----------------------------\nINSERT ... RETURNING was added in MariaDB 10.5.0, and returns a resultset of\nthe inserted rows.\n\nSyntax\n------\n\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ] [RETURNING select_expr\n [, select_expr ...]]\n\nOr:\n\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ] [RETURNING select_expr\n [, select_expr ...]]\n\nOr:\n\nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE\n col=expr\n [, col=expr] ... ] [RETURNING select_expr\n [, select_expr ...]]\n\nDescription\n-----------\n\nINSERT ... RETURNING returns a resultset of the inserted rows.\n\nThis returns the listed columns for all the rows that are inserted, or\nalternatively, the specified SELECT expression. Any SQL expressions which can\nbe calculated can be used in the select expression for the RETURNING clause,\nincluding virtual columns and aliases, expressions which use various operators\nsuch as bitwise, logical and arithmetic operators, string functions, date-time\nfunctions, numeric functions, control flow functions, secondary functions and\nstored functions. Along with this, statements which have subqueries and\nprepared statements can also be used.\n\nExamples\n--------\n\nSimple INSERT statements:\n\nCREATE OR REPLACE TABLE t2 (id INT, animal VARCHAR(20), t TIMESTAMP);\n\nINSERT INTO t2 (id) VALUES (2),(3) RETURNING id,t;\n+------+---------------------+\n| id | t |\n+------+---------------------+\n| 2 | 2021-04-28 00:59:32 |\n| 3 | 2021-04-28 00:59:32 |\n+------+---------------------+\n\nINSERT INTO t2(id,animal) VALUES\n(1,\'Dog\'),(2,\'Lion\'),(3,\'Tiger\'),(4,\'Leopard\') \n RETURNING id,id+id,id&id,id||id;\n+------+-------+-------+--------+\n| id | id+id | id&id | id||id |\n+------+-------+-------+--------+\n| 1 | 2 | 1 | 1 |\n| 2 | 4 | 2 | 1 |\n| 3 | 6 | 3 | 1 |\n| 4 | 8 | 4 | 1 |\n+------+-------+-------+--------+\n\nUsing stored functions in RETURNING\n\nDELIMITER |\nCREATE FUNCTION f(arg INT) RETURNS INT\n BEGIN\n RETURN (SELECT arg+arg);\n END|\n\nDELIMITER ;\n\nPREPARE stmt FROM \"INSERT INTO t1 SET id1=1, animal1=\'Bear\' RETURNING f(id1),\nUPPER(animal1)\";\n\nEXECUTE stmt;\n+---------+----------------+\n| f(id1) | UPPER(animal1) |\n+---------+----------------+\n| 2 | BEAR |\n+---------+----------------+\n\nSubqueries in the RETURNING clause that return more than one row or column\ncannot be used.\n\nAggregate functions cannot be used in the RETURNING clause. Since aggregate\nfunctions work on a set of values, and if the purpose is to get the row count,\nROW_COUNT() with SELECT can be used or it can be used in\nINSERT...SELECT...RETURNING if the table in the RETURNING clause is not the\nsame as the INSERT table.\n\nURL: https://mariadb.com/kb/en/insertreturning/','','https://mariadb.com/kb/en/insertreturning/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (458,27,'REPLACE...RETURNING','MariaDB starting with 10.5.0\n----------------------------\nREPLACE ... RETURNING was added in MariaDB 10.5.0, and returns a resultset of\nthe replaced rows.\n\nSyntax\n------\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n[RETURNING select_expr \n [, select_expr ...]]\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n[RETURNING select_expr \n [, select_expr ...]]\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n[RETURNING select_expr \n [, select_expr ...]]\n\nDescription\n-----------\n\nREPLACE ... RETURNING returns a resultset of the replaced rows.\n\nThis returns the listed columns for all the rows that are replaced, or\nalternatively, the specified SELECT expression. Any SQL expressions which can\nbe calculated can be used in the select expression for the RETURNING clause,\nincluding virtual columns and aliases, expressions which use various operators\nsuch as bitwise, logical and arithmetic operators, string functions, date-time\nfunctions, numeric functions, control flow functions, secondary functions and\nstored functions. Along with this, statements which have subqueries and\nprepared statements can also be used.\n\nExamples\n--------\n\nSimple REPLACE statement\n\nREPLACE INTO t2 VALUES (1,\'Leopard\'),(2,\'Dog\') RETURNING id2, id2+id2 \nas Total ,id2|id2, id2&&id2;\n+-----+-------+---------+----------+\n| id2 | Total | id2|id2 | id2&&id2 |\n+-----+-------+---------+----------+\n| 1 | 2 | 1 | 1 |\n| 2 | 4 | 2 | 1 |\n+-----+-------+---------+----------+\n\nUsing stored functions in RETURNING\n\nDELIMITER |\nCREATE FUNCTION f(arg INT) RETURNS INT\n BEGIN\n RETURN (SELECT arg+arg);\n END|\n\nDELIMITER ;\nPREPARE stmt FROM \"REPLACE INTO t2 SET id2=3, animal2=\'Fox\' RETURNING f2(id2),\nUPPER(animal2)\";\n\nEXECUTE stmt;\n+---------+----------------+\n| f2(id2) | UPPER(animal2) |\n+---------+----------------+\n| 6 | FOX |\n+---------+----------------+\n\nSubqueries in the statement\n\nREPLACE INTO t1 SELECT * FROM t2 RETURNING (SELECT id2 FROM t2 WHERE \nid2 IN (SELECT id2 FROM t2 WHERE id2=1)) AS new_id;\n+--------+\n| new_id |\n+--------+\n| 1 |\n| 1 |\n| 1 |\n| 1 |\n+--------+\n\nSubqueries in the RETURNING clause that return more than one row or column\ncannot be used..\n\nAggregate functions cannot be used in the RETURNING clause. Since aggregate\nfunctions work on a set of values and if the purpose is to get the row count,\nROW_COUNT() with SELECT can be used, or it can be used in\nREPLACE...SELECT...RETURNING if the table in the RETURNING clause is not the\nsame as the REPLACE table.\n\nURL: https://mariadb.com/kb/en/replacereturning/','','https://mariadb.com/kb/en/replacereturning/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (459,27,'CALL','Syntax\n------\n\nCALL sp_name([parameter[,...]])\nCALL sp_name[()]\n\nDescription\n-----------\n\nThe CALL statement invokes a stored procedure that was defined previously with\nCREATE PROCEDURE.\n\nStored procedure names can be specified as database_name.procedure_name.\nProcedure names and database names can be quoted with backticks (). This is\nnecessary if they are reserved words, or contain special characters. See\nidentifier qualifiers for details.\n\nCALL p() and CALL p are equivalent.\n\nIf parentheses are used, any number of spaces, tab characters and newline\ncharacters are allowed between the procedure\'s name and the open parenthesis.\n\nCALL can pass back values to its caller using parameters that are declared as\nOUT or INOUT parameters. If no value is assigned to an OUT parameter, NULL is\nassigned (and its former value is lost). To pass such values from another\nstored program you can use user-defined variables, local variables or\nroutine\'s parameters; in other contexts, you can only use user-defined\nvariables.\n\nCALL can also be executed as a prepared statement. Placeholders can be used\nfor IN parameters in all versions of MariaDB; for OUT and INOUT parameters,\nplaceholders can be used since MariaDB 5.5.\n\nWhen the procedure returns, a client program can also obtain the number of\nrows affected for the final statement executed within the routine: At the SQL\nlevel, call the ROW_COUNT() function; from the C API, call the\nmysql_affected_rows() function.\n\nIf the CLIENT_MULTI_RESULTS API flag is set, CALL can return any number of\nresultsets and the called stored procedure can execute prepared statements. If\nit is not set, at most one resultset can be returned and prepared statements\ncannot be used within procedures.\n\nURL: https://mariadb.com/kb/en/call/','','https://mariadb.com/kb/en/call/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (460,27,'DO','Syntax\n------\n\nDO expr [, expr] ...\n\nDescription\n-----------\n\nDO executes the expressions but does not return any results. In most respects,\nDO is shorthand for SELECT expr, ..., but has the advantage that it is\nslightly faster when you do not care about the result.\n\nDO is useful primarily with functions that have side effects, such as\nRELEASE_LOCK().\n\nURL: https://mariadb.com/kb/en/do/','','https://mariadb.com/kb/en/do/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (461,27,'Comment Syntax','There are three supported comment styles in MariaDB:\n\n* From a \'#\' to the end of a line:SELECT * FROM users; # This is a comment\n\n* From a \'-- \' to the end of a line. The space after the two dashes is\nrequired (as in MySQL).SELECT * FROM users; -- This is a comment\n\n* C style comments from an opening \'/*\' to a closing \'*/\'. Comments of this\nform can span multiple lines:SELECT * FROM users; /* This is a\nmulti-line\ncomment */\n\nNested comments are possible in some situations, but they are not supported or\nrecommended.\n\nExecutable Comments\n-------------------\n\nAs an aid to portability between different databases, MariaDB supports\nexecutable comments. These special comments allow you to embed SQL code which\nwill not execute when run on other databases, but will execute when run on\nMariaDB.\n\nMariaDB supports both MySQL\'s executable comment format, and a slightly\nmodified version specific to MariaDB. This way, if you have SQL code that\nworks on MySQL and MariaDB, but not other databases, you can wrap it in a\nMySQL executable comment, and if you have code that specifically takes\nadvantage of features only available in MariaDB you can use the MariaDB\nspecific format to hide the code from MySQL.\n\nExecutable Comment Syntax\n-------------------------\n\nMySQL and MariaDB executable comment syntax:\n\n/*! MySQL or MariaDB-specific code */\n\nCode that should be executed only starting from a specific MySQL or MariaDB\nversion:\n\n/*!##### MySQL or MariaDB-specific code */\n\nThe numbers, represented by \'######\' in the syntax examples above specify the\nspecific the minimum versions of MySQL and MariaDB that should execute the\ncomment. The first number is the major version, the second 2 numbers are the\nminor version and the last 2 is the patch level.\n\nFor example, if you want to embed some code that should only execute on MySQL\nor MariaDB starting from 5.1.0, you would do the following:\n\n/*!50100 MySQL and MariaDB 5.1.0 (and above) code goes here. */\n\nMariaDB-only executable comment syntax (starting from MariaDB 5.3.1):\n\n/*M! MariaDB-specific code */\n/*M!###### MariaDB-specific code */\n\nMariaDB ignores MySQL-style executable comments that have a version number in\nthe range 50700..99999. This is needed to skip features introduced in\nMySQL-5.7 that are not ported to MariaDB 10.x yet.\n\n/*!50701 MariaDB-10.x ignores MySQL-5.7 specific code */\n\nNote: comments which have a version number in the range 50700..99999 that use\nMariaDB-style executable comment syntax are still executed.\n\n/*M!50701 MariaDB-10.x does not ignore this */\n\nStatement delimiters cannot be used within executable comments.\n\nExamples\n--------\n\nIn MySQL all the following will return 2: In MariaDB, the last 2 queries would\nreturn 3.\n\nSELECT 2 /* +1 */;\nSELECT 1 /*! +1 */;\nSELECT 1 /*!50101 +1 */;\nSELECT 2 /*M! +1 */;\nSELECT 2 /*M!50301 +1 */;\n\nThe following executable statement will not work due to the delimiter inside\nthe executable portion:\n\n/*M!100100 select 1 ; */\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual\nthat corresponds to your MariaDB server version for the right syntax to use\nnear \'\' at line 1\n\nInstead, the delimiter should be placed outside the executable portion:\n\n/*M!100100 select 1 */;\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n\nURL: https://mariadb.com/kb/en/comment-syntax/','','https://mariadb.com/kb/en/comment-syntax/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (462,27,'HANDLER Commands','Syntax\n------\n\nHANDLER tbl_name OPEN [ [AS] alias]\nHANDLER tbl_name READ index_name { = | >= | <= | < } (value1,value2,...)\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ index_name { FIRST | NEXT | PREV | LAST }\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ { FIRST | NEXT }\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name CLOSE\n\nDescription\n-----------\n\nThe HANDLER statement provides direct access to table storage engine\ninterfaces for key lookups and key or table scans. It is available for at\nleast Aria, Memory, MyISAM and InnoDB tables (and should work with most\n\'normal\' storage engines, but not with system tables, MERGE or views).\n\nHANDLER ... OPEN opens a table, allowing it to be accessible to subsequent\nHANDLER ... READ statements. The table can either be opened using an alias\n(which must then be used by HANDLER ... READ, or a table name.\n\nThe table object is only closed when HANDLER ... CLOSE is called by the\nsession, and is not shared by other sessions.\n\nPrepared statements work with HANDLER READ, which gives a much higher\nperformance (50% speedup) as there is no parsing and all data is transformed\nin binary (without conversions to text, as with the normal protocol).\n\nThe HANDLER command does not work with partitioned tables.\n\nKey Lookup\n----------\n\nA key lookup is started with:\n\nHANDLER tbl_name READ index_name { = | >= | <= | < } (value,value) [LIMIT...]\n\nThe values stands for the value of each of the key columns. For most key types\n(except for HASH keys in MEMORY storage engine) you can use a prefix subset of\nit\'s columns.\n\nIf you are using LIMIT, then in case of >= or > then there is an implicit NEXT\nimplied, while if you are using <= or < then there is an implicit PREV implied.\n\nAfter the initial read, you can use\n\nHANDLER tbl_name READ index_name NEXT [ LIMIT ... ]\nor\nHANDLER tbl_name READ index_name PREV [ LIMIT ... ]\n\nto scan the rows in key order.\n\nNote that the row order is not defined for keys with duplicated values and\nwill vary from engine to engine.\n\nKey Scans\n---------\n\nYou can scan a table in key order by doing:\n\nHANDLER tbl_name READ index_name FIRST [ LIMIT ... ]\nHANDLER tbl_name READ index_name NEXT [ LIMIT ... ]\n\nor, if the handler supports backwards key scans (most do):\n\nHANDLER tbl_name READ index_name LAST [ LIMIT ... ]\nHANDLER tbl_name READ index_name PREV [ LIMIT ... ]\n\nTable Scans\n-----------\n\nYou can scan a table in row order by doing:\n\nHANDLER tbl_name READ FIRST [ LIMIT ... ]\nHANDLER tbl_name READ NEXT [ LIMIT ... ]\n\nLimitations\n-----------\n\nAs this is a direct interface to the storage engine, some limitations may\napply for what you can do and what happens if the table changes. Here follows\nsome of the common limitations:\n\nFinding \'Old Rows\'\n------------------\n\nHANDLER READ is not transaction safe, consistent or atomic. It\'s ok for the\nstorage engine to returns rows that existed when you started the scan but that\nwere later deleted. This can happen as the storage engine may cache rows as\npart of the scan from a previous read.\n\nYou may also find rows committed since the scan originally started.\n\nInvisible Columns\n-----------------\n\nHANDLER ... READ also reads the data of invisible-columns.\n\nSystem-Versioned Tables\n-----------------------\n\nHANDLER ... READ reads everything from system-versioned tables, and so\nincludes row_start and row_end fields, as well as all rows that have since\nbeen deleted or changed, including when history partitions are used.\n\nOther Limitations\n-----------------\n\n* If you do an ALTER TABLE, all your HANDLERs for that table are automatically\nclosed.\n* If you do an ALTER TABLE for a table that is used by some other connection\nwith HANDLER, the ALTER TABLE will wait for the HANDLER to be closed.\n* For HASH keys, you must use all key parts when searching for a row.\n* For HASH keys, you can\'t do a key scan of all values. You can only find all\nrows with the same key value.\n* While each HANDLER READ command is atomic, if you do a scan in many steps,\nthen some engines may give you error 1020 if the table changed between the\ncommands. Please refer to the specific engine handler page if this happens.\n\nError Codes\n-----------\n\n* Error 1031 (ER_ILLEGAL_HA) Table storage engine for \'t1\' doesn\'t have this\noption\nIf you get this for HANDLER OPEN it means the storage engine doesn\'t support\nHANDLER calls.\nIf you get this for HANDLER READ it means you are trying to use an incomplete\nHASH key.\n\n* Error 1020 (ER_CHECKREAD) Record has changed since last read in table \'...\'\nThis means that the table changed between two reads and the handler can\'t\nhandle this case for the given scan.\n\nURL: https://mariadb.com/kb/en/handler-commands/','','https://mariadb.com/kb/en/handler-commands/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (463,27,'HANDLER for MEMORY Tables','This article explains how to use HANDLER commands efficiently with MEMORY/HEAP\ntables.\n\nIf you want to scan a table for over different key values, not just search for\nexact key values, you should create your keys with \'USING BTREE\':\n\nCREATE TABLE t1 (a INT, b INT, KEY(a), KEY b USING BTREE (b)) engine=memory;\n\nIn the above table, a is a HASH key that only supports exact matches (=) while\nb is a BTREE key that you can use to scan the table in key order, starting\nfrom start or from a given key value.\n\nThe limitations for HANDLER READ with Memory|HEAP tables are:\n\nLimitations for HASH keys\n-------------------------\n\n* You must use all key parts when searching for a row.\n* You can\'t do a key scan of all values. You can only find all rows with the\nsame key value.\n* READ NEXT gives error 1031 if the tables changed since last read.\n\nLimitations for BTREE keys\n--------------------------\n\n* READ NEXT gives error 1031 if the tables changed since last read. This\nlimitation can be lifted in the future.\n\nLimitations for table scans\n---------------------------\n\n* READ NEXT gives error 1031 if the table was truncated since last READ call.\n\nURL: https://mariadb.com/kb/en/handler-for-memory-tables/','','https://mariadb.com/kb/en/handler-for-memory-tables/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (464,27,'Useful MariaDB Queries','This page is intended to be a quick reference of commonly-used and/or useful\nqueries in MariaDB.\n\nCreating a Table\n----------------\n\nCREATE TABLE t1 ( a INT );\nCREATE TABLE t2 ( b INT );\nCREATE TABLE student_tests (\n name CHAR(10), test CHAR(10), \n score TINYINT, test_date DATE\n);\n\nSee CREATE TABLE for more.\n\nInserting Records\n-----------------\n\nINSERT INTO t1 VALUES (1), (2), (3);\nINSERT INTO t2 VALUES (2), (4);\n\nINSERT INTO student_tests \n (name, test, score, test_date) VALUES\n (\'Chun\', \'SQL\', 75, \'2012-11-05\'), \n (\'Chun\', \'Tuning\', 73, \'2013-06-14\'),\n (\'Esben\', \'SQL\', 43, \'2014-02-11\'), \n (\'Esben\', \'Tuning\', 31, \'2014-02-09\'), \n (\'Kaolin\', \'SQL\', 56, \'2014-01-01\'),\n (\'Kaolin\', \'Tuning\', 88, \'2013-12-29\'), \n (\'Tatiana\', \'SQL\', 87, \'2012-04-28\'), \n (\'Tatiana\', \'Tuning\', 83, \'2013-09-30\');\n\nSee INSERT for more.\n\nUsing AUTO_INCREMENT\n--------------------\n\nThe AUTO_INCREMENT attribute is used to automatically generate a unique\nidentity for new rows.\n\nCREATE TABLE student_details (\n id INT NOT NULL AUTO_INCREMENT, name CHAR(10), \n date_of_birth DATE, PRIMARY KEY (id)\n);\n\nWhen inserting, the id field can be omitted, and is automatically created.\n\nINSERT INTO student_details (name,date_of_birth) VALUES \n (\'Chun\', \'1993-12-31\'), \n (\'Esben\',\'1946-01-01\'),\n (\'Kaolin\',\'1996-07-16\'),\n (\'Tatiana\', \'1988-04-13\');\n\nSELECT * FROM student_details;\n+----+---------+---------------+\n| id | name | date_of_birth |\n+----+---------+---------------+\n| 1 | Chun | 1993-12-31 |\n| 2 | Esben | 1946-01-01 |\n| 3 | Kaolin | 1996-07-16 |\n| 4 | Tatiana | 1988-04-13 |\n+----+---------+---------------+\n\nSee AUTO_INCREMENT for more.\n\nQuerying from two tables on a common value\n------------------------------------------\n\nSELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.b;\n\nThis kind of query is called a join - see JOINS for more.\n\nFinding the Maximum Value\n-------------------------\n\nSELECT MAX(a) FROM t1;\n+--------+\n| MAX(a) |\n+--------+\n| 3 |\n+--------+\n\nSee the MAX() function for more, as well as Finding the maximum value and\ngrouping the results below for a more practical example.\n\nFinding the Minimum Value\n-------------------------\n\nSELECT MIN(a) FROM t1;\n+--------+\n| MIN(a) |\n+--------+\n| 1 |\n+--------+\n\nSee the MIN() function for more.\n\nFinding the Average Value\n-------------------------\n\nSELECT AVG(a) FROM t1;\n+--------+\n| AVG(a) |\n+--------+\n| 2.0000 |\n+--------+\n\nSee the AVG() function for more.\n\nFinding the Maximum Value and Grouping the Results\n--------------------------------------------------\n\nSELECT name, MAX(score) FROM student_tests GROUP BY name;\n+---------+------------+\n| name | MAX(score) |\n+---------+------------+\n| Chun | 75 |\n| Esben | 43 |\n| Kaolin | 88 |\n| Tatiana | 87 |\n+---------+------------+\n\nSee the MAX() function for more.\n\nOrdering Results\n----------------\n\nSELECT name, test, score FROM student_tests ORDER BY score DESC;\n+---------+--------+-------+\n| name | test | score |\n+---------+--------+-------+\n| Kaolin | Tuning | 88 |\n| Tatiana | SQL | 87 |\n| Tatiana | Tuning | 83 |\n| Chun | SQL | 75 |\n| Chun | Tuning | 73 |\n| Kaolin | SQL | 56 |\n| Esben | SQL | 43 |\n| Esben | Tuning | 31 |\n+---------+--------+-------+\n\nSee ORDER BY for more.\n\nFinding the Row with the Minimum of a Particular Column\n-------------------------------------------------------\n\nIn this example, we want to find the lowest test score for any student.\n\nSELECT name,test, score FROM student_tests WHERE score=(SELECT MIN(score) FROM\nstudent);\n+-------+--------+-------+\n| name | test | score |\n+-------+--------+-------+\n| Esben | Tuning | 31 |\n+-------+--------+-------+\n\nFinding Rows with the Maximum Value of a Column by Group\n--------------------------------------------------------\n\nThis example returns the best test results of each student:\n\nSELECT name, test, score FROM student_tests st1 WHERE score = (\n SELECT MAX(score) FROM student st2 WHERE st1.name = st2.name\n); \n+---------+--------+-------+\n| name | test | score |\n+---------+--------+-------+\n| Chun | SQL | 75 |\n| Esben | SQL | 43 |\n| Kaolin | Tuning | 88 |\n| Tatiana | SQL | 87 |\n+---------+--------+-------+\n\nCalculating Age\n---------------\n\nThe TIMESTAMPDIFF function can be used to calculate someone\'s age:\n\nSELECT CURDATE() AS today;\n+------------+\n| today |\n+------------+\n| 2014-02-17 |\n+------------+\n\nSELECT name, date_of_birth, TIMESTAMPDIFF(YEAR,date_of_birth,\'2014-08-02\') AS\nage \n FROM student_details;\n+---------+---------------+------+\n| name | date_of_birth | age |\n+---------+---------------+------+\n| Chun | 1993-12-31 | 20 |\n| Esben | 1946-01-01 | 68 |\n| Kaolin | 1996-07-16 | 18 |\n| Tatiana | 1988-04-13 | 26 |\n+---------+---------------+------+\n\nSee TIMESTAMPDIFF() for more.\n\nUsing User-defined Variables\n----------------------------\n\nThis example sets a user-defined variable with the average test score, and\nthen uses it in a later query to return all results above the average.\n\nSELECT @avg_score:= AVG(score) FROM student_tests;\n+-------------------------+\n| @avg_score:= AVG(score) |\n+-------------------------+\n| 67.000000000 |\n+-------------------------+\n\nSELECT * FROM student_tests WHERE score > @avg_score;\n+---------+--------+-------+------------+\n| name | test | score | test_date |\n+---------+--------+-------+------------+\n| Chun | SQL | 75 | 2012-11-05 |\n| Chun | Tuning | 73 | 2013-06-14 |\n| Kaolin | Tuning | 88 | 2013-12-29 |\n| Tatiana | SQL | 87 | 2012-04-28 |\n| Tatiana | Tuning | 83 | 2013-09-30 |\n+---------+--------+-------+------------+\n\nUser-defined variables can also be used to add an incremental counter to a\nresultset:\n\nSET @count = 0;\n\nSELECT @count := @count + 1 AS counter, name, date_of_birth FROM\nstudent_details;\n+---------+---------+---------------+\n| counter | name | date_of_birth |\n+---------+---------+---------------+\n| 1 | Chun | 1993-12-31 |\n| 2 | Esben | 1946-01-01 |\n| 3 | Kaolin | 1996-07-16 |\n| 4 | Tatiana | 1988-04-13 |\n+---------+---------+---------------+\n\nSee User-defined Variables for more.\n\nView Tables in Order of Size\n----------------------------\n\nReturns a list of all tables in the database, ordered by size:\n\nSELECT table_schema as `DB`, table_name AS `Table`, \n ROUND(((data_length + index_length) / 1024 / 1024), 2) `Size (MB)`\n FROM information_schema.TABLES\n ORDER BY (data_length + index_length) DESC;\n\n+--------------------+---------------------------------------+-----------+\n| DB | Table | Size (MB) |\n+--------------------+---------------------------------------+-----------+\n| wordpress | wp_simple_history_contexts | 7.05 |\n| wordpress | wp_posts | 6.59 |\n| wordpress | wp_simple_history | 3.05 |\n| wordpress | wp_comments | 2.73 |\n| wordpress | wp_commentmeta | 2.47 |\n| wordpress | wp_simple_login_log | 2.03 |\n...\n\nRemoving Duplicates\n-------------------\n\nMariaDB starting with 10.3\n--------------------------\nThe following syntax is only valid MariaDB 10.3 and beyond:\n\nThis example assumes there\'s a unique ID, but that all other fields are\nidentical. In the example below, there are 4 records, 3 of which are\nduplicates, so two of the three duplicates need to be removed. The\nintermediate SELECT is not necessary, but demonstrates what is being returned.\n\nCREATE TABLE t (id INT, f1 VARCHAR(2));\n\nINSERT INTO t VALUES (1,\'a\'), (2,\'a\'), (3,\'b\'), (4,\'a\');\n\nSELECT * FROM t t1, t t2 WHERE t1.f1=t2.f1 AND t1.id<>t2.id AND t1.id=(\n SELECT MAX(id) FROM t tab WHERE tab.f1=t1.f1\n);\n+------+------+------+------+\n| id | f1 | id | f1 |\n+------+------+------+------+\n| 4 | a | 1 | a |\n| 4 | a | 2 | a |\n+------+------+------+------+\n\nDELETE FROM t WHERE id IN (\n SELECT t2.id FROM t t1, t t2 WHERE t1.f1=t2.f1 AND t1.id<>t2.id AND t1.id=(\n SELECT MAX(id) FROM t tab WHERE tab.f1=t1.f1\n )\n);\nQuery OK, 2 rows affected (0.120 sec)\n\nSELECT * FROM t;\n+------+------+\n| id | f1 |\n+------+------+\n| 3 | b |\n| 4 | a |\n+------+------\n\nURL: https://mariadb.com/kb/en/useful-mariadb-queries/','','https://mariadb.com/kb/en/useful-mariadb-queries/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (465,28,'ANALYZE FORMAT=JSON','ANALYZE FORMAT=JSON is a mix of the EXPLAIN FORMAT=JSON and ANALYZE statement\nfeatures. The ANALYZE FORMAT=JSON $statement will execute $statement, and then\nprint the output of EXPLAIN FORMAT=JSON, amended with data from the query\nexecution.\n\nBasic Execution Data\n--------------------\n\nYou can get the following also from tabular ANALYZE statement form:\n\n* r_rows is provided for any node that reads rows. It shows how many rows\nwere read, on average \n* r_filtered is provided whenever there is a condition that is checked. It\nshows the percentage of rows left after checking the condition.\n\nAdvanced Execution Data\n-----------------------\n\nThe most important data not available in the regular tabula ANALYZE statement\nare:\n\n* r_loops field. This shows how many times the node was executed. Most query\nplan elements have this field.\n* r_total_time_ms field. It shows how much time in total was spent executing\nthis node. If the node has subnodes, their execution time is included.\n* r_buffer_size field. Query plan nodes that make use of buffers report the\nsize of buffer that was was used.\n\nSHOW ANALYZE FORMAT=JSON\n------------------------\n\nMariaDB starting with 10.9\n--------------------------\nSHOW ANALYZE FORMAT=JSON for extends ANALYZE [FORMAT=JSON]\n
The flags in @c thd->options, binary AND-ed with @c OPTIONS_WRITTEN_TO_BIN_LOG. The @c thd->options bitfield contains options for "SELECT". @c OPTIONS_WRITTEN identifies those options - that need to be written to the binlog (not all do). Specifically, - @c OPTIONS_WRITTEN_TO_BIN_LOG equals (@c OPTION_AUTO_IS_NULL | @c - OPTION_NO_FOREIGN_KEY_CHECKS | @c OPTION_RELAXED_UNIQUE_CHECKS | - @c OPTION_NOT_AUTOCOMMIT), or 0x0c084000 in hex. + that need to be written to the binlog (not all do). These flags correspond to the SQL variables SQL_AUTO_IS_NULL, FOREIGN_KEY_CHECKS, UNIQUE_CHECKS, and AUTOCOMMIT, documented in @@ -2119,7 +2149,7 @@ class Query_log_event: public Log_event flags2==0 (5.0 master, we know this has a meaning of flags all down which must influence the query). */ - bool flags2_inited; + uint32 flags2_inited; bool sql_mode_inited; bool charset_inited; @@ -2148,6 +2178,12 @@ class Query_log_event: public Log_event Q_MASTER_DATA_WRITTEN_CODE to the slave's server binlog. */ uint32 master_data_written; + /* + A copy of Gtid event's extra flags that is relevant for two-phase + logged ALTER. + */ + uchar gtid_flags_extra; + decltype(rpl_gtid::seq_no) sa_seq_no; /* data part for CA/RA flags */ #ifdef MYSQL_SERVER @@ -2159,6 +2195,7 @@ class Query_log_event: public Log_event #endif /* HAVE_REPLICATION */ #else bool print_query_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info); + bool print_verbose(IO_CACHE* cache, PRINT_EVENT_INFO* print_event_info); bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif @@ -2172,8 +2209,10 @@ class Query_log_event: public Log_event my_free(data_buf); } Log_event_type get_type_code() { return QUERY_EVENT; } - static int dummy_event(String *packet, ulong ev_offset, enum enum_binlog_checksum_alg checksum_alg); - static int begin_event(String *packet, ulong ev_offset, enum enum_binlog_checksum_alg checksum_alg); + static int dummy_event(String *packet, ulong ev_offset, + enum enum_binlog_checksum_alg checksum_alg); + static int begin_event(String *packet, ulong ev_offset, + enum enum_binlog_checksum_alg checksum_alg); #ifdef MYSQL_SERVER bool write(); virtual bool write_post_header_for_derived() { return FALSE; } @@ -2199,6 +2238,9 @@ class Query_log_event: public Log_event size_t event_len, enum enum_binlog_checksum_alg checksum_alg); + int handle_split_alter_query_log_event(rpl_group_info *rgi, + bool &skip_error_check); + #endif /* HAVE_REPLICATION */ /* If true, the event always be applied by slave SQL thread or be printed by @@ -2580,8 +2622,7 @@ class Load_log_event: public Log_event */ Load_log_event(const uchar *buf, uint event_len, const Format_description_log_event* description_event); - ~Load_log_event() - {} + ~Load_log_event() = default; Log_event_type get_type_code() { return sql_ex.new_format() ? NEW_LOAD_EVENT: LOAD_EVENT; @@ -2665,13 +2706,13 @@ class Start_log_event_v3: public Log_event void pack_info(Protocol* protocol); #endif /* HAVE_REPLICATION */ #else - Start_log_event_v3() {} + Start_log_event_v3() = default; bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif Start_log_event_v3(const uchar *buf, uint event_len, const Format_description_log_event* description_event); - ~Start_log_event_v3() {} + ~Start_log_event_v3() = default; Log_event_type get_type_code() { return START_EVENT_V3;} my_off_t get_header_len(my_off_t l __attribute__((unused))) { return LOG_EVENT_MINIMAL_HEADER_LEN; } @@ -2841,6 +2882,7 @@ class Format_description_log_event: public Start_log_event_v3 }; master_version_split server_version_split; const uint8 *event_type_permutation; + uint32 options_written_to_bin_log; Format_description_log_event(uint8 binlog_ver, const char* server_ver=0); Format_description_log_event(const uchar *buf, uint event_len, @@ -2888,6 +2930,7 @@ class Format_description_log_event: public Start_log_event_v3 } void calc_server_version_split(); + void deduct_options_written_to_bin_log(); static bool is_version_before_checksum(const master_version_split *version_split); protected: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) @@ -2959,7 +3002,7 @@ Intvar_log_event(THD* thd_arg,uchar type_arg, ulonglong val_arg, Intvar_log_event(const uchar *buf, const Format_description_log_event *description_event); - ~Intvar_log_event() {} + ~Intvar_log_event() = default; Log_event_type get_type_code() { return INTVAR_EVENT;} const char* get_var_type_name(); int get_data_size() { return 9; /* sizeof(type) + sizeof(val) */;} @@ -3040,7 +3083,7 @@ class Rand_log_event: public Log_event Rand_log_event(const uchar *buf, const Format_description_log_event *description_event); - ~Rand_log_event() {} + ~Rand_log_event() = default; Log_event_type get_type_code() { return RAND_EVENT;} int get_data_size() { return 16; /* sizeof(ulonglong) * 2*/ } #ifdef MYSQL_SERVER @@ -3076,7 +3119,7 @@ class Xid_apply_log_event: public Log_event virtual int do_commit()= 0; virtual int do_apply_event(rpl_group_info *rgi); int do_record_gtid(THD *thd, rpl_group_info *rgi, bool in_trans, - void **out_hton); + void **out_hton, bool force_err= false); enum_skip_reason do_shall_skip(rpl_group_info *rgi); virtual const char* get_query()= 0; #endif @@ -3120,7 +3163,7 @@ class Xid_log_event: public Xid_apply_log_event Xid_log_event(const uchar *buf, const Format_description_log_event *description_event); - ~Xid_log_event() {} + ~Xid_log_event() = default; Log_event_type get_type_code() { return XID_EVENT;} int get_data_size() { return sizeof(xid); } #ifdef MYSQL_SERVER @@ -3340,7 +3383,7 @@ class User_var_log_event: public Log_event User_var_log_event(const uchar *buf, uint event_len, const Format_description_log_event *description_event); - ~User_var_log_event() {} + ~User_var_log_event() = default; Log_event_type get_type_code() { return USER_VAR_EVENT;} #ifdef MYSQL_SERVER bool write(); @@ -3390,7 +3433,7 @@ class Stop_log_event: public Log_event const Format_description_log_event *description_event): Log_event(buf, description_event) {} - ~Stop_log_event() {} + ~Stop_log_event() = default; Log_event_type get_type_code() { return STOP_EVENT;} bool is_valid() const { return 1; } @@ -3606,13 +3649,19 @@ class Gtid_log_event: public Log_event uint64 seq_no; uint64 commit_id; uint32 domain_id; + uint64 sa_seq_no; // start alter identifier for CA/RA #ifdef MYSQL_SERVER event_xid_t xid; #else event_mysql_xid_t xid; #endif uchar flags2; - uint flags_extra; // more flags area placed after the regular flags2's one + /* + More flags area placed after the regular flags2's area. The type + is declared to be in agreement with Query_log_event's member that + may copy the flags_extra value. + */ + decltype(Query_log_event::gtid_flags_extra) flags_extra; /* Number of engine participants in transaction minus 1. When zero the event does not contain that information. @@ -3650,14 +3699,19 @@ class Gtid_log_event: public Log_event /* FL_"COMMITTED or ROLLED-BACK"_XA is set for XA transaction. */ static const uchar FL_COMPLETED_XA= 128; - /* Flags_extra. */ - /* - FL_EXTRA_MULTI_ENGINE is set for event group comprising a transaction + flags_extra 's bit values. + _E1 suffix below stands for Extra to infer the extra flags, + their "1st" generation (more *generations* can come when necessary). + + FL_EXTRA_MULTI_ENGINE_E1 is set for event group comprising a transaction involving multiple storage engines. No flag and extra data are added to the event when the transaction involves only one engine. */ - static const uchar FL_EXTRA_MULTI_ENGINE= 1; + static const uchar FL_EXTRA_MULTI_ENGINE_E1= 1; + static const uchar FL_START_ALTER_E1= 2; + static const uchar FL_COMMIT_ALTER_E1= 4; + static const uchar FL_ROLLBACK_ALTER_E1= 8; #ifdef MYSQL_SERVER Gtid_log_event(THD *thd_arg, uint64 seq_no, uint32 domain_id, bool standalone, @@ -3674,7 +3728,7 @@ class Gtid_log_event: public Log_event #endif Gtid_log_event(const uchar *buf, uint event_len, const Format_description_log_event *description_event); - ~Gtid_log_event() { } + ~Gtid_log_event() = default; Log_event_type get_type_code() { return GTID_EVENT; } enum_logged_status logged_status() { return LOGGED_NO_DATA; } int get_data_size() @@ -3927,7 +3981,7 @@ class Append_block_log_event: public Log_event Append_block_log_event(const uchar *buf, uint event_len, const Format_description_log_event *description_event); - ~Append_block_log_event() {} + ~Append_block_log_event() = default; Log_event_type get_type_code() { return APPEND_BLOCK_EVENT;} int get_data_size() { return block_len + APPEND_BLOCK_HEADER_LEN ;} bool is_valid() const { return block != 0; } @@ -3968,7 +4022,7 @@ class Delete_file_log_event: public Log_event Delete_file_log_event(const uchar *buf, uint event_len, const Format_description_log_event* description_event); - ~Delete_file_log_event() {} + ~Delete_file_log_event() = default; Log_event_type get_type_code() { return DELETE_FILE_EVENT;} int get_data_size() { return DELETE_FILE_HEADER_LEN ;} bool is_valid() const { return file_id != 0; } @@ -4008,7 +4062,7 @@ class Execute_load_log_event: public Log_event Execute_load_log_event(const uchar *buf, uint event_len, const Format_description_log_event *description_event); - ~Execute_load_log_event() {} + ~Execute_load_log_event() = default; Log_event_type get_type_code() { return EXEC_LOAD_EVENT;} int get_data_size() { return EXEC_LOAD_HEADER_LEN ;} bool is_valid() const { return file_id != 0; } @@ -4048,7 +4102,7 @@ class Begin_load_query_log_event: public Append_block_log_event Begin_load_query_log_event(const uchar *buf, uint event_len, const Format_description_log_event *description_event); - ~Begin_load_query_log_event() {} + ~Begin_load_query_log_event() = default; Log_event_type get_type_code() { return BEGIN_LOAD_QUERY_EVENT; } private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) @@ -4106,7 +4160,7 @@ class Execute_load_query_log_event: public Query_log_event Execute_load_query_log_event(const uchar *buf, uint event_len, const Format_description_log_event *description_event); - ~Execute_load_query_log_event() {} + ~Execute_load_query_log_event() = default; Log_event_type get_type_code() { return EXECUTE_LOAD_QUERY_EVENT; } bool is_valid() const { return Query_log_event::is_valid() && file_id != 0; } @@ -4144,7 +4198,7 @@ class Unknown_log_event: public Log_event {} /* constructor for hopelessly corrupted events */ Unknown_log_event(): Log_event(), what(ENCRYPTED) {} - ~Unknown_log_event() {} + ~Unknown_log_event() = default; bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); Log_event_type get_type_code() { return UNKNOWN_EVENT;} bool is_valid() const { return 1; } @@ -5827,4 +5881,12 @@ int row_log_event_uncompress(const Format_description_log_event uchar* buf, ulong buf_size, bool *is_malloc, uchar **dst, ulong *newlen); +bool is_parallel_retry_error(rpl_group_info *rgi, int err); + +/* + Compares two GTIDs to facilitate sorting a GTID list log event by domain id + (ascending) and sequence number (ascending) +*/ +int compare_glle_gtids(const void * _gtid1, const void *_gtid2); + #endif /* _log_event_h */ diff --git a/sql/log_event_client.cc b/sql/log_event_client.cc index 7e0bf7d8e4caa..03e319076c7a6 100644 --- a/sql/log_event_client.cc +++ b/sql/log_event_client.cc @@ -17,6 +17,7 @@ */ +#include "log_event.h" #ifndef MYSQL_CLIENT #error MYSQL_CLIENT must be defined here #endif @@ -839,10 +840,12 @@ log_event_print_value(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info, my_b_write_bit(file, ptr , (meta & 0xFF) * 8); return meta & 0xFF; + case MYSQL_TYPE_BLOB_COMPRESSED: case MYSQL_TYPE_BLOB: switch (meta) { case 1: - strmake(typestr, "TINYBLOB/TINYTEXT", typestr_length); + my_snprintf(typestr, typestr_length, "TINYBLOB/TINYTEXT%s", + type == MYSQL_TYPE_BLOB_COMPRESSED ? " COMPRESSED" : ""); if (!ptr) goto return_null; @@ -850,7 +853,8 @@ log_event_print_value(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info, my_b_write_quoted(file, ptr + 1, length); return length + 1; case 2: - strmake(typestr, "BLOB/TEXT", typestr_length); + my_snprintf(typestr, typestr_length, "BLOB/TEXT%s", + type == MYSQL_TYPE_BLOB_COMPRESSED ? " COMPRESSED" : ""); if (!ptr) goto return_null; @@ -858,7 +862,8 @@ log_event_print_value(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info, my_b_write_quoted(file, ptr + 2, length); return length + 2; case 3: - strmake(typestr, "MEDIUMBLOB/MEDIUMTEXT", typestr_length); + my_snprintf(typestr, typestr_length, "MEDIUMBLOB/MEDIUMTEXT%s", + type == MYSQL_TYPE_BLOB_COMPRESSED ? " COMPRESSED" : ""); if (!ptr) goto return_null; @@ -866,7 +871,8 @@ log_event_print_value(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info, my_b_write_quoted(file, ptr + 3, length); return length + 3; case 4: - strmake(typestr, "LONGBLOB/LONGTEXT", typestr_length); + my_snprintf(typestr, typestr_length, "LONGBLOB/LONGTEXT%s", + type == MYSQL_TYPE_BLOB_COMPRESSED ? " COMPRESSED" : ""); if (!ptr) goto return_null; @@ -878,10 +884,12 @@ log_event_print_value(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info, return 0; } + case MYSQL_TYPE_VARCHAR_COMPRESSED: case MYSQL_TYPE_VARCHAR: case MYSQL_TYPE_VAR_STRING: length= meta; - my_snprintf(typestr, typestr_length, "VARSTRING(%d)", length); + my_snprintf(typestr, typestr_length, "VARSTRING(%d)%s", length, + type == MYSQL_TYPE_VARCHAR_COMPRESSED ? " COMPRESSED" : ""); if (!ptr) goto return_null; @@ -1886,6 +1894,7 @@ bool Query_log_event::print_query_header(IO_CACHE* file, if (unlikely(tmp)) /* some bits have changed */ { bool need_comma= 0; + ulonglong mask= glob_description_event->options_written_to_bin_log; if (my_b_write_string(file, "SET ") || print_set_option(file, tmp, OPTION_NO_FOREIGN_KEY_CHECKS, ~flags2, "@@session.foreign_key_checks", &need_comma)|| @@ -1895,11 +1904,13 @@ bool Query_log_event::print_query_header(IO_CACHE* file, "@@session.unique_checks", &need_comma) || print_set_option(file, tmp, OPTION_NOT_AUTOCOMMIT, ~flags2, "@@session.autocommit", &need_comma) || - print_set_option(file, tmp, OPTION_NO_CHECK_CONSTRAINT_CHECKS, - ~flags2, + print_set_option(file, tmp, OPTION_NO_CHECK_CONSTRAINT_CHECKS, ~flags2, "@@session.check_constraint_checks", &need_comma) || - print_set_option(file, tmp, OPTION_IF_EXISTS, flags2, - "@@session.sql_if_exists", &need_comma)|| + print_set_option(file, tmp, mask & OPTION_IF_EXISTS, flags2, + "@@session.sql_if_exists", &need_comma) || + print_set_option(file, tmp, mask & OPTION_EXPLICIT_DEF_TIMESTAMP, flags2, + "@@session.explicit_defaults_for_timestamp", + &need_comma) || my_b_printf(file,"%s\n", print_event_info->delimiter)) goto err; print_event_info->flags2= flags2; @@ -1956,11 +1967,11 @@ bool Query_log_event::print_query_header(IO_CACHE* file, goto err; } if (my_b_printf(file,"SET " - "@@session.character_set_client=%d," + "@@session.character_set_client=%s," "@@session.collation_connection=%d," "@@session.collation_server=%d" "%s\n", - uint2korr(charset), + cs_info->cs_name.str, uint2korr(charset+2), uint2korr(charset+4), print_event_info->delimiter)) @@ -2005,6 +2016,19 @@ bool Query_log_event::print_query_header(IO_CACHE* file, return 1; } +bool Query_log_event::print_verbose(IO_CACHE* cache, PRINT_EVENT_INFO* print_event_info) +{ + if (my_b_printf(cache, "### ") || + my_b_write(cache, (uchar *) query, q_len) || + my_b_printf(cache, "\n")) + { + goto err; + } + return 0; + +err: + return 1; +} bool Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { @@ -2020,9 +2044,42 @@ bool Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) goto err; if (!is_flashback) { - if (my_b_write(&cache, (uchar*) query, q_len) || - my_b_printf(&cache, "\n%s\n", print_event_info->delimiter)) - goto err; + if (gtid_flags_extra & (Gtid_log_event::FL_START_ALTER_E1 | + Gtid_log_event::FL_COMMIT_ALTER_E1 | + Gtid_log_event::FL_ROLLBACK_ALTER_E1)) + { + bool do_print_encoded= + print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER && + print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS && + !print_event_info->short_form; + bool comment_mode= do_print_encoded && + gtid_flags_extra & (Gtid_log_event::FL_START_ALTER_E1 | + Gtid_log_event::FL_ROLLBACK_ALTER_E1); + + if(comment_mode) + my_b_printf(&cache, "/*!100600 "); + if (do_print_encoded) + my_b_printf(&cache, "BINLOG '\n"); + if (print_base64(&cache, print_event_info, do_print_encoded)) + goto err; + if (do_print_encoded) + { + if(comment_mode) + my_b_printf(&cache, "' */%s\n", print_event_info->delimiter); + else + my_b_printf(&cache, "'%s\n", print_event_info->delimiter); + } + if (print_event_info->verbose && print_verbose(&cache, print_event_info)) + { + goto err; + } + } + else + { + if (my_b_write(&cache, (uchar*) query, q_len) || + my_b_printf(&cache, "\n%s\n", print_event_info->delimiter)) + goto err; + } } else // is_flashback == 1 { @@ -2295,6 +2352,8 @@ Gtid_list_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info) char buf[21]; uint32 i; + qsort(list, count, sizeof(rpl_gtid), compare_glle_gtids); + if (print_header(&cache, print_event_info, FALSE) || my_b_printf(&cache, "\tGtid list [")) goto err; @@ -3791,6 +3850,8 @@ st_print_event_info::st_print_event_info() printed_fd_event=FALSE; file= 0; base64_output_mode=BASE64_OUTPUT_UNSPEC; + m_is_event_group_active= TRUE; + m_is_event_group_filtering_enabled= FALSE; open_cached_file(&head_cache, NULL, NULL, 0, flags); open_cached_file(&body_cache, NULL, NULL, 0, flags); open_cached_file(&tail_cache, NULL, NULL, 0, flags); @@ -3854,6 +3915,15 @@ Gtid_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info) if (flags2 & FL_WAITED) if (my_b_write_string(&cache, " waited")) goto err; + if (flags_extra & FL_START_ALTER_E1) + if (my_b_write_string(&cache, " START ALTER")) + goto err; + if (flags_extra & FL_COMMIT_ALTER_E1) + if (my_b_printf(&cache, " COMMIT ALTER id= %lu", sa_seq_no)) + goto err; + if (flags_extra & FL_ROLLBACK_ALTER_E1) + if (my_b_printf(&cache, " ROLLBACK ALTER id= %lu", sa_seq_no)) + goto err; if (my_b_printf(&cache, "\n")) goto err; diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc index cc103751b138d..b3fca6de0acd5 100644 --- a/sql/log_event_server.cc +++ b/sql/log_event_server.cc @@ -52,6 +52,7 @@ #include "compat56.h" #include "wsrep_mysqld.h" #include "sql_insert.h" +#include "sql_table.h" #include #include "rpl_utility.h" @@ -124,6 +125,7 @@ static const char *HA_ERR(int i) case HA_ERR_LOGGING_IMPOSSIBLE: return "HA_ERR_LOGGING_IMPOSSIBLE"; case HA_ERR_CORRUPT_EVENT: return "HA_ERR_CORRUPT_EVENT"; case HA_ERR_ROWS_EVENT_APPLY : return "HA_ERR_ROWS_EVENT_APPLY"; + case HA_ERR_PARTITION_LIST : return "HA_ERR_PARTITION_LIST"; } return "No Error!"; } @@ -138,7 +140,7 @@ static const char *HA_ERR(int i) deadlocks; such errors are handled automatically by rolling back re-trying the transactions, so should not pollute the error log. */ -static bool +bool is_parallel_retry_error(rpl_group_info *rgi, int err) { if (!rgi->is_parallel_exec) @@ -151,6 +153,30 @@ is_parallel_retry_error(rpl_group_info *rgi, int err) return has_temporary_error(rgi->thd); } +/** + Accumulate a Diagnostics_area's errors and warnings into an output buffer + + @param errbuf The output buffer to write error messages + @param errbuf_size The size of the output buffer + @param da The Diagnostics_area to check for errors +*/ +static void inline aggregate_da_errors(char *errbuf, size_t errbuf_size, + Diagnostics_area *da) +{ + const char *errbuf_end= errbuf + errbuf_size; + char *slider; + Diagnostics_area::Sql_condition_iterator it= da->sql_conditions(); + const Sql_condition *err; + size_t len; + for (err= it++, slider= errbuf; err && slider < errbuf_end - 1; + slider += len, err= it++) + { + len= my_snprintf(slider, errbuf_end - slider, + " %s, Error_code: %d;", err->get_message_text(), + err->get_sql_errno()); + } +} + /** Error reporting facility for Rows_log_event::do_apply_event @@ -171,13 +197,8 @@ static void inline slave_rows_error_report(enum loglevel level, int ha_error, const char *log_name, my_off_t pos) { const char *handler_error= (ha_error ? HA_ERR(ha_error) : NULL); - char buff[MAX_SLAVE_ERRMSG], *slider; - const char *buff_end= buff + sizeof(buff); - size_t len; - Diagnostics_area::Sql_condition_iterator it= - thd->get_stmt_da()->sql_conditions(); + char buff[MAX_SLAVE_ERRMSG]; Relay_log_info const *rli= rgi->rli; - const Sql_condition *err; buff[0]= 0; int errcode= thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0; @@ -190,13 +211,7 @@ static void inline slave_rows_error_report(enum loglevel level, int ha_error, if (is_parallel_retry_error(rgi, errcode)) return; - for (err= it++, slider= buff; err && slider < buff_end - 1; - slider += len, err= it++) - { - len= my_snprintf(slider, buff_end - slider, - " %s, Error_code: %d;", err->get_message_text(), - err->get_sql_errno()); - } + aggregate_da_errors(buff, sizeof(buff), thd->get_stmt_da()); if (ha_error != 0) rli->report(level, errcode, rgi->gtid_info(), @@ -1303,11 +1318,25 @@ bool Query_log_event::write() start+= 8; } + if (gtid_flags_extra) + { + *start++= Q_GTID_FLAGS3; + *start++= gtid_flags_extra; + if (gtid_flags_extra & + (Gtid_log_event::FL_COMMIT_ALTER_E1 | + Gtid_log_event::FL_ROLLBACK_ALTER_E1)) + { + int8store(start, sa_seq_no); + start+= 8; + } + } + + /* NOTE: When adding new status vars, please don't forget to update the MAX_SIZE_LOG_EVENT_STATUS in log_event.h and update the function code_name() in this file. - + Here there could be code like if (command-line-option-which-says-"log_this_variable" && inited) { @@ -1415,7 +1444,9 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, lc_time_names_number(thd_arg->variables.lc_time_names->number), charset_database_number(0), table_map_for_update((ulonglong)thd_arg->table_map_for_update), - master_data_written(0) + master_data_written(0), + gtid_flags_extra(thd_arg->get_binlog_flags_for_alter()), + sa_seq_no(0) { /* status_vars_len is set just before writing the event */ @@ -1551,11 +1582,15 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, use_cache= trx_cache= TRUE; break; default: - use_cache= sqlcom_can_generate_row_events(thd); + use_cache= (gtid_flags_extra) ? false : sqlcom_can_generate_row_events(thd); break; } } + if (gtid_flags_extra & (Gtid_log_event::FL_COMMIT_ALTER_E1 | + Gtid_log_event::FL_ROLLBACK_ALTER_E1)) + sa_seq_no= thd_arg->get_binlog_start_alter_seq_no(); + if (!use_cache || direct) { cache_type= Log_event::EVENT_NO_CACHE; @@ -1627,6 +1662,223 @@ bool test_if_equal_repl_errors(int expected_error, int actual_error) } +static start_alter_info *get_new_start_alter_info(THD *thd) +{ + /* + Why on global memory ?- So that process_commit/rollback_alter should not get + error when spawned threads exits too early. + */ + start_alter_info *info; + if (!(info= (start_alter_info *)my_malloc(PSI_INSTRUMENT_ME, + sizeof(start_alter_info), MYF(MY_WME)))) + { + sql_print_error("Failed to allocate memory for ddl log free list"); + return 0; + } + info->sa_seq_no= 0; + info->domain_id= 0; + info->direct_commit_alter= false; + info->state= start_alter_state::INVALID; + mysql_cond_init(0, &info->start_alter_cond, NULL); + info->error= 0; + + return info; +} + + +/* + Perform necessary actions for two-phase-logged ALTER parts, to + return + + 0 when the event's query proceeds normal parsing and execution + 1 when the event skips parsing and execution + -1 as error. +*/ +int Query_log_event::handle_split_alter_query_log_event(rpl_group_info *rgi, + bool &skip_error_check) +{ + int rc= 0; + + rgi->gtid_ev_flags_extra= gtid_flags_extra; + if (gtid_flags_extra & Gtid_log_event::FL_START_ALTER_E1) + { + //No Slave, Normal Slave, Start Alter under Worker 1 will simple binlog and exit + if(!rgi->rpt || rgi->reserved_start_alter_thread || WSREP(thd)) + { + rc= 1; + /* + We will just write the binlog and move to next event , because COMMIT + Alter will take care of actual work + */ + rgi->reserved_start_alter_thread= false; + thd->lex->sql_command= SQLCOM_ALTER_TABLE; + Write_log_with_flags wlwf(thd, Gtid_log_event::FL_START_ALTER_E1, + true /* wsrep to isolation end */); +#ifdef WITH_WSREP + if (WSREP(thd) && wsrep_thd_is_local(thd) && + // no need to supply other than db in this case + wsrep_to_isolation_begin(thd, db, NULL,NULL,NULL,NULL,NULL)) + return -1; +#endif + if (write_bin_log(thd, false, thd->query(), thd->query_length())) + return -1; + + my_ok(thd); + return rc; + } + if (!rgi->sa_info) + rgi->sa_info= get_new_start_alter_info(thd); + else + { + /* Not send Start-Alter into query execution when it's to rollback */ + mysql_mutex_lock(&rgi->rli->mi->start_alter_lock); + if (rgi->sa_info->state == start_alter_state::ROLLBACK_ALTER) + mysql_cond_broadcast(&rgi->sa_info->start_alter_cond); + mysql_mutex_unlock(&rgi->rli->mi->start_alter_lock); + } + + return rc; + } + + bool is_CA= (gtid_flags_extra & Gtid_log_event::FL_COMMIT_ALTER_E1) ? true : false; + if (is_CA) + { + DBUG_EXECUTE_IF("rpl_slave_stop_CA_before_binlog", + { + // the awake comes from STOP-SLAVE running driver (sql) thread + debug_sync_set_action(thd, + STRING_WITH_LEN("now WAIT_FOR proceed_CA_1")); + }); + } + start_alter_info *info=NULL; + Master_info *mi= NULL; + + rgi->gtid_ev_sa_seq_no= sa_seq_no; + // is set for both the direct execution and the write to binlog + thd->set_binlog_start_alter_seq_no(sa_seq_no); + mi= rgi->rli->mi; + mysql_mutex_lock(&mi->start_alter_list_lock); + { + List_iterator info_iterator(mi->start_alter_list); + while ((info= info_iterator++)) + { + if(info->sa_seq_no == rgi->gtid_ev_sa_seq_no && + info->domain_id == rgi->current_gtid.domain_id) + { + info_iterator.remove(); + break; + } + } + } + mysql_mutex_unlock(&mi->start_alter_list_lock); + + if (!info) + { + if (is_CA) + { + /* + error handeling, direct_commit_alter is turned on, so that we dont + wait for master reply in mysql_alter_table (in wait_for_master) + */ + rgi->direct_commit_alter= true; +#ifdef WITH_WSREP + if (WSREP(thd)) + thd->set_binlog_flags_for_alter(Gtid_log_event::FL_COMMIT_ALTER_E1); +#endif + goto cleanup; + } + else + { + //Just write the binlog because there is nothing to be done + goto write_binlog; + } + } + + mysql_mutex_lock(&mi->start_alter_lock); + if (info->state != start_alter_state::COMPLETED) + { + if (is_CA) + info->state= start_alter_state::COMMIT_ALTER; + else + info->state= start_alter_state::ROLLBACK_ALTER; + mysql_cond_broadcast(&info->start_alter_cond); + mysql_mutex_unlock(&mi->start_alter_lock); + /* + Wait till Start Alter worker has changed the state to ::COMPLETED + when start alter worker reaches the old code write_bin_log(), it will + change state to COMMITTED. + COMMITTED and `direct_commit_alter == true` at the same time indicates + the query needs re-execution by the CA running thread. + */ + mysql_mutex_lock(&mi->start_alter_lock); + + DBUG_ASSERT(info->state == start_alter_state::COMPLETED || + !info->direct_commit_alter); + + while(info->state != start_alter_state::COMPLETED) + mysql_cond_wait(&info->start_alter_cond, &mi->start_alter_lock); + } + else + { + // SA has completed and left being kicked out by deadlock or ftwrl + DBUG_ASSERT(info->direct_commit_alter); + } + mysql_mutex_unlock(&mi->start_alter_lock); + + if (info->direct_commit_alter) + { + rgi->direct_commit_alter= true; // execute the query as if there was no SA + if (is_CA) + goto cleanup; + } + +write_binlog: + rc= 1; + + if(!is_CA) + { + if(((info && info->error) || error_code) && + global_system_variables.log_warnings > 2) + { + sql_print_information("Query '%s' having %d error code on master " + "is rolled back%s", query, error_code, + !(info && info->error) ? "." : ";"); + if (info && info->error) + sql_print_information("its execution on slave %sproduced %d error.", + info->error == error_code ? "re":"", info->error); + } + } + { + thd->lex->sql_command= SQLCOM_ALTER_TABLE; + Write_log_with_flags wlwf(thd, is_CA ? Gtid_log_event::FL_COMMIT_ALTER_E1 : + Gtid_log_event::FL_ROLLBACK_ALTER_E1, + true); +#ifdef WITH_WSREP + if (WSREP(thd) && wsrep_thd_is_local(thd) && + wsrep_to_isolation_begin(thd, db, NULL,NULL,NULL,NULL,NULL)) + rc= -1; +#endif + if (rc != -1 && + write_bin_log(thd, false, thd->query(), thd->query_length())) + rc= -1; + } + + if (!thd->is_error()) + { + skip_error_check= true; + my_ok(thd); + } + +cleanup: + if (info) + { + mysql_cond_destroy(&info->start_alter_cond); + my_free(info); + } + return rc; +} + + /** @todo Compare the values of "affected rows" around here. Something @@ -1655,6 +1907,7 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi, Relay_log_info const *rli= rgi->rli; Rpl_filter *rpl_filter= rli->mi->rpl_filter; bool current_stmt_is_commit; + bool skip_error_check= false; DBUG_ENTER("Query_log_event::do_apply_event"); /* @@ -1665,6 +1918,7 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi, you. */ thd->catalog= catalog_len ? (char *) catalog : (char *)""; + rgi->start_alter_ev= this; size_t valid_len= Well_formed_prefix(system_charset_info, db, db_len, NAME_LEN).length(); @@ -1709,25 +1963,24 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi, */ if (is_trans_keyword() || rpl_filter->db_ok(thd->db.str)) { + bool is_rb_alter= gtid_flags_extra & Gtid_log_event::FL_ROLLBACK_ALTER_E1; + thd->set_time(when, when_sec_part); thd->set_query_and_id((char*)query_arg, q_len_arg, thd->charset(), next_query_id()); thd->variables.pseudo_thread_id= thread_id; // for temp tables DBUG_PRINT("query",("%s", thd->query())); - if (unlikely(!(expected_error= error_code)) || + if (unlikely(!(expected_error= !is_rb_alter ? error_code : 0)) || ignored_error_code(expected_error) || !unexpected_error_code(expected_error)) { thd->slave_expected_error= expected_error; if (flags2_inited) { - /* - all bits of thd->variables.option_bits which are 1 in - OPTIONS_WRITTEN_TO_BIN_LOG must take their value from - flags2. - */ - thd->variables.option_bits= flags2|(thd->variables.option_bits & ~OPTIONS_WRITTEN_TO_BIN_LOG); + ulonglong mask= flags2_inited; + thd->variables.option_bits= (flags2 & mask) | + (thd->variables.option_bits & ~mask); } /* else, we are in a 3.23/4.0 binlog; we previously received a @@ -1749,7 +2002,7 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi, if (charset_inited) { rpl_sql_thread_info *sql_info= thd->system_thread_info.rpl_sql_info; - if (sql_info->cached_charset_compare(charset)) + if (thd->slave_thread && sql_info->cached_charset_compare(charset)) { /* Verify that we support the charsets found in the event. */ if (!(thd->variables.character_set_client= @@ -1887,40 +2140,69 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi, thd->variables.option_bits|= OPTION_MASTER_SQL_ERROR; thd->variables.option_bits&= ~OPTION_GTID_BEGIN; } - /* Execute the query (note that we bypass dispatch_command()) */ - Parser_state parser_state; - if (!parser_state.init(thd, thd->query(), thd->query_length())) + + int sa_result= 0; + bool is_2p_alter= gtid_flags_extra & + (Gtid_log_event::FL_START_ALTER_E1 | + Gtid_log_event::FL_COMMIT_ALTER_E1 | + Gtid_log_event::FL_ROLLBACK_ALTER_E1); + if (is_2p_alter) + sa_result= handle_split_alter_query_log_event(rgi, skip_error_check); + if (sa_result == 0) { - DBUG_ASSERT(thd->m_digest == NULL); - thd->m_digest= & thd->m_digest_state; - DBUG_ASSERT(thd->m_statement_psi == NULL); - thd->m_statement_psi= MYSQL_START_STATEMENT(&thd->m_statement_state, - stmt_info_rpl.m_key, - thd->db.str, thd->db.length, - thd->charset(), NULL); - THD_STAGE_INFO(thd, stage_starting); - MYSQL_SET_STATEMENT_TEXT(thd->m_statement_psi, thd->query(), thd->query_length()); - if (thd->m_digest != NULL) - thd->m_digest->reset(thd->m_token_array, max_digest_length); - - if (thd->slave_thread) - { - /* - To be compatible with previous releases, the slave thread uses the global - log_slow_disabled_statements value, wich can be changed dynamically, so we - have to set the sql_log_slow respectively. - */ - thd->variables.sql_log_slow= !MY_TEST(global_system_variables.log_slow_disabled_statements & LOG_SLOW_DISABLE_SLAVE); - } - - mysql_parse(thd, thd->query(), thd->query_length(), &parser_state); - /* Finalize server status flags after executing a statement. */ - thd->update_server_status(); - log_slow_statement(thd); - thd->lex->restore_set_statement_var(); - } + /* Execute the query (note that we bypass dispatch_command()) */ + Parser_state parser_state; + if (!parser_state.init(thd, thd->query(), thd->query_length())) + { + DBUG_ASSERT(thd->m_digest == NULL); + thd->m_digest= & thd->m_digest_state; + DBUG_ASSERT(thd->m_statement_psi == NULL); + thd->m_statement_psi= MYSQL_START_STATEMENT(&thd->m_statement_state, + stmt_info_rpl.m_key, + thd->db.str, thd->db.length, + thd->charset(), NULL); + THD_STAGE_INFO(thd, stage_starting); + MYSQL_SET_STATEMENT_TEXT(thd->m_statement_psi, thd->query(), thd->query_length()); + if (thd->m_digest != NULL) + thd->m_digest->reset(thd->m_token_array, max_digest_length); + + if (thd->slave_thread) + { + /* + To be compatible with previous releases, the slave thread uses the global + log_slow_disabled_statements value, wich can be changed dynamically, so we + have to set the sql_log_slow respectively. + */ + thd->variables.sql_log_slow= !MY_TEST(global_system_variables.log_slow_disabled_statements & LOG_SLOW_DISABLE_SLAVE); + } + mysql_parse(thd, thd->query(), thd->query_length(), &parser_state); + /* Finalize server status flags after executing a statement. */ + thd->update_server_status(); + log_slow_statement(thd); + thd->lex->restore_set_statement_var(); + /* + When THD::slave_expected_error gets reset inside execution stack + that is the case of to be ignored event. In this case the expected + error must change to the reset value as well. + */ + expected_error= thd->slave_expected_error; + } + } + else if (sa_result == -1) + { + rli->report(ERROR_LEVEL, expected_error, rgi->gtid_info(), + "TODO start alter error"); + thd->is_slave_error= 1; + goto end; + } thd->variables.option_bits&= ~OPTION_MASTER_SQL_ERROR; + if (is_2p_alter && !rgi->is_parallel_exec) + { + rgi->gtid_ev_flags_extra= 0; + rgi->direct_commit_alter= 0; + rgi->gtid_ev_sa_seq_no= 0; + } } else { @@ -1983,7 +2265,8 @@ START SLAVE; . Query: '%s'", expected_error, thd->query()); If we expected a non-zero error code, and we don't get the same error code, and it should be ignored or is related to a concurrency issue. */ - actual_error= thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0; + actual_error= thd->is_error() ? thd->get_stmt_da()->sql_errno() : + skip_error_check? expected_error : 0; DBUG_PRINT("info",("expected_error: %d sql_errno: %d", expected_error, actual_error)); @@ -2379,6 +2662,39 @@ bool Format_description_log_event::write() } #if defined(HAVE_REPLICATION) +/* + Auxiliary function to conduct cleanup of unfinished two-phase logged ALTERs. +*/ +static void check_and_remove_stale_alter(Relay_log_info *rli) +{ + Master_info *mi= rli->mi; + start_alter_info *info=NULL; + + mysql_mutex_lock(&mi->start_alter_list_lock); + List_iterator info_iterator(mi->start_alter_list); + while ((info= info_iterator++)) + { + DBUG_ASSERT(info->state == start_alter_state::REGISTERED); + + sql_print_warning("ALTER query started at %u-%u-%llu could not " + "be completed because of unexpected master server " + "or its binlog change", info->sa_seq_no, // todo:gtid + 0, 0); + info_iterator.remove(); + mysql_mutex_lock(&mi->start_alter_lock); + info->state= start_alter_state::ROLLBACK_ALTER; + mysql_mutex_unlock(&mi->start_alter_lock); + mysql_cond_broadcast(&info->start_alter_cond); + mysql_mutex_lock(&mi->start_alter_lock); + while(info->state != start_alter_state::COMPLETED) + mysql_cond_wait(&info->start_alter_cond, &mi->start_alter_lock); + mysql_mutex_unlock(&mi->start_alter_lock); + mysql_cond_destroy(&info->start_alter_cond); + my_free(info); + } + mysql_mutex_unlock(&mi->start_alter_list_lock); +} + int Format_description_log_event::do_apply_event(rpl_group_info *rgi) { int ret= 0; @@ -2396,15 +2712,21 @@ int Format_description_log_event::do_apply_event(rpl_group_info *rgi) original place when it comes to us; we'll know this by checking log_pos ("artificial" events have log_pos == 0). */ - if (!is_artificial_event() && created && thd->transaction->all.ha_list) + if (!is_artificial_event() && created && !thd->rli_fake && !thd->rgi_fake) { - /* This is not an error (XA is safe), just an information */ - rli->report(INFORMATION_LEVEL, 0, NULL, - "Rolling back unfinished transaction (no COMMIT " - "or ROLLBACK in relay log). A probable cause is that " - "the master died while writing the transaction to " - "its binary log, thus rolled back too."); - rgi->cleanup_context(thd, 1); + // check_and_remove stale Start Alter:s + if (flags & LOG_EVENT_BINLOG_IN_USE_F) + check_and_remove_stale_alter(rli); + if (thd->transaction->all.ha_list) + { + /* This is not an error (XA is safe), just an information */ + rli->report(INFORMATION_LEVEL, 0, NULL, + "Rolling back unfinished transaction (no COMMIT " + "or ROLLBACK in relay log). A probable cause is that " + "the master died while writing the transaction to " + "its binary log, thus rolled back too."); + rgi->cleanup_context(thd, 1); + } } /* @@ -3324,7 +3646,14 @@ Gtid_log_event::Gtid_log_event(THD *thd_arg, uint64 seq_no_arg, extra_engines= count > 1 ? 0 : UCHAR_MAX; } if (extra_engines > 0) - flags_extra|= FL_EXTRA_MULTI_ENGINE; + flags_extra|= FL_EXTRA_MULTI_ENGINE_E1; + } + if (thd->get_binlog_flags_for_alter()) + { + flags_extra |= thd->get_binlog_flags_for_alter(); + if (flags_extra & (FL_COMMIT_ALTER_E1 | FL_ROLLBACK_ALTER_E1)) + sa_seq_no= thd->get_binlog_start_alter_seq_no(); + flags2|= FL_DDL; } } @@ -3397,12 +3726,18 @@ Gtid_log_event::write() buf[write_len]= flags_extra; write_len++; } - if (flags_extra & FL_EXTRA_MULTI_ENGINE) + if (flags_extra & FL_EXTRA_MULTI_ENGINE_E1) { buf[write_len]= extra_engines; write_len++; } + if (flags_extra & (FL_COMMIT_ALTER_E1 | FL_ROLLBACK_ALTER_E1)) + { + int8store(buf + write_len, sa_seq_no); + write_len+= 8; + } + if (write_len < GTID_HEADER_LEN) { bzero(buf+write_len, GTID_HEADER_LEN-write_len); @@ -3466,6 +3801,20 @@ Gtid_log_event::pack_info(Protocol *protocol) p= strmov(p, " cid="); p= longlong10_to_str(commit_id, p, 10); } + if (flags_extra & FL_START_ALTER_E1) + { + p= strmov(p, " START ALTER"); + } + if (flags_extra & FL_COMMIT_ALTER_E1) + { + p= strmov(p, " COMMIT ALTER id="); + p= longlong10_to_str(sa_seq_no, p, 10); + } + if (flags_extra & FL_ROLLBACK_ALTER_E1) + { + p= strmov(p, " ROLLBACK ALTER id="); + p= longlong10_to_str(sa_seq_no, p, 10); + } protocol->store(buf, p-buf, &my_charset_bin); } @@ -3480,6 +3829,9 @@ Gtid_log_event::do_apply_event(rpl_group_info *rgi) thd->variables.gtid_domain_id= this->domain_id; thd->variables.gtid_seq_no= this->seq_no; rgi->gtid_ev_flags2= flags2; + + rgi->gtid_ev_flags_extra= flags_extra; + rgi->gtid_ev_sa_seq_no= sa_seq_no; thd->reset_for_next_command(); if (opt_gtid_strict_mode && opt_bin_log && opt_log_slave_updates) @@ -3750,6 +4102,12 @@ Gtid_list_log_event::pack_info(Protocol *protocol) uint32 i; bool first; + /* + For output consistency and ease of reading, we sort the GTID list in + ascending order + */ + qsort(list, count, sizeof(rpl_gtid), compare_glle_gtids); + buf.length(0); buf.append(STRING_WITH_LEN("[")); first= true; @@ -3935,7 +4293,8 @@ bool slave_execute_deferred_events(THD *thd) #if defined(HAVE_REPLICATION) int Xid_apply_log_event::do_record_gtid(THD *thd, rpl_group_info *rgi, - bool in_trans, void **out_hton) + bool in_trans, void **out_hton, + bool force_err) { int err= 0; Relay_log_info const *rli= rgi->rli; @@ -3950,14 +4309,26 @@ int Xid_apply_log_event::do_record_gtid(THD *thd, rpl_group_info *rgi, int ec= thd->get_stmt_da()->sql_errno(); /* Do not report an error if this is really a kill due to a deadlock. - In this case, the transaction will be re-tried instead. + In this case, the transaction will be re-tried instead. Unless force_err + is set, as in the case of XA PREPARE, as the GTID state is updated as a + separate transaction, and if that fails, we should not retry but exit in + error immediately. */ - if (!is_parallel_retry_error(rgi, ec)) + if (!is_parallel_retry_error(rgi, ec) || force_err) + { + char buff[MAX_SLAVE_ERRMSG]; + buff[0]= 0; + aggregate_da_errors(buff, sizeof(buff), thd->get_stmt_da()); + + if (force_err) + thd->clear_error(); + rli->report(ERROR_LEVEL, ER_CANNOT_UPDATE_GTID_STATE, rgi->gtid_info(), "Error during XID COMMIT: failed to update GTID state in " - "%s.%s: %d: %s", + "%s.%s: %d: %s the event's master log %s, end_log_pos %llu", "mysql", rpl_gtid_slave_state_table_name.str, ec, - thd->get_stmt_da()->message()); + buff, RPL_LOG_NAME, log_pos); + } thd->is_slave_error= 1; } @@ -4031,7 +4402,7 @@ int Xid_apply_log_event::do_apply_event(rpl_group_info *rgi) { DBUG_ASSERT(!thd->transaction->xid_state.is_explicit_XA()); - if ((err= do_record_gtid(thd, rgi, false, &hton))) + if ((err= do_record_gtid(thd, rgi, false, &hton, true))) return err; } @@ -5628,7 +5999,8 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) to avoid query cache being polluted with stale entries, */ # ifdef WITH_WSREP - if (!WSREP(thd) && !wsrep_thd_is_applying(thd)) + /* Query cache is not invalidated on wsrep applier here */ + if (!(WSREP(thd) && wsrep_thd_is_applying(thd))) # endif /* WITH_WSREP */ query_cache.invalidate_locked_for_write(thd, rgi->tables_to_lock); #endif /* HAVE_QUERY_CACHE */ @@ -7509,8 +7881,18 @@ Rows_log_event::write_row(rpl_group_info *rgi, int Rows_log_event::update_sequence() { TABLE *table= m_table; // pointer to event's table + bool old_master= false; + int err= 0; - if (!bitmap_is_set(table->rpl_write_set, MIN_VALUE_FIELD_NO)) + if (!bitmap_is_set(table->rpl_write_set, MIN_VALUE_FIELD_NO) || + ( +#if defined(WITH_WSREP) + ! WSREP(thd) && +#endif + !(table->in_use->rgi_slave->gtid_ev_flags2 & Gtid_log_event::FL_DDL) && + !(old_master= + rpl_master_has_bug(thd->rgi_slave->rli, + 29621, FALSE, FALSE, FALSE, TRUE)))) { /* This event come from a setval function executed on the master. Update the sequence next_number and round, like we do with setval() @@ -7523,12 +7905,27 @@ int Rows_log_event::update_sequence() return table->s->sequence->set_value(table, nextval, round, 0) > 0; } - + if (old_master && !WSREP(thd) && thd->rgi_slave->is_parallel_exec) + { + DBUG_ASSERT(thd->rgi_slave->parallel_entry); + /* + With parallel replication enabled, we can't execute alongside any other + transaction in which we may depend, so we force retry to release + the server layer table lock for possible prior in binlog order + same table transactions. + */ + if (thd->rgi_slave->parallel_entry->last_committed_sub_id < + thd->rgi_slave->wait_commit_sub_id) + { + err= ER_LOCK_DEADLOCK; + my_error(err, MYF(0)); + } + } /* Update all fields in table and update the active sequence, like with ALTER SEQUENCE */ - return table->file->ha_write_row(table->record[0]); + return err == 0 ? table->file->ha_write_row(table->record[0]) : err; } @@ -7544,19 +7941,21 @@ Write_rows_log_event::do_exec_row(rpl_group_info *rgi) const char *tmp= thd->get_proc_info(); LEX_CSTRING tmp_db= thd->db; char *message, msg[128]; - const char *table_name= m_table->s->table_name.str; - char quote_char= get_quote_char_for_identifier(thd, STRING_WITH_LEN(table_name)); - my_snprintf(msg, sizeof(msg),"Write_rows_log_event::write_row() on table %c%s%c", - quote_char, table_name, quote_char); + const LEX_CSTRING &table_name= m_table->s->table_name; + const char quote_char= + get_quote_char_for_identifier(thd, table_name.str, table_name.length); + my_snprintf(msg, sizeof msg, + "Write_rows_log_event::write_row() on table %c%.*s%c", + quote_char, int(table_name.length), table_name.str, quote_char); thd->reset_db(&m_table->s->db); message= msg; int error; #ifdef WSREP_PROC_INFO my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, - "Write_rows_log_event::write_row(%lld) on table %c%s%c", - (long long) wsrep_thd_trx_seqno(thd), quote_char, table_name, - quote_char); + "Write_rows_log_event::write_row(%lld) on table %c%.*s%c", + (long long) wsrep_thd_trx_seqno(thd), quote_char, + int(table_name.length), table_name.str, quote_char); message= thd->wsrep_info; #endif /* WSREP_PROC_INFO */ @@ -7595,7 +7994,7 @@ uint8 Write_rows_log_event::get_trg_event_map() Returns TRUE if different. */ -static bool record_compare(TABLE *table) +static bool record_compare(TABLE *table, bool vers_from_plain= false) { bool result= FALSE; /** @@ -7628,10 +8027,19 @@ static bool record_compare(TABLE *table) /* Compare fields */ for (Field **ptr=table->field ; *ptr ; ptr++) { - if (table->versioned() && (*ptr)->vers_sys_field()) - { + /* + If the table is versioned, don't compare using the version if there is a + primary key. If there isn't a primary key, we need the version to + identify the correct record if there are duplicate rows in the data set. + However, if the primary server is unversioned (vers_from_plain is true), + then we implicitly use row_end as the primary key on our side. This is + because the implicit row_end value will be set to the maximum value for + the latest row update (which is what we care about). + */ + if (table->versioned() && (*ptr)->vers_sys_field() && + (table->s->primary_key < MAX_KEY || + (vers_from_plain && table->vers_start_field() == (*ptr)))) continue; - } /** We only compare field contents that are not null. NULL fields (i.e., their null bits) were compared @@ -8028,7 +8436,7 @@ int Rows_log_event::find_row(rpl_group_info *rgi) /* We use this to test that the correct key is used in test cases. */ DBUG_EXECUTE_IF("slave_crash_if_index_scan", abort();); - while (record_compare(table)) + while (record_compare(table, m_vers_from_plain)) { while ((error= table->file->ha_index_next(table->record[0]))) { @@ -8081,7 +8489,7 @@ int Rows_log_event::find_row(rpl_group_info *rgi) goto end; } } - while (record_compare(table)); + while (record_compare(table, m_vers_from_plain)); /* Note: above record_compare will take into accout all record fields @@ -8169,10 +8577,12 @@ int Delete_rows_log_event::do_exec_row(rpl_group_info *rgi) const char *tmp= thd->get_proc_info(); LEX_CSTRING tmp_db= thd->db; char *message, msg[128]; - const char *table_name= m_table->s->table_name.str; - char quote_char= get_quote_char_for_identifier(thd, STRING_WITH_LEN(table_name)); - my_snprintf(msg, sizeof(msg),"Delete_rows_log_event::find_row() on table %c%s%c", - quote_char, table_name, quote_char); + const LEX_CSTRING &table_name= m_table->s->table_name; + const char quote_char= + get_quote_char_for_identifier(thd, table_name.str, table_name.length); + my_snprintf(msg, sizeof msg, + "Delete_rows_log_event::find_row() on table %c%.*s%c", + quote_char, int(table_name.length), table_name.str, quote_char); thd->reset_db(&m_table->s->db); message= msg; const bool invoke_triggers= (m_table->triggers && do_invoke_trigger()); @@ -8180,26 +8590,29 @@ int Delete_rows_log_event::do_exec_row(rpl_group_info *rgi) #ifdef WSREP_PROC_INFO my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, - "Delete_rows_log_event::find_row(%lld) on table %c%s%c", - (long long) wsrep_thd_trx_seqno(thd), quote_char, table_name, + "Delete_rows_log_event::find_row(%lld) on table %c%.*s%c", + (long long) wsrep_thd_trx_seqno(thd), quote_char, + int(table_name.length), table_name.str, quote_char); message= thd->wsrep_info; #endif /* WSREP_PROC_INFO */ thd_proc_info(thd, message); if (likely(!(error= find_row(rgi)))) - { + { /* Delete the record found, located in record[0] */ - my_snprintf(msg, sizeof(msg),"Delete_rows_log_event::ha_delete_row() on table %c%s%c", - quote_char, table_name, quote_char); + my_snprintf(msg, sizeof msg, + "Delete_rows_log_event::ha_delete_row() on table %c%.*s%c", + quote_char, int(table_name.length), table_name.str, + quote_char); message= msg; #ifdef WSREP_PROC_INFO snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, - "Delete_rows_log_event::ha_delete_row(%lld) on table %c%s%c", - (long long) wsrep_thd_trx_seqno(thd), quote_char, table_name, - quote_char); + "Delete_rows_log_event::ha_delete_row(%lld) on table %c%.*s%c", + (long long) wsrep_thd_trx_seqno(thd), quote_char, + int(table_name.length), table_name.str, quote_char); message= thd->wsrep_info; #endif thd_proc_info(thd, message); @@ -8332,17 +8745,20 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi) DBUG_ASSERT(m_table != NULL); LEX_CSTRING tmp_db= thd->db; char *message, msg[128]; - const char *table_name= m_table->s->table_name.str; - char quote_char= get_quote_char_for_identifier(thd, STRING_WITH_LEN(table_name)); - my_snprintf(msg, sizeof(msg),"Update_rows_log_event::find_row() on table %c%s%c", - quote_char, table_name, quote_char); + const LEX_CSTRING &table_name= m_table->s->table_name; + const char quote_char= + get_quote_char_for_identifier(thd, table_name.str, table_name.length); + my_snprintf(msg, sizeof msg, + "Update_rows_log_event::find_row() on table %c%.*s%c", + quote_char, int(table_name.length), table_name.str, quote_char); thd->reset_db(&m_table->s->db); message= msg; #ifdef WSREP_PROC_INFO my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, - "Update_rows_log_event::find_row(%lld) on table %c%s%c", - (long long) wsrep_thd_trx_seqno(thd), quote_char, table_name, + "Update_rows_log_event::find_row(%lld) on table %c%.*s%c", + (long long) wsrep_thd_trx_seqno(thd), quote_char, + int(table_name.length), table_name.str, quote_char); message= thd->wsrep_info; #endif /* WSREP_PROC_INFO */ @@ -8382,14 +8798,15 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi) store_record(m_table,record[1]); m_curr_row= m_curr_row_end; - my_snprintf(msg, sizeof(msg),"Update_rows_log_event::unpack_current_row() on table %c%s%c", - quote_char, table_name, quote_char); + my_snprintf(msg, sizeof msg, + "Update_rows_log_event::unpack_current_row() on table %c%.*s%c", + quote_char, int(table_name.length), table_name.str, quote_char); message= msg; #ifdef WSREP_PROC_INFO my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, - "Update_rows_log_event::unpack_current_row(%lld) on table %c%s%c", - (long long) wsrep_thd_trx_seqno(thd), quote_char, table_name, - quote_char); + "Update_rows_log_event::unpack_current_row(%lld) on table %c%.*s%c", + (long long) wsrep_thd_trx_seqno(thd), quote_char, + int(table_name.length), table_name.str, quote_char); message= thd->wsrep_info; #endif /* WSREP_PROC_INFO */ @@ -8412,13 +8829,15 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi) DBUG_DUMP("new values", m_table->record[0], m_table->s->reclength); #endif - my_snprintf(msg, sizeof(msg),"Update_rows_log_event::ha_update_row() on table %c%s%c", - quote_char, table_name, quote_char); + my_snprintf(msg, sizeof msg, + "Update_rows_log_event::ha_update_row() on table %c%.*s%c", + quote_char, int(table_name.length), table_name.str, quote_char); message= msg; #ifdef WSREP_PROC_INFO my_snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, - "Update_rows_log_event::ha_update_row(%lld) on table %c%s%c", - (long long) wsrep_thd_trx_seqno(thd), quote_char, table_name, quote_char); + "Update_rows_log_event::ha_update_row(%lld) on table %c%.*s%c", + (long long) wsrep_thd_trx_seqno(thd), quote_char, + int(table_name.length), table_name.str, quote_char); message= thd->wsrep_info; #endif /* WSREP_PROC_INFO */ diff --git a/sql/mdl.cc b/sql/mdl.cc index c2475bb3b914b..6cb27efba127f 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2007, 2012, Oracle and/or its affiliates. - Copyright (c) 2020, 2021, MariaDB + Copyright (c) 2020, 2022, 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 @@ -30,6 +30,9 @@ #include #include #include +#ifdef WITH_WSREP +#include "wsrep_mysqld.h" +#endif static PSI_memory_key key_memory_MDL_context_acquire_locks; @@ -247,25 +250,32 @@ class Deadlock_detection_visitor: public MDL_wait_for_graph_visitor Print a list of all locks to DBUG trace to help with debugging */ +const char *dbug_print_mdl(MDL_ticket *mdl_ticket) +{ + thread_local char buffer[256]; + MDL_key *mdl_key= mdl_ticket->get_key(); + my_snprintf(buffer, sizeof(buffer) - 1, "%.*s/%.*s (%s)", + (int) mdl_key->db_name_length(), mdl_key->db_name(), + (int) mdl_key->name_length(), mdl_key->name(), + mdl_ticket->get_type_name()->str); + return buffer; +} + + static int mdl_dbug_print_lock(MDL_ticket *mdl_ticket, void *arg, bool granted) { String *tmp= (String*) arg; - char buffer[128]; - MDL_key *mdl_key= mdl_ticket->get_key(); - size_t length; - length= my_snprintf(buffer, sizeof(buffer)-1, - "\nname: %s db: %.*s key_name: %.*s (%s)", - mdl_ticket->get_type_name()->str, - (int) mdl_key->db_name_length(), mdl_key->db_name(), - (int) mdl_key->name_length(), mdl_key->name(), - granted ? "granted" : "waiting"); + char buffer[256]; + size_t length= my_snprintf(buffer, sizeof(buffer) - 1, + "\n %s (%s)", dbug_print_mdl(mdl_ticket), + granted ? "granted" : "waiting"); tmp->append(buffer, length); return 0; } const char *mdl_dbug_print_locks() { - static String tmp; + thread_local String tmp; mdl_iterate(mdl_dbug_print_lock, (void*) &tmp); return tmp.c_ptr(); } @@ -405,7 +415,7 @@ class MDL_lock virtual bool needs_notification(const MDL_ticket *ticket) const = 0; virtual bool conflicting_locks(const MDL_ticket *ticket) const = 0; virtual bitmap_t hog_lock_types_bitmap() const = 0; - virtual ~MDL_lock_strategy() {} + virtual ~MDL_lock_strategy() = default; }; @@ -416,7 +426,7 @@ class MDL_lock */ struct MDL_scoped_lock : public MDL_lock_strategy { - MDL_scoped_lock() {} + MDL_scoped_lock() = default; virtual const bitmap_t *incompatible_granted_types_bitmap() const { return m_granted_incompatible; } virtual const bitmap_t *incompatible_waiting_types_bitmap() const @@ -453,7 +463,7 @@ class MDL_lock */ struct MDL_object_lock : public MDL_lock_strategy { - MDL_object_lock() {} + MDL_object_lock() = default; virtual const bitmap_t *incompatible_granted_types_bitmap() const { return m_granted_incompatible; } virtual const bitmap_t *incompatible_waiting_types_bitmap() const @@ -497,7 +507,7 @@ class MDL_lock struct MDL_backup_lock: public MDL_lock_strategy { - MDL_backup_lock() {} + MDL_backup_lock() = default; virtual const bitmap_t *incompatible_granted_types_bitmap() const { return m_granted_incompatible; } virtual const bitmap_t *incompatible_waiting_types_bitmap() const @@ -1177,6 +1187,7 @@ MDL_wait::timed_wait(MDL_context_owner *owner, struct timespec *abs_timeout, wait_result != ETIMEDOUT && wait_result != ETIME) { #ifdef WITH_WSREP +# ifdef ENABLED_DEBUG_SYNC // Allow tests to block the applier thread using the DBUG facilities DBUG_EXECUTE_IF("sync.wsrep_before_mdl_wait", { @@ -1186,6 +1197,7 @@ MDL_wait::timed_wait(MDL_context_owner *owner, struct timespec *abs_timeout, DBUG_ASSERT(!debug_sync_set_action((owner->get_thd()), STRING_WITH_LEN(act))); };); +# endif if (WSREP_ON && wsrep_thd_is_BF(owner->get_thd(), false)) { wait_result= mysql_cond_wait(&m_COND_wait_status, &m_LOCK_wait_status); @@ -1735,10 +1747,9 @@ MDL_lock::can_grant_lock(enum_mdl_type type_arg, #ifdef WITH_WSREP /* Approve lock request in BACKUP namespace for BF threads. - We should get rid of this code and forbid FTWRL/BACKUP statements - when wsrep is active. */ - if ((wsrep_thd_is_toi(requestor_ctx->get_thd()) || + if (!wsrep_check_mode(WSREP_MODE_BF_MARIABACKUP) && + (wsrep_thd_is_toi(requestor_ctx->get_thd()) || wsrep_thd_is_applying(requestor_ctx->get_thd())) && key.mdl_namespace() == MDL_key::BACKUP) { @@ -1864,13 +1875,11 @@ bool MDL_lock::has_pending_conflicting_lock(enum_mdl_type type) MDL_wait_for_graph_visitor::~MDL_wait_for_graph_visitor() -{ -} += default; MDL_wait_for_subgraph::~MDL_wait_for_subgraph() -{ -} += default; /** Check if ticket represents metadata lock of "stronger" or equal type @@ -2232,8 +2241,8 @@ bool MDL_lock::check_if_conflicting_replication_locks(MDL_context *ctx) /* If the conflicting thread is another parallel replication - thread for the same master and it's not in commit stage, then - the current transaction has started too early and something is + thread for the same master and it's not in commit or post-commit stages, + then the current transaction has started too early and something is seriously wrong. */ if (conflicting_rgi_slave && @@ -2241,7 +2250,9 @@ bool MDL_lock::check_if_conflicting_replication_locks(MDL_context *ctx) conflicting_rgi_slave->rli == rgi_slave->rli && conflicting_rgi_slave->current_gtid.domain_id == rgi_slave->current_gtid.domain_id && - !conflicting_rgi_slave->did_mark_start_commit) + !((conflicting_rgi_slave->did_mark_start_commit || + conflicting_rgi_slave->worker_error) || + conflicting_rgi_slave->finish_event_group_called)) return 1; // Fatal error } } @@ -2269,13 +2280,19 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) MDL_ticket *ticket; MDL_wait::enum_wait_status wait_status; DBUG_ENTER("MDL_context::acquire_lock"); +#ifdef DBUG_TRACE + const char *mdl_lock_name= get_mdl_lock_name( + mdl_request->key.mdl_namespace(), mdl_request->type)->str; +#endif DBUG_PRINT("enter", ("lock_type: %s timeout: %f", - get_mdl_lock_name(mdl_request->key.mdl_namespace(), - mdl_request->type)->str, + mdl_lock_name, lock_wait_timeout)); if (try_acquire_lock_impl(mdl_request, &ticket)) + { + DBUG_PRINT("mdl", ("OOM: %s", mdl_lock_name)); DBUG_RETURN(TRUE); + } if (mdl_request->ticket) { @@ -2285,9 +2302,14 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) accordingly, so we can simply return success. */ DBUG_PRINT("info", ("Got lock without waiting")); + DBUG_PRINT("mdl", ("Seized: %s", dbug_print_mdl(mdl_request->ticket))); DBUG_RETURN(FALSE); } +#ifdef DBUG_TRACE + const char *ticket_msg= dbug_print_mdl(ticket); +#endif + /* Our attempt to acquire lock without waiting has failed. As a result of this attempt we got MDL_ticket with m_lock @@ -2298,6 +2320,7 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) if (lock_wait_timeout == 0) { + DBUG_PRINT("mdl", ("Nowait: %s", ticket_msg)); mysql_prlock_unlock(&lock->m_rwlock); MDL_ticket::destroy(ticket); my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0)); @@ -2358,6 +2381,7 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) locker= PSI_CALL_start_metadata_wait(&state, ticket->m_psi, __FILE__, __LINE__); #endif + DBUG_PRINT("mdl", ("Waiting: %s", ticket_msg)); will_wait_for(ticket); /* There is a shared or exclusive lock on the object. */ @@ -2415,15 +2439,16 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) switch (wait_status) { case MDL_wait::VICTIM: - DBUG_LOCK_FILE; - DBUG_PRINT("mdl_locks", ("%s", mdl_dbug_print_locks())); - DBUG_UNLOCK_FILE; + DBUG_PRINT("mdl", ("Deadlock: %s", ticket_msg)); + DBUG_PRINT("mdl_locks", ("Existing locks:%s", mdl_dbug_print_locks())); my_error(ER_LOCK_DEADLOCK, MYF(0)); break; case MDL_wait::TIMEOUT: + DBUG_PRINT("mdl", ("Timeout: %s", ticket_msg)); my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0)); break; case MDL_wait::KILLED: + DBUG_PRINT("mdl", ("Killed: %s", ticket_msg)); get_thd()->send_kill_message(); break; default: @@ -2447,6 +2472,7 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) mysql_mdl_set_status(ticket->m_psi, MDL_ticket::GRANTED); + DBUG_PRINT("mdl", ("Acquired: %s", ticket_msg)); DBUG_RETURN(FALSE); } @@ -2868,6 +2894,7 @@ void MDL_context::release_lock(enum_mdl_duration duration, MDL_ticket *ticket) lock->key.db_name(), lock->key.name())); DBUG_ASSERT(this == ticket->get_ctx()); + DBUG_PRINT("mdl", ("Released: %s", dbug_print_mdl(ticket))); lock->remove_ticket(m_pins, &MDL_lock::m_granted, ticket); diff --git a/sql/mdl.h b/sql/mdl.h index 31ac4e81377df..998f34ff2bb98 100644 --- a/sql/mdl.h +++ b/sql/mdl.h @@ -60,7 +60,7 @@ typedef unsigned short mdl_bitmap_t; class MDL_context_owner { public: - virtual ~MDL_context_owner() {} + virtual ~MDL_context_owner() = default; /** Enter a condition wait. @@ -471,7 +471,7 @@ struct MDL_key { mdl_key_init(namespace_arg, db_arg, name_arg); } - MDL_key() {} /* To use when part of MDL_request. */ + MDL_key() = default; /* To use when part of MDL_request. */ /** Get thread state name to be used in case when we have to @@ -640,7 +640,7 @@ class MDL_wait_for_graph_visitor virtual bool inspect_edge(MDL_context *dest) = 0; virtual ~MDL_wait_for_graph_visitor(); - MDL_wait_for_graph_visitor() {} + MDL_wait_for_graph_visitor() = default; }; /** @@ -799,7 +799,7 @@ class MDL_ticket : public MDL_wait_for_subgraph, public ilist_node<> class MDL_savepoint { public: - MDL_savepoint() {}; + MDL_savepoint() = default;; private: MDL_savepoint(MDL_ticket *stmt_ticket, MDL_ticket *trans_ticket) diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc index c7c3079f28f32..2701dac56c405 100644 --- a/sql/multi_range_read.cc +++ b/sql/multi_range_read.cc @@ -179,6 +179,8 @@ handler::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, { /* Can't scan one range => can't do MRR scan at all */ total_rows= HA_POS_ERROR; + if (thd->is_error()) + DBUG_RETURN(HA_POS_ERROR); break; } if (pages.first_page == UNUSED_PAGE_NO) diff --git a/sql/multi_range_read.h b/sql/multi_range_read.h index 37a00e3086f6a..57cfd21727f80 100644 --- a/sql/multi_range_read.h +++ b/sql/multi_range_read.h @@ -204,7 +204,7 @@ class Mrr_reader public: virtual int get_next(range_id_t *range_info) = 0; virtual int refill_buffer(bool initial) = 0; - virtual ~Mrr_reader() {}; /* just to remove compiler warning */ + virtual ~Mrr_reader() = default; /* just to remove compiler warning */ }; diff --git a/sql/my_apc.h b/sql/my_apc.h index cc98e36bbe4e8..2c0a9ade31419 100644 --- a/sql/my_apc.h +++ b/sql/my_apc.h @@ -92,7 +92,7 @@ class Apc_target public: /* This function will be called in the target thread */ virtual void call_in_target_thread()= 0; - virtual ~Apc_call() {} + virtual ~Apc_call() = default; }; /* Make a call in the target thread (see function definition for details) */ diff --git a/sql/my_json_writer.h b/sql/my_json_writer.h index 7840476b8780a..87d1a7facf15f 100644 --- a/sql/my_json_writer.h +++ b/sql/my_json_writer.h @@ -398,12 +398,14 @@ class Json_writer_struct public: +#ifdef ENABLED_JSON_WRITER_CONSISTENCY_CHECKS virtual ~Json_writer_struct() { -#ifdef ENABLED_JSON_WRITER_CONSISTENCY_CHECKS named_items_expectation.pop_back(); -#endif } +#else + virtual ~Json_writer_struct() = default; +#endif bool trace_started() const { diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc index d2fcb5858a826..1543cb5ca5686 100644 --- a/sql/mysql_install_db.cc +++ b/sql/mysql_install_db.cc @@ -129,15 +129,6 @@ ATTRIBUTE_NORETURN static void die(const char *fmt, ...) fprintf(stderr, "FATAL ERROR: "); vfprintf(stderr, fmt, args); fputc('\n', stderr); - if (verbose_errors) - { - fprintf(stderr, - "https://mariadb.com/kb/en/installation-issues-on-windows%20contains%20some%20help/n" - "for solving the most common problems. If this doesn't help you, please\n" - "leave a comment in the Knowledge Base or file a bug report at\n" - "https://jira.mariadb.org/"); - } - fflush(stderr); va_end(args); my_end(0); exit(1); @@ -254,8 +245,6 @@ int main(int argc, char **argv) DBUG_ASSERT(datadir); - /* Print some help on errors */ - verbose_errors= TRUE; /* Workaround WiX bug (strip possible quote character at the end of path) */ size_t len= strlen(datadir); @@ -288,11 +277,11 @@ int main(int argc, char **argv) Convert slashes in paths into MySQL-compatible form */ -static void convert_slashes(char *s) +static void convert_slashes(char *s, char replacement) { - for (; *s ; s++) - if (*s == '\\') - *s= '/'; + for (; *s; s++) + if (*s == '\\' || *s == '/') + *s= replacement; } @@ -302,15 +291,16 @@ static void convert_slashes(char *s) E.g basedir for C:\my\bin\mysqld.exe would be C:\my */ -static void get_basedir(char *basedir, int size, const char *mysqld_path) +static void get_basedir(char *basedir, int size, const char *mysqld_path, + char slash) { strcpy_s(basedir, size, mysqld_path); - convert_slashes(basedir); - char *p= strrchr(basedir,'/'); + convert_slashes(basedir, '\\'); + char *p= strrchr(basedir, '\\'); if (p) { *p = 0; - p= strrchr(basedir, '/'); + p= strrchr(basedir, '\\'); if (p) *p= 0; } @@ -322,8 +312,8 @@ static void get_basedir(char *basedir, int size, const char *mysqld_path) static char *get_plugindir() { static char plugin_dir[2*MAX_PATH]; - get_basedir(plugin_dir, sizeof(plugin_dir), mysqld_path); - strcat(plugin_dir, "/" STR(INSTALL_PLUGINDIR)); + get_basedir(plugin_dir, sizeof(plugin_dir), mysqld_path, '/'); + safe_strcat(plugin_dir, sizeof(plugin_dir), "/" STR(INSTALL_PLUGINDIR)); if (access(plugin_dir, 0) == 0) return plugin_dir; @@ -345,7 +335,7 @@ static char *init_bootstrap_command_line(char *cmdline, size_t size) " %s" " --bootstrap" " --datadir=." - " --loose-innodb-buffer-pool-size=10M" + " --loose-innodb-buffer-pool-size=20M" "\"" , mysqld_path, opt_verbose_bootstrap ? "--console" : ""); return cmdline; @@ -393,7 +383,7 @@ static int create_myini() } /* Write out server settings. */ - convert_slashes(path_buf); + convert_slashes(path_buf,'/'); write_myini_str("datadir",path_buf); if (opt_skip_networking) @@ -600,7 +590,8 @@ static void clean_directory(const char *dir) (defined as username or group string or as SID) */ -static int set_directory_permissions(const char *dir, const char *os_user) +static int set_directory_permissions(const char *dir, const char *os_user, + DWORD permission) { struct{ @@ -676,12 +667,19 @@ static int set_directory_permissions(const char *dir, const char *os_user) ea.Trustee.TrusteeForm= TRUSTEE_IS_SID; ea.Trustee.ptstrName= (LPTSTR)pSid; } + ea.Trustee.TrusteeType= TRUSTEE_IS_UNKNOWN; ea.grfAccessMode= GRANT_ACCESS; - ea.grfAccessPermissions= GENERIC_ALL; - ea.grfInheritance= CONTAINER_INHERIT_ACE|OBJECT_INHERIT_ACE; - ea.Trustee.TrusteeType= TRUSTEE_IS_UNKNOWN; - ACL* pNewDACL= 0; - SetEntriesInAcl(1,&ea,pOldDACL,&pNewDACL); + ea.grfAccessPermissions= permission; + ea.grfInheritance= CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE; + ACL *pNewDACL= 0; + + ACCESS_MASK access_mask; + if (GetEffectiveRightsFromAcl(pOldDACL, &ea.Trustee, &access_mask) != ERROR_SUCCESS + || (access_mask & permission) != permission) + { + SetEntriesInAcl(1, &ea, pOldDACL, &pNewDACL); + } + if (pNewDACL) { SetSecurityInfo(hDir,SE_FILE_OBJECT,DACL_SECURITY_INFORMATION,NULL, NULL, @@ -695,7 +693,65 @@ static int set_directory_permissions(const char *dir, const char *os_user) return 0; } +static void set_permissions(const char *datadir, const char *service_user) +{ + /* + Set data directory permissions for both current user and + the one who who runs services. + */ + set_directory_permissions(datadir, NULL, + FILE_GENERIC_READ | FILE_GENERIC_WRITE); + if (!service_user) + return; + + /* Datadir permission for the service. */ + set_directory_permissions(datadir, service_user, FILE_ALL_ACCESS); + char basedir[MAX_PATH]; + char path[MAX_PATH]; + struct + { + const char *subdir; + DWORD perm; + } all_subdirs[]= { + {STR(INSTALL_PLUGINDIR), FILE_GENERIC_READ | FILE_GENERIC_EXECUTE}, + {STR(INSTALL_SHAREDIR), FILE_GENERIC_READ}, + }; + + + if (strncmp(service_user,"NT SERVICE\\",sizeof("NT SERVICE\\")-1) == 0) + { + /* + Read and execute permission for executables can/should be given + to any service account, rather than specific one. + */ + service_user="NT SERVICE\\ALL SERVICES"; + } + + get_basedir(basedir, sizeof(basedir), mysqld_path, '\\'); + for (int i= 0; i < array_elements(all_subdirs); i++) + { + auto subdir= + snprintf(path, sizeof(path), "%s\\%s", basedir, all_subdirs[i].subdir); + if (access(path, 0) == 0) + { + set_directory_permissions(path, service_user, all_subdirs[i].perm); + } + } + + /* Bindir, the directory where mysqld_path is located. */ + strcpy_s(path, mysqld_path); + char *end= strrchr(path, '/'); + if (!end) + end= strrchr(path, '\\'); + if (end) + *end= 0; + if (access(path, 0) == 0) + { + set_directory_permissions(path, service_user, + FILE_GENERIC_READ | FILE_GENERIC_EXECUTE); + } +} /* Create database instance (including registering as service etc) .*/ @@ -776,19 +832,13 @@ static int create_db_instance(const char *datadir) goto end; service_created = true; } + + set_permissions(datadir, service_user.c_str()); + if (opt_large_pages) { handle_user_privileges(service_user.c_str(), L"SeLockMemoryPrivilege", true); } - /* - Set data directory permissions for both current user and - the one who who runs services. - */ - set_directory_permissions(datadir, NULL); - if (!service_user.empty()) - { - set_directory_permissions(datadir, service_user.c_str()); - } /* Get security descriptor for the data directory. diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f23f485b9a6b0..e0c830f8618b9 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -78,6 +78,7 @@ #ifdef WITH_WSREP #include "wsrep_thd.h" #include "wsrep_sst.h" +#include "wsrep_server_state.h" #endif /* WITH_WSREP */ #include "proxy_protocol.h" @@ -132,6 +133,8 @@ #include +#include + #define mysqld_charset &my_charset_latin1 @@ -390,7 +393,6 @@ my_bool opt_show_slave_auth_info; my_bool opt_log_slave_updates= 0; my_bool opt_replicate_annotate_row_events= 0; my_bool opt_mysql56_temporal_format=0, strict_password_validation= 1; -my_bool opt_explicit_defaults_for_timestamp= 0; char *opt_slave_skip_errors; char *opt_slave_transaction_retry_errors; @@ -911,6 +913,8 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list, key_LOCK_user_conn, key_LOCK_uuid_short_generator, key_LOG_LOCK_log, key_master_info_data_lock, key_master_info_run_lock, key_master_info_sleep_lock, key_master_info_start_stop_lock, + key_master_info_start_alter_lock, + key_master_info_start_alter_list_lock, key_mutex_slave_reporting_capability_err_lock, key_relay_log_info_data_lock, key_rpl_group_info_sleep_lock, key_relay_log_info_log_space_lock, key_relay_log_info_run_lock, @@ -995,6 +999,8 @@ static PSI_mutex_info all_server_mutexes[]= { &key_master_info_start_stop_lock, "Master_info::start_stop_lock", 0}, { &key_master_info_run_lock, "Master_info::run_lock", 0}, { &key_master_info_sleep_lock, "Master_info::sleep_lock", 0}, + { &key_master_info_start_alter_lock, "Master_info::start_alter_lock", 0}, + { &key_master_info_start_alter_list_lock, "Master_info::start_alter_lock", 0}, { &key_mutex_slave_reporting_capability_err_lock, "Slave_reporting_capability::err_lock", 0}, { &key_relay_log_info_data_lock, "Relay_log_info::data_lock", 0}, { &key_relay_log_info_log_space_lock, "Relay_log_info::log_space_lock", 0}, @@ -1241,8 +1247,7 @@ class Buffered_log : public Sql_alloc public: Buffered_log(enum loglevel level, const char *message); - ~Buffered_log() - {} + ~Buffered_log() = default; void print(void); @@ -1302,11 +1307,9 @@ void Buffered_log::print() class Buffered_logs { public: - Buffered_logs() - {} + Buffered_logs() = default; - ~Buffered_logs() - {} + ~Buffered_logs() = default; void init(); void cleanup(); @@ -1555,15 +1558,22 @@ static void kill_thread(THD *thd) /** First shutdown everything but slave threads and binlog dump connections */ -static my_bool kill_thread_phase_1(THD *thd, void *) +static my_bool kill_thread_phase_1(THD *thd, int *n_threads_awaiting_ack) { DBUG_PRINT("quit", ("Informing thread %ld that it's time to die", (ulong) thd->thread_id)); - if (thd->slave_thread || thd->is_binlog_dump_thread()) + + if (thd->slave_thread || thd->is_binlog_dump_thread() || + (shutdown_wait_for_slaves && + repl_semisync_master.is_thd_awaiting_semisync_ack(thd) && + ++(*n_threads_awaiting_ack))) return 0; - if (DBUG_IF("only_kill_system_threads") ? !thd->system_thread : 0) + if (DBUG_IF("only_kill_system_threads") && !thd->system_thread) + return 0; + if (DBUG_IF("only_kill_system_threads_no_loop") && !thd->system_thread) return 0; + thd->awake(KILL_SERVER_HARD); return 0; } @@ -1574,7 +1584,7 @@ static my_bool kill_thread_phase_1(THD *thd, void *) */ static my_bool kill_thread_phase_2(THD *thd, void *) { - if (shutdown_wait_for_slaves) + if (shutdown_wait_for_slaves && thd->is_binlog_dump_thread()) { thd->set_killed(KILL_SERVER); } @@ -1698,6 +1708,7 @@ void kill_mysql(THD *thd) shutdown_thread_id= thd->thread_id; DBUG_EXECUTE_IF("mysql_admin_shutdown_wait_for_slaves", thd->lex->is_shutdown_wait_for_slaves= true;); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("simulate_delay_at_shutdown", { DBUG_ASSERT(binlog_dump_thread_count == 3); @@ -1707,6 +1718,7 @@ void kill_mysql(THD *thd) DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act))); };); +#endif if (thd->lex->is_shutdown_wait_for_slaves) shutdown_wait_for_slaves= true; @@ -1747,11 +1759,32 @@ static void close_connections(void) This will give the threads some time to gracefully abort their statements and inform their clients that the server is about to die. */ - server_threads.iterate(kill_thread_phase_1); + DBUG_EXECUTE_IF("mysqld_delay_kill_threads_phase_1", my_sleep(200000);); + int n_threads_awaiting_ack= 0; + server_threads.iterate(kill_thread_phase_1, &n_threads_awaiting_ack); + + /* + If we are waiting on any ACKs, delay killing the thread until either an ACK + is received or the timeout is hit. + + Allow at max the number of sessions to await a timeout; however, if all + ACKs have been received in less iterations, then quit early + */ + if (shutdown_wait_for_slaves && repl_semisync_master.get_master_enabled()) + { + int waiting_threads= repl_semisync_master.sync_get_master_wait_sessions(); + if (waiting_threads) + sql_print_information("Delaying shutdown to await semi-sync ACK"); + + while (waiting_threads-- > 0) + repl_semisync_master.await_slave_reply(); + } + + DBUG_EXECUTE_IF("delay_shutdown_phase_2_after_semisync_wait", + my_sleep(500000);); Events::deinit(); slave_prepare_for_shutdown(); - mysql_bin_log.stop_background_thread(); ack_receiver.stop(); /* @@ -1770,8 +1803,13 @@ static void close_connections(void) */ DBUG_PRINT("info", ("THD_count: %u", THD_count::value())); - for (int i= 0; (THD_count::connection_thd_count()) && i < 1000; i++) + for (int i= 0; THD_count::connection_thd_count() - n_threads_awaiting_ack + && i < 1000; i++) + { + if (DBUG_IF("only_kill_system_threads_no_loop")) + break; my_sleep(20000); + } if (global_system_variables.log_warnings) server_threads.iterate(warn_threads_active_after_phase_1); @@ -1781,12 +1819,18 @@ static void close_connections(void) { wsrep_deinit(true); } + wsrep_sst_auth_free(); #endif /* All threads has now been aborted */ - DBUG_PRINT("quit", ("Waiting for threads to die (count=%u)", THD_count::value())); + DBUG_PRINT("quit", ("Waiting for threads to die (count=%u)", + THD_count::connection_thd_count() - n_threads_awaiting_ack)); - while (THD_count::connection_thd_count()) + while (THD_count::connection_thd_count() - n_threads_awaiting_ack) + { + if (DBUG_IF("only_kill_system_threads_no_loop")) + break; my_sleep(1000); + } /* Kill phase 2 */ server_threads.iterate(kill_thread_phase_2); @@ -1823,6 +1867,13 @@ extern "C" sig_handler print_signal_warning(int sig) #endif } +#ifdef _WIN32 +typedef void (*report_svc_status_t)(DWORD current_state, DWORD win32_exit_code, + DWORD wait_hint); +static void dummy_svc_status(DWORD, DWORD, DWORD) {} +static report_svc_status_t my_report_svc_status= dummy_svc_status; +#endif + #ifndef EMBEDDED_LIBRARY extern "C" void unireg_abort(int exit_code) { @@ -1868,13 +1919,6 @@ extern "C" void unireg_abort(int exit_code) mysqld_exit(exit_code); } -#ifdef _WIN32 -typedef void (*report_svc_status_t)(DWORD current_state, DWORD win32_exit_code, - DWORD wait_hint); -static void dummy_svc_status(DWORD, DWORD, DWORD) {} -static report_svc_status_t my_report_svc_status= dummy_svc_status; -#endif - static void mysqld_exit(int exit_code) { DBUG_ENTER("mysqld_exit"); @@ -2505,6 +2549,7 @@ static void use_systemd_activated_sockets() addr.un.sun_path[0] = '@'; sql_print_information("Using systemd activated unix socket %s%s", addr.un.sun_path, sock.is_extra_port ? " (extra)" : ""); + memset(addr.un.sun_path, 0, sizeof(addr.un.sun_path)); } else { @@ -2669,11 +2714,9 @@ void close_connection(THD *thd, uint sql_errno) thd->protocol->net_send_error(thd, sql_errno, ER_DEFAULT(sql_errno), NULL); thd->print_aborted_warning(lvl, ER_DEFAULT(sql_errno)); } - else - thd->print_aborted_warning(lvl, (thd->main_security_ctx.user ? - "This connection closed normally" : - "This connection closed normally without" - " authentication")); + else if (!thd->main_security_ctx.user) + thd->print_aborted_warning(lvl, "This connection closed normally without" + " authentication"); thd->disconnect(); @@ -2782,6 +2825,12 @@ void mysqld_win_set_startup_complete() } +void mysqld_win_extend_service_timeout(DWORD sec) +{ + my_report_svc_status((DWORD)-1, 0, 2*1000*sec); +} + + void mysqld_win_set_service_name(const char *name) { if (stricmp(name, "mysql")) @@ -3162,7 +3211,7 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused))) sql_print_information("Got signal %d to shutdown server",sig); #endif /* switch to the old log message processing */ - logger.set_handlers(LOG_FILE, global_system_variables.sql_log_slow ? LOG_FILE:LOG_NONE, + logger.set_handlers(global_system_variables.sql_log_slow ? LOG_FILE:LOG_NONE, opt_log ? LOG_FILE:LOG_NONE); DBUG_PRINT("info",("Got signal: %d abort_loop: %d",sig,abort_loop)); if (!abort_loop) @@ -3204,8 +3253,8 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused))) ulonglong fixed_log_output_options= log_output_options & LOG_NONE ? LOG_TABLE : log_output_options; - logger.set_handlers(LOG_FILE, global_system_variables.sql_log_slow - ? fixed_log_output_options : LOG_NONE, + logger.set_handlers(global_system_variables.sql_log_slow + ? fixed_log_output_options : LOG_NONE, opt_log ? fixed_log_output_options : LOG_NONE); } break; @@ -3669,13 +3718,18 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific) /* Ensure we don't get called here again */ char buf[50], *buf2; thd->set_killed(KILL_QUERY); - my_snprintf(buf, sizeof(buf), "--max-thread-mem-used=%llu", + my_snprintf(buf, sizeof(buf), "--max-session-mem-used=%llu", thd->variables.max_mem_used); if ((buf2= (char*) thd->alloc(256))) { my_snprintf(buf2, 256, ER_THD(thd, ER_OPTION_PREVENTS_STATEMENT), buf); thd->set_killed(KILL_QUERY, ER_OPTION_PREVENTS_STATEMENT, buf2); } + else + { + thd->set_killed(KILL_QUERY, ER_OPTION_PREVENTS_STATEMENT, + "--max-session-mem-used"); + } } DBUG_ASSERT((longlong) thd->status_var.local_memory_used >= 0 || !debug_assert_on_not_freed_memory); @@ -3847,14 +3901,24 @@ static int init_common_variables() if (ignore_db_dirs_init()) exit(1); -#ifdef _WIN32 - get_win_tzname(system_time_zone, sizeof(system_time_zone)); -#elif defined(HAVE_TZNAME) struct tm tm_tmp; - localtime_r(&server_start_time,&tm_tmp); - const char *tz_name= tzname[tm_tmp.tm_isdst != 0 ? 1 : 0]; - strmake_buf(system_time_zone, tz_name); -#endif /* HAVE_TZNAME */ + localtime_r(&server_start_time, &tm_tmp); + +#ifdef HAVE_TZNAME +#ifdef _WIN32 + /* + If env.variable TZ is set, derive timezone name from it. + Otherwise, use IANA tz name from get_win_tzname. + */ + if (!getenv("TZ")) + get_win_tzname(system_time_zone, sizeof(system_time_zone)); + else +#endif + { + const char *tz_name= tzname[tm_tmp.tm_isdst != 0 ? 1 : 0]; + strmake_buf(system_time_zone, tz_name); + } +#endif /* We set SYSTEM time zone as reasonable default and @@ -3981,21 +4045,6 @@ static int init_common_variables() mysql_real_data_home_len= uint(strlen(mysql_real_data_home)); - if (!opt_abort) - { - if (IS_SYSVAR_AUTOSIZE(&server_version_ptr)) - sql_print_information("%s (server %s) starting as process %lu ...", - my_progname, server_version, (ulong) getpid()); - else - { - char real_server_version[SERVER_VERSION_LENGTH]; - set_server_version(real_server_version, sizeof(real_server_version)); - sql_print_information("%s (server %s as %s) starting as process %lu ...", - my_progname, real_server_version, server_version, - (ulong) getpid()); - } - } - sf_leaking_memory= 0; // no memory leaks from now on #ifndef EMBEDDED_LIBRARY @@ -4058,8 +4107,8 @@ static int init_common_variables() files= my_set_max_open_files(max_open_files); SYSVAR_AUTOSIZE_IF_CHANGED(open_files_limit, files, ulong); - if (files < wanted_files && global_system_variables.log_warnings) - sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, wanted_files); + if (files < max_open_files && global_system_variables.log_warnings) + sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, max_open_files); /* If we required too much tc_instances than we reduce */ SYSVAR_AUTOSIZE_IF_CHANGED(tc_instances, @@ -4237,15 +4286,15 @@ static int init_common_variables() /* check log options and issue warnings if needed */ if (opt_log && opt_logname && *opt_logname && !(log_output_options & (LOG_FILE | LOG_NONE))) - sql_print_warning("Although a path was specified for the " - "--log option, log tables are used. " + sql_print_warning("Although a general log file was specified, " + "log tables are used. " "To enable logging to files use the --log-output option."); if (global_system_variables.sql_log_slow && opt_slow_logname && *opt_slow_logname && !(log_output_options & (LOG_FILE | LOG_NONE))) - sql_print_warning("Although a path was specified for the " - "--log-slow-queries option, log tables are used. " + sql_print_warning("Although a slow query log file was specified, " + "log tables are used. " "To enable logging to files use the --log-output=file option."); if (!opt_logname || !*opt_logname) @@ -4553,6 +4602,7 @@ void ssl_acceptor_stats_update(int sslaccept_ret) static void init_ssl() { +#if !defined(EMBEDDED_LIBRARY) /* Not need to check require_secure_transport on the Linux, because it always has Unix domain sockets that are secure: @@ -4568,7 +4618,7 @@ static void init_ssl() unireg_abort(1); } #endif -#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) +#if defined(HAVE_OPENSSL) if (opt_use_ssl) { enum enum_ssl_init_error error= SSL_INITERR_NOERROR; @@ -4582,8 +4632,10 @@ static void init_ssl() DBUG_PRINT("info",("ssl_acceptor_fd: %p", ssl_acceptor_fd)); if (!ssl_acceptor_fd) { - sql_print_warning("Failed to setup SSL"); - sql_print_warning("SSL error: %s", sslGetErrString(error)); + sql_print_error("Failed to setup SSL"); + sql_print_error("SSL error: %s", sslGetErrString(error)); + if (!opt_bootstrap) + unireg_abort(1); opt_use_ssl = 0; have_ssl= SHOW_OPTION_DISABLED; } @@ -4609,7 +4661,8 @@ static void init_ssl() } if (des_key_file) load_des_key_file(des_key_file); -#endif /* HAVE_OPENSSL && ! EMBEDDED_LIBRARY */ +#endif /* HAVE_OPENSSL */ +#endif /* !EMBEDDED_LIBRARY */ } /* Reinitialize SSL (FLUSH SSL) */ @@ -4848,6 +4901,14 @@ static int init_server_components() error_handler_hook= my_message_sql; proc_info_hook= set_thd_stage_info; + /* + Print source revision hash, as one of the first lines, if not the + first in error log, for troubleshooting and debugging purposes + */ + if (!opt_help) + sql_print_information("Starting MariaDB %s source revision %s as process %lu", + server_version, SOURCE_REVISION, (ulong) getpid()); + #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE /* Parsing the performance schema command line option may have reported @@ -4991,12 +5052,11 @@ static int init_server_components() else // full wsrep initialization { // add basedir/bin to PATH to resolve wsrep script names - char* const tmp_path= (char*)my_alloca(strlen(mysql_home) + - strlen("/bin") + 1); + size_t tmp_path_size= strlen(mysql_home) + 5; /* including "/bin" */ + char* const tmp_path= (char*)my_alloca(tmp_path_size); if (tmp_path) { - strcpy(tmp_path, mysql_home); - strcat(tmp_path, "/bin"); + snprintf(tmp_path, tmp_path_size, "%s/bin", mysql_home); wsrep_prepend_PATH(tmp_path); } else @@ -5258,7 +5318,7 @@ static int init_server_components() sql_print_warning("There were other values specified to " "log-output besides NONE. Disabling slow " "and general logs anyway."); - logger.set_handlers(LOG_FILE, LOG_NONE, LOG_NONE); + logger.set_handlers(LOG_NONE, LOG_NONE); } else { @@ -5274,8 +5334,7 @@ static int init_server_components() /* purecov: end */ } - logger.set_handlers(LOG_FILE, - global_system_variables.sql_log_slow ? + logger.set_handlers(global_system_variables.sql_log_slow ? log_output_options:LOG_NONE, opt_log ? log_output_options:LOG_NONE); } @@ -5336,6 +5395,9 @@ static int init_server_components() if (ha_recover(0)) unireg_abort(1); +#ifndef EMBEDDED_LIBRARY + start_handle_manager(); +#endif if (opt_bin_log) { int error; @@ -5793,8 +5855,6 @@ int mysqld_main(int argc, char **argv) } } - start_handle_manager(); - /* Copy default global rpl_filter to global_rpl_filter */ copy_filter_setting(global_rpl_filter, get_or_create_rpl_filter("", 0)); @@ -5827,8 +5887,9 @@ int mysqld_main(int argc, char **argv) char real_server_version[2 * SERVER_VERSION_LENGTH + 10]; set_server_version(real_server_version, sizeof(real_server_version)); - strcat(real_server_version, "' as '"); - strcat(real_server_version, server_version); + safe_strcat(real_server_version, sizeof(real_server_version), "' as '"); + safe_strcat(real_server_version, sizeof(real_server_version), + server_version); sql_print_information(ER_DEFAULT(ER_STARTUP), my_progname, real_server_version, @@ -6202,7 +6263,7 @@ void handle_connections_sockets() } #endif // HAVE_POLL - for (uint retry=0; retry < MAX_ACCEPT_RETRY; retry++) + for (uint retry=0; retry < MAX_ACCEPT_RETRY && !abort_loop; retry++) { size_socket length= sizeof(struct sockaddr_storage); MYSQL_SOCKET new_sock; @@ -6356,8 +6417,6 @@ struct my_option my_long_options[]= {"console", OPT_CONSOLE, "Write error output on screen; don't remove the console window on windows.", &opt_console, &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"core-file", OPT_WANT_CORE, "Write core on errors.", 0, 0, 0, GET_NO_ARG, - NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef DBUG_OFF {"debug", '#', "Built in DBUG debugger. Disabled in this build.", ¤t_dbug_option, ¤t_dbug_option, 0, GET_STR, OPT_ARG, @@ -6679,7 +6738,7 @@ struct my_option my_long_options[]= Also disable by default on Windows, due to high overhead for checking .sym files. */ - IF_VALGRIND(0,IF_WIN(0,1)), 0, 0, 0, 0, 0}, + IF_WIN(0,1), 0, 0, 0, 0, 0}, {"sysdate-is-now", 0, "Non-default option to alias SYSDATE() to NOW() to make it safe-replicable. " "Since 5.0, SYSDATE() returns a `dynamic' value different for different " @@ -6996,7 +7055,9 @@ static int show_ssl_get_cipher_list(THD *thd, SHOW_VAR *var, char *buff, rpl_semi_sync_master_show_##name #define DEF_SHOW_FUNC(name, show_type) \ - static int SHOW_FNAME(name)(MYSQL_THD thd, SHOW_VAR *var, char *buff) \ + static int SHOW_FNAME(name)(MYSQL_THD thd, SHOW_VAR *var, void *buff, \ + system_status_var *status_var, \ + enum_var_type var_type) \ { \ repl_semisync_master.set_export_stats(); \ var->type= show_type; \ @@ -7273,7 +7334,7 @@ SHOW_VAR status_vars[]= { {"Created_tmp_files", (char*) &my_tmp_file_created, SHOW_LONG}, {"Created_tmp_tables", (char*) offsetof(STATUS_VAR, created_tmp_tables_), SHOW_LONG_STATUS}, #ifndef DBUG_OFF - {"Debug", (char*) &debug_status_func, SHOW_FUNC}, + SHOW_FUNC_ENTRY("Debug", &debug_status_func), #endif {"Delayed_errors", (char*) &delayed_insert_errors, SHOW_LONG}, {"Delayed_insert_threads", (char*) &delayed_insert_threads, SHOW_LONG_NOFLUSH}, @@ -7326,7 +7387,7 @@ SHOW_VAR status_vars[]= { {"Handler_tmp_write", (char*) offsetof(STATUS_VAR, ha_tmp_write_count), SHOW_LONG_STATUS}, {"Handler_update", (char*) offsetof(STATUS_VAR, ha_update_count), SHOW_LONG_STATUS}, {"Handler_write", (char*) offsetof(STATUS_VAR, ha_write_count), SHOW_LONG_STATUS}, - {"Key", (char*) &show_default_keycache, SHOW_FUNC}, + SHOW_FUNC_ENTRY("Key", &show_default_keycache), {"Last_query_cost", (char*) offsetof(STATUS_VAR, last_query_cost), SHOW_DOUBLE_STATUS}, #ifndef DBUG_OFF {"malloc_calls", (char*) &malloc_calls, SHOW_LONG}, @@ -7354,20 +7415,20 @@ SHOW_VAR status_vars[]= { {"Rows_read", (char*) offsetof(STATUS_VAR, rows_read), SHOW_LONGLONG_STATUS}, {"Rows_tmp_read", (char*) offsetof(STATUS_VAR, rows_tmp_read), SHOW_LONGLONG_STATUS}, #ifdef HAVE_REPLICATION - {"Rpl_semi_sync_master_status", (char*) &SHOW_FNAME(status), SHOW_FUNC}, - {"Rpl_semi_sync_master_clients", (char*) &SHOW_FNAME(clients), SHOW_FUNC}, + SHOW_FUNC_ENTRY("Rpl_semi_sync_master_status", &SHOW_FNAME(status)), + SHOW_FUNC_ENTRY("Rpl_semi_sync_master_clients", &SHOW_FNAME(clients)), {"Rpl_semi_sync_master_yes_tx", (char*) &rpl_semi_sync_master_yes_transactions, SHOW_LONG}, {"Rpl_semi_sync_master_no_tx", (char*) &rpl_semi_sync_master_no_transactions, SHOW_LONG}, - {"Rpl_semi_sync_master_wait_sessions", (char*) &SHOW_FNAME(wait_sessions), SHOW_FUNC}, + SHOW_FUNC_ENTRY("Rpl_semi_sync_master_wait_sessions", &SHOW_FNAME(wait_sessions)), {"Rpl_semi_sync_master_no_times", (char*) &rpl_semi_sync_master_off_times, SHOW_LONG}, {"Rpl_semi_sync_master_timefunc_failures", (char*) &rpl_semi_sync_master_timefunc_fails, SHOW_LONG}, {"Rpl_semi_sync_master_wait_pos_backtraverse", (char*) &rpl_semi_sync_master_wait_pos_backtraverse, SHOW_LONG}, - {"Rpl_semi_sync_master_tx_wait_time", (char*) &SHOW_FNAME(trx_wait_time), SHOW_FUNC}, - {"Rpl_semi_sync_master_tx_waits", (char*) &SHOW_FNAME(trx_wait_num), SHOW_FUNC}, - {"Rpl_semi_sync_master_tx_avg_wait_time", (char*) &SHOW_FNAME(avg_trx_wait_time), SHOW_FUNC}, - {"Rpl_semi_sync_master_net_wait_time", (char*) &SHOW_FNAME(net_wait_time), SHOW_FUNC}, - {"Rpl_semi_sync_master_net_waits", (char*) &SHOW_FNAME(net_wait_num), SHOW_FUNC}, - {"Rpl_semi_sync_master_net_avg_wait_time", (char*) &SHOW_FNAME(avg_net_wait_time), SHOW_FUNC}, + SHOW_FUNC_ENTRY("Rpl_semi_sync_master_tx_wait_time", &SHOW_FNAME(trx_wait_time)), + SHOW_FUNC_ENTRY("Rpl_semi_sync_master_tx_waits", &SHOW_FNAME(trx_wait_num)), + SHOW_FUNC_ENTRY("Rpl_semi_sync_master_tx_avg_wait_time", &SHOW_FNAME(avg_trx_wait_time)), + SHOW_FUNC_ENTRY("Rpl_semi_sync_master_net_wait_time", &SHOW_FNAME(net_wait_time)), + SHOW_FUNC_ENTRY("Rpl_semi_sync_master_net_waits", &SHOW_FNAME(net_wait_num)), + SHOW_FUNC_ENTRY("Rpl_semi_sync_master_net_avg_wait_time", &SHOW_FNAME(avg_net_wait_time)), {"Rpl_semi_sync_master_request_ack", (char*) &rpl_semi_sync_master_request_ack, SHOW_LONGLONG}, {"Rpl_semi_sync_master_get_ack", (char*)&rpl_semi_sync_master_get_ack, SHOW_LONGLONG}, {"Rpl_semi_sync_slave_status", (char*) &rpl_semi_sync_slave_status, SHOW_BOOL}, @@ -7491,7 +7552,7 @@ SHOW_VAR status_vars[]= { {"wsrep_applier_thread_count", (char*) &wsrep_running_applier_threads, SHOW_LONG_NOFLUSH}, {"wsrep_rollbacker_thread_count", (char *) &wsrep_running_rollbacker_threads, SHOW_LONG_NOFLUSH}, {"wsrep_cluster_capabilities", (char*) &wsrep_cluster_capabilities, SHOW_CHAR_PTR}, - {"wsrep", (char*) &wsrep_show_status, SHOW_FUNC}, + SHOW_FUNC_ENTRY("wsrep", &wsrep_show_status), #endif {NullS, NullS, SHOW_LONG} }; @@ -7824,7 +7885,8 @@ static int mysql_init_variables(void) } else my_path(prg_dev, my_progname, "mysql/bin"); - strcat(prg_dev,"/../"); // Remove 'bin' to get base dir + // Remove 'bin' to get base dir + safe_strcat(prg_dev, sizeof(prg_dev), "/../"); cleanup_dirname(mysql_home,prg_dev); } #else @@ -7948,7 +8010,7 @@ mysqld_get_one_option(const struct my_option *opt, const char *argument, global_system_variables.log_warnings= atoi(argument); break; case 'T': - test_flags= argument ? (uint) atoi(argument) : 0; + test_flags= argument ? ((uint) atoi(argument) & ~TEST_BLOCKING) : 0; opt_endinfo=1; break; case OPT_THREAD_CONCURRENCY: @@ -8141,15 +8203,6 @@ mysqld_get_one_option(const struct my_option *opt, const char *argument, case (int) OPT_SKIP_HOST_CACHE: opt_specialflag|= SPECIAL_NO_HOST_CACHE; break; - case (int) OPT_SKIP_RESOLVE: - if ((opt_skip_name_resolve= (argument != disabled_my_option))) - opt_specialflag|= SPECIAL_NO_RESOLVE; - else - opt_specialflag&= ~SPECIAL_NO_RESOLVE; - break; - case (int) OPT_WANT_CORE: - test_flags |= TEST_CORE_ON_SIGNAL; - break; case OPT_CONSOLE: if (opt_console) opt_error_log= 0; // Force logs to stdout @@ -8694,12 +8747,16 @@ void set_server_version(char *buf, size_t size) { bool is_log= opt_log || global_system_variables.sql_log_slow || opt_bin_log; bool is_debug= IF_DBUG(!strstr(MYSQL_SERVER_SUFFIX_STR, "-debug"), 0); - bool is_valgrind= IF_VALGRIND(!strstr(MYSQL_SERVER_SUFFIX_STR, "-valgrind"), 0); + const char *is_valgrind= +#ifdef HAVE_VALGRIND + !strstr(MYSQL_SERVER_SUFFIX_STR, "-valgrind") ? "-valgrind" : +#endif + ""; strxnmov(buf, size - 1, MYSQL_SERVER_VERSION, MYSQL_SERVER_SUFFIX_STR, IF_EMBEDDED("-embedded", ""), - is_valgrind ? "-valgrind" : "", + is_valgrind, is_debug ? "-debug" : "", is_log ? "-log" : "", NullS); diff --git a/sql/mysqld.h b/sql/mysqld.h index 8c0b92c6446f5..36b17e28eab95 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -332,6 +332,8 @@ extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list, key_LOCK_user_conn, key_LOG_LOCK_log, key_master_info_data_lock, key_master_info_run_lock, key_master_info_sleep_lock, key_master_info_start_stop_lock, + key_master_info_start_alter_lock, + key_master_info_start_alter_list_lock, key_mutex_slave_reporting_capability_err_lock, key_relay_log_info_data_lock, key_relay_log_info_log_space_lock, key_relay_log_info_run_lock, key_rpl_group_info_sleep_lock, @@ -820,7 +822,6 @@ enum options_mysqld OPT_SERVER_ID, OPT_SILENT, OPT_SKIP_HOST_CACHE, - OPT_SKIP_RESOLVE, OPT_SLAVE_PARALLEL_MODE, OPT_SSL_CA, OPT_SSL_CAPATH, @@ -901,6 +902,8 @@ enum enum_query_type // it evaluates to. Should be used for error messages, so that they // don't reveal values. QT_NO_DATA_EXPANSION= (1 << 9), + // Remove wrappers added for TVC when creating or showing view + QT_NO_WRAPPERS_FOR_TVC_IN_VIEW= (1 << 12), }; @@ -963,7 +966,6 @@ extern my_bool opt_stack_trace, disable_log_notes; extern my_bool opt_expect_abort; extern my_bool opt_slave_sql_verify_checksum; extern my_bool opt_mysql56_temporal_format, strict_password_validation; -extern my_bool opt_explicit_defaults_for_timestamp; extern ulong binlog_checksum_options; extern bool max_user_connections_checking; extern ulong opt_binlog_dbug_fsync_sleep; @@ -977,6 +979,7 @@ extern int mysqld_main(int argc, char **argv); extern HANDLE hEventShutdown; extern void mysqld_win_initiate_shutdown(); extern void mysqld_win_set_startup_complete(); +extern void mysqld_win_extend_service_timeout(DWORD sec); extern void mysqld_set_service_status_callback(void (*)(DWORD, DWORD, DWORD)); extern void mysqld_win_set_service_name(const char *name); #endif diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 39b4290a16131..70e71d9a21b31 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2012, 2020, MariaDB Corporation. + Copyright (c) 2012, 2022, 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 @@ -507,6 +507,7 @@ net_write_command(NET *net,uchar command, DBUG_ENTER("net_write_command"); DBUG_PRINT("enter",("length: %lu", (ulong) len)); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("simulate_error_on_packet_write", { if (command == COM_BINLOG_DUMP) @@ -518,6 +519,7 @@ net_write_command(NET *net,uchar command, DBUG_RETURN(true); } };); +#endif MYSQL_NET_WRITE_START(length); buff[4]=command; /* For first packet */ diff --git a/sql/opt_histogram_json.cc b/sql/opt_histogram_json.cc index de0b4ebab509d..bea18050a59f6 100644 --- a/sql/opt_histogram_json.cc +++ b/sql/opt_histogram_json.cc @@ -178,22 +178,13 @@ class Histogram_json_builder : public Histogram_builder void append_histogram_params() { char buf[128]; + String str(buf, sizeof(buf), system_charset_info); + THD *thd= current_thd; + timeval tv= {thd->query_start(), 0}; // we do not need microseconds - time_t cur_time_t= my_time(0); - struct tm curtime; - localtime_r(&cur_time_t, &curtime); - - my_snprintf(buf, sizeof(buf), "%d-%02d-%02d %2d:%02d:%02d %s", - curtime.tm_year + 1900, - curtime.tm_mon+1, - curtime.tm_mday, - curtime.tm_hour, - curtime.tm_min, - curtime.tm_sec, - system_time_zone); - + Timestamp(tv).to_datetime(thd).to_string(&str, 0); writer.add_member("target_histogram_size").add_ull(hist_width); - writer.add_member("collected_at").add_str(buf); + writer.add_member("collected_at").add_str(str.ptr()); writer.add_member("collected_by").add_str(server_version); } /* @@ -968,9 +959,16 @@ std::string& Histogram_json_hb::get_end_value(int idx) @param field The table field histogram is for. We don't care about the field's current value, we only need its virtual functions to perform various operations - @param min_endp Left endpoint, or NULL if there is none @param max_endp Right endpoint, or NULL if there is none + @param avg_sel Average selectivity of "field=const" equality for this field + + @return + Range selectivity: a number between 0.0 and 1.0. + + @note + This may return 0.0. Adjustments to avoid multiply-by-zero meltdown are + made elsewhere. */ double Histogram_json_hb::range_selectivity(Field *field, key_range *min_endp, @@ -1071,6 +1069,18 @@ double Histogram_json_hb::range_selectivity(Field *field, key_range *min_endp, else max= 1.0; + if (min > max) + { + /* + This can happen due to rounding errors. + + What is the acceptable error size? Json_writer::add_double() uses + %.11lg format. This gives 9 digits after the dot. A histogram may have + hundreds of buckets, let's multiply the error by 1000. 9-3=6 + */ + DBUG_ASSERT(max < min + 1e-6); + max= min; + } return max - min; } @@ -1081,12 +1091,14 @@ void Histogram_json_hb::serialize(Field *field) } +#ifndef DBUG_OFF static int SGN(int x) { if (!x) return 0; return (x < 0)? -1 : 1; } +#endif /* diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 37cf054dfb00b..a32d4cfe24ea0 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2008, 2020, MariaDB + Copyright (c) 2008, 2021, 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 @@ -461,7 +461,7 @@ void print_range_for_non_indexed_field(String *out, Field *field, static void print_min_range_operator(String *out, const ha_rkey_function flag); static void print_max_range_operator(String *out, const ha_rkey_function flag); -static bool is_field_an_unique_index(RANGE_OPT_PARAM *param, Field *field); +static bool is_field_an_unique_index(Field *field); /* SEL_IMERGE is a list of possible ways to do index merge, i.e. it is @@ -1890,7 +1890,7 @@ SEL_ARG::SEL_ARG(SEL_ARG &arg) :Sql_alloc() next= 0; if (next_key_part) { - ++next_key_part->use_count; + next_key_part->increment_use_count(1); weight += next_key_part->weight; } } @@ -1901,10 +1901,12 @@ inline void SEL_ARG::make_root() left=right= &null_element; color=BLACK; next=prev=0; - use_count=0; elements=1; + use_count=0; + elements=1; + weight= 1 + (next_key_part? next_key_part->weight : 0); } -SEL_ARG::SEL_ARG(Field *f,const uchar *min_value_arg, +SEL_ARG::SEL_ARG(Field *f, const uchar *min_value_arg, const uchar *max_value_arg) :min_flag(0), max_flag(0), maybe_flag(0), maybe_null(f->real_maybe_null()), elements(1), use_count(1), field(f), min_value((uchar*) min_value_arg), @@ -1919,7 +1921,8 @@ SEL_ARG::SEL_ARG(Field *field_,uint8 part_, uchar *min_value_, uchar *max_value_, uint8 min_flag_,uint8 max_flag_,uint8 maybe_flag_) :min_flag(min_flag_),max_flag(max_flag_),maybe_flag(maybe_flag_), - part(part_),maybe_null(field_->real_maybe_null()), elements(1),use_count(1), + part(part_),maybe_null(field_->real_maybe_null()), + elements(1),use_count(1), field(field_), min_value(min_value_), max_value(max_value_), next(0),prev(0),next_key_part(0),color(BLACK),type(KEY_RANGE), weight(1) { @@ -1967,7 +1970,8 @@ class SEL_ARG_LT: public SEL_ARG_LE but we don't know if rounding or truncation happened (as some Field::store() do not report minor data changes). */ - SEL_ARG_LT(THD *thd, const uchar *key, Field *field, Item *value) + SEL_ARG_LT(THD *thd, const uchar *key, Field *field, + Item *value) :SEL_ARG_LE(key, field) { if (stored_field_cmp_to_item(thd, field, value) == 0) @@ -2059,7 +2063,8 @@ SEL_ARG *SEL_ARG::clone(RANGE_OPT_PARAM *param, SEL_ARG *new_parent, } else { - if (!(tmp= new (param->mem_root) SEL_ARG(field,part, min_value,max_value, + if (!(tmp= new (param->mem_root) SEL_ARG(field, part, + min_value, max_value, min_flag, max_flag, maybe_flag))) return 0; // OOM tmp->parent=new_parent; @@ -2225,7 +2230,7 @@ class TABLE_READ_PLAN { return (void*) alloc_root(mem_root, (uint) size); } static void operator delete(void *ptr,size_t size) { TRASH_FREE(ptr, size); } static void operator delete(void *ptr, MEM_ROOT *mem_root) { /* Never called */ } - virtual ~TABLE_READ_PLAN() {} /* Remove gcc warning */ + virtual ~TABLE_READ_PLAN() = default; /* Remove gcc warning */ /** Add basic info for this TABLE_READ_PLAN to the optimizer trace. @@ -2260,7 +2265,7 @@ class TRP_RANGE : public TABLE_READ_PLAN TRP_RANGE(SEL_ARG *key_arg, uint idx_arg, uint mrr_flags_arg) : key(key_arg), key_idx(idx_arg), mrr_flags(mrr_flags_arg) {} - virtual ~TRP_RANGE() {} /* Remove gcc warning */ + virtual ~TRP_RANGE() = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc) @@ -2307,8 +2312,8 @@ void TRP_RANGE::trace_basic_info(PARAM *param, class TRP_ROR_INTERSECT : public TABLE_READ_PLAN { public: - TRP_ROR_INTERSECT() {} /* Remove gcc warning */ - virtual ~TRP_ROR_INTERSECT() {} /* Remove gcc warning */ + TRP_ROR_INTERSECT() = default; /* Remove gcc warning */ + virtual ~TRP_ROR_INTERSECT() = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc); @@ -2333,8 +2338,8 @@ class TRP_ROR_INTERSECT : public TABLE_READ_PLAN class TRP_ROR_UNION : public TABLE_READ_PLAN { public: - TRP_ROR_UNION() {} /* Remove gcc warning */ - virtual ~TRP_ROR_UNION() {} /* Remove gcc warning */ + TRP_ROR_UNION() = default; /* Remove gcc warning */ + virtual ~TRP_ROR_UNION() = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc); TABLE_READ_PLAN **first_ror; /* array of ptrs to plans for merged scans */ @@ -2366,8 +2371,8 @@ void TRP_ROR_UNION::trace_basic_info(PARAM *param, class TRP_INDEX_INTERSECT : public TABLE_READ_PLAN { public: - TRP_INDEX_INTERSECT() {} /* Remove gcc warning */ - virtual ~TRP_INDEX_INTERSECT() {} /* Remove gcc warning */ + TRP_INDEX_INTERSECT() = default; /* Remove gcc warning */ + virtual ~TRP_INDEX_INTERSECT() = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc); TRP_RANGE **range_scans; /* array of ptrs to plans of intersected scans */ @@ -2403,8 +2408,8 @@ void TRP_INDEX_INTERSECT::trace_basic_info(PARAM *param, class TRP_INDEX_MERGE : public TABLE_READ_PLAN { public: - TRP_INDEX_MERGE() {} /* Remove gcc warning */ - virtual ~TRP_INDEX_MERGE() {} /* Remove gcc warning */ + TRP_INDEX_MERGE() = default; /* Remove gcc warning */ + virtual ~TRP_INDEX_MERGE() = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc); TRP_RANGE **range_scans; /* array of ptrs to plans of merged scans */ @@ -2472,7 +2477,7 @@ class TRP_GROUP_MIN_MAX : public TABLE_READ_PLAN if (key_infix_len) memcpy(this->key_infix, key_infix_arg, key_infix_len); } - virtual ~TRP_GROUP_MIN_MAX() {} /* Remove gcc warning */ + virtual ~TRP_GROUP_MIN_MAX() = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc); @@ -2695,6 +2700,8 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, notnull_cond= head->notnull_cond; if (!records) records++; /* purecov: inspected */ + if (head->file->ha_table_flags() & HA_NON_COMPARABLE_ROWID) + only_single_index_range_scan= 1; if (head->force_index || force_quick_range) scan_time= read_time= DBL_MAX; @@ -2804,7 +2811,6 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, trace_idx_details.add("usable", false).add("cause", "fulltext"); continue; // ToDo: ft-keys in non-ft ranges, if possible SerG } - trace_idx_details.add("usable", true); param.key[param.keys]=key_parts; key_part_info= key_info->key_part; @@ -2826,6 +2832,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, key_parts->flag= (uint8) key_part_info->key_part_flag; trace_keypart.add(key_parts->field->field_name); } + trace_keypart.end(); param.real_keynr[param.keys++]=idx; if (cur_key_len > max_key_len) max_key_len= cur_key_len; @@ -3239,6 +3246,7 @@ double records_in_column_ranges(PARAM *param, uint idx, seq.keyno= idx; seq.real_keyno= MAX_KEY; + seq.key_parts= param->key[idx]; seq.param= param; seq.start= tree; seq.is_ror_scan= FALSE; @@ -3285,6 +3293,25 @@ double records_in_column_ranges(PARAM *param, uint idx, } +/* + Compare quick select ranges according to number of found rows + If there is equal amounts of rows, use the long key part. + The idea is that if we have keys (a),(a,b) and (a,b,c) and we have + a query like WHERE a=1 and b=1 and c=1, + it is better to use key (a,b,c) than (a) as it will ensure we don't also + use histograms for columns b and c +*/ + +static +int cmp_quick_ranges(TABLE *table, uint *a, uint *b) +{ + int tmp= CMP_NUM(table->opt_range[*a].rows, table->opt_range[*b].rows); + if (tmp) + return tmp; + return -CMP_NUM(table->opt_range[*a].key_parts, table->opt_range[*b].key_parts); +} + + /* Calculate the selectivity of the condition imposed on the rows of a table @@ -3321,10 +3348,10 @@ double records_in_column_ranges(PARAM *param, uint idx, bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond) { - uint keynr; - uint max_quick_key_parts= 0; + uint keynr, range_index, ranges; MY_BITMAP *used_fields= &table->cond_set; - double table_records= (double)table->stat_records(); + double table_records= (double)table->stat_records(); + uint optimal_key_order[MAX_KEY]; DBUG_ENTER("calculate_cond_selectivity_for_table"); table->cond_selectivity= 1.0; @@ -3363,23 +3390,21 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond) Json_writer_object trace_wrapper(thd); Json_writer_array selectivity_for_indexes(thd, "selectivity_for_indexes"); - for (keynr= 0; keynr < table->s->keys; keynr++) - { + /* + Walk through all quick ranges in the order of least found rows. + */ + for (ranges= keynr= 0 ; keynr < table->s->keys; keynr++) if (table->opt_range_keys.is_set(keynr)) - set_if_bigger(max_quick_key_parts, table->opt_range[keynr].key_parts); - } + optimal_key_order[ranges++]= keynr; - /* - Walk through all indexes, indexes where range access uses more keyparts - go first. - */ - for (uint quick_key_parts= max_quick_key_parts; - quick_key_parts; quick_key_parts--) + my_qsort2(optimal_key_order, ranges, + sizeof(optimal_key_order[0]), + (qsort2_cmp) cmp_quick_ranges, table); + + for (range_index= 0 ; range_index < ranges ; range_index++) { - for (keynr= 0; keynr < table->s->keys; keynr++) + uint keynr= optimal_key_order[range_index]; { - if (table->opt_range_keys.is_set(keynr) && - table->opt_range[keynr].key_parts == quick_key_parts) { uint i; uint used_key_parts= table->opt_range[keynr].key_parts; @@ -3536,7 +3561,10 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond) } else { + enum_check_fields save_count_cuted_fields= thd->count_cuted_fields; + thd->count_cuted_fields= CHECK_FIELD_IGNORE; rows= records_in_column_ranges(¶m, idx, key); + thd->count_cuted_fields= save_count_cuted_fields; if (rows != DBL_MAX) { key->field->cond_selectivity= rows/table_records; @@ -4414,12 +4442,14 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree) key_tree->next_key_part->store_min_key(ppar->key, &tmp_min_key, &tmp_min_flag, - ppar->last_part_partno); + ppar->last_part_partno, + true); if (!tmp_max_flag) key_tree->next_key_part->store_max_key(ppar->key, &tmp_max_key, &tmp_max_flag, - ppar->last_part_partno); + ppar->last_part_partno, + false); flag= tmp_min_flag | tmp_max_flag; } else @@ -7732,8 +7762,13 @@ SEL_TREE *Item_func_ne::get_func_mm_tree(RANGE_OPT_PARAM *param, If this condition is a "col1<>...", where there is a UNIQUE KEY(col1), do not construct a SEL_TREE from it. A condition that excludes just one row in the table is not selective (unless there are only a few rows) + + Note: this logic must be in sync with code in + check_group_min_max_predicates(). That function walks an Item* condition + and checks if the range optimizer would produce an equivalent range for + it. */ - if (is_field_an_unique_index(param, field)) + if (param->using_real_indexes && is_field_an_unique_index(field)) DBUG_RETURN(NULL); DBUG_RETURN(get_ne_mm_tree(param, field, value, value)); } @@ -7845,7 +7880,7 @@ SEL_TREE *Item_func_in::get_func_mm_tree(RANGE_OPT_PARAM *param, - if there are a lot of constants, the overhead of building and processing enormous range list is not worth it. */ - if (is_field_an_unique_index(param, field)) + if (param->using_real_indexes && is_field_an_unique_index(field)) DBUG_RETURN(0); /* Get a SEL_TREE for "(-inf|NULL) < X < c_0" interval. */ @@ -8554,24 +8589,18 @@ SEL_TREE *Item_equal::get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) In the future we could also add "almost unique" indexes where any value is present only in a few rows (but necessarily exactly one row) */ -static bool is_field_an_unique_index(RANGE_OPT_PARAM *param, Field *field) +static bool is_field_an_unique_index(Field *field) { DBUG_ENTER("is_field_an_unique_index"); - - // The check for using_real_indexes is there because of the heuristics - // this function is used for. - if (param->using_real_indexes) + key_map::Iterator it(field->key_start); + uint key_no; + while ((key_no= it++) != key_map::Iterator::BITMAP_END) { - key_map::Iterator it(field->key_start); - uint key_no; - while ((key_no= it++) != key_map::Iterator::BITMAP_END) + KEY *key_info= &field->table->key_info[key_no]; + if (key_info->user_defined_key_parts == 1 && + (key_info->flags & HA_NOSAME)) { - KEY *key_info= &field->table->key_info[key_no]; - if (key_info->user_defined_key_parts == 1 && - (key_info->flags & HA_NOSAME)) - { - DBUG_RETURN(true); - } + DBUG_RETURN(true); } } DBUG_RETURN(false); @@ -9694,7 +9723,6 @@ tree_or(RANGE_OPT_PARAM *param,SEL_TREE *tree1,SEL_TREE *tree2) DBUG_RETURN(tree2); SEL_TREE *result= NULL; - key_map result_keys; key_map ored_keys; SEL_TREE *rtree[2]= {NULL,NULL}; SEL_IMERGE *imerge[2]= {NULL, NULL}; @@ -9837,12 +9865,14 @@ and_all_keys(RANGE_OPT_PARAM *param, SEL_ARG *key1, SEL_ARG *key2, return key2; key1->right= key1->left= &null_element; key1->next= key1->prev= 0; + key1->weight= 1 + (key1->next_key_part? key1->next_key_part->weight: 0); } for (next=key1->first(); next ; next=next->next) { if (next->next_key_part) { + uint old_weight= next->next_key_part->weight; SEL_ARG *tmp= key_and(param, next->next_key_part, key2, clone_flag); if (tmp && tmp->type == SEL_ARG::IMPOSSIBLE) { @@ -9850,21 +9880,22 @@ and_all_keys(RANGE_OPT_PARAM *param, SEL_ARG *key1, SEL_ARG *key2, continue; } next->next_key_part=tmp; + key1->weight+= (tmp? tmp->weight: 0) - old_weight; if (use_count) next->increment_use_count(use_count); if (param->alloced_sel_args > SEL_ARG::MAX_SEL_ARGS) break; } else + { next->next_key_part=key2; + key1->weight += key2->weight; + } } if (!key1) return &null_element; // Impossible ranges key1->use_count++; - /* Re-compute the result tree's weight. */ - key1->update_weight_locally(); - key1->max_part_no= MY_MAX(key2->max_part_no, key2->part+1); return key1; } @@ -10028,29 +10059,6 @@ get_range(SEL_ARG **e1,SEL_ARG **e2,SEL_ARG *root1) return 0; } -/* - @brief - Update the tree weight. - - @detail - Utility function to be called on a SEL_ARG tree root after doing local - modifications concerning changes at this key part. - Assumes that the weight of the graphs connected via next_key_part is - up to dayte. -*/ -void SEL_ARG::update_weight_locally() -{ - uint new_weight= 0; - const SEL_ARG *sl; - for (sl= first(); sl ; sl= sl->next) - { - new_weight++; - if (sl->next_key_part) - new_weight += sl->next_key_part->weight; - } - weight= new_weight; -} - #ifndef DBUG_OFF /* @@ -10271,7 +10279,7 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2) uint max_part_no= MY_MAX(key1->max_part_no, key2->max_part_no); - for (key2=key2->first(); key2; ) + for (key2=key2->first(); ; ) { /* key1 consists of one or more ranges. tmp is the range currently @@ -10285,6 +10293,16 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2) ^ tmp */ + if (key1->min_flag & NO_MIN_RANGE && + key1->max_flag & NO_MAX_RANGE) + { + if (key1->maybe_flag) + return new SEL_ARG(SEL_ARG::MAYBE_KEY); + return 0; // Always true OR + } + if (!key2) + break; + SEL_ARG *tmp=key1->find_range(key2); /* @@ -10355,6 +10373,13 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2) key2->copy_min(tmp); if (!(key1=key1->tree_delete(tmp))) { // Only one key in tree + if (key2->min_flag & NO_MIN_RANGE && + key2->max_flag & NO_MAX_RANGE) + { + if (key2->maybe_flag) + return new SEL_ARG(SEL_ARG::MAYBE_KEY); + return 0; // Always true OR + } key1=key2; key1->make_root(); key2=key2_next; @@ -10590,8 +10615,7 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2) Move on to next range in key2 */ key2->increment_use_count(-1); // Free not used tree - key2=key2_next; - continue; + key2= key2_next; } else { @@ -10605,8 +10629,9 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2) tmp: [---------] */ key2->copy_max_to_min(tmp); - continue; + key2->next= key2_next; // In case of key2_shared } + continue; } /* @@ -10793,9 +10818,6 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2) } key1->use_count++; - /* Re-compute the result tree's weight. */ - key1->update_weight_locally(); - key1->max_part_no= max_part_no; return key1; } @@ -11523,6 +11545,7 @@ ha_rows check_quick_select(PARAM *param, uint idx, bool index_only, seq.keyno= idx; seq.real_keyno= keynr; + seq.key_parts= param->key[idx]; seq.param= param; seq.start= tree; @@ -11670,6 +11693,9 @@ static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts) table_key->user_defined_key_parts); uint pk_number; + if (param->table->file->ha_table_flags() & HA_NON_COMPARABLE_ROWID) + return false; + for (KEY_PART_INFO *kp= table_key->key_part; kp < key_part; kp++) { field_index_t fieldnr= (param->table->key_info[keynr]. @@ -11771,6 +11797,46 @@ get_quick_select(PARAM *param,uint idx,SEL_ARG *key_tree, uint mrr_flags, } +void SEL_ARG::store_next_min_max_keys(KEY_PART *key, + uchar **cur_min_key, uint *cur_min_flag, + uchar **cur_max_key, uint *cur_max_flag, + int *min_part, int *max_part) +{ + DBUG_ASSERT(next_key_part); + const bool asc = !(key[next_key_part->part].flag & HA_REVERSE_SORT); + + if (!get_min_flag(key)) + { + if (asc) + { + *min_part += next_key_part->store_min_key(key, cur_min_key, + cur_min_flag, MAX_KEY, true); + } + else + { + uint tmp_flag = invert_min_flag(*cur_min_flag); + *min_part += next_key_part->store_max_key(key, cur_min_key, &tmp_flag, + MAX_KEY, true); + *cur_min_flag = invert_max_flag(tmp_flag); + } + } + if (!get_max_flag(key)) + { + if (asc) + { + *max_part += next_key_part->store_max_key(key, cur_max_key, + cur_max_flag, MAX_KEY, false); + } + else + { + uint tmp_flag = invert_max_flag(*cur_max_flag); + *max_part += next_key_part->store_min_key(key, cur_max_key, &tmp_flag, + MAX_KEY, false); + *cur_max_flag = invert_min_flag(tmp_flag); + } + } +} + /* ** Fix this to get all possible sub_ranges */ @@ -11784,17 +11850,20 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key, int min_part= key_tree->part-1, // # of keypart values in min_key buffer max_part= key_tree->part-1; // # of keypart values in max_key buffer - if (key_tree->left != &null_element) + const bool asc = !(key[key_tree->part].flag & HA_REVERSE_SORT); + SEL_ARG *next_tree = asc ? key_tree->left : key_tree->right; + if (next_tree != &null_element) { - if (get_quick_keys(param,quick,key,key_tree->left, + if (get_quick_keys(param,quick,key,next_tree, min_key,min_key_flag, max_key, max_key_flag)) return 1; } uchar *tmp_min_key=min_key,*tmp_max_key=max_key; - min_part+= key_tree->store_min(key[key_tree->part].store_length, - &tmp_min_key,min_key_flag); - max_part+= key_tree->store_max(key[key_tree->part].store_length, - &tmp_max_key,max_key_flag); + + key_tree->store_min_max(key, key[key_tree->part].store_length, + &tmp_min_key, min_key_flag, + &tmp_max_key, max_key_flag, + &min_part, &max_part); if (key_tree->next_key_part && key_tree->next_key_part->type == SEL_ARG::KEY_RANGE && @@ -11804,31 +11873,40 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key, memcmp(min_key, max_key, (uint)(tmp_max_key - max_key))==0 && key_tree->min_flag==0 && key_tree->max_flag==0) { + // psergey-note: simplified the parameters below as follows: + // min_key_flag | key_tree->min_flag -> min_key_flag + // max_key_flag | key_tree->max_flag -> max_key_flag if (get_quick_keys(param,quick,key,key_tree->next_key_part, - tmp_min_key, min_key_flag | key_tree->min_flag, - tmp_max_key, max_key_flag | key_tree->max_flag)) + tmp_min_key, min_key_flag, + tmp_max_key, max_key_flag)) return 1; goto end; // Ugly, but efficient } { - uint tmp_min_flag=key_tree->min_flag,tmp_max_flag=key_tree->max_flag; - if (!tmp_min_flag) - min_part+= key_tree->next_key_part->store_min_key(key, - &tmp_min_key, - &tmp_min_flag, - MAX_KEY); - if (!tmp_max_flag) - max_part+= key_tree->next_key_part->store_max_key(key, - &tmp_max_key, - &tmp_max_flag, - MAX_KEY); + uint tmp_min_flag= key_tree->get_min_flag(key); + uint tmp_max_flag= key_tree->get_max_flag(key); + + key_tree->store_next_min_max_keys(key, + &tmp_min_key, &tmp_min_flag, + &tmp_max_key, &tmp_max_flag, + &min_part, &max_part); flag=tmp_min_flag | tmp_max_flag; } } else { - flag = (key_tree->min_flag & GEOM_FLAG) ? - key_tree->min_flag : key_tree->min_flag | key_tree->max_flag; + if (asc) + { + flag= (key_tree->min_flag & GEOM_FLAG) ? key_tree->min_flag: + (key_tree->min_flag | + key_tree->max_flag); + } + else + { + // Invert flags for DESC keypart + flag= invert_min_flag(key_tree->min_flag) | + invert_max_flag(key_tree->max_flag); + } } /* @@ -11889,8 +11967,9 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key, return 1; end: - if (key_tree->right != &null_element) - return get_quick_keys(param,quick,key,key_tree->right, + next_tree= asc ? key_tree->right : key_tree->left; + if (next_tree != &null_element) + return get_quick_keys(param,quick,key,next_tree, min_key,min_key_flag, max_key,max_key_flag); return 0; @@ -13019,24 +13098,25 @@ int QUICK_RANGE_SELECT::cmp_next(QUICK_RANGE *range_arg) key+= store_length, key_part++) { int cmp; + bool reverse= MY_TEST(key_part->flag & HA_REVERSE_SORT); store_length= key_part->store_length; if (key_part->null_bit) { if (*key) { if (!key_part->field->is_null()) - return 1; + return reverse ? 0 : 1; continue; } else if (key_part->field->is_null()) - return 0; + return reverse ? 1 : 0; key++; // Skip null byte store_length--; } if ((cmp=key_part->field->key_cmp(key, key_part->length)) < 0) - return 0; + return reverse ? 1 : 0; if (cmp > 0) - return 1; + return reverse ? 0 : 1; } return (range_arg->flag & NEAR_MAX) ? 1 : 0; // Exact match } @@ -13459,7 +13539,7 @@ cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts, - (C between const_i and const_j) - C IS NULL - C IS NOT NULL - - C != const + - C != const (unless C is the primary key) SA4. If Q has a GROUP BY clause, there are no other aggregate functions except MIN and MAX. For queries with DISTINCT, aggregate functions are allowed. @@ -13763,6 +13843,17 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) cause= "not covering"; goto next_index; } + + { + for (uint i= 0; i < table->actual_n_key_parts(cur_index_info); i++) + { + if (cur_index_info->key_part[i].key_part_flag & HA_REVERSE_SORT) + { + cause="Reverse-ordered (not supported yet)"; + goto next_index; + } + } + } /* This function is called on the precondition that the index is covering. @@ -14001,7 +14092,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) key_part_range[1]= last_part; /* Check if cur_part is referenced in the WHERE clause. */ - if (join->conds->walk(&Item::find_item_in_field_list_processor, 0, + if (join->conds->walk(&Item::find_item_in_field_list_processor, true, key_part_range)) { cause= "keypart reference from where clause"; @@ -14342,6 +14433,17 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item, if (!simple_pred(pred, args, &inv)) DBUG_RETURN(FALSE); + /* + Follow the logic in Item_func_ne::get_func_mm_tree(): condition + in form "tbl.primary_key <> const" is not used to produce intervals. + + If the condition doesn't have an equivalent interval, this means we + fail LooseScan's condition SA3. Return FALSE to indicate this. + */ + if (pred_type == Item_func::NE_FUNC && + is_field_an_unique_index(min_max_arg_item->field)) + DBUG_RETURN(FALSE); + if (args[0] && args[1]) // this is a binary function or BETWEEN { DBUG_ASSERT(pred->fixed_type_handler()); @@ -16147,6 +16249,7 @@ const char *dbug_print_sel_arg(SEL_ARG *sel_arg) out.append(STRING_WITH_LEN("+inf")); else { + buf.length(0); print_sel_arg_key(sel_arg->field, sel_arg->max_value, &buf); out.append(buf); } @@ -16488,6 +16591,7 @@ static void trace_ranges(Json_writer_array *range_trace, uint n_key_parts= param->table->actual_n_key_parts(keyinfo); DBUG_ASSERT(range_trace->trace_started()); seq.keyno= idx; + seq.key_parts= param->key[idx]; seq.real_keyno= param->real_keynr[idx]; seq.param= param; seq.start= keypart; @@ -16565,6 +16669,8 @@ void print_keyparts_name(String *out, const KEY_PART_INFO *key_part, else out->append(STRING_WITH_LEN(",")); out->append(key_part->field->field_name); + if (key_part->key_part_flag & HA_REVERSE_SORT) + out->append(STRING_WITH_LEN(" DESC")); } else break; diff --git a/sql/opt_range.h b/sql/opt_range.h index 1014176ecc594..a505cd09ea4a2 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -54,6 +54,33 @@ struct KEY_PART { }; +/** + A helper function to invert min flags to max flags for DESC key parts. + It changes NEAR_MIN, NO_MIN_RANGE to NEAR_MAX, NO_MAX_RANGE appropriately +*/ + +inline uint invert_min_flag(uint min_flag) +{ + uint max_flag_out = min_flag & ~(NEAR_MIN | NO_MIN_RANGE); + if (min_flag & NEAR_MIN) max_flag_out |= NEAR_MAX; + if (min_flag & NO_MIN_RANGE) max_flag_out |= NO_MAX_RANGE; + return max_flag_out; +} + + +/** + A helper function to invert max flags to min flags for DESC key parts. + It changes NEAR_MAX, NO_MAX_RANGE to NEAR_MIN, NO_MIN_RANGE appropriately +*/ + +inline uint invert_max_flag(uint max_flag) +{ + uint min_flag_out = max_flag & ~(NEAR_MAX | NO_MAX_RANGE); + if (max_flag & NEAR_MAX) min_flag_out |= NEAR_MIN; + if (max_flag & NO_MAX_RANGE) min_flag_out |= NO_MIN_RANGE; + return min_flag_out; +} + class RANGE_OPT_PARAM; /* A construction block of the SEL_ARG-graph. @@ -267,6 +294,8 @@ class RANGE_OPT_PARAM; - it is a lot easier to compute than computing the number of ranges, - it can be updated incrementally when performing AND/OR operations on parts of the graph. + + 6. For handling DESC keyparts, See HowRangeOptimizerHandlesDescKeyparts */ class SEL_ARG :public Sql_alloc @@ -317,7 +346,6 @@ class SEL_ARG :public Sql_alloc uint weight; enum { MAX_WEIGHT = 32000 }; - void update_weight_locally(); #ifndef DBUG_OFF uint verify_weight(); #endif @@ -325,13 +353,17 @@ class SEL_ARG :public Sql_alloc /* See RANGE_OPT_PARAM::alloced_sel_args */ enum { MAX_SEL_ARGS = 16000 }; - SEL_ARG() {} + SEL_ARG() = default; SEL_ARG(SEL_ARG &); - SEL_ARG(Field *,const uchar *, const uchar *); - SEL_ARG(Field *field, uint8 part, uchar *min_value, uchar *max_value, + SEL_ARG(Field *, const uchar *, const uchar *); + SEL_ARG(Field *field, uint8 part, + uchar *min_value, uchar *max_value, uint8 min_flag, uint8 max_flag, uint8 maybe_flag); + + /* This is used to construct degenerate SEL_ARGS like ALWAYS, IMPOSSIBLE, etc */ SEL_ARG(enum Type type_arg) - :min_flag(0), max_part_no(0) /* first key part means 1. 0 mean 'no parts'*/, + :min_flag(0), + max_part_no(0) /* first key part means 1. 0 mean 'no parts'*/, elements(1),use_count(1),left(0),right(0), next_key_part(0), color(BLACK), type(type_arg), weight(1) {} @@ -409,13 +441,14 @@ class SEL_ARG :public Sql_alloc { new_max=arg->max_value; flag_max=arg->max_flag; } - return new (thd->mem_root) SEL_ARG(field, part, new_min, new_max, flag_min, + return new (thd->mem_root) SEL_ARG(field, part, + new_min, new_max, flag_min, flag_max, MY_TEST(maybe_flag && arg->maybe_flag)); } SEL_ARG *clone_first(SEL_ARG *arg) { // min <= X < arg->min - return new SEL_ARG(field,part, min_value, arg->min_value, + return new SEL_ARG(field, part, min_value, arg->min_value, min_flag, arg->min_flag & NEAR_MIN ? 0 : NEAR_MAX, maybe_flag | arg->maybe_flag); } @@ -504,6 +537,57 @@ class SEL_ARG :public Sql_alloc return 0; } + /* Save minimum and maximum, taking index order into account */ + void store_min_max(KEY_PART *kp, + uint length, + uchar **min_key, uint min_flag, + uchar **max_key, uint max_flag, + int *min_part, int *max_part) + { + if (kp[part].flag & HA_REVERSE_SORT) { + *max_part += store_min(length, max_key, min_flag); + *min_part += store_max(length, min_key, max_flag); + } else { + *min_part += store_min(length, min_key, min_flag); + *max_part += store_max(length, max_key, max_flag); + } + } + /* + Get the flag for range's starting endpoint, taking index order into + account. + */ + uint get_min_flag(KEY_PART *kp) + { + return (kp[part].flag & HA_REVERSE_SORT)? invert_max_flag(max_flag) : min_flag; + } + /* + Get the flag for range's starting endpoint, taking index order into + account. + */ + uint get_max_flag(KEY_PART *kp) + { + return (kp[part].flag & HA_REVERSE_SORT)? invert_min_flag(min_flag) : max_flag ; + } + /* Get the previous interval, taking index order into account */ + inline SEL_ARG* index_order_prev(KEY_PART *kp) + { + return (kp[part].flag & HA_REVERSE_SORT)? next : prev; + } + /* Get the next interval, taking index order into account */ + inline SEL_ARG* index_order_next(KEY_PART *kp) + { + return (kp[part].flag & HA_REVERSE_SORT)? prev : next; + } + + /* + Produce a single multi-part interval, taking key part ordering into + account. + */ + void store_next_min_max_keys(KEY_PART *key, uchar **cur_min_key, + uint *cur_min_flag, uchar **cur_max_key, + uint *cur_max_flag, int *min_part, + int *max_part); + /* Returns a number of keypart values appended to the key buffer for min key and max key. This function is used by both Range @@ -516,7 +600,8 @@ class SEL_ARG :public Sql_alloc int store_min_key(KEY_PART *key, uchar **range_key, uint *range_key_flag, - uint last_part) + uint last_part, + bool start_key) { SEL_ARG *key_tree= first(); uint res= key_tree->store_min(key[key_tree->part].store_length, @@ -525,15 +610,26 @@ class SEL_ARG :public Sql_alloc if (!res) return 0; *range_key_flag|= key_tree->min_flag; - if (key_tree->next_key_part && - key_tree->next_key_part->type == SEL_ARG::KEY_RANGE && + SEL_ARG *nkp= key_tree->next_key_part; + if (nkp && nkp->type == SEL_ARG::KEY_RANGE && key_tree->part != last_part && - key_tree->next_key_part->part == key_tree->part+1 && + nkp->part == key_tree->part+1 && !(*range_key_flag & (NO_MIN_RANGE | NEAR_MIN))) - res+= key_tree->next_key_part->store_min_key(key, - range_key, - range_key_flag, - last_part); + { + const bool asc = !(key[key_tree->part].flag & HA_REVERSE_SORT); + if (start_key == asc) + { + res+= nkp->store_min_key(key, range_key, range_key_flag, last_part, + start_key); + } + else + { + uint tmp_flag = invert_min_flag(*range_key_flag); + res += nkp->store_max_key(key, range_key, &tmp_flag, last_part, + start_key); + *range_key_flag = invert_max_flag(tmp_flag); + } + } return res; } @@ -541,7 +637,8 @@ class SEL_ARG :public Sql_alloc int store_max_key(KEY_PART *key, uchar **range_key, uint *range_key_flag, - uint last_part) + uint last_part, + bool start_key) { SEL_ARG *key_tree= last(); uint res=key_tree->store_max(key[key_tree->part].store_length, @@ -549,15 +646,26 @@ class SEL_ARG :public Sql_alloc if (!res) return 0; *range_key_flag|= key_tree->max_flag; - if (key_tree->next_key_part && - key_tree->next_key_part->type == SEL_ARG::KEY_RANGE && + SEL_ARG *nkp= key_tree->next_key_part; + if (nkp && nkp->type == SEL_ARG::KEY_RANGE && key_tree->part != last_part && - key_tree->next_key_part->part == key_tree->part+1 && + nkp->part == key_tree->part+1 && !(*range_key_flag & (NO_MAX_RANGE | NEAR_MAX))) - res+= key_tree->next_key_part->store_max_key(key, - range_key, - range_key_flag, - last_part); + { + const bool asc = !(key[key_tree->part].flag & HA_REVERSE_SORT); + if ((!start_key && asc) || (start_key && !asc)) + { + res += nkp->store_max_key(key, range_key, range_key_flag, last_part, + start_key); + } + else + { + uint tmp_flag = invert_max_flag(*range_key_flag); + res += nkp->store_min_key(key, range_key, &tmp_flag, last_part, + start_key); + *range_key_flag = invert_min_flag(tmp_flag); + } + } return res; } @@ -661,6 +769,73 @@ class SEL_ARG :public Sql_alloc SEL_ARG *clone_tree(RANGE_OPT_PARAM *param); }; +/* + HowRangeOptimizerHandlesDescKeyparts + ==================================== + + Starting with MySQL-8.0 and MariaDB 10.8, index key parts may be descending, + for example: + + INDEX idx1(col1, col2 DESC, col3, col4 DESC) + + Range Optimizer handles this as follows: + + Other than that, the SEL_ARG graph is built without any regard to DESC + keyparts. + + For example, for an index + + INDEX idx2(kp1 DESC, kp2) + + and range + + kp1 BETWEEN 10 and 20 (RANGE-1) + + the SEL_ARG will have min_value=10, max_value=20 + + The ordering of key parts is taken into account when SEL_ARG graph is + linearized to ranges, in sel_arg_range_seq_next() and get_quick_keys(). + + The storage engine expects the first bound to be the first in the index and + the last bound to be the last, that is, for (RANGE-1) we will flip min and + max and generate these key_range structures: + + start.key='20' , end.key='10' + + See SEL_ARG::store_min_max(). The flag values are flipped as well, see + SEL_ARG::get_min_flag(), get_max_flag(). + + == Handling multiple key parts == + + For multi-part keys, the order of key parts has an effect on which ranges are + generated. Consider + + kp1 >= 10 AND kp2 >'foo' + + for INDEX(kp1 ASC, kp2 ASC) the range will be + + (kp1, kp2) > (10, 'foo') + + while for INDEX(kp1 ASC, kp2 DESC) it will be just + + kp1 >= 10 + + Another example: + + (kp1 BETWEEN 10 AND 20) AND (kp2 BETWEEN 'foo' AND 'quux') + + with INDEX (kp1 ASC, kp2 ASC) will generate + + (10, 'foo') <= (kp1, kp2) < (20, 'quux') + + while with index INDEX (kp1 ASC, kp2 DESC) it will generate + + (10, 'quux') <= (kp1, kp2) < (20, 'foo') + + This is again achieved by sel_arg_range_seq_next() and get_quick_keys() + flipping SEL_ARG's min,max, their flags and next/prev as needed. +*/ + extern MYSQL_PLUGIN_IMPORT SEL_ARG null_element; class SEL_ARG_IMPOSSIBLE: public SEL_ARG @@ -780,7 +955,7 @@ class QUICK_RANGE :public Sql_alloc { } /** - Initalizes a key_range object for communication with storage engine. + Initializes a key_range object for communication with storage engine. This function facilitates communication with the Storage Engine API by translating the minimum endpoint of the interval represented by this @@ -801,7 +976,7 @@ class QUICK_RANGE :public Sql_alloc { } /** - Initalizes a key_range object for communication with storage engine. + Initializes a key_range object for communication with storage engine. This function facilitates communication with the Storage Engine API by translating the minimum endpoint of the interval represented by this @@ -818,7 +993,7 @@ class QUICK_RANGE :public Sql_alloc { } /** - Initalizes a key_range object for communication with storage engine. + Initializes a key_range object for communication with storage engine. This function facilitates communication with the Storage Engine API by translating the maximum endpoint of the interval represented by this @@ -839,7 +1014,7 @@ class QUICK_RANGE :public Sql_alloc { } /** - Initalizes a key_range object for communication with storage engine. + Initializes a key_range object for communication with storage engine. This function facilitates communication with the Storage Engine API by translating the maximum endpoint of the interval represented by this @@ -935,7 +1110,7 @@ class QUICK_SELECT_I uint used_key_parts; QUICK_SELECT_I(); - virtual ~QUICK_SELECT_I(){}; + virtual ~QUICK_SELECT_I() = default;; /* Do post-constructor initialization. diff --git a/sql/opt_range_mrr.cc b/sql/opt_range_mrr.cc index 20413f5df6354..452a6864f06c3 100644 --- a/sql/opt_range_mrr.cc +++ b/sql/opt_range_mrr.cc @@ -34,7 +34,7 @@ typedef struct st_range_seq_entry uint min_key_flag, max_key_flag; /* Number of key parts */ - uint min_key_parts, max_key_parts; + int min_key_parts, max_key_parts; SEL_ARG *key_tree; } RANGE_SEQ_ENTRY; @@ -47,6 +47,7 @@ typedef struct st_sel_arg_range_seq uint keyno; /* index of used tree in SEL_TREE structure */ uint real_keyno; /* Number of the index in tables */ PARAM *param; + KEY_PART *key_parts; SEL_ARG *start; /* Root node of the traversed SEL_ARG* graph */ RANGE_SEQ_ENTRY stack[MAX_REF_PARTS]; @@ -105,13 +106,14 @@ static void step_down_to(SEL_ARG_RANGE_SEQ *arg, SEL_ARG *key_tree) cur->max_key_parts= prev->max_key_parts; uint16 stor_length= arg->param->key[arg->keyno][key_tree->part].store_length; - cur->min_key_parts += key_tree->store_min(stor_length, &cur->min_key, - prev->min_key_flag); - cur->max_key_parts += key_tree->store_max(stor_length, &cur->max_key, - prev->max_key_flag); - cur->min_key_flag= prev->min_key_flag | key_tree->min_flag; - cur->max_key_flag= prev->max_key_flag | key_tree->max_flag; + key_tree->store_min_max(arg->key_parts, stor_length, + &cur->min_key, prev->min_key_flag, + &cur->max_key, prev->max_key_flag, + &cur->min_key_parts, &cur->max_key_parts); + + cur->min_key_flag= prev->min_key_flag | key_tree->get_min_flag(arg->key_parts); + cur->max_key_flag= prev->max_key_flag | key_tree->get_max_flag(arg->key_parts); if (key_tree->is_null_interval()) cur->min_key_flag |= NULL_RANGE; @@ -165,12 +167,13 @@ bool sel_arg_range_seq_next(range_seq_t rseq, KEY_MULTI_RANGE *range) /* Ok, we're at some "full tuple" position in the tree */ /* Step down if we can */ - if (key_tree->next && key_tree->next != &null_element) + if (key_tree->index_order_next(seq->key_parts) && + key_tree->index_order_next(seq->key_parts) != &null_element) { //step down; (update the tuple, we'll step right and stay there) seq->i--; - step_down_to(seq, key_tree->next); - key_tree= key_tree->next; + step_down_to(seq, key_tree->index_order_next(seq->key_parts)); + key_tree= key_tree->index_order_next(seq->key_parts); seq->is_ror_scan= FALSE; goto walk_right_n_up; } @@ -185,12 +188,13 @@ bool sel_arg_range_seq_next(range_seq_t rseq, KEY_MULTI_RANGE *range) key_tree= seq->stack[seq->i].key_tree; /* Step down if we can */ - if (key_tree->next && key_tree->next != &null_element) + if (key_tree->index_order_next(seq->key_parts) && + key_tree->index_order_next(seq->key_parts) != &null_element) { // Step down; update the tuple seq->i--; - step_down_to(seq, key_tree->next); - key_tree= key_tree->next; + step_down_to(seq, key_tree->index_order_next(seq->key_parts)); + key_tree= key_tree->index_order_next(seq->key_parts); break; } } @@ -214,16 +218,10 @@ bool sel_arg_range_seq_next(range_seq_t rseq, KEY_MULTI_RANGE *range) !key_tree->min_flag && !key_tree->max_flag)) { seq->is_ror_scan= FALSE; - if (!key_tree->min_flag) - cur->min_key_parts += - key_tree->next_key_part->store_min_key(seq->param->key[seq->keyno], - &cur->min_key, - &cur->min_key_flag, MAX_KEY); - if (!key_tree->max_flag) - cur->max_key_parts += - key_tree->next_key_part->store_max_key(seq->param->key[seq->keyno], - &cur->max_key, - &cur->max_key_flag, MAX_KEY); + key_tree->store_next_min_max_keys(seq->param->key[seq->keyno], + &cur->min_key, &cur->min_key_flag, + &cur->max_key, &cur->max_key_flag, + &cur->min_key_parts, &cur->max_key_parts); break; } } @@ -235,10 +233,11 @@ bool sel_arg_range_seq_next(range_seq_t rseq, KEY_MULTI_RANGE *range) key_tree= key_tree->next_key_part; walk_up_n_right: - while (key_tree->prev && key_tree->prev != &null_element) + while (key_tree->index_order_prev(seq->key_parts) && + key_tree->index_order_prev(seq->key_parts) != &null_element) { /* Step up */ - key_tree= key_tree->prev; + key_tree= key_tree->index_order_prev(seq->key_parts); } step_down_to(seq, key_tree); } diff --git a/sql/opt_split.cc b/sql/opt_split.cc index ad90bf3231505..e00a26e3328ea 100644 --- a/sql/opt_split.cc +++ b/sql/opt_split.cc @@ -65,7 +65,7 @@ If we have only one equi-join condition then we either push it as for Q1R or we don't. In a general case we may have much more options. Consider the query (Q3) - SELECT + SELECT * FROM t1,t2 (SELECT t3.a, t3.b, MIN(t3.c) as min FROM t3 GROUP BY a,b) t WHERE t.a = t1.a AND t.b = t2.b @@ -102,6 +102,47 @@ If we just drop the index on t3(a,b) the chances that the splitting will be used becomes much lower but they still exists providing that the fanout of the partial join of t1 and t2 is small enough. + + The lateral derived table LT formed as a result of SM optimization applied + to a materialized derived table DT must be joined after all parameters + of splitting has been evaluated, i.e. after all expressions used in the + equalities pushed into DT that make the employed splitting effective + could be evaluated. With the chosen join order all the parameters can be + evaluated after the last table LPT that contains any columns referenced in + the parameters has been joined and the table APT following LPT in the chosen + join order is accessed. + Usually the formed lateral derived table LT is accessed right after the table + LPT. As in such cases table LT must be refilled for each combination of + splitting parameters this table must be populated before each access to LT + and the estimate of the expected number of refills that could be suggested in + such cases is the number of rows in the partial join ending with table LPT. + However in other cases the chosen join order may contain tables between LPT + and LT. + Consider the query (Q4) + SELECT * + FROM t1 JOIN t2 ON t1.b = t2.b + LEFT JOIN (SELECT t3.a, t3.b, MIN(t3.c) as min + FROM t3 GROUP BY a,b) t + ON t.a = t1.a AND t.c > 0 + [WHERE P(t1,t2)]; + Let's assume that the join order t1,t2,t was chosen for this query and + SP optimization was applied to t with splitting over t3.a using the index + on column t3.a. Here the table t1 serves as LPT, t2 as APT while t with + pushed condition t.a = t1.a serves as LT. Note that here LT is accessed + after t2, not right after t1. Here the number of refills of the lateral + derived is not more that the number of key values of t1.a that might be + less than the cardinality of the partial join (t1,t2). That's why it makes + sense to signal that t3 has to be refilled just before t2 is accessed. + However if the cardinality of the partial join (t1,t2) happens to be less + than the cardinality of the partial join (t1) due to additional selective + condition P(t1,t2) then the flag informing about necessity of a new refill + can be set either when accessing t2 or right after it has been joined. + The current code sets such flag right after generating a record of the + partial join with minimal cardinality for all those partial joins that + end between APT and LT. It allows sometimes to push extra conditions + into the lateral derived without any increase of the number of refills. + However this flag can be set only after the last join table between + APT and LT using join buffer has been joined. */ /* @@ -249,6 +290,7 @@ class SplM_opt_info : public Sql_alloc double unsplit_card; /* Lastly evaluated execution plan for 'join' with pushed equalities */ SplM_plan_info *last_plan; + double last_refills; SplM_plan_info *find_plan(TABLE *table, uint key, uint parts); }; @@ -311,6 +353,8 @@ struct SplM_field_ext_info: public SplM_field_info occurred also in the select list of this join 9. There are defined some keys usable for ref access of fields from C with available statistics. + 10. The select doesn't use WITH ROLLUP (This limitation can probably be + lifted) @retval true if the answer is positive @@ -327,7 +371,8 @@ bool JOIN::check_for_splittable_materialized() (unit->first_select()->next_select()) || // !(3) (derived->prohibit_cond_pushdown) || // !(4) (derived->is_recursive_with_table()) || // !(5) - (table_count == 0 || const_tables == top_join_tab_count)) // !(6) + (table_count == 0 || const_tables == top_join_tab_count) || // !(6) + rollup.state != ROLLUP::STATE_NONE) // (10) return false; if (group_list) // (7.1) { @@ -343,6 +388,9 @@ bool JOIN::check_for_splittable_materialized() if (!partition_list) return false; + Json_writer_object trace_wrapper(thd); + Json_writer_object trace_split(thd, "check_split_materialized"); + ORDER *ord; Dynamic_array candidates(PSI_INSTRUMENT_MEM); @@ -388,7 +436,10 @@ bool JOIN::check_for_splittable_materialized() } } if (candidates.elements() == 0) // no candidates satisfying (8.1) && (8.2) + { + trace_split.add("not_applicable", "group list has no candidates"); return false; + } /* For each table from this join find the keys that can be used for ref access @@ -447,7 +498,11 @@ bool JOIN::check_for_splittable_materialized() } if (!spl_field_cnt) // No candidate field can be accessed by ref => !(9) + { + trace_split.add("not_applicable", + "no candidate field can be accessed through ref"); return false; + } /* Create a structure of the type SplM_opt_info and fill it with @@ -465,16 +520,22 @@ bool JOIN::check_for_splittable_materialized() spl_opt_info->tables_usable_for_splitting= 0; spl_opt_info->spl_field_cnt= spl_field_cnt; spl_opt_info->spl_fields= spl_field; - for (cand= cand_start; cand < cand_end; cand++) + { - if (!cand->is_usable_for_ref_access) - continue; - spl_field->producing_item= cand->producing_item; - spl_field->underlying_field= cand->underlying_field; - spl_field->mat_field= cand->mat_field; - spl_opt_info->tables_usable_for_splitting|= - cand->underlying_field->table->map; - spl_field++; + Json_writer_array trace_range(thd, "split_candidates"); + for (cand= cand_start; cand < cand_end; cand++) + { + if (!cand->is_usable_for_ref_access) + continue; + trace_range.add(cand->producing_item); + + spl_field->producing_item= cand->producing_item; + spl_field->underlying_field= cand->underlying_field; + spl_field->mat_field= cand->mat_field; + spl_opt_info->tables_usable_for_splitting|= + cand->underlying_field->table->map; + spl_field++; + } } /* Attach this info to the table T */ @@ -729,7 +790,7 @@ void JOIN::add_keyuses_for_splitting() bzero((char*) &keyuse_ext_end, sizeof(keyuse_ext_end)); if (ext_keyuses_for_splitting->push(keyuse_ext_end)) goto err; - + // psergey-todo: trace anything here? spl_opt_info->unsplit_card= join_record_count; rec_len= table->s->rec_buff_length; @@ -827,13 +888,13 @@ SplM_plan_info *SplM_opt_info::find_plan(TABLE *table, uint key, uint parts) static void reset_validity_vars_for_keyuses(KEYUSE_EXT *key_keyuse_ext_start, TABLE *table, uint key, - table_map remaining_tables, + table_map excluded_tables, bool validity_val) { KEYUSE_EXT *keyuse_ext= key_keyuse_ext_start; do { - if (!(keyuse_ext->needed_in_prefix & remaining_tables)) + if (!(keyuse_ext->needed_in_prefix & excluded_tables)) { /* The enabling/disabling flags are set just in KEYUSE_EXT structures. @@ -853,8 +914,11 @@ void reset_validity_vars_for_keyuses(KEYUSE_EXT *key_keyuse_ext_start, Choose the best splitting to extend the evaluated partial join @param - record_count estimated cardinality of the extended partial join + idx index for joined table T in current partial join P remaining_tables tables not joined yet + spl_pd_boundary OUT bitmap of the table from P extended by T that + starts the sub-sequence of tables S from which + no conditions are allowed to be pushed into T. @details This function is called during the search for the best execution @@ -869,17 +933,19 @@ void reset_validity_vars_for_keyuses(KEYUSE_EXT *key_keyuse_ext_start, splitting the function set it as the true plan of materialization of the table T. The function caches the found plans for materialization of table T - together if the info what key was used for splitting. Next time when + together with the info what key was used for splitting. Next time when the optimizer prefers to use the same key the plan is taken from the cache of plans @retval Pointer to the info on the found plan that employs the pushed equalities if the plan has been chosen, NULL - otherwise. + If the function returns NULL the value of spl_param_tables is set to 0. */ -SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count, - table_map remaining_tables) +SplM_plan_info * JOIN_TAB::choose_best_splitting(uint idx, + table_map remaining_tables, + table_map *spl_pd_boundary) { SplM_opt_info *spl_opt_info= table->spl_opt_info; DBUG_ASSERT(spl_opt_info != NULL); @@ -894,7 +960,9 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count, SplM_plan_info *spl_plan= 0; uint best_key= 0; uint best_key_parts= 0; - + table_map best_param_tables; + Json_writer_object trace_obj(thd, "choose_best_splitting"); + Json_writer_array trace_arr(thd, "considered_keys"); /* Check whether there are keys that can be used to join T employing splitting and if so, select the best out of such keys @@ -912,6 +980,7 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count, uint key= keyuse_ext->key; KEYUSE_EXT *key_keyuse_ext_start= keyuse_ext; key_part_map found_parts= 0; + table_map needed_in_prefix= 0; do { if (keyuse_ext->needed_in_prefix & remaining_tables) @@ -937,6 +1006,7 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count, KEY *key_info= table->key_info + key; double rec_per_key= key_info->actual_rec_per_key(keyuse_ext->keypart); + needed_in_prefix|= keyuse_ext->needed_in_prefix; if (rec_per_key < best_rec_per_key) { best_table= keyuse_ext->table; @@ -944,6 +1014,14 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count, best_key_parts= keyuse_ext->keypart + 1; best_rec_per_key= rec_per_key; best_key_keyuse_ext_start= key_keyuse_ext_start; + best_param_tables= needed_in_prefix; + // trace table, key_name, parts, needed_tables. + Json_writer_object cur_index(thd); + cur_index. + add("table_name", best_table->alias.ptr()). + add("index", best_table->key_info[best_key].name). + add("rec_per_key", best_rec_per_key). + add("param_tables", best_param_tables); } keyuse_ext++; } @@ -951,14 +1029,41 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count, } while (keyuse_ext->table == table); } + trace_arr.end(); + spl_opt_info->last_plan= 0; + double refills= DBL_MAX; + table_map excluded_tables= remaining_tables | this->join->sjm_lookup_tables; if (best_table) { + *spl_pd_boundary= this->table->map; + if (!best_param_tables) + refills= 1; + else + { + table_map last_found= this->table->map; + for (POSITION *pos= &this->join->positions[idx - 1]; ; pos--) + { + if (pos->table->table->map & excluded_tables) + continue; + if (pos->partial_join_cardinality < refills) + { + *spl_pd_boundary= last_found; + refills= pos->partial_join_cardinality; + } + last_found= pos->table->table->map; + if ((last_found & best_param_tables) || pos->use_join_buffer) + break; + } + } + + trace_obj.add("refills", refills). + add("spl_pd_boundary", *spl_pd_boundary); + /* The key for splitting was chosen, look for the plan for this key in the cache */ - Json_writer_array spl_trace(thd, "choose_best_splitting"); spl_plan= spl_opt_info->find_plan(best_table, best_key, best_key_parts); if (!spl_plan) { @@ -966,11 +1071,13 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count, The plan for the chosen key has not been found in the cache. Build a new plan and save info on it in the cache */ + Json_writer_array wrapper(thd, "split_plan_search"); table_map all_table_map= (((table_map) 1) << join->table_count) - 1; reset_validity_vars_for_keyuses(best_key_keyuse_ext_start, best_table, - best_key, remaining_tables, true); + best_key, excluded_tables, true); choose_plan(join, all_table_map & ~join->const_table_map); + wrapper.end(); /* Check that the chosen plan is really a splitting plan. If not or if there is not enough memory to save the plan in the cache @@ -987,7 +1094,8 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count, spl_opt_info->plan_cache.push_back(spl_plan)) { reset_validity_vars_for_keyuses(best_key_keyuse_ext_start, best_table, - best_key, remaining_tables, false); + best_key, excluded_tables, false); + trace_obj.add("split_plan_discarded", "constructed unapplicable query plan"); return 0; } @@ -1007,32 +1115,41 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count, spl_plan->cost= join->best_positions[join->table_count-1].read_time + + oper_cost; - if (unlikely(thd->trace_started())) - { - Json_writer_object wrapper(thd); - Json_writer_object find_trace(thd, "best_splitting"); - find_trace.add("table", best_table->alias.c_ptr()); - find_trace.add("key", best_table->key_info[best_key].name); - find_trace.add("record_count", record_count); - find_trace.add("cost", spl_plan->cost); - find_trace.add("unsplit_cost", spl_opt_info->unsplit_cost); - } memcpy((char *) spl_plan->best_positions, (char *) join->best_positions, sizeof(POSITION) * join->table_count); reset_validity_vars_for_keyuses(best_key_keyuse_ext_start, best_table, - best_key, remaining_tables, false); + best_key, excluded_tables, false); } + else + trace_obj.add("cached_plan_found", 1); + if (spl_plan) { - if(record_count * spl_plan->cost < spl_opt_info->unsplit_cost - 0.01) + if (unlikely(thd->trace_started())) + { + trace_obj. + add("lead_table", spl_plan->table->alias.ptr()). + add("index", spl_plan->table->key_info[spl_plan->key].name). + add("parts", spl_plan->parts). + add("split_sel", spl_plan->split_sel). + add("cost", spl_plan->cost). + add("unsplit_cost", spl_opt_info->unsplit_cost). + add("records", (ha_rows) (records * spl_plan->split_sel)); + } + + if (refills * spl_plan->cost < spl_opt_info->unsplit_cost - 0.01) { /* The best plan that employs splitting is cheaper than the plan without splitting */ spl_opt_info->last_plan= spl_plan; + spl_opt_info->last_refills= refills; + trace_obj.add("chosen", true); } + else + trace_obj.add("chosen", false); } } @@ -1041,16 +1158,14 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count, spl_plan= spl_opt_info->last_plan; if (spl_plan) { - startup_cost= record_count * spl_plan->cost; + startup_cost= spl_opt_info->last_refills * spl_plan->cost; records= (ha_rows) (records * spl_plan->split_sel); - - Json_writer_object trace(thd, "lateral_derived"); - trace.add("startup_cost", startup_cost); - trace.add("splitting_cost", spl_plan->cost); - trace.add("records", records); } else + { startup_cost= spl_opt_info->unsplit_cost; + *spl_pd_boundary= 0; + } return spl_plan; } @@ -1060,16 +1175,16 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count, Inject equalities for splitting used by the materialization join @param - remaining_tables used to filter out the equalities that cannot - be pushed. + excluded_tables used to filter out the equalities that are not + to be pushed. @details - This function is called by JOIN_TAB::fix_splitting that is used - to fix the chosen splitting of a splittable materialized table T - in the final query execution plan. In this plan the table T - is joined just before the 'remaining_tables'. So all equalities - usable for splitting whose right parts do not depend on any of - remaining tables can be pushed into join for T. + This function injects equalities pushed into a derived table T for which + the split optimization has been chosen by the optimizer. The function + is called by JOIN::inject_splitting_cond_for_all_tables_with_split_opt(). + All equalities usable for splitting T whose right parts do not depend on + any of the 'excluded_tables' can be pushed into the where clause of the + derived table T. The function also marks the select that specifies T as UNCACHEABLE_DEPENDENT_INJECTED. @@ -1078,7 +1193,7 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count, true on failure */ -bool JOIN::inject_best_splitting_cond(table_map remaining_tables) +bool JOIN::inject_best_splitting_cond(table_map excluded_tables) { Item *inj_cond= 0; List *inj_cond_list= &spl_opt_info->inj_cond_list; @@ -1086,7 +1201,7 @@ bool JOIN::inject_best_splitting_cond(table_map remaining_tables) KEY_FIELD *added_key_field; while ((added_key_field= li++)) { - if (remaining_tables & added_key_field->val->used_tables()) + if (excluded_tables & added_key_field->val->used_tables()) continue; if (inj_cond_list->push_back(added_key_field->cond, thd->mem_root)) return true; @@ -1103,7 +1218,7 @@ bool JOIN::inject_best_splitting_cond(table_map remaining_tables) if (inj_cond) inj_cond->fix_fields(thd,0); - if (inject_cond_into_where(inj_cond)) + if (inject_cond_into_where(inj_cond->copy_andor_structure(thd))) return true; select_lex->uncacheable|= UNCACHEABLE_DEPENDENT_INJECTED; @@ -1154,7 +1269,7 @@ bool is_eq_cond_injected_for_split_opt(Item_func_eq *eq_item) @param spl_plan info on the splitting plan chosen for the splittable table T - remaining_tables the table T is joined just before these tables + excluded_tables tables that cannot be used in equalities pushed into T is_const_table the table T is a constant table @details @@ -1169,7 +1284,7 @@ bool is_eq_cond_injected_for_split_opt(Item_func_eq *eq_item) */ bool JOIN_TAB::fix_splitting(SplM_plan_info *spl_plan, - table_map remaining_tables, + table_map excluded_tables, bool is_const_table) { SplM_opt_info *spl_opt_info= table->spl_opt_info; @@ -1177,11 +1292,10 @@ bool JOIN_TAB::fix_splitting(SplM_plan_info *spl_plan, JOIN *md_join= spl_opt_info->join; if (spl_plan && !is_const_table) { + is_split_derived= true; memcpy((char *) md_join->best_positions, (char *) spl_plan->best_positions, sizeof(POSITION) * md_join->table_count); - if (md_join->inject_best_splitting_cond(remaining_tables)) - return true; /* This is called for a proper work of JOIN::get_best_combination() called for the join that materializes T @@ -1189,7 +1303,7 @@ bool JOIN_TAB::fix_splitting(SplM_plan_info *spl_plan, reset_validity_vars_for_keyuses(spl_plan->keyuse_ext_start, spl_plan->table, spl_plan->key, - remaining_tables, + excluded_tables, true); } else if (md_join->save_qep) @@ -1225,7 +1339,21 @@ bool JOIN::fix_all_splittings_in_plan() if (tab->table->is_splittable()) { SplM_plan_info *spl_plan= cur_pos->spl_plan; - if (tab->fix_splitting(spl_plan, all_tables & ~prev_tables, + table_map excluded_tables= (all_tables & ~prev_tables) | + sjm_lookup_tables; + ; + if (spl_plan) + { + POSITION *pos= cur_pos; + table_map spl_pd_boundary= pos->spl_pd_boundary; + do + { + excluded_tables|= pos->table->table->map; + } + while (!((pos--)->table->table->map & spl_pd_boundary)); + } + if (tab->fix_splitting(spl_plan, + excluded_tables, tablenr < const_tables )) return true; } @@ -1233,3 +1361,52 @@ bool JOIN::fix_all_splittings_in_plan() } return false; } + + +/** + @brief + Inject splitting conditions into WHERE of split derived + + @details + The function calls JOIN_TAB::inject_best_splitting_cond() for each + materialized derived table T used in this join for which the split + optimization has been chosen by the optimizer. It is done in order to + inject equalities pushed into the where clause of the specification + of T that would be helpful to employ the splitting technique. + + @retval + false on success + true on failure +*/ + +bool JOIN::inject_splitting_cond_for_all_tables_with_split_opt() +{ + table_map prev_tables= 0; + table_map all_tables= (table_map(1) << table_count) - 1; + for (uint tablenr= 0; tablenr < table_count; tablenr++) + { + POSITION *cur_pos= &best_positions[tablenr]; + JOIN_TAB *tab= cur_pos->table; + prev_tables|= tab->table->map; + if (!(tab->table->is_splittable() && cur_pos->spl_plan)) + continue; + SplM_opt_info *spl_opt_info= tab->table->spl_opt_info; + JOIN *join= spl_opt_info->join; + table_map excluded_tables= (all_tables & ~prev_tables) | sjm_lookup_tables; + table_map spl_pd_boundary= cur_pos->spl_pd_boundary; + for (POSITION *pos= cur_pos; ; pos--) + { + excluded_tables|= pos->table->table->map; + pos->table->no_forced_join_cache= true; + if (pos->table->table->map & spl_pd_boundary) + { + pos->table->split_derived_to_update|= tab->table->map; + break; + } + } + + if (join->inject_best_splitting_cond(excluded_tables)) + return true; + } + return false; +} diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 596b516965979..46db641987bf9 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -180,7 +180,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - optimize_semijoin_nests() does pre-optimization - during join optimization, the join has one JOIN_TAB (or is it POSITION?) - array, and suffix-based detection is used, see advance_sj_state() + array, and suffix-based detection is used, see optimize_semi_joins() - after join optimization is done, get_best_combination() switches the data-structure to prefix-based, multiple JOIN_TAB ranges format. @@ -664,6 +664,17 @@ int check_and_do_in_subquery_rewrites(JOIN *join) DBUG_RETURN(-1); } } + /* Check if any table is not supporting comparable rowids */ + { + List_iterator_fast li(select_lex->outer_select()->leaf_tables); + TABLE_LIST *tbl; + while ((tbl = li++)) + { + TABLE *table= tbl->table; + if (table && table->file->ha_table_flags() & HA_NON_COMPARABLE_ROWID) + join->not_usable_rowid_map|= table->map; + } + } DBUG_PRINT("info", ("Checking if subq can be converted to semi-join")); /* @@ -683,8 +694,11 @@ int check_and_do_in_subquery_rewrites(JOIN *join) 9. Parent select is not a table-less select 10. Neither parent nor child select have STRAIGHT_JOIN option. 11. It is first optimisation (the subquery could be moved from ON - clause during first optimisation and then be considered for SJ - on the second when it is too late) + clause during first optimisation and then be considered for SJ + on the second when it is too late) + 12. All tables supports comparable rowids. + This is needed for DuplicateWeedout strategy to work (which + is the catch-all semi-join strategy so it must be applicable). */ if (optimizer_flag(thd, OPTIMIZER_SWITCH_SEMIJOIN) && in_subs && // 1 @@ -699,11 +713,12 @@ int check_and_do_in_subquery_rewrites(JOIN *join) !((join->select_options | // 10 select_lex->outer_select()->join->select_options) // 10 & SELECT_STRAIGHT_JOIN) && // 10 - select_lex->first_cond_optimization) // 11 + select_lex->first_cond_optimization && // 11 + join->not_usable_rowid_map == 0) // 12 { DBUG_PRINT("info", ("Subquery is semi-join conversion candidate")); - (void)subquery_types_allow_materialization(thd, in_subs); + //(void)subquery_types_allow_materialization(thd, in_subs); in_subs->is_flattenable_semijoin= TRUE; @@ -1271,6 +1286,7 @@ bool convert_join_subqueries_to_semijoins(JOIN *join) while ((in_subq= li++)) { bool remove_item= TRUE; + subquery_types_allow_materialization(thd, in_subq); /* Stop processing if we've reached a subquery that's attached to the ON clause */ if (in_subq->do_not_convert_to_sj) @@ -1613,8 +1629,15 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) { SELECT_LEX *parent_lex= parent_join->select_lex; TABLE_LIST *emb_tbl_nest= NULL; + TABLE_LIST *orig_tl; List *emb_join_list= &parent_lex->top_join_list; THD *thd= parent_join->thd; + SELECT_LEX *save_lex; + Item **left; + Item *left_exp; + Item *left_exp_orig; + + uint ncols; DBUG_ENTER("convert_subq_to_sj"); /* @@ -1774,18 +1797,18 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) because view's tables are inserted after the view) */ - for (tl= (TABLE_LIST*)(parent_lex->table_list.first); tl->next_local; tl= tl->next_local) + for (orig_tl= (TABLE_LIST*)(parent_lex->table_list.first); + orig_tl->next_local; + orig_tl= orig_tl->next_local) {} - tl->next_local= subq_lex->join->tables_list; + orig_tl->next_local= subq_lex->join->tables_list; /* A theory: no need to re-connect the next_global chain */ /* 3. Remove the original subquery predicate from the WHERE/ON */ - // The subqueries were replaced for Item_int(1) earlier - subq_pred->reset_strategy(SUBS_SEMI_JOIN); // for subsequent executions - /*TODO: also reset the 'with_subquery' there. */ + /*TODO: also reset the 'm_with_subquery' there. */ /* n. Adjust the parent_join->table_count counter */ uint table_no= parent_join->table_count; @@ -1820,16 +1843,18 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) Put the subquery's WHERE into semi-join's sj_on_expr Add the subquery-induced equalities too. */ - SELECT_LEX *save_lex= thd->lex->current_select; + save_lex= thd->lex->current_select; + table_map subq_pred_used_tables; + thd->lex->current_select=subq_lex; - Item **left= subq_pred->left_exp_ptr(); + left= subq_pred->left_exp_ptr(); if ((*left)->fix_fields_if_needed(thd, left)) - DBUG_RETURN(TRUE); - Item *left_exp= *left; - Item *left_exp_orig= subq_pred->left_exp_orig(); + goto restore_tl_and_exit; + left_exp= *left; + left_exp_orig= subq_pred->left_exp_orig(); thd->lex->current_select=save_lex; - table_map subq_pred_used_tables= subq_pred->used_tables(); + subq_pred_used_tables= subq_pred->used_tables(); sj_nest->nested_join->sj_corr_tables= subq_pred_used_tables; sj_nest->nested_join->sj_depends_on= subq_pred_used_tables | left_exp->used_tables(); @@ -1850,7 +1875,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) Item_direct_view_refs doesn't substitute itself with anything in Item_direct_view_ref::fix_fields. */ - uint ncols= sj_nest->sj_in_exprs= left_exp->cols(); + ncols= sj_nest->sj_in_exprs= left_exp->cols(); sj_nest->nested_join->sj_outer_expr_list.empty(); reset_equality_number_for_subq_conds(sj_nest->sj_on_expr); @@ -1872,7 +1897,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) new (thd->mem_root) Item_func_eq(thd, left_exp_orig, subq_lex->ref_pointer_array[0]); if (!item_eq) - DBUG_RETURN(TRUE); + goto restore_tl_and_exit; if (left_exp_orig != left_exp) thd->change_item_tree(item_eq->arguments(), left_exp); item_eq->in_equality_no= 0; @@ -1893,7 +1918,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) Item_func_eq(thd, left_exp_orig->element_index(i), subq_lex->ref_pointer_array[i]); if (!item_eq) - DBUG_RETURN(TRUE); + goto restore_tl_and_exit; DBUG_ASSERT(left_exp->element_index(i)->fixed()); if (left_exp_orig->element_index(i) != left_exp->element_index(i)) @@ -1912,13 +1937,13 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) Item_row *row= new (thd->mem_root) Item_row(thd, subq_lex->pre_fix); /* fix fields on subquery was call so they should be the same */ if (!row) - DBUG_RETURN(TRUE); + goto restore_tl_and_exit; DBUG_ASSERT(ncols == row->cols()); nested_join->sj_outer_expr_list.push_back(left); Item_func_eq *item_eq= new (thd->mem_root) Item_func_eq(thd, left_exp_orig, row); if (!item_eq) - DBUG_RETURN(TRUE); + goto restore_tl_and_exit; for (uint i= 0; i < row->cols(); i++) { if (row->element_index(i) != subq_lex->ref_pointer_array[i]) @@ -1937,9 +1962,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) we have in here). */ if (sj_nest->sj_on_expr->fix_fields_if_needed(thd, &sj_nest->sj_on_expr)) - { - DBUG_RETURN(TRUE); - } + goto restore_tl_and_exit; /* Walk through sj nest's WHERE and ON expressions and call @@ -1964,9 +1987,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) emb_tbl_nest->on_expr->top_level_item(); if (emb_tbl_nest->on_expr->fix_fields_if_needed(thd, &emb_tbl_nest->on_expr)) - { - DBUG_RETURN(TRUE); - } + goto restore_tl_and_exit; } else { @@ -1980,9 +2001,8 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) save_lex= thd->lex->current_select; thd->lex->current_select=parent_join->select_lex; if (parent_join->conds->fix_fields_if_needed(thd, &parent_join->conds)) - { - DBUG_RETURN(1); - } + goto restore_tl_and_exit; + thd->lex->current_select=save_lex; parent_join->select_lex->where= parent_join->conds; } @@ -1995,9 +2015,16 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) parent_lex->ftfunc_list->push_front(ifm, thd->mem_root); } + // The subqueries were replaced for Item_int(1) earlier + subq_pred->reset_strategy(SUBS_SEMI_JOIN); // for subsequent executions + parent_lex->have_merged_subqueries= TRUE; /* Fatal error may have been set to by fix_after_pullout() */ DBUG_RETURN(thd->is_fatal_error); + +restore_tl_and_exit: + orig_tl->next_local= NULL; + DBUG_RETURN(TRUE); } @@ -2750,7 +2777,7 @@ bool find_eq_ref_candidate(TABLE *table, table_map sj_inner_tables) Do semi-join optimization step after we've added a new tab to join prefix SYNOPSIS - advance_sj_state() + optimize_semi_joins() join The join we're optimizing remaining_tables Tables not in the join prefix new_join_tab Join tab we've just added to the join prefix @@ -2810,9 +2837,9 @@ bool is_multiple_semi_joins(JOIN *join, POSITION *prefix, uint idx, table_map in } -void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx, - double *current_record_count, double *current_read_time, - POSITION *loose_scan_pos) +void optimize_semi_joins(JOIN *join, table_map remaining_tables, uint idx, + double *current_record_count, + double *current_read_time, POSITION *loose_scan_pos) { POSITION *pos= join->positions + idx; const JOIN_TAB *new_join_tab= pos->table; @@ -3003,19 +3030,37 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx, } } - if ((emb_sj_nest= new_join_tab->emb_sj_nest)) + update_sj_state(join, new_join_tab, idx, remaining_tables); + + pos->prefix_cost.convert_from_cost(*current_read_time); + pos->prefix_record_count= *current_record_count; + pos->dups_producing_tables= dups_producing_tables; +} + + +/* + Update JOIN's semi-join optimization state after the join tab new_tab + has been added into the join prefix. + + @seealso restore_prev_sj_state() does the reverse actoion +*/ + +void update_sj_state(JOIN *join, const JOIN_TAB *new_tab, + uint idx, table_map remaining_tables) +{ + DBUG_ASSERT(!join->emb_sjm_nest); + if (TABLE_LIST *emb_sj_nest= new_tab->emb_sj_nest) { join->cur_sj_inner_tables |= emb_sj_nest->sj_inner_tables; /* Remove the sj_nest if all of its SJ-inner tables are in cur_table_map */ if (!(remaining_tables & - emb_sj_nest->sj_inner_tables & ~new_join_tab->table->map)) + emb_sj_nest->sj_inner_tables & ~new_tab->table->map)) join->cur_sj_inner_tables &= ~emb_sj_nest->sj_inner_tables; } - - pos->prefix_cost.convert_from_cost(*current_read_time); - pos->prefix_record_count= *current_record_count; - pos->dups_producing_tables= dups_producing_tables; +#ifndef DBUG_OFF + join->dbug_verify_sj_inner_tables(idx + 1); +#endif } @@ -3527,6 +3572,9 @@ bool Duplicate_weedout_picker::check_qep(JOIN *join, } else { + /* Ensure that table supports comparable rowids */ + DBUG_ASSERT(!(p->table->table->file->ha_table_flags() & HA_NON_COMPARABLE_ROWID)); + sj_outer_fanout= COST_MULT(sj_outer_fanout, p->records_read); temptable_rec_size += p->table->table->file->ref_length; } @@ -3568,10 +3616,45 @@ bool Duplicate_weedout_picker::check_qep(JOIN *join, return FALSE; } +#ifndef DBUG_OFF +/* + Verify the value of JOIN::cur_sj_inner_tables by recomputing it +*/ +void JOIN::dbug_verify_sj_inner_tables(uint prefix_size) const +{ + table_map cur_map= const_table_map; + table_map nests_entered= 0; + if (emb_sjm_nest) + { + DBUG_ASSERT(cur_sj_inner_tables == 0); + return; + } + + for (uint i= const_tables; i < prefix_size; i++) + { + JOIN_TAB *tab= positions[i].table; + cur_map |= tab->table->map; + if (TABLE_LIST *sj_nest= tab->emb_sj_nest) + { + nests_entered |= sj_nest->sj_inner_tables; + if (!(sj_nest->sj_inner_tables & ~cur_map)) + { + // all nest tables are in the prefix already + nests_entered &= ~sj_nest->sj_inner_tables; + } + } + } + DBUG_ASSERT(nests_entered == cur_sj_inner_tables); +} +#endif /* Remove the last join tab from from join->cur_sj_inner_tables bitmap - we assume remaining_tables doesnt contain @tab. + + @note + remaining_tables contains @tab. + + @seealso update_sj_state() does the reverse */ void restore_prev_sj_state(const table_map remaining_tables, @@ -3585,15 +3668,30 @@ void restore_prev_sj_state(const table_map remaining_tables, tab->join->sjm_lookup_tables &= ~subq_tables; } - if ((emb_sj_nest= tab->emb_sj_nest)) + if (!tab->join->emb_sjm_nest && (emb_sj_nest= tab->emb_sj_nest)) { + table_map subq_tables= emb_sj_nest->sj_inner_tables & + ~tab->join->const_table_map; /* If we're removing the last SJ-inner table, remove the sj-nest */ - if ((remaining_tables & emb_sj_nest->sj_inner_tables) == - (emb_sj_nest->sj_inner_tables & ~tab->table->map)) + if ((remaining_tables & subq_tables) == subq_tables) { + // All non-const tables of the SJ nest are in the remaining_tables. + // we are not in the nest anymore. tab->join->cur_sj_inner_tables &= ~emb_sj_nest->sj_inner_tables; } + else + { + // Semi-join nest has: + // - a table being removed (not in the prefix) + // - some tables in the prefix. + tab->join->cur_sj_inner_tables |= emb_sj_nest->sj_inner_tables; + } } + +#ifndef DBUG_OFF + /* positions[idx] has been removed. Verify the state for [0...idx-1] */ + tab->join->dbug_verify_sj_inner_tables(idx); +#endif } @@ -3820,8 +3918,8 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join) join->best_positions[first].sj_strategy= SJ_OPT_MATERIALIZE_SCAN; join->best_positions[first].n_sj_tables= sjm->tables; /* - Do what advance_sj_state did: re-run best_access_path for every table - in the [last_inner_table + 1; pos..) range + Do what optimize_semi_joins did: re-run best_access_path for every + table in the [last_inner_table + 1; pos..) range */ double prefix_rec_count; /* Get the prefix record count */ @@ -4089,6 +4187,7 @@ bool setup_sj_materialization_part1(JOIN_TAB *sjm_tab) } sjm->sjm_table_param.field_count= subq_select->item_list.elements; + sjm->sjm_table_param.func_count= sjm->sjm_table_param.field_count; sjm->sjm_table_param.force_not_null_cols= TRUE; if (!(sjm->table= create_tmp_table(thd, &sjm->sjm_table_param, @@ -5075,7 +5174,7 @@ int setup_semijoin_loosescan(JOIN *join) The choice between the strategies is made by the join optimizer (see - advance_sj_state() and fix_semijoin_strategies_for_picked_join_order()). + optimize_semi_joins() and fix_semijoin_strategies_for_picked_join_order()). This function sets up all fields/structures/etc needed for execution except for setup/initialization of semi-join materialization which is done in setup_sj_materialization() (todo: can't we move that to here also?) @@ -5704,14 +5803,14 @@ TABLE *create_dummy_tmp_table(THD *thd) DBUG_ENTER("create_dummy_tmp_table"); TABLE *table; TMP_TABLE_PARAM sjm_table_param; - sjm_table_param.init(); - sjm_table_param.field_count= 1; List sjm_table_cols; const LEX_CSTRING dummy_name= { STRING_WITH_LEN("dummy") }; Item *column_item= new (thd->mem_root) Item_int(thd, 1); if (!column_item) DBUG_RETURN(NULL); + sjm_table_param.init(); + sjm_table_param.field_count= sjm_table_param.func_count= 1; sjm_table_cols.push_back(column_item, thd->mem_root); if (!(table= create_tmp_table(thd, &sjm_table_param, sjm_table_cols, (ORDER*) 0, diff --git a/sql/opt_subselect.h b/sql/opt_subselect.h index abd37f1e98ed7..7b1b810ee81ad 100644 --- a/sql/opt_subselect.h +++ b/sql/opt_subselect.h @@ -314,9 +314,11 @@ class Loose_scan_opt }; -void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx, - double *current_record_count, double *current_read_time, - POSITION *loose_scan_pos); +void optimize_semi_joins(JOIN *join, table_map remaining_tables, uint idx, + double *current_record_count, + double *current_read_time, POSITION *loose_scan_pos); +void update_sj_state(JOIN *join, const JOIN_TAB *new_tab, + uint idx, table_map remaining_tables); void restore_prev_sj_state(const table_map remaining_tables, const JOIN_TAB *tab, uint idx); diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index b3871254e6eb6..794ec40fc660a 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2008, 2017, MariaDB Corporation. + Copyright (c) 2008, 2021, 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 @@ -438,7 +438,7 @@ int opt_sum_query(THD *thd, The optimization is not applicable in both cases: (a) 'expr' is a non-constant expression. Then we can't replace 'expr' by a constant. - (b) 'expr' is a costant. According to ANSI, MIN/MAX must return + (b) 'expr' is a constant. According to ANSI, MIN/MAX must return NULL if the query does not return any rows. Thus, if we are not able to determine if the query returns any rows, we can't apply the optimization and replace MIN/MAX with a constant. @@ -953,6 +953,9 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref, part->length < part_field->key_length()) break; + if (part->key_part_flag & HA_REVERSE_SORT) + break; // TODO MDEV-27576 + if (field->eq(part->field)) { ref->key= idx; diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc index 8c4720bdec4ad..03ee1a2ad6201 100644 --- a/sql/opt_table_elimination.cc +++ b/sql/opt_table_elimination.cc @@ -218,7 +218,7 @@ class Dep_value : public Sql_alloc { public: Dep_value(): bound(FALSE) {} - virtual ~Dep_value(){} /* purecov: inspected */ /* stop compiler warnings */ + virtual ~Dep_value() = default; /* purecov: inspected */ bool is_bound() { return bound; } void make_bound() { bound= TRUE; } @@ -342,7 +342,7 @@ const size_t Dep_value::iterator_size= class Dep_module : public Sql_alloc { public: - virtual ~Dep_module(){} /* purecov: inspected */ /* stop compiler warnings */ + virtual ~Dep_module() = default; /* purecov: inspected */ /* Mark as bound. Currently is non-virtual and does nothing */ void make_bound() {}; diff --git a/sql/parse_file.cc b/sql/parse_file.cc index 8911c68390189..f4aae1300e2c1 100644 --- a/sql/parse_file.cc +++ b/sql/parse_file.cc @@ -175,11 +175,12 @@ write_parameter(IO_CACHE *file, const uchar* base, File_option *parameter) { /* string have to be allocated already */ LEX_STRING *val_s= (LEX_STRING *)(base + parameter->offset); - time_t tm= my_time(0); - - get_date(val_s->str, GETDATE_DATE_TIME|GETDATE_GMT|GETDATE_FIXEDLENGTH, - tm); - val_s->length= PARSE_FILE_TIMESTAMPLENGTH; + // number of microseconds since Epoch, timezone-independent + my_hrtime_t tm= my_hrtime(); + // Paded to 19 characters for compatibility + val_s->length= snprintf(val_s->str, MICROSECOND_TIMESTAMP_BUFFER_SIZE, + "%019lld", tm.val); + DBUG_ASSERT(val_s->length == MICROSECOND_TIMESTAMP_BUFFER_SIZE-1); if (my_b_write(file, (const uchar *)val_s->str, PARSE_FILE_TIMESTAMPLENGTH)) DBUG_RETURN(TRUE); @@ -464,6 +465,8 @@ sql_parse_prepare(const LEX_CSTRING *file_name, MEM_ROOT *mem_root, DBUG_RETURN(0); } + MSAN_STAT_WORKAROUND(&stat_info); + if (stat_info.st_size > INT_MAX-1) { my_error(ER_FPARSER_TOO_BIG_FILE, MYF(0), file_name->str); @@ -882,16 +885,16 @@ File_parser::parse(uchar* base, MEM_ROOT *mem_root, { /* string have to be allocated already */ LEX_STRING *val= (LEX_STRING *)(base + parameter->offset); - /* yyyy-mm-dd HH:MM:SS = 19(PARSE_FILE_TIMESTAMPLENGTH) characters */ - if (ptr[PARSE_FILE_TIMESTAMPLENGTH] != '\n') + /* 19 characters of timestamp */ + if (ptr[MICROSECOND_TIMESTAMP_BUFFER_SIZE-1] != '\n') { my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0), parameter->name.str, line); DBUG_RETURN(TRUE); } - memcpy(val->str, ptr, PARSE_FILE_TIMESTAMPLENGTH); - val->str[val->length= PARSE_FILE_TIMESTAMPLENGTH]= '\0'; - ptr+= (PARSE_FILE_TIMESTAMPLENGTH+1); + memcpy(val->str, ptr, MICROSECOND_TIMESTAMP_BUFFER_SIZE-1); + val->str[val->length= MICROSECOND_TIMESTAMP_BUFFER_SIZE-1]= '\0'; + ptr+= MICROSECOND_TIMESTAMP_BUFFER_SIZE; break; } case FILE_OPTIONS_STRLIST: diff --git a/sql/parse_file.h b/sql/parse_file.h index cd26ffec91ab5..0589d628bfcd8 100644 --- a/sql/parse_file.h +++ b/sql/parse_file.h @@ -55,8 +55,8 @@ struct File_option class Unknown_key_hook { public: - Unknown_key_hook() {} /* Remove gcc warning */ - virtual ~Unknown_key_hook() {} /* Remove gcc warning */ + Unknown_key_hook() = default; /* Remove gcc warning */ + virtual ~Unknown_key_hook() = default; /* Remove gcc warning */ virtual bool process_unknown_string(const char *&unknown_key, uchar* base, MEM_ROOT *mem_root, const char *end)= 0; }; @@ -67,7 +67,7 @@ class Unknown_key_hook class File_parser_dummy_hook: public Unknown_key_hook { public: - File_parser_dummy_hook() {} /* Remove gcc warning */ + File_parser_dummy_hook() = default; /* Remove gcc warning */ virtual bool process_unknown_string(const char *&unknown_key, uchar* base, MEM_ROOT *mem_root, const char *end); }; diff --git a/sql/partition_element.h b/sql/partition_element.h index c551baa309241..1abaa315218fd 100644 --- a/sql/partition_element.h +++ b/sql/partition_element.h @@ -2,6 +2,7 @@ #define PARTITION_ELEMENT_INCLUDED /* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2021, 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 @@ -126,6 +127,9 @@ class partition_element :public Sql_alloc bool empty; elem_type_enum type; + engine_option_value *option_list; // create options for partition + ha_table_option_struct *option_struct; // structure with parsed options + partition_element() : part_max_rows(0), part_min_rows(0), range_value(0), partition_name(NULL), @@ -136,7 +140,8 @@ class partition_element :public Sql_alloc signed_flag(FALSE), max_value(FALSE), id(UINT_MAX32), empty(true), - type(CONVENTIONAL) + type(CONVENTIONAL), + option_list(NULL), option_struct(NULL) {} partition_element(partition_element *part_elem) : part_max_rows(part_elem->part_max_rows), @@ -155,9 +160,11 @@ class partition_element :public Sql_alloc max_value(part_elem->max_value), id(part_elem->id), empty(part_elem->empty), - type(CONVENTIONAL) + type(CONVENTIONAL), + option_list(part_elem->option_list), + option_struct(part_elem->option_struct) {} - ~partition_element() {} + ~partition_element() = default; part_column_list_val& get_col_val(uint idx) { diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 62a3092f369fd..8bef416587822 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2006, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2020, MariaDB Corporation. + Copyright (c) 2010, 2022, 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 @@ -40,7 +40,7 @@ #include "ha_partition.h" -partition_info *partition_info::get_clone(THD *thd) +partition_info *partition_info::get_clone(THD *thd, bool empty_data_and_index_file) { MEM_ROOT *mem_root= thd->mem_root; DBUG_ENTER("partition_info::get_clone"); @@ -60,21 +60,22 @@ partition_info *partition_info::get_clone(THD *thd) { List_iterator subpart_it(part->subpartitions); partition_element *subpart; - partition_element *part_clone= new (mem_root) partition_element(); + partition_element *part_clone= new (mem_root) partition_element(*part); if (!part_clone) DBUG_RETURN(NULL); - - *part_clone= *part; part_clone->subpartitions.empty(); while ((subpart= (subpart_it++))) { - partition_element *subpart_clone= new (mem_root) partition_element(); + partition_element *subpart_clone= new (mem_root) partition_element(*subpart); if (!subpart_clone) DBUG_RETURN(NULL); - - *subpart_clone= *subpart; + if (empty_data_and_index_file) + subpart_clone->data_file_name= subpart_clone->index_file_name= NULL; part_clone->subpartitions.push_back(subpart_clone, mem_root); } + + if (empty_data_and_index_file) + part_clone->data_file_name= part_clone->index_file_name= NULL; clone->partitions.push_back(part_clone, mem_root); part_clone->list_val_list.empty(); List_iterator list_val_it(part->list_val_list); @@ -283,27 +284,6 @@ bool partition_info::set_partition_bitmaps(List *partition_names) } -/** - Set read/lock_partitions bitmap over non pruned partitions - - @param table_list Possible TABLE_LIST which can contain - list of partition names to query - - @return Operation status - @retval FALSE OK - @retval TRUE Failed to allocate memory for bitmap or list of partitions - did not match - - @note OK to call multiple times without the need for free_bitmaps. -*/ -bool partition_info::set_partition_bitmaps_from_table(TABLE_LIST *table_list) -{ - List *partition_names= table_list ? - NULL : table_list->partition_names; - return set_partition_bitmaps(partition_names); -} - - /* Create a memory area where default partition names are stored and fill it up with the names. @@ -819,42 +799,41 @@ bool partition_info::has_unique_name(partition_element *element) vers_info->interval Limit by fixed time interval vers_info->hist_part (out) Working history partition */ -void partition_info::vers_set_hist_part(THD *thd) +int partition_info::vers_set_hist_part(THD *thd) { + if (!vers_require_hist_part(thd)) + return 0; + + if (table->pos_in_table_list && + table->pos_in_table_list->partition_names) + { + return HA_ERR_PARTITION_LIST; + } if (vers_info->limit) { ha_partition *hp= (ha_partition*)(table->file); - partition_element *next= NULL; + partition_element *next; List_iterator it(partitions); - while (next != vers_info->hist_part) - next= it++; - ha_rows records= hp->part_records(next); + ha_rows records= 0; + vers_info->hist_part= partitions.head(); while ((next= it++) != vers_info->now_part) { + DBUG_ASSERT(bitmap_is_set(&read_partitions, next->id)); ha_rows next_records= hp->part_records(next); if (next_records == 0) break; vers_info->hist_part= next; records= next_records; } - if (records >= vers_info->limit) - { - if (next == vers_info->now_part) - { - my_error(WARN_VERS_PART_FULL, MYF(ME_WARNING|ME_ERROR_LOG), - table->s->db.str, table->s->table_name.str, - vers_info->hist_part->partition_name, "LIMIT"); - } - else - vers_info->hist_part= next; - } - return; + if (records >= vers_info->limit && next != vers_info->now_part) + vers_info->hist_part= next; + return 0; } if (vers_info->interval.is_set()) { if (vers_info->hist_part->range_value > thd->query_start()) - return; + return 0; partition_element *next= NULL; List_iterator it(partitions); @@ -865,9 +844,49 @@ void partition_info::vers_set_hist_part(THD *thd) { vers_info->hist_part= next; if (next->range_value > thd->query_start()) - return; + return 0; } } + return 0; +} + + +/** + Warn at the end of DML command if the last history partition is out of LIMIT. +*/ +void partition_info::vers_check_limit(THD *thd) +{ + if (!vers_info->limit || + vers_info->hist_part->id + 1 < vers_info->now_part->id) + return; + + /* + NOTE: at this point read_partitions bitmap is already pruned by DML code, + we have to set read bits for working history partition. We could use + bitmap_set_all(), but this is not optimal since there can be quite a number + of partitions. + */ +#ifndef DBUG_OFF + const uint32 sub_factor= num_subparts ? num_subparts : 1; + uint32 part_id= vers_info->hist_part->id * sub_factor; + const uint32 part_id_end __attribute__((unused)) = part_id + sub_factor; + DBUG_ASSERT(part_id_end <= num_parts * sub_factor); +#endif + + ha_partition *hp= (ha_partition*)(table->file); + ha_rows hist_rows= hp->part_records(vers_info->hist_part); + if (hist_rows >= vers_info->limit) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + WARN_VERS_PART_FULL, + ER_THD(thd, WARN_VERS_PART_FULL), + table->s->db.str, table->s->table_name.str, + vers_info->hist_part->partition_name, "LIMIT"); + + sql_print_warning(ER_THD(thd, WARN_VERS_PART_FULL), + table->s->db.str, table->s->table_name.str, + vers_info->hist_part->partition_name, "LIMIT"); + } } @@ -1486,7 +1505,6 @@ bool partition_info::set_up_charset_field_preps(THD *thd) uchar **char_ptrs; unsigned i; size_t size; - uint tot_fields= 0; uint tot_part_fields= 0; uint tot_subpart_fields= 0; DBUG_ENTER("set_up_charset_field_preps"); @@ -1498,13 +1516,8 @@ bool partition_info::set_up_charset_field_preps(THD *thd) ptr= part_field_array; /* Set up arrays and buffers for those fields */ while ((field= *(ptr++))) - { if (field_is_partition_charset(field)) - { tot_part_fields++; - tot_fields++; - } - } size= tot_part_fields * sizeof(char*); if (!(char_ptrs= (uchar**)thd->calloc(size))) goto error; @@ -1538,13 +1551,8 @@ bool partition_info::set_up_charset_field_preps(THD *thd) /* Set up arrays and buffers for those fields */ ptr= subpart_field_array; while ((field= *(ptr++))) - { if (field_is_partition_charset(field)) - { tot_subpart_fields++; - tot_fields++; - } - } size= tot_subpart_fields * sizeof(char*); if (!(char_ptrs= (uchar**) thd->calloc(size))) goto error; diff --git a/sql/partition_info.h b/sql/partition_info.h index 995147d67664e..d80676057d312 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -79,6 +79,10 @@ struct Vers_part_info : public Sql_alloc partition_element *hist_part; }; +/* + See generate_partition_syntax() for details of how the data is used + in partition expression. +*/ class partition_info : public DDL_LOG_STATE, public Sql_alloc { public: @@ -88,6 +92,10 @@ class partition_info : public DDL_LOG_STATE, public Sql_alloc List partitions; List temp_partitions; + /* + These are mutually exclusive with part_expr/subpart_expr depending on + what is specified in partitioning filter: expression or column list. + */ List part_field_list; List subpart_field_list; @@ -324,12 +332,11 @@ class partition_info : public DDL_LOG_STATE, public Sql_alloc part_field_list.empty(); subpart_field_list.empty(); } - ~partition_info() {} + ~partition_info() = default; - partition_info *get_clone(THD *thd); + partition_info *get_clone(THD *thd, bool empty_data_and_index_file= FALSE); bool set_named_partition_bitmap(const char *part_name, size_t length); bool set_partition_bitmaps(List *partition_names); - bool set_partition_bitmaps_from_table(TABLE_LIST *table_list); /* Answers the question if subpartitioning is used for a certain table */ bool is_sub_partitioned() { @@ -400,7 +407,13 @@ class partition_info : public DDL_LOG_STATE, public Sql_alloc vers_info->limit= limit; return !limit; } - void vers_set_hist_part(THD *thd); + bool vers_require_hist_part(THD *thd) const + { + return part_type == VERSIONING_PARTITION && + thd->lex->vers_history_generating(); + } + int vers_set_hist_part(THD *thd); + void vers_check_limit(THD *thd); bool vers_fix_field_list(THD *thd); void vers_update_el_ids(); partition_element *get_partition(uint part_id) @@ -415,8 +428,13 @@ class partition_info : public DDL_LOG_STATE, public Sql_alloc return NULL; } uint next_part_no(uint new_parts) const; + + int gen_part_type(THD *thd, String *str) const; }; +void part_type_error(THD *thd, partition_info *work_part_info, + const char *part_type, partition_info *tab_part_info); + uint32 get_next_partition_id_range(struct st_partition_iter* part_iter); bool check_partition_dirs(partition_info *part_info); diff --git a/sql/privilege.h b/sql/privilege.h index c12331025226b..82173912e2a7d 100644 --- a/sql/privilege.h +++ b/sql/privilege.h @@ -293,7 +293,7 @@ constexpr privilege_t SHOW_CREATE_TABLE_ACLS= existing temporary tables (CREATE_ACL is necessary for ALTER ... RENAME). */ constexpr privilege_t TMP_TABLE_ACLS= - COL_DML_ACLS | ALL_TABLE_DDL_ACLS; + COL_DML_ACLS | ALL_TABLE_DDL_ACLS | REFERENCES_ACL; constexpr privilege_t PRIV_LOCK_TABLES= SELECT_ACL | LOCK_TABLES_ACL; diff --git a/sql/protocol.cc b/sql/protocol.cc index b2ca946037c86..33d865a3f9f00 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -465,8 +465,12 @@ bool Protocol::net_send_error_packet(THD *thd, uint sql_errno, const char *err, coming from server to have seq_no > 0, due to missing awareness of "out-of-band" operations. Make these clients happy. */ - if (!net->pkt_nr) - net->pkt_nr= 1; + if (!net->pkt_nr && + (sql_errno == ER_CONNECTION_KILLED || sql_errno == ER_SERVER_SHUTDOWN || + sql_errno == ER_QUERY_INTERRUPTED)) + { + net->pkt_nr= 1; + } ret= net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) buff, length); diff --git a/sql/protocol.h b/sql/protocol.h index f095ad68a345c..683bbd6958302 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -90,7 +90,7 @@ class Protocol public: THD *thd; Protocol(THD *thd_arg) { init(thd_arg); } - virtual ~Protocol() {} + virtual ~Protocol() = default; void init(THD* thd_arg); enum { SEND_NUM_ROWS= 1, SEND_EOF= 2, SEND_FORCE_COLUMN_INFO= 4 }; diff --git a/sql/records.cc b/sql/records.cc index 09500b3acef37..3aad36ca86253 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2010, Oracle and/or its affiliates. - Copyright (c) 2009, 2017, MariaDB Corporation + Copyright (c) 2009, 2022, 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 @@ -355,7 +355,7 @@ void end_read_record(READ_RECORD *info) free_cache(info); if (info->table) { - if (info->table->is_created()) + if (info->table->db_stat) // if opened (void) info->table->file->extra(HA_EXTRA_NO_CACHE); if (info->read_record_func != rr_quick) // otherwise quick_range does it (void) info->table->file->ha_index_or_rnd_end(); @@ -568,7 +568,7 @@ template static int rr_unpack_from_tempfile(READ_RECORD *info) { uchar *destination= info->rec_buf; -#ifndef DBUG_OFF +#ifdef DBUG_TRACE my_off_t where= my_b_tell(info->io_cache); #endif if (Packed_addon_fields) diff --git a/sql/rowid_filter.cc b/sql/rowid_filter.cc index 4a3746d72db02..0589b587ba25d 100644 --- a/sql/rowid_filter.cc +++ b/sql/rowid_filter.cc @@ -350,6 +350,9 @@ void TABLE::init_cost_info_for_usable_range_rowid_filters(THD *thd) usable_range_filter_keys.clear_all(); key_map::Iterator it(opt_range_keys); + if (file->ha_table_flags() & HA_NON_COMPARABLE_ROWID) + return; // Cannot create filtering + /* From all indexes that can be used for range accesses select only such that - range filter pushdown is supported by the engine for them (1) diff --git a/sql/rowid_filter.h b/sql/rowid_filter.h index 12710aecb185b..02962f3e677e1 100644 --- a/sql/rowid_filter.h +++ b/sql/rowid_filter.h @@ -192,7 +192,10 @@ class Rowid_filter_container : public Sql_alloc */ virtual bool check(void *ctxt, char *elem) = 0; - virtual ~Rowid_filter_container() {} + /* True if the container does not contain any element */ + virtual bool is_empty() = 0; + + virtual ~Rowid_filter_container() = default; }; @@ -229,7 +232,9 @@ class Rowid_filter : public Sql_alloc */ virtual bool check(char *elem) = 0; - virtual ~Rowid_filter() {} + virtual ~Rowid_filter() = default; + + bool is_empty() { return container->is_empty(); } Rowid_filter_container *get_container() { return container; } @@ -268,6 +273,8 @@ class Range_rowid_filter: public Rowid_filter bool check(char *elem) { + if (container->is_empty()) + return false; bool was_checked= container->check(table, elem); tracker->increment_checked_elements_count(was_checked); return was_checked; @@ -340,6 +347,8 @@ class Refpos_container_sorted_array : public Sql_alloc my_qsort2(array->front(), array->elements()/elem_size, elem_size, (qsort2_cmp) cmp, cmp_arg); } + + bool is_empty() { return elements() == 0; } }; @@ -369,6 +378,8 @@ class Rowid_filter_sorted_array: public Rowid_filter_container bool add(void *ctxt, char *elem) { return refpos_container.add(elem); } bool check(void *ctxt, char *elem); + + bool is_empty() { return refpos_container.is_empty(); } }; /** diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc index 306ae8780608d..f7059668b11aa 100644 --- a/sql/rpl_gtid.cc +++ b/sql/rpl_gtid.cc @@ -17,6 +17,7 @@ /* Definitions for MariaDB global transaction ID (GTID). */ +#ifndef MYSQL_CLIENT #include "mariadb.h" #include "sql_priv.h" #include "unireg.h" @@ -24,7 +25,6 @@ #include "sql_base.h" #include "sql_parse.h" #include "key.h" -#include "rpl_gtid.h" #include "rpl_rli.h" #include "slave.h" #include "log_event.h" @@ -607,6 +607,8 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id, wait_for_commit* suspended_wfc; void *hton= NULL; LEX_CSTRING gtid_pos_table_name; + TABLE *tbl= nullptr; + MDL_savepoint m_start_of_statement_svp(thd->mdl_context.mdl_savepoint()); DBUG_ENTER("record_gtid"); *out_hton= NULL; @@ -625,6 +627,18 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id, if (!in_statement) thd->reset_for_next_command(); + if (thd->rgi_slave && (thd->rgi_slave->gtid_ev_flags_extra & + Gtid_log_event::FL_START_ALTER_E1)) + { + /* + store the open table table list in ptr, so that is close_thread_tables + is called start alter tables are not closed + */ + mysql_mutex_lock(&thd->LOCK_thd_data); + tbl= thd->open_tables; + thd->open_tables= nullptr; + mysql_mutex_unlock(&thd->LOCK_thd_data); + } /* Only the SQL thread can call select_gtid_pos_table without a mutex Other threads needs to use a mutex and take into account that the @@ -734,12 +748,23 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id, { if (err || (err= ha_commit_trans(thd, FALSE))) ha_rollback_trans(thd, FALSE); - close_thread_tables(thd); - if (in_transaction) - thd->mdl_context.release_statement_locks(); - else - thd->release_transactional_locks(); + if (!thd->rgi_slave || !(thd->rgi_slave->gtid_ev_flags_extra & + Gtid_log_event::FL_START_ALTER_E1)) + { + if (in_transaction) + thd->mdl_context.release_statement_locks(); + else + thd->release_transactional_locks(); + } + } + if (thd->rgi_slave && + thd->rgi_slave->gtid_ev_flags_extra & Gtid_log_event::FL_START_ALTER_E1) + { + mysql_mutex_lock(&thd->LOCK_thd_data); + thd->open_tables= tbl; + mysql_mutex_unlock(&thd->LOCK_thd_data); + thd->mdl_context.rollback_to_savepoint(m_start_of_statement_svp); } thd->lex->restore_backup_query_tables_list(&lex_backup); thd->variables.option_bits= thd_saved_option; @@ -1273,6 +1298,7 @@ rpl_slave_state::domain_to_gtid(uint32 domain_id, rpl_gtid *out_gtid) return true; } +#endif /* Parse a GTID at the start of a string, and update the pointer to point @@ -1310,7 +1336,6 @@ gtid_parser_helper(const char **ptr, const char *end, rpl_gtid *out_gtid) return 0; } - rpl_gtid * gtid_parse_string_to_list(const char *str, size_t str_len, uint32 *out_len) { @@ -1349,6 +1374,7 @@ gtid_parse_string_to_list(const char *str, size_t str_len, uint32 *out_len) return list; } +#ifndef MYSQL_CLIENT /* Update the slave replication state with the GTID position obtained from @@ -1743,7 +1769,7 @@ rpl_binlog_state::alloc_element_nolock(const rpl_gtid *gtid) */ bool rpl_binlog_state::check_strict_sequence(uint32 domain_id, uint32 server_id, - uint64 seq_no) + uint64 seq_no, bool no_error) { element *elem; bool res= 0; @@ -1754,9 +1780,10 @@ rpl_binlog_state::check_strict_sequence(uint32 domain_id, uint32 server_id, sizeof(domain_id))) && elem->last_gtid && elem->last_gtid->seq_no >= seq_no) { - my_error(ER_GTID_STRICT_OUT_OF_ORDER, MYF(0), domain_id, server_id, seq_no, - elem->last_gtid->domain_id, elem->last_gtid->server_id, - elem->last_gtid->seq_no); + if (!no_error) + my_error(ER_GTID_STRICT_OUT_OF_ORDER, MYF(0), domain_id, server_id, seq_no, + elem->last_gtid->domain_id, elem->last_gtid->server_id, + elem->last_gtid->seq_no); res= 1; } mysql_mutex_unlock(&LOCK_binlog_state); @@ -2974,3 +3001,843 @@ gtid_waiting::remove_from_wait_queue(gtid_waiting::hash_element *he, queue_remove(&he->queue, elem->queue_idx); } + +#endif + +void free_domain_lookup_element(void *p) +{ + struct Binlog_gtid_state_validator::audit_elem *audit_elem= + (struct Binlog_gtid_state_validator::audit_elem *) p; + delete_dynamic(&audit_elem->late_gtids_previous); + delete_dynamic(&audit_elem->late_gtids_real); + my_free(audit_elem); +} + +Binlog_gtid_state_validator::Binlog_gtid_state_validator() +{ + my_hash_init(PSI_INSTRUMENT_ME, &m_audit_elem_domain_lookup, &my_charset_bin, 32, + offsetof(struct audit_elem, domain_id), sizeof(uint32), + NULL, free_domain_lookup_element, HASH_UNIQUE); +} + +Binlog_gtid_state_validator::~Binlog_gtid_state_validator() +{ + my_hash_free(&m_audit_elem_domain_lookup); +} + +void Binlog_gtid_state_validator::initialize_start_gtids(rpl_gtid *start_gtids, + size_t n_gtids) +{ + size_t i; + for(i= 0; i < n_gtids; i++) + { + rpl_gtid *domain_state_gtid= &start_gtids[i]; + + /* + If we are initializing from a GLLE, we can have repeat domain ids from + differing servers, so we want to ensure our start gtid matches the last + known position + */ + struct audit_elem *audit_elem= (struct audit_elem *) my_hash_search( + &m_audit_elem_domain_lookup, + (const uchar *) &(domain_state_gtid->domain_id), 0); + if (audit_elem) + { + /* + We have this domain already specified, so try to overwrite with the + more recent GTID + */ + if (domain_state_gtid->seq_no > audit_elem->start_gtid.seq_no) + audit_elem->start_gtid = *domain_state_gtid; + continue; + } + + /* Initialize a new domain */ + audit_elem= (struct audit_elem *) my_malloc( + PSI_NOT_INSTRUMENTED, sizeof(struct audit_elem), MYF(MY_WME)); + if (!audit_elem) + { + my_error(ER_OUT_OF_RESOURCES, MYF(0)); + return; + } + + audit_elem->domain_id= start_gtids[i].domain_id; + audit_elem->start_gtid= start_gtids[i]; + audit_elem->last_gtid= {audit_elem->domain_id, 0, 0}; + + my_init_dynamic_array(PSI_INSTRUMENT_ME, &audit_elem->late_gtids_real, + sizeof(rpl_gtid), 8, 8, MYF(0)); + my_init_dynamic_array(PSI_INSTRUMENT_ME, &audit_elem->late_gtids_previous, + sizeof(rpl_gtid), 8, 8, MYF(0)); + + if (my_hash_insert(&m_audit_elem_domain_lookup, (uchar *) audit_elem)) + { + my_free(audit_elem); + my_error(ER_OUT_OF_RESOURCES, MYF(0)); + return; + } + } +} + +my_bool Binlog_gtid_state_validator::initialize_gtid_state(FILE *out, + rpl_gtid *gtids, + size_t n_gtids) +{ + size_t i; + my_bool err= FALSE; + + /* + We weren't initialized with starting positions explicitly, so assume the + starting positions of the current gtid state + */ + if (!m_audit_elem_domain_lookup.records) + initialize_start_gtids(gtids, n_gtids); + + for(i= 0; i < n_gtids; i++) + { + rpl_gtid *domain_state_gtid= >ids[i]; + + struct audit_elem *audit_elem= (struct audit_elem *) my_hash_search( + &m_audit_elem_domain_lookup, + (const uchar *) &(domain_state_gtid->domain_id), 0); + + if (!audit_elem) + { + Binlog_gtid_state_validator::error( + out, + "Starting GTID position list does not specify an initial value " + "for domain %u, whose events may be present in the requested binlog " + "file(s). The last known position for this domain was %u-%u-%llu.", + domain_state_gtid->domain_id, PARAM_GTID((*domain_state_gtid))); + err= TRUE; + continue; + } + + if (audit_elem->start_gtid.seq_no < domain_state_gtid->seq_no) + { + Binlog_gtid_state_validator::error( + out, + "Binary logs are missing data for domain %u. Expected data to " + "start from state %u-%u-%llu; however, the initial GTID state of " + "the logs was %u-%u-%llu.", + domain_state_gtid->domain_id, PARAM_GTID(audit_elem->start_gtid), + PARAM_GTID((*domain_state_gtid))); + err= TRUE; + continue; + } + + if (domain_state_gtid->seq_no > audit_elem->last_gtid.seq_no) + audit_elem->last_gtid= *domain_state_gtid; + } + return err; +} + +my_bool Binlog_gtid_state_validator::verify_stop_state(FILE *out, + rpl_gtid *stop_gtids, + size_t n_stop_gtids) +{ + size_t i; + for(i= 0; i < n_stop_gtids; i++) + { + rpl_gtid *stop_gtid= &stop_gtids[i]; + + struct audit_elem *audit_elem= (struct audit_elem *) my_hash_search( + &m_audit_elem_domain_lookup, + (const uchar *) &(stop_gtid->domain_id), 0); + + /* + It is okay if stop gtid doesn't exist in current state because it will be treated + as a new domain + */ + if (audit_elem && stop_gtid->seq_no <= audit_elem->start_gtid.seq_no) + { + Binlog_gtid_state_validator::error( + out, + "--stop-position GTID %u-%u-%llu does not exist in the " + "specified binlog files. The current GTID state of domain %u in the " + "specified binary logs is %u-%u-%llu", + PARAM_GTID((*stop_gtid)), stop_gtid->domain_id, + PARAM_GTID(audit_elem->start_gtid)); + return TRUE; + } + } + + /* No issues with any GTIDs */ + return FALSE; +} + +my_bool +Binlog_gtid_state_validator::verify_gtid_state(FILE *out, + rpl_gtid *domain_state_gtid) +{ + struct audit_elem *audit_elem= (struct audit_elem *) my_hash_search( + &m_audit_elem_domain_lookup, + (const uchar *) &(domain_state_gtid->domain_id), 0); + + if (!audit_elem) + { + Binlog_gtid_state_validator::warn( + out, + "Binary logs are missing data for domain %u. The current binary log " + "specified its " + "current state for this domain as %u-%u-%llu, but neither the " + "starting GTID position list nor any processed events have " + "mentioned " + "this domain.", + domain_state_gtid->domain_id, PARAM_GTID((*domain_state_gtid))); + return TRUE; + } + + if (audit_elem->last_gtid.seq_no < domain_state_gtid->seq_no) + { + Binlog_gtid_state_validator::warn( + out, + "Binary logs are missing data for domain %u. The current binary log " + "state is %u-%u-%llu, but the last seen event was %u-%u-%llu.", + domain_state_gtid->domain_id, PARAM_GTID((*domain_state_gtid)), + PARAM_GTID(audit_elem->last_gtid)); + return TRUE; + } + + return FALSE; +} + +my_bool Binlog_gtid_state_validator::record(rpl_gtid *gtid) +{ + struct audit_elem *audit_elem= (struct audit_elem *) my_hash_search( + &m_audit_elem_domain_lookup, (const uchar *) &(gtid->domain_id), 0); + + if (!audit_elem) + { + /* + We haven't seen any GTIDs in this domian yet. Perform initial set up for + this domain so we can monitor its events. + */ + audit_elem= (struct audit_elem *) my_malloc( + PSI_NOT_INSTRUMENTED, sizeof(struct audit_elem), MYF(MY_WME)); + if (!audit_elem) + { + my_error(ER_OUT_OF_RESOURCES, MYF(0)); + return TRUE; + } + + audit_elem->domain_id= gtid->domain_id; + audit_elem->last_gtid= *gtid; + audit_elem->start_gtid= {gtid->domain_id, 0, 0}; + + my_init_dynamic_array(PSI_INSTRUMENT_ME, &audit_elem->late_gtids_real, + sizeof(rpl_gtid), 8, 8, MYF(0)); + my_init_dynamic_array(PSI_INSTRUMENT_ME, &audit_elem->late_gtids_previous, + sizeof(rpl_gtid), 8, 8, MYF(0)); + + if (my_hash_insert(&m_audit_elem_domain_lookup, (uchar *) audit_elem)) + { + my_free(audit_elem); + my_error(ER_OUT_OF_RESOURCES, MYF(0)); + return TRUE; + } + } + else + { + /* Out of order check */ + if (gtid->seq_no <= audit_elem->last_gtid.seq_no && + gtid->seq_no >= audit_elem->start_gtid.seq_no) + { + /* GTID is out of order */ + insert_dynamic(&audit_elem->late_gtids_real, (const void *) gtid); + insert_dynamic(&audit_elem->late_gtids_previous, + (const void *) &(audit_elem->last_gtid)); + + return TRUE; + } + else + { + /* GTID is valid */ + audit_elem->last_gtid= *gtid; + } + } + + return FALSE; +} + +/* + Data structure used to help pass data into report_audit_findings because + my_hash_iterate only passes one parameter +*/ +struct gtid_report_ctx +{ + FILE *out_file; + my_bool is_strict_mode; + my_bool contains_err; +}; + +static my_bool report_audit_findings(void *entry, void *report_ctx_arg) +{ + struct Binlog_gtid_state_validator::audit_elem *audit_el= + (struct Binlog_gtid_state_validator::audit_elem *) entry; + + struct gtid_report_ctx *report_ctx= + (struct gtid_report_ctx *) report_ctx_arg; + FILE *out= report_ctx->out_file; + my_bool is_strict_mode= report_ctx->is_strict_mode; + size_t i; + void (*report_f)(FILE*, const char*, ...); + + if (is_strict_mode) + report_f= Binlog_gtid_state_validator::error; + else + report_f= Binlog_gtid_state_validator::warn; + + if (audit_el) + { + if (audit_el->last_gtid.seq_no < audit_el->start_gtid.seq_no) + { + report_f(out, + "Binary logs never reached expected GTID state of %u-%u-%llu", + PARAM_GTID(audit_el->start_gtid)); + report_ctx->contains_err= TRUE; + } + + /* Report any out of order GTIDs */ + for(i= 0; i < audit_el->late_gtids_real.elements; i++) + { + rpl_gtid *real_gtid= + (rpl_gtid *) dynamic_array_ptr(&(audit_el->late_gtids_real), i); + rpl_gtid *last_gtid= (rpl_gtid *) dynamic_array_ptr( + &(audit_el->late_gtids_previous), i); + DBUG_ASSERT(real_gtid && last_gtid); + + report_f(out, + "Found out of order GTID. Got %u-%u-%llu after %u-%u-%llu", + PARAM_GTID((*real_gtid)), PARAM_GTID((*last_gtid))); + report_ctx->contains_err= TRUE; + } + } + + return FALSE; +} + +my_bool Binlog_gtid_state_validator::report(FILE *out, my_bool is_strict_mode) +{ + struct gtid_report_ctx report_ctx; + report_ctx.out_file= out; + report_ctx.is_strict_mode= is_strict_mode; + report_ctx.contains_err= FALSE; + my_hash_iterate(&m_audit_elem_domain_lookup, report_audit_findings, &report_ctx); + fflush(out); + return is_strict_mode ? report_ctx.contains_err : FALSE; +} + +Window_gtid_event_filter::Window_gtid_event_filter() + : m_has_start(FALSE), m_has_stop(FALSE), m_is_active(FALSE), + m_has_passed(FALSE) +{ + // m_start and m_stop do not need initial values if unused +} + +int Window_gtid_event_filter::set_start_gtid(rpl_gtid *start) +{ + if (m_has_start) + { + sql_print_error( + "Start position cannot have repeated domain " + "ids (found %u-%u-%llu when %u-%u-%llu was previously specified)", + PARAM_GTID((*start)), PARAM_GTID(m_start)); + return 1; + } + + m_has_start= TRUE; + m_start= *start; + return 0; +} + +int Window_gtid_event_filter::set_stop_gtid(rpl_gtid *stop) +{ + if (m_has_stop) + { + sql_print_error( + "Stop position cannot have repeated domain " + "ids (found %u-%u-%llu when %u-%u-%llu was previously specified)", + PARAM_GTID((*stop)), PARAM_GTID(m_stop)); + return 1; + } + + m_has_stop= TRUE; + m_stop= *stop; + return 0; +} + +my_bool Window_gtid_event_filter::is_range_invalid() +{ + if (m_has_start && m_has_stop && m_start.seq_no > m_stop.seq_no) + { + sql_print_error( + "Queried GTID range is invalid in strict mode. Stop position " + "%u-%u-%llu is not greater than or equal to start %u-%u-%llu.", + PARAM_GTID(m_stop), PARAM_GTID(m_start)); + return TRUE; + } + return FALSE; +} + +static inline my_bool is_gtid_at_or_after(rpl_gtid *boundary, + rpl_gtid *test_gtid) +{ + return test_gtid->domain_id == boundary->domain_id && + test_gtid->seq_no >= boundary->seq_no; +} + +static inline my_bool is_gtid_at_or_before(rpl_gtid *boundary, + rpl_gtid *test_gtid) +{ + return test_gtid->domain_id == boundary->domain_id && + test_gtid->seq_no <= boundary->seq_no; +} + +my_bool Window_gtid_event_filter::exclude(rpl_gtid *gtid) +{ + /* Assume result should be excluded to start */ + my_bool should_exclude= TRUE; + + DBUG_ASSERT((m_has_start && gtid->domain_id == m_start.domain_id) || + (m_has_stop && gtid->domain_id == m_stop.domain_id)); + + if (!m_is_active && !m_has_passed) + { + /* + This filter has not yet been activated. Check if the gtid is within the + bounds of this window. + */ + + if (!m_has_start && is_gtid_at_or_before(&m_stop, gtid)) + { + /* + Start GTID was not provided, so we want to include everything from here + up to m_stop + */ + m_is_active= TRUE; + should_exclude= FALSE; + } + else if ((m_has_start && is_gtid_at_or_after(&m_start, gtid)) && + (!m_has_stop || is_gtid_at_or_before(&m_stop, gtid))) + { + m_is_active= TRUE; + + DBUG_PRINT("gtid-event-filter", + ("Window: Begin (%d-%d-%llu, %d-%d-%llu]", + PARAM_GTID(m_start), PARAM_GTID(m_stop))); + + /* + As the start of the range is exclusive, if this gtid is the start of + the range, exclude it + */ + if (gtid->seq_no == m_start.seq_no) + should_exclude= TRUE; + else + should_exclude= FALSE; + + if (m_has_stop && gtid->seq_no == m_stop.seq_no) + { + m_has_passed= TRUE; + DBUG_PRINT("gtid-event-filter", + ("Window: End (%d-%d-%llu, %d-%d-%llu]", + PARAM_GTID(m_start), PARAM_GTID(m_stop))); + } + } + } /* if (!m_is_active && !m_has_passed) */ + else if (m_is_active && !m_has_passed) + { + /* + This window is currently active so we want the event group to be included + in the results. Additionally check if we are at the end of the window. + If no end of the window is provided, go indefinitely + */ + should_exclude= FALSE; + + if (m_has_stop && is_gtid_at_or_after(&m_stop, gtid)) + { + DBUG_PRINT("gtid-event-filter", + ("Window: End (%d-%d-%llu, %d-%d-%llu]", + PARAM_GTID(m_start), PARAM_GTID(m_stop))); + m_is_active= FALSE; + m_has_passed= TRUE; + + if (!is_gtid_at_or_before(&m_stop, gtid)) + { + /* + The GTID is after the finite stop of the window, don't let it pass + through + */ + should_exclude= TRUE; + } + } + } + + return should_exclude; +} + +my_bool Window_gtid_event_filter::has_finished() +{ + return m_has_stop ? m_has_passed : FALSE; +} + +void free_gtid_filter_element(void *p) +{ + gtid_filter_element *gfe = (gtid_filter_element *) p; + if (gfe->filter) + delete gfe->filter; + my_free(gfe); +} + +Id_delegating_gtid_event_filter::Id_delegating_gtid_event_filter() + : m_num_stateful_filters(0), m_num_completed_filters(0) +{ + my_hash_init(PSI_INSTRUMENT_ME, &m_filters_by_id_hash, &my_charset_bin, 32, + offsetof(gtid_filter_element, identifier), + sizeof(gtid_filter_identifier), NULL, free_gtid_filter_element, + HASH_UNIQUE); + + m_default_filter= new Accept_all_gtid_filter(); +} + +Id_delegating_gtid_event_filter::~Id_delegating_gtid_event_filter() +{ + my_hash_free(&m_filters_by_id_hash); + delete m_default_filter; +} + +void Id_delegating_gtid_event_filter::set_default_filter( + Gtid_event_filter *filter) +{ + if (m_default_filter) + delete m_default_filter; + + m_default_filter= filter; +} + +gtid_filter_element * +Id_delegating_gtid_event_filter::find_or_create_filter_element_for_id( + gtid_filter_identifier filter_id) +{ + gtid_filter_element *fe= (gtid_filter_element *) my_hash_search( + &m_filters_by_id_hash, (const uchar *) &filter_id, 0); + + if (!fe) + { + gtid_filter_element *new_fe= (gtid_filter_element *) my_malloc( + PSI_NOT_INSTRUMENTED, sizeof(gtid_filter_element), MYF(MY_WME)); + new_fe->filter= NULL; + new_fe->identifier= filter_id; + if (my_hash_insert(&m_filters_by_id_hash, (uchar*) new_fe)) + { + my_free(new_fe); + my_error(ER_OUT_OF_RESOURCES, MYF(0)); + return NULL; + } + fe= new_fe; + } + + return fe; +} + +my_bool Id_delegating_gtid_event_filter::has_finished() +{ + /* + If all user-defined filters have deactivated, we are effectively + deactivated + */ + return m_num_stateful_filters && + m_num_completed_filters == m_num_stateful_filters; +} + +my_bool Id_delegating_gtid_event_filter::exclude(rpl_gtid *gtid) +{ + gtid_filter_identifier filter_id= get_id_from_gtid(gtid); + gtid_filter_element *filter_element= (gtid_filter_element *) my_hash_search( + &m_filters_by_id_hash, (const uchar *) &filter_id, 0); + Gtid_event_filter *filter= + (filter_element ? filter_element->filter : m_default_filter); + my_bool ret= TRUE; + + if(!filter_element || !filter->has_finished()) + { + ret= filter->exclude(gtid); + + /* + If this is an explicitly defined filter, e.g. Window-based filter, check + if it has completed, and update the counter accordingly if so. + */ + if (filter_element && filter->has_finished()) + m_num_completed_filters++; + } + + return ret; +} + +Window_gtid_event_filter * +Domain_gtid_event_filter::find_or_create_window_filter_for_id( + uint32 domain_id) +{ + gtid_filter_element *filter_element= + find_or_create_filter_element_for_id(domain_id); + Window_gtid_event_filter *wgef= NULL; + + if (filter_element->filter == NULL) + { + /* New filter */ + wgef= new Window_gtid_event_filter(); + filter_element->filter= wgef; + } + else if (filter_element->filter->get_filter_type() == WINDOW_GTID_FILTER_TYPE) + { + /* We have an existing window filter here */ + wgef= (Window_gtid_event_filter *) filter_element->filter; + } + else + { + /* + We have an existing filter but it is not of window type so propogate NULL + filter + */ + sql_print_error("cannot subset domain id %d by position, another rule " + "exists on that domain", + domain_id); + } + + return wgef; +} + +static my_bool check_filter_entry_validity(void *entry, void *are_filters_invalid_arg) +{ + gtid_filter_element *fe= (gtid_filter_element*) entry; + + if (fe) + { + Gtid_event_filter *gef= fe->filter; + if (gef->get_filter_type() == Gtid_event_filter::WINDOW_GTID_FILTER_TYPE) + { + Window_gtid_event_filter *wgef= (Window_gtid_event_filter *) gef; + if (wgef->is_range_invalid()) + { + *((int *) are_filters_invalid_arg)= 1; + return TRUE; + } + } + } + return FALSE; +} + +int Domain_gtid_event_filter::validate_window_filters() +{ + int are_filters_invalid= 0; + my_hash_iterate(&m_filters_by_id_hash, check_filter_entry_validity, &are_filters_invalid); + return are_filters_invalid; +} + +int Domain_gtid_event_filter::add_start_gtid(rpl_gtid *gtid) +{ + int err= 0; + Window_gtid_event_filter *filter_to_update= + find_or_create_window_filter_for_id(gtid->domain_id); + + if (filter_to_update == NULL) + { + err= 1; + } + else if (!(err= filter_to_update->set_start_gtid(gtid))) + { + gtid_filter_element *fe= (gtid_filter_element *) my_hash_search( + &m_filters_by_id_hash, (const uchar *) &(gtid->domain_id), 0); + insert_dynamic(&m_start_filters, (const void *) &fe); + } + + return err; +} + +int Domain_gtid_event_filter::add_stop_gtid(rpl_gtid *gtid) +{ + int err= 0; + Window_gtid_event_filter *filter_to_update= + find_or_create_window_filter_for_id(gtid->domain_id); + + if (filter_to_update == NULL) + { + err= 1; + } + else if (!(err= filter_to_update->set_stop_gtid(gtid))) + { + gtid_filter_element *fe= (gtid_filter_element *) my_hash_search( + &m_filters_by_id_hash, (const uchar *) &(gtid->domain_id), 0); + insert_dynamic(&m_stop_filters, (const void *) &fe); + + /* + A window with a stop position can be disabled, and is therefore stateful. + */ + m_num_stateful_filters++; + + /* + Default filtering behavior changes with GTID stop positions, where we + exclude all domains not present in the stop list + */ + if (m_default_filter->get_filter_type() == ACCEPT_ALL_GTID_FILTER_TYPE) + { + delete m_default_filter; + m_default_filter= new Reject_all_gtid_filter(); + } + } + + return err; +} + +rpl_gtid *Domain_gtid_event_filter::get_start_gtids() +{ + rpl_gtid *gtid_list; + uint32 i; + size_t n_start_gtids= get_num_start_gtids(); + + gtid_list= (rpl_gtid *) my_malloc( + PSI_INSTRUMENT_ME, n_start_gtids * sizeof(rpl_gtid), MYF(MY_WME)); + + for (i = 0; i < n_start_gtids; i++) + { + gtid_filter_element *fe= + *(gtid_filter_element **) dynamic_array_ptr(&m_start_filters, i); + DBUG_ASSERT(fe->filter && + fe->filter->get_filter_type() == WINDOW_GTID_FILTER_TYPE); + Window_gtid_event_filter *wgef= + (Window_gtid_event_filter *) fe->filter; + + rpl_gtid win_start_gtid= wgef->get_start_gtid(); + gtid_list[i]= win_start_gtid; + } + + return gtid_list; +} + +rpl_gtid *Domain_gtid_event_filter::get_stop_gtids() +{ + rpl_gtid *gtid_list; + uint32 i; + size_t n_stop_gtids= get_num_stop_gtids(); + + gtid_list= (rpl_gtid *) my_malloc( + PSI_INSTRUMENT_ME, n_stop_gtids * sizeof(rpl_gtid), MYF(MY_WME)); + + for (i = 0; i < n_stop_gtids; i++) + { + gtid_filter_element *fe= + *(gtid_filter_element **) dynamic_array_ptr(&m_stop_filters, i); + DBUG_ASSERT(fe->filter && + fe->filter->get_filter_type() == WINDOW_GTID_FILTER_TYPE); + Window_gtid_event_filter *wgef= + (Window_gtid_event_filter *) fe->filter; + + rpl_gtid win_stop_gtid= wgef->get_stop_gtid(); + gtid_list[i]= win_stop_gtid; + } + + return gtid_list; +} + +void Domain_gtid_event_filter::clear_start_gtids() +{ + uint32 i; + for (i = 0; i < get_num_start_gtids(); i++) + { + gtid_filter_element *fe= + *(gtid_filter_element **) dynamic_array_ptr(&m_start_filters, i); + DBUG_ASSERT(fe->filter && + fe->filter->get_filter_type() == WINDOW_GTID_FILTER_TYPE); + Window_gtid_event_filter *wgef= + (Window_gtid_event_filter *) fe->filter; + + if (wgef->has_stop()) + { + /* + Don't delete the whole filter if it already has a stop position attached + */ + wgef->clear_start_pos(); + } + else + { + /* + This domain only has a stop, so delete the whole filter + */ + my_hash_delete(&m_filters_by_id_hash, (uchar *) fe); + } + } + + reset_dynamic(&m_start_filters); +} + +void Domain_gtid_event_filter::clear_stop_gtids() +{ + uint32 i; + + for (i = 0; i < get_num_stop_gtids(); i++) + { + gtid_filter_element *fe= + *(gtid_filter_element **) dynamic_array_ptr(&m_stop_filters, i); + DBUG_ASSERT(fe->filter && + fe->filter->get_filter_type() == WINDOW_GTID_FILTER_TYPE); + Window_gtid_event_filter *wgef= + (Window_gtid_event_filter *) fe->filter; + + if (wgef->has_start()) + { + /* + Don't delete the whole filter if it already has a start position + attached + */ + wgef->clear_stop_pos(); + } + else + { + /* + This domain only has a start, so delete the whole filter + */ + my_hash_delete(&m_filters_by_id_hash, (uchar *) fe); + } + m_num_stateful_filters--; + } + + /* + Stop positions were cleared and we want to be inclusive again of other + domains again + */ + if (m_default_filter->get_filter_type() == REJECT_ALL_GTID_FILTER_TYPE) + { + delete m_default_filter; + m_default_filter= new Accept_all_gtid_filter(); + } + + reset_dynamic(&m_stop_filters); +} + +my_bool Domain_gtid_event_filter::exclude(rpl_gtid *gtid) +{ + my_bool include_domain= TRUE; + /* + If GTID stop positions are provided, we limit the domains which are output + to only be those specified with stop positions + */ + if (get_num_stop_gtids()) + { + gtid_filter_identifier filter_id= get_id_from_gtid(gtid); + gtid_filter_element *filter_element= + (gtid_filter_element *) my_hash_search(&m_filters_by_id_hash, + (const uchar *) &filter_id, 0); + if (filter_element) + { + Gtid_event_filter *filter= filter_element->filter; + if (filter->get_filter_type() == WINDOW_GTID_FILTER_TYPE) + { + Window_gtid_event_filter *wgef= (Window_gtid_event_filter *) filter; + include_domain= wgef->has_stop(); + } + } + } + + return include_domain ? Id_delegating_gtid_event_filter::exclude(gtid) + : TRUE; +} diff --git a/sql/rpl_gtid.h b/sql/rpl_gtid.h index 11541c8000cde..ffe804a8f01c6 100644 --- a/sql/rpl_gtid.h +++ b/sql/rpl_gtid.h @@ -26,8 +26,10 @@ extern const LEX_CSTRING rpl_gtid_slave_state_table_name; class String; +#define PARAM_GTID(G) G.domain_id, G.server_id, G.seq_no #define GTID_MAX_STR_LENGTH (10+1+10+1+20) +#define PARAM_GTID(G) G.domain_id, G.server_id, G.seq_no struct rpl_gtid { @@ -36,6 +38,9 @@ struct rpl_gtid uint64 seq_no; }; +/* Data structure to help with quick lookup for filters. */ +typedef decltype(rpl_gtid::domain_id) gtid_filter_identifier; + inline bool operator==(const rpl_gtid& lhs, const rpl_gtid& rhs) { return @@ -44,6 +49,18 @@ inline bool operator==(const rpl_gtid& lhs, const rpl_gtid& rhs) lhs.seq_no == rhs.seq_no; }; +inline bool operator<(const rpl_gtid& lhs, const rpl_gtid& rhs) +{ + return (lhs.domain_id == rhs.domain_id) ? lhs.seq_no < rhs.seq_no + : lhs.domain_id < rhs.domain_id; +}; + +inline bool operator>(const rpl_gtid& lhs, const rpl_gtid& rhs) +{ + return (lhs.domain_id == rhs.domain_id) ? lhs.seq_no > rhs.seq_no + : lhs.domain_id > rhs.domain_id; +}; + enum enum_gtid_skip_type { GTID_SKIP_NOT, GTID_SKIP_STANDALONE, GTID_SKIP_TRANSACTION }; @@ -316,7 +333,8 @@ struct rpl_binlog_state int update_with_next_gtid(uint32 domain_id, uint32 server_id, rpl_gtid *gtid); int alloc_element_nolock(const rpl_gtid *gtid); - bool check_strict_sequence(uint32 domain_id, uint32 server_id, uint64 seq_no); + bool check_strict_sequence(uint32 domain_id, uint32 server_id, uint64 seq_no, + bool no_error= false); int bump_seq_no_if_needed(uint32 domain_id, uint64 seq_no); int write_to_iocache(IO_CACHE *dest); int read_from_iocache(IO_CACHE *src); @@ -380,5 +398,449 @@ extern bool rpl_slave_state_tostring_helper(String *dest, const rpl_gtid *gtid, extern int gtid_check_rpl_slave_state_table(TABLE *table); extern rpl_gtid *gtid_parse_string_to_list(const char *p, size_t len, uint32 *out_len); +extern rpl_gtid *gtid_unpack_string_to_list(const char *p, size_t len, + uint32 *out_len); + + + +/* + This class ensures that the GTID state of an event stream is consistent with + the set of provided binary log files. In particular, it has two concerns: + + 1) Ensuring that GTID events are monotonically increasing within each + domain + 2) Ensuring that the GTID state of the specified binary logs is consistent + both with the initial state that a user provides, and between + binary logs (if multiple are specified) +*/ +class Binlog_gtid_state_validator +{ +public: + + struct audit_elem + { + uint32 domain_id; + + + /* + Holds the largest GTID received, and is indexed by domain_id + */ + rpl_gtid last_gtid; + + /* + Holds the largest GTID received, and is indexed by domain_id + */ + rpl_gtid start_gtid; + + /* + List of the problematic GTIDs received which were out of order + */ + DYNAMIC_ARRAY late_gtids_real; + + /* + For each problematic GTID in late_gtids_real, this list contains the last + GTID of the domain at the time of receiving the out of order GTID. + */ + DYNAMIC_ARRAY late_gtids_previous; + }; + + Binlog_gtid_state_validator(); + ~Binlog_gtid_state_validator(); + + /* + Initialize where we should start monitoring for invalid GTID entries + in the event stream. Note that these start positions must occur at or after + a given binary logs GTID state (from Gtid_list_log_event) + */ + void initialize_start_gtids(rpl_gtid *start_gtids, size_t n_gtids); + + /* + Initialize our current state so we know where to expect GTIDs to start + increasing from. Error if the state exists after our expected start_gtid + positions, because we know we will be missing event data (possibly from + a purged log). + */ + my_bool initialize_gtid_state(FILE *out, rpl_gtid *gtids, size_t n_gtids); + + /* + Ensures that the expected stop GTID positions exist within the specified + binary logs. + */ + my_bool verify_stop_state(FILE *out, rpl_gtid *stop_gtids, size_t n_stop_gtids); + + /* + Ensure a GTID state (e.g., from a Gtid_list_log_event) is consistent with + the current state of our auditing. For example, if we see a GTID from a + Gtid_list_log_event that is ahead of our current state for that domain, we + have missed events (perhaps from a missing log). + */ + my_bool verify_gtid_state(FILE *out, rpl_gtid *gtid_state_cur); + + /* + Take note of a new GTID being processed. + + returns TRUE if the GTID is invalid, FALSE on success + */ + my_bool record(rpl_gtid *gtid); + + /* + Writes warnings/errors (if any) during GTID processing + + Returns TRUE if any findings were reported, FALSE otherwise + */ + my_bool report(FILE *out, my_bool is_strict_mode); + + static void report_details(FILE *out, const char *format, va_list args) + { + vfprintf(out, format, args); + fprintf(out, "\n"); + } + + static void warn(FILE *out, const char *format,...) + { + va_list args; + va_start(args, format); + fprintf(out, "WARNING: "); + report_details(out, format, args); + } + + static void error(FILE *out, const char *format,...) + { + va_list args; + va_start(args, format); + fprintf(out, "ERROR: "); + report_details(out, format, args); + } + +private: + + /* + Holds the records for each domain id we are monitoring. Elements are of type + `struct audit_elem` and indexed by domian_id. + */ + HASH m_audit_elem_domain_lookup; +}; + +/* + Interface to support different methods of filtering log events by GTID +*/ +class Gtid_event_filter +{ +public: + Gtid_event_filter() {}; + virtual ~Gtid_event_filter() {}; + + enum gtid_event_filter_type + { + DELEGATING_GTID_FILTER_TYPE = 1, + WINDOW_GTID_FILTER_TYPE = 2, + ACCEPT_ALL_GTID_FILTER_TYPE = 3, + REJECT_ALL_GTID_FILTER_TYPE = 4 + }; + + /* + Run the filter on an input gtid to test if the corresponding log events + should be excluded from a result + + Returns TRUE when the event group corresponding to the input GTID should be + excluded. + Returns FALSE when the event group should be included. + */ + virtual my_bool exclude(rpl_gtid *) = 0; + + /* + The gtid_event_filter_type that corresponds to the underlying filter + implementation + */ + virtual uint32 get_filter_type() = 0; + + /* + For filters that can maintain their own state, this tests if the filter + implementation has completed. + + Returns TRUE when completed, and FALSE when the filter has not finished. + */ + virtual my_bool has_finished() = 0; +}; + +/* + Filter implementation which will include any and all input GTIDs. This is + used to set default behavior for GTIDs that do not have explicit filters + set on their domain_id, e.g. when a Window_gtid_event_filter is used for + a specific domain, then all other domain_ids will be accepted using this + filter implementation. +*/ +class Accept_all_gtid_filter : public Gtid_event_filter +{ +public: + Accept_all_gtid_filter() {} + ~Accept_all_gtid_filter() {} + my_bool exclude(rpl_gtid *gtid) { return FALSE; } + uint32 get_filter_type() { return ACCEPT_ALL_GTID_FILTER_TYPE; } + my_bool has_finished() { return FALSE; } +}; + +/* + Filter implementation to exclude all tested GTIDs. +*/ +class Reject_all_gtid_filter : public Gtid_event_filter +{ +public: + Reject_all_gtid_filter() {} + ~Reject_all_gtid_filter() {} + my_bool exclude(rpl_gtid *gtid) { return TRUE; } + uint32 get_filter_type() { return REJECT_ALL_GTID_FILTER_TYPE; } + my_bool has_finished() { return FALSE; } +}; + +/* + A filter implementation that includes events that exist between two GTID + positions, m_start (exclusive) and m_stop (inclusive), within a domain. + + This filter is stateful, such that it expects GTIDs to be an increasing + stream, and internally, the window will activate and deactivate when the start + and stop positions of the event stream have passed through, respectively. +*/ +class Window_gtid_event_filter : public Gtid_event_filter +{ +public: + Window_gtid_event_filter(); + ~Window_gtid_event_filter() {} + + my_bool exclude(rpl_gtid*); + my_bool has_finished(); + + /* + Set the GTID that begins this window (exclusive) + + Returns 0 on ok, non-zero on error + */ + int set_start_gtid(rpl_gtid *start); + + /* + Set the GTID that ends this window (inclusive) + + Returns 0 on ok, non-zero on error + */ + int set_stop_gtid(rpl_gtid *stop); + + uint32 get_filter_type() { return WINDOW_GTID_FILTER_TYPE; } + + /* + Validates the underlying range is correct, and writes an error if not, i.e. + m_start >= m_stop. + + Returns FALSE on ok, TRUE if range is invalid + */ + my_bool is_range_invalid(); + + /* + Getter/setter methods + */ + my_bool has_start() { return m_has_start; } + my_bool has_stop() { return m_has_stop; } + rpl_gtid get_start_gtid() { return m_start; } + rpl_gtid get_stop_gtid() { return m_stop; } + + void clear_start_pos() + { + m_has_start= FALSE; + m_start= {0, 0, 0}; + } + + void clear_stop_pos() + { + m_has_stop= FALSE; + m_stop= {0, 0, 0}; + } + +protected: + + /* + When processing GTID streams, the order in which they are processed should + be sequential with no gaps between events. If a gap is found within a + window, warn the user. + */ + void verify_gtid_is_expected(rpl_gtid *gtid); + +private: + + enum warning_flags + { + WARN_GTID_SEQUENCE_NUMBER_OUT_OF_ORDER= 0x1 + }; + + /* + m_has_start : Indicates if a start to this window has been explicitly + provided. A window starts immediately if not provided. + */ + my_bool m_has_start; + + /* + m_has_stop : Indicates if a stop to this window has been explicitly + provided. A window continues indefinitely if not provided. + */ + my_bool m_has_stop; + + /* + m_is_active : Indicates whether or not the program is currently reading + events from within this window. When TRUE, events with + different server ids than those specified by m_start or + m_stop will be passed through. + */ + my_bool m_is_active; + + /* + m_has_passed : Indicates whether or not the program is currently reading + events from within this window. + */ + my_bool m_has_passed; + + /* m_start : marks the GTID that begins the window (exclusive). */ + rpl_gtid m_start; + + /* m_stop : marks the GTID that ends the range (inclusive). */ + rpl_gtid m_stop; +}; + +typedef struct _gtid_filter_element +{ + Gtid_event_filter *filter; + gtid_filter_identifier identifier; /* Used for HASH lookup */ +} gtid_filter_element; + +/* + Gtid_event_filter subclass which has no specific implementation, but rather + delegates the filtering to specific identifiable/mapped implementations. + + A default filter is used for GTIDs that are passed through which no explicit + filter can be identified. + + This class should be subclassed, where the get_id_from_gtid function + specifies how to extract the filter identifier from a GTID. +*/ +class Id_delegating_gtid_event_filter : public Gtid_event_filter +{ +public: + Id_delegating_gtid_event_filter(); + ~Id_delegating_gtid_event_filter(); + + my_bool exclude(rpl_gtid *gtid); + my_bool has_finished(); + void set_default_filter(Gtid_event_filter *default_filter); + + uint32 get_filter_type() { return DELEGATING_GTID_FILTER_TYPE; } + + virtual gtid_filter_identifier get_id_from_gtid(rpl_gtid *) = 0; + +protected: + + uint32 m_num_stateful_filters; + uint32 m_num_completed_filters; + Gtid_event_filter *m_default_filter; + + HASH m_filters_by_id_hash; + + gtid_filter_element *find_or_create_filter_element_for_id(gtid_filter_identifier); +}; + +/* + A subclass of Id_delegating_gtid_event_filter which identifies filters using the + domain id of a GTID. + + Additional helper functions include: + add_start_gtid(GTID) : adds a start GTID position to this filter, to be + identified by its domain id + add_stop_gtid(GTID) : adds a stop GTID position to this filter, to be + identified by its domain id + clear_start_gtids() : removes existing GTID start positions + clear_stop_gtids() : removes existing GTID stop positions + get_start_gtids() : gets all added GTID start positions + get_stop_gtids() : gets all added GTID stop positions + get_num_start_gtids() : gets the count of added GTID start positions + get_num_stop_gtids() : gets the count of added GTID stop positions +*/ +class Domain_gtid_event_filter : public Id_delegating_gtid_event_filter +{ +public: + Domain_gtid_event_filter() + { + my_init_dynamic_array(PSI_INSTRUMENT_ME, &m_start_filters, + sizeof(gtid_filter_element*), 8, 8, MYF(0)); + my_init_dynamic_array(PSI_INSTRUMENT_ME, &m_stop_filters, + sizeof(gtid_filter_element*), 8, 8, MYF(0)); + } + ~Domain_gtid_event_filter() + { + delete_dynamic(&m_start_filters); + delete_dynamic(&m_stop_filters); + } + + /* + Returns the domain id of from the input GTID + */ + gtid_filter_identifier get_id_from_gtid(rpl_gtid *gtid) + { + return gtid->domain_id; + } + + /* + Override Id_delegating_gtid_event_filter to extend with domain specific + filtering logic + */ + my_bool exclude(rpl_gtid*); + + /* + Validates that window filters with both a start and stop GTID satisfy + stop_gtid > start_gtid + + Returns 0 on ok, non-zero if any windows are invalid. + */ + int validate_window_filters(); + + /* + Helper function to start a GTID window filter at the given GTID + + Returns 0 on ok, non-zero on error + */ + int add_start_gtid(rpl_gtid *gtid); + + /* + Helper function to end a GTID window filter at the given GTID + + Returns 0 on ok, non-zero on error + */ + int add_stop_gtid(rpl_gtid *gtid); + + /* + If start or stop position is respecified, we remove all existing values + and start over with the new specification. + */ + void clear_start_gtids(); + void clear_stop_gtids(); + + /* + Return list of all GTIDs used as start position. + + Note that this list is allocated and it is up to the user to free it + */ + rpl_gtid *get_start_gtids(); + + /* + Return list of all GTIDs used as stop position. + + Note that this list is allocated and it is up to the user to free it + */ + rpl_gtid *get_stop_gtids(); + + size_t get_num_start_gtids() { return m_start_filters.elements; } + size_t get_num_stop_gtids() { return m_stop_filters.elements; } + +private: + DYNAMIC_ARRAY m_start_filters; + DYNAMIC_ARRAY m_stop_filters; + + Window_gtid_event_filter *find_or_create_window_filter_for_id(gtid_filter_identifier); +}; #endif /* RPL_GTID_H */ diff --git a/sql/rpl_injector.cc b/sql/rpl_injector.cc index 2319f69d67cdf..3080d92bf6339 100644 --- a/sql/rpl_injector.cc +++ b/sql/rpl_injector.cc @@ -131,9 +131,7 @@ injector::transaction::binlog_pos injector::transaction::start_pos() const */ /* This constructor is called below */ -inline injector::injector() -{ -} +inline injector::injector() = default; static injector *s_injector= 0; injector *injector::instance() diff --git a/sql/rpl_injector.h b/sql/rpl_injector.h index 669a8e2954393..6a1c724809ae4 100644 --- a/sql/rpl_injector.h +++ b/sql/rpl_injector.h @@ -264,14 +264,14 @@ class injector */ int check_state(enum_state const target_state) { -#ifndef DBUG_OFF +#ifdef DBUG_TRACE static char const *state_name[] = { "START_STATE", "TABLE_STATE", "ROW_STATE", "STATE_COUNT" }; - DBUG_ASSERT(target_state <= STATE_COUNT); DBUG_PRINT("info", ("In state %s", state_name[m_state])); #endif + DBUG_ASSERT(target_state <= STATE_COUNT); if (m_state <= target_state && target_state <= m_state + 1 && m_state < STATE_COUNT) @@ -307,7 +307,7 @@ class injector private: explicit injector(); - ~injector() { } /* Nothing needs to be done */ + ~injector() = default; /* Nothing needs to be done */ injector(injector const&); /* You're not allowed to copy injector instances. */ diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 4fd36891a4b67..b9aea39e5474a 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2006, 2017, Oracle and/or its affiliates. - Copyright (c) 2010, 2017, MariaDB Corporation + Copyright (c) 2010, 2022, 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 @@ -85,6 +85,14 @@ Master_info::Master_info(LEX_CSTRING *connection_name_arg, mysql_mutex_init(key_master_info_data_lock, &data_lock, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_master_info_start_stop_lock, &start_stop_lock, MY_MUTEX_INIT_SLOW); + /* + start_alter_lock will protect individual start_alter_info while + start_alter_list_lock is for list insertion and deletion operations + */ + mysql_mutex_init(key_master_info_start_alter_lock, &start_alter_lock, + MY_MUTEX_INIT_FAST); + mysql_mutex_init(key_master_info_start_alter_list_lock, &start_alter_list_lock, + MY_MUTEX_INIT_FAST); mysql_mutex_setflags(&run_lock, MYF_NO_DEADLOCK_DETECTION); mysql_mutex_setflags(&data_lock, MYF_NO_DEADLOCK_DETECTION); mysql_mutex_init(key_master_info_sleep_lock, &sleep_lock, MY_MUTEX_INIT_FAST); @@ -92,6 +100,7 @@ Master_info::Master_info(LEX_CSTRING *connection_name_arg, mysql_cond_init(key_master_info_start_cond, &start_cond, NULL); mysql_cond_init(key_master_info_stop_cond, &stop_cond, NULL); mysql_cond_init(key_master_info_sleep_cond, &sleep_cond, NULL); + init_sql_alloc(PSI_INSTRUMENT_ME, &mem_root, MEM_ROOT_BLOCK_SIZE, 0, MYF(0)); } @@ -121,10 +130,13 @@ Master_info::~Master_info() mysql_mutex_destroy(&data_lock); mysql_mutex_destroy(&sleep_lock); mysql_mutex_destroy(&start_stop_lock); + mysql_mutex_destroy(&start_alter_lock); + mysql_mutex_destroy(&start_alter_list_lock); mysql_cond_destroy(&data_cond); mysql_cond_destroy(&start_cond); mysql_cond_destroy(&stop_cond); mysql_cond_destroy(&sleep_cond); + free_root(&mem_root, MYF(0)); } /** diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h index a4a06d42a5c1f..ecfecabd6c95d 100644 --- a/sql/rpl_mi.h +++ b/sql/rpl_mi.h @@ -227,7 +227,7 @@ class Master_info : public Slave_reporting_capability File fd; // we keep the file open, so we need to remember the file pointer IO_CACHE file; - mysql_mutex_t data_lock, run_lock, sleep_lock, start_stop_lock; + mysql_mutex_t data_lock, run_lock, sleep_lock, start_stop_lock, start_alter_lock, start_alter_list_lock; mysql_cond_t data_cond, start_cond, stop_cond, sleep_cond; THD *io_thd; MYSQL* mysql; @@ -352,6 +352,39 @@ class Master_info : public Slave_reporting_capability ACK from slave, or if delay_master is enabled. */ int semi_ack; + /* + The flag has replicate_same_server_id semantics and is raised to accept + a same-server-id event group by the gtid strict mode semisync slave. + Own server-id events can normally appear as result of EITHER + A. this server semisync (failover to) slave crash-recovery: + the transaction was created on this server then being master, + got replicated elsewhere right before the crash before commit, + and finally at recovery the transaction gets evicted from the + server's binlog and its gtid (slave) state; OR + B. in a general circular configuration and then when a recieved (returned + to slave) gtid exists in the server's binlog. Then, in gtid strict mode, + it must be ignored similarly to the replicate-same-server-id rule. + */ + bool do_accept_own_server_id= false; + List start_alter_list; + MEM_ROOT mem_root; + /* + Flag is raised at the parallel worker slave stop. Its purpose + is to mark the whole start_alter_list when slave stops. + The flag is read by Start Alter event to self-mark its state accordingly + at time its alter info struct is about to be appened to the list. + */ + bool is_shutdown= false; +}; + +struct start_alter_thd_args +{ + rpl_group_info *rgi; + LEX_CSTRING query; + LEX_CSTRING *db; + char *catalog; + bool shutdown; + CHARSET_INFO *cs; }; int init_master_info(Master_info* mi, const char* master_info_fname, diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index 49ec08a9cea87..1e07ca582da04 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -56,8 +56,7 @@ rpt_handle_event(rpl_parallel_thread::queued_event *qev, rgi->event_relay_log_pos= qev->event_relay_log_pos; rgi->future_event_relay_log_pos= qev->future_event_relay_log_pos; strcpy(rgi->future_event_master_log_name, qev->future_event_master_log_name); - if (!(ev->is_artificial_event() || ev->is_relay_log_event() || - (ev->when == 0))) + if (event_can_update_last_master_timestamp(ev)) rgi->last_master_timestamp= ev->when + (time_t)ev->exec_time; err= apply_event_and_update_pos_for_parallel(ev, thd, rgi); @@ -151,6 +150,9 @@ finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id, wait_for_commit *wfc= &rgi->commit_orderer; int err; + if (rgi->get_finish_event_group_called()) + return; + thd->get_stmt_da()->set_overwrite_status(true); /* Remove any left-over registration to wait for a prior commit to @@ -247,6 +249,7 @@ finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id, entry->stop_on_error_sub_id == (uint64)ULONGLONG_MAX) entry->stop_on_error_sub_id= sub_id; mysql_mutex_unlock(&entry->LOCK_parallel_entry); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("hold_worker_on_schedule", { if (entry->stop_on_error_sub_id < (uint64)ULONGLONG_MAX) { @@ -261,6 +264,13 @@ finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id, STRING_WITH_LEN("now WAIT_FOR proceed_by_1000")); } }); + DBUG_EXECUTE_IF("hold_worker2_favor_worker3", { + if (rgi->current_gtid.seq_no == 2001) { + DBUG_ASSERT(!rgi->worker_error || entry->stop_on_error_sub_id == sub_id); + debug_sync_set_action(thd, STRING_WITH_LEN("now SIGNAL cont_worker3")); + } + }); +#endif if (rgi->killed_for_retry == rpl_group_info::RETRY_KILL_PENDING) wait_for_pending_deadlock_kill(thd, rgi); @@ -272,6 +282,8 @@ finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id, */ thd->get_stmt_da()->reset_diagnostics_area(); wfc->wakeup_subsequent_commits(rgi->worker_error); + rgi->did_mark_start_commit= false; + rgi->set_finish_event_group_called(true); } @@ -283,6 +295,11 @@ signal_error_to_sql_driver_thread(THD *thd, rpl_group_info *rgi, int err) In case we get an error during commit, inform following transactions that we aborted our commit. */ + DBUG_EXECUTE_IF("hold_worker2_favor_worker3", { + if (rgi->current_gtid.seq_no == 2002) { + debug_sync_set_action(thd, STRING_WITH_LEN("now WAIT_FOR cont_worker2")); + }}); + rgi->unmark_start_commit(); rgi->cleanup_context(thd, true); rgi->rli->abort_slave= true; @@ -571,6 +588,7 @@ rpl_pause_for_ftwrl(THD *thd) uint32 i; rpl_parallel_thread_pool *pool= &global_rpl_thread_pool; int err; + Dynamic_array mi_arr(4, 4); // array of replication source mi:s DBUG_ENTER("rpl_pause_for_ftwrl"); /* @@ -622,9 +640,36 @@ rpl_pause_for_ftwrl(THD *thd) mysql_cond_wait(&e->COND_parallel_entry, &e->LOCK_parallel_entry); }; --e->need_sub_id_signal; + thd->EXIT_COND(&old_stage); if (err) break; + /* + Notify any source any domain waiting-for-master Start-Alter to give way. + */ + Master_info *mi= e->rli->mi; + bool found= false; + for (uint i= 0; i < mi_arr.elements() && !found; i++) + found= mi_arr.at(i) == mi; + if (!found) + { + mi_arr.append(mi); + start_alter_info *info=NULL; + mysql_mutex_lock(&mi->start_alter_list_lock); + List_iterator info_iterator(mi->start_alter_list); + while ((info= info_iterator++)) + { + mysql_mutex_lock(&mi->start_alter_lock); + + DBUG_ASSERT(info->state == start_alter_state::REGISTERED); + + info->state= start_alter_state::ROLLBACK_ALTER; + info->direct_commit_alter= true; + mysql_cond_broadcast(&info->start_alter_cond); + mysql_mutex_unlock(&mi->start_alter_lock); + } + mysql_mutex_unlock(&mi->start_alter_list_lock); + } } if (err) @@ -774,6 +819,7 @@ retry_event_group(rpl_group_info *rgi, rpl_parallel_thread *rpt, rgi->killed_for_retry= rpl_group_info::RETRY_KILL_KILLED; thd->set_killed(KILL_CONNECTION); }); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("rpl_parallel_simulate_wait_at_retry", { if (rgi->current_gtid.seq_no == 1001) { debug_sync_set_action(thd, @@ -781,13 +827,21 @@ retry_event_group(rpl_group_info *rgi, rpl_parallel_thread *rpt, } DEBUG_SYNC(thd, "rpl_parallel_simulate_wait_at_retry"); }); +#endif rgi->cleanup_context(thd, 1); wait_for_pending_deadlock_kill(thd, rgi); thd->reset_killed(); thd->clear_error(); rgi->killed_for_retry = rpl_group_info::RETRY_KILL_NONE; - +#ifdef ENABLED_DEBUG_SYNC + DBUG_EXECUTE_IF("hold_worker2_favor_worker3", { + if (rgi->current_gtid.seq_no == 2003) { + debug_sync_set_action(thd, + STRING_WITH_LEN("now WAIT_FOR cont_worker3")); + } + }); +#endif /* If we retry due to a deadlock kill that occurred during the commit step, we might have already updated (but not committed) an update of table @@ -806,13 +860,10 @@ retry_event_group(rpl_group_info *rgi, rpl_parallel_thread *rpt, for (;;) { mysql_mutex_lock(&entry->LOCK_parallel_entry); - if (entry->stop_on_error_sub_id == (uint64) ULONGLONG_MAX || - DBUG_IF("simulate_mdev_12746") || - rgi->gtid_sub_id < entry->stop_on_error_sub_id) - { - register_wait_for_prior_event_group_commit(rgi, entry); - } - else + register_wait_for_prior_event_group_commit(rgi, entry); + if (entry->stop_on_error_sub_id != (uint64) ULONGLONG_MAX && + !DBUG_IF("simulate_mdev_12746") && + rgi->gtid_sub_id >= entry->stop_on_error_sub_id) { /* A failure of a preceding "parent" transaction may not be @@ -1204,6 +1255,7 @@ handle_rpl_parallel_thread(void *arg) bool did_enter_cond= false; PSI_stage_info old_stage; +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("hold_worker_on_schedule", { if (rgi->current_gtid.domain_id == 0 && rgi->current_gtid.seq_no == 100) { @@ -1218,6 +1270,7 @@ handle_rpl_parallel_thread(void *arg) STRING_WITH_LEN("now SIGNAL scheduled_gtid_0_x_100")); } }); +#endif if(unlikely(thd->wait_for_commit_ptr) && group_rgi != NULL) { @@ -1690,6 +1743,9 @@ rpl_parallel_change_thread_count(rpl_parallel_thread_pool *pool, { mysql_mutex_lock(&pool->threads[i]->LOCK_rpl_thread); pool->threads[i]->delay_start= false; + pool->threads[i]->current_start_alter_id= 0; + pool->threads[i]->current_start_alter_domain_id= 0; + pool->threads[i]->reserved_start_alter_thread= false; mysql_cond_signal(&pool->threads[i]->COND_rpl_thread); while (!pool->threads[i]->running) mysql_cond_wait(&pool->threads[i]->COND_rpl_thread, @@ -1774,6 +1830,7 @@ rpl_parallel_activate_pool(rpl_parallel_thread_pool *pool) } else bkp->init(pool->count); + bkp->is_valid= false; // Mark backup as stale during pool init } } @@ -1969,7 +2026,19 @@ rpl_parallel_thread::get_rgi(Relay_log_info *rli, Gtid_log_event *gtid_ev, rgi->retry_start_offset= rli->future_event_relay_log_pos-event_size; rgi->retry_event_count= 0; rgi->killed_for_retry= rpl_group_info::RETRY_KILL_NONE; + /* rgi is transaction specific so we need to move this value to rgi */ + rgi->reserved_start_alter_thread= reserved_start_alter_thread; + rgi->rpt= this; + rgi->direct_commit_alter= false; + rgi->finish_event_group_called= false; + DBUG_ASSERT(!rgi->sa_info); + /* + We can remove the reserved_start_alter_thread flag. + If we get more concurrent alter handle_split_alter will + automatically set this flag again. + */ + reserved_start_alter_thread= false; return rgi; } @@ -2019,6 +2088,9 @@ rpl_parallel_thread::get_gco(uint64 wait_count, group_commit_orderer *prev, gco->prior_sub_id= prior_sub_id; gco->installed= false; gco->flags= 0; +#ifndef DBUG_OFF + gco->gc_done= false; +#endif return gco; } @@ -2026,6 +2098,10 @@ rpl_parallel_thread::get_gco(uint64 wait_count, group_commit_orderer *prev, void rpl_parallel_thread::loc_free_gco(group_commit_orderer *gco) { +#ifndef DBUG_OFF + DBUG_ASSERT(!gco->gc_done); + gco->gc_done= true; +#endif if (!loc_gco_list) loc_gco_last_ptr_ptr= &gco->next_gco; else @@ -2033,6 +2109,10 @@ rpl_parallel_thread::loc_free_gco(group_commit_orderer *gco) loc_gco_list= gco; } +void rpl_group_info::finish_start_alter_event_group() +{ + finish_event_group(rpt, this->gtid_sub_id, this->parallel_entry, this); +} rpl_parallel_thread::rpl_parallel_thread() : channel_name_length(0), last_error_number(0), last_error_timestamp(0), @@ -2042,8 +2122,8 @@ rpl_parallel_thread::rpl_parallel_thread() rpl_parallel_thread_pool::rpl_parallel_thread_pool() - : threads(0), free_list(0), count(0), inited(false), busy(false), - pfs_bkp{0, false, NULL} + : threads(0), free_list(0), count(0), inited(false),current_start_alters(0), busy(false), + pfs_bkp{0, false, false, NULL} { } @@ -2172,9 +2252,133 @@ rpl_parallel_thread_pool::copy_pool_for_pfs(Relay_log_info *rli) pfs_rpt->worker_idle_time= rpt->get_worker_idle_time(); pfs_rpt->last_trans_retry_count= rpt->last_trans_retry_count; } + pfs_bkp.is_valid= true; } } +/* + START ALTER , COMMIT ALTER / ROLLBACK ALTER scheduling + + Steps:- + 1. (For Gtid_log_event SA). Get the worker thread which is either + e->rpl_threads[i] is NULL means worker from poll has not been assigned yet + e->rpl_threads[i]->current_owner != &e->rpl_threads[i] + Thread has been released, or about to //same as choose_thread logic + !e->rpl_threads[i]->current_start_alter_id is 0 , safe to schedule. + We dont want to schedule on worker which already have been scheduled SA + but CA/RA has not been scheduled yet. current_start_alter_id will indicate + this. If we dont do this we will get deadlock. + 2. (For Gtid_log_event SA) + call choose_thread_internal so that e->rpl_threads[idx] is not null + update the current_start_alter_id + 3. (For Gtid_log_event SA) + update local e->pending_start_alters(local) variable and + pool->current_start_alters(global) + We need 2 status variable (global and local) because we can have + slave_domain_parallel_threads != pool->threads. + 4. (For CA/RA Gtid_log_event) + Update e->pending_start_alters and pool->current_start_alters + while holding mutex lock on pool (if SA is not assigned to + reserved thread) + + + @returns + true Worker allocated (choose_thread_internal called) + false Worker not allocated (choose_thread_internal not called) +*/ +static bool handle_split_alter(rpl_parallel_entry *e, + Gtid_log_event *gtid_ev, uint32 *idx, + //choose_thread_internal specific + bool *did_enter_cond, rpl_group_info* rgi, + PSI_stage_info *old_stage) +{ + uint16 flags_extra= gtid_ev->flags_extra; + bool thread_allocated= false; + //Step 1 + if (flags_extra & Gtid_log_event::FL_START_ALTER_E1 || + //This will arrange finding threads for CA/RA as well + //as concurrent DDL + e->pending_start_alters) + { + /* + j is needed for round robin scheduling, we will start with rpl_thread_idx + go till rpl_thread_max and then start with 0 to rpl_thread_idx + */ + int j= e->rpl_thread_idx; + for(uint i= 0; i < e->rpl_thread_max; i++) + { + if (!e->rpl_threads[j] || e->rpl_threads[j]->current_owner + != &e->rpl_threads[j] || !e->rpl_threads[j]->current_start_alter_id) + { + //This condition will hit atleast one time no matter what happens + *idx= j; + DBUG_PRINT("info", ("Start alter id %d", j)); + goto idx_found; + } + j++; + j= j % e->rpl_thread_max; + } + //We did not find and idx + DBUG_ASSERT(0); + return false; +idx_found: + e->rpl_thread_idx= *idx; + e->choose_thread_internal(*idx, did_enter_cond, rgi, old_stage); + thread_allocated= true; + if (flags_extra & Gtid_log_event::FL_START_ALTER_E1) + { + mysql_mutex_assert_owner(&e->rpl_threads[*idx]->LOCK_rpl_thread); + e->rpl_threads[e->rpl_thread_idx]->current_start_alter_id= gtid_ev->seq_no; + e->rpl_threads[e->rpl_thread_idx]->current_start_alter_domain_id= + gtid_ev->domain_id; + /* + We are locking LOCK_rpl_thread_pool becuase we are going to update + current_start_alters + */ + mysql_mutex_lock(&global_rpl_thread_pool.LOCK_rpl_thread_pool); + if (e->pending_start_alters < e->rpl_thread_max - 1 && + global_rpl_thread_pool.current_start_alters + < global_rpl_thread_pool.count - 1) + { + e->pending_start_alters++; + global_rpl_thread_pool.current_start_alters++; + } + else + { + e->rpl_threads[*idx]->reserved_start_alter_thread= true; + e->rpl_threads[*idx]->current_start_alter_id= 0; + e->rpl_threads[*idx]->current_start_alter_domain_id= 0; + } + mysql_mutex_unlock(&global_rpl_thread_pool.LOCK_rpl_thread_pool); + } + } + if(flags_extra & (Gtid_log_event::FL_COMMIT_ALTER_E1 | + Gtid_log_event::FL_ROLLBACK_ALTER_E1 )) + { + //Free the corrosponding rpt current_start_alter_id + for(uint i= 0; i < e->rpl_thread_max; i++) + { + if(e->rpl_threads[i] && + e->rpl_threads[i]->current_start_alter_id == gtid_ev->sa_seq_no && + e->rpl_threads[i]->current_start_alter_domain_id == gtid_ev->domain_id) + { + mysql_mutex_lock(&global_rpl_thread_pool.LOCK_rpl_thread_pool); + e->rpl_threads[i]->current_start_alter_id= 0; + e->rpl_threads[i]->current_start_alter_domain_id= 0; + global_rpl_thread_pool.current_start_alters--; + e->pending_start_alters--; + DBUG_PRINT("info", ("Commit/Rollback alter id %d", i)); + mysql_mutex_unlock(&global_rpl_thread_pool.LOCK_rpl_thread_pool); + break; + } + } + } + + return thread_allocated; + +} + + /* Obtain a worker thread that we can queue an event to. @@ -2208,25 +2412,32 @@ rpl_parallel_entry::choose_thread(rpl_group_info *rgi, bool *did_enter_cond, Gtid_log_event *gtid_ev) { uint32 idx; - Relay_log_info *rli= rgi->rli; - rpl_parallel_thread *thr; idx= rpl_thread_idx; if (gtid_ev) { + if (++idx >= rpl_thread_max) + idx= 0; + //rpl_thread_idx will be updated handle_split_alter + if (handle_split_alter(this, gtid_ev, &idx, did_enter_cond, rgi, old_stage)) + return rpl_threads[idx]; if (gtid_ev->flags2 & (Gtid_log_event::FL_COMPLETED_XA | Gtid_log_event::FL_PREPARED_XA)) + { idx= my_hash_sort(&my_charset_bin, gtid_ev->xid.key(), gtid_ev->xid.key_length()) % rpl_thread_max; - else - { - ++idx; - if (idx >= rpl_thread_max) - idx= 0; } rpl_thread_idx= idx; } - thr= rpl_threads[idx]; + return choose_thread_internal(idx, did_enter_cond, rgi, old_stage); +} + +rpl_parallel_thread * rpl_parallel_entry::choose_thread_internal(uint idx, + bool *did_enter_cond, rpl_group_info *rgi, + PSI_stage_info *old_stage) +{ + rpl_parallel_thread* thr= rpl_threads[idx]; + Relay_log_info *rli= rgi->rli; if (thr) { *did_enter_cond= false; @@ -2255,11 +2466,13 @@ rpl_parallel_entry::choose_thread(rpl_group_info *rgi, bool *did_enter_cond, unlock_or_exit_cond(rli->sql_driver_thd, &thr->LOCK_rpl_thread, did_enter_cond, old_stage); my_error(ER_CONNECTION_KILLED, MYF(0)); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("rpl_parallel_wait_queue_max", { debug_sync_set_action(rli->sql_driver_thd, STRING_WITH_LEN("now SIGNAL wait_queue_killed")); };); +#endif slave_output_error_info(rgi, rli->sql_driver_thd); return NULL; } @@ -2277,11 +2490,13 @@ rpl_parallel_entry::choose_thread(rpl_group_info *rgi, bool *did_enter_cond, Because debug_sync changes the thd->mysys_var->current_mutex, and this can cause THD::awake to use the wrong mutex. */ +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("rpl_parallel_wait_queue_max", { debug_sync_set_action(rli->sql_driver_thd, STRING_WITH_LEN("now SIGNAL wait_queue_ready")); };); +#endif rli->sql_driver_thd->ENTER_COND(&thr->COND_rpl_thread_queue, &thr->LOCK_rpl_thread, &stage_waiting_for_room_in_worker_thread, @@ -2340,7 +2555,7 @@ rpl_parallel::~rpl_parallel() rpl_parallel_entry * -rpl_parallel::find(uint32 domain_id) +rpl_parallel::find(uint32 domain_id, Relay_log_info *rli) { struct rpl_parallel_entry *e; @@ -2366,17 +2581,25 @@ rpl_parallel::find(uint32 domain_id) e->domain_id= domain_id; e->stop_on_error_sub_id= (uint64)ULONGLONG_MAX; e->pause_sub_id= (uint64)ULONGLONG_MAX; + e->pending_start_alters= 0; + e->rli= rli; + mysql_mutex_init(key_LOCK_parallel_entry, &e->LOCK_parallel_entry, + MY_MUTEX_INIT_FAST); + mysql_cond_init(key_COND_parallel_entry, &e->COND_parallel_entry, NULL); if (my_hash_insert(&domain_hash, (uchar *)e)) { + mysql_cond_destroy(&e->COND_parallel_entry); + mysql_mutex_destroy(&e->LOCK_parallel_entry); my_free(e); return NULL; } - mysql_mutex_init(key_LOCK_parallel_entry, &e->LOCK_parallel_entry, - MY_MUTEX_INIT_FAST); - mysql_cond_init(key_COND_parallel_entry, &e->COND_parallel_entry, NULL); } else + { + DBUG_ASSERT(rli == e->rli); + e->force_abort= false; + } return e; } @@ -2393,7 +2616,7 @@ rpl_parallel::wait_for_done(THD *thd, Relay_log_info *rli) struct rpl_parallel_entry *e; rpl_parallel_thread *rpt; uint32 i, j; - + Master_info *mi= rli->mi; /* First signal all workers that they must force quit; no more events will be queued to complete any partial event groups executed. @@ -2437,13 +2660,54 @@ rpl_parallel::wait_for_done(THD *thd, Relay_log_info *rli) } } } +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("rpl_parallel_wait_for_done_trigger", { debug_sync_set_action(thd, STRING_WITH_LEN("now SIGNAL wait_for_done_waiting")); };); +#endif global_rpl_thread_pool.copy_pool_for_pfs(rli); + /* + Shutdown SA alter threads through marking their execution states + to force their early post-SA execution exit. Upon that the affected SA threads + change their state to COMPLETED, notify any waiting CA|RA and this thread. + */ + start_alter_info *info=NULL; + mysql_mutex_lock(&mi->start_alter_list_lock); + List_iterator info_iterator(mi->start_alter_list); + mi->is_shutdown= true; // a sign to stop in concurrently coming in new SA:s + while ((info= info_iterator++)) + { + mysql_mutex_lock(&mi->start_alter_lock); + if (info->state == start_alter_state::COMPLETED) + { + mysql_mutex_unlock(&mi->start_alter_lock); + continue; + } + info->state= start_alter_state::ROLLBACK_ALTER; + // Any possible CA that is (will be) waiting will complete this ALTER instance + info->direct_commit_alter= true; + mysql_cond_broadcast(&info->start_alter_cond); // notify SA:s + mysql_mutex_unlock(&mi->start_alter_lock); + + // await SA in the COMPLETED state + mysql_mutex_lock(&mi->start_alter_lock); + while(info->state == start_alter_state::ROLLBACK_ALTER) + mysql_cond_wait(&info->start_alter_cond, &mi->start_alter_lock); + + DBUG_ASSERT(info->state == start_alter_state::COMPLETED); + + mysql_mutex_unlock(&mi->start_alter_lock); + } + mysql_mutex_unlock(&mi->start_alter_list_lock); + + DBUG_EXECUTE_IF("rpl_slave_stop_CA_before_binlog", + { + debug_sync_set_action(thd, STRING_WITH_LEN("now signal proceed_CA_1")); + }); + for (i= 0; i < domain_hash.records; ++i) { e= (struct rpl_parallel_entry *)my_hash_element(&domain_hash, i); @@ -2458,6 +2722,17 @@ rpl_parallel::wait_for_done(THD *thd, Relay_log_info *rli) } } } + // Now that all threads are docked, remained alter states are safe to destroy + mysql_mutex_lock(&mi->start_alter_list_lock); + info_iterator.rewind(); + while ((info= info_iterator++)) + { + info_iterator.remove(); + mysql_cond_destroy(&info->start_alter_cond); + my_free(info); + } + mi->is_shutdown= false; + mysql_mutex_unlock(&mi->start_alter_list_lock); } @@ -2802,7 +3077,7 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev, uint32 domain_id= (rli->mi->using_gtid == Master_info::USE_GTID_NO || rli->mi->parallel_mode <= SLAVE_PARALLEL_MINIMAL ? 0 : gtid_ev->domain_id); - if (!(e= find(domain_id))) + if (!(e= find(domain_id, rli))) { my_error(ER_OUT_OF_RESOURCES, MYF(MY_WME)); delete ev; @@ -2814,6 +3089,7 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev, gtid.server_id= gtid_ev->server_id; gtid.seq_no= gtid_ev->seq_no; rli->update_relay_log_state(>id, 1); + serial_rgi->gtid_ev_flags_extra= gtid_ev->flags_extra; if (process_gtid_for_restart_pos(rli, >id)) { /* @@ -2897,7 +3173,12 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev, if (mode <= SLAVE_PARALLEL_MINIMAL || !(gtid_flags & Gtid_log_event::FL_GROUP_COMMIT_ID) || - e->last_commit_id != gtid_ev->commit_id) + e->last_commit_id != gtid_ev->commit_id || + /* + MULTI_BATCH is also set when the current gtid even being a member + of a commit group is flagged as DDL which disallows parallel. + */ + (gtid_flags & Gtid_log_event::FL_DDL)) flags|= group_commit_orderer::MULTI_BATCH; /* Make sure we do not attempt to run DDL in parallel speculatively. */ if (gtid_flags & Gtid_log_event::FL_DDL) diff --git a/sql/rpl_parallel.h b/sql/rpl_parallel.h index d3c46301ff8f2..f2bf36aa4a162 100644 --- a/sql/rpl_parallel.h +++ b/sql/rpl_parallel.h @@ -91,6 +91,9 @@ struct group_commit_orderer { FORCE_SWITCH= 2 }; uint8 flags; +#ifndef DBUG_OFF + bool gc_done; +#endif }; @@ -99,6 +102,18 @@ struct rpl_parallel_thread { bool running; bool stop; bool pause_for_ftwrl; + /* + 0 = No start alter assigned + >0 = Start alter assigned + */ + uint64 current_start_alter_id; + uint32 current_start_alter_domain_id; + /* + This flag is true when Start Alter just needs to be binlogged only. + This scenario will happens when there is congestion , and we can not + allocate independent worker to start alter. + */ + bool reserved_start_alter_thread; mysql_mutex_t LOCK_rpl_thread; mysql_cond_t COND_rpl_thread; mysql_cond_t COND_rpl_thread_queue; @@ -260,7 +275,7 @@ struct rpl_parallel_thread { struct pool_bkp_for_pfs{ uint32 count; - bool inited; + bool inited, is_valid; struct rpl_parallel_thread **rpl_thread_arr; void init(uint32 thd_count) { @@ -287,6 +302,7 @@ struct pool_bkp_for_pfs{ my_free(rpl_thread_arr); rpl_thread_arr= NULL; } + inited= false; } }; @@ -297,6 +313,12 @@ struct rpl_parallel_thread_pool { mysql_cond_t COND_rpl_thread_pool; uint32 count; bool inited; + + /* + Lock first LOCK_rpl_thread_pool and then LOCK_rpl_thread to + update this variable. + */ + uint32 current_start_alters; /* While FTWRL runs, this counter is incremented to make SQL thread or STOP/START slave not try to start new activity while that operation @@ -328,6 +350,7 @@ struct rpl_parallel_entry { */ uint32 need_sub_id_signal; uint64 last_commit_id; + uint32 pending_start_alters; bool active; /* Set when SQL thread is shutting down, and no more events can be processed, @@ -410,10 +433,15 @@ struct rpl_parallel_entry { uint64 count_committing_event_groups; /* The group_commit_orderer object for the events currently being queued. */ group_commit_orderer *current_gco; + /* Relay log info of replication source for this entry. */ + Relay_log_info *rli; rpl_parallel_thread * choose_thread(rpl_group_info *rgi, bool *did_enter_cond, PSI_stage_info *old_stage, Gtid_log_event *gtid_ev); + rpl_parallel_thread * + choose_thread_internal(uint idx, bool *did_enter_cond, rpl_group_info *rgi, + PSI_stage_info *old_stage); int queue_master_restart(rpl_group_info *rgi, Format_description_log_event *fdev); }; @@ -425,7 +453,7 @@ struct rpl_parallel { rpl_parallel(); ~rpl_parallel(); void reset(); - rpl_parallel_entry *find(uint32 domain_id); + rpl_parallel_entry *find(uint32 domain_id, Relay_log_info *rli); void wait_for_done(THD *thd, Relay_log_info *rli); void stop_during_until(); bool workers_idle(); diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc index 7da296b47d92d..6266acf780552 100644 --- a/sql/rpl_record.cc +++ b/sql/rpl_record.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2007, 2013, Oracle and/or its affiliates. - Copyright (c) 2008, 2019, MariaDB Corporation. + Copyright (c) 2008, 2022, 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 @@ -319,7 +319,9 @@ unpack_row(rpl_group_info *rgi, normal unpack operation. */ uint16 const metadata= tabledef->field_metadata(i); - IF_DBUG(uchar const *const old_pack_ptr= pack_ptr;,) +#ifdef DBUG_TRACE + uchar const *const old_pack_ptr= pack_ptr; +#endif pack_ptr= f->unpack(f->ptr, pack_ptr, row_end, metadata); DBUG_PRINT("debug", ("field: %s; metadata: 0x%x;" diff --git a/sql/rpl_reporting.h b/sql/rpl_reporting.h index 46a71ff5ad69d..8c10f3f04c11e 100644 --- a/sql/rpl_reporting.h +++ b/sql/rpl_reporting.h @@ -93,13 +93,13 @@ class Slave_reporting_capability localtime_r(&skr, &tm_tmp); start=&tm_tmp; - sprintf(timestamp, "%02d%02d%02d %02d:%02d:%02d", - start->tm_year % 100, - start->tm_mon+1, - start->tm_mday, - start->tm_hour, - start->tm_min, - start->tm_sec); + snprintf(timestamp, sizeof(timestamp), "%02d%02d%02d %02d:%02d:%02d", + start->tm_year % 100, + start->tm_mon+1, + start->tm_mday, + start->tm_hour, + start->tm_min, + start->tm_sec); timestamp[15]= '\0'; } diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 4ba843a51ab62..239616865608b 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -1673,7 +1673,7 @@ scan_one_gtid_slave_pos_table(THD *thd, HASH *hash, DYNAMIC_ARRAY *array, { table->file->ha_index_or_rnd_end(); ha_commit_trans(thd, FALSE); - ha_commit_trans(thd, TRUE); + trans_commit(thd); } if (table_opened) { @@ -2152,16 +2152,24 @@ rpl_group_info::reinit(Relay_log_info *rli) long_find_row_note_printed= false; did_mark_start_commit= false; gtid_ev_flags2= 0; + gtid_ev_flags_extra= 0; + gtid_ev_sa_seq_no= 0; last_master_timestamp = 0; gtid_ignore_duplicate_state= GTID_DUPLICATE_NULL; speculation= SPECULATE_NO; + rpt= NULL; + start_alter_ev= NULL; + direct_commit_alter= false; commit_orderer.reinit(); } rpl_group_info::rpl_group_info(Relay_log_info *rli) : thd(0), wait_commit_sub_id(0), wait_commit_group_info(0), parallel_entry(0), - deferred_events(NULL), m_annotate_event(0), is_parallel_exec(false) + deferred_events(NULL), m_annotate_event(0), is_parallel_exec(false), + gtid_ev_flags2(0), gtid_ev_flags_extra(0), gtid_ev_sa_seq_no(0), + reserved_start_alter_thread(0), finish_event_group_called(0), rpt(NULL), + start_alter_ev(NULL), direct_commit_alter(false), sa_info(NULL) { reinit(rli); bzero(¤t_gtid, sizeof(current_gtid)); @@ -2170,7 +2178,6 @@ rpl_group_info::rpl_group_info(Relay_log_info *rli) mysql_cond_init(key_rpl_group_info_sleep_cond, &sleep_cond, NULL); } - rpl_group_info::~rpl_group_info() { free_annotate_event(); @@ -2195,6 +2202,7 @@ event_group_new_gtid(rpl_group_info *rgi, Gtid_log_event *gev) rgi->current_gtid.seq_no= gev->seq_no; rgi->commit_id= gev->commit_id; rgi->gtid_pending= true; + rgi->sa_info= NULL; return 0; } @@ -2288,11 +2296,9 @@ void rpl_group_info::cleanup_context(THD *thd, bool error) if (unlikely(error)) { - /* - trans_rollback above does not rollback XA transactions - (todo/fixme consider to do so. - */ - if (thd->transaction->xid_state.is_explicit_XA()) + // leave alone any XA prepared transactions + if (thd->transaction->xid_state.is_explicit_XA() && + thd->transaction->xid_state.get_state_code() != XA_PREPARED) xa_trans_force_rollback(thd); thd->release_transactional_locks(); @@ -2430,8 +2436,13 @@ mark_start_commit_inner(rpl_parallel_entry *e, group_commit_orderer *gco, uint64 count= ++e->count_committing_event_groups; /* Signal any following GCO whose wait_count has been reached now. */ tmp= gco; + + DBUG_ASSERT(!tmp->gc_done); + while ((tmp= tmp->next_gco)) { + DBUG_ASSERT(!tmp->gc_done); + uint64 wait_count= tmp->wait_count; if (wait_count > count) break; diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h index cc807852bf219..80ee143a8e888 100644 --- a/sql/rpl_rli.h +++ b/sql/rpl_rli.h @@ -641,6 +641,33 @@ struct inuse_relaylog { } }; +enum start_alter_state +{ + INVALID= 0, + REGISTERED, // Start Alter exist, Default state + COMMIT_ALTER, // COMMIT the alter + ROLLBACK_ALTER, // Rollback the alter + COMPLETED // COMMIT/ROLLBACK Alter written in binlog +}; + +struct start_alter_info +{ + /* + ALTER id is defined as a pair of GTID's seq_no and domain_id. + */ + decltype(rpl_gtid::seq_no) sa_seq_no; // key for searching (SA's id) + uint32 domain_id; + bool direct_commit_alter; // when true CA thread executes the whole query + /* + 0 prepared and not error from commit and rollback + >0 error expected in commit/rollback + Rollback can be logged with 0 error if master is killed + */ + uint error; + enum start_alter_state state; + /* We are not using mysql_cond_t because we do not need PSI */ + mysql_cond_t start_alter_cond; +}; /* This is data for various state needed to be kept for the processing of @@ -760,6 +787,9 @@ struct rpl_group_info bool did_mark_start_commit; /* Copy of flags2 from GTID event. */ uchar gtid_ev_flags2; + /* Copy of flags3 from GTID event. */ + uint16 gtid_ev_flags_extra; + uint64 gtid_ev_sa_seq_no; enum { GTID_DUPLICATE_NULL=0, GTID_DUPLICATE_IGNORE=1, @@ -834,6 +864,15 @@ struct rpl_group_info RETRY_KILL_KILLED }; uchar killed_for_retry; + bool reserved_start_alter_thread; + bool finish_event_group_called; + /* + Used for two phase alter table + */ + rpl_parallel_thread *rpt; + Query_log_event *start_alter_ev; + bool direct_commit_alter; + start_alter_info *sa_info; rpl_group_info(Relay_log_info *rli_); ~rpl_group_info(); @@ -961,6 +1000,19 @@ struct rpl_group_info if (!is_parallel_exec) rli->event_relay_log_pos= future_event_relay_log_pos; } + + void finish_start_alter_event_group(); + + bool get_finish_event_group_called() + { + return finish_event_group_called; + } + + void set_finish_event_group_called(bool value) + { + finish_event_group_called= value; + } + }; diff --git a/sql/rpl_utility_server.cc b/sql/rpl_utility_server.cc index 8110b142e743f..ccad7bd070905 100644 --- a/sql/rpl_utility_server.cc +++ b/sql/rpl_utility_server.cc @@ -549,6 +549,8 @@ Field_longstr::rpl_conv_type_from(const Conv_source &source, binlog_type() == MYSQL_TYPE_VARCHAR_COMPRESSED || binlog_type() == MYSQL_TYPE_BLOB_COMPRESSED) same_type= binlog_type() == source.real_field_type(); + else if (Type_handler_json_common::is_json_type_handler(type_handler())) + same_type= type_handler()->type_handler_base() == source.type_handler(); else same_type= type_handler() == source.type_handler(); diff --git a/sql/select_handler.cc b/sql/select_handler.cc index 795ed8eb641a6..b0b8e58623de7 100644 --- a/sql/select_handler.cc +++ b/sql/select_handler.cc @@ -51,18 +51,19 @@ select_handler::~select_handler() TABLE *select_handler::create_tmp_table(THD *thd, SELECT_LEX *select) { - DBUG_ENTER("select_handler::create_tmp_table"); List types; TMP_TABLE_PARAM tmp_table_param; + TABLE *table; + DBUG_ENTER("select_handler::create_tmp_table"); + if (select->master_unit()->join_union_item_types(thd, types, 1)) DBUG_RETURN(NULL); tmp_table_param.init(); - tmp_table_param.field_count= types.elements; - - TABLE *table= ::create_tmp_table(thd, &tmp_table_param, types, - (ORDER *) 0, false, 0, - TMP_TABLE_ALL_COLUMNS, 1, - &empty_clex_str, true, false); + tmp_table_param.field_count= tmp_table_param.func_count= types.elements; + table= ::create_tmp_table(thd, &tmp_table_param, types, + (ORDER *) 0, false, 0, + TMP_TABLE_ALL_COLUMNS, 1, + &empty_clex_str, true, false); DBUG_RETURN(table); } diff --git a/sql/semisync_master.cc b/sql/semisync_master.cc index 2480eebf8d716..17adeed86e782 100644 --- a/sql/semisync_master.cc +++ b/sql/semisync_master.cc @@ -1,6 +1,6 @@ /* Copyright (C) 2007 Google Inc. Copyright (c) 2008, 2013, Oracle and/or its affiliates. - Copyright (c) 2011, 2016, MariaDB + Copyright (c) 2011, 2022, 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 @@ -275,12 +275,16 @@ void Active_tranx::clear_active_tranx_nodes(const char *log_file_name, Tranx_node *curr_node, *next_node; /* Delete all transaction nodes before the confirmation point. */ +#ifdef DBUG_TRACE int n_frees = 0; +#endif curr_node = m_trx_front; while (curr_node != new_front) { next_node = curr_node->next; +#ifdef DBUG_TRACE n_frees++; +#endif /* Remove the node from the hash table. */ unsigned int hash_val = get_hash_value(curr_node->log_name, curr_node->log_pos); @@ -313,8 +317,8 @@ void Active_tranx::clear_active_tranx_nodes(const char *log_file_name, /******************************************************************************* * - * class: the basic code layer for syncsync master. - * class: the basic code layer for syncsync slave. + * class: the basic code layer for semisync master. + * class: the basic code layer for semisync slave. * * The most important functions during semi-syn replication listed: * @@ -463,6 +467,37 @@ void Repl_semi_sync_master::cleanup() delete m_active_tranxs; } +int Repl_semi_sync_master::sync_get_master_wait_sessions() +{ + int wait_sessions; + lock(); + wait_sessions= rpl_semi_sync_master_wait_sessions; + unlock(); + return wait_sessions; +} + +void Repl_semi_sync_master::create_timeout(struct timespec *out, + struct timespec *start_arg) +{ + struct timespec *start_ts; + struct timespec now_ts; + if (!start_arg) + { + set_timespec(now_ts, 0); + start_ts= &now_ts; + } + else + { + start_ts= start_arg; + } + + long diff_secs= (long) (m_wait_timeout / TIME_THOUSAND); + long diff_nsecs= (long) ((m_wait_timeout % TIME_THOUSAND) * TIME_MILLION); + long nsecs= start_ts->tv_nsec + diff_nsecs; + out->tv_sec= start_ts->tv_sec + diff_secs + nsecs / TIME_BILLION; + out->tv_nsec= nsecs % TIME_BILLION; +} + void Repl_semi_sync_master::lock() { mysql_mutex_lock(&LOCK_binlog); @@ -774,8 +809,6 @@ void Repl_semi_sync_master::dump_end(THD* thd) remove_slave(); ack_receiver.remove_slave(thd); - - return; } int Repl_semi_sync_master::commit_trx(const char* trx_wait_binlog_name, @@ -862,13 +895,6 @@ int Repl_semi_sync_master::commit_trx(const char* trx_wait_binlog_name, m_wait_file_name, (ulong)m_wait_file_pos)); } - /* Calcuate the waiting period. */ - long diff_secs = (long) (m_wait_timeout / TIME_THOUSAND); - long diff_nsecs = (long) ((m_wait_timeout % TIME_THOUSAND) * TIME_MILLION); - long nsecs = start_ts.tv_nsec + diff_nsecs; - abstime.tv_sec = start_ts.tv_sec + diff_secs + nsecs/TIME_BILLION; - abstime.tv_nsec = nsecs % TIME_BILLION; - /* In semi-synchronous replication, we wait until the binlog-dump * thread has received the reply on the relevant binlog segment from the * replication slave. @@ -879,12 +905,20 @@ int Repl_semi_sync_master::commit_trx(const char* trx_wait_binlog_name, */ rpl_semi_sync_master_wait_sessions++; + /* We keep track of when this thread is awaiting an ack to ensure it is + * not killed while awaiting an ACK if a shutdown is issued. + */ + set_thd_awaiting_semisync_ack(thd, TRUE); + DBUG_PRINT("semisync", ("%s: wait %lu ms for binlog sent (%s, %lu)", "Repl_semi_sync_master::commit_trx", m_wait_timeout, m_wait_file_name, (ulong)m_wait_file_pos)); + create_timeout(&abstime, &start_ts); wait_result = cond_timewait(&abstime); + + set_thd_awaiting_semisync_ack(thd, FALSE); rpl_semi_sync_master_wait_sessions--; if (wait_result != 0) @@ -1229,6 +1263,7 @@ int Repl_semi_sync_master::flush_net(THD *thd, net_clear(net, 0); net->pkt_nr++; + net->compress_pkt_nr++; result = 0; rpl_semi_sync_master_net_wait_num++; @@ -1319,6 +1354,25 @@ void Repl_semi_sync_master::set_export_stats() unlock(); } +void Repl_semi_sync_master::await_slave_reply() +{ + struct timespec abstime; + + DBUG_ENTER("Repl_semi_sync_master::::await_slave_reply"); + lock(); + + /* Just return if there is nothing to wait for */ + if (!rpl_semi_sync_master_wait_sessions) + goto end; + + create_timeout(&abstime, NULL); + cond_timewait(&abstime); + +end: + unlock(); + DBUG_VOID_RETURN; +} + /* Get the waiting time given the wait's staring time. * * Return: diff --git a/sql/semisync_master.h b/sql/semisync_master.h index 9f0acf57a60de..5451ad512c621 100644 --- a/sql/semisync_master.h +++ b/sql/semisync_master.h @@ -454,7 +454,7 @@ class Repl_semi_sync_master public: Repl_semi_sync_master(); - ~Repl_semi_sync_master() {} + ~Repl_semi_sync_master() = default; void cleanup(); @@ -472,6 +472,21 @@ class Repl_semi_sync_master m_wait_timeout = wait_timeout; } + int sync_get_master_wait_sessions(); + + /* + Calculates a timeout that is m_wait_timeout after start_arg and saves it + in out. If start_arg is NULL, the timeout is m_wait_timeout after the + current system time. + */ + void create_timeout(struct timespec *out, struct timespec *start_arg); + + /* + Blocks the calling thread until the ack_receiver either receives an ACK + or times out (from rpl_semi_sync_master_timeout) + */ + void await_slave_reply(); + /*set the ACK point, after binlog sync or after transaction commit*/ void set_wait_point(unsigned long ack_point) { @@ -620,6 +635,30 @@ class Repl_semi_sync_master void check_and_switch(); + /* + Determines if the given thread is currently awaiting a semisync_ack. Note + that the thread's value is protected by this class's LOCK_binlog, so this + function (indirectly) provides safe access. + */ + my_bool is_thd_awaiting_semisync_ack(THD *thd) + { + lock(); + my_bool ret= thd->is_awaiting_semisync_ack; + unlock(); + return ret; + } + + /* + Update the thread's value for is_awaiting_semisync_ack. LOCK_binlog (from + this class) should be acquired before calling this function. + */ + void set_thd_awaiting_semisync_ack(THD *thd, + my_bool _is_awaiting_semisync_ack) + { + mysql_mutex_assert_owner(&LOCK_binlog); + thd->is_awaiting_semisync_ack= _is_awaiting_semisync_ack; + } + mysql_mutex_t LOCK_rpl_semi_sync_master_enabled; }; diff --git a/sql/semisync_master_ack_receiver.h b/sql/semisync_master_ack_receiver.h index 138f7b5aeed8b..d869bd2e6d41e 100644 --- a/sql/semisync_master_ack_receiver.h +++ b/sql/semisync_master_ack_receiver.h @@ -50,7 +50,7 @@ class Ack_receiver : public Repl_semi_sync_base { public: Ack_receiver(); - ~Ack_receiver() {} + ~Ack_receiver() = default; void cleanup(); /** Notify ack receiver to receive acks on the dump session. @@ -183,7 +183,7 @@ class Select_socket_listener bool listen_on_sockets() { - /* Reinitialze the fds with active fds before calling select */ + /* Reinitialize the fds with active fds before calling select */ m_fds= m_init_fds; struct timeval tv= {1,0}; /* select requires max fd + 1 for the first argument */ diff --git a/sql/semisync_slave.cc b/sql/semisync_slave.cc index 684199031ee23..788aab78911c3 100644 --- a/sql/semisync_slave.cc +++ b/sql/semisync_slave.cc @@ -114,10 +114,12 @@ int Repl_semi_sync_slave::slave_start(Master_info *mi) int Repl_semi_sync_slave::slave_stop(Master_info *mi) { - if (rpl_semi_sync_slave_status) - rpl_semi_sync_slave_status= 0; if (get_slave_enabled()) kill_connection(mi->mysql); + + if (rpl_semi_sync_slave_status) + rpl_semi_sync_slave_status= 0; + return 0; } @@ -133,6 +135,8 @@ void Repl_semi_sync_slave::kill_connection(MYSQL *mysql) char kill_buffer[30]; MYSQL *kill_mysql = NULL; + size_t kill_buffer_length; + kill_mysql = mysql_init(kill_mysql); mysql_options(kill_mysql, MYSQL_OPT_CONNECT_TIMEOUT, &m_kill_conn_timeout); mysql_options(kill_mysql, MYSQL_OPT_READ_TIMEOUT, &m_kill_conn_timeout); @@ -144,13 +148,35 @@ void Repl_semi_sync_slave::kill_connection(MYSQL *mysql) { sql_print_information("cannot connect to master to kill slave io_thread's " "connection"); - mysql_close(kill_mysql); - return; + goto failed_graceful_kill; } - size_t kill_buffer_length = my_snprintf(kill_buffer, 30, "KILL %lu", - mysql->thread_id); - mysql_real_query(kill_mysql, kill_buffer, (ulong)kill_buffer_length); + + DBUG_EXECUTE_IF("slave_delay_killing_semisync_connection", my_sleep(400000);); + + kill_buffer_length= my_snprintf(kill_buffer, 30, "KILL %lu", + mysql->thread_id); + if (mysql_real_query(kill_mysql, kill_buffer, (ulong)kill_buffer_length)) + { + sql_print_information( + "Failed to gracefully kill our active semi-sync connection with " + "primary. Silently closing the connection."); + goto failed_graceful_kill; + } + +end: mysql_close(kill_mysql); + return; + +failed_graceful_kill: + /* + If we fail to issue `KILL` on the primary to kill the active semi-sync + connection; we need to locally clean up our side of the connection. This + is because mysql_close will send COM_QUIT on the active semi-sync + connection, causing the primary to error. + */ + net_clear(&(mysql->net), 0); + end_server(mysql); + goto end; } int Repl_semi_sync_slave::request_transmit(Master_info *mi) diff --git a/sql/semisync_slave.h b/sql/semisync_slave.h index e7ccd952130b4..a8229245ab163 100644 --- a/sql/semisync_slave.h +++ b/sql/semisync_slave.h @@ -23,6 +23,7 @@ #include "sql_priv.h" #include "rpl_mi.h" #include "mysql.h" +#include class Master_info; @@ -33,7 +34,7 @@ class Repl_semi_sync_slave :public Repl_semi_sync_base { public: Repl_semi_sync_slave() :m_slave_enabled(false) {} - ~Repl_semi_sync_slave() {} + ~Repl_semi_sync_slave() = default; void set_trace_level(unsigned long trace_level) { m_trace_level = trace_level; diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc index 43183ff759513..dd12149ff48e4 100644 --- a/sql/service_wsrep.cc +++ b/sql/service_wsrep.cc @@ -1,4 +1,4 @@ -/* Copyright 2018 Codership Oy +/* Copyright 2018-2023 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 @@ -238,10 +238,10 @@ extern "C" my_bool wsrep_thd_bf_abort(THD *bf_thd, THD *victim_thd, } victim_thd->wsrep_aborter= bf_thd->thread_id; - victim_thd->awake_no_mutex(KILL_QUERY); + victim_thd->awake_no_mutex(KILL_QUERY_HARD); mysql_mutex_unlock(&victim_thd->LOCK_thd_data); } else { - WSREP_DEBUG("wsrep_thd_bf_abort skipped awake"); + WSREP_DEBUG("wsrep_thd_bf_abort skipped awake, signal %d", signal); } return ret; } @@ -253,7 +253,9 @@ extern "C" my_bool wsrep_thd_skip_locking(const THD *thd) extern "C" my_bool wsrep_thd_order_before(const THD *left, const THD *right) { - if (wsrep_thd_trx_seqno(left) < wsrep_thd_trx_seqno(right)) { + if (wsrep_thd_is_BF(left, false) && + wsrep_thd_is_BF(right, false) && + wsrep_thd_trx_seqno(left) < wsrep_thd_trx_seqno(right)) { WSREP_DEBUG("BF conflict, order: %lld %lld\n", (long long)wsrep_thd_trx_seqno(left), (long long)wsrep_thd_trx_seqno(right)); @@ -277,7 +279,6 @@ extern "C" my_bool wsrep_thd_is_aborting(const MYSQL_THD thd) return (cs.state() == wsrep::client_state::s_exec || cs.state() == wsrep::client_state::s_result); case wsrep::transaction::s_aborting: - case wsrep::transaction::s_aborted: return true; default: return false; @@ -369,13 +370,20 @@ extern "C" ulong wsrep_OSU_method_get(const MYSQL_THD thd) extern "C" bool wsrep_thd_set_wsrep_aborter(THD *bf_thd, THD *victim_thd) { - WSREP_DEBUG("wsrep_thd_set_wsrep_aborter called"); mysql_mutex_assert_owner(&victim_thd->LOCK_thd_data); + if (!bf_thd) + { + victim_thd->wsrep_aborter= 0; + WSREP_DEBUG("wsrep_thd_set_wsrep_aborter resetting wsrep_aborter"); + return false; + } if (victim_thd->wsrep_aborter && victim_thd->wsrep_aborter != bf_thd->thread_id) { return true; } - victim_thd->wsrep_aborter = bf_thd->thread_id; + victim_thd->wsrep_aborter= bf_thd->thread_id; + WSREP_DEBUG("wsrep_thd_set_wsrep_aborter setting wsrep_aborter %u", + victim_thd->wsrep_aborter); return false; } @@ -409,3 +417,23 @@ extern "C" void wsrep_thd_set_PA_unsafe(THD *thd) WSREP_DEBUG("session does not have active transaction, can not mark as PA unsafe"); } } + +extern "C" int wsrep_thd_append_table_key(MYSQL_THD thd, + const char* db, + const char* table, + enum Wsrep_service_key_type key_type) +{ + wsrep_key_arr_t key_arr = {0, 0}; + int ret = wsrep_prepare_keys_for_isolation(thd, db, table, NULL, &key_arr); + ret = ret || wsrep_thd_append_key(thd, key_arr.keys, + (int)key_arr.keys_len, key_type); + wsrep_keys_free(&key_arr); + return ret; +} + +extern "C" my_bool wsrep_thd_is_local_transaction(const THD *thd) +{ + return (wsrep_thd_is_local(thd) && + thd->wsrep_cs().transaction().active()); +} + diff --git a/sql/session_tracker.h b/sql/session_tracker.h index c78778ac73c7b..5715b5837b5a1 100644 --- a/sql/session_tracker.h +++ b/sql/session_tracker.h @@ -78,7 +78,7 @@ class State_tracker bool m_changed; public: - virtual ~State_tracker() {} + virtual ~State_tracker() = default; /** Getters */ bool is_enabled() const diff --git a/sql/set_var.h b/sql/set_var.h index 611f16e8bbbc1..ce1d01b9bd255 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -99,7 +99,7 @@ class sys_var: protected Value_source // for double_from_string_with_check on_check_function on_check_func, on_update_function on_update_func, const char *substitute); - virtual ~sys_var() {} + virtual ~sys_var() = default; /** All the cleanup procedures should be performed here @@ -278,8 +278,8 @@ class sys_var: protected Value_source // for double_from_string_with_check class set_var_base :public Sql_alloc { public: - set_var_base() {} - virtual ~set_var_base() {} + set_var_base() = default; + virtual ~set_var_base() = default; virtual int check(THD *thd)=0; /* To check privileges etc. */ virtual int update(THD *thd)=0; /* To set the value */ virtual int light_check(THD *thd) { return check(thd); } /* for PS */ diff --git a/sql/share/CMakeLists.txt b/sql/share/CMakeLists.txt index 55f39e5e22bdb..ddb813057ab9a 100644 --- a/sql/share/CMakeLists.txt +++ b/sql/share/CMakeLists.txt @@ -15,30 +15,32 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA SET (dirs +bulgarian +chinese +czech danish -german -slovak dutch -greek -norwegian -spanish english +estonian +french +german +greek +hindi hungarian -norwegian-ny -swedish italian -polish -ukrainian japanese +korean +norwegian-ny +norwegian +polish portuguese romanian -estonian -korean russian -czech -french serbian -hindi +slovak +spanish +swedish +ukrainian ) SET(files diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 3b5c8010a6de5..5956c15927828 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -1,4 +1,4 @@ -languages czech=cze latin2, danish=dan latin1, dutch=nla latin1, english=eng latin1, estonian=est latin7, french=fre latin1, german=ger latin1, greek=greek greek, hungarian=hun latin2, italian=ita latin1, japanese=jpn ujis, korean=kor euckr, norwegian-ny=norwegian-ny latin1, norwegian=nor latin1, polish=pol latin2, portuguese=por latin1, romanian=rum latin2, russian=rus koi8r, serbian=serbian cp1250, slovak=slo latin2, spanish=spa latin1, swedish=swe latin1, ukrainian=ukr koi8u, bulgarian=bgn cp1251, hindi=hindi utf8mb3; +languages bulgarian=bgn cp1251, chinese=chi gbk, czech=cze latin2, danish=dan latin1, dutch=nla latin1, english=eng latin1, estonian=est latin7, french=fre latin1, german=ger latin1, greek=greek greek, hindi=hindi utf8mb3, hungarian=hun latin2, italian=ita latin1, japanese=jpn ujis, korean=kor euckr, norwegian-ny=norwegian-ny latin1, norwegian=nor latin1, polish=pol latin2, portuguese=por latin1, romanian=rum latin2, russian=rus koi8r, serbian=serbian cp1250, slovak=slo latin2, spanish=spa latin1, swedish=swe latin1, ukrainian=ukr koi8u; default-language eng @@ -9,9 +9,9 @@ ER_HASHCHK ER_NISAMCHK eng "isamchk" ER_NO + chi "不" cze "NE" dan "NEJ" - nla "NEE" eng "NO" est "EI" fre "NON" @@ -20,6 +20,7 @@ ER_NO hindi "नहीं" hun "NEM" kor "아니오" + nla "NEE" nor "NEI" norwegian-ny "NEI" pol "NIE" @@ -30,9 +31,9 @@ ER_NO slo "NIE" ukr "НІ" ER_YES + chi "是的" cze "ANO" dan "JA" - nla "JA" eng "YES" est "JAH" fre "OUI" @@ -42,6 +43,7 @@ ER_YES hun "IGEN" ita "SI" kor "예" + nla "JA" nor "JA" norwegian-ny "JA" pol "TAK" @@ -53,9 +55,9 @@ ER_YES spa "SÍ" ukr "ТАК" ER_CANT_CREATE_FILE + chi "无法创建文件'%-.200s'(错误号码:%M)" cze "Nemohu vytvořit soubor '%-.200s' (chybový kód: %M)" dan "Kan ikke oprette filen '%-.200s' (Fejlkode: %M)" - nla "Kan file '%-.200s' niet aanmaken (Errcode: %M)" eng "Can't create file '%-.200s' (errno: %M)" est "Ei suuda luua faili '%-.200s' (veakood: %M)" fre "Ne peut créer le fichier '%-.200s' (Errcode: %M)" @@ -66,6 +68,7 @@ ER_CANT_CREATE_FILE ita "Impossibile creare il file '%-.200s' (errno: %M)" jpn "ファイル '%-.200s' を作成できません。(エラー番号: %M)" kor "화일 '%-.200s'를 만들지 못했습니다. (에러번호: %M)" + nla "Kan file '%-.200s' niet aanmaken (Errcode: %M)" nor "Kan ikke opprette fila '%-.200s' (Feilkode: %M)" norwegian-ny "Kan ikkje opprette fila '%-.200s' (Feilkode: %M)" pol "Nie można stworzyć pliku '%-.200s' (Kod błędu: %M)" @@ -78,11 +81,10 @@ ER_CANT_CREATE_FILE swe "Kan inte skapa filen '%-.200s' (Felkod: %M)" ukr "Не можу створити файл '%-.200s' (помилка: %M)" ER_CANT_CREATE_TABLE + chi "无法创建表%`s.%`s(错误号码:%M)" cze "Nemohu vytvořit tabulku %`s.%`s (chybový kód: %M)" dan "Kan ikke oprette tabellen %`s.%`s (Fejlkode: %M)" - nla "Kan tabel %`s.%`s niet aanmaken (Errcode: %M)" eng "Can't create table %`s.%`s (errno: %M)" - jps "%`s.%`s テーブルが作れません.(errno: %M)", est "Ei suuda luua tabelit %`s.%`s (veakood: %M)" fre "Ne peut créer la table %`s.%`s (Errcode: %M)" ger "Kann Tabelle %`s.%`s nicht erzeugen (Fehler: %M)" @@ -92,6 +94,7 @@ ER_CANT_CREATE_TABLE ita "Impossibile creare la tabella %`s.%`s (errno: %M)" jpn "%`s.%`s テーブルが作れません.(errno: %M)" kor "테이블 %`s.%`s를 만들지 못했습니다. (에러번호: %M)" + nla "Kan tabel %`s.%`s niet aanmaken (Errcode: %M)" nor "Kan ikke opprette tabellen %`s.%`s (Feilkode: %M)" norwegian-ny "Kan ikkje opprette tabellen %`s.%`s (Feilkode: %M)" pol "Nie można stworzyć tabeli %`s.%`s (Kod błędu: %M)" @@ -104,9 +107,9 @@ ER_CANT_CREATE_TABLE swe "Kan inte skapa tabellen %`s.%`s (Felkod: %M)" ukr "Не можу створити таблицю %`s.%`s (помилка: %M)" ER_CANT_CREATE_DB + chi "无法创建数据库'%-.192s'(错误号码:%M)" cze "Nemohu vytvořit databázi '%-.192s' (chybový kód: %M)" dan "Kan ikke oprette databasen '%-.192s' (Fejlkode: %M)" - nla "Kan database '%-.192s' niet aanmaken (Errcode: %M)" eng "Can't create database '%-.192s' (errno: %M)" est "Ei suuda luua andmebaasi '%-.192s' (veakood: %M)" fre "Ne peut créer la base '%-.192s' (Erreur %M)" @@ -117,6 +120,7 @@ ER_CANT_CREATE_DB ita "Impossibile creare il database '%-.192s' (errno: %M)" jpn "データベース '%-.192s' を作成できません。(エラー番号: %M)" kor "데이타베이스 '%-.192s'를 만들지 못했습니다.. (에러번호: %M)" + nla "Kan database '%-.192s' niet aanmaken (Errcode: %M)" nor "Kan ikke opprette databasen '%-.192s' (Feilkode: %M)" norwegian-ny "Kan ikkje opprette databasen '%-.192s' (Feilkode: %M)" pol "Nie można stworzyć bazy danych '%-.192s' (Kod błędu: %M)" @@ -129,9 +133,9 @@ ER_CANT_CREATE_DB swe "Kan inte skapa databasen '%-.192s' (Felkod: %M)" ukr "Не можу створити базу данних '%-.192s' (помилка: %M)" ER_DB_CREATE_EXISTS + chi "无法创建数据库'%-.192s';已经存在" cze "Nemohu vytvořit databázi '%-.192s'; databáze již existuje" dan "Kan ikke oprette databasen '%-.192s'; databasen eksisterer" - nla "Kan database '%-.192s' niet aanmaken; database bestaat reeds" eng "Can't create database '%-.192s'; database exists" est "Ei suuda luua andmebaasi '%-.192s': andmebaas juba eksisteerib" fre "Ne peut créer la base '%-.192s'; elle existe déjà" @@ -142,6 +146,7 @@ ER_DB_CREATE_EXISTS ita "Impossibile creare il database '%-.192s'; il database esiste" jpn "データベース '%-.192s' を作成できません。データベースはすでに存在します。" kor "데이타베이스 '%-.192s'를 만들지 못했습니다.. 데이타베이스가 존재함" + nla "Kan database '%-.192s' niet aanmaken; database bestaat reeds" nor "Kan ikke opprette databasen '%-.192s'; databasen eksisterer" norwegian-ny "Kan ikkje opprette databasen '%-.192s'; databasen eksisterer" pol "Nie można stworzyć bazy danych '%-.192s'; baza danych już istnieje" @@ -154,9 +159,9 @@ ER_DB_CREATE_EXISTS swe "Databasen '%-.192s' existerar redan" ukr "Не можу створити базу данних '%-.192s'. База данних існує" ER_DB_DROP_EXISTS + chi "无法删除数据库'%-.192s';数据库不存在" cze "Nemohu zrušit databázi '%-.192s', databáze neexistuje" dan "Kan ikke slette (droppe) '%-.192s'; databasen eksisterer ikke" - nla "Kan database '%-.192s' niet verwijderen; database bestaat niet" eng "Can't drop database '%-.192s'; database doesn't exist" est "Ei suuda kustutada andmebaasi '%-.192s': andmebaasi ei eksisteeri" fre "Ne peut effacer la base '%-.192s'; elle n'existe pas" @@ -167,6 +172,7 @@ ER_DB_DROP_EXISTS ita "Impossibile cancellare '%-.192s'; il database non esiste" jpn "データベース '%-.192s' を削除できません。データベースは存在しません。" kor "데이타베이스 '%-.192s'를 제거하지 못했습니다. 데이타베이스가 존재하지 않음 " + nla "Kan database '%-.192s' niet verwijderen; database bestaat niet" nor "Kan ikke fjerne (drop) '%-.192s'; databasen eksisterer ikke" norwegian-ny "Kan ikkje fjerne (drop) '%-.192s'; databasen eksisterer ikkje" pol "Nie można usun?ć bazy danych '%-.192s'; baza danych nie istnieje" @@ -179,9 +185,9 @@ ER_DB_DROP_EXISTS swe "Kan inte radera databasen '%-.192s'; databasen finns inte" ukr "Не можу видалити базу данних '%-.192s'. База данних не існує" ER_DB_DROP_DELETE + chi "删除数据库错误(无法删除'%-.192s',错误号码:%M)" cze "Chyba při rušení databáze (nemohu vymazat '%-.192s', chyba %M)" dan "Fejl ved sletning (drop) af databasen (kan ikke slette '%-.192s', Fejlkode %M)" - nla "Fout bij verwijderen database (kan '%-.192s' niet verwijderen, Errcode: %M)" eng "Error dropping database (can't delete '%-.192s', errno: %M)" est "Viga andmebaasi kustutamisel (ei suuda kustutada faili '%-.192s', veakood: %M)" fre "Ne peut effacer la base '%-.192s' (erreur %M)" @@ -192,6 +198,7 @@ ER_DB_DROP_DELETE ita "Errore durante la cancellazione del database (impossibile cancellare '%-.192s', errno: %M)" jpn "データベース削除エラー ('%-.192s' を削除できません。エラー番号: %M)" kor "데이타베이스 제거 에러('%-.192s'를 삭제할 수 없습니다, 에러번호: %M)" + nla "Fout bij verwijderen database (kan '%-.192s' niet verwijderen, Errcode: %M)" nor "Feil ved fjerning (drop) av databasen (kan ikke slette '%-.192s', feil %M)" norwegian-ny "Feil ved fjerning (drop) av databasen (kan ikkje slette '%-.192s', feil %M)" pol "Bł?d podczas usuwania bazy danych (nie można usun?ć '%-.192s', bł?d %M)" @@ -204,9 +211,9 @@ ER_DB_DROP_DELETE swe "Fel vid radering av databasen (Kan inte radera '%-.192s'. Felkod: %M)" ukr "Не можу видалити базу данних (Не можу видалити '%-.192s', помилка: %M)" ER_DB_DROP_RMDIR + chi "删除数据库错误(无法rmdir '%-.192s',错误号码:%M)" cze "Chyba při rušení databáze (nemohu vymazat adresář '%-.192s', chyba %M)" dan "Fejl ved sletting af database (kan ikke slette folderen '%-.192s', Fejlkode %M)" - nla "Fout bij verwijderen database (kan rmdir '%-.192s' niet uitvoeren, Errcode: %M)" eng "Error dropping database (can't rmdir '%-.192s', errno: %M)" est "Viga andmebaasi kustutamisel (ei suuda kustutada kataloogi '%-.192s', veakood: %M)" fre "Erreur en effaçant la base (rmdir '%-.192s', erreur %M)" @@ -215,8 +222,9 @@ ER_DB_DROP_RMDIR hindi "डेटाबेस ड्रॉप में त्रुटि हुई ('%-.192s' rmdir नहीं कर सकते, errno: %M)" hun "Adatbazis megszuntetesi hiba ('%-.192s' nem szuntetheto meg, hibakod: %M)" ita "Errore durante la cancellazione del database (impossibile rmdir '%-.192s', errno: %M)" - jpn "データベース削除エラー (ディレクトリ '%-.192s' を削除できません。エラー番号: %M)" + jpn "データベース削除エラー (ディレクトリ '%-.192s' を削除できません。エラー番号: %M)" kor "데이타베이스 제거 에러(rmdir '%-.192s'를 할 수 없습니다, 에러번호: %M)" + nla "Fout bij verwijderen database (kan rmdir '%-.192s' niet uitvoeren, Errcode: %M)" nor "Feil ved sletting av database (kan ikke slette katalogen '%-.192s', feil %M)" norwegian-ny "Feil ved sletting av database (kan ikkje slette katalogen '%-.192s', feil %M)" pol "Bł?d podczas usuwania bazy danych (nie można wykonać rmdir '%-.192s', bł?d %M)" @@ -229,9 +237,9 @@ ER_DB_DROP_RMDIR swe "Fel vid radering av databasen (Kan inte radera biblioteket '%-.192s'. Felkod: %M)" ukr "Не можу видалити базу данних (Не можу видалити теку '%-.192s', помилка: %M)" ER_CANT_DELETE_FILE + chi "删除'%-.192s'出错(错误号码:%M)" cze "Chyba při výmazu '%-.192s' (chybový kód: %M)" dan "Fejl ved sletning af '%-.192s' (Fejlkode: %M)" - nla "Fout bij het verwijderen van '%-.192s' (Errcode: %M)" eng "Error on delete of '%-.192s' (errno: %M)" est "Viga '%-.192s' kustutamisel (veakood: %M)" fre "Erreur en effaçant '%-.192s' (Errcode: %M)" @@ -240,8 +248,9 @@ ER_CANT_DELETE_FILE hindi "'%-.192s' के हटाने पर त्रुटि हुई (errno: %M)" hun "Torlesi hiba: '%-.192s' (hibakod: %M)" ita "Errore durante la cancellazione di '%-.192s' (errno: %M)" - jpn "ファイル '%-.192s' の削除エラー (エラー番号: %M)" + jpn "ファイル '%-.192s' の削除エラー (エラー番号: %M)" kor "'%-.192s' 삭제 중 에러 (에러번호: %M)" + nla "Fout bij het verwijderen van '%-.192s' (Errcode: %M)" nor "Feil ved sletting av '%-.192s' (Feilkode: %M)" norwegian-ny "Feil ved sletting av '%-.192s' (Feilkode: %M)" pol "Bł?d podczas usuwania '%-.192s' (Kod błędu: %M)" @@ -254,9 +263,9 @@ ER_CANT_DELETE_FILE swe "Kan inte radera filen '%-.192s' (Felkod: %M)" ukr "Не можу видалити '%-.192s' (помилка: %M)" ER_CANT_FIND_SYSTEM_REC + chi "无法在系统表中读取记录" cze "Nemohu číst záznam v systémové tabulce" dan "Kan ikke læse posten i systemfolderen" - nla "Kan record niet lezen in de systeem tabel" eng "Can't read record in system table" est "Ei suuda lugeda kirjet süsteemsest tabelist" fre "Ne peut lire un enregistrement de la table 'system'" @@ -267,6 +276,7 @@ ER_CANT_FIND_SYSTEM_REC ita "Impossibile leggere il record dalla tabella di sistema" jpn "システム表のレコードを読み込めません。" kor "system 테이블에서 레코드를 읽을 수 없습니다." + nla "Kan record niet lezen in de systeem tabel" nor "Kan ikke lese posten i systemkatalogen" norwegian-ny "Kan ikkje lese posten i systemkatalogen" pol "Nie można odczytać rekordu z tabeli systemowej" @@ -279,9 +289,9 @@ ER_CANT_FIND_SYSTEM_REC swe "Hittar inte posten i systemregistret" ukr "Не можу зчитати запис з системної таблиці" ER_CANT_GET_STAT + chi "无法获得'%-.200s'的状态(错误号码:%M)" cze "Nemohu získat stav '%-.200s' (chybový kód: %M)" dan "Kan ikke læse status af '%-.200s' (Fejlkode: %M)" - nla "Kan de status niet krijgen van '%-.200s' (Errcode: %M)" eng "Can't get status of '%-.200s' (errno: %M)" est "Ei suuda lugeda '%-.200s' olekut (veakood: %M)" fre "Ne peut obtenir le status de '%-.200s' (Errcode: %M)" @@ -292,6 +302,7 @@ ER_CANT_GET_STAT ita "Impossibile leggere lo stato di '%-.200s' (errno: %M)" jpn "'%-.200s' の状態を取得できません。(エラー番号: %M)" kor "'%-.200s'의 상태를 얻지 못했습니다. (에러번호: %M)" + nla "Kan de status niet krijgen van '%-.200s' (Errcode: %M)" nor "Kan ikke lese statusen til '%-.200s' (Feilkode: %M)" norwegian-ny "Kan ikkje lese statusen til '%-.200s' (Feilkode: %M)" pol "Nie można otrzymać statusu '%-.200s' (Kod błędu: %M)" @@ -304,9 +315,9 @@ ER_CANT_GET_STAT swe "Kan inte läsa filinformationen (stat) från '%-.200s' (Felkod: %M)" ukr "Не можу отримати статус '%-.200s' (помилка: %M)" ER_CANT_GET_WD + chi "无法获取工作目录(错误号码:%M)" cze "Chyba při zjišťování pracovní adresář (chybový kód: %M)" dan "Kan ikke læse aktive folder (Fejlkode: %M)" - nla "Kan de werkdirectory niet krijgen (Errcode: %M)" eng "Can't get working directory (errno: %M)" est "Ei suuda identifitseerida jooksvat kataloogi (veakood: %M)" fre "Ne peut obtenir le répertoire de travail (Errcode: %M)" @@ -317,6 +328,7 @@ ER_CANT_GET_WD ita "Impossibile leggere la directory di lavoro (errno: %M)" jpn "作業ディレクトリを取得できません。(エラー番号: %M)" kor "수행 디렉토리를 찾지 못했습니다. (에러번호: %M)" + nla "Kan de werkdirectory niet krijgen (Errcode: %M)" nor "Kan ikke lese aktiv katalog(Feilkode: %M)" norwegian-ny "Kan ikkje lese aktiv katalog(Feilkode: %M)" pol "Nie można rozpoznać aktualnego katalogu (Kod błędu: %M)" @@ -329,9 +341,9 @@ ER_CANT_GET_WD swe "Kan inte inte läsa aktivt bibliotek. (Felkod: %M)" ukr "Не можу визначити робочу теку (помилка: %M)" ER_CANT_LOCK + chi "无法锁定文件(错误号码:%M)" cze "Nemohu uzamknout soubor (chybový kód: %M)" dan "Kan ikke låse fil (Fejlkode: %M)" - nla "Kan de file niet blokeren (Errcode: %M)" eng "Can't lock file (errno: %M)" est "Ei suuda lukustada faili (veakood: %M)" fre "Ne peut verrouiller le fichier (Errcode: %M)" @@ -342,6 +354,7 @@ ER_CANT_LOCK ita "Impossibile il locking il file (errno: %M)" jpn "ファイルをロックできません。(エラー番号: %M)" kor "화일을 잠그지(lock) 못했습니다. (에러번호: %M)" + nla "Kan de file niet blokeren (Errcode: %M)" nor "Kan ikke låse fila (Feilkode: %M)" norwegian-ny "Kan ikkje låse fila (Feilkode: %M)" pol "Nie można zablokować pliku (Kod błędu: %M)" @@ -354,9 +367,9 @@ ER_CANT_LOCK swe "Kan inte låsa filen. (Felkod: %M)" ukr "Не можу заблокувати файл (помилка: %M)" ER_CANT_OPEN_FILE - cze "Nemohu otevřít soubor '%-.200s' (chybový kód: %M)" + chi "无法打开文件:'%-.200s'(错误号码:%M)" + cze "Nemohu otevřít soubor '%-.200s' (chybový kód: %M)" dan "Kan ikke åbne fil: '%-.200s' (Fejlkode: %M)" - nla "Kan de file '%-.200s' niet openen (Errcode: %M)" eng "Can't open file: '%-.200s' (errno: %M)" est "Ei suuda avada faili '%-.200s' (veakood: %M)" fre "Ne peut ouvrir le fichier: '%-.200s' (Errcode: %M)" @@ -367,6 +380,7 @@ ER_CANT_OPEN_FILE ita "Impossibile aprire il file: '%-.200s' (errno: %M)" jpn "ファイル '%-.200s' をオープンできません。(エラー番号: %M)" kor "화일을 열지 못했습니다.: '%-.200s' (에러번호: %M)" + nla "Kan de file '%-.200s' niet openen (Errcode: %M)" nor "Kan ikke åpne fila: '%-.200s' (Feilkode: %M)" norwegian-ny "Kan ikkje åpne fila: '%-.200s' (Feilkode: %M)" pol "Nie można otworzyć pliku: '%-.200s' (Kod błędu: %M)" @@ -379,9 +393,9 @@ ER_CANT_OPEN_FILE swe "Kan inte använda '%-.200s' (Felkod: %M)" ukr "Не можу відкрити файл: '%-.200s' (помилка: %M)" ER_FILE_NOT_FOUND + chi "找不到文件:'%-.200s'(错误号码:%M)" cze "Nemohu najít soubor '%-.200s' (chybový kód: %M)" dan "Kan ikke finde fila: '%-.200s' (Fejlkode: %M)" - nla "Kan de file: '%-.200s' niet vinden (Errcode: %M)" eng "Can't find file: '%-.200s' (errno: %M)" est "Ei suuda leida faili '%-.200s' (veakood: %M)" fre "Ne peut trouver le fichier: '%-.200s' (Errcode: %M)" @@ -392,6 +406,7 @@ ER_FILE_NOT_FOUND ita "Impossibile trovare il file: '%-.200s' (errno: %M)" jpn "ファイル '%-.200s' が見つかりません。(エラー番号: %M)" kor "화일을 찾지 못했습니다.: '%-.200s' (에러번호: %M)" + nla "Kan de file: '%-.200s' niet vinden (Errcode: %M)" nor "Kan ikke finne fila: '%-.200s' (Feilkode: %M)" norwegian-ny "Kan ikkje finne fila: '%-.200s' (Feilkode: %M)" pol "Nie można znaleĽć pliku: '%-.200s' (Kod błędu: %M)" @@ -404,9 +419,9 @@ ER_FILE_NOT_FOUND swe "Hittar inte filen '%-.200s' (Felkod: %M)" ukr "Не можу знайти файл: '%-.200s' (помилка: %M)" ER_CANT_READ_DIR + chi "无法读取'%-.192s'的文件夹(错误号码:%M)" cze "Nemohu číst adresář '%-.192s' (chybový kód: %M)" dan "Kan ikke læse folder '%-.192s' (Fejlkode: %M)" - nla "Kan de directory niet lezen van '%-.192s' (Errcode: %M)" eng "Can't read dir of '%-.192s' (errno: %M)" est "Ei suuda lugeda kataloogi '%-.192s' (veakood: %M)" fre "Ne peut lire le répertoire de '%-.192s' (Errcode: %M)" @@ -417,6 +432,7 @@ ER_CANT_READ_DIR ita "Impossibile leggere la directory di '%-.192s' (errno: %M)" jpn "ディレクトリ '%-.192s' を読み込めません。(エラー番号: %M)" kor "'%-.192s'디렉토리를 읽지 못했습니다. (에러번호: %M)" + nla "Kan de directory niet lezen van '%-.192s' (Errcode: %M)" nor "Kan ikke lese katalogen '%-.192s' (Feilkode: %M)" norwegian-ny "Kan ikkje lese katalogen '%-.192s' (Feilkode: %M)" pol "Nie można odczytać katalogu '%-.192s' (Kod błędu: %M)" @@ -429,9 +445,9 @@ ER_CANT_READ_DIR swe "Kan inte läsa från bibliotek '%-.192s' (Felkod: %M)" ukr "Не можу прочитати теку '%-.192s' (помилка: %M)" ER_CANT_SET_WD - cze "Nemohu změnit adresář na '%-.192s' (chybový kód: %M)" + chi "无法将dir更改为'%-.192s'(错误号码:%M)" + cze "Nemohu změnit adresář na '%-.192s' (chybový kód: %M)" dan "Kan ikke skifte folder til '%-.192s' (Fejlkode: %M)" - nla "Kan de directory niet veranderen naar '%-.192s' (Errcode: %M)" eng "Can't change dir to '%-.192s' (errno: %M)" est "Ei suuda siseneda kataloogi '%-.192s' (veakood: %M)" fre "Ne peut changer le répertoire pour '%-.192s' (Errcode: %M)" @@ -442,6 +458,7 @@ ER_CANT_SET_WD ita "Impossibile cambiare la directory in '%-.192s' (errno: %M)" jpn "ディレクトリ '%-.192s' に移動できません。(エラー番号: %M)" kor "'%-.192s'디렉토리로 이동할 수 없었습니다. (에러번호: %M)" + nla "Kan de directory niet veranderen naar '%-.192s' (Errcode: %M)" nor "Kan ikke skifte katalog til '%-.192s' (Feilkode: %M)" norwegian-ny "Kan ikkje skifte katalog til '%-.192s' (Feilkode: %M)" pol "Nie można zmienić katalogu na '%-.192s' (Kod błędu: %M)" @@ -454,9 +471,9 @@ ER_CANT_SET_WD swe "Kan inte byta till '%-.192s' (Felkod: %M)" ukr "Не можу перейти у теку '%-.192s' (помилка: %M)" ER_CHECKREAD + chi "这个表自上次读后数据有变化'%-.192s'" cze "Záznam byl změněn od posledního čtení v tabulce '%-.192s'" dan "Posten er ændret siden sidste læsning '%-.192s'" - nla "Record is veranderd sinds de laatste lees activiteit in de tabel '%-.192s'" eng "Record has changed since last read in table '%-.192s'" est "Kirje tabelis '%-.192s' on muutunud viimasest lugemisest saadik" fre "Enregistrement modifié depuis sa dernière lecture dans la table '%-.192s'" @@ -467,6 +484,7 @@ ER_CHECKREAD ita "Il record e` cambiato dall'ultima lettura della tabella '%-.192s'" jpn "表 '%-.192s' の最後の読み込み時点から、レコードが変化しました。" kor "테이블 '%-.192s'에서 마지막으로 읽은 후 Record가 변경되었습니다." + nla "Record is veranderd sinds de laatste lees activiteit in de tabel '%-.192s'" nor "Posten har blitt endret siden den ble lest '%-.192s'" norwegian-ny "Posten har vorte endra sidan den sist vart lesen '%-.192s'" pol "Rekord został zmieniony od ostaniego odczytania z tabeli '%-.192s'" @@ -479,9 +497,9 @@ ER_CHECKREAD swe "Posten har förändrats sedan den lästes i register '%-.192s'" ukr "Запис було змінено з часу останнього читання з таблиці '%-.192s'" ER_DISK_FULL + chi "磁盘已满(%s);等待释放一些空间...(错误号码:%M)" cze "Disk je plný (%s), čekám na uvolnění nějakého místa ... (chybový kód: %M)" dan "Ikke mere diskplads (%s). Venter på at få frigjort plads... (Fejlkode: %M)" - nla "Schijf vol (%s). Aan het wachten totdat er ruimte vrij wordt gemaakt... (Errcode: %M)" eng "Disk full (%s); waiting for someone to free some space... (errno: %M)" est "Ketas täis (%s). Ootame kuni tekib vaba ruumi... (veakood: %M)" fre "Disque plein (%s). J'attend que quelqu'un libère de l'espace... (Errcode: %M)" @@ -492,6 +510,7 @@ ER_DISK_FULL ita "Disco pieno (%s). In attesa che qualcuno liberi un po' di spazio... (errno: %M)" jpn "ディスク領域不足です(%s)。(エラー番号: %M)" kor "Disk full (%s). 다른 사람이 지울때까지 기다립니다... (에러번호: %M)" + nla "Schijf vol (%s). Aan het wachten totdat er ruimte vrij wordt gemaakt... (Errcode: %M)" nor "Ikke mer diskplass (%s). Venter på å få frigjort plass... (Feilkode: %M)" norwegian-ny "Ikkje meir diskplass (%s). Ventar på å få frigjort plass... (Feilkode: %M)" pol "Dysk pełny (%s). Oczekiwanie na zwolnienie miejsca... (Kod błędu: %M)" @@ -504,9 +523,9 @@ ER_DISK_FULL swe "Disken är full (%s). Väntar tills det finns ledigt utrymme... (Felkod: %M)" ukr "Диск заповнений (%s). Вичикую, доки звільниться трохи місця... (помилка: %M)" ER_DUP_KEY 23000 + chi "不能写;表'%-.192s'中有重复索引" cze "Nemohu zapsat, zdvojený klíč v tabulce '%-.192s'" dan "Kan ikke skrive, flere ens nøgler i tabellen '%-.192s'" - nla "Kan niet schrijven, dubbele zoeksleutel in tabel '%-.192s'" eng "Can't write; duplicate key in table '%-.192s'" est "Ei saa kirjutada, korduv võti tabelis '%-.192s'" fre "Ecriture impossible, doublon dans une clé de la table '%-.192s'" @@ -517,6 +536,7 @@ ER_DUP_KEY 23000 ita "Scrittura impossibile: chiave duplicata nella tabella '%-.192s'" jpn "書き込めません。表 '%-.192s' に重複するキーがあります。" kor "기록할 수 없습니다., 테이블 '%-.192s'에서 중복 키" + nla "Kan niet schrijven, dubbele zoeksleutel in tabel '%-.192s'" nor "Kan ikke skrive, flere like nøkler i tabellen '%-.192s'" norwegian-ny "Kan ikkje skrive, flere like nyklar i tabellen '%-.192s'" pol "Nie można zapisać, powtórzone klucze w tabeli '%-.192s'" @@ -529,9 +549,9 @@ ER_DUP_KEY 23000 swe "Kan inte skriva, dubbel söknyckel i register '%-.192s'" ukr "Не можу записати, дублюючийся ключ в таблиці '%-.192s'" ER_ERROR_ON_CLOSE - cze "Chyba při zavírání '%-.192s' (chybový kód: %M)" + chi "'%-.192s'关闭时出错(错误号码:%M)" + cze "Chyba při zavírání '%-.192s' (chybový kód: %M)" dan "Fejl ved lukning af '%-.192s' (Fejlkode: %M)" - nla "Fout bij het sluiten van '%-.192s' (Errcode: %M)" eng "Error on close of '%-.192s' (errno: %M)" est "Viga faili '%-.192s' sulgemisel (veakood: %M)" fre "Erreur a la fermeture de '%-.192s' (Errcode: %M)" @@ -542,6 +562,7 @@ ER_ERROR_ON_CLOSE ita "Errore durante la chiusura di '%-.192s' (errno: %M)" jpn "'%-.192s' のクローズ時エラー (エラー番号: %M)" kor "'%-.192s'닫는 중 에러 (에러번호: %M)" + nla "Fout bij het sluiten van '%-.192s' (Errcode: %M)" nor "Feil ved lukking av '%-.192s' (Feilkode: %M)" norwegian-ny "Feil ved lukking av '%-.192s' (Feilkode: %M)" pol "Bł?d podczas zamykania '%-.192s' (Kod błędu: %M)" @@ -554,9 +575,9 @@ ER_ERROR_ON_CLOSE swe "Fick fel vid stängning av '%-.192s' (Felkod: %M)" ukr "Не можу закрити '%-.192s' (помилка: %M)" ER_ERROR_ON_READ + chi "读取文件'%-.200s'错误(错误号码:%M)" cze "Chyba při čtení souboru '%-.200s' (chybový kód: %M)" dan "Fejl ved læsning af '%-.200s' (Fejlkode: %M)" - nla "Fout bij het lezen van file '%-.200s' (Errcode: %M)" eng "Error reading file '%-.200s' (errno: %M)" est "Viga faili '%-.200s' lugemisel (veakood: %M)" fre "Erreur en lecture du fichier '%-.200s' (Errcode: %M)" @@ -567,6 +588,7 @@ ER_ERROR_ON_READ ita "Errore durante la lettura del file '%-.200s' (errno: %M)" jpn "ファイル '%-.200s' の読み込みエラー (エラー番号: %M)" kor "'%-.200s'화일 읽기 에러 (에러번호: %M)" + nla "Fout bij het lezen van file '%-.200s' (Errcode: %M)" nor "Feil ved lesing av '%-.200s' (Feilkode: %M)" norwegian-ny "Feil ved lesing av '%-.200s' (Feilkode: %M)" pol "Bł?d podczas odczytu pliku '%-.200s' (Kod błędu: %M)" @@ -579,9 +601,9 @@ ER_ERROR_ON_READ swe "Fick fel vid läsning av '%-.200s' (Felkod %M)" ukr "Не можу прочитати файл '%-.200s' (помилка: %M)" ER_ERROR_ON_RENAME + chi "重命名'%-.210s'到'%-.210s'错误(错误号码:%M)" cze "Chyba při přejmenování '%-.210s' na '%-.210s' (chybový kód: %M)" dan "Fejl ved omdøbning af '%-.210s' til '%-.210s' (Fejlkode: %M)" - nla "Fout bij het hernoemen van '%-.210s' naar '%-.210s' (Errcode: %M)" eng "Error on rename of '%-.210s' to '%-.210s' (errno: %M)" est "Viga faili '%-.210s' ümbernimetamisel '%-.210s'-ks (veakood: %M)" fre "Erreur en renommant '%-.210s' en '%-.210s' (Errcode: %M)" @@ -592,6 +614,7 @@ ER_ERROR_ON_RENAME ita "Errore durante la rinominazione da '%-.210s' a '%-.210s' (errno: %M)" jpn "'%-.210s' の名前を '%-.210s' に変更できません (エラー番号: %M)" kor "'%-.210s'를 '%-.210s'로 이름 변경중 에러 (에러번호: %M)" + nla "Fout bij het hernoemen van '%-.210s' naar '%-.210s' (Errcode: %M)" nor "Feil ved omdøping av '%-.210s' til '%-.210s' (Feilkode: %M)" norwegian-ny "Feil ved omdøyping av '%-.210s' til '%-.210s' (Feilkode: %M)" pol "Bł?d podczas zmieniania nazwy '%-.210s' na '%-.210s' (Kod błędu: %M)" @@ -604,9 +627,9 @@ ER_ERROR_ON_RENAME swe "Kan inte byta namn från '%-.210s' till '%-.210s' (Felkod: %M)" ukr "Не можу перейменувати '%-.210s' у '%-.210s' (помилка: %M)" ER_ERROR_ON_WRITE - cze "Chyba při zápisu do souboru '%-.200s' (chybový kód: %M)" + chi "写文件'%-.200s'错误(错误号码:%M)" + cze "Chyba při zápisu do souboru '%-.200s' (chybový kód: %M)" dan "Fejl ved skriving av filen '%-.200s' (Fejlkode: %M)" - nla "Fout bij het wegschrijven van file '%-.200s' (Errcode: %M)" eng "Error writing file '%-.200s' (errno: %M)" est "Viga faili '%-.200s' kirjutamisel (veakood: %M)" fre "Erreur d'écriture du fichier '%-.200s' (Errcode: %M)" @@ -617,6 +640,7 @@ ER_ERROR_ON_WRITE ita "Errore durante la scrittura del file '%-.200s' (errno: %M)" jpn "ファイル '%-.200s' の書き込みエラー (エラー番号: %M)" kor "'%-.200s'화일 기록 중 에러 (에러번호: %M)" + nla "Fout bij het wegschrijven van file '%-.200s' (Errcode: %M)" nor "Feil ved skriving av fila '%-.200s' (Feilkode: %M)" norwegian-ny "Feil ved skriving av fila '%-.200s' (Feilkode: %M)" pol "Bł?d podczas zapisywania pliku '%-.200s' (Kod błędu: %M)" @@ -629,9 +653,9 @@ ER_ERROR_ON_WRITE swe "Fick fel vid skrivning till '%-.200s' (Felkod %M)" ukr "Не можу записати файл '%-.200s' (помилка: %M)" ER_FILE_USED + chi "'%-.192s'被锁定,不能改变" cze "'%-.192s' je zamčen proti změnám" dan "'%-.192s' er låst mod opdateringer" - nla "'%-.192s' is geblokeerd tegen veranderingen" eng "'%-.192s' is locked against change" est "'%-.192s' on lukustatud muudatuste vastu" fre "'%-.192s' est verrouillé contre les modifications" @@ -642,6 +666,7 @@ ER_FILE_USED ita "'%-.192s' e` soggetto a lock contro i cambiamenti" jpn "'%-.192s' はロックされています。" kor "'%-.192s'가 변경할 수 없도록 잠겨있습니다." + nla "'%-.192s' is geblokeerd tegen veranderingen" nor "'%-.192s' er låst mot oppdateringer" norwegian-ny "'%-.192s' er låst mot oppdateringar" pol "'%-.192s' jest zablokowany na wypadek zmian" @@ -654,9 +679,9 @@ ER_FILE_USED swe "'%-.192s' är låst mot användning" ukr "'%-.192s' заблокований на внесення змін" ER_FILSORT_ABORT + chi "排序中止" cze "Třídění přerušeno" dan "Sortering afbrudt" - nla "Sorteren afgebroken" eng "Sort aborted" est "Sorteerimine katkestatud" fre "Tri alphabétique abandonné" @@ -667,6 +692,7 @@ ER_FILSORT_ABORT ita "Operazione di ordinamento abbandonata" jpn "ソート処理を中断しました。" kor "소트가 중단되었습니다." + nla "Sorteren afgebroken" nor "Sortering avbrutt" norwegian-ny "Sortering avbrote" pol "Sortowanie przerwane" @@ -679,9 +705,9 @@ ER_FILSORT_ABORT swe "Sorteringen avbruten" ukr "Сортування перервано" ER_FORM_NOT_FOUND + chi "视图'%-.192s'不存在'%-.192s'" cze "Pohled '%-.192s' pro '%-.192s' neexistuje" dan "View '%-.192s' eksisterer ikke for '%-.192s'" - nla "View '%-.192s' bestaat niet voor '%-.192s'" eng "View '%-.192s' doesn't exist for '%-.192s'" est "Vaade '%-.192s' ei eksisteeri '%-.192s' jaoks" fre "La vue (View) '%-.192s' n'existe pas pour '%-.192s'" @@ -692,6 +718,7 @@ ER_FORM_NOT_FOUND ita "La view '%-.192s' non esiste per '%-.192s'" jpn "ビュー '%-.192s' は '%-.192s' に存在しません。" kor "뷰 '%-.192s'가 '%-.192s'에서는 존재하지 않습니다." + nla "View '%-.192s' bestaat niet voor '%-.192s'" nor "View '%-.192s' eksisterer ikke for '%-.192s'" norwegian-ny "View '%-.192s' eksisterar ikkje for '%-.192s'" pol "Widok '%-.192s' nie istnieje dla '%-.192s'" @@ -704,13 +731,14 @@ ER_FORM_NOT_FOUND swe "Formulär '%-.192s' finns inte i '%-.192s'" ukr "Вигляд '%-.192s' не існує для '%-.192s'" ER_GET_ERRNO - nla "Fout %M van tabel handler %s" + chi "错误 %M, 来自存储引擎 %s" eng "Got error %M from storage engine %s" fre "Reçu l'erreur %M du handler de la table %s" ger "Fehler %M von Speicher-Engine %s" greek "Ελήφθη μήνυμα λάθους %M από τον χειριστή πίνακα (table handler) %s" hindi "%M त्रुटि %s स्टोरेज इंजन से" ita "Rilevato l'errore %M dal gestore delle tabelle %s" + nla "Fout %M van tabel handler %s" nor "Mottok feil %M fra tabell håndterer %s" norwegian-ny "Mottok feil %M fra tabell handterar %s" pol "Otrzymano bł?d %M z obsługi tabeli %s" @@ -721,6 +749,7 @@ ER_GET_ERRNO swe "Fick felkod %M från databashanteraren %s" ukr "Отримано помилку %M від дескриптора таблиці %s" ER_ILLEGAL_HA + chi "存储引擎%s %`s.%`s 表没有该选项" eng "Storage engine %s of the table %`s.%`s doesn't have this option" ger "Diese Option gibt es nicht in Speicher-Engine %s für %`s.%`s" hindi "स्टोरेज इंजन %s में यह विकल्प उपलब्ध नहीं है (टेबल: %`s.%`s)" @@ -728,9 +757,9 @@ ER_ILLEGAL_HA spa "El motor de almacenaje %s de la tabla %`s.%`s no contiene esta opción" ukr "Дескриптор %s таблиці %`s.%`s не має цієї властивості" ER_KEY_NOT_FOUND + chi "无法在'%-.192s'中找到记录" cze "Nemohu najít záznam v '%-.192s'" dan "Kan ikke finde posten i '%-.192s'" - nla "Kan record niet vinden in '%-.192s'" eng "Can't find record in '%-.192s'" est "Ei suuda leida kirjet '%-.192s'-s" fre "Ne peut trouver l'enregistrement dans '%-.192s'" @@ -741,6 +770,7 @@ ER_KEY_NOT_FOUND ita "Impossibile trovare il record in '%-.192s'" jpn "'%-.192s' にレコードが見つかりません。" kor "'%-.192s'에서 레코드를 찾을 수 없습니다." + nla "Kan record niet vinden in '%-.192s'" nor "Kan ikke finne posten i '%-.192s'" norwegian-ny "Kan ikkje finne posten i '%-.192s'" pol "Nie można znaleĽć rekordu w '%-.192s'" @@ -750,12 +780,12 @@ ER_KEY_NOT_FOUND serbian "Ne mogu da pronađem slog u '%-.192s'" slo "Nemôžem nájsť záznam v '%-.192s'" spa "No puedo encontrar el registro en '%-.192s'" - swe "Hittar inte posten '%-.192s'" + swe "Hittar inte posten '%-.192s'" ukr "Не можу записати у '%-.192s'" ER_NOT_FORM_FILE + chi "文件中的信息不正确:'%-.200s'" cze "Nesprávná informace v souboru '%-.200s'" dan "Forkert indhold i: '%-.200s'" - nla "Verkeerde info in file: '%-.200s'" eng "Incorrect information in file: '%-.200s'" est "Vigane informatsioon failis '%-.200s'" fre "Information erronnée dans le fichier: '%-.200s'" @@ -766,6 +796,7 @@ ER_NOT_FORM_FILE ita "Informazione errata nel file: '%-.200s'" jpn "ファイル '%-.200s' 内の情報が不正です。" kor "화일의 부정확한 정보: '%-.200s'" + nla "Verkeerde info in file: '%-.200s'" nor "Feil informasjon i filen: '%-.200s'" norwegian-ny "Feil informasjon i fila: '%-.200s'" pol "Niewła?ciwa informacja w pliku: '%-.200s'" @@ -778,9 +809,9 @@ ER_NOT_FORM_FILE swe "Felaktig fil: '%-.200s'" ukr "Хибна інформація у файлі: '%-.200s'" ER_NOT_KEYFILE + chi "表'%-.200s'的索引损坏;试着修复" cze "Nesprávný klíč pro tabulku '%-.200s'; pokuste se ho opravit" dan "Fejl i indeksfilen til tabellen '%-.200s'; prøv at reparere den" - nla "Verkeerde zoeksleutel file voor tabel: '%-.200s'; probeer het te repareren" eng "Index for table '%-.200s' is corrupt; try to repair it" est "Tabeli '%-.200s' võtmefail on vigane; proovi seda parandada" fre "Index corrompu dans la table: '%-.200s'; essayez de le réparer" @@ -791,6 +822,7 @@ ER_NOT_KEYFILE ita "File chiave errato per la tabella : '%-.200s'; prova a riparalo" jpn "表 '%-.200s' の索引ファイル(key file)の内容が不正です。修復を試行してください。" kor "'%-.200s' 테이블의 부정확한 키 존재. 수정하시오!" + nla "Verkeerde zoeksleutel file voor tabel: '%-.200s'; probeer het te repareren" nor "Tabellen '%-.200s' har feil i nøkkelfilen; forsøk å reparer den" norwegian-ny "Tabellen '%-.200s' har feil i nykkelfila; prøv å reparere den" pol "Niewła?ciwy plik kluczy dla tabeli: '%-.200s'; spróbuj go naprawić" @@ -803,9 +835,9 @@ ER_NOT_KEYFILE swe "Fatalt fel vid hantering av register '%-.200s'; kör en reparation" ukr "Хибний файл ключей для таблиці: '%-.200s'; Спробуйте його відновити" ER_OLD_KEYFILE + chi "表'%-.192s'的老索引文件损坏; 修复!" cze "Starý klíčový soubor pro '%-.192s'; opravte ho" dan "Gammel indeksfil for tabellen '%-.192s'; reparer den" - nla "Oude zoeksleutel file voor tabel '%-.192s'; repareer het!" eng "Old key file for table '%-.192s'; repair it!" est "Tabeli '%-.192s' võtmefail on aegunud; paranda see!" fre "Vieux fichier d'index pour la table '%-.192s'; réparez le!" @@ -816,6 +848,7 @@ ER_OLD_KEYFILE ita "File chiave vecchio per la tabella '%-.192s'; riparalo!" jpn "表 '%-.192s' の索引ファイル(key file)は古い形式です。修復してください。" kor "'%-.192s' 테이블의 이전버젼의 키 존재. 수정하시오!" + nla "Oude zoeksleutel file voor tabel '%-.192s'; repareer het!" nor "Gammel nøkkelfil for tabellen '%-.192s'; reparer den!" norwegian-ny "Gammel nykkelfil for tabellen '%-.192s'; reparer den!" pol "Plik kluczy dla tabeli '%-.192s' jest starego typu; napraw go!" @@ -828,9 +861,9 @@ ER_OLD_KEYFILE swe "Gammal nyckelfil '%-.192s'; reparera registret" ukr "Старий файл ключей для таблиці '%-.192s'; Відновіть його!" ER_OPEN_AS_READONLY + chi "表'%-.192s'只可读" cze "'%-.192s' je jen pro čtení" dan "'%-.192s' er skrivebeskyttet" - nla "'%-.192s' is alleen leesbaar" eng "Table '%-.192s' is read only" est "Tabel '%-.192s' on ainult lugemiseks" fre "'%-.192s' est en lecture seulement" @@ -841,6 +874,7 @@ ER_OPEN_AS_READONLY ita "'%-.192s' e` di sola lettura" jpn "表 '%-.192s' は読み込み専用です。" kor "테이블 '%-.192s'는 읽기전용 입니다." + nla "'%-.192s' is alleen leesbaar" nor "'%-.192s' er skrivebeskyttet" norwegian-ny "'%-.192s' er skrivetryggja" pol "'%-.192s' jest tylko do odczytu" @@ -853,9 +887,9 @@ ER_OPEN_AS_READONLY swe "'%-.192s' är skyddad mot förändring" ukr "Таблиця '%-.192s' тільки для читання" ER_OUTOFMEMORY HY001 S1001 + chi "内存不足; 重启后重试(需要 %d bytes)" cze "Málo paměti. Přestartujte daemona a zkuste znovu (je potřeba %d bytů)" dan "Ikke mere hukommelse. Genstart serveren og prøv igen (mangler %d bytes)" - nla "Geen geheugen meer. Herstart server en probeer opnieuw (%d bytes nodig)" eng "Out of memory; restart server and try again (needed %d bytes)" est "Mälu sai otsa. Proovi MariaDB uuesti käivitada (puudu jäi %d baiti)" fre "Manque de mémoire. Redémarrez le démon et ré-essayez (%d octets nécessaires)" @@ -865,6 +899,7 @@ ER_OUTOFMEMORY HY001 S1001 ita "Memoria esaurita. Fai ripartire il demone e riprova (richiesti %d bytes)" jpn "メモリが不足しています。サーバーを再起動してみてください。(%d バイトの割り当てに失敗)" kor "Out of memory. 데몬을 재 실행 후 다시 시작하시오 (needed %d bytes)" + nla "Geen geheugen meer. Herstart server en probeer opnieuw (%d bytes nodig)" nor "Ikke mer minne. Star på nytt tjenesten og prøv igjen (trengte %d byter)" norwegian-ny "Ikkje meir minne. Start på nytt tenesten og prøv igjen (trengte %d bytar)" pol "Zbyt mało pamięci. Uruchom ponownie demona i spróbuj ponownie (potrzeba %d bajtów)" @@ -877,9 +912,9 @@ ER_OUTOFMEMORY HY001 S1001 swe "Oväntat slut på minnet, starta om programmet och försök på nytt (Behövde %d bytes)" ukr "Брак пам'яті. Рестартуйте сервер та спробуйте знову (потрібно %d байтів)" ER_OUT_OF_SORTMEMORY HY001 S1001 + chi "排序内存不足,可以考虑增加实例排序缓存量" cze "Málo paměti pro třídění. Zvyšte velikost třídícího bufferu" dan "Ikke mere sorteringshukommelse. Øg sorteringshukommelse (sort buffer size) for serveren" - nla "Geen geheugen om te sorteren. Verhoog de server sort buffer size" eng "Out of sort memory, consider increasing server sort buffer size" est "Mälu sai sorteerimisel otsa. Suurenda MariaDB-i sorteerimispuhvrit" fre "Manque de mémoire pour le tri. Augmentez-la" @@ -889,6 +924,7 @@ ER_OUT_OF_SORTMEMORY HY001 S1001 ita "Memoria per gli ordinamenti esaurita. Incrementare il 'sort_buffer' al demone" jpn "ソートメモリが不足しています。ソートバッファサイズ(sort buffer size)の増加を検討してください。" kor "Out of sort memory. daemon sort buffer의 크기를 증가시키세요" + nla "Geen geheugen om te sorteren. Verhoog de server sort buffer size" nor "Ikke mer sorteringsminne. Vurder å øke sorteringsminnet (sort buffer size) for tjenesten" norwegian-ny "Ikkje meir sorteringsminne. Vurder å auke sorteringsminnet (sorteringsbuffer storleik) for tenesten" pol "Zbyt mało pamięci dla sortowania. Zwiększ wielko?ć bufora demona dla sortowania" @@ -901,9 +937,9 @@ ER_OUT_OF_SORTMEMORY HY001 S1001 swe "Sorteringsbufferten räcker inte till. Kontrollera startparametrarna" ukr "Брак пам'яті для сортування. Треба збільшити розмір буфера сортування у сервера" ER_UNEXPECTED_EOF - cze "Neočekávaný konec souboru při čtení '%-.192s' (chybový kód: %M)" + chi "阅读文件'%-.192s'时出现意外的EOF(错误号码:%M)" + cze "Neočekávaný konec souboru při čtení '%-.192s' (chybový kód: %M)" dan "Uventet afslutning på fil (eof) ved læsning af filen '%-.192s' (Fejlkode: %M)" - nla "Onverwachte eof gevonden tijdens het lezen van file '%-.192s' (Errcode: %M)" eng "Unexpected EOF found when reading file '%-.192s' (errno: %M)" est "Ootamatu faililõpumärgend faili '%-.192s' lugemisel (veakood: %M)" fre "Fin de fichier inattendue en lisant '%-.192s' (Errcode: %M)" @@ -913,6 +949,7 @@ ER_UNEXPECTED_EOF ita "Fine del file inaspettata durante la lettura del file '%-.192s' (errno: %M)" jpn "ファイル '%-.192s' を読み込み中に予期せずファイルの終端に達しました。(エラー番号: %M)" kor "'%-.192s' 화일을 읽는 도중 잘못된 eof을 발견 (에러번호: %M)" + nla "Onverwachte eof gevonden tijdens het lezen van file '%-.192s' (Errcode: %M)" nor "Uventet slutt på fil (eof) ved lesing av filen '%-.192s' (Feilkode: %M)" norwegian-ny "Uventa slutt på fil (eof) ved lesing av fila '%-.192s' (Feilkode: %M)" pol "Nieoczekiwany 'eof' napotkany podczas czytania z pliku '%-.192s' (Kod błędu: %M)" @@ -925,9 +962,9 @@ ER_UNEXPECTED_EOF swe "Oväntat filslut vid läsning från '%-.192s' (Felkod: %M)" ukr "Хибний кінець файлу '%-.192s' (помилка: %M)" ER_CON_COUNT_ERROR 08004 + chi "太多连接" cze "Příliš mnoho spojení" dan "For mange forbindelser (connections)" - nla "Te veel verbindingen" eng "Too many connections" est "Liiga palju samaaegseid ühendusi" fre "Trop de connexions" @@ -938,6 +975,7 @@ ER_CON_COUNT_ERROR 08004 ita "Troppe connessioni" jpn "接続が多すぎます。" kor "너무 많은 연결... max_connection을 증가 시키시오..." + nla "Te veel verbindingen" nor "For mange tilkoblinger (connections)" norwegian-ny "For mange tilkoplingar (connections)" pol "Zbyt wiele poł?czeń" @@ -950,9 +988,9 @@ ER_CON_COUNT_ERROR 08004 swe "För många anslutningar" ukr "Забагато з'єднань" ER_OUT_OF_RESOURCES + chi "内存不足." cze "Málo prostoru/paměti pro thread" dan "Udgået for tråde/hukommelse" - nla "Geen thread geheugen meer; controleer of mariadbd of andere processen al het beschikbare geheugen gebruikt. Zo niet, dan moet u wellicht 'ulimit' gebruiken om mariadbd toe te laten meer geheugen te benutten, of u kunt extra swap ruimte toevoegen" eng "Out of memory." est "Mälu sai otsa. Võimalik, et aitab swap-i lisamine või käsu 'ulimit' abil MariaDB-le rohkema mälu kasutamise lubamine" fre "Manque de 'threads'/mémoire" @@ -962,6 +1000,7 @@ ER_OUT_OF_RESOURCES ita "Fine dello spazio/memoria per i thread" jpn "メモリが不足しています。mariadbd やその他のプロセスがメモリーを使い切っていないか確認して下さい。メモリーを使い切っていない場合、'ulimit'の設定等で mariadbd のメモリー使用最大量を多くするか、スワップ領域を増やす必要があるかもしれません。" # This message failed to convert from euc-kr, skipped + nla "Geen thread geheugen meer; controleer of mariadbd of andere processen al het beschikbare geheugen gebruikt. Zo niet, dan moet u wellicht 'ulimit' gebruiken om mariadbd toe te laten meer geheugen te benutten, of u kunt extra swap ruimte toevoegen" nor "Tomt for tråd plass/minne" norwegian-ny "Tomt for tråd plass/minne" pol "Zbyt mało miejsca/pamięci dla w?tku" @@ -974,9 +1013,9 @@ ER_OUT_OF_RESOURCES swe "Fick slut på minnet." ukr "Брак пам'яті." ER_BAD_HOST_ERROR 08S01 + chi "不能从你的地址获取主机名称" cze "Nemohu zjistit jméno stroje pro Vaši adresu" dan "Kan ikke få værtsnavn for din adresse" - nla "Kan de hostname niet krijgen van uw adres" eng "Can't get hostname for your address" est "Ei suuda lahendada IP aadressi masina nimeks" fre "Ne peut obtenir de hostname pour votre adresse" @@ -987,6 +1026,7 @@ ER_BAD_HOST_ERROR 08S01 ita "Impossibile risalire al nome dell'host dall'indirizzo (risoluzione inversa)" jpn "IPアドレスからホスト名を解決できません。" kor "당신의 컴퓨터의 호스트이름을 얻을 수 없습니다." + nla "Kan de hostname niet krijgen van uw adres" nor "Kan ikke få tak i vertsnavn for din adresse" norwegian-ny "Kan ikkje få tak i vertsnavn for di adresse" pol "Nie można otrzymać nazwy hosta dla twojego adresu" @@ -999,9 +1039,9 @@ ER_BAD_HOST_ERROR 08S01 swe "Kan inte hitta 'hostname' för din adress" ukr "Не можу визначити ім'я хосту для вашої адреси" ER_HANDSHAKE_ERROR 08S01 + chi "坏握手" cze "Chyba při ustavování spojení" dan "Forkert håndtryk (handshake)" - nla "Verkeerde handshake" eng "Bad handshake" est "Väär handshake" fre "Mauvais 'handshake'" @@ -1011,6 +1051,7 @@ ER_HANDSHAKE_ERROR 08S01 hun "A kapcsolatfelvetel nem sikerult (Bad handshake)" ita "Negoziazione impossibile" jpn "ハンドシェイクエラー" + nla "Verkeerde handshake" nor "Feil håndtrykk (handshake)" norwegian-ny "Feil handtrykk (handshake)" pol "Zły uchwyt(handshake)" @@ -1023,20 +1064,20 @@ ER_HANDSHAKE_ERROR 08S01 swe "Fel vid initiering av kommunikationen med klienten" ukr "Невірна установка зв'язку" ER_DBACCESS_DENIED_ERROR 42000 + chi "用户'%s'@'%s'无权访问数据库'%-.192s'" cze "Přístup pro uživatele '%s'@'%s' k databázi '%-.192s' není povolen" dan "Adgang nægtet bruger: '%s'@'%s' til databasen '%-.192s'" - nla "Toegang geweigerd voor gebruiker: '%s'@'%s' naar database '%-.192s'" eng "Access denied for user '%s'@'%s' to database '%-.192s'" - jps "ユーザー '%s'@'%s' の '%-.192s' データベースへのアクセスを拒否します", est "Ligipääs keelatud kasutajale '%s'@'%s' andmebaasile '%-.192s'" fre "Accès refusé pour l'utilisateur: '%s'@'%s'. Base '%-.192s'" ger "Benutzer '%s'@'%s' hat keine Zugriffsberechtigung für Datenbank '%-.192s'" greek "Δεν επιτέρεται η πρόσβαση στο χρήστη: '%s'@'%s' στη βάση δεδομένων '%-.192s'" - hun "A(z) '%s'@'%s' felhasznalo szamara tiltott eleres az '%-.192s' adabazishoz" hindi "यूज़र '%s'@'%s' को डेटाबेस '%-.192s' की अनुमति नहीं है" + hun "A(z) '%s'@'%s' felhasznalo szamara tiltott eleres az '%-.192s' adabazishoz" ita "Accesso non consentito per l'utente: '%s'@'%s' al database '%-.192s'" jpn "ユーザー '%s'@'%s' の '%-.192s' データベースへのアクセスを拒否します" kor "'%s'@'%s' 사용자는 '%-.192s' 데이타베이스에 접근이 거부 되었습니다." + nla "Toegang geweigerd voor gebruiker: '%s'@'%s' naar database '%-.192s'" nor "Tilgang nektet for bruker: '%s'@'%s' til databasen '%-.192s' nektet" norwegian-ny "Tilgang ikkje tillate for brukar: '%s'@'%s' til databasen '%-.192s' nekta" por "Acesso negado para o usuário '%s'@'%s' ao banco de dados '%-.192s'" @@ -1048,11 +1089,10 @@ ER_DBACCESS_DENIED_ERROR 42000 swe "Användare '%s'@'%s' är ej berättigad att använda databasen %-.192s" ukr "Доступ заборонено для користувача: '%s'@'%s' до бази данних '%-.192s'" ER_ACCESS_DENIED_ERROR 28000 + chi "'%s'@'%s' 用户无权访问 (使用密码: %s)" cze "Přístup pro uživatele '%s'@'%s' (s heslem %s)" dan "Adgang nægtet bruger: '%s'@'%s' (Bruger adgangskode: %s)" - nla "Toegang geweigerd voor gebruiker: '%s'@'%s' (Wachtwoord gebruikt: %s)" eng "Access denied for user '%s'@'%s' (using password: %s)" - jps "ユーザー '%s'@'%s' を拒否します.uUsing password: %s)", est "Ligipääs keelatud kasutajale '%s'@'%s' (kasutab parooli: %s)" fre "Accès refusé pour l'utilisateur: '%s'@'%s' (mot de passe: %s)" ger "Benutzer '%s'@'%s' hat keine Zugriffsberechtigung (verwendetes Passwort: %s)" @@ -1062,6 +1102,7 @@ ER_ACCESS_DENIED_ERROR 28000 ita "Accesso non consentito per l'utente: '%s'@'%s' (Password: %s)" jpn "ユーザー '%s'@'%s' を拒否します.uUsing password: %s)" kor "'%s'@'%s' 사용자는 접근이 거부 되었습니다. (using password: %s)" + nla "Toegang geweigerd voor gebruiker: '%s'@'%s' (Wachtwoord gebruikt: %s)" nor "Tilgang nektet for bruker: '%s'@'%s' (Bruker passord: %s)" norwegian-ny "Tilgang ikke tillate for brukar: '%s'@'%s' (Brukar passord: %s)" por "Acesso negado para o usuário '%s'@'%s' (senha usada: %s)" @@ -1073,9 +1114,9 @@ ER_ACCESS_DENIED_ERROR 28000 swe "Användare '%s'@'%s' är ej berättigad att logga in (Använder lösen: %s)" ukr "Доступ заборонено для користувача: '%s'@'%s' (Використано пароль: %s)" ER_NO_DB_ERROR 3D000 + chi "没有选择数据库" cze "Nebyla vybrána žádná databáze" dan "Ingen database valgt" - nla "Geen database geselecteerd" eng "No database selected" est "Andmebaasi ei ole valitud" fre "Aucune base n'a été sélectionnée" @@ -1086,6 +1127,7 @@ ER_NO_DB_ERROR 3D000 ita "Nessun database selezionato" jpn "データベースが選択されていません。" kor "선택된 데이타베이스가 없습니다." + nla "Geen database geselecteerd" nor "Ingen database valgt" norwegian-ny "Ingen database vald" pol "Nie wybrano żadnej bazy danych" @@ -1098,9 +1140,9 @@ ER_NO_DB_ERROR 3D000 swe "Ingen databas i användning" ukr "Базу данних не вибрано" ER_UNKNOWN_COM_ERROR 08S01 + chi "未知的命令" cze "Neznámý příkaz" dan "Ukendt kommando" - nla "Onbekend commando" eng "Unknown command" est "Tundmatu käsk" fre "Commande inconnue" @@ -1111,6 +1153,7 @@ ER_UNKNOWN_COM_ERROR 08S01 ita "Comando sconosciuto" jpn "不明なコマンドです。" kor "명령어가 뭔지 모르겠어요..." + nla "Onbekend commando" nor "Ukjent kommando" norwegian-ny "Ukjent kommando" pol "Nieznana komenda" @@ -1123,9 +1166,9 @@ ER_UNKNOWN_COM_ERROR 08S01 swe "Okänt kommando" ukr "Невідома команда" ER_BAD_NULL_ERROR 23000 + chi "列'%-.192s'不能为NULL" cze "Sloupec '%-.192s' nemůže být null" dan "Kolonne '%-.192s' kan ikke være NULL" - nla "Kolom '%-.192s' kan niet null zijn" eng "Column '%-.192s' cannot be null" est "Tulp '%-.192s' ei saa omada nullväärtust" fre "Le champ '%-.192s' ne peut être vide (null)" @@ -1136,6 +1179,7 @@ ER_BAD_NULL_ERROR 23000 ita "La colonna '%-.192s' non puo` essere nulla" jpn "列 '%-.192s' は null にできません。" kor "칼럼 '%-.192s'는 널(Null)이 되면 안됩니다. " + nla "Kolom '%-.192s' kan niet null zijn" nor "Kolonne '%-.192s' kan ikke vere null" norwegian-ny "Kolonne '%-.192s' kan ikkje vere null" pol "Kolumna '%-.192s' nie może być null" @@ -1148,9 +1192,9 @@ ER_BAD_NULL_ERROR 23000 swe "Kolumn '%-.192s' får inte vara NULL" ukr "Стовбець '%-.192s' не може бути нульовим" ER_BAD_DB_ERROR 42000 + chi "未知数据库'%-.192s'" cze "Neznámá databáze '%-.192s'" dan "Ukendt database '%-.192s'" - nla "Onbekende database '%-.192s'" eng "Unknown database '%-.192s'" est "Tundmatu andmebaas '%-.192s'" fre "Base '%-.192s' inconnue" @@ -1161,6 +1205,7 @@ ER_BAD_DB_ERROR 42000 ita "Database '%-.192s' sconosciuto" jpn "'%-.192s' は不明なデータベースです。" kor "데이타베이스 '%-.192s'는 알수 없음" + nla "Onbekende database '%-.192s'" nor "Ukjent database '%-.192s'" norwegian-ny "Ukjent database '%-.192s'" pol "Nieznana baza danych '%-.192s'" @@ -1173,9 +1218,9 @@ ER_BAD_DB_ERROR 42000 swe "Okänd databas: '%-.192s'" ukr "Невідома база данних '%-.192s'" ER_TABLE_EXISTS_ERROR 42S01 + chi "表'%-.192s'已经存在" cze "Tabulka '%-.192s' již existuje" dan "Tabellen '%-.192s' findes allerede" - nla "Tabel '%-.192s' bestaat al" eng "Table '%-.192s' already exists" est "Tabel '%-.192s' juba eksisteerib" fre "La table '%-.192s' existe déjà" @@ -1186,6 +1231,7 @@ ER_TABLE_EXISTS_ERROR 42S01 ita "La tabella '%-.192s' esiste gia`" jpn "表 '%-.192s' はすでに存在します。" kor "테이블 '%-.192s'는 이미 존재함" + nla "Tabel '%-.192s' bestaat al" nor "Tabellen '%-.192s' eksisterer allerede" norwegian-ny "Tabellen '%-.192s' eksisterar allereide" pol "Tabela '%-.192s' już istnieje" @@ -1198,9 +1244,9 @@ ER_TABLE_EXISTS_ERROR 42S01 swe "Tabellen '%-.192s' finns redan" ukr "Таблиця '%-.192s' вже існує" ER_BAD_TABLE_ERROR 42S02 + chi "未知表'%-.100T'" cze "Neznámá tabulka '%-.100T'" dan "Ukendt tabel '%-.100T'" - nla "Onbekende tabel '%-.100T'" eng "Unknown table '%-.100T'" est "Tundmatu tabel '%-.100T'" fre "Table '%-.100T' inconnue" @@ -1211,6 +1257,7 @@ ER_BAD_TABLE_ERROR 42S02 ita "Tabella '%-.100T' sconosciuta" jpn "'%-.100T' は不明な表です。" kor "테이블 '%-.100T'는 알수 없음" + nla "Onbekende tabel '%-.100T'" nor "Ukjent tabell '%-.100T'" norwegian-ny "Ukjent tabell '%-.100T'" pol "Nieznana tabela '%-.100T'" @@ -1223,9 +1270,9 @@ ER_BAD_TABLE_ERROR 42S02 swe "Okänd tabell '%-.100T'" ukr "Невідома таблиця '%-.100T'" ER_NON_UNIQ_ERROR 23000 + chi "列名 '%-.192s' 在 %-.192s 定义模糊" cze "Sloupec '%-.192s' v %-.192s není zcela jasný" dan "Felt: '%-.192s' i tabel %-.192s er ikke entydigt" - nla "Kolom: '%-.192s' in %-.192s is niet eenduidig" eng "Column '%-.192s' in %-.192s is ambiguous" est "Väli '%-.192s' %-.192s-s ei ole ühene" fre "Champ: '%-.192s' dans %-.192s est ambigu" @@ -1236,6 +1283,7 @@ ER_NON_UNIQ_ERROR 23000 ita "Colonna: '%-.192s' di %-.192s e` ambigua" jpn "列 '%-.192s' は %-.192s 内で曖昧です。" kor "칼럼: '%-.192s' in '%-.192s' 이 모호함" + nla "Kolom: '%-.192s' in %-.192s is niet eenduidig" nor "Felt: '%-.192s' i tabell %-.192s er ikke entydig" norwegian-ny "Kolonne: '%-.192s' i tabell %-.192s er ikkje eintydig" pol "Kolumna: '%-.192s' w %-.192s jest dwuznaczna" @@ -1248,9 +1296,9 @@ ER_NON_UNIQ_ERROR 23000 swe "Kolumn '%-.192s' i %-.192s är inte unik" ukr "Стовбець '%-.192s' у %-.192s визначений неоднозначно" ER_SERVER_SHUTDOWN 08S01 + chi "服务器正在关闭" cze "Probíhá ukončování práce serveru" dan "Database nedlukning er i gang" - nla "Bezig met het stoppen van de server" eng "Server shutdown in progress" est "Serveri seiskamine käib" fre "Arrêt du serveur en cours" @@ -1261,6 +1309,7 @@ ER_SERVER_SHUTDOWN 08S01 ita "Shutdown del server in corso" jpn "サーバーをシャットダウン中です。" kor "Server가 셧다운 중입니다." + nla "Bezig met het stoppen van de server" nor "Database nedkobling er i gang" norwegian-ny "Tenar nedkopling er i gang" pol "Trwa kończenie działania serwera" @@ -1273,9 +1322,9 @@ ER_SERVER_SHUTDOWN 08S01 swe "Servern går nu ned" ukr "Завершується работа сервера" ER_BAD_FIELD_ERROR 42S22 S0022 + chi "未知列'%-.192s'在'%-.192s'" cze "Neznámý sloupec '%-.192s' v %-.192s" dan "Ukendt kolonne '%-.192s' i tabel %-.192s" - nla "Onbekende kolom '%-.192s' in %-.192s" eng "Unknown column '%-.192s' in '%-.192s'" est "Tundmatu tulp '%-.192s' '%-.192s'-s" fre "Champ '%-.192s' inconnu dans %-.192s" @@ -1286,6 +1335,7 @@ ER_BAD_FIELD_ERROR 42S22 S0022 ita "Colonna sconosciuta '%-.192s' in '%-.192s'" jpn "列 '%-.192s' は '%-.192s' にはありません。" kor "Unknown 칼럼 '%-.192s' in '%-.192s'" + nla "Onbekende kolom '%-.192s' in %-.192s" nor "Ukjent kolonne '%-.192s' i tabell %-.192s" norwegian-ny "Ukjent felt '%-.192s' i tabell %-.192s" pol "Nieznana kolumna '%-.192s' w %-.192s" @@ -1298,9 +1348,9 @@ ER_BAD_FIELD_ERROR 42S22 S0022 swe "Okänd kolumn '%-.192s' i %-.192s" ukr "Невідомий стовбець '%-.192s' у '%-.192s'" ER_WRONG_FIELD_WITH_GROUP 42000 S1009 + chi "'%-.192s' 不在 GROUP BY" cze "Použité '%-.192s' nebylo v group by" dan "Brugte '%-.192s' som ikke var i group by" - nla "Opdracht gebruikt '%-.192s' dat niet in de GROUP BY voorkomt" eng "'%-.192s' isn't in GROUP BY" est "'%-.192s' puudub GROUP BY klauslis" fre "'%-.192s' n'est pas dans 'group by'" @@ -1311,6 +1361,7 @@ ER_WRONG_FIELD_WITH_GROUP 42000 S1009 ita "Usato '%-.192s' che non e` nel GROUP BY" jpn "'%-.192s' はGROUP BY句で指定されていません。" kor "'%-.192s'은 GROUP BY속에 없음" + nla "Opdracht gebruikt '%-.192s' dat niet in de GROUP BY voorkomt" nor "Brukte '%-.192s' som ikke var i group by" norwegian-ny "Brukte '%-.192s' som ikkje var i group by" pol "Użyto '%-.192s' bez umieszczenia w group by" @@ -1323,9 +1374,9 @@ ER_WRONG_FIELD_WITH_GROUP 42000 S1009 swe "'%-.192s' finns inte i GROUP BY" ukr "'%-.192s' не є у GROUP BY" ER_WRONG_GROUP_FIELD 42000 S1009 + chi "不能在'%-.192s'上分组" cze "Nemohu použít group na '%-.192s'" dan "Kan ikke gruppere på '%-.192s'" - nla "Kan '%-.192s' niet groeperen" eng "Can't group on '%-.192s'" est "Ei saa grupeerida '%-.192s' järgi" fre "Ne peut regrouper '%-.192s'" @@ -1336,6 +1387,7 @@ ER_WRONG_GROUP_FIELD 42000 S1009 ita "Impossibile raggruppare per '%-.192s'" jpn "'%-.192s' でのグループ化はできません。" kor "'%-.192s'를 그룹할 수 없음" + nla "Kan '%-.192s' niet groeperen" nor "Kan ikke gruppere på '%-.192s'" norwegian-ny "Kan ikkje gruppere på '%-.192s'" pol "Nie można grupować po '%-.192s'" @@ -1348,9 +1400,9 @@ ER_WRONG_GROUP_FIELD 42000 S1009 swe "Kan inte använda GROUP BY med '%-.192s'" ukr "Не можу групувати по '%-.192s'" ER_WRONG_SUM_SELECT 42000 S1009 + chi "语句在同一语句里有求和函数和列" cze "Příkaz obsahuje zároveň funkci sum a sloupce" dan "Udtrykket har summer (sum) funktioner og kolonner i samme udtryk" - nla "Opdracht heeft totaliseer functies en kolommen in dezelfde opdracht" eng "Statement has sum functions and columns in same statement" est "Lauses on korraga nii tulbad kui summeerimisfunktsioonid" fre "Vous demandez la fonction sum() et des champs dans la même commande" @@ -1359,6 +1411,7 @@ ER_WRONG_SUM_SELECT 42000 S1009 ita "Il comando ha una funzione SUM e una colonna non specificata nella GROUP BY" jpn "集計関数と通常の列が同時に指定されています。" kor "Statement 가 sum기능을 동작중이고 칼럼도 동일한 statement입니다." + nla "Opdracht heeft totaliseer functies en kolommen in dezelfde opdracht" nor "Uttrykket har summer (sum) funksjoner og kolonner i samme uttrykk" norwegian-ny "Uttrykket har summer (sum) funksjoner og kolonner i same uttrykk" pol "Zapytanie ma funkcje sumuj?ce i kolumny w tym samym zapytaniu" @@ -1371,9 +1424,9 @@ ER_WRONG_SUM_SELECT 42000 S1009 swe "Kommandot har både sum functions och enkla funktioner" ukr "У виразі використано підсумовуючі функції поряд з іменами стовбців" ER_WRONG_VALUE_COUNT 21S01 + chi "列数与值数不匹配" cze "Počet sloupců neodpovídá zadané hodnotě" dan "Kolonne tæller stemmer ikke med antallet af værdier" - nla "Het aantal kolommen komt niet overeen met het aantal opgegeven waardes" eng "Column count doesn't match value count" est "Tulpade arv erineb väärtuste arvust" ger "Die Anzahl der Spalten entspricht nicht der Anzahl der Werte" @@ -1383,6 +1436,7 @@ ER_WRONG_VALUE_COUNT 21S01 ita "Il numero delle colonne non e` uguale al numero dei valori" jpn "列数が値の個数と一致しません。" kor "칼럼의 카운트가 값의 카운트와 일치하지 않습니다." + nla "Het aantal kolommen komt niet overeen met het aantal opgegeven waardes" nor "Felt telling stemmer verdi telling" norwegian-ny "Kolonne telling stemmer verdi telling" pol "Liczba kolumn nie odpowiada liczbie warto?ci" @@ -1395,9 +1449,9 @@ ER_WRONG_VALUE_COUNT 21S01 swe "Antalet kolumner motsvarar inte antalet värden" ukr "Кількість стовбців не співпадає з кількістю значень" ER_TOO_LONG_IDENT 42000 S1009 + chi "标识符'%-.100T'太长" cze "Jméno identifikátoru '%-.100T' je příliš dlouhé" dan "Navnet '%-.100T' er for langt" - nla "Naam voor herkenning '%-.100T' is te lang" eng "Identifier name '%-.100T' is too long" est "Identifikaatori '%-.100T' nimi on liiga pikk" fre "Le nom de l'identificateur '%-.100T' est trop long" @@ -1408,6 +1462,7 @@ ER_TOO_LONG_IDENT 42000 S1009 ita "Il nome dell'identificatore '%-.100T' e` troppo lungo" jpn "識別子名 '%-.100T' は長すぎます。" kor "Identifier '%-.100T'는 너무 길군요." + nla "Naam voor herkenning '%-.100T' is te lang" nor "Identifikator '%-.100T' er for lang" norwegian-ny "Identifikator '%-.100T' er for lang" pol "Nazwa identyfikatora '%-.100T' jest zbyt długa" @@ -1420,9 +1475,9 @@ ER_TOO_LONG_IDENT 42000 S1009 swe "Kolumnnamn '%-.100T' är för långt" ukr "Ім'я ідентифікатора '%-.100T' задовге" ER_DUP_FIELDNAME 42S21 S1009 + chi "列名重复 '%-.192s'" cze "Zdvojené jméno sloupce '%-.192s'" dan "Feltnavnet '%-.192s' findes allerede" - nla "Dubbele kolom naam '%-.192s'" eng "Duplicate column name '%-.192s'" est "Kattuv tulba nimi '%-.192s'" fre "Nom du champ '%-.192s' déjà utilisé" @@ -1433,6 +1488,7 @@ ER_DUP_FIELDNAME 42S21 S1009 ita "Nome colonna duplicato '%-.192s'" jpn "列名 '%-.192s' は重複してます。" kor "중복된 칼럼 이름: '%-.192s'" + nla "Dubbele kolom naam '%-.192s'" nor "Feltnavnet '%-.192s' eksisterte fra før" norwegian-ny "Feltnamnet '%-.192s' eksisterte frå før" pol "Powtórzona nazwa kolumny '%-.192s'" @@ -1445,9 +1501,9 @@ ER_DUP_FIELDNAME 42S21 S1009 swe "Kolumnnamn '%-.192s finns flera gånger" ukr "Дублююче ім'я стовбця '%-.192s'" ER_DUP_KEYNAME 42000 S1009 + chi "索引名重复 '%-.192s'" cze "Zdvojené jméno klíče '%-.192s'" dan "Indeksnavnet '%-.192s' findes allerede" - nla "Dubbele zoeksleutel naam '%-.192s'" eng "Duplicate key name '%-.192s'" est "Kattuv võtme nimi '%-.192s'" fre "Nom de clef '%-.192s' déjà utilisé" @@ -1458,6 +1514,7 @@ ER_DUP_KEYNAME 42000 S1009 ita "Nome chiave duplicato '%-.192s'" jpn "索引名 '%-.192s' は重複しています。" kor "중복된 키 이름 : '%-.192s'" + nla "Dubbele zoeksleutel naam '%-.192s'" nor "Nøkkelnavnet '%-.192s' eksisterte fra før" norwegian-ny "Nøkkelnamnet '%-.192s' eksisterte frå før" pol "Powtórzony nazwa klucza '%-.192s'" @@ -1472,34 +1529,35 @@ ER_DUP_KEYNAME 42000 S1009 # When using this error code, please use ER(ER_DUP_ENTRY_WITH_KEY_NAME) # for the message string. See, for example, code in handler.cc. ER_DUP_ENTRY 23000 S1009 - cze "Zdvojený klíč '%-.192T' (číslo klíče %d)" - dan "Ens værdier '%-.192T' for indeks %d" - nla "Dubbele ingang '%-.192T' voor zoeksleutel %d" - eng "Duplicate entry '%-.192T' for key %d" - est "Kattuv väärtus '%-.192T' võtmele %d" - fre "Duplicata du champ '%-.192T' pour la clef %d" - ger "Doppelter Eintrag '%-.192T' für Schlüssel %d" - greek "Διπλή εγγραφή '%-.192T' για το κλειδί %d" - hindi "सामान प्रवेश '%-.192T' KEY %d के लिए" - hun "Duplikalt bejegyzes '%-.192T' a %d kulcs szerint" - ita "Valore duplicato '%-.192T' per la chiave %d" - jpn "'%-.192T' は索引 %d で重複しています。" - kor "중복된 입력 값 '%-.192T': key %d" - nor "Like verdier '%-.192T' for nøkkel %d" - norwegian-ny "Like verdiar '%-.192T' for nykkel %d" - pol "Powtórzone wystąpienie '%-.192T' dla klucza %d" - por "Entrada '%-.192T' duplicada para a chave %d" - rum "Cimpul '%-.192T' e duplicat pentru cheia %d" - rus "Дублирующаяся запись '%-.192T' по ключу %d" - serbian "Dupliran unos '%-.192T' za ključ '%d'" - slo "Opakovaný kľúč '%-.192T' (číslo kľúča %d)" - spa "Entrada duplicada '%-.192T' para la clave %d" - swe "Dublett '%-.192T' för nyckel %d" - ukr "Дублюючий запис '%-.192T' для ключа %d" + chi "重复条目'%-.192T'在索引%d" + cze "Zdvojený klíč '%-.192T' (číslo klíče %d)" + dan "Ens værdier '%-.192T' for indeks %d" + eng "Duplicate entry '%-.192T' for key %d" + est "Kattuv väärtus '%-.192T' võtmele %d" + fre "Duplicata du champ '%-.192T' pour la clef %d" + ger "Doppelter Eintrag '%-.192T' für Schlüssel %d" + greek "Διπλή εγγραφή '%-.192T' για το κλειδί %d" + hindi "सामान प्रवेश '%-.192T' KEY %d के लिए" + hun "Duplikalt bejegyzes '%-.192T' a %d kulcs szerint" + ita "Valore duplicato '%-.192T' per la chiave %d" + jpn "'%-.192T' は索引 %d で重複しています。" + kor "중복된 입력 값 '%-.192T': key %d" + nla "Dubbele ingang '%-.192T' voor zoeksleutel %d" + nor "Like verdier '%-.192T' for nøkkel %d" + norwegian-ny "Like verdiar '%-.192T' for nykkel %d" + pol "Powtórzone wystąpienie '%-.192T' dla klucza %d" + por "Entrada '%-.192T' duplicada para a chave %d" + rum "Cimpul '%-.192T' e duplicat pentru cheia %d" + rus "Дублирующаяся запись '%-.192T' по ключу %d" + serbian "Dupliran unos '%-.192T' za ključ '%d'" + slo "Opakovaný kľúč '%-.192T' (číslo kľúča %d)" + spa "Entrada duplicada '%-.192T' para la clave %d" + swe "Dublett '%-.192T' för nyckel %d" + ukr "Дублюючий запис '%-.192T' для ключа %d" ER_WRONG_FIELD_SPEC 42000 S1009 + chi "列的说明符不对 '%-.192s'" cze "Chybná specifikace sloupce '%-.192s'" dan "Forkert kolonnespecifikaton for felt '%-.192s'" - nla "Verkeerde kolom specificatie voor kolom '%-.192s'" eng "Incorrect column specifier for column '%-.192s'" est "Vigane tulba kirjeldus tulbale '%-.192s'" fre "Mauvais paramètre de champ pour le champ '%-.192s'" @@ -1510,6 +1568,7 @@ ER_WRONG_FIELD_SPEC 42000 S1009 ita "Specifica errata per la colonna '%-.192s'" jpn "列 '%-.192s' の定義が不正です。" kor "칼럼 '%-.192s'의 부정확한 칼럼 정의자" + nla "Verkeerde kolom specificatie voor kolom '%-.192s'" nor "Feil kolonne spesifikator for felt '%-.192s'" norwegian-ny "Feil kolonne spesifikator for kolonne '%-.192s'" pol "Błędna specyfikacja kolumny dla kolumny '%-.192s'" @@ -1522,9 +1581,9 @@ ER_WRONG_FIELD_SPEC 42000 S1009 swe "Felaktigt kolumntyp för kolumn '%-.192s'" ukr "Невірний специфікатор стовбця '%-.192s'" ER_PARSE_ERROR 42000 s1009 + chi "%s 附近'%-.80T'在第%d行" cze "%s blízko '%-.80T' na řádku %d" dan "%s nær '%-.80T' på linje %d" - nla "%s bij '%-.80T' in regel %d" eng "%s near '%-.80T' at line %d" est "%s '%-.80T' ligidal real %d" fre "%s près de '%-.80T' à la ligne %d" @@ -1535,6 +1594,7 @@ ER_PARSE_ERROR 42000 s1009 ita "%s vicino a '%-.80T' linea %d" jpn "%s : '%-.80T' 付近 %d 行目" kor "'%s' 에러 같습니다. ('%-.80T' 명령어 라인 %d)" + nla "%s bij '%-.80T' in regel %d" nor "%s nær '%-.80T' på linje %d" norwegian-ny "%s attmed '%-.80T' på line %d" pol "%s obok '%-.80T' w linii %d" @@ -1547,9 +1607,9 @@ ER_PARSE_ERROR 42000 s1009 swe "%s nära '%-.80T' på rad %d" ukr "%s біля '%-.80T' в строці %d" ER_EMPTY_QUERY 42000 + chi "查询为空" cze "Výsledek dotazu je prázdný" dan "Forespørgsel var tom" - nla "Query was leeg" eng "Query was empty" est "Tühi päring" fre "Query est vide" @@ -1560,6 +1620,7 @@ ER_EMPTY_QUERY 42000 ita "La query e` vuota" jpn "クエリが空です。" kor "쿼리결과가 없습니다." + nla "Query was leeg" nor "Forespørsel var tom" norwegian-ny "Førespurnad var tom" pol "Zapytanie było puste" @@ -1572,9 +1633,9 @@ ER_EMPTY_QUERY 42000 swe "Frågan var tom" ukr "Пустий запит" ER_NONUNIQ_TABLE 42000 S1009 + chi "表或别名不唯一:'%-.192s'" cze "Nejednoznačná tabulka/alias: '%-.192s'" dan "Tabellen/aliaset: '%-.192s' er ikke unikt" - nla "Niet unieke waarde tabel/alias: '%-.192s'" eng "Not unique table/alias: '%-.192s'" est "Ei ole unikaalne tabel/alias '%-.192s'" fre "Table/alias: '%-.192s' non unique" @@ -1585,6 +1646,7 @@ ER_NONUNIQ_TABLE 42000 S1009 ita "Tabella/alias non unico: '%-.192s'" jpn "表名/別名 '%-.192s' は一意ではありません。" kor "Unique 하지 않은 테이블/alias: '%-.192s'" + nla "Niet unieke waarde tabel/alias: '%-.192s'" nor "Ikke unikt tabell/alias: '%-.192s'" norwegian-ny "Ikkje unikt tabell/alias: '%-.192s'" pol "Tabela/alias nie s? unikalne: '%-.192s'" @@ -1597,9 +1659,9 @@ ER_NONUNIQ_TABLE 42000 S1009 swe "Icke unikt tabell/alias: '%-.192s'" ukr "Неунікальна таблиця/псевдонім: '%-.192s'" ER_INVALID_DEFAULT 42000 S1009 + chi "'%-.192s'的默认值无效" cze "Chybná defaultní hodnota pro '%-.192s'" dan "Ugyldig standardværdi for '%-.192s'" - nla "Foutieve standaard waarde voor '%-.192s'" eng "Invalid default value for '%-.192s'" est "Vigane vaikeväärtus '%-.192s' jaoks" fre "Valeur par défaut invalide pour '%-.192s'" @@ -1610,6 +1672,7 @@ ER_INVALID_DEFAULT 42000 S1009 ita "Valore di default non valido per '%-.192s'" jpn "'%-.192s' へのデフォルト値が無効です。" kor "'%-.192s'의 유효하지 못한 디폴트 값을 사용하셨습니다." + nla "Foutieve standaard waarde voor '%-.192s'" nor "Ugyldig standardverdi for '%-.192s'" norwegian-ny "Ugyldig standardverdi for '%-.192s'" pol "Niewła?ciwa warto?ć domy?lna dla '%-.192s'" @@ -1622,9 +1685,9 @@ ER_INVALID_DEFAULT 42000 S1009 swe "Ogiltigt DEFAULT värde för '%-.192s'" ukr "Невірне значення по замовчуванню для '%-.192s'" ER_MULTIPLE_PRI_KEY 42000 S1009 + chi "定义了多个主键" cze "Definováno více primárních klíčů" dan "Flere primærnøgler specificeret" - nla "Meerdere primaire zoeksleutels gedefinieerd" eng "Multiple primary key defined" est "Mitut primaarset võtit ei saa olla" fre "Plusieurs clefs primaires définies" @@ -1635,6 +1698,7 @@ ER_MULTIPLE_PRI_KEY 42000 S1009 ita "Definite piu` chiave primarie" jpn "PRIMARY KEY が複数定義されています。" kor "Multiple primary key가 정의되어 있슴" + nla "Meerdere primaire zoeksleutels gedefinieerd" nor "Fleire primærnøkle spesifisert" norwegian-ny "Fleire primærnyklar spesifisert" pol "Zdefiniowano wiele kluczy podstawowych" @@ -1647,19 +1711,20 @@ ER_MULTIPLE_PRI_KEY 42000 S1009 swe "Flera PRIMARY KEY använda" ukr "Первинного ключа визначено неодноразово" ER_TOO_MANY_KEYS 42000 S1009 + chi "定义的索引太多; 最多允许%d 个索引" cze "Zadáno příliš mnoho klíčů, je povoleno nejvíce %d klíčů" dan "For mange nøgler specificeret. Kun %d nøgler må bruges" - nla "Teveel zoeksleutels gedefinieerd. Maximaal zijn %d zoeksleutels toegestaan" eng "Too many keys specified; max %d keys allowed" est "Liiga palju võtmeid. Maksimaalselt võib olla %d võtit" fre "Trop de clefs sont définies. Maximum de %d clefs alloué" ger "Zu viele Schlüssel definiert. Maximal %d Schlüssel erlaubt" greek "Πάρα πολλά key ορίσθηκαν. Το πολύ %d επιτρέπονται" - hun "Tul sok kulcs. Maximum %d kulcs engedelyezett" hindi "बहुत सारी KEYS निर्दिष्ट हैं; अधिकतम %d KEYS की अनुमति है" + hun "Tul sok kulcs. Maximum %d kulcs engedelyezett" ita "Troppe chiavi. Sono ammesse max %d chiavi" jpn "索引の数が多すぎます。最大 %d 個までです。" kor "너무 많은 키가 정의되어 있습니다.. 최대 %d의 키가 가능함" + nla "Teveel zoeksleutels gedefinieerd. Maximaal zijn %d zoeksleutels toegestaan" nor "For mange nøkler spesifisert. Maks %d nøkler tillatt" norwegian-ny "For mange nykler spesifisert. Maks %d nyklar tillatt" pol "Okre?lono zbyt wiele kluczy. Dostępnych jest maksymalnie %d kluczy" @@ -1672,9 +1737,9 @@ ER_TOO_MANY_KEYS 42000 S1009 swe "För många nycklar använda. Man får ha högst %d nycklar" ukr "Забагато ключів зазначено. Дозволено не більше %d ключів" ER_TOO_MANY_KEY_PARTS 42000 S1009 + chi "指定的索引部分过多; 最多允许%d个部分" cze "Zadáno příliš mnoho část klíčů, je povoleno nejvíce %d částí" dan "For mange nøgledele specificeret. Kun %d dele må bruges" - nla "Teveel zoeksleutel onderdelen gespecificeerd. Maximaal %d onderdelen toegestaan" eng "Too many key parts specified; max %d parts allowed" est "Võti koosneb liiga paljudest osadest. Maksimaalselt võib olla %d osa" fre "Trop de parties specifiées dans la clef. Maximum de %d parties" @@ -1685,6 +1750,7 @@ ER_TOO_MANY_KEY_PARTS 42000 S1009 ita "Troppe parti di chiave specificate. Sono ammesse max %d parti" jpn "索引のキー列指定が多すぎます。最大 %d 個までです。" kor "너무 많은 키 부분(parts)들이 정의되어 있습니다.. 최대 %d 부분이 가능함" + nla "Teveel zoeksleutel onderdelen gespecificeerd. Maximaal %d onderdelen toegestaan" nor "For mange nøkkeldeler spesifisert. Maks %d deler tillatt" norwegian-ny "For mange nykkeldelar spesifisert. Maks %d delar tillatt" pol "Okre?lono zbyt wiele czę?ci klucza. Dostępnych jest maksymalnie %d czę?ci" @@ -1697,9 +1763,9 @@ ER_TOO_MANY_KEY_PARTS 42000 S1009 swe "För många nyckeldelar använda. Man får ha högst %d nyckeldelar" ukr "Забагато частин ключа зазначено. Дозволено не більше %d частин" ER_TOO_LONG_KEY 42000 S1009 + chi "指定索引太长; 最大索引长度是 %d字节" cze "Zadaný klíč byl příliš dlouhý, největší délka klíče je %d" dan "Specificeret nøgle var for lang. Maksimal nøglelængde er %d" - nla "Gespecificeerde zoeksleutel was te lang. De maximale lengte is %d" eng "Specified key was too long; max key length is %d bytes" est "Võti on liiga pikk. Maksimaalne võtmepikkus on %d" fre "La clé est trop longue. Longueur maximale: %d" @@ -1710,6 +1776,7 @@ ER_TOO_LONG_KEY 42000 S1009 ita "La chiave specificata e` troppo lunga. La max lunghezza della chiave e` %d" jpn "索引のキーが長すぎます。最大 %d バイトまでです。" kor "정의된 키가 너무 깁니다. 최대 키의 길이는 %d입니다." + nla "Gespecificeerde zoeksleutel was te lang. De maximale lengte is %d" nor "Spesifisert nøkkel var for lang. Maks nøkkellengde er is %d" norwegian-ny "Spesifisert nykkel var for lang. Maks nykkellengde er %d" pol "Zdefinowany klucz jest zbyt długi. Maksymaln? długo?ci? klucza jest %d" @@ -1722,9 +1789,9 @@ ER_TOO_LONG_KEY 42000 S1009 swe "För lång nyckel. Högsta tillåtna nyckellängd är %d" ukr "Зазначений ключ задовгий. Найбільша довжина ключа %d байтів" ER_KEY_COLUMN_DOES_NOT_EXIST 42000 S1009 + chi "索引列'%-.192s'不在表里" cze "Klíčový sloupec '%-.192s' v tabulce neexistuje" dan "Nøglefeltet '%-.192s' eksisterer ikke i tabellen" - nla "Zoeksleutel kolom '%-.192s' bestaat niet in tabel" eng "Key column '%-.192s' doesn't exist in table" est "Võtme tulp '%-.192s' puudub tabelis" fre "La clé '%-.192s' n'existe pas dans la table" @@ -1735,6 +1802,7 @@ ER_KEY_COLUMN_DOES_NOT_EXIST 42000 S1009 ita "La colonna chiave '%-.192s' non esiste nella tabella" jpn "キー列 '%-.192s' は表にありません。" kor "Key 칼럼 '%-.192s'는 테이블에 존재하지 않습니다." + nla "Zoeksleutel kolom '%-.192s' bestaat niet in tabel" nor "Nøkkel felt '%-.192s' eksiterer ikke i tabellen" norwegian-ny "Nykkel kolonne '%-.192s' eksiterar ikkje i tabellen" pol "Kolumna '%-.192s' zdefiniowana w kluczu nie istnieje w tabeli" @@ -1747,6 +1815,7 @@ ER_KEY_COLUMN_DOES_NOT_EXIST 42000 S1009 swe "Nyckelkolumn '%-.192s' finns inte" ukr "Ключовий стовбець '%-.192s' не існує у таблиці" ER_BLOB_USED_AS_KEY 42000 S1009 + chi "索引里不能含有BLOB列%`s表%s" eng "BLOB column %`s can't be used in key specification in the %s table" ger "BLOB-Feld %`s kann beim %s Tabellen nicht als Schlüssel verwendet werden" hindi "BLOB कॉलम %`s टेबल %s में KEY विनिर्देश में इस्तेमाल नहीं किया जा सकता" @@ -1754,9 +1823,9 @@ ER_BLOB_USED_AS_KEY 42000 S1009 spa "La columna BLOB %`s no se puede usar en la especificación de clave en la tabla %s" ukr "BLOB стовбець %`s не може бути використаний у визначенні ключа в %s таблиці" ER_TOO_BIG_FIELDLENGTH 42000 S1009 + chi "数据太长超过列容量 '%-.192s' (最长 = %lu); 用 BLOB 或 TEXT 替代" cze "Příliš velká délka sloupce '%-.192s' (nejvíce %lu). Použijte BLOB" dan "For stor feltlængde for kolonne '%-.192s' (maks = %lu). Brug BLOB i stedet" - nla "Te grote kolomlengte voor '%-.192s' (max = %lu). Maak hiervoor gebruik van het type BLOB" eng "Column length too big for column '%-.192s' (max = %lu); use BLOB or TEXT instead" est "Tulba '%-.192s' pikkus on liiga pikk (maksimaalne pikkus: %lu). Kasuta BLOB väljatüüpi" fre "Champ '%-.192s' trop long (max = %lu). Utilisez un BLOB" @@ -1767,6 +1836,7 @@ ER_TOO_BIG_FIELDLENGTH 42000 S1009 ita "La colonna '%-.192s' e` troppo grande (max=%lu). Utilizza un BLOB" jpn "列 '%-.192s' のサイズ定義が大きすぎます (最大 %lu まで)。代わりに BLOB または TEXT を使用してください。" kor "칼럼 '%-.192s'의 칼럼 길이가 너무 깁니다 (최대 = %lu). 대신에 BLOB를 사용하세요." + nla "Te grote kolomlengte voor '%-.192s' (max = %lu). Maak hiervoor gebruik van het type BLOB" nor "For stor nøkkellengde for kolonne '%-.192s' (maks = %lu). Bruk BLOB istedenfor" norwegian-ny "For stor nykkellengde for felt '%-.192s' (maks = %lu). Bruk BLOB istadenfor" pol "Zbyt duża długo?ć kolumny '%-.192s' (maks. = %lu). W zamian użyj typu BLOB" @@ -1779,9 +1849,9 @@ ER_TOO_BIG_FIELDLENGTH 42000 S1009 swe "För stor kolumnlängd angiven för '%-.192s' (max= %lu). Använd en BLOB instället" ukr "Задовга довжина стовбця '%-.192s' (max = %lu). Використайте тип BLOB" ER_WRONG_AUTO_KEY 42000 S1009 + chi "表定义不正确;只能有一个自动列,并且必须将其定义为索引" cze "Můžete mít pouze jedno AUTO pole a to musí být definováno jako klíč" dan "Der kan kun specificeres eet AUTO_INCREMENT-felt, og det skal være indekseret" - nla "Er kan slechts 1 autofield zijn en deze moet als zoeksleutel worden gedefinieerd" eng "Incorrect table definition; there can be only one auto column and it must be defined as a key" est "Vigane tabelikirjeldus; Tabelis tohib olla üks auto_increment tüüpi tulp ning see peab olema defineeritud võtmena" fre "Un seul champ automatique est permis et il doit être indexé" @@ -1792,6 +1862,7 @@ ER_WRONG_AUTO_KEY 42000 S1009 ita "Puo` esserci solo un campo AUTO e deve essere definito come chiave" jpn "不正な表定義です。AUTO_INCREMENT列は1個までで、索引を定義する必要があります。" kor "부정확한 테이블 정의; 테이블은 하나의 auto 칼럼이 존재하고 키로 정의되어져야 합니다." + nla "Er kan slechts 1 autofield zijn en deze moet als zoeksleutel worden gedefinieerd" nor "Bare ett auto felt kan være definert som nøkkel" norwegian-ny "Bare eitt auto felt kan være definert som nøkkel" pol "W tabeli może być tylko jedno pole auto i musi ono być zdefiniowane jako klucz" @@ -1804,13 +1875,14 @@ ER_WRONG_AUTO_KEY 42000 S1009 swe "Det får finnas endast ett AUTO_INCREMENT-fält och detta måste vara en nyckel" ukr "Хибне визначення таблиці; Може бути лише один автоматичний стовбець, що повинен бути визначений як ключ" ER_BINLOG_CANT_DELETE_GTID_DOMAIN - eng "Could not delete gtid domain. Reason: %s." - spa "No pude borrar el dominio gtid. Motivo: %s." + chi "无法删除gtid域. 原因: %s." + eng "Could not delete gtid domain. Reason: %s." + spa "No pude borrar el dominio gtid. Motivo: %s." ukr "Не можу видалити домен gtid. Причина: %s." ER_NORMAL_SHUTDOWN + chi "%s(%s):正常关闭" cze "%s (%s): normální ukončení" dan "%s (%s): Normal nedlukning" - nla "%s (%s): Normaal afgesloten " eng "%s (initiated by: %s): Normal shutdown" est "%s (%s): MariaDB lõpetas" fre "%s (%s): Arrêt normal du serveur" @@ -1821,6 +1893,7 @@ ER_NORMAL_SHUTDOWN ita "%s (%s): Shutdown normale" jpn "%s (%s): 通常シャットダウン" kor "%s (%s): 정상적인 shutdown" + nla "%s (%s): Normaal afgesloten " nor "%s (%s): Normal avslutning" norwegian-ny "%s (%s): Normal nedkopling" pol "%s (%s): Standardowe zakończenie działania" @@ -1833,9 +1906,9 @@ ER_NORMAL_SHUTDOWN swe "%s (%s): Normal avslutning" ukr "%s (%s): Нормальне завершення" ER_GOT_SIGNAL + chi "%s: 收到信号 %d. 强行中止!\n" cze "%s: přijat signal %d, končím\n" dan "%s: Fangede signal %d. Afslutter!!\n" - nla "%s: Signaal %d. Systeem breekt af!\n" eng "%s: Got signal %d. Aborting!\n" est "%s: sain signaali %d. Lõpetan!\n" fre "%s: Reçu le signal %d. Abandonne!\n" @@ -1846,6 +1919,7 @@ ER_GOT_SIGNAL ita "%s: Ricevuto segnale %d. Interruzione!\n" jpn "%s: シグナル %d を受信しました。強制終了します!\n" kor "%s: %d 신호가 들어왔음. 중지!\n" + nla "%s: Signaal %d. Systeem breekt af!\n" nor "%s: Oppdaget signal %d. Avslutter!\n" norwegian-ny "%s: Oppdaga signal %d. Avsluttar!\n" pol "%s: Otrzymano sygnał %d. Kończenie działania!\n" @@ -1858,9 +1932,9 @@ ER_GOT_SIGNAL swe "%s: Fick signal %d. Avslutar!\n" ukr "%s: Отримано сигнал %d. Перериваюсь!\n" ER_SHUTDOWN_COMPLETE + chi "%s:关闭完成\n" cze "%s: ukončení práce hotovo\n" dan "%s: Server lukket\n" - nla "%s: Afsluiten afgerond\n" eng "%s: Shutdown complete\n" est "%s: Lõpp\n" fre "%s: Arrêt du serveur terminé\n" @@ -1871,6 +1945,7 @@ ER_SHUTDOWN_COMPLETE ita "%s: Shutdown completato\n" jpn "%s: シャットダウン完了\n" kor "%s: Shutdown 이 완료됨!\n" + nla "%s: Afsluiten afgerond\n" nor "%s: Avslutning komplett\n" norwegian-ny "%s: Nedkopling komplett\n" pol "%s: Zakończenie działania wykonane\n" @@ -1883,9 +1958,9 @@ ER_SHUTDOWN_COMPLETE swe "%s: Avslutning klar\n" ukr "%s: Роботу завершено\n" ER_FORCING_CLOSE 08S01 + chi "%s: 强行关闭线程 %ld 用户: '%-.48s'\n" cze "%s: násilné uzavření threadu %ld uživatele '%-.48s'\n" dan "%s: Forceret nedlukning af tråd: %ld bruger: '%-.48s'\n" - nla "%s: Afsluiten afgedwongen van thread %ld gebruiker: '%-.48s'\n" eng "%s: Forcing close of thread %ld user: '%-.48s'\n" est "%s: Sulgen jõuga lõime %ld kasutaja: '%-.48s'\n" fre "%s: Arrêt forcé de la tâche (thread) %ld utilisateur: '%-.48s'\n" @@ -1896,6 +1971,7 @@ ER_FORCING_CLOSE 08S01 ita "%s: Forzata la chiusura del thread %ld utente: '%-.48s'\n" jpn "%s: スレッド %ld を強制終了します (ユーザー: '%-.48s')\n" kor "%s: thread %ld의 강제 종료 user: '%-.48s'\n" + nla "%s: Afsluiten afgedwongen van thread %ld gebruiker: '%-.48s'\n" nor "%s: Påtvinget avslutning av tråd %ld bruker: '%-.48s'\n" norwegian-ny "%s: Påtvinga avslutning av tråd %ld brukar: '%-.48s'\n" pol "%s: Wymuszenie zamknięcia w?tku %ld użytkownik: '%-.48s'\n" @@ -1908,9 +1984,9 @@ ER_FORCING_CLOSE 08S01 swe "%s: Stänger av tråd %ld; användare: '%-.48s'\n" ukr "%s: Прискорюю закриття гілки %ld користувача: '%-.48s'\n" ER_IPSOCK_ERROR 08S01 + chi "无法创建IP插口" cze "Nemohu vytvořit IP socket" dan "Kan ikke oprette IP socket" - nla "Kan IP-socket niet openen" eng "Can't create IP socket" est "Ei suuda luua IP socketit" fre "Ne peut créer la connexion IP (socket)" @@ -1921,6 +1997,7 @@ ER_IPSOCK_ERROR 08S01 ita "Impossibile creare il socket IP" jpn "IPソケットを作成できません。" kor "IP 소켓을 만들지 못했습니다." + nla "Kan IP-socket niet openen" nor "Kan ikke opprette IP socket" norwegian-ny "Kan ikkje opprette IP socket" pol "Nie można stworzyć socket'u IP" @@ -1933,9 +2010,9 @@ ER_IPSOCK_ERROR 08S01 swe "Kan inte skapa IP-socket" ukr "Не можу створити IP роз'єм" ER_NO_SUCH_INDEX 42S12 S1009 + chi "表 '%-.192s' 没有像 CREATE INDEX 中使用的索引;重新创建表" cze "Tabulka '%-.192s' nemá index odpovídající CREATE INDEX. Vytvořte tabulku znovu" dan "Tabellen '%-.192s' har ikke den nøgle, som blev brugt i CREATE INDEX. Genopret tabellen" - nla "Tabel '%-.192s' heeft geen INDEX zoals deze gemaakt worden met CREATE INDEX. Maak de tabel opnieuw" eng "Table '%-.192s' has no index like the one used in CREATE INDEX; recreate the table" est "Tabelil '%-.192s' puuduvad võtmed. Loo tabel uuesti" fre "La table '%-.192s' n'a pas d'index comme celle utilisée dans CREATE INDEX. Recréez la table" @@ -1946,6 +2023,7 @@ ER_NO_SUCH_INDEX 42S12 S1009 ita "La tabella '%-.192s' non ha nessun indice come quello specificatato dalla CREATE INDEX. Ricrea la tabella" jpn "表 '%-.192s' に以前CREATE INDEXで作成された索引がありません。表を作り直してください。" kor "테이블 '%-.192s'는 인덱스를 만들지 않았습니다. alter 테이블명령을 이용하여 테이블을 수정하세요..." + nla "Tabel '%-.192s' heeft geen INDEX zoals deze gemaakt worden met CREATE INDEX. Maak de tabel opnieuw" nor "Tabellen '%-.192s' har ingen index som den som er brukt i CREATE INDEX. Gjenopprett tabellen" norwegian-ny "Tabellen '%-.192s' har ingen index som den som er brukt i CREATE INDEX. Oprett tabellen på nytt" pol "Tabela '%-.192s' nie ma indeksu takiego jak w CREATE INDEX. Stwórz tabelę" @@ -1958,9 +2036,9 @@ ER_NO_SUCH_INDEX 42S12 S1009 swe "Tabellen '%-.192s' har inget index som motsvarar det angivna i CREATE INDEX. Skapa om tabellen" ukr "Таблиця '%-.192s' має індекс, що не співпадає з вказанним у CREATE INDEX. Створіть таблицю знову" ER_WRONG_FIELD_TERMINATORS 42000 S1009 + chi "字段分隔符参数不合预期;查看文档" cze "Argument separátoru položek nebyl očekáván. Přečtěte si manuál" dan "Felt adskiller er ikke som forventet, se dokumentationen" - nla "De argumenten om velden te scheiden zijn anders dan verwacht. Raadpleeg de handleiding" eng "Field separator argument is not what is expected; check the manual" est "Väljade eraldaja erineb oodatust. Tutvu kasutajajuhendiga" fre "Séparateur de champs inconnu. Vérifiez dans le manuel" @@ -1971,6 +2049,7 @@ ER_WRONG_FIELD_TERMINATORS 42000 S1009 ita "L'argomento 'Field separator' non e` quello atteso. Controlla il manuale" jpn "フィールド区切り文字が予期せぬ使われ方をしています。マニュアルを確認して下さい。" kor "필드 구분자 인수들이 완전하지 않습니다. 메뉴얼을 찾아 보세요." + nla "De argumenten om velden te scheiden zijn anders dan verwacht. Raadpleeg de handleiding" nor "Felt skiller argumentene er ikke som forventet, se dokumentasjonen" norwegian-ny "Felt skiljer argumenta er ikkje som venta, sjå dokumentasjonen" pol "Nie oczekiwano separatora. SprawdĽ podręcznik" @@ -1983,9 +2062,9 @@ ER_WRONG_FIELD_TERMINATORS 42000 S1009 swe "Fältseparatorerna är vad som förväntades. Kontrollera mot manualen" ukr "Хибний розділювач полів. Почитайте документацію" ER_BLOBS_AND_NO_TERMINATED 42000 S1009 + chi "您不能对 BLOB 使用固定的行长度;请使用 'fields terminated by'" cze "Není možné použít pevný rowlength s BLOBem. Použijte 'fields terminated by'" dan "Man kan ikke bruge faste feltlængder med BLOB. Brug i stedet 'fields terminated by'" - nla "Bij het gebruik van BLOBs is het niet mogelijk om vaste rijlengte te gebruiken. Maak s.v.p. gebruik van 'fields terminated by'" eng "You can't use fixed rowlength with BLOBs; please use 'fields terminated by'" est "BLOB-tüüpi väljade olemasolul ei saa kasutada fikseeritud väljapikkust. Vajalik 'fields terminated by' määrang" fre "Vous ne pouvez utiliser des lignes de longueur fixe avec des BLOBs. Utiliser 'fields terminated by'" @@ -1996,6 +2075,7 @@ ER_BLOBS_AND_NO_TERMINATED 42000 S1009 ita "Non possono essere usate righe a lunghezza fissa con i BLOB. Usa 'FIELDS TERMINATED BY'" jpn "BLOBには固定長レコードが使用できません。'FIELDS TERMINATED BY'句を使用して下さい。" kor "BLOB로는 고정길이의 lowlength를 사용할 수 없습니다. 'fields terminated by'를 사용하세요." + nla "Bij het gebruik van BLOBs is het niet mogelijk om vaste rijlengte te gebruiken. Maak s.v.p. gebruik van 'fields terminated by'" nor "En kan ikke bruke faste feltlengder med BLOB. Vennlisgt bruk 'fields terminated by'" norwegian-ny "Ein kan ikkje bruke faste feltlengder med BLOB. Vennlisgt bruk 'fields terminated by'" pol "Nie można użyć stałej długo?ci wiersza z polami typu BLOB. Użyj 'fields terminated by'" @@ -2008,9 +2088,9 @@ ER_BLOBS_AND_NO_TERMINATED 42000 S1009 swe "Man kan inte använda fast radlängd med blobs. Använd 'fields terminated by'" ukr "Не можна використовувати сталу довжину строки з BLOB. Зкористайтеся 'fields terminated by'" ER_TEXTFILE_NOT_READABLE + chi "文件'%-.128s'必须位于数据库目录中,或所有人都可以读取" cze "Soubor '%-.128s' musí být v adresáři databáze nebo čitelný pro všechny" dan "Filen '%-.128s' skal være i database-folderen, eller kunne læses af alle" - nla "Het bestand '%-.128s' dient in de database directory voor the komen of leesbaar voor iedereen te zijn" eng "The file '%-.128s' must be in the database directory or be readable by all" est "Fail '%-.128s' peab asuma andmebaasi kataloogis või olema kõigile loetav" fre "Le fichier '%-.128s' doit être dans le répertoire de la base et lisible par tous" @@ -2021,6 +2101,7 @@ ER_TEXTFILE_NOT_READABLE ita "Il file '%-.128s' deve essere nella directory del database e deve essere leggibile da tutti" jpn "ファイル '%-.128s' はデータベースディレクトリにあるか、全てのユーザーから読める必要があります。" kor "'%-.128s' 화일는 데이타베이스 디렉토리에 존재하거나 모두에게 읽기 가능하여야 합니다." + nla "Het bestand '%-.128s' dient in de database directory voor the komen of leesbaar voor iedereen te zijn" nor "Filen '%-.128s' må være i database-katalogen for å være lesbar for alle" norwegian-ny "Filen '%-.128s' må være i database-katalogen for å være lesbar for alle" pol "Plik '%-.128s' musi znajdować sie w katalogu bazy danych lub mieć prawa czytania przez wszystkich" @@ -2033,9 +2114,9 @@ ER_TEXTFILE_NOT_READABLE swe "Textfilen '%-.128s' måste finnas i databasbiblioteket eller vara läsbar för alla" ukr "Файл '%-.128s' повинен бути у теці бази данних або мати встановлене право на читання для усіх" ER_FILE_EXISTS_ERROR + chi "文件'%-.200s'已经存在" cze "Soubor '%-.200s' již existuje" dan "Filen '%-.200s' eksisterer allerede" - nla "Het bestand '%-.200s' bestaat reeds" eng "File '%-.200s' already exists" est "Fail '%-.200s' juba eksisteerib" fre "Le fichier '%-.200s' existe déjà" @@ -2046,6 +2127,7 @@ ER_FILE_EXISTS_ERROR ita "Il file '%-.200s' esiste gia`" jpn "ファイル '%-.200s' はすでに存在します。" kor "'%-.200s' 화일은 이미 존재합니다." + nla "Het bestand '%-.200s' bestaat reeds" nor "Filen '%-.200s' eksisterte allerede" norwegian-ny "Filen '%-.200s' eksisterte allereide" pol "Plik '%-.200s' już istnieje" @@ -2058,9 +2140,9 @@ ER_FILE_EXISTS_ERROR swe "Filen '%-.200s' existerar redan" ukr "Файл '%-.200s' вже існує" ER_LOAD_INFO + chi "记录:%ld删除:%ld跳过:%ld警告:%ld" cze "Záznamů: %ld Vymazáno: %ld Přeskočeno: %ld Varování: %ld" dan "Poster: %ld Fjernet: %ld Sprunget over: %ld Advarsler: %ld" - nla "Records: %ld Verwijderd: %ld Overgeslagen: %ld Waarschuwingen: %ld" eng "Records: %ld Deleted: %ld Skipped: %ld Warnings: %ld" est "Kirjeid: %ld Kustutatud: %ld Vahele jäetud: %ld Hoiatusi: %ld" fre "Enregistrements: %ld Effacés: %ld Non traités: %ld Avertissements: %ld" @@ -2071,6 +2153,7 @@ ER_LOAD_INFO ita "Records: %ld Cancellati: %ld Saltati: %ld Avvertimenti: %ld" jpn "レコード数: %ld 削除: %ld スキップ: %ld 警告: %ld" kor "레코드: %ld개 삭제: %ld개 스킵: %ld개 경고: %ld개" + nla "Records: %ld Verwijderd: %ld Overgeslagen: %ld Waarschuwingen: %ld" nor "Poster: %ld Fjernet: %ld Hoppet over: %ld Advarsler: %ld" norwegian-ny "Poster: %ld Fjerna: %ld Hoppa over: %ld Åtvaringar: %ld" pol "Recordów: %ld Usuniętych: %ld Pominiętych: %ld Ostrzeżeń: %ld" @@ -2083,9 +2166,9 @@ ER_LOAD_INFO swe "Rader: %ld Bortagna: %ld Dubletter: %ld Varningar: %ld" ukr "Записів: %ld Видалено: %ld Пропущено: %ld Застережень: %ld" ER_ALTER_INFO + chi "记录: %ld 重复: %ld" cze "Záznamů: %ld Zdvojených: %ld" dan "Poster: %ld Ens: %ld" - nla "Records: %ld Dubbel: %ld" eng "Records: %ld Duplicates: %ld" est "Kirjeid: %ld Kattuvaid: %ld" fre "Enregistrements: %ld Doublons: %ld" @@ -2096,6 +2179,7 @@ ER_ALTER_INFO ita "Records: %ld Duplicati: %ld" jpn "レコード数: %ld 重複: %ld" kor "레코드: %ld개 중복: %ld개" + nla "Records: %ld Dubbel: %ld" nor "Poster: %ld Like: %ld" norwegian-ny "Poster: %ld Like: %ld" pol "Rekordów: %ld Duplikatów: %ld" @@ -2108,9 +2192,9 @@ ER_ALTER_INFO swe "Rader: %ld Dubletter: %ld" ukr "Записів: %ld Дублікатів: %ld" ER_WRONG_SUB_KEY + chi "前缀索引不正确;使用的索引部分不是字符串,使用的长度比索引部分长,或者存储引擎不支持独特前缀索引" cze "Chybná podčást klíče -- není to řetězec nebo je delší než délka části klíče" dan "Forkert indeksdel. Den anvendte nøgledel er ikke en streng eller længden er større end nøglelængden" - nla "Foutief sub-gedeelte van de zoeksleutel. De gebruikte zoeksleutel is geen onderdeel van een string of of de gebruikte lengte is langer dan de zoeksleutel" eng "Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys" est "Vigane võtme osa. Kasutatud võtmeosa ei ole string tüüpi, määratud pikkus on pikem kui võtmeosa või tabelihandler ei toeta seda tüüpi võtmeid" fre "Mauvaise sous-clef. Ce n'est pas un 'string' ou la longueur dépasse celle définie dans la clef" @@ -2120,6 +2204,7 @@ ER_WRONG_SUB_KEY ita "Sotto-parte della chiave errata. La parte di chiave utilizzata non e` una stringa o la lunghezza e` maggiore della parte di chiave" jpn "キーのプレフィックスが不正です。キーが文字列ではないか、プレフィックス長がキーよりも長いか、ストレージエンジンが一意索引のプレフィックス指定をサポートしていません。" kor "부정확한 서버 파트 키. 사용된 키 파트가 스트링이 아니거나 키 파트의 길이가 너무 깁니다." + nla "Foutief sub-gedeelte van de zoeksleutel. De gebruikte zoeksleutel is geen onderdeel van een string of of de gebruikte lengte is langer dan de zoeksleutel" nor "Feil delnøkkel. Den brukte delnøkkelen er ikke en streng eller den oppgitte lengde er lengre enn nøkkel lengden" norwegian-ny "Feil delnykkel. Den brukte delnykkelen er ikkje ein streng eller den oppgitte lengda er lengre enn nykkellengden" pol "Błędna podczę?ć klucza. Użyta czę?ć klucza nie jest łańcuchem lub użyta długo?ć jest większa niż czę?ć klucza" @@ -2132,9 +2217,9 @@ ER_WRONG_SUB_KEY swe "Felaktig delnyckel. Nyckeldelen är inte en sträng eller den angivna längden är längre än kolumnlängden" ukr "Невірна частина ключа. Використана частина ключа не є строкою, задовга або вказівник таблиці не підтримує унікальних частин ключей" ER_CANT_REMOVE_ALL_FIELDS 42000 + chi "您不能使用 ALTER TABLE 删除所有列;改用 DROP TABLE" cze "Není možné vymazat všechny položky s ALTER TABLE. Použijte DROP TABLE" dan "Man kan ikke slette alle felter med ALTER TABLE. Brug DROP TABLE i stedet" - nla "Het is niet mogelijk alle velden te verwijderen met ALTER TABLE. Gebruik a.u.b. DROP TABLE hiervoor!" eng "You can't delete all columns with ALTER TABLE; use DROP TABLE instead" est "ALTER TABLE kasutades ei saa kustutada kõiki tulpasid. Kustuta tabel DROP TABLE abil" fre "Vous ne pouvez effacer tous les champs avec ALTER TABLE. Utilisez DROP TABLE" @@ -2145,6 +2230,7 @@ ER_CANT_REMOVE_ALL_FIELDS 42000 ita "Non si possono cancellare tutti i campi con una ALTER TABLE. Utilizzare DROP TABLE" jpn "ALTER TABLE では全ての列の削除はできません。DROP TABLE を使用してください。" kor "ALTER TABLE 명령으로는 모든 칼럼을 지울 수 없습니다. DROP TABLE 명령을 이용하세요." + nla "Het is niet mogelijk alle velden te verwijderen met ALTER TABLE. Gebruik a.u.b. DROP TABLE hiervoor!" nor "En kan ikke slette alle felt med ALTER TABLE. Bruk DROP TABLE isteden" norwegian-ny "Ein kan ikkje slette alle felt med ALTER TABLE. Bruk DROP TABLE istadenfor" pol "Nie można usun?ć wszystkich pól wykorzystuj?c ALTER TABLE. W zamian użyj DROP TABLE" @@ -2157,9 +2243,9 @@ ER_CANT_REMOVE_ALL_FIELDS 42000 swe "Man kan inte radera alla fält med ALTER TABLE. Använd DROP TABLE istället" ukr "Не можливо видалити всі стовбці за допомогою ALTER TABLE. Для цього скористайтеся DROP TABLE" ER_CANT_DROP_FIELD_OR_KEY 42000 + chi "不能 DROP %s %`-.192s; 检查它是否存在" cze "Nemohu zrušit (DROP %s) %`-.192s. Zkontrolujte, zda neexistují záznamy/klíče" dan "Kan ikke udføre DROP %s %`-.192s. Undersøg om feltet/nøglen eksisterer" - nla "DROP %s: Kan %`-.192s niet weggooien. Controleer of het veld of de zoeksleutel daadwerkelijk bestaat" eng "Can't DROP %s %`-.192s; check that it exists" est "Ei suuda kustutada (DROP %s) %`-.192s. Kontrolli kas tulp/võti eksisteerib" fre "Ne peut effacer (DROP %s) %`-.192s. Vérifiez s'il existe" @@ -2168,6 +2254,7 @@ ER_CANT_DROP_FIELD_OR_KEY 42000 hindi "%s %`-.192s को ड्रॉप नहीं कर सकते हैं; कृपया जाँच करें कि यह मौजूद है" hun "A DROP %s %`-.192s nem lehetseges. Ellenorizze, hogy a mezo/kulcs letezik-e" ita "Impossibile cancellare (DROP %s) %`-.192s. Controllare che il campo chiave esista" + nla "DROP %s: Kan %`-.192s niet weggooien. Controleer of het veld of de zoeksleutel daadwerkelijk bestaat" nor "Kan ikke DROP %s %`-.192s. Undersøk om felt/nøkkel eksisterer" norwegian-ny "Kan ikkje DROP %s %`-.192s. Undersøk om felt/nøkkel eksisterar" pol "Nie można wykonać operacji DROP %s %`-.192s. SprawdĽ, czy to pole/klucz istnieje" @@ -2180,9 +2267,9 @@ ER_CANT_DROP_FIELD_OR_KEY 42000 swe "Kan inte ta bort (DROP %s) %`-.192s. Kontrollera att begränsningen/fältet/nyckel finns" ukr "Не можу DROP %s %`-.192s. Перевірте, чи він існує" ER_INSERT_INFO + chi "记录: %ld 重复: %ld 警告: %ld" cze "Záznamů: %ld Zdvojených: %ld Varování: %ld" dan "Poster: %ld Ens: %ld Advarsler: %ld" - nla "Records: %ld Dubbel: %ld Waarschuwing: %ld" eng "Records: %ld Duplicates: %ld Warnings: %ld" est "Kirjeid: %ld Kattuvaid: %ld Hoiatusi: %ld" fre "Enregistrements: %ld Doublons: %ld Avertissements: %ld" @@ -2193,6 +2280,7 @@ ER_INSERT_INFO ita "Records: %ld Duplicati: %ld Avvertimenti: %ld" jpn "レコード数: %ld 重複数: %ld 警告: %ld" kor "레코드: %ld개 중복: %ld개 경고: %ld개" + nla "Records: %ld Dubbel: %ld Waarschuwing: %ld" nor "Poster: %ld Like: %ld Advarsler: %ld" norwegian-ny "Postar: %ld Like: %ld Åtvaringar: %ld" pol "Rekordów: %ld Duplikatów: %ld Ostrzeżeń: %ld" @@ -2205,13 +2293,14 @@ ER_INSERT_INFO swe "Rader: %ld Dubletter: %ld Varningar: %ld" ukr "Записів: %ld Дублікатів: %ld Застережень: %ld" ER_UPDATE_TABLE_USED + chi "表 '%-.192s' 被指定了两次, 即作为 '%s' 的目标,又作为数据的独立源" eng "Table '%-.192s' is specified twice, both as a target for '%s' and as a separate source for data" swe "Table '%-.192s' är använd två gånger. Både för '%s' och för att hämta data" ukr "Таблиця '%-.192s' вказується двічі, як цільова для '%s', так і як окреме джерело даних" ER_NO_SUCH_THREAD + chi "未知线程ID:%lu" cze "Neznámá identifikace threadu: %lu" dan "Ukendt tråd id: %lu" - nla "Onbekend thread id: %lu" eng "Unknown thread id: %lu" est "Tundmatu lõim: %lu" fre "Numéro de tâche inconnu: %lu" @@ -2222,6 +2311,7 @@ ER_NO_SUCH_THREAD ita "Thread id: %lu sconosciuto" jpn "不明なスレッドIDです: %lu" kor "알수 없는 쓰레드 id: %lu" + nla "Onbekend thread id: %lu" nor "Ukjent tråd id: %lu" norwegian-ny "Ukjent tråd id: %lu" pol "Nieznany identyfikator w?tku: %lu" @@ -2234,34 +2324,35 @@ ER_NO_SUCH_THREAD swe "Finns ingen tråd med id %lu" ukr "Невідомий ідентифікатор гілки: %lu" ER_KILL_DENIED_ERROR - cze "Nejste vlastníkem threadu %lu" - dan "Du er ikke ejer af tråden %lu" - nla "U bent geen bezitter van thread %lu" - eng "You are not owner of thread %lu" - est "Ei ole lõime %lu omanik" - fre "Vous n'êtes pas propriétaire de la tâche no: %lu" - ger "Sie sind nicht Eigentümer von Thread %lu" - greek "Δεν είσθε owner του thread %lu" - hindi "आप थ्रेड %lu के OWNER नहीं हैं" - hun "A %lu thread-nek mas a tulajdonosa" - ita "Utente non proprietario del thread %lu" - jpn "スレッド %lu のオーナーではありません。" - kor "쓰레드(Thread) %lu의 소유자가 아닙니다." - nor "Du er ikke eier av tråden %lu" - norwegian-ny "Du er ikkje eigar av tråd %lu" - pol "Nie jeste? wła?cicielem w?tku %lu" - por "Você não é proprietário da 'thread' %lu" - rum "Nu sinteti proprietarul threadului %lu" - rus "Вы не являетесь владельцем потока %lu" - serbian "Vi niste vlasnik thread-a %lu" - slo "Nie ste vlastníkom vlákna %lu" - spa "No eres el propietario del hilo (thread) %lu" - swe "Du är inte ägare till tråd %lu" - ukr "Ви не володар гілки %lu" + chi "你不是线程%lld的所有者" + cze "Nejste vlastníkem threadu %lld" + dan "Du er ikke ejer af tråden %lld" + eng "You are not owner of thread %lld" + est "Ei ole lõime %lld omanik" + fre "Vous n'êtes pas propriétaire de la tâche no: %lld" + ger "Sie sind nicht Eigentümer von Thread %lld" + greek "Δεν είσθε owner του thread %lld" + hindi "आप थ्रेड %lld के OWNER नहीं हैं" + hun "A %lld thread-nek mas a tulajdonosa" + ita "Utente non proprietario del thread %lld" + jpn "スレッド %lld のオーナーではありません。" + kor "쓰레드(Thread) %lld의 소유자가 아닙니다." + nla "U bent geen bezitter van thread %lld" + nor "Du er ikke eier av tråden %lld" + norwegian-ny "Du er ikkje eigar av tråd %lld" + pol "Nie jeste? wła?cicielem w?tku %lld" + por "Você não é proprietário da 'thread' %lld" + rum "Nu sinteti proprietarul threadului %lld" + rus "Вы не являетесь владельцем потока %lld" + serbian "Vi niste vlasnik thread-a %lld" + slo "Nie ste vlastníkom vlákna %lld" + spa "No eres el propietario del hilo (thread) %lld" + swe "Du är inte ägare till tråd %lld" + ukr "Ви не володар гілки %lld" ER_NO_TABLES_USED + chi "没有使用表" cze "Nejsou použity žádné tabulky" dan "Ingen tabeller i brug" - nla "Geen tabellen gebruikt" eng "No tables used" est "Ühtegi tabelit pole kasutusel" fre "Aucune table utilisée" @@ -2272,6 +2363,7 @@ ER_NO_TABLES_USED ita "Nessuna tabella usata" jpn "表が指定されていません。" kor "어떤 테이블도 사용되지 않았습니다." + nla "Geen tabellen gebruikt" nor "Ingen tabeller i bruk" norwegian-ny "Ingen tabellar i bruk" pol "Nie ma żadej użytej tabeli" @@ -2284,9 +2376,9 @@ ER_NO_TABLES_USED swe "Inga tabeller angivna" ukr "Не використано таблиць" ER_TOO_BIG_SET + chi "列 %-.192s 和SET的字符串过多" cze "Příliš mnoho řetězců pro sloupec %-.192s a SET" dan "For mange tekststrenge til specifikationen af SET i kolonne %-.192s" - nla "Teveel strings voor kolom %-.192s en SET" eng "Too many strings for column %-.192s and SET" est "Liiga palju string tulbale %-.192s tüübile SET" fre "Trop de chaînes dans la colonne %-.192s avec SET" @@ -2296,6 +2388,7 @@ ER_TOO_BIG_SET ita "Troppe stringhe per la colonna %-.192s e la SET" jpn "SET型の列 '%-.192s' のメンバーの数が多すぎます。" kor "칼럼 %-.192s와 SET에서 스트링이 너무 많습니다." + nla "Teveel strings voor kolom %-.192s en SET" nor "For mange tekststrenger kolonne %-.192s og SET" norwegian-ny "For mange tekststrengar felt %-.192s og SET" pol "Zbyt wiele łańcuchów dla kolumny %-.192s i polecenia SET" @@ -2308,9 +2401,9 @@ ER_TOO_BIG_SET swe "För många alternativ till kolumn %-.192s för SET" ukr "Забагато строк для стовбця %-.192s та SET" ER_NO_UNIQUE_LOGFILE + chi "无法生成唯一的log-filename%-.200s.(1-999)\ n" cze "Nemohu vytvořit jednoznačné jméno logovacího souboru %-.200s.(1-999)\n" dan "Kan ikke lave unikt log-filnavn %-.200s.(1-999)\n" - nla "Het is niet mogelijk een unieke naam te maken voor de logfile %-.200s.(1-999)\n" eng "Can't generate a unique log-filename %-.200s.(1-999)\n" est "Ei suuda luua unikaalset logifaili nime %-.200s.(1-999)\n" fre "Ne peut générer un unique nom de journal %-.200s.(1-999)\n" @@ -2321,6 +2414,7 @@ ER_NO_UNIQUE_LOGFILE ita "Impossibile generare un nome del file log unico %-.200s.(1-999)\n" jpn "一意なログファイル名 %-.200s.(1-999) を生成できません。\n" kor "Unique 로그화일 '%-.200s'를 만들수 없습니다.(1-999)\n" + nla "Het is niet mogelijk een unieke naam te maken voor de logfile %-.200s.(1-999)\n" nor "Kan ikke lage unikt loggfilnavn %-.200s.(1-999)\n" norwegian-ny "Kan ikkje lage unikt loggfilnavn %-.200s.(1-999)\n" pol "Nie można stworzyć unikalnej nazwy pliku z logiem %-.200s.(1-999)\n" @@ -2333,9 +2427,9 @@ ER_NO_UNIQUE_LOGFILE swe "Kan inte generera ett unikt filnamn %-.200s.(1-999)\n" ukr "Не можу згенерувати унікальне ім'я log-файлу %-.200s.(1-999)\n" ER_TABLE_NOT_LOCKED_FOR_WRITE + chi "表 '%-.192s' 有 READ 锁,无法更新" cze "Tabulka '%-.192s' byla zamčena s READ a nemůže být změněna" dan "Tabellen '%-.192s' var låst med READ lås og kan ikke opdateres" - nla "Tabel '%-.192s' was gelocked met een lock om te lezen. Derhalve kunnen geen wijzigingen worden opgeslagen" eng "Table '%-.192s' was locked with a READ lock and can't be updated" est "Tabel '%-.192s' on lukustatud READ lukuga ning ei ole muudetav" fre "Table '%-.192s' verrouillée lecture (READ): modification impossible" @@ -2346,6 +2440,7 @@ ER_TABLE_NOT_LOCKED_FOR_WRITE ita "La tabella '%-.192s' e` soggetta a lock in lettura e non puo` essere aggiornata" jpn "表 '%-.192s' はREADロックされていて、更新できません。" kor "테이블 '%-.192s'는 READ 락이 잠겨있어서 갱신할 수 없습니다." + nla "Tabel '%-.192s' was gelocked met een lock om te lezen. Derhalve kunnen geen wijzigingen worden opgeslagen" nor "Tabellen '%-.192s' var låst med READ lås og kan ikke oppdateres" norwegian-ny "Tabellen '%-.192s' var låst med READ lås og kan ikkje oppdaterast" pol "Tabela '%-.192s' została zablokowana przez READ i nie może zostać zaktualizowana" @@ -2358,9 +2453,9 @@ ER_TABLE_NOT_LOCKED_FOR_WRITE swe "Tabell '%-.192s' kan inte uppdateras emedan den är låst för läsning" ukr "Таблицю '%-.192s' заблоковано тільки для читання, тому її не можна оновити" ER_TABLE_NOT_LOCKED + chi "表 '%-.192s' 未使用 LOCK TABLES 锁定" cze "Tabulka '%-.192s' nebyla zamčena s LOCK TABLES" dan "Tabellen '%-.192s' var ikke låst med LOCK TABLES" - nla "Tabel '%-.192s' was niet gelocked met LOCK TABLES" eng "Table '%-.192s' was not locked with LOCK TABLES" est "Tabel '%-.192s' ei ole lukustatud käsuga LOCK TABLES" fre "Table '%-.192s' non verrouillée: utilisez LOCK TABLES" @@ -2371,6 +2466,7 @@ ER_TABLE_NOT_LOCKED ita "Non e` stato impostato il lock per la tabella '%-.192s' con LOCK TABLES" jpn "表 '%-.192s' は LOCK TABLES でロックされていません。" kor "테이블 '%-.192s'는 LOCK TABLES 명령으로 잠기지 않았습니다." + nla "Tabel '%-.192s' was niet gelocked met LOCK TABLES" nor "Tabellen '%-.192s' var ikke låst med LOCK TABLES" norwegian-ny "Tabellen '%-.192s' var ikkje låst med LOCK TABLES" pol "Tabela '%-.192s' nie została zablokowana poleceniem LOCK TABLES" @@ -2383,12 +2479,13 @@ ER_TABLE_NOT_LOCKED swe "Tabell '%-.192s' är inte låst med LOCK TABLES" ukr "Таблицю '%-.192s' не було блоковано з LOCK TABLES" ER_UNUSED_17 + chi "你永远不应该看到它" eng "You should never see it" spa "Nunca debería vd de ver esto" ER_WRONG_DB_NAME 42000 + chi "数据库名称不正确'%-.100T'" cze "Nepřípustné jméno databáze '%-.100T'" dan "Ugyldigt database navn '%-.100T'" - nla "Databasenaam '%-.100T' is niet getoegestaan" eng "Incorrect database name '%-.100T'" est "Vigane andmebaasi nimi '%-.100T'" fre "Nom de base de donnée illégal: '%-.100T'" @@ -2399,6 +2496,7 @@ ER_WRONG_DB_NAME 42000 ita "Nome database errato '%-.100T'" jpn "データベース名 '%-.100T' は不正です。" kor "'%-.100T' 데이타베이스의 이름이 부정확합니다." + nla "Databasenaam '%-.100T' is niet getoegestaan" nor "Ugyldig database navn '%-.100T'" norwegian-ny "Ugyldig database namn '%-.100T'" pol "Niedozwolona nazwa bazy danych '%-.100T'" @@ -2411,9 +2509,9 @@ ER_WRONG_DB_NAME 42000 swe "Felaktigt databasnamn '%-.100T'" ukr "Невірне ім'я бази данних '%-.100T'" ER_WRONG_TABLE_NAME 42000 + chi "表名不正确'%-.100s'" cze "Nepřípustné jméno tabulky '%-.100s'" dan "Ugyldigt tabel navn '%-.100s'" - nla "Niet toegestane tabelnaam '%-.100s'" eng "Incorrect table name '%-.100s'" est "Vigane tabeli nimi '%-.100s'" fre "Nom de table illégal: '%-.100s'" @@ -2424,6 +2522,7 @@ ER_WRONG_TABLE_NAME 42000 ita "Nome tabella errato '%-.100s'" jpn "表名 '%-.100s' は不正です。" kor "'%-.100s' 테이블 이름이 부정확합니다." + nla "Niet toegestane tabelnaam '%-.100s'" nor "Ugyldig tabell navn '%-.100s'" norwegian-ny "Ugyldig tabell namn '%-.100s'" pol "Niedozwolona nazwa tabeli '%-.100s'..." @@ -2436,19 +2535,20 @@ ER_WRONG_TABLE_NAME 42000 swe "Felaktigt tabellnamn '%-.100s'" ukr "Невірне ім'я таблиці '%-.100s'" ER_TOO_BIG_SELECT 42000 + chi "SELECT 将检查超过 MAX_JOIN_SIZE 行;检查您的 WHERE 并使用 SET SQL_BIG_SELECTS=1 或 SET MAX_JOIN_SIZE=# 如果 SELECT 没问题" cze "Zadaný SELECT by procházel příliš mnoho záznamů a trval velmi dlouho. Zkontrolujte tvar WHERE a je-li SELECT v pořádku, použijte SET SQL_BIG_SELECTS=1" dan "SELECT ville undersøge for mange poster og ville sandsynligvis tage meget lang tid. Undersøg WHERE delen og brug SET SQL_BIG_SELECTS=1 hvis udtrykket er korrekt" - nla "Het SELECT-statement zou te veel records analyseren en dus veel tijd in beslagnemen. Kijk het WHERE-gedeelte van de query na en kies SET SQL_BIG_SELECTS=1 als het stament in orde is" eng "The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay" est "SELECT lause peab läbi vaatama suure hulga kirjeid ja võtaks tõenäoliselt liiga kaua aega. Tasub kontrollida WHERE klauslit ja vajadusel kasutada käsku SET SQL_BIG_SELECTS=1" fre "SELECT va devoir examiner beaucoup d'enregistrements ce qui va prendre du temps. Vérifiez la clause WHERE et utilisez SET SQL_BIG_SELECTS=1 si SELECT se passe bien" ger "Die Ausführung des SELECT würde zu viele Datensätze untersuchen und wahrscheinlich sehr lange dauern. Bitte WHERE-Klausel überprüfen und gegebenenfalls SET SQL_BIG_SELECTS=1 oder SET MAX_JOIN_SIZE=# verwenden" greek "Το SELECT θα εξετάσει μεγάλο αριθμό εγγραφών και πιθανώς θα καθυστερήσει. Παρακαλώ εξετάστε τις παραμέτρους του WHERE και χρησιμοποιείστε SET SQL_BIG_SELECTS=1 αν το SELECT είναι σωστό" - hun "A SELECT tul sok rekordot fog megvizsgalni es nagyon sokaig fog tartani. Ellenorizze a WHERE-t es hasznalja a SET SQL_BIG_SELECTS=1 beallitast, ha a SELECT okay" hindi "SELECT कमांड MAX_JOIN_SIZE पंक्तियों से भी ज्यादा की जांच करेगा; कृपया WHERE क्लॉज़ को जाचें अथवा SET SQL_BIG_SELECTS=1 या SET MAX_JOIN_SIZE=# का इस्तेमाल करें" + hun "A SELECT tul sok rekordot fog megvizsgalni es nagyon sokaig fog tartani. Ellenorizze a WHERE-t es hasznalja a SET SQL_BIG_SELECTS=1 beallitast, ha a SELECT okay" ita "La SELECT dovrebbe esaminare troppi record e usare troppo tempo. Controllare la WHERE e usa SET SQL_BIG_SELECTS=1 se e` tutto a posto" jpn "SELECTがMAX_JOIN_SIZEを超える行数を処理しました。WHERE句を確認し、SELECT文に問題がなければ、 SET SQL_BIG_SELECTS=1 または SET MAX_JOIN_SIZE=# を使用して下さい。" kor "SELECT 명령에서 너무 많은 레코드를 찾기 때문에 많은 시간이 소요됩니다. 따라서 WHERE 문을 점검하거나, 만약 SELECT가 ok되면 SET SQL_BIG_SELECTS=1 옵션을 사용하세요." + nla "Het SELECT-statement zou te veel records analyseren en dus veel tijd in beslagnemen. Kijk het WHERE-gedeelte van de query na en kies SET SQL_BIG_SELECTS=1 als het stament in orde is" nor "SELECT ville undersøke for mange poster og ville sannsynligvis ta veldig lang tid. Undersøk WHERE klausulen og bruk SET SQL_BIG_SELECTS=1 om SELECTen er korrekt" norwegian-ny "SELECT ville undersøkje for mange postar og ville sannsynligvis ta veldig lang tid. Undersøk WHERE klausulen og bruk SET SQL_BIG_SELECTS=1 om SELECTen er korrekt" pol "Operacja SELECT będzie dotyczyła zbyt wielu rekordów i prawdopodobnie zajmie bardzo dużo czasu. SprawdĽ warunek WHERE i użyj SQL_OPTION BIG_SELECTS=1 je?li operacja SELECT jest poprawna" @@ -2461,9 +2561,9 @@ ER_TOO_BIG_SELECT 42000 swe "Den angivna frågan skulle läsa mer än MAX_JOIN_SIZE rader. Kontrollera din WHERE och använd SET SQL_BIG_SELECTS=1 eller SET MAX_JOIN_SIZE=# ifall du vill hantera stora joins" ukr "Запиту SELECT потрібно обробити багато записів, що, певне, займе дуже багато часу. Перевірте ваше WHERE та використовуйте SET SQL_BIG_SELECTS=1, якщо цей запит SELECT є вірним" ER_UNKNOWN_ERROR + chi "未知错误" cze "Neznámá chyba" dan "Ukendt fejl" - nla "Onbekende Fout" eng "Unknown error" est "Tundmatu viga" fre "Erreur inconnue" @@ -2474,6 +2574,7 @@ ER_UNKNOWN_ERROR ita "Errore sconosciuto" jpn "不明なエラー" kor "알수 없는 에러입니다." + nla "Onbekende Fout" nor "Ukjent feil" norwegian-ny "Ukjend feil" por "Erro desconhecido" @@ -2485,9 +2586,9 @@ ER_UNKNOWN_ERROR swe "Okänt fel" ukr "Невідома помилка" ER_UNKNOWN_PROCEDURE 42000 + chi "未知存储过程 '%-.192s'" cze "Neznámá procedura %-.192s" dan "Ukendt procedure %-.192s" - nla "Onbekende procedure %-.192s" eng "Unknown procedure '%-.192s'" est "Tundmatu protseduur '%-.192s'" fre "Procédure %-.192s inconnue" @@ -2498,6 +2599,7 @@ ER_UNKNOWN_PROCEDURE 42000 ita "Procedura '%-.192s' sconosciuta" jpn "'%-.192s' は不明なプロシージャです。" kor "알수 없는 수행문 : '%-.192s'" + nla "Onbekende procedure %-.192s" nor "Ukjent prosedyre %-.192s" norwegian-ny "Ukjend prosedyre %-.192s" pol "Unkown procedure %-.192s" @@ -2510,9 +2612,9 @@ ER_UNKNOWN_PROCEDURE 42000 swe "Okänd procedur: %-.192s" ukr "Невідома процедура '%-.192s'" ER_WRONG_PARAMCOUNT_TO_PROCEDURE 42000 + chi "存储过程 '%-.192s' 需要的参数和提供的参数不吻合" cze "Chybný počet parametrů procedury %-.192s" dan "Forkert antal parametre til proceduren %-.192s" - nla "Foutief aantal parameters doorgegeven aan procedure %-.192s" eng "Incorrect parameter count to procedure '%-.192s'" est "Vale parameetrite hulk protseduurile '%-.192s'" fre "Mauvais nombre de paramètres pour la procedure %-.192s" @@ -2523,6 +2625,7 @@ ER_WRONG_PARAMCOUNT_TO_PROCEDURE 42000 ita "Numero di parametri errato per la procedura '%-.192s'" jpn "プロシージャ '%-.192s' へのパラメータ数が不正です。" kor "'%-.192s' 수행문에 대한 부정확한 파라메터" + nla "Foutief aantal parameters doorgegeven aan procedure %-.192s" nor "Feil parameter antall til prosedyren %-.192s" norwegian-ny "Feil parameter tal til prosedyra %-.192s" pol "Incorrect parameter count to procedure %-.192s" @@ -2535,9 +2638,9 @@ ER_WRONG_PARAMCOUNT_TO_PROCEDURE 42000 swe "Felaktigt antal parametrar till procedur %-.192s" ukr "Хибна кількість параметрів процедури '%-.192s'" ER_WRONG_PARAMETERS_TO_PROCEDURE + chi "存储过程 '%-.192s' 的参数不对" cze "Chybné parametry procedury %-.192s" dan "Forkert(e) parametre til proceduren %-.192s" - nla "Foutieve parameters voor procedure %-.192s" eng "Incorrect parameters to procedure '%-.192s'" est "Vigased parameetrid protseduurile '%-.192s'" fre "Paramètre erroné pour la procedure %-.192s" @@ -2548,6 +2651,7 @@ ER_WRONG_PARAMETERS_TO_PROCEDURE ita "Parametri errati per la procedura '%-.192s'" jpn "プロシージャ '%-.192s' へのパラメータが不正です。" kor "'%-.192s' 수행문에 대한 부정확한 파라메터" + nla "Foutieve parameters voor procedure %-.192s" nor "Feil parametre til prosedyren %-.192s" norwegian-ny "Feil parameter til prosedyra %-.192s" pol "Incorrect parameters to procedure %-.192s" @@ -2560,9 +2664,9 @@ ER_WRONG_PARAMETERS_TO_PROCEDURE swe "Felaktiga parametrar till procedur %-.192s" ukr "Хибний параметер процедури '%-.192s'" ER_UNKNOWN_TABLE 42S02 + chi "未知表名 '%-.192s' 在 %-.32s" cze "Neznámá tabulka '%-.192s' v %-.32s" dan "Ukendt tabel '%-.192s' i %-.32s" - nla "Onbekende tabel '%-.192s' in %-.32s" eng "Unknown table '%-.192s' in %-.32s" est "Tundmatu tabel '%-.192s' %-.32s-s" fre "Table inconnue '%-.192s' dans %-.32s" @@ -2573,6 +2677,7 @@ ER_UNKNOWN_TABLE 42S02 ita "Tabella '%-.192s' sconosciuta in %-.32s" jpn "'%-.192s' は %-.32s では不明な表です。" kor "알수 없는 테이블 '%-.192s' (데이타베이스 %-.32s)" + nla "Onbekende tabel '%-.192s' in %-.32s" nor "Ukjent tabell '%-.192s' i %-.32s" norwegian-ny "Ukjend tabell '%-.192s' i %-.32s" pol "Unknown table '%-.192s' in %-.32s" @@ -2585,9 +2690,9 @@ ER_UNKNOWN_TABLE 42S02 swe "Okänd tabell '%-.192s' i '%-.32s'" ukr "Невідома таблиця '%-.192s' у %-.32s" ER_FIELD_SPECIFIED_TWICE 42000 + chi "列 '%-.192s' 被指定了两次" cze "Položka '%-.192s' je zadána dvakrát" dan "Feltet '%-.192s' er anvendt to gange" - nla "Veld '%-.192s' is dubbel gespecificeerd" eng "Column '%-.192s' specified twice" est "Tulp '%-.192s' on määratletud topelt" fre "Champ '%-.192s' spécifié deux fois" @@ -2598,6 +2703,7 @@ ER_FIELD_SPECIFIED_TWICE 42000 ita "Campo '%-.192s' specificato 2 volte" jpn "列 '%-.192s' は2回指定されています。" kor "칼럼 '%-.192s'는 두번 정의되어 있습니다." + nla "Veld '%-.192s' is dubbel gespecificeerd" nor "Feltet '%-.192s' er spesifisert to ganger" norwegian-ny "Feltet '%-.192s' er spesifisert to gangar" pol "Field '%-.192s' specified twice" @@ -2610,9 +2716,9 @@ ER_FIELD_SPECIFIED_TWICE 42000 swe "Fält '%-.192s' är redan använt" ukr "Стовбець '%-.192s' зазначено двічі" ER_INVALID_GROUP_FUNC_USE + chi "组函数使用无效" cze "Nesprávné použití funkce group" dan "Forkert brug af grupperings-funktion" - nla "Ongeldig gebruik van GROUP-functie" eng "Invalid use of group function" est "Vigane grupeerimisfunktsiooni kasutus" fre "Utilisation invalide de la clause GROUP" @@ -2623,6 +2729,7 @@ ER_INVALID_GROUP_FUNC_USE ita "Uso non valido di una funzione di raggruppamento" jpn "集計関数の使用方法が不正です。" kor "잘못된 그룹 함수를 사용하였습니다." + nla "Ongeldig gebruik van GROUP-functie" por "Uso inválido de função de agrupamento (GROUP)" rum "Folosire incorecta a functiei group" rus "Неправильное использование групповых функций" @@ -2632,9 +2739,9 @@ ER_INVALID_GROUP_FUNC_USE swe "Felaktig användning av SQL grupp function" ukr "Хибне використання функції групування" ER_UNSUPPORTED_EXTENSION 42000 + chi "表'%-.192s'使用此MariaDB版本不存在的扩展" cze "Tabulka '%-.192s' používá rozšíření, které v této verzi MariaDB není" dan "Tabellen '%-.192s' bruger et filtypenavn som ikke findes i denne MariaDB version" - nla "Tabel '%-.192s' gebruikt een extensie, die niet in deze MariaDB-versie voorkomt" eng "Table '%-.192s' uses an extension that doesn't exist in this MariaDB version" est "Tabel '%-.192s' kasutab laiendust, mis ei eksisteeri antud MariaDB versioonis" fre "Table '%-.192s' : utilise une extension invalide pour cette version de MariaDB" @@ -2643,8 +2750,9 @@ ER_UNSUPPORTED_EXTENSION 42000 hindi "टेबल '%-.192s' जिस इक्स्टेन्शन का उपयोग कर रहा है, वह इस MariaDB संस्करण में उपलब्ध नहीं है" hun "A(z) '%-.192s' tabla olyan bovitest hasznal, amely nem letezik ebben a MariaDB versioban" ita "La tabella '%-.192s' usa un'estensione che non esiste in questa versione di MariaDB" - jpn "表 '%-.192s' は、このMariaDBバージョンには無い機能を使用しています。" + jpn "表 '%-.192s' は、このMariaDBバージョンには無い機能を使用しています。" kor "테이블 '%-.192s'는 확장명령을 이용하지만 현재의 MariaDB 버젼에서는 존재하지 않습니다." + nla "Tabel '%-.192s' gebruikt een extensie, die niet in deze MariaDB-versie voorkomt" nor "Table '%-.192s' uses a extension that doesn't exist in this MariaDB version" norwegian-ny "Table '%-.192s' uses a extension that doesn't exist in this MariaDB version" pol "Table '%-.192s' uses a extension that doesn't exist in this MariaDB version" @@ -2657,9 +2765,9 @@ ER_UNSUPPORTED_EXTENSION 42000 swe "Tabell '%-.192s' har en extension som inte finns i denna version av MariaDB" ukr "Таблиця '%-.192s' використовує розширення, що не існує у цій версії MariaDB" ER_TABLE_MUST_HAVE_COLUMNS 42000 + chi "表必须至少有1列" cze "Tabulka musí mít alespoň jeden sloupec" dan "En tabel skal have mindst een kolonne" - nla "Een tabel moet minstens 1 kolom bevatten" eng "A table must have at least 1 column" est "Tabelis peab olema vähemalt üks tulp" fre "Une table doit comporter au moins une colonne" @@ -2670,6 +2778,7 @@ ER_TABLE_MUST_HAVE_COLUMNS 42000 ita "Una tabella deve avere almeno 1 colonna" jpn "表には最低でも1個の列が必要です。" kor "하나의 테이블에서는 적어도 하나의 칼럼이 존재하여야 합니다." + nla "Een tabel moet minstens 1 kolom bevatten" por "Uma tabela tem que ter pelo menos uma (1) coluna" rum "O tabela trebuie sa aiba cel putin o coloana" rus "В таблице должен быть как минимум один столбец" @@ -2679,9 +2788,9 @@ ER_TABLE_MUST_HAVE_COLUMNS 42000 swe "Tabeller måste ha minst 1 kolumn" ukr "Таблиця повинна мати хочаб один стовбець" ER_RECORD_FILE_FULL + chi "表'%-.192s'已满" cze "Tabulka '%-.192s' je plná" dan "Tabellen '%-.192s' er fuld" - nla "De tabel '%-.192s' is vol" eng "The table '%-.192s' is full" est "Tabel '%-.192s' on täis" fre "La table '%-.192s' est pleine" @@ -2692,6 +2801,7 @@ ER_RECORD_FILE_FULL ita "La tabella '%-.192s' e` piena" jpn "表 '%-.192s' は満杯です。" kor "테이블 '%-.192s'가 full났습니다. " + nla "De tabel '%-.192s' is vol" por "Tabela '%-.192s' está cheia" rum "Tabela '%-.192s' e plina" rus "Таблица '%-.192s' переполнена" @@ -2701,9 +2811,9 @@ ER_RECORD_FILE_FULL swe "Tabellen '%-.192s' är full" ukr "Таблиця '%-.192s' заповнена" ER_UNKNOWN_CHARACTER_SET 42000 + chi "未知字符集:'%-.64s'" cze "Neznámá znaková sada: '%-.64s'" dan "Ukendt tegnsæt: '%-.64s'" - nla "Onbekende character set: '%-.64s'" eng "Unknown character set: '%-.64s'" est "Vigane kooditabel '%-.64s'" fre "Jeu de caractères inconnu: '%-.64s'" @@ -2714,6 +2824,7 @@ ER_UNKNOWN_CHARACTER_SET 42000 ita "Set di caratteri '%-.64s' sconosciuto" jpn "不明な文字コードセット: '%-.64s'" kor "알수없는 언어 Set: '%-.64s'" + nla "Onbekende character set: '%-.64s'" por "Conjunto de caracteres '%-.64s' desconhecido" rum "Set de caractere invalid: '%-.64s'" rus "Неизвестная кодировка '%-.64s'" @@ -2723,9 +2834,9 @@ ER_UNKNOWN_CHARACTER_SET 42000 swe "Okänd teckenuppsättning: '%-.64s'" ukr "Невідома кодова таблиця: '%-.64s'" ER_TOO_MANY_TABLES + chi "表太多; MariaDB 只能在join中使用 %d 个表" cze "Příliš mnoho tabulek, MariaDB jich může mít v joinu jen %d" dan "For mange tabeller. MariaDB kan kun bruge %d tabeller i et join" - nla "Teveel tabellen. MariaDB kan slechts %d tabellen in een join bevatten" eng "Too many tables; MariaDB can only use %d tables in a join" est "Liiga palju tabeleid. MariaDB suudab JOINiga ühendada kuni %d tabelit" fre "Trop de tables. MariaDB ne peut utiliser que %d tables dans un JOIN" @@ -2736,6 +2847,7 @@ ER_TOO_MANY_TABLES ita "Troppe tabelle. MariaDB puo` usare solo %d tabelle in una join" jpn "表が多すぎます。MariaDBがJOINできる表は %d 個までです。" kor "너무 많은 테이블이 Join되었습니다. MariaDB에서는 JOIN시 %d개의 테이블만 사용할 수 있습니다." + nla "Teveel tabellen. MariaDB kan slechts %d tabellen in een join bevatten" por "Tabelas demais. O MariaDB pode usar somente %d tabelas em uma junção (JOIN)" rum "Prea multe tabele. MariaDB nu poate folosi mai mult de %d tabele intr-un join" rus "Слишком много таблиц. MariaDB может использовать только %d таблиц в соединении" @@ -2745,9 +2857,9 @@ ER_TOO_MANY_TABLES swe "För många tabeller. MariaDB can ha högst %d tabeller i en och samma join" ukr "Забагато таблиць. MariaDB може використовувати лише %d таблиць у об'єднанні" ER_TOO_MANY_FIELDS + chi "太多列" cze "Příliš mnoho položek" dan "For mange felter" - nla "Te veel velden" eng "Too many columns" est "Liiga palju tulpasid" fre "Trop de champs" @@ -2758,6 +2870,7 @@ ER_TOO_MANY_FIELDS ita "Troppi campi" jpn "列が多すぎます。" kor "칼럼이 너무 많습니다." + nla "Te veel velden" por "Colunas demais" rum "Prea multe coloane" rus "Слишком много столбцов" @@ -2767,9 +2880,9 @@ ER_TOO_MANY_FIELDS swe "För många fält" ukr "Забагато стовбців" ER_TOO_BIG_ROWSIZE 42000 + chi "行尺寸太大. 不包括BLOB,表的最大的行大小是 %ld. 这包括存储开销,请查看文档。您必须将某些列更改为 TEXT 或 BLOB" cze "Řádek je příliš velký. Maximální velikost řádku, nepočítaje položky blob, je %ld. Musíte změnit některé položky na blob" dan "For store poster. Max post størrelse, uden BLOB's, er %ld. Du må lave nogle felter til BLOB's" - nla "Rij-grootte is groter dan toegestaan. Maximale rij grootte, blobs niet meegeteld, is %ld. U dient sommige velden in blobs te veranderen" eng "Row size too large. The maximum row size for the used table type, not counting BLOBs, is %ld. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs" est "Liiga pikk kirje. Kirje maksimumpikkus arvestamata BLOB-tüüpi välju on %ld. Muuda mõned väljad BLOB-tüüpi väljadeks" fre "Ligne trop grande. Le taille maximale d'une ligne, sauf les BLOBs, est %ld. Changez le type de quelques colonnes en BLOB" @@ -2779,6 +2892,7 @@ ER_TOO_BIG_ROWSIZE 42000 ita "Riga troppo grande. La massima grandezza di una riga, non contando i BLOB, e` %ld. Devi cambiare alcuni campi in BLOB" jpn "行サイズが大きすぎます。この表の最大行サイズは BLOB を含まずに %ld です。格納時のオーバーヘッドも含まれます(マニュアルを確認してください)。列をTEXTまたはBLOBに変更する必要があります。" kor "너무 큰 row 사이즈입니다. BLOB를 계산하지 않고 최대 row 사이즈는 %ld입니다. 일부열을 BLOB 또는 TEXT로 변경해야 합니다." + nla "Rij-grootte is groter dan toegestaan. Maximale rij grootte, blobs niet meegeteld, is %ld. U dient sommige velden in blobs te veranderen" por "Tamanho de linha grande demais. O máximo tamanho de linha, não contando BLOBs, é %ld. Você tem que mudar alguns campos para BLOBs" rum "Marimea liniei (row) prea mare. Marimea maxima a liniei, excluzind BLOB-urile este de %ld. Trebuie sa schimbati unele cimpuri in BLOB-uri" rus "Слишком большой размер записи. Максимальный размер строки, исключая поля BLOB, - %ld. Возможно, вам следует изменить тип некоторых полей на BLOB" @@ -2788,17 +2902,18 @@ ER_TOO_BIG_ROWSIZE 42000 swe "För stor total radlängd. Den högst tillåtna radlängden, förutom BLOBs, är %ld. Ändra några av dina fält till BLOB" ukr "Задовга строка. Найбільшою довжиною строки, не рахуючи BLOB, є %ld. Вам потрібно привести деякі стовбці до типу BLOB" ER_STACK_OVERRUN + chi "线程栈溢出: 已使用了: %ld 堆栈 %ld. 使用 'mariadbd --thread_stack=#' 指定更大的堆栈" cze "Přetečení zásobníku threadu: použito %ld z %ld. Použijte 'mariadbd --thread_stack=#' k zadání většího zásobníku" dan "Thread stack brugt: Brugt: %ld af en %ld stak. Brug 'mariadbd --thread_stack=#' for at allokere en større stak om nødvendigt" - nla "Thread stapel overrun: Gebruikte: %ld van een %ld stack. Gebruik 'mariadbd --thread_stack=#' om een grotere stapel te definieren (indien noodzakelijk)" - eng "Thread stack overrun: Used: %ld of a %ld stack. Consider increasing the thread_stack system variable" + eng "Thread stack overrun: Used: %ld of a %ld stack. Use 'mariadbd --thread_stack=#' to specify a bigger stack if needed" fre "Débordement de la pile des tâches (Thread stack). Utilisées: %ld pour une pile de %ld. Essayez 'mariadbd --thread_stack=#' pour indiquer une plus grande valeur" ger "Thread-Stack-Überlauf. Benutzt: %ld von %ld Stack. 'mariadbd --thread_stack=#' verwenden, um bei Bedarf einen größeren Stack anzulegen" greek "Stack overrun στο thread: Used: %ld of a %ld stack. Παρακαλώ χρησιμοποιείστε 'mariadbd --thread_stack=#' για να ορίσετε ένα μεγαλύτερο stack αν χρειάζεται" hun "Thread verem tullepes: Used: %ld of a %ld stack. Hasznalja a 'mariadbd --thread_stack=#' nagyobb verem definialasahoz" - ita "Thread stack overrun: Usati: %ld di uno stack di %ld. Usa 'maridbd --thread_stack=#' per specificare uno stack piu` grande" + ita "Thread stack overrun: Usati: %ld di uno stack di %ld. Usa 'mariadbd --thread_stack=#' per specificare uno stack piu` grande" jpn "スレッドスタック不足です(使用: %ld ; サイズ: %ld)。必要に応じて、より大きい値で 'mariadbd --thread_stack=#' の指定をしてください。" kor "쓰레드 스택이 넘쳤습니다. 사용: %ld개 스택: %ld개. 만약 필요시 더큰 스택을 원할때에는 'mariadbd --thread_stack=#' 를 정의하세요" + nla "Thread stapel overrun: Gebruikte: %ld van een %ld stack. Gebruik 'mariadbd --thread_stack=#' om een grotere stapel te definieren (indien noodzakelijk)" por "Estouro da pilha do 'thread'. Usados %ld de uma pilha de %ld. Use 'mariadbd --thread_stack=#' para especificar uma pilha maior, se necessário" rum "Stack-ul thread-ului a fost depasit (prea mic): Folositi: %ld intr-un stack de %ld. Folositi 'mariadbd --thread_stack=#' ca sa specifici un stack mai mare" rus "Стек потоков переполнен: использовано: %ld из %ld стека. Применяйте 'mariadbd --thread_stack=#' для указания большего размера стека, если необходимо" @@ -2808,9 +2923,9 @@ ER_STACK_OVERRUN swe "Trådstacken tog slut: Har använt %ld av %ld bytes. Använd 'mariadbd --thread_stack=#' ifall du behöver en större stack" ukr "Стек гілок переповнено: Використано: %ld з %ld. Використовуйте 'mariadbd --thread_stack=#' аби зазначити більший стек, якщо необхідно" ER_WRONG_OUTER_JOIN 42000 + chi "在 OUTER JOIN 中发现交叉依赖;检查您的 ON 条件" cze "V OUTER JOIN byl nalezen křížový odkaz. Prověřte ON podmínky" dan "Krydsreferencer fundet i OUTER JOIN; check dine ON conditions" - nla "Gekruiste afhankelijkheid gevonden in OUTER JOIN. Controleer uw ON-conditions" eng "Cross dependency found in OUTER JOIN; examine your ON conditions" est "Ristsõltuvus OUTER JOIN klauslis. Kontrolli oma ON tingimusi" fre "Dépendance croisée dans une clause OUTER JOIN. Vérifiez la condition ON" @@ -2819,6 +2934,7 @@ ER_WRONG_OUTER_JOIN 42000 hun "Keresztfuggoseg van az OUTER JOIN-ban. Ellenorizze az ON felteteleket" ita "Trovata una dipendenza incrociata nella OUTER JOIN. Controlla le condizioni ON" jpn "OUTER JOINに相互依存が見つかりました。ON句の条件を確認して下さい。" + nla "Gekruiste afhankelijkheid gevonden in OUTER JOIN. Controleer uw ON-conditions" por "Dependência cruzada encontrada em junção externa (OUTER JOIN); examine as condições utilizadas nas cláusulas 'ON'" rum "Dependinta incrucisata (cross dependency) gasita in OUTER JOIN. Examinati conditiile ON" rus "В OUTER JOIN обнаружена перекрестная зависимость. Внимательно проанализируйте свои условия ON" @@ -2828,14 +2944,15 @@ ER_WRONG_OUTER_JOIN 42000 swe "Felaktigt referens i OUTER JOIN. Kontrollera ON-uttrycket" ukr "Перехресна залежність у OUTER JOIN. Перевірте умову ON" ER_NULL_COLUMN_IN_INDEX 42000 + chi "表处理程序不支持给定索引中的 NULL. 请将列 '%-.192s' 改为 NOT NULL 或使用其他处理程序" eng "Table handler doesn't support NULL in given index. Please change column '%-.192s' to be NOT NULL or use another handler" spa "El manejador de tabla no soporta NULL en índice suministrado. Por favor, cambie la columna '%-.192s' para que sea NOT NULL o utilice otro manejador" swe "Tabell hanteraren kan inte indexera NULL kolumner för den givna index typen. Ändra '%-.192s' till NOT NULL eller använd en annan hanterare" ukr "Вказівник таблиці не підтримує NULL у зазначенному індексі. Будь ласка, зменіть стовпчик '%-.192s' на NOT NULL або використайте інший вказівник таблиці." ER_CANT_FIND_UDF + chi "无法加载函数'%-.192s'" cze "Nemohu načíst funkci '%-.192s'" dan "Kan ikke læse funktionen '%-.192s'" - nla "Kan functie '%-.192s' niet laden" eng "Can't load function '%-.192s'" est "Ei suuda avada funktsiooni '%-.192s'" fre "Imposible de charger la fonction '%-.192s'" @@ -2846,6 +2963,7 @@ ER_CANT_FIND_UDF ita "Impossibile caricare la funzione '%-.192s'" jpn "関数 '%-.192s' をロードできません。" kor "'%-.192s' 함수를 로드하지 못했습니다." + nla "Kan functie '%-.192s' niet laden" por "Não pode carregar a função '%-.192s'" rum "Nu pot incarca functia '%-.192s'" rus "Невозможно загрузить функцию '%-.192s'" @@ -2855,9 +2973,9 @@ ER_CANT_FIND_UDF swe "Kan inte ladda funktionen '%-.192s'" ukr "Не можу завантажити функцію '%-.192s'" ER_CANT_INITIALIZE_UDF + chi "无法初始化函数 '%-.192s'; %-.80s" cze "Nemohu inicializovat funkci '%-.192s'; %-.80s" dan "Kan ikke starte funktionen '%-.192s'; %-.80s" - nla "Kan functie '%-.192s' niet initialiseren; %-.80s" eng "Can't initialize function '%-.192s'; %-.80s" est "Ei suuda algväärtustada funktsiooni '%-.192s'; %-.80s" fre "Impossible d'initialiser la fonction '%-.192s'; %-.80s" @@ -2868,6 +2986,7 @@ ER_CANT_INITIALIZE_UDF ita "Impossibile inizializzare la funzione '%-.192s'; %-.80s" jpn "関数 '%-.192s' を初期化できません。; %-.80s" kor "'%-.192s' 함수를 초기화 하지 못했습니다.; %-.80s" + nla "Kan functie '%-.192s' niet initialiseren; %-.80s" por "Não pode inicializar a função '%-.192s' - '%-.80s'" rum "Nu pot initializa functia '%-.192s'; %-.80s" rus "Невозможно инициализировать функцию '%-.192s'; %-.80s" @@ -2877,9 +2996,9 @@ ER_CANT_INITIALIZE_UDF swe "Kan inte initialisera funktionen '%-.192s'; '%-.80s'" ukr "Не можу ініціалізувати функцію '%-.192s'; %-.80s" ER_UDF_NO_PATHS + chi "共享库不允许使用路径" cze "Pro sdílenou knihovnu nejsou povoleny cesty" dan "Angivelse af sti ikke tilladt for delt bibliotek" - nla "Geen pad toegestaan voor shared library" eng "No paths allowed for shared library" est "Teegi nimes ei tohi olla kataloogi" fre "Chemin interdit pour les bibliothèques partagées" @@ -2889,6 +3008,7 @@ ER_UDF_NO_PATHS ita "Non sono ammessi path per le librerie condivisa" jpn "共有ライブラリにはパスを指定できません。" kor "공유 라이버러리를 위한 패스가 정의되어 있지 않습니다." + nla "Geen pad toegestaan voor shared library" por "Não há caminhos (paths) permitidos para biblioteca compartilhada" rum "Nici un paths nu e permis pentru o librarie shared" rus "Недопустимо указывать пути для динамических библиотек" @@ -2898,9 +3018,9 @@ ER_UDF_NO_PATHS swe "Man får inte ange sökväg för dynamiska bibliotek" ukr "Не дозволено використовувати путі для розділюваних бібліотек" ER_UDF_EXISTS + chi "函数 '%-.192s' 已经存在" cze "Funkce '%-.192s' již existuje" dan "Funktionen '%-.192s' findes allerede" - nla "Functie '%-.192s' bestaat reeds" eng "Function '%-.192s' already exists" est "Funktsioon '%-.192s' juba eksisteerib" fre "La fonction '%-.192s' existe déjà" @@ -2911,6 +3031,7 @@ ER_UDF_EXISTS ita "La funzione '%-.192s' esiste gia`" jpn "関数 '%-.192s' はすでに定義されています。" kor "'%-.192s' 함수는 이미 존재합니다." + nla "Functie '%-.192s' bestaat reeds" por "Função '%-.192s' já existe" rum "Functia '%-.192s' exista deja" rus "Функция '%-.192s' уже существует" @@ -2920,9 +3041,9 @@ ER_UDF_EXISTS swe "Funktionen '%-.192s' finns redan" ukr "Функція '%-.192s' вже існує" ER_CANT_OPEN_LIBRARY + chi "不能打开共享库 '%-.192s' (错误号码: %d, %-.128s)" cze "Nemohu otevřít sdílenou knihovnu '%-.192s' (errno: %d, %-.128s)" dan "Kan ikke åbne delt bibliotek '%-.192s' (errno: %d, %-.128s)" - nla "Kan shared library '%-.192s' niet openen (Errcode: %d, %-.128s)" eng "Can't open shared library '%-.192s' (errno: %d, %-.128s)" est "Ei suuda avada jagatud teeki '%-.192s' (veakood: %d, %-.128s)" fre "Impossible d'ouvrir la bibliothèque partagée '%-.192s' (errno: %d, %-.128s)" @@ -2932,6 +3053,7 @@ ER_CANT_OPEN_LIBRARY ita "Impossibile aprire la libreria condivisa '%-.192s' (errno: %d, %-.128s)" jpn "共有ライブラリ '%-.192s' を開く事ができません。(エラー番号: %d, %-.128s)" kor "'%-.192s' 공유 라이버러리를 열수 없습니다.(에러번호: %d, %-.128s)" + nla "Kan shared library '%-.192s' niet openen (Errcode: %d, %-.128s)" nor "Can't open shared library '%-.192s' (errno: %d, %-.128s)" norwegian-ny "Can't open shared library '%-.192s' (errno: %d, %-.128s)" pol "Can't open shared library '%-.192s' (errno: %d, %-.128s)" @@ -2944,9 +3066,9 @@ ER_CANT_OPEN_LIBRARY swe "Kan inte öppna det dynamiska biblioteket '%-.192s' (Felkod: %d, %-.128s)" ukr "Не можу відкрити розділювану бібліотеку '%-.192s' (помилка: %d, %-.128s)" ER_CANT_FIND_DL_ENTRY + chi "在库中找不到符号 '%-.128s'" cze "Nemohu najít funkci '%-.128s' v knihovně" dan "Kan ikke finde funktionen '%-.128s' i bibliotek" - nla "Kan functie '%-.128s' niet in library vinden" eng "Can't find symbol '%-.128s' in library" est "Ei leia funktsiooni '%-.128s' antud teegis" fre "Impossible de trouver la fonction '%-.128s' dans la bibliothèque" @@ -2956,6 +3078,7 @@ ER_CANT_FIND_DL_ENTRY ita "Impossibile trovare la funzione '%-.128s' nella libreria" jpn "関数 '%-.128s' は共有ライブラリー中にありません。" kor "라이버러리에서 '%-.128s' 함수를 찾을 수 없습니다." + nla "Kan functie '%-.128s' niet in library vinden" por "Não pode encontrar a função '%-.128s' na biblioteca" rum "Nu pot gasi functia '%-.128s' in libraria" rus "Невозможно отыскать символ '%-.128s' в библиотеке" @@ -2965,9 +3088,9 @@ ER_CANT_FIND_DL_ENTRY swe "Hittar inte funktionen '%-.128s' in det dynamiska biblioteket" ukr "Не можу знайти функцію '%-.128s' у бібліотеці" ER_FUNCTION_NOT_DEFINED + chi "未定义函数 '%-.192s'" cze "Funkce '%-.192s' není definována" dan "Funktionen '%-.192s' er ikke defineret" - nla "Functie '%-.192s' is niet gedefinieerd" eng "Function '%-.192s' is not defined" est "Funktsioon '%-.192s' ei ole defineeritud" fre "La fonction '%-.192s' n'est pas définie" @@ -2978,6 +3101,7 @@ ER_FUNCTION_NOT_DEFINED ita "La funzione '%-.192s' non e` definita" jpn "関数 '%-.192s' は定義されていません。" kor "'%-.192s' 함수가 정의되어 있지 않습니다." + nla "Functie '%-.192s' is niet gedefinieerd" por "Função '%-.192s' não está definida" rum "Functia '%-.192s' nu e definita" rus "Функция '%-.192s' не определена" @@ -2987,9 +3111,9 @@ ER_FUNCTION_NOT_DEFINED swe "Funktionen '%-.192s' är inte definierad" ukr "Функцію '%-.192s' не визначено" ER_HOST_IS_BLOCKED + chi "主机 '%-.64s' 由于许多连接错误而被阻止;使用 'mariadb-admin flush-hosts' 解除阻塞" cze "Stroj '%-.64s' je zablokován kvůli mnoha chybám při připojování. Odblokujete použitím 'mariadb-admin flush-hosts'" dan "Værten '%-.64s' er blokeret på grund af mange fejlforespørgsler. Lås op med 'mariadb-admin flush-hosts'" - nla "Host '%-.64s' is geblokkeeerd vanwege te veel verbindings fouten. Deblokkeer met 'mariadb-admin flush-hosts'" eng "Host '%-.64s' is blocked because of many connection errors; unblock with 'mariadb-admin flush-hosts'" est "Masin '%-.64s' on blokeeritud hulgaliste ühendusvigade tõttu. Blokeeringu saab tühistada 'mariadb-admin flush-hosts' käsuga" fre "L'hôte '%-.64s' est bloqué à cause d'un trop grand nombre d'erreur de connexion. Débloquer le par 'mariadb-admin flush-hosts'" @@ -3000,6 +3124,7 @@ ER_HOST_IS_BLOCKED ita "Sistema '%-.64s' bloccato a causa di troppi errori di connessione. Per sbloccarlo: 'mariadb-admin flush-hosts'" jpn "接続エラーが多いため、ホスト '%-.64s' は拒否されました。'mariadb-admin flush-hosts' で解除できます。" kor "너무 많은 연결오류로 인하여 호스트 '%-.64s'는 블락되었습니다. 'mariadb-admin flush-hosts'를 이용하여 블락을 해제하세요" + nla "Host '%-.64s' is geblokkeeerd vanwege te veel verbindings fouten. Deblokkeer met 'mariadb-admin flush-hosts'" por "'Host' '%-.64s' está bloqueado devido a muitos erros de conexão. Desbloqueie com 'mariadb-admin flush-hosts'" rum "Host-ul '%-.64s' e blocat din cauza multelor erori de conectie. Poti deploca folosind 'mariadb-admin flush-hosts'" rus "Хост '%-.64s' заблокирован из-за слишком большого количества ошибок соединения. Разблокировать его можно с помощью 'mariadb-admin flush-hosts'" @@ -3008,9 +3133,9 @@ ER_HOST_IS_BLOCKED swe "Denna dator, '%-.64s', är blockerad pga många felaktig paket. Gör 'mariadb-admin flush-hosts' för att ta bort alla blockeringarna" ukr "Хост '%-.64s' заблоковано з причини великої кількості помилок з'єднання. Для розблокування використовуйте 'mariadb-admin flush-hosts'" ER_HOST_NOT_PRIVILEGED + chi "Host'%-.64s'不允许连接到此MariaDB服务器" cze "Stroj '%-.64s' nemá povoleno se k tomuto MariaDB serveru připojit" dan "Værten '%-.64s' kan ikke tilkoble denne MariaDB-server" - nla "Het is host '%-.64s' is niet toegestaan verbinding te maken met deze MariaDB server" eng "Host '%-.64s' is not allowed to connect to this MariaDB server" est "Masinal '%-.64s' puudub ligipääs sellele MariaDB serverile" fre "Le hôte '%-.64s' n'est pas authorisé à se connecter à ce serveur MariaDB" @@ -3021,6 +3146,7 @@ ER_HOST_NOT_PRIVILEGED ita "Al sistema '%-.64s' non e` consentita la connessione a questo server MariaDB" jpn "ホスト '%-.64s' からのこの MariaDB server への接続は許可されていません。" kor "'%-.64s' 호스트는 이 MariaDB서버에 접속할 허가를 받지 못했습니다." + nla "Het is host '%-.64s' is niet toegestaan verbinding te maken met deze MariaDB server" por "'Host' '%-.64s' não tem permissão para se conectar com este servidor MariaDB" rum "Host-ul '%-.64s' nu este permis a se conecta la aceste server MariaDB" rus "Хосту '%-.64s' не разрешается подключаться к этому серверу MariaDB" @@ -3029,9 +3155,9 @@ ER_HOST_NOT_PRIVILEGED swe "Denna dator, '%-.64s', har inte privileger att använda denna MariaDB server" ukr "Хосту '%-.64s' не доволено зв'язуватись з цим сервером MariaDB" ER_PASSWORD_ANONYMOUS_USER 42000 + chi "您正在以匿名用户身份使用 MariaDB,匿名用户不能修改用户设置" cze "Používáte MariaDB jako anonymní uživatel a anonymní uživatelé nemají povoleno měnit hesla" dan "Du bruger MariaDB som anonym bruger. Anonyme brugere må ikke ændre adgangskoder" - nla "U gebruikt MariaDB als anonieme gebruiker en deze mogen geen wachtwoorden wijzigen" eng "You are using MariaDB as an anonymous user and anonymous users are not allowed to modify user settings" est "Te kasutate MariaDB-i anonüümse kasutajana, kelledel pole parooli muutmise õigust" fre "Vous utilisez un utilisateur anonyme et les utilisateurs anonymes ne sont pas autorisés à changer les mots de passe" @@ -3042,6 +3168,7 @@ ER_PASSWORD_ANONYMOUS_USER 42000 ita "Impossibile cambiare la password usando MariaDB come utente anonimo" jpn "MariaDB を匿名ユーザーで使用しているので、パスワードの変更はできません。" kor "당신은 MariaDB서버에 익명의 사용자로 접속을 하셨습니다.익명의 사용자는 암호를 변경할 수 없습니다." + nla "U gebruikt MariaDB als anonieme gebruiker en deze mogen geen wachtwoorden wijzigen" por "Você está usando o MariaDB como usuário anônimo e usuários anônimos não têm permissão para mudar senhas" rum "Dumneavoastra folositi MariaDB ca un utilizator anonim si utilizatorii anonimi nu au voie sa schimbe setarile utilizatorilor" rus "Вы используете MariaDB от имени анонимного пользователя, а анонимным пользователям не разрешается менять пароли" @@ -3050,9 +3177,9 @@ ER_PASSWORD_ANONYMOUS_USER 42000 swe "Du använder MariaDB som en anonym användare och som sådan får du inte ändra ditt lösenord" ukr "Ви використовуєте MariaDB як анонімний користувач, тому вам не дозволено змінювати паролі" ER_PASSWORD_NOT_ALLOWED 42000 + chi "您必须具有更新 MariaDB 数据库中的表的权限才能更改其他人的密码" cze "Na změnu hesel ostatním musíte mít právo provést update tabulek v databázi mysql" - dan "Du skal have tilladelse til at opdatere tabeller i mysql databasen for at ændre andres adgangskoder" - nla "U moet tabel update priveleges hebben in de mysql database om wachtwoorden voor anderen te mogen wijzigen" + dan "Du skal have tilladelse til at opdatere tabeller i MariaDB databasen for at ændre andres adgangskoder" eng "You must have privileges to update tables in the mysql database to be able to change passwords for others" est "Teiste paroolide muutmiseks on nõutav tabelite muutmisõigus 'mysql' andmebaasis" fre "Vous devez avoir le privilège update sur les tables de la base de donnée mysql pour pouvoir changer les mots de passe des autres" @@ -3062,6 +3189,7 @@ ER_PASSWORD_NOT_ALLOWED 42000 ita "E` necessario il privilegio di update sulle tabelle del database mysql per cambiare le password per gli altri utenti" jpn "他のユーザーのパスワードを変更するためには、mysqlデータベースの表を更新する権限が必要です。" kor "당신은 다른사용자들의 암호를 변경할 수 있도록 데이타베이스 변경권한을 가져야 합니다." + nla "U moet tabel update priveleges hebben in de MariaDB database om wachtwoorden voor anderen te mogen wijzigen" por "Você deve ter privilégios para atualizar tabelas no banco de dados mysql para ser capaz de mudar a senha de outros" rum "Trebuie sa aveti privilegii sa actualizati tabelele in bazele de date mysql ca sa puteti sa schimati parolele altora" rus "Для того чтобы изменять пароли других пользователей, у вас должны быть привилегии на изменение таблиц в базе данных mysql" @@ -3070,9 +3198,9 @@ ER_PASSWORD_NOT_ALLOWED 42000 swe "För att ändra lösenord för andra måste du ha rättigheter att uppdatera mysql-databasen" ukr "Ви повині мати право на оновлення таблиць у базі данних mysql, аби мати можливість змінювати пароль іншим" ER_PASSWORD_NO_MATCH 28000 + chi "在用户表中找不到任何匹配的行" cze "V tabulce user není žádný odpovídající řádek" dan "Kan ikke finde nogen tilsvarende poster i bruger tabellen" - nla "Kan geen enkele passende rij vinden in de gebruikers tabel" eng "Can't find any matching row in the user table" est "Ei leia vastavat kirjet kasutajate tabelis" fre "Impossible de trouver un enregistrement correspondant dans la table user" @@ -3083,6 +3211,7 @@ ER_PASSWORD_NO_MATCH 28000 ita "Impossibile trovare la riga corrispondente nella tabella user" jpn "ユーザーテーブルに該当するレコードが見つかりません。" kor "사용자 테이블에서 일치하는 것을 찾을 수 없습니다." + nla "Kan geen enkele passende rij vinden in de gebruikers tabel" por "Não pode encontrar nenhuma linha que combine na tabela usuário (user table)" rum "Nu pot gasi nici o linie corespunzatoare in tabela utilizatorului" rus "Невозможно отыскать подходящую запись в таблице пользователей" @@ -3091,9 +3220,9 @@ ER_PASSWORD_NO_MATCH 28000 swe "Hittade inte användaren i 'user'-tabellen" ukr "Не можу знайти відповідних записів у таблиці користувача" ER_UPDATE_INFO + chi "匹配行:%ld已更改:%ld警告:%ld" cze "Nalezených řádků: %ld Změněno: %ld Varování: %ld" dan "Poster fundet: %ld Ændret: %ld Advarsler: %ld" - nla "Passende rijen: %ld Gewijzigd: %ld Waarschuwingen: %ld" eng "Rows matched: %ld Changed: %ld Warnings: %ld" est "Sobinud kirjeid: %ld Muudetud: %ld Hoiatusi: %ld" fre "Enregistrements correspondants: %ld Modifiés: %ld Warnings: %ld" @@ -3102,6 +3231,7 @@ ER_UPDATE_INFO ita "Rows riconosciute: %ld Cambiate: %ld Warnings: %ld" jpn "該当した行: %ld 変更: %ld 警告: %ld" kor "일치하는 Rows : %ld개 변경됨: %ld개 경고: %ld개" + nla "Passende rijen: %ld Gewijzigd: %ld Waarschuwingen: %ld" por "Linhas que combinaram: %ld - Alteradas: %ld - Avisos: %ld" rum "Linii identificate (matched): %ld Schimbate: %ld Atentionari (warnings): %ld" rus "Совпало записей: %ld Изменено: %ld Предупреждений: %ld" @@ -3110,9 +3240,9 @@ ER_UPDATE_INFO swe "Rader: %ld Uppdaterade: %ld Varningar: %ld" ukr "Записів відповідає: %ld Змінено: %ld Застережень: %ld" ER_CANT_CREATE_THREAD + chi "无法创建新线程 (错误号码 %M); 如果您没有用完剩余内存,您可以查阅文档以了解可能与操作系统相关的错误" cze "Nemohu vytvořit nový thread (errno %M). Pokud je ještě nějaká volná paměť, podívejte se do manuálu na část o chybách specifických pro jednotlivé operační systémy" dan "Kan ikke danne en ny tråd (fejl nr. %M). Hvis computeren ikke er løbet tør for hukommelse, kan du se i brugervejledningen for en mulig operativ-system - afhængig fejl" - nla "Kan geen nieuwe thread aanmaken (Errcode: %M). Indien er geen tekort aan geheugen is kunt u de handleiding consulteren over een mogelijke OS afhankelijke fout" eng "Can't create a new thread (errno %M); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug" est "Ei suuda luua uut lõime (veakood %M). Kui mälu ei ole otsas, on tõenäoliselt tegemist operatsioonisüsteemispetsiifilise veaga" fre "Impossible de créer une nouvelle tâche (errno %M). S'il reste de la mémoire libre, consultez le manual pour trouver un éventuel bug dépendant de l'OS" @@ -3121,6 +3251,7 @@ ER_CANT_CREATE_THREAD ita "Impossibile creare un nuovo thread (errno %M). Se non ci sono problemi di memoria disponibile puoi consultare il manuale per controllare possibili problemi dipendenti dal SO" jpn "新規にスレッドを作成できません。(エラー番号 %M) もしも使用可能メモリーの不足でなければ、OS依存のバグである可能性があります。" kor "새로운 쓰레드를 만들 수 없습니다.(에러번호 %M). 만약 여유메모리가 있다면 OS-dependent버그 의 메뉴얼 부분을 찾아보시오." + nla "Kan geen nieuwe thread aanmaken (Errcode: %M). Indien er geen tekort aan geheugen is kunt u de handleiding consulteren over een mogelijke OS afhankelijke fout" nor "Can't create a new thread (errno %M); if you are not out of available memory you can consult the manual for any possible OS dependent bug" norwegian-ny "Can't create a new thread (errno %M); if you are not out of available memory you can consult the manual for any possible OS dependent bug" pol "Can't create a new thread (errno %M); if you are not out of available memory you can consult the manual for any possible OS dependent bug" @@ -3132,9 +3263,9 @@ ER_CANT_CREATE_THREAD swe "Kan inte skapa en ny tråd (errno %M)" ukr "Не можу створити нову гілку (помилка %M). Якщо ви не використали усю пам'ять, то прочитайте документацію до вашої ОС - можливо це помилка ОС" ER_WRONG_VALUE_COUNT_ON_ROW 21S01 + chi "列计数与行%lu的值计数不匹配" cze "Počet sloupců neodpovídá počtu hodnot na řádku %lu" dan "Kolonne antallet stemmer ikke overens med antallet af værdier i post %lu" - nla "Kolom aantal komt niet overeen met waarde aantal in rij %lu" eng "Column count doesn't match value count at row %lu" est "Tulpade hulk erineb väärtuste hulgast real %lu" ger "Anzahl der Felder stimmt nicht mit der Anzahl der Werte in Zeile %lu überein" @@ -3142,6 +3273,7 @@ ER_WRONG_VALUE_COUNT_ON_ROW 21S01 ita "Il numero delle colonne non corrisponde al conteggio alla riga %lu" jpn "%lu 行目で、列の数が値の数と一致しません。" kor "Row %lu에서 칼럼 카운트와 value 카운터와 일치하지 않습니다." + nla "Kolom aantal komt niet overeen met waarde aantal in rij %lu" por "Contagem de colunas não confere com a contagem de valores na linha %lu" rum "Numarul de coloane nu corespunde cu numarul de valori la linia %lu" rus "Количество столбцов не совпадает с количеством значений в записи %lu" @@ -3150,9 +3282,9 @@ ER_WRONG_VALUE_COUNT_ON_ROW 21S01 swe "Antalet kolumner motsvarar inte antalet värden på rad: %lu" ukr "Кількість стовбців не співпадає з кількістю значень у строці %lu" ER_CANT_REOPEN_TABLE + chi "无法重新打开表:'%-.192s'" cze "Nemohu znovuotevřít tabulku: '%-.192s" dan "Kan ikke genåbne tabel '%-.192s" - nla "Kan tabel niet opnieuw openen: '%-.192s" eng "Can't reopen table: '%-.192s'" est "Ei suuda taasavada tabelit '%-.192s'" fre "Impossible de réouvrir la table: '%-.192s" @@ -3162,6 +3294,7 @@ ER_CANT_REOPEN_TABLE ita "Impossibile riaprire la tabella: '%-.192s'" jpn "表を再オープンできません。: '%-.192s'" kor "테이블을 다시 열수 없군요: '%-.192s" + nla "Kan tabel niet opnieuw openen: '%-.192s" nor "Can't reopen table: '%-.192s" norwegian-ny "Can't reopen table: '%-.192s" pol "Can't reopen table: '%-.192s" @@ -3174,9 +3307,9 @@ ER_CANT_REOPEN_TABLE swe "Kunde inte stänga och öppna tabell '%-.192s" ukr "Не можу перевідкрити таблицю: '%-.192s'" ER_INVALID_USE_OF_NULL 22004 + chi "无效使用 NULL 值" cze "Neplatné užití hodnoty NULL" dan "Forkert brug af nulværdi (NULL)" - nla "Foutief gebruik van de NULL waarde" eng "Invalid use of NULL value" est "NULL väärtuse väärkasutus" fre "Utilisation incorrecte de la valeur NULL" @@ -3186,6 +3319,7 @@ ER_INVALID_USE_OF_NULL 22004 ita "Uso scorretto del valore NULL" jpn "NULL 値の使用方法が不適切です。" kor "NULL 값을 잘못 사용하셨군요..." + nla "Foutief gebruik van de NULL waarde" por "Uso inválido do valor NULL" rum "Folosirea unei value NULL e invalida" rus "Неправильное использование величины NULL" @@ -3194,29 +3328,30 @@ ER_INVALID_USE_OF_NULL 22004 swe "Felaktig använding av NULL" ukr "Хибне використання значення NULL" ER_REGEXP_ERROR 42000 + chi "正则表达错误 '%s'" cze "Regulární výraz vrátil chybu: %s" - dan "Fik fejl '%-.64s' fra regexp" - nla "Fout '%-.64s' ontvangen van regexp" + dan "Fik fejl '%s' fra regexp" eng "Regex error '%s'" est "regexp tagastas vea: %s" - fre "Erreur '%-.64s' provenant de regexp" + fre "Erreur '%s' provenant de regexp" ger "Regexp Fehler %s" - hindi "regexp में '%-.64s' त्रुटि हुई" - hun "'%-.64s' hiba a regularis kifejezes hasznalata soran (regexp)" - ita "Errore '%-.64s' da regexp" - jpn "regexp がエラー '%-.64s' を返しました。" - kor "regexp에서 '%-.64s'가 났습니다." - por "Obteve erro '%-.64s' em regexp" - rum "Eroarea '%-.64s' obtinuta din expresia regulara (regexp)" + hindi "regexp में '%s' त्रुटि हुई" + hun "'%s' hiba a regularis kifejezes hasznalata soran (regexp)" + ita "Errore '%s' da regexp" + jpn "regexp がエラー '%s' を返しました。" + kor "regexp에서 '%s'가 났습니다." + nla "Fout '%s' ontvangen van regexp" + por "Obteve erro '%s' em regexp" + rum "Eroarea '%s' obtinuta din expresia regulara (regexp)" rus "Ошибка регулярного выражения: %s" serbian "Funkcija regexp je vratila grešku: %s" - spa "Error %s desde regexp" - swe "Fick fel '%-.64s' från REGEXP" + spa "Obtenido error '%s' de regexp" + swe "Fick fel '%s' från REGEXP" ukr "Помилка регулярного виразу: %s" ER_MIX_OF_GROUP_FUNC_AND_FIELDS 42000 + chi "如果没有 GROUP BY 子句,不能混合没有 GROUP 列的 GROUP 列 (MIN(),MAX(),COUNT(),...)" cze "Pokud není žádná GROUP BY klauzule, není dovoleno současné použití GROUP položek (MIN(),MAX(),COUNT()...) s ne GROUP položkami" dan "Sammenblanding af GROUP kolonner (MIN(),MAX(),COUNT()...) uden GROUP kolonner er ikke tilladt, hvis der ikke er noget GROUP BY prædikat" - nla "Het mixen van GROUP kolommen (MIN(),MAX(),COUNT()...) met no-GROUP kolommen is foutief indien er geen GROUP BY clausule is" eng "Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause" est "GROUP tulpade (MIN(),MAX(),COUNT()...) kooskasutamine tavaliste tulpadega ilma GROUP BY klauslita ei ole lubatud" fre "Mélanger les colonnes GROUP (MIN(),MAX(),COUNT()...) avec des colonnes normales est interdit s'il n'y a pas de clause GROUP BY" @@ -3225,6 +3360,7 @@ ER_MIX_OF_GROUP_FUNC_AND_FIELDS 42000 ita "Il mescolare funzioni di aggregazione (MIN(),MAX(),COUNT()...) e non e` illegale se non c'e` una clausula GROUP BY" jpn "GROUP BY句が無い場合、集計関数(MIN(),MAX(),COUNT(),...)と通常の列を同時に使用できません。" kor "GROUP BY 절 없이 혼합된 GROUP 함수 (MIN(),MAX(),COUNT(),...) 를 사용할 수 없습니다." + nla "Het mixen van GROUP kolommen (MIN(),MAX(),COUNT()...) met no-GROUP kolommen is foutief indien er geen GROUP BY clausule is" por "Mistura de colunas agrupadas (com MIN(), MAX(), COUNT(), ...) com colunas não agrupadas é ilegal, se não existir uma cláusula de agrupamento (cláusula GROUP BY)" rum "Amestecarea de coloane GROUP (MIN(),MAX(),COUNT()...) fara coloane GROUP este ilegala daca nu exista o clauza GROUP BY" rus "Одновременное использование сгруппированных (GROUP) столбцов (MIN(),MAX(),COUNT(),...) с несгруппированными столбцами является некорректным, если в выражении есть GROUP BY" @@ -3233,9 +3369,9 @@ ER_MIX_OF_GROUP_FUNC_AND_FIELDS 42000 swe "Man får ha både GROUP-kolumner (MIN(),MAX(),COUNT()...) och fält i en fråga om man inte har en GROUP BY-del" ukr "Змішування GROUP стовбців (MIN(),MAX(),COUNT()...) з не GROUP стовбцями є забороненим, якщо не має GROUP BY" ER_NONEXISTING_GRANT 42000 + chi "用户 '%-.48s' 来自主机 '%-.64s'没有此类授权" cze "Neexistuje odpovídající grant pro uživatele '%-.48s' na stroji '%-.64s'" dan "Denne tilladelse findes ikke for brugeren '%-.48s' på vært '%-.64s'" - nla "Deze toegang (GRANT) is niet toegekend voor gebruiker '%-.48s' op host '%-.64s'" eng "There is no such grant defined for user '%-.48s' on host '%-.64s'" est "Sellist õigust ei ole defineeritud kasutajale '%-.48s' masinast '%-.64s'" fre "Un tel droit n'est pas défini pour l'utilisateur '%-.48s' sur l'hôte '%-.64s'" @@ -3244,6 +3380,7 @@ ER_NONEXISTING_GRANT 42000 ita "GRANT non definita per l'utente '%-.48s' dalla macchina '%-.64s'" jpn "ユーザー '%-.48s' (ホスト '%-.64s' 上) は許可されていません。" kor "사용자 '%-.48s' (호스트 '%-.64s')를 위하여 정의된 그런 승인은 없습니다." + nla "Deze toegang (GRANT) is niet toegekend voor gebruiker '%-.48s' op host '%-.64s'" por "Não existe tal permissão (grant) definida para o usuário '%-.48s' no 'host' '%-.64s'" rum "Nu exista un astfel de grant definit pentru utilzatorul '%-.48s' de pe host-ul '%-.64s'" rus "Такие права не определены для пользователя '%-.48s' на хосте '%-.64s'" @@ -3252,31 +3389,30 @@ ER_NONEXISTING_GRANT 42000 swe "Det finns inget privilegium definierat för användare '%-.48s' på '%-.64s'" ukr "Повноважень не визначено для користувача '%-.48s' з хосту '%-.64s'" ER_TABLEACCESS_DENIED_ERROR 42000 - cze "%-.100T příkaz nepřístupný pro uživatele: '%s'@'%s' pro tabulku '%-.192s'" - dan "%-.100T-kommandoen er ikke tilladt for brugeren '%s'@'%s' for tabellen '%-.192s'" - nla "%-.100T commando geweigerd voor gebruiker: '%s'@'%s' voor tabel '%-.192s'" - eng "%-.100T command denied to user '%s'@'%s' for table '%-.192s'" - jps "コマンド %-.100T は ユーザー '%s'@'%s' ,テーブル '%-.192s' に対して許可されていません", - est "%-.100T käsk ei ole lubatud kasutajale '%s'@'%s' tabelis '%-.192s'" - fre "La commande '%-.100T' est interdite à l'utilisateur: '%s'@'%s' sur la table '%-.192s'" - ger "%-.100T Befehl nicht erlaubt für Benutzer '%s'@'%s' auf Tabelle '%-.192s'" - hun "%-.100T parancs a '%s'@'%s' felhasznalo szamara nem engedelyezett a '%-.192s' tablaban" - ita "Comando %-.100T negato per l'utente: '%s'@'%s' sulla tabella '%-.192s'" - jpn "コマンド %-.100T は ユーザー '%s'@'%s' ,テーブル '%-.192s' に対して許可されていません" - kor "'%-.100T' 명령은 다음 사용자에게 거부되었습니다. : '%s'@'%s' for 테이블 '%-.192s'" - por "Comando '%-.100T' negado para o usuário '%s'@'%s' na tabela '%-.192s'" - rum "Comanda %-.100T interzisa utilizatorului: '%s'@'%s' pentru tabela '%-.192s'" - rus "Команда %-.100T запрещена пользователю '%s'@'%s' для таблицы '%-.192s'" - serbian "%-.100T komanda zabranjena za korisnika '%s'@'%s' za tabelu '%-.192s'" - spa "%-.100T comando denegado a usuario '%s'@'%s' para la tabla '%-.192s'" - swe "%-.100T ej tillåtet för '%s'@'%s' för tabell '%-.192s'" - ukr "%-.100T команда заборонена користувачу: '%s'@'%s' у таблиці '%-.192s'" + chi "%-.100T 命令的权限拒绝用户 '%s'@'%s' 用在表 %`s.%`s" + cze "%-.100T příkaz nepřístupný pro uživatele: '%s'@'%s' pro tabulku %`s.%`s" + dan "%-.100T-kommandoen er ikke tilladt for brugeren '%s'@'%s' for tabellen %`s.%`s" + nla "%-.100T commando geweigerd voor gebruiker: '%s'@'%s' voor tabel %`s.%`s" + eng "%-.100T command denied to user '%s'@'%s' for table %`s.%`s" + est "%-.100T käsk ei ole lubatud kasutajale '%s'@'%s' tabelis %`s.%`s" + fre "La commande '%-.100T' est interdite à l'utilisateur: '%s'@'%s' sur la table %`s.%`s" + ger "%-.100T Befehl nicht erlaubt für Benutzer '%s'@'%s' auf Tabelle %`s.%`s" + hun "%-.100T parancs a '%s'@'%s' felhasznalo szamara nem engedelyezett a %`s.%`s tablaban" + ita "Comando %-.100T negato per l'utente: '%s'@'%s' sulla tabella %`s.%`s" + jpn "コマンド %-.100T は ユーザー '%s'@'%s' ,テーブル %`s.%`s に対して許可されていません" + kor "'%-.100T' 명령은 다음 사용자에게 거부되었습니다. : '%s'@'%s' for 테이블 %`s.%`s" + por "Comando '%-.100T' negado para o usuário '%s'@'%s' na tabela %`s.%`s" + rum "Comanda %-.100T interzisa utilizatorului: '%s'@'%s' pentru tabela %`s.%`s" + rus "Команда %-.100T запрещена пользователю '%s'@'%s' для таблицы %`s.%`s" + serbian "%-.100T komanda zabranjena za korisnika '%s'@'%s' za tabelu %`s.%`s" + spa "%-.100T comando denegado a usuario '%s'@'%s' para la tabla %`s.%`s" + swe "%-.100T ej tillåtet för '%s'@'%s' för tabell %`s.%`s" + ukr "%-.100T команда заборонена користувачу: '%s'@'%s' у таблиці %`s.%`s" ER_COLUMNACCESS_DENIED_ERROR 42000 + chi "%-.32s 命令的权限拒绝用户 '%s'@'%s' 用在列 '%-.192s' 在表 '%-.192s'" cze "%-.32s příkaz nepřístupný pro uživatele: '%s'@'%s' pro sloupec '%-.192s' v tabulce '%-.192s'" dan "%-.32s-kommandoen er ikke tilladt for brugeren '%s'@'%s' for kolonne '%-.192s' in tabellen '%-.192s'" - nla "%-.32s commando geweigerd voor gebruiker: '%s'@'%s' voor kolom '%-.192s' in tabel '%-.192s'" eng "%-.32s command denied to user '%s'@'%s' for column '%-.192s' in table '%-.192s'" - jps "コマンド %-.32s は ユーザー '%s'@'%s'¥n カラム '%-.192s' テーブル '%-.192s' に対して許可されていません", est "%-.32s käsk ei ole lubatud kasutajale '%s'@'%s' tulbale '%-.192s' tabelis '%-.192s'" fre "La commande '%-.32s' est interdite à l'utilisateur: '%s'@'%s' sur la colonne '%-.192s' de la table '%-.192s'" ger "%-.32s Befehl nicht erlaubt für Benutzer '%s'@'%s' und Feld '%-.192s' in Tabelle '%-.192s'" @@ -3284,6 +3420,7 @@ ER_COLUMNACCESS_DENIED_ERROR 42000 ita "Comando %-.32s negato per l'utente: '%s'@'%s' sulla colonna '%-.192s' della tabella '%-.192s'" jpn "コマンド %-.32s は ユーザー '%s'@'%s'\n カラム '%-.192s' テーブル '%-.192s' に対して許可されていません" kor "'%-.32s' 명령은 다음 사용자에게 거부되었습니다. : '%s'@'%s' for 칼럼 '%-.192s' in 테이블 '%-.192s'" + nla "%-.32s commando geweigerd voor gebruiker: '%s'@'%s' voor kolom '%-.192s' in tabel '%-.192s'" por "Comando '%-.32s' negado para o usuário '%s'@'%s' na coluna '%-.192s', na tabela '%-.192s'" rum "Comanda %-.32s interzisa utilizatorului: '%s'@'%s' pentru coloana '%-.192s' in tabela '%-.192s'" rus "Команда %-.32s запрещена пользователю '%s'@'%s' для столбца '%-.192s' в таблице '%-.192s'" @@ -3292,9 +3429,9 @@ ER_COLUMNACCESS_DENIED_ERROR 42000 swe "%-.32s ej tillåtet för '%s'@'%s' för kolumn '%-.192s' i tabell '%-.192s'" ukr "%-.32s команда заборонена користувачу: '%s'@'%s' для стовбця '%-.192s' у таблиці '%-.192s'" ER_ILLEGAL_GRANT_FOR_TABLE 42000 + chi "非法的 GRANT/REVOKE 命令;请查阅文档查看可以使用哪些权限" cze "Neplatný příkaz GRANT/REVOKE. Prosím, přečtěte si v manuálu, jaká privilegia je možné použít" dan "Forkert GRANT/REVOKE kommando. Se i brugervejledningen hvilke privilegier der kan specificeres" - nla "Foutief GRANT/REVOKE commando. Raadpleeg de handleiding welke priveleges gebruikt kunnen worden" eng "Illegal GRANT/REVOKE command; please consult the manual to see which privileges can be used" est "Vigane GRANT/REVOKE käsk. Tutvu kasutajajuhendiga" fre "Commande GRANT/REVOKE incorrecte. Consultez le manuel" @@ -3304,6 +3441,7 @@ ER_ILLEGAL_GRANT_FOR_TABLE 42000 ita "Comando GRANT/REVOKE illegale. Prego consultare il manuale per sapere quali privilegi possono essere usati" jpn "不正な GRANT/REVOKE コマンドです。どの権限で利用可能かはマニュアルを参照して下さい。" kor "잘못된 GRANT/REVOKE 명령. 어떤 권리와 승인이 사용되어 질 수 있는지 메뉴얼을 보시오." + nla "Foutief GRANT/REVOKE commando. Raadpleeg de handleiding welke priveleges gebruikt kunnen worden" nor "Illegal GRANT/REVOKE command; please consult the manual to see which privleges can be used" norwegian-ny "Illegal GRANT/REVOKE command; please consult the manual to see which privleges can be used" pol "Illegal GRANT/REVOKE command; please consult the manual to see which privleges can be used" @@ -3316,9 +3454,9 @@ ER_ILLEGAL_GRANT_FOR_TABLE 42000 swe "Felaktigt GRANT-privilegium använt" ukr "Хибна GRANT/REVOKE команда; прочитайте документацію стосовно того, які права можна використовувати" ER_GRANT_WRONG_HOST_OR_USER 42000 + chi "GRANT 语句的主机或用户参数太长" cze "Argument příkazu GRANT uživatel nebo stroj je příliš dlouhý" dan "Værts- eller brugernavn for langt til GRANT" - nla "De host of gebruiker parameter voor GRANT is te lang" eng "The host or user argument to GRANT is too long" est "Masina või kasutaja nimi GRANT lauses on liiga pikk" fre "L'hôte ou l'utilisateur donné en argument à GRANT est trop long" @@ -3328,6 +3466,7 @@ ER_GRANT_WRONG_HOST_OR_USER 42000 ita "L'argomento host o utente per la GRANT e` troppo lungo" jpn "GRANTコマンドへの、ホスト名やユーザー名が長すぎます。" kor "승인(GRANT)을 위하여 사용한 사용자나 호스트의 값들이 너무 깁니다." + nla "De host of gebruiker parameter voor GRANT is te lang" por "Argumento de 'host' ou de usuário para o GRANT é longo demais" rum "Argumentul host-ului sau utilizatorului pentru GRANT e prea lung" rus "Слишком длинное имя пользователя/хоста для GRANT" @@ -3336,9 +3475,9 @@ ER_GRANT_WRONG_HOST_OR_USER 42000 swe "Felaktigt maskinnamn eller användarnamn använt med GRANT" ukr "Аргумент host або user для GRANT задовгий" ER_NO_SUCH_TABLE 42S02 + chi "表 '%-.192s.%-.192s' 不存在" cze "Tabulka '%-.192s.%-.192s' neexistuje" dan "Tabellen '%-.192s.%-.192s' eksisterer ikke" - nla "Tabel '%-.192s.%-.192s' bestaat niet" eng "Table '%-.192s.%-.192s' doesn't exist" est "Tabelit '%-.192s.%-.192s' ei eksisteeri" fre "La table '%-.192s.%-.192s' n'existe pas" @@ -3348,6 +3487,7 @@ ER_NO_SUCH_TABLE 42S02 ita "La tabella '%-.192s.%-.192s' non esiste" jpn "表 '%-.192s.%-.192s' は存在しません。" kor "테이블 '%-.192s.%-.192s' 는 존재하지 않습니다." + nla "Tabel '%-.192s.%-.192s' bestaat niet" nor "Table '%-.192s.%-.192s' doesn't exist" norwegian-ny "Table '%-.192s.%-.192s' doesn't exist" pol "Table '%-.192s.%-.192s' doesn't exist" @@ -3360,9 +3500,9 @@ ER_NO_SUCH_TABLE 42S02 swe "Det finns ingen tabell som heter '%-.192s.%-.192s'" ukr "Таблиця '%-.192s.%-.192s' не існує" ER_NONEXISTING_TABLE_GRANT 42000 + chi "没有为用户 '%-.48s' 来自主机 '%-.64s' 在表 '%-.192s' 上授权" cze "Neexistuje odpovídající grant pro uživatele '%-.48s' na stroji '%-.64s' pro tabulku '%-.192s'" dan "Denne tilladelse eksisterer ikke for brugeren '%-.48s' på vært '%-.64s' for tabellen '%-.192s'" - nla "Deze toegang (GRANT) is niet toegekend voor gebruiker '%-.48s' op host '%-.64s' op tabel '%-.192s'" eng "There is no such grant defined for user '%-.48s' on host '%-.64s' on table '%-.192s'" est "Sellist õigust ei ole defineeritud kasutajale '%-.48s' masinast '%-.64s' tabelile '%-.192s'" fre "Un tel droit n'est pas défini pour l'utilisateur '%-.48s' sur l'hôte '%-.64s' sur la table '%-.192s'" @@ -3371,6 +3511,7 @@ ER_NONEXISTING_TABLE_GRANT 42000 ita "GRANT non definita per l'utente '%-.48s' dalla macchina '%-.64s' sulla tabella '%-.192s'" jpn "ユーザー '%-.48s' (ホスト '%-.64s' 上) の表 '%-.192s' への権限は定義されていません。" kor "사용자 '%-.48s'(호스트 '%-.64s')는 테이블 '%-.192s'를 사용하기 위하여 정의된 승인은 없습니다. " + nla "Deze toegang (GRANT) is niet toegekend voor gebruiker '%-.48s' op host '%-.64s' op tabel '%-.192s'" por "Não existe tal permissão (grant) definido para o usuário '%-.48s' no 'host' '%-.64s', na tabela '%-.192s'" rum "Nu exista un astfel de privilegiu (grant) definit pentru utilizatorul '%-.48s' de pe host-ul '%-.64s' pentru tabela '%-.192s'" rus "Такие права не определены для пользователя '%-.48s' на компьютере '%-.64s' для таблицы '%-.192s'" @@ -3379,9 +3520,9 @@ ER_NONEXISTING_TABLE_GRANT 42000 swe "Det finns inget privilegium definierat för användare '%-.48s' på '%-.64s' för tabell '%-.192s'" ukr "Повноважень не визначено для користувача '%-.48s' з хосту '%-.64s' для таблиці '%-.192s'" ER_NOT_ALLOWED_COMMAND 42000 + chi "本 MariaDB 版本不允许使用这个命令" cze "Použitý příkaz není v této verzi MariaDB povolen" dan "Den brugte kommando er ikke tilladt med denne udgave af MariaDB" - nla "Het used commando is niet toegestaan in deze MariaDB versie" eng "The used command is not allowed with this MariaDB version" est "Antud käsk ei ole lubatud käesolevas MariaDB versioonis" fre "Cette commande n'existe pas dans cette version de MariaDB" @@ -3391,6 +3532,7 @@ ER_NOT_ALLOWED_COMMAND 42000 ita "Il comando utilizzato non e` supportato in questa versione di MariaDB" jpn "このMariaDBバージョンでは利用できないコマンドです。" kor "사용된 명령은 현재의 MariaDB 버젼에서는 이용되지 않습니다." + nla "Het used commando is niet toegestaan in deze MariaDB versie" por "Comando usado não é permitido para esta versão do MariaDB" rum "Comanda folosita nu este permisa pentru aceasta versiune de MariaDB" rus "Эта команда не допускается в данной версии MariaDB" @@ -3399,9 +3541,9 @@ ER_NOT_ALLOWED_COMMAND 42000 swe "Du kan inte använda detta kommando med denna MariaDB version" ukr "Використовувана команда не дозволена у цій версії MariaDB" ER_SYNTAX_ERROR 42000 + chi "您的 SQL 语法有错误;请查看相关文档" cze "Vaše syntaxe je nějaká divná" dan "Der er en fejl i SQL syntaksen" - nla "Er is iets fout in de gebruikte syntax" eng "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use" est "Viga SQL süntaksis" fre "Erreur de syntaxe" @@ -3412,6 +3554,7 @@ ER_SYNTAX_ERROR 42000 ita "Errore di sintassi nella query SQL" jpn "SQL構文エラーです。バージョンに対応するマニュアルを参照して正しい構文を確認してください。" kor "SQL 구문에 오류가 있습니다." + nla "Er is iets fout in de gebruikte syntax" nor "Something is wrong in your syntax" norwegian-ny "Something is wrong in your syntax" pol "Something is wrong in your syntax" @@ -3424,9 +3567,9 @@ ER_SYNTAX_ERROR 42000 swe "Du har något fel i din syntax" ukr "У вас помилка у синтаксисі SQL" ER_DELAYED_CANT_CHANGE_LOCK + chi "延迟插入线程无法获得 %-.192s 的请求锁定" cze "Zpožděný insert threadu nebyl schopen získat požadovaný zámek pro tabulku %-.192s" dan "Forsinket indsættelse tråden (delayed insert thread) kunne ikke opnå lås på tabellen %-.192s" - nla "'Delayed insert' thread kon de aangevraagde 'lock' niet krijgen voor tabel %-.192s" eng "Delayed insert thread couldn't get requested lock for table %-.192s" est "INSERT DELAYED lõim ei suutnud saada soovitud lukku tabelile %-.192s" fre "La tâche 'delayed insert' n'a pas pu obtenir le verrou démandé sur la table %-.192s" @@ -3435,6 +3578,7 @@ ER_DELAYED_CANT_CHANGE_LOCK ita "Il thread di inserimento ritardato non riesce ad ottenere il lock per la tabella %-.192s" jpn "'Delayed insert'スレッドが表 '%-.192s' のロックを取得できませんでした。" kor "지연된 insert 쓰레드가 테이블 %-.192s의 요구된 락킹을 처리할 수 없었습니다." + nla "'Delayed insert' thread kon de aangevraagde 'lock' niet krijgen voor tabel %-.192s" por "'Thread' de inserção retardada (atrasada) pois não conseguiu obter a trava solicitada para tabela '%-.192s'" rum "Thread-ul pentru inserarea aminata nu a putut obtine lacatul (lock) pentru tabela %-.192s" rus "Поток, обслуживающий отложенную вставку (delayed insert), не смог получить запрашиваемую блокировку на таблицу %-.192s" @@ -3443,9 +3587,9 @@ ER_DELAYED_CANT_CHANGE_LOCK swe "DELAYED INSERT-tråden kunde inte låsa tabell '%-.192s'" ukr "Гілка для INSERT DELAYED не може отримати блокування для таблиці %-.192s" ER_TOO_MANY_DELAYED_THREADS + chi "使用中的延迟线程太多" cze "Příliš mnoho zpožděných threadů" dan "For mange slettede tråde (threads) i brug" - nla "Te veel 'delayed' threads in gebruik" eng "Too many delayed threads in use" est "Liiga palju DELAYED lõimesid kasutusel" fre "Trop de tâche 'delayed' en cours" @@ -3455,6 +3599,7 @@ ER_TOO_MANY_DELAYED_THREADS ita "Troppi threads ritardati in uso" jpn "'Delayed insert'スレッドが多すぎます。" kor "너무 많은 지연 쓰레드를 사용하고 있습니다." + nla "Te veel 'delayed' threads in gebruik" por "Excesso de 'threads' retardadas (atrasadas) em uso" rum "Prea multe threaduri aminate care sint in uz" rus "Слишком много потоков, обслуживающих отложенную вставку (delayed insert)" @@ -3463,9 +3608,9 @@ ER_TOO_MANY_DELAYED_THREADS swe "Det finns redan 'max_delayed_threads' trådar i använding" ukr "Забагато затриманих гілок використовується" ER_ABORTING_CONNECTION 08S01 + chi "终止连线 %ld 数据库: '%-.192s' 用户: '%-.48s' (%-.64s)" cze "Zrušeno spojení %ld do databáze: '%-.192s' uživatel: '%-.48s' (%-.64s)" dan "Afbrudt forbindelse %ld til database: '%-.192s' bruger: '%-.48s' (%-.64s)" - nla "Afgebroken verbinding %ld naar db: '%-.192s' gebruiker: '%-.48s' (%-.64s)" eng "Aborted connection %ld to db: '%-.192s' user: '%-.48s' (%-.64s)" est "Ühendus katkestatud %ld andmebaasile: '%-.192s' kasutajale: '%-.48s' (%-.64s)" fre "Connection %ld avortée vers la bd: '%-.192s' utilisateur: '%-.48s' (%-.64s)" @@ -3474,6 +3619,7 @@ ER_ABORTING_CONNECTION 08S01 ita "Interrotta la connessione %ld al db: '%-.192s' utente: '%-.48s' (%-.64s)" jpn "接続 %ld が中断されました。データベース: '%-.192s' ユーザー: '%-.48s' (%-.64s)" kor "데이타베이스 접속을 위한 연결 %ld가 중단됨 : '%-.192s' 사용자: '%-.48s' (%-.64s)" + nla "Afgebroken verbinding %ld naar db: '%-.192s' gebruiker: '%-.48s' (%-.64s)" nor "Aborted connection %ld to db: '%-.192s' user: '%-.48s' (%-.64s)" norwegian-ny "Aborted connection %ld to db: '%-.192s' user: '%-.48s' (%-.64s)" pol "Aborted connection %ld to db: '%-.192s' user: '%-.48s' (%-.64s)" @@ -3486,9 +3632,9 @@ ER_ABORTING_CONNECTION 08S01 swe "Avbröt länken för tråd %ld till db '%-.192s', användare '%-.48s' (%-.64s)" ukr "Перервано з'єднання %ld до бази данних: '%-.192s' користувача: '%-.48s' (%-.64s)" ER_NET_PACKET_TOO_LARGE 08S01 + chi "收到的数据包大于 'max_allowed_packet' 字节" cze "Zjištěn příchozí packet delší než 'max_allowed_packet'" dan "Modtog en datapakke som var større end 'max_allowed_packet'" - nla "Groter pakket ontvangen dan 'max_allowed_packet'" eng "Got a packet bigger than 'max_allowed_packet' bytes" est "Saabus suurem pakett kui lubatud 'max_allowed_packet' muutujaga" fre "Paquet plus grand que 'max_allowed_packet' reçu" @@ -3498,6 +3644,7 @@ ER_NET_PACKET_TOO_LARGE 08S01 ita "Ricevuto un pacchetto piu` grande di 'max_allowed_packet'" jpn "'max_allowed_packet'よりも大きなパケットを受信しました。" kor "'max_allowed_packet'보다 더큰 패킷을 받았습니다." + nla "Groter pakket ontvangen dan 'max_allowed_packet'" por "Obteve um pacote maior do que a taxa máxima de pacotes definida (max_allowed_packet)" rum "Un packet mai mare decit 'max_allowed_packet' a fost primit" rus "Полученный пакет больше, чем 'max_allowed_packet'" @@ -3506,9 +3653,9 @@ ER_NET_PACKET_TOO_LARGE 08S01 swe "Kommunkationspaketet är större än 'max_allowed_packet'" ukr "Отримано пакет більший ніж max_allowed_packet" ER_NET_READ_ERROR_FROM_PIPE 08S01 + chi "连接管道读取错误" cze "Zjištěna chyba při čtení z roury spojení" dan "Fik læsefejl fra forbindelse (connection pipe)" - nla "Kreeg leesfout van de verbindings pipe" eng "Got a read error from the connection pipe" est "Viga ühendustoru lugemisel" fre "Erreur de lecture reçue du pipe de connexion" @@ -3518,6 +3665,7 @@ ER_NET_READ_ERROR_FROM_PIPE 08S01 ita "Rilevato un errore di lettura dalla pipe di connessione" jpn "接続パイプの読み込みエラーです。" kor "연결 파이프로부터 에러가 발생하였습니다." + nla "Kreeg leesfout van de verbindings pipe" por "Obteve um erro de leitura no 'pipe' da conexão" rum "Eroare la citire din cauza lui 'connection pipe'" rus "Получена ошибка чтения от потока соединения (connection pipe)" @@ -3526,9 +3674,9 @@ ER_NET_READ_ERROR_FROM_PIPE 08S01 swe "Fick läsfel från klienten vid läsning från 'PIPE'" ukr "Отримано помилку читання з комунікаційного каналу" ER_NET_FCNTL_ERROR 08S01 + chi "fcntl()的错误" cze "Zjištěna chyba fcntl()" dan "Fik fejlmeddelelse fra fcntl()" - nla "Kreeg fout van fcntl()" eng "Got an error from fcntl()" est "fcntl() tagastas vea" fre "Erreur reçue de fcntl() " @@ -3538,6 +3686,7 @@ ER_NET_FCNTL_ERROR 08S01 ita "Rilevato un errore da fcntl()" jpn "fcntl()がエラーを返しました。" kor "fcntl() 함수로부터 에러가 발생하였습니다." + nla "Kreeg fout van fcntl()" por "Obteve um erro em fcntl()" rum "Eroare obtinuta de la fcntl()" rus "Получена ошибка от fcntl()" @@ -3546,9 +3695,9 @@ ER_NET_FCNTL_ERROR 08S01 swe "Fick fatalt fel från 'fcntl()'" ukr "Отримано помилкку від fcntl()" ER_NET_PACKETS_OUT_OF_ORDER 08S01 + chi "数据包乱序" cze "Příchozí packety v chybném pořadí" dan "Modtog ikke datapakker i korrekt rækkefølge" - nla "Pakketten in verkeerde volgorde ontvangen" eng "Got packets out of order" est "Paketid saabusid vales järjekorras" fre "Paquets reçus dans le désordre" @@ -3558,6 +3707,7 @@ ER_NET_PACKETS_OUT_OF_ORDER 08S01 ita "Ricevuti pacchetti non in ordine" jpn "不正な順序のパケットを受信しました。" kor "순서가 맞지않는 패킷을 받았습니다." + nla "Pakketten in verkeerde volgorde ontvangen" por "Obteve pacotes fora de ordem" rum "Packets care nu sint ordonati au fost gasiti" rus "Пакеты получены в неверном порядке" @@ -3566,9 +3716,9 @@ ER_NET_PACKETS_OUT_OF_ORDER 08S01 swe "Kommunikationspaketen kom i fel ordning" ukr "Отримано пакети у неналежному порядку" ER_NET_UNCOMPRESS_ERROR 08S01 + chi "无法解压缩通信数据包" cze "Nemohu rozkomprimovat komunikační packet" dan "Kunne ikke dekomprimere kommunikations-pakke (communication packet)" - nla "Communicatiepakket kon niet worden gedecomprimeerd" eng "Couldn't uncompress communication packet" est "Viga andmepaketi lahtipakkimisel" fre "Impossible de décompresser le paquet reçu" @@ -3578,6 +3728,7 @@ ER_NET_UNCOMPRESS_ERROR 08S01 ita "Impossibile scompattare i pacchetti di comunicazione" jpn "圧縮パケットの展開ができませんでした。" kor "통신 패킷의 압축해제를 할 수 없었습니다." + nla "Communicatiepakket kon niet worden gedecomprimeerd" por "Não conseguiu descomprimir pacote de comunicação" rum "Nu s-a putut decompresa pachetul de comunicatie (communication packet)" rus "Невозможно распаковать пакет, полученный через коммуникационный протокол" @@ -3586,9 +3737,9 @@ ER_NET_UNCOMPRESS_ERROR 08S01 swe "Kunde inte packa up kommunikationspaketet" ukr "Не можу декомпресувати комунікаційний пакет" ER_NET_READ_ERROR 08S01 + chi "读取通信数据包出错" cze "Zjištěna chyba při čtení komunikačního packetu" dan "Fik fejlmeddelelse ved læsning af kommunikations-pakker (communication packets)" - nla "Fout bij het lezen van communicatiepakketten" eng "Got an error reading communication packets" est "Viga andmepaketi lugemisel" fre "Erreur de lecture des paquets reçus" @@ -3598,6 +3749,7 @@ ER_NET_READ_ERROR 08S01 ita "Rilevato un errore ricevendo i pacchetti di comunicazione" jpn "パケットの受信でエラーが発生しました。" kor "통신 패킷을 읽는 중 오류가 발생하였습니다." + nla "Fout bij het lezen van communicatiepakketten" por "Obteve um erro na leitura de pacotes de comunicação" rum "Eroare obtinuta citind pachetele de comunicatie (communication packets)" rus "Получена ошибка в процессе получения пакета через коммуникационный протокол " @@ -3606,9 +3758,9 @@ ER_NET_READ_ERROR 08S01 swe "Fick ett fel vid läsning från klienten" ukr "Отримано помилку читання комунікаційних пакетів" ER_NET_READ_INTERRUPTED 08S01 + chi "读取通信包超时" cze "Zjištěn timeout při čtení komunikačního packetu" dan "Timeout-fejl ved læsning af kommunukations-pakker (communication packets)" - nla "Timeout bij het lezen van communicatiepakketten" eng "Got timeout reading communication packets" est "Kontrollaja ületamine andmepakettide lugemisel" fre "Timeout en lecture des paquets reçus" @@ -3618,6 +3770,7 @@ ER_NET_READ_INTERRUPTED 08S01 ita "Rilevato un timeout ricevendo i pacchetti di comunicazione" jpn "パケットの受信でタイムアウトが発生しました。" kor "통신 패킷을 읽는 중 timeout이 발생하였습니다." + nla "Timeout bij het lezen van communicatiepakketten" por "Obteve expiração de tempo (timeout) na leitura de pacotes de comunicação" rum "Timeout obtinut citind pachetele de comunicatie (communication packets)" rus "Получен таймаут ожидания пакета через коммуникационный протокол " @@ -3626,9 +3779,9 @@ ER_NET_READ_INTERRUPTED 08S01 swe "Fick 'timeout' vid läsning från klienten" ukr "Отримано затримку читання комунікаційних пакетів" ER_NET_ERROR_ON_WRITE 08S01 + chi "写入通信包时出错" cze "Zjištěna chyba při zápisu komunikačního packetu" dan "Fik fejlmeddelelse ved skrivning af kommunukations-pakker (communication packets)" - nla "Fout bij het schrijven van communicatiepakketten" eng "Got an error writing communication packets" est "Viga andmepaketi kirjutamisel" fre "Erreur d'écriture des paquets envoyés" @@ -3638,6 +3791,7 @@ ER_NET_ERROR_ON_WRITE 08S01 ita "Rilevato un errore inviando i pacchetti di comunicazione" jpn "パケットの送信でエラーが発生しました。" kor "통신 패킷을 기록하는 중 오류가 발생하였습니다." + nla "Fout bij het schrijven van communicatiepakketten" por "Obteve um erro na escrita de pacotes de comunicação" rum "Eroare in scrierea pachetelor de comunicatie (communication packets)" rus "Получена ошибка при передаче пакета через коммуникационный протокол " @@ -3646,9 +3800,9 @@ ER_NET_ERROR_ON_WRITE 08S01 swe "Fick ett fel vid skrivning till klienten" ukr "Отримано помилку запису комунікаційних пакетів" ER_NET_WRITE_INTERRUPTED 08S01 + chi "写入通信包超时" cze "Zjištěn timeout při zápisu komunikačního packetu" dan "Timeout-fejl ved skrivning af kommunukations-pakker (communication packets)" - nla "Timeout bij het schrijven van communicatiepakketten" eng "Got timeout writing communication packets" est "Kontrollaja ületamine andmepakettide kirjutamisel" fre "Timeout d'écriture des paquets envoyés" @@ -3658,6 +3812,7 @@ ER_NET_WRITE_INTERRUPTED 08S01 ita "Rilevato un timeout inviando i pacchetti di comunicazione" jpn "パケットの送信でタイムアウトが発生しました。" kor "통신 패팃을 기록하는 중 timeout이 발생하였습니다." + nla "Timeout bij het schrijven van communicatiepakketten" por "Obteve expiração de tempo ('timeout') na escrita de pacotes de comunicação" rum "Timeout obtinut scriind pachetele de comunicatie (communication packets)" rus "Получен таймаут в процессе передачи пакета через коммуникационный протокол " @@ -3666,18 +3821,19 @@ ER_NET_WRITE_INTERRUPTED 08S01 swe "Fick 'timeout' vid skrivning till klienten" ukr "Отримано затримку запису комунікаційних пакетів" ER_TOO_LONG_STRING 42000 + chi "结果字符串长于'max_allowed_packet'字节" cze "Výsledný řetězec je delší než 'max_allowed_packet'" dan "Strengen med resultater er større end 'max_allowed_packet'" - nla "Resultaat string is langer dan 'max_allowed_packet'" eng "Result string is longer than 'max_allowed_packet' bytes" est "Tulemus on pikem kui lubatud 'max_allowed_packet' muutujaga" fre "La chaîne résultat est plus grande que 'max_allowed_packet'" ger "Ergebnis-String ist länger als 'max_allowed_packet' Bytes" - kor "결과 문자열이 설정된 max_allowed_packet 값보다 큽니다." hindi "रिजल्ट स्ट्रिंग 'max_allowed_packet' से लंबा है" hun "Ez eredmeny sztring nagyobb, mint a lehetseges maximum: 'max_allowed_packet'" ita "La stringa di risposta e` piu` lunga di 'max_allowed_packet'" jpn "結果の文字列が 'max_allowed_packet' よりも大きいです。" + kor "결과 문자열이 설정된 max_allowed_packet 값보다 큽니다." + nla "Resultaat string is langer dan 'max_allowed_packet'" por "'String' resultante é mais longa do que 'max_allowed_packet'" rum "Sirul rezultat este mai lung decit 'max_allowed_packet'" rus "Результирующая строка больше, чем 'max_allowed_packet'" @@ -3686,17 +3842,18 @@ ER_TOO_LONG_STRING 42000 swe "Resultatsträngen är längre än max_allowed_packet" ukr "Строка результату довша ніж max_allowed_packet" ER_TABLE_CANT_HANDLE_BLOB 42000 + chi "存储引擎%s不支持blob / text列" cze "Typ použité tabulky (%s) nepodporuje BLOB/TEXT sloupce" dan "Denne tabeltype (%s) understøtter ikke brug af BLOB og TEXT kolonner" - nla "Het gebruikte tabel type (%s) ondersteunt geen BLOB/TEXT kolommen" eng "Storage engine %s doesn't support BLOB/TEXT columns" est "Valitud tabelitüüp (%s) ei toeta BLOB/TEXT tüüpi välju" fre "Ce type de table (%s) ne supporte pas les colonnes BLOB/TEXT" ger "Der verwendete Tabellentyp (%s) unterstützt keine BLOB- und TEXT-Felder" hindi "स्टोरेज इंजन %s BLOB/TEXT कॉलम्स को सपोर्ट नहीं करता" hun "A hasznalt tabla tipus (%s) nem tamogatja a BLOB/TEXT mezoket" - kor "스토리지 엔진 (%s)는 BLOB/TEXT 컬럼을 지원하지 않습니다." ita "Il tipo di tabella usata (%s) non supporta colonne di tipo BLOB/TEXT" + kor "스토리지 엔진 (%s)는 BLOB/TEXT 컬럼을 지원하지 않습니다." + nla "Het gebruikte tabel type (%s) ondersteunt geen BLOB/TEXT kolommen" por "Tipo de tabela usado (%s) não permite colunas BLOB/TEXT" rum "Tipul de tabela folosit (%s) nu suporta coloane de tip BLOB/TEXT" rus "%s таблицы не поддерживают типы BLOB/TEXT" @@ -3705,17 +3862,18 @@ ER_TABLE_CANT_HANDLE_BLOB 42000 swe "Den använda tabelltypen (%s) kan inte hantera BLOB/TEXT-kolumner" ukr "%s таблиці не підтримують BLOB/TEXT стовбці" ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 42000 + chi "存储引擎%s不支持auto_increment列" cze "Typ použité tabulky (%s) nepodporuje AUTO_INCREMENT sloupce" dan "Denne tabeltype understøtter (%s) ikke brug af AUTO_INCREMENT kolonner" - nla "Het gebruikte tabel type (%s) ondersteunt geen AUTO_INCREMENT kolommen" eng "Storage engine %s doesn't support AUTO_INCREMENT columns" est "Valitud tabelitüüp (%s) ei toeta AUTO_INCREMENT tüüpi välju" fre "Ce type de table (%s) ne supporte pas les colonnes AUTO_INCREMENT" ger "Der verwendete Tabellentyp (%s) unterstützt keine AUTO_INCREMENT-Felder" hindi "स्टोरेज इंजन %s AUTO_INCREMENT कॉलम्स को सपोर्ट नहीं करता" - kor "스토리지 엔진 (%s)는 AUTO_INCREMENT를 지원하지 않습니다." hun "A hasznalt tabla tipus (%s) nem tamogatja az AUTO_INCREMENT tipusu mezoket" ita "Il tipo di tabella usata (%s) non supporta colonne di tipo AUTO_INCREMENT" + kor "스토리지 엔진 (%s)는 AUTO_INCREMENT를 지원하지 않습니다." + nla "Het gebruikte tabel type (%s) ondersteunt geen AUTO_INCREMENT kolommen" por "Tipo de tabela usado (%s) não permite colunas AUTO_INCREMENT" rum "Tipul de tabela folosit (%s) nu suporta coloane de tip AUTO_INCREMENT" rus "%s таблицы не поддерживают автоинкрементные столбцы" @@ -3724,9 +3882,9 @@ ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 42000 swe "Den använda tabelltypen (%s) kan inte hantera AUTO_INCREMENT-kolumner" ukr "%s таблиці не підтримують AUTO_INCREMENT стовбці" ER_DELAYED_INSERT_TABLE_LOCKED + chi "INSERT DELAYED 不能用在表 '%-.192s' 因为它被LOCK TABLES 锁定" cze "INSERT DELAYED není možno s tabulkou '%-.192s' použít, protože je zamčená pomocí LOCK TABLES" dan "INSERT DELAYED kan ikke bruges med tabellen '%-.192s', fordi tabellen er låst med LOCK TABLES" - nla "INSERT DELAYED kan niet worden gebruikt bij table '%-.192s', vanwege een 'lock met LOCK TABLES" eng "INSERT DELAYED can't be used with table '%-.192s' because it is locked with LOCK TABLES" est "INSERT DELAYED ei saa kasutada tabeli '%-.192s' peal, kuna see on lukustatud LOCK TABLES käsuga" fre "INSERT DELAYED ne peut être utilisé avec la table '%-.192s', car elle est verrouée avec LOCK TABLES" @@ -3736,6 +3894,7 @@ ER_DELAYED_INSERT_TABLE_LOCKED ita "L'inserimento ritardato (INSERT DELAYED) non puo` essere usato con la tabella '%-.192s', perche` soggetta a lock da 'LOCK TABLES'" jpn "表 '%-.192s' はLOCK TABLESでロックされているため、INSERT DELAYEDを使用できません。" kor "INSERT DELAYED can't be used with table '%-.192s', because it is locked with LOCK TABLES" + nla "INSERT DELAYED kan niet worden gebruikt bij table '%-.192s', vanwege een 'lock met LOCK TABLES" nor "INSERT DELAYED can't be used with table '%-.192s', because it is locked with LOCK TABLES" norwegian-ny "INSERT DELAYED can't be used with table '%-.192s', because it is locked with LOCK TABLES" pol "INSERT DELAYED can't be used with table '%-.192s', because it is locked with LOCK TABLES" @@ -3748,9 +3907,9 @@ ER_DELAYED_INSERT_TABLE_LOCKED swe "INSERT DELAYED kan inte användas med tabell '%-.192s', emedan den är låst med LOCK TABLES" ukr "INSERT DELAYED не може бути використано з таблицею '%-.192s', тому що її заблоковано з LOCK TABLES" ER_WRONG_COLUMN_NAME 42000 + chi "错误列名 '%-.100s'" cze "Nesprávné jméno sloupce '%-.100s'" dan "Forkert kolonnenavn '%-.100s'" - nla "Incorrecte kolom naam '%-.100s'" eng "Incorrect column name '%-.100s'" est "Vigane tulba nimi '%-.100s'" fre "Nom de colonne '%-.100s' incorrect" @@ -3759,6 +3918,7 @@ ER_WRONG_COLUMN_NAME 42000 hun "Ervenytelen mezonev: '%-.100s'" ita "Nome colonna '%-.100s' non corretto" jpn "列名 '%-.100s' は不正です。" + nla "Incorrecte kolom naam '%-.100s'" por "Nome de coluna '%-.100s' incorreto" rum "Nume increct de coloana '%-.100s'" rus "Неверное имя столбца '%-.100s'" @@ -3767,6 +3927,7 @@ ER_WRONG_COLUMN_NAME 42000 swe "Felaktigt kolumnnamn '%-.100s'" ukr "Невірне ім'я стовбця '%-.100s'" ER_WRONG_KEY_COLUMN 42000 + chi "存储引擎 %s 不能给 %`s 列建索引" eng "The storage engine %s can't index column %`s" ger "Die Speicher-Engine %s kann die Spalte %`s nicht indizieren" hindi "स्टोरेज इंजन %s, कॉलम %`s को इंडेक्स नहीं कर सकता" @@ -3774,9 +3935,9 @@ ER_WRONG_KEY_COLUMN 42000 spa "El motor de almacenaje %s no puede indizar la columna %`s" ukr "Вказівник таблиц %s не може індексувати стовбець %`s" ER_WRONG_MRG_TABLE + chi "无法打开定义不同或非 MyISAM 类型或不存在的表" cze "Všechny tabulky v MERGE tabulce nejsou definovány stejně" dan "Tabellerne i MERGE er ikke defineret ens" - nla "Niet alle tabellen in de MERGE tabel hebben identieke gedefinities" eng "Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist" est "Kõik tabelid MERGE tabeli määratluses ei ole identsed" fre "Toutes les tables de la table de type MERGE n'ont pas la même définition" @@ -3785,6 +3946,7 @@ ER_WRONG_MRG_TABLE ita "Non tutte le tabelle nella tabella di MERGE sono definite in maniera identica" jpn "MERGE表の構成表がオープンできません。列定義が異なるか、MyISAM表ではないか、存在しません。" kor "All tables in the MERGE table are not defined identically" + nla "Niet alle tabellen in de MERGE tabel hebben identieke gedefinities" nor "All tables in the MERGE table are not defined identically" norwegian-ny "All tables in the MERGE table are not defined identically" pol "All tables in the MERGE table are not defined identically" @@ -3797,16 +3959,17 @@ ER_WRONG_MRG_TABLE swe "Tabellerna i MERGE-tabellen är inte identiskt definierade" ukr "Таблиці у MERGE TABLE мають різну структуру" ER_DUP_UNIQUE 23000 + chi "因为表'%-.192s' 唯一约束,无法写入" cze "Kvůli unique constraintu nemozu zapsat do tabulky '%-.192s'" dan "Kan ikke skrive til tabellen '%-.192s' fordi det vil bryde CONSTRAINT regler" - nla "Kan niet opslaan naar table '%-.192s' vanwege 'unique' beperking" eng "Can't write, because of unique constraint, to table '%-.192s'" est "Ei suuda kirjutada tabelisse '%-.192s', kuna see rikub ühesuse kitsendust" fre "Écriture impossible à cause d'un index UNIQUE sur la table '%-.192s'" ger "Schreiben in Tabelle '%-.192s' nicht möglich wegen einer Eindeutigkeitsbeschränkung (unique constraint)" hun "A '%-.192s' nem irhato, az egyedi mezok miatt" - jpn "一意性制約違反のため、表 '%-.192s' に書き込めません。" ita "Impossibile scrivere nella tabella '%-.192s' per limitazione di unicita`" + jpn "一意性制約違反のため、表 '%-.192s' に書き込めません。" + nla "Kan niet opslaan naar table '%-.192s' vanwege 'unique' beperking" por "Não pode gravar, devido à restrição UNIQUE, na tabela '%-.192s'" rum "Nu pot scrie pe hard-drive, din cauza constraintului unic (unique constraint) pentru tabela '%-.192s'" rus "Невозможно записать в таблицу '%-.192s' из-за ограничений уникального ключа" @@ -3815,9 +3978,9 @@ ER_DUP_UNIQUE 23000 swe "Kan inte skriva till tabell '%-.192s'; UNIQUE-test" ukr "Не можу записати до таблиці '%-.192s', з причини вимог унікальності" ER_BLOB_KEY_WITHOUT_LENGTH 42000 + chi "BLOB/TEXT 列 '%-.192s' 在没有索引长度的索引规范中使用" cze "BLOB sloupec '%-.192s' je použit ve specifikaci klíče bez délky" dan "BLOB kolonnen '%-.192s' brugt i nøglespecifikation uden nøglelængde" - nla "BLOB kolom '%-.192s' gebruikt in zoeksleutel specificatie zonder zoeksleutel lengte" eng "BLOB/TEXT column '%-.192s' used in key specification without a key length" est "BLOB-tüüpi tulp '%-.192s' on kasutusel võtmes ilma pikkust määratlemata" fre "La colonne '%-.192s' de type BLOB est utilisée dans une définition d'index sans longueur d'index" @@ -3827,6 +3990,7 @@ ER_BLOB_KEY_WITHOUT_LENGTH 42000 ita "La colonna '%-.192s' di tipo BLOB e` usata in una chiave senza specificarne la lunghezza" jpn "BLOB列 '%-.192s' をキーに使用するには長さ指定が必要です。" kor "BLOB column '%-.192s' used in key specification without a key length" + nla "BLOB kolom '%-.192s' gebruikt in zoeksleutel specificatie zonder zoeksleutel lengte" nor "BLOB column '%-.192s' used in key specification without a key length" norwegian-ny "BLOB column '%-.192s' used in key specification without a key length" pol "BLOB column '%-.192s' used in key specification without a key length" @@ -3839,9 +4003,9 @@ ER_BLOB_KEY_WITHOUT_LENGTH 42000 swe "Du har inte angett någon nyckellängd för BLOB '%-.192s'" ukr "Стовбець BLOB '%-.192s' використано у визначенні ключа без вказання довжини ключа" ER_PRIMARY_CANT_HAVE_NULL 42000 + chi "PRIMARY KEY 的所有部分都不能为NULL;如果您需要在键中使用 NULL,请改用 UNIQUE" cze "Všechny části primárního klíče musejí být NOT NULL; pokud potřebujete NULL, použijte UNIQUE" dan "Alle dele af en PRIMARY KEY skal være NOT NULL; Hvis du skal bruge NULL i nøglen, brug UNIQUE istedet" - nla "Alle delen van een PRIMARY KEY moeten NOT NULL zijn; Indien u NULL in een zoeksleutel nodig heeft kunt u UNIQUE gebruiken" eng "All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead" est "Kõik PRIMARY KEY peavad olema määratletud NOT NULL piiranguga; vajadusel kasuta UNIQUE tüüpi võtit" fre "Toutes les parties d'un index PRIMARY KEY doivent être NOT NULL; Si vous avez besoin d'un NULL dans l'index, utilisez un index UNIQUE" @@ -3850,6 +4014,7 @@ ER_PRIMARY_CANT_HAVE_NULL 42000 hun "Az elsodleges kulcs teljes egeszeben csak NOT NULL tipusu lehet; Ha NULL mezot szeretne a kulcskent, hasznalja inkabb a UNIQUE-ot" ita "Tutte le parti di una chiave primaria devono essere dichiarate NOT NULL; se necessitano valori NULL nelle chiavi utilizzare UNIQUE" jpn "PRIMARY KEYの列は全てNOT NULLでなければいけません。UNIQUE索引であればNULLを含むことが可能です。" + nla "Alle delen van een PRIMARY KEY moeten NOT NULL zijn; Indien u NULL in een zoeksleutel nodig heeft kunt u UNIQUE gebruiken" por "Todas as partes de uma chave primária devem ser não-nulas. Se você precisou usar um valor nulo (NULL) em uma chave, use a cláusula UNIQUE em seu lugar" rum "Toate partile unei chei primare (PRIMARY KEY) trebuie sa fie NOT NULL; Daca aveti nevoie de NULL in vreo cheie, folositi UNIQUE in schimb" rus "Все части первичного ключа (PRIMARY KEY) должны быть определены как NOT NULL; Если вам нужна поддержка величин NULL в ключе, воспользуйтесь индексом UNIQUE" @@ -3858,9 +4023,9 @@ ER_PRIMARY_CANT_HAVE_NULL 42000 swe "Alla delar av en PRIMARY KEY måste vara NOT NULL; Om du vill ha en nyckel med NULL, använd UNIQUE istället" ukr "Усі частини PRIMARY KEY повинні бути NOT NULL; Якщо ви потребуєте NULL у ключі, скористайтеся UNIQUE" ER_TOO_MANY_ROWS 42000 + chi "结果多于一行" cze "Výsledek obsahuje více než jeden řádek" dan "Resultatet bestod af mere end een række" - nla "Resultaat bevatte meer dan een rij" eng "Result consisted of more than one row" est "Tulemis oli rohkem kui üks kirje" fre "Le résultat contient plus d'un enregistrement" @@ -3869,6 +4034,7 @@ ER_TOO_MANY_ROWS 42000 hun "Az eredmeny tobb, mint egy sort tartalmaz" ita "Il risultato consiste di piu` di una riga" jpn "結果が2行以上です。" + nla "Resultaat bevatte meer dan een rij" por "O resultado consistiu em mais do que uma linha" rum "Resultatul constista din mai multe linii" rus "В результате возвращена более чем одна строка" @@ -3877,9 +4043,9 @@ ER_TOO_MANY_ROWS 42000 swe "Resultet bestod av mera än en rad" ukr "Результат знаходиться у більше ніж одній строці" ER_REQUIRES_PRIMARY_KEY 42000 + chi "此表类型需要主索引" cze "Tento typ tabulky vyžaduje primární klíč" dan "Denne tabeltype kræver en primærnøgle" - nla "Dit tabel type heeft een primaire zoeksleutel nodig" eng "This table type requires a primary key" est "Antud tabelitüüp nõuab primaarset võtit" fre "Ce type de table nécessite une clé primaire (PRIMARY KEY)" @@ -3888,6 +4054,7 @@ ER_REQUIRES_PRIMARY_KEY 42000 hun "Az adott tablatipushoz elsodleges kulcs hasznalata kotelezo" ita "Questo tipo di tabella richiede una chiave primaria" jpn "使用のストレージエンジンでは、PRIMARY KEYが必要です。" + nla "Dit tabel type heeft een primaire zoeksleutel nodig" por "Este tipo de tabela requer uma chave primária" rum "Aceast tip de tabela are nevoie de o cheie primara" rus "Этот тип таблицы требует определения первичного ключа" @@ -3896,9 +4063,9 @@ ER_REQUIRES_PRIMARY_KEY 42000 swe "Denna tabelltyp kräver en PRIMARY KEY" ukr "Цей тип таблиці потребує первинного ключа" ER_NO_RAID_COMPILED + chi "这个版本的 MariaDB 编译时不支持 RAID" cze "Tato verze MariaDB není zkompilována s podporou RAID" dan "Denne udgave af MariaDB er ikke oversat med understøttelse af RAID" - nla "Deze versie van MariaDB is niet gecompileerd met RAID ondersteuning" eng "This version of MariaDB is not compiled with RAID support" est "Antud MariaDB versioon on kompileeritud ilma RAID toeta" fre "Cette version de MariaDB n'est pas compilée avec le support RAID" @@ -3907,6 +4074,7 @@ ER_NO_RAID_COMPILED hun "Ezen leforditott MariaDB verzio nem tartalmaz RAID support-ot" ita "Questa versione di MariaDB non e` compilata con il supporto RAID" jpn "このバージョンのMariaDBはRAIDサポートを含めてコンパイルされていません。" + nla "Deze versie van MariaDB is niet gecompileerd met RAID ondersteuning" por "Esta versão do MariaDB não foi compilada com suporte a RAID" rum "Aceasta versiune de MariaDB, nu a fost compilata cu suport pentru RAID" rus "Эта версия MariaDB скомпилирована без поддержки RAID" @@ -3915,9 +4083,9 @@ ER_NO_RAID_COMPILED swe "Denna version av MariaDB är inte kompilerad med RAID" ukr "Ця версія MariaDB не зкомпільована з підтримкою RAID" ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE + chi "您正在使用安全更新模式,同时您尝试更新时没有使用含有 KEY 列的 WHERE 语句" cze "Update tabulky bez WHERE s klíčem není v módu bezpečných update dovoleno" dan "Du bruger sikker opdaterings modus ('safe update mode') og du forsøgte at opdatere en tabel uden en WHERE klausul, der gør brug af et KEY felt" - nla "U gebruikt 'safe update mode' en u probeerde een tabel te updaten zonder een WHERE met een KEY kolom" eng "You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column" est "Katse muuta tabelit turvalises rezhiimis ilma WHERE klauslita" fre "Vous êtes en mode 'safe update' et vous essayez de faire un UPDATE sans clause WHERE utilisant un index" @@ -3925,6 +4093,7 @@ ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE hun "On a biztonsagos update modot hasznalja, es WHERE that uses a KEY column" ita "In modalita` 'safe update' si e` cercato di aggiornare una tabella senza clausola WHERE su una chiave" jpn "'safe update mode'で、索引を利用するWHERE句の無い更新処理を実行しようとしました。" + nla "U gebruikt 'safe update mode' en u probeerde een tabel te updaten zonder een WHERE met een KEY kolom" por "Você está usando modo de atualização seguro e tentou atualizar uma tabela sem uma cláusula WHERE que use uma coluna chave" rus "Вы работаете в режиме безопасных обновлений (safe update mode) и попробовали изменить таблицу без использования ключевого столбца в части WHERE" serbian "Vi koristite safe update mod servera, a probali ste da promenite podatke bez 'WHERE' komande koja koristi kolonu ključa" @@ -3932,9 +4101,9 @@ ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE swe "Du använder 'säker uppdateringsmod' och försökte uppdatera en tabell utan en WHERE-sats som använder sig av en nyckel" ukr "Ви у режимі безпечного оновлення та намагаєтесь оновити таблицю без оператора WHERE, що використовує KEY стовбець" ER_KEY_DOES_NOT_EXISTS 42000 S1009 + chi "索引 '%-.192s' 在表 '%-.192s' 里不存在" cze "Klíč '%-.192s' v tabulce '%-.192s' neexistuje" dan "Nøglen '%-.192s' eksisterer ikke i tabellen '%-.192s'" - nla "Zoeksleutel '%-.192s' bestaat niet in tabel '%-.192s'" eng "Key '%-.192s' doesn't exist in table '%-.192s'" est "Võti '%-.192s' ei eksisteeri tabelis '%-.192s'" fre "L'index '%-.192s' n'existe pas sur la table '%-.192s'" @@ -3943,6 +4112,7 @@ ER_KEY_DOES_NOT_EXISTS 42000 S1009 hun "A '%-.192s' kulcs nem letezik a '%-.192s' tablaban" ita "La chiave '%-.192s' non esiste nella tabella '%-.192s'" jpn "索引 '%-.192s' は表 '%-.192s' には存在しません。" + nla "Zoeksleutel '%-.192s' bestaat niet in tabel '%-.192s'" por "Chave '%-.192s' não existe na tabela '%-.192s'" rus "Ключ '%-.192s' не существует в таблице '%-.192s'" serbian "Ključ '%-.192s' ne postoji u tabeli '%-.192s'" @@ -3950,9 +4120,9 @@ ER_KEY_DOES_NOT_EXISTS 42000 S1009 swe "Nyckel '%-.192s' finns inte in tabell '%-.192s'" ukr "Ключ '%-.192s' не існує в таблиці '%-.192s'" ER_CHECK_NO_SUCH_TABLE 42000 + chi "无法打开表" cze "Nemohu otevřít tabulku" dan "Kan ikke åbne tabellen" - nla "Kan tabel niet openen" eng "Can't open table" est "Ei suuda avada tabelit" fre "Impossible d'ouvrir la table" @@ -3961,6 +4131,7 @@ ER_CHECK_NO_SUCH_TABLE 42000 hun "Nem tudom megnyitni a tablat" ita "Impossibile aprire la tabella" jpn "表をオープンできません。" + nla "Kan tabel niet openen" por "Não pode abrir a tabela" rus "Невозможно открыть таблицу" serbian "Ne mogu da otvorim tabelu" @@ -3968,9 +4139,9 @@ ER_CHECK_NO_SUCH_TABLE 42000 swe "Kan inte öppna tabellen" ukr "Не можу відкрити таблицю" ER_CHECK_NOT_IMPLEMENTED 42000 + chi "该表的存储引擎不支持%s" cze "Handler tabulky nepodporuje %s" dan "Denne tabeltype understøtter ikke %s" - nla "De 'handler' voor de tabel ondersteund geen %s" eng "The storage engine for the table doesn't support %s" est "Antud tabelitüüp ei toeta %s käske" fre "Ce type de table ne supporte pas les %s" @@ -3981,6 +4152,7 @@ ER_CHECK_NOT_IMPLEMENTED 42000 ita "Il gestore per la tabella non supporta il %s" jpn "この表のストレージエンジンは '%s' を利用できません。" kor "The handler for the table doesn't support %s" + nla "De 'handler' voor de tabel ondersteund geen %s" nor "The handler for the table doesn't support %s" norwegian-ny "The handler for the table doesn't support %s" pol "The handler for the table doesn't support %s" @@ -3993,9 +4165,9 @@ ER_CHECK_NOT_IMPLEMENTED 42000 swe "Tabellhanteraren för denna tabell kan inte göra %s" ukr "Вказівник таблиці не підтримуе %s" ER_CANT_DO_THIS_DURING_AN_TRANSACTION 25000 + chi "不允许在事务中执行此命令" cze "Provedení tohoto příkazu není v transakci dovoleno" dan "Du må ikke bruge denne kommando i en transaktion" - nla "Het is u niet toegestaan dit commando uit te voeren binnen een transactie" eng "You are not allowed to execute this command in a transaction" est "Seda käsku ei saa kasutada transaktsiooni sees" fre "Vous n'êtes pas autorisé à exécute cette commande dans une transaction" @@ -4003,6 +4175,7 @@ ER_CANT_DO_THIS_DURING_AN_TRANSACTION 25000 hun "Az On szamara nem engedelyezett a parancs vegrehajtasa a tranzakcioban" ita "Non puoi eseguire questo comando in una transazione" jpn "このコマンドはトランザクション内で実行できません。" + nla "Het is u niet toegestaan dit commando uit te voeren binnen een transactie" por "Não lhe é permitido executar este comando em uma transação" rus "Вам не разрешено выполнять эту команду в транзакции" serbian "Nije Vam dozvoljeno da izvršite ovu komandu u transakciji" @@ -4010,9 +4183,9 @@ ER_CANT_DO_THIS_DURING_AN_TRANSACTION 25000 swe "Du får inte utföra detta kommando i en transaktion" ukr "Вам не дозволено виконувати цю команду в транзакції" ER_ERROR_DURING_COMMIT + chi "COMMIT时发生错误 %M " cze "Chyba %M při COMMIT" dan "Modtog fejl %M mens kommandoen COMMIT blev udført" - nla "Kreeg fout %M tijdens COMMIT" eng "Got error %M during COMMIT" est "Viga %M käsu COMMIT täitmisel" fre "Erreur %M lors du COMMIT" @@ -4021,6 +4194,7 @@ ER_ERROR_DURING_COMMIT hun "%M hiba a COMMIT vegrehajtasa soran" ita "Rilevato l'errore %M durante il COMMIT" jpn "COMMIT中にエラー %M が発生しました。" + nla "Kreeg fout %M tijdens COMMIT" por "Obteve erro %M durante COMMIT" rus "Получена ошибка %M в процессе COMMIT" serbian "Greška %M za vreme izvršavanja komande 'COMMIT'" @@ -4028,9 +4202,9 @@ ER_ERROR_DURING_COMMIT swe "Fick fel %M vid COMMIT" ukr "Отримано помилку %M під час COMMIT" ER_ERROR_DURING_ROLLBACK + chi "回滚时出错%M" cze "Chyba %M při ROLLBACK" dan "Modtog fejl %M mens kommandoen ROLLBACK blev udført" - nla "Kreeg fout %M tijdens ROLLBACK" eng "Got error %M during ROLLBACK" est "Viga %M käsu ROLLBACK täitmisel" fre "Erreur %M lors du ROLLBACK" @@ -4039,6 +4213,7 @@ ER_ERROR_DURING_ROLLBACK hun "%M hiba a ROLLBACK vegrehajtasa soran" ita "Rilevato l'errore %M durante il ROLLBACK" jpn "ROLLBACK中にエラー %M が発生しました。" + nla "Kreeg fout %M tijdens ROLLBACK" por "Obteve erro %M durante ROLLBACK" rus "Получена ошибка %M в процессе ROLLBACK" serbian "Greška %M za vreme izvršavanja komande 'ROLLBACK'" @@ -4046,9 +4221,9 @@ ER_ERROR_DURING_ROLLBACK swe "Fick fel %M vid ROLLBACK" ukr "Отримано помилку %M під час ROLLBACK" ER_ERROR_DURING_FLUSH_LOGS + chi "flush_logs时出错%M" cze "Chyba %M při FLUSH_LOGS" dan "Modtog fejl %M mens kommandoen FLUSH_LOGS blev udført" - nla "Kreeg fout %M tijdens FLUSH_LOGS" eng "Got error %M during FLUSH_LOGS" est "Viga %M käsu FLUSH_LOGS täitmisel" fre "Erreur %M lors du FLUSH_LOGS" @@ -4057,6 +4232,7 @@ ER_ERROR_DURING_FLUSH_LOGS hun "%M hiba a FLUSH_LOGS vegrehajtasa soran" ita "Rilevato l'errore %M durante il FLUSH_LOGS" jpn "FLUSH_LOGS中にエラー %M が発生しました。" + nla "Kreeg fout %M tijdens FLUSH_LOGS" por "Obteve erro %M durante FLUSH_LOGS" rus "Получена ошибка %M в процессе FLUSH_LOGS" serbian "Greška %M za vreme izvršavanja komande 'FLUSH_LOGS'" @@ -4064,9 +4240,9 @@ ER_ERROR_DURING_FLUSH_LOGS swe "Fick fel %M vid FLUSH_LOGS" ukr "Отримано помилку %M під час FLUSH_LOGS" ER_ERROR_DURING_CHECKPOINT + chi "CHECKPOINT时出错%M " cze "Chyba %M při CHECKPOINT" dan "Modtog fejl %M mens kommandoen CHECKPOINT blev udført" - nla "Kreeg fout %M tijdens CHECKPOINT" eng "Got error %M during CHECKPOINT" est "Viga %M käsu CHECKPOINT täitmisel" fre "Erreur %M lors du CHECKPOINT" @@ -4075,6 +4251,7 @@ ER_ERROR_DURING_CHECKPOINT hun "%M hiba a CHECKPOINT vegrehajtasa soran" ita "Rilevato l'errore %M durante il CHECKPOINT" jpn "CHECKPOINT中にエラー %M が発生しました。" + nla "Kreeg fout %M tijdens CHECKPOINT" por "Obteve erro %M durante CHECKPOINT" rus "Получена ошибка %M в процессе CHECKPOINT" serbian "Greška %M za vreme izvršavanja komande 'CHECKPOINT'" @@ -4082,15 +4259,16 @@ ER_ERROR_DURING_CHECKPOINT swe "Fick fel %M vid CHECKPOINT" ukr "Отримано помилку %M під час CHECKPOINT" ER_NEW_ABORTING_CONNECTION 08S01 + chi "终止的连接 %lld 到数据库: '%-.192s' 用户: '%-.48s' 主机: '%-.64s' (%-.64s)" cze "Spojení %lld do databáze: '%-.192s' uživatel: '%-.48s' stroj: '%-.64s' (%-.64s) bylo přerušeno" dan "Afbrød forbindelsen %lld til databasen '%-.192s' bruger: '%-.48s' vært: '%-.64s' (%-.64s)" - nla "Afgebroken verbinding %lld naar db: '%-.192s' gebruiker: '%-.48s' host: '%-.64s' (%-.64s)" eng "Aborted connection %lld to db: '%-.192s' user: '%-.48s' host: '%-.64s' (%-.64s)" est "Ühendus katkestatud %lld andmebaas: '%-.192s' kasutaja: '%-.48s' masin: '%-.64s' (%-.64s)" fre "Connection %lld avortée vers la bd: '%-.192s' utilisateur: '%-.48s' hôte: '%-.64s' (%-.64s)" ger "Abbruch der Verbindung %lld zur Datenbank '%-.192s'. Benutzer: '%-.48s', Host: '%-.64s' (%-.64s)" ita "Interrotta la connessione %lld al db: ''%-.192s' utente: '%-.48s' host: '%-.64s' (%-.64s)" jpn "接続 %lld が中断されました。データベース: '%-.192s' ユーザー: '%-.48s' ホスト: '%-.64s' (%-.64s)" + nla "Afgebroken verbinding %lld naar db: '%-.192s' gebruiker: '%-.48s' host: '%-.64s' (%-.64s)" por "Conexão %lld abortada para banco de dados '%-.192s' - usuário '%-.48s' - 'host' '%-.64s' ('%-.64s')" rus "Прервано соединение %lld к базе данных '%-.192s' пользователя '%-.48s' с хоста '%-.64s' (%-.64s)" serbian "Prekinuta konekcija broj %lld ka bazi: '%-.192s' korisnik je bio: '%-.48s' a host: '%-.64s' (%-.64s)" @@ -4098,9 +4276,11 @@ ER_NEW_ABORTING_CONNECTION 08S01 swe "Avbröt länken för tråd %lld till db '%-.192s', användare '%-.48s', host '%-.64s' (%-.64s)" ukr "Перервано з'єднання %lld до бази данних: '%-.192s' користувач: '%-.48s' хост: '%-.64s' (%-.64s)" ER_UNUSED_10 + chi "你应当永远看不到这个" eng "You should never see it" spa "Nunca lo debería vd de ver" ER_FLUSH_MASTER_BINLOG_CLOSED + chi "Binlog 已关闭, 不能 RESET MASTER" eng "Binlog closed, cannot RESET MASTER" ger "Binlog geschlossen. Kann RESET MASTER nicht ausführen" jpn "バイナリログがクローズされています。RESET MASTER を実行できません。" @@ -4110,9 +4290,9 @@ ER_FLUSH_MASTER_BINLOG_CLOSED spa "Binlog cerrado, no puedo hacer RESET MASTER" ukr "Реплікаційний лог закрито, не можу виконати RESET MASTER" ER_INDEX_REBUILD + chi "重建 dumped table '%-.192s' 的索引失败" cze "Přebudování indexu dumpnuté tabulky '%-.192s' nebylo úspěšné" dan "Kunne ikke genopbygge indekset for den dumpede tabel '%-.192s'" - nla "Gefaald tijdens heropbouw index van gedumpte tabel '%-.192s'" eng "Failed rebuilding the index of dumped table '%-.192s'" fre "La reconstruction de l'index de la table copiée '%-.192s' a échoué" ger "Neuerstellung des Index der Dump-Tabelle '%-.192s' fehlgeschlagen" @@ -4120,20 +4300,22 @@ ER_INDEX_REBUILD hun "Failed rebuilding the index of dumped table '%-.192s'" ita "Fallita la ricostruzione dell'indice della tabella copiata '%-.192s'" jpn "ダンプ表 '%-.192s' の索引再構築に失敗しました。" + nla "Gefaald tijdens heropbouw index van gedumpte tabel '%-.192s'" por "Falhou na reconstrução do índice da tabela 'dumped' '%-.192s'" rus "Ошибка перестройки индекса сохраненной таблицы '%-.192s'" serbian "Izgradnja indeksa dump-ovane tabele '%-.192s' nije uspela" spa "Fallo reconstruyendo el índice del volcado de la tabla '%-.192s'" ukr "Невдале відновлення індекса переданої таблиці '%-.192s'" ER_MASTER + chi "Master错误:'%-.64s'" cze "Chyba masteru: '%-.64s'" dan "Fejl fra master: '%-.64s'" - nla "Fout van master: '%-.64s'" eng "Error from master: '%-.64s'" fre "Erreur reçue du maître: '%-.64s'" ger "Fehler vom Master: '%-.64s'" ita "Errore dal master: '%-.64s" jpn "マスターでエラーが発生: '%-.64s'" + nla "Fout van master: '%-.64s'" por "Erro no 'master' '%-.64s'" rus "Ошибка от головного сервера: '%-.64s'" serbian "Greška iz glavnog servera '%-.64s' u klasteru" @@ -4141,14 +4323,15 @@ ER_MASTER swe "Fel från master: '%-.64s'" ukr "Помилка від головного: '%-.64s'" ER_MASTER_NET_READ 08S01 + chi "读master时有网络错误" cze "Síťová chyba při čtení z masteru" dan "Netværksfejl ved læsning fra master" - nla "Net fout tijdens lezen van master" eng "Net error reading from master" fre "Erreur de lecture réseau reçue du maître" ger "Netzfehler beim Lesen vom Master" ita "Errore di rete durante la ricezione dal master" jpn "マスターからのデータ受信中のネットワークエラー" + nla "Net fout tijdens lezen van master" por "Erro de rede lendo do 'master'" rus "Возникла ошибка чтения в процессе коммуникации с головным сервером" serbian "Greška u primanju mrežnih paketa sa glavnog servera u klasteru" @@ -4156,14 +4339,15 @@ ER_MASTER_NET_READ 08S01 swe "Fick nätverksfel vid läsning från master" ukr "Мережева помилка читання від головного" ER_MASTER_NET_WRITE 08S01 + chi "写master时有网络错误" cze "Síťová chyba při zápisu na master" dan "Netværksfejl ved skrivning til master" - nla "Net fout tijdens schrijven naar master" eng "Net error writing to master" fre "Erreur d'écriture réseau reçue du maître" ger "Netzfehler beim Schreiben zum Master" ita "Errore di rete durante l'invio al master" jpn "マスターへのデータ送信中のネットワークエラー" + nla "Net fout tijdens schrijven naar master" por "Erro de rede gravando no 'master'" rus "Возникла ошибка записи в процессе коммуникации с головным сервером" serbian "Greška u slanju mrežnih paketa na glavni server u klasteru" @@ -4171,15 +4355,16 @@ ER_MASTER_NET_WRITE 08S01 swe "Fick nätverksfel vid skrivning till master" ukr "Мережева помилка запису до головного" ER_FT_MATCHING_KEY_NOT_FOUND + chi "找不到与列列表匹配的全文索引" cze "Žádný sloupec nemá vytvořen fulltextový index" dan "Kan ikke finde en FULLTEXT nøgle som svarer til kolonne listen" - nla "Kan geen FULLTEXT index vinden passend bij de kolom lijst" eng "Can't find FULLTEXT index matching the column list" est "Ei suutnud leida FULLTEXT indeksit, mis kattuks kasutatud tulpadega" fre "Impossible de trouver un index FULLTEXT correspondant à cette liste de colonnes" ger "Kann keinen FULLTEXT-Index finden, der der Feldliste entspricht" ita "Impossibile trovare un indice FULLTEXT che corrisponda all'elenco delle colonne" jpn "列リストに対応する全文索引(FULLTEXT)が見つかりません。" + nla "Kan geen FULLTEXT index vinden passend bij de kolom lijst" por "Não pode encontrar um índice para o texto todo que combine com a lista de colunas" rus "Невозможно отыскать полнотекстовый (FULLTEXT) индекс, соответствующий списку столбцов" serbian "Ne mogu da pronađem 'FULLTEXT' indeks koli odgovara listi kolona" @@ -4187,15 +4372,16 @@ ER_FT_MATCHING_KEY_NOT_FOUND swe "Hittar inte ett FULLTEXT-index i kolumnlistan" ukr "Не можу знайти FULLTEXT індекс, що відповідає переліку стовбців" ER_LOCK_OR_ACTIVE_TRANSACTION + chi "无法执行给定的命令,因为表上有锁或有活动事务" cze "Nemohu provést zadaný příkaz, protože existují aktivní zamčené tabulky nebo aktivní transakce" dan "Kan ikke udføre den givne kommando fordi der findes aktive, låste tabeller eller fordi der udføres en transaktion" - nla "Kan het gegeven commando niet uitvoeren, want u heeft actieve gelockte tabellen of een actieve transactie" eng "Can't execute the given command because you have active locked tables or an active transaction" est "Ei suuda täita antud käsku kuna on aktiivseid lukke või käimasolev transaktsioon" fre "Impossible d'exécuter la commande car vous avez des tables verrouillées ou une transaction active" ger "Kann den angegebenen Befehl wegen einer aktiven Tabellensperre oder einer aktiven Transaktion nicht ausführen" ita "Impossibile eseguire il comando richiesto: tabelle sotto lock o transazione in atto" jpn "すでにアクティブな表ロックやトランザクションがあるため、コマンドを実行できません。" + nla "Kan het gegeven commando niet uitvoeren, want u heeft actieve gelockte tabellen of een actieve transactie" por "Não pode executar o comando dado porque você tem tabelas ativas travadas ou uma transação ativa" rus "Невозможно выполнить указанную команду, поскольку у вас присутствуют активно заблокированные таблица или открытая транзакция" serbian "Ne mogu da izvršim datu komandu zbog toga što su tabele zaključane ili je transakcija u toku" @@ -4203,9 +4389,9 @@ ER_LOCK_OR_ACTIVE_TRANSACTION swe "Kan inte utföra kommandot emedan du har en låst tabell eller an aktiv transaktion" ukr "Не можу виконати подану команду тому, що таблиця заблокована або виконується транзакція" ER_UNKNOWN_SYSTEM_VARIABLE + chi "未知系统变量 '%-.*s'" cze "Neznámá systémová proměnná '%-.*s'" dan "Ukendt systemvariabel '%-.*s'" - nla "Onbekende systeem variabele '%-.*s'" eng "Unknown system variable '%-.*s'" est "Tundmatu süsteemne muutuja '%-.*s'" fre "Variable système '%-.*s' inconnue" @@ -4213,6 +4399,7 @@ ER_UNKNOWN_SYSTEM_VARIABLE hindi "अज्ञात सिस्टम वैरिएबल '%-.*s'" ita "Variabile di sistema '%-.*s' sconosciuta" jpn "'%-.*s' は不明なシステム変数です。" + nla "Onbekende systeem variabele '%-.*s'" por "Variável de sistema '%-.*s' desconhecida" rus "Неизвестная системная переменная '%-.*s'" serbian "Nepoznata sistemska promenljiva '%-.*s'" @@ -4220,15 +4407,16 @@ ER_UNKNOWN_SYSTEM_VARIABLE swe "Okänd systemvariabel: '%-.*s'" ukr "Невідома системна змінна '%-.*s'" ER_CRASHED_ON_USAGE + chi "表'%-.192s'标记为崩溃,应该修复" cze "Tabulka '%-.192s' je označena jako porušená a měla by být opravena" dan "Tabellen '%-.192s' er markeret med fejl og bør repareres" - nla "Tabel '%-.192s' staat als gecrashed gemarkeerd en dient te worden gerepareerd" eng "Table '%-.192s' is marked as crashed and should be repaired" est "Tabel '%-.192s' on märgitud vigaseks ja tuleb parandada" fre "La table '%-.192s' est marquée 'crashed' et devrait être réparée" ger "Tabelle '%-.192s' ist als defekt markiert und sollte repariert werden" ita "La tabella '%-.192s' e` segnalata come corrotta e deve essere riparata" jpn "表 '%-.192s' は壊れています。修復が必要です。" + nla "Tabel '%-.192s' staat als gecrashed gemarkeerd en dient te worden gerepareerd" por "Tabela '%-.192s' está marcada como danificada e deve ser reparada" rus "Таблица '%-.192s' помечена как испорченная и должна пройти проверку и ремонт" serbian "Tabela '%-.192s' je markirana kao oštećena i trebala bi biti popravljena" @@ -4236,15 +4424,16 @@ ER_CRASHED_ON_USAGE swe "Tabell '%-.192s' är trasig och bör repareras med REPAIR TABLE" ukr "Таблицю '%-.192s' марковано як зіпсовану та її потрібно відновити" ER_CRASHED_ON_REPAIR + chi "表 '%-.192s' 被标记为崩溃,上一次的修复(自动?)失败" cze "Tabulka '%-.192s' je označena jako porušená a poslední (automatická?) oprava se nezdařila" dan "Tabellen '%-.192s' er markeret med fejl og sidste (automatiske?) REPAIR fejlede" - nla "Tabel '%-.192s' staat als gecrashed gemarkeerd en de laatste (automatische?) reparatie poging mislukte" eng "Table '%-.192s' is marked as crashed and last (automatic?) repair failed" est "Tabel '%-.192s' on märgitud vigaseks ja viimane (automaatne?) parandus ebaõnnestus" fre "La table '%-.192s' est marquée 'crashed' et le dernier 'repair' a échoué" ger "Tabelle '%-.192s' ist als defekt markiert und der letzte (automatische?) Reparaturversuch schlug fehl" ita "La tabella '%-.192s' e` segnalata come corrotta e l'ultima ricostruzione (automatica?) e` fallita" jpn "表 '%-.192s' は壊れています。修復(自動?)にも失敗しています。" + nla "Tabel '%-.192s' staat als gecrashed gemarkeerd en de laatste (automatische?) reparatie poging mislukte" por "Tabela '%-.192s' está marcada como danificada e a última reparação (automática?) falhou" rus "Таблица '%-.192s' помечена как испорченная и последний (автоматический?) ремонт не был успешным" serbian "Tabela '%-.192s' je markirana kao oštećena, a zadnja (automatska?) popravka je bila neuspela" @@ -4252,14 +4441,15 @@ ER_CRASHED_ON_REPAIR swe "Tabell '%-.192s' är trasig och senast (automatiska?) reparation misslyckades" ukr "Таблицю '%-.192s' марковано як зіпсовану та останнє (автоматичне?) відновлення не вдалося" ER_WARNING_NOT_COMPLETE_ROLLBACK + chi "某些非事务性更改的表无法回滚" dan "Advarsel: Visse data i tabeller der ikke understøtter transaktioner kunne ikke tilbagestilles" - nla "Waarschuwing: Roll back mislukt voor sommige buiten transacties gewijzigde tabellen" eng "Some non-transactional changed tables couldn't be rolled back" est "Hoiatus: mõnesid transaktsioone mittetoetavaid tabeleid ei suudetud tagasi kerida" fre "Attention: certaines tables ne supportant pas les transactions ont été changées et elles ne pourront pas être restituées" ger "Änderungen an einigen nicht transaktionalen Tabellen konnten nicht zurückgerollt werden" ita "Attenzione: Alcune delle modifiche alle tabelle non transazionali non possono essere ripristinate (roll back impossibile)" jpn "トランザクション対応ではない表への変更はロールバックされません。" + nla "Waarschuwing: Roll back mislukt voor sommige buiten transacties gewijzigde tabellen" por "Aviso: Algumas tabelas não-transacionais alteradas não puderam ser reconstituídas (rolled back)" rus "Внимание: по некоторым измененным нетранзакционным таблицам невозможно будет произвести откат транзакции" serbian "Upozorenje: Neke izmenjene tabele ne podržavaju komandu 'ROLLBACK'" @@ -4267,26 +4457,28 @@ ER_WARNING_NOT_COMPLETE_ROLLBACK swe "Warning: Några icke transaktionella tabeller kunde inte återställas vid ROLLBACK" ukr "Застереження: Деякі нетранзакційні зміни таблиць не можна буде повернути" ER_TRANS_CACHE_FULL + chi "多语句事务需要超过 'max_binlog_cache_size' 字节的存储空间;增加这个 mariadbd 变量后再试一次" dan "Fler-udtryks transaktion krævede mere plads en 'max_binlog_cache_size' bytes. Forhøj værdien af denne variabel og prøv igen" - nla "Multi-statement transactie vereist meer dan 'max_binlog_cache_size' bytes opslag. Verhoog deze mariadbd variabele en probeer opnieuw" - eng "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage" + eng "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again" est "Mitme lausendiga transaktsioon nõudis rohkem ruumi kui lubatud 'max_binlog_cache_size' muutujaga. Suurenda muutuja väärtust ja proovi uuesti" fre "Cette transaction à commandes multiples nécessite plus de 'max_binlog_cache_size' octets de stockage, augmentez cette variable de mariadbd et réessayez" ger "Transaktionen, die aus mehreren Befehlen bestehen, benötigten mehr als 'max_binlog_cache_size' Bytes an Speicher. Btte vergrössern Sie diese Server-Variable versuchen Sie es noch einmal" ita "La transazione a comandi multipli (multi-statement) ha richiesto piu` di 'max_binlog_cache_size' bytes di disco: aumentare questa variabile di mariadbd e riprovare" jpn "複数ステートメントから成るトランザクションが 'max_binlog_cache_size' 以上の容量を必要としました。このシステム変数を増加して、再試行してください。" + nla "Multi-statement transactie vereist meer dan 'max_binlog_cache_size' bytes opslag. Verhoog deze mariadbd variabele en probeer opnieuw" por "Transações multi-declaradas (multi-statement transactions) requeriram mais do que o valor limite (max_binlog_cache_size) de bytes para armazenagem. Aumente o valor desta variável do mariadbd e tente novamente" rus "Транзакции, включающей большое количество команд, потребовалось более чем 'max_binlog_cache_size' байт. Увеличьте эту переменную сервера mariadbd и попробуйте еще раз" spa "Transacción multi-sentencia requirió de más de 'max_binlog_cache_size' bytes de almacenamiento" swe "Transaktionen krävde mera än 'max_binlog_cache_size' minne. Öka denna mariadbd-variabel och försök på nytt" ukr "Транзакція з багатьма виразами вимагає більше ніж 'max_binlog_cache_size' байтів для зберігання. Збільште цю змінну mariadbd та спробуйте знову" ER_SLAVE_MUST_STOP + chi "这个操作不能执行,因为你有个正在运行的 slave '%2$*1$s'; 先运行 STOP SLAVE '%2$*1$s' 后再试" dan "Denne handling kunne ikke udføres med kørende slave '%2$*1$s', brug først kommandoen STOP SLAVE '%2$*1$s'" - nla "Deze operatie kan niet worden uitgevoerd met een actieve slave '%2$*1$s', doe eerst STOP SLAVE '%2$*1$s'" eng "This operation cannot be performed as you have a running slave '%2$*1$s'; run STOP SLAVE '%2$*1$s' first" fre "Cette opération ne peut être réalisée avec un esclave '%2$*1$s' actif, faites STOP SLAVE '%2$*1$s' d'abord" ger "Diese Operation kann bei einem aktiven Slave '%2$*1$s' nicht durchgeführt werden. Bitte zuerst STOP SLAVE '%2$*1$s' ausführen" ita "Questa operazione non puo' essere eseguita con un database 'slave' '%2$*1$s' che gira, lanciare prima STOP SLAVE '%2$*1$s'" + nla "Deze operatie kan niet worden uitgevoerd met een actieve slave '%2$*1$s', doe eerst STOP SLAVE '%2$*1$s'" por "Esta operação não pode ser realizada com um 'slave' '%2$*1$s' em execução. Execute STOP SLAVE '%2$*1$s' primeiro" rus "Эту операцию невозможно выполнить при работающем потоке подчиненного сервера %2$*1$s. Сначала выполните STOP SLAVE '%2$*1$s'" serbian "Ova operacija ne može biti izvršena dok je aktivan podređeni '%2$*1$s' server. Zadajte prvo komandu 'STOP SLAVE '%2$*1$s'' da zaustavite podređeni server" @@ -4294,13 +4486,14 @@ ER_SLAVE_MUST_STOP swe "Denna operation kan inte göras under replikering; Du har en aktiv förbindelse till '%2$*1$s'. Gör STOP SLAVE '%2$*1$s' först" ukr "Операція не може бути виконана з запущеним підлеглим '%2$*1$s', спочатку виконайте STOP SLAVE '%2$*1$s'" ER_SLAVE_NOT_RUNNING + chi "这个操作需要一个正在运行的slave;配置从机并执行 START SLAVE" dan "Denne handling kræver en kørende slave. Konfigurer en slave og brug kommandoen START SLAVE" - nla "Deze operatie vereist een actieve slave, configureer slave en doe dan START SLAVE" eng "This operation requires a running slave; configure slave and do START SLAVE" fre "Cette opération nécessite un esclave actif, configurez les esclaves et faites START SLAVE" ger "Diese Operation benötigt einen aktiven Slave. Bitte Slave konfigurieren und mittels START SLAVE aktivieren" ita "Questa operaione richiede un database 'slave', configurarlo ed eseguire START SLAVE" jpn "この処理は、稼働中のスレーブでなければ実行できません。スレーブの設定をしてSTART SLAVEコマンドを実行してください。" + nla "Deze operatie vereist een actieve slave, configureer slave en doe dan START SLAVE" por "Esta operação requer um 'slave' em execução. Configure o 'slave' e execute START SLAVE" rus "Для этой операции требуется работающий подчиненный сервер. Сначала выполните START SLAVE" serbian "Ova operacija zahteva da je aktivan podređeni server. Konfigurišite prvo podređeni server i onda izvršite komandu 'START SLAVE'" @@ -4308,13 +4501,14 @@ ER_SLAVE_NOT_RUNNING swe "Denna operation kan endast göras under replikering; Konfigurera slaven och gör START SLAVE" ukr "Операція вимагає запущеного підлеглого, зконфігуруйте підлеглого та виконайте START SLAVE" ER_BAD_SLAVE + chi "服务器未配置为从站;修复配置文件或使用CHANGE MASTER TO" dan "Denne server er ikke konfigureret som slave. Ret in config-filen eller brug kommandoen CHANGE MASTER TO" - nla "De server is niet geconfigureerd als slave, fix in configuratie bestand of met CHANGE MASTER TO" eng "The server is not configured as slave; fix in config file or with CHANGE MASTER TO" fre "Le server n'est pas configuré comme un esclave, changez le fichier de configuration ou utilisez CHANGE MASTER TO" ger "Der Server ist nicht als Slave konfiguriert. Bitte in der Konfigurationsdatei oder mittels CHANGE MASTER TO beheben" ita "Il server non e' configurato come 'slave', correggere il file di configurazione cambiando CHANGE MASTER TO" jpn "このサーバーはスレーブとして設定されていません。コンフィグファイルかCHANGE MASTER TOコマンドで設定して下さい。" + nla "De server is niet geconfigureerd als slave, fix in configuratie bestand of met CHANGE MASTER TO" por "O servidor não está configurado como 'slave'. Acerte o arquivo de configuração ou use CHANGE MASTER TO" rus "Этот сервер не настроен как подчиненный. Внесите исправления в конфигурационном файле или с помощью CHANGE MASTER TO" serbian "Server nije konfigurisan kao podređeni server, ispravite konfiguracioni file ili na njemu izvršite komandu 'CHANGE MASTER TO'" @@ -4322,6 +4516,7 @@ ER_BAD_SLAVE swe "Servern är inte konfigurerade som en replikationsslav. Ändra konfigurationsfilen eller gör CHANGE MASTER TO" ukr "Сервер не зконфігуровано як підлеглий, виправте це у файлі конфігурації або з CHANGE MASTER TO" ER_MASTER_INFO + chi "无法初始化'%.*s'的master info structure;MariaDB错误日志中可以找到更多错误消息" eng "Could not initialize master info structure for '%.*s'; more error messages can be found in the MariaDB error log" fre "Impossible d'initialiser les structures d'information de maître '%.*s', vous trouverez des messages d'erreur supplémentaires dans le journal des erreurs de MariaDB" ger "Konnte Master-Info-Struktur '%.*s' nicht initialisieren. Weitere Fehlermeldungen können im MariaDB-Error-Log eingesehen werden" @@ -4331,13 +4526,14 @@ ER_MASTER_INFO swe "Kunde inte initialisera replikationsstrukturerna för '%.*s'. See MariaDB fel fil för mera information" ukr "Інформаційна структура з'єднання головного і підлеглого (master.info) для '%.*s' не може бути ініціалізована" ER_SLAVE_THREAD + chi "无法创建slave线程;检查系统资源" dan "Kunne ikke danne en slave-tråd; check systemressourcerne" - nla "Kon slave thread niet aanmaken, controleer systeem resources" eng "Could not create slave thread; check system resources" fre "Impossible de créer une tâche esclave, vérifiez les ressources système" ger "Konnte Slave-Thread nicht starten. Bitte System-Ressourcen überprüfen" ita "Impossibile creare il thread 'slave', controllare le risorse di sistema" jpn "スレーブスレッドを作成できません。システムリソースを確認してください。" + nla "Kon slave thread niet aanmaken, controleer systeem resources" por "Não conseguiu criar 'thread' de 'slave'. Verifique os recursos do sistema" rus "Невозможно создать поток подчиненного сервера. Проверьте системные ресурсы" serbian "Nisam mogao da startujem thread za podređeni server, proverite sistemske resurse" @@ -4345,8 +4541,8 @@ ER_SLAVE_THREAD swe "Kunde inte starta en tråd för replikering" ukr "Не можу створити підлеглу гілку, перевірте системні ресурси" ER_TOO_MANY_USER_CONNECTIONS 42000 + chi "用户%-.64s已经拥有超过“max_user_conections”的活连接" dan "Brugeren %-.64s har allerede mere end 'max_user_connections' aktive forbindelser" - nla "Gebruiker %-.64s heeft reeds meer dan 'max_user_connections' actieve verbindingen" eng "User %-.64s already has more than 'max_user_connections' active connections" est "Kasutajal %-.64s on juba rohkem ühendusi kui lubatud 'max_user_connections' muutujaga" fre "L'utilisateur %-.64s possède déjà plus de 'max_user_connections' connexions actives" @@ -4354,6 +4550,7 @@ ER_TOO_MANY_USER_CONNECTIONS 42000 hindi "यूज़र %-.64s के पहले से ही 'max_user_connections' से अधिक सक्रिय कनेक्शन्स हैं" ita "L'utente %-.64s ha gia' piu' di 'max_user_connections' connessioni attive" jpn "ユーザー '%-.64s' はすでに 'max_user_connections' 以上のアクティブな接続を行っています。" + nla "Gebruiker %-.64s heeft reeds meer dan 'max_user_connections' actieve verbindingen" por "Usuário '%-.64s' já possui mais que o valor máximo de conexões (max_user_connections) ativas" rus "У пользователя %-.64s уже больше чем 'max_user_connections' активных соединений" serbian "Korisnik %-.64s već ima više aktivnih konekcija nego što je to određeno 'max_user_connections' promenljivom" @@ -4361,8 +4558,8 @@ ER_TOO_MANY_USER_CONNECTIONS 42000 swe "Användare '%-.64s' har redan 'max_user_connections' aktiva inloggningar" ukr "Користувач %-.64s вже має більше ніж 'max_user_connections' активних з'єднань" ER_SET_CONSTANTS_ONLY + chi "您只能在此语句中使用常量表达式" dan "Du må kun bruge konstantudtryk med SET" - nla "U mag alleen constante expressies gebruiken bij SET" eng "You may only use constant expressions in this statement" est "Ainult konstantsed suurused on lubatud SET klauslis" fre "Seules les expressions constantes sont autorisées avec SET" @@ -4370,6 +4567,7 @@ ER_SET_CONSTANTS_ONLY hindi "इस स्टेटमेंट में आप केवल CONSTANT EXPRESSIONS का उपयोग कर सकते हैं" ita "Si possono usare solo espressioni costanti con SET" jpn "SET処理が失敗しました。" + nla "U mag alleen constante expressies gebruiken bij SET" por "Você pode usar apenas expressões constantes com SET" rus "С этой командой вы можете использовать только константные выражения" serbian "Možete upotrebiti samo konstantan iskaz sa komandom 'SET'" @@ -4377,14 +4575,15 @@ ER_SET_CONSTANTS_ONLY swe "Man kan endast använda konstantuttryck med SET" ukr "Можна використовувати лише вирази зі сталими у SET" ER_LOCK_WAIT_TIMEOUT + chi "锁等待超时;尝试重新启动事务" dan "Lock wait timeout overskredet" - nla "Lock wacht tijd overschreden" eng "Lock wait timeout exceeded; try restarting transaction" est "Kontrollaeg ületatud luku järel ootamisel; Proovi transaktsiooni otsast alata" fre "Timeout sur l'obtention du verrou" ger "Beim Warten auf eine Sperre wurde die zulässige Wartezeit überschritten. Bitte versuchen Sie, die Transaktion neu zu starten" ita "E' scaduto il timeout per l'attesa del lock" jpn "ロック待ちがタイムアウトしました。トランザクションを再試行してください。" + nla "Lock wacht tijd overschreden" por "Tempo de espera (timeout) de travamento excedido. Tente reiniciar a transação" rus "Таймаут ожидания блокировки истек; попробуйте перезапустить транзакцию" serbian "Vremenski limit za zaključavanje tabele je istekao; Probajte da ponovo startujete transakciju" @@ -4392,8 +4591,8 @@ ER_LOCK_WAIT_TIMEOUT swe "Fick inte ett lås i tid ; Försök att starta om transaktionen" ukr "Затримку очікування блокування вичерпано" ER_LOCK_TABLE_FULL + chi "锁的总数超过锁定表大小" dan "Det totale antal låse overstiger størrelsen på låse-tabellen" - nla "Het totale aantal locks overschrijdt de lock tabel grootte" eng "The total number of locks exceeds the lock table size" est "Lukkude koguarv ületab lukutabeli suuruse" fre "Le nombre total de verrou dépasse la taille de la table des verrous" @@ -4401,6 +4600,7 @@ ER_LOCK_TABLE_FULL hindi "लॉक्स की कुल संख्या लॉक टेबल के साइज से अधिक है" ita "Il numero totale di lock e' maggiore della grandezza della tabella di lock" jpn "ロックの数が多すぎます。" + nla "Het totale aantal locks overschrijdt de lock tabel grootte" por "O número total de travamentos excede o tamanho da tabela de travamentos" rus "Общее количество блокировок превысило размеры таблицы блокировок" serbian "Broj totalnih zaključavanja tabele premašuje veličinu tabele zaključavanja" @@ -4408,14 +4608,15 @@ ER_LOCK_TABLE_FULL swe "Antal lås överskrider antalet reserverade lås" ukr "Загальна кількість блокувань перевищила розмір блокувань для таблиці" ER_READ_ONLY_TRANSACTION 25000 + chi "在READ UNCOMMITTED事务期间无法获取更新锁定" dan "Update lås kan ikke opnås under en READ UNCOMMITTED transaktion" - nla "Update locks kunnen niet worden verkregen tijdens een READ UNCOMMITTED transactie" eng "Update locks cannot be acquired during a READ UNCOMMITTED transaction" est "Uuenduslukke ei saa kasutada READ UNCOMMITTED transaktsiooni käigus" fre "Un verrou en update ne peut être acquit pendant une transaction READ UNCOMMITTED" ger "Während einer READ-UNCOMMITTED-Transaktion können keine UPDATE-Sperren angefordert werden" ita "I lock di aggiornamento non possono essere acquisiti durante una transazione 'READ UNCOMMITTED'" jpn "読み込み専用トランザクションです。" + nla "Update locks kunnen niet worden verkregen tijdens een READ UNCOMMITTED transactie" por "Travamentos de atualização não podem ser obtidos durante uma transação de tipo READ UNCOMMITTED" rus "Блокировки обновлений нельзя получить в процессе чтения не принятой (в режиме READ UNCOMMITTED) транзакции" serbian "Zaključavanja izmena ne mogu biti realizovana sve dok traje 'READ UNCOMMITTED' transakcija" @@ -4423,14 +4624,15 @@ ER_READ_ONLY_TRANSACTION 25000 swe "Updateringslås kan inte göras när man använder READ UNCOMMITTED" ukr "Оновити блокування не можливо на протязі транзакції READ UNCOMMITTED" ER_DROP_DB_WITH_READ_LOCK + chi "线程持有全局读锁时,不允许删除数据库" dan "DROP DATABASE er ikke tilladt mens en tråd holder på globalt read lock" - nla "DROP DATABASE niet toegestaan terwijl thread een globale 'read lock' bezit" eng "DROP DATABASE not allowed while thread is holding global read lock" est "DROP DATABASE ei ole lubatud kui lõim omab globaalset READ lukku" fre "DROP DATABASE n'est pas autorisée pendant qu'une tâche possède un verrou global en lecture" ger "DROP DATABASE ist nicht erlaubt, solange der Thread eine globale Lesesperre hält" ita "DROP DATABASE non e' permesso mentre il thread ha un lock globale di lettura" jpn "グローバルリードロックを保持している間は、DROP DATABASE を実行できません。" + nla "DROP DATABASE niet toegestaan terwijl thread een globale 'read lock' bezit" por "DROP DATABASE não permitido enquanto uma 'thread' está mantendo um travamento global de leitura" rus "Не допускается DROP DATABASE, пока поток держит глобальную блокировку чтения" serbian "Komanda 'DROP DATABASE' nije dozvoljena dok thread globalno zaključava čitanje podataka" @@ -4438,14 +4640,15 @@ ER_DROP_DB_WITH_READ_LOCK swe "DROP DATABASE är inte tillåtet när man har ett globalt läslås" ukr "DROP DATABASE не дозволено доки гілка перебуває під загальним блокуванням читання" ER_CREATE_DB_WITH_READ_LOCK + chi "线程持有全局读锁时,不允许创建数据库" dan "CREATE DATABASE er ikke tilladt mens en tråd holder på globalt read lock" - nla "CREATE DATABASE niet toegestaan terwijl thread een globale 'read lock' bezit" eng "CREATE DATABASE not allowed while thread is holding global read lock" est "CREATE DATABASE ei ole lubatud kui lõim omab globaalset READ lukku" fre "CREATE DATABASE n'est pas autorisée pendant qu'une tâche possède un verrou global en lecture" ger "CREATE DATABASE ist nicht erlaubt, solange der Thread eine globale Lesesperre hält" ita "CREATE DATABASE non e' permesso mentre il thread ha un lock globale di lettura" jpn "グローバルリードロックを保持している間は、CREATE DATABASE を実行できません。" + nla "CREATE DATABASE niet toegestaan terwijl thread een globale 'read lock' bezit" por "CREATE DATABASE não permitido enquanto uma 'thread' está mantendo um travamento global de leitura" rus "Не допускается CREATE DATABASE, пока поток держит глобальную блокировку чтения" serbian "Komanda 'CREATE DATABASE' nije dozvoljena dok thread globalno zaključava čitanje podataka" @@ -4453,7 +4656,7 @@ ER_CREATE_DB_WITH_READ_LOCK swe "CREATE DATABASE är inte tillåtet när man har ett globalt läslås" ukr "CREATE DATABASE не дозволено доки гілка перебуває під загальним блокуванням читання" ER_WRONG_ARGUMENTS - nla "Foutieve parameters voor %s" + chi "%s的参数不正确" eng "Incorrect arguments to %s" est "Vigased parameetrid %s-le" fre "Mauvais arguments à %s" @@ -4461,6 +4664,7 @@ ER_WRONG_ARGUMENTS hindi "%s को गलत आर्ग्यूमेंट्स" ita "Argomenti errati a %s" jpn "%s の引数が不正です" + nla "Foutieve parameters voor %s" por "Argumentos errados para %s" rus "Неверные параметры для %s" serbian "Pogrešni argumenti prosleđeni na %s" @@ -4468,13 +4672,14 @@ ER_WRONG_ARGUMENTS swe "Felaktiga argument till %s" ukr "Хибний аргумент для %s" ER_NO_PERMISSION_TO_CREATE_USER 42000 - nla "'%s'@'%s' mag geen nieuwe gebruikers creeren" + chi "'%s'@'%s'不允许创建新用户" eng "'%s'@'%s' is not allowed to create new users" est "Kasutajal '%s'@'%s' ei ole lubatud luua uusi kasutajaid" fre "'%s'@'%s' n'est pas autorisé à créer de nouveaux utilisateurs" ger "'%s'@'%s' ist nicht berechtigt, neue Benutzer hinzuzufügen" hindi "'%s'@'%s' को नए यूज़र्स बनाने की अनुमति नहीं है" ita "A '%s'@'%s' non e' permesso creare nuovi utenti" + nla "'%s'@'%s' mag geen nieuwe gebruikers creeren" por "Não é permitido a '%s'@'%s' criar novos usuários" rus "'%s'@'%s' не разрешается создавать новых пользователей" serbian "Korisniku '%s'@'%s' nije dozvoljeno da kreira nove korisnike" @@ -4482,13 +4687,14 @@ ER_NO_PERMISSION_TO_CREATE_USER 42000 swe "'%s'@'%s' har inte rättighet att skapa nya användare" ukr "Користувачу '%s'@'%s' не дозволено створювати нових користувачів" ER_UNION_TABLES_IN_DIFFERENT_DIR - nla "Incorrecte tabel definitie; alle MERGE tabellen moeten tot dezelfde database behoren" + chi "表定义不正确;所有合并表必须在同一数据库中" eng "Incorrect table definition; all MERGE tables must be in the same database" est "Vigane tabelimääratlus; kõik MERGE tabeli liikmed peavad asuma samas andmebaasis" fre "Définition de table incorrecte; toutes les tables MERGE doivent être dans la même base de donnée" ger "Falsche Tabellendefinition. Alle MERGE-Tabellen müssen sich in derselben Datenbank befinden" ita "Definizione della tabella errata; tutte le tabelle di tipo MERGE devono essere nello stesso database" jpn "不正な表定義です。MERGE表の構成表はすべて同じデータベース内になければなりません。" + nla "Incorrecte tabel definitie; alle MERGE tabellen moeten tot dezelfde database behoren" por "Definição incorreta da tabela. Todas as tabelas contidas na junção devem estar no mesmo banco de dados" rus "Неверное определение таблицы; Все таблицы в MERGE должны принадлежать одной и той же базе данных" serbian "Pogrešna definicija tabele; sve 'MERGE' tabele moraju biti u istoj bazi podataka" @@ -4496,13 +4702,14 @@ ER_UNION_TABLES_IN_DIFFERENT_DIR swe "Felaktig tabelldefinition; alla tabeller i en MERGE-tabell måste vara i samma databas" ukr "Хибне визначення таблиці; всі MERGE-таблиці повинні належити до однієї бази ланних." ER_LOCK_DEADLOCK 40001 - nla "Deadlock gevonden tijdens lock-aanvraag poging; Probeer herstart van de transactie" + chi "试图锁定时发现僵局;尝试重新启动事务" eng "Deadlock found when trying to get lock; try restarting transaction" est "Lukustamisel tekkis tupik (deadlock); alusta transaktsiooni otsast" fre "Deadlock découvert en essayant d'obtenir les verrous : essayez de redémarrer la transaction" ger "Beim Versuch, eine Sperre anzufordern, ist ein Deadlock aufgetreten. Versuchen Sie, die Transaktion neu zu starten" ita "Trovato deadlock durante il lock; Provare a far ripartire la transazione" jpn "ロック取得中にデッドロックが検出されました。トランザクションを再試行してください。" + nla "Deadlock gevonden tijdens lock-aanvraag poging; Probeer herstart van de transactie" por "Encontrado um travamento fatal (deadlock) quando tentava obter uma trava. Tente reiniciar a transação" rus "Возникла тупиковая ситуация в процессе получения блокировки; Попробуйте перезапустить транзакцию" serbian "Unakrsno zaključavanje pronađeno kada sam pokušao da dobijem pravo na zaključavanje; Probajte da restartujete transakciju" @@ -4510,13 +4717,14 @@ ER_LOCK_DEADLOCK 40001 swe "Fick 'DEADLOCK' vid låsförsök av block/rad. Försök att starta om transaktionen" ukr "Взаємне блокування знайдено під час спроби отримати блокування; спробуйте перезапустити транзакцію." ER_TABLE_CANT_HANDLE_FT - nla "Het gebruikte tabel type (%s) ondersteund geen FULLTEXT indexen" + chi "存储引擎%s不支持fulltext索引" eng "The storage engine %s doesn't support FULLTEXT indexes" est "Antud tabelitüüp (%s) ei toeta FULLTEXT indekseid" fre "Le type de table utilisé (%s) ne supporte pas les index FULLTEXT" ger "Der verwendete Tabellentyp (%s) unterstützt keine FULLTEXT-Indizes" hindi "स्टोरेज इंजन '%s' FULLTEXT इन्डेक्सेस को सपोर्ट नहीं करता" ita "La tabella usata (%s) non supporta gli indici FULLTEXT" + nla "Het gebruikte tabel type (%s) ondersteund geen FULLTEXT indexen" por "O tipo de tabela utilizado (%s) não suporta índices de texto completo (fulltext indexes)" rus "Используемый тип таблиц (%s) не поддерживает полнотекстовых индексов" serbian "Upotrebljeni tip tabele (%s) ne podržava 'FULLTEXT' indekse" @@ -4524,12 +4732,13 @@ ER_TABLE_CANT_HANDLE_FT swe "Tabelltypen (%s) har inte hantering av FULLTEXT-index" ukr "Використаний тип таблиці (%s) не підтримує FULLTEXT індексів" ER_CANNOT_ADD_FOREIGN - nla "Kan foreign key beperking niet toevoegen vor `%s`" + chi "不能为`%s`添加外键约束" eng "Cannot add foreign key constraint for `%s`" fre "Impossible d'ajouter des contraintes d'index externe à `%s`" ger "Fremdschlüssel-Beschränkung kann nicht hinzugefügt werden für `%s`" ita "Impossibile aggiungere il vincolo di integrita' referenziale (foreign key constraint) a `%s`" jpn "`%s` 外部キー制約を追加できません。" + nla "Kan foreign key beperking niet toevoegen vor `%s`" por "Não pode acrescentar uma restrição de chave estrangeira para `%s`" rus "Невозможно добавить ограничения внешнего ключа для `%s`" serbian "Ne mogu da dodam proveru spoljnog ključa na `%s`" @@ -4537,7 +4746,7 @@ ER_CANNOT_ADD_FOREIGN swe "Kan inte lägga till 'FOREIGN KEY constraint' för `%s`'" ukr "Не можу додати обмеження зовнішнього ключа Ha `%s`" ER_NO_REFERENCED_ROW 23000 - nla "Kan onderliggende rij niet toevoegen: foreign key beperking gefaald" + chi "无法添加或更新子行:外键约束失败" eng "Cannot add or update a child row: a foreign key constraint fails" fre "Impossible d'ajouter un enregistrement fils : une constrainte externe l'empèche" ger "Hinzufügen oder Aktualisieren eines Kind-Datensatzes schlug aufgrund einer Fremdschlüssel-Beschränkung fehl" @@ -4545,6 +4754,7 @@ ER_NO_REFERENCED_ROW 23000 hun "Cannot add a child row: a foreign key constraint fails" ita "Impossibile aggiungere la riga: un vincolo d'integrita' referenziale non e' soddisfatto" jpn "親キーがありません。外部キー制約違反です。" + nla "Kan onderliggende rij niet toevoegen: foreign key beperking gefaald" norwegian-ny "Cannot add a child row: a foreign key constraint fails" por "Não pode acrescentar uma linha filha: uma restrição de chave estrangeira falhou" rus "Невозможно добавить или обновить дочернюю строку: проверка ограничений внешнего ключа не выполняется" @@ -4552,6 +4762,7 @@ ER_NO_REFERENCED_ROW 23000 swe "FOREIGN KEY-konflikt: Kan inte skriva barn" ukr "Не вдається додати або оновити дочірній рядок: невдала перевірка обмеження зовнішнього ключа" ER_ROW_IS_REFERENCED 23000 + chi "无法删除或更新父行:外键约束失败" eng "Cannot delete or update a parent row: a foreign key constraint fails" fre "Impossible de supprimer un enregistrement père : une constrainte externe l'empèche" ger "Löschen oder Aktualisieren eines Eltern-Datensatzes schlug aufgrund einer Fremdschlüssel-Beschränkung fehl" @@ -4565,44 +4776,48 @@ ER_ROW_IS_REFERENCED 23000 spa "No puedo borrar o actualizar una fila padre: ha fallado una restrición de clave foránea" swe "FOREIGN KEY-konflikt: Kan inte radera fader" ER_CONNECT_TO_MASTER 08S01 - nla "Fout bij opbouwen verbinding naar master: %-.128s" + chi "连接master时出错:%-.128s" eng "Error connecting to master: %-.128s" ger "Fehler bei der Verbindung zum Master: %-.128s" ita "Errore durante la connessione al master: %-.128s" jpn "マスターへの接続エラー: %-.128s" + nla "Fout bij opbouwen verbinding naar master: %-.128s" por "Erro conectando com o master: %-.128s" rus "Ошибка соединения с головным сервером: %-.128s" spa "Error conectando al maestro (master): %-.128s" swe "Fick fel vid anslutning till master: %-.128s" ER_QUERY_ON_MASTER - nla "Fout bij uitvoeren query op master: %-.128s" + chi "在Master上运行查询时出错:%-.128s" eng "Error running query on master: %-.128s" ger "Beim Ausführen einer Abfrage auf dem Master trat ein Fehler auf: %-.128s" ita "Errore eseguendo una query sul master: %-.128s" jpn "マスターでのクエリ実行エラー: %-.128s" + nla "Fout bij uitvoeren query op master: %-.128s" por "Erro rodando consulta no master: %-.128s" rus "Ошибка выполнения запроса на головном сервере: %-.128s" spa "Error ejecutando consulta (query) en maestro (master): %-.128s" swe "Fick fel vid utförande av command på mastern: %-.128s" ER_ERROR_WHEN_EXECUTING_COMMAND - nla "Fout tijdens uitvoeren van commando %s: %-.128s" + chi "执行命令%s时出错:%-.128s" eng "Error when executing command %s: %-.128s" est "Viga käsu %s täitmisel: %-.128s" ger "Fehler beim Ausführen des Befehls %s: %-.128s" ita "Errore durante l'esecuzione del comando %s: %-.128s" jpn "%s コマンドの実行エラー: %-.128s" + nla "Fout tijdens uitvoeren van commando %s: %-.128s" por "Erro quando executando comando %s: %-.128s" rus "Ошибка при выполнении команды %s: %-.128s" serbian "Greška pri izvršavanju komande %s: %-.128s" spa "Error al ejecutar comando %s: %-.128s" swe "Fick fel vid utförande av %s: %-.128s" ER_WRONG_USAGE - nla "Foutief gebruik van %s en %s" + chi "%s和%s使用不正确" eng "Incorrect usage of %s and %s" est "Vigane %s ja %s kasutus" ger "Falsche Verwendung von %s und %s" ita "Uso errato di %s e %s" jpn "%s の %s に関する不正な使用法です。" + nla "Foutief gebruik van %s en %s" por "Uso errado de %s e %s" rus "Неверное использование %s и %s" serbian "Pogrešna upotreba %s i %s" @@ -4610,164 +4825,180 @@ ER_WRONG_USAGE swe "Felaktig använding av %s and %s" ukr "Wrong usage of %s and %s" ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 21000 - nla "De gebruikte SELECT commando's hebben een verschillend aantal kolommen" + chi "使用的SELECT语句具有不同数量的列" eng "The used SELECT statements have a different number of columns" est "Tulpade arv kasutatud SELECT lausetes ei kattu" ger "Die verwendeten SELECT-Befehle liefern unterschiedliche Anzahlen von Feldern zurück" ita "La SELECT utilizzata ha un numero di colonne differente" jpn "使用のSELECT文が返す列数が違います。" + nla "De gebruikte SELECT commando's hebben een verschillend aantal kolommen" por "Os comandos SELECT usados têm diferente número de colunas" rus "Использованные операторы выборки (SELECT) дают разное количество столбцов" serbian "Upotrebljene 'SELECT' komande adresiraju različit broj kolona" spa "Las sentencias SELECT usadas tienen un número diferente de columnas" swe "SELECT-kommandona har olika antal kolumner" ER_CANT_UPDATE_WITH_READLOCK - nla "Kan de query niet uitvoeren vanwege een conflicterende read lock" + chi "无法执行查询,因为您有冲突的读锁" eng "Can't execute the query because you have a conflicting read lock" est "Ei suuda täita päringut konfliktse luku tõttu" ger "Augrund eines READ-LOCK-Konflikts kann die Abfrage nicht ausgeführt werden" ita "Impossibile eseguire la query perche' c'e' un conflitto con in lock di lettura" jpn "競合するリードロックを保持しているので、クエリを実行できません。" + nla "Kan de query niet uitvoeren vanwege een conflicterende read lock" por "Não posso executar a consulta porque você tem um conflito de travamento de leitura" rus "Невозможно исполнить запрос, поскольку у вас установлены конфликтующие блокировки чтения" serbian "Ne mogu da izvršim upit zbog toga što imate zaključavanja čitanja podataka u konfliktu" spa "No puedo ejecutar la consulta (query) porque vd tiene un conflicto de bloqueo de lectura" swe "Kan inte utföra kommandot emedan du har ett READ-lås" ER_MIXING_NOT_ALLOWED - nla "Het combineren van transactionele en niet-transactionele tabellen is uitgeschakeld" + chi "事务和非事务表的混合被禁用" eng "Mixing of transactional and non-transactional tables is disabled" est "Transaktsioone toetavate ning mittetoetavate tabelite kooskasutamine ei ole lubatud" ger "Die gleichzeitige Verwendung von Tabellen mit und ohne Transaktionsunterstützung ist deaktiviert" ita "E' disabilitata la possibilita' di mischiare tabelle transazionali e non-transazionali" jpn "トランザクション対応の表と非対応の表の同時使用は無効化されています。" + nla "Het combineren van transactionele en niet-transactionele tabellen is uitgeschakeld" por "Mistura de tabelas transacional e não-transacional está desabilitada" rus "Использование транзакционных таблиц наряду с нетранзакционными запрещено" serbian "Mešanje tabela koje podržavaju transakcije i onih koje ne podržavaju transakcije je isključeno" spa "Desactivada la mezcla de tablas transaccionales y no transaccionales" swe "Blandning av transaktionella och icke-transaktionella tabeller är inaktiverat" ER_DUP_ARGUMENT - nla "Optie '%s' tweemaal gebruikt in opdracht" + chi "选项'%s'在语句中使用两次" eng "Option '%s' used twice in statement" est "Määrangut '%s' on lauses kasutatud topelt" ger "Option '%s' wird im Befehl zweimal verwendet" ita "L'opzione '%s' e' stata usata due volte nel comando" jpn "オプション '%s' が2度使用されています。" + nla "Optie '%s' tweemaal gebruikt in opdracht" por "Opção '%s' usada duas vezes no comando" rus "Опция '%s' дважды использована в выражении" spa "Opción '%s' usada dos veces en la sentencia" swe "Option '%s' användes två gånger" ER_USER_LIMIT_REACHED 42000 - nla "Gebruiker '%-.64s' heeft het maximale gebruik van de '%s' faciliteit overschreden (huidige waarde: %ld)" + chi "用户'%-.64s'已超过'%s'资源(当前值:%ld)" eng "User '%-.64s' has exceeded the '%s' resource (current value: %ld)" ger "Benutzer '%-.64s' hat die Ressourcenbeschränkung '%s' überschritten (aktueller Wert: %ld)" ita "L'utente '%-.64s' ha ecceduto la risorsa '%s' (valore corrente: %ld)" jpn "ユーザー '%-.64s' はリソースの上限 '%s' に達しました。(現在値: %ld)" + nla "Gebruiker '%-.64s' heeft het maximale gebruik van de '%s' faciliteit overschreden (huidige waarde: %ld)" por "Usuário '%-.64s' tem excedido o '%s' recurso (atual valor: %ld)" rus "Пользователь '%-.64s' превысил использование ресурса '%s' (текущее значение: %ld)" spa "El usuario '%-.64s' ha excedido el recurso '%s' (valor actual: %ld)" swe "Användare '%-.64s' har överskridit '%s' (nuvarande värde: %ld)" ER_SPECIFIC_ACCESS_DENIED_ERROR 42000 - nla "Toegang geweigerd. U moet het %-.128s privilege hebben voor deze operatie" + chi "拒绝访问;您需要(至少一个)%-.128s特权用于此操作" eng "Access denied; you need (at least one of) the %-.128s privilege(s) for this operation" ger "Kein Zugriff. Hierfür wird die Berechtigung %-.128s benötigt" ita "Accesso non consentito. Serve il privilegio %-.128s per questa operazione" jpn "アクセスは拒否されました。この操作には %-.128s 権限が(複数の場合はどれか1つ)必要です。" + nla "Toegang geweigerd. U moet het %-.128s privilege hebben voor deze operatie" por "Acesso negado. Você precisa o privilégio %-.128s para essa operação" rus "В доступе отказано. Вам нужны привилегии %-.128s для этой операции" spa "Acceso denegado. Usted necesita (al menos un(os)) privilegio(s) %-.128s para esta operación" swe "Du har inte privlegiet '%-.128s' som behövs för denna operation" ukr "Access denied. You need the %-.128s privilege for this operation" ER_LOCAL_VARIABLE - nla "Variabele '%-.64s' is SESSION en kan niet worden gebruikt met SET GLOBAL" + chi "变量'%-.64s'是一个SESSION变量,不能与Set Global一起使用" eng "Variable '%-.64s' is a SESSION variable and can't be used with SET GLOBAL" ger "Variable '%-.64s' ist eine lokale Variable und kann nicht mit SET GLOBAL verändert werden" ita "La variabile '%-.64s' e' una variabile locale ( SESSION ) e non puo' essere cambiata usando SET GLOBAL" jpn "変数 '%-.64s' はセッション変数です。SET GLOBALでは使用できません。" + nla "Variabele '%-.64s' is SESSION en kan niet worden gebruikt met SET GLOBAL" por "Variável '%-.64s' é uma SESSION variável e não pode ser usada com SET GLOBAL" rus "Переменная '%-.64s' является потоковой (SESSION) переменной и не может быть изменена с помощью SET GLOBAL" spa "La variable '%-.64s' es una variable de SESSION y no puede ser usada con SET GLOBAL" swe "Variabel '%-.64s' är en SESSION variabel och kan inte ändrad med SET GLOBAL" ER_GLOBAL_VARIABLE - nla "Variabele '%-.64s' is GLOBAL en dient te worden gewijzigd met SET GLOBAL" + chi "变量'%-.64s'是全局变量,应该用SET GLOBAL设置" eng "Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL" ger "Variable '%-.64s' ist eine globale Variable und muss mit SET GLOBAL verändert werden" ita "La variabile '%-.64s' e' una variabile globale ( GLOBAL ) e deve essere cambiata usando SET GLOBAL" jpn "変数 '%-.64s' はグローバル変数です。SET GLOBALを使用してください。" + nla "Variabele '%-.64s' is GLOBAL en dient te worden gewijzigd met SET GLOBAL" por "Variável '%-.64s' é uma GLOBAL variável e deve ser configurada com SET GLOBAL" rus "Переменная '%-.64s' является глобальной (GLOBAL) переменной, и ее следует изменять с помощью SET GLOBAL" spa "La variable '%-.64s' es una variable GLOBAL y debería de ser configurada con SET GLOBAL" swe "Variabel '%-.64s' är en GLOBAL variabel och bör sättas med SET GLOBAL" ER_NO_DEFAULT 42000 - nla "Variabele '%-.64s' heeft geen standaard waarde" + chi "变量'%-.64s'没有默认值" eng "Variable '%-.64s' doesn't have a default value" ger "Variable '%-.64s' hat keinen Vorgabewert" ita "La variabile '%-.64s' non ha un valore di default" jpn "変数 '%-.64s' にはデフォルト値がありません。" + nla "Variabele '%-.64s' heeft geen standaard waarde" por "Variável '%-.64s' não tem um valor padrão" rus "Переменная '%-.64s' не имеет значения по умолчанию" spa "La variable '%-.64s' no tiene un valor por defecto" swe "Variabel '%-.64s' har inte ett DEFAULT-värde" ER_WRONG_VALUE_FOR_VAR 42000 - nla "Variabele '%-.64s' kan niet worden gewijzigd naar de waarde '%-.200T'" + chi "变量'%-.64s'无法设置为'%-.200T'的值" eng "Variable '%-.64s' can't be set to the value of '%-.200T'" ger "Variable '%-.64s' kann nicht auf '%-.200T' gesetzt werden" ita "Alla variabile '%-.64s' non puo' essere assegato il valore '%-.200T'" jpn "変数 '%-.64s' に値 '%-.200T' を設定できません。" + nla "Variabele '%-.64s' kan niet worden gewijzigd naar de waarde '%-.200T'" por "Variável '%-.64s' não pode ser configurada para o valor de '%-.200T'" rus "Переменная '%-.64s' не может быть установлена в значение '%-.200T'" spa "La variable '%-.64s' no puede ser configurada para el valor de '%-.200T'" swe "Variabel '%-.64s' kan inte sättas till '%-.200T'" ER_WRONG_TYPE_FOR_VAR 42000 - nla "Foutief argumenttype voor variabele '%-.64s'" + chi "变量'%-.64s'的参数类型不正确" eng "Incorrect argument type to variable '%-.64s'" ger "Falscher Argumenttyp für Variable '%-.64s'" ita "Tipo di valore errato per la variabile '%-.64s'" jpn "変数 '%-.64s' への値の型が不正です。" + nla "Foutief argumenttype voor variabele '%-.64s'" por "Tipo errado de argumento para variável '%-.64s'" rus "Неверный тип аргумента для переменной '%-.64s'" spa "Tipo de argumento incorrecto para variable '%-.64s'" swe "Fel typ av argument till variabel '%-.64s'" ER_VAR_CANT_BE_READ - nla "Variabele '%-.64s' kan alleen worden gewijzigd, niet gelezen" + chi "变量'%-.64s'只能设置,不能读" eng "Variable '%-.64s' can only be set, not read" ger "Variable '%-.64s' kann nur verändert, nicht gelesen werden" ita "Alla variabile '%-.64s' e' di sola scrittura quindi puo' essere solo assegnato un valore, non letto" jpn "変数 '%-.64s' は書き込み専用です。読み込みはできません。" + nla "Variabele '%-.64s' kan alleen worden gewijzigd, niet gelezen" por "Variável '%-.64s' somente pode ser configurada, não lida" rus "Переменная '%-.64s' может быть только установлена, но не считана" spa "La variable '%-.64s' solamente puede ser configurada, no leída" swe "Variabeln '%-.64s' kan endast sättas, inte läsas" ER_CANT_USE_OPTION_HERE 42000 - nla "Foutieve toepassing/plaatsing van '%s'" + chi "'%s'的使用/放置不正确" eng "Incorrect usage/placement of '%s'" ger "Falsche Verwendung oder Platzierung von '%s'" ita "Uso/posizione di '%s' sbagliato" jpn "'%s' の使用法または場所が不正です。" + nla "Foutieve toepassing/plaatsing van '%s'" por "Errado uso/colocação de '%s'" rus "Неверное использование или в неверном месте указан '%s'" spa "Incorrecto uso/colocación de '%s'" swe "Fel använding/placering av '%s'" ER_NOT_SUPPORTED_YET 42000 - nla "Deze versie van MariaDB ondersteunt nog geen '%s'" + chi "此版本的MariaDB尚未支持'%s'" eng "This version of MariaDB doesn't yet support '%s'" ger "Diese MariaDB-Version unterstützt '%s' nicht" ita "Questa versione di MariaDB non supporta ancora '%s'" jpn "このバージョンのMariaDBでは、まだ '%s' を利用できません。" + nla "Deze versie van MariaDB ondersteunt nog geen '%s'" por "Esta versão de MariaDB não suporta ainda '%s'" rus "Эта версия MariaDB пока еще не поддерживает '%s'" spa "Esta versión de MariaDB no soporta todavía '%s'" swe "Denna version av MariaDB kan ännu inte utföra '%s'" ER_MASTER_FATAL_ERROR_READING_BINLOG - nla "Kreeg fatale fout %d: '%-.320s' van master tijdens lezen van data uit binaire log" + chi "从二进制日志读取数据时,从master遇到致命错误%d:'%-.320s'" eng "Got fatal error %d from master when reading data from binary log: '%-.320s'" ger "Schwerer Fehler %d: '%-.320s vom Master beim Lesen des binären Logs" ita "Errore fatale %d: '%-.320s' dal master leggendo i dati dal log binario" jpn "致命的なエラー %d: '%-.320s' がマスターでバイナリログ読み込み中に発生しました。" + nla "Kreeg fatale fout %d: '%-.320s' van master tijdens lezen van data uit binaire log" por "Obteve fatal erro %d: '%-.320s' do master quando lendo dados do binary log" rus "Получена неисправимая ошибка %d: '%-.320s' от головного сервера в процессе выборки данных из двоичного журнала" spa "Obtenido error fatal %d del maestro (master) al leer datos del historial (log) binario: '%-.320s'" swe "Fick fatalt fel %d: '%-.320s' från master vid läsning av binärloggen" ER_SLAVE_IGNORED_TABLE + chi "由于复制replicate-*-table规则,Slave SQL线程忽略了查询" eng "Slave SQL thread ignored the query because of replicate-*-table rules" ger "Slave-SQL-Thread hat die Abfrage aufgrund von replicate-*-table-Regeln ignoriert" jpn "replicate-*-table ルールに従って、スレーブSQLスレッドはクエリを無視しました。" @@ -4776,14 +5007,16 @@ ER_SLAVE_IGNORED_TABLE spa "El hilo (thread) SQL esclavo ha ignorado la consulta (query) debido a las reglas de replicar-*-tabla" swe "Slav SQL tråden ignorerade frågan pga en replicate-*-table regel" ER_INCORRECT_GLOBAL_LOCAL_VAR + chi "变量'%-.192s'是一个%s变量" eng "Variable '%-.192s' is a %s variable" - serbian "Promenljiva '%-.192s' je %s promenljiva" ger "Variable '%-.192s' ist eine %s-Variable" jpn "変数 '%-.192s' は %s 変数です。" nla "Variabele '%-.192s' is geen %s variabele" + serbian "Promenljiva '%-.192s' je %s promenljiva" spa "La variable '%-.192s' es una variable %s" swe "Variabel '%-.192s' är av typ %s" ER_WRONG_FK_DEF 42000 + chi "'%-.192s'的外键定义不正确:%s" eng "Incorrect foreign key definition for '%-.192s': %s" ger "Falsche Fremdschlüssel-Definition für '%-.192s': %s" jpn "外部キー '%-.192s' の定義の不正: %s" @@ -4792,6 +5025,7 @@ ER_WRONG_FK_DEF 42000 spa "Definición de clave foránea incorrecta para '%-.192s': %s" swe "Felaktig FOREIGN KEY-definition för '%-.192s': %s" ER_KEY_REF_DO_NOT_MATCH_TABLE_REF + chi "索引参考和表参考不匹配" eng "Key reference and table reference don't match" ger "Schlüssel- und Tabellenverweis passen nicht zusammen" jpn "外部キーの参照表と定義が一致しません。" @@ -4800,6 +5034,7 @@ ER_KEY_REF_DO_NOT_MATCH_TABLE_REF spa "La referencia de clave y la referencia de tabla no coinciden" swe "Nyckelreferensen och tabellreferensen stämmer inte överens" ER_OPERAND_COLUMNS 21000 + chi "操作数应包含%d列" eng "Operand should contain %d column(s)" ger "Operand sollte %d Spalte(n) enthalten" jpn "オペランドに %d 個の列が必要です。" @@ -4808,6 +5043,7 @@ ER_OPERAND_COLUMNS 21000 spa "El operando debería de contener %d columna(s)" ukr "Операнд має складатися з %d стовбців" ER_SUBQUERY_NO_1_ROW 21000 + chi "子查询返回超过1行" eng "Subquery returns more than 1 row" ger "Unterabfrage lieferte mehr als einen Datensatz zurück" jpn "サブクエリが2行以上の結果を返します。" @@ -4818,6 +5054,7 @@ ER_SUBQUERY_NO_1_ROW 21000 swe "Subquery returnerade mer än 1 rad" ukr "Підзапит повертає більш нiж 1 запис" ER_UNKNOWN_STMT_HANDLER + chi "未知prepared statement处理程序(%.*s)给予%s" dan "Unknown prepared statement handler (%.*s) given to %s" eng "Unknown prepared statement handler (%.*s) given to %s" ger "Unbekannter Prepared-Statement-Handler (%.*s) für %s angegeben" @@ -4828,6 +5065,7 @@ ER_UNKNOWN_STMT_HANDLER swe "Okänd PREPARED STATEMENT id (%.*s) var given till %s" ukr "Unknown prepared statement handler (%.*s) given to %s" ER_CORRUPT_HELP_DB + chi "帮助数据库已损坏或不存在" eng "Help database is corrupt or does not exist" ger "Die Hilfe-Datenbank ist beschädigt oder existiert nicht" jpn "ヘルプデータベースは壊れているか存在しません。" @@ -4836,6 +5074,7 @@ ER_CORRUPT_HELP_DB spa "O la Base de datos de Ayuda está corrupta o no existe" swe "Hjälpdatabasen finns inte eller är skadad" ER_CYCLIC_REFERENCE + chi "亚查询的死环参考" eng "Cyclic reference on subqueries" ger "Zyklischer Verweis in Unterabfragen" jpn "サブクエリの参照がループしています。" @@ -4846,6 +5085,7 @@ ER_CYCLIC_REFERENCE swe "Cyklisk referens i subqueries" ukr "Циклічне посилання на підзапит" ER_AUTO_CONVERT + chi "将列'%s'从%s转换为%s" eng "Converting column '%s' from %s to %s" ger "Feld '%s' wird von %s nach %s umgewandelt" jpn "列 '%s' を %s から %s へ変換します。" @@ -4856,6 +5096,7 @@ ER_AUTO_CONVERT swe "Konvertar kolumn '%s' från %s till %s" ukr "Перетворення стовбца '%s' з %s у %s" ER_ILLEGAL_REFERENCE 42S22 + chi "参考'%-.64s'不支持(%s)" eng "Reference '%-.64s' not supported (%s)" ger "Verweis '%-.64s' wird nicht unterstützt (%s)" jpn "'%-.64s' の参照はできません。(%s)" @@ -4866,6 +5107,7 @@ ER_ILLEGAL_REFERENCE 42S22 swe "Referens '%-.64s' stöds inte (%s)" ukr "Посилання '%-.64s' не пiдтримуется (%s)" ER_DERIVED_MUST_HAVE_ALIAS 42000 + chi "每个派生的表必须有自己的别名" eng "Every derived table must have its own alias" ger "Für jede abgeleitete Tabelle muss ein eigener Alias angegeben werden" jpn "導出表には別名が必須です。" @@ -4874,6 +5116,7 @@ ER_DERIVED_MUST_HAVE_ALIAS 42000 spa "Cada tabla derivada debe de tener su propio alias" swe "Varje 'derived table' måste ha sitt eget alias" ER_SELECT_REDUCED 01000 + chi "SELECT %u在优化期间被减" eng "Select %u was reduced during optimization" ger "Select %u wurde während der Optimierung reduziert" jpn "Select %u は最適化によって減らされました。" @@ -4884,6 +5127,7 @@ ER_SELECT_REDUCED 01000 swe "Select %u reducerades vid optimiering" ukr "Select %u was скасовано при оптимiзацii" ER_TABLENAME_NOT_ALLOWED_HERE 42000 + chi "表'%-.192s'从其中一个SELECT中不能用于%-.32s" eng "Table '%-.192s' from one of the SELECTs cannot be used in %-.32s" ger "Tabelle '%-.192s', die in einem der SELECT-Befehle verwendet wurde, kann nicht in %-.32s verwendet werden" jpn "特定のSELECTのみで使用の表 '%-.192s' は %-.32s では使用できません。" @@ -4892,6 +5136,7 @@ ER_TABLENAME_NOT_ALLOWED_HERE 42000 spa "La tabla '%-.192s' de uno de los SELECT no puede ser usada en %-.32s" swe "Tabell '%-.192s' från en SELECT kan inte användas i %-.32s" ER_NOT_SUPPORTED_AUTH_MODE 08004 + chi "客户端不支持服务器请求的身份验证协议;考虑升级MariaDB客户端" eng "Client does not support authentication protocol requested by server; consider upgrading MariaDB client" ger "Client unterstützt das vom Server erwartete Authentifizierungsprotokoll nicht. Bitte aktualisieren Sie Ihren MariaDB-Client" jpn "クライアントはサーバーが要求する認証プロトコルに対応できません。MariaDBクライアントのアップグレードを検討してください。" @@ -4900,6 +5145,7 @@ ER_NOT_SUPPORTED_AUTH_MODE 08004 spa "El cliente no soporta protocolo de autenticación requerido por el servidor; considere mejorar el cliente MariaDB" swe "Klienten stöder inte autentiseringsprotokollet som begärts av servern; överväg uppgradering av klientprogrammet" ER_SPATIAL_CANT_HAVE_NULL 42000 + chi "SPATIAL索引的所有部分必须不为null" eng "All parts of a SPATIAL index must be NOT NULL" ger "Alle Teile eines SPATIAL-Index müssen als NOT NULL deklariert sein" jpn "空間索引のキー列は NOT NULL でなければいけません。" @@ -4908,6 +5154,7 @@ ER_SPATIAL_CANT_HAVE_NULL 42000 spa "Todas las partes de un índice SPATIAL deben de ser NOT NULL" swe "Alla delar av en SPATIAL index måste vara NOT NULL" ER_COLLATION_CHARSET_MISMATCH 42000 + chi "COLLATION'%s'无效地用于字符集'%s'" eng "COLLATION '%s' is not valid for CHARACTER SET '%s'" ger "COLLATION '%s' ist für CHARACTER SET '%s' ungültig" jpn "COLLATION '%s' は CHARACTER SET '%s' に適用できません。" @@ -4916,6 +5163,7 @@ ER_COLLATION_CHARSET_MISMATCH 42000 spa "El COTEJO (COLLATION) '%s' no es válido para CHARACTER SET '%s'" swe "COLLATION '%s' är inte tillåtet för CHARACTER SET '%s'" ER_SLAVE_WAS_RUNNING + chi "Slave已经在运行" eng "Slave is already running" ger "Slave läuft bereits" jpn "スレーブはすでに稼働中です。" @@ -4924,6 +5172,7 @@ ER_SLAVE_WAS_RUNNING spa "El esclavo ya está funcionando" swe "Slaven har redan startat" ER_SLAVE_WAS_NOT_RUNNING + chi "slave已经停止了" eng "Slave already has been stopped" ger "Slave wurde bereits angehalten" jpn "スレーブはすでに停止しています。" @@ -4932,6 +5181,7 @@ ER_SLAVE_WAS_NOT_RUNNING spa "El esclavo ya fué parado" swe "Slaven har redan stoppat" ER_TOO_BIG_FOR_UNCOMPRESS + chi "未压缩的数据量太大;最大量为%d(可能未压缩数据的长度已损坏)" eng "Uncompressed data size too large; the maximum size is %d (probably, length of uncompressed data was corrupted)" ger "Unkomprimierte Daten sind zu groß. Die maximale Größe beträgt %d (wahrscheinlich wurde die Länge der unkomprimierten Daten beschädigt)" jpn "展開後のデータが大きすぎます。最大サイズは %d です。(展開後データの長さ情報が壊れている可能性もあります。)" @@ -4939,6 +5189,7 @@ ER_TOO_BIG_FOR_UNCOMPRESS por "Tamanho muito grande dos dados des comprimidos. O máximo tamanho é %d. (provavelmente, o comprimento dos dados descomprimidos está corrupto)" spa "Tamaño demasiado grande para datos descomprimidos; el máximo tamaño es %d. (probablemente, el tamaño de datos descomprimidos fué corrompido)" ER_ZLIB_Z_MEM_ERROR + chi "ZLIB:内存不足" eng "ZLIB: Not enough memory" ger "ZLIB: Nicht genug Speicher" jpn "ZLIB: メモリ不足です。" @@ -4946,6 +5197,7 @@ ER_ZLIB_Z_MEM_ERROR por "ZLIB: Não suficiente memória disponível" spa "ZLIB: No hay suficiente memoria" ER_ZLIB_Z_BUF_ERROR + chi "ZLIB:输出缓冲区中没有足够的空间(可能未压缩数据的长度已损坏)" eng "ZLIB: Not enough room in the output buffer (probably, length of uncompressed data was corrupted)" ger "ZLIB: Im Ausgabepuffer ist nicht genug Platz vorhanden (wahrscheinlich wurde die Länge der unkomprimierten Daten beschädigt)" jpn "ZLIB: 出力バッファに十分な空きがありません。(展開後データの長さ情報が壊れている可能性もあります。)" @@ -4953,6 +5205,7 @@ ER_ZLIB_Z_BUF_ERROR por "ZLIB: Não suficiente espaço no buffer emissor (provavelmente, o comprimento dos dados descomprimidos está corrupto)" spa "ZLIB: No hay suficiente espacio en el búfer de salida (probablemente, el tamaño de datos descomprimidos fué corrompido)" ER_ZLIB_Z_DATA_ERROR + chi "ZLIB:输入数据已损坏" eng "ZLIB: Input data corrupted" ger "ZLIB: Eingabedaten beschädigt" jpn "ZLIB: 入力データが壊れています。" @@ -4960,9 +5213,11 @@ ER_ZLIB_Z_DATA_ERROR por "ZLIB: Dados de entrada está corrupto" spa "ZLIB: Dato de entrada corrupto" ER_CUT_VALUE_GROUP_CONCAT + chi "group_concat()削减了行%u. %s" eng "Row %u was cut by %s)" spa "La fila %u ha sido cortada por %s)" ER_WARN_TOO_FEW_RECORDS 01000 + chi "行%lu不包含所有列的数据" eng "Row %lu doesn't contain data for all columns" ger "Zeile %lu enthält nicht für alle Felder Daten" jpn "行 %lu はすべての列へのデータを含んでいません。" @@ -4970,6 +5225,7 @@ ER_WARN_TOO_FEW_RECORDS 01000 por "Conta de registro é menor que a conta de coluna na linha %lu" spa "La fila %lu no contiene datos para todas las columnas" ER_WARN_TOO_MANY_RECORDS 01000 + chi "行%lu被截断;它包含的数据比输入列更多" eng "Row %lu was truncated; it contained more data than there were input columns" ger "Zeile %lu gekürzt, die Zeile enthielt mehr Daten, als es Eingabefelder gibt" jpn "行 %lu はデータを切り捨てられました。列よりも多いデータを含んでいました。" @@ -4977,21 +5233,25 @@ ER_WARN_TOO_MANY_RECORDS 01000 por "Conta de registro é maior que a conta de coluna na linha %lu" spa "La fila %lu fué truncada; contenía más datos que columnas de entrada" ER_WARN_NULL_TO_NOTNULL 22004 + chi "列设置为默认值; NULL在行'%s'中提供给了NOT NULL列%lu" eng "Column set to default value; NULL supplied to NOT NULL column '%s' at row %lu" ger "Feld auf Vorgabewert gesetzt, da NULL für NOT-NULL-Feld '%s' in Zeile %lu angegeben" jpn "列にデフォルト値が設定されました。NOT NULLの列 '%s' に 行 %lu で NULL が与えられました。" por "Dado truncado, NULL fornecido para NOT NULL coluna '%s' na linha %lu" spa "Columna puesta a valor por defecto; NULL suministrado para columna NOT NULL '%s' en la fila %lu" ER_WARN_DATA_OUT_OF_RANGE 22003 + chi "列'%s'行%lu的值超出范围" eng "Out of range value for column '%s' at row %lu" spa "Valor fuera de rango para la columna '%s' en la fila %lu" WARN_DATA_TRUNCATED 01000 + chi "数据被截断,在列'%s', 行%lu" eng "Data truncated for column '%s' at row %lu" ger "Daten abgeschnitten für Feld '%s' in Zeile %lu" jpn "列 '%s' の 行 %lu でデータが切り捨てられました。" por "Dado truncado para coluna '%s' na linha %lu" spa "Datos truncados para la columna '%s' en la fila %lu" ER_WARN_USING_OTHER_HANDLER + chi "使用存储引擎%s 表格'%s'" eng "Using storage engine %s for table '%s'" ger "Speicher-Engine %s wird für Tabelle '%s' benutzt" hindi "स्टोरेज इंजन %s का इस्तेमाल टेबल '%s' के लिए किया जा रहा है" @@ -5000,52 +5260,61 @@ ER_WARN_USING_OTHER_HANDLER spa "Usando motor de almacenaje %s para la tabla '%s'" swe "Använder handler %s för tabell '%s'" ER_CANT_AGGREGATE_2COLLATIONS + chi "非法混合collations(%s,%s)和(%s,%s),用于操作'%s'" eng "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'" ger "Unerlaubte Mischung von Sortierreihenfolgen (%s, %s) und (%s, %s) für Operation '%s'" jpn "照合順序 (%s,%s) と (%s,%s) の混在は操作 '%s' では不正です。" por "Combinação ilegal de collations (%s,%s) e (%s,%s) para operação '%s'" spa "Mezcla ilegal de cotejos (collations) (%s,%s) y (%s,%s) para la operación '%s'" ER_DROP_USER + chi "无法删除一个或多个请求的用户" eng "Cannot drop one or more of the requested users" ger "Kann einen oder mehrere der angegebenen Benutzer nicht löschen" spa "No puedo eliminar uno o más de los usuarios solicitados" ER_REVOKE_GRANTS + chi "无法为一个或多个请求的用户撤消所有权限" eng "Can't revoke all privileges for one or more of the requested users" ger "Kann nicht alle Berechtigungen widerrufen, die für einen oder mehrere Benutzer gewährt wurden" jpn "指定されたユーザーから指定された全ての権限を剥奪することができませんでした。" por "Não pode revocar todos os privilégios, grant para um ou mais dos usuários pedidos" spa "No puedo revocar todos los privilegios para uno o más de los usuarios solicitados" ER_CANT_AGGREGATE_3COLLATIONS + chi "非法混合collations(%s,%s),(%s,%s)和(%s,%s),用于操作'%s'" eng "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'" ger "Unerlaubte Mischung von Sortierreihenfolgen (%s, %s), (%s, %s), (%s, %s) für Operation '%s'" jpn "照合順序 (%s,%s), (%s,%s), (%s,%s) の混在は操作 '%s' では不正です。" por "Ilegal combinação de collations (%s,%s), (%s,%s), (%s,%s) para operação '%s'" spa "Mezcla ilegal de cotejos (collations) (%s,%s), (%s,%s), (%s,%s) para la operación '%s'" ER_CANT_AGGREGATE_NCOLLATIONS + chi "非法混合collations操作'%s'" eng "Illegal mix of collations for operation '%s'" ger "Unerlaubte Mischung von Sortierreihenfolgen für Operation '%s'" jpn "操作 '%s' では不正な照合順序の混在です。" por "Ilegal combinação de collations para operação '%s'" spa "Mezcla ilegal de cotejos (collations) para la operación '%s'" ER_VARIABLE_IS_NOT_STRUCT + chi "变量'%-.64s'不是可变组件(不能用作xxxx.variable_name)" eng "Variable '%-.64s' is not a variable component (can't be used as XXXX.variable_name)" ger "Variable '%-.64s' ist keine Variablen-Komponente (kann nicht als XXXX.variablen_name verwendet werden)" jpn "変数 '%-.64s' は構造変数の構成要素ではありません。(XXXX.変数名 という指定はできません。)" por "Variável '%-.64s' não é uma variável componente (Não pode ser usada como XXXX.variável_nome)" spa "La variable '%-.64s' no es un componente variable (No puede ser usada como XXXX.variable_name)" ER_UNKNOWN_COLLATION + chi "未知的collation:'%-.64s'" eng "Unknown collation: '%-.64s'" ger "Unbekannte Sortierreihenfolge: '%-.64s'" jpn "不明な照合順序: '%-.64s'" por "Collation desconhecida: '%-.64s'" spa "Cotejo (Collation) desconocido: '%-.64s'" ER_SLAVE_IGNORED_SSL_PARAMS + chi "CHANGE MASTER中的SSL参数被忽略,因为此MariaDB从站未在没有SSL支持的情况下编译;如果启动了SSL的MariaDB从站,则可以使用它们" eng "SSL parameters in CHANGE MASTER are ignored because this MariaDB slave was compiled without SSL support; they can be used later if MariaDB slave with SSL is started" ger "SSL-Parameter in CHANGE MASTER werden ignoriert, weil dieser MariaDB-Slave ohne SSL-Unterstützung kompiliert wurde. Sie können aber später verwendet werden, wenn ein MariaDB-Slave mit SSL gestartet wird" jpn "このMariaDBスレーブはSSLサポートを含めてコンパイルされていないので、CHANGE MASTER のSSLパラメータは無視されました。今後SSLサポートを持つMariaDBスレーブを起動する際に利用されます。" por "SSL parâmetros em CHANGE MASTER são ignorados porque este escravo MariaDB foi compilado sem o SSL suporte. Os mesmos podem ser usados mais tarde quando o escravo MariaDB com SSL seja iniciado." spa "Los parámetros SSL en CHANGE MASTER son ignorados porque este esclavo MariaDB fue compilado sin soporte SSL; pueden ser usados después cuando el esclavo MariaDB con SSL sea arrancado" ER_SERVER_IS_IN_SECURE_AUTH_MODE + chi "服务器在--secure-auth模式下运行,但'%s'@'%s'具有旧格式的密码;请将密码更改为新格式" eng "Server is running in --secure-auth mode, but '%s'@'%s' has a password in the old format; please change the password to the new format" ger "Server läuft im Modus --secure-auth, aber '%s'@'%s' hat ein Passwort im alten Format. Bitte Passwort ins neue Format ändern" jpn "サーバーは --secure-auth モードで稼働しています。しかし '%s'@'%s' は古い形式のパスワードを使用しています。新しい形式のパスワードに変更してください。" @@ -5053,6 +5322,7 @@ ER_SERVER_IS_IN_SECURE_AUTH_MODE rus "Сервер запущен в режиме --secure-auth (безопасной авторизации), но для пользователя '%s'@'%s' пароль сохранён в старом формате; необходимо обновить формат пароля" spa "El servidor se está ejecutando en modo --secure-auth, pero '%s'@'%s' tiene una contraseña con formato antiguo; por favor cambie la contraseña al nuevo formato" ER_WARN_FIELD_RESOLVED + chi "列或参考'%-.192s%s%-.192s%s%-.192s' 在SELECT #%d 中, 在SELECT #%d中得到解决" eng "Field or reference '%-.192s%s%-.192s%s%-.192s' of SELECT #%d was resolved in SELECT #%d" ger "Feld oder Verweis '%-.192s%s%-.192s%s%-.192s' im SELECT-Befehl Nr. %d wurde im SELECT-Befehl Nr. %d aufgelöst" jpn "フィールドまたは参照 '%-.192s%s%-.192s%s%-.192s' は SELECT #%d ではなく、SELECT #%d で解決されました。" @@ -5061,24 +5331,28 @@ ER_WARN_FIELD_RESOLVED spa "El campo o la referencia '%-.192s%s%-.192s%s%-.192s' de SELECT #%d se resolvió en SELECT #%d" ukr "Стовбець або посилання '%-.192s%s%-.192s%s%-.192s' із SELECTу #%d було знайдене у SELECTі #%d" ER_BAD_SLAVE_UNTIL_COND + chi "START SLAVE UNTIL的参数或参数的组合不正确" eng "Incorrect parameter or combination of parameters for START SLAVE UNTIL" ger "Falscher Parameter oder falsche Kombination von Parametern für START SLAVE UNTIL" jpn "START SLAVE UNTIL へのパラメータまたはその組み合わせが不正です。" por "Parâmetro ou combinação de parâmetros errado para START SLAVE UNTIL" spa "Parámetro incorrecto o combinación de parámetros para START SLAVE UNTIL" ER_MISSING_SKIP_SLAVE + chi "START SLAVE UNTIL进行逐步复制时建议使用--skip-slave-start;否则,如果有意外的Slave的mariadbd重启,可能有问题" eng "It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mariadbd restart" ger "Es wird empfohlen, mit --skip-slave-start zu starten, wenn mit START SLAVE UNTIL eine Schritt-für-Schritt-Replikation ausgeführt wird. Ansonsten gibt es Probleme, wenn ein Slave-Server unerwartet neu startet" jpn "START SLAVE UNTIL で段階的にレプリケーションを行う際には、--skip-slave-start オプションを使うことを推奨します。使わない場合、スレーブのmariadbdが不慮の再起動をすると問題が発生します。" por "É recomendado para rodar com --skip-slave-start quando fazendo replicação passo-por-passo com START SLAVE UNTIL, de outra forma você não está seguro em caso de inesperada reinicialição do mariadbd escravo" spa "Se recomienda usar --skip-slave-start al hacer réplica paso a paso con START SLAVE UNTIL; en caso contrario, obtendrá problemas si tiene lugar un rearranque inesperado del esclavo mariadb" ER_UNTIL_COND_IGNORED + chi "不能启动SQL线程所以UNTIL选项被忽略" eng "SQL thread is not to be started so UNTIL options are ignored" ger "SQL-Thread soll nicht gestartet werden. Daher werden UNTIL-Optionen ignoriert" jpn "スレーブSQLスレッドが開始されないため、UNTILオプションは無視されました。" por "Thread SQL não pode ser inicializado tal que opções UNTIL são ignoradas" spa "Un hilo (thread) SQL no ha de ser arrancado de esa manera HASTA que las opciones sean ignordas" ER_WRONG_NAME_FOR_INDEX 42000 + chi "索引名称'%-.100s'不正确" eng "Incorrect index name '%-.100s'" ger "Falscher Indexname '%-.100s'" jpn "索引名 '%-.100s' は不正です。" @@ -5086,6 +5360,7 @@ ER_WRONG_NAME_FOR_INDEX 42000 spa "Nombre de índice incorrecto '%-.100s'" swe "Felaktigt index namn '%-.100s'" ER_WRONG_NAME_FOR_CATALOG 42000 + chi "目录名称'%-.100s'不正确" eng "Incorrect catalog name '%-.100s'" ger "Falscher Katalogname '%-.100s'" jpn "カタログ名 '%-.100s' は不正です。" @@ -5093,6 +5368,7 @@ ER_WRONG_NAME_FOR_CATALOG 42000 spa "Nombre de catálogo incorrecto '%-.100s'" swe "Felaktigt katalog namn '%-.100s'" ER_WARN_QC_RESIZE + chi "设置查询缓存值%llu失败;新查询缓存值为%lu" eng "Query cache failed to set size %llu; new query cache size is %lu" ger "Änderung der Query-Cache-Größe auf %llu fehlgeschlagen; neue Query-Cache-Größe ist %lu" por "Falha em Query cache para configurar tamanho %llu, novo tamanho de query cache é %lu" @@ -5101,6 +5377,7 @@ ER_WARN_QC_RESIZE swe "Storleken av "Query cache" kunde inte sättas till %llu, ny storlek är %lu" ukr "Кеш запитів неспроможен встановити розмір %llu, новий розмір кеша запитів - %lu" ER_BAD_FT_COLUMN + chi "列'%-.192s'不能成为全文索引的一部分" eng "Column '%-.192s' cannot be part of FULLTEXT index" ger "Feld '%-.192s' kann nicht Teil eines FULLTEXT-Index sein" jpn "列 '%-.192s' は全文索引のキーにはできません。" @@ -5108,6 +5385,7 @@ ER_BAD_FT_COLUMN spa "La columna '%-.192s' no puede format parte de índice FULLTEXT" swe "Kolumn '%-.192s' kan inte vara del av ett FULLTEXT index" ER_UNKNOWN_KEY_CACHE + chi "未知索引缓存'%-.100s'" eng "Unknown key cache '%-.100s'" ger "Unbekannter Schlüssel-Cache '%-.100s'" jpn "'%-.100s' は不明なキーキャッシュです。" @@ -5115,12 +5393,14 @@ ER_UNKNOWN_KEY_CACHE spa "Caché de clave desconocida '%-.100s'" swe "Okänd nyckel cache '%-.100s'" ER_WARN_HOSTNAME_WONT_WORK + chi "MariaDB以-skip-name-resolve模式启动;想用grant,您必须重新启动,不用这个选项" eng "MariaDB is started in --skip-name-resolve mode; you must restart it without this switch for this grant to work" ger "MariaDB wurde mit --skip-name-resolve gestartet. Diese Option darf nicht verwendet werden, damit diese Rechtevergabe möglich ist" jpn "MariaDBは --skip-name-resolve モードで起動しています。このオプションを外して再起動しなければ、この権限操作は機能しません。" por "MariaDB foi inicializado em modo --skip-name-resolve. Você necesita reincializá-lo sem esta opção para este grant funcionar" spa "MariaDB ha sido arrancada en modo --skip-name-resolve; vd necesita reinicializarla sin esta opción para que esta concesión funcione" ER_UNKNOWN_STORAGE_ENGINE 42000 + chi "未知的存储引擎'%s'" eng "Unknown storage engine '%s'" ger "Unbekannte Speicher-Engine '%s'" hindi "अज्ञात स्टोरेज इंजन '%s'" @@ -5128,12 +5408,14 @@ ER_UNKNOWN_STORAGE_ENGINE 42000 por "Motor de tabela desconhecido '%s'" spa "Motor de almacenaje '%s' desconocido" ER_WARN_DEPRECATED_SYNTAX + chi "弃用'%s',将在将来的版本中删除。请使用%s" eng "'%s' is deprecated and will be removed in a future release. Please use %s instead" ger "'%s' ist veraltet. Bitte benutzen Sie '%s'" jpn "'%s' は将来のリリースで廃止予定です。代わりに %s を使用してください。" por "'%s' é desatualizado. Use '%s' em seu lugar" spa "'%s' está obsoleto y será quitado en una entrega futura, use '%s' en su lugar" ER_NON_UPDATABLE_TABLE + chi "目标表%-.100s多个%s不可更新" eng "The target table %-.100s of the %s is not updatable" ger "Die Zieltabelle %-.100s von %s ist nicht aktualisierbar" jpn "対象表 %-.100s は更新可能ではないので、%s を行えません。" @@ -5143,6 +5425,7 @@ ER_NON_UPDATABLE_TABLE swe "Tabell %-.100s använd med '%s' är inte uppdateringsbar" ukr "Таблиця %-.100s у %s не може оновлюватись" ER_FEATURE_DISABLED + chi "'%s'功能被禁用;您需要MariaDB以'%s'构建以使其工作" eng "The '%s' feature is disabled; you need MariaDB built with '%s' to have it working" ger "Das Feature '%s' ist ausgeschaltet, Sie müssen MariaDB mit '%s' übersetzen, damit es verfügbar ist" jpn "機能 '%s' は無効です。利用するためには '%s' を含めてビルドしたMariaDBが必要です。" @@ -5150,6 +5433,7 @@ ER_FEATURE_DISABLED spa "La característica '%s' fue deshabilitada; usted necesita construir MariaDB con '%s' para tener eso funcionando" swe "'%s' är inte aktiverad; För att aktivera detta måste du bygga om MariaDB med '%s' definierad" ER_OPTION_PREVENTS_STATEMENT + chi "MariaDB服务器使用%s选项运行,因此无法执行此语句" eng "The MariaDB server is running with the %s option so it cannot execute this statement" ger "Der MariaDB-Server läuft mit der Option %s und kann diese Anweisung deswegen nicht ausführen" jpn "MariaDBサーバーが %s オプションで実行されているので、このステートメントは実行できません。" @@ -5157,34 +5441,40 @@ ER_OPTION_PREVENTS_STATEMENT spa "El servidor MariaDB se está ejecutando con la opción %s por lo que no se puede ejecutar esta sentencia" swe "MariaDB är startad med %s. Pga av detta kan du inte använda detta kommando" ER_DUPLICATED_VALUE_IN_TYPE + chi "列'%-.100s'有重复的值'%-.64s'在%s" eng "Column '%-.100s' has duplicated value '%-.64s' in %s" ger "Feld '%-.100s' hat doppelten Wert '%-.64s' in %s" jpn "列 '%-.100s' で、重複する値 '%-.64s' が %s に指定されています。" por "Coluna '%-.100s' tem valor duplicado '%-.64s' em %s" spa "La columna '%-.100s' tiene valor duplicado '%-.64s' en %s" ER_TRUNCATED_WRONG_VALUE 22007 + chi "截断的不正确%-.32T值:'%-.128T'" eng "Truncated incorrect %-.32T value: '%-.128T'" ger "Falscher %-.32T-Wert gekürzt: '%-.128T'" jpn "不正な %-.32T の値が切り捨てられました。: '%-.128T'" por "Truncado errado %-.32T valor: '%-.128T'" spa "Truncado incorrecto %-.32T valor: '%-.128T'" ER_TOO_MUCH_AUTO_TIMESTAMP_COLS + chi "表定义不正确;默认或ON UPDATE中只能有一个带有CURRENT_TIMESTAMP的TIMESTAMP列" eng "Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause" ger "Fehlerhafte Tabellendefinition. Es kann nur eine einzige TIMESTAMP-Spalte mit CURRENT_TIMESTAMP als DEFAULT oder in einer ON-UPDATE-Klausel geben" jpn "不正な表定義です。DEFAULT句またはON UPDATE句に CURRENT_TIMESTAMP をともなうTIMESTAMP型の列は1つまでです。" por "Incorreta definição de tabela; Pode ter somente uma coluna TIMESTAMP com CURRENT_TIMESTAMP em DEFAULT ou ON UPDATE cláusula" spa "Definición incorrecta de tabla; solamente puede haber una columna TIMESTAMP con CURRENT_TIMESTAMP en DEFAULT o en cláusula ON UPDATE" ER_INVALID_ON_UPDATE + chi "在'%-.192s'列的ON UPDATE子句上无效" eng "Invalid ON UPDATE clause for '%-.192s' column" ger "Ungültige ON-UPDATE-Klausel für Spalte '%-.192s'" jpn "列 '%-.192s' に ON UPDATE句は無効です。" por "Inválida cláusula ON UPDATE para campo '%-.192s'" spa "Cláusula ON UPDATE inválida para la columna '%-.192s'" ER_UNSUPPORTED_PS + chi "尚未在prepared statement协议中支持此命令" eng "This command is not supported in the prepared statement protocol yet" ger "Dieser Befehl wird im Protokoll für vorbereitete Anweisungen noch nicht unterstützt" spa "Este comando no se encuentra soportado para protocolo de sentencia preparada, aún" ER_GET_ERRMSG + chi "出错%d '%-.200s'来自%s" dan "Modtog fejl %d '%-.200s' fra %s" eng "Got error %d '%-.200s' from %s" ger "Fehler %d '%-.200s' von %s" @@ -5193,247 +5483,300 @@ ER_GET_ERRMSG norwegian-ny "Mottok feil %d '%-.200s' fra %s" spa "Obtenido error %d '%-.200s' desde %s" ER_GET_TEMPORARY_ERRMSG + chi "出临时错误%d '%-.200s'来自%s" dan "Modtog temporary fejl %d '%-.200s' fra %s" eng "Got temporary error %d '%-.200s' from %s" - jpn "一時エラー %d '%-.200s' が %s から返されました。" ger "Temporärer Fehler %d '%-.200s' von %s" + jpn "一時エラー %d '%-.200s' が %s から返されました。" nor "Mottok temporary feil %d '%-.200s' fra %s" norwegian-ny "Mottok temporary feil %d '%-.200s' fra %s" spa "Obtenido error temporal %d '%-.200s' desde %s" ER_UNKNOWN_TIME_ZONE + chi "未知或不正确的时区:'%-.64s'" eng "Unknown or incorrect time zone: '%-.64s'" ger "Unbekannte oder falsche Zeitzone: '%-.64s'" spa "Zona temporal desconocida o incorrecta: '%-.64s'" ER_WARN_INVALID_TIMESTAMP + chi "无效TIMESTAMP值:列'%s' 行'%lu'" eng "Invalid TIMESTAMP value in column '%s' at row %lu" ger "Ungültiger TIMESTAMP-Wert in Feld '%s', Zeile %lu" spa "Valor inválido de SELLO TEMPORAL (TIMESTAMP) en la columna '%s' de la fila %lu" ER_INVALID_CHARACTER_STRING + chi "无效的%s字符串:'%.64T'" eng "Invalid %s character string: '%.64T'" ger "Ungültiger %s-Zeichen-String: '%.64T'" spa "Cadena de carácter %s inválida: '%.64T'" ER_WARN_ALLOWED_PACKET_OVERFLOWED + chi "%s()的结果大于max_allowed_packet(%ld) - 截断" eng "Result of %s() was larger than max_allowed_packet (%ld) - truncated" ger "Ergebnis von %s() war größer als max_allowed_packet (%ld) Bytes und wurde deshalb gekürzt" spa "El resultado de %s() ha sido mayor que max_allowed_packet (%ld) - truncado" ER_CONFLICTING_DECLARATIONS + chi "矛盾语句:'%s%s'和'%s%s'" eng "Conflicting declarations: '%s%s' and '%s%s'" ger "Widersprüchliche Deklarationen: '%s%s' und '%s%s'" spa "Declaraciones conflictivas: '%s%s' y '%s%s'" ER_SP_NO_RECURSIVE_CREATE 2F003 + chi "无法从另一个存储过程中创建%s" eng "Can't create a %s from within another stored routine" ger "Kann kein %s innerhalb einer anderen gespeicherten Routine erzeugen" spa "No puedo crear una %s desde dentro de otra rutina almacenada" ER_SP_ALREADY_EXISTS 42000 + chi "%s%s已经存在" eng "%s %s already exists" ger "%s %s existiert bereits" hindi "%s %s पहले से ही मौजूद है" spa "%s %s ya existe" ER_SP_DOES_NOT_EXIST 42000 + chi "%s%s不存在" eng "%s %s does not exist" ger "%s %s existiert nicht" hindi "%s %s मौजूद नहीं है" spa "%s %s no existe" ER_SP_DROP_FAILED + chi "未能DROP%s%s" eng "Failed to DROP %s %s" ger "DROP %s %s ist fehlgeschlagen" hindi "%s %s को ड्रॉप करने में असफल रहे" spa "No pude ELIMINAR (DROP) %s %s" ER_SP_STORE_FAILED + chi "无法创建%s%s" eng "Failed to CREATE %s %s" ger "CREATE %s %s ist fehlgeschlagen" hindi "%s %s को बनाने में असफल रहे" spa "No pude CREAR %s %s" ER_SP_LILABEL_MISMATCH 42000 + chi "%s,没有匹配标签:%s" eng "%s with no matching label: %s" ger "%s ohne passende Marke: %s" spa "%s sin etiqueta coincidente: %s" ER_SP_LABEL_REDEFINE 42000 + chi "重新定义标签%s" eng "Redefining label %s" ger "Neudefinition der Marke %s" spa "Redefiniendo etiqueta %s" ER_SP_LABEL_MISMATCH 42000 + chi "没有匹配的最终标签%s" eng "End-label %s without match" ger "Ende-Marke %s ohne zugehörigen Anfang" spa "Etiqueta-Final %s sin coincidencia" ER_SP_UNINIT_VAR 01000 + chi "参考未初始化的变量%s" eng "Referring to uninitialized variable %s" ger "Zugriff auf nichtinitialisierte Variable %s" spa "Refiriéndose a variable %s sin inicializar" ER_SP_BADSELECT 0A000 + chi "PROCEDURE%s不能返回给定上下文中的结果集" eng "PROCEDURE %s can't return a result set in the given context" ger "PROCEDURE %s kann im gegebenen Kontext keine Ergebnismenge zurückgeben" spa "El PROCEDIMIENTO (PROCEDURE) %s no puede devolver un conjunto de resultados en el contexto dado" ER_SP_BADRETURN 42000 + chi "RETURN仅允许在函数中" eng "RETURN is only allowed in a FUNCTION" ger "RETURN ist nur innerhalb einer FUNCTION erlaubt" hindi "RETURN को केवल FUNCTION में इस्तेमाल किया जा सकता है" spa "RETURN sólo se permite dentro de una FUNCIÓN" ER_SP_BADSTATEMENT 0A000 + chi "%s不允许在存储过程中" eng "%s is not allowed in stored procedures" ger "%s ist in gespeicherten Prozeduren nicht erlaubt" hindi "%s को STORED PROCEDURE में इस्तेमाल नहीं किया जा सकता है" spa "%s no permitido en procedimientos almacenados" ER_UPDATE_LOG_DEPRECATED_IGNORED 42000 + chi "更新日志被弃用并由二进制日志替换;SET SQL_LOG_UPDATE已被忽略。此选项将在MariaDB 5.6中删除" eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored. This option will be removed in MariaDB 5.6" ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wird ignoriert. Diese Option wird in MariaDB 5.6 entfernt" spa "El historial (log) de actualización se encuentra obsoleto y reemplazado por el historial (log) binario; SET SQL_LOG_UPDATE ha sido ignorado. Esta opción será quitada en MariaDB 5.6" ER_UPDATE_LOG_DEPRECATED_TRANSLATED 42000 + chi "更新日志被弃用并由二进制日志替换;SET SQL_LOG_UPDATE已被转换为设置SQL_LOG_BIN。此选项将在MariaDB 5.6中删除" eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN. This option will be removed in MariaDB 5.6" ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wurde in SET SQL_LOG_BIN übersetzt. Diese Option wird in MariaDB 5.6 entfernt" spa "El historial (log) de actualización se encuentra obsoleto y reemplazado por el historial binario; SET SQL_LOG_UPDATE ha sido traducido a SET SQL_LOG_BIN. Esta opción será quitada en MariaDB 5.6" ER_QUERY_INTERRUPTED 70100 + chi "查询执行中断" eng "Query execution was interrupted" ger "Ausführung der Abfrage wurde unterbrochen" spa "Se ha interrumpido la ejecución de la consulta (query)" ER_SP_WRONG_NO_OF_ARGS 42000 + chi "%s%s的参数数量不正确;预期%u,得到%u" eng "Incorrect number of arguments for %s %s; expected %u, got %u" ger "Falsche Anzahl von Argumenten für %s %s; erwarte %u, erhalte %u" spa "Número incorrecto de argumentos para %s %s; se esperaba %u, se obtuvo %u" ER_SP_COND_MISMATCH 42000 + chi "未定义的CONDITION:%s" eng "Undefined CONDITION: %s" ger "Undefinierte CONDITION: %s" spa "CONDICIÓN no definida: %s" ER_SP_NORETURN 42000 + chi "FUNCTION%s中没有RETURN" eng "No RETURN found in FUNCTION %s" ger "Kein RETURN in FUNCTION %s gefunden" hindi "FUNCTION %s में कोई RETURN है" spa "No se hallado RETURN en FUNCIÓN %s" ER_SP_NORETURNEND 2F005 + chi "FUNCTION%s结束但无RETURN" eng "FUNCTION %s ended without RETURN" ger "FUNCTION %s endete ohne RETURN" hindi "FUNCTION %s RETURN के बिना समाप्त हो गया" spa "La FUNCIÓN %s termina sin RETURN" ER_SP_BAD_CURSOR_QUERY 42000 + chi "Cursor语句必须是选择" eng "Cursor statement must be a SELECT" ger "Cursor-Anweisung muss ein SELECT sein" spa "La sentencia de cursor debe de ser un SELECT" ER_SP_BAD_CURSOR_SELECT 42000 + chi "Cursor SELECT不能有INTO" eng "Cursor SELECT must not have INTO" ger "Cursor-SELECT darf kein INTO haben" spa "El SELECT de cursor no debe de tener INTO" ER_SP_CURSOR_MISMATCH 42000 + chi "未定义的CURSOR:%s" eng "Undefined CURSOR: %s" ger "Undefinierter CURSOR: %s" hindi "CURSOR %s अपरिभाषित है" spa "CURSOR indefinido: %s" ER_SP_CURSOR_ALREADY_OPEN 24000 + chi "Cursor已经打开" eng "Cursor is already open" ger "Cursor ist schon geöffnet" hindi "CURSOR पहले से ही खुला है" spa "Cursor ya abierto" ER_SP_CURSOR_NOT_OPEN 24000 + chi "Cursor未打开" eng "Cursor is not open" ger "Cursor ist nicht geöffnet" spa "Cursor no abierto" ER_SP_UNDECLARED_VAR 42000 + chi "未定义的变量:%s" eng "Undeclared variable: %s" ger "Nicht deklarierte Variable: %s" spa "Variable sin declarar: %s" ER_SP_WRONG_NO_OF_FETCH_ARGS + chi "FETCH变量数不正确" eng "Incorrect number of FETCH variables" ger "Falsche Anzahl von FETCH-Variablen" spa "Incorrecto número de variables FETCH" ER_SP_FETCH_NO_DATA 02000 + chi "没有数据 - 零行被选择或处理" eng "No data - zero rows fetched, selected, or processed" ger "Keine Daten - null Zeilen geholt (fetch), ausgewählt oder verarbeitet" spa "No hay datos - cero filas logradas, seleccionadas o procesadas" ER_SP_DUP_PARAM 42000 + chi "重复参数:%s" eng "Duplicate parameter: %s" ger "Doppelter Parameter: %s" spa "Parámetro duplicado: %s" ER_SP_DUP_VAR 42000 + chi "重复变量:%s" eng "Duplicate variable: %s" ger "Doppelte Variable: %s" spa "Variable duplicada: %s" ER_SP_DUP_COND 42000 + chi "重复条件:%s" eng "Duplicate condition: %s" ger "Doppelte Bedingung: %s" spa "Condición duplicada: %s" ER_SP_DUP_CURS 42000 + chi "重复Cursor:%s" eng "Duplicate cursor: %s" ger "Doppelter Cursor: %s" spa "Cursor duplicado: %s" ER_SP_CANT_ALTER + chi "未能ALTER %s%s" eng "Failed to ALTER %s %s" ger "ALTER %s %s fehlgeschlagen" hindi "%s %s को ALTER करने में असफल रहे" spa "Fallo en ALTER %s %s" ER_SP_SUBSELECT_NYI 0A000 + chi "不支持子查询值" eng "Subquery value not supported" ger "Subquery-Wert wird nicht unterstützt" spa "Valor de Subconsulta (subquery) no soportado" ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG 0A000 + chi "在存储的函数或触发中不允许%s" eng "%s is not allowed in stored function or trigger" ger "%s ist in gespeicherten Funktionen und in Triggern nicht erlaubt" spa "%s no permitido en función almacenada o en disparador" ER_SP_VARCOND_AFTER_CURSHNDLR 42000 + chi "变量或条件声明在cursor或处理程序定义之后" eng "Variable or condition declaration after cursor or handler declaration" ger "Deklaration einer Variablen oder einer Bedingung nach der Deklaration eines Cursors oder eines Handlers" spa "Declaración de variable o condición tras declaración de cursor o manejador" ER_SP_CURSOR_AFTER_HANDLER 42000 + chi "处理程序声明后的cursor声明" eng "Cursor declaration after handler declaration" ger "Deklaration eines Cursors nach der Deklaration eines Handlers" spa "Declaración de cursor tras declaración de manejador" ER_SP_CASE_NOT_FOUND 20000 + chi "未能在CASE语句找到Case" eng "Case not found for CASE statement" ger "Fall für CASE-Anweisung nicht gefunden" spa "Caso no hallado para sentencia CASE" ER_FPARSER_TOO_BIG_FILE + chi "配置文件'%-.192s'太大了" eng "Configuration file '%-.192s' is too big" ger "Konfigurationsdatei '%-.192s' ist zu groß" rus "Слишком большой конфигурационный файл '%-.192s'" spa "El fichero/archivo de configuración '%-.192s' es demasiado grande" ukr "Занадто великий конфігураційний файл '%-.192s'" ER_FPARSER_BAD_HEADER + chi "文件'%-.192s'中的文件类型格式有问题" eng "Malformed file type header in file '%-.192s'" ger "Nicht wohlgeformter Dateityp-Header in Datei '%-.192s'" rus "Неверный заголовок типа файла '%-.192s'" spa "Cabecera de tipo de fichero/archivo malformada en fichero/archivo '%-.192s'" ukr "Невірний заголовок типу у файлі '%-.192s'" ER_FPARSER_EOF_IN_COMMENT + chi "解析评论'%-.200s'时意外碰到EOF" eng "Unexpected end of file while parsing comment '%-.200s'" ger "Unerwartetes Dateiende beim Parsen des Kommentars '%-.200s'" rus "Неожиданный конец файла в коментарии '%-.200s'" spa "Inesperado fin de fichero/archivo mientras se analizaba comentario '%-.200s'" ukr "Несподіванний кінець файлу у коментарі '%-.200s'" ER_FPARSER_ERROR_IN_PARAMETER + chi "解析参数'%-.192s'时出错(行:'%-.192s')" eng "Error while parsing parameter '%-.192s' (line: '%-.192s')" ger "Fehler beim Parsen des Parameters '%-.192s' (Zeile: '%-.192s')" rus "Ошибка при распознавании параметра '%-.192s' (строка: '%-.192s')" spa "Error mientras se analizaba parámetro '%-.192s' (línea: '%-.192s')" ukr "Помилка в роспізнаванні параметру '%-.192s' (рядок: '%-.192s')" ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER + chi "跳过未知参数'%-.192s'时意外碰到EOF" eng "Unexpected end of file while skipping unknown parameter '%-.192s'" ger "Unerwartetes Dateiende beim Überspringen des unbekannten Parameters '%-.192s'" rus "Неожиданный конец файла при пропуске неизвестного параметра '%-.192s'" spa "Inesperado fin de fichero/archivo mientras se saltaba parámetro desconocido '%-.192s'" ukr "Несподіванний кінець файлу у спробі проминути невідомий параметр '%-.192s'" ER_VIEW_NO_EXPLAIN + chi "ANALYZE/EXPLAIN/SHOW无法进行;缺乏底层表的特权" eng "ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table" ger "ANALYZE/EXPLAIN/SHOW kann nicht verlangt werden. Rechte für zugrunde liegende Tabelle fehlen" rus "ANALYZE/EXPLAIN/SHOW не может быть выполнено; недостаточно прав на таблицы запроса" spa "ANALYZE/EXPLAIN/SHOW no puede ser emitdo; privilegios insuficientes para tabla subyacente" ukr "ANALYZE/EXPLAIN/SHOW не може бути виконано; немає прав на таблиці запиту" ER_FRM_UNKNOWN_TYPE + chi "文件'%-.192s'在其标题中有未知的'%-.64s'" eng "File '%-.192s' has unknown type '%-.64s' in its header" ger "Datei '%-.192s' hat unbekannten Typ '%-.64s' im Header" rus "Файл '%-.192s' содержит неизвестный тип '%-.64s' в заголовке" spa "El fichero/archivo '%-.192s' es de un tipo desconocido '%-.64s' en su cabecera" ukr "Файл '%-.192s' має невідомий тип '%-.64s' у заголовку" ER_WRONG_OBJECT + chi "'%-.192s.%-.192s'不是'%s'类" eng "'%-.192s.%-.192s' is not of type '%s'" ger "'%-.192s.%-.192s' ist nicht %s" rus "'%-.192s.%-.192s' - не %s" spa "'%-.192s.%-.192s' no es del tipo '%s'" ukr "'%-.192s.%-.192s' не є %s" ER_NONUPDATEABLE_COLUMN + chi "列'%-.192s'不可更新" eng "Column '%-.192s' is not updatable" ger "Feld '%-.192s' ist nicht aktualisierbar" rus "Столбец '%-.192s' не обновляемый" spa "La columna '%-.192s' no es actualiable" ukr "Стовбець '%-.192s' не може бути зминений" ER_VIEW_SELECT_DERIVED + chi "View的Select的FROM包含子查询" eng "View's SELECT contains a subquery in the FROM clause" ger "SELECT der View enthält eine Subquery in der FROM-Klausel" rus "View SELECT содержит подзапрос в конструкции FROM" @@ -5442,684 +5785,852 @@ ER_VIEW_SELECT_DERIVED # Not used any more, syntax error is returned instead ER_VIEW_SELECT_CLAUSE + chi "View的Select包含“%s”子句" eng "View's SELECT contains a '%s' clause" ger "SELECT der View enthält eine '%s'-Klausel" rus "View SELECT содержит конструкцию '%s'" spa "El SELECT de la vista contiene una cláusula '%s'" ukr "View SELECT має конструкцію '%s'" ER_VIEW_SELECT_VARIABLE + chi "View的选择包含变量或参数" eng "View's SELECT contains a variable or parameter" ger "SELECT der View enthält eine Variable oder einen Parameter" rus "View SELECT содержит переменную или параметр" spa "El SELECT de la vista contiene una variable o un parámetro" ukr "View SELECT має зминну або параметер" ER_VIEW_SELECT_TMPTABLE + chi "View的SELECT指的是临时表'%-.192s'" eng "View's SELECT refers to a temporary table '%-.192s'" ger "SELECT der View verweist auf eine temporäre Tabelle '%-.192s'" rus "View SELECT содержит ссылку на временную таблицу '%-.192s'" spa "El SELECT de la vista se refiere a una tabla temporal '%-.192s'" ukr "View SELECT використовує тимчасову таблицю '%-.192s'" ER_VIEW_WRONG_LIST + chi "View的选择和VIEW的字段列表具有不同的列计数" eng "View's SELECT and view's field list have different column counts" ger "SELECT- und Feldliste der Views haben unterschiedliche Anzahlen von Spalten" rus "View SELECT и список полей view имеют разное количество столбцов" spa "El SELECT de la vista y la lista de campos de la vista tienen un contador diferente de columnas" ukr "View SELECT і перелік стовбців view мають різну кількість сковбців" ER_WARN_VIEW_MERGE + chi "View合并算法目前不能使用(假设未定义的算法)" eng "View merge algorithm can't be used here for now (assumed undefined algorithm)" ger "View-Merge-Algorithmus kann hier momentan nicht verwendet werden (undefinierter Algorithmus wird angenommen)" rus "Алгоритм слияния view не может быть использован сейчас (алгоритм будет неопеределенным)" spa "El algoritmo de fusión de la vista no se puede usar aquí por ahora (se asume algoritmo indefinido)" ukr "Алгоритм зливання view не може бути використаний зараз (алгоритм буде невизначений)" ER_WARN_VIEW_WITHOUT_KEY + chi "更新的视图没有底层表的完整键" eng "View being updated does not have complete key of underlying table in it" ger "Die aktualisierte View enthält nicht den vollständigen Schlüssel der zugrunde liegenden Tabelle" rus "Обновляемый view не содержит ключа использованных(ой) в нем таблиц(ы)" spa "La vista que se está actualizando no tiene clave completa de la tabla subyacente que contiene" ukr "View, що оновлюеться, не містить повного ключа таблиці(ь), що викорістана в ньюому" ER_VIEW_INVALID + chi "View'%-.192s.%-.192s'引用无效的表、列、函数、或者函数或View缺乏使用权" eng "View '%-.192s.%-.192s' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them" spa "La vista '%-.192s.%-.192s' hace referencia a tabla(s) o columna(s) o función(es) inválida(s) o al definidor/invocador de vista le faltan derechos para usarlos" ER_SP_NO_DROP_SP + chi "无法从另一个存储的例程中删除或更改%s" eng "Can't drop or alter a %s from within another stored routine" ger "Kann eine %s nicht von innerhalb einer anderen gespeicherten Routine löschen oder ändern" spa "No puedo eliminar o alterar una %s desde dentro de otra rutina almacenada" ER_SP_GOTO_IN_HNDLR + chi "在存储过程处理程序中不允许GOTO" eng "GOTO is not allowed in a stored procedure handler" ger "GOTO ist im Handler einer gespeicherten Prozedur nicht erlaubt" spa "GOTO no permitido en manejador de procedimiento almacenado" ER_TRG_ALREADY_EXISTS + chi "触发'%s'已经存在" eng "Trigger '%s' already exists" ger "Trigger '%s' existiert bereits" hindi "TRIGGER '%s' पहले से मौजूद है" spa "Ya existe el disparador `%s`" ER_TRG_DOES_NOT_EXIST + chi "触发不存在" eng "Trigger does not exist" ger "Trigger existiert nicht" hindi "TRIGGER मौजूद नहीं है" spa "El disparador no existe" ER_TRG_ON_VIEW_OR_TEMP_TABLE - eng "Trigger's '%-.192s' is view or temporary table" - ger "'%-.192s' des Triggers ist View oder temporäre Tabelle" - spa "El disparador '%-.192s' es una vista o tabla temporal" + chi "触发器的'%-.192s'是视图或临时表" + eng "Trigger's '%-.192s' is a view, temporary table or sequence" + ger "'%-.192s' des Triggers ist ein View, temporäre Tabelle oder Sequence" + spa "El disparador '%-.192s' es una vista, tabla temporal o secuencia" + hindi "Trigger का '%-.192s' एक व्यू, टेम्पररी टेबल या सीक्वेंस है" ER_TRG_CANT_CHANGE_ROW + chi "更新%s行在%s触发器中不允许" eng "Updating of %s row is not allowed in %strigger" ger "Aktualisieren einer %s-Zeile ist in einem %s-Trigger nicht erlaubt" spa "Actualizar la fila %s no está permitido en disparador %s" ER_TRG_NO_SUCH_ROW_IN_TRG + chi "没有%s行,触发%s" eng "There is no %s row in %s trigger" ger "Es gibt keine %s-Zeile im %s-Trigger" spa "No hay fila %s en disparador %s" ER_NO_DEFAULT_FOR_FIELD + chi "字段'%-.192s'没有默认值" eng "Field '%-.192s' doesn't have a default value" ger "Feld '%-.192s' hat keinen Vorgabewert" spa "El campo '%-.192s' no tiene un valor por defecto" ER_DIVISION_BY_ZERO 22012 + chi "除0错误" eng "Division by 0" ger "Division durch 0" hindi "0 से विभाजन" spa "División por 0" ER_TRUNCATED_WRONG_VALUE_FOR_FIELD 22007 + chi "不正确的%-.32s值:'%-.128T'用于列`%.192s`%.192s`%.192s`在%lu行" eng "Incorrect %-.32s value: '%-.128T' for column `%.192s`.`%.192s`.`%.192s` at row %lu" ger "Falscher %-.32s-Wert: '%-.128T' für Feld '`%.192s`.`%.192s`.`%.192s` in Zeile %lu" spa "Incorrecto %-.32s valor: '%-.128T' para columna `%.192s`.`%.192s`.`%.192s` en la fila %lu" ER_ILLEGAL_VALUE_FOR_TYPE 22007 + chi "在解析期间发现的非法%s '%-.192T'值" eng "Illegal %s '%-.192T' value found during parsing" ger "Nicht zulässiger %s-Wert '%-.192T' beim Parsen gefunden" spa "Hallado valor ilegal %s '%-.192T' durante el análisi" ER_VIEW_NONUPD_CHECK + chi "在不可更新的视图%`-.192s.%`-.192s上CHECK OPTION" eng "CHECK OPTION on non-updatable view %`-.192s.%`-.192s" ger "CHECK OPTION auf nicht-aktualisierbarem View %`-.192s.%`-.192s" rus "CHECK OPTION для необновляемого VIEW %`-.192s.%`-.192s" spa "CHECK OPTION en vista no actualizable %`-.192s.%`-.192s" ukr "CHECK OPTION для VIEW %`-.192s.%`-.192s що не може бути оновленним" ER_VIEW_CHECK_FAILED 44000 + chi "CHECK OPTION失败%`-.192s.%`-.192s" eng "CHECK OPTION failed %`-.192s.%`-.192s" ger "CHECK OPTION fehlgeschlagen: %`-.192s.%`-.192s" rus "Проверка CHECK OPTION для VIEW %`-.192s.%`-.192s провалилась" spa "CHECK OPTION falló %`-.192s.%`-.192s" ukr "Перевірка CHECK OPTION для VIEW %`-.192s.%`-.192s не пройшла" ER_PROCACCESS_DENIED_ERROR 42000 + chi "%-.32s命令被拒绝。用户为'%s'@'%s' 例程'%-.192s'" eng "%-.32s command denied to user '%s'@'%s' for routine '%-.192s'" ger "Befehl %-.32s nicht zulässig für Benutzer '%s'@'%s' in Routine '%-.192s'" spa "Comando %-.32s denegado para el usuario '%s'@'%s' para rutina '%-.192s'" ER_RELAY_LOG_FAIL + chi "清除旧继relay日志失败:%s" eng "Failed purging old relay logs: %s" ger "Bereinigen alter Relais-Logs fehlgeschlagen: %s" spa "Falló la purga de viejos historiales (logs) de reenvío: %s" ER_PASSWD_LENGTH + chi "密码哈希应该是一个%d-digit十六进制数" eng "Password hash should be a %d-digit hexadecimal number" ger "Passwort-Hash sollte eine Hexdaezimalzahl mit %d Stellen sein" spa "El valor calculado de la contraseña debería de ser un número hexadecimal de %d-dígitos" ER_UNKNOWN_TARGET_BINLOG + chi "在Binlog索引中找不到目标日志" eng "Target log not found in binlog index" ger "Ziel-Log im Binlog-Index nicht gefunden" spa "Historial (log) de destino no hallado en índice binlog" ER_IO_ERR_LOG_INDEX_READ + chi "读取日志索引文件时I/O错误" eng "I/O error reading log index file" ger "Fehler beim Lesen der Log-Index-Datei" spa "Error de E/S leyendo fichero/archivo índice de historial (log)" ER_BINLOG_PURGE_PROHIBITED + chi "服务器配置不允许Binlog清除" eng "Server configuration does not permit binlog purge" ger "Server-Konfiguration erlaubt keine Binlog-Bereinigung" spa "La configuración del servidor no permite purgar binlog" ER_FSEEK_FAIL + chi "fseek()失败" eng "Failed on fseek()" ger "fseek() fehlgeschlagen" hindi "fseek() विफल रहा" spa "Fallo en fseek()" ER_BINLOG_PURGE_FATAL_ERR + chi "日志清除期间的致命错误" eng "Fatal error during log purge" ger "Schwerwiegender Fehler bei der Log-Bereinigung" spa "Error fatal durante la purga del historial (log)" ER_LOG_IN_USE + chi "日志在用,不会清除" eng "A purgeable log is in use, will not purge" ger "Ein zu bereinigendes Log wird gerade benutzt, daher keine Bereinigung" spa "Se encuentra en uso un historial purgable, no lo purgaré" ER_LOG_PURGE_UNKNOWN_ERR + chi "日志清除期间未知错误" eng "Unknown error during log purge" ger "Unbekannter Fehler bei Log-Bereinigung" spa "Error desconocido durante la purga del historial (log)" ER_RELAY_LOG_INIT + chi "初始化relay日志失败。位置:%s" eng "Failed initializing relay log position: %s" ger "Initialisierung der Relais-Log-Position fehlgeschlagen: %s" spa "Fallo inicializando la posición del historial de reenvío: %s" ER_NO_BINARY_LOGGING + chi "您不使用二进制日志记录" eng "You are not using binary logging" ger "Sie verwenden keine Binärlogs" spa "No está usando historial (log) binario" ER_RESERVED_SYNTAX + chi "'%-.64s'语法保留用于MariaDB服务器内部" eng "The '%-.64s' syntax is reserved for purposes internal to the MariaDB server" ger "Die Schreibweise '%-.64s' ist für interne Zwecke des MariaDB-Servers reserviert" spa "La sintaxis '%-.64s' está reservada para propósitos internos del servidor MariaDB" ER_WSAS_FAILED + chi "WSAStartup失败了" eng "WSAStartup Failed" ger "WSAStartup fehlgeschlagen" spa "Falló WSAStartup" ER_DIFF_GROUPS_PROC + chi "无法处理具有不同组的过程" eng "Can't handle procedures with different groups yet" ger "Kann Prozeduren mit unterschiedlichen Gruppen noch nicht verarbeiten" spa "No puedo manejar procedimientos con grupos diferentes, aún" ER_NO_GROUP_FOR_PROC + chi "SELECT必须具有此过程的组" eng "Select must have a group with this procedure" ger "SELECT muss bei dieser Prozedur ein GROUP BY haben" spa "La selección debe de tener un grupo con este procedimiento" ER_ORDER_WITH_PROC + chi "无法在次存储过程使用ORDER子句" eng "Can't use ORDER clause with this procedure" ger "Kann bei dieser Prozedur keine ORDER-BY-Klausel verwenden" spa "No puedo usar la cláusula ORDER con este procedimiento" ER_LOGGING_PROHIBIT_CHANGING_OF + chi "二进制日志记录和复制禁止更改全局服务器%s" eng "Binary logging and replication forbid changing the global server %s" ger "Binärlogs und Replikation verhindern Wechsel des globalen Servers %s" spa "El historial (log) binario y la réplica prohibe cambiar el servidor global %s" ER_NO_FILE_MAPPING + chi "无法映射文件:%-.200s,错误号码:%M" eng "Can't map file: %-.200s, errno: %M" ger "Kann Datei nicht abbilden: %-.200s, Fehler: %M" spa "No puedo mapear fichero/archivo: %-.200s, error: %M" ER_WRONG_MAGIC + chi "魔法错误%-.64s" eng "Wrong magic in %-.64s" ger "Falsche magische Zahlen in %-.64s" spa "Magia equivocada en %-.64s" ER_PS_MANY_PARAM + chi "Prepared statement包含太多占位符" eng "Prepared statement contains too many placeholders" ger "Vorbereitete Anweisung enthält zu viele Platzhalter" spa "Sentencia preparada contiene demasiados marcadores de posición" ER_KEY_PART_0 + chi "索引部分'%-.192s'长度不能为0" eng "Key part '%-.192s' length cannot be 0" ger "Länge des Schlüsselteils '%-.192s' kann nicht 0 sein" spa "El tamaño de trozo de clave '%-.192s' no puede ser 0" ER_VIEW_CHECKSUM + chi "查看文本checksum失败" eng "View text checksum failed" ger "View-Text-Prüfsumme fehlgeschlagen" rus "Проверка контрольной суммы текста VIEW провалилась" spa "Ha fallado la suma de comprobación del texto de la vista" ukr "Перевірка контрольної суми тексту VIEW не пройшла" ER_VIEW_MULTIUPDATE + chi "无法通过JOIN视图'%-.192s.%-.192s'修改多个基础表。" eng "Can not modify more than one base table through a join view '%-.192s.%-.192s'" ger "Kann nicht mehr als eine Basistabelle über Join-View '%-.192s.%-.192s' ändern" rus "Нельзя изменить больше чем одну базовую таблицу используя многотабличный VIEW '%-.192s.%-.192s'" spa "No puedo modificar más de una tabla base a través de una vista de unión '%-.192s.%-.192s'" ukr "Неможливо оновити більш ниж одну базову таблицю выкористовуючи VIEW '%-.192s.%-.192s', що містіть декілька таблиць" ER_VIEW_NO_INSERT_FIELD_LIST + chi "无法写入JOIN视图'%-.192s.%-.192s'没有字段列表" eng "Can not insert into join view '%-.192s.%-.192s' without fields list" ger "Kann nicht ohne Feldliste in Join-View '%-.192s.%-.192s' einfügen" rus "Нельзя вставлять записи в многотабличный VIEW '%-.192s.%-.192s' без списка полей" spa "No puedo insertar dentro de vista de unión '%-.192s.%-.192s' sin lista de campos" ukr "Неможливо уставити рядки у VIEW '%-.192s.%-.192s', що містить декілька таблиць, без списку стовбців" ER_VIEW_DELETE_MERGE_VIEW + chi "无法从JOIN视图'%-.192s.%-.192s'删除" eng "Can not delete from join view '%-.192s.%-.192s'" ger "Kann nicht aus Join-View '%-.192s.%-.192s' löschen" rus "Нельзя удалять из многотабличного VIEW '%-.192s.%-.192s'" spa "No puedo borrar desde vista de unión '%-.192s.%-.192s'" ukr "Неможливо видалити рядки у VIEW '%-.192s.%-.192s', що містить декілька таблиць" ER_CANNOT_USER + chi "操作%s失败%.256s" eng "Operation %s failed for %.256s" ger "Operation %s schlug fehl für %.256s" norwegian-ny "Operation %s failed for '%.256s'" spa "Ha fallado la operación %s para %.256s" ER_XAER_NOTA XAE04 + chi "XAER_NOTA:未知的XID" eng "XAER_NOTA: Unknown XID" ger "XAER_NOTA: Unbekannte XID" spa "XAER_NOTA: XID desconocido" ER_XAER_INVAL XAE05 + chi "XAER_INVAL:无效的参数(或不支持的命令)" eng "XAER_INVAL: Invalid arguments (or unsupported command)" ger "XAER_INVAL: Ungültige Argumente (oder nicht unterstützter Befehl)" spa "XAER_INVAL: Argumentos inválidos (o comando no soportado)" ER_XAER_RMFAIL XAE07 + chi "XAER_RMFAIL:当全局事务处于%.64s状态时,无法执行该命令" eng "XAER_RMFAIL: The command cannot be executed when global transaction is in the %.64s state" ger "XAER_RMFAIL: DEr Befehl kann nicht ausgeführt werden, wenn die globale Transaktion im Zustand %.64s ist" rus "XAER_RMFAIL: эту команду нельзя выполнять когда глобальная транзакция находится в состоянии '%.64s'" spa "XAER_RMFAIL: El comando no se puede ejecutar cuando la transacción global se encuentra en estado %.64s" ER_XAER_OUTSIDE XAE09 + chi "XAER_OUTSIDE:一些工作是在全局交易之外完成的" eng "XAER_OUTSIDE: Some work is done outside global transaction" ger "XAER_OUTSIDE: Einige Arbeiten werden außerhalb der globalen Transaktion verrichtet" spa "XAER_OUTSIDE: Algún trabajo se ha realizado fuera de la transacción global" ER_XAER_RMERR XAE03 + chi "XAER_RMERR:事务分支中发生致命错误 - 检查您的数据以获得一致性" eng "XAER_RMERR: Fatal error occurred in the transaction branch - check your data for consistency" ger "XAER_RMERR: Schwerwiegender Fehler im Transaktionszweig - prüfen Sie Ihre Daten auf Konsistenz" spa "XAER_RMERR: Ha ocurrido un error fatal en la rama de la transacción - revise la consitencia de sus datos" ER_XA_RBROLLBACK XA100 + chi "XA_RBROLBACK:交易分支回滚" eng "XA_RBROLLBACK: Transaction branch was rolled back" ger "XA_RBROLLBACK: Transaktionszweig wurde zurückgerollt" spa "XA_RBROLLBACK: La rama de la transacción ha sido retrocedida (rolled back)" ER_NONEXISTING_PROC_GRANT 42000 + chi "无授权:用户'%-.48s'主机'%-.64s'ROUTINE'%-.192s'" eng "There is no such grant defined for user '%-.48s' on host '%-.64s' on routine '%-.192s'" ger "Es gibt diese Berechtigung für Benutzer '%-.48s' auf Host '%-.64s' für Routine '%-.192s' nicht" spa "No existe tal concesión definida para el usuario '%-.48s' en equipo '%-.64s' en rutina '%-.192s'" ER_PROC_AUTO_GRANT_FAIL + chi "无法授予EXECUTE和ALTER ROUTINE权限" eng "Failed to grant EXECUTE and ALTER ROUTINE privileges" ger "Gewährung von EXECUTE- und ALTER-ROUTINE-Rechten fehlgeschlagen" spa "Fallo al conceder privilegios de EXECUTE y ALTER ROUTINE" ER_PROC_AUTO_REVOKE_FAIL + chi "无法撤消所有权限以删除例程" eng "Failed to revoke all privileges to dropped routine" ger "Rücknahme aller Rechte für die gelöschte Routine fehlgeschlagen" spa "Fallo al rescindir todos los privilegios de la rutina anulada" ER_DATA_TOO_LONG 22001 + chi "列'%s'行%lu数据太长" eng "Data too long for column '%s' at row %lu" ger "Daten zu lang für Feld '%s' in Zeile %lu" spa "Datos demasiado largos para la columna '%s' en la fila %lu" ER_SP_BAD_SQLSTATE 42000 + chi "坏SQLSTATE:'%s'" eng "Bad SQLSTATE: '%s'" ger "Ungültiger SQLSTATE: '%s'" spa "Mal SQLSTATE: '%s'" ER_STARTUP + chi "%s:已经准备好接受连接\nVersion:'%s'套接字:'%s'端口:%d %s" eng "%s: ready for connections.\nVersion: '%s' socket: '%s' port: %d %s" ger "%s: bereit für Verbindungen.\nVersion: '%s' Socket: '%s' Port: %d %s" spa "%s: preparada para conexiones.\nVersión: '%s' conector: '%s' puerto: %d %s" ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR + chi "无法从带有固定大小行的文件中加载值到变量" eng "Can't load value from file with fixed size rows to variable" ger "Kann Wert aus Datei mit Zeilen fester Größe nicht in Variable laden" spa "No puedo cargar valor desde fichero/archivo con filas de tamaño fijo en variable" ER_CANT_CREATE_USER_WITH_GRANT 42000 + chi "您不允许使用创建用户时给予GRANT" eng "You are not allowed to create a user with GRANT" ger "Sie dürfen keinen Benutzer mit GRANT anlegen" spa "No está autorizado a crear un usuario con GRANT" ER_WRONG_VALUE_FOR_TYPE + chi "不正确的%-.32s值:'%-.128T' 函数:%-.32s" eng "Incorrect %-.32s value: '%-.128T' for function %-.32s" ger "Falscher %-.32s-Wert: '%-.128T' für Funktion %-.32s" spa "Incorrecto valor %-.32s: '%-.128T' para la función %-.32s" ER_TABLE_DEF_CHANGED + chi "表定义已更改,请重试" eng "Table definition has changed, please retry transaction" ger "Tabellendefinition wurde geändert, bitte starten Sie die Transaktion neu" spa "Ha cambiado la definición de la tabla, por favor reintente la transacción" ER_SP_DUP_HANDLER 42000 + chi "在同一块中声明的处理程序重复" eng "Duplicate handler declared in the same block" ger "Doppelter Handler im selben Block deklariert" spa "Manejador duplicado declarado en mismo bloque" ER_SP_NOT_VAR_ARG 42000 + chi "OUT或INOUT参数%d 例程 %s的不是BEFORE触发器里的变量或新伪变量" eng "OUT or INOUT argument %d for routine %s is not a variable or NEW pseudo-variable in BEFORE trigger" ger "OUT- oder INOUT-Argument %d für Routine %s ist keine Variable" spa "El argumento %d OUT o INOUT para la rutina %s no es una variable o pseudo-variable NEW en disparador BEFORE" ER_SP_NO_RETSET 0A000 + chi "不允许从%s返回结果集" eng "Not allowed to return a result set from a %s" ger "Rückgabe einer Ergebnismenge aus einer %s ist nicht erlaubt" spa "No autorizado a devolver un conjunto de resultados desde un %s" ER_CANT_CREATE_GEOMETRY_OBJECT 22003 + chi "无法从发送到几何字段的数据中获取几何对象" eng "Cannot get geometry object from data you send to the GEOMETRY field" ger "Kann kein Geometrieobjekt aus den Daten machen, die Sie dem GEOMETRY-Feld übergeben haben" spa "No puedo obtener objeto de geometría desde los datos que vd envía al campo GEOMETRY" ER_FAILED_ROUTINE_BREAK_BINLOG + chi "ROUTINE失败,定义中既没有NO SQL也没有READ SQL DAT。启用二进制日志记录;如果更新非事务性表,则二进制日志将会错过其更改" eng "A routine failed and has neither NO SQL nor READS SQL DATA in its declaration and binary logging is enabled; if non-transactional tables were updated, the binary log will miss their changes" ger "Eine Routine, die weder NO SQL noch READS SQL DATA in der Deklaration hat, schlug fehl und Binärlogging ist aktiv. Wenn Nicht-Transaktions-Tabellen aktualisiert wurden, enthält das Binärlog ihre Änderungen nicht" spa "Ha fallado una rutina y no tiene ni NO SQL ni READS SQL DATA en su declaración y el historial (log) binario se encuentra activado; si han sido actualizadas tablas no transaccionales, el fichero/archivo binario de historial (log) perderá sus cambios" ER_BINLOG_UNSAFE_ROUTINE + chi "此函数定义中没有DETERMINISTIC,NO SQL,或者READS SQL DATA,并且已启用二进制日志记录(您*可能*希望使用较少的安全性的log_bin_trust_function_creators变量)" eng "This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)" ger "Diese Routine hat weder DETERMINISTIC, NO SQL noch READS SQL DATA in der Deklaration und Binärlogging ist aktiv (*vielleicht* sollten Sie die weniger sichere Variable log_bin_trust_function_creators verwenden)" spa "Esta función no tiene ninguno de DETERMINISTIC, NO SQL o READS SQL DATA en su declaración y está activado el historial binario (vd *podría* querer usar la variable menos segura log_bin_trust_function_creators)" ER_BINLOG_CREATE_ROUTINE_NEED_SUPER + chi "您没有超级特权和二进制日志记录已启用(您*可能*想要使用较少的安全log_bin_trust_function_creators变量)" eng "You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)" ger "Sie haben keine SUPER-Berechtigung und Binärlogging ist aktiv (*vielleicht* sollten Sie die weniger sichere Variable log_bin_trust_function_creators verwenden)" spa "No tiene el privilegio SUPER y está activado el historial binario (*podría* querer usar la variable menos segura log_bin_trust_function_creators)" ER_EXEC_STMT_WITH_OPEN_CURSOR + chi "您无法执行具有与之关联的打开Cursor的prepared statement。重置语句以重新执行它" eng "You can't execute a prepared statement which has an open cursor associated with it. Reset the statement to re-execute it" ger "Sie können keine vorbereitete Anweisung ausführen, die mit einem geöffneten Cursor verknüpft ist. Setzen Sie die Anweisung zurück, um sie neu auszuführen" spa "No puede ejecutar una sentencia preparada que tiene abierto un cursor asociado con ella. Renueve la sentencia para re-ejecutarla" ER_STMT_HAS_NO_OPEN_CURSOR + chi "语句(%lu)没有开放的Cursor" eng "The statement (%lu) has no open cursor" ger "Die Anweisung (%lu) hat keinen geöffneten Cursor" spa "La sentencia (%lu) no tiene cursor abierto" ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG + chi "在存储的函数或触发器中不允许显式或隐式提交" eng "Explicit or implicit commit is not allowed in stored function or trigger" ger "Explizites oder implizites Commit ist in gespeicherten Funktionen und in Triggern nicht erlaubt" spa "Comisión (commit) implícita o explícita no permitida en funciones almacenadas o en disparadores" ER_NO_DEFAULT_FOR_VIEW_FIELD + chi "VIEW的列'%-.192s.%-.192s'底层表没有默认值" eng "Field of view '%-.192s.%-.192s' underlying table doesn't have a default value" ger "Ein Feld der dem View '%-.192s.%-.192s' zugrundeliegenden Tabelle hat keinen Vorgabewert" spa "El campo de tabla subyacente de vista '%-.192s.%-.192s' no tiene valor por defecto" ER_SP_NO_RECURSION + chi "不允许递归存储功能和触发器" eng "Recursive stored functions and triggers are not allowed" ger "Rekursive gespeicherte Routinen und Triggers sind nicht erlaubt" spa "No autorizadas funciones almacenadas recursivas ni disparadores" ER_TOO_BIG_SCALE 42000 S1009 + chi "指定的大规模%llu为'%-.192s'。最大是%u" eng "Too big scale %llu specified for '%-.192s'. Maximum is %u" ger "Zu großer Skalierungsfaktor %llu für '%-.192s' angegeben. Maximum ist %u" spa "Escala %llu demasiado grande especificada para '%-.192s'. El máximo es de %u" ER_TOO_BIG_PRECISION 42000 S1009 + chi "指定的精度%llu太大 '%-.192s'。最大是%u" eng "Too big precision %llu specified for '%-.192s'. Maximum is %u" ger "Zu große Genauigkeit %llu für '%-.192s' angegeben. Maximum ist %u" spa "Precisión %llu demasiado grande especificada para '%-.192s'. El máximo es de %u" ER_M_BIGGER_THAN_D 42000 S1009 + chi "对于FLOAT(M,D),DOUBLE(M,D)或DECIMAL(M,D),M必须> = D(列'%-.192s')" eng "For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '%-.192s')" ger "Für FLOAT(M,D), DOUBLE(M,D) oder DECIMAL(M,D) muss M >= D sein (Feld '%-.192s')" spa "Para flotante(M,D), doble(M,D) o decimal(M,D), M debe de ser >= D (columna '%-.192s')" ER_WRONG_LOCK_OF_SYSTEM_TABLE + chi "您无法将系统表的写入锁定与其他表或锁定类型相结合" eng "You can't combine write-locking of system tables with other tables or lock types" - ger "Sie können Schreibsperren auf der Systemtabelle nicht mit anderen Tabellen kombinieren" + ger "Sie können Schreibsperren auf der Systemtabelle nicht mit anderen Tabellen kombinieren" spa "No puede combinar bloqueo de escritura de tablas de sistema con otras tablas o tipos de bloqueo" ER_CONNECT_TO_FOREIGN_DATA_SOURCE + chi "无法连接到外数据源:%.64s" eng "Unable to connect to foreign data source: %.64s" ger "Kann nicht mit Fremddatenquelle verbinden: %.64s" spa "No puedo conectar a fuente foránea de datos: %.64s" ER_QUERY_ON_FOREIGN_DATA_SOURCE + chi "处理对外数据源上的查询时出现问题。数据源错误:%-.64s" eng "There was a problem processing the query on the foreign data source. Data source error: %-.64s" ger "Bei der Verarbeitung der Abfrage ist in der Fremddatenquelle ein Problem aufgetreten. Datenquellenfehlermeldung: %-.64s" spa "Hubo un problema procesando la consulta (query) en la fuente foránea de datos. Error de fuente de datos: %-.64s" ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST + chi "您尝试引用的外数据源不存在。数据源错误:%-.64s" eng "The foreign data source you are trying to reference does not exist. Data source error: %-.64s" ger "Die Fremddatenquelle, auf die Sie zugreifen wollen, existiert nicht. Datenquellenfehlermeldung: %-.64s" spa "La fuente foránea de datos que intenta referenciar no existe. Error en fuente de datos: %-.64s" ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE + chi "无法创建联合表。数据源连接字符串'%-.64s'不是正确的格式" eng "Can't create federated table. The data source connection string '%-.64s' is not in the correct format" ger "Kann föderierte Tabelle nicht erzeugen. Der Datenquellen-Verbindungsstring '%-.64s' hat kein korrektes Format" spa "No puedo crear tabla federada. La cadena de conexión de la fuente de datos '%-.64s' no tiene el formato correcto" ER_FOREIGN_DATA_STRING_INVALID + chi "数据源连接字符串'%-.64s'不是正确的格式" eng "The data source connection string '%-.64s' is not in the correct format" ger "Der Datenquellen-Verbindungsstring '%-.64s' hat kein korrektes Format" spa "La cadena de conexón de la fuente de datos '%-.64s' no tiene el formato correcto" ER_CANT_CREATE_FEDERATED_TABLE + chi "无法创建联合表。外数据SRC错误:%-.64s" eng "Can't create federated table. Foreign data src error: %-.64s" ger "Kann föderierte Tabelle nicht erzeugen. Fremddatenquellenfehlermeldung: %-.64s" spa "No puedo crear tabla federada. Error en fuente de datos foráneos: %-.64s" ER_TRG_IN_WRONG_SCHEMA + chi "触发在错的SCHEMA" eng "Trigger in wrong schema" ger "Trigger im falschen Schema" spa "Disparador en esquema equivocado" ER_STACK_OVERRUN_NEED_MORE + chi "线程堆栈溢出:%ld字节堆栈的%ld字节,以及所需的%ld字节。使用'mariadbd --thread_stack =#'指定更大的堆栈" eng "Thread stack overrun: %ld bytes used of a %ld byte stack, and %ld bytes needed. Consider increasing the thread_stack system variable." ger "Thread-Stack-Überlauf: %ld Bytes eines %ld-Byte-Stacks in Verwendung, und %ld Bytes benötigt. Verwenden Sie 'mariadbd --thread_stack=#', um einen größeren Stack anzugeben" jpn "スレッドスタック不足です(使用: %ld ; サイズ: %ld ; 要求: %ld)。より大きい値で 'mariadbd --thread_stack=#' の指定をしてください。" spa "Desbordamiento en pila de hilos (threads): %ld bytes usados de una pila de %ld y son necesarios %ld bytes. Considere el incrementar la variable de sistema --thread_stack=#." ER_TOO_LONG_BODY 42000 S1009 + chi "'%-.100s”的ROUTINE太长了" eng "Routine body for '%-.100s' is too long" ger "Routinen-Body für '%-.100s' ist zu lang" spa "El cuerpo de rutina para '%-.100s' es demasiado largo" ER_WARN_CANT_DROP_DEFAULT_KEYCACHE + chi "无法删除默认索引缓存" eng "Cannot drop default keycache" ger "Der vorgabemäßige Schlüssel-Cache kann nicht gelöscht werden" spa "No puedo eliminar keycache por defecto" ER_TOO_BIG_DISPLAYWIDTH 42000 S1009 + chi "显示宽度超过'%-.192s'的范围(max =%lu)" eng "Display width out of range for '%-.192s' (max = %lu)" ger "Anzeigebreite außerhalb des zulässigen Bereichs für '%-.192s' (Maximum = %lu)" spa "Ancho a mostrar fuera de rango para '%-.192s' (máx = %lu)" ER_XAER_DUPID XAE08 + chi "XAER_DUPID:xid已存在" eng "XAER_DUPID: The XID already exists" ger "XAER_DUPID: Die XID existiert bereits" spa "XAER_DUPID: El XID ya existe" ER_DATETIME_FUNCTION_OVERFLOW 22008 + chi "DateTime函数:%-.32s字段溢出" eng "Datetime function: %-.32s field overflow" ger "Datetime-Funktion: %-.32s Feldüberlauf" spa "Función Datetime: %-.32s desbordamiento de campo" ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG + chi "在存储的函数/触发器中无法更新表'%-.192s',因为它已被调用此存储的函数/触发器调用的语句" eng "Can't update table '%-.192s' in stored function/trigger because it is already used by statement which invoked this stored function/trigger" ger "Kann Tabelle '%-.192s' in gespeicherter Funktion oder Trigger nicht aktualisieren, weil sie bereits von der Anweisung verwendet wird, die diese gespeicherte Funktion oder den Trigger aufrief" spa "No puedo actualizar tabla '%-.192s' en función almacenada/disparador porque ya está siendo usada por la sentencia que invocó esta función almacenada/disparador" ER_VIEW_PREVENT_UPDATE - eng "The definition of table '%-.192s' prevents operation %.192s on table '%-.192s'" - ger "Die Definition der Tabelle '%-.192s' verhindert die Operation %.192s auf Tabelle '%-.192s'" - spa "La definición de la tabla '%-.192s' previene la operación %.192s en la tabla '%-.192s'" + chi "表'%-.192s'的定义可防止在表'%-.192s'上的操作'%-.192s'" + eng "The definition of table '%-.192s' prevents operation %-.192s on table '%-.192s'" + ger "Die Definition der Tabelle '%-.192s' verhindert die Operation %-.192s auf Tabelle '%-.192s'" + spa "La definición de la tabla '%-.192s' previene la operación %-.192s en la tabla '%-.192s'" ER_PS_NO_RECURSION + chi "prepared statement包含一个有关该语句的存储例程调用。它不允许以这种递归方式执行prepared statement" eng "The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a prepared statement in such a recursive manner" ger "Die vorbereitete Anweisung enthält einen Aufruf einer gespeicherten Routine, die auf eben dieselbe Anweisung verweist. Es ist nicht erlaubt, eine vorbereitete Anweisung in solch rekursiver Weise auszuführen" spa "La sentencia preparada contiene una llamada a rutina almacenada que se refiere a esa misma sentencia. No está permitido ejecutar una sentencia preparada de esta manera recursiva" ER_SP_CANT_SET_AUTOCOMMIT + chi "不允许从存储的函数或触发器设置自动判处" eng "Not allowed to set autocommit from a stored function or trigger" ger "Es ist nicht erlaubt, innerhalb einer gespeicherten Funktion oder eines Triggers AUTOCOMMIT zu setzen" spa "No permitido usar auto acometida (autocommit) desde una función almacenada o disparador" ER_MALFORMED_DEFINER 0L000 + chi "无效的定义" eng "Invalid definer" spa "Definidor inválido" ER_VIEW_FRM_NO_USER + chi "VIEW'%-.192s'。'%-.192s'没有绝定的信息(旧表格式)。当前用户用作定义。请重新创建视图!" eng "View '%-.192s'.'%-.192s' has no definer information (old table format). Current user is used as definer. Please recreate the view!" ger "View '%-.192s'.'%-.192s' hat keine Definierer-Information (altes Tabellenformat). Der aktuelle Benutzer wird als Definierer verwendet. Bitte erstellen Sie den View neu" spa "La vista '%-.192s'.'%-.192s' no tiene información de definidor (formato viejo de tabla). Se usa el usuario actual como definidor. Por favor, ¡recrea la vista!" ER_VIEW_OTHER_USER + chi "您需要使用'%-.192s'@'%-.192s'的创建视图的超级特权" eng "You need the SUPER privilege for creation view with '%-.192s'@'%-.192s' definer" ger "Sie brauchen die SUPER-Berechtigung, um einen View mit dem Definierer '%-.192s'@'%-.192s' zu erzeugen" spa "Vd necesita el privilegio SUPER para la creación de la vista con definidor '%-.192s'@'%-.192s'" ER_NO_SUCH_USER + chi "指定为定义的用户('%-.64s'@'%-.64s')不存在" eng "The user specified as a definer ('%-.64s'@'%-.64s') does not exist" ger "Der als Definierer angegebene Benutzer ('%-.64s'@'%-.64s') existiert nicht" spa "El usuario especificado como definidor ('%-.64s'@'%-.64s') no existe" ER_FORBID_SCHEMA_CHANGE + chi "不允许从'%-.192s'到'%-.192s'的SCHEMA更改" eng "Changing schema from '%-.192s' to '%-.192s' is not allowed" ger "Wechsel des Schemas von '%-.192s' auf '%-.192s' ist nicht erlaubt" spa "Vd no está autorizado a cambiar el esquema de '%-.192s' a '%-.192s'" ER_ROW_IS_REFERENCED_2 23000 + chi "无法删除或更新父行:外键约束失败(%.192s)" eng "Cannot delete or update a parent row: a foreign key constraint fails (%.192s)" ger "Kann Eltern-Zeile nicht löschen oder aktualisieren: eine Fremdschlüsselbedingung schlägt fehl (%.192s)" spa "No puedo borrar o actualizar una fila padre: falla una restricción de clave foránea (%.192s)" ER_NO_REFERENCED_ROW_2 23000 + chi "无法添加或更新子行:外键约束失败(%.192s)" eng "Cannot add or update a child row: a foreign key constraint fails (%.192s)" ger "Kann Kind-Zeile nicht hinzufügen oder aktualisieren: eine Fremdschlüsselbedingung schlägt fehl (%.192s)" spa "No puedo añadir o actualizar una fila hija: falla una restricción de clave foránea (%.192s)" ER_SP_BAD_VAR_SHADOW 42000 + chi "变量'%-.64s'必须用`...`,或重命名" eng "Variable '%-.64s' must be quoted with `...`, or renamed" ger "Variable '%-.64s' muss mit `...` geschützt oder aber umbenannt werden" spa "La variable '%-.64s' debe de ser entrecomillada con `...` o renombrada" ER_TRG_NO_DEFINER + chi "触发'%-.192s'的绝对属性。'%-.192s'。触发器将在调用者的授权下激活,该权限可能不足。请重新创建触发器" eng "No definer attribute for trigger '%-.192s'.'%-.192s'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger" ger "Kein Definierer-Attribut für Trigger '%-.192s'.'%-.192s'. Der Trigger wird mit der Autorisierung des Aufrufers aktiviert, der möglicherweise keine zureichenden Berechtigungen hat. Bitte legen Sie den Trigger neu an" spa "No hay atributo de definidor para disparador '%-.192s'.'%-.192s'. El disparador será activado bajo la autorización del invocador, el cual puede tener insuficientes privilegios. Por favor, vuelva a crear el disparador" ER_OLD_FILE_FORMAT + chi "'%-.192s'具有旧格式,您应该重新创建'%s'对象" eng "'%-.192s' has an old format, you should re-create the '%s' object(s)" ger "'%-.192s' hat altes Format, Sie sollten die '%s'-Objekt(e) neu erzeugen" spa "'%-.192s' tiene un formato viejo, debería vd de volver a crear el/los objeto(s) '%s'" ER_SP_RECURSION_LIMIT + chi "递归限制%d(如max_sp_recursion_depth变量设置)的例程%.192s" eng "Recursive limit %d (as set by the max_sp_recursion_depth variable) was exceeded for routine %.192s" ger "Rekursionsgrenze %d (durch Variable max_sp_recursion_depth gegeben) wurde für Routine %.192s überschritten" spa "El límite recursivo %d (según se indica mediante la variable max_sp_recursion_depth) se ha excedido para la rutina %.192s" ER_SP_PROC_TABLE_CORRUPT + chi "无法加载常规%-.192s(内部代码%d)。有关更多详细信息,请运行SHOW WARNINGS" eng "Failed to load routine %-.192s (internal code %d). For more details, run SHOW WARNINGS" ger "Routine %-.192s (interner Code %d) konnte nicht geladen werden. Weitere Einzelheiten erhalten Sie, wenn Sie SHOW WARNINGS ausführen" ukr "Невдала спроба завантажити процедуру %-.192s (внутрішний код %d). Для отримання детальної інформації використовуйте SHOW WARNINGS" spa "No pude cargar la rutina %-.192s (código interno %d). Para más detalles, ejecute SHOW WARNINGS" ER_SP_WRONG_NAME 42000 + chi "常规名称错误不正确'%-.192s'" eng "Incorrect routine name '%-.192s'" ger "Ungültiger Routinenname '%-.192s'" spa "Nombre incorrecto de rutina '%-.192s'" ER_TABLE_NEEDS_UPGRADE + chi "需要升级。请做\"修复%s%`s \"或转储/重新加载以修复!" eng "Upgrade required. Please do \"REPAIR %s %`s\" or dump/reload to fix it!" ger "Aktualisierung erforderlich. Bitte zum Reparieren \"REPAIR %s %`s\" eingeben!" spa "Es necesaria una mejora. Por favor, ¡haga \"REPAIR %s %`s\" o vuelque/recargue para arreglarlo!" ER_SP_NO_AGGREGATE 42000 + chi "存储函数不支持聚合" eng "AGGREGATE is not supported for stored functions" ger "AGGREGATE wird bei gespeicherten Funktionen nicht unterstützt" spa "AGGREGATE no está soportado en funciones almacenadas" ER_MAX_PREPARED_STMT_COUNT_REACHED 42000 + chi "无法创建超过max_prepared_stmt_count语句(当前值:%u)" eng "Can't create more than max_prepared_stmt_count statements (current value: %u)" ger "Kann nicht mehr Anweisungen als max_prepared_stmt_count erzeugen (aktueller Wert: %u)" spa "No puedo crear más de max_prepared_stmt_count sentencias (valor en curso: %u)" ER_VIEW_RECURSIVE + chi "%`s.%`s包含视图递归" eng "%`s.%`s contains view recursion" ger "%`s.%`s enthält View-Rekursion" spa "`%-.192s`.`%-.192s` contiene recursividad de vista"" ER_NON_GROUPING_FIELD_USED 42000 + chi "非分组字段'%-.192s'用于%-.64s条款" eng "Non-grouping field '%-.192s' is used in %-.64s clause" ger "In der %-.192s-Klausel wird das die Nicht-Gruppierungsspalte '%-.64s' verwendet" spa "No hay campo agrupado '%-.192s' usado en cláusula %-.64s" ER_TABLE_CANT_HANDLE_SPKEYS + chi "存储引擎%s不支持SPATIAL索引" eng "The storage engine %s doesn't support SPATIAL indexes" ger "Der verwendete Tabellentyp (%s) unterstützt keine SPATIAL-Indizes" spa "El motor de almacenaje %s no soporta índices SPATIAL" ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA + chi "无法在系统表上创建触发器" eng "Triggers can not be created on system tables" ger "Trigger können nicht auf Systemtabellen erzeugt werden" spa "Los disparadores no pueden ser creados en las tablas del sistema" ER_REMOVED_SPACES + chi "前面的空格从名称'%s'删除" eng "Leading spaces are removed from name '%s'" ger "Führende Leerzeichen werden aus dem Namen '%s' entfernt" spa "Se quitan los espacios iniciales del nombre '%s'" ER_AUTOINC_READ_FAILED + chi "无法从存储引擎读取自动增量值" eng "Failed to read auto-increment value from storage engine" ger "Lesen des Autoincrement-Werts von der Speicher-Engine fehlgeschlagen" hindi "स्टोरेज इंजन से auto-increment का मान पढ़ने में असफल रहे" spa "No pude leer valor de auto-incremento del motor de almacenaje" ER_USERNAME + chi "用户名" eng "user name" ger "Benutzername" hindi "यूज़र का नाम" spa "nombre de usuario" ER_HOSTNAME + chi "主机名" eng "host name" ger "Hostname" hindi "होस्ट का नाम" spa "nombre de equipo" ER_WRONG_STRING_LENGTH + chi "字符串'%-.70T'对于%s(应不超过%d)太长" eng "String '%-.70T' is too long for %s (should be no longer than %d)" ger "String '%-.70T' ist zu lang für %s (sollte nicht länger sein als %d)" spa "La cadena '%-.70T' es demasiado larga para %s (no debería de ser mayor de %d)" ER_NON_INSERTABLE_TABLE + chi "目标表%-.100s %s不可插入" eng "The target table %-.100s of the %s is not insertable-into" ger "Die Zieltabelle %-.100s von %s ist nicht einfügbar" jpn "対象表 %-.100s は挿入可能ではないので、%s を行えません。" spa "La tabla destino %-.100s de la %s no es insertable-dentro" ER_ADMIN_WRONG_MRG_TABLE - eng "Table '%-.64s' is differently defined or of non-MyISAM type or doesn't exist" - ger "Tabelle '%-.64s' ist unterschiedlich definiert, nicht vom Typ MyISAM oder existiert nicht" - spa "La tabla '%-.64s' está definida de forma diferente o es del tipo no-MyISAM o no existe" + chi "表'%-.64s'不同定义、或非myisam类型、或不存在" + eng "Table '%-.64s' is differently defined or of non-MyISAM type or doesn't exist" + ger "Tabelle '%-.64s' ist unterschiedlich definiert, nicht vom Typ MyISAM oder existiert nicht" + spa "La tabla '%-.64s' está definida de forma diferente o es del tipo no-MyISAM o no existe" ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT - eng "Too high level of nesting for select" - ger "Zu tief verschachtelte SELECT-Anweisungen" - spa "Demasiado alto el nivel de anidamiento para la selección" + chi "太高的嵌套SELECT" + eng "Too high level of nesting for select" + ger "Zu tief verschachtelte SELECT-Anweisungen" + spa "Demasiado alto el nivel de anidamiento para la selección" ER_NAME_BECOMES_EMPTY - eng "Name '%-.64s' has become ''" - ger "Name '%-.64s' wurde zu ''" - spa "El nombre '%-.64s' ha pasado a ser ''" + chi "名'%-.64s'已成为''" + eng "Name '%-.64s' has become ''" + ger "Name '%-.64s' wurde zu ''" + spa "El nombre '%-.64s' ha pasado a ser ''" ER_AMBIGUOUS_FIELD_TERM - eng "First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY" - ger "Das erste Zeichen der Zeichenkette FIELDS TERMINATED ist mehrdeutig; bitte benutzen Sie nicht optionale und nicht leere FIELDS ENCLOSED BY" - spa "El primer carácter de la cadena de los FIELDS TERMINATED es ambiguo; por favor, use FIELDS ENCLOSED BY no opcionales y no vacíos" + chi "FIELDS TERMINATED字符串的第一个字符是模棱两可的;请使用非空字段FIELDS ENCLOSED BY" + eng "First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY" + ger "Das erste Zeichen der Zeichenkette FIELDS TERMINATED ist mehrdeutig; bitte benutzen Sie nicht optionale und nicht leere FIELDS ENCLOSED BY" + spa "El primer carácter de la cadena de los FIELDS TERMINATED es ambiguo; por favor, use FIELDS ENCLOSED BY no opcionales y no vacíos" ER_FOREIGN_SERVER_EXISTS - eng "The foreign server, %s, you are trying to create already exists" - ger "Der entfernte Server %s, den Sie versuchen zu erzeugen, existiert schon" - spa "El servidor foráneo %s que intenta crear ya existe" + chi "无法创建外部服务器'%s',因为它已经存在" + eng "Cannot create foreign server '%s' as it already exists" + fin "Vieraata palvelinta '%s' ei voida luoda, koska se on jo olemassa" + fre "Impossible de créer le serveur étranger '%s' car il existe déjà" + ger "Der auswärtige Server '%s' kann nicht erstellt werden, da er bereits vorhanden ist" + greek "Δεν είναι δυνατή η δημιουργία ξένου διακομιστή '%s' επειδή υπάρχει ήδη" + ita "Impossibile creare il server esterno '%s' poiché esiste già" + jpn "外部サーバー '%s'は既に存在するため、作成できません" + nla "Kan geen externe server '%s' maken omdat deze al bestaat" + nor "Kan ikke opprette utenlandsk server '%s' fordi den allerede eksisterer" + pol "Nie można utworzyć obcego serwera '%s', ponieważ już istnieje" + por "Não foi possível criar o servidor externo '%s' porque ele já existe" + rus "Невозможно создать сторонний сервер '%s', так как он уже существует" + spa "No se puede crear el servidor externo '%s' porque ya existe" + swe "Det gick inte att skapa främmande server '%s' eftersom den redan finns" ER_FOREIGN_SERVER_DOESNT_EXIST + chi "您尝试引用的外部服务器名称不存在。数据源错误:%-.64s" eng "The foreign server name you are trying to reference does not exist. Data source error: %-.64s" - ger "Die externe Verbindung, auf die Sie zugreifen wollen, existiert nicht. Datenquellenfehlermeldung: %-.64s" + ger "Die externe Verbindung, auf die Sie zugreifen wollen, existiert nicht. Datenquellenfehlermeldung: %-.64s" spa "El nombre del servidor foráneo que intenta referenciar no existe. Error en fuentes de datos: %-.64s" ER_ILLEGAL_HA_CREATE_OPTION + chi "表存储引擎'%-.64s'不支持创建选项'%.64s'" eng "Table storage engine '%-.64s' does not support the create option '%.64s'" ger "Speicher-Engine '%-.64s' der Tabelle unterstützt die Option '%.64s' nicht" spa "El motor de almacenaje de la tabla '%-.64s' no soporta la opción de creación '%.64s'" ER_PARTITION_REQUIRES_VALUES_ERROR + chi "语法错误:%-.64s PARTITIONING需要定义给每个分区VALUES %-.64s" eng "Syntax error: %-.64s PARTITIONING requires definition of VALUES %-.64s for each partition" ger "Fehler in der SQL-Syntax: %-.64s-PARTITIONierung erfordert Definition von VALUES %-.64s für jede Partition" spa "Error de sintaxis: %-.64s PARTITIONING requiere de la definición de VALUES %-.64s para cada partición" swe "Syntaxfel: %-.64s PARTITIONering kräver definition av VALUES %-.64s för varje partition" ER_PARTITION_WRONG_VALUES_ERROR + chi "只有%-.64s PARTITIONING可以使用VALUES %-.64s在分区定义中" eng "Only %-.64s PARTITIONING can use VALUES %-.64s in partition definition" ger "Nur %-.64s-PARTITIONierung kann VALUES %-.64s in der Partitionsdefinition verwenden" spa "Sólo %-.64s PARTITIONING puede usar VALUES %-.64s en la definición de la partición" swe "Endast %-.64s partitionering kan använda VALUES %-.64s i definition av partitionen" ER_PARTITION_MAXVALUE_ERROR + chi "MAXVALUE只能在最后一个分区定义中使用" eng "MAXVALUE can only be used in last partition definition" ger "MAXVALUE kann nur für die Definition der letzten Partition verwendet werden" spa "MAXVALUE sólo se puede usar en la definición de la última partición" swe "MAXVALUE kan bara användas i definitionen av den sista partitionen" ER_PARTITION_SUBPARTITION_ERROR + chi "子分区只能是哈希分区和分区列" eng "Subpartitions can only be hash partitions and by key" ger "Unterpartitionen dürfen nur HASH- oder KEY-Partitionen sein" spa "Las subparticiones sólo pueden ser particiones dispersas (hash) y mediante clave" swe "Subpartitioner kan bara vara hash och key partitioner" ER_PARTITION_SUBPART_MIX_ERROR + chi "如果在一个分区上,必须在所有分区上定义子组分" eng "Must define subpartitions on all partitions if on one partition" ger "Wenn Sie Unterpartitionen auf einer Partition definieren, müssen Sie das für alle Partitionen tun" spa "Se deben de definir subparticiones en todas las particiones si se está en una partición" swe "Subpartitioner måste definieras på alla partitioner om på en" ER_PARTITION_WRONG_NO_PART_ERROR + chi "定义了错误的分区数,与以前的设置不匹配" eng "Wrong number of partitions defined, mismatch with previous setting" ger "Falsche Anzahl von Partitionen definiert, stimmt nicht mit vorherigen Einstellungen überein" spa "Definido un número equivocado de particiones, no coincide con configuración previa" swe "Antal partitioner definierade och antal partitioner är inte lika" ER_PARTITION_WRONG_NO_SUBPART_ERROR + chi "错误的子组分数定义,与以前的设置不匹配" eng "Wrong number of subpartitions defined, mismatch with previous setting" ger "Falsche Anzahl von Unterpartitionen definiert, stimmt nicht mit vorherigen Einstellungen überein" spa "Definido un número equivocado de subparticiones, no coincide con configuración previa" swe "Antal subpartitioner definierade och antal subpartitioner är inte lika" ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR + chi "不允许(子)分区功能中的常量,随机或时区依赖表达式" eng "Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed" ger "Konstante oder Random-Ausdrücke in (Unter-)Partitionsfunktionen sind nicht erlaubt" spa "Las expresiones constantes, al azar o dependientes de zona en función de (sub)particionado no están permitidas" swe "Konstanta uttryck eller slumpmässiga uttryck är inte tillåtna (sub)partitioneringsfunktioner" ER_NOT_CONSTANT_EXPRESSION + chi "%s中的表达必须是恒定的" eng "Expression in %s must be constant" ger "Ausdrücke in %s müssen konstant sein" spa "Las expresiones incluidas en %s deben de ser constantes" swe "Uttryck i %s måste vara ett konstant uttryck" ER_FIELD_NOT_FOUND_PART_ERROR + chi "在表中找不到分区功能的字段列表中的字段" eng "Field in list of fields for partition function not found in table" ger "Felder in der Feldliste der Partitionierungsfunktion wurden in der Tabelle nicht gefunden" spa "Campo en la lista de campos para función de partición no hallado en tabla" swe "Fält i listan av fält för partitionering med key inte funnen i tabellen" ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR + chi "只允许在索引分区中允许字段列表" eng "List of fields is only allowed in KEY partitions" ger "Eine Feldliste ist nur in KEY-Partitionen erlaubt" spa "Lista de campos sólo se permite en particiones KEY" swe "En lista av fält är endast tillåtet för KEY partitioner" ER_INCONSISTENT_PARTITION_INFO_ERROR + chi "FRM文件中的分区信息不与可以写入FRM文件的内容一致" eng "The partition info in the frm file is not consistent with what can be written into the frm file" ger "Die Partitionierungsinformationen in der frm-Datei stimmen nicht mit dem überein, was in die frm-Datei geschrieben werden kann" spa "La información de partición en el fichero/archivo frm no es consistente con lo que se puede grabar en un fichero/archivo frm" swe "Partitioneringsinformationen i frm-filen är inte konsistent med vad som kan skrivas i frm-filen" ER_PARTITION_FUNC_NOT_ALLOWED_ERROR + chi "%-.192s函数返回错误的类型" eng "The %-.192s function returns the wrong type" ger "Die %-.192s-Funktion gibt einen falschen Typ zurück" spa "La función %-.192s devueve un tipo equivocado" swe "%-.192s-funktionen returnerar felaktig typ" ER_PARTITIONS_MUST_BE_DEFINED_ERROR + chi "对于%-.64s分区必须定义每个分区" eng "For %-.64s partitions each partition must be defined" ger "Für %-.64s-Partitionen muss jede Partition definiert sein" spa "Para las particiones %-.64s, se debe de definir cada partición" swe "För %-.64s partitionering så måste varje partition definieras" ER_RANGE_NOT_INCREASING_ERROR + chi "每个分区的VALUES LESS THAN的值必须严格增加" eng "VALUES LESS THAN value must be strictly increasing for each partition" ger "Werte in VALUES LESS THAN müssen für jede Partition strikt aufsteigend sein" spa "El valor VALUES LESS THAN debe de ser estrictamente incremental para cada partición" swe "Värden i VALUES LESS THAN måste vara strikt växande för varje partition" ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR + chi "VALUES值必须与分区函数相同" eng "VALUES value must be of same type as partition function" ger "VALUES-Werte müssen vom selben Typ wie die Partitionierungsfunktion sein" spa "El valor VALUES debe de ser del mismo tipo que la función de partición" swe "Värden i VALUES måste vara av samma typ som partitioneringsfunktionen" ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR + chi "列表分区中相同常量的多个定义" eng "Multiple definition of same constant in list partitioning" ger "Mehrfachdefinition derselben Konstante bei Listen-Partitionierung" spa "Definición múltiple de la misma constante en el particionamiento de la lista" swe "Multipel definition av samma konstant i list partitionering" ER_PARTITION_ENTRY_ERROR + chi "分区不能在查询中独立使用" eng "Partitioning can not be used stand-alone in query" ger "Partitionierung kann in einer Abfrage nicht alleinstehend benutzt werden" spa "El particionado no puede ser usado de forma autónoma en consulta (query)" swe "Partitioneringssyntax kan inte användas på egen hand i en SQL-fråga" ER_MIX_HANDLER_ERROR + chi "此版本的MariaDB中不允许分区中的处理程序混合" eng "The mix of handlers in the partitions is not allowed in this version of MariaDB" ger "Das Vermischen von Handlern in Partitionen ist in dieser Version von MariaDB nicht erlaubt" spa "La mezcla de manejadores en las particiones no está autorizada en esta versión de MariaDB" swe "Denna mix av lagringsmotorer är inte tillåten i denna version av MariaDB" ER_PARTITION_NOT_DEFINED_ERROR + chi "对于分区引擎,需要定义所有%-.64s" eng "For the partitioned engine it is necessary to define all %-.64s" ger "Für die partitionierte Engine müssen alle %-.64s definiert sein" spa "Para el motor de particionado es necesario definir todas %-.64s" swe "För partitioneringsmotorn så är det nödvändigt att definiera alla %-.64s" ER_TOO_MANY_PARTITIONS_ERROR + chi "定义了太多分区(包括子组分)" eng "Too many partitions (including subpartitions) were defined" ger "Es wurden zu vielen Partitionen (einschließlich Unterpartitionen) definiert" spa "Definidas demasiadas particiones (incluyendo las subparticiones)" swe "För många partitioner (inkluderande subpartitioner) definierades" ER_SUBPARTITION_ERROR + chi "只有在子节分节的HASH/KEY分区中可以混合RANGE/LIST分区" eng "It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning" ger "RANGE/LIST-Partitionierung kann bei Unterpartitionen nur zusammen mit HASH/KEY-Partitionierung verwendet werden" spa "Sólo es posible mezclar particionado RANGE/LIST con particionado HASH/KEY para el subparticionado" swe "Det är endast möjligt att blanda RANGE/LIST partitionering med HASH/KEY partitionering för subpartitionering" ER_CANT_CREATE_HANDLER_FILE + chi "无法创建特定的处理程序文件" eng "Failed to create specific handler file" ger "Erzeugen einer spezifischen Handler-Datei fehlgeschlagen" spa "No pude crear fichero/archivo de manejador específico" swe "Misslyckades med att skapa specifik fil i lagringsmotor" ER_BLOB_FIELD_IN_PART_FUNC_ERROR + chi "分区功能中不允许BLOB字段" eng "A BLOB field is not allowed in partition function" ger "In der Partitionierungsfunktion sind BLOB-Spalten nicht erlaubt" spa "No se autoriza campo BLOB en la función de partición" swe "Ett BLOB-fält är inte tillåtet i partitioneringsfunktioner" ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF + chi "A%-.192s必须包含表的分区功能中的所有列" eng "A %-.192s must include all columns in the table's partitioning function" spa "Un %-.192s debe de incluir todas las columnas en la función de particionado de la tabla" ER_NO_PARTS_ERROR + chi "不允许%-.64s = 0" eng "Number of %-.64s = 0 is not an allowed value" ger "Eine Anzahl von %-.64s = 0 ist kein erlaubter Wert" spa "El número de %-.64s = 0 no es un valor autorizado" swe "Antal %-.64s = 0 är inte ett tillåten värde" ER_PARTITION_MGMT_ON_NONPARTITIONED + chi "不分区表上的分区管理是不可能的" eng "Partition management on a not partitioned table is not possible" ger "Partitionsverwaltung einer nicht partitionierten Tabelle ist nicht möglich" spa "La gestión de particiones en una tabla no particionada no es posible" @@ -6128,358 +6639,436 @@ ER_FEATURE_NOT_SUPPORTED_WITH_PARTITIONING eng "Partitioned tables do not support %s" spa "Las tablas particionadas no soportan %s" ER_PARTITION_DOES_NOT_EXIST + chi "分区名称或分区列表错误" eng "Wrong partition name or partition list" ger "Falscher Name einer Partition oder Fehler in der Partitionsliste" spa "Error en lista de particiones" swe "Fel namn av en partition eller fel i listan av partitioner" ER_DROP_LAST_PARTITION + chi "无法删除所有分区,请使用删除表" eng "Cannot remove all partitions, use DROP TABLE instead" ger "Es lassen sich nicht sämtliche Partitionen löschen, benutzen Sie statt dessen DROP TABLE" spa "No puedo quitar todas las particiones, use DROP TABLE en su lugar" swe "Det är inte tillåtet att ta bort alla partitioner, använd DROP TABLE istället" ER_COALESCE_ONLY_ON_HASH_PARTITION + chi "COALESCE分区只能用于哈希/索引分区" eng "COALESCE PARTITION can only be used on HASH/KEY partitions" ger "COALESCE PARTITION kann nur auf HASH- oder KEY-Partitionen benutzt werden" spa "COALESCE PARTITION sólo se puede usar en particiones HASH/KEY" swe "COALESCE PARTITION kan bara användas på HASH/KEY partitioner" ER_REORG_HASH_ONLY_ON_SAME_NO + chi "REORGANIZE PARTITION只能用于重新组织不改变他们的数字的分区" eng "REORGANIZE PARTITION can only be used to reorganize partitions not to change their numbers" ger "REORGANIZE PARTITION kann nur zur Reorganisation von Partitionen verwendet werden, nicht, um ihre Nummern zu ändern" spa "REORGANIZE PARTITION sólo se puede usar para reorganizar particiones no para cambiar sus números" swe "REORGANIZE PARTITION kan bara användas för att omorganisera partitioner, inte för att ändra deras antal" ER_REORG_NO_PARAM_ERROR + chi "没有参数的REORGANIZE PARTITION只能用于HASH PARTITION的自动分区表" eng "REORGANIZE PARTITION without parameters can only be used on auto-partitioned tables using HASH PARTITIONs" ger "REORGANIZE PARTITION ohne Parameter kann nur für auto-partitionierte Tabellen verwendet werden, die HASH-Partitionierung benutzen" spa "REORGANIZE PARTITION sin parámetros sólo se puede usar en tablas auto-particionadas usando HASH PARTITIONs" swe "REORGANIZE PARTITION utan parametrar kan bara användas på auto-partitionerade tabeller som använder HASH partitionering" ER_ONLY_ON_RANGE_LIST_PARTITION + chi "%-.64s分区只能用于RANGE/LIST分区" eng "%-.64s PARTITION can only be used on RANGE/LIST partitions" ger "%-.64s PARTITION kann nur für RANGE- oder LIST-Partitionen verwendet werden" spa "%-.64s PARTITION sólo puede ser usada en particiones RANGE/LIST" swe "%-.64s PARTITION kan bara användas på RANGE/LIST-partitioner" ER_ADD_PARTITION_SUBPART_ERROR + chi "尝试用错误数量的子分区添加分区" eng "Trying to Add partition(s) with wrong number of subpartitions" ger "Es wurde versucht, eine oder mehrere Partitionen mit der falschen Anzahl von Unterpartitionen hinzuzufügen" spa "Intentando añadir particion(es) usando un número equivocado de subparticiones" swe "ADD PARTITION med fel antal subpartitioner" ER_ADD_PARTITION_NO_NEW_PARTITION + chi "必须添加至少一个分区" eng "At least one partition must be added" ger "Es muss zumindest eine Partition hinzugefügt werden" spa "Se debe de añadir una partición, al menos" swe "Åtminstone en partition måste läggas till vid ADD PARTITION" ER_COALESCE_PARTITION_NO_PARTITION + chi "至少一个分区必须合并" eng "At least one partition must be coalesced" ger "Zumindest eine Partition muss mit COALESCE PARTITION zusammengefügt werden" spa "Se debe de fusionar una partición, al menos" swe "Åtminstone en partition måste slås ihop vid COALESCE PARTITION" ER_REORG_PARTITION_NOT_EXIST + chi "分区重组量超过而不是分区量" eng "More partitions to reorganize than there are partitions" ger "Es wurde versucht, mehr Partitionen als vorhanden zu reorganisieren" spa "Hay más particiones a reorganizar que las que existen" swe "Fler partitioner att reorganisera än det finns partitioner" ER_SAME_NAME_PARTITION + chi "重复分区名称%-.192s" eng "Duplicate partition name %-.192s" ger "Doppelter Partitionsname: %-.192s" spa "Nombre de partición duplicado %-.192s" swe "Duplicerat partitionsnamn %-.192s" ER_NO_BINLOG_ERROR + chi "在此命令上不允许关闭binlog" eng "It is not allowed to shut off binlog on this command" ger "Es es nicht erlaubt, bei diesem Befehl binlog abzuschalten" spa "No se autoriza a apagar binlog con este comando" swe "Det är inte tillåtet att stänga av binlog på detta kommando" ER_CONSECUTIVE_REORG_PARTITIONS + chi "在重新组织一组分区时,它们必须按照次序" eng "When reorganizing a set of partitions they must be in consecutive order" ger "Bei der Reorganisation eines Satzes von Partitionen müssen diese in geordneter Reihenfolge vorliegen" spa "Para reorganizar un conjunto de particiones, éstas deben de estar ordenadas consecutivamente" swe "När ett antal partitioner omorganiseras måste de vara i konsekutiv ordning" ER_REORG_OUTSIDE_RANGE + chi "重组范围分区无法更改除最后分区之外的总范围,无法扩展范围" eng "Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range" ger "Die Reorganisation von RANGE-Partitionen kann Gesamtbereiche nicht verändern, mit Ausnahme der letzten Partition, die den Bereich erweitern kann" spa "El reorganizar un rango de particiones no puede cambiar los rangos totales excepto para la última partición donde se puede extender el rango" swe "Reorganisering av rangepartitioner kan inte ändra den totala intervallet utom för den sista partitionen där intervallet kan utökas" ER_PARTITION_FUNCTION_FAILURE + chi "此版不支持此处理程序的分区功能" eng "Partition function not supported in this version for this handler" ger "Partitionsfunktion in dieser Version dieses Handlers nicht unterstützt" spa "Función de partición no soportada en esta versión para este manejador" ER_PART_STATE_ERROR + chi "无法从CREATE/ALTER表中定义分区状态" eng "Partition state cannot be defined from CREATE/ALTER TABLE" ger "Partitionszustand kann nicht von CREATE oder ALTER TABLE aus definiert werden" spa "El estado de una partición no se puede definir desde CREATE/ALTER TABLE" swe "Partition state kan inte definieras från CREATE/ALTER TABLE" ER_LIMITED_PART_RANGE + chi "%-.64s处理程序仅支持32-bit整数" eng "The %-.64s handler only supports 32 bit integers in VALUES" ger "Der Handler %-.64s unterstützt in VALUES nur 32-Bit-Integers" spa "El manejador %-.64s sólo soporta enteros de 32 bit en VALUES" swe "%-.64s stödjer endast 32 bitar i integers i VALUES" ER_PLUGIN_IS_NOT_LOADED + chi "插件'%-.192s'未加载" eng "Plugin '%-.192s' is not loaded" ger "Plugin '%-.192s' ist nicht geladen" spa "Enchufe (plugin) '%-.192s' no cargado" ER_WRONG_VALUE + chi "错误%-.32s值:'%-.128T'" eng "Incorrect %-.32s value: '%-.128T'" ger "Falscher %-.32s-Wert: '%-.128T'" spa "Incorrecto %-.32s valor: '%-.128T'" ER_NO_PARTITION_FOR_GIVEN_VALUE + chi "表没有%-.64s的分区" eng "Table has no partition for value %-.64s" ger "Tabelle hat für den Wert %-.64s keine Partition" spa "La tabla no tiene partición para valor %-.64s" ER_FILEGROUP_OPTION_ONLY_ONCE + chi "设置%s不能超过一次" eng "It is not allowed to specify %s more than once" ger "%s darf nicht mehr als einmal angegegeben werden" spa "No se permite especificar %s más de unva vez" ER_CREATE_FILEGROUP_FAILED + chi "无法创建%s" eng "Failed to create %s" ger "Anlegen von %s fehlgeschlagen" hindi "%s को बनाने में असफल रहे" spa "No pude crear %s" ER_DROP_FILEGROUP_FAILED + chi "未能DROP%s" eng "Failed to drop %s" ger "Löschen von %s fehlgeschlagen" hindi "%s को हटाने में असफल रहे" spa "No pude eliminar %s" ER_TABLESPACE_AUTO_EXTEND_ERROR + chi "处理程序不支持表空间的自动扩展名" eng "The handler doesn't support autoextend of tablespaces" ger "Der Handler unterstützt keine automatische Erweiterung (Autoextend) von Tablespaces" spa "El manejador no soporta autoextensión de espacios de tabla" ER_WRONG_SIZE_NUMBER + chi "尺寸参数被错误地指定,编号或表单10M" eng "A size parameter was incorrectly specified, either number or on the form 10M" ger "Ein Größen-Parameter wurde unkorrekt angegeben, muss entweder Zahl sein oder im Format 10M" spa "Se ha especificado de forma incorrecta un parámetro de medida o el número o en la forma 10M" ER_SIZE_OVERFLOW_ERROR + chi "尺寸编号是正确的,但我们不允许数字部分超过20亿" eng "The size number was correct but we don't allow the digit part to be more than 2 billion" ger "Die Zahl für die Größe war korrekt, aber der Zahlanteil darf nicht größer als 2 Milliarden sein" spa "El número de medida es correcto pero no permitimos que la parte del dígito tenga más de 2 billones" ER_ALTER_FILEGROUP_FAILED + chi "未能改变:%s" eng "Failed to alter: %s" ger "Änderung von %s fehlgeschlagen" hindi "%s को ALTER करने में असफल रहे" spa "No pude alterar: %s" ER_BINLOG_ROW_LOGGING_FAILED + chi "将一行写入基于行的二进制日志失败" eng "Writing one row to the row-based binary log failed" ger "Schreiben einer Zeilen ins zeilenbasierte Binärlog fehlgeschlagen" spa "Ha fallado el grabar una fila en historial (log) binario basado en fila" ER_BINLOG_ROW_WRONG_TABLE_DEF + chi "表定义主机和从站不匹配:%s" eng "Table definition on master and slave does not match: %s" ger "Tabellendefinition auf Master und Slave stimmt nicht überein: %s" spa "La definición de tabla en maestro (master) y esclavo no coincide: %s" ER_BINLOG_ROW_RBR_TO_SBR + chi "使用--log-slave-updates的从站必须使用基于行的二进制日志记录,以便能够复制基于行的二进制日志事件" eng "Slave running with --log-slave-updates must use row-based binary logging to be able to replicate row-based binary log events" ger "Slave, die mit --log-slave-updates laufen, müssen zeilenbasiertes Loggen verwenden, um zeilenbasierte Binärlog-Ereignisse loggen zu können" spa "La ejecución esclava con --log-slave-updates debe de usar un historial (log) binario basado en fila para que pueda replicar eventos de historial (log) binario basados en fila" ER_EVENT_ALREADY_EXISTS + chi "事件'%-.192s'已经存在" eng "Event '%-.192s' already exists" ger "Event '%-.192s' existiert bereits" spa "El evento '%-.192s' ya existe" ER_EVENT_STORE_FAILED + chi "无法存储事件%s。错误代码%M来自存储引擎" eng "Failed to store event %s. Error code %M from storage engine" ger "Speichern von Event %s fehlgeschlagen. Fehlercode der Speicher-Engine: %M" spa "No pude almacenar evento %s. Código de error %M desde motor de almacenaje" ER_EVENT_DOES_NOT_EXIST + chi "未知事件'%-.192s'" eng "Unknown event '%-.192s'" ger "Unbekanntes Event '%-.192s'" spa "Evento desconocido '%-.192s'" ER_EVENT_CANT_ALTER + chi "无法改变事件'%-.192s'" eng "Failed to alter event '%-.192s'" ger "Ändern des Events '%-.192s' fehlgeschlagen" hindi "'%-.192s' EVENT को ALTER करने में असफल रहे" spa "No pude alterar evento '%-.192s'" ER_EVENT_DROP_FAILED + chi "未能DROP%s" eng "Failed to drop %s" ger "Löschen von %s fehlgeschlagen" hindi "%s को हटाने में असफल रहे" spa "No pude eliminar %s" ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG + chi "INTERVAL为负或太大" eng "INTERVAL is either not positive or too big" ger "INTERVAL ist entweder nicht positiv oder zu groß" spa "O INTERVAL no es positivo o es demasiado grande" ER_EVENT_ENDS_BEFORE_STARTS + chi "ENDS无效的或在STARTS之前" eng "ENDS is either invalid or before STARTS" ger "ENDS ist entweder ungültig oder liegt vor STARTS" spa "O ENDS es inválido o anterior a STARTS" ER_EVENT_EXEC_TIME_IN_THE_PAST - eng "Event execution time is in the past. Event has been disabled" - ger "Ausführungszeit des Events liegt in der Vergangenheit. Event wurde deaktiviert" - spa "El tiempo de ejecución de evento se encuentra en el pasado. El evento ha sido desactivado" + chi "事件执行时间在过去。事件已被禁用" + eng "Event execution time is in the past. Event has been disabled" + ger "Ausführungszeit des Events liegt in der Vergangenheit. Event wurde deaktiviert" + spa "El tiempo de ejecución de evento se encuentra en el pasado. El evento ha sido desactivado" ER_EVENT_OPEN_TABLE_FAILED + chi "无法打开mysql.event" eng "Failed to open mysql.event" ger "Öffnen von mysql.event fehlgeschlagen" hindi "mysql.event को खोलने में असफल रहे" spa "No puede abrir mysql.event" ER_EVENT_NEITHER_M_EXPR_NOR_M_AT + chi "没有提供DateTime表达式" eng "No datetime expression provided" ger "Kein DATETIME-Ausdruck angegeben" spa "No se ha suministrado expresión datetime" - ER_UNUSED_2 + chi "你永远不应该看到它" eng "You should never see it" spa "No lo debería vd de ver nunca" ER_UNUSED_3 + chi "你永远不应该看到它" eng "You should never see it" spa "No lo debería vd de ver nunca" ER_EVENT_CANNOT_DELETE + chi "无法从mysql.event删除该事件" eng "Failed to delete the event from mysql.event" ger "Löschen des Events aus mysql.event fehlgeschlagen" hindi "EVENT को mysql.event से हटाने मैं असफल रहे" spa "No pude borrar el evento desde mysql.event" ER_EVENT_COMPILE_ERROR + chi "在汇编事件的主体时出错" eng "Error during compilation of event's body" ger "Fehler beim Kompilieren des Event-Bodys" spa "Error durante compilación de cuerpo de evento" ER_EVENT_SAME_NAME + chi "相同的旧活动名称" eng "Same old and new event name" ger "Alter und neuer Event-Name sind gleich" spa "Mismo nombre de evento viejo y nuevo" ER_EVENT_DATA_TOO_LONG + chi "列'%s'数据太长" eng "Data for column '%s' too long" ger "Daten der Spalte '%s' zu lang" spa "Datos demasiado largos para la columna '%s'" ER_DROP_INDEX_FK + chi "无法删除索引'%-.192s':外部索引约束中需要它" eng "Cannot drop index '%-.192s': needed in a foreign key constraint" ger "Kann Index '%-.192s' nicht löschen: wird für eine Fremdschlüsselbeschränkung benötigt" spa "No puedo eliminar índice '%-.192s': necesario en una restricción de clave foránea" # When using this error message, use the ER_WARN_DEPRECATED_SYNTAX error # code. ER_WARN_DEPRECATED_SYNTAX_WITH_VER + chi "语法'%s'被弃用,将在Mariadb%s中删除。请使用%s" eng "The syntax '%s' is deprecated and will be removed in MariaDB %s. Please use %s instead" ger "Die Syntax '%s' ist veraltet und wird in MariaDB %s entfernt. Bitte benutzen Sie statt dessen %s" spa "La sintaxis '%s' está obsoleta y será quitada en MariaDB %s. Por favor, use %s en su lugar" ER_CANT_WRITE_LOCK_LOG_TABLE + chi "您无法获得日志表的写锁。只有读访问是可能的" eng "You can't write-lock a log table. Only read access is possible" ger "Eine Log-Tabelle kann nicht schreibgesperrt werden. Es ist ohnehin nur Lesezugriff möglich" spa "No puede hacer bloqueo de escritura en una tabla de historial (log). Sólo es posible acceso de lectura" ER_CANT_LOCK_LOG_TABLE + chi "您无法使用带日志表的锁" eng "You can't use locks with log tables" ger "Log-Tabellen können nicht gesperrt werden" spa "No puede usar bloqueos con tablas de historial (log)" ER_UNUSED_4 + chi "你永远不应该看到它" eng "You should never see it" spa "Nunca debería vd de ver esto" ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE + chi "mysql的列计数。%s是错误的。预期%d,找到%d。使用MariaDB%d创建,现在运行%d。请使用mariadb-upgrade来修复此错误" eng "Column count of mysql.%s is wrong. Expected %d, found %d. Created with MariaDB %d, now running %d. Please use mariadb-upgrade to fix this error" ger "Spaltenanzahl von mysql.%s falsch. %d erwartet, aber %d erhalten. Erzeugt mit MariaDB %d, jetzt unter %d. Bitte benutzen Sie mariadb-upgrade, um den Fehler zu beheben" spa "El contador de columnas de mysql.%s está equivocado. Se esperaba %d, hallado %d. Creado con MariaDB %d, ahora ejecuando %d. Por favor, use mariadb-upgrade para solucionar este error" ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR + chi "当会话打开临时表时,无法切换出基于行的二进制日志格式" eng "Cannot switch out of the row-based binary log format when the session has open temporary tables" ger "Kann nicht aus dem zeilenbasierten Binärlog-Format herauswechseln, wenn die Sitzung offene temporäre Tabellen hat" spa "No puedo conmutar fuera del formato de historial (log) binario basado en fila cuando la sesión ha abierto tablas temporales" ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT + chi "无法更改存储函数或触发器内的二进制记录格式" eng "Cannot change the binary logging format inside a stored function or trigger" ger "Das Binärlog-Format kann innerhalb einer gespeicherten Funktion oder eines Triggers nicht geändert werden" spa "No puedo cambiar el formato de historial (log) binario dentro de funciones almacenadas o disparadores" ER_UNUSED_13 + chi "你永远不应该看到它" eng "You should never see it" spa "Nunca debería vd de ver esto" ER_PARTITION_NO_TEMPORARY + chi "无法使用分区创建临时表" eng "Cannot create temporary table with partitions" ger "Anlegen temporärer Tabellen mit Partitionen nicht möglich" hindi "अस्थाई टेबल को पार्टिशन्स के साथ नहीं बनाया जा सकता" spa "No puedo crear tabla temporal con particiones" ER_PARTITION_CONST_DOMAIN_ERROR + chi "分区常量超出分区功能域" eng "Partition constant is out of partition function domain" ger "Partitionskonstante liegt außerhalb der Partitionsfunktionsdomäne" spa "La constante de partición está fuera del dominio de función de partición" swe "Partitionskonstanten är utanför partitioneringsfunktionens domän" ER_PARTITION_FUNCTION_IS_NOT_ALLOWED + chi "不允许此分区功能" eng "This partition function is not allowed" ger "Diese Partitionierungsfunktion ist nicht erlaubt" spa "Esta función de partición no está permitida" swe "Denna partitioneringsfunktion är inte tillåten" ER_DDL_LOG_ERROR + chi "DDL日志中的错误" eng "Error in DDL log" ger "Fehler im DDL-Log" hindi "DDL लॉग में त्रुटि हुई" spa "Error en historial (log) DDL" ER_NULL_IN_VALUES_LESS_THAN + chi "VALUES LESS THAN不允许使用NULL" eng "Not allowed to use NULL value in VALUES LESS THAN" ger "In VALUES LESS THAN dürfen keine NULL-Werte verwendet werden" spa "No autorizado a usar valor NULL en VALUES LESS THAN" swe "Det är inte tillåtet att använda NULL-värden i VALUES LESS THAN" ER_WRONG_PARTITION_NAME + chi "分区名称不正确" eng "Incorrect partition name" ger "Falscher Partitionsname" hindi "पार्टीशन का नाम गलत है" spa "Nombre incorrecto de partición" swe "Felaktigt partitionsnamn" ER_CANT_CHANGE_TX_CHARACTERISTICS 25001 + chi "交易正在进行,无法更改事务特性" eng "Transaction characteristics can't be changed while a transaction is in progress" spa "No se pueden cambiar las característias de transacción mientras que una transacción se ecuentre en proceso" ER_DUP_ENTRY_AUTOINCREMENT_CASE + chi "ALTER TABLE表会导致AUTO_INCREMENT重建,导致重复的条目'%-.192T'用于索引'%-.192s'" eng "ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '%-.192T' for key '%-.192s'" ger "ALTER TABLE führt zur Neusequenzierung von auto_increment, wodurch der doppelte Eintrag '%-.192T' für Schlüssel '%-.192s' auftritt" spa "ALTER TABLE causa resecuenciado de auto_incremento resultando en entrada duplicada '%-.192T' para la clave '%-.192s'" ER_EVENT_MODIFY_QUEUE_ERROR + chi "内部调度器错误%d" eng "Internal scheduler error %d" ger "Interner Scheduler-Fehler %d" spa "Error en organizador interno %d" ER_EVENT_SET_VAR_ERROR + chi "在开始/停止调度程序期间出错。错误代码%M" eng "Error during starting/stopping of the scheduler. Error code %M" ger "Fehler während des Startens oder Anhalten des Schedulers. Fehlercode %M" spa "Error durante arranque/parada del organizador. Código de error %M" ER_PARTITION_MERGE_ERROR + chi "引擎不能用于分区表" eng "Engine cannot be used in partitioned tables" ger "Engine kann in partitionierten Tabellen nicht verwendet werden" spa "No se puede usar el motor en tablas particionadas" swe "Engine inte användas i en partitionerad tabell" ER_CANT_ACTIVATE_LOG + chi "无法激活'%-.64s'日志" eng "Cannot activate '%-.64s' log" ger "Kann Logdatei '%-.64s' nicht aktivieren" spa "No puedo activar historial (log) '%-.64s'" ER_RBR_NOT_AVAILABLE + chi "服务器不是基于行的复制构建的" eng "The server was not built with row-based replication" ger "Der Server wurde nicht mit zeilenbasierter Replikation gebaut" spa "El servidor no ha sido construido con réplica basada en fila" ER_BASE64_DECODE_ERROR + chi "Base64字符串的解码失败" eng "Decoding of base64 string failed" ger "Der Server hat keine zeilenbasierte Replikation" spa "Ha fallado la decodificación de cadena base64" swe "Avkodning av base64 sträng misslyckades" ER_EVENT_RECURSION_FORBIDDEN + chi "EVENT主体存在时EVENT DDL语句递归被禁止" eng "Recursion of EVENT DDL statements is forbidden when body is present" ger "Rekursivität von EVENT-DDL-Anweisungen ist unzulässig wenn ein Hauptteil (Body) existiert" spa "Se prohiben sentencias de EVENT DDL cuando se encuentra presente el cuerpo" ER_EVENTS_DB_ERROR + chi "无法继续,因为事件调度程序已禁用" eng "Cannot proceed, because event scheduler is disabled" ger "Die Operation kann nicht fortgesetzt werden, da Event Scheduler deaktiviert ist." spa "No puedo proceder porque el organizado de eventos está desactivado" ER_ONLY_INTEGERS_ALLOWED + chi "这里只允许整数作为数字" eng "Only integers allowed as number here" ger "An dieser Stelle sind nur Ganzzahlen zulässig" spa "Sólo se permiten enteros como número aquí" ER_UNSUPORTED_LOG_ENGINE + chi "存储引擎%s不能用于日志表" eng "Storage engine %s cannot be used for log tables" ger "Speicher-Engine %s kann für Logtabellen nicht verwendet werden" hindi "स्टोरेज इंजन %s को लॉग टेबल्स के लिए इस्तेमाल नहीं किया जा सकता है" spa "No se puede usar el motor de almacenaje %s para tablas de historial (log)" ER_BAD_LOG_STATEMENT + chi "如果启用日志记录,则无法'%s'日志表" eng "You cannot '%s' a log table if logging is enabled" ger "Sie können eine Logtabelle nicht '%s', wenn Loggen angeschaltet ist" spa "No puede '%s' una tabla de historial (log) cuando se encuentra activado el llevar historial (log)" ER_CANT_RENAME_LOG_TABLE + chi "无法重命名'%s'。启用日志记录时,重命名日志表必须重命名两个表:日志表到存档表,另一个表返回'%s'" eng "Cannot rename '%s'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to '%s'" ger "Kann '%s' nicht umbenennen. Wenn Loggen angeschaltet ist, müssen zwei Tabellen umbenannt werden: die Logtabelle zu einer Archivtabelle, und eine weitere Tabelle zu '%s'" spa "No puedo renombrar '%s'. Si se encuentra activo el llevar historial (log), el renombrar a/desde tabla de historial (log) debe de renombrar dos tablas: la tabla de historial (log) a una tabla archivo y otra tabla de vuelta a '%s'" ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT 42000 + chi "对本机函数的呼叫中的参数计数不正确'%-.192s'" eng "Incorrect parameter count in the call to native function '%-.192s'" ger "Falsche Anzahl von Parametern beim Aufruf der nativen Funktion '%-.192s'" spa "Contador de parámetro incorrecto en la llamada a función nativa '%-.192s'" ER_WRONG_PARAMETERS_TO_NATIVE_FCT 42000 + chi "对本机函数'%-.192s'呼叫中的参数不正确" eng "Incorrect parameters in the call to native function '%-.192s'" ger "Falscher Parameter beim Aufruf der nativen Funktion '%-.192s'" spa "Parámetros incorrectos en la llamada a función nativa '%-.192s'" ER_WRONG_PARAMETERS_TO_STORED_FCT 42000 + chi "呼叫中的参数不正确为存储函数'%-.192s'" eng "Incorrect parameters in the call to stored function '%-.192s'" ger "Falsche Parameter beim Aufruf der gespeicherten Funktion '%-.192s'" spa "Parámetros incorrectos en la llamada a función almacenada '%-.192s'" ER_NATIVE_FCT_NAME_COLLISION + chi "此功能'%-.192s'具有与本机函数相同的名称" eng "This function '%-.192s' has the same name as a native function" ger "Die Funktion '%-.192s' hat denselben Namen wie eine native Funktion" spa "Esta función '%-.192s' tiene el mismo nombre que una función nativa" # When using this error message, use the ER_DUP_ENTRY error code. See, for # example, code in handler.cc. ER_DUP_ENTRY_WITH_KEY_NAME 23000 S1009 + chi "重复条目'%-.64T'键'%-.192s'" cze "Zvojený klíč '%-.64T' (číslo klíče '%-.192s')" dan "Ens værdier '%-.64T' for indeks '%-.192s'" - nla "Dubbele ingang '%-.64T' voor zoeksleutel '%-.192s'" eng "Duplicate entry '%-.64T' for key '%-.192s'" est "Kattuv väärtus '%-.64T' võtmele '%-.192s'" fre "Duplicata du champ '%-.64T' pour la clef '%-.192s'" @@ -6489,6 +7078,7 @@ ER_DUP_ENTRY_WITH_KEY_NAME 23000 S1009 ita "Valore duplicato '%-.64T' per la chiave '%-.192s'" jpn "'%-.64T' は索引 '%-.192s' で重複しています。" kor "중복된 입력 값 '%-.64T': key '%-.192s'" + nla "Dubbele ingang '%-.64T' voor zoeksleutel '%-.192s'" nor "Like verdier '%-.64T' for nøkkel '%-.192s'" norwegian-ny "Like verdiar '%-.64T' for nykkel '%-.192s'" pol "Powtórzone wystąpienie '%-.64T' dla klucza '%-.192s'" @@ -6501,455 +7091,549 @@ ER_DUP_ENTRY_WITH_KEY_NAME 23000 S1009 swe "Dublett '%-.64T' för nyckel '%-.192s'" ukr "Дублюючий запис '%-.64T' для ключа '%-.192s'" ER_BINLOG_PURGE_EMFILE - eng "Too many files opened, please execute the command again" - ger "Zu viele offene Dateien, bitte führen Sie den Befehl noch einmal aus" - spa "Demasiados ficheros/archivos abiertos. Por favor, ejecute el comando otra vez" + chi "打开太多文件,请再次执行命令" + eng "Too many files opened, please execute the command again" + ger "Zu viele offene Dateien, bitte führen Sie den Befehl noch einmal aus" + spa "Demasiados ficheros/archivos abiertos. Por favor, ejecute el comando otra vez" ER_EVENT_CANNOT_CREATE_IN_THE_PAST - eng "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation" - ger "Ausführungszeit des Events liegt in der Vergangenheit, und es wurde ON COMPLETION NOT PRESERVE gesetzt. Das Event wurde unmittelbar nach Erzeugung gelöscht" - spa "El tiempo de jecución del evento se encuentra en el pasado y está configurado ON COMPLETION NOT PRESERVE. El evento fue eliminado inmediatamente tras su creación" + chi "事件执行时间在过去,并ON COMPLETION NOT PRESERVE。创建后,事件立即丢弃" + eng "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation" + ger "Ausführungszeit des Events liegt in der Vergangenheit, und es wurde ON COMPLETION NOT PRESERVE gesetzt. Das Event wurde unmittelbar nach Erzeugung gelöscht" + spa "El tiempo de jecución del evento se encuentra en el pasado y está configurado ON COMPLETION NOT PRESERVE. El evento fue eliminado inmediatamente tras su creación" ER_EVENT_CANNOT_ALTER_IN_THE_PAST - eng "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future" - ger "Execution Zeitpunkt des Ereignisses in der Vergangenheit liegt, und es war NACH ABSCHLUSS Set nicht erhalten. Die Veranstaltung wurde nicht verändert. Geben Sie einen Zeitpunkt in der Zukunft" - spa "El tiempo de jecución del evento se encuentra en el pasado y está configurado ON COMPLETION NOT PRESERVE. El evento no fue cambiado. Especifique un tiempo del futuro" + chi "事件执行时间在过去,并ON COMPLETION NOT PRESERVE。事件没有改变。指定将来的时间" + eng "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future" + ger "Execution Zeitpunkt des Ereignisses in der Vergangenheit liegt, und es war NACH ABSCHLUSS Set nicht erhalten. Die Veranstaltung wurde nicht verändert. Geben Sie einen Zeitpunkt in der Zukunft" + spa "El tiempo de jecución del evento se encuentra en el pasado y está configurado ON COMPLETION NOT PRESERVE. El evento no fue cambiado. Especifique un tiempo del futuro" ER_SLAVE_INCIDENT - eng "The incident %s occurred on the master. Message: %-.64s" - ger "Der Vorfall %s passierte auf dem Master. Meldung: %-.64s" - spa "Ha ocurrido un incidente %s en el maestro (master). Mensaje: %-.64s" + chi "事件%s发生在master上。消息:%-.64s" + eng "The incident %s occurred on the master. Message: %-.64s" + ger "Der Vorfall %s passierte auf dem Master. Meldung: %-.64s" + spa "Ha ocurrido un incidente %s en el maestro (master). Mensaje: %-.64s" ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT - eng "Table has no partition for some existing values" - ger "Tabelle hat für einige bestehende Werte keine Partition" - spa "La tabla no tiene partición para algunos valores existentes" + chi "表对某些现有值没有分区" + eng "Table has no partition for some existing values" + ger "Tabelle hat für einige bestehende Werte keine Partition" + spa "La tabla no tiene partición para algunos valores existentes" ER_BINLOG_UNSAFE_STATEMENT - eng "Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. %s" - ger "Unsichere Anweisung ins Binärlog geschrieben, weil Anweisungsformat BINLOG_FORMAT = STATEMENT. %s" - spa "Se ha grabado una sentencia no segura en historial (log) binario usando el formato de sentencia desde BINLOG_FORMAT = STATEMENT. %s" - swe "Detta är inte säkert att logga i statement-format, för BINLOG_FORMAT = STATEMENT. %s" + chi "自从BINLOG_FORMAT =STATEMENT以来,使用语句格式写入二进制日志的不安全语句。%s." + eng "Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. %s" + ger "Unsichere Anweisung ins Binärlog geschrieben, weil Anweisungsformat BINLOG_FORMAT = STATEMENT. %s" + spa "Se ha grabado una sentencia no segura en historial (log) binario usando el formato de sentencia desde BINLOG_FORMAT = STATEMENT. %s" + swe "Detta är inte säkert att logga i statement-format, för BINLOG_FORMAT = STATEMENT. %s" ER_SLAVE_FATAL_ERROR - eng "Fatal error: %s" - ger "Fataler Fehler: %s" - spa "Error fatal: %s" + chi "致命错误:%s" + eng "Fatal error: %s" + ger "Fataler Fehler: %s" + spa "Error fatal: %s" ER_SLAVE_RELAY_LOG_READ_FAILURE - eng "Relay log read failure: %s" - ger "Relaylog-Lesefehler: %s" - spa "Fallo de lectura en historial (log) de reenvío: %s" + chi "relay日志读取失败:%s" + eng "Relay log read failure: %s" + ger "Relaylog-Lesefehler: %s" + spa "Fallo de lectura en historial (log) de reenvío: %s" ER_SLAVE_RELAY_LOG_WRITE_FAILURE - eng "Relay log write failure: %s" - ger "Relaylog-Schreibfehler: %s" - spa "Fallo de grabación en historial (log) de reenvío: %s" + chi "relay日志写入失败:%s" + eng "Relay log write failure: %s" + ger "Relaylog-Schreibfehler: %s" + spa "Fallo de grabación en historial (log) de reenvío: %s" ER_SLAVE_CREATE_EVENT_FAILURE - eng "Failed to create %s" - ger "Erzeugen von %s fehlgeschlagen" - hindi "%s को बनाने मैं असफल रहे" - spa "Fallo al crear %s" + chi "无法创建%s" + eng "Failed to create %s" + ger "Erzeugen von %s fehlgeschlagen" + hindi "%s को बनाने मैं असफल रहे" + spa "Fallo al crear %s" ER_SLAVE_MASTER_COM_FAILURE - eng "Master command %s failed: %s" - ger "Master-Befehl %s fehlgeschlagen: %s" - spa "El comando maestro (master) %s ha fallado: %s" + chi "Master命令%s失败:%s" + eng "Master command %s failed: %s" + ger "Master-Befehl %s fehlgeschlagen: %s" + spa "El comando maestro (master) %s ha fallado: %s" ER_BINLOG_LOGGING_IMPOSSIBLE - eng "Binary logging not possible. Message: %s" - ger "Binärlogging nicht möglich. Meldung: %s" - spa "No es posible llevar historial (log) binario. Mensaje: %s" + chi "二进制记录不可能。消息:%s" + eng "Binary logging not possible. Message: %s" + ger "Binärlogging nicht möglich. Meldung: %s" + spa "No es posible llevar historial (log) binario. Mensaje: %s" ER_VIEW_NO_CREATION_CTX - eng "View %`s.%`s has no creation context" - ger "View %`s.%`s hat keinen Erzeugungskontext" - spa "La vista %`s.%`s no tiene contexto de creación" + chi "View%`s.%`s没有创建上下文" + eng "View %`s.%`s has no creation context" + ger "View %`s.%`s hat keinen Erzeugungskontext" + spa "La vista %`s.%`s no tiene contexto de creación" ER_VIEW_INVALID_CREATION_CTX - eng "Creation context of view %`s.%`s is invalid" - ger "Erzeugungskontext des Views%`s.%`s ist ungültig" - spa "El contexto de creación de la vista %`s.%`s es inválido" + chi "Creation View%`s.%`s的上下文无效" + eng "Creation context of view %`s.%`s is invalid" + ger "Erzeugungskontext des Views%`s.%`s ist ungültig" + spa "El contexto de creación de la vista %`s.%`s es inválido" ER_SR_INVALID_CREATION_CTX - eng "Creation context of stored routine %`s.%`s is invalid" - ger "Erzeugungskontext der gespeicherten Routine%`s.%`s ist ungültig" - spa "El contexto de creación de la rutina almacenada %`s.%`s es inválido" + chi "存储例程%`s.%`s的创建上下文无效" + eng "Creation context of stored routine %`s.%`s is invalid" + ger "Erzeugungskontext der gespeicherten Routine%`s.%`s ist ungültig" + spa "El contexto de creación de la rutina almacenada %`s.%`s es inválido" ER_TRG_CORRUPTED_FILE - eng "Corrupted TRG file for table %`s.%`s" - ger "Beschädigte TRG-Datei für Tabelle %`s.%`s" - spa "Fichero/archivo TRG estropeado para la tabla %`s.%`s`" + chi "表的trg文件损坏了。%`s.%`s" + eng "Corrupted TRG file for table %`s.%`s" + ger "Beschädigte TRG-Datei für Tabelle %`s.%`s" + spa "Fichero/archivo TRG estropeado para la tabla %`s.%`s`" ER_TRG_NO_CREATION_CTX - eng "Triggers for table %`s.%`s have no creation context" - ger "Trigger für Tabelle %`s.%`s haben keinen Erzeugungskontext" - spa "Los disparadores para la tabla %`s.%`s no tienen contexto de creación" + chi "表%`s.%`s的触发器没有创建上下文" + eng "Triggers for table %`s.%`s have no creation context" + ger "Trigger für Tabelle %`s.%`s haben keinen Erzeugungskontext" + spa "Los disparadores para la tabla %`s.%`s no tienen contexto de creación" ER_TRG_INVALID_CREATION_CTX - eng "Trigger creation context of table %`s.%`s is invalid" - ger "Trigger-Erzeugungskontext der Tabelle %`s.%`s ist ungültig" - spa "El contexto de creación del disparador de la tabla %`s.%`s es inválido" + chi "触发表%`s.%`s的创建上下文无效" + eng "Trigger creation context of table %`s.%`s is invalid" + ger "Trigger-Erzeugungskontext der Tabelle %`s.%`s ist ungültig" + spa "El contexto de creación del disparador de la tabla %`s.%`s es inválido" ER_EVENT_INVALID_CREATION_CTX - eng "Creation context of event %`s.%`s is invalid" - ger "Erzeugungskontext des Events %`s.%`s ist ungültig" - spa "El contexto de creación del evento %`s.%`s es inválido" + chi "事件%`s.%`s的创建上下文无效" + eng "Creation context of event %`s.%`s is invalid" + ger "Erzeugungskontext des Events %`s.%`s ist ungültig" + spa "El contexto de creación del evento %`s.%`s es inválido" ER_TRG_CANT_OPEN_TABLE - eng "Cannot open table for trigger %`s.%`s" - ger "Kann Tabelle für den Trigger %`s.%`s nicht öffnen" - spa "No puedo abrir tabla para disparador %`s.%`s" + chi "无法打开触发%`s.%`s的表" + eng "Cannot open table for trigger %`s.%`s" + ger "Kann Tabelle für den Trigger %`s.%`s nicht öffnen" + spa "No puedo abrir tabla para disparador %`s.%`s" ER_CANT_CREATE_SROUTINE - eng "Cannot create stored routine %`s. Check warnings" - ger "Kann gespeicherte Routine %`s nicht erzeugen. Beachten Sie die Warnungen" - spa "No puedo crear rutina alnacenada %`s. Revise los avisos" + chi "无法创建存储过程%`s。检查警告" + eng "Cannot create stored routine %`s. Check warnings" + ger "Kann gespeicherte Routine %`s nicht erzeugen. Beachten Sie die Warnungen" + spa "No puedo crear rutina alnacenada %`s. Revise los avisos" ER_UNUSED_11 + chi "你永远不应该看到它" eng "You should never see it" spa "Nunca debería vd de ver esto" ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT - eng "The BINLOG statement of type %s was not preceded by a format description BINLOG statement" - ger "Der BINLOG-Anweisung vom Typ %s ging keine BINLOG-Anweisung zur Formatbeschreibung voran" - spa "La sentencia BINLOG del tipo `%s` no ha sido precedida por una sentencia de descripción de formato BINLOG" + chi "类型%s的Binlog语句未在格式描述binlog语句之前" + eng "The BINLOG statement of type %s was not preceded by a format description BINLOG statement" + ger "Der BINLOG-Anweisung vom Typ %s ging keine BINLOG-Anweisung zur Formatbeschreibung voran" + spa "La sentencia BINLOG del tipo `%s` no ha sido precedida por una sentencia de descripción de formato BINLOG" ER_SLAVE_CORRUPT_EVENT - eng "Corrupted replication event was detected" - ger "Beschädigtes Replikationsereignis entdeckt" - spa "Se ha detectado un evento de réplica estropeado" + chi "检测到损坏的复制事件" + eng "Corrupted replication event was detected" + ger "Beschädigtes Replikationsereignis entdeckt" + spa "Se ha detectado un evento de réplica estropeado" ER_LOAD_DATA_INVALID_COLUMN - eng "Invalid column reference (%-.64s) in LOAD DATA" - ger "Ungültige Spaltenreferenz (%-.64s) bei LOAD DATA" - spa "Referencia inválida a columna (%-.64s) en LOAD DATA" + chi "LOAD DATA中的列引用(%-.64s)无效" + eng "Invalid column reference (%-.64s) in LOAD DATA" + ger "Ungültige Spaltenreferenz (%-.64s) bei LOAD DATA" + spa "Referencia inválida a columna (%-.64s) en LOAD DATA" ER_LOG_PURGE_NO_FILE - eng "Being purged log %s was not found" - ger "Zu bereinigende Logdatei %s wurde nicht gefunden" - spa "No ha sido hallado historial (log) %s siendo purgado" + chi "未找到清除的log%s" + eng "Being purged log %s was not found" + ger "Zu bereinigende Logdatei %s wurde nicht gefunden" + spa "No ha sido hallado historial (log) %s siendo purgado" ER_XA_RBTIMEOUT XA106 - eng "XA_RBTIMEOUT: Transaction branch was rolled back: took too long" - ger "XA_RBTIMEOUT: Transaktionszweig wurde zurückgerollt: Zeitüberschreitung" - spa "XA_RBTIMEOUT: Rama de transacción ha sido retrocedida (rolled back): transcurrido demasiado tiempo" + chi "XA_RBTIMEOUT:交易分支回滚:花了太久了" + eng "XA_RBTIMEOUT: Transaction branch was rolled back: took too long" + ger "XA_RBTIMEOUT: Transaktionszweig wurde zurückgerollt: Zeitüberschreitung" + spa "XA_RBTIMEOUT: Rama de transacción ha sido retrocedida (rolled back): transcurrido demasiado tiempo" ER_XA_RBDEADLOCK XA102 - eng "XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected" - ger "XA_RBDEADLOCK: Transaktionszweig wurde zurückgerollt: Deadlock entdeckt" - spa "XA_RBDEADLOCK: Rama de transacción ha dido retrocedida (rolled back): se ha detectado estancamiento (deadlock)" + chi "XA_RBDEADLOCK:交易分支回滚:检测到死锁" + eng "XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected" + ger "XA_RBDEADLOCK: Transaktionszweig wurde zurückgerollt: Deadlock entdeckt" + spa "XA_RBDEADLOCK: Rama de transacción ha dido retrocedida (rolled back): se ha detectado estancamiento (deadlock)" ER_NEED_REPREPARE - eng "Prepared statement needs to be re-prepared" - ger "Vorbereitete Anweisungen müssen noch einmal vorbereitet werden" - spa "Sentencia preparada necesita volver a ser preparada" + chi "prepared statement需要重新准备" + eng "Prepared statement needs to be re-prepared" + ger "Vorbereitete Anweisungen müssen noch einmal vorbereitet werden" + spa "Sentencia preparada necesita volver a ser preparada" ER_DELAYED_NOT_SUPPORTED - eng "DELAYED option not supported for table '%-.192s'" - ger "Die DELAYED-Option wird für Tabelle '%-.192s' nicht unterstützt" - spa "Opción DELAYED no soportada para la tabla '%-.192s'" -WARN_NO_MASTER_INFO - eng "There is no master connection '%.*s'" - ger "Die Master-Info-Struktur existiert nicht '%.*s'" - spa "No existe conexión maestra '%.*s'" + chi "表'%-.192s'不支持延迟选项" + eng "DELAYED option not supported for table '%-.192s'" + ger "Die DELAYED-Option wird für Tabelle '%-.192s' nicht unterstützt" + spa "Opción DELAYED no soportada para la tabla '%-.192s'" +WARN_NO_MASTER_INFO + eng "There is no master connection '%.*s'" + ger "Die Master-Info-Struktur existiert nicht '%.*s'" + spa "No existe conexión maestra '%.*s'" WARN_OPTION_IGNORED - eng "<%-.64s> option ignored" - ger "Option <%-.64s> ignoriert" - spa "Opción <%-.64s> ignorada" + eng "<%-.64s> option ignored" + ger "Option <%-.64s> ignoriert" + spa "Opción <%-.64s> ignorada" ER_PLUGIN_DELETE_BUILTIN - eng "Built-in plugins cannot be deleted" - ger "Eingebaute Plugins können nicht gelöscht werden" - spa "No se pueden borrar los enchufes (plugins) internos" + chi "内置插件无法删除" + eng "Built-in plugins cannot be deleted" + ger "Eingebaute Plugins können nicht gelöscht werden" + spa "No se pueden borrar los enchufes (plugins) internos" WARN_PLUGIN_BUSY - eng "Plugin is busy and will be uninstalled on shutdown" - ger "Plugin wird verwendet und wird erst beim Herunterfahren deinstalliert" - spa "El enchufe (plugin) está ocupado y será desinstalado cuando se apague" + chi "插件很忙,将在关机时卸载" + eng "Plugin is busy and will be uninstalled on shutdown" + ger "Plugin wird verwendet und wird erst beim Herunterfahren deinstalliert" + spa "El enchufe (plugin) está ocupado y será desinstalado cuando se apague" ER_VARIABLE_IS_READONLY - eng "%s variable '%s' is read-only. Use SET %s to assign the value" - ger "%s Variable '%s' ist nur lesbar. Benutzen Sie SET %s, um einen Wert zuzuweisen" - spa "%s variable '%s' es de sólo lectura. Use SET %s para asignar el valor" + chi "%s变量'%s'是只读的。使用set%s付值" + eng "%s variable '%s' is read-only. Use SET %s to assign the value" + ger "%s Variable '%s' ist nur lesbar. Benutzen Sie SET %s, um einen Wert zuzuweisen" + spa "%s variable '%s' es de sólo lectura. Use SET %s para asignar el valor" ER_WARN_ENGINE_TRANSACTION_ROLLBACK - eng "Storage engine %s does not support rollback for this statement. Transaction rolled back and must be restarted" - ger "Speicher-Engine %s unterstützt für diese Anweisung kein Rollback. Transaktion wurde zurückgerollt und muss neu gestartet werden" - spa "El motor de almacenaje %s no soporta retroceso (rollback) para esta sentencia. Transacción retrocedida (rolled back) y debe de ser rearrancada" + chi "存储引擎%s不支持此语句的回滚。交易回滚并必须重新启动" + eng "Storage engine %s does not support rollback for this statement. Transaction rolled back and must be restarted" + ger "Speicher-Engine %s unterstützt für diese Anweisung kein Rollback. Transaktion wurde zurückgerollt und muss neu gestartet werden" + spa "El motor de almacenaje %s no soporta retroceso (rollback) para esta sentencia. Transacción retrocedida (rolled back) y debe de ser rearrancada" ER_SLAVE_HEARTBEAT_FAILURE - eng "Unexpected master's heartbeat data: %s" - ger "Unerwartete Daten vom Heartbeat des Masters: %s" - spa "Datos inesperados de latido (heartbeat) de maestro (master): %s" + chi "意外的master心跳数据:%s" + eng "Unexpected master's heartbeat data: %s" + ger "Unerwartete Daten vom Heartbeat des Masters: %s" + spa "Datos inesperados de latido (heartbeat) de maestro (master): %s" ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE - eng "The requested value for the heartbeat period is either negative or exceeds the maximum allowed (%u seconds)" - spa "El valor requerido para el período de latido o es negativo o excede al máximo permitido (%u segundos)" + chi "心跳周期的请求值是负的或超过允许的最大值(%u秒)" + eng "The requested value for the heartbeat period is either negative or exceeds the maximum allowed (%u seconds)" + spa "El valor requerido para el período de latido o es negativo o excede al máximo permitido (%u segundos)" ER_UNUSED_14 - eng "You should never see it" - spa "Nunca debería vd de ver esto" + chi "你永远不应该看到它" + eng "You should never see it" + spa "Nunca debería vd de ver esto" ER_CONFLICT_FN_PARSE_ERROR - eng "Error in parsing conflict function. Message: %-.64s" - ger "Fehler beim Parsen einer Konflikt-Funktion. Meldung: %-.64s" - spa "Error al analizar función de conflicto. Mensaje: %-.64s" + chi "解析冲突功能时出错。消息:%-.64s" + eng "Error in parsing conflict function. Message: %-.64s" + ger "Fehler beim Parsen einer Konflikt-Funktion. Meldung: %-.64s" + spa "Error al analizar función de conflicto. Mensaje: %-.64s" ER_EXCEPTIONS_WRITE_ERROR - eng "Write to exceptions table failed. Message: %-.128s"" - ger "Schreiben in Ausnahme-Tabelle fehlgeschlagen. Meldung: %-.128s"" - spa "Ha fallado el grabar en tabla de excepciones. Mensaje: %-.128s"" + chi "写入异常表失败。消息:%-.128s" + eng "Write to exceptions table failed. Message: %-.128s"" + ger "Schreiben in Ausnahme-Tabelle fehlgeschlagen. Meldung: %-.128s"" + spa "Ha fallado el grabar en tabla de excepciones. Mensaje: %-.128s"" ER_TOO_LONG_TABLE_COMMENT - eng "Comment for table '%-.64s' is too long (max = %u)" - por "Comentário para a tabela '%-.64s' é longo demais (max = %u)" - ger "Kommentar für Tabelle '%-.64s' ist zu lang (max = %u)" - spa "El comentario para tabla '%-.64s' es demasiado largo (máx = %u)" + chi "表格备注'%-.64s'太长(max =%u)" + eng "Comment for table '%-.64s' is too long (max = %u)" + ger "Kommentar für Tabelle '%-.64s' ist zu lang (max = %u)" + por "Comentário para a tabela '%-.64s' é longo demais (max = %u)" + spa "El comentario para tabla '%-.64s' es demasiado largo (máx = %u)" ER_TOO_LONG_FIELD_COMMENT - eng "Comment for field '%-.64s' is too long (max = %u)" - por "Comentário para o campo '%-.64s' é longo demais (max = %u)" - ger "Kommentar für Feld '%-.64s' ist zu lang (max = %u)" - spa "El comentario para el campo '%-.64s' es demasiado largo (máx = %u)" + chi "字段'%-.64s'太长(max =%u)" + eng "Comment for field '%-.64s' is too long (max = %u)" + ger "Kommentar für Feld '%-.64s' ist zu lang (max = %u)" + por "Comentário para o campo '%-.64s' é longo demais (max = %u)" + spa "El comentario para el campo '%-.64s' es demasiado largo (máx = %u)" ER_FUNC_INEXISTENT_NAME_COLLISION 42000 - eng "FUNCTION %s does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual" - ger "FUNCTION %s existiert nicht. Erläuterungen im Abschnitt 'Function Name Parsing and Resolution' im Referenzhandbuch" - spa "La FUNCTION %s no existe. Revise la sección de 'Function Name Parsing and Resolution' en el Manual de Referencia" + chi "FUNCTION %s不存在。在参考手册中查看“函数名称解析”部分" + eng "FUNCTION %s does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual" + ger "FUNCTION %s existiert nicht. Erläuterungen im Abschnitt 'Function Name Parsing and Resolution' im Referenzhandbuch" + spa "La FUNCTION %s no existe. Revise la sección de 'Function Name Parsing and Resolution' en el Manual de Referencia" # When updating these, please update EXPLAIN_FILENAME_MAX_EXTRA_LENGTH in # sql_table.h with the new maximal additional length for explain_filename. ER_DATABASE_NAME - eng "Database" - swe "Databas" - ger "Datenbank" - hindi "डेटाबेस" - spa "Base de datos" + chi "数据库" + eng "Database" + ger "Datenbank" + hindi "डेटाबेस" + spa "Base de datos" + swe "Databas" ER_TABLE_NAME - eng "Table" - swe "Tabell" - ger "Tabelle" - hindi "टेबल" - spa "Tabla" + chi "表" + eng "Table" + ger "Tabelle" + hindi "टेबल" + spa "Tabla" + swe "Tabell" ER_PARTITION_NAME - eng "Partition" - swe "Partition" - ger "Partition" - hindi "पार्टीशन" - spa "Partición" + chi "分区" + eng "Partition" + ger "Partition" + hindi "पार्टीशन" + spa "Partición" + swe "Partition" ER_SUBPARTITION_NAME - eng "Subpartition" - swe "Subpartition" - ger "Unterpartition" - hindi "सब-पार्टीशन" - spa "Subpartición" + chi "下分区" + eng "Subpartition" + ger "Unterpartition" + hindi "सब-पार्टीशन" + spa "Subpartición" + swe "Subpartition" ER_TEMPORARY_NAME - eng "Temporary" - swe "Temporär" - ger "Temporär" - hindi "अस्थायी" - spa "Temporal" + chi "暂时的" + eng "Temporary" + ger "Temporär" + hindi "अस्थायी" + spa "Temporaria" + swe "Temporär" ER_RENAMED_NAME - eng "Renamed" - swe "Namnändrad" - ger "Umbenannt" - spa "Renombrado" + chi "重命名" + eng "Renamed" + ger "Umbenannt" + spa "Renombrado" + swe "Namnändrad" ER_TOO_MANY_CONCURRENT_TRXS - eng "Too many active concurrent transactions" - ger "Zu viele aktive simultane Transaktionen" - spa "Demasiadas transacciones concurrentes activas" + chi "“太多并发交易" + eng "Too many active concurrent transactions" + ger "Zu viele aktive simultane Transaktionen" + spa "Demasiadas transacciones concurrentes activas" WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED - eng "Non-ASCII separator arguments are not fully supported" - ger "Nicht-ASCII-Trennargumente werden nicht vollständig unterstützt" - spa "Los argumentos con separador No ASCII no están completamente soportados" + chi "非ASCII分隔符参数不完全支持" + eng "Non-ASCII separator arguments are not fully supported" + ger "Nicht-ASCII-Trennargumente werden nicht vollständig unterstützt" + spa "Los argumentos con separador No ASCII no están completamente soportados" ER_DEBUG_SYNC_TIMEOUT - eng "debug sync point wait timed out" - ger "Debug Sync Point Wartezeit überschritten" - spa "agotado tiempo de espera de punto de sincronización de depuración" + chi "调试同步点等待超时" + eng "debug sync point wait timed out" + ger "Debug Sync Point Wartezeit überschritten" + spa "agotado tiempo de espera de punto de sincronización de depuración" ER_DEBUG_SYNC_HIT_LIMIT - eng "debug sync point hit limit reached" - ger "Debug Sync Point Hit Limit erreicht" - spa "alcanzado límite de punto de sincronización de depuración" + chi "调试同步点限制达到" + eng "debug sync point hit limit reached" + ger "Debug Sync Point Hit Limit erreicht" + spa "alcanzado límite de punto de sincronización de depuración" ER_DUP_SIGNAL_SET 42000 - eng "Duplicate condition information item '%s'" - ger "Informationselement '%s' für Duplikatbedingung" - spa "Duplicado elemento de información de condición '%s'" + chi "重复条件信息项'%s'" + eng "Duplicate condition information item '%s'" + ger "Informationselement '%s' für Duplikatbedingung" + spa "Duplicado elemento de información de condición '%s'" # Note that the SQLSTATE is not 01000, it is provided by SIGNAL/RESIGNAL ER_SIGNAL_WARN 01000 - eng "Unhandled user-defined warning condition" - ger "Unbehandelte benutzerdefinierte Warnbedingung" - spa "Condición de aviso definida por usuario sin manejar" + chi "未处理用户定义的警告条件" + eng "Unhandled user-defined warning condition" + ger "Unbehandelte benutzerdefinierte Warnbedingung" + spa "Condición de aviso definida por usuario sin manejar" # Note that the SQLSTATE is not 02000, it is provided by SIGNAL/RESIGNAL ER_SIGNAL_NOT_FOUND 02000 - eng "Unhandled user-defined not found condition" - ger "Unbehandelte benutzerdefinierte Nicht-gefunden-Bedingung" - spa "Condición de no hallado definida por usuario sin manejar" + chi "未找到的用户定义未找到条件" + eng "Unhandled user-defined not found condition" + ger "Unbehandelte benutzerdefinierte Nicht-gefunden-Bedingung" + spa "Condición de no hallado definida por usuario sin manejar" # Note that the SQLSTATE is not HY000, it is provided by SIGNAL/RESIGNAL ER_SIGNAL_EXCEPTION HY000 - eng "Unhandled user-defined exception condition" - ger "Unbehandelte benutzerdefinierte Ausnahmebedingung" - spa "Condición de excepción definida por usuario sin manejar" + chi "未处理用户定义的异常条件" + eng "Unhandled user-defined exception condition" + ger "Unbehandelte benutzerdefinierte Ausnahmebedingung" + spa "Condición de excepción definida por usuario sin manejar" ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER 0K000 - eng "RESIGNAL when handler not active" - ger "RESIGNAL bei nicht aktivem Handler" - spa "RESIGNAL cuando el manejador no activo" + chi "RESIGNAL处理程序不活跃" + eng "RESIGNAL when handler not active" + ger "RESIGNAL bei nicht aktivem Handler" + spa "RESIGNAL cuando el manejador no activo" ER_SIGNAL_BAD_CONDITION_TYPE - eng "SIGNAL/RESIGNAL can only use a CONDITION defined with SQLSTATE" - ger "SIGNAL/RESIGNAL kann nur mit einer Bedingung (CONDITION) benutzt werden, die bei SQLSTATE definiert wurde" - spa "SIGNAL/RESIGNAL sólo pueden usar una CONDITION definida mediante SQLSTATE" + chi "SIGNAL/RESIGNAL只能使用SQLState定义的条件" + eng "SIGNAL/RESIGNAL can only use a CONDITION defined with SQLSTATE" + ger "SIGNAL/RESIGNAL kann nur mit einer Bedingung (CONDITION) benutzt werden, die bei SQLSTATE definiert wurde" + spa "SIGNAL/RESIGNAL sólo pueden usar una CONDITION definida mediante SQLSTATE" WARN_COND_ITEM_TRUNCATED - eng "Data truncated for condition item '%s'" - ger "Daten gekürzt für Bedingungselement '%s'" - spa "Datos truncados para elemento de condición '%s'" + chi "数据被截断为条件项目'%s'" + eng "Data truncated for condition item '%s'" + ger "Daten gekürzt für Bedingungselement '%s'" + spa "Datos truncados para elemento de condición '%s'" ER_COND_ITEM_TOO_LONG - eng "Data too long for condition item '%s'" - ger "Daten zu lang für Bedingungselement '%s'" - spa "Datos demasiados largos para elemento de condición '%s'" + chi "条件项目'%s'的数据太长" + eng "Data too long for condition item '%s'" + ger "Daten zu lang für Bedingungselement '%s'" + spa "Datos demasiados largos para elemento de condición '%s'" ER_UNKNOWN_LOCALE - eng "Unknown locale: '%-.64s'" - ger "Unbekannte Locale: '%-.64s'" - spa "Localización (locale) desconocida: '%-.64s'" + chi "未知区域设置:'%-.64s'" + eng "Unknown locale: '%-.64s'" + ger "Unbekannte Locale: '%-.64s'" + spa "Localización (locale) desconocida: '%-.64s'" ER_SLAVE_IGNORE_SERVER_IDS - eng "The requested server id %d clashes with the slave startup option --replicate-same-server-id" - ger "Die angeforderte Server-ID %d steht im Konflikt mit der Startoption --replicate-same-server-id für den Slave" - spa "La id %d del servidor requerido choca con la opción de arranque del esclavo --replicate-same-server-id" + chi "请求的服务器ID%d与SLAVE启动选项--replicate-same-server-id冲突" + eng "The requested server id %d clashes with the slave startup option --replicate-same-server-id" + ger "Die angeforderte Server-ID %d steht im Konflikt mit der Startoption --replicate-same-server-id für den Slave" + spa "La id %d del servidor requerido choca con la opción de arranque del esclavo --replicate-same-server-id" ER_QUERY_CACHE_DISABLED - eng "Query cache is disabled; set query_cache_type to ON or DEMAND to enable it" - spa "Caché de consulta (query) desactivada; configura query_cache_type a ON o DEMAND para activarla" + chi "查询缓存已禁用;将query_cache_type设置为ON或DEMAND启用它" + eng "Query cache is disabled; set query_cache_type to ON or DEMAND to enable it" + spa "Caché de consulta (query) desactivada; configura query_cache_type a ON o DEMAND para activarla" ER_SAME_NAME_PARTITION_FIELD - eng "Duplicate partition field name '%-.192s'" - ger "Partitionsfeld '%-.192s' ist ein Duplikat" - spa "Nombre de campo de partición duplicado '%-.192s'" + chi "重复分区字段名称'%-.192s'" + eng "Duplicate partition field name '%-.192s'" + ger "Partitionsfeld '%-.192s' ist ein Duplikat" + spa "Nombre de campo de partición duplicado '%-.192s'" ER_PARTITION_COLUMN_LIST_ERROR - eng "Inconsistency in usage of column lists for partitioning" - ger "Inkonsistenz bei der Benutzung von Spaltenlisten für Partitionierung" - spa "Inconsistencia en uso de listas de columna para particionar" + chi "分区用的列和列表使用不一致" + eng "Inconsistency in usage of column lists for partitioning" + ger "Inkonsistenz bei der Benutzung von Spaltenlisten für Partitionierung" + spa "Inconsistencia en uso de listas de columna para particionar" ER_WRONG_TYPE_COLUMN_VALUE_ERROR - eng "Partition column values of incorrect type" - ger "Partitionsspaltenwerte sind vom falschen Typ" - spa "Valores de columna de partición de tipo incorrecto" + chi "不正确类型的分区列值" + eng "Partition column values of incorrect type" + ger "Partitionsspaltenwerte sind vom falschen Typ" + spa "Valores de columna de partición de tipo incorrecto" ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR - eng "Too many fields in '%-.192s'" - ger "Zu viele Felder in '%-.192s'" - spa "Demasiados campos en '%-.192s'" + chi "'%-.192s'中的太多字段" + eng "Too many fields in '%-.192s'" + ger "Zu viele Felder in '%-.192s'" + spa "Demasiados campos en '%-.192s'" ER_MAXVALUE_IN_VALUES_IN - eng "Cannot use MAXVALUE as value in VALUES IN" - ger "MAXVALUE kann nicht als Wert in VALUES IN verwendet werden" - spa "No puedo usar MAXVALUE como valor en VALUES IN" + chi "不能在VALUES IN使用MAXVALUE" + eng "Cannot use MAXVALUE as value in VALUES IN" + ger "MAXVALUE kann nicht als Wert in VALUES IN verwendet werden" + spa "No puedo usar MAXVALUE como valor en VALUES IN" ER_TOO_MANY_VALUES_ERROR - eng "Cannot have more than one value for this type of %-.64s partitioning" - ger "Für den Partionierungstyp %-.64s darf es nicht mehr als einen Wert geben" - spa "No puedo tener más de un valor para este tipo de particionamiento %-.64s" + chi "这种类型不能有多个值%-.64s 分区" + eng "Cannot have more than one value for this type of %-.64s partitioning" + ger "Für den Partionierungstyp %-.64s darf es nicht mehr als einen Wert geben" + spa "No puedo tener más de un valor para este tipo de particionamiento %-.64s" ER_ROW_SINGLE_PARTITION_FIELD_ERROR - eng "Row expressions in VALUES IN only allowed for multi-field column partitioning" - ger "Zeilenausdrücke in VALUES IN sind nur für Mehrfeld-Spaltenpartionierung erlaubt" - spa "Expresiones de fila en VALUES IN sólo permitidas para particionamiento de columna multi-campo" + chi "仅允许的多字段列分区的VALUES IN的行表达式" + eng "Row expressions in VALUES IN only allowed for multi-field column partitioning" + ger "Zeilenausdrücke in VALUES IN sind nur für Mehrfeld-Spaltenpartionierung erlaubt" + spa "Expresiones de fila en VALUES IN sólo permitidas para particionamiento de columna multi-campo" ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD - eng "Field '%-.192s' is of a not allowed type for this type of partitioning" - ger "Feld '%-.192s' ist für diese Art von Partitionierung von einem nicht zulässigen Typ" - spa "El campo '%-.192s' es de un tipo no permitido para este tipo de particionado" + chi "字段'%-.192s'类型不允许为此类型的分区类型" + eng "Field '%-.192s' is of a not allowed type for this type of partitioning" + ger "Feld '%-.192s' ist für diese Art von Partitionierung von einem nicht zulässigen Typ" + spa "El campo '%-.192s' es de un tipo no permitido para este tipo de particionado" ER_PARTITION_FIELDS_TOO_LONG - eng "The total length of the partitioning fields is too large" - ger "Die Gesamtlänge der Partitionsfelder ist zu groß" - spa "El tamaño total de los campos de particionado es demasiado grande" + chi "分区字段的总长度太大" + eng "The total length of the partitioning fields is too large" + ger "Die Gesamtlänge der Partitionsfelder ist zu groß" + spa "El tamaño total de los campos de particionado es demasiado grande" ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE - eng "Cannot execute statement: impossible to write to binary log since both row-incapable engines and statement-incapable engines are involved" - spa "No puedo ejecutar sentencia: imposible grabar historial (log) binario ya que ambos motores de fila-incapaz y de sentencia-incapaz están involucrados" + chi "无法执行语句:由于引擎不能支持行和语句,因此无法写入二进制日志" + eng "Cannot execute statement: impossible to write to binary log since both row-incapable engines and statement-incapable engines are involved" + spa "No puedo ejecutar sentencia: imposible grabar historial (log) binario ya que ambos motores de fila-incapaz y de sentencia-incapaz están involucrados" ER_BINLOG_ROW_MODE_AND_STMT_ENGINE - eng "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging" - spa "No puedo ejecutar sentencia: imposible grabar historial (log) binario ya que BINLOG_FORMAT = ROW y al menos una tabla utiliza motor de almacenaje limitado a historiales basados en sentencia" + chi "无法执行语句:由于BINLOG_FORMAT =ROW和至少一个表使用存储引擎限制为基于语句的日志记录,因此无法写入二进制日志" + eng "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging" + spa "No puedo ejecutar sentencia: imposible grabar historial (log) binario ya que BINLOG_FORMAT = ROW y al menos una tabla utiliza motor de almacenaje limitado a historiales basados en sentencia" ER_BINLOG_UNSAFE_AND_STMT_ENGINE - eng "Cannot execute statement: impossible to write to binary log since statement is unsafe, storage engine is limited to statement-based logging, and BINLOG_FORMAT = MIXED. %s" - spa "No puedo ejecutar sentencia: imposible grabar historial (log) binario ya que la sentencia no es segura, el motor de almacenaje está limitado a historial basado en sentencia y BINLOG_FORMAT = MIXED. %s" + chi "无法执行语句:由于语句不安全,无法写入二进制日志,存储引擎仅限于基于语句的日志记录,而BINLOG_FORMAT = MIXED。%s." + eng "Cannot execute statement: impossible to write to binary log since statement is unsafe, storage engine is limited to statement-based logging, and BINLOG_FORMAT = MIXED. %s" + spa "No puedo ejecutar sentencia: imposible grabar historial (log) binario ya que la sentencia no es segura, el motor de almacenaje está limitado a historial basado en sentencia y BINLOG_FORMAT = MIXED. %s" ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE - eng "Cannot execute statement: impossible to write to binary log since statement is in row format and at least one table uses a storage engine limited to statement-based logging" - spa "No puedo ejecutar sentencia: imposible grabar historial (log) binario ya que la sentencia está en un formato de fila y al menos una tabla utiliza un motor de almacenaje limitado a historial basado en sentencia" + chi "无法执行语句:由于语句以行格式,至少一个表使用基于语句的日志记录的存储引擎,因此无法写入二进制日志。" + eng "Cannot execute statement: impossible to write to binary log since statement is in row format and at least one table uses a storage engine limited to statement-based logging" + spa "No puedo ejecutar sentencia: imposible grabar historial (log) binario ya que la sentencia está en un formato de fila y al menos una tabla utiliza un motor de almacenaje limitado a historial basado en sentencia" ER_BINLOG_STMT_MODE_AND_ROW_ENGINE - eng "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging.%s" - spa "No puedo ejecutar sentencia: imposible grabar historial (log) binario ya que BINLOG_FORMAT = STATEMENT y al menos una tabla utilizan un motor de almacenaje limitado a historial basado en fila. %s" + chi "无法执行语句:由于BINLOG_FORMAT = STATEMENT,并且至少一个表使用存储引擎限制为基于行的日志记录,因此无法写入二进制日志。%s" + eng "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging.%s" + spa "No puedo ejecutar sentencia: imposible grabar historial (log) binario ya que BINLOG_FORMAT = STATEMENT y al menos una tabla utilizan un motor de almacenaje limitado a historial basado en fila. %s" ER_BINLOG_ROW_INJECTION_AND_STMT_MODE - eng "Cannot execute statement: impossible to write to binary log since statement is in row format and BINLOG_FORMAT = STATEMENT" - spa "No puedo ejecutar sentencia: imposible grabar historial (log) binario ya que la sentencia está en formato de fila y BINLOG_FORMAT = STATEMENT" + chi "无法执行语句:由于语句的正常格式和BINLOG_FORMAT = STATEMENT,因此无法写入二进制日志" + eng "Cannot execute statement: impossible to write to binary log since statement is in row format and BINLOG_FORMAT = STATEMENT" + spa "No puedo ejecutar sentencia: imposible grabar historial (log) binario ya que la sentencia está en formato de fila y BINLOG_FORMAT = STATEMENT" ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE - eng "Cannot execute statement: impossible to write to binary log since more than one engine is involved and at least one engine is self-logging" - spa "No puedo ejecutar sentencia: imposible grabar historial (log) binario ya que hay más de un motor involucrado y al menos un motor usa auto-historial" - + chi "无法执行语句:由于涉及多个引擎并且至少有一个引擎是自记录的,因此无法写入二进制日志。" + eng "Cannot execute statement: impossible to write to binary log since more than one engine is involved and at least one engine is self-logging" + spa "No puedo ejecutar sentencia: imposible grabar historial (log) binario ya que hay más de un motor involucrado y al menos un motor usa auto-historial" ER_BINLOG_UNSAFE_LIMIT - eng "The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted" - spa "La sentencia no es segura debido a usar una cláusula LIMIT. No es segura porque el conjunto incluido de filas no se puede predecir" + chi "该语句不安全,因为它使用限制子句。这不安全,因为所包含的一组行无法预测" + eng "The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted" + spa "La sentencia no es segura debido a usar una cláusula LIMIT. No es segura porque el conjunto incluido de filas no se puede predecir" ER_BINLOG_UNSAFE_INSERT_DELAYED - eng "The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted" - spa "La sentencia no es segura debido a usar una INSERT DELAYED. No es segura porque los momentos en que las filas han de insertarse no se pueden predecir" + chi "该声明不安全,因为它使用插入延迟。这是不安全的,因为无法预测插入行的时间" + eng "The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted" + spa "La sentencia no es segura debido a usar una INSERT DELAYED. No es segura porque los momentos en que las filas han de insertarse no se pueden predecir" ER_BINLOG_UNSAFE_SYSTEM_TABLE - eng "The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves" - spa "La sentencia no es segura debido a usar el historial (log) general, un historial (log) lento o tabla(s) de performance_schema. No es segura porque las tablas de sistema pueden diferir de las esclavas" + chi "该声明不安全,因为它使用常规日志,慢查询日志或performance_schema表。这是不安全的,因为系统表可能在slave上不同" + eng "The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves" + spa "La sentencia no es segura debido a usar el historial (log) general, un historial (log) lento o tabla(s) de performance_schema. No es segura porque las tablas de sistema pueden diferir de las esclavas" ER_BINLOG_UNSAFE_AUTOINC_COLUMNS - eng "Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly" - spa "La sentencia no es segura debido a invocar un disparador o una función almacenada que inserta una columna de AUTO_INCREMENT. No se puede llevar historial correcto de Los valores insertados". + chi "语句不安全,因为它调用了插入AUTO_INCREMENT列的触发器或存储函数。插入的值无法正确记录" + eng "Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly" + spa "La sentencia no es segura debido a invocar un disparador o una función almacenada que inserta una columna de AUTO_INCREMENT. No se puede llevar historial correcto de Los valores insertados". ER_BINLOG_UNSAFE_UDF - eng "Statement is unsafe because it uses a UDF which may not return the same value on the slave" - spa "La sentencia no es segura porque usa un UDF que puede no devolver el mismo valor en el esclavo" + chi "语句不安全,因为它使用了一个可能在从设备上返回相同值的UDF" + eng "Statement is unsafe because it uses a UDF which may not return the same value on the slave" + spa "La sentencia no es segura porque usa un UDF que puede no devolver el mismo valor en el esclavo" ER_BINLOG_UNSAFE_SYSTEM_VARIABLE - eng "Statement is unsafe because it uses a system variable that may have a different value on the slave" - spa "La sentencia no es segura porque usa una variable de sistema que puede tener un valor diferente en el esclavo" + chi "语句不安全,因为它使用的系统变量可能在从站上具有不同的值" + eng "Statement is unsafe because it uses a system variable that may have a different value on the slave" + spa "La sentencia no es segura porque usa una variable de sistema que puede tener un valor diferente en el esclavo" ER_BINLOG_UNSAFE_SYSTEM_FUNCTION - eng "Statement is unsafe because it uses a system function that may return a different value on the slave" - spa "La sentencia no es segura porque usa una función de sistema que puede devolver un valor diferente en el esclavo" + chi "语句不安全,因为它使用系统函数可能在从站上返回不同的值" + eng "Statement is unsafe because it uses a system function that may return a different value on the slave" + spa "La sentencia no es segura porque usa una función de sistema que puede devolver un valor diferente en el esclavo" ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS - eng "Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction" - spa "La sentencia no es segura porque accede a una tabla no transaccional tras acceder a una transaccional dentro de la misma transacción" - + chi "语句不安全,因为它在访问同一事务中访问事务表后访问非事务性表" + eng "Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction" + spa "La sentencia no es segura porque accede a una tabla no transaccional tras acceder a una transaccional dentro de la misma transacción" ER_MESSAGE_AND_STATEMENT - eng "%s Statement: %s" - spa "%s Sentencia: %s" + chi "%s.语句:%s" + eng "%s. Statement: %s" + spa "%s. Sentencia: %s" ER_SLAVE_CONVERSION_FAILED - eng "Column %d of table '%-.192s.%-.192s' cannot be converted from type '%-.50s' to type '%-.50s'" - spa "La columna %d de la tabla '%-.192s.%-.192s' no puede ser convertida desde el tipo '%-.50s' al tipo '%-.50s'" + chi "列%d表'%-.192s.%-.192s'无法从'%-.50s'类型为'%-.50s'" + eng "Column %d of table '%-.192s.%-.192s' cannot be converted from type '%-.50s' to type '%-.50s'" + spa "La columna %d de la tabla '%-.192s.%-.192s' no puede ser convertida desde el tipo '%-.50s' al tipo '%-.50s'" ER_SLAVE_CANT_CREATE_CONVERSION - eng "Can't create conversion table for table '%-.192s.%-.192s'" - spa "No puedo crear tabla de conversión para la tabla '%-.192s.%-.192s'" + chi "无法为表创建转换表'%-.192s.%-.192s'" + eng "Can't create conversion table for table '%-.192s.%-.192s'" + spa "No puedo crear tabla de conversión para la tabla '%-.192s.%-.192s'" ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT - eng "Cannot modify @@session.binlog_format inside a transaction" - spa "No puedo modificar @@session.binlog_format dentro de una transacción" + chi "无法在事务中修改@@session.binlog_format" + eng "Cannot modify @@session.binlog_format inside a transaction" + spa "No puedo modificar @@session.binlog_format dentro de una transacción" ER_PATH_LENGTH - eng "The path specified for %.64T is too long" - hindi "%.64T के लिए निर्दिष्ट पथ बहुत लंबा है" - spa "La ruta especificada para %.64T es demasiado larga" + chi "指定%.64T的路径太长了" + eng "The path specified for %.64T is too long" + hindi "%.64T के लिए निर्दिष्ट पथ बहुत लंबा है" + spa "La ruta especificada para %.64T es demasiado larga" ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT - eng "'%s' is deprecated and will be removed in a future release" - ger "'%s' ist veraltet und wird in einer zukünftigen Version entfernt werden" - spa "'%s' está obsoleto y será quitada en una entrega futura" - + chi "'%s'被弃用,将在将来的版本中删除" + eng "'%s' is deprecated and will be removed in a future release" + ger "'%s' ist veraltet und wird in einer zukünftigen Version entfernt werden" + spa "'%s' está obsoleto y será quitada en una entrega futura" ER_WRONG_NATIVE_TABLE_STRUCTURE + chi "本机表'%-.64s'。'%-.64s'具有错误的结构" eng "Native table '%-.64s'.'%-.64s' has the wrong structure" spa "La tabla nativa '%-.64s'.'%-.64s' tiene una estructura equivocada" - ER_WRONG_PERFSCHEMA_USAGE + chi "performance_schema使用无效" eng "Invalid performance_schema usage" hindi "performance_schema का अवैध उपयोग" spa "Uso inválido de performance_schema" ER_WARN_I_S_SKIPPED_TABLE - eng "Table '%s'.'%s' was skipped since its definition is being modified by concurrent DDL statement" - spa "La tabla '%s'.'%s' fue saltada ya que su definición está siendo modificada por la sentencia DDL concurrente" - + chi "表'%s'.'%s'由于并发DDL语句正在修改其定义,因此跳过" + eng "Table '%s'.'%s' was skipped since its definition is being modified by concurrent DDL statement" + spa "La tabla '%s'.'%s' fue saltada ya que su definición está siendo modificada por la sentencia DDL concurrente" ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT - eng "Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction" - spa "No puedo modificar @@session.binlog_direct_non_transactional_updates dentro de una transacción" + chi "无法在交易事务中修改@@session.binlog_direct_non_transactional_updates" + eng "Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction" + spa "No puedo modificar @@session.binlog_direct_non_transactional_updates dentro de una transacción" ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT - eng "Cannot change the binlog direct flag inside a stored function or trigger" - spa "No puedo cambiar la bandera directa de binlog dentro de una función almacenada o de un disparador" + chi "无法在存储的函数或触发器内更改Binlog Direct标志" + eng "Cannot change the binlog direct flag inside a stored function or trigger" + spa "No puedo cambiar la bandera directa de binlog dentro de una función almacenada o de un disparador" ER_SPATIAL_MUST_HAVE_GEOM_COL 42000 - eng "A SPATIAL index may only contain a geometrical type column" - ger "Ein raumbezogener Index (SPATIAL) darf nur Spalten geometrischen Typs enthalten" - spa "Un índice SPATIAL sólo puede contener una columna de tipo geométrico" + chi "空间索引可以仅包含几何类型列" + eng "A SPATIAL index may only contain a geometrical type column" + ger "Ein raumbezogener Index (SPATIAL) darf nur Spalten geometrischen Typs enthalten" + spa "Un índice SPATIAL sólo puede contener una columna de tipo geométrico" ER_TOO_LONG_INDEX_COMMENT - eng "Comment for index '%-.64s' is too long (max = %lu)" - spa "El comentario para el índice '%-.64s' es demasiado largo (máx = %lu)" - + chi "索引评论'%-.64s'太长(max =%lu)" + eng "Comment for index '%-.64s' is too long (max = %lu)" + spa "El comentario para el índice '%-.64s' es demasiado largo (máx = %lu)" ER_LOCK_ABORTED - eng "Wait on a lock was aborted due to a pending exclusive lock" - spa "Se ha abortado la espera por un bloqueo debido a bloqueo exclusivo pendiente" - + chi "由于待处理的独家锁,等待锁被中止" + eng "Wait on a lock was aborted due to a pending exclusive lock" + spa "Se ha abortado la espera por un bloqueo debido a bloqueo exclusivo pendiente" ER_DATA_OUT_OF_RANGE 22003 - eng "%s value is out of range in '%s'" - spa "%s valor se encuentra fuera de rango '%s'" - + chi "%s值超出'%s'范围" + eng "%s value is out of range in '%s'" + spa "%s valor se encuentra fuera de rango '%s'" ER_WRONG_SPVAR_TYPE_IN_LIMIT - eng "A variable of a non-integer based type in LIMIT clause" - spa "Una variable de tipo basado en no entero en cláusula LIMIT" - + chi "基于非整数类型的基于LIMIT子句的变量" + eng "A variable of a non-integer based type in LIMIT clause" + spa "Una variable de tipo basado en no entero en cláusula LIMIT" ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE - eng "Mixing self-logging and non-self-logging engines in a statement is unsafe" - spa "No es segura la mezcla de motores de auto-historial (log) y de no auto-historial en una sentencia" - + chi "混合声明中的自记录和非自动记录引擎是不安全的" + eng "Mixing self-logging and non-self-logging engines in a statement is unsafe" + spa "No es segura la mezcla de motores de auto-historial (log) y de no auto-historial en una sentencia" ER_BINLOG_UNSAFE_MIXED_STATEMENT - eng "Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them" - spa "La sentencia accede a tabla no transaccional así como transaccional o tabla temporal y graba en cualquiera de ellas" - + chi "语句访问非致突变表以及事务性或临时表,并写入其中任何一个" + eng "Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them" + spa "La sentencia accede a tabla no transaccional así como transaccional o tabla temporal y graba en cualquiera de ellas" ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN - eng "Cannot modify @@session.sql_log_bin inside a transaction" - spa "No puedo modificar @@session.sql_log_bin dentro de una transacción" - + chi "无法修改事务中的@@sessient.sql_log_bin" + eng "Cannot modify @@session.sql_log_bin inside a transaction" + spa "No puedo modificar @@session.sql_log_bin dentro de una transacción" ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN - eng "Cannot change the sql_log_bin inside a stored function or trigger" - spa "No puedo cambiar sql_log_bin dentro de una función almacenada o disparador" - + chi "无法在存储的函数或触发器内更改SQL_LOG_BIN" + eng "Cannot change the sql_log_bin inside a stored function or trigger" + spa "No puedo cambiar sql_log_bin dentro de una función almacenada o disparador" ER_FAILED_READ_FROM_PAR_FILE - eng "Failed to read from the .par file" - hindi ".par फ़ाइल से पढ़ने में असफल रहे" - spa "No pude leer desde fichero/archivo .par" - swe "Misslyckades läsa från .par filen" - + chi "无法从.par文件中读取" + eng "Failed to read from the .par file" + hindi ".par फ़ाइल से पढ़ने में असफल रहे" + spa "No pude leer desde fichero/archivo .par" + swe "Misslyckades läsa från .par filen" ER_VALUES_IS_NOT_INT_TYPE_ERROR - eng "VALUES value for partition '%-.64s' must have type INT" - spa "El valor VALUES para la partición '%-.64s' debe de tener el tipo INT" - swe "Värden i VALUES för partition '%-.64s' måste ha typen INT" - + chi "分区的值'%-.64s'必须具有类型INT" + eng "VALUES value for partition '%-.64s' must have type INT" + spa "El valor VALUES para la partición '%-.64s' debe de tener el tipo INT" + swe "Värden i VALUES för partition '%-.64s' måste ha typen INT" ER_ACCESS_DENIED_NO_PASSWORD_ERROR 28000 + chi "拒绝用户'%s'@'%s'" cze "Přístup pro uživatele '%s'@'%s'" dan "Adgang nægtet bruger: '%s'@'%s'" - nla "Toegang geweigerd voor gebruiker: '%s'@'%s'" eng "Access denied for user '%s'@'%s'" est "Ligipääs keelatud kasutajale '%s'@'%s'" fre "Accès refusé pour l'utilisateur: '%s'@'%s'" @@ -6959,6 +7643,7 @@ ER_ACCESS_DENIED_NO_PASSWORD_ERROR 28000 hun "A(z) '%s'@'%s' felhasznalo szamara tiltott eleres" ita "Accesso non consentito per l'utente: '%s'@'%s'" kor "'%s'@'%s' 사용자는 접근이 거부 되었습니다." + nla "Toegang geweigerd voor gebruiker: '%s'@'%s'" nor "Tilgang nektet for bruker: '%s'@'%s'" norwegian-ny "Tilgang ikke tillate for brukar: '%s'@'%s'" por "Acesso negado para o usuário '%s'@'%s'" @@ -6971,1057 +7656,1310 @@ ER_ACCESS_DENIED_NO_PASSWORD_ERROR 28000 ukr "Доступ заборонено для користувача: '%s'@'%s'" ER_SET_PASSWORD_AUTH_PLUGIN + chi "通过%s插件验证的用户忽略SET PASSWORD" eng "SET PASSWORD is ignored for users authenticating via %s plugin" spa "SET PASSWORD no tiene significado para usuarios que se autentican vía enchufe (plugin) %s" ER_GRANT_PLUGIN_USER_EXISTS + chi "由于用户%-.*s已经存在,GRANT IDENTIFIED WITH授权是非法的" eng "GRANT with IDENTIFIED WITH is illegal because the user %-.*s already exists" spa "GRANT con IDENTIFIED WITH es ilegal porque el usuario %-.*s ya existe" ER_TRUNCATE_ILLEGAL_FK 42000 - eng "Cannot truncate a table referenced in a foreign key constraint (%.192s)" - spa "No puedo truncar una tabla referenciada en una restricción de clave foránea (%.192s)" + chi "无法截断外键约束中引用的表(%.192s)" + eng "Cannot truncate a table referenced in a foreign key constraint (%.192s)" + spa "No puedo truncar una tabla referenciada en una restricción de clave foránea (%.192s)" ER_PLUGIN_IS_PERMANENT - eng "Plugin '%s' is force_plus_permanent and can not be unloaded" - spa "El enchufe (plugin) '%s' está force_plus_permanent y no puede ser descargado" + chi "插件'%s'是force_plus_permanent,无法卸载" + eng "Plugin '%s' is force_plus_permanent and can not be unloaded" + spa "El enchufe (plugin) '%s' está force_plus_permanent y no puede ser descargado" ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN - eng "The requested value for the heartbeat period is less than 1 millisecond. The value is reset to 0, meaning that heartbeating will effectively be disabled" - spa "El valor de requerimiento para el período de latido es menor de 1 milisegundo. El valor se vuelve a poner a 0, indicando que el latido será efectivamente desactivado" + chi "心跳期的要求值小于1毫秒。该值重置为0,这意味着心跳将有效地禁用" + eng "The requested value for the heartbeat period is less than 1 millisecond. The value is reset to 0, meaning that heartbeating will effectively be disabled" + spa "El valor de requerimiento para el período de latido es menor de 1 milisegundo. El valor se vuelve a poner a 0, indicando que el latido será efectivamente desactivado" ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX - eng "The requested value for the heartbeat period exceeds the value of `slave_net_timeout' seconds. A sensible value for the period should be less than the timeout" - spa "El valor de requerimiento para el período de latido excede el valor de `slave_net_timeout` segundos. Un valor sensible para el período debería de ser menor que el 'tiempo agotado'" + chi "心跳期的请求值超出了“slave_net_timeout”秒的值。该期间的明智价值应小于超时" + eng "The requested value for the heartbeat period exceeds the value of `slave_net_timeout' seconds. A sensible value for the period should be less than the timeout" + spa "El valor de requerimiento para el período de latido excede el valor de `slave_net_timeout` segundos. Un valor sensible para el período debería de ser menor que el 'tiempo agotado'" ER_STMT_CACHE_FULL + chi "需要多行语句超过“max_binlog_stmt_cache_size”字节的存储;增加这个mariadbd变量,然后重试" eng "Multi-row statements required more than 'max_binlog_stmt_cache_size' bytes of storage." spa "Las sentencias Multi-fila requieren de más de 'max_binlog_stmt_cache_size' bytes para almacenaje." ER_MULTI_UPDATE_KEY_CONFLICT - eng "Primary key/partition key update is not allowed since the table is updated both as '%-.192s' and '%-.192s'" - spa "La actualización de clave primaria de o de partición no está permitida por estar la tabla actualizada como '%-.192s' y '%-.192s'" - + chi "由于表格被更新为'%-.192s'和'%-.192s',因此不允许允许主键/分区索引更新。" + eng "Primary key/partition key update is not allowed since the table is updated both as '%-.192s' and '%-.192s'" + spa "La actualización de clave primaria de o de partición no está permitida por estar la tabla actualizada como '%-.192s' y '%-.192s'" # When translating this error message make sure to include "ALTER TABLE" in the # message as mariadb-check parses the error message looking for ALTER TABLE. ER_TABLE_NEEDS_REBUILD + chi "表需重建。请做ALTER TABLE %`s FORCE”或转储/重新加载以修复它!" eng "Table rebuild required. Please do \"ALTER TABLE %`s FORCE\" or dump/reload to fix it!" spa "Se requiere reconstrucción de la tabla. Por favor, ¡haga un \"ALTER TABLE %`s FORCE\" o volcado/recarga para solucionarlo!" WARN_OPTION_BELOW_LIMIT - eng "The value of '%s' should be no less than the value of '%s'" - spa "El valor de '%s' debería de ser no menor que el valor de '%s'" + chi "'%s'的值应该不小于'%s'的值" + eng "The value of '%s' should be no less than the value of '%s'" + spa "El valor de '%s' debería de ser no menor que el valor de '%s'" ER_INDEX_COLUMN_TOO_LONG - eng "Index column size too large. The maximum column size is %lu bytes" - spa "El tamaño de índice de columna es demasiado grande. El tamaño máximo de columna es de %lu bytes" + chi "索引列太大。最大列大小为%lu字节" + eng "Index column size too large. The maximum column size is %lu bytes" + spa "El tamaño de índice de columna es demasiado grande. El tamaño máximo de columna es de %lu bytes" ER_ERROR_IN_TRIGGER_BODY - eng "Trigger '%-.64s' has an error in its body: '%-.256s'" - spa "El disparador '%-.64s' tiene una error en su cuerpo: '%-.256s'" + chi "触发器'%-.64s'内存在错误:'%-.256s'" + eng "Trigger '%-.64s' has an error in its body: '%-.256s'" + spa "El disparador '%-.64s' tiene una error en su cuerpo: '%-.256s'" ER_ERROR_IN_UNKNOWN_TRIGGER_BODY - eng "Unknown trigger has an error in its body: '%-.256s'" - spa "El disparador desconocido tiene un error en su cuerpo: '%-.256s'" + chi "未知触发器内存在错误:'%-.256s'" + eng "Unknown trigger has an error in its body: '%-.256s'" + spa "El disparador desconocido tiene un error en su cuerpo: '%-.256s'" ER_INDEX_CORRUPT - eng "Index %s is corrupted" - spa "El índice %s está estropeado" + chi "索引%s已损坏" + eng "Index %s is corrupted" + spa "El índice %s está estropeado" ER_UNDO_RECORD_TOO_BIG - eng "Undo log record is too big" - spa "El registro de historial (log) para deshacer es demasiado grande" + chi "撤消日志记录太大" + eng "Undo log record is too big" + spa "El registro de historial (log) para deshacer es demasiado grande" ER_BINLOG_UNSAFE_INSERT_IGNORE_SELECT - eng "INSERT IGNORE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave" - spa "INSERT IGNORE... SELECT es no seguro porque el orden en el que las filas se recuperan por el SELECT determina qué filas (si hay alguna) son ignoradas. Este orden no puede ser predicho y puede diferir entre maestro (master) y esclavo" + chi "INSERT IGNORE...SELECT不安全,因为选择由select检索行的顺序确定哪个(如果有)行被忽略。无法预测此顺序,并且在master和slave方面可能有所不同" + eng "INSERT IGNORE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave" + spa "INSERT IGNORE... SELECT es no seguro porque el orden en el que las filas se recuperan por el SELECT determina qué filas (si hay alguna) son ignoradas. Este orden no puede ser predicho y puede diferir entre maestro (master) y esclavo" ER_BINLOG_UNSAFE_INSERT_SELECT_UPDATE - eng "INSERT... SELECT... ON DUPLICATE KEY UPDATE is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are updated. This order cannot be predicted and may differ on master and the slave" - spa "INSERT... SELECT... ON DUPLICATE KEY UPDATE no es seguro porque el orden en el que las filas se recuperan por el SELECT determina qué filas (si hay alguna) son actualizadas. Este orden no puede ser predicho y puede diferir entre maestro (master) y esclavo" + chi "INSERT... SELECT... ON DUPLICATE KEY UPDATE是不安全的,因为SELECT检索行的顺序确定哪个(如果有的话)是更新的。无法预测此顺序,并且在master和slave方面可能有所不同" + eng "INSERT... SELECT... ON DUPLICATE KEY UPDATE is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are updated. This order cannot be predicted and may differ on master and the slave" + spa "INSERT... SELECT... ON DUPLICATE KEY UPDATE no es seguro porque el orden en el que las filas se recuperan por el SELECT determina qué filas (si hay alguna) son actualizadas. Este orden no puede ser predicho y puede diferir entre maestro (master) y esclavo" ER_BINLOG_UNSAFE_REPLACE_SELECT - eng "REPLACE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave" - spa "REPLACE... SELECT no es seguro porque el orden en el que las filas se recuperan por el SELECT determina qué filas (si hay alguna) son sustituidas. Este orden no puede ser predicho y puede diferir entre maestro (master) y esclavo" + chi "REPLACE... SELECT 不安全,因为选择由select检索行的顺序确定哪个(如果有)行被替换。无法预测此顺序,并且在master和slave方面可能有所不同" + eng "REPLACE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave" + spa "REPLACE... SELECT no es seguro porque el orden en el que las filas se recuperan por el SELECT determina qué filas (si hay alguna) son sustituidas. Este orden no puede ser predicho y puede diferir entre maestro (master) y esclavo" ER_BINLOG_UNSAFE_CREATE_IGNORE_SELECT - eng "CREATE... IGNORE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave" - spa "CREATE... IGNORE SELECT no es seguro porque el orden en el que las filas se recuperan por el SELECT determina qué filas (si hay alguna) son ignoradas. Este orden no puede ser predicho y puede diferir entre maestro (master) y esclavo" + chi "CREATE... IGNORE SELECT是不安全,因为选择由SELECT检索行的顺序确定哪个(如果有)行被忽略。无法预测此顺序,并且在master和slave方面可能有所不同" + eng "CREATE... IGNORE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave" + spa "CREATE... IGNORE SELECT no es seguro porque el orden en el que las filas se recuperan por el SELECT determina qué filas (si hay alguna) son ignoradas. Este orden no puede ser predicho y puede diferir entre maestro (master) y esclavo" ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT - eng "CREATE... REPLACE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave" - spa "CREATE... REPLACE SELECT no es seguro porque el orden en el que las filas se recuperan por el SELECT determina qué filas (si hay alguna) son sustituidas. Este orden no puede ser predicho y puede diferir entre maestro (master) y esclavo" + chi "CREATE... REPLACE SELECT不安全,因为选择由SELECT检索行的顺序确定哪个(如果有)是替换哪个(如果有的话)。无法预测此顺序,并且在master和slave方面可能有所不同" + eng "CREATE... REPLACE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave" + spa "CREATE... REPLACE SELECT no es seguro porque el orden en el que las filas se recuperan por el SELECT determina qué filas (si hay alguna) son sustituidas. Este orden no puede ser predicho y puede diferir entre maestro (master) y esclavo" ER_BINLOG_UNSAFE_UPDATE_IGNORE - eng "UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave" - spa "UPDATE IGNORE no es seguro porque el orden en el que las filas son actualizadas determina qué filas (si hay alguna) son ignoradas. Este orden no puede ser predicho y puede diferir entre maestro (master) y esclavo" + chi "UPDATE IGNORE不安全,因为更新行的顺序确定了哪个(如果有)行被忽略。无法预测此顺序,并且在master和slave方面可能有所不同" + eng "UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave" + spa "UPDATE IGNORE no es seguro porque el orden en el que las filas son actualizadas determina qué filas (si hay alguna) son ignoradas. Este orden no puede ser predicho y puede diferir entre maestro (master) y esclavo" ER_UNUSED_15 - eng "You should never see it" - spa "Nunca debería vd de ver esto" + chi "你永远不应该看到它" + eng "You should never see it" + spa "Nunca debería vd de ver esto" ER_UNUSED_16 - eng "You should never see it" - spa "Nunca debería vd de ver esto" + chi "你永远不应该看到它" + eng "You should never see it" + spa "Nunca debería vd de ver esto" ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT - eng "Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave" - spa "Las sentencias que graban en una tabla con columna de auto-incremento tras seleccionar desde otra tabla no son seguras porque el orden en el que las filas son recuperadas determina qué filas (si hay alguna) serán grabadas. Este orden no puede ser predicho y puede diferir entre maestro (master) y esclavo" + chi "从另一个表选择后,使用自动增量列的表格写入的语句是不安全的,因为检索行的顺序确定将写入哪些(如果有)行。无法预测此顺序,并且在主站和slave方面可能有所不同" + eng "Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave" + spa "Las sentencias que graban en una tabla con columna de auto-incremento tras seleccionar desde otra tabla no son seguras porque el orden en el que las filas son recuperadas determina qué filas (si hay alguna) serán grabadas. Este orden no puede ser predicho y puede diferir entre maestro (master) y esclavo" ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC - eng "CREATE TABLE... SELECT... on a table with an auto-increment column is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are inserted. This order cannot be predicted and may differ on master and the slave" - spa "CREATE TABKE... SELECT... en una tabla con columna de auto-incremento no es segura porque el orden en el que las filas son recuperadas por el SELECT determina qué filas (si hay alguna) serán insertadas. Este orden no puede ser predicho y puede diferir entre maestro (master) y esclavo" + chi "创建表...在具有自动增量列的表上选择...不安全,因为选择的顺序是由select检索行的顺序,确定插入哪个(如果有)行。无法预测此订单,并且在主站和slave方面可能有所不同" + eng "CREATE TABLE... SELECT... on a table with an auto-increment column is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are inserted. This order cannot be predicted and may differ on master and the slave" + spa "CREATE TABLE... SELECT... en una tabla con columna de auto-incremento no es segura porque el orden en el que las filas son recuperadas por el SELECT determina qué filas (si hay alguna) serán insertadas. Este orden no puede ser predicho y puede diferir entre maestro (master) y esclavo" ER_BINLOG_UNSAFE_INSERT_TWO_KEYS - eng "INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe" - spa "INSERT... ON DUPLICATE KEY UPDATE en una tabla con más de una UNIQUE KEY no es segura" + chi "在具有多个唯一键的表上INSERT... ON DUPLICATE KEY UPDATE的重复索引更新是不安全的" + eng "INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe" + spa "INSERT... ON DUPLICATE KEY UPDATE en una tabla con más de una UNIQUE KEY no es segura" ER_UNUSED_28 - eng "You should never see it" - spa "Nunca debería vd de ver esto" + chi "你永远不应该看到它" + eng "You should never see it" + spa "Nunca debería vd de ver esto" -ER_UNUSED_1 - eng "You should never see it" - spa "Nunca debería vd de ver esto" +ER_VERS_NOT_ALLOWED + chi "系统版本的表%`s.%`s不允许" + eng "Not allowed for system-versioned table %`s.%`s" ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST - eng "INSERT into autoincrement field which is not the first part in the composed primary key is unsafe" - spa "INSERT dentro de campo con autoincremento que no es la primera parte en la clave primaria compuesta no es seguro" - + chi "插入AutoIncrement字段,该字段不是组成的主键中的第一部分是不安全的" + eng "INSERT into autoincrement field which is not the first part in the composed primary key is unsafe" + spa "INSERT dentro de campo con autoincremento que no es la primera parte en la clave primaria compuesta no es seguro" # # End of 5.5 error messages. # ER_CANNOT_LOAD_FROM_TABLE_V2 - eng "Cannot load from %s.%s. The table is probably corrupted" - ger "Kann %s.%s nicht einlesen. Tabelle ist wahrscheinlich beschädigt" - spa "No puedo cargar desde %s.%s. La tabla está probablemente estropeada" + chi "不能从加载%s.%s。表可能损坏了" + eng "Cannot load from %s.%s. The table is probably corrupted" + ger "Kann %s.%s nicht einlesen. Tabelle ist wahrscheinlich beschädigt" + spa "No puedo cargar desde %s.%s. La tabla está probablemente estropeada" ER_MASTER_DELAY_VALUE_OUT_OF_RANGE - eng "The requested value %lu for the master delay exceeds the maximum %lu" - spa "El valor requerido %lu para retraso en maestro (master) excede el máximo de %lu" + chi "主延迟的所需值%lu超过最大%lu" + eng "The requested value %lu for the master delay exceeds the maximum %lu" + spa "El valor requerido %lu para retraso en maestro (master) excede el máximo de %lu" ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT - eng "Only Format_description_log_event and row events are allowed in BINLOG statements (but %s was provided)" - spa "Sólo se permiten Format_description_log_event y eventos de fila en sentencias BINLOG (pero %s fue suministrado)" + chi "在Binlog语句中只允许Format_Description_Log_Event和行事件(但是提供了%s)" + eng "Only Format_description_log_event and row events are allowed in BINLOG statements (but %s was provided)" + spa "Sólo se permiten Format_description_log_event y eventos de fila en sentencias BINLOG (pero %s fue suministrado)" ER_PARTITION_EXCHANGE_DIFFERENT_OPTION - eng "Non matching attribute '%-.64s' between partition and table" - spa "Atributo no coincidente '%-.64s' entre la partición y la tabla" - swe "Attributet '%-.64s' är olika mellan partition och tabell" + chi "分区和表之间的非匹配属性'%-.64s'" + eng "Non matching attribute '%-.64s' between partition and table" + spa "Atributo no coincidente '%-.64s' entre la partición y la tabla" + swe "Attributet '%-.64s' är olika mellan partition och tabell" ER_PARTITION_EXCHANGE_PART_TABLE - eng "Table to exchange with partition is partitioned: '%-.64s'" - spa "La tabla para intercambiar con la partición está particionada: '%-.64s'" - swe "Tabellen att byta ut mot partition är partitionerad: '%-.64s'" + chi "用分区交换的表是分区:'%-.64s'" + eng "Table to exchange with partition is partitioned: '%-.64s'" + spa "La tabla para intercambiar con la partición está particionada: '%-.64s'" + swe "Tabellen att byta ut mot partition är partitionerad: '%-.64s'" ER_PARTITION_EXCHANGE_TEMP_TABLE - eng "Table to exchange with partition is temporary: '%-.64s'" - spa "La tabla para intercambiar con la partición es temporal: '%-.64s'" - swe "Tabellen att byta ut mot partition är temporär: '%-.64s'" + chi "与分区交换的表是临时的:'%-.64s'" + eng "Table to exchange with partition is temporary: '%-.64s'" + spa "La tabla para intercambiar con la partición es temporal: '%-.64s'" + swe "Tabellen att byta ut mot partition är temporär: '%-.64s'" ER_PARTITION_INSTEAD_OF_SUBPARTITION - eng "Subpartitioned table, use subpartition instead of partition" - spa "La tabla subparticionada utiliza subpartición en lugar de partición" - swe "Subpartitionerad tabell, använd subpartition istället för partition" + chi "子分区表,使用子分区代替分区" + eng "Subpartitioned table, use subpartition instead of partition" + spa "La tabla subparticionada utiliza subpartición en lugar de partición" + swe "Subpartitionerad tabell, använd subpartition istället för partition" ER_UNKNOWN_PARTITION - eng "Unknown partition '%-.64s' in table '%-.64s'" - spa "Partición desconocida '%-.64s' en la tabla '%-.64s'" - swe "Okänd partition '%-.64s' i tabell '%-.64s'" + chi "未知分区'%-.64s'在表'%-.64s'" + eng "Unknown partition '%-.64s' in table '%-.64s'" + spa "Partición desconocida '%-.64s' en la tabla '%-.64s'" + swe "Okänd partition '%-.64s' i tabell '%-.64s'" ER_TABLES_DIFFERENT_METADATA - eng "Tables have different definitions" - spa "Las tablas tienen diferentes definiciones" - swe "Tabellerna har olika definitioner" + chi "表有不同的定义" + eng "Tables have different definitions" + spa "Las tablas tienen diferentes definiciones" + swe "Tabellerna har olika definitioner" ER_ROW_DOES_NOT_MATCH_PARTITION - eng "Found a row that does not match the partition" - spa "Hallada una fila que no coincide con la partición" - swe "Hittade en rad som inte passar i partitionen" + chi "找到了与分区不匹配的行" + eng "Found a row that does not match the partition" + spa "Hallada una fila que no coincide con la partición" + swe "Hittade en rad som inte passar i partitionen" ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX - eng "Option binlog_cache_size (%lu) is greater than max_binlog_cache_size (%lu); setting binlog_cache_size equal to max_binlog_cache_size" - spa "La opción binlog_cache_size (%lu) es mayor que max_binlog_cache_size (%lu); configurando binlog_cache_size igual a max_binlog_cache_size" + chi "选项binlog_cache_size(%lu)大于max_binlog_cache_size(%lu);设置binlog_cache_size等于max_binlog_cache_size" + eng "Option binlog_cache_size (%lu) is greater than max_binlog_cache_size (%lu); setting binlog_cache_size equal to max_binlog_cache_size" + spa "La opción binlog_cache_size (%lu) es mayor que max_binlog_cache_size (%lu); configurando binlog_cache_size igual a max_binlog_cache_size" ER_WARN_INDEX_NOT_APPLICABLE - eng "Cannot use %-.64s access on index '%-.64s' due to type or collation conversion on field '%-.64s'" - spa "No puedo usar acceso %-.64s en índice '%-.64s' debido al tipo o conversión de cotejo en campo '%-.64s'" + chi "不能使用%-.64s在索引'%-.64s'上的访问,由于字段'%-.64s”的类型或排序规则转换" + eng "Cannot use %-.64s access on index '%-.64s' due to type or collation conversion on field '%-.64s'" + spa "No puedo usar acceso %-.64s en índice '%-.64s' debido al tipo o conversión de cotejo en campo '%-.64s'" ER_PARTITION_EXCHANGE_FOREIGN_KEY - eng "Table to exchange with partition has foreign key references: '%-.64s'" - spa "La tabla para intercambiar con la partición tiene referencias a clave foránea: '%-.64s'" - swe "Tabellen att byta ut mot partition har foreign key referenser: '%-.64s'" + chi "与分区交换的表具有外键参考:'%-.64s'" + eng "Table to exchange with partition has foreign key references: '%-.64s'" + spa "La tabla para intercambiar con la partición tiene referencias a clave foránea: '%-.64s'" + swe "Tabellen att byta ut mot partition har foreign key referenser: '%-.64s'" ER_NO_SUCH_KEY_VALUE - eng "Key value '%-.192s' was not found in table '%-.192s.%-.192s'" - spa "Valor de clave '%-.192s' no hallado en la tabla '%-.192s.%-.192s'" + chi "键值'%-.192s'在表'%-.192s%-.192s'不存在" + eng "Key value '%-.192s' was not found in table '%-.192s.%-.192s'" + spa "Valor de clave '%-.192s' no hallado en la tabla '%-.192s.%-.192s'" ER_VALUE_TOO_LONG - eng "Too long value for '%s'" - spa "Valor demasiado largo para '%s'" + chi "'%s'的价值太长了" + eng "Too long value for '%s'" + spa "Valor demasiado largo para '%s'" ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE - eng "Replication event checksum verification failed while reading from network" - spa "Ha fallado la verificación de la suma de revisión de evento de réplica mientras se leía desde la red" + chi "从网络读取时,复制事件校验和验证失败" + eng "Replication event checksum verification failed while reading from network" + spa "Ha fallado la verificación de la suma de revisión de evento de réplica mientras se leía desde la red" ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE - eng "Replication event checksum verification failed while reading from a log file" - spa "Ha fallado la verificación de la suma de revisión de evento de réplica mientras se leía desde fichero/archivo de historial (log)" + chi "从日志文件读取时复制事件校验和验证失败" + eng "Replication event checksum verification failed while reading from a log file" + spa "Ha fallado la verificación de la suma de revisión de evento de réplica mientras se leía desde fichero/archivo de historial (log)" ER_BINLOG_STMT_CACHE_SIZE_GREATER_THAN_MAX - eng "Option binlog_stmt_cache_size (%lu) is greater than max_binlog_stmt_cache_size (%lu); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size" - spa "La opción binlog_stmt_cache_size (%lu) es mayor que max_binlog_stmt_cache_size (%lu); configurando binlog_stmt_cache_size igual a max_binlog_stmt_cache_size" + chi "选项binlog_stmt_cache_size(%lu)大于max_binlog_stmt_cache_size(%lu);设置binlog_stmt_cache_size等于max_binlog_stmt_cache_size" + eng "Option binlog_stmt_cache_size (%lu) is greater than max_binlog_stmt_cache_size (%lu); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size" + spa "La opción binlog_stmt_cache_size (%lu) es mayor que max_binlog_stmt_cache_size (%lu); configurando binlog_stmt_cache_size igual a max_binlog_stmt_cache_size" ER_CANT_UPDATE_TABLE_IN_CREATE_TABLE_SELECT - eng "Can't update table '%-.192s' while '%-.192s' is being created" - spa "No puedo actualizar tabla '%-.192s' mientras '%-.192s' está siendo creada" + chi "无法更新表'%-.192s'正在创建'%-.192s'" + eng "Can't update table '%-.192s' while '%-.192s' is being created" + spa "No puedo actualizar tabla '%-.192s' mientras '%-.192s' está siendo creada" ER_PARTITION_CLAUSE_ON_NONPARTITIONED - eng "PARTITION () clause on non partitioned table" - spa "Cláusula PARTITION () en tabla no particionada" - swe "PARTITION () klausul för en icke partitionerad tabell" + chi "非分区表上的PARTITION()子句" + eng "PARTITION () clause on non partitioned table" + spa "Cláusula PARTITION () en tabla no particionada" + swe "PARTITION () klausul för en icke partitionerad tabell" ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET - eng "Found a row not matching the given partition set" - spa "Hallada una fila que no coincide con el conjunto dado de partición" - swe "Hittade en rad som inte passar i någon given partition" + chi "发现不匹配给定分区集的行" + eng "Found a row not matching the given partition set" + spa "Hallada una fila que no coincide con el conjunto dado de partición" + swe "Hittade en rad som inte passar i någon given partition" ER_UNUSED_5 - eng "You should never see it" - spa "Nunca debería vd de ver esto" + chi "你永远不应该看到它" + eng "You should never see it" + spa "Nunca debería vd de ver esto" ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE - eng "Failure while changing the type of replication repository: %s" - spa "Fallo mientras cambiaba el tipo de repositorio de réplica: %s" + chi "更改Replication存储库类型时失败:%s" + eng "Failure while changing the type of replication repository: %s" + spa "Fallo mientras cambiaba el tipo de repositorio de réplica: %s" ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_CREATED_TEMP_TABLE - eng "The creation of some temporary tables could not be rolled back" - spa "La creación de algunas tablas temporales no se pudo retroceder (rolled back)" + chi "无法回滚一些临时表的创建" + eng "The creation of some temporary tables could not be rolled back" + spa "La creación de algunas tablas temporales no se pudo retroceder (ROLLBACK)" ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_DROPPED_TEMP_TABLE - eng "Some temporary tables were dropped, but these operations could not be rolled back" - spa "Algunas tablas temporales fueron eliminadas, pero estas operaciones no se pudieron retroceder (rolled back)" + chi "一些临时表被删除,但这些操作无法回滚" + eng "Some temporary tables were dropped, but these operations could not be rolled back" + spa "Algunas tablas temporales fueron eliminadas, pero estas operaciones no se pudieron retroceder (ROLLBACK)" ER_MTS_FEATURE_IS_NOT_SUPPORTED - eng "%s is not supported in multi-threaded slave mode. %s" - spa "%s no se soporta en modo esclavo multi-hilo (thread). %s" + chi "%s不支持多线程从模式。%s." + eng "%s is not supported in multi-threaded slave mode. %s" + spa "%s no se soporta en modo esclavo multi-hilo (thread). %s" ER_MTS_UPDATED_DBS_GREATER_MAX - eng "The number of modified databases exceeds the maximum %d; the database names will not be included in the replication event metadata" - spa "El núermo de bases de datos modificadas excede el máximo de %d; los nombres de base de datos no serán incluidos en los metadatos de eventos de réplica" + chi "修改的数据库的数量超过了最大%d;数据库名称不会包含在Replication事件元数据中" + eng "The number of modified databases exceeds the maximum %d; the database names will not be included in the replication event metadata" + spa "El núermo de bases de datos modificadas excede el máximo de %d; los nombres de base de datos no serán incluidos en los metadatos de eventos de réplica" ER_MTS_CANT_PARALLEL - eng "Cannot execute the current event group in the parallel mode. Encountered event %s, relay-log name %s, position %s which prevents execution of this event group in parallel mode. Reason: %s" - spa "No puedo ejecutar el grupo de eventos actual en modo paralelo. Encontrado evento %s, nombre de historial (log) de reenvío %s, posición %s que previene la ejecución de este grupo de eventos en modo paralelo. Motivo: %s" + chi "无法以并行模式执行当前事件组。遇到事件%s,中继日志名称%s,position%s,它防止并行模式执行此事件组。原因:%s" + eng "Cannot execute the current event group in the parallel mode. Encountered event %s, relay-log name %s, position %s which prevents execution of this event group in parallel mode. Reason: %s" + spa "No puedo ejecutar el grupo de eventos actual en modo paralelo. Encontrado evento %s, nombre de historial (log) de reenvío %s, posición %s que previene la ejecución de este grupo de eventos en modo paralelo. Motivo: %s" ER_MTS_INCONSISTENT_DATA - eng "%s" + eng "%s" ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING - eng "FULLTEXT index is not supported for partitioned tables" - spa "El índice FULLTEXT no está soportado para tablas particionadas" - swe "FULLTEXT index stöds ej för partitionerade tabeller" + chi "分区表不支持FullText索引" + eng "FULLTEXT index is not supported for partitioned tables" + spa "El índice FULLTEXT no está soportado para tablas particionadas" + swe "FULLTEXT index stöds ej för partitionerade tabeller" ER_DA_INVALID_CONDITION_NUMBER 35000 - eng "Invalid condition number" - por "Número de condição inválido" - spa "Número inválido de condición" + chi "无效条件号" + eng "Invalid condition number" + por "Número de condição inválido" + spa "Número inválido de condición" ER_INSECURE_PLAIN_TEXT - eng "Sending passwords in plain text without SSL/TLS is extremely insecure" - spa "Enviar contraseñas en texto plano sin SSL/TLS es extremadamente inseguro" + chi "在没有SSL/TLS的纯文本中发送密码非常不安全" + eng "Sending passwords in plain text without SSL/TLS is extremely insecure" + spa "Enviar contraseñas en texto plano sin SSL/TLS es extremadamente inseguro" ER_INSECURE_CHANGE_MASTER - eng "Storing MariaDB user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MariaDB Manual for more about this issue and possible alternatives" - spa "Almacenar nombre de usuario de MariaDB o información de contraseña en el repositorio master.info no es seguro y por ello no se recomienda. Por favor, mira el manual de MariaDB para saber más acerca de este asunto y sus posibles alternativas" + chi "在Master.Info存储库中存储MariaDB用户名或密码信息不安全,因此不建议使用。有关此问题和可能的替代方案,请参阅MariaDB手册" + eng "Storing MariaDB user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MariaDB Manual for more about this issue and possible alternatives" + spa "Almacenar nombre de usuario de MariaDB o información de contraseña en el repositorio master.info no es seguro y por ello no se recomienda. Por favor, mira el manual de MariaDB para saber más acerca de este asunto y sus posibles alternativas" ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO 23000 S1009 + chi "表'%.192s'的外键约束,记录'%-.192s'会导致表'%.192s'中的重复条目,键'%.192s'" eng "Foreign key constraint for table '%.192s', record '%-.192s' would lead to a duplicate entry in table '%.192s', key '%.192s'" ger "Fremdschlüssel-Beschränkung für Tabelle '%.192s', Datensatz '%-.192s' würde zu einem doppelten Eintrag in Tabelle '%.192s', Schlüssel '%.192s' führen" spa "La restricción de clave foránea para tabla '%.192s', registro '%-.192s' llevaría a una entrada duplicada en la tabla '%.192s', clave '%.192s'" swe "FOREIGN KEY constraint för tabell '%.192s', posten '%-.192s' kan inte uppdatera barntabell '%.192s' på grund av nyckel '%.192s'" ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO 23000 S1009 + chi "表'%.192s'的外键约束,记录'%-.192s'会导致子表中的重复条目" eng "Foreign key constraint for table '%.192s', record '%-.192s' would lead to a duplicate entry in a child table" ger "Fremdschlüssel-Beschränkung für Tabelle '%.192s', Datensatz '%-.192s' würde zu einem doppelten Eintrag in einer Kind-Tabelle führen" spa "La restricción de clave foránea para tabla '%.192s', registro '%-.192s' llevaría a una entrada duplicada en una tabla hija" swe "FOREIGN KEY constraint för tabell '%.192s', posten '%-.192s' kan inte uppdatera en barntabell på grund av UNIQUE-test" ER_SQLTHREAD_WITH_SECURE_SLAVE - eng "Setting authentication options is not possible when only the Slave SQL Thread is being started" - spa "Configurar opciones de autenticación no es posible si sólo se ha arrancado el Hilo (thread) SQL Esclavo" + chi "仅在启动从SQL线程时无法设置身份验证选项" + eng "Setting authentication options is not possible when only the Slave SQL Thread is being started" + spa "Configurar opciones de autenticación no es posible si sólo se ha arrancado el Hilo (thread) SQL Esclavo" ER_TABLE_HAS_NO_FT - eng "The table does not have FULLTEXT index to support this query" - spa "La tabla no tiene índice FULLTEXT que soporte esta consulta (query)" + chi "该表没有全文索引来支持此查询" + eng "The table does not have FULLTEXT index to support this query" + spa "La tabla no tiene índice FULLTEXT que soporte esta consulta (query)" ER_VARIABLE_NOT_SETTABLE_IN_SF_OR_TRIGGER - eng "The system variable %.200s cannot be set in stored functions or triggers" - spa "La variable de sistema %.200s no se puede poner en funciones almacenadas o disparadores" + chi "无法在存储的函数或触发器中设置系统变量%.200s" + eng "The system variable %.200s cannot be set in stored functions or triggers" + spa "La variable de sistema %.200s no se puede poner en funciones almacenadas o disparadores" ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION - eng "The system variable %.200s cannot be set when there is an ongoing transaction" - spa "La variable de sistema %.200s no se puede poner si hay una transacción en curso" + chi "持续交易时,无法设置系统变量%.200s" + eng "The system variable %.200s cannot be set when there is an ongoing transaction" + spa "La variable de sistema %.200s no se puede poner si hay una transacción en curso" ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST - eng "The system variable @@SESSION.GTID_NEXT has the value %.200s, which is not listed in @@SESSION.GTID_NEXT_LIST" - spa "La variable de sistema @@SESSION.GTID_NEXT tiene el valor %.200s, el cual no está listado en @@SESSION.GTID_NEXT_LIST" + chi "系统变量@@session.gtid_next具有值%.200s,该值未在@@session.gtid_next_list中列出" + eng "The system variable @@SESSION.GTID_NEXT has the value %.200s, which is not listed in @@SESSION.GTID_NEXT_LIST" + spa "La variable de sistema @@SESSION.GTID_NEXT tiene el valor %.200s, el cual no está listado en @@SESSION.GTID_NEXT_LIST" ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION_WHEN_GTID_NEXT_LIST_IS_NULL - eng "When @@SESSION.GTID_NEXT_LIST == NULL, the system variable @@SESSION.GTID_NEXT cannot change inside a transaction" - spa "Cuando @@SESSION.GTID_NEXT_LIST == NULL, la variable de sistema @@SESSION.GTID_NEXT no puede cambiar dentro de una transacción" + chi "当@@session.gtid_next_list == null时,系统变量@@session.gtid_next无法在事务内更改" + eng "When @@SESSION.GTID_NEXT_LIST == NULL, the system variable @@SESSION.GTID_NEXT cannot change inside a transaction" + spa "Cuando @@SESSION.GTID_NEXT_LIST == NULL, la variable de sistema @@SESSION.GTID_NEXT no puede cambiar dentro de una transacción" ER_SET_STATEMENT_CANNOT_INVOKE_FUNCTION - eng "The statement 'SET %.200s' cannot invoke a stored function" - spa "La sentencia 'SET %.200s' no puede invocar una función almacenada" + chi "语句'SET %.200s'无法调用存储的函数" + eng "The statement 'SET %.200s' cannot invoke a stored function" + spa "La sentencia 'SET %.200s' no puede invocar una función almacenada" ER_GTID_NEXT_CANT_BE_AUTOMATIC_IF_GTID_NEXT_LIST_IS_NON_NULL - eng "The system variable @@SESSION.GTID_NEXT cannot be 'AUTOMATIC' when @@SESSION.GTID_NEXT_LIST is non-NULL" - spa "La variable de sistema @@SESSION.GTID_NEXT no puede ser 'AUTOMATIC' si la @@SESSION.GTID_NEXT_LIST es no-NULL" + chi "系统变量@@sessient.gtid_next不能是'自动'@@sessient.gtid_next_list非null时" + eng "The system variable @@SESSION.GTID_NEXT cannot be 'AUTOMATIC' when @@SESSION.GTID_NEXT_LIST is non-NULL" + spa "La variable de sistema @@SESSION.GTID_NEXT no puede ser 'AUTOMATIC' si la @@SESSION.GTID_NEXT_LIST es no-NULL" ER_SKIPPING_LOGGED_TRANSACTION - eng "Skipping transaction %.200s because it has already been executed and logged" - spa "Saltando transacción %.200s porque ya ha sido ejecutada y puesta en historial (log)" + chi "跳过事务%.200s,因为它已经被执行和记录" + eng "Skipping transaction %.200s because it has already been executed and logged" + spa "Saltando transacción %.200s porque ya ha sido ejecutada y puesta en historial (log)" ER_MALFORMED_GTID_SET_SPECIFICATION - eng "Malformed GTID set specification '%.200s'" - spa "GTID malformado pone especificación '%.200s'" + chi "畸形GTID设置规范'%.200s'" + eng "Malformed GTID set specification '%.200s'" + spa "GTID malformado pone especificación '%.200s'" ER_MALFORMED_GTID_SET_ENCODING - eng "Malformed GTID set encoding" - spa "GTID malformado pone codificación" + chi "格式错误的GTID集编码" + eng "Malformed GTID set encoding" + spa "GTID malformado pone codificación" ER_MALFORMED_GTID_SPECIFICATION - eng "Malformed GTID specification '%.200s'" - spa "GTID malformado especificación '%.200s'" + chi "畸形GTID规范'%.200s'" + eng "Malformed GTID specification '%.200s'" + spa "GTID malformado especificación '%.200s'" ER_GNO_EXHAUSTED - eng "Impossible to generate Global Transaction Identifier: the integer component reached the maximal value. Restart the server with a new server_uuid" - spa "Imposible generar Identificador Global de Transacción: el componente entero alcanzó el máximo valor. Rearranque el servidor con un nuevo server_uuid" + chi "无法生成全局事务标识符:整数组件达到了最大值。用新server_uuId重新启动服务器" + eng "Impossible to generate Global Transaction Identifier: the integer component reached the maximal value. Restart the server with a new server_uuid" + spa "Imposible generar Identificador Global de Transacción: el componente entero alcanzó el máximo valor. Rearranque el servidor con un nuevo server_uuid" ER_BAD_SLAVE_AUTO_POSITION - eng "Parameters MASTER_LOG_FILE, MASTER_LOG_POS, RELAY_LOG_FILE and RELAY_LOG_POS cannot be set when MASTER_AUTO_POSITION is active" - spa "Los parámetros MASTER_LOG_FILE, MASTER_LOG_POS, RELAY_LOG_FILE y RELAY_LOG_POS no pueden ser puestos cuando MASTER_AUTO_POSITION esté activo" + chi "当MASTER_AUTO_POSITION处于活动状态时,无法设置参数MASTER_LOG_FILE,MASTER_LOG_POS,RELAY_LOG_FILE和RELAY_LOG_POS" + eng "Parameters MASTER_LOG_FILE, MASTER_LOG_POS, RELAY_LOG_FILE and RELAY_LOG_POS cannot be set when MASTER_AUTO_POSITION is active" + spa "Los parámetros MASTER_LOG_FILE, MASTER_LOG_POS, RELAY_LOG_FILE y RELAY_LOG_POS no pueden ser puestos cuando MASTER_AUTO_POSITION esté activo" ER_AUTO_POSITION_REQUIRES_GTID_MODE_ON - eng "CHANGE MASTER TO MASTER_AUTO_POSITION = 1 can only be executed when GTID_MODE = ON" - spa "CHANGE MASTER TO MASTER_AUTO_POSITION = 1 sólo se puede ejecutar cuando GTID_MODE = ON" + chi "CHANGE MASTER TO MASTER_AUTO_POSITION = 1只能在GTID_MODE = ON上执行" + eng "CHANGE MASTER TO MASTER_AUTO_POSITION = 1 can only be executed when GTID_MODE = ON" + spa "CHANGE MASTER TO MASTER_AUTO_POSITION = 1 sólo se puede ejecutar cuando GTID_MODE = ON" ER_CANT_DO_IMPLICIT_COMMIT_IN_TRX_WHEN_GTID_NEXT_IS_SET - eng "Cannot execute statements with implicit commit inside a transaction when GTID_NEXT != AUTOMATIC or GTID_NEXT_LIST != NULL" - spa "No puedo ejecutar sentencias con acometidas (commit) implícitas dentro de una transacción cuando GTID_NEXT != AUTOMATIC o GTID_NEXT_LIST != NULL" + chi "当GTID_Next != AUTOMATIC 或GTID_NEXT_LIST != NULL时,无法在事务中执行语句" + eng "Cannot execute statements with implicit commit inside a transaction when GTID_NEXT != AUTOMATIC or GTID_NEXT_LIST != NULL" + spa "No puedo ejecutar sentencias con acometidas (commit) implícitas dentro de una transacción cuando GTID_NEXT != AUTOMATIC o GTID_NEXT_LIST != NULL" ER_GTID_MODE_2_OR_3_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON - eng "GTID_MODE = ON or GTID_MODE = UPGRADE_STEP_2 requires ENFORCE_GTID_CONSISTENCY = 1" - spa "GTID_MODE = ON o GTID_MODE = UPGRADE_STEP_2 requiere que ENFORCE_GTID_CONSISTENCY = 1" + chi "GTID_MODE = ON或GTID_MODE = UPGRADE_STEP_2需要ENFORCE_GTID_CONSISTY = 1" + eng "GTID_MODE = ON or GTID_MODE = UPGRADE_STEP_2 requires ENFORCE_GTID_CONSISTENCY = 1" + spa "GTID_MODE = ON o GTID_MODE = UPGRADE_STEP_2 requiere que ENFORCE_GTID_CONSISTENCY = 1" ER_GTID_MODE_REQUIRES_BINLOG - eng "GTID_MODE = ON or UPGRADE_STEP_1 or UPGRADE_STEP_2 requires --log-bin and --log-slave-updates" - spa "GTID_MODE = ON o UPGRADE_STEP_1 o UPGRADE_STEP_2 requiere --log-bin y --log-slave-updates" + chi "GTID_MODE = ON或UPGRADE_STEP_1或UPGRADE_STEP_2需要--log-bin和-log-slave-updates" + eng "GTID_MODE = ON or UPGRADE_STEP_1 or UPGRADE_STEP_2 requires --log-bin and --log-slave-updates" + spa "GTID_MODE = ON o UPGRADE_STEP_1 o UPGRADE_STEP_2 requiere --log-bin y --log-slave-updates" ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF - eng "GTID_NEXT cannot be set to UUID:NUMBER when GTID_MODE = OFF" - spa "GTID_NEXT no se puede poner a UUID:NUMBER cuando GTID_MODE = OFF" + chi "GTID_NEXT无法设置为UUID:NUMBER 当GTID_MODE = OFF" + eng "GTID_NEXT cannot be set to UUID:NUMBER when GTID_MODE = OFF" + spa "GTID_NEXT no se puede poner a UUID:NUMBER cuando GTID_MODE = OFF" ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON - eng "GTID_NEXT cannot be set to ANONYMOUS when GTID_MODE = ON" - spa "GTID_NEXT no se puede poner como ANONYMOUS cuando GTID_MODE = ON" + chi "GTID_NEXT无法在当GTID_MODE = ON上时设置为ANONYMOUS" + eng "GTID_NEXT cannot be set to ANONYMOUS when GTID_MODE = ON" + spa "GTID_NEXT no se puede poner como ANONYMOUS cuando GTID_MODE = ON" ER_CANT_SET_GTID_NEXT_LIST_TO_NON_NULL_WHEN_GTID_MODE_IS_OFF - eng "GTID_NEXT_LIST cannot be set to a non-NULL value when GTID_MODE = OFF" - spa "GTID_NEXT_LIST no se puede poner como valor no-NULL cuando GTID_MODE = OFF" + chi "GTID_NEXT_LIST无法设置为非空值当GTID_MODE = OFF" + eng "GTID_NEXT_LIST cannot be set to a non-NULL value when GTID_MODE = OFF" + spa "GTID_NEXT_LIST no se puede poner como valor no-NULL cuando GTID_MODE = OFF" ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF - eng "Found a Gtid_log_event or Previous_gtids_log_event when GTID_MODE = OFF" - spa "Hallado un Gtid_log_event o Previous_gtids_log_event cuando GTID_MODE = OFF" + chi "找到一个Gtid_log_event或Previous_gtids_log_event,当gtid_mode = OFF时" + eng "Found a Gtid_log_event or Previous_gtids_log_event when GTID_MODE = OFF" + spa "Hallado un Gtid_log_event o Previous_gtids_log_event cuando GTID_MODE = OFF" ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE - eng "When ENFORCE_GTID_CONSISTENCY = 1, updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions, and never in the same statement as updates to transactional tables" - spa "Cuando ENFORCE_GTID_CONSISTENCY = 1, las actualiaciones a tablas no transaccionales sólo se puede hacer o bien en sentencias autoacometidas o en transacciones de sentencias simples y nunca dentro de la misma sentencia como actualizaciones a tablas transaccionales" + chi "当Enforce_gtid_consistenty = 1时,对非事务性表的更新只能在Autocomated语句或单一语句事务中完成,而不是在与事务表中的更新相同的语句中" + eng "When ENFORCE_GTID_CONSISTENCY = 1, updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions, and never in the same statement as updates to transactional tables" + spa "Cuando ENFORCE_GTID_CONSISTENCY = 1, las actualiaciones a tablas no transaccionales sólo se puede hacer o bien en sentencias autoacometidas o en transacciones de sentencias simples y nunca dentro de la misma sentencia como actualizaciones a tablas transaccionales" ER_GTID_UNSAFE_CREATE_SELECT - eng "CREATE TABLE ... SELECT is forbidden when ENFORCE_GTID_CONSISTENCY = 1" - spa "CREATE TABLE ... SELECT está prohibido si ENFORCE_GTID_CONSISTENCY = 1" + chi "CREATE TABLE...SELECT在ENFORCE_GTID_CONSISTENCY = 1时被禁止" + eng "CREATE TABLE ... SELECT is forbidden when ENFORCE_GTID_CONSISTENCY = 1" + spa "CREATE TABLE ... SELECT está prohibido si ENFORCE_GTID_CONSISTENCY = 1" ER_GTID_UNSAFE_CREATE_DROP_TEMPORARY_TABLE_IN_TRANSACTION - eng "When ENFORCE_GTID_CONSISTENCY = 1, the statements CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE can be executed in a non-transactional context only, and require that AUTOCOMMIT = 1" - spa "Cuando ENFORCE_GTID_CONSISTENCY = 1, las sentencias CREATE TEMPORARY TABLE y DROP TEMPORARY TABLE pueden ser ejecutadas sólo en contextos no-transaccionales y requieren que AUTOCOMMIT = 1" + chi "当ENFORCE_GTID_CONSISTENCY = 1时,语句CREATE TEMPORARY TABL和DROP TEMPORARY TABLE,只能在非事务性上下文中执行,并且要求autocommit = 1" + eng "When ENFORCE_GTID_CONSISTENCY = 1, the statements CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE can be executed in a non-transactional context only, and require that AUTOCOMMIT = 1" + spa "Cuando ENFORCE_GTID_CONSISTENCY = 1, las sentencias CREATE TEMPORARY TABLE y DROP TEMPORARY TABLE pueden ser ejecutadas sólo en contextos no-transaccionales y requieren que AUTOCOMMIT = 1" ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME - eng "The value of GTID_MODE can only change one step at a time: OFF <-> UPGRADE_STEP_1 <-> UPGRADE_STEP_2 <-> ON. Also note that this value must be stepped up or down simultaneously on all servers; see the Manual for instructions." - spa "El valor de GTID_MODE sólo puede cambiar un paso a la vez: OFF <-> UPGRADE_STEP_1 <-> UPGRADE_STEP_2 <-> ON. También ten en cuenta que este valor debe de ser aumentado y disminuido simultaneamente en todos los servidores; mira el Manual para instrucciones." + chi "GTID_MODE的值只能一次更改一步:OFF<-> UPGRODE_STEP_1 <-> UPGRODE_STEP_2 <-> ON。另请注意,此值必须在所有服务器上同时上升或下降;有关说明,请参阅手册。“" + eng "The value of GTID_MODE can only change one step at a time: OFF <-> UPGRADE_STEP_1 <-> UPGRADE_STEP_2 <-> ON. Also note that this value must be stepped up or down simultaneously on all servers; see the Manual for instructions." + spa "El valor de GTID_MODE sólo puede cambiar un paso a la vez: OFF <-> UPGRADE_STEP_1 <-> UPGRADE_STEP_2 <-> ON. También ten en cuenta que este valor debe de ser aumentado y disminuido simultaneamente en todos los servidores; mira el Manual para instrucciones." ER_MASTER_HAS_PURGED_REQUIRED_GTIDS - eng "The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires" - spa "El esclavo se está conectando usando CHANGE MASTER TO MASTER_AUTO_POSITION = 1, pero el maestro (master) ha purgado los historiales (logs) binarios que contienen GTIDs requeridos por el esclavo" + chi "从机更改主站到Master_Auto_Position = 1,因此主站连接,但主设备已清除了slave需要的GTID的二进制日志" + eng "The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires" + spa "El esclavo se está conectando usando CHANGE MASTER TO MASTER_AUTO_POSITION = 1, pero el maestro (master) ha purgado los historiales (logs) binarios que contienen GTIDs requeridos por el esclavo" ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID - eng "GTID_NEXT cannot be changed by a client that owns a GTID. The client owns %s. Ownership is released on COMMIT or ROLLBACK" - spa "GTID_NEXT no se puede cambiar por un cliente que posee un GTID. El cliente posee %s. La propiedad se libera con COMMIT o ROLLBACK" + chi "无法由拥有GTID的客户端更改GTID_NEXT。客户拥有%s。所有权在提交或回滚上发布" + eng "GTID_NEXT cannot be changed by a client that owns a GTID. The client owns %s. Ownership is released on COMMIT or ROLLBACK" + spa "GTID_NEXT no se puede cambiar por un cliente que posee un GTID. El cliente posee %s. La propiedad se libera con COMMIT o ROLLBACK" ER_UNKNOWN_EXPLAIN_FORMAT - eng "Unknown %s format name: '%s'" - rus "Неизвестное имя формата команды %s: '%s'" - spa "Nombre de formato %s desconocido: '%s'" + chi "未知%s格式名称:'%s'" + eng "Unknown %s format name: '%s'" + rus "Неизвестное имя формата команды %s: '%s'" + spa "Nombre de formato %s desconocido: '%s'" ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION 25006 - eng "Cannot execute statement in a READ ONLY transaction" - spa "No puedo ejecutar sentencia en una transacción READ ONLY" + chi "无法在只读事务中执行语句" + eng "Cannot execute statement in a READ ONLY transaction" + spa "No puedo ejecutar sentencia en una transacción READ ONLY" ER_TOO_LONG_TABLE_PARTITION_COMMENT - eng "Comment for table partition '%-.64s' is too long (max = %lu)" - spa "El comentario para partición de tabla '%-.64s' es demasido largo (máx = %lu)" + chi "表分区的评论'%-.64s'太长(max =%lu)" + eng "Comment for table partition '%-.64s' is too long (max = %lu)" + spa "El comentario para partición de tabla '%-.64s' es demasido largo (máx = %lu)" ER_SLAVE_CONFIGURATION - eng "Slave is not configured or failed to initialize properly. You must at least set --server-id to enable either a master or a slave. Additional error messages can be found in the MariaDB error log" - spa "El esclavo no está configurado o falló al inicializarse de forma adecuada. Vd debe de poner al menos --server-id para activar o bien un maestro (master) o un esclavo. Mensajes de error adicionales pueden ser hallados en historial (log) de errores de MariaDB" + chi "从站未配置或未能正确初始化。您必须至少set --server-id以启用主站或从站。可以在MariaDB错误日志中找到其他错误消息" + eng "Slave is not configured or failed to initialize properly. You must at least set --server-id to enable either a master or a slave. Additional error messages can be found in the MariaDB error log" + spa "El esclavo no está configurado o falló al inicializarse de forma adecuada. Vd debe de poner al menos --server-id para activar o bien un maestro (master) o un esclavo. Mensajes de error adicionales pueden ser hallados en historial (log) de errores de MariaDB" ER_INNODB_FT_LIMIT - eng "InnoDB presently supports one FULLTEXT index creation at a time" - spa "Actualmente InnoDB soporta la creación de un índice FULLTEXT a la vez" + chi "InnoDB目前一次支持一个全文索引创建" + eng "InnoDB presently supports one FULLTEXT index creation at a time" + spa "Actualmente InnoDB soporta la creación de un índice FULLTEXT a la vez" ER_INNODB_NO_FT_TEMP_TABLE - eng "Cannot create FULLTEXT index on temporary InnoDB table" - spa "No puedo crear índice FULLTEXT en tabla temporal InnoDB" + chi "无法在临时InnoDB表上创建FullText索引" + eng "Cannot create FULLTEXT index on temporary InnoDB table" + spa "No puedo crear índice FULLTEXT en tabla temporaria InnoDB" ER_INNODB_FT_WRONG_DOCID_COLUMN - eng "Column '%-.192s' is of wrong type for an InnoDB FULLTEXT index" - spa "La columna '%-.192s' es de tipo equivocado para un índice InnoDB FULLTEXT" + chi "列'%-.192s'是innodb fulltext索引的错误类型" + eng "Column '%-.192s' is of wrong type for an InnoDB FULLTEXT index" + spa "La columna '%-.192s' es de tipo equivocado para un índice InnoDB FULLTEXT" ER_INNODB_FT_WRONG_DOCID_INDEX - eng "Index '%-.192s' is of wrong type for an InnoDB FULLTEXT index" - spa "El índice '%-.192s' es de tipo equivocado para un índice InnoDB FULLTEXT" + chi "InnoDB全文索引的索引'%-.192s'是错误的类型错误" + eng "Index '%-.192s' is of wrong type for an InnoDB FULLTEXT index" + spa "El índice '%-.192s' es de tipo equivocado para un índice InnoDB FULLTEXT" ER_INNODB_ONLINE_LOG_TOO_BIG - eng "Creating index '%-.192s' required more than 'innodb_online_alter_log_max_size' bytes of modification log. Please try again" - spa "La creación de índice '%-.192s' requirió más de 'innodb_online_alter_log_max_size' bytes de historial (log) de modificaciones. Por favor, pruebe otra vez" + chi "创建索引'%-.192s'所需的多于'innodb_online_alter_log_max_size'字节的修改日志。请再试一次" + eng "Creating index '%-.192s' required more than 'innodb_online_alter_log_max_size' bytes of modification log. Please try again" + spa "La creación de índice '%-.192s' requirió más de 'innodb_online_alter_log_max_size' bytes de historial (log) de modificaciones. Por favor, pruebe otra vez" ER_UNKNOWN_ALTER_ALGORITHM - eng "Unknown ALGORITHM '%s'" - spa "ALGORITHM desconocido '%s'" + chi "未知算法'%s'" + eng "Unknown ALGORITHM '%s'" + spa "ALGORITHM desconocido '%s'" ER_UNKNOWN_ALTER_LOCK - eng "Unknown LOCK type '%s'" - spa "Tipo de LOCK desconocido '%s'" + chi "未知锁定类型'%s'" + eng "Unknown LOCK type '%s'" + spa "Tipo de LOCK desconocido '%s'" ER_MTS_CHANGE_MASTER_CANT_RUN_WITH_GAPS - eng "CHANGE MASTER cannot be executed when the slave was stopped with an error or killed in MTS mode. Consider using RESET SLAVE or START SLAVE UNTIL" - spa "CHANGE MASTER no se puede ejecutar cuando se ha parado el esclavo con un error o matado en modo MTS. Considere el usar RESET SLAVE o START SLAVE UNTIL" + chi "当从站因为错误停止或以MTS模式终止时,不呢执行CHANGE MASTER。考虑使用RESET SLAVE或START SLAVE UNTIL" + eng "CHANGE MASTER cannot be executed when the slave was stopped with an error or killed in MTS mode. Consider using RESET SLAVE or START SLAVE UNTIL" + spa "CHANGE MASTER no se puede ejecutar cuando se ha parado el esclavo con un error o matado en modo MTS. Considere el usar RESET SLAVE o START SLAVE UNTIL" ER_MTS_RECOVERY_FAILURE - eng "Cannot recover after SLAVE errored out in parallel execution mode. Additional error messages can be found in the MariaDB error log" - spa "No puedo recuperar después de que SLAVE diera error en modo paralelo de ejecución. Mensajes de error adicionales se pueden hallar en el historial (log) de error de MariaDB" + chi "从并行执行模式下的从站错误后无法恢复。可以在MariaDB错误日志中找到其他错误消息" + eng "Cannot recover after SLAVE errored out in parallel execution mode. Additional error messages can be found in the MariaDB error log" + spa "No puedo recuperar después de que SLAVE diera error en modo paralelo de ejecución. Mensajes de error adicionales se pueden hallar en el historial (log) de error de MariaDB" ER_MTS_RESET_WORKERS - eng "Cannot clean up worker info tables. Additional error messages can be found in the MariaDB error log" - spa "No puedo limpiar tablas de información de trabajador. Mensajes de error adicionales se pueden hallar en el historial (log) de error de MariaDB" + chi "无法清理工作者信息表。可以在MariaDB错误日志中找到其他错误消息" + eng "Cannot clean up worker info tables. Additional error messages can be found in the MariaDB error log" + spa "No puedo limpiar tablas de información de trabajador. Mensajes de error adicionales se pueden hallar en el historial (log) de error de MariaDB" ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2 - eng "Column count of %s.%s is wrong. Expected %d, found %d. The table is probably corrupted" - ger "Spaltenanzahl von %s.%s falsch. %d erwartet, aber %d gefunden. Tabelle ist wahrscheinlich beschädigt" - spa "El contador de columnas %s.%s está equivocado. Se esperaba %d, hallado %d. La tabla está probablemente estropeada" + chi "列数为%s.%s是错误的。预期的%d,找到%d。表可能损坏了" + eng "Column count of %s.%s is wrong. Expected %d, found %d. The table is probably corrupted" + ger "Spaltenanzahl von %s.%s falsch. %d erwartet, aber %d gefunden. Tabelle ist wahrscheinlich beschädigt" + spa "El contador de columnas %s.%s está equivocado. Se esperaba %d, hallado %d. La tabla está probablemente estropeada" ER_SLAVE_SILENT_RETRY_TRANSACTION - eng "Slave must silently retry current transaction" - spa "El esclavo debe de reintentar silenciosamente la transacción en curso" + chi "从站必须静默地重试当前事务" + eng "Slave must silently retry current transaction" + spa "El esclavo debe de reintentar silenciosamente la transacción en curso" ER_UNUSED_22 - eng "You should never see it" - spa "Nunca debería vd de ver esto" + chi "你永远不应该看到它" + eng "You should never see it" + spa "Nunca debería vd de ver esto" ER_TABLE_SCHEMA_MISMATCH - eng "Schema mismatch (%s)" - spa "Esquema no coincide (%s)" + chi "架构不匹配(%s)" + eng "Schema mismatch (%s)" + spa "Esquema no coincide (%s)" ER_TABLE_IN_SYSTEM_TABLESPACE - eng "Table %-.192s in system tablespace" - spa "Tabla %-.192s en espacio de tablas del sitema" + chi "表%-.192s在系统表空间中" + eng "Table %-.192s in system tablespace" + spa "Tabla %-.192s en espacio de tablas del sitema" ER_IO_READ_ERROR - eng "IO Read error: (%lu, %s) %s" - spa "Error de Lectura de E/S: (%lu, %s) %s" + chi "IO读取错误:(%lu,%s)%s" + eng "IO Read error: (%lu, %s) %s" + spa "Error de Lectura de E/S: (%lu, %s) %s" ER_IO_WRITE_ERROR - eng "IO Write error: (%lu, %s) %s" - spa "Error de Escritura de E/S: (%lu, %s) %s" + chi "IO写错错误:(%lu,%s)%s" + eng "IO Write error: (%lu, %s) %s" + spa "Error de Escritura de E/S: (%lu, %s) %s" ER_TABLESPACE_MISSING - eng "Tablespace is missing for table '%-.192s'" - spa "Espacio de tabla falta para la tabla '%-.192s'" + chi "表空间缺少表'%-.192s'" + eng "Tablespace is missing for table '%-.192s'" + spa "Espacio de tabla falta para la tabla '%-.192s'" ER_TABLESPACE_EXISTS - eng "Tablespace for table '%-.192s' exists. Please DISCARD the tablespace before IMPORT" - spa "Existe Espacio de tabla para la tabla '%-.192s'. Por favor, haga DISCARD del espacio de tabla antes de hacer IMPORT" + chi "表格'%-.192s'的表空间。请在导入之前丢弃表空间" + eng "Tablespace for table '%-.192s' exists. Please DISCARD the tablespace before IMPORT" + spa "Existe Espacio de tabla para la tabla '%-.192s'. Por favor, haga DISCARD del espacio de tabla antes de hacer IMPORT" ER_TABLESPACE_DISCARDED - eng "Tablespace has been discarded for table %`s" - spa "El espacio de tabla ha sido descartado para la tabla %`s" + chi "表空间已被丢弃为表%`s" + eng "Tablespace has been discarded for table %`s" + spa "El espacio de tabla ha sido descartado para la tabla %`s" ER_INTERNAL_ERROR - eng "Internal error: %-.192s" - spa "Error interno: %-.192s" + chi "内部错误:%-.192s" + eng "Internal error: %-.192s" + spa "Error interno: %-.192s" ER_INNODB_IMPORT_ERROR - eng "ALTER TABLE '%-.192s' IMPORT TABLESPACE failed with error %lu : '%s'" - spa "ALTER TABLE '%-.192s' IMPORT TABLESPACE ha fallado con error %lu : '%s'" + chi "ALTER TABLE '%-.192s' IMPORT TABLESPACE 失败,错误%lu:'%s'" + eng "ALTER TABLE '%-.192s' IMPORT TABLESPACE failed with error %lu : '%s'" + spa "ALTER TABLE '%-.192s' IMPORT TABLESPACE ha fallado con error %lu : '%s'" ER_INNODB_INDEX_CORRUPT - eng "Index corrupt: %s" - spa "Índice corrupto: %s" + chi "索引损坏:%s" + eng "Index corrupt: %s" + spa "Índice corrupto: %s" ER_INVALID_YEAR_COLUMN_LENGTH - eng "YEAR(%lu) column type is deprecated. Creating YEAR(4) column instead" - rus "Тип YEAR(%lu) более не поддерживается, вместо него будет создана колонка с типом YEAR(4)" - spa "El tipo de columna YEAR(%lu) está obsoleto. Creando columna YEAR(4) en su lugar" + chi "已弃用YEAR(%lu)列类型。创建YEAR(4)列代替" + eng "YEAR(%lu) column type is deprecated. Creating YEAR(4) column instead" + rus "Тип YEAR(%lu) более не поддерживается, вместо него будет создана колонка с типом YEAR(4)" + spa "El tipo de columna YEAR(%lu) está obsoleto. Creando columna YEAR(4) en su lugar" ER_NOT_VALID_PASSWORD - eng "Your password does not satisfy the current policy requirements" - spa "Su contraseña no satisface los requerimientos de la política en curso" + eng "Your password does not satisfy the current policy requirements (%s)" + ukr "Ваш пароль не відповідає поточним правилам (%s)" ER_MUST_CHANGE_PASSWORD - eng "You must SET PASSWORD before executing this statement" - bgn "Трябва първо да си смените паролата със SET PASSWORD за да можете да изпълните тази команда" - rum "Trebuie sa iti schimbi parola folosind SET PASSWORD inainte de a executa aceasta comanda" - spa "Debe vd de poner SET PASSWORD antes de ejecutar esta sentencia" + bgn "Трябва първо да си смените паролата със SET PASSWORD за да можете да изпълните тази команда" + chi "您必须在执行此语句之前设置密码" + eng "You must SET PASSWORD before executing this statement" + rum "Trebuie sa iti schimbi parola folosind SET PASSWORD inainte de a executa aceasta comanda" + spa "Debe vd de poner SET PASSWORD antes de ejecutar esta sentencia" ER_FK_NO_INDEX_CHILD - eng "Failed to add the foreign key constaint. Missing index for constraint '%s' in the foreign table '%s'" + chi "无法添加外键约束。外表'%s'中的约束'%s'缺少索引" + eng "Failed to add the foreign key constraint. Missing index for constraint '%s' in the foreign table '%s'" spa "No pude añadir la restricción de clave foránea. Falta índice para restricción '%s' en la tabla foránea '%s'" ER_FK_NO_INDEX_PARENT - eng "Failed to add the foreign key constaint. Missing index for constraint '%s' in the referenced table '%s'" + chi "无法添加外键约束。引用的表'%s'中的约束'%s'缺少索引" + eng "Failed to add the foreign key constraint. Missing index for constraint '%s' in the referenced table '%s'" spa "No pude añadir la restricción de clave foránea. Falta índice para restricción '%s' en la tabla referenciada '%s'" ER_FK_FAIL_ADD_SYSTEM + chi "无法将外键约束'%s'添加到系统表" eng "Failed to add the foreign key constraint '%s' to system tables" spa "No pude añadir la restricción de clave foránea '%s' a las tablas del sistema" ER_FK_CANNOT_OPEN_PARENT + chi "无法打开引用的表'%s'" eng "Failed to open the referenced table '%s'" spa "No pude abrir la tabla referenciada '%s'" ER_FK_INCORRECT_OPTION + chi "无法在表'%s'上添加外键约束。外键约束'%s'中的选项不正确" eng "Failed to add the foreign key constraint on table '%s'. Incorrect options in FOREIGN KEY constraint '%s'" spa "No pude añadir restricción de clave foránea en la tabla '%s'. Opciones incorrectas en restricción FOREIGN KEY '%s'" ER_DUP_CONSTRAINT_NAME - eng "Duplicate %s constraint name '%s'" - spa "Duplicada restricción %s llamada '%s'" + chi "重复%s约束名称'%s'" + eng "Duplicate %s constraint name '%s'" + spa "Duplicada restricción %s llamada '%s'" ER_PASSWORD_FORMAT - eng "The password hash doesn't have the expected format. Check if the correct password algorithm is being used with the PASSWORD() function" - spa "El cálculo de contraseña no tiene el formato esperado. Revise si se está usando el algoritmo correcto de contraseña con la función PASSWORD()" + chi "密码哈希没有预期的格式。检查密码()函数是否使用正确的密码算法" + eng "The password hash doesn't have the expected format. Check if the correct password algorithm is being used with the PASSWORD() function" + spa "El cálculo de contraseña no tiene el formato esperado. Revise si se está usando el algoritmo correcto de contraseña con la función PASSWORD()" ER_FK_COLUMN_CANNOT_DROP + chi "无法删除'%-.192s'列:在外部索引约束'%-.192s'中需要" eng "Cannot drop column '%-.192s': needed in a foreign key constraint '%-.192s'" ger "Kann Spalte '%-.192s' nicht löschen: wird für eine Fremdschlüsselbeschränkung '%-.192s' benötigt" spa "No puedo eliminar la columna '%-.192s': necesaria en restricción de clave foránea '%-.192s'" ER_FK_COLUMN_CANNOT_DROP_CHILD + chi "无法删除列'%-.192s':在外键约束'%-.192s'中需要,表%-.192s" eng "Cannot drop column '%-.192s': needed in a foreign key constraint '%-.192s' of table %-.192s" ger "Kann Spalte '%-.192s' nicht löschen: wird für eine Fremdschlüsselbeschränkung '%-.192s' der Tabelle %-.192s benötigt" spa "No puedo eliminar la columna '%-.192s': necesaria en restriccón de clave foránea '%-.192s' de la tabla %-.192s" ER_FK_COLUMN_NOT_NULL + chi "列'%-.192s'不能没有null:在外键约束'%-.192s'设置为null" eng "Column '%-.192s' cannot be NOT NULL: needed in a foreign key constraint '%-.192s' SET NULL" ger "Spalte '%-.192s' kann nicht NOT NULL sein: wird für eine Fremdschlüsselbeschränkung '%-.192s' SET NULL benötigt" spa "La columna '%-.192s' no puede ser NOT NULL: necesaria en restricción de clave foránea '%-.192s' SET NULL" ER_DUP_INDEX - eng "Duplicate index %`s. This is deprecated and will be disallowed in a future release" - spa "Índice duplicado %`s. Éste está obsoleto y será quitado en entregas futuras" + chi "重复索引%`s。这已弃用,将在未来的版本中不允许" + eng "Duplicate index %`s. This is deprecated and will be disallowed in a future release" + spa "Índice duplicado %`s. Éste está obsoleto y será quitado en entregas futuras" ER_FK_COLUMN_CANNOT_CHANGE - eng "Cannot change column '%-.192s': used in a foreign key constraint '%-.192s'" - spa "No puedo cambiar la columna '%-.192s': usada en una restricción de clave foránea '%-.192s'" + chi "无法更改列'%-.192s':用于外部键约束'%-.192s'" + eng "Cannot change column '%-.192s': used in a foreign key constraint '%-.192s'" + spa "No puedo cambiar la columna '%-.192s': usada en una restricción de clave foránea '%-.192s'" ER_FK_COLUMN_CANNOT_CHANGE_CHILD - eng "Cannot change column '%-.192s': used in a foreign key constraint '%-.192s' of table '%-.192s'" - spa "No puedo cambiar la columna '%-.192s': usada en restricción de clave foránea '%-.192s' de la tabla '%-.192s'" + chi "无法更改列'%-.192s':用于在外部键约束'%-.192s'的表'%-.192s'" + eng "Cannot change column '%-.192s': used in a foreign key constraint '%-.192s' of table '%-.192s'" + spa "No puedo cambiar la columna '%-.192s': usada en restricción de clave foránea '%-.192s' de la tabla '%-.192s'" ER_FK_CANNOT_DELETE_PARENT - eng "Cannot delete rows from table which is parent in a foreign key constraint '%-.192s' of table '%-.192s'" - spa "No puedo borrar filas de la tabla que es padre en restricción de clave foránea '%-.192s' de la tabla '%-.192s'" + chi "无法从表中删除来自表中的父级的表中的行'%-.192s”表'%-.192s'" + eng "Cannot delete rows from table which is parent in a foreign key constraint '%-.192s' of table '%-.192s'" + spa "No puedo borrar filas de la tabla que es padre en restricción de clave foránea '%-.192s' de la tabla '%-.192s'" ER_MALFORMED_PACKET - eng "Malformed communication packet" - spa "Paquete de comunicación malformado" + chi "畸形通信包" + eng "Malformed communication packet" + spa "Paquete de comunicación malformado" ER_READ_ONLY_MODE + chi "以只读模式运行" eng "Running in read-only mode" spa "Ejecutando em modo sólo-lectura" ER_GTID_NEXT_TYPE_UNDEFINED_GROUP - eng "When GTID_NEXT is set to a GTID, you must explicitly set it again after a COMMIT or ROLLBACK. If you see this error message in the slave SQL thread, it means that a table in the current transaction is transactional on the master and non-transactional on the slave. In a client connection, it means that you executed SET GTID_NEXT before a transaction and forgot to set GTID_NEXT to a different identifier or to 'AUTOMATIC' after COMMIT or ROLLBACK. Current GTID_NEXT is '%s'" - spa "Cuando GTID_NEXT se pone a GTID, debe vd de ponerlo de nuevo de forma explícita tras un COMMIT o ROLLBACK. Si vd ve este mensaje de error en el hilo (thread) de SQL esclavo, indica que una tabla de la transacción en curso es transaccional en el maestro (master) y no transaccional en el esclavo. En una conexión cliente, indica que has ejecutado SET GTID_NEXT antes de una transacción y has olvidado poner GTID_NEXT a un identificador diferente o a 'AUTOMATIC' tras COMMIT o ROLLBACK. El GTID_NEXT actual es '%s'" + chi "当GTID_NEXT设置为GTID时,必须在提交或回滚后立即将其再次设置。如果在从SQL线程中看到此错误消息,则表示当前事务中的表是在主站和从站上的非交易的事务性。在客户端连接中,它意味着您在事务之前执行SET GTID_NEXT并忘记将GTID_NEXT设置为不同的标识符或在提交或回滚后“自动”。当前gtid_next是'%s'" + eng "When GTID_NEXT is set to a GTID, you must explicitly set it again after a COMMIT or ROLLBACK. If you see this error message in the slave SQL thread, it means that a table in the current transaction is transactional on the master and non-transactional on the slave. In a client connection, it means that you executed SET GTID_NEXT before a transaction and forgot to set GTID_NEXT to a different identifier or to 'AUTOMATIC' after COMMIT or ROLLBACK. Current GTID_NEXT is '%s'" + spa "Cuando GTID_NEXT se pone a GTID, debe vd de ponerlo de nuevo de forma explícita tras un COMMIT o ROLLBACK. Si vd ve este mensaje de error en el hilo (thread) de SQL esclavo, indica que una tabla de la transacción en curso es transaccional en el maestro (master) y no transaccional en el esclavo. En una conexión cliente, indica que has ejecutado SET GTID_NEXT antes de una transacción y has olvidado poner GTID_NEXT a un identificador diferente o a 'AUTOMATIC' tras COMMIT o ROLLBACK. El GTID_NEXT actual es '%s'" ER_VARIABLE_NOT_SETTABLE_IN_SP - eng "The system variable %.200s cannot be set in stored procedures" - spa "La variable de sistema %.200s no se puede poner en procedimentos almacenados" + chi "无法在存储过程中设置系统变量%.200s" + eng "The system variable %.200s cannot be set in stored procedures" + spa "La variable de sistema %.200s no se puede poner en procedimentos almacenados" ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF - eng "GTID_PURGED can only be set when GTID_MODE = ON" - spa "GTID_PURGED sólo se puede usar cuando GTID_MODE = ON" + chi "只能在GTID_MODE = ON设置GTID_PURGED" + eng "GTID_PURGED can only be set when GTID_MODE = ON" + spa "GTID_PURGED sólo se puede usar cuando GTID_MODE = ON" ER_CANT_SET_GTID_PURGED_WHEN_GTID_EXECUTED_IS_NOT_EMPTY - eng "GTID_PURGED can only be set when GTID_EXECUTED is empty" - spa "GTID_PURGED sólo se puede poner cuando GTID_EXECUTED está vacío" + chi "只有在GTID_EXECUTED为空时才可以设置GTID_PURGED" + eng "GTID_PURGED can only be set when GTID_EXECUTED is empty" + spa "GTID_PURGED sólo se puede poner cuando GTID_EXECUTED está vacío" ER_CANT_SET_GTID_PURGED_WHEN_OWNED_GTIDS_IS_NOT_EMPTY - eng "GTID_PURGED can only be set when there are no ongoing transactions (not even in other clients)" - spa "GTID_PURGED sólo se puede poner cuando no hay trasacciones en curso (ni incluso en otros clientes)" + chi "只有在没有持续的事务时才可以设置GTID_PURGED(即使在其他客户端中不)" + eng "GTID_PURGED can only be set when there are no ongoing transactions (not even in other clients)" + spa "GTID_PURGED sólo se puede poner cuando no hay trasacciones en curso (ni incluso en otros clientes)" ER_GTID_PURGED_WAS_CHANGED - eng "GTID_PURGED was changed from '%s' to '%s'" - spa "GTID_PURGED se cambió de '%s' a '%s'" + chi "GTID_PURGED从'%s'更改为'%s'" + eng "GTID_PURGED was changed from '%s' to '%s'" + spa "GTID_PURGED se cambió de '%s' a '%s'" ER_GTID_EXECUTED_WAS_CHANGED - eng "GTID_EXECUTED was changed from '%s' to '%s'" - spa "GTID_EXECUTED se cambió de '%s' a '%s'" + chi "GTID_EXECUTE从'%s'更改为'%s'" + eng "GTID_EXECUTED was changed from '%s' to '%s'" + spa "GTID_EXECUTED se cambió de '%s' a '%s'" ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES - eng "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT, and both replicated and non replicated tables are written to" - spa "No puedo ejecutar sentencia: imposible escribir en historial (log) binario desde BINLOG_FORMAT = STATEMENT y en tablas replicadas y no replicadas" + chi "无法执行语句:由于BINLOG_FORMAT = STATEMENT,因此无法写入二进制日志,并将复制和非复制表写入" + eng "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT, and both replicated and non replicated tables are written to" + spa "No puedo ejecutar sentencia: imposible escribir en historial (log) binario desde BINLOG_FORMAT = STATEMENT y en tablas replicadas y no replicadas" ER_ALTER_OPERATION_NOT_SUPPORTED 0A000 - eng "%s is not supported for this operation. Try %s" - spa "%s no está soportado para esta operación. Pruebe %s" + chi "此操作不支持%s。试试%s" + eng "%s is not supported for this operation. Try %s" + spa "%s no está soportado para esta operación. Pruebe %s" ER_ALTER_OPERATION_NOT_SUPPORTED_REASON 0A000 - eng "%s is not supported. Reason: %s. Try %s" - spa "%s no está soportado. Motivo: %s. Pruebe %s" + chi "不支持%s。原因:%s。试试%s" + eng "%s is not supported. Reason: %s. Try %s" + spa "%s no está soportado. Motivo: %s. Pruebe %s" ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COPY - eng "COPY algorithm requires a lock" - spa "El algoritmo de COPY requiere de un bloqueo" + chi "复制算法需要锁定" + eng "COPY algorithm requires a lock" + spa "El algoritmo de COPY requiere de un bloqueo" ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION - eng "Partition specific operations do not yet support LOCK/ALGORITHM" - spa "Las operaciones específicas de partición aún no soportan LOCK/ALGORITHM" + chi "分区特定操作尚不支持锁定/算法" + eng "Partition specific operations do not yet support LOCK/ALGORITHM" + spa "Las operaciones específicas de partición aún no soportan LOCK/ALGORITHM" ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME - eng "Columns participating in a foreign key are renamed" - spa "Las columnas que participan en una clave foránea son renombradas" + chi "参与外键的列被更名" + eng "Columns participating in a foreign key are renamed" + spa "Las columnas que participan en una clave foránea son renombradas" ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE - eng "Cannot change column type" - spa "No puedo cambiar el tipo de la columna" + chi "无法更改列类型" + eng "Cannot change column type" + spa "No puedo cambiar el tipo de la columna" ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_CHECK - eng "Adding foreign keys needs foreign_key_checks=OFF" - spa "El añadir claves foráneas necesita de foreign_key_checks=OFF" + chi "添加外键需要figner_key_checks = OFF" + eng "Adding foreign keys needs foreign_key_checks=OFF" + spa "El añadir claves foráneas necesita de foreign_key_checks=OFF" ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_IGNORE - eng "Creating unique indexes with IGNORE requires COPY algorithm to remove duplicate rows" - spa "El crear ídices únicos con IGNORE requiere del algoritmo COPY para quitar filas duplicadas" + chi "使用忽略创建唯一索引需要复制算法删除重复行" + eng "Creating unique indexes with IGNORE requires COPY algorithm to remove duplicate rows" + spa "El crear ídices únicos con IGNORE requiere del algoritmo COPY para quitar filas duplicadas" ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOPK - eng "Dropping a primary key is not allowed without also adding a new primary key" - spa "Eliminar una clave primaria no está permitido sin añadir también una nueva clave primaria" + chi "不允许删除主键,而不添加新的主键" + eng "Dropping a primary key is not allowed without also adding a new primary key" + spa "Eliminar una clave primaria no está permitido sin añadir también una nueva clave primaria" ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC - eng "Adding an auto-increment column requires a lock" - spa "Para añadir una columna auto-incrementable se requiere de un bloqueo" + chi "添加自动增量列需要锁定" + eng "Adding an auto-increment column requires a lock" + spa "Para añadir una columna auto-incrementable se requiere de un bloqueo" ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_HIDDEN_FTS - eng "Cannot replace hidden FTS_DOC_ID with a user-visible one" - spa "No puedo reemplazar FTS_DOC_ID oculta con una visible-por-usuario" + chi "无法使用用户可见的替换隐藏的FTS_DOC_ID" + eng "Cannot replace hidden FTS_DOC_ID with a user-visible one" + spa "No puedo reemplazar FTS_DOC_ID oculta con una visible-por-usuario" ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS - eng "Cannot drop or rename FTS_DOC_ID" - spa "No puedo eliminar o renombrar FTS_DOC_ID" + chi "无法删除或重命名FTS_DOC_ID" + eng "Cannot drop or rename FTS_DOC_ID" + spa "No puedo eliminar o renombrar FTS_DOC_ID" ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS - eng "Fulltext index creation requires a lock" - spa "La creación de un índice Fulltext requiere de un bloqueo" + chi "fulltext索引创建需要锁定" + eng "Fulltext index creation requires a lock" + spa "La creación de un índice Fulltext requiere de un bloqueo" ER_SQL_SLAVE_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE - eng "sql_slave_skip_counter can not be set when the server is running with GTID_MODE = ON. Instead, for each transaction that you want to skip, generate an empty transaction with the same GTID as the transaction" - spa "sql_slave_skip_counter no se puede poner cuando el servidor se ejecuta con GTID_MODE = ON. En su lugar, para cada transacción que desees saltar, genera una transacción vacía con el mismo GTID que la transacción" + chi "使用GTID_Mode = ON运行时,无法设置SQL_SLAVE_SKIP_COUNTER。相反,对于要跳过的每个事务,使用与事务相同的GTID生成空事务" + eng "sql_slave_skip_counter can not be set when the server is running with GTID_MODE = ON. Instead, for each transaction that you want to skip, generate an empty transaction with the same GTID as the transaction" + spa "sql_slave_skip_counter no se puede poner cuando el servidor se ejecuta con GTID_MODE = ON. En su lugar, para cada transacción que desees saltar, genera una transacción vacía con el mismo GTID que la transacción" ER_DUP_UNKNOWN_IN_INDEX 23000 - cze "Zdvojený klíč (číslo klíče '%-.192s')" - dan "Flere ens nøgler for indeks '%-.192s'" - nla "Dubbele ingang voor zoeksleutel '%-.192s'" - eng "Duplicate entry for key '%-.192s'" - est "Kattuv väärtus võtmele '%-.192s'" - fre "Duplicata du champ pour la clef '%-.192s'" - ger "Doppelter Eintrag für Schlüssel '%-.192s'" - greek "Διπλή εγγραφή για το κλειδί '%-.192s'" - hun "Duplikalt bejegyzes a '%-.192s' kulcs szerint" - ita "Valore duplicato per la chiave '%-.192s'" - jpn "は索引 '%-.192s' で重複しています。" - kor "중복된 입력 값: key '%-.192s'" - nor "Like verdier for nøkkel '%-.192s'" - norwegian-ny "Like verdiar for nykkel '%-.192s'" - pol "Powtórzone wystąpienie dla klucza '%-.192s'" - por "Entrada duplicada para a chave '%-.192s'" - rum "Cimpul e duplicat pentru cheia '%-.192s'" - rus "Дублирующаяся запись по ключу '%-.192s'" - serbian "Dupliran unos za ključ '%-.192s'" - slo "Opakovaný kľúč (číslo kľúča '%-.192s')" - spa "Entrada duplicada para la clave '%-.192s'" - swe "Dublett för nyckel '%-.192s'" - ukr "Дублюючий запис для ключа '%-.192s'" + chi "索引的重复条目'%-.192s'" + cze "Zdvojený klíč (číslo klíče '%-.192s')" + dan "Flere ens nøgler for indeks '%-.192s'" + eng "Duplicate entry for key '%-.192s'" + est "Kattuv väärtus võtmele '%-.192s'" + fre "Duplicata du champ pour la clef '%-.192s'" + ger "Doppelter Eintrag für Schlüssel '%-.192s'" + greek "Διπλή εγγραφή για το κλειδί '%-.192s'" + hun "Duplikalt bejegyzes a '%-.192s' kulcs szerint" + ita "Valore duplicato per la chiave '%-.192s'" + jpn "は索引 '%-.192s' で重複しています。" + kor "중복된 입력 값: key '%-.192s'" + nla "Dubbele ingang voor zoeksleutel '%-.192s'" + nor "Like verdier for nøkkel '%-.192s'" + norwegian-ny "Like verdiar for nykkel '%-.192s'" + pol "Powtórzone wystąpienie dla klucza '%-.192s'" + por "Entrada duplicada para a chave '%-.192s'" + rum "Cimpul e duplicat pentru cheia '%-.192s'" + rus "Дублирующаяся запись по ключу '%-.192s'" + serbian "Dupliran unos za ključ '%-.192s'" + slo "Opakovaný kľúč (číslo kľúča '%-.192s')" + spa "Entrada duplicada para la clave '%-.192s'" + swe "Dublett för nyckel '%-.192s'" + ukr "Дублюючий запис для ключа '%-.192s'" ER_IDENT_CAUSES_TOO_LONG_PATH - eng "Long database name and identifier for object resulted in path length exceeding %d characters. Path: '%s'" - spa "Nombre largo de base de datos e identificador para objeto resultó en que el tamaño de la ruta excedió de %d caracteres. Ruta: '%s'" + chi "对象的长数据库名称和标识符导致路径长度超过%d字符。路径:'%s'" + eng "Long database name and identifier for object resulted in path length exceeding %d characters. Path: '%s'" + spa "Nombre largo de base de datos e identificador para objeto resultó en que el tamaño de la ruta excedió de %d caracteres. Ruta: '%s'" ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL - eng "cannot convert NULL to non-constant DEFAULT" - spa "no puedo convertir NULL a DEFAULT no-constante" + chi "无法将null转换为非常量默认值" + eng "cannot convert NULL to non-constant DEFAULT" + spa "no puedo convertir NULL a DEFAULT no-constante" ER_MUST_CHANGE_PASSWORD_LOGIN - eng "Your password has expired. To log in you must change it using a client that supports expired passwords" - bgn "Паролата ви е изтекла. За да влезете трябва да я смените използвайки клиент който поддрържа такива пароли" - rum "Parola ta a expirat. Pentru a te loga, trebuie sa o schimbi folosind un client ce suporta parole expirate" - spa "Su contraseña ha expirado. Para ingresar, vd debe de cambiarla usando un cliente que soporte contraseñas expiradas" + bgn "Паролата ви е изтекла. За да влезете трябва да я смените използвайки клиент който поддрържа такива пароли" + chi "您的密码已过期。要登录您必须使用支持过期密码的客户端更改它" + eng "Your password has expired. To log in you must change it using a client that supports expired passwords" + rum "Parola ta a expirat. Pentru a te loga, trebuie sa o schimbi folosind un client ce suporta parole expirate" + spa "Su contraseña ha expirado. Para ingresar, vd debe de cambiarla usando un cliente que soporte contraseñas expiradas" ER_ROW_IN_WRONG_PARTITION - eng "Found a row in wrong partition %s" - spa "Hallada una fila en partición equivocada %s" - swe "Hittade en rad i fel partition %s" + chi "在错误分区%s中找到了一行" + eng "Found a row in wrong partition %s" + spa "Hallada una fila en partición equivocada %s" + swe "Hittade en rad i fel partition %s" ER_MTS_EVENT_BIGGER_PENDING_JOBS_SIZE_MAX - eng "Cannot schedule event %s, relay-log name %s, position %s to Worker thread because its size %lu exceeds %lu of slave_pending_jobs_size_max" - spa "No puedo organizar evento %s, nombre de historial (log)-reenvío %s, posiciona %s a hilo (thread) de Trabajador porque su tamaño %lu excede %lu de slave_pending_jobs_size_max" + chi "无法安排事件%s,中继日志名称%s,position%s对工作线程,因为它的大小%lu超过了slave_pending_jobs_size_max (%lu)" + eng "Cannot schedule event %s, relay-log name %s, position %s to Worker thread because its size %lu exceeds %lu of slave_pending_jobs_size_max" + spa "No puedo organizar evento %s, nombre de historial (log)-reenvío %s, posiciona %s a hilo (thread) de Trabajador porque su tamaño %lu excede %lu de slave_pending_jobs_size_max" ER_INNODB_NO_FT_USES_PARSER - eng "Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table" - spa "No puedo CREATE FULLTEXT INDEX WITH PARSER en tabla InnoDB" + chi "无法在InnoDB表上CREATE FULLTEXT INDEX WITH PARSER" + eng "Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table" + spa "No puedo CREATE FULLTEXT INDEX WITH PARSER en tabla InnoDB" ER_BINLOG_LOGICAL_CORRUPTION - eng "The binary log file '%s' is logically corrupted: %s" - spa "El fichero/archivo de historial (log) binario '%s' está lógicamente corrupto: %s" + chi "二进制日志文件'%s'逻辑损坏:%s" + eng "The binary log file '%s' is logically corrupted: %s" + spa "El fichero/archivo de historial (log) binario '%s' está lógicamente corrupto: %s" ER_WARN_PURGE_LOG_IN_USE - eng "file %s was not purged because it was being read by %d thread(s), purged only %d out of %d files" - spa "el fchero %s no se ha purgado porque estaba siendo leído por hilo(s) (thread) %d, purgado sólo %d de %d ficheros/archivos" + chi "未清除文件%s,因为它被%d线程读取,只清除%d文件中的%d" + eng "file %s was not purged because it was being read by %d thread(s), purged only %d out of %d files" + spa "el fchero %s no se ha purgado porque estaba siendo leído por hilo(s) (thread) %d, purgado sólo %d de %d ficheros/archivos" ER_WARN_PURGE_LOG_IS_ACTIVE - eng "file %s was not purged because it is the active log file" - spa "el fichero/archivo %s no fue purgado porque es el fichero/archivo activo de historial (log)" + chi "文件%s未清除,因为它是活动日志文件" + eng "file %s was not purged because it is the active log file" + spa "el fichero/archivo %s no fue purgado porque es el fichero/archivo activo de historial (log)" ER_AUTO_INCREMENT_CONFLICT - eng "Auto-increment value in UPDATE conflicts with internally generated values" - spa "Valor de Auto-incremento en UPDATE está en conflicto con valores generados internamente" - + chi "更新中的自动增量值与内部生成的值冲突" + eng "Auto-increment value in UPDATE conflicts with internally generated values" + spa "Valor de Auto-incremento en UPDATE está en conflicto con valores generados internamente" WARN_ON_BLOCKHOLE_IN_RBR - eng "Row events are not logged for %s statements that modify BLACKHOLE tables in row format. Table(s): '%-.192s'" - spa "Los eventos de fila no son puestos en historial (log) para sentencias %s que modifican tablas BLACKHOLE en formato de fila. Tabla(s): '%-.192s'" + chi "未记录行事件的%s语句,该语句以行格式修改BlackHole表。表:'%-.192s'" + eng "Row events are not logged for %s statements that modify BLACKHOLE tables in row format. Table(s): '%-.192s'" + spa "Los eventos de fila no son puestos en historial (log) para sentencias %s que modifican tablas BLACKHOLE en formato de fila. Tabla(s): '%-.192s'" ER_SLAVE_MI_INIT_REPOSITORY - eng "Slave failed to initialize master info structure from the repository" - spa "El esclavo falló al inicializar información de estructura del maestro (master) desde el repositorio" + chi "从设备无法从存储库初始化主信息结构" + eng "Slave failed to initialize master info structure from the repository" + spa "El esclavo falló al inicializar información de estructura del maestro (master) desde el repositorio" ER_SLAVE_RLI_INIT_REPOSITORY - eng "Slave failed to initialize relay log info structure from the repository" - spa "El esclavo falló al inicializar estructura de información de historial (log) de reenvío desde el repositorio" + chi "从站无法从存储库初始化中继日志信息结构" + eng "Slave failed to initialize relay log info structure from the repository" + spa "El esclavo falló al inicializar estructura de información de historial (log) de reenvío desde el repositorio" ER_ACCESS_DENIED_CHANGE_USER_ERROR 28000 - eng "Access denied trying to change to user '%-.48s'@'%-.64s' (using password: %s). Disconnecting" bgn "Отказан достъп при опит за смяна към потребител %-.48s'@'%-.64s' (използвана парола: %s). Затваряне на връзката" + chi "访问拒绝尝试更改为用户'%-.48s'@'%-.64s'(使用密码:%s)。断开连接" + eng "Access denied trying to change to user '%-.48s'@'%-.64s' (using password: %s). Disconnecting" spa "Acceso denegado intentando cambiar a usuario '%-.48s'@'%-.64s' (usando contraseña: %s). Desconectando" ER_INNODB_READ_ONLY - eng "InnoDB is in read only mode" - hindi "InnoDB केवल READ-ONLY मोड में है" - spa "InnoDB está en modo de sólo lectura" + chi "innodb是只读模式" + eng "InnoDB is in read only mode" + hindi "InnoDB केवल READ-ONLY मोड में है" + spa "InnoDB está en modo de sólo lectura" ER_STOP_SLAVE_SQL_THREAD_TIMEOUT - eng "STOP SLAVE command execution is incomplete: Slave SQL thread got the stop signal, thread is busy, SQL thread will stop once the current task is complete" - spa "La ejecución del comando STOP SLAVE está incompleta: El hilo (thread) de SQL esclavo recibió la señal de parada, hilo (thread) ocupado, el hilo (thread) SQL se parará una vez que se complete la tarea actual" + chi "STOP SLAVE命令执行不完整:从SQL线程获得停止信号,线程正忙,一旦当前任务完成后,SQL线程将停止" + eng "STOP SLAVE command execution is incomplete: Slave SQL thread got the stop signal, thread is busy, SQL thread will stop once the current task is complete" + spa "La ejecución del comando STOP SLAVE está incompleta: El hilo (thread) de SQL esclavo recibió la señal de parada, hilo (thread) ocupado, el hilo (thread) SQL se parará una vez que se complete la tarea actual" ER_STOP_SLAVE_IO_THREAD_TIMEOUT - eng "STOP SLAVE command execution is incomplete: Slave IO thread got the stop signal, thread is busy, IO thread will stop once the current task is complete" - spa "La ejecución del comando STOP SLAVE está incompleta: El hilo (thread) de E/S esclavo recibió la señal de parada, hilo (thread) ocupado, el hilo (thread) de E/S se parará una vez que se complete la tarea actual" + chi "STOP SLAVE命令执行不完整:从机动程线程得到停止信号,线程很忙,一旦当前任务完成后,IO线程将停止。" + eng "STOP SLAVE command execution is incomplete: Slave IO thread got the stop signal, thread is busy, IO thread will stop once the current task is complete" + spa "La ejecución del comando STOP SLAVE está incompleta: El hilo (thread) de E/S esclavo recibió la señal de parada, hilo (thread) ocupado, el hilo (thread) de E/S se parará una vez que se complete la tarea actual" ER_TABLE_CORRUPT - eng "Operation cannot be performed. The table '%-.64s.%-.64s' is missing, corrupt or contains bad data" - spa "La operación no se puede realizar. Falta la tabla '%-.64s.%-.64s', está corrupta o contiene datos malos" + chi "无法执行操作。表'%-.64s。%-.64s'丢失,损坏或包含不良数据" + eng "Operation cannot be performed. The table '%-.64s.%-.64s' is missing, corrupt or contains bad data" + spa "La operación no se puede realizar. Falta la tabla '%-.64s.%-.64s', está corrupta o contiene datos malos" ER_TEMP_FILE_WRITE_FAILURE - eng "Temporary file write failure" - spa "Fallo al escribir fichero/archivo temporal" + chi "临时文件写入失败" + eng "Temporary file write failure" + spa "Fallo al escribir fichero/archivo temporal" ER_INNODB_FT_AUX_NOT_HEX_ID - eng "Upgrade index name failed, please use create index(alter table) algorithm copy to rebuild index" - spa "Falló la mejora de nombre de índice. Por favor, use una copia del algoritmo de create index(alter table) para reconstruir el índice" - - + chi "升级索引名称失败,请使用创建索引(ALTER TABLE)算法复制来重建索引" + eng "Upgrade index name failed, please use create index(alter table) algorithm copy to rebuild index" + spa "Falló la mejora de nombre de índice. Por favor, use una copia del algoritmo de create index(alter table) para reconstruir el índice" # -# MariaDB error messages section starts here # +# MariaDB error messages section starts here + # The following is here to allow us to detect if there was missing # error messages in the errmsg.sys file ER_LAST_MYSQL_ERROR_MESSAGE - eng "" + eng "" # MariaDB error numbers starts from 1900 start-error-number 1900 ER_UNUSED_18 - eng "" + eng "" ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED - eng "Function or expression '%s' cannot be used in the %s clause of %`s" - spa "La Función o expresión '%s' no se puede usar en la cláusula %s de %`s" + chi "函数或表达式'%s'不能用于%s的%`s" + eng "Function or expression '%s' cannot be used in the %s clause of %`s" + spa "La Función o expresión '%s' no se puede usar en la cláusula %s de %`s" ER_UNUSED_19 - eng "" + eng "" ER_PRIMARY_KEY_BASED_ON_GENERATED_COLUMN - eng "Primary key cannot be defined upon a generated column" - spa "La clave primaria no se puede definir sobre una columna generada" + chi "主键无法在生成的列上定义" + eng "Primary key cannot be defined upon a generated column" + spa "La clave primaria no se puede definir sobre una columna generada" ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN - eng "Key/Index cannot be defined on a virtual generated column" - spa "Key/Index no se puede definir en una columna virtual generada" + chi "无法在虚拟生成的列上定义键/索引" + eng "Key/Index cannot be defined on a virtual generated column" + spa "Key/Index no se puede definir en una columna virtual generada" ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN - eng "Cannot define foreign key with %s clause on a generated column" - spa "No puedo definir clave foránea con cláusula %s en una columna generada" + chi "无法在生成的列上定义%s子句的外键" + eng "Cannot define foreign key with %s clause on a generated column" + spa "No puedo definir clave foránea con cláusula %s en una columna generada" ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN - eng "The value specified for generated column '%s' in table '%s' has been ignored" - spa "El valor especificado para columna generada '%s' en la tabla '%s' ha sido ignorado" + chi "忽略了表'%s'中为生成的列'%s'指定的值已被忽略" + eng "The value specified for generated column '%s' in table '%s' has been ignored" + spa "El valor especificado para columna generada '%s' en la tabla '%s' ha sido ignorado" ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN - eng "This is not yet supported for generated columns" - spa "Esto no está aún soportado para columnas generadas" + chi "生成的列尚未支持这一点" + eng "This is not yet supported for generated columns" + spa "Esto no está aún soportado para columnas generadas" ER_UNUSED_20 - eng "" + eng "" ER_UNUSED_21 - eng "" + eng "" ER_UNSUPPORTED_ENGINE_FOR_GENERATED_COLUMNS - eng "%s storage engine does not support generated columns" - hindi "स्टोरेज इंजन %s COMPUTED कॉलम्स को सपोर्ट नहीं करता" - spa "El motor de almacenaje %s no soporta columnas generadas" + chi "%s存储引擎不支持生成的列" + eng "%s storage engine does not support generated columns" + hindi "स्टोरेज इंजन %s COMPUTED कॉलम्स को सपोर्ट नहीं करता" + spa "El motor de almacenaje %s no soporta columnas generadas" ER_UNKNOWN_OPTION - eng "Unknown option '%-.64s'" - hindi "अज्ञात विकल्प '%-.64s'" - spa "Opción desconocida '%-.64s'" + chi "未知选项'%-.64s'" + eng "Unknown option '%-.64s'" + hindi "अज्ञात विकल्प '%-.64s'" + spa "Opción desconocida '%-.64s'" ER_BAD_OPTION_VALUE - eng "Incorrect value '%-.64T' for option '%-.64s'" - hindi "गलत मान '%-.64T' विकल्प '%-.64s' के लिए" - spa "Valor incorrecto '%-.64T' para opción '%-.64s'" + chi "值不正确'%-.64T'选项'%-.64s'" + eng "Incorrect value '%-.64T' for option '%-.64s'" + hindi "गलत मान '%-.64T' विकल्प '%-.64s' के लिए" + spa "Valor incorrecto '%-.64T' para opción '%-.64s'" ER_UNUSED_6 - eng "You should never see it" - spa "Nunca debería vd de ver esto" + chi "你永远不应该看到它" + eng "You should never see it" + spa "Nunca debería vd de ver esto" ER_UNUSED_7 - eng "You should never see it" - spa "Nunca debería vd de ver esto" + chi "你永远不应该看到它" + eng "You should never see it" + spa "Nunca debería vd de ver esto" ER_UNUSED_8 - eng "You should never see it" - spa "Nunca debería vd de ver esto" + chi "你永远不应该看到它" + eng "You should never see it" + spa "Nunca debería vd de ver esto" ER_DATA_OVERFLOW 22003 + chi "转换'%-.128s'到%-.32s时溢出。值截断" eng "Got overflow when converting '%-.128s' to %-.32s. Value truncated" spa "Obtenido desbordamiento al convertir '%-.128s' a %-.32s. Valor truncado" ER_DATA_TRUNCATED 22003 + chi "转换'%-.128s'到%-.32s时值截断" eng "Truncated value '%-.128s' when converting to %-.32s" spa "Valor truncado '%-.128s' al convertir a %-.32s" ER_BAD_DATA 22007 + chi "非法值'%-.128s',在转换%-.32s时遇到" eng "Encountered illegal value '%-.128s' when converting to %-.32s" spa "Encontrado valor ilegal '%-.128s' al convertir a %-.32s" ER_DYN_COL_WRONG_FORMAT + chi "遇到非法格式的动态列字符串" eng "Encountered illegal format of dynamic column string" spa "Encontrado formato ilegal de cadena en columna dinámica" ER_DYN_COL_IMPLEMENTATION_LIMIT + chi "达到动态列实现限制" eng "Dynamic column implementation limit reached" spa "Alcanzado límite de implementación de columna dinámica" ER_DYN_COL_DATA 22007 + chi "非法值用作动态列函数的参数" eng "Illegal value used as argument of dynamic column function" spa "Valor ilegal usado como argumento de función de columna dinámica" ER_DYN_COL_WRONG_CHARSET + chi "动态列包含未知字符集" eng "Dynamic column contains unknown character set" spa "Columna dinámica contiene conjunto desconocido de caracteres" ER_ILLEGAL_SUBQUERY_OPTIMIZER_SWITCHES + chi "“in_to_exists”或'materialization'optimizer_switch标志中的至少一个必须是'开启'" eng "At least one of the 'in_to_exists' or 'materialization' optimizer_switch flags must be 'on'" hindi "कम से कम 'in_to_exists' या 'materialization' optimizer_switch फ्लैग 'ON' होना चाहिए" spa "Al menos una de las banderas de optimizer_switch 'in_to_exists' o 'materialization' debe de estar a 'on'" ER_QUERY_CACHE_IS_DISABLED + chi "查询缓存已禁用(调整大小或类似命令正在进行中);稍后重复此命令" eng "Query cache is disabled (resize or similar command in progress); repeat this command later" spa "Caché de consulta (query) desactivada (el comando ajustar o similar está en proceso); repite este comando más tarde" ER_QUERY_CACHE_IS_GLOBALY_DISABLED + chi "查询缓存全局禁用,您无法为此会话启用它" eng "Query cache is globally disabled and you can't enable it only for this session" hindi "क्वेरी कैश ग्लोबल स्तर पर DISABLED है और आप इसे केवल सत्र के लिए ENABLE नहीं कर सकते" spa "La caché de consulta (query) está desactivada de forma global y no puede activarla sólo para esta sesión" ER_VIEW_ORDERBY_IGNORED + chi "查看'%-.192s'.'%-.192s's ORDER BY子句被忽略,因为还有其他ORDER BY子句" eng "View '%-.192s'.'%-.192s' ORDER BY clause ignored because there is other ORDER BY clause already" spa "Cláusula de vista '%-.192s'.'%-.192s' ORDER BY ignorada porque ya hay otra clásula ORDER BY" ER_CONNECTION_KILLED 70100 + chi "连接被杀死" eng "Connection was killed" hindi "कनेक्शन को समाप्त कर दिया गया है" spa "La conexión fue matada" ER_UNUSED_12 + chi "你永远不应该看到它" eng "You should never see it" spa "Nunca debería vd de ver esto" ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION + chi "无法修改事务中的@@session.skip_replication" eng "Cannot modify @@session.skip_replication inside a transaction" spa "No puedo modificar @@session.skip_replication dentro de una transacción" ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION + chi "无法修改存储函数或触发器内的@@session.skip_replication" eng "Cannot modify @@session.skip_replication inside a stored function or trigger" spa "No puedo modificar @@session.skip_replication dentro de una función almacenada o disparador" ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT + chi "查询执行被中断。查询检查至少%llu行,超过限制行(%llu)。查询结果可能是不完整的" eng "Query execution was interrupted. The query examined at least %llu rows, which exceeds LIMIT ROWS EXAMINED (%llu). The query result may be incomplete" spa "Se ha interrumpido la ejecución de la consulta (query). La consulta (query) examinó al menos %llu filas, lo cual excede LIMIT ROWS EXAMINED (%llu). El resultado de la consulta (query) puede estar incompleto" ER_NO_SUCH_TABLE_IN_ENGINE 42S02 + chi "表'%-.192s.%-.192s'在引擎中不存在" eng "Table '%-.192s.%-.192s' doesn't exist in engine" hindi "टेबल '%-.192s.%-.192s' इंजन में मौजूद नहीं है" spa "La tabla '%-.192s.%-.192s' no existe en el motor" swe "Det finns ingen tabell som heter '%-.192s.%-.192s' i handlern" ER_TARGET_NOT_EXPLAINABLE + chi "目标未运行可解释的命令" eng "Target is not running an EXPLAINable command" spa "El objetivo no está ejecutando un comando EXPLAINable" ER_CONNECTION_ALREADY_EXISTS + chi "连接'%.*s'与现有连接'%.*s'冲突" eng "Connection '%.*s' conflicts with existing connection '%.*s'" spa "La conexión '%.*s' está en conflicto con la conexión existente '%.*s'" ER_MASTER_LOG_PREFIX + chi "Master'%.*s':" eng "Master '%.*s': " spa "Maestro (master) '%.*s': " ER_CANT_START_STOP_SLAVE + chi "不能%sSLAVE'%.*s'" eng "Can't %s SLAVE '%.*s'" spa "No puedo %s ESCLAVO '%.*s'" ER_SLAVE_STARTED + chi "SLAVE '%.*s'开始了" eng "SLAVE '%.*s' started" spa "ESCLAVO '%.*s' arrancado" ER_SLAVE_STOPPED + chi "slave'%.*s'停止了" eng "SLAVE '%.*s' stopped" spa "ESCLAVO '%.*s' parado" ER_SQL_DISCOVER_ERROR + chi "引擎%s无法发现表%`-.192s.%`-.192s,'%s'" eng "Engine %s failed to discover table %`-.192s.%`-.192s with '%s'" spa "El motor %s no pudo descubr la tabla %`-.192s.%`-.192s con '%s'" ER_FAILED_GTID_STATE_INIT + chi "初始化复制GTID状态失败" eng "Failed initializing replication GTID state" spa "Fallo inicializando estado de réplica GTID" ER_INCORRECT_GTID_STATE + chi "无法解析GTID列表" eng "Could not parse GTID list" spa "No pude analizar la lista GTID" ER_CANNOT_UPDATE_GTID_STATE + chi "无法更新Replication Slave GTID状态" eng "Could not update replication slave gtid state" spa "No pude actualizar estado gtid de esclavo de réplica" ER_DUPLICATE_GTID_DOMAIN - eng "GTID %u-%u-%llu and %u-%u-%llu conflict (duplicate domain id %u)" - spa "Conflicto GTID %u-%u-%llu y %u-%u-%llu (duplicado id de dominio %u)" + chi "GTID %u-%u-%llu和%u-%u-%llu冲突(重复域ID%u)" + eng "GTID %u-%u-%llu and %u-%u-%llu conflict (duplicate domain id %u)" + spa "Conflicto GTID %u-%u-%llu y %u-%u-%llu (duplicado id de dominio %u)" ER_GTID_OPEN_TABLE_FAILED + chi "未能打开%s.%s" eng "Failed to open %s.%s" ger "Öffnen von %s.%s fehlgeschlagen" spa "No pude abrir %s.%s" ER_GTID_POSITION_NOT_FOUND_IN_BINLOG - eng "Connecting slave requested to start from GTID %u-%u-%llu, which is not in the master's binlog" + chi "连接从站请求从GTID%u-%u-%llu开始,这不在Master的Binlog中" + eng "Connecting slave requested to start from GTID %u-%u-%llu, which is not in the master's binlog" spa "Se ha requerido que conectar esclavo arranque desde GTID %u-%u-%llu, el cual no está en el binlog del maestro (master)" ER_CANNOT_LOAD_SLAVE_GTID_STATE - eng "Failed to load replication slave GTID position from table %s.%s" + chi "无法从表%s中加载Replication Slave GTID位置。%s" + eng "Failed to load replication slave GTID position from table %s.%s" spa "No pude cargar posición GTID de esclavo de réplica desde la tabla %s.%s" ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG - eng "Specified GTID %u-%u-%llu conflicts with the binary log which contains a more recent GTID %u-%u-%llu. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos" + chi "指定的GTID%u-%u-%llu与二进制日志冲突,其中包含更新的GTID%u-%u-%llu。如果使用master_gtid_pos = current_pos,则Binlog位置将覆盖@@gtid_slave_pos的新值" + eng "Specified GTID %u-%u-%llu conflicts with the binary log which contains a more recent GTID %u-%u-%llu. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos" spa "El especificado GTID %u-%u-%llu está en conflicto con el historial (log) binario el cual contiene un más reciente GTID %u-%u-%llu. Si se usa MASTER_GTID_POS=CURRENT_POS, la posición de binlog sobreescribirá el nuevo valor de @@gtid_slave_pos" ER_MASTER_GTID_POS_MISSING_DOMAIN - eng "Specified value for @@gtid_slave_pos contains no value for replication domain %u. This conflicts with the binary log which contains GTID %u-%u-%llu. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos" + chi "指定值为@@gtid_slave_pos不包含复制域%u的值。这与二进制日志冲突,其中包含gtid%u-%u-%llu。如果使用master_gtid_pos = current_pos,则Binlog位置将覆盖@@ gtid_slave_pos的新值" + eng "Specified value for @@gtid_slave_pos contains no value for replication domain %u. This conflicts with the binary log which contains GTID %u-%u-%llu. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos" spa "El valor especificado para @@gtid_slave_pos no contiene valor para dominio de réplica %u. Esto está en conflicto con el historial (log) binario el cual contiene un GTID %u-%u-%llu. Si se usa MASTER_GTID_POS=CURRENT_POS, la posición binlog sobreescribirá el nuevo valor de @@gtid_slave_pos" ER_UNTIL_REQUIRES_USING_GTID - eng "START SLAVE UNTIL master_gtid_pos requires that slave is using GTID" + chi "启动从站,直到master_gtid_pos要求从站使用gtid" + eng "START SLAVE UNTIL master_gtid_pos requires that slave is using GTID" spa "START SLAVE UNTIL master_gtid_pos requiere que esclavo esté usando GTID" ER_GTID_STRICT_OUT_OF_ORDER - eng "An attempt was made to binlog GTID %u-%u-%llu which would create an out-of-order sequence number with existing GTID %u-%u-%llu, and gtid strict mode is enabled" + chi "尝试对Binlog GTID%u-%u-%llu进行,这将创建具有现有GTID%u-%u-%llu的订单无序序列号,并且启用了GTID严格模式" + eng "An attempt was made to binlog GTID %u-%u-%llu which would create an out-of-order sequence number with existing GTID %u-%u-%llu, and gtid strict mode is enabled" spa "Se ha intentado hacer binlog de GTID %u-%u-%llu lo cual crearía un número de secuencia fuera de orden con el existente GTID %u-%u-%llu y está activado gtid en modo estricto" ER_GTID_START_FROM_BINLOG_HOLE - eng "The binlog on the master is missing the GTID %u-%u-%llu requested by the slave (even though a subsequent sequence number does exist), and GTID strict mode is enabled" + chi "主机上的Binlog缺少从站所需请求的GTID%u-%u-%llu(即使存在后续的序列号),并启用GTID严格模式" + eng "The binlog on the master is missing the GTID %u-%u-%llu requested by the slave (even though a subsequent sequence number does exist), and GTID strict mode is enabled" spa "Al binlog del maestro (master) le falta el GTID %u-%u-%llu requerido por el esclavo (incluso aunque existe un número posterior de secuencia) y está activado GTID en modo estricto" ER_SLAVE_UNEXPECTED_MASTER_SWITCH - eng "Unexpected GTID received from master after reconnect. This normally indicates that the master server was replaced without restarting the slave threads. %s" + chi "重新连接后,从master收到意外的GTID。这通常表示在不重新启动从线程的情况下替换主服务器。%s." + eng "Unexpected GTID received from master after reconnect. This normally indicates that the master server was replaced without restarting the slave threads. %s" spa "Se ha recibido un GTID inesperado desde el maestro (master) tras reconectar. Esto indica normalmente que el servidor maestro (master) ha sido reemplazado sin rearrancar los hilos (threads) del esclavo. %s" ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO + chi "无法修改@@sessient.gtid_domain_id或@@session.gtid_seq_no" eng "Cannot modify @@session.gtid_domain_id or @@session.gtid_seq_no inside a transaction" spa "No puedo modificar @@session.gtid_domain_id o @@session.gtid_seq_no dentro de una transacción" ER_STORED_FUNCTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO + chi "无法修改@@sessient.gtid_domain_id或@@session.gtid_seq_no或触发器" eng "Cannot modify @@session.gtid_domain_id or @@session.gtid_seq_no inside a stored function or trigger" spa "No puedo modificar @@session.gtid_domain_id o @@session.gtid_seq_no dentro de una función almacenada o de un disparador" ER_GTID_POSITION_NOT_FOUND_IN_BINLOG2 - eng "Connecting slave requested to start from GTID %u-%u-%llu, which is not in the master's binlog. Since the master's binlog contains GTIDs with higher sequence numbers, it probably means that the slave has diverged due to executing extra erroneous transactions" + chi "连接从站请求从GTID%u-%u-%llu开始,这不在Master的Binlog中。由于Master的Binlog包含具有更高序列号的GTID,因此它可能意味着由于执行额外错误的交易,因此slave已经分歧" + eng "Connecting slave requested to start from GTID %u-%u-%llu, which is not in the master's binlog. Since the master's binlog contains GTIDs with higher sequence numbers, it probably means that the slave has diverged due to executing extra erroneous transactions" spa "Se ha requerido arrancar la conexión a esclavo desde GTID %u-%u-%llu, el cual no está en el binlog del maestro (master). Ya que el binlog del maestro (master) contiene GTIDs con números mayores de secuencia, es probable que indique que el esclavo diverge debido a ejecutar transacciones extra erróneas" ER_BINLOG_MUST_BE_EMPTY - eng "This operation is not allowed if any GTID has been logged to the binary log. Run RESET MASTER first to erase the log" + chi "如果已将任何GTID记录到二进制日志,则不允许此操作。首先运行RESET MASTER擦除日志" + eng "This operation is not allowed if any GTID has been logged to the binary log. Run RESET MASTER first to erase the log" spa "Esta operación no está permitida si cualquier GTID ha sido puesto en historial (log) binario. Ejecuta primero RESET MASTER para borrar el historial (log)" ER_NO_SUCH_QUERY + chi "未知查询ID:%lld" eng "Unknown query id: %lld" ger "Unbekannte Abfrage-ID: %lld" hindi "अज्ञात क्वेरी ID: %lld" rus "Неизвестный номер запроса: %lld" spa "Id desconocido de consulta (query): %lld" ER_BAD_BASE64_DATA - eng "Bad base64 data as position %u" + chi "错误Base64数据作为位置%u" + eng "Bad base64 data as position %u" spa "Datos base64 malos en posición %u" ER_INVALID_ROLE OP000 - eng "Invalid role specification %`s" - hindi "अमान्य रोल विनिर्देश %`s" - rum "Rolul %`s este invalid" - spa "Especificación inválida de rol %`s" + chi "无效的角色规范%`s" + eng "Invalid role specification %`s" + hindi "अमान्य रोल विनिर्देश %`s" + rum "Rolul %`s este invalid" + spa "Especificación inválida de rol %`s" ER_INVALID_CURRENT_USER 0L000 - eng "The current user is invalid" - hindi "वर्तमान यूज़र अमान्य है" - rum "Utilizatorul curent este invalid" + chi "当前用户无效" + eng "The current user is invalid" + hindi "वर्तमान यूज़र अमान्य है" + rum "Utilizatorul curent este invalid" spa "El usuario en curso no es válido" ER_CANNOT_GRANT_ROLE - eng "Cannot grant role '%s' to: %s" - hindi "रोल '%s', %s को प्रदान नहीं कर सकते" - rum "Rolul '%s' nu poate fi acordat catre: %s" + chi "无法将角色'%s'授予:%s" + eng "Cannot grant role '%s' to: %s" + hindi "रोल '%s', %s को प्रदान नहीं कर सकते" + rum "Rolul '%s' nu poate fi acordat catre: %s" spa "No puedo conceder rol '%s' a: %s" ER_CANNOT_REVOKE_ROLE - eng "Cannot revoke role '%s' from: %s" - hindi "रोल '%s', %s से हटाया नहीं जा सका" - rum "Rolul '%s' nu poate fi revocat de la: %s" + chi "无法撤消来自:%s的角色'%s'" + eng "Cannot revoke role '%s' from: %s" + hindi "रोल '%s', %s से हटाया नहीं जा सका" + rum "Rolul '%s' nu poate fi revocat de la: %s" spa "No puedo revocar rol '%s' desde: %s" ER_CHANGE_SLAVE_PARALLEL_THREADS_ACTIVE - eng "Cannot change @@slave_parallel_threads while another change is in progress" + chi "无法更改@@slave_parallel_threads,而另一个更改正在进行中" + eng "Cannot change @@slave_parallel_threads while another change is in progress" spa "No puedo cambiar @@slave_parallel_threads mientras otro cambio esté en proceso" ER_PRIOR_COMMIT_FAILED - eng "Commit failed due to failure of an earlier commit on which this one depends" + chi "由于早期提交的失败取决于依赖于哪个依赖性,提交失败" + eng "Commit failed due to failure of an earlier commit on which this one depends" spa "Ha fallado la acometida (commit) debido a un fallo previo en acometida (commit) de la que depende ésta" ER_IT_IS_A_VIEW 42S02 + chi "'%-.192s'是一个VIEW" eng "'%-.192s' is a view" hindi "'%-.192s' एक VIEW है" spa "'%-.192s' es una vista" ER_SLAVE_SKIP_NOT_IN_GTID - eng "When using parallel replication and GTID with multiple replication domains, @@sql_slave_skip_counter can not be used. Instead, setting @@gtid_slave_pos explicitly can be used to skip to after a given GTID position" + chi "使用并行复制和带有多个复制域的GTID时,无法使用@@SQL_SLAVE_SKIP_COUNTER。相反,可以使用明确设置@@gtid_slave_pos以在给定的gtid位置之后跳到" + eng "When using parallel replication and GTID with multiple replication domains, @@sql_slave_skip_counter can not be used. Instead, setting @@gtid_slave_pos explicitly can be used to skip to after a given GTID position" spa "Al usar réplica paralela y GTID con múltiples dominios de réplica, no se puede usar @@sql_slave_skip_counter. En su lugar, poner @@gtid_slave_pos de forma explícita se puede usar para saltar tras una posición GTID dada" ER_TABLE_DEFINITION_TOO_BIG + chi "表%`s的定义太大了" eng "The definition for table %`s is too big" hindi "टेबल %`s की परिभाषा बहुत बड़ी है" spa "La definición para la tabla %`s es demasiado larga" ER_PLUGIN_INSTALLED + chi "插件'%-.192s'已安装" eng "Plugin '%-.192s' already installed" hindi "प्लग-इन '%-.192s' पहले से ही इन्स्टॉल्ड है" rus "Плагин '%-.192s' уже установлен" spa "Ya instalado el enchufe (plugin) '%-.192s'" ER_STATEMENT_TIMEOUT 70100 + chi "查询执行中断(超出MAX_STATEMENT_TIME)" eng "Query execution was interrupted (max_statement_time exceeded)" spa "Se ha interrumpido la ejecución de una consulta (query) (excedido max_statement_time) ER_SUBQUERIES_NOT_SUPPORTED 42000 + chi "%s不支持子查询或存储的函数" eng "%s does not support subqueries or stored functions" spa "%s no soporta subconsultas (subqueries) o funciones almacenadas" ER_SET_STATEMENT_NOT_SUPPORTED 42000 + chi "系统变量%.200s无法在set语句中设置。“" eng "The system variable %.200s cannot be set in SET STATEMENT." spa "La variable del sistema %.200s no se puede poner en SET STATEMENT." ER_UNUSED_9 + chi "你永远不应该看到它" eng "You should never see it" spa "Nunca debería vd de ver esto" ER_USER_CREATE_EXISTS + chi "无法创建用户'%-.64s'@'%-.64s';它已经存在" eng "Can't create user '%-.64s'@'%-.64s'; it already exists" hindi "यूज़र '%-.64s'@'%-.64s' को नहीं बना सकते; यह पहले से ही मौजूद है" spa "No puedo crear usuario '%-.64s'@'%-.64s'; ya existe" ER_USER_DROP_EXISTS + chi "无法删除用户'%-.64s'@'%-.64s';它不存在" eng "Can't drop user '%-.64s'@'%-.64s'; it doesn't exist" hindi "यूज़र '%-.64s'@'%-.64s' को ड्रॉप नहीं कर सकते; यह मौजूद नहीं है" spa "No puedo eliminar usuario '%-.64s'@'%-.64s'; no existe" ER_ROLE_CREATE_EXISTS + chi "无法创建角色'%-.64s';它已经存在" eng "Can't create role '%-.64s'; it already exists" hindi "रोल '%-.64s' को नहीं बना सकते; यह पहले से ही मौजूद है" spa "No puedo crear rol '%-.64s'; ya existe" ER_ROLE_DROP_EXISTS + chi "无法删除'%-.64s'。它不存在" eng "Can't drop role '%-.64s'; it doesn't exist" hindi "रोल '%-.64s' को ड्रॉप नहीं कर सकते; यह मौजूद नहीं है" spa "No puedo eliminar rol '%-.64s'; no existe" ER_CANNOT_CONVERT_CHARACTER + chi "无法将'%s'字符0x转换为0x%-.64s到'%s'" eng "Cannot convert '%s' character 0x%-.64s to '%s'" spa "No puedo convertir '%s' carácter 0x%-.64s a '%s'" ER_INVALID_DEFAULT_VALUE_FOR_FIELD 22007 + chi "列的默认值不正确'%-.128T' '%.192s'" eng "Incorrect default value '%-.128T' for column '%.192s'" hindi "गलत डिफ़ॉल्ट मान '%-.128T' कॉलम '%.192s' के लिए" spa "Valor por defecto incorrecto '%-.128T' para columna '%.192s'" ER_KILL_QUERY_DENIED_ERROR - eng "You are not owner of query %lu" - ger "Sie sind nicht Eigentümer von Abfrage %lu" - hindi "आप क्वेरी %lu के OWNER नहीं हैं" - rus "Вы не являетесь владельцем запроса %lu" - spa "No eres el propietario de la consulta (query) %lu" + chi "你不是查询%lld的所有者" + eng "You are not owner of query %lld" + ger "Sie sind nicht Eigentümer von Abfrage %lld" + hindi "आप क्वेरी %lld के OWNER नहीं हैं" + rus "Вы не являетесь владельцем запроса %lld" + spa "No eres el propietario de la consulta (query) %lld" ER_NO_EIS_FOR_FIELD + chi "没有收集无关的统计信息列'%s'" eng "Engine-independent statistics are not collected for column '%s'" hindi "Engine-independent सांख्यिकी कॉलम '%s' के लिए एकत्रित नहीं किया जा रहा है" spa "No se han recolectado estadísticas independientes del motor para la columna '%s'" ukr "Незалежна від типу таблиці статистика не збирається для стовбця '%s'" ER_WARN_AGGFUNC_DEPENDENCE + chi "聚合函数'%-.192s)'SELECT#%d的属于选择#%d" eng "Aggregate function '%-.192s)' of SELECT #%d belongs to SELECT #%d" spa "La función de agregación '%-.192s)' del SELECT #%d pertenece a SELECT #%d" ukr "Агрегатна функція '%-.192s)' з SELECTу #%d належить до SELECTу #%d" WARN_INNODB_PARTITION_OPTION_IGNORED + chi "<%-.64s> innodb分区忽略的选项" eng "<%-.64s> option ignored for InnoDB partition" spa "<%-.64s> opción ignorada para partición InnoDB" @@ -8034,251 +8972,311 @@ skip-to-error-number 2000 skip-to-error-number 3000 ER_FILE_CORRUPT - eng "File %s is corrupted" - spa "El fichero/archivo %s está corrupto" + chi "文件%s已损坏" + eng "File %s is corrupted" + spa "El fichero/archivo %s está corrupto" ER_ERROR_ON_MASTER - eng "Query partially completed on the master (error on master: %d) and was aborted. There is a chance that your master is inconsistent at this point. If you are sure that your master is ok, run this query manually on the slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;. Query:'%s'" - spa "Consulta (query) completada de forma parcial en el maestro (master) (error en maestro (master): %d) y se ha abortado. Existe una posibilidad de que su maestro (master) esté inconsitente en este punto. Si está seguro de que su maestro (master) está ok, ejecute esta consulta (query) de forma manual en el esclavo y luego rearranque el esclavo mediante SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;. Consulta (query):'%s'" + chi "查询在主设备上部分完成(主设备:%d)并中止。你的master在这一点上有可能不一致。如果您确定您的主站是可以的,请在从站上手动运行此查询,然后使用SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; START SLAVE ;查询:'%s'" + eng "Query partially completed on the master (error on master: %d) and was aborted. There is a chance that your master is inconsistent at this point. If you are sure that your master is ok, run this query manually on the slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;. Query:'%s'" + spa "Consulta (query) completada de forma parcial en el maestro (master) (error en maestro (master): %d) y se ha abortado. Existe una posibilidad de que su maestro (master) esté inconsitente en este punto. Si está seguro de que su maestro (master) está ok, ejecute esta consulta (query) de forma manual en el esclavo y luego rearranque el esclavo mediante SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;. Consulta (query):'%s'" ER_INCONSISTENT_ERROR - eng "Query caused different errors on master and slave. Error on master: message (format)='%s' error code=%d; Error on slave:actual message='%s', error code=%d. Default database:'%s'. Query:'%s'" - spa "La consulta (query) ha ocasionado diferentes errores en el maestro (master) y en el esclavo. Error en maestro (master): mensaje (formato)='%s' código de error=%d; Error en esclavo: mensaje actual='%s', código de error=%d. Base de datos por defecto:'%s'. Consulta (query):'%s'" + chi "查询在主站和从站上引起了不同的错误。主站错误:消息(格式)='%s'错误代码=%d;从站错误:实际消息='%s',错误代码=%d。默认数据库:'%s'。查询:'%s'" + eng "Query caused different errors on master and slave. Error on master: message (format)='%s' error code=%d; Error on slave:actual message='%s', error code=%d. Default database:'%s'. Query:'%s'" + spa "La consulta (query) ha ocasionado diferentes errores en el maestro (master) y en el esclavo. Error en maestro (master): mensaje (formato)='%s' código de error=%d; Error en esclavo: mensaje actual='%s', código de error=%d. Base de datos por defecto:'%s'. Consulta (query):'%s'" ER_STORAGE_ENGINE_NOT_LOADED + chi "表'%s'的存储引擎'%s'没有加载。" eng "Storage engine for table '%s'.'%s' is not loaded." spa "El motor de almacenaje para la tabla '%s'.'%s' no ha sido cargado." ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER 0Z002 - eng "GET STACKED DIAGNOSTICS when handler not active" - spa "GET STACKED DIAGNOSTICS cuando el manejador no está activo" + chi "处理程序未激活时GET STACKED DIAGNOSTICS" + eng "GET STACKED DIAGNOSTICS when handler not active" + spa "GET STACKED DIAGNOSTICS cuando el manejador no está activo" ER_WARN_LEGACY_SYNTAX_CONVERTED - eng "%s is no longer supported. The statement was converted to %s." - spa "%s ya no está soportada. Se ha convertido la sentencia a %s." + chi "不再支持%s。该语句被转换为%s。" + eng "%s is no longer supported. The statement was converted to %s." + spa "%s ya no está soportada. Se ha convertido la sentencia a %s." ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN - eng "Statement is unsafe because it uses a fulltext parser plugin which may not return the same value on the slave." - spa "La sentencia no es segura porque usa un enchufe (plugin) analizador de fulltext que puede que no devuelva el mismo valor en el esclavo." + chi "语句不安全,因为它使用全文解析器插件,它可能不会在从站上返回相同的值。" + eng "Statement is unsafe because it uses a fulltext parser plugin which may not return the same value on the slave." + spa "La sentencia no es segura porque usa un enchufe (plugin) analizador de fulltext que puede que no devuelva el mismo valor en el esclavo." ER_CANNOT_DISCARD_TEMPORARY_TABLE - eng "Cannot DISCARD/IMPORT tablespace associated with temporary table" - spa "No puedo DISCARD/IMPORT espacio de tabla asociado con tabla temporal" + chi "无法丢弃与临时表相关联的/导入表空间" + eng "Cannot DISCARD/IMPORT tablespace associated with temporary table" + spa "No puedo DISCARD/IMPORT espacio de tabla asociado con tabla temporal" ER_FK_DEPTH_EXCEEDED - eng "Foreign key cascade delete/update exceeds max depth of %d." - spa "La cascada borrar/actualizar en clave foránea excede la máxima profundidad de %d." + chi "外键级联删除/更新超出了%d的最大深度。" + eng "Foreign key cascade delete/update exceeds max depth of %d." + spa "La cascada borrar/actualizar en clave foránea excede la máxima profundidad de %d." ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2 + chi "列数为%s.%s是错误的。预期的%d,找到%d。使用MariaDB%d创建,现在运行%d。请使用mariadb-upgrade来修复此错误。" eng "Column count of %s.%s is wrong. Expected %d, found %d. Created with MariaDB %d, now running %d. Please use mariadb-upgrade to fix this error." ger "Spaltenanzahl von %s.%s falsch. %d erwartet, aber %d erhalten. Erzeugt mit MariaDB %d, jetzt unter %d. Bitte benutzen Sie mariadb-upgrade, um den Fehler zu beheben" spa "El contador de columna de %s.%s está equivocado. Se esperaba %d, hallado %d, Creado con MariaDB %d, ahora ejecutando %d. Por favor, use mariadb-upgrade para arreglar este error." ER_WARN_TRIGGER_DOESNT_HAVE_CREATED - eng "Trigger %s.%s.%s does not have CREATED attribute." - spa "El disparador %s.%s.%s no tiene el atributo CREATED." + chi "触发器%s.%s.%s没有CREATE属性。" + eng "Trigger %s.%s.%s does not have CREATED attribute." + spa "El disparador %s.%s.%s no tiene el atributo CREATED." ER_REFERENCED_TRG_DOES_NOT_EXIST_MYSQL - eng "Referenced trigger '%s' for the given action time and event type does not exist." - spa "El disparador referenciado '%s' para el momento dado de acción y el tipo de evento no existe." + chi "引用的触发器'%s'用于给定的动作时间和事件类型不存在。" + eng "Referenced trigger '%s' for the given action time and event type does not exist." + spa "El disparador referenciado '%s' para el momento dado de acción y el tipo de evento no existe." ER_EXPLAIN_NOT_SUPPORTED + chi "EXPLAIN FOR CONNECTION仅支持SELECT/UPDATE/INSERT/DELETE/REPLACE" eng "EXPLAIN FOR CONNECTION command is supported only for SELECT/UPDATE/INSERT/DELETE/REPLACE" spa "El comando EXPLAIN FOR CONNECTION sólo se soporta para SELECT/UPDATE/INSERT/DELETE/REPLACE" ER_INVALID_FIELD_SIZE + chi "列'%-.192s'的大小无效。" eng "Invalid size for column '%-.192s'." spa "Tamaño inválido para columna '%-.192s'." ER_MISSING_HA_CREATE_OPTION + chi "表存储引擎'%-.64s'所找到的必备创建选项丢失" eng "Table storage engine '%-.64s' found required create option missing" spa "El motor hallado de almacenaje de tabla '%-.64s' requería de la opción de crear que falta" ER_ENGINE_OUT_OF_MEMORY - eng "Out of memory in storage engine '%-.64s'." - spa "Memoria agotada en motor de almacenaje '%-.64s'." + chi "存储引擎'%-.64s'中的内存不足。" + eng "Out of memory in storage engine '%-.64s'." + spa "Memoria agotada en motor de almacenaje '%-.64s'." ER_PASSWORD_EXPIRE_ANONYMOUS_USER - eng "The password for anonymous user cannot be expired." - spa "La contraseña para usuario anónimo no puede expirar." + chi "匿名用户的密码不能过期。" + eng "The password for anonymous user cannot be expired." + spa "La contraseña para usuario anónimo no puede expirar." ER_SLAVE_SQL_THREAD_MUST_STOP - eng "This operation cannot be performed with a running slave sql thread; run STOP SLAVE SQL_THREAD first" - spa "Esta operación no se puede realizar con hilo (thread) sql esclavo en ejecución; ejecuta STOP SLAVE SQL_THREAD primero" + chi "无法使用正在运行的从SQL线程执行此操作;首先运行STOP SLAVE SQL_THREAD" + eng "This operation cannot be performed with a running slave sql thread; run STOP SLAVE SQL_THREAD first" + spa "Esta operación no se puede realizar con hilo (thread) sql esclavo en ejecución; ejecuta STOP SLAVE SQL_THREAD primero" ER_NO_FT_MATERIALIZED_SUBQUERY - eng "Cannot create FULLTEXT index on materialized subquery" - spa "No puedo crear índice FULLTEXT en subconsulta (subquery) materializada" + chi "无法在物化的子查询上创建FullText索引" + eng "Cannot create FULLTEXT index on materialized subquery" + spa "No puedo crear índice FULLTEXT en subconsulta (subquery) materializada" ER_INNODB_UNDO_LOG_FULL - eng "Undo Log error: %s" - spa "Error de Historial (log) de Deshacer: %s" + chi "撤消日志错误:%s" + eng "Undo Log error: %s" + spa "Error de Historial (log) de Deshacer: %s" ER_INVALID_ARGUMENT_FOR_LOGARITHM 2201E - eng "Invalid argument for logarithm" - spa "Argumento inválido para logaritmo" + chi "对数的参数无效" + eng "Invalid argument for logarithm" + spa "Argumento inválido para logaritmo" ER_SLAVE_CHANNEL_IO_THREAD_MUST_STOP - eng "This operation cannot be performed with a running slave io thread; run STOP SLAVE IO_THREAD FOR CHANNEL '%s' first." - spa "Esta operación no se puede realizar con un hilo (thread) de e/s de esclavo en ejecución; ejecuta STOP SLAVE IO_THREAD FOR CHANNEL '%s' primero." + chi "无法使用正在运行的slave IO线程执行此操作;首先运行STOP SLAVE IO_THREAD FOR CHANNEL'%s'。" + eng "This operation cannot be performed with a running slave io thread; run STOP SLAVE IO_THREAD FOR CHANNEL '%s' first." + spa "Esta operación no se puede realizar con un hilo (thread) de e/s de esclavo en ejecución; ejecuta STOP SLAVE IO_THREAD FOR CHANNEL '%s' primero." ER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO - eng "This operation may not be safe when the slave has temporary tables. The tables will be kept open until the server restarts or until the tables are deleted by any replicated DROP statement. Suggest to wait until slave_open_temp_tables = 0." - spa "Esta operación puede no ser segura cuando el esclavo tenga tablas temporales. Las tablas serán mantenidas abiertas hasta que el servidor rearranque o hasta que las tablas sean borradas por cualquier sentencia DROP replicada. Se sugiere esperar hasta slave_open_temp_tables = 0." + chi "当从站具有临时表时,此操作可能不安全。表将保持打开,直到服务器重新启动或通过任何复制的DROP语句删除表。建议等到Slave_open_temp_tables = 0。" + eng "This operation may not be safe when the slave has temporary tables. The tables will be kept open until the server restarts or until the tables are deleted by any replicated DROP statement. Suggest to wait until slave_open_temp_tables = 0." + spa "Esta operación puede no ser segura cuando el esclavo tenga tablas temporales. Las tablas serán mantenidas abiertas hasta que el servidor rearranque o hasta que las tablas sean borradas por cualquier sentencia DROP replicada. Se sugiere esperar hasta slave_open_temp_tables = 0." ER_WARN_ONLY_MASTER_LOG_FILE_NO_POS - eng "CHANGE MASTER TO with a MASTER_LOG_FILE clause but no MASTER_LOG_POS clause may not be safe. The old position value may not be valid for the new binary log file." - spa "CHANGE MASTER TO mediante una cláusula MASTER_LOG_FILE pero sin existir cláusula MASTER_LOG_POS puede no ser seguro. El valor viejo de la posición puede no ser válido para el nuevo fichero/archivo binario de historial (log)." + chi "使用CHANGE MASTER TO master_log_file子句更改master,但没有master_log_pos子句可能不安全。旧位置值可能对新的二进制日志文件无效。" + eng "CHANGE MASTER TO with a MASTER_LOG_FILE clause but no MASTER_LOG_POS clause may not be safe. The old position value may not be valid for the new binary log file." + spa "CHANGE MASTER TO mediante una cláusula MASTER_LOG_FILE pero sin existir cláusula MASTER_LOG_POS puede no ser seguro. El valor viejo de la posición puede no ser válido para el nuevo fichero/archivo binario de historial (log)." ER_QUERY_TIMEOUT - eng "Query execution was interrupted, maximum statement execution time exceeded" - spa "Se ha interrumpido la ejecución de la consulta (query), se ha excedido el tiempo máximo de ejecución de sentencia" + chi "查询执行中断,超过了最大语句执行时间" + eng "Query execution was interrupted, maximum statement execution time exceeded" + spa "Se ha interrumpido la ejecución de la consulta (query), se ha excedido el tiempo máximo de ejecución de sentencia" ER_NON_RO_SELECT_DISABLE_TIMER - eng "Select is not a read only statement, disabling timer" - spa "Select no es una sentencia de sólo lectura, desactivando cronómetro" + chi "SELECT不是只读语句,禁用计时器" + eng "Select is not a read only statement, disabling timer" + spa "Select no es una sentencia de sólo lectura, desactivando cronómetro" ER_DUP_LIST_ENTRY - eng "Duplicate entry '%-.192s'." - spa "Entrada duplicada '%-.192s'." + chi "重复条目'%-.192s'。" + eng "Duplicate entry '%-.192s'." + spa "Entrada duplicada '%-.192s'." ER_SQL_MODE_NO_EFFECT - eng "'%s' mode no longer has any effect. Use STRICT_ALL_TABLES or STRICT_TRANS_TABLES instead." - spa "El modo '%s' ya no tiene efecto alguno. Use STRICT_ALL_TABLES o STRICT_TRANS_TABLES en su lugar" + chi "'%s'模式不再有任何效果。使用STRICT_ALL_TABLES或STRICT_TRANS_TABLES。" + eng "'%s' mode no longer has any effect. Use STRICT_ALL_TABLES or STRICT_TRANS_TABLES instead." + spa "El modo '%s' ya no tiene efecto alguno. Use STRICT_ALL_TABLES o STRICT_TRANS_TABLES en su lugar" ER_AGGREGATE_ORDER_FOR_UNION - eng "Expression #%u of ORDER BY contains aggregate function and applies to a UNION" - spa "La expresión #%u de ORDER BY contiene función de agregación y se aplica a UNION" + chi "表达式#%u ORDER BY包含聚合函数并适用于UNION" + eng "Expression #%u of ORDER BY contains aggregate function and applies to a UNION" + spa "La expresión #%u de ORDER BY contiene función de agregación y se aplica a UNION" ER_AGGREGATE_ORDER_NON_AGG_QUERY - eng "Expression #%u of ORDER BY contains aggregate function and applies to the result of a non-aggregated query" - spa "La expresión #%u de ORDER BY contiene función de agregación y se aplica al resultado de una consulta (query) no agregada" + chi "表达式#%u通过包含聚合函数,并适用于非聚合查询的结果" + eng "Expression #%u of ORDER BY contains aggregate function and applies to the result of a non-aggregated query" + spa "La expresión #%u de ORDER BY contiene función de agregación y se aplica al resultado de una consulta (query) no agregada" ER_SLAVE_WORKER_STOPPED_PREVIOUS_THD_ERROR - eng "Slave worker has stopped after at least one previous worker encountered an error when slave-preserve-commit-order was enabled. To preserve commit order, the last transaction executed by this thread has not been committed. When restarting the slave after fixing any failed threads, you should fix this worker as well." - spa "El trabajador esclavo se ha parado tras al menos encontrar un error en trabajador previo cuando slave-preserve-commit-order fue activado. Para preserver el orden de acometida (commit), la última transacción ejecutada por este hilo (thread) no se ha acometido (commit). Al rearrancar el esclavo tras arreglar cualquier hilo (thread) fallido, vd debería de arreglar este trabajador también" + chi "在启用了slave保存提交次序时至少有一个以前的工人遇到错误后,slave工作者已停止。要保留提交次序,此线程执行的最后一项事务尚未提交。在修复任何故障线程后重新启动从站时,您也应该修复此工作人。" + eng "Slave worker has stopped after at least one previous worker encountered an error when slave-preserve-commit-order was enabled. To preserve commit order, the last transaction executed by this thread has not been committed. When restarting the slave after fixing any failed threads, you should fix this worker as well." + spa "El trabajador esclavo se ha parado tras al menos encontrar un error en trabajador previo cuando slave-preserve-commit-order fue activado. Para preserver el orden de acometida (commit), la última transacción ejecutada por este hilo (thread) no se ha acometido (commit). Al rearrancar el esclavo tras arreglar cualquier hilo (thread) fallido, vd debería de arreglar este trabajador también" ER_DONT_SUPPORT_SLAVE_PRESERVE_COMMIT_ORDER - eng "slave_preserve_commit_order is not supported %s." - spa "slave_preserve_commit_order no está soportado %s." + chi "slave_preerve_commit_order不支持%s。" + eng "slave_preserve_commit_order is not supported %s." + spa "slave_preserve_commit_order no está soportado %s." ER_SERVER_OFFLINE_MODE - eng "The server is currently in offline mode" - spa "El servidor se encuentra actualmente en modo fuera de línea" + chi "服务器目前处于离线模式" + eng "The server is currently in offline mode" + spa "El servidor se encuentra actualmente en modo fuera de línea" ER_GIS_DIFFERENT_SRIDS - eng "Binary geometry function %s given two geometries of different srids: %u and %u, which should have been identical." - spa "La función binaria de geomertía %s ha dado dos geometrías de diferente srids: %u y %u, que deberían de haber sido idénticas" + chi "二进制几何函数%s给定两个不同SRID的几何形状:%u和%u,应该是相同的。" + eng "Binary geometry function %s given two geometries of different srids: %u and %u, which should have been identical." + spa "La función binaria de geomertía %s ha dado dos geometrías de diferente srids: %u y %u, que deberían de haber sido idénticas" ER_GIS_UNSUPPORTED_ARGUMENT - eng "Calling geometry function %s with unsupported types of arguments." - spa "Llamando a función de geometría %s con tipos de argumento no soportados." + chi "调用几何函数%s与不受支持类型的参数。" + eng "Calling geometry function %s with unsupported types of arguments." + spa "Llamando a función de geometría %s con tipos de argumento no soportados." ER_GIS_UNKNOWN_ERROR - eng "Unknown GIS error occurred in function %s." - spa "Ha ocurrido un error GIS desconocido en función %s." + chi "未知的GIS错误发生在功能%s中。" + eng "Unknown GIS error occurred in function %s." + spa "Ha ocurrido un error GIS desconocido en función %s." ER_GIS_UNKNOWN_EXCEPTION - eng "Unknown exception caught in GIS function %s." - spa "Excepción desconocida capturada en función GIS %s." + chi "在GIS功能%s中捕获的未知异常。" + eng "Unknown exception caught in GIS function %s." + spa "Excepción desconocida capturada en función GIS %s." ER_GIS_INVALID_DATA 22023 - eng "Invalid GIS data provided to function %s." - spa "Suministrados datos GIS inválidos a función %s." + chi "提供给功能%s的GIS数据无效。" + eng "Invalid GIS data provided to function %s." + spa "Suministrados datos GIS inválidos a función %s." ER_BOOST_GEOMETRY_EMPTY_INPUT_EXCEPTION - eng "The geometry has no data in function %s." - spa "La geometría no tiene datos en función %s." + chi "几何形状在功能%s中没有数据。" + eng "The geometry has no data in function %s." + spa "La geometría no tiene datos en función %s." ER_BOOST_GEOMETRY_CENTROID_EXCEPTION - eng "Unable to calculate centroid because geometry is empty in function %s." - spa "Imposible calcular centroid porque la geometría está vacía en la función %s." + chi "无法计算质心,因为在功能%s中几何为空。" + eng "Unable to calculate centroid because geometry is empty in function %s." + spa "Imposible calcular centroid porque la geometría está vacía en la función %s." ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION - eng "Geometry overlay calculation error: geometry data is invalid in function %s." - spa "Error de cálculo de superposición de geometría: el dato de geometría es inválido en la función %s." + chi "几何叠加计算错误:几何数据在功能%s中无效。" + eng "Geometry overlay calculation error: geometry data is invalid in function %s." + spa "Error de cálculo de superposición de geometría: el dato de geometría es inválido en la función %s." ER_BOOST_GEOMETRY_TURN_INFO_EXCEPTION - eng "Geometry turn info calculation error: geometry data is invalid in function %s." - spa "Error de cálculo de información devuelto: los datos de geometría son inválidos en la función %s." + chi "几何旋转信息计算错误:几何数据在功能%s中无效。" + eng "Geometry turn info calculation error: geometry data is invalid in function %s." + spa "Error de cálculo de información devuelto: los datos de geometría son inválidos en la función %s." ER_BOOST_GEOMETRY_SELF_INTERSECTION_POINT_EXCEPTION - eng "Analysis procedures of intersection points interrupted unexpectedly in function %s." - spa "Los procedimientos de análisis de puntos de intersección se interrumpieron inesperadamente en la función %s." + chi "在功能%s中出乎意料地中断交叉点的分析程序。" + eng "Analysis procedures of intersection points interrupted unexpectedly in function %s." + spa "Los procedimientos de análisis de puntos de intersección se interrumpieron inesperadamente en la función %s." ER_BOOST_GEOMETRY_UNKNOWN_EXCEPTION - eng "Unknown exception thrown in function %s." - spa "Excepción desconocida lanzada en la función %s." + chi "在功能%s中抛出的未知异常。" + eng "Unknown exception thrown in function %s." + spa "Excepción desconocida lanzada en la función %s." ER_STD_BAD_ALLOC_ERROR - eng "Memory allocation error: %-.256s in function %s." - spa "Error en adjudicación de memoria: %-.256s en la función %s." + chi "内存分配错误:%-.256s。函数%s。" + eng "Memory allocation error: %-.256s in function %s." + spa "Error en adjudicación de memoria: %-.256s en la función %s." ER_STD_DOMAIN_ERROR - eng "Domain error: %-.256s in function %s." - spa "Error en dominio: %-.256s en función %s." + chi "域名错误:%-.256s. 函数%s" + eng "Domain error: %-.256s in function %s." + spa "Error en dominio: %-.256s en función %s." ER_STD_LENGTH_ERROR - eng "Length error: %-.256s in function %s." - spa "Error de tamaño: %-.256s en función %s." + chi "长度误差:%-.256s函数%s。" + eng "Length error: %-.256s in function %s." + spa "Error de tamaño: %-.256s en función %s." ER_STD_INVALID_ARGUMENT - eng "Invalid argument error: %-.256s in function %s." - spa "Error de argumento inválido: %-.256s en función %s." + chi "无效的参数错误:%-.256s函数%s。" + eng "Invalid argument error: %-.256s in function %s." + spa "Error de argumento inválido: %-.256s en función %s." ER_STD_OUT_OF_RANGE_ERROR - eng "Out of range error: %-.256s in function %s." - spa "Error de fuera de rango: %-.256s en función %s." + chi "超出范围错误:%-.256s 函数%s。" + eng "Out of range error: %-.256s in function %s." + spa "Error de fuera de rango: %-.256s en función %s." ER_STD_OVERFLOW_ERROR - eng "Overflow error error: %-.256s in function %s." - spa "Error de desbordamiento: %-.256s en función %s." + chi "溢出错误:%-.256s。功能%s。" + eng "Overflow error: %-.256s in function %s." + spa "Error de desbordamiento: %-.256s en función %s." ER_STD_RANGE_ERROR - eng "Range error: %-.256s in function %s." - spa "Error de rango: %-.256s en función %s." + chi "范围错误:%-.256s函数%s。" + eng "Range error: %-.256s in function %s." + spa "Error de rango: %-.256s en función %s." ER_STD_UNDERFLOW_ERROR - eng "Underflow error: %-.256s in function %s." - spa "Error de refreno (underflow): %-.256s en la función %s." + chi "下溢错误:%-.256s函数%s。" + eng "Underflow error: %-.256s in function %s." + spa "Error de refreno (underflow): %-.256s en la función %s." ER_STD_LOGIC_ERROR - eng "Logic error: %-.256s in function %s." - spa "Error lógico: %-.256s en la función %s." + chi "逻辑错误:%-.256s 函数%s。" + eng "Logic error: %-.256s in function %s." + spa "Error lógico: %-.256s en la función %s." ER_STD_RUNTIME_ERROR - eng "Runtime error: %-.256s in function %s." - spa "Error en tiempo de ejecución: %-.256s en la función %s." + chi "运行时错误:%-.256s函数%s。" + eng "Runtime error: %-.256s in function %s." + spa "Error en tiempo de ejecución: %-.256s en la función %s." ER_STD_UNKNOWN_EXCEPTION - eng "Unknown exception: %-.384s in function %s." - spa "Excepción desconocida: %-.384s en la función %s." + chi "未知例外:%-.384s在函数%s中。" + eng "Unknown exception: %-.384s in function %s." + spa "Excepción desconocida: %-.384s en la función %s." ER_GIS_DATA_WRONG_ENDIANESS - eng "Geometry byte string must be little endian." - spa "La cadena de byte en Geometría debe de ser 'little endian'." + chi "几何字节字符串必须是小endian。" + eng "Geometry byte string must be little endian." + spa "La cadena de byte en Geometría debe de ser 'little endian'." ER_CHANGE_MASTER_PASSWORD_LENGTH - eng "The password provided for the replication user exceeds the maximum length of 32 characters" - spa "La contraseña suministrada para el usuario de réplica excede el tamaño máximo de 32 caracteres" + chi "为Replication User提供的密码超过32个字符的最大长度" + eng "The password provided for the replication user exceeds the maximum length of 32 characters" + spa "La contraseña suministrada para el usuario de réplica excede el tamaño máximo de 32 caracteres" ER_USER_LOCK_WRONG_NAME 42000 + chi "用户级锁名名称'%-.192s'不正确。" eng "Incorrect user-level lock name '%-.192s'." spa "Nombre de bloqueo incorrecto a nivel de usuario '%-.192s'." # Should be different from ER_LOCK_DEADLOCK since it doesn't cause implicit # rollback. Should not be mapped to SQLSTATE 40001 for the same reason. ER_USER_LOCK_DEADLOCK - eng "Deadlock found when trying to get user-level lock; try rolling back transaction/releasing locks and restarting lock acquisition." - spa "Hallado estancamiento (deadlock) al intentar obtener bloqueo a nivel de usuario; intente retroceder (roll back) bloqueos de transacción/entrega y rearranque la adquisición de bloqueo." + chi "在尝试获得用户级锁时发现死锁;尝试回滚交易/释放锁定并重新启动锁定采集。" + eng "Deadlock found when trying to get user-level lock; try rolling back transaction/releasing locks and restarting lock acquisition." + spa "Hallado estancamiento (deadlock) al intentar obtener bloqueo a nivel de usuario; intente retroceder (roll back) bloqueos de transacción/entrega y rearranque la adquisición de bloqueo." ER_REPLACE_INACCESSIBLE_ROWS - eng "REPLACE cannot be executed as it requires deleting rows that are not in the view" - spa "REPLACE no se puede ejecutar ya que requiere borrar filas que no están en la vista" + chi "无法执行REPLACE,因为它需要删除不在视图中的行" + eng "REPLACE cannot be executed as it requires deleting rows that are not in the view" + spa "REPLACE no se puede ejecutar ya que requiere borrar filas que no están en la vista" ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS - eng "Do not support online operation on table with GIS index" - spa "No soporta operación en línea en tabla con índice GIS" - + chi "不要支持使用GIS索引的表中的在线操作" + eng "Do not support online operation on table with GIS index" + spa "No soporta operación en línea en tabla con índice GIS" # MariaDB extra error numbers starts from 4000 skip-to-error-number 4000 @@ -8289,553 +9287,708 @@ ER_UNUSED_27 eng "This error never happens" spa "Este error nunca ocurre" ER_WITH_COL_WRONG_LIST + chi "使用列列表并选择字段列表具有不同的列计数" eng "WITH column list and SELECT field list have different column counts" spa "La lista de columnas de WITH y lista de campos de SELECT tienen diferentes contadores de columna" ER_TOO_MANY_DEFINITIONS_IN_WITH_CLAUSE + chi "WITH条款中的元素太多了" eng "Too many WITH elements in WITH clause" spa "Demasiados elementos WITH en cláusua WITH" ER_DUP_QUERY_NAME + chi "WITH子句重复查询名称%`-.64s" eng "Duplicate query name %`-.64s in WITH clause" spa "Nombre de consulta (query) %`-.64s duplicada en cláusula WITH" ER_RECURSIVE_WITHOUT_ANCHORS + chi "没有元素'%s'递归的锚点" eng "No anchors for recursive WITH element '%s'" spa "No hay anclajes para elemento WITH recursivo '%s'" ER_UNACCEPTABLE_MUTUAL_RECURSION + chi "锚定表'%s'不可接受的相互递归" eng "Unacceptable mutual recursion with anchored table '%s'" spa "Recursión mutua inaceptable con tabla anclada '%s'" ER_REF_TO_RECURSIVE_WITH_TABLE_IN_DERIVED + chi "物质化的衍生参考指向递归的WITH 表'%s'" eng "Reference to recursive WITH table '%s' in materialized derived" spa "Referencia recursiva con WITH tabla '%s' en derivada materializada" ER_NOT_STANDARD_COMPLIANT_RECURSIVE + chi "表'%s'R_WRONG_WINDOW_SPEC_NAME违反了递归定义的限制" eng "Restrictions imposed on recursive definitions are violated for table '%s'" - spa "Las restricciónes impuestas en definiciones recursivas son violadas para la tabla '%s'" ER_WRONG_WINDOW_SPEC_NAME - eng "Window specification with name '%s' is not defined" - spa "Especificación de ventana con nombre '%s' no definida" + chi "没有定义名称'%s'的窗口规范" + eng "Window specification with name '%s' is not defined" + spa "Especificación de ventana con nombre '%s' no definida" ER_DUP_WINDOW_NAME + chi "具有相同名称'%s'的多个窗口规范" eng "Multiple window specifications with the same name '%s'" spa "Múltiples especificaciones de ventana con el mismo nombre '%s'" ER_PARTITION_LIST_IN_REFERENCING_WINDOW_SPEC + chi "窗口规范引用另一个'%s'不能包含分区列表" eng "Window specification referencing another one '%s' cannot contain partition list" spa "La especificación de ventana que referencia a otra '%s' no puede contener una lista de partición" ER_ORDER_LIST_IN_REFERENCING_WINDOW_SPEC + chi "引用的窗口规范'%s'已包含次序列表" eng "Referenced window specification '%s' already contains order list" spa "La especificación de ventana referenciada '%s' ya contiene lista de orden" ER_WINDOW_FRAME_IN_REFERENCED_WINDOW_SPEC + chi "引用的窗口规范'%s'不能包含窗口框架" eng "Referenced window specification '%s' cannot contain window frame" spa "La especificación referenciada de ventana '%s' no puede contener marco de ventana" ER_BAD_COMBINATION_OF_WINDOW_FRAME_BOUND_SPECS + chi "窗框绑定规格的不可接受的组合" eng "Unacceptable combination of window frame bound specifications" spa "Combinación inaceptable de especificaciones ligadas a marco de ventana" ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION + chi "窗口函数仅在SELECT列表和ORDER BY子句中允许" eng "Window function is allowed only in SELECT list and ORDER BY clause" spa "La función de ventana sólo se permite en lista SELECT y en cláusula ORDER BY" ER_WINDOW_FUNCTION_IN_WINDOW_SPEC + chi "窗口规范中不允许窗口功能" eng "Window function is not allowed in window specification" spa "La función de ventana no está permitida en especificación de ventana" ER_NOT_ALLOWED_WINDOW_FRAME + chi "窗框不允许使用'%s'" eng "Window frame is not allowed with '%s'" spa "El marco de ventana no está permitido con '%s'" ER_NO_ORDER_LIST_IN_WINDOW_SPEC + chi "在“%s”的窗口规范中没有订单列表" eng "No order list in window specification for '%s'" spa "No exite lista de orden en especificación de ventana para '%s'" ER_RANGE_FRAME_NEEDS_SIMPLE_ORDERBY + chi "范围型框架需要单个排序键订购逐个条款" eng "RANGE-type frame requires ORDER BY clause with single sort key" spa "El marco tipo-RANGE requiere de la cláusula ORDER BY con clave única de clasificación" ER_WRONG_TYPE_FOR_ROWS_FRAME + chi "行类型框架需要整数" eng "Integer is required for ROWS-type frame" spa "Se requiere de un entero para marco tipo-ROWS" ER_WRONG_TYPE_FOR_RANGE_FRAME + chi "范围类型框架需要数字数据类型" eng "Numeric datatype is required for RANGE-type frame" spa "Se requiere de tipo de dato numérico para marco tipo-RANGE" ER_FRAME_EXCLUSION_NOT_SUPPORTED + chi "帧排除尚不支持" eng "Frame exclusion is not supported yet" spa "No se seporta aún la exclusión del marco" ER_WINDOW_FUNCTION_DONT_HAVE_FRAME + chi "此窗口功能可能没有窗口框架" eng "This window function may not have a window frame" spa "Esta función de ventana puede no tener un marco de ventana" ER_INVALID_NTILE_ARGUMENT + chi "NTILE的参数必须大于0" eng "Argument of NTILE must be greater than 0" spa "El argumento de NTILE debe de ser mayor de 0" ER_CONSTRAINT_FAILED 23000 + chi "CONSTRAINT %`s失败的%`-.192s。%`-.192s" eng "CONSTRAINT %`s failed for %`-.192s.%`-.192s" ger "CONSTRAINT %`s fehlgeschlagen: %`-.192s.%`-.192s" rus "проверка CONSTRAINT %`s для %`-.192s.%`-.192s провалилась" spa "No se cumple la RESTRICCIÓN %`s para %`-.192s.%`-.192s" ukr "Перевірка CONSTRAINT %`s для %`-.192s.%`-.192s не пройшла" ER_EXPRESSION_IS_TOO_BIG + chi "%s条款中的表达太大了" eng "Expression in the %s clause is too big" spa "La expresión en la cláusula %s es demasiado grande" ER_ERROR_EVALUATING_EXPRESSION + chi "获得了一个错误评估存储的表达式%s" eng "Got an error evaluating stored expression %s" spa "Obtenido error evaluando expresión almacenada %s" ER_CALCULATING_DEFAULT_VALUE + chi "计算默认值为%`s时出错" eng "Got an error when calculating default value for %`s" spa "Obtenido un error al calcular valor por defecto para %`s" ER_EXPRESSION_REFERS_TO_UNINIT_FIELD 01000 + chi "字段%`-.64s的表达指的是未初始化的字段%`s" eng "Expression for field %`-.64s is referring to uninitialized field %`s" spa "La expresión para campo %`-.64s se refiere a un campo sin inicializar %`s" ER_PARTITION_DEFAULT_ERROR + chi "只允许一个默认分区" eng "Only one DEFAULT partition allowed" spa "Sólo se permite una partición DEFAULT" ukr "Припустимо мати тільки один DEFAULT розділ" ER_REFERENCED_TRG_DOES_NOT_EXIST - eng "Referenced trigger '%s' for the given action time and event type does not exist" - spa "No existe disparador referenciado '%s' para el momento dado de acción y para el tipo de evento" + chi "给定动作时间和事件类型的引用触发'%s'不存在" + eng "Referenced trigger '%s' for the given action time and event type does not exist" + spa "No existe disparador referenciado '%s' para el momento dado de acción y para el tipo de evento" ER_INVALID_DEFAULT_PARAM + chi "此类参数使用不支持默认/忽略值" eng "Default/ignore value is not supported for such parameter usage" spa "El valor por defecto/ignorado no está soportado para tal utilización de parámetro" ukr "Значення за замовчуванням або ігнороване значення не підтримано для цього випадку використання параьетра" ER_BINLOG_NON_SUPPORTED_BULK + chi "仅支持基于行的复制,支持批量操作" eng "Only row based replication supported for bulk operations" spa "Sólo la réplica basada en fila es soportada para operaciones enormes" ER_BINLOG_UNCOMPRESS_ERROR + chi "解压压缩的binlog失败" eng "Uncompress the compressed binlog failed" spa "Ha fallado la descompresión del binlog comprimido" ER_JSON_BAD_CHR + chi "坏JSON,参数%d 函数'%s' 位置%d" eng "Broken JSON string in argument %d to function '%s' at position %d" spa "Cadena JSON rota en argumento %d para función '%s' en posición %d" ER_JSON_NOT_JSON_CHR + chi "变量%d出现禁止字符,函数'%s'在%d处" eng "Character disallowed in JSON in argument %d to function '%s' at position %d" spa "Carácter no permitido en JSON en argumento %d para función '%s' en la posición %d" ER_JSON_EOS + chi "JSON文本中的意外结尾,参数%d 函数'%s'" eng "Unexpected end of JSON text in argument %d to function '%s'" spa "Fin inesperado de texto JSON en argumento %d a función '%s'" ER_JSON_SYNTAX + chi "JSON文本语法错误 参数%d 函数'%s' 位置%d" eng "Syntax error in JSON text in argument %d to function '%s' at position %d" spa "Error de sintaxis en texto JSON en argumento %d a función '%s' en la posición %d" ER_JSON_ESCAPING + chi "JSON文本中逸出不正确 参数%d 函数'%s' 位置%d" eng "Incorrect escaping in JSON text in argument %d to function '%s' at position %d" spa "Incorrecta escapatoria en texto JSON en argumento %d a función '%s' en la posicón %d" ER_JSON_DEPTH - eng "Limit of %d on JSON nested strucures depth is reached in argument %d to function '%s' at position %d" + chi "超过JSON嵌套深度的%d限制 参数%d 函数'%s' 位置%d的" + eng "Limit of %d on JSON nested structures depth is reached in argument %d to function '%s' at position %d" spa "El límite de %d en profundidad de estructuras JSON anidadas se ha alcanzado en argumento %d a función '%s' en la posición %d" ER_JSON_PATH_EOS + chi "JSON文本路径错误 参数%d 函数'%s'" eng "Unexpected end of JSON path in argument %d to function '%s'" spa "Fin inesperado de ruta JSON en argumento %d a función '%s'" ER_JSON_PATH_SYNTAX + chi "JSON路径语法错误 参数%d 函数'%s' 位置%d" eng "Syntax error in JSON path in argument %d to function '%s' at position %d" spa "Error de sintaxis en ruta JSON en argumento %d a función '%s' en la posición %d" ER_JSON_PATH_DEPTH + chi "JSON路径深度上限达到:%d 参数%d 函数'%s' 位置%d" eng "Limit of %d on JSON path depth is reached in argument %d to function '%s' at position %d" spa "El límite de %d en profundidad de ruta JSON se ha alcanzado en argumento %d a función '%s' en la posición %d" ER_JSON_PATH_NO_WILDCARD + chi "JSON路径中的通配符不允许 参数%d 函数'%s'" eng "Wildcards in JSON path not allowed in argument %d to function '%s'" spa "Comodines en ruta JSON no permitidos en argumento %d a función '%s'" ER_JSON_PATH_ARRAY + chi "JSON路径应当以排列为终 参数%d 函数'%s'" eng "JSON path should end with an array identifier in argument %d to function '%s'" spa "La ruta JSON debería de terminar con identificador de arreglo en argumento %d a función '%s'" ER_JSON_ONE_OR_ALL + chi "函数'%s'的第二个参数必须是'一个'或'全部'" eng "Argument 2 to function '%s' must be "one" or "all"." spa "El argumento 2 a función '%s' debe de ser "one" o "all"." ER_UNSUPPORTED_COMPRESSED_TABLE + chi "CREATE TEMPORARY TABLE 不允许用ROW_FORMAT=COMPRESSED或KEY_BLOCK_SIZE" eng "InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE." spa "InnoDB rechaza grabar en tablas con ROW_FORMAT=COMPRESSED o KEY_BLOCK_SIZE." ER_GEOJSON_INCORRECT + chi "为st_geomfromgeojson函数指定了不正确的GeoJSON格式。" eng "Incorrect GeoJSON format specified for st_geomfromgeojson function." spa "Especficado formato GeoJSON incorrecto para función st_geomfromgeojson." ER_GEOJSON_TOO_FEW_POINTS + chi "Geojson格式不正确 - Linestring指定的太少点。" eng "Incorrect GeoJSON format - too few points for linestring specified." spa "Formato GeoJSON incorrecto - demasiados pocos puntos especificados para linestring." ER_GEOJSON_NOT_CLOSED + chi "Geojson格式不正确 - 多边形未关闭。" eng "Incorrect GeoJSON format - polygon not closed." spa "Formato GeoJSON incorrect - polígono no cerrado." ER_JSON_PATH_EMPTY + chi "path表达式'$'不允许在参数%d中允许运行'%s'。" eng "Path expression '$' is not allowed in argument %d to function '%s'." spa "La expresión de ruta '$' no está permitida en argumento %d a función '%s'." ER_SLAVE_SAME_ID + chi "与此从站相同的server_uuId / server_id的从站已连接到主设备" eng "A slave with the same server_uuid/server_id as this slave has connected to the master" spa "Un esclavo con el mismo server_uuid/server_id que este esclavo se ha conectado al maestro (master)" ER_FLASHBACK_NOT_SUPPORTED + chi "闪回不支持%s%s" eng "Flashback does not support %s %s" spa "Retrospectiva no soporta %s %s" - - -# +# # MyRocks error messages # ER_KEYS_OUT_OF_ORDER - eng "Keys are out order during bulk load" - spa "Claves desordenadas durante carga enorme" + chi "钥匙在散装负载期间出现订单" + eng "Keys are out order during bulk load" + spa "Claves desordenadas durante carga enorme" ER_OVERLAPPING_KEYS - eng "Bulk load rows overlap existing rows" - spa "La carga enorme de filas se superpone con filas existentes" + chi "批量负载行重叠现有行" + eng "Bulk load rows overlap existing rows" + spa "La carga enorme de filas se superpone con filas existentes" ER_REQUIRE_ROW_BINLOG_FORMAT - eng "Can't execute updates on master with binlog_format != ROW." - spa "No puedo ejecutar actualizaciones en maestro (master) con binlog_format != ROW." + chi "binlog_format != ROW时无法在master上执行更新" + eng "Can't execute updates on master with binlog_format != ROW." + spa "No puedo ejecutar actualizaciones en maestro (master) con binlog_format != ROW." ER_ISOLATION_MODE_NOT_SUPPORTED - eng "MyRocks supports only READ COMMITTED and REPEATABLE READ isolation levels. Please change from current isolation level %s" - spa "MyRocks soporta sólo niveles de aislamiento READ COMMITTED y REPEATABLE READ. Por favor, cambie desde nivel de aislamiento actual %s" + chi "MyRocks仅支持读取承诺和可重复读取隔离级别。请从当前隔离级别的%s改变" + eng "MyRocks supports only READ COMMITTED and REPEATABLE READ isolation levels. Please change from current isolation level %s" + spa "MyRocks soporta sólo niveles de aislamiento READ COMMITTED y REPEATABLE READ. Por favor, cambie desde nivel de aislamiento actual %s" ER_ON_DUPLICATE_DISABLED - eng "When unique checking is disabled in MyRocks, INSERT,UPDATE,LOAD statements with clauses that update or replace the key (i.e. INSERT ON DUPLICATE KEY UPDATE, REPLACE) are not allowed. Query: %s" - spa "Al desactivar chequeo de único en MyRocks, las sentencias INSERT, UPDATE, LOAD con cláusulas que actualizan o reemplazan la clave (p.ej. INSERT ON DUPLICATE KEY UPDATE, REPLACE) no se permiten. Consulte (query): %s" + chi "当在MyRocks禁用唯一检查时,INSERT,UPDATE, LOAD,使用Clauses更新或替换索引的子句(即,在重复的重复键更新,替换)中,不允许使用。查询:%s" + eng "When unique checking is disabled in MyRocks, INSERT,UPDATE,LOAD statements with clauses that update or replace the key (i.e. INSERT ON DUPLICATE KEY UPDATE, REPLACE) are not allowed. Query: %s" + spa "Al desactivar chequeo de único en MyRocks, las sentencias INSERT, UPDATE, LOAD con cláusulas que actualizan o reemplazan la clave (p.ej. INSERT ON DUPLICATE KEY UPDATE, REPLACE) no se permiten. Consulte (query): %s" ER_UPDATES_WITH_CONSISTENT_SNAPSHOT - eng "Can't execute updates when you started a transaction with START TRANSACTION WITH CONSISTENT [ROCKSDB] SNAPSHOT." - spa "No puedo ejecutar actualizaciones cuando has iniciado una transacción mediante START TRANSACTION WITH CONSISTENT [ROCKSDB] SNAPSHOT." + chi "START TRANSACTION WITH CONSISTENT [ROCKSDB] SNAPSHOT时,无法执行更新。" + eng "Can't execute updates when you started a transaction with START TRANSACTION WITH CONSISTENT [ROCKSDB] SNAPSHOT." + spa "No puedo ejecutar actualizaciones cuando has iniciado una transacción mediante START TRANSACTION WITH CONSISTENT [ROCKSDB] SNAPSHOT." ER_ROLLBACK_ONLY - eng "This transaction was rolled back and cannot be committed. Only supported operation is to roll it back, so all pending changes will be discarded. Please restart another transaction." - spa "Esta transacción se ha retrocedido (rolled back) y no puede ser acometida (commit). La única operación soportada es retroceder (roll back), de tal forma que se descartarán todos los cambios pendientes. Por favor, rearranque otra transacción." + chi "此交易回滚并无法承诺。只支持支持的操作是滚动,因此将丢弃所有待处理的更改。请重新启动其他事务。" + eng "This transaction was rolled back and cannot be committed. Only supported operation is to roll it back, so all pending changes will be discarded. Please restart another transaction." + spa "Esta transacción se ha retrocedido (rolled back) y no puede ser acometida (commit). La única operación soportada es retroceder (roll back), de tal forma que se descartarán todos los cambios pendientes. Por favor, rearranque otra transacción." ER_ROLLBACK_TO_SAVEPOINT - eng "MyRocks currently does not support ROLLBACK TO SAVEPOINT if modifying rows." - spa "MyRocks en este momento no soporta ROLLBACK TO SAVEPOINT si se están modificando filas." + chi "如果修改行,MyRocks目前不支持保存点的回滚。" + eng "MyRocks currently does not support ROLLBACK TO SAVEPOINT if modifying rows." + spa "MyRocks en este momento no soporta ROLLBACK TO SAVEPOINT si se están modificando filas." ER_ISOLATION_LEVEL_WITH_CONSISTENT_SNAPSHOT - eng "Only REPEATABLE READ isolation level is supported for START TRANSACTION WITH CONSISTENT SNAPSHOT in RocksDB Storage Engine." - spa "Sólo el nivel de aislamiento REPEATABLE READ se soporta para START TRANSACTION WITH CONSISTENT SNAPSHOT en Motor de Almacenaje RocksDB." + chi "在RockSDB存储引擎中,START TRANSACTION WITH CONSISTENT SNAPSHOT 只支持REPEATABLE READ隔离" + eng "Only REPEATABLE READ isolation level is supported for START TRANSACTION WITH CONSISTENT SNAPSHOT in RocksDB Storage Engine." + spa "Sólo el nivel de aislamiento REPEATABLE READ se soporta para START TRANSACTION WITH CONSISTENT SNAPSHOT en Motor de Almacenaje RocksDB." ER_UNSUPPORTED_COLLATION - eng "Unsupported collation on string indexed column %s.%s Use binary collation (%s)." - spa "Cotejo (collation) no soportado en columna indizada de cadena %s.%s Use cotejo binario (%s)." + chi "字符串索引列%s的不受支持的归类。%s使用二进制校构(%s)。" + eng "Unsupported collation on string indexed column %s.%s Use binary collation (%s)." + spa "Cotejo (collation) no soportado en columna indizada de cadena %s.%s Use cotejo binario (%s)." ER_METADATA_INCONSISTENCY - eng "Table '%s' does not exist, but metadata information exists inside MyRocks. This is a sign of data inconsistency. Please check if '%s.frm' exists, and try to restore it if it does not exist." - spa "La tabla '%s' no existe, pero existe información de metadatos dentro de MyRocks. Esto es una señal de datos inconsistentes. Por favor, revise si existe '%s.frm' e intente restaurarla si no existe." + chi "表'%s'不存在,但MyRocks内存存在元数据信息。这是数据不一致的标志。请检查是否存在'%s.frm',并尝试恢复如果它不存在。" + eng "Table '%s' does not exist, but metadata information exists inside MyRocks. This is a sign of data inconsistency. Please check if '%s.frm' exists, and try to restore it if it does not exist." + spa "La tabla '%s' no existe, pero existe información de metadatos dentro de MyRocks. Esto es una señal de datos inconsistentes. Por favor, revise si existe '%s.frm' e intente restaurarla si no existe." ER_CF_DIFFERENT - eng "Column family ('%s') flag (%d) is different from an existing flag (%d). Assign a new CF flag, or do not change existing CF flag." - spa "La familia de columna ('%s') bandera (%d) es diferente de una bandera existente (%d). Asigne una nueva bandera CF o no cambie la bandera CF." + chi "列族('%s')标志(%d)与现有标志(%d)不同。分配新的CF标志,或者不要更改现有的CF标志。" + eng "Column family ('%s') flag (%d) is different from an existing flag (%d). Assign a new CF flag, or do not change existing CF flag." + spa "La familia de columna ('%s') bandera (%d) es diferente de una bandera existente (%d). Asigne una nueva bandera CF o no cambie la bandera CF." ER_RDB_TTL_DURATION_FORMAT - eng "TTL duration (%s) in MyRocks must be an unsigned non-null 64-bit integer." - spa "La duración de TTL (%s) en MyRocks debe de ser un entero sin signo no-null de 64-bit." + chi "Myrocks中的TTL持续时间(%s)必须是无符号非空64位整数。" + eng "TTL duration (%s) in MyRocks must be an unsigned non-null 64-bit integer." + spa "La duración de TTL (%s) en MyRocks debe de ser un entero sin signo no-null de 64-bit." ER_RDB_STATUS_GENERAL + chi "状态误差%d从RockSDB收到:%s" eng "Status error %d received from RocksDB: %s" spa "Recibido error de estado %d desde RocksDB: %s" ER_RDB_STATUS_MSG + chi "%s,状态误差%d从rocksdb收到:%s" eng "%s, Status error %d received from RocksDB: %s" spa "%s, Recibido error de estado %d desde RocksDB: %s" ER_RDB_TTL_UNSUPPORTED - eng "TTL support is currently disabled when table has a hidden PK." - spa "El soporte TTL está desactivado en este momento cuando la tabla tiene una PK oculta." + chi "当表有隐藏的PK时,目前禁用TTL支持。" + eng "TTL support is currently disabled when table has a hidden PK." + spa "El soporte TTL está desactivado en este momento cuando la tabla tiene una PK oculta." ER_RDB_TTL_COL_FORMAT - eng "TTL column (%s) in MyRocks must be an unsigned non-null 64-bit integer, exist inside the table, and have an accompanying ttl duration." - spa "La columna TTL (%s) en MyRocks debe de ser un entero sin signo no-null de 64-bit, debe de existir dentro de la tabla y debe de tener una duración ttl acompañante." + chi "Myrocks中的TTL列(%s)必须是一个无符号的非空64位整数,存在于表内,并具有伴随的TTL持续时间。" + eng "TTL column (%s) in MyRocks must be an unsigned non-null 64-bit integer, exist inside the table, and have an accompanying ttl duration." + spa "La columna TTL (%s) en MyRocks debe de ser un entero sin signo no-null de 64-bit, debe de existir dentro de la tabla y debe de tener una duración ttl acompañante." ER_PER_INDEX_CF_DEPRECATED - eng "The per-index column family option has been deprecated" - spa "La opcion de familia de columna por-índice está obsoleta" + chi "已弃用每个索引列族选项" + eng "The per-index column family option has been deprecated" + spa "La opcion de familia de columna por-índice está obsoleta" ER_KEY_CREATE_DURING_ALTER - eng "MyRocks failed creating new key definitions during alter." - spa "MyRocks no pudo crear nuevas definiciones de clave durante 'alter'." + chi "MyRocks在Alter期间创建新的索引定义失败。" + eng "MyRocks failed creating new key definitions during alter." + spa "MyRocks no pudo crear nuevas definiciones de clave durante 'alter'." ER_SK_POPULATE_DURING_ALTER - eng "MyRocks failed populating secondary key during alter." - spa "MyRocks falló al poblar clave secundaria duante el 'alter'." - + chi "MyRocks在Alter期间失败填充次要索引。" + eng "MyRocks failed populating secondary key during alter." + spa "MyRocks falló al poblar clave secundaria duante el 'alter'." # MyRocks messages end + ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG - eng "Window functions can not be used as arguments to group functions." - spa "Las funciones de ventana no se pueden usar como argumentos para agrupar funciones." + chi "窗口函数不能用作组函数的参数。" + eng "Window functions can not be used as arguments to group functions." + spa "Las funciones de ventana no se pueden usar como argumentos para agrupar funciones." ER_NET_OK_PACKET_TOO_LARGE - eng "OK packet too large" - spa "Paquete OK demasiado grande" + chi "好的包太大了" + eng "OK packet too large" + spa "Paquete OK demasiado grande" ER_GEOJSON_EMPTY_COORDINATES + chi "Geojson格式不正确 - 空的'coordinates'阵列。" eng "Incorrect GeoJSON format - empty 'coordinates' array." spa "Formato GeoJSON incorrecto - arreglo vacío de coordenadas." ER_MYROCKS_CANT_NOPAD_COLLATION - eng "MyRocks doesn't currently support collations with \"No pad\" attribute." - spa "MyRocks no soporta en la actualidad cotejos con atributo \"No pad\"." + chi "MyRocks目前不支持与“No Pad \”属性的归类。" + eng "MyRocks doesn't currently support collations with \"No pad\" attribute." + spa "MyRocks no soporta en la actualidad cotejos con atributo \"No pad\"." ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION + chi "非法参数数据类型%s和%s为操作'%s'" eng "Illegal parameter data types %s and %s for operation '%s'" spa "Tipos de datos de parámetro ilegales %s y %s para operación '%s'" ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION + chi "非法参数数据类型%s用于操作'%s'" eng "Illegal parameter data type %s for operation '%s'" spa "Tipo de dato %s de parámetro ilegal para operación '%s'" ER_WRONG_PARAMCOUNT_TO_CURSOR 42000 + chi "对Cursor的参数计数不正确'%-.192s'" eng "Incorrect parameter count to cursor '%-.192s'" spa "Contador incorrecto de parámetro para cursor '%-.192s'" rus "Некорректное количество параметров для курсора '%-.192s'" ER_UNKNOWN_STRUCTURED_VARIABLE + chi "未知的结构系统变量或行程变量'%-.*s'" eng "Unknown structured system variable or ROW routine variable '%-.*s'" spa "Variable de sistema con estructura desconocida o variable de rutina ROW '%-.*s'" ER_ROW_VARIABLE_DOES_NOT_HAVE_FIELD + chi "行变量'%-.192s'没有字段'%-.192s'" eng "Row variable '%-.192s' does not have a field '%-.192s'" spa "La variable de fila '%-.192s' no tiene un campo '%-.192s'" ER_END_IDENTIFIER_DOES_NOT_MATCH + chi "结束标识符'%-.192s'不匹配'%-.192s'" eng "END identifier '%-.192s' does not match '%-.192s'" spa "Identificador END '%-.192s' no coincide con '%-.192s'" ER_SEQUENCE_RUN_OUT + chi "序列'%-.64s。%-.64s'已经用完了" eng "Sequence '%-.64s.%-.64s' has run out" spa "La secuencia '%-.64s.%-.64s' se ha agotado" ER_SEQUENCE_INVALID_DATA - eng "Sequence '%-.64s.%-.64s' values are conflicting" - spa "Los valores de secuencia '%-.64s.%-.64s' son conflictivos" + chi "序列'%-.64s。%-.64s的值冲突" + eng "Sequence '%-.64s.%-.64s' has out of range value for options" + spa "La secuencia '%-.64s.%-.64s' tiene un valor fuera de rango para las opciones" ER_SEQUENCE_INVALID_TABLE_STRUCTURE + chi "序列'%-.64s。%-.64s'表结构无效(%s)" eng "Sequence '%-.64s.%-.64s' table structure is invalid (%s)" spa "La estuctura de tabla de secuencia '%-.64s.%-.64s' es inválida (%s)" ER_SEQUENCE_ACCESS_ERROR + chi "序列'%-.64s。%-.64s的访问错误" eng "Sequence '%-.64s.%-.64s' access error" spa "Error en acceso a secuencia '%-.64s.%-.64s'" ER_SEQUENCE_BINLOG_FORMAT eng "Sequences requires binlog_format mixed or row" spa "Las secuencias requieren binlog_format mixto o fila" ER_NOT_SEQUENCE 42S02 + chi "'%-.64s。%-.64s'不是序列" eng "'%-.64s.%-.64s' is not a SEQUENCE" spa "'%-.64s.%-.64s' no es una SECUENCIA" ER_NOT_SEQUENCE2 42S02 + chi "'%-.192s'不是序列" eng "'%-.192s' is not a SEQUENCE" spa "'%-.192s' no es una SECUENCIA" ER_UNKNOWN_SEQUENCES 42S02 + chi "未知序列:'%-.300s'" eng "Unknown SEQUENCE: '%-.300s'" spa "SECUENCIA desconocida: '%-.300s'" ER_UNKNOWN_VIEW 42S02 + chi "未知视图:'%-.300s'" eng "Unknown VIEW: '%-.300s'" spa "VISTA desconocida: '%-.300s'" ER_WRONG_INSERT_INTO_SEQUENCE + chi "错误插入序列。人们只能将单表插入到序列对象(与mariadb-dump)中进行。如果要更改序列,请使用更改序列。" eng "Wrong INSERT into a SEQUENCE. One can only do single table INSERT into a sequence object (like with mariadb-dump). If you want to change the SEQUENCE, use ALTER SEQUENCE instead." spa "INSERT equivocado dentro de SEQUENCE. Uno sólo puede hacer INSERT único en tabla dentro de un objeto de secuencia (como con volcado-mariadb). Si desea cambiar la SECUENCIA, use ALTER SEQUENCE en su lugar." ER_SP_STACK_TRACE + chi "在%u中以%s" eng "At line %u in %s" spa "En la línea %u en %s" ER_PACKAGE_ROUTINE_IN_SPEC_NOT_DEFINED_IN_BODY + chi "在包规范中声明子程序'%-.192s',但未在包主体中定义" eng "Subroutine '%-.192s' is declared in the package specification but is not defined in the package body" spa "La subrutina '%-.192s' está declarada en la especificación del paquete pero no está definida en el cuerpo del paquete" ER_PACKAGE_ROUTINE_FORWARD_DECLARATION_NOT_DEFINED + chi "子程序'%-.192s'具有前向声明但未定义" eng "Subroutine '%-.192s' has a forward declaration but is not defined" spa "La subrutina '%-.192s' tiene una declaración adelantada pero no está definida" ER_COMPRESSED_COLUMN_USED_AS_KEY - eng "Compressed column '%-.192s' can't be used in key specification" - spa "Una columna comprimida '%-.192s' no se puede usar en especificación de clave" + chi "压缩列'%-.192s'不能用于索引规范" + eng "Compressed column '%-.192s' can't be used in key specification" + spa "Una columna comprimida '%-.192s' no se puede usar en especificación de clave" ER_UNKNOWN_COMPRESSION_METHOD - eng "Unknown compression method: %s" - spa "Método de compresión desconocido: %s" + chi "未知压缩方法:%s" + eng "Unknown compression method: %s" + spa "Método de compresión desconocido: %s" ER_WRONG_NUMBER_OF_VALUES_IN_TVC + chi "使用的表值构造函数具有不同数量的值" eng "The used table value constructor has a different number of values" spa "El constructor del valor de tabla usado tiene un número diferente de valores" ER_FIELD_REFERENCE_IN_TVC - eng "Field reference '%-.192s' can't be used in table value constructor" + chi "字段参考'%-.192s'不能用于表值构造函数" + eng "Field reference '%-.192s' can't be used in table value constructor" spa "La referencia a campo '%-.192s' no se puede usar en constructor de valor de tabla" ER_WRONG_TYPE_FOR_PERCENTILE_FUNC + chi "%s函数需要数字数据类型" eng "Numeric datatype is required for %s function" spa "Se requiere de tipo de dato numérico para función %s" ER_ARGUMENT_NOT_CONSTANT + chi "%s函数的参数不是分区的常量" eng "Argument to the %s function is not a constant for a partition" spa "El argumento de la función %s no es una constante para una partición" ER_ARGUMENT_OUT_OF_RANGE + chi "%s函数的参数不属于范围[0,1]" eng "Argument to the %s function does not belong to the range [0,1]" spa "El argumento de la función %s no pertenece al rango [0,1]" ER_WRONG_TYPE_OF_ARGUMENT + chi "%s函数仅接受可以转换为数字类型的参数" eng "%s function only accepts arguments that can be converted to numerical types" spa "La función %s sólo acepta argumentos que se puedan convertir a tipos numéricos" ER_NOT_AGGREGATE_FUNCTION + chi "在错误的上下文中使用的聚合特定指令(fetch组下一行)" eng "Aggregate specific instruction (FETCH GROUP NEXT ROW) used in a wrong context" spa "Instrucción específica de agregación (FETCH GROUP NEXT ROW) usada en contexto equivocado" ER_INVALID_AGGREGATE_FUNCTION + chi "聚合函数丢失的聚合特定指令(fetch组下一行)" eng "Aggregate specific instruction(FETCH GROUP NEXT ROW) missing from the aggregate function" spa "Falta instrucción específica de agregación (FETCH GROUP NEXT ROW) de la función de agregación" ER_INVALID_VALUE_TO_LIMIT + chi "限制仅接受整数值" eng "Limit only accepts integer values" spa "El límite sólo acepta valores enteros" ER_INVISIBLE_NOT_NULL_WITHOUT_DEFAULT + chi "隐形列%`s必须具有默认值" eng "Invisible column %`s must have a default value" spa "Una columna invisible %`s debe de tener valor por defecto" # MariaDB error numbers related to System Versioning + ER_UPDATE_INFO_WITH_SYSTEM_VERSIONING + chi "匹配的行:%ld已更改:%ld插入:%ld警告:%ld" eng "Rows matched: %ld Changed: %ld Inserted: %ld Warnings: %ld" spa "Filas coincidentes: %ld Cambiadas: %ld Insertadas: %ld Avisos: %ld" ER_VERS_FIELD_WRONG_TYPE + chi "%`s必须为系统版本为表%s的类型%`s" eng "%`s must be of type %s for system-versioned table %`s" spa "%`s debe de ser del tipo %s para tabla versionada del sistema %`s" ER_VERS_ENGINE_UNSUPPORTED + chi "Transaction-Precise系统版本控制%`s不受支持" eng "Transaction-precise system versioning for %`s is not supported" spa "No se soporta versionado de sistema de transacción precisa para %`s" ER_UNUSED_23 + chi "你永远不应该看到它" eng "You should never see it" spa "Nunca debería vd de ver esto" ER_PARTITION_WRONG_TYPE - eng "Wrong partitioning type, expected type: %`s" - spa "Tipo de partición equivocada, tipo esperado: %`s" + chi "错误分区类型%`s,应当是%`s" + eng "Wrong partition type %`s for partitioning by %`s" + spa "Tipo de partición equivocada %`s para particionado mediante %`s" WARN_VERS_PART_FULL + chi "版本化表%`s.%`s:partition%`s已满,添加更多历史分区(out of %s)" eng "Versioned table %`s.%`s: last HISTORY partition (%`s) is out of %s, need more HISTORY partitions" spa "Tabla versionada %`s.%`s: última partición HISTORY (%`s) fuera de %s, necesita de más particiones HISTORY" WARN_VERS_PARAMETERS + chi "也许缺少参数:%s" eng "Maybe missing parameters: %s" spa "Parámetros que quizás faltan: %s" ER_VERS_DROP_PARTITION_INTERVAL + chi "只能在旋转间隔时丢弃最旧的分区" eng "Can only drop oldest partitions when rotating by INTERVAL" spa "Sólo se pueden eliminar viejas particiones al rotar mediante INTERVAL" ER_UNUSED_25 + chi "你永远不应该看到它" eng "You should never see it" spa "Nunca debería vd de ver esto" WARN_VERS_PART_NON_HISTORICAL + chi "分区%`s包含非历史数据" eng "Partition %`s contains non-historical data" spa "La partición %`s contiene datos no históricos" ER_VERS_ALTER_NOT_ALLOWED + chi "系统版本为%`s.%`s不允许。更改@@system_versioning_alter_history用ALTER。" eng "Not allowed for system-versioned %`s.%`s. Change @@system_versioning_alter_history to proceed with ALTER." spa "No permitido para versionado del sistema %`s.%`s. Cambie @@system_versioning_alter_history para proceder con ALTER." ER_VERS_ALTER_ENGINE_PROHIBITED + chi "不允许系统版本为%`s.%`s。不支持更改返回/来自本机系统版本传输引擎。" eng "Not allowed for system-versioned %`s.%`s. Change to/from native system versioning engine is not supported." spa "No permitido para versionado del sistema %`s.%`s. Cambio a/desde motor de versionado nativo no soportado." ER_VERS_RANGE_PROHIBITED + chi "不允许使用SYSTEM_TIME范围选择器" eng "SYSTEM_TIME range selector is not allowed" spa "Selector de rango SYSTEM_TIME no permitido" ER_CONFLICTING_FOR_SYSTEM_TIME + chi "与递归的System_time子句相冲突" eng "Conflicting FOR SYSTEM_TIME clauses in WITH RECURSIVE" spa "Cláusulas conflictivas FOR SYSTEM_TIME en WITH RECURSIVE" ER_VERS_TABLE_MUST_HAVE_COLUMNS + chi "表%`s必须至少有一个版本后的列" eng "Table %`s must have at least one versioned column" spa "La tabla %`s debe de tener al menos una columna versionada" ER_VERS_NOT_VERSIONED + chi "表%`s不是系统版本的" eng "Table %`s is not system-versioned" spa "La tabla %`s no es versionada del sistema" ER_MISSING + chi "%`s的错误参数:缺少'%s'" eng "Wrong parameters for %`s: missing '%s'" spa "Parámetros equivocados para %`s: falta '%s'" ER_VERS_PERIOD_COLUMNS + chi "system_time的时期必须使用列%`s和%`s" eng "PERIOD FOR SYSTEM_TIME must use columns %`s and %`s" spa "PERIOD FOR SYSTEM_TIME debe de usar columnas %`s y %`s" ER_PART_WRONG_VALUE + chi "用于分区%`s的错误参数:'%s'的错误值" eng "Wrong parameters for partitioned %`s: wrong value for '%s'" spa "Parámetros equivocados para particionado %`s: valor equivocado para '%s'" ER_VERS_WRONG_PARTS + chi "%`s的错误分区:必须至少有一个HISTORY,只能有一个CURRENT" eng "Wrong partitions for %`s: must have at least one HISTORY and exactly one last CURRENT" spa "Particiones equivocadas para %`s: debe de tener al menos una HISTORY y exactamente un último CURRENT" ER_VERS_NO_TRX_ID + chi "TRX_ID%llu在`mysql.transaction_registry`中找不到" eng "TRX_ID %llu not found in `mysql.transaction_registry`" spa "TRX_ID %llu no hallado en `mysql.transaction_registry`" ER_VERS_ALTER_SYSTEM_FIELD + chi "无法更改系统版本配置字段%`s" eng "Can not change system versioning field %`s" spa "No puedo cambiar campo de versionado de sistema %`s" ER_DROP_VERSIONING_SYSTEM_TIME_PARTITION + chi "无法删除由SYSTEM_TIME分区的表%`s的系统版本" eng "Can not DROP SYSTEM VERSIONING for table %`s partitioned BY SYSTEM_TIME" spa "No puedo DROP SYSTEM VERSIONING para la tabla %`s particionada BY SYSTEM_TIME" ER_VERS_DB_NOT_SUPPORTED - eng "System-versioned tables in the %`s database are not supported" - spa "No se soportan las tablas versionadas del sistema en la base de datos %`s" + chi "不支持%`s数据库中的系统版本化表" + eng "System-versioned tables in the %`s database are not supported" + spa "No se soportan las tablas versionadas del sistema en la base de datos %`s" ER_VERS_TRT_IS_DISABLED + chi "事务注册表已禁用" eng "Transaction registry is disabled" spa "El registro de transaciones está desactivado" ER_VERS_DUPLICATE_ROW_START_END - eng "Duplicate ROW %s column %`s" + chi "重复行%s列%`s" + eng "Duplicate ROW %s column %`s" spa "Duplicada FILA %s columna %`s" ER_VERS_ALREADY_VERSIONED + chi "表%`s已经是系统版本的" eng "Table %`s is already system-versioned" spa "La tabla %`s ya es versionada del sistema" ER_UNUSED_24 - eng "You should never see it" - spa "Nunca debería vd de ver esto" + chi "你永远不应该看到它" + eng "You should never see it" + spa "Nunca debería vd de ver esto" ER_VERS_NOT_SUPPORTED - eng "System-versioned tables do not support %s" + chi "系统版本的表不支持%s" + eng "System-versioned tables do not support %s" spa "Las tablas versionadas del sistema no soportan %s" ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED + chi "事务 - 精确的系统 - 版本的表不支持按行开始或行末端分区" eng "Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END" spa "Las tablas versionadas del sistemas de transacción precisa no soportan particionado mediante ROW START o ROW END" ER_INDEX_FILE_FULL + chi "表'%-.192s'的索引文件已满" eng "The index file for table '%-.192s' is full" spa "El fichero/archivo índice para la tabla '%-.192s' está lleno" ER_UPDATED_COLUMN_ONLY_ONCE + chi "列%`s.%`s在单个更新语句中不能更换一次" eng "The column %`s.%`s cannot be changed more than once in a single UPDATE statement" spa "La columna %`s.%`s no se pude cambiar más de ua vez en una sentencia UPDATE única" ER_EMPTY_ROW_IN_TVC + chi "在此上下文中,表值构造函数不允许在没有元素的行" eng "Row with no elements is not allowed in table value constructor in this context" spa "Fila sin elementos no se permite en constructor de valor de tabla en este contexto" ER_VERS_QUERY_IN_PARTITION + chi "表%`s的SYSTEM_TIME分区不支持历史查询" eng "SYSTEM_TIME partitions in table %`s does not support historical query" spa "Las particiones SYSTEM_TIME en la tabla %`s no soportan consulta (query) histórica" ER_KEY_DOESNT_SUPPORT + chi "%s索引%`s不支持此操作" eng "%s index %`s does not support this operation" spa "%s índice %`s no soporta esta operación" ER_ALTER_OPERATION_TABLE_OPTIONS_NEED_REBUILD - eng "Changing table options requires the table to be rebuilt" + chi "更改表选项需要将要重建的表格重建" + eng "Changing table options requires the table to be rebuilt" spa "Cambiar las opciones de tabla requiere que la tabla sea reconstruida" ER_BACKUP_LOCK_IS_ACTIVE + chi "由于您在运行BACKUP STAGE,无法执行命令" eng "Can't execute the command as you have a BACKUP STAGE active" spa "No puedo ejecutar el comando cuando vd tiene activo un BACKUP STAGE" ER_BACKUP_NOT_RUNNING + chi "您必须启动备份“备份阶段开始”" eng "You must start backup with \"BACKUP STAGE START\"" spa "Vd debe de arracar respaldo mediante \"BACKUP STAGE START\"" ER_BACKUP_WRONG_STAGE + chi "备份阶段'%s'相同或在当前备份阶段'%s'之前" eng "Backup stage '%s' is same or before current backup stage '%s'" spa "La fase de respaldo '%s' es la misma o anterior a la fase de respaldo actual '%s'" ER_BACKUP_STAGE_FAILED + chi "备份阶段'%s'失败" eng "Backup stage '%s' failed" spa "La fase de respaldo '%s' ha fallado" ER_BACKUP_UNKNOWN_STAGE + chi "未知备份阶段:'%s'。阶段应该是START,FLUSH,BLOCK_DDL,BLOCK_COMIT或END之一" eng "Unknown backup stage: '%s'. Stage should be one of START, FLUSH, BLOCK_DDL, BLOCK_COMMIT or END" spa "Fase de respaldo desconocida: '%s'. La fase debería de ser una de START, FLUSH, BLOCK_DDL, BLOCK_COMMIT o END" ER_USER_IS_BLOCKED + chi "由于凭证错误太多,用户被阻止;用'FLUSH PRIVILEGES'解锁" eng "User is blocked because of too many credential errors; unblock with 'FLUSH PRIVILEGES'" spa "El usuario está bloqueado a causa de demasiados errores de credenciales; desbloquee mediante 'FLUSH PRIVILEGES'" ER_ACCOUNT_HAS_BEEN_LOCKED + chi "访问拒绝,此帐户已锁定" eng "Access denied, this account is locked" rum "Acces refuzat, acest cont este blocat" spa "Acceso denegado, esta cuenta está bloqueada" ER_PERIOD_TEMPORARY_NOT_ALLOWED + chi "应用程序时间段表不能临时" eng "Application-time period table cannot be temporary" spa "Una tabla de período de momento-de-aplicación no puede ser temporal" ER_PERIOD_TYPES_MISMATCH + chi "%`s的期间的字段有不同的类型" eng "Fields of PERIOD FOR %`s have different types" spa "Los campos de PERIOD FOR %`s tienen tipos diferentes" ER_MORE_THAN_ONE_PERIOD + chi "无法指定多个应用程序时间段" eng "Cannot specify more than one application-time period" spa "No se puede especificar más de un período de momento de aplicación" ER_PERIOD_FIELD_WRONG_ATTRIBUTES + chi "期间字段%`s不能是%s" eng "Period field %`s cannot be %s" spa "El campo de período %`s no puede ser %s" ER_PERIOD_NOT_FOUND + chi "期间%`s未在表中找到" eng "Period %`s is not found in table" spa "El período %`s no se ha hallado en la tabla" ER_PERIOD_COLUMNS_UPDATED + chi "列%`s在更新集列表中指定的周期%`s中使用" eng "Column %`s used in period %`s specified in update SET list" spa "La columna %`s usada en período %`s especificado en lista de actualizar SET" ER_PERIOD_CONSTRAINT_DROP + chi "无法DROP CONSTRAINT `%s`。使用DROP PERIOD `%s`" eng "Can't DROP CONSTRAINT `%s`. Use DROP PERIOD `%s` for this" spa "No puedo DROP CONSTRAINT `%s`. Use DROP PERIOD `%s` para esto" ER_TOO_LONG_KEYPART 42000 S1009 + chi "指定的索引部分太长;最大索引部分长度为 %u 个字节" eng "Specified key part was too long; max key part length is %u bytes" spa "La parte de clave especificada es demasiado larga; el tamaño máximo de la parte de clave es de %u bytes" ER_TOO_LONG_DATABASE_COMMENT - eng "Comment for database '%-.64s' is too long (max = %u)" - spa "El comentario para la base de datos '%-.64s' es demasiado largo (máx = %u)" + eng "Comment for database '%-.64s' is too long (max = %u)" + spa "El comentario para la base de datos '%-.64s' es demasiado largo (máx = %u)" ER_UNKNOWN_DATA_TYPE eng "Unknown data type: '%-.64s'" spa "Tipo de datos desconocido: '%-.64s'" @@ -8915,3 +10068,7 @@ ER_PROVIDER_NOT_LOADED eng "MariaDB tried to use the %s, but its provider plugin is not loaded" ER_JSON_HISTOGRAM_PARSE_FAILED eng "Failed to parse histogram for table %s.%s: %s at offset %d." +ER_SF_OUT_INOUT_ARG_NOT_ALLOWED + eng "OUT or INOUT argument %d for function %s is not allowed here" +ER_INCONSISTENT_SLAVE_TEMP_TABLE + eng "Replicated query '%s' table `%s.%s` can not be temporary" diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index b2281b69a4f92..fb3f94d019e73 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -23,9 +23,11 @@ #include "mysqld.h" #include "sql_class.h" #include "my_stacktrace.h" +#include #ifdef _WIN32 #include +#include #define SIGNAL_FMT "exception 0x%x" #else #define SIGNAL_FMT "signal %d" @@ -65,25 +67,30 @@ static inline void output_core_info() (int) len, buff); } #ifdef __FreeBSD__ - if ((fd= my_open("/proc/curproc/rlimit", O_RDONLY, MYF(MY_NO_REGISTER))) >= 0) + if ((fd= open("/proc/curproc/rlimit", O_RDONLY)) >= 0) #else - if ((fd= my_open("/proc/self/limits", O_RDONLY, MYF(MY_NO_REGISTER))) >= 0) + if ((fd= open("/proc/self/limits", O_RDONLY)) >= 0) #endif { my_safe_printf_stderr("Resource Limits:\n"); - while ((len= my_read(fd, (uchar*)buff, sizeof(buff), MYF(0))) > 0) + while ((len= read(fd, (uchar*)buff, sizeof(buff))) > 0) { my_write_stderr(buff, len); } - my_close(fd, MYF(0)); + close(fd); } #ifdef __linux__ - if ((fd= my_open("/proc/sys/kernel/core_pattern", O_RDONLY, - MYF(MY_NO_REGISTER))) >= 0) + if ((fd= open("/proc/sys/kernel/core_pattern", O_RDONLY)) >= 0) { - len= my_read(fd, (uchar*)buff, sizeof(buff), MYF(0)); + len= read(fd, (uchar*)buff, sizeof(buff)); my_safe_printf_stderr("Core pattern: %.*s\n", (int) len, buff); - my_close(fd, MYF(0)); + close(fd); + } + if ((fd= open("/proc/version", O_RDONLY)) >= 0) + { + len= read(fd, (uchar*)buff, sizeof(buff)); + my_safe_printf_stderr("Kernel version: %.*s\n", (int) len, buff); + close(fd); } #endif #elif defined(__APPLE__) || defined(__FreeBSD__) @@ -93,11 +100,18 @@ static inline void output_core_info() { my_safe_printf_stderr("Core pattern: %.*s\n", (int) len, buff); } -#else + if (sysctlbyname("kern.version", buff, &len, NULL, 0) == 0) + { + my_safe_printf_stderr("Kernel version: %.*s\n", (int) len, buff); + } +#elif defined(HAVE_GETCWD) char buff[80]; - my_getwd(buff, sizeof(buff), 0); - my_safe_printf_stderr("Writing a core file at %s\n", buff); - fflush(stderr); + + if (getcwd(buff, sizeof(buff))) + { + my_safe_printf_stderr("Writing a core file at %.*s\n", (int) sizeof(buff), buff); + fflush(stderr); + } #endif } @@ -171,7 +185,8 @@ extern "C" sig_handler handle_fatal_signal(int sig) "something is definitely wrong and this may fail.\n\n"); set_server_version(server_version, sizeof(server_version)); - my_safe_printf_stderr("Server version: %s\n", server_version); + my_safe_printf_stderr("Server version: %s source revision: %s\n", + server_version, SOURCE_REVISION); if (dflt_key_cache) my_safe_printf_stderr("key_buffer_size=%zu\n", diff --git a/sql/slave.cc b/sql/slave.cc index 3c5b830fbe257..83f138b78f068 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB Corporation. + Copyright (c) 2009, 2022, 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 @@ -3307,9 +3307,9 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full, protocol->store((uint32) mi->master_id); // SQL_Delay // Master_Ssl_Crl - protocol->store_string_or_null(mi->ssl_ca, &my_charset_bin); + protocol->store_string_or_null(mi->ssl_crl, &my_charset_bin); // Master_Ssl_Crlpath - protocol->store_string_or_null(mi->ssl_capath, &my_charset_bin); + protocol->store_string_or_null(mi->ssl_crlpath, &my_charset_bin); // Using_Gtid protocol->store_string_or_null(mi->using_gtid_astext(mi->using_gtid), &my_charset_bin); @@ -3402,7 +3402,7 @@ bool show_all_master_info(THD* thd) String gtid_pos; Master_info **tmp; List field_list; - DBUG_ENTER("show_master_info"); + DBUG_ENTER("show_all_master_info"); mysql_mutex_assert_owner(&LOCK_active_mi); gtid_pos.length(0); @@ -3871,12 +3871,14 @@ apply_event_and_update_pos_apply(Log_event* ev, THD* thd, rpl_group_info *rgi, Relay_log_info* rli= rgi->rli; DBUG_ENTER("apply_event_and_update_pos_apply"); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("inject_slave_sql_before_apply_event", { DBUG_ASSERT(!debug_sync_set_action (thd, STRING_WITH_LEN("now WAIT_FOR continue"))); DBUG_SET_INITIAL("-d,inject_slave_sql_before_apply_event"); };); +#endif if (reason == Log_event::EVENT_SKIP_NOT) exec_res= ev->apply_event(rgi); @@ -3905,7 +3907,7 @@ apply_event_and_update_pos_apply(Log_event* ev, THD* thd, rpl_group_info *rgi, } #endif -#ifndef DBUG_OFF +#ifdef DBUG_TRACE /* This only prints information to the debug trace. @@ -3930,8 +3932,12 @@ apply_event_and_update_pos_apply(Log_event* ev, THD* thd, rpl_group_info *rgi, DBUG_PRINT("info", ("apply_event error = %d", exec_res)); if (exec_res == 0) { + if (thd->rgi_slave && (thd->rgi_slave->gtid_ev_flags_extra & + Gtid_log_event::FL_START_ALTER_E1) && + thd->rgi_slave->get_finish_event_group_called()) + DBUG_RETURN(exec_res ? 1 : 0); int error= ev->update_pos(rgi); - #ifndef DBUG_OFF +#ifdef DBUG_TRACE DBUG_PRINT("info", ("update_pos error = %d", error)); if (!rli->belongs_to_client()) { @@ -4053,6 +4059,11 @@ int apply_event_and_update_pos_for_parallel(Log_event* ev, THD* thd, rpl_group_info *rgi) { + int rc= 0; + ulong retries= 0; + bool is_sa= rgi->gtid_ev_flags_extra == Gtid_log_event::FL_START_ALTER_E1; + bool is_sa_temp_err= false; + mysql_mutex_assert_not_owner(&rgi->rli->data_lock); int reason= apply_event_and_update_pos_setup(ev, thd, rgi); /* @@ -4064,7 +4075,51 @@ apply_event_and_update_pos_for_parallel(Log_event* ev, THD* thd, Calling sql_delay_event() was handled in the SQL driver thread when doing parallel replication. */ - return apply_event_and_update_pos_apply(ev, thd, rgi, reason); + do + { + rc= apply_event_and_update_pos_apply(ev, thd, rgi, reason); + if (rc && is_sa) + { + is_sa_temp_err= + is_parallel_retry_error(rgi, thd->get_stmt_da()->sql_errno()); + } + } + while(is_sa_temp_err && retries++ < slave_trans_retries); + + if (is_sa_temp_err) + { + Master_info *mi= rgi->rli->mi; + mysql_mutex_lock(&mi->start_alter_lock); + + DBUG_ASSERT(!rgi->sa_info->direct_commit_alter); + /* + Give up retrying to hand the whole ALTER execution over to + the "Complete" ALTER. + */ + rgi->sa_info->direct_commit_alter= true; + rgi->sa_info->state= start_alter_state::COMPLETED; + mysql_cond_broadcast(&rgi->sa_info->start_alter_cond); + mysql_mutex_unlock(&mi->start_alter_lock); + if (global_system_variables.log_warnings > 2) + { + rpl_gtid *gtid= &rgi->current_gtid; + sql_print_information("Start Alter Query '%s' " + "GTID %u-%u-%llu having a temporary error %d code " + "has been unsuccessfully retried %lu times; its " + "parallel optimistic execution now proceeds in " + "legacy mode", + static_cast(ev)->query, + gtid->domain_id, gtid->server_id, gtid->seq_no, + thd->get_stmt_da()->sql_errno(), retries - 1); + } + thd->clear_error(); + thd->reset_killed(); + rgi->killed_for_retry = rpl_group_info::RETRY_KILL_NONE; + + rc= false; + } + + return rc; } @@ -4207,6 +4262,21 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, int exec_res; Log_event_type typ= ev->get_type_code(); + DBUG_EXECUTE_IF( + "pause_sql_thread_on_next_event", + { + /* + Temporarily unlock data_lock so we can check-in with the IO thread + */ + mysql_mutex_unlock(&rli->data_lock); + DBUG_ASSERT(!debug_sync_set_action( + thd, + STRING_WITH_LEN( + "now SIGNAL paused_on_event WAIT_FOR sql_thread_continue"))); + DBUG_SET("-d,pause_sql_thread_on_next_event"); + mysql_mutex_lock(&rli->data_lock); + }); + /* Even if we don't execute this event, we keep the master timestamp, so that seconds behind master shows correct delta (there are events @@ -4220,10 +4290,10 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, the user might be surprised to see a claim that the slave is up to date long before those queued events are actually executed. */ - if (!rli->mi->using_parallel() && - !(ev->is_artificial_event() || ev->is_relay_log_event() || (ev->when == 0))) + if ((!rli->mi->using_parallel()) && event_can_update_last_master_timestamp(ev)) { rli->last_master_timestamp= ev->when + (time_t) ev->exec_time; + rli->sql_thread_caught_up= false; DBUG_ASSERT(rli->last_master_timestamp >= 0); } @@ -4275,6 +4345,17 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, if (rli->mi->using_parallel()) { + if (unlikely((rli->last_master_timestamp == 0 || + rli->sql_thread_caught_up) && + event_can_update_last_master_timestamp(ev))) + { + if (rli->last_master_timestamp < ev->when) + { + rli->last_master_timestamp= ev->when; + rli->sql_thread_caught_up= false; + } + } + int res= rli->parallel.do_event(serial_rgi, ev, event_size); /* In parallel replication, we need to update the relay log position @@ -4295,7 +4376,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, This is the case for pre-10.0 events without GTID, and for handling slave_skip_counter. */ - if (!(ev->is_artificial_event() || ev->is_relay_log_event() || (ev->when == 0))) + if (event_can_update_last_master_timestamp(ev)) { /* Ignore FD's timestamp as it does not reflect the slave execution @@ -4303,7 +4384,8 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, data modification event execution last long all this time Seconds_Behind_Master is zero. */ - if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT) + if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT && + rli->last_master_timestamp < ev->when) rli->last_master_timestamp= ev->when + (time_t) ev->exec_time; DBUG_ASSERT(rli->last_master_timestamp >= 0); @@ -4464,6 +4546,17 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, #ifdef WITH_WSREP wsrep_after_statement(thd); #endif /* WITH_WSREP */ +#ifdef ENABLED_DEBUG_SYNC + DBUG_EXECUTE_IF( + "pause_sql_thread_on_fde", + if (ev && typ == FORMAT_DESCRIPTION_EVENT) { + DBUG_ASSERT(!debug_sync_set_action( + thd, + STRING_WITH_LEN( + "now SIGNAL paused_on_fde WAIT_FOR sql_thread_continue"))); + }); +#endif + DBUG_RETURN(exec_res); } mysql_mutex_unlock(&rli->data_lock); @@ -4929,6 +5022,7 @@ Stopping slave I/O thread due to out-of-memory error from master"); not cause the slave IO thread to stop, and the error messages are already reported. */ + DBUG_EXECUTE_IF("simulate_delay_semisync_slave_reply", my_sleep(800000);); (void)repl_semisync_slave.slave_reply(mi); } @@ -5037,6 +5131,7 @@ log space"); mi->abort_slave= 0; mi->slave_running= MYSQL_SLAVE_NOT_RUN; mi->io_thd= 0; + mi->do_accept_own_server_id= false; /* Note: the order of the two following calls (first broadcast, then unlock) is important. Otherwise a killer_thread can execute between the calls and @@ -5049,8 +5144,7 @@ log space"); DBUG_LEAVE; // Must match DBUG_ENTER() my_thread_end(); ERR_remove_state(0); - pthread_exit(0); - return 0; // Avoid compiler warnings + return nullptr; } /* @@ -5570,8 +5664,10 @@ pthread_handler_t handle_slave_sql(void *arg) err: if (mi->using_parallel()) + { rli->parallel.wait_for_done(thd, rli); - /* Gtid_list_log_event::do_apply_event has already reported the GTID until */ + }; + /* Gtid_list_log_event::do_apply_event has already reported the GTID until */ if (rli->stop_for_until && rli->until_condition != Relay_log_info::UNTIL_GTID) { if (global_system_variables.log_warnings > 2) @@ -5756,8 +5852,7 @@ pthread_handler_t handle_slave_sql(void *arg) DBUG_LEAVE; // Must match DBUG_ENTER() my_thread_end(); ERR_remove_state(0); - pthread_exit(0); - return 0; // Avoid compiler warnings + return nullptr; } @@ -6175,15 +6270,6 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len) uchar new_buf_arr[4096]; bool is_malloc = false; bool is_rows_event= false; - /* - The flag has replicate_same_server_id semantics and is raised to accept - a same-server-id event on the semisync slave, for both the gtid and legacy - connection modes. - Such events can appear as result of this server recovery so the event - was created there and replicated elsewhere right before the crash. At recovery - it could be evicted from the server's binlog. - */ - bool do_accept_own_server_id= false; /* FD_q must have been prepared for the first R_a event inside get_master_version_and_clock() @@ -6272,6 +6358,8 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len) dbug_rows_event_count = 0; };); #endif + s_id= uint4korr(buf + SERVER_ID_OFFSET); + mysql_mutex_lock(&mi->data_lock); switch (buf[EVENT_TYPE_OFFSET]) { @@ -6294,12 +6382,19 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len) Rotate_log_event rev(buf, checksum_alg != BINLOG_CHECKSUM_ALG_OFF ? event_len - BINLOG_CHECKSUM_LEN : event_len, mi->rli.relay_log.description_event_for_queue); - - if (unlikely(mi->gtid_reconnect_event_skip_count) && - unlikely(!mi->gtid_event_seen) && - rev.is_artificial_event() && - (mi->prev_master_id != mi->master_id || - strcmp(rev.new_log_ident, mi->master_log_name) != 0)) + bool master_changed= false; + bool maybe_crashed= false; + // Exclude server start scenario + if ((mi->prev_master_id && mi->master_id) && + (mi->prev_master_id != mi->master_id)) + master_changed= true; + if ((mi->master_log_name[0]!='\0') && + (strcmp(rev.new_log_ident, mi->master_log_name) != 0)) + maybe_crashed= true; + + if (unlikely((mi->gtid_reconnect_event_skip_count && master_changed) || + maybe_crashed) && + unlikely(!mi->gtid_event_seen) && rev.is_artificial_event()) { /* Artificial Rotate_log_event is the first event we receive at the start @@ -6335,26 +6430,37 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len) case likewise rollback the partially received event group. */ Format_description_log_event fdle(4); + fdle.checksum_alg= checksum_alg; + + /* + Possible crash is flagged in being created FD' common header + to conduct any necessary cleanup by the slave applier. + */ + if (maybe_crashed) + fdle.flags |= LOG_EVENT_BINLOG_IN_USE_F; - if (mi->prev_master_id != mi->master_id) - sql_print_warning("The server_id of master server changed in the " - "middle of GTID %u-%u-%llu. Assuming a change of " - "master server, so rolling back the previously " - "received partial transaction. Expected: %lu, " - "received: %lu", mi->last_queued_gtid.domain_id, - mi->last_queued_gtid.server_id, - mi->last_queued_gtid.seq_no, - mi->prev_master_id, mi->master_id); - else if (strcmp(rev.new_log_ident, mi->master_log_name) != 0) - sql_print_warning("Unexpected change of master binlog file name in the " - "middle of GTID %u-%u-%llu, assuming that master has " - "crashed and rolling back the transaction. Expected: " - "'%s', received: '%s'", - mi->last_queued_gtid.domain_id, - mi->last_queued_gtid.server_id, - mi->last_queued_gtid.seq_no, - mi->master_log_name, rev.new_log_ident); + if (mi->gtid_reconnect_event_skip_count) + { + if (master_changed) + sql_print_warning("The server_id of master server changed in the " + "middle of GTID %u-%u-%llu. Assuming a change of " + "master server, so rolling back the previously " + "received partial transaction. Expected: %lu, " + "received: %lu", mi->last_queued_gtid.domain_id, + mi->last_queued_gtid.server_id, + mi->last_queued_gtid.seq_no, + mi->prev_master_id, mi->master_id); + else + sql_print_warning("Unexpected change of master binlog file name in " + "the middle of GTID %u-%u-%llu, assuming that " + "master has crashed and rolling back the " + "transaction. Expected: '%s', received: '%s'", + mi->last_queued_gtid.domain_id, + mi->last_queued_gtid.server_id, + mi->last_queued_gtid.seq_no, mi->master_log_name, + rev.new_log_ident); + } mysql_mutex_lock(log_lock); if (likely(!rli->relay_log.write_event(&fdle) && !rli->relay_log.flush_and_sync(NULL))) @@ -6693,17 +6799,75 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len) mi->gtid_event_seen= true; /* - We have successfully queued to relay log everything before this GTID, so + Unless the previous group is malformed, + we have successfully queued to relay log everything before this GTID, so in case of reconnect we can start from after any previous GTID. - (Normally we would have updated gtid_current_pos earlier at the end of - the previous event group, but better leave an extra check here for - safety). + (We must have updated gtid_current_pos earlier at the end of + the previous event group. Unless ...) */ - if (mi->events_queued_since_last_gtid) + if (unlikely(mi->events_queued_since_last_gtid > 0)) { - mi->gtid_current_pos.update(&mi->last_queued_gtid); - mi->events_queued_since_last_gtid= 0; + /* + ...unless the last group has not been completed. An assert below + can be satisfied only with the strict mode that ensures + against "genuine" gtid duplicates. + */ + IF_DBUG(rpl_gtid *gtid_in_slave_state= + mi->gtid_current_pos.find(mi->last_queued_gtid.domain_id),); + + // Slave gtid state must not have updated yet to the last received gtid. + DBUG_ASSERT((mi->using_gtid == Master_info::USE_GTID_NO || + !opt_gtid_strict_mode) || + (!gtid_in_slave_state || + !(*gtid_in_slave_state == mi->last_queued_gtid))); + + DBUG_EXECUTE_IF("slave_discard_xid_for_gtid_0_x_1000", + { + /* Inject an event group that is missing its XID commit event. */ + if ((mi->last_queued_gtid.domain_id == 0 && + mi->last_queued_gtid.seq_no == 1000) || + (mi->last_queued_gtid.domain_id == 1 && + mi->last_queued_gtid.seq_no == 32)) + { + sql_print_warning( + "Unexpected break of being relay-logged GTID %u-%u-%llu " + "event group by the current GTID event %u-%u-%llu", + PARAM_GTID(mi->last_queued_gtid),PARAM_GTID(event_gtid)); + DBUG_SET("-d,slave_discard_xid_for_gtid_0_x_1000"); + goto dbug_gtid_accept; + } + }); + error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE; + sql_print_error("Unexpected break of being relay-logged GTID %u-%u-%llu " + "event group by the current GTID event %u-%u-%llu", + PARAM_GTID(mi->last_queued_gtid),PARAM_GTID(event_gtid)); + goto err; } + else if (unlikely(mi->gtid_reconnect_event_skip_count > 0)) + { + if (mi->gtid_reconnect_event_skip_count == + mi->events_queued_since_last_gtid) + { + DBUG_ASSERT(event_gtid == mi->last_queued_gtid); + + goto default_action; + } + + DBUG_ASSERT(0); + } + // else_likely{... +#ifndef DBUG_OFF +dbug_gtid_accept: + DBUG_EXECUTE_IF("slave_discard_gtid_0_x_1002", + { + if (mi->last_queued_gtid.server_id == 27697 && + mi->last_queued_gtid.seq_no == 1002) + { + DBUG_SET("-d,slave_discard_gtid_0_x_1002"); + goto skip_relay_logging; + } + }); +#endif mi->last_queued_gtid= event_gtid; mi->last_queued_gtid_standalone= (gtid_flag & Gtid_log_event::FL_STANDALONE) != 0; @@ -6713,6 +6877,20 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len) ++mi->events_queued_since_last_gtid; inc_pos= event_len; + + /* + To compute `true` is normal for this *now* semisync slave server when + it has passed its crash-recovery as a former master. + */ + mi->do_accept_own_server_id= + (s_id == global_system_variables.server_id && + rpl_semi_sync_slave_enabled && opt_gtid_strict_mode && + mi->using_gtid != Master_info::USE_GTID_NO && + !mysql_bin_log.check_strict_gtid_sequence(event_gtid.domain_id, + event_gtid.server_id, + event_gtid.seq_no, + true)); + // ...} eof else_likely } break; /* @@ -6792,6 +6970,12 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len) case XID_EVENT: DBUG_EXECUTE_IF("slave_discard_xid_for_gtid_0_x_1000", { + if (mi->last_queued_gtid.server_id == 27697 && + mi->last_queued_gtid.seq_no == 1000) + { + DBUG_SET("-d,slave_discard_xid_for_gtid_0_x_1000"); + goto skip_relay_logging; + } /* Inject an event group that is missing its XID commit event. */ if (mi->last_queued_gtid.domain_id == 0 && mi->last_queued_gtid.seq_no == 1000) @@ -6838,15 +7022,48 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len) } };); - if (mi->using_gtid != Master_info::USE_GTID_NO && mi->gtid_event_seen) + if (mi->using_gtid != Master_info::USE_GTID_NO) { - if (unlikely(mi->gtid_reconnect_event_skip_count)) + if (likely(mi->gtid_event_seen)) { - --mi->gtid_reconnect_event_skip_count; - gtid_skip_enqueue= true; + if (unlikely(mi->gtid_reconnect_event_skip_count)) + { + if (!got_gtid_event && + mi->gtid_reconnect_event_skip_count == + mi->events_queued_since_last_gtid) + goto gtid_not_start; // the 1st re-sent must be gtid + + --mi->gtid_reconnect_event_skip_count; + gtid_skip_enqueue= true; + } + else if (likely(mi->events_queued_since_last_gtid)) + { + DBUG_ASSERT(!got_gtid_event); + + ++mi->events_queued_since_last_gtid; + } + else if (Log_event::is_group_event((Log_event_type) (uchar) + buf[EVENT_TYPE_OFFSET])) + { + goto gtid_not_start; // no first gtid event in this group + } + } + else if (Log_event::is_group_event((Log_event_type) (uchar) + buf[EVENT_TYPE_OFFSET])) + { + gtid_not_start: + + DBUG_ASSERT(!got_gtid_event); + + error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE; + sql_print_error("The current group of events starts with " + "a non-GTID %s event; " + "the last seen GTID is %u-%u-%llu", + Log_event::get_type_str((Log_event_type) (uchar) + buf[EVENT_TYPE_OFFSET]), + mi->last_queued_gtid); + goto err; } - else if (mi->events_queued_since_last_gtid) - ++mi->events_queued_since_last_gtid; } if (!is_compress_event) @@ -6900,7 +7117,6 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len) */ mysql_mutex_lock(log_lock); - s_id= uint4korr(buf + SERVER_ID_OFFSET); /* Write the event to the relay log, unless we reconnected in the middle of an event group and now need to skip the initial part of the group that @@ -6946,7 +7162,7 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len) else if ((s_id == global_system_variables.server_id && !(mi->rli.replicate_same_server_id || - (do_accept_own_server_id= rpl_semi_sync_slave_enabled))) || + mi->do_accept_own_server_id)) || event_that_should_be_ignored(buf) || /* the following conjunction deals with IGNORE_SERVER_IDS, if set @@ -7006,7 +7222,7 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len) } else { - if (do_accept_own_server_id) + if (mi->do_accept_own_server_id) { int2store(const_cast(buf + FLAGS_OFFSET), uint2korr(buf + FLAGS_OFFSET) | LOG_EVENT_ACCEPT_OWN_F); @@ -7041,8 +7257,9 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len) mi->using_gtid != Master_info::USE_GTID_NO && mi->events_queued_since_last_gtid > 0 && ( (mi->last_queued_gtid_standalone && - !Log_event::is_part_of_group((Log_event_type)(uchar) - buf[EVENT_TYPE_OFFSET])) || + (LOG_EVENT_IS_QUERY((Log_event_type)(uchar) + buf[EVENT_TYPE_OFFSET]) || + (uchar)buf[EVENT_TYPE_OFFSET] == INCIDENT_EVENT)) || (!mi->last_queued_gtid_standalone && ((uchar)buf[EVENT_TYPE_OFFSET] == XID_EVENT || (uchar)buf[EVENT_TYPE_OFFSET] == XA_PREPARE_LOG_EVENT || @@ -7054,11 +7271,13 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len) The whole of the current event group is queued. So in case of reconnect we can start from after the current GTID. */ - if (mi->gtid_reconnect_event_skip_count) + if (gtid_skip_enqueue) { bool first= true; StringBuffer<1024> gtid_text; + DBUG_ASSERT(mi->events_queued_since_last_gtid > 1); + rpl_slave_state_tostring_helper(>id_text, &mi->last_queued_gtid, &first); sql_print_error("Slave IO thread received a terminal event from " @@ -7068,6 +7287,8 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len) gtid_text.ptr(), mi->gtid_reconnect_event_skip_count, mi->events_queued_since_last_gtid); + error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE; + goto err; } mi->gtid_current_pos.update(&mi->last_queued_gtid); mi->events_queued_since_last_gtid= 0; @@ -7219,9 +7440,9 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, mi->ssl_ca[0]?mi->ssl_ca:0, mi->ssl_capath[0]?mi->ssl_capath:0, mi->ssl_cipher[0]?mi->ssl_cipher:0); - mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, - &mi->ssl_verify_server_cert); - mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, + mysql_options(mysql, MYSQL_OPT_SSL_CRL, + mi->ssl_crl[0] ? mi->ssl_crl : 0); + mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, mi->ssl_crlpath[0] ? mi->ssl_crlpath : 0); mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, &mi->ssl_verify_server_cert); @@ -7554,7 +7775,6 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size) if (hot_log) mysql_mutex_unlock(log_lock); - rli->sql_thread_caught_up= false; DBUG_RETURN(ev); } if (opt_reckless_slave) // For mysql-test @@ -7718,7 +7938,6 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size) rli->relay_log.wait_for_update_relay_log(rli->sql_driver_thd); // re-acquire data lock since we released it earlier mysql_mutex_lock(&rli->data_lock); - rli->sql_thread_caught_up= false; continue; } /* @@ -7909,12 +8128,19 @@ event(errno: %d cur_log->error: %d)", { sql_print_information("Error reading relay log event: %s", "slave SQL thread was killed"); - DBUG_RETURN(0); + goto end; } err: if (errmsg) sql_print_error("Error reading relay log event: %s", errmsg); + +end: + /* + Set that we are not caught up so if there is a hang/problem on restart, + Seconds_Behind_Master will still grow. + */ + rli->sql_thread_caught_up= false; DBUG_RETURN(0); } #ifdef WITH_WSREP @@ -8018,14 +8244,15 @@ int rotate_relay_log(Master_info* mi) @return TRUE if master has the bug, FALSE if it does not. */ bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report, - bool (*pred)(const void *), const void *param) + bool (*pred)(const void *), const void *param, + bool maria_master) { struct st_version_range_for_one_bug { uint bug_id; Version introduced_in; // first version with bug Version fixed_in; // first version with fix }; - static struct st_version_range_for_one_bug versions_for_all_bugs[]= + static struct st_version_range_for_one_bug versions_for_their_bugs[]= { {24432, { 5, 0, 24 }, { 5, 0, 38 } }, {24432, { 5, 1, 12 }, { 5, 1, 17 } }, @@ -8033,11 +8260,27 @@ bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report, {33029, { 5, 1, 0 }, { 5, 1, 12 } }, {37426, { 5, 1, 0 }, { 5, 1, 26 } }, }; + static struct st_version_range_for_one_bug versions_for_our_bugs[]= + { + {29621, { 10, 3, 36 }, { 10, 3, 39 } }, + {29621, { 10, 4, 26 }, { 10, 4, 29 } }, + {29621, { 10, 5, 17 }, { 10, 5, 20 } }, + {29621, { 10, 6, 9 }, { 10, 6, 13 } }, + {29621, { 10, 7, 5 }, { 10, 7, 9 } }, + {29621, { 10, 8, 4 }, { 10, 8, 8 } }, + {29621, { 10, 9, 2 }, { 10, 9, 6 } }, + {29621, { 10, 10,1 }, { 10, 10,4 } }, + {29621, { 10, 11,1 }, { 10, 11,3 } }, + }; const Version &master_ver= rli->relay_log.description_event_for_exec->server_version_split; + struct st_version_range_for_one_bug* versions_for_all_bugs= maria_master ? + versions_for_our_bugs : versions_for_their_bugs; + uint all_size= maria_master ? + sizeof(versions_for_our_bugs)/sizeof(*versions_for_our_bugs) : + sizeof(versions_for_their_bugs)/sizeof(*versions_for_their_bugs); - for (uint i= 0; - i < sizeof(versions_for_all_bugs)/sizeof(*versions_for_all_bugs);i++) + for (uint i= 0; i < all_size; i++) { const Version &introduced_in= versions_for_all_bugs[i].introduced_in; const Version &fixed_in= versions_for_all_bugs[i].fixed_in; @@ -8046,18 +8289,21 @@ bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report, fixed_in > master_ver && (pred == NULL || (*pred)(param))) { + const char *bug_source= maria_master ? + "https://jira.mariadb.org/browse/MDEV-" : + "http://bugs.mysql.com/bug.php?id="; if (!report) return TRUE; // a short message for SHOW SLAVE STATUS (message length constraints) my_printf_error(ER_UNKNOWN_ERROR, "master may suffer from" - " http://bugs.mysql.com/bug.php?id=%u" + " %s%u" " so slave stops; check error log on slave" - " for more info", MYF(0), bug_id); + " for more info", MYF(0), bug_source, bug_id); // a verbose message for the error log rli->report(ERROR_LEVEL, ER_UNKNOWN_ERROR, NULL, "According to the master's version ('%s')," " it is probable that master suffers from this bug:" - " http://bugs.mysql.com/bug.php?id=%u" + " %s%u" " and thus replicating the current binary log event" " may make the slave's data become different from the" " master's data." @@ -8071,6 +8317,7 @@ bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report, " equal to '%d.%d.%d'. Then replication can be" " restarted.", rli->relay_log.description_event_for_exec->server_version, + bug_source, bug_id, fixed_in[0], fixed_in[1], fixed_in[2]); return TRUE; diff --git a/sql/slave.h b/sql/slave.h index 5ca6054a178b3..02de9135c2a10 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -49,6 +49,7 @@ #include "rpl_filter.h" #include "rpl_tblmap.h" #include "rpl_gtid.h" +#include "log_event.h" #define SLAVE_NET_TIMEOUT 60 @@ -230,7 +231,8 @@ bool show_all_master_info(THD* thd); void show_binlog_info_get_fields(THD *thd, List *field_list); bool show_binlog_info(THD* thd); bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report, - bool (*pred)(const void *), const void *param); + bool (*pred)(const void *), const void *param, + bool maria_master= false); bool rpl_master_erroneous_autoinc(THD* thd); const char *print_slave_db_safe(const char *db); @@ -293,6 +295,17 @@ extern char *report_host, *report_password; extern I_List threads; +/* + Check that a binlog event (read from the relay log) is valid to update + last_master_timestamp. That is, a valid event is one with a consistent + timestamp which originated from a primary server. +*/ +static inline bool event_can_update_last_master_timestamp(Log_event *ev) +{ + return ev && !(ev->is_artificial_event() || ev->is_relay_log_event() || + (ev->when == 0)); +} + #else #define close_active_mi() /* no-op */ #endif /* HAVE_REPLICATION */ diff --git a/sql/sp.cc b/sql/sp.cc index 4ef23983f780a..74743347816fa 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2002, 2018, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB + Copyright (c) 2009, 2022, 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 @@ -1078,7 +1078,7 @@ sp_returns_type(THD *thd, String &result, const sp_head *sp) { result.append(STRING_WITH_LEN(" CHARSET ")); result.append(field->charset()->cs_name); - if (!(field->charset()->state & MY_CS_PRIMARY)) + if (Charset(field->charset()).can_have_collate_clause()) { result.append(STRING_WITH_LEN(" COLLATE ")); result.append(field->charset()->coll_name); diff --git a/sql/sp.h b/sql/sp.h index 0b79877a3e17d..c73ff2877b0ce 100644 --- a/sql/sp.h +++ b/sql/sp.h @@ -119,7 +119,7 @@ class Sp_handler const; public: - virtual ~Sp_handler() {} + virtual ~Sp_handler() = default; static const Sp_handler *handler(enum enum_sql_command cmd); static const Sp_handler *handler(enum_sp_type type); static const Sp_handler *handler(MDL_key::enum_mdl_namespace ns); diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc index b3949a9475184..36ad37104bda8 100644 --- a/sql/sp_cache.cc +++ b/sql/sp_cache.cc @@ -312,3 +312,12 @@ sp_cache::cleanup() { my_hash_free(&m_hashtable); } + + +void Sp_caches::sp_caches_clear() +{ + sp_cache_clear(&sp_proc_cache); + sp_cache_clear(&sp_func_cache); + sp_cache_clear(&sp_package_spec_cache); + sp_cache_clear(&sp_package_body_cache); +} diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 97905f6a5b4ad..d23b5e88baaa0 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -46,6 +46,7 @@ #include "sql_audit.h" #include "debug_sync.h" #ifdef WITH_WSREP +#include "wsrep.h" #include "wsrep_trans_observer.h" #endif /* WITH_WSREP */ @@ -410,6 +411,26 @@ Item *THD::sp_fix_func_item(Item **it_addr) } +/** + Prepare an Item for evaluation as an assignment source, + for assignment to the given target. + + @param to - the assignment target + @param it_addr - a pointer on item refernce + + @retval - NULL on error + @retval - a prepared item pointer on success +*/ +Item *THD::sp_fix_func_item_for_assignment(const Field *to, Item **it_addr) +{ + DBUG_ENTER("THD::sp_fix_func_item_for_assignment"); + Item *res= sp_fix_func_item(it_addr); + if (res && (!res->check_assignability_to(to, false))) + DBUG_RETURN(res); + DBUG_RETURN(NULL); +} + + /** Evaluate an expression and store the result in the field. @@ -829,7 +850,7 @@ void sp_head::set_stmt_end(THD *thd) { Lex_input_stream *lip= & thd->m_parser_state->m_lip; /* shortcut */ - const char *end_ptr= lip->get_cpp_ptr(); /* shortcut */ + const char *end_ptr= lip->get_cpp_tok_start(); /* shortcut */ /* Make the string of parameters. */ @@ -1498,7 +1519,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success) wsrep_current_error_status(thd)); thd->wsrep_cs().reset_error(); /* Reset also thd->killed if it has been set during BF abort. */ - if (thd->killed == KILL_QUERY) + if (killed_mask_hard(thd->killed) == KILL_QUERY) thd->killed= NOT_KILLED; /* if failed transaction was not replayed, must return with error from here */ if (!must_replay) err_status = 1; @@ -1882,7 +1903,7 @@ sp_head::execute_trigger(THD *thd, my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), priv_desc, thd->security_ctx->priv_user, thd->security_ctx->host_or_ip, - table_name->str); + db_name->str, table_name->str); m_security_ctx.restore_security_context(thd, save_ctx); DBUG_RETURN(TRUE); @@ -2079,7 +2100,8 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, /* Arguments must be fixed in Item_func_sp::fix_fields */ DBUG_ASSERT(argp[arg_no]->fixed()); - if ((err_status= (*func_ctx)->set_parameter(thd, arg_no, &(argp[arg_no])))) + err_status= bind_input_param(thd, argp[arg_no], arg_no, *func_ctx, TRUE); + if (err_status) goto err_with_cleanup; } @@ -2202,6 +2224,19 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, my_error(ER_SP_NORETURNEND, MYF(0), m_name.str); err_status= TRUE; } + else + { + /* + Copy back all OUT or INOUT values to the previous frame, or + set global user variables + */ + for (arg_no= 0; arg_no < argcount; arg_no++) + { + err_status= bind_output_param(thd, argp[arg_no], arg_no, octx, *func_ctx); + if (err_status) + break; + } + } } #ifndef NO_EMBEDDED_ACCESS_CHECKS @@ -2324,50 +2359,9 @@ sp_head::execute_procedure(THD *thd, List *args) if (!arg_item) break; - sp_variable *spvar= m_pcont->find_variable(i); - - if (!spvar) - continue; - - if (spvar->mode != sp_variable::MODE_IN) - { - Settable_routine_parameter *srp= - arg_item->get_settable_routine_parameter(); - - if (!srp) - { - my_error(ER_SP_NOT_VAR_ARG, MYF(0), i+1, ErrConvDQName(this).ptr()); - err_status= TRUE; - break; - } - - srp->set_required_privilege(spvar->mode == sp_variable::MODE_INOUT); - } - - if (spvar->mode == sp_variable::MODE_OUT) - { - Item_null *null_item= new (thd->mem_root) Item_null(thd); - Item *tmp_item= null_item; - - if (!null_item || - nctx->set_parameter(thd, i, &tmp_item)) - { - DBUG_PRINT("error", ("set variable failed")); - err_status= TRUE; - break; - } - } - else - { - if (nctx->set_parameter(thd, i, it_args.ref())) - { - DBUG_PRINT("error", ("set variable 2 failed")); - err_status= TRUE; - break; - } - } - - TRANSACT_TRACKER(add_trx_state_from_thd(thd)); + err_status= bind_input_param(thd, arg_item, i, nctx, FALSE); + if (err_status) + break; } /* @@ -2412,7 +2406,7 @@ sp_head::execute_procedure(THD *thd, List *args) Disable slow log if: - Slow logging is enabled (no change needed) - This is a normal SP (not event log) - - If we have not explicitely disabled logging of SP + - If we have not explicitly disabled logging of SP */ if (save_enable_slow_log && ((!(m_flags & LOG_SLOW_STATEMENTS) && @@ -2426,7 +2420,7 @@ sp_head::execute_procedure(THD *thd, List *args) Disable general log if: - If general log is enabled (no change needed) - This is a normal SP (not event log) - - If we have not explicitely disabled logging of SP + - If we have not explicitly disabled logging of SP */ if (!(thd->variables.option_bits & OPTION_LOG_OFF) && (!(m_flags & LOG_GENERAL_LOG) && @@ -2477,31 +2471,9 @@ sp_head::execute_procedure(THD *thd, List *args) if (!arg_item) break; - sp_variable *spvar= m_pcont->find_variable(i); - - if (spvar->mode == sp_variable::MODE_IN) - continue; - - Settable_routine_parameter *srp= - arg_item->get_settable_routine_parameter(); - - DBUG_ASSERT(srp); - - if (srp->set_value(thd, octx, nctx->get_variable_addr(i))) - { - DBUG_PRINT("error", ("set value failed")); - err_status= TRUE; + err_status= bind_output_param(thd, arg_item, i, octx, nctx); + if (err_status) break; - } - - Send_field *out_param_info= new (thd->mem_root) Send_field(thd, nctx->get_parameter(i)); - out_param_info->db_name= m_db; - out_param_info->table_name= m_name; - out_param_info->org_table_name= m_name; - out_param_info->col_name= spvar->name; - out_param_info->org_col_name= spvar->name; - - srp->set_out_param_info(out_param_info); } } @@ -2532,6 +2504,112 @@ sp_head::execute_procedure(THD *thd, List *args) DBUG_RETURN(err_status); } +bool +sp_head::bind_input_param(THD *thd, + Item *arg_item, + uint arg_no, + sp_rcontext *nctx, + bool is_function) +{ + DBUG_ENTER("sp_head::bind_input_param"); + + sp_variable *spvar= m_pcont->find_variable(arg_no); + if (!spvar) + DBUG_RETURN(FALSE); + + if (spvar->mode != sp_variable::MODE_IN) + { + Settable_routine_parameter *srp= + arg_item->get_settable_routine_parameter(); + + if (!srp) + { + my_error(ER_SP_NOT_VAR_ARG, MYF(0), arg_no+1, ErrConvDQName(this).ptr()); + DBUG_RETURN(TRUE); + } + + if (is_function) + { + /* + Check if the function is called from SELECT/INSERT/UPDATE/DELETE query + and parameter is OUT or INOUT. + If yes, it is an invalid call - throw error. + */ + if (thd->lex->sql_command == SQLCOM_SELECT || + thd->lex->sql_command == SQLCOM_INSERT || + thd->lex->sql_command == SQLCOM_INSERT_SELECT || + thd->lex->sql_command == SQLCOM_UPDATE || + thd->lex->sql_command == SQLCOM_DELETE) + { + my_error(ER_SF_OUT_INOUT_ARG_NOT_ALLOWED, MYF(0), arg_no+1, m_name.str); + DBUG_RETURN(TRUE); + } + } + + srp->set_required_privilege(spvar->mode == sp_variable::MODE_INOUT); + } + + if (spvar->mode == sp_variable::MODE_OUT) + { + Item_null *null_item= new (thd->mem_root) Item_null(thd); + Item *tmp_item= null_item; + + if (!null_item || + nctx->set_parameter(thd, arg_no, &tmp_item)) + { + DBUG_PRINT("error", ("set variable failed")); + DBUG_RETURN(TRUE); + } + } + else + { + if (nctx->set_parameter(thd, arg_no, &arg_item)) + { + DBUG_PRINT("error", ("set variable 2 failed")); + DBUG_RETURN(TRUE); + } + } + + TRANSACT_TRACKER(add_trx_state_from_thd(thd)); + + DBUG_RETURN(FALSE); +} + +bool +sp_head::bind_output_param(THD *thd, + Item *arg_item, + uint arg_no, + sp_rcontext *octx, + sp_rcontext *nctx) +{ + DBUG_ENTER("sp_head::bind_output_param"); + + sp_variable *spvar= m_pcont->find_variable(arg_no); + if (spvar->mode == sp_variable::MODE_IN) + DBUG_RETURN(FALSE); + + Settable_routine_parameter *srp= + arg_item->get_settable_routine_parameter(); + + DBUG_ASSERT(srp); + + if (srp->set_value(thd, octx, nctx->get_variable_addr(arg_no))) + { + DBUG_PRINT("error", ("set value failed")); + DBUG_RETURN(TRUE); + } + + Send_field *out_param_info= new (thd->mem_root) Send_field(thd, nctx->get_parameter(arg_no)); + out_param_info->db_name= m_db; + out_param_info->table_name= m_name; + out_param_info->org_table_name= m_name; + out_param_info->col_name= spvar->name; + out_param_info->org_col_name= spvar->name; + + srp->set_out_param_info(out_param_info); + + DBUG_RETURN(FALSE); +} /** Reset lex during parsing, before we parse a sub statement. @@ -3551,6 +3629,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp, lex_query_tables_own_last= m_lex->query_tables_own_last; prelocking_tables= *lex_query_tables_own_last; *lex_query_tables_own_last= NULL; + m_lex->query_tables_last= m_lex->query_tables_own_last; m_lex->mark_as_requiring_prelocking(NULL); } thd->rollback_item_tree_changes(); @@ -4070,7 +4149,7 @@ sp_instr_jump_if_not::exec_core(THD *thd, uint *nextp) Item *it; int res; - it= thd->sp_prepare_func_item(&m_expr); + it= thd->sp_prepare_func_item(&m_expr, 1); if (! it) { res= -1; diff --git a/sql/sp_head.h b/sql/sp_head.h index 475f1e0d42463..5b4aa36e518d2 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -1,7 +1,7 @@ /* -*- C++ -*- */ /* Copyright (c) 2002, 2011, Oracle and/or its affiliates. - Copyright (c) 2020, MariaDB + Copyright (c) 2020, 2022, 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 @@ -124,8 +124,7 @@ class sp_name : public Sql_alloc, /** Create temporary sp_name object from MDL key. Store in qname_buff */ sp_name(const MDL_key *key, char *qname_buff); - ~sp_name() - {} + ~sp_name() = default; }; @@ -505,6 +504,18 @@ class sp_head :private Query_arena, sp_assignment_lex *param_lex, Item_args *parameters); + bool bind_input_param(THD *thd, + Item *arg_item, + uint arg_no, + sp_rcontext *nctx, + bool is_function); + + bool bind_output_param(THD *thd, + Item *arg_item, + uint arg_no, + sp_rcontext *octx, + sp_rcontext *nctx); + public: /** Generate a code for an "OPEN cursor" statement. @@ -625,6 +636,23 @@ class sp_head :private Query_arena, DBUG_RETURN(false); } + /** + Iterate through the LEX stack from the top (the newest) to the bottom + (the oldest) and find the one that contains a non-zero spname. + @returns - the address of spname, or NULL of no spname found. + */ + const sp_name *find_spname_recursive() + { + uint count= m_lex.elements; + for (uint i= 0; i < count; i++) + { + const LEX *tmp= m_lex.elem(count - i - 1); + if (tmp->spname) + return tmp->spname; + } + return NULL; + } + /// Put the instruction on the backpatch list, associated with the label. int push_backpatch(THD *thd, sp_instr *, sp_label *); @@ -1041,8 +1069,9 @@ class sp_lex_cursor: public sp_lex_local, public Query_arena Query_arena(thd->lex->sphead->get_main_mem_root(), STMT_INITIALIZED_FOR_SP) { } ~sp_lex_cursor() { free_items(); } - void cleanup_stmt(bool /*restore_set_statement_vars*/) { } - Query_arena *query_arena() { return this; } + virtual bool cleanup_stmt(bool /*restore_set_statement_vars*/) override + { return false; } + Query_arena *query_arena() override { return this; } bool validate() { DBUG_ASSERT(sql_command == SQLCOM_SELECT); @@ -1286,8 +1315,7 @@ class sp_instr_stmt : public sp_instr m_query.length= 0; } - virtual ~sp_instr_stmt() - {}; + virtual ~sp_instr_stmt() = default; virtual int execute(THD *thd, uint *nextp); @@ -1322,8 +1350,7 @@ class sp_instr_set : public sp_instr m_lex_keeper(lex, lex_resp) {} - virtual ~sp_instr_set() - {} + virtual ~sp_instr_set() = default; virtual int execute(THD *thd, uint *nextp); @@ -1366,8 +1393,7 @@ class sp_instr_set_row_field : public sp_instr_set m_field_offset(field_offset) {} - virtual ~sp_instr_set_row_field() - {} + virtual ~sp_instr_set_row_field() = default; virtual int exec_core(THD *thd, uint *nextp); @@ -1409,8 +1435,7 @@ class sp_instr_set_row_field_by_name : public sp_instr_set m_field_name(field_name) {} - virtual ~sp_instr_set_row_field_by_name() - {} + virtual ~sp_instr_set_row_field_by_name() = default; virtual int exec_core(THD *thd, uint *nextp); @@ -1436,8 +1461,7 @@ class sp_instr_set_trigger_field : public sp_instr value(val), m_lex_keeper(lex, TRUE) {} - virtual ~sp_instr_set_trigger_field() - {} + virtual ~sp_instr_set_trigger_field() = default; virtual int execute(THD *thd, uint *nextp); @@ -1480,8 +1504,7 @@ class sp_instr_opt_meta : public sp_instr m_dest(dest), m_cont_dest(0), m_optdest(0), m_cont_optdest(0) {} - virtual ~sp_instr_opt_meta() - {} + virtual ~sp_instr_opt_meta() = default; virtual void set_destination(uint old_dest, uint new_dest) = 0; @@ -1510,8 +1533,7 @@ class sp_instr_jump : public sp_instr_opt_meta : sp_instr_opt_meta(ip, ctx, dest) {} - virtual ~sp_instr_jump() - {} + virtual ~sp_instr_jump() = default; virtual int execute(THD *thd, uint *nextp); @@ -1562,8 +1584,7 @@ class sp_instr_jump_if_not : public sp_instr_jump m_lex_keeper(lex, TRUE) {} - virtual ~sp_instr_jump_if_not() - {} + virtual ~sp_instr_jump_if_not() = default; virtual int execute(THD *thd, uint *nextp); @@ -1610,8 +1631,7 @@ class sp_instr_preturn : public sp_instr : sp_instr(ip, ctx) {} - virtual ~sp_instr_preturn() - {} + virtual ~sp_instr_preturn() = default; virtual int execute(THD *thd, uint *nextp); @@ -1642,8 +1662,7 @@ class sp_instr_freturn : public sp_instr m_lex_keeper(lex, TRUE) {} - virtual ~sp_instr_freturn() - {} + virtual ~sp_instr_freturn() = default; virtual int execute(THD *thd, uint *nextp); @@ -1748,8 +1767,7 @@ class sp_instr_hpop : public sp_instr : sp_instr(ip, ctx), m_count(count) {} - virtual ~sp_instr_hpop() - {} + virtual ~sp_instr_hpop() = default; void update_count(uint count) { @@ -1782,8 +1800,7 @@ class sp_instr_hreturn : public sp_instr_jump m_frame(ctx->current_var_count()) {} - virtual ~sp_instr_hreturn() - {} + virtual ~sp_instr_hreturn() = default; virtual int execute(THD *thd, uint *nextp); @@ -1819,27 +1836,26 @@ class sp_instr_cpush : public sp_instr, public sp_cursor : sp_instr(ip, ctx), m_lex_keeper(lex, TRUE), m_cursor(offset) {} - virtual ~sp_instr_cpush() - {} + virtual ~sp_instr_cpush() = default; - virtual int execute(THD *thd, uint *nextp); + int execute(THD *thd, uint *nextp) override; - virtual void print(String *str); + void print(String *str) override; /** This call is used to cleanup the instruction when a sensitive cursor is closed. For now stored procedures always use materialized cursors and the call is not used. */ - virtual void cleanup_stmt(bool /*restore_set_statement_vars*/) - { /* no op */ } + virtual bool cleanup_stmt(bool /*restore_set_statement_vars*/) override + { return false; } private: sp_lex_keeper m_lex_keeper; uint m_cursor; /**< Frame offset (for debugging) */ public: - virtual PSI_statement_info* get_psi_info() { return & psi_info; } + PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; }; // class sp_instr_cpush : public sp_instr @@ -1855,8 +1871,7 @@ class sp_instr_cpop : public sp_instr : sp_instr(ip, ctx), m_count(count) {} - virtual ~sp_instr_cpop() - {} + virtual ~sp_instr_cpop() = default; void update_count(uint count) { @@ -1888,8 +1903,7 @@ class sp_instr_copen : public sp_instr : sp_instr(ip, ctx), m_cursor(c) {} - virtual ~sp_instr_copen() - {} + virtual ~sp_instr_copen() = default; virtual int execute(THD *thd, uint *nextp); @@ -1926,8 +1940,7 @@ class sp_instr_cursor_copy_struct: public sp_instr m_cursor(coffs), m_var(voffs) {} - virtual ~sp_instr_cursor_copy_struct() - {} + virtual ~sp_instr_cursor_copy_struct() = default; virtual int execute(THD *thd, uint *nextp); virtual int exec_core(THD *thd, uint *nextp); virtual void print(String *str); @@ -1949,8 +1962,7 @@ class sp_instr_cclose : public sp_instr : sp_instr(ip, ctx), m_cursor(c) {} - virtual ~sp_instr_cclose() - {} + virtual ~sp_instr_cclose() = default; virtual int execute(THD *thd, uint *nextp); @@ -1979,8 +1991,7 @@ class sp_instr_cfetch : public sp_instr m_varlist.empty(); } - virtual ~sp_instr_cfetch() - {} + virtual ~sp_instr_cfetch() = default; virtual int execute(THD *thd, uint *nextp); @@ -2018,8 +2029,7 @@ class sp_instr_agg_cfetch : public sp_instr sp_instr_agg_cfetch(uint ip, sp_pcontext *ctx) : sp_instr(ip, ctx){} - virtual ~sp_instr_agg_cfetch() - {} + virtual ~sp_instr_agg_cfetch() = default; virtual int execute(THD *thd, uint *nextp); @@ -2044,8 +2054,7 @@ class sp_instr_error : public sp_instr : sp_instr(ip, ctx), m_errcode(errcode) {} - virtual ~sp_instr_error() - {} + virtual ~sp_instr_error() = default; virtual int execute(THD *thd, uint *nextp); @@ -2078,8 +2087,7 @@ class sp_instr_set_case_expr : public sp_instr_opt_meta m_lex_keeper(lex, TRUE) {} - virtual ~sp_instr_set_case_expr() - {} + virtual ~sp_instr_set_case_expr() = default; virtual int execute(THD *thd, uint *nextp); diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index 619218f3b6838..d2fe53a2431f4 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -715,7 +715,7 @@ Item_cache *sp_rcontext::create_case_expr_holder(THD *thd, bool sp_rcontext::set_case_expr(THD *thd, int case_expr_id, Item **case_expr_item_ptr) { - Item *case_expr_item= thd->sp_prepare_func_item(case_expr_item_ptr); + Item *case_expr_item= thd->sp_prepare_func_item(case_expr_item_ptr, 1); if (!case_expr_item) return true; diff --git a/sql/spatial.cc b/sql/spatial.cc index 527a1df9d1f5e..9bf6110c991c2 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -635,7 +635,8 @@ Geometry *Geometry::create_from_json(Geometry_buffer *buffer, if (feature_type_found) goto handle_geometry_key; } - goto err_return; + else + goto err_return; } else { @@ -1094,10 +1095,9 @@ double Gis_point::calculate_haversine(const Geometry *g, point_temp[point_size-1]= '\0'; Geometry_buffer gbuff; Geometry *gg= Geometry::construct(&gbuff, point_temp, point_size-1); - DBUG_ASSERT(gg); - if (static_cast(gg)->get_xy_radian(&x2r, &y2r)) + if (!gg || static_cast(gg)->get_xy_radian(&x2r, &y2r)) { - DBUG_ASSERT(0); + *error= 2; return -1; } } @@ -1105,15 +1105,16 @@ double Gis_point::calculate_haversine(const Geometry *g, { if (static_cast(g)->get_xy_radian(&x2r, &y2r)) { - DBUG_ASSERT(0); + *error= 2; return -1; } } if (this->get_xy_radian(&x1r, &y1r)) { - DBUG_ASSERT(0); + *error= 2; return -1; } + // // Check boundary conditions: longitude[-180,180] if (!((x2r >= -M_PI && x2r <= M_PI) && (x1r >= -M_PI && x1r <= M_PI))) { @@ -1166,15 +1167,20 @@ int Gis_point::spherical_distance_multipoints(Geometry *g, const double r, { Geometry_buffer buff_temp; Geometry *temp; + const char *pt_ptr= g->get_data_ptr()+ + 4+WKB_HEADER_SIZE*i + POINT_DATA_SIZE*(i-1); // First 4 bytes are handled already, make sure to create a Point memset(s + 4, Geometry::wkb_point, 1); + if (g->no_data(pt_ptr, POINT_DATA_SIZE)) + return 1; + memcpy(s + 5, g->get_data_ptr() + 5, 4); - memcpy(s + 4 + WKB_HEADER_SIZE, g->get_data_ptr() + 4 + WKB_HEADER_SIZE*i +\ - POINT_DATA_SIZE*(i-1), POINT_DATA_SIZE); + memcpy(s + 4 + WKB_HEADER_SIZE, pt_ptr, POINT_DATA_SIZE); s[len-1]= '\0'; temp= Geometry::construct(&buff_temp, s, len); - DBUG_ASSERT(temp); + if (!temp) + return 1; temp_res= this->calculate_haversine(temp, r, err); if (res > temp_res) res= temp_res; @@ -2351,14 +2357,18 @@ int Gis_multi_point::spherical_distance_multipoints(Geometry *g, const double r, Geometry *temp; double temp_res= 0.0; char s[len]; + const char *pt_ptr= get_data_ptr()+ + 4+WKB_HEADER_SIZE*i + POINT_DATA_SIZE*(i-1); // First 4 bytes are handled already, make sure to create a Point memset(s + 4, Geometry::wkb_point, 1); + if (no_data(pt_ptr, POINT_DATA_SIZE)) + return 1; memcpy(s + 5, this->get_data_ptr() + 5, 4); - memcpy(s + 4 + WKB_HEADER_SIZE, this->get_data_ptr() + 4 + WKB_HEADER_SIZE*i +\ - POINT_DATA_SIZE*(i-1), POINT_DATA_SIZE); + memcpy(s + 4 + WKB_HEADER_SIZE, pt_ptr, POINT_DATA_SIZE); s[len-1]= '\0'; temp= Geometry::construct(&buff_temp, s, len); - DBUG_ASSERT(temp); + if (!temp) + return 1; // Optimization for single Multipoint if (num_of_points2 == 1) { @@ -2370,14 +2380,18 @@ int Gis_multi_point::spherical_distance_multipoints(Geometry *g, const double r, Geometry_buffer buff_temp2; Geometry *temp2; char s2[len]; + const char *pt_ptr= g->get_data_ptr()+ + 4+WKB_HEADER_SIZE*j + POINT_DATA_SIZE*(j-1); // First 4 bytes are handled already, make sure to create a Point memset(s2 + 4, Geometry::wkb_point, 1); + if (g->no_data(pt_ptr, POINT_DATA_SIZE)) + return 1; memcpy(s2 + 5, g->get_data_ptr() + 5, 4); - memcpy(s2 + 4 + WKB_HEADER_SIZE, g->get_data_ptr() + 4 + WKB_HEADER_SIZE*j +\ - POINT_DATA_SIZE*(j-1), POINT_DATA_SIZE); + memcpy(s2 + 4 + WKB_HEADER_SIZE, pt_ptr, POINT_DATA_SIZE); s2[len-1]= '\0'; temp2= Geometry::construct(&buff_temp2, s2, len); - DBUG_ASSERT(temp2); + if (!temp2) + return 1; temp_res= static_cast(temp)->calculate_haversine(temp2, r, err); if (res > temp_res) res= temp_res; diff --git a/sql/spatial.h b/sql/spatial.h index 7b33529ee94c2..d85bdc86af48b 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -214,8 +214,8 @@ struct Geometry_buffer; class Geometry { public: - Geometry() {} /* Remove gcc warning */ - virtual ~Geometry() {} /* Remove gcc warning */ + Geometry() = default; /* Remove gcc warning */ + virtual ~Geometry() = default; /* Remove gcc warning */ static void *operator new(size_t size, void *buffer) { return buffer; @@ -353,6 +353,7 @@ class Geometry const char *get_mbr_for_points(MBR *mbr, const char *data, uint offset) const; +public: /** Check if there're enough data remaining as requested @@ -383,6 +384,7 @@ class Geometry (expected_points > ((m_data_end - data) / (POINT_DATA_SIZE + extra_point_space)))); } +protected: const char *m_data; const char *m_data_end; }; @@ -393,8 +395,8 @@ class Geometry class Gis_point: public Geometry { public: - Gis_point() {} /* Remove gcc warning */ - virtual ~Gis_point() {} /* Remove gcc warning */ + Gis_point() = default; /* Remove gcc warning */ + virtual ~Gis_point() = default; /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -463,8 +465,8 @@ class Gis_point: public Geometry class Gis_line_string: public Geometry { public: - Gis_line_string() {} /* Remove gcc warning */ - virtual ~Gis_line_string() {} /* Remove gcc warning */ + Gis_line_string() = default; /* Remove gcc warning */ + virtual ~Gis_line_string() = default; /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -496,8 +498,8 @@ class Gis_line_string: public Geometry class Gis_polygon: public Geometry { public: - Gis_polygon() {} /* Remove gcc warning */ - virtual ~Gis_polygon() {} /* Remove gcc warning */ + Gis_polygon() = default; /* Remove gcc warning */ + virtual ~Gis_polygon() = default; /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -533,8 +535,8 @@ class Gis_multi_point: public Geometry (uint32) (UINT_MAX32 - WKB_HEADER_SIZE - 4 /* n_points */) / (WKB_HEADER_SIZE + POINT_DATA_SIZE); public: - Gis_multi_point() {} /* Remove gcc warning */ - virtual ~Gis_multi_point() {} /* Remove gcc warning */ + Gis_multi_point() = default; /* Remove gcc warning */ + virtual ~Gis_multi_point() = default; /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -564,8 +566,8 @@ class Gis_multi_point: public Geometry class Gis_multi_line_string: public Geometry { public: - Gis_multi_line_string() {} /* Remove gcc warning */ - virtual ~Gis_multi_line_string() {} /* Remove gcc warning */ + Gis_multi_line_string() = default; /* Remove gcc warning */ + virtual ~Gis_multi_line_string() = default; /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -595,8 +597,8 @@ class Gis_multi_line_string: public Geometry class Gis_multi_polygon: public Geometry { public: - Gis_multi_polygon() {} /* Remove gcc warning */ - virtual ~Gis_multi_polygon() {} /* Remove gcc warning */ + Gis_multi_polygon() = default; /* Remove gcc warning */ + virtual ~Gis_multi_polygon() = default; /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -626,8 +628,8 @@ class Gis_multi_polygon: public Geometry class Gis_geometry_collection: public Geometry { public: - Gis_geometry_collection() {} /* Remove gcc warning */ - virtual ~Gis_geometry_collection() {} /* Remove gcc warning */ + Gis_geometry_collection() = default; /* Remove gcc warning */ + virtual ~Gis_geometry_collection() = default; /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 2d7f62cd72503..283c629f42abb 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2018, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB + Copyright (c) 2009, 2023, 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 @@ -56,6 +56,7 @@ #include "password.h" #include "sql_plugin_compat.h" +#include "wsrep_mysqld.h" #define MAX_SCRAMBLE_LENGTH 1024 @@ -199,7 +200,7 @@ class ACL_USER :public ACL_USER_BASE, { public: - ACL_USER() { } + ACL_USER() = default; ACL_USER(THD *thd, const LEX_USER &combo, const Account_options &options, const privilege_t privileges); @@ -337,7 +338,7 @@ class ACL_PROXY_USER :public ACL_ACCESS MYSQL_PROXIES_PRIV_GRANTOR, MYSQL_PROXIES_PRIV_TIMESTAMP } proxy_table_fields; public: - ACL_PROXY_USER () {}; + ACL_PROXY_USER () = default; void init(const char *host_arg, const char *user_arg, const char *proxied_host_arg, const char *proxied_user_arg, @@ -382,9 +383,9 @@ class ACL_PROXY_USER :public ACL_ACCESS update_hostname(&host, safe_strdup_root(mem, host_arg)); } - bool check_validity(bool check_no_resolve) + bool check_validity() { - if (check_no_resolve && + if (opt_skip_name_resolve && (hostname_requires_resolving(host.hostname) || hostname_requires_resolving(proxied_host.hostname))) { @@ -928,7 +929,7 @@ class User_table: public Grant_table_base virtual longlong get_password_lifetime () const = 0; virtual int set_password_lifetime (longlong x) const = 0; - virtual ~User_table() {} + virtual ~User_table() = default; private: friend class Grant_tables; virtual int setup_sysvars() const = 0; @@ -1277,7 +1278,7 @@ class User_table_tabular: public User_table return 1; } - virtual ~User_table_tabular() {} + virtual ~User_table_tabular() = default; private: friend class Grant_tables; @@ -1688,7 +1689,7 @@ class User_table_json: public User_table int set_password_expired (bool x) const { return x ? set_password_last_changed(0) : 0; } - ~User_table_json() {} + ~User_table_json() = default; private: friend class Grant_tables; static const uint JSON_SIZE=1024; @@ -1937,10 +1938,17 @@ class Grant_tables public: Grant_tables() : p_user_table(&m_user_table_json) { } - int open_and_lock(THD *thd, int which_tables, enum thr_lock_type lock_type) + /** + An auxiliary to build a list of involved tables. + + @retval 0 Success + @retval -1 A my_error reported error + */ + int build_table_list(THD *thd, TABLE_LIST** ptr_first, + int which_tables, enum thr_lock_type lock_type, + TABLE_LIST *tables) { - DBUG_ENTER("Grant_tables::open_and_lock"); - TABLE_LIST tables[USER_TABLE+1], *first= NULL; + DBUG_ENTER("Grant_tables::build_table_list"); DBUG_ASSERT(which_tables); /* At least one table must be opened. */ /* @@ -1965,12 +1973,23 @@ class Grant_tables tl->updating= lock_type >= TL_FIRST_WRITE; if (i >= FIRST_OPTIONAL_TABLE) tl->open_strategy= TABLE_LIST::OPEN_IF_EXISTS; - tl->next_global= tl->next_local= first; - first= tl; + tl->next_global= tl->next_local= *ptr_first; + *ptr_first= tl; } else tl->table= NULL; } + DBUG_RETURN(0); + } + + int open_and_lock(THD *thd, int which_tables, enum thr_lock_type lock_type) + { + DBUG_ENTER("Grant_tables::open_and_lock"); + + TABLE_LIST tables[USER_TABLE+1], *first= NULL; + + if (build_table_list(thd, &first, which_tables, lock_type, tables)) + DBUG_RETURN(-1); uint counter; int res= really_open(thd, first, &counter); @@ -2041,6 +2060,50 @@ class Grant_tables inline const Roles_mapping_table& roles_mapping_table() const { return m_roles_mapping_table; } +#ifdef HAVE_REPLICATION + /** + Checks if the tables targeted by a grant command should be ignored because + of the configured replication filters + + @retval 1 Tables are excluded for replication + @retval 0 tables are included for replication + */ + int rpl_ignore_tables(THD *thd, TABLE_LIST* tables, int which_tables= 0, + enum thr_lock_type lock_type= TL_IGNORE) + { + DBUG_ENTER("Grant_tables::rpl_ignore_tables"); + + if (!(thd->slave_thread && !thd->spcont)) + DBUG_RETURN(0); + + TABLE_LIST all_tables[USER_TABLE+1]; + + if (!tables) + { + int rc __attribute__((unused))= + build_table_list(thd, &tables, which_tables, lock_type, all_tables); + + DBUG_ASSERT(!rc); // Grant_tables must be already initialized + DBUG_ASSERT(tables); + } + + if (tables->lock_type >= TL_FIRST_WRITE) + { + /* + GRANT and REVOKE are applied the slave in/exclusion rules as they are + some kind of updates to the mysql.% tables. + */ + Rpl_filter *rpl_filter= thd->system_thread_info.rpl_sql_info->rpl_filter; + if (rpl_filter->is_on() && !rpl_filter->tables_ok(0, tables)) + { + thd->slave_expected_error= 0; + DBUG_RETURN(1); + } + } + DBUG_RETURN(0); + } +#endif + private: /* Before any operation is possible on grant tables, they must be opened. @@ -2054,16 +2117,9 @@ class Grant_tables { DBUG_ENTER("Grant_tables::really_open:"); #ifdef HAVE_REPLICATION - if (tables->lock_type >= TL_FIRST_WRITE && - thd->slave_thread && !thd->spcont) + if (rpl_ignore_tables(thd, tables)) { - /* - GRANT and REVOKE are applied the slave in/exclusion rules as they are - some kind of updates to the mysql.% tables. - */ - Rpl_filter *rpl_filter= thd->system_thread_info.rpl_sql_info->rpl_filter; - if (rpl_filter->is_on() && !rpl_filter->tables_ok(0, tables)) - DBUG_RETURN(1); + DBUG_RETURN(1); } #endif if (open_tables(thd, &tables, counter, MYSQL_LOCK_IGNORE_TIMEOUT)) @@ -2175,7 +2231,12 @@ static my_bool do_validate(THD *, plugin_ref plugin, void *arg) struct validation_data *data= (struct validation_data *)arg; struct st_mariadb_password_validation *handler= (st_mariadb_password_validation *)plugin_decl(plugin)->info; - return handler->validate_password(data->user, data->password, data->host); + if (handler->validate_password(data->user, data->password, data->host)) + { + my_error(ER_NOT_VALID_PASSWORD, MYF(0), plugin_ref_to_int(plugin)->name.str); + return true; + } + return false; } @@ -2191,7 +2252,6 @@ static bool validate_password(THD *thd, const LEX_CSTRING &user, if (plugin_foreach(NULL, do_validate, MariaDB_PASSWORD_VALIDATION_PLUGIN, &data)) { - my_error(ER_NOT_VALID_PASSWORD, MYF(0)); return true; } } @@ -2266,6 +2326,12 @@ static int set_user_auth(THD *thd, const LEX_CSTRING &user, goto end; } + if (thd->lex->sql_command == SQLCOM_SET_OPTION && !info->hash_password) + { + res= ER_SET_PASSWORD_AUTH_PLUGIN; + goto end; + } + if (info->hash_password && validate_password(thd, user, host, pwtext, auth->auth_string.length)) { @@ -2463,7 +2529,6 @@ static void push_new_user(const ACL_USER &user) static bool acl_load(THD *thd, const Grant_tables& tables) { READ_RECORD read_record_info; - bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE; char tmp_name[SAFE_NAME_LEN+1]; Sql_mode_save old_mode_save(thd); DBUG_ENTER("acl_load"); @@ -2503,15 +2568,17 @@ static bool acl_load(THD *thd, const Grant_tables& tables) "possible to remove this privilege using REVOKE.", host.host.hostname, host.db); } + else if (!host.db) + host.db= const_cast(host_not_specified.str); host.access= host_table.get_access(); host.access= fix_rights_for_db(host.access); host.sort= get_magic_sort("hd", host.host.hostname, host.db); - if (check_no_resolve && hostname_requires_resolving(host.host.hostname)) + if (opt_skip_name_resolve && + hostname_requires_resolving(host.host.hostname)) { sql_print_warning("'host' entry '%s|%s' " "ignored in --skip-name-resolve mode.", - safe_str(host.host.hostname), - safe_str(host.db)); + host.host.hostname, host.db); continue; } #ifndef TO_BE_REMOVED @@ -2577,7 +2644,8 @@ static bool acl_load(THD *thd, const Grant_tables& tables) } else { - if (check_no_resolve && hostname_requires_resolving(user.host.hostname)) + if (opt_skip_name_resolve && + hostname_requires_resolving(user.host.hostname)) { sql_print_warning("'user' entry '%s@%s' " "ignored in --skip-name-resolve mode.", user.user.str, @@ -2635,7 +2703,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables) sql_print_warning("Found an entry in the 'db' table with empty database name; Skipped"); continue; } - if (check_no_resolve && hostname_requires_resolving(db.host.hostname)) + if (opt_skip_name_resolve && hostname_requires_resolving(db.host.hostname)) { sql_print_warning("'db' entry '%s %s@%s' " "ignored in --skip-name-resolve mode.", @@ -2690,7 +2758,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables) { ACL_PROXY_USER proxy; proxy.init(proxies_priv_table, &acl_memroot); - if (proxy.check_validity(check_no_resolve)) + if (proxy.check_validity()) continue; if (push_dynamic(&acl_proxy_users, (uchar*) &proxy)) DBUG_RETURN(TRUE); @@ -3604,7 +3672,7 @@ privilege_t acl_get(const char *host, const char *ip, ACL_HOST *acl_host=dynamic_element(&acl_hosts,i,ACL_HOST*); if (compare_hostname(&acl_host->host,host,ip)) { - if (!acl_host->db || !wild_compare(db,acl_host->db,db_is_pattern)) + if (!wild_compare(db, acl_host->db, db_is_pattern)) { host_access=acl_host->access; // Fully specified. Take it break; @@ -4036,7 +4104,7 @@ bool change_password(THD *thd, LEX_USER *user) if (update_user_table_password(thd, tables.user_table(), *acl_user)) goto end; - acl_cache->clear(1); // Clear locked hostname cache + hostname_cache_refresh(); // Clear locked hostname cache mysql_mutex_unlock(&acl_cache->lock); result= acl_cache_is_locked= 0; if (mysql_bin_log.is_open()) @@ -4070,6 +4138,17 @@ int acl_check_set_default_role(THD *thd, const char *host, const char *user, const char *role) { DBUG_ENTER("acl_check_set_default_role"); +#ifdef HAVE_REPLICATION + /* + If the roles_mapping table is excluded by the replication filter, we return + successful without validating the user/role data because the command will + be ignored in a later call to `acl_set_default_role()` for a graceful exit. + */ + Grant_tables tables; + TABLE_LIST* first= NULL; + if (tables.rpl_ignore_tables(thd, first, Table_roles_mapping, TL_WRITE)) + DBUG_RETURN(0); +#endif DBUG_RETURN(check_alter_user(thd, host, user) || check_user_can_set_role(thd, user, host, NULL, role, NULL)); } @@ -4182,7 +4261,6 @@ int acl_set_default_role(THD *thd, const char *host, const char *user, goto end; } - acl_cache->clear(1); mysql_mutex_unlock(&acl_cache->lock); result= 0; if (mysql_bin_log.is_open()) @@ -5249,7 +5327,7 @@ class GRANT_NAME :public Sql_alloc GRANT_NAME(const char *h, const char *d,const char *u, const char *t, privilege_t p, bool is_routine); GRANT_NAME (TABLE *form, bool is_routine); - virtual ~GRANT_NAME() {}; + virtual ~GRANT_NAME() = default; virtual bool ok() { return privs != NO_ACL; } void set_user_details(const char *h, const char *d, const char *u, const char *t, @@ -5317,7 +5395,7 @@ GRANT_NAME::GRANT_NAME(const char *h, const char *d,const char *u, GRANT_TABLE::GRANT_TABLE(const char *h, const char *d,const char *u, const char *t, privilege_t p, privilege_t c) - :GRANT_NAME(h,d,u,t,p, FALSE), cols(c), init_cols(NO_ACL) + :GRANT_NAME(h,d,u,t,p, FALSE), cols(c), init_cols(c) { init_hash(); } @@ -5657,8 +5735,11 @@ static int replace_column_table(GRANT_TABLE *g_t, error= 0; grant_column= column_hash_search(g_t, column->column.ptr(), column->column.length()); - if (grant_column) // Should always be true - grant_column->rights= privileges; // Update hash + if (grant_column) // Should always be true + { + grant_column->rights= privileges; // Update hash + grant_column->init_rights= privileges; + } } else // new grant { @@ -6108,6 +6189,7 @@ static int count_subgraph_nodes(ACL_ROLE *role, ACL_ROLE *grantee, void *context } static int merge_role_privileges(ACL_ROLE *, ACL_ROLE *, void *); +static bool merge_one_role_privileges(ACL_ROLE *grantee, PRIVS_TO_MERGE what); /** rebuild privileges of all affected roles @@ -6126,6 +6208,11 @@ static void propagate_role_grants(ACL_ROLE *role, mysql_mutex_assert_owner(&acl_cache->lock); PRIVS_TO_MERGE data= { what, db, name }; + /* + Before updating grants to roles that inherit from this role, ensure that + the effective grants on this role are up-to-date from *its* granted roles. + */ + merge_one_role_privileges(role, data); /* Changing privileges of a role causes all other roles that had this role granted to them to have their rights invalidated. @@ -6574,7 +6661,6 @@ static int table_name_sort(GRANT_TABLE * const *tbl1, GRANT_TABLE * const *tbl2) */ static int update_role_columns(GRANT_TABLE *merged, GRANT_TABLE **cur, GRANT_TABLE **last) - { privilege_t rights __attribute__((unused)) (NO_ACL); int changed= 0; @@ -6614,6 +6700,7 @@ static int update_role_columns(GRANT_TABLE *merged, } } +restart: for (uint i=0 ; i < mh->records ; i++) { GRANT_COLUMN *col = (GRANT_COLUMN *)my_hash_element(mh, i); @@ -6622,6 +6709,7 @@ static int update_role_columns(GRANT_TABLE *merged, { changed= 1; my_hash_delete(mh, (uchar*)col); + goto restart; } } DBUG_ASSERT(rights == merged->cols); @@ -6925,11 +7013,12 @@ static int merge_role_privileges(ACL_ROLE *role __attribute__((unused)), return !changed; // don't recurse into the subgraph if privs didn't change } -static bool merge_one_role_privileges(ACL_ROLE *grantee) +static +bool merge_one_role_privileges(ACL_ROLE *grantee, + PRIVS_TO_MERGE what) { - PRIVS_TO_MERGE data= { PRIVS_TO_MERGE::ALL, 0, 0 }; grantee->counter= 1; - return merge_role_privileges(0, grantee, &data); + return merge_role_privileges(0, grantee, &what); } /***************************************************************** @@ -7051,7 +7140,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, table_list->grant.want_privilege); my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), command, thd->security_ctx->priv_user, - thd->security_ctx->host_or_ip, table_list->alias.str); + thd->security_ctx->host_or_ip, table_list->db.str, + table_list->alias.str); DBUG_RETURN(-1); } } @@ -7120,15 +7210,15 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, /* Find/create cached table grant */ grant_table= table_hash_search(Str->host.str, NullS, db_name, - Str->user.str, table_name, 1); + Str->user.str, table_name, 1); if (!grant_table) { if (revoke_grant) { - my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0), + my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0), Str->user.str, Str->host.str, table_list->table_name.str); - result= TRUE; - continue; + result= TRUE; + continue; } grant_table= new (&grant_memroot) GRANT_TABLE(Str->host.str, db_name, Str->user.str, table_name, @@ -7137,8 +7227,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, if (!grant_table || column_priv_insert(grant_table)) { - result= TRUE; /* purecov: deadcode */ - continue; /* purecov: deadcode */ + result= TRUE; /* purecov: deadcode */ + continue; /* purecov: deadcode */ } } @@ -7152,11 +7242,15 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, /* Fix old grants */ while ((column = column_iter++)) { - grant_column = column_hash_search(grant_table, - column->column.ptr(), - column->column.length()); - if (grant_column) - grant_column->rights&= ~(column->rights | rights); + grant_column = column_hash_search(grant_table, + column->column.ptr(), + column->column.length()); + if (grant_column) + { + grant_column->init_rights&= ~(column->rights | rights); + // If this is a role, rights will need to be reconstructed. + grant_column->rights= grant_column->init_rights; + } } /* scan trough all columns to get new column grant */ column_priv= NO_ACL; @@ -7164,13 +7258,14 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, { grant_column= (GRANT_COLUMN*) my_hash_element(&grant_table->hash_columns, idx); - grant_column->rights&= ~rights; // Fix other columns - column_priv|= grant_column->rights; + grant_column->init_rights&= ~rights; // Fix other columns + grant_column->rights= grant_column->init_rights; + column_priv|= grant_column->init_rights; } } else { - column_priv|= grant_table->cols; + column_priv|= grant_table->init_cols; } @@ -7298,23 +7393,24 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, table_name= table_list->table_name.str; grant_name= routine_hash_search(Str->host.str, NullS, db_name, Str->user.str, table_name, sph, 1); - if (!grant_name || !grant_name->init_privs) + if (revoke_grant && (!grant_name || !grant_name->init_privs)) { - if (revoke_grant) - { - my_error(ER_NONEXISTING_PROC_GRANT, MYF(0), - Str->user.str, Str->host.str, table_name); - result= TRUE; - continue; - } + my_error(ER_NONEXISTING_PROC_GRANT, MYF(0), + Str->user.str, Str->host.str, table_name); + result= TRUE; + continue; + } + if (!grant_name) + { + DBUG_ASSERT(!revoke_grant); grant_name= new GRANT_NAME(Str->host.str, db_name, - Str->user.str, table_name, - rights, TRUE); + Str->user.str, table_name, + rights, TRUE); if (!grant_name || - my_hash_insert(sph->get_priv_hash(), (uchar*) grant_name)) + my_hash_insert(sph->get_priv_hash(), (uchar*) grant_name)) { result= TRUE; - continue; + continue; } } @@ -7651,8 +7747,11 @@ bool mysql_grant_role(THD *thd, List &list, bool revoke) Only need to propagate grants when granting/revoking a role to/from a role */ - if (role_as_user && merge_one_role_privileges(role_as_user) == 0) + if (role_as_user) + { propagate_role_grants(role_as_user, PRIVS_TO_MERGE::ALL); + acl_cache->clear(1); + } } mysql_mutex_unlock(&acl_cache->lock); @@ -7838,7 +7937,6 @@ static bool grant_load(THD *thd, { bool return_val= 1; TABLE *t_table, *c_table, *p_table; - bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE; MEM_ROOT *save_mem_root= thd->mem_root; DBUG_ENTER("grant_load"); @@ -7885,7 +7983,7 @@ static bool grant_load(THD *thd, goto end_unlock; } - if (check_no_resolve) + if (opt_skip_name_resolve) { if (hostname_requires_resolving(mem_check->host.hostname)) { @@ -7929,7 +8027,7 @@ static bool grant_load(THD *thd, goto end_unlock_p; } - if (check_no_resolve) + if (opt_skip_name_resolve) { if (hostname_requires_resolving(mem_check->host.hostname)) { @@ -8097,8 +8195,8 @@ bool grant_reload(THD *thd) @see check_table_access @note - This functions assumes that either number of tables to be inspected - by it is limited explicitly (i.e. is is not UINT_MAX) or table list + This function assumes that either number of tables to be inspected + by it is limited explicitly (i.e. is not UINT_MAX) or table list used and thd->lex->query_tables_own_last value correspond to each other (the latter should be either 0 or point to next_global member of one of elements of this table list). @@ -8303,7 +8401,7 @@ bool check_grant(THD *thd, privilege_t want_access, TABLE_LIST *tables, my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), command, sctx->priv_user, - sctx->host_or_ip, + sctx->host_or_ip, tl ? tl->db.str : "unknown", tl ? tl->get_table_name() : "unknown"); } DBUG_RETURN(TRUE); @@ -8487,7 +8585,7 @@ bool check_grant_all_columns(THD *thd, privilege_t want_access_arg, Security_context *sctx= thd->security_ctx; privilege_t want_access(NO_ACL); const char *table_name= NULL; - const char* db_name; + const char* db_name= NULL; GRANT_INFO *grant; GRANT_TABLE *UNINIT_VAR(grant_table); GRANT_TABLE *UNINIT_VAR(grant_table_role); @@ -8576,7 +8674,7 @@ bool check_grant_all_columns(THD *thd, privilege_t want_access_arg, if (using_column_privileges) my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), command, sctx->priv_user, - sctx->host_or_ip, table_name); + sctx->host_or_ip, db_name, table_name); else my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0), command, @@ -9752,9 +9850,8 @@ static bool show_table_and_column_privileges(THD *thd, const char *username, } else global.append(STRING_WITH_LEN(", ")); - global.append(grant_column->column, - grant_column->key_length, - system_charset_info); + append_identifier(thd, &global, grant_column->column, + grant_column->key_length); } } if (found_col) @@ -10271,9 +10368,6 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop, size_t old_key_length= acl_role->user.length; if (drop) { - /* all grants must be revoked from this role by now. propagate this */ - propagate_role_grants(acl_role, PRIVS_TO_MERGE::ALL); - // delete the role from cross-reference arrays for (size_t i=0; i < acl_role->role_grants.elements; i++) { @@ -10289,6 +10383,12 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop, remove_ptr_from_dynarray(&grantee->role_grants, acl_role); } + /* Remove all of the role_grants from this role. */ + delete_dynamic(&acl_role->role_grants); + + /* all grants must be revoked from this role by now. propagate this */ + propagate_role_grants(acl_role, PRIVS_TO_MERGE::ALL); + my_hash_delete(&acl_roles, (uchar*) acl_role); DBUG_RETURN(1); } @@ -10752,24 +10852,21 @@ static int handle_grant_data(THD *thd, Grant_tables& tables, bool drop, } /* Handle roles_mapping table. */ - if (tables.roles_mapping_table().table_exists()) + if (tables.roles_mapping_table().table_exists() && + (found= handle_grant_table(thd, tables.roles_mapping_table(), + ROLES_MAPPING_TABLE, drop, user_from, user_to)) < 0) { - if ((found= handle_grant_table(thd, tables.roles_mapping_table(), - ROLES_MAPPING_TABLE, drop, - user_from, user_to)) < 0) - { - /* Handle of table failed, don't touch the in-memory array. */ - result= -1; - } - else - { - /* Handle acl_roles_mappings array */ - if ((handle_grant_struct(ROLES_MAPPINGS_HASH, drop, user_from, user_to) || found) - && ! result) - result= 1; /* At least one record/element found */ - if (search_only) - goto end; - } + /* Handle of table failed, don't touch the in-memory array. */ + result= -1; + } + else + { + /* Handle acl_roles_mappings array */ + if ((handle_grant_struct(ROLES_MAPPINGS_HASH, drop, user_from, user_to) || found) + && ! result) + result= 1; /* At least one record/element found */ + if (search_only) + goto end; } /* Handle user table. */ @@ -11523,8 +11620,7 @@ class Silence_routine_definer_errors : public Internal_error_handler : is_grave(FALSE) {} - virtual ~Silence_routine_definer_errors() - {} + virtual ~Silence_routine_definer_errors() = default; virtual bool handle_condition(THD *thd, uint sql_errno, @@ -11995,8 +12091,7 @@ void Sql_cmd_grant::warn_hostname_requires_resolving(THD *thd, List_iterator it(users); while ((user= it++)) { - if (specialflag & SPECIAL_NO_RESOLVE && - hostname_requires_resolving(user->host.str)) + if (opt_skip_name_resolve && hostname_requires_resolving(user->host.str)) push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WARN_HOSTNAME_WONT_WORK, ER_THD(thd, ER_WARN_HOSTNAME_WONT_WORK)); @@ -14057,11 +14152,11 @@ static bool acl_check_ssl(THD *thd, const ACL_USER *acl_user) if (global_system_variables.log_warnings) sql_print_information("X509 issuer mismatch: should be '%s' " "but is '%s'", acl_user->x509_issuer, ptr); - free(ptr); + OPENSSL_free(ptr); X509_free(cert); return 1; } - free(ptr); + OPENSSL_free(ptr); } /* X509 subject is specified, we check it .. */ if (acl_user->x509_subject[0]) @@ -14074,11 +14169,11 @@ static bool acl_check_ssl(THD *thd, const ACL_USER *acl_user) if (global_system_variables.log_warnings) sql_print_information("X509 subject mismatch: should be '%s' but is '%s'", acl_user->x509_subject, ptr); - free(ptr); + OPENSSL_free(ptr); X509_free(cert); return 1; } - free(ptr); + OPENSSL_free(ptr); } X509_free(cert); return 0; @@ -14337,61 +14432,6 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len) if (initialized) // if not --skip-grant-tables { -#ifndef NO_EMBEDDED_ACCESS_CHECKS - bool is_proxy_user= FALSE; - const char *auth_user = acl_user->user.str; - ACL_PROXY_USER *proxy_user; - /* check if the user is allowed to proxy as another user */ - proxy_user= acl_find_proxy_user(auth_user, sctx->host, sctx->ip, - mpvio.auth_info.authenticated_as, - &is_proxy_user); - if (is_proxy_user) - { - ACL_USER *acl_proxy_user; - - /* we need to find the proxy user, but there was none */ - if (!proxy_user) - { - Host_errors errors; - errors.m_proxy_user= 1; - inc_host_errors(mpvio.auth_info.thd->security_ctx->ip, &errors); - if (!thd->is_error()) - login_failed_error(thd); - DBUG_RETURN(1); - } - - my_snprintf(sctx->proxy_user, sizeof(sctx->proxy_user) - 1, - "'%s'@'%s'", auth_user, - safe_str(acl_user->host.hostname)); - - /* we're proxying : find the proxy user definition */ - mysql_mutex_lock(&acl_cache->lock); - acl_proxy_user= find_user_exact(safe_str(proxy_user->get_proxied_host()), - mpvio.auth_info.authenticated_as); - if (!acl_proxy_user) - { - mysql_mutex_unlock(&acl_cache->lock); - - Host_errors errors; - errors.m_proxy_user_acl= 1; - inc_host_errors(mpvio.auth_info.thd->security_ctx->ip, &errors); - if (!thd->is_error()) - login_failed_error(thd); - DBUG_RETURN(1); - } - acl_user= acl_proxy_user->copy(thd->mem_root); - mysql_mutex_unlock(&acl_cache->lock); - } -#endif - - sctx->master_access= acl_user->access; - strmake_buf(sctx->priv_user, acl_user->user.str); - - if (acl_user->host.hostname) - strmake_buf(sctx->priv_host, acl_user->host.hostname); - else - *sctx->priv_host= 0; - /* OK. Let's check the SSL. Historically it was checked after the password, as an additional layer, not instead of the password @@ -14428,6 +14468,65 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len) sctx->password_expired= password_expired; +#ifndef NO_EMBEDDED_ACCESS_CHECKS + if (!password_expired) + { + bool is_proxy_user= FALSE; + const char *auth_user = acl_user->user.str; + ACL_PROXY_USER *proxy_user; + /* check if the user is allowed to proxy as another user */ + proxy_user= acl_find_proxy_user(auth_user, sctx->host, sctx->ip, + mpvio.auth_info.authenticated_as, + &is_proxy_user); + if (is_proxy_user) + { + ACL_USER *acl_proxy_user; + + /* we need to find the proxy user, but there was none */ + if (!proxy_user) + { + Host_errors errors; + errors.m_proxy_user= 1; + inc_host_errors(mpvio.auth_info.thd->security_ctx->ip, &errors); + if (!thd->is_error()) + login_failed_error(thd); + DBUG_RETURN(1); + } + + my_snprintf(sctx->proxy_user, sizeof(sctx->proxy_user) - 1, + "'%s'@'%s'", auth_user, + safe_str(acl_user->host.hostname)); + + /* we're proxying : find the proxy user definition */ + mysql_mutex_lock(&acl_cache->lock); + acl_proxy_user= find_user_exact(safe_str(proxy_user->get_proxied_host()), + mpvio.auth_info.authenticated_as); + if (!acl_proxy_user) + { + mysql_mutex_unlock(&acl_cache->lock); + + Host_errors errors; + errors.m_proxy_user_acl= 1; + inc_host_errors(mpvio.auth_info.thd->security_ctx->ip, &errors); + if (!thd->is_error()) + login_failed_error(thd); + DBUG_RETURN(1); + } + acl_user= acl_proxy_user->copy(thd->mem_root); + mysql_mutex_unlock(&acl_cache->lock); + } + } +#endif + + sctx->master_access= acl_user->access; + strmake_buf(sctx->priv_user, acl_user->user.str); + + if (acl_user->host.hostname) + strmake_buf(sctx->priv_host, acl_user->host.hostname); + else + *sctx->priv_host= 0; + + /* Don't allow the user to connect if he has done too many queries. As we are testing max_user_connections == 0 here, it means that we diff --git a/sql/sql_acl.h b/sql/sql_acl.h index 570da144b46e5..b4288b05bfb34 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -184,11 +184,9 @@ enum ACL_internal_access_result class ACL_internal_table_access { public: - ACL_internal_table_access() - {} + ACL_internal_table_access() = default; - virtual ~ACL_internal_table_access() - {} + virtual ~ACL_internal_table_access() = default; /** Check access to an internal table. @@ -223,11 +221,9 @@ class ACL_internal_table_access class ACL_internal_schema_access { public: - ACL_internal_schema_access() - {} + ACL_internal_schema_access() = default; - virtual ~ACL_internal_schema_access() - {} + virtual ~ACL_internal_schema_access() = default; /** Check access to an internal schema. diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index 028838b65e41c..465145cf25f8b 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -44,7 +44,8 @@ const LEX_CSTRING msg_optimize= { STRING_WITH_LEN("optimize") }; /* Prepare, run and cleanup for mysql_recreate_table() */ -static bool admin_recreate_table(THD *thd, TABLE_LIST *table_list) +static bool admin_recreate_table(THD *thd, TABLE_LIST *table_list, + Recreate_info *recreate_info) { bool result_code; DBUG_ENTER("admin_recreate_table"); @@ -65,7 +66,7 @@ static bool admin_recreate_table(THD *thd, TABLE_LIST *table_list) DEBUG_SYNC(thd, "ha_admin_try_alter"); tmp_disable_binlog(thd); // binlogging is done by caller if wanted result_code= (thd->open_temporary_tables(table_list) || - mysql_recreate_table(thd, table_list, false)); + mysql_recreate_table(thd, table_list, recreate_info, false)); reenable_binlog(thd); /* mysql_recreate_table() can push OK or ERROR. @@ -444,52 +445,6 @@ static bool open_only_one_table(THD* thd, TABLE_LIST* table, return open_error; } -#ifdef WITH_WSREP -/* - OPTIMIZE, REPAIR and ALTER may take MDL locks not only for the - affected table, but also for the table referenced by foreign key - constraint. - - This wsrep_toi_replication() function handles TOI replication for - OPTIMIZE and REPAIR so that certification keys for potential FK - parent tables are also appended in the write set. ALTER TABLE - case is handled elsewhere. -*/ - -static bool wsrep_toi_replication(THD *thd, TABLE_LIST *tables) -{ - LEX *lex= thd->lex; - /* only handle OPTIMIZE and REPAIR here */ - switch (lex->sql_command) - { - case SQLCOM_OPTIMIZE: - case SQLCOM_REPAIR: - break; - default: - return false; - } - - close_thread_tables(thd); - wsrep::key_array keys; - - wsrep_append_fk_parent_table(thd, tables, &keys); - - /* now TOI replication, with no locks held */ - if (keys.empty()) - { - if (!thd->lex->no_write_to_binlog && - wsrep_to_isolation_begin(thd, NULL, NULL, tables)) - return true; - } - else - { - if (!thd->lex->no_write_to_binlog && - wsrep_to_isolation_begin(thd, NULL, NULL, tables, NULL, &keys)) - return true; - } - return false; -} -#endif /* WITH_WSREP */ static void send_read_only_warning(THD *thd, const LEX_CSTRING *msg_status, @@ -593,16 +548,6 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, close_thread_tables(thd); for (table= tables; table; table= table->next_local) table->table= NULL; -#ifdef WITH_WSREP - if (WSREP(thd)) - { - if(wsrep_toi_replication(thd, tables)) - { - WSREP_INFO("wsrep TOI replication of has failed."); - goto err; - } - } -#endif /* WITH_WSREP */ for (table= tables; table; table= table->next_local) { @@ -616,6 +561,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, bool open_error= 0; bool collect_eis= FALSE; bool open_for_modify= org_open_for_modify; + Recreate_info recreate_info; storage_engine_name[0]= 0; // Marker that's not used @@ -885,7 +831,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, { /* We use extra_open_options to be able to open crashed tables */ thd->open_options|= extra_open_options; - result_code= admin_recreate_table(thd, table); + result_code= admin_recreate_table(thd, table, &recreate_info) ? + HA_ADMIN_FAILED : HA_ADMIN_OK; thd->open_options&= ~extra_open_options; goto send_result; } @@ -1068,12 +1015,31 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, repair was not implemented and we need to upgrade the table to a new version so we recreate the table with ALTER TABLE */ - result_code= admin_recreate_table(thd, table); + result_code= admin_recreate_table(thd, table, &recreate_info); } send_result: lex->cleanup_after_one_table_open(); thd->clear_error(); // these errors shouldn't get client + + if (recreate_info.records_duplicate()) + { + protocol->prepare_for_resend(); + protocol->store(&table_name, system_charset_info); + protocol->store(operator_name, system_charset_info); + protocol->store(warning_level_names[Sql_condition::WARN_LEVEL_WARN].str, + warning_level_names[Sql_condition::WARN_LEVEL_WARN].length, + system_charset_info); + char buf[80]; + size_t length= my_snprintf(buf, sizeof(buf), + "Number of rows changed from %u to %u", + (uint) recreate_info.records_processed(), + (uint) recreate_info.records_copied()); + protocol->store(buf, length, system_charset_info); + if (protocol->write()) + goto err; + } + { Diagnostics_area::Sql_condition_iterator it= thd->get_stmt_da()->sql_conditions(); @@ -1184,7 +1150,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, *save_next_global= table->next_global; table->next_local= table->next_global= 0; - result_code= admin_recreate_table(thd, table); + result_code= admin_recreate_table(thd, table, &recreate_info); trans_commit_stmt(thd); trans_commit(thd); close_thread_tables(thd); @@ -1396,6 +1362,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, goto err; DEBUG_SYNC(thd, "admin_command_kill_after_modify"); } + thd->resume_subsequent_commits(suspended_wfc); + DBUG_EXECUTE_IF("inject_analyze_table_sleep", my_sleep(500000);); if (is_table_modified && is_cmd_replicated && (!opt_readonly || thd->slave_thread) && !thd->lex->no_write_to_binlog) { @@ -1405,10 +1373,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, if (res) goto err; } - my_eof(thd); - thd->resume_subsequent_commits(suspended_wfc); - DBUG_EXECUTE_IF("inject_analyze_table_sleep", my_sleep(500000);); + DBUG_RETURN(FALSE); err: @@ -1557,20 +1523,25 @@ bool Sql_cmd_optimize_table::execute(THD *thd) LEX *m_lex= thd->lex; TABLE_LIST *first_table= m_lex->first_select_lex()->table_list.first; bool res= TRUE; + Recreate_info recreate_info; DBUG_ENTER("Sql_cmd_optimize_table::execute"); if (check_table_access(thd, SELECT_ACL | INSERT_ACL, first_table, FALSE, UINT_MAX, FALSE)) goto error; /* purecov: inspected */ + WSREP_TO_ISOLATION_BEGIN_WRTCHK(NULL, NULL, first_table); res= (specialflag & SPECIAL_NO_NEW_FUNC) ? - mysql_recreate_table(thd, first_table, true) : + mysql_recreate_table(thd, first_table, &recreate_info, true) : mysql_admin_table(thd, first_table, &m_lex->check_opt, &msg_optimize, TL_WRITE, 1, 0, 0, 0, &handler::ha_optimize, 0, true); m_lex->first_select_lex()->table_list.first= first_table; m_lex->query_tables= first_table; +#ifdef WITH_WSREP +wsrep_error_label: +#endif /* WITH_WSREP */ error: DBUG_RETURN(res); } @@ -1586,6 +1557,7 @@ bool Sql_cmd_repair_table::execute(THD *thd) if (check_table_access(thd, SELECT_ACL | INSERT_ACL, first_table, FALSE, UINT_MAX, FALSE)) goto error; /* purecov: inspected */ + WSREP_TO_ISOLATION_BEGIN_WRTCHK(NULL, NULL, first_table); res= mysql_admin_table(thd, first_table, &m_lex->check_opt, &msg_repair, TL_WRITE, 1, MY_TEST(m_lex->check_opt.sql_flags & TT_USEFRM), @@ -1595,6 +1567,9 @@ bool Sql_cmd_repair_table::execute(THD *thd) m_lex->first_select_lex()->table_list.first= first_table; m_lex->query_tables= first_table; +#ifdef WITH_WSREP +wsrep_error_label: +#endif /* WITH_WSREP */ error: DBUG_RETURN(res); } diff --git a/sql/sql_admin.h b/sql/sql_admin.h index 0c7f1c3cee5d2..1a237d4f6165d 100644 --- a/sql/sql_admin.h +++ b/sql/sql_admin.h @@ -34,11 +34,9 @@ class Sql_cmd_analyze_table : public Sql_cmd /** Constructor, used to represent a ANALYZE TABLE statement. */ - Sql_cmd_analyze_table() - {} + Sql_cmd_analyze_table() = default; - ~Sql_cmd_analyze_table() - {} + ~Sql_cmd_analyze_table() = default; bool execute(THD *thd); @@ -59,11 +57,9 @@ class Sql_cmd_check_table : public Sql_cmd /** Constructor, used to represent a CHECK TABLE statement. */ - Sql_cmd_check_table() - {} + Sql_cmd_check_table() = default; - ~Sql_cmd_check_table() - {} + ~Sql_cmd_check_table() = default; bool execute(THD *thd); @@ -83,11 +79,9 @@ class Sql_cmd_optimize_table : public Sql_cmd /** Constructor, used to represent a OPTIMIZE TABLE statement. */ - Sql_cmd_optimize_table() - {} + Sql_cmd_optimize_table() = default; - ~Sql_cmd_optimize_table() - {} + ~Sql_cmd_optimize_table() = default; bool execute(THD *thd); @@ -108,11 +102,9 @@ class Sql_cmd_repair_table : public Sql_cmd /** Constructor, used to represent a REPAIR TABLE statement. */ - Sql_cmd_repair_table() - {} + Sql_cmd_repair_table() = default; - ~Sql_cmd_repair_table() - {} + ~Sql_cmd_repair_table() = default; bool execute(THD *thd); diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc index e28308b4ff606..2a7f885734e64 100644 --- a/sql/sql_alter.cc +++ b/sql/sql_alter.cc @@ -19,6 +19,9 @@ #include "sql_table.h" // mysql_alter_table, // mysql_exchange_partition #include "sql_alter.h" +#include "rpl_mi.h" +#include "slave.h" +#include "debug_sync.h" #include "wsrep_mysqld.h" Alter_info::Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root) @@ -510,8 +513,18 @@ bool Sql_cmd_alter_table::execute(THD *thd) DBUG_RETURN(TRUE); } - thd->variables.auto_increment_offset = 1; - thd->variables.auto_increment_increment = 1; + /* + It makes sense to set auto_increment_* to defaults in TOI operations. + Must be done before wsrep_TOI_begin() since Query_log_event encapsulating + TOI statement and auto inc variables for wsrep replication is constructed + there. Variables are reset back in THD::reset_for_next_command() before + processing of next command. + */ + if (wsrep_auto_increment_control) + { + thd->variables.auto_increment_offset = 1; + thd->variables.auto_increment_increment = 1; + } } #endif @@ -541,9 +554,11 @@ bool Sql_cmd_alter_table::execute(THD *thd) thd->work_part_info= 0; #endif + Recreate_info recreate_info; result= mysql_alter_table(thd, &select_lex->db, &lex->name, &create_info, first_table, + &recreate_info, &alter_info, select_lex->order_list.elements, select_lex->order_list.first, diff --git a/sql/sql_alter.h b/sql/sql_alter.h index bf1edd4c964b2..99e717d50b290 100644 --- a/sql/sql_alter.h +++ b/sql/sql_alter.h @@ -372,11 +372,9 @@ class Sql_cmd_common_alter_table : public Sql_cmd /** Constructor. */ - Sql_cmd_common_alter_table() - {} + Sql_cmd_common_alter_table() = default; - virtual ~Sql_cmd_common_alter_table() - {} + virtual ~Sql_cmd_common_alter_table() = default; virtual enum_sql_command sql_command_code() const { @@ -395,11 +393,9 @@ class Sql_cmd_alter_table : public Sql_cmd_common_alter_table, /** Constructor, used to represent a ALTER TABLE statement. */ - Sql_cmd_alter_table() - {} + Sql_cmd_alter_table() = default; - ~Sql_cmd_alter_table() - {} + ~Sql_cmd_alter_table() = default; Storage_engine_name *option_storage_engine_name() { return this; } @@ -421,8 +417,7 @@ class Sql_cmd_alter_sequence : public Sql_cmd, :DDL_options(options) {} - ~Sql_cmd_alter_sequence() - {} + ~Sql_cmd_alter_sequence() = default; enum_sql_command sql_command_code() const { diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index d609fff548744..4c85368950401 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -409,19 +409,15 @@ void field_real::add() if ((decs = decimals()) >= FLOATING_POINT_DECIMALS) { - length= sprintf(buff, "%g", num); + length= snprintf(buff, sizeof(buff), "%g", num); if (rint(num) != num) max_notzero_dec_len = 1; } else { -#ifdef HAVE_SNPRINTF buff[sizeof(buff)-1]=0; // Safety snprintf(buff, sizeof(buff)-1, "%-.*f", (int) decs, num); length = (uint) strlen(buff); -#else - length= sprintf(buff, "%-.*f", (int) decs, num); -#endif // We never need to check further than this end = buff + length - 1 - decs + max_notzero_dec_len; @@ -814,32 +810,32 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows) if (can_be_still_num) { if (num_info.is_float) - sprintf(buff, "DOUBLE"); // number was like 1e+50... TODO: + snprintf(buff, sizeof(buff), "DOUBLE"); // number was like 1e+50... TODO: else if (num_info.decimals) // DOUBLE(%d,%d) sometime { if (num_info.dval > -FLT_MAX && num_info.dval < FLT_MAX) - sprintf(buff, "FLOAT(%d,%d)", (num_info.integers + num_info.decimals), num_info.decimals); + snprintf(buff, sizeof(buff), "FLOAT(%d,%d)", (num_info.integers + num_info.decimals), num_info.decimals); else - sprintf(buff, "DOUBLE(%d,%d)", (num_info.integers + num_info.decimals), num_info.decimals); + snprintf(buff, sizeof(buff), "DOUBLE(%d,%d)", (num_info.integers + num_info.decimals), num_info.decimals); } else if (ev_num_info.llval >= -128 && ev_num_info.ullval <= (ulonglong) (ev_num_info.llval >= 0 ? 255 : 127)) - sprintf(buff, "TINYINT(%d)", num_info.integers); + snprintf(buff, sizeof(buff), "TINYINT(%d)", num_info.integers); else if (ev_num_info.llval >= INT_MIN16 && ev_num_info.ullval <= (ulonglong) (ev_num_info.llval >= 0 ? UINT_MAX16 : INT_MAX16)) - sprintf(buff, "SMALLINT(%d)", num_info.integers); + snprintf(buff, sizeof(buff), "SMALLINT(%d)", num_info.integers); else if (ev_num_info.llval >= INT_MIN24 && ev_num_info.ullval <= (ulonglong) (ev_num_info.llval >= 0 ? UINT_MAX24 : INT_MAX24)) - sprintf(buff, "MEDIUMINT(%d)", num_info.integers); + snprintf(buff, sizeof(buff), "MEDIUMINT(%d)", num_info.integers); else if (ev_num_info.llval >= INT_MIN32 && ev_num_info.ullval <= (ulonglong) (ev_num_info.llval >= 0 ? UINT_MAX32 : INT_MAX32)) - sprintf(buff, "INT(%d)", num_info.integers); + snprintf(buff, sizeof(buff), "INT(%d)", num_info.integers); else - sprintf(buff, "BIGINT(%d)", num_info.integers); + snprintf(buff, sizeof(buff), "BIGINT(%d)", num_info.integers); answer->append(buff, (uint) strlen(buff)); if (ev_num_info.llval >= 0 && ev_num_info.min_dval >= 0) answer->append(STRING_WITH_LEN(" UNSIGNED")); @@ -857,12 +853,12 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows) } else if ((max_length * (total_rows - nulls)) < (sum + total_rows)) { - sprintf(buff, "CHAR(%d)", (int) max_length); + snprintf(buff, sizeof(buff), "CHAR(%d)", (int) max_length); answer->append(buff, (uint) strlen(buff)); } else { - sprintf(buff, "VARCHAR(%d)", (int) max_length); + snprintf(buff, sizeof(buff), "VARCHAR(%d)", (int) max_length); answer->append(buff, (uint) strlen(buff)); } } @@ -901,18 +897,18 @@ void field_real::get_opt_type(String *answer, 0 : (item->decimals + 1)); if (min_arg >= -128 && max_arg <= (min_arg >= 0 ? 255 : 127)) - sprintf(buff, "TINYINT(%d)", len); + snprintf(buff, sizeof(buff), "TINYINT(%d)", len); else if (min_arg >= INT_MIN16 && max_arg <= (min_arg >= 0 ? UINT_MAX16 : INT_MAX16)) - sprintf(buff, "SMALLINT(%d)", len); + snprintf(buff, sizeof(buff), "SMALLINT(%d)", len); else if (min_arg >= INT_MIN24 && max_arg <= (min_arg >= 0 ? UINT_MAX24 : INT_MAX24)) - sprintf(buff, "MEDIUMINT(%d)", len); + snprintf(buff, sizeof(buff), "MEDIUMINT(%d)", len); else if (min_arg >= INT_MIN32 && max_arg <= (min_arg >= 0 ? UINT_MAX32 : INT_MAX32)) - sprintf(buff, "INT(%d)", len); + snprintf(buff, sizeof(buff), "INT(%d)", len); else - sprintf(buff, "BIGINT(%d)", len); + snprintf(buff, sizeof(buff), "BIGINT(%d)", len); answer->append(buff, (uint) strlen(buff)); if (min_arg >= 0) answer->append(STRING_WITH_LEN(" UNSIGNED")); @@ -927,10 +923,10 @@ void field_real::get_opt_type(String *answer, else { if (min_arg >= -FLT_MAX && max_arg <= FLT_MAX) - sprintf(buff, "FLOAT(%d,%d)", (int) max_length - (item->decimals + 1) + max_notzero_dec_len, + snprintf(buff, sizeof(buff), "FLOAT(%d,%d)", (int) max_length - (item->decimals + 1) + max_notzero_dec_len, max_notzero_dec_len); else - sprintf(buff, "DOUBLE(%d,%d)", (int) max_length - (item->decimals + 1) + max_notzero_dec_len, + snprintf(buff, sizeof(buff), "DOUBLE(%d,%d)", (int) max_length - (item->decimals + 1) + max_notzero_dec_len, max_notzero_dec_len); answer->append(buff, (uint) strlen(buff)); } @@ -949,18 +945,18 @@ void field_longlong::get_opt_type(String *answer, char buff[MAX_FIELD_WIDTH]; if (min_arg >= -128 && max_arg <= (min_arg >= 0 ? 255 : 127)) - sprintf(buff, "TINYINT(%d)", (int) max_length); + snprintf(buff, sizeof(buff), "TINYINT(%d)", (int) max_length); else if (min_arg >= INT_MIN16 && max_arg <= (min_arg >= 0 ? UINT_MAX16 : INT_MAX16)) - sprintf(buff, "SMALLINT(%d)", (int) max_length); + snprintf(buff, sizeof(buff), "SMALLINT(%d)", (int) max_length); else if (min_arg >= INT_MIN24 && max_arg <= (min_arg >= 0 ? UINT_MAX24 : INT_MAX24)) - sprintf(buff, "MEDIUMINT(%d)", (int) max_length); + snprintf(buff, sizeof(buff), "MEDIUMINT(%d)", (int) max_length); else if (min_arg >= INT_MIN32 && max_arg <= (min_arg >= 0 ? UINT_MAX32 : INT_MAX32)) - sprintf(buff, "INT(%d)", (int) max_length); + snprintf(buff, sizeof(buff), "INT(%d)", (int) max_length); else - sprintf(buff, "BIGINT(%d)", (int) max_length); + snprintf(buff, sizeof(buff), "BIGINT(%d)", (int) max_length); answer->append(buff, (uint) strlen(buff)); if (min_arg >= 0) answer->append(STRING_WITH_LEN(" UNSIGNED")); @@ -980,15 +976,15 @@ void field_ulonglong::get_opt_type(String *answer, char buff[MAX_FIELD_WIDTH]; if (max_arg < 256) - sprintf(buff, "TINYINT(%d) UNSIGNED", (int) max_length); + snprintf(buff, sizeof(buff), "TINYINT(%d) UNSIGNED", (int) max_length); else if (max_arg <= ((2 * INT_MAX16) + 1)) - sprintf(buff, "SMALLINT(%d) UNSIGNED", (int) max_length); + snprintf(buff, sizeof(buff), "SMALLINT(%d) UNSIGNED", (int) max_length); else if (max_arg <= ((2 * INT_MAX24) + 1)) - sprintf(buff, "MEDIUMINT(%d) UNSIGNED", (int) max_length); + snprintf(buff, sizeof(buff), "MEDIUMINT(%d) UNSIGNED", (int) max_length); else if (max_arg < (((ulonglong) 1) << 32)) - sprintf(buff, "INT(%d) UNSIGNED", (int) max_length); + snprintf(buff, sizeof(buff), "INT(%d) UNSIGNED", (int) max_length); else - sprintf(buff, "BIGINT(%d) UNSIGNED", (int) max_length); + snprintf(buff, sizeof(buff), "BIGINT(%d) UNSIGNED", (int) max_length); // if item is FIELD_ITEM, it _must_be_ Field_num in this class answer->append(buff, (uint) strlen(buff)); if (item->type() == Item::FIELD_ITEM && @@ -1009,7 +1005,7 @@ void field_decimal::get_opt_type(String *answer, my_decimal_set_zero(&zero); my_bool is_unsigned= (zero.cmp(&min_arg) >= 0); - length= sprintf(buff, "DECIMAL(%d, %d)", + length= snprintf(buff, sizeof(buff), "DECIMAL(%d, %d)", (int) (max_length - (item->decimals ? 1 : 0)), item->decimals); if (is_unsigned) diff --git a/sql/sql_analyze_stmt.h b/sql/sql_analyze_stmt.h index 990c79fb9ad52..e2037279a7a89 100644 --- a/sql/sql_analyze_stmt.h +++ b/sql/sql_analyze_stmt.h @@ -63,14 +63,19 @@ class Exec_time_tracker if (my_gap_tracker) attach_gap_time_tracker(thd, my_gap_tracker, end); } -public: - Exec_time_tracker() : count(0), cycles(0), my_gap_tracker(NULL) {} /* - The time spent between stop_tracking() call on this object and any - other time measurement will be billed to this tracker. + The time spent after stop_tracking() call on this object and any + subsequent time tracking call will be billed to this tracker. */ Gap_time_tracker *my_gap_tracker; +public: + Exec_time_tracker() : count(0), cycles(0), my_gap_tracker(NULL) {} + + void set_gap_tracker(Gap_time_tracker *gap_tracker) + { + my_gap_tracker= gap_tracker; + } // interface for collecting time void start_tracking(THD *thd) @@ -158,6 +163,25 @@ class Time_and_counter_tracker: public Exec_time_tracker if (unlikely((tracker)->timed)) \ { (tracker)->stop_tracking(thd); } + +/* + Just a counter to increment one value. Wrapped in a class to be uniform + with other counters used by ANALYZE. +*/ + +class Counter_tracker +{ +public: + Counter_tracker() : r_scans(0) {} + ha_rows r_scans; + + inline void on_scan_init() { r_scans++; } + + bool has_scans() const { return (r_scans != 0); } + ha_rows get_loops() const { return r_scans; } +}; + + /* A class for collecting read statistics. @@ -168,20 +192,16 @@ class Time_and_counter_tracker: public Exec_time_tracker It can be used to track reading from files, buffers, etc). */ -class Table_access_tracker +class Table_access_tracker { public: - Table_access_tracker() : - r_scans(0), r_rows(0), /*r_rows_after_table_cond(0),*/ - r_rows_after_where(0) + Table_access_tracker() : r_scans(0), r_rows(0), r_rows_after_where(0) {} - ha_rows r_scans; /* How many scans were ran on this join_tab */ + ha_rows r_scans; /* how many scans were ran on this join_tab */ ha_rows r_rows; /* How many rows we've got after that */ ha_rows r_rows_after_where; /* Rows after applying attached part of WHERE */ - bool has_scans() const { return (r_scans != 0); } - ha_rows get_loops() const { return r_scans; } double get_avg_rows() const { return r_scans @@ -200,6 +220,9 @@ class Table_access_tracker inline void on_scan_init() { r_scans++; } inline void on_record_read() { r_rows++; } inline void on_record_after_where() { r_rows_after_where++; } + + bool has_scans() const { return (r_scans != 0); } + ha_rows get_loops() const { return r_scans; } }; @@ -416,12 +439,13 @@ class Rowid_filter_tracker : public Sql_alloc uint get_container_elements() const { return container_elements; } + uint get_container_lookups() { return n_checks; } + double get_r_selectivity_pct() const { - return static_cast(n_positive_checks) / - static_cast(n_checks); + return n_checks ? static_cast(n_positive_checks) / + static_cast(n_checks) : 0; } size_t get_container_buff_size() const { return container_buff_size; } }; - diff --git a/sql/sql_audit.cc b/sql/sql_audit.cc index cbf3f97108860..c9c59c1b84999 100644 --- a/sql/sql_audit.cc +++ b/sql/sql_audit.cc @@ -113,8 +113,6 @@ void mysql_audit_acquire_plugins(THD *thd, ulong *event_class_mask) { DBUG_ENTER("mysql_audit_acquire_plugins"); DBUG_ASSERT(thd); - DBUG_ASSERT(!check_audit_mask(mysql_global_audit_mask, event_class_mask)); - if (check_audit_mask(thd->audit_class_mask, event_class_mask)) { plugin_foreach(thd, acquire_plugins, MYSQL_AUDIT_PLUGIN, event_class_mask); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 414bb5efa25e6..3a5a90966b8c3 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2010, 2021, MariaDB + Copyright (c) 2010, 2022, 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 @@ -515,7 +515,7 @@ class flush_tables_error_handler : public Internal_error_handler Sql_condition ** cond_hdl) { *cond_hdl= NULL; - if (sql_errno == ER_OPEN_AS_READONLY) + if (sql_errno == ER_OPEN_AS_READONLY || sql_errno == ER_LOCK_WAIT_TIMEOUT) { handled_errors++; return TRUE; @@ -600,24 +600,43 @@ bool flush_tables(THD *thd, flush_tables_type flag) else { /* - HA_OPEN_FOR_FLUSH is used to allow us to open the table even if - TABLE_SHARE::incompatible_version is set. It also will tell - SEQUENCE engine that we don't have to read the sequence information - (which may cause deadlocks with concurrently running ALTER TABLE or - ALTER SEQUENCE) as we will close the table at once. + No free TABLE instances available. We have to open a new one. + + Try to take a MDL lock to ensure we can open a new table instance. + If the lock fails, it means that some DDL operation or flush tables + with read lock is ongoing. + In this case we cannot sending the HA_EXTRA_FLUSH signal. */ - if (!open_table_from_share(thd, share, &empty_clex_str, - HA_OPEN_KEYFILE, 0, - HA_OPEN_FOR_ALTER | HA_OPEN_FOR_FLUSH, - tmp_table, FALSE, - NULL)) + + MDL_request mdl_request; + MDL_REQUEST_INIT(&mdl_request, MDL_key::TABLE, + share->db.str, + share->table_name.str, + MDL_SHARED, MDL_EXPLICIT); + + if (!thd->mdl_context.acquire_lock(&mdl_request, 0)) { - (void) tmp_table->file->extra(HA_EXTRA_FLUSH); /* - We don't put the table into the TDC as the table was not fully - opened (we didn't open triggers) + HA_OPEN_FOR_FLUSH is used to allow us to open the table even if + TABLE_SHARE::incompatible_version is set. It also will tell + SEQUENCE engine that we don't have to read the sequence information + (which may cause deadlocks with concurrently running ALTER TABLE or + ALTER SEQUENCE) as we will close the table at once. */ - closefrm(tmp_table); + if (!open_table_from_share(thd, share, &empty_clex_str, + HA_OPEN_KEYFILE, 0, + HA_OPEN_FOR_ALTER | HA_OPEN_FOR_FLUSH, + tmp_table, FALSE, + NULL)) + { + (void) tmp_table->file->extra(HA_EXTRA_FLUSH); + /* + We don't put the table into the TDC as the table was not fully + opened (we didn't open triggers) + */ + closefrm(tmp_table); + } + thd->mdl_context.release_lock(mdl_request.ticket); } } tdc_release_share(share); @@ -807,6 +826,16 @@ int close_thread_tables(THD *thd) DBUG_PRINT("tcache", ("table: '%s' query_id: %lu", table->s->table_name.str, (ulong) table->query_id)); + if (thd->locked_tables_mode) + { +#ifdef WITH_PARTITION_STORAGE_ENGINE + if (table->part_info && table->part_info->vers_require_hist_part(thd) && + !thd->stmt_arena->is_stmt_prepare()) + table->part_info->vers_check_limit(thd); +#endif + table->vcol_cleanup_expr(thd); + } + /* Detach MERGE children after every statement. Even under LOCK TABLES. */ if (thd->locked_tables_mode <= LTM_LOCK_TABLES || table->query_id == thd->query_id) @@ -943,6 +972,8 @@ void close_thread_table(THD *thd, TABLE **table_ptr) table->s->db.str, table->s->table_name.str, MDL_SHARED)); + + table->vcol_cleanup_expr(thd); table->mdl_ticket= NULL; if (table->file) @@ -1381,7 +1412,7 @@ class MDL_deadlock_handler : public Internal_error_handler : m_ot_ctx(ot_ctx_arg), m_is_active(FALSE) {} - virtual ~MDL_deadlock_handler() {} + virtual ~MDL_deadlock_handler() = default; virtual bool handle_condition(THD *thd, uint sql_errno, @@ -1670,6 +1701,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx) MDL_ticket *mdl_ticket; TABLE_SHARE *share; uint gts_flags; + bool from_share= false; #ifdef WITH_PARTITION_STORAGE_ENGINE int part_names_error=0; #endif @@ -1901,6 +1933,11 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx) table_list->alias.str); goto err_lock; } + + /* Open view */ + if (mysql_make_view(thd, share, table_list, false)) + goto err_lock; + /* This table is a view. Validate its metadata version: in particular, that it was a view when the statement was prepared. @@ -1908,10 +1945,6 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx) if (check_and_update_table_version(thd, table_list, share)) goto err_lock; - /* Open view */ - if (mysql_make_view(thd, share, table_list, false)) - goto err_lock; - /* TODO: Don't free this */ tdc_release_share(share); @@ -2032,6 +2065,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx) /* Add table to the share's used tables list. */ tc_add_table(thd, table); + from_share= true; } if (!(flags & MYSQL_OPEN_HAS_MDL_LOCK) && @@ -2123,6 +2157,9 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx) table_list->updatable= 1; // It is not derived table nor non-updatable VIEW table_list->table= table; + if (!from_share && table->vcol_fix_expr(thd)) + DBUG_RETURN(true); + #ifdef WITH_PARTITION_STORAGE_ENGINE if (unlikely(table->part_info)) { @@ -2800,7 +2837,7 @@ static bool inject_reprepare(THD *thd) @sa Execute_observer @sa check_prepared_statement() to see cases when an observer is installed - @sa TABLE_LIST::is_table_ref_id_equal() + @sa TABLE_LIST::is_the_same_definition() @sa TABLE_SHARE::get_table_ref_id() @param[in] thd used to report errors @@ -2823,7 +2860,7 @@ check_and_update_table_version(THD *thd, created with TABLE_LIST::init_one_table() have a short life time and aren't linked anywhere. */ - if (tables->prev_global && !tables->is_table_ref_id_equal(table_share)) + if (tables->prev_global && !tables->is_the_same_definition(thd, table_share)) { if (thd->m_reprepare_observer && thd->m_reprepare_observer->report_error(thd)) @@ -2929,7 +2966,9 @@ bool tdc_open_view(THD *thd, TABLE_LIST *table_list, uint flags) DBUG_ASSERT(share->is_view); - if (flags & CHECK_METADATA_VERSION) + err= mysql_make_view(thd, share, table_list, (flags & OPEN_VIEW_NO_PARSE)); + + if (!err && (flags & CHECK_METADATA_VERSION)) { /* Check TABLE_SHARE-version of view only if we have been instructed to do @@ -2944,7 +2983,6 @@ bool tdc_open_view(THD *thd, TABLE_LIST *table_list, uint flags) goto ret; } - err= mysql_make_view(thd, share, table_list, (flags & OPEN_VIEW_NO_PARSE)); ret: tdc_release_share(share); @@ -4476,6 +4514,7 @@ bool open_tables(THD *thd, const DDL_options_st &options, { enum_sql_command sql_command= thd->lex->sql_command; bool is_dml_stmt= thd->get_command() != COM_STMT_PREPARE && + !thd->stmt_arena->is_stmt_prepare() && (sql_command == SQLCOM_INSERT || sql_command == SQLCOM_INSERT_SELECT || sql_command == SQLCOM_REPLACE || @@ -4688,7 +4727,7 @@ prepare_fk_prelocking_list(THD *thd, Query_tables_list *prelocking_ctx, if ((op & trg2bit(TRG_EVENT_DELETE) && fk_modifies_child(fk->delete_method)) || (op & trg2bit(TRG_EVENT_UPDATE) && fk_modifies_child(fk->update_method))) - lock_type= TL_WRITE_ALLOW_WRITE; + lock_type= TL_FIRST_WRITE; else lock_type= TL_READ; @@ -5435,54 +5474,6 @@ static void mark_real_tables_as_free_for_reuse(TABLE_LIST *table_list) DBUG_VOID_RETURN; } -int TABLE::fix_vcol_exprs(THD *thd) -{ - for (Field **vf= vfield; vf && *vf; vf++) - if (fix_session_vcol_expr(thd, (*vf)->vcol_info)) - return 1; - - for (Field **df= default_field; df && *df; df++) - if ((*df)->default_value && - fix_session_vcol_expr(thd, (*df)->default_value)) - return 1; - - for (Virtual_column_info **cc= check_constraints; cc && *cc; cc++) - if (fix_session_vcol_expr(thd, (*cc))) - return 1; - - return 0; -} - - -static bool fix_all_session_vcol_exprs(THD *thd, TABLE_LIST *tables) -{ - Security_context *save_security_ctx= thd->security_ctx; - TABLE_LIST *first_not_own= thd->lex->first_not_own_table(); - DBUG_ENTER("fix_session_vcol_expr"); - - int error= 0; - for (TABLE_LIST *table= tables; table && table != first_not_own && !error; - table= table->next_global) - { - TABLE *t= table->table; - if (!table->placeholder() && t->s->vcols_need_refixing && - table->lock_type >= TL_FIRST_WRITE) - { - Query_arena *stmt_backup= thd->stmt_arena; - if (thd->stmt_arena->is_conventional()) - thd->stmt_arena= t->expr_arena; - if (table->security_ctx) - thd->security_ctx= table->security_ctx; - - error= t->fix_vcol_exprs(thd); - - thd->security_ctx= save_security_ctx; - thd->stmt_arena= stmt_backup; - } - } - DBUG_RETURN(error); -} - /** Lock all tables in a list. @@ -5658,9 +5649,8 @@ bool lock_tables(THD *thd, TABLE_LIST *tables, uint count, uint flags) } } - bool res= fix_all_session_vcol_exprs(thd, tables); - if (!res && !(flags & MYSQL_OPEN_IGNORE_LOGGING_FORMAT)) - res= thd->decide_logging_format(tables); + const bool res= !(flags & MYSQL_OPEN_IGNORE_LOGGING_FORMAT) && + thd->decide_logging_format(tables); DBUG_RETURN(res); } @@ -6037,7 +6027,10 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, size_t length, if (cached_field_index < table->s->fields && !my_strcasecmp(system_charset_info, table->field[cached_field_index]->field_name.str, name)) + { field= table->field[cached_field_index]; + DEBUG_SYNC(thd, "table_field_cached"); + } else { LEX_CSTRING fname= {name, length}; @@ -6425,8 +6418,9 @@ find_field_in_tables(THD *thd, Item_ident *item, TRUE, &(item->cached_field_index)); #ifndef NO_EMBEDDED_ACCESS_CHECKS /* Check if there are sufficient access rights to the found field. */ - if (found && check_privileges && - check_column_grant_in_table_ref(thd, table_ref, name, length, found)) + if (found && check_privileges && !is_temporary_table(table_ref) && + check_column_grant_in_table_ref(thd, table_ref, name, length, + found)) found= WRONG_GRANT; #endif } @@ -6455,8 +6449,11 @@ find_field_in_tables(THD *thd, Item_ident *item, for (SELECT_LEX *sl= current_sel; sl && sl!=last_select; sl=sl->outer_select()) { - Item_in_subselect *in_subs= - sl->master_unit()->item->get_IN_subquery(); + Item *subs= sl->master_unit()->item; + if (!subs) + continue; + + Item_in_subselect *in_subs= subs->get_IN_subquery(); if (in_subs && in_subs->substype() == Item_subselect::IN_SUBS && in_subs->test_strategy(SUBS_SEMI_JOIN)) @@ -6497,6 +6494,13 @@ find_field_in_tables(THD *thd, Item_ident *item, if (last_table) last_table= last_table->next_name_resolution_table; + field_index_t fake_index_for_duplicate_search= NO_CACHED_FIELD_INDEX; + /* + For the field search it will point to field cache, but for duplicate + search it will point to fake_index_for_duplicate_search (no cache + present). + */ + field_index_t *current_cache= &(item->cached_field_index); for (; cur_table != last_table ; cur_table= cur_table->next_name_resolution_table) { @@ -6511,7 +6515,7 @@ find_field_in_tables(THD *thd, Item_ident *item, SQLCOM_SHOW_FIELDS) ? false : check_privileges, allow_rowid, - &(item->cached_field_index), + current_cache, register_tree_change, &actual_table); if (cur_field) @@ -6526,7 +6530,7 @@ find_field_in_tables(THD *thd, Item_ident *item, item->name.str, db, table_name, ignored_tables, ref, false, allow_rowid, - &(item->cached_field_index), + current_cache, register_tree_change, &actual_table); if (cur_field) @@ -6543,8 +6547,19 @@ find_field_in_tables(THD *thd, Item_ident *item, Store the original table of the field, which may be different from cur_table in the case of NATURAL/USING join. */ - item->cached_table= (!actual_table->cacheable_table || found) ? - 0 : actual_table; + if (actual_table->cacheable_table /*(1)*/ && !found /*(2)*/) + { + /* + We have just found a field allowed to cache (1) and + it is not dublicate search (2). + */ + item->cached_table= actual_table; + } + else + { + item->cached_table= NULL; + item->cached_field_index= NO_CACHED_FIELD_INDEX; + } DBUG_ASSERT(thd->where); /* @@ -6563,6 +6578,7 @@ find_field_in_tables(THD *thd, Item_ident *item, return (Field*) 0; } found= cur_field; + current_cache= &fake_index_for_duplicate_search; } } @@ -6896,7 +6912,6 @@ set_new_item_local_context(THD *thd, Item_ident *item, TABLE_LIST *table_ref) if (!(context= new (thd->mem_root) Name_resolution_context)) return TRUE; context->init(); - context->select_lex= table_ref->select_lex; context->first_name_resolution_table= context->last_name_resolution_table= table_ref; item->context= context; @@ -7576,10 +7591,12 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List &fields, Item *item; List_iterator it(fields); Query_arena *arena, backup; + uint *with_wild= returning_field ? &(thd->lex->returning()->with_wild) : + &(select_lex->with_wild); DBUG_ENTER("setup_wild"); - if (!select_lex->with_wild) - DBUG_RETURN(0); + if (!(*with_wild)) + DBUG_RETURN(0); /* Don't use arena if we are not in prepared statements or stored procedures @@ -7588,7 +7605,7 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List &fields, arena= thd->activate_stmt_arena_if_needed(&backup); thd->lex->current_select->cur_pos_in_select_list= 0; - while (select_lex->with_wild && (item= it++)) + while (*with_wild && (item= it++)) { if (item->type() == Item::FIELD_ITEM && ((Item_field*) item)->field_name.str == star_clex_str.str && @@ -7626,12 +7643,12 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List &fields, */ sum_func_list->elements+= fields.elements - elem; } - select_lex->with_wild--; + (*with_wild)--; } else thd->lex->current_select->cur_pos_in_select_list++; } - DBUG_ASSERT(!select_lex->with_wild); + DBUG_ASSERT(!(*with_wild)); thd->lex->current_select->cur_pos_in_select_list= UNDEF_POS; if (arena) thd->restore_active_arena(arena, &backup); @@ -7743,6 +7760,8 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, thd->lex->current_select->select_list_tables|= item->used_tables(); thd->lex->used_tables|= item->used_tables(); thd->lex->current_select->cur_pos_in_select_list++; + + thd->lex->current_select->rownum_in_field_list |= item->with_rownum_func(); } thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup; thd->lex->current_select->cur_pos_in_select_list= UNDEF_POS; @@ -7753,6 +7772,39 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, DBUG_RETURN(MY_TEST(thd->is_error())); } +/* + make list of leaves for a single TABLE_LIST + + SYNOPSIS + make_leaves_for_single_table() + thd Thread handler + leaves List of leaf tables to be filled + table TABLE_LIST object to process + full_table_list Whether to include tables from mergeable derived table/view +*/ +void make_leaves_for_single_table(THD *thd, List &leaves, + TABLE_LIST *table, bool& full_table_list, + TABLE_LIST *boundary) +{ + if (table == boundary) + full_table_list= !full_table_list; + if (full_table_list && table->is_merged_derived()) + { + SELECT_LEX *select_lex= table->get_single_select(); + /* + It's safe to use select_lex->leaf_tables because all derived + tables/views were already prepared and has their leaf_tables + set properly. + */ + make_leaves_list(thd, leaves, select_lex->get_table_list(), + full_table_list, boundary); + } + else + { + leaves.push_back(table, thd->mem_root); + } +} + /* Perform checks like all given fields exists, if exists fill struct with @@ -7779,40 +7831,79 @@ int setup_returning_fields(THD* thd, TABLE_LIST* table_list) SYNOPSIS make_leaves_list() - list pointer to pointer on list first element - tables table list - full_table_list whether to include tables from mergeable derived table/view. - we need them for checks for INSERT/UPDATE statements only. - - RETURN pointer on pointer to next_leaf of last element + leaves List of leaf tables to be filled + tables Table list + full_table_list Whether to include tables from mergeable derived table/view. + We need them for checks for INSERT/UPDATE statements only. */ -void make_leaves_list(THD *thd, List &list, TABLE_LIST *tables, +void make_leaves_list(THD *thd, List &leaves, TABLE_LIST *tables, bool full_table_list, TABLE_LIST *boundary) { for (TABLE_LIST *table= tables; table; table= table->next_local) { - if (table == boundary) - full_table_list= !full_table_list; - if (full_table_list && table->is_merged_derived()) - { - SELECT_LEX *select_lex= table->get_single_select(); - /* - It's safe to use select_lex->leaf_tables because all derived - tables/views were already prepared and has their leaf_tables - set properly. - */ - make_leaves_list(thd, list, select_lex->get_table_list(), - full_table_list, boundary); - } - else - { - list.push_back(table, thd->mem_root); - } + make_leaves_for_single_table(thd, leaves, table, full_table_list, + boundary); + } +} + + +/* + Setup the map and other attributes for a single TABLE_LIST object + + SYNOPSIS + setup_table_attributes() + thd Thread handler + table_list TABLE_LIST object to process + first_select_table First table participating in SELECT for INSERT..SELECT + statements, NULL for other cases + tablenr Serial number of the table in the SQL statement + + RETURN + false Success + true Failure +*/ +bool setup_table_attributes(THD *thd, TABLE_LIST *table_list, + TABLE_LIST *first_select_table, + uint &tablenr) +{ + TABLE *table= table_list->table; + if (table) + table->pos_in_table_list= table_list; + if (first_select_table && table_list->top_table() == first_select_table) + { + /* new counting for SELECT of INSERT ... SELECT command */ + first_select_table= 0; + thd->lex->first_select_lex()->insert_tables= tablenr; + tablenr= 0; + } + if (table_list->jtbm_subselect) + { + table_list->jtbm_table_no= tablenr; } + else if (table) + { + table->pos_in_table_list= table_list; + setup_table_map(table, table_list, tablenr); + + if (table_list->process_index_hints(table)) + return true; + } + tablenr++; + /* + We test the max tables here as we setup_table_map() should not be called + with tablenr >= 64 + */ + if (tablenr > MAX_TABLES) + { + my_error(ER_TOO_MANY_TABLES, MYF(0), static_cast(MAX_TABLES)); + return true; + } + return false; } + /* prepare tables @@ -7869,7 +7960,14 @@ bool setup_tables(THD *thd, Name_resolution_context *context, leaves.empty(); if (select_lex->prep_leaf_list_state != SELECT_LEX::SAVED) { - make_leaves_list(thd, leaves, tables, full_table_list, first_select_table); + /* + For INSERT ... SELECT statements we must not include the first table + (where the data is being inserted into) in the list of leaves + */ + TABLE_LIST *tables_for_leaves= + select_insert ? first_select_table : tables; + make_leaves_list(thd, leaves, tables_for_leaves, full_table_list, + first_select_table); select_lex->prep_leaf_list_state= SELECT_LEX::READY; select_lex->leaf_tables_exec.empty(); } @@ -7880,40 +7978,33 @@ bool setup_tables(THD *thd, Name_resolution_context *context, leaves.push_back(table_list, thd->mem_root); } + List_iterator ti(leaves); while ((table_list= ti++)) { - TABLE *table= table_list->table; - if (table) - table->pos_in_table_list= table_list; - if (first_select_table && - table_list->top_table() == first_select_table) - { - /* new counting for SELECT of INSERT ... SELECT command */ - first_select_table= 0; - thd->lex->first_select_lex()->insert_tables= tablenr; - tablenr= 0; - } - if(table_list->jtbm_subselect) - { - table_list->jtbm_table_no= tablenr; - } - else if (table) - { - table->pos_in_table_list= table_list; - setup_table_map(table, table_list, tablenr); + if (setup_table_attributes(thd, table_list, first_select_table, tablenr)) + DBUG_RETURN(1); + } - if (table_list->process_index_hints(table)) - DBUG_RETURN(1); - } - tablenr++; + if (select_insert) + { /* - We test the max tables here as we setup_table_map() should not be called - with tablenr >= 64 + The table/view in which the data is inserted must not be included into + the leaf_tables list. But we need this table/view to setup attributes + for it. So build a temporary list of leaves and setup attributes for + the tables included */ - if (tablenr > MAX_TABLES) + List leaves; + TABLE_LIST *table= tables; + + make_leaves_for_single_table(thd, leaves, table, full_table_list, + first_select_table); + + List_iterator ti(leaves); + while ((table_list= ti++)) { - my_error(ER_TOO_MANY_TABLES,MYF(0), static_cast(MAX_TABLES)); - DBUG_RETURN(1); + if (setup_table_attributes(thd, table_list, first_select_table, + tablenr)) + DBUG_RETURN(1); } } } @@ -7944,9 +8035,8 @@ bool setup_tables(THD *thd, Name_resolution_context *context, table_list; table_list= table_list->next_local) { - if (table_list->merge_underlying_list) + if (table_list->is_merged_derived() && table_list->merge_underlying_list) { - DBUG_ASSERT(table_list->is_merged_derived()); Query_arena *arena, backup; arena= thd->activate_stmt_arena_if_needed(&backup); bool res; @@ -8230,19 +8320,20 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name, tables->is_natural_join); DBUG_ASSERT(item->type() == Item::FIELD_ITEM); Item_field *fld= (Item_field*) item; + const char *field_db_name= field_iterator.get_db_name(); const char *field_table_name= field_iterator.get_table_name(); if (!tables->schema_table && !(fld->have_privileges= (get_column_grant(thd, field_iterator.grant(), - field_iterator.get_db_name(), + field_db_name, field_table_name, fld->field_name.str) & VIEW_ANY_ACL))) { my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), "ANY", thd->security_ctx->priv_user, thd->security_ctx->host_or_ip, - field_table_name); + field_db_name, field_table_name); DBUG_RETURN(TRUE); } } @@ -8434,9 +8525,11 @@ int setup_conds(THD *thd, TABLE_LIST *tables, List &leaves, thd->lex->which_check_option_applicable(); bool save_is_item_list_lookup= select_lex->is_item_list_lookup; TABLE_LIST *derived= select_lex->master_unit()->derived; + bool save_resolve_in_select_list= select_lex->context.resolve_in_select_list; DBUG_ENTER("setup_conds"); select_lex->is_item_list_lookup= 0; + select_lex->context.resolve_in_select_list= false; thd->column_usage= MARK_COLUMNS_READ; DBUG_PRINT("info", ("thd->column_usage: %d", thd->column_usage)); @@ -8489,7 +8582,8 @@ int setup_conds(THD *thd, TABLE_LIST *tables, List &leaves, select_lex->where= *conds; } thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup; - DBUG_RETURN(MY_TEST(thd->is_error())); + select_lex->context.resolve_in_select_list= save_resolve_in_select_list; + DBUG_RETURN(thd->is_error()); err_no_arena: select_lex->is_item_list_lookup= save_is_item_list_lookup; diff --git a/sql/sql_base.h b/sql/sql_base.h index 5b449fdddac93..0bfef1ca7ee24 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -394,7 +394,7 @@ inline bool setup_fields_with_no_wrap(THD *thd, Ref_ptr_array ref_pointer_array, class Prelocking_strategy { public: - virtual ~Prelocking_strategy() { } + virtual ~Prelocking_strategy() = default; virtual void reset(THD *thd) { }; virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx, diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc index bab2afb957a14..e71c701523872 100644 --- a/sql/sql_binlog.cc +++ b/sql/sql_binlog.cc @@ -1,5 +1,6 @@ /* Copyright (c) 2005, 2013, Oracle and/or its affiliates. + Copyright (c) 2022, 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 @@ -20,6 +21,7 @@ #include "sql_parse.h" #include "sql_acl.h" #include "rpl_rli.h" +#include "rpl_mi.h" #include "slave.h" #include "log_event.h" @@ -41,14 +43,13 @@ static int check_event_type(int type, Relay_log_info *rli) */ if (fd_event && fd_event->event_type_permutation) { - IF_DBUG({ - int new_type= fd_event->event_type_permutation[type]; - DBUG_PRINT("info", - ("converting event type %d to %d (%s)", - type, new_type, - Log_event::get_type_str((Log_event_type)new_type))); - }, - (void)0); +#ifdef DBUG_TRACE + int new_type= fd_event->event_type_permutation[type]; + DBUG_PRINT("info", + ("converting event type %d to %d (%s)", + type, new_type, + Log_event::get_type_str((Log_event_type)new_type))); +#endif type= fd_event->event_type_permutation[type]; } @@ -70,7 +71,8 @@ static int check_event_type(int type, Relay_log_info *rli) /* It is always allowed to execute FD events. */ return 0; - + + case QUERY_EVENT: case TABLE_MAP_EVENT: case WRITE_ROWS_EVENT_V1: case UPDATE_ROWS_EVENT_V1: @@ -167,6 +169,57 @@ int binlog_defragment(THD *thd) return 0; } +/** + Wraps Log_event::apply_event to save and restore + session context in case of Query_log_event. + + @param ev replication event + @param rgi execution context for the event + + @return + 0 on success, + non-zero otherwise. +*/ +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) +int save_restore_context_apply_event(Log_event *ev, rpl_group_info *rgi) +{ + if (ev->get_type_code() != QUERY_EVENT) + return ev->apply_event(rgi); + + THD *thd= rgi->thd; + Relay_log_info *rli= thd->rli_fake; + DBUG_ASSERT(!rli->mi); + LEX_CSTRING connection_name= { STRING_WITH_LEN("BINLOG_BASE64_EVENT") }; + + if (!(rli->mi= new Master_info(&connection_name, false))) + { + my_error(ER_OUT_OF_RESOURCES, MYF(0)); + return -1; + } + + sql_digest_state *m_digest= thd->m_digest; + PSI_statement_locker *m_statement_psi= thd->m_statement_psi;; + LEX_CSTRING save_db= thd->db; + my_thread_id m_thread_id= thd->variables.pseudo_thread_id; + + thd->system_thread_info.rpl_sql_info= NULL; + thd->reset_db(&null_clex_str); + + thd->m_digest= NULL; + thd->m_statement_psi= NULL; + + int err= ev->apply_event(rgi); + + thd->m_digest= m_digest; + thd->m_statement_psi= m_statement_psi; + thd->variables.pseudo_thread_id= m_thread_id; + thd->reset_db(&save_db); + delete rli->mi; + rli->mi= NULL; + + return err; +} +#endif /** Execute a BINLOG statement. @@ -216,11 +269,9 @@ void mysql_client_binlog_statement(THD* thd) if (!(rgi= thd->rgi_fake)) rgi= thd->rgi_fake= new rpl_group_info(rli); rgi->thd= thd; - const char *error= 0; Log_event *ev = 0; my_bool is_fragmented= FALSE; - /* Out of memory check */ @@ -373,7 +424,7 @@ void mysql_client_binlog_statement(THD* thd) LEX *backup_lex; thd->backup_and_reset_current_lex(&backup_lex); - err= ev->apply_event(rgi); + err= save_restore_context_apply_event(ev, rgi); thd->restore_current_lex(backup_lex); } thd->variables.option_bits= @@ -389,7 +440,7 @@ void mysql_client_binlog_statement(THD* thd) i.e. when this thread terminates. */ if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT) - delete ev; + delete ev; ev= 0; if (err) { @@ -397,7 +448,8 @@ void mysql_client_binlog_statement(THD* thd) TODO: Maybe a better error message since the BINLOG statement now contains several events. */ - my_error(ER_UNKNOWN_ERROR, MYF(0)); + if (!thd->is_error()) + my_error(ER_UNKNOWN_ERROR, MYF(0)); goto end; } } @@ -413,5 +465,7 @@ void mysql_client_binlog_statement(THD* thd) thd->variables.option_bits= thd_options; rgi->slave_close_thread_tables(thd); my_free(buf); + delete rgi; + rgi= thd->rgi_fake= NULL; DBUG_VOID_RETURN; } diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h index 02dc8198c7cb0..353601eb98a02 100644 --- a/sql/sql_bitmap.h +++ b/sql/sql_bitmap.h @@ -90,7 +90,7 @@ template class Bitmap or to call set_all()/clear_all()/set_prefix() to initialize bitmap. */ - Bitmap() { } + Bitmap() = default; explicit Bitmap(uint prefix) { diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 49f42eb95c5ac..b284189db2395 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -347,6 +347,9 @@ TODO list: #include "probes_mysql.h" #include "transaction.h" #include "strfunc.h" +#ifdef WITH_WSREP +#include "wsrep_mysqld.h" +#endif const uchar *query_state_map; @@ -1205,7 +1208,7 @@ void Query_cache::end_of_result(THD *thd) BLOCK_LOCK_WR(query_block); Query_cache_query *header= query_block->query(); Query_cache_block *last_result_block; - size_t allign_size; + size_t align_size; size_t len; if (header->result() == 0) @@ -1223,8 +1226,8 @@ void Query_cache::end_of_result(THD *thd) DBUG_VOID_RETURN; } last_result_block= header->result()->prev; - allign_size= ALIGN_SIZE(last_result_block->used); - len= MY_MAX(query_cache.min_allocation_unit, allign_size); + align_size= ALIGN_SIZE(last_result_block->used); + len= MY_MAX(query_cache.min_allocation_unit, align_size); if (last_result_block->length >= query_cache.min_allocation_unit + len) query_cache.split_block(last_result_block,len); @@ -1415,6 +1418,8 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) flags.client_long_flag= MY_TEST(thd->client_capabilities & CLIENT_LONG_FLAG); flags.client_protocol_41= MY_TEST(thd->client_capabilities & CLIENT_PROTOCOL_41); + flags.client_extended_metadata= MY_TEST(thd->client_capabilities & + MARIADB_CLIENT_EXTENDED_METADATA); flags.client_depr_eof= MY_TEST(thd->client_capabilities & CLIENT_DEPRECATE_EOF); /* @@ -1447,12 +1452,13 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) flags.div_precision_increment= thd->variables.div_precincrement; flags.default_week_format= thd->variables.default_week_format; DBUG_PRINT("qcache", ("\ -long %d, 4.1: %d, eof: %d, bin_proto: %d, more results %d, pkt_nr: %d, \ +long %d, 4.1: %d, ex metadata: %d, eof: %d, bin_proto: %d, more results %d, pkt_nr: %d, \ CS client: %u, CS result: %u, CS conn: %u, limit: %llu, TZ: %p, \ sql mode: 0x%llx, sort len: %llu, concat len: %u, div_precision: %zu, \ def_week_frmt: %zu, in_trans: %d, autocommit: %d", (int)flags.client_long_flag, (int)flags.client_protocol_41, + (int)flags.client_extended_metadata, (int)flags.client_depr_eof, (int)flags.protocol_type, (int)flags.more_results_exists, @@ -1924,6 +1930,8 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length) flags.client_long_flag= MY_TEST(thd->client_capabilities & CLIENT_LONG_FLAG); flags.client_protocol_41= MY_TEST(thd->client_capabilities & CLIENT_PROTOCOL_41); + flags.client_extended_metadata= MY_TEST(thd->client_capabilities & + MARIADB_CLIENT_EXTENDED_METADATA); flags.client_depr_eof= MY_TEST(thd->client_capabilities & CLIENT_DEPRECATE_EOF); flags.protocol_type= (unsigned int) thd->protocol->type(); @@ -1947,12 +1955,13 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length) flags.default_week_format= thd->variables.default_week_format; flags.lc_time_names= thd->variables.lc_time_names; DBUG_PRINT("qcache", ("\ -long %d, 4.1: %d, eof: %d, bin_proto: %d, more results %d, pkt_nr: %d, \ +long %d, 4.1: %d, ex metadata: %d, eof: %d, bin_proto: %d, more results %d, pkt_nr: %d, \ CS client: %u, CS result: %u, CS conn: %u, limit: %llu, TZ: %p, \ sql mode: 0x%llx, sort len: %llu, concat len: %u, div_precision: %zu, \ def_week_frmt: %zu, in_trans: %d, autocommit: %d", (int)flags.client_long_flag, (int)flags.client_protocol_41, + (int)flags.client_extended_metadata, (int)flags.client_depr_eof, (int)flags.protocol_type, (int)flags.more_results_exists, @@ -2122,8 +2131,7 @@ def_week_frmt: %zu, in_trans: %d, autocommit: %d", ("Handler require invalidation queries of %.*s %llu-%llu", (int)qcache_se_key_len, qcache_se_key_name, engine_data, table->engine_data())); - invalidate_table_internal(thd, - (uchar *) table->db(), + invalidate_table_internal((uchar *) table->db(), table->key_length()); } else @@ -2372,7 +2380,7 @@ void Query_cache::invalidate(THD *thd, const char *db) if (strcmp(table->db(),db) == 0) { Query_cache_block_table *list_root= table_block->table(0); - invalidate_query_block_list(thd,list_root); + invalidate_query_block_list(list_root); } table_block= next; @@ -3311,7 +3319,7 @@ void Query_cache::invalidate_table(THD *thd, uchar * key, size_t key_length) DEBUG_SYNC(thd, "wait_in_query_cache_invalidate2"); if (query_cache_size > 0) - invalidate_table_internal(thd, key, key_length); + invalidate_table_internal(key, key_length); unlock(); } @@ -3326,14 +3334,14 @@ void Query_cache::invalidate_table(THD *thd, uchar * key, size_t key_length) */ void -Query_cache::invalidate_table_internal(THD *thd, uchar *key, size_t key_length) +Query_cache::invalidate_table_internal(uchar *key, size_t key_length) { Query_cache_block *table_block= (Query_cache_block*)my_hash_search(&tables, key, key_length); if (table_block) { Query_cache_block_table *list_root= table_block->table(0); - invalidate_query_block_list(thd, list_root); + invalidate_query_block_list(list_root); } } @@ -3350,8 +3358,7 @@ Query_cache::invalidate_table_internal(THD *thd, uchar *key, size_t key_length) */ void -Query_cache::invalidate_query_block_list(THD *thd, - Query_cache_block_table *list_root) +Query_cache::invalidate_query_block_list(Query_cache_block_table *list_root) { while (list_root->next != list_root) { @@ -3535,7 +3542,7 @@ Query_cache::insert_table(THD *thd, size_t key_len, const char *key, */ { Query_cache_block_table *list_root= table_block->table(0); - invalidate_query_block_list(thd, list_root); + invalidate_query_block_list(list_root); } table_block= 0; @@ -4761,7 +4768,7 @@ void Query_cache::cache_dump() void Query_cache::queries_dump() { - +#ifdef DBUG_TRACE if (!initialized) { DBUG_PRINT("qcache", ("Query Cache not initialized")); @@ -4822,11 +4829,13 @@ void Query_cache::queries_dump() DBUG_PRINT("qcache", ("no queries in list")); } DBUG_PRINT("qcache", ("------------------")); +#endif } void Query_cache::tables_dump() { +#ifdef DBUG_TRACE if (!initialized || query_cache_size == 0) { DBUG_PRINT("qcache", ("Query Cache not initialized")); @@ -4849,6 +4858,7 @@ void Query_cache::tables_dump() else DBUG_PRINT("qcache", ("no tables in list")); DBUG_PRINT("qcache", ("--------------------")); +#endif } diff --git a/sql/sql_cache.h b/sql/sql_cache.h index 196acf6fa2e4c..a02034764a707 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -32,7 +32,7 @@ typedef struct st_changed_table_list CHANGED_TABLE_LIST; Can't create new free memory block if unused memory in block less then QUERY_CACHE_MIN_ALLOCATION_UNIT. if QUERY_CACHE_MIN_ALLOCATION_UNIT == 0 then - QUERY_CACHE_MIN_ALLOCATION_UNIT choosed automaticaly + QUERY_CACHE_MIN_ALLOCATION_UNIT choosed automatically */ #define QUERY_CACHE_MIN_ALLOCATION_UNIT 512 @@ -91,7 +91,7 @@ typedef my_bool (*qc_engine_callback)(THD *thd, const char *table_key, */ struct Query_cache_block_table { - Query_cache_block_table() {} /* Remove gcc warning */ + Query_cache_block_table() = default; /* Remove gcc warning */ /** This node holds a position in a static table list belonging @@ -122,7 +122,7 @@ struct Query_cache_block_table struct Query_cache_block { - Query_cache_block() {} /* Remove gcc warning */ + Query_cache_block() = default; /* Remove gcc warning */ enum block_type {FREE, QUERY, RESULT, RES_CONT, RES_BEG, RES_INCOMPLETE, TABLE, INCOMPLETE}; @@ -161,7 +161,7 @@ struct Query_cache_query uint8 ready; ulonglong hit_count; - Query_cache_query() {} /* Remove gcc warning */ + Query_cache_query() = default; /* Remove gcc warning */ inline void init_n_lock(); void unlock_n_destroy(); inline ulonglong found_rows() { return limit_found_rows; } @@ -197,7 +197,7 @@ struct Query_cache_query struct Query_cache_table { - Query_cache_table() {} /* Remove gcc warning */ + Query_cache_table() = default; /* Remove gcc warning */ char *tbl; uint32 key_len; uint8 suffix_len; /* For partitioned tables */ @@ -240,7 +240,7 @@ struct Query_cache_table struct Query_cache_result { - Query_cache_result() {} /* Remove gcc warning */ + Query_cache_result() = default; /* Remove gcc warning */ Query_cache_block *query; inline uchar* data() @@ -266,7 +266,7 @@ extern "C" void query_cache_invalidate_by_MyISAM_filename(const char* filename); struct Query_cache_memory_bin { - Query_cache_memory_bin() {} /* Remove gcc warning */ + Query_cache_memory_bin() = default; /* Remove gcc warning */ #ifndef DBUG_OFF size_t size; #endif @@ -285,7 +285,7 @@ struct Query_cache_memory_bin struct Query_cache_memory_bin_step { - Query_cache_memory_bin_step() {} /* Remove gcc warning */ + Query_cache_memory_bin_step() = default; /* Remove gcc warning */ size_t size; size_t increment; size_t idx; @@ -319,7 +319,7 @@ class Query_cache Cache_staus m_cache_status; void free_query_internal(Query_cache_block *point); - void invalidate_table_internal(THD *thd, uchar *key, size_t key_length); + void invalidate_table_internal(uchar *key, size_t key_length); protected: /* @@ -375,8 +375,7 @@ class Query_cache void invalidate_table(THD *thd, TABLE *table); void invalidate_table(THD *thd, uchar *key, size_t key_length); void invalidate_table(THD *thd, Query_cache_block *table_block); - void invalidate_query_block_list(THD *thd, - Query_cache_block_table *list_root); + void invalidate_query_block_list(Query_cache_block_table *list_root); TABLE_COUNTER_TYPE register_tables_from_list(THD *thd, TABLE_LIST *tables_used, @@ -549,6 +548,7 @@ struct Query_cache_query_flags { unsigned int client_long_flag:1; unsigned int client_protocol_41:1; + unsigned int client_extended_metadata:1; unsigned int client_depr_eof:1; unsigned int protocol_type:2; unsigned int more_results_exists:1; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 29824301e9db2..3858cbfca4529 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2008, 2021, MariaDB Corporation. + Copyright (c) 2008, 2022, 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 @@ -67,6 +67,7 @@ #ifdef WITH_WSREP #include "wsrep_thd.h" #include "wsrep_trans_observer.h" +#include "wsrep_server_state.h" #else static inline bool wsrep_is_bf_aborted(THD* thd) { return false; } #endif /* WITH_WSREP */ @@ -450,6 +451,7 @@ void thd_storage_lock_wait(THD *thd, long long value) extern "C" void *thd_get_ha_data(const THD *thd, const struct handlerton *hton) { + DBUG_ASSERT(thd == current_thd || mysql_mutex_is_owner(&thd->LOCK_thd_data)); return thd->ha_data[hton->slot].ha_ptr; } @@ -679,7 +681,8 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) #ifdef HAVE_REPLICATION , current_linfo(0), - slave_info(0) + slave_info(0), + is_awaiting_semisync_ack(0) #endif #ifdef WITH_WSREP , @@ -707,11 +710,12 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) wsrep_was_on(false), wsrep_ignore_table(false), wsrep_aborter(0), + wsrep_delayed_BF_abort(false), /* wsrep-lib */ m_wsrep_next_trx_id(WSREP_UNDEFINED_TRX_ID), - m_wsrep_mutex(LOCK_thd_data), - m_wsrep_cond(COND_wsrep_thd), + m_wsrep_mutex(&LOCK_thd_data), + m_wsrep_cond(&COND_wsrep_thd), m_wsrep_client_service(this, m_wsrep_client_state), m_wsrep_client_state(this, m_wsrep_mutex, @@ -860,11 +864,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) get_sequence_last_key, (my_hash_free_key) free_sequence_last, HASH_THREAD_SPECIFIC); - sp_proc_cache= NULL; - sp_func_cache= NULL; - sp_package_spec_cache= NULL; - sp_package_body_cache= NULL; - /* For user vars replication*/ if (opt_bin_log) my_init_dynamic_array(key_memory_user_var_entry, &user_var_events, @@ -1301,10 +1300,7 @@ void THD::init() wsrep_desynced_backup_stage= false; #endif /* WITH_WSREP */ - if (variables.sql_log_bin) - variables.option_bits|= OPTION_BIN_LOG; - else - variables.option_bits&= ~OPTION_BIN_LOG; + set_binlog_bit(); select_commands= update_commands= other_commands= 0; /* Set to handle counting of aborted connections */ @@ -1438,10 +1434,7 @@ void THD::change_user(void) SEQUENCES_HASH_SIZE, 0, 0, (my_hash_get_key) get_sequence_last_key, (my_hash_free_key) free_sequence_last, HASH_THREAD_SPECIFIC); - sp_cache_clear(&sp_proc_cache); - sp_cache_clear(&sp_func_cache); - sp_cache_clear(&sp_package_spec_cache); - sp_cache_clear(&sp_package_body_cache); + sp_caches_clear(); opt_trace.delete_traces(); } @@ -1530,6 +1523,8 @@ void THD::cleanup(void) wsrep_client_thread= false; #endif /* WITH_WSREP */ + DEBUG_SYNC(this, "THD_cleanup_after_set_killed"); + mysql_ha_cleanup(this); locked_tables_list.unlock_locked_tables(this); @@ -1568,10 +1563,7 @@ void THD::cleanup(void) my_hash_free(&user_vars); my_hash_free(&sequences); - sp_cache_clear(&sp_proc_cache); - sp_cache_clear(&sp_func_cache); - sp_cache_clear(&sp_package_spec_cache); - sp_cache_clear(&sp_package_body_cache); + sp_caches_clear(); auto_inc_intervals_forced.empty(); auto_inc_intervals_in_cur_stmt_for_binlog.empty(); @@ -1872,7 +1864,7 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var, extern std::atomic shutdown_thread_id; void THD::awake_no_mutex(killed_state state_to_set) { - DBUG_ENTER("THD::awake"); + DBUG_ENTER("THD::awake_no_mutex"); DBUG_PRINT("enter", ("this: %p current_thd: %p state: %d", this, current_thd, (int) state_to_set)); THD_CHECK_SENTRY(this); @@ -2353,6 +2345,58 @@ bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs, } +/* + Reinterpret a binary string to a character string + + @param[OUT] to The result will be written here, + either the original string as is, + or a newly alloced fixed string with + some zero bytes prepended. + @param cs The destination character set + @param str The binary string + @param length The length of the binary string + + @return false on success + @return true on error +*/ + +bool THD::reinterpret_string_from_binary(LEX_CSTRING *to, CHARSET_INFO *cs, + const char *str, size_t length) +{ + /* + When reinterpreting from binary to tricky character sets like + UCS2, UTF16, UTF32, we may need to prepend some zero bytes. + This is possible in scenarios like this: + SET COLLATION_CONNECTION=utf32_general_ci, CHARACTER_SET_CLIENT=binary; + This code is similar to String::copy_aligned(). + */ + size_t incomplete= length % cs->mbminlen; // Bytes in an incomplete character + if (incomplete) + { + size_t zeros= cs->mbminlen - incomplete; + size_t aligned_length= zeros + length; + char *dst= (char*) alloc(aligned_length + 1); + if (!dst) + { + to->str= NULL; // Safety + to->length= 0; + return true; + } + bzero(dst, zeros); + memcpy(dst + zeros, str, length); + dst[aligned_length]= '\0'; + to->str= dst; + to->length= aligned_length; + } + else + { + to->str= str; + to->length= length; + } + return check_string_for_wellformedness(to->str, to->length, cs); +} + + /* Convert a string between two character sets. dstcs and srccs cannot be &my_charset_bin. @@ -3623,6 +3667,41 @@ void select_max_min_finder_subselect::cleanup() } +void select_max_min_finder_subselect::set_op(const Type_handler *th) +{ + if (th->is_val_native_ready()) + { + op= &select_max_min_finder_subselect::cmp_native; + return; + } + + switch (th->cmp_type()) { + case REAL_RESULT: + op= &select_max_min_finder_subselect::cmp_real; + break; + case INT_RESULT: + op= &select_max_min_finder_subselect::cmp_int; + break; + case STRING_RESULT: + op= &select_max_min_finder_subselect::cmp_str; + break; + case DECIMAL_RESULT: + op= &select_max_min_finder_subselect::cmp_decimal; + break; + case TIME_RESULT: + if (th->field_type() == MYSQL_TYPE_TIME) + op= &select_max_min_finder_subselect::cmp_time; + else + op= &select_max_min_finder_subselect::cmp_str; + break; + case ROW_RESULT: + // This case should never be chosen + DBUG_ASSERT(0); + op= 0; + } +} + + int select_max_min_finder_subselect::send_data(List &items) { DBUG_ENTER("select_max_min_finder_subselect::send_data"); @@ -3641,32 +3720,11 @@ int select_max_min_finder_subselect::send_data(List &items) if (!cache) { cache= val_item->get_cache(thd); - switch (val_item->cmp_type()) { - case REAL_RESULT: - op= &select_max_min_finder_subselect::cmp_real; - break; - case INT_RESULT: - op= &select_max_min_finder_subselect::cmp_int; - break; - case STRING_RESULT: - op= &select_max_min_finder_subselect::cmp_str; - break; - case DECIMAL_RESULT: - op= &select_max_min_finder_subselect::cmp_decimal; - break; - case TIME_RESULT: - if (val_item->field_type() == MYSQL_TYPE_TIME) - op= &select_max_min_finder_subselect::cmp_time; - else - op= &select_max_min_finder_subselect::cmp_str; - break; - case ROW_RESULT: - // This case should never be chosen - DBUG_ASSERT(0); - op= 0; - } + set_op(val_item->type_handler()); + cache->setup(thd, val_item); } - cache->store(val_item); + else + cache->store(val_item); it->store(0, cache); } it->assigned(1); @@ -3758,6 +3816,26 @@ bool select_max_min_finder_subselect::cmp_str() return (sortcmp(val1, val2, cache->collation.collation) < 0); } + +bool select_max_min_finder_subselect::cmp_native() +{ + NativeBuffer cvalue, mvalue; + Item *maxmin= ((Item_singlerow_subselect *)item)->element_index(0); + bool cvalue_is_null= cache->val_native(thd, &cvalue); + bool mvalue_is_null= maxmin->val_native(thd, &mvalue); + + /* Ignore NULLs for ANY and keep them for ALL subqueries */ + if (cvalue_is_null) + return (is_all && !mvalue_is_null) || (!is_all && mvalue_is_null); + if (mvalue_is_null) + return !is_all; + + const Type_handler *th= cache->type_handler(); + return fmax ? th->cmp_native(cvalue, mvalue) > 0 : + th->cmp_native(cvalue, mvalue) < 0; +} + + int select_exists_subselect::send_data(List &items) { DBUG_ENTER("select_exists_subselect::send_data"); @@ -3845,9 +3923,10 @@ void Query_arena::set_query_arena(Query_arena *set) } -void Query_arena::cleanup_stmt(bool /*restore_set_statement_vars*/) +bool Query_arena::cleanup_stmt(bool /*restore_set_statement_vars*/) { DBUG_ASSERT(! "Query_arena::cleanup_stmt() not implemented"); + return false; } /* @@ -3862,6 +3941,7 @@ Statement::Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg, lex(lex_arg), db(null_clex_str) { + hr_prepare_time.val= 0, name= null_clex_str; } @@ -3878,6 +3958,7 @@ void Statement::set_statement(Statement *stmt) column_usage= stmt->column_usage; lex= stmt->lex; query_string= stmt->query_string; + hr_prepare_time= stmt->hr_prepare_time; } @@ -3953,9 +4034,7 @@ void THD::restore_active_arena(Query_arena *set, Query_arena *backup) DBUG_VOID_RETURN; } -Statement::~Statement() -{ -} +Statement::~Statement() = default; C_MODE_START @@ -4208,6 +4287,7 @@ create_result_table(THD *thd_arg, List *column_types, { DBUG_ASSERT(table == 0); tmp_table_param.field_count= column_types->elements; + tmp_table_param.func_count= tmp_table_param.field_count; tmp_table_param.bit_fields_as_long= bit_fields_as_long; if (! (table= create_tmp_table(thd_arg, &tmp_table_param, *column_types, @@ -5032,12 +5112,22 @@ void reset_thd(MYSQL_THD thd) before writing response to client, to provide durability guarantees, in other words, server can't send OK packet before modified data is durable in redo log. -*/ -extern "C" void thd_increment_pending_ops(MYSQL_THD thd) + + NOTE: system THD (those that are not associated with client + connection) do not allows async operations yet. + + @param thd a THD + @return thd + @retval nullptr if this is system THD */ +extern "C" MYSQL_THD thd_increment_pending_ops(MYSQL_THD thd) { + if (!thd || thd->system_thread != NON_SYSTEM_THREAD) + return nullptr; thd->async_state.inc_pending_ops(); + return thd; } + /** This function can be used by plugin/engine to indicate end of async operation (such as end of group commit @@ -5048,6 +5138,8 @@ extern "C" void thd_increment_pending_ops(MYSQL_THD thd) extern "C" void thd_decrement_pending_ops(MYSQL_THD thd) { DBUG_ASSERT(thd); + DBUG_ASSERT(thd->system_thread == NON_SYSTEM_THREAD); + thd_async_state::enum_async_state state; if (thd->async_state.dec_pending_ops(&state) == 0) { @@ -5286,6 +5378,16 @@ thd_rpl_deadlock_check(MYSQL_THD thd, MYSQL_THD other_thd) return 0; if (rgi->gtid_sub_id > other_rgi->gtid_sub_id) return 0; + if (rgi->finish_event_group_called || other_rgi->finish_event_group_called) + { + /* + If either of two transactions has already performed commit + (e.g split ALTER, asserted below) there won't be any deadlock. + */ + DBUG_ASSERT(rgi->sa_info || other_rgi->sa_info); + + return 0; + } /* This transaction is about to wait for another transaction that is required by replication binlog order to commit after. This would cause a deadlock. @@ -5355,8 +5457,8 @@ thd_need_ordering_with(const MYSQL_THD thd, const MYSQL_THD other_thd) the caller should guarantee that the BF state won't change. (e.g. InnoDB does it by keeping lock_sys.mutex locked) */ - if (WSREP_ON && wsrep_thd_is_BF(thd, false) && - wsrep_thd_is_BF(other_thd, false)) + if (WSREP_ON && + wsrep_thd_order_before(thd, other_thd)) return 0; #endif /* WITH_WSREP */ rgi= thd->rgi_slave; @@ -6228,6 +6330,10 @@ int THD::decide_logging_format(TABLE_LIST *tables) bool is_write= FALSE; // If any write tables bool has_read_tables= FALSE; // If any read only tables bool has_auto_increment_write_tables= FALSE; // Write with auto-increment + /* true if it's necessary to switch current statement log format from + STATEMENT to ROW if binary log format is MIXED and autoincrement values + are changed in the statement */ + bool has_unsafe_stmt_autoinc_lock_mode= false; /* If a write table that doesn't have auto increment part first */ bool has_write_table_auto_increment_not_first_in_pk= FALSE; bool has_auto_increment_write_tables_not_first= FALSE; @@ -6350,6 +6456,8 @@ int THD::decide_logging_format(TABLE_LIST *tables) has_auto_increment_write_tables_not_first= found_first_not_own_table; if (share->next_number_keypart != 0) has_write_table_auto_increment_not_first_in_pk= true; + has_unsafe_stmt_autoinc_lock_mode= + table->file->autoinc_lock_mode_stmt_unsafe(); } } @@ -6364,7 +6472,8 @@ int THD::decide_logging_format(TABLE_LIST *tables) blackhole_table_found= 1; if (share->non_determinstic_insert && - !(sql_command_flags[lex->sql_command] & CF_SCHEMA_CHANGE)) + (sql_command_flags[lex->sql_command] & CF_CAN_GENERATE_ROW_EVENTS + && !(sql_command_flags[lex->sql_command] & CF_SCHEMA_CHANGE))) has_write_tables_with_unsafe_statements= true; trans= table->file->has_transactions(); @@ -6421,6 +6530,9 @@ int THD::decide_logging_format(TABLE_LIST *tables) if (has_write_tables_with_unsafe_statements) lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION); + if (has_unsafe_stmt_autoinc_lock_mode) + lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_AUTOINC_LOCK_MODE); + /* A query that modifies autoinc column in sub-statement can make the master and slave inconsistent. @@ -6667,49 +6779,86 @@ int THD::decide_logging_format(TABLE_LIST *tables) DBUG_RETURN(0); } -int THD::decide_logging_format_low(TABLE *table) + +/* + Reconsider logging format in case of INSERT...ON DUPLICATE KEY UPDATE + for tables with more than one unique keys in case of MIXED binlog format. + + Unsafe means that a master could execute the statement differently than + the slave. + This could can happen in the following cases: + - The unique check are done in different order on master or slave + (different engine or different key order). + - There is a conflict on another key than the first and before the + statement is committed, another connection commits a row that conflicts + on an earlier unique key. Example follows: + + Below a and b are unique keys, the table has a row (1,1,0) + connection 1: + INSERT INTO t1 set a=2,b=1,c=0 ON DUPLICATE KEY UPDATE c=1; + connection 2: + INSERT INTO t1 set a=2,b=2,c=0; + + If 2 commits after 1 has been executed but before 1 has committed + (and are thus put before the other in the binary log), one will + get different data on the slave: + (1,1,1),(2,2,1) instead of (1,1,1),(2,2,0) +*/ + +void THD::reconsider_logging_format_for_iodup(TABLE *table) { - DBUG_ENTER("decide_logging_format_low"); - /* - INSERT...ON DUPLICATE KEY UPDATE on a table with more than one unique keys - can be unsafe. - */ - if (wsrep_binlog_format() <= BINLOG_FORMAT_STMT && - !is_current_stmt_binlog_format_row() && - !lex->is_stmt_unsafe() && - lex->duplicates == DUP_UPDATE) + DBUG_ENTER("reconsider_logging_format_for_iodup"); + enum_binlog_format bf= (enum_binlog_format) wsrep_binlog_format(); + + DBUG_ASSERT(lex->duplicates == DUP_UPDATE); + + if (bf <= BINLOG_FORMAT_STMT && + !is_current_stmt_binlog_format_row()) { + KEY *end= table->s->key_info + table->s->keys; uint unique_keys= 0; - uint keys= table->s->keys, i= 0; - Field *field; - for (KEY* keyinfo= table->s->key_info; - i < keys && unique_keys <= 1; i++, keyinfo++) - if (keyinfo->flags & HA_NOSAME && - !(keyinfo->key_part->field->flags & AUTO_INCREMENT_FLAG && - //User given auto inc can be unsafe - !keyinfo->key_part->field->val_int())) + + for (KEY *keyinfo= table->s->key_info; keyinfo < end ; keyinfo++) + { + if (keyinfo->flags & HA_NOSAME) { + /* + We assume that the following cases will guarantee that the + key is unique if a key part is not set: + - The key part is an autoincrement (autogenerated) + - The key part has a default value that is null and it not + a virtual field that will be calculated later. + */ for (uint j= 0; j < keyinfo->user_defined_key_parts; j++) { - field= keyinfo->key_part[j].field; - if(!bitmap_is_set(table->write_set,field->field_index)) - goto exit; + Field *field= keyinfo->key_part[j].field; + if (!bitmap_is_set(table->write_set, field->field_index)) + { + /* Check auto_increment */ + if (field == table->next_number_field) + goto exit; + if (field->is_real_null() && !field->default_value) + goto exit; + } } - unique_keys++; + if (unique_keys++) + break; exit:; } - + } if (unique_keys > 1) { - lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_TWO_KEYS); - binlog_unsafe_warning_flags|= lex->get_stmt_unsafe_flags(); + if (bf == BINLOG_FORMAT_STMT && !lex->is_stmt_unsafe()) + { + lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_TWO_KEYS); + binlog_unsafe_warning_flags|= lex->get_stmt_unsafe_flags(); + } set_current_stmt_binlog_format_row_if_mixed(); if (is_current_stmt_binlog_format_row()) binlog_prepare_for_row_logging(); - DBUG_RETURN(1); } } - DBUG_RETURN(0); + DBUG_VOID_RETURN; } #ifndef MYSQL_CLIENT @@ -7253,7 +7402,7 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end, bool is_transactional) } -#if !defined(DBUG_OFF) && !defined(_lint) +#if defined(DBUG_TRACE) && !defined(_lint) static const char * show_query_type(THD::enum_binlog_query_type qtype) { @@ -8171,6 +8320,20 @@ bool THD::timestamp_to_TIME(MYSQL_TIME *ltime, my_time_t ts, return 0; } + +void THD::my_ok_with_recreate_info(const Recreate_info &info, + ulong warn_count) +{ + char buf[80]; + my_snprintf(buf, sizeof(buf), + ER_THD(this, ER_INSERT_INFO), + (ulong) info.records_processed(), + (ulong) info.records_duplicate(), + warn_count); + my_ok(this, info.records_processed(), 0L, buf); +} + + THD_list_iterator *THD_list_iterator::iterator() { return &server_threads; diff --git a/sql/sql_class.h b/sql/sql_class.h index df9d89b5affee..c508559051139 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB Corporation. + Copyright (c) 2009, 2022, 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 @@ -66,7 +66,8 @@ void set_thd_stage_info(void *thd, #include "my_apc.h" #include "rpl_gtid.h" -#include "wsrep_mysqld.h" +#include "wsrep.h" +#include "wsrep_on.h" #ifdef WITH_WSREP #include /* wsrep-lib */ @@ -76,11 +77,17 @@ void set_thd_stage_info(void *thd, #include "wsrep_condition_variable.h" class Wsrep_applier_service; +enum wsrep_consistency_check_mode { + NO_CONSISTENCY_CHECK, + CONSISTENCY_CHECK_DECLARED, + CONSISTENCY_CHECK_RUNNING, +}; #endif /* WITH_WSREP */ class Reprepare_observer; class Relay_log_info; struct rpl_group_info; +struct rpl_parallel_thread; class Rpl_filter; class Query_log_event; class Load_log_event; @@ -114,8 +121,8 @@ enum enum_slave_type_conversions { SLAVE_TYPE_CONVERSIONS_ALL_LOSSY, SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY}; /* - MARK_COLUMNS_READ: A column is goind to be read. - MARK_COLUMNS_WRITE: A column is going to be written to. + COLUMNS_READ: A column is goind to be read. + COLUMNS_WRITE: A column is going to be written to. MARK_COLUMNS_READ: A column is goind to be read. A bit in read set is set to inform handler that the field is to be read. If field list contains duplicates, then @@ -239,6 +246,29 @@ class CSET_STRING }; +class Recreate_info +{ + ha_rows m_records_copied; + ha_rows m_records_duplicate; +public: + Recreate_info() + :m_records_copied(0), + m_records_duplicate(0) + { } + Recreate_info(ha_rows records_copied, + ha_rows records_duplicate) + :m_records_copied(records_copied), + m_records_duplicate(records_duplicate) + { } + ha_rows records_copied() const { return m_records_copied; } + ha_rows records_duplicate() const { return m_records_duplicate; } + ha_rows records_processed() const + { + return m_records_copied + m_records_duplicate; + } +}; + + #define TC_HEURISTIC_RECOVER_COMMIT 1 #define TC_HEURISTIC_RECOVER_ROLLBACK 2 extern ulong tc_heuristic_recover; @@ -290,9 +320,9 @@ class Key_part_spec :public Sql_alloc { public: LEX_CSTRING field_name; uint length; - bool generated; + bool generated, asc; Key_part_spec(const LEX_CSTRING *name, uint len, bool gen= false) - : field_name(*name), length(len), generated(gen) + : field_name(*name), length(len), generated(gen), asc(1) {} bool operator==(const Key_part_spec& other) const; /** @@ -444,7 +474,7 @@ class Key :public Sql_alloc, public DDL_options { invisible(false), without_overlaps(false) {} Key(const Key &rhs, MEM_ROOT *mem_root); - virtual ~Key() {} + virtual ~Key() = default; /* Equality comparison of keys (ignoring name) */ friend bool foreign_key_prefix(Key *a, Key *b); /** @@ -853,6 +883,7 @@ typedef struct system_variables vers_asof_timestamp_t vers_asof_timestamp; ulong vers_alter_history; + my_bool binlog_alter_two_phase; } SV; /** @@ -1181,7 +1212,7 @@ class Query_arena /* We build without RTTI, so dynamic_cast can't be used. */ enum Type { - STATEMENT, PREPARED_STATEMENT, STORED_PROCEDURE, TABLE_ARENA + STATEMENT, PREPARED_STATEMENT, STORED_PROCEDURE }; Query_arena(MEM_ROOT *mem_root_arg, enum enum_state state_arg) : @@ -1194,7 +1225,7 @@ class Query_arena Query_arena() { INIT_ARENA_DBUG_INFO; } virtual Type type() const; - virtual ~Query_arena() {}; + virtual ~Query_arena() = default; inline bool is_stmt_prepare() const { return state == STMT_INITIALIZED; } inline bool is_stmt_prepare_or_first_sp_execute() const @@ -1232,7 +1263,7 @@ class Query_arena void free_items(); /* Close the active state associated with execution of this statement */ - virtual void cleanup_stmt(bool /*restore_set_statement_vars*/); + virtual bool cleanup_stmt(bool /*restore_set_statement_vars*/); }; @@ -1245,7 +1276,7 @@ class Query_arena_memroot: public Query_arena, public Sql_alloc Query_arena_memroot() : Query_arena() {} - virtual ~Query_arena_memroot() {} + virtual ~Query_arena_memroot() = default; }; @@ -1330,6 +1361,7 @@ class Statement: public ilink, public Query_arena LEX_CSTRING name; /* name for named prepared statements */ LEX *lex; // parse tree descriptor + my_hrtime_t hr_prepare_time; // time of preparation in microseconds /* Points to the query associated with this statement. It's const, but we need to declare it char * because all table handlers are written @@ -1394,7 +1426,7 @@ class Statement: public ilink, public Query_arena my_bool query_cache_is_applicable; /* This constructor is called for backup statements */ - Statement() {} + Statement() = default; Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg, enum enum_state state_arg, ulong id_arg); @@ -1883,7 +1915,7 @@ show_system_thread(enum_thread_type thread) RETURN_NAME_AS_STRING(SYSTEM_THREAD_SLAVE_BACKGROUND); RETURN_NAME_AS_STRING(SYSTEM_THREAD_SEMISYNC_MASTER_BACKGROUND); default: - sprintf(buf, "", thread); + snprintf(buf, sizeof(buf), "", thread); return buf; } #undef RETURN_NAME_AS_STRING @@ -1902,7 +1934,7 @@ class Internal_error_handler m_prev_internal_handler(NULL) {} - virtual ~Internal_error_handler() {} + virtual ~Internal_error_handler() = default; public: /** @@ -1960,7 +1992,7 @@ class Dummy_error_handler : public Internal_error_handler /* Ignore error */ return TRUE; } - Dummy_error_handler() {} /* Remove gcc warning */ + Dummy_error_handler() = default; /* Remove gcc warning */ }; @@ -1997,7 +2029,7 @@ class Counting_error_handler : public Internal_error_handler class Drop_table_error_handler : public Internal_error_handler { public: - Drop_table_error_handler() {} + Drop_table_error_handler() = default; public: bool handle_condition(THD *thd, @@ -2038,7 +2070,7 @@ class MDL_deadlock_and_lock_abort_error_handler: public Internal_error_handler class Turn_errors_to_warnings_handler : public Internal_error_handler { public: - Turn_errors_to_warnings_handler() {} + Turn_errors_to_warnings_handler() = default; bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, @@ -2054,6 +2086,21 @@ class Turn_errors_to_warnings_handler : public Internal_error_handler }; +struct Suppress_warnings_error_handler : public Internal_error_handler +{ + bool handle_condition(THD *thd, + uint sql_errno, + const char *sqlstate, + Sql_condition::enum_warning_level *level, + const char *msg, + Sql_condition **cond_hdl) + { + return *level == Sql_condition::WARN_LEVEL_WARN; + } +}; + + + /** Tables that were locked with LOCK TABLES statement. @@ -2359,6 +2406,39 @@ struct wait_for_commit void reinit(); }; + +class Sp_caches +{ +public: + sp_cache *sp_proc_cache; + sp_cache *sp_func_cache; + sp_cache *sp_package_spec_cache; + sp_cache *sp_package_body_cache; + Sp_caches() + :sp_proc_cache(NULL), + sp_func_cache(NULL), + sp_package_spec_cache(NULL), + sp_package_body_cache(NULL) + { } + ~Sp_caches() + { + // All caches must be freed by the caller explicitly + DBUG_ASSERT(sp_proc_cache == NULL); + DBUG_ASSERT(sp_func_cache == NULL); + DBUG_ASSERT(sp_package_spec_cache == NULL); + DBUG_ASSERT(sp_package_body_cache == NULL); + } + void sp_caches_swap(Sp_caches &rhs) + { + swap_variables(sp_cache*, sp_proc_cache, rhs.sp_proc_cache); + swap_variables(sp_cache*, sp_func_cache, rhs.sp_func_cache); + swap_variables(sp_cache*, sp_package_spec_cache, rhs.sp_package_spec_cache); + swap_variables(sp_cache*, sp_package_body_cache, rhs.sp_package_body_cache); + } + void sp_caches_clear(); +}; + + extern "C" void my_message_sql(uint error, const char *str, myf MyFlags); @@ -2533,9 +2613,6 @@ struct thd_async_state } }; -extern "C" void thd_increment_pending_ops(MYSQL_THD); -extern "C" void thd_decrement_pending_ops(MYSQL_THD); - /** @class THD @@ -2554,7 +2631,8 @@ class THD: public THD_count, /* this must be first */ */ public Item_change_list, public MDL_context_owner, - public Open_tables_state + public Open_tables_state, + public Sp_caches { private: inline bool is_stmt_prepare() const @@ -2996,6 +3074,11 @@ class THD: public THD_count, /* this must be first */ } bool binlog_table_should_be_logged(const LEX_CSTRING *db); + // Accessors and setters of two-phase loggable ALTER binlog properties + uchar get_binlog_flags_for_alter(); + void set_binlog_flags_for_alter(uchar); + uint64 get_binlog_start_alter_seq_no(); + void set_binlog_start_alter_seq_no(uint64); #endif /* MYSQL_CLIENT */ public: @@ -3222,6 +3305,13 @@ class THD: public THD_count, /* this must be first */ auto_inc_intervals_forced.empty(); // in case of multiple SET INSERT_ID auto_inc_intervals_forced.append(next_id, ULONGLONG_MAX, 0); } + inline void set_binlog_bit() + { + if (variables.sql_log_bin) + variables.option_bits |= OPTION_BIN_LOG; + else + variables.option_bits &= ~OPTION_BIN_LOG; + } ulonglong limit_found_rows; @@ -3578,15 +3668,13 @@ class THD: public THD_count, /* this must be first */ /* In case of a slave, set to the error code the master got when executing the query. 0 if no error on the master. + The stored into variable master error code may get reset inside + execution stack when the event turns out to be ignored. */ int slave_expected_error; enum_sql_command last_sql_command; // Last sql_command exceuted in mysql_execute_command() sp_rcontext *spcont; // SP runtime context - sp_cache *sp_proc_cache; - sp_cache *sp_func_cache; - sp_cache *sp_package_spec_cache; - sp_cache *sp_package_body_cache; /** number of name_const() substitutions, see sp_head.cc:subst_spvars() */ uint query_name_consts; @@ -4155,6 +4243,8 @@ class THD: public THD_count, /* this must be first */ bool convert_string(LEX_STRING *to, CHARSET_INFO *to_cs, const char *from, size_t from_length, CHARSET_INFO *from_cs); + bool reinterpret_string_from_binary(LEX_CSTRING *to, CHARSET_INFO *to_cs, + const char *from, size_t from_length); bool convert_string(LEX_CSTRING *to, CHARSET_INFO *to_cs, const char *from, size_t from_length, CHARSET_INFO *from_cs) @@ -4171,6 +4261,8 @@ class THD: public THD_count, /* this must be first */ { if (!simple_copy_is_possible) return unlikely(convert_string(to, tocs, from->str, from->length, fromcs)); + if (fromcs == &my_charset_bin) + return reinterpret_string_from_binary(to, tocs, from->str, from->length); *to= *from; return false; } @@ -4300,6 +4392,8 @@ class THD: public THD_count, /* this must be first */ inline bool vio_ok() const { return TRUE; } inline bool is_connected() { return TRUE; } #endif + + void my_ok_with_recreate_info(const Recreate_info &info, ulong warn_count); /** Mark the current error as fatal. Warning: this does not set any error, it sets a property of the error, so must be @@ -4380,8 +4474,7 @@ class THD: public THD_count, /* this must be first */ bool is_item_tree_change_register_required() { - return !stmt_arena->is_conventional() - || stmt_arena->type() == Query_arena::TABLE_ARENA; + return !stmt_arena->is_conventional(); } void change_item_tree(Item **place, Item *new_value) @@ -4606,13 +4699,13 @@ class THD: public THD_count, /* this must be first */ */ DBUG_PRINT("debug", ("temporary_tables: %s, in_sub_stmt: %s, system_thread: %s", - YESNO(has_thd_temporary_tables()), YESNO(in_sub_stmt), + YESNO(has_temporary_tables()), YESNO(in_sub_stmt), show_system_thread(system_thread))); if (in_sub_stmt == 0) { if (wsrep_binlog_format() == BINLOG_FORMAT_ROW) set_current_stmt_binlog_format_row(); - else if (!has_thd_temporary_tables()) + else if (!has_temporary_tables()) set_current_stmt_binlog_format_stmt(); } DBUG_VOID_RETURN; @@ -4971,18 +5064,18 @@ class THD: public THD_count, /* this must be first */ mdl_context.release_transactional_locks(this); } int decide_logging_format(TABLE_LIST *tables); + /* - In Some cases when decide_logging_format is called it does not have all - information to decide the logging format. So that cases we call decide_logging_format_2 - at later stages in execution. - One example would be binlog format for IODKU but column with unique key is not inserted. - We don't have inserted columns info when we call decide_logging_format so on later stage we call - decide_logging_format_low + In Some cases when decide_logging_format is called it does not have + all information to decide the logging format. So that cases we call + decide_logging_format_2 at later stages in execution. - @returns 0 if no format is changed - 1 if there is change in binlog format + One example would be binlog format for insert on duplicate key + (IODKU) but column with unique key is not inserted. We do not have + inserted columns info when we call decide_logging_format so on + later stage we call reconsider_logging_format_for_iodup() */ - int decide_logging_format_low(TABLE *table); + void reconsider_logging_format_for_iodup(TABLE *table); enum need_invoker { INVOKER_NONE=0, INVOKER_USER, INVOKER_ROLE}; void binlog_invoker(bool role) { m_binlog_invoker= role ? INVOKER_ROLE : INVOKER_USER; } @@ -5196,7 +5289,7 @@ class THD: public THD_count, /* this must be first */ bool use_temporary_table(TABLE *table, TABLE **out_table); void close_temporary_table(TABLE *table); bool log_events_and_free_tmp_shares(); - void free_tmp_table_share(TMP_TABLE_SHARE *share, bool delete_table); + bool free_tmp_table_share(TMP_TABLE_SHARE *share, bool delete_table); void free_temporary_table(TABLE *table); bool lock_temporary_tables(); void unlock_temporary_tables(); @@ -5232,6 +5325,14 @@ class THD: public THD_count, /* this must be first */ bool is_binlog_dump_thread(); #endif + /* + Indicates if this thread is suspended due to awaiting an ACK from a + replica. True if suspended, false otherwise. + + Note that this variable is protected by Repl_semi_sync_master::LOCK_binlog + */ + bool is_awaiting_semisync_ack; + inline ulong wsrep_binlog_format() const { return WSREP_BINLOG_FORMAT(variables.binlog_format); @@ -5289,6 +5390,10 @@ class THD: public THD_count, /* this must be first */ /* thread who has started kill for this THD protected by LOCK_thd_data*/ my_thread_id wsrep_aborter; + /* true if BF abort is observed in do_command() right after reading + client's packet, and if the client has sent PS execute command. */ + bool wsrep_delayed_BF_abort; + /* Transaction id: * m_wsrep_next_trx_id is assigned on the first query after @@ -5320,7 +5425,10 @@ class THD: public THD_count, /* this must be first */ { return m_wsrep_next_trx_id; } - + /* + If node is async slave and have parallel execution, wait for prior commits. + */ + bool wsrep_parallel_slave_wait_for_prior_commit(); private: wsrep_trx_id_t m_wsrep_next_trx_id; /* cast from query_id_t */ /* wsrep-lib */ @@ -5374,9 +5482,9 @@ class THD: public THD_count, /* this must be first */ thr_timer_end(&query_timer); #endif } - void restore_set_statement_var() + bool restore_set_statement_var() { - main_lex.restore_set_statement_var(); + return main_lex.restore_set_statement_var(); } /* Copy relevant `stmt` transaction flags to `all` transaction. */ void merge_unsafe_rollback_flags() @@ -5438,7 +5546,8 @@ class THD: public THD_count, /* this must be first */ bool restore_from_local_lex_to_old_lex(LEX *oldlex); Item *sp_fix_func_item(Item **it_addr); - Item *sp_prepare_func_item(Item **it_addr, uint cols= 1); + Item *sp_fix_func_item_for_assignment(const Field *to, Item **it_addr); + Item *sp_prepare_func_item(Item **it_addr, uint cols); bool sp_eval_expr(Field *result_field, Item **expr_item_ptr); bool sql_parser(LEX *old_lex, LEX *lex, @@ -5547,8 +5656,8 @@ my_eof(THD *thd) inline date_conv_mode_t sql_mode_for_dates(THD *thd) { - static_assert((date_conv_mode_t::KNOWN_MODES & - time_round_mode_t::KNOWN_MODES) == 0, + static_assert((ulonglong(date_conv_mode_t::KNOWN_MODES) & + ulonglong(time_round_mode_t::KNOWN_MODES)) == 0, "date_conv_mode_t and time_round_mode_t must use different " "bit values"); static_assert(MODE_NO_ZERO_DATE == date_mode_t::NO_ZERO_DATE && @@ -5609,7 +5718,7 @@ class select_result_sink: public Sql_alloc example for a duplicate row entry written to a temp table. */ virtual int send_data(List &items)=0; - virtual ~select_result_sink() {}; + virtual ~select_result_sink() = default; void reset(THD *thd_arg) { thd= thd_arg; } }; @@ -5641,7 +5750,7 @@ class select_result :public select_result_sink ha_rows est_records; /* estimated number of records in the result */ select_result(THD *thd_arg): select_result_sink(thd_arg), est_records(0) {} void set_unit(SELECT_LEX_UNIT *unit_arg) { unit= unit_arg; } - virtual ~select_result() {}; + virtual ~select_result() = default; /** Change wrapped select_result. @@ -6029,7 +6138,7 @@ class select_insert :public select_result_interceptor { int prepare(List &list, SELECT_LEX_UNIT *u); virtual int prepare2(JOIN *join); virtual int send_data(List &items); - virtual void store_values(List &values); + virtual bool store_values(List &values); virtual bool can_rollback_data() { return 0; } bool prepare_eof(); bool send_ok_packet(); @@ -6074,7 +6183,8 @@ class select_create: public select_insert { } int prepare(List &list, SELECT_LEX_UNIT *u); - void store_values(List &values); + int binlog_show_create_table(TABLE **tables, uint count); + bool store_values(List &values); bool send_eof(); virtual void abort_result_set(); virtual bool can_rollback_data() { return 1; } @@ -6156,8 +6266,15 @@ class TMP_TABLE_PARAM :public Sql_alloc @see opt_sum_query, count_field_types */ uint sum_func_count; + uint copy_func_count; // Allocated copy fields uint hidden_field_count; uint group_parts,group_length,group_null_parts; + + /* + If we're doing a GROUP BY operation, shows which one is used: + true TemporaryTableWithPartialSums algorithm (see end_update()). + false OrderedGroupBy algorithm (see end_write_group()). + */ uint quick_group; /** Enabled when we have atleast one outer_sum_func. Needed when used @@ -6434,10 +6551,12 @@ class select_union_recursive :public select_unit or for the unit specifying a CTE that mutually recursive with this CTE. */ uint cleanup_count; + long row_counter; select_union_recursive(THD *thd_arg): select_unit(thd_arg), - incr_table(0), first_rec_table_to_update(0), cleanup_count(0) + incr_table(0), first_rec_table_to_update(0), cleanup_count(0), + row_counter(0) { incr_table_param.init(); }; int send_data(List &items); @@ -6644,6 +6763,7 @@ class select_max_min_finder_subselect :public select_subselect bool (select_max_min_finder_subselect::*op)(); bool fmax; bool is_all; + void set_op(const Type_handler *ha); public: select_max_min_finder_subselect(THD *thd_arg, Item_subselect *item_arg, bool mx, bool all): @@ -6656,6 +6776,7 @@ class select_max_min_finder_subselect :public select_subselect bool cmp_decimal(); bool cmp_str(); bool cmp_time(); + bool cmp_native(); }; /* EXISTS subselect interface class */ @@ -6877,7 +6998,7 @@ class user_var_entry { CHARSET_INFO *m_charset; public: - user_var_entry() {} /* Remove gcc warning */ + user_var_entry() = default; /* Remove gcc warning */ LEX_CSTRING name; char *value; size_t length; @@ -6998,7 +7119,7 @@ class my_var : public Sql_alloc { enum type { SESSION_VAR, LOCAL_VAR, PARAM_VAR }; type scope; my_var(const LEX_CSTRING *j, enum type s) : name(*j), scope(s) { } - virtual ~my_var() {} + virtual ~my_var() = default; virtual bool set(THD *thd, Item *val) = 0; virtual my_var_sp *get_my_var_sp() { return NULL; } }; @@ -7019,7 +7140,7 @@ class my_var_sp: public my_var { : my_var(j, LOCAL_VAR), m_rcontext_handler(rcontext_handler), m_type_handler(type_handler), offset(o), sp(s) { } - ~my_var_sp() { } + ~my_var_sp() = default; bool set(THD *thd, Item *val); my_var_sp *get_my_var_sp() { return this; } const Type_handler *type_handler() const @@ -7049,7 +7170,7 @@ class my_var_user: public my_var { public: my_var_user(const LEX_CSTRING *j) : my_var(j, SESSION_VAR) { } - ~my_var_user() { } + ~my_var_user() = default; bool set(THD *thd, Item *val); }; @@ -7062,7 +7183,7 @@ class select_dumpvar :public select_result_interceptor { select_dumpvar(THD *thd_arg) :select_result_interceptor(thd_arg), row_count(0), m_var_sp_row(NULL) { var_list.empty(); } - ~select_dumpvar() {} + ~select_dumpvar() = default; int prepare(List &list, SELECT_LEX_UNIT *u); int send_data(List &items); bool send_eof(); @@ -7245,7 +7366,12 @@ class select_dumpvar :public select_result_interceptor { inline bool add_item_to_list(THD *thd, Item *item) { - bool res= thd->lex->current_select->add_item_to_list(thd, item); + bool res; + LEX *lex= thd->lex; + if (lex->current_select->parsing_place == IN_RETURNING) + res= lex->returning()->add_item_to_list(thd, item); + else + res= lex->current_select->add_item_to_list(thd, item); return res; } @@ -7293,8 +7419,13 @@ inline int handler::ha_ft_read(uchar *buf) { int error= ft_read(buf); if (!error) + { update_rows_read(); + if (table->vfield && buf == table->record[0]) + table->update_virtual_fields(this, VCOL_UPDATE_FOR_READ); + } + table->status=error ? STATUS_NOT_FOUND: 0; return error; } @@ -7495,6 +7626,19 @@ class Check_level_instant_set }; +class Use_relaxed_field_copy: public Sql_mode_save, + public Check_level_instant_set +{ +public: + Use_relaxed_field_copy(THD *thd) : + Sql_mode_save(thd), Check_level_instant_set(thd, CHECK_FIELD_IGNORE) + { + thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE); + thd->variables.sql_mode|= MODE_INVALID_DATES; + } +}; + + /** This class resembles the SQL Standard schema qualified object name: ::= [ ] @@ -7534,6 +7678,19 @@ class Database_qualified_name } void copy(MEM_ROOT *mem_root, const LEX_CSTRING &db, const LEX_CSTRING &name); + + static Database_qualified_name split(const LEX_CSTRING &txt) + { + DBUG_ASSERT(txt.str[txt.length] == '\0'); // Expect 0-terminated input + const char *dot= strchr(txt.str, '.'); + if (!dot) + return Database_qualified_name(NULL, 0, txt.str, txt.length); + size_t dblen= dot - txt.str; + Lex_cstring db(txt.str, dblen); + Lex_cstring name(txt.str + dblen + 1, txt.length - dblen - 1); + return Database_qualified_name(db, name); + } + // Export db and name as a qualified name string: 'db.name' size_t make_qname(char *dst, size_t dstlen) const { @@ -7551,7 +7708,7 @@ class Database_qualified_name if (unlikely(!(dst->str= tmp= (char*) alloc_root(mem_root, dst->length + 1)))) return true; - sprintf(tmp, "%.*s%.*s%.*s", + snprintf(tmp, dst->length + 1, "%.*s%.*s%.*s", (int) m_db.length, (m_db.length ? m_db.str : ""), dot, ".", (int) m_name.length, m_name.str); @@ -7776,6 +7933,41 @@ extern THD_list server_threads; void setup_tmp_table_column_bitmaps(TABLE *table, uchar *bitmaps, uint field_count); +#ifdef WITH_WSREP +extern void wsrep_to_isolation_end(THD*); +#endif +/* + RAII utility class to ease binlogging with temporary setting + THD etc context and restoring the original one upon logger execution. +*/ +class Write_log_with_flags +{ + THD* m_thd; +#ifdef WITH_WSREP + bool wsrep_to_isolation; +#endif + +public: +~Write_log_with_flags() + { + m_thd->set_binlog_flags_for_alter(0); + m_thd->set_binlog_start_alter_seq_no(0); +#ifdef WITH_WSREP + if (wsrep_to_isolation) + wsrep_to_isolation_end(m_thd); +#endif + } + + Write_log_with_flags(THD *thd, uchar flags, + bool do_wsrep_iso __attribute__((unused))= false) : + m_thd(thd) + { + m_thd->set_binlog_flags_for_alter(flags); +#ifdef WITH_WSREP + wsrep_to_isolation= do_wsrep_iso && WSREP(m_thd); +#endif + } +}; #endif /* MYSQL_SERVER */ #endif /* SQL_CLASS_INCLUDED */ diff --git a/sql/sql_cmd.h b/sql/sql_cmd.h index 430afadb491bd..6554fc78f2726 100644 --- a/sql/sql_cmd.h +++ b/sql/sql_cmd.h @@ -192,8 +192,7 @@ class Sql_cmd : public Sql_alloc } protected: - Sql_cmd() - {} + Sql_cmd() = default; virtual ~Sql_cmd() { @@ -261,8 +260,7 @@ class Sql_cmd_call : public Sql_cmd m_handler(handler) {} - virtual ~Sql_cmd_call() - {} + virtual ~Sql_cmd_call() = default; /** Execute a CALL statement at runtime. diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 18db76e99cbd7..6b195ac9fe7ce 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -892,7 +892,7 @@ int thd_set_peer_addr(THD *thd, return 1; /* The error is set by my_strdup(). */ } thd->main_security_ctx.host_or_ip = thd->main_security_ctx.ip; - if (!(specialflag & SPECIAL_NO_RESOLVE)) + if (!opt_skip_name_resolve) { int rc; @@ -1108,6 +1108,11 @@ static int check_connection(THD *thd) void setup_connection_thread_globals(THD *thd) { + DBUG_EXECUTE_IF("CONNECT_wait", { + extern Dynamic_array listen_sockets; + while (listen_sockets.size()) + my_sleep(1000); + }); thd->store_globals(); } @@ -1265,7 +1270,8 @@ void prepare_new_connection_state(THD* thd) and the main Diagnostics Area contains an error condition. */ if (packet_length != packet_error) - my_error(ER_NEW_ABORTING_CONNECTION, MYF(0), + my_error(ER_NEW_ABORTING_CONNECTION, + (thd->db.str || sctx->user) ? MYF(0) : MYF(ME_WARNING), thd->thread_id, thd->db.str ? thd->db.str : "unconnected", sctx->user ? sctx->user : "unauthenticated", @@ -1359,14 +1365,6 @@ void do_handle_one_connection(CONNECT *connect, bool put_in_cache) return; } - DBUG_EXECUTE_IF("CONNECT_wait", - { - extern Dynamic_array listen_sockets; - DBUG_ASSERT(listen_sockets.size()); - while (listen_sockets.size()) - my_sleep(1000); - }); - /* If a thread was created to handle this connection: increment slow_launch_threads counter if it took more than diff --git a/sql/sql_const.h b/sql/sql_const.h index bcc556e61f918..490b870d768d0 100644 --- a/sql/sql_const.h +++ b/sql/sql_const.h @@ -29,7 +29,7 @@ /* extra 4+4 bytes for slave tmp tables */ #define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4) #define MAX_ALIAS_NAME 256 -#define MAX_FIELD_NAME 34 /* Max colum name length +2 */ +#define MAX_FIELD_NAME (NAME_LEN+1) /* Max colum name length +1 */ #define MAX_SYS_VAR_LENGTH 32 #define MAX_KEY MAX_INDEXES /* Max used keys */ #define MAX_REF_PARTS 32 /* Max parts used as ref */ diff --git a/sql/sql_crypt.h b/sql/sql_crypt.h index 3c90550c9449c..aab97501b4846 100644 --- a/sql/sql_crypt.h +++ b/sql/sql_crypt.h @@ -30,12 +30,12 @@ class SQL_CRYPT :public Sql_alloc char decode_buff[256],encode_buff[256]; uint shift; public: - SQL_CRYPT() {} + SQL_CRYPT() = default; SQL_CRYPT(ulong *seed) { init(seed); } - ~SQL_CRYPT() {} + ~SQL_CRYPT() = default; void init(ulong *seed); void reinit() { shift=0; rand=org_rand; } void encode(char *str, uint length); diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc index 445bc97a3b5b4..ad385128d8d46 100644 --- a/sql/sql_cte.cc +++ b/sql/sql_cte.cc @@ -100,49 +100,6 @@ bool LEX::check_dependencies_in_with_clauses() } -/** - @brief - Resolve references to CTE in specification of hanging CTE - - @details - A CTE to which there are no references in the query is called hanging CTE. - Although such CTE is not used for execution its specification must be - subject to context analysis. All errors concerning references to - non-existing tables or fields occurred in the specification must be - reported as well as all other errors caught at the prepare stage. - The specification of a hanging CTE might contain references to other - CTE outside of the specification and within it if the specification - contains a with clause. This function resolves all such references for - all hanging CTEs encountered in the processed query. - - @retval - false on success - true on failure -*/ - -bool -LEX::resolve_references_to_cte_in_hanging_cte() -{ - for (With_clause *with_clause= with_clauses_list; - with_clause; with_clause= with_clause->next_with_clause) - { - for (With_element *with_elem= with_clause->with_list.first; - with_elem; with_elem= with_elem->next) - { - if (!with_elem->is_referenced()) - { - TABLE_LIST *first_tbl= - with_elem->spec->first_select()->table_list.first; - TABLE_LIST **with_elem_end_pos= with_elem->head->tables_pos.end_pos; - if (first_tbl && resolve_references_to_cte(first_tbl, with_elem_end_pos)) - return true; - } - } - } - return false; -} - - /** @brief Resolve table references to CTE from a sub-chain of table references @@ -289,8 +246,6 @@ LEX::check_cte_dependencies_and_resolve_references() return false; if (resolve_references_to_cte(query_tables, query_tables_last)) return true; - if (resolve_references_to_cte_in_hanging_cte()) - return true; return false; } @@ -410,9 +365,17 @@ bool With_element::check_dependencies_in_spec() { for (st_select_lex *sl= spec->first_select(); sl; sl= sl->next_select()) { - st_unit_ctxt_elem ctxt0= {NULL, owner->owner}; - st_unit_ctxt_elem ctxt1= {&ctxt0, spec}; - check_dependencies_in_select(sl, &ctxt1, false, &sl->with_dep); + if (owner->with_recursive) + { + st_unit_ctxt_elem ctxt0= {NULL, owner->owner}; + st_unit_ctxt_elem ctxt1= {&ctxt0, spec}; + check_dependencies_in_select(sl, &ctxt1, false, &sl->with_dep); + } + else + { + st_unit_ctxt_elem ctxt= {NULL, spec}; + check_dependencies_in_select(sl, &ctxt, false, &sl->with_dep); + } base_dep_map|= sl->with_dep; } return false; @@ -480,29 +443,36 @@ With_element *With_clause::find_table_def(TABLE_LIST *table, With_element *find_table_def_in_with_clauses(TABLE_LIST *tbl, st_unit_ctxt_elem *ctxt) { - With_element *barrier= NULL; + With_element *found= 0; + st_select_lex_unit *top_unit= 0; for (st_unit_ctxt_elem *unit_ctxt_elem= ctxt; unit_ctxt_elem; unit_ctxt_elem= unit_ctxt_elem->prev) { st_select_lex_unit *unit= unit_ctxt_elem->unit; With_clause *with_clause= unit->with_clause; - if (with_clause && - (tbl->with= with_clause->find_table_def(tbl, barrier))) - return tbl->with; - barrier= NULL; - if (unit->with_element && !unit->with_element->get_owner()->with_recursive) + if (with_clause) { - /* - This unit is the specification if the with element unit->with_element. - The with element belongs to a with clause without the specifier RECURSIVE. - So when searching for the matching definition of tbl this with clause must - be looked up to this with element + /* + If the reference to tbl that has to be resolved belongs to + the FROM clause of a descendant of top_unit->with_element + and this with element belongs to with_clause then this + element must be used as the barrier for the search in the + the list of CTEs from with_clause unless the clause contains + RECURSIVE. */ - barrier= unit->with_element; + With_element *barrier= 0; + if (top_unit && !with_clause->with_recursive && + top_unit->with_element && + top_unit->with_element->get_owner() == with_clause) + barrier= top_unit->with_element; + found= with_clause->find_table_def(tbl, barrier); + if (found) + break; } + top_unit= unit; } - return NULL; + return found; } @@ -532,22 +502,30 @@ void With_element::check_dependencies_in_select(st_select_lex *sl, bool in_subq, table_map *dep_map) { - With_clause *with_clause= sl->get_with_clause(); + bool is_spec_select= sl->get_with_element() == this; + for (TABLE_LIST *tbl= sl->table_list.first; tbl; tbl= tbl->next_local) { - if (tbl->derived || tbl->nested_join) + if (tbl->with || tbl->derived || tbl->nested_join) continue; tbl->with_internal_reference_map= 0; /* - If there is a with clause attached to the unit containing sl - look first for the definition of tbl in this with clause. - If such definition is not found there look in the with - clauses of the upper levels. + Look first for the definition of tbl in the with clause to which + this with element belongs. If such definition is not found there + look in the with clauses of the upper levels via the context + chain of embedding with elements. If the definition of tbl is found somewhere in with clauses - then tbl->with is set to point to this definition + then tbl->with is set to point to this definition. */ - if (with_clause && !tbl->with) - tbl->with= with_clause->find_table_def(tbl, NULL); + if (is_spec_select) + { + With_clause *with_clause= sl->master_unit()->with_clause; + if (with_clause) + tbl->with= with_clause->find_table_def(tbl, NULL); + if (!tbl->with) + tbl->with= owner->find_table_def(tbl, + owner->with_recursive ? NULL : this); + } if (!tbl->with) tbl->with= find_table_def_in_with_clauses(tbl, ctxt); @@ -574,8 +552,7 @@ void With_element::check_dependencies_in_select(st_select_lex *sl, st_select_lex_unit *inner_unit= sl->first_inner_unit(); for (; inner_unit; inner_unit= inner_unit->next_unit()) { - if (!inner_unit->with_element) - check_dependencies_in_unit(inner_unit, ctxt, in_subq, dep_map); + check_dependencies_in_unit(inner_unit, ctxt, in_subq, dep_map); } } @@ -653,10 +630,14 @@ void With_element::check_dependencies_in_unit(st_select_lex_unit *unit, bool in_subq, table_map *dep_map) { + st_unit_ctxt_elem unit_ctxt_elem= {ctxt, unit}; if (unit->with_clause) - check_dependencies_in_with_clause(unit->with_clause, ctxt, in_subq, dep_map); + { + (void) unit->with_clause->check_dependencies(); + check_dependencies_in_with_clause(unit->with_clause, &unit_ctxt_elem, + in_subq, dep_map); + } in_subq |= unit->item != NULL; - st_unit_ctxt_elem unit_ctxt_elem= {ctxt, unit}; st_select_lex *sl= unit->first_select(); for (; sl; sl= sl->next_select()) { diff --git a/sql/sql_cte.h b/sql/sql_cte.h index 4cec1240d1f2b..6a1f67d32585c 100644 --- a/sql/sql_cte.h +++ b/sql/sql_cte.h @@ -326,8 +326,6 @@ class With_element : public Sql_alloc friend bool LEX::resolve_references_to_cte(TABLE_LIST *tables, TABLE_LIST **tables_last); - friend - bool LEX::resolve_references_to_cte_in_hanging_cte(); }; const uint max_number_of_elements_in_with_clause= sizeof(table_map)*8; @@ -393,10 +391,24 @@ class With_clause : public Sql_alloc bool add_with_element(With_element *elem); /* Add this with clause to the list of with clauses used in the statement */ - void add_to_list(With_clause ** &last_next) + void add_to_list(With_clause **ptr, With_clause ** &last_next) { - *last_next= this; - last_next= &this->next_with_clause; + if (embedding_with_clause) + { + /* + An embedded with clause is always placed before the embedding one + in the list of with clauses used in the query. + */ + while (*ptr != embedding_with_clause) + ptr= &(*ptr)->next_with_clause; + *ptr= this; + next_with_clause= embedding_with_clause; + } + else + { + *last_next= this; + last_next= &this->next_with_clause; + } } st_select_lex_unit *get_owner() { return owner; } @@ -427,9 +439,6 @@ class With_clause : public Sql_alloc friend bool LEX::check_dependencies_in_with_clauses(); - - friend - bool LEX::resolve_references_to_cte_in_hanging_cte(); }; inline diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc index 0324e9691e821..cef8ac161df3d 100644 --- a/sql/sql_cursor.cc +++ b/sql/sql_cursor.cc @@ -80,19 +80,7 @@ class Select_materialize: public select_unit Select_materialize(THD *thd_arg, select_result *result_arg): select_unit(thd_arg), result(result_arg), materialized_cursor(0) {} virtual bool send_result_set_metadata(List &list, uint flags); - bool send_eof() - { - if (materialized_cursor) - materialized_cursor->on_table_fill_finished(); - return false; - } - - void abort_result_set() - { - if (materialized_cursor) - materialized_cursor->on_table_fill_finished(); - } - + bool send_eof() { return false; } bool view_structure_only() const { return result->view_structure_only(); @@ -197,7 +185,7 @@ int mysql_open_cursor(THD *thd, select_result *result, } *pcursor= materialized_cursor; - thd->stmt_arena->cleanup_stmt(true); + rc|= (thd->stmt_arena->cleanup_stmt(true)? 1 : 0); } end: @@ -209,9 +197,7 @@ int mysql_open_cursor(THD *thd, select_result *result, Server_side_cursor ****************************************************************************/ -Server_side_cursor::~Server_side_cursor() -{ -} +Server_side_cursor::~Server_side_cursor() = default; void Server_side_cursor::operator delete(void *ptr, size_t size) @@ -333,6 +319,8 @@ int Materialized_cursor::open(JOIN *join __attribute__((unused))) result->abort_result_set(); } + on_table_fill_finished(); + return rc; } diff --git a/sql/sql_debug.h b/sql/sql_debug.h new file mode 100644 index 0000000000000..003caec54544f --- /dev/null +++ b/sql/sql_debug.h @@ -0,0 +1,168 @@ +#ifndef SQL_DEBUG_INCLUDED +#define SQL_DEBUG_INCLUDED +/* + Copyright (c) 2022, 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 the Free Software Foundation; version 2 of + the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA +*/ + + +class Debug_key: public String +{ +public: + Debug_key() = default; + void print(THD *thd) const + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, + ER_UNKNOWN_ERROR, "DBUG: %.*s", length(), ptr()); + } + + bool append_key_type(ha_base_keytype type) + { + static LEX_CSTRING names[20]= + { + {STRING_WITH_LEN("END")}, + {STRING_WITH_LEN("TEXT")}, + {STRING_WITH_LEN("BINARY")}, + {STRING_WITH_LEN("SHORT_INT")}, + {STRING_WITH_LEN("LONG_INT")}, + {STRING_WITH_LEN("FLOAT")}, + {STRING_WITH_LEN("DOUBLE")}, + {STRING_WITH_LEN("NUM")}, + {STRING_WITH_LEN("USHORT_INT")}, + {STRING_WITH_LEN("ULONG_INT")}, + {STRING_WITH_LEN("LONGLONG")}, + {STRING_WITH_LEN("ULONGLONG")}, + {STRING_WITH_LEN("INT24")}, + {STRING_WITH_LEN("UINT24")}, + {STRING_WITH_LEN("INT8")}, + {STRING_WITH_LEN("VARTEXT1")}, + {STRING_WITH_LEN("VARBINARY1")}, + {STRING_WITH_LEN("VARTEXT2")}, + {STRING_WITH_LEN("VARBINARY2")}, + {STRING_WITH_LEN("BIT")} + }; + if ((uint) type >= array_elements(names)) + return append(STRING_WITH_LEN("???")); + return append(names[(uint) type]); + } + + bool append_KEY_flag_names(ulong flags) + { + static LEX_CSTRING names[17]= + { + {STRING_WITH_LEN("HA_NOSAME")}, // 1 + {STRING_WITH_LEN("HA_PACK_KEY")}, // 2; also in HA_KEYSEG + {STRING_WITH_LEN("HA_SPACE_PACK_USED")}, // 4 + {STRING_WITH_LEN("HA_VAR_LENGTH_KEY")}, // 8 + {STRING_WITH_LEN("HA_AUTO_KEY")}, // 16 + {STRING_WITH_LEN("HA_BINARY_PACK_KEY")}, // 32 + {STRING_WITH_LEN("HA_NULL_PART_KEY")}, // 64 + {STRING_WITH_LEN("HA_FULLTEXT")}, // 128 + {STRING_WITH_LEN("HA_UNIQUE_CHECK")}, // 256 + {STRING_WITH_LEN("HA_SORT_ALLOWS_SAME")}, // 512 + {STRING_WITH_LEN("HA_SPATIAL")}, // 1024 + {STRING_WITH_LEN("HA_NULL_ARE_EQUAL")}, // 2048 + {STRING_WITH_LEN("HA_USES_COMMENT")}, // 4096 + {STRING_WITH_LEN("HA_GENERATED_KEY")}, // 8192 + {STRING_WITH_LEN("HA_USES_PARSER")}, // 16384 + {STRING_WITH_LEN("HA_USES_BLOCK_SIZE")}, // 32768 + {STRING_WITH_LEN("HA_KEY_HAS_PART_KEY_SEG")}// 65536 + }; + return append_flag32_names((uint) flags, names, array_elements(names)); + } + + bool append_HA_KEYSEG_flag_names(uint32 flags) + { + static LEX_CSTRING names[]= + { + {STRING_WITH_LEN("HA_SPACE_PACK")}, // 1 + {STRING_WITH_LEN("HA_PACK_KEY")}, // 2; also in KEY/MI/KEY_DEF + {STRING_WITH_LEN("HA_PART_KEY_SEG")}, // 4 + {STRING_WITH_LEN("HA_VAR_LENGTH_PART")}, // 8 + {STRING_WITH_LEN("HA_NULL_PART")}, // 16 + {STRING_WITH_LEN("HA_BLOB_PART")}, // 32 + {STRING_WITH_LEN("HA_SWAP_KEY")}, // 64 + {STRING_WITH_LEN("HA_REVERSE_SORT")}, // 128 + {STRING_WITH_LEN("HA_NO_SORT")}, // 256 + {STRING_WITH_LEN("??? 512 ???")}, // 512 + {STRING_WITH_LEN("HA_BIT_PART")}, // 1024 + {STRING_WITH_LEN("HA_CAN_MEMCMP")} // 2048 + }; + return append_flag32_names(flags, names, array_elements(names)); + } + + bool append_HA_KEYSEG_type(ha_base_keytype type) + { + return append_ulonglong(type) || + append(' ') || + append_key_type(type); + } + + bool append_HA_KEYSEG_flags(uint32 flags) + { + return append_hex_uint32(flags) || + append(' ') || + append_HA_KEYSEG_flag_names(flags); + } + + bool append_key(const LEX_CSTRING &name, uint32 flags) + { + return + append_name_value(Lex_cstring(STRING_WITH_LEN("name")), name, '`') || + append(Lex_cstring(STRING_WITH_LEN(" flags="))) || + append_hex_uint32(flags) || + append(' ') || + append_KEY_flag_names(flags); + } + + bool append_KEY(const KEY &key) + { + return append_key(key.name, key.flags); + } + + static void print_keysegs(THD *thd, const HA_KEYSEG *seg, uint count) + { + for (uint i= 0; i < count; i++) + { + Debug_key tmp; + if (!tmp.append(Lex_cstring(STRING_WITH_LEN(" seg["))) && + !tmp.append_ulonglong(i) && + !tmp.append(Lex_cstring(STRING_WITH_LEN("].type="))) && + !tmp.append_HA_KEYSEG_type((ha_base_keytype) seg[i].type)) + tmp.print(thd); + tmp.length(0); + if (!tmp.append(Lex_cstring(STRING_WITH_LEN(" seg["))) && + !tmp.append_ulonglong(i) && + !tmp.append(Lex_cstring(STRING_WITH_LEN("].flag="))) && + !tmp.append_HA_KEYSEG_flags(seg[i].flag)) + tmp.print(thd); + } + } + + static void print_keys(THD *thd, const char *where, + const KEY *keys, uint key_count) + { + for (uint i= 0; i < key_count; i++) + { + Debug_key tmp; + if (!tmp.append(where, strlen(where)) && !tmp.append_KEY(keys[i])) + tmp.print(thd); + } + } +}; + + +#endif // SQL_DEBUG_INCLUDED diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 0403d6e73c38e..41e2892be5f09 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2019, Oracle and/or its affiliates. - Copyright (c) 2010, 2021, MariaDB + Copyright (c) 2010, 2022, 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 @@ -417,7 +417,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, DBUG_RETURN(TRUE); const_cond= (!conds || conds->const_item()); - safe_update= MY_TEST(thd->variables.option_bits & OPTION_SAFE_UPDATES); + safe_update= (thd->variables.option_bits & OPTION_SAFE_UPDATES) && + !thd->lex->describe; if (safe_update && const_cond) { my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE, @@ -542,7 +543,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, } /* If running in safe sql mode, don't allow updates without keys */ - if (table->opt_range_keys.is_clear_all()) + if (!select || !select->quick) { thd->set_status_no_index_used(); if (safe_update && !using_limit) @@ -703,6 +704,10 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, { table->use_all_columns(); table->rpl_write_set= table->write_set; + // Initialize autoinc. + // We don't set next_number_field here, as it is handled manually. + if (table->found_next_number_field) + table->file->info(HA_STATUS_AUTO); } else { @@ -1083,6 +1088,8 @@ int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds, DBUG_RETURN(TRUE); select_lex->fix_prepare_information(thd, conds, &fake_conds); + if (!thd->lex->upd_del_where) + thd->lex->upd_del_where= *conds; DBUG_RETURN(FALSE); } @@ -1309,7 +1316,9 @@ multi_delete::initialize_tables(JOIN *join) table->file->ref_length, MEM_STRIP_BUF_SIZE); } - init_ftfuncs(thd, thd->lex->current_select, 1); + if (init_ftfuncs(thd, thd->lex->current_select, 1)) + DBUG_RETURN(true); + DBUG_RETURN(thd->is_fatal_error); } diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 579ea34b8e4ef..e5362ffe0a9a1 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -351,24 +351,6 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived) DBUG_RETURN(FALSE); } - if (dt_select->uncacheable & UNCACHEABLE_RAND) - { - /* There is random function => fall back to materialization. */ - cause= "Random function in the select"; - if (unlikely(thd->trace_started())) - { - OPT_TRACE_VIEWS_TRANSFORM(thd, trace_wrapper, trace_derived, - derived->is_derived() ? "derived" : "view", - derived->alias.str ? derived->alias.str : "", - derived->get_unit()->first_select()->select_number, - "materialized"); - trace_derived.add("cause", cause); - } - derived->change_refs_to_fields(); - derived->set_materialized_derived(); - DBUG_RETURN(FALSE); - } - if (derived->dt_handler) { derived->change_refs_to_fields(); @@ -821,6 +803,9 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived) cursor->outer_join|= JOIN_TYPE_OUTER; } } + // Prevent it for possible ORDER BY clause + if (unit->fake_select_lex) + unit->fake_select_lex->context.outer_context= 0; if (unlikely(thd->trace_started())) { @@ -1016,11 +1001,7 @@ bool mysql_derived_optimize(THD *thd, LEX *lex, TABLE_LIST *derived) /* Create an object for execution of the query specifying the table */ if (!(derived->pushdown_derived= new (thd->mem_root) Pushdown_derived(derived, derived->dt_handler))) - { - delete derived->dt_handler; - derived->dt_handler= NULL; DBUG_RETURN(TRUE); - } } lex->current_select= first_select; @@ -1245,7 +1226,6 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived) /* Execute the query that specifies the derived table by a foreign engine */ res= derived->pushdown_derived->execute(); unit->executed= true; - delete derived->pushdown_derived; DBUG_RETURN(res); } diff --git a/sql/sql_error.h b/sql/sql_error.h index d9d7f420baaed..541b92b4531eb 100644 --- a/sql/sql_error.h +++ b/sql/sql_error.h @@ -245,8 +245,7 @@ class Sql_condition_identity: public Sql_state_errno_level, public Sql_user_condition_identity { public: - Sql_condition_identity() - { } + Sql_condition_identity() = default; Sql_condition_identity(const Sql_state_errno_level &st, const Sql_user_condition_identity &ucid) :Sql_state_errno_level(st), @@ -450,8 +449,7 @@ class Sql_condition : public Sql_alloc, } /** Destructor. */ - ~Sql_condition() - {} + ~Sql_condition() = default; /** Copy optional condition items attributes. @@ -725,6 +723,13 @@ class Warning_info /** Reset the current row counter. Start counting from the first row. */ void reset_current_row_for_warning(int n) { m_current_row_for_warning= n; } + ulong set_current_row_for_warning(ulong row) + { + ulong old_row= m_current_row_for_warning; + m_current_row_for_warning= row; + return old_row; + } + /** Return the current counter value. */ ulong current_row_for_warning() const { return m_current_row_for_warning; } @@ -864,8 +869,8 @@ class ErrBuff class ErrConv: public ErrBuff { public: - ErrConv() {} - virtual ~ErrConv() {} + ErrConv() = default; + virtual ~ErrConv() = default; virtual LEX_CSTRING lex_cstring() const= 0; inline const char *ptr() const { @@ -1139,6 +1144,9 @@ class Diagnostics_area: public Sql_state_errno, void opt_clear_warning_info(ulonglong query_id) { get_warning_info()->opt_clear(query_id); } + long set_current_row_for_warning(long row) + { return get_warning_info()->set_current_row_for_warning(row); } + ulong current_row_for_warning() const { return get_warning_info()->current_row_for_warning(); } diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 4fd4e6d3b77be..e49ba0da11c01 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -163,7 +163,7 @@ void Explain_query::query_plan_ready() Send EXPLAIN output to the client. */ -int Explain_query::send_explain(THD *thd) +int Explain_query::send_explain(THD *thd, bool extended) { select_result *result; LEX *lex= thd->lex; @@ -176,8 +176,22 @@ int Explain_query::send_explain(THD *thd) if (thd->lex->explain_json) print_explain_json(result, thd->lex->analyze_stmt); else + { res= print_explain(result, lex->describe, thd->lex->analyze_stmt); - + if (extended) + { + char buff[1024]; + String str(buff,(uint32) sizeof(buff), system_charset_info); + str.length(0); + /* + The warnings system requires input in utf8, @see + mysqld_show_warnings(). + */ + lex->unit.print(&str, QT_EXPLAIN_EXTENDED); + push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, + ER_YES, str.c_ptr_safe()); + } + } if (res) result->abort_result_set(); else @@ -187,6 +201,7 @@ int Explain_query::send_explain(THD *thd) } + /* The main entry point to print EXPLAIN of the entire query */ @@ -606,27 +621,29 @@ void Explain_union::print_explain_json(Explain_query *query, else writer->add_member("union_result").start_object(); - // using_temporary_table - make_union_table_name(table_name_buffer); - writer->add_member("table_name").add_str(table_name_buffer); - writer->add_member("access_type").add_str("ALL"); // not very useful - - /* r_loops (not present in tabular output) */ - if (is_analyze) + if (using_tmp) { - writer->add_member("r_loops").add_ll(fake_select_lex_tracker.get_loops()); - } + make_union_table_name(table_name_buffer); + writer->add_member("table_name").add_str(table_name_buffer); + writer->add_member("access_type").add_str("ALL"); // not very useful - /* `r_rows` */ - if (is_analyze) - { - writer->add_member("r_rows"); - if (fake_select_lex_tracker.has_scans()) - writer->add_double(fake_select_lex_tracker.get_avg_rows()); - else - writer->add_null(); - } + /* r_loops (not present in tabular output) */ + if (is_analyze) + { + writer->add_member("r_loops").add_ll( + fake_select_lex_tracker.get_loops()); + } + /* `r_rows` */ + if (is_analyze) + { + writer->add_member("r_rows"); + if (fake_select_lex_tracker.has_scans()) + writer->add_double(fake_select_lex_tracker.get_avg_rows()); + else + writer->add_null(); + } + } writer->add_member("query_specifications").start_array(); for (int i= 0; i < (int) union_members.elements(); i++) @@ -662,7 +679,11 @@ int Explain_node::print_explain_for_children(Explain_query *query, for (int i= 0; i < (int) children.elements(); i++) { Explain_node *node= query->get_node(children.at(i)); - if (node->print_explain(query, output, explain_flags, is_analyze)) + /* + Note: node may not be present because for certain kinds of subqueries, + the optimizer is not able to see that they were eliminated. + */ + if (node && node->print_explain(query, output, explain_flags, is_analyze)) return 1; } return 0; @@ -706,8 +727,15 @@ void Explain_node::print_explain_json_for_children(Explain_query *query, for (int i= 0; i < (int) children.elements(); i++) { Explain_node *node= query->get_node(children.at(i)); - /* Derived tables are printed inside Explain_table_access objects */ + /* + Note: node may not be present because for certain kinds of subqueries, + the optimizer is not able to see that they were eliminated. + */ + if (!node) + continue; + + /* Derived tables are printed inside Explain_table_access objects */ if (!is_connection_printable_in_json(node->connection_type)) continue; @@ -1680,6 +1708,7 @@ void Explain_rowid_filter::print_explain_json(Explain_query *query, if (is_analyze) { writer->add_member("r_rows").add_double(tracker->get_container_elements()); + writer->add_member("r_lookups").add_ll(tracker->get_container_lookups()); writer->add_member("r_selectivity_pct"). add_double(tracker->get_r_selectivity_pct() * 100.0); writer->add_member("r_buffer_size"). @@ -1887,12 +1916,35 @@ void Explain_table_access::print_explain_json(Explain_query *query, if (is_analyze) { - //writer->add_member("r_loops").add_ll(jbuf_tracker.get_loops()); + writer->add_member("r_loops").add_ll(jbuf_loops_tracker.get_loops()); + writer->add_member("r_filtered"); if (jbuf_tracker.has_scans()) writer->add_double(jbuf_tracker.get_filtered_after_where()*100.0); else writer->add_null(); + + writer->add_member("r_unpack_time_ms"); + writer->add_double(jbuf_unpack_tracker.get_time_ms()); + + writer->add_member("r_other_time_ms"). + add_double(jbuf_extra_time_tracker.get_time_ms()); + /* + effective_rows is average number of matches we got for an incoming + row. The row is stored in the join buffer and then is read + from there, possibly multiple times. We can't count this number + directly. Infer it as: + total_number_of_row_combinations_considered / r_loops. + */ + writer->add_member("r_effective_rows"); + if (jbuf_loops_tracker.has_scans()) + { + double loops= (double)jbuf_loops_tracker.get_loops(); + double row_combinations= (double)jbuf_tracker.r_rows; + writer->add_double(row_combinations / loops); + } + else + writer->add_null(); } } diff --git a/sql/sql_explain.h b/sql/sql_explain.h index 88fae9d4f1a69..7639df4604a1a 100644 --- a/sql/sql_explain.h +++ b/sql/sql_explain.h @@ -142,7 +142,7 @@ class Explain_node : public Sql_alloc void print_explain_json_for_children(Explain_query *query, Json_writer *writer, bool is_analyze); bool print_explain_json_cache(Json_writer *writer, bool is_analyze); - virtual ~Explain_node(){} + virtual ~Explain_node() = default; }; @@ -289,7 +289,7 @@ class Explain_aggr_node : public Sql_alloc { public: virtual enum_explain_aggr_node_type get_type()= 0; - virtual ~Explain_aggr_node() {} + virtual ~Explain_aggr_node() = default; Explain_aggr_node *child; }; @@ -473,7 +473,7 @@ class Explain_query : public Sql_alloc bool is_analyze); /* Send tabular EXPLAIN to the client */ - int send_explain(THD *thd); + int send_explain(THD *thd, bool extended); /* Return tabular EXPLAIN output as a text string */ bool print_explain_str(THD *thd, String *out_str, bool is_analyze); @@ -721,7 +721,7 @@ class Explain_range_checked_fer : public Sql_alloc class Explain_table_access : public Sql_alloc { public: - Explain_table_access(MEM_ROOT *root) : + Explain_table_access(MEM_ROOT *root, bool timed) : derived_select_number(0), non_merged_sjm_number(0), extra_tags(root), @@ -734,6 +734,7 @@ class Explain_table_access : public Sql_alloc pushed_index_cond(NULL), sjm_nest(NULL), pre_join_sort(NULL), + jbuf_unpack_tracker(timed), rowid_filter(NULL) {} ~Explain_table_access() { delete sjm_nest; } @@ -841,8 +842,22 @@ class Explain_table_access : public Sql_alloc Exec_time_tracker op_tracker; Gap_time_tracker extra_time_tracker; + /* When using join buffer: Track the reads from join buffer */ Table_access_tracker jbuf_tracker; - + + /* When using join buffer: time spent unpacking rows from the join buffer */ + Time_and_counter_tracker jbuf_unpack_tracker; + + /* + When using join buffer: time spent after unpacking rows from the join + buffer. This will capture the time spent checking the Join Condition: + the condition that depends on this table and preceding tables. + */ + Gap_time_tracker jbuf_extra_time_tracker; + + /* When using join buffer: Track the number of incoming record combinations */ + Counter_tracker jbuf_loops_tracker; + Explain_rowid_filter *rowid_filter; int print_explain(select_result_sink *output, uint8 explain_flags, diff --git a/sql/sql_expression_cache.cc b/sql/sql_expression_cache.cc index 351ec258ddb07..69d85f3343d46 100644 --- a/sql/sql_expression_cache.cc +++ b/sql/sql_expression_cache.cc @@ -63,7 +63,7 @@ void Expression_cache_tmptable::disable_cache() cache_table= NULL; update_tracker(); if (tracker) - tracker->cache= NULL; + tracker->detach_from_cache(); } @@ -114,7 +114,7 @@ void Expression_cache_tmptable::init() cache_table_param.init(); /* dependent items and result */ - cache_table_param.field_count= items.elements; + cache_table_param.field_count= cache_table_param.func_count= items.elements; /* postpone table creation to index description */ cache_table_param.skip_create_table= 1; @@ -189,6 +189,8 @@ Expression_cache_tmptable::~Expression_cache_tmptable() else { update_tracker(); + if (tracker) + tracker->detach_from_cache(); tracker= NULL; } } diff --git a/sql/sql_expression_cache.h b/sql/sql_expression_cache.h index 031773adb9f06..88436837a2de9 100644 --- a/sql/sql_expression_cache.h +++ b/sql/sql_expression_cache.h @@ -36,8 +36,8 @@ class Expression_cache :public Sql_alloc public: enum result {ERROR, HIT, MISS}; - Expression_cache(){}; - virtual ~Expression_cache() {}; + Expression_cache()= default; + virtual ~Expression_cache() = default; /** Shall check the presence of expression value in the cache for a given set of values of the expression parameters. Return the result of the @@ -83,7 +83,11 @@ class Expression_cache_tracker :public Sql_alloc cache(c), hit(0), miss(0), state(UNINITED) {} +private: + // This can be NULL if the cache is already deleted Expression_cache *cache; + +public: ulong hit, miss; enum expr_cache_state state; @@ -91,6 +95,7 @@ class Expression_cache_tracker :public Sql_alloc void set(ulong h, ulong m, enum expr_cache_state s) {hit= h; miss= m; state= s;} + void detach_from_cache() { cache= NULL; } void fetch_current_stats() { if (cache) diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 833492d3d9f55..7235dc6472de8 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -712,8 +712,10 @@ mysql_ha_fix_cond_and_key(SQL_HANDLER *handler, if (!in_prepare) { MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set); - (void) item->save_in_field(key_part->field, 1); + int res= item->save_in_field(key_part->field, 1); dbug_tmp_restore_column_map(&table->write_set, old_map); + if (res) + return 1; } key_len+= key_part->store_length; keypart_map= (keypart_map << 1) | 1; diff --git a/sql/sql_hset.h b/sql/sql_hset.h index b3d8165f6f6c4..41573fb5f03a3 100644 --- a/sql/sql_hset.h +++ b/sql/sql_hset.h @@ -15,6 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ +#include "my_global.h" #include "hash.h" @@ -28,17 +29,15 @@ class Hash_set public: enum { START_SIZE= 8 }; /** - Constructs an empty hash. Does not allocate memory, it is done upon - the first insert. Thus does not cause or return errors. + Constructs an empty unique hash. */ Hash_set(PSI_memory_key psi_key, uchar *(*K)(const T *, size_t *, my_bool), CHARSET_INFO *cs= &my_charset_bin) { - my_hash_clear(&m_hash); - m_hash.get_key= (my_hash_get_key)K; - m_hash.charset= cs; - m_hash.array.m_psi_key= psi_key; + my_hash_init(psi_key, &m_hash, cs, START_SIZE, 0, 0, (my_hash_get_key)K, 0, + HASH_UNIQUE); } + Hash_set(PSI_memory_key psi_key, CHARSET_INFO *charset, ulong default_array_elements, size_t key_offset, size_t key_length, my_hash_get_key get_key, void (*free_element)(void*), uint flags) @@ -65,8 +64,6 @@ class Hash_set */ bool insert(T *value) { - my_hash_init_opt(m_hash.array.m_psi_key, &m_hash, m_hash.charset, - START_SIZE, 0, 0, m_hash.get_key, 0, HASH_UNIQUE); return my_hash_insert(&m_hash, reinterpret_cast(value)); } bool remove(T *value) diff --git a/sql/sql_i_s.h b/sql/sql_i_s.h index 60a91205bbff8..a3614d889c9af 100644 --- a/sql/sql_i_s.h +++ b/sql/sql_i_s.h @@ -45,13 +45,6 @@ enum enum_show_open_table }; -enum enum_show_default -{ - DEFAULT_TYPE_IMPLICIT= 0, - DEFAULT_NONE -}; - - namespace Show { class Type { @@ -97,29 +90,24 @@ class ST_FIELD_INFO: public Show::Type protected: LEX_CSTRING m_name; // I_S column name enum_nullability m_nullability; // NULLABLE or NOT NULL - enum_show_default m_def; // Whether has a DEFAULT value LEX_CSTRING m_old_name; // SHOW column name enum_show_open_table m_open_method; public: ST_FIELD_INFO(const LEX_CSTRING &name, const Type &type, enum_nullability nullability, - enum_show_default def, LEX_CSTRING &old_name, enum_show_open_table open_method) :Type(type), m_name(name), m_nullability(nullability), - m_def(def), m_old_name(old_name), m_open_method(open_method) { } ST_FIELD_INFO(const char *name, const Type &type, enum_nullability nullability, - enum_show_default def, const char *old_name, enum_show_open_table open_method) :Type(type), m_nullability(nullability), - m_def(def), m_open_method(open_method) { m_name.str= name; @@ -129,7 +117,6 @@ class ST_FIELD_INFO: public Show::Type } const LEX_CSTRING &name() const { return m_name; } bool nullable() const { return m_nullability == NULLABLE; } - enum_show_default def() const { return m_def; } const LEX_CSTRING &old_name() const { return m_old_name; } enum_show_open_table open_method() const { return m_open_method; } bool end_marker() const { return m_name.str == NULL; } @@ -171,10 +158,10 @@ class Longtext: public Type }; -class Yesno: public Varchar +class Yes_or_empty: public Varchar { public: - Yesno(): Varchar(3) { } + Yes_or_empty(): Varchar(3) { } }; @@ -298,29 +285,17 @@ class Float: public Type class Column: public ST_FIELD_INFO { public: - Column(const char *name, const Type &type, - enum_nullability nullability, - enum_show_default def, - const char *old_name, - enum_show_open_table open_method= SKIP_OPEN_TABLE) - :ST_FIELD_INFO(name, type, nullability, def, old_name, open_method) - { } - Column(const char *name, const Type &type, enum_nullability nullability, - enum_show_default def, - enum_show_open_table open_method= SKIP_OPEN_TABLE) - :ST_FIELD_INFO(name, type, nullability, def, NullS, open_method) - { } Column(const char *name, const Type &type, enum_nullability nullability, const char *old_name, enum_show_open_table open_method= SKIP_OPEN_TABLE) - :ST_FIELD_INFO(name, type, nullability, DEFAULT_TYPE_IMPLICIT, + :ST_FIELD_INFO(name, type, nullability, old_name, open_method) { } Column(const char *name, const Type &type, enum_nullability nullability, enum_show_open_table open_method= SKIP_OPEN_TABLE) - :ST_FIELD_INFO(name, type, nullability, DEFAULT_TYPE_IMPLICIT, + :ST_FIELD_INFO(name, type, nullability, NullS, open_method) { } }; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 707b8a0d3bf6e..45296f22f356d 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2010, 2021, MariaDB + Copyright (c) 2010, 2022, 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 @@ -95,8 +95,8 @@ pthread_handler_t handle_delayed_insert(void *arg); static void unlink_blobs(TABLE *table); #endif static bool check_view_insertability(THD *thd, TABLE_LIST *view); -static int binlog_show_create_table(THD *thd, TABLE *table, - Table_specification_st *create_info); +static int binlog_show_create_table_(THD *thd, TABLE *table, + Table_specification_st *create_info); /* Check that insert/update fields are from the same single table of a view. @@ -768,7 +768,7 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, value_count= values->elements; if ((res= mysql_prepare_insert(thd, table_list, fields, values, - update_fields, update_values, duplic, + update_fields, update_values, duplic, ignore, &unused_conds, FALSE))) { retval= thd->is_error(); @@ -829,6 +829,20 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, context->resolve_in_table_list_only(table_list); switch_to_nullable_trigger_fields(*values, table); + /* + Check assignability for the leftmost () in VALUES: + INSERT INTO t1 (a,b) VALUES (1,2), (3,4); + This checks if the values (1,2) can be assigned to fields (a,b). + The further values, e.g. (3,4) are not checked - they will be + checked during the execution time (when processing actual rows). + This is to preserve the "insert until the very first error"-style + behaviour for non-transactional tables. + */ + if (values->elements && + table_list->table->check_assignability_opt_fields(fields, *values, + ignore)) + goto abort; + while ((values= its++)) { thd->get_stmt_da()->inc_current_row_for_warning(); @@ -856,7 +870,8 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, save_insert_query_plan(thd, table_list); if (thd->lex->describe) { - retval= thd->lex->explain->send_explain(thd); + bool extended= thd->lex->describe & DESCRIBE_EXTENDED; + retval= thd->lex->explain->send_explain(thd, extended); goto abort; } @@ -995,7 +1010,12 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, goto values_loop_end; THD_STAGE_INFO(thd, stage_update); - thd->decide_logging_format_low(table); + + if (duplic == DUP_UPDATE) + { + restore_record(table,s->default_values); // Get empty record + thd->reconsider_logging_format_for_iodup(table); + } fix_rownum_pointers(thd, thd->lex->current_select, &info.accepted_rows); if (returning) fix_rownum_pointers(thd, thd->lex->returning(), &info.accepted_rows); @@ -1349,8 +1369,12 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, thd->lex->current_select->save_leaf_tables(thd); thd->lex->current_select->first_cond_optimization= 0; } - if (readbuff) - my_free(readbuff); + + my_free(readbuff); +#ifndef EMBEDDED_LIBRARY + if (lock_type == TL_WRITE_DELAYED && table->expr_arena) + table->expr_arena->free_items(); +#endif DBUG_RETURN(FALSE); abort: @@ -1367,6 +1391,8 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, */ for (Field **ptr= table_list->table->field ; *ptr ; ptr++) (*ptr)->free(); + if (table_list->table->expr_arena) + table_list->table->expr_arena->free_items(); } #endif if (table != NULL) @@ -1545,8 +1571,7 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list, if (insert_into_view && !fields.elements) { thd->lex->empty_field_list_on_rset= 1; - if (!thd->lex->first_select_lex()->leaf_tables.head()->table || - table_list->is_multitable()) + if (!table_list->table || table_list->is_multitable()) { my_error(ER_VIEW_NO_INSERT_FIELD_LIST, MYF(0), table_list->view_db.str, table_list->view_name.str); @@ -1615,7 +1640,8 @@ static void prepare_for_positional_update(TABLE *table, TABLE_LIST *tables) int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, List &fields, List_item *values, List &update_fields, List &update_values, - enum_duplicates duplic, COND **where, + enum_duplicates duplic, bool ignore, + COND **where, bool select_insert) { SELECT_LEX *select_lex= thd->lex->first_select_lex(); @@ -1683,7 +1709,16 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, { select_lex->no_wrap_view_item= TRUE; res= check_update_fields(thd, context->table_list, update_fields, - update_values, false, &map); + update_values, false, &map) || + /* + Check that all col=expr pairs are compatible for assignment in + INSERT INTO t1 VALUES (...) + ON DUPLICATE KEY UPDATE col=expr [, col=expr]; + */ + TABLE::check_assignability_explicit_fields(update_fields, + update_values, + ignore); + select_lex->no_wrap_view_item= FALSE; } @@ -2222,7 +2257,7 @@ int check_that_all_fields_are_given_values(THD *thd, TABLE *entry, TABLE_LIST *t for (Field **field=entry->field ; *field ; field++) { if (!bitmap_is_set(write_set, (*field)->field_index) && - !(*field)->vers_sys_field() && + !(*field)->vers_sys_field() && !(*field)->vcol_info && has_no_default_value(thd, *field, table_list) && ((*field)->real_type() != MYSQL_TYPE_ENUM)) err=1; @@ -2524,6 +2559,11 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request, di->table_list.alias.str= di->table_list.table_name.str= di->thd.query(); di->table_list.alias.length= di->table_list.table_name.length= di->thd.query_length(); di->table_list.db= di->thd.db; + /* + Nulify select_lex because, if the thread that spawned the current one + disconnects, the select_lex will point to freed memory. + */ + di->table_list.select_lex= NULL; /* We need the tickets so that they can be cloned in handle_delayed_insert @@ -3183,6 +3223,8 @@ pthread_handler_t handle_delayed_insert(void *arg) di->handler_thread_initialized= TRUE; di->table_list.mdl_request.ticket= NULL; + thd->set_query_id(next_query_id()); + if (di->open_and_lock_table()) goto err; @@ -3301,6 +3343,7 @@ pthread_handler_t handle_delayed_insert(void *arg) if (di->tables_in_use && ! thd->lock && (!thd->killed || di->stacked_inserts)) { + thd->set_query_id(next_query_id()); /* Request for new delayed insert. Lock the table, but avoid to be blocked by a global read lock. @@ -3775,7 +3818,7 @@ int mysql_insert_select_prepare(THD *thd, select_result *sel_res) if ((res= mysql_prepare_insert(thd, lex->query_tables, lex->field_list, 0, lex->update_list, lex->value_list, - lex->duplicates, + lex->duplicates, lex->ignore, &select_lex->where, TRUE))) DBUG_RETURN(res); @@ -3786,7 +3829,6 @@ int mysql_insert_select_prepare(THD *thd, select_result *sel_res) if (sel_res) sel_res->prepare(lex->returning()->item_list, NULL); - DBUG_ASSERT(select_lex->leaf_tables.elements != 0); List_iterator ti(select_lex->leaf_tables); TABLE_LIST *table; uint insert_tables; @@ -3870,6 +3912,17 @@ select_insert::prepare(List &values, SELECT_LEX_UNIT *u) check_insert_fields(thd, table_list, *fields, values, !insert_into_view, 1, &map)); + if (!res) + { + /* + Check that all colN=exprN pairs are compatible for assignment, e.g.: + INSERT INTO t1 (col1, col2) VALUES (expr1, expr2); + INSERT INTO t1 SET col1=expr1, col2=expr2; + */ + res= table_list->table->check_assignability_opt_fields(*fields, values, + lex->ignore); + } + if (!res && fields->elements) { Abort_on_warning_instant_set aws(thd, @@ -3923,7 +3976,15 @@ select_insert::prepare(List &values, SELECT_LEX_UNIT *u) } res= res || setup_fields(thd, Ref_ptr_array(), *info.update_values, - MARK_COLUMNS_READ, 0, NULL, 0); + MARK_COLUMNS_READ, 0, NULL, 0) || + /* + Check that all col=expr pairs are compatible for assignment in + INSERT INTO t1 SELECT ... FROM t2 + ON DUPLICATE KEY UPDATE col=expr [, col=expr] + */ + TABLE::check_assignability_explicit_fields(*info.update_fields, + *info.update_values, + lex->ignore); if (!res) { /* @@ -3966,7 +4027,8 @@ select_insert::prepare(List &values, SELECT_LEX_UNIT *u) lex->current_select->join->select_options|= OPTION_BUFFER_RESULT; } else if (!(lex->current_select->options & OPTION_BUFFER_RESULT) && - thd->locked_tables_mode <= LTM_LOCK_TABLES) + thd->locked_tables_mode <= LTM_LOCK_TABLES && + !table->s->long_unique_table) { /* We must not yet prepare the result table if it is the same as one of the @@ -4087,9 +4149,7 @@ int select_insert::send_data(List &values) bool error=0; thd->count_cuted_fields= CHECK_FIELD_WARN; // Calculate cuted fields - store_values(values); - if (table->default_field && - unlikely(table->update_default_fields(info.ignore))) + if (store_values(values)) DBUG_RETURN(1); thd->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL; if (unlikely(thd->is_error())) @@ -4147,18 +4207,20 @@ int select_insert::send_data(List &values) } -void select_insert::store_values(List &values) +bool select_insert::store_values(List &values) { DBUG_ENTER("select_insert::store_values"); + bool error; + table->reset_default_fields(); if (fields->elements) - fill_record_n_invoke_before_triggers(thd, table, *fields, values, 1, - TRG_EVENT_INSERT); + error= fill_record_n_invoke_before_triggers(thd, table, *fields, values, + true, TRG_EVENT_INSERT); else - fill_record_n_invoke_before_triggers(thd, table, table->field_to_fill(), - values, 1, TRG_EVENT_INSERT); + error= fill_record_n_invoke_before_triggers(thd, table, table->field_to_fill(), + values, true, TRG_EVENT_INSERT); - DBUG_VOID_RETURN; + DBUG_RETURN(error); } bool select_insert::prepare_eof() @@ -4438,7 +4500,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, tmp_table.maybe_null= 0; tmp_table.in_use= thd; - if (!opt_explicit_defaults_for_timestamp) + if (!(thd->variables.option_bits & OPTION_EXPLICIT_DEF_TIMESTAMP)) promote_first_timestamp_column(&alter_info->create_list); if (create_info->fix_create_fields(thd, alter_info, *create_table)) @@ -4481,6 +4543,16 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, alter_info->create_list.push_back(cr_field, thd->mem_root); } + /* + Item*::type_handler() always returns pointers to + type_handler_{time2|datetime2|timestamp2} no matter what + the current mysql56_temporal_format says. + Let's convert them according to mysql56_temporal_format. + QQ: This perhaps should eventually be fixed to have Item*::type_handler() + respect mysql56_temporal_format, and remove the upgrade from here. + */ + Create_field::upgrade_data_types(alter_info->create_list); + if (create_info->check_fields(thd, alter_info, create_table->table_name, create_table->db, @@ -4567,6 +4639,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, */ DBUG_ASSERT(0); } + create_table->table->pos_in_table_list= create_table; } } else @@ -4693,7 +4766,7 @@ select_create::prepare(List &_values, SELECT_LEX_UNIT *u) TABLE const *const table = *tables; if (thd->is_current_stmt_binlog_format_row() && !table->s->tmp_table) - return binlog_show_create_table(thd, *tables, ptr->create_info); + return binlog_show_create_table_(thd, *tables, ptr->create_info); return 0; } select_create *ptr; @@ -4814,8 +4887,8 @@ select_create::prepare(List &_values, SELECT_LEX_UNIT *u) } -static int binlog_show_create_table(THD *thd, TABLE *table, - Table_specification_st *create_info) +static int binlog_show_create_table_(THD *thd, TABLE *table, + Table_specification_st *create_info) { /* Note 1: In RBR mode, we generate a CREATE TABLE statement for the @@ -4908,7 +4981,7 @@ bool binlog_create_table(THD *thd, TABLE *table, bool replace) HA_CREATE_USED_DEFAULT_CHARSET); /* Ensure we write all engine options to binary log */ create_info.used_fields|= HA_CREATE_PRINT_ALL_OPTIONS; - result= binlog_show_create_table(thd, table, &create_info) != 0; + result= binlog_show_create_table_(thd, table, &create_info) != 0; thd->variables.option_bits= save_option_bits; return result; } @@ -4950,10 +5023,10 @@ bool binlog_drop_table(THD *thd, TABLE *table) } -void select_create::store_values(List &values) +bool select_create::store_values(List &values) { - fill_record_n_invoke_before_triggers(thd, table, field, values, 1, - TRG_EVENT_INSERT); + return fill_record_n_invoke_before_triggers(thd, table, field, values, + true, TRG_EVENT_INSERT); } diff --git a/sql/sql_insert.h b/sql/sql_insert.h index 80666a81c50a1..8b034c258772d 100644 --- a/sql/sql_insert.h +++ b/sql/sql_insert.h @@ -27,6 +27,7 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, List &fields, List_item *values, List &update_fields, List &update_values, enum_duplicates duplic, + bool ignore, COND **where, bool select_insert); bool mysql_insert(THD *thd,TABLE_LIST *table,List &fields, List &values, List &update_fields, diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc index 620c52a3f408e..36eae30de1669 100644 --- a/sql/sql_join_cache.cc +++ b/sql/sql_join_cache.cc @@ -1614,7 +1614,7 @@ bool JOIN_CACHE::get_record() pos+= referenced_fields*size_of_fld_ofs; if (prev_cache) prev_cache->get_record_by_pos(prev_rec_ptr); - } + } return res; } @@ -2293,11 +2293,7 @@ enum_nested_loop_state JOIN_CACHE::join_matching_records(bool skip_last) int error; enum_nested_loop_state rc= NESTED_LOOP_OK; join_tab->table->null_row= 0; - bool check_only_first_match= - join_tab->check_only_first_match() && - (!join_tab->first_inner || // semi-join case - join_tab->first_inner == join_tab->first_unmatched); // outer join case - bool outer_join_first_inner= join_tab->is_first_inner_for_outer_join(); + bool check_only_first_match= join_tab->check_only_first_match(); DBUG_ENTER("JOIN_CACHE::join_matching_records"); /* Return at once if there are no records in the join buffer */ @@ -2363,10 +2359,39 @@ enum_nested_loop_state JOIN_CACHE::join_matching_records(bool skip_last) Also those records that must be null complemented are not considered as candidates for matches. */ - if ((!check_only_first_match && !outer_join_first_inner) || + + bool not_exists_opt_is_applicable= true; + if (check_only_first_match && join_tab->first_inner) + { + /* + This is the case with not_exists optimization for nested outer join + when join_tab is the last inner table for one or more embedding outer + joins. To safely use 'not_exists' optimization in this case we have + to check that the match flags for all these embedding outer joins are + in the 'on' state. + (See also a similar check in evaluate_join_record() for the case when + join buffer are not used.) + */ + for (JOIN_TAB *tab= join_tab->first_inner; + tab && tab->first_inner && tab->last_inner == join_tab; + tab= tab->first_inner->first_upper) + { + if (get_match_flag_by_pos_from_join_buffer(rec_ptr, tab) != + MATCH_FOUND) + { + not_exists_opt_is_applicable= false; + break; + } + } + } + + if (!check_only_first_match || + (join_tab->first_inner && !not_exists_opt_is_applicable) || !skip_next_candidate_for_match(rec_ptr)) { - read_next_candidate_for_match(rec_ptr); + ANALYZE_START_TRACKING(join->thd, join_tab->jbuf_unpack_tracker); + read_next_candidate_for_match(rec_ptr); + ANALYZE_STOP_TRACKING(join->thd, join_tab->jbuf_unpack_tracker); rc= generate_full_extensions(rec_ptr); if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS) goto finish; diff --git a/sql/sql_join_cache.h b/sql/sql_join_cache.h index 2c3bf4022caed..393b3e309d380 100644 --- a/sql/sql_join_cache.h +++ b/sql/sql_join_cache.h @@ -678,7 +678,7 @@ class JOIN_CACHE :public Sql_alloc THD *thd(); - virtual ~JOIN_CACHE() {} + virtual ~JOIN_CACHE() = default; void reset_join(JOIN *j) { join= j; } void free() { @@ -1075,7 +1075,7 @@ class JOIN_TAB_SCAN: public Sql_alloc cache= join_tab->cache; } - virtual ~JOIN_TAB_SCAN() {} + virtual ~JOIN_TAB_SCAN() = default; /* Shall calculate the increment of the auxiliary buffer for a record diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index b5f8cf4a8860d..807fcd3ba1281 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2019, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB Corporation. + Copyright (c) 2009, 2022, 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 @@ -37,6 +37,9 @@ #include "sql_partition.h" #include "sql_partition_admin.h" // Sql_cmd_alter_table_*_part #include "event_parse_data.h" +#ifdef WITH_WSREP +#include "mysql/service_wsrep.h" +#endif void LEX::parse_error(uint err_number) { @@ -615,6 +618,13 @@ Query_tables_list::binlog_stmt_unsafe_errcode[BINLOG_STMT_UNSAFE_COUNT] = ER_BINLOG_UNSAFE_UPDATE_IGNORE, ER_BINLOG_UNSAFE_INSERT_TWO_KEYS, ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST, + /* + There is no need to add new error code as we plan to get rid of auto + increment lock mode variable, so we use existing error code below, add + the correspondent text to the existing error message during merging to + non-GA release. + */ + ER_BINLOG_UNSAFE_SYSTEM_VARIABLE, ER_BINLOG_UNSAFE_SKIP_LOCKED }; @@ -738,7 +748,6 @@ init_lex_with_single_table(THD *thd, TABLE *table, LEX *lex) return TRUE; context->resolve_in_table_list_only(table_list); lex->use_only_table_context= TRUE; - lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VCOL_EXPR; select_lex->cur_pos_in_select_list= UNDEF_POS; table->map= 1; //To ensure correct calculation of const item table_list->table= table; @@ -877,7 +886,7 @@ void Lex_input_stream::body_utf8_start(THD *thd, const char *begin_ptr) } -size_t Lex_input_stream::get_body_utf8_maximum_length(THD *thd) +size_t Lex_input_stream::get_body_utf8_maximum_length(THD *thd) const { /* String literals can grow during escaping: @@ -1231,6 +1240,7 @@ void LEX::start(THD *thd_arg) context_stack.empty(); //empty select_stack select_stack_top= 0; + select_stack_outer_barrier= 0; unit.init_query(); current_select_number= 0; curr_with_clause= 0; @@ -1307,14 +1317,14 @@ void LEX::start(THD *thd_arg) stmt_var_list.empty(); proc_list.elements=0; - save_group_list.empty(); - save_order_list.empty(); win_ref= NULL; win_frame= NULL; frame_top_bound= NULL; frame_bottom_bound= NULL; win_spec= NULL; + upd_del_where= NULL; + vers_conditions.empty(); period_conditions.empty(); @@ -1381,7 +1391,7 @@ Yacc_state::~Yacc_state() } int Lex_input_stream::find_keyword(Lex_ident_cli_st *kwd, - uint len, bool function) + uint len, bool function) const { const char *tok= m_tok_start; @@ -2804,7 +2814,6 @@ int Lex_input_stream::scan_ident_delimited(THD *thd, uchar quote_char) { CHARSET_INFO *const cs= thd->charset(); - uint double_quotes= 0; uchar c; DBUG_ASSERT(m_ptr == m_tok_start + 1); @@ -2829,7 +2838,6 @@ int Lex_input_stream::scan_ident_delimited(THD *thd, if (yyPeek() != quote_char) break; c= yyGet(); - double_quotes++; continue; } } @@ -2943,6 +2951,7 @@ void st_select_lex::init_query() min_max_opt_list.empty(); limit_params.clear(); join= 0; + cur_pos_in_select_list= UNDEF_POS; having= prep_having= where= prep_where= 0; cond_pushed_into_where= cond_pushed_into_having= 0; attach_to_conds.empty(); @@ -2993,6 +3002,8 @@ void st_select_lex::init_query() prep_leaf_list_state= UNINIT; bzero((char*) expr_cache_may_be_used, sizeof(expr_cache_may_be_used)); select_list_tables= 0; + rownum_in_field_list= 0; + window_specs.empty(); window_funcs.empty(); tvc= 0; @@ -3047,6 +3058,7 @@ void st_select_lex::init_select() in_funcs.empty(); curr_tvc_name= 0; versioned_tables= 0; + is_tvc_wrapper= false; nest_flags= 0; } @@ -3066,23 +3078,9 @@ void st_select_lex_node::include_down(st_select_lex_node *upper) } -void st_select_lex_node::add_slave(st_select_lex_node *slave_arg) +void st_select_lex_node::attach_single(st_select_lex_node *slave_arg) { - for (; slave; slave= slave->next) - if (slave == slave_arg) - return; - - if (slave) - { - st_select_lex_node *slave_arg_slave= slave_arg->slave; - /* Insert in the front of list of slaves if any. */ - slave_arg->include_neighbour(slave); - /* include_neighbour() sets slave_arg->slave=0, restore it. */ - slave_arg->slave= slave_arg_slave; - /* Count on include_neighbour() setting the master. */ - DBUG_ASSERT(slave_arg->master == this); - } - else + DBUG_ASSERT(slave == 0); { slave= slave_arg; slave_arg->master= this; @@ -3179,6 +3177,7 @@ void st_select_lex_node::fast_exclude() for (; slave; slave= slave->next) slave->fast_exclude(); + prev= NULL; // to ensure correct behavior of st_select_lex_unit::is_excluded() } @@ -3253,9 +3252,7 @@ void st_select_lex_node::exclude_from_tree() */ void st_select_lex_node::exclude() { - /* exclude from global list */ - fast_exclude(); - /* exclude from other structures */ + /* exclude the node from the tree */ exclude_from_tree(); /* We do not need following statements, because prev pointer of first @@ -3263,6 +3260,8 @@ void st_select_lex_node::exclude() if (master->slave == this) master->slave= next; */ + /* exclude all nodes under this excluded node */ + fast_exclude(); } @@ -3984,57 +3983,54 @@ LEX::LEX() } +bool LEX::can_be_merged() +{ + return unit.can_be_merged(); +} + + /* - Check whether the merging algorithm can be used on this VIEW + Check whether the merging algorithm can be used for this unit SYNOPSIS - LEX::can_be_merged() + st_select_lex_unit::can_be_merged() DESCRIPTION - We can apply merge algorithm if it is single SELECT view with - subqueries only in WHERE clause (we do not count SELECTs of underlying - views, and second level subqueries) and we have not grpouping, ordering, - HAVING clause, aggregate functions, DISTINCT clause, LIMIT clause and - several underlying tables. + We can apply merge algorithm for a unit if it is single SELECT with + subqueries only in WHERE clauses or in ON conditions or in select list + (we do not count SELECTs of underlying views/derived tables/CTEs and + second level subqueries) and we have no grouping, ordering, HAVING + clause, aggregate functions, DISTINCT clause, LIMIT clause. RETURN FALSE - only temporary table algorithm can be used TRUE - merge algorithm can be used */ -bool LEX::can_be_merged() +bool st_select_lex_unit::can_be_merged() { // TODO: do not forget implement case when select_lex.table_list.elements==0 /* find non VIEW subqueries/unions */ - bool selects_allow_merge= (first_select_lex()->next_select() == 0 && - !(first_select_lex()->uncacheable & - UNCACHEABLE_RAND)); - if (selects_allow_merge) - { - for (SELECT_LEX_UNIT *tmp_unit= first_select_lex()->first_inner_unit(); - tmp_unit; - tmp_unit= tmp_unit->next_unit()) - { - if (tmp_unit->first_select()->parent_lex == this && - (tmp_unit->item != 0 && - (tmp_unit->item->place() != IN_WHERE && - tmp_unit->item->place() != IN_ON && - tmp_unit->item->place() != SELECT_LIST))) - { - selects_allow_merge= 0; - break; - } - } - } - - return (selects_allow_merge && - first_select_lex()->group_list.elements == 0 && - first_select_lex()->having == 0 && - first_select_lex()->with_sum_func == 0 && - first_select_lex()->table_list.elements >= 1 && - !(first_select_lex()->options & SELECT_DISTINCT) && - first_select_lex()->limit_params.select_limit == 0); + st_select_lex *fs= first_select(); + + if (fs->next_select() || + (fs->uncacheable & UNCACHEABLE_RAND) || + (fs->options & SELECT_DISTINCT) || + fs->group_list.elements || fs->having || + fs->with_sum_func || + fs->table_list.elements < 1 || + fs->limit_params.select_limit) + return false; + for (SELECT_LEX_UNIT *tmp_unit= fs->first_inner_unit(); + tmp_unit; + tmp_unit= tmp_unit->next_unit()) + if ((tmp_unit->item != 0 && + (tmp_unit->item->place() != IN_WHERE && + tmp_unit->item->place() != IN_ON && + tmp_unit->item->place() != SELECT_LIST))) + return false; + return true; } @@ -4094,7 +4090,7 @@ bool LEX::can_use_merged() TRUE - VIEWs with MERGE algorithms can be used */ -bool LEX::can_not_use_merged(bool no_update_or_delete) +bool LEX::can_not_use_merged() { switch (sql_command) { case SQLCOM_CREATE_VIEW: @@ -4107,12 +4103,6 @@ bool LEX::can_not_use_merged(bool no_update_or_delete) case SQLCOM_SHOW_FIELDS: return TRUE; - case SQLCOM_UPDATE_MULTI: - case SQLCOM_DELETE_MULTI: - if (no_update_or_delete) - return TRUE; - /* Fall through */ - default: return FALSE; } @@ -4965,7 +4955,21 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only) } if (empty_union_result) subquery_predicate->no_rows_in_result(); - if (!is_correlated_unit) + + if (is_correlated_unit) + { + /* + Some parts of UNION are not correlated. This means we will need to + re-execute the whole UNION every time. Mark all parts of the UNION + as correlated so that they are prepared to be executed multiple + times (if we don't do that, some part of the UNION may free its + execution data at the end of first execution and crash on the second + execution) + */ + for (SELECT_LEX *sl= un->first_select(); sl; sl= sl->next_select()) + sl->uncacheable |= UNCACHEABLE_DEPENDENT; + } + else un->uncacheable&= ~UNCACHEABLE_DEPENDENT; subquery_predicate->is_correlated= is_correlated_unit; } @@ -5301,17 +5305,21 @@ void SELECT_LEX::update_used_tables() while ((tl= ti++)) { TABLE_LIST *embedding= tl; - do + if (!is_eliminated_table(join->eliminated_tables, tl)) { - bool maybe_null; - if ((maybe_null= MY_TEST(embedding->outer_join))) + do { - tl->table->maybe_null= maybe_null; - break; + bool maybe_null; + if ((maybe_null= MY_TEST(embedding->outer_join))) + { + tl->table->maybe_null= maybe_null; + break; + } } + while ((embedding= embedding->embedding)); } - while ((embedding= embedding->embedding)); - if (tl->on_expr) + + if (tl->on_expr && !is_eliminated_table(join->eliminated_tables, tl)) { tl->on_expr->update_used_tables(); tl->on_expr->walk(&Item::eval_not_null_tables, 0, NULL); @@ -5338,8 +5346,11 @@ void SELECT_LEX::update_used_tables() if (embedding->on_expr && embedding->nested_join->join_list.head() == tl) { - embedding->on_expr->update_used_tables(); - embedding->on_expr->walk(&Item::eval_not_null_tables, 0, NULL); + if (!is_eliminated_table(join->eliminated_tables, embedding)) + { + embedding->on_expr->update_used_tables(); + embedding->on_expr->walk(&Item::eval_not_null_tables, 0, NULL); + } } tl= embedding; embedding= tl->embedding; @@ -5902,18 +5913,19 @@ void LEX::free_arena_for_set_stmt() DBUG_VOID_RETURN; } -void LEX::restore_set_statement_var() +bool LEX::restore_set_statement_var() { + bool err= false; DBUG_ENTER("LEX::restore_set_statement_var"); if (!old_var_list.is_empty()) { DBUG_PRINT("info", ("vars: %d", old_var_list.elements)); - sql_set_variables(thd, &old_var_list, false); + err= sql_set_variables(thd, &old_var_list, false); old_var_list.empty(); free_arena_for_set_stmt(); } DBUG_ASSERT(!is_arena_for_set_stmt()); - DBUG_VOID_RETURN; + DBUG_RETURN(err); } unit_common_op st_select_lex_unit::common_op() @@ -7130,6 +7142,27 @@ bool LEX::sp_declare_cursor(THD *thd, const LEX_CSTRING *name, uint offp; sp_instr_cpush *i; + /* In some cases param_ctx can be NULL. e.g.: FOR rec IN (SELECT...) */ + if (param_ctx) + { + for (uint prm= 0; prm < param_ctx->context_var_count(); prm++) + { + const sp_variable *param= param_ctx->get_context_variable(prm); + if (param->mode != sp_variable::MODE_IN) + { + /* + PL/SQL supports the IN keyword in cursor parameters. + We also support this for compatibility. Note, OUT/INOUT parameters + will unlikely be ever supported. So "YET" may sound confusing here. + But it should be better than using a generic error. Adding a dedicated + error message for this small issue is not desirable. + */ + my_error(ER_NOT_SUPPORTED_YET, MYF(0), "OUT/INOUT cursor parameter"); + return true; + } + } + } + if (spcont->find_cursor(name, &offp, true)) { my_error(ER_SP_DUP_CURS, MYF(0), name->str); @@ -7771,7 +7804,7 @@ bool LEX::maybe_start_compound_statement(THD *thd) if (!make_sp_head(thd, NULL, &sp_handler_procedure, DEFAULT_AGGREGATE)) return true; sphead->set_suid(SP_IS_NOT_SUID); - sphead->set_body_start(thd, thd->m_parser_state->m_lip.get_cpp_ptr()); + sphead->set_body_start(thd, thd->m_parser_state->m_lip.get_cpp_tok_start()); } return false; } @@ -9226,6 +9259,43 @@ bool LEX::call_statement_start(THD *thd, const Lex_ident_sys_st *name1, } +bool LEX::call_statement_start(THD *thd, + const Lex_ident_sys_st *db, + const Lex_ident_sys_st *pkg, + const Lex_ident_sys_st *proc) +{ + Database_qualified_name q_db_pkg(db, pkg); + Database_qualified_name q_pkg_proc(pkg, proc); + sp_name *spname; + + sql_command= SQLCOM_CALL; + + if (check_db_name(reinterpret_cast + (const_cast + (static_cast(db))))) + { + my_error(ER_WRONG_DB_NAME, MYF(0), db->str); + return true; + } + if (check_routine_name(pkg) || + check_routine_name(proc)) + return true; + + // Concat `pkg` and `name` to `pkg.name` + LEX_CSTRING pkg_dot_proc; + if (q_pkg_proc.make_qname(thd->mem_root, &pkg_dot_proc) || + check_ident_length(&pkg_dot_proc) || + !(spname= new (thd->mem_root) sp_name(db, &pkg_dot_proc, true))) + return true; + + sp_handler_package_function.add_used_routine(thd->lex, thd, spname); + sp_handler_package_body.add_used_routine(thd->lex, thd, &q_db_pkg); + + return !(m_sql_cmd= new (thd->mem_root) Sql_cmd_call(spname, + &sp_handler_package_procedure)); +} + + sp_package *LEX::get_sp_package() const { return sphead ? sphead->get_package() : NULL; @@ -9333,22 +9403,6 @@ bool LEX::add_grant_command(THD *thd, const List &columns) } -Item *LEX::make_item_func_substr(THD *thd, Item *a, Item *b, Item *c) -{ - return (thd->variables.sql_mode & MODE_ORACLE) ? - new (thd->mem_root) Item_func_substr_oracle(thd, a, b, c) : - new (thd->mem_root) Item_func_substr(thd, a, b, c); -} - - -Item *LEX::make_item_func_substr(THD *thd, Item *a, Item *b) -{ - return (thd->variables.sql_mode & MODE_ORACLE) ? - new (thd->mem_root) Item_func_substr_oracle(thd, a, b) : - new (thd->mem_root) Item_func_substr(thd, a, b); -} - - Item *LEX::make_item_func_sysdate(THD *thd, uint fsp) { /* @@ -9369,17 +9423,6 @@ Item *LEX::make_item_func_sysdate(THD *thd, uint fsp) } -Item *LEX::make_item_func_replace(THD *thd, - Item *org, - Item *find, - Item *replace) -{ - return (thd->variables.sql_mode & MODE_ORACLE) ? - new (thd->mem_root) Item_func_replace_oracle(thd, org, find, replace) : - new (thd->mem_root) Item_func_replace(thd, org, find, replace); -} - - bool SELECT_LEX::vers_push_field(THD *thd, TABLE_LIST *table, const LEX_CSTRING field_name) { @@ -9500,6 +9543,56 @@ Item *LEX::make_item_func_call_generic(THD *thd, Lex_ident_cli_st *cdb, } +/* + Create a 3-step qualified function call. + Currently it's possible for package routines only, e.g.: + SELECT db.pkg.func(); +*/ +Item *LEX::make_item_func_call_generic(THD *thd, + Lex_ident_cli_st *cdb, + Lex_ident_cli_st *cpkg, + Lex_ident_cli_st *cfunc, + List *args) +{ + static Lex_cstring dot(".", 1); + Lex_ident_sys db(thd, cdb), pkg(thd, cpkg), func(thd, cfunc); + Database_qualified_name q_db_pkg(db, pkg); + Database_qualified_name q_pkg_func(pkg, func); + sp_name *qname; + + if (db.is_null() || pkg.is_null() || func.is_null()) + return NULL; // EOM + + if (check_db_name((LEX_STRING*) static_cast(&db))) + { + my_error(ER_WRONG_DB_NAME, MYF(0), db.str); + return NULL; + } + if (check_routine_name(&pkg) || + check_routine_name(&func)) + return NULL; + + // Concat `pkg` and `name` to `pkg.name` + LEX_CSTRING pkg_dot_func; + if (q_pkg_func.make_qname(thd->mem_root, &pkg_dot_func) || + check_ident_length(&pkg_dot_func) || + !(qname= new (thd->mem_root) sp_name(&db, &pkg_dot_func, true))) + return NULL; + + sp_handler_package_function.add_used_routine(thd->lex, thd, qname); + sp_handler_package_body.add_used_routine(thd->lex, thd, &q_db_pkg); + + thd->lex->safe_to_cache_query= 0; + + if (args && args->elements > 0) + return new (thd->mem_root) Item_func_sp(thd, thd->lex->current_context(), + qname, &sp_handler_package_function, + *args); + return new (thd->mem_root) Item_func_sp(thd, thd->lex->current_context(), + qname, &sp_handler_package_function); +} + + Item *LEX::make_item_func_call_native_or_parse_error(THD *thd, Lex_ident_cli_st &name, List *args) @@ -9522,7 +9615,8 @@ Item *LEX::create_item_qualified_asterisk(THD *thd, null_clex_str, *name, star_clex_str))) return NULL; - current_select->with_wild++; + current_select->parsing_place == IN_RETURNING ? + thd->lex->returning()->with_wild++ : current_select->with_wild++; return item; } @@ -9537,7 +9631,8 @@ Item *LEX::create_item_qualified_asterisk(THD *thd, if (!(item= new (thd->mem_root) Item_field(thd, current_context(), schema, *b, star_clex_str))) return NULL; - current_select->with_wild++; + current_select->parsing_place == IN_RETURNING ? + thd->lex->returning()->with_wild++ : current_select->with_wild++; return item; } @@ -9626,6 +9721,7 @@ bool Lex_ident_sys_st::to_size_number(ulonglong *to) const } +#ifdef WITH_PARTITION_STORAGE_ENGINE bool LEX::part_values_current(THD *thd) { partition_element *elem= part_info->curr_part_elem; @@ -9633,7 +9729,7 @@ bool LEX::part_values_current(THD *thd) { if (unlikely(part_info->part_type != VERSIONING_PARTITION)) { - my_error(ER_PARTITION_WRONG_TYPE, MYF(0), "SYSTEM_TIME"); + part_type_error(thd, NULL, "SYSTEM_TIME", part_info); return true; } } @@ -9660,7 +9756,7 @@ bool LEX::part_values_history(THD *thd) { if (unlikely(part_info->part_type != VERSIONING_PARTITION)) { - my_error(ER_PARTITION_WRONG_TYPE, MYF(0), "SYSTEM_TIME"); + part_type_error(thd, NULL, "SYSTEM_TIME", part_info); return true; } } @@ -9681,6 +9777,7 @@ bool LEX::part_values_history(THD *thd) elem->type= partition_element::HISTORY; return false; } +#endif /* WITH_PARTITION_STORAGE_ENGINE */ bool LEX::last_field_generated_always_as_row_start_or_end(Lex_ident *p, @@ -10378,11 +10475,13 @@ void LEX::relink_hack(st_select_lex *select_lex) { if (!select_stack_top) // Statements of the second type { - if (!select_lex->get_master()->get_master()) - ((st_select_lex *) select_lex->get_master())-> - set_master(&builtin_select); - if (!builtin_select.get_slave()) - builtin_select.set_slave(select_lex->get_master()); + if (!select_lex->outer_select() && + !builtin_select.first_inner_unit()) + { + builtin_select.register_unit(select_lex->master_unit(), + &builtin_select.context); + builtin_select.add_statistics(select_lex->master_unit()); + } } } @@ -10743,9 +10842,8 @@ st_select_lex::build_pushable_cond_for_having_pushdown(THD *thd, Item *cond) */ if (cond->get_extraction_flag() == MARKER_FULL_EXTRACTION) { - Item *result= cond->transform(thd, - &Item::multiple_equality_transformer, - (uchar *)this); + Item *result= cond->top_level_transform(thd, + &Item::multiple_equality_transformer, (uchar *)this); if (!result) return true; if (result->type() == Item::COND_ITEM && @@ -11762,3 +11860,9 @@ bool SELECT_LEX_UNIT::explainable() const derived->is_materialized_derived() : // (3) false; } + + +bool st_select_lex::is_query_topmost(THD *thd) +{ + return get_master() == &thd->lex->unit; +} diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 14cf90caa0486..c9a1f8678d819 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2019, Oracle and/or its affiliates. - Copyright (c) 2010, 2021, MariaDB Corporation + Copyright (c) 2010, 2022, 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 @@ -36,6 +36,7 @@ #include "sql_limit.h" // Select_limit_counters #include "json_table.h" // Json_table_column #include "sql_schema.h" +#include "table.h" /* Used for flags of nesting constructs */ #define SELECT_NESTING_MAP_SIZE 64 @@ -765,9 +766,8 @@ class st_select_lex_node { } inline st_select_lex_node* get_master() { return master; } - inline st_select_lex_node* get_slave() { return slave; } void include_down(st_select_lex_node *upper); - void add_slave(st_select_lex_node *slave_arg); + void attach_single(st_select_lex_node *slave_arg); void include_neighbour(st_select_lex_node *before); void link_chain_down(st_select_lex_node *first); void link_neighbour(st_select_lex_node *neighbour) @@ -1038,6 +1038,8 @@ class st_select_lex_unit: public st_select_lex_node { bool set_lock_to_the_last_select(Lex_select_lock l); + bool can_be_merged(); + friend class st_select_lex; }; @@ -1199,12 +1201,14 @@ class st_select_lex: public st_select_lex_node group_list_ptrs, and re-establish the original list before each execution. */ SQL_I_List group_list; + SQL_I_List save_group_list; Group_list_ptrs *group_list_ptrs; List item_list; /* list of fields & expressions */ List pre_fix; /* above list before fix_fields */ List fix_after_optimize; SQL_I_List order_list; /* ORDER clause */ + SQL_I_List save_order_list; SQL_I_List gorder_list; Lex_select_limit limit_params; /* LIMIT clause parameters */ @@ -1293,6 +1297,8 @@ class st_select_lex: public st_select_lex_node st_select_lex. */ uint curr_tvc_name; + /* true <=> select has been created a TVC wrapper */ + bool is_tvc_wrapper; uint fields_in_window_functions; uint insert_tables; enum_parsing_place parsing_place; /* where we are parsing expression */ @@ -1343,6 +1349,9 @@ class st_select_lex: public st_select_lex_node */ table_map select_list_tables; + /* Set to 1 if any field in field list has ROWNUM() */ + bool rownum_in_field_list; + /* namp of nesting SELECT visibility (for aggregate functions check) */ nesting_map name_visibility_map; table_map with_dep; @@ -1374,6 +1383,7 @@ class st_select_lex: public st_select_lex_node return (st_select_lex_unit*) slave; } st_select_lex* outer_select(); + bool is_query_topmost(THD *thd); st_select_lex* next_select() { return (st_select_lex*) next; } st_select_lex* next_select_in_list() { @@ -1460,6 +1470,10 @@ class st_select_lex: public st_select_lex_node } bool setup_ref_array(THD *thd, uint order_group_num); void print(THD *thd, String *str, enum_query_type query_type); + void print_item_list(THD *thd, String *str, enum_query_type query_type); + void print_set_clause(THD *thd, String *str, enum_query_type query_type); + void print_on_duplicate_key_clause(THD *thd, String *str, + enum_query_type query_type); static void print_order(String *str, ORDER *order, enum_query_type query_type); @@ -1744,21 +1758,12 @@ class Query_tables_list Sroutine_hash_entry **sroutines_list_own_last; uint sroutines_list_own_elements; - /** - Number of tables which were open by open_tables() and to be locked - by lock_tables(). - Note that we set this member only in some cases, when this value - needs to be passed from open_tables() to lock_tables() which are - separated by some amount of code. - */ - uint table_count; - /* These constructor and destructor serve for creation/destruction of Query_tables_list instances which are used as backup storage. */ - Query_tables_list() {} - ~Query_tables_list() {} + Query_tables_list() = default; + ~Query_tables_list() = default; /* Initializes (or resets) Query_tables_list object for "real" use. */ void reset_query_tables_list(bool init); @@ -1947,6 +1952,11 @@ class Query_tables_list */ BINLOG_STMT_UNSAFE_AUTOINC_NOT_FIRST, + /** + Autoincrement lock mode is incompatible with STATEMENT binlog format. + */ + BINLOG_STMT_UNSAFE_AUTOINC_LOCK_MODE, + /** INSERT .. SELECT ... SKIP LOCKED is unlikely to have the same rows locked on the replica. @@ -2042,8 +2052,7 @@ class Query_tables_list @retval nonzero if the statement is a row injection */ inline bool is_stmt_row_injection() const { - return binlog_stmt_flags & - (1U << (BINLOG_STMT_UNSAFE_COUNT + BINLOG_STMT_TYPE_ROW_INJECTION)); + return binlog_stmt_flags & (1U << BINLOG_STMT_TYPE_ROW_INJECTION); } /** @@ -2053,8 +2062,7 @@ class Query_tables_list */ inline void set_stmt_row_injection() { DBUG_ENTER("set_stmt_row_injection"); - binlog_stmt_flags|= - (1U << (BINLOG_STMT_UNSAFE_COUNT + BINLOG_STMT_TYPE_ROW_INJECTION)); + binlog_stmt_flags|= (1U << BINLOG_STMT_TYPE_ROW_INJECTION); DBUG_VOID_RETURN; } @@ -2330,7 +2338,7 @@ class Query_tables_list The statement is a row injection (i.e., either a BINLOG statement or a row event executed by the slave SQL thread). */ - BINLOG_STMT_TYPE_ROW_INJECTION = 0, + BINLOG_STMT_TYPE_ROW_INJECTION = BINLOG_STMT_UNSAFE_COUNT, /** The last element of this enumeration type. */ BINLOG_STMT_TYPE_COUNT @@ -2344,8 +2352,8 @@ class Query_tables_list - The low BINLOG_STMT_UNSAFE_COUNT bits indicate the types of unsafeness that the current statement has. - - The next BINLOG_STMT_TYPE_COUNT bits indicate if the statement - is of some special type. + - The next BINLOG_STMT_TYPE_COUNT-BINLOG_STMT_TYPE_COUNT bits indicate if + the statement is of some special type. This must be a member of LEX, not of THD: each stored procedure needs to remember its unsafeness state between calls and each @@ -2420,13 +2428,9 @@ class Lex_input_stream const char *str, const char *end, int sep); my_charset_conv_wc_mb get_escape_func(THD *thd, my_wc_t sep) const; public: - Lex_input_stream() - { - } + Lex_input_stream() = default; - ~Lex_input_stream() - { - } + ~Lex_input_stream() = default; /** Object initializer. Must be called before usage. @@ -2502,7 +2506,7 @@ class Lex_input_stream Get the last character accepted. @return the last character accepted. */ - unsigned char yyGetLast() + unsigned char yyGetLast() const { return m_ptr[-1]; } @@ -2510,7 +2514,7 @@ class Lex_input_stream /** Look at the next character to parse, but do not accept it. */ - unsigned char yyPeek() + unsigned char yyPeek() const { return m_ptr[0]; } @@ -2519,7 +2523,7 @@ class Lex_input_stream Look ahead at some character to parse. @param n offset of the character to look up */ - unsigned char yyPeekn(int n) + unsigned char yyPeekn(int n) const { return m_ptr[n]; } @@ -2580,7 +2584,7 @@ class Lex_input_stream @param n number of characters expected @return true if there are less than n characters to parse */ - bool eof(int n) + bool eof(int n) const { return ((m_ptr + n) >= m_end_of_query); } @@ -2611,10 +2615,10 @@ class Lex_input_stream Get the maximum length of the utf8-body buffer. The utf8 body can grow because of the character set conversion and escaping. */ - size_t get_body_utf8_maximum_length(THD *thd); + size_t get_body_utf8_maximum_length(THD *thd) const; /** Get the length of the current token, in the raw buffer. */ - uint yyLength() + uint yyLength() const { /* The assumption is that the lexical analyser is always 1 character ahead, @@ -2639,31 +2643,31 @@ class Lex_input_stream End of file indicator for the query text to parse. @return true if there are no more characters to parse */ - bool eof() + bool eof() const { return (m_ptr >= m_end_of_query); } /** Get the raw query buffer. */ - const char *get_buf() + const char *get_buf() const { return m_buf; } /** Get the pre-processed query buffer. */ - const char *get_cpp_buf() + const char *get_cpp_buf() const { return m_cpp_buf; } /** Get the end of the raw query buffer. */ - const char *get_end_of_query() + const char *get_end_of_query() const { return m_end_of_query; } /** Get the token start position, in the raw buffer. */ - const char *get_tok_start() + const char *get_tok_start() const { return has_lookahead() ? m_tok_start_prev : m_tok_start; } @@ -2674,25 +2678,25 @@ class Lex_input_stream } /** Get the token end position, in the raw buffer. */ - const char *get_tok_end() + const char *get_tok_end() const { return m_tok_end; } /** Get the current stream pointer, in the raw buffer. */ - const char *get_ptr() + const char *get_ptr() const { return m_ptr; } /** Get the token start position, in the pre-processed buffer. */ - const char *get_cpp_tok_start() + const char *get_cpp_tok_start() const { return has_lookahead() ? m_cpp_tok_start_prev : m_cpp_tok_start; } /** Get the token end position, in the pre-processed buffer. */ - const char *get_cpp_tok_end() + const char *get_cpp_tok_end() const { return m_cpp_tok_end; } @@ -2701,7 +2705,7 @@ class Lex_input_stream Get the token end position in the pre-processed buffer, with trailing spaces removed. */ - const char *get_cpp_tok_end_rtrim() + const char *get_cpp_tok_end_rtrim() const { const char *p; for (p= m_cpp_tok_end; @@ -2712,7 +2716,7 @@ class Lex_input_stream } /** Get the current stream pointer, in the pre-processed buffer. */ - const char *get_cpp_ptr() + const char *get_cpp_ptr() const { return m_cpp_ptr; } @@ -2721,7 +2725,7 @@ class Lex_input_stream Get the current stream pointer, in the pre-processed buffer, with traling spaces removed. */ - const char *get_cpp_ptr_rtrim() + const char *get_cpp_ptr_rtrim() const { const char *p; for (p= m_cpp_ptr; @@ -2731,13 +2735,13 @@ class Lex_input_stream return p; } /** Get the utf8-body string. */ - const char *get_body_utf8_str() + const char *get_body_utf8_str() const { return m_body_utf8; } /** Get the utf8-body length. */ - size_t get_body_utf8_length() + size_t get_body_utf8_length() const { return (size_t) (m_body_utf8_ptr - m_body_utf8); } @@ -2773,7 +2777,7 @@ class Lex_input_stream bool consume_comment(int remaining_recursions_permitted); int lex_one_token(union YYSTYPE *yylval, THD *thd); - int find_keyword(Lex_ident_cli_st *str, uint len, bool function); + int find_keyword(Lex_ident_cli_st *str, uint len, bool function) const; LEX_CSTRING get_token(uint skip, uint length); int scan_ident_sysvar(THD *thd, Lex_ident_cli_st *str); int scan_ident_start(THD *thd, Lex_ident_cli_st *str); @@ -3009,7 +3013,7 @@ class Update_plan protected: bool save_explain_data_intern(MEM_ROOT *mem_root, Explain_update *eu, bool is_analyze); public: - virtual ~Update_plan() {} + virtual ~Update_plan() = default; Update_plan(MEM_ROOT *mem_root_arg) : impossible_where(false), no_partitions(false), @@ -3063,7 +3067,7 @@ enum password_exp_type struct Account_options: public USER_RESOURCES { - Account_options() { } + Account_options() = default; void reset() { @@ -3306,6 +3310,12 @@ struct LEX: public Query_tables_list List context_stack; SELECT_LEX *select_stack[MAX_SELECT_NESTING + 1]; uint select_stack_top; + /* + Usually this is set to 0, but for INSERT/REPLACE SELECT it is set to 1. + When parsing such statements the pointer to the most outer select is placed + into the second element of select_stack rather than into the first. + */ + uint select_stack_outer_barrier; SQL_I_List proc_list; SQL_I_List auxiliary_table_list, save_list; @@ -3440,7 +3450,7 @@ struct LEX: public Query_tables_list stores total number of tables. For LEX representing multi-delete holds number of tables from which we will delete records. */ - uint table_count; + uint table_count_update; uint8 describe; /* @@ -3553,14 +3563,14 @@ struct LEX: public Query_tables_list } - SQL_I_List save_group_list; - SQL_I_List save_order_list; LEX_CSTRING *win_ref; Window_frame *win_frame; Window_frame_bound *frame_top_bound; Window_frame_bound *frame_bottom_bound; Window_spec *win_spec; + Item *upd_del_where; + /* System Versioning */ vers_select_conds_t vers_conditions; vers_select_conds_t period_conditions; @@ -3642,7 +3652,7 @@ struct LEX: public Query_tables_list bool can_be_merged(); bool can_use_merged(); - bool can_not_use_merged(bool no_update_or_delete); + bool can_not_use_merged(); bool only_view_structure(); bool need_correct_ident(); uint8 get_effective_with_check(TABLE_LIST *view); @@ -3749,6 +3759,17 @@ struct LEX: public Query_tables_list bool copy_db_to(LEX_CSTRING *to); + void inc_select_stack_outer_barrier() + { + select_stack_outer_barrier++; + } + + SELECT_LEX *parser_current_outer_select() + { + return select_stack_top - 1 == select_stack_outer_barrier ? + 0 : select_stack[select_stack_top - 2]; + } + Name_resolution_context *current_context() { return context_stack.head(); @@ -3765,8 +3786,10 @@ struct LEX: public Query_tables_list bool table_or_sp_used(); bool is_partition_management() const; +#ifdef WITH_PARTITION_STORAGE_ENGINE bool part_values_current(THD *thd); bool part_values_history(THD *thd); +#endif /** @brief check if the statement is a single-level join @@ -3793,7 +3816,7 @@ struct LEX: public Query_tables_list int print_explain(select_result_sink *output, uint8 explain_flags, bool is_analyze, bool *printed_anything); - void restore_set_statement_var(); + bool restore_set_statement_var(); void init_last_field(Column_definition *field, const LEX_CSTRING *name, const CHARSET_INFO *cs); @@ -3861,6 +3884,10 @@ struct LEX: public Query_tables_list bool call_statement_start(THD *thd, const Lex_ident_sys_st *name); bool call_statement_start(THD *thd, const Lex_ident_sys_st *name1, const Lex_ident_sys_st *name2); + bool call_statement_start(THD *thd, + const Lex_ident_sys_st *db, + const Lex_ident_sys_st *pkg, + const Lex_ident_sys_st *proc); sp_variable *find_variable(const LEX_CSTRING *name, sp_pcontext **ctx, const Sp_rcontext_handler **rh) const; @@ -4099,12 +4126,14 @@ struct LEX: public Query_tables_list Item *create_item_query_expression(THD *thd, st_select_lex_unit *unit); - Item *make_item_func_replace(THD *thd, Item *org, Item *find, Item *replace); - Item *make_item_func_substr(THD *thd, Item *a, Item *b, Item *c); - Item *make_item_func_substr(THD *thd, Item *a, Item *b); Item *make_item_func_sysdate(THD *thd, uint fsp); Item *make_item_func_call_generic(THD *thd, Lex_ident_cli_st *db, Lex_ident_cli_st *name, List *args); + Item *make_item_func_call_generic(THD *thd, + Lex_ident_cli_st *db, + Lex_ident_cli_st *pkg, + Lex_ident_cli_st *name, + List *args); Item *make_item_func_call_native_or_parse_error(THD *thd, Lex_ident_cli_st &name, List *args); @@ -4372,7 +4401,7 @@ struct LEX: public Query_tables_list bool if_not_exists) { constr->name= name; - constr->flags= if_not_exists ? VCOL_CHECK_CONSTRAINT_IF_NOT_EXISTS : 0; + constr->if_not_exists= if_not_exists; alter_info.check_constraint_list.push_back(constr); return false; } @@ -4518,8 +4547,36 @@ struct LEX: public Query_tables_list return create_info.vers_info; } + /* The list of history-generating DML commands */ + bool vers_history_generating() const + { + switch (sql_command) + { + case SQLCOM_DELETE: + return !vers_conditions.delete_history; + case SQLCOM_UPDATE: + case SQLCOM_UPDATE_MULTI: + case SQLCOM_DELETE_MULTI: + case SQLCOM_REPLACE: + case SQLCOM_REPLACE_SELECT: + return true; + case SQLCOM_INSERT: + case SQLCOM_INSERT_SELECT: + return duplicates == DUP_UPDATE; + case SQLCOM_LOAD: + return duplicates == DUP_REPLACE; + default: + return false; + } + } + int add_period(Lex_ident name, Lex_ident_sys_st start, Lex_ident_sys_st end) { + if (check_period_name(name.str)) { + my_error(ER_WRONG_COLUMN_NAME, MYF(0), name.str); + return 1; + } + if (lex_string_cmp(system_charset_info, &start, &end) == 0) { my_error(ER_FIELD_SPECIFIED_TWICE, MYF(0), start.str); @@ -4748,8 +4805,8 @@ struct LEX: public Query_tables_list const LEX_CSTRING *constraint_name, Table_ident *ref_table_name, DDL_options ddl_options); + bool check_dependencies_in_with_clauses(); - bool resolve_references_to_cte_in_hanging_cte(); bool check_cte_dependencies_and_resolve_references(); bool resolve_references_to_cte(TABLE_LIST *tables, TABLE_LIST **tables_last); @@ -4779,14 +4836,13 @@ class Set_signal_information { public: /** Empty default constructor, use clear() */ - Set_signal_information() {} + Set_signal_information() = default; /** Copy constructor. */ Set_signal_information(const Set_signal_information& set); /** Destructor. */ - ~Set_signal_information() - {} + ~Set_signal_information() = default; /** Clear all items. */ void clear(); @@ -4909,8 +4965,7 @@ class Parser_state return m_lip.init(thd, buff, length); } - ~Parser_state() - {} + ~Parser_state() = default; Lex_input_stream m_lip; Yacc_state m_yacc; diff --git a/sql/sql_lifo_buffer.h b/sql/sql_lifo_buffer.h index 0347030e4c6ca..2d6482718988e 100644 --- a/sql/sql_lifo_buffer.h +++ b/sql/sql_lifo_buffer.h @@ -138,7 +138,7 @@ class Lifo_buffer virtual void remove_unused_space(uchar **unused_start, uchar **unused_end)=0; virtual uchar *used_area() = 0; - virtual ~Lifo_buffer() {}; + virtual ~Lifo_buffer() = default; }; diff --git a/sql/sql_list.h b/sql/sql_list.h index 91134bcbeb2ba..a9ab5415d5a94 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -54,7 +54,7 @@ class SQL_I_List :public Sql_alloc { elements= tmp.elements; first= tmp.first; - next= tmp.next; + next= elements ? tmp.next : &first;; return *this; } @@ -119,8 +119,8 @@ struct list_node :public Sql_alloc { list_node *next; void *info; - list_node(void *info_par,list_node *next_par) - :next(next_par),info(info_par) + list_node(const void *info_par, list_node *next_par) + :next(next_par), info(const_cast(info_par)) {} list_node() /* For end_of_list */ { @@ -385,7 +385,7 @@ class base_list :public Sql_alloc #endif // LIST_EXTRA_DEBUG protected: - void after(void *info,list_node *node) + void after(const void *info, list_node *node) { list_node *new_node=new list_node(info,node->next); node->next=new_node; @@ -446,11 +446,11 @@ class base_list_iterator { el= &list->first; } - inline void *replace(void *element) + inline void *replace(const void *element) { // Return old element void *tmp=current->info; DBUG_ASSERT(current->info != 0); - current->info=element; + current->info= const_cast(element); return tmp; } void *replace(base_list &new_list) @@ -473,7 +473,7 @@ class base_list_iterator el=prev; current=0; // Safeguard } - void after(void *element) // Insert element after current + void after(const void *element) // Insert element after current { list->after(element,current); current=current->next; diff --git a/sql/sql_locale.cc b/sql/sql_locale.cc index 45f81da80c963..60e7abc3fa23f 100644 --- a/sql/sql_locale.cc +++ b/sql/sql_locale.cc @@ -29,7 +29,7 @@ enum err_msgs_index { - en_US= 0, cs_CZ, da_DK, nl_NL, et_EE, fr_FR, de_DE, el_GR, hu_HU, it_IT, + en_US= 0, zh_CN, cs_CZ, da_DK, nl_NL, et_EE, fr_FR, de_DE, el_GR, hu_HU, it_IT, ja_JP, ko_KR, no_NO, nn_NO, pl_PL, pt_PT, ro_RO, ru_RU, sr_RS, sk_SK, es_ES, sv_SE, uk_UA, hi_IN } ERR_MSGS_INDEX; @@ -38,6 +38,7 @@ enum err_msgs_index MY_LOCALE_ERRMSGS global_errmsgs[]= { {"english", NULL}, + {"chinese", NULL}, {"czech", NULL}, {"danish", NULL}, {"dutch", NULL}, @@ -563,8 +564,8 @@ MY_LOCALE my_locale_es_ES 10, 9, ',', /* decimal point es_ES */ - '\0', /* thousands_sep es_ES */ - "\x80\x80", /* grouping es_ES */ + '.', /* thousands_sep es_ES */ + "\x03\x03", /* grouping es_ES */ &global_errmsgs[es_ES] ); /***** LOCALE END es_ES *****/ @@ -1919,7 +1920,7 @@ MY_LOCALE my_locale_th_TH ); /***** LOCALE END th_TH *****/ -/***** LOCALE BEGIN tr_TR: Turkish - Turkey *****/ +/***** LOCALE BEGIN tr_TR: Turkish - Türkiye *****/ static const char *my_locale_month_names_tr_TR[13] = {"Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık", NullS }; static const char *my_locale_ab_month_names_tr_TR[13] = @@ -1940,7 +1941,7 @@ MY_LOCALE my_locale_tr_TR ( 52, "tr_TR", - "Turkish - Turkey", + "Turkish - Türkiye", FALSE, &my_locale_typelib_month_names_tr_TR, &my_locale_typelib_ab_month_names_tr_TR, @@ -2095,7 +2096,7 @@ MY_LOCALE my_locale_zh_CN '.', /* decimal point zh_CN */ ',', /* thousands_sep zh_CN */ "\x03", /* grouping zh_CN */ - &global_errmsgs[en_US] + &global_errmsgs[zh_CN] ); /***** LOCALE END zh_CN *****/ @@ -2649,8 +2650,8 @@ MY_LOCALE my_locale_es_BO 10, 9, ',', /* decimal point es_BO */ - '\0', /* thousands_sep es_BO */ - "\x80\x80", /* grouping es_BO */ + '.', /* thousands_sep es_BO */ + "\x03\x03", /* grouping es_BO */ &global_errmsgs[es_ES] ); /***** LOCALE END es_BO *****/ @@ -2669,8 +2670,8 @@ MY_LOCALE my_locale_es_CL 10, 9, ',', /* decimal point es_CL */ - '\0', /* thousands_sep es_CL */ - "\x80\x80", /* grouping es_CL */ + '.', /* thousands_sep es_CL */ + "\x03\x03", /* grouping es_CL */ &global_errmsgs[es_ES] ); /***** LOCALE END es_CL *****/ @@ -2689,8 +2690,8 @@ MY_LOCALE my_locale_es_CO 10, 9, ',', /* decimal point es_CO */ - '\0', /* thousands_sep es_CO */ - "\x80\x80", /* grouping es_CO */ + '.', /* thousands_sep es_CO */ + "\x03\x03", /* grouping es_CO */ &global_errmsgs[es_ES] ); /***** LOCALE END es_CO *****/ @@ -2708,9 +2709,9 @@ MY_LOCALE my_locale_es_CR &my_locale_typelib_ab_day_names_es_ES, 10, 9, - '.', /* decimal point es_CR */ - '\0', /* thousands_sep es_CR */ - "\x80\x80", /* grouping es_CR */ + ',', /* decimal point es_CR */ + ' ', /* thousands_sep es_CR */ + "\x03\x03", /* grouping es_CR */ &global_errmsgs[es_ES] ); /***** LOCALE END es_CR *****/ @@ -2729,8 +2730,8 @@ MY_LOCALE my_locale_es_DO 10, 9, '.', /* decimal point es_DO */ - '\0', /* thousands_sep es_DO */ - "\x80\x80", /* grouping es_DO */ + ',', /* thousands_sep es_DO */ + "\x03\x03", /* grouping es_DO */ &global_errmsgs[es_ES] ); /***** LOCALE END es_DO *****/ @@ -2749,8 +2750,8 @@ MY_LOCALE my_locale_es_EC 10, 9, ',', /* decimal point es_EC */ - '\0', /* thousands_sep es_EC */ - "\x80\x80", /* grouping es_EC */ + '.', /* thousands_sep es_EC */ + "\x03\x03", /* grouping es_EC */ &global_errmsgs[es_ES] ); /***** LOCALE END es_EC *****/ @@ -2769,8 +2770,8 @@ MY_LOCALE my_locale_es_GT 10, 9, '.', /* decimal point es_GT */ - '\0', /* thousands_sep es_GT */ - "\x80\x80", /* grouping es_GT */ + ',', /* thousands_sep es_GT */ + "\x03\x03", /* grouping es_GT */ &global_errmsgs[es_ES] ); /***** LOCALE END es_GT *****/ @@ -2789,8 +2790,8 @@ MY_LOCALE my_locale_es_HN 10, 9, '.', /* decimal point es_HN */ - '\0', /* thousands_sep es_HN */ - "\x80\x80", /* grouping es_HN */ + ',', /* thousands_sep es_HN */ + "\x03\x03", /* grouping es_HN */ &global_errmsgs[es_ES] ); /***** LOCALE END es_HN *****/ @@ -2809,8 +2810,8 @@ MY_LOCALE my_locale_es_MX 10, 9, '.', /* decimal point es_MX */ - '\0', /* thousands_sep es_MX */ - "\x80\x80", /* grouping es_MX */ + ',', /* thousands_sep es_MX */ + "\x03\x03", /* grouping es_MX */ &global_errmsgs[es_ES] ); /***** LOCALE END es_MX *****/ @@ -2829,8 +2830,8 @@ MY_LOCALE my_locale_es_NI 10, 9, '.', /* decimal point es_NI */ - '\0', /* thousands_sep es_NI */ - "\x80\x80", /* grouping es_NI */ + ',', /* thousands_sep es_NI */ + "\x03\x03", /* grouping es_NI */ &global_errmsgs[es_ES] ); /***** LOCALE END es_NI *****/ @@ -2849,8 +2850,8 @@ MY_LOCALE my_locale_es_PA 10, 9, '.', /* decimal point es_PA */ - '\0', /* thousands_sep es_PA */ - "\x80\x80", /* grouping es_PA */ + ',', /* thousands_sep es_PA */ + "\x03\x03", /* grouping es_PA */ &global_errmsgs[es_ES] ); /***** LOCALE END es_PA *****/ @@ -2869,8 +2870,8 @@ MY_LOCALE my_locale_es_PE 10, 9, '.', /* decimal point es_PE */ - '\0', /* thousands_sep es_PE */ - "\x80\x80", /* grouping es_PE */ + ',', /* thousands_sep es_PE */ + "\x03\x03", /* grouping es_PE */ &global_errmsgs[es_ES] ); /***** LOCALE END es_PE *****/ @@ -2889,8 +2890,8 @@ MY_LOCALE my_locale_es_PR 10, 9, '.', /* decimal point es_PR */ - '\0', /* thousands_sep es_PR */ - "\x80\x80", /* grouping es_PR */ + ',', /* thousands_sep es_PR */ + "\x03\x03", /* grouping es_PR */ &global_errmsgs[es_ES] ); /***** LOCALE END es_PR *****/ @@ -2909,8 +2910,8 @@ MY_LOCALE my_locale_es_PY 10, 9, ',', /* decimal point es_PY */ - '\0', /* thousands_sep es_PY */ - "\x80\x80", /* grouping es_PY */ + '.', /* thousands_sep es_PY */ + "\x03\x03", /* grouping es_PY */ &global_errmsgs[es_ES] ); /***** LOCALE END es_PY *****/ @@ -2929,8 +2930,8 @@ MY_LOCALE my_locale_es_SV 10, 9, '.', /* decimal point es_SV */ - '\0', /* thousands_sep es_SV */ - "\x80\x80", /* grouping es_SV */ + ',', /* thousands_sep es_SV */ + "\x03\x03", /* grouping es_SV */ &global_errmsgs[es_ES] ); /***** LOCALE END es_SV *****/ @@ -2969,8 +2970,8 @@ MY_LOCALE my_locale_es_UY 10, 9, ',', /* decimal point es_UY */ - '\0', /* thousands_sep es_UY */ - "\x80\x80", /* grouping es_UY */ + '.', /* thousands_sep es_UY */ + "\x03\x03", /* grouping es_UY */ &global_errmsgs[es_ES] ); /***** LOCALE END es_UY *****/ @@ -2989,8 +2990,8 @@ MY_LOCALE my_locale_es_VE 10, 9, ',', /* decimal point es_VE */ - '\0', /* thousands_sep es_VE */ - "\x80\x80", /* grouping es_VE */ + '.', /* thousands_sep es_VE */ + "\x03\x03", /* grouping es_VE */ &global_errmsgs[es_ES] ); /***** LOCALE END es_VE *****/ diff --git a/sql/sql_manager.cc b/sql/sql_manager.cc index df6847f2ba195..3d3728b9e0053 100644 --- a/sql/sql_manager.cc +++ b/sql/sql_manager.cc @@ -134,6 +134,7 @@ void start_handle_manager() { pthread_t hThread; int err; + DBUG_EXECUTE_IF("delay_start_handle_manager", my_sleep(1000);); manager_thread_in_use = 1; mysql_cond_init(key_COND_manager, &COND_manager,NULL); mysql_mutex_init(key_LOCK_manager, &LOCK_manager, NULL); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 18629f4bd2271..9fe2506bbae7a 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. - Copyright (c) 2008, 2021, MariaDB + Copyright (c) 2008, 2023, 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 @@ -119,7 +119,7 @@ static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, */ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables); -static void sql_kill(THD *thd, longlong id, killed_state state, killed_type type); +static void sql_kill(THD *thd, my_thread_id id, killed_state state, killed_type type); static void sql_kill_user(THD *thd, LEX_USER *user, killed_state state); static bool lock_tables_precheck(THD *thd, TABLE_LIST *tables); static bool execute_show_status(THD *, TABLE_LIST *); @@ -1040,9 +1040,9 @@ int bootstrap(MYSQL_FILE *file) break; case READ_BOOTSTRAP_QUERY_SIZE: - my_printf_error(ER_UNKNOWN_ERROR, "Boostrap file error. Query size " + my_printf_error(ER_UNKNOWN_ERROR, "Bootstrap file error. Query size " "exceeded %d bytes near '%s'.", MYF(0), - MAX_BOOTSTRAP_LINE_SIZE, err_ptr); + MAX_BOOTSTRAP_QUERY_SIZE, err_ptr); break; default: @@ -1136,13 +1136,12 @@ static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables) if (get_table_category(&db, &tn) < TABLE_CATEGORY_INFORMATION) return false; } - return true; + return tables != NULL; } static bool wsrep_command_no_result(char command) { - return (command == COM_STMT_PREPARE || - command == COM_STMT_FETCH || + return (command == COM_STMT_FETCH || command == COM_STMT_SEND_LONG_DATA || command == COM_STMT_CLOSE); } @@ -1188,7 +1187,7 @@ static enum enum_server_command fetch_command(THD *thd, char *packet) DISPATCH_COMMAND_CLOSE_CONNECTION request of THD shutdown (s. dispatch_command() description) @retval - DISPATCH_COMMAND_WOULDBLOCK - need to wait for asyncronous operations + DISPATCH_COMMAND_WOULDBLOCK - need to wait for asynchronous operations to finish. Only returned if parameter 'blocking' is false. */ @@ -1337,10 +1336,16 @@ dispatch_command_return do_command(THD *thd, bool blocking) in wsrep_before_command(). */ WSREP_LOG_THD(thd, "enter found BF aborted"); - DBUG_ASSERT(!thd->mdl_context.has_locks()); + DBUG_ASSERT(!thd->mdl_context.has_transactional_locks()); DBUG_ASSERT(!thd->get_stmt_da()->is_set()); /* We let COM_QUIT and COM_STMT_CLOSE to execute even if wsrep aborted. */ - if (command != COM_STMT_CLOSE && + if (command == COM_STMT_EXECUTE) + { + WSREP_DEBUG("PS BF aborted at do_command"); + thd->wsrep_delayed_BF_abort= true; + } + if (command != COM_STMT_CLOSE && + command != COM_STMT_EXECUTE && command != COM_QUIT) { my_error(ER_LOCK_DEADLOCK, MYF(0)); @@ -1423,6 +1428,17 @@ dispatch_command_return do_command(THD *thd, bool blocking) if (unlikely(wsrep_service_started)) wsrep_after_command_after_result(thd); } + + if (thd->wsrep_delayed_BF_abort) + { + my_error(ER_LOCK_DEADLOCK, MYF(0)); + WSREP_DEBUG("Deadlock error for PS query: %s", thd->query()); + thd->reset_killed(); + thd->mysys_var->abort = 0; + thd->wsrep_retry_counter = 0; + + thd->wsrep_delayed_BF_abort= false; + } #endif /* WITH_WSREP */ DBUG_RETURN(return_value); } @@ -1489,22 +1505,6 @@ static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables) } #ifdef WITH_WSREP -static my_bool wsrep_read_only_option(THD *thd, TABLE_LIST *all_tables) -{ - int opt_readonly_saved = opt_readonly; - privilege_t flag_saved= thd->security_ctx->master_access & PRIV_IGNORE_READ_ONLY; - - opt_readonly = 0; - thd->security_ctx->master_access &= ~PRIV_IGNORE_READ_ONLY; - - my_bool ret = !deny_updates_if_read_only_option(thd, all_tables); - - opt_readonly = opt_readonly_saved; - thd->security_ctx->master_access |= flag_saved; - - return ret; -} - static void wsrep_copy_query(THD *thd) { thd->wsrep_retry_command = thd->get_command(); @@ -2513,7 +2513,7 @@ void log_slow_statement(THD *thd) if ((thd->server_status & (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) && !(thd->query_plan_flags & QPLAN_STATUS) && - !slow_filter_masked(thd, QPLAN_NOT_USING_INDEX)) + (thd->variables.log_slow_filter & QPLAN_NOT_USING_INDEX)) { thd->query_plan_flags|= QPLAN_NOT_USING_INDEX; /* We are always logging no index queries if enabled in filter */ @@ -2798,9 +2798,10 @@ bool sp_process_definer(THD *thd) } else { - LEX_USER *d= lex->definer= get_current_user(thd, lex->definer); + LEX_USER *d= get_current_user(thd, lex->definer); if (!d) DBUG_RETURN(TRUE); + thd->change_item_tree((Item**)&lex->definer, (Item*)d); /* If the specified definer differs from the current user or role, we @@ -3323,6 +3324,7 @@ bool run_set_statement_if_requested(THD *thd, LEX *lex) { switch (v->var->option.var_type & GET_TYPE_MASK) { + case GET_BIT: case GET_BOOL: case GET_INT: case GET_LONG: @@ -3686,6 +3688,8 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) (sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) == 0) && !wsrep_tables_accessible_when_detached(all_tables) && lex->sql_command != SQLCOM_SET_OPTION && + lex->sql_command != SQLCOM_CHANGE_DB && + !(lex->sql_command == SQLCOM_SELECT && !all_tables) && !wsrep_is_show_query(lex->sql_command)) { my_message(ER_UNKNOWN_COM_ERROR, @@ -4205,8 +4209,10 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) WSREP_TO_ISOLATION_BEGIN(first_table->db.str, first_table->table_name.str, NULL); + Recreate_info recreate_info; res= mysql_alter_table(thd, &first_table->db, &first_table->table_name, - &create_info, first_table, &alter_info, + &create_info, first_table, + &recreate_info, &alter_info, 0, (ORDER*) 0, 0, lex->if_exists()); break; } @@ -4568,7 +4574,10 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) thd->protocol= save_protocol; } if (!res && thd->lex->analyze_stmt) - res= thd->lex->explain->send_explain(thd); + { + bool extended= thd->lex->describe & DESCRIBE_EXTENDED; + res= thd->lex->explain->send_explain(thd, extended); + } delete sel_result; MYSQL_INSERT_DONE(res, (ulong) thd->get_row_count_func()); /* @@ -4748,7 +4757,10 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) thd->protocol= save_protocol; } if (!res && (explain || lex->analyze_stmt)) - res= thd->lex->explain->send_explain(thd); + { + bool extended= thd->lex->describe & DESCRIBE_EXTENDED; + res= thd->lex->explain->send_explain(thd, extended); + } /* revert changes for SP */ MYSQL_INSERT_SELECT_DONE(res, (ulong) thd->get_row_count_func()); @@ -4815,7 +4827,10 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) if (thd->lex->analyze_stmt || thd->lex->describe) { if (!res) - res= thd->lex->explain->send_explain(thd); + { + bool extended= thd->lex->describe & DESCRIBE_EXTENDED; + res= thd->lex->explain->send_explain(thd, extended); + } } delete sel_result; @@ -4853,7 +4868,7 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) if (likely(!thd->is_fatal_error)) { result= new (thd->mem_root) multi_delete(thd, aux_tables, - lex->table_count); + lex->table_count_update); if (likely(result)) { if (unlikely(select_lex->vers_setup_conds(thd, aux_tables))) @@ -4876,7 +4891,10 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) else { if (lex->describe || lex->analyze_stmt) - res= thd->lex->explain->send_explain(thd); + { + bool extended= thd->lex->describe & DESCRIBE_EXTENDED; + res= thd->lex->explain->send_explain(thd, extended); + } } multi_delete_error: delete result; @@ -5523,7 +5541,7 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) MYF(0)); goto error; } - sql_kill(thd, it->val_int(), lex->kill_signal, lex->kill_type); + sql_kill(thd, (my_thread_id) it->val_int(), lex->kill_signal, lex->kill_type); } else sql_kill_user(thd, get_current_user(thd, lex->users_list.head()), @@ -5828,7 +5846,7 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) } case SQLCOM_XA_START: #ifdef WITH_WSREP - if (WSREP(thd)) + if (WSREP_ON) { my_error(ER_NOT_SUPPORTED_YET, MYF(0), "XA transactions with Galera replication"); @@ -6261,7 +6279,10 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables) thd->protocol= save_protocol; } if (!res) - res= thd->lex->explain->send_explain(thd); + { + bool extended= thd->lex->describe & DESCRIBE_EXTENDED; + res= thd->lex->explain->send_explain(thd, extended); + } } } } @@ -7040,13 +7061,13 @@ static bool check_show_access(THD *thd, TABLE_LIST *table) @brief Check if the requested privileges exists in either User-, Host- or Db-tables. @param thd Thread context - @param want_access Privileges requested + @param requirements Privileges requested @param tables List of tables to be compared against - @param no_errors Don't report error to the client (using my_error() call). @param any_combination_of_privileges_will_do TRUE if any privileges on any column combination is enough. @param number Only the first 'number' tables in the linked list are relevant. + @param no_errors Don't report error to the client (using my_error() call). The suppled table list contains cached privileges. This functions calls the help functions check_access and check_grant to verify the first three steps @@ -7073,7 +7094,7 @@ static bool check_show_access(THD *thd, TABLE_LIST *table) bool check_table_access(THD *thd, privilege_t requirements, TABLE_LIST *tables, - bool any_combination_of_privileges_will_do, + bool any_combination_of_privileges_will_do, uint number, bool no_errors) { TABLE_LIST *org_tables= tables; @@ -7304,7 +7325,6 @@ bool check_fk_parent_table_access(THD *thd, if (key->type == Key::FOREIGN_KEY) { TABLE_LIST parent_table; - bool is_qualified_table_name; Foreign_key *fk_key= (Foreign_key *)key; LEX_CSTRING db_name; LEX_CSTRING table_name= { fk_key->ref_table.str, @@ -7321,7 +7341,6 @@ bool check_fk_parent_table_access(THD *thd, if (fk_key->ref_db.str) { - is_qualified_table_name= true; if (!(db_name.str= (char *) thd->memdup(fk_key->ref_db.str, fk_key->ref_db.length+1))) return true; @@ -7343,7 +7362,6 @@ bool check_fk_parent_table_access(THD *thd, if (!(db_name.str= (char *) thd->memdup(create_db, db_name.length+1))) return true; - is_qualified_table_name= true; if (check_db_name((LEX_STRING*) &db_name)) { @@ -7355,8 +7373,6 @@ bool check_fk_parent_table_access(THD *thd, { if (thd->lex->copy_db_to(&db_name)) return true; - else - is_qualified_table_name= false; } } @@ -7382,22 +7398,11 @@ bool check_fk_parent_table_access(THD *thd, if (check_some_access(thd, privileges, &parent_table) || parent_table.grant.want_privilege) { - if (is_qualified_table_name) - { - const size_t qualified_table_name_len= NAME_LEN + 1 + NAME_LEN + 1; - char *qualified_table_name= (char *) thd->alloc(qualified_table_name_len); - - my_snprintf(qualified_table_name, qualified_table_name_len, "%s.%s", - db_name.str, table_name.str); - table_name.str= qualified_table_name; - } - my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), - "REFERENCES", - thd->security_ctx->priv_user, - thd->security_ctx->host_or_ip, - table_name.str); - + "REFERENCES", + thd->security_ctx->priv_user, + thd->security_ctx->host_or_ip, + db_name.str, table_name.str); return true; } } @@ -7832,7 +7837,7 @@ static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, { bool is_autocommit= !thd->in_multi_stmt_transaction_mode() && - wsrep_read_only_option(thd, thd->lex->query_tables); + !thd->wsrep_applier; bool retry_autocommit; do { @@ -7877,6 +7882,7 @@ static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, thd->lex->sql_command != SQLCOM_SELECT && thd->wsrep_retry_counter < thd->variables.wsrep_retry_autocommit) { +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sync.wsrep_retry_autocommit", { const char act[]= @@ -7885,6 +7891,7 @@ static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, "WAIT_FOR wsrep_retry_autocommit_continue"; DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act))); }); +#endif WSREP_DEBUG("wsrep retrying AC query: %lu %s", thd->wsrep_retry_counter, wsrep_thd_query(thd)); @@ -8835,8 +8842,8 @@ TABLE_LIST *st_select_lex::convert_right_join() void st_select_lex::prepare_add_window_spec(THD *thd) { LEX *lex= thd->lex; - lex->save_group_list= group_list; - lex->save_order_list= order_list; + save_group_list= group_list; + save_order_list= order_list; lex->win_ref= NULL; lex->win_frame= NULL; lex->frame_top_bound= NULL; @@ -8863,13 +8870,14 @@ bool st_select_lex::add_window_def(THD *thd, win_part_list_ptr, win_order_list_ptr, win_frame); - group_list= thd->lex->save_group_list; - order_list= thd->lex->save_order_list; + group_list= save_group_list; + order_list= save_order_list; if (parsing_place != SELECT_LIST) { fields_in_window_functions+= win_part_list_ptr->elements + win_order_list_ptr->elements; } + win_def->win_spec_number= window_specs.elements; return (win_def == NULL || window_specs.push_back(win_def)); } @@ -8889,14 +8897,15 @@ bool st_select_lex::add_window_spec(THD *thd, win_part_list_ptr, win_order_list_ptr, win_frame); - group_list= thd->lex->save_group_list; - order_list= thd->lex->save_order_list; + group_list= save_group_list; + order_list= save_order_list; if (parsing_place != SELECT_LIST) { fields_in_window_functions+= win_part_list_ptr->elements + win_order_list_ptr->elements; } thd->lex->win_spec= win_spec; + win_spec->win_spec_number= window_specs.elements; return (win_spec == NULL || window_specs.push_back(win_spec)); } @@ -9033,16 +9042,13 @@ push_new_name_resolution_context(THD *thd, Name_resolution_context *on_context; if (!(on_context= new (thd->mem_root) Name_resolution_context)) return TRUE; - on_context->init(); on_context->first_name_resolution_table= left_op->first_leaf_for_name_resolution(); on_context->last_name_resolution_table= right_op->last_leaf_for_name_resolution(); LEX *lex= thd->lex; on_context->select_lex = lex->current_select; - st_select_lex *curr_select= lex->pop_select(); - st_select_lex *outer_sel= lex->select_stack_head(); - lex->push_select(curr_select); + st_select_lex *outer_sel= lex->parser_current_outer_select(); on_context->outer_context = outer_sel ? &outer_sel->context : 0; return lex->push_context(on_context); } @@ -9185,6 +9191,7 @@ THD *find_thread_by_id(longlong id, bool query_id) return arg.thd; } + /** kill one thread. @@ -9195,16 +9202,16 @@ THD *find_thread_by_id(longlong id, bool query_id) */ uint -kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type type) +kill_one_thread(THD *thd, my_thread_id id, killed_state kill_signal, killed_type type) { THD *tmp; uint error= (type == KILL_TYPE_QUERY ? ER_NO_SUCH_QUERY : ER_NO_SUCH_THREAD); DBUG_ENTER("kill_one_thread"); - DBUG_PRINT("enter", ("id: %lld signal: %u", id, (uint) kill_signal)); + DBUG_PRINT("enter", ("id: %lld signal: %d", (long long) id, kill_signal)); tmp= find_thread_by_id(id, type == KILL_TYPE_QUERY); if (!tmp) DBUG_RETURN(error); - + DEBUG_SYNC(thd, "found_killee"); if (tmp->get_command() != COM_DAEMON) { /* @@ -9228,7 +9235,8 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ faster and do a harder kill than KILL_SYSTEM_THREAD; */ - mysql_mutex_lock(&tmp->LOCK_thd_data); // for various wsrep* checks below + mysql_mutex_lock(&tmp->LOCK_thd_data); // Lock from concurrent usage + #ifdef WITH_WSREP if (((thd->security_ctx->master_access & PRIV_KILL_OTHER_USER_PROCESS) || thd->security_ctx->user_matches(tmp->security_ctx)) && @@ -9243,27 +9251,28 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ if (tmp->wsrep_aborter && tmp->wsrep_aborter != thd->thread_id) { /* victim is in hit list already, bail out */ - WSREP_DEBUG("victim has wsrep aborter: %lu, skipping awake()", - tmp->wsrep_aborter); + WSREP_DEBUG("victim %lld has wsrep aborter: %lu, skipping awake()", + id, tmp->wsrep_aborter); error= 0; } else #endif /* WITH_WSREP */ { - WSREP_DEBUG("kill_one_thread %llu, victim: %llu wsrep_aborter %llu by signal %d", - thd->thread_id, id, tmp->wsrep_aborter, kill_signal); + WSREP_DEBUG("kill_one_thread victim: %lld wsrep_aborter %lu" + " by signal %d", + id, tmp->wsrep_aborter, kill_signal); tmp->awake_no_mutex(kill_signal); - WSREP_DEBUG("victim: %llu taken care of", id); error= 0; } } else error= (type == KILL_TYPE_QUERY ? ER_KILL_QUERY_DENIED_ERROR : ER_KILL_DENIED_ERROR); + mysql_mutex_unlock(&tmp->LOCK_thd_data); } mysql_mutex_unlock(&tmp->LOCK_thd_kill); - DBUG_PRINT("exit", ("%d", error)); + DBUG_PRINT("exit", ("%u", error)); DBUG_RETURN(error); } @@ -9306,7 +9315,9 @@ static my_bool kill_threads_callback(THD *thd, kill_threads_callback_arg *arg) if (!(arg->thd->security_ctx->master_access & PRIV_KILL_OTHER_USER_PROCESS) && !arg->thd->security_ctx->user_matches(thd->security_ctx)) - return 1; + { + return MY_TEST(arg->thd->security_ctx->master_access & PROCESS_ACL); + } if (!arg->threads_to_kill.push_back(thd, arg->thd->mem_root)) { mysql_mutex_lock(&thd->LOCK_thd_kill); // Lock from delete @@ -9371,9 +9382,21 @@ static uint kill_threads_for_user(THD *thd, LEX_USER *user, */ static -void sql_kill(THD *thd, longlong id, killed_state state, killed_type type) +void sql_kill(THD *thd, my_thread_id id, killed_state state, killed_type type) { uint error; +#ifdef WITH_WSREP + if (WSREP(thd)) + { + WSREP_DEBUG("sql_kill called"); + if (thd->wsrep_applier) + { + WSREP_DEBUG("KILL in applying, bailing out here"); + return; + } + WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + } +#endif /* WITH_WSREP */ if (likely(!(error= kill_one_thread(thd, id, state, type)))) { if (!thd->killed) @@ -9383,6 +9406,11 @@ void sql_kill(THD *thd, longlong id, killed_state state, killed_type type) } else my_error(error, MYF(0), id); +#ifdef WITH_WSREP + return; + wsrep_error_label: + my_error(ER_KILL_DENIED_ERROR, MYF(0), (long long) thd->thread_id); +#endif /* WITH_WSREP */ } @@ -9391,16 +9419,38 @@ sql_kill_user(THD *thd, LEX_USER *user, killed_state state) { uint error; ha_rows rows; - if (likely(!(error= kill_threads_for_user(thd, user, state, &rows)))) - my_ok(thd, rows); - else +#ifdef WITH_WSREP + if (WSREP(thd)) { - /* - This is probably ER_OUT_OF_RESOURCES, but in the future we may - want to write the name of the user we tried to kill - */ - my_error(error, MYF(0), user->host.str, user->user.str); + WSREP_DEBUG("sql_kill_user called"); + if (thd->wsrep_applier) + { + WSREP_DEBUG("KILL in applying, bailing out here"); + return; + } + WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) } +#endif /* WITH_WSREP */ + switch (error= kill_threads_for_user(thd, user, state, &rows)) + { + case 0: + my_ok(thd, rows); + break; + case ER_KILL_DENIED_ERROR: + char buf[DEFINER_LENGTH+1]; + strxnmov(buf, sizeof(buf), user->user.str, "@", user->host.str, NULL); + my_printf_error(ER_KILL_DENIED_ERROR, ER_THD(thd, ER_CANNOT_USER), MYF(0), + "KILL USER", buf); + break; + case ER_OUT_OF_RESOURCES: + default: + my_error(error, MYF(0)); + } +#ifdef WITH_WSREP + return; + wsrep_error_label: + my_error(ER_KILL_DENIED_ERROR, MYF(0), (long long) thd->thread_id); +#endif /* WITH_WSREP */ } @@ -9709,12 +9759,12 @@ bool multi_delete_set_locks_and_link_aux_tables(LEX *lex) TABLE_LIST *target_tbl; DBUG_ENTER("multi_delete_set_locks_and_link_aux_tables"); - lex->table_count= 0; + lex->table_count_update= 0; for (target_tbl= lex->auxiliary_table_list.first; target_tbl; target_tbl= target_tbl->next_local) { - lex->table_count++; + lex->table_count_update++; /* All tables in aux_tables must be found in FROM PART */ TABLE_LIST *walk= multi_delete_table_match(lex, target_tbl, tables); if (!walk) @@ -9871,7 +9921,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables, { LEX *lex= thd->lex; SELECT_LEX *select_lex= lex->first_select_lex(); - privilege_t want_priv(NO_ACL); + privilege_t want_priv{CREATE_ACL}; bool error= TRUE; // Error message is given DBUG_ENTER("create_table_precheck"); @@ -9880,8 +9930,10 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables, CREATE TABLE ... SELECT, also require INSERT. */ - want_priv= lex->tmp_table() ? CREATE_TMP_ACL : - (CREATE_ACL | (select_lex->item_list.elements ? INSERT_ACL : NO_ACL)); + if (lex->tmp_table()) + want_priv= CREATE_TMP_ACL; + else if (select_lex->item_list.elements || select_lex->tvc) + want_priv|= INSERT_ACL; /* CREATE OR REPLACE on not temporary tables require DROP_ACL */ if (lex->create_info.or_replace() && !lex->tmp_table()) diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index b75a318ab652e..9c7f25e8808d7 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2005, 2017, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB + Copyright (c) 2009, 2022, 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 @@ -69,6 +69,7 @@ #include "sql_select.h" #include "ddl_log.h" #include "tztime.h" // my_tz_OFFSET0 +#include "create_options.h" // engine_option_value #include using std::max; @@ -2205,7 +2206,7 @@ static int add_keyword_int(String *str, const char *keyword, longlong num) return err + str->append_longlong(num); } -static int add_partition_options(String *str, partition_element *p_elem) +static int add_server_part_options(String *str, partition_element *p_elem) { int err= 0; @@ -2232,6 +2233,20 @@ static int add_partition_options(String *str, partition_element *p_elem) return err; } +static int add_engine_part_options(String *str, partition_element *p_elem) +{ + engine_option_value *opt= p_elem->option_list; + + for (; opt; opt= opt->next) + { + if (!opt->value.str) + continue; + if ((add_keyword_string(str, opt->name.str, opt->quoted_value, + opt->value.str))) + return 1; + } + return 0; +} /* Find the given field's Create_field object using name of field @@ -2455,7 +2470,7 @@ static int add_partition_values(String *str, partition_info *part_info, @retval != 0 Failure */ -static int add_key_with_algorithm(String *str, partition_info *part_info) +static int add_key_with_algorithm(String *str, const partition_info *part_info) { int err= 0; err+= str->append(STRING_WITH_LEN("KEY ")); @@ -2484,6 +2499,78 @@ char *generate_partition_syntax_for_frm(THD *thd, partition_info *part_info, return res; } + +/* + Generate the partition type syntax from the partition data structure. + + @return Operation status. + @retval 0 Success + @retval > 0 Failure + @retval -1 Fatal error +*/ + +int partition_info::gen_part_type(THD *thd, String *str) const +{ + int err= 0; + switch (part_type) + { + case RANGE_PARTITION: + err+= str->append(STRING_WITH_LEN("RANGE ")); + break; + case LIST_PARTITION: + err+= str->append(STRING_WITH_LEN("LIST ")); + break; + case HASH_PARTITION: + if (linear_hash_ind) + err+= str->append(STRING_WITH_LEN("LINEAR ")); + if (list_of_part_fields) + { + err+= add_key_with_algorithm(str, this); + err+= add_part_field_list(thd, str, part_field_list); + } + else + err+= str->append(STRING_WITH_LEN("HASH ")); + break; + case VERSIONING_PARTITION: + err+= str->append(STRING_WITH_LEN("SYSTEM_TIME ")); + break; + default: + DBUG_ASSERT(0); + /* We really shouldn't get here, no use in continuing from here */ + my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATAL)); + return -1; + } + return err; +} + + +void part_type_error(THD *thd, partition_info *work_part_info, + const char *part_type, + partition_info *tab_part_info) +{ + StringBuffer<256> tab_part_type; + if (tab_part_info->gen_part_type(thd, &tab_part_type) < 0) + return; + tab_part_type.length(tab_part_type.length() - 1); + if (work_part_info) + { + DBUG_ASSERT(!part_type); + StringBuffer<256> work_part_type; + if (work_part_info->gen_part_type(thd, &work_part_type) < 0) + return; + work_part_type.length(work_part_type.length() - 1); + my_error(ER_PARTITION_WRONG_TYPE, MYF(0), work_part_type.c_ptr(), + tab_part_type.c_ptr()); + } + else + { + DBUG_ASSERT(part_type); + my_error(ER_PARTITION_WRONG_TYPE, MYF(0), part_type, + tab_part_type.c_ptr()); + } +} + + /* Generate the partition syntax from the partition data structure. Useful for support of generating defaults, SHOW CREATE TABLES @@ -2527,34 +2614,10 @@ char *generate_partition_syntax(THD *thd, partition_info *part_info, DBUG_ENTER("generate_partition_syntax"); err+= str.append(STRING_WITH_LEN(" PARTITION BY ")); - switch (part_info->part_type) - { - case RANGE_PARTITION: - err+= str.append(STRING_WITH_LEN("RANGE ")); - break; - case LIST_PARTITION: - err+= str.append(STRING_WITH_LEN("LIST ")); - break; - case HASH_PARTITION: - if (part_info->linear_hash_ind) - err+= str.append(STRING_WITH_LEN("LINEAR ")); - if (part_info->list_of_part_fields) - { - err+= add_key_with_algorithm(&str, part_info); - err+= add_part_field_list(thd, &str, part_info->part_field_list); - } - else - err+= str.append(STRING_WITH_LEN("HASH ")); - break; - case VERSIONING_PARTITION: - err+= str.append(STRING_WITH_LEN("SYSTEM_TIME ")); - break; - default: - DBUG_ASSERT(0); - /* We really shouldn't get here, no use in continuing from here */ - my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATAL)); - DBUG_RETURN(NULL); - } + int err2= part_info->gen_part_type(thd, &str); + if (err2 < 0) + DBUG_RETURN(NULL); + err+= err2; if (part_info->part_type == VERSIONING_PARTITION) { Vers_part_info *vers_info= part_info->vers_info; @@ -2655,7 +2718,10 @@ char *generate_partition_syntax(THD *thd, partition_info *part_info, part_info->use_default_subpartitions) { if (show_partition_options) - err+= add_partition_options(&str, part_elem); + { + err+= add_server_part_options(&str, part_elem); + err+= add_engine_part_options(&str, part_elem); + } } else { @@ -2669,7 +2735,7 @@ char *generate_partition_syntax(THD *thd, partition_info *part_info, err+= append_identifier(thd, &str, part_elem->partition_name, strlen(part_elem->partition_name)); if (show_partition_options) - err+= add_partition_options(&str, part_elem); + err+= add_server_part_options(&str, part_elem); if (j != (num_subparts-1)) err+= str.append(STRING_WITH_LEN(",\n ")); else @@ -4792,6 +4858,7 @@ static void check_datadir_altered_for_innodb(THD *thd, @param[out] partition_changed Boolean indicating whether partition changed @param[out] fast_alter_table Boolean indicating if fast partition alter is possible. + @param[out] thd->work_part_info Prepared part_info for the new table @return Operation status @retval TRUE Error @@ -5008,6 +5075,13 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, if ((alter_info->partition_flags & ALTER_PARTITION_ADD) || (alter_info->partition_flags & ALTER_PARTITION_REORGANIZE)) { + if ((alter_info->partition_flags & ALTER_PARTITION_CONVERT_IN) && + !(tab_part_info->part_type == RANGE_PARTITION || + tab_part_info->part_type == LIST_PARTITION)) + { + my_error(ER_ONLY_ON_RANGE_LIST_PARTITION, MYF(0), "CONVERT TABLE TO"); + goto err; + } if (thd->work_part_info->part_type != tab_part_info->part_type) { if (thd->work_part_info->part_type == NOT_A_PARTITION) @@ -5043,7 +5117,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, else if (thd->work_part_info->part_type == VERSIONING_PARTITION || tab_part_info->part_type == VERSIONING_PARTITION) { - my_error(ER_PARTITION_WRONG_TYPE, MYF(0), "SYSTEM_TIME"); + part_type_error(thd, thd->work_part_info, NULL, tab_part_info); } else { @@ -5077,13 +5151,6 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, } if (alter_info->partition_flags & ALTER_PARTITION_ADD) { - if ((alter_info->partition_flags & ALTER_PARTITION_CONVERT_IN) && - !(tab_part_info->part_type == RANGE_PARTITION || - tab_part_info->part_type == LIST_PARTITION)) - { - my_error(ER_ONLY_ON_RANGE_LIST_PARTITION, MYF(0), "CONVERT TABLE TO"); - goto err; - } if (*fast_alter_table && thd->locked_tables_mode) { MEM_ROOT *old_root= thd->mem_root; @@ -6969,16 +7036,33 @@ static bool alter_partition_lock_handling(ALTER_PARTITION_PARAM_TYPE *lpt) static int alter_close_table(ALTER_PARTITION_PARAM_TYPE *lpt) { - int error= 0; + THD *thd= lpt->thd; + TABLE_SHARE *share= lpt->table->s; DBUG_ENTER("alter_close_table"); - if (lpt->table->db_stat) - { - error= mysql_lock_remove(lpt->thd, lpt->thd->lock, lpt->table); - error= lpt->table->file->ha_close(); - lpt->table->db_stat= 0; // Mark file closed - } - DBUG_RETURN(error); + TABLE *table= thd->open_tables; + do { + table= find_locked_table(table, share->db.str, share->table_name.str); + if (!table) + { + DBUG_RETURN(0); + } + + if (table->db_stat) + { + if (int error= mysql_lock_remove(thd, thd->lock, table)) + { + DBUG_RETURN(error); + } + if (int error= table->file->ha_close()) + { + DBUG_RETURN(error); + } + table->db_stat= 0; // Mark file closed + } + } while ((table= table->next)); + + DBUG_RETURN(0); } @@ -6999,7 +7083,8 @@ static int alter_close_table(ALTER_PARTITION_PARAM_TYPE *lpt) static void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt, bool action_completed, bool drop_partition, - bool frm_install) + bool frm_install, + bool reopen) { THD *thd= lpt->thd; partition_info *part_info= lpt->part_info->get_clone(thd); @@ -7043,6 +7128,9 @@ static void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt, close_all_tables_for_name(thd, table->s, HA_EXTRA_NOT_USED, NULL); } + if (!reopen) + DBUG_VOID_RETURN; + if (part_info->list && ddl_log_execute_entry(thd, part_info->list->entry_pos)) { @@ -7473,7 +7561,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, thd->query(), thd->query_length()), FALSE)) || ERROR_INJECT("drop_partition_9")) { - handle_alter_part_error(lpt, action_completed, TRUE, frm_install); + handle_alter_part_error(lpt, action_completed, TRUE, frm_install, true); goto err; } if (alter_partition_lock_handling(lpt)) @@ -7509,9 +7597,12 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, (thd->binlog_xid= 0))) || ERROR_INJECT("convert_partition_9")) { + DDL_LOG_STATE main_state= *lpt->part_info; + handle_alter_part_error(lpt, true, true, false, false); ddl_log_complete(&chain_drop_backup); - (void) ddl_log_revert(thd, lpt->part_info); - handle_alter_part_error(lpt, true, true, false); + (void) ddl_log_revert(thd, &main_state); + if (thd->locked_tables_mode) + thd->locked_tables_list.reopen_tables(thd, false); goto err; } ddl_log_complete(lpt->part_info); @@ -7558,9 +7649,12 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, (thd->binlog_xid= 0))) || ERROR_INJECT("convert_partition_9")) { + DDL_LOG_STATE main_state= *lpt->part_info; + handle_alter_part_error(lpt, true, true, false, false); ddl_log_complete(&chain_drop_backup); - (void) ddl_log_revert(thd, lpt->part_info); - handle_alter_part_error(lpt, true, true, false); + (void) ddl_log_revert(thd, &main_state); + if (thd->locked_tables_mode) + thd->locked_tables_list.reopen_tables(thd, false); goto err; } ddl_log_complete(lpt->part_info); @@ -7632,7 +7726,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, thd->query(), thd->query_length()), FALSE)) || ERROR_INJECT("add_partition_10")) { - handle_alter_part_error(lpt, action_completed, FALSE, frm_install); + handle_alter_part_error(lpt, action_completed, FALSE, frm_install, true); goto err; } if (alter_partition_lock_handling(lpt)) @@ -7725,7 +7819,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, thd->query(), thd->query_length()), FALSE)) || ERROR_INJECT("change_partition_12")) { - handle_alter_part_error(lpt, action_completed, FALSE, frm_install); + handle_alter_part_error(lpt, action_completed, FALSE, frm_install, true); goto err; } if (alter_partition_lock_handling(lpt)) diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc index fb1ae0d5fc70f..fcc08b69af4c2 100644 --- a/sql/sql_partition_admin.cc +++ b/sql/sql_partition_admin.cc @@ -33,6 +33,7 @@ #endif #include "sql_base.h" // open_and_lock_tables #include "ddl_log.h" +#include "wsrep_mysqld.h" #ifndef WITH_PARTITION_STORAGE_ENGINE @@ -258,8 +259,13 @@ bool compare_table_with_partition(THD *thd, TABLE *table, TABLE *part_table, my_error(ER_TABLES_DIFFERENT_METADATA, MYF(0)); DBUG_RETURN(TRUE); } - DBUG_ASSERT(table->s->db_create_options == - part_table->s->db_create_options); + + if (table->s->db_create_options != part_table->s->db_create_options) + { + my_error(ER_TABLES_DIFFERENT_METADATA, MYF(0)); + DBUG_RETURN(TRUE); + } + DBUG_ASSERT(table->s->db_options_in_use == part_table->s->db_options_in_use); @@ -573,6 +579,14 @@ bool Sql_cmd_alter_table_exchange_partition:: part_table= table_list->table; swap_table= swap_table_list->table; + /* Don't allow to exchange with a VIEW */ + if (unlikely(swap_table_list->view)) + { + my_error(ER_WRONG_OBJECT, MYF(0), table_list->db.str, + swap_table_list->table_name.str, "BASE TABLE"); + DBUG_RETURN(TRUE); + } + if (unlikely(check_exchange_partition(swap_table, part_table))) DBUG_RETURN(TRUE); diff --git a/sql/sql_partition_admin.h b/sql/sql_partition_admin.h index 4be9e56e3598a..b50c3555bcb83 100644 --- a/sql/sql_partition_admin.h +++ b/sql/sql_partition_admin.h @@ -127,8 +127,7 @@ class Sql_cmd_alter_table_exchange_partition : public Sql_cmd_common_alter_table : Sql_cmd_common_alter_table() {} - ~Sql_cmd_alter_table_exchange_partition() - {} + ~Sql_cmd_alter_table_exchange_partition() = default; bool execute(THD *thd); @@ -150,8 +149,7 @@ class Sql_cmd_alter_table_analyze_partition : public Sql_cmd_analyze_table : Sql_cmd_analyze_table() {} - ~Sql_cmd_alter_table_analyze_partition() - {} + ~Sql_cmd_alter_table_analyze_partition() = default; bool execute(THD *thd); @@ -176,8 +174,7 @@ class Sql_cmd_alter_table_check_partition : public Sql_cmd_check_table : Sql_cmd_check_table() {} - ~Sql_cmd_alter_table_check_partition() - {} + ~Sql_cmd_alter_table_check_partition() = default; bool execute(THD *thd); @@ -202,8 +199,7 @@ class Sql_cmd_alter_table_optimize_partition : public Sql_cmd_optimize_table : Sql_cmd_optimize_table() {} - ~Sql_cmd_alter_table_optimize_partition() - {} + ~Sql_cmd_alter_table_optimize_partition() = default; bool execute(THD *thd); @@ -228,8 +224,7 @@ class Sql_cmd_alter_table_repair_partition : public Sql_cmd_repair_table : Sql_cmd_repair_table() {} - ~Sql_cmd_alter_table_repair_partition() - {} + ~Sql_cmd_alter_table_repair_partition() = default; bool execute(THD *thd); @@ -250,11 +245,9 @@ class Sql_cmd_alter_table_truncate_partition : public Sql_cmd_truncate_table /** Constructor, used to represent a ALTER TABLE TRUNCATE PARTITION statement. */ - Sql_cmd_alter_table_truncate_partition() - {} + Sql_cmd_alter_table_truncate_partition() = default; - virtual ~Sql_cmd_alter_table_truncate_partition() - {} + virtual ~Sql_cmd_alter_table_truncate_partition() = default; bool execute(THD *thd); diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index e3ddd14fe6ac5..5a077a934ac05 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -40,6 +40,7 @@ #include #include #include "sql_plugin_compat.h" +#include "wsrep_mysqld.h" static PSI_memory_key key_memory_plugin_mem_root; static PSI_memory_key key_memory_plugin_int_mem_root; @@ -233,7 +234,7 @@ static struct /* support for Services */ -#include "sql_plugin_services.ic" +#include "sql_plugin_services.inl" /* A mutex LOCK_plugin must be acquired before accessing the @@ -311,7 +312,8 @@ class sys_var_pluginvar: public sys_var, public Sql_alloc struct st_mysql_sys_var *plugin_var; sys_var_pluginvar(sys_var_chain *chain, const char *name_arg, - st_plugin_int *p, st_mysql_sys_var *plugin_var_arg); + st_plugin_int *p, st_mysql_sys_var *plugin_var_arg, + const char *substitute); sys_var_pluginvar *cast_pluginvar() { return this; } uchar* real_value_ptr(THD *thd, enum_var_type type) const; TYPELIB* plugin_var_typelib(void) const; @@ -340,7 +342,7 @@ static bool register_builtin(struct st_maria_plugin *, struct st_plugin_int *, struct st_plugin_int **); static void unlock_variables(THD *thd, struct system_variables *vars); static void cleanup_variables(struct system_variables *vars); -static void plugin_vars_free_values(sys_var *vars); +static void plugin_vars_free_values(st_mysql_sys_var **vars); static void restore_ptr_backup(uint n, st_ptr_backup *backup); static void intern_plugin_unlock(LEX *lex, plugin_ref plugin); static void reap_plugins(void); @@ -373,7 +375,8 @@ bool check_valid_path(const char *path, size_t len) static void fix_dl_name(MEM_ROOT *root, LEX_CSTRING *dl) { const size_t so_ext_len= sizeof(SO_EXT) - 1; - if (my_strcasecmp(&my_charset_latin1, dl->str + dl->length - so_ext_len, + if (dl->length < so_ext_len || + my_strcasecmp(&my_charset_latin1, dl->str + dl->length - so_ext_len, SO_EXT)) { char *s= (char*)alloc_root(root, dl->length + so_ext_len + 1); @@ -1290,7 +1293,7 @@ static void plugin_del(struct st_plugin_int *plugin, uint del_mask) if (!(plugin->state & del_mask)) DBUG_VOID_RETURN; /* Free allocated strings before deleting the plugin. */ - plugin_vars_free_values(plugin->system_vars); + plugin_vars_free_values(plugin->plugin->system_vars); restore_ptr_backup(plugin->nbackups, plugin->ptr_backup); if (plugin->plugin_dl) { @@ -2530,7 +2533,7 @@ static bool plugin_dl_foreach_internal(THD *thd, st_plugin_dl *plugin_dl, tmp.plugin_dl= plugin_dl; mysql_mutex_lock(&LOCK_plugin); - if ((plugin= plugin_find_internal(&tmp.name, MYSQL_ANY_PLUGIN)) && + if ((plugin= plugin_find_internal(&tmp.name, plug->type)) && plugin->plugin == plug) { @@ -2942,6 +2945,7 @@ sys_var *find_sys_var(THD *thd, const char *str, size_t length, /* called by register_var, construct_options and test_plugin_options. Returns the 'bookmark' for the named variable. + returns null for non thd-local variables. LOCK_system_variables_hash should be at least read locked */ static st_bookmark *find_bookmark(const char *plugin, const char *name, @@ -2998,7 +3002,6 @@ static size_t var_storage_size(int flags) /* returns a bookmark for thd-local variables, creating if neccessary. - returns null for non thd-local variables. Requires that a write lock is obtained on LOCK_system_variables_hash */ static st_bookmark *register_var(const char *plugin, const char *name, @@ -3352,27 +3355,35 @@ void plugin_thdvar_cleanup(THD *thd) variables are no longer accessible and the value space is lost. Note that only string values with PLUGIN_VAR_MEMALLOC are allocated and must be freed. - - @param[in] vars Chain of system variables of a plugin */ -static void plugin_vars_free_values(sys_var *vars) +static void plugin_vars_free_values(st_mysql_sys_var **vars) { DBUG_ENTER("plugin_vars_free_values"); - for (sys_var *var= vars; var; var= var->next) + if (!vars) + DBUG_VOID_RETURN; + + while(st_mysql_sys_var *var= *vars++) { - sys_var_pluginvar *piv= var->cast_pluginvar(); - if (piv && - ((piv->plugin_var->flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR) && - (piv->plugin_var->flags & PLUGIN_VAR_MEMALLOC)) + if ((var->flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR && + var->flags & PLUGIN_VAR_MEMALLOC) { - /* Free the string from global_system_variables. */ - char **valptr= (char**) piv->real_value_ptr(NULL, OPT_GLOBAL); + char **val; + if (var->flags & PLUGIN_VAR_THDLOCAL) + { + st_bookmark *v= find_bookmark(0, var->name, var->flags); + if (!v) + continue; + val= (char**)(global_system_variables.dynamic_variables_ptr + v->offset); + } + else + val= *(char***) (var + 1); + DBUG_PRINT("plugin", ("freeing value for: '%s' addr: %p", - var->name.str, valptr)); - my_free(*valptr); - *valptr= NULL; + var->name, val)); + my_free(*val); + *val= NULL; } } DBUG_VOID_RETURN; @@ -3416,11 +3427,11 @@ static int pluginvar_sysvar_flags(const st_mysql_sys_var *p) } sys_var_pluginvar::sys_var_pluginvar(sys_var_chain *chain, const char *name_arg, - st_plugin_int *p, st_mysql_sys_var *pv) + st_plugin_int *p, st_mysql_sys_var *pv, const char *substitute) : sys_var(chain, name_arg, pv->comment, pluginvar_sysvar_flags(pv), 0, pv->flags & PLUGIN_VAR_NOCMDOPT ? -1 : 0, NO_ARG, pluginvar_show_type(pv), 0, - NULL, VARIABLE_NOT_IN_BINLOG, NULL, NULL, NULL), + NULL, VARIABLE_NOT_IN_BINLOG, NULL, NULL, substitute), plugin(p), plugin_var(pv) { plugin_var->name= name_arg; @@ -4032,7 +4043,7 @@ static my_option *construct_help_options(MEM_ROOT *mem_root, bzero(opts, sizeof(my_option) * count); /** - some plugin variables (those that don't have PLUGIN_VAR_NOSYSVAR flag) + some plugin variables have their names prefixed with the plugin name. Restore the names here to get the correct (not double-prefixed) help text. We won't need @@sysvars anymore and don't care about their proper names. @@ -4144,9 +4155,6 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, char *varname; sys_var *v; - if (o->flags & PLUGIN_VAR_NOSYSVAR) - continue; - tmp_backup[tmp->nbackups++].save(&o->name); if ((var= find_bookmark(tmp->name.str, o->name, o->flags))) { @@ -4162,7 +4170,14 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, my_casedn_str(&my_charset_latin1, varname); convert_dash_to_underscore(varname, len-1); } - v= new (mem_root) sys_var_pluginvar(&chain, varname, tmp, o); + if (o->flags & PLUGIN_VAR_NOSYSVAR) + { + o->name= varname; + continue; + } + + const char *s= o->flags & PLUGIN_VAR_DEPRECATED ? "" : NULL; + v= new (mem_root) sys_var_pluginvar(&chain, varname, tmp, o, s); v->test_load= (var ? &var->loaded : &static_unload); DBUG_ASSERT(static_unload == FALSE); diff --git a/sql/sql_plugin_services.ic b/sql/sql_plugin_services.ic deleted file mode 100644 index 3dd41ffbed9d5..0000000000000 --- a/sql/sql_plugin_services.ic +++ /dev/null @@ -1,351 +0,0 @@ -/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. - Copyright (c) 2012, 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* support for Services */ -#include -#include -#include - -struct st_service_ref { - const char *name; - uint version; - void *service; -}; - -static struct my_snprintf_service_st my_snprintf_handler = { - my_snprintf, - my_vsnprintf -}; - -static struct thd_alloc_service_st thd_alloc_handler= { - thd_alloc, - thd_calloc, - thd_strdup, - thd_strmake, - thd_memdup, - thd_make_lex_string -}; - -static struct thd_wait_service_st thd_wait_handler= { - thd_wait_begin, - thd_wait_end -}; - -static struct progress_report_service_st progress_report_handler= { - thd_progress_init, - thd_progress_report, - thd_progress_next_stage, - thd_progress_end, - set_thd_proc_info -}; - -static struct kill_statement_service_st thd_kill_statement_handler= { - thd_kill_level -}; - -static struct thd_timezone_service_st thd_timezone_handler= { - thd_TIME_to_gmt_sec, - thd_gmt_sec_to_TIME -}; - -static struct my_sha2_service_st my_sha2_handler = { - my_sha224, - my_sha224_multi, - my_sha224_context_size, - my_sha224_init, - my_sha224_input, - my_sha224_result, - my_sha256, - my_sha256_multi, - my_sha256_context_size, - my_sha256_init, - my_sha256_input, - my_sha256_result, - my_sha384, - my_sha384_multi, - my_sha384_context_size, - my_sha384_init, - my_sha384_input, - my_sha384_result, - my_sha512, - my_sha512_multi, - my_sha512_context_size, - my_sha512_init, - my_sha512_input, - my_sha512_result, -}; - -static struct my_sha1_service_st my_sha1_handler = { - my_sha1, - my_sha1_multi, - my_sha1_context_size, - my_sha1_init, - my_sha1_input, - my_sha1_result -}; - -static struct my_md5_service_st my_md5_handler = { - my_md5, - my_md5_multi, - my_md5_context_size, - my_md5_init, - my_md5_input, - my_md5_result -}; - -static struct logger_service_st logger_service_handler= { - logger_init_mutexes, - logger_open, - logger_close, - logger_vprintf, - logger_printf, - logger_write, - logger_rotate -}; - -static struct thd_autoinc_service_st thd_autoinc_handler= { - thd_get_autoinc -}; - -static struct thd_rnd_service_st thd_rnd_handler= { - thd_rnd, - thd_create_random_password -}; - -static struct base64_service_st base64_handler= { - my_base64_needed_encoded_length, - my_base64_encode_max_arg_length, - my_base64_needed_decoded_length, - my_base64_decode_max_arg_length, - my_base64_encode, - my_base64_decode -}; - -static struct thd_error_context_service_st thd_error_context_handler= { - thd_get_error_message, - thd_get_error_number, - thd_get_error_row, - thd_inc_error_row, - thd_get_error_context_description -}; - -static struct wsrep_service_st wsrep_handler = { - get_wsrep_recovery, - wsrep_consistency_check, - wsrep_is_wsrep_xid, - wsrep_xid_seqno, - wsrep_xid_uuid, - wsrep_on, - wsrep_prepare_key_for_innodb, - wsrep_thd_LOCK, - wsrep_thd_UNLOCK, - wsrep_thd_query, - wsrep_thd_retry_counter, - wsrep_thd_ignore_table, - wsrep_thd_trx_seqno, - wsrep_thd_is_aborting, - wsrep_set_data_home_dir, - wsrep_thd_is_BF, - wsrep_thd_is_local, - wsrep_thd_self_abort, - wsrep_thd_append_key, - wsrep_thd_client_state_str, - wsrep_thd_client_mode_str, - wsrep_thd_transaction_state_str, - wsrep_thd_transaction_id, - wsrep_thd_bf_abort, - wsrep_thd_order_before, - wsrep_handle_SR_rollback, - wsrep_thd_skip_locking, - wsrep_get_sr_table_name, - wsrep_get_debug, - wsrep_commit_ordered, - wsrep_thd_is_applying, - wsrep_OSU_method_get, - wsrep_thd_has_ignored_error, - wsrep_thd_set_ignored_error, - wsrep_thd_set_wsrep_aborter, - wsrep_report_bf_lock_wait, - wsrep_thd_kill_LOCK, - wsrep_thd_kill_UNLOCK, - wsrep_thd_set_PA_unsafe -}; - -static struct thd_specifics_service_st thd_specifics_handler= -{ - thd_key_create, - thd_key_delete, - thd_getspecific, - thd_setspecific -}; - -static struct encryption_scheme_service_st encryption_scheme_handler= -{ - encryption_scheme_encrypt, - encryption_scheme_decrypt -}; - -static struct my_crypt_service_st crypt_handler= -{ - my_aes_crypt_init, - my_aes_crypt_update, - my_aes_crypt_finish, - my_aes_crypt, - my_aes_get_size, - my_aes_ctx_size, - my_random_bytes -}; - -static struct my_print_error_service_st my_print_error_handler= -{ - my_error, - my_printf_error, - my_printv_error -}; - -static struct json_service_st json_handler= -{ - json_type, - json_get_array_item, - json_get_object_key, - json_get_object_nkey, - json_escape_string, - json_unescape_json -}; - -static struct thd_mdl_service_st thd_mdl_handler= -{ - thd_mdl_context -}; - -struct sql_service_st sql_service_handler= -{ - mysql_init, - mysql_real_connect_local, - mysql_real_connect, - mysql_errno, - mysql_error, - mysql_real_query, - mysql_affected_rows, - mysql_num_rows, - mysql_store_result, - mysql_free_result, - mysql_fetch_row, - mysql_close, -}; - -#define DEFINE_warning_function(name, ret) { \ - static query_id_t last_query_id= -1; \ - THD *thd= current_thd; \ - if((thd ? thd->query_id : 0) != last_query_id) \ - { \ - my_error(ER_PROVIDER_NOT_LOADED, MYF(ME_ERROR_LOG|ME_WARNING), name); \ - last_query_id= thd ? thd->query_id : 0; \ - } \ - return ret; \ -} - -#include -static struct provider_service_lzma_st provider_handler_lzma= -{ - DEFINE_lzma_stream_buffer_decode([]) DEFINE_warning_function("LZMA compression", LZMA_PROG_ERROR), - DEFINE_lzma_easy_buffer_encode([]) DEFINE_warning_function("LZMA compression", LZMA_PROG_ERROR), - - false // .is_loaded -}; -struct provider_service_lzma_st *provider_service_lzma= &provider_handler_lzma; - -#include -static struct provider_service_lzo_st provider_handler_lzo= -{ - DEFINE_lzo1x_1_15_compress([]) DEFINE_warning_function("LZO compression", LZO_E_INTERNAL_ERROR), - DEFINE_lzo1x_decompress_safe([]) DEFINE_warning_function("LZO compression", LZO_E_INTERNAL_ERROR), - - false // .is_loaded -}; -struct provider_service_lzo_st *provider_service_lzo= &provider_handler_lzo; - -#include -static struct provider_service_bzip2_st provider_handler_bzip2= -{ - DEFINE_BZ2_bzBuffToBuffCompress([]) DEFINE_warning_function("BZip2 compression", -1), - DEFINE_BZ2_bzBuffToBuffDecompress([]) DEFINE_warning_function("BZip2 compression", -1), - DEFINE_BZ2_bzCompress([]) DEFINE_warning_function("BZip2 compression", -1), - DEFINE_BZ2_bzCompressEnd([]) DEFINE_warning_function("BZip2 compression", -1), - DEFINE_BZ2_bzCompressInit([]) DEFINE_warning_function("BZip2 compression", -1), - DEFINE_BZ2_bzDecompress([]) DEFINE_warning_function("BZip2 compression", -1), - DEFINE_BZ2_bzDecompressEnd([]) DEFINE_warning_function("BZip2 compression", -1), - DEFINE_BZ2_bzDecompressInit([]) DEFINE_warning_function("BZip2 compression", -1), - - false // .is_loaded -}; -struct provider_service_bzip2_st *provider_service_bzip2= &provider_handler_bzip2; - -#include -static struct provider_service_snappy_st provider_handler_snappy= -{ - DEFINE_snappy_max_compressed_length([]) -> size_t DEFINE_warning_function("Snappy compression", 0), - DEFINE_snappy_compress([]) DEFINE_warning_function("Snappy compression", SNAPPY_INVALID_INPUT), - DEFINE_snappy_uncompressed_length([]) DEFINE_warning_function("Snappy compression", SNAPPY_INVALID_INPUT), - DEFINE_snappy_uncompress([]) DEFINE_warning_function("Snappy compression", SNAPPY_INVALID_INPUT), - - false // .is_loaded -}; -struct provider_service_snappy_st *provider_service_snappy= &provider_handler_snappy; - -#include -static struct provider_service_lz4_st provider_handler_lz4= -{ - DEFINE_LZ4_compressBound([]) DEFINE_warning_function("LZ4 compression", 0), - DEFINE_LZ4_compress_default([]) DEFINE_warning_function("LZ4 compression", 0), - DEFINE_LZ4_decompress_safe([]) DEFINE_warning_function("LZ4 compression", -1), - - false // .is_loaded -}; -struct provider_service_lz4_st *provider_service_lz4= &provider_handler_lz4; - -static struct st_service_ref list_of_services[]= -{ - { "base64_service", VERSION_base64, &base64_handler }, - { "debug_sync_service", VERSION_debug_sync, 0 }, // updated in plugin_init() - { "encryption_scheme_service", VERSION_encryption_scheme, &encryption_scheme_handler }, - { "encryption_service", VERSION_encryption, &encryption_handler }, - { "logger_service", VERSION_logger, &logger_service_handler }, - { "my_crypt_service", VERSION_my_crypt, &crypt_handler}, - { "my_md5_service", VERSION_my_md5, &my_md5_handler}, - { "my_print_error_service", VERSION_my_print_error, &my_print_error_handler}, - { "my_sha1_service", VERSION_my_sha1, &my_sha1_handler}, - { "my_sha2_service", VERSION_my_sha2, &my_sha2_handler}, - { "my_snprintf_service", VERSION_my_snprintf, &my_snprintf_handler }, - { "progress_report_service", VERSION_progress_report, &progress_report_handler }, - { "thd_alloc_service", VERSION_thd_alloc, &thd_alloc_handler }, - { "thd_autoinc_service", VERSION_thd_autoinc, &thd_autoinc_handler }, - { "thd_error_context_service", VERSION_thd_error_context, &thd_error_context_handler }, - { "thd_kill_statement_service", VERSION_kill_statement, &thd_kill_statement_handler }, - { "thd_rnd_service", VERSION_thd_rnd, &thd_rnd_handler }, - { "thd_specifics_service", VERSION_thd_specifics, &thd_specifics_handler }, - { "thd_timezone_service", VERSION_thd_timezone, &thd_timezone_handler }, - { "thd_wait_service", VERSION_thd_wait, &thd_wait_handler }, - { "wsrep_service", VERSION_wsrep, &wsrep_handler }, - { "json_service", VERSION_json, &json_handler }, - { "thd_mdl_service", VERSION_thd_mdl, &thd_mdl_handler }, - { "sql_service", VERSION_sql_service, &sql_service_handler }, - { "provider_service_bzip2", VERSION_provider_bzip2, &provider_handler_bzip2 }, - { "provider_service_lz4", VERSION_provider_lz4, &provider_handler_lz4 }, - { "provider_service_lzma", VERSION_provider_lzma, &provider_handler_lzma }, - { "provider_service_lzo", VERSION_provider_lzo, &provider_handler_lzo }, - { "provider_service_snappy", VERSION_provider_snappy, &provider_handler_snappy } -}; diff --git a/sql/sql_plugin_services.inl b/sql/sql_plugin_services.inl new file mode 100644 index 0000000000000..3a66e982e7bcd --- /dev/null +++ b/sql/sql_plugin_services.inl @@ -0,0 +1,358 @@ +/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. + Copyright (c) 2012, 2020, MariaDB Corporation. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ + +/* support for Services */ +#include +#include +#include + +struct st_service_ref { + const char *name; + uint version; + void *service; +}; + +static struct my_snprintf_service_st my_snprintf_handler = { + my_snprintf, + my_vsnprintf +}; + +static struct thd_alloc_service_st thd_alloc_handler= { + thd_alloc, + thd_calloc, + thd_strdup, + thd_strmake, + thd_memdup, + thd_make_lex_string +}; + +static struct thd_wait_service_st thd_wait_handler= { + thd_wait_begin, + thd_wait_end +}; + +static struct progress_report_service_st progress_report_handler= { + thd_progress_init, + thd_progress_report, + thd_progress_next_stage, + thd_progress_end, + set_thd_proc_info +}; + +static struct kill_statement_service_st thd_kill_statement_handler= { + thd_kill_level +}; + +static struct thd_timezone_service_st thd_timezone_handler= { + thd_TIME_to_gmt_sec, + thd_gmt_sec_to_TIME +}; + +static struct my_sha2_service_st my_sha2_handler = { + my_sha224, + my_sha224_multi, + my_sha224_context_size, + my_sha224_init, + my_sha224_input, + my_sha224_result, + my_sha256, + my_sha256_multi, + my_sha256_context_size, + my_sha256_init, + my_sha256_input, + my_sha256_result, + my_sha384, + my_sha384_multi, + my_sha384_context_size, + my_sha384_init, + my_sha384_input, + my_sha384_result, + my_sha512, + my_sha512_multi, + my_sha512_context_size, + my_sha512_init, + my_sha512_input, + my_sha512_result, +}; + +static struct my_sha1_service_st my_sha1_handler = { + my_sha1, + my_sha1_multi, + my_sha1_context_size, + my_sha1_init, + my_sha1_input, + my_sha1_result +}; + +static struct my_md5_service_st my_md5_handler = { + my_md5, + my_md5_multi, + my_md5_context_size, + my_md5_init, + my_md5_input, + my_md5_result +}; + +static struct logger_service_st logger_service_handler= { + logger_init_mutexes, + logger_open, + logger_close, + logger_vprintf, + logger_printf, + logger_write, + logger_rotate +}; + +static struct thd_autoinc_service_st thd_autoinc_handler= { + thd_get_autoinc +}; + +static struct thd_rnd_service_st thd_rnd_handler= { + thd_rnd, + thd_create_random_password +}; + +static struct base64_service_st base64_handler= { + my_base64_needed_encoded_length, + my_base64_encode_max_arg_length, + my_base64_needed_decoded_length, + my_base64_decode_max_arg_length, + my_base64_encode, + my_base64_decode +}; + +static struct thd_error_context_service_st thd_error_context_handler= { + thd_get_error_message, + thd_get_error_number, + thd_get_error_row, + thd_inc_error_row, + thd_get_error_context_description +}; + +static struct wsrep_service_st wsrep_handler = { + get_wsrep_recovery, + wsrep_consistency_check, + wsrep_is_wsrep_xid, + wsrep_xid_seqno, + wsrep_xid_uuid, + wsrep_on, + wsrep_prepare_key_for_innodb, + wsrep_thd_LOCK, + wsrep_thd_UNLOCK, + wsrep_thd_query, + wsrep_thd_retry_counter, + wsrep_thd_ignore_table, + wsrep_thd_trx_seqno, + wsrep_thd_is_aborting, + wsrep_set_data_home_dir, + wsrep_thd_is_BF, + wsrep_thd_is_local, + wsrep_thd_self_abort, + wsrep_thd_append_key, + wsrep_thd_append_table_key, + wsrep_thd_is_local_transaction, + wsrep_thd_client_state_str, + wsrep_thd_client_mode_str, + wsrep_thd_transaction_state_str, + wsrep_thd_transaction_id, + wsrep_thd_bf_abort, + wsrep_thd_order_before, + wsrep_handle_SR_rollback, + wsrep_thd_skip_locking, + wsrep_get_sr_table_name, + wsrep_get_debug, + wsrep_commit_ordered, + wsrep_thd_is_applying, + wsrep_OSU_method_get, + wsrep_thd_has_ignored_error, + wsrep_thd_set_ignored_error, + wsrep_thd_set_wsrep_aborter, + wsrep_report_bf_lock_wait, + wsrep_thd_kill_LOCK, + wsrep_thd_kill_UNLOCK, + wsrep_thd_set_PA_unsafe +}; + +static struct thd_specifics_service_st thd_specifics_handler= +{ + thd_key_create, + thd_key_delete, + thd_getspecific, + thd_setspecific +}; + +static struct encryption_scheme_service_st encryption_scheme_handler= +{ + encryption_scheme_encrypt, + encryption_scheme_decrypt +}; + +static struct my_crypt_service_st crypt_handler= +{ + my_aes_crypt_init, + my_aes_crypt_update, + my_aes_crypt_finish, + my_aes_crypt, + my_aes_get_size, + my_aes_ctx_size, + my_random_bytes +}; + +static struct my_print_error_service_st my_print_error_handler= +{ + my_error, + my_printf_error, + my_printv_error +}; + +static struct json_service_st json_handler= +{ + json_type, + json_get_array_item, + json_get_object_key, + json_get_object_nkey, + json_escape_string, + json_unescape_json +}; + +static struct thd_mdl_service_st thd_mdl_handler= +{ + thd_mdl_context +}; + +struct sql_service_st sql_service_handler= +{ + mysql_init, + mysql_real_connect_local, + mysql_real_connect, + mysql_errno, + mysql_error, + mysql_real_query, + mysql_affected_rows, + mysql_num_rows, + mysql_store_result, + mysql_free_result, + mysql_fetch_row, + mysql_close, + mysql_options, + mysql_fetch_lengths, + mysql_set_character_set, + mysql_num_fields, + mysql_select_db +}; + +#define DEFINE_warning_function(name, ret) { \ + static query_id_t last_query_id= -1; \ + THD *thd= current_thd; \ + if((thd ? thd->query_id : 0) != last_query_id) \ + { \ + my_error(ER_PROVIDER_NOT_LOADED, MYF(ME_ERROR_LOG|ME_WARNING), name); \ + last_query_id= thd ? thd->query_id : 0; \ + } \ + return ret; \ +} + +#include +static struct provider_service_lzma_st provider_handler_lzma= +{ + DEFINE_lzma_stream_buffer_decode([]) DEFINE_warning_function("LZMA compression", LZMA_PROG_ERROR), + DEFINE_lzma_easy_buffer_encode([]) DEFINE_warning_function("LZMA compression", LZMA_PROG_ERROR), + + false // .is_loaded +}; +struct provider_service_lzma_st *provider_service_lzma= &provider_handler_lzma; + +#include +static struct provider_service_lzo_st provider_handler_lzo= +{ + DEFINE_lzo1x_1_15_compress([]) DEFINE_warning_function("LZO compression", LZO_E_INTERNAL_ERROR), + DEFINE_lzo1x_decompress_safe([]) DEFINE_warning_function("LZO compression", LZO_E_INTERNAL_ERROR), + + false // .is_loaded +}; +struct provider_service_lzo_st *provider_service_lzo= &provider_handler_lzo; + +#include +static struct provider_service_bzip2_st provider_handler_bzip2= +{ + DEFINE_BZ2_bzBuffToBuffCompress([]) DEFINE_warning_function("BZip2 compression", -1), + DEFINE_BZ2_bzBuffToBuffDecompress([]) DEFINE_warning_function("BZip2 compression", -1), + DEFINE_BZ2_bzCompress([]) DEFINE_warning_function("BZip2 compression", -1), + DEFINE_BZ2_bzCompressEnd([]) DEFINE_warning_function("BZip2 compression", -1), + DEFINE_BZ2_bzCompressInit([]) DEFINE_warning_function("BZip2 compression", -1), + DEFINE_BZ2_bzDecompress([]) DEFINE_warning_function("BZip2 compression", -1), + DEFINE_BZ2_bzDecompressEnd([]) DEFINE_warning_function("BZip2 compression", -1), + DEFINE_BZ2_bzDecompressInit([]) DEFINE_warning_function("BZip2 compression", -1), + + false // .is_loaded +}; +struct provider_service_bzip2_st *provider_service_bzip2= &provider_handler_bzip2; + +#include +static struct provider_service_snappy_st provider_handler_snappy= +{ + DEFINE_snappy_max_compressed_length([]) -> size_t DEFINE_warning_function("Snappy compression", 0), + DEFINE_snappy_compress([]) DEFINE_warning_function("Snappy compression", SNAPPY_INVALID_INPUT), + DEFINE_snappy_uncompressed_length([]) DEFINE_warning_function("Snappy compression", SNAPPY_INVALID_INPUT), + DEFINE_snappy_uncompress([]) DEFINE_warning_function("Snappy compression", SNAPPY_INVALID_INPUT), + + false // .is_loaded +}; +struct provider_service_snappy_st *provider_service_snappy= &provider_handler_snappy; + +#include +static struct provider_service_lz4_st provider_handler_lz4= +{ + DEFINE_LZ4_compressBound([]) DEFINE_warning_function("LZ4 compression", 0), + DEFINE_LZ4_compress_default([]) DEFINE_warning_function("LZ4 compression", 0), + DEFINE_LZ4_decompress_safe([]) DEFINE_warning_function("LZ4 compression", -1), + + false // .is_loaded +}; +struct provider_service_lz4_st *provider_service_lz4= &provider_handler_lz4; + +static struct st_service_ref list_of_services[]= +{ + { "base64_service", VERSION_base64, &base64_handler }, + { "debug_sync_service", VERSION_debug_sync, 0 }, // updated in plugin_init() + { "encryption_scheme_service", VERSION_encryption_scheme, &encryption_scheme_handler }, + { "encryption_service", VERSION_encryption, &encryption_handler }, + { "logger_service", VERSION_logger, &logger_service_handler }, + { "my_crypt_service", VERSION_my_crypt, &crypt_handler}, + { "my_md5_service", VERSION_my_md5, &my_md5_handler}, + { "my_print_error_service", VERSION_my_print_error, &my_print_error_handler}, + { "my_sha1_service", VERSION_my_sha1, &my_sha1_handler}, + { "my_sha2_service", VERSION_my_sha2, &my_sha2_handler}, + { "my_snprintf_service", VERSION_my_snprintf, &my_snprintf_handler }, + { "progress_report_service", VERSION_progress_report, &progress_report_handler }, + { "thd_alloc_service", VERSION_thd_alloc, &thd_alloc_handler }, + { "thd_autoinc_service", VERSION_thd_autoinc, &thd_autoinc_handler }, + { "thd_error_context_service", VERSION_thd_error_context, &thd_error_context_handler }, + { "thd_kill_statement_service", VERSION_kill_statement, &thd_kill_statement_handler }, + { "thd_rnd_service", VERSION_thd_rnd, &thd_rnd_handler }, + { "thd_specifics_service", VERSION_thd_specifics, &thd_specifics_handler }, + { "thd_timezone_service", VERSION_thd_timezone, &thd_timezone_handler }, + { "thd_wait_service", VERSION_thd_wait, &thd_wait_handler }, + { "wsrep_service", VERSION_wsrep, &wsrep_handler }, + { "json_service", VERSION_json, &json_handler }, + { "thd_mdl_service", VERSION_thd_mdl, &thd_mdl_handler }, + { "sql_service", VERSION_sql_service, &sql_service_handler }, + { "provider_service_bzip2", VERSION_provider_bzip2, &provider_handler_bzip2 }, + { "provider_service_lz4", VERSION_provider_lz4, &provider_handler_lz4 }, + { "provider_service_lzma", VERSION_provider_lzma, &provider_handler_lzma }, + { "provider_service_lzo", VERSION_provider_lzo, &provider_handler_lzo }, + { "provider_service_snappy", VERSION_provider_snappy, &provider_handler_snappy } +}; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 68dd670787cbc..4ff5a679ffd04 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2002, 2015, Oracle and/or its affiliates. - Copyright (c) 2008, 2021, MariaDB + Copyright (c) 2008, 2022, 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 @@ -201,8 +201,8 @@ class Prepared_statement: public Statement Prepared_statement(THD *thd_arg); virtual ~Prepared_statement(); void setup_set_params(); - virtual Query_arena::Type type() const; - virtual void cleanup_stmt(bool restore_set_statement_vars); + Query_arena::Type type() const override; + bool cleanup_stmt(bool restore_set_statement_vars) override; bool set_name(const LEX_CSTRING *name); inline void close_cursor() { delete cursor; cursor= 0; } inline bool is_in_use() { return flags & (uint) IS_IN_USE; } @@ -1288,7 +1288,8 @@ static bool mysql_test_insert_common(Prepared_statement *stmt, List &values_list, List &update_fields, List &update_values, - enum_duplicates duplic) + enum_duplicates duplic, + bool ignore) { THD *thd= stmt->thd; List_iterator_fast its(values_list); @@ -1324,7 +1325,8 @@ static bool mysql_test_insert_common(Prepared_statement *stmt, } if (mysql_prepare_insert(thd, table_list, fields, values, update_fields, - update_values, duplic, &unused_conds, FALSE)) + update_values, duplic, ignore, + &unused_conds, FALSE)) goto error; value_count= values->elements; @@ -1379,7 +1381,7 @@ static bool mysql_test_insert(Prepared_statement *stmt, List &values_list, List &update_fields, List &update_values, - enum_duplicates duplic) + enum_duplicates duplic, bool ignore) { THD *thd= stmt->thd; @@ -1395,7 +1397,7 @@ static bool mysql_test_insert(Prepared_statement *stmt, } return mysql_test_insert_common(stmt, table_list, fields, values_list, - update_fields, update_values, duplic); + update_fields, update_values, duplic, ignore); } @@ -1443,7 +1445,7 @@ static int mysql_test_update(Prepared_statement *stmt, DBUG_ASSERT(update_source_table || table_list->view != 0); DBUG_PRINT("info", ("Switch to multi-update")); /* pass counter value */ - thd->lex->table_count= table_count; + thd->lex->table_count_update= table_count; /* convert to multiupdate */ DBUG_RETURN(2); } @@ -2463,20 +2465,24 @@ static bool check_prepared_statement(Prepared_statement *stmt) goto error; } +#ifdef WITH_WSREP + if (wsrep_sync_wait(thd, sql_command)) + goto error; +#endif switch (sql_command) { case SQLCOM_REPLACE: case SQLCOM_INSERT: res= mysql_test_insert(stmt, tables, lex->field_list, lex->many_values, lex->update_list, lex->value_list, - lex->duplicates); + lex->duplicates, lex->ignore); break; case SQLCOM_LOAD: res= mysql_test_insert_common(stmt, tables, lex->field_list, lex->many_values, lex->update_list, lex->value_list, - lex->duplicates); + lex->duplicates, lex->ignore); break; case SQLCOM_UPDATE: @@ -3139,7 +3145,6 @@ void reinit_stmt_before_use(THD *thd, LEX *lex) } for (; sl; sl= sl->next_select_in_list()) { - sl->parent_lex->in_sum_func= NULL; if (sl->changed_elements & TOUCHED_SEL_COND) { /* remove option which was put by mysql_explain_union() */ @@ -3274,6 +3279,7 @@ void reinit_stmt_before_use(THD *thd, LEX *lex) lex->result->set_thd(thd); } lex->allow_sum_func.clear_all(); + lex->in_sum_func= NULL; DBUG_VOID_RETURN; } @@ -4029,9 +4035,7 @@ Reprepare_observer::report_error(THD *thd) * Server_runnable *******************************************************************/ -Server_runnable::~Server_runnable() -{ -} +Server_runnable::~Server_runnable() = default; /////////////////////////////////////////////////////////////////////////// @@ -4217,19 +4221,20 @@ Query_arena::Type Prepared_statement::type() const } -void Prepared_statement::cleanup_stmt(bool restore_set_statement_vars) +bool Prepared_statement::cleanup_stmt(bool restore_set_statement_vars) { + bool error= false; DBUG_ENTER("Prepared_statement::cleanup_stmt"); DBUG_PRINT("enter",("stmt: %p", this)); if (restore_set_statement_vars) - lex->restore_set_statement_var(); + error= lex->restore_set_statement_var(); thd->rollback_item_tree_changes(); cleanup_items(free_list); thd->cleanup_after_query(); - DBUG_VOID_RETURN; + DBUG_RETURN(error); } @@ -4465,7 +4470,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len) Pass the value true to restore original values of variables modified on handling SET STATEMENT clause. */ - cleanup_stmt(true); + error|= cleanup_stmt(true); thd->restore_backup_statement(this, &stmt_backup); thd->stmt_arena= old_stmt_arena; @@ -4498,6 +4503,8 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len) if (thd->spcont == NULL) general_log_write(thd, COM_STMT_PREPARE, query(), query_length()); } + // The same format as for triggers to compare + hr_prepare_time= my_hrtime(); DBUG_RETURN(error); } @@ -4591,8 +4598,8 @@ Prepared_statement::execute_loop(String *expanded_query, uchar *packet_end) { Reprepare_observer reprepare_observer; - bool error; int reprepare_attempt= 0; + bool error; iterations= FALSE; /* @@ -4611,7 +4618,13 @@ Prepared_statement::execute_loop(String *expanded_query, if (set_parameters(expanded_query, packet, packet_end)) return TRUE; - +#ifdef WITH_WSREP + if (thd->wsrep_delayed_BF_abort) + { + WSREP_DEBUG("delayed BF abort, quitting execute_loop, stmt: %d", id); + return TRUE; + } +#endif /* WITH_WSREP */ reexecute: // Make sure that reprepare() did not create any new Items. DBUG_ASSERT(thd->free_list == NULL); @@ -5274,7 +5287,8 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor) */ log_slow_statement(thd); - lex->restore_set_statement_var(); + error|= lex->restore_set_statement_var(); + /* EXECUTE command has its own dummy "explain data". We don't need it, @@ -5318,7 +5332,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor) } error: - thd->lex->restore_set_statement_var(); + error|= thd->lex->restore_set_statement_var(); flags&= ~ (uint) IS_IN_USE; return error; } @@ -5614,13 +5628,28 @@ class Protocol_local : public Protocol_text MEM_ROOT *alloc; THD *new_thd; Security_context empty_ctx; + ulonglong client_capabilities; + + my_bool do_log_bin; Protocol_local(THD *thd_arg, THD *new_thd_arg, ulong prealloc) : Protocol_text(thd_arg, prealloc), cur_data(0), first_data(0), data_tail(&first_data), alloc(0), - new_thd(new_thd_arg) + new_thd(new_thd_arg), do_log_bin(FALSE) {} + void set_binlog_vars(my_bool *sav_log_bin) + { + *sav_log_bin= thd->variables.sql_log_bin; + thd->variables.sql_log_bin= do_log_bin; + thd->set_binlog_bit(); + } + void restore_binlog_vars(my_bool sav_log_bin) + { + do_log_bin= thd->variables.sql_log_bin; + thd->variables.sql_log_bin= sav_log_bin; + thd->set_binlog_bit(); + } protected: bool net_store_data(const uchar *from, size_t length); bool net_store_data_cs(const uchar *from, size_t length, @@ -6227,13 +6256,20 @@ loc_advanced_command(MYSQL *mysql, enum enum_server_command command, { Ed_connection con(p->thd); Security_context *ctx_orig= p->thd->security_ctx; + ulonglong cap_orig= p->thd->client_capabilities; MYSQL_LEX_STRING sql_text; + my_bool log_bin_orig; + p->set_binlog_vars(&log_bin_orig); + DBUG_ASSERT(current_thd == p->thd); sql_text.str= (char *) arg; sql_text.length= arg_length; p->thd->security_ctx= &p->empty_ctx; + p->thd->client_capabilities= p->client_capabilities; result= con.execute_direct(p, sql_text); + p->thd->client_capabilities= cap_orig; p->thd->security_ctx= ctx_orig; + p->restore_binlog_vars(log_bin_orig); } if (skip_check) result= 0; @@ -6357,6 +6393,7 @@ extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql) THD *thd_orig= current_thd; THD *new_thd; Protocol_local *p; + ulonglong client_flag; DBUG_ENTER("mysql_real_connect_local"); /* Test whether we're already connected */ @@ -6368,6 +6405,9 @@ extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql) mysql->methods= &local_methods; mysql->user= NULL; + client_flag= mysql->options.client_flag; + client_flag|= CLIENT_MULTI_RESULTS;; + client_flag&= ~(CLIENT_COMPRESS | CLIENT_PLUGIN_AUTH); mysql->info_buffer= (char *) my_malloc(PSI_INSTRUMENT_ME, MYSQL_ERRMSG_SIZE, MYF(0)); @@ -6389,6 +6429,10 @@ extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql) new_thd->security_ctx->skip_grants(); new_thd->query_cache_is_applicable= 0; new_thd->variables.wsrep_on= 0; + new_thd->variables.sql_log_bin= 0; + new_thd->set_binlog_bit(); + new_thd->client_capabilities= client_flag; + /* TOSO: decide if we should turn the auditing off for such threads. @@ -6409,6 +6453,7 @@ extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql) { p->empty_ctx.init(); p->empty_ctx.skip_grants(); + p->client_capabilities= client_flag; } mysql->thd= p; diff --git a/sql/sql_prepare.h b/sql/sql_prepare.h index 1a96df85a1972..ff6e986ec8767 100644 --- a/sql/sql_prepare.h +++ b/sql/sql_prepare.h @@ -125,7 +125,7 @@ class Ed_result_set MEM_ROOT *mem_root_arg); /** We don't call member destructors, they all are POD types. */ - ~Ed_result_set() {} + ~Ed_result_set() = default; size_t get_field_count() const { return m_column_count; } diff --git a/sql/sql_priv.h b/sql/sql_priv.h index b5efe53dfa4bb..2f1f716643298 100644 --- a/sql/sql_priv.h +++ b/sql/sql_priv.h @@ -136,8 +136,7 @@ #define OPTION_QUICK (1ULL << 22) // SELECT (for DELETE) #define OPTION_KEEP_LOG (1ULL << 23) // THD, user -/* The following is used to detect a conflict with DISTINCT */ -#define SELECT_ALL (1ULL << 24) // SELECT, user, parser +#define OPTION_EXPLICIT_DEF_TIMESTAMP (1ULL << 24) // THD, user #define OPTION_GTID_BEGIN (1ULL << 25) // GTID BEGIN found in log /** The following can be set when importing tables in a 'wrong order' @@ -180,10 +179,11 @@ #define OPTION_NO_QUERY_CACHE (1ULL << 39) // SELECT, user #define OPTION_PROCEDURE_CLAUSE (1ULL << 40) // Internal usage #define SELECT_NO_UNLOCK (1ULL << 41) // SELECT, intern -#define SELECT_NO_UNLOCK (1ULL << 41) // SELECT, intern #define OPTION_BIN_TMP_LOG_OFF (1ULL << 42) // disable binlog, intern /* Disable commit of binlog. Used to combine many DDL's and DML's as one */ #define OPTION_BIN_COMMIT_OFF (1ULL << 43) +/* The following is used to detect a conflict with DISTINCT */ +#define SELECT_ALL (1ULL << 44) // SELECT, user, parser #define OPTION_LEX_FOUND_COMMENT (1ULL << 0) // intern, parser @@ -234,6 +234,7 @@ #define OPTIMIZER_SWITCH_USE_ROWID_FILTER (1ULL << 33) #define OPTIMIZER_SWITCH_COND_PUSHDOWN_FROM_HAVING (1ULL << 34) #define OPTIMIZER_SWITCH_NOT_NULL_RANGE_SCAN (1ULL << 35) +#define OPTIMIZER_SWITCH_HASH_JOIN_CARDINALITY (1ULL << 36) #define OPTIMIZER_SWITCH_DEFAULT (OPTIMIZER_SWITCH_INDEX_MERGE | \ OPTIMIZER_SWITCH_INDEX_MERGE_UNION | \ @@ -376,6 +377,7 @@ enum enum_parsing_place BEFORE_OPT_LIST, AFTER_LIST, FOR_LOOP_BOUND, + IN_RETURNING, PARSING_PLACE_SIZE /* always should be the last */ }; diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc index 1dfa238de5030..8f0f15a982a0e 100644 --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -33,6 +33,9 @@ #include "debug_sync.h" #include "des_key_file.h" #include "transaction.h" +#ifdef WITH_WSREP +#include "wsrep_mysqld.h" +#endif static void disable_checkpoints(THD *thd); @@ -601,6 +604,7 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables) if (table_list->is_view_or_derived()) continue; if (thd->lex->type & REFRESH_FOR_EXPORT && + table_list->table && !(table_list->table->file->ha_table_flags() & HA_CAN_EXPORT)) { my_error(ER_ILLEGAL_HA, MYF(0),table_list->table->file->table_type(), @@ -608,6 +612,7 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables) goto error_reset_bits; } if (thd->lex->type & REFRESH_READ_LOCK && + table_list->table && table_list->table->file->extra(HA_EXTRA_FLUSH)) goto error_reset_bits; } diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index 094578874a855..5948b8ebc3d5a 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -29,8 +29,9 @@ #include "sql_trigger.h" #include "sql_base.h" // tdc_remove_table, lock_table_names, #include "sql_handler.h" // mysql_ha_rm_tables -#include "sql_statistics.h" +#include "sql_statistics.h" #include "ddl_log.h" +#include "wsrep_mysqld.h" #include "debug.h" /* used to hold table entries for as part of list of renamed temporary tables */ diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 90fdce1b56f22..336e1eeb38e54 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2018, Oracle and/or its affiliates. - Copyright (c) 2008, 2020, MariaDB Corporation + Copyright (c) 2008, 2022, 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 @@ -432,7 +432,7 @@ static int send_file(THD *thd) /** Internal to mysql_binlog_send() routine that recalculates checksum for - 1. FD event (asserted) that needs additional arranment prior sending to slave. + 1. FD event (asserted) that needs additional arrangement prior sending to slave. 2. Start_encryption_log_event whose Ignored flag is set TODO DBUG_ASSERT can be removed if this function is used for more general cases */ @@ -2876,6 +2876,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, info->error= ER_UNKNOWN_ERROR; goto err; } +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("simulate_delay_at_shutdown", { const char act[]= @@ -2884,6 +2885,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act))); };); +#endif /* heartbeat_period from @master_heartbeat_period user variable @@ -2973,12 +2975,14 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, if (should_stop(info)) break; +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("wait_after_binlog_EOF", { const char act[]= "now wait_for signal.rotate_finished"; DBUG_ASSERT(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act))); };); +#endif THD_STAGE_INFO(thd, stage_finished_reading_one_binlog_switching_to_next_binlog); @@ -4119,7 +4123,7 @@ bool mysql_show_binlog_events(THD* thd) binlog_size= s.st_size; if (lex_mi->pos > binlog_size) { - sprintf(errmsg_buf, "Invalid pos specified. Requested from pos:%llu is " + snprintf(errmsg_buf, sizeof(errmsg_buf), "Invalid pos specified. Requested from pos:%llu is " "greater than actual file size:%lu\n", lex_mi->pos, (ulong)s.st_size); errmsg= errmsg_buf; diff --git a/sql/sql_schema.cc b/sql/sql_schema.cc index 0bf4a63c2f852..f08204d272d71 100644 --- a/sql/sql_schema.cc +++ b/sql/sql_schema.cc @@ -32,6 +32,14 @@ class Schema_oracle: public Schema return thd->type_handler_for_datetime(); return src; } + + Item *make_item_func_replace(THD *thd, + Item *subj, + Item *find, + Item *replace) const; + Item *make_item_func_substr(THD *thd, + const Lex_substring_spec_st &spec) const; + Item *make_item_func_trim(THD *thd, const Lex_trim_st &spec) const; }; @@ -78,3 +86,56 @@ Schema *Schema::find_implied(THD *thd) return &maxdb_schema; return &mariadb_schema; } + + +Item *Schema::make_item_func_replace(THD *thd, + Item *subj, + Item *find, + Item *replace) const +{ + return new (thd->mem_root) Item_func_replace(thd, subj, find, replace); +} + + +Item *Schema::make_item_func_substr(THD *thd, + const Lex_substring_spec_st &spec) const +{ + return spec.m_for ? + new (thd->mem_root) Item_func_substr(thd, spec.m_subject, spec.m_from, + spec.m_for) : + new (thd->mem_root) Item_func_substr(thd, spec.m_subject, spec.m_from); +} + + +Item *Schema::make_item_func_trim(THD *thd, const Lex_trim_st &spec) const +{ + return spec.make_item_func_trim_std(thd); +} + + +Item *Schema_oracle::make_item_func_replace(THD *thd, + Item *subj, + Item *find, + Item *replace) const +{ + return new (thd->mem_root) Item_func_replace_oracle(thd, subj, find, replace); +} + + +Item *Schema_oracle::make_item_func_substr(THD *thd, + const Lex_substring_spec_st &spec) const +{ + return spec.m_for ? + new (thd->mem_root) Item_func_substr_oracle(thd, spec.m_subject, + spec.m_from, + spec.m_for) : + new (thd->mem_root) Item_func_substr_oracle(thd, spec.m_subject, + spec.m_from); +} + + +Item *Schema_oracle::make_item_func_trim(THD *thd, + const Lex_trim_st &spec) const +{ + return spec.make_item_func_trim_oracle(thd); +} diff --git a/sql/sql_schema.h b/sql/sql_schema.h index 886a115cbc557..0258ff2dc97ea 100644 --- a/sql/sql_schema.h +++ b/sql/sql_schema.h @@ -26,13 +26,24 @@ class Schema Schema(const LEX_CSTRING &name) :m_name(name) { } - virtual ~Schema() { } + virtual ~Schema() = default; const LEX_CSTRING &name() const { return m_name; } virtual const Type_handler *map_data_type(THD *thd, const Type_handler *src) const { return src; } + + // Builders for native SQL function with a special syntax in sql_yacc.yy + virtual Item *make_item_func_replace(THD *thd, + Item *subj, + Item *find, + Item *replace) const; + virtual Item *make_item_func_substr(THD *thd, + const Lex_substring_spec_st &spec) const; + + virtual Item *make_item_func_trim(THD *thd, const Lex_trim_st &spec) const; + /* For now we have *hard-coded* compatibility schemas: schema_mariadb, schema_oracle, schema_maxdb. diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 56cb4ce804223..bf1732ade6b79 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB Corporation. + Copyright (c) 2009, 2022, 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 @@ -67,6 +67,7 @@ #include "select_handler.h" #include "my_json_writer.h" #include "opt_trace.h" +#include "derived_handler.h" #include "create_tmp_table.h" /* @@ -111,12 +112,19 @@ static void optimize_straight_join(JOIN *join, table_map join_tables); static bool greedy_search(JOIN *join, table_map remaining_tables, uint depth, uint prune_level, uint use_cond_selectivity); -static bool best_extension_by_limited_search(JOIN *join, - table_map remaining_tables, - uint idx, double record_count, - double read_time, uint depth, - uint prune_level, - uint use_cond_selectivity); +enum enum_best_search { + SEARCH_ABORT= -2, + SEARCH_ERROR= -1, + SEARCH_OK= 0, + SEARCH_FOUND_EDGE=1 +}; +static enum_best_search +best_extension_by_limited_search(JOIN *join, + table_map remaining_tables, + uint idx, double record_count, + double read_time, uint depth, + uint prune_level, + uint use_cond_selectivity); static uint determine_search_depth(JOIN* join); C_MODE_START static int join_tab_cmp(const void *dummy, const void* ptr1, const void* ptr2); @@ -232,9 +240,7 @@ static bool test_if_cheaper_ordering(const JOIN_TAB *tab, ha_rows *new_select_limit, uint *new_used_key_parts= NULL, uint *saved_best_key_parts= NULL); -static int test_if_order_by_key(JOIN *join, - ORDER *order, TABLE *table, uint idx, - uint *used_key_parts); +static int test_if_order_by_key(JOIN *, ORDER *, TABLE *, uint, uint *); static bool test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order, ha_rows select_limit, bool no_changes, const key_map *map); @@ -244,10 +250,12 @@ static bool find_field_in_item_list (Field *field, void *data); static bool find_field_in_order_list (Field *field, void *data); int create_sort_index(THD *thd, JOIN *join, JOIN_TAB *tab, Filesort *fsort); static int remove_dup_with_compare(THD *thd, TABLE *entry, Field **field, - Item *having); + SORT_FIELD *sortorder, ulong keylength, + Item *having); static int remove_dup_with_hash_index(THD *thd,TABLE *table, - uint field_count, Field **first_field, - ulong key_length,Item *having); + uint field_count, Field **first_field, + SORT_FIELD *sortorder, + ulong key_length,Item *having); static bool cmp_buffer_with_ref(THD *thd, TABLE *table, TABLE_REF *tab_ref); static bool setup_new_fields(THD *thd, List &fields, List &all_fields, ORDER *new_order); @@ -306,6 +314,9 @@ static Item **get_sargable_cond(JOIN *join, TABLE *table); bool is_eq_cond_injected_for_split_opt(Item_func_eq *eq_item); +void print_list_item(String *str, List_item *list, + enum_query_type query_type); + static bool build_notnull_conds_for_range_scans(JOIN *join, COND *cond, table_map allowed); @@ -384,6 +395,8 @@ POSITION::POSITION() range_rowid_filter_info= 0; ref_depend_map= dups_producing_tables= 0; inner_tables_handled_with_other_sjs= 0; + type= JT_UNKNOWN; + key_dependent= 0; dups_weedout_picker.set_empty(); firstmatch_picker.set_empty(); loosescan_picker.set_empty(); @@ -399,7 +412,7 @@ void JOIN::init(THD *thd_arg, List &fields_arg, table_count= 0; top_join_tab_count= 0; const_tables= 0; - const_table_map= found_const_table_map= 0; + const_table_map= found_const_table_map= not_usable_rowid_map= 0; aggr_tables= 0; eliminated_tables= 0; join_list= 0; @@ -424,7 +437,6 @@ void JOIN::init(THD *thd_arg, List &fields_arg, no_order= 0; simple_order= 0; simple_group= 0; - rand_table_in_field_list= 0; ordered_index_usage= ordered_index_void; need_distinct= 0; skip_sort_order= 0; @@ -778,7 +790,22 @@ void remove_redundant_subquery_clauses(st_select_lex *subq_select_lex) Here SUBQ cannot be removed. */ if (!ord->in_field_list) + { (*ord->item)->walk(&Item::eliminate_subselect_processor, FALSE, NULL); + /* + Remove from the JOIN::all_fields list any reference to the elements + of the eliminated GROUP BY list unless it is 'in_field_list'. + This is needed in order not to confuse JOIN::make_aggr_tables_info() + when it constructs different structure for execution phase. + */ + List_iterator li(subq_select_lex->join->all_fields); + Item *item; + while ((item= li++)) + { + if (item == *ord->item) + li.remove(); + } + } } subq_select_lex->join->group_list= NULL; subq_select_lex->group_list.empty(); @@ -899,8 +926,10 @@ void vers_select_conds_t::print(String *str, enum_query_type query_type) const end.print(str, query_type, STRING_WITH_LEN(" AND ")); break; case SYSTEM_TIME_BEFORE: + start.print(str, query_type, STRING_WITH_LEN(" FOR SYSTEM_TIME BEFORE ")); + break; case SYSTEM_TIME_HISTORY: - DBUG_ASSERT(0); + // nothing to add break; case SYSTEM_TIME_ALL: str->append(STRING_WITH_LEN(" FOR SYSTEM_TIME ALL")); @@ -1298,6 +1327,15 @@ JOIN::prepare(TABLE_LIST *tables_init, COND *conds_init, uint og_num, /* Fix items that requires the join structure to exist */ fix_items_after_optimize(thd, select_lex); + /* + It is hack which force creating EXPLAIN object always on runt-time arena + (because very top JOIN::prepare executes always with runtime arena, but + constant subquery like (SELECT 'x') can be called with statement arena + during prepare phase of top SELECT). + */ + if (!(thd->lex->context_analysis_only & CONTEXT_ANALYSIS_ONLY_PREPARE)) + create_explain_query_if_not_exists(thd->lex, thd->mem_root); + if (select_lex->handle_derived(thd->lex, DT_PREPARE)) DBUG_RETURN(-1); @@ -1398,7 +1436,6 @@ JOIN::prepare(TABLE_LIST *tables_init, COND *conds_init, uint og_num, &all_fields, &select_lex->pre_fix, 1)) DBUG_RETURN(-1); thd->lex->current_select->context_analysis_place= save_place; - rand_table_in_field_list= select_lex->select_list_tables & RAND_TABLE_BIT; if (setup_without_group(thd, ref_ptrs, tables_list, select_lex->leaf_tables, fields_list, @@ -1730,7 +1767,8 @@ bool JOIN::prepare_stage2() #endif if (select_lex->olap == ROLLUP_TYPE && rollup_init()) goto err; - if (alloc_func_list()) + if (alloc_func_list() || + make_sum_func_list(all_fields, fields_list, false)) goto err; res= FALSE; @@ -1784,7 +1822,6 @@ bool JOIN::build_explain() int JOIN::optimize() { int res= 0; - create_explain_query_if_not_exists(thd->lex, thd->mem_root); join_optimization_state init_state= optimization_state; if (select_lex->pushdown_select) { @@ -1971,6 +2008,9 @@ JOIN::optimize_inner() DEBUG_SYNC(thd, "before_join_optimize"); THD_STAGE_INFO(thd, stage_optimizing); +#ifndef DBUG_OFF + dbug_join_tab_array_size= 0; +#endif // rownum used somewhere in query, no limits and it is derived if (unlikely(thd->lex->with_rownum && @@ -2000,7 +2040,6 @@ JOIN::optimize_inner() /* Merge all mergeable derived tables/views in this SELECT. */ if (select_lex->handle_derived(thd->lex, DT_MERGE)) DBUG_RETURN(TRUE); - table_count= select_lex->leaf_tables.elements; } if (select_lex->first_cond_optimization && @@ -2048,8 +2087,6 @@ JOIN::optimize_inner() eval_select_list_used_tables(); - table_count= select_lex->leaf_tables.elements; - if (select_lex->options & OPTION_SCHEMA_TABLE && optimize_schema_tables_memory_usage(select_lex->leaf_tables)) DBUG_RETURN(1); @@ -2191,6 +2228,9 @@ JOIN::optimize_inner() ignore_on_expr= true; break; } + + transform_in_predicates_into_equalities(thd); + conds= optimize_cond(this, conds, join_list, ignore_on_expr, &cond_value, &cond_equal, OPT_LINK_EQUAL_FIELDS); @@ -2361,7 +2401,21 @@ JOIN::optimize_inner() If all items were resolved by opt_sum_query, there is no need to open any tables. */ - if ((res=opt_sum_query(thd, select_lex->leaf_tables, all_fields, conds))) + + /* + The following resetting and restoring of sum_funcs is needed to + go around a bug in spider where it assumes that + make_sum_func_list() has not been called yet and do logical + choices based on this if special handling of min/max functions should + be done. We disable this special handling while we are trying to find + out if we can replace MIN/MAX values with constants. + */ + Item_sum **save_func_sums= sum_funcs, *tmp_sum_funcs= 0; + sum_funcs= &tmp_sum_funcs; + res= opt_sum_query(thd, select_lex->leaf_tables, all_fields, conds); + sum_funcs= save_func_sums; + + if (res) { DBUG_ASSERT(res >= 0); if (res == HA_ERR_KEY_NOT_FOUND) @@ -2425,7 +2479,7 @@ JOIN::optimize_inner() /* We have to remove constants and duplicates from group_list before calling make_join_statistics() as this may call get_best_group_min_max() - which needs a simplfied group_list. + which needs a simplified group_list. */ if (group_list && table_count == 1) { @@ -2959,18 +3013,14 @@ int JOIN::optimize_stage2() } /* - Remove ORDER BY in the following cases: - - GROUP BY is more specific. Example GROUP BY a, b ORDER BY a - - If there are aggregate functions and no GROUP BY, this always leads - to one row result, no point in sorting. + We can ignore ORDER BY if it's a prefix of the GROUP BY list + (as MariaDB is by default sorting on GROUP BY) or + if there is no GROUP BY and aggregate functions are used + (as the result will only contain one row). */ - if (test_if_subpart(group_list, order) || - (!group_list && tmp_table_param.sum_func_count)) - { - order= 0; - if (is_indexed_agg_distinct(this, NULL)) - sort_and_group= 0; - } + if (order && (test_if_subpart(group_list, order) || + (!group_list && tmp_table_param.sum_func_count))) + order=0; // Can't use sort on head table if using join buffering if (full_join || hash_join) @@ -3002,7 +3052,6 @@ int JOIN::optimize_stage2() if (select_lex->have_window_funcs()) simple_order= FALSE; - /* If the hint FORCE INDEX FOR ORDER BY/GROUP BY is used for the table whose columns are required to be returned in a sorted order, then @@ -3258,10 +3307,21 @@ int JOIN::optimize_stage2() { if (!(join_tab= (JOIN_TAB*) thd->alloc(sizeof(JOIN_TAB)))) DBUG_RETURN(1); +#ifndef DBUG_OFF + dbug_join_tab_array_size= 1; +#endif need_tmp= 1; } if (make_aggr_tables_info()) DBUG_RETURN(1); + + /* + It could be that we've only done optimization stage 1 for + some of the derived tables, and never did stage 2. + Do it now, otherwise Explain data structure will not be complete. + */ + if (select_lex->handle_derived(thd->lex, DT_OPTIMIZE)) + DBUG_RETURN(1); } /* Even with zero matching rows, subqueries in the HAVING clause may @@ -3459,7 +3519,8 @@ bool JOIN::make_aggr_tables_info() if (gbh) { - if (!(pushdown_query= new (thd->mem_root) Pushdown_query(select_lex, gbh))) + if (!(pushdown_query= new (thd->mem_root) Pushdown_query(select_lex, + gbh))) DBUG_RETURN(1); /* We must store rows in the tmp table if we need to do an ORDER BY @@ -3479,6 +3540,7 @@ bool JOIN::make_aggr_tables_info() if (!(curr_tab->tmp_table_param= new TMP_TABLE_PARAM(tmp_table_param))) DBUG_RETURN(1); + curr_tab->tmp_table_param->func_count= all_fields.elements; TABLE* table= create_tmp_table(thd, curr_tab->tmp_table_param, all_fields, NULL, distinct, @@ -3563,6 +3625,7 @@ bool JOIN::make_aggr_tables_info() { aggr_tables++; curr_tab= join_tab + exec_join_tab_cnt(); + DBUG_ASSERT(curr_tab - join_tab < dbug_join_tab_array_size); bzero((void*)curr_tab, sizeof(JOIN_TAB)); curr_tab->ref.key= -1; if (only_const_tables()) @@ -3672,15 +3735,26 @@ bool JOIN::make_aggr_tables_info() /* If we have different sort & group then we must sort the data by group - and copy it to another tmp table + and copy it to another tmp table. + This code is also used if we are using distinct something we haven't been able to store in the temporary table yet like SEC_TO_TIME(SUM(...)). + + 3. Also, this is used when + - the query has Window functions, + - the GROUP BY operation is done with OrderedGroupBy algorithm. + In this case, the first temptable will contain pre-GROUP-BY data. Force + the creation of the second temporary table. Post-GROUP-BY dataset will be + written there, and then Window Function processing code will be able to + process it. */ if ((group_list && (!test_if_subpart(group_list, order) || select_distinct)) || - (select_distinct && tmp_table_param.using_outer_summary_function)) - { /* Must copy to another table */ + (select_distinct && tmp_table_param.using_outer_summary_function) || + (group_list && !tmp_table_param.quick_group && // (3) + select_lex->have_window_funcs())) // (3) + { /* Must copy to another table */ DBUG_PRINT("info",("Creating group table")); calc_group_buffer(this, group_list); @@ -3691,6 +3765,7 @@ bool JOIN::make_aggr_tables_info() curr_tab++; aggr_tables++; + DBUG_ASSERT(curr_tab - join_tab < dbug_join_tab_array_size); bzero((void*)curr_tab, sizeof(JOIN_TAB)); curr_tab->ref.key= -1; @@ -3727,7 +3802,7 @@ bool JOIN::make_aggr_tables_info() // for the first table if (group_list || tmp_table_param.sum_func_count) { - if (make_sum_func_list(*curr_all_fields, *curr_fields_list, true, true)) + if (make_sum_func_list(*curr_all_fields, *curr_fields_list, true)) DBUG_RETURN(true); if (prepare_sum_aggregators(thd, sum_funcs, !join_tab->is_using_agg_loose_index_scan())) @@ -3837,7 +3912,7 @@ bool JOIN::make_aggr_tables_info() last_tab->all_fields= &tmp_all_fields3; last_tab->fields= &tmp_fields_list3; } - if (make_sum_func_list(*curr_all_fields, *curr_fields_list, true, true)) + if (make_sum_func_list(*curr_all_fields, *curr_fields_list, true)) DBUG_RETURN(true); if (prepare_sum_aggregators(thd, sum_funcs, !join_tab || @@ -4019,12 +4094,9 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List *table_fields, tab->join= this; DBUG_ASSERT(tab > tab->join->join_tab || !top_join_tab_count || !tables_list); + tab->table= table; if (tab > join_tab) (tab - 1)->next_select= sub_select_postjoin_aggr; - if (!(tab->aggr= new (thd->mem_root) AGGR_OP(tab))) - goto err; - tab->table= table; - table->reginfo.join_tab= tab; /* if group or order on first table, sort first */ if ((group_list && simple_group) || @@ -4054,8 +4126,6 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List *table_fields, } else { - if (make_sum_func_list(all_fields, fields_list, false)) - goto err; if (prepare_sum_aggregators(thd, sum_funcs, !join_tab->is_using_agg_loose_index_scan())) goto err; @@ -4075,12 +4145,15 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List *table_fields, order= NULL; } } - + if (!(tab->aggr= new (thd->mem_root) AGGR_OP(tab))) + goto err; + table->reginfo.join_tab= tab; DBUG_RETURN(false); err: if (table != NULL) free_tmp_table(thd, table); + tab->table= NULL; DBUG_RETURN(true); } @@ -4100,7 +4173,7 @@ JOIN::optimize_distinct() } /* Optimize "select distinct b from t1 order by key_part_1 limit #" */ - if (order && skip_sort_order) + if (order && skip_sort_order && !unit->lim.is_with_ties()) { /* Should already have been optimized away */ DBUG_ASSERT(ordered_index_usage == ordered_index_order_by); @@ -5738,7 +5811,7 @@ make_join_statistics(JOIN *join, List &tables_list, /* Perform range analysis if there are keys it could use (1). Don't do range analysis for materialized subqueries (2). - Don't do range analysis for materialized derived tables (3) + Don't do range analysis for materialized derived tables/views (3) */ if ((!s->const_keys.is_clear_all() || !bitmap_is_clear_all(&s->table->cond_set)) && // (1) @@ -5806,7 +5879,7 @@ make_join_statistics(JOIN *join, List &tables_list, caller to abort with a zero row result. */ TABLE_LIST *emb= s->table->pos_in_table_list->embedding; - if (emb && !emb->sj_on_expr) + if (emb && !emb->sj_on_expr && !*s->on_expr_ref) { /* Mark all tables in a multi-table join nest as const */ mark_join_nest_as_const(join, emb, &found_const_table_map, @@ -6264,7 +6337,11 @@ add_key_field(JOIN *join, Field IN ... */ if (field->flags & PART_KEY_FLAG) - stat[0].key_dependent|=used_tables; + { + stat[0].key_dependent|= used_tables; + if (field->key_start.bits_set()) + stat[0].key_start_dependent= 1; + } bool is_const=1; for (uint i=0; ielements-1 ; i++,use++) { if (!use->is_for_hash_join()) @@ -7308,8 +7386,7 @@ void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array) Check for the presence of AGGFN(DISTINCT a) queries that may be subject to loose index scan. - - Check if the query is a subject to AGGFN(DISTINCT) using loose index scan + Check if the query is a subject to AGGFN(DISTINCT) using loose index scan (QUICK_GROUP_MIN_MAX_SELECT). Optionally (if out_args is supplied) will push the arguments of AGGFN(DISTINCT) to the list @@ -7342,14 +7419,11 @@ is_indexed_agg_distinct(JOIN *join, List *out_args) Item_sum **sum_item_ptr; bool result= false; - if (join->table_count != 1 || /* reference more than 1 table */ + if (join->table_count != 1 || /* reference more than 1 table */ join->select_distinct || /* or a DISTINCT */ join->select_lex->olap == ROLLUP_TYPE) /* Check (B3) for ROLLUP */ return false; - if (join->make_sum_func_list(join->all_fields, join->fields_list, true)) - return false; - Bitmap first_aggdistinct_fields; bool first_aggdistinct_fields_initialized= false; for (sum_item_ptr= join->sum_funcs; *sum_item_ptr; sum_item_ptr++) @@ -7451,16 +7525,23 @@ add_group_and_distinct_keys(JOIN *join, JOIN_TAB *join_tab) while ((item= select_items_it++)) item->walk(&Item::collect_item_field_processor, 0, &indexed_fields); } - else if (join->tmp_table_param.sum_func_count && - is_indexed_agg_distinct(join, &indexed_fields)) + else if (!join->tmp_table_param.sum_func_count || + !is_indexed_agg_distinct(join, &indexed_fields)) { - join->sort_and_group= 1; - } - else + /* + There where no GROUP BY fields and also either no aggregate + functions or not all aggregate functions where used with the + same DISTINCT (or MIN() / MAX() that works similarly). + Nothing to do there. + */ return; + } if (indexed_fields.elements == 0) + { + /* There where no index we could use to satisfy the GROUP BY */ return; + } /* Intersect the keys of all group fields. */ cur_item= indexed_fields_it++; @@ -7489,6 +7570,7 @@ void set_position(JOIN *join,uint idx,JOIN_TAB *table,KEYUSE *key) join->positions[idx].records_read=1.0; /* This is a const table */ join->positions[idx].cond_selectivity= 1.0; join->positions[idx].ref_depend_map= 0; + join->positions[idx].partial_join_cardinality= 1; // join->positions[idx].loosescan_key= MAX_KEY; /* Not a LooseScan */ join->positions[idx].sj_strategy= SJ_OPT_NONE; @@ -7506,6 +7588,7 @@ void set_position(JOIN *join,uint idx,JOIN_TAB *table,KEYUSE *key) } join->best_ref[idx]=table; join->positions[idx].spl_plan= 0; + join->positions[idx].spl_pd_boundary= 0; } @@ -7513,20 +7596,28 @@ void set_position(JOIN *join,uint idx,JOIN_TAB *table,KEYUSE *key) Estimate how many records we will get if we read just this table and apply a part of WHERE that can be checked for it. + @param s Current JOIN_TAB + @param use_cond_selectivity Value of optimizer_use_condition_selectivity. + If > 1 then use table->cond_selecitivity. + @param force_estiamte Set to 1 if we should not call + use_found_constraint. To be deleted in 11.0 + @return 0.0 No matching rows + @return >= 1.0 Number of expected matching rows + @detail Estimate how many records we will get if we - read the given table with its "independent" access method (either quick select or full table/index scan), - apply the part of WHERE that refers only to this table. - @seealso + @see also table_cond_selectivity() produces selectivity of condition that is checked after joining rows from this table to rows from preceding tables. */ -inline -double matching_candidates_in_table(JOIN_TAB *s, bool with_found_constraint, - uint use_cond_selectivity) +static double apply_selectivity_for_table(JOIN_TAB *s, + uint use_cond_selectivity, + bool *force_estimate) { ha_rows records; double dbl_records; @@ -7537,34 +7628,47 @@ double matching_candidates_in_table(JOIN_TAB *s, bool with_found_constraint, double sel= table->cond_selectivity; double table_records= rows2double(s->records); dbl_records= table_records * sel; + *force_estimate= 1; // Don't call use_found_constraint() return dbl_records; } records = s->found_records; /* - If there is a filtering condition on the table (i.e. ref analyzer found - at least one "table.keyXpartY= exprZ", where exprZ refers only to tables - preceding this table in the join order we're now considering), then - assume that 25% of the rows will be filtered out by this condition. - - This heuristic is supposed to force tables used in exprZ to be before - this table in join order. + If applicable, get a more accurate estimate. */ - if (with_found_constraint) - records-= records/4; - - /* - If applicable, get a more accurate estimate. Don't use the two - heuristics at once. - */ + DBUG_ASSERT(s->table->opt_range_condition_rows <= s->found_records); if (s->table->opt_range_condition_rows != s->found_records) + { + *force_estimate= 1; // Don't call use_found_constraint() records= s->table->opt_range_condition_rows; + } dbl_records= (double)records; return dbl_records; } +/* + Take into account that the table's WHERE clause has conditions on earlier + tables that can reduce the number of accepted rows. + + @param records Number of original rows (after selectivity) + + If there is a filtering condition on the table (i.e. ref analyzer found + at least one "table.keyXpartY= exprZ", where exprZ refers only to tables + preceding this table in the join order we're now considering), then + assume that 25% of the rows will be filtered out by this condition. + + This heuristic is supposed to force tables used in exprZ to be before + this table in join order. +*/ + +inline double use_found_constraint(double records) +{ + records-= records/4; + return records; +} + /* Calculate the cost of reading a set of rows trough an index @@ -7605,7 +7709,7 @@ double cost_for_index_read(const THD *thd, const TABLE *table, uint key, Adjust cost from table->quick_costs calculated by multi_range_read_info_const() to be comparable with cost_for_index_read() - This functions is needed because best_access_patch doesn't add + This functions is needed because best_access_path() doesn't add TIME_FOR_COMPARE to it's costs until very late. Preferably we should fix so that all costs are comparably. (All compared costs should include TIME_FOR_COMPARE for all found @@ -7621,6 +7725,92 @@ double adjust_quick_cost(double quick_cost, ha_rows records) } +/* + @brief + Compute the fanout of hash join operation using EITS data +*/ + +double hash_join_fanout(JOIN *join, JOIN_TAB *s, table_map remaining_tables, + double rnd_records, KEYUSE *hj_start_key, + bool *stats_found) +{ + THD *thd= join->thd; + /* + Before doing the hash join, we will scan the table and apply the local part + of the WHERE condition. This will produce rnd_records. + + The EITS statistics describes the entire table. Calling + + table->field[N]->get_avg_frequency() + + produces average #rows in the table with some value. + + What happens if we filter out rows so that rnd_records rows are left? + Something between the two outcomes: + A. filtering removes a fraction of rows for each value: + avg_frequency=avg_frequency * condition_selectivity + + B. filtering removes entire groups of rows with the same value, but + the remaining groups remain of the same size. + + We make pessimistic assumption and assume B. + We also handle an edge case: if rnd_records is less than avg_frequency, + assume we'll get rnd_records rows with the same value, and return + rnd_records as the fanout estimate. + */ + double min_freq= rnd_records; + + Json_writer_object trace_obj(thd, "hash_join_cardinality"); + /* + There can be multiple KEYUSE referring to same or different columns + + KEYUSE(tbl.col1 = ...) + KEYUSE(tbl.col1 = ...) + KEYUSE(tbl.col2 = ...) + + Hash join code can use multiple columns: (col1, col2) for joining. + We need n_distinct({col1, col2}). + + EITS only has statistics on individual columns: n_distinct(col1), + n_distinct(col2). + + Our current solution is to be very conservative and use selectivity + of one column with the lowest avg_frequency. + + In the future, we should an approach that cautiosly takes into account + multiple KEYUSEs either multiply by number of equalities or by sqrt + of the second most selective equality. + */ + Json_writer_array trace_arr(thd, "hash_join_columns"); + for (KEYUSE *keyuse= hj_start_key; + keyuse->table == s->table && is_hash_join_key_no(keyuse->key); + keyuse++) + { + if (!(remaining_tables & keyuse->used_tables) && + (!keyuse->validity_ref || *keyuse->validity_ref) && + s->access_from_tables_is_allowed(keyuse->used_tables, + join->sjm_lookup_tables)) + { + Field *field= s->table->field[keyuse->keypart]; + if (is_eits_usable(field)) + { + double freq= field->read_stats->get_avg_frequency(); + + Json_writer_object trace_field(thd); + trace_field.add("field",field->field_name.str). + add("avg_frequency", freq); + if (freq < min_freq) + min_freq= freq; + *stats_found= 1; + } + } + } + trace_arr.end(); + trace_obj.add("rows", min_freq); + return min_freq; +} + + /** Find the best access path for an extension of a partial execution plan and add this path to the plan. @@ -7668,14 +7858,24 @@ best_access_path(JOIN *join, double best= DBL_MAX; double best_time= DBL_MAX; double records= DBL_MAX; + ha_rows records_for_key= 0; table_map best_ref_depends_map= 0; + /* + key_dependent is 0 if all key parts could be used or if there was an + EQ_REF table found (which uses all key parts). In other words, we cannot + find a better key for the table even if remaining_tables is reduced. + Otherwise it's a bitmap of tables that could improve key usage. + */ + table_map key_dependent= 0; Range_rowid_filter_cost_info *best_filter= 0; double tmp; + double keyread_tmp= 0; ha_rows rec; bool best_uses_jbuf= FALSE; MY_BITMAP *eq_join_set= &s->table->eq_join_set; KEYUSE *hj_start_key= 0; SplM_plan_info *spl_plan= 0; + table_map spl_pd_boundary= 0; Range_rowid_filter_cost_info *filter= 0; const char* cause= NULL; enum join_type best_type= JT_UNKNOWN, type= JT_UNKNOWN; @@ -7692,9 +7892,11 @@ best_access_path(JOIN *join, loose_scan_opt.init(join, s, remaining_tables); if (s->table->is_splittable()) - spl_plan= s->choose_best_splitting(record_count, remaining_tables); - Json_writer_array trace_paths(thd, "considered_access_paths"); + spl_plan= s->choose_best_splitting(idx, + remaining_tables, + &spl_pd_boundary); + Json_writer_array trace_paths(thd, "considered_access_paths"); if (s->keyuse) { /* Use key if possible */ KEYUSE *keyuse; @@ -7720,6 +7922,8 @@ best_access_path(JOIN *join, key_part_map const_part= 0; /* The or-null keypart in ref-or-null access: */ key_part_map ref_or_null_part= 0; + key_part_map all_parts= 0; + if (is_hash_join_key_no(key)) { /* @@ -7751,15 +7955,16 @@ best_access_path(JOIN *join, do /* For each keypart */ { uint keypart= keyuse->keypart; - table_map best_part_found_ref= 0; + table_map best_part_found_ref= 0, key_parts_dependent= 0; double best_prev_record_reads= DBL_MAX; - + do /* For each way to access the keypart */ { /* if 1. expression doesn't refer to forward tables 2. we won't get two ref-or-null's */ + all_parts|= keyuse->keypart_map; if (!(remaining_tables & keyuse->used_tables) && (!keyuse->validity_ref || *keyuse->validity_ref) && s->access_from_tables_is_allowed(keyuse->used_tables, @@ -7768,6 +7973,7 @@ best_access_path(JOIN *join, KEY_OPTIMIZE_REF_OR_NULL))) { found_part|= keyuse->keypart_map; + key_parts_dependent= 0; if (!(keyuse->used_tables & ~join->const_table_map)) const_part|= keyuse->keypart_map; @@ -7790,10 +7996,16 @@ best_access_path(JOIN *join, if (keyuse->optimize & KEY_OPTIMIZE_REF_OR_NULL) ref_or_null_part |= keyuse->keypart_map; } + else if (!(found_part & keyuse->keypart_map)) + key_parts_dependent|= keyuse->used_tables; + loose_scan_opt.add_keyuse(remaining_tables, keyuse); keyuse++; } while (keyuse->table == table && keyuse->key == key && keyuse->keypart == keypart); + /* If we found a usable key, remember the dependent tables */ + if (all_parts & 1) + key_dependent|= key_parts_dependent; found_ref|= best_part_found_ref; } while (keyuse->table == table && keyuse->key == key); @@ -7847,11 +8059,13 @@ best_access_path(JOIN *join, type= JT_EQ_REF; trace_access_idx.add("access_type", join_type_str[type]) .add("index", keyinfo->name); + if (!found_ref && table->opt_range_keys.is_set(key)) tmp= adjust_quick_cost(table->opt_range[key].cost, 1); else tmp= table->file->avg_io_cost(); - tmp*= prev_record_reads(join_positions, idx, found_ref); + tmp*= prev_record_reads(join_positions, idx, + found_ref); records=1.0; } else @@ -7943,8 +8157,12 @@ best_access_path(JOIN *join, /* Limit the number of matched rows */ tmp= cost_for_index_read(thd, table, key, (ha_rows) records, (ha_rows) s->worst_seeks); + records_for_key= (ha_rows) records; + set_if_smaller(records_for_key, thd->variables.max_seeks_for_key); + keyread_tmp= table->file->keyread_time(key, 1, records_for_key); got_cost: tmp= COST_MULT(tmp, record_count); + keyread_tmp= COST_MULT(keyread_tmp, record_count); } } else @@ -8118,12 +8336,14 @@ best_access_path(JOIN *join, } /* Limit the number of matched rows */ - tmp= records; - set_if_smaller(tmp, (double) thd->variables.max_seeks_for_key); - tmp= cost_for_index_read(thd, table, key, (ha_rows) tmp, + tmp= cost_for_index_read(thd, table, key, (ha_rows) records, (ha_rows) s->worst_seeks); + records_for_key= (ha_rows) records; + set_if_smaller(records_for_key, thd->variables.max_seeks_for_key); + keyread_tmp= table->file->keyread_time(key, 1, records_for_key); got_cost2: tmp= COST_MULT(tmp, record_count); + keyread_tmp= COST_MULT(keyread_tmp, record_count); } else { @@ -8139,16 +8359,85 @@ best_access_path(JOIN *join, } /* not ft_key */ if (records < DBL_MAX && - (found_part & 1)) // start_key->key can be used for index access + (found_part & 1) && // start_key->key can be used for index access + (table->file->index_flags(start_key->key,0,1) & + HA_DO_RANGE_FILTER_PUSHDOWN)) { double rows= record_count * records; - double access_cost_factor= MY_MIN(tmp / rows, 1.0); - filter= - table->best_range_rowid_filter_for_partial_join(start_key->key, rows, - access_cost_factor); + /* + If we use filter F with selectivity s the the cost of fetching data + by key using this filter will be + cost_of_fetching_1_row * rows * s + + cost_of_fetching_1_key_tuple * rows * (1 - s) + + cost_of_1_lookup_into_filter * rows + Without using any filter the cost would be just + cost_of_fetching_1_row * rows + + So the gain in access cost per row will be + cost_of_fetching_1_row * (1 - s) - + cost_of_fetching_1_key_tuple * (1 - s) - + cost_of_1_lookup_into_filter + = + (cost_of_fetching_1_row - cost_of_fetching_1_key_tuple) * (1 - s) + - cost_of_1_lookup_into_filter + + Here we have: + cost_of_fetching_1_row = tmp/rows + cost_of_fetching_1_key_tuple = keyread_tmp/rows + + Here's a more detailed explanation that uses the formulas behind + the function the call filter->get_adjusted_gain(). The function + takes as a parameter the number of probes/look-ups into the filter + that is equal to the number of fetched key entries that is equal to + the number of row fetches when no filter is used (assuming no + index condition pushdown is employed for the used key access). + Let this number be N. Then the total gain from using the filter is + N*a_adj - b where b is the cost of building the filter and + a_adj is calcilated as follows: + a - (1-access_cost_factor)*(1-s) = + (1+1_cond_eval_cost)*(1-s)-1_probe_cost - (1-access_cost_factor)*(1-s) + = (1-s)*(1_cond_eval_cost+access_cost_factor) - 1_probe_cost. + Here ((1-s)*(1_cond_eval_cost) * N is the gain from checking less + conditions pushed into the table, 1_probe_cost*N is the cost of the + probes and (1*s) * access_cost_factor * N must be the gain from + accessing less rows. + It does not matter how we calculate the cost of N full row fetches + cost_of_fetching_N_rows or + how we calculate the cost of fetching N key entries + cost_of_fetching_N_key_entries + the gain from less row fetches will be + (cost_of_fetching_N_rows - cost_of_fetching_N_key_entries) * (1-s) + and this should be equal to (1*s) * access_cost_factor * N. + Thus access_cost_factor must be calculated as + (cost_of_fetching_N_rows - cost_of_fetching_N_key_entries) / N. + + For safety we clip cost_of_fetching_N_key_entries by the value + of cost_of_fetching_N_row though formally it's not necessary. + */ + /* + For eq_ref access we assume that the cost of fetching N key entries + is equal to the half of fetching N rows + */ + double key_access_cost= + type == JT_EQ_REF ? 0.5 * tmp : MY_MIN(tmp, keyread_tmp); + double access_cost_factor= MY_MIN((tmp - key_access_cost) / rows, 1.0); + + if (!(records < s->worst_seeks && + records <= thd->variables.max_seeks_for_key)) + { + // Don't use rowid filter + trace_access_idx.add("rowid_filter_skipped", "worst/max seeks clipping"); + filter= NULL; + } + else + { + filter= + table->best_range_rowid_filter_for_partial_join(start_key->key, + rows, + access_cost_factor); + } if (filter) - { - filter->get_cmp_gain(rows); + { tmp-= filter->get_adjusted_gain(rows) - filter->get_cmp_gain(rows); DBUG_ASSERT(tmp >= 0); trace_access_idx.add("rowid_filter_key", @@ -8178,6 +8467,27 @@ best_access_path(JOIN *join, } /* for each key */ records= best_records; } + else + { + /* + No usable keys found. However, there may still be an option to use + "Range checked for each record" when all depending tables has + been read. s->key_dependent tells us which tables these could be and + s->key_start_dependent tells us if a first key part was used. + s->key_dependent may include more tables than could be used, + but this is ok as not having any usable keys is a rare thing and + the performance penalty for extra table bits is that + best_extension_by_limited_search() would not be able to prune tables + earlier. + Example query: + SELECT * FROM t1,t2 where t1.key1=t2.key1 OR t2.key2<1 + */ + if (s->key_start_dependent) + key_dependent= s->key_dependent; + } + /* Check that s->key_dependent contains all used_tables found in s->keyuse */ + key_dependent&= ~PSEUDO_TABLE_BITS; + DBUG_ASSERT((key_dependent & s->key_dependent) == key_dependent); /* If there is no key to access the table, but there is an equi-join @@ -8196,11 +8506,46 @@ best_access_path(JOIN *join, (!(s->table->map & join->outer_join) || join->allowed_outer_join_with_cache)) // (2) { - double join_sel= 0.1; + double fanout; + double join_sel; + bool stats_found= 0, force_estimate= 0; + Json_writer_object trace_access_hash(thd); + trace_access_hash.add("type", "hash"); + trace_access_hash.add("index", "hj-key"); /* Estimate the cost of the hash join access to the table */ - double rnd_records= matching_candidates_in_table(s, found_constraint, - use_cond_selectivity); + double rnd_records= apply_selectivity_for_table(s, use_cond_selectivity, + &force_estimate); + + DBUG_ASSERT(hj_start_key); + if (optimizer_flag(thd, OPTIMIZER_SWITCH_HASH_JOIN_CARDINALITY)) + { + /* + Starting from this point, rnd_records should not be used anymore. + Use "fanout" for an estimate of # matching records. + */ + fanout= hash_join_fanout(join, s, remaining_tables, rnd_records, + hj_start_key, &stats_found); + join_sel= 1.0; // Don't do the "10% heuristic" + if (stats_found) + goto fanout_computed; + } + + /* + No OPTIMIZER_SWITCH_HASH_JOIN_CARDINALITY or no field statistics + found. + + Take into account if there is non constant constraints used with + earlier tables in the where expression. + If yes, this will set fanout to rnd_records/4. + We estimate that there will be HASH_FANOUT (10%) + hash matches / row. + */ + if (found_constraint && !force_estimate) + rnd_records= use_found_constraint(rnd_records); + fanout= rnd_records; + join_sel= 0.1; + fanout_computed: tmp= s->quick ? s->quick->read_time : s->scan_time(); double cmp_time= (s->records - rnd_records)/TIME_FOR_COMPARE; tmp= COST_ADD(tmp, cmp_time); @@ -8211,20 +8556,37 @@ best_access_path(JOIN *join, record_count / (double) thd->variables.join_buff_size)); tmp= COST_MULT(tmp, refills); - best_time= COST_ADD(tmp, - COST_MULT((record_count*join_sel) / TIME_FOR_COMPARE, - rnd_records)); + + // Add cost of reading/writing the join buffer + if (optimizer_flag(thd, OPTIMIZER_SWITCH_HASH_JOIN_CARDINALITY)) + { + /* Set it to be 1/10th of TIME_FOR_COMPARE */ + double row_copy_cost= 1.0 / (10*TIME_FOR_COMPARE); + double join_buffer_operations= + COST_ADD( + COST_MULT(record_count, row_copy_cost), + COST_MULT(record_count, fanout * (idx - join->const_tables)) + ); + double jbuf_use_cost= row_copy_cost * join_buffer_operations; + trace_access_hash.add("jbuf_use_cost", jbuf_use_cost); + tmp= COST_ADD(tmp, jbuf_use_cost); + } + + double where_cost= COST_MULT((fanout*join_sel) / TIME_FOR_COMPARE, + record_count); + trace_access_hash.add("extra_cond_check_cost", where_cost); + + best_time= COST_ADD(tmp, where_cost); + best= tmp; - records= rnd_records; + records= fanout; best_key= hj_start_key; best_ref_depends_map= 0; best_uses_jbuf= TRUE; best_filter= 0; best_type= JT_HASH; - Json_writer_object trace_access_hash(thd); - trace_access_hash.add("type", "hash"); - trace_access_hash.add("index", "hj-key"); trace_access_hash.add("rnd_records", rnd_records); + trace_access_hash.add("records", records); trace_access_hash.add("cost", best); trace_access_hash.add("chosen", true); } @@ -8276,9 +8638,13 @@ best_access_path(JOIN *join, !(s->table->force_index && best_key && !s->quick) && // (4) !(best_key && s->table->pos_in_table_list->jtbm_subselect)) // (5) { // Check full join - double rnd_records= matching_candidates_in_table(s, found_constraint, - use_cond_selectivity); - + bool force_estimate= 0; + double rnd_records= apply_selectivity_for_table(s, + use_cond_selectivity, + &force_estimate); + rnd_records= ((found_constraint && !force_estimate) ? + use_found_constraint(rnd_records) : + rnd_records); /* Range optimizer never proposes a RANGE if it isn't better than FULL: so if RANGE is present, it's always preferred to FULL. @@ -8297,23 +8663,31 @@ best_access_path(JOIN *join, access (see first else-branch below), but we don't take it into account here for range/index_merge access. Find out why this is so. */ - double cmp_time= (s->found_records - rnd_records)/TIME_FOR_COMPARE; + double cmp_time= (s->found_records - rnd_records) / TIME_FOR_COMPARE; tmp= COST_MULT(record_count, COST_ADD(s->quick->read_time, cmp_time)); if ( s->quick->get_type() == QUICK_SELECT_I::QS_TYPE_RANGE) { double rows= record_count * s->found_records; - double access_cost_factor= MY_MIN(tmp / rows, 1.0); uint key_no= s->quick->index; + + /* See the comment concerning using rowid filter for with ref access */ + double row_access_cost= s->quick->read_time * record_count; + double key_access_cost= + MY_MIN(row_access_cost, + s->table->opt_range[key_no].index_only_cost * record_count); + double access_cost_factor= MY_MIN((row_access_cost - key_access_cost) / + rows, 1.0); filter= - s->table->best_range_rowid_filter_for_partial_join(key_no, rows, - access_cost_factor); + s->table->best_range_rowid_filter_for_partial_join(key_no, rows, + access_cost_factor); if (filter) { tmp-= filter->get_adjusted_gain(rows); DBUG_ASSERT(tmp >= 0); } + type= JT_RANGE; } else @@ -8404,8 +8778,9 @@ best_access_path(JOIN *join, best_filter= filter; /* range/index_merge/ALL/index access method are "independent", so: */ best_ref_depends_map= 0; - best_uses_jbuf= MY_TEST(!disable_jbuf && !((s->table->map & - join->outer_join))); + best_uses_jbuf= MY_TEST(!disable_jbuf && + (join->allowed_outer_join_with_cache || + !(s->table->map & join->outer_join))); spl_plan= 0; best_type= type; } @@ -8422,12 +8797,16 @@ best_access_path(JOIN *join, pos->records_read= records; pos->read_time= best; pos->key= best_key; + pos->type= best_type; pos->table= s; pos->ref_depend_map= best_ref_depends_map; pos->loosescan_picker.loosescan_key= MAX_KEY; pos->use_join_buffer= best_uses_jbuf; pos->spl_plan= spl_plan; + pos->spl_pd_boundary= !spl_plan ? 0 : spl_pd_boundary; pos->range_rowid_filter_info= best_filter; + pos->key_dependent= (best_type == JT_EQ_REF ? (table_map) 0 : + key_dependent & remaining_tables); loose_scan_opt.save_to_position(s, loose_scan_pos); @@ -8630,6 +9009,10 @@ choose_plan(JOIN *join, table_map join_tables) { choose_initial_table_order(join); } + /* + Note: constant tables are already in the join prefix. We don't + put them into the cur_sj_inner_tables, though. + */ join->cur_sj_inner_tables= 0; if (straight_join) @@ -8909,7 +9292,7 @@ determine_search_depth(JOIN *join) */ static void -optimize_straight_join(JOIN *join, table_map join_tables) +optimize_straight_join(JOIN *join, table_map remaining_tables) { JOIN_TAB *s; uint idx= join->const_tables; @@ -8927,31 +9310,36 @@ optimize_straight_join(JOIN *join, table_map join_tables) Json_writer_object trace_one_table(thd); if (unlikely(thd->trace_started())) { - trace_plan_prefix(join, idx, join_tables); + trace_plan_prefix(join, idx, remaining_tables); trace_one_table.add_table_name(s); } /* Find the best access method from 's' to the current partial plan */ - best_access_path(join, s, join_tables, join->positions, idx, + best_access_path(join, s, remaining_tables, join->positions, idx, disable_jbuf, record_count, position, &loose_scan_pos); - /* compute the cost of the new plan extended with 's' */ + /* Compute the cost of the new plan extended with 's' */ record_count= COST_MULT(record_count, position->records_read); const double filter_cmp_gain= position->range_rowid_filter_info ? position->range_rowid_filter_info->get_cmp_gain(record_count) : 0; - read_time+= COST_ADD(read_time - filter_cmp_gain, - COST_ADD(position->read_time, - record_count / TIME_FOR_COMPARE)); - advance_sj_state(join, join_tables, idx, &record_count, &read_time, - &loose_scan_pos); - - join_tables&= ~(s->table->map); + read_time= COST_ADD(read_time, + COST_ADD(position->read_time - + filter_cmp_gain, + record_count / + TIME_FOR_COMPARE)); + optimize_semi_joins(join, remaining_tables, idx, &record_count, &read_time, + &loose_scan_pos); + + remaining_tables&= ~(s->table->map); double pushdown_cond_selectivity= 1.0; if (use_cond_selectivity > 1) pushdown_cond_selectivity= table_cond_selectivity(join, idx, s, - join_tables); + remaining_tables); position->cond_selectivity= pushdown_cond_selectivity; + double partial_join_cardinality= record_count * + pushdown_cond_selectivity; + join->positions[idx].partial_join_cardinality= partial_join_cardinality; ++idx; } @@ -9077,9 +9465,12 @@ greedy_search(JOIN *join, do { /* Find the extension of the current QEP with the lowest cost */ join->best_read= DBL_MAX; - if (best_extension_by_limited_search(join, remaining_tables, idx, record_count, - read_time, search_depth, prune_level, - use_cond_selectivity)) + if ((int) best_extension_by_limited_search(join, remaining_tables, idx, + record_count, + read_time, search_depth, + prune_level, + use_cond_selectivity) < + (int) SEARCH_OK) DBUG_RETURN(TRUE); /* 'best_read < DBL_MAX' means that optimizer managed to find @@ -9121,6 +9512,13 @@ greedy_search(JOIN *join, /* This has been already checked by best_extension_by_limited_search */ DBUG_ASSERT(!is_interleave_error); + /* + Also, update the semi-join optimization state. Information about the + picked semi-join operation is in best_pos->...picker, but we need to + update the global state in the JOIN object, too. + */ + if (!join->emb_sjm_nest) + update_sj_state(join, best_table, idx, remaining_tables); /* find the position of 'best_table' in 'join->best_ref' */ best_idx= idx; @@ -9128,8 +9526,13 @@ greedy_search(JOIN *join, while (pos && best_table != pos) pos= join->best_ref[++best_idx]; DBUG_ASSERT((pos != NULL)); // should always find 'best_table' - /* move 'best_table' at the first free position in the array of joins */ - swap_variables(JOIN_TAB*, join->best_ref[idx], join->best_ref[best_idx]); + /* + move 'best_table' at the first free position in the array of joins, + keeping the sorted table order intact + */ + memmove(join->best_ref + idx + 1, join->best_ref + idx, + sizeof(JOIN_TAB*) * (best_idx - idx)); + join->best_ref[idx]= best_table; /* compute the cost of the new plan extended with 'best_table' */ record_count= COST_MULT(record_count, join->positions[idx].records_read); @@ -9348,10 +9751,7 @@ double table_multi_eq_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s, double sel= 1.0; COND_EQUAL *cond_equal= join->cond_equal; - if (!cond_equal || !cond_equal->current_level.elements) - return sel; - - if (!s->keyuse) + if (!cond_equal || !cond_equal->current_level.elements || !s->keyuse) return sel; Item_equal *item_equal; @@ -9466,7 +9866,7 @@ double table_multi_eq_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s, with previous tables. For quick selects and full table scans, selectivity of COND(this_table) - is accounted for in matching_candidates_in_table(). Here, we only count + is accounted for in apply_selectivity_for_table(). Here, we only count selectivity of COND(this_table, previous_tables). For other access methods, we need to calculate selectivity of the whole @@ -9668,7 +10068,7 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s, /* The table is accessed with full table scan, or quick select. Selectivity of COND(table) is already accounted for in - matching_candidates_in_table(). + apply_selectivity_for_table(). */ sel= 1; } @@ -9715,6 +10115,28 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s, } +/* + Check if the table is an EQ_REF or similar table and there is no cost + to gain by moveing it to a later stage. + We call such a table a edge table (or hanging leaf) as it will read at + most one row and will not add to the number of row combinations in the join. +*/ + +static inline enum_best_search +check_if_edge_table(POSITION *pos, + double pushdown_cond_selectivity) +{ + + if ((pos->type == JT_EQ_REF || + (pos->type == JT_REF && + pos->records_read == 1 && + !pos->range_rowid_filter_info)) && + pushdown_cond_selectivity >= 0.999) + return SEARCH_FOUND_EDGE; + return SEARCH_OK; +} + + /** Find a good, possibly optimal, query execution plan (QEP) by a possibly exhaustive search. @@ -9829,12 +10251,17 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s, pushed to a table should be taken into account @retval - FALSE ok + enum_best_search::SEARCH_OK All fine @retval - TRUE Fatal error + enum_best_search::SEARCH_FOUND_EDGE All remaning tables are edge tables + @retval + enum_best_search::SEARCH_ABORT Killed by user + @retval + enum_best_search::SEARCH_ERROR Fatal error */ -static bool + +static enum_best_search best_extension_by_limited_search(JOIN *join, table_map remaining_tables, uint idx, @@ -9844,9 +10271,17 @@ best_extension_by_limited_search(JOIN *join, uint prune_level, uint use_cond_selectivity) { - DBUG_ENTER("best_extension_by_limited_search"); - THD *thd= join->thd; + /* + 'join' is a partial plan with lower cost than the best plan so far, + so continue expanding it further with the tables in 'remaining_tables'. + */ + JOIN_TAB *s, **pos; + double best_record_count= DBL_MAX; + double best_read_time= DBL_MAX; + bool disable_jbuf= join->thd->variables.join_cache_level == 0; + enum_best_search best_res; + DBUG_ENTER("best_extension_by_limited_search"); DBUG_EXECUTE_IF("show_explain_probe_best_ext_lim_search", if (dbug_user_var_equals_int(thd, @@ -9856,24 +10291,12 @@ best_extension_by_limited_search(JOIN *join, ); if (unlikely(thd->check_killed())) // Abort - DBUG_RETURN(TRUE); - - DBUG_EXECUTE("opt", print_plan(join, idx, read_time, record_count, idx, - "SOFAR:");); - - /* - 'join' is a partial plan with lower cost than the best plan so far, - so continue expanding it further with the tables in 'remaining_tables'. - */ - JOIN_TAB *s; - double best_record_count= DBL_MAX; - double best_read_time= DBL_MAX; - bool disable_jbuf= join->thd->variables.join_cache_level == 0; + DBUG_RETURN(SEARCH_ABORT); DBUG_EXECUTE("opt", print_plan(join, idx, record_count, read_time, read_time, "part_plan");); - /* + /* If we are searching for the execution plan of a materialized semi-join nest then allowed_tables contains bits only for the tables from this nest. */ @@ -9881,18 +10304,23 @@ best_extension_by_limited_search(JOIN *join, if (join->emb_sjm_nest) allowed_tables= join->emb_sjm_nest->sj_inner_tables & ~join->const_table_map; - for (JOIN_TAB **pos= join->best_ref + idx ; (s= *pos) ; pos++) + for (pos= join->best_ref + idx ; (s= *pos) ; pos++) { table_map real_table_bit= s->table->map; - if ((remaining_tables & real_table_bit) && - (allowed_tables & real_table_bit) && + DBUG_ASSERT(remaining_tables & real_table_bit); + + swap_variables(JOIN_TAB*, join->best_ref[idx], *pos); + + if ((allowed_tables & real_table_bit) && !(remaining_tables & s->dependent) && - (!idx || !check_interleaving_with_nj(s))) + !check_interleaving_with_nj(s)) { double current_record_count, current_read_time; + double partial_join_cardinality; POSITION *position= join->positions + idx; - + POSITION loose_scan_pos; Json_writer_object trace_one_table(thd); + if (unlikely(thd->trace_started())) { trace_plan_prefix(join, idx, remaining_tables); @@ -9900,28 +10328,27 @@ best_extension_by_limited_search(JOIN *join, } /* Find the best access method from 's' to the current partial plan */ - POSITION loose_scan_pos; best_access_path(join, s, remaining_tables, join->positions, idx, disable_jbuf, record_count, position, &loose_scan_pos); - /* Compute the cost of extending the plan with 's' */ + /* Compute the cost of the new plan extended with 's' */ current_record_count= COST_MULT(record_count, position->records_read); const double filter_cmp_gain= position->range_rowid_filter_info ? position->range_rowid_filter_info->get_cmp_gain(current_record_count) : 0; - current_read_time=COST_ADD(read_time, - COST_ADD(position->read_time - - filter_cmp_gain, - current_record_count / - TIME_FOR_COMPARE)); + current_read_time= COST_ADD(read_time, + COST_ADD(position->read_time - + filter_cmp_gain, + current_record_count / + TIME_FOR_COMPARE)); if (unlikely(thd->trace_started())) { trace_one_table.add("rows_for_plan", current_record_count); trace_one_table.add("cost_for_plan", current_read_time); } - advance_sj_state(join, remaining_tables, idx, ¤t_record_count, - ¤t_read_time, &loose_scan_pos); + optimize_semi_joins(join, remaining_tables, idx, ¤t_record_count, + ¤t_read_time, &loose_scan_pos); /* Expand only partial plans with lower cost than the best QEP so far */ if (current_read_time >= join->best_read) @@ -9948,11 +10375,18 @@ best_extension_by_limited_search(JOIN *join, (idx == join->const_tables && // 's' is the first table in the QEP s->table == join->sort_by_table)) { + /* + Store the current record count and cost as the best + possible cost at this level if the following holds: + - It's the lowest record number and cost so far + - There is no remaing table that could improve index usage + or we found an EQ_REF or REF key with less than 2 + matching records (good enough). + */ if (best_record_count >= current_record_count && best_read_time >= current_read_time && - /* TODO: What is the reasoning behind this condition? */ - (!(s->key_dependent & allowed_tables & remaining_tables) || - join->positions[idx].records_read < 2.0)) + (!(position->key_dependent & allowed_tables) || + position->records_read < 2.0)) { best_record_count= current_record_count; best_read_time= current_read_time; @@ -9975,32 +10409,51 @@ best_extension_by_limited_search(JOIN *join, double pushdown_cond_selectivity= 1.0; if (use_cond_selectivity > 1) pushdown_cond_selectivity= table_cond_selectivity(join, idx, s, - remaining_tables & + remaining_tables & ~real_table_bit); join->positions[idx].cond_selectivity= pushdown_cond_selectivity; - if (unlikely(thd->trace_started()) && pushdown_cond_selectivity < 1.0) - trace_one_table.add("selectivity", pushdown_cond_selectivity); + partial_join_cardinality= (current_record_count * + pushdown_cond_selectivity); + + if (unlikely(thd->trace_started())) + { + if (pushdown_cond_selectivity < 1.0) + { + trace_one_table.add("selectivity", pushdown_cond_selectivity); + trace_one_table.add("estimated_join_cardinality", + partial_join_cardinality); + } + } + + join->positions[idx].partial_join_cardinality= partial_join_cardinality; - double partial_join_cardinality= current_record_count * - pushdown_cond_selectivity; - if ( (search_depth > 1) && (remaining_tables & ~real_table_bit) & allowed_tables ) - { /* Recursively expand the current partial plan */ - swap_variables(JOIN_TAB*, join->best_ref[idx], *pos); + if ((search_depth > 1) && (remaining_tables & ~real_table_bit) & + allowed_tables) + { + /* Recursively expand the current partial plan */ Json_writer_array trace_rest(thd, "rest_of_plan"); - if (best_extension_by_limited_search(join, - remaining_tables & ~real_table_bit, - idx + 1, - partial_join_cardinality, - current_read_time, - search_depth - 1, - prune_level, - use_cond_selectivity)) - DBUG_RETURN(TRUE); - swap_variables(JOIN_TAB*, join->best_ref[idx], *pos); + best_res= + best_extension_by_limited_search(join, + remaining_tables & + ~real_table_bit, + idx + 1, + partial_join_cardinality, + current_read_time, + search_depth - 1, + prune_level, + use_cond_selectivity); + if ((int) best_res < (int) SEARCH_OK) + goto end; // Return best_res + if (best_res == SEARCH_FOUND_EDGE && + check_if_edge_table(join->positions+ idx, + pushdown_cond_selectivity) != + SEARCH_FOUND_EDGE) + best_res= SEARCH_OK; } else - { /* + { + /* 'join' is either the best partial QEP with 'search_depth' relations, or the best complete QEP so far, whichever is smaller. */ @@ -10009,15 +10462,13 @@ best_extension_by_limited_search(JOIN *join, join->positions[join->const_tables].table->table) { /* - We may have to make a temp table, note that this is only a - heuristic since we cannot know for sure at this point. - Hence it may be wrong. + We may have to make a temp table, note that this is only a + heuristic since we cannot know for sure at this point. + Hence it may be wrong. */ trace_one_table.add("cost_for_sorting", current_record_count); current_read_time= COST_ADD(current_read_time, current_record_count); } - trace_one_table.add("estimated_join_cardinality", - partial_join_cardinality); if (current_read_time < join->best_read) { memcpy((uchar*) join->best_positions, (uchar*) join->positions, @@ -10030,12 +10481,35 @@ best_extension_by_limited_search(JOIN *join, read_time, current_read_time, "full_plan");); + best_res= check_if_edge_table(join->positions + idx, + pushdown_cond_selectivity); } restore_prev_nj_state(s); restore_prev_sj_state(remaining_tables, s, idx); + if (best_res == SEARCH_FOUND_EDGE) + { + trace_one_table.add("pruned_by_hanging_leaf", true); + goto end; + } } } - DBUG_RETURN(FALSE); + best_res= SEARCH_OK; + +end: + /* Restore original table order */ + if (!*pos) + pos--; // Revert last pos++ in for loop + if (pos != join->best_ref + idx) + { + JOIN_TAB *tmp= join->best_ref[idx]; + uint elements= (uint) (pos - (join->best_ref + idx)); + + memmove((void*) (join->best_ref + idx), + (void*) (join->best_ref + idx + 1), + elements * sizeof(JOIN_TAB*)); + *pos= tmp; + } + DBUG_RETURN(best_res); } @@ -10706,10 +11180,28 @@ bool JOIN::get_best_combination() fix_semijoin_strategies_for_picked_join_order(this); top_join_tab_count= get_number_of_tables_at_top_level(this); +#ifndef DBUG_OFF + dbug_join_tab_array_size= top_join_tab_count + aggr_tables; +#endif + /* + NOTE: The above computation of aggr_tables can produce wrong result because some + of the variables it uses may change their values after we leave this function. + Known examples: + - Dangerous: using_outer_summary_function=false at this point. Added + DBUG_ASSERT below to demonstrate. Can this cause us to allocate less + space than we would need? + - Not dangerous: select_distinct can be true here but be assigned false + afterwards. + */ + aggr_tables= 2; + DBUG_ASSERT(!tmp_table_param.using_outer_summary_function); if (!(join_tab= (JOIN_TAB*) thd->alloc(sizeof(JOIN_TAB)* (top_join_tab_count + aggr_tables)))) DBUG_RETURN(TRUE); - + + if (inject_splitting_cond_for_all_tables_with_split_opt()) + DBUG_RETURN(TRUE); + JOIN_TAB_RANGE *root_range; if (!(root_range= new (thd->mem_root) JOIN_TAB_RANGE)) DBUG_RETURN(TRUE); @@ -12432,6 +12924,7 @@ bool generate_derived_keys_for_table(KEYUSE *keyuse, uint count, uint keys) (uchar *) &first_keyuse)) { + JOIN_TAB *tab; first_keyuse= save_first_keyuse; if (table->add_tmp_key(table->s->keys, parts, get_next_field_for_derived_key, @@ -12439,6 +12932,9 @@ bool generate_derived_keys_for_table(KEYUSE *keyuse, uint count, uint keys) FALSE)) return TRUE; table->reginfo.join_tab->keys.set_bit(table->s->keys); + tab= table->reginfo.join_tab; + for (uint i=0; i < parts; i++) + tab->key_dependent|= save_first_keyuse[i].used_tables; } else { @@ -13000,6 +13496,9 @@ uint check_join_cache_usage(JOIN_TAB *tab, join->return_tab= 0; + if (tab->no_forced_join_cache) + goto no_join_cache; + /* Don't use join cache if @@join_cache_level==0 or this table is the first one join suborder (either at top level or inside a bush) @@ -13469,6 +13968,7 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after) uint jcl= tab->used_join_cache_level; tab->read_record.table= table; tab->read_record.unlock_row= rr_unlock_row; + tab->read_record.print_error= true; tab->sorted= sorted; sorted= 0; // only first must be sorted @@ -13967,7 +14467,8 @@ bool JOIN_TAB::preread_init() DBUG_RETURN(TRUE); if (!(derived->get_unit()->uncacheable & UNCACHEABLE_DEPENDENT) || - derived->is_nonrecursive_derived_with_rec_ref()) + derived->is_nonrecursive_derived_with_rec_ref() || + is_split_derived) preread_init_done= TRUE; if (select && select->quick) select->quick->replace_handler(table->file); @@ -14220,7 +14721,6 @@ void JOIN::cleanup(bool full) /* Free the original optimized join created for the group_by_handler */ join_tab= original_join_tab; original_join_tab= 0; - table_count= original_table_count; } if (join_tab) @@ -14258,6 +14758,7 @@ void JOIN::cleanup(bool full) if (curr_tab->aggr) { free_tmp_table(thd, curr_tab->table); + curr_tab->table= NULL; delete curr_tab->tmp_table_param; curr_tab->tmp_table_param= NULL; curr_tab->aggr= NULL; @@ -14317,6 +14818,7 @@ void JOIN::cleanup(bool full) } } } + free_pushdown_handlers(*join_list); } /* Restore ref array to original state */ if (current_ref_ptrs != items0) @@ -14327,16 +14829,42 @@ void JOIN::cleanup(bool full) DBUG_VOID_RETURN; } - /** - Remove the following expressions from ORDER BY and GROUP BY: - Constant expressions @n - Expression that only uses tables that are of type EQ_REF and the reference - is in the ORDER list or if all refereed tables are of the above type. + Clean up all derived pushdown handlers in this join. - In the following, the X field can be removed: - @code - SELECT * FROM t1,t2 WHERE t1.a=t2.a ORDER BY t1.a,t2.X + @detail + Note that dt_handler is picked at the prepare stage (as opposed + to optimization stage where one could expect this). + Because of that, we have to do cleanups in this function that is called + from JOIN::cleanup() and not in JOIN_TAB::cleanup. + */ +void JOIN::free_pushdown_handlers(List& join_list) +{ + List_iterator li(join_list); + TABLE_LIST *table_ref; + while ((table_ref= li++)) + { + if (table_ref->nested_join) + free_pushdown_handlers(table_ref->nested_join->join_list); + if (table_ref->pushdown_derived) + { + delete table_ref->pushdown_derived; + table_ref->pushdown_derived= NULL; + } + delete table_ref->dt_handler; + table_ref->dt_handler= NULL; + } +} + +/** + Remove the following expressions from ORDER BY and GROUP BY: + Constant expressions @n + Expression that only uses tables that are of type EQ_REF and the reference + is in the ORDER list or if all refereed tables are of the above type. + + In the following, the X field can be removed: + @code + SELECT * FROM t1,t2 WHERE t1.a=t2.a ORDER BY t1.a,t2.X SELECT * FROM t1,t2,t3 WHERE t1.a=t2.a AND t2.b=t3.b ORDER BY t1.a,t3.X @endcode @@ -14517,7 +15045,7 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, and some wrong results so better to leave the code as it was related to ROLLUP. */ - *simple_order= !join->rand_table_in_field_list; + *simple_order= !join->select_lex->rownum_in_field_list; if (join->only_const_tables()) return change_list ? 0 : first_order; // No need to sort @@ -14759,8 +15287,6 @@ return_zero_rows(JOIN *join, select_result *result, List &tables, DBUG_RETURN(0); } - join->join_free(); - if (send_row) { /* @@ -14807,6 +15333,14 @@ return_zero_rows(JOIN *join, select_result *result, List &tables, if (likely(!send_error)) result->send_eof(); // Should be safe } + /* + JOIN::join_free() must be called after the virtual method + select::send_result_set_metadata() returned control since + implementation of this method could use data strutcures + that are released by the method JOIN::join_free(). + */ + join->join_free(); + DBUG_RETURN(0); } @@ -17177,7 +17711,6 @@ static uint reset_nj_counters(JOIN *join, List *join_list) static bool check_interleaving_with_nj(JOIN_TAB *next_tab) { - TABLE_LIST *next_emb= next_tab->table->pos_in_table_list->embedding; JOIN *join= next_tab->join; if (join->cur_embedding_map & ~next_tab->embedding_map) @@ -17189,6 +17722,7 @@ static bool check_interleaving_with_nj(JOIN_TAB *next_tab) return TRUE; } + TABLE_LIST *next_emb= next_tab->table->pos_in_table_list->embedding; /* Do update counters for "pairs of brackets" that we've left (marked as X,Y,Z in the above picture) @@ -17402,6 +17936,9 @@ void optimize_wo_join_buffering(JOIN *join, uint first_tab, uint last_tab, reopt_remaining_tables & ~real_table_bit); } + double partial_join_cardinality= rec_count * + pushdown_cond_selectivity; + join->positions[i].partial_join_cardinality= partial_join_cardinality; (*outer_rec_count) *= pushdown_cond_selectivity; if (!rs->emb_sj_nest) *outer_rec_count= COST_MULT(*outer_rec_count, pos.records_read); @@ -18364,7 +18901,8 @@ Field *Item_field::create_tmp_field_ex(MEM_ROOT *root, TABLE *table, src->set_field(field); if (!(result= create_tmp_field_from_item_field(root, table, NULL, param))) return NULL; - if (field->eq_def(result)) + if (!(field->flags & NO_DEFAULT_VALUE_FLAG) && + field->eq_def(result)) src->set_default_field(field); return result; } @@ -18374,14 +18912,17 @@ Field *Item_default_value::create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, const Tmp_field_param *param) { - if (field->default_value && (field->flags & BLOB_FLAG)) + if (field->default_value || (field->flags & BLOB_FLAG)) { /* We have to use a copy function when using a blob with default value as the we have to calculate the default value before we can use it. */ get_tmp_field_src(src, param); - return tmp_table_field_from_field_type(root, table); + Field *result= tmp_table_field_from_field_type(root, table); + if (result && param->modify_item()) + result_field= result; + return result; } /* Same code as in Item_field::create_tmp_field_ex, except no default field @@ -18538,7 +19079,7 @@ Field *create_tmp_field(TABLE *table, Item *item, make_copy_field); Field *result= item->create_tmp_field_ex(table->in_use->mem_root, table, &src, &prm); - if (item->is_json_type() && make_json_valid_expr(table, result)) + if (is_json_type(item) && make_json_valid_expr(table, result)) result= NULL; *from_field= src.field(); @@ -18761,6 +19302,7 @@ TABLE *Create_tmp_table::start(THD *thd, */ if (param->precomputed_group_by) copy_func_count+= param->sum_func_count; + param->copy_func_count= copy_func_count; init_sql_alloc(key_memory_TABLE, &own_root, TABLE_ALLOC_BLOCK_SIZE, 0, MYF(MY_THREAD_SPECIFIC)); @@ -18818,6 +19360,7 @@ TABLE *Create_tmp_table::start(THD *thd, table->copy_blobs= 1; table->in_use= thd; table->no_rows_with_nulls= param->force_not_null_cols; + table->expr_arena= thd; table->s= share; init_tmp_table_share(thd, share, "", 0, "(temporary)", tmpname); @@ -18964,8 +19507,9 @@ bool Create_tmp_table::add_fields(THD *thd, We here distinguish between UNION and multi-table-updates by the fact that in the later case group is set to the row pointer. - The test for item->marker == 4 is ensure we don't create a group-by - key over a bit field as heap tables can't handle that. + The test for item->marker == MARKER_NULL_KEY is ensure we + don't create a group-by key over a bit field as heap tables + can't handle that. */ DBUG_ASSERT(!param->schema_table); Field *new_field= @@ -18985,7 +19529,7 @@ bool Create_tmp_table::add_fields(THD *thd, item->marker == MARKER_NULL_KEY || param->bit_fields_as_long, param->force_copy_fields); - if (!new_field) + if (unlikely(!new_field)) { if (unlikely(thd->is_fatal_error)) goto err; // Got OOM @@ -19032,6 +19576,7 @@ bool Create_tmp_table::add_fields(THD *thd, new_field->flags|= FIELD_PART_OF_TMP_UNIQUE; } } + DBUG_ASSERT(fieldnr == m_field_count[other] + m_field_count[distinct]); DBUG_ASSERT(m_blob_count == m_blobs_count[other] + m_blobs_count[distinct]); share->fields= fieldnr; @@ -19040,6 +19585,8 @@ bool Create_tmp_table::add_fields(THD *thd, share->blob_field[m_blob_count]= 0; // End marker copy_func[0]= 0; // End marker param->func_count= (uint) (copy_func - param->items_to_copy); + DBUG_ASSERT(param->func_count <= param->copy_func_count); + share->column_bitmap_size= bitmap_buffer_size(share->fields); thd->mem_root= mem_root_save; @@ -19240,8 +19787,10 @@ bool Create_tmp_table::finalize(THD *thd, { /* Copy default value. We have to use field_conv() for copy, instead of - memcpy(), because bit_fields may be stored differently + memcpy(), because bit_fields may be stored differently. + But otherwise we copy as is, in particular, ignore NO_ZERO_DATE, etc */ + Use_relaxed_field_copy urfc(thd); my_ptrdiff_t ptr_diff= (orig_field->table->s->default_values - orig_field->table->record[0]); field->set_notnull(); @@ -19580,16 +20129,7 @@ bool Create_tmp_table::add_schema_fields(THD *thd, TABLE *table, DBUG_RETURN(true); // EOM } field->init(table); - switch (def.def()) { - case DEFAULT_NONE: - field->flags|= NO_DEFAULT_VALUE_FLAG; - break; - case DEFAULT_TYPE_IMPLICIT: - break; - default: - DBUG_ASSERT(0); - break; - } + field->flags|= NO_DEFAULT_VALUE_FLAG; add_field(table, field, fieldnr, param->force_not_null_cols); } @@ -20368,6 +20908,8 @@ free_tmp_table(THD *thd, TABLE *entry) } entry->file->ha_drop_table(entry->s->path.str); delete entry->file; + entry->file= NULL; + entry->reset_created(); } /* free blobs */ @@ -20860,6 +21402,8 @@ sub_select_cache(JOIN *join, JOIN_TAB *join_tab, bool end_of_records) /* The user has aborted the execution of the query */ DBUG_RETURN(NESTED_LOOP_KILLED); } + join_tab->jbuf_loops_tracker->on_scan_init(); + if (!test_if_use_dynamic_range_scan(join_tab)) { if (!cache->put_record()) @@ -21008,6 +21552,16 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records) { DBUG_ENTER("sub_select"); + if (join_tab->split_derived_to_update && !end_of_records) + { + table_map tab_map= join_tab->split_derived_to_update; + for (uint i= 0; tab_map; i++, tab_map>>= 1) + { + if (tab_map & 1) + join->map2table[i]->preread_init_done= false; + } + } + if (join_tab->last_inner) { JOIN_TAB *last_inner_tab= join_tab->last_inner; @@ -21041,6 +21595,8 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records) DBUG_RETURN(NESTED_LOOP_ERROR); join_tab->build_range_rowid_filter_if_needed(); + if (join_tab->rowid_filter && join_tab->rowid_filter->is_empty()) + rc= NESTED_LOOP_NO_MORE_ROWS; join->return_tab= join_tab; @@ -21325,11 +21881,8 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab, */ if (shortcut_for_distinct && found_records != join->found_records) DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS); - } - else - { - join->thd->get_stmt_da()->inc_current_row_for_warning(); - join_tab->read_record.unlock_row(join_tab); + + DBUG_RETURN(NESTED_LOOP_OK); } } else @@ -21339,9 +21892,11 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab, with the beginning coinciding with the current partial join. */ join->join_examined_rows++; - join->thd->get_stmt_da()->inc_current_row_for_warning(); - join_tab->read_record.unlock_row(join_tab); } + + join->thd->get_stmt_da()->inc_current_row_for_warning(); + join_tab->read_record.unlock_row(join_tab); + DBUG_RETURN(NESTED_LOOP_OK); } @@ -22401,11 +22956,17 @@ end_send(JOIN *join, JOIN_TAB *join_tab, bool end_of_records) /* @brief - Perform a GROUP BY operation over a stream of rows ordered by their group. - The result is sent into join->result. + Perform OrderedGroupBy operation and write the output into join->result. @detail - Also applies HAVING, etc. + The input stream is ordered by the GROUP BY expression, so groups come + one after another. We only need to accumulate the aggregate value, when + a GROUP BY group ends, check the HAVING and send the group. + + Note that the output comes in the GROUP BY order, which is required by + the MySQL's GROUP BY semantics. No further sorting is needed. + + @seealso end_write_group() also implements SortAndGroup */ enum_nested_loop_state @@ -22605,13 +23166,26 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), /* @brief - Perform a GROUP BY operation over rows coming in arbitrary order. - - This is done by looking up the group in a temp.table and updating group - values. + Perform GROUP BY operation over rows coming in arbitrary order: use + TemporaryTableWithPartialSums algorithm. + + @detail + The TemporaryTableWithPartialSums algorithm is: + + CREATE TEMPORARY TABLE tmp ( + group_by_columns PRIMARY KEY, + partial_sum + ); + + for each row R in join output { + INSERT INTO tmp (R.group_by_columns, R.sum_value) + ON DUPLICATE KEY UPDATE partial_sum=partial_sum + R.sum_value; + } @detail Also applies HAVING, etc. + + @seealso end_unique_update() */ static enum_nested_loop_state @@ -22764,13 +23338,15 @@ end_unique_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), /* @brief - Perform a GROUP BY operation over a stream of rows ordered by their group. - Write the result into a temporary table. + Perform OrderedGroupBy operation and write the output into the temporary + table (join_tab->table). @detail - Also applies HAVING, etc. + The input stream is ordered by the GROUP BY expression, so groups come + one after another. We only need to accumulate the aggregate value, when + a GROUP BY group ends, check the HAVING and write the group. - The rows are written into temptable so e.g. filesort can read them. + @seealso end_send_group() also implements OrderedGroupBy */ enum_nested_loop_state @@ -23145,21 +23721,6 @@ make_cond_for_table_from_pred(THD *thd, Item *root_cond, Item *cond, cond->marker= MARKER_CHECK_ON_READ; // Checked when read return (COND*) 0; } - /* - If cond is an equality injected for split optimization then - a. when retain_ref_cond == false : cond is removed unconditionally - (cond that supports ref access is removed by the preceding code) - b. when retain_ref_cond == true : cond is removed if it does not - support ref access - */ - if (left_item->type() == Item::FIELD_ITEM && - is_eq_cond_injected_for_split_opt((Item_func_eq *) cond) && - (!retain_ref_cond || - !test_if_ref(root_cond, (Item_field*) left_item,right_item))) - { - cond->marker= MARKER_CHECK_ON_READ; - return (COND*) 0; - } } cond->marker= MARKER_PROCESSED; cond->set_join_tab_idx((uint8) join_tab_idx_arg); @@ -24517,39 +25078,70 @@ JOIN_TAB::remove_duplicates() { bool error; - ulong keylength= 0; - uint field_count; + ulong keylength= 0, sort_field_keylength= 0; + uint field_count, item_count; List *fields= (this-1)->fields; + Item *item; THD *thd= join->thd; - + SORT_FIELD *sortorder, *sorder; DBUG_ENTER("remove_duplicates"); DBUG_ASSERT(join->aggr_tables > 0 && table->s->tmp_table != NO_TMP_TABLE); THD_STAGE_INFO(join->thd, stage_removing_duplicates); - //join->explain->ops_tracker.report_duplicate_removal(); - - table->reginfo.lock_type=TL_WRITE; + if (!(sortorder= (SORT_FIELD*) my_malloc(PSI_INSTRUMENT_ME, + (fields->elements+1) * + sizeof(SORT_FIELD), + MYF(MY_WME | MY_ZEROFILL)))) + DBUG_RETURN(TRUE); /* Calculate how many saved fields there is in list */ - field_count=0; + field_count= item_count= 0; + List_iterator it(*fields); - Item *item; - while ((item=it++)) + for (sorder= sortorder ; (item=it++) ;) { - if (item->get_tmp_table_field() && ! item->const_item()) - field_count++; + if (!item->const_item()) + { + if (item->get_tmp_table_field()) + { + /* Field is stored in temporary table, skipp */ + field_count++; + } + else + { + /* Item is not stored in temporary table, remember it */ + sorder->item= item; + /* Calculate sorder->length */ + item->type_handler()->sort_length(thd, item, sorder); + sorder++; + item_count++; + } + } } + sorder->item= 0; // End marker - if (!field_count && !(join->select_options & OPTION_FOUND_ROWS) && !having) - { // only const items with no OPTION_FOUND_ROWS + if ((field_count + item_count == 0) && ! having && + !(join->select_options & OPTION_FOUND_ROWS)) + { + // only const items with no OPTION_FOUND_ROWS join->unit->lim.set_single_row(); // Only send first row + my_free(sortorder); DBUG_RETURN(false); } + /* + The table contains first fields that will be in the output, then + temporary results pointed to by the fields list. + Example: SELECT DISTINCT sum(a), sum(d) > 2 FROM ... + In this case the temporary table contains sum(a), sum(d). + */ + Field **first_field=table->field+table->s->fields - field_count; for (Field **ptr=first_field; *ptr; ptr++) keylength+= (*ptr)->sort_length() + (*ptr)->maybe_null(); + for (SORT_FIELD *ptr= sortorder ; ptr->item ; ptr++) + sort_field_keylength+= ptr->length + (ptr->item->maybe_null() ? 1 : 0); /* Disable LIMIT ROWS EXAMINED in order to avoid interrupting prematurely @@ -24560,30 +25152,80 @@ JOIN_TAB::remove_duplicates() thd->reset_killed(); table->file->info(HA_STATUS_VARIABLE); + table->reginfo.lock_type=TL_WRITE; + if (table->s->db_type() == heap_hton || (!table->s->blob_fields && ((ALIGN_SIZE(keylength) + HASH_OVERHEAD) * table->file->stats.records < thd->variables.sortbuff_size))) - error=remove_dup_with_hash_index(join->thd, table, field_count, first_field, - keylength, having); + error= remove_dup_with_hash_index(join->thd, table, field_count, + first_field, sortorder, + keylength + sort_field_keylength, having); else - error=remove_dup_with_compare(join->thd, table, first_field, having); + error=remove_dup_with_compare(join->thd, table, first_field, sortorder, + sort_field_keylength, having); if (join->select_lex != join->select_lex->master_unit()->fake_select_lex) thd->lex->set_limit_rows_examined(); free_blobs(first_field); + my_free(sortorder); DBUG_RETURN(error); } +/* + Create a sort/compare key from items + + Key is of fixed length and binary comparable +*/ + +static uchar *make_sort_key(SORT_FIELD *sortorder, uchar *key_buffer, + String *tmp_value) +{ + for (SORT_FIELD *ptr= sortorder ; ptr->item ; ptr++) + { + ptr->item->type_handler()->make_sort_key_part(key_buffer, + ptr->item, + ptr, tmp_value); + key_buffer+= (ptr->item->maybe_null() ? 1 : 0) + ptr->length; + } + return key_buffer; +} + + +/* + Remove duplicates by comparing all rows with all other rows + + @param thd THD + @param table Temporary table + @param first_field Pointer to fields in temporary table that are part of + distinct, ends with null pointer + @param sortorder An array of Items part of distsinct. Terminated with an + element N with sortorder[N]->item=NULL. + @param keylength Length of key produced by sortorder + @param having Having expression (NULL if no having) +*/ + static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field, + SORT_FIELD *sortorder, ulong keylength, Item *having) { handler *file=table->file; - uchar *record=table->record[0]; + uchar *record=table->record[0], *key_buffer, *key_buffer2; + char *tmp_buffer; int error; + String tmp_value; DBUG_ENTER("remove_dup_with_compare"); + if (unlikely(!my_multi_malloc(PSI_INSTRUMENT_ME, + MYF(MY_WME), + &key_buffer, keylength, + &key_buffer2, keylength, + &tmp_buffer, keylength+1, + NullS))) + DBUG_RETURN(1); + tmp_value.set(tmp_buffer, keylength, &my_charset_bin); + if (unlikely(file->ha_rnd_init_with_error(1))) DBUG_RETURN(1); @@ -24592,8 +25234,8 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field, { if (unlikely(thd->check_killed())) { - error=0; - goto err; + error= 1; + goto end; } if (unlikely(error)) { @@ -24612,9 +25254,10 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field, { my_message(ER_OUTOFMEMORY, ER_THD(thd,ER_OUTOFMEMORY), MYF(ME_FATAL)); - error=0; - goto err; + error= 1; + goto end; } + make_sort_key(sortorder, key_buffer, &tmp_value); store_record(table,record[1]); /* Read through rest of file and mark duplicated rows deleted */ @@ -24627,7 +25270,10 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field, break; goto err; } - if (compare_record(table, first_field) == 0) + make_sort_key(sortorder, key_buffer2, &tmp_value); + if (compare_record(table, first_field) == 0 && + (!keylength || + memcmp(key_buffer, key_buffer2, keylength) == 0)) { if (unlikely((error= file->ha_delete_row(record)))) goto err; @@ -24646,38 +25292,52 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field, goto err; } + error= 0; +end: + my_free(key_buffer); file->extra(HA_EXTRA_NO_CACHE); (void) file->ha_rnd_end(); - DBUG_RETURN(0); + DBUG_RETURN(error); + err: - file->extra(HA_EXTRA_NO_CACHE); - (void) file->ha_rnd_end(); - if (error) - file->print_error(error,MYF(0)); - DBUG_RETURN(1); + DBUG_ASSERT(error); + file->print_error(error,MYF(0)); + goto end; } /** - Generate a hash index for each row to quickly find duplicate rows. + Generate a hash index for each row to quickly find duplicate rows. + + @param thd THD + @param table Temporary table + @param field_count Number of fields part of distinct + @param first_field Pointer to fields in temporary table that are part of + distinct, ends with null pointer + @param sortorder An array of Items part of distsinct. Terminated with an + element N with sortorder[N]->item=NULL. + @param keylength Length of hash key + @param having Having expression (NULL if no having) - @note - Note that this will not work on tables with blobs! + @note + Note that this will not work on tables with blobs! */ static int remove_dup_with_hash_index(THD *thd, TABLE *table, uint field_count, Field **first_field, + SORT_FIELD *sortorder, ulong key_length, Item *having) { uchar *key_buffer, *key_pos, *record=table->record[0]; + char *tmp_buffer; int error; handler *file= table->file; ulong extra_length= ALIGN_SIZE(key_length)-key_length; uint *field_lengths, *field_length; HASH hash; - Field **ptr; + String tmp_value; DBUG_ENTER("remove_dup_with_hash_index"); if (!my_multi_malloc(key_memory_hash_index_key_buffer, MYF(MY_WME), @@ -24686,10 +25346,13 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, (long) file->stats.records), &field_lengths, (uint) (field_count*sizeof(*field_lengths)), + &tmp_buffer, key_length+1, NullS)) DBUG_RETURN(1); - for (ptr= first_field, field_length=field_lengths ; *ptr ; ptr++) + tmp_value.set(tmp_buffer, key_length, &my_charset_bin); + field_length= field_lengths; + for (Field **ptr= first_field ; *ptr ; ptr++) (*field_length++)= (*ptr)->sort_length(); if (my_hash_init(key_memory_hash_index_key_buffer, &hash, &my_charset_bin, @@ -24703,7 +25366,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, if (unlikely((error= file->ha_rnd_init(1)))) goto err; - key_pos=key_buffer; + key_pos= key_buffer; for (;;) { uchar *org_key_pos; @@ -24728,11 +25391,14 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, /* copy fields to key buffer */ org_key_pos= key_pos; field_length=field_lengths; - for (ptr= first_field ; *ptr ; ptr++) + for (Field **ptr= first_field ; *ptr ; ptr++) { (*ptr)->make_sort_key_part(key_pos, *field_length); key_pos+= (*ptr)->maybe_null() + *field_length++; } + /* Copy result fields not stored in table to key buffer */ + key_pos= make_sort_key(sortorder, key_pos, &tmp_value); + /* Check if it exists before */ if (my_hash_search(&hash, org_key_pos, key_length)) { @@ -25055,30 +25721,30 @@ int setup_order(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables, if (find_order_in_list(thd, ref_pointer_array, tables, order, fields, all_fields, false, true, from_window_spec)) return 1; - if ((*order->item)->with_window_func() && - context_analysis_place != IN_ORDER_BY) + Item * const item= *order->item; + if (item->with_window_func() && context_analysis_place != IN_ORDER_BY) { my_error(ER_WINDOW_FUNCTION_IN_WINDOW_SPEC, MYF(0)); return 1; } - if (!(*order->item)->with_sum_func()) - continue; - /* UNION queries cannot be used with an aggregate function in an ORDER BY clause */ - if (for_union) + if (for_union && (item->with_sum_func() || item->with_window_func())) { my_error(ER_AGGREGATE_ORDER_FOR_UNION, MYF(0), number); return 1; } - if (from_window_spec && (*order->item)->type() != Item::SUM_FUNC_ITEM) - (*order->item)->split_sum_func(thd, ref_pointer_array, - all_fields, SPLIT_SUM_SELECT); + if ((from_window_spec && item->with_sum_func() && + item->type() != Item::SUM_FUNC_ITEM) || item->with_window_func()) + { + item->split_sum_func(thd, ref_pointer_array, + all_fields, SPLIT_SUM_SELECT); + } } return 0; } @@ -25951,7 +26617,6 @@ bool JOIN::alloc_func_list() @param field_list All items @param send_result_set_metadata Items in select list @param before_group_by Set to 1 if this is called before GROUP BY handling - @param recompute Set to TRUE if sum_funcs must be recomputed @retval 0 ok @@ -25961,16 +26626,13 @@ bool JOIN::alloc_func_list() bool JOIN::make_sum_func_list(List &field_list, List &send_result_set_metadata, - bool before_group_by, bool recompute) + bool before_group_by) { List_iterator_fast it(field_list); Item_sum **func; Item *item; DBUG_ENTER("make_sum_func_list"); - if (*sum_funcs && !recompute) - DBUG_RETURN(FALSE); /* We have already initialized sum_funcs. */ - func= sum_funcs; while ((item=it++)) { @@ -26031,15 +26693,17 @@ change_to_use_tmp_fields(THD *thd, Ref_ptr_array ref_pointer_array, for (uint i= 0; (item= it++); i++) { Field *field; - if ((item->with_sum_func() && item->type() != Item::SUM_FUNC_ITEM) || - item->with_window_func()) + enum Item::Type item_type= item->type(); + if ((item->with_sum_func() && item_type != Item::SUM_FUNC_ITEM) || + item->with_window_func()) item_field= item; - else if (item->type() == Item::FIELD_ITEM) + else if (item_type == Item::FIELD_ITEM || + item_type == Item::DEFAULT_VALUE_ITEM) { if (!(item_field= item->get_tmp_table_item(thd))) DBUG_RETURN(true); } - else if (item->type() == Item::FUNC_ITEM && + else if (item_type == Item::FUNC_ITEM && ((Item_func*)item)->functype() == Item_func::SUSERVAR_FUNC) { field= item->get_tmp_table_field(); @@ -26117,7 +26781,7 @@ change_to_use_tmp_fields(THD *thd, Ref_ptr_array ref_pointer_array, Change all funcs to be fields in tmp table. @param thd THD pointer - @param ref_pointer_array array of pointers to top elements of filed list + @param ref_pointer_array array of pointers to top elements of field list @param res_selected_fields new list of items of select item list @param res_all_fields new list of all items @param elements number of elements in select item list @@ -26489,6 +27153,11 @@ bool JOIN::rollup_init() Item **ref_array; tmp_table_param.quick_group= 0; // Can't create groups in tmp table + /* + Each group can potentially be replaced with Item_func_rollup_const() which + needs a copy_func placeholder. + */ + tmp_table_param.func_count+= send_group_parts; rollup.state= ROLLUP::STATE_INITED; /* @@ -26513,7 +27182,6 @@ bool JOIN::rollup_init() ref_array= (Item**) (rollup.ref_pointer_arrays+send_group_parts); - /* Prepare space for field list for the different levels These will be filled up in rollup_make_fields() @@ -26677,7 +27345,6 @@ bool JOIN::rollup_make_fields(List &fields_arg, List &sel_fields, /* Point to first hidden field */ uint ref_array_ix= fields_arg.elements-1; - /* Remember where the sum functions ends for the previous level */ sum_funcs_end[pos+1]= *func; @@ -27014,12 +27681,16 @@ bool JOIN_TAB::save_explain_data(Explain_table_access *eta, // psergey-todo: data for filtering! tracker= &eta->tracker; jbuf_tracker= &eta->jbuf_tracker; + jbuf_loops_tracker= &eta->jbuf_loops_tracker; + jbuf_unpack_tracker= &eta->jbuf_unpack_tracker; /* Enable the table access time tracker only for "ANALYZE stmt" */ if (thd->lex->analyze_stmt) { table->file->set_time_tracker(&eta->op_tracker); - eta->op_tracker.my_gap_tracker = &eta->extra_time_tracker; + eta->op_tracker.set_gap_tracker(&eta->extra_time_tracker); + + eta->jbuf_unpack_tracker.set_gap_tracker(&eta->jbuf_extra_time_tracker); } /* No need to save id and select_type here, they are kept in Explain_select */ @@ -27647,7 +28318,8 @@ int JOIN::save_explain_data_intern(Explain_query *output, Explain_table_access *eta= (new (output->mem_root) - Explain_table_access(output->mem_root)); + Explain_table_access(output->mem_root, + thd->lex->analyze_stmt)); if (!eta) DBUG_RETURN(1); @@ -27790,8 +28462,11 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result) if (unit->is_unit_op() || unit->fake_select_lex) { + ulonglong save_options= 0; + if (unit->union_needs_tmp_table() && unit->fake_select_lex) { + save_options= unit->fake_select_lex->options; unit->fake_select_lex->select_number= FAKE_SELECT_LEX_ID; // just for initialization unit->fake_select_lex->type= unit_operation_text[unit->common_op()]; unit->fake_select_lex->options|= SELECT_DESCRIBE; @@ -27802,6 +28477,9 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result) if (!is_pushed_union) res= unit->exec(); } + + if (unit->union_needs_tmp_table() && unit->fake_select_lex) + unit->fake_select_lex->options= save_options; } else { @@ -27816,12 +28494,6 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result) result, unit, first); } - if (unit->derived && unit->derived->pushdown_derived) - { - delete unit->derived->pushdown_derived; - unit->derived->pushdown_derived= NULL; - } - DBUG_RETURN(res || thd->is_error()); } @@ -27884,7 +28556,7 @@ static void print_table_array(THD *thd, too) */ -static bool is_eliminated_table(table_map eliminated_tables, TABLE_LIST *tbl) +bool is_eliminated_table(table_map eliminated_tables, TABLE_LIST *tbl) { return eliminated_tables && ((tbl->table && (tbl->table->map & eliminated_tables)) || @@ -28186,6 +28858,162 @@ void TABLE_LIST::print(THD *thd, table_map eliminated_tables, String *str, } } +enum explainable_cmd_type +{ + SELECT_CMD, INSERT_CMD, REPLACE_CMD, UPDATE_CMD, DELETE_CMD, NO_CMD +}; + +static +const LEX_CSTRING explainable_cmd_name []= +{ + {STRING_WITH_LEN("select ")}, + {STRING_WITH_LEN("insert ")}, + {STRING_WITH_LEN("replace ")}, + {STRING_WITH_LEN("update ")}, + {STRING_WITH_LEN("delete ")}, +}; + +static +const LEX_CSTRING* get_explainable_cmd_name(enum explainable_cmd_type cmd) +{ + return explainable_cmd_name + cmd; +} + +static +enum explainable_cmd_type get_explainable_cmd_type(THD *thd) +{ + switch (thd->lex->sql_command) { + case SQLCOM_SELECT: + return SELECT_CMD; + case SQLCOM_INSERT: + case SQLCOM_INSERT_SELECT: + return INSERT_CMD; + case SQLCOM_REPLACE: + case SQLCOM_REPLACE_SELECT: + return REPLACE_CMD; + case SQLCOM_UPDATE: + case SQLCOM_UPDATE_MULTI: + return UPDATE_CMD; + case SQLCOM_DELETE: + case SQLCOM_DELETE_MULTI: + return DELETE_CMD; + default: + return SELECT_CMD; + } +} + + +void TABLE_LIST::print_leaf_tables(THD *thd, String *str, + enum_query_type query_type) +{ + if (merge_underlying_list) + { + for (TABLE_LIST *tbl= merge_underlying_list; tbl; tbl= tbl->next_local) + tbl->print_leaf_tables(thd, str, query_type); + } + else + print(thd, 0, str, query_type); +} + + +void st_select_lex::print_item_list(THD *thd, String *str, + enum_query_type query_type) +{ + bool first= 1; + /* + outer_select() can not be used here because it is for name resolution + and will return NULL at any end of name resolution chain (view/derived) + */ + bool top_level= is_query_topmost(thd); + List_iterator_fast it(item_list); + Item *item; + while ((item= it++)) + { + if (first) + first= 0; + else + str->append(','); + + if ((is_subquery_function() && !item->is_explicit_name()) || + !item->name.str) + { + /* + Do not print auto-generated aliases in subqueries. It has no purpose + in a view definition or other contexts where the query is printed. + */ + item->print(str, query_type); + } + else + { + /* + Do not print illegal names (if it is not top level SELECT). + Top level view checked (and correct name are assigned), + other cases of top level SELECT are not important, because + it is not "table field". + */ + if (top_level || + item->is_explicit_name() || + !check_column_name(item->name.str)) + item->print_item_w_name(str, query_type); + else + item->print(str, query_type); + } + } +} + + +void st_select_lex::print_set_clause(THD *thd, String *str, + enum_query_type query_type) +{ + bool first= 1; + /* + outer_select() can not be used here because it is for name resolution + and will return NULL at any end of name resolution chain (view/derived) + */ + List_iterator_fast it(item_list); + List_iterator_fast vt(thd->lex->value_list); + Item *item; + Item *val; + while ((item= it++, val= vt++ )) + { + if (first) + { + str->append(STRING_WITH_LEN(" set ")); + first= 0; + } + else + str->append(','); + + item->print(str, query_type); + str->append(STRING_WITH_LEN(" = ")); + val->print(str, query_type); + } +} + + +void st_select_lex::print_on_duplicate_key_clause(THD *thd, String *str, + enum_query_type query_type) +{ + bool first= 1; + List_iterator_fast it(thd->lex->update_list); + List_iterator_fast vt(thd->lex->value_list); + Item *item; + Item *val; + while ((item= it++, val= vt++ )) + { + if (first) + { + str->append(STRING_WITH_LEN(" on duplicate key update ")); + first= 0; + } + else + str->append(','); + + item->print(str, query_type); + str->append(STRING_WITH_LEN(" = ")); + val->print(str, query_type); + } +} void st_select_lex::print(THD *thd, String *str, enum_query_type query_type) { @@ -28197,6 +29025,67 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type) return; } + if (is_tvc_wrapper && (query_type & QT_NO_WRAPPERS_FOR_TVC_IN_VIEW)) + { + first_inner_unit()->first_select()->print(thd, str, query_type); + return; + } + + bool top_level= is_query_topmost(thd); + enum explainable_cmd_type sel_type= SELECT_CMD; + if (top_level) + sel_type= get_explainable_cmd_type(thd); + + if (sel_type == INSERT_CMD || sel_type == REPLACE_CMD) + { + str->append(get_explainable_cmd_name(sel_type)); + str->append(STRING_WITH_LEN("into ")); + TABLE_LIST *tbl= thd->lex->query_tables; + while (tbl->merge_underlying_list) + tbl= tbl->merge_underlying_list; + tbl->print(thd, 0, str, query_type); + if (thd->lex->field_list.elements) + { + str->append ('('); + List_iterator_fast it(thd->lex->field_list); + Item *item; + bool first= true; + while ((item= it++)) + { + if (first) + first= false; + else + str->append(','); + str->append(item->name); + } + str->append(')'); + } + + str->append(' '); + + if (thd->lex->sql_command == SQLCOM_INSERT || + thd->lex->sql_command == SQLCOM_REPLACE) + { + str->append(STRING_WITH_LEN("values ")); + bool is_first_elem= true; + List_iterator_fast li(thd->lex->many_values); + List_item *list; + + while ((list= li++)) + { + if (is_first_elem) + is_first_elem= false; + else + str->append(','); + + print_list_item(str, list, query_type); + } + if (thd->lex->update_list.elements) + print_on_duplicate_key_clause(thd, str, query_type); + return; + } + } + if ((query_type & QT_SHOW_SELECT_NUMBER) && thd->lex->all_selects_list && thd->lex->all_selects_list->link_next && @@ -28219,7 +29108,10 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type) str->append(STRING_WITH_LEN(" */ ")); } - str->append(STRING_WITH_LEN("select ")); + if (sel_type == SELECT_CMD || + sel_type == INSERT_CMD || + sel_type == REPLACE_CMD) + str->append(STRING_WITH_LEN("select ")); if (join && join->cleaned) { @@ -28265,57 +29157,66 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type) } //Item List - bool first= 1; + if (sel_type == SELECT_CMD || + sel_type == INSERT_CMD || + sel_type == REPLACE_CMD) + print_item_list(thd, str, query_type); /* - outer_select() can not be used here because it is for name resolution - and will return NULL at any end of name resolution chain (view/derived) + from clause + TODO: support USING/FORCE/IGNORE index */ - bool top_level= (get_master()->get_master() == 0); - List_iterator_fast it(item_list); - Item *item; - while ((item= it++)) + if (table_list.elements) { - if (first) - first= 0; - else - str->append(','); - - if ((is_subquery_function() && !item->is_explicit_name()) || - !item->name.str) + if (sel_type == SELECT_CMD || + sel_type == INSERT_CMD || + sel_type == REPLACE_CMD) { - /* - Do not print auto-generated aliases in subqueries. It has no purpose - in a view definition or other contexts where the query is printed. - */ - item->print(str, query_type); + str->append(STRING_WITH_LEN(" from ")); + /* go through join tree */ + print_join(thd, join? join->eliminated_tables: 0, str, &top_join_list, + query_type); } - else + if (sel_type == UPDATE_CMD || sel_type == DELETE_CMD) + str->append(get_explainable_cmd_name(sel_type)); + if (sel_type == DELETE_CMD) { - /* - Do not print illegal names (if it is not top level SELECT). - Top level view checked (and correct name are assigned), - other cases of top level SELECT are not important, because - it is not "table field". - */ - if (top_level || - item->is_explicit_name() || - !check_column_name(item->name.str)) - item->print_item_w_name(str, query_type); + str->append(STRING_WITH_LEN(" from ")); + bool first= true; + for (TABLE_LIST *target_tbl= thd->lex->auxiliary_table_list.first; + target_tbl; + target_tbl= target_tbl->next_local) + { + if (first) + first= false; + else + str->append(','); + target_tbl->correspondent_table->print_leaf_tables(thd, str, + query_type); + } + + if (!first) + str->append(STRING_WITH_LEN(" using ")); + } + if (sel_type == UPDATE_CMD || sel_type == DELETE_CMD) + { + if (join) + print_join(thd, 0, str, &top_join_list, query_type); else - item->print(str, query_type); + { + bool first= true; + List_iterator_fast li(leaf_tables); + TABLE_LIST *tbl; + while ((tbl= li++)) + { + if (first) + first= false; + else + str->append(','); + tbl->print(thd, 0, str, query_type); + } + } } } - - /* - from clause - TODO: support USING/FORCE/IGNORE index - */ - if (table_list.elements) - { - str->append(STRING_WITH_LEN(" from ")); - /* go through join tree */ - print_join(thd, join? join->eliminated_tables: 0, str, &top_join_list, query_type); - } else if (where) { /* @@ -28325,10 +29226,15 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type) str->append(STRING_WITH_LEN(" from DUAL ")); } + if (sel_type == UPDATE_CMD) + print_set_clause(thd, str, query_type); + // Where Item *cur_where= where; if (join) cur_where= join->conds; + else if (sel_type == UPDATE_CMD || sel_type == DELETE_CMD) + cur_where= thd->lex->upd_del_where; if (cur_where || cond_value != Item::COND_UNDEF) { str->append(STRING_WITH_LEN(" where ")); @@ -28387,6 +29293,15 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type) if (unlikely(skip_locked)) str->append(STRING_WITH_LEN(" skip locked")); + if ((sel_type == INSERT_CMD || sel_type == REPLACE_CMD) && + thd->lex->update_list.elements) + print_on_duplicate_key_clause(thd, str, query_type); + + // returning clause + if (sel_type == DELETE_CMD && !item_list.elements) + { + print_item_list(thd, str, query_type); + } // PROCEDURE unsupported here } @@ -28641,20 +29556,20 @@ JOIN::reoptimize(Item *added_where, table_map join_tables, void JOIN::cache_const_exprs() { - bool cache_flag= FALSE; - bool *analyzer_arg= &cache_flag; + uchar cache_flag= FALSE; + uchar *analyzer_arg= &cache_flag; /* No need in cache if all tables are constant. */ if (const_tables == table_count) return; if (conds) - conds->compile(thd, &Item::cache_const_expr_analyzer, (uchar **)&analyzer_arg, - &Item::cache_const_expr_transformer, (uchar *)&cache_flag); + conds->top_level_compile(thd, &Item::cache_const_expr_analyzer, &analyzer_arg, + &Item::cache_const_expr_transformer, &cache_flag); cache_flag= FALSE; if (having) - having->compile(thd, &Item::cache_const_expr_analyzer, (uchar **)&analyzer_arg, - &Item::cache_const_expr_transformer, (uchar *)&cache_flag); + having->top_level_compile(thd, &Item::cache_const_expr_analyzer, + &analyzer_arg, &Item::cache_const_expr_transformer, &cache_flag); for (JOIN_TAB *tab= first_depth_first_tab(this); tab; tab= next_depth_first_tab(this, tab)) @@ -28662,10 +29577,8 @@ void JOIN::cache_const_exprs() if (*tab->on_expr_ref) { cache_flag= FALSE; - (*tab->on_expr_ref)->compile(thd, &Item::cache_const_expr_analyzer, - (uchar **)&analyzer_arg, - &Item::cache_const_expr_transformer, - (uchar *)&cache_flag); + (*tab->on_expr_ref)->top_level_compile(thd, &Item::cache_const_expr_analyzer, + &analyzer_arg, &Item::cache_const_expr_transformer, &cache_flag); } } } @@ -28967,6 +29880,7 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, DBUG_ASSERT (ref_key != (int) nr); possible_key.add("can_resolve_order", true); + possible_key.add("direction", direction); bool is_covering= (table->covering_keys.is_set(nr) || (table->file->index_flags(nr, 0, 1) & HA_CLUSTERED_INDEX)); @@ -29518,6 +30432,12 @@ AGGR_OP::end_send() table->reginfo.lock_type= TL_UNLOCK; bool in_first_read= true; + + /* + Reset the counter before copying rows from internal temporary table to + INSERT table. + */ + join_tab->join->thd->get_stmt_da()->reset_current_row_for_warning(1); while (rc == NESTED_LOOP_OK) { int error; @@ -29720,7 +30640,6 @@ void JOIN::make_notnull_conds_for_range_scans() { DBUG_ENTER("JOIN::make_notnull_conds_for_range_scans"); - if (impossible_where || !optimizer_flag(thd, OPTIMIZER_SWITCH_NOT_NULL_RANGE_SCAN)) { @@ -29800,20 +30719,20 @@ bool build_notnull_conds_for_range_scans(JOIN *join, Item *cond, table_map allowed) { THD *thd= join->thd; - DBUG_ENTER("build_notnull_conds_for_range_scans"); - for (JOIN_TAB *s= join->join_tab + join->const_tables ; + for (JOIN_TAB *s= join->join_tab; s < join->join_tab + join->table_count ; s++) { /* Clear all needed bitmaps to mark found fields */ - if (allowed & s->table->map) + if ((allowed & s->table->map) && + !(s->table->map & join->const_table_map)) bitmap_clear_all(&s->table->tmp_set); } /* Find all null-rejected fields assuming that cond is null-rejected and - only formulas over tables from 'allowed' are to be taken into account + only formulas over tables from 'allowed' are to be taken into account */ if (cond->find_not_null_fields(allowed)) DBUG_RETURN(true); @@ -29822,17 +30741,18 @@ bool build_notnull_conds_for_range_scans(JOIN *join, Item *cond, For each table t from 'allowed' build a conjunction of NOT NULL predicates constructed for all found fields if they are included in some indexes. If the construction of the conjunction succeeds attach the formula to - t->table->notnull_cond. The condition will be used to look for complementary - range scans. + t->table->notnull_cond. The condition will be used to look for + complementary range scans. */ - for (JOIN_TAB *s= join->join_tab + join->const_tables ; + for (JOIN_TAB *s= join->join_tab ; s < join->join_tab + join->table_count ; s++) { TABLE *tab= s->table; List notnull_list; Item *notnull_cond= 0; - if (!(allowed & tab->map)) + if (!(allowed & tab->map) || + (s->table->map && join->const_table_map)) continue; for (Field** field_ptr= tab->field; *field_ptr; field_ptr++) @@ -30258,6 +31178,95 @@ static bool process_direct_rownum_comparison(THD *thd, SELECT_LEX_UNIT *unit, DBUG_RETURN(false); } +/** + @brief + Transform IN predicates having equal constant elements to equalities + + @param thd The context of the statement + + @details + If all elements in an IN predicate are constant and equal to each other + then clause + - "a IN (e1,..,en)" can be transformed to "a = e1" + - "a NOT IN (e1,..,en)" can be transformed to "a != e1". + This means an object of Item_func_in can be replaced with an object of + Item_func_eq for IN (e1,..,en) clause or Item_func_ne for + NOT IN (e1,...,en). + Such a replacement allows the optimizer to choose a better execution plan. + + This methods applies such transformation for each IN predicate of the WHERE + condition and ON expressions of this join where possible + + @retval + false success + true failure +*/ +bool JOIN::transform_in_predicates_into_equalities(THD *thd) +{ + DBUG_ENTER("JOIN::transform_in_predicates_into_equalities"); + DBUG_RETURN(transform_all_conds_and_on_exprs( + thd, &Item::in_predicate_to_equality_transformer)); +} + + +/** + @brief + Transform all items in WHERE and ON expressions using a given transformer + + @param thd The context of the statement + transformer Pointer to the transformation function + + @details + For each item of the WHERE condition and ON expressions of the SELECT + for this join the method performs the intransformation using the given + transformation function + + @retval + false success + true failure +*/ +bool JOIN::transform_all_conds_and_on_exprs(THD *thd, + Item_transformer transformer) +{ + if (conds) + { + conds= conds->top_level_transform(thd, transformer, (uchar *) 0); + if (!conds) + return true; + } + if (join_list) + { + if (transform_all_conds_and_on_exprs_in_join_list(thd, join_list, + transformer)) + return true; + } + return false; +} + + +bool JOIN::transform_all_conds_and_on_exprs_in_join_list( + THD *thd, List *join_list, Item_transformer transformer) +{ + TABLE_LIST *table; + List_iterator li(*join_list); + + while ((table= li++)) + { + if (table->nested_join) + { + if (transform_all_conds_and_on_exprs_in_join_list( + thd, &table->nested_join->join_list, transformer)) + return true; + } + if (table->on_expr) + { + table->on_expr= table->on_expr->top_level_transform(thd, transformer, 0); + if (!table->on_expr) + return true; + } + } + return false; +} /** diff --git a/sql/sql_select.h b/sql/sql_select.h index d4e06f42249aa..88e6fd4e30f79 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -2,7 +2,7 @@ #define SQL_SELECT_INCLUDED /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2008, 2020, MariaDB Corporation. + Copyright (c) 2008, 2022, 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 @@ -309,6 +309,8 @@ typedef struct st_join_table { Table_access_tracker *tracker; Table_access_tracker *jbuf_tracker; + Time_and_counter_tracker *jbuf_unpack_tracker; + Counter_tracker *jbuf_loops_tracker; /* Bitmap of TAB_INFO_* bits that encodes special line for EXPLAIN 'Extra' column, or 0 if there is no info. @@ -376,6 +378,8 @@ typedef struct st_join_table { uint used_null_fields; uint used_uneven_bit_fields; enum join_type type; + /* If first key part is used for any key in 'key_dependent' */ + bool key_start_dependent; bool cached_eq_ref_table,eq_ref_table; bool shortcut_for_distinct; bool sorted; @@ -394,6 +398,8 @@ typedef struct st_join_table { */ bool idx_cond_fact_out; bool use_join_cache; + /* TRUE <=> it is prohibited to join this table using join buffer */ + bool no_forced_join_cache; uint used_join_cache_level; ulong join_buffer_size_limit; JOIN_CACHE *cache; @@ -520,6 +526,16 @@ typedef struct st_join_table { bool preread_init_done; + /* true <=> split optimization has been applied to this materialized table */ + bool is_split_derived; + + /* + Bitmap of split materialized derived tables that can be filled just before + this join table is to be joined. All parameters of the split derived tables + belong to tables preceding this join table. + */ + table_map split_derived_to_update; + /* Cost info to the range filter used when joining this join table (Defined when the best join order has been already chosen) @@ -682,9 +698,10 @@ typedef struct st_join_table { void partial_cleanup(); void add_keyuses_for_splitting(); - SplM_plan_info *choose_best_splitting(double record_count, - table_map remaining_tables); - bool fix_splitting(SplM_plan_info *spl_plan, table_map remaining_tables, + SplM_plan_info *choose_best_splitting(uint idx, + table_map remaining_tables, + table_map *spl_pd_boundary); + bool fix_splitting(SplM_plan_info *spl_plan, table_map excluded_tables, bool is_const_table); } JOIN_TAB; @@ -730,7 +747,7 @@ class Semi_join_strategy_picker virtual void mark_used() = 0; - virtual ~Semi_join_strategy_picker() {} + virtual ~Semi_join_strategy_picker() = default; }; @@ -949,15 +966,29 @@ class POSITION */ KEYUSE *key; + /* Cardinality of current partial join ending with this position */ + double partial_join_cardinality; + /* Info on splitting plan used at this position */ SplM_plan_info *spl_plan; + /* + If spl_plan is NULL the value of spl_pd_boundary is 0. Otherwise + spl_pd_boundary contains the bitmap of the table from the current + partial join ending at this position that starts the sub-sequence of + tables S from which no conditions are allowed to be used in the plan + spl_plan for the split table joined at this position. + */ + table_map spl_pd_boundary; + /* Cost info for the range filter used at this position */ Range_rowid_filter_cost_info *range_rowid_filter_info; /* If ref-based access is used: bitmap of tables this table depends on */ table_map ref_depend_map; + /* tables that may help best_access_path() to find a better key */ + table_map key_dependent; /* Bitmap of semi-join inner tables that are in the join prefix and for which there's no provision for how to eliminate semi-join duplicates @@ -989,6 +1020,8 @@ class POSITION */ enum sj_strategy_enum sj_strategy; + /* Type of join (EQ_REF, REF etc) */ + enum join_type type; /* Valid only after fix_semijoin_strategies_for_picked_join_order() call: if sj_strategy!=SJ_OPT_NONE, this is the number of subsequent tables that @@ -1206,7 +1239,17 @@ class JOIN :public Sql_alloc Indicates that grouping will be performed on the result set during query execution. This field belongs to query execution. - @see make_group_fields, alloc_group_fields, JOIN::exec + If 'sort_and_group' is set, then the optimizer is going to use on of + the following algorithms to resolve GROUP BY. + + - If one table, sort the table and then calculate groups on the fly. + - If more than one table, create a temporary table to hold the join, + sort it and then resolve group by on the fly. + + The 'on the fly' calculation is done in end_send_group() + + @see make_group_fields, alloc_group_fields, JOIN::exec, + setup_end_select_func */ bool sort_and_group; bool first_record,full_join, no_field_update; @@ -1238,6 +1281,8 @@ class JOIN :public Sql_alloc table_map outer_join; /* Bitmap of tables used in the select list items */ table_map select_list_used_tables; + /* Tables that has HA_NON_COMPARABLE_ROWID (does not support rowid) set */ + table_map not_usable_rowid_map; ha_rows send_records,found_records,join_examined_rows, accepted_rows; /* @@ -1273,7 +1318,6 @@ class JOIN :public Sql_alloc Pushdown_query *pushdown_query; JOIN_TAB *original_join_tab; - uint original_table_count; /******* Join optimization state members start *******/ /* @@ -1295,9 +1339,16 @@ class JOIN :public Sql_alloc Bitmap of inner tables of semi-join nests that have a proper subset of their tables in the current join prefix. That is, of those semi-join nests that have their tables both in and outside of the join prefix. + (Note: tables that are constants but have not been pulled out of semi-join + nests are not considered part of semi-join nests) */ table_map cur_sj_inner_tables; - + +#ifndef DBUG_OFF + void dbug_verify_sj_inner_tables(uint n_positions) const; + int dbug_join_tab_array_size; +#endif + /* We also maintain a stack of join optimization states in * join->positions[] */ /******* Join optimization state members end *******/ @@ -1398,11 +1449,6 @@ class JOIN :public Sql_alloc GROUP/ORDER BY. */ bool simple_order, simple_group; - /* - Set to 1 if any field in field list has RAND_TABLE set. For example if - if one uses RAND() or ROWNUM() in field list - */ - bool rand_table_in_field_list; /* ordered_index_usage is set if an ordered index access @@ -1435,12 +1481,30 @@ class JOIN :public Sql_alloc (set in make_join_statistics()) */ bool impossible_where; - List all_fields; ///< to store all fields that used in query + + /* + All fields used in the query processing. + + Initially this is a list of fields from the query's SQL text. + + Then, ORDER/GROUP BY and Window Function code add columns that need to + be saved to be available in the post-group-by context. These extra columns + are added to the front, because this->all_fields points to the suffix of + this list. + */ + List all_fields; ///Above list changed to use temporary table List tmp_all_fields1, tmp_all_fields2, tmp_all_fields3; ///Part, shared with list above, emulate following list List tmp_fields_list1, tmp_fields_list2, tmp_fields_list3; - List &fields_list; ///< hold field list passed to mysql_select + + /* + The original field list as it was passed to mysql_select(). This refers + to select_lex->item_list. + CAUTION: this list is a suffix of this->all_fields list, that is, it shares + elements with that list! + */ + List &fields_list; List procedure_fields_list; int error; @@ -1585,7 +1649,7 @@ class JOIN :public Sql_alloc bool make_range_rowid_filters(); bool init_range_rowid_filters(); bool make_sum_func_list(List &all_fields, List &send_fields, - bool before_group_by, bool recompute= FALSE); + bool before_group_by); /// Initialzes a slice, see comments for ref_ptrs above. Ref_ptr_array ref_ptr_array_slice(size_t slice_num) @@ -1728,6 +1792,7 @@ class JOIN :public Sql_alloc void add_keyuses_for_splitting(); bool inject_best_splitting_cond(table_map remaining_tables); bool fix_all_splittings_in_plan(); + bool inject_splitting_cond_for_all_tables_with_split_opt(); void make_notnull_conds_for_range_scans(); bool transform_in_predicates_into_in_subq(THD *thd); @@ -1768,7 +1833,14 @@ class JOIN :public Sql_alloc bool add_having_as_table_cond(JOIN_TAB *tab); bool make_aggr_tables_info(); bool add_fields_for_current_rowid(JOIN_TAB *cur, List *fields); + void free_pushdown_handlers(List& join_list); void init_join_cache_and_keyread(); + bool transform_in_predicates_into_equalities(THD *thd); + bool transform_all_conds_and_on_exprs(THD *thd, + Item_transformer transformer); + bool transform_all_conds_and_on_exprs_in_join_list(THD *thd, + List *join_list, + Item_transformer transformer); }; enum enum_with_bush_roots { WITH_BUSH_ROOTS, WITHOUT_BUSH_ROOTS}; @@ -1828,7 +1900,7 @@ class store_key :public Sql_alloc null_ptr(arg.null_ptr), err(arg.err) {} - virtual ~store_key() {} /** Not actually needed */ + virtual ~store_key() = default; /** Not actually needed */ virtual enum Type type() const=0; virtual const char *name() const=0; virtual bool store_key_is_const() { return false; } @@ -1841,15 +1913,10 @@ class store_key :public Sql_alloc */ enum store_key_result copy(THD *thd) { - enum store_key_result result; enum_check_fields org_count_cuted_fields= thd->count_cuted_fields; - sql_mode_t org_sql_mode= thd->variables.sql_mode; - thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE); - thd->variables.sql_mode|= MODE_INVALID_DATES; - thd->count_cuted_fields= CHECK_FIELD_IGNORE; - result= copy_inner(); + Use_relaxed_field_copy urfc(to_field->table->in_use); + store_key_result result= copy_inner(); thd->count_cuted_fields= org_count_cuted_fields; - thd->variables.sql_mode= org_sql_mode; return result; } @@ -2442,8 +2509,6 @@ class Pushdown_derived: public Sql_alloc Pushdown_derived(TABLE_LIST *tbl, derived_handler *h); - ~Pushdown_derived(); - int execute(); }; @@ -2458,6 +2523,8 @@ int create_sort_index(THD *thd, JOIN *join, JOIN_TAB *tab, Filesort *fsort); JOIN_TAB *first_explain_order_tab(JOIN* join); JOIN_TAB *next_explain_order_tab(JOIN* join, JOIN_TAB* tab); +bool is_eliminated_table(table_map eliminated_tables, TABLE_LIST *tbl); + bool check_simple_equality(THD *thd, const Item::Context &ctx, Item *left_item, Item *right_item, COND_EQUAL *cond_equal); diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc index 307a0b29c5709..fdb9c6477278b 100644 --- a/sql/sql_sequence.cc +++ b/sql/sql_sequence.cc @@ -26,6 +26,9 @@ #include "transaction.h" #include "lock.h" #include "sql_acl.h" +#ifdef WITH_WSREP +#include "wsrep_mysqld.h" +#endif struct Field_definition { @@ -122,7 +125,7 @@ bool sequence_definition::check_and_adjust(bool set_reserved_until) start >= min_value && max_value != LONGLONG_MAX && min_value != LONGLONG_MIN && - cache < (LONGLONG_MAX - max_increment) / max_increment && + cache >= 0 && cache < (LONGLONG_MAX - max_increment) / max_increment && ((real_increment > 0 && reserved_until >= min_value) || (real_increment < 0 && reserved_until <= max_value))) DBUG_RETURN(FALSE); @@ -309,6 +312,11 @@ bool sequence_insert(THD *thd, LEX *lex, TABLE_LIST *org_table_list) DBUG_RETURN(TRUE); } +#ifdef WITH_WSREP + if (WSREP_ON && seq->cache != 0) + WSREP_WARN("CREATE SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +#endif + /* If not temporary table */ if (!temporary_table) { @@ -365,9 +373,14 @@ bool sequence_insert(THD *thd, LEX *lex, TABLE_LIST *org_table_list) seq->reserved_until= seq->start; error= seq->write_initial_sequence(table); - - if (trans_commit_stmt(thd)) - error= 1; + { + uint save_unsafe_rollback_flags= + thd->transaction->stmt.m_unsafe_rollback_flags; + if (trans_commit_stmt(thd)) + error= 1; + thd->transaction->stmt.m_unsafe_rollback_flags= + save_unsafe_rollback_flags; + } if (trans_commit_implicit(thd)) error= 1; @@ -696,7 +709,9 @@ longlong SEQUENCE::next_value(TABLE *table, bool second_round, int *error) { longlong res_value, org_reserved_until, add_to; bool out_of_values; + THD *thd= table->in_use; DBUG_ENTER("SEQUENCE::next_value"); + DBUG_ASSERT(thd); *error= 0; if (!second_round) @@ -761,7 +776,8 @@ longlong SEQUENCE::next_value(TABLE *table, bool second_round, int *error) DBUG_RETURN(next_value(table, 1, error)); } - if (unlikely((*error= write(table, 0)))) + if (unlikely((*error= write(table, thd->variables.binlog_row_image != + BINLOG_ROW_IMAGE_MINIMAL)))) { reserved_until= org_reserved_until; next_free_value= res_value; @@ -828,7 +844,9 @@ int SEQUENCE::set_value(TABLE *table, longlong next_val, ulonglong next_round, longlong org_reserved_until= reserved_until; longlong org_next_free_value= next_free_value; ulonglong org_round= round; + THD *thd= table->in_use; DBUG_ENTER("SEQUENCE::set_value"); + DBUG_ASSERT(thd); write_lock(table); if (is_used) @@ -867,7 +885,8 @@ int SEQUENCE::set_value(TABLE *table, longlong next_val, ulonglong next_round, needs_to_be_stored) { reserved_until= next_free_value; - if (write(table, 0)) + if (write(table, + thd->variables.binlog_row_image != BINLOG_ROW_IMAGE_MINIMAL)) { reserved_until= org_reserved_until; next_free_value= org_next_free_value; @@ -896,15 +915,28 @@ bool Sql_cmd_alter_sequence::execute(THD *thd) No_such_table_error_handler no_such_table_handler; DBUG_ENTER("Sql_cmd_alter_sequence::execute"); + if (check_access(thd, ALTER_ACL, first_table->db.str, &first_table->grant.privilege, &first_table->grant.m_internal, 0, 0)) DBUG_RETURN(TRUE); /* purecov: inspected */ +#ifdef WITH_WSREP + if (WSREP_ON && new_seq->cache != 0) + WSREP_WARN("ALTER SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +#endif + if (check_grant(thd, ALTER_ACL, first_table, FALSE, 1, FALSE)) DBUG_RETURN(TRUE); /* purecov: inspected */ +#ifdef WITH_WSREP + if (WSREP_ON && WSREP(thd) && + wsrep_to_isolation_begin(thd, first_table->db.str, + first_table->table_name.str, + first_table)) + DBUG_RETURN(TRUE); +#endif /* WITH_WSREP */ if (if_exists()) thd->push_internal_handler(&no_such_table_handler); error= open_and_lock_tables(thd, first_table, FALSE, 0); @@ -979,10 +1011,19 @@ bool Sql_cmd_alter_sequence::execute(THD *thd) else table->file->print_error(error, MYF(0)); seq->write_unlock(table); - if (trans_commit_stmt(thd)) - error= 1; - if (trans_commit_implicit(thd)) - error= 1; + { + wait_for_commit* suspended_wfc= thd->suspend_subsequent_commits(); + if (trans_commit_stmt(thd)) + error= 1; + if (trans_commit_implicit(thd)) + error= 1; + thd->resume_subsequent_commits(suspended_wfc); + DBUG_EXECUTE_IF("hold_worker_on_schedule", + { + /* delay binlogging of a parent trx in rpl_parallel_seq */ + my_sleep(100000); + }); + } if (likely(!error)) error= write_bin_log(thd, 1, thd->query(), thd->query_length()); if (likely(!error)) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index d01f84fe7d165..0cc05ebdfcc91 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB + Copyright (c) 2009, 2023, 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 @@ -1072,7 +1072,8 @@ class Show_create_error_handler : public Internal_error_handler { my_snprintf(m_view_access_denied_message, MYSQL_ERRMSG_SIZE, ER_THD(thd, ER_TABLEACCESS_DENIED_ERROR), "SHOW VIEW", m_sctx->priv_user, - m_sctx->host_or_ip, m_top_view->get_table_name()); + m_sctx->host_or_ip, + m_top_view->get_db_name(), m_top_view->get_table_name()); } return m_view_access_denied_message_ptr; } @@ -1164,7 +1165,8 @@ mysqld_show_create_get_fields(THD *thd, TABLE_LIST *table_list, DBUG_PRINT("debug", ("check_table_access failed")); my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), "SHOW", thd->security_ctx->priv_user, - thd->security_ctx->host_or_ip, table_list->alias.str); + thd->security_ctx->host_or_ip, + table_list->db.str, table_list->alias.str); goto exit; } DBUG_PRINT("debug", ("check_table_access succeeded")); @@ -1193,7 +1195,8 @@ mysqld_show_create_get_fields(THD *thd, TABLE_LIST *table_list, { my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), "SHOW", thd->security_ctx->priv_user, - thd->security_ctx->host_or_ip, table_list->alias.str); + thd->security_ctx->host_or_ip, + table_list->db.str, table_list->alias.str); goto exit; } } @@ -1456,7 +1459,7 @@ bool mysqld_show_create_db(THD *thd, LEX_CSTRING *dbname, buffer.append(STRING_WITH_LEN(" /*!40100")); buffer.append(STRING_WITH_LEN(" DEFAULT CHARACTER SET ")); buffer.append(create.default_table_charset->cs_name); - if (!(create.default_table_charset->state & MY_CS_PRIMARY)) + if (Charset(create.default_table_charset).can_have_collate_clause()) { buffer.append(STRING_WITH_LEN(" COLLATE ")); buffer.append(create.default_table_charset->coll_name); @@ -1916,7 +1919,7 @@ static void add_table_options(THD *thd, TABLE *table, { packet->append(STRING_WITH_LEN(" DEFAULT CHARSET=")); packet->append(share->table_charset->cs_name); - if (!(share->table_charset->state & MY_CS_PRIMARY)) + if (Charset(table->s->table_charset).can_have_collate_clause()) { packet->append(STRING_WITH_LEN(" COLLATE=")); packet->append(table->s->table_charset->coll_name); @@ -2202,20 +2205,11 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list, { packet->append(STRING_WITH_LEN(" CHARACTER SET ")); packet->append(field->charset()->cs_name); - } - /* - For string types dump collation name only if - collation is not primary for the given charset - - For generated fields don't print the COLLATE clause if - the collation matches the expression's collation. - */ - if (!(field->charset()->state & MY_CS_PRIMARY) && - (!field->vcol_info || - field->charset() != field->vcol_info->expr->collation.collation)) - { - packet->append(STRING_WITH_LEN(" COLLATE ")); - packet->append(field->charset()->coll_name); + if (Charset(field->charset()).can_have_collate_clause()) + { + packet->append(STRING_WITH_LEN(" COLLATE ")); + packet->append(field->charset()->coll_name); + } } } @@ -2369,6 +2363,9 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list, packet->append_parenthesized((long) key_part->length / key_part->field->charset()->mbmaxlen); } + if (table->file->index_flags(i, j, 0) & HA_READ_ORDER && + key_part->key_part_flag & HA_REVERSE_SORT) /* same in SHOW KEYS */ + packet->append(STRING_WITH_LEN(" DESC")); } if (key_info->without_overlaps) @@ -2455,7 +2452,7 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list, add_table_options(thd, table, create_info_arg, table_list->schema_table != 0, 0, packet); - if (table->versioned()) + if (!DBUG_IF("sysvers_hide") && table->versioned()) packet->append(STRING_WITH_LEN(" WITH SYSTEM VERSIONING")); #ifdef WITH_PARTITION_STORAGE_ENGINE @@ -2636,7 +2633,8 @@ static int show_create_view(THD *thd, TABLE_LIST *table, String *buff) tbl; tbl= tbl->next_global) { - if (cmp(&table->view_db, tbl->view ? &tbl->view_db : &tbl->db)) + if (!tbl->is_derived() && + cmp(&table->view_db, tbl->view ? &tbl->view_db : &tbl->db)) { table->compact_view_format= FALSE; break; @@ -2663,7 +2661,8 @@ static int show_create_view(THD *thd, TABLE_LIST *table, String *buff) a different syntax, like when ANSI_QUOTES is defined. */ table->view->unit.print(buff, enum_query_type(QT_VIEW_INTERNAL | - QT_ITEM_ORIGINAL_FUNC_NULLIF)); + QT_ITEM_ORIGINAL_FUNC_NULLIF | + QT_NO_WRAPPERS_FOR_TVC_IN_VIEW)); if (table->with_check != VIEW_CHECK_NONE) { @@ -3593,6 +3592,7 @@ union Any_pointer { @param variable [in] Details of the variable. @param value_type [in] Variable type. @param show_type [in] Variable show type. + @param status_var [in] Status variable pointer @param charset [out] Character set of the value. @param buff [in,out] Buffer to store the value. (Needs to have enough memory @@ -5102,7 +5102,8 @@ static int fill_schema_table_from_frm(THD *thd, TABLE *table, */ DBUG_ASSERT(thd->open_tables == NULL); thd->mdl_context.rollback_to_savepoint(open_tables_state_backup->mdl_system_tables_svp); - thd->clear_error(); + if (!thd->is_fatal_error) + thd->clear_error(); return res; } @@ -5152,6 +5153,7 @@ class Warnings_only_error_handler : public Internal_error_handler int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) { + DBUG_ENTER("get_all_tables"); LEX *lex= thd->lex; TABLE *table= tables->table; TABLE_LIST table_acl_check; @@ -5169,7 +5171,29 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) uint table_open_method= tables->table_open_method; bool can_deadlock; MEM_ROOT tmp_mem_root; - DBUG_ENTER("get_all_tables"); + /* + We're going to open FRM files for tables. + In case of VIEWs that contain stored function calls, + these stored functions will be parsed and put to the SP cache. + + Suppose we have a view containing a stored function call: + CREATE VIEW v1 AS SELECT f1() AS c1; + and now we're running: + SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME=f1(); + If a parallel thread invalidates the cache, + e.g. by creating or dropping some stored routine, + the SELECT query will re-parse f1() when processing "v1" + and replace the outdated cached version of f1() to a new one. + But the old version of f1() is referenced from the m_sp member + of the Item_func_sp instances used in the WHERE condition. + We cannot destroy it. To avoid such clashes, let's remember + all old routines into a temporary SP cache collection + and process tables with a new empty temporary SP cache collection. + Then restore to the old SP cache collection at the end. + */ + Sp_caches old_sp_caches; + + old_sp_caches.sp_caches_swap(*thd); bzero(&tmp_mem_root, sizeof(tmp_mem_root)); @@ -5318,6 +5342,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) error= 0; goto err; } + if (thd->is_fatal_error) + goto err; DEBUG_SYNC(thd, "before_open_in_get_all_tables"); if (fill_schema_table_by_open(thd, &tmp_mem_root, FALSE, @@ -5343,6 +5369,13 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) thd->restore_backup_open_tables_state(&open_tables_state_backup); free_root(&tmp_mem_root, 0); + /* + Now restore to the saved SP cache collection + and clear the temporary SP cache collection. + */ + old_sp_caches.sp_caches_swap(*thd); + old_sp_caches.sp_caches_clear(); + DBUG_RETURN(error); } @@ -6025,6 +6058,15 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables, show_table->use_all_columns(); // Required for default restore_record(show_table, s->default_values); +#ifndef NO_EMBEDDED_ACCESS_CHECKS + check_access(thd, SELECT_ACL, db_name->str, + &tables->grant.privilege, 0, 0, MY_TEST(tables->schema_table)); + if (is_temporary_table(tables)) + { + tables->grant.privilege|= TMP_TABLE_ACLS; + } +#endif + for (; (field= *ptr) ; ptr++) { if(field->invisible > INVISIBLE_USER) @@ -6044,14 +6086,13 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables, restore_record(table, s->default_values); #ifndef NO_EMBEDDED_ACCESS_CHECKS - ulonglong col_access; - check_access(thd,SELECT_ACL, db_name->str, - &tables->grant.privilege, 0, 0, MY_TEST(tables->schema_table)); - col_access= get_column_grant(thd, &tables->grant, - db_name->str, table_name->str, - field->field_name.str) & COL_ACLS; - if (!tables->schema_table && !col_access) + ulonglong col_access= + get_column_grant(thd, &tables->grant, db_name->str, table_name->str, + field->field_name.str) & COL_ACLS; + + if (!col_access && !tables->schema_table) continue; + char *end= tmp; for (uint bitnr=0; col_access ; col_access>>=1,bitnr++) { @@ -6993,19 +7034,18 @@ static int get_check_constraints_record(THD *thd, TABLE_LIST *tables, #ifndef NO_EMBEDDED_ACCESS_CHECKS TABLE_LIST table_acl_check; bzero((char*) &table_acl_check, sizeof(table_acl_check)); + + if (!(thd->col_access & TABLE_ACLS)) + { + table_acl_check.db= *db_name; + table_acl_check.table_name= *table_name; + table_acl_check.grant.privilege= thd->col_access; + if (check_grant(thd, TABLE_ACLS, &table_acl_check, FALSE, 1, TRUE)) + DBUG_RETURN(res); + } #endif for (uint i= 0; i < tables->table->s->table_check_constraints; i++) { -#ifndef NO_EMBEDDED_ACCESS_CHECKS - if (!(thd->col_access & TABLE_ACLS)) - { - table_acl_check.db= *db_name; - table_acl_check.table_name= *table_name; - table_acl_check.grant.privilege= thd->col_access; - if (check_grant(thd, TABLE_ACLS, &table_acl_check, FALSE, 1, TRUE)) - continue; - } -#endif Virtual_column_info *check= tables->table->check_constraints[i]; table->field[0]->store(STRING_WITH_LEN("def"), system_charset_info); table->field[3]->store(check->name.str, check->name.length, @@ -7130,13 +7170,14 @@ static bool store_trigger(THD *thd, Trigger *trigger, table->field[14]->store(STRING_WITH_LEN("OLD"), cs); table->field[15]->store(STRING_WITH_LEN("NEW"), cs); - if (trigger->create_time) + if (trigger->hr_create_time.val) { + /* timestamp is in microseconds */ table->field[16]->set_notnull(); - thd->variables.time_zone->gmt_sec_to_TIME(×tamp, - (my_time_t)(trigger->create_time/100)); - /* timestamp is with 6 digits */ - timestamp.second_part= (trigger->create_time % 100) * 10000; + thd->variables.time_zone-> + gmt_sec_to_TIME(×tamp, + (my_time_t) hrtime_to_time(trigger->hr_create_time)); + timestamp.second_part= hrtime_sec_part(trigger->hr_create_time); table->field[16]->store_time_dec(×tamp, 2); } @@ -8199,27 +8240,34 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list) TABLE *table; ST_SCHEMA_TABLE *schema_table= table_list->schema_table; ST_FIELD_INFO *fields= schema_table->fields_info; - bool need_all_fieds= table_list->schema_table_reformed || // SHOW command + bool need_all_fields= table_list->schema_table_reformed || // SHOW command thd->lex->only_view_structure(); // need table structure + bool keep_row_order; + TMP_TABLE_PARAM *tmp_table_param; + SELECT_LEX *select_lex; DBUG_ENTER("create_schema_table"); for (; !fields->end_marker(); fields++) field_count++; - TMP_TABLE_PARAM *tmp_table_param = new (thd->mem_root) TMP_TABLE_PARAM; + tmp_table_param = new (thd->mem_root) TMP_TABLE_PARAM; tmp_table_param->init(); tmp_table_param->table_charset= system_charset_info; tmp_table_param->field_count= field_count; tmp_table_param->schema_table= 1; - SELECT_LEX *select_lex= table_list->select_lex; - bool keep_row_order= is_show_command(thd); - if (!(table= create_tmp_table_for_schema(thd, tmp_table_param, *schema_table, - (select_lex->options | thd->variables.option_bits | TMP_TABLE_ALL_COLUMNS), - table_list->alias, !need_all_fieds, keep_row_order))) + select_lex= table_list->select_lex; + keep_row_order= is_show_command(thd); + if (!(table= + create_tmp_table_for_schema(thd, tmp_table_param, *schema_table, + (select_lex->options | + thd->variables.option_bits | + TMP_TABLE_ALL_COLUMNS), + table_list->alias, !need_all_fields, + keep_row_order))) DBUG_RETURN(0); my_bitmap_map* bitmaps= (my_bitmap_map*) thd->alloc(bitmap_buffer_size(field_count)); - my_bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count); + my_bitmap_init(&table->def_read_set, bitmaps, field_count); table->read_set= &table->def_read_set; bitmap_clear_all(table->read_set); table_list->schema_table_param= tmp_table_param; @@ -8642,6 +8690,7 @@ bool optimize_schema_tables_memory_usage(List &tables) if (bitmap_is_set(table->read_set, i)) { field->move_field(cur); + field->reset(); *to_recinfo++= *from_recinfo; cur+= from_recinfo->length; } @@ -8663,6 +8712,7 @@ bool optimize_schema_tables_memory_usage(List &tables) to_recinfo->type= FIELD_NORMAL; to_recinfo++; } + store_record(table, s->default_values); p->recinfo= to_recinfo; // TODO switch from Aria to Memory if all blobs were optimized away? @@ -9048,7 +9098,7 @@ ST_FIELD_INFO columns_fields_info[]= Column("ORDINAL_POSITION", ULonglong(), NOT_NULL, OPEN_FRM_ONLY), Column("COLUMN_DEFAULT", Longtext(MAX_FIELD_VARCHARLENGTH), NULLABLE, "Default",OPEN_FRM_ONLY), - Column("IS_NULLABLE", Yesno(), NOT_NULL, "Null", OPEN_FRM_ONLY), + Column("IS_NULLABLE", Yes_or_empty(), NOT_NULL, "Null", OPEN_FRM_ONLY), Column("DATA_TYPE", Name(), NOT_NULL, OPEN_FRM_ONLY), Column("CHARACTER_MAXIMUM_LENGTH",ULonglong(), NULLABLE, OPEN_FRM_ONLY), Column("CHARACTER_OCTET_LENGTH", ULonglong(), NULLABLE, OPEN_FRM_ONLY), @@ -9059,7 +9109,7 @@ ST_FIELD_INFO columns_fields_info[]= Column("COLLATION_NAME", CSName(), NULLABLE, "Collation", OPEN_FRM_ONLY), Column("COLUMN_TYPE", Longtext(65535), NOT_NULL, "Type", OPEN_FRM_ONLY), Column("COLUMN_KEY", Varchar(3), NOT_NULL, "Key", OPEN_FRM_ONLY), - Column("EXTRA", Varchar(30), NOT_NULL, "Extra", OPEN_FRM_ONLY), + Column("EXTRA", Varchar(80), NOT_NULL, "Extra", OPEN_FRM_ONLY), Column("PRIVILEGES", Varchar(80), NOT_NULL, "Privileges", OPEN_FRM_ONLY), Column("COLUMN_COMMENT", Varchar(COLUMN_COMMENT_MAXLEN), NOT_NULL, "Comment", OPEN_FRM_ONLY), @@ -9085,8 +9135,8 @@ ST_FIELD_INFO collation_fields_info[]= Column("COLLATION_NAME", CSName(), NOT_NULL, "Collation"), Column("CHARACTER_SET_NAME", CSName(), NOT_NULL, "Charset"), Column("ID", SLonglong(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL, "Id"), - Column("IS_DEFAULT", Yesno(), NOT_NULL, "Default"), - Column("IS_COMPILED", Yesno(), NOT_NULL, "Compiled"), + Column("IS_DEFAULT", Yes_or_empty(), NOT_NULL, "Default"), + Column("IS_COMPILED", Yes_or_empty(), NOT_NULL, "Compiled"), Column("SORTLEN", SLonglong(3), NOT_NULL, "Sortlen"), CEnd() }; @@ -9094,10 +9144,10 @@ ST_FIELD_INFO collation_fields_info[]= ST_FIELD_INFO applicable_roles_fields_info[]= { - Column("GRANTEE", Userhost(), NOT_NULL), + Column("GRANTEE", Userhost(), NOT_NULL), Column("ROLE_NAME", Varchar(USERNAME_CHAR_LENGTH), NOT_NULL), - Column("IS_GRANTABLE", Yesno(), NOT_NULL), - Column("IS_DEFAULT", Yesno(), NULLABLE), + Column("IS_GRANTABLE", Yes_or_empty(), NOT_NULL), + Column("IS_DEFAULT", Yes_or_empty(), NULLABLE), CEnd() }; @@ -9220,7 +9270,7 @@ ST_FIELD_INFO stat_fields_info[]= Column("INDEX_NAME", Name(), NOT_NULL, "Key_name", OPEN_FRM_ONLY), Column("SEQ_IN_INDEX", SLonglong(2),NOT_NULL, "Seq_in_index",OPEN_FRM_ONLY), Column("COLUMN_NAME", Name(), NOT_NULL, "Column_name", OPEN_FRM_ONLY), - Column("COLLATION", Varchar(1), NULLABLE, "Collation", OPEN_FRM_ONLY), + Column("COLLATION", Varchar(1), NULLABLE, "Collation", OPEN_FULL_TABLE), Column("CARDINALITY", SLonglong(), NULLABLE, "Cardinality", OPEN_FULL_TABLE), Column("SUB_PART", SLonglong(3),NULLABLE, "Sub_part", OPEN_FRM_ONLY), Column("PACKED", Varchar(10), NULLABLE, "Packed", OPEN_FRM_ONLY), @@ -9241,7 +9291,7 @@ ST_FIELD_INFO view_fields_info[]= Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FRM_ONLY), Column("VIEW_DEFINITION", Longtext(65535), NOT_NULL, OPEN_FRM_ONLY), Column("CHECK_OPTION", Varchar(8), NOT_NULL, OPEN_FRM_ONLY), - Column("IS_UPDATABLE", Yesno(), NOT_NULL, OPEN_FULL_TABLE), + Column("IS_UPDATABLE", Yes_or_empty(), NOT_NULL, OPEN_FULL_TABLE), Column("DEFINER", Definer(), NOT_NULL, OPEN_FRM_ONLY), Column("SECURITY_TYPE", Varchar(7), NOT_NULL, OPEN_FRM_ONLY), Column("CHARACTER_SET_CLIENT", CSName(), NOT_NULL, OPEN_FRM_ONLY), @@ -9253,46 +9303,46 @@ ST_FIELD_INFO view_fields_info[]= ST_FIELD_INFO user_privileges_fields_info[]= { - Column("GRANTEE", Userhost(), NOT_NULL), - Column("TABLE_CATALOG", Catalog(), NOT_NULL), - Column("PRIVILEGE_TYPE", Name(), NOT_NULL), - Column("IS_GRANTABLE", Yesno(), NOT_NULL), + Column("GRANTEE", Userhost(), NOT_NULL), + Column("TABLE_CATALOG", Catalog(), NOT_NULL), + Column("PRIVILEGE_TYPE", Name(), NOT_NULL), + Column("IS_GRANTABLE", Yes_or_empty(), NOT_NULL), CEnd() }; ST_FIELD_INFO schema_privileges_fields_info[]= { - Column("GRANTEE", Userhost(), NOT_NULL), - Column("TABLE_CATALOG", Catalog(), NOT_NULL), - Column("TABLE_SCHEMA", Name(), NOT_NULL), - Column("PRIVILEGE_TYPE", Name(), NOT_NULL), - Column("IS_GRANTABLE", Yesno(), NOT_NULL), + Column("GRANTEE", Userhost(), NOT_NULL), + Column("TABLE_CATALOG", Catalog(), NOT_NULL), + Column("TABLE_SCHEMA", Name(), NOT_NULL), + Column("PRIVILEGE_TYPE", Name(), NOT_NULL), + Column("IS_GRANTABLE", Yes_or_empty(), NOT_NULL), CEnd() }; ST_FIELD_INFO table_privileges_fields_info[]= { - Column("GRANTEE", Userhost(), NOT_NULL), - Column("TABLE_CATALOG", Catalog(), NOT_NULL), - Column("TABLE_SCHEMA", Name(), NOT_NULL), - Column("TABLE_NAME", Name(), NOT_NULL), - Column("PRIVILEGE_TYPE", Name(), NOT_NULL), - Column("IS_GRANTABLE", Yesno(), NOT_NULL), + Column("GRANTEE", Userhost(), NOT_NULL), + Column("TABLE_CATALOG", Catalog(), NOT_NULL), + Column("TABLE_SCHEMA", Name(), NOT_NULL), + Column("TABLE_NAME", Name(), NOT_NULL), + Column("PRIVILEGE_TYPE", Name(), NOT_NULL), + Column("IS_GRANTABLE", Yes_or_empty(), NOT_NULL), CEnd() }; ST_FIELD_INFO column_privileges_fields_info[]= { - Column("GRANTEE", Userhost(), NOT_NULL), - Column("TABLE_CATALOG", Catalog(), NOT_NULL), - Column("TABLE_SCHEMA", Name(), NOT_NULL), - Column("TABLE_NAME", Name(), NOT_NULL), - Column("COLUMN_NAME", Name(), NOT_NULL), - Column("PRIVILEGE_TYPE", Name(), NOT_NULL), - Column("IS_GRANTABLE", Yesno(), NOT_NULL), + Column("GRANTEE", Userhost(), NOT_NULL), + Column("TABLE_CATALOG", Catalog(), NOT_NULL), + Column("TABLE_SCHEMA", Name(), NOT_NULL), + Column("TABLE_NAME", Name(), NOT_NULL), + Column("COLUMN_NAME", Name(), NOT_NULL), + Column("PRIVILEGE_TYPE", Name(), NOT_NULL), + Column("IS_GRANTABLE", Yes_or_empty(), NOT_NULL), CEnd() }; @@ -9433,7 +9483,7 @@ ST_FIELD_INFO sysvars_fields_info[]= Column("NUMERIC_MAX_VALUE", Varchar(MY_INT64_NUM_DECIMAL_DIGITS), NULLABLE), Column("NUMERIC_BLOCK_SIZE", Varchar(MY_INT64_NUM_DECIMAL_DIGITS), NULLABLE), Column("ENUM_VALUE_LIST", Longtext(65535), NULLABLE), - Column("READ_ONLY", Yesno(), NOT_NULL), + Column("READ_ONLY", Yes_or_empty(), NOT_NULL), Column("COMMAND_LINE_ARGUMENT",Name(), NULLABLE), Column("GLOBAL_VALUE_PATH", Varchar(2048), NULLABLE), CEnd() @@ -9941,12 +9991,14 @@ static bool show_create_trigger_impl(THD *thd, Trigger *trigger) p->store(&trigger->db_cl_name, system_charset_info); - if (trigger->create_time) + if (trigger->hr_create_time.val) { MYSQL_TIME timestamp; - thd->variables.time_zone->gmt_sec_to_TIME(×tamp, - (my_time_t)(trigger->create_time/100)); - timestamp.second_part= (trigger->create_time % 100) * 10000; + thd->variables.time_zone-> + gmt_sec_to_TIME(×tamp, + (my_time_t) + hrtime_to_time(trigger->hr_create_time)); + timestamp.second_part= hrtime_sec_part(trigger->hr_create_time); p->store_datetime(×tamp, 2); } else @@ -10112,11 +10164,9 @@ bool show_create_trigger(THD *thd, const sp_name *trg_name) class IS_internal_schema_access : public ACL_internal_schema_access { public: - IS_internal_schema_access() - {} + IS_internal_schema_access() = default; - ~IS_internal_schema_access() - {} + ~IS_internal_schema_access() = default; ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const; diff --git a/sql/sql_signal.h b/sql/sql_signal.h index 433cee21d58a0..abc9905aefbad 100644 --- a/sql/sql_signal.h +++ b/sql/sql_signal.h @@ -36,8 +36,7 @@ class Sql_cmd_common_signal : public Sql_cmd m_set_signal_information(set) {} - virtual ~Sql_cmd_common_signal() - {} + virtual ~Sql_cmd_common_signal() = default; /** Evaluate each signal condition items for this statement. @@ -84,8 +83,7 @@ class Sql_cmd_signal : public Sql_cmd_common_signal : Sql_cmd_common_signal(cond, set) {} - virtual ~Sql_cmd_signal() - {} + virtual ~Sql_cmd_signal() = default; virtual enum_sql_command sql_command_code() const { @@ -111,8 +109,7 @@ class Sql_cmd_resignal : public Sql_cmd_common_signal : Sql_cmd_common_signal(cond, set) {} - virtual ~Sql_cmd_resignal() - {} + virtual ~Sql_cmd_resignal() = default; virtual enum_sql_command sql_command_code() const { diff --git a/sql/sql_sort.h b/sql/sql_sort.h index 6c9a81a32c9ba..82e1f492d6786 100644 --- a/sql/sql_sort.h +++ b/sql/sql_sort.h @@ -20,6 +20,7 @@ #include "my_base.h" /* ha_rows */ #include /* qsort2_cmp */ #include "queues.h" +#include "sql_string.h" #include "sql_class.h" class Field; diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 84d0902193b75..d300fe43b67c2 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -1,5 +1,5 @@ /* Copyright (C) 2009 MySQL AB - Copyright (c) 2019, 2020, MariaDB Corporation. + Copyright (c) 2019, 2022, 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 @@ -519,7 +519,7 @@ class Stat_table } - virtual ~Stat_table() {} + virtual ~Stat_table() = default; /** @brief @@ -1705,7 +1705,7 @@ class Count_distinct_field: public Sql_alloc public: - Count_distinct_field() {} + Count_distinct_field() = default; /** @param @@ -2623,7 +2623,6 @@ int collect_statistics_for_index(THD *thd, TABLE *table, uint index) { int rc= 0; KEY *key_info= &table->key_info[index]; - ha_rows rows= 0; DBUG_ENTER("collect_statistics_for_index"); @@ -2658,7 +2657,6 @@ int collect_statistics_for_index(THD *thd, TABLE *table, uint index) if (rc) break; - rows++; index_prefix_calc.add(); rc= table->file->ha_index_next(table->record[0]); } @@ -4026,50 +4024,16 @@ double Histogram_binary::point_selectivity(Field *field, key_range *endpoint, } else { - /* + /* The value 'pos' fits within one single histogram bucket. - Histogram_binary buckets have the same numbers of rows, but they cover - different ranges of values. - - We assume that values are uniformly distributed across the [0..1] value - range. - */ - - /* - If all buckets covered value ranges of the same size, the width of - value range would be: + We also have avg_sel which is per-table average selectivity of col=const. + If there are popular values, this may be larger than one bucket, so + cap the returned number by the selectivity of one bucket. */ double avg_bucket_width= 1.0 / (get_width() + 1); - - /* - Let's see what is the width of value range that our bucket is covering. - (min==max currently. they are kept in the formula just in case we - will want to extend it to handle multi-bucket case) - */ - double inv_prec_factor= (double) 1.0 / prec_factor(); - double current_bucket_width= - (max + 1 == get_width() ? 1.0 : (get_value(max) * inv_prec_factor)) - - (min == 0 ? 0.0 : (get_value(min-1) * inv_prec_factor)); - - DBUG_ASSERT(current_bucket_width); /* We shouldn't get a one zero-width bucket */ - - /* - So: - - each bucket has the same #rows - - values are unformly distributed across the [min_value,max_value] domain. - If a bucket has value range that's N times bigger then average, than - each value will have to have N times fewer rows than average. - */ - sel= avg_sel * avg_bucket_width / current_bucket_width; - - /* - (Q: if we just follow this proportion we may end up in a situation - where number of different values we expect to find in this bucket - exceeds the number of rows that this histogram has in a bucket. Are - we ok with this or we would want to have certain caps?) - */ + sel= MY_MIN(avg_bucket_width, avg_sel); } return sel; } diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 991b65ef4b298..7a8aa4ef0f48e 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -173,6 +173,17 @@ void Binary_string::qs_append_hex(const char *str, uint32 len) } +void Binary_string::qs_append_hex_uint32(uint32 num) +{ + char *to= Ptr + str_length; + APPEND_HEX(to, (uchar) (num >> 24)); + APPEND_HEX(to, (uchar) (num >> 16)); + APPEND_HEX(to, (uchar) (num >> 8)); + APPEND_HEX(to, (uchar) num); + str_length+= 8; +} + + // Convert a string to its HEX representation bool Binary_string::set_hex(const char *str, uint32 len) { @@ -398,7 +409,7 @@ bool String::copy_aligned(const char *str, size_t arg_length, size_t offset, DBUG_ASSERT(offset && offset != cs->mbminlen); size_t aligned_length= arg_length + offset; - if (alloc(aligned_length)) + if (alloc(aligned_length+1)) return TRUE; /* @@ -552,7 +563,7 @@ bool String::append(const char *s,size_t size) } /* - For an ASCII compatinble string we can just append. + For an ASCII compatible string we can just append. */ return Binary_string::append(s, arg_length); } @@ -666,33 +677,37 @@ bool String::append_with_prefill(const char *s,uint32 arg_length, } -int Binary_string::strstr(const Binary_string &s, uint32 offset) +int Binary_string::strstr(const char *search, uint32 search_length, uint32 offset) { - if (s.length()+offset <= str_length) + if (search_length + offset <= str_length) { - if (!s.length()) + if (!search_length) return ((int) offset); // Empty string is always found - const char *str = Ptr+offset; - const char *search=s.ptr(); - const char *end=Ptr+str_length-s.length()+1; - const char *search_end=s.ptr()+s.length(); + const char *str= Ptr + offset; + const char *end= Ptr + str_length - search_length + 1; + const char *search_end= search + search_length; skip: while (str != end) { if (*str++ == *search) { - char *i,*j; - i=(char*) str; j=(char*) search+1; - while (j != search_end) - if (*i++ != *j++) goto skip; - return (int) (str-Ptr) -1; + char *i= (char*) str; + char *j= (char*) search + 1 ; + while (j != search_end) + if (*i++ != *j++) goto skip; + return (int) (str-Ptr) -1; } } } return -1; } +int Binary_string::strstr(const Binary_string &s, uint32 offset) +{ + return strstr(s.ptr(), s.length(), offset); +} + /* ** Search string from end. Offset is offset to the end of string */ diff --git a/sql/sql_string.h b/sql/sql_string.h index 795f80c3e080f..dbb4760ab3407 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -199,6 +199,87 @@ class Charset LEX_CSTRING collation_specific_name() const; bool encoding_allows_reinterpret_as(CHARSET_INFO *cs) const; bool eq_collation_specific_names(CHARSET_INFO *cs) const; + bool can_have_collate_clause() const + { + return m_charset != &my_charset_bin; + } + + /* + The MariaDB version when the last collation change happened, + e.g. due to a bug fix. See functions below. + */ + static ulong latest_mariadb_version_with_collation_change() + { + return 110002; + } + + /* + Check if the collation with the given ID changed its order + since the given MariaDB version. + */ + static bool collation_changed_order(ulong mysql_version, uint cs_number) + { + if ((mysql_version < 50048 && + (cs_number == 11 || /* ascii_general_ci - bug #29499, bug #27562 */ + cs_number == 41 || /* latin7_general_ci - bug #29461 */ + cs_number == 42 || /* latin7_general_cs - bug #29461 */ + cs_number == 20 || /* latin7_estonian_cs - bug #29461 */ + cs_number == 21 || /* latin2_hungarian_ci - bug #29461 */ + cs_number == 22 || /* koi8u_general_ci - bug #29461 */ + cs_number == 23 || /* cp1251_ukrainian_ci - bug #29461 */ + cs_number == 26)) || /* cp1250_general_ci - bug #29461 */ + (mysql_version < 50124 && + (cs_number == 33 || /* utf8mb3_general_ci - bug #27877 */ + cs_number == 35))) /* ucs2_general_ci - bug #27877 */ + return true; + + if (cs_number == 159 && /* ucs2_general_mysql500_ci - MDEV-30746 */ + ((mysql_version >= 100400 && mysql_version < 100429) || + (mysql_version >= 100500 && mysql_version < 100520) || + (mysql_version >= 100600 && mysql_version < 100613) || + (mysql_version >= 100700 && mysql_version < 100708) || + (mysql_version >= 100800 && mysql_version < 100808) || + (mysql_version >= 100900 && mysql_version < 100906) || + (mysql_version >= 101000 && mysql_version < 101004) || + (mysql_version >= 101100 && mysql_version < 101103) || + (mysql_version >= 110000 && mysql_version < 110002))) + return true; + return false; + } + + /** + Check if a collation has changed ID since the given version. + Return the new ID. + + @param mysql_version + @param cs_number - collation ID + + @retval the new collation ID (or cs_number, if no change) + */ + + static uint upgrade_collation_id(ulong mysql_version, uint cs_number) + { + if (mysql_version >= 50300 && mysql_version <= 50399) + { + switch (cs_number) { + case 149: return MY_PAGE2_COLLATION_ID_UCS2; // ucs2_crotian_ci + case 213: return MY_PAGE2_COLLATION_ID_UTF8; // utf8_crotian_ci + } + } + if ((mysql_version >= 50500 && mysql_version <= 50599) || + (mysql_version >= 100000 && mysql_version <= 100005)) + { + switch (cs_number) { + case 149: return MY_PAGE2_COLLATION_ID_UCS2; // ucs2_crotian_ci + case 213: return MY_PAGE2_COLLATION_ID_UTF8; // utf8_crotian_ci + case 214: return MY_PAGE2_COLLATION_ID_UTF32; // utf32_croatian_ci + case 215: return MY_PAGE2_COLLATION_ID_UTF16; // utf16_croatian_ci + case 245: return MY_PAGE2_COLLATION_ID_UTF8MB4;// utf8mb4_croatian_ci + } + } + return cs_number; + } + }; @@ -326,6 +407,7 @@ class Binary_string: public Sql_alloc // Returns offset to substring or -1 int strstr(const Binary_string &search, uint32 offset=0); + int strstr(const char *search, uint32 search_length, uint32 offset=0); // Returns offset to substring or -1 int strrstr(const Binary_string &search, uint32 offset=0); @@ -395,6 +477,7 @@ class Binary_string: public Sql_alloc } void qs_append(const char *str, size_t len); void qs_append_hex(const char *str, uint32 len); + void qs_append_hex_uint32(uint32 num); void qs_append(double d); void qs_append(const double *d); inline void qs_append(const char c) @@ -610,7 +693,13 @@ class Binary_string: public Sql_alloc } return false; } - + bool append_hex_uint32(uint32 num) + { + if (reserve(8)) + return true; + qs_append_hex_uint32(num); + return false; + } bool append_with_step(const char *s, uint32 arg_length, uint32 step_alloc) { uint32 new_length= arg_length + str_length; @@ -695,7 +784,7 @@ class Binary_string: public Sql_alloc Note that if arg_length == Alloced_length then we don't allocate. This ensures we don't do any extra allocations in protocol and String:int, - but the string will not be atomically null terminated if c_ptr() is not + but the string will not be automatically null terminated if c_ptr() is not called. */ if (arg_length <= Alloced_length && Alloced_length) @@ -792,7 +881,7 @@ class Binary_string: public Sql_alloc class String: public Charset, public Binary_string { public: - String() { } + String() = default; String(size_t length_arg) :Binary_string(length_arg) { } /* @@ -806,9 +895,7 @@ class String: public Charset, public Binary_string String(char *str, size_t len, CHARSET_INFO *cs) :Charset(cs), Binary_string(str, len) { } - String(const String &str) - :Charset(str), Binary_string(str) - { } + String(const String &str) = default; void set(String &str,size_t offset,size_t arg_length) { @@ -983,6 +1070,17 @@ class String: public Charset, public Binary_string { return append(&ls); } + bool append_name_value(const LEX_CSTRING &name, + const LEX_CSTRING &value, + uchar quot= '\0') + { + return + append(name) || + append('=') || + (quot && append(quot)) || + append(value) || + (quot && append(quot)); + } bool append(const char *s, size_t size); bool append_with_prefill(const char *s, uint32 arg_length, uint32 full_length, char fill_char); @@ -995,6 +1093,37 @@ class String: public Charset, public Binary_string return append(s.str, s.length, cs); } + /* + Append a bitmask in an uint32 with a translation into a + C-style human readable representation, e.g.: + 0x05 -> "(flag04|flag01)" + + @param flags - the flags to translate + @param names - an array of flag names + @param count - the number of available elements in "names" + */ + bool append_flag32_names(uint32 flags, LEX_CSTRING names[], size_t count) + { + bool added= false; + if (flags && append('(')) + return true; + for (ulong i= 0; i <= 31; i++) + { + ulong bit= 31 - i; + if (flags & (1 << bit)) + { + if (added && append('|')) + return true; + if (bit < count ? append(names[bit]) : append('?')) + return true; + added= true; + } + } + if (flags && append(')')) + return true; + return false; + } + void strip_sp(); friend String *copy_if_not_alloced(String *a,String *b,uint32 arg_length); friend class Field; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 7d9fd0c516d03..88b29d2b59e4c 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2019, Oracle and/or its affiliates. - Copyright (c) 2010, 2021, MariaDB + Copyright (c) 2010, 2022, 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 @@ -19,6 +19,7 @@ /* drop and alter of tables */ #include "mariadb.h" +#include "sql_class.h" #include "sql_priv.h" #include "unireg.h" #include "debug_sync.h" @@ -58,6 +59,11 @@ #include "ddl_log.h" #include "debug.h" // debug_crash_here() #include +#include "wsrep_mysqld.h" +#include "rpl_mi.h" +#include "rpl_rli.h" +#include "log.h" +#include "sql_debug.h" #ifdef _WIN32 #include @@ -89,6 +95,12 @@ static int mysql_prepare_create_table(THD *, HA_CREATE_INFO *, Alter_info *, static uint blob_length_by_type(enum_field_types type); static bool fix_constraints_names(THD *, List *, const HA_CREATE_INFO *); +static bool wait_for_master(THD *thd); +static int process_master_state(THD *thd, int alter_result, + uint64 &start_alter_id, bool if_exists); +static bool +write_bin_log_start_alter_rollback(THD *thd, uint64 &start_alter_id, + bool &partial_alter, bool if_exists); /** @brief Helper function for explain_filename @@ -992,7 +1004,16 @@ int write_bin_log(THD *thd, bool clear_error, int errcode= 0; thd_proc_info(thd, "Writing to binlog"); if (clear_error) + { + if (global_system_variables.log_warnings > 2) + { + uint err_clear= thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0; + if (err_clear) + sql_print_warning("Error code %d of query '%s' is cleared at its " + "binary logging.", err_clear, query); + } thd->clear_error(); + } else errcode= query_error_code(thd, TRUE); error= thd->binlog_query(THD::STMT_QUERY_TYPE, @@ -1004,21 +1025,40 @@ int write_bin_log(THD *thd, bool clear_error, } -/* - Write to binary log with optional adding "IF EXISTS" +/** + Write to binary log the query event whose text is taken from thd->query(). - The query is taken from thd->query() + @param thd Thread handle. + @param clear_error Whether to clear out any error from + execution context and binlog event. + @param is_trans Whether the query changed transactional data. + @param add_if_exists True indicates the binary logging of the query + should be done with "if exists" option. + @param commit_alter Whether the query should be binlogged as + Commit Alter. + + @return false on Success + @return true otherwise */ int write_bin_log_with_if_exists(THD *thd, bool clear_error, - bool is_trans, bool add_if_exists) + bool is_trans, bool add_if_exists, + bool commit_alter) { int result; ulonglong save_option_bits= thd->variables.option_bits; if (add_if_exists) thd->variables.option_bits|= OPTION_IF_EXISTS; + if (commit_alter) + thd->set_binlog_flags_for_alter(Gtid_log_event::FL_COMMIT_ALTER_E1); + result= write_bin_log(thd, clear_error, thd->query(), thd->query_length(), is_trans); + if (commit_alter) + { + thd->set_binlog_flags_for_alter(0); + thd->set_binlog_start_alter_seq_no(0); + } thd->variables.option_bits= save_option_bits; return result; } @@ -1258,7 +1298,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, StringBuffer<160> unknown_tables(system_charset_info); DDL_LOG_STATE local_ddl_log_state; const char *comment_start; - uint not_found_errors= 0, table_count= 0, non_temp_tables_count= 0; + uint table_count= 0, non_temp_tables_count= 0; int error= 0; uint32 comment_len; bool trans_tmp_table_deleted= 0, non_trans_tmp_table_deleted= 0; @@ -1389,7 +1429,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, unknown_tables.append(&table_name); unknown_tables.append(','); error= ENOENT; - not_found_errors++; continue; } @@ -1472,7 +1511,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, unknown_tables.append(&table_name); unknown_tables.append(','); error= ENOENT; - not_found_errors++; continue; } @@ -1718,7 +1756,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, } else { - not_found_errors++; if (unknown_tables.append(tbl_name) || unknown_tables.append(',')) { error= 1; @@ -1793,13 +1830,16 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, } error= thd->is_error(); + if (non_temp_tables_count) + query_cache_invalidate3(thd, tables, 0); + /* We are always logging drop of temporary tables. The reason is to handle the following case: - Use statement based replication - CREATE TEMPORARY TABLE foo (logged) - set row based replication - - DROP TEMPORAY TABLE foo (needs to be logged) + - DROP TEMPORARY TABLE foo (needs to be logged) This should be fixed so that we remember if creation of the temporary table was logged and only log it if the creation was logged. @@ -1811,7 +1851,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, if (non_trans_tmp_table_deleted || trans_tmp_table_deleted) thd->transaction->stmt.mark_dropped_temp_table(); - query_cache_invalidate3(thd, tables, 0); if (!dont_log_query && mysql_bin_log.is_open()) { debug_crash_here("ddl_log_drop_before_binlog"); @@ -1999,17 +2038,13 @@ bool quick_rm_table(THD *thd, handlerton *base, const LEX_CSTRING *db, const char *table_path) { char path[FN_REFLEN + 1]; + const size_t pathmax = sizeof(path) - 1 - reg_ext_length; int error= 0; DBUG_ENTER("quick_rm_table"); size_t path_length= table_path ? - (strxnmov(path, sizeof(path) - 1, table_path, reg_ext, NullS) - path) : - build_table_filename(path, sizeof(path)-1, db->str, table_name->str, - reg_ext, flags); - if (!(flags & NO_FRM_RENAME)) - if (mysql_file_delete(key_file_frm, path, MYF(0))) - error= 1; /* purecov: inspected */ - path[path_length - reg_ext_length]= '\0'; // Remove reg_ext + (strxnmov(path, pathmax, table_path, NullS) - path) : + build_table_filename(path, pathmax, db->str, table_name->str, "", flags); if ((flags & (NO_HA_TABLE | NO_PAR_TABLE)) == NO_HA_TABLE) { handler *file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base); @@ -2019,8 +2054,14 @@ bool quick_rm_table(THD *thd, handlerton *base, const LEX_CSTRING *db, delete file; } if (!(flags & (FRM_ONLY|NO_HA_TABLE))) - if (ha_delete_table(thd, base, path, db, table_name, 0) > 0) - error= 1; + error|= ha_delete_table(thd, base, path, db, table_name, 0) > 0; + + if (!(flags & NO_FRM_RENAME)) + { + memcpy(path + path_length, reg_ext, reg_ext_length + 1); + if (mysql_file_delete(key_file_frm, path, MYF(0))) + error= 1; /* purecov: inspected */ + } if (likely(error == 0)) { @@ -2254,13 +2295,17 @@ bool Column_definition::prepare_stage2(handler *file, void promote_first_timestamp_column(List *column_definitions) { + bool first= true; for (Create_field &column_definition : *column_definitions) { if (column_definition.is_timestamp_type() || // TIMESTAMP column_definition.unireg_check == Field::TIMESTAMP_OLD_FIELD) // Legacy { + if (!column_definition.explicitly_nullable) + column_definition.flags|= NOT_NULL_FLAG; DBUG_PRINT("info", ("field-ptr:%p", column_definition.field)); - if ((column_definition.flags & NOT_NULL_FLAG) != 0 && // NOT NULL, + if (first && + (column_definition.flags & NOT_NULL_FLAG) != 0 && // NOT NULL, column_definition.default_value == NULL && // no constant default, column_definition.unireg_check == Field::NONE && // no function default column_definition.vcol_info == NULL && @@ -2274,14 +2319,14 @@ void promote_first_timestamp_column(List *column_definitions) )); column_definition.unireg_check= Field::TIMESTAMP_DNUN_FIELD; } - return; + first= false; } } } static bool key_cmp(const Key_part_spec &a, const Key_part_spec &b) { - return a.length == b.length && + return a.length == b.length && a.asc == b.asc && !lex_string_cmp(system_charset_info, &a.field_name, &b.field_name); } @@ -2906,7 +2951,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, List_iterator key_iterator(alter_info->key_list); List_iterator key_iterator2(alter_info->key_list); - uint key_parts=0, fk_key_count=0; + uint key_parts=0; bool primary_key=0,unique_key=0; Key *key, *key2; uint tmp, key_number; @@ -2922,7 +2967,6 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, "(none)" , key->type)); if (key->type == Key::FOREIGN_KEY) { - fk_key_count++; Foreign_key *fk_key= (Foreign_key*) key; if (fk_key->validate(alter_info->create_list)) DBUG_RETURN(TRUE); @@ -3328,6 +3372,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, key_part_info->fieldnr= field; key_part_info->offset= (uint16) sql_field->offset; key_part_info->key_type=sql_field->pack_flag; + key_part_info->key_part_flag= column->asc ? 0 : HA_REVERSE_SORT; uint key_part_length= sql_field->type_handler()-> calc_key_length(*sql_field); @@ -3599,7 +3644,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, !sql_field->has_default_function() && (sql_field->flags & NOT_NULL_FLAG) && (!sql_field->is_timestamp_type() || - opt_explicit_defaults_for_timestamp)&& + (thd->variables.option_bits & OPTION_EXPLICIT_DEF_TIMESTAMP))&& !sql_field->vers_sys_field()) { sql_field->flags|= NO_DEFAULT_VALUE_FLAG; @@ -3610,7 +3655,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, !sql_field->default_value && !sql_field->vcol_info && !sql_field->vers_sys_field() && sql_field->is_timestamp_type() && - !opt_explicit_defaults_for_timestamp && + !(thd->variables.option_bits & OPTION_EXPLICIT_DEF_TIMESTAMP) && (sql_field->flags & NOT_NULL_FLAG) && (type == Field::NONE || type == Field::TIMESTAMP_UN_FIELD)) { @@ -3735,7 +3780,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, my_error(ER_TOO_LONG_IDENT, MYF(0), check->name.str); DBUG_RETURN(TRUE); } - if (check_expression(check, &check->name, VCOL_CHECK_TABLE)) + if (check_expression(check, &check->name, VCOL_CHECK_TABLE, alter_info)) DBUG_RETURN(TRUE); } } @@ -3757,6 +3802,13 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, thd->mem_root)) DBUG_RETURN(TRUE); +#ifndef DBUG_OFF + DBUG_EXECUTE_IF("key", + Debug_key::print_keys(thd, "prep_create_table: ", + *key_info_buffer, *key_count); + ); +#endif + DBUG_RETURN(FALSE); } @@ -4457,7 +4509,7 @@ int create_table_impl(THD *thd, else if (options.if_not_exists()) { /* - We never come here as part of normal create table as table existance + We never come here as part of normal create table as table existence is checked in open_and_lock_tables(). We may come here as part of ALTER TABLE when converting a table for a distributed engine to a a local one. @@ -4773,7 +4825,7 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table, else create_table_mode= C_ASSISTED_DISCOVERY; - if (!opt_explicit_defaults_for_timestamp) + if (!(thd->variables.option_bits & OPTION_EXPLICIT_DEF_TIMESTAMP)) promote_first_timestamp_column(&alter_info->create_list); /* We can abort create table for any table type */ @@ -5067,7 +5119,7 @@ mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db, length= build_table_filename(to, sizeof(to) - 1, new_db->str, new_name->str, "", flags & FN_TO_IS_TMP); // Check if we hit FN_REFLEN bytes along with file extension. - if (length+reg_ext_length >= FN_REFLEN) + if (length+reg_ext_length > FN_REFLEN) { my_error(ER_IDENT_CAUSES_TOO_LONG_PATH, MYF(0), (int) sizeof(to)-1, to); DBUG_RETURN(TRUE); @@ -5225,6 +5277,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, if ((duplicate= unique_table(thd, table, src_table, 0))) { update_non_unique_table_error(src_table, "CREATE", duplicate); + res= 1; goto err; } } @@ -5248,8 +5301,15 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, #ifdef WITH_PARTITION_STORAGE_ENGINE /* Partition info is not handled by mysql_prepare_alter_table() call. */ if (src_table->table->part_info) - thd->work_part_info= src_table->table->part_info->get_clone(thd); -#endif + { + /* + The CREATE TABLE LIKE should not inherit the DATA DIRECTORY + and INDEX DIRECTORY from the base table. + So that TRUE argument for the get_clone. + */ + thd->work_part_info= src_table->table->part_info->get_clone(thd, TRUE); + } +#endif /*WITH_PARTITION_STORAGE_ENGINE*/ /* Adjust description of source table before using it for creation of @@ -5589,6 +5649,9 @@ int mysql_discard_or_import_tablespace(THD *thd, if (unlikely(error)) goto err; + if (discard) + table_list->table->s->tdc->flush(thd, true); + /* The 0 in the call below means 'not in a transaction', which means immediate invalidation; that is probably what we wish here @@ -6162,10 +6225,8 @@ handle_if_exists_options(THD *thd, TABLE *table, Alter_info *alter_info, while ((check=it++)) { - if (!(check->flags & VCOL_CHECK_CONSTRAINT_IF_NOT_EXISTS) && - check->name.length) + if (!check->if_not_exists && check->name.length) continue; - check->flags= 0; for (c= share->field_check_constraints; c < share->table_check_constraints ; c++) { @@ -6335,6 +6396,14 @@ Compare_keys compare_keys_but_name(const KEY *table_key, const KEY *new_key, return Compare_keys::NotEqual; } + /* + Check the descending flag for index field. + */ + if ((new_part->key_part_flag ^ key_part->key_part_flag) & HA_REVERSE_SORT) + { + return Compare_keys::NotEqual; + } + auto compare= table->file->compare_key_parts( *table->field[key_part->fieldnr - 1], new_field, *key_part, *new_part); result= merge(result, compare); @@ -6516,7 +6585,7 @@ static bool fill_alter_inplace_info(THD *thd, TABLE *table, bool varchar, bool is_equal= field->is_equal(*new_field); if (!is_equal) { - if (field->can_be_converted_by_engine(*new_field)) + if (field->table->file->can_convert_nocopy(*field, *new_field)) { /* New column type differs from the old one, but storage engine can @@ -6971,10 +7040,8 @@ static void update_altered_table(const Alter_inplace_info &ha_alter_info, @retval false success */ -bool mysql_compare_tables(TABLE *table, - Alter_info *alter_info, - HA_CREATE_INFO *create_info, - bool *metadata_equal) +bool mysql_compare_tables(TABLE *table, Alter_info *alter_info, + HA_CREATE_INFO *create_info, bool *metadata_equal) { DBUG_ENTER("mysql_compare_tables"); @@ -6999,15 +7066,14 @@ bool mysql_compare_tables(TABLE *table, Alter_info tmp_alter_info(*alter_info, thd->mem_root); uint db_options= 0; /* not used */ KEY *key_info_buffer= NULL; - LEX_CSTRING db= { table->s->db.str, table->s->db.length }; - LEX_CSTRING table_name= { table->s->db.str, table->s->table_name.length }; /* Create the prepared information. */ int create_table_mode= table->s->tmp_table == NO_TMP_TABLE ? C_ORDINARY_CREATE : C_ALTER_TABLE; if (mysql_prepare_create_table(thd, create_info, &tmp_alter_info, &db_options, table->file, &key_info_buffer, - &key_count, create_table_mode, db, table_name)) + &key_count, create_table_mode, + table->s->db, table->s->table_name)) DBUG_RETURN(1); /* Some very basic checks. */ @@ -7102,7 +7168,8 @@ bool mysql_compare_tables(TABLE *table, are equal. Comparing field numbers is sufficient. */ if ((table_part->length != new_part->length) || - (table_part->fieldnr - 1 != new_part->fieldnr)) + (table_part->fieldnr - 1 != new_part->fieldnr) || + ((table_part->key_part_flag ^ new_part->key_part_flag) & HA_REVERSE_SORT)) DBUG_RETURN(false); } } @@ -7287,6 +7354,86 @@ static bool notify_tabledef_changed(TABLE_LIST *table_list) DBUG_RETURN(0); } +/** + The function is invoked in error branches of ALTER processing. + Write Rollback alter in case of partial_alter is true else + call process_master_state. + + @param thd Thread handle. + @param[in/out] + start_alter_id Start Alter identifier or zero, + it is reset to zero. + @param[in/out] + partial_alter When is true at the function enter + that indicates Start Alter phase completed; + it then is reset to false. + @param if_exists True indicates the binary logging of the query + should be done with "if exists" option. + + @return false on Success + @return true otherwise +*/ +static bool +write_bin_log_start_alter_rollback(THD *thd, uint64 &start_alter_id, + bool &partial_alter, bool if_exists) +{ +#if defined(HAVE_REPLICATION) + if (start_alter_id) + { + start_alter_info *info= thd->rgi_slave->sa_info; + Master_info *mi= thd->rgi_slave->rli->mi; + + if (info->sa_seq_no == 0) + { + /* + Error occurred before SA got to processing incl its binlogging. + So it's a failure to apply and thus no need to wait for master's + completion result. + */ + return true; + } + mysql_mutex_lock(&mi->start_alter_lock); + if (info->direct_commit_alter) + { + DBUG_ASSERT(info->state == start_alter_state::ROLLBACK_ALTER); + + /* + SA may end up in the rollback state through FTWRL that breaks + SA's waiting for a master decision. + Then it completes "officially", and `direct_commit_alter` true status + will affect the future of CA to re-execute the whole query. + */ + info->state= start_alter_state::COMPLETED; + if (info->direct_commit_alter) + mysql_cond_broadcast(&info->start_alter_cond); + mysql_mutex_unlock(&mi->start_alter_lock); + + return true; // not really an error to be handled by caller specifically + } + mysql_mutex_unlock(&mi->start_alter_lock); + /* + We have to call wait for master here because in main calculation + we can error out before calling wait for master + (for example if copy_data_between_tables fails) + */ + if (info->state == start_alter_state::REGISTERED) + wait_for_master(thd); + if(process_master_state(thd, 1, start_alter_id, if_exists)) + return true; + } + else +#endif + if (partial_alter) // Write only if SA written + { + // Send the rollback message + Write_log_with_flags wlwf(thd, Gtid_log_event::FL_ROLLBACK_ALTER_E1); + if(write_bin_log_with_if_exists(thd, false, false, if_exists, false)) + return true; + partial_alter= false; + } + return false; +} + /** Perform in-place alter table. @@ -7300,9 +7447,17 @@ static bool notify_tabledef_changed(TABLE_LIST *table_list) used during different phases. @param target_mdl_request Metadata request/lock on the target table name. @param alter_ctx ALTER TABLE runtime context. - - @retval true Error - @retval false Success + @param partial_alter Is set to true to return the fact of the first + "START ALTER" binlogging phase is done. + @param[in/out] + start_alter_id Gtid seq_no of START ALTER or zero otherwise; + it may get changed to return to the caller. + @param if_exists True indicates the binary logging of the query + should be done with "if exists" option. + + @retval >=1 Error{ 1= ROLLBACK recieved from master , 2= error + in alter so no ROLLBACK in binlog } + @retval 0 Success @note If mysql_alter_table does not need to copy the table, it is @@ -7325,13 +7480,16 @@ static bool mysql_inplace_alter_table(THD *thd, MDL_request *target_mdl_request, DDL_LOG_STATE *ddl_log_state, TRIGGER_RENAME_PARAM *trigger_param, - Alter_table_ctx *alter_ctx) + Alter_table_ctx *alter_ctx, + bool &partial_alter, + uint64 &start_alter_id, bool if_exists) { Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN | MYSQL_OPEN_IGNORE_KILLED); handlerton *db_type= table->s->db_type(); Alter_info *alter_info= ha_alter_info->alter_info; bool reopen_tables= false; bool res, commit_succeded_with_error= 0; + const enum_alter_inplace_result inplace_supported= ha_alter_info->inplace_supported; DBUG_ENTER("mysql_inplace_alter_table"); @@ -7350,16 +7508,15 @@ static bool mysql_inplace_alter_table(THD *thd, lock for prepare phase under LOCK TABLES in the same way as when exclusive lock is required for duration of the whole statement. */ - if (!ha_alter_info->mdl_exclusive_after_prepare && - (inplace_supported == HA_ALTER_INPLACE_EXCLUSIVE_LOCK || - ((inplace_supported == HA_ALTER_INPLACE_COPY_NO_LOCK || + if (inplace_supported == HA_ALTER_INPLACE_EXCLUSIVE_LOCK || + ((inplace_supported == HA_ALTER_INPLACE_COPY_NO_LOCK || inplace_supported == HA_ALTER_INPLACE_COPY_LOCK || inplace_supported == HA_ALTER_INPLACE_NOCOPY_NO_LOCK || inplace_supported == HA_ALTER_INPLACE_NOCOPY_LOCK || inplace_supported == HA_ALTER_INPLACE_INSTANT) && (thd->locked_tables_mode == LTM_LOCK_TABLES || thd->locked_tables_mode == LTM_PRELOCKED_UNDER_LOCK_TABLES)) || - alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_EXCLUSIVE)) + alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_EXCLUSIVE) { if (wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN)) goto cleanup; @@ -7412,10 +7569,31 @@ static bool mysql_inplace_alter_table(THD *thd, thd->variables.lock_wait_timeout)) goto cleanup; + DBUG_ASSERT(table->s->tmp_table == NO_TMP_TABLE || start_alter_id == 0); + + if (table->s->tmp_table == NO_TMP_TABLE) + { + if (write_bin_log_start_alter(thd, partial_alter, start_alter_id, + if_exists)) + goto cleanup; + } + else if (start_alter_id) + { + DBUG_ASSERT(thd->rgi_slave); + + my_error(ER_INCONSISTENT_SLAVE_TEMP_TABLE, MYF(0), thd->query(), + table_list->db.str, table_list->table_name.str); + goto cleanup; + } + + DBUG_EXECUTE_IF("start_alter_kill_after_binlog", { + DBUG_SUICIDE(); + }); + + // It's now safe to take the table level lock. if (lock_tables(thd, table_list, alter_ctx->tables_opened, 0)) goto cleanup; - DEBUG_SYNC(thd, "alter_table_inplace_after_lock_upgrade"); THD_STAGE_INFO(thd, stage_alter_inplace_prepare); @@ -7471,7 +7649,8 @@ static bool mysql_inplace_alter_table(THD *thd, necessary only for prepare phase (unless we are not under LOCK TABLES) and user has not explicitly requested exclusive lock. */ - if ((inplace_supported == HA_ALTER_INPLACE_COPY_NO_LOCK || + if (!ha_alter_info->mdl_exclusive_after_prepare && + (inplace_supported == HA_ALTER_INPLACE_COPY_NO_LOCK || inplace_supported == HA_ALTER_INPLACE_COPY_LOCK || inplace_supported == HA_ALTER_INPLACE_NOCOPY_LOCK || inplace_supported == HA_ALTER_INPLACE_NOCOPY_NO_LOCK) && @@ -7494,14 +7673,23 @@ static bool mysql_inplace_alter_table(THD *thd, DEBUG_SYNC(thd, "alter_table_inplace_after_lock_downgrade"); THD_STAGE_INFO(thd, stage_alter_inplace); + DBUG_EXECUTE_IF("start_alter_delay_master", { + debug_sync_set_action(thd, + STRING_WITH_LEN("now wait_for alter_cont NO_CLEAR_EVENT")); + }); /* We can abort alter table for any table type */ thd->abort_on_warning= !ha_alter_info->ignore && thd->is_strict_mode(); res= table->file->ha_inplace_alter_table(altered_table, ha_alter_info); thd->abort_on_warning= false; + + if (start_alter_id && wait_for_master(thd)) + goto rollback; + if (res) goto rollback; + DEBUG_SYNC(thd, "alter_table_inplace_before_lock_upgrade"); // Upgrade to EXCLUSIVE before commit. if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_RENAME)) @@ -7610,7 +7798,7 @@ static bool mysql_inplace_alter_table(THD *thd, thd->is_error()) { // Since changes were done in-place, we can't revert them. - DBUG_RETURN(true); + goto err; } debug_crash_here("ddl_log_alter_after_rename_frm"); @@ -7627,7 +7815,7 @@ static bool mysql_inplace_alter_table(THD *thd, If the rename fails we will still have a working table with the old name, but with other changes applied. */ - DBUG_RETURN(true); + goto err; } debug_crash_here("ddl_log_alter_before_rename_triggers"); if (Table_triggers_list::change_table_name(thd, trigger_param, @@ -7672,6 +7860,8 @@ static bool mysql_inplace_alter_table(THD *thd, if (thd->locked_tables_list.reopen_tables(thd, false)) thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0); } + +err: DBUG_RETURN(true); } @@ -7714,6 +7904,22 @@ void append_drop_column(THD *thd, String *str, Field *field) } +#ifdef WITH_PARTITION_STORAGE_ENGINE +static inline +void rename_field_in_list(Create_field *field, List *field_list) +{ + DBUG_ASSERT(field->change.str); + List_iterator it(*field_list); + while (const char *name= it++) + { + if (my_strcasecmp(system_charset_info, name, field->change.str)) + continue; + it.replace(field->field_name.str); + } +} +#endif + + /** Prepare column and key definitions for CREATE TABLE in ALTER TABLE. @@ -7765,6 +7971,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, { /* New column definitions are added here */ List new_create_list; + /* System-invisible fields must be added last */ + List new_create_tail; /* New key definitions are added here */ List new_key_list; List rename_key_list(alter_info->alter_rename_key_list); @@ -7863,8 +8071,9 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, thd->calloc(sizeof(void*) * table->s->keys)) == NULL) DBUG_RETURN(1); - create_info->option_list= merge_engine_table_options(table->s->option_list, - create_info->option_list, thd->mem_root); + if (merge_engine_options(table->s->option_list, create_info->option_list, + &create_info->option_list, thd->mem_root)) + DBUG_RETURN(1); /* First collect all fields from table which isn't in drop_list @@ -7978,14 +8187,19 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, def->invisible= INVISIBLE_SYSTEM; alter_info->flags|= ALTER_CHANGE_COLUMN; if (field->flags & VERS_ROW_START) - create_info->vers_info.as_row.start= def->field_name= Vers_parse_info::default_start; + create_info->vers_info.period.start= + create_info->vers_info.as_row.start= + def->field_name= Vers_parse_info::default_start; + else - create_info->vers_info.as_row.end= def->field_name= Vers_parse_info::default_end; + create_info->vers_info.period.end= + create_info->vers_info.as_row.end= + def->field_name= Vers_parse_info::default_end; new_create_list.push_back(def, thd->mem_root); dropped_sys_vers_fields|= field->flags; drop_it.remove(); } - else + else if (field->invisible < INVISIBLE_SYSTEM) { /* This field was not dropped and not changed, add it to the list @@ -8009,9 +8223,15 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, def->field_name= alter->new_name; column_rename_param.fields.push_back(def); if (field->flags & VERS_ROW_START) + { create_info->vers_info.as_row.start= alter->new_name; + create_info->vers_info.period.start= alter->new_name; + } else if (field->flags & VERS_ROW_END) + { create_info->vers_info.as_row.end= alter->new_name; + create_info->vers_info.period.end= alter->new_name; + } if (table->s->period.name) { if (field == table->period_start_field()) @@ -8030,6 +8250,12 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, alter_it.remove(); } } + else + { + DBUG_ASSERT(field->invisible == INVISIBLE_SYSTEM); + def= new (thd->mem_root) Create_field(thd, field, field); + new_create_tail.push_back(def, thd->mem_root); + } } /* @@ -8061,6 +8287,36 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, field->default_value->expr->walk(&Item::rename_fields_processor, 1, &column_rename_param); } +#ifdef WITH_PARTITION_STORAGE_ENGINE + if (thd->work_part_info) + { + partition_info *part_info= thd->work_part_info; + List_iterator def_it(column_rename_param.fields); + const bool part_field_list= !part_info->part_field_list.is_empty(); + const bool subpart_field_list= !part_info->subpart_field_list.is_empty(); + if (part_info->part_expr) + part_info->part_expr->walk(&Item::rename_fields_processor, 1, + &column_rename_param); + if (part_info->subpart_expr) + part_info->subpart_expr->walk(&Item::rename_fields_processor, 1, + &column_rename_param); + if (part_field_list || subpart_field_list) + { + while (Create_field *def= def_it++) + { + if (def->change.str) + { + if (part_field_list) + rename_field_in_list(def, &part_info->part_field_list); + if (subpart_field_list) + rename_field_in_list(def, &part_info->subpart_field_list); + } /* if (def->change.str) */ + } /* while (def) */ + } /* if (part_field_list || subpart_field_list) */ + // Force reopen because new column name is on thd->mem_root + table->mark_table_for_reopen(); + } /* if (part_info) */ +#endif // Force reopen because new column name is on thd->mem_root table->mark_table_for_reopen(); } @@ -8192,6 +8448,9 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, alter_it.remove(); } } + + new_create_list.append(&new_create_tail); + if (unlikely(alter_info->alter_list.elements)) { my_error(ER_BAD_FIELD_ERROR, MYF(0), @@ -8385,9 +8644,10 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, key_part_length= 0; // Use whole field } key_part_length /= kfield->charset()->mbmaxlen; - key_parts.push_back(new (thd->mem_root) Key_part_spec(&cfield->field_name, - key_part_length, true), - thd->mem_root); + Key_part_spec *kps= new (thd->mem_root) Key_part_spec(&cfield->field_name, + key_part_length, true); + kps->asc= !(key_part->key_part_flag & HA_REVERSE_SORT); + key_parts.push_back(kps, thd->mem_root); if (!(cfield->invisible == INVISIBLE_SYSTEM && cfield->vers_sys_field())) user_keyparts= true; } @@ -9372,6 +9632,153 @@ static bool log_and_ok(THD *thd) return(0); } +/* + Wait for master to send result of Alter table. + Returns + true when Rollback is decided + false otherwise +*/ +static bool wait_for_master(THD *thd) +{ +#ifdef HAVE_REPLICATION + start_alter_info* info= thd->rgi_slave->sa_info; + Master_info *mi= thd->rgi_slave->rli->mi; + + DBUG_ASSERT(info); + DBUG_ASSERT(info->state != start_alter_state::INVALID); + DBUG_ASSERT(mi); + + mysql_mutex_lock(&mi->start_alter_lock); + + DBUG_ASSERT(!info->direct_commit_alter || + info->state == start_alter_state::ROLLBACK_ALTER); + + while (info->state == start_alter_state::REGISTERED) + { + mysql_cond_wait(&info->start_alter_cond, &mi->start_alter_lock); + } + if (info->state == start_alter_state::ROLLBACK_ALTER) + { + /* + SA thread will not give error , We will set the error in info->error + and then RA worker will output the error + We can modify the info->error without taking mutex, because CA worker + will be waiting on ::COMPLETED wait condition + */ + if(thd->is_error()) + { + info->error= thd->get_stmt_da()->sql_errno(); + thd->clear_error(); + thd->reset_killed(); + } + } + mysql_mutex_unlock(&mi->start_alter_lock); + + return info->state == start_alter_state::ROLLBACK_ALTER; +#else + return 0; +#endif +} + +#ifdef HAVE_REPLICATION +/** + In this function, we are going to change info->state to ::COMPLETED. + This means we are messaging CA/RA worker that we have binlogged, so our + here is finished. + + @param thd Thread handle + @param start_alter_state ALTER replicaton execution context + @param mi Master_info of the replication source +*/ +static void alter_committed(THD *thd, start_alter_info* info, Master_info *mi) +{ + start_alter_state tmp= info->state; + mysql_mutex_lock(&mi->start_alter_lock); + info->state= start_alter_state::COMPLETED; + mysql_cond_broadcast(&info->start_alter_cond); + mysql_mutex_unlock(&mi->start_alter_lock); + if (tmp == start_alter_state::ROLLBACK_ALTER) + { + thd->clear_error(); + thd->reset_killed(); + } +} +#endif + +/** + process_master_state:- process the info->state recieved from master + We will comapre master state with alter_result + In the case of ROLLBACK_ALTER alter_result > 0 + In the case of COMMIT_ALTER alter_result == 0 + if the condition is not satisfied we will report error and + Return 1. Make sure wait_for_master is called before calling this function + This function should be called only at the write binlog time of commit/ + rollback alter. We will alter_committed if everything is fine. + + @param thd Thread handle. + @param alter_result Result of execution. + @param[in/out] + start_alter_id Start Alter identifier or zero, + it is reset to zero. + @param if_exists True indicates the binary logging of the query + should be done with "if exists" option. + @retval 1 error + @retval 0 Ok +*/ +static int process_master_state(THD *thd, int alter_result, + uint64 &start_alter_id, bool if_exists) +{ +#ifdef HAVE_REPLICATION + start_alter_info *info= thd->rgi_slave->sa_info; + bool partial_alter= false; + + if (info->state == start_alter_state::INVALID) + { + /* the caller has not yet called SA logging nor wait for master decision */ + if (!write_bin_log_start_alter(thd, partial_alter, start_alter_id, + if_exists)) + wait_for_master(thd); + + DBUG_ASSERT(!partial_alter); + } + + /* this function shouldn't be called twice */ + DBUG_ASSERT(start_alter_id); + + start_alter_id= 0; + if ((info->state == start_alter_state::ROLLBACK_ALTER && alter_result >= 0) + || (info->state == start_alter_state::COMMIT_ALTER && !alter_result)) + { + alter_committed(thd, info, thd->rgi_slave->rli->mi); + return 0; + } + else + { + thd->is_slave_error= 1; + return 1; + } +#else + return 0; +#endif +} + +/* + Returns a (global unique) identifier of START Alter when slave applier + executes mysql_alter_table(). + In non-slave context it is zero. +*/ +static uint64 get_start_alter_id(THD *thd) +{ + DBUG_ASSERT(!(thd->rgi_slave && + (thd->rgi_slave->gtid_ev_flags_extra & + Gtid_log_event::FL_START_ALTER_E1)) || + !thd->rgi_slave->direct_commit_alter); + return + thd->rgi_slave && + (thd->rgi_slave->gtid_ev_flags_extra & Gtid_log_event::FL_START_ALTER_E1) ? + thd->variables.gtid_seq_no : 0; +} + /** Alter table @@ -9415,13 +9822,14 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, const LEX_CSTRING *new_name, HA_CREATE_INFO *create_info, TABLE_LIST *table_list, + Recreate_info *recreate_info, Alter_info *alter_info, uint order_num, ORDER *order, bool ignore, bool if_exists) { bool engine_changed, error, frm_is_created= false, error_handler_pushed= false; bool no_ha_table= true; /* We have not created table in storage engine yet */ - TABLE *table, *new_table; + TABLE *table, *new_table= nullptr; DDL_LOG_STATE ddl_log_state; Turn_errors_to_warnings_handler errors_to_warnings; @@ -9429,6 +9837,14 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, bool partition_changed= false; bool fast_alter_partition= false; #endif + bool partial_alter= false; + /* + start_alter_id is the gtid seq no of the START Alter - the 1st part + of two-phase loggable ALTER. The variable is meaningful only + on slave execution. + */ + uint64 start_alter_id= get_start_alter_id(thd); + /* Create .FRM for new version of table with a temporary name. We don't log the statement, it will be logged later. @@ -9447,7 +9863,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, bool varchar= create_info->varchar, table_creation_was_logged= 0; bool binlog_as_create_select= 0, log_if_exists= 0; uint tables_opened; - handlerton *new_db_type, *old_db_type= nullptr; + handlerton *new_db_type= create_info->db_type, *old_db_type; ha_rows copied=0, deleted=0; LEX_CUSTRING frm= {0,0}; LEX_CSTRING backup_name; @@ -9567,6 +9983,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, } table= table_list->table; + bool is_reg_table= table->s->tmp_table == NO_TMP_TABLE; #ifdef WITH_WSREP if (WSREP(thd) && @@ -9603,7 +10020,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, DEBUG_SYNC(thd, "alter_opened_table"); -#ifdef WITH_WSREP +#if defined WITH_WSREP && defined ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sync.alter_opened_table", { const char act[]= @@ -9756,6 +10173,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, if (check_engine(thd, alter_ctx.new_db.str, alter_ctx.new_name.str, create_info)) DBUG_RETURN(true); + create_info->vers_check_native(); if (create_info->vers_info.fix_alter_info(thd, alter_info, create_info, table)) { DBUG_RETURN(true); @@ -9797,22 +10215,24 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, create_info->used_fields |= HA_CREATE_USED_ROW_FORMAT; } + old_db_type= table->s->db_type(); + new_db_type= create_info->db_type; + DBUG_PRINT("info", ("old type: %s new type: %s", - ha_resolve_storage_engine_name(table->s->db_type()), - ha_resolve_storage_engine_name(create_info->db_type))); - if (ha_check_storage_engine_flag(table->s->db_type(), HTON_ALTER_NOT_SUPPORTED)) + ha_resolve_storage_engine_name(old_db_type), + ha_resolve_storage_engine_name(new_db_type))); + if (ha_check_storage_engine_flag(old_db_type, HTON_ALTER_NOT_SUPPORTED)) { DBUG_PRINT("info", ("doesn't support alter")); - my_error(ER_ILLEGAL_HA, MYF(0), hton_name(table->s->db_type())->str, + my_error(ER_ILLEGAL_HA, MYF(0), hton_name(old_db_type)->str, alter_ctx.db.str, alter_ctx.table_name.str); DBUG_RETURN(true); } - if (ha_check_storage_engine_flag(create_info->db_type, - HTON_ALTER_NOT_SUPPORTED)) + if (ha_check_storage_engine_flag(new_db_type, HTON_ALTER_NOT_SUPPORTED)) { DBUG_PRINT("info", ("doesn't support alter")); - my_error(ER_ILLEGAL_HA, MYF(0), hton_name(create_info->db_type)->str, + my_error(ER_ILLEGAL_HA, MYF(0), hton_name(new_db_type)->str, alter_ctx.new_db.str, alter_ctx.new_name.str); DBUG_RETURN(true); } @@ -9968,12 +10388,28 @@ do_continue:; #ifdef WITH_PARTITION_STORAGE_ENGINE { + /* + Partitioning: part_info is prepared and returned via thd->work_part_info + */ if (prep_alter_part_table(thd, table, alter_info, create_info, &partition_changed, &fast_alter_partition)) { DBUG_RETURN(true); } + if (parse_engine_part_options(thd, table)) + DBUG_RETURN(true); } + /* + If the old table had partitions and we are doing ALTER TABLE ... + engine= , the new table must preserve the original + partitioning. This means that the new engine is still the + partitioning engine, not the engine specified in the parser. + This is discovered in prep_alter_part_table, which in such case + updates create_info->db_type. + It's therefore important that the assignment below is done + after prep_alter_part_table. + */ + new_db_type= create_info->db_type; #endif if (mysql_prepare_alter_table(thd, table, create_info, alter_info, @@ -9984,12 +10420,24 @@ do_continue:; set_table_default_charset(thd, create_info, alter_ctx.db); + /* + The ALTER related code cannot alter partitions and change column data types + at the same time. So in case of partition change statements like: + ALTER TABLE t1 DROP PARTITION p1; + we skip implicit data type upgrade (such as "MariaDB 5.3 TIME" to + "MySQL 5.6 TIME" or vice versa according to mysql56_temporal_format). + Note, one can run a separate "ALTER TABLE t1 FORCE;" statement + before or after the partition change ALTER statement to upgrade data types. + */ + if (IF_PARTITIONING(!fast_alter_partition, 1)) + Create_field::upgrade_data_types(alter_info->create_list); + if (create_info->check_fields(thd, alter_info, table_list->table_name, table_list->db) || create_info->fix_period_fields(thd, alter_info)) DBUG_RETURN(true); - if (!opt_explicit_defaults_for_timestamp) + if (!(thd->variables.option_bits & OPTION_EXPLICIT_DEF_TIMESTAMP)) promote_first_timestamp_column(&alter_info->create_list); #ifdef WITH_PARTITION_STORAGE_ENGINE @@ -10052,7 +10500,7 @@ do_continue:; Alter_info::ALTER_TABLE_ALGORITHM_INPLACE) || is_inplace_alter_impossible(table, create_info, alter_info) || IF_PARTITIONING((partition_changed && - !(table->s->db_type()->partition_flags() & HA_USE_AUTO_PARTITION)), 0)) + !(old_db_type->partition_flags() & HA_USE_AUTO_PARTITION)), 0)) { if (alter_info->algorithm(thd) == Alter_info::ALTER_TABLE_ALGORITHM_INPLACE) @@ -10070,24 +10518,10 @@ do_continue:; request table rebuild. Set ALTER_RECREATE flag to force table rebuild. */ - if (create_info->db_type == table->s->db_type() && + if (new_db_type == old_db_type && create_info->used_fields & HA_CREATE_USED_ENGINE) alter_info->flags|= ALTER_RECREATE; - /* - If the old table had partitions and we are doing ALTER TABLE ... - engine= , the new table must preserve the original - partitioning. This means that the new engine is still the - partitioning engine, not the engine specified in the parser. - This is discovered in prep_alter_part_table, which in such case - updates create_info->db_type. - It's therefore important that the assignment below is done - after prep_alter_part_table. - */ - new_db_type= create_info->db_type; - old_db_type= table->s->db_type(); - new_table= NULL; - /* Handling of symlinked tables: If no rename: @@ -10183,8 +10617,10 @@ do_continue:; No ddl logging needed as ddl_log_alter_query will take care of failed table creations. + + Partitioning: part_info is passed via thd->work_part_info */ - error= create_table_impl(thd, (DDL_LOG_STATE*) 0, (DDL_LOG_STATE*) 0, + error= create_table_impl(thd, nullptr, nullptr, alter_ctx.db, alter_ctx.table_name, alter_ctx.new_db, alter_ctx.tmp_name, alter_ctx.get_tmp_cstring_path(), @@ -10347,7 +10783,8 @@ do_continue:; &ha_alter_info, &target_mdl_request, &ddl_log_state, &trigger_param, - &alter_ctx); + &alter_ctx, partial_alter, + start_alter_id, if_exists); thd->count_cuted_fields= org_count_cuted_fields; inplace_alter_table_committed= ha_alter_info.inplace_alter_table_committed; inplace_alter_table_committed_argument= @@ -10402,6 +10839,25 @@ do_continue:; else thd->close_unused_temporary_table_instances(table_list); + if (table->s->tmp_table == NO_TMP_TABLE) + { + if (write_bin_log_start_alter(thd, partial_alter, start_alter_id, + if_exists)) + goto err_new_table_cleanup; + } + else if (start_alter_id) + { + DBUG_ASSERT(thd->rgi_slave); + + my_error(ER_INCONSISTENT_SLAVE_TEMP_TABLE, MYF(0), thd->query(), + table_list->db.str, table_list->table_name.str); + goto err_new_table_cleanup; + } + + DBUG_EXECUTE_IF("start_alter_delay_master", { + debug_sync_set_action(thd, + STRING_WITH_LEN("now wait_for alter_cont NO_CLEAR_EVENT")); + }); // It's now safe to take the table level lock. if (lock_tables(thd, table_list, alter_ctx.tables_opened, MYSQL_LOCK_USE_MALLOC)) @@ -10514,6 +10970,13 @@ do_continue:; } thd->count_cuted_fields= CHECK_FIELD_IGNORE; + if (start_alter_id) + { + DBUG_ASSERT(thd->slave_thread); + + if (wait_for_master(thd)) + goto err_new_table_cleanup; + } if (table->s->tmp_table != NO_TMP_TABLE) { /* Release lock if this is a transactional temporary table */ @@ -10557,6 +11020,9 @@ do_continue:; binlog_commit(thd, true); } + DBUG_ASSERT(!start_alter_id); // no 2 phase logging for + DBUG_ASSERT(!partial_alter); // temporary table alter + /* We don't replicate alter table statement on temporary tables */ if (!thd->is_current_stmt_binlog_format_row() && table_creation_was_logged && @@ -10795,12 +11261,26 @@ do_continue:; DBUG_ASSERT(!(mysql_bin_log.is_open() && thd->is_current_stmt_binlog_format_row() && (create_info->tmp_table()))); - if (!binlog_as_create_select) + + if(start_alter_id) + { + if (!is_reg_table) + { + my_error(ER_INCONSISTENT_SLAVE_TEMP_TABLE, MYF(0), thd->query(), + table_list->db.str, table_list->table_name.str); + DBUG_RETURN(true); + } + + if (process_master_state(thd, 0, start_alter_id, if_exists)) + DBUG_RETURN(true); + } + else if (!binlog_as_create_select) { int tmp_error; thd->binlog_xid= thd->query_id; ddl_log_update_xid(&ddl_log_state, thd->binlog_xid); - tmp_error= write_bin_log_with_if_exists(thd, true, false, log_if_exists); + tmp_error= write_bin_log_with_if_exists(thd, true, false, log_if_exists, + partial_alter); thd->binlog_xid= 0; if (tmp_error) goto err_cleanup; @@ -10853,11 +11333,10 @@ do_continue:; thd->variables.option_bits&= ~OPTION_BIN_COMMIT_OFF; - my_snprintf(alter_ctx.tmp_buff, sizeof(alter_ctx.tmp_buff), - ER_THD(thd, ER_INSERT_INFO), - (ulong) (copied + deleted), (ulong) deleted, - (ulong) thd->get_stmt_da()->current_statement_warn_count()); - my_ok(thd, copied + deleted, 0L, alter_ctx.tmp_buff); + *recreate_info= Recreate_info(copied, deleted); + thd->my_ok_with_recreate_info(*recreate_info, + (ulong) thd->get_stmt_da()-> + current_statement_warn_count()); DEBUG_SYNC(thd, "alter_table_inplace_trans_commit"); DBUG_RETURN(false); @@ -10897,6 +11376,10 @@ do_continue:; /* Signal to storage engine that ddl log is committed */ (*inplace_alter_table_committed)(inplace_alter_table_committed_argument); } + DEBUG_SYNC(thd, "alter_table_after_temp_table_drop"); + if (partial_alter || start_alter_id) + write_bin_log_start_alter_rollback(thd, start_alter_id, partial_alter, + if_exists); DBUG_RETURN(true); err_with_mdl: @@ -11058,6 +11541,8 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, if (!(*ptr)->vcol_info) { bitmap_set_bit(from->read_set, def->field->field_index); + if ((*ptr)->check_assignability_from(def->field, ignore)) + goto err; (copy_end++)->set(*ptr,def->field,0); } } @@ -11366,7 +11851,8 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, Like mysql_alter_table(). */ -bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool table_copy) +bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, + Recreate_info *recreate_info, bool table_copy) { HA_CREATE_INFO create_info; Alter_info alter_info; @@ -11392,8 +11878,11 @@ bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool table_copy) Alter_info::ALTER_TABLE_ALGORITHM_COPY); bool res= mysql_alter_table(thd, &null_clex_str, &null_clex_str, &create_info, - table_list, &alter_info, 0, - (ORDER *) 0, 0, 0); + table_list, recreate_info, &alter_info, 0, + (ORDER *) 0, + // Ignore duplicate records on REPAIR + thd->lex->sql_command == SQLCOM_REPAIR, + 0); table_list->next_global= next_table; DBUG_RETURN(res); } @@ -11750,6 +12239,19 @@ bool Sql_cmd_create_table_like::execute(THD *thd) } #endif +#ifdef WITH_WSREP + if (select_lex->item_list.elements && // With SELECT + WSREP(thd) && thd->variables.wsrep_trx_fragment_size > 0) + { + my_message( + ER_NOT_ALLOWED_COMMAND, + "CREATE TABLE AS SELECT is not supported with streaming replication", + MYF(0)); + res= 1; + goto end_with_restore_list; + } +#endif /* WITH_WSREP */ + if (select_lex->item_list.elements || select_lex->tvc) // With select or TVC { select_result *result; @@ -11901,20 +12403,30 @@ bool Sql_cmd_create_table_like::execute(THD *thd) tables, like mysql replication does. Also check if the requested engine is allowed/supported. */ - if (WSREP(thd) && - !check_engine(thd, create_table->db.str, create_table->table_name.str, - &create_info) && - (!thd->is_current_stmt_binlog_format_row() || - !create_info.tmp_table())) - { + if (WSREP(thd)) + { + handlerton *orig_ht= create_info.db_type; + if (!check_engine(thd, create_table->db.str, + create_table->table_name.str, + &create_info) && + (!thd->is_current_stmt_binlog_format_row() || + !create_info.tmp_table())) + { #ifdef WITH_WSREP - WSREP_TO_ISOLATION_BEGIN_ALTER(create_table->db.str, create_table->table_name.str, - first_table, &alter_info, NULL, &create_info) - { - WSREP_WARN("CREATE TABLE isolation failure"); - DBUG_RETURN(true); - } + WSREP_TO_ISOLATION_BEGIN_ALTER(create_table->db.str, + create_table->table_name.str, + first_table, &alter_info, NULL, + &create_info) + { + WSREP_WARN("CREATE TABLE isolation failure"); + DBUG_RETURN(true); + } #endif /* WITH_WSREP */ + } + // check_engine will set db_type to NULL if e.g. TEMPORARY is + // not supported by the storage engine, this case is checked + // again in mysql_create_table + create_info.db_type= orig_ht; } /* Regular CREATE TABLE */ res= mysql_create_table(thd, create_table, &create_info, &alter_info); diff --git a/sql/sql_table.h b/sql/sql_table.h index eaa03bfaf8c19..0f9a73c848a81 100644 --- a/sql/sql_table.h +++ b/sql/sql_table.h @@ -165,6 +165,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, const LEX_CSTRING *new_name, HA_CREATE_INFO *create_info, TABLE_LIST *table_list, + class Recreate_info *recreate_info, Alter_info *alter_info, uint order_num, ORDER *order, bool ignore, bool if_exists); @@ -172,7 +173,8 @@ bool mysql_compare_tables(TABLE *table, Alter_info *alter_info, HA_CREATE_INFO *create_info, bool *metadata_equal); -bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool table_copy); +bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, + class Recreate_info *recreate_info, bool table_copy); bool mysql_create_like_table(THD *thd, TABLE_LIST *table, TABLE_LIST *src_table, Table_specification_st *create_info); @@ -211,7 +213,8 @@ int write_bin_log(THD *thd, bool clear_error, char const *query, ulong query_length, bool is_trans= FALSE); int write_bin_log_with_if_exists(THD *thd, bool clear_error, - bool is_trans, bool add_if_exists); + bool is_trans, bool add_if_exists, + bool commit_alter= false); void promote_first_timestamp_column(List *column_definitions); diff --git a/sql/sql_test.cc b/sql/sql_test.cc index 0d1a831356425..479d4289406ae 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -628,6 +628,10 @@ Next alarm time: %lu\n", #elif defined(HAVE_MALLINFO) struct mallinfo info= mallinfo(); #endif +#if __has_feature(memory_sanitizer) + /* Work around missing MSAN instrumentation */ + MEM_MAKE_DEFINED(&info, sizeof info); +#endif #if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2) char llbuff[10][22]; printf("\nMemory status:\n\ diff --git a/sql/sql_time.cc b/sql/sql_time.cc index 8bb96dfa776d4..12e4460ed2524 100644 --- a/sql/sql_time.cc +++ b/sql/sql_time.cc @@ -68,62 +68,71 @@ int append_interval(String *str, interval_type int_type, const INTERVAL &interva size_t len; switch (int_type) { case INTERVAL_YEAR: - len= my_snprintf(buf,sizeof(buf),"%u", interval.year); + len= my_snprintf(buf,sizeof(buf),"%lu", interval.year); break; case INTERVAL_QUARTER: case INTERVAL_MONTH: - len= my_snprintf(buf,sizeof(buf),"%u", interval.month); + len= my_snprintf(buf,sizeof(buf),"%lu", interval.month); int_type=INTERVAL_MONTH; break; case INTERVAL_WEEK: case INTERVAL_DAY: - len= my_snprintf(buf,sizeof(buf),"%u", interval.day); + len= my_snprintf(buf,sizeof(buf),"%lu", interval.day); int_type=INTERVAL_DAY; break; case INTERVAL_HOUR: - len= my_snprintf(buf,sizeof(buf),"%u", interval.hour); + len= my_snprintf(buf,sizeof(buf),"%lu", interval.hour); break; case INTERVAL_MINUTE: - len= my_snprintf(buf,sizeof(buf),"%u", interval.minute); + len= my_snprintf(buf,sizeof(buf),"%llu", interval.minute); break; case INTERVAL_SECOND: - len= my_snprintf(buf,sizeof(buf),"%u", interval.second); + len= my_snprintf(buf,sizeof(buf),"%llu", interval.second); break; case INTERVAL_MICROSECOND: - len= my_snprintf(buf,sizeof(buf),"%u", interval.second_part); + len= my_snprintf(buf,sizeof(buf),"%llu", interval.second_part); break; case INTERVAL_YEAR_MONTH: - len= my_snprintf(buf,sizeof(buf),"%u-%02u", interval.day, interval.month); + len= my_snprintf(buf,sizeof(buf),"'%lu-%02lu'", + interval.year, interval.month); break; case INTERVAL_DAY_HOUR: - len= my_snprintf(buf,sizeof(buf),"%u %u", interval.day, interval.hour); + len= my_snprintf(buf,sizeof(buf),"'%lu %lu'", interval.day, interval.hour); break; case INTERVAL_DAY_MINUTE: - len= my_snprintf(buf,sizeof(buf),"%u %u:%02u", interval.day, interval.hour, interval.minute); + len= my_snprintf(buf,sizeof(buf),"'%lu %lu:%02llu'", + interval.day, interval.hour, interval.minute); break; case INTERVAL_DAY_SECOND: - len= my_snprintf(buf,sizeof(buf),"%u %u:%02u:%02u", interval.day, interval.hour, interval.minute, interval.second); + len= my_snprintf(buf,sizeof(buf),"'%lu %lu:%02llu:%02llu'", + interval.day, interval.hour, interval.minute, interval.second); break; case INTERVAL_HOUR_MINUTE: - len= my_snprintf(buf,sizeof(buf),"%u:%02u", interval.hour, interval.minute); + len= my_snprintf(buf,sizeof(buf),"'%lu:%02llu'", interval.hour, interval.minute); break; case INTERVAL_HOUR_SECOND: - len= my_snprintf(buf,sizeof(buf),"%u:%02u:%02u", interval.hour, interval.minute, interval.second); + len= my_snprintf(buf,sizeof(buf),"'%lu:%02llu:%02llu'", + interval.hour, interval.minute, interval.second); break; case INTERVAL_MINUTE_SECOND: - len= my_snprintf(buf,sizeof(buf),"%u:%02u", interval.minute, interval.second); + len= my_snprintf(buf,sizeof(buf),"'%llu:%02llu'", interval.minute, interval.second); break; case INTERVAL_DAY_MICROSECOND: - len= my_snprintf(buf,sizeof(buf),"%u %u:%02u:%02u.%06u", interval.day, interval.hour, interval.minute, interval.second, interval.second_part); + len= my_snprintf(buf,sizeof(buf),"'%lu %lu:%02llu:%02llu.%06llu'", + interval.day, interval.hour, interval.minute, + interval.second, interval.second_part); break; case INTERVAL_HOUR_MICROSECOND: - len= my_snprintf(buf,sizeof(buf),"%u:%02u:%02u.%06u", interval.hour, interval.minute, interval.second, interval.second_part); + len= my_snprintf(buf,sizeof(buf),"'%lu:%02llu:%02llu.%06llu'", + interval.hour, interval.minute, interval.second, + interval.second_part); break; case INTERVAL_MINUTE_MICROSECOND: - len= my_snprintf(buf,sizeof(buf),"%u:%02u.%06u", interval.minute, interval.second, interval.second_part); + len= my_snprintf(buf,sizeof(buf),"'%llu:%02llu.%06llu'", + interval.minute, interval.second, interval.second_part); break; case INTERVAL_SECOND_MICROSECOND: - len= my_snprintf(buf,sizeof(buf),"%u.%06u", interval.second, interval.second_part); + len= my_snprintf(buf,sizeof(buf),"%llu.%06llu", interval.second, interval.second_part); break; default: DBUG_ASSERT(0); diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 7b3db324db7ec..d29ef53238262 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2004, 2012, Oracle and/or its affiliates. - Copyright (c) 2010, 2021, MariaDB + Copyright (c) 2010, 2022, 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 @@ -37,6 +37,9 @@ #include "debug_sync.h" // DEBUG_SYNC #include "debug.h" // debug_crash_here #include "mysql/psi/mysql_sp.h" +#include "wsrep_mysqld.h" +#include +#include /*************************************************************************/ @@ -221,7 +224,7 @@ static File_option triggers_file_parameters[]= }, { { STRING_WITH_LEN("created") }, - my_offsetof(class Table_triggers_list, create_times), + my_offsetof(class Table_triggers_list, hr_create_times), FILE_OPTIONS_ULLLIST }, { { 0, 0 }, 0, FILE_OPTIONS_STRING } @@ -313,7 +316,7 @@ class Deprecated_trigger_syntax_handler : public Internal_error_handler private: char m_message[MYSQL_ERRMSG_SIZE]; - LEX_CSTRING *m_trigger_name; + const LEX_CSTRING *m_trigger_name; public: @@ -329,8 +332,23 @@ class Deprecated_trigger_syntax_handler : public Internal_error_handler if (sql_errno != EE_OUTOFMEMORY && sql_errno != ER_OUT_OF_RESOURCES) { + // Check if the current LEX contains a non-empty spname if(thd->lex->spname) m_trigger_name= &thd->lex->spname->m_name; + else if (thd->lex->sphead) + { + /* + Some SP statements, for example IF, create their own local LEX. + All LEX instances are available in the LEX stack in sphead::m_lex. + Let's find the one that contains a non-zero spname. + Note, although a parse error has happened, the LEX instances + in sphead::m_lex are not freed yet at this point. The first + found non-zero spname contains the valid trigger name. + */ + const sp_name *spname= thd->lex->sphead->find_spname_recursive(); + if (spname) + m_trigger_name= &spname->m_name; + } if (m_trigger_name) my_snprintf(m_message, sizeof(m_message), ER_THD(thd, ER_ERROR_IN_TRIGGER_BODY), @@ -343,7 +361,7 @@ class Deprecated_trigger_syntax_handler : public Internal_error_handler return false; } - LEX_CSTRING *get_trigger_name() { return m_trigger_name; } + const LEX_CSTRING *get_trigger_name() { return m_trigger_name; } char *get_error_message() { return m_message; } }; @@ -424,6 +442,8 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) Query_tables_list backup; DDL_LOG_STATE ddl_log_state, ddl_log_state_tmp_file; char trn_path_buff[FN_REFLEN]; + char path[FN_REFLEN + 1]; + DBUG_ENTER("mysql_create_or_drop_trigger"); /* Charset of the buffer for statement must be system one. */ @@ -553,8 +573,12 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) /* We should have only one table in table list. */ DBUG_ASSERT(tables->next_global == 0); - /* We do not allow creation of triggers on temporary tables. */ - if (create && thd->find_tmp_table_share(tables)) + build_table_filename(path, sizeof(path) - 1, tables->db.str, tables->alias.str, ".frm", 0); + tables->required_type= dd_frm_type(NULL, path, NULL, NULL, NULL); + + /* We do not allow creation of triggers on temporary tables or sequence. */ + if (tables->required_type == TABLE_TYPE_SEQUENCE || + (create && thd->find_tmp_table_share(tables))) { my_error(ER_TRG_ON_VIEW_OR_TEMP_TABLE, MYF(0), tables->alias.str); goto end; @@ -622,7 +646,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) goto end; } -#ifdef WITH_WSREP +#if defined WITH_WSREP && defined ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sync.mdev_20225", { const char act[]= @@ -631,7 +655,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act))); };); -#endif /* WITH_WSREP */ +#endif /* WITH_WSREP && ENABLED_DEBUG_SYNC */ if (create) result= table->triggers->create_trigger(thd, tables, &stmt_query, @@ -1035,6 +1059,10 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, if (!(trigger= new (&table->mem_root) Trigger(this, 0))) goto err; + /* Time with in microseconds */ + trigger->hr_create_time= make_hr_time(thd->query_start(), + thd->query_start_sec_part()); + /* Create trigger_name.TRN file to ensure trigger name is unique */ if (sql_create_definition_file(NULL, &trigname_file, &trigname_file_type, (uchar*)&trigname, trigname_file_parameters)) @@ -1047,8 +1075,6 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, /* Populate the trigger object */ trigger->sql_mode= thd->variables.sql_mode; - /* Time with 2 decimals, like in MySQL 5.7 */ - trigger->create_time= ((ulonglong) thd->query_start())*100 + thd->query_start_sec_part()/10000; build_trig_stmt_query(thd, tables, stmt_query, &trigger_definition, &trigger->definer, trg_definer_holder); @@ -1116,7 +1142,7 @@ void Table_triggers_list::empty_lists() client_cs_names.empty(); connection_cl_names.empty(); db_cl_names.empty(); - create_times.empty(); + hr_create_times.empty(); } @@ -1152,7 +1178,7 @@ bool Trigger::add_to_file_list(void* param_arg) base->client_cs_names.push_back(&client_cs_name, mem_root) || base->connection_cl_names.push_back(&connection_cl_name, mem_root) || base->db_cl_names.push_back(&db_cl_name, mem_root) || - base->create_times.push_back(&create_time, mem_root)) + base->hr_create_times.push_back(&hr_create_time.val, mem_root)) return 1; return 0; } @@ -1562,7 +1588,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const LEX_CSTRING *db, List_iterator_fast it_client_cs_name(trigger_list->client_cs_names); List_iterator_fast it_connection_cl_name(trigger_list->connection_cl_names); List_iterator_fast it_db_cl_name(trigger_list->db_cl_names); - List_iterator_fast it_create_times(trigger_list->create_times); + List_iterator_fast + it_create_times(trigger_list->hr_create_times); LEX *old_lex= thd->lex; LEX lex; sp_rcontext *save_spcont= thd->spcont; @@ -1648,7 +1675,13 @@ bool Table_triggers_list::check_n_load(THD *thd, const LEX_CSTRING *db, trigger->sql_mode= sql_mode; trigger->definition= *trg_create_str; - trigger->create_time= trg_create_time ? *trg_create_time : 0; + trigger->hr_create_time.val= trg_create_time ? *trg_create_time : 0; + /* + Fix time if in 100th of second (comparison with max uint * 100 + (max possible timestamp in the old format)) + */ + if (trigger->hr_create_time.val < 429496729400ULL) + trigger->hr_create_time.val*= 10000; trigger->name= sp ? sp->m_name : empty_clex_str; trigger->on_table_name.str= (char*) lex.raw_trg_on_table_name_begin; trigger->on_table_name.length= (lex.raw_trg_on_table_name_end - @@ -1669,7 +1702,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const LEX_CSTRING *db, if (unlikely(parse_error)) { - LEX_CSTRING *name; + const LEX_CSTRING *name; /* In case of errors, disable all triggers for the table, but keep diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h index 739669c86a575..774dca7cba142 100644 --- a/sql/sql_trigger.h +++ b/sql/sql_trigger.h @@ -140,7 +140,7 @@ class Trigger :public Sql_alloc GRANT_INFO subject_table_grants; sql_mode_t sql_mode; /* Store create time. Can't be mysql_time_t as this holds also sub seconds */ - ulonglong create_time; + my_hrtime_t hr_create_time; // Create time timestamp in microseconds trg_event_type event; trg_action_time_type action_time; uint action_order; @@ -223,7 +223,7 @@ class Table_triggers_list: public Sql_alloc */ List definition_modes_list; /** Create times for triggers */ - List create_times; + List hr_create_times; List definers_list; diff --git a/sql/sql_truncate.h b/sql/sql_truncate.h index 7d2ff4b605061..5704da1dd7bb0 100644 --- a/sql/sql_truncate.h +++ b/sql/sql_truncate.h @@ -31,11 +31,9 @@ class Sql_cmd_truncate_table : public Sql_cmd /** Constructor, used to represent a TRUNCATE statement. */ - Sql_cmd_truncate_table() - {} + Sql_cmd_truncate_table() = default; - virtual ~Sql_cmd_truncate_table() - {} + virtual ~Sql_cmd_truncate_table() = default; /** Execute a TRUNCATE statement at runtime. diff --git a/sql/sql_tvc.cc b/sql/sql_tvc.cc index bdaf6829fbd2c..d4fd473887340 100644 --- a/sql/sql_tvc.cc +++ b/sql/sql_tvc.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2017, 2020, MariaDB +/* Copyright (c) 2017, 2022, 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 @@ -422,7 +422,9 @@ bool table_value_constr::exec(SELECT_LEX *sl) DBUG_ENTER("table_value_constr::exec"); List_iterator_fast li(lists_of_values); List_item *elem; + THD *cur_thd= sl->parent_lex->thd; ha_rows send_records= 0; + int rc=0; if (select_options & SELECT_DESCRIBE) DBUG_RETURN(false); @@ -438,10 +440,10 @@ bool table_value_constr::exec(SELECT_LEX *sl) while ((elem= li++)) { + cur_thd->get_stmt_da()->inc_current_row_for_warning(); if (send_records >= sl->master_unit()->lim.get_select_limit()) break; - int rc= - result->send_data_with_check(*elem, sl->master_unit(), send_records); + rc= result->send_data_with_check(*elem, sl->master_unit(), send_records); if (!rc) send_records++; else if (rc > 0) @@ -571,7 +573,7 @@ bool Item_func_in::create_value_list_for_tvc(THD *thd, if (is_list_of_rows) { - Item_row *row_list= (Item_row *)(args[i]->build_clone(thd)); + Item_row *row_list= (Item_row *)(args[i]); if (!row_list) return true; @@ -596,8 +598,7 @@ bool Item_func_in::create_value_list_for_tvc(THD *thd, sprintf(col_name, "_col_%i", 1); args[i]->set_name(thd, col_name, strlen(col_name), thd->charset()); } - Item *arg_clone= args[i]->build_clone(thd); - if (!arg_clone || tvc_value->push_back(arg_clone)) + if (tvc_value->push_back(args[i])) return true; } @@ -706,6 +707,7 @@ st_select_lex *wrap_tvc(THD *thd, st_select_lex *tvc_sl, wrapper_sl->parent_lex= lex; /* Used in init_query. */ wrapper_sl->init_query(); wrapper_sl->init_select(); + wrapper_sl->is_tvc_wrapper= true; wrapper_sl->nest_level= tvc_sl->nest_level; wrapper_sl->parsing_place= tvc_sl->parsing_place; @@ -741,7 +743,7 @@ st_select_lex *wrap_tvc(THD *thd, st_select_lex *tvc_sl, Attach the select used of TVC as the only slave to the unit for the derived table tvc_x of the transformation */ - derived_unit->add_slave(tvc_sl); + derived_unit->attach_single(tvc_sl); tvc_sl->set_linkage(DERIVED_TABLE_TYPE); /* @@ -929,13 +931,11 @@ Item *Item_func_in::in_predicate_to_in_subs_transformer(THD *thd, { if (!transform_into_subq) return this; - + Json_writer_object trace_wrapper(thd); Json_writer_object trace_conv(thd, "in_to_subquery_conversion"); trace_conv.add("item", this); - transform_into_subq= false; - List values; LEX *lex= thd->lex; @@ -1109,15 +1109,38 @@ uint32 Item_func_in::max_length_of_left_expr() bool Item_func_in::to_be_transformed_into_in_subq(THD *thd) { + bool is_row_list= args[1]->type() == Item::ROW_ITEM; uint values_count= arg_count-1; - if (args[1]->type() == Item::ROW_ITEM) + if (is_row_list) values_count*= ((Item_row *)(args[1]))->cols(); if (thd->variables.in_subquery_conversion_threshold == 0 || thd->variables.in_subquery_conversion_threshold > values_count) return false; + if (!(thd->lex->context_analysis_only & CONTEXT_ANALYSIS_ONLY_PREPARE)) + return true; + + /* Occurence of '?' in IN list is checked only for PREPARE commands */ + for (uint i=1; i < arg_count; i++) + { + if (!is_row_list) + { + if (args[i]->type() == Item::PARAM_ITEM) + return false; + } + else + { + Item_row *row_list= (Item_row *)(args[i]); + for (uint j=0; j < row_list->cols(); j++) + { + if (row_list->element_index(j)->type() == Item::PARAM_ITEM) + return false; + } + } + } + return true; } @@ -1150,12 +1173,10 @@ bool JOIN::transform_in_predicates_into_in_subq(THD *thd) { select_lex->parsing_place= IN_WHERE; conds= - conds->transform(thd, - &Item::in_predicate_to_in_subs_transformer, - (uchar*) 0); + conds->top_level_transform(thd, + &Item::in_predicate_to_in_subs_transformer, 0); if (!conds) DBUG_RETURN(true); - select_lex->prep_where= conds ? conds->copy_andor_structure(thd) : 0; select_lex->where= conds; } @@ -1170,13 +1191,10 @@ bool JOIN::transform_in_predicates_into_in_subq(THD *thd) if (table->on_expr) { table->on_expr= - table->on_expr->transform(thd, - &Item::in_predicate_to_in_subs_transformer, - (uchar*) 0); + table->on_expr->top_level_transform(thd, + &Item::in_predicate_to_in_subs_transformer, 0); if (!table->on_expr) DBUG_RETURN(true); - table->prep_on_expr= table->on_expr ? - table->on_expr->copy_andor_structure(thd) : 0; } } } @@ -1186,4 +1204,3 @@ bool JOIN::transform_in_predicates_into_in_subq(THD *thd) thd->lex->current_select= save_current_select; DBUG_RETURN(false); } - diff --git a/sql/sql_type.cc b/sql/sql_type.cc index 0764265f9782a..f3c0a8404db21 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2015, 2020, MariaDB + Copyright (c) 2015, 2022, 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 @@ -1746,7 +1746,7 @@ Type_handler_time_common::type_handler_for_native_format() const const Type_handler *Type_handler_typelib::type_handler_for_item_field() const { - return &type_handler_string; + return &type_handler_varchar; } @@ -1761,16 +1761,21 @@ const Type_handler *Type_handler_typelib::cast_to_int_type_handler() const bool Type_handler_hybrid_field_type::aggregate_for_result(const Type_handler *other) { - const Type_handler *hres; - const Type_collection *c; - if (!(c= Type_handler::type_collection_for_aggregation(m_type_handler, other)) || - !(hres= c->aggregate_for_result(m_type_handler, other))) - hres= type_handler_data-> - m_type_aggregator_for_result.find_handler(m_type_handler, other); - if (!hres) - return true; - m_type_handler= hres; - return false; + Type_handler_pair tp(m_type_handler, other); + do + { + const Type_handler *hres; + const Type_collection *c; + if (((c= Type_handler::type_collection_for_aggregation(tp.a(), tp.b())) && + (hres= c->aggregate_for_result(tp.a(), tp.b()))) || + (hres= type_handler_data-> + m_type_aggregator_for_result.find_handler(tp.a(), tp.b()))) + { + m_type_handler= hres; + return false; + } + } while (tp.to_base()); + return true; } @@ -1954,6 +1959,9 @@ Type_collection_std::aggregate_for_comparison(const Type_handler *ha, return ha; } } + if ((a == INT_RESULT && b == STRING_RESULT) || + (b == INT_RESULT && a == STRING_RESULT)) + return &type_handler_newdecimal; if ((a == INT_RESULT || a == DECIMAL_RESULT) && (b == INT_RESULT || b == DECIMAL_RESULT)) return &type_handler_newdecimal; @@ -1973,26 +1981,29 @@ Type_collection_std::aggregate_for_comparison(const Type_handler *ha, bool Type_handler_hybrid_field_type::aggregate_for_min_max(const Type_handler *h) { - const Type_handler *hres; - const Type_collection *c; - if (!(c= Type_handler::type_collection_for_aggregation(m_type_handler, h))|| - !(hres= c->aggregate_for_min_max(m_type_handler, h))) + Type_handler_pair tp(m_type_handler, h); + do { - /* - For now we suppose that these two expressions: - - LEAST(type1, type2) - - COALESCE(type1, type2) - return the same data type (or both expressions return error) - if type1 and/or type2 are non-traditional. - This may change in the future. - */ - hres= type_handler_data-> - m_type_aggregator_for_result.find_handler(m_type_handler, h); - } - if (!hres) - return true; - m_type_handler= hres; - return false; + const Type_handler *hres; + const Type_collection *c; + if (((c= Type_handler::type_collection_for_aggregation(tp.a(), tp.b())) && + (hres= c->aggregate_for_min_max(tp.a(), tp.b()))) || + (hres= type_handler_data-> + m_type_aggregator_for_result.find_handler(tp.a(), tp.b()))) + { + /* + For now we suppose that these two expressions: + - LEAST(type1, type2) + - COALESCE(type1, type2) + return the same data type (or both expressions return error) + if type1 and/or type2 are non-traditional. + This may change in the future. + */ + m_type_handler= hres; + return false; + } + } while (tp.to_base()); + return true; } @@ -2131,15 +2142,20 @@ Type_handler_hybrid_field_type::aggregate_for_num_op(const Type_aggregator *agg, const Type_handler *h0, const Type_handler *h1) { - const Type_handler *hres; - const Type_collection *c; - if (!(c= Type_handler::type_collection_for_aggregation(h0, h1)) || - !(hres= c->aggregate_for_num_op(h0, h1))) - hres= agg->find_handler(h0, h1); - if (!hres) - return true; - m_type_handler= hres; - return false; + Type_handler_pair tp(h0, h1); + do + { + const Type_handler *hres; + const Type_collection *c; + if (((c= Type_handler::type_collection_for_aggregation(tp.a(), tp.b())) && + (hres= c->aggregate_for_num_op(tp.a(), tp.b()))) || + (hres= agg->find_handler(tp.a(), tp.b()))) + { + m_type_handler= hres; + return false; + } + } while (tp.to_base()); + return true; } @@ -2282,7 +2298,6 @@ Type_handler_decimal_result::make_num_distinct_aggregator_field( const Item *item) const { - DBUG_ASSERT(item->decimals <= DECIMAL_MAX_SCALE); return new (mem_root) Field_new_decimal(NULL, item->max_length, (uchar *) (item->maybe_null() ? "" : 0), @@ -4249,19 +4264,6 @@ void Type_handler_temporal_with_date::Item_update_null_value(Item *item) const (void) item->get_date(thd, <ime, Datetime::Options(thd)); } -bool -Type_handler_timestamp_common:: -Column_definition_set_attributes(THD *thd, - Column_definition *def, - const Lex_field_type_st &attr, - CHARSET_INFO *cs, - column_definition_type_t type) const -{ - Type_handler::Column_definition_set_attributes(thd, def, attr, cs, type); - if (!opt_explicit_defaults_for_timestamp) - def->flags|= NOT_NULL_FLAG; - return false; -} void Type_handler_string_result::Item_update_null_value(Item *item) const { @@ -9048,13 +9050,13 @@ Type_handler_timestamp_common::Item_val_native_with_conversion(THD *thd, Item *item, Native *to) const { - MYSQL_TIME ltime; if (item->type_handler()->type_handler_for_native_format() == &type_handler_timestamp2) return item->val_native(thd, to); + Datetime dt(thd, item, Datetime::Options(TIME_NO_ZERO_IN_DATE, thd)); return - item->get_date(thd, <ime, Datetime::Options(TIME_NO_ZERO_IN_DATE, thd)) || - TIME_to_native(thd, <ime, to, item->datetime_precision(thd)); + !dt.is_valid_datetime() || + TIME_to_native(thd, dt.get_mysql_time(), to, item->datetime_precision(thd)); } bool Type_handler_null::union_element_finalize(Item_type_holder *item) const diff --git a/sql/sql_type.h b/sql/sql_type.h index 44225b4160921..b082449639b97 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -2,7 +2,7 @@ #define SQL_TYPE_H_INCLUDED /* Copyright (c) 2015 MariaDB Foundation. - Copyright (c) 2015, 2020, MariaDB Corporation. + Copyright (c) 2015, 2022, 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,6 +45,7 @@ class Item_param; class Item_cache; class Item_copy; class Item_func_or_sum; +class Item_sum; class Item_sum_hybrid; class Item_sum_sum; class Item_sum_avg; @@ -123,6 +124,32 @@ enum scalar_comparison_op }; +class Hasher +{ + ulong m_nr1; + ulong m_nr2; +public: + Hasher(): m_nr1(1), m_nr2(4) + { } + void add_null() + { + m_nr1^= (m_nr1 << 1) | 1; + } + void add(CHARSET_INFO *cs, const uchar *str, size_t length) + { + cs->coll->hash_sort(cs, str, length, &m_nr1, &m_nr2); + } + void add(CHARSET_INFO *cs, const char *str, size_t length) + { + add(cs, (const uchar *) str, length); + } + uint32 finalize() const + { + return (uint32) m_nr1; + } +}; + + enum partition_value_print_mode_t { PARTITION_VALUE_PRINT_MODE_SHOW= 0, @@ -366,7 +393,7 @@ class Dec_ptr { protected: my_decimal *m_ptr; - Dec_ptr() { } + Dec_ptr() = default; public: Dec_ptr(my_decimal *ptr) :m_ptr(ptr) { } bool is_null() const { return m_ptr == NULL; } @@ -514,7 +541,7 @@ class Sec6 { m_sec= m_usec= m_neg= m_truncated= 0; } - Sec6() { } + Sec6() = default; bool add_nanoseconds(uint nanoseconds) { DBUG_ASSERT(nanoseconds <= 1000000000); @@ -674,7 +701,7 @@ class Sec9: public Sec6 Sec6::make_from_int(nr); m_nsec= 0; } - Sec9() { } + Sec9() = default; public: Sec9(const my_decimal *d) { @@ -2827,7 +2854,7 @@ class Timestamp_or_zero_datetime_native: public NativeBuffer { public: - Timestamp_or_zero_datetime_native() { } + Timestamp_or_zero_datetime_native() = default; Timestamp_or_zero_datetime_native(const Timestamp_or_zero_datetime &ts, uint decimals) { @@ -3304,13 +3331,9 @@ class Type_std_attributes: public Type_numeric_attributes class Type_all_attributes: public Type_std_attributes { public: - Type_all_attributes() - :Type_std_attributes() - { } - Type_all_attributes(const Type_all_attributes &other) - :Type_std_attributes(other) - { } - virtual ~Type_all_attributes() {} + Type_all_attributes() = default; + Type_all_attributes(const Type_all_attributes &) = default; + virtual ~Type_all_attributes() = default; virtual void set_type_maybe_null(bool maybe_null_arg)= 0; // Returns total number of decimal digits virtual decimal_digits_t decimal_precision() const= 0; @@ -3322,7 +3345,7 @@ class Type_all_attributes: public Type_std_attributes class Type_cmp_attributes { public: - virtual ~Type_cmp_attributes() { } + virtual ~Type_cmp_attributes() = default; virtual CHARSET_INFO *compare_collation() const= 0; }; @@ -3533,9 +3556,9 @@ enum vers_kind_t class Vers_type_handler { protected: - Vers_type_handler() {} + Vers_type_handler() = default; public: - virtual ~Vers_type_handler() {} + virtual ~Vers_type_handler() = default; virtual vers_kind_t kind() const { DBUG_ASSERT(0); @@ -3767,6 +3790,19 @@ class Type_handler incompatible data type. */ virtual bool is_param_long_data_type() const { return false; } + /* + The base type handler "this" is derived from. + "This" inherits aggregation rules from the base type handler. + */ + virtual const Type_handler *type_handler_base() const + { + return NULL; + } + const Type_handler *type_handler_base_or_self() const + { + const Type_handler *res= type_handler_base(); + return res ? res : this; + } virtual const Type_handler *type_handler_for_comparison() const= 0; virtual const Type_handler *type_handler_for_native_format() const { @@ -3796,8 +3832,8 @@ class Type_handler { return this; } - virtual bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const + virtual bool partition_field_check(const LEX_CSTRING &field_name, Item *) + const { partition_field_type_not_allowed(field_name); return true; @@ -3819,7 +3855,7 @@ class Type_handler return false; } Type_handler() : m_name(0,0) {} - virtual ~Type_handler() {} + virtual ~Type_handler() = default; /** Determines MariaDB traditional scalar data types that always present in the server. @@ -4033,14 +4069,14 @@ class Type_handler */ virtual void make_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const= 0; + String *tmp) const= 0; /* create a compact size key part for a sort key */ virtual uint make_packed_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const=0; + String *tmp) const=0; virtual void sort_length(THD *thd, const Type_std_attributes *item, @@ -4166,8 +4202,8 @@ class Type_handler CHARSET_INFO *cs, bool send_error) const { - DBUG_ASSERT(0); - return NULL; + MY_ASSERT_UNREACHABLE(); + return nullptr; } Item_literal *create_literal_item(THD *thd, const String *str, bool send_error) const @@ -4178,12 +4214,13 @@ class Type_handler virtual Item *create_typecast_item(THD *thd, Item *item, const Type_cast_attributes &attr) const { - return NULL; + MY_ASSERT_UNREACHABLE(); + return nullptr; } virtual Item_copy *create_item_copy(THD *thd, Item *item) const; virtual int cmp_native(const Native &a, const Native &b) const { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return 0; } virtual bool set_comparator_func(THD *thd, Arg_comparator *cmp) const= 0; @@ -4335,13 +4372,12 @@ class Type_handler class Type_handler_row: public Type_handler { public: - virtual ~Type_handler_row() {} + virtual ~Type_handler_row() = default; const Name &default_value() const override; - bool validate_implicit_default_value(THD *thd, - const Column_definition &def) const - override + bool validate_implicit_default_value(THD *, const Column_definition &) + const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } const Type_collection *type_collection() const override; @@ -4355,12 +4391,12 @@ class Type_handler_row: public Type_handler bool can_return_time() const override { return false; } enum_field_types field_type() const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return MYSQL_TYPE_NULL; }; protocol_send_type_t protocol_send_type() const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return PROTOCOL_SEND_STRING; } Item_result result_type() const override @@ -4371,47 +4407,44 @@ class Type_handler_row: public Type_handler { return ROW_RESULT; } - enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) + enum_dynamic_column_type dyncol_type(const Type_all_attributes *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return DYN_COL_NULL; } const Type_handler *type_handler_for_comparison() const override; - int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const override + int stored_field_cmp_to_item(THD *, Field *, Item *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return 0; } - bool subquery_type_allows_materialization(const Item *, const Item *, - bool) const override + bool subquery_type_allows_materialization(const Item *, const Item *, bool) + const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return false; } - Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) const override + Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) const + override { - DBUG_ASSERT(0); - return NULL; + MY_ASSERT_UNREACHABLE(); + return nullptr; } - Field *make_conversion_table_field(MEM_ROOT *root, - TABLE *table, - uint metadata, - const Field *target) const override + Field *make_conversion_table_field(MEM_ROOT *, TABLE *, uint, const Field *) + const override { - DBUG_ASSERT(0); - return NULL; + MY_ASSERT_UNREACHABLE(); + return nullptr; } - bool Column_definition_fix_attributes(Column_definition *c) const override + bool Column_definition_fix_attributes(Column_definition *) const override { return false; } - void Column_definition_reuse_fix_attributes(THD *thd, - Column_definition *c, - const Field *field) - const override + void Column_definition_reuse_fix_attributes(THD *, Column_definition *, + const Field *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); } bool Column_definition_prepare_stage1(THD *thd, MEM_ROOT *mem_root, @@ -4421,28 +4454,25 @@ class Type_handler_row: public Type_handler const Column_derived_attributes *derived_attr) const override; - bool Column_definition_redefine_stage1(Column_definition *def, - const Column_definition *dup, - const handler *file) + bool Column_definition_redefine_stage1(Column_definition *, + const Column_definition *, + const handler *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } - bool Column_definition_prepare_stage2(Column_definition *c, - handler *file, - ulonglong table_flags) const override + bool Column_definition_prepare_stage2(Column_definition *, handler *, + ulonglong) const override { return false; } - Field *make_table_field(MEM_ROOT *root, - const LEX_CSTRING *name, - const Record_addr &addr, - const Type_all_attributes &attr, - TABLE_SHARE *share) const override + Field *make_table_field(MEM_ROOT *, const LEX_CSTRING *, const Record_addr &, + const Type_all_attributes &, TABLE_SHARE *) + const override { - DBUG_ASSERT(0); - return NULL; + MY_ASSERT_UNREACHABLE(); + return nullptr; } Field *make_table_field_from_def(TABLE_SHARE *share, MEM_ROOT *mem_root, @@ -4453,78 +4483,75 @@ class Type_handler_row: public Type_handler uint32 flags) const override; void make_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override + String *tmp) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); } - uint make_packed_sort_key_part(uchar *to, Item *item, - const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override + uint make_packed_sort_key_part(uchar *, Item *, const SORT_FIELD_ATTR *, + String *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return 0; } - void sort_length(THD *thd, const Type_std_attributes *item, - SORT_FIELD_ATTR *attr) const override + void sort_length(THD *, const Type_std_attributes *, SORT_FIELD_ATTR *) + const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); } - uint32 max_display_length(const Item *item) const override + uint32 max_display_length(const Item *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return 0; } - uint32 max_display_length_for_field(const Conv_source &src) const override + uint32 max_display_length_for_field(const Conv_source &) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return 0; } - uint32 calc_pack_length(uint32 length) const override + uint32 calc_pack_length(uint32) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return 0; } bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr, Item *a, Item *b) const override; - decimal_digits_t Item_decimal_precision(const Item *item) const override + decimal_digits_t Item_decimal_precision(const Item *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return DECIMAL_MAX_PRECISION; } - bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override; + bool Item_save_in_value(THD *thd, Item *item, st_value *value) const + override; bool Item_param_set_from_value(THD *thd, Item_param *param, const Type_all_attributes *attr, const st_value *value) const override; - bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override + bool Item_send(Item *, Protocol *, st_value *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } void Item_update_null_value(Item *item) const override; - int Item_save_in_field(Item *item, Field *field, bool no_conversions) - const override + int Item_save_in_field(Item *, Field *, bool) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return 1; } String *print_item_value(THD *thd, Item *item, String *str) const override; - bool can_change_cond_ref_to_const(Item_bool_func2 *target, - Item *target_expr, Item *target_value, - Item_bool_func2 *source, - Item *source_expr, Item *source_const) - const override + bool can_change_cond_ref_to_const(Item_bool_func2 *, Item *, Item *, + Item_bool_func2 *, Item *, Item *) + const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return false; } - Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) - const override; + Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const + override; Item_cache *Item_get_cache(THD *thd, const Item *item) const override; - Item_copy *create_item_copy(THD *thd, Item *item) const override + Item_copy *create_item_copy(THD *, Item *) const override { - DBUG_ASSERT(0); - return NULL; + MY_ASSERT_UNREACHABLE(); + return nullptr; } bool set_comparator_func(THD *thd, Arg_comparator *cmp) const override; bool Item_hybrid_func_fix_attributes(THD *thd, @@ -4534,188 +4561,187 @@ class Type_handler_row: public Type_handler Item **items, uint nitems) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } - bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const override + bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } bool Item_val_bool(Item *item) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return false; } - void Item_get_date(THD *thd, Item *item, - Temporal::Warn *warn, MYSQL_TIME *ltime, - date_mode_t fuzzydate) const override + void Item_get_date(THD *, Item *, Temporal::Warn *, MYSQL_TIME *ltime, + date_mode_t) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); set_zero_time(ltime, MYSQL_TIMESTAMP_NONE); } - longlong Item_val_int_signed_typecast(Item *item) const override + longlong Item_val_int_signed_typecast(Item *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return 0; } - longlong Item_val_int_unsigned_typecast(Item *item) const override + longlong Item_val_int_unsigned_typecast(Item *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return 0; } - String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) - const override + String *Item_func_hex_val_str_ascii(Item_func_hex *, String *) const override { - DBUG_ASSERT(0); - return NULL; + MY_ASSERT_UNREACHABLE(); + return nullptr; } String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *, String *) const override { - DBUG_ASSERT(0); - return NULL; + MY_ASSERT_UNREACHABLE(); + return nullptr; } double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return 0.0; } longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return 0; } my_decimal *Item_func_hybrid_field_type_val_decimal( Item_func_hybrid_field_type *, my_decimal *) const override { - DBUG_ASSERT(0); - return NULL; + MY_ASSERT_UNREACHABLE(); + return nullptr; } void Item_func_hybrid_field_type_get_date(THD *, Item_func_hybrid_field_type *, Temporal::Warn *, MYSQL_TIME *ltime, - date_mode_t fuzzydate) - const override + date_mode_t) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); set_zero_time(ltime, MYSQL_TIMESTAMP_NONE); } - String *Item_func_min_max_val_str(Item_func_min_max *, String *) const override + String *Item_func_min_max_val_str(Item_func_min_max *, String *) const + override { - DBUG_ASSERT(0); - return NULL; + MY_ASSERT_UNREACHABLE(); + return nullptr; } double Item_func_min_max_val_real(Item_func_min_max *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return 0; } longlong Item_func_min_max_val_int(Item_func_min_max *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return 0; } my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *, my_decimal *) const override { - DBUG_ASSERT(0); - return NULL; + MY_ASSERT_UNREACHABLE(); + return nullptr; } - bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*, - MYSQL_TIME *, date_mode_t fuzzydate) - const override + bool Item_func_min_max_get_date(THD *, Item_func_min_max*, MYSQL_TIME *, + date_mode_t) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } - bool Item_func_between_fix_length_and_dec(Item_func_between *func) - const override + bool Item_func_between_fix_length_and_dec(Item_func_between *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } longlong Item_func_between_val_int(Item_func_between *func) const override; cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override; - in_vector *make_in_vector(THD *thd, const Item_func_in *f, uint nargs) - const override; - bool Item_func_in_fix_comparator_compatible_types(THD *thd, Item_func_in *) - const override; + in_vector *make_in_vector(THD *thd, const Item_func_in *f, uint nargs) const + override; + bool Item_func_in_fix_comparator_compatible_types(THD *thd, + Item_func_in *) const + override; bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; - bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const override; + bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const + override; bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override; bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override; bool Item_func_signed_fix_length_and_dec(Item_func_signed *) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } - bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *) const override + bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *) const + override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } - bool Item_double_typecast_fix_length_and_dec(Item_double_typecast *) - const override + bool Item_double_typecast_fix_length_and_dec(Item_double_typecast *) const + override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } - bool Item_float_typecast_fix_length_and_dec(Item_float_typecast *) - const override + bool Item_float_typecast_fix_length_and_dec(Item_float_typecast *) const + override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } - bool Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *) - const override + bool Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *) const + override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } - bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) - const override + bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const + override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } - bool Item_time_typecast_fix_length_and_dec(Item_time_typecast *) - const override + bool Item_time_typecast_fix_length_and_dec(Item_time_typecast *) const + override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } - bool Item_date_typecast_fix_length_and_dec(Item_date_typecast *) - const override + bool Item_date_typecast_fix_length_and_dec(Item_date_typecast *) const + override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } bool Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *) - const override + const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return true; } @@ -4735,8 +4761,6 @@ class Type_handler_numeric: public Type_handler public: const Name &default_value() const override; String *print_item_value(THD *thd, Item *item, String *str) const override; - double Item_func_min_max_val_real(Item_func_min_max *) const override; - longlong Item_func_min_max_val_int(Item_func_min_max *) const override; bool Column_definition_prepare_stage1(THD *thd, MEM_ROOT *mem_root, Column_definition *c, @@ -4745,19 +4769,23 @@ class Type_handler_numeric: public Type_handler const Column_derived_attributes *derived_attr) const override; + double Item_func_min_max_val_real(Item_func_min_max *) const override; + longlong Item_func_min_max_val_int(Item_func_min_max *) const override; my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *, my_decimal *) const override; bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*, - MYSQL_TIME *, date_mode_t fuzzydate) - const override; - virtual ~Type_handler_numeric() { } + MYSQL_TIME *, date_mode_t fuzzydate) const + override; + virtual ~Type_handler_numeric() = default; bool can_change_cond_ref_to_const(Item_bool_func2 *target, Item *target_expr, Item *target_value, Item_bool_func2 *source, - Item *source_expr, Item *source_const) - const override; - bool Item_func_between_fix_length_and_dec(Item_func_between *func) const override; - bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const override; + Item *source_expr, Item *source_const) const + override; + bool Item_func_between_fix_length_and_dec(Item_func_between *func) const + override; + bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const + override; }; @@ -4773,7 +4801,7 @@ class Type_handler_real_result: public Type_handler_numeric { return DYN_COL_DOUBLE; } - virtual ~Type_handler_real_result() {} + virtual ~Type_handler_real_result() = default; const Type_handler *type_handler_for_comparison() const override; Field *make_table_field(MEM_ROOT *root, const LEX_CSTRING *name, @@ -4801,10 +4829,10 @@ class Type_handler_real_result: public Type_handler_numeric const override; void make_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; + String *tmp) const override; uint make_packed_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; + String *tmp) const override; void sort_length(THD *thd, const Type_std_attributes *item, SORT_FIELD_ATTR *attr) const override; @@ -4894,7 +4922,7 @@ class Type_handler_decimal_result: public Type_handler_numeric { return DYN_COL_DECIMAL; } - virtual ~Type_handler_decimal_result() {}; + virtual ~Type_handler_decimal_result() = default; const Type_handler *type_handler_for_comparison() const override; int stored_field_cmp_to_item(THD *, Field *field, Item *item) const override { @@ -4913,10 +4941,10 @@ class Type_handler_decimal_result: public Type_handler_numeric const override; void make_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; + String *tmp) const override; uint make_packed_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; + String *tmp) const override; void Column_definition_attributes_frm_pack(const Column_definition_attributes *at, uchar *buff) const override; @@ -5154,7 +5182,7 @@ class Type_handler_int_result: public Type_handler_numeric } bool is_order_clause_position_type() const override { return true; } bool is_limit_clause_valid_type() const override { return true; } - virtual ~Type_handler_int_result() {} + virtual ~Type_handler_int_result() = default; const Type_handler *type_handler_for_comparison() const override; int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const override; bool subquery_type_allows_materialization(const Item *inner, @@ -5169,10 +5197,10 @@ class Type_handler_int_result: public Type_handler_numeric TABLE_SHARE *share) const override; void make_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; + String *tmp) const override; uint make_packed_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; + String *tmp) const override; void Column_definition_attributes_frm_pack(const Column_definition_attributes *at, uchar *buff) const override; @@ -5252,8 +5280,8 @@ class Type_handler_general_purpose_int: public Type_handler_int_result return type_limits_int()->char_length(); } uint32 Item_decimal_notation_int_digits(const Item *item) const override; - bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const override + bool partition_field_check(const LEX_CSTRING &, Item *item_expr) + const override { return partition_field_check_result_type(item_expr, INT_RESULT); } @@ -5274,16 +5302,16 @@ class Type_handler_temporal_result: public Type_handler public: Item_result result_type() const override { return STRING_RESULT; } Item_result cmp_type() const override { return TIME_RESULT; } - virtual ~Type_handler_temporal_result() {} + virtual ~Type_handler_temporal_result() = default; void Column_definition_attributes_frm_pack(const Column_definition_attributes *at, uchar *buff) const override; void make_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; + String *tmp) const override; uint make_packed_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; + String *tmp) const override; void sort_length(THD *thd, const Type_std_attributes *item, SORT_FIELD_ATTR *attr) const override; @@ -5372,7 +5400,7 @@ class Type_handler_string_result: public Type_handler return DYN_COL_STRING; } CHARSET_INFO *charset_for_protocol(const Item *item) const override; - virtual ~Type_handler_string_result() {} + virtual ~Type_handler_string_result() = default; const Type_handler *type_handler_for_comparison() const override; int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const override; @@ -5381,10 +5409,10 @@ class Type_handler_string_result: public Type_handler CHARSET_INFO *cs) const override; void make_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; + String *tmp) const override; uint make_packed_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; + String *tmp) const override; void sort_length(THD *thd, const Type_std_attributes *item, SORT_FIELD_ATTR *attr) const override; @@ -5562,7 +5590,7 @@ class Type_handler_general_purpose_string: public Type_handler_string_result class Type_handler_tiny: public Type_handler_general_purpose_int { public: - virtual ~Type_handler_tiny() {} + virtual ~Type_handler_tiny() = default; enum_field_types field_type() const override { return MYSQL_TYPE_TINY; } const Type_handler *type_handler_unsigned() const override; const Type_handler *type_handler_signed() const override; @@ -5613,7 +5641,7 @@ class Type_handler_utiny: public Type_handler_tiny class Type_handler_short: public Type_handler_general_purpose_int { public: - virtual ~Type_handler_short() {} + virtual ~Type_handler_short() = default; enum_field_types field_type() const override { return MYSQL_TYPE_SHORT; } const Type_handler *type_handler_unsigned() const override; const Type_handler *type_handler_signed() const override; @@ -5664,7 +5692,7 @@ class Type_handler_ushort: public Type_handler_short class Type_handler_long: public Type_handler_general_purpose_int { public: - virtual ~Type_handler_long() {} + virtual ~Type_handler_long() = default; enum_field_types field_type() const override { return MYSQL_TYPE_LONG; } const Type_handler *type_handler_unsigned() const override; const Type_handler *type_handler_signed() const override; @@ -5726,7 +5754,7 @@ class Type_handler_bool: public Type_handler_long class Type_handler_longlong: public Type_handler_general_purpose_int { public: - virtual ~Type_handler_longlong() {} + virtual ~Type_handler_longlong() = default; enum_field_types field_type() const override{ return MYSQL_TYPE_LONGLONG; } const Type_handler *type_handler_unsigned() const override; const Type_handler *type_handler_signed() const override; @@ -5781,7 +5809,7 @@ class Type_handler_ulonglong: public Type_handler_longlong class Type_handler_vers_trx_id: public Type_handler_ulonglong { public: - virtual ~Type_handler_vers_trx_id() {} + virtual ~Type_handler_vers_trx_id() = default; Field *make_table_field(MEM_ROOT *root, const LEX_CSTRING *name, const Record_addr &addr, @@ -5793,7 +5821,7 @@ class Type_handler_vers_trx_id: public Type_handler_ulonglong class Type_handler_int24: public Type_handler_general_purpose_int { public: - virtual ~Type_handler_int24() {} + virtual ~Type_handler_int24() = default; enum_field_types field_type() const override { return MYSQL_TYPE_INT24; } const Type_handler *type_handler_unsigned() const override; const Type_handler *type_handler_signed() const override; @@ -5838,7 +5866,7 @@ class Type_handler_uint24: public Type_handler_int24 class Type_handler_year: public Type_handler_int_result { public: - virtual ~Type_handler_year() {} + virtual ~Type_handler_year() = default; enum_field_types field_type() const override { return MYSQL_TYPE_YEAR; } uint flags() const override { return UNSIGNED_FLAG; } protocol_send_type_t protocol_send_type() const override @@ -5892,7 +5920,7 @@ class Type_handler_year: public Type_handler_int_result class Type_handler_bit: public Type_handler_int_result { public: - virtual ~Type_handler_bit() {} + virtual ~Type_handler_bit() = default; enum_field_types field_type() const override { return MYSQL_TYPE_BIT; } uint flags() const override { return UNSIGNED_FLAG; } protocol_send_type_t protocol_send_type() const override @@ -5957,7 +5985,7 @@ class Type_handler_bit: public Type_handler_int_result class Type_handler_float: public Type_handler_real_result { public: - virtual ~Type_handler_float() {} + virtual ~Type_handler_float() = default; enum_field_types field_type() const override { return MYSQL_TYPE_FLOAT; } protocol_send_type_t protocol_send_type() const override { @@ -6011,7 +6039,7 @@ class Type_handler_float: public Type_handler_real_result class Type_handler_double: public Type_handler_real_result { public: - virtual ~Type_handler_double() {} + virtual ~Type_handler_double() = default; enum_field_types field_type() const override { return MYSQL_TYPE_DOUBLE; } protocol_send_type_t protocol_send_type() const override { @@ -6066,7 +6094,7 @@ class Type_handler_double: public Type_handler_real_result class Type_handler_time_common: public Type_handler_temporal_result { public: - virtual ~Type_handler_time_common() { } + virtual ~Type_handler_time_common() = default; const Name &default_value() const override; enum_field_types field_type() const override { return MYSQL_TYPE_TIME; } enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) @@ -6091,8 +6119,8 @@ class Type_handler_time_common: public Type_handler_temporal_result const override; bool Item_param_val_native(THD *thd, Item_param *item, Native *to) const override; - bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const override + bool partition_field_check(const LEX_CSTRING &, Item *item_expr) + const override { return partition_field_check_result_type(item_expr, STRING_RESULT); } @@ -6188,7 +6216,7 @@ class Type_handler_time: public Type_handler_time_common static uint m_hires_bytes[MAX_DATETIME_PRECISION+1]; public: static uint hires_bytes(uint dec) { return m_hires_bytes[dec]; } - virtual ~Type_handler_time() {} + virtual ~Type_handler_time() = default; const Name version() const override { return version_mariadb53(); } uint32 max_display_length_for_field(const Conv_source &src) const override { return MIN_TIME_WIDTH; } @@ -6218,7 +6246,7 @@ class Type_handler_time: public Type_handler_time_common class Type_handler_time2: public Type_handler_time_common { public: - virtual ~Type_handler_time2() {} + virtual ~Type_handler_time2() = default; const Name version() const override { return version_mysql56(); } enum_field_types real_field_type() const override { return MYSQL_TYPE_TIME2; } uint32 max_display_length_for_field(const Conv_source &src) const override; @@ -6248,7 +6276,7 @@ class Type_handler_time2: public Type_handler_time_common class Type_handler_temporal_with_date: public Type_handler_temporal_result { public: - virtual ~Type_handler_temporal_with_date() {} + virtual ~Type_handler_temporal_with_date() = default; Item_literal *create_literal_item(THD *thd, const char *str, size_t length, CHARSET_INFO *cs, bool send_error) const override; @@ -6278,7 +6306,7 @@ class Type_handler_temporal_with_date: public Type_handler_temporal_result class Type_handler_date_common: public Type_handler_temporal_with_date { public: - virtual ~Type_handler_date_common() {} + virtual ~Type_handler_date_common() = default; const Name &default_value() const override; const Type_handler *type_handler_for_comparison() const override; enum_field_types field_type() const override { return MYSQL_TYPE_DATE; } @@ -6301,8 +6329,8 @@ class Type_handler_date_common: public Type_handler_temporal_with_date { return true; } - bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const override + bool partition_field_check(const LEX_CSTRING &, Item *item_expr) + const override { return partition_field_check_result_type(item_expr, STRING_RESULT); } @@ -6349,7 +6377,7 @@ class Type_handler_date_common: public Type_handler_temporal_with_date class Type_handler_date: public Type_handler_date_common { public: - virtual ~Type_handler_date() {} + virtual ~Type_handler_date() = default; uint32 calc_pack_length(uint32 length) const override { return 4; } Field *make_conversion_table_field(MEM_ROOT *root, TABLE *table, uint metadata, @@ -6376,7 +6404,7 @@ class Type_handler_date: public Type_handler_date_common class Type_handler_newdate: public Type_handler_date_common { public: - virtual ~Type_handler_newdate() {} + virtual ~Type_handler_newdate() = default; enum_field_types real_field_type() const override { return MYSQL_TYPE_NEWDATE; @@ -6407,7 +6435,7 @@ class Type_handler_newdate: public Type_handler_date_common class Type_handler_datetime_common: public Type_handler_temporal_with_date { public: - virtual ~Type_handler_datetime_common() {} + virtual ~Type_handler_datetime_common() = default; const Name &default_value() const override; const Type_handler *type_handler_for_comparison() const override; enum_field_types field_type() const override @@ -6431,8 +6459,8 @@ class Type_handler_datetime_common: public Type_handler_temporal_with_date { return true; } - bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const override + bool partition_field_check(const LEX_CSTRING &, Item *item_expr) + const override { return partition_field_check_result_type(item_expr, STRING_RESULT); } @@ -6491,7 +6519,7 @@ class Type_handler_datetime: public Type_handler_datetime_common static uint m_hires_bytes[MAX_DATETIME_PRECISION + 1]; public: static uint hires_bytes(uint dec) { return m_hires_bytes[dec]; } - virtual ~Type_handler_datetime() {} + virtual ~Type_handler_datetime() = default; const Name version() const override { return version_mariadb53(); } uint32 max_display_length_for_field(const Conv_source &src) const override { return MAX_DATETIME_WIDTH; } @@ -6521,7 +6549,7 @@ class Type_handler_datetime: public Type_handler_datetime_common class Type_handler_datetime2: public Type_handler_datetime_common { public: - virtual ~Type_handler_datetime2() {} + virtual ~Type_handler_datetime2() = default; const Name version() const override { return version_mysql56(); } enum_field_types real_field_type() const override { @@ -6556,7 +6584,7 @@ class Type_handler_timestamp_common: public Type_handler_temporal_with_date protected: bool TIME_to_native(THD *, const MYSQL_TIME *from, Native *to, uint dec) const; public: - virtual ~Type_handler_timestamp_common() {} + virtual ~Type_handler_timestamp_common() = default; const Name &default_value() const override; const Type_handler *type_handler_for_comparison() const override; const Type_handler *type_handler_for_native_format() const override; @@ -6606,10 +6634,10 @@ class Type_handler_timestamp_common: public Type_handler_temporal_with_date const override; void make_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; + String *tmp) const override; uint make_packed_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override; + String *tmp) const override; void sort_length(THD *thd, const Type_std_attributes *item, SORT_FIELD_ATTR *attr) const override; @@ -6649,12 +6677,6 @@ class Type_handler_timestamp_common: public Type_handler_temporal_with_date bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*, MYSQL_TIME *, date_mode_t fuzzydate) const override; - bool Column_definition_set_attributes(THD *thd, - Column_definition *def, - const Lex_field_type_st &attr, - CHARSET_INFO *cs, - column_definition_type_t type) - const override; }; @@ -6664,7 +6686,7 @@ class Type_handler_timestamp: public Type_handler_timestamp_common static uint m_sec_part_bytes[MAX_DATETIME_PRECISION + 1]; public: static uint sec_part_bytes(uint dec) { return m_sec_part_bytes[dec]; } - virtual ~Type_handler_timestamp() {} + virtual ~Type_handler_timestamp() = default; const Name version() const override { return version_mariadb53(); } uint32 max_display_length_for_field(const Conv_source &src) const override { return MAX_DATETIME_WIDTH; } @@ -6694,7 +6716,7 @@ class Type_handler_timestamp: public Type_handler_timestamp_common class Type_handler_timestamp2: public Type_handler_timestamp_common { public: - virtual ~Type_handler_timestamp2() {} + virtual ~Type_handler_timestamp2() = default; const Name version() const override { return version_mysql56(); } enum_field_types real_field_type() const override { @@ -6729,7 +6751,7 @@ class Type_handler_timestamp2: public Type_handler_timestamp_common class Type_handler_olddecimal: public Type_handler_decimal_result { public: - virtual ~Type_handler_olddecimal() {} + virtual ~Type_handler_olddecimal() = default; enum_field_types field_type() const override { return MYSQL_TYPE_DECIMAL; } uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 calc_pack_length(uint32 length) const override { return length; } @@ -6763,7 +6785,7 @@ class Type_handler_olddecimal: public Type_handler_decimal_result class Type_handler_newdecimal: public Type_handler_decimal_result { public: - virtual ~Type_handler_newdecimal() {} + virtual ~Type_handler_newdecimal() = default; enum_field_types field_type() const override { return MYSQL_TYPE_NEWDECIMAL; } uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 calc_pack_length(uint32 length) const override; @@ -6807,7 +6829,7 @@ class Type_handler_newdecimal: public Type_handler_decimal_result class Type_handler_null: public Type_handler_general_purpose_string { public: - virtual ~Type_handler_null() {} + virtual ~Type_handler_null() = default; enum_field_types field_type() const override { return MYSQL_TYPE_NULL; } enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) const override @@ -6879,7 +6901,7 @@ class Type_handler_longstr: public Type_handler_general_purpose_string class Type_handler_string: public Type_handler_longstr { public: - virtual ~Type_handler_string() {} + virtual ~Type_handler_string() = default; enum_field_types field_type() const override { return MYSQL_TYPE_STRING; } ulong KEY_pack_flags(uint column_nr) const override { @@ -6888,12 +6910,13 @@ class Type_handler_string: public Type_handler_longstr bool is_param_long_data_type() const override { return true; } uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 calc_pack_length(uint32 length) const override { return length; } - const Type_handler *type_handler_for_tmp_table(const Item *item) const override + const Type_handler *type_handler_for_tmp_table(const Item *item) const + override { return varstring_type_handler(item); } - bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const override + bool partition_field_check(const LEX_CSTRING &, Item *item_expr) + const override { return partition_field_check_result_type(item_expr, STRING_RESULT); } @@ -6933,7 +6956,7 @@ class Type_handler_string: public Type_handler_longstr class Type_handler_var_string: public Type_handler_string { public: - virtual ~Type_handler_var_string() {} + virtual ~Type_handler_var_string() = default; enum_field_types field_type() const override { return MYSQL_TYPE_VAR_STRING; } enum_field_types real_field_type() const override { return MYSQL_TYPE_STRING; } enum_field_types traditional_merge_field_type() const override @@ -6963,7 +6986,7 @@ class Type_handler_var_string: public Type_handler_string class Type_handler_varchar: public Type_handler_longstr { public: - virtual ~Type_handler_varchar() {} + virtual ~Type_handler_varchar() = default; enum_field_types field_type() const override { return MYSQL_TYPE_VARCHAR; } ulong KEY_pack_flags(uint column_nr) const override { @@ -6980,7 +7003,8 @@ class Type_handler_varchar: public Type_handler_longstr { return (length + (length < 256 ? 1: 2)); } - const Type_handler *type_handler_for_tmp_table(const Item *item) const override + const Type_handler *type_handler_for_tmp_table(const Item *item) const + override { return varstring_type_handler(item); } @@ -6989,8 +7013,8 @@ class Type_handler_varchar: public Type_handler_longstr return varstring_type_handler(item); } bool is_param_long_data_type() const override { return true; } - bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const override + bool partition_field_check(const LEX_CSTRING &, Item *item_expr) + const override { return partition_field_check_result_type(item_expr, STRING_RESULT); } @@ -7034,7 +7058,7 @@ class Type_handler_varchar: public Type_handler_longstr class Type_handler_hex_hybrid: public Type_handler_varchar { public: - virtual ~Type_handler_hex_hybrid() {} + virtual ~Type_handler_hex_hybrid() = default; const Type_handler *cast_to_int_type_handler() const override; bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; bool Item_func_int_val_fix_length_and_dec(Item_func_int_val*) const override; @@ -7050,12 +7074,12 @@ class Type_handler_varchar_compressed: public Type_handler_varchar } ulong KEY_pack_flags(uint column_nr) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return 0; } uint32 max_display_length_for_field(const Conv_source &src) const override; - bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const override + bool partition_field_check(const LEX_CSTRING &field_name, Item *) + const override { partition_field_type_not_allowed(field_name); return true; @@ -7077,7 +7101,7 @@ class Type_handler_varchar_compressed: public Type_handler_varchar class Type_handler_blob_common: public Type_handler_longstr { public: - virtual ~Type_handler_blob_common() { } + virtual ~Type_handler_blob_common() = default; virtual uint length_bytes() const= 0; ulong KEY_pack_flags(uint column_nr) const override { @@ -7135,7 +7159,7 @@ class Type_handler_blob_common: public Type_handler_longstr void Item_param_setup_conversion(THD *thd, Item_param *) const override; bool partition_field_check(const LEX_CSTRING &field_name, - Item *item_expr) const override; + Item *item_expr) const override; Field *make_schema_field(MEM_ROOT *root, TABLE *table, const Record_addr &addr, @@ -7154,7 +7178,7 @@ class Type_handler_blob_common: public Type_handler_longstr class Type_handler_tiny_blob: public Type_handler_blob_common { public: - virtual ~Type_handler_tiny_blob() {} + virtual ~Type_handler_tiny_blob() = default; uint length_bytes() const override { return 1; } enum_field_types field_type() const override { return MYSQL_TYPE_TINY_BLOB; } uint32 max_display_length_for_field(const Conv_source &src) const override; @@ -7171,9 +7195,10 @@ class Type_handler_tiny_blob: public Type_handler_blob_common class Type_handler_medium_blob: public Type_handler_blob_common { public: - virtual ~Type_handler_medium_blob() {} + virtual ~Type_handler_medium_blob() = default; uint length_bytes() const override { return 3; } - enum_field_types field_type() const override { return MYSQL_TYPE_MEDIUM_BLOB; } + enum_field_types field_type() const override + { return MYSQL_TYPE_MEDIUM_BLOB; } uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 calc_pack_length(uint32 length) const override; Field *make_table_field(MEM_ROOT *root, @@ -7188,7 +7213,7 @@ class Type_handler_medium_blob: public Type_handler_blob_common class Type_handler_long_blob: public Type_handler_blob_common { public: - virtual ~Type_handler_long_blob() {} + virtual ~Type_handler_long_blob() = default; uint length_bytes() const override { return 4; } enum_field_types field_type() const override { return MYSQL_TYPE_LONG_BLOB; } uint32 max_display_length_for_field(const Conv_source &src) const override; @@ -7207,7 +7232,7 @@ class Type_handler_long_blob: public Type_handler_blob_common class Type_handler_blob: public Type_handler_blob_common { public: - virtual ~Type_handler_blob() {} + virtual ~Type_handler_blob() = default; uint length_bytes() const override { return 2; } enum_field_types field_type() const override { return MYSQL_TYPE_BLOB; } uint32 max_display_length_for_field(const Conv_source &src) const override; @@ -7230,7 +7255,7 @@ class Type_handler_blob_compressed: public Type_handler_blob } ulong KEY_pack_flags(uint) const override { - DBUG_ASSERT(0); + MY_ASSERT_UNREACHABLE(); return 0; } uint32 max_display_length_for_field(const Conv_source &src) const override; @@ -7251,7 +7276,7 @@ class Type_handler_blob_compressed: public Type_handler_blob class Type_handler_typelib: public Type_handler_general_purpose_string { public: - virtual ~Type_handler_typelib() { } + virtual ~Type_handler_typelib() = default; enum_field_types field_type() const override { return MYSQL_TYPE_STRING; } const Type_handler *type_handler_for_item_field() const override; const Type_handler *cast_to_int_type_handler() const override; @@ -7289,7 +7314,7 @@ class Type_handler_typelib: public Type_handler_general_purpose_string class Type_handler_enum: public Type_handler_typelib { public: - virtual ~Type_handler_enum() {} + virtual ~Type_handler_enum() = default; enum_field_types real_field_type() const override { return MYSQL_TYPE_ENUM; } enum_field_types traditional_merge_field_type() const override { @@ -7330,7 +7355,7 @@ class Type_handler_enum: public Type_handler_typelib class Type_handler_set: public Type_handler_typelib { public: - virtual ~Type_handler_set() {} + virtual ~Type_handler_set() = default; enum_field_types real_field_type() const override { return MYSQL_TYPE_SET; } enum_field_types traditional_merge_field_type() const override { @@ -7376,7 +7401,7 @@ class Type_handler_interval_DDhhmmssff: public Type_handler_long_blob class Function_collection { public: - virtual ~Function_collection() {} + virtual ~Function_collection() = default; virtual bool init()= 0; virtual void cleanup()= 0; virtual Create_func *find_native_function_builder(THD *thd, @@ -7388,11 +7413,8 @@ class Function_collection class Type_collection { public: - virtual ~Type_collection() {} - virtual bool init(Type_handler_data *data) - { - return false; - } + virtual ~Type_collection() = default; + virtual bool init(Type_handler_data *) { return false; } virtual const Type_handler *handler_by_name(const LEX_CSTRING &name) const= 0; virtual const Type_handler *aggregate_for_result(const Type_handler *h1, const Type_handler *h2) @@ -7475,6 +7497,41 @@ class Type_handler_hybrid_field_type const Type_handler *h0, const Type_handler *h1); }; + +class Type_handler_pair +{ + const Type_handler *m_a; + const Type_handler *m_b; +public: + Type_handler_pair(const Type_handler *a, + const Type_handler *b) + :m_a(a), m_b(b) + { } + const Type_handler *a() const { return m_a; } + const Type_handler *b() const { return m_b; } + /* + Change both handlers to their parent data type handlers, if available. + For example, VARCHAR/JSON -> VARCHAR. + @returns The number of handlers changed (0,1 or 2). + */ + bool to_base() + { + bool rc= false; + const Type_handler *na= m_a->type_handler_base(); + const Type_handler *nb= m_b->type_handler_base(); + if (na) + { + m_a= na; rc= true; + } + if (nb) + { + m_b= nb; rc= true; + } + return rc; + } +}; + + /* Helper template to simplify creating builtin types with names. Plugin types inherit from Type_handler_xxx types that do not set the name in @@ -7551,7 +7608,7 @@ class Type_aggregator const Type_handler *m_handler1; const Type_handler *m_handler2; const Type_handler *m_result; - Pair() { } + Pair() = default; Pair(const Type_handler *handler1, const Type_handler *handler2, const Type_handler *result) diff --git a/sql/sql_type_fixedbin.h b/sql/sql_type_fixedbin.h index 332b712db3183..093587c4deb42 100644 --- a/sql/sql_type_fixedbin.h +++ b/sql/sql_type_fixedbin.h @@ -468,7 +468,7 @@ class FixedBinTypeBundle return def->frm_unpack_charset(share, buffer); } void make_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override + String *) const override { DBUG_ASSERT(item->type_handler() == this); NativeBuffer tmp; @@ -489,7 +489,7 @@ class FixedBinTypeBundle } uint make_packed_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, - Sort_param *param) const override + String *) const override { DBUG_ASSERT(item->type_handler() == this); NativeBuffer tmp; @@ -1190,7 +1190,6 @@ class FixedBinTypeBundle bool val_native(Native *to) override { DBUG_ASSERT(marked_for_read()); - DBUG_ASSERT(!is_null()); if (to->alloc(FbtImpl::binary_length())) return true; to->length(FbtImpl::binary_length()); @@ -1201,7 +1200,6 @@ class FixedBinTypeBundle Fbt to_fbt() const { DBUG_ASSERT(marked_for_read()); - DBUG_ASSERT(!is_null()); return Fbt::record_to_memory((const char*) ptr); } @@ -1410,7 +1408,8 @@ class FixedBinTypeBundle Mixing of two different non-traditional types is currently prevented. This may change in the future. */ - DBUG_ASSERT(item->type_handler()->is_traditional_scalar_type() || + DBUG_ASSERT(item->type_handler()->type_handler_base_or_self()-> + is_traditional_scalar_type() || item->type_handler() == type_handler()); return true; } @@ -1424,16 +1423,14 @@ class FixedBinTypeBundle bool is_eq_func) const override { // See the DBUG_ASSERT comment in can_optimize_keypart_ref() - DBUG_ASSERT(item->type_handler()->is_traditional_scalar_type() || + DBUG_ASSERT(item->type_handler()->type_handler_base_or_self()-> + is_traditional_scalar_type() || item->type_handler() == type_handler()); return true; } - void hash(ulong *nr, ulong *nr2) override + void hash_not_null(Hasher *hasher) override { - if (is_null()) - *nr^= (*nr << 1) | 1; - else - FbtImpl::hash_record(ptr, nr, nr2); + FbtImpl::hash_record(ptr, hasher); } SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *prm, KEY_PART *key_part, const Item_bool_func *cond, @@ -1587,8 +1584,9 @@ class FixedBinTypeBundle if (!example) return false; value_cached= true; - null_value= example->val_native_with_conversion_result(current_thd, - &m_value, type_handler()); + null_value_inside= null_value= + example->val_native_with_conversion_result(current_thd, + &m_value, type_handler()); return true; } String* val_str(String *to) diff --git a/sql/sql_type_fixedbin_storage.h b/sql/sql_type_fixedbin_storage.h index 6e18335bd4c3f..3a4e74a8cdbca 100644 --- a/sql/sql_type_fixedbin_storage.h +++ b/sql/sql_type_fixedbin_storage.h @@ -64,9 +64,7 @@ class FixedBinTypeStorage // The buffer that stores the in-memory binary representation char m_buffer[NATIVE_LEN]; - // Non-initializing constructor - FixedBinTypeStorage() - { } + FixedBinTypeStorage() = default; FixedBinTypeStorage & set_zero() { @@ -122,9 +120,9 @@ class FixedBinTypeStorage Hash the in-record representation Used in Field::hash(). */ - static void hash_record(const uchar *ptr, ulong *nr, ulong *nr2) + static void hash_record(uchar *ptr, Hasher *hasher) { - my_charset_bin.hash_sort(ptr, binary_length(), nr, nr2); + hasher->add(&my_charset_bin, ptr, binary_length()); } static bool only_zero_bytes(const char *ptr, size_t length) diff --git a/sql/sql_type_geom.h b/sql/sql_type_geom.h index a2bcd45e0e880..3bc25808bc39a 100644 --- a/sql/sql_type_geom.h +++ b/sql/sql_type_geom.h @@ -2,7 +2,7 @@ #define SQL_TYPE_GEOM_H_INCLUDED /* Copyright (c) 2015 MariaDB Foundation - Copyright (c) 2019 MariaDB + Copyright (c) 2019, 2022, 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 @@ -397,12 +397,6 @@ class Field_geom :public Field_blob !table->copy_blobs; } bool is_equal(const Column_definition &new_field) const override; - bool can_be_converted_by_engine(const Column_definition &new_type) - const override - { - return false; // Override the Field_blob behavior - } - int store(const char *to, size_t length, CHARSET_INFO *charset) override; int store(double nr) override; int store(longlong nr, bool unsigned_val) override; diff --git a/sql/sql_type_json.cc b/sql/sql_type_json.cc index a804366ec0318..c12b868e6b98a 100644 --- a/sql/sql_type_json.cc +++ b/sql/sql_type_json.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2019, MariaDB + Copyright (c) 2019, 2021 MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -20,17 +20,111 @@ #include "sql_class.h" -Type_handler_json_longtext type_handler_json_longtext; +Named_type_handler + type_handler_string_json("char/json"); + +Named_type_handler + type_handler_varchar_json("varchar/json"); + +Named_type_handler + type_handler_tiny_blob_json("tinyblob/json"); + +Named_type_handler + type_handler_blob_json("blob/json"); + +Named_type_handler + type_handler_medium_blob_json("mediumblob/json"); + +Named_type_handler + type_handler_long_blob_json("longblob/json"); + + +// Convert general purpose string type handlers to their JSON counterparts +const Type_handler * +Type_handler_json_common::json_type_handler_from_generic(const Type_handler *th) +{ + // Test in the order of likelyhood. + if (th == &type_handler_long_blob) + return &type_handler_long_blob_json; + if (th == &type_handler_varchar) + return &type_handler_varchar_json; + if (th == &type_handler_blob) + return &type_handler_blob_json; + if (th == &type_handler_tiny_blob) + return &type_handler_tiny_blob_json; + if (th == &type_handler_medium_blob) + return &type_handler_medium_blob_json; + if (th == &type_handler_string) + return &type_handler_string_json; + DBUG_ASSERT(is_json_type_handler(th)); + return th; +} + + +/* + This method resembles what Type_handler::string_type_handler() + does for general purpose string type handlers. +*/ +const Type_handler * +Type_handler_json_common::json_type_handler(uint max_octet_length) +{ + if (max_octet_length >= 16777216) + return &type_handler_long_blob_json; + else if (max_octet_length >= 65536) + return &type_handler_medium_blob_json; + else if (max_octet_length >= MAX_FIELD_VARCHARLENGTH) + return &type_handler_blob_json; + return &type_handler_varchar_json; +} + + +/* + This method resembles what Field_blob::type_handler() + does for general purpose BLOB type handlers. +*/ +const Type_handler * +Type_handler_json_common::json_blob_type_handler_by_length_bytes(uint len) +{ + switch (len) { + case 1: return &type_handler_tiny_blob_json; + case 2: return &type_handler_blob_json; + case 3: return &type_handler_medium_blob_json; + } + return &type_handler_long_blob_json; +} + + +/* + This method resembles what Item_sum_group_concat::type_handler() + does for general purpose string type handlers. +*/ +const Type_handler * +Type_handler_json_common::json_type_handler_sum(const Item_sum *item) +{ + if (item->too_big_for_varchar()) + return &type_handler_blob_json; + return &type_handler_varchar_json; +} + + +bool Type_handler_json_common::has_json_valid_constraint(const Field *field) +{ + return field->check_constraint && + field->check_constraint->expr && + field->check_constraint->expr->type() == Item::FUNC_ITEM && + static_cast(field->check_constraint->expr)-> + functype() == Item_func::JSON_VALID_FUNC; +} /** Create JSON_VALID(field_name) expression */ + Virtual_column_info * -Type_handler_json_longtext::make_json_valid_expr(THD *thd, - const LEX_CSTRING *field_name) - const +Type_handler_json_common::make_json_valid_expr(THD *thd, + const LEX_CSTRING *field_name) { Lex_ident_sys_st str; Item *field, *expr; @@ -46,12 +140,118 @@ Type_handler_json_longtext::make_json_valid_expr(THD *thd, } -bool Type_handler_json_longtext:: - Column_definition_validate_check_constraint(THD *thd, - Column_definition * c) const +bool Type_handler_json_common::make_json_valid_expr_if_needed(THD *thd, + Column_definition *c) +{ + return !c->check_constraint && + !(c->check_constraint= make_json_valid_expr(thd, &c->field_name)); +} + + +class Type_collection_json: public Type_collection +{ + const Type_handler *aggregate_common(const Type_handler *a, + const Type_handler *b) const + { + if (a == b) + return a; + if (a == &type_handler_null) + return b; + if (b == &type_handler_null) + return a; + return NULL; + } + + /* + Aggregate two JSON type handlers for result. + If one of the handlers is not JSON, NULL is returned. + */ + const Type_handler *aggregate_json_for_result(const Type_handler *a, + const Type_handler *b) const + { + if (!Type_handler_json_common::is_json_type_handler(a) || + !Type_handler_json_common::is_json_type_handler(b)) + return NULL; + // Here we have two JSON data types. Let's aggregate their base types. + const Type_handler *a0= a->type_handler_base(); + const Type_handler *b0= b->type_handler_base(); + // Base types are expected to belong to type_collection_std: + DBUG_ASSERT(a0->type_collection() == type_handler_null.type_collection()); + DBUG_ASSERT(b0->type_collection() == type_handler_null.type_collection()); + const Type_handler *c= a0->type_collection()->aggregate_for_result(a0, b0); + return Type_handler_json_common::json_type_handler_from_generic(c); + } +public: + const Type_handler *aggregate_for_result(const Type_handler *a, + const Type_handler *b) + const override + { + const Type_handler *h; + if ((h= aggregate_common(a, b)) || + (h= aggregate_json_for_result(a, b))) + return h; + /* + One of the types is not JSON. + Let the caller aggregate according to the derived rules: + COALESCE(VARCHAR/JSON, TEXT) -> COALESCE(VARCHAR, TEXT) + */ + return NULL; + } + + const Type_handler *aggregate_for_min_max(const Type_handler *a, + const Type_handler *b) + const override + { + /* + No JSON specific rules. + Let the caller aggregate according to the derived rules: + LEAST(VARCHAR/JSON, TEXT/JSON) -> LEAST(VARCHAR, TEXT) + */ + return NULL; + } + + const Type_handler *aggregate_for_comparison(const Type_handler *a, + const Type_handler *b) + const override + { + /* + All JSON types return &type_handler_long_blob + in type_handler_for_comparison(). We should not get here. + */ + DBUG_ASSERT(0); + return NULL; + } + + const Type_handler *aggregate_for_num_op(const Type_handler *a, + const Type_handler *b) + const override + { + /* + No JSON specific rules. + Let the caller aggregate according to the derived rules: + (VARCHAR/JSON + TEXT/JSON) -> (VARCHAR + TEXT) + */ + return NULL; + } + + const Type_handler *handler_by_name(const LEX_CSTRING &name) const override + { + /* + Name resolution is not needed yet. + JSON is not fully pluggable at the moment: + - It is parsed using a hard-coded rule in sql_yacc.yy + - It does not store extended data type information into + FRM file yet. JSON is detected by CHECK(JSON_VALID(col)) + and this detection is also hard-coded. + This will change in the future. + */ + return NULL; + } +}; + + +const Type_collection *Type_handler_json_common::type_collection() { - if (!c->check_constraint && - !(c->check_constraint= make_json_valid_expr(thd, &c->field_name))) - return true; - return Type_handler::Column_definition_validate_check_constraint(thd, c); + static Type_collection_json type_collection_json; + return &type_collection_json; } diff --git a/sql/sql_type_json.h b/sql/sql_type_json.h index 6c4ee8cb2eb8e..b7fe5c8aa64a3 100644 --- a/sql/sql_type_json.h +++ b/sql/sql_type_json.h @@ -1,7 +1,7 @@ #ifndef SQL_TYPE_JSON_INCLUDED #define SQL_TYPE_JSON_INCLUDED /* - Copyright (c) 2019, MariaDB + Copyright (c) 2019, 2021 MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -21,18 +21,145 @@ #include "mariadb.h" #include "sql_type.h" -class Type_handler_json_longtext: public Type_handler_long_blob + +class Type_handler_json_common +{ +public: + static Virtual_column_info *make_json_valid_expr(THD *thd, + const LEX_CSTRING *field_name); + static bool make_json_valid_expr_if_needed(THD *thd, Column_definition *c); + static bool set_format_name(Send_field_extended_metadata *to) + { + static const Lex_cstring fmt(STRING_WITH_LEN("json")); + return to->set_format_name(fmt); + } + static const Type_handler *json_type_handler(uint max_octet_length); + static const Type_handler *json_blob_type_handler_by_length_bytes(uint len); + static const Type_handler *json_type_handler_sum(const Item_sum *sum); + static const Type_handler *json_type_handler_from_generic(const Type_handler *th); + static bool has_json_valid_constraint(const Field *field); + static const Type_collection *type_collection(); + static bool is_json_type_handler(const Type_handler *handler) + { + return handler->type_collection() == type_collection(); + } +}; + + +template &thbase> +class Type_handler_general_purpose_string_to_json: + public BASE, + public Type_handler_json_common { - Virtual_column_info *make_json_valid_expr(THD *thd, - const LEX_CSTRING *field_name) - const; public: - virtual ~Type_handler_json_longtext() {} + const Type_handler *type_handler_base() const override + { + return &thbase; + } + const Type_collection *type_collection() const override + { + return Type_handler_json_common::type_collection(); + } bool Column_definition_validate_check_constraint(THD *thd, - Column_definition *c) const; + Column_definition *c) + const override + { + return make_json_valid_expr_if_needed(thd, c) || + BASE::Column_definition_validate_check_constraint(thd, c); + } + bool Column_definition_data_type_info_image(Binary_string *to, + const Column_definition &def) + const override + { + /* + Override the inherited method to avoid JSON type handlers writing any + extended metadata to FRM. JSON type handlers are currently detected + only by CHECK(JSON_VALID()) constraint. This may change in the future + to do write extended metadata to FRM, for more reliable detection. + */ + return false; + } + + bool Item_append_extended_type_info(Send_field_extended_metadata *to, + const Item *item) const override + { + return set_format_name(to); // Send "format=json" in the protocol + } + + bool Item_hybrid_func_fix_attributes(THD *thd, + const LEX_CSTRING &name, + Type_handler_hybrid_field_type *hybrid, + Type_all_attributes *attr, + Item **items, uint nitems) + const override + { + if (BASE::Item_hybrid_func_fix_attributes(thd, name, hybrid, attr, + items, nitems)) + return true; + /* + The above call can change the type handler on "hybrid", e.g. + choose a proper BLOB type handler according to the calculated max_length. + Convert general purpose string type handler to its JSON counterpart. + This makes hybrid functions preserve JSON data types, e.g.: + COALESCE(json_expr1, json_expr2) -> JSON + */ + hybrid->set_handler(json_type_handler_from_generic(hybrid->type_handler())); + return false; + } }; + +class Type_handler_string_json: + public Type_handler_general_purpose_string_to_json +{ }; + + +class Type_handler_varchar_json: + public Type_handler_general_purpose_string_to_json +{ }; + +class Type_handler_tiny_blob_json: + public Type_handler_general_purpose_string_to_json +{ }; + +class Type_handler_blob_json: + public Type_handler_general_purpose_string_to_json +{ }; + + +class Type_handler_medium_blob_json: + public Type_handler_general_purpose_string_to_json +{ }; + +class Type_handler_long_blob_json: + public Type_handler_general_purpose_string_to_json +{ }; + + + +extern MYSQL_PLUGIN_IMPORT + Named_type_handler type_handler_string_json; + +extern MYSQL_PLUGIN_IMPORT + Named_type_handler type_handler_varchar_json; + extern MYSQL_PLUGIN_IMPORT - Type_handler_json_longtext type_handler_json_longtext; + Named_type_handler type_handler_tiny_blob_json; + +extern MYSQL_PLUGIN_IMPORT + Named_type_handler type_handler_blob_json; + +extern MYSQL_PLUGIN_IMPORT + Named_type_handler type_handler_medium_blob_json; + +extern MYSQL_PLUGIN_IMPORT + Named_type_handler type_handler_long_blob_json; + #endif // SQL_TYPE_JSON_INCLUDED diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index b55bbc7ffac66..02f068e9bbcaa 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -620,7 +620,7 @@ int mysql_create_function(THD *thd,udf_func *udf) /* Allow creation of functions even if we can't open func table */ if (unlikely(!table)) - goto err; + goto err_open_func_table; table->use_all_columns(); restore_record(table, s->default_values); // Default values for fields table->field[0]->store(u_d->name.str, u_d->name.length, system_charset_info); @@ -634,7 +634,7 @@ int mysql_create_function(THD *thd,udf_func *udf) { my_error(ER_ERROR_ON_WRITE, MYF(0), "mysql.func", error); del_udf(u_d); - goto err; + goto err_open_func_table; } done: @@ -649,6 +649,7 @@ int mysql_create_function(THD *thd,udf_func *udf) err: if (new_dl) dlclose(dl); +err_open_func_table: mysql_rwlock_unlock(&THR_LOCK_udf); DBUG_RETURN(1); } diff --git a/sql/sql_union.cc b/sql/sql_union.cc index a0f60532f32f2..f88f515f0d208 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -251,7 +251,27 @@ bool select_unit::send_eof() int select_union_recursive::send_data(List &values) { - int rc= select_unit::send_data(values); + + int rc; + bool save_abort_on_warning= thd->abort_on_warning; + enum_check_fields save_count_cuted_fields= thd->count_cuted_fields; + long save_counter; + + /* + For recursive CTE's give warnings for wrong field info + However, we don't do that for CREATE TABLE ... SELECT or INSERT ... SELECT + as the upper level code for these handles setting of abort_on_warning + depending on if 'IGNORE' is used. + */ + if (thd->lex->sql_command != SQLCOM_CREATE_TABLE && + thd->lex->sql_command != SQLCOM_INSERT_SELECT) + thd->abort_on_warning= thd->is_strict_mode(); + thd->count_cuted_fields= CHECK_FIELD_WARN; + save_counter= thd->get_stmt_da()->set_current_row_for_warning(++row_counter); + rc= select_unit::send_data(values); + thd->get_stmt_da()->set_current_row_for_warning(save_counter); + thd->count_cuted_fields= save_count_cuted_fields; + thd->abort_on_warning= save_abort_on_warning; if (rc == 0 && write_err != HA_ERR_FOUND_DUPP_KEY && @@ -324,6 +344,7 @@ select_unit::create_result_table(THD *thd_arg, List *column_types, DBUG_ASSERT(table == 0); tmp_table_param.init(); tmp_table_param.field_count= column_types->elements; + tmp_table_param.func_count= tmp_table_param.field_count; tmp_table_param.bit_fields_as_long= bit_fields_as_long; tmp_table_param.hidden_field_count= hidden; @@ -364,7 +385,8 @@ select_union_recursive::create_result_table(THD *thd_arg, return true; incr_table_param.init(); - incr_table_param.field_count= column_types->elements; + incr_table_param.field_count= incr_table_param.func_count= + column_types->elements; incr_table_param.bit_fields_as_long= bit_fields_as_long; if (! (incr_table= create_tmp_table(thd_arg, &incr_table_param, *column_types, (ORDER*) 0, false, 1, @@ -918,6 +940,7 @@ void select_union_recursive::cleanup() thd->rec_tables= tab; tbl->derived_result= 0; } + row_counter= 0; } @@ -1054,15 +1077,6 @@ st_select_lex_unit::init_prepare_fake_select_lex(THD *thd_arg, order= order->next) order->item= &order->item_ptr; } - for (ORDER *order= global_parameters()->order_list.first; - order; - order=order->next) - { - (*order->item)->walk(&Item::change_context_processor, 0, - &fake_select_lex->context); - (*order->item)->walk(&Item::set_fake_select_as_master_processor, 0, - fake_select_lex); - } } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 539bea958e85a..7dfde55ec7cbb 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2011, 2021, MariaDB + Copyright (c) 2011, 2022, 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 @@ -370,7 +370,8 @@ int mysql_update(THD *thd, ha_rows *found_return, ha_rows *updated_return) { bool using_limit= limit != HA_POS_ERROR; - bool safe_update= thd->variables.option_bits & OPTION_SAFE_UPDATES; + bool safe_update= (thd->variables.option_bits & OPTION_SAFE_UPDATES) + && !thd->lex->describe; bool used_key_is_modified= FALSE, transactional_table; bool will_batch= FALSE; bool can_compare_record; @@ -426,7 +427,7 @@ int mysql_update(THD *thd, DBUG_ASSERT(update_source_table || table_list->view != 0); DBUG_PRINT("info", ("Switch to multi-update")); /* pass counter value */ - thd->lex->table_count= table_count; + thd->lex->table_count_update= table_count; if (thd->lex->period_conditions.is_set()) { my_error(ER_NOT_SUPPORTED_YET, MYF(0), @@ -522,6 +523,10 @@ int mysql_update(THD *thd, DBUG_RETURN(1); /* purecov: inspected */ } + if (table_list->table->check_assignability_explicit_fields(fields, values, + ignore)) + DBUG_RETURN(true); + if (check_unique_table(thd, table_list)) DBUG_RETURN(TRUE); @@ -597,7 +602,7 @@ int mysql_update(THD *thd, } /* If running in safe sql mode, don't allow updates without keys */ - if (table->opt_range_keys.is_clear_all()) + if (!select || !select->quick) { thd->set_status_no_index_used(); if (safe_update && !using_limit) @@ -1379,7 +1384,8 @@ int mysql_update(THD *thd, goto err; emit_explain_and_leave: - int err2= thd->lex->explain->send_explain(thd); + bool extended= thd->lex->describe & DESCRIBE_EXTENDED; + int err2= thd->lex->explain->send_explain(thd, extended); delete select; free_underlaid_joins(thd, select_lex); @@ -1453,6 +1459,8 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list, select_lex->fix_prepare_information(thd, conds, &fake_conds); + if (!thd->lex->upd_del_where) + thd->lex->upd_del_where= *conds; DBUG_RETURN(FALSE); } @@ -1857,7 +1865,7 @@ int mysql_multi_update_prepare(THD *thd) TABLE_LIST *table_list= lex->query_tables; TABLE_LIST *tl; Multiupdate_prelocking_strategy prelocking_strategy; - uint table_count= lex->table_count; + uint table_count= lex->table_count_update; DBUG_ENTER("mysql_multi_update_prepare"); /* @@ -1980,7 +1988,10 @@ bool mysql_multi_update(THD *thd, TABLE_LIST *table_list, List *fields, else { if (thd->lex->describe || thd->lex->analyze_stmt) - res= thd->lex->explain->send_explain(thd); + { + bool extended= thd->lex->describe & DESCRIBE_EXTENDED; + res= thd->lex->explain->send_explain(thd, extended); + } } thd->abort_on_warning= 0; DBUG_RETURN(res); @@ -2081,7 +2092,9 @@ int multi_update::prepare(List ¬_used_values, */ int error= setup_fields(thd, Ref_ptr_array(), - *values, MARK_COLUMNS_READ, 0, NULL, 0); + *values, MARK_COLUMNS_READ, 0, NULL, 0) || + TABLE::check_assignability_explicit_fields(*fields, *values, + ignore); ti.rewind(); while ((table_ref= ti++)) @@ -2122,10 +2135,9 @@ int multi_update::prepare(List ¬_used_values, if (!tl) DBUG_RETURN(1); update.link_in_list(tl, &tl->next_local); - tl->shared= table_count++; + table_ref->shared= tl->shared= table_count++; table->no_keyread=1; table->covering_keys.clear_all(); - table->pos_in_table_list= tl; table->prepare_triggers_for_update_stmt_or_event(); table->reset_default_fields(); } @@ -2295,6 +2307,11 @@ multi_update::initialize_tables(JOIN *join) if (unlikely((thd->variables.option_bits & OPTION_SAFE_UPDATES) && error_if_full_join(join))) DBUG_RETURN(1); + if (join->implicit_grouping) + { + my_error(ER_INVALID_GROUP_FUNC_USE, MYF(0)); + DBUG_RETURN(1); + } main_table=join->join_tab->table; table_to_update= 0; diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 20ac4b086bb47..a4da5c48b6dda 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -100,7 +100,8 @@ static void make_unique_view_field_name(THD *thd, Item *target, itc.rewind(); } - target->orig_name= target->name.str; + if (!target->orig_name) + target->orig_name= target->name.str; target->set_name(thd, buff, name_len, system_charset_info); } @@ -305,7 +306,8 @@ bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view, { my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), "ANY", thd->security_ctx->priv_user, - thd->security_ctx->priv_host, tbl->table_name.str); + thd->security_ctx->priv_host, + tbl->db.str, tbl->table_name.str); goto err; } /* @@ -412,8 +414,18 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, bool res= FALSE; DBUG_ENTER("mysql_create_view"); - /* This is ensured in the parser. */ - DBUG_ASSERT(!lex->proc_list.first && !lex->result && + /* + This is ensured in the parser. + NOTE: Originally, the assert below contained the extra condition + && !lex->result + but in this form the assert is failed in case CREATE VIEW run under + cursor (the case when the byte 'flags' in the COM_STMT_EXECUTE packet has + the flag CURSOR_TYPE_READ_ONLY set). For the cursor use case + thd->lex->result is assigned a pointer to the class Select_materialize + inside the function mysql_open_cursor() just before handling of a statement + will be started and the function mysql_create_view() called. + */ + DBUG_ASSERT(!lex->proc_list.first && !lex->param_list.elements); bzero(&ddl_log_state, sizeof(ddl_log_state)); @@ -688,11 +700,9 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, if (lex->view_list.elements) { List_iterator_fast names(lex->view_list); - LEX_CSTRING *name; - int i; - + buff.append('('); - for (i= 0; (name= names++); i++) + while (LEX_CSTRING *name= names++) { append_identifier(thd, &buff, name); buff.append(", ", 2); @@ -825,7 +835,7 @@ static File_option view_parameters[]= my_offsetof(TABLE_LIST, with_check), FILE_OPTIONS_ULONGLONG}, {{ STRING_WITH_LEN("timestamp")}, - my_offsetof(TABLE_LIST, timestamp), + my_offsetof(TABLE_LIST, hr_timestamp), FILE_OPTIONS_TIMESTAMP}, {{ STRING_WITH_LEN("create-version")}, my_offsetof(TABLE_LIST, file_version), @@ -849,6 +859,15 @@ static File_option view_parameters[]= FILE_OPTIONS_STRING} }; + +static File_option view_timestamp_parameters[]= +{ + + {{ C_STRING_WITH_LEN("timestamp")}, 0, FILE_OPTIONS_TIMESTAMP}, + {{NullS, 0}, 0, FILE_OPTIONS_STRING} +}; + + static LEX_CSTRING view_file_type[]= {{STRING_WITH_LEN("VIEW") }}; @@ -866,8 +885,8 @@ int mariadb_fix_view(THD *thd, TABLE_LIST *view, bool wrong_checksum, &path, path_buff, sizeof(path_buff), &file, view); /* init timestamp */ - if (!view->timestamp.str) - view->timestamp.str= view->timestamp_buffer; + if (!view->hr_timestamp.str) + view->hr_timestamp.str= view->timestamp_buffer; if (swap_alg && view->algorithm != VIEW_ALGORITHM_UNDEFINED) { @@ -882,13 +901,13 @@ int mariadb_fix_view(THD *thd, TABLE_LIST *view, bool wrong_checksum, swap_alg= 0; if (wrong_checksum) { - if (view->md5.length != 32) + if (view->md5.length != VIEW_MD5_LEN) { - if ((view->md5.str= (char *)thd->alloc(32 + 1)) == NULL) + if ((view->md5.str= (char *)thd->alloc(VIEW_MD5_LEN + 1)) == NULL) DBUG_RETURN(HA_ADMIN_FAILED); } view->calc_md5(const_cast(view->md5.str)); - view->md5.length= 32; + view->md5.length= VIEW_MD5_LEN; } view->mariadb_version= MYSQL_VERSION_ID; @@ -987,10 +1006,12 @@ static int mysql_register_view(THD *thd, DDL_LOG_STATE *ddl_log_state, Sql_mode_instant_remove sms(thd, MODE_ANSI_QUOTES); lex->unit.print(&view_query, enum_query_type(QT_VIEW_INTERNAL | - QT_ITEM_ORIGINAL_FUNC_NULLIF)); + QT_ITEM_ORIGINAL_FUNC_NULLIF | + QT_NO_WRAPPERS_FOR_TVC_IN_VIEW)); lex->unit.print(&is_query, enum_query_type(QT_TO_SYSTEM_CHARSET | QT_WITHOUT_INTRODUCERS | - QT_ITEM_ORIGINAL_FUNC_NULLIF)); + QT_ITEM_ORIGINAL_FUNC_NULLIF | + QT_NO_WRAPPERS_FOR_TVC_IN_VIEW)); } DBUG_PRINT("info", ("View: %.*s", view_query.length(), view_query.ptr())); @@ -1012,13 +1033,13 @@ static int mysql_register_view(THD *thd, DDL_LOG_STATE *ddl_log_state, view->file_version= 2; view->mariadb_version= MYSQL_VERSION_ID; view->calc_md5(md5); - if (!(view->md5.str= (char*) thd->memdup(md5, 32))) + if (!(view->md5.str= (char*) thd->memdup(md5, VIEW_MD5_LEN))) { my_error(ER_OUT_OF_RESOURCES, MYF(0)); error= -1; goto err; } - view->md5.length= 32; + view->md5.length= VIEW_MD5_LEN; can_be_merged= lex->can_be_merged(); if (lex->create_view->algorithm == VIEW_ALGORITHM_MERGE && !lex->can_be_merged()) @@ -1069,8 +1090,8 @@ static int mysql_register_view(THD *thd, DDL_LOG_STATE *ddl_log_state, &path, path_buff, sizeof(path_buff), &file, view); /* init timestamp */ - if (!view->timestamp.str) - view->timestamp.str= view->timestamp_buffer; + if (!view->hr_timestamp.str) + view->hr_timestamp.str= view->timestamp_buffer; /* check old .frm */ { @@ -1215,7 +1236,39 @@ static int mysql_register_view(THD *thd, DDL_LOG_STATE *ddl_log_state, DBUG_RETURN(error); } +/** + Reads view definition "version" + + @param[in] share Share object of view + @return true on error, otherwise false +*/ + +bool mariadb_view_version_get(TABLE_SHARE *share) +{ + DBUG_ASSERT(share->is_view); + DBUG_ASSERT(share->tabledef_version.length == 0); + + if (!(share->tabledef_version.str= + (uchar*) alloc_root(&share->mem_root, + MICROSECOND_TIMESTAMP_BUFFER_SIZE))) + return TRUE; + + DBUG_ASSERT(share->view_def != NULL); + if (share->view_def->parse((uchar *) &share->tabledef_version, NULL, + view_timestamp_parameters, 1, + &file_parser_dummy_hook)) + { + // safety if the definition file is brocken + share->tabledef_version.length= 0; + my_error(ER_TABLE_CORRUPT, MYF(0), + share->db.str, share->table_name.str); + return TRUE; + } + DBUG_ASSERT(share->tabledef_version.length == MICROSECOND_TIMESTAMP_BUFFER_SIZE-1); + + return FALSE; +} /** read VIEW .frm and create structures @@ -1278,6 +1331,7 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table, mysql_handle_single_derived(thd->lex, table, DT_REINIT); DEBUG_SYNC(thd, "after_cached_view_opened"); + DBUG_ASSERT(share->tabledef_version.length); DBUG_RETURN(0); } @@ -1314,8 +1368,8 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table, arena= thd->activate_stmt_arena_if_needed(&backup); /* init timestamp */ - if (!table->timestamp.str) - table->timestamp.str= table->timestamp_buffer; + if (!table->hr_timestamp.str) + table->hr_timestamp.str= table->timestamp_buffer; /* prepare default values for old format */ table->view_suid= TRUE; table->definer.user.str= table->definer.host.str= 0; @@ -1331,6 +1385,11 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table, required_view_parameters, &file_parser_dummy_hook))) goto end; + DBUG_ASSERT(share->tabledef_version.length); + if (!table->tabledef_version.length) + { + table->set_view_def_version(&table->hr_timestamp); + } /* check old format view .frm @@ -1749,7 +1808,7 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table, if (view_is_mergeable && (table->select_lex->master_unit() != &old_lex->unit || old_lex->can_use_merged()) && - !old_lex->can_not_use_merged(0)) + !old_lex->can_not_use_merged()) { /* lex should contain at least one table */ DBUG_ASSERT(view_main_select_tables != 0); @@ -1782,8 +1841,11 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table, */ if (!table->select_lex->master_unit()->is_unit_op() && table->select_lex->order_list.elements == 0) + { table->select_lex->order_list. push_back(&lex->first_select_lex()->order_list); + lex->first_select_lex()->order_list.empty(); + } else { if (old_lex->sql_command == SQLCOM_SELECT && @@ -2187,10 +2249,10 @@ bool insert_view_fields(THD *thd, List *list, TABLE_LIST *view) int view_checksum(THD *thd, TABLE_LIST *view) { char md5[MD5_BUFF_LENGTH]; - if (!view->view || view->md5.length != 32) + if (!view->view || view->md5.length != VIEW_MD5_LEN) return HA_ADMIN_NOT_IMPLEMENTED; view->calc_md5(md5); - return (strncmp(md5, view->md5.str, 32) ? + return (strncmp(md5, view->md5.str, VIEW_MD5_LEN) ? HA_ADMIN_WRONG_CHECKSUM : HA_ADMIN_OK); } @@ -2295,7 +2357,7 @@ mysql_rename_view(THD *thd, object for it. */ view_def.reset(); - view_def.timestamp.str= view_def.timestamp_buffer; + view_def.hr_timestamp.str= view_def.timestamp_buffer; view_def.view_suid= TRUE; /* get view definition and source */ diff --git a/sql/sql_view.h b/sql/sql_view.h index 536b5f1b78418..1b880e43eb143 100644 --- a/sql/sql_view.h +++ b/sql/sql_view.h @@ -66,4 +66,6 @@ extern const LEX_CSTRING view_type; void make_valid_column_names(List &item_list); +bool mariadb_view_version_get(TABLE_SHARE *share); + #endif /* SQL_VIEW_INCLUDED */ diff --git a/sql/sql_window.cc b/sql/sql_window.cc index 17920519b4127..3e94dfbe6b9cb 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2016, 2017 MariaDB + Copyright (c) 2016, 2022 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 @@ -424,16 +424,49 @@ ORDER *st_select_lex::find_common_window_func_partition_fields(THD *thd) #define CMP_GT 2 // Greater then static -int compare_order_elements(ORDER *ord1, ORDER *ord2) +int compare_order_elements(ORDER *ord1, int weight1, + ORDER *ord2, int weight2) { if (*ord1->item == *ord2->item && ord1->direction == ord2->direction) return CMP_EQ; Item *item1= (*ord1->item)->real_item(); Item *item2= (*ord2->item)->real_item(); - DBUG_ASSERT(item1->type() == Item::FIELD_ITEM && - item2->type() == Item::FIELD_ITEM); - int cmp= ((Item_field *) item1)->field->field_index - - ((Item_field *) item2)->field->field_index; + + bool item1_field= (item1->type() == Item::FIELD_ITEM); + bool item2_field= (item2->type() == Item::FIELD_ITEM); + + ptrdiff_t cmp; + if (item1_field && item2_field) + { + DBUG_ASSERT(((Item_field *) item1)->field->table == + ((Item_field *) item2)->field->table); + cmp= ((Item_field *) item1)->field->field_index - + ((Item_field *) item2)->field->field_index; + } + else if (item1_field && !item2_field) + return CMP_LT; + else if (!item1_field && item2_field) + return CMP_LT; + else + { + /* + Ok, item1_field==NULL and item2_field==NULL. + We're not able to compare Item expressions. Order them according to + their passed "weight" (which comes from Window_spec::win_spec_number): + */ + if (weight1 != weight2) + cmp= weight1 - weight2; + else + { + /* + The weight is the same. That is, the elements come from the same + window specification... This shouldn't happen. + */ + DBUG_ASSERT(0); + cmp= item1 - item2; + } + } + if (cmp == 0) { if (ord1->direction == ord2->direction) @@ -446,7 +479,9 @@ int compare_order_elements(ORDER *ord1, ORDER *ord2) static int compare_order_lists(SQL_I_List *part_list1, - SQL_I_List *part_list2) + int spec_number1, + SQL_I_List *part_list2, + int spec_number2) { if (part_list1 == part_list2) return CMP_EQ; @@ -471,7 +506,8 @@ int compare_order_lists(SQL_I_List *part_list1, if (!elem1 || !elem2) break; - if ((cmp= compare_order_elements(elem1, elem2))) + if ((cmp= compare_order_elements(elem1, spec_number1, + elem2, spec_number2))) return cmp; } if (elem1) @@ -566,7 +602,9 @@ int compare_window_spec_joined_lists(Window_spec *win_spec1, win_spec1->join_partition_and_order_lists(); win_spec2->join_partition_and_order_lists(); int cmp= compare_order_lists(win_spec1->partition_list, - win_spec2->partition_list); + win_spec1->win_spec_number, + win_spec2->partition_list, + win_spec2->win_spec_number); win_spec1->disjoin_partition_and_order_lists(); win_spec2->disjoin_partition_and_order_lists(); return cmp; @@ -584,7 +622,9 @@ int compare_window_funcs_by_window_specs(Item_window_func *win_func1, if (win_spec1 == win_spec2) return CMP_EQ; cmp= compare_order_lists(win_spec1->partition_list, - win_spec2->partition_list); + win_spec1->win_spec_number, + win_spec2->partition_list, + win_spec2->win_spec_number); if (cmp == CMP_EQ) { /* @@ -603,7 +643,9 @@ int compare_window_funcs_by_window_specs(Item_window_func *win_func1, } cmp= compare_order_lists(win_spec1->order_list, - win_spec2->order_list); + win_spec1->win_spec_number, + win_spec2->order_list, + win_spec2->win_spec_number); if (cmp != CMP_EQ) return cmp; @@ -696,7 +738,9 @@ void order_window_funcs_by_window_specs(List *win_func_list) int cmp; if (win_spec_prev->partition_list == win_spec_curr->partition_list) cmp= compare_order_lists(win_spec_prev->order_list, - win_spec_curr->order_list); + win_spec_prev->win_spec_number, + win_spec_curr->order_list, + win_spec_curr->win_spec_number); else cmp= compare_window_spec_joined_lists(win_spec_prev, win_spec_curr); if (!(CMP_LT_C <= cmp && cmp <= CMP_GT_C)) @@ -900,7 +944,7 @@ class Rowid_seq_cursor class Table_read_cursor : public Rowid_seq_cursor { public: - virtual ~Table_read_cursor() {} + virtual ~Table_read_cursor() = default; void init(READ_RECORD *info) { @@ -1084,7 +1128,7 @@ class Frame_cursor : public Sql_alloc virtual bool is_outside_computation_bounds() const { return false; }; - virtual ~Frame_cursor() {} + virtual ~Frame_cursor() = default; /* Regular frame cursors add or remove values from the sum functions they diff --git a/sql/sql_window.h b/sql/sql_window.h index 5e76a33dcd0cd..1c02740e7697b 100644 --- a/sql/sql_window.h +++ b/sql/sql_window.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2016, 2017 MariaDB + Copyright (c) 2016, 2022 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 @@ -106,7 +106,7 @@ class Window_spec : public Sql_alloc { bool window_names_are_checked; public: - virtual ~Window_spec() {} + virtual ~Window_spec() = default; LEX_CSTRING *window_ref; @@ -120,10 +120,15 @@ class Window_spec : public Sql_alloc Window_spec *referenced_win_spec; - Window_spec(LEX_CSTRING *win_ref, - SQL_I_List *part_list, - SQL_I_List *ord_list, - Window_frame *win_frame) + /* + Window_spec objects are numbered by the number of their appearance in the + query. This is used by compare_order_elements() to provide a predictable + ordering of PARTITION/ORDER BY clauses. + */ + int win_spec_number; + + Window_spec(LEX_CSTRING *win_ref, SQL_I_List *part_list, + SQL_I_List *ord_list, Window_frame *win_frame) : window_names_are_checked(false), window_ref(win_ref), partition_list(part_list), save_partition_list(NULL), order_list(ord_list), save_order_list(NULL), diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 8ebefbb3d8275..b6ab30cc86d9f 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2021, MariaDB + Copyright (c) 2010, 2023, 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 @@ -200,17 +200,6 @@ void _CONCAT_UNDERSCORED(turn_parser_debug_on,yyparse)() MYSQL_YYABORT; \ } while(0) -#define set_collation(X) \ - do { \ - if (X) \ - { \ - if (unlikely(Lex->charset && !my_charset_same(Lex->charset,X))) \ - my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0), \ - X->coll_name.str,Lex->charset->cs_name.str)); \ - Lex->charset= X; \ - } \ - } while(0) - %} %union { @@ -237,6 +226,7 @@ void _CONCAT_UNDERSCORED(turn_parser_debug_on,yyparse)() Lex_for_loop_bounds_st for_loop_bounds; Lex_trim_st trim; Json_table_column::On_response json_on_response; + Lex_substring_spec_st substring_spec; vers_history_point_t vers_history_point; struct { @@ -301,6 +291,7 @@ void _CONCAT_UNDERSCORED(turn_parser_debug_on,yyparse)() class With_element_head *with_element_head; class With_clause *with_clause; class Virtual_column_info *virtual_column; + engine_option_value *engine_option_value_ptr; handlerton *db_type; st_select_lex *select_lex; @@ -360,12 +351,11 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); */ %ifdef MARIADB -%expect 67 +%expect 64 %else -%expect 69 +%expect 65 %endif - /* Comments for TOKENS. For each token, please include in the same line a comment that contains @@ -393,6 +383,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); */ %token ABORT_SYM /* INTERNAL (used in lex) */ %token IMPOSSIBLE_ACTION /* To avoid warning for yyerrlab1 */ +%token FORCE_LOOKAHEAD /* INTERNAL never returned by the lexer */ %token END_OF_INPUT /* INTERNAL */ %token COLON_ORACLE_SYM /* INTERNAL */ %token PARAM_MARKER /* INTERNAL */ @@ -406,7 +397,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); %token WITH_ROLLUP_SYM /* INTERNAL */ %token WITH_SYSTEM_SYM /* INTERNAL */ - /* Identifiers */ @@ -648,7 +638,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); %token RELEASE_SYM /* SQL-2003-R */ %token RENAME %token REPEAT_SYM /* MYSQL-FUNC */ -%token REPLACE /* MYSQL-FUNC */ %token REQUIRE_SYM %token RESIGNAL_SYM /* SQL-2003-R */ %token RESTRICT @@ -685,7 +674,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); %token STDDEV_SAMP_SYM /* SQL-2003-N */ %token STD_SYM %token STRAIGHT_JOIN -%token SUBSTRING /* SQL-2003-N */ %token SUM_SYM /* SQL-2003-N */ %token SYSDATE %token TABLE_REF_PRIORITY @@ -698,7 +686,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); %token TO_SYM /* SQL-2003-R */ %token TRAILING /* SQL-2003-R */ %token TRIGGER_SYM /* SQL-2003-R */ -%token TRIM /* SQL-2003-N */ %token TRUE_SYM /* SQL-2003-R */ %token UNDO_SYM /* FUTURE-USE */ %token UNION_SYM /* SQL-2003-R */ @@ -743,6 +730,14 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); %token ROWTYPE_MARIADB_SYM // PLSQL-R %token ROWNUM_SYM /* Oracle-R */ +/* + SQL functions with a special syntax +*/ +%token REPLACE /* MYSQL-FUNC */ +%token SUBSTRING /* SQL-2003-N */ +%token TRIM /* SQL-2003-N */ + + /* Non-reserved keywords */ @@ -1193,7 +1188,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); %left PREC_BELOW_NOT -%nonassoc NOT_SYM +/* The precendence of boolean NOT is in fact here. See the comment below. */ + %left '=' EQUAL_SYM GE '>' LE '<' NE %nonassoc IS %right BETWEEN_SYM @@ -1205,6 +1201,24 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); %left '*' '/' '%' DIV_SYM MOD_SYM %left '^' %left MYSQL_CONCAT_SYM +/* + Boolean negation has a special branch in "expr" starting with NOT_SYM. + The precedence of logical negation is determined by the grammar itself + (without using Bison terminal symbol precedence) in this order + - Boolean factor (i.e. logical AND) + - Boolean NOT + - Boolean test (such as '=', IS NULL, IS TRUE) + + But we also need a precedence for NOT_SYM in other contexts, + to shift (without reduce) in these cases: + predicate NOT IN ... + predicate NOT BETWEEN ... + predicate NOT LIKE ... + predicate NOT REGEXP ... + If the precedence of NOT_SYM was low, it would reduce immediately + after scanning "predicate" and then produce a syntax error on "NOT". +*/ +%nonassoc NOT_SYM %nonassoc NEG '~' NOT2_SYM BINARY %nonassoc COLLATE_SYM %nonassoc SUBQUERY_AS_EXPR @@ -1257,7 +1271,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); TRANSACTION can be a non-empty history unit, or can be an identifier in bit_expr. - In the grammar below we use %prec to explicitely tell Bison to go + In the grammar below we use %prec to explicitly tell Bison to go through the empty branch in the optional rule only when the lookahead token does not belong to a small set of selected tokens. @@ -1326,6 +1340,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); TEXT_STRING NCHAR_STRING json_text_literal + json_text_literal_or_num %type opt_table_alias_clause @@ -1479,6 +1494,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); literal insert_ident order_ident temporal_literal simple_ident expr sum_expr in_sum_expr variable variable_aux + boolean_test predicate bit_expr parenthesized_expr table_wild simple_expr column_default_non_parenthesized_expr udf_expr primary_expr string_factor_expr mysql_concatenation_expr @@ -1584,6 +1600,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); %type opt_collate + collate charset_name charset_or_alias charset_name_or_default @@ -1748,11 +1765,12 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); %type sp_handler_type sp_hcond_list %type sp_cond sp_hcond sqlstate signal_value opt_signal_value %type sp_name -%type sp_param_name sp_param_name_and_type -%type sp_param_name_and_type_anchored +%type sp_param_name sp_param_name_and_mode sp_param +%type sp_param_anchored %type sp_for_loop_index_and_bounds %type sp_for_loop_bounds %type trim_operands +%type substring_operands %type opt_sp_for_loop_direction %type sp_parameter_type %type index_hint_type @@ -1802,6 +1820,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); %type opt_history_unit %type history_point %type with_or_without_system +%type engine_defined_option; %ifdef MARIADB %type sp_tail_standalone @@ -2372,6 +2391,7 @@ create: lex->create_info.default_table_charset= NULL; lex->name= null_clex_str; lex->create_last_non_select_table= lex->last_table(); + lex->inc_select_stack_outer_barrier(); } create_body { @@ -2528,6 +2548,7 @@ create: { if (Lex->main_select_push()) MYSQL_YYABORT; + Lex->inc_select_stack_outer_barrier(); if (Lex->add_create_view(thd, $1 | $5, DTYPE_ALGORITHM_UNDEFINED, $3, $6)) MYSQL_YYABORT; @@ -2543,6 +2564,7 @@ create: MYSQL_YYABORT; if (Lex->main_select_push()) MYSQL_YYABORT; + Lex->inc_select_stack_outer_barrier(); } view_list_opt AS view_select { @@ -2689,7 +2711,7 @@ sequence_def: if (unlikely(Lex->sql_command != SQLCOM_ALTER_SEQUENCE)) { thd->parse_error(ER_SYNTAX_ERROR, "RESTART"); - YYABORT; + MYSQL_YYABORT; } if (unlikely(Lex->create_info.seq_create_info->used_fields & seq_field_used_restart)) @@ -2701,7 +2723,7 @@ sequence_def: if (unlikely(Lex->sql_command != SQLCOM_ALTER_SEQUENCE)) { thd->parse_error(ER_SYNTAX_ERROR, "RESTART"); - YYABORT; + MYSQL_YYABORT; } if (unlikely(Lex->create_info.seq_create_info->used_fields & seq_field_used_restart)) @@ -2711,6 +2733,9 @@ sequence_def: } ; +/* this rule is used to force look-ahead in the parser */ +force_lookahead: {} | FORCE_LOOKAHEAD {} ; + server_def: SERVER_SYM opt_if_not_exists ident_or_text { @@ -2912,7 +2937,7 @@ ev_sql_stmt: lex->sphead->set_body_start(thd, lip->get_cpp_ptr()); } - sp_proc_stmt + sp_proc_stmt force_lookahead { /* return back to the original memory root ASAP */ if (Lex->sp_body_finalize_event(thd)) @@ -2997,9 +3022,29 @@ sp_suid: ; call: - CALL_SYM sp_name + CALL_SYM ident + { + if (unlikely(Lex->call_statement_start(thd, &$2))) + MYSQL_YYABORT; + } + opt_sp_cparam_list + { + if (Lex->check_cte_dependencies_and_resolve_references()) + MYSQL_YYABORT; + } + | CALL_SYM ident '.' ident { - if (unlikely(Lex->call_statement_start(thd, $2))) + if (unlikely(Lex->call_statement_start(thd, &$2, &$4))) + MYSQL_YYABORT; + } + opt_sp_cparam_list + { + if (Lex->check_cte_dependencies_and_resolve_references()) + MYSQL_YYABORT; + } + | CALL_SYM ident '.' ident '.' ident + { + if (unlikely(Lex->call_statement_start(thd, &$2, &$4, &$6))) MYSQL_YYABORT; } opt_sp_cparam_list @@ -3049,8 +3094,8 @@ sp_fdparam_list: ; sp_fdparams: - sp_fdparams ',' sp_param_name_and_type - | sp_param_name_and_type + sp_fdparams ',' sp_param + | sp_param ; sp_param_name: @@ -3061,20 +3106,6 @@ sp_param_name: } ; -sp_param_name_and_type: - sp_param_name field_type - { - if (unlikely(Lex->sp_param_fill_definition($$= $1, $2))) - MYSQL_YYABORT; - } - | sp_param_name ROW_SYM row_type_body - { - if (unlikely(Lex->sphead->spvar_fill_row(thd, $$= $1, $3))) - MYSQL_YYABORT; - } - | sp_param_name_and_type_anchored - ; - /* Stored PROCEDURE parameter declaration list */ sp_pdparam_list: /* Empty */ @@ -3082,8 +3113,8 @@ sp_pdparam_list: ; sp_pdparams: - sp_pdparams ',' sp_pdparam - | sp_pdparam + sp_pdparams ',' sp_param + | sp_param ; sp_parameter_type: @@ -3560,7 +3591,7 @@ simple_target_specification: if (!$2.length) { thd->parse_error(); - YYABORT; + MYSQL_YYABORT; } $$= new (thd->mem_root) Item_func_get_user_var(thd, &$2); if (unlikely($$ == NULL)) @@ -4799,13 +4830,17 @@ opt_part_values: part_values_in {} | CURRENT_SYM { +#ifdef WITH_PARTITION_STORAGE_ENGINE if (Lex->part_values_current(thd)) MYSQL_YYABORT; +#endif } | HISTORY_SYM { +#ifdef WITH_PARTITION_STORAGE_ENGINE if (Lex->part_values_history(thd)) MYSQL_YYABORT; +#endif } | DEFAULT { @@ -5040,7 +5075,7 @@ sub_part_definition: part_info->use_default_num_subpartitions= FALSE; part_info->count_curr_subparts++; } - sub_name opt_part_options {} + sub_name opt_subpart_options {} ; sub_name: @@ -5054,15 +5089,34 @@ sub_name: opt_part_options: /* empty */ {} - | opt_part_option_list {} + | part_option_list {} + ; + +part_option_list: + part_option_list part_option {} + | part_option {} + ; + +part_option: + server_part_option {} + | engine_defined_option + { + $1->link(&Lex->part_info->curr_part_elem->option_list, + &Lex->option_list_last); + } + ; + +opt_subpart_options: + /* empty */ {} + | subpart_option_list {} ; -opt_part_option_list: - opt_part_option_list opt_part_option {} - | opt_part_option {} +subpart_option_list: + subpart_option_list server_part_option {} + | server_part_option {} ; -opt_part_option: +server_part_option: TABLESPACE opt_equal ident_or_text { /* Compatibility with MySQL */ } | opt_storage ENGINE_SYM opt_equal storage_engines @@ -5093,11 +5147,12 @@ opt_part_option: opt_versioning_rotation: /* empty */ {} - | INTERVAL_SYM expr interval opt_versioning_interval_start + | { Lex->clause_that_disallows_subselect= "INTERVAL"; } + INTERVAL_SYM expr interval opt_versioning_interval_start { partition_info *part_info= Lex->part_info; const char *table_name= Lex->create_last_non_select_table->table_name.str; - if (unlikely(part_info->vers_set_interval(thd, $2, $3, $4, table_name))) + if (unlikely(part_info->vers_set_interval(thd, $3, $4, $5, table_name))) MYSQL_YYABORT; } | LIMIT ulonglong_num @@ -5424,42 +5479,43 @@ create_table_option: Lex->create_info.used_fields|= HA_CREATE_USED_TRANSACTIONAL; Lex->create_info.transactional= $3; } - | IDENT_sys equal TEXT_STRING_sys + | engine_defined_option + { + $1->link(&Lex->create_info.option_list, &Lex->option_list_last); + } + | SEQUENCE_SYM opt_equal choice + { + Lex->create_info.used_fields|= HA_CREATE_USED_SEQUENCE; + Lex->create_info.sequence= ($3 == HA_CHOICE_YES); + } + | versioning_option + ; + +engine_defined_option: + IDENT_sys equal TEXT_STRING_sys { if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH)) my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str)); - (void) new (thd->mem_root) - engine_option_value($1, $3, true, - &Lex->create_info.option_list, - &Lex->option_list_last); + $$= new (thd->mem_root) engine_option_value($1, $3, true); + MYSQL_YYABORT_UNLESS($$); } | IDENT_sys equal ident { if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH)) my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str)); - (void) new (thd->mem_root) - engine_option_value($1, $3, false, - &Lex->create_info.option_list, - &Lex->option_list_last); + $$= new (thd->mem_root) engine_option_value($1, $3, false); + MYSQL_YYABORT_UNLESS($$); } | IDENT_sys equal real_ulonglong_num { - (void) new (thd->mem_root) - engine_option_value($1, $3, &Lex->create_info.option_list, - &Lex->option_list_last, thd->mem_root); + $$= new (thd->mem_root) engine_option_value($1, $3, thd->mem_root); + MYSQL_YYABORT_UNLESS($$); } | IDENT_sys equal DEFAULT { - (void) new (thd->mem_root) - engine_option_value($1, &Lex->create_info.option_list, - &Lex->option_list_last); + $$= new (thd->mem_root) engine_option_value($1); + MYSQL_YYABORT_UNLESS($$); } - | SEQUENCE_SYM opt_equal choice - { - Lex->create_info.used_fields|= HA_CREATE_USED_SEQUENCE; - Lex->create_info.sequence= ($3 == HA_CHOICE_YES); - } - | versioning_option ; opt_versioning_option: @@ -5793,7 +5849,6 @@ field_def: | opt_generated_always AS virtual_column_func { Lex->last_field->vcol_info= $3; - Lex->last_field->flags&= ~NOT_NULL_FLAG; // undo automatic NOT NULL for timestamps } vcol_opt_specifier vcol_opt_attribute | opt_generated_always AS ROW_SYM START_SYM opt_asrow_attribute @@ -6159,7 +6214,7 @@ field_type_lob: | JSON_SYM opt_compressed { Lex->charset= &my_charset_utf8mb4_bin; - $$.set(&type_handler_json_longtext); + $$.set(&type_handler_long_blob_json); } ; @@ -6268,7 +6323,11 @@ attribute_list: ; attribute: - NULL_SYM { Lex->last_field->flags&= ~ NOT_NULL_FLAG; } + NULL_SYM + { + Lex->last_field->flags&= ~NOT_NULL_FLAG; + Lex->last_field->explicitly_nullable= true; + } | DEFAULT column_default_expr { Lex->last_field->default_value= $2; } | ON UPDATE_SYM NOW_SYM opt_default_time_precision { @@ -6350,35 +6409,9 @@ asrow_attribute: serial_attribute: asrow_attribute - | IDENT_sys equal TEXT_STRING_sys + | engine_defined_option { - if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH)) - my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str)); - (void) new (thd->mem_root) - engine_option_value($1, $3, true, - &Lex->last_field->option_list, - &Lex->option_list_last); - } - | IDENT_sys equal ident - { - if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH)) - my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str)); - (void) new (thd->mem_root) - engine_option_value($1, $3, false, - &Lex->last_field->option_list, - &Lex->option_list_last); - } - | IDENT_sys equal real_ulonglong_num - { - (void) new (thd->mem_root) - engine_option_value($1, $3, &Lex->last_field->option_list, - &Lex->option_list_last, thd->mem_root); - } - | IDENT_sys equal DEFAULT - { - (void) new (thd->mem_root) - engine_option_value($1, &Lex->last_field->option_list, - &Lex->option_list_last); + $1->link(&Lex->last_field->option_list, &Lex->option_list_last); } | with_or_without_system VERSIONING_SYM { @@ -6486,10 +6519,7 @@ charset_or_alias: } ; -collate: COLLATE_SYM collation_name_or_default - { - Lex->charset= $2; - } +collate: COLLATE_SYM collation_name_or_default { $$= $2; } ; opt_binary: @@ -6504,11 +6534,17 @@ binary: | BINARY charset_or_alias { bincmp_collation($2, true); } | charset_or_alias collate { - if (!my_charset_same(Lex->charset, $1)) - my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0), - Lex->charset->coll_name.str, $1->cs_name.str)); + if (!$2) + Lex->charset= $1; // CHARACTER SET cs COLLATE DEFAULT + else + { + if (!my_charset_same($2, $1)) + my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0), + $2->coll_name.str, $1->cs_name.str)); + Lex->charset= $2; + } } - | collate { } + | collate { Lex->charset= $1; } ; opt_bin_mod: @@ -6781,33 +6817,9 @@ all_key_opt: { Lex->last_key->key_create_info.is_ignored= $1; } - | IDENT_sys equal TEXT_STRING_sys + | engine_defined_option { - if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH)) - my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str)); - (void) new (thd->mem_root) - engine_option_value($1, $3, true, &Lex->option_list, - &Lex->option_list_last); - } - | IDENT_sys equal ident - { - if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH)) - my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str)); - (void) new (thd->mem_root) - engine_option_value($1, $3, false, &Lex->option_list, - &Lex->option_list_last); - } - | IDENT_sys equal real_ulonglong_num - { - (void) new (thd->mem_root) - engine_option_value($1, $3, &Lex->option_list, - &Lex->option_list_last, thd->mem_root); - } - | IDENT_sys equal DEFAULT - { - (void) new (thd->mem_root) - engine_option_value($1, &Lex->option_list, - &Lex->option_list_last); + $1->link(&Lex->option_list, &Lex->option_list_last); } ; @@ -6845,10 +6857,12 @@ ignorability: key_list: key_list ',' key_part order_dir { + $3->asc= $4; Lex->last_key->columns.push_back($3, thd->mem_root); } | key_part order_dir { + $1->asc= $2; Lex->last_key->columns.push_back($1, thd->mem_root); } ; @@ -8656,7 +8670,7 @@ subselect: query_expression { if (!($$= Lex->parsed_subselect($1))) - YYABORT; + MYSQL_YYABORT; } ; @@ -8701,14 +8715,14 @@ subquery: else $1->fake_select_lex->braces= false; if (!($$= Lex->parsed_subselect($1))) - YYABORT; + MYSQL_YYABORT; } | '(' with_clause query_expression_no_with_clause ')' { $3->set_with_clause($2); $2->attach_to($3->first_select()); if (!($$= Lex->parsed_subselect($3))) - YYABORT; + MYSQL_YYABORT; } ; @@ -8922,14 +8936,20 @@ select_item_list: | select_item | '*' { + bool is_parsing_returning= + thd->lex->current_select->parsing_place == + IN_RETURNING; + SELECT_LEX *correct_select= is_parsing_returning ? + thd->lex->returning() : + thd->lex->current_select; Item *item= new (thd->mem_root) - Item_field(thd, &thd->lex->current_select->context, + Item_field(thd, &correct_select->context, star_clex_str); if (unlikely(item == NULL)) MYSQL_YYABORT; if (unlikely(add_item_to_list(thd, item))) MYSQL_YYABORT; - (thd->lex->current_select->with_wild)++; + correct_select->with_wild++; } ; @@ -9106,79 +9126,83 @@ expr: MYSQL_YYABORT; } } - | NOT_SYM expr %prec NOT_SYM + | NOT_SYM expr { $$= negate_expression(thd, $2); if (unlikely($$ == NULL)) MYSQL_YYABORT; } - | expr IS TRUE_SYM %prec IS + | boolean_test %prec PREC_BELOW_NOT + ; + +boolean_test: + boolean_test IS TRUE_SYM %prec IS { $$= new (thd->mem_root) Item_func_istrue(thd, $1); if (unlikely($$ == NULL)) MYSQL_YYABORT; } - | expr IS not TRUE_SYM %prec IS + | boolean_test IS not TRUE_SYM %prec IS { $$= new (thd->mem_root) Item_func_isnottrue(thd, $1); if (unlikely($$ == NULL)) MYSQL_YYABORT; } - | expr IS FALSE_SYM %prec IS + | boolean_test IS FALSE_SYM %prec IS { $$= new (thd->mem_root) Item_func_isfalse(thd, $1); if (unlikely($$ == NULL)) MYSQL_YYABORT; } - | expr IS not FALSE_SYM %prec IS + | boolean_test IS not FALSE_SYM %prec IS { $$= new (thd->mem_root) Item_func_isnotfalse(thd, $1); if (unlikely($$ == NULL)) MYSQL_YYABORT; } - | expr IS UNKNOWN_SYM %prec IS + | boolean_test IS UNKNOWN_SYM %prec IS { $$= new (thd->mem_root) Item_func_isnull(thd, $1); if (unlikely($$ == NULL)) MYSQL_YYABORT; } - | expr IS not UNKNOWN_SYM %prec IS + | boolean_test IS not UNKNOWN_SYM %prec IS { $$= new (thd->mem_root) Item_func_isnotnull(thd, $1); if (unlikely($$ == NULL)) MYSQL_YYABORT; } - | expr IS NULL_SYM %prec PREC_BELOW_NOT + | boolean_test IS NULL_SYM %prec IS { $$= new (thd->mem_root) Item_func_isnull(thd, $1); if (unlikely($$ == NULL)) MYSQL_YYABORT; } - | expr IS not NULL_SYM %prec IS + | boolean_test IS not NULL_SYM %prec IS { $$= new (thd->mem_root) Item_func_isnotnull(thd, $1); if (unlikely($$ == NULL)) MYSQL_YYABORT; } - | expr EQUAL_SYM predicate %prec EQUAL_SYM + | boolean_test EQUAL_SYM predicate %prec EQUAL_SYM { $$= new (thd->mem_root) Item_func_equal(thd, $1, $3); if (unlikely($$ == NULL)) MYSQL_YYABORT; } - | expr comp_op predicate %prec '=' + | boolean_test comp_op predicate %prec '=' { $$= (*$2)(0)->create(thd, $1, $3); if (unlikely($$ == NULL)) MYSQL_YYABORT; } - | expr comp_op all_or_any '(' subselect ')' %prec '=' + | boolean_test comp_op all_or_any '(' subselect ')' %prec '=' { $$= all_any_subquery_creator(thd, $1, $2, $3, $5); if (unlikely($$ == NULL)) MYSQL_YYABORT; } - | predicate + | predicate %prec BETWEEN_SYM ; predicate: @@ -9935,7 +9959,8 @@ function_call_keyword: } | TRIM '(' trim_operands ')' { - if (unlikely(!($$= $3.make_item_func_trim(thd)))) + if (unlikely(!($$= Schema::find_implied(thd)-> + make_item_func_trim(thd, $3)))) MYSQL_YYABORT; } | USER_SYM '(' ')' @@ -9954,6 +9979,26 @@ function_call_keyword: } ; +substring_operands: + expr ',' expr ',' expr + { + $$= Lex_substring_spec_st::init($1, $3, $5); + } + | expr ',' expr + { + $$= Lex_substring_spec_st::init($1, $3); + } + | expr FROM expr FOR_SYM expr + { + $$= Lex_substring_spec_st::init($1, $3, $5); + } + | expr FROM expr + { + $$= Lex_substring_spec_st::init($1, $3); + } + ; + + /* Function calls using non reserved keywords, with special syntaxic forms. Dedicated grammar rules are needed because of the syntax, @@ -10086,24 +10131,10 @@ function_call_nonkeyword: if (unlikely($$ == NULL)) MYSQL_YYABORT; } - | SUBSTRING '(' expr ',' expr ',' expr ')' - { - if (unlikely(!($$= Lex->make_item_func_substr(thd, $3, $5, $7)))) - MYSQL_YYABORT; - } - | SUBSTRING '(' expr ',' expr ')' + | SUBSTRING '(' substring_operands ')' { - if (unlikely(!($$= Lex->make_item_func_substr(thd, $3, $5)))) - MYSQL_YYABORT; - } - | SUBSTRING '(' expr FROM expr FOR_SYM expr ')' - { - if (unlikely(!($$= Lex->make_item_func_substr(thd, $3, $5, $7)))) - MYSQL_YYABORT; - } - | SUBSTRING '(' expr FROM expr ')' - { - if (unlikely(!($$= Lex->make_item_func_substr(thd, $3, $5)))) + if (unlikely(!($$= Schema::find_implied(thd)-> + make_item_func_substr(thd, $3)))) MYSQL_YYABORT; } %ifdef ORACLE @@ -10318,7 +10349,8 @@ function_call_conflict: } | REPLACE '(' expr ',' expr ',' expr ')' { - if (unlikely(!($$= Lex->make_item_func_replace(thd, $3, $5, $7)))) + if (unlikely(!($$= Schema::find_implied(thd)-> + make_item_func_replace(thd, $3, $5, $7)))) MYSQL_YYABORT; } | REVERSE_SYM '(' expr ')' @@ -10495,6 +10527,11 @@ function_call_generic: if (unlikely(!($$= Lex->make_item_func_call_generic(thd, &$1, &$3, $5)))) MYSQL_YYABORT; } + | ident_cli '.' ident_cli '.' ident_cli '(' opt_expr_list ')' + { + if (unlikely(!($$= Lex->make_item_func_call_generic(thd, &$1, &$3, &$5, $7)))) + MYSQL_YYABORT; + } ; fulltext_options: @@ -10776,9 +10813,6 @@ window_func: simple_window_func | sum_expr - { - ((Item_sum *) $1)->mark_as_window_func_sum_expr(); - } | function_call_generic { @@ -10791,8 +10825,6 @@ window_func: thd->parse_error(); MYSQL_YYABORT; } - - ((Item_sum *) $1)->mark_as_window_func_sum_expr(); } ; @@ -10993,7 +11025,7 @@ variable_aux: if (!$1.length) { thd->parse_error(); - YYABORT; + MYSQL_YYABORT; } $$= item= new (thd->mem_root) Item_func_set_user_var(thd, &$1, $3); if (unlikely($$ == NULL)) @@ -11007,7 +11039,7 @@ variable_aux: if (!$1.length) { thd->parse_error(); - YYABORT; + MYSQL_YYABORT; } $$= new (thd->mem_root) Item_func_get_user_var(thd, &$1); if (unlikely($$ == NULL)) @@ -11276,6 +11308,26 @@ json_text_literal: } ; +json_text_literal_or_num: + json_text_literal + | NUM + { + Lex->json_table->m_text_literal_cs= NULL; + } + | LONG_NUM + { + Lex->json_table->m_text_literal_cs= NULL; + } + | DECIMAL_NUM + { + Lex->json_table->m_text_literal_cs= NULL; + } + | FLOAT_NUM + { + Lex->json_table->m_text_literal_cs= NULL; + } + ; + join_table_list: derived_table_list { MYSQL_YYABORT_UNLESS($$=$1); } ; @@ -11351,7 +11403,7 @@ json_table_column_type: Lex->last_field->set_attributes(thd, $1, Lex->charset, COLUMN_DEFINITION_TABLE_FIELD); if (Lex->json_table->m_cur_json_table_column-> - set(thd, Json_table_column::PATH, $3)) + set(thd, Json_table_column::PATH, $3, Lex->charset)) { MYSQL_YYABORT; } @@ -11361,23 +11413,15 @@ json_table_column_type: Lex->last_field->set_attributes(thd, $1, Lex->charset, COLUMN_DEFINITION_TABLE_FIELD); Lex->json_table->m_cur_json_table_column-> - set(thd, Json_table_column::EXISTS_PATH, $4); + set(thd, Json_table_column::EXISTS_PATH, $4, Lex->charset); } ; json_table_field_type: field_type_numeric | field_type_temporal - | field_type_string opt_collate - { - set_collation($2); - Lex->json_table->m_cur_json_table_column->m_explicit_cs= Lex->charset; - } - | field_type_lob opt_collate - { - set_collation($2); - Lex->json_table->m_cur_json_table_column->m_explicit_cs= Lex->charset; - } + | field_type_string + | field_type_lob ; json_opt_on_empty_or_error: @@ -11398,7 +11442,7 @@ json_on_response: { $$.m_response= Json_table_column::RESPONSE_NULL; } - | DEFAULT json_text_literal + | DEFAULT json_text_literal_or_num { $$.m_response= Json_table_column::RESPONSE_DEFAULT; $$.m_default= $2; @@ -12653,7 +12697,7 @@ select_outvar: if (!$2.length) { thd->parse_error(); - YYABORT; + MYSQL_YYABORT; } $$ = Lex->result ? new (thd->mem_root) my_var_user(&$2) : NULL; @@ -12947,6 +12991,7 @@ insert_start: { if (Lex->main_select_push()) MYSQL_YYABORT; mysql_init_select(Lex); + Lex->inc_select_stack_outer_barrier(); Lex->current_select->parsing_place= BEFORE_OPT_LIST; } ; @@ -13322,6 +13367,8 @@ delete_part2: { Lex->last_table()->vers_conditions= Lex->vers_conditions; Lex->pop_select(); //main select + if (Lex->check_main_unit_semantics()) + MYSQL_YYABORT; } ; @@ -13358,6 +13405,8 @@ single_multi: if ($3) Select->order_list= *($3); Lex->pop_select(); //main select + if (Lex->check_main_unit_semantics()) + MYSQL_YYABORT; } | table_wild_list { @@ -13391,19 +13440,33 @@ opt_returning: | RETURNING_SYM { DBUG_ASSERT(!Lex->has_returning()); - if (($$= (Select != Lex->returning()))) - { - SELECT_LEX *sl= Lex->returning(); - sl->set_master_unit(0); - Select->add_slave(Lex->create_unit(sl)); - sl->include_global((st_select_lex_node**)&Lex->all_selects_list); - Lex->push_select(sl); - } + /* + When parsing_place is IN_RETURNING, we push select items to + item_list of builtin_select instead of current_select. + But set parsing_place of current_select to true. + + Because parsing_place for builtin_select will be IN_RETURNING, + regardless there is SELECT in RETURNING. Example, if + there is RETURNING (SELECT...), then when we parse + SELECT inside RETURNING, builtin_select->parsing_place + will still be true. So the select items of SELECT inside + RETURNING will be added to item_list of builtin_select which + is incorrect. We want to prevent this from happening. + Since for every new select, a new SELECT_LEX + object is created and pushed to select stack, current_select + will point to SELECT inside RETURNING, and also has + parsing_place not set to IN_RETURNING by default. + So items are correctly added to item_list of SELECT inside + RETURNING instead of builtin_select. + */ + + thd->lex->current_select->parsing_place= IN_RETURNING; + thd->lex->push_context(&thd->lex->returning()->context); } select_item_list { - if ($2) - Lex->pop_select(); + thd->lex->pop_context(); + thd->lex->current_select->parsing_place= NO_MATTER; } ; @@ -14644,7 +14707,7 @@ field_or_var: if (!$2.length) { thd->parse_error(); - YYABORT; + MYSQL_YYABORT; } $$= new (thd->mem_root) Item_user_var_as_out_param(thd, &$2); @@ -14921,7 +14984,8 @@ with_clause: lex->derived_tables|= DERIVED_WITH; lex->with_cte_resolution= true; lex->curr_with_clause= with_clause; - with_clause->add_to_list(Lex->with_clauses_list_last_next); + with_clause->add_to_list(&lex->with_clauses_list, + lex->with_clauses_list_last_next); if (lex->current_select && lex->current_select->parsing_place == BEFORE_OPT_LIST) lex->current_select->parsing_place= NO_MATTER; @@ -16465,7 +16529,7 @@ option_value_no_option_type: if (!$2.length) { thd->parse_error(); - YYABORT; + MYSQL_YYABORT; } if (sp_create_assignment_lex(thd, $1.str)) @@ -17739,8 +17803,8 @@ trigger_tail: lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); } - sp_proc_stmt /* $19 */ - { /* $20 */ + sp_proc_stmt /* $19 */ force_lookahead /* $20 */ + { /* $21 */ LEX *lex= Lex; lex->sql_command= SQLCOM_CREATE_TRIGGER; @@ -17781,7 +17845,6 @@ sf_return_type: } ; - /*************************************************************************/ xa: @@ -18043,11 +18106,6 @@ sp_opt_default: | DEFAULT expr { $$ = $2; } ; -sp_pdparam: - sp_parameter_type sp_param_name_and_type { $2->mode=$1; } - | sp_param_name_and_type { $1->mode= sp_variable::MODE_IN; } - ; - sp_decl_variable_list_anchored: sp_decl_idents_init_vars TYPE_SYM OF_SYM optionally_qualified_column_ident @@ -18067,26 +18125,49 @@ sp_decl_variable_list_anchored: } ; -sp_param_name_and_type_anchored: - sp_param_name TYPE_SYM OF_SYM ident '.' ident +sp_param_name_and_mode: + sp_parameter_type sp_param_name + { + $2->mode= $1; + $$= $2; + } + | sp_param_name + ; + +sp_param: + sp_param_name_and_mode field_type + { + if (unlikely(Lex->sp_param_fill_definition($$= $1, $2))) + MYSQL_YYABORT; + } + | sp_param_name_and_mode ROW_SYM row_type_body + { + if (unlikely(Lex->sphead->spvar_fill_row(thd, $$= $1, $3))) + MYSQL_YYABORT; + } + | sp_param_anchored + ; + +sp_param_anchored: + sp_param_name_and_mode TYPE_SYM OF_SYM ident '.' ident { if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $$= $1, $4, $6))) MYSQL_YYABORT; } - | sp_param_name TYPE_SYM OF_SYM ident '.' ident '.' ident + | sp_param_name_and_mode TYPE_SYM OF_SYM ident '.' ident '.' ident { if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $$= $1, $4, $6, $8))) MYSQL_YYABORT; } - | sp_param_name ROW_SYM TYPE_SYM OF_SYM ident + | sp_param_name_and_mode ROW_SYM TYPE_SYM OF_SYM ident { if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $$= $1, $5))) MYSQL_YYABORT; } - | sp_param_name ROW_SYM TYPE_SYM OF_SYM ident '.' ident + | sp_param_name_and_mode ROW_SYM TYPE_SYM OF_SYM ident '.' ident { if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $$= $1, $5, $7))) MYSQL_YYABORT; @@ -18101,7 +18182,7 @@ sf_c_chistics_and_body_standalone: lex->sphead->set_c_chistics(lex->sp_chistics); lex->sphead->set_body_start(thd, YYLIP->get_cpp_tok_start()); } - sp_proc_stmt_in_returns_clause + sp_proc_stmt_in_returns_clause force_lookahead { if (unlikely(Lex->sp_body_finalize_function(thd))) MYSQL_YYABORT; @@ -18122,7 +18203,7 @@ sp_tail_standalone: Lex->sphead->set_c_chistics(Lex->sp_chistics); Lex->sphead->set_body_start(thd, YYLIP->get_cpp_tok_start()); } - sp_proc_stmt + sp_proc_stmt force_lookahead { if (unlikely(Lex->sp_body_finalize_procedure(thd))) MYSQL_YYABORT; @@ -18345,6 +18426,10 @@ sp_statement: MYSQL_YYABORT; } opt_sp_cparam_list + { + if (Lex->check_cte_dependencies_and_resolve_references()) + MYSQL_YYABORT; + } | ident_cli_directly_assignable '.' ident { Lex_ident_sys tmp(thd, &$1); @@ -18353,6 +18438,21 @@ sp_statement: MYSQL_YYABORT; } opt_sp_cparam_list + { + if (Lex->check_cte_dependencies_and_resolve_references()) + MYSQL_YYABORT; + } + | ident_cli_directly_assignable '.' ident '.' ident + { + Lex_ident_sys tmp(thd, &$1); + if (unlikely(Lex->call_statement_start(thd, &tmp, &$3, &$5))) + MYSQL_YYABORT; + } + opt_sp_cparam_list + { + if (Lex->check_cte_dependencies_and_resolve_references()) + MYSQL_YYABORT; + } ; sp_if_then_statements: @@ -18470,46 +18570,6 @@ sp_opt_inout: | IN_SYM OUT_SYM { $$= sp_variable::MODE_INOUT; } ; -sp_pdparam: - sp_param_name sp_opt_inout field_type - { - $1->mode= $2; - if (unlikely(Lex->sp_param_fill_definition($1, $3))) - MYSQL_YYABORT; - } - | sp_param_name sp_opt_inout sp_decl_ident '.' ident PERCENT_ORACLE_SYM TYPE_SYM - { - $1->mode= $2; - if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $1, $3, $5))) - MYSQL_YYABORT; - } - | sp_param_name sp_opt_inout sp_decl_ident '.' ident '.' ident PERCENT_ORACLE_SYM TYPE_SYM - { - $1->mode= $2; - if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $1, $3, $5, $7))) - MYSQL_YYABORT; - } - | sp_param_name sp_opt_inout sp_decl_ident PERCENT_ORACLE_SYM ROWTYPE_ORACLE_SYM - { - $1->mode= $2; - if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $1, $3))) - MYSQL_YYABORT; - } - | sp_param_name sp_opt_inout sp_decl_ident '.' ident PERCENT_ORACLE_SYM ROWTYPE_ORACLE_SYM - { - $1->mode= $2; - if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $1, $3, $5))) - MYSQL_YYABORT; - } - | sp_param_name sp_opt_inout ROW_SYM row_type_body - { - $1->mode= $2; - if (unlikely(Lex->sphead->spvar_fill_row(thd, $1, $4))) - MYSQL_YYABORT; - } - ; - - sp_proc_stmts1_implicit_block: { Lex->sp_block_init(thd); @@ -18861,6 +18921,7 @@ package_implementation_function_body: sp_head *sp= pkg->m_current_routine->sphead; thd->lex= pkg->m_current_routine; sp->reset_thd_mem_root(thd); + sp->set_c_chistics(thd->lex->sp_chistics); sp->set_body_start(thd, YYLIP->get_cpp_tok_start()); } sp_body opt_package_routine_end_name @@ -18879,6 +18940,7 @@ package_implementation_procedure_body: sp_head *sp= pkg->m_current_routine->sphead; thd->lex= pkg->m_current_routine; sp->reset_thd_mem_root(thd); + sp->set_c_chistics(thd->lex->sp_chistics); sp->set_body_start(thd, YYLIP->get_cpp_tok_start()); } sp_body opt_package_routine_end_name @@ -18941,23 +19003,45 @@ sp_decl_variable_list_anchored: } ; -sp_param_name_and_type_anchored: - sp_param_name sp_decl_ident '.' ident PERCENT_ORACLE_SYM TYPE_SYM +sp_param_name_and_mode: + sp_param_name sp_opt_inout + { + $1->mode= $2; + $$= $1; + } + ; + +sp_param: + sp_param_name_and_mode field_type + { + if (unlikely(Lex->sp_param_fill_definition($$= $1, $2))) + MYSQL_YYABORT; + } + | sp_param_name_and_mode ROW_SYM row_type_body + { + if (unlikely(Lex->sphead->spvar_fill_row(thd, $$= $1, $3))) + MYSQL_YYABORT; + } + | sp_param_anchored + ; + +sp_param_anchored: + sp_param_name_and_mode sp_decl_ident '.' ident PERCENT_ORACLE_SYM TYPE_SYM { if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $$= $1, $2, $4))) MYSQL_YYABORT; } - | sp_param_name sp_decl_ident '.' ident '.' ident PERCENT_ORACLE_SYM TYPE_SYM + | sp_param_name_and_mode sp_decl_ident '.' ident '.' ident PERCENT_ORACLE_SYM TYPE_SYM { if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $$= $1, $2, $4, $6))) MYSQL_YYABORT; } - | sp_param_name sp_decl_ident PERCENT_ORACLE_SYM ROWTYPE_ORACLE_SYM + | sp_param_name_and_mode sp_decl_ident PERCENT_ORACLE_SYM ROWTYPE_ORACLE_SYM { if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $$= $1, $2))) MYSQL_YYABORT; } - | sp_param_name sp_decl_ident '.' ident PERCENT_ORACLE_SYM ROWTYPE_ORACLE_SYM + | sp_param_name_and_mode sp_decl_ident '.' ident PERCENT_ORACLE_SYM ROWTYPE_ORACLE_SYM { if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $$= $1, $2, $4))) MYSQL_YYABORT; @@ -18972,8 +19056,7 @@ sf_c_chistics_and_body_standalone: lex->sphead->set_c_chistics(lex->sp_chistics); lex->sphead->set_body_start(thd, YYLIP->get_cpp_tok_start()); } - sp_tail_is - sp_body + sp_tail_is sp_body force_lookahead { if (unlikely(Lex->sp_body_finalize_function(thd))) MYSQL_YYABORT; diff --git a/sql/strfunc.cc b/sql/strfunc.cc index 9f178950fb0e1..416aea589dd99 100644 --- a/sql/strfunc.cc +++ b/sql/strfunc.cc @@ -72,7 +72,7 @@ ulonglong find_set(const TYPELIB *lib, if ((mblen= cs->mb_wc(&wc, (const uchar *) pos, (const uchar *) end)) < 1) mblen= 1; // Not to hang on a wrong multibyte sequence - if (wc == (my_wc_t) field_separator) + else if (wc == (my_wc_t) field_separator) break; } } diff --git a/sql/structs.h b/sql/structs.h index 59bab6c6f18de..0e4ca6236fe13 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -76,14 +76,14 @@ typedef struct st_key_part_info { /* Info about a key part */ uint offset; /* Offset in record (from 0) */ uint null_offset; /* Offset to null_bit in record */ /* Length of key part in bytes, excluding NULL flag and length bytes */ - uint16 length; + uint length; /* Number of bytes required to store the keypart value. This may be different from the "length" field as it also counts - possible NULL-flag byte (see HA_KEY_NULL_LENGTH) - possible HA_KEY_BLOB_LENGTH bytes needed to store actual value length. */ - uint16 store_length; + uint store_length; uint16 key_type; field_index_t fieldnr; /* Fieldnr begins counting from 1 */ uint16 key_part_flag; /* 0 or HA_REVERSE_SORT */ @@ -793,6 +793,11 @@ struct Lex_trim_st } Item *make_item_func_trim_std(THD *thd) const; Item *make_item_func_trim_oracle(THD *thd) const; + /* + This method is still used to handle LTRIM and RTRIM, + while the special syntax TRIM(... BOTH|LEADING|TRAILING) + is now handled by Schema::make_item_func_trim(). + */ Item *make_item_func_trim(THD *thd) const; }; @@ -804,6 +809,25 @@ class Lex_trim: public Lex_trim_st }; +class Lex_substring_spec_st +{ +public: + Item *m_subject; + Item *m_from; + Item *m_for; + static Lex_substring_spec_st init(Item *subject, + Item *from, + Item *xfor= NULL) + { + Lex_substring_spec_st res; + res.m_subject= subject; + res.m_from= from; + res.m_for= xfor; + return res; + } +}; + + class st_select_lex; class Lex_select_lock @@ -871,7 +895,7 @@ class Load_data_param class Load_data_outvar { public: - virtual ~Load_data_outvar() {} + virtual ~Load_data_outvar() = default; virtual bool load_data_set_null(THD *thd, const Load_data_param *param)= 0; virtual bool load_data_set_value(THD *thd, const char *pos, uint length, const Load_data_param *param)= 0; @@ -885,7 +909,7 @@ class Load_data_outvar class Timeval: public timeval { protected: - Timeval() { } + Timeval() = default; public: Timeval(my_time_t sec, ulong usec) { diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 447c1f0731092..a149bd23f33bb 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2002, 2015, Oracle and/or its affiliates. - Copyright (c) 2012, 2021, MariaDB Corporation. + Copyright (c) 2012, 2022, 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 @@ -34,7 +34,7 @@ #include "sql_plugin.h" #include "sql_priv.h" #include "sql_class.h" // set_var.h: THD -#include "sys_vars.ic" +#include "sys_vars.inl" #include "my_sys.h" #include "events.h" @@ -65,6 +65,9 @@ #include "semisync_master.h" #include "semisync_slave.h" #include +#ifdef WITH_WSREP +#include "wsrep_mysqld.h" +#endif #define PCRE2_STATIC 1 /* Important on Windows */ #include "pcre2.h" /* pcre2 header file */ @@ -599,10 +602,9 @@ bool check_has_super(sys_var *self, THD *thd, set_var *var) return false; } -static Sys_var_bit Sys_core_file("core_file", "write a core-file on crashes", - READ_ONLY GLOBAL_VAR(test_flags), NO_CMD_LINE, - TEST_CORE_ON_SIGNAL, DEFAULT(IF_WIN(TRUE,FALSE)), NO_MUTEX_GUARD, NOT_IN_BINLOG, - 0,0,0); +static Sys_var_bit Sys_core_file("core_file", "Write core on crashes", + READ_ONLY GLOBAL_VAR(test_flags), CMD_LINE(OPT_ARG), + TEST_CORE_ON_SIGNAL, DEFAULT(IF_WIN(TRUE,FALSE))); static bool binlog_format_check(sys_var *self, THD *thd, set_var *var) { @@ -719,15 +721,13 @@ Sys_binlog_direct( CMD_LINE(OPT_ARG), DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(binlog_direct_check)); - -static Sys_var_mybool Sys_explicit_defaults_for_timestamp( +static Sys_var_bit Sys_explicit_defaults_for_timestamp( "explicit_defaults_for_timestamp", "This option causes CREATE TABLE to create all TIMESTAMP columns " "as NULL with DEFAULT NULL attribute, Without this option, " "TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses.", - READ_ONLY GLOBAL_VAR(opt_explicit_defaults_for_timestamp), - CMD_LINE(OPT_ARG), DEFAULT(FALSE)); - + SESSION_VAR(option_bits), CMD_LINE(OPT_ARG), + OPTION_EXPLICIT_DEF_TIMESTAMP, DEFAULT(FALSE), NO_MUTEX_GUARD, IN_BINLOG); static Sys_var_ulonglong Sys_bulk_insert_buff_size( "bulk_insert_buffer_size", "Size of tree cache used in bulk " @@ -2047,7 +2047,10 @@ Sys_gtid_strict_mode( "gtid_strict_mode", "Enforce strict seq_no ordering of events in the binary log. Slave " "stops with an error if it encounters an event that would cause it to " - "generate an out-of-order binlog if executed.", + "generate an out-of-order binlog if executed. " + "When ON the same server-id semisync-replicated transactions that " + "duplicate exising ones in binlog are ignored without error " + "and slave interruption.", GLOBAL_VAR(opt_gtid_strict_mode), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); @@ -2409,6 +2412,12 @@ static Sys_var_bit Sys_skip_parallel_replication( SESSION_ONLY(option_bits), NO_CMD_LINE, OPTION_RPL_SKIP_PARALLEL, DEFAULT(FALSE)); +static Sys_var_mybool Sys_binlog_alter_two_phase( + "binlog_alter_two_phase", + "When set, split ALTER at binary logging into 2 statements: " + "START ALTER and COMMIT/ROLLBACK ALTER", + SESSION_VAR(binlog_alter_two_phase), CMD_LINE(OPT_ARG), + DEFAULT(FALSE)); static bool check_gtid_ignore_duplicates(sys_var *self, THD *thd, set_var *var) @@ -2770,6 +2779,7 @@ export const char *optimizer_switch_names[]= "rowid_filter", "condition_pushdown_from_having", "not_null_range_scan", + "hash_join_cardinality", "default", NullS }; @@ -3032,7 +3042,7 @@ static Sys_var_mybool Sys_skip_name_resolve( "skip_name_resolve", "Don't resolve hostnames. All hostnames are IP's or 'localhost'.", READ_ONLY GLOBAL_VAR(opt_skip_name_resolve), - CMD_LINE(OPT_ARG, OPT_SKIP_RESOLVE), + CMD_LINE(OPT_ARG), DEFAULT(FALSE)); static Sys_var_mybool Sys_skip_show_database( @@ -3273,6 +3283,21 @@ static Sys_var_charptr_fscs Sys_secure_file_priv( PREALLOCATED READ_ONLY GLOBAL_VAR(opt_secure_file_priv), CMD_LINE(REQUIRED_ARG), DEFAULT(0)); +static bool check_server_id(sys_var *self, THD *thd, set_var *var) +{ +#ifdef WITH_WSREP + if (WSREP_ON && WSREP_PROVIDER_EXISTS && !wsrep_new_cluster && wsrep_gtid_mode) + { + push_warning(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WRONG_VALUE_FOR_VAR, + "Can't change server_id because wsrep and wsrep_gtid_mode is set." + " You can set server_id only with wsrep_new_cluster. "); + return true; + } +#endif /* WITH_WSREP */ + return false; +} + static bool fix_server_id(sys_var *self, THD *thd, enum_var_type type) { if (type == OPT_GLOBAL) @@ -3297,7 +3322,7 @@ Sys_server_id( "replication partners", SESSION_VAR(server_id), CMD_LINE(REQUIRED_ARG, OPT_SERVER_ID), VALID_RANGE(1, UINT_MAX32), DEFAULT(1), BLOCK_SIZE(1), NO_MUTEX_GUARD, - NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_server_id)); + NOT_IN_BINLOG, ON_CHECK(check_server_id), ON_UPDATE(fix_server_id)); static Sys_var_on_access_global @@ -4469,10 +4494,7 @@ static bool fix_sql_log_bin_after_update(sys_var *self, THD *thd, { DBUG_ASSERT(type == OPT_SESSION); - if (thd->variables.sql_log_bin) - thd->variables.option_bits |= OPTION_BIN_LOG; - else - thd->variables.option_bits &= ~OPTION_BIN_LOG; + thd->set_binlog_bit(); return FALSE; } @@ -4902,7 +4924,9 @@ static Sys_var_mybool Sys_keep_files_on_create( "keep_files_on_create", "Don't overwrite stale .MYD and .MYI even if no directory is specified", SESSION_VAR(keep_files_on_create), CMD_LINE(OPT_ARG), - DEFAULT(FALSE)); + DEFAULT(FALSE), + NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0), + DEPRECATED("")); // since 10.8.0 static char *license; static Sys_var_charptr Sys_license( @@ -5115,13 +5139,19 @@ static Sys_var_have Sys_have_symlink( "--skip-symbolic-links option.", READ_ONLY GLOBAL_VAR(have_symlink), NO_CMD_LINE); -#if defined(__SANITIZE_ADDRESS__) || defined(WITH_UBSAN) +#if defined __SANITIZE_ADDRESS__ || defined WITH_UBSAN || __has_feature(memory_sanitizer) -#ifdef __SANITIZE_ADDRESS__ -#define SANITIZER_MODE "ASAN" -#else -#define SANITIZER_MODE "UBSAN" -#endif /* __SANITIZE_ADDRESS__ */ +# ifdef __SANITIZE_ADDRESS__ +# ifdef WITH_UBSAN +# define SANITIZER_MODE "ASAN,UBSAN" +# else +# define SANITIZER_MODE "ASAN" +# endif +# elif defined WITH_UBSAN +# define SANITIZER_MODE "UBSAN" +# else +# define SANITIZER_MODE "MSAN" +# endif static char *have_sanitizer; static Sys_var_charptr Sys_have_santitizer( @@ -5369,7 +5399,6 @@ Sys_var_rpl_filter::global_value_ptr(THD *thd, } rpl_filter= mi->rpl_filter; - tmp.length(0); mysql_mutex_lock(&LOCK_active_mi); switch (opt_id) { @@ -5841,7 +5870,7 @@ static bool update_wsrep_auto_increment_control (sys_var *self, THD *thd, enum_v { /* The variables that control auto increment shall be calculated - automaticaly based on the size of the cluster. This usually done + automatically based on the size of the cluster. This usually done within the wsrep_view_handler_cb callback. However, if the user manually sets the value of wsrep_auto_increment_control to 'ON', then we should to re-calculate these variables again (because @@ -6007,6 +6036,7 @@ static const char *wsrep_mode_names[]= "REPLICATE_MYISAM", "REPLICATE_ARIA", "DISALLOW_LOCAL_GTID", + "BF_ABORT_MARIABACKUP", NullS }; static Sys_var_set Sys_wsrep_mode( @@ -6671,7 +6701,7 @@ static Sys_var_ulong Sys_log_tc_size( DEFAULT(my_getpagesize() * 6), BLOCK_SIZE(my_getpagesize())); #endif -static Sys_var_ulonglong Sys_max_thread_mem( +static Sys_var_ulonglong Sys_max_session_mem_used( "max_session_mem_used", "Amount of memory a single user session " "is allowed to allocate. This limits the value of the " "session variable MEM_USED", SESSION_VAR(max_mem_used), diff --git a/sql/sys_vars.ic b/sql/sys_vars.inl similarity index 100% rename from sql/sys_vars.ic rename to sql/sys_vars.inl diff --git a/sql/sys_vars_shared.h b/sql/sys_vars_shared.h index bc48d1f7fffdb..508a0a70c8f9b 100644 --- a/sql/sys_vars_shared.h +++ b/sql/sys_vars_shared.h @@ -44,7 +44,7 @@ class PolyLock virtual void rdlock()= 0; virtual void wrlock()= 0; virtual void unlock()= 0; - virtual ~PolyLock() {} + virtual ~PolyLock() = default; }; class PolyLock_mutex: public PolyLock diff --git a/sql/table.cc b/sql/table.cc index b1a7b6bfe2be7..6d207bc847bc3 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. - Copyright (c) 2008, 2021, MariaDB + Copyright (c) 2008, 2022, 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 @@ -50,25 +50,14 @@ #define MYSQL57_GENERATED_FIELD 128 #define MYSQL57_GCOL_HEADER_SIZE 4 -class Table_arena: public Query_arena -{ -public: - Table_arena(MEM_ROOT *mem_root, enum enum_state state_arg) : - Query_arena(mem_root, state_arg){} - virtual Type type() const - { - return TABLE_ARENA; - } -}; - bool TABLE::init_expr_arena(MEM_ROOT *mem_root) { /* We need to use CONVENTIONAL_EXECUTION here to ensure that any new items created by fix_fields() are not reverted. */ - expr_arena= new (alloc_root(mem_root, sizeof(Table_arena))) - Table_arena(mem_root, Query_arena::STMT_CONVENTIONAL_EXECUTION); + expr_arena= new (alloc_root(mem_root, sizeof(Query_arena))) + Query_arena(mem_root, Query_arena::STMT_CONVENTIONAL_EXECUTION); return expr_arena == NULL; } @@ -88,10 +77,8 @@ struct extra2_fields { bzero((void*)this, sizeof(*this)); } }; -static Virtual_column_info * unpack_vcol_info_from_frm(THD *, MEM_ROOT *, +static Virtual_column_info * unpack_vcol_info_from_frm(THD *, TABLE *, String *, Virtual_column_info **, bool *); -static bool check_vcol_forward_refs(Field *, Virtual_column_info *, - bool check_constraint); /* INFORMATION_SCHEMA name */ LEX_CSTRING INFORMATION_SCHEMA_NAME= {STRING_WITH_LEN("information_schema")}; @@ -686,7 +673,11 @@ enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, uint flags) if (!share->view_def) share->error= OPEN_FRM_ERROR_ALREADY_ISSUED; else + { share->error= OPEN_FRM_OK; + if (mariadb_view_version_get(share)) + share->error= OPEN_FRM_ERROR_ALREADY_ISSUED; + } } else share->error= OPEN_FRM_NOT_A_TABLE; @@ -960,39 +951,6 @@ static uint enum_value_with_check(THD *thd, TABLE_SHARE *share, } -/** - Check if a collation has changed number - - @param mysql_version - @param current collation number - - @retval new collation number (same as current collation number of no change) -*/ - -static uint upgrade_collation(ulong mysql_version, uint cs_number) -{ - if (mysql_version >= 50300 && mysql_version <= 50399) - { - switch (cs_number) { - case 149: return MY_PAGE2_COLLATION_ID_UCS2; // ucs2_crotian_ci - case 213: return MY_PAGE2_COLLATION_ID_UTF8; // utf8_crotian_ci - } - } - if ((mysql_version >= 50500 && mysql_version <= 50599) || - (mysql_version >= 100000 && mysql_version <= 100005)) - { - switch (cs_number) { - case 149: return MY_PAGE2_COLLATION_ID_UCS2; // ucs2_crotian_ci - case 213: return MY_PAGE2_COLLATION_ID_UTF8; // utf8_crotian_ci - case 214: return MY_PAGE2_COLLATION_ID_UTF32; // utf32_croatian_ci - case 215: return MY_PAGE2_COLLATION_ID_UTF16; // utf16_croatian_ci - case 245: return MY_PAGE2_COLLATION_ID_UTF8MB4;// utf8mb4_croatian_ci - } - } - return cs_number; -} - - void Column_definition_attributes::frm_pack_basic(uchar *buff) const { int2store(buff + 3, length); @@ -1052,7 +1010,7 @@ bool Column_definition_attributes::frm_unpack_charset(TABLE_SHARE *share, const uchar *buff) { uint cs_org= buff[14] + (((uint) buff[11]) << 8); - uint cs_new= upgrade_collation(share->mysql_version, cs_org); + uint cs_new= Charset::upgrade_collation_id(share->mysql_version, cs_org); if (cs_org != cs_new) share->incompatible_version|= HA_CREATE_USED_CHARSET; if (cs_new && !(charset= get_charset(cs_new, MYF(0)))) @@ -1119,8 +1077,17 @@ static void mysql57_calculate_null_position(TABLE_SHARE *share, } } -static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, - Virtual_column_info *vcol); + +Item_func_hash *TABLE_SHARE::make_long_hash_func(THD *thd, + MEM_ROOT *mem_root, + List *field_list) + const +{ + if (old_long_hash_function()) + return new (mem_root) Item_func_hash_mariadb_100403(thd, *field_list); + return new (mem_root) Item_func_hash(thd, *field_list); +} + /** Parse TABLE_SHARE::vcol_defs @@ -1147,6 +1114,31 @@ static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, bool *error_reported, vcol_init_mode mode) { + struct check_vcol_forward_refs + { + static bool check(Field *field, Virtual_column_info *vcol) + { + return vcol && + vcol->expr->walk(&Item::check_field_expression_processor, 0, field); + } + static bool check_constraint(Field *field, Virtual_column_info *vcol) + { + uint32 flags= field->flags; + /* Check constraints can refer it itself */ + field->flags|= NO_DEFAULT_VALUE_FLAG; + const bool res= check(field, vcol); + field->flags= flags; + return res; + } + static bool check(Field *field) + { + if (check(field, field->vcol_info) || + check_constraint(field, field->check_constraint) || + check(field, field->default_value)) + return true; + return false; + } + }; CHARSET_INFO *save_character_set_client= thd->variables.character_set_client; CHARSET_INFO *save_collation= thd->variables.collation_connection; Query_arena *backup_stmt_arena_ptr= thd->stmt_arena; @@ -1221,7 +1213,7 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, switch (type) { case VCOL_GENERATED_VIRTUAL: case VCOL_GENERATED_STORED: - vcol= unpack_vcol_info_from_frm(thd, mem_root, table, &expr_str, + vcol= unpack_vcol_info_from_frm(thd, table, &expr_str, &((*field_ptr)->vcol_info), error_reported); *(vfield_ptr++)= *field_ptr; DBUG_ASSERT(table->map == 0); @@ -1241,7 +1233,7 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, table->map= 0; break; case VCOL_DEFAULT: - vcol= unpack_vcol_info_from_frm(thd, mem_root, table, &expr_str, + vcol= unpack_vcol_info_from_frm(thd, table, &expr_str, &((*field_ptr)->default_value), error_reported); *(dfield_ptr++)= *field_ptr; @@ -1249,13 +1241,13 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, table->s->non_determinstic_insert= true; break; case VCOL_CHECK_FIELD: - vcol= unpack_vcol_info_from_frm(thd, mem_root, table, &expr_str, + vcol= unpack_vcol_info_from_frm(thd, table, &expr_str, &((*field_ptr)->check_constraint), error_reported); *check_constraint_ptr++= (*field_ptr)->check_constraint; break; case VCOL_CHECK_TABLE: - vcol= unpack_vcol_info_from_frm(thd, mem_root, table, &expr_str, + vcol= unpack_vcol_info_from_frm(thd, table, &expr_str, check_constraint_ptr, error_reported); check_constraint_ptr++; break; @@ -1302,12 +1294,15 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, list_item= new (mem_root) Item_field(thd, keypart->field); field_list->push_back(list_item, mem_root); } - Item_func_hash *hash_item= new(mem_root)Item_func_hash(thd, *field_list); + + Item_func_hash *hash_item= table->s->make_long_hash_func(thd, mem_root, + field_list); + Virtual_column_info *v= new (mem_root) Virtual_column_info(); field->vcol_info= v; field->vcol_info->expr= hash_item; field->vcol_info->set_vcol_type(VCOL_USING_HASH); - if (fix_and_check_vcol_expr(thd, table, v)) + if (v->fix_and_check_expr(thd, table)) goto end; key->user_defined_key_parts= key->ext_key_parts= key->usable_key_parts= 1; key->key_part+= parts; @@ -1325,7 +1320,7 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, expr_str.append(STRING_WITH_LEN("current_timestamp(")); expr_str.append_ulonglong(field->decimals()); expr_str.append(')'); - vcol= unpack_vcol_info_from_frm(thd, mem_root, table, &expr_str, + vcol= unpack_vcol_info_from_frm(thd, table, &expr_str, &((*field_ptr)->default_value), error_reported); *(dfield_ptr++)= *field_ptr; @@ -1347,16 +1342,11 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, /* Check that expressions aren't referring to not yet initialized fields */ for (field_ptr= table->field; *field_ptr; field_ptr++) - { - Field *field= *field_ptr; - if (check_vcol_forward_refs(field, field->vcol_info, 0) || - check_vcol_forward_refs(field, field->check_constraint, 1) || - check_vcol_forward_refs(field, field->default_value, 0)) + if (check_vcol_forward_refs::check(*field_ptr)) { *error_reported= true; goto end; } - } table->find_constraint_correlated_indexes(); @@ -1553,21 +1543,6 @@ bool TABLE_SHARE::init_period_from_extra2(period_info_t *period, } -static size_t extra2_read_len(const uchar **extra2, const uchar *extra2_end) -{ - size_t length= *(*extra2)++; - if (length) - return length; - - if ((*extra2) + 2 >= extra2_end) - return 0; - length= uint2korr(*extra2); - (*extra2)+= 2; - if (length < 256 || *extra2 + length > extra2_end) - return 0; - return length; -} - static bool read_extra2_section_once(const uchar *extra2, size_t len, LEX_CUSTRING *section) { @@ -1795,6 +1770,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, Field_data_type_info_array field_data_type_info_array; MEM_ROOT *old_root= thd->mem_root; Virtual_column_info **table_check_constraints; + bool *interval_unescaped= NULL; extra2_fields extra2; bool extra_index_flags_present= FALSE; DBUG_ENTER("TABLE_SHARE::init_from_binary_frm_image"); @@ -1867,7 +1843,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, if (frm_image[61] && !share->default_part_plugin) { enum legacy_db_type db_type= (enum legacy_db_type) (uint) frm_image[61]; - share->default_part_plugin= ha_lock_engine(NULL, ha_checktype(thd, db_type)); + share->default_part_plugin= ha_lock_engine(NULL, ha_checktype(thd, db_type, 1)); if (!share->default_part_plugin) goto err; } @@ -1888,7 +1864,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, if (!frm_image[32]) // New frm file in 3.23 { uint cs_org= (((uint) frm_image[41]) << 8) + (uint) frm_image[38]; - uint cs_new= upgrade_collation(share->mysql_version, cs_org); + uint cs_new= Charset::upgrade_collation_id(share->mysql_version, cs_org); if (cs_org != cs_new) share->incompatible_version|= HA_CREATE_USED_CHARSET; @@ -2257,6 +2233,13 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, goto err; + if (interval_count) + { + if (!(interval_unescaped= (bool*) my_alloca(interval_count * sizeof(bool)))) + goto err; + bzero(interval_unescaped, interval_count * sizeof(bool)); + } + field_ptr= share->field; table_check_constraints= share->check_constraints; read_length=(uint) (share->fields * field_pack_length + @@ -2438,11 +2421,11 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, comment_pos+= comment_length; } - if ((uchar) strpos[13] == (uchar) MYSQL_TYPE_VIRTUAL - && likely(share->mysql_version >= 100000)) + if (strpos[13] == MYSQL_TYPE_VIRTUAL && + (share->mysql_version < 50600 || share->mysql_version >= 100000)) { /* - MariaDB version 10.0 version. + MariaDB 5.5 or 10.0 version. The interval_id byte in the .frm file stores the length of the expression statement for a virtual column. */ @@ -2611,11 +2594,17 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, if (share->mysql_version < 100200) attr.pack_flag&= ~FIELDFLAG_LONG_DECIMAL; - if (interval_nr && attr.charset->mbminlen > 1) + if (interval_nr && attr.charset->mbminlen > 1 && + !interval_unescaped[interval_nr - 1]) { - /* Unescape UCS2 intervals from HEX notation */ + /* + Unescape UCS2/UTF16/UTF32 intervals from HEX notation. + Note, ENUM/SET columns with equal value list share a single + copy of TYPELIB. Unescape every TYPELIB only once. + */ TYPELIB *interval= share->intervals + interval_nr - 1; unhex_type2(interval); + interval_unescaped[interval_nr - 1]= true; } #ifndef TO_BE_DELETED_ON_PRODUCTION @@ -2661,8 +2650,11 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, if (flags & VERS_SYSTEM_FIELD) { - switch (handler->real_field_type()) - { + auto field_type= handler->real_field_type(); + + DBUG_EXECUTE_IF("error_vers_wrong_type", field_type= MYSQL_TYPE_BLOB;); + + switch (field_type) { case MYSQL_TYPE_TIMESTAMP2: break; case MYSQL_TYPE_LONGLONG: @@ -2673,9 +2665,13 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, } /* Fallthrough */ default: - my_error(ER_VERS_FIELD_WRONG_TYPE, MYF(0), fieldnames.type_names[i], - versioned == VERS_TIMESTAMP ? "TIMESTAMP(6)" : "BIGINT(20) UNSIGNED", - table_name.str); + my_error(ER_VERS_FIELD_WRONG_TYPE, + (field_type == MYSQL_TYPE_LONGLONG ? + MYF(0) : MYF(ME_WARNING)), + fieldnames.type_names[i], + (versioned == VERS_TIMESTAMP ? + "TIMESTAMP(6)" : "BIGINT(20) UNSIGNED"), + table_name.str); goto err; } } @@ -3026,6 +3022,9 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, goto err; field= key_part->field= share->field[key_part->fieldnr-1]; + if (Charset::collation_changed_order(share->mysql_version, + field->charset()->number)) + share->incompatible_version|= HA_CREATE_USED_CHARSET; key_part->type= field->key_type(); if (field->invisible > INVISIBLE_USER && !field->vers_sys_field()) @@ -3240,6 +3239,8 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, share->stored_fields--; if (reg_field->flags & BLOB_FLAG) share->virtual_not_stored_blob_fields++; + if (reg_field->flags & PART_KEY_FLAG) + vcol_info->set_vcol_type(VCOL_GENERATED_VIRTUAL_INDEXED); /* Correct stored_rec_length as non stored fields are last */ recpos= (uint) (reg_field->ptr - record); if (share->stored_rec_length >= recpos) @@ -3363,6 +3364,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, share->error= OPEN_FRM_OK; thd->status_var.opened_shares++; thd->mem_root= old_root; + my_afree(interval_unescaped); DBUG_RETURN(0); err: @@ -3390,6 +3392,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, open_table_error(share, OPEN_FRM_CORRUPTED, share->open_errno); thd->mem_root= old_root; + my_afree(interval_unescaped); DBUG_RETURN(HA_ERR_NOT_A_TABLE); } @@ -3458,7 +3461,6 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write, char *sql_copy; handler *file; LEX *old_lex; - Query_arena *arena, backup; LEX tmp_lex; KEY *unused1; uint unused2; @@ -3485,12 +3487,6 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write, old_lex= thd->lex; thd->lex= &tmp_lex; - arena= thd->stmt_arena; - if (arena->is_conventional()) - arena= 0; - else - thd->set_n_backup_active_arena(arena, &backup); - thd->reset_db(&db); lex_start(thd); @@ -3525,8 +3521,6 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write, lex_end(thd->lex); thd->reset_db(&db_backup); thd->lex= old_lex; - if (arena) - thd->restore_active_arena(arena, &backup); reenable_binlog(thd); thd->variables.character_set_client= old_cs; if (unlikely(thd->is_error() || error)) @@ -3586,21 +3580,21 @@ void TABLE_SHARE::free_frm_image(const uchar *frm) } -static bool fix_vcol_expr(THD *thd, Virtual_column_info *vcol) +bool Virtual_column_info::fix_expr(THD *thd) { DBUG_ENTER("fix_vcol_expr"); const enum enum_column_usage saved_column_usage= thd->column_usage; thd->column_usage= COLUMNS_WRITE; - int error= vcol->expr->fix_fields(thd, &vcol->expr); + int error= expr->fix_fields(thd, &expr); thd->column_usage= saved_column_usage; if (unlikely(error)) { StringBuffer str; - vcol->print(&str); + print(&str); my_error(ER_ERROR_EVALUATING_EXPRESSION, MYF(0), str.c_ptr_safe()); DBUG_RETURN(1); } @@ -3613,36 +3607,120 @@ static bool fix_vcol_expr(THD *thd, Virtual_column_info *vcol) @note this is done for all vcols for INSERT/UPDATE/DELETE, and only as needed for SELECTs. */ -bool fix_session_vcol_expr(THD *thd, Virtual_column_info *vcol) +bool Virtual_column_info::fix_session_expr(THD *thd) { - DBUG_ENTER("fix_session_vcol_expr"); - if (!(vcol->flags & (VCOL_TIME_FUNC|VCOL_SESSION_FUNC))) - DBUG_RETURN(0); + if (!need_refix()) + return false; - vcol->expr->walk(&Item::cleanup_excluding_fields_processor, 0, 0); - DBUG_ASSERT(!vcol->expr->fixed()); - DBUG_RETURN(fix_vcol_expr(thd, vcol)); + DBUG_ASSERT(!expr->fixed()); + return fix_expr(thd); } -/** invoke fix_session_vcol_expr for a vcol +bool Virtual_column_info::cleanup_session_expr() +{ + DBUG_ASSERT(need_refix()); + return expr->walk(&Item::cleanup_excluding_fields_processor, 0, 0); +} - @note this is called for generated column or a DEFAULT expression from - their corresponding fix_fields on SELECT. -*/ -bool fix_session_vcol_expr_for_read(THD *thd, Field *field, - Virtual_column_info *vcol) + + +class Vcol_expr_context { - DBUG_ENTER("fix_session_vcol_expr_for_read"); - TABLE_LIST *tl= field->table->pos_in_table_list; - if (!tl || tl->lock_type >= TL_FIRST_WRITE) - DBUG_RETURN(0); - Security_context *save_security_ctx= thd->security_ctx; - if (tl->security_ctx) + bool inited; + THD *thd; + TABLE *table; + Query_arena backup_arena, *stmt_arena; + table_map old_map; + Security_context *save_security_ctx; + sql_mode_t save_sql_mode; + +public: + Vcol_expr_context(THD *_thd, TABLE *_table) : + inited(false), + thd(_thd), + table(_table), + stmt_arena(thd->stmt_arena), + old_map(table->map), + save_security_ctx(thd->security_ctx), + save_sql_mode(thd->variables.sql_mode) {} + bool init(); + + ~Vcol_expr_context(); +}; + + +bool Vcol_expr_context::init() +{ + thd->variables.sql_mode= 0; + + TABLE_LIST const *tl= table->pos_in_table_list; + DBUG_ASSERT(table->pos_in_table_list); + + if (table->pos_in_table_list->security_ctx) thd->security_ctx= tl->security_ctx; - bool res= fix_session_vcol_expr(thd, vcol); + + thd->set_n_backup_active_arena(table->expr_arena, &backup_arena); + thd->stmt_arena= thd; + + inited= true; + return false; +} + +Vcol_expr_context::~Vcol_expr_context() +{ + if (!inited) + return; + table->map= old_map; thd->security_ctx= save_security_ctx; - DBUG_RETURN(res); + thd->restore_active_arena(table->expr_arena, &backup_arena); + thd->variables.sql_mode= save_sql_mode; + thd->stmt_arena= stmt_arena; +} + + +bool TABLE::vcol_fix_expr(THD *thd) +{ + if (pos_in_table_list->placeholder() || vcol_refix_list.is_empty()) + return false; + + if (!thd->stmt_arena->is_conventional() && + vcol_refix_list.head()->expr->fixed()) + { + /* NOTE: Under trigger we already have fixed expressions */ + return false; + } + + Vcol_expr_context expr_ctx(thd, this); + if (expr_ctx.init()) + return true; + + List_iterator_fast it(vcol_refix_list); + while (Virtual_column_info *vcol= it++) + if (vcol->fix_session_expr(thd)) + goto error; + + return false; + +error: + DBUG_ASSERT(thd->get_stmt_da()->is_error()); + return true; +} + + +bool TABLE::vcol_cleanup_expr(THD *thd) +{ + if (vcol_refix_list.is_empty()) + return false; + + List_iterator it(vcol_refix_list); + bool result= false; + + while (Virtual_column_info *vcol= it++) + result|= vcol->cleanup_session_expr(); + + DBUG_ASSERT(!result || thd->get_stmt_da()->is_error()); + return result; } @@ -3667,28 +3745,25 @@ bool fix_session_vcol_expr_for_read(THD *thd, Field *field, FALSE Otherwise */ -static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, - Virtual_column_info *vcol) +bool Virtual_column_info::fix_and_check_expr(THD *thd, TABLE *table) { - Item* func_expr= vcol->expr; - DBUG_ENTER("fix_and_check_vcol_expr"); - DBUG_PRINT("info", ("vcol: %p", vcol)); - DBUG_ASSERT(func_expr); + DBUG_ENTER("Virtual_column_info::fix_and_check_expr"); + DBUG_PRINT("info", ("vcol: %p", this)); + DBUG_ASSERT(expr); - if (func_expr->fixed()) + /* NOTE: constants are fixed when constructed */ + if (expr->fixed()) DBUG_RETURN(0); // nothing to do - if (fix_vcol_expr(thd, vcol)) + if (fix_expr(thd)) DBUG_RETURN(1); - if (vcol->flags) + if (flags) DBUG_RETURN(0); // already checked, no need to do it again - /* fix_fields could've changed the expression */ - func_expr= vcol->expr; /* this was checked in check_expression(), but the frm could be mangled... */ - if (unlikely(func_expr->result_type() == ROW_RESULT)) + if (unlikely(expr->result_type() == ROW_RESULT)) { my_error(ER_OPERAND_COLUMNS, MYF(0), 1); DBUG_RETURN(1); @@ -3700,15 +3775,15 @@ static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, */ Item::vcol_func_processor_result res; - int error= func_expr->walk(&Item::check_vcol_func_processor, 0, &res); + int error= expr->walk(&Item::check_vcol_func_processor, 0, &res); if (unlikely(error || (res.errors & VCOL_IMPOSSIBLE))) { // this can only happen if the frm was corrupted my_error(ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED, MYF(0), res.name, - vcol->get_vcol_type_name(), vcol->name.str); + get_vcol_type_name(), name.str); DBUG_RETURN(1); } - else if (unlikely(res.errors & VCOL_AUTO_INC)) + else if (res.errors & VCOL_AUTO_INC && vcol_type != VCOL_GENERATED_VIRTUAL) { /* An auto_increment field may not be used in an expression for @@ -3719,15 +3794,22 @@ static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, pointer at that time */ myf warn= table->s->frm_version < FRM_VER_EXPRESSSIONS ? ME_WARNING : 0; - my_error(ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED, MYF(warn), - "AUTO_INCREMENT", vcol->get_vcol_type_name(), res.name); + my_error(ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED, MYF(warn), + "AUTO_INCREMENT", get_vcol_type_name(), res.name); if (!warn) DBUG_RETURN(1); } - vcol->flags= res.errors; + else if (vcol_type != VCOL_GENERATED_VIRTUAL && vcol_type != VCOL_DEFAULT && + res.errors & VCOL_NOT_STRICTLY_DETERMINISTIC) + { + my_error(ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED, MYF(0), + res.name, get_vcol_type_name(), name.str); + DBUG_RETURN(1); + } + flags= res.errors; - if (vcol->flags & VCOL_SESSION_FUNC) - table->s->vcols_need_refixing= true; + if (!table->s->tmp_table && need_refix()) + table->vcol_refix_list.push_back(this, &table->mem_root); DBUG_RETURN(0); } @@ -3765,7 +3847,7 @@ static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, */ static Virtual_column_info * -unpack_vcol_info_from_frm(THD *thd, MEM_ROOT *mem_root, TABLE *table, +unpack_vcol_info_from_frm(THD *thd, TABLE *table, String *expr_str, Virtual_column_info **vcol_ptr, bool *error_reported) { @@ -3804,7 +3886,7 @@ unpack_vcol_info_from_frm(THD *thd, MEM_ROOT *mem_root, TABLE *table, vcol_storage.vcol_info->stored_in_db= vcol->stored_in_db; vcol_storage.vcol_info->name= vcol->name; vcol_storage.vcol_info->utf8= vcol->utf8; - if (!fix_and_check_vcol_expr(thd, table, vcol_storage.vcol_info)) + if (!vcol_storage.vcol_info->fix_and_check_expr(thd, table)) { *vcol_ptr= vcol_info= vcol_storage.vcol_info; // Expression ok DBUG_ASSERT(vcol_info->expr); @@ -3818,22 +3900,6 @@ unpack_vcol_info_from_frm(THD *thd, MEM_ROOT *mem_root, TABLE *table, DBUG_RETURN(vcol_info); } -static bool check_vcol_forward_refs(Field *field, Virtual_column_info *vcol, - bool check_constraint) -{ - bool res; - uint32 flags= field->flags; - if (check_constraint) - { - /* Check constraints can refer it itself */ - field->flags|= NO_DEFAULT_VALUE_FLAG; - } - res= (vcol && - vcol->expr->walk(&Item::check_field_expression_processor, 0, field)); - field->flags= flags; - return res; -} - #ifndef DBUG_OFF static void print_long_unique_table(TABLE *table) { @@ -4014,6 +4080,7 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, outparam->s= share; outparam->db_stat= db_stat; outparam->write_row_record= NULL; + outparam->status= STATUS_NO_RECORD; if (share->incompatible_version && !(ha_open_flags & (HA_OPEN_FOR_ALTER | HA_OPEN_FOR_REPAIR | @@ -4034,6 +4101,7 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, goto err; outparam->alias.set(tmp_alias, alias->length, table_alias_charset); + outparam->vcol_refix_list.empty(); /* Allocate handler */ outparam->file= 0; @@ -4244,6 +4312,8 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, thd->restore_active_arena(&part_func_arena, &backup_arena); goto partititon_err; } + if (parse_engine_part_options(thd, outparam)) + goto err; outparam->part_info->is_auto_partitioned= share->auto_partitioned; DBUG_PRINT("info", ("autopartitioned: %u", share->auto_partitioned)); /* @@ -4850,7 +4920,8 @@ void update_create_info_from_table(HA_CREATE_INFO *create_info, TABLE *table) int rename_file_ext(const char * from,const char * to,const char * ext) { - char from_b[FN_REFLEN],to_b[FN_REFLEN]; + /* Reserve space for ./databasename/tablename.frm + NUL byte */ + char from_b[2 + FN_REFLEN + 4 + 1], to_b[2 + FN_REFLEN + 4 + 1]; (void) strxmov(from_b,from,ext,NullS); (void) strxmov(to_b,to,ext,NullS); return mysql_file_rename(key_file_frm, from_b, to_b, MYF(0)); @@ -5105,6 +5176,12 @@ bool check_column_name(const char *name) } +bool check_period_name(const char *name) +{ + return check_column_name(name); +} + + /** Checks whether a table is intact. Should be done *just* after the table has been opened. @@ -6637,6 +6714,9 @@ bool TABLE_LIST::prepare_security(THD *thd) #ifndef DBUG_OFF void TABLE_LIST::set_check_merged() { + if (is_view()) + return; + DBUG_ASSERT(derived); /* It is not simple to check all, but at least this should be checked: @@ -6654,7 +6734,7 @@ void TABLE_LIST::set_check_materialized() DBUG_ENTER("TABLE_LIST::set_check_materialized"); SELECT_LEX_UNIT *derived= this->derived; if (view) - derived= &view->unit; + derived= this->derived= &view->unit; DBUG_ASSERT(derived); DBUG_ASSERT(!derived->is_excluded()); if (!derived->first_select()->exclude_from_table_unique_test) @@ -6860,7 +6940,7 @@ Item *Field_iterator_view::create_item(THD *thd) Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref, LEX_CSTRING *name) { - bool save_wrapper= thd->lex->first_select_lex()->no_wrap_view_item; + bool save_wrapper= thd->lex->current_select->no_wrap_view_item; Item *field= *field_ref; DBUG_ENTER("create_view_field"); @@ -6964,9 +7044,8 @@ void Field_iterator_table_ref::set_field_iterator() table_ref->alias.str)); } /* This is a merge view, so use field_translation. */ - else if (table_ref->field_translation) + else if (table_ref->is_merged_derived() && table_ref->field_translation) { - DBUG_ASSERT(table_ref->is_merged_derived()); field_it= &view_field_it; DBUG_PRINT("info", ("field_it for '%s' is Field_iterator_view", table_ref->alias.str)); @@ -8678,7 +8757,16 @@ int TABLE::update_virtual_fields(handler *h, enum_vcol_update_mode update_mode) if (h->keyread_enabled()) DBUG_RETURN(0); - + /* + TODO: this imposes memory leak until table flush when save_in_field() + does expr_arena allocation. F.ex. case in + gcol.gcol_supported_sql_funcs_innodb (see CONVERT_TZ): + + create table t1 ( + a datetime, b datetime generated always as + (convert_tz(a, 'MET', 'UTC')) virtual); + insert into t1 values ('2008-08-31', default); + */ in_use->set_n_backup_active_arena(expr_arena, &backup_arena); /* When reading or deleting row, ignore errors from virtual columns */ @@ -8749,10 +8837,12 @@ int TABLE::update_virtual_fields(handler *h, enum_vcol_update_mode update_mode) if (update) { - int field_error __attribute__((unused)) = 0; /* Compute the actual value of the virtual fields */ DBUG_FIX_WRITE_SET(vf); - field_error= vcol_info->expr->save_in_field(vf, 0); +# ifdef DBUG_TRACE + int field_error= +# endif + vcol_info->expr->save_in_field(vf, 0); DBUG_RESTORE_WRITE_SET(vf); DBUG_PRINT("info", ("field '%s' - updated error: %d", vf->field_name.str, field_error)); @@ -8780,12 +8870,33 @@ int TABLE::update_virtual_fields(handler *h, enum_vcol_update_mode update_mode) DBUG_RETURN(in_use->is_error()); } -int TABLE::update_virtual_field(Field *vf) +/* + Calculate the virtual field value for a specified field. + @param vf A field to calculate + @param ignore_warnings Ignore the warnings and also make the + calculations permissive. This usually means + that a calculation is internal and is not + expected to fail. +*/ +int TABLE::update_virtual_field(Field *vf, bool ignore_warnings) { DBUG_ENTER("TABLE::update_virtual_field"); Query_arena backup_arena; Counting_error_handler count_errors; + Suppress_warnings_error_handler warning_handler; in_use->push_internal_handler(&count_errors); + bool abort_on_warning= ignore_warnings; + if (ignore_warnings) + { + abort_on_warning= in_use->abort_on_warning; + in_use->abort_on_warning= false; + in_use->push_internal_handler(&warning_handler); + } + /* + TODO: this may impose memory leak until table flush. + See comment in + TABLE::update_virtual_fields(handler *, enum_vcol_update_mode). + */ in_use->set_n_backup_active_arena(expr_arena, &backup_arena); bitmap_clear_all(&tmp_set); vf->vcol_info->expr->walk(&Item::update_vcol_processor, 0, &tmp_set); @@ -8794,6 +8905,13 @@ int TABLE::update_virtual_field(Field *vf) DBUG_RESTORE_WRITE_SET(vf); in_use->restore_active_arena(expr_arena, &backup_arena); in_use->pop_internal_handler(); + if (ignore_warnings) + { + in_use->abort_on_warning= abort_on_warning; + in_use->pop_internal_handler(); + // This is an internal calculation, we expect it to always succeed + DBUG_ASSERT(count_errors.errors == 0); + } DBUG_RETURN(count_errors.errors); } @@ -8826,6 +8944,11 @@ int TABLE::update_default_fields(bool ignore_errors) DBUG_ENTER("TABLE::update_default_fields"); DBUG_ASSERT(default_field); + /* + TODO: this may impose memory leak until table flush. + See comment in + TABLE::update_virtual_fields(handler *, enum_vcol_update_mode). + */ in_use->set_n_backup_active_arena(expr_arena, &backup_arena); /* Iterate over fields with default functions in the table */ @@ -8862,6 +8985,7 @@ int TABLE::update_generated_fields() res= found_next_number_field->set_default(); if (likely(!res)) res= file->update_auto_increment(); + next_number_field= NULL; } if (likely(!res) && vfield) @@ -8962,7 +9086,7 @@ bool TABLE::check_period_overlaps(const KEY &key, return false; uint kp_len= key.key_part[part_nr].length; if (f->cmp_prefix(f->ptr_in_record(lhs), f->ptr_in_record(rhs), - kp_len) != 0) + kp_len / f->charset()->mbmaxlen) != 0) return false; } @@ -8980,24 +9104,29 @@ bool TABLE::check_period_overlaps(const KEY &key, void TABLE::vers_update_fields() { - bitmap_set_bit(write_set, vers_start_field()->field_index); - bitmap_set_bit(write_set, vers_end_field()->field_index); - if (!vers_write) { file->column_bitmaps_signal(); return; } - if (versioned(VERS_TIMESTAMP) && - vers_start_field()->store_timestamp(in_use->query_start(), - in_use->query_start_sec_part())) + if (versioned(VERS_TIMESTAMP)) { - DBUG_ASSERT(0); + bitmap_set_bit(write_set, vers_start_field()->field_index); + if (vers_start_field()->store_timestamp(in_use->query_start(), + in_use->query_start_sec_part())) + { + DBUG_ASSERT(0); + } + vers_start_field()->set_has_explicit_value(); + bitmap_set_bit(read_set, vers_start_field()->field_index); } + bitmap_set_bit(write_set, vers_end_field()->field_index); vers_end_field()->set_max(); + vers_end_field()->set_has_explicit_value(); bitmap_set_bit(read_set, vers_end_field()->field_index); + file->column_bitmaps_signal(); if (vfield) update_virtual_fields(file, VCOL_UPDATE_FOR_READ); @@ -9009,6 +9138,7 @@ void TABLE::vers_update_end() if (vers_end_field()->store_timestamp(in_use->query_start(), in_use->query_start_sec_part())) DBUG_ASSERT(0); + vers_end_field()->set_has_explicit_value(); } /** @@ -9139,6 +9269,62 @@ bool TABLE::validate_default_values_of_unset_fields(THD *thd) const } +/* + Check assignment compatibility of a value list against an explicitly + specified field list, e.g. + INSERT INTO t1 (a,b) VALUES (1,2); +*/ +bool TABLE::check_assignability_explicit_fields(List fields, + List values, + bool ignore) +{ + DBUG_ENTER("TABLE::check_assignability_explicit_fields"); + DBUG_ASSERT(fields.elements == values.elements); + + List_iterator fi(fields); + List_iterator vi(values); + Item *f, *value; + while ((f= fi++) && (value= vi++)) + { + Item_field *item_field= f->field_for_view_update(); + if (!item_field) + { + /* + A non-updatable field of a view found. + This scenario is caught later and an error is raised. + We could eventually move error reporting here. For now just continue. + */ + continue; + } + if (value->check_assignability_to(item_field->field, ignore)) + DBUG_RETURN(true); + } + DBUG_RETURN(false); +} + + +/* + Check assignment compatibility for a value list against + all visible fields of the table, e.g. + INSERT INTO t1 VALUES (1,2); +*/ +bool TABLE::check_assignability_all_visible_fields(List &values, + bool ignore) const +{ + DBUG_ENTER("TABLE::check_assignability_all_visible_fields"); + DBUG_ASSERT(s->visible_fields == values.elements); + + List_iterator vi(values); + for (uint i= 0; i < s->fields; i++) + { + if (!field[i]->invisible && + (vi++)->check_assignability_to(field[i], ignore)) + DBUG_RETURN(true); + } + DBUG_RETURN(false); +} + + bool TABLE::insert_all_rows_into_tmp_table(THD *thd, TABLE *tmp_table, TMP_TABLE_PARAM *tmp_table_param, @@ -9317,6 +9503,29 @@ void TABLE_LIST::wrap_into_nested_join(List &join_list) } +/** + Check whether optimization has been performed and a derived table either + been merged to upper select level or materialized. + + @param table a TABLE_LIST object containing a derived table + + @return true in case the derived table has been merged to surrounding select, + false otherwise +*/ + +static inline bool derived_table_optimization_done(TABLE_LIST *table) +{ + SELECT_LEX_UNIT *derived= (table->derived ? + table->derived : + (table->view ? + &table->view->unit: + NULL)); + return derived && + (derived->is_excluded() || + table->is_materialized_derived()); +} + + /** @brief Initialize this derived table/view @@ -9367,22 +9576,36 @@ bool TABLE_LIST::init_derived(THD *thd, bool init_view) } } - if (init_view && !view) + if (init_view && !view && + !derived_table_optimization_done(this)) { /* This is all what we can do for a derived table for now. */ set_derived(); } - if (!is_view()) + if (!derived_table_optimization_done(this)) { /* A subquery might be forced to be materialized due to a side-effect. */ - if (!is_materialized_derived() && first_select->is_mergeable() && - (unit->outer_select() && !unit->outer_select()->with_rownum) && + if (!is_materialized_derived() && unit->can_be_merged() && + /* + Following is special case of + SELECT * FROM () WHERE ROWNUM() <= nnn + */ + (unit->outer_select() && + !(unit->outer_select()->with_rownum && + unit->outer_select()->table_list.elements == 1 && + (thd->lex->sql_command == SQLCOM_SELECT || + !unit->outer_select()->is_query_topmost(thd)) && + !is_view())) && + (!thd->lex->with_rownum || (!first_select->group_list.elements && !first_select->order_list.elements)) && - optimizer_flag(thd, OPTIMIZER_SWITCH_DERIVED_MERGE) && - !thd->lex->can_not_use_merged(1) && + (is_view() || + optimizer_flag(thd, OPTIMIZER_SWITCH_DERIVED_MERGE)) && + !thd->lex->can_not_use_merged() && + !((thd->lex->sql_command == SQLCOM_UPDATE_MULTI || + thd->lex->sql_command == SQLCOM_DELETE_MULTI) && !is_view()) && !is_recursive_with_table()) set_merged_derived(); else @@ -9497,15 +9720,17 @@ bool TABLE_LIST::change_refs_to_fields() List_iterator li(used_items); Item_direct_ref *ref; Field_iterator_view field_it; + Name_resolution_context *ctx; THD *thd= table->in_use; + Item **materialized_items; DBUG_ASSERT(is_merged_derived()); if (!used_items.elements) return FALSE; - Item **materialized_items= - (Item **)thd->calloc(sizeof(void *) * table->s->fields); - if (!materialized_items) + materialized_items= (Item **)thd->calloc(sizeof(void *) * table->s->fields); + ctx= new (thd->mem_root) Name_resolution_context(this); + if (!materialized_items || !ctx) return TRUE; while ((ref= (Item_direct_ref*)li++)) @@ -9521,7 +9746,8 @@ bool TABLE_LIST::change_refs_to_fields() DBUG_ASSERT(!field_it.end_of_fields()); if (!materialized_items[idx]) { - materialized_items[idx]= new (thd->mem_root) Item_field(thd, table->field[idx]); + materialized_items[idx]= + new (thd->mem_root) Item_field(thd, ctx, table->field[idx]); if (!materialized_items[idx]) return TRUE; } @@ -9565,6 +9791,73 @@ bool TABLE_LIST::is_with_table() return derived && derived->with_element; } + +/** + Check if the definition are the same. + + If versions do not match it check definitions (with checking and setting + trigger definition versions (times) + + @param[in] view TABLE_LIST of the view + @param[in] share Share object of view + + @return false on error or different definitions. + + @sa check_and_update_table_version() +*/ + +bool TABLE_LIST::is_the_same_definition(THD* thd, TABLE_SHARE *s) +{ + enum enum_table_ref_type tp= s->get_table_ref_type(); + if (m_table_ref_type == tp) + { + /* + Cache have not changed which means that definition was not changed + including triggers + */ + if (m_table_ref_version == s->get_table_ref_version()) + return TRUE; + + /* + If cache changed then check content version + */ + if ((tabledef_version.length && + tabledef_version.length == s->tabledef_version.length && + memcmp(tabledef_version.str, s->tabledef_version.str, + tabledef_version.length) == 0)) + { + // Definition have not changed, let's check if triggers changed. + if (table && table->triggers) + { + + my_hrtime_t hr_stmt_prepare= thd->hr_prepare_time; + if (hr_stmt_prepare.val) + for(uint i= 0; i < TRG_EVENT_MAX; i++) + for (uint j= 0; j < TRG_ACTION_MAX; j++) + { + Trigger *tr= + table->triggers->get_trigger((trg_event_type)i, + (trg_action_time_type)j); + if (tr) + if (hr_stmt_prepare.val <= tr->hr_create_time.val) + { + set_tabledef_version(s); + return FALSE; + } + } + } + set_table_id(s); + return TRUE; + } + else + tabledef_version.length= 0; + } + else + set_tabledef_version(s); + return FALSE; +} + + uint TABLE_SHARE::actual_n_key_parts(THD *thd) { return use_ext_keys && diff --git a/sql/table.h b/sql/table.h index 221e18bc9264d..83abc10797115 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1,7 +1,7 @@ #ifndef TABLE_INCLUDED #define TABLE_INCLUDED /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB + Copyright (c) 2009, 2022, 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 @@ -36,12 +36,26 @@ #include "sql_type.h" /* vers_kind_t */ #include "privilege.h" /* privilege_t */ +/* + Buffer for unix timestamp in microseconds: + 9,223,372,036,854,775,807 (signed int64 maximal value) + 1 234 567 890 123 456 789 + + Note: we can use unsigned for calculation, but practically they + are the same by probability to overflow them (signed int64 in + microseconds is enough for almost 3e5 years) and signed allow to + avoid increasing the buffer (the old buffer for human readable + date was 19+1). +*/ +#define MICROSECOND_TIMESTAMP_BUFFER_SIZE (19 + 1) + /* Structs that defines the TABLE */ class Item; /* Needed by ORDER */ typedef Item (*Item_ptr); class Item_subselect; class Item_field; +class Item_func_hash; class GRANT_TABLE; class st_select_lex_unit; class st_select_lex; @@ -72,6 +86,8 @@ class Table_function_json_table; */ typedef ulonglong nested_join_map; +#define VIEW_MD5_LEN 32 + #define tmp_file_prefix "#sql" /**< Prefix for tmp tables */ #define tmp_file_prefix_length 4 @@ -120,14 +136,13 @@ class Object_creation_ctx void restore_env(THD *thd, Object_creation_ctx *backup_ctx); protected: - Object_creation_ctx() {} + Object_creation_ctx() = default; virtual Object_creation_ctx *create_backup_ctx(THD *thd) const = 0; virtual void change_env(THD *thd) const = 0; public: - virtual ~Object_creation_ctx() - { } + virtual ~Object_creation_ctx() = default; }; /*************************************************************************/ @@ -534,7 +549,7 @@ class Table_check_intact public: Table_check_intact(bool keys= false) : has_keys(keys) {} - virtual ~Table_check_intact() {} + virtual ~Table_check_intact() = default; /** Checks whether a table is intact. */ bool check(TABLE *table, const TABLE_FIELD_DEF *table_def); @@ -711,7 +726,7 @@ class TABLE_STATISTICS_CB struct TABLE_SHARE { - TABLE_SHARE() {} /* Remove gcc warning */ + TABLE_SHARE() = default; /* Remove gcc warning */ /** Category of this table. */ TABLE_CATEGORY table_category; @@ -860,7 +875,6 @@ struct TABLE_SHARE /* This is set for temporary tables where CREATE was binary logged */ bool table_creation_was_logged; bool non_determinstic_insert; - bool vcols_need_refixing; bool has_update_default_function; bool can_do_row_logging; /* 1 if table supports RBR */ bool long_unique_table; @@ -1097,7 +1111,7 @@ struct TABLE_SHARE with a base table, a base table is replaced with a temporary table and so on. - @sa TABLE_LIST::is_table_ref_id_equal() + @sa TABLE_LIST::is_the_same_definition() */ ulong get_table_ref_version() const { @@ -1163,6 +1177,21 @@ struct TABLE_SHARE void set_overlapped_keys(); void set_ignored_indexes(); key_map usable_indexes(THD *thd); + + bool old_long_hash_function() const + { + return mysql_version < 100428 || + (mysql_version >= 100500 && mysql_version < 100519) || + (mysql_version >= 100600 && mysql_version < 100612) || + (mysql_version >= 100700 && mysql_version < 100708) || + (mysql_version >= 100800 && mysql_version < 100807) || + (mysql_version >= 100900 && mysql_version < 100905) || + (mysql_version >= 101000 && mysql_version < 101003) || + (mysql_version >= 101100 && mysql_version < 101102); + } + Item_func_hash *make_long_hash_func(THD *thd, + MEM_ROOT *mem_root, + List *field_list) const; }; /* not NULL, but cannot be dereferenced */ @@ -1239,7 +1268,7 @@ struct vers_select_conds_t; struct TABLE { - TABLE() {} /* Remove gcc warning */ + TABLE() = default; /* Remove gcc warning */ TABLE_SHARE *s; handler *file; @@ -1492,8 +1521,15 @@ struct TABLE */ bool auto_increment_field_not_null; bool insert_or_update; /* Can be used by the handler */ + /* + NOTE: alias_name_used is only a hint! It works only in need_correct_ident() + condition. On other cases it is FALSE even if table_name is alias. + + E.g. in update t1 as x set a = 1 + */ bool alias_name_used; /* true if table_name is alias */ bool get_fields_in_item_tree; /* Signal to fix_field */ + List vcol_refix_list; private: bool m_needs_reopen; bool created; /* For tmp tables. TRUE <=> tmp table was actually created.*/ @@ -1636,7 +1672,11 @@ struct TABLE } /// Return true if table is instantiated, and false otherwise. - bool is_created() const { return created; } + bool is_created() const + { + DBUG_ASSERT(!created || file != 0); + return created; + } /** Set the table as "created", and enable flags in storage engine @@ -1651,6 +1691,11 @@ struct TABLE created= true; } + void reset_created() + { + created= 0; + } + /* Returns TRUE if the table is filled at execution phase (and so, the optimizer must not do anything that depends on the contents of the table, @@ -1671,7 +1716,7 @@ struct TABLE uint actual_n_key_parts(KEY *keyinfo); ulong actual_key_flags(KEY *keyinfo); - int update_virtual_field(Field *vf); + int update_virtual_field(Field *vf, bool ignore_warnings); int update_virtual_fields(handler *h, enum_vcol_update_mode update_mode); int update_default_fields(bool ignore_errors); void evaluate_update_default_function(); @@ -1685,11 +1730,36 @@ struct TABLE Field **field_to_fill(); bool validate_default_values_of_unset_fields(THD *thd) const; + // Check if the value list is assignable to the explicit field list + static bool check_assignability_explicit_fields(List fields, + List values, + bool ignore); + // Check if the value list is assignable to all visible fields + bool check_assignability_all_visible_fields(List &values, + bool ignore) const; + /* + Check if the value list is assignable to: + - The explicit field list if fields.elements > 0, e.g. + INSERT INTO t1 (a,b) VALUES (1,2); + - All visible fields, if fields.elements==0, e.g. + INSERT INTO t1 VALUES (1,2); + */ + bool check_assignability_opt_fields(List fields, + List values, + bool ignore) const + { + DBUG_ASSERT(values.elements); + return fields.elements ? + check_assignability_explicit_fields(fields, values, ignore) : + check_assignability_all_visible_fields(values, ignore); + } + bool insert_all_rows_into_tmp_table(THD *thd, TABLE *tmp_table, TMP_TABLE_PARAM *tmp_table_param, bool with_cleanup); - int fix_vcol_exprs(THD *thd); + bool vcol_fix_expr(THD *thd); + bool vcol_cleanup_expr(THD *thd); Field *find_field_by_name(LEX_CSTRING *str) const; bool export_structure(THD *thd, class Row_definition_list *defs); bool is_splittable() { return spl_opt_info != NULL; } @@ -1779,7 +1849,9 @@ struct TABLE bool vers_check_update(List &items); static bool check_period_overlaps(const KEY &key, const uchar *lhs, const uchar *rhs); int delete_row(); + /* Used in majority of DML (called from fill_record()) */ void vers_update_fields(); + /* Used in DELETE, DUP REPLACE and insert history row */ void vers_update_end(); void find_constraint_correlated_indexes(); @@ -2138,7 +2210,7 @@ class Index_hint; struct TABLE_CHAIN { - TABLE_CHAIN() {} + TABLE_CHAIN() = default; TABLE_LIST **start_pos; TABLE_LIST ** end_pos; @@ -2149,7 +2221,7 @@ struct TABLE_CHAIN struct TABLE_LIST { - TABLE_LIST() {} /* Remove gcc warning */ + TABLE_LIST() = default; /* Remove gcc warning */ enum prelocking_types { @@ -2433,6 +2505,12 @@ struct TABLE_LIST to view with SQL SECURITY DEFINER) */ Security_context *security_ctx; + uchar tabledef_version_buf[MY_UUID_SIZE > + MICROSECOND_TIMESTAMP_BUFFER_SIZE-1 ? + MY_UUID_SIZE + 1 : + MICROSECOND_TIMESTAMP_BUFFER_SIZE]; + LEX_CUSTRING tabledef_version; + /* This view security context (non-zero only for views with SQL SECURITY DEFINER) @@ -2446,7 +2524,7 @@ struct TABLE_LIST LEX_CSTRING source; /* source of CREATE VIEW */ LEX_CSTRING view_db; /* saved view database */ LEX_CSTRING view_name; /* saved view name */ - LEX_STRING timestamp; /* GMT time stamp of last operation */ + LEX_STRING hr_timestamp; /* time stamp of last operation */ LEX_USER definer; /* definer of view */ ulonglong file_version; /* version of file's field set */ ulonglong mariadb_version; /* version of server on creation */ @@ -2530,7 +2608,7 @@ struct TABLE_LIST /* TABLE_TYPE_UNKNOWN if any type is acceptable */ Table_type required_type; handlerton *db_type; /* table_type for handler */ - char timestamp_buffer[MAX_DATETIME_WIDTH + 1]; + char timestamp_buffer[MICROSECOND_TIMESTAMP_BUFFER_SIZE]; /* This TABLE_LIST object is just placeholder for prelocking, it will be used for implicit LOCK TABLES only and won't be used in real statement. @@ -2652,6 +2730,8 @@ struct TABLE_LIST } void print(THD *thd, table_map eliminated_tables, String *str, enum_query_type query_type); + void print_leaf_tables(THD *thd, String *str, + enum_query_type query_type); bool check_single_table(TABLE_LIST **table, table_map map, TABLE_LIST *view); bool set_insert_values(MEM_ROOT *mem_root); @@ -2728,19 +2808,7 @@ struct TABLE_LIST */ bool process_index_hints(TABLE *table); - /** - Compare the version of metadata from the previous execution - (if any) with values obtained from the current table - definition cache element. - - @sa check_and_update_table_version() - */ - inline bool is_table_ref_id_equal(TABLE_SHARE *s) const - { - return (m_table_ref_type == s->get_table_ref_type() && - m_table_ref_version == s->get_table_ref_version()); - } - + bool is_the_same_definition(THD *thd, TABLE_SHARE *s); /** Record the value of metadata version of the corresponding table definition cache element in this parse tree node. @@ -2757,6 +2825,26 @@ struct TABLE_LIST m_table_ref_version= table_ref_version_arg; } + void set_table_id(TABLE_SHARE *s) + { + set_table_ref_id(s); + set_tabledef_version(s); + } + + void set_tabledef_version(TABLE_SHARE *s) + { + if (!tabledef_version.length && s->tabledef_version.length) + { + DBUG_ASSERT(s->tabledef_version.length < + sizeof(tabledef_version_buf)); + tabledef_version.str= tabledef_version_buf; + memcpy(tabledef_version_buf, s->tabledef_version.str, + (tabledef_version.length= s->tabledef_version.length)); + // safety + tabledef_version_buf[tabledef_version.length]= 0; + } + } + /* Set of functions returning/setting state of a derived table/view. */ bool is_non_derived() const { return (!derived_type); } bool is_view_or_derived() const { return derived_type; } @@ -2784,8 +2872,7 @@ struct TABLE_LIST DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", (alias.str ? alias.str : ""), get_unit())); - derived_type= static_cast((derived_type & DTYPE_MASK) | - DTYPE_TABLE | DTYPE_MERGE); + derived_type= static_cast((derived_type & DTYPE_MASK) | DTYPE_MERGE); set_check_merged(); DBUG_VOID_RETURN; } @@ -2799,10 +2886,9 @@ struct TABLE_LIST DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", (alias.str ? alias.str : ""), get_unit())); - derived= get_unit(); derived_type= static_cast((derived_type & (derived ? DTYPE_MASK : DTYPE_VIEW)) | - DTYPE_TABLE | DTYPE_MATERIALIZE); + DTYPE_MATERIALIZE); set_check_materialized(); DBUG_VOID_RETURN; } @@ -2870,6 +2956,12 @@ struct TABLE_LIST } } + inline void set_view_def_version(LEX_STRING *version) + { + m_table_ref_type= TABLE_REF_VIEW; + tabledef_version.str= (const uchar *) version->str; + tabledef_version.length= version->length; + } private: bool prep_check_option(THD *thd, uint8 check_opt_type); bool prep_where(THD *thd, Item **conds, bool no_where_clause); @@ -2894,8 +2986,8 @@ class Item; class Field_iterator: public Sql_alloc { public: - Field_iterator() {} /* Remove gcc warning */ - virtual ~Field_iterator() {} + Field_iterator() = default; /* Remove gcc warning */ + virtual ~Field_iterator() = default; virtual void set(TABLE_LIST *)= 0; virtual void next()= 0; virtual bool end_of_fields()= 0; /* Return 1 at end of list */ @@ -2956,7 +3048,7 @@ class Field_iterator_natural_join: public Field_iterator Natural_join_column *cur_column_ref; public: Field_iterator_natural_join() :cur_column_ref(NULL) {} - ~Field_iterator_natural_join() {} + ~Field_iterator_natural_join() = default; void set(TABLE_LIST *table); void next(); bool end_of_fields() { return !cur_column_ref; } @@ -3179,9 +3271,6 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, bool is_create_table, List *partitions_to_open= NULL); bool copy_keys_from_share(TABLE *outparam, MEM_ROOT *root); -bool fix_session_vcol_expr(THD *thd, Virtual_column_info *vcol); -bool fix_session_vcol_expr_for_read(THD *thd, Field *field, - Virtual_column_info *vcol); bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, bool *error_reported, vcol_init_mode expr); TABLE_SHARE *alloc_table_share(const char *db, const char *table_name, @@ -3198,6 +3287,7 @@ void open_table_error(TABLE_SHARE *share, enum open_frm_error error, void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form); bool check_db_name(LEX_STRING *db); bool check_column_name(const char *name); +bool check_period_name(const char *name); bool check_table_name(const char *name, size_t length, bool check_for_path_chars); int rename_file_ext(const char * from,const char * to,const char * ext); char *get_field(MEM_ROOT *mem, Field *field); diff --git a/sql/table_cache.cc b/sql/table_cache.cc index 2e9fb34c17e71..8fb3a559d86e6 100644 --- a/sql/table_cache.cc +++ b/sql/table_cache.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. - Copyright (c) 2010, 2011 Monty Program Ab + Copyright (c) 2010, 2022, MariaDB Corporation. Copyright (C) 2013 Sergey Vojtovich and MariaDB Foundation This program is free software; you can redistribute it and/or modify @@ -50,6 +50,7 @@ #include "lf.h" #include "table.h" #include "sql_base.h" +#include "aligned.h" /** Configuration. */ @@ -122,6 +123,7 @@ struct Table_cache_instance records, Share_free_tables::List (TABLE::prev and TABLE::next), TABLE::in_use. */ + alignas(CPU_LEVEL1_DCACHE_LINESIZE) mysql_mutex_t LOCK_table_cache; I_P_List , @@ -130,11 +132,10 @@ struct Table_cache_instance ulong records; uint mutex_waits; uint mutex_nowaits; - /** Avoid false sharing between instances */ - char pad[CPU_LEVEL1_DCACHE_LINESIZE]; Table_cache_instance(): records(0), mutex_waits(0), mutex_nowaits(0) { + static_assert(!(sizeof(*this) % CPU_LEVEL1_DCACHE_LINESIZE), "alignment"); mysql_mutex_init(key_LOCK_table_cache, &LOCK_table_cache, MY_MUTEX_INIT_FAST); } @@ -146,6 +147,10 @@ struct Table_cache_instance DBUG_ASSERT(records == 0); } + static void *operator new[](size_t size) + { return aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE); } + static void operator delete[](void *ptr) { aligned_free(ptr); } + /** Lock table cache mutex and check contention. diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc index 981958abdb2c2..3ba6a7725499b 100644 --- a/sql/temporary_tables.cc +++ b/sql/temporary_tables.cc @@ -340,7 +340,8 @@ bool THD::open_temporary_table(TABLE_LIST *tl) */ DBUG_ASSERT(!tl->derived); DBUG_ASSERT(!tl->schema_table); - DBUG_ASSERT(has_temporary_tables()); + DBUG_ASSERT(has_temporary_tables() || + (rgi_slave && rgi_slave->is_parallel_exec)); if (tl->open_type == OT_BASE_ONLY) { @@ -625,6 +626,10 @@ bool THD::drop_temporary_table(TABLE *table, bool *is_trans, bool delete_table) DBUG_PRINT("tmptable", ("Dropping table: '%s'.'%s'", table->s->db.str, table->s->table_name.str)); + // close all handlers in case it is statement abort and some can be left + if (is_error()) + table->file->ha_reset(); + locked= lock_temporary_tables(); share= tmp_table_share(table); @@ -666,7 +671,7 @@ bool THD::drop_temporary_table(TABLE *table, bool *is_trans, bool delete_table) temporary_tables->remove(share); /* Free the TABLE_SHARE and/or delete the files. */ - free_tmp_table_share(share, delete_table); + result= free_tmp_table_share(share, delete_table); end: if (locked) @@ -697,9 +702,7 @@ bool THD::rm_temporary_table(handlerton *base, const char *path) char frm_path[FN_REFLEN + 1]; strxnmov(frm_path, sizeof(frm_path) - 1, path, reg_ext, NullS); - if (mysql_file_delete(key_file_frm, frm_path, - MYF(MY_WME | MY_IGNORE_ENOENT))) - error= true; + if (base->drop_table(base, path) > 0) { error= true; @@ -707,6 +710,10 @@ bool THD::rm_temporary_table(handlerton *base, const char *path) path, my_errno); } + if (mysql_file_delete(key_file_frm, frm_path, + MYF(MY_WME | MY_IGNORE_ENOENT))) + error= true; + DBUG_RETURN(error); } @@ -872,12 +879,20 @@ void THD::restore_tmp_table_share(TMP_TABLE_SHARE *share) bool THD::has_temporary_tables() { DBUG_ENTER("THD::has_temporary_tables"); - bool result= + bool result; #ifdef HAVE_REPLICATION - rgi_slave ? (rgi_slave->rli->save_temporary_tables && - !rgi_slave->rli->save_temporary_tables->is_empty()) : + if (rgi_slave) + { + mysql_mutex_lock(&rgi_slave->rli->data_lock); + result= rgi_slave->rli->save_temporary_tables && + !rgi_slave->rli->save_temporary_tables->is_empty(); + mysql_mutex_unlock(&rgi_slave->rli->data_lock); + } + else #endif - has_thd_temporary_tables(); + { + result= has_thd_temporary_tables(); + } DBUG_RETURN(result); } @@ -906,9 +921,8 @@ bool THD::has_temporary_tables() uint THD::create_tmp_table_def_key(char *key, const char *db, const char *table_name) { - DBUG_ENTER("THD::create_tmp_table_def_key"); - uint key_length; + DBUG_ENTER("THD::create_tmp_table_def_key"); key_length= tdc_create_key(key, db, table_name); int4store(key + key_length, variables.server_id); @@ -1157,11 +1171,10 @@ TABLE *THD::open_temporary_table(TMP_TABLE_SHARE *share, */ bool THD::find_and_use_tmp_table(const TABLE_LIST *tl, TABLE **out_table) { - DBUG_ENTER("THD::find_and_use_tmp_table"); - char key[MAX_DBKEY_LENGTH]; uint key_length; bool result; + DBUG_ENTER("THD::find_and_use_tmp_table"); key_length= create_tmp_table_def_key(key, tl->get_db_name(), tl->get_table_name()); @@ -1451,20 +1464,21 @@ bool THD::log_events_and_free_tmp_shares() @param share [IN] TABLE_SHARE to free @param delete_table [IN] Whether to delete the table files? - @return void + @return false Success + true Error */ -void THD::free_tmp_table_share(TMP_TABLE_SHARE *share, bool delete_table) +bool THD::free_tmp_table_share(TMP_TABLE_SHARE *share, bool delete_table) { + bool error= false; DBUG_ENTER("THD::free_tmp_table_share"); if (delete_table) { - rm_temporary_table(share->db_type(), share->path.str); + error= rm_temporary_table(share->db_type(), share->path.str); } free_table_share(share); my_free(share); - - DBUG_VOID_RETURN; + DBUG_RETURN(error); } diff --git a/sql/threadpool.h b/sql/threadpool.h index 7737d056b4a86..d815d538cde7b 100644 --- a/sql/threadpool.h +++ b/sql/threadpool.h @@ -102,8 +102,7 @@ struct TP_connection priority(TP_PRIORITY_HIGH) {} - virtual ~TP_connection() - {}; + virtual ~TP_connection() = default; /* Initialize io structures windows threadpool, epoll etc */ virtual int init() = 0; @@ -121,7 +120,7 @@ struct TP_connection struct TP_pool { - virtual ~TP_pool(){}; + virtual ~TP_pool() = default; virtual int init()= 0; virtual TP_connection *new_connection(CONNECT *)= 0; virtual void add(TP_connection *c)= 0; diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index 97c6c317cc4ff..78f9eaf8792f1 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -92,13 +92,13 @@ struct Worker_thread_context PSI_thread *psi_thread; st_my_thread_var* mysys_var; - void save() + Worker_thread_context() { psi_thread= PSI_CALL_get_thread(); mysys_var= my_thread_var; } - void restore() + ~Worker_thread_context() { PSI_CALL_set_thread(psi_thread); set_mysys_var(mysys_var); @@ -142,6 +142,44 @@ static inline void set_thd_idle(THD *thd) #endif } +/* + Per OS thread info (ID and pthread_self) + stored as TLS, because of syscall overhead + (on Linux) +*/ +struct OS_thread_info +{ + pthread_t self; + ssize_t stack_size; + uint32_t thread_id; + + inline bool initialized() { return stack_size != 0; } + + void init(ssize_t ssize) + { +#if _WIN32 + self= thread_id= GetCurrentThreadId(); +#else +#ifdef __NR_gettid + thread_id= (uint32) syscall(__NR_gettid); +#else + thread_id= 0; +#endif + self= pthread_self(); +#endif + stack_size= ssize; + } +}; +static thread_local OS_thread_info os_thread_info; + +static const OS_thread_info *get_os_thread_info() +{ + auto *res= &os_thread_info; + if (!res->initialized()) + res->init((ssize_t) (my_thread_stack_size * STACK_DIRECTION)); + return res; +} + /* Attach/associate the connection with the OS thread, */ @@ -154,7 +192,12 @@ static void thread_attach(THD* thd) #endif /* WITH_WSREP */ set_mysys_var(thd->mysys_var); thd->thread_stack=(char*)&thd; - thd->store_globals(); + set_current_thd(thd); + auto tinfo= get_os_thread_info(); + thd->real_id= tinfo->self; + thd->os_thread_id= tinfo->thread_id; + DBUG_ASSERT(thd->mysys_var == my_thread_var); + thd->mysys_var->stack_ends_here= thd->thread_stack + tinfo->stack_size; PSI_CALL_set_thread(thd->get_psi()); mysql_socket_set_thread_owner(thd->net.vio->mysql_socket); } @@ -179,7 +222,6 @@ void tp_callback(TP_connection *c) DBUG_ASSERT(c); Worker_thread_context worker_context; - worker_context.save(); THD *thd= c->thd; @@ -212,7 +254,6 @@ void tp_callback(TP_connection *c) thd->async_state.m_state = thd_async_state::enum_async_state::RESUMED; goto retry; } - worker_context.restore(); return; case DISPATCH_COMMAND_CLOSE_CONNECTION: /* QUIT or an error occurred. */ @@ -231,8 +272,6 @@ void tp_callback(TP_connection *c) c->state= TP_STATE_IDLE; if (c->start_io()) goto error; - - worker_context.restore(); return; error: @@ -242,7 +281,6 @@ void tp_callback(TP_connection *c) threadpool_remove_connection(thd); } delete c; - worker_context.restore(); } @@ -250,14 +288,6 @@ static THD *threadpool_add_connection(CONNECT *connect, TP_connection *c) { THD *thd= NULL; - DBUG_EXECUTE_IF("CONNECT_wait", - { - extern Dynamic_array listen_sockets; - DBUG_ASSERT(listen_sockets.size()); - while (listen_sockets.size()) - my_sleep(1000); - }); - /* Create a new connection context: mysys_thread_var and PSI thread Store them in THD. diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc index eb08441a4d5af..7261eabfd8296 100644 --- a/sql/threadpool_generic.cc +++ b/sql/threadpool_generic.cc @@ -1574,8 +1574,7 @@ static void *worker_main(void *param) } -TP_pool_generic::TP_pool_generic() -{} +TP_pool_generic::TP_pool_generic() = default; int TP_pool_generic::init() { diff --git a/sql/threadpool_winsockets.cc b/sql/threadpool_winsockets.cc index 41167781283d1..a214cda2a5c96 100644 --- a/sql/threadpool_winsockets.cc +++ b/sql/threadpool_winsockets.cc @@ -114,8 +114,17 @@ void AIO_buffer_cache::clear() if (!m_base) return; - /* Check that all items are returned to the cache. */ - DBUG_ASSERT(m_cache.size() == m_elements); + std::unique_lock lk(m_mtx, std::defer_lock); + for(;;) + { + if (lk.try_lock()) + { + if (m_cache.size() == m_elements) + break; + lk.unlock(); + } + Sleep(100); + } VirtualFree(m_base, 0, MEM_RELEASE); m_cache.clear(); m_base= 0; diff --git a/sql/tztime.cc b/sql/tztime.cc index 1f393e24ec26e..8ddb9f0e30ebf 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -1027,7 +1027,7 @@ static const String tz_SYSTEM_name("SYSTEM", 6, &my_charset_latin1); class Time_zone_system : public Time_zone { public: - Time_zone_system() {} /* Remove gcc warning */ + Time_zone_system() = default; /* Remove gcc warning */ virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, uint *error_code) const; virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const; virtual const String * get_name() const; @@ -1123,7 +1123,7 @@ Time_zone_system::get_name() const class Time_zone_utc : public Time_zone { public: - Time_zone_utc() {} /* Remove gcc warning */ + Time_zone_utc() = default; /* Remove gcc warning */ virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, uint *error_code) const; virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const; @@ -1798,7 +1798,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap) delete thd; if (org_thd) org_thd->store_globals(); /* purecov: inspected */ - + default_tz= default_tz_name ? global_system_variables.time_zone : my_tz_SYSTEM; @@ -1873,7 +1873,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) #ifdef ABBR_ARE_USED char chars[MY_MAX(TZ_MAX_CHARS + 1, (2 * (MY_TZNAME_MAX + 1)))]; #endif - /* + /* Used as a temporary tz_info until we decide that we actually want to allocate and keep the tz info and tz name in tz_storage. */ @@ -2004,7 +2004,11 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) #endif /* ttid is increasing because we are reading using index */ - DBUG_ASSERT(ttid >= tmp_tz_info.typecnt); + if (ttid < tmp_tz_info.typecnt) + { + sql_print_error("mysql.time_zone_transition_type table is incorrectly defined or corrupted"); + goto end; + } tmp_tz_info.typecnt= ttid + 1; @@ -2026,7 +2030,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) mysql.time_zone_transition table. Here we additionally need records in ascending order by index scan also satisfies us. */ - table= tz_tables->table; + table= tz_tables->table; table->field[0]->store((longlong) tzid, TRUE); if (table->file->ha_index_init(0, 1)) goto end; @@ -2361,7 +2365,7 @@ my_tz_find(THD *thd, const String *name) /** Convert leap seconds into non-leap - This function will convert the leap seconds added by the OS to + This function will convert the leap seconds added by the OS to non-leap seconds, e.g. 23:59:59, 23:59:60 -> 23:59:59, 00:00:01 ... This check is not checking for years on purpose : although it's not a complete check this way it doesn't require looking (and having installed) @@ -2428,6 +2432,11 @@ print_tz_as_sql(const char* tz_name, const TIME_ZONE_INFO *sp) } +#define SAVE_ENGINE(e) \ + "'select ENGINE into @" e "_engine" \ + " from information_schema.TABLES" \ + " where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''" e "'''" + /* Print info about leap seconds in time zone as SQL statements populating mysql.time_zone_leap_second table. @@ -2446,12 +2455,11 @@ print_tz_leaps_as_sql(const TIME_ZONE_INFO *sp) For all timezones. */ if (!opt_skip_write_binlog) - printf("\\d |\n" - "IF (select count(*) from information_schema.global_variables where\n" - "variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n" - "ALTER TABLE time_zone_leap_second ENGINE=InnoDB;\n" - "END IF|\n" - "\\d ;\n"); + printf( + "execute immediate if(@wsrep_cannot_replicate_tz, " + SAVE_ENGINE("time_zone_leap_second") ", 'do 0');\n" + "execute immediate if(@wsrep_cannot_replicate_tz, " + "'ALTER TABLE time_zone_leap_second ENGINE=InnoDB', 'do 0');\n"); printf("TRUNCATE TABLE time_zone_leap_second;\n"); @@ -2466,12 +2474,10 @@ print_tz_leaps_as_sql(const TIME_ZONE_INFO *sp) } if (!opt_skip_write_binlog) - printf("\\d |\n" - "IF (select count(*) from information_schema.global_variables where\n" - "variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n" - "ALTER TABLE time_zone_leap_second ENGINE=Aria;\n" - "END IF|\n" - "\\d ;\n"); + printf( + "execute immediate if(@wsrep_cannot_replicate_tz, " + "concat('ALTER TABLE time_zone_leap_second ENGINE=', " + "@time_zone_leap_second_engine), 'do 0');\n"); printf("ALTER TABLE time_zone_leap_second ORDER BY Transition_time;\n"); } @@ -2486,15 +2492,6 @@ MEM_ROOT tz_storage; char fullname[FN_REFLEN + 1]; char *root_name_end; -/* - known file types that exist in the zoneinfo directory that are safe to - silently skip -*/ -const char *known_extensions[]= { - ".tab", - NullS -}; - /* Recursively scan zoneinfo directory and print all found time zone @@ -2591,20 +2588,19 @@ scan_tz_dir(char * name_end, uint symlink_recursion_level, uint verbose) else { /* - Some systems (like debian, opensuse etc) have description - files (.tab). We skip these silently if verbose is > 0 + Some systems (like Debian, openSUSE, etc) have non-timezone files: + * iso3166.tab + * leap-seconds.list + * leapseconds + * tzdata.zi + * zone.tab + * zone1970.tab + We skip these silently unless verbose > 0. */ const char *current_ext= fn_ext(fullname); - my_bool known_ext= 0; + my_bool known_ext= strlen(current_ext) || + !strcmp(my_basename(fullname), "leapseconds"); - for (const char **ext= known_extensions ; *ext ; ext++) - { - if (!strcmp(*ext, current_ext)) - { - known_ext= 1; - break; - } - } if (verbose > 0 || !known_ext) { fflush(stdout); @@ -2638,24 +2634,33 @@ static struct my_option my_long_options[] = {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef DBUG_OFF - {"debug", '#', "This is a non-debug version. Catch this and exit", + {"debug", '#', "This is a non-debug version. Catch this and exit.", 0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, #else {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"leap", 'l', "Print the leap second information from the given time zone file. By convention, when --leap is used the next argument is the timezonefile", + {"leap", 'l', "Print the leap second information from the given time zone file. By convention, when --leap is used the next argument is the timezonefile.", &opt_leap, &opt_leap, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"verbose", 'v', "Write non critical warnings", + {"verbose", 'v', "Write non critical warnings.", &opt_verbose, &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"skip-write-binlog", 'S', "Do not replicate changes to time zone tables to other nodes in a Galera cluster", + {"skip-write-binlog", 'S', "Do not replicate changes to time zone tables to the binary log, or to other nodes in a Galera cluster.", &opt_skip_write_binlog,&opt_skip_write_binlog, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; +static char **default_argv; + +static void free_allocated_data() +{ + free_defaults(default_argv); + my_end(0); +} + + C_MODE_START static my_bool get_one_option(const struct my_option *, const char *, const char *); @@ -2667,11 +2672,21 @@ static void print_version(void) MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); } +static const char *default_timezone_dir= "/usr/share/zoneinfo/"; + + static void print_usage(void) { - fprintf(stderr, "Usage:\n"); - fprintf(stderr, " %s [options] timezonedir\n", my_progname); - fprintf(stderr, " %s [options] timezonefile timezonename\n", my_progname); + fprintf(stdout, "Create SQL commands for loading system timezeone data for " + "MariaDB\n\n"); + fprintf(stdout, "Usage:\n"); + fprintf(stdout, " %s [options] timezonedir\n", my_progname); + fprintf(stdout, "or\n"); + fprintf(stdout, " %s [options] timezonefile timezonename\n", my_progname); + + fprintf(stdout, "\nA typical place for the system timezone directory is " + "\"%s\"\n", default_timezone_dir); + print_defaults("my",load_default_groups); puts(""); my_print_help(my_long_options); @@ -2692,19 +2707,48 @@ get_one_option(const struct my_option *opt, const char *argument, const char *) print_version(); puts(""); print_usage(); + free_allocated_data(); exit(0); case 'V': print_version(); + free_allocated_data(); exit(0); } return 0; } +static const char *lock_tables= + "LOCK TABLES time_zone WRITE,\n" + " time_zone_leap_second WRITE,\n" + " time_zone_name WRITE,\n" + " time_zone_transition WRITE,\n" + " time_zone_transition_type WRITE"; +static const char *trunc_tables_const= + "TRUNCATE TABLE time_zone;\n" + "TRUNCATE TABLE time_zone_name;\n" + "TRUNCATE TABLE time_zone_transition;\n" + "TRUNCATE TABLE time_zone_transition_type;\n"; + +/* + These queries need to return FALSE/0 when the 'wsrep*' variables do not + exist at all. + Moving the WHERE clause into the sum(...) seems like the obvious solution + here, but it does not work in bootstrap mode (see MDEV-28782 and + 0e4cf497ca11a7298e2bd896cb594bd52085a1d4). + Thus we use coalesce(..., 0) instead, +*/ +static const char *wsrep_is_on= + "select coalesce(sum(SESSION_VALUE='ON'), 0)" + " from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on'"; +static const char *wsrep_cannot_replicate_tz= + "select coalesce(sum(GLOBAL_VALUE NOT LIKE @replicate_opt), 0)" + " from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode'"; + int main(int argc, char **argv) { - char **default_argv; + const char *trunc_tables= ""; MY_INIT(argv[0]); load_defaults_or_exit("my", load_default_groups, &argc, &argv); @@ -2716,34 +2760,52 @@ main(int argc, char **argv) if ((argc != 1 && argc != 2) || (opt_leap && argc != 1)) { print_usage(); - free_defaults(default_argv); + free_allocated_data(); return 1; } + if (argc == 1 && !opt_leap) + trunc_tables= trunc_tables_const; + + printf("set @wsrep_is_on=(%s);\n", wsrep_is_on); + printf("SET STATEMENT SQL_MODE='' FOR " + "SELECT concat('%%', GROUP_CONCAT(OPTION), '%%') INTO @replicate_opt " + " FROM" + " (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION" + " FROM information_schema.TABLES" + " WHERE TABLE_SCHEMA=DATABASE()" + " AND TABLE_NAME IN ('time_zone'," + " 'time_zone_name'," + " 'time_zone_transition'," + " 'time_zone_transition_type'," + " 'time_zone_leap_second')" + " AND ENGINE in ('MyISAM'," + " 'Aria')) AS o" + " ORDER BY OPTION DESC;\n"); + printf("set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (%s);\n", wsrep_cannot_replicate_tz); if (opt_skip_write_binlog) - { - /* If skip_write_binlog is set and wsrep is compiled in we disable - sql_log_bin and wsrep_on to avoid Galera replicating below - truncate table clauses. This will allow user to set different - time zones to nodes in Galera cluster. */ - printf("set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');\n" - "prepare set_wsrep_write_binlog from @prep1;\n" - "set @toggle=0; execute set_wsrep_write_binlog using @toggle;\n"); - } + /* We turn off session wsrep if we cannot replicate using galera. + Disable sql_log_bin as the name implies. */ + printf("execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF', 'do 0');\n" + "SET @save_sql_log_bin=@@SQL_LOG_BIN;\n" + "SET SESSION SQL_LOG_BIN=0;\n" + "SET @wsrep_cannot_replicate_tz=0;\n" + "%s%s;\n", trunc_tables, lock_tables); else - { - // Alter time zone tables to InnoDB if wsrep_on is enabled - // to allow changes to them to replicate with Galera - printf("\\d |\n" - "IF (select count(*) from information_schema.global_variables where\n" - "variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n" - "ALTER TABLE time_zone ENGINE=InnoDB;\n" - "ALTER TABLE time_zone_name ENGINE=InnoDB;\n" - "ALTER TABLE time_zone_transition ENGINE=InnoDB;\n" - "ALTER TABLE time_zone_transition_type ENGINE=InnoDB;\n" - "END IF|\n" - "\\d ;\n"); - } + // Alter time zone tables to InnoDB if wsrep_on is enabled + // to allow changes to them to replicate with Galera + printf( + "execute immediate if(@wsrep_cannot_replicate_tz, " SAVE_ENGINE("time_zone") ", 'do 0');\n" + "execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');\n" + "execute immediate if(@wsrep_cannot_replicate_tz, " SAVE_ENGINE("time_zone_name") ", 'do 0');\n" + "execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0');\n" + "execute immediate if(@wsrep_cannot_replicate_tz, " SAVE_ENGINE("time_zone_transition") ", 'do 0');\n" + "execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0');\n" + "execute immediate if(@wsrep_cannot_replicate_tz, " SAVE_ENGINE("time_zone_transition_type") ", 'do 0');\n" + "execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0');\n" + "%s" + "/*M!100602 execute immediate if(@wsrep_cannot_replicate_tz, 'start transaction', '%s')*/;\n" + , trunc_tables, lock_tables); if (argc == 1 && !opt_leap) { @@ -2751,12 +2813,6 @@ main(int argc, char **argv) root_name_end= strmake_buf(fullname, argv[0]); - printf("TRUNCATE TABLE time_zone;\n"); - printf("TRUNCATE TABLE time_zone_name;\n"); - printf("TRUNCATE TABLE time_zone_transition;\n"); - printf("TRUNCATE TABLE time_zone_transition_type;\n"); - printf("START TRANSACTION;\n"); - if (scan_tz_dir(root_name_end, 0, opt_verbose)) { printf("ROLLBACK;\n"); @@ -2767,11 +2823,15 @@ main(int argc, char **argv) return 1; } - printf("COMMIT;\n"); - printf("ALTER TABLE time_zone_transition " - "ORDER BY Time_zone_id, Transition_time;\n"); - printf("ALTER TABLE time_zone_transition_type " - "ORDER BY Time_zone_id, Transition_type_id;\n"); + printf("UNLOCK TABLES;\n" + "COMMIT;\n"); + printf( + "execute immediate if(@wsrep_cannot_replicate_tz, 'do 0'," + "'ALTER TABLE time_zone_transition " + "ORDER BY Time_zone_id, Transition_time');\n" + "execute immediate if(@wsrep_cannot_replicate_tz, 'do 0'," + "'ALTER TABLE time_zone_transition_type " + "ORDER BY Time_zone_id, Transition_type_id');\n"); } else { @@ -2791,25 +2851,29 @@ main(int argc, char **argv) print_tz_leaps_as_sql(&tz_info); else print_tz_as_sql(argv[1], &tz_info); - + printf("UNLOCK TABLES;\n" + "COMMIT;\n"); free_root(&tz_storage, MYF(0)); } - if(!opt_skip_write_binlog) - { - // Fall back to Aria - printf("\\d |\n" - "IF (select count(*) from information_schema.global_variables where\n" - "variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n" - "ALTER TABLE time_zone ENGINE=Aria;\n" - "ALTER TABLE time_zone_name ENGINE=Aria;\n" - "ALTER TABLE time_zone_transition ENGINE=Aria;\n" - "ALTER TABLE time_zone_transition_type ENGINE=Aria;\n" - "END IF|\n" - "\\d ;\n"); - } - - free_defaults(default_argv); + if(opt_skip_write_binlog) + printf("SET SESSION SQL_LOG_BIN=@save_sql_log_bin;\n" + "execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0');\n"); + else + // Change back to what it was before + printf( + "execute immediate if(@wsrep_cannot_replicate_tz, " + "concat('ALTER TABLE time_zone ENGINE=', @time_zone_engine), 'do 0');\n" + "execute immediate if(@wsrep_cannot_replicate_tz, " + "concat('ALTER TABLE time_zone_name ENGINE=', @time_zone_name_engine), 'do 0');\n" + "execute immediate if(@wsrep_cannot_replicate_tz, " + "concat('ALTER TABLE time_zone_transition ENGINE=', " + "@time_zone_transition_engine, ', ORDER BY Time_zone_id, Transition_time'), 'do 0');\n" + "execute immediate if(@wsrep_cannot_replicate_tz, " + "concat('ALTER TABLE time_zone_transition_type ENGINE=', " + "@time_zone_transition_type_engine, ', ORDER BY Time_zone_id, Transition_type_id'), 'do 0');\n"); + + free_allocated_data(); my_end(0); return 0; } diff --git a/sql/tztime.h b/sql/tztime.h index 9e5d469925ff6..6d8af62ecd45a 100644 --- a/sql/tztime.h +++ b/sql/tztime.h @@ -41,7 +41,7 @@ class THD; class Time_zone: public Sql_alloc { public: - Time_zone() {} /* Remove gcc warning */ + Time_zone() = default; /* Remove gcc warning */ /** Converts local time in broken down MYSQL_TIME representation to my_time_t (UTC seconds since Epoch) represenation. @@ -66,7 +66,7 @@ class Time_zone: public Sql_alloc We need this only for surpressing warnings, objects of this type are allocated on MEM_ROOT and should not require destruction. */ - virtual ~Time_zone() {}; + virtual ~Time_zone() = default; protected: static inline void adjust_leap_second(MYSQL_TIME *t); diff --git a/sql/unireg.cc b/sql/unireg.cc index 2726b9a68c212..e6f52cd953e81 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB Corporation. + Copyright (c) 2009, 2021, 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 @@ -685,6 +685,13 @@ static uint pack_keys(uchar *keybuff, uint key_count, KEY *keyinfo, DBUG_PRINT("loop", ("flags: %lu key_parts: %d key_part: %p", key->flags, key->user_defined_key_parts, key->key_part)); + + /* For SPATIAL, FULLTEXT and HASH indexes (anything other than B-tree), + ignore the ASC/DESC attribute of columns. */ + const uchar ha_reverse_sort= + key->algorithm > HA_KEY_ALG_BTREE || key->flags & (HA_FULLTEXT|HA_SPATIAL) + ? 0 : HA_REVERSE_SORT; + for (key_part=key->key_part,key_part_end=key_part+key->user_defined_key_parts ; key_part != key_part_end ; key_part++) @@ -697,7 +704,8 @@ static uint pack_keys(uchar *keybuff, uint key_count, KEY *keyinfo, int2store(pos,key_part->fieldnr+1+FIELD_NAME_USED); offset= (uint) (key_part->offset+data_offset+1); int2store(pos+2, offset); - pos[4]=0; // Sort order + key_part->key_part_flag &= ha_reverse_sort; + pos[4]= (uchar)(key_part->key_part_flag); int2store(pos+5,key_part->key_type); int2store(pos+7,key_part->length); pos+=9; @@ -980,7 +988,16 @@ static uint get_interval_id(uint *int_count,List &create_fields, while ((field=it++) != last_field) { - if (field->interval_id && field->interval->count == interval->count) + /* + ENUM/SET columns with equal value lists share a single + copy of the underlying TYPELIB. + Fields with different mbminlen can't reuse TYPELIBs, because: + - mbminlen==1 are written to FRM as is + - mbminlen>1 are written to FRM in hex-encoded format + */ + if (field->interval_id && + field->interval->count == interval->count && + field->charset->mbminlen == last_field->charset->mbminlen) { const char **a,**b; for (a=field->interval->type_names, b=interval->type_names ; diff --git a/sql/unireg.h b/sql/unireg.h index 0edb0a50ebd33..1eec3585accf5 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -62,7 +62,7 @@ #define SPECIAL_WAIT_IF_LOCKED 8 /* Wait if locked database */ #define SPECIAL_SAME_DB_NAME 16 /* form name = file name */ #define SPECIAL_ENGLISH 32 /* English error messages */ -#define SPECIAL_NO_RESOLVE 64 /* Don't use gethostname */ +#define SPECIAL_NO_RESOLVE 64 /* Obsolete */ #define SPECIAL_NO_PRIOR 128 /* Obsolete */ #define SPECIAL_BIG_SELECTS 256 /* Don't use heap tables */ #define SPECIAL_NO_HOST_CACHE 512 /* Don't cache hosts */ @@ -192,6 +192,22 @@ enum extra2_index_flags { EXTRA2_IGNORED_KEY }; + +static inline size_t extra2_read_len(const uchar **extra2, const uchar *end) +{ + size_t length= *(*extra2)++; + if (length) + return length; + + if ((*extra2) + 2 >= end) + return 0; + length= uint2korr(*extra2); + (*extra2)+= 2; + if (length < 256 || *extra2 + length > end) + return 0; + return length; +} + LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING &table, HA_CREATE_INFO *create_info, List &create_fields, diff --git a/sql/vers_string.h b/sql/vers_string.h index 4e173f86e6e95..c5be9c359e3e7 100644 --- a/sql/vers_string.h +++ b/sql/vers_string.h @@ -40,6 +40,8 @@ struct Compare_identifiers { int operator()(const LEX_CSTRING& a, const LEX_CSTRING& b) const { + DBUG_ASSERT(a.str != NULL); + DBUG_ASSERT(b.str != NULL); DBUG_ASSERT(a.str[a.length] == 0); DBUG_ASSERT(b.str[b.length] == 0); return my_strcasecmp(system_charset_info, a.str, b.str); @@ -51,7 +53,7 @@ template struct Lex_cstring_with_compare : public Lex_cstring { public: - Lex_cstring_with_compare() {} + Lex_cstring_with_compare() = default; Lex_cstring_with_compare(const char *_str, size_t _len) : Lex_cstring(_str, _len) { } diff --git a/sql/win_tzname_data.h b/sql/win_tzname_data.h index 792cdbc7a13f2..8a240118ac32a 100644 --- a/sql/win_tzname_data.h +++ b/sql/win_tzname_data.h @@ -44,7 +44,7 @@ {L"UTC-02","Etc/GMT+2"}, {L"Azores Standard Time","Atlantic/Azores"}, {L"Cape Verde Standard Time","Atlantic/Cape_Verde"}, -{L"UTC","Etc/GMT"}, +{L"UTC","Etc/UTC"}, {L"GMT Standard Time","Europe/London"}, {L"Greenwich Standard Time","Atlantic/Reykjavik"}, {L"Sao Tome Standard Time","Africa/Sao_Tome"}, @@ -64,6 +64,7 @@ {L"South Africa Standard Time","Africa/Johannesburg"}, {L"FLE Standard Time","Europe/Kiev"}, {L"Israel Standard Time","Asia/Jerusalem"}, +{L"South Sudan Standard Time","Africa/Juba"}, {L"Kaliningrad Standard Time","Europe/Kaliningrad"}, {L"Sudan Standard Time","Africa/Khartoum"}, {L"Libya Standard Time","Africa/Tripoli"}, diff --git a/sql/winmain.cc b/sql/winmain.cc index bdad409065d44..2ed43130fa769 100644 --- a/sql/winmain.cc +++ b/sql/winmain.cc @@ -82,7 +82,8 @@ static void report_svc_status(DWORD current_state, DWORD exit_code, DWORD wait_h return; static DWORD check_point= 1; - svc_status.dwCurrentState= current_state; + if (current_state != (DWORD)-1) + svc_status.dwCurrentState= current_state; svc_status.dwWaitHint= wait_hint; if (exit_code) diff --git a/sql/winservice.h b/sql/winservice.h index a14ee73d14693..aa0528be5eea1 100644 --- a/sql/winservice.h +++ b/sql/winservice.h @@ -166,7 +166,6 @@ static inline BOOL my_ChangeServiceConfig(SC_HANDLE hService, DWORD dwServiceTyp wchar_t *w_Dependencies= NULL; wchar_t *w_ServiceStartName= NULL; wchar_t *w_Password= NULL; - SC_HANDLE sch = NULL; DWORD last_error=0; BOOL ok= TRUE; diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc index 3fe0792d83e8d..5e1fa137fedb8 100644 --- a/sql/wsrep_binlog.cc +++ b/sql/wsrep_binlog.cc @@ -16,11 +16,11 @@ #include "mariadb.h" #include "mysql/service_wsrep.h" #include "wsrep_binlog.h" -#include "wsrep_priv.h" #include "log.h" #include "slave.h" #include "log_event.h" #include "wsrep_applier.h" +#include "wsrep_mysqld.h" #include "transaction.h" @@ -155,10 +155,10 @@ static int wsrep_write_cache_inc(THD* const thd, goto cleanup; cache->read_pos= cache->read_end; } while ((cache->file >= 0) && (length= my_b_fill(cache))); - } - if (ret == 0) - { - assert(total_length + thd->wsrep_sr().log_position() == saved_pos); + if (ret == 0) + { + assert(total_length + thd->wsrep_sr().log_position() == saved_pos); + } } cleanup: diff --git a/sql/wsrep_check_opts.cc b/sql/wsrep_check_opts.cc index e5a0dcb2ede35..b17a5f164a4e9 100644 --- a/sql/wsrep_check_opts.cc +++ b/sql/wsrep_check_opts.cc @@ -19,6 +19,7 @@ #include "sys_vars_shared.h" #include "wsrep.h" #include "wsrep_sst.h" +#include "wsrep_mysqld.h" extern char *my_bind_addr_str; diff --git a/sql/wsrep_client_service.cc b/sql/wsrep_client_service.cc index 6ab2834a21948..d3b4a18195b4f 100644 --- a/sql/wsrep_client_service.cc +++ b/sql/wsrep_client_service.cc @@ -1,4 +1,4 @@ -/* Copyright 2018-2021 Codership Oy +/* Copyright 2018-2023 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 @@ -20,6 +20,8 @@ #include "wsrep_thd.h" #include "wsrep_xid.h" #include "wsrep_trans_observer.h" +#include "wsrep_server_state.h" +#include "wsrep_mysqld.h" #include "sql_base.h" /* close_temporary_table() */ #include "sql_class.h" /* THD */ @@ -83,18 +85,37 @@ int Wsrep_client_service::prepare_data_for_replication() DBUG_ASSERT(m_thd == current_thd); DBUG_ENTER("Wsrep_client_service::prepare_data_for_replication"); size_t data_len= 0; - IO_CACHE* cache= wsrep_get_trans_cache(m_thd); + IO_CACHE* transactional_cache= wsrep_get_cache(m_thd, true); + IO_CACHE* stmt_cache= wsrep_get_cache(m_thd, false); - if (cache) + if (transactional_cache || stmt_cache) { m_thd->binlog_flush_pending_rows_event(true); - if (wsrep_write_cache(m_thd, cache, &data_len)) + + size_t transactional_data_len= 0; + size_t stmt_data_len= 0; + + // Write transactional cache + if (transactional_cache && + wsrep_write_cache(m_thd, transactional_cache, &transactional_data_len)) + { + WSREP_ERROR("rbr write fail, data_len: %zu", + data_len); + // wsrep_override_error(m_thd, ER_ERROR_DURING_COMMIT); + DBUG_RETURN(1); + } + + // Write stmt cache + if (stmt_cache && wsrep_write_cache(m_thd, stmt_cache, &stmt_data_len)) { WSREP_ERROR("rbr write fail, data_len: %zu", data_len); // wsrep_override_error(m_thd, ER_ERROR_DURING_COMMIT); DBUG_RETURN(1); } + + // Complete data written from both caches + data_len = transactional_data_len + stmt_data_len; } if (data_len == 0) @@ -136,7 +157,7 @@ int Wsrep_client_service::prepare_fragment_for_replication( DBUG_ASSERT(m_thd == current_thd); THD* thd= m_thd; DBUG_ENTER("Wsrep_client_service::prepare_fragment_for_replication"); - IO_CACHE* cache= wsrep_get_trans_cache(thd); + IO_CACHE* cache= wsrep_get_cache(thd, true); thd->binlog_flush_pending_rows_event(true); if (!cache) @@ -218,7 +239,7 @@ bool Wsrep_client_service::statement_allowed_for_streaming() const size_t Wsrep_client_service::bytes_generated() const { - IO_CACHE* cache= wsrep_get_trans_cache(m_thd); + IO_CACHE* cache= wsrep_get_cache(m_thd, true); if (cache) { size_t pending_rows_event_length= 0; @@ -326,21 +347,34 @@ void Wsrep_client_service::debug_crash(const char* crash_point) int Wsrep_client_service::bf_rollback() { DBUG_ASSERT(m_thd == current_thd); - DBUG_ENTER("Wsrep_client_service::rollback"); + DBUG_ENTER("Wsrep_client_service::bf_rollback"); int ret= (trans_rollback_stmt(m_thd) || trans_rollback(m_thd)); - if (m_thd->locked_tables_mode && m_thd->lock) - { - if (m_thd->locked_tables_list.unlock_locked_tables(m_thd)) - ret= 1; - m_thd->variables.option_bits&= ~OPTION_TABLE_LOCK; - } - if (m_thd->global_read_lock.is_acquired()) + + WSREP_DEBUG("::bf_rollback() thread: %lu, client_state %s " + "client_mode %s trans_state %s killed %d", + thd_get_thread_id(m_thd), + wsrep_thd_client_state_str(m_thd), + wsrep_thd_client_mode_str(m_thd), + wsrep_thd_transaction_state_str(m_thd), + m_thd->killed); + + /* If client is quiting all below will be done in THD::cleanup() + TODO: why we need this any other case? */ + if (m_thd->wsrep_cs().state() != wsrep::client_state::s_quitting) { - m_thd->global_read_lock.unlock_global_read_lock(m_thd); + if (m_thd->locked_tables_mode && m_thd->lock) + { + if (m_thd->locked_tables_list.unlock_locked_tables(m_thd)) + ret= 1; + m_thd->variables.option_bits&= ~OPTION_TABLE_LOCK; + } + if (m_thd->global_read_lock.is_acquired()) + { + m_thd->global_read_lock.unlock_global_read_lock(m_thd); + } + m_thd->release_transactional_locks(); } - m_thd->release_transactional_locks(); - m_thd->mdl_context.release_explicit_locks(); DBUG_RETURN(ret); } diff --git a/sql/wsrep_condition_variable.h b/sql/wsrep_condition_variable.h index 6ad53a3086c0d..d9798bb9548b6 100644 --- a/sql/wsrep_condition_variable.h +++ b/sql/wsrep_condition_variable.h @@ -26,29 +26,28 @@ class Wsrep_condition_variable : public wsrep::condition_variable { public: - Wsrep_condition_variable(mysql_cond_t& cond) + Wsrep_condition_variable(mysql_cond_t* cond) : m_cond(cond) { } - ~Wsrep_condition_variable() - { } + ~Wsrep_condition_variable() = default; void notify_one() { - mysql_cond_signal(&m_cond); + mysql_cond_signal(m_cond); } void notify_all() { - mysql_cond_broadcast(&m_cond); + mysql_cond_broadcast(m_cond); } void wait(wsrep::unique_lock& lock) { mysql_mutex_t* mutex= static_cast(lock.mutex()->native()); - mysql_cond_wait(&m_cond, mutex); + mysql_cond_wait(m_cond, mutex); } private: - mysql_cond_t& m_cond; + mysql_cond_t* m_cond; }; #endif /* WSREP_CONDITION_VARIABLE_H */ diff --git a/sql/wsrep_dummy.cc b/sql/wsrep_dummy.cc index ac14fc4597a8f..9bfaf9285f3a0 100644 --- a/sql/wsrep_dummy.cc +++ b/sql/wsrep_dummy.cc @@ -101,6 +101,12 @@ void wsrep_thd_self_abort(THD *) int wsrep_thd_append_key(THD *, const struct wsrep_key*, int, enum Wsrep_service_key_type) { return 0; } +int wsrep_thd_append_table_key(THD *, const char*, const char*, enum Wsrep_service_key_type) +{ return 0; } + +my_bool wsrep_thd_is_local_transaction(const THD*) +{ return 0; } + const char* wsrep_thd_client_state_str(const THD*) { return 0; } diff --git a/sql/wsrep_high_priority_service.cc b/sql/wsrep_high_priority_service.cc index 1f6537a1351d2..53ef20f3e7833 100644 --- a/sql/wsrep_high_priority_service.cc +++ b/sql/wsrep_high_priority_service.cc @@ -1,4 +1,4 @@ -/* Copyright 2018-2021 Codership Oy +/* Copyright 2018-2023 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 @@ -19,6 +19,7 @@ #include "wsrep_schema.h" #include "wsrep_xid.h" #include "wsrep_trans_observer.h" +#include "wsrep_server_state.h" #include "sql_class.h" /* THD */ #include "transaction.h" @@ -291,6 +292,7 @@ int Wsrep_high_priority_service::append_fragment_and_commit( ret= ret || trans_commit(m_thd); ret= ret || (m_thd->wsrep_cs().after_applying(), 0); + m_thd->release_transactional_locks(); free_root(m_thd->mem_root, MYF(MY_KEEP_PREALLOC)); @@ -379,8 +381,16 @@ int Wsrep_high_priority_service::rollback(const wsrep::ws_handle& ws_handle, assert(ws_handle == wsrep::ws_handle()); } int ret= (trans_rollback_stmt(m_thd) || trans_rollback(m_thd)); + + WSREP_DEBUG("::rollback() thread: %lu, client_state %s " + "client_mode %s trans_state %s killed %d", + thd_get_thread_id(m_thd), + wsrep_thd_client_state_str(m_thd), + wsrep_thd_client_mode_str(m_thd), + wsrep_thd_transaction_state_str(m_thd), + m_thd->killed); + m_thd->release_transactional_locks(); - m_thd->mdl_context.release_explicit_locks(); free_root(m_thd->mem_root, MYF(MY_KEEP_PREALLOC)); @@ -403,6 +413,7 @@ int Wsrep_high_priority_service::apply_toi(const wsrep::ws_meta& ws_meta, WSREP_DEBUG("Wsrep_high_priority_service::apply_toi: %lld", client_state.toi_meta().seqno().get()); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sync.wsrep_apply_toi", { const char act[]= @@ -412,6 +423,7 @@ int Wsrep_high_priority_service::apply_toi(const wsrep::ws_meta& ws_meta, DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act))); };); +#endif int ret= apply_events(thd, m_rli, data, err); wsrep_thd_set_ignored_error(thd, false); @@ -457,6 +469,7 @@ int Wsrep_high_priority_service::log_dummy_write_set(const wsrep::ws_handle& ws_ DBUG_PRINT("info", ("Wsrep_high_priority_service::log_dummy_write_set: seqno=%lld", ws_meta.seqno().get())); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sync.wsrep_log_dummy_write_set", { const char act[]= @@ -465,6 +478,7 @@ int Wsrep_high_priority_service::log_dummy_write_set(const wsrep::ws_handle& ws_ DBUG_ASSERT(!debug_sync_set_action(m_thd, STRING_WITH_LEN(act))); };); +#endif if (ws_meta.ordered()) { @@ -486,7 +500,13 @@ int Wsrep_high_priority_service::log_dummy_write_set(const wsrep::ws_handle& ws_ if (!WSREP_EMULATE_BINLOG(m_thd)) { wsrep_register_for_group_commit(m_thd); - ret = ret || cs.provider().commit_order_leave(ws_handle, ws_meta, err); + /* wait_for_prior_commit() ensures that all preceding transactions + have been committed and seqno has been synced into + storage engine. We don't release commit order here yet to + avoid following transactions to sync seqno before + wsrep_set_SE_checkpoint() below returns. This effectively pauses + group commit for the checkpoint operation, but is the only way to + ensure proper ordering. */ m_thd->wait_for_prior_commit(); } @@ -496,10 +516,7 @@ int Wsrep_high_priority_service::log_dummy_write_set(const wsrep::ws_handle& ws_ { wsrep_unregister_from_group_commit(m_thd); } - else - { - ret= ret || cs.provider().commit_order_leave(ws_handle, ws_meta, err); - } + ret= ret || cs.provider().commit_order_leave(ws_handle, ws_meta, err); cs.after_applying(); } DBUG_RETURN(ret); @@ -560,8 +577,8 @@ int Wsrep_applier_service::apply_write_set(const wsrep::ws_meta& ws_meta, /* moved dbug sync point here, after possible THD switch for SR transactions has ben done */ - /* Allow tests to block the applier thread using the DBUG facilities */ #ifdef ENABLED_DEBUG_SYNC + /* Allow tests to block the applier thread using the DBUG facilities */ DBUG_EXECUTE_IF("sync.wsrep_apply_cb", { const char act[]= @@ -633,6 +650,9 @@ Wsrep_replayer_service::Wsrep_replayer_service(THD* replayer_thd, THD* orig_thd) transactional locks */ DBUG_ASSERT(!orig_thd->mdl_context.has_transactional_locks()); + replayer_thd->system_thread_info.rpl_sql_info= + new rpl_sql_thread_info(replayer_thd->wsrep_rgi->rli->mi->rpl_filter); + /* Make a shadow copy of diagnostics area and reset */ m_da_shadow.status= orig_thd->get_stmt_da()->status(); if (m_da_shadow.status == Diagnostics_area::DA_OK) @@ -671,35 +691,35 @@ Wsrep_replayer_service::Wsrep_replayer_service(THD* replayer_thd, THD* orig_thd) Wsrep_replayer_service::~Wsrep_replayer_service() { - THD* replayer_thd= m_thd; - THD* orig_thd= m_orig_thd; - /* Switch execution context back to original. */ - wsrep_after_apply(replayer_thd); - wsrep_after_command_ignore_result(replayer_thd); - wsrep_close(replayer_thd); - wsrep_reset_threadvars(replayer_thd); - wsrep_store_threadvars(orig_thd); + wsrep_after_apply(m_thd); + wsrep_after_command_ignore_result(m_thd); + wsrep_close(m_thd); + wsrep_reset_threadvars(m_thd); + wsrep_store_threadvars(m_orig_thd); - DBUG_ASSERT(!orig_thd->get_stmt_da()->is_sent()); - DBUG_ASSERT(!orig_thd->get_stmt_da()->is_set()); + DBUG_ASSERT(!m_orig_thd->get_stmt_da()->is_sent()); + DBUG_ASSERT(!m_orig_thd->get_stmt_da()->is_set()); + + delete m_thd->system_thread_info.rpl_sql_info; + m_thd->system_thread_info.rpl_sql_info= nullptr; if (m_replay_status == wsrep::provider::success) { - DBUG_ASSERT(replayer_thd->wsrep_cs().current_error() == wsrep::e_success); - orig_thd->reset_kill_query(); - my_ok(orig_thd, m_da_shadow.affected_rows, m_da_shadow.last_insert_id); + DBUG_ASSERT(m_thd->wsrep_cs().current_error() == wsrep::e_success); + m_orig_thd->reset_kill_query(); + my_ok(m_orig_thd, m_da_shadow.affected_rows, m_da_shadow.last_insert_id); } else if (m_replay_status == wsrep::provider::error_certification_failed) { - wsrep_override_error(orig_thd, ER_LOCK_DEADLOCK); + wsrep_override_error(m_orig_thd, ER_LOCK_DEADLOCK); } else { DBUG_ASSERT(0); WSREP_ERROR("trx_replay failed for: %d, schema: %s, query: %s", m_replay_status, - orig_thd->db.str, wsrep_thd_query(orig_thd)); + m_orig_thd->db.str, wsrep_thd_query(m_orig_thd)); unireg_abort(1); } } @@ -714,6 +734,7 @@ int Wsrep_replayer_service::apply_write_set(const wsrep::ws_meta& ws_meta, DBUG_ASSERT(thd->wsrep_trx().active()); DBUG_ASSERT(thd->wsrep_trx().state() == wsrep::transaction::s_replaying); +#ifdef ENABLED_DEBUG_SYNC /* Allow tests to block the replayer thread using the DBUG facilities */ DBUG_EXECUTE_IF("sync.wsrep_replay_cb", { @@ -724,6 +745,7 @@ int Wsrep_replayer_service::apply_write_set(const wsrep::ws_meta& ws_meta, DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act))); };); +#endif wsrep_setup_uk_and_fk_checks(thd); diff --git a/sql/wsrep_mutex.h b/sql/wsrep_mutex.h index 3454b44e0ec16..f396c1be33186 100644 --- a/sql/wsrep_mutex.h +++ b/sql/wsrep_mutex.h @@ -25,26 +25,26 @@ class Wsrep_mutex : public wsrep::mutex { public: - Wsrep_mutex(mysql_mutex_t& mutex) + Wsrep_mutex(mysql_mutex_t* mutex) : m_mutex(mutex) { } void lock() { - mysql_mutex_lock(&m_mutex); + mysql_mutex_lock(m_mutex); } void unlock() { - mysql_mutex_unlock(&m_mutex); + mysql_mutex_unlock(m_mutex); } void* native() { - return &m_mutex; + return m_mutex; } private: - mysql_mutex_t& m_mutex; + mysql_mutex_t* m_mutex; }; #endif /* WSREP_MUTEX_H */ diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 641e203d44260..cff31ab44845f 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1,5 +1,5 @@ -/* Copyright 2008-2021 Codership Oy - Copyright (c) 2020, 2021, MariaDB +/* Copyright (c) 2008, 2022 Codership Oy + Copyright (c) 2020, 2022, 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 @@ -125,6 +125,7 @@ ulong wsrep_trx_fragment_unit= WSREP_FRAG_BYTES; ulong wsrep_SR_store_type= WSREP_SR_STORE_TABLE; uint wsrep_ignore_apply_errors= 0; +std::atomic wsrep_thread_create_failed; /* * End configuration options @@ -325,7 +326,6 @@ void WSREP_LOG(void (*fun)(const char* fmt, ...), const char* fmt, ...) wsrep_uuid_t local_uuid = WSREP_UUID_UNDEFINED; wsrep_seqno_t local_seqno = WSREP_SEQNO_UNDEFINED; -wsp::node_status local_status; /* */ @@ -362,10 +362,12 @@ static void wsrep_log_cb(wsrep::log::level level, void wsrep_init_gtid() { wsrep_server_gtid_t stored_gtid= wsrep_get_SE_checkpoint(); + // Domain id may have changed, use the one + // received during state transfer. + stored_gtid.domain_id= wsrep_gtid_server.domain_id; if (stored_gtid.server_id == 0) { rpl_gtid wsrep_last_gtid; - stored_gtid.domain_id= wsrep_gtid_server.domain_id; if (mysql_bin_log.is_open() && mysql_bin_log.lookup_domain_in_binlog_state(stored_gtid.domain_id, &wsrep_last_gtid)) @@ -470,19 +472,20 @@ void wsrep_recover_sr_from_storage(THD *orig_thd) if (!wsrep_schema) { WSREP_ERROR("Wsrep schema not initialized when trying to recover " - "streaming transactions"); - unireg_abort(1); + "streaming transactions: wsrep_on %d", WSREP_ON); + trans_commit(orig_thd); } if (wsrep_schema->recover_sr_transactions(orig_thd)) { - WSREP_ERROR("Failed to recover SR transactions from schema"); - unireg_abort(1); + WSREP_ERROR("Failed to recover SR transactions from schema: wsrep_on : %d", WSREP_ON); + trans_commit(orig_thd); } break; default: /* */ - WSREP_ERROR("Unsupported wsrep SR store type: %lu", wsrep_SR_store_type); - unireg_abort(1); + WSREP_ERROR("Unsupported wsrep SR store type: %lu wsrep_on: %d", + wsrep_SR_store_type, WSREP_ON); + trans_commit(orig_thd); break; } } @@ -649,7 +652,7 @@ static std::string wsrep_server_incoming_address() bool is_ipv6= false; unsigned int my_bind_ip= INADDR_ANY; // default if not set - if (my_bind_addr_str && strlen(my_bind_addr_str) && + if (my_bind_addr_str && strlen(my_bind_addr_str) && strcmp(my_bind_addr_str, "*") != 0) { my_bind_ip= wsrep_check_ip(my_bind_addr_str, &is_ipv6); @@ -708,15 +711,22 @@ static std::string wsrep_server_incoming_address() /* In case port is not specified in wsrep_node_incoming_address, we use mysqld_port. + Note that we might get here before we execute set_ports(). */ - int port= (addr.get_port() > 0) ? addr.get_port() : (int) mysqld_port; + int local_port= (addr.get_port() > 0) ? addr.get_port() : (int) mysqld_port; + if (!local_port) + local_port= MYSQL_PORT; const char *fmt= (addr.is_ipv6()) ? "[%s]:%u" : "%s:%u"; - snprintf(inc_addr, inc_addr_max, fmt, addr.get_address(), port); + snprintf(inc_addr, inc_addr_max, fmt, addr.get_address(), local_port); } - + done: - ret= wsrep_node_incoming_address; + if (!strlen(inc_addr)) + ret= wsrep_node_incoming_address; + else + ret= inc_addr; + WSREP_DEBUG("wsrep_incoming_address = %s", ret.c_str()); return ret; } @@ -800,7 +810,6 @@ int wsrep_init_server() void wsrep_init_globals() { - wsrep_gtid_server.domain_id= wsrep_gtid_domain_id; wsrep_init_sidno(Wsrep_server_state::instance().connected_gtid().id()); /* Recover last written wsrep gtid */ wsrep_init_gtid(); @@ -815,6 +824,13 @@ void wsrep_init_globals() wsrep_get_binlog_gtid_seqno(new_gtid); wsrep_gtid_server.gtid(new_gtid); } + else + { + if (wsrep_gtid_mode && wsrep_gtid_server.server_id != global_system_variables.server_id) + { + WSREP_WARN("Ignoring server id for non bootstrap node."); + } + } wsrep_init_schema(); if (WSREP_ON) { @@ -977,13 +993,19 @@ void wsrep_init_startup (bool sst_first) With mysqldump SST (!sst_first) wait until the server reaches joiner state and procedd to accepting connections. */ + int err= 0; if (sst_first) { - server_state.wait_until_state(Wsrep_server_state::s_initializing); + err= server_state.wait_until_state(Wsrep_server_state::s_initializing); } else { - server_state.wait_until_state(Wsrep_server_state::s_joiner); + err= server_state.wait_until_state(Wsrep_server_state::s_joiner); + } + if (err) + { + WSREP_ERROR("Wsrep startup was interrupted"); + unireg_abort(1); } } @@ -1088,7 +1110,11 @@ void wsrep_stop_replication(THD *thd) { WSREP_DEBUG("Disconnect provider"); Wsrep_server_state::instance().disconnect(); - Wsrep_server_state::instance().wait_until_state(Wsrep_server_state::s_disconnected); + if (Wsrep_server_state::instance().wait_until_state( + Wsrep_server_state::s_disconnected)) + { + WSREP_WARN("Wsrep interrupted while waiting for disconnected state"); + } } /* my connection, should not terminate with wsrep_close_client_connection(), @@ -1110,7 +1136,11 @@ void wsrep_shutdown_replication() { WSREP_DEBUG("Disconnect provider"); Wsrep_server_state::instance().disconnect(); - Wsrep_server_state::instance().wait_until_state(Wsrep_server_state::s_disconnected); + if (Wsrep_server_state::instance().wait_until_state( + Wsrep_server_state::s_disconnected)) + { + WSREP_WARN("Wsrep interrupted while waiting for disconnected state"); + } } wsrep_close_client_connections(TRUE); @@ -1140,6 +1170,15 @@ bool wsrep_start_replication(const char *wsrep_cluster_address) DBUG_ASSERT(wsrep_cluster_address[0]); + // --wsrep-new-cluster flag is not used, checking wsrep_cluster_address + // it should match gcomm:// only to be considered as bootstrap node. + // This logic is used in galera. + if (!wsrep_new_cluster && (strlen(wsrep_cluster_address) == 8) && + !strncmp(wsrep_cluster_address, "gcomm://", 8)) + { + wsrep_new_cluster= true; + } + bool const bootstrap(TRUE == wsrep_new_cluster); WSREP_INFO("Start replication"); @@ -1580,6 +1619,73 @@ wsrep_sync_wait_upto (THD* thd, return ret; } +bool wsrep_is_show_query(enum enum_sql_command command) +{ + DBUG_ASSERT(command >= 0 && command <= SQLCOM_END); + return (sql_command_flags[command] & CF_STATUS_COMMAND) != 0; +} + +static bool wsrep_is_diagnostic_query(enum enum_sql_command command) +{ + assert(command >= 0 && command <= SQLCOM_END); + return (sql_command_flags[command] & CF_DIAGNOSTIC_STMT) != 0; +} + +static enum enum_wsrep_sync_wait +wsrep_sync_wait_mask_for_command(enum enum_sql_command command) +{ + switch (command) + { + case SQLCOM_SELECT: + case SQLCOM_CHECKSUM: + return WSREP_SYNC_WAIT_BEFORE_READ; + case SQLCOM_DELETE: + case SQLCOM_DELETE_MULTI: + case SQLCOM_UPDATE: + case SQLCOM_UPDATE_MULTI: + return WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE; + case SQLCOM_REPLACE: + case SQLCOM_INSERT: + case SQLCOM_REPLACE_SELECT: + case SQLCOM_INSERT_SELECT: + return WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE; + default: + if (wsrep_is_diagnostic_query(command)) + { + return WSREP_SYNC_WAIT_NONE; + } + if (wsrep_is_show_query(command)) + { + switch (command) + { + case SQLCOM_SHOW_PROFILE: + case SQLCOM_SHOW_PROFILES: + case SQLCOM_SHOW_SLAVE_HOSTS: + case SQLCOM_SHOW_RELAYLOG_EVENTS: + case SQLCOM_SHOW_SLAVE_STAT: + case SQLCOM_SHOW_BINLOG_STAT: + case SQLCOM_SHOW_ENGINE_STATUS: + case SQLCOM_SHOW_ENGINE_MUTEX: + case SQLCOM_SHOW_ENGINE_LOGS: + case SQLCOM_SHOW_PROCESSLIST: + case SQLCOM_SHOW_PRIVILEGES: + return WSREP_SYNC_WAIT_NONE; + default: + return WSREP_SYNC_WAIT_BEFORE_SHOW; + } + } + } + return WSREP_SYNC_WAIT_NONE; +} + +bool wsrep_sync_wait(THD* thd, enum enum_sql_command command) +{ + bool res = false; + if (WSREP_CLIENT(thd) && thd->variables.wsrep_sync_wait) + res = wsrep_sync_wait(thd, wsrep_sync_wait_mask_for_command(command)); + return res; +} + void wsrep_keys_free(wsrep_key_arr_t* key_arr) { for (size_t i= 0; i < key_arr->keys_len; ++i) @@ -1605,20 +1711,29 @@ wsrep_append_fk_parent_table(THD* thd, TABLE_LIST* tables, wsrep::key_array* key TABLE_LIST *table; TABLE_LIST *table_last_in_list; + for (table= tables; table; table= table->next_local) + { + if (is_temporary_table(table)) + { + WSREP_DEBUG("Temporary table %s.%s already opened query=%s", table->db.str, + table->table_name.str, wsrep_thd_query(thd)); + return false; + } + } + thd->release_transactional_locks(); uint counter; MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint(); - for (table_last_in_list= tables;;table_last_in_list= table_last_in_list->next_local) { + for (table_last_in_list= tables;;table_last_in_list= table_last_in_list->next_local) { if (!table_last_in_list->next_local) { break; } } - if (thd->open_temporary_tables(tables) || - open_tables(thd, &tables, &counter, MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL)) + if (open_tables(thd, &tables, &counter, MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL)) { - WSREP_DEBUG("unable to open table for FK checks for %s", thd->query()); + WSREP_DEBUG("Unable to open table for FK checks for %s", wsrep_thd_query(thd)); fail= true; goto exit; } @@ -2591,7 +2706,7 @@ static int wsrep_TOI_begin(THD *thd, const char *db, const char *table, ret, (thd->db.str ? thd->db.str : "(null)"), wsrep_thd_query(thd)); - my_error(ER_ERROR_DURING_COMMIT, MYF(0), WSREP_SIZE_EXCEEDED); + my_error(ER_UNKNOWN_ERROR, MYF(0), "Maximum writeset size exceeded"); break; case wsrep::e_deadlock_error: WSREP_WARN("TO isolation failed for: %d, schema: %s, sql: %s. " @@ -2766,6 +2881,12 @@ int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_, return 0; } + if (thd->wsrep_parallel_slave_wait_for_prior_commit()) + { + WSREP_WARN("TOI: wait_for_prior_commit() returned error."); + return -1; + } + int ret= 0; mysql_mutex_lock(&thd->LOCK_thd_data); @@ -2973,6 +3094,11 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, THD_STAGE_INFO(request_thd, stage_waiting_ddl); ticket->wsrep_report(wsrep_debug); mysql_mutex_unlock(&granted_thd->LOCK_thd_data); + if (granted_thd->current_backup_stage != BACKUP_FINISHED && + wsrep_check_mode(WSREP_MODE_BF_MARIABACKUP)) + { + wsrep_abort_thd(request_thd, granted_thd, 1); + } } else if (request_thd->lex->sql_command == SQLCOM_DROP_TABLE) { @@ -3062,7 +3188,9 @@ static my_bool have_client_connections(THD *thd, void*) { DBUG_PRINT("quit",("Informing thread %lld that it's time to die", (longlong) thd->thread_id)); - if (is_client_connection(thd) && thd->killed == KILL_CONNECTION) + if (is_client_connection(thd) && + (thd->killed == KILL_CONNECTION || + thd->killed == KILL_CONNECTION_HARD)) { (void)abort_replicated(thd); return 1; @@ -3072,7 +3200,7 @@ static my_bool have_client_connections(THD *thd, void*) static void wsrep_close_thread(THD *thd) { - thd->set_killed(KILL_CONNECTION); + thd->set_killed(KILL_CONNECTION_HARD); MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (thd)); mysql_mutex_lock(&thd->LOCK_thd_kill); thd->abort_current_cond_wait(true); @@ -3106,13 +3234,13 @@ static my_bool kill_all_threads(THD *thd, THD *caller_thd) if (is_client_connection(thd) && thd != caller_thd) { if (is_replaying_connection(thd)) - thd->set_killed(KILL_CONNECTION); + thd->set_killed(KILL_CONNECTION_HARD); else if (!abort_replicated(thd)) { /* replicated transactions must be skipped */ WSREP_DEBUG("closing connection %lld", (longlong) thd->thread_id); /* instead of wsrep_close_thread() we do now soft kill by THD::awake */ - thd->awake(KILL_CONNECTION); + thd->awake(KILL_CONNECTION_HARD); } } return 0; @@ -3296,11 +3424,6 @@ extern bool wsrep_thd_ignore_table(THD *thd) return thd->wsrep_ignore_table; } -bool wsrep_is_show_query(enum enum_sql_command command) -{ - DBUG_ASSERT(command >= 0 && command <= SQLCOM_END); - return (sql_command_flags[command] & CF_STATUS_COMMAND) != 0; -} bool wsrep_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table, HA_CREATE_INFO *create_info) @@ -3318,21 +3441,17 @@ bool wsrep_create_like_table(THD* thd, TABLE_LIST* table, } else { - /* here we have CREATE TABLE LIKE - the temporary table definition will be needed in slaves to - enable the create to succeed - */ - TABLE_LIST tbl; - bzero((void*) &tbl, sizeof(tbl)); - tbl.db= src_table->db; - tbl.table_name= tbl.alias= src_table->table_name; - tbl.table= src_table->table; + /* Non-MERGE tables ignore this call. */ + if (src_table->table->file->extra(HA_EXTRA_ADD_CHILDREN_LIST)) + return (true); + char buf[2048]; String query(buf, sizeof(buf), system_charset_info); query.length(0); // Have to zero it since constructor doesn't - (void) show_create_table(thd, &tbl, &query, NULL, WITH_DB_NAME); - WSREP_DEBUG("TMP TABLE: %s", query.ptr()); + int result __attribute__((unused))= + show_create_table(thd, src_table, &query, NULL, WITH_DB_NAME); + WSREP_DEBUG("TMP TABLE: %s ret_code %d", query.ptr(), result); thd->wsrep_TOI_pre_query= query.ptr(); thd->wsrep_TOI_pre_query_len= query.length(); @@ -3341,6 +3460,9 @@ bool wsrep_create_like_table(THD* thd, TABLE_LIST* table, thd->wsrep_TOI_pre_query= NULL; thd->wsrep_TOI_pre_query_len= 0; + + /* Non-MERGE tables ignore this call. */ + src_table->table->file->extra(HA_EXTRA_DETACH_CHILDREN); } return(false); @@ -3415,7 +3537,7 @@ int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len) void* start_wsrep_THD(void *arg) { - THD *thd; + THD *thd= NULL; Wsrep_thd_args* thd_args= (Wsrep_thd_args*) arg; @@ -3446,6 +3568,7 @@ void* start_wsrep_THD(void *arg) mysql_thread_set_psi_id(thd->thread_id); thd->thr_create_utime= microsecond_interval_timer(); + DBUG_EXECUTE_IF("wsrep_simulate_failed_connection_1", goto error; ); // /* handle_one_connection() is normally the only way a thread would @@ -3552,6 +3675,18 @@ void* start_wsrep_THD(void *arg) error: WSREP_ERROR("Failed to create/initialize system thread"); + if (thd) + { + close_connection(thd, ER_OUT_OF_RESOURCES); + statistic_increment(aborted_connects, &LOCK_status); + server_threads.erase(thd); + delete thd; + my_thread_end(); + } + delete thd_args; + // This will signal error to wsrep_slave_threads_update + wsrep_thread_create_failed.store(true, std::memory_order_relaxed); + /* Abort if its the first applier/rollbacker thread. */ if (!mysqld_server_initialized) unireg_abort(1); @@ -3572,6 +3707,15 @@ enum wsrep::streaming_context::fragment_unit wsrep_fragment_unit(ulong unit) } } +bool THD::wsrep_parallel_slave_wait_for_prior_commit() +{ + if (rgi_slave && rgi_slave->is_parallel_exec && wait_for_prior_commit()) + { + return 1; + } + return 0; +} + /***** callbacks for wsrep service ************/ my_bool get_wsrep_recovery() @@ -3602,19 +3746,28 @@ bool wsrep_consistency_check(THD *thd) void wsrep_commit_empty(THD* thd, bool all) { DBUG_ENTER("wsrep_commit_empty"); - WSREP_DEBUG("wsrep_commit_empty(%llu)", thd->thread_id); + WSREP_DEBUG("wsrep_commit_empty for %llu client_state %s client_mode" + " %s trans_state %s sql %s", + thd_get_thread_id(thd), + wsrep::to_c_string(thd->wsrep_cs().state()), + wsrep::to_c_string(thd->wsrep_cs().mode()), + wsrep::to_c_string(thd->wsrep_cs().transaction().state()), + wsrep_thd_query(thd)); + if (wsrep_is_real(thd, all) && wsrep_thd_is_local(thd) && thd->wsrep_trx().active() && !thd->internal_transaction() && thd->wsrep_trx().state() != wsrep::transaction::s_committed) { - /* @todo CTAS with STATEMENT binlog format and empty result set - seems to be committing empty. Figure out why and try to fix - elsewhere. */ + /* Here transaction is either empty (i.e. no changes) or + it was CREATE TABLE with no row binlog format or + we have already aborted transaction e.g. because max writeset size + has been reached. */ DBUG_ASSERT(!wsrep_has_changes(thd) || (thd->lex->sql_command == SQLCOM_CREATE_TABLE && - !thd->is_current_stmt_binlog_format_row())); + !thd->is_current_stmt_binlog_format_row()) || + thd->wsrep_cs().transaction().state() == wsrep::transaction::s_aborted); bool have_error= wsrep_current_error(thd); int ret= wsrep_before_rollback(thd, all) || wsrep_after_rollback(thd, all) || diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 9cbe186aedf03..d14e59957719c 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -1,5 +1,4 @@ -/* Copyright 2008-2021 Codership Oy - Copyright (c) 2020, 2021, MariaDB +/* Copyright 2008-2022 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 @@ -20,8 +19,6 @@ #include #ifdef WITH_WSREP -extern bool WSREP_ON_; -extern bool WSREP_PROVIDER_EXISTS_; #include #include "mysql/service_wsrep.h" @@ -40,21 +37,12 @@ typedef struct st_mysql_show_var SHOW_VAR; #include "wsrep/provider.hpp" #include "wsrep/streaming_context.hpp" #include "wsrep_api.h" -#include #include -#include "wsrep_server_state.h" #define WSREP_UNDEFINED_TRX_ID ULONGLONG_MAX -class set_var; class THD; -enum wsrep_consistency_check_mode { - NO_CONSISTENCY_CHECK, - CONSISTENCY_CHECK_DECLARED, - CONSISTENCY_CHECK_RUNNING, -}; - // Global wsrep parameters // MySQL wsrep options @@ -81,7 +69,6 @@ extern ulong wsrep_max_ws_rows; extern const char* wsrep_notify_cmd; extern my_bool wsrep_certify_nonPK; extern long int wsrep_protocol_version; -extern ulong wsrep_forced_binlog_format; extern my_bool wsrep_desync; extern ulong wsrep_reject_queries; extern my_bool wsrep_recovery; @@ -100,7 +87,8 @@ extern ulong wsrep_running_applier_threads; extern ulong wsrep_running_rollbacker_threads; extern bool wsrep_new_cluster; extern bool wsrep_gtid_mode; -extern uint wsrep_gtid_domain_id; +extern uint32 wsrep_gtid_domain_id; +extern std::atomic wsrep_thread_create_failed; extern ulonglong wsrep_mode; enum enum_wsrep_reject_types { @@ -112,7 +100,7 @@ enum enum_wsrep_reject_types { enum enum_wsrep_OSU_method { WSREP_OSU_TOI, WSREP_OSU_RSU, - WSREP_OSU_NONE + WSREP_OSU_NONE, }; enum enum_wsrep_sync_wait { @@ -140,7 +128,8 @@ enum enum_wsrep_mode { WSREP_MODE_REQUIRED_PRIMARY_KEY= (1ULL << 2), WSREP_MODE_REPLICATE_MYISAM= (1ULL << 3), WSREP_MODE_REPLICATE_ARIA= (1ULL << 4), - WSREP_MODE_DISALLOW_LOCAL_GTID= (1ULL << 5) + WSREP_MODE_DISALLOW_LOCAL_GTID= (1ULL << 5), + WSREP_MODE_BF_MARIABACKUP= (1ULL << 6) }; // Streaming Replication @@ -225,6 +214,7 @@ extern bool wsrep_check_mode_after_open_table (THD *thd, const handlerton *hton, extern bool wsrep_check_mode_before_cmd_execute (THD *thd); extern bool wsrep_must_sync_wait (THD* thd, uint mask= WSREP_SYNC_WAIT_BEFORE_READ); extern bool wsrep_sync_wait (THD* thd, uint mask= WSREP_SYNC_WAIT_BEFORE_READ); +extern bool wsrep_sync_wait (THD* thd, enum enum_sql_command command); extern enum wsrep::provider::status wsrep_sync_wait_upto (THD* thd, wsrep_gtid_t* upto, int timeout); extern int wsrep_check_opts(); @@ -234,68 +224,46 @@ extern bool wsrep_reload_ssl(); /* Other global variables */ extern wsrep_seqno_t wsrep_locked_seqno; -#define WSREP_ON unlikely(WSREP_ON_) - -/* use xxxxxx_NNULL macros when thd pointer is guaranteed to be non-null to - * avoid compiler warnings (GCC 6 and later) */ -#define WSREP_NNULL(thd) \ - (WSREP_PROVIDER_EXISTS_ && thd->variables.wsrep_on) +/* A wrapper function for MySQL log functions. The call will prefix + the log message with WSREP and forward the result buffer to fun. */ +void WSREP_LOG(void (*fun)(const char* fmt, ...), const char* fmt, ...); -#define WSREP(thd) \ - (thd && WSREP_NNULL(thd)) +#define WSREP_SYNC_WAIT(thd_, before_) \ + { if (WSREP_CLIENT(thd_) && \ + wsrep_sync_wait(thd_, before_)) goto wsrep_error_label; } -#define WSREP_CLIENT_NNULL(thd) \ - (WSREP_NNULL(thd) && thd->wsrep_client_thread) +#define WSREP_MYSQL_DB (char *)"mysql" -#define WSREP_CLIENT(thd) \ - (WSREP(thd) && thd->wsrep_client_thread) +#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \ + if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) \ + goto wsrep_error_label; -#define WSREP_EMULATE_BINLOG_NNULL(thd) \ - (WSREP_NNULL(thd) && wsrep_emulate_bin_log) +#define WSREP_TO_ISOLATION_BEGIN_CREATE(db_, table_, table_list_, create_info_) \ + if (WSREP_ON && WSREP(thd) && \ + wsrep_to_isolation_begin(thd, db_, table_, \ + table_list_, nullptr, nullptr, create_info_))\ + goto wsrep_error_label; -#define WSREP_EMULATE_BINLOG(thd) \ - (WSREP(thd) && wsrep_emulate_bin_log) +#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_, fk_tables_, create_info_) \ + if (WSREP(thd) && wsrep_thd_is_local(thd) && \ + wsrep_to_isolation_begin(thd, db_, table_, \ + table_list_, alter_info_, fk_tables_, create_info_)) -#define WSREP_BINLOG_FORMAT(my_format) \ - ((wsrep_forced_binlog_format != BINLOG_FORMAT_UNSPEC) ? \ - wsrep_forced_binlog_format : my_format) +#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); -/* A wrapper function for MySQL log functions. The call will prefix - the log message with WSREP and forward the result buffer to fun. */ -void WSREP_LOG(void (*fun)(const char* fmt, ...), const char* fmt, ...); +/* + Checks if lex->no_write_to_binlog is set for statements that use LOCAL or + NO_WRITE_TO_BINLOG. +*/ +#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 wsrep_error_label; -#define WSREP_DEBUG(...) \ - if (wsrep_debug) sql_print_information( "WSREP: " __VA_ARGS__) -#define WSREP_INFO(...) sql_print_information( "WSREP: " __VA_ARGS__) -#define WSREP_WARN(...) sql_print_warning( "WSREP: " __VA_ARGS__) -#define WSREP_ERROR(...) sql_print_error( "WSREP: " __VA_ARGS__) -#define WSREP_UNKNOWN(fmt, ...) WSREP_ERROR("UNKNOWN: " fmt, ##__VA_ARGS__) - -#define WSREP_LOG_CONFLICT_THD(thd, role) \ - WSREP_INFO( \ - "%s: \n " \ - " THD: %lu, mode: %s, state: %s, conflict: %s, seqno: %lld\n " \ - " SQL: %s", \ - role, \ - thd_get_thread_id(thd), \ - wsrep_thd_client_mode_str(thd), \ - wsrep_thd_client_state_str(thd), \ - wsrep_thd_transaction_state_str(thd), \ - wsrep_thd_trx_seqno(thd), \ - wsrep_thd_query(thd) \ - ); - -#define WSREP_LOG_CONFLICT(bf_thd, victim_thd, bf_abort) \ - if (wsrep_debug || wsrep_log_conflicts) \ - { \ - WSREP_INFO("cluster conflict due to %s for threads:", \ - (bf_abort) ? "high priority abort" : "certification failure" \ - ); \ - if (bf_thd) WSREP_LOG_CONFLICT_THD(bf_thd, "Winning thread"); \ - if (victim_thd) WSREP_LOG_CONFLICT_THD(victim_thd, "Victim thread"); \ - WSREP_INFO("context: %s:%d", __FILE__, __LINE__); \ - } #define WSREP_PROVIDER_EXISTS (WSREP_PROVIDER_EXISTS_) @@ -309,9 +277,6 @@ static inline bool wsrep_cluster_address_exists() extern my_bool wsrep_ready_get(); extern void wsrep_ready_wait(); -class Ha_trx_info; -struct THD_TRANS; - extern mysql_mutex_t LOCK_wsrep_ready; extern mysql_cond_t COND_wsrep_ready; extern mysql_mutex_t LOCK_wsrep_sst; @@ -335,8 +300,10 @@ extern mysql_mutex_t LOCK_wsrep_donor_monitor; extern mysql_cond_t COND_wsrep_joiner_monitor; extern mysql_cond_t COND_wsrep_donor_monitor; -extern my_bool wsrep_emulate_bin_log; extern int wsrep_to_isolation; +#ifdef GTID_SUPPORT +extern rpl_sidno wsrep_sidno; +#endif /* GTID_SUPPORT */ extern my_bool wsrep_preordered_opt; #ifdef HAVE_PSI_INTERFACE @@ -380,8 +347,6 @@ extern PSI_thread_key key_wsrep_sst_donor_monitor; struct TABLE_LIST; class Alter_info; -struct HA_CREATE_INFO; - int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_, const TABLE_LIST* table_list, const Alter_info* alter_info= nullptr, @@ -635,12 +600,6 @@ wsrep::key wsrep_prepare_key_for_toi(const char* db, const char* table, /* These macros are needed to compile MariaDB without WSREP support * (e.g. embedded) */ -#define WSREP_ON false -#define WSREP(T) (0) -#define WSREP_NNULL(T) (0) -#define WSREP_EMULATE_BINLOG(thd) (0) -#define WSREP_EMULATE_BINLOG_NNULL(thd) (0) -#define WSREP_BINLOG_FORMAT(my_format) ((ulong)my_format) #define WSREP_PROVIDER_EXISTS (0) #define wsrep_emulate_bin_log (0) #define wsrep_to_isolation (0) @@ -653,6 +612,12 @@ wsrep::key wsrep_prepare_key_for_toi(const char* db, const char* table, #define wsrep_create_appliers(X) do {} while(0) #define wsrep_should_replicate_ddl(X,Y) (1) #define wsrep_cluster_address_exists() (false) +#define WSREP_MYSQL_DB (0) +#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) do { } while(0) +#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_, fk_tables_) +#define WSREP_TO_ISOLATION_END +#define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_) +#define WSREP_SYNC_WAIT(thd_, before_) #endif /* WITH_WSREP */ diff --git a/sql/wsrep_on.h b/sql/wsrep_on.h new file mode 100644 index 0000000000000..f85fe3d5d0dd9 --- /dev/null +++ b/sql/wsrep_on.h @@ -0,0 +1,63 @@ +/* Copyright 2022 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 + 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 WSREP_ON_H +#define WSREP_ON_H + +#ifdef WITH_WSREP + +extern bool WSREP_ON_; +extern bool WSREP_PROVIDER_EXISTS_; +extern my_bool wsrep_emulate_bin_log; +extern ulong wsrep_forced_binlog_format; + +#define WSREP_ON unlikely(WSREP_ON_) + +/* use xxxxxx_NNULL macros when thd pointer is guaranteed to be non-null to + * avoid compiler warnings (GCC 6 and later) */ + +#define WSREP_NNULL(thd) \ + (WSREP_PROVIDER_EXISTS_ && thd->variables.wsrep_on) + +#define WSREP(thd) \ + (thd && WSREP_NNULL(thd)) + +#define WSREP_CLIENT_NNULL(thd) \ + (WSREP_NNULL(thd) && thd->wsrep_client_thread) + +#define WSREP_CLIENT(thd) \ + (WSREP(thd) && thd->wsrep_client_thread) + +#define WSREP_EMULATE_BINLOG_NNULL(thd) \ + (WSREP_NNULL(thd) && wsrep_emulate_bin_log) + +#define WSREP_EMULATE_BINLOG(thd) \ + (WSREP(thd) && wsrep_emulate_bin_log) + +#define WSREP_BINLOG_FORMAT(my_format) \ + ((wsrep_forced_binlog_format != BINLOG_FORMAT_UNSPEC) ? \ + wsrep_forced_binlog_format : my_format) + +#else + +#define WSREP_ON false +#define WSREP(T) (0) +#define WSREP_NNULL(T) (0) +#define WSREP_EMULATE_BINLOG(thd) (0) +#define WSREP_EMULATE_BINLOG_NNULL(thd) (0) +#define WSREP_BINLOG_FORMAT(my_format) ((ulong)my_format) + +#endif +#endif diff --git a/sql/wsrep_priv.h b/sql/wsrep_priv.h index fb8467adc9d7f..e88d3c862a084 100644 --- a/sql/wsrep_priv.h +++ b/sql/wsrep_priv.h @@ -19,13 +19,8 @@ #ifndef WSREP_PRIV_H #define WSREP_PRIV_H -#include -#include "wsrep_mysqld.h" -#include "wsrep_schema.h" - -#include -#include -#include +#include "wsrep_api.h" +#include "wsrep/server_state.hpp" my_bool wsrep_ready_set (my_bool x); @@ -39,7 +34,6 @@ wsrep_cb_status wsrep_sst_donate_cb (void* app_ctx, extern wsrep_uuid_t local_uuid; extern wsrep_seqno_t local_seqno; -extern Wsrep_schema* wsrep_schema; // a helper function bool wsrep_sst_received(THD*, const wsrep_uuid_t&, wsrep_seqno_t, diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc index 48077040f8847..a19ea688fd62f 100644 --- a/sql/wsrep_schema.cc +++ b/sql/wsrep_schema.cc @@ -30,6 +30,7 @@ #include "wsrep_high_priority_service.h" #include "wsrep_storage_service.h" #include "wsrep_thd.h" +#include "wsrep_server_state.h" #include #include @@ -623,9 +624,11 @@ static int init_for_index_scan(TABLE* table, const uchar* key, */ static int end_index_scan(TABLE* table) { int error; - if ((error= table->file->ha_index_end())) { - WSREP_ERROR("Failed to end scan: %d", error); - return 1; + if (table->file->inited) { + if ((error= table->file->ha_index_end())) { + WSREP_ERROR("Failed to end scan: %d", error); + return 1; + } } return 0; } @@ -651,12 +654,9 @@ static void make_key(TABLE* table, uchar** key, key_part_map* map, int parts) { } /* namespace Wsrep_schema_impl */ -Wsrep_schema::Wsrep_schema() -{ -} +Wsrep_schema::Wsrep_schema() = default; -Wsrep_schema::~Wsrep_schema() -{ } +Wsrep_schema::~Wsrep_schema() = default; static void wsrep_init_thd_for_schema(THD *thd) { @@ -1016,10 +1016,9 @@ int Wsrep_schema::append_fragment(THD* thd, Wsrep_schema_impl::store(frag_table, 3, flags); Wsrep_schema_impl::store(frag_table, 4, data.data(), data.size()); - int error; - if ((error= Wsrep_schema_impl::insert(frag_table))) { - WSREP_ERROR("Failed to write to frag table: %d", error); + if (Wsrep_schema_impl::insert(frag_table)) { trans_rollback_stmt(thd); + close_thread_tables(thd); thd->lex->restore_backup_query_tables_list(&query_tables_list_backup); DBUG_RETURN(1); } diff --git a/sql/wsrep_server_service.cc b/sql/wsrep_server_service.cc index 4916005e7ed1f..9be6af71c56c1 100644 --- a/sql/wsrep_server_service.cc +++ b/sql/wsrep_server_service.cc @@ -391,6 +391,7 @@ int Wsrep_server_service::wait_committing_transactions(int timeout) void Wsrep_server_service::debug_sync(const char* sync_point) { +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF(sync_point, { std::stringstream dbug_action; dbug_action << "now " @@ -401,4 +402,5 @@ void Wsrep_server_service::debug_sync(const char* sync_point) action.c_str(), action.length())); };); +#endif } diff --git a/sql/wsrep_server_state.cc b/sql/wsrep_server_state.cc index ebc4efaabe5c3..6bc4eaf4d86de 100644 --- a/sql/wsrep_server_state.cc +++ b/sql/wsrep_server_state.cc @@ -43,13 +43,12 @@ Wsrep_server_state::Wsrep_server_state(const std::string& name, initial_position, max_protocol_version, wsrep::server_state::rm_sync) - , m_mutex(LOCK_wsrep_server_state) - , m_cond(COND_wsrep_server_state) + , m_mutex(&LOCK_wsrep_server_state) + , m_cond(&COND_wsrep_server_state) , m_service(*this) { } -Wsrep_server_state::~Wsrep_server_state() -{ } +Wsrep_server_state::~Wsrep_server_state() = default; void Wsrep_server_state::init_once(const std::string& name, const std::string& incoming_address, diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 786d8b9bbf5f5..8c8e568c62da4 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -1,4 +1,5 @@ -/* Copyright 2008-2020 Codership Oy +/* Copyright 2008-2022 Codership Oy + Copyright (c) 2008, 2022, 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 @@ -29,10 +30,11 @@ #include "wsrep_utils.h" #include "wsrep_xid.h" #include "wsrep_thd.h" -#include "wsrep_mysqld.h" +#include "wsrep_server_state.h" #include #include +#include "debug_sync.h" #include @@ -334,9 +336,14 @@ static bool wsrep_sst_complete (THD* thd, if ((state == Wsrep_server_state::s_joiner || state == Wsrep_server_state::s_initialized)) { - Wsrep_server_state::instance().sst_received(client_service, - rcode); - WSREP_INFO("SST succeeded for position %s", start_pos_buf); + if (Wsrep_server_state::instance().sst_received(client_service, rcode)) + { + failed= true; + } + else + { + WSREP_INFO("SST succeeded for position %s", start_pos_buf); + } } else { @@ -1067,12 +1074,14 @@ static ssize_t sst_prepare_other (const char* method, WSREP_SST_OPT_ADDR " '%s' " WSREP_SST_OPT_DATA " '%s' " "%s" - WSREP_SST_OPT_PARENT " '%d'" + WSREP_SST_OPT_PARENT " %d " + WSREP_SST_OPT_PROGRESS " %d" "%s" "%s", method, addr_in, mysql_real_data_home, wsrep_defaults_file, (int)getpid(), + 0, binlog_opt_val, binlog_index_opt_val); my_free(binlog_opt_val); @@ -1223,35 +1232,46 @@ std::string wsrep_sst_prepare() /* Figure out SST receive address. Common for all SST methods. */ + wsp::Address* addr_in_parser= NULL; + // Attempt 1: wsrep_sst_receive_address if (wsrep_sst_receive_address && - strcmp (wsrep_sst_receive_address, WSREP_SST_ADDRESS_AUTO)) + strcmp(wsrep_sst_receive_address, WSREP_SST_ADDRESS_AUTO)) { - addr_in= wsrep_sst_receive_address; - } + addr_in_parser = new wsp::Address(wsrep_sst_receive_address); + if (!addr_in_parser->is_valid()) + { + WSREP_ERROR("Could not parse wsrep_sst_receive_address : %s", + wsrep_sst_receive_address); + unireg_abort(1); + } + } //Attempt 2: wsrep_node_address - else if (wsrep_node_address && strlen(wsrep_node_address)) + else if (wsrep_node_address && *wsrep_node_address) { - wsp::Address addr(wsrep_node_address); + addr_in_parser = new wsp::Address(wsrep_node_address); - if (!addr.is_valid()) + if (addr_in_parser->is_valid()) + { + // we must not inherit the port number from this address: + addr_in_parser->set_port(0); + } + else { WSREP_ERROR("Could not parse wsrep_node_address : %s", wsrep_node_address); throw wsrep::runtime_error("Failed to prepare for SST. Unrecoverable"); } - memcpy(ip_buf, addr.get_address(), addr.get_address_len()); - addr_in= ip_buf; } // Attempt 3: Try to get the IP from the list of available interfaces. else { - ssize_t ret= wsrep_guess_ip (ip_buf, ip_max); + ssize_t ret= wsrep_guess_ip(ip_buf, ip_max); if (ret && ret < ip_max) { - addr_in= ip_buf; + addr_in_parser = new wsp::Address(ip_buf); } else { @@ -1261,6 +1281,51 @@ std::string wsrep_sst_prepare() } } + assert(addr_in_parser); + + size_t len= addr_in_parser->get_address_len(); + bool is_ipv6= addr_in_parser->is_ipv6(); + const char* address= addr_in_parser->get_address(); + + if (len > (is_ipv6 ? ip_max - 2 : ip_max)) + { + WSREP_ERROR("Address to accept state transfer is too long: '%s'", + address); + unireg_abort(1); + } + + if (is_ipv6) + { + /* wsrep_sst_*.sh scripts requite ipv6 addreses to be in square breackets */ + ip_buf[0] = '['; + /* the length (len) already includes the null byte: */ + memcpy(ip_buf + 1, address, len - 1); + ip_buf[len] = ']'; + ip_buf[len + 1] = 0; + len += 2; + } + else + { + memcpy(ip_buf, address, len); + } + + int port= addr_in_parser->get_port(); + if (port) + { + size_t space= ip_max - len; + ip_buf[len - 1] = ':'; + int ret= snprintf(ip_buf + len, ip_max - len, "%d", port); + if (ret <= 0 || (size_t) ret > space) + { + WSREP_ERROR("Address to accept state transfer is too long: '%s:%d'", + address, port); + unireg_abort(1); + } + } + + delete addr_in_parser; + addr_in = ip_buf; + ssize_t addr_len= -ENOSYS; method = wsrep_sst_method; if (!strcmp(method, WSREP_SST_MYSQLDUMP)) @@ -1500,17 +1565,14 @@ static int run_sql_command(THD *thd, const char *query) if (thd->is_error()) { int const err= thd->get_stmt_da()->sql_errno(); - WSREP_WARN ("Error executing '%s': %d (%s)%s", - query, err, thd->get_stmt_da()->message(), - err == ER_UNKNOWN_SYSTEM_VARIABLE ? - ". Was mysqld built with --with-innodb-disallow-writes ?" : ""); + WSREP_WARN ("Error executing '%s': %d (%s)", + query, err, thd->get_stmt_da()->message()); thd->clear_error(); return -1; } return 0; } - static int sst_flush_tables(THD* thd) { WSREP_INFO("Flushing tables for SST..."); @@ -1570,16 +1632,19 @@ static int sst_flush_tables(THD* thd) } else { + ha_disable_internal_writes(true); + WSREP_INFO("Tables flushed."); - /* - Tables have been flushed. Create a file with cluster state ID and - wsrep_gtid_domain_id. - */ + + // Create a file with cluster state ID and wsrep_gtid_domain_id. char content[100]; snprintf(content, sizeof(content), "%s:%lld %d\n", wsrep_cluster_state_uuid, (long long)wsrep_locked_seqno, wsrep_gtid_server.domain_id); err= sst_create_file(flush_success, content); + if (err) + WSREP_INFO("Creating file for flush_success failed %d",err); + const char base_name[]= "tables_flushed"; ssize_t const full_len= strlen(mysql_real_data_home) + strlen(base_name)+2; char *real_name= (char*) malloc(full_len); @@ -1614,39 +1679,13 @@ static int sst_flush_tables(THD* thd) } free(real_name); free(tmp_name); + if (err) + ha_disable_internal_writes(false); } return err; } - -static void sst_disallow_writes (THD* thd, bool yes) -{ - char query_str[64]= { 0, }; - ssize_t const query_max= sizeof(query_str) - 1; - CHARSET_INFO *current_charset; - - current_charset= thd->variables.character_set_client; - - if (!is_supported_parser_charset(current_charset)) - { - /* Do not use non-supported parser character sets */ - WSREP_WARN("Current client character set is non-supported parser character set: %s", current_charset->cs_name.str); - thd->variables.character_set_client= &my_charset_latin1; - WSREP_WARN("For SST temporally setting character set to : %s", - my_charset_latin1.cs_name.str); - } - - snprintf (query_str, query_max, "SET GLOBAL innodb_disallow_writes=%d", - yes ? 1 : 0); - - if (run_sql_command(thd, query_str)) - { - WSREP_ERROR("Failed to disallow InnoDB writes"); - } - thd->variables.character_set_client= current_charset; -} - static void* sst_donor_thread (void* a) { sst_thread_arg* arg= (sst_thread_arg*)a; @@ -1692,20 +1731,32 @@ static void* sst_donor_thread (void* a) if (!strcasecmp (out, magic_flush)) { err= sst_flush_tables (thd.ptr); + if (!err) { - sst_disallow_writes (thd.ptr, true); + locked= true; /* Lets also keep statements that modify binary logs (like RESET LOGS, RESET MASTER) from proceeding until the files have been transferred to the joiner node. */ if (mysql_bin_log.is_open()) - { mysql_mutex_lock(mysql_bin_log.get_log_lock()); - } - locked= true; + WSREP_INFO("Donor state reached"); + +#ifdef ENABLED_DEBUG_SYNC + DBUG_EXECUTE_IF("sync.wsrep_donor_state", + { + const char act[]= + "now " + "SIGNAL sync.wsrep_donor_state_reached " + "WAIT_FOR signal.wsrep_donor_state"; + assert(!debug_sync_set_action(thd.ptr, + STRING_WITH_LEN(act))); + };); +#endif + goto wait_signal; } } @@ -1713,14 +1764,11 @@ static void* sst_donor_thread (void* a) { if (locked) { + locked= false; + ha_disable_internal_writes(false); if (mysql_bin_log.is_open()) - { - mysql_mutex_assert_owner(mysql_bin_log.get_log_lock()); mysql_mutex_unlock(mysql_bin_log.get_log_lock()); - } - sst_disallow_writes (thd.ptr, false); thd.ptr->global_read_lock.unlock_global_read_lock(thd.ptr); - locked= false; } err= 0; goto wait_signal; @@ -1751,12 +1799,12 @@ static void* sst_donor_thread (void* a) if (locked) // don't forget to unlock server before return { + ha_disable_internal_writes(false); if (mysql_bin_log.is_open()) { mysql_mutex_assert_owner(mysql_bin_log.get_log_lock()); mysql_mutex_unlock(mysql_bin_log.get_log_lock()); } - sst_disallow_writes (thd.ptr, false); thd.ptr->global_read_lock.unlock_global_read_lock(thd.ptr); } @@ -1815,16 +1863,18 @@ static int sst_donate_other (const char* method, "wsrep_sst_%s " WSREP_SST_OPT_ROLE " 'donor' " WSREP_SST_OPT_ADDR " '%s' " - WSREP_SST_OPT_LPORT " '%u' " + WSREP_SST_OPT_LPORT " %u " WSREP_SST_OPT_SOCKET " '%s' " + WSREP_SST_OPT_PROGRESS " %d " WSREP_SST_OPT_DATA " '%s' " "%s" WSREP_SST_OPT_GTID " '%s:%lld' " - WSREP_SST_OPT_GTID_DOMAIN_ID " '%d'" + WSREP_SST_OPT_GTID_DOMAIN_ID " %d" "%s" "%s" "%s", method, addr, mysqld_port, mysqld_unix_port, + 0, mysql_real_data_home, wsrep_defaults_file, uuid_oss.str().c_str(), gtid.seqno().get(), wsrep_gtid_server.domain_id, diff --git a/sql/wsrep_sst.h b/sql/wsrep_sst.h index 2389db4abe784..462db7a159edd 100644 --- a/sql/wsrep_sst.h +++ b/sql/wsrep_sst.h @@ -32,6 +32,7 @@ #define WSREP_SST_OPT_PARENT "--parent" #define WSREP_SST_OPT_BINLOG "--binlog" #define WSREP_SST_OPT_BINLOG_INDEX "--binlog-index" +#define WSREP_SST_OPT_PROGRESS "--progress" #define WSREP_SST_OPT_MYSQLD "--mysqld-args" // mysqldump-specific options diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index bccd1a4f8b36a..420a25dd2ae91 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2013 Codership Oy +/* Copyright (C) 2013-2023 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 @@ -18,12 +18,12 @@ #include "wsrep_trans_observer.h" #include "wsrep_high_priority_service.h" #include "wsrep_storage_service.h" +#include "wsrep_server_state.h" #include "transaction.h" #include "rpl_rli.h" #include "log_event.h" #include "sql_parse.h" -#include "mysqld.h" // start_wsrep_THD(); -#include "wsrep_applier.h" // start_wsrep_THD(); +#include "wsrep_mysqld.h" // start_wsrep_THD(); #include "mysql/service_wsrep.h" #include "debug_sync.h" #include "slave.h" @@ -308,32 +308,37 @@ void wsrep_fire_rollbacker(THD *thd) } -int wsrep_abort_thd(THD *bf_thd_ptr, THD *victim_thd_ptr, my_bool signal) +int wsrep_abort_thd(THD *bf_thd, + THD *victim_thd, + my_bool signal) { DBUG_ENTER("wsrep_abort_thd"); - THD *victim_thd= (THD *) victim_thd_ptr; - THD *bf_thd= (THD *) bf_thd_ptr; mysql_mutex_lock(&victim_thd->LOCK_thd_data); /* Note that when you use RSU node is desynced from cluster, thus WSREP(thd) might not be true. */ - if ((WSREP(bf_thd) || + if ((WSREP_NNULL(bf_thd) || ((WSREP_ON || bf_thd->variables.wsrep_OSU_method == WSREP_OSU_RSU) && wsrep_thd_is_toi(bf_thd))) && - victim_thd && !wsrep_thd_is_aborting(victim_thd)) { - WSREP_DEBUG("wsrep_abort_thd, by: %llu, victim: %llu", (bf_thd) ? - (long long)bf_thd->real_id : 0, (long long)victim_thd->real_id); + WSREP_DEBUG("wsrep_abort_thd, by: %llu, victim: %llu", + (long long)bf_thd->real_id, (long long)victim_thd->real_id); mysql_mutex_unlock(&victim_thd->LOCK_thd_data); ha_abort_transaction(bf_thd, victim_thd, signal); - mysql_mutex_lock(&victim_thd->LOCK_thd_data); + DBUG_RETURN(1); } else { - WSREP_DEBUG("wsrep_abort_thd not effective: %p %p", bf_thd, victim_thd); + WSREP_DEBUG("wsrep_abort_thd not effective: bf %llu victim %llu " + "wsrep %d wsrep_on %d RSU %d TOI %d aborting %d", + (long long)bf_thd->real_id, (long long)victim_thd->real_id, + WSREP_NNULL(bf_thd), WSREP_ON, + bf_thd->variables.wsrep_OSU_method == WSREP_OSU_RSU, + wsrep_thd_is_toi(bf_thd), + wsrep_thd_is_aborting(victim_thd)); } mysql_mutex_unlock(&victim_thd->LOCK_thd_data); @@ -345,6 +350,7 @@ bool wsrep_bf_abort(THD* bf_thd, THD* victim_thd) WSREP_LOG_THD(bf_thd, "BF aborter before"); WSREP_LOG_THD(victim_thd, "victim before"); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sync.wsrep_bf_abort", { const char act[]= @@ -354,6 +360,7 @@ bool wsrep_bf_abort(THD* bf_thd, THD* victim_thd) DBUG_ASSERT(!debug_sync_set_action(bf_thd, STRING_WITH_LEN(act))); };); +#endif if (WSREP(victim_thd) && !victim_thd->wsrep_trx().active()) { @@ -373,6 +380,14 @@ bool wsrep_bf_abort(THD* bf_thd, THD* victim_thd) have acquired MDL locks (due to DDL execution), and this has caused BF conflict. such case does not require aborting in wsrep or replication provider state. */ + if (victim_thd->current_backup_stage != BACKUP_FINISHED && + wsrep_check_mode(WSREP_MODE_BF_MARIABACKUP)) + { + WSREP_DEBUG("killing connection for non wsrep session"); + mysql_mutex_lock(&victim_thd->LOCK_thd_data); + victim_thd->awake_no_mutex(KILL_CONNECTION); + mysql_mutex_unlock(&victim_thd->LOCK_thd_data); + } return false; } diff --git a/sql/wsrep_thd.h b/sql/wsrep_thd.h index 73c949cb6d5d5..0ce612d6097e1 100644 --- a/sql/wsrep_thd.h +++ b/sql/wsrep_thd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2021 Codership Oy +/* Copyright (C) 2013-2023 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 @@ -88,7 +88,9 @@ bool wsrep_create_appliers(long threads, bool mutex_protected=false); void wsrep_create_rollbacker(); bool wsrep_bf_abort(THD* bf_thd, THD* victim_thd); -int wsrep_abort_thd(THD *bf_thd_ptr, THD *victim_thd_ptr, my_bool signal); +int wsrep_abort_thd(THD *bf_thd, + THD *victim_thd, + my_bool signal) __attribute__((nonnull(1,2))); /* Helper methods to deal with thread local storage. @@ -182,9 +184,8 @@ void wsrep_reset_threadvars(THD *); so don't override those by default */ -static inline void wsrep_override_error(THD *thd, uint error) +static inline void wsrep_override_error(THD *thd, uint error, const char *format= 0, ...) { - DBUG_ASSERT(error != ER_ERROR_DURING_COMMIT); Diagnostics_area *da= thd->get_stmt_da(); if (da->is_ok() || da->is_eof() || @@ -195,26 +196,11 @@ static inline void wsrep_override_error(THD *thd, uint error) da->sql_errno() != ER_LOCK_DEADLOCK)) { da->reset_diagnostics_area(); - my_error(error, MYF(0)); - } -} - -/** - Override error with additional wsrep status. - */ -static inline void wsrep_override_error(THD *thd, uint error, - enum wsrep::provider::status status) -{ - Diagnostics_area *da= thd->get_stmt_da(); - if (da->is_ok() || - !da->is_set() || - (da->is_error() && - da->sql_errno() != error && - da->sql_errno() != ER_ERROR_DURING_COMMIT && - da->sql_errno() != ER_LOCK_DEADLOCK)) - { - da->reset_diagnostics_area(); - my_error(error, MYF(0), status); + va_list args; + va_start(args, format); + if (!format) format= ER_THD(thd, error); + my_printv_error(error, format, MYF(0), args); + va_end(args); } } @@ -226,7 +212,10 @@ static inline void wsrep_override_error(THD* thd, switch (ce) { case wsrep::e_error_during_commit: - wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status); + if (status == wsrep::provider::error_size_exceeded) + wsrep_override_error(thd, ER_UNKNOWN_ERROR, "Maximum writeset size exceeded"); + else + wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, 0, status); break; case wsrep::e_deadlock_error: wsrep_override_error(thd, ER_LOCK_DEADLOCK); @@ -235,11 +224,18 @@ static inline void wsrep_override_error(THD* thd, wsrep_override_error(thd, ER_QUERY_INTERRUPTED); break; case wsrep::e_size_exceeded_error: - wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status); + wsrep_override_error(thd, ER_UNKNOWN_ERROR, "Maximum writeset size exceeded"); break; case wsrep::e_append_fragment_error: /* TODO: Figure out better error number */ - wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status); + if (status) + wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, + "Error while appending streaming replication fragment" + "(provider status: %s)", + wsrep::provider::to_string(status).c_str()); + else + wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, + "Error while appending streaming replication fragment"); break; case wsrep::e_not_supported_error: wsrep_override_error(thd, ER_NOT_SUPPORTED_YET); diff --git a/sql/wsrep_trans_observer.h b/sql/wsrep_trans_observer.h index 70759e381a54a..42ba56fa2c25e 100644 --- a/sql/wsrep_trans_observer.h +++ b/sql/wsrep_trans_observer.h @@ -1,4 +1,4 @@ -/* Copyright 2016-2021 Codership Oy +/* Copyright 2016-2023 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 @@ -217,6 +217,19 @@ static inline bool wsrep_run_commit_hook(THD* thd, bool all) } mysql_mutex_unlock(&thd->LOCK_thd_data); } + + mysql_mutex_lock(&thd->LOCK_thd_data); + /* Transaction creating sequence is TOI or RSU, + CREATE [TEMPORARY] SEQUENCE = CREATE + INSERT (initial value) + and replicated using statement based replication, thus + the commit hooks will be skipped */ + if (ret && + (thd->wsrep_cs().mode() == wsrep::client_state::m_toi || + thd->wsrep_cs().mode() == wsrep::client_state::m_rsu) && + thd->lex->sql_command == SQLCOM_CREATE_SEQUENCE) + ret= false; + mysql_mutex_unlock(&thd->LOCK_thd_data); + DBUG_PRINT("wsrep", ("return: %d", ret)); DBUG_RETURN(ret); } @@ -232,6 +245,10 @@ static inline int wsrep_before_prepare(THD* thd, bool all) WSREP_DEBUG("wsrep_before_prepare: %d", wsrep_is_real(thd, all)); int ret= 0; DBUG_ASSERT(wsrep_run_commit_hook(thd, all)); + if ((ret= thd->wsrep_parallel_slave_wait_for_prior_commit())) + { + DBUG_RETURN(ret); + } if ((ret= thd->wsrep_cs().before_prepare()) == 0) { DBUG_ASSERT(!thd->wsrep_trx().ws_meta().gtid().is_undefined()); diff --git a/sql/wsrep_utils.h b/sql/wsrep_utils.h index 974c623521edb..743e8d1fb70f6 100644 --- a/sql/wsrep_utils.h +++ b/sql/wsrep_utils.h @@ -21,27 +21,6 @@ unsigned int wsrep_check_ip (const char* const addr, bool *is_ipv6); size_t wsrep_guess_ip (char* buf, size_t buf_len); -namespace wsp { -class node_status -{ -public: - node_status() : status(wsrep::server_state::s_disconnected) {} - void set(enum wsrep::server_state::state new_status, - const wsrep::view* view= 0) - { - if (status != new_status || 0 != view) - { - wsrep_notify_status(new_status, view); - status= new_status; - } - } - enum wsrep::server_state::state get() const { return status; } -private: - enum wsrep::server_state::state status; -}; -} /* namespace wsp */ - -extern wsp::node_status local_status; /* returns the length of the host part of the address string */ size_t wsrep_host_len(const char* addr, size_t addr_len); @@ -67,6 +46,7 @@ class Address { const char* get_address() { return m_address; } size_t get_address_len() { return m_address_len; } int get_port() { return m_port; } + void set_port(int port) { m_port= port; } private: enum family { diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 178ec603e7285..0de1b034953db 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -1,4 +1,4 @@ -/* Copyright 2008-2021 Codership Oy +/* Copyright 2008-2022 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 @@ -26,6 +26,7 @@ #include #include #include "wsrep_trans_observer.h" +#include "wsrep_server_state.h" ulong wsrep_reject_queries; @@ -118,8 +119,7 @@ bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type) if (wsrep_init()) { - my_error(ER_CANT_OPEN_LIBRARY, MYF(0), tmp, my_error, "wsrep_init failed"); - //rcode= true; + my_error(ER_CANT_OPEN_LIBRARY, MYF(0), tmp, errno, "wsrep_init failed"); saved_wsrep_on= false; } @@ -789,12 +789,30 @@ bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type) if (wsrep_slave_count_change > 0) { WSREP_DEBUG("Creating %d applier threads, total %ld", wsrep_slave_count_change, wsrep_slave_threads); + wsrep_thread_create_failed.store(false, std::memory_order_relaxed); res= wsrep_create_appliers(wsrep_slave_count_change, true); + mysql_mutex_unlock(&LOCK_global_system_variables); + mysql_mutex_unlock(&LOCK_wsrep_slave_threads); + // Thread creation and execution is asyncronous, therefore we need + // wait them to be started or error produced + while (wsrep_running_applier_threads != (ulong)wsrep_slave_threads && + !wsrep_thread_create_failed.load(std::memory_order_relaxed)) + { + my_sleep(1000); + } + + mysql_mutex_lock(&LOCK_global_system_variables); + + if (wsrep_thread_create_failed.load(std::memory_order_relaxed)) { + wsrep_slave_threads= wsrep_running_applier_threads; + return true; + } + WSREP_DEBUG("Running %lu applier threads", wsrep_running_applier_threads); wsrep_slave_count_change = 0; } - - mysql_mutex_unlock(&LOCK_wsrep_slave_threads); + else + mysql_mutex_unlock(&LOCK_wsrep_slave_threads); return res; } diff --git a/sql/xa.cc b/sql/xa.cc index af7c7388c5785..ff104dea6026d 100644 --- a/sql/xa.cc +++ b/sql/xa.cc @@ -600,6 +600,7 @@ bool trans_xa_commit(THD *thd) if (auto xs= xid_cache_search(thd, thd->lex->xid)) { + bool xid_deleted= false; res= xa_trans_rolled_back(xs); /* Acquire metadata lock which will ensure that COMMIT is blocked @@ -610,7 +611,7 @@ bool trans_xa_commit(THD *thd) */ MDL_request mdl_request; MDL_REQUEST_INIT(&mdl_request, MDL_key::BACKUP, "", "", MDL_BACKUP_COMMIT, - MDL_STATEMENT); + MDL_EXPLICIT); if (thd->mdl_context.acquire_lock(&mdl_request, thd->variables.lock_wait_timeout)) { @@ -621,25 +622,37 @@ bool trans_xa_commit(THD *thd) */ DBUG_ASSERT(thd->is_error()); - xs->acquired_to_recovered(); - DBUG_RETURN(true); + res= true; + goto _end_external_xid; } - DBUG_ASSERT(!xid_state.xid_cache_element); - - if (thd->wait_for_prior_commit()) + else { - DBUG_ASSERT(thd->is_error()); - - xs->acquired_to_recovered(); - DBUG_RETURN(true); + thd->backup_commit_lock= &mdl_request; } + DBUG_ASSERT(!xid_state.xid_cache_element); xid_state.xid_cache_element= xs; ha_commit_or_rollback_by_xid(thd->lex->xid, !res); - xid_state.xid_cache_element= 0; + if (!res && thd->is_error()) + { + // hton completion error retains xs/xid in the cache, + // unless there had been already one as reflected by `res`. + res= true; + goto _end_external_xid; + } + xid_cache_delete(thd, xs); + xid_deleted= true; + _end_external_xid: + xid_state.xid_cache_element= 0; res= res || thd->is_error(); - xid_cache_delete(thd, xs); + if (!xid_deleted) + xs->acquired_to_recovered(); + if (mdl_request.ticket) + { + thd->mdl_context.release_lock(mdl_request.ticket); + thd->backup_commit_lock= 0; + } } else my_error(ER_XAER_NOTA, MYF(0)); @@ -761,9 +774,11 @@ bool trans_xa_rollback(THD *thd) if (auto xs= xid_cache_search(thd, thd->lex->xid)) { + bool res; + bool xid_deleted= false; MDL_request mdl_request; MDL_REQUEST_INIT(&mdl_request, MDL_key::BACKUP, "", "", MDL_BACKUP_COMMIT, - MDL_STATEMENT); + MDL_EXPLICIT); if (thd->mdl_context.acquire_lock(&mdl_request, thd->variables.lock_wait_timeout)) { @@ -774,23 +789,33 @@ bool trans_xa_rollback(THD *thd) */ DBUG_ASSERT(thd->is_error()); - xs->acquired_to_recovered(); - DBUG_RETURN(true); + goto _end_external_xid; } - xa_trans_rolled_back(xs); - DBUG_ASSERT(!xid_state.xid_cache_element); - - if (thd->wait_for_prior_commit()) + else { - DBUG_ASSERT(thd->is_error()); - xs->acquired_to_recovered(); - DBUG_RETURN(true); + thd->backup_commit_lock= &mdl_request; } + res= xa_trans_rolled_back(xs); + DBUG_ASSERT(!xid_state.xid_cache_element); xid_state.xid_cache_element= xs; ha_commit_or_rollback_by_xid(thd->lex->xid, 0); - xid_state.xid_cache_element= 0; + if (!res && thd->is_error()) + { + goto _end_external_xid; + } xid_cache_delete(thd, xs); + xid_deleted= true; + + _end_external_xid: + xid_state.xid_cache_element= 0; + if (!xid_deleted) + xs->acquired_to_recovered(); + if (mdl_request.ticket) + { + thd->mdl_context.release_lock(mdl_request.ticket); + thd->backup_commit_lock= 0; + } } else my_error(ER_XAER_NOTA, MYF(0)); diff --git a/storage/archive/azio.c b/storage/archive/azio.c index 3529d875f72d2..9cb9f4693ec8d 100644 --- a/storage/archive/azio.c +++ b/storage/archive/azio.c @@ -71,7 +71,7 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd) s->in = 0; s->out = 0; s->back = EOF; - s->crc = crc32(0L, Z_NULL, 0); + s->crc = 0; s->transparent = 0; s->mode = 'r'; s->version = (unsigned char)az_magic[1]; /* this needs to be a define to version */ @@ -249,8 +249,7 @@ int azdopen(azio_stream *s, File fd, int Flags) for end of file. IN assertion: the stream s has been sucessfully opened for reading. */ -int get_byte(s) - azio_stream *s; +int get_byte(azio_stream *s) { if (s->z_eof) return EOF; if (s->stream.avail_in == 0) @@ -427,8 +426,7 @@ void read_header(azio_stream *s, unsigned char *buffer) * Cleanup then free the given azio_stream. Return a zlib error code. Try freeing in the reverse order of allocations. */ -int destroy (s) - azio_stream *s; +int destroy (azio_stream *s) { int err = Z_OK; @@ -679,9 +677,7 @@ int do_flush (azio_stream *s, int flush) return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; } -int ZEXPORT azflush (s, flush) - azio_stream *s; - int flush; +int ZEXPORT azflush (azio_stream *s, int flush) { int err; @@ -708,8 +704,7 @@ int ZEXPORT azflush (s, flush) /* =========================================================================== Rewinds input file. */ -int azrewind (s) - azio_stream *s; +int azrewind (azio_stream *s) { if (s == NULL || s->mode != 'r') return -1; @@ -733,10 +728,7 @@ int azrewind (s) SEEK_END is not implemented, returns error. In this version of the library, azseek can be extremely slow. */ -my_off_t azseek (s, offset, whence) - azio_stream *s; - my_off_t offset; - int whence; +my_off_t azseek (azio_stream *s, my_off_t offset, int whence) { if (s == NULL || whence == SEEK_END || @@ -812,8 +804,7 @@ my_off_t azseek (s, offset, whence) given compressed file. This position represents a number of bytes in the uncompressed data stream. */ -my_off_t ZEXPORT aztell (file) - azio_stream *file; +my_off_t ZEXPORT aztell (azio_stream *file) { return azseek(file, 0L, SEEK_CUR); } diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 2df5456728586..19a0ffe028afc 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -785,7 +785,9 @@ int ha_archive::create(const char *name, TABLE *table_arg, { Field *field= key_part->field; - if (!(field->flags & AUTO_INCREMENT_FLAG)) + if (!(field->flags & AUTO_INCREMENT_FLAG) || + key_part->key_part_flag & HA_REVERSE_SORT) + { error= HA_WRONG_CREATE_OPTION; DBUG_PRINT("ha_archive", ("Index error in creating archive table")); diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h index 2bb5079868b3b..2e03ac639b50b 100644 --- a/storage/archive/ha_archive.h +++ b/storage/archive/ha_archive.h @@ -87,9 +87,7 @@ class ha_archive final : public handler public: ha_archive(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_archive() - { - } + ~ha_archive() = default; const char *index_type(uint inx) { return "NONE"; } ulonglong table_flags() const { diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h index baa140bc04aba..04ca65f2a53e1 100644 --- a/storage/blackhole/ha_blackhole.h +++ b/storage/blackhole/ha_blackhole.h @@ -44,9 +44,7 @@ class ha_blackhole final : public handler public: ha_blackhole(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_blackhole() - { - } + ~ha_blackhole() = default; /* The name of the index type that will be used for display don't implement this method unless you really have indexes diff --git a/storage/columnstore/CMakeLists.txt b/storage/columnstore/CMakeLists.txt index 6669862f03816..ebb138c70f070 100644 --- a/storage/columnstore/CMakeLists.txt +++ b/storage/columnstore/CMakeLists.txt @@ -5,6 +5,10 @@ if("NO" STREQUAL "${PLUGIN_COLUMNSTORE}") endif() add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) +IF(NOT PLUGIN_PERFSCHEMA STREQUAL NO) + add_definitions(-DHAVE_PSI_INTERFACE=) +ENDIF() + # this does everything, gets the var from the correct scope, appends new # values, sets in the correct scope @@ -13,6 +17,11 @@ macro(APPEND_FOR_CPACK V) set(${V} "${var}${ARGN}" PARENT_SCOPE) endmacro() +# don't use compression providers, there are standalone executables below +GET_PROPERTY(dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES) +LIST(REMOVE_ITEM dirs ${CMAKE_SOURCE_DIR}/include/providers) +SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "${dirs}") + IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") diff --git a/storage/columnstore/columnstore b/storage/columnstore/columnstore index 4dc5d3af0579a..b989238ff7996 160000 --- a/storage/columnstore/columnstore +++ b/storage/columnstore/columnstore @@ -1 +1 @@ -Subproject commit 4dc5d3af0579a50ac1b4d158d2ff0bcdf960ac04 +Subproject commit b989238ff79969f86ffee66620495d57c8c00691 diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index f36cdcb3b0005..4816086f7c885 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -69,6 +69,7 @@ IF(UNIX) DISABLE_WARNING("format-truncation") DISABLE_WARNING("implicit-fallthrough") DISABLE_WARNING("type-limits") + DISABLE_WARNING("deprecated-declarations") endif(NOT WITH_WARNINGS) add_definitions( -DUNIX -DLINUX -DUBUNTU ) @@ -361,26 +362,26 @@ IF(CONNECT_WITH_REST) # MESSAGE(STATUS "=====> REST support is ON") SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabrest.cpp tabrest.h) add_definitions(-DREST_SUPPORT) -# FIND_PACKAGE(cpprestsdk QUIET) -# IF (cpprestsdk_FOUND) +# FIND_PACKAGE(cpprestsdk QUIET) +# IF (cpprestsdk_FOUND) # IF(UNIX) -## INCLUDE_DIRECTORIES(${CPPRESTSDK_INCLUDE_DIR}) -## If needed edit next line to set the path to libcpprest.so -# SET(REST_LIBRARY -lcpprest) -# MESSAGE (STATUS ${REST_LIBRARY}) +## INCLUDE_DIRECTORIES(${CPPRESTSDK_INCLUDE_DIR}) +## If needed edit next line to set the path to libcpprest.so +# SET(REST_LIBRARY -lcpprest) +# MESSAGE (STATUS ${REST_LIBRARY}) # ELSE(NOT UNIX) -## Next line sets debug compile mode matching cpprest_2_10d.dll -## when it was binary installed (can be change later in Visual Studio) -## Comment it out if not needed depending on your cpprestsdk installation. +## Next line sets debug compile mode matching cpprest_2_10d.dll +## when it was binary installed (can be change later in Visual Studio) +## Comment it out if not needed depending on your cpprestsdk installation. # SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd") # ENDIF(UNIX) -## IF(REST_LIBRARY) why this? how about Windows -# SET(CONNECT_SOURCES ${CONNECT_SOURCES} restget.cpp) -# add_definitions(-DREST_SOURCE) -## ENDIF() -##ELSE(NOT cpprestsdk_FOUND) -## MESSAGE(STATUS "=====> cpprestsdk package not found") -# ENDIF (cpprestsdk_FOUND) +## IF(REST_LIBRARY) why this? how about Windows +# SET(CONNECT_SOURCES ${CONNECT_SOURCES} restget.cpp) +# add_definitions(-DREST_SOURCE) +## ENDIF() +## ELSE(NOT cpprestsdk_FOUND) +# MESSAGE(STATUS "=====> cpprestsdk package not found") +# ENDIF (cpprestsdk_FOUND) ENDIF(CONNECT_WITH_REST) ADD_FEATURE_INFO(CONNECT_REST CONNECT_WITH_REST "Support for REST API in the CONNECT storage engine") @@ -423,28 +424,22 @@ IF(MSVC AND (CMAKE_CXX_FLAGS MATCHES "/MP")) ENDIF() ENDIF() -IF(WIN32) +IF(MSVC) IF (libmongoc-1.0_FOUND) SET_TARGET_PROPERTIES(connect PROPERTIES LINK_FLAGS "/DELAYLOAD:libbson-1.0.dll /DELAYLOAD:libmongoc-1.0.dll") - ENDIF(libmongoc-1.0_FOUND) - -# Install some extra files that belong to connect engine - - INSTALL(FILES "$/ha_connect.lib" - DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine) -ENDIF(WIN32) - -IF(MSVC) - # Temporarily disable "conversion from size_t .." + ENDIF() + # Temporarily disable "conversion from size_t .." warnings IF(CMAKE_SIZEOF_VOID_P EQUAL 8) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4267") ENDIF() SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996") string(REPLACE "/permissive-" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + INSTALL(FILES "$/ha_connect.lib" + DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine) ENDIF() + IF(CONNECT_WITH_JDBC AND JAVA_FOUND AND JNI_FOUND) # TODO: Find how to compile and install the java wrapper classes # Find required libraries and include directories diff --git a/storage/connect/array.cpp b/storage/connect/array.cpp index 6d105c12a593e..1eeb4ac05ca29 100644 --- a/storage/connect/array.cpp +++ b/storage/connect/array.cpp @@ -89,7 +89,7 @@ PARRAY MakeValueArray(PGLOBAL g, PPARM pp) /*********************************************************************/ for (n = 0, parmp = pp; parmp; n++, parmp = parmp->Next) if (parmp->Type != valtyp) { - sprintf(g->Message, MSG(BAD_PARAM_TYPE), "MakeValueArray", parmp->Type); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_PARAM_TYPE), "MakeValueArray", parmp->Type); return NULL; } else if (valtyp == TYPE_STRING) len = MY_MAX(len, strlen((char*)parmp->Value)); @@ -176,7 +176,7 @@ ARRAY::ARRAY(PGLOBAL g, int type, int size, int length, int prec) break; #endif // 0 default: // This is illegal an causes an ill formed array building - sprintf(g->Message, MSG(BAD_ARRAY_TYPE), type); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_ARRAY_TYPE), type); Type = TYPE_ERROR; return; } // endswitch type @@ -224,7 +224,7 @@ ARRAY::ARRAY(PGLOBAL g, PQUERY qryp) : CSORT(false) // Value = qryp->GetColValue(0); // break; default: // This is illegal an causes an ill formed array building - sprintf(g->Message, MSG(BAD_ARRAY_TYPE), Type); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_ARRAY_TYPE), Type); Type = TYPE_ERROR; } // endswitch type @@ -285,7 +285,7 @@ void ARRAY::Empty(void) bool ARRAY::AddValue(PGLOBAL g, PSZ strp) { if (Type != TYPE_STRING) { - sprintf(g->Message, MSG(ADD_BAD_TYPE), GetTypeName(Type), "CHAR"); + snprintf(g->Message, sizeof(g->Message), MSG(ADD_BAD_TYPE), GetTypeName(Type), "CHAR"); return true; } // endif Type @@ -300,7 +300,7 @@ bool ARRAY::AddValue(PGLOBAL g, PSZ strp) bool ARRAY::AddValue(PGLOBAL g, void *p) { if (Type != TYPE_PCHAR) { - sprintf(g->Message, MSG(ADD_BAD_TYPE), GetTypeName(Type), "PCHAR"); + snprintf(g->Message, sizeof(g->Message), MSG(ADD_BAD_TYPE), GetTypeName(Type), "PCHAR"); return true; } // endif Type @@ -315,7 +315,7 @@ bool ARRAY::AddValue(PGLOBAL g, void *p) bool ARRAY::AddValue(PGLOBAL g, short n) { if (Type != TYPE_SHORT) { - sprintf(g->Message, MSG(ADD_BAD_TYPE), GetTypeName(Type), "SHORT"); + snprintf(g->Message, sizeof(g->Message), MSG(ADD_BAD_TYPE), GetTypeName(Type), "SHORT"); return true; } // endif Type @@ -330,7 +330,7 @@ bool ARRAY::AddValue(PGLOBAL g, short n) bool ARRAY::AddValue(PGLOBAL g, int n) { if (Type != TYPE_INT) { - sprintf(g->Message, MSG(ADD_BAD_TYPE), GetTypeName(Type), "INTEGER"); + snprintf(g->Message, sizeof(g->Message), MSG(ADD_BAD_TYPE), GetTypeName(Type), "INTEGER"); return true; } // endif Type @@ -345,7 +345,7 @@ bool ARRAY::AddValue(PGLOBAL g, int n) bool ARRAY::AddValue(PGLOBAL g, double d) { if (Type != TYPE_DOUBLE) { - sprintf(g->Message, MSG(ADD_BAD_TYPE), GetTypeName(Type), "DOUBLE"); + snprintf(g->Message, sizeof(g->Message), MSG(ADD_BAD_TYPE), GetTypeName(Type), "DOUBLE"); return true; } // endif Type @@ -361,7 +361,7 @@ bool ARRAY::AddValue(PGLOBAL g, double d) bool ARRAY::AddValue(PGLOBAL g, PXOB xp) { if (Type != xp->GetResultType()) { - sprintf(g->Message, MSG(ADD_BAD_TYPE), + snprintf(g->Message, sizeof(g->Message), MSG(ADD_BAD_TYPE), GetTypeName(xp->GetResultType()), GetTypeName(Type)); return true; } // endif Type @@ -377,7 +377,7 @@ bool ARRAY::AddValue(PGLOBAL g, PXOB xp) bool ARRAY::AddValue(PGLOBAL g, PVAL vp) { if (Type != vp->GetType()) { - sprintf(g->Message, MSG(ADD_BAD_TYPE), + snprintf(g->Message, sizeof(g->Message), MSG(ADD_BAD_TYPE), GetTypeName(vp->GetType()), GetTypeName(Type)); return true; } // endif Type @@ -404,7 +404,7 @@ bool ARRAY::GetSubValue(PGLOBAL g, PVAL valp, int *kp) PVBLK vblp; if (Type != TYPE_LIST) { - sprintf(g->Message, MSG(NO_SUB_VAL), Type); + snprintf(g->Message, sizeof(g->Message), MSG(NO_SUB_VAL), Type); return true; } // endif Type @@ -500,7 +500,7 @@ bool ARRAY::FilTest(PGLOBAL g, PVAL valp, OPVAL opc, int opm) vp = valp; } else if (opc != OP_EXIST) { - sprintf(g->Message, MSG(MISSING_ARG), opc); + snprintf(g->Message, sizeof(g->Message), MSG(MISSING_ARG), opc); throw (int)TYPE_ARRAY; } else // OP_EXIST return Nval > 0; @@ -581,7 +581,7 @@ int ARRAY::Convert(PGLOBAL g, int k, PVAL vp) Len = 1; break; default: - sprintf(g->Message, MSG(BAD_CONV_TYPE), Type); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_CONV_TYPE), Type); return TYPE_ERROR; } // endswitch k @@ -975,13 +975,13 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g) xtrc(1, "Arraylist: len=%d\n", len); p = (char *)PlugSubAlloc(g, NULL, len); - strcpy(p, "("); + safe_strcpy(p, len, "("); for (i = 0; i < Nval;) { Value->SetValue_pvblk(Vblp, i); Value->Prints(g, tp, z); - strcat(p, tp); - strcat(p, (++i == Nval) ? ")" : ","); + safe_strcat(p, len, tp); + safe_strcat(p, len, (++i == Nval) ? ")" : ","); } // enfor i xtrc(1, "Arraylist: newlen=%d\n", strlen(p)); diff --git a/storage/connect/blkfil.cpp b/storage/connect/blkfil.cpp index 93ae5a5ef0c21..692ef98a5e830 100644 --- a/storage/connect/blkfil.cpp +++ b/storage/connect/blkfil.cpp @@ -594,7 +594,7 @@ BLKFILIN::BLKFILIN(PGLOBAL g, PTDBDOS tdbp, int op, int opm, PXOB *xp) Type = Arap->GetResultType(); if (Colp->GetResultType() != Type) { - sprintf(g->Message, "BLKFILIN: %s", MSG(VALTYPE_NOMATCH)); + snprintf(g->Message, sizeof(g->Message), "BLKFILIN: %s", MSG(VALTYPE_NOMATCH)); throw g->Message; } else if (Colp->GetValue()->IsCi()) Arap->SetPrecision(g, 1); // Case insensitive diff --git a/storage/connect/blkfil.h b/storage/connect/blkfil.h index 61b02c53c14bd..27e6fd4b1668e 100644 --- a/storage/connect/blkfil.h +++ b/storage/connect/blkfil.h @@ -31,7 +31,7 @@ class DllExport BLOCKFILTER : public BLOCK { /* Block Filter */ virtual void Prints(PGLOBAL g, char *ps, uint z); protected: - BLOCKFILTER(void) {} // Standard constructor not to be used + BLOCKFILTER(void) = default; // Standard constructor not to be used // Members PTDBDOS Tdbp; // Owner TDB @@ -54,7 +54,7 @@ class DllExport BLKFILLOG : public BLOCKFILTER { /* Logical Op Block Filter */ virtual int BlockEval(PGLOBAL g); protected: - BLKFILLOG(void) {} // Standard constructor not to be used + BLKFILLOG(void) = default; // Standard constructor not to be used // Members PBF *Fil; // Points to Block filter args @@ -75,7 +75,7 @@ class DllExport BLKFILARI : public BLOCKFILTER { /* Arithm. Op Block Filter */ virtual void MakeValueBitmap(void) {} protected: - BLKFILARI(void) {} // Standard constructor not to be used + BLKFILARI(void) = default; // Standard constructor not to be used // Members PDOSCOL Colp; // Points to column argument @@ -97,7 +97,7 @@ class DllExport BLKFILAR2 : public BLKFILARI { /* Arithm. Op Block Filter */ virtual void MakeValueBitmap(void); protected: - BLKFILAR2(void) {} // Standard constructor not to be used + BLKFILAR2(void) = default; // Standard constructor not to be used // Members uint Bmp; // The value bitmap used to test blocks @@ -118,7 +118,7 @@ class DllExport BLKFILMR2 : public BLKFILARI { /* Arithm. Op Block Filter */ virtual void MakeValueBitmap(void); protected: - BLKFILMR2(void) {} // Standard constructor not to be used + BLKFILMR2(void) = default; // Standard constructor not to be used // Members int Nbm; // The number of ULONG bitmaps @@ -141,7 +141,7 @@ class DllExport BLKSPCARI : public BLOCKFILTER { /* Arithm. Op Block Filter */ virtual int BlockEval(PGLOBAL g); protected: - BLKSPCARI(void) {} // Standard constructor not to be used + BLKSPCARI(void) = default; // Standard constructor not to be used // Members PCOL Cpx; // Point to subquery "constant" column diff --git a/storage/connect/block.h b/storage/connect/block.h index e8871277d4861..5351c2e6354fa 100644 --- a/storage/connect/block.h +++ b/storage/connect/block.h @@ -55,7 +55,7 @@ class DllExport BLOCK { void operator delete(void*, long long) {} void operator delete(void*) {} - virtual ~BLOCK() {} + virtual ~BLOCK() = default; }; // end of class BLOCK #endif // !BLOCK_DEFINED diff --git a/storage/connect/bson.cpp b/storage/connect/bson.cpp index fa9cd5f1e52e6..6bea4eb5d85c9 100644 --- a/storage/connect/bson.cpp +++ b/storage/connect/bson.cpp @@ -10,6 +10,7 @@ /* Include relevant sections of the MariaDB header file. */ /***********************************************************************/ #include +#include /***********************************************************************/ /* Include application header files: */ @@ -135,7 +136,7 @@ PBVAL BDOC::ParseJson(PGLOBAL g, char* js, size_t lng) break; } // endif pretty - sprintf(g->Message, "Unexpected ',' (pretty=%d)", pretty); + snprintf(g->Message, sizeof(g->Message), "Unexpected ',' (pretty=%d)", pretty); throw 3; case '(': b = true; @@ -159,7 +160,7 @@ PBVAL BDOC::ParseJson(PGLOBAL g, char* js, size_t lng) }; // endswitch s[i] if (bvp->Type == TYPE_UNKNOWN) - sprintf(g->Message, "Invalid Json string '%.*s'", MY_MIN((int)len, 50), s); + snprintf(g->Message, sizeof(g->Message), "Invalid Json string '%.*s'", MY_MIN((int)len, 50), s); else if (pretty == 3) { for (i = 0; i < 3; i++) if (pty[i]) { @@ -598,7 +599,7 @@ PSZ BDOC::Serialize(PGLOBAL g, PBVAL bvp, char* fn, int pretty) try { if (!bvp) { - strcpy(g->Message, "Null json tree"); + safe_strcpy(g->Message, sizeof(g->Message), "Null json tree"); throw 1; } else if (!fn) { // Serialize to a string @@ -606,9 +607,8 @@ PSZ BDOC::Serialize(PGLOBAL g, PBVAL bvp, char* fn, int pretty) b = pretty == 1; } else { if (!(fs = fopen(fn, "wb"))) { - sprintf(g->Message, MSG(OPEN_MODE_ERROR), - "w", (int)errno, fn); - strcat(strcat(g->Message, ": "), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR) ": %s", + "w", (int)errno, fn, strerror(errno)); throw 2; } else if (pretty >= 2) { // Serialize to a pretty file diff --git a/storage/connect/bson.h b/storage/connect/bson.h index acc36e8e0ed2f..e3a15a41952f7 100644 --- a/storage/connect/bson.h +++ b/storage/connect/bson.h @@ -165,7 +165,7 @@ class BJSON : public BLOCK { protected: // Default constructor not to be used - BJSON(void) {} + BJSON(void) = default; }; // end of class BJSON /***********************************************************************/ @@ -203,5 +203,5 @@ class BDOC : public BJSON { bool comma; // True if Pretty = 1 // Default constructor not to be used - BDOC(void) {} + BDOC(void) = default; }; // end of class BDOC diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp index f513ffbdeab7e..f92bdb46727da 100644 --- a/storage/connect/bsonudf.cpp +++ b/storage/connect/bsonudf.cpp @@ -203,7 +203,7 @@ my_bool BJNX::SetArrayOptions(PGLOBAL g, char* p, int i, PSZ nm) p[--n] = 0; } else if (!IsNum(p)) { // Wrong array specification - sprintf(g->Message, "Invalid array specification %s", p); + snprintf(g->Message, sizeof(g->Message), "Invalid array specification %s", p); return true; } // endif p @@ -240,7 +240,7 @@ my_bool BJNX::SetArrayOptions(PGLOBAL g, char* p, int i, PSZ nm) jnp->Rank = atoi(p) - B; jnp->Op = OP_EQ; } else if (Wr) { - sprintf(g->Message, "Invalid specification %s in a write path", p); + snprintf(g->Message, sizeof(g->Message), "Invalid specification %s in a write path", p); return true; } else if (n == 1) { // Set the Op value; @@ -253,7 +253,7 @@ my_bool BJNX::SetArrayOptions(PGLOBAL g, char* p, int i, PSZ nm) case '#': jnp->Op = OP_NUM; break; case '*': jnp->Op = OP_EXP; break; default: - sprintf(g->Message, "Invalid function specification %c", *p); + snprintf(g->Message, sizeof(g->Message), "Invalid function specification %c", *p); return true; } // endswitch *p @@ -345,7 +345,7 @@ my_bool BJNX::ParseJpath(PGLOBAL g) } else if (*p == '*') { if (Wr) { - sprintf(g->Message, "Invalid specification %c in a write path", *p); + snprintf(g->Message, sizeof(g->Message), "Invalid specification %c in a write path", *p); return true; } else // Return JSON Nodes[i].Op = OP_XX; @@ -598,7 +598,7 @@ PBVAL BJNX::GetRowValue(PGLOBAL g, PBVAL row, int i) vlp = row; break; default: - sprintf(g->Message, "Invalid row JSON type %d", row->Type); + snprintf(g->Message, sizeof(g->Message), "Invalid row JSON type %d", row->Type); vlp = NULL; } // endswitch Type @@ -843,7 +843,7 @@ PBVAL BJNX::GetRow(PGLOBAL g) val = MVP(row->To_Val); break; default: - sprintf(g->Message, "Invalid row JSON type %d", row->Type); + snprintf(g->Message, sizeof(g->Message), "Invalid row JSON type %d", row->Type); val = NULL; } // endswitch Type @@ -1035,7 +1035,7 @@ my_bool BJNX::CheckPath(PGLOBAL g) val = row; break; default: - sprintf(g->Message, "Invalid row JSON type %d", row->Type); + snprintf(g->Message, sizeof(g->Message), "Invalid row JSON type %d", row->Type); } // endswitch Type if (i < Nod-1) @@ -1064,7 +1064,7 @@ my_bool BJNX::CheckPath(PGLOBAL g, UDF_ARGS *args, PBVAL jsp, PBVAL& jvp, int n) return true; if (!(jvp = GetJson(g))) { - sprintf(g->Message, "No sub-item at '%s'", path); + snprintf(g->Message, sizeof(g->Message), "No sub-item at '%s'", path); return true; } else return false; @@ -1147,7 +1147,7 @@ my_bool BJNX::LocateArray(PGLOBAL g, PBVAL jarp) for (int i = 0; i < n && !Found; i++) { Jp->N = m; - sprintf(s, "[%d]", i + B); + snprintf(s, sizeof(s), "[%d]", i + B); if (Jp->WriteStr(s)) return true; @@ -1441,7 +1441,7 @@ my_bool BJNX::AddPath(void) for (int i = 0; i <= I; i++) { if (Jpnp[i].Type == TYPE_JAR) { - sprintf(s, "[%d]", Jpnp[i].N + B); + snprintf(s, sizeof(s), "[%d]", Jpnp[i].N + B); if (Jp->WriteStr(s)) return true; @@ -1632,7 +1632,7 @@ PBVAL BJNX::ParseJsonFile(PGLOBAL g, char *fn, int& pty, size_t& len) DWORD rc = GetLastError(); if (!(*g->Message)) - sprintf(g->Message, MSG(OPEN_MODE_ERROR), "map", (int)rc, fn); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR), "map", (int)rc, fn); return NULL; } // endif hFile @@ -1652,7 +1652,7 @@ PBVAL BJNX::ParseJsonFile(PGLOBAL g, char *fn, int& pty, size_t& len) if (!memory) { CloseFileHandle(hFile); - sprintf(g->Message, MSG(MAP_VIEW_ERROR), fn, GetLastError()); + snprintf(g->Message, sizeof(g->Message), MSG(MAP_VIEW_ERROR), fn, GetLastError()); return NULL; } // endif Memory @@ -3047,7 +3047,7 @@ my_bool bson_test_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { char* bson_test(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* res_length, char* is_null, char* error) { - char* str = NULL, * fn = NULL; + char* str = NULL, *fn = NULL; int pretty = 1; PBVAL bvp; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3572,16 +3572,16 @@ char *bson_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, } // endif Xchk if (!CheckMemory(g, initid, args, 2, false, false, true)) { - JTYP type; + JTYP type= TYPE_JAR; BJNX bnx(g); - PBVAL jvp, top = NULL; + PBVAL jvp = NULL, top = NULL; PBVAL jsp[2] = {NULL, NULL}; for (int i = 0; i < 2; i++) { jvp = bnx.MakeValue(args, i, true); if (i) { - if (jvp->Type != type) { + if (jvp && (jvp->Type != type)) { PUSH_WARNING("Argument types mismatch"); goto fin; } // endif type @@ -4767,7 +4767,7 @@ char *bfile_bjson(UDF_INIT *initid, UDF_ARGS *args, char *result, if (!fgets(buf, lrecl, fin)) { if (!feof(fin)) { - sprintf(g->Message, "Error %d reading %zd bytes from %s", + snprintf(g->Message, sizeof(g->Message), "Error %d reading %zu bytes from %s", errno, lrecl, fn); str = strcpy(result, g->Message); } else @@ -4779,11 +4779,11 @@ char *bfile_bjson(UDF_INIT *initid, UDF_ARGS *args, char *result, binszp = newloc - (size_t)jsp; if (fwrite(&binszp, sizeof(binszp), 1, fout) != 1) { - sprintf(g->Message, "Error %d writing %zd bytes to %s", + snprintf(g->Message, sizeof(g->Message), "Error %d writing %zu bytes to %s", errno, sizeof(binszp), ofn); str = strcpy(result, g->Message); } else if (fwrite(jsp, binszp, 1, fout) != 1) { - sprintf(g->Message, "Error %d writing %zd bytes to %s", + snprintf(g->Message, sizeof(g->Message), "Error %d writing %zu bytes to %s", errno, binszp, ofn); str = strcpy(result, g->Message); } else @@ -4911,7 +4911,7 @@ char *bbin_make_array(UDF_INIT *initid, UDF_ARGS *args, char *result, } // endfor i if ((bsp = BbinAlloc(bnx.G, initid->max_length, arp))) { - strcat(bsp->Msg, " array"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " array"); // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5109,8 +5109,9 @@ char *bbin_array_grp(UDF_INIT *initid, UDF_ARGS *, char *result, PUSH_WARNING("Result truncated to json_grp_size values"); if (arp) - if ((bsp = BbinAlloc(g, initid->max_length, arp))) - strcat(bsp->Msg, " array"); + if ((bsp = BbinAlloc(g, initid->max_length, arp))) { + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " array"); + } if (!bsp) { *res_length = 0; @@ -5156,8 +5157,9 @@ char *bbin_object_grp(UDF_INIT *initid, UDF_ARGS *, char *result, PUSH_WARNING("Result truncated to json_grp_size values"); if (bop) - if ((bsp = BbinAlloc(g, initid->max_length, bop))) - strcat(bsp->Msg, " object"); + if ((bsp = BbinAlloc(g, initid->max_length, bop))) { + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); + } if (!bsp) { *res_length = 0; @@ -5201,7 +5203,7 @@ char *bbin_make_object(UDF_INIT *initid, UDF_ARGS *args, char *result, bnx.SetKeyValue(objp, bnx.MakeValue(args, i), bnx.MakeKey(args, i)); if ((bsp = BbinAlloc(bnx.G, initid->max_length, objp))) { - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5256,7 +5258,7 @@ char *bbin_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, bnx.SetKeyValue(objp, jvp, bnx.MakeKey(args, i)); if ((bsp = BbinAlloc(bnx.G, initid->max_length, objp))) { - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5315,7 +5317,7 @@ char *bbin_object_key(UDF_INIT *initid, UDF_ARGS *args, char *result, bnx.SetKeyValue(objp, bnx.MakeValue(args, i + 1), MakePSZ(g, args, i)); if ((bsp = BbinAlloc(bnx.G, initid->max_length, objp))) { - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5669,7 +5671,6 @@ char *bbin_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, if (g->Xchk) { bsp = (PBSON)g->Xchk; } else if (!CheckMemory(g, initid, args, 1, true, true)) { - // char *path = MakePSZ(g, args, 1); BJNX bnx(g, NULL, TYPE_STRING, initid->max_length); PBVAL top, jvp = NULL; PBVAL jsp = bnx.MakeValue(args, 0, true, &top); @@ -5724,16 +5725,16 @@ char *bbin_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, } // endif Xchk if (!CheckMemory(g, initid, args, 2, false, false, true)) { - JTYP type; + JTYP type = TYPE_JAR; BJNX bnx(g); - PBVAL jvp, top = NULL; + PBVAL jvp = NULL, top = NULL; PBVAL jsp[2] = {NULL, NULL}; for (int i = 0; i < 2; i++) { if (i) { jvp = bnx.MakeValue(args, i, true); - if (jvp->Type != type) { + if (jvp && (jvp->Type != type)) { PUSH_WARNING("Argument types mismatch"); goto fin; } // endif type @@ -6079,7 +6080,7 @@ char *bbin_file(UDF_INIT *initid, UDF_ARGS *args, char *result, // pretty = pty; if ((bsp = BbinAlloc(bnx.G, len, jsp))) { - strcat(bsp->Msg, " file"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " file"); bsp->Filename = fn; bsp->Pretty = pretty; } else { diff --git a/storage/connect/bsonudf.h b/storage/connect/bsonudf.h index 0fe3715617eaa..e355fe7b48e15 100644 --- a/storage/connect/bsonudf.h +++ b/storage/connect/bsonudf.h @@ -143,7 +143,7 @@ class BJNX : public BDOC { my_bool AddPath(void); // Default constructor not to be used - BJNX(void) {} + BJNX(void) = default; // Members PBVAL Row; diff --git a/storage/connect/catalog.h b/storage/connect/catalog.h index 48347d7519e01..a46615f5d6ef9 100644 --- a/storage/connect/catalog.h +++ b/storage/connect/catalog.h @@ -39,9 +39,9 @@ typedef struct _colinfo { PCSZ Name; int Type; int Offset; - int Length; + unsigned Length; int Key; - int Precision; + unsigned Precision; int Scale; int Opt; int Freq; @@ -61,7 +61,7 @@ class DllExport CATALOG { friend class OEMDEF; public: CATALOG(void); // Constructor - virtual ~CATALOG() { } // Make -Wdelete-non-virtual-dtor happy + virtual ~CATALOG() = default; // Make -Wdelete-non-virtual-dtor happy // Implementation int GetCblen(void) {return Cblen;} diff --git a/storage/connect/cmgoconn.cpp b/storage/connect/cmgoconn.cpp index f3fc30fa9e242..3ecdb02a81388 100644 --- a/storage/connect/cmgoconn.cpp +++ b/storage/connect/cmgoconn.cpp @@ -175,7 +175,7 @@ bool CMgoConn::Connect(PGLOBAL g) Uri = mongoc_uri_new_with_error(Pcg->Uristr, &Error); if (!Uri) { - sprintf(g->Message, "Failed to parse URI: \"%s\" Msg: %s", + snprintf(g->Message, sizeof(g->Message), "Failed to parse URI: \"%s\" Msg: %s", Pcg->Uristr, Error.message); return true; } // endif Uri @@ -196,7 +196,7 @@ bool CMgoConn::Connect(PGLOBAL g) Client = mongoc_client_new_from_uri (Uri); if (!Client) { - sprintf(g->Message, "Failed to get Client"); + snprintf(g->Message, sizeof(g->Message), "Failed to get Client"); return true; } // endif Client @@ -212,7 +212,7 @@ bool CMgoConn::Connect(PGLOBAL g) Collection = mongoc_client_get_collection(Client, Pcg->Db_name, Pcg->Coll_name); if (!Collection) { - sprintf(g->Message, "Failed to get Collection %s.%s", + snprintf(g->Message, sizeof(g->Message), "Failed to get Collection %s.%s", Pcg->Db_name, Pcg->Coll_name); return true; } // endif Collection @@ -420,7 +420,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g) Query = bson_new_from_json((const uint8_t *)p, -1, &Error); if (!Query) { - sprintf(g->Message, "Wrong pipeline: %s", Error.message); + snprintf(g->Message, sizeof(g->Message), "Wrong pipeline: %s", Error.message); return true; } // endif Query @@ -428,7 +428,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g) Query, NULL, NULL); if (mongoc_cursor_error(Cursor, &Error)) { - sprintf(g->Message, "Mongo aggregate Failure: %s", Error.message); + snprintf(g->Message, sizeof(g->Message), "Mongo aggregate Failure: %s", Error.message); return true; } // endif error @@ -468,7 +468,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g) Query = bson_new_from_json((const uint8_t *)s->GetStr(), -1, &Error); if (!Query) { - sprintf(g->Message, "Wrong filter: %s", Error.message); + snprintf(g->Message, sizeof(g->Message), "Wrong filter: %s", Error.message); return true; } // endif Query @@ -503,7 +503,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g) Opts = bson_new_from_json((const uint8_t *)p, -1, &Error); if (!Opts) { - sprintf(g->Message, "Wrong options: %s", Error.message); + snprintf(g->Message, sizeof(g->Message), "Wrong options: %s", Error.message); return true; } // endif Opts @@ -532,7 +532,7 @@ int CMgoConn::ReadNext(PGLOBAL g) htrc("%s\n", GetDocument(g)); } else if (mongoc_cursor_error(Cursor, &Error)) { - sprintf(g->Message, "Mongo Cursor Failure: %s", Error.message); + snprintf(g->Message, sizeof(g->Message), "Mongo Cursor Failure: %s", Error.message); rc = RC_FX; } else rc = RC_EF; @@ -683,7 +683,7 @@ int CMgoConn::Write(PGLOBAL g) if (!mongoc_collection_insert(Collection, MONGOC_INSERT_NONE, Fpc->Child, NULL, &Error)) { - sprintf(g->Message, "Mongo insert: %s", Error.message); + snprintf(g->Message, sizeof(g->Message), "Mongo insert: %s", Error.message); rc = RC_FX; } // endif insert @@ -698,11 +698,11 @@ int CMgoConn::Write(PGLOBAL g) } // endif trace if (!doc) { - sprintf(g->Message, "bson_new_from_json: %s", Error.message); + snprintf(g->Message, sizeof(g->Message), "bson_new_from_json: %s", Error.message); rc = RC_FX; } else if (!mongoc_collection_insert(Collection, MONGOC_INSERT_NONE, doc, NULL, &Error)) { - sprintf(g->Message, "Mongo insert: %s", Error.message); + snprintf(g->Message, sizeof(g->Message), "Mongo insert: %s", Error.message); bson_destroy(doc); rc = RC_FX; } // endif insert @@ -759,14 +759,14 @@ int CMgoConn::Write(PGLOBAL g) if (rc == RC_OK) if (!mongoc_collection_update(Collection, MONGOC_UPDATE_NONE, query, update, NULL, &Error)) { - sprintf(g->Message, "Mongo update: %s", Error.message); + snprintf(g->Message, sizeof(g->Message), "Mongo update: %s", Error.message); rc = RC_FX; } // endif update bson_destroy(update); } else if (!mongoc_collection_remove(Collection, MONGOC_REMOVE_SINGLE_REMOVE, query, NULL, &Error)) { - sprintf(g->Message, "Mongo delete: %s", Error.message); + snprintf(g->Message, sizeof(g->Message), "Mongo delete: %s", Error.message); rc = RC_FX; } // endif remove @@ -790,7 +790,7 @@ bool CMgoConn::DocDelete(PGLOBAL g) if (!mongoc_collection_remove(Collection, MONGOC_REMOVE_NONE, Query, NULL, &Error)) { - sprintf(g->Message, "Mongo remove all: %s", Error.message); + snprintf(g->Message, sizeof(g->Message), "Mongo remove all: %s", Error.message); return true; } // endif remove @@ -843,7 +843,7 @@ char *CMgoConn::Mini(PGLOBAL g, PCOL colp, const bson_t *bson, bool b) s = str = bson_as_json(bson, &len); if (len > (size_t)colp->GetLength()) { - sprintf(g->Message, "Value too long for column %s", colp->GetName()); + snprintf(g->Message, sizeof(g->Message), "Value too long for column %s", colp->GetName()); bson_free(str); throw (int)TYPE_AM_MGO; } // endif len @@ -1061,7 +1061,7 @@ bool CMgoConn::AddValue(PGLOBAL g, PCOL colp, bson_t *doc, char *key, bool upd) rc = BSON_APPEND_DATE_TIME(doc, key, value->GetBigintValue() * 1000); break; default: - sprintf(g->Message, "Type %d not supported yet", colp->GetResultType()); + snprintf(g->Message, sizeof(g->Message), "Type %d not supported yet", colp->GetResultType()); return true; } // endswitch Buf_Type diff --git a/storage/connect/colblk.cpp b/storage/connect/colblk.cpp index d531685950d18..79fc2a5e076cd 100644 --- a/storage/connect/colblk.cpp +++ b/storage/connect/colblk.cpp @@ -177,7 +177,7 @@ bool COLBLK::InitValue(PGLOBAL g) /***********************************************************************/ bool COLBLK::SetBuffer(PGLOBAL g, PVAL, bool, bool) { - sprintf(g->Message, MSG(UNDEFINED_AM), "SetBuffer"); + snprintf(g->Message, sizeof(g->Message), MSG(UNDEFINED_AM), "SetBuffer"); return true; } // end of SetBuffer @@ -196,7 +196,7 @@ int COLBLK::GetLengthEx(void) /***********************************************************************/ void COLBLK::ReadColumn(PGLOBAL g) { - sprintf(g->Message, MSG(UNDEFINED_AM), "ReadColumn"); + snprintf(g->Message, sizeof(g->Message), MSG(UNDEFINED_AM), "ReadColumn"); throw (int)TYPE_COLBLK; } // end of ReadColumn @@ -207,7 +207,7 @@ void COLBLK::ReadColumn(PGLOBAL g) /***********************************************************************/ void COLBLK::WriteColumn(PGLOBAL g) { - sprintf(g->Message, MSG(UNDEFINED_AM), "WriteColumn"); + snprintf(g->Message, sizeof(g->Message), MSG(UNDEFINED_AM), "WriteColumn"); throw (int)TYPE_COLBLK; } // end of WriteColumn @@ -261,7 +261,7 @@ SPCBLK::SPCBLK(PCOLUMN cp) /***********************************************************************/ void SPCBLK::WriteColumn(PGLOBAL g) { - sprintf(g->Message, MSG(SPCOL_READONLY), Name); + snprintf(g->Message, sizeof(g->Message), MSG(SPCOL_READONLY), Name); throw (int)TYPE_COLBLK; } // end of WriteColumn diff --git a/storage/connect/colblk.h b/storage/connect/colblk.h index c9712f516b5ed..e67ba3ba3f983 100644 --- a/storage/connect/colblk.h +++ b/storage/connect/colblk.h @@ -177,7 +177,7 @@ class DllExport TIDBLK : public SPCBLK { protected: // Default constructor not to be used - TIDBLK(void) {} + TIDBLK(void) = default; // Members PCSZ Tname; // The current table name @@ -200,7 +200,7 @@ class DllExport PRTBLK : public SPCBLK { protected: // Default constructor not to be used - PRTBLK(void) {} + PRTBLK(void) = default; // Members PCSZ Pname; // The current partition name @@ -223,7 +223,7 @@ class DllExport SIDBLK : public SPCBLK { protected: // Default constructor not to be used - SIDBLK(void) {} + SIDBLK(void) = default; // Members PCSZ Sname; // The current server name diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc index ee62e0cd03ea8..72b12552b952c 100644 --- a/storage/connect/connect.cc +++ b/storage/connect/connect.cc @@ -148,7 +148,7 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname) /*********************************************************************/ /* All is correct. */ /*********************************************************************/ - sprintf(g->Message, MSG(DATABASE_LOADED), "???"); + snprintf(g->Message, sizeof(g->Message), MSG(DATABASE_LOADED), "???"); if (trace(1)) printf("msg=%s\n", g->Message); @@ -237,7 +237,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, bool del, PHC) { char *p; - int i, n; + int n; bool rcop= true; PCOL colp; //PCOLUMN cp; @@ -268,7 +268,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, if (!colp && !(mode == MODE_INSERT && tdbp->IsSpecial(p))) { if (g->Message[0] == 0) - sprintf(g->Message, MSG(COL_ISNOT_TABLE), p, tdbp->GetName()); + snprintf(g->Message, sizeof(g->Message), MSG(COL_ISNOT_TABLE), p, tdbp->GetName()); throw 1; } // endif colp @@ -276,7 +276,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, n = strlen(p) + 1; } // endfor p - for (i = 0, colp = tdbp->GetColumns(); colp; i++, colp = colp->GetNext()) { + for (colp = tdbp->GetColumns(); colp; colp = colp->GetNext()) { if (colp->InitValue(g)) throw 2; @@ -297,7 +297,14 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, PTDB utp; if (!(utp = tdbp->Duplicate(g))) { - sprintf(g->Message, MSG(INV_UPDT_TABLE), tdbp->GetName()); + /* If table type is of type virtual retrieve global parameter as it was.*/ + if (tdbp->GetAmType() == TYPE_AM_VIR) { + if (tdbp->OpenDB(g)) { + printf("%s\n", g->Message); + throw 7; + } + } + snprintf(g->Message, sizeof(g->Message), MSG(INV_UPDT_TABLE), tdbp->GetName()); throw 4; } // endif tp @@ -310,7 +317,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, n = strlen(p) + 1; } // endfor p - for (i = 0, colp = utp->GetColumns(); colp; i++, colp = colp->GetNext()) { + for (colp = utp->GetColumns(); colp; colp = colp->GetNext()) { if (colp->InitValue(g)) throw 5; @@ -546,7 +553,8 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort) if (!tdbp) return rc; // Nothing to do else if (tdbp->GetUse() != USE_OPEN) { - if (tdbp->GetAmType() == TYPE_AM_XML) + if (tdbp->GetAmType() == TYPE_AM_XML || + tdbp->GetAmType() == TYPE_AM_JSN) tdbp->CloseDB(g); // Opened by GetMaxSize return rc; @@ -626,7 +634,7 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted) if (!ptdb) return -1; else if (!ptdb->GetDef()->Indexable()) { - sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName()); + snprintf(g->Message, sizeof(g->Message), MSG(TABLE_NO_INDEX), ptdb->GetName()); return 0; } else if (ptdb->GetDef()->Indexable() == 3) { return 1; @@ -659,7 +667,7 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted) break; if (!xdp) { - sprintf(g->Message, "Wrong index ID %d", id); + snprintf(g->Message, sizeof(g->Message), "Wrong index ID %d", id); return 0; } // endif xdp @@ -718,7 +726,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op, x= ptdb->GetDef()->Indexable(); if (!x) { - sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName()); + snprintf(g->Message, sizeof(g->Message), MSG(TABLE_NO_INDEX), ptdb->GetName()); return RC_FX; } else if (x == 2) { // Remote index. Only used in read mode @@ -741,13 +749,13 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op, // Set reference values and index operator if (!tdbp->GetLink() || !tdbp->GetKindex()) { // if (!tdbp->To_Xdp) { - sprintf(g->Message, "Index not initialized for table %s", tdbp->GetName()); + snprintf(g->Message, sizeof(g->Message), "Index not initialized for table %s", tdbp->GetName()); return RC_FX; #if 0 } // endif !To_Xdp // Now it's time to make the dynamic index if (tdbp->InitialyzeIndex(g, NULL, false)) { - sprintf(g->Message, "Fail to make dynamic index %s", + snprintf(g->Message, sizeof(g->Message), "Fail to make dynamic index %s", tdbp->To_Xdp->GetName()); return RC_FX; } // endif MakeDynamicIndex @@ -787,10 +795,10 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op, if (rcb) { if (tdbp->RowNumber(g)) - sprintf(g->Message, "Out of range value for column %s at row %d", + snprintf(g->Message, sizeof(g->Message), "Out of range value for column %s at row %d", colp->GetName(), tdbp->RowNumber(g)); else - sprintf(g->Message, "Out of range value for column %s", + snprintf(g->Message, sizeof(g->Message), "Out of range value for column %s", colp->GetName()); PushWarning(g, tdbp); @@ -849,7 +857,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len, x= ptdb->GetDef()->Indexable(); if (!x) { - sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName()); + snprintf(g->Message, sizeof(g->Message), MSG(TABLE_NO_INDEX), ptdb->GetName()); DBUG_PRINT("Range", ("%s", g->Message)); return -1; } else if (x == 2) { @@ -869,7 +877,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len, if (!tdbp->GetKindex() || !tdbp->GetLink()) { if (!tdbp->GetXdp()) { - sprintf(g->Message, "Index not initialized for table %s", tdbp->GetName()); + snprintf(g->Message, sizeof(g->Message), "Index not initialized for table %s", tdbp->GetName()); DBUG_PRINT("Range", ("%s", g->Message)); return -1; } else // Dynamic index @@ -910,11 +918,11 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len, if (rcb) { if (tdbp->RowNumber(g)) - sprintf(g->Message, + snprintf(g->Message, sizeof(g->Message), "Out of range value for column %s at row %d", colp->GetName(), tdbp->RowNumber(g)); else - sprintf(g->Message, "Out of range value for column %s", + snprintf(g->Message, sizeof(g->Message), "Out of range value for column %s", colp->GetName()); PushWarning(g, tdbp); diff --git a/storage/connect/connect.h b/storage/connect/connect.h index d1fc2ea592fb8..af1b9ba726e55 100644 --- a/storage/connect/connect.h +++ b/storage/connect/connect.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 Street, Fifth Floor, Boston, MA 02110-1335 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ /**************** Cnt H Declares Source Code File (.H) *****************/ /* Name: CONNECT.H Version 2.4 */ diff --git a/storage/connect/csort.h b/storage/connect/csort.h index 6e7000598812b..cce01df4199c0 100644 --- a/storage/connect/csort.h +++ b/storage/connect/csort.h @@ -33,7 +33,7 @@ class DllExport CSORT { public: // Constructor CSORT(bool cns, int th = THRESH, int mth = MTHRESH); - virtual ~CSORT() {} + virtual ~CSORT() = default; protected: // Implementation /*********************************************************************/ diff --git a/storage/connect/domdoc.cpp b/storage/connect/domdoc.cpp index 482f0b347d2b1..268ad771ef949 100644 --- a/storage/connect/domdoc.cpp +++ b/storage/connect/domdoc.cpp @@ -33,7 +33,7 @@ using namespace MSXML2; inline bool TestHr(PGLOBAL g, HRESULT hr) { if FAILED(hr) { - sprintf(g->Message, "%s, hr=%d", MSG(COM_ERROR), hr); + snprintf(g->Message, sizeof(g->Message), "%s, hr=%d", MSG(COM_ERROR), hr); return true; } else return false; @@ -65,7 +65,7 @@ void CloseXMLFile(PGLOBAL g, PFBLOCK fp, bool all) } catch(_com_error e) { char *p = _com_util::ConvertBSTRToString(e.Description()); - sprintf(g->Message, "%s %s", MSG(COM_ERROR), p); + snprintf(g->Message, sizeof(g->Message), "%s %s", MSG(COM_ERROR), p); delete[] p; } catch(...) {} @@ -242,7 +242,7 @@ int DOMDOC::DumpDoc(PGLOBAL g, char *ofn) try { Docp->save(ofn); } catch(_com_error e) { - sprintf(g->Message, "%s: %s", MSG(COM_ERROR), + snprintf(g->Message, sizeof(g->Message), "%s: %s", MSG(COM_ERROR), _com_util::ConvertBSTRToString(e.Description())); rc = -1; } catch(...) {} @@ -332,16 +332,16 @@ RCODE DOMNODE::GetContent(PGLOBAL g, char *buf, int len) switch (lsr) { case 0: case ERROR_INSUFFICIENT_BUFFER: // 122L - sprintf(g->Message, "Truncated %s content", GetName(g)); + snprintf(g->Message, sizeof(g->Message), "Truncated %s content", GetName(g)); rc = RC_INFO; break; case ERROR_NO_UNICODE_TRANSLATION: // 1113L - sprintf(g->Message, "Invalid character(s) in %s content", + snprintf(g->Message, sizeof(g->Message), "Invalid character(s) in %s content", GetName(g)); rc = RC_INFO; break; default: - sprintf(g->Message, "System error getting %s content", + snprintf(g->Message, sizeof(g->Message), "System error getting %s content", GetName(g)); rc = RC_FX; break; @@ -370,7 +370,7 @@ bool DOMNODE::SetContent(PGLOBAL g, char *txtp, int len) if (!MultiByteToWideChar(CP_UTF8, 0, txtp, strlen(txtp) + 1, Ws, Len + 1)) { - sprintf(g->Message, MSG(WS_CONV_ERR), txtp); + snprintf(g->Message, sizeof(g->Message), MSG(WS_CONV_ERR), txtp); return true; } // endif @@ -451,7 +451,7 @@ PXNODE DOMNODE::SelectSingleNode(PGLOBAL g, char *xp, PXNODE np) } // endif dnp } catch(_com_error e) { - sprintf(g->Message, "%s: %s", MSG(COM_ERROR), + snprintf(g->Message, sizeof(g->Message), "%s: %s", MSG(COM_ERROR), _com_util::ConvertBSTRToString(e.Description())); } catch(...) {} @@ -642,7 +642,6 @@ bool DOMNODELIST::DropItem(PGLOBAL g, int n) if (Listp == NULL || Listp->length < n) return true; -//Listp->item[n] = NULL; La propri�t� n'a pas de m�thode 'set' return false; } // end of DeleteItem @@ -710,16 +709,16 @@ RCODE DOMATTR::GetText(PGLOBAL g, char *buf, int len) switch (lsr) { case 0: case ERROR_INSUFFICIENT_BUFFER: // 122L - sprintf(g->Message, "Truncated %s content", GetName(g)); + snprintf(g->Message, sizeof(g->Message), "Truncated %s content", GetName(g)); rc = RC_INFO; break; case ERROR_NO_UNICODE_TRANSLATION: // 1113L - sprintf(g->Message, "Invalid character(s) in %s content", + snprintf(g->Message, sizeof(g->Message), "Invalid character(s) in %s content", GetName(g)); rc = RC_INFO; break; default: - sprintf(g->Message, "System error getting %s content", + snprintf(g->Message, sizeof(g->Message), "System error getting %s content", GetName(g)); rc = RC_FX; break; @@ -745,7 +744,7 @@ bool DOMATTR::SetText(PGLOBAL g, char *txtp, int len) if (!MultiByteToWideChar(CP_UTF8, 0, txtp, strlen(txtp) + 1, Ws, Len + 1)) { - sprintf(g->Message, MSG(WS_CONV_ERR), txtp); + snprintf(g->Message, sizeof(g->Message), MSG(WS_CONV_ERR), txtp); return true; } // endif diff --git a/storage/connect/filamap.cpp b/storage/connect/filamap.cpp index 4930e3944af9e..1b38ab2ee570b 100644 --- a/storage/connect/filamap.cpp +++ b/storage/connect/filamap.cpp @@ -163,7 +163,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g) DWORD rc = GetLastError(); if (!(*g->Message)) - sprintf(g->Message, MSG(OPEN_MODE_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR), "map", (int) rc, filename); if (trace(1)) @@ -192,7 +192,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g) if (!Memory) { CloseFileHandle(hFile); - sprintf(g->Message, MSG(MAP_VIEW_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(MAP_VIEW_ERROR), filename, GetLastError()); return true; } // endif Memory @@ -473,7 +473,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc) DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN); if (drc == 0xFFFFFFFF) { - sprintf(g->Message, MSG(FUNCTION_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(FUNCTION_ERROR), "SetFilePointer", GetLastError()); CloseHandle(fp->Handle); return RC_FX; @@ -483,7 +483,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc) htrc("done, Tpos=%p newsize=%d drc=%d\n", Tpos, n, drc); if (!SetEndOfFile(fp->Handle)) { - sprintf(g->Message, MSG(FUNCTION_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(FUNCTION_ERROR), "SetEndOfFile", GetLastError()); CloseHandle(fp->Handle); return RC_FX; @@ -491,7 +491,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc) #else // UNIX if (ftruncate(fp->Handle, (off_t)n)) { - sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(TRUNCATE_ERROR), strerror(errno)); close(fp->Handle); return RC_FX; } // endif diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp index 4686f7dcff2c7..7cd46fd118184 100644 --- a/storage/connect/filamdbf.cpp +++ b/storage/connect/filamdbf.cpp @@ -158,7 +158,7 @@ static int dbfhead(PGLOBAL g, FILE *file, PCSZ fn, DBFHEADER *buf) // Check last byte(s) of header if (fseek(file, buf->Headlen() - dbc, SEEK_SET) != 0) { - sprintf(g->Message, MSG(BAD_HEADER), fn); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_HEADER), fn); return RC_FX; } // endif fseek @@ -169,7 +169,7 @@ static int dbfhead(PGLOBAL g, FILE *file, PCSZ fn, DBFHEADER *buf) // Some files have just 1D others have 1D00 following fields if (endmark[0] != EOH && endmark[1] != EOH) { - sprintf(g->Message, MSG(NO_0DH_HEAD), dbc); + snprintf(g->Message, sizeof(g->Message), MSG(NO_0DH_HEAD), dbc); if (rc == RC_OK) return RC_FX; @@ -215,7 +215,7 @@ static int dbfields(PGLOBAL g, DBFHEADER* hdrp) // Some headers just have 1D others have 1D00 following fields if (endmark[0] != EOH && endmark[1] != EOH) { - sprintf(g->Message, MSG(NO_0DH_HEAD), dbc); + snprintf(g->Message, sizeof(g->Message), MSG(NO_0DH_HEAD), dbc); if (rc == RC_OK) return RC_FX; @@ -245,7 +245,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, PTOS topt, bool info) int rc, type, len, field, fields; bool bad, mul; PCSZ target, pwd; - DBFHEADER mainhead, *hp; + DBFHEADER mainhead, *hp = NULL; DESCRIPTOR thisfield, *tfp; FILE *infile = NULL; UNZIPUTL *zutp = NULL; @@ -353,7 +353,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, PTOS topt, bool info) if (topt->zipped) { tfp = (DESCRIPTOR*)((char*)tfp + HEADLEN); } else if (fread(tfp, HEADLEN, 1, infile) != 1) { - sprintf(g->Message, MSG(ERR_READING_REC), field+1, fn); + snprintf(g->Message, sizeof(g->Message), MSG(ERR_READING_REC), field+1, fn); goto err; } // endif fread @@ -394,7 +394,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, PTOS topt, bool info) break; default: if (!info) { - sprintf(g->Message, MSG(BAD_DBF_TYPE), tfp->Type + snprintf(g->Message, sizeof(g->Message), MSG(BAD_DBF_TYPE), tfp->Type , tfp->Name); goto err; } // endif info @@ -443,7 +443,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, PTOS topt, bool info) hp->Headlen, hp->Filedate[0], hp->Filedate[1], hp->Filedate[2]); - strcat(g->Message, buf); + safe_strcat(g->Message, sizeof(g->Message), buf); } // endif info #endif // 0 @@ -543,7 +543,7 @@ int DBFFAM::Cardinality(PGLOBAL g) if (rln && Lrecl != rln) { // This happens always on some Linux platforms - sprintf(g->Message, MSG(BAD_LRECL), Lrecl, (ushort)rln); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_LRECL), Lrecl, (ushort)rln); if (Accept) { Lrecl = rln; @@ -610,7 +610,7 @@ bool DBFFAM::OpenTableFile(PGLOBAL g) strcpy(opmode, "a+"); break; default: - sprintf(g->Message, MSG(BAD_OPEN_MODE), mode); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode); return true; } // endswitch Mode @@ -657,7 +657,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g) /* translating 0A bytes (LF) into 0D0A (CRLF) by Windows in text mode. */ /************************************************************************/ if (_setmode(_fileno(Stream), _O_BINARY) == -1) { - sprintf(g->Message, MSG(BIN_MODE_FAIL), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(BIN_MODE_FAIL), strerror(errno)); return true; } // endif setmode #endif // _WIN32 @@ -686,7 +686,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g) } // endif Flags if (Lrecl != reclen) { - sprintf(g->Message, MSG(BAD_LRECL), Lrecl, reclen); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_LRECL), Lrecl, reclen); if (Accept) { Lrecl = reclen; @@ -728,7 +728,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g) case 'D': // Date break; default: // Should never happen - sprintf(g->Message, MSG(BAD_DBF_TYPE), + snprintf(g->Message, sizeof(g->Message), MSG(BAD_DBF_TYPE), c, cdp->GetName()); return true; } // endswitch c @@ -742,7 +742,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g) // Now write the header if (fwrite(header, 1, hlen, Stream) != (unsigned)hlen) { - sprintf(g->Message, MSG(FWRITE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FWRITE_ERROR), strerror(errno)); return true; } // endif fwrite @@ -770,7 +770,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g) if ((rc = dbfhead(g, Stream, Tdbp->GetFile(g), &header)) == RC_OK) { if (Lrecl != (int)header.Reclen()) { - sprintf(g->Message, MSG(BAD_LRECL), Lrecl, header.Reclen()); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_LRECL), Lrecl, header.Reclen()); if (Accept) { Lrecl = header.Reclen(); @@ -800,7 +800,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g) rc = fseek(Stream, Headlen, SEEK_SET); if (rc) { - sprintf(g->Message, MSG(BAD_DBF_FILE), Tdbp->GetFile(g)); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_DBF_FILE), Tdbp->GetFile(g)); return true; } // endif fseek @@ -858,7 +858,7 @@ int DBFFAM::ReadBuffer(PGLOBAL g) break; default: if (++Nerr >= Maxerr && !Accept) { - sprintf(g->Message, MSG(BAD_DBF_REC), Tdbp->GetFile(g), GetRowID()); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_DBF_REC), Tdbp->GetFile(g), GetRowID()); rc = RC_FX; } else rc = (Accept) ? RC_OK : RC_NF; @@ -883,9 +883,9 @@ bool DBFFAM::CopyHeader(PGLOBAL g) if (fseek(Stream, 0, SEEK_SET)) strcpy(g->Message, "Seek error in CopyHeader"); else if ((n = fread(hdr, 1, hlen, Stream)) != hlen) - sprintf(g->Message, MSG(BAD_READ_NUMBER), (int) n, To_File); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_READ_NUMBER), (int) n, To_File); else if ((n = fwrite(hdr, 1, hlen, T_Stream)) != hlen) - sprintf(g->Message, MSG(WRITE_STRERROR), To_Fbt->Fname + snprintf(g->Message, sizeof(g->Message), MSG(WRITE_STRERROR), To_Fbt->Fname , strerror(errno)); else if (fseek(Stream, pos, SEEK_SET)) strcpy(g->Message, "Seek error in CopyHeader"); @@ -911,16 +911,16 @@ int DBFFAM::InitDelete(PGLOBAL g, int fpos, int spos) if (Nrec != 1) strcpy(g->Message, "Cannot delete in block mode"); else if (fseek(Stream, Headlen + fpos * Lrecl, SEEK_SET)) - sprintf(g->Message, MSG(FSETPOS_ERROR), 0); + snprintf(g->Message, sizeof(g->Message), MSG(FSETPOS_ERROR), 0); else if (fread(To_Buf, 1, lrecl, Stream) != lrecl) - sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, strerror(errno)); else *To_Buf = '*'; if (fseek(Stream, Headlen + fpos * Lrecl, SEEK_SET)) - sprintf(g->Message, MSG(FSETPOS_ERROR), 0); + snprintf(g->Message, sizeof(g->Message), MSG(FSETPOS_ERROR), 0); else if (fwrite(To_Buf, 1, lrecl, Stream) != lrecl) - sprintf(g->Message, MSG(FWRITE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FWRITE_ERROR), strerror(errno)); else rc = RC_NF; // Ok, Nothing else to do @@ -1064,7 +1064,7 @@ int DBMFAM::Cardinality(PGLOBAL g) if (rln && Lrecl != rln) { // This happens always on some Linux platforms - sprintf(g->Message, MSG(BAD_LRECL), Lrecl, (ushort)rln); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_LRECL), Lrecl, (ushort)rln); if (Accept) { Lrecl = rln; @@ -1117,7 +1117,7 @@ bool DBMFAM::AllocateBuffer(PGLOBAL g) DBFHEADER *hp = (DBFHEADER*)Memory; if (Lrecl != (int)hp->Reclen()) { - sprintf(g->Message, MSG(BAD_LRECL), Lrecl, hp->Reclen()); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_LRECL), Lrecl, hp->Reclen()); if (Accept) { Lrecl = hp->Reclen(); @@ -1170,7 +1170,7 @@ int DBMFAM::ReadBuffer(PGLOBAL g) break; default: if (++Nerr >= Maxerr && !Accept) { - sprintf(g->Message, MSG(BAD_DBF_REC), Tdbp->GetFile(g), GetRowID()); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_DBF_REC), Tdbp->GetFile(g), GetRowID()); rc = RC_FX; } else rc = (Accept) ? RC_OK : RC_NF; diff --git a/storage/connect/filamdbf.h b/storage/connect/filamdbf.h index dfe5cb5cfc40a..6cf6331abd4e1 100644 --- a/storage/connect/filamdbf.h +++ b/storage/connect/filamdbf.h @@ -35,7 +35,7 @@ class DllExport DBFBASE { protected: // Default constructor, not to be used - DBFBASE(void) {} + DBFBASE(void) = default; // Members int Records; /* records in the file */ diff --git a/storage/connect/filamfix.cpp b/storage/connect/filamfix.cpp index 46f3ea0112967..3298a83394c39 100644 --- a/storage/connect/filamfix.cpp +++ b/storage/connect/filamfix.cpp @@ -36,6 +36,8 @@ #include #endif // !_WIN32 +#include + /***********************************************************************/ /* Include application header files: */ /* global.h is header containing all global declarations. */ @@ -236,10 +238,10 @@ int FIXFAM::WriteModifiedBlock(PGLOBAL g) // Fpos is last position, Headlen is DBF file header length else if (!moved && fseek(Stream, Headlen + Fpos * Lrecl, SEEK_SET)) { - sprintf(g->Message, MSG(FSETPOS_ERROR), 0); + snprintf(g->Message, sizeof(g->Message), MSG(FSETPOS_ERROR), 0); rc = RC_FX; } else if (fwrite(To_Buf, Lrecl, Rbuf, T_Stream) != (size_t)Rbuf) { - sprintf(g->Message, MSG(FWRITE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FWRITE_ERROR), strerror(errno)); rc = RC_FX; } else Spos = Fpos + Nrec; // + Rbuf ??? @@ -316,7 +318,7 @@ int FIXFAM::ReadBuffer(PGLOBAL g) if (CurBlk != OldBlk + 1) // Note: Headlen is for DBF tables if (fseek(Stream, Headlen + Fpos * Lrecl, SEEK_SET)) { - sprintf(g->Message, MSG(FSETPOS_ERROR), Fpos); + snprintf(g->Message, sizeof(g->Message), MSG(FSETPOS_ERROR), Fpos); return RC_FX; } // endif fseek @@ -337,9 +339,9 @@ int FIXFAM::ReadBuffer(PGLOBAL g) rc = RC_EF; } else { #if defined(_WIN32) - sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, _strerror(NULL)); #else - sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, strerror(errno)); #endif if (trace(1)) @@ -377,7 +379,7 @@ int FIXFAM::WriteBuffer(PGLOBAL g) // Now start the writing process. if (fwrite(To_Buf, Lrecl, Rbuf, Stream) != (size_t)Rbuf) { - sprintf(g->Message, MSG(FWRITE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FWRITE_ERROR), strerror(errno)); Closing = true; // To tell CloseDB about a Write error return RC_FX; } // endif size @@ -482,7 +484,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc) if (moved) { if (fseek(Stream, Spos * Lrecl, SEEK_SET)) { - sprintf(g->Message, MSG(FSETPOS_ERROR), 0); + snprintf(g->Message, sizeof(g->Message), MSG(FSETPOS_ERROR), 0); return RC_FX; } // endif fseek @@ -524,13 +526,13 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc) /*****************************************************************/ #if defined(UNIX) if (ftruncate(h, (off_t)(Tpos * Lrecl))) { - sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(TRUNCATE_ERROR), strerror(errno)); close(h); return RC_FX; } // endif #else if (chsize(h, Tpos * Lrecl)) { - sprintf(g->Message, MSG(CHSIZE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(CHSIZE_ERROR), strerror(errno)); close(h); return RC_FX; } // endif @@ -563,7 +565,7 @@ bool FIXFAM::MoveIntermediateLines(PGLOBAL g, bool *b) /*******************************************************************/ if (!UseTemp || !*b) if (fseek(Stream, Headlen + Spos * Lrecl, SEEK_SET)) { - sprintf(g->Message, MSG(READ_SEEK_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_SEEK_ERROR), strerror(errno)); return true; } // endif @@ -574,18 +576,18 @@ bool FIXFAM::MoveIntermediateLines(PGLOBAL g, bool *b) htrc("after read req=%d len=%d\n", req, len); if (len != req) { - sprintf(g->Message, MSG(DEL_READ_ERROR), (int) req, (int) len); + snprintf(g->Message, sizeof(g->Message), MSG(DEL_READ_ERROR), (int) req, (int) len); return true; } // endif len if (!UseTemp) // Delete mode, cannot be a DBF file if (fseek(T_Stream, Tpos * Lrecl, SEEK_SET)) { - sprintf(g->Message, MSG(WRITE_SEEK_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(WRITE_SEEK_ERR), strerror(errno)); return true; } // endif if ((len = fwrite(DelBuf, Lrecl, req, T_Stream)) != req) { - sprintf(g->Message, MSG(DEL_WRITE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(DEL_WRITE_ERROR), strerror(errno)); return true; } // endif @@ -689,13 +691,12 @@ bool BGXFAM::BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, int org) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, drc, 0, (LPTSTR)buf, sizeof(buf), NULL); - sprintf(g->Message, MSG(SFP_ERROR), buf); + snprintf(g->Message, sizeof(g->Message), MSG(SFP_ERROR), buf); return true; } // endif #else // !_WIN32 if (lseek64(h, pos, org) < 0) { -// sprintf(g->Message, MSG(ERROR_IN_LSK), errno); - sprintf(g->Message, "lseek64: %s", strerror(errno)); + snprintf(g->Message, sizeof(g->Message), "lseek64: %s", strerror(errno)); printf("%s\n", g->Message); return true; } // endif @@ -726,7 +727,7 @@ int BGXFAM::BigRead(PGLOBAL g __attribute__((unused)), FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, drc, 0, (LPTSTR)buf, sizeof(buf), NULL); - sprintf(g->Message, MSG(READ_ERROR), To_File, buf); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, buf); if (trace(2)) htrc("BIGREAD: %s\n", g->Message); @@ -771,7 +772,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req) (LPTSTR)buf, sizeof(buf), NULL); } // endelse brc - sprintf(g->Message, MSG(WRITE_STRERROR), fn, buf); + snprintf(g->Message, sizeof(g->Message), MSG(WRITE_STRERROR), fn, buf); if (trace(2)) htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n", @@ -786,7 +787,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req) if (nbw != (ssize_t)len) { const char *fn = (h == Hfile) ? To_File : "Tempfile"; - sprintf(g->Message, MSG(WRITE_STRERROR), fn, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(WRITE_STRERROR), fn, strerror(errno)); if (trace(2)) htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n", @@ -820,7 +821,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g) PDBUSER dbuserp = PlgGetUser(g); if ((To_Fb && To_Fb->Count) || Hfile != INVALID_HANDLE_VALUE) { - sprintf(g->Message, MSG(FILE_OPEN_YET), To_File); + snprintf(g->Message, sizeof(g->Message), MSG(FILE_OPEN_YET), To_File); return true; } // endif @@ -869,7 +870,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g) creation = OPEN_ALWAYS; break; default: - sprintf(g->Message, MSG(BAD_OPEN_MODE), mode); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode); return true; } // endswitch @@ -878,11 +879,10 @@ bool BGXFAM::OpenTableFile(PGLOBAL g) if (Hfile == INVALID_HANDLE_VALUE) { rc = GetLastError(); - sprintf(g->Message, MSG(OPEN_ERROR), rc, mode, filename); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, mode, filename); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)filename, sizeof(filename), NULL); - strcat(g->Message, filename); } else rc = 0; @@ -929,7 +929,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g) // tmode = S_IREAD | S_IWRITE; break; default: - sprintf(g->Message, MSG(BAD_OPEN_MODE), mode); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode); return true; } // endswitch @@ -999,11 +999,11 @@ int BGXFAM::Cardinality(PGLOBAL g) if (h == INVALID_HANDLE_VALUE) if ((rc = GetLastError()) != ERROR_FILE_NOT_FOUND) { - sprintf(g->Message, MSG(OPEN_ERROR), rc, 10, filename); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, 10, filename); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)filename, sizeof(filename), NULL); - strcat(g->Message, filename); + safe_strcat(g->Message, sizeof(g->Message), filename); return -1; } else return 0; // File does not exist @@ -1015,7 +1015,7 @@ int BGXFAM::Cardinality(PGLOBAL g) len.LowPart = GetFileSize(Hfile, (LPDWORD)&len.HighPart); if (len.LowPart == 0xFFFFFFFF && (rc = GetLastError()) != NO_ERROR) { - sprintf(g->Message, MSG(FILELEN_ERROR), "GetFileSize", filename); + snprintf(g->Message, sizeof(g->Message), MSG(FILELEN_ERROR), "GetFileSize", filename); return -2; } else fsize = len.QuadPart; @@ -1032,7 +1032,7 @@ int BGXFAM::Cardinality(PGLOBAL g) htrc(" errno=%d ENOENT=%d\n", errno, ENOENT); if (errno != ENOENT) { - sprintf(g->Message, MSG(OPEN_ERROR_IS), + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR_IS), filename, strerror(errno)); return -1; } else @@ -1051,7 +1051,7 @@ int BGXFAM::Cardinality(PGLOBAL g) } // endif Hfile if (fsize < 0) { - sprintf(g->Message, MSG(FILELEN_ERROR), "lseek64", filename); + snprintf(g->Message, sizeof(g->Message), MSG(FILELEN_ERROR), "lseek64", filename); return -2; } // endif fsize @@ -1060,14 +1060,14 @@ int BGXFAM::Cardinality(PGLOBAL g) // Check the real size of the file if (Padded && Blksize) { if (fsize % (BIGINT)Blksize) { - sprintf(g->Message, MSG(NOT_FIXED_LEN), + snprintf(g->Message, sizeof(g->Message), MSG(NOT_FIXED_LEN), filename, (int)fsize, Lrecl); return -3; } else card = (int)(fsize / (BIGINT)Blksize) * Nrec; } else if (fsize % (BIGINT)Lrecl) { - sprintf(g->Message, MSG(NOT_FIXED_LEN), filename, (int)fsize, Lrecl); + snprintf(g->Message, sizeof(g->Message), MSG(NOT_FIXED_LEN), filename, (int)fsize, Lrecl); return -3; } else card = (int)(fsize / (BIGINT)Lrecl); // Fixed length file @@ -1353,12 +1353,12 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc) if (!SetEndOfFile(Hfile)) { DWORD drc = GetLastError(); - sprintf(g->Message, MSG(SETEOF_ERROR), drc); + snprintf(g->Message, sizeof(g->Message), MSG(SETEOF_ERROR), drc); return RC_FX; } // endif error #else // !_WIN32 if (ftruncate64(Hfile, (BIGINT)(Tpos * Lrecl))) { - sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(TRUNCATE_ERROR), strerror(errno)); return RC_FX; } // endif #endif // !_WIN32 @@ -1383,7 +1383,8 @@ bool BGXFAM::OpenTempFile(PGLOBAL g) /*********************************************************************/ tempname = (char*)PlugSubAlloc(g, NULL, _MAX_PATH); PlugSetPath(tempname, To_File, Tdbp->GetPath()); - strcat(PlugRemoveType(tempname, tempname), ".t"); + PlugRemoveType(tempname, tempname); + safe_strcat(tempname, _MAX_PATH, ".t"); remove(tempname); // Be sure it does not exist yet #if defined(_WIN32) @@ -1392,11 +1393,12 @@ bool BGXFAM::OpenTempFile(PGLOBAL g) if (Tfile == INVALID_HANDLE_VALUE) { DWORD rc = GetLastError(); - sprintf(g->Message, MSG(OPEN_ERROR), rc, MODE_INSERT, tempname); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, MODE_INSERT, + tempname); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)tempname, _MAX_PATH, NULL); - strcat(g->Message, tempname); + safe_strcat(g->Message, sizeof(g->Message), tempname); return true; } // endif Tfile #else // UNIX @@ -1404,8 +1406,8 @@ bool BGXFAM::OpenTempFile(PGLOBAL g) if (Tfile == INVALID_HANDLE_VALUE) { int rc = errno; - sprintf(g->Message, MSG(OPEN_ERROR), rc, MODE_INSERT, tempname); - strcat(g->Message, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR)" %s", rc, + MODE_INSERT, tempname, strerror(errno)); return true; } //endif Tfile #endif // UNIX @@ -1442,7 +1444,7 @@ bool BGXFAM::MoveIntermediateLines(PGLOBAL g, bool *b) req = MY_MIN(n, Dbflen) * Lrecl; if ((nbr = BigRead(g, Hfile, DelBuf, req)) != req) { - sprintf(g->Message, MSG(DEL_READ_ERROR), req, nbr); + snprintf(g->Message, sizeof(g->Message), MSG(DEL_READ_ERROR), req, nbr); return true; } // endif nbr diff --git a/storage/connect/filamgz.cpp b/storage/connect/filamgz.cpp index 634599eced33b..0eaf3571a809d 100644 --- a/storage/connect/filamgz.cpp +++ b/storage/connect/filamgz.cpp @@ -33,6 +33,8 @@ #include #endif // !_WIN32 +#include + /***********************************************************************/ /* Include application header files: */ /* global.h is header containing all global declarations. */ @@ -90,9 +92,9 @@ int GZFAM::Zerror(PGLOBAL g) if (errnum == Z_ERRNO) #if defined(_WIN32) - sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(NULL)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, strerror(NULL)); #else // !_WIN32 - sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, strerror(errno)); #endif // !_WIN32 return (errnum == Z_STREAM_END) ? RC_EF : RC_FX; @@ -128,12 +130,13 @@ int GZFAM::GetFileLength(PGLOBAL g) /***********************************************************************/ bool GZFAM::OpenTableFile(PGLOBAL g) { - char opmode[4], filename[_MAX_PATH]; - MODE mode = Tdbp->GetMode(); + const char *opmode; + char filename[_MAX_PATH]; + MODE mode = Tdbp->GetMode(); switch (mode) { case MODE_READ: - strcpy(opmode, "r"); + opmode = "rb"; break; case MODE_UPDATE: /*****************************************************************/ @@ -147,21 +150,21 @@ bool GZFAM::OpenTableFile(PGLOBAL g) DelRows = Cardinality(g); // This will erase the entire file - strcpy(opmode, "w"); + opmode = "wb"; // Block = 0; // For ZBKFAM // Last = Nrec; // For ZBKFAM Tdbp->ResetSize(); } else { - sprintf(g->Message, MSG(NO_PART_DEL), "GZ"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_PART_DEL), "GZ"); return true; } // endif filter break; case MODE_INSERT: - strcpy(opmode, "a+"); + opmode = "a+b"; break; default: - sprintf(g->Message, MSG(BAD_OPEN_MODE), mode); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode); return true; } // endswitch Mode @@ -170,13 +173,11 @@ bool GZFAM::OpenTableFile(PGLOBAL g) /* Use specific zlib functions. */ /* Treat files as binary. */ /*********************************************************************/ - strcat(opmode, "b"); Zfile = gzopen(PlugSetPath(filename, To_File, Tdbp->GetPath()), opmode); if (Zfile == NULL) { - sprintf(g->Message, MSG(GZOPEN_ERROR), - opmode, (int)errno, filename); - strcat(strcat(g->Message, ": "), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(GZOPEN_ERROR) ": %s", + opmode, (int)errno, filename, strerror(errno)); return (mode == MODE_READ && errno == ENOENT) ? PushWarning(g, Tdbp) : true; } // endif Zfile @@ -249,13 +250,13 @@ int GZFAM::GetNextPos(void) /***********************************************************************/ bool GZFAM::SetPos(PGLOBAL g, int pos __attribute__((unused))) { - sprintf(g->Message, MSG(NO_SETPOS_YET), "GZ"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_SETPOS_YET), "GZ"); return true; #if 0 Fpos = pos; if (fseek(Stream, Fpos, SEEK_SET)) { - sprintf(g->Message, MSG(FSETPOS_ERROR), Fpos); + snprintf(g->Message, sizeof(g->Message), MSG(FSETPOS_ERROR), Fpos); return true; } // endif @@ -655,7 +656,7 @@ int ZBKFAM::DeleteRecords(PGLOBAL g, int irc) if (!defp->SetIntCatInfo("Blocks", 0) || !defp->SetIntCatInfo("Last", 0)) { - sprintf(g->Message, MSG(UPDATE_ERROR), "Header"); + snprintf(g->Message, sizeof(g->Message), MSG(UPDATE_ERROR), "Header"); return RC_FX; } else return RC_OK; @@ -932,7 +933,7 @@ bool ZLBFAM::AllocateBuffer(PGLOBAL g) #if defined(NOLIB) if (!zlib && LoadZlib()) { - sprintf(g->Message, MSG(DLL_LOAD_ERROR), GetLastError(), "zlib.dll"); + snprintf(g->Message, sizeof(g->Message), MSG(DLL_LOAD_ERROR), GetLastError(), "zlib.dll"); return TRUE; } // endif zlib #endif @@ -964,9 +965,9 @@ bool ZLBFAM::AllocateBuffer(PGLOBAL g) if (zrc != Z_OK) { if (Zstream->msg) - sprintf(g->Message, "%s error: %s", msg, Zstream->msg); + snprintf(g->Message, sizeof(g->Message), "%s error: %s", msg, Zstream->msg); else - sprintf(g->Message, "%s error: %d", msg, zrc); + snprintf(g->Message, sizeof(g->Message), "%s error: %d", msg, zrc); return TRUE; } // endif zrc @@ -1017,9 +1018,9 @@ bool ZLBFAM::AllocateBuffer(PGLOBAL g) return FALSE; case RC_FX: #if defined(UNIX) - sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, strerror(errno)); #else - sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, _strerror(NULL)); #endif /* falls through */ case RC_NF: @@ -1028,7 +1029,7 @@ bool ZLBFAM::AllocateBuffer(PGLOBAL g) // Some old tables can have PlugDB in their header if (strcmp(To_Buf, "PlugDB")) { - sprintf(g->Message, MSG(BAD_HEADER), Tdbp->GetFile(g)); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_HEADER), Tdbp->GetFile(g)); return TRUE; } // endif strcmp @@ -1063,7 +1064,7 @@ int ZLBFAM::GetNextPos(void) /***********************************************************************/ bool ZLBFAM::SetPos(PGLOBAL g, int pos __attribute__((unused))) { - sprintf(g->Message, MSG(NO_SETPOS_YET), "GZ"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_SETPOS_YET), "GZ"); return true; #if 0 // All this must be checked if (pos < 0) { @@ -1146,7 +1147,7 @@ int ZLBFAM::ReadBuffer(PGLOBAL g) // fseek is required only in non sequential reading if (CurBlk != OldBlk + 1) if (fseek(Stream, Fpos, SEEK_SET)) { - sprintf(g->Message, MSG(FSETPOS_ERROR), Fpos); + snprintf(g->Message, sizeof(g->Message), MSG(FSETPOS_ERROR), Fpos); return RC_FX; } // endif fseek @@ -1208,9 +1209,9 @@ int ZLBFAM::ReadBuffer(PGLOBAL g) err: #if defined(UNIX) - sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, strerror(errno)); #else - sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, _strerror(NULL)); #endif return RC_FX; } // end of ReadBuffer @@ -1226,7 +1227,7 @@ int ZLBFAM::ReadCompressedBuffer(PGLOBAL g, void *rdbuf) num_read++; if (Optimized && BlkLen != signed(*Zlenp + sizeof(int))) { - sprintf(g->Message, MSG(BAD_BLK_SIZE), CurBlk + 1); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_BLK_SIZE), CurBlk + 1); return RC_NF; } // endif BlkLen @@ -1239,9 +1240,9 @@ int ZLBFAM::ReadCompressedBuffer(PGLOBAL g, void *rdbuf) if (zrc != Z_OK) { if (Zstream->msg) - sprintf(g->Message, MSG(FUNC_ERR_S), "inflate", Zstream->msg); + snprintf(g->Message, sizeof(g->Message), MSG(FUNC_ERR_S), "inflate", Zstream->msg); else - sprintf(g->Message, MSG(FUNCTION_ERROR), "inflate", (int)zrc); + snprintf(g->Message, sizeof(g->Message), MSG(FUNCTION_ERROR), "inflate", (int)zrc); return RC_NF; } // endif zrc @@ -1329,9 +1330,9 @@ bool ZLBFAM::WriteCompressedBuffer(PGLOBAL g) if (zrc != Z_OK) { if (Zstream->msg) - sprintf(g->Message, MSG(FUNC_ERR_S), "deflate", Zstream->msg); + snprintf(g->Message, sizeof(g->Message), MSG(FUNC_ERR_S), "deflate", Zstream->msg); else - sprintf(g->Message, MSG(FUNCTION_ERROR), "deflate", (int)zrc); + snprintf(g->Message, sizeof(g->Message), MSG(FUNCTION_ERROR), "deflate", (int)zrc); return TRUE; } else @@ -1341,7 +1342,7 @@ bool ZLBFAM::WriteCompressedBuffer(PGLOBAL g) BlkLen = *Zlenp + sizeof(int); if (fwrite(Zlenp, 1, BlkLen, Stream) != (size_t)BlkLen) { - sprintf(g->Message, MSG(FWRITE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FWRITE_ERROR), strerror(errno)); return TRUE; } // endif size diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp index 393ca360df9c0..f8168887e892e 100644 --- a/storage/connect/filamtxt.cpp +++ b/storage/connect/filamtxt.cpp @@ -38,6 +38,8 @@ #include #endif // !_WIN32 +#include + /***********************************************************************/ /* Include application header files: */ /* global.h is header containing all global declarations. */ @@ -211,7 +213,7 @@ int TXTFAM::GetFileLength(PGLOBAL g) } else { if ((len = _filelength(h)) < 0) - sprintf(g->Message, MSG(FILELEN_ERROR), "_filelength", filename); + snprintf(g->Message, sizeof(g->Message), MSG(FILELEN_ERROR), "_filelength", filename); if (Eof && len) len--; // Do not count the EOF character @@ -240,13 +242,13 @@ int TXTFAM::Cardinality(PGLOBAL g) if (!(len % Blksize)) card = (len / Blksize) * Nrec; else - sprintf(g->Message, MSG(NOT_FIXED_LEN), To_File, len, Lrecl); + snprintf(g->Message, sizeof(g->Message), MSG(NOT_FIXED_LEN), To_File, len, Lrecl); } else { if (!(len % Lrecl)) card = len / (int)Lrecl; // Fixed length file else - sprintf(g->Message, MSG(NOT_FIXED_LEN), To_File, len, Lrecl); + snprintf(g->Message, sizeof(g->Message), MSG(NOT_FIXED_LEN), To_File, len, Lrecl); } // endif Padded @@ -511,7 +513,7 @@ int DOSFAM::GetFileLength(PGLOBAL g) len = TXTFAM::GetFileLength(g); else if ((len = _filelength(_fileno(Stream))) < 0) - sprintf(g->Message, MSG(FILELEN_ERROR), "_filelength", To_File); + snprintf(g->Message, sizeof(g->Message), MSG(FILELEN_ERROR), "_filelength", To_File); if (trace(1)) htrc("File length=%d\n", len); @@ -588,12 +590,12 @@ bool DOSFAM::OpenTableFile(PGLOBAL g) strcpy(opmode, "a+"); break; default: - sprintf(g->Message, MSG(BAD_OPEN_MODE), mode); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode); return true; } // endswitch Mode // For blocked I/O or for moving lines, open the table in binary - strcat(opmode, (Bin) ? "b" : "t"); + safe_strcat(opmode, sizeof(opmode), (Bin) ? "b" : "t"); // Now open the file stream PlugSetPath(filename, To_File, Tdbp->GetPath()); @@ -682,7 +684,7 @@ bool DOSFAM::SetPos(PGLOBAL g, int pos) Fpos = pos; if (fseek(Stream, Fpos, SEEK_SET)) { - sprintf(g->Message, MSG(FSETPOS_ERROR), Fpos); + snprintf(g->Message, sizeof(g->Message), MSG(FSETPOS_ERROR), Fpos); return true; } // endif @@ -696,7 +698,7 @@ bool DOSFAM::SetPos(PGLOBAL g, int pos) bool DOSFAM::RecordPos(PGLOBAL g) { if ((Fpos = ftell(Stream)) < 0) { - sprintf(g->Message, MSG(FTELL_ERROR), 0, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FTELL_ERROR), 0, strerror(errno)); // strcat(g->Message, " (possible wrong ENDING option value)"); return true; } // endif Fpos @@ -712,7 +714,7 @@ int DOSFAM::InitDelete(PGLOBAL g, int fpos, int spos) Fpos = fpos; if (fseek(Stream, spos, SEEK_SET)) { - sprintf(g->Message, MSG(FSETPOS_ERROR), Fpos); + snprintf(g->Message, sizeof(g->Message), MSG(FSETPOS_ERROR), Fpos); return RC_FX; } // endif @@ -732,9 +734,9 @@ int DOSFAM::SkipRecord(PGLOBAL g, bool header) return RC_EF; #if defined(_WIN32) - sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, _strerror(NULL)); #else - sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, strerror(0)); #endif return RC_FX; } // endif fgets @@ -849,9 +851,9 @@ int DOSFAM::ReadBuffer(PGLOBAL g) rc = RC_EF; } else { #if defined(_WIN32) - sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, _strerror(NULL)); #else - sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, strerror(0)); #endif if (trace(1)) @@ -913,7 +915,7 @@ int DOSFAM::WriteBuffer(PGLOBAL g) // Update is directly written back into the file, // with this (fast) method, record size cannot change. if (fseek(Stream, Fpos, SEEK_SET)) { - sprintf(g->Message, MSG(FSETPOS_ERROR), 0); + snprintf(g->Message, sizeof(g->Message), MSG(FSETPOS_ERROR), 0); return RC_FX; } // endif @@ -928,13 +930,13 @@ int DOSFAM::WriteBuffer(PGLOBAL g) /* Now start the writing process. */ /*********************************************************************/ if ((fputs(To_Buf, T_Stream)) == EOF) { - sprintf(g->Message, MSG(FPUTS_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FPUTS_ERROR), strerror(errno)); return RC_FX; } // endif EOF if (Tdbp->Mode == MODE_UPDATE && moved) if (fseek(Stream, curpos, SEEK_SET)) { - sprintf(g->Message, MSG(FSEEK_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FSEEK_ERROR), strerror(errno)); return RC_FX; } // endif @@ -1010,7 +1012,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc) /*******************************************************************/ if (!UseTemp || moved) if (fseek(Stream, curpos, SEEK_SET)) { - sprintf(g->Message, MSG(FSETPOS_ERROR), 0); + snprintf(g->Message, sizeof(g->Message), MSG(FSETPOS_ERROR), 0); return RC_FX; } // endif @@ -1045,13 +1047,13 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc) /*****************************************************************/ #if defined(_WIN32) if (chsize(h, Tpos)) { - sprintf(g->Message, MSG(CHSIZE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(CHSIZE_ERROR), strerror(errno)); close(h); return RC_FX; } // endif #else if (ftruncate(h, (off_t)Tpos)) { - sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(TRUNCATE_ERROR), strerror(errno)); close(h); return RC_FX; } // endif @@ -1081,7 +1083,8 @@ bool DOSFAM::OpenTempFile(PGLOBAL g) /* Open the temporary file, Spos is at the beginning of file. */ /*********************************************************************/ PlugSetPath(tempname, To_File, Tdbp->GetPath()); - strcat(PlugRemoveType(tempname, tempname), ".t"); + PlugRemoveType(tempname, tempname); + safe_strcat(tempname, sizeof(tempname), ".t"); if (!(T_Stream = PlugOpenFile(g, tempname, "wb"))) { if (trace(1)) @@ -1106,7 +1109,7 @@ bool DOSFAM::MoveIntermediateLines(PGLOBAL g, bool *b) for (*b = false, n = Fpos - Spos; n > 0; n -= req) { if (!UseTemp || !*b) if (fseek(Stream, Spos, SEEK_SET)) { - sprintf(g->Message, MSG(READ_SEEK_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_SEEK_ERROR), strerror(errno)); return true; } // endif @@ -1117,18 +1120,18 @@ bool DOSFAM::MoveIntermediateLines(PGLOBAL g, bool *b) htrc("after read req=%d len=%d\n", req, len); if (len != req) { - sprintf(g->Message, MSG(DEL_READ_ERROR), (int) req, (int) len); + snprintf(g->Message, sizeof(g->Message), MSG(DEL_READ_ERROR), (int) req, (int) len); return true; } // endif len if (!UseTemp) if (fseek(T_Stream, Tpos, SEEK_SET)) { - sprintf(g->Message, MSG(WRITE_SEEK_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(WRITE_SEEK_ERR), strerror(errno)); return true; } // endif if ((len = fwrite(DelBuf, 1, req, T_Stream)) != req) { - sprintf(g->Message, MSG(DEL_WRITE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(DEL_WRITE_ERROR), strerror(errno)); return true; } // endif @@ -1170,20 +1173,21 @@ int DOSFAM::RenameTempFile(PGLOBAL g) if (!Abort) { PlugSetPath(filename, To_File, Tdbp->GetPath()); - strcat(PlugRemoveType(filetemp, filename), ".ttt"); + PlugRemoveType(filetemp, filename); + safe_strcat(filetemp, sizeof(filetemp), ".ttt"); remove(filetemp); // May still be there from previous error if (rename(filename, filetemp)) { // Save file for security - snprintf(g->Message, MAX_STR, MSG(RENAME_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(RENAME_ERROR), filename, filetemp, strerror(errno)); throw 51; } else if (rename(tempname, filename)) { - snprintf(g->Message, MAX_STR, MSG(RENAME_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(RENAME_ERROR), tempname, filename, strerror(errno)); rc = rename(filetemp, filename); // Restore saved file throw 52; } else if (remove(filetemp)) { - sprintf(g->Message, MSG(REMOVE_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(REMOVE_ERROR), filetemp, strerror(errno)); rc = RC_INFO; // Acceptable } // endif's @@ -1447,7 +1451,7 @@ int BLKFAM::ReadBuffer(PGLOBAL g) // fseek is required only in non sequential reading if (CurBlk != OldBlk + 1) if (fseek(Stream, BlkPos[CurBlk], SEEK_SET)) { - sprintf(g->Message, MSG(FSETPOS_ERROR), BlkPos[CurBlk]); + snprintf(g->Message, sizeof(g->Message), MSG(FSETPOS_ERROR), BlkPos[CurBlk]); return RC_FX; } // endif fseek @@ -1483,9 +1487,9 @@ int BLKFAM::ReadBuffer(PGLOBAL g) rc = RC_EF; } else { #if defined(_WIN32) - sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, _strerror(NULL)); #else - sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, strerror(errno)); #endif if (trace(1)) @@ -1529,7 +1533,7 @@ int BLKFAM::WriteBuffer(PGLOBAL g) BlkLen = (int)(NxtLine - To_Buf); if (fwrite(To_Buf, 1, BlkLen, Stream) != (size_t)BlkLen) { - sprintf(g->Message, MSG(FWRITE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FWRITE_ERROR), strerror(errno)); Closing = true; // To tell CloseDB about a Write error return RC_FX; } // endif size @@ -1577,7 +1581,7 @@ int BLKFAM::WriteBuffer(PGLOBAL g) len = strlen(OutBuf); } else { if (fseek(Stream, Fpos, SEEK_SET)) { // Fpos is last position - sprintf(g->Message, MSG(FSETPOS_ERROR), 0); + snprintf(g->Message, sizeof(g->Message), MSG(FSETPOS_ERROR), 0); return RC_FX; } // endif fseek @@ -1588,13 +1592,13 @@ int BLKFAM::WriteBuffer(PGLOBAL g) } // endif UseTemp if (fwrite(OutBuf, 1, len, T_Stream) != (size_t)len) { - sprintf(g->Message, MSG(FWRITE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FWRITE_ERROR), strerror(errno)); return RC_FX; } // endif fwrite if (moved) if (fseek(Stream, curpos, SEEK_SET)) { - sprintf(g->Message, MSG(FSEEK_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FSEEK_ERROR), strerror(errno)); return RC_FX; } // endif @@ -1678,7 +1682,7 @@ int BINFAM::GetFileLength(PGLOBAL g) len = TXTFAM::GetFileLength(g); else if ((len = _filelength(_fileno(Stream))) < 0) - sprintf(g->Message, MSG(FILELEN_ERROR), "_filelength", To_File); + snprintf(g->Message, sizeof(g->Message), MSG(FILELEN_ERROR), "_filelength", To_File); xtrc(1, "File length=%d\n", len); return len; @@ -1710,7 +1714,7 @@ bool BINFAM::OpenTableFile(PGLOBAL g) { strcpy(opmode, "wb"); break; default: - sprintf(g->Message, MSG(BAD_OPEN_MODE), mode); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode); return true; } // endswitch Mode @@ -1802,7 +1806,7 @@ bool BINFAM::SetPos(PGLOBAL g, int pos) { Fpos = pos; if (fseek(Stream, Fpos, SEEK_SET)) { - sprintf(g->Message, MSG(FSETPOS_ERROR), Fpos); + snprintf(g->Message, sizeof(g->Message), MSG(FSETPOS_ERROR), Fpos); return true; } // endif @@ -1815,7 +1819,7 @@ bool BINFAM::SetPos(PGLOBAL g, int pos) { /***********************************************************************/ bool BINFAM::RecordPos(PGLOBAL g) { if ((Fpos = ftell(Stream)) < 0) { - sprintf(g->Message, MSG(FTELL_ERROR), 0, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FTELL_ERROR), 0, strerror(errno)); // strcat(g->Message, " (possible wrong ENDING option value)"); return true; } // endif Fpos @@ -1861,7 +1865,7 @@ int BINFAM::ReadBuffer(PGLOBAL g) return RC_EF; } else if (Recsize > (unsigned)Buflen) { - sprintf(g->Message, "Record too big (Recsize=%zd Buflen=%d)\n", Recsize, Buflen); + snprintf(g->Message, sizeof(g->Message), "Record too big (Recsize=%zd Buflen=%d)\n", Recsize, Buflen); return RC_FX; } // endif Recsize @@ -1873,9 +1877,9 @@ int BINFAM::ReadBuffer(PGLOBAL g) rc = RC_EF; } else { #if defined(_WIN32) - sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, _strerror(NULL)); #else - sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, strerror(0)); #endif xtrc(2, "%s\n", g->Message); rc = RC_FX; @@ -1932,7 +1936,7 @@ int BINFAM::WriteBuffer(PGLOBAL g) // Update is directly written back into the file, // with this (fast) method, record size cannot change. if (fseek(Stream, Fpos, SEEK_SET)) { - sprintf(g->Message, MSG(FSETPOS_ERROR), 0); + snprintf(g->Message, sizeof(g->Message), MSG(FSETPOS_ERROR), 0); return RC_FX; } // endif @@ -1947,18 +1951,18 @@ int BINFAM::WriteBuffer(PGLOBAL g) /* Now start the writing process. */ /*********************************************************************/ if (fwrite(&Recsize, sizeof(size_t), 1, T_Stream) != 1) { - sprintf(g->Message, "Error %d writing prefix to %s", + snprintf(g->Message, sizeof(g->Message), "Error %d writing prefix to %s", errno, To_File); return RC_FX; } else if (fwrite(To_Buf, Recsize, 1, T_Stream) != 1) { - sprintf(g->Message, "Error %d writing %zd bytes to %s", + snprintf(g->Message, sizeof(g->Message), "Error %d writing %zd bytes to %s", errno, Recsize, To_File); return RC_FX; } // endif fwrite if (Tdbp->GetMode() == MODE_UPDATE && moved) if (fseek(Stream, curpos, SEEK_SET)) { - sprintf(g->Message, MSG(FSEEK_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FSEEK_ERROR), strerror(errno)); return RC_FX; } // endif @@ -2033,7 +2037,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc) /*******************************************************************/ if (!UseTemp || moved) if (fseek(Stream, curpos, SEEK_SET)) { - sprintf(g->Message, MSG(FSETPOS_ERROR), 0); + snprintf(g->Message, sizeof(g->Message), MSG(FSETPOS_ERROR), 0); return RC_FX; } // endif @@ -2068,13 +2072,13 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc) /*****************************************************************/ #if defined(_WIN32) if (chsize(h, Tpos)) { - sprintf(g->Message, MSG(CHSIZE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(CHSIZE_ERROR), strerror(errno)); close(h); return RC_FX; } // endif #else if (ftruncate(h, (off_t)Tpos)) { - sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(TRUNCATE_ERROR), strerror(errno)); close(h); return RC_FX; } // endif diff --git a/storage/connect/filamvct.cpp b/storage/connect/filamvct.cpp index 2cd80f5d43f99..184df646cb76d 100644 --- a/storage/connect/filamvct.cpp +++ b/storage/connect/filamvct.cpp @@ -42,6 +42,8 @@ #include #endif // !_WIN32 +#include + /***********************************************************************/ /* Include application header files: */ /* global.h is header containing all global declarations. */ @@ -152,7 +154,7 @@ int VCTFAM::GetFileLength(PGLOBAL g) To_File = filename; for (i = 0; i < Ncol; i++) { - sprintf(filename, Colfn, i+1); + snprintf(filename, _MAX_PATH, Colfn, i+1); len += TXTFAM::GetFileLength(g); } // endfor i @@ -184,7 +186,7 @@ int VCTFAM::GetBlockInfo(PGLOBAL g) VECHEADER vh; if (Header < 1 || Header > 3 || !MaxBlk) { - sprintf(g->Message, "Invalid header value %d", Header); + snprintf(g->Message, sizeof(g->Message), "Invalid header value %d", Header); return -1; } else n = (Header == 1) ? (int)sizeof(VECHEADER) : 0; @@ -192,7 +194,10 @@ int VCTFAM::GetBlockInfo(PGLOBAL g) PlugSetPath(filename, To_File, Tdbp->GetPath()); if (Header == 2) - strcat(PlugRemoveType(filename, filename), ".blk"); + { + PlugRemoveType(filename, filename); + safe_strcat(filename, sizeof(filename), ".blk"); + } if ((h = global_open(g, MSGID_CANNOT_OPEN, filename, O_RDONLY)) == -1 || !_filelength(h)) { @@ -208,10 +213,10 @@ int VCTFAM::GetBlockInfo(PGLOBAL g) k = lseek(h, -(int)sizeof(VECHEADER), SEEK_END); if ((k = read(h, &vh, sizeof(vh))) != sizeof(vh)) { - sprintf(g->Message, "Error reading header file %s", filename); + snprintf(g->Message, sizeof(g->Message), "Error reading header file %s", filename); n = -1; } else if (MaxBlk * Nrec != vh.MaxRec) { - sprintf(g->Message, "MaxRec=%d doesn't match MaxBlk=%d Nrec=%d", + snprintf(g->Message, sizeof(g->Message), "MaxRec=%d doesn't match MaxBlk=%d Nrec=%d", vh.MaxRec, MaxBlk, Nrec); n = -1; } else { @@ -247,12 +252,13 @@ bool VCTFAM::SetBlockInfo(PGLOBAL g) s= global_fopen(g, MSGID_CANNOT_OPEN, filename, "r+b"); } else { // Header == 2 - strcat(PlugRemoveType(filename, filename), ".blk"); + PlugRemoveType(filename, filename); + safe_strcat(filename, sizeof(filename), ".blk"); s= global_fopen(g, MSGID_CANNOT_OPEN, filename, "wb"); } // endif Header if (!s) { - sprintf(g->Message, "Error opening header file %s", filename); + snprintf(g->Message, sizeof(g->Message), "Error opening header file %s", filename); return true; } else if (Header == 3) /*k =*/ fseek(s, -(int)sizeof(VECHEADER), SEEK_END); @@ -261,7 +267,7 @@ bool VCTFAM::SetBlockInfo(PGLOBAL g) vh.NumRec = (Block - 1) * Nrec + Last; if ((n = fwrite(&vh, sizeof(vh), 1, s)) != 1) { - sprintf(g->Message, "Error writing header file %s", filename); + snprintf(g->Message, sizeof(g->Message), "Error writing header file %s", filename); rc = true; } // endif fread @@ -321,7 +327,7 @@ int VCTFAM::Cardinality(PGLOBAL g) // Use the first column file to calculate the cardinality clen = cdp->GetClen(); - sprintf(filename, Colfn, 1); + snprintf(filename, _MAX_PATH, Colfn, 1); To_File = filename; len = TXTFAM::GetFileLength(g); To_File = savfn; @@ -330,7 +336,7 @@ int VCTFAM::Cardinality(PGLOBAL g) if (!(len % clen)) card = len / clen; // Fixed length file else - sprintf(g->Message, MSG(NOT_FIXED_LEN), To_File, len, clen); + snprintf(g->Message, sizeof(g->Message), MSG(NOT_FIXED_LEN), To_File, len, clen); if (trace(1)) htrc(" Computed max_K=%d Filen=%d Clen=%d\n", card, len, clen); @@ -394,7 +400,7 @@ bool VCTFAM::MakeEmptyFile(PGLOBAL g, PCSZ fn) return false; err: - sprintf(g->Message, MSG(MAKE_EMPTY_FILE), To_File, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(MAKE_EMPTY_FILE), To_File, strerror(errno)); close(h); return true; } // end of MakeEmptyFile @@ -455,7 +461,7 @@ bool VCTFAM::OpenTableFile(PGLOBAL g) break; default: - sprintf(g->Message, MSG(BAD_OPEN_MODE), mode); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode); return true; } // endswitch Mode @@ -583,7 +589,7 @@ bool VCTFAM::InitInsert(PGLOBAL g) htrc("Exception %d: %s\n", n, g->Message); rc = true; } catch (const char *msg) { - strcpy(g->Message, msg); + safe_strcpy(g->Message, sizeof(msg), msg); rc = true; } // end catch @@ -688,7 +694,7 @@ int VCTFAM::WriteBuffer(PGLOBAL g) } else { // Mode Insert if (MaxBlk && CurBlk == MaxBlk) { - strcpy(g->Message, MSG(TRUNC_BY_ESTIM)); + strncpy(g->Message, MSG(TRUNC_BY_ESTIM), sizeof(g->Message)); return RC_EF; // Too many lines for vector formatted table } // endif MaxBlk @@ -727,7 +733,7 @@ int VCTFAM::WriteBuffer(PGLOBAL g) if ((size_t)Nrec != fwrite(NewBlock, (size_t)Lrecl, (size_t)Nrec, Stream)) { - sprintf(g->Message, MSG(WRITE_STRERROR), To_File, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(WRITE_STRERROR), To_File, strerror(errno)); return RC_FX; } // endif @@ -840,13 +846,13 @@ int VCTFAM::DeleteRecords(PGLOBAL g, int irc) /***************************************************************/ #if defined(UNIX) if (ftruncate(h, (off_t)(Headlen + Block * Blksize))) { - sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(TRUNCATE_ERROR), strerror(errno)); close(h); return RC_FX; } // endif #else if (chsize(h, Headlen + Block * Blksize)) { - sprintf(g->Message, MSG(CHSIZE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(CHSIZE_ERROR), strerror(errno)); close(h); return RC_FX; } // endif @@ -886,8 +892,8 @@ bool VCTFAM::OpenTempFile(PGLOBAL g) /* Open the temporary file, Spos is at the beginning of file. */ /*********************************************************************/ PlugSetPath(tempname, To_File, Tdbp->GetPath()); - strcat(PlugRemoveType(tempname, tempname), ".t"); - + PlugRemoveType(tempname, tempname); + safe_strcat(tempname, sizeof(tempname), ".t"); if (MaxBlk) { if (MakeEmptyFile(g, tempname)) return true; @@ -939,7 +945,7 @@ bool VCTFAM::MoveIntermediateLines(PGLOBAL g, bool *b) } // endif MaxBlk if (fseek(Stream, dep + off, SEEK_SET)) { - sprintf(g->Message, MSG(READ_SEEK_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_SEEK_ERROR), strerror(errno)); return true; } // endif @@ -949,7 +955,7 @@ bool VCTFAM::MoveIntermediateLines(PGLOBAL g, bool *b) htrc("after read req=%d len=%d\n", req, len); if (len != req) { - sprintf(g->Message, MSG(DEL_READ_ERROR), (int) req, (int) len); + snprintf(g->Message, sizeof(g->Message), MSG(DEL_READ_ERROR), (int) req, (int) len); return true; } // endif len @@ -963,12 +969,12 @@ bool VCTFAM::MoveIntermediateLines(PGLOBAL g, bool *b) } // endif MaxBlk if (fseek(T_Stream, dep + off, SEEK_SET)) { - sprintf(g->Message, MSG(WRITE_SEEK_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(WRITE_SEEK_ERR), strerror(errno)); return true; } // endif if ((len = fwrite(To_Buf, Clens[i], req, T_Stream)) != req) { - sprintf(g->Message, MSG(DEL_WRITE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(DEL_WRITE_ERROR), strerror(errno)); return true; } // endif @@ -996,7 +1002,7 @@ bool VCTFAM::MoveIntermediateLines(PGLOBAL g, bool *b) len = (size_t)Blksize; if (fwrite(NewBlock, 1, len, T_Stream) != len) { - sprintf(g->Message, MSG(DEL_WRITE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(DEL_WRITE_ERROR), strerror(errno)); return true; } // endif @@ -1038,12 +1044,12 @@ bool VCTFAM::CleanUnusedSpace(PGLOBAL g) memset(To_Buf, (Isnum[i]) ? 0 : ' ', n * Clens[i]); if (fseek(Stream, dep + Deplac[i] + Last * Clens[i], SEEK_SET)) { - sprintf(g->Message, MSG(WRITE_SEEK_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(WRITE_SEEK_ERR), strerror(errno)); return true; } // endif if ((len = fwrite(To_Buf, Clens[i], req, Stream)) != req) { - sprintf(g->Message, MSG(DEL_WRITE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(DEL_WRITE_ERROR), strerror(errno)); return true; } // endif @@ -1060,12 +1066,12 @@ bool VCTFAM::CleanUnusedSpace(PGLOBAL g) for (i = 0; i < Ncol; i++) { if (fseek(T_Stream, Deplac[i] + Tpos * Clens[i], SEEK_SET)) { - sprintf(g->Message, MSG(WRITE_SEEK_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(WRITE_SEEK_ERR), strerror(errno)); return true; } // endif if ((len = fwrite(To_Buf, Clens[i], req, T_Stream)) != req) { - sprintf(g->Message, MSG(DEL_WRITE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(DEL_WRITE_ERROR), strerror(errno)); return true; } // endif @@ -1170,7 +1176,7 @@ bool VCTFAM::ResetTableSize(PGLOBAL g, int block, int last) if (!defp->SetIntCatInfo("Blocks", Block) || !defp->SetIntCatInfo("Last", Last)) { - sprintf(g->Message, MSG(UPDATE_ERROR), "Header"); + snprintf(g->Message, sizeof(g->Message), MSG(UPDATE_ERROR), "Header"); rc = true; } // endif @@ -1219,7 +1225,7 @@ bool VCTFAM::ReadBlock(PGLOBAL g, PVCTCOL colp) len, Nrec, colp->Deplac, Lrecl, CurBlk, MaxBlk); if (fseek(Stream, len, SEEK_SET)) { - sprintf(g->Message, MSG(FSEEK_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FSEEK_ERROR), strerror(errno)); return true; } // endif @@ -1228,9 +1234,9 @@ bool VCTFAM::ReadBlock(PGLOBAL g, PVCTCOL colp) if (n != (size_t)Nrec) { if (errno == NO_ERROR) - sprintf(g->Message, MSG(BAD_READ_NUMBER), (int) n, To_File); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_READ_NUMBER), (int) n, To_File); else - sprintf(g->Message, MSG(READ_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, strerror(errno)); if (trace(1)) @@ -1270,7 +1276,7 @@ bool VCTFAM::WriteBlock(PGLOBAL g, PVCTCOL colp) Modif, len, Nrec, colp->Deplac, Lrecl, colp->ColBlk); if (fseek(T_Stream, len, SEEK_SET)) { - sprintf(g->Message, MSG(FSEEK_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FSEEK_ERROR), strerror(errno)); return true; } // endif @@ -1281,7 +1287,7 @@ bool VCTFAM::WriteBlock(PGLOBAL g, PVCTCOL colp) if (n != fwrite(colp->Blk->GetValPointer(), (size_t)colp->Clen, n, T_Stream)) { - sprintf(g->Message, MSG(WRITE_STRERROR), + snprintf(g->Message, sizeof(g->Message), MSG(WRITE_STRERROR), (UseTemp) ? To_Fbt->Fname : To_File, strerror(errno)); if (trace(1)) @@ -1386,7 +1392,7 @@ bool VCMFAM::OpenTableFile(PGLOBAL g) // Inserting will be like updating the file mapmode = MODE_UPDATE; } else { - strcpy(g->Message, "MAP Insert is for VEC Estimate tables only"); + strncpy(g->Message, "MAP Insert is for VEC Estimate tables only", sizeof(g->Message)); return true; } // endif MaxBlk @@ -1410,7 +1416,7 @@ bool VCMFAM::OpenTableFile(PGLOBAL g) DWORD rc = GetLastError(); if (!(*g->Message)) - sprintf(g->Message, MSG(OPEN_MODE_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR), "map", (int) rc, filename); if (trace(1)) @@ -1438,7 +1444,7 @@ bool VCMFAM::OpenTableFile(PGLOBAL g) if (!Memory) { CloseFileHandle(hFile); - sprintf(g->Message, MSG(MAP_VIEW_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(MAP_VIEW_ERROR), filename, GetLastError()); return true; } // endif Memory @@ -1557,7 +1563,7 @@ bool VCMFAM::InitInsert(PGLOBAL g) htrc("Exception %d: %s\n", n, g->Message); rc = true; } catch (const char *msg) { - strcpy(g->Message, msg); + safe_strcpy(g->Message, sizeof(g->Message), msg); rc = true; } // end catch @@ -1576,7 +1582,7 @@ int VCMFAM::WriteBuffer(PGLOBAL g) // Mode Update being done in ReadDB we process here Insert mode only. if (Tdbp->GetMode() == MODE_INSERT) { if (CurBlk == MaxBlk) { - strcpy(g->Message, MSG(TRUNC_BY_ESTIM)); + strncpy(g->Message, MSG(TRUNC_BY_ESTIM), sizeof(g->Message)); return RC_EF; // Too many lines for vector formatted table } // endif MaxBlk @@ -1676,7 +1682,7 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc) DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN); if (drc == 0xFFFFFFFF) { - sprintf(g->Message, MSG(FUNCTION_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(FUNCTION_ERROR), "SetFilePointer", GetLastError()); CloseHandle(fp->Handle); return RC_FX; @@ -1686,7 +1692,7 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc) htrc("done, Tpos=%p newsize=%d drc=%d\n", Tpos, n, drc); if (!SetEndOfFile(fp->Handle)) { - sprintf(g->Message, MSG(FUNCTION_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(FUNCTION_ERROR), "SetEndOfFile", GetLastError()); CloseHandle(fp->Handle); return RC_FX; @@ -1695,7 +1701,7 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc) CloseHandle(fp->Handle); #else // UNIX if (ftruncate(fp->Handle, (off_t)n)) { - sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(TRUNCATE_ERROR), strerror(errno)); close(fp->Handle); return RC_FX; } // endif @@ -1930,7 +1936,7 @@ bool VECFAM::OpenTableFile(PGLOBAL g) strcpy(opmode, "ab"); break; default: - sprintf(g->Message, MSG(BAD_OPEN_MODE), mode); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode); return true; } // endswitch Mode @@ -2007,7 +2013,7 @@ bool VECFAM::OpenColumnFile(PGLOBAL g, PCSZ opmode, int i) char filename[_MAX_PATH]; PDBUSER dup = PlgGetUser(g); - sprintf(filename, Colfn, i+1); + snprintf(filename, _MAX_PATH, Colfn, i+1); if (!(Streams[i] = PlugOpenFile(g, filename, opmode))) { if (trace(1)) @@ -2077,9 +2083,10 @@ bool VECFAM::AllocateBuffer(PGLOBAL g) // Allocate all that is needed to move lines and make Temp if (UseTemp) { Tempat = (char*)PlugSubAlloc(g, NULL, _MAX_PATH); - strcpy(Tempat, Colfn); + safe_strcpy(Tempat, _MAX_PATH, Colfn); PlugSetPath(Tempat, Tempat, Tdbp->GetPath()); - strcat(PlugRemoveType(Tempat, Tempat), ".t"); + PlugRemoveType(Tempat, Tempat); + safe_strcat(Tempat, _MAX_PATH, ".t"); T_Fbs = (PFBLOCK *)PlugSubAlloc(g, NULL, Ncol * sizeof(PFBLOCK)); } // endif UseTemp @@ -2178,7 +2185,7 @@ int VECFAM::WriteBuffer(PGLOBAL g) for (i = 0; i < Ncol; i++) if (n != fwrite(To_Bufs[i], (size_t)Clens[i], n, Streams[i])) { - sprintf(g->Message, MSG(WRITE_STRERROR), To_File, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(WRITE_STRERROR), To_File, strerror(errno)); return RC_FX; } // endif @@ -2272,7 +2279,7 @@ int VECFAM::DeleteRecords(PGLOBAL g, int irc) int h; // File handle, return code for (int i = 0; i < Ncol; i++) { - sprintf(filename, Colfn, i + 1); + snprintf(filename, _MAX_PATH, Colfn, i + 1); /*rc =*/ PlugCloseFile(g, To_Fbs[i]); if ((h= global_open(g, MSGID_OPEN_STRERROR, filename, O_WRONLY)) <= 0) @@ -2283,13 +2290,13 @@ int VECFAM::DeleteRecords(PGLOBAL g, int irc) /***************************************************************/ #if defined(UNIX) if (ftruncate(h, (off_t)(Tpos * Clens[i]))) { - sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(TRUNCATE_ERROR), strerror(errno)); close(h); return RC_FX; } // endif #else if (chsize(h, Tpos * Clens[i])) { - sprintf(g->Message, MSG(CHSIZE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(CHSIZE_ERROR), strerror(errno)); close(h); return RC_FX; } // endif @@ -2332,7 +2339,7 @@ bool VECFAM::OpenTempFile(PGLOBAL g) /*****************************************************************/ /* Open the temporary file, Spos is at the beginning of file. */ /*****************************************************************/ - sprintf(tempname, Tempat, i+1); + snprintf(tempname, _MAX_PATH, Tempat, i+1); if (!(T_Streams[i] = PlugOpenFile(g, tempname, "wb"))) { if (trace(1)) @@ -2388,7 +2395,7 @@ bool VECFAM::MoveIntermediateLines(PGLOBAL g, bool *) if (!UseTemp || !b) if (fseek(Streams[i], Spos * Clens[i], SEEK_SET)) { - sprintf(g->Message, MSG(READ_SEEK_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_SEEK_ERROR), strerror(errno)); return true; } // endif @@ -2398,18 +2405,18 @@ bool VECFAM::MoveIntermediateLines(PGLOBAL g, bool *) htrc("after read req=%d len=%d\n", req, len); if (len != req) { - sprintf(g->Message, MSG(DEL_READ_ERROR), (int) req, (int) len); + snprintf(g->Message, sizeof(g->Message), MSG(DEL_READ_ERROR), (int) req, (int) len); return true; } // endif len if (!UseTemp) if (fseek(T_Streams[i], Tpos * Clens[i], SEEK_SET)) { - sprintf(g->Message, MSG(WRITE_SEEK_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(WRITE_SEEK_ERR), strerror(errno)); return true; } // endif if ((len = fwrite(To_Buf, Clens[i], req, T_Streams[i])) != req) { - sprintf(g->Message, MSG(DEL_WRITE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(DEL_WRITE_ERROR), strerror(errno)); return true; } // endif @@ -2451,22 +2458,23 @@ int VECFAM::RenameTempFile(PGLOBAL g) tempname = (char*)T_Fbs[i]->Fname; if (!Abort) { - sprintf(filename, Colfn, i+1); + snprintf(filename, _MAX_PATH, Colfn, i+1); PlugSetPath(filename, filename, Tdbp->GetPath()); - strcat(PlugRemoveType(filetemp, filename), ".ttt"); + PlugRemoveType(filetemp, filename); + safe_strcat(filetemp, sizeof(filetemp), ".ttt"); remove(filetemp); // May still be there from previous error if (rename(filename, filetemp)) { // Save file for security - snprintf(g->Message, MAX_STR, MSG(RENAME_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(RENAME_ERROR), filename, filetemp, strerror(errno)); rc = RC_FX; } else if (rename(tempname, filename)) { - snprintf(g->Message, MAX_STR, MSG(RENAME_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(RENAME_ERROR), tempname, filename, strerror(errno)); rc = rename(filetemp, filename); // Restore saved file rc = RC_FX; } else if (remove(filetemp)) { - sprintf(g->Message, MSG(REMOVE_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(REMOVE_ERROR), filetemp, strerror(errno)); rc = RC_INFO; // Acceptable } // endif's @@ -2568,7 +2576,7 @@ bool VECFAM::ReadBlock(PGLOBAL g, PVCTCOL colp) len, i, Nrec, colp->Deplac, Lrecl, CurBlk); if (fseek(Streams[i], len, SEEK_SET)) { - sprintf(g->Message, MSG(FSEEK_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FSEEK_ERROR), strerror(errno)); return true; } // endif @@ -2578,15 +2586,15 @@ bool VECFAM::ReadBlock(PGLOBAL g, PVCTCOL colp) if (n != (size_t)Nrec && (CurBlk+1 != Block || n != (size_t)Last)) { char fn[_MAX_PATH]; - sprintf(fn, Colfn, colp->Index); + snprintf(fn, _MAX_PATH, Colfn, colp->Index); #if defined(_WIN32) if (feof(Streams[i])) #else // !_WIN32 if (errno == NO_ERROR) #endif // !_WIN32 - sprintf(g->Message, MSG(BAD_READ_NUMBER), (int) n, fn); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_READ_NUMBER), (int) n, fn); else - sprintf(g->Message, MSG(READ_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), fn, strerror(errno)); if (trace(1)) @@ -2624,7 +2632,7 @@ bool VECFAM::WriteBlock(PGLOBAL g, PVCTCOL colp) if (Tdbp->GetMode() == MODE_UPDATE && !UseTemp) if (fseek(T_Streams[i], len, SEEK_SET)) { - sprintf(g->Message, MSG(FSEEK_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FSEEK_ERROR), strerror(errno)); return true; } // endif @@ -2638,8 +2646,8 @@ bool VECFAM::WriteBlock(PGLOBAL g, PVCTCOL colp) (size_t)colp->Clen, n, T_Streams[i])) { char fn[_MAX_PATH]; - sprintf(fn, (UseTemp) ? Tempat : Colfn, colp->Index); - sprintf(g->Message, MSG(WRITE_STRERROR), fn, strerror(errno)); + snprintf(fn, _MAX_PATH, (UseTemp) ? Tempat : Colfn, colp->Index); + snprintf(g->Message, sizeof(g->Message), MSG(WRITE_STRERROR), fn, strerror(errno)); if (trace(1)) htrc("Write error: %s\n", strerror(errno)); @@ -2772,7 +2780,7 @@ bool VMPFAM::MapColumnFile(PGLOBAL g, MODE mode, int i) PFBLOCK fp; PDBUSER dup = PlgGetUser(g); - sprintf(filename, Colfn, i+1); + snprintf(filename, _MAX_PATH, Colfn, i+1); /*********************************************************************/ /* The whole file will be mapped so we can use it as */ @@ -2808,7 +2816,7 @@ bool VMPFAM::MapColumnFile(PGLOBAL g, MODE mode, int i) DWORD rc = GetLastError(); if (!(*g->Message)) - sprintf(g->Message, MSG(OPEN_MODE_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR), "map", (int) rc, filename); if (trace(1)) htrc("%s\n", g->Message); @@ -2835,7 +2843,7 @@ bool VMPFAM::MapColumnFile(PGLOBAL g, MODE mode, int i) if (!Memcol[i]) { CloseFileHandle(hFile); - sprintf(g->Message, MSG(MAP_VIEW_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(MAP_VIEW_ERROR), filename, GetLastError()); return true; } // endif Memory @@ -2983,7 +2991,7 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc) DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN); if (drc == 0xFFFFFFFF) { - sprintf(g->Message, MSG(FUNCTION_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(FUNCTION_ERROR), "SetFilePointer", GetLastError()); CloseHandle(fp->Handle); return RC_FX; @@ -2993,7 +3001,7 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc) htrc("done, Tpos=%p newsize=%d drc=%d\n", Tpos, n, drc); if (!SetEndOfFile(fp->Handle)) { - sprintf(g->Message, MSG(FUNCTION_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(FUNCTION_ERROR), "SetEndOfFile", GetLastError()); CloseHandle(fp->Handle); return RC_FX; @@ -3002,7 +3010,7 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc) CloseHandle(fp->Handle); #else // UNIX if (ftruncate(fp->Handle, (off_t)n)) { - sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(TRUNCATE_ERROR), strerror(errno)); close(fp->Handle); return RC_FX; } // endif @@ -3072,12 +3080,12 @@ bool BGVFAM::BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, bool b) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, drc, 0, (LPTSTR)buf, sizeof(buf), NULL); - sprintf(g->Message, MSG(SFP_ERROR), buf); + snprintf(g->Message, sizeof(g->Message), MSG(SFP_ERROR), buf); return true; } // endif #else // !_WIN32 if (lseek64(h, pos, (b) ? SEEK_END : SEEK_SET) < 0) { - sprintf(g->Message, MSG(ERROR_IN_LSK), errno); + snprintf(g->Message, sizeof(g->Message), MSG(ERROR_IN_LSK), errno); return true; } // endif #endif // !_WIN32 @@ -3103,7 +3111,7 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req) char buf[256]; // , *fn = (h == Hfile) ? To_File : "Tempfile"; if (brc) - strcpy(buf, MSG(BAD_BYTE_READ)); + strncpy(buf, MSG(BAD_BYTE_READ), 256); else { drc = GetLastError(); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | @@ -3111,7 +3119,7 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req) (LPTSTR)buf, sizeof(buf), NULL); } // endelse brc - sprintf(g->Message, MSG(READ_ERROR), To_File, buf); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, buf); if (trace(1)) htrc("BIGREAD: %s\n", g->Message); @@ -3125,7 +3133,7 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req) if (nbr != (ssize_t)len) { const char *fn = (h == Hfile) ? To_File : "Tempfile"; - sprintf(g->Message, MSG(READ_ERROR), fn, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), fn, strerror(errno)); if (trace(1)) htrc("BIGREAD: nbr=%d len=%d errno=%d %s\n", @@ -3157,7 +3165,7 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req) PCSZ fn = (h == Hfile) ? To_File : "Tempfile"; if (brc) - strcpy(buf, MSG(BAD_BYTE_NUM)); + strncpy(buf, MSG(BAD_BYTE_NUM), 256); else { drc = GetLastError(); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | @@ -3165,7 +3173,7 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req) (LPTSTR)buf, sizeof(buf), NULL); } // endelse brc - sprintf(g->Message, MSG(WRITE_STRERROR), fn, buf); + snprintf(g->Message, sizeof(g->Message), MSG(WRITE_STRERROR), fn, buf); if (trace(1)) htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n", @@ -3180,7 +3188,7 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req) if (nbw != (ssize_t)len) { const char *fn = (h == Hfile) ? To_File : "Tempfile"; - sprintf(g->Message, MSG(WRITE_STRERROR), fn, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(WRITE_STRERROR), fn, strerror(errno)); if (trace(1)) htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n", @@ -3204,7 +3212,7 @@ int BGVFAM::GetBlockInfo(PGLOBAL g) HANDLE h; if (Header < 1 || Header > 3 || !MaxBlk) { - sprintf(g->Message, "Invalid header value %d", Header); + snprintf(g->Message, sizeof(g->Message), "Invalid header value %d", Header); return -1; } else n = (Header == 1) ? (int)sizeof(VECHEADER) : 0; @@ -3212,7 +3220,10 @@ int BGVFAM::GetBlockInfo(PGLOBAL g) PlugSetPath(filename, To_File, Tdbp->GetPath()); if (Header == 2) - strcat(PlugRemoveType(filename, filename), ".blk"); + { + PlugRemoveType(filename, filename); + safe_strcat(filename, sizeof(filename), ".blk"); + } #if defined(_WIN32) LARGE_INTEGER len; @@ -3246,10 +3257,10 @@ int BGVFAM::GetBlockInfo(PGLOBAL g) /*b = */ BigSeek(g, h, -(BIGINT)sizeof(vh), true); if (BigRead(g, h, &vh, sizeof(vh))) { - sprintf(g->Message, "Error reading header file %s", filename); + snprintf(g->Message, sizeof(g->Message), "Error reading header file %s", filename); n = -1; } else if (MaxBlk * Nrec != vh.MaxRec) { - sprintf(g->Message, "MaxRec=%d doesn't match MaxBlk=%d Nrec=%d", + snprintf(g->Message, sizeof(g->Message), "MaxRec=%d doesn't match MaxBlk=%d Nrec=%d", vh.MaxRec, MaxBlk, Nrec); n = -1; } else { @@ -3288,7 +3299,10 @@ bool BGVFAM::SetBlockInfo(PGLOBAL g) b = true; } else // Header == 2 - strcat(PlugRemoveType(filename, filename), ".blk"); + { + PlugRemoveType(filename, filename); + safe_strcat(filename, sizeof(filename), ".blk"); + } if (h == INVALID_HANDLE_VALUE) { #if defined(_WIN32) @@ -3304,7 +3318,7 @@ bool BGVFAM::SetBlockInfo(PGLOBAL g) #endif // !_WIN32 if (h == INVALID_HANDLE_VALUE) { - sprintf(g->Message, "Error opening header file %s", filename); + snprintf(g->Message, sizeof(g->Message), "Error opening header file %s", filename); return true; } // endif h @@ -3317,7 +3331,7 @@ bool BGVFAM::SetBlockInfo(PGLOBAL g) vh.NumRec = (Block - 1) * Nrec + Last; if (BigWrite(g, h, &vh, sizeof(vh))) { - sprintf(g->Message, "Error writing header file %s", filename); + snprintf(g->Message, sizeof(g->Message), "Error writing header file %s", filename); rc = true; } // endif fread @@ -3381,11 +3395,11 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, PCSZ fn) err: rc = GetLastError(); - sprintf(g->Message, MSG(EMPTY_FILE), p, filename); + snprintf(g->Message, sizeof(g->Message), MSG(EMPTY_FILE), p, filename); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)filename, sizeof(filename), NULL); - strcat(g->Message, filename); + safe_strcat(g->Message, sizeof(g->Message), filename); if (h != INVALID_HANDLE_VALUE) CloseHandle(h); @@ -3417,7 +3431,7 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, PCSZ fn) return false; err: - sprintf(g->Message, MSG(MAKE_EMPTY_FILE), To_File, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(MAKE_EMPTY_FILE), To_File, strerror(errno)); close(h); return true; #endif // !_WIN32 @@ -3434,7 +3448,7 @@ bool BGVFAM::OpenTableFile(PGLOBAL g) PDBUSER dbuserp = PlgGetUser(g); if ((To_Fb && To_Fb->Count) || Hfile != INVALID_HANDLE_VALUE) { - sprintf(g->Message, MSG(FILE_OPEN_YET), To_File); + snprintf(g->Message, sizeof(g->Message), MSG(FILE_OPEN_YET), To_File); return true; } // endif @@ -3505,7 +3519,7 @@ bool BGVFAM::OpenTableFile(PGLOBAL g) creation = OPEN_EXISTING; break; default: - sprintf(g->Message, MSG(BAD_OPEN_MODE), mode); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode); return true; } // endswitch @@ -3517,11 +3531,11 @@ bool BGVFAM::OpenTableFile(PGLOBAL g) if (Hfile == INVALID_HANDLE_VALUE) { rc = GetLastError(); - sprintf(g->Message, MSG(OPEN_ERROR), rc, mode, filename); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, mode, filename); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)filename, sizeof(filename), NULL); - strcat(g->Message, filename); + safe_strcat(g->Message, sizeof(g->Message), filename); } // endif Hfile if (trace(1)) @@ -3540,7 +3554,7 @@ bool BGVFAM::OpenTableFile(PGLOBAL g) if (of.LowPart == INVALID_SET_FILE_POINTER && (rc = GetLastError()) != NO_ERROR) { - sprintf(g->Message, MSG(ERROR_IN_SFP), rc); + snprintf(g->Message, sizeof(g->Message), MSG(ERROR_IN_SFP), rc); CloseHandle(Hfile); Hfile = INVALID_HANDLE_VALUE; } // endif @@ -3590,7 +3604,7 @@ bool BGVFAM::OpenTableFile(PGLOBAL g) // This will delete the whole file and provoque ReadDB to // return immediately. oflag = O_RDWR | O_TRUNC; - strcpy(g->Message, MSG(NO_VCT_DELETE)); + strncpy(g->Message, MSG(NO_VCT_DELETE), sizeof(g->Message)); break; } // endif @@ -3601,7 +3615,7 @@ bool BGVFAM::OpenTableFile(PGLOBAL g) oflag = (UseTemp) ? O_RDONLY : O_RDWR; break; default: - sprintf(g->Message, MSG(BAD_OPEN_MODE), mode); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode); return true; } // endswitch @@ -3609,8 +3623,8 @@ bool BGVFAM::OpenTableFile(PGLOBAL g) if (Hfile == INVALID_HANDLE_VALUE) { rc = errno; - sprintf(g->Message, MSG(OPEN_ERROR), rc, mode, filename); - strcat(g->Message, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR)"%s", rc, mode, + filename, strerror(errno)); } // endif Hfile if (trace(1)) @@ -3765,7 +3779,7 @@ int BGVFAM::WriteBuffer(PGLOBAL g) } else { // Mode Insert if (MaxBlk && CurBlk == MaxBlk) { - strcpy(g->Message, MSG(TRUNC_BY_ESTIM)); + strncpy(g->Message, MSG(TRUNC_BY_ESTIM), sizeof(g->Message)); return RC_EF; // Too many lines for a Vector formatted table } // endif MaxBlk @@ -3915,12 +3929,12 @@ int BGVFAM::DeleteRecords(PGLOBAL g, int irc) if (!SetEndOfFile(Hfile)) { DWORD drc = GetLastError(); - sprintf(g->Message, MSG(SETEOF_ERROR), drc); + snprintf(g->Message, sizeof(g->Message), MSG(SETEOF_ERROR), drc); return RC_FX; } // endif error #else // !_WIN32 if (ftruncate64(Hfile, (BIGINT)(Tpos * Lrecl))) { - sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(TRUNCATE_ERROR), strerror(errno)); return RC_FX; } // endif #endif // !_WIN32 @@ -3953,7 +3967,8 @@ bool BGVFAM::OpenTempFile(PGLOBAL g) /*********************************************************************/ tempname = (char*)PlugSubAlloc(g, NULL, _MAX_PATH); PlugSetPath(tempname, To_File, Tdbp->GetPath()); - strcat(PlugRemoveType(tempname, tempname), ".t"); + PlugRemoveType(tempname, tempname); + safe_strcat(tempname, _MAX_PATH, ".t"); if (!MaxBlk) remove(tempname); // Be sure it does not exist yet @@ -3968,11 +3983,11 @@ bool BGVFAM::OpenTempFile(PGLOBAL g) if (Tfile == INVALID_HANDLE_VALUE) { DWORD rc = GetLastError(); - sprintf(g->Message, MSG(OPEN_ERROR), rc, MODE_DELETE, tempname); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, MODE_DELETE, tempname); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)tempname, _MAX_PATH, NULL); - strcat(g->Message, tempname); + safe_strcat(g->Message, sizeof(g->Message), tempname); return true; } // endif Tfile #else // UNIX @@ -3982,8 +3997,8 @@ bool BGVFAM::OpenTempFile(PGLOBAL g) if (Tfile == INVALID_HANDLE_VALUE) { int rc = errno; - sprintf(g->Message, MSG(OPEN_ERROR), rc, MODE_INSERT, tempname); - strcat(g->Message, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR) "%s", rc, MODE_INSERT, + tempname, strerror(errno)); return true; } //endif Tfile #endif // UNIX diff --git a/storage/connect/filamzip.cpp b/storage/connect/filamzip.cpp index 77a97b9510791..5a1e40cccb260 100644 --- a/storage/connect/filamzip.cpp +++ b/storage/connect/filamzip.cpp @@ -29,6 +29,7 @@ #include #endif // !_WIN32 #include +#include /***********************************************************************/ /* Include application header files: */ @@ -114,7 +115,7 @@ static bool ZipFile(PGLOBAL g, ZIPUTIL *zutp, PCSZ fn, PCSZ entry, char *buf) if (zutp->addEntry(g, entry)) return true; else if (!(fin = fopen(fn, "rb"))) { - sprintf(g->Message, "error in opening %s for reading", fn); + snprintf(g->Message, sizeof(g->Message), "error in opening %s for reading", fn); return true; } // endif fin @@ -122,7 +123,7 @@ static bool ZipFile(PGLOBAL g, ZIPUTIL *zutp, PCSZ fn, PCSZ entry, char *buf) size_read = (int)fread(buf, 1, size_buf, fin); if (size_read < size_buf && feof(fin) == 0) { - sprintf(g->Message, "error in reading %s", fn); + snprintf(g->Message, sizeof(g->Message), "error in reading %s", fn); rc = RC_FX; } // endif size_read @@ -130,7 +131,7 @@ static bool ZipFile(PGLOBAL g, ZIPUTIL *zutp, PCSZ fn, PCSZ entry, char *buf) rc = zutp->writeEntry(g, buf, size_read); if (rc == RC_FX) - sprintf(g->Message, "error in writing %s in the zipfile", fn); + snprintf(g->Message, sizeof(g->Message), "error in writing %s in the zipfile", fn); } // endif size_read @@ -170,7 +171,7 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf) if (rc != ERROR_FILE_NOT_FOUND) { FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), 0, (LPTSTR)&filename, sizeof(filename), NULL); - sprintf(g->Message, MSG(BAD_FILE_HANDLE), filename); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FILE_HANDLE), filename); return true; } else { strcpy(g->Message, "Cannot find any file to load"); @@ -181,7 +182,8 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf) while (true) { if (!(FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { - strcat(strcat(strcpy(filename, drive), direc), FileData.cFileName); + snprintf(filename, sizeof(filename), "%s%s%s", + drive, direc, FileData.cFileName); if (ZipFile(g, zutp, filename, FileData.cFileName, buf)) { FindClose(hSearch); @@ -194,7 +196,7 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf) rc = GetLastError(); if (rc != ERROR_NO_MORE_FILES) { - sprintf(g->Message, MSG(NEXT_FILE_ERROR), rc); + snprintf(g->Message, sizeof(g->Message), MSG(NEXT_FILE_ERROR), rc); FindClose(hSearch); return true; } // endif rc @@ -217,19 +219,19 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf) struct dirent *entry; _splitpath(filename, NULL, direc, pattern, ftype); - strcat(pattern, ftype); + safe_strcat(pattern, sizeof(pattern), ftype); // Start searching files in the target directory. if (!(dir = opendir(direc))) { - sprintf(g->Message, MSG(BAD_DIRECTORY), direc, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_DIRECTORY), direc, strerror(errno)); return true; } // endif dir while ((entry = readdir(dir))) { - strcat(strcpy(fn, direc), entry->d_name); + snprintf(fn, sizeof(fn), "%s%s", direc, entry->d_name); if (lstat(fn, &fileinfo) < 0) { - sprintf(g->Message, "%s: %s", fn, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), "%s: %s", fn, strerror(errno)); return true; } else if (!S_ISREG(fileinfo.st_mode)) continue; // Not a regular file (should test for links) @@ -240,7 +242,7 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf) if (fnmatch(pattern, entry->d_name, 0)) continue; // Not a match - strcat(strcpy(filename, direc), entry->d_name); + snprintf(filename, sizeof(filename), "%s%s", direc, entry->d_name); if (ZipFile(g, zutp, filename, entry->d_name, buf)) { closedir(dir); @@ -343,7 +345,7 @@ bool ZIPUTIL::open(PGLOBAL g, PCSZ filename, bool append) if (!zipfile && !(zipfile = zipOpen64(filename, append ? APPEND_STATUS_ADDINZIP : APPEND_STATUS_CREATE))) - sprintf(g->Message, "Zipfile open error on %s", filename); + snprintf(g->Message, sizeof(g->Message), "Zipfile open error on %s", filename); return (zipfile == NULL); } // end of open @@ -430,7 +432,7 @@ bool ZIPUTIL::addEntry(PGLOBAL g, PCSZ entry) int ZIPUTIL::writeEntry(PGLOBAL g, char *buf, int len) { if (zipWriteInFileInZip(zipfile, buf, len) < 0) { - sprintf(g->Message, "Error writing %s in the zipfile", target); + snprintf(g->Message, sizeof(g->Message), "Error writing %s in the zipfile", target); return RC_FX; } // endif zipWriteInFileInZip @@ -549,7 +551,7 @@ bool UNZIPUTL::WildMatch(PCSZ pat, PCSZ str) { bool UNZIPUTL::open(PGLOBAL g, PCSZ filename) { if (!zipfile && !(zipfile = unzOpen64(filename))) - sprintf(g->Message, "Zipfile open error on %s", filename); + snprintf(g->Message, sizeof(g->Message), "Zipfile open error on %s", filename); return (zipfile == NULL); } // end of open @@ -584,7 +586,7 @@ int UNZIPUTL::findEntry(PGLOBAL g, bool next) if (rc == UNZ_END_OF_LIST_OF_FILE) return RC_EF; else if (rc != UNZ_OK) { - sprintf(g->Message, "unzGoToNextFile rc = %d", rc); + snprintf(g->Message, sizeof(g->Message), "unzGoToNextFile rc = %d", rc); return RC_FX; } // endif rc @@ -598,7 +600,7 @@ int UNZIPUTL::findEntry(PGLOBAL g, bool next) return RC_OK; } else { - sprintf(g->Message, "GetCurrentFileInfo rc = %d", rc); + snprintf(g->Message, sizeof(g->Message), "GetCurrentFileInfo rc = %d", rc); return RC_FX; } // endif rc @@ -655,10 +657,10 @@ bool UNZIPUTL::OpenTable(PGLOBAL g, MODE mode, PCSZ fn) rc = unzLocateFile(zipfile, target, 0); if (rc == UNZ_END_OF_LIST_OF_FILE) { - sprintf(g->Message, "Target file %s not in %s", target, fn); + snprintf(g->Message, sizeof(g->Message), "Target file %s not in %s", target, fn); return true; } else if (rc != UNZ_OK) { - sprintf(g->Message, "unzLocateFile rc=%d", rc); + snprintf(g->Message, sizeof(g->Message), "unzLocateFile rc=%d", rc); return true; } // endif's rc @@ -666,7 +668,7 @@ bool UNZIPUTL::OpenTable(PGLOBAL g, MODE mode, PCSZ fn) if ((rc = findEntry(g, false)) == RC_FX) return true; else if (rc == RC_EF) { - sprintf(g->Message, "No match of %s in %s", target, fn); + snprintf(g->Message, sizeof(g->Message), "No match of %s in %s", target, fn); return true; } // endif rc @@ -741,10 +743,10 @@ bool UNZIPUTL::openEntry(PGLOBAL g) NULL, 0, NULL, 0); if (rc != UNZ_OK) { - sprintf(g->Message, "unzGetCurrentFileInfo64 rc=%d", rc); + snprintf(g->Message, sizeof(g->Message), "unzGetCurrentFileInfo64 rc=%d", rc); return true; } else if ((rc = unzOpenCurrentFilePassword(zipfile, pwd)) != UNZ_OK) { - sprintf(g->Message, "unzOpen fn=%s rc=%d", fn, rc); + snprintf(g->Message, sizeof(g->Message), "unzOpen fn=%s rc=%d", fn, rc); return true; } // endif rc @@ -758,7 +760,7 @@ bool UNZIPUTL::openEntry(PGLOBAL g) } // end try/catch if ((rc = unzReadCurrentFile(zipfile, memory, size)) < 0) { - sprintf(g->Message, "unzReadCurrentFile rc = %d", rc); + snprintf(g->Message, sizeof(g->Message), "unzReadCurrentFile rc = %d", rc); unzCloseCurrentFile(zipfile); delete[] memory; memory = NULL; @@ -1020,7 +1022,7 @@ int UZXFAM::Cardinality(PGLOBAL g) if (!(len % Lrecl)) card = len / (int)Lrecl; // Fixed length file else - sprintf(g->Message, MSG(NOT_FIXED_LEN), zutp->fn, len, Lrecl); + snprintf(g->Message, sizeof(g->Message), MSG(NOT_FIXED_LEN), zutp->fn, len, Lrecl); // Set number of blocks for later use Block = (card > 0) ? (card + Nrec - 1) / Nrec : 0; @@ -1074,7 +1076,7 @@ int UZXFAM::GetNext(PGLOBAL g) int len = zutp->size; if (len % Lrecl) { - sprintf(g->Message, MSG(NOT_FIXED_LEN), zutp->fn, len, Lrecl); + snprintf(g->Message, sizeof(g->Message), MSG(NOT_FIXED_LEN), zutp->fn, len, Lrecl); return RC_FX; } // endif size @@ -1144,7 +1146,7 @@ int UZDFAM::dbfhead(PGLOBAL g, void* buf) // Some headers just have 1D others have 1D00 following fields if (endmark[0] != EOH && endmark[1] != EOH) { - sprintf(g->Message, MSG(NO_0DH_HEAD), dbc); + snprintf(g->Message, sizeof(g->Message), MSG(NO_0DH_HEAD), dbc); if (rc == RC_OK) return RC_FX; @@ -1263,7 +1265,7 @@ int UZDFAM::GetNext(PGLOBAL g) #if 0 if (len % Lrecl) { - sprintf(g->Message, MSG(NOT_FIXED_LEN), zutp->fn, len, Lrecl); + snprintf(g->Message, sizeof(g->Message), MSG(NOT_FIXED_LEN), zutp->fn, len, Lrecl); return RC_FX; } // endif size #endif // 0 diff --git a/storage/connect/filter.cpp b/storage/connect/filter.cpp index 9d8518ec3a567..da418d38e312d 100644 --- a/storage/connect/filter.cpp +++ b/storage/connect/filter.cpp @@ -83,7 +83,7 @@ BYTE OpBmp(PGLOBAL g, OPVAL opc) case OP_LE: bt = 0x04; break; case OP_EXIST: bt = 0x00; break; default: - sprintf(g->Message, MSG(BAD_FILTER_OP), opc); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FILTER_OP), opc); throw (int)TYPE_FILTER; } // endswitch opc @@ -1021,7 +1021,7 @@ bool FILTER::Convert(PGLOBAL g, bool having) // Special case of the LIKE operator. if (Opc == OP_LIKE) { if (!IsTypeChar((int)Test[i].B_T)) { - sprintf(g->Message, MSG(BAD_TYPE_LIKE), i, Test[i].B_T); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_TYPE_LIKE), i, Test[i].B_T); return TRUE; } // endif @@ -1129,11 +1129,11 @@ bool FILTER::Convert(PGLOBAL g, bool having) // Last check to be sure all is correct. if (Test[0].B_T != Test[1].B_T) { - sprintf(g->Message, MSG(BAD_FILTER_CONV), Test[0].B_T, Test[1].B_T); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FILTER_CONV), Test[0].B_T, Test[1].B_T); return TRUE; //} else if (Test[0].B_T == TYPE_LIST && // ((LSTVAL*)Val(0))->GetN() != ((LSTVAL*)Val(1))->GetN()) { -// sprintf(g->Message, MSG(ROW_ARGNB_ERR), +// snprintf(g->Message, sizeof(g->Message), MSG(ROW_ARGNB_ERR), // ((LSTVAL*)Val(0))->GetN(), ((LSTVAL*)Val(1))->GetN()); // return TRUE; } // endif's B_T @@ -1372,7 +1372,7 @@ bool FILTER::Eval(PGLOBAL g) return FALSE; FilterError: - sprintf(g->Message, MSG(BAD_FILTER), + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FILTER), Opc, Test[0].B_T, Test[1].B_T, GetArgType(0), GetArgType(1)); return TRUE; } // end of Eval diff --git a/storage/connect/filter.h b/storage/connect/filter.h index 12ac3a169c1a6..0c3fa41046a56 100644 --- a/storage/connect/filter.h +++ b/storage/connect/filter.h @@ -77,7 +77,7 @@ class DllExport FILTER : public XOBJECT { /* Filter description block */ // PFIL Copy(PTABS t); protected: - FILTER(void) {} // Standard constructor not to be used + FILTER(void) = default; // Standard constructor not to be used void Constr(PGLOBAL g, OPVAL opc, int opm, PPARM *tp); // Members diff --git a/storage/connect/frcas.h b/storage/connect/frcas.h deleted file mode 100644 index e9401d475ae56..0000000000000 --- a/storage/connect/frcas.h +++ /dev/null @@ -1,320 +0,0 @@ - case MSG_ACCESS_VIOLATN: p = "Violation acc�s m�moire"; break; - case MSG_ADD_BAD_TYPE: p = "Ajout d'une valeur de type %s non conforme dans un tableau %s"; break; - case MSG_ALLOC_ERROR: p = "Erreur d'allocation de %s"; break; - case MSG_ANSWER_TYPE: p = "R�ponse de type"; break; - case MSG_API_CONF_ERROR: p = "Erreur SQL: API_CONFORMANCE"; break; - case MSG_APPL_NOT_INIT: p = "Application non initialis�e"; break; - case MSG_ARRAY_BNDS_EXCD: p = "Hors limite de tableau"; break; - case MSG_BAD_ARRAY_OPER: p = "Les tableaux doivent utiliser l'op�rateur IN"; break; - case MSG_BAD_ARRAY_TYPE: p = "Type=%d invalide pour un tableau"; break; - case MSG_BAD_ARRAY_VAL: p = "Les tableaux doivent avoir le m�me nombre de valeurs"; break; - case MSG_BAD_BIN_FMT: p = "Format invalide %c pour la colonne BIN %s"; break; - case MSG_BAD_BLK_ESTIM: p = "Nombre de blocs sup�rieur � l'estimation"; break; - case MSG_BAD_BLK_SIZE: p = "Taille du bloc %d non conforme"; break; - case MSG_BAD_BYTE_NUM: p = "Le nombre d'octets �crits est faux"; break; - case MSG_BAD_BYTE_READ: p = "Le nombre d'octets lus est faux"; break; - case MSG_BAD_COL_TYPE: p = "Type invalide %s pour la colonne %s"; break; - case MSG_BAD_COL_XPATH: p = "Xpath invalide colonne %s de la table HTML %s"; break; - case MSG_BAD_CONST_TYPE: p = "Type=%d invalide pour une constante"; break; - case MSG_BAD_CONV_TYPE: p = "Convertion de type invalide %d"; break; - case MSG_BAD_DATETIME: p = "Valeur date/temps invalide"; break; - case MSG_BAD_DBF_FILE: p = "Le fichier DBF %s est alt�r�"; break; - case MSG_BAD_DBF_REC: p = "Fichier DBF %s alt�r� enregistrement %d"; break; - case MSG_BAD_DBF_TYPE: p = "Type DBF %c non support� colonne %s"; break; - case MSG_BAD_DIRECTORY: p = "R�pertoire invalide %s: %s"; break; - case MSG_BAD_FIELD_RANK: p = "Rang %d invalide pour la colonne %s"; break; - case MSG_BAD_FIELD_TYPE: p = "Mauvais type de champ %s"; break; - case MSG_BAD_FILE_HANDLE: p = "Handle de fichier invalide: %s"; break; - case MSG_BAD_FILTER: p = "Mauvais filtre: Opc=%d B_T=%d %d Type=%d %d"; break; - case MSG_BAD_FILTER_CONV: p = "Conversion filtre incorrecte, B_T=%d,%d"; break; - case MSG_BAD_FILTER_OP: p = "Op�rateur de filtre invalide %d"; break; - case MSG_BAD_FLD_FORMAT: p = "Format invalide pour le champs %d de %s"; break; - case MSG_BAD_FLD_LENGTH: p = "Champs %s trop long (%s --> %d) ligne %d de %s"; break; - case MSG_BAD_FREQ_SET: p = "Sp�cification erronn�e de Freq pour la colonne %s"; break; - case MSG_BAD_FUNC_MODE: p = "%s: mode invalide %d"; break; - case MSG_BAD_HANDLE_VAL: p = "Valeur Handle invalide"; break; - case MSG_BAD_HEADER: p = "Fichier %s: bloc en-t�te alt�r�"; break; - case MSG_BAD_HEAD_END: p = "Lecture fin d'en-t�te impossible"; break; - case MSG_BAD_INDEX_FILE: p = "Fichier index %s corrompu"; break; - case MSG_BAD_LINEFLD_FMT: p = "Format invalide ligne %d champs %d de %s"; break; - case MSG_BAD_LINE_LEN: p = "Longueur ligne non �gale � Lrecl"; break; - case MSG_BAD_LRECL: p = "Disparit� lrecl table/fichier (%d,%hd)"; break; - case MSG_BAD_NODE_TYPE: p = "Type noeud erron� pour la table"; break; - case MSG_BAD_OFFSET_VAL: p = "Nul offset invalide pour une table CSV"; break; - case MSG_BAD_OPEN_MODE: p = "Mode d'ouverture invalide %d"; break; - case MSG_BAD_PARAM_TYPE: p = "%.8s: Param�tre de type=%d invalide"; break; - case MSG_BAD_PARM_COUNT: p = "Nombre de param�tres incoh�rent"; break; - case MSG_BAD_QUOTE_FIELD: p = "Quote manquante dans %s champs %d ligne %d"; break; - case MSG_BAD_READ_NUMBER: p = "Mauvais nombre %d de valeurs lues dans %s"; break; - case MSG_BAD_RECFM: p = "Recfm type %d invalide pour DOSCOL"; break; - case MSG_BAD_RECFM_VAL: p = "Valeur invalide %d de Recfm"; break; - case MSG_BAD_SET_CASE: p = "La casse d'un tableau ne peut pas passer de non respect � respecter"; break; - case MSG_BAD_SET_STRING: p = "SetValue: appel invalide pour STRING"; break; - case MSG_BAD_SPECIAL_COL: p = "Colonne sp�ciale invalide %s"; break; - case MSG_BAD_SPEC_COLUMN: p = "Colonne sp�ciale invalide pour ce type de table"; break; - case MSG_BAD_TABLE_TYPE: p = "Type invalide %s pour la table %s"; break; - case MSG_BAD_TYPE_LIKE: p = "Type(%d)= %d invalide pour LIKE"; break; - case MSG_BAD_VALBLK_INDX: p = "Valeur hors limites de l'index du bloc de valeurs"; break; - case MSG_BAD_VALBLK_TYPE: p = "Type=%d invalide pour un bloc de valeurs"; break; - case MSG_BAD_VALNODE: p = "Type %d invalide pour le noeud valeur colonne %s"; break; - case MSG_BAD_VALUE_TYPE: p = "Type de valeur invalide %d"; break; - case MSG_BAD_VAL_UPDATE: p = "Impossible de d�terminer quelle valeur %s doit �tre mise � jour"; break; - case MSG_BAS_NS_LIST: p = "Format invalide de la liste des espace-noms"; break; - case MSG_BIN_F_TOO_LONG: p = "Valeur trop longue pour le champ %s (%d --> %d)"; break; - case MSG_BIN_MODE_FAIL: p = "Echec mode binaire: %s"; break; - case MSG_BLKTYPLEN_MISM: p = "Disparit� types/longueurs de bloc dans SetValue"; break; - case MSG_BLK_IS_NULL: p = "Blk est nul"; break; - case MSG_BREAKPOINT: p = "Point de contr�le"; break; - case MSG_BUILD_INDEX: p = "Construction index %s sur %s"; break; - case MSG_CANNOT_OPEN: p = "Ouverture impossible de %s"; break; - case MSG_CHSIZE_ERROR: p = "Erreur dans chsize: %s"; break; - case MSG_COL_ALLOC_ERR: p = "Allocation impossible du noeud colonne"; break; - case MSG_COL_ISNOT_TABLE: p = "La colonne %s n'est pas dans la table %s"; break; - case MSG_COL_NOT_SORTED: p = "La colonne %s de la table %s n'est pas tri�e"; break; - case MSG_COL_NUM_MISM: p = "Disparit� du nombre de colonnes"; break; - case MSG_COM_ERROR: p = "Erreur Com"; break; - case MSG_CONCAT_SUBNODE: p = "Concat�nation de sous-noeuds impossible"; break; - case MSG_CONNECT_CANCEL: p = "Connection interrompue par l'utilisateur"; break; - case MSG_CONTROL_C_EXIT: p = "Exit par Ctrl-C"; break; - case MSG_DATABASE_LOADED: p = "Base de donn�es %s charg�e"; break; - case MSG_DATA_MISALIGN: p = "Mauvais alignement pour ce type de donn�es"; break; - case MSG_DBASE_FILE: p = "Fichier dBASE dbf: "; break; - case MSG_DEF_ALLOC_ERROR: p = "Erreur d'allocation de la classe DEF %s"; break; - case MSG_DEL_FILE_ERR: p = "Erreur � l'effacement de %s"; break; - case MSG_DEL_READ_ERROR: p = "Delete: erreur en lecture req=%d len=%d"; break; - case MSG_DEL_WRITE_ERROR: p = "Delete: erreur en �criture: %s"; break; - case MSG_DEPREC_FLAG: p = "Option Flag p�rim�e, utiliser Coltype"; break; - case MSG_DLL_LOAD_ERROR: p = "Erreur %d au chargement du module %s"; break; - case MSG_DOM_NOT_SUPP: p = "MS-DOM non support� par cette version"; break; - case MSG_DVAL_NOTIN_LIST: p = "Valeur %s non trouv�e dans la liste des valeurs distinctes de la colonne %s"; break; - case MSG_EMPTY_DOC: p = "Document vide"; break; - case MSG_EMPTY_FILE: p = "%s du fichier vide %s: "; break; - case MSG_EOF_AFTER_LINE: p = "Fin de fichier apr�s la ligne %d"; break; - case MSG_EOF_INDEX_FILE: p = "EOF lisant le fichier index"; break; - case MSG_ERROR_IN_LSK: p = "Erreur %d dans lseek64"; break; - case MSG_ERROR_IN_SFP: p = "Erreur %d dans SetFilePointer"; break; - case MSG_ERR_READING_REC: p = "Erreur lisant l'enregistrement %d de %s"; break; - case MSG_FAIL_ADD_NODE: p = "L'ajout du noeud %s dans la table a �chou�"; break; - case MSG_FETCH_NO_RES: p = "Fetch: Pas de R�sultats"; break; - case MSG_FIELD_TOO_LONG: p = "Valeur trop longue pour le champs %d ligne %d"; break; - case MSG_FILELEN_ERROR: p = "Erreur dans %s pour %s"; break; - case MSG_FILE_IS_EMPTY: p = "Le fichier %s est vide"; break; - case MSG_FILE_MAP_ERR: p = "Erreur de File mapping"; break; - case MSG_FILE_MAP_ERROR: p = "CreateFileMapping %s erreur rc=%d"; break; - case MSG_FILE_OPEN_YET: p = "Fichier %s d�j� ouvert"; break; - case MSG_FILE_UNFOUND: p = "Fichier %s non trouv�"; break; - case MSG_FLD_TOO_LNG_FOR: p = "Champs %d trop long pour %s ligne %d de %s"; break; - case MSG_FLT_BAD_RESULT: p = "Virgule flottante: r�sultat inexacte"; break; - case MSG_FLT_DENORMAL_OP: p = "Op�rande virgule flottante non normalis�"; break; - case MSG_FLT_INVALID_OP: p = "Op�ration virgule flottante invalide"; break; - case MSG_FLT_OVERFLOW: p = "D�passement de capacit� virgule flottante"; break; - case MSG_FLT_STACK_CHECK: p = "Virgule flottante: Erreur de la pile"; break; - case MSG_FLT_UNDERFLOW: p = "Sous-d�passement de capacit� virgule flottante"; break; - case MSG_FLT_ZERO_DIVIDE: p = "Virgule flottante: division par z�ro"; break; - case MSG_FMT_WRITE_NIY: p = "L'�criture des fichiers %s n'est pas encore impl�ment�e"; break; - case MSG_FOXPRO_FILE: p = "Fichier FoxPro: "; break; - case MSG_FPUTS_ERROR: p = "Erreur dans fputs: %s"; break; - case MSG_FSEEK_ERROR: p = "Erreur dans fseek: %s"; break; - case MSG_FSETPOS_ERROR: p = "Erreur dans fseek pour i=%d"; break; - case MSG_FTELL_ERROR: p = "Erreur dans ftell enregistrement=%d: %s"; break; - case MSG_FUNCTION_ERROR: p = "Erreur dans %s: %d"; break; - case MSG_FUNC_ERRNO: p = "Erreur %d dans %s"; break; - case MSG_FUNC_ERROR: p = "Erreur dans %s"; break; - case MSG_FUNC_ERR_S: p = "Erreur dans %s: %s"; break; - case MSG_FWRITE_ERROR: p = "Erreur dans fwrite: %s"; break; - case MSG_GET_DIST_VALS: p = "R�cup�ration des valeurs distinctes de "; break; - case MSG_GET_FUNC_ERR: p = "Erreur en recherche de la fonction %s: %s"; break; - case MSG_GLOBAL_ERROR: p = "Erreur d'allocation de Global (taille=%d)\n"; break; - case MSG_GUARD_PAGE: p = "Violation de page de garde"; break; - case MSG_GZOPEN_ERROR: p = "gzopen %s: erreur %d sur %s"; break; - case MSG_ILLEGAL_INSTR: p = "Instruction ill�gale"; break; - case MSG_ILL_FILTER_CONV: p = "Conversion implicite ill�gale dans un filtre"; break; - case MSG_INDEX_NOT_UNIQ: p = "L'index n'est pas Unique"; break; - case MSG_INDEX_YET_ON: p = "L'index %s existe d�j� sur %s"; break; - case MSG_INDX_COL_NOTIN: p = "La colonne index %s n'existe pas dans la table %s"; break; - case MSG_INDX_EXIST_YET: p = "L'entr�e index existe d�j�"; break; - case MSG_INIT_FAILED: p = "L'initialisation de %s a �chou�"; break; - case MSG_INT_COL_ERROR: p = "Erreur interne sur la colonne index %s"; break; - case MSG_INT_OVERFLOW: p = "D�passement de capacit� sur entier"; break; - case MSG_INT_ZERO_DIVIDE: p = "Division enti�re par z�ro"; break; - case MSG_INVALID_DISP: p = "Disposition invalide"; break; - case MSG_INVALID_FTYPE: p = "SBV: Ftype %d invalide"; break; - case MSG_INVALID_HANDLE: p = "Poign�e invalide"; break; - case MSG_INVALID_OPER: p = "Op�rateur invalide %d pour %s"; break; - case MSG_INV_COLUMN_TYPE: p = "Type %d Invalide pour la colonne %s"; break; - case MSG_INV_COL_TYPE: p = "Type de colonne %s invalide"; break; - case MSG_INV_DEF_READ: p = "Lecture diff�r�e invalide rc=%d"; break; - case MSG_INV_DIRCOL_OFST: p = "Offset invalide pour une colonne DIR"; break; - case MSG_INV_MAP_POS: p = "Position m�moire invalide"; break; - case MSG_INV_RAND_ACC: p = "L'acc�s al�atoire d'une table non optimis�e est impossible"; break; - case MSG_INV_REC_POS: p = "Position d'enregistrement invalide"; break; - case MSG_INV_RESULT_TYPE: p = "Type de r�sultat invalide %s"; break; - case MSG_INV_UPDT_TABLE: p = "Table %s invalide pour Update"; break; - case MSG_IN_WITHOUT_SUB: p = "IN ou EXISTS sans tableau ou subquery"; break; - case MSG_KEY_ALLOC_ERR: p = "Erreur d'allocation d'un bloc offset cl�"; break; - case MSG_KEY_ALLOC_ERROR: p = "Erreur d'allocation m�moire, Klen=%d n=%d"; break; - case MSG_LINE_TOO_LONG: p = "La nouvelle ligne est trop longue"; break; - case MSG_LIST: p = "--Liste--"; break; - case MSG_LOADING_FAILED: p = "Le chargement de %s a �chou�"; break; - case MSG_LRECL_TOO_SMALL: p = "Lrecl trop petit (longueur en-t�te = %d)"; break; - case MSG_MAKE_EMPTY_FILE: p = "G�n�ration du fichier vide %s: %s"; break; - case MSG_MAKING: p = "G�n�ration"; break; - case MSG_MALLOC_ERROR: p = "Allocation m�moire impossible par %s"; break; - case MSG_MAP_VIEW_ERROR: p = "MapViewOfFile %s erreur rc=%d"; break; - case MSG_MAXSIZE_ERROR: p = "Maxsize incalculable sur table ouverte"; break; - case MSG_MEM_ALLOC_ERR: p = "Erreur d'allocation m�moire, taille %s = %d"; break; - case MSG_MEM_ALLOC_ERROR: p = "Erreur d'allocation m�moire"; break; - case MSG_MISPLACED_QUOTE: p = "Appostrophe mal plac�e ligne %d"; break; - case MSG_MISSING_ARG: p = "Argument manquant pour l'op�rateur %d"; break; - case MSG_MISSING_FIELD: p = "Champs %d manquant dans %s ligne %d"; break; - case MSG_MISSING_FNAME: p = "Nom du fichier manquant"; break; - case MSG_MISSING_NODE: p = "Noeud %s manquant dans %s"; break; - case MSG_MISSING_ROWNODE: p = "Impossible de trouver le noeud de la ligne %d"; break; - case MSG_MIS_TAG_LIST: p = "Liste des balises colonne manquante"; break; - case MSG_MUL_MAKECOL_ERR: p = "Erreur logique dans TABMUL::MakeCol"; break; - case MSG_NAME_CONV_ERR: p = "Erreur de convertion du nom de noeud"; break; - case MSG_NEW_DOC_FAILED: p = "Impossible de cr�er le nouveau document"; break; - case MSG_NEW_RETURN_NULL: p = "NULL renvoy� par New dans PlugEvalLike"; break; - case MSG_NEXT_FILE_ERROR: p = "Erreur en recherche du fichier suivant. rc=%s"; break; - case MSG_NONCONT_EXCEPT: p = "Exception non-continuable"; break; - case MSG_NOP_ZLIB_INDEX: p = "L'indexage d'une table zlib non optimis�e est impossible"; break; - case MSG_NOT_A_DBF_FILE: p = "Le fichier n'a pas le format dBASE dbf "; break; - case MSG_NOT_FIXED_LEN: p = "Fichier %s non fixe, len=%d lrecl=%d"; break; - case MSG_NO_0DH_HEAD: p = "0DH manquant en fin d'en-t�te (dbc=%d)"; break; - case MSG_NO_ACTIVE_DB: p = "Pas de base de donn�es active"; break; - case MSG_NO_CHAR_FROM: p = "Conversion de type %d en caract�res impossible"; break; - case MSG_NO_DATE_FMT: p = "Pas de format date pour le valblock de type %d"; break; - case MSG_NO_DEF_FNCCOL: p = "Colonne fonction par d�faut introuvable"; break; - case MSG_NO_DEF_PIVOTCOL: p = "Colonne pivot par d�faut introuvable"; break; - case MSG_NO_DIR_INDX_RD: p = "Pas d'acc�s directe des tables %s"; break; - case MSG_NO_FEAT_SUPPORT: p = "%s non support� dans cette version"; break; - case MSG_NO_FLD_FORMAT: p = "Format absent pour le champs %d de %s"; break; - case MSG_NO_FORMAT_COL: p = "Type COLUMN informattable"; break; - case MSG_NO_FORMAT_TYPE: p = "Le format ne peut pas �tre d�fini � partir du type %d"; break; - case MSG_NO_INDEX_READ: p = "Pas d'acc�s directe des tables multiples"; break; - case MSG_NO_KEY_COL: p = "Pas de colonne cl� trouv�e"; break; - case MSG_NO_KEY_UPDATE: p = "Le nom des cl�s ne peut pas �tre modifi�"; break; - case MSG_NO_MAP_INSERT: p = "MAP incompatible avec Insert"; break; - case MSG_NO_MATCHING_COL: p = "Pas de colonne correspondant � %s dans %s"; break; - case MSG_NO_MATCH_COL: p = "Colonne correspondante introuvable"; break; - case MSG_NO_MEMORY: p = "M�moire pleine"; break; - case MSG_NO_MODE_PADDED: p = "Mode non support� pour les fichiers 'padded'"; break; - case MSG_NO_MUL_VCT: p = "Les tables VCT ne peuvent pas �tre multiples"; break; - case MSG_NO_ODBC_DELETE: p = "Delete ne devrait pas �tre appel� pour les tables ODBC"; break; - case MSG_NO_ODBC_DIRECT: p = "Acc�s directe des tables ODBC non encore impl�ment�"; break; - case MSG_NO_ODBC_MUL: p = "Multiple(2) non support� pour les tables ODBC"; break; - case MSG_NO_ODBC_SPECOL: p = "Pas de colonne sp�ciale ODBC"; break; - case MSG_NO_PART_DEL: p = "Delete partiel des fichier %s impossible"; break; - case MSG_NO_PART_MAP: p = "Mapping partiel non impl�ment� pour cet OS"; break; - case MSG_NO_PAR_BLK_INS: p = "Insertion de bloc partiel impossible"; break; - case MSG_NO_PIV_DIR_ACC: p = "Pas d'acc�s directe aux tables PIVOT"; break; - case MSG_NO_READ_32: p = "Lecture de 32 octets impossible"; break; - case MSG_NO_RECOV_SPACE: p = "Espace non recouvrable dans le fichier index"; break; - case MSG_NO_ROWID_FOR_AM: p = "Acc�s direct impossible de ROWID pour les tables de type %s"; break; - case MSG_NO_ROW_NODE: p = "Le nom du Rownode n'est pas d�fini"; break; - case MSG_NO_SECTION_NAME: p = "Nom de section manquant"; break; - case MSG_NO_SEC_UPDATE: p = "Les noms de section ne peuvent pas �tre modifi�s"; break; - case MSG_NO_SETPOS_YET: p = "SetPos pas encore impl�ment� pour les fichier %s"; break; - case MSG_NO_SPEC_COL: p = "Pas de colonne sp�ciales MYSQL"; break; - case MSG_NO_SUB_VAL: p = "Pas de sous-value d'un tableau de type %d"; break; - case MSG_NO_TABCOL_DATA: p = "Pas de donn�es pour la table %s colonne %s"; break; - case MSG_NO_TABLE_DEL: p = "Delete non autoris� pour les tables %s "; break; - case MSG_NO_TAB_DATA: p = "Pas de donn�es pour la table %s"; break; - case MSG_NO_VCT_DELETE: p = "D�l�tion Partielle non impl�ment�e pour les fichiers VCT"; break; - case MSG_NO_ZIP_DELETE: p = "Delete sur fichier Zip non encore implement�"; break; - case MSG_OPENING: p = "Ouverture"; break; - case MSG_OPEN_EMPTY_FILE: p = "Ouverture du fichier vide %s: %s"; break; - case MSG_OPEN_ERROR: p = "Erreur d'ouverture %d en mode %d sur %s: "; break; - case MSG_OPEN_ERROR_IS: p = "Erreur � l'ouverture de %s: %s"; break; - case MSG_OPEN_MODE_ERROR: p = "Erreur d'ouverture(%s) %d sur %s"; break; - case MSG_OPEN_STRERROR: p = "Erreur � l'ouverture: %s"; break; - case MSG_OPTBLK_RD_ERR: p = "Erreur � la lecture d'un bloc optimisation: %s"; break; - case MSG_OPTBLK_WR_ERR: p = "Erreur � l'�criture d'un bloc optimisation: %s"; break; - case MSG_OPTIMIZING: p = "Optimisation de "; break; - case MSG_OPT_BMAP_RD_ERR: p = "Erreur en lecture des bitmaps d'optimisation: %s"; break; - case MSG_OPT_BMAP_WR_ERR: p = "Erreur en �criture des bitmaps d'optimisation: %s"; break; - case MSG_OPT_CANCELLED: p = "Optimisation interrompue par l'utilisateur"; break; - case MSG_OPT_DVAL_RD_ERR: p = "Erreur en lecture des valeurs distinctes: %s"; break; - case MSG_OPT_DVAL_WR_ERR: p = "Erreur en �criture des valeurs distinctes: %s"; break; - case MSG_OPT_HEAD_RD_ERR: p = "Erreur en lecture de l'ent�te du fichier opt: %s"; break; - case MSG_OPT_HEAD_WR_ERR: p = "Erreur en �criture de l'ent�te du fichier opt: %s"; break; - case MSG_OPT_LOGIC_ERR: p = "Erreur logique dans SetBitmap, i=%d"; break; - case MSG_OPT_MAX_RD_ERR: p = "Erreur en lecture des valeurs maxi: %s"; break; - case MSG_OPT_MAX_WR_ERR: p = "Erreur en �criture des valeurs maxi: %s"; break; - case MSG_OPT_MIN_RD_ERR: p = "Erreur en lecture des valeurs mini: %s"; break; - case MSG_OPT_MIN_WR_ERR: p = "Erreur en �criture des valeurs mini: %s"; break; - case MSG_OPT_NOT_MATCH: p = "Le fichier opt %s n'est pas � jour"; break; - case MSG_PAGE_ERROR: p = "Erreur de pagination"; break; - case MSG_PARM_CNT_MISS: p = "Disparit� du nombre de Param�tres"; break; - case MSG_PREC_VBLP_NULL: p = "ARRAY SetPrecision: Vblp est NULL"; break; - case MSG_PRIV_INSTR: p = "Instruction privil�gi�e"; break; - case MSG_PROCADD_ERROR: p = "Erreur %d sur l'adresse de %s"; break; - case MSG_QUERY_CANCELLED: p = "Requ�te interrompue par l'utilisateur"; break; - case MSG_RANGE_NO_JOIN: p = "Range non compatible avec les index de jointure"; break; - case MSG_RC_READING: p = "rc=%d en lecture de la table %s"; break; - case MSG_READY: p = "Pr�t"; break; - case MSG_READ_ERROR: p = "Erreur en lecture sur %s: %s"; break; - case MSG_READ_ONLY: p = "Cette table prot�g�e en lecture seule ne peut �tre modifi�e"; break; - case MSG_READ_SEEK_ERROR: p = "Erreur de recherche en lecture: %s"; break; - case MSG_REGISTER_ERR: p = "Enregistrement NS impossible, pr�fix='%s' et href='http://github.com/%s'"; break; - case MSG_REMOVE_ERROR: p = "Erreur en supprimant %s: %s"; break; - case MSG_RENAME_ERROR: p = "Erreur renommant %s en %s: %s"; break; - case MSG_ROWID_NOT_IMPL: p = "RowNumber non impl�ment� pour les tables de type %s"; break; - case MSG_SEC_KEY_FIRST: p = "Les sections et cl�s doivent �tre ins�r�es en premier"; break; - case MSG_SEC_NAME_FIRST: p = "Le nom de section doit �tre en t�te de liste en insertion"; break; - case MSG_SEP_IN_FIELD: p = "Le champ %d contient le caract�re s�parateur"; break; - case MSG_SEQUENCE_ERROR: p = "HSTMT: Allocation hors s�quence"; break; - case MSG_SETEOF_ERROR: p = "Erreur %d dans SetEndOfFile"; break; - case MSG_SETRECPOS_NIY: p = "SetRecpos non impl�ment� pour ce type de table"; break; - case MSG_SET_STR_TRUNC: p = "SetValue: Cha�ne de caract�res tronqu�e"; break; - case MSG_SFP_ERROR: p = "Erreur sur SetFilePointer: %s"; break; - case MSG_SHARED_LIB_ERR: p = "Erreur au chargement de la librairie partag�e %s: %s"; break; - case MSG_SINGLE_STEP: p = "Pas � pas"; break; - case MSG_SORTING_VAL: p = "Tri de %d valeurs"; break; - case MSG_SPCOL_READONLY: p = "La colonne sp�ciale %s est en lecture seulement"; break; - case MSG_SQL_CONF_ERROR: p = "Erreur SQL: SQL_CONFORMANCE"; break; - case MSG_SRCH_CLOSE_ERR: p = "Erreur � la fermeture de l'Handle de recherche"; break; - case MSG_SRC_TABLE_UNDEF: p = "La table source n'est pas d�finie"; break; - case MSG_STACK_OVERFLOW: p = "D�passement de capacit� de la pile"; break; - case MSG_TABDIR_READONLY: p = "Les tables DIR sont en lecture seulement"; break; - case MSG_TABLE_NOT_OPT: p = "Table non optimisable"; break; - case MSG_TABLE_NO_INDEX: p = "La table %s n'est pas indexable"; break; - case MSG_TABLE_READ_ONLY: p = "Les tables %s sont en lecture seulement "; break; - case MSG_TABMUL_READONLY: p = "Les tables multiples sont en lecture seulement"; break; - case MSG_TOO_MANY_FIELDS: p = "Trop de champs ligne %d de %s"; break; - case MSG_TOO_MANY_JUMPS: p = "Trop de niveaux de saut"; break; - case MSG_TOO_MANY_KEYS: p = "Trop de cl�s (%d)"; break; - case MSG_TO_BLK_IS_NULL: p = "To Blk est nul"; break; - case MSG_TRUNCATE_ERROR: p = "Erreur en troncation: %s"; break; - case MSG_TRUNC_BY_ESTIM: p = "Tronqu� par l'option Estimate"; break; - case MSG_TYPE_MISMATCH: p = "Cl� et source ne sont pas du m�me type"; break; - case MSG_TYPE_VALUE_ERR: p = "Colonne %s: disparit� type(%s)/valeur(%s)"; break; - case MSG_UNBALANCE_QUOTE: p = "Appostrophe en trop ligne %d"; break; - case MSG_UNDEFINED_AM: p = "COLBLK %s: m�thode d'acc�s ind�finie"; break; - case MSG_UNKNOWN_EXCPT: p = "Exception non r�pertori�e"; break; - case MSG_UNMATCH_FIL_ARG: p = "Argument de filtre d�pareill�"; break; - case MSG_UPDATE_ERROR: p = "Erreur en Update sur %s"; break; - case MSG_UPD_ZIP_NOT_IMP: p = "Mise � jour des tables ZDOS non encore implement�"; break; - case MSG_VALSTR_TOO_LONG: p = "Valeur %s trop longue pour une cha�ne de longueur %d"; break; - case MSG_VALTYPE_NOMATCH: p = "Disparit� types de valeur"; break; - case MSG_VALUE_ERROR: p = "Colonne %s: bloc valeur nul"; break; - case MSG_VALUE_TOO_BIG: p = "Valeur %lld trop grande pour la colonne %s"; break; - case MSG_VALUE_TOO_LONG: p = "Valeur %s trop longue pour la colonne %s de longueur %d"; break; - case MSG_VAL_ALLOC_ERR: p = "Allocation impossible du noeud valeur"; break; - case MSG_VIR_NO_DELETE: p = "Delete impossible sur les tables %s"; break; - case MSG_VIR_READ_ONLY: p = "Les tables virtuelles %s sont en lecture seulement"; break; - case MSG_VOID_FIRST_ARG: p = "Le premier argument ne doit pas �tre vide"; break; - case MSG_WORK_AREA: p = "Espace de travail: %s"; break; - case MSG_WRITE_SEEK_ERR: p = "Erreur de recherche en �criture: %s"; break; - case MSG_WRITE_STRERROR: p = "Erreur en �criture sur %s: %s"; break; - case MSG_WRITING: p = "Ecriture"; break; - case MSG_WRITING_ERROR: p = "Erreur � l'�criture de %s: %s"; break; - case MSG_WS_CONV_ERR: p = "Erreur de convertion de %s en WS"; break; - case MSG_XCOL_MISMATCH: p = "La colonne %s ne correspond pas � l'index"; break; - case MSG_XFILE_READERR: p = "Erreur %d en lisant le fichier index"; break; - case MSG_XFILE_WRITERR: p = "Erreur en �crivant le fichier index: %s"; break; - case MSG_XMLTAB_INIT_ERR: p = "Erreur d'initialisation de la table XML"; break; - case MSG_XML_INIT_ERROR: p = "Erreur d'initialisation du nouveau fichier XML"; break; - case MSG_XPATH_CNTX_ERR: p = "Le nouveau contexte XPath ne peut �tre cr��"; break; - case MSG_XPATH_EVAL_ERR: p = "Impossible d'�valuer l'emplacement xpath '%s'"; break; - case MSG_XPATH_NOT_SUPP: p = "Xpath non support� colonne %s"; break; diff --git a/storage/connect/frids.h b/storage/connect/frids.h deleted file mode 100644 index 561dbb6883722..0000000000000 --- a/storage/connect/frids.h +++ /dev/null @@ -1,46 +0,0 @@ - case IDS_TABLES: p = "Table Ent�tes"; break; - case IDS_TAB_01: p = "Catalogue"; break; - case IDS_TAB_02: p = "Sch�ma"; break; - case IDS_TAB_03: p = "Nom"; break; - case IDS_TAB_04: p = "Type"; break; - case IDS_TAB_05: p = "Remarque"; break; - case IDS_COLUMNS: p = "Colonne Ent�tes"; break; - case IDS_COL_01: p = "Cat_Table"; break; - case IDS_COL_02: p = "Schem_Table"; break; - case IDS_COL_03: p = "Nom_Table"; break; - case IDS_COL_04: p = "Nom_Colonne"; break; - case IDS_COL_05: p = "Type_Donn�es"; break; - case IDS_COL_06: p = "Nom_Type"; break; - case IDS_COL_07: p = "Pr�cision"; break; - case IDS_COL_08: p = "Longueur"; break; - case IDS_COL_09: p = "Echelle"; break; - case IDS_COL_10: p = "Base"; break; - case IDS_COL_11: p = "Nullifiable"; break; - case IDS_COL_12: p = "Remarques"; break; - case IDS_PKEY: p = "Cl� Ent�tes"; break; - case IDS_PKY_01: p = "Cat_Table"; break; - case IDS_PKY_02: p = "Schem_Table"; break; - case IDS_PKY_03: p = "Nom_Table"; break; - case IDS_PKY_04: p = "Nom_Colonne"; break; - case IDS_PKY_05: p = "Num�ro_Cl�"; break; - case IDS_PKY_06: p = "Nom_Cl�"; break; - case IDS_STAT: p = "Stat Ent�tes"; break; - case IDS_STA_01: p = "Table_Catalog"; break; - case IDS_STA_02: p = "Table_Schema"; break; - case IDS_STA_03: p = "Table_Name"; break; - case IDS_STA_04: p = "Non_Unique"; break; - case IDS_STA_05: p = "Index_Qualifier"; break; - case IDS_STA_06: p = "Index_Name"; break; - case IDS_STA_07: p = "Type"; break; - case IDS_STA_08: p = "Seq_in_Index"; break; - case IDS_STA_09: p = "Column_Name"; break; - case IDS_STA_10: p = "Collation"; break; - case IDS_STA_11: p = "Cardinality"; break; - case IDS_STA_12: p = "Pages"; break; - case IDS_STA_13: p = "Filter_Condition"; break; - case IDS_DRIVER: p = "Driver Ent�tes"; break; - case IDS_DRV_01: p = "Description"; break; - case IDS_DRV_02: p = "Attributs"; break; - case IDS_DSRC: p = "DataSrc Ent�tes"; break; - case IDS_DSC_01: p = "Nom"; break; - case IDS_DSC_02: p = "Description"; break; diff --git a/storage/connect/frmsg.h b/storage/connect/frmsg.h deleted file mode 100644 index d58779b948fe4..0000000000000 --- a/storage/connect/frmsg.h +++ /dev/null @@ -1,320 +0,0 @@ -#define MSG_ACCESS_VIOLATN "Violation acc�s m�moire" -#define MSG_ADD_BAD_TYPE "Ajout d'une valeur de type %s non conforme dans un tableau %s" -#define MSG_ALLOC_ERROR "Erreur d'allocation de %s" -#define MSG_ANSWER_TYPE "R�ponse de type" -#define MSG_API_CONF_ERROR "Erreur SQL: API_CONFORMANCE" -#define MSG_APPL_NOT_INIT "Application non initialis�e" -#define MSG_ARRAY_BNDS_EXCD "Hors limite de tableau" -#define MSG_BAD_ARRAY_OPER "Les tableaux doivent utiliser l'op�rateur IN" -#define MSG_BAD_ARRAY_TYPE "Type=%d invalide pour un tableau" -#define MSG_BAD_ARRAY_VAL "Les tableaux doivent avoir le m�me nombre de valeurs" -#define MSG_BAD_BIN_FMT "Format invalide %c pour la colonne BIN %s" -#define MSG_BAD_BLK_ESTIM "Nombre de blocs sup�rieur � l'estimation" -#define MSG_BAD_BLK_SIZE "Taille du bloc %d non conforme" -#define MSG_BAD_BYTE_NUM "Le nombre d'octets �crits est faux" -#define MSG_BAD_BYTE_READ "Le nombre d'octets lus est faux" -#define MSG_BAD_COL_TYPE "Type invalide %s pour la colonne %s" -#define MSG_BAD_COL_XPATH "Xpath invalide colonne %s de la table HTML %s" -#define MSG_BAD_CONST_TYPE "Type=%d invalide pour une constante" -#define MSG_BAD_CONV_TYPE "Convertion de type invalide %d" -#define MSG_BAD_DATETIME "Valeur date/temps invalide" -#define MSG_BAD_DBF_FILE "Le fichier DBF %s est alt�r�" -#define MSG_BAD_DBF_REC "Fichier DBF %s alt�r� enregistrement %d" -#define MSG_BAD_DBF_TYPE "Type DBF %c non support� colonne %s" -#define MSG_BAD_DIRECTORY "R�pertoire invalide %s: %s" -#define MSG_BAD_FIELD_RANK "Rang %d invalide pour la colonne %s" -#define MSG_BAD_FIELD_TYPE "Mauvais type de champ %s" -#define MSG_BAD_FILE_HANDLE "Handle de fichier invalide: %s" -#define MSG_BAD_FILTER "Mauvais filtre: Opc=%d B_T=%d %d Type=%d %d" -#define MSG_BAD_FILTER_CONV "Conversion filtre incorrecte, B_T=%d,%d" -#define MSG_BAD_FILTER_OP "Op�rateur de filtre invalide %d" -#define MSG_BAD_FLD_FORMAT "Format invalide pour le champs %d de %s" -#define MSG_BAD_FLD_LENGTH "Champs %s trop long (%s --> %d) ligne %d de %s" -#define MSG_BAD_FREQ_SET "Sp�cification erronn�e de Freq pour la colonne %s" -#define MSG_BAD_FUNC_MODE "%s: mode invalide %d" -#define MSG_BAD_HANDLE_VAL "Valeur Handle invalide" -#define MSG_BAD_HEADER "Fichier %s: bloc en-t�te alt�r�" -#define MSG_BAD_HEAD_END "Lecture fin d'en-t�te impossible" -#define MSG_BAD_INDEX_FILE "Fichier index %s corrompu" -#define MSG_BAD_LINEFLD_FMT "Format invalide ligne %d champs %d de %s" -#define MSG_BAD_LINE_LEN "Longueur ligne non �gale � Lrecl" -#define MSG_BAD_LRECL "Disparit� lrecl table/fichier (%d,%hd)" -#define MSG_BAD_NODE_TYPE "Type noeud erron� pour la table" -#define MSG_BAD_OFFSET_VAL "Nul offset invalide pour une table CSV" -#define MSG_BAD_OPEN_MODE "Mode d'ouverture invalide %d" -#define MSG_BAD_PARAM_TYPE "%.8s: Param�tre de type=%d invalide" -#define MSG_BAD_PARM_COUNT "Nombre de param�tres incoh�rent" -#define MSG_BAD_QUOTE_FIELD "Quote manquante dans %s champs %d ligne %d" -#define MSG_BAD_READ_NUMBER "Mauvais nombre %d de valeurs lues dans %s" -#define MSG_BAD_RECFM "Recfm type %d invalide pour DOSCOL" -#define MSG_BAD_RECFM_VAL "Valeur invalide %d de Recfm" -#define MSG_BAD_SET_CASE "La casse d'un tableau ne peut pas passer de non respect � respecter" -#define MSG_BAD_SET_STRING "SetValue: appel invalide pour STRING" -#define MSG_BAD_SPECIAL_COL "Colonne sp�ciale invalide %s" -#define MSG_BAD_SPEC_COLUMN "Colonne sp�ciale invalide pour ce type de table" -#define MSG_BAD_TABLE_TYPE "Type invalide %s pour la table %s" -#define MSG_BAD_TYPE_LIKE "Type(%d)= %d invalide pour LIKE" -#define MSG_BAD_VALBLK_INDX "Valeur hors limites de l'index du bloc de valeurs" -#define MSG_BAD_VALBLK_TYPE "Type=%d invalide pour un bloc de valeurs" -#define MSG_BAD_VALNODE "Type %d invalide pour le noeud valeur colonne %s" -#define MSG_BAD_VALUE_TYPE "Type de valeur invalide %d" -#define MSG_BAD_VAL_UPDATE "Impossible de d�terminer quelle valeur %s doit �tre mise � jour" -#define MSG_BAS_NS_LIST "Format invalide de la liste des espace-noms" -#define MSG_BIN_F_TOO_LONG "Valeur trop longue pour le champ %s (%d --> %d)" -#define MSG_BIN_MODE_FAIL "Echec mode binaire: %s" -#define MSG_BLKTYPLEN_MISM "Disparit� types/longueurs de bloc dans SetValue" -#define MSG_BLK_IS_NULL "Blk est nul" -#define MSG_BREAKPOINT "Point de contr�le" -#define MSG_BUILD_INDEX "Construction index %s sur %s" -#define MSG_CANNOT_OPEN "Ouverture impossible de %s" -#define MSG_CHSIZE_ERROR "Erreur dans chsize: %s" -#define MSG_COL_ALLOC_ERR "Allocation impossible du noeud colonne" -#define MSG_COL_ISNOT_TABLE "La colonne %s n'est pas dans la table %s" -#define MSG_COL_NOT_SORTED "La colonne %s de la table %s n'est pas tri�e" -#define MSG_COL_NUM_MISM "Disparit� du nombre de colonnes" -#define MSG_COM_ERROR "Erreur Com" -#define MSG_CONCAT_SUBNODE "Concat�nation de sous-noeuds impossible" -#define MSG_CONNECT_CANCEL "Connection interrompue par l'utilisateur" -#define MSG_CONTROL_C_EXIT "Exit par Ctrl-C" -#define MSG_DATABASE_LOADED "Base de donn�es %s charg�e" -#define MSG_DATA_MISALIGN "Mauvais alignement pour ce type de donn�es" -#define MSG_DBASE_FILE "Fichier dBASE dbf: " -#define MSG_DEF_ALLOC_ERROR "Erreur d'allocation de la classe DEF %s" -#define MSG_DEL_FILE_ERR "Erreur � l'effacement de %s" -#define MSG_DEL_READ_ERROR "Delete: erreur en lecture req=%d len=%d" -#define MSG_DEL_WRITE_ERROR "Delete: erreur en �criture: %s" -#define MSG_DEPREC_FLAG "Option Flag p�rim�e, utiliser Coltype" -#define MSG_DLL_LOAD_ERROR "Erreur %d au chargement du module %s" -#define MSG_DOM_NOT_SUPP "MS-DOM non support� par cette version" -#define MSG_DVAL_NOTIN_LIST "Valeur %s non trouv�e dans la liste des valeurs distinctes de la colonne %s" -#define MSG_EMPTY_DOC "Document vide" -#define MSG_EMPTY_FILE "%s du fichier vide %s: " -#define MSG_EOF_AFTER_LINE "Fin de fichier apr�s la ligne %d" -#define MSG_EOF_INDEX_FILE "EOF lisant le fichier index" -#define MSG_ERROR_IN_LSK "Erreur %d dans lseek64" -#define MSG_ERROR_IN_SFP "Erreur %d dans SetFilePointer" -#define MSG_ERR_READING_REC "Erreur lisant l'enregistrement %d de %s" -#define MSG_FAIL_ADD_NODE "L'ajout du noeud %s dans la table a �chou�" -#define MSG_FETCH_NO_RES "Fetch: Pas de R�sultats" -#define MSG_FIELD_TOO_LONG "Valeur trop longue pour le champs %d ligne %d" -#define MSG_FILELEN_ERROR "Erreur dans %s pour %s" -#define MSG_FILE_IS_EMPTY "Le fichier %s est vide" -#define MSG_FILE_MAP_ERR "Erreur de File mapping" -#define MSG_FILE_MAP_ERROR "CreateFileMapping %s erreur rc=%d" -#define MSG_FILE_OPEN_YET "Fichier %s d�j� ouvert" -#define MSG_FILE_UNFOUND "Fichier %s non trouv�" -#define MSG_FLD_TOO_LNG_FOR "Champs %d trop long pour %s ligne %d de %s" -#define MSG_FLT_BAD_RESULT "Virgule flottante: r�sultat inexacte" -#define MSG_FLT_DENORMAL_OP "Op�rande virgule flottante non normalis�" -#define MSG_FLT_INVALID_OP "Op�ration virgule flottante invalide" -#define MSG_FLT_OVERFLOW "D�passement de capacit� virgule flottante" -#define MSG_FLT_STACK_CHECK "Virgule flottante: Erreur de la pile" -#define MSG_FLT_UNDERFLOW "Sous-d�passement de capacit� virgule flottante" -#define MSG_FLT_ZERO_DIVIDE "Virgule flottante: division par z�ro" -#define MSG_FMT_WRITE_NIY "L'�criture des fichiers %s n'est pas encore impl�ment�e" -#define MSG_FOXPRO_FILE "Fichier FoxPro: " -#define MSG_FPUTS_ERROR "Erreur dans fputs: %s" -#define MSG_FSEEK_ERROR "Erreur dans fseek: %s" -#define MSG_FSETPOS_ERROR "Erreur dans fseek pour i=%d" -#define MSG_FTELL_ERROR "Erreur dans ftell enregistrement=%d: %s" -#define MSG_FUNCTION_ERROR "Erreur dans %s: %d" -#define MSG_FUNC_ERRNO "Erreur %d dans %s" -#define MSG_FUNC_ERROR "Erreur dans %s" -#define MSG_FUNC_ERR_S "Erreur dans %s: %s" -#define MSG_FWRITE_ERROR "Erreur dans fwrite: %s" -#define MSG_GET_DIST_VALS "R�cup�ration des valeurs distinctes de " -#define MSG_GET_FUNC_ERR "Erreur en recherche de la fonction %s: %s" -#define MSG_GLOBAL_ERROR "Erreur d'allocation de Global (taille=%d)\n" -#define MSG_GUARD_PAGE "Violation de page de garde" -#define MSG_GZOPEN_ERROR "gzopen %s: erreur %d sur %s" -#define MSG_ILLEGAL_INSTR "Instruction ill�gale" -#define MSG_ILL_FILTER_CONV "Conversion implicite ill�gale dans un filtre" -#define MSG_INDEX_NOT_UNIQ "L'index n'est pas Unique" -#define MSG_INDEX_YET_ON "L'index %s existe d�j� sur %s" -#define MSG_INDX_COL_NOTIN "La colonne index %s n'existe pas dans la table %s" -#define MSG_INDX_EXIST_YET "L'entr�e index existe d�j�" -#define MSG_INIT_FAILED "L'initialisation de %s a �chou�" -#define MSG_INT_COL_ERROR "Erreur interne sur la colonne index %s" -#define MSG_INT_OVERFLOW "D�passement de capacit� sur entier" -#define MSG_INT_ZERO_DIVIDE "Division enti�re par z�ro" -#define MSG_INVALID_DISP "Disposition invalide" -#define MSG_INVALID_FTYPE "SBV: Ftype %d invalide" -#define MSG_INVALID_HANDLE "Poign�e invalide" -#define MSG_INVALID_OPER "Op�rateur invalide %d pour %s" -#define MSG_INV_COLUMN_TYPE "Type %d Invalide pour la colonne %s" -#define MSG_INV_COL_TYPE "Type de colonne %s invalide" -#define MSG_INV_DEF_READ "Lecture diff�r�e invalide rc=%d" -#define MSG_INV_DIRCOL_OFST "Offset invalide pour une colonne DIR" -#define MSG_INV_MAP_POS "Position m�moire invalide" -#define MSG_INV_RAND_ACC "L'acc�s al�atoire d'une table non optimis�e est impossible" -#define MSG_INV_REC_POS "Position d'enregistrement invalide" -#define MSG_INV_RESULT_TYPE "Type de r�sultat invalide %s" -#define MSG_INV_UPDT_TABLE "Table %s invalide pour Update" -#define MSG_IN_WITHOUT_SUB "IN ou EXISTS sans tableau ou subquery" -#define MSG_KEY_ALLOC_ERR "Erreur d'allocation d'un bloc offset cl�" -#define MSG_KEY_ALLOC_ERROR "Erreur d'allocation m�moire, Klen=%d n=%d" -#define MSG_LINE_TOO_LONG "La nouvelle ligne est trop longue" -#define MSG_LIST "--Liste--" -#define MSG_LOADING_FAILED "Le chargement de %s a �chou�" -#define MSG_LRECL_TOO_SMALL "Lrecl trop petit (longueur en-t�te = %d)" -#define MSG_MAKE_EMPTY_FILE "G�n�ration du fichier vide %s: %s" -#define MSG_MAKING "G�n�ration" -#define MSG_MALLOC_ERROR "Allocation m�moire impossible par %s" -#define MSG_MAP_VIEW_ERROR "MapViewOfFile %s erreur rc=%d" -#define MSG_MAXSIZE_ERROR "Maxsize incalculable sur table ouverte" -#define MSG_MEM_ALLOC_ERR "Erreur d'allocation m�moire, taille %s = %d" -#define MSG_MEM_ALLOC_ERROR "Erreur d'allocation m�moire" -#define MSG_MISPLACED_QUOTE "Appostrophe mal plac�e ligne %d" -#define MSG_MISSING_ARG "Argument manquant pour l'op�rateur %d" -#define MSG_MISSING_FIELD "Champs %d manquant dans %s ligne %d" -#define MSG_MISSING_FNAME "Nom du fichier manquant" -#define MSG_MISSING_NODE "Noeud %s manquant dans %s" -#define MSG_MISSING_ROWNODE "Impossible de trouver le noeud de la ligne %d" -#define MSG_MIS_TAG_LIST "Liste des balises colonne manquante" -#define MSG_MUL_MAKECOL_ERR "Erreur logique dans TABMUL::MakeCol" -#define MSG_NAME_CONV_ERR "Erreur de convertion du nom de noeud" -#define MSG_NEW_DOC_FAILED "Impossible de cr�er le nouveau document" -#define MSG_NEW_RETURN_NULL "NULL renvoy� par New dans PlugEvalLike" -#define MSG_NEXT_FILE_ERROR "Erreur en recherche du fichier suivant. rc=%s" -#define MSG_NONCONT_EXCEPT "Exception non-continuable" -#define MSG_NOP_ZLIB_INDEX "L'indexage d'une table zlib non optimis�e est impossible" -#define MSG_NOT_A_DBF_FILE "Le fichier n'a pas le format dBASE dbf " -#define MSG_NOT_FIXED_LEN "Fichier %s non fixe, len=%d lrecl=%d" -#define MSG_NO_0DH_HEAD "0DH manquant en fin d'en-t�te (dbc=%d)" -#define MSG_NO_ACTIVE_DB "Pas de base de donn�es active" -#define MSG_NO_CHAR_FROM "Conversion de type %d en caract�res impossible" -#define MSG_NO_DATE_FMT "Pas de format date pour le valblock de type %d" -#define MSG_NO_DEF_FNCCOL "Colonne fonction par d�faut introuvable" -#define MSG_NO_DEF_PIVOTCOL "Colonne pivot par d�faut introuvable" -#define MSG_NO_DIR_INDX_RD "Pas d'acc�s directe des tables %s" -#define MSG_NO_FEAT_SUPPORT "%s non support� dans cette version" -#define MSG_NO_FLD_FORMAT "Format absent pour le champs %d de %s" -#define MSG_NO_FORMAT_COL "Type COLUMN informattable" -#define MSG_NO_FORMAT_TYPE "Le format ne peut pas �tre d�fini � partir du type %d" -#define MSG_NO_INDEX_READ "Pas d'acc�s directe des tables multiples" -#define MSG_NO_KEY_COL "Pas de colonne cl� trouv�e" -#define MSG_NO_KEY_UPDATE "Le nom des cl�s ne peut pas �tre modifi�" -#define MSG_NO_MAP_INSERT "MAP incompatible avec Insert" -#define MSG_NO_MATCHING_COL "Pas de colonne correspondant � %s dans %s" -#define MSG_NO_MATCH_COL "Colonne correspondante introuvable" -#define MSG_NO_MEMORY "M�moire pleine" -#define MSG_NO_MODE_PADDED "Mode non support� pour les fichiers 'padded'" -#define MSG_NO_MUL_VCT "Les tables VCT ne peuvent pas �tre multiples" -#define MSG_NO_ODBC_DELETE "Delete ne devrait pas �tre appel� pour les tables ODBC" -#define MSG_NO_ODBC_DIRECT "Acc�s directe des tables ODBC non encore impl�ment�" -#define MSG_NO_ODBC_MUL "Multiple(2) non support� pour les tables ODBC" -#define MSG_NO_ODBC_SPECOL "Pas de colonne sp�ciale ODBC" -#define MSG_NO_PART_DEL "Delete partiel des fichier %s impossible" -#define MSG_NO_PART_MAP "Mapping partiel non impl�ment� pour cet OS" -#define MSG_NO_PAR_BLK_INS "Insertion de bloc partiel impossible" -#define MSG_NO_PIV_DIR_ACC "Pas d'acc�s directe aux tables PIVOT" -#define MSG_NO_READ_32 "Lecture de 32 octets impossible" -#define MSG_NO_RECOV_SPACE "Espace non recouvrable dans le fichier index" -#define MSG_NO_ROWID_FOR_AM "Acc�s direct impossible de ROWID pour les tables de type %s" -#define MSG_NO_ROW_NODE "Le nom du Rownode n'est pas d�fini" -#define MSG_NO_SECTION_NAME "Nom de section manquant" -#define MSG_NO_SEC_UPDATE "Les noms de section ne peuvent pas �tre modifi�s" -#define MSG_NO_SETPOS_YET "SetPos pas encore impl�ment� pour les fichier %s" -#define MSG_NO_SPEC_COL "Pas de colonne sp�ciales MYSQL" -#define MSG_NO_SUB_VAL "Pas de sous-value d'un tableau de type %d" -#define MSG_NO_TABCOL_DATA "Pas de donn�es pour la table %s colonne %s" -#define MSG_NO_TABLE_DEL "Delete non autoris� pour les tables %s " -#define MSG_NO_TAB_DATA "Pas de donn�es pour la table %s" -#define MSG_NO_VCT_DELETE "D�l�tion Partielle non impl�ment�e pour les fichiers VCT" -#define MSG_NO_ZIP_DELETE "Delete sur fichier Zip non encore implement�" -#define MSG_OPENING "Ouverture" -#define MSG_OPEN_EMPTY_FILE "Ouverture du fichier vide %s: %s" -#define MSG_OPEN_ERROR "Erreur d'ouverture %d en mode %d sur %s: " -#define MSG_OPEN_ERROR_IS "Erreur � l'ouverture de %s: %s" -#define MSG_OPEN_MODE_ERROR "Erreur d'ouverture(%s) %d sur %s" -#define MSG_OPEN_STRERROR "Erreur � l'ouverture: %s" -#define MSG_OPTBLK_RD_ERR "Erreur � la lecture d'un bloc optimisation: %s" -#define MSG_OPTBLK_WR_ERR "Erreur � l'�criture d'un bloc optimisation: %s" -#define MSG_OPTIMIZING "Optimisation de " -#define MSG_OPT_BMAP_RD_ERR "Erreur en lecture des bitmaps d'optimisation: %s" -#define MSG_OPT_BMAP_WR_ERR "Erreur en �criture des bitmaps d'optimisation: %s" -#define MSG_OPT_CANCELLED "Optimisation interrompue par l'utilisateur" -#define MSG_OPT_DVAL_RD_ERR "Erreur en lecture des valeurs distinctes: %s" -#define MSG_OPT_DVAL_WR_ERR "Erreur en �criture des valeurs distinctes: %s" -#define MSG_OPT_HEAD_RD_ERR "Erreur en lecture de l'ent�te du fichier opt: %s" -#define MSG_OPT_HEAD_WR_ERR "Erreur en �criture de l'ent�te du fichier opt: %s" -#define MSG_OPT_LOGIC_ERR "Erreur logique dans SetBitmap, i=%d" -#define MSG_OPT_MAX_RD_ERR "Erreur en lecture des valeurs maxi: %s" -#define MSG_OPT_MAX_WR_ERR "Erreur en �criture des valeurs maxi: %s" -#define MSG_OPT_MIN_RD_ERR "Erreur en lecture des valeurs mini: %s" -#define MSG_OPT_MIN_WR_ERR "Erreur en �criture des valeurs mini: %s" -#define MSG_OPT_NOT_MATCH "Le fichier opt %s n'est pas � jour" -#define MSG_PAGE_ERROR "Erreur de pagination" -#define MSG_PARM_CNT_MISS "Disparit� du nombre de Param�tres" -#define MSG_PREC_VBLP_NULL "ARRAY SetPrecision: Vblp est NULL" -#define MSG_PRIV_INSTR "Instruction privil�gi�e" -#define MSG_PROCADD_ERROR "Erreur %d sur l'adresse de %s" -#define MSG_QUERY_CANCELLED "Requ�te interrompue par l'utilisateur" -#define MSG_RANGE_NO_JOIN "Range non compatible avec les index de jointure" -#define MSG_RC_READING "rc=%d en lecture de la table %s" -#define MSG_READY "Pr�t" -#define MSG_READ_ERROR "Erreur en lecture sur %s: %s" -#define MSG_READ_ONLY "Cette table prot�g�e en lecture seule ne peut �tre modifi�e" -#define MSG_READ_SEEK_ERROR "Erreur de recherche en lecture: %s" -#define MSG_REGISTER_ERR "Enregistrement NS impossible, pr�fix='%s' et href='http://github.com/%s'" -#define MSG_REMOVE_ERROR "Erreur en supprimant %s: %s" -#define MSG_RENAME_ERROR "Erreur renommant %s en %s: %s" -#define MSG_ROWID_NOT_IMPL "RowNumber non impl�ment� pour les tables de type %s" -#define MSG_SEC_KEY_FIRST "Les sections et cl�s doivent �tre ins�r�es en premier" -#define MSG_SEC_NAME_FIRST "Le nom de section doit �tre en t�te de liste en insertion" -#define MSG_SEP_IN_FIELD "Le champ %d contient le caract�re s�parateur" -#define MSG_SEQUENCE_ERROR "HSTMT: Allocation hors s�quence" -#define MSG_SETEOF_ERROR "Erreur %d dans SetEndOfFile" -#define MSG_SETRECPOS_NIY "SetRecpos non impl�ment� pour ce type de table" -#define MSG_SET_STR_TRUNC "SetValue: Cha�ne de caract�res tronqu�e" -#define MSG_SFP_ERROR "Erreur sur SetFilePointer: %s" -#define MSG_SHARED_LIB_ERR "Erreur au chargement de la librairie partag�e %s: %s" -#define MSG_SINGLE_STEP "Pas � pas" -#define MSG_SORTING_VAL "Tri de %d valeurs" -#define MSG_SPCOL_READONLY "La colonne sp�ciale %s est en lecture seulement" -#define MSG_SQL_CONF_ERROR "Erreur SQL: SQL_CONFORMANCE" -#define MSG_SRCH_CLOSE_ERR "Erreur � la fermeture de l'Handle de recherche" -#define MSG_SRC_TABLE_UNDEF "La table source n'est pas d�finie" -#define MSG_STACK_OVERFLOW "D�passement de capacit� de la pile" -#define MSG_TABDIR_READONLY "Les tables DIR sont en lecture seulement" -#define MSG_TABLE_NOT_OPT "Table non optimisable" -#define MSG_TABLE_NO_INDEX "La table %s n'est pas indexable" -#define MSG_TABLE_READ_ONLY "Les tables %s sont en lecture seulement " -#define MSG_TABMUL_READONLY "Les tables multiples sont en lecture seulement" -#define MSG_TOO_MANY_FIELDS "Trop de champs ligne %d de %s" -#define MSG_TOO_MANY_JUMPS "Trop de niveaux de saut" -#define MSG_TOO_MANY_KEYS "Trop de cl�s (%d)" -#define MSG_TO_BLK_IS_NULL "To Blk est nul" -#define MSG_TRUNCATE_ERROR "Erreur en troncation: %s" -#define MSG_TRUNC_BY_ESTIM "Tronqu� par l'option Estimate" -#define MSG_TYPE_MISMATCH "Cl� et source ne sont pas du m�me type" -#define MSG_TYPE_VALUE_ERR "Colonne %s: disparit� type(%s)/valeur(%s)" -#define MSG_UNBALANCE_QUOTE "Appostrophe en trop ligne %d" -#define MSG_UNDEFINED_AM "COLBLK %s: m�thode d'acc�s ind�finie" -#define MSG_UNKNOWN_EXCPT "Exception non r�pertori�e" -#define MSG_UNMATCH_FIL_ARG "Argument de filtre d�pareill�" -#define MSG_UPDATE_ERROR "Erreur en Update sur %s" -#define MSG_UPD_ZIP_NOT_IMP "Mise � jour des tables ZDOS non encore implement�" -#define MSG_VALSTR_TOO_LONG "Valeur %s trop longue pour une cha�ne de longueur %d" -#define MSG_VALTYPE_NOMATCH "Disparit� types de valeur" -#define MSG_VALUE_ERROR "Colonne %s: bloc valeur nul" -#define MSG_VALUE_TOO_BIG "Valeur %lld trop grande pour la colonne %s" -#define MSG_VALUE_TOO_LONG "Valeur %s trop longue pour la colonne %s de longueur %d" -#define MSG_VAL_ALLOC_ERR "Allocation impossible du noeud valeur" -#define MSG_VIR_NO_DELETE "Delete impossible sur les tables %s" -#define MSG_VIR_READ_ONLY "Les tables virtuelles %s sont en lecture seulement" -#define MSG_VOID_FIRST_ARG "Le premier argument ne doit pas �tre vide" -#define MSG_WORK_AREA "Espace de travail: %s" -#define MSG_WRITE_SEEK_ERR "Erreur de recherche en �criture: %s" -#define MSG_WRITE_STRERROR "Erreur en �criture sur %s: %s" -#define MSG_WRITING "Ecriture" -#define MSG_WRITING_ERROR "Erreur � l'�criture de %s: %s" -#define MSG_WS_CONV_ERR "Erreur de convertion de %s en WS" -#define MSG_XCOL_MISMATCH "La colonne %s ne correspond pas � l'index" -#define MSG_XFILE_READERR "Erreur %d en lisant le fichier index" -#define MSG_XFILE_WRITERR "Erreur en �crivant le fichier index: %s" -#define MSG_XMLTAB_INIT_ERR "Erreur d'initialisation de la table XML" -#define MSG_XML_INIT_ERROR "Erreur d'initialisation du nouveau fichier XML" -#define MSG_XPATH_CNTX_ERR "Le nouveau contexte XPath ne peut �tre cr��" -#define MSG_XPATH_EVAL_ERR "Impossible d'�valuer l'emplacement xpath '%s'" -#define MSG_XPATH_NOT_SUPP "Xpath non support� colonne %s" diff --git a/storage/connect/frmsg1.h b/storage/connect/frmsg1.h deleted file mode 100644 index e88440a3a9c29..0000000000000 --- a/storage/connect/frmsg1.h +++ /dev/null @@ -1,1013 +0,0 @@ -#define MSG_ACCESS_VIOLATN "Violation acc�s m�moire" -#define MSG_ACT_ALLOC_FAIL "PlugInitLang: Erreur d'allocation du bloc Activity" -#define MSG_ADDVAL_ERROR "Erreur %d dans AddValue" -#define MSG_ADD_BAD_TYPE "Ajout d'une valeur de type %s non conforme dans un tableau %s" -#define MSG_ADD_NULL_DOM "Ajout de la cha�ne %s � un domaine nul" -#define MSG_ADPOS_IN_DICTP "ADPOS au travail dans User_Dictp" -#define MSG_AFTER " apr�s: " -#define MSG_ALG_CHOICE_AUTO "Le choix du meilleur algorithme est automatique" -#define MSG_ALG_CHOICE_BAD "Choix d'algorithme invalide, remis � AUTO" -#define MSG_ALG_CHOICE_QRY "Utilise l'algorithme 'Query'" -#define MSG_ALG_CURLY_BRK "Le choix de l'algorithme d�pend des accolades externes" -#define MSG_ALLOC_ERROR "Erreur d'allocation de %s" -#define MSG_ALL_DELETED "Toutes les lignes enlev�es en %.2lf sec" -#define MSG_ALTER_DB_ERR "Impossible de d�terminer la base de donn�es � modifier" -#define MSG_AMBIG_COL_QUAL "Qualificateur ambigu %s pour la colonne %s" -#define MSG_AMBIG_CORREL "Select %s.* corr�lation ambigue" -#define MSG_AMBIG_SPEC_COL "Colonne sp�ciale ambigu� %s" -#define MSG_ANSWER_TYPE "R�ponse de type" -#define MSG_API_CONF_ERROR "Erreur SQL: API_CONFORMANCE" -#define MSG_APPL_ACCESSIBLE "Application %s accessible" -#define MSG_APPL_ACTIVE "Application %s encore active" -#define MSG_APPL_BAD_SAVE "Application %s partiellement sauvegard�e" -#define MSG_APPL_CREATED "Application %s cr�e" -#define MSG_APPL_IS_ACTIVE "Application d�j� active" -#define MSG_APPL_NOT_INIT "Application non initialis�e" -#define MSG_APPL_NOT_LOADED "Application non charg�e" -#define MSG_APPL_QUIT "Fin de l'application %s" -#define MSG_APPL_SAVED "Application %s sauvegard�e" -#define MSG_APP_STILL_ACTIV "Application du langage %s encore active (non lib�rable)" -#define MSG_AREAFILE_NOTFND "Fichier Area introuvable" -#define MSG_ARGS_SYNTAX_ERR "?SetArgs erreur de syntaxe: %s inattendu apr�s %s" -#define MSG_ARG_ALREADY_SET "Argument %d d�j� allou�" -#define MSG_ARG_NOT_AN_ATTR "L'argument n'est pas un attribut (type %d erron�)" -#define MSG_ARG_OUT_CONTEXT "Argument de type @ utilis� hors contexte" -#define MSG_ARG_OUT_RANGE "Argument de phrase valant %d hors limite" -#define MSG_ARG_PTR_NOSEM "Argument valant %d pointe sur un noeud sans Sem" -#define MSG_ARG_PTR_NOSEMS "Argument valant %d pointe sur un noeud sans s�mantique" -#define MSG_ARG_REF_LOOP "?Bouclage entre r�f�rences crois�es des arguments" -#define MSG_ARG_TWO_CONST "Le 2�me argument de %s doit �tre constant" -#define MSG_ARRAY_ALLOC_ERR "Erreur d'allocation m�moire dans ARRAY" -#define MSG_ARRAY_BNDS_EXCD "Hors limite de tableau" -#define MSG_ARRAY_ERROR "Erreur de fonctionnement k=%d n=%d" -#define MSG_ATTRIBUTE_ERROR "Erreur r�gle %u attribut %s: " -#define MSG_ATT_NOT_CASE "Mauvaise valeur %d pour attribut (pas une CaseValue)" -#define MSG_ATT_POSCODE_BIG "Code attribut %d trop grand (max=%d)" -#define MSG_AVGLEN_ERROR "avglen doit �tre entre %d et %d" -#define MSG_BAD_AGGREG_FUNC "Fonction aggr�g�e %d non support�e" -#define MSG_BAD_ARGTYPES "Argument de type invalide pour %s" -#define MSG_BAD_ARGUMENTS "Argument not attach�s pour %s" -#define MSG_BAD_ARG_NUM "Nombre d'arguments invalide %d" -#define MSG_BAD_ARG_TYPE "Type d'argument %d invalide" -#define MSG_BAD_ARRAY_OPER "Les tableaux doivent utiliser l'op�rateur IN" -#define MSG_BAD_ARRAY_TYPE "Type=%d invalide pour un tableau" -#define MSG_BAD_ARRAY_VAL "Les tableaux doivent avoir le m�me nombre de valeurs" -#define MSG_BAD_BIN_FMT "Format invalide %c pour la colonne BIN %s" -#define MSG_BAD_BLK_ESTIM "Nombre de blocs sup�rieur � l'estimation" -#define MSG_BAD_BLK_SIZE "Taille du bloc %d non conforme" -#define MSG_BAD_BYTE_NUM "Le nombre d'octets �crits est faux" -#define MSG_BAD_BYTE_READ "Le nombre d'octets lus est faux" -#define MSG_BAD_CARDINALITY "Appel invalide de Cardinality pour une table multiple" -#define MSG_BAD_CASE_SPEC "Min/Maj: sp�cification %c incorrecte, recommencez: " -#define MSG_BAD_CHAR_SPEC "Sp�cification '%s' invalide pour caract�re" -#define MSG_BAD_CHECK_TYPE "Sous-type %d invalide pour CheckColumn" -#define MSG_BAD_CHECK_VAL "Valeur pour Check invalide '%s'" -#define MSG_BAD_COLCRT_ARG "COLCRT: Arg invalide (type=%hd, domain=%hd)" -#define MSG_BAD_COLDEF_TYPE "Coldefs: type ill�gal %d" -#define MSG_BAD_COLIST_ITEM "El�ment invalide dans une Colist" -#define MSG_BAD_COLIST_TYPE "Mauvais type=%d pour une Colist" -#define MSG_BAD_COLSIZE "Colsize %d trop petit pour cette base de donn�es" -#define MSG_BAD_COL_ENTRY "Entr�e invalide pour la colonne %s" -#define MSG_BAD_COL_FORMAT "Type de formattage %d invalide pour une colonne" -#define MSG_BAD_COL_IN_FILT "Colonne incorrecte dans un filtre" -#define MSG_BAD_COL_QUALIF "Qualificateur invalide %s pour la colonne %s" -#define MSG_BAD_COL_TYPE "Type invalide %s pour la colonne %s" -#define MSG_BAD_COL_XPATH "Xpath invalide colonne %s de la table HTML %s" -#define MSG_BAD_COMPARE_OP "Op�rateur de comparaison %d invalide" -#define MSG_BAD_CONST_TYPE "Type=%d invalide pour une constante" -#define MSG_BAD_CONV_TYPE "Convertion de type invalide %d" -#define MSG_BAD_CORREL "Select %s.* corr�lation absente" -#define MSG_BAD_DATETIME "Valeur date/temps invalide" -#define MSG_BAD_DATE_OPER "Op�rateur de date inattendu %d" -#define MSG_BAD_DBF_FILE "Le fichier DBF %s est alt�r�" -#define MSG_BAD_DBF_REC "Fichier DBF %s alt�r� enregistrement %d" -#define MSG_BAD_DBF_TYPE "Type DBF %c non support�" -#define MSG_BAD_DEF_ARG "Argument invalide pour INDEXDEF (type=%hd, domain=%hd)" -#define MSG_BAD_DEF_READ "EOF inattendue en lecture diff�r�e" -#define MSG_BAD_DEF_TYPE "Type de colonne invalide" -#define MSG_BAD_DIRECTORY "R�pertoire invalide %s: %s" -#define MSG_BAD_DIST_JN_FIL "Filtre de jointure distincte invalide" -#define MSG_BAD_DIST_JOIN "Sp�cification invalide de jointure distincte" -#define MSG_BAD_DOM_COL_DEF "D�finition de colonnes invalide pour un domaine" -#define MSG_BAD_DOM_VALUE "La valeur %d n'appartient pas au domaine" -#define MSG_BAD_EDIT_INIT "Coparm: �dition %s initialis�e improprement" -#define MSG_BAD_EVAL_TYPE "Fonction scalaire de type=%d invalide" -#define MSG_BAD_EXEC_MODE "Mode d'ex�cution invalide '%s'" -#define MSG_BAD_EXP_ARGTYPE "Argument de type %d invalide pour une expression" -#define MSG_BAD_EXP_OPER "Op�rateur=%d invalide pour expression" -#define MSG_BAD_FETCH_RC "Code retour inattendu de Fetch %d" -#define MSG_BAD_FIELD_FMT "Format de champ invalide %c pour %s" -#define MSG_BAD_FIELD_RANK "Rang %d invalide pour la colonne %s" -#define MSG_BAD_FIELD_TYPE "Mauvais type de champ %s" -#define MSG_BAD_FILE_HANDLE "Handle de fichier invalide: %s" -#define MSG_BAD_FILE_LIST "La section liste de fichiers est erron�e" -#define MSG_BAD_FILTER "Mauvais filtre: Opc=%d B_T=%d %d Type=%d %d" -#define MSG_BAD_FILTER_CONV "Conversion filtre incorrecte, B_T=%d,%d" -#define MSG_BAD_FILTER_LINK "Op�rateur de cha�nage ill�gal %d" -#define MSG_BAD_FILTER_OP "Op�rateur de filtre invalide %d" -#define MSG_BAD_FILTEST_OP "Op�rateur invalide %d %d pour FilTest" -#define MSG_BAD_FLD_FORMAT "Format invalide pour le champs %d de %s" -#define MSG_BAD_FLD_LENGTH "Champs %s trop long (%s --> %d) ligne %d de %s" -#define MSG_BAD_FLOAT_CONV "Convertion invalide d'un tableau flottant" -#define MSG_BAD_FPARM_NEXT "Coparm: FPARM avec Next non nul" -#define MSG_BAD_FREQ_SET "Sp�cification erronn�e de Freq pour la colonne %s" -#define MSG_BAD_FUNC_ARG "Funcarg de type %d non impl�ment�" -#define MSG_BAD_FUNC_ARGTYP "Mauvais type d'argument=%d pour une fonction" -#define MSG_BAD_FUNC_MODE "%s: mode invalide %d" -#define MSG_BAD_GENRE "Genre est invalide" -#define MSG_BAD_GETVIEW_RET "GetView: type de retour %d invalide" -#define MSG_BAD_HANDLE_VAL "Valeur Handle invalide" -#define MSG_BAD_HAV_FILTER "Filtre Having sur une requ�te non group�e" -#define MSG_BAD_HAV_FILTYPE "Filtre invalide pour clause Having" -#define MSG_BAD_HEADER "Fichier %s: bloc en-t�te alt�r�" -#define MSG_BAD_HEADER_VAL "Valeur invalide pour Header" -#define MSG_BAD_HEAD_END "Lecture fin d'en-t�te impossible" -#define MSG_BAD_INDEX_COL "Colonne %s invalide pour index %s" -#define MSG_BAD_INDEX_DEF "D�finition invalide pour index %s" -#define MSG_BAD_INDEX_FILE "Fichier index %s corrompu" -#define MSG_BAD_INDEX_PART "D�finition colonne invalide pour index %s" -#define MSG_BAD_INPUT "Entr�e incorrecte" -#define MSG_BAD_IN_ARGTYPE "Argument de type invalide pour l'op�rateur IN" -#define MSG_BAD_IN_ENDING "Erreur: fin de cha�ne IN invalide" -#define MSG_BAD_IN_STRING "La cha�ne IN commence ou finie par des caract�res invalides %c ... %c" -#define MSG_BAD_JCOL_TYPE "Erreur logique JCT: disparit� des types colonnes" -#define MSG_BAD_JOIN_EXP "Expression invalide pour une jointure" -#define MSG_BAD_JOIN_FILTER "Filtre de jointure invalide" -#define MSG_BAD_JOIN_OP "Op�rateur de joint invalide %d" -#define MSG_BAD_LANG_SIZE "Le fichier langage a une mauvaise taille %d" -#define MSG_BAD_LINEFLD_FMT "Format invalide ligne %d champs %d de %s" -#define MSG_BAD_LINE_LEN "Longueur ligne non �gale � Lrecl" -#define MSG_BAD_LIST_TYPE "Type de liste invalide %d" -#define MSG_BAD_LOCALE "Locale invalide %s" -#define MSG_BAD_LOCDFON_ARG "Mauvais param�tre pour LOCDFON" -#define MSG_BAD_LOCNODE_USE "Usage inattendu de LOCNODE" -#define MSG_BAD_LRECL "Disparit� lrecl table/fichier (%d,%hd)" -#define MSG_BAD_MAX_HAVING "MAXTMP trop petit pour Having" -#define MSG_BAD_MAX_NREC "MaxRec=%d ne correspond pas � MaxBlk=%d Nrec=%d" -#define MSG_BAD_MAX_PARAM "Mauvais param�tres pour sp�cifier une valeur maximum" -#define MSG_BAD_MAX_SETTING "Mauvaise valeur '%c' pour max" -#define MSG_BAD_MERGE_TYPE "Le type %d ne pas �tre intercall�" -#define MSG_BAD_NODE_TYPE "Type noeud erron� pour la table" -#define MSG_BAD_OFFSET_VAL "Nul offset invalide pour une table CSV" -#define MSG_BAD_OPEN_MODE "Mode d'ouverture invalide %d" -#define MSG_BAD_OPERATOR "Op�rateur invalide %s" -#define MSG_BAD_ORDER_MODE "Mode de tri %c invalide" -#define MSG_BAD_ORDER_TYPE "Tri sur objet de type=%d invalide" -#define MSG_BAD_OUTER_JOIN "Jointure externe invalide sur table enfant" -#define MSG_BAD_PAD_ARGTYP "Argument de type invalide pour Pad ou Justify" -#define MSG_BAD_PARAMETERS "%.8s: Mauvais param�tres" -#define MSG_BAD_PARAM_TYPE "%.8s: Param�tre de type=%d invalide" -#define MSG_BAD_PARM_COUNT "Nombre de param�tres incoh�rent" -#define MSG_BAD_PHASE_NUM "Num�ro de phrase %d hors limite" -#define MSG_BAD_PHRASE_NB "num�ro de phrase hors limite %d rc=%d\n" -#define MSG_BAD_POS_CODE "POS_code invalide %d" -#define MSG_BAD_POS_TYPE "Type de POS_code invalide %d" -#define MSG_BAD_PROJNUM "Mauvais projnum %d pour la colonne %s" -#define MSG_BAD_QUERY_OPEN "Mode invalide %d pour l'ouverture d'une requ�te" -#define MSG_BAD_QUERY_TYPE "Type de requ�te %d invalide pour %s" -#define MSG_BAD_QUOTE_FIELD "Quote manquante dans %s champs %d ligne %d" -#define MSG_BAD_READ_NUMBER "Mauvais nombre %d de valeurs lues dans %s" -#define MSG_BAD_RECFM "Recfm type %d invalide pour DOSCOL" -#define MSG_BAD_RECFM_VAL "Valeur invalide %d de Recfm" -#define MSG_BAD_RESULT_TYPE "Mauvais type de r�sultat %d pour %s" -#define MSG_BAD_RETURN_TYPE "Type de retour %d incorrect" -#define MSG_BAD_ROW_VALIST "Liste de valeurs invalide pour ROW" -#define MSG_BAD_ROW_VALNB "Nombre de valeurs in�gal dans la liste" -#define MSG_BAD_SCF_ARGTYPE "Argument %d de type=%s invalide pour %s" -#define MSG_BAD_SEM_DOMAIN "Domain .%d invalide" -#define MSG_BAD_SETTINGS "Certaines sp�cifications sont incompatibles avec le type de la table" -#define MSG_BAD_SET_CASE "La casse d'un tableau ne peut pas passer de non respect � respecter" -#define MSG_BAD_SET_STRING "SetValue: appel invalide pour STRING" -#define MSG_BAD_SET_TYPE "Set type %hd invalide" -#define MSG_BAD_SPECIAL_CMD "Commande sp�ciale invalide" -#define MSG_BAD_SPECIAL_COL "Colonne sp�ciale invalide %s" -#define MSG_BAD_SPEC_COLUMN "Colonne sp�ciale invalide pour ce type de table" -#define MSG_BAD_SQL_PARAM "Param�tre SQL invalide pour FindColblk" -#define MSG_BAD_SUBLST_TYPE "Coparm: type %d de sous-liste invalide" -#define MSG_BAD_SUBSEL_IN_X "Sub-select invalide pour une expression" -#define MSG_BAD_SUBSEL_TYPE "Type %d invalide retourn� de Sub-Select" -#define MSG_BAD_SUB_RESULT "R�sultat ind�fini de fonction Sub-Select" -#define MSG_BAD_SUB_SELECT "Sub-select invalide comme argument de fonction" -#define MSG_BAD_TABLE_LINE "Ligne '%s' ill�gale ou tronqu�e dans la section Tables" -#define MSG_BAD_TABLE_LIST "Table %s absente de la liste des tables" -#define MSG_BAD_TABLE_TYPE "Type invalide %s pour la table %s" -#define MSG_BAD_TEST_TYPE "BlockTest sur tableau: types d�pareill�s %s %s" -#define MSG_BAD_TRIM_ARGTYP "Argument de type invalide pour Trim" -#define MSG_BAD_TYPE_FOR_IN "Types d'argument incompatibles pour la fonction IN" -#define MSG_BAD_TYPE_FOR_S "Type incorrecte %d pour %s(%d)" -#define MSG_BAD_TYPE_LIKE "Type(%d)= %d invalide pour LIKE" -#define MSG_BAD_UPD_COR "Le qualificateur %s de la colonne %s ne se ref�re pas � la table mise � jour %s" -#define MSG_BAD_USERBLK_LEN "Mauvaise longueur � l'�criture du bloc utilisateur" -#define MSG_BAD_USETEMP "Usetemp invalide '%s'" -#define MSG_BAD_USETEMP_VAL "Valeur pour Usetemp invalide %d" -#define MSG_BAD_VALBLK_INDX "Valeur hors limites de l'index du bloc de valeurs" -#define MSG_BAD_VALBLK_TYPE "Type=%d invalide pour un bloc de valeurs" -#define MSG_BAD_VALNODE "Type %d invalide pour le noeud valeur colonne %s" -#define MSG_BAD_VALUE_TYPE "Type de valeur invalide %d" -#define MSG_BAD_VAL_UPDATE "Impossible de d�terminer quelle valeur %s doit �tre mise � jour" -#define MSG_BAD_VIEW_OPEN "Mode invalide %d pour l'ouverture d'une View" -#define MSG_BAD_XMODE_VAL "Mode d'ex�cution %d invalide" -#define MSG_BAD_XOBJ_TYPE "Mauvais type de Xobject %d" -#define MSG_BAS_NS_LIST "Format invalide de la liste des espace-noms" -#define MSG_BIN_F_TOO_LONG "Valeur trop longue pour le champ %s (%d --> %d)" -#define MSG_BIN_MODE_FAIL "Echec mode binaire: %s" -#define MSG_BLKTYPLEN_MISM "Disparit� types/longueurs de bloc dans SetValue" -#define MSG_BLK_IS_NULL "Blk est nul" -#define MSG_BLOCK_NO_MATCH "Bloc non correspondant" -#define MSG_BREAKPOINT "Point de contr�le" -#define MSG_BUFF_TOO_SMALL "GetColData: Buffer trop petit" -#define MSG_BUFSIZE_ERROR "Erreur en recherchant la taille du buffer" -#define MSG_BUILDING_GROUPS "Formation des groupes" -#define MSG_BUILD_DIST_GRPS "Formation des groupes distinctes" -#define MSG_BUILD_INDEX "Construction index %s sur %s" -#define MSG_BXP_NULL "Bxp nul dans PUTFON" -#define MSG_CANNOT_OPEN "Ouverture impossible de %s" -#define MSG_CD_ONE_STEP "Count Distinct doit �tre ex�cut� en une seule �tape" -#define MSG_CD_ORDER_ERROR "Erreur de tri dans Count Distinct" -#define MSG_CHECKING_ROWS "Test des lignes � mettre � jour" -#define MSG_CHECK_LEVEL "Niveau de v�rification fix� � %u" -#define MSG_CHSIZE_ERROR "Erreur dans chsize: %s" -#define MSG_CLN_NOT_IN_JOIN "La colonne C%d n'est pas dans le join" -#define MSG_CNTDIS_COL_LOST "Colonne du Count Distinct perdue" -#define MSG_COLIST_BAD_TYPE "Type=%d invalide pour Colist" -#define MSG_COLNAM_TOO_LONG "Nom de colonne trop long" -#define MSG_COLSEC_TOO_BIG "Section colonne trop grande, table %s (%d)" -#define MSG_COLS_REDUCED " (r�duit par Maxcol)" -#define MSG_COLUMN_ERROR "Erreur de colonne" -#define MSG_COLUMN_MISMATCH "Colonne %s d�pareill�e" -#define MSG_COLUMN_NOT_KEY "La colonne jointe R%d.%s n'est pas une cl�" -#define MSG_COL_ALLOC_ERR "Allocation impossible du noeud colonne" -#define MSG_COL_ALLOC_ERROR "Erreur d'allocation m�moire pour la colonne %d" -#define MSG_COL_HAS_NO_DEF "La colonne %s n'est pas d�finie" -#define MSG_COL_INVAL_TABLE "La colonne %s.%s n'existe pas dans la table %s alias %s" -#define MSG_COL_ISNOT_TABLE "La colonne %s n'est pas dans la table %s" -#define MSG_COL_NB_MISM "Le nombre de colonnes ne correspond pas" -#define MSG_COL_NOTIN_GRPBY "La colonne %s n'est pas dans la liste de Group By" -#define MSG_COL_NOTIN_TABLE "La colonne %s n'est dans aucune table" -#define MSG_COL_NOTIN_UPDT "%s n'appartient pas � la table mise � jour %s" -#define MSG_COL_NOT_CODED "La colonne %s n'est pas codifi�e" -#define MSG_COL_NOT_EXIST "La colonne %s n'existe pas dans %s" -#define MSG_COL_NOT_FOUND "La colonne %s n'est pas dans la table %s" -#define MSG_COL_NOT_IN_DB "La colonne %s de la table %s n'est pas dans la base de donn�es" -#define MSG_COL_NOT_IN_JOIN "La colonne %s n'est pas dans le join" -#define MSG_COL_NOT_SORTED "La colonne %s de la table %s n'est pas tri�e" -#define MSG_COL_NUM_MISM "Disparit� du nombre de colonnes" -#define MSG_COL_USED_TWICE "Colonne %s utilis�e deux fois ???" -#define MSG_COMPUTE_ERROR "Erreur dans Compute, op=%d" -#define MSG_COMPUTE_NIY "Compute non impl�ment� pour TOKEN" -#define MSG_COMPUTING "Calculs en cours" -#define MSG_COMPUTING_DIST "Comptage des valeurs distinctes" -#define MSG_COMPUTING_FUNC "Calcul de(s) fonction(s)" -#define MSG_COM_ERROR "Erreur Com" -#define MSG_CONCAT_SUBNODE "Concat�nation de sous-noeuds impossible" -#define MSG_CONNECTED "Connect�" -#define MSG_CONNECT_CANCEL "Connection interrompue par l'utilisateur" -#define MSG_CONNECT_ERROR "Erreur %d se connectant � %s" -#define MSG_CONN_CLOSED "%s(%d) ferm�e" -#define MSG_CONN_CREATED "Connexion %s cr�e" -#define MSG_CONN_DROPPED "Connexion %s supprim�e" -#define MSG_CONN_OPEN "%s(%d) ouverte (%s)" -#define MSG_CONN_SUC_OPEN "%s(%d) ouverte avec succ�s" -#define MSG_CONTROL_C_EXIT "Exit par Ctrl-C" -#define MSG_COPY_BAD_PHASE "Copie de liste invalide en phase %d" -#define MSG_COPY_INV_TYPE "Coparm: type non support� %d" -#define MSG_CORREL_NO_QRY "Les sous-requ�tes corr�l�es ne peuvent pas �tre de type QRY" -#define MSG_CREATED_PLUGDB " Cr�� par PlugDB %s " -#define MSG_CURSOR_SET "Curseur remis � %d" -#define MSG_DATABASE_ACTIVE "Base de donn�es %s activ�e" -#define MSG_DATABASE_LOADED "Base de donn�es %s charg�e" -#define MSG_DATA_IS_NULL "ExecSpecialCmd: data est NULL" -#define MSG_DATA_MISALIGN "Mauvais alignement pour ce type de donn�es" -#define MSG_DBASE_FILE "Fichier dBASE dbf: " -#define MSG_DB_ALREADY_DEF "Base de donn�es %s d�j� d�finie" -#define MSG_DB_ALTERED "Base de donn�es modifi�e" -#define MSG_DB_CREATED "Base de donn�es %s cr��e" -#define MSG_DB_NOT_SPEC "Base de donn�es non sp�cifi�e" -#define MSG_DB_REMOVED "Base de donn�es %s retir�e de la liste" -#define MSG_DB_SORT_ERROR "Erreur de tri DB" -#define MSG_DB_STOPPED "Arr�t de la base de donn�es %s" -#define MSG_DEBUG_NOT_ACTIV "Mode Debug inactif" -#define MSG_DEBUG_SET_INV "Invalide pour Debug: %c" -#define MSG_DEF_ALLOC_ERROR "Erreur d'allocation de la classe DEF %s" -#define MSG_DELETING_ROWS "Suppression des lignes" -#define MSG_DEL_FILE_ERR "Erreur � l'effacement de %s" -#define MSG_DEL_READ_ERROR "Delete: erreur en lecture req=%d len=%d" -#define MSG_DEL_WRITE_ERROR "Delete: erreur en �criture: %s" -#define MSG_DEPREC_FLAG "Option Flag p�rim�e, utiliser Coltype" -#define MSG_DICTIONARY "Dictionnaire " -#define MSG_DIRECT_VARTOK "Acc�s direct aux r�gles du Variable Token non impl�ment�" -#define MSG_DISCONNECTED "D�connect�" -#define MSG_DISTINCT_ERROR "Plus d'un �l�ment fonctionel DISTINCT" -#define MSG_DISTINCT_ROWS "S�lection des lignes distinctes" -#define MSG_DISTINCT_VALUES "Extraction des valeurs distinctes" -#define MSG_DIS_NOHEAD_JOIN "Jointure distincte sur une table non en t�te" -#define MSG_DLL_LOAD_ERROR "Erreur %d au chargement du module %s" -#define MSG_DOMAIN_EMPTY "Le domaine %s est vide" -#define MSG_DOMAIN_ERROR "Colonne %s: disparit� domaine(%s)/valeur(%s)" -#define MSG_DOMAIN_FULL "Le domaine %s est plein (max=%d)" -#define MSG_DOM_FILE_ERROR "Fichier domain %s introuvable" -#define MSG_DOM_NOT_SUPP "MS-DOM non support� par cette version" -#define MSG_DOM_OPEN_ERROR "Erreur d'ouverture du domaine: %s" -#define MSG_DOM_READ_ERROR "Erreur %d en lecture de domaine: %s" -#define MSG_DOM_READ_ONLY "La table domaine %s est en lecture seulement" -#define MSG_DOM_WRITE_ERROR "Erreur %d en �criture de domaine: %s" -#define MSG_DONE "Effectu�, rc=%d" -#define MSG_DOSALMEM_NOMEM "Erreur d'allocation, pas assez de m�moire" -#define MSG_DROP_DB_ERR "Echec du Drop sur le base de donn�es %s" -#define MSG_DSORT_LOG_ERROR "Kindex: Erreur logique de tri distincte" -#define MSG_DUMMY_NO_COLS "Les tables DUMMY ne peuvent pas avoir de colonne" -#define MSG_DUPLICAT_COUNT "Count sur plus d'une colonne" -#define MSG_DUP_COL_NAME "La colonne %s existe en double" -#define MSG_DUP_PROJNUM "Non unique projnum %d pour la colonne %s" -#define MSG_DVAL_NOTIN_LIST "Valeur %s non trouv�e dans la liste des valeurs distinctes de la colonne %s" -#define MSG_EMPTY_DOC "Document vide" -#define MSG_EMPTY_FILE "%s du fichier vide %s: " -#define MSG_ENDSTR_MISMATCH "Fins de cha�ne et de noeud ne correspondent pas" -#define MSG_END_OF_DELETE "%d ligne(s) enlev�e(s) en %.2lf sec" -#define MSG_END_OF_INSERT "%d ligne(s) ins�r�e(s) en %.2lf sec" -#define MSG_END_OF_QUERY "%d ligne(s) extraite(s) en %.2lf sec" -#define MSG_END_OF_UPDATE "%d ligne(s) modifi�e(s) en %.2lf sec" -#define MSG_EOF_AFTER_LINE "Fin de fichier apr�s la ligne %d" -#define MSG_EOF_INDEX_FILE "EOF lisant le fichier index" -#define MSG_ERASED " et effac�e" -#define MSG_ERASE_FAILED " (�chec de l'effacement)" -#define MSG_ERROR "Erreur" -#define MSG_ERROR_IN_LSK "Erreur %d dans lseek64" -#define MSG_ERROR_IN_SFP "Erreur %d dans SetFilePointer" -#define MSG_ERROR_NO_PARM "Param�tre absent (valide seulement pour %.8s.1 et %.8s.5)" -#define MSG_ERROR_OPENING "Erreur � l'ouverture de : " -#define MSG_ERR_NUM_GT_MAX "Erreur: Numval (%d) plus grand que Maxnum (%d)" -#define MSG_ERR_READING_REC "Erreur lisant l'enregistrement %d de %s" -#define MSG_ERR_RET_RULE "Retour erreur, r�gle=%u" -#define MSG_ERR_RET_TYPE "Retour erreur, type=%d" -#define MSG_EVAL_EXPIRED "Cette version d'�valuation est expir�e" -#define MSG_EVAL_ONLY "L'utilisation de cette Dll est pour �valuation seulement" -#define MSG_EXECUTING "Ex�cution" -#define MSG_EXECUTION_ERROR "Erreur d'ex�cution" -#define MSG_EXEC_MODE_IS "Le mode d'ex�cution est %s" -#define MSG_EXEC_MODE_RESET ". Mode remis � Execute" -#define MSG_EXEC_MODE_SET "Mode d'ex�cution fix� � %s" -#define MSG_EXIT_EVAL_ERR "Erreur pendant l'�valuation de Exit" -#define MSG_EXIT_FROM_LANG "Fin du langage %s version %d.%d" -#define MSG_FAIL_ADD_NODE "L'ajout du noeud %s dans la table a �chou�" -#define MSG_FETCHING_DATA "Recherche des donn�es" -#define MSG_FETCHING_ROWS "Recherche des lignes" -#define MSG_FETCH_NO_RES "Fetch: Pas de R�sultats" -#define MSG_FIELD_TOO_LONG "Valeur trop longue pour le champs %d ligne %d" -#define MSG_FILELEN_ERROR "Erreur dans %s pour %s" -#define MSG_FILE_CLOSE_ERR "Erreur %d � la fermeture du fichier" -#define MSG_FILE_IS_EMPTY "Le fichier %s est vide" -#define MSG_FILE_MAP_ERR "Erreur de File mapping" -#define MSG_FILE_MAP_ERROR "CreateFileMapping %s erreur rc=%d" -#define MSG_FILE_NOT_FOUND "Fichier %s introuvable" -#define MSG_FILE_OPEN_YET "Fichier %s d�j� ouvert" -#define MSG_FILE_UNFOUND "Fichier %s non trouv�" -#define MSG_FILGRP_NO_TABLE "Table %d manquante pour groupe filtre" -#define MSG_FILTER_ATTACH "Filtre pass� � Attach" -#define MSG_FILTER_NO_TABLE "Filtre: premi�re table manquante" -#define MSG_FIND_BAD_TYPE "Recherche dans un tableau: type non conforme %s %s" -#define MSG_FIX_OVFLW_ADD "D�passement de capacit� en addition" -#define MSG_FIX_OVFLW_TIMES "D�passement de capacit� en mutiplication" -#define MSG_FIX_UNFLW_ADD "Sous d�passement de capacit� en addition" -#define MSG_FIX_UNFLW_TIMES "Sous d�passement de capacit� en multiplication" -#define MSG_FLD_TOO_LNG_FOR "Champs %d trop long pour %s ligne %d de %s" -#define MSG_FLTST_NO_CORREL "FilTest ne devrait �tre appel� que pour les sous-requ�tes corr�l�es" -#define MSG_FLT_BAD_RESULT "Virgule flottante: r�sultat inexacte" -#define MSG_FLT_DENORMAL_OP "Op�rande virgule flottante non normalis�" -#define MSG_FLT_INVALID_OP "Op�ration virgule flottante invalide" -#define MSG_FLT_OVERFLOW "D�passement de capacit� virgule flottante" -#define MSG_FLT_STACK_CHECK "Virgule flottante: Erreur de la pile" -#define MSG_FLT_UNDERFLOW "Sous-d�passement de capacit� virgule flottante" -#define MSG_FLT_ZERO_DIVIDE "Virgule flottante: division par z�ro" -#define MSG_FMT_WRITE_NIY "L'�criture des fichiers %s n'est pas encore impl�ment�e" -#define MSG_FNC_NOTIN_SLIST "Fonction de tri absente de la liste de s�lection" -#define MSG_FORMAT_ERROR "Erreur de formattage" -#define MSG_FOXPRO_FILE "Fichier FoxPro: " -#define MSG_FPUTS_ERROR "Erreur dans fputs: %s" -#define MSG_FSBPARP_NULL "PUTFON: fsbparp est nul" -#define MSG_FSEEK_ERROR "Erreur dans fseek: %s" -#define MSG_FSETPOS_ERROR "Erreur dans fseek pour i=%d" -#define MSG_FTELL_ERROR "Erreur dans ftell enregistrement=%d: %s" -#define MSG_FUNCTION_ERROR "Erreur dans %s: %d" -#define MSG_FUNC_ERRNO "Erreur %d dans %s" -#define MSG_FUNC_ERROR "Erreur dans %s" -#define MSG_FUNC_ERR_S "Erreur dans %s: %s" -#define MSG_FUNC_REF_DEL "R�f�rence � une fonction d�finie (r�gle %d) qui a �t� supprim�e" -#define MSG_FWRITE_ERROR "Erreur dans fwrite: %s" -#define MSG_GETCWD_ERR_NO "?getcwd %s errno=%d" -#define MSG_GETFILESIZE_ERR "Erreur %d dans GetFileSize" -#define MSG_GET_DIST_VALS "R�cup�ration des valeurs distinctes de " -#define MSG_GET_ERROR "Erreur dans %s (colonne %d)" -#define MSG_GET_FUNC_ERR "Erreur en recherche de la fonction %s: %s" -#define MSG_GET_NAME_ERR "Erreur en retrouvant le nom d'une table SYS" -#define MSG_GLOBAL_ERROR "Erreur d'allocation de Global (taille=%d)\n" -#define MSG_GRAM_ALLOC_ERR "Erreur d'allocation dans Grammar Up" -#define MSG_GRAM_MISMATCH "Avertissement: version de GRAMMAR perim�e (sauv� sous GRAMMAR v%u)" -#define MSG_GRAM_SUBSET_ERR "Erreur d'initialisation du dictionnaire de la grammaire" -#define MSG_GRBY_TAB_NOTIMP "Group by avec tables jointes non impl�ment�" -#define MSG_GROUPBY_NOT_ALL "Group By doit inclure toutes les s�lections non-fonctionnelles" -#define MSG_GROUP_ON_FUNC "Group by invalide sur colonne fonctionnelle" -#define MSG_GRP_COL_MISM "Disparit� colonne des groupes" -#define MSG_GRP_LIST_MISMAT "Le groupement ne couvre pas la liste de s�lection" -#define MSG_GUARD_PAGE "Violation de page de garde" -#define MSG_GZOPEN_ERROR "gzopen %s: erreur %d sur %s" -#define MSG_GZPUTS_ERROR "Erreur dans gzputs: %s" -#define MSG_HANDLE_IS_NULL "%s est NULL: erreur code: %d" -#define MSG_HARRY_COMP_NIY "Compute non impl�ment� pour les cha�nes cod�es" -#define MSG_HAVING_FILTER "Traitement du Filtre Having" -#define MSG_HBUF_TOO_SMALL "Buffer(%d) trop petit pour ent�te(%d)" -#define MSG_HEAD_OPEN_ERROR "Erreur � l'ouverture du fichier header" -#define MSG_HEAD_READ_ERROR "Erreur en lecture du fichier header %s" -#define MSG_HEAD_WRITE_ERR "Erreur en �criture du fichier header" -#define MSG_HI_OFFSET_ERR "Offset sup�rieur non nul" -#define MSG_HUGE_DEFAULT "Huge est %d par d�fault" -#define MSG_HUGE_WARNING_1 "M�moire Huge non compatible 16-bit pour %d\n" -#define MSG_HUGE_WARNING_2 "R�sultats impr�visibles possibles\n" -#define MSG_IDLE "Au repos" -#define MSG_ILLEGAL_INSTR "Instruction ill�gale" -#define MSG_ILL_FILTER_CONV "Conversion implicite ill�gale dans un filtre" -#define MSG_INDEX_CREATED "Index %s cr�� sur %s" -#define MSG_INDEX_DEF_ERR "Erreur sauvegardant l'index d�finition pour %s" -#define MSG_INDEX_DROPPED "Index %s supprim� de %s" -#define MSG_INDEX_INIT_ERR "Echec de l'initialisation de l'index %s" -#define MSG_INDEX_NOT_DEF "Index %s non d�fini" -#define MSG_INDEX_NOT_UNIQ "L'index n'est pas Unique" -#define MSG_INDEX_ONE_SAVE "Les index sont sauvegard�s dans un fichier unique" -#define MSG_INDEX_SEP_SAVE "Les index sont sauvegard�s dans des fichiers s�par�s" -#define MSG_INDEX_YET_ON "L'index %s existe d�j� sur %s" -#define MSG_INDX_ALL_DROP "Tous les index de %s supprim�s" -#define MSG_INDX_COL_NOTIN "La colonne index %s n'existe pas dans la table %s" -#define MSG_INDX_EXIST_YET "L'entr�e index existe d�j�" -#define MSG_INIT_ERROR "Erreur � l'initialisation de %s" -#define MSG_INIT_FAILED "L'initialisation de %s a �chou�" -#define MSG_INPUT "Entr�e: " -#define MSG_INPUT_KEYBD_YET "L'entr�e est d�j� au clavier" -#define MSG_INSERTING "Insertion: " -#define MSG_INSERT_ERROR "Insert erreur: usage multiple du fichier %s" -#define MSG_INSERT_MISMATCH "Les listes colonne et valeur ne correspondent pas" -#define MSG_INTERNAL "interne" -#define MSG_INT_COL_ERROR "Erreur interne sur la colonne index %s" -#define MSG_INT_OVERFLOW "D�passement de capacit� sur entier" -#define MSG_INT_ZERO_DIVIDE "Division enti�re par z�ro" -#define MSG_INVALID_BIP "Bip invalide .%d" -#define MSG_INVALID_DISP "Disposition invalide" -#define MSG_INVALID_FTYPE "SBV: Ftype %d invalide" -#define MSG_INVALID_HANDLE "Poign�e invalide" -#define MSG_INVALID_OPER "Op�rateur invalide %d pour %s" -#define MSG_INVALID_OPTION "Option invalide %s" -#define MSG_INV_COLUMN_TYPE "Type %d Invalide pour la colonne %s" -#define MSG_INV_COL_DATATYP "Type de donn�es %d invalide pour la colonne %d" -#define MSG_INV_COL_NUM "Colonne invalide %d" -#define MSG_INV_COL_TYPE "Type de colonne %s invalide" -#define MSG_INV_CONC_BIP "Bip invalide (seuls valides: %.8s.0 .1 and .5)" -#define MSG_INV_DATA_PATH "Chemin vers les donn�es invalide" -#define MSG_INV_DEF_READ "Lecture diff�r�e invalide rc=%d" -#define MSG_INV_DIRCOL_OFST "Offset invalide pour une colonne DIR" -#define MSG_INV_DOMAIN_TYPE "Type invalide %d" -#define MSG_INV_FILTER "Filtre r�siduel dans %s" -#define MSG_INV_FNC_BUFTYPE "FNC: Type %d de l'argument invalide pour %s" -#define MSG_INV_INFO_TYPE "Type d'info catalog invalide %d" -#define MSG_INV_INIPATH "Inipath invalide " -#define MSG_INV_MAP_POS "Position m�moire invalide" -#define MSG_INV_OPERATOR "op�rateur invalide %d\n" -#define MSG_INV_PARAMETER "Param�tre invalide %s" -#define MSG_INV_PARM_TYPE "Type de param�tre invalide" -#define MSG_INV_QUALIFIER "Qalificateur '%s' invalide" -#define MSG_INV_QUERY_TYPE "Type de requ�te %d invalide" -#define MSG_INV_RAND_ACC "L'acc�s al�atoire d'une table non optimis�e est impossible" -#define MSG_INV_REC_POS "Position d'enregistrement invalide" -#define MSG_INV_RESULT_TYPE "Type de r�sultat invalide %s" -#define MSG_INV_SET_SUBTYPE "Type de formattage %d invalide" -#define MSG_INV_SPECIAL_CMD "%s: Commande sp�ciale invalide" -#define MSG_INV_SUBTYPE "Sous type invalide %s" -#define MSG_INV_TOK_DOMAIN "Le domaine %s n'existe pas" -#define MSG_INV_TOPSEM_CMD "Commande TopSem invalide %c" -#define MSG_INV_TRANSF_USE "Usage invalide en r�gle transformationnelle" -#define MSG_INV_TYPE_SPEC "Sp�cification de type invalide (%.8s.%d)" -#define MSG_INV_UPDT_TABLE "Table %s invalide pour Update" -#define MSG_INV_VALUE_LIST "Liste de valeurs invalide pour Insert" -#define MSG_INV_WHERE_JOIN "Clause Where invalide dans une requ�te de jointure" -#define MSG_INV_WORK_PATH "Chemin de travail invalide" -#define MSG_IN_ARGTYPE_MISM "Arguments de types incompatibles pour une expression IN" -#define MSG_IN_USE " et en activit�" -#define MSG_IN_WITHOUT_SUB "IN ou EXISTS sans tableau ou subquery" -#define MSG_IS_NOT_CONN "%s n'est pas une connexion d�finie" -#define MSG_JCT_MISS_COLS "Colonnes manquantes pour une table JCT" -#define MSG_JCT_MISS_TABLE "Table jointe manquante pour JCT" -#define MSG_JCT_NO_FILTER "Filtrage impossible des tables virtuelles JCT" -#define MSG_JCT_NO_KEY "Erreur logique JCT: cl� manquante" -#define MSG_JOIN_KEY_NO_COL "La cl� de jointure n'est pas une colonne" -#define MSG_KEY_ALLOC_ERR "Erreur d'allocation d'un bloc offset cl�" -#define MSG_KEY_ALLOC_ERROR "Erreur d'allocation m�moire, Klen=%d n=%d" -#define MSG_LANGUAGE_QUIT "%s lib�r�" -#define MSG_LANG_ACTIVE "Langage %s actif" -#define MSG_LANG_ALLOC_FAIL "PlugInitLang: Erreur d'allocation du bloc Lang" -#define MSG_LANG_ALREADY_UP "Langage d�j� en �dition" -#define MSG_LANG_BAD_SAVE "Langage %s peut-�tre incorrectement sauvegard�" -#define MSG_LANG_NOT_FREED "Langage %s non lib�rable (pas dans la cha�ne principale)" -#define MSG_LANG_SAVED "Langage %s sauvegard�" -#define MSG_LANG_WR_LEN_ERR "Erreur de longueur � l'�criture du bloc Lang" -#define MSG_LDF_ALLOC_ERROR "Erreur d'allocation d'un LdfBlock" -#define MSG_LDF_RN_MISMATCH "LDF: d�calage des num�ros de r�gle" -#define MSG_LDF_WLEN_ERROR "Erreur de longueur en �crivant LdfData" -#define MSG_LDF_W_LEN_ERROR "Erreur de longueur pour LdfData en �criture" -#define MSG_LIC_NO_MYSQL "Votre licence actuelle ne permet pas l'utilisation du type MYSQL" -#define MSG_LINEAR_ERROR "Erreur de lin�arisation" -#define MSG_LINE_LENGTH "Largeur d'impression fix�e � %d" -#define MSG_LINE_MAXLIN "Nombre de lignes de travail plafonn� � %d" -#define MSG_LINE_MAXRES "Nombre de lignes de r�sultat plafonn� � %d" -#define MSG_LINE_MAXTMP "Nombre de lignes interm�diaires plafonn� � %d" -#define MSG_LINE_TOO_LONG "La nouvelle ligne est trop longue" -#define MSG_LINJOINDB_ERROR "Erreur syst�me: appel incorrecte � LinJoinDB" -#define MSG_LIST "--Liste--" -#define MSG_LNG_NOT_IN_LIST "Le langage %s n'est pas dans la liste" -#define MSG_LOADING_DB "Chargement description de la BD" -#define MSG_LOADING_FAILED "Le chargement de %s a �chou�" -#define MSG_LOAD_CDLL_ERROR "Erreur au chargement de ConnDll: rc=%d" -#define MSG_LOCSTRG_TOO_BIG "LOCSTRG: n trop grand ? (%d)\n" -#define MSG_LOGICAL_ERROR "%s: Erreur logique" -#define MSG_LRECL_TOO_SMALL "Lrecl trop petit (longueur en-t�te = %d)" -#define MSG_MAC_NO_DELETE "Pas de suppression de lignes pour les tables MAC" -#define MSG_MAC_NO_INDEX "Pas d'acc�s direct aux tables MAC" -#define MSG_MAC_READ_ONLY "Les tables MAC sont en lecture seulement" -#define MSG_MAC_WIN_ONLY "Les tables MAC sont seulement sous Windows" -#define MSG_MAKE_EMPTY_FILE "G�n�ration du fichier vide %s: %s" -#define MSG_MAKING "G�n�ration" -#define MSG_MAKING_DISTINCT "Regroupement des valeures distinctes" -#define MSG_MALLOC_ERROR "Allocation m�moire impossible par %s" -#define MSG_MALLOC_NULL "malloc retourne Null" -#define MSG_MAP_NO_MORE "Le type %s n'est plus support�" -#define MSG_MAP_OBJ_ERR "Erreur %d � la fermeture du map objet" -#define MSG_MAP_VEC_ONLY "MAP Insert permis seulement pour les tables VEC Estimate" -#define MSG_MAP_VIEW_ERROR "MapViewOfFile %s erreur rc=%d" -#define MSG_MAXSIZE_ERROR "Maxsize incalculable sur table ouverte" -#define MSG_MAXTMP_TRUNCATE "R�sultats interm�diaires tronqu�s par maxtmp=%d" -#define MSG_MAX_BITMAP "Taille maxi des bitmaps d'optimisation fix�e � %d" -#define MSG_MEMSIZE_TOO_BIG "Erreur: memsize (%d) trop grand pour Length (%d)" -#define MSG_MEM_ALLOC_ERR "Erreur d'allocation m�moire, taille %s = %d" -#define MSG_MEM_ALLOC_ERROR "Erreur d'allocation m�moire" -#define MSG_MEM_ALLOC_YET "M�moire d�j� allou�e" -#define MSG_METAFILE_NOTFND "Fichier Meta introuvable" -#define MSG_MISPLACED_QUOTE "Appostrophe mal plac�e ligne %d" -#define MSG_MISSING "Manquant: Value=%p Argval=%p Builtin=%d" -#define MSG_MISSING_ARG "Argument manquant pour l'op�rateur %d" -#define MSG_MISSING_COL_DEF "D�finition des colonnes manquante" -#define MSG_MISSING_CONNECT "Connection #1 manquante" -#define MSG_MISSING_EOL "Fin de ligne manquante dans %s" -#define MSG_MISSING_FIELD "Champs %d manquant dans %s ligne %d" -#define MSG_MISSING_FNAME "Nom du fichier manquant" -#define MSG_MISSING_NODE "Noeud %s manquant dans %s" -#define MSG_MISSING_POS "POS code manquant" -#define MSG_MISSING_ROWNODE "Impossible de trouver le noeud de la ligne %d" -#define MSG_MISSING_SERV_DB "Indication serveur et/ou base de donn�es manquante" -#define MSG_MISS_LEAD_COL "Colonne majeure %s manquante" -#define MSG_MISS_NAME_LRECL "Nom du fichier et/ou LRECL manquant" -#define MSG_MISS_TABLE_LIST "Liste des tables manquante" -#define MSG_MISS_VCT_ELMT "Taille de bloc vectoriel manquante (Elements)" -#define MSG_MIS_TAG_LIST "Liste des balises colonne manquante" -#define MSG_MKEMPTY_NIY "MakeEmptyFile: pas encore implement� pour Huge et Unix" -#define MSG_MOVE_INV_TYPE "MOVPARM: param�tre de type invalide %d" -#define MSG_MULT_DISTINCT "Distinct utilis� plus d'une fois" -#define MSG_MULT_KEY_ERROR "Erreur sur cl� multiple k=%d n=%d" -#define MSG_MUL_MAKECOL_ERR "Erreur logique dans TABMUL::MakeCol" -#define MSG_MYSQL_CNC_OFF "La connexion � MySQL est ferm�e" -#define MSG_MYSQL_CNC_ON "La connexion � MySQL est �tablie" -#define MSG_MYSQL_NOT_SUP "Pas de support de MySQL dans cette version" -#define MSG_MY_CNC_ALREADY "La connexion � MySQL est d�j� active" -#define MSG_NAME_CONV_ERR "Erreur de convertion du nom de noeud" -#define MSG_NAME_IS_USED "Le nom %s est d�j� utilis�" -#define MSG_NCOL_GT_MAXCOL "Trop de colonnes (%d > %d max)" -#define MSG_NEW_CHAR_NULL "new char(%d) retourne Null" -#define MSG_NEW_DOC_FAILED "Impossible de cr�er le nouveau document" -#define MSG_NEW_RETURN_NULL "NULL renvoy� par New dans PlugEvalLike" -#define MSG_NEW_TABLE_ERR "La nouvelle table %s ne peut pas �tre charg�e" -#define MSG_NEXT_FILE_ERROR "Erreur en recherche du fichier suivant. rc=%s" -#define MSG_NODEF_FROM_VIEW "Pas de d�finition de table depuis une view" -#define MSG_NODE_FOR_CHAR "Noeud %s trouv� au lieu d'un caract�re" -#define MSG_NODE_SUBSET_ERR "Erreur d'initialisation de la zone Noeud %d" -#define MSG_NONCONT_EXCEPT "Exception non-continuable" -#define MSG_NON_DUP_HAVING "Clause Having dans une requ�te non fonctionelle" -#define MSG_NON_EVAL_SEM "Sem non �valu�e: p_no=%d" -#define MSG_NOP_ZLIB_INDEX "L'indexage d'une table zlib non optimis�e est impossible" -#define MSG_NOT_A_DBF_FILE "Le fichier n'a pas le format dBASE dbf " -#define MSG_NOT_ENOUGH_COLS "Pas assez de colonnes dans %s" -#define MSG_NOT_ENOUGH_MEM "M�moire insuffisante pour cette op�ration" -#define MSG_NOT_FIXED_LEN "Fichier %s non fixe, len=%d lrecl=%d" -#define MSG_NOT_IMPLEMENTED "Non implement�: %.8s" -#define MSG_NOT_IMPL_JOIN "Pas impl�ment� pour les jointures" -#define MSG_NOT_IMPL_SET "Pas impl�ment� pour les op�rateurs d'ensembles" -#define MSG_NOT_IMPL_YET "Pas encore implement�" -#define MSG_NOT_LINEARIZED "Arborescence des tables non lin�aris�e" -#define MSG_NOT_MODIFIABLE " (non modifiable)" -#define MSG_NO_0DH_HEAD "0DH manquant en fin d'en-t�te (dbc=%d)" -#define MSG_NO_ACTIVE_APPL "Pas d'application active" -#define MSG_NO_ACTIVE_DB "Pas de base de donn�es active" -#define MSG_NO_ACTIVE_UDIC "Pas de dictionaire utilisateur actif" -#define MSG_NO_AGGR_FUNC "Fonction aggr�g�e %d ill�gale � cet endroit" -#define MSG_NO_AREA_FILE "Fichier Area introuvable" -#define MSG_NO_AVAIL_RESULT "Pas de r�sultat disponible" -#define MSG_NO_BIG_DELETE "D�l�tion Partielle non impl�ment�e pour les fichiers HUGE" -#define MSG_NO_CHAR_FROM "Conversion de type %d en caract�res impossible" -#define MSG_NO_CLUSTER_COL "Pas de colonne optimisable" -#define MSG_NO_COL_ADDING "Ajouter des colonnes dans une d�finition existante est impossible" -#define MSG_NO_COL_DEF_AS "La d�finitions des colonnes est incompatible avec AS Select" -#define MSG_NO_COL_FOUND "La section colonne %s est vide" -#define MSG_NO_COL_IN_TABLE "La colonne %d n'est pas dans la table %s" -#define MSG_NO_COL_SECTION "Section colonne manquante pour la table %s" -#define MSG_NO_CONNECT_ADDR "Adresse de connection non sp�cifi�e" -#define MSG_NO_CONST_FILTER "Filtres constants non implement�s" -#define MSG_NO_CURLY_BRKT "Pas d'accolade de fermeture" -#define MSG_NO_DATABASE "Base de donn�es %s introuvable" -#define MSG_NO_DATE_FMT "Pas de format date pour le valblock de type %d" -#define MSG_NO_DBF_INSERT "Insert pas encore impl�ment� pour les fichier DBF" -#define MSG_NO_DEF_FNCCOL "Colonne fonction par d�faut introuvable" -#define MSG_NO_DEF_PIVOTCOL "Colonne pivot par d�faut introuvable" -#define MSG_NO_DIR_INDX_RD "Pas d'acc�s directe des tables %s" -#define MSG_NO_DMY_DIR_ACC "Pas d'acc�s direct aux tables virtuelles DUMMY" -#define MSG_NO_DOM_DELETE "D�l�tion Partielle non impl�ment�e pour les domaines" -#define MSG_NO_DOM_MATCH "Cha�ne %.8s... non touv�e dans le domaine %s" -#define MSG_NO_EDITED_LANG "Coparm: Pas de langage en �dition" -#define MSG_NO_EXP_LINK "Liaison par expression invalide pour une table JCT" -#define MSG_NO_EXT_FILTER "Le filtrage ne peut se r�f�rer � une autre table" -#define MSG_NO_EXT_UPDATE "Pas de mise � jour en r�f�rence � une autre table" -#define MSG_NO_FEAT_SUPPORT "%s non support� dans cette version" -#define MSG_NO_FILE_LIST "La table %s n'a pas de liste de fichiers" -#define MSG_NO_FLD_FORMAT "Format absent pour le champs %d de %s" -#define MSG_NO_FORMAT_COL "Type COLUMN informattable" -#define MSG_NO_FORMAT_TYPE "Le format ne peut pas �tre d�fini � partir du type %d" -#define MSG_NO_FULL_JOIN "Jointures autoris�es seulement � �galit� sur cl�(s)" -#define MSG_NO_FUL_OUT_JOIN "Jointures externes compl�tes non support�es" -#define MSG_NO_FUNC_ORDER "Tri non support� sur �l�ment fonctionnel" -#define MSG_NO_HEAD_JOIN "Jointure sur une table non en t�te" -#define MSG_NO_HQL_CONV "Conversion en HQL non disponible" -#define MSG_NO_INDEX "La table %s n'a pas d'index" -#define MSG_NO_INDEX_GBX "Pas ou mauvais index pour SQLGBX" -#define MSG_NO_INDEX_IN "Pas d'index dans %s" -#define MSG_NO_INDEX_READ "Pas d'acc�s directe des tables multiples" -#define MSG_NO_INIT_LANG "Pas de langage initial" -#define MSG_NO_JOIN_TO_EXP "Jointure vers une expression impossible" -#define MSG_NO_JOIN_UPDEL "Pas de jointure avec Update/Delete" -#define MSG_NO_KEY_COL "Pas de colonne cl� trouv�e" -#define MSG_NO_KEY_UPDATE "Le nom des cl�s ne peut pas �tre modifi�" -#define MSG_NO_LANGUAGE "Pas de langage op�rationnel\n" -#define MSG_NO_LANG_TO_QUIT "Pas de langage � quitter" -#define MSG_NO_LISTVAL_HERE "LSTBLK: Liste de valeurs utilis�e hors contexte" -#define MSG_NO_MAP_INSERT "MAP incompatible avec Insert" -#define MSG_NO_MATCHING_COL "Pas de colonne correspondant � %s dans %s" -#define MSG_NO_MATCH_COL "Colonne correspondante introuvable" -#define MSG_NO_MEMORY "M�moire pleine" -#define MSG_NO_MEM_CORR_SUB "Subquery corr�l�e en m�moire non encore impl�ment�e" -#define MSG_NO_MODE_PADDED "Mode non support� pour les fichiers 'padded'" -#define MSG_NO_MORE_COL "La colonne %s n'est plus dans la table pivot" -#define MSG_NO_MORE_LANG "Plus de langage, exit de %s\n" -#define MSG_NO_MORE_VAR "Les fichiers VAR ne sont plus support�s" -#define MSG_NO_MULCOL_JOIN "Jointure vers un index multi-colonne pas encore possible" -#define MSG_NO_MULT_HAVING "Clauses Having multiples non impl�ment�es" -#define MSG_NO_MUL_DIR_ACC "Acc�s direct des tables multiples pas encore impl�ment�" -#define MSG_NO_MUL_VCT "Les tables VCT ne peuvent pas �tre multiples" -#define MSG_NO_MYSQL_CONN "Aucune connexion MySQL ouverte" -#define MSG_NO_MYSQL_DELETE "Pas de Delete pour les tables MySQL" -#define MSG_NO_NBCOL "Pas de NBcol" -#define MSG_NO_NBLIN "Pas de NBlin, MaxSize ou Continued" -#define MSG_NO_NBLIN_CONT "Fetch: Pas de NBlin ou Continued" -#define MSG_NO_NULL_CONST "Les constantes ne sont pas prises en charge" -#define MSG_NO_ODBC_COL "Colonnes ODBC automatiques non support�es par cette version" -#define MSG_NO_ODBC_DELETE "Delete ne devrait pas �tre appel� pour les tables ODBC" -#define MSG_NO_ODBC_DIRECT "Acc�s directe des tables ODBC non encore impl�ment�" -#define MSG_NO_ODBC_MUL "Multiple(2) non support� pour les tables ODBC" -#define MSG_NO_ODBC_SPECOL "Pas de colonne sp�ciale ODBC" -#define MSG_NO_OPT_COLUMN "Pas optimisable ou pas de colonne optimis�es" -#define MSG_NO_OP_MODIF "Les modificateurs ne s'appliquent pas � %s" -#define MSG_NO_PARAMETER "Pas de param�tre" -#define MSG_NO_PART_DEL "Delete partiel des fichier %s impossible" -#define MSG_NO_PART_MAP "Mapping partiel non impl�ment� pour cet OS" -#define MSG_NO_PAR_BLK_INS "Insertion de bloc partiel impossible" -#define MSG_NO_PIV_DIR_ACC "Pas d'acc�s directe aux tables PIVOT" -#define MSG_NO_POS_ADDED "Pos_code non ajout�" -#define MSG_NO_PROMPTING "Relance impossible pour les tables distribu�es" -#define MSG_NO_QRY_DELETE "Delete n'est pas utilisable pour les views QRY" -#define MSG_NO_QUERY_ARRAY "Tableaux avec QUERY non encore impl�ment�s" -#define MSG_NO_RCUR_DSK_YET "Usage recursif de DISK non encore implement�" -#define MSG_NO_READ_32 "Lecture de 32 octets impossible" -#define MSG_NO_RECOV_SPACE "Espace non recouvrable dans le fichier index" -#define MSG_NO_REF_DELETE "Pas de suppression en r�f�rence � une autre table" -#define MSG_NO_REF_UPDATE "Pas de mise � jour en r�f�rence � une autre table" -#define MSG_NO_REMOTE_FNC "Certaines fonctions ne peuvent pas �tre ex�cut�es � distance" -#define MSG_NO_ROWID_FOR_AM "Acc�s direct impossible de ROWID pour les tables de type %s" -#define MSG_NO_ROW_NODE "Le nom du Rownode n'est pas d�fini" -#define MSG_NO_SECTION_NAME "Nom de section manquant" -#define MSG_NO_SEC_UPDATE "Les noms de section ne peuvent pas �tre modifi�s" -#define MSG_NO_SELECTED_DB "Aucune base de donn�es s�lect�e" -#define MSG_NO_SELF_PIVOT "Une table ne peut se pivoter elle-m�me !" -#define MSG_NO_SERVER_FOUND "Serveur introuvable" -#define MSG_NO_SETPOS_YET "SetPos pas encore impl�ment� pour les fichier %s" -#define MSG_NO_SFEXIT_UNIX "Fonction %s non disponible sur Unix" -#define MSG_NO_SOURCE " (pas de source)" -#define MSG_NO_SPEC_COL "Pas de colonne sp�ciales MYSQL" -#define MSG_NO_SQL_DELETE "Delete n'est pas utilisable actuellement pour les views SQL" -#define MSG_NO_SUB_VAL "Pas de sous-value d'un tableau de type %d" -#define MSG_NO_SUCH_INDEX "La table %s n'a pas l'index %s" -#define MSG_NO_SUCH_SERVER "Serveur %s introuvable" -#define MSG_NO_SUCH_TABLE "Table %s pas dans la base de donn�es" -#define MSG_NO_TABCOL_DATA "Pas de donn�es pour la table %s colonne %s" -#define MSG_NO_TABLE_COL "Aucune colonne trouv�e pour %s" -#define MSG_NO_TABLE_DEL "Delete non autoris� pour les tables %s " -#define MSG_NO_TABLE_DESC "Pas de bloc descriptif de table" -#define MSG_NO_TABLE_INDEX "La table %s n'a pas d'index" -#define MSG_NO_TABLE_LIST "Pas de liste de tables" -#define MSG_NO_TAB_DATA "Pas de donn�es pour la table %s" -#define MSG_NO_TERM_IN_TOK "Les non-terminaux ne sont pas utilisables dans les r�gles de Token" -#define MSG_NO_TOKEN_DB "DB introuvable pour la colonne TOKEN %s" -#define MSG_NO_UNIX_CATINFO "Pas d'info catalogue sous Unix" -#define MSG_NO_UPDEL_JOIN "Pas de jointure de tables ODBC pour Update/Delete" -#define MSG_NO_VCT_DELETE "D�l�tion Partielle non impl�ment�e pour les fichiers VCT" -#define MSG_NO_VIEW_COLDEF "Colonne d�finition impossible pour les views" -#define MSG_NO_VIEW_SORT "La View fonctionnelle %s ne peut pas �tre tri�e ou jointe" -#define MSG_NO_ZIP_DELETE "Delete sur fichier Zip non encore implement�" -#define MSG_NO_ZIP_DIR_ACC "Acc�s directe des tables ZDOS non encore implement�" -#define MSG_NULL_COL_VALUE "La colonne n'a pas de valeur" -#define MSG_NULL_ENTRY "InitLang, entr�e nulle %d %s" -#define MSG_NULL_QUERY "Requ�te vide" -#define MSG_NUMVAL_NOMATCH "Disparit� de Numval pour %s" -#define MSG_N_FULL_PARSES "%d significations" -#define MSG_ODBC_READ_ONLY "ODBC est actuellement en lecture seulement" -#define MSG_OFFSET_NOT_SUPP "Offset non support� pour ce type de sous requ�te" -#define MSG_ONE_LANG_YET "Un langage est d�j� en �dition" -#define MSG_ONE_PARAM_ONLY "Un seul param�tre autoris�" -#define MSG_ONLY_LOG10_IMPL "Seul Log10 est implement�" -#define MSG_ON_LANGUAGE "Langage %.8s version %d niveau %d �ditable" -#define MSG_OPENING "Ouverture" -#define MSG_OPENING_QUERY "Ouverture de la requ�te" -#define MSG_OPEN_EMPTY_FILE "Ouverture du fichier vide %s: %s" -#define MSG_OPEN_ERROR "Erreur d'ouverture %d en mode %d sur %s: " -#define MSG_OPEN_ERROR_IS "Erreur � l'ouverture de %s: %s" -#define MSG_OPEN_ERROR_ON "Erreur d'ouverture sur %s" -#define MSG_OPEN_MODE_ERROR "Erreur d'ouverture(%s) %d sur %s" -#define MSG_OPEN_SORT_ERROR "Erreur logique de tri dans QUERY Open" -#define MSG_OPEN_STRERROR "Erreur � l'ouverture: %s" -#define MSG_OPEN_W_ERROR "Erreur � l'ouverture de %s en �criture" -#define MSG_OPTBLK_RD_ERR "Erreur � la lecture d'un bloc optimisation: %s" -#define MSG_OPTBLK_WR_ERR "Erreur � l'�criture d'un bloc optimisation: %s" -#define MSG_OPTIMIZING "Optimisation de " -#define MSG_OPT_BMAP_RD_ERR "Erreur en lecture des bitmaps d'optimisation: %s" -#define MSG_OPT_BMAP_WR_ERR "Erreur en �criture des bitmaps d'optimisation: %s" -#define MSG_OPT_CANCELLED "Optimisation interrompue par l'utilisateur" -#define MSG_OPT_DVAL_RD_ERR "Erreur en lecture des valeurs distinctes: %s" -#define MSG_OPT_DVAL_WR_ERR "Erreur en �criture des valeurs distinctes: %s" -#define MSG_OPT_HEAD_RD_ERR "Erreur en lecture de l'ent�te du fichier opt: %s" -#define MSG_OPT_HEAD_WR_ERR "Erreur en �criture de l'ent�te du fichier opt: %s" -#define MSG_OPT_INIT "Optimisation initialis�e" -#define MSG_OPT_LOGIC_ERR "Erreur logique dans SetBitmap, i=%d" -#define MSG_OPT_MAX_RD_ERR "Erreur en lecture des valeurs maxi: %s" -#define MSG_OPT_MAX_WR_ERR "Erreur en �criture des valeurs maxi: %s" -#define MSG_OPT_MIN_RD_ERR "Erreur en lecture des valeurs mini: %s" -#define MSG_OPT_MIN_WR_ERR "Erreur en �criture des valeurs mini: %s" -#define MSG_OPT_NOT_MATCH "Le fichier opt %s n'est pas � jour" -#define MSG_OP_RES_TOO_LONG "R�sultat trop long pour l'op�rateur=%d" -#define MSG_ORDER_OUT_RANGE "Tri: Order %d hors limite" -#define MSG_ORDER_TWICE "Un m�me �l�ment est tri� deux fois" -#define MSG_PAGE_ERROR "Erreur de pagination" -#define MSG_PARM_CNT_MISS "Disparit� du nombre de Param�tres" -#define MSG_PARSE_NULL_SEM "S�mantique nulle" -#define MSG_PARSING_QUERY "Analyse de la requ�te" -#define MSG_PIX_ERROR "Pix %s erreur r�gle no=%u\n" -#define MSG_PIX_TEST_ERROR "R�gle=%u: pix-TEST pas dans le premier noeud\n" -#define MSG_PLG_READ_ONLY "PLG est actuellement en lecture seulement" -#define MSG_PLM_NULL_SFP "TABPLM ReadDB: Sfp est NULL" -#define MSG_PLUG_NOT_INIT "Plug n'est pas initialis�\n" -#define MSG_PLUG_NOT_RUN "Plug n'est pas en marche" -#define MSG_PNODE_RULE "(Noeud %d r�gle %d) " -#define MSG_POS_TOO_LONG "%s trop long (>%d)" -#define MSG_PREC_VBLP_NULL "ARRAY SetPrecision: Vblp est NULL" -#define MSG_PRIV_INSTR "Instruction privil�gi�e" -#define MSG_PROCADD_ERROR "Erreur %d sur l'adresse de %s" -#define MSG_PROCESS_SUBQRY "Sub-Query en cours de traitement" -#define MSG_PROC_WOULD_LOOP "Bouclage du traitement (maxres=%d maxlin=%d)" -#define MSG_PROGRESS_INFO "Informations sur le traitement en cours" -#define MSG_PROMPT_CANCEL "Relance annul�e" -#define MSG_PROMPT_NIY "Prompt non impl�ment� pour cette configuration" -#define MSG_PTR_NOT_FOUND "Pointeur introuvable Num=%d ti1=%d" -#define MSG_PXDEF_IS_NULL "Pxdef est NULL" -#define MSG_QRY_READ_ONLY "Les views QRY sont en lecture seulement" -#define MSG_QUERY_CANCELLED "Requ�te interrompue par l'utilisateur" -#define MSG_QUERY_NOT_EXEC "Requ�te non ex�cut�e" -#define MSG_QUERY_SAVED "Requ�te %s sauvegard�e" -#define MSG_QUOTE_IN_QUOTE "Appostrophe dans un champ entre appostrophe ligne %d" -#define MSG_RANGE_NIY "Range pas encore impl�ment� pour %s" -#define MSG_RANGE_NO_JOIN "Range non compatible avec les index de jointure" -#define MSG_RC_READING "rc=%d en lecture de la table %s" -#define MSG_READB_BAD_INIT "%s ReadDB appel� avec Init=0" -#define MSG_READCOL_ERROR "SQLCOL: erreur dans ReadColumn" -#define MSG_READING "Lecture" -#define MSG_READING_FROM "Lecture de %s" -#define MSG_READING_RECORD "Erreur en lecture de l'enregistrement %d de %s" -#define MSG_READY "Pr�t" -#define MSG_READ_ERROR "Erreur en lecture sur %s: %s" -#define MSG_READ_ERROR_RC "Erreur en lecture, rc=%d" -#define MSG_READ_MEM_ERROR "Lecture m�moire %d: taille=%d" -#define MSG_READ_ONLY "Cette table prot�g�e en lecture seule ne peut �tre modifi�e" -#define MSG_READ_SEEK_ERROR "Erreur de recherche en lecture: %s" -#define MSG_READ_SEG_ERROR "Lecture segment %d: taille=%d" -#define MSG_RECEIVED "Re�u %c\n" -#define MSG_RECORD_ERROR "Erreur � la lecture de l'enregistrement %d de %s" -#define MSG_RECORD_NO_SEP "Enregistrement sans s�parateur" -#define MSG_REC_SKIPPED " (%d lignes erronn�es saut�es par l'option MaxErr)" -#define MSG_REDUCE_INDEX "R�duction de l'index" -#define MSG_REGISTER_ERR "Enregistrement NS impossible, pr�fix='%s' et href='http://github.com/%s'" -#define MSG_REMOTE_CONN_ERR "La connection �loign�e a �chou�" -#define MSG_REMOVE_ERROR "Erreur en supprimant %s: %s" -#define MSG_REMOVE_NOT_IMPL "Remove non impl�ment� pour TDB non Table" -#define MSG_RENAME_ERROR "Erreur renommant %s en %s: %s" -#define MSG_RENUM_RULES "Renum�rotez les r�gles et r�entrez ADD (r�gle sauvegard�e dans la zone tampon)" -#define MSG_REORDER_INDEX "Reclassement de l'index" -#define MSG_REQU_ARG_NUM "La fonction %s doit avoir %d arguments" -#define MSG_RESET_TO "%s remis � %d" -#define MSG_RES_NOT_UNIQUE "Le r�sultat n'est pas unique" -#define MSG_RET_FROM_LANG "Retour au language %s version %d.%d du language %s version %d.%d" -#define MSG_ROWID_NOT_IMPL "RowNumber non impl�ment� pour les tables de type %s" -#define MSG_ROWS_SELECTED "%d lignes s�lectionn�es en %.2lf sec" -#define MSG_ROWS_TRUNCATED " (tronqu� par MAXRES, LIMIT, FREQ ou AreaSize)" -#define MSG_ROW_ARGNB_ERR "ROW: disparit� du nombre d'arguments (%d,%d)" -#define MSG_RPC_SERVER_ERR "Erreur logique dans TABMUL::MakeCol" -#define MSG_RSC_ALLOC_ERROR "Erreur d'allocation m�moire dans Rescol %s" -#define MSG_RULE_ENTERED "R�gle %d entr�e" -#define MSG_RULE_SUBSET_ERR "Erreur d'initialisation de la zone R�gles" -#define MSG_SAVING_INDEX "Sauvegarde du fichier index" -#define MSG_SCAN_NOT_IMP "Scan non impl�ment�" -#define MSG_SEC_KEY_FIRST "Les sections et cl�s doivent �tre ins�r�es en premier" -#define MSG_SEC_NAME_FIRST "Le nom de section doit �tre en t�te de liste en insertion" -#define MSG_SEC_NOT_FOUND "Section %s absente de %s" -#define MSG_SEEK_ERROR "Seek erreur dans CopyHeader" -#define MSG_SEMANTIC_TREE "Arbre s�mantique" -#define MSG_SEM_BAD_REF "Sem @%d r�f�rence un argument de type non 0 ou 1" -#define MSG_SEM_UNKNOWN "inconnue, rc=%d" -#define MSG_SEP_IN_FIELD "Le champ %d contient le caract�re s�parateur" -#define MSG_SEQUENCE_ERROR "HSTMT: Allocation hors s�quence" -#define MSG_SETEOF_ERROR "Erreur %d dans SetEndOfFile" -#define MSG_SETRECPOS_NIY "SetRecpos non impl�ment� pour ce type de table" -#define MSG_SET_LOCALE "Locale fix�e � %s" -#define MSG_SET_NULL_DOM "Valeur %d donn�e � un domaine nul" -#define MSG_SET_OP_NOT_IMPL "Op�rateurs ensemblistes non implement�s" -#define MSG_SET_STR_TRUNC "SetValue: Cha�ne de caract�res tronqu�e" -#define MSG_SEVERAL_TREES "Jointure non sp�cifi�e pour certaines tables" -#define MSG_SFP_ERROR "Erreur sur SetFilePointer: %s" -#define MSG_SFUNC_NOT_IMPL "Fonction scalaire %s non impl�ment�e" -#define MSG_SHARED_LIB_ERR "Erreur au chargement de la librairie partag�e %s: %s" -#define MSG_SINGLE_STEP "Pas � pas" -#define MSG_SLEEP "J'ai dormi %d milliseconds" -#define MSG_SMART_SORTING "R�cup�ration des lignes tri�es (passage %d de %d)" -#define MSG_SMART_SORT_ERR "Erreur logique 1 dans Smart Sort" -#define MSG_SORTING "Tri en cours" -#define MSG_SORTING_INDEX "Tri de l'index" -#define MSG_SORTING_VAL "Tri de %d valeurs" -#define MSG_SORT_JOIN_INDEX "Tri de l'index de jointure" -#define MSG_SPCOL_READONLY "La colonne sp�ciale %s est en lecture seulement" -#define MSG_SPEC_CMD_SEP "Les commandes sp�ciales doivent �tre ex�cut�es s�par�ment" -#define MSG_SQL_BAD_TYPE "RephraseSQL: type %d non support�" -#define MSG_SQL_BLOCK_MISM "CheckColumn: bloc SQL courant non correspondant" -#define MSG_SQL_CONF_ERROR "Erreur SQL: SQL_CONFORMANCE" -#define MSG_SQL_READ_ONLY "Les views SQL sont actuellement en lecture seulement" -#define MSG_SRCH_CLOSE_ERR "Erreur � la fermeture de l'Handle de recherche" -#define MSG_SRC_TABLE_UNDEF "La table source n'est pas d�finie" -#define MSG_STACK_ERROR "Erreur sur la pile, i=%d\n" -#define MSG_STACK_OVERFLOW "Parser: D�bordement de la pile\n" -#define MSG_STRG_NOT_FOUND "Cha�ne introuvable" -#define MSG_STRING_INV_LIST "Liste invalide pour SemString" -#define MSG_STRING_TOO_BIG "Cha�ne trop grande pour le domaine %s" -#define MSG_SUBALLOC_ERROR "Pas assez de m�moire en zone %p pour allouer %d (utilis�=%d libre=%d)" -#define MSG_SUBAL_HUGE_ERR "Pas assez de m�moire en zone huge %p pour allouer %d" -#define MSG_SUBARG_NOSEM "Argument @ ou sous-phrase de niveau %d pointe sur un noeud sans Sem" -#define MSG_SUBARG_OUTRANGE "Argument @ ou sous-phrase de niveau %d hors limite" -#define MSG_SUBQRY_ONEITEM "Une Sub-Query ne doit avoir qu'une s�lection" -#define MSG_SUBSET_ERROR "SubSet erreur dans LoadDB" -#define MSG_SUB_OPEN_YET "Subquery d�j� ouverte" -#define MSG_SUB_RES_TOO_LNG "R�sultat trop long pour SUBSTR" -#define MSG_SYNTAX_ERROR "Erreur de syntaxe" -#define MSG_SYSTEM_ERROR "Erreur syst�me %d" -#define MSG_S_ACCESS_DENIED "%s: acc�s non autoris�" -#define MSG_S_ERROR "%s erreur" -#define MSG_S_ERROR_NUM "%s: erreur=%d" -#define MSG_S_INTRUPT_ERROR "%s: erreur interruption" -#define MSG_S_INVALID_PARM "%s: param�tre invalide" -#define MSG_S_INV_ADDRESS "%s: adresse invalide" -#define MSG_S_UNKNOWN_ERROR "%s: erreur de code %u inconnu" -#define MSG_TABDIR_READONLY "Les tables DIR sont en lecture seulement" -#define MSG_TABLE_ALREADY "La table %s existe d�j�" -#define MSG_TABLE_ALTERED "Table %s %s alt�r�e" -#define MSG_TABLE_CREATED "%s table %s cr��e" -#define MSG_TABLE_DROPPED "Table %s supprim�e" -#define MSG_TABLE_MULT_JOIN "Utilisation multiple de la table %s pour jointure" -#define MSG_TABLE_NOT_IN_DB "La table %s n'existe pas dans %s" -#define MSG_TABLE_NOT_OPT "Table non optimisable" -#define MSG_TABLE_NO_INDEX "La table %s n'est pas indexable" -#define MSG_TABLE_NO_OPT "La table %s n'existe pas ou de type non optimisable" -#define MSG_TABLE_READ_ONLY "Les tables %s sont en lecture seulement " -#define MSG_TABMUL_READONLY "Les tables multiples sont en lecture seulement" -#define MSG_TAB_NOT_LOADED " (certaines tables n'ont put �tre charg�es)" -#define MSG_TAB_NOT_SPEC "Table non specifi�e" -#define MSG_TB_VW_NOTIN_DB "Table ou view %s pas dans la base de donn�es" -#define MSG_TDB_NXT_NOT_NUL "Tdb.Next non NULL" -#define MSG_TDB_USE_ERROR "Erreur, Tdbp->Use=%d" -#define MSG_TOO_MANY_COLS "Trop de colonnes" -#define MSG_TOO_MANY_COLTAB "Trop de colonnes dans %s (%d)" -#define MSG_TOO_MANY_FIELDS "Trop de champs ligne %d de %s" -#define MSG_TOO_MANY_JUMPS "Trop de niveaux de saut" -#define MSG_TOO_MANY_KEYS "Trop de cl�s (%d)" -#define MSG_TOO_MANY_POS "Trop de pos_codes" -#define MSG_TOO_MANY_TABLES "Trop de tables (%d)" -#define MSG_TOPSEM_ERROR "Erreur inconnue dans TopSem" -#define MSG_TO_BLK_IS_NULL "To Blk est nul" -#define MSG_TO_FTR_NOT_NULL "Set.To_Ftr n'est pas nul" -#define MSG_TO_PIX_NOT_NULL "Set.To_Pix n'est pas nul" -#define MSG_TO_SEM_NOT_NULL "Set.To_Sem n'est pas nul" -#define MSG_TRUNCATE_ERROR "Erreur en troncation: %s" -#define MSG_TRUNC_BY_ESTIM "Tronqu� par l'option Estimate" -#define MSG_TYPES_ERROR "Erreur sur Types(%d)" -#define MSG_TYPE_CONV_ERROR "Type non convertible dans une expression" -#define MSG_TYPE_DEF_MISM "Disparit� entre type et d�finition" -#define MSG_TYPE_MISMATCH "Cl� et source ne sont pas du m�me type" -#define MSG_TYPE_RECFM_MISM "Disparit� entre Type et Recfm" -#define MSG_TYPE_TO_VERIFY "Type � v�rifier: %d" -#define MSG_TYPE_VALUE_ERR "Colonne %s: disparit� type(%s)/valeur(%s)" -#define MSG_UNBALANCE_QUOTE "Appostrophe en trop ligne %d" -#define MSG_UNDEFINED_AM "COLBLK %s: m�thode d'acc�s ind�finie" -#define MSG_UNDEFINED_PATH "Chemin d'acc�s ind�fini pour Plgcnx.ini" -#define MSG_UNDEF_COL_COUNT "Count sur colonne non d�finie" -#define MSG_UNKNOWN_DOMAIN "Domaine inconnu %s" -#define MSG_UNKNOWN_ERROR "Erreur inconnue" -#define MSG_UNKNOWN_EXCPT "Exception non r�pertori�e" -#define MSG_UNKNOWN_NAME "Nom inconnu: %.8s" -#define MSG_UNKNOWN_PATH "Chemin d'acc�s inconnu pour Plgcnx.ini" -#define MSG_UNKNOWN_POS "Nom pos_code inconnu: %s" -#define MSG_UNKNOWN_SEM "Sem %.8s inconnue, rc=%d" -#define MSG_UNKNOWN_SYNONYM "Synonyme inconnu" -#define MSG_UNKNW_QRY_TYPE "ReadDB: type de requ�te inconnu" -#define MSG_UNKN_ERR_CODE "Erreur de code %d inconnu" -#define MSG_UNLOADABLE " inchargeable: " -#define MSG_UNLOADABLE_PRM "%s inchargeable: %s" -#define MSG_UNMATCH_FIL_ARG "Argument de filtre d�pareill�" -#define MSG_UNQ_COL_SEV_TAB "La colonne %s non qualifi�e est dans plusieurs tables" -#define MSG_UNRESOLVED_ARG "?Argument manquant: %s non r�solu en %d ligne %d" -#define MSG_UPDATE_ERROR "Erreur en Update sur %s" -#define MSG_UPDATING_ROWS "Mise � jour des lignes" -#define MSG_UPD_ZIP_NOT_IMP "Mise � jour des tables ZDOS non encore implement�" -#define MSG_UP_LANGUAGE "Bloc langage %.8s version %d niveau %d charg�" -#define MSG_USED_FREE_MEM "Sarea: utilis� %d, libre %d" -#define MSG_USETEMP_IS "Usetemp est : %s" -#define MSG_USETEMP_RESET ". Usetemp remis � Auto" -#define MSG_USETEMP_SET "Usetemp fix� � %s" -#define MSG_USE_NO_MATCH "Use non correspondant : Use=%d, ti2=%d, ti3=%d" -#define MSG_USING_INDEX " (Index� par" -#define MSG_VALIST_MISMATCH "Disparit� des listes de valeurs" -#define MSG_VALSTR_TOO_LONG "Valeur %s trop longue pour une cha�ne de longueur %d" -#define MSG_VALTYPE_NOMATCH "Disparit� types de valeur" -#define MSG_VALUE_ERROR "Colonne %s: bloc valeur nul" -#define MSG_VALUE_NOT_ALLOC "Valeur non allou�e pour la colonne R%d %s" -#define MSG_VALUE_TOO_BIG "Valeur %lld trop grande pour la colonne %s" -#define MSG_VALUE_TOO_LONG "Valeur %s trop longue pour la colonne %s de longueur %d" -#define MSG_VAL_ALLOC_ERR "Allocation impossible du noeud valeur" -#define MSG_VAL_TOO_LONG "Valeur %s trop longue pour le champ %s" -#define MSG_VIEW_ALREADY "La VIEW %s existe d�j�" -#define MSG_VIEW_CREATED "%s view %s cr��e" -#define MSG_VIEW_DROPPED "View %s supprim�e" -#define MSG_VIEW_NOT_IN_DB "%s n'est pas une View de %s" -#define MSG_VIR_NO_DELETE "Delete impossible sur les tables %s" -#define MSG_VIR_READ_ONLY "Les tables virtuelles %s sont en lecture seulement" -#define MSG_VM_LANG "Langage au format VM, non support�" -#define MSG_VOID_FIRST_ARG "Le premier argument ne doit pas �tre vide" -#define MSG_VOID_IN_STRING "Erreur: cha�ne IN vide" -#define MSG_VOID_ORDER_LIST "Liste de tri vide, erreur syst�me ?" -#define MSG_VOID_POS_DICT "Dictionnaire interne du langage vide" -#define MSG_VOID_QUERY "Requ�te vide %s" -#define MSG_WORK_AREA "Espace de travail: %s" -#define MSG_WORK_TOO_SMALL "Zone de travail trop petite, accro�tre AreaSize" -#define MSG_WRITE_ERROR "Erreur � l'�criture de %s" -#define MSG_WRITE_SEEK_ERR "Erreur de recherche en �criture: %s" -#define MSG_WRITE_STRERROR "Erreur en �criture sur %s: %s" -#define MSG_WRITING "Ecriture" -#define MSG_WRITING_ERROR "Erreur � l'�criture de %s: %s" -#define MSG_WRITING_QUERY "Erreur � l'�criture de la requ�te: " -#define MSG_WRONG_ARG_NUM "La fonction %s ne prend pas %d arguments" -#define MSG_WRONG_COL_NUM "Num�ro de colonne %d trop grand pour %s" -#define MSG_WRONG_DB_LIST "Liste des bases de donn�es incorrecte ou vide" -#define MSG_WRONG_FUNCTION "Mauvaise fonction %d" -#define MSG_WRONG_OP_PARM "Mauvais op�rateur ou param�tres pour %s" -#define MSG_WRONG_PARMS "Mauvais param�tres pour %s" -#define MSG_WRONG_PASSWORD "Mot de passe ill�gal pour %s" -#define MSG_WRONG_TYPE "type non support�" -#define MSG_WRONG_USERFILE "La Userfile a une mauvaise taille %d" -#define MSG_WS_CONV_ERR "Erreur de convertion de %s en WS" -#define MSG_XCOL_MISMATCH "La colonne %s ne correspond pas � l'index" -#define MSG_XDB_DEL_ERROR "Erreur en supprimant des entr�es du fichier XDB" -#define MSG_XFILE_READERR "Erreur %d en lisant le fichier index" -#define MSG_XFILE_TOO_SMALL "Le fichier index est plus petit que la taille de l'index" -#define MSG_XFILE_WRITERR "Erreur en �crivant le fichier index: %s" -#define MSG_XMLTAB_INIT_ERR "Erreur d'initialisation de la table XML" -#define MSG_XML_INIT_ERROR "Erreur d'initialisation du nouveau fichier XML" -#define MSG_XPATH_CNTX_ERR "Le nouveau contexte XPath ne peut �tre cr��" -#define MSG_XPATH_EVAL_ERR "Impossible d'�valuer l'emplacement xpath '%s'" -#define MSG_XPATH_NOT_SUPP "Xpath non support� colonne %s" -#define MSG_X_ARG_ADDED "%d arguments ajout�s" -#define MSG_X_ARG_SET "%d arguments ont �t� initialis�s" -#define MSG_X_ON_TAB " %s sur %s(" -#define MSG_ZERO_DIVIDE "Division par z�ro dans une expression" diff --git a/storage/connect/frmsg2.h b/storage/connect/frmsg2.h deleted file mode 100644 index 487db3395fb51..0000000000000 --- a/storage/connect/frmsg2.h +++ /dev/null @@ -1,1013 +0,0 @@ -#define MSG_ACCESS_VIOLATN "Violation acc�s m�moire" -#define MSG_ACT_ALLOC_FAIL "PlugInitLang: Erreur d'allocation du bloc Activity" -#define MSG_ADDVAL_ERROR "Erreur %d dans AddValue" -#define MSG_ADD_BAD_TYPE "Ajout d'une valeur de type %s non conforme dans un tableau %s" -#define MSG_ADD_NULL_DOM "Ajout de la cha�ne %s � un domaine nul" -#define MSG_ADPOS_IN_DICTP "ADPOS au travail dans User_Dictp" -#define MSG_AFTER " apr�s: " -#define MSG_ALG_CHOICE_AUTO "Le choix du meilleur algorithme est automatique" -#define MSG_ALG_CHOICE_BAD "Choix d'algorithme invalide, remis � AUTO" -#define MSG_ALG_CHOICE_QRY "Utilise l'algorithme 'Query'" -#define MSG_ALG_CURLY_BRK "Le choix de l'algorithme d�pend des accolades externes" -#define MSG_ALLOC_ERROR "Erreur d'allocation de %s" -#define MSG_ALL_DELETED "Toutes les lignes enlev�es en %.2lf sec" -#define MSG_ALTER_DB_ERR "Impossible de d�terminer la base de donn�es � modifier" -#define MSG_AMBIG_COL_QUAL "Qualificateur ambigu %s pour la colonne %s" -#define MSG_AMBIG_CORREL "Select %s.* corr�lation ambigue" -#define MSG_AMBIG_SPEC_COL "Colonne sp�ciale ambigue %s" -#define MSG_ANSWER_TYPE "R�ponse de type" -#define MSG_API_CONF_ERROR "Erreur SQL: API_CONFORMANCE" -#define MSG_APPL_ACCESSIBLE "Application %s accessible" -#define MSG_APPL_ACTIVE "Application %s encore active" -#define MSG_APPL_BAD_SAVE "Application %s partiellement sauvegard�e" -#define MSG_APPL_CREATED "Application %s cr��" -#define MSG_APPL_IS_ACTIVE "Application d�j� active" -#define MSG_APPL_NOT_INIT "Application non initialis�e" -#define MSG_APPL_NOT_LOADED "Application non charg�e" -#define MSG_APPL_QUIT "Fin de l'application %s" -#define MSG_APPL_SAVED "Application %s sauvegard�e" -#define MSG_APP_STILL_ACTIV "Application du langage %s encore active (non lib�rable)" -#define MSG_AREAFILE_NOTFND "Fichier Area introuvable" -#define MSG_ARGS_SYNTAX_ERR "?SetArgs erreur de syntaxe: %s inattendu apr�s %s" -#define MSG_ARG_ALREADY_SET "Argument %d d�j� allou�" -#define MSG_ARG_NOT_AN_ATTR "L'argument n'est pas un attribut (type %d erron�)" -#define MSG_ARG_OUT_CONTEXT "Argument de type @ utilis� hors contexte" -#define MSG_ARG_OUT_RANGE "Argument de phrase valant %d hors limite" -#define MSG_ARG_PTR_NOSEM "Argument valant %d pointe sur un noeud sans Sem" -#define MSG_ARG_PTR_NOSEMS "Argument valant %d pointe sur un noeud sans s�mantique" -#define MSG_ARG_REF_LOOP "?Bouclage entre r�f�rences crois�es des arguments" -#define MSG_ARG_TWO_CONST "Le 2�me argument de %s doit �tre constant" -#define MSG_ARRAY_ALLOC_ERR "Erreur d'allocation m�moire dans ARRAY" -#define MSG_ARRAY_BNDS_EXCD "Hors limite de tableau" -#define MSG_ARRAY_ERROR "Erreur de fonctionnement k=%d n=%d" -#define MSG_ATTRIBUTE_ERROR "Erreur r�gle %u attribut %s: " -#define MSG_ATT_NOT_CASE "Mauvaise valeur %d pour attribut (pas une CaseValue)" -#define MSG_ATT_POSCODE_BIG "Code attribut %d trop grand (max=%d)" -#define MSG_AVGLEN_ERROR "avglen doit �tre entre %d et %d" -#define MSG_BAD_AGGREG_FUNC "Fonction aggr�g�e %d non support�e" -#define MSG_BAD_ARGTYPES "Argument de type invalide pour %s" -#define MSG_BAD_ARGUMENTS "Argument non attach�s pour %s" -#define MSG_BAD_ARG_NUM "Nombre d'arguments invalide %d" -#define MSG_BAD_ARG_TYPE "Type d'argument %d invalide" -#define MSG_BAD_ARRAY_OPER "Les tableaux doivent utiliser l'op�rateur IN" -#define MSG_BAD_ARRAY_TYPE "Type=%d invalide pour un tableau" -#define MSG_BAD_ARRAY_VAL "Les tableaux doivent avoir le m�me nombre de valeurs" -#define MSG_BAD_BIN_FMT "Format invalide %c pour la colonne BIN %s" -#define MSG_BAD_BLK_ESTIM "Nombre de blocs sup�rieur � l'estimation" -#define MSG_BAD_BLK_SIZE "Taille du bloc %d non conforme" -#define MSG_BAD_BYTE_NUM "Le nombre d'octets �crits est faux" -#define MSG_BAD_BYTE_READ "Le nombre d'octets lus est faux" -#define MSG_BAD_CARDINALITY "Appel invalide de Cardinality pour une table multiple" -#define MSG_BAD_CASE_SPEC "Min/Maj: sp�cification %c incorrecte, recommencez: " -#define MSG_BAD_CHAR_SPEC "Sp�cification '%s' invalide pour caract�re" -#define MSG_BAD_CHECK_TYPE "Sous-type %d invalide pour CheckColumn" -#define MSG_BAD_CHECK_VAL "Valeur pour Check invalide '%s'" -#define MSG_BAD_COLCRT_ARG "COLCRT: Arg invalide (type=%hd, domain=%hd)" -#define MSG_BAD_COLDEF_TYPE "Coldefs: type ill�gal %d" -#define MSG_BAD_COLIST_ITEM "El�ment invalide dans une Colist" -#define MSG_BAD_COLIST_TYPE "Mauvais type=%d pour une Colist" -#define MSG_BAD_COLSIZE "Colsize %d trop petit pour cette base de donn�es" -#define MSG_BAD_COL_ENTRY "Entr�e invalide pour la colonne %s" -#define MSG_BAD_COL_FORMAT "Type de formattage %d invalide pour une colonne" -#define MSG_BAD_COL_IN_FILT "Colonne incorrecte dans un filtre" -#define MSG_BAD_COL_QUALIF "Qualificateur invalide %s pour la colonne %s" -#define MSG_BAD_COL_TYPE "Type invalide %s pour la colonne %s" -#define MSG_BAD_COL_XPATH "Xpath invalide colonne %s de la table HTML %s" -#define MSG_BAD_COMPARE_OP "Op�rateur de comparaison %d invalide" -#define MSG_BAD_CONST_TYPE "Type=%d invalide pour une constante" -#define MSG_BAD_CONV_TYPE "Convertion de type invalide %d" -#define MSG_BAD_CORREL "Select %s.* corr�lation absente" -#define MSG_BAD_DATETIME "Valeur date/temps invalide" -#define MSG_BAD_DATE_OPER "Op�rateur de date inattendu %d" -#define MSG_BAD_DBF_FILE "Le fichier DBF %s est alt�r�" -#define MSG_BAD_DBF_REC "Fichier DBF %s alt�r� enregistrement %d" -#define MSG_BAD_DBF_TYPE "Type DBF %c non support�" -#define MSG_BAD_DEF_ARG "Argument invalide pour INDEXDEF (type=%hd, domain=%hd)" -#define MSG_BAD_DEF_READ "EOF inattendue en lecture diff�r�e" -#define MSG_BAD_DEF_TYPE "Type de colonne invalide" -#define MSG_BAD_DIRECTORY "R�pertoire invalide %s: %s" -#define MSG_BAD_DIST_JN_FIL "Filtre de jointure distincte invalide" -#define MSG_BAD_DIST_JOIN "Sp�cification invalide de jointure distincte" -#define MSG_BAD_DOM_COL_DEF "D�finition de colonnes invalide pour un domaine" -#define MSG_BAD_DOM_VALUE "La valeur %d n'appartient pas au domaine" -#define MSG_BAD_EDIT_INIT "Coparm: �dition %s initialis�e improprement" -#define MSG_BAD_EVAL_TYPE "Fonction scalaire de type=%d invalide" -#define MSG_BAD_EXEC_MODE "Mode d'ex�cution invalide '%s'" -#define MSG_BAD_EXP_ARGTYPE "Argument de type %d invalide pour une expression" -#define MSG_BAD_EXP_OPER "Op�rateur=%d invalide pour expression" -#define MSG_BAD_FETCH_RC "Code retour inattendu de Fetch %d" -#define MSG_BAD_FIELD_FMT "Format de champ invalide %c pour %s" -#define MSG_BAD_FIELD_RANK "Rang %d invalide pour la colonne %s" -#define MSG_BAD_FIELD_TYPE "Mauvais type de champ %s" -#define MSG_BAD_FILE_HANDLE "Handle de fichier invalide: %s" -#define MSG_BAD_FILE_LIST "La section liste de fichiers est erron�e" -#define MSG_BAD_FILTER "Mauvais filtre: Opc=%d B_T=%d %d Type=%d %d" -#define MSG_BAD_FILTER_CONV "Conversion filtre incorrecte, B_T=%d,%d" -#define MSG_BAD_FILTER_LINK "Op�rateur de cha�nage ill�gal %d" -#define MSG_BAD_FILTER_OP "Op�rateur de filtre invalide %d" -#define MSG_BAD_FILTEST_OP "Op�rateur invalide %d %d pour FilTest" -#define MSG_BAD_FLD_FORMAT "Format invalide pour le champs %d de %s" -#define MSG_BAD_FLD_LENGTH "Champs %s trop long (%s --> %d) ligne %d de %s" -#define MSG_BAD_FLOAT_CONV "Convertion invalide d'un tableau flottant" -#define MSG_BAD_FPARM_NEXT "Coparm: FPARM avec Next non nul" -#define MSG_BAD_FREQ_SET "Sp�cification erronn�e de Freq pour la colonne %s" -#define MSG_BAD_FUNC_ARG "Funcarg de type %d non impl�ment�" -#define MSG_BAD_FUNC_ARGTYP "Mauvais type d'argument=%d pour une fonction" -#define MSG_BAD_FUNC_MODE "%s: mode invalide %d" -#define MSG_BAD_GENRE "Genre est invalide" -#define MSG_BAD_GETVIEW_RET "GetView: type de retour %d invalide" -#define MSG_BAD_HANDLE_VAL "Valeur Handle invalide" -#define MSG_BAD_HAV_FILTER "Filtre Having sur une requ�te non group�e" -#define MSG_BAD_HAV_FILTYPE "Filtre invalide pour clause Having" -#define MSG_BAD_HEADER "Fichier %s: bloc en-t�te alt�r�" -#define MSG_BAD_HEADER_VAL "Valeur invalide pour Header" -#define MSG_BAD_HEAD_END "Lecture fin d'en-t�te impossible" -#define MSG_BAD_INDEX_COL "Colonne %s invalide pour index %s" -#define MSG_BAD_INDEX_DEF "D�finition invalide pour index %s" -#define MSG_BAD_INDEX_FILE "Fichier index %s corrompu" -#define MSG_BAD_INDEX_PART "D�finition colonne invalide pour index %s" -#define MSG_BAD_INPUT "Entr�e incorrecte" -#define MSG_BAD_IN_ARGTYPE "Argument de type invalide pour l'op�rateur IN" -#define MSG_BAD_IN_ENDING "Erreur: fin de cha�ne IN invalide" -#define MSG_BAD_IN_STRING "La cha�ne IN commence ou finie par des caract�res invalides %c ... %c" -#define MSG_BAD_JCOL_TYPE "Erreur logique JCT: disparit� des types colonnes" -#define MSG_BAD_JOIN_EXP "Expression invalide pour une jointure" -#define MSG_BAD_JOIN_FILTER "Filtre de jointure invalide" -#define MSG_BAD_JOIN_OP "Op�rateur de joint invalide %d" -#define MSG_BAD_LANG_SIZE "Le fichier langage a une mauvaise taille %d" -#define MSG_BAD_LINEFLD_FMT "Format invalide ligne %d champs %d de %s" -#define MSG_BAD_LINE_LEN "Longueur ligne non �gale � Lrecl" -#define MSG_BAD_LIST_TYPE "Type de liste invalide %d" -#define MSG_BAD_LOCALE "Locale invalide %s" -#define MSG_BAD_LOCDFON_ARG "Mauvais param�tre pour LOCDFON" -#define MSG_BAD_LOCNODE_USE "Usage inattendu de LOCNODE" -#define MSG_BAD_LRECL "Disparit� lrecl table/fichier (%d,%hd)" -#define MSG_BAD_MAX_HAVING "MAXTMP trop petit pour Having" -#define MSG_BAD_MAX_NREC "MaxRec=%d ne correspond pas � MaxBlk=%d Nrec=%d" -#define MSG_BAD_MAX_PARAM "Mauvais param�tres pour sp�cifier une valeur maximum" -#define MSG_BAD_MAX_SETTING "Mauvaise valeur '%c' pour max" -#define MSG_BAD_MERGE_TYPE "Le type %d ne pas �tre intercall�" -#define MSG_BAD_NODE_TYPE "Type noeud erron� pour la table" -#define MSG_BAD_OFFSET_VAL "Nul offset invalide pour une table CSV" -#define MSG_BAD_OPEN_MODE "Mode d'ouverture invalide %d" -#define MSG_BAD_OPERATOR "Op�rateur invalide %s" -#define MSG_BAD_ORDER_MODE "Mode de tri %c invalide" -#define MSG_BAD_ORDER_TYPE "Tri sur objet de type=%d invalide" -#define MSG_BAD_OUTER_JOIN "Jointure externe invalide sur table enfant" -#define MSG_BAD_PAD_ARGTYP "Argument de type invalide pour Pad ou Justify" -#define MSG_BAD_PARAMETERS "%.8s: Mauvais param�tres" -#define MSG_BAD_PARAM_TYPE "%.8s: Param�tre de type=%d invalide" -#define MSG_BAD_PARM_COUNT "Nombre de param�tres incoh�rent" -#define MSG_BAD_PHASE_NUM "Num�ro de phrase %d hors limite" -#define MSG_BAD_PHRASE_NB "num�ro de phrase hors limite %d rc=%d\n" -#define MSG_BAD_POS_CODE "POS_code invalide %d" -#define MSG_BAD_POS_TYPE "Type de POS_code invalide %d" -#define MSG_BAD_PROJNUM "Mauvais projnum %d pour la colonne %s" -#define MSG_BAD_QUERY_OPEN "Mode invalide %d pour l'ouverture d'une requ�te" -#define MSG_BAD_QUERY_TYPE "Type de requ�te %d invalide pour %s" -#define MSG_BAD_QUOTE_FIELD "Quote manquante dans %s champs %d ligne %d" -#define MSG_BAD_READ_NUMBER "Mauvais nombre %d de valeurs lues dans %s" -#define MSG_BAD_RECFM "Recfm type %d invalide pour DOSCOL" -#define MSG_BAD_RECFM_VAL "Valeur invalide %d de Recfm" -#define MSG_BAD_RESULT_TYPE "Mauvais type de r�sultat %d pour %s" -#define MSG_BAD_RETURN_TYPE "Type de retour %d incorrect" -#define MSG_BAD_ROW_VALIST "Liste de valeurs invalide pour ROW" -#define MSG_BAD_ROW_VALNB "Nombre de valeurs in�gal dans la liste" -#define MSG_BAD_SCF_ARGTYPE "Argument %d de type=%s invalide pour %s" -#define MSG_BAD_SEM_DOMAIN "Domain .%d invalide" -#define MSG_BAD_SETTINGS "Certaines sp�cifications sont incompatibles avec le type de la table" -#define MSG_BAD_SET_CASE "La casse d'un tableau ne peut pas passer de non respect � respecter" -#define MSG_BAD_SET_STRING "SetValue: appel invalide pour STRING" -#define MSG_BAD_SET_TYPE "Set type %hd invalide" -#define MSG_BAD_SPECIAL_CMD "Commande sp�ciale invalide" -#define MSG_BAD_SPECIAL_COL "Colonne sp�ciale invalide %s" -#define MSG_BAD_SPEC_COLUMN "Colonne sp�ciale invalide pour ce type de table" -#define MSG_BAD_SQL_PARAM "Param�tre SQL invalide pour FindColblk" -#define MSG_BAD_SUBLST_TYPE "Coparm: type %d de sous-liste invalide" -#define MSG_BAD_SUBSEL_IN_X "Sub-select invalide pour une expression" -#define MSG_BAD_SUBSEL_TYPE "Type %d invalide retourn� de Sub-Select" -#define MSG_BAD_SUB_RESULT "R�sultat ind�fini de fonction Sub-Select" -#define MSG_BAD_SUB_SELECT "Sub-select invalide comme argument de fonction" -#define MSG_BAD_TABLE_LINE "Ligne '%s' ill�gale ou tronqu�e dans la section Tables" -#define MSG_BAD_TABLE_LIST "Table %s absente de la liste des tables" -#define MSG_BAD_TABLE_TYPE "Type invalide %s pour la table %s" -#define MSG_BAD_TEST_TYPE "BlockTest sur tableau: types d�pareill�s %s %s" -#define MSG_BAD_TRIM_ARGTYP "Argument de type invalide pour Trim" -#define MSG_BAD_TYPE_FOR_IN "Types d'argument incompatibles pour la fonction IN" -#define MSG_BAD_TYPE_FOR_S "Type incorrecte %d pour %s(%d)" -#define MSG_BAD_TYPE_LIKE "Type(%d)= %d invalide pour LIKE" -#define MSG_BAD_UPD_COR "Le qualificateur %s de la colonne %s ne se ref�re pas � la table mise � jour %s" -#define MSG_BAD_USERBLK_LEN "Mauvaise longueur � l'�criture du bloc utilisateur" -#define MSG_BAD_USETEMP "Usetemp invalide '%s'" -#define MSG_BAD_USETEMP_VAL "Valeur pour Usetemp invalide %d" -#define MSG_BAD_VALBLK_INDX "Valeur hors limites de l'index du bloc de valeurs" -#define MSG_BAD_VALBLK_TYPE "Type=%d invalide pour un bloc de valeurs" -#define MSG_BAD_VALNODE "Type %d invalide pour le noeud valeur colonne %s" -#define MSG_BAD_VALUE_TYPE "Type de valeur invalide %d" -#define MSG_BAD_VAL_UPDATE "Impossible de d�terminer quelle valeur %s doit �tre mise � jour" -#define MSG_BAD_VIEW_OPEN "Mode invalide %d pour l'ouverture d'une View" -#define MSG_BAD_XMODE_VAL "Mode d'ex�cution %d invalide" -#define MSG_BAD_XOBJ_TYPE "Mauvais type de Xobject %d" -#define MSG_BAS_NS_LIST "Format invalide de la liste des espace-noms" -#define MSG_BIN_F_TOO_LONG "Valeur trop longue pour le champ %s (%d --> %d)" -#define MSG_BIN_MODE_FAIL "Echec mode binaire: %s" -#define MSG_BLKTYPLEN_MISM "Disparit� types/longueurs de bloc dans SetValue" -#define MSG_BLK_IS_NULL "Blk est nul" -#define MSG_BLOCK_NO_MATCH "Bloc non correspondant" -#define MSG_BREAKPOINT "Point de controle" -#define MSG_BUFF_TOO_SMALL "GetColData: Buffer trop petit" -#define MSG_BUFSIZE_ERROR "Erreur en recherchant la taille du buffer" -#define MSG_BUILDING_GROUPS "Formation des groupes" -#define MSG_BUILD_DIST_GRPS "Formation des groupes distinctes" -#define MSG_BUILD_INDEX "Construction index %s sur %s" -#define MSG_BXP_NULL "Bxp nul dans PUTFON" -#define MSG_CANNOT_OPEN "Ouverture impossible de %s" -#define MSG_CD_ONE_STEP "Count Distinct doit �tre ex�cut� en une seule �tape" -#define MSG_CD_ORDER_ERROR "Erreur de tri dans Count Distinct" -#define MSG_CHECKING_ROWS "Test des lignes � mettre � jour" -#define MSG_CHECK_LEVEL "Niveau de v�rification fix� � %u" -#define MSG_CHSIZE_ERROR "Erreur dans chsize: %s" -#define MSG_CLN_NOT_IN_JOIN "La colonne C%d n'est pas dans le join" -#define MSG_CNTDIS_COL_LOST "Colonne du Count Distinct perdue" -#define MSG_COLIST_BAD_TYPE "Type=%d invalide pour Colist" -#define MSG_COLNAM_TOO_LONG "Nom de colonne trop long" -#define MSG_COLSEC_TOO_BIG "Section colonne trop grande, table %s (%d)" -#define MSG_COLS_REDUCED " (r�duit par Maxcol)" -#define MSG_COLUMN_ERROR "Erreur de colonne" -#define MSG_COLUMN_MISMATCH "Colonne %s d�pareill�e" -#define MSG_COLUMN_NOT_KEY "La colonne jointe R%d.%s n'est pas une cl�" -#define MSG_COL_ALLOC_ERR "Allocation impossible du noeud colonne" -#define MSG_COL_ALLOC_ERROR "Erreur d'allocation m�moire pour la colonne %d" -#define MSG_COL_HAS_NO_DEF "La colonne %s n'est pas d�finie" -#define MSG_COL_INVAL_TABLE "La colonne %s.%s n'existe pas dans la table %s alias %s" -#define MSG_COL_ISNOT_TABLE "La colonne %s n'est pas dans la table %s" -#define MSG_COL_NB_MISM "Le nombre de colonnes ne correspond pas" -#define MSG_COL_NOTIN_GRPBY "La colonne %s n'est pas dans la liste de Group By" -#define MSG_COL_NOTIN_TABLE "La colonne %s n'est dans aucune table" -#define MSG_COL_NOTIN_UPDT "%s n'appartient pas � la table mise � jour %s" -#define MSG_COL_NOT_CODED "La colonne %s n'est pas codifi�e" -#define MSG_COL_NOT_EXIST "La colonne %s n'existe pas dans %s" -#define MSG_COL_NOT_FOUND "La colonne %s n'est pas dans la table %s" -#define MSG_COL_NOT_IN_DB "La colonne %s de la table %s n'est pas dans la base de donn�es" -#define MSG_COL_NOT_IN_JOIN "La colonne %s n'est pas dans le join" -#define MSG_COL_NOT_SORTED "La colonne %s de la table %s n'est pas tri�e" -#define MSG_COL_NUM_MISM "Disparit� du nombre de colonnes" -#define MSG_COL_USED_TWICE "Colonne %s utilis�e deux fois ???" -#define MSG_COMPUTE_ERROR "Erreur dans Compute, op=%d" -#define MSG_COMPUTE_NIY "Compute non impl�ment� pour TOKEN" -#define MSG_COMPUTING "Calculs en cours" -#define MSG_COMPUTING_DIST "Comptage des valeurs distinctes" -#define MSG_COMPUTING_FUNC "Calcul de(s) fonction(s)" -#define MSG_COM_ERROR "Erreur Com" -#define MSG_CONCAT_SUBNODE "Concat�nation de sous-noeuds impossible" -#define MSG_CONNECTED "Connect�e" -#define MSG_CONNECT_CANCEL "Connection interrompue par l'utilisateur" -#define MSG_CONNECT_ERROR "Erreur %d se connectant � %s" -#define MSG_CONN_CLOSED "%s(%d) ferm�e" -#define MSG_CONN_CREATED "Connexion %s cr�e" -#define MSG_CONN_DROPPED "Connexion %s supprim�e" -#define MSG_CONN_OPEN "%s(%d) ouverte (%s)" -#define MSG_CONN_SUC_OPEN "%s(%d) ouverte avec succ�s" -#define MSG_CONTROL_C_EXIT "Exit par Ctrl-C" -#define MSG_COPY_BAD_PHASE "Copie de liste invalide en phase %d" -#define MSG_COPY_INV_TYPE "Coparm: type non support� %d" -#define MSG_CORREL_NO_QRY "Les sous-requ�tes corr�l�es ne peuvent pas �tre de type QRY" -#define MSG_CREATED_PLUGDB " Cr�� par PlugDB %s " -#define MSG_CURSOR_SET "Curseur remis � %d" -#define MSG_DATABASE_ACTIVE "Base de donn�es %s activ�e" -#define MSG_DATABASE_LOADED "Base de donn�es %s charg�e" -#define MSG_DATA_IS_NULL "ExecSpecialCmd: data est NULL" -#define MSG_DATA_MISALIGN "Mauvais alignement pour ce type de donn�es" -#define MSG_DBASE_FILE "Fichier dBASE dbf: " -#define MSG_DB_ALREADY_DEF "Base de donn�es %s d�j� d�finie" -#define MSG_DB_ALTERED "Base de donn�es modifi�e" -#define MSG_DB_CREATED "Base de donn�es %s cr��e" -#define MSG_DB_NOT_SPEC "Base de donn�es non sp�cifi�e" -#define MSG_DB_REMOVED "Base de donn�es %s retir�e de la liste" -#define MSG_DB_SORT_ERROR "Erreur de tri DB" -#define MSG_DB_STOPPED "Arr�t de la base de donn�es %s" -#define MSG_DEBUG_NOT_ACTIV "Mode Debug inactif" -#define MSG_DEBUG_SET_INV "Invalide pour Debug: %c" -#define MSG_DEF_ALLOC_ERROR "Erreur d'allocation de la classe DEF %s" -#define MSG_DELETING_ROWS "Suppression des lignes" -#define MSG_DEL_FILE_ERR "Erreur � l'effacement de %s" -#define MSG_DEL_READ_ERROR "Delete: erreur en lecture req=%d len=%d" -#define MSG_DEL_WRITE_ERROR "Delete: erreur en �criture: %s" -#define MSG_DEPREC_FLAG "Option Flag p�rim�e, utiliser Coltype" -#define MSG_DICTIONARY "Dictionnaire " -#define MSG_DIRECT_VARTOK "Acc�s direct aux r�gles du Variable Token non impl�ment�" -#define MSG_DISCONNECTED "D�connect�" -#define MSG_DISTINCT_ERROR "Plus d'un �l�ment fonctionel DISTINCT" -#define MSG_DISTINCT_ROWS "S�lection des lignes distinctes" -#define MSG_DISTINCT_VALUES "Extraction des valeurs distinctes" -#define MSG_DIS_NOHEAD_JOIN "Jointure distincte sur une table non en t�te" -#define MSG_DLL_LOAD_ERROR "Erreur %d au chargement du module %s" -#define MSG_DOMAIN_EMPTY "Le domaine %s est vide" -#define MSG_DOMAIN_ERROR "Colonne %s: disparit� domaine(%s)/valeur(%s)" -#define MSG_DOMAIN_FULL "Le domaine %s est plein (max=%d)" -#define MSG_DOM_FILE_ERROR "Fichier domain %s introuvable" -#define MSG_DOM_NOT_SUPP "MS-DOM non support� par cette version" -#define MSG_DOM_OPEN_ERROR "Erreur d'ouverture du domaine: %s" -#define MSG_DOM_READ_ERROR "Erreur %d en lecture de domaine: %s" -#define MSG_DOM_READ_ONLY "La table domaine %s est en lecture seulement" -#define MSG_DOM_WRITE_ERROR "Erreur %d en �criture de domaine: %s" -#define MSG_DONE "Effectu�, rc=%d" -#define MSG_DOSALMEM_NOMEM "Erreur d'allocation, pas assez de m�moire" -#define MSG_DROP_DB_ERR "Echec du Drop sur le base de donn�es %s" -#define MSG_DSORT_LOG_ERROR "Kindex: Erreur logique de tri distincte" -#define MSG_DUMMY_NO_COLS "Les tables DUMMY ne peuvent pas avoir de colonne" -#define MSG_DUPLICAT_COUNT "Count sur plus d'une colonne" -#define MSG_DUP_COL_NAME "La colonne %s existe en double" -#define MSG_DUP_PROJNUM "Non unique projnum %d pour la colonne %s" -#define MSG_DVAL_NOTIN_LIST "Valeur %s non trouv�e dans la liste des valeurs distinctes de la colonne %s" -#define MSG_EMPTY_DOC "Document vide" -#define MSG_EMPTY_FILE "%s du fichier vide %s: " -#define MSG_ENDSTR_MISMATCH "Fins de cha�ne et de noeud ne correspondent pas" -#define MSG_END_OF_DELETE "%d ligne(s) enlev�e(s) en %.2lf sec" -#define MSG_END_OF_INSERT "%d ligne(s) ins�r�e(s) en %.2lf sec" -#define MSG_END_OF_QUERY "%d ligne(s) extraite(s) en %.2lf sec" -#define MSG_END_OF_UPDATE "%d ligne(s) modifi�e(s) en %.2lf sec" -#define MSG_EOF_AFTER_LINE "Fin de fichier apr�s la ligne %d" -#define MSG_EOF_INDEX_FILE "EOF lisant le fichier index" -#define MSG_ERASED " et effac�e" -#define MSG_ERASE_FAILED " (�chec de l'effacement)" -#define MSG_ERROR "Erreur" -#define MSG_ERROR_IN_LSK "Erreur %d dans lseek64" -#define MSG_ERROR_IN_SFP "Erreur %d dans SetFilePointer" -#define MSG_ERROR_NO_PARM "Param�tre absent (valide seulement pour %.8s.1 et %.8s.5)" -#define MSG_ERROR_OPENING "Erreur � l'ouverture de : " -#define MSG_ERR_NUM_GT_MAX "Erreur: Numval (%d) plus grand que Maxnum (%d)" -#define MSG_ERR_READING_REC "Erreur lisant l'enregistrement %d de %s" -#define MSG_ERR_RET_RULE "Retour erreur, r�gle=%u" -#define MSG_ERR_RET_TYPE "Retour erreur, type=%d" -#define MSG_EVAL_EXPIRED "Cette version d'�valuation est expir�e" -#define MSG_EVAL_ONLY "L'utilisation de cette Dll est pour �valuation seulement" -#define MSG_EXECUTING "Ex�cution" -#define MSG_EXECUTION_ERROR "Erreur d'ex�cution" -#define MSG_EXEC_MODE_IS "Le mode d'ex�cution est %s" -#define MSG_EXEC_MODE_RESET ". Mode remis � Execute" -#define MSG_EXEC_MODE_SET "Mode d'ex�cution fix� � %s" -#define MSG_EXIT_EVAL_ERR "Erreur pendant l'�valuation de Exit" -#define MSG_EXIT_FROM_LANG "Fin du langage %s version %d.%d" -#define MSG_FAIL_ADD_NODE "L'ajout du noeud %s dans la table a �chou�" -#define MSG_FETCHING_DATA "Recherche des donn�es" -#define MSG_FETCHING_ROWS "Recherche des lignes" -#define MSG_FETCH_NO_RES "Fetch: Pas de R�sultats" -#define MSG_FIELD_TOO_LONG "Valeur trop longue pour le champs %d ligne %d" -#define MSG_FILELEN_ERROR "Erreur dans %s pour %s" -#define MSG_FILE_CLOSE_ERR "Erreur %d � la fermeture du fichier" -#define MSG_FILE_IS_EMPTY "Le fichier %s est vide" -#define MSG_FILE_MAP_ERR "Erreur de File mapping" -#define MSG_FILE_MAP_ERROR "CreateFileMapping %s erreur rc=%d" -#define MSG_FILE_NOT_FOUND "Fichier %s introuvable" -#define MSG_FILE_OPEN_YET "Fichier %s d�j� ouvert" -#define MSG_FILE_UNFOUND "Fichier %s non trouv�" -#define MSG_FILGRP_NO_TABLE "Table %d manquante pour groupe filtre" -#define MSG_FILTER_ATTACH "Filtre pass� � Attach" -#define MSG_FILTER_NO_TABLE "Filtre: premi�re table manquante" -#define MSG_FIND_BAD_TYPE "Recherche dans un tableau: type non conforme %s %s" -#define MSG_FIX_OVFLW_ADD "D�passement de capacit� en addition" -#define MSG_FIX_OVFLW_TIMES "D�passement de capacit� en mutiplication" -#define MSG_FIX_UNFLW_ADD "Sous d�passement de capacit� en addition" -#define MSG_FIX_UNFLW_TIMES "Sous d�passement de capacit� en multiplication" -#define MSG_FLD_TOO_LNG_FOR "Champs %d trop long pour %s ligne %d de %s" -#define MSG_FLTST_NO_CORREL "FilTest ne devrait �tre appel� que pour les sous-requ�tes corr�l�es" -#define MSG_FLT_BAD_RESULT "Virgule flottante: r�sultat inexacte" -#define MSG_FLT_DENORMAL_OP "Op�rande virgule flottante non normalis�" -#define MSG_FLT_INVALID_OP "Op�ration virgule flottante invalide" -#define MSG_FLT_OVERFLOW "D�passement de capacit� virgule flottante" -#define MSG_FLT_STACK_CHECK "Virgule flottante: Erreur de la pile" -#define MSG_FLT_UNDERFLOW "Sous-d�passement de capacit� virgule flottante" -#define MSG_FLT_ZERO_DIVIDE "Virgule flottante: division par z�ro" -#define MSG_FMT_WRITE_NIY "L'�criture des fichiers %s n'est pas encore impl�ment�e" -#define MSG_FNC_NOTIN_SLIST "Fonction de tri absente de la liste de s�lection" -#define MSG_FORMAT_ERROR "Erreur de formattage" -#define MSG_FOXPRO_FILE "Fichier FoxPro: " -#define MSG_FPUTS_ERROR "Erreur dans fputs: %s" -#define MSG_FSBPARP_NULL "PUTFON: fsbparp est nul" -#define MSG_FSEEK_ERROR "Erreur dans fseek: %s" -#define MSG_FSETPOS_ERROR "Erreur dans fseek pour i=%d" -#define MSG_FTELL_ERROR "Erreur dans ftell enregistrement=%d: %s" -#define MSG_FUNCTION_ERROR "Erreur dans %s: %d" -#define MSG_FUNC_ERRNO "Erreur %d dans %s" -#define MSG_FUNC_ERROR "Erreur dans %s" -#define MSG_FUNC_ERR_S "Erreur dans %s: %s" -#define MSG_FUNC_REF_DEL "R�f�rence � une fonction d�finie (r�gle %d) qui a �t� supprim�e" -#define MSG_FWRITE_ERROR "Erreur dans fwrite: %s" -#define MSG_GETCWD_ERR_NO "?getcwd %s errno=%d" -#define MSG_GETFILESIZE_ERR "Erreur %d dans GetFileSize" -#define MSG_GET_DIST_VALS "R�cup�ration des valeurs distinctes de " -#define MSG_GET_ERROR "Erreur dans %s (colonne %d)" -#define MSG_GET_FUNC_ERR "Erreur en recherche de la fonction %s: %s" -#define MSG_GET_NAME_ERR "Erreur en retrouvant le nom d'une table SYS" -#define MSG_GLOBAL_ERROR "Erreur d'allocation de Global (taille=%d)\n" -#define MSG_GRAM_ALLOC_ERR "Erreur d'allocation dans Grammar Up" -#define MSG_GRAM_MISMATCH "Avertissement: version de GRAMMAR p�rim�e (sauv� sous GRAMMAR v%u)" -#define MSG_GRAM_SUBSET_ERR "Erreur d'initialisation du dictionnaire de la grammaire" -#define MSG_GRBY_TAB_NOTIMP "Group by avec tables jointes non impl�ment�" -#define MSG_GROUPBY_NOT_ALL "Group By doit inclure toutes les s�lections non-fonctionnelles" -#define MSG_GROUP_ON_FUNC "Group by invalide sur colonne fonctionnelle" -#define MSG_GRP_COL_MISM "Disparit� colonne des groupes" -#define MSG_GRP_LIST_MISMAT "Le groupement ne couvre pas la liste de s�lection" -#define MSG_GUARD_PAGE "Violation de page de garde" -#define MSG_GZOPEN_ERROR "gzopen %s: erreur %d sur %s" -#define MSG_GZPUTS_ERROR "Erreur dans gzputs: %s" -#define MSG_HANDLE_IS_NULL "%s est NULL: erreur code: %d" -#define MSG_HARRY_COMP_NIY "Compute non impl�ment� pour les cha�nes cod�es" -#define MSG_HAVING_FILTER "Traitement du Filtre Having" -#define MSG_HBUF_TOO_SMALL "Buffer(%d) trop petit pour ent�te(%d)" -#define MSG_HEAD_OPEN_ERROR "Erreur � l'ouverture du fichier header" -#define MSG_HEAD_READ_ERROR "Erreur en lecture du fichier header %s" -#define MSG_HEAD_WRITE_ERR "Erreur en �criture du fichier header" -#define MSG_HI_OFFSET_ERR "Offset sup�rieur non nul" -#define MSG_HUGE_DEFAULT "Huge est %d par d�fault" -#define MSG_HUGE_WARNING_1 "M�moire Huge non compatible 16-bit pour %d\n" -#define MSG_HUGE_WARNING_2 "R�sultats impr�visibles possibles\n" -#define MSG_IDLE "Au repos" -#define MSG_ILLEGAL_INSTR "Instruction ill�gale" -#define MSG_ILL_FILTER_CONV "Conversion implicite ill�gale dans un filtre" -#define MSG_INDEX_CREATED "Index %s cr�� sur %s" -#define MSG_INDEX_DEF_ERR "Erreur sauvegardant l'index d�finition pour %s" -#define MSG_INDEX_DROPPED "Index %s supprim� de %s" -#define MSG_INDEX_INIT_ERR "Echec de l'initialisation de l'index %s" -#define MSG_INDEX_NOT_DEF "Index %s non d�fini" -#define MSG_INDEX_NOT_UNIQ "L'index n'est pas Unique" -#define MSG_INDEX_ONE_SAVE "Les index sont sauvegard�s dans un fichier unique" -#define MSG_INDEX_SEP_SAVE "Les index sont sauvegard�s dans des fichiers s�par�s" -#define MSG_INDEX_YET_ON "L'index %s existe d�j� sur %s" -#define MSG_INDX_ALL_DROP "Tous les index de %s supprim�s" -#define MSG_INDX_COL_NOTIN "La colonne index %s n'existe pas dans la table %s" -#define MSG_INDX_EXIST_YET "L'entr�e index existe d�j�" -#define MSG_INIT_ERROR "Erreur � l'initialisation de %s" -#define MSG_INIT_FAILED "L'initialisation de %s a �chou�" -#define MSG_INPUT "Entr�e: " -#define MSG_INPUT_KEYBD_YET "L'entr�e est d�j� au clavier" -#define MSG_INSERTING "Insertion: " -#define MSG_INSERT_ERROR "Insert erreur: usage multiple du fichier %s" -#define MSG_INSERT_MISMATCH "Les listes colonne et valeur ne correspondent pas" -#define MSG_INTERNAL "interne" -#define MSG_INT_COL_ERROR "Erreur interne sur la colonne index %s" -#define MSG_INT_OVERFLOW "D�passement de capacit� sur entier" -#define MSG_INT_ZERO_DIVIDE "Division enti�re par z�ro" -#define MSG_INVALID_BIP "Bip invalide .%d" -#define MSG_INVALID_DISP "Disposition invalide" -#define MSG_INVALID_FTYPE "SBV: Ftype %d invalide" -#define MSG_INVALID_HANDLE "Poign�e invalide" -#define MSG_INVALID_OPER "Op�rateur invalide %d pour %s" -#define MSG_INVALID_OPTION "Option invalide %s" -#define MSG_INV_COLUMN_TYPE "Type %d Invalide pour la colonne %s" -#define MSG_INV_COL_DATATYP "Type de donn�es %d invalide pour la colonne %d" -#define MSG_INV_COL_NUM "Colonne invalide %d" -#define MSG_INV_COL_TYPE "Type de colonne %s invalide" -#define MSG_INV_CONC_BIP "Bip invalide (seuls valides: %.8s.0 .1 and .5)" -#define MSG_INV_DATA_PATH "Chemin vers les donn�es invalide" -#define MSG_INV_DEF_READ "Lecture diff�r�e invalide rc=%d" -#define MSG_INV_DIRCOL_OFST "Offset invalide pour une colonne DIR" -#define MSG_INV_DOMAIN_TYPE "Type invalide %d" -#define MSG_INV_FILTER "Filtre r�siduel dans %s" -#define MSG_INV_FNC_BUFTYPE "FNC: Type %d de l'argument invalide pour %s" -#define MSG_INV_INFO_TYPE "Type d'info catalog invalide %d" -#define MSG_INV_INIPATH "Inipath invalide " -#define MSG_INV_MAP_POS "Position m�moire invalide" -#define MSG_INV_OPERATOR "op�rateur invalide %d\n" -#define MSG_INV_PARAMETER "Param�tre invalide %s" -#define MSG_INV_PARM_TYPE "Type de param�tre invalide" -#define MSG_INV_QUALIFIER "Qalificateur '%s' invalide" -#define MSG_INV_QUERY_TYPE "Type de requ�te %d invalide" -#define MSG_INV_RAND_ACC "L'acc�s al�atoire d'une table non optimis�e est impossible" -#define MSG_INV_REC_POS "Position d'enregistrement invalide" -#define MSG_INV_RESULT_TYPE "Type de r�sultat invalide %s" -#define MSG_INV_SET_SUBTYPE "Type de formattage %d invalide" -#define MSG_INV_SPECIAL_CMD "%s: Commande sp�ciale invalide" -#define MSG_INV_SUBTYPE "Sous type invalide %s" -#define MSG_INV_TOK_DOMAIN "Le domaine %s n'existe pas" -#define MSG_INV_TOPSEM_CMD "Commande TopSem invalide %c" -#define MSG_INV_TRANSF_USE "Usage invalide en r�gle transformationnelle" -#define MSG_INV_TYPE_SPEC "Sp�cification de type invalide (%.8s.%d)" -#define MSG_INV_UPDT_TABLE "Table %s invalide pour Update" -#define MSG_INV_VALUE_LIST "Liste de valeurs invalide pour Insert" -#define MSG_INV_WHERE_JOIN "Clause Where invalide dans une requ�te de jointure" -#define MSG_INV_WORK_PATH "Chemin de travail invalide" -#define MSG_IN_ARGTYPE_MISM "Arguments de types incompatibles pour une expression IN" -#define MSG_IN_USE " et en activit�" -#define MSG_IN_WITHOUT_SUB "IN ou EXISTS sans tableau ou subquery" -#define MSG_IS_NOT_CONN "%s n'est pas une connexion d�finie" -#define MSG_JCT_MISS_COLS "Colonnes manquantes pour une table JCT" -#define MSG_JCT_MISS_TABLE "Table jointe manquante pour JCT" -#define MSG_JCT_NO_FILTER "Filtrage impossible des tables virtuelles JCT" -#define MSG_JCT_NO_KEY "Erreur logique JCT: cl� manquante" -#define MSG_JOIN_KEY_NO_COL "La cl� de jointure n'est pas une colonne" -#define MSG_KEY_ALLOC_ERR "Erreur d'allocation d'un bloc offset cl�" -#define MSG_KEY_ALLOC_ERROR "Erreur d'allocation m�moire, Klen=%d n=%d" -#define MSG_LANGUAGE_QUIT "%s lib�r�" -#define MSG_LANG_ACTIVE "Langage %s actif" -#define MSG_LANG_ALLOC_FAIL "PlugInitLang: Erreur d'allocation du bloc Lang" -#define MSG_LANG_ALREADY_UP "Langage d�j� en �dition" -#define MSG_LANG_BAD_SAVE "Langage %s peut-�tre incorrectement sauvegard�" -#define MSG_LANG_NOT_FREED "Langage %s non lib�rable (pas dans la cha�ne principale)" -#define MSG_LANG_SAVED "Langage %s sauvegard�" -#define MSG_LANG_WR_LEN_ERR "Erreur de longueur � l'�criture du bloc Lang" -#define MSG_LDF_ALLOC_ERROR "Erreur d'allocation d'un LdfBlock" -#define MSG_LDF_RN_MISMATCH "LDF: d�calage des num�ros de r�gle" -#define MSG_LDF_WLEN_ERROR "Erreur de longueur en �crivant LdfData" -#define MSG_LDF_W_LEN_ERROR "Erreur de longueur pour LdfData en �criture" -#define MSG_LIC_NO_MYSQL "Votre licence actuelle ne permet pas l'utilisation du type MYSQL" -#define MSG_LINEAR_ERROR "Erreur de lin�arisation" -#define MSG_LINE_LENGTH "Largeur d'impression fix�e � %d" -#define MSG_LINE_MAXLIN "Nombre de lignes de travail plafonn� � %d" -#define MSG_LINE_MAXRES "Nombre de lignes de r�sultat plafonn� � %d" -#define MSG_LINE_MAXTMP "Nombre de lignes interm�diaires plafonn� � %d" -#define MSG_LINE_TOO_LONG "La nouvelle ligne est trop longue" -#define MSG_LINJOINDB_ERROR "Erreur syst�me: appel incorrecte � LinJoinDB" -#define MSG_LIST "--Liste--" -#define MSG_LNG_NOT_IN_LIST "Le langage %s n'est pas dans la liste" -#define MSG_LOADING_DB "Chargement description de la BD" -#define MSG_LOADING_FAILED "Le chargement de %s a �chou�" -#define MSG_LOAD_CDLL_ERROR "Erreur au chargement de ConnDll: rc=%d" -#define MSG_LOCSTRG_TOO_BIG "LOCSTRG: n trop grand ? (%d)\n" -#define MSG_LOGICAL_ERROR "%s: Erreur logique" -#define MSG_LRECL_TOO_SMALL "Lrecl trop petit (longueur en-t�te = %d)" -#define MSG_MAC_NO_DELETE "Pas de suppression de lignes pour les tables MAC" -#define MSG_MAC_NO_INDEX "Pas d'acc�s direct aux tables MAC" -#define MSG_MAC_READ_ONLY "Les tables MAC sont en lecture seulement" -#define MSG_MAC_WIN_ONLY "Les tables MAC sont seulement sous Windows" -#define MSG_MAKE_EMPTY_FILE "G�n�ration du fichier vide %s: %s" -#define MSG_MAKING "G�n�ration" -#define MSG_MAKING_DISTINCT "Regroupement des valeures distinctes" -#define MSG_MALLOC_ERROR "Allocation m�moire impossible par %s" -#define MSG_MALLOC_NULL "malloc retourne Null" -#define MSG_MAP_NO_MORE "Le type %s n'est plus support�" -#define MSG_MAP_OBJ_ERR "Erreur %d � la fermeture du map objet" -#define MSG_MAP_VEC_ONLY "MAP Insert permis seulement pour les tables VEC Estimate" -#define MSG_MAP_VIEW_ERROR "MapViewOfFile %s erreur rc=%d" -#define MSG_MAXSIZE_ERROR "Maxsize incalculable sur table ouverte" -#define MSG_MAXTMP_TRUNCATE "R�sultats interm�diaires tronqu�s par maxtmp=%d" -#define MSG_MAX_BITMAP "Taille maxi des bitmaps d'optimisation fix�e � %d" -#define MSG_MEMSIZE_TOO_BIG "Erreur: memsize (%d) trop grand pour Length (%d)" -#define MSG_MEM_ALLOC_ERR "Erreur d'allocation m�moire, taille %s = %d" -#define MSG_MEM_ALLOC_ERROR "Erreur d'allocation m�moire" -#define MSG_MEM_ALLOC_YET "M�moire d�j� allou�e" -#define MSG_METAFILE_NOTFND "Fichier Meta introuvable" -#define MSG_MISPLACED_QUOTE "Appostrophe mal plac�e ligne %d" -#define MSG_MISSING "Manquant: Value=%p Argval=%p Builtin=%d" -#define MSG_MISSING_ARG "Argument manquant pour l'op�rateur %d" -#define MSG_MISSING_COL_DEF "D�finition des colonnes manquante" -#define MSG_MISSING_CONNECT "Connection #1 manquante" -#define MSG_MISSING_EOL "Fin de ligne manquante dans %s" -#define MSG_MISSING_FIELD "Champs %d manquant dans %s ligne %d" -#define MSG_MISSING_FNAME "Nom du fichier manquant" -#define MSG_MISSING_NODE "Noeud %s manquant dans %s" -#define MSG_MISSING_POS "POS code manquant" -#define MSG_MISSING_ROWNODE "Impossible de trouver le noeud de la ligne %d" -#define MSG_MISSING_SERV_DB "Indication serveur et/ou base de donn�es manquante" -#define MSG_MISS_LEAD_COL "Colonne majeure %s manquante" -#define MSG_MISS_NAME_LRECL "Nom du fichier et/ou LRECL manquant" -#define MSG_MISS_TABLE_LIST "Liste des tables manquante" -#define MSG_MISS_VCT_ELMT "Taille de bloc vectoriel manquante (Elements)" -#define MSG_MIS_TAG_LIST "Liste des balises colonne manquante" -#define MSG_MKEMPTY_NIY "MakeEmptyFile: pas encore implement� pour Huge et Unix" -#define MSG_MOVE_INV_TYPE "MOVPARM: param�tre de type invalide %d" -#define MSG_MULT_DISTINCT "Distinct utilis� plus d'une fois" -#define MSG_MULT_KEY_ERROR "Erreur sur cl� multiple k=%d n=%d" -#define MSG_MUL_MAKECOL_ERR "Erreur logique dans TABMUL::MakeCol" -#define MSG_MYSQL_CNC_OFF "La connexion � MySQL est ferm�e" -#define MSG_MYSQL_CNC_ON "La connexion � MySQL est �tablie" -#define MSG_MYSQL_NOT_SUP "Pas de support de MySQL dans cette version" -#define MSG_MY_CNC_ALREADY "La connexion � MySQL est d�j� active" -#define MSG_NAME_CONV_ERR "Erreur de convertion du nom de noeud" -#define MSG_NAME_IS_USED "Le nom %s est d�j� utilis�" -#define MSG_NCOL_GT_MAXCOL "Trop de colonnes (%d > %d max)" -#define MSG_NEW_CHAR_NULL "new char(%d) retourne Null" -#define MSG_NEW_DOC_FAILED "Impossible de cr�er le nouveau document" -#define MSG_NEW_RETURN_NULL "NULL renvoy� par New dans PlugEvalLike" -#define MSG_NEW_TABLE_ERR "La nouvelle table %s ne peut pas �tre charg�e" -#define MSG_NEXT_FILE_ERROR "Erreur en recherche du fichier suivant. rc=%s" -#define MSG_NODEF_FROM_VIEW "Pas de d�finition de table depuis une view" -#define MSG_NODE_FOR_CHAR "Noeud %s trouve au lieu d'un caract�re" -#define MSG_NODE_SUBSET_ERR "Erreur d'initialisation de la zone Noeud %d" -#define MSG_NONCONT_EXCEPT "Exception non-continuable" -#define MSG_NON_DUP_HAVING "Clause Having dans une requ�te non fonctionelle" -#define MSG_NON_EVAL_SEM "Sem non �valu�e: p_no=%d" -#define MSG_NOP_ZLIB_INDEX "L'indexage d'une table zlib non optimis�e est impossible" -#define MSG_NOT_A_DBF_FILE "Le fichier n'a pas le format dBASE dbf " -#define MSG_NOT_ENOUGH_COLS "Pas assez de colonnes dans %s" -#define MSG_NOT_ENOUGH_MEM "M�moire insuffisante pour cette op�ration" -#define MSG_NOT_FIXED_LEN "Fichier %s non fixe, len=%d lrecl=%d" -#define MSG_NOT_IMPLEMENTED "Non implement�: %.8s" -#define MSG_NOT_IMPL_JOIN "Pas impl�ment� pour les jointures" -#define MSG_NOT_IMPL_SET "Pas impl�ment� pour les op�rateurs d'ensembles" -#define MSG_NOT_IMPL_YET "Pas encore implement�" -#define MSG_NOT_LINEARIZED "Arborescence des tables non lin�aris�e" -#define MSG_NOT_MODIFIABLE " (non modifiable)" -#define MSG_NO_0DH_HEAD "0DH manquant en fin d'en-t�te (dbc=%d)" -#define MSG_NO_ACTIVE_APPL "Pas d'application active" -#define MSG_NO_ACTIVE_DB "Pas de base de donn�es active" -#define MSG_NO_ACTIVE_UDIC "Pas de dictionaire utilisateur actif" -#define MSG_NO_AGGR_FUNC "Fonction aggr�g�e %d ill�gale � cet endroit" -#define MSG_NO_AREA_FILE "Fichier Area introuvable" -#define MSG_NO_AVAIL_RESULT "Pas de r�sultat disponible" -#define MSG_NO_BIG_DELETE "D�l�tion Partielle non impl�ment�e pour les fichiers HUGE" -#define MSG_NO_CHAR_FROM "Conversion de type %d en caract�res impossible" -#define MSG_NO_CLUSTER_COL "Pas de colonne optimisable" -#define MSG_NO_COL_ADDING "Ajouter des colonnes dans une d�finition existante est impossible" -#define MSG_NO_COL_DEF_AS "La d�finitions des colonnes est incompatible avec AS Select" -#define MSG_NO_COL_FOUND "La section colonne %s est vide" -#define MSG_NO_COL_IN_TABLE "La colonne %d n'est pas dans la table %s" -#define MSG_NO_COL_SECTION "Section colonne manquante pour la table %s" -#define MSG_NO_CONNECT_ADDR "Adresse de connection non sp�cifi�e" -#define MSG_NO_CONST_FILTER "Filtres constants non implement�s" -#define MSG_NO_CURLY_BRKT "Pas d'accolade de fermeture" -#define MSG_NO_DATABASE "Base de donn�es %s introuvable" -#define MSG_NO_DATE_FMT "Pas de format date pour le valblock de type %d" -#define MSG_NO_DBF_INSERT "Insert pas encore impl�ment� pour les fichier DBF" -#define MSG_NO_DEF_FNCCOL "Colonne fonction par d�faut introuvable" -#define MSG_NO_DEF_PIVOTCOL "Colonne pivot par d�faut introuvable" -#define MSG_NO_DIR_INDX_RD "Pas d'acc�s directe des tables %s" -#define MSG_NO_DMY_DIR_ACC "Pas d'acc�s direct aux tables virtuelles DUMMY" -#define MSG_NO_DOM_DELETE "D�l�tion Partielle non impl�ment�e pour les domaines" -#define MSG_NO_DOM_MATCH "Cha�ne %.8s... non touv�e dans le domaine %s" -#define MSG_NO_EDITED_LANG "Coparm: Pas de langage en �dition" -#define MSG_NO_EXP_LINK "Liaison par expression invalide pour une table JCT" -#define MSG_NO_EXT_FILTER "Le filtrage ne peut se r�f�rer � une autre table" -#define MSG_NO_EXT_UPDATE "Pas de mise � jour en r�f�rence � une autre table" -#define MSG_NO_FEAT_SUPPORT "%s non support� dans cette version" -#define MSG_NO_FILE_LIST "La table %s n'a pas de liste de fichiers" -#define MSG_NO_FLD_FORMAT "Format absent pour le champs %d de %s" -#define MSG_NO_FORMAT_COL "Type COLUMN informattable" -#define MSG_NO_FORMAT_TYPE "Le format ne peut pas �tre d�fini � partir du type %d" -#define MSG_NO_FULL_JOIN "Jointures autoris�es seulement � �galit� sur cl�(s)" -#define MSG_NO_FUL_OUT_JOIN "Jointures externes compl�tes non support�es" -#define MSG_NO_FUNC_ORDER "Tri non support� sur �l�ment fonctionnel" -#define MSG_NO_HEAD_JOIN "Jointure sur une table non en t�te" -#define MSG_NO_HQL_CONV "Conversion en HQL non disponible" -#define MSG_NO_INDEX "La table %s n'a pas d'index" -#define MSG_NO_INDEX_GBX "Pas ou mauvais index pour SQLGBX" -#define MSG_NO_INDEX_IN "Pas d'index dans %s" -#define MSG_NO_INDEX_READ "Pas d'acc�s directe des tables multiples" -#define MSG_NO_INIT_LANG "Pas de langage initial" -#define MSG_NO_JOIN_TO_EXP "Jointure vers une expression impossible" -#define MSG_NO_JOIN_UPDEL "Pas de jointure avec Update/Delete" -#define MSG_NO_KEY_COL "Pas de colonne cl� trouv�e" -#define MSG_NO_KEY_UPDATE "Le nom des cl�s ne peut pas �tre modifi�" -#define MSG_NO_LANGUAGE "Pas de langage op�rationnel\n" -#define MSG_NO_LANG_TO_QUIT "Pas de langage � quitter" -#define MSG_NO_LISTVAL_HERE "LSTBLK: Liste de valeurs utilis�e hors contexte" -#define MSG_NO_MAP_INSERT "MAP incompatible avec Insert" -#define MSG_NO_MATCHING_COL "Pas de colonne correspondant � %s dans %s" -#define MSG_NO_MATCH_COL "Colonne correspondante introuvable" -#define MSG_NO_MEMORY "M�moire pleine" -#define MSG_NO_MEM_CORR_SUB "Subquery corr�l�e en m�moire non encore impl�ment�e" -#define MSG_NO_MODE_PADDED "Mode non support� pour les fichiers 'padded'" -#define MSG_NO_MORE_COL "La colonne %s n'est plus dans la table pivot" -#define MSG_NO_MORE_LANG "Plus de langage, exit de %s\n" -#define MSG_NO_MORE_VAR "Les fichiers VAR ne sont plus support�s" -#define MSG_NO_MULCOL_JOIN "Jointure vers un index multi-colonne pas encore possible" -#define MSG_NO_MULT_HAVING "Clauses Having multiples non impl�ment�es" -#define MSG_NO_MUL_DIR_ACC "Acc�s direct des tables multiples pas encore impl�ment�" -#define MSG_NO_MUL_VCT "Les tables VCT ne peuvent pas �tre multiples" -#define MSG_NO_MYSQL_CONN "Aucune connexion MySQL ouverte" -#define MSG_NO_MYSQL_DELETE "Pas de Delete pour les tables MySQL" -#define MSG_NO_NBCOL "Pas de NBcol" -#define MSG_NO_NBLIN "Pas de NBlin, MaxSize ou Continued" -#define MSG_NO_NBLIN_CONT "Fetch: Pas de NBlin ou Continued" -#define MSG_NO_NULL_CONST "Les constantes ne sont pas prises en charge" -#define MSG_NO_ODBC_COL "Colonnes ODBC automatiques non support�es par cette version" -#define MSG_NO_ODBC_DELETE "Delete ne devrait pas �tre appel� pour les tables ODBC" -#define MSG_NO_ODBC_DIRECT "Acc�s directe des tables ODBC non encore impl�ment�" -#define MSG_NO_ODBC_MUL "Multiple(2) non support� pour les tables ODBC" -#define MSG_NO_ODBC_SPECOL "Pas de colonne sp�ciale ODBC" -#define MSG_NO_OPT_COLUMN "Pas optimisable ou pas de colonne optimis�es" -#define MSG_NO_OP_MODIF "Les modificateurs ne s'appliquent pas � %s" -#define MSG_NO_PARAMETER "Pas de param�tre" -#define MSG_NO_PART_DEL "Delete partiel des fichier %s impossible" -#define MSG_NO_PART_MAP "Mapping partiel non impl�ment� pour cet OS" -#define MSG_NO_PAR_BLK_INS "Insertion de bloc partiel impossible" -#define MSG_NO_PIV_DIR_ACC "Pas d'acc�s directe aux tables PIVOT" -#define MSG_NO_POS_ADDED "Pos_code non ajout�" -#define MSG_NO_PROMPTING "Relance impossible pour les tables distribu�es" -#define MSG_NO_QRY_DELETE "Delete n'est pas utilisable pour les views QRY" -#define MSG_NO_QUERY_ARRAY "Tableaux avec QUERY non encore impl�ment�s" -#define MSG_NO_RCUR_DSK_YET "Usage r�cursif de DISK non encore implement�" -#define MSG_NO_READ_32 "Lecture de 32 octets impossible" -#define MSG_NO_RECOV_SPACE "Espace non recouvrable dans le fichier index" -#define MSG_NO_REF_DELETE "Pas de suppression en r�f�rence � une autre table" -#define MSG_NO_REF_UPDATE "Pas de mise � jour en r�f�rence � une autre table" -#define MSG_NO_REMOTE_FNC "Certaines fonctions ne peuvent pas �tre ex�cut�es � distance" -#define MSG_NO_ROWID_FOR_AM "Acc�s direct impossible de ROWID pour les tables de type %s" -#define MSG_NO_ROW_NODE "Le nom du Rownode n'est pas d�fini" -#define MSG_NO_SECTION_NAME "Nom de section manquant" -#define MSG_NO_SEC_UPDATE "Les noms de section ne peuvent pas �tre modifi�s" -#define MSG_NO_SELECTED_DB "Aucune base de donn�es s�lect�e" -#define MSG_NO_SELF_PIVOT "Une table ne peut se pivoter elle-m�me !" -#define MSG_NO_SERVER_FOUND "Serveur introuvable" -#define MSG_NO_SETPOS_YET "SetPos pas encore impl�ment� pour les fichier %s" -#define MSG_NO_SFEXIT_UNIX "Fonction %s non disponible sur Unix" -#define MSG_NO_SOURCE " (pas de source)" -#define MSG_NO_SPEC_COL "Pas de colonne sp�ciales MYSQL" -#define MSG_NO_SQL_DELETE "Delete n'est pas utilisable actuellement pour les views SQL" -#define MSG_NO_SUB_VAL "Pas de sous-value d'un tableau de type %d" -#define MSG_NO_SUCH_INDEX "La table %s n'a pas l'index %s" -#define MSG_NO_SUCH_SERVER "Serveur %s introuvable" -#define MSG_NO_SUCH_TABLE "Table %s pas dans la base de donn�es" -#define MSG_NO_TABCOL_DATA "Pas de donn�es pour la table %s colonne %s" -#define MSG_NO_TABLE_COL "Aucune colonne trouv�e pour %s" -#define MSG_NO_TABLE_DEL "Delete non autoris� pour les tables %s " -#define MSG_NO_TABLE_DESC "Pas de bloc descriptif de table" -#define MSG_NO_TABLE_INDEX "La table %s n'a pas d'index" -#define MSG_NO_TABLE_LIST "Pas de liste de tables" -#define MSG_NO_TAB_DATA "Pas de donn�es pour la table %s" -#define MSG_NO_TERM_IN_TOK "Les non-terminaux ne sont pas utilisables dans les r�gles de Token" -#define MSG_NO_TOKEN_DB "DB introuvable pour la colonne TOKEN %s" -#define MSG_NO_UNIX_CATINFO "Pas d'info catalogue sous Unix" -#define MSG_NO_UPDEL_JOIN "Pas de jointure de tables ODBC pour Update/Delete" -#define MSG_NO_VCT_DELETE "D�l�tion Partielle non impl�ment�e pour les fichiers VCT" -#define MSG_NO_VIEW_COLDEF "Colonne d�finition impossible pour les views" -#define MSG_NO_VIEW_SORT "La View fonctionnelle %s ne peut pas �tre tri�e ou jointe" -#define MSG_NO_ZIP_DELETE "Delete sur fichier Zip non encore implement�" -#define MSG_NO_ZIP_DIR_ACC "Acc�s directe des tables ZDOS non encore implement�" -#define MSG_NULL_COL_VALUE "La colonne n'a pas de valeur" -#define MSG_NULL_ENTRY "InitLang, entr�e nulle %d %s" -#define MSG_NULL_QUERY "Requ�te vide" -#define MSG_NUMVAL_NOMATCH "Disparit� de Numval pour %s" -#define MSG_N_FULL_PARSES "%d significations" -#define MSG_ODBC_READ_ONLY "ODBC est actuellement en lecture seulement" -#define MSG_OFFSET_NOT_SUPP "Offset non support� pour ce type de sous requ�te" -#define MSG_ONE_LANG_YET "Un langage est d�j� en �dition" -#define MSG_ONE_PARAM_ONLY "Un seul param�tre autoris�" -#define MSG_ONLY_LOG10_IMPL "Seul Log10 est implement�" -#define MSG_ON_LANGUAGE "Langage %.8s version %d niveau %d �ditable" -#define MSG_OPENING "Ouverture" -#define MSG_OPENING_QUERY "Ouverture de la requ�te" -#define MSG_OPEN_EMPTY_FILE "Ouverture du fichier vide %s: %s" -#define MSG_OPEN_ERROR "Erreur d'ouverture %d en mode %d sur %s: " -#define MSG_OPEN_ERROR_IS "Erreur � l'ouverture de %s: %s" -#define MSG_OPEN_ERROR_ON "Erreur d'ouverture sur %s" -#define MSG_OPEN_MODE_ERROR "Erreur d'ouverture(%s) %d sur %s" -#define MSG_OPEN_SORT_ERROR "Erreur logique de tri dans QUERY Open" -#define MSG_OPEN_STRERROR "Erreur � l'ouverture: %s" -#define MSG_OPEN_W_ERROR "Erreur � l'ouverture de %s en �criture" -#define MSG_OPTBLK_RD_ERR "Erreur � la lecture d'un bloc optimisation: %s" -#define MSG_OPTBLK_WR_ERR "Erreur � l'�criture d'un bloc optimisation: %s" -#define MSG_OPTIMIZING "Optimisation de " -#define MSG_OPT_BMAP_RD_ERR "Erreur en lecture des bitmaps d'optimisation: %s" -#define MSG_OPT_BMAP_WR_ERR "Erreur en �criture des bitmaps d'optimisation: %s" -#define MSG_OPT_CANCELLED "Optimisation interrompue par l'utilisateur" -#define MSG_OPT_DVAL_RD_ERR "Erreur en lecture des valeurs distinctes: %s" -#define MSG_OPT_DVAL_WR_ERR "Erreur en �criture des valeurs distinctes: %s" -#define MSG_OPT_HEAD_RD_ERR "Erreur en lecture de l'ent�te du fichier opt: %s" -#define MSG_OPT_HEAD_WR_ERR "Erreur en �criture de l'ent�te du fichier opt: %s" -#define MSG_OPT_INIT "Optimisation initialis�e" -#define MSG_OPT_LOGIC_ERR "Erreur logique dans SetBitmap, i=%d" -#define MSG_OPT_MAX_RD_ERR "Erreur en lecture des valeurs maxi: %s" -#define MSG_OPT_MAX_WR_ERR "Erreur en �criture des valeurs maxi: %s" -#define MSG_OPT_MIN_RD_ERR "Erreur en lecture des valeurs mini: %s" -#define MSG_OPT_MIN_WR_ERR "Erreur en �criture des valeurs mini: %s" -#define MSG_OPT_NOT_MATCH "Le fichier opt %s n'est pas � jour" -#define MSG_OP_RES_TOO_LONG "R�sultat trop long pour l'op�rateur=%d" -#define MSG_ORDER_OUT_RANGE "Tri: Order %d hors limite" -#define MSG_ORDER_TWICE "Un m�me �l�ment est tri� deux fois" -#define MSG_PAGE_ERROR "Erreur de pagination" -#define MSG_PARM_CNT_MISS "Disparit� du nombre de Param�tres" -#define MSG_PARSE_NULL_SEM "S�mantique nulle" -#define MSG_PARSING_QUERY "Analyse de la requ�te" -#define MSG_PIX_ERROR "Pix %s erreur r�gle no=%u\n" -#define MSG_PIX_TEST_ERROR "R�gle=%u: pix-TEST pas dans le premier noeud\n" -#define MSG_PLG_READ_ONLY "PLG est actuellement en lecture seulement" -#define MSG_PLM_NULL_SFP "TABPLM ReadDB: Sfp est NULL" -#define MSG_PLUG_NOT_INIT "Plug n'est pas initialis�\n" -#define MSG_PLUG_NOT_RUN "Plug n'est pas en marche" -#define MSG_PNODE_RULE "(Noeud %d r�gle %d) " -#define MSG_POS_TOO_LONG "%s trop long (>%d)" -#define MSG_PREC_VBLP_NULL "ARRAY SetPrecision: Vblp est NULL" -#define MSG_PRIV_INSTR "Instruction privil�gi�e" -#define MSG_PROCADD_ERROR "Erreur %d sur l'adresse de %s" -#define MSG_PROCESS_SUBQRY "Sub-Query en cours de traitement" -#define MSG_PROC_WOULD_LOOP "Bouclage du traitement (maxres=%d maxlin=%d)" -#define MSG_PROGRESS_INFO "Informations sur le traitement en cours" -#define MSG_PROMPT_CANCEL "Relance annul�e" -#define MSG_PROMPT_NIY "Prompt non impl�ment� pour cette configuration" -#define MSG_PTR_NOT_FOUND "Pointeur introuvable Num=%d ti1=%d" -#define MSG_PXDEF_IS_NULL "Pxdef est NULL" -#define MSG_QRY_READ_ONLY "Les views QRY sont en lecture seulement" -#define MSG_QUERY_CANCELLED "Requ�te interrompue par l'utilisateur" -#define MSG_QUERY_NOT_EXEC "Requ�te non ex�cut�e" -#define MSG_QUERY_SAVED "Requ�te %s sauvegard�e" -#define MSG_QUOTE_IN_QUOTE "Appostrophe dans un champ entre appostrophe ligne %d" -#define MSG_RANGE_NIY "Range pas encore impl�ment� pour %s" -#define MSG_RANGE_NO_JOIN "Range non compatible avec les index de jointure" -#define MSG_RC_READING "rc=%d en lecture de la table %s" -#define MSG_READB_BAD_INIT "%s ReadDB appel� avec Init=0" -#define MSG_READCOL_ERROR "SQLCOL: erreur dans ReadColumn" -#define MSG_READING "Lecture" -#define MSG_READING_FROM "Lecture de %s" -#define MSG_READING_RECORD "Erreur en lecture de l'enregistrement %d de %s" -#define MSG_READY "Pr�t" -#define MSG_READ_ERROR "Erreur en lecture sur %s: %s" -#define MSG_READ_ERROR_RC "Erreur en lecture, rc=%d" -#define MSG_READ_MEM_ERROR "Lecture m�moire %d: taille=%d" -#define MSG_READ_ONLY "Cette table prot�g�e en lecture seule ne peut �tre modifi�e" -#define MSG_READ_SEEK_ERROR "Erreur de recherche en lecture: %s" -#define MSG_READ_SEG_ERROR "Lecture segment %d: taille=%d" -#define MSG_RECEIVED "Re�u %c\n" -#define MSG_RECORD_ERROR "Erreur � la lecture de l'enregistrement %d de %s" -#define MSG_RECORD_NO_SEP "Enregistrement sans s�parateur" -#define MSG_REC_SKIPPED " (%d lignes erronn�es saut�es par l'option MaxErr)" -#define MSG_REDUCE_INDEX "R�duction de l'index" -#define MSG_REGISTER_ERR "Enregistrement NS impossible, pr�fix='%s' et href='http://github.com/%s'" -#define MSG_REMOTE_CONN_ERR "La connection �loign�e a �chou�" -#define MSG_REMOVE_ERROR "Erreur en supprimant %s: %s" -#define MSG_REMOVE_NOT_IMPL "Remove non impl�ment� pour TDB non Table" -#define MSG_RENAME_ERROR "Erreur renommant %s en %s: %s" -#define MSG_RENUM_RULES "Renum�rotez les r�gles et r�entrez ADD (r�gle sauvegard�e dans la zone tampon)" -#define MSG_REORDER_INDEX "Reclassement de l'index" -#define MSG_REQU_ARG_NUM "La fonction %s doit avoir %d arguments" -#define MSG_RESET_TO "%s remis � %d" -#define MSG_RES_NOT_UNIQUE "Le r�sultat n'est pas unique" -#define MSG_RET_FROM_LANG "Retour au language %s version %d.%d du language %s version %d.%d" -#define MSG_ROWID_NOT_IMPL "RowNumber non impl�ment� pour les tables de type %s" -#define MSG_ROWS_SELECTED "%d lignes s�lectionn�es en %.2lf sec" -#define MSG_ROWS_TRUNCATED " (tronqu� par MAXRES, LIMIT, FREQ ou AreaSize)" -#define MSG_ROW_ARGNB_ERR "ROW: disparit� du nombre d'arguments (%d,%d)" -#define MSG_RPC_SERVER_ERR "Erreur logique dans TABMUL::MakeCol" -#define MSG_RSC_ALLOC_ERROR "Erreur d'allocation m�moire dans Rescol %s" -#define MSG_RULE_ENTERED "R�gle %d entr�e" -#define MSG_RULE_SUBSET_ERR "Erreur d'initialisation de la zone R�gles" -#define MSG_SAVING_INDEX "Sauvegarde du fichier index" -#define MSG_SCAN_NOT_IMP "Scan non impl�ment�" -#define MSG_SEC_KEY_FIRST "Les sections et cl�s doivent �tre ins�r�es en premier" -#define MSG_SEC_NAME_FIRST "Le nom de section doit �tre en t�te de liste en insertion" -#define MSG_SEC_NOT_FOUND "Section %s absente de %s" -#define MSG_SEEK_ERROR "Seek erreur dans CopyHeader" -#define MSG_SEMANTIC_TREE "Arbre s�mantique" -#define MSG_SEM_BAD_REF "Sem @%d r�f�rence un argument de type non 0 ou 1" -#define MSG_SEM_UNKNOWN "inconnue, rc=%d" -#define MSG_SEP_IN_FIELD "Le champ %d contient le caract�re s�parateur" -#define MSG_SEQUENCE_ERROR "HSTMT: Allocation hors s�quence" -#define MSG_SETEOF_ERROR "Erreur %d dans SetEndOfFile" -#define MSG_SETRECPOS_NIY "SetRecpos non impl�ment� pour ce type de table" -#define MSG_SET_LOCALE "Locale fix�e � %s" -#define MSG_SET_NULL_DOM "Valeur %d donn�e � un domaine nul" -#define MSG_SET_OP_NOT_IMPL "Op�rateurs ensemblistes non impl�ment�s" -#define MSG_SET_STR_TRUNC "SetValue: Cha�ne de caract�res tronqu�e" -#define MSG_SEVERAL_TREES "Jointure non sp�cifi�e pour certaines tables" -#define MSG_SFP_ERROR "Erreur sur SetFilePointer: %s" -#define MSG_SFUNC_NOT_IMPL "Fonction scalaire %s non impl�ment�e" -#define MSG_SHARED_LIB_ERR "Erreur au chargement de la librairie partag�e %s: %s" -#define MSG_SINGLE_STEP "Pas � pas" -#define MSG_SLEEP "J'ai dormi %d milliseconds" -#define MSG_SMART_SORTING "R�cup�ration des lignes tri�es (passage %d de %d)" -#define MSG_SMART_SORT_ERR "Erreur logique 1 dans Smart Sort" -#define MSG_SORTING "Tri en cours" -#define MSG_SORTING_INDEX "Tri de l'index" -#define MSG_SORTING_VAL "Tri de %d valeurs" -#define MSG_SORT_JOIN_INDEX "Tri de l'index de jointure" -#define MSG_SPCOL_READONLY "La colonne sp�ciale %s est en lecture seulement" -#define MSG_SPEC_CMD_SEP "Les commandes sp�ciales doivent �tre ex�cut�es s�par�ment" -#define MSG_SQL_BAD_TYPE "RephraseSQL: type %d non support�" -#define MSG_SQL_BLOCK_MISM "CheckColumn: bloc SQL courant non correspondant" -#define MSG_SQL_CONF_ERROR "Erreur SQL: SQL_CONFORMANCE" -#define MSG_SQL_READ_ONLY "Les views SQL sont actuellement en lecture seulement" -#define MSG_SRCH_CLOSE_ERR "Erreur � la fermeture de l'Handle de recherche" -#define MSG_SRC_TABLE_UNDEF "La table source n'est pas d�finie" -#define MSG_STACK_ERROR "Erreur sur la pile, i=%d\n" -#define MSG_STACK_OVERFLOW "Parser: D�bordement de la pile\n" -#define MSG_STRG_NOT_FOUND "Cha�ne introuvable" -#define MSG_STRING_INV_LIST "Liste invalide pour SemString" -#define MSG_STRING_TOO_BIG "Cha�ne trop grande pour le domaine %s" -#define MSG_SUBALLOC_ERROR "Pas assez de m�moire en zone %p pour allouer %d (utilis�=%d libre=%d)" -#define MSG_SUBAL_HUGE_ERR "Pas assez de m�moire en zone huge %p pour allouer %d" -#define MSG_SUBARG_NOSEM "Argument @ ou sous-phrase de niveau %d pointe sur un noeud sans Sem" -#define MSG_SUBARG_OUTRANGE "Argument @ ou sous-phrase de niveau %d hors limite" -#define MSG_SUBQRY_ONEITEM "Une Sub-Query ne doit avoir qu'une s�lection" -#define MSG_SUBSET_ERROR "SubSet erreur dans LoadDB" -#define MSG_SUB_OPEN_YET "Subquery d�j� ouverte" -#define MSG_SUB_RES_TOO_LNG "R�sultat trop long pour SUBSTR" -#define MSG_SYNTAX_ERROR "Erreur de syntaxe" -#define MSG_SYSTEM_ERROR "Erreur syst�me %d" -#define MSG_S_ACCESS_DENIED "%s: acc�s non autoris�" -#define MSG_S_ERROR "%s erreur" -#define MSG_S_ERROR_NUM "%s: erreur=%d" -#define MSG_S_INTRUPT_ERROR "%s: erreur interruption" -#define MSG_S_INVALID_PARM "%s: param�tre invalide" -#define MSG_S_INV_ADDRESS "%s: adresse invalide" -#define MSG_S_UNKNOWN_ERROR "%s: erreur de code %u inconnu" -#define MSG_TABDIR_READONLY "Les tables DIR sont en lecture seulement" -#define MSG_TABLE_ALREADY "La table %s existe d�j�" -#define MSG_TABLE_ALTERED "Table %s %s alt�r�e" -#define MSG_TABLE_CREATED "%s table %s cr��e" -#define MSG_TABLE_DROPPED "Table %s supprim�e" -#define MSG_TABLE_MULT_JOIN "Utilisation multiple de la table %s pour jointure" -#define MSG_TABLE_NOT_IN_DB "La table %s n'existe pas dans %s" -#define MSG_TABLE_NOT_OPT "Table non optimisable" -#define MSG_TABLE_NO_INDEX "La table %s n'est pas indexable" -#define MSG_TABLE_NO_OPT "La table %s n'existe pas ou de type non optimisable" -#define MSG_TABLE_READ_ONLY "Les tables %s sont en lecture seulement " -#define MSG_TABMUL_READONLY "Les tables multiples sont en lecture seulement" -#define MSG_TAB_NOT_LOADED " (certaines tables n'ont put �tre charg�es)" -#define MSG_TAB_NOT_SPEC "Table non specifi�e" -#define MSG_TB_VW_NOTIN_DB "Table ou view %s pas dans la base de donn�es" -#define MSG_TDB_NXT_NOT_NUL "Tdb.Next non NULL" -#define MSG_TDB_USE_ERROR "Erreur, Tdbp->Use=%d" -#define MSG_TOO_MANY_COLS "Trop de colonnes" -#define MSG_TOO_MANY_COLTAB "Trop de colonnes dans %s (%d)" -#define MSG_TOO_MANY_FIELDS "Trop de champs ligne %d de %s" -#define MSG_TOO_MANY_JUMPS "Trop de niveaux de saut" -#define MSG_TOO_MANY_KEYS "Trop de cl�s (%d)" -#define MSG_TOO_MANY_POS "Trop de pos_codes" -#define MSG_TOO_MANY_TABLES "Trop de tables (%d)" -#define MSG_TOPSEM_ERROR "Erreur inconnue dans TopSem" -#define MSG_TO_BLK_IS_NULL "To Blk est nul" -#define MSG_TO_FTR_NOT_NULL "Set.To_Ftr n'est pas nul" -#define MSG_TO_PIX_NOT_NULL "Set.To_Pix n'est pas nul" -#define MSG_TO_SEM_NOT_NULL "Set.To_Sem n'est pas nul" -#define MSG_TRUNCATE_ERROR "Erreur en troncation: %s" -#define MSG_TRUNC_BY_ESTIM "Tronqu� par l'option Estimate" -#define MSG_TYPES_ERROR "Erreur sur Types(%d)" -#define MSG_TYPE_CONV_ERROR "Type non convertible dans une expression" -#define MSG_TYPE_DEF_MISM "Disparit� entre type et d�finition" -#define MSG_TYPE_MISMATCH "Cl� et source ne sont pas du m�me type" -#define MSG_TYPE_RECFM_MISM "Disparit� entre Type et Recfm" -#define MSG_TYPE_TO_VERIFY "Type � v�rifier: %d" -#define MSG_TYPE_VALUE_ERR "Colonne %s: disparit� type(%s)/valeur(%s)" -#define MSG_UNBALANCE_QUOTE "Appostrophe en trop ligne %d" -#define MSG_UNDEFINED_AM "COLBLK %s: m�thode d'acc�s ind�finie" -#define MSG_UNDEFINED_PATH "Chemin d'acc�s ind�fini pour Plgcnx.ini" -#define MSG_UNDEF_COL_COUNT "Count sur colonne non d�finie" -#define MSG_UNKNOWN_DOMAIN "Domaine inconnu %s" -#define MSG_UNKNOWN_ERROR "Erreur inconnue" -#define MSG_UNKNOWN_EXCPT "Exception non r�pertori�e" -#define MSG_UNKNOWN_NAME "Nom inconnu: %.8s" -#define MSG_UNKNOWN_PATH "Chemin d'acc�s inconnu pour Plgcnx.ini" -#define MSG_UNKNOWN_POS "Nom pos_code inconnu: %s" -#define MSG_UNKNOWN_SEM "Sem %.8s inconnue, rc=%d" -#define MSG_UNKNOWN_SYNONYM "Synonyme inconnu" -#define MSG_UNKNW_QRY_TYPE "ReadDB: type de requ�te inconnu" -#define MSG_UNKN_ERR_CODE "Erreur de code %d inconnu" -#define MSG_UNLOADABLE " inchargeable: " -#define MSG_UNLOADABLE_PRM "%s inchargeable: %s" -#define MSG_UNMATCH_FIL_ARG "Argument de filtre d�pareill�" -#define MSG_UNQ_COL_SEV_TAB "La colonne %s non qualifi�e est dans plusieurs tables" -#define MSG_UNRESOLVED_ARG "?Argument manquant: %s non r�solu en %d ligne %d" -#define MSG_UPDATE_ERROR "Erreur en Update sur %s" -#define MSG_UPDATING_ROWS "Mise � jour des lignes" -#define MSG_UPD_ZIP_NOT_IMP "Mise � jour des tables ZDOS non encore implement�" -#define MSG_UP_LANGUAGE "Bloc langage %.8s version %d niveau %d charg�" -#define MSG_USED_FREE_MEM "Sarea: utilis� %d, libre %d" -#define MSG_USETEMP_IS "Usetemp est : %s" -#define MSG_USETEMP_RESET ". Usetemp remis � Auto" -#define MSG_USETEMP_SET "Usetemp fix� � %s" -#define MSG_USE_NO_MATCH "Use non correspondant : Use=%d, ti2=%d, ti3=%d" -#define MSG_USING_INDEX " (Index� par" -#define MSG_VALIST_MISMATCH "Disparit� des listes de valeurs" -#define MSG_VALSTR_TOO_LONG "Valeur %s trop longue pour une cha�ne de longueur %d" -#define MSG_VALTYPE_NOMATCH "Disparit� types de valeur" -#define MSG_VALUE_ERROR "Colonne %s: bloc valeur nul" -#define MSG_VALUE_NOT_ALLOC "Valeur non allou�e pour la colonne R%d %s" -#define MSG_VALUE_TOO_BIG "Valeur %lld trop grande pour la colonne %s" -#define MSG_VALUE_TOO_LONG "Valeur %s trop longue pour la colonne %s de longueur %d" -#define MSG_VAL_ALLOC_ERR "Allocation impossible du noeud valeur" -#define MSG_VAL_TOO_LONG "Valeur %s trop longue pour le champ %s" -#define MSG_VIEW_ALREADY "La VIEW %s existe d�j�" -#define MSG_VIEW_CREATED "%s view %s cr��e" -#define MSG_VIEW_DROPPED "View %s supprim�e" -#define MSG_VIEW_NOT_IN_DB "%s n'est pas une View de %s" -#define MSG_VIR_NO_DELETE "Delete impossible sur les tables %s" -#define MSG_VIR_READ_ONLY "Les tables virtuelles %s sont en lecture seulement" -#define MSG_VM_LANG "Langage au format VM, non support�" -#define MSG_VOID_FIRST_ARG "Le premier argument ne doit pas �tre vide" -#define MSG_VOID_IN_STRING "Erreur: cha�ne IN vide" -#define MSG_VOID_ORDER_LIST "Liste de tri vide, erreur syst�me ?" -#define MSG_VOID_POS_DICT "Dictionnaire interne du langage vide" -#define MSG_VOID_QUERY "Requ�te vide %s" -#define MSG_WORK_AREA "Espace de travail: %s" -#define MSG_WORK_TOO_SMALL "Zone de travail trop petite, accro�tre AreaSize" -#define MSG_WRITE_ERROR "Erreur � l'�criture de %s" -#define MSG_WRITE_SEEK_ERR "Erreur de recherche en �criture: %s" -#define MSG_WRITE_STRERROR "Erreur en �criture sur %s: %s" -#define MSG_WRITING "Ecriture" -#define MSG_WRITING_ERROR "Erreur � l'�criture de %s: %s" -#define MSG_WRITING_QUERY "Erreur � l'�criture de la requ�te: " -#define MSG_WRONG_ARG_NUM "La fonction %s ne prend pas %d arguments" -#define MSG_WRONG_COL_NUM "Num�ro de colonne %d trop grand pour %s" -#define MSG_WRONG_DB_LIST "Liste des bases de donn�es incorrecte ou vide" -#define MSG_WRONG_FUNCTION "Mauvaise fonction %d" -#define MSG_WRONG_OP_PARM "Mauvais op�rateur ou param�tres pour %s" -#define MSG_WRONG_PARMS "Mauvais param�tres pour %s" -#define MSG_WRONG_PASSWORD "Mot de passe ill�gal pour %s" -#define MSG_WRONG_TYPE "type non support�" -#define MSG_WRONG_USERFILE "La Userfile a une mauvaise taille %d" -#define MSG_WS_CONV_ERR "Erreur de convertion de %s en WS" -#define MSG_XCOL_MISMATCH "La colonne %s ne correspond pas � l'index" -#define MSG_XDB_DEL_ERROR "Erreur en supprimant des entr�es du fichier XDB" -#define MSG_XFILE_READERR "Erreur %d en lisant le fichier index" -#define MSG_XFILE_TOO_SMALL "Le fichier index est plus petit que la taille de l'index" -#define MSG_XFILE_WRITERR "Erreur en �crivant le fichier index: %s" -#define MSG_XMLTAB_INIT_ERR "Erreur d'initialisation de la table XML" -#define MSG_XML_INIT_ERROR "Erreur d'initialisation du nouveau fichier XML" -#define MSG_XPATH_CNTX_ERR "Le nouveau contexte XPath ne peut �tre cr��" -#define MSG_XPATH_EVAL_ERR "Impossible d'�valuer l'emplacement xpath '%s'" -#define MSG_XPATH_NOT_SUPP "Xpath non support� colonne %s" -#define MSG_X_ARG_ADDED "%d arguments ajout�s" -#define MSG_X_ARG_SET "%d arguments ont �t� initialis�s" -#define MSG_X_ON_TAB " %s sur %s(" -#define MSG_ZERO_DIVIDE "Division par z�ro dans une expression" diff --git a/storage/connect/global.h b/storage/connect/global.h index eb3d4106477ef..bc1585eba41d2 100644 --- a/storage/connect/global.h +++ b/storage/connect/global.h @@ -14,6 +14,8 @@ #include /* time_t type declaration */ #include /* Long jump declarations */ +#define ROUNDUP_TO_8(num) (((num + 7) / 8) * 8) + #if defined(_WIN32) && !defined(NOEX) #define DllExport __declspec( dllexport ) #else // !_WIN32 diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 17e50b5c56bd0..3327ba6359842 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -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 Street, Fifth Floor, Boston, MA 02110-1335 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ /** @file ha_connect.cc @@ -266,7 +266,7 @@ bool Force_Bson(void); size_t GetWorkSize(void); void SetWorkSize(size_t); extern "C" const char *msglang(void); - +static char *strz(PGLOBAL g, LEX_CSTRING &ls); static void PopUser(PCONNECT xp); static PCONNECT GetUser(THD *thd, PCONNECT xp); static PGLOBAL GetPlug(THD *thd, PCONNECT& lxp); @@ -540,11 +540,7 @@ extern "C" const char *msglang(void) #else // !XMSG && !NEWMSG extern "C" const char *msglang(void) { -#if defined(FRENCH) - return "french"; -#else // DEFAULT return "english"; -#endif // DEFAULT } // end of msglang #endif // !XMSG && !NEWMSG @@ -1301,10 +1297,10 @@ PCSZ GetStringTableOption(PGLOBAL g, PTOS options, PCSZ opname, PCSZ sdef) opval= options->filter; else if (!stricmp(opname, "Data_charset")) opval= options->data_charset; - else if (!stricmp(opname, "Http") || !stricmp(opname, "URL")) - opval= options->http; - else if (!stricmp(opname, "Uri")) - opval= options->uri; + else if (!stricmp(opname, "Http") || !stricmp(opname, "URL")) + opval= options->http; + else if (!stricmp(opname, "Uri")) + opval= options->uri; if (!opval && options->oplist) opval= GetListOption(g, opname, options->oplist); @@ -1403,7 +1399,8 @@ char *ha_connect::GetRealString(PCSZ s) if (IsPartitioned() && s && *partname) { sv= (char*)PlugSubAlloc(xp->g, NULL, 0); - sprintf(sv, s, partname); + PPOOLHEADER pph = (PPOOLHEADER)xp->g->Sarea; + snprintf(sv, xp->g->Sarea_Size - pph->To_Free, s, partname); PlugSubAlloc(xp->g, NULL, strlen(sv) + 1); } else sv= (char*)s; @@ -1617,15 +1614,7 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf) pcf->Scale= 0; pcf->Opt= (fop) ? (int)fop->opt : 0; -// if (fp->field_length >= 0) { - pcf->Length= fp->field_length; - - // length is bytes for Connect, not characters - if (!strnicmp(chset, "utf8", 4)) - pcf->Length /= 3; - -// } else -// pcf->Length= 256; // BLOB? + pcf->Length= fp->field_length; pcf->Precision= pcf->Length; @@ -1812,6 +1801,12 @@ PIXDEF ha_connect::GetIndexInfo(TABLE_SHARE *s) pn= (char*)kp.key_part[k].field->field_name.str; name= PlugDup(g, pn); + if (kp.key_part[k].key_part_flag & HA_REVERSE_SORT) + { + strcpy(g->Message, "Descending indexes are not supported"); + xdp->Invalid= true; + } + // Allocate the key part description block kpp= new(g) KPARTDEF(name, k + 1); kpp->SetKlen(kp.key_part[k].length); @@ -2079,7 +2074,7 @@ int ha_connect::OpenTable(PGLOBAL g, bool del) // Trying to update a column used for partitioning // This cannot be currently done because it may require // a row to be moved in another partition. - sprintf(g->Message, + snprintf(g->Message, sizeof(g->Message), "Cannot update column %s because it is used for partitioning", p); return HA_ERR_INTERNAL_ERROR; @@ -2134,7 +2129,7 @@ bool ha_connect::CheckColumnList(PGLOBAL g) for (field= table->field; (fp= *field); field++) if (bitmap_is_set(map, fp->field_index)) { if (!(colp= tdbp->ColDB(g, (PSZ)fp->field_name.str, 0))) { - sprintf(g->Message, "Column %s not found in %s", + snprintf(g->Message, sizeof(g->Message), "Column %s not found in %s", fp->field_name.str, tdbp->GetName()); throw 1; } // endif colp @@ -2293,7 +2288,7 @@ int ha_connect::MakeRecord(char *buf) char buf[256]; THD *thd= ha_thd(); - sprintf(buf, "Out of range value %.140s for column '%s' at row %ld", + snprintf(buf, sizeof(buf), "Out of range value %.140s for column '%s' at row %ld", value->GetCharString(val), fp->field_name.str, thd->get_stmt_da()->current_row_for_warning()); @@ -2575,7 +2570,7 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q, op= OP_LE; break; default: - sprintf(g->Message, "cannot handle flag %d", ranges[i]->flag); + snprintf(g->Message, sizeof(g->Message), "cannot handle flag %d", ranges[i]->flag); goto err; } // endswitch flag @@ -3073,6 +3068,8 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond) if ((iscol= args[i]->type() == COND::FIELD_ITEM)) { const char *fnm; + char buf[MAX_FIELD_WIDTH]; + String strColumn(buf, sizeof(buf), system_charset_info); ha_field_option_struct *fop; Item_field *pField= (Item_field *)args[i]; @@ -3098,8 +3095,14 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond) return NULL; } else { bool h; - fnm= filp->Chk(pField->field->field_name.str, &h); + if (tty == TYPE_AM_MYSQL && !(x || ismul)) + { + strColumn.length(0); + strColumn.qs_append(STRING_WITH_LEN("`")); + strColumn.qs_append(fnm, strlen(fnm)); + strColumn.append(STRING_WITH_LEN("`")); + } if (h && i && !ishav) return NULL; // Having should be col VOP arg @@ -3113,9 +3116,11 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond) htrc("Field name=%s\n", pField->field->field_name.str); htrc("Field type=%d\n", pField->field->type()); htrc("Field_type=%d\n", args[i]->field_type()); - } // endif trace - - strcat((ishav ? havg : body), fnm); + } // endif trace + if (tty == TYPE_AM_MYSQL && !(x || ismul)) + strcat((ishav ? havg : body), strColumn.ptr()); + else + strcat((ishav ? havg : body), fnm); } else if (args[i]->type() == COND::FUNC_ITEM) { if (tty == TYPE_AM_MYSQL) { if (!CheckCond(g, filp, args[i])) @@ -4897,7 +4902,7 @@ int ha_connect::external_lock(THD *thd, int lock_type) && sqlcom != SQLCOM_FLUSH && sqlcom != SQLCOM_BEGIN && sqlcom != SQLCOM_DROP_TABLE) { - sprintf(g->Message, "external_lock: unexpected command %d", sqlcom); + snprintf(g->Message, sizeof(g->Message), "external_lock: unexpected command %d", sqlcom); push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message); DBUG_RETURN(0); } else if (g->Xchk) { @@ -4907,7 +4912,7 @@ int ha_connect::external_lock(THD *thd, int lock_type) push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message); DBUG_RETURN(0); } else if (!tdbp->GetDef()->Indexable()) { - sprintf(g->Message, "external_lock: Table %s is not indexable", tdbp->GetName()); + snprintf(g->Message, sizeof(g->Message), "external_lock: Table %s is not indexable", tdbp->GetName()); // DBUG_RETURN(HA_ERR_INTERNAL_ERROR); causes assert error push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message); DBUG_RETURN(0); @@ -5656,7 +5661,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, String sql(buf, sizeof(buf), system_charset_info); sql.copy(STRING_WITH_LEN("CREATE TABLE whatever ("), system_charset_info); - user= host= pwd= tbl= src= col= ocl= pic= fcl= skc= rnk= zfn= NULL; + user= host= pwd= tbl= src= col= ocl= pic= fcl= skc= rnk= zfn= NULL; dsn= url= NULL; // Get the useful create options @@ -5708,7 +5713,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, #if defined(ZIP_SUPPORT) zfn= GetListOption(g, "Zipfile", topt->oplist, NULL); #endif // ZIP_SUPPORT - } else { + } else { host= "localhost"; user= ((ttp == TAB_ODBC || ttp == TAB_JDBC) ? NULL : "root"); } // endif option_list @@ -5721,10 +5726,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd, if (ttp == TAB_UNDEF && !topt->http) { topt->type= (src) ? "MYSQL" : (tab) ? "PROXY" : "DOS"; ttp= GetTypeID(topt->type); - sprintf(g->Message, "No table_type. Was set to %s", topt->type); + snprintf(g->Message, sizeof(g->Message), "No table_type. Was set to %s", topt->type); push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, g->Message); } else if (ttp == TAB_NIY) { - sprintf(g->Message, "Unsupported table type %s", topt->type); + snprintf(g->Message, sizeof(g->Message), "Unsupported table type %s", topt->type); rc= HA_ERR_INTERNAL_ERROR; goto err; #if defined(REST_SUPPORT) @@ -5818,7 +5823,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, #endif // PROMPT_OK } else if (!dsn) { - sprintf(g->Message, "Missing %s connection string", topt->type); + snprintf(g->Message, sizeof(g->Message), "Missing %s connection string", topt->type); } else { // Store ODBC additional parameters sop= (POPARM)PlugSubAlloc(g, NULL, sizeof(ODBCPARM)); @@ -5845,17 +5850,17 @@ static int connect_assisted_discovery(handlerton *, THD* thd, PJDBCDEF jdef= new(g) JDBCDEF(); jdef->SetName(create_info->alias.str); - sjp = (PJPARM)PlugSubAlloc(g, NULL, sizeof(JDBCPARM)); - sjp->Driver = driver; - // sjp->Properties = prop; - sjp->Fsize = 0; - sjp->Scrollable = false; - - if ((rc = jdef->ParseURL(g, url, false)) == RC_OK) { - sjp->Url = url; - sjp->User = (char*)user; - sjp->Pwd = (char*)pwd; - ok = true; + sjp= (PJPARM)PlugSubAlloc(g, NULL, sizeof(JDBCPARM)); + sjp->Driver= driver; + // sjp->Properties= prop; + sjp->Fsize= 0; + sjp->Scrollable= false; + + if ((rc= jdef->ParseURL(g, url, false)) == RC_OK) { + sjp->Url= url; + sjp->User= (char*)user; + sjp->Pwd= (char*)pwd; + ok= true; } else if (rc == RC_NF) { if (jdef->GetTabname()) tab= (char*)jdef->GetTabname(); @@ -5873,9 +5878,9 @@ static int connect_assisted_discovery(handlerton *, THD* thd, // fall through case TAB_CSV: if (!fn && fnc != FNC_NO) - sprintf(g->Message, "Missing %s file name", topt->type); + snprintf(g->Message, sizeof(g->Message), "Missing %s file name", topt->type); else if (sep && strlen(sep) > 1) - sprintf(g->Message, "Invalid separator %s", sep); + snprintf(g->Message, sizeof(g->Message), "Invalid separator %s", sep); else ok= true; @@ -5933,7 +5938,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, case TAB_OCCUR: if (!src && !stricmp(tab, create_info->alias.str) && (!db || !stricmp(db, table_s->db.str))) - sprintf(g->Message, "A %s table cannot refer to itself", topt->type); + snprintf(g->Message, sizeof(g->Message), "A %s table cannot refer to itself", topt->type); else ok= true; @@ -5955,7 +5960,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, dsn= strz(g, create_info->connect_string); if (!fn && !zfn && !mul && !dsn) - sprintf(g->Message, "Missing %s file name", topt->type); + snprintf(g->Message, sizeof(g->Message), "Missing %s file name", topt->type); else if (dsn && !topt->tabname) topt->tabname= tab; @@ -5970,11 +5975,11 @@ static int connect_assisted_discovery(handlerton *, THD* thd, break; #endif // JAVA_SUPPORT #if defined(REST_SUPPORT) - case TAB_REST: - if (!topt->http) - strcpy(g->Message, "Missing REST HTTP option"); - else - ok = true; + case TAB_REST: + if (!topt->http) + sprintf(g->Message, "Missing %s HTTP address", topt->type); + else + ok= true; break; #endif // REST_SUPPORT @@ -5982,13 +5987,13 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ok= true; break; default: - sprintf(g->Message, "Cannot get column info for table type %s", topt->type); + snprintf(g->Message, sizeof(g->Message), "Cannot get column info for table type %s", topt->type); break; } // endif ttp // Check for supported catalog function if (ok && !(supfnc & fnc)) { - sprintf(g->Message, "Unsupported catalog function %s for table type %s", + snprintf(g->Message, sizeof(g->Message), "Unsupported catalog function %s for table type %s", fncn, topt->type); ok= false; } // endif supfnc @@ -6044,7 +6049,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, qrp= ODBCDrivers(g, mxr, true); break; default: - sprintf(g->Message, "invalid catfunc %s", fncn); + snprintf(g->Message, sizeof(g->Message), "invalid catfunc %s", fncn); break; } // endswitch info @@ -6075,7 +6080,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, qrp= JDBCDrivers(g, mxr, true); break; default: - sprintf(g->Message, "invalid catfunc %s", fncn); + snprintf(g->Message, sizeof(g->Message), "invalid catfunc %s", fncn); break; } // endswitch info @@ -6138,11 +6143,11 @@ static int connect_assisted_discovery(handlerton *, THD* thd, break; #endif // LIBXML2_SUPPORT || DOMDOC_SUPPORT #if defined(REST_SUPPORT) - case TAB_REST: - qrp = RESTColumns(g, topt, tab, (char *)db, fnc == FNC_COL); - break; + case TAB_REST: + qrp= RESTColumns(g, topt, tab, (char *)db, fnc == FNC_COL); + break; #endif // REST_SUPPORT - case TAB_OEM: + case TAB_OEM: qrp= OEMColumns(g, topt, tab, (char*)db, fnc == FNC_COL); break; default: @@ -6182,9 +6187,9 @@ static int connect_assisted_discovery(handlerton *, THD* thd, // Not a catalog table if (!qrp->Nblin) { if (tab) - sprintf(g->Message, "Cannot get columns from %s", tab); + snprintf(g->Message, sizeof(g->Message), "Cannot get columns from %s", tab); else - strcpy(g->Message, "Fail to retrieve columns"); + strncpy(g->Message, "Fail to retrieve columns", sizeof(g->Message)); rc= HA_ERR_INTERNAL_ERROR; goto err; @@ -6271,7 +6276,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, #if defined(ODBC_SUPPORT) || defined(JAVA_SUPPORT) if ((ttp == TAB_ODBC || ttp == TAB_JDBC) && crp->Kdata) { if (schem && stricmp(schem, crp->Kdata->GetCharValue(i))) { - sprintf(g->Message, + snprintf(g->Message, sizeof(g->Message), "Several %s tables found, specify DBNAME", tab); rc= HA_ERR_INTERNAL_ERROR; goto err; @@ -6293,12 +6298,12 @@ static int connect_assisted_discovery(handlerton *, THD* thd, if (!(plgtyp= TranslateSQLType(typ, dec, prec, v, w))) { if (GetTypeConv() == TPC_SKIP) { // Skip this column - sprintf(g->Message, "Column %s skipped (unsupported type %d)", + snprintf(g->Message, sizeof(g->Message), "Column %s skipped (unsupported type %d)", cnm, typ); push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message); continue; } else { - sprintf(g->Message, "Unsupported SQL type %d", typ); + snprintf(g->Message, sizeof(g->Message), "Unsupported SQL type %d", typ); rc= HA_ERR_INTERNAL_ERROR; goto err; } // endif type_conv @@ -6309,7 +6314,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, switch (typ) { case TYPE_STRING: if (w) { - sprintf(g->Message, "Column %s is wide characters", cnm); + snprintf(g->Message, sizeof(g->Message), "Column %s is wide characters", cnm); push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, g->Message); } // endif w @@ -6335,12 +6340,12 @@ static int connect_assisted_discovery(handlerton *, THD* thd, if (!(plgtyp= TranslateJDBCType(typ, tn, dec, prec, v))) { if (GetTypeConv() == TPC_SKIP) { // Skip this column - sprintf(g->Message, "Column %s skipped (unsupported type %d)", + snprintf(g->Message, sizeof(g->Message), "Column %s skipped (unsupported type %d)", cnm, typ); push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message); continue; } else { - sprintf(g->Message, "Unsupported SQL type %d", typ); + snprintf(g->Message, sizeof(g->Message), "Unsupported SQL type %d", typ); rc= HA_ERR_INTERNAL_ERROR; goto err; } // endif type_conv @@ -6459,7 +6464,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, TABTYPE type; TABLE *st= table; // Probably unuseful THD *thd= ha_thd(); - LEX_CSTRING cnc = table_arg->s->connect_string; + LEX_CSTRING cnc= table_arg->s->connect_string; myf utf8_flag= thd->get_utf8_flag(); #if defined(WITH_PARTITION_STORAGE_ENGINE) partition_info *part_info= table_arg->part_info; @@ -6499,13 +6504,13 @@ int ha_connect::create(const char *name, TABLE *table_arg, #endif // REST_SUPPORT (options->tabname) ? "PROXY" : "DOS"; type= GetTypeID(options->type); - sprintf(g->Message, "No table_type. Will be set to %s", options->type); + snprintf(g->Message, sizeof(g->Message), "No table_type. Will be set to %s", options->type); if (sqlcom == SQLCOM_CREATE_TABLE) push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message); } else if (type == TAB_NIY) { - sprintf(g->Message, "Unsupported table type %s", options->type); + snprintf(g->Message, sizeof(g->Message), "Unsupported table type %s", options->type); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); DBUG_RETURN(HA_ERR_INTERNAL_ERROR); } // endif ttp @@ -6556,7 +6561,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, if (!stricmp(options->tabname, create_info->alias.str) && (!options->dbname || !stricmp(options->dbname, table_arg->s->db.str))) { - sprintf(g->Message, "A %s table cannot refer to itself", + snprintf(g->Message, sizeof(g->Message), "A %s table cannot refer to itself", options->type); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); DBUG_RETURN(HA_ERR_INTERNAL_ERROR); @@ -6665,7 +6670,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, int pretty= atoi(GetListOption(g, "Pretty", options->oplist, "2")); if (!options->lrecl && pretty != 2) { - sprintf(g->Message, "LRECL must be specified for pretty=%d", pretty); + snprintf(g->Message, sizeof(g->Message), "LRECL must be specified for pretty=%d", pretty); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); rc= HA_ERR_INTERNAL_ERROR; DBUG_RETURN(rc); @@ -6677,7 +6682,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, const char *sep= options->separator; if (sep && strlen(sep) > 1) { - sprintf(g->Message, "Invalid separator %s", sep); + snprintf(g->Message, sizeof(g->Message), "Invalid separator %s", sep); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); rc= HA_ERR_INTERNAL_ERROR; DBUG_RETURN(rc); @@ -6700,7 +6705,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, } // endif flags if (fp->flags & (BLOB_FLAG | ENUM_FLAG | SET_FLAG)) { - sprintf(g->Message, "Unsupported type for column %s", + snprintf(g->Message, sizeof(g->Message), "Unsupported type for column %s", fp->field_name.str); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); rc= HA_ERR_INTERNAL_ERROR; @@ -6737,7 +6742,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, case MYSQL_TYPE_STRING: #if 0 if (!fp->field_length) { - sprintf(g->Message, "Unsupported 0 length for column %s", + snprintf(g->Message, sizeof(g->Message), "Unsupported 0 length for column %s", fp->field_name.str); rc= HA_ERR_INTERNAL_ERROR; my_printf_error(ER_UNKNOWN_ERROR, @@ -6758,7 +6763,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, case MYSQL_TYPE_GEOMETRY: default: // fprintf(stderr, "Unsupported type column %s\n", fp->field_name.str); - sprintf(g->Message, "Unsupported type for column %s", + snprintf(g->Message, sizeof(g->Message), "Unsupported type for column %s", fp->field_name.str); rc= HA_ERR_INTERNAL_ERROR; my_printf_error(ER_UNKNOWN_ERROR, "Unsupported type for column %s", @@ -6778,10 +6783,10 @@ int ha_connect::create(const char *name, TABLE *table_arg, bool b= false; if ((b= fp->field_name.length > 10)) - sprintf(g->Message, "DBF: Column name '%s' is too long (max=10)", + snprintf(g->Message, sizeof(g->Message), "DBF: Column name '%s' is too long (max=10)", fp->field_name.str); else if ((b= fp->field_length > 255)) - sprintf(g->Message, "DBF: Column length too big for '%s' (max=255)", + snprintf(g->Message, sizeof(g->Message), "DBF: Column length too big for '%s' (max=255)", fp->field_name.str); if (b) { @@ -6844,7 +6849,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, *p= 0; } else { strcat(strcat(strcpy(buf, GetTableName()), "."), lwt); - sprintf(g->Message, "No file name. Table will use %s", buf); + snprintf(g->Message, sizeof(g->Message), "No file name. Table will use %s", buf); if (sqlcom == SQLCOM_CREATE_TABLE) push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message); @@ -6856,9 +6861,9 @@ int ha_connect::create(const char *name, TABLE *table_arg, if ((h= ::open(fn, O_CREAT | O_EXCL, 0666)) == -1) { if (errno == EEXIST) - sprintf(g->Message, "Default file %s already exists", fn); + snprintf(g->Message, sizeof(g->Message), "Default file %s already exists", fn); else - sprintf(g->Message, "Error %d creating file %s", errno, fn); + snprintf(g->Message, sizeof(g->Message), "Error %d creating file %s", errno, fn); push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message); } else @@ -6921,7 +6926,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, if (g->Alchecked == 0 && (!IsFileType(type) || FileExists(options->filename, false))) { if (part_info) { - sprintf(g->Message, "Data repartition in %s is unchecked", partname); + snprintf(g->Message, sizeof(g->Message), "Data repartition in %s is unchecked", partname); push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message); } else if (sqlcom == SQLCOM_ALTER_TABLE) { // This is an ALTER to CONNECT from another engine. @@ -6944,6 +6949,9 @@ int ha_connect::create(const char *name, TABLE *table_arg, strcpy(g->Message, "Compressed tables are not indexable"); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); rc= HA_ERR_UNSUPPORTED; + } else if (xdp->Invalid) { + my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); + rc= HA_ERR_UNSUPPORTED; } else if (GetIndexType(type) == 1) { PDBUSER dup= PlgGetUser(g); PCATLG cat= (dup) ? dup->Catalog : NULL; @@ -6973,7 +6981,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, } // endif Check } else if (!GetIndexType(type)) { - sprintf(g->Message, "Table type %s is not indexable", options->type); + snprintf(g->Message, sizeof(g->Message), "Table type %s is not indexable", options->type); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); rc= HA_ERR_UNSUPPORTED; } // endif index type @@ -7006,8 +7014,8 @@ bool ha_connect::FileExists(const char *fn, bool bf) if (table) { const char *s; - char tfn[_MAX_PATH], filename[_MAX_PATH], path[_MAX_PATH]; - bool b= false; + char tfn[_MAX_PATH], filename[_MAX_PATH], path[_MAX_PATH]; + bool b= false; int n; struct stat info; @@ -7017,7 +7025,7 @@ bool ha_connect::FileExists(const char *fn, bool bf) s= "/"; #endif // !_WIN32 if (IsPartitioned()) { - sprintf(tfn, fn, GetPartName()); + snprintf(tfn, sizeof(tfn), fn, GetPartName()); // This is to avoid an initialization error raised by the // test on check_table_flags made in ha_partition::open @@ -7034,7 +7042,7 @@ bool ha_connect::FileExists(const char *fn, bool bf) if (errno != ENOENT) { char buf[_MAX_PATH + 20]; - sprintf(buf, "Error %d for file %s", errno, filename); + snprintf(buf, sizeof(buf), "Error %d for file %s", errno, filename); push_warning(table->in_use, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, buf); return true; } else @@ -7262,7 +7270,7 @@ ha_connect::check_if_supported_inplace_alter(TABLE *altered_table, } // endif Check } else if (!GetIndexType(type)) { - sprintf(g->Message, "Table type %s is not indexable", oldopt->type); + snprintf(g->Message, sizeof(g->Message), "Table type %s is not indexable", oldopt->type); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); DBUG_RETURN(HA_ALTER_ERROR); } // endif index type diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h index d1aca22b01fd9..71ceb7974ba70 100644 --- a/storage/connect/ha_connect.h +++ b/storage/connect/ha_connect.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 Street, Fifth Floor, Boston, MA 02110-1335 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ /** @file ha_connect.h Author Olivier Bertrand @@ -555,3 +555,25 @@ int index_prev(uchar *buf); #if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT) bool MongoEnabled(void); #endif // JAVA_SUPPORT || CMGO_SUPPORT + +/* This is a hack for ASAN + * Libraries such as libxml2 and libodbc do not like being unloaded before + * exit and will show as a leak in ASAN with no stack trace (as the plugin + * has been unloaded from memory). + * + * The below is designed to trick the compiler into adding a "UNIQUE" symbol + * which can be seen using: + * readelf -s storage/connect/ha_connect.so | grep UNIQUE + * + * Having this symbol means that the plugin remains in memory after dlclose() + * has been called. Thereby letting the libraries clean up properly. + */ +#if defined(__SANITIZE_ADDRESS__) +__attribute__((__used__)) +inline int dummy(void) +{ + static int d; + d++; + return d; +} +#endif diff --git a/storage/connect/ioapi.c b/storage/connect/ioapi.c index a49da91f7f064..b6a0ec318e64d 100644 --- a/storage/connect/ioapi.c +++ b/storage/connect/ioapi.c @@ -14,8 +14,7 @@ #define _CRT_SECURE_NO_WARNINGS #endif -#if defined(__APPLE__) || defined(IOAPI_NO_64) -// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions +#if defined(IOAPI_NO_64) #define FOPEN_FUNC(filename, mode) fopen(filename, mode) #define FTELLO_FUNC(stream) ftello(stream) #define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin) @@ -222,8 +221,7 @@ static int ZCALLBACK ferror_file_func (voidpf opaque __attribute__((unused)), vo return ret; } -void fill_fopen_filefunc (pzlib_filefunc_def) - zlib_filefunc_def* pzlib_filefunc_def; +void fill_fopen_filefunc (zlib_filefunc_def* pzlib_filefunc_def) { pzlib_filefunc_def->zopen_file = fopen_file_func; pzlib_filefunc_def->zread_file = fread_file_func; diff --git a/storage/connect/ioapi.h b/storage/connect/ioapi.h index e2148c56bac2c..44430e56dd4e2 100644 --- a/storage/connect/ioapi.h +++ b/storage/connect/ioapi.h @@ -21,7 +21,7 @@ #ifndef _ZLIBIOAPI64_H #define _ZLIBIOAPI64_H -#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) +#if defined(__linux__) // Linux needs this to support file operation on files larger then 4+GB // But might need better if/def to select just the platforms that needs them. @@ -50,7 +50,8 @@ #define ftello64 ftell #define fseeko64 fseek #else -#ifdef __FreeBSD__ +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ + defined(__OpenBSD__) || defined(__DragonFly__) #define fopen64 fopen #define ftello64 ftello #define fseeko64 fseeko diff --git a/storage/connect/javaconn.cpp b/storage/connect/javaconn.cpp index de37d5b697022..efde2e8633078 100644 --- a/storage/connect/javaconn.cpp +++ b/storage/connect/javaconn.cpp @@ -33,6 +33,8 @@ #define NODW #endif // !_WIN32 +#include + /***********************************************************************/ /* Required objects includes. */ /***********************************************************************/ @@ -231,15 +233,16 @@ bool JAVAConn::GetJVM(PGLOBAL g) #if defined(_WIN32) for (ntry = 0; !LibJvm && ntry < 3; ntry++) { if (!ntry && JvmPath) { - strcat(strcpy(soname, JvmPath), "\\jvm.dll"); + snprintf(soname, sizeof(soname), "%s\\jvm.dll", JvmPath); + ntry = 3; // No other try } else if (ntry < 2 && getenv("JAVA_HOME")) { - strcpy(soname, getenv("JAVA_HOME")); + safe_strcpy(soname, sizeof(soname), getenv("JAVA_HOME")); if (ntry == 1) - strcat(soname, "\\jre"); + safe_strcat(soname, sizeof(soname), "\\jre"); - strcat(soname, "\\bin\\client\\jvm.dll"); + safe_strcat(soname, sizeof(soname), "\\bin\\client\\jvm.dll"); } else { // Try to find it through the registry char version[16]; @@ -247,11 +250,12 @@ bool JAVAConn::GetJVM(PGLOBAL g) LONG rc; DWORD BufferSize = 16; - strcpy(soname, "jvm.dll"); // In case it fails + safe_strcpy(soname, sizeof(soname), "jvm.dll"); // In case it fails if ((rc = RegGetValue(HKEY_LOCAL_MACHINE, javaKey, "CurrentVersion", RRF_RT_ANY, NULL, (PVOID)&version, &BufferSize)) == ERROR_SUCCESS) { - strcat(strcat(javaKey, "\\"), version); + safe_strcat(javaKey, sizeof(javaKey), "\\"); + safe_strcat(javaKey, sizeof(javaKey), version); BufferSize = sizeof(soname); if ((rc = RegGetValue(HKEY_LOCAL_MACHINE, javaKey, "RuntimeLib", @@ -272,25 +276,25 @@ bool JAVAConn::GetJVM(PGLOBAL g) char buf[256]; DWORD rc = GetLastError(); - sprintf(g->Message, MSG(DLL_LOAD_ERROR), rc, soname); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)buf, sizeof(buf), NULL); - strcat(strcat(g->Message, ": "), buf); + snprintf(g->Message, sizeof(g->Message), MSG(DLL_LOAD_ERROR)": %s", rc, + soname, buf); } else if (!(CreateJavaVM = (CRTJVM)GetProcAddress((HINSTANCE)LibJvm, "JNI_CreateJavaVM"))) { - sprintf(g->Message, MSG(PROCADD_ERROR), GetLastError(), "JNI_CreateJavaVM"); + snprintf(g->Message, sizeof(g->Message), MSG(PROCADD_ERROR), GetLastError(), "JNI_CreateJavaVM"); FreeLibrary((HMODULE)LibJvm); LibJvm = NULL; } else if (!(GetCreatedJavaVMs = (GETJVM)GetProcAddress((HINSTANCE)LibJvm, "JNI_GetCreatedJavaVMs"))) { - sprintf(g->Message, MSG(PROCADD_ERROR), GetLastError(), "JNI_GetCreatedJavaVMs"); + snprintf(g->Message, sizeof(g->Message), MSG(PROCADD_ERROR), GetLastError(), "JNI_GetCreatedJavaVMs"); FreeLibrary((HMODULE)LibJvm); LibJvm = NULL; #if defined(_DEBUG) } else if (!(GetDefaultJavaVMInitArgs = (GETDEF)GetProcAddress((HINSTANCE)LibJvm, "JNI_GetDefaultJavaVMInitArgs"))) { - sprintf(g->Message, MSG(PROCADD_ERROR), GetLastError(), + snprintf(g->Message, sizeof(g->Message), MSG(PROCADD_ERROR), GetLastError(), "JNI_GetDefaultJavaVMInitArgs"); FreeLibrary((HMODULE)LibJvm); LibJvm = NULL; @@ -301,13 +305,14 @@ bool JAVAConn::GetJVM(PGLOBAL g) for (ntry = 0; !LibJvm && ntry < 2; ntry++) { if (!ntry && JvmPath) { - strcat(strcpy(soname, JvmPath), "/libjvm.so"); + snprintf(soname, sizeof(soname), "%s/libjvm.so", JvmPath); ntry = 2; } else if (!ntry && getenv("JAVA_HOME")) { // TODO: Replace i386 by a better guess - strcat(strcpy(soname, getenv("JAVA_HOME")), "/jre/lib/i386/client/libjvm.so"); + snprintf(soname, sizeof(soname), "%s/jre/lib/i386/client/libjvm.so", + getenv("JAVA_HOME")); } else { // Will need LD_LIBRARY_PATH to be set - strcpy(soname, "libjvm.so"); + safe_strcpy(soname, sizeof(soname), "libjvm.so"); ntry = 2; } // endelse @@ -317,22 +322,22 @@ bool JAVAConn::GetJVM(PGLOBAL g) // Load the desired shared library if (!LibJvm) { error = dlerror(); - sprintf(g->Message, MSG(SHARED_LIB_ERR), soname, SVP(error)); + snprintf(g->Message, sizeof(g->Message), MSG(SHARED_LIB_ERR), soname, SVP(error)); } else if (!(CreateJavaVM = (CRTJVM)dlsym(LibJvm, "JNI_CreateJavaVM"))) { error = dlerror(); - sprintf(g->Message, MSG(GET_FUNC_ERR), "JNI_CreateJavaVM", SVP(error)); + snprintf(g->Message, sizeof(g->Message), MSG(GET_FUNC_ERR), "JNI_CreateJavaVM", SVP(error)); dlclose(LibJvm); LibJvm = NULL; } else if (!(GetCreatedJavaVMs = (GETJVM)dlsym(LibJvm, "JNI_GetCreatedJavaVMs"))) { error = dlerror(); - sprintf(g->Message, MSG(GET_FUNC_ERR), "JNI_GetCreatedJavaVMs", SVP(error)); + snprintf(g->Message, sizeof(g->Message), MSG(GET_FUNC_ERR), "JNI_GetCreatedJavaVMs", SVP(error)); dlclose(LibJvm); LibJvm = NULL; #if defined(_DEBUG) } else if (!(GetDefaultJavaVMInitArgs = (GETDEF)dlsym(LibJvm, "JNI_GetDefaultJavaVMInitArgs"))) { error = dlerror(); - sprintf(g->Message, MSG(GET_FUNC_ERR), "JNI_GetDefaultJavaVMInitArgs", SVP(error)); + snprintf(g->Message, sizeof(g->Message), MSG(GET_FUNC_ERR), "JNI_GetDefaultJavaVMInitArgs", SVP(error)); dlclose(LibJvm); LibJvm = NULL; #endif // _DEBUG @@ -473,7 +478,7 @@ bool JAVAConn::Open(PGLOBAL g) strcpy(g->Message, "Invalid arguments"); break; default: - sprintf(g->Message, "Unknown return code %d", (int)rc); + snprintf(g->Message, sizeof(g->Message), "Unknown return code %d", (int)rc); break; } // endswitch rc @@ -492,7 +497,7 @@ bool JAVAConn::Open(PGLOBAL g) jdi = env->FindClass(m_Wrap); if (jdi == nullptr) { - sprintf(g->Message, "ERROR: class %s not found!", m_Wrap); + snprintf(g->Message, sizeof(g->Message), "ERROR: class %s not found!", m_Wrap); return true; } // endif jdi @@ -538,13 +543,13 @@ bool JAVAConn::Open(PGLOBAL g) jmethodID ctor = env->GetMethodID(jdi, "", "(Z)V"); if (ctor == nullptr) { - sprintf(g->Message, "ERROR: %s constructor not found!", m_Wrap); + snprintf(g->Message, sizeof(g->Message), "ERROR: %s constructor not found!", m_Wrap); return true; } else job = env->NewObject(jdi, ctor, jt); if (job == nullptr) { - sprintf(g->Message, "%s class object not constructed!", m_Wrap); + snprintf(g->Message, sizeof(g->Message), "%s class object not constructed!", m_Wrap); return true; } // endif job diff --git a/storage/connect/jdbconn.cpp b/storage/connect/jdbconn.cpp index c3a30f3501e85..0ba1f56aa505f 100644 --- a/storage/connect/jdbconn.cpp +++ b/storage/connect/jdbconn.cpp @@ -451,8 +451,14 @@ PQRYRES JDBCSrcCols(PGLOBAL g, PCSZ src, PJPARM sjp) if (strstr(src, "%s")) { // Place holder for an eventual where clause - sqry = (char*)PlugSubAlloc(g, NULL, strlen(src) + 2); - sprintf(sqry, src, "1=1"); // dummy where clause + size_t sqry_size = strlen(src) + 2; + sqry = (char*)PlugSubAlloc(g, NULL, sqry_size); + // Function PlugSubAlloc(...) recalculate string size + // while allocate memory - it rounds size up size to multiple of 8 + // we need to know the real allocated size + // to use it in sprintf(...) + const int sqry_real_allocated_size = ROUNDUP_TO_8(sqry_size); + snprintf(sqry, sqry_real_allocated_size, src, "1=1"); // dummy where clause } else sqry = (char*)src; @@ -689,17 +695,17 @@ bool JDBConn::SetUUID(PGLOBAL g, PTDBJDBC tjp) ncol = env->CallIntMethod(job, catid, parms); if (Check(ncol)) { - sprintf(g->Message, "%s: %s", fnc, Msg); + snprintf(g->Message, sizeof(g->Message), "%s: %s", fnc, Msg); goto err; } // endif Check rc = env->CallBooleanMethod(job, readid); if (Check(rc)) { - sprintf(g->Message, "ReadNext: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "ReadNext: %s", Msg); goto err; } else if (rc == 0) { - sprintf(g->Message, "table %s does not exist", tjp->TableName); + snprintf(g->Message, sizeof(g->Message), "table %s does not exist", tjp->TableName); goto err; } // endif rc @@ -707,7 +713,7 @@ bool JDBConn::SetUUID(PGLOBAL g, PTDBJDBC tjp) ctyp = (int)env->CallIntMethod(job, intfldid, 5, nullptr); //if (Check((ctyp == 666) ? -1 : 1)) { - // sprintf(g->Message, "Getting ctyp: %s", Msg); + // snprintf(g->Message, sizeof(g->Message), "Getting ctyp: %s", Msg); // goto err; //} // endif ctyp @@ -813,7 +819,7 @@ bool JDBConn::Connect(PJPARM sop) env->DeleteLocalRef(parms); // Not used anymore if (err) { - sprintf(g->Message, "Connecting: %s rc=%d", Msg, (int)rc); + snprintf(g->Message, sizeof(g->Message), "Connecting: %s rc=%d", Msg, (int)rc); return true; } // endif Msg @@ -861,14 +867,14 @@ int JDBConn::ExecuteCommand(PCSZ sql) env->DeleteLocalRef(qry); if (Check(n)) { - sprintf(g->Message, "Execute: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "Execute: %s", Msg); return RC_FX; } // endif n m_Ncol = env->CallIntMethod(job, grs); if (Check(m_Ncol)) { - sprintf(g->Message, "GetResult: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "GetResult: %s", Msg); rc = RC_FX; } else if (m_Ncol) { strcpy(g->Message, "Result set column number"); @@ -917,7 +923,7 @@ int JDBConn::Fetch(int pos) m_Rows += (int)rc; } else - sprintf(g->Message, "Fetch: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "Fetch: %s", Msg); } // endif pos @@ -959,7 +965,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) if (rank == 0) if (!name || (jn = env->NewStringUTF(name)) == nullptr) { - sprintf(g->Message, "Fail to allocate jstring %s", SVP(name)); + snprintf(g->Message, sizeof(g->Message), "Fail to allocate jstring %s", SVP(name)); throw (int)TYPE_AM_JDBC; } // endif name @@ -967,7 +973,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) ctyp = env->CallIntMethod(job, typid, rank, jn); if (Check((ctyp == 666) ? -1 : 1)) { - sprintf(g->Message, "Getting ctyp: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "Getting ctyp: %s", Msg); throw (int)TYPE_AM_JDBC; } // endif Check @@ -976,7 +982,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) jb = env->CallObjectMethod(job, objfldid, (jint)rank, jn); if (Check(0)) { - sprintf(g->Message, "Getting jp: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "Getting jp: %s", Msg); throw (int)TYPE_AM_JDBC; } // endif Check @@ -1096,7 +1102,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) if (rank == 0) env->DeleteLocalRef(jn); - sprintf(g->Message, "SetColumnValue: %s rank=%d ctyp=%d", Msg, rank, (int)ctyp); + snprintf(g->Message, sizeof(g->Message), "SetColumnValue: %s rank=%d ctyp=%d", Msg, rank, (int)ctyp); throw (int)TYPE_AM_JDBC; } // endif Check @@ -1118,7 +1124,7 @@ bool JDBConn::PrepareSQL(PCSZ sql) jstring qry = env->NewStringUTF(sql); if (Check(env->CallBooleanMethod(job, prepid, qry))) - sprintf(g->Message, "CreatePrepStmt: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "CreatePrepStmt: %s", Msg); else b = false; @@ -1148,7 +1154,7 @@ int JDBConn::ExecuteQuery(PCSZ sql) m_Aff = 0; // Affected rows rc = RC_OK; } else - sprintf(g->Message, "ExecuteQuery: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "ExecuteQuery: %s", Msg); env->DeleteLocalRef(qry); } // endif xqid @@ -1176,7 +1182,7 @@ int JDBConn::ExecuteUpdate(PCSZ sql) m_Aff = (int)n; // Affected rows rc = RC_OK; } else - sprintf(g->Message, "ExecuteUpdate: %s n=%d", Msg, n); + snprintf(g->Message, sizeof(g->Message), "ExecuteUpdate: %s n=%d", Msg, n); env->DeleteLocalRef(qry); } // endif xuid @@ -1226,7 +1232,7 @@ int JDBConn::ExecuteSQL(void) if (n == -3) strcpy(g->Message, "SQL statement is not prepared"); else if (Check(n)) - sprintf(g->Message, "ExecutePrep: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "ExecutePrep: %s", Msg); else { m_Aff = (int)n; rc = RC_OK; @@ -1325,12 +1331,12 @@ bool JDBConn::SetParam(JDBCCOL *colp) env->CallVoidMethod(job, setid, i, datobj); break; default: - sprintf(g->Message, "Parm type %d not supported", val->GetType()); + snprintf(g->Message, sizeof(g->Message), "Parm type %d not supported", val->GetType()); return true; } // endswitch Type if (Check(jrc)) { - sprintf(g->Message, "SetParam: col=%s msg=%s", colp->GetName(), Msg); + snprintf(g->Message, sizeof(g->Message), "SetParam: col=%s msg=%s", colp->GetName(), Msg); rc = true; } // endif msg @@ -1453,7 +1459,7 @@ bool JDBConn::SetParam(JDBCCOL *colp) for (i = 0; i < m_Ncol; i++) { if (!(label = (jstring)env->CallObjectMethod(job, colid, i + 1, val))) { if (Check()) - sprintf(g->Message, "ColumnDesc: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "ColumnDesc: %s", Msg); else strcpy(g->Message, "No result metadata"); @@ -1535,7 +1541,7 @@ bool JDBConn::SetParam(JDBCCOL *colp) break; #endif // 0 default: - sprintf(g->Message, "Invalid SQL function id"); + snprintf(g->Message, sizeof(g->Message), "Invalid SQL function id"); return -1; } // endswitch infotype @@ -1546,7 +1552,7 @@ bool JDBConn::SetParam(JDBCCOL *colp) ncol = env->CallIntMethod(job, catid, parms); if (Check(ncol)) { - sprintf(g->Message, "%s: %s", fnc, Msg); + snprintf(g->Message, sizeof(g->Message), "%s: %s", fnc, Msg); env->DeleteLocalRef(parms); return -1; } // endif Check @@ -1571,7 +1577,7 @@ bool JDBConn::SetParam(JDBCCOL *colp) // Prepare retrieving column values for (n = 0, crp = qrp->Colresp; crp; crp = crp->Next) { if (!(tp = GetJDBCType(crp->Type))) { - sprintf(g->Message, MSG(INV_COLUMN_TYPE), crp->Type, crp->Name); + snprintf(g->Message, sizeof(g->Message), MSG(INV_COLUMN_TYPE), crp->Type, crp->Name); return -1; } // endif tp @@ -1596,7 +1602,7 @@ bool JDBConn::SetParam(JDBCCOL *colp) // Now fetch the result for (i = 0; i < qrp->Maxres; i++) { if (Check(rc = Fetch(0))) { - sprintf(g->Message, "Fetch: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "Fetch: %s", Msg); return -1; } if (rc == 0) { if (trace(1)) @@ -1665,7 +1671,7 @@ bool JDBConn::SetParam(JDBCCOL *colp) if (!(crp->Kdata = AllocValBlock(g, NULL, crp->Type, m_Rows, crp->Clen, 0, FALSE, TRUE, uns))) { - sprintf(g->Message, MSG(INV_RESULT_TYPE), + snprintf(g->Message, sizeof(g->Message), MSG(INV_RESULT_TYPE), GetFormatType(crp->Type)); return NULL; } // endif Kdata diff --git a/storage/connect/jmgoconn.cpp b/storage/connect/jmgoconn.cpp index a4091e88bbf30..f527eb83dfe89 100644 --- a/storage/connect/jmgoconn.cpp +++ b/storage/connect/jmgoconn.cpp @@ -193,7 +193,7 @@ bool JMgoConn::Connect(PJPARM sop) env->DeleteLocalRef(parms); // Not used anymore if (err) { - sprintf(g->Message, "Connecting: %s rc=%d", Msg, (int)rc); + snprintf(g->Message, sizeof(g->Message), "Connecting: %s rc=%d", Msg, (int)rc); return true; } // endif Msg @@ -208,7 +208,7 @@ bool JMgoConn::Connect(PJPARM sop) env->DeleteLocalRef(cln); if (Check(brc ? -1 : 0)) { - sprintf(g->Message, "GetCollection: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "GetCollection: %s", Msg); return true; } // endif Msg @@ -429,7 +429,7 @@ bool JMgoConn::FindCollection(PCSZ query, PCSZ proj) if (!Check(brc ? -1 : 0)) { rc = false; } else - sprintf(g->Message, "FindColl: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "FindColl: %s", Msg); if (query) env->DeleteLocalRef(qry); @@ -461,7 +461,7 @@ bool JMgoConn::AggregateCollection(PCSZ pipeline) if (!Check(brc ? -1 : 0)) { rc = false; } else - sprintf(g->Message, "AggregateColl: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "AggregateColl: %s", Msg); env->DeleteLocalRef(pip); } // endif acollid @@ -506,7 +506,7 @@ int JMgoConn::Fetch(int pos) rc = MY_MIN(rc, 1); m_Rows += rc; } else - sprintf(g->Message, "Fetch: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "Fetch: %s", Msg); //} // endif pos @@ -633,13 +633,13 @@ jobject JMgoConn::MakeObject(PGLOBAL g, PCOL colp, bool&error ) val = env->NewObject(cls, cns, valp->GetFloatValue()); break; default: - sprintf(g->Message, "Cannot make object from %d type", valp->GetType()); + snprintf(g->Message, sizeof(g->Message), "Cannot make object from %d type", valp->GetType()); error = true; break; } // endswitch Type } catch (...) { - sprintf(g->Message, "Cannot make object from %s value", colp->GetName()); + snprintf(g->Message, sizeof(g->Message), "Cannot make object from %s value", colp->GetName()); error = true; } // end try/catch @@ -723,9 +723,9 @@ jobject JMgoConn::MakeDoc(PGLOBAL g, PJNCOL jcp) } else if (env->CallBooleanMethod(job, araddid, parent, kp->N, val, j)) { if (Check(-1)) - sprintf(g->Message, "ArrayAdd: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "ArrayAdd: %s", Msg); else - sprintf(g->Message, "ArrayAdd: unknown error"); + snprintf(g->Message, sizeof(g->Message), "ArrayAdd: unknown error"); return NULL; } // endif ArrayAdd @@ -766,9 +766,9 @@ int JMgoConn::DocWrite(PGLOBAL g, PCSZ line) if (env->CallBooleanMethod(job, insertid, doc)) { if (Check(-1)) - sprintf(g->Message, "CollInsert: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "CollInsert: %s", Msg); else - sprintf(g->Message, "CollInsert: unknown error"); + snprintf(g->Message, sizeof(g->Message), "CollInsert: unknown error"); rc = RC_FX; } // endif Insert @@ -823,7 +823,7 @@ int JMgoConn::DocUpdate(PGLOBAL g, PTDB tdbp) htrc("DocUpdate: ar = %ld\n", ar); if (Check((int)ar)) { - sprintf(g->Message, "CollUpdate: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "CollUpdate: %s", Msg); rc = RC_FX; } // endif ar @@ -842,7 +842,7 @@ int JMgoConn::DocDelete(PGLOBAL g, bool all) htrc("DocDelete: ar = %ld\n", ar); if (Check((int)ar)) { - sprintf(g->Message, "CollDelete: %s", Msg); + snprintf(g->Message, sizeof(g->Message), "CollDelete: %s", Msg); rc = RC_FX; } // endif ar @@ -867,7 +867,7 @@ PSZ JMgoConn::GetColumnValue(PSZ path) jstring fn, jn = nullptr; if (!path || (jn = env->NewStringUTF(path)) == nullptr) { - sprintf(g->Message, "Fail to allocate jstring %s", SVP(path)); + snprintf(g->Message, sizeof(g->Message), "Fail to allocate jstring %s", SVP(path)); throw (int)TYPE_AM_MGO; } // endif name diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp index 17c6ba9791a09..a46d600143471 100644 --- a/storage/connect/json.cpp +++ b/storage/connect/json.cpp @@ -10,6 +10,7 @@ /* Include relevant sections of the MariaDB header file. */ /***********************************************************************/ #include +#include /***********************************************************************/ /* Include application header files: */ @@ -208,7 +209,7 @@ PJSON ParseJson(PGLOBAL g, char* s, size_t len, int* ptyp, bool* comma) break; } // endif pretty - sprintf(g->Message, "Unexpected ',' (pretty=%d)", pretty); + snprintf(g->Message, sizeof(g->Message), "Unexpected ',' (pretty=%d)", pretty); throw 3; case '(': b = true; @@ -229,7 +230,7 @@ PJSON ParseJson(PGLOBAL g, char* s, size_t len, int* ptyp, bool* comma) }; // endswitch s[i] if (!jsp) - sprintf(g->Message, "Invalid Json string '%.*s'", MY_MIN((int)len, 50), s); + snprintf(g->Message, sizeof(g->Message), "Invalid Json string '%.*s'", MY_MIN((int)len, 50), s); else if (ptyp && pretty == 3) { *ptyp = 3; // Not recognized pretty @@ -270,7 +271,7 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char* fn, int pretty) { jdp->dfp = GetDefaultPrec(); if (!jsp) { - strcpy(g->Message, "Null json tree"); + safe_strcpy(g->Message, sizeof(g->Message), "Null json tree"); throw 1; } else if (!fn) { // Serialize to a string @@ -278,9 +279,8 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char* fn, int pretty) { b = pretty == 1; } else { if (!(fs = fopen(fn, "wb"))) { - sprintf(g->Message, MSG(OPEN_MODE_ERROR), - "w", (int)errno, fn); - strcat(strcat(g->Message, ": "), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR) ": %s", + "w", (int)errno, fn, strerror(errno)); throw 2; } else if (pretty >= 2) { // Serialize to a pretty file @@ -571,7 +571,7 @@ PJAR JDOC::ParseArray(PGLOBAL g, int& i) switch (s[i]) { case ',': if (level < 2) { - sprintf(g->Message, "Unexpected ',' near %.*s",ARGS); + snprintf(g->Message, sizeof(g->Message), "Unexpected ',' near %.*s",ARGS); throw 1; } else level = 1; @@ -579,7 +579,7 @@ PJAR JDOC::ParseArray(PGLOBAL g, int& i) break; case ']': if (level == 1) { - sprintf(g->Message, "Unexpected ',]' near %.*s", ARGS); + snprintf(g->Message, sizeof(g->Message), "Unexpected ',]' near %.*s", ARGS); throw 1; } // endif level @@ -594,7 +594,7 @@ PJAR JDOC::ParseArray(PGLOBAL g, int& i) break; default: if (level == 2) { - sprintf(g->Message, "Unexpected value near %.*s", ARGS); + snprintf(g->Message, sizeof(g->Message), "Unexpected value near %.*s", ARGS); throw 1; } else jarp->AddArrayValue(g, ParseValue(g, i)); @@ -630,7 +630,7 @@ PJOB JDOC::ParseObject(PGLOBAL g, int& i) jpp = jobp->AddPair(g, key); level = 1; } else { - sprintf(g->Message, "misplaced string near %.*s", ARGS); + snprintf(g->Message, sizeof(g->Message), "misplaced string near %.*s", ARGS); throw 2; } // endif level @@ -640,14 +640,14 @@ PJOB JDOC::ParseObject(PGLOBAL g, int& i) jpp->Val = ParseValue(g, ++i); level = 2; } else { - sprintf(g->Message, "Unexpected ':' near %.*s", ARGS); + snprintf(g->Message, sizeof(g->Message), "Unexpected ':' near %.*s", ARGS); throw 2; } // endif level break; case ',': if (level < 2) { - sprintf(g->Message, "Unexpected ',' near %.*s", ARGS); + snprintf(g->Message, sizeof(g->Message), "Unexpected ',' near %.*s", ARGS); throw 2; } else level = 0; @@ -655,7 +655,7 @@ PJOB JDOC::ParseObject(PGLOBAL g, int& i) break; case '}': if (level == 0 || level == 1) { - sprintf(g->Message, "Unexpected '}' near %.*s", ARGS); + snprintf(g->Message, sizeof(g->Message), "Unexpected '}' near %.*s", ARGS); throw 2; } // endif level @@ -667,7 +667,7 @@ PJOB JDOC::ParseObject(PGLOBAL g, int& i) case '\t': break; default: - sprintf(g->Message, "Unexpected character '%c' near %.*s", + snprintf(g->Message, sizeof(g->Message), "Unexpected character '%c' near %.*s", s[i], ARGS); throw 2; }; // endswitch s[i] @@ -750,7 +750,7 @@ PJVAL JDOC::ParseValue(PGLOBAL g, int& i) return jvp; err: - sprintf(g->Message, "Unexpected character '%c' near %.*s", s[i], ARGS); + snprintf(g->Message, sizeof(g->Message), "Unexpected character '%c' near %.*s", s[i], ARGS); throw 3; } // end of ParseValue @@ -1023,13 +1023,13 @@ bool JDOC::SerializeValue(PJVAL jvp) case TYPE_DTM: return js->Escape(jvp->Strp); case TYPE_INTG: - sprintf(buf, "%d", jvp->N); + snprintf(buf, sizeof(buf), "%d", jvp->N); return js->WriteStr(buf); case TYPE_BINT: - sprintf(buf, "%lld", jvp->LLn); + snprintf(buf, sizeof(buf), "%lld", jvp->LLn); return js->WriteStr(buf); case TYPE_DBL: // dfp to limit to the default number of decimals - sprintf(buf, "%.*f", MY_MIN(jvp->Nd, dfp), jvp->F); + snprintf(buf, sizeof(buf), "%.*f", MY_MIN(jvp->Nd, dfp), jvp->F); return js->WriteStr(buf); case TYPE_NULL: return js->WriteStr("null"); @@ -1767,7 +1767,7 @@ void JVALUE::SetValue(PGLOBAL g, PVAL valp) DataType = TYPE_BINT; break; default: - sprintf(g->Message, "Unsupported typ %d\n", valp->GetType()); + snprintf(g->Message, sizeof(g->Message), "Unsupported typ %d\n", valp->GetType()); throw(777); } // endswitch Type diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index 4a92990d23354..45a0bb963e780 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -124,7 +124,7 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm) p[--n] = 0; } else if (!IsNum(p)) { // Wrong array specification - sprintf(g->Message, "Invalid array specification %s", p); + snprintf(g->Message, sizeof(g->Message), "Invalid array specification %s", p); return true; } // endif p @@ -161,7 +161,7 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm) jnp->Rank = atoi(p) - B; jnp->Op = OP_EQ; } else if (Wr) { - sprintf(g->Message, "Invalid specification %s in a write path", p); + snprintf(g->Message, sizeof(g->Message), "Invalid specification %s in a write path", p); return true; } else if (n == 1) { // Set the Op value; @@ -176,7 +176,7 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm) strcpy(g->Message, "Expand not supported by this function"); return true; default: - sprintf(g->Message, "Invalid function specification %c", *p); + snprintf(g->Message, sizeof(g->Message), "Invalid function specification %c", *p); return true; } // endswitch *p @@ -268,7 +268,7 @@ my_bool JSNX::ParseJpath(PGLOBAL g) } else if (*p == '*') { if (Wr) { - sprintf(g->Message, "Invalid specification %c in a write path", *p); + snprintf(g->Message, sizeof(g->Message), "Invalid specification %c in a write path", *p); return true; } else // Return JSON Nodes[i].Op = OP_XX; @@ -478,7 +478,7 @@ PJVAL JSNX::GetRowValue(PGLOBAL g, PJSON row, int i, my_bool b) val = (PJVAL)row; break; default: - sprintf(g->Message, "Invalid row JSON type %d", row->GetType()); + snprintf(g->Message, sizeof(g->Message), "Invalid row JSON type %d", row->GetType()); val = NULL; } // endswitch Type @@ -709,7 +709,7 @@ my_bool JSNX::CheckPath(PGLOBAL g) val = (PJVAL)row; break; default: - sprintf(g->Message, "Invalid row JSON type %d", row->GetType()); + snprintf(g->Message, sizeof(g->Message), "Invalid row JSON type %d", row->GetType()); } // endswitch Type if (i < Nod-1) @@ -761,7 +761,7 @@ PJSON JSNX::GetRow(PGLOBAL g) val = (PJVAL)row; break; default: - sprintf(g->Message, "Invalid row JSON type %d", row->GetType()); + snprintf(g->Message, sizeof(g->Message), "Invalid row JSON type %d", row->GetType()); val = NULL; } // endswitch Type @@ -909,7 +909,7 @@ my_bool JSNX::LocateArray(PGLOBAL g, PJAR jarp) for (int i = 0; i < jarp->size() && !Found; i++) { Jp->N = m; - sprintf(s, "[%d]", i + B); + snprintf(s, sizeof(s), "[%d]", i + B); if (Jp->WriteStr(s)) return true; @@ -1190,7 +1190,7 @@ my_bool JSNX::AddPath(void) { for (int i = 0; i <= I; i++) { if (Jpnp[i].Type == TYPE_JAR) { - sprintf(s, "[%d]", Jpnp[i].N + B); + snprintf(s, sizeof(s), "[%d]", Jpnp[i].N + B); if (Jp->WriteStr(s)) return true; @@ -1398,7 +1398,7 @@ static my_bool CheckPath(PGLOBAL g, UDF_ARGS *args, PJSON jsp, PJVAL& jvp, int n return true; if (!(jvp = jsx->GetJson(g))) { - sprintf(g->Message, "No sub-item at '%s'", path); + snprintf(g->Message, sizeof(g->Message), "No sub-item at '%s'", path); return true; } // endif jvp @@ -1816,7 +1816,7 @@ static PCSZ MakeKey(PGLOBAL g, UDF_ARGS *args, int i) } // endif *s if (n < 1) - return (PCSZ) "Key"; + return (PCSZ) "Key"; if (!b) { if ((p = (PSZ)PlgDBSubAlloc(g, NULL, n + 1))) { @@ -1830,7 +1830,7 @@ static PCSZ MakeKey(PGLOBAL g, UDF_ARGS *args, int i) } // endif s - return (char*) s; + return s; } // endif count return (PCSZ) "Key"; @@ -1855,7 +1855,7 @@ static PJSON ParseJsonFile(PGLOBAL g, char *fn, int *pretty, size_t& len) DWORD rc = GetLastError(); if (!(*g->Message)) - sprintf(g->Message, MSG(OPEN_MODE_ERROR), "map", (int)rc, fn); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR), "map", (int)rc, fn); return NULL; } // endif hFile @@ -1877,7 +1877,7 @@ static PJSON ParseJsonFile(PGLOBAL g, char *fn, int *pretty, size_t& len) if (!memory) { CloseFileHandle(hFile); - sprintf(g->Message, MSG(MAP_VIEW_ERROR), fn, GetLastError()); + snprintf(g->Message, sizeof(g->Message), MSG(MAP_VIEW_ERROR), fn, GetLastError()); return NULL; } // endif Memory @@ -1907,19 +1907,19 @@ char *GetJsonFile(PGLOBAL g, char *fn) #endif if (h == -1) { - sprintf(g->Message, "Error %d opening %-.1024s", errno, fn); + snprintf(g->Message, sizeof(g->Message), "Error %d opening %-.1024s", errno, fn); return NULL; } // endif h if ((len = _filelength(h)) < 0) { - sprintf(g->Message, MSG(FILELEN_ERROR), "_filelength", fn); + snprintf(g->Message, sizeof(g->Message), MSG(FILELEN_ERROR), "_filelength", fn); close(h); return NULL; } // endif len if ((str = (char*)PlgDBSubAlloc(g, NULL, len + 1))) { if ((n = read(h, str, len)) < 0) { - sprintf(g->Message, "Error %d reading %d bytes from %-.1024s", errno, len, fn); + snprintf(g->Message, sizeof(g->Message), "Error %d reading %d bytes from %-.1024s", errno, len, fn); return NULL; } // endif n @@ -3373,7 +3373,7 @@ char *json_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, if (!i) top = jvp->GetJson(); if (jvp->GetValType() != TYPE_JAR && jvp->GetValType() != TYPE_JOB) { - sprintf(g->Message, "Argument %d is not an array or object", i); + snprintf(g->Message, sizeof(g->Message), "Argument %d is not an array or object", i); PUSH_WARNING(g->Message); } else jsp[i] = jvp->GetJsp(); @@ -4756,7 +4756,7 @@ char *jbin_array(UDF_INIT *initid, UDF_ARGS *args, char *result, if ((arp = (PJAR)JsonNew(g, TYPE_JAR)) && (bsp = JbinAlloc(g, args, initid->max_length, arp))) { - strcat(bsp->Msg, " array"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " array"); for (uint i = 0; i < args->arg_count; i++) arp->AddArrayValue(g, MakeValue(g, args, i)); @@ -4833,7 +4833,7 @@ char *jbin_array_add_values(UDF_INIT *initid, UDF_ARGS *args, char *result, arp->InitArray(gb); if ((bsp = JbinAlloc(g, args, initid->max_length, top))) { - strcat(bsp->Msg, " array"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " array"); bsp->Jsp = arp; } // endif bsp @@ -5054,7 +5054,7 @@ char *jbin_object(UDF_INIT *initid, UDF_ARGS *args, char *result, if ((bsp = JbinAlloc(g, args, initid->max_length, objp))) - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); } else bsp = NULL; @@ -5110,7 +5110,7 @@ char *jbin_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, objp->SetKeyValue(g, jvp, MakeKey(g, args, i)); if ((bsp = JbinAlloc(g, args, initid->max_length, objp))) - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); } else bsp = NULL; @@ -5169,7 +5169,7 @@ char *jbin_object_key(UDF_INIT *initid, UDF_ARGS *args, char *result, objp->SetKeyValue(g, MakeValue(g, args, i + 1), MakePSZ(g, args, i)); if ((bsp = JbinAlloc(g, args, initid->max_length, objp))) - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); } else bsp = NULL; @@ -5391,7 +5391,7 @@ char *jbin_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, } // endif CheckMemory if ((bsp = JbinAlloc(g, args, initid->max_length, jarp))) - strcat(bsp->Msg, " array"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " array"); // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5466,7 +5466,7 @@ char *jbin_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, jsp = (jvp->GetJsp()) ? jvp->GetJsp() : JvalNew(g, TYPE_JVAL, jvp->GetValue(g)); if ((bsp = JbinAlloc(g, args, initid->max_length, jsp))) - strcat(bsp->Msg, " item"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " item"); else *error = 1; @@ -5536,7 +5536,7 @@ char *jbin_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, if (!i) top = jvp->GetJson(); if (jvp->GetValType() != TYPE_JAR && jvp->GetValType() != TYPE_JOB) { - sprintf(g->Message, "Argument %d is not an array or object", i); + snprintf(g->Message, sizeof(g->Message), "Argument %d is not an array or object", i); PUSH_WARNING(g->Message); } else jsp[i] = jvp->GetJsp(); @@ -5826,7 +5826,7 @@ char *jbin_file(UDF_INIT *initid, UDF_ARGS *args, char *result, pretty = pty; if ((bsp = JbinAlloc(g, args, len, jsp))) { - strcat(bsp->Msg, " file"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " file"); bsp->Filename = fn; bsp->Pretty = pretty; } else { @@ -6034,7 +6034,7 @@ char *jfile_bjson(UDF_INIT *initid, UDF_ARGS *args, char *result, if (!fgets(buf, lrecl, fin)) { if (!feof(fin)) { - sprintf(g->Message, "Error %d reading %zd bytes from %s", errno, lrecl, fn); + snprintf(g->Message, sizeof(g->Message), "Error %d reading %zu bytes from %s", errno, lrecl, fn); str = strcpy(result, g->Message); } else str = strcpy(result, ofn); @@ -6048,11 +6048,11 @@ char *jfile_bjson(UDF_INIT *initid, UDF_ARGS *args, char *result, swp->SwapJson(jsp, true); if (fwrite(binszp, sizeof(binszp), 1, fout) != 1) { - sprintf(g->Message, "Error %d writing %zd bytes to %s", + snprintf(g->Message, sizeof(g->Message), "Error %d writing %zu bytes to %s", errno, sizeof(binszp), ofn); str = strcpy(result, g->Message); } else if (fwrite(jsp, *binszp, 1, fout) != 1) { - sprintf(g->Message, "Error %d writing %zd bytes to %s", + snprintf(g->Message, sizeof(g->Message), "Error %d writing %zu bytes to %s", errno, *binszp, ofn); str = strcpy(result, g->Message); } else @@ -6130,7 +6130,7 @@ char* JUP::UnprettyJsonFile(PGLOBAL g, char *fn, char *outfn, int lrecl) { DWORD rc = GetLastError(); if (!(*g->Message)) - sprintf(g->Message, MSG(OPEN_MODE_ERROR), "map", (int)rc, fn); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR), "map", (int)rc, fn); return NULL; } // endif hFile @@ -6151,7 +6151,7 @@ char* JUP::UnprettyJsonFile(PGLOBAL g, char *fn, char *outfn, int lrecl) { if (!mm.memory) { CloseFileHandle(hFile); - sprintf(g->Message, MSG(MAP_VIEW_ERROR), fn, GetLastError()); + snprintf(g->Message, sizeof(g->Message), MSG(MAP_VIEW_ERROR), fn, GetLastError()); return NULL; } else s = (char*)mm.memory; @@ -6162,9 +6162,8 @@ char* JUP::UnprettyJsonFile(PGLOBAL g, char *fn, char *outfn, int lrecl) { /* Parse the json file and allocate its tree structure. */ /*********************************************************************************/ if (!(fs = fopen(outfn, "wb"))) { - sprintf(g->Message, MSG(OPEN_MODE_ERROR), - "w", (int)errno, outfn); - strcat(strcat(g->Message, ": "), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR)": %s", + "w", (int)errno, outfn, strerror(errno)); CloseMemMap(mm.memory, len); return NULL; } // endif fs @@ -6227,7 +6226,7 @@ bool JUP::unPretty(PGLOBAL g, int lrecl) { go = next = false; break; default: - sprintf(g->Message, "Unexpected '%c' near %.*s", s[i], ARGS); + snprintf(g->Message, sizeof(g->Message), "Unexpected '%c' near %.*s", s[i], ARGS); throw 4; break; }; // endswitch s[i] @@ -6240,7 +6239,7 @@ bool JUP::unPretty(PGLOBAL g, int lrecl) { buff[k] = 0; if ((fputs(buff, fs)) == EOF) { - sprintf(g->Message, MSG(FPUTS_ERROR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(FPUTS_ERROR), strerror(errno)); throw 5; } // endif EOF @@ -6274,7 +6273,7 @@ void JUP::CopyObject(PGLOBAL g) { CopyString(g); level = 1; } else { - sprintf(g->Message, "misplaced string near %.*s", ARGS); + snprintf(g->Message, sizeof(g->Message), "misplaced string near %.*s", ARGS); throw 3; } // endif level @@ -6286,7 +6285,7 @@ void JUP::CopyObject(PGLOBAL g) { CopyValue(g); level = 2; } else { - sprintf(g->Message, "Unexpected ':' near %.*s", ARGS); + snprintf(g->Message, sizeof(g->Message), "Unexpected ':' near %.*s", ARGS); throw 3; } // endif level @@ -6295,7 +6294,7 @@ void JUP::CopyObject(PGLOBAL g) { AddBuff(s[i]); if (level < 2) { - sprintf(g->Message, "Unexpected ',' near %.*s", ARGS); + snprintf(g->Message, sizeof(g->Message), "Unexpected ',' near %.*s", ARGS); throw 3; } else level = 0; @@ -6305,7 +6304,7 @@ void JUP::CopyObject(PGLOBAL g) { AddBuff(s[i]); if (level == 1) { - sprintf(g->Message, "Unexpected '}' near %.*s", ARGS); + snprintf(g->Message, sizeof(g->Message), "Unexpected '}' near %.*s", ARGS); throw 3; } // endif level @@ -6316,7 +6315,7 @@ void JUP::CopyObject(PGLOBAL g) { case '\t': break; default: - sprintf(g->Message, "Unexpected character '%c' near %.*s", s[i], ARGS); + snprintf(g->Message, sizeof(g->Message), "Unexpected character '%c' near %.*s", s[i], ARGS); throw 3; }; // endswitch s[i] @@ -6333,7 +6332,7 @@ void JUP::CopyArray(PGLOBAL g) { switch (s[i]) { case ',': if (level < 2) { - sprintf(g->Message, "Unexpected ',' near %.*s", ARGS); + snprintf(g->Message, sizeof(g->Message), "Unexpected ',' near %.*s", ARGS); throw 2; } else level = 1; @@ -6342,7 +6341,7 @@ void JUP::CopyArray(PGLOBAL g) { break; case ']': if (level == 1) { - sprintf(g->Message, "Unexpected ',]' near %.*s", ARGS); + snprintf(g->Message, sizeof(g->Message), "Unexpected ',]' near %.*s", ARGS); throw 2; } // endif level @@ -6355,7 +6354,7 @@ void JUP::CopyArray(PGLOBAL g) { break; default: if (level == 2) { - sprintf(g->Message, "Unexpected value near %.*s", ARGS); + snprintf(g->Message, sizeof(g->Message), "Unexpected value near %.*s", ARGS); throw 2; } // endif level @@ -6438,7 +6437,7 @@ void JUP::CopyValue(PGLOBAL g) { return; err: - sprintf(g->Message, "Unexpected character '%c' near %.*s", s[i], ARGS); + snprintf(g->Message, sizeof(g->Message), "Unexpected character '%c' near %.*s", s[i], ARGS); throw 1; } // end of CopyValue diff --git a/storage/connect/jsonudf.h b/storage/connect/jsonudf.h index ada0dbcd96b4b..4378bddf9ba6c 100644 --- a/storage/connect/jsonudf.h +++ b/storage/connect/jsonudf.h @@ -349,7 +349,7 @@ class JSNX : public BLOCK { my_bool AddPath(void); // Default constructor not to be used - JSNX(void) {} + JSNX(void) = default; // Members PJSON Row; diff --git a/storage/connect/libdoc.cpp b/storage/connect/libdoc.cpp index 3b2696b066db9..14e1e44895c80 100644 --- a/storage/connect/libdoc.cpp +++ b/storage/connect/libdoc.cpp @@ -290,46 +290,8 @@ if (!rc) /******************************************************************/ /* XML library cleanup function. */ /******************************************************************/ -/* - This is a copy of xmlCleanupParser() from the libxml2 sources - with xmlResetLastError() commented. - - xmlResetLastError() called from the original xmlCleanupParser() causes - valgrind to report memory leaks. This happens because - ha_initialize_handlerton() is called from the main thread in mysqld.cc, - while ha_finalize_handlerton() is called from a non-main thread. - libxml2 gets confused because of xmlInitParser() and xmlCleanupParser() - being called from the different threads. - - Perhaps the code in mysqld.cc should eventually be modified - to shutdown plugins from the main thread. -*/ -static void -xmlCleanupParser_replacement(void) - { - xmlCleanupCharEncodingHandlers(); -#ifdef LIBXML_CATALOG_ENABLED - xmlCatalogCleanup(); -#endif - xmlDictCleanup(); - xmlCleanupInputCallbacks(); -#ifdef LIBXML_OUTPUT_ENABLED - xmlCleanupOutputCallbacks(); -#endif -#ifdef LIBXML_SCHEMAS_ENABLED - xmlSchemaCleanupTypes(); - xmlRelaxNGCleanupTypes(); -#endif - //xmlResetLastError(); - xmlCleanupGlobals(); - xmlCleanupThreads(); /* must be last if called not from the main thread */ - xmlCleanupMemory(); - } - - void XmlCleanupParserLib(void) { - xmlCleanupParser_replacement(); } // end of XmlCleanupParserLib /******************************************************************/ @@ -661,7 +623,7 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp) if (xmlXPathRegisterNs(Ctxp, BAD_CAST nsp->Prefix, BAD_CAST nsp->Uri)) { - sprintf(g->Message, MSG(REGISTER_ERR), nsp->Prefix, nsp->Uri); + snprintf(g->Message, sizeof(g->Message), MSG(REGISTER_ERR), nsp->Prefix, nsp->Uri); if (trace(1)) htrc("Ns error: %-.256s\n", g->Message); @@ -703,7 +665,7 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp) // Evaluate table xpath if (!(Xop = xmlXPathEval(BAD_CAST xp, Ctxp))) { - sprintf(g->Message, MSG(XPATH_EVAL_ERR), xp); + snprintf(g->Message, sizeof(g->Message), MSG(XPATH_EVAL_ERR), xp); if (trace(1)) htrc("Path error: %-.256s\n", g->Message); @@ -882,7 +844,7 @@ RCODE XML2NODE::GetContent(PGLOBAL g, char *buf, int len) } // endif p1 } else { - sprintf(g->Message, "Truncated %-.256s content", Nodep->name); + snprintf(g->Message, sizeof(g->Message), "Truncated %-.256s content", Nodep->name); rc = RC_INFO; } // endif len @@ -1260,7 +1222,7 @@ RCODE XML2ATTR::GetText(PGLOBAL g, char *buf, int len) if (strlen((char*)txt) >= (unsigned)len) { memcpy(buf, txt, len - 1); buf[len - 1] = 0; - sprintf(g->Message, "Truncated %-.256s content", Atrp->name); + snprintf(g->Message, sizeof(g->Message), "Truncated %-.256s content", Atrp->name); rc = RC_INFO; } else strcpy(buf, (const char*)txt); diff --git a/storage/connect/macutil.cpp b/storage/connect/macutil.cpp index 93cd0bcb5e14b..fd85210ac91d9 100644 --- a/storage/connect/macutil.cpp +++ b/storage/connect/macutil.cpp @@ -53,7 +53,7 @@ MACINFO::MACINFO(bool adap, bool fix) void MACINFO::MakeErrorMsg(PGLOBAL g, DWORD drc) { if (drc == ERROR_BUFFER_OVERFLOW) - sprintf(g->Message, + snprintf(g->Message, sizeof(g->Message), "GetAdaptersInfo: Buffer Overflow buflen=%d nbofadap=%d", Buflen, N); else if (drc == ERROR_INVALID_PARAMETER) @@ -146,7 +146,7 @@ bool MACINFO::GetFixedInfo(PGLOBAL g) } // endif drc if (drc != ERROR_SUCCESS) { - sprintf(g->Message, "GetNetworkParams failed. Rc=%08x\n", drc); + snprintf(g->Message, sizeof(g->Message), "GetNetworkParams failed. Rc=%08x\n", drc); return true; } // endif drc @@ -305,7 +305,7 @@ bool MACINFO::GetOneInfo(PGLOBAL g, int flag, void *v, int lv) n = (int)Curp->LeaseExpires; break; default: - sprintf(g->Message, "Invalid flag value %d", flag); + snprintf(g->Message, sizeof(g->Message), "Invalid flag value %d", flag); return true; } // endswitch flag diff --git a/storage/connect/maputil.cpp b/storage/connect/maputil.cpp index b722a438011f5..903798bccdd1c 100644 --- a/storage/connect/maputil.cpp +++ b/storage/connect/maputil.cpp @@ -50,7 +50,7 @@ HANDLE CreateFileMap(PGLOBAL g, LPCSTR filename, disposition = OPEN_ALWAYS; break; default: - sprintf(g->Message, MSG(BAD_FUNC_MODE), "CreateFileMap", mode); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FUNC_MODE), "CreateFileMap", mode); return INVALID_HANDLE_VALUE; } // endswitch @@ -69,11 +69,11 @@ HANDLE CreateFileMap(PGLOBAL g, LPCSTR filename, DWORD ler = GetLastError(); if (ler && ler != 1006) { - sprintf(g->Message, MSG(FILE_MAP_ERROR), filename, ler); + snprintf(g->Message, sizeof(g->Message), MSG(FILE_MAP_ERROR), filename, ler); CloseHandle(hFile); return INVALID_HANDLE_VALUE; } else { - sprintf(g->Message, MSG(FILE_IS_EMPTY), filename); + snprintf(g->Message, sizeof(g->Message), MSG(FILE_IS_EMPTY), filename); return hFile; } // endif ler @@ -84,7 +84,7 @@ HANDLE CreateFileMap(PGLOBAL g, LPCSTR filename, if (!(mm->memory = MapViewOfFile(hFileMap, access, 0, 0, 0))) { DWORD ler = GetLastError(); - sprintf(g->Message, "Error %ld in MapViewOfFile %s", + snprintf(g->Message, sizeof(g->Message), "Error %ld in MapViewOfFile %s", ler, filename); CloseHandle(hFile); return INVALID_HANDLE_VALUE; @@ -149,7 +149,7 @@ HANDLE CreateFileMap(PGLOBAL g, LPCSTR fileName, protmode = PROT_WRITE; break; default: - sprintf(g->Message, MSG(BAD_FUNC_MODE), "CreateFileMap", mode); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FUNC_MODE), "CreateFileMap", mode); return INVALID_HANDLE_VALUE; } // endswitch @@ -159,7 +159,7 @@ HANDLE CreateFileMap(PGLOBAL g, LPCSTR fileName, if (fd != INVALID_HANDLE_VALUE && mode != MODE_INSERT) { /* We must know about the size of the file. */ if (fstat(fd, &st)) { - sprintf(g->Message, MSG(FILE_MAP_ERROR), fileName, errno); + snprintf(g->Message, sizeof(g->Message), MSG(FILE_MAP_ERROR), fileName, errno); close(fd); return INVALID_HANDLE_VALUE; } // endif fstat diff --git a/storage/connect/messages.h b/storage/connect/messages.h index b55ec39b2354d..91e04f3d47203 100644 --- a/storage/connect/messages.h +++ b/storage/connect/messages.h @@ -1,13 +1,5 @@ /**************************************************************************/ /* NLS messsages definition. */ /**************************************************************************/ -#if defined(FRENCH) -#if defined(CPX) -#include "frmsg1.h" -#else /* not CPX */ -#include "frmsg2.h" -#endif /* CPX */ -#else /* not FRENCH */ #include "engmsg.h" -#endif /* FRENCH */ /* ---------------------------------------------------------------------- */ diff --git a/storage/connect/mongo.cpp b/storage/connect/mongo.cpp index a9c4813684b1f..9a35dfb3de0d3 100644 --- a/storage/connect/mongo.cpp +++ b/storage/connect/mongo.cpp @@ -152,14 +152,14 @@ PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt, bool info) #if defined(CMGO_SUPPORT) cmgd = new(g) CMGDISC(g, (int*)length); #else - sprintf(g->Message, "Mongo %s Driver not available", "C"); + snprintf(g->Message, sizeof(g->Message), "Mongo %s Driver not available", "C"); goto err; #endif } else if (drv && toupper(*drv) == 'J') { #if defined(JAVA_SUPPORT) cmgd = new(g) JMGDISC(g, (int*)length); #else - sprintf(g->Message, "Mongo %s Driver not available", "Java"); + snprintf(g->Message, sizeof(g->Message), "Mongo %s Driver not available", "Java"); goto err; #endif } else { // Driver not specified @@ -421,7 +421,7 @@ PTDB MGODEF::GetTable(PGLOBAL g, MODE m) else return new(g) TDBCMG(this); #else - sprintf(g->Message, "Mongo %s Driver not available", "C"); + snprintf(g->Message, sizeof(g->Message), "Mongo %s Driver not available", "C"); return NULL; #endif } else if (Driver && toupper(*Driver) == 'J') { @@ -431,7 +431,7 @@ PTDB MGODEF::GetTable(PGLOBAL g, MODE m) else return new(g) TDBJMG(this); #else - sprintf(g->Message, "Mongo %s Driver not available", "Java"); + snprintf(g->Message, sizeof(g->Message), "Mongo %s Driver not available", "Java"); return NULL; #endif } else { // Driver not specified diff --git a/storage/connect/mycat.cc b/storage/connect/mycat.cc index 5f98a7950c430..c4c2ade787dff 100644 --- a/storage/connect/mycat.cc +++ b/storage/connect/mycat.cc @@ -520,7 +520,7 @@ PTABDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am) /* fall through */ #endif // JAVA_SUPPORT || CMGO_SUPPORT default: - sprintf(g->Message, MSG(BAD_TABLE_TYPE), am, name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_TABLE_TYPE), am, name); } // endswitch // Do make the table/view definition diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp index f8d56f7652432..bb6f72de1f85b 100644 --- a/storage/connect/myconn.cpp +++ b/storage/connect/myconn.cpp @@ -272,7 +272,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db, nf = sscanf(fld, "%s %s %s", buf, uns, zero) + 2; break; default: - sprintf(g->Message, MSG(BAD_FIELD_TYPE), fld); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FIELD_TYPE), fld); myc.Close(); return NULL; } // endswitch nf @@ -280,19 +280,19 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db, if ((type = MYSQLtoPLG(buf, &v)) == TYPE_ERROR) { if (v == 'K') { // Skip this column - sprintf(g->Message, "Column %s skipped (unsupported type %s)", + snprintf(g->Message, sizeof(g->Message), "Column %s skipped (unsupported type %s)", colname, buf); PushWarning(g, thd); continue; } // endif v - sprintf(g->Message, "Column %s unsupported type %s", colname, buf); + snprintf(g->Message, sizeof(g->Message), "Column %s unsupported type %s", colname, buf); myc.Close(); return NULL; } else if (type == TYPE_STRING) { if (v == 'X') { len = GetConvSize(); - sprintf(g->Message, "Column %s converted to varchar(%d)", + snprintf(g->Message, sizeof(g->Message), "Column %s converted to varchar(%d)", colname, len); PushWarning(g, thd); v = 'V'; @@ -399,20 +399,26 @@ PQRYRES SrcColumns(PGLOBAL g, const char *host, const char *db, int w; MYSQLC myc; PQRYRES qrp = NULL; + const char *p; if (!port) port = mysqld_port; if (!strnicmp(srcdef, "select ", 7) || strstr(srcdef, "%s")) { - query = (char *)PlugSubAlloc(g, NULL, strlen(srcdef) + 10); - - if (strstr(srcdef, "%s")) - sprintf(query, srcdef, "1=1"); // dummy where clause - else - strcpy(query, srcdef); + size_t query_sz = strlen(srcdef) + 10; + query = (char *)PlugSubAlloc(g, NULL, query_sz); + + if ((p= strstr(srcdef, "%s"))) + { + /* Replace %s with 1=1 */ + snprintf(query, query_sz, "%.*s1=1%s", + (int) (p - srcdef), srcdef, p + 2); // dummy where clause + } + else + safe_strcpy(query, query_sz, srcdef); if (!strnicmp(srcdef, "select ", 7)) - strcat(query, " LIMIT 0"); + safe_strcat(query, query_sz, " LIMIT 0"); } else query = (char *)srcdef; @@ -528,10 +534,10 @@ int MYSQLC::Open(PGLOBAL g, const char *host, const char *db, if (!mysql_real_connect(m_DB, host, user, pwd, db, pt, pipe, CLIENT_MULTI_RESULTS | CLIENT_REMEMBER_OPTIONS)) { #if defined(_DEBUG) - sprintf(g->Message, "mysql_real_connect failed: (%d) %s", + snprintf(g->Message, sizeof(g->Message), "mysql_real_connect failed: (%d) %s", mysql_errno(m_DB), mysql_error(m_DB)); #else // !_DEBUG - sprintf(g->Message, "(%d) %s", mysql_errno(m_DB), mysql_error(m_DB)); + snprintf(g->Message, sizeof(g->Message), "(%d) %s", mysql_errno(m_DB), mysql_error(m_DB)); #endif // !_DEBUG mysql_close(m_DB); m_DB = NULL; @@ -612,7 +618,7 @@ int MYSQLC::PrepareSQL(PGLOBAL g, const char *stmt) #if defined(ALPHA) if (!(m_Stmt = mysql_prepare(m_DB, stmt, strlen(stmt)))) { - sprintf(g->Message, "mysql_prepare failed: %s [%s]", + snprintf(g->Message, sizeof(g->Message), "mysql_prepare failed: %s [%s]", mysql_error(m_DB), stmt); return -1; } // endif m_Stmt @@ -626,7 +632,7 @@ int MYSQLC::PrepareSQL(PGLOBAL g, const char *stmt) } // endif m_Stmt if (mysql_stmt_prepare(m_Stmt, stmt, strlen(stmt))) { - sprintf(g->Message, "mysql_stmt_prepare() failed: (%d) %s", + snprintf(g->Message, sizeof(g->Message), "mysql_stmt_prepare() failed: (%d) %s", mysql_stmt_errno(m_Stmt), mysql_stmt_error(m_Stmt)); return -3; } // endif prepare @@ -649,11 +655,11 @@ int MYSQLC::BindParams(PGLOBAL g, MYSQL_BIND *bind) #if defined(ALPHA) if (mysql_bind_param(m_Stmt, bind)) { - sprintf(g->Message, "mysql_bind_param() failed: %s", + snprintf(g->Message, sizeof(g->Message), "mysql_bind_param() failed: %s", mysql_stmt_error(m_Stmt)); #else // !ALPHA if (mysql_stmt_bind_param(m_Stmt, bind)) { - sprintf(g->Message, "mysql_stmt_bind_param() failed: %s", + snprintf(g->Message, sizeof(g->Message), "mysql_stmt_bind_param() failed: %s", mysql_stmt_error(m_Stmt)); #endif // !ALPHA return RC_FX; @@ -673,13 +679,13 @@ int MYSQLC::ExecStmt(PGLOBAL g) #if defined(ALPHA) if (mysql_execute(m_Stmt)) { - sprintf(g->Message, "mysql_execute() failed: %s", + snprintf(g->Message, sizeof(g->Message), "mysql_execute() failed: %s", mysql_stmt_error(m_Stmt)); return RC_FX; } // endif execute #else // !ALPHA if (mysql_stmt_execute(m_Stmt)) { - sprintf(g->Message, "mysql_stmt_execute() failed: %s", + snprintf(g->Message, sizeof(g->Message), "mysql_stmt_execute() failed: %s", mysql_stmt_error(m_Stmt)); return RC_FX; } // endif execute @@ -687,7 +693,7 @@ int MYSQLC::ExecStmt(PGLOBAL g) // Check the total number of affected rows if (mysql_stmt_affected_rows(m_Stmt) != 1) { - sprintf(g->Message, "Invalid affected rows by MySQL"); + snprintf(g->Message, sizeof(g->Message), "Invalid affected rows by MySQL"); return RC_FX; } // endif affected_rows @@ -753,7 +759,7 @@ int MYSQLC::ExecSQL(PGLOBAL g, const char *query, int *w) } else { // m_Rows = (int)mysql_affected_rows(m_DB); m_Rows = (int)m_DB->affected_rows; - sprintf(g->Message, "Affected rows: %d\n", m_Rows); + snprintf(g->Message, sizeof(g->Message), "Affected rows: %d\n", m_Rows); rc = RC_NF; } // endif field count @@ -888,7 +894,7 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb) MYSQL_ROW row; if (!m_Res || !m_Fields) { - sprintf(g->Message, "%s result", (m_Res) ? "Void" : "No"); + snprintf(g->Message, sizeof(g->Message), "%s result", (m_Res) ? "Void" : "No"); return NULL; } // endif m_Res @@ -922,7 +928,7 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb) crp->Name = name; if ((crp->Type = MYSQLtoPLG(fld->type, &v)) == TYPE_ERROR) { - sprintf(g->Message, "Type %d not supported for column %s", + snprintf(g->Message, sizeof(g->Message), "Type %d not supported for column %s", fld->type, crp->Name); return NULL; } else if (crp->Type == TYPE_DATE && !pdb) @@ -940,7 +946,7 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb) if (!(crp->Kdata = AllocValBlock(g, NULL, crp->Type, m_Rows, crp->Clen, 0, FALSE, TRUE, uns))) { - sprintf(g->Message, MSG(INV_RESULT_TYPE), + snprintf(g->Message, sizeof(g->Message), MSG(INV_RESULT_TYPE), GetFormatType(crp->Type)); return NULL; } else if (crp->Type == TYPE_DATE) { @@ -969,7 +975,7 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb) /*********************************************************************/ for (n = 0; n < m_Rows; n++) { if (!(m_Row = mysql_fetch_row(m_Res))) { - sprintf(g->Message, "Missing row %d from result", n + 1); + snprintf(g->Message, sizeof(g->Message), "Missing row %d from result", n + 1); return NULL; } // endif m_Row @@ -1047,7 +1053,7 @@ int MYSQLC::ExecSQLcmd(PGLOBAL g, const char *query, int *w) //if (mysql_query(m_DB, query) != 0) { if (mysql_real_query(m_DB, query, strlen(query))) { m_Afrw = (int)mysql_errno(m_DB); - sprintf(g->Message, "Remote: %s", mysql_error(m_DB)); + snprintf(g->Message, sizeof(g->Message), "Remote: %s", mysql_error(m_DB)); rc = RC_FX; //} else if (!(m_Fields = mysql_field_count(m_DB))) { } else if (!(m_Fields = (int)m_DB->field_count)) { diff --git a/storage/connect/mysql-test/connect/r/alter.result b/storage/connect/mysql-test/connect/r/alter.result index 7de43c883293a..09f4584a75e76 100644 --- a/storage/connect/mysql-test/connect/r/alter.result +++ b/storage/connect/mysql-test/connect/r/alter.result @@ -35,7 +35,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` char(5) NOT NULL, `d` char(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t1; c d 1 One @@ -61,7 +61,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` int(11) NOT NULL, `d` char(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=CSV `HEADER`=1 `QUOTED`=1 +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=CSV `HEADER`=1 `QUOTED`=1 # create an outward table used to see the t1 file CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.csv'; Warnings: @@ -90,7 +90,7 @@ t1 CREATE TABLE `t1` ( `d` char(10) NOT NULL, KEY `xc` (`c`), KEY `xd` (`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci 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 Ignored t1 1 xc 1 c A NULL NULL NULL BTREE NO @@ -108,7 +108,7 @@ t1 CREATE TABLE `t1` ( `d` char(10) NOT NULL, KEY `xc` (`c`), KEY `xd` (`d`) -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=DBF 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 Ignored t1 1 xc 1 c A NULL NULL NULL XINDEX NO @@ -167,7 +167,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` char(5) NOT NULL, `d` char(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=fix `FILE_NAME`='tf1.txt' `ENDING`=1 +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=fix `FILE_NAME`='tf1.txt' `ENDING`=1 SELECT * FROM t1; ERROR HY000: Got error 174 'File tf1.txt is not fixed length, len=66 lrecl=16' from CONNECT ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL; @@ -189,7 +189,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `d` char(10) NOT NULL, `c` int(11) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=fix `FILE_NAME`='tf1.txt' `ENDING`=1 +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=fix `FILE_NAME`='tf1.txt' `ENDING`=1 # Wrong result SELECT * FROM t1; d c @@ -208,7 +208,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `d` char(10) NOT NULL `FLAG`=11, `c` int(11) NOT NULL `FLAG`=0 -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=fix `FILE_NAME`='tf1.txt' `ENDING`=1 +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=fix `FILE_NAME`='tf1.txt' `ENDING`=1 SELECT * FROM t1; d c One 1 @@ -224,7 +224,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `d` char(10) NOT NULL /* `FLAG`=11 */, `c` int(11) NOT NULL /* `FLAG`=0 */ -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 /* `TABLE_TYPE`=fix `FILE_NAME`='tf1.txt' `ENDING`=1 */ +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 /* `TABLE_TYPE`=fix `FILE_NAME`='tf1.txt' `ENDING`=1 */ set @old_sql_mode=@@sql_mode; set sql_mode=ignore_bad_table_options; SHOW CREATE TABLE t1; @@ -232,7 +232,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `d` char(10) NOT NULL `FLAG`=11, `c` int(11) NOT NULL `FLAG`=0 -) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 `TABLE_TYPE`=fix `FILE_NAME`='tf1.txt' `ENDING`=1 +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 `TABLE_TYPE`=fix `FILE_NAME`='tf1.txt' `ENDING`=1 set sql_mode=@old_sql_mode; SELECT * from t1; d c @@ -260,7 +260,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `d` char(10) NOT NULL `FLAG`=11, `c` int(11) NOT NULL `FLAG`=0 -) ENGINE=CONNECT DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 `TABLE_TYPE`=fix `FILE_NAME`='tf1.txt' `ENDING`=1 +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 `TABLE_TYPE`=fix `FILE_NAME`='tf1.txt' `ENDING`=1 SELECT * from t1; d c One 1 diff --git a/storage/connect/mysql-test/connect/r/alter_xml.result b/storage/connect/mysql-test/connect/r/alter_xml.result index d2f882f128747..65ad40d869015 100644 --- a/storage/connect/mysql-test/connect/r/alter_xml.result +++ b/storage/connect/mysql-test/connect/r/alter_xml.result @@ -25,7 +25,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` int(11) NOT NULL, `d` char(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `HEADER`=1 `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='xmlsup=domdoc,rownode=row' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `HEADER`=1 `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='xmlsup=domdoc,rownode=row' # Let us see the XML file CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.xml'; Warnings: @@ -65,7 +65,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` int(11) NOT NULL, `d` char(10) NOT NULL `XPATH`='@' -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='xmlsup=domdoc,rownode=row' `HEADER`=0 +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='xmlsup=domdoc,rownode=row' `HEADER`=0 SELECT * FROM t2; line diff --git a/storage/connect/mysql-test/connect/r/alter_xml2.result b/storage/connect/mysql-test/connect/r/alter_xml2.result index a15be966aa8be..88359e4b4e1a8 100644 --- a/storage/connect/mysql-test/connect/r/alter_xml2.result +++ b/storage/connect/mysql-test/connect/r/alter_xml2.result @@ -1,5 +1,3 @@ -Warnings: -Warning 1105 No file name. Table will use t1.xml # # Testing changing table type (not in-place) # @@ -27,7 +25,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` int(11) NOT NULL, `d` char(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `HEADER`=1 `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='xmlsup=libxml2,rownode=row' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `HEADER`=1 `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='xmlsup=libxml2,rownode=row' # Let us see the XML file CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.xml'; Warnings: @@ -67,7 +65,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c` int(11) NOT NULL, `d` char(10) NOT NULL `XPATH`='@' -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='xmlsup=libxml2,rownode=row' `HEADER`=0 +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='xmlsup=libxml2,rownode=row' `HEADER`=0 SELECT * FROM t2; line diff --git a/storage/connect/mysql-test/connect/r/bin.result b/storage/connect/mysql-test/connect/r/bin.result index 1baa18a1e4df2..14808745c7634 100644 --- a/storage/connect/mysql-test/connect/r/bin.result +++ b/storage/connect/mysql-test/connect/r/bin.result @@ -59,7 +59,7 @@ t1 CREATE TABLE `t1` ( `id` char(5) NOT NULL `FIELD_FORMAT`='S', `salary` double(9,2) NOT NULL DEFAULT 0.00 `FIELD_FORMAT`='F', `dept` int(4) NOT NULL `FIELD_FORMAT`='S' -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `OPTION_LIST`='Endian=Little' `READONLY`=NO +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `OPTION_LIST`='Endian=Little' `READONLY`=NO INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777); SELECT * FROM t1; fig name birth id salary dept @@ -78,7 +78,7 @@ t1 CREATE TABLE `t1` ( `id` char(5) NOT NULL `FIELD_FORMAT`='S', `salary` double(9,2) NOT NULL DEFAULT 0.00 `FIELD_FORMAT`='F', `dept` int(4) NOT NULL `FIELD_FORMAT`='S' -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `OPTION_LIST`='Endian=Little' `READONLY`=YES +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `OPTION_LIST`='Endian=Little' `READONLY`=YES INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777); ERROR HY000: Table 't1' is read only DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/r/bson.result b/storage/connect/mysql-test/connect/r/bson.result index 8b9a92e448956..a9567fe47b351 100644 --- a/storage/connect/mysql-test/connect/r/bson.result +++ b/storage/connect/mysql-test/connect/r/bson.result @@ -515,3 +515,27 @@ Beth 4 Food 17.00 Beth 4 Beer 15.00 Janet 4 Car 17.00 DROP TABLE t1, t2, t3, t4; +# +# MDEV-29426 memory leak on "SHOW INDEX" +# +CREATE TABLE t1 +( +ISBN CHAR(15) NOT NULL, +Language CHAR(2) JPATH='$.LANG', +Subject CHAR(32) JPATH='$.SUBJECT', +AuthorFN CHAR(128) JPATH='$.AUTHOR[*].FIRSTNAME', +AuthorLN CHAR(128) JPATH='$.AUTHOR[*].LASTNAME', +Title CHAR(32) JPATH='$.TITLE', +Translation CHAR(32) JPATH='$.TRANSLATED.PREFIX', +TranslatorFN CHAR(80) JPATH='$.TRANSLATED.TRANSLATOR.FIRSTNAME', +TranslatorLN CHAR(80) JPATH='$.TRANSLATED.TRANSLATOR.LASTNAME', +Publisher CHAR(20) JPATH='$.PUBLISHER.NAME', +Location CHAR(16) JPATH='$.PUBLISHER.PLACE', +Year int(4) JPATH='$.DATEPUB', +INDEX IX(ISBN) +) +ENGINE=CONNECT TABLE_TYPE=BSON FILE_NAME='bib0.json' LRECL=320 OPTION_LIST='Pretty=0'; +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 Ignored +t1 1 IX 1 ISBN A NULL NULL NULL XINDEX NO +DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/r/csv.result b/storage/connect/mysql-test/connect/r/csv.result index be25a842bc4cf..4fc8269875d9c 100644 --- a/storage/connect/mysql-test/connect/r/csv.result +++ b/storage/connect/mysql-test/connect/r/csv.result @@ -69,7 +69,7 @@ t1 CREATE TABLE `t1` ( `name` char(12) NOT NULL, `birth` date NOT NULL `DATE_FORMAT`='DD/MM/YY', `children` smallint(2) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=CSV `FILE_NAME`='people.csv' `HEADER`=1 `SEP_CHAR`=';' `QUOTED`=1 `READONLY`=no +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=CSV `FILE_NAME`='people.csv' `HEADER`=1 `SEP_CHAR`=';' `QUOTED`=1 `READONLY`=no INSERT INTO t1 VALUES ('BILL','1973-06-30',5); SELECT * FROM t1; name birth children @@ -84,7 +84,7 @@ t1 CREATE TABLE `t1` ( `name` char(12) NOT NULL, `birth` date NOT NULL `DATE_FORMAT`='DD/MM/YY', `children` smallint(2) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=CSV `FILE_NAME`='people.csv' `HEADER`=1 `SEP_CHAR`=';' `QUOTED`=1 `READONLY`=1 +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=CSV `FILE_NAME`='people.csv' `HEADER`=1 `SEP_CHAR`=';' `QUOTED`=1 `READONLY`=1 INSERT INTO t1 VALUES ('BILL','1973-06-30',5); ERROR HY000: Table 't1' is read only SELECT * FROM t1; diff --git a/storage/connect/mysql-test/connect/r/dbf.result b/storage/connect/mysql-test/connect/r/dbf.result index 7296d73a25860..65d894a0c24e3 100644 --- a/storage/connect/mysql-test/connect/r/dbf.result +++ b/storage/connect/mysql-test/connect/r/dbf.result @@ -6,7 +6,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' SELECT * FROM t1; a Warnings: @@ -62,7 +62,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' INSERT INTO t1 VALUES (10),(20); SELECT * FROM t1; a @@ -73,7 +73,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' `READONLY`=Yes +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' `READONLY`=Yes INSERT INTO t1 VALUES (30); ERROR HY000: Table 't1' is read only UPDATE t1 SET a=30 WHERE a=10; @@ -87,7 +87,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' `READONLY`=NO +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' `READONLY`=NO INSERT INTO t1 VALUES (30); SELECT * FROM t1; a @@ -119,7 +119,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=dbf `file_name`='t1.dbf' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `table_type`=dbf `file_name`='t1.dbf' INSERT INTO t1 VALUES (10); SELECT * FROM t1; a @@ -130,7 +130,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `Table_Type`=dbf `File_Name`='t1.dbf' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `Table_Type`=dbf `File_Name`='t1.dbf' INSERT INTO t1 VALUES ('test'); SELECT * FROM t1; a @@ -243,7 +243,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a01234567a` int(11) NOT NULL, `b01234567b` int(11) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t02x13.dbf' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=DBF `FILE_NAME`='t02x13.dbf' INSERT INTO t1 VALUES (1,2); SELECT * FROM t1; a01234567a b01234567b @@ -532,7 +532,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1c.dbf' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=DBF `FILE_NAME`='t1c.dbf' SELECT * FROM t1; a 10 @@ -561,7 +561,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1c.dbf' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=DBF `FILE_NAME`='t1c.dbf' SELECT * FROM t1; a 10 diff --git a/storage/connect/mysql-test/connect/r/dir.result b/storage/connect/mysql-test/connect/r/dir.result index 139544b99e980..d13d2a455c000 100644 --- a/storage/connect/mysql-test/connect/r/dir.result +++ b/storage/connect/mysql-test/connect/r/dir.result @@ -20,7 +20,7 @@ t1 CREATE TABLE `t1` ( `fname` varchar(256) NOT NULL, `ftype` char(4) NOT NULL, `size` double(12,0) NOT NULL `flag`=5 -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DIR `FILE_NAME`='*.txt' `OPTION_LIST`='subdir=0' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=DIR `FILE_NAME`='*.txt' `OPTION_LIST`='subdir=0' SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size; fname ftype size boys .txt 282 diff --git a/storage/connect/mysql-test/connect/r/fix.result b/storage/connect/mysql-test/connect/r/fix.result index 4d620c66a04b7..4b8806c1cc954 100644 --- a/storage/connect/mysql-test/connect/r/fix.result +++ b/storage/connect/mysql-test/connect/r/fix.result @@ -26,7 +26,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=FIX `FILE_NAME`='t1.txt' `READONLY`=1 +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=FIX `FILE_NAME`='t1.txt' `READONLY`=1 INSERT INTO t1 VALUES (20); ERROR HY000: Table 't1' is read only UPDATE t1 SET id=20 WHERE id=10; @@ -40,7 +40,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=FIX `FILE_NAME`='t1.txt' `READONLY`=0 +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=FIX `FILE_NAME`='t1.txt' `READONLY`=0 INSERT INTO t1 VALUES (20); SELECT * FROM t1; id diff --git a/storage/connect/mysql-test/connect/r/general.result b/storage/connect/mysql-test/connect/r/general.result index ed2c903145db5..ef023b7c8d913 100644 --- a/storage/connect/mysql-test/connect/r/general.result +++ b/storage/connect/mysql-test/connect/r/general.result @@ -16,3 +16,17 @@ SELECT * FROM t1; a 10 DROP TABLE t1; +# +# MDEV-23626: CONNECT VIR tables return inconsistent error for UPDATE +# +CREATE TABLE numbers +ENGINE=CONNECT, +TABLE_TYPE=VIR, +BLOCK_SIZE=3; +TRUNCATE TABLE numbers; +ERROR HY000: Got error 174 'Virtual tables are read only' from CONNECT +DELETE FROM numbers WHERE n = 1; +ERROR HY000: Got error 174 'Virtual tables are read only' from CONNECT +UPDATE numbers SET n = 10 WHERE n = 1; +ERROR HY000: Got error 174 'Virtual tables are read only' from CONNECT +DROP TABLE numbers; diff --git a/storage/connect/mysql-test/connect/r/grant2.result b/storage/connect/mysql-test/connect/r/grant2.result index 2e20dc3959632..4999b76fe50ec 100644 --- a/storage/connect/mysql-test/connect/r/grant2.result +++ b/storage/connect/mysql-test/connect/r/grant2.result @@ -620,7 +620,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=fix `FILE_NAME`='t1.fix' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=fix `FILE_NAME`='t1.fix' RENAME TABLE t2 TO t1; connection user; RENAME TABLE t1 TO t2; @@ -636,7 +636,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=fix `FILE_NAME`='t1.fix' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=fix `FILE_NAME`='t1.fix' ALTER TABLE t2 RENAME TO t1; connection user; ALTER TABLE t1 RENAME TO t2; diff --git a/storage/connect/mysql-test/connect/r/index.result b/storage/connect/mysql-test/connect/r/index.result index bffaaecc7852a..baebf1f1ebead 100644 --- a/storage/connect/mysql-test/connect/r/index.result +++ b/storage/connect/mysql-test/connect/r/index.result @@ -139,3 +139,48 @@ DELETE FROM t1; DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +# +# MDEV-28299: Server crashes in +# XINDXS::Range/CntIndexRange (Connect engine) +# +CREATE TABLE t1 ( a int not null, KEY (a))engine=CONNECT; +Warnings: +Warning 1105 No table_type. Will be set to DOS +Warning 1105 No file name. Table will use t1.dos +SELECT * FROM t1 WHERE a=1; +a +INSERT INTO t1 values (1),(2),(1); +SELECT * FROM t1 WHERE a=1; +a +1 +1 +DROP TABLE t1; +CREATE TABLE t1 (a int, b int, pk int, PRIMARY KEY (pk)) engine=CONNECT; +Warnings: +Warning 1105 No table_type. Will be set to DOS +Warning 1105 No file name. Table will use t1.dos +SELECT x.a +FROM t1 AS x JOIN t1 AS y ON (x.a = y.b) +WHERE x.pk > 3; +a +INSERT INTO t1 values (1,2,1),(2,1,2),(1,2,3),(3,4,4); +SELECT x.a +FROM t1 AS x JOIN t1 AS y ON (x.a = y.b) +WHERE x.pk > 3; +a +INSERT INTO t1 values (1,2,5); +SELECT x.a +FROM t1 AS x JOIN t1 AS y ON (x.a = y.b) +WHERE x.pk > 3; +a +1 +DROP TABLE t1; +# +# MDEV-27591 Connect tables (FIX/DOS) don't work with DESC keys - wrong results +# +CREATE TABLE t1 ( +id INT, +f VARCHAR(32), +PRIMARY KEY (id DESC) +) ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='emp.txt'; +ERROR HY000: Descending indexes are not supported diff --git a/storage/connect/mysql-test/connect/r/infoschema2-9739.result b/storage/connect/mysql-test/connect/r/infoschema2-9739.result index 32ca77dc71d21..6abc576ff8eb7 100644 --- a/storage/connect/mysql-test/connect/r/infoschema2-9739.result +++ b/storage/connect/mysql-test/connect/r/infoschema2-9739.result @@ -1,5 +1,3 @@ -Warnings: -Warning 1105 No file name. Table will use t1.xml create table t1 (i int) engine=Connect table_type=XML option_list='xmlsup=libxml2'; Warnings: Warning 1105 No file name. Table will use t1.xml diff --git a/storage/connect/mysql-test/connect/r/ini.result b/storage/connect/mysql-test/connect/r/ini.result index a377cb3ee201b..86d25c8d649ab 100644 --- a/storage/connect/mysql-test/connect/r/ini.result +++ b/storage/connect/mysql-test/connect/r/ini.result @@ -190,7 +190,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `contact` char(10) DEFAULT NULL `flag`=1, `c2` char(60) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=INI `FILE_NAME`='t1.ini' `READONLY`=1 +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=INI `FILE_NAME`='t1.ini' `READONLY`=1 INSERT INTO t1 VALUES ('US',40); ERROR HY000: Table 't1' is read only UPDATE t1 SET c2=20 WHERE c2=10; @@ -205,7 +205,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `contact` char(10) DEFAULT NULL `flag`=1, `c2` char(60) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=INI `FILE_NAME`='t1.ini' `READONLY`=0 +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=INI `FILE_NAME`='t1.ini' `READONLY`=0 INSERT INTO t1 VALUES ('US',40); SELECT * FROM t1; contact c2 diff --git a/storage/connect/mysql-test/connect/r/jdbc_postgresql.result b/storage/connect/mysql-test/connect/r/jdbc_postgresql.result index 07cc3c465eac2..bec1dc8725b14 100644 --- a/storage/connect/mysql-test/connect/r/jdbc_postgresql.result +++ b/storage/connect/mysql-test/connect/r/jdbc_postgresql.result @@ -1,4 +1,4 @@ -SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/JavaWrappers.jar;C:/Jconnectors/postgresql-42.2.1.jar'; +SET GLOBAL connect_class_path='C:/MariaDB-10.0/MariaDB/storage/connect/mysql-test/connect/std_data/JavaWrappers.jar;C:/Jconnectors/postgresql-42.2.1.jar'; CREATE TABLE t2 ( command varchar(128) not null, number int(5) not null flag=1, diff --git a/storage/connect/mysql-test/connect/r/json.result b/storage/connect/mysql-test/connect/r/json.result index 8cc4e66c2ea2c..55b1bb8b8e557 100644 --- a/storage/connect/mysql-test/connect/r/json.result +++ b/storage/connect/mysql-test/connect/r/json.result @@ -515,3 +515,27 @@ Beth 4 Food 17.00 Beth 4 Beer 15.00 Janet 4 Car 17.00 DROP TABLE t1, t2, t3, t4; +# +# MDEV-29426 memory leak on "SHOW INDEX" +# +CREATE TABLE t1 +( +ISBN CHAR(15) NOT NULL, +Language CHAR(2) JPATH='$.LANG', +Subject CHAR(32) JPATH='$.SUBJECT', +AuthorFN CHAR(128) JPATH='$.AUTHOR[*].FIRSTNAME', +AuthorLN CHAR(128) JPATH='$.AUTHOR[*].LASTNAME', +Title CHAR(32) JPATH='$.TITLE', +Translation CHAR(32) JPATH='$.TRANSLATED.PREFIX', +TranslatorFN CHAR(80) JPATH='$.TRANSLATED.TRANSLATOR.FIRSTNAME', +TranslatorLN CHAR(80) JPATH='$.TRANSLATED.TRANSLATOR.LASTNAME', +Publisher CHAR(20) JPATH='$.PUBLISHER.NAME', +Location CHAR(16) JPATH='$.PUBLISHER.PLACE', +Year int(4) JPATH='$.DATEPUB', +INDEX IX(ISBN) +) +ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='bib0.json' LRECL=320 OPTION_LIST='Pretty=0'; +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 Ignored +t1 1 IX 1 ISBN A NULL NULL NULL XINDEX NO +DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/r/misc.result b/storage/connect/mysql-test/connect/r/misc.result new file mode 100644 index 0000000000000..6b6372f6e414b --- /dev/null +++ b/storage/connect/mysql-test/connect/r/misc.result @@ -0,0 +1,54 @@ +execute immediate concat('create table t engine=CONNECT table_type=JSON',REPEAT('1',5000), +' FILE_NAME=''users.json'' HTTP=''http://localhost:4142/'' URI=''/users'''); +ERROR HY000: Unsupported table type JSON1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +execute immediate concat('create table t engine=CONNECT table_type=OEM module=''libname'' +Option_list=''Myopt=foo'' subtype=''MYTYPE',REPEAT('1', 10000), ''''); +ERROR HY000: Subtype string too long +execute immediate concat('create table t engine=CONNECT table_type=DBF file_name=''', +REPLACE(@@secure_file_priv,'\\','/'),'cust.dbf', REPEAT('1', 10000), ''''); +ERROR HY000: Cannot open +create table t engine=connect table_type=mysql +CONNECTION='mysql://root@localhost:MASTER_MYPORT/test/foobar' + SRCDEF='SELECT 1,''%n'' FROM DUAL WHERE %s'; +select *from t; +ERROR HY000: Got error 174 'MakeSQL: Wrong place holders specification' from CONNECT +drop table t; +create table t engine=connect table_type=mysql +CONNECTION='mysql://root@localhost:MASTER_MYPORT/test/foobar' + SRCDEF='SELECT 1,%n FROM DUAL WHERE %s'; +ERROR HY000: (1064) 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 '%n FROM DUAL WHERE 1=1 LIMIT 0' at line 1 [SELECT 1,%n FROM DUAL WHERE 1=1 LIMIT 0] +create table t engine=connect table_type=mysql +CONNECTION='mysql://root@localhost:MASTER_MYPORT/test/foobar' + SRCDEF='SELECT 1 FROM DUAL WHERE %s'; +select *from t; +1 +1 +drop table t; +create table beers ( +`Name` char(16) xpath='brandName', +`Origin` char(16) xpath='origin', +`Description` char(32) xpath='details') +engine=CONNECT table_type=XML file_name='MYSQLTEST_VARDIR/tmp/beer.xml' +tabname='table' option_list='rownode=tr,colnode=td%n'; +select * from beers; +Name Origin Description +NULL NULL NULL +NULL NULL NULL +drop table beers; +create table beers ( +`Name` char(16) xpath='brandName', +`Origin` char(16) xpath='origin', +`Description` char(32) xpath='details') +engine=CONNECT table_type=XML file_name='MYSQLTEST_VARDIR/tmp/beer.xml' +tabname='table' option_list='rownode=tr,colnode=td'; +insert into beers values('11','22','33'); +drop table beers; +execute immediate CONCAT('create table jsampall +(Author char(128) jpath=''$.AUTHOR["', REPEAT('a',10000),'"]'') +engine=CONNECT table_type=JSON +file_name=''',REPLACE(@@secure_file_priv,'\\','/'),'tmp/test.json'''); +select author from jsampall; +author +Jean-Christophe Bernadacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +William J. Pardi +drop table jsampall; diff --git a/storage/connect/mysql-test/connect/r/mysql.result b/storage/connect/mysql-test/connect/r/mysql.result index 3ac23394cbc0a..1dcbca88a7b5e 100644 --- a/storage/connect/mysql-test/connect/r/mysql.result +++ b/storage/connect/mysql-test/connect/r/mysql.result @@ -26,7 +26,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `x` int(11) DEFAULT NULL, `y` char(10) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' SELECT * FROM t2; ERROR HY000: Got error 174 '(1054) Unknown column 'x' in 'field list' [SELECT `x`, `y` FROM `t1`]' from CONNECT DROP TABLE t2; @@ -45,7 +45,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` char(10) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' SELECT * FROM t2; a b NULL NULL @@ -60,7 +60,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` char(10) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' SELECT * FROM t2; a b NULL NULL @@ -75,7 +75,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) NOT NULL, `b` char(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' SELECT * FROM t2; a b 0 @@ -90,7 +90,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` char(10) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' SELECT * FROM t2; a b NULL NULL @@ -109,12 +109,12 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` smallint(6) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` smallint(6) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' SELECT * FROM t2; a DROP TABLE t2, t1; @@ -124,12 +124,12 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumint(9) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(9) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' SELECT * FROM t2; a DROP TABLE t2, t1; @@ -139,12 +139,12 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' SELECT * FROM t2; a DROP TABLE t2, t1; @@ -154,12 +154,12 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` bigint(20) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' SELECT * FROM t2; a DROP TABLE t2, t1; @@ -172,12 +172,12 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` char(10) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' SELECT * FROM t2; a DROP TABLE t2, t1; @@ -187,12 +187,12 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` varchar(10) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' SELECT * FROM t2; a DROP TABLE t2, t1; @@ -208,12 +208,12 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` date DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' SELECT * FROM t2; a DROP TABLE t2, t1; @@ -233,7 +233,7 @@ a /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@localhost:PORT/test/t1' `TABLE_TYPE`='MYSQL'; +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CONNECTION='mysql://root@localhost:PORT/test/t1' `TABLE_TYPE`='MYSQL'; /*!40101 SET character_set_client = @saved_cs_client */; # End of mysqldump ------ DROP TABLE t2; @@ -286,7 +286,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` tinyint(4) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@localhost:PORT/test/t1' `TABLE_TYPE`='MYSQL' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CONNECTION='mysql://root@localhost:PORT/test/t1' `TABLE_TYPE`='MYSQL' SELECT * FROM t2; a 10 @@ -294,3 +294,86 @@ a 30 DROP TABLE t2; DROP TABLE t1; +# +# MDEV-27766 CONNECT Engine Support for INSERT IGNORE with Mysql Table type +# +CREATE TABLE t1 (a INT PRIMARY KEY); +INSERT INTO t1 VALUES (10),(20),(30); +CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@localhost:PORT/test/t1' OPTION_LIST="Delayed=1,Ignored=1"; +INSERT INTO t2 VALUES (10),(20),(30),(40); +DROP TABLE t2; +DROP TABLE t1; +# +# MDEV-28533 CONNECT engine does not quote columns involved in WHERE clause +# +CREATE TABLE t1 (id int, `spaced col` varchar(10),`nospace` varchar(10)); +insert into t1 values (1,1,'x1'),(2,'C-003','x2'); +SELECT * from t1; +id spaced col nospace +1 1 x1 +2 C-003 x2 +CREATE TABLE t2 (id int, `spaced col` varchar(10), `nospace` varchar(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='test' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT'; +SELECT * from t2; +id spaced col nospace +1 1 x1 +2 C-003 x2 +SELECT `id` FROM t2 WHERE t2.`nospace` = 'x1'; +id +1 +SELECT `id` FROM t2 WHERE t2.`spaced col` = 'C-003'; +id +2 +DROP TABLE t1; +DROP TABLE t2; +# +# MDEV-28489 / MDEV-26722 UTF8 bytes calculated incorrectly +# +CREATE TABLE t1 (name varchar(20)) CHARSET=utf8; +INSERT INTO t1 (name) VALUES ('Иванова'), ('Ivanova'); +CREATE TABLE t2 (name varchar(1)) ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='test' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT' CHARSET=utf8; +SELECT hex(name) from t1; +hex(name) +C390CB9CC390C2B2C390C2B0C390C2BDC390C2BEC390C2B2C390C2B0 +4976616E6F7661 +SELECT hex(name) from t2; +hex(name) +C390 +49 +Warnings: +Warning 1105 Out of range value for column name at row 1 +Warning 1265 Data truncated for column 'name' at row 1 +Warning 1105 Out of range value �? for column 'name' at row 1 +Warning 1105 Out of range value for column name at row 2 +Warning 1265 Data truncated for column 'name' at row 2 +Warning 1105 Out of range value Iva for column 'name' at row 2 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (col char(5)) CHARSET=utf8; +INSERT INTO t1 (col) VALUES ('glace'), ('glacé'); +Warnings: +Warning 1406 Data too long for column 'col' at row 2 +CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='test' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT' CHARSET=utf8; +SELECT hex(col) from t1; +hex(col) +676C616365 +676C6163C383 +SELECT hex(col) from t2; +hex(col) +676C616365 +676C6163C383 +DROP TABLE t2; +DROP TABLE t1; +# +# MDEV-29782 CONNECT engine converted YEAR to DATETIME, causing INSERT to fail +# +CREATE TABLE t1 (id year); +CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='test' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT'; +INSERT INTO t2 VALUES (1999); +SELECT * FROM t2; +id +1999 +DROP TABLE t2; +DROP TABLE t1; +# +# End of 10.3 tests +# diff --git a/storage/connect/mysql-test/connect/r/mysql_discovery.result b/storage/connect/mysql-test/connect/r/mysql_discovery.result index 32bd4761f37a6..1c9f83cd95f05 100644 --- a/storage/connect/mysql-test/connect/r/mysql_discovery.result +++ b/storage/connect/mysql-test/connect/r/mysql_discovery.result @@ -23,7 +23,7 @@ t1 CREATE TABLE `t1` ( `a\\b` int(11) NOT NULL DEFAULT 2, `a\\` int(10) unsigned DEFAULT NULL, `name` varchar(32) DEFAULT 'name' -) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1' `TABLE_TYPE`='MYSQL' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1' `TABLE_TYPE`='MYSQL' INSERT INTO t1 (id, name) VALUES (1, 'foo'); INSERT INTO t1 (id, name) VALUES (2, 'fee'); SELECT * FROM t1; diff --git a/storage/connect/mysql-test/connect/r/mysql_new.result b/storage/connect/mysql-test/connect/r/mysql_new.result index 0394caac8af1a..4d4006eea2c1a 100644 --- a/storage/connect/mysql-test/connect/r/mysql_new.result +++ b/storage/connect/mysql-test/connect/r/mysql_new.result @@ -39,7 +39,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL, `y` char(10) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1' `TABLE_TYPE`=MYSQL +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1' `TABLE_TYPE`=MYSQL SELECT * FROM t1; ERROR HY000: Got error 174 '(1054) Unknown column 'x' in 'field list' [SELECT `x`, `y` FROM `t1`]' from CONNECT DROP TABLE t1; @@ -64,7 +64,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` char(10) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1' `TABLE_TYPE`='MYSQL' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1' `TABLE_TYPE`='MYSQL' SELECT * FROM t1; a b NULL NULL @@ -80,7 +80,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` char(10) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=127.0.0.1,user=root,port=SLAVE_PORT' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=127.0.0.1,user=root,port=SLAVE_PORT' SELECT * FROM t1; a b NULL NULL @@ -96,7 +96,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` char(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `OPTION_LIST`='host=127.0.0.1,user=root,port=SLAVE_PORT' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=MYSQL `OPTION_LIST`='host=127.0.0.1,user=root,port=SLAVE_PORT' SELECT * FROM t1; a b 0 @@ -112,7 +112,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1' `TABLE_TYPE`=MYSQL +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1' `TABLE_TYPE`=MYSQL SELECT * FROM t1; a b NULL NULL @@ -138,7 +138,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT NULL, `g` double DEFAULT NULL, `h` decimal(20,5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES(100,3333,41235,1234567890,235000000000,3.14159265,3.14159265,3141.59265); connection master; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL @@ -154,7 +154,7 @@ t1 CREATE TABLE `t1` ( `f` double DEFAULT NULL, `g` double DEFAULT NULL, `h` decimal(20,5) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `OPTION_LIST`='host=127.0.0.1,user=root,port=SLAVE_PORT' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`='MYSQL' `OPTION_LIST`='host=127.0.0.1,user=root,port=SLAVE_PORT' SELECT * FROM t1; a b c d e f g h 100 3333 41235 1234567890 235000000000 3.14159 3.14159265 3141.59265 @@ -170,7 +170,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(12) DEFAULT NULL, `b` varchar(12) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 VALUES('Welcome','Hello, World'); SELECT * FROM t1; a b @@ -183,7 +183,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(12) DEFAULT NULL, `b` varchar(12) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT' `TABLE_TYPE`='MYSQL' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT' `TABLE_TYPE`='MYSQL' SELECT * FROM t1; a b Welcome Hello, World @@ -202,7 +202,7 @@ t1 CREATE TABLE `t1` ( `c` time DEFAULT NULL, `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `e` year(4) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT IGNORE INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23'); Warnings: Note 1265 Data truncated for column 'a' at row 1 @@ -222,7 +222,7 @@ t1 CREATE TABLE `t1` ( `c` time DEFAULT NULL, `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `e` year(4) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT' `TABLE_TYPE`='MYSQL' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT' `TABLE_TYPE`='MYSQL' SELECT * FROM t1; a b c d e 2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003 diff --git a/storage/connect/mysql-test/connect/r/odbc.result b/storage/connect/mysql-test/connect/r/odbc.result index 4ca7e2095df3d..442fe36a0e47e 100644 --- a/storage/connect/mysql-test/connect/r/odbc.result +++ b/storage/connect/mysql-test/connect/r/odbc.result @@ -6,7 +6,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `Name` varchar(256) NOT NULL, `Description` varchar(256) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Sources' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`='ODBC' `CATFUNC`='Sources' DROP TABLE t1; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Drivers; SHOW CREATE TABLE t1; @@ -14,7 +14,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `Description` char(128) NOT NULL, `Attributes` varchar(256) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Drivers' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`='ODBC' `CATFUNC`='Drivers' DROP TABLE t1; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Tables CONNECTION='Not important'; SHOW CREATE TABLE t1; @@ -25,7 +25,7 @@ t1 CREATE TABLE `t1` ( `Table_Name` char(128) NOT NULL, `Table_Type` char(16) NOT NULL, `Remark` char(255) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='Not important' `TABLE_TYPE`='ODBC' `CATFUNC`='Tables' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CONNECTION='Not important' `TABLE_TYPE`='ODBC' `CATFUNC`='Tables' DROP TABLE t1; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Columns CONNECTION='Not important'; SHOW CREATE TABLE t1; @@ -43,5 +43,5 @@ t1 CREATE TABLE `t1` ( `Radix` smallint(6) DEFAULT NULL, `Nullable` smallint(6) NOT NULL, `Remarks` char(255) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='Not important' `TABLE_TYPE`='ODBC' `CATFUNC`='Columns' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CONNECTION='Not important' `TABLE_TYPE`='ODBC' `CATFUNC`='Columns' DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/r/odbc_postgresql.result b/storage/connect/mysql-test/connect/r/odbc_postgresql.result index dc23dbdb990fb..9ecb66307e603 100644 --- a/storage/connect/mysql-test/connect/r/odbc_postgresql.result +++ b/storage/connect/mysql-test/connect/r/odbc_postgresql.result @@ -2,7 +2,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `Name` varchar(256) NOT NULL, `Description` varchar(256) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Sources' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`='ODBC' `CATFUNC`='Sources' SET NAMES utf8; # # Checking CATFUNC=Tables @@ -15,8 +15,10 @@ Table_Cat Table_Schema Table_Name Table_Type Remark mtr public t1 TABLE mtr public t2 TABLE mtr public v1 VIEW +mtr schema1 space_in_column_name TABLE mtr schema1 t1 TABLE mtr schema1 t2 TABLE +mtr schema1 t3 TABLE mtr schema1 v1 VIEW DROP TABLE t1; # All tables in all schemas @@ -26,8 +28,10 @@ Table_Cat Table_Schema Table_Name Table_Type Remark mtr public t1 TABLE mtr public t2 TABLE mtr public v1 VIEW +mtr schema1 space_in_column_name TABLE mtr schema1 t1 TABLE mtr schema1 t2 TABLE +mtr schema1 t3 TABLE mtr schema1 v1 VIEW DROP TABLE t1; # All tables in all schemas @@ -37,8 +41,10 @@ Table_Cat Table_Schema Table_Name Table_Type Remark mtr public t1 TABLE mtr public t2 TABLE mtr public v1 VIEW +mtr schema1 space_in_column_name TABLE mtr schema1 t1 TABLE mtr schema1 t2 TABLE +mtr schema1 t3 TABLE mtr schema1 v1 VIEW DROP TABLE t1; # All tables in the default schema ("public") @@ -99,8 +105,11 @@ Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Bu mtr public t1 a 4 int4 10 4 0 10 0 mtr public t2 a 4 int4 10 4 0 10 0 mtr public v1 a 4 int4 10 4 0 10 1 +mtr schema1 space_in_column_name my space column 1 bpchar 20 80 NULL NULL 0 mtr schema1 t1 a 1 bpchar 10 40 NULL NULL 0 mtr schema1 t2 a 1 bpchar 10 40 NULL NULL 0 +mtr schema1 t3 a 1 bpchar 10 40 NULL NULL 0 +mtr schema1 t3 b 1 bpchar 10 40 NULL NULL 0 mtr schema1 v1 a 1 bpchar 10 40 NULL NULL 1 DROP TABLE t1; # All columns in the schemas "public" and "schema1" @@ -110,8 +119,11 @@ Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Bu mtr public t1 a 4 int4 10 4 0 10 0 mtr public t2 a 4 int4 10 4 0 10 0 mtr public v1 a 4 int4 10 4 0 10 1 +mtr schema1 space_in_column_name my space column 1 bpchar 20 80 NULL NULL 0 mtr schema1 t1 a 1 bpchar 10 40 NULL NULL 0 mtr schema1 t2 a 1 bpchar 10 40 NULL NULL 0 +mtr schema1 t3 a 1 bpchar 10 40 NULL NULL 0 +mtr schema1 t3 b 1 bpchar 10 40 NULL NULL 0 mtr schema1 v1 a 1 bpchar 10 40 NULL NULL 1 DROP TABLE t1; # All tables "t1" in all schemas @@ -150,7 +162,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' SELECT * FROM t1; a 10 @@ -161,7 +173,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(10) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a 10 @@ -182,7 +194,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='public.t1' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='public.t1' SELECT * FROM t1; a 10 @@ -195,7 +207,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=utf8 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.t1' `DATA_CHARSET`='utf8' +) ENGINE=CONNECT DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.t1' `DATA_CHARSET`='utf8' SELECT * FROM t1; a aaa @@ -206,8 +218,8 @@ CREATE TABLE t2 AS SELECT * FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` char(10) CHARACTER SET utf8 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a aaa @@ -230,7 +242,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=utf8 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.v1' `DATA_CHARSET`='utf8' +) ENGINE=CONNECT DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.v1' `DATA_CHARSET`='utf8' SELECT * FROM t1; a aaa @@ -241,8 +253,8 @@ CREATE TABLE t2 AS SELECT * FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` char(10) CHARACTER SET utf8 DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a aaa @@ -265,7 +277,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=utf8 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.t2' `DATA_CHARSET`='utf8' +) ENGINE=CONNECT DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.t2' `DATA_CHARSET`='utf8' SELECT * FROM t1; a xxx @@ -276,8 +288,8 @@ CREATE TABLE t2 AS SELECT * FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` char(10) CHARACTER SET utf8 NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 + `a` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT * FROM t2; a xxx @@ -294,3 +306,25 @@ zzz ÄÖÜ DROP VIEW v1; DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(6), b VARCHAR(6), PRIMARY KEY(a, b)) ENGINE=CONNECT TABNAME='schema1.t3' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr'; +DELETE FROM t1 WHERE a='20'; +Warnings: +Note 1105 schema1.t3: 0 affected rows +DROP TABLE t1; +# +# MDEV-29687 ODBC tables do not quote identifier names correctly +# +CREATE TABLE pg_in_maria ENGINE=CONNECT TABNAME='schema1.space_in_column_name' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' quoted=1; +SELECT * from pg_in_maria; +my space column +My value +DROP TABLE pg_in_maria; +# +# MDEV-29397 UPDATE with WHERE on part of two-part primary key causes +# info to turn into error. +# +CREATE TABLE t1 (a VARCHAR(6), b VARCHAR(6), PRIMARY KEY(a, b)) ENGINE=CONNECT TABNAME='schema1.t3' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr'; +UPDATE t1 SET a='10' WHERE a='20'; +Warnings: +Note 1105 schema1.t3: 0 affected rows +DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/r/vec.result b/storage/connect/mysql-test/connect/r/vec.result index 51fb8aeee778c..52c10b6c59d10 100644 --- a/storage/connect/mysql-test/connect/r/vec.result +++ b/storage/connect/mysql-test/connect/r/vec.result @@ -14,7 +14,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` char(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' SELECT * FROM t1; a b Warnings: @@ -54,7 +54,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` char(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' SELECT * FROM t1; a b Warnings: @@ -99,7 +99,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` char(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' `READONLY`=yes +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' `READONLY`=yes INSERT INTO t1 VALUES (4,'test04'); ERROR HY000: Table 't1' is read only UPDATE t1 SET b='test04' WHERE a=3; @@ -114,7 +114,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` char(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' `READONLY`=no +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' `READONLY`=no INSERT INTO t1 VALUES (4,'test04'); UPDATE t1 SET b='test04a' WHERE a=4; DELETE FROM t1 WHERE a=0; diff --git a/storage/connect/mysql-test/connect/r/xml.result b/storage/connect/mysql-test/connect/r/xml.result index 575c903bbbc5c..d09e531828fe1 100644 --- a/storage/connect/mysql-test/connect/r/xml.result +++ b/storage/connect/mysql-test/connect/r/xml.result @@ -285,7 +285,7 @@ SHOW CREATE TABLE t1; Table t1 Create Table CREATE TABLE `t1` ( `c` char(16) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=XML `FILE_NAME`='latin1.xml' `OPTION_LIST`='xmlsup=domdoc' `DATA_CHARSET`=utf8 +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=XML `FILE_NAME`='latin1.xml' `OPTION_LIST`='xmlsup=domdoc' `DATA_CHARSET`=utf8 SELECT c, HEX(c) FROM t1; c ÁÂÃÄÅÆÇ HEX(c) C1C2C3C4C5C6C7 diff --git a/storage/connect/mysql-test/connect/r/xml2.result b/storage/connect/mysql-test/connect/r/xml2.result index 891c6e6f8dd25..3f82ed1adff57 100644 --- a/storage/connect/mysql-test/connect/r/xml2.result +++ b/storage/connect/mysql-test/connect/r/xml2.result @@ -1,5 +1,3 @@ -Warnings: -Warning 1105 No file name. Table will use t1.xml SET NAMES utf8; # # Testing tag values @@ -287,7 +285,7 @@ SHOW CREATE TABLE t1; Table t1 Create Table CREATE TABLE `t1` ( `c` char(16) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=XML `FILE_NAME`='latin1.xml' `OPTION_LIST`='xmlsup=libxml2' `DATA_CHARSET`=utf8 +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`=XML `FILE_NAME`='latin1.xml' `OPTION_LIST`='xmlsup=libxml2' `DATA_CHARSET`=utf8 SELECT c, HEX(c) FROM t1; c ÁÂÃÄÅÆÇ HEX(c) C1C2C3C4C5C6C7 diff --git a/storage/connect/mysql-test/connect/r/xml2_grant.result b/storage/connect/mysql-test/connect/r/xml2_grant.result index a6e6c150b5931..e014f00f577fa 100644 --- a/storage/connect/mysql-test/connect/r/xml2_grant.result +++ b/storage/connect/mysql-test/connect/r/xml2_grant.result @@ -1,5 +1,3 @@ -Warnings: -Warning 1105 No file name. Table will use t1.xml # # Beginning of grant.inc # diff --git a/storage/connect/mysql-test/connect/r/xml2_html.result b/storage/connect/mysql-test/connect/r/xml2_html.result index 499108b724dc0..0ec47ad803870 100644 --- a/storage/connect/mysql-test/connect/r/xml2_html.result +++ b/storage/connect/mysql-test/connect/r/xml2_html.result @@ -1,5 +1,3 @@ -Warnings: -Warning 1105 No file name. Table will use t1.xml SET NAMES utf8; # # Testing HTML like XML file diff --git a/storage/connect/mysql-test/connect/r/xml2_mdev5261.result b/storage/connect/mysql-test/connect/r/xml2_mdev5261.result index 0ee5712dd0257..8913663f6ae42 100644 --- a/storage/connect/mysql-test/connect/r/xml2_mdev5261.result +++ b/storage/connect/mysql-test/connect/r/xml2_mdev5261.result @@ -1,5 +1,3 @@ -Warnings: -Warning 1105 No file name. Table will use t1.xml SET NAMES utf8; CREATE TABLE t1 (i INT UNIQUE NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xt1.xml' OPTION_LIST='xmlsup=libxml2,Rownode=N'; ERROR HY000: Table type XML is not indexable diff --git a/storage/connect/mysql-test/connect/r/xml2_mult.result b/storage/connect/mysql-test/connect/r/xml2_mult.result index 0146baa89c0d8..5d68527b592b8 100644 --- a/storage/connect/mysql-test/connect/r/xml2_mult.result +++ b/storage/connect/mysql-test/connect/r/xml2_mult.result @@ -1,5 +1,3 @@ -Warnings: -Warning 1105 No file name. Table will use t1.xml SET NAMES utf8; # # Testing expanded values diff --git a/storage/connect/mysql-test/connect/r/xml2_zip.result b/storage/connect/mysql-test/connect/r/xml2_zip.result index e743af3241811..7e36650da7172 100644 --- a/storage/connect/mysql-test/connect/r/xml2_zip.result +++ b/storage/connect/mysql-test/connect/r/xml2_zip.result @@ -1,5 +1,3 @@ -Warnings: -Warning 1105 No file name. Table will use t1.xml # # Testing zipped XML tables # diff --git a/storage/connect/mysql-test/connect/t/bson.test b/storage/connect/mysql-test/connect/t/bson.test index ab38cab73fc80..173435d79d1e0 100644 --- a/storage/connect/mysql-test/connect/t/bson.test +++ b/storage/connect/mysql-test/connect/t/bson.test @@ -282,6 +282,29 @@ SELECT * FROM t1; SELECT * FROM t1 WHERE WEEK = 4; DROP TABLE t1, t2, t3, t4; +--echo # +--echo # MDEV-29426 memory leak on "SHOW INDEX" +--echo # +CREATE TABLE t1 +( + ISBN CHAR(15) NOT NULL, + Language CHAR(2) JPATH='$.LANG', + Subject CHAR(32) JPATH='$.SUBJECT', + AuthorFN CHAR(128) JPATH='$.AUTHOR[*].FIRSTNAME', + AuthorLN CHAR(128) JPATH='$.AUTHOR[*].LASTNAME', + Title CHAR(32) JPATH='$.TITLE', + Translation CHAR(32) JPATH='$.TRANSLATED.PREFIX', + TranslatorFN CHAR(80) JPATH='$.TRANSLATED.TRANSLATOR.FIRSTNAME', + TranslatorLN CHAR(80) JPATH='$.TRANSLATED.TRANSLATOR.LASTNAME', + Publisher CHAR(20) JPATH='$.PUBLISHER.NAME', + Location CHAR(16) JPATH='$.PUBLISHER.PLACE', + Year int(4) JPATH='$.DATEPUB', + INDEX IX(ISBN) +) +ENGINE=CONNECT TABLE_TYPE=BSON FILE_NAME='bib0.json' LRECL=320 OPTION_LIST='Pretty=0'; +SHOW INDEX FROM t1; +DROP TABLE t1; + # # Clean up # diff --git a/storage/connect/mysql-test/connect/t/general.test b/storage/connect/mysql-test/connect/t/general.test index 34e5d4c7b6d1e..e2f228738cf12 100644 --- a/storage/connect/mysql-test/connect/t/general.test +++ b/storage/connect/mysql-test/connect/t/general.test @@ -14,3 +14,20 @@ SELECT * FROM t1; ALTER TABLE t1 TABLE_TYPE=NON_EXISTING; SELECT * FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-23626: CONNECT VIR tables return inconsistent error for UPDATE +--echo # + +CREATE TABLE numbers +ENGINE=CONNECT, +TABLE_TYPE=VIR, +BLOCK_SIZE=3; + +--error ER_GET_ERRMSG +TRUNCATE TABLE numbers; +--error ER_GET_ERRMSG +DELETE FROM numbers WHERE n = 1; +--error ER_GET_ERRMSG +UPDATE numbers SET n = 10 WHERE n = 1; +DROP TABLE numbers; diff --git a/storage/connect/mysql-test/connect/t/have_libxml2.inc b/storage/connect/mysql-test/connect/t/have_libxml2.inc index fc16265aa12f1..64722af0ec4fd 100644 --- a/storage/connect/mysql-test/connect/t/have_libxml2.inc +++ b/storage/connect/mysql-test/connect/t/have_libxml2.inc @@ -1,4 +1,5 @@ --disable_query_log +--disable_warnings --error 0,ER_UNKNOWN_ERROR CREATE TABLE t1 (a VARCHAR(10)) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=libxml2'; @@ -12,6 +13,7 @@ if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES Skip Need LIBXML2; } DROP TABLE t1; +--enable_warnings --enable_query_log diff --git a/storage/connect/mysql-test/connect/t/index.test b/storage/connect/mysql-test/connect/t/index.test index 5e913582734e1..47bfbae7680ef 100644 --- a/storage/connect/mysql-test/connect/t/index.test +++ b/storage/connect/mysql-test/connect/t/index.test @@ -78,6 +78,42 @@ DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +--echo # +--echo # MDEV-28299: Server crashes in +--echo # XINDXS::Range/CntIndexRange (Connect engine) +--echo # + +CREATE TABLE t1 ( a int not null, KEY (a))engine=CONNECT; +SELECT * FROM t1 WHERE a=1; + +INSERT INTO t1 values (1),(2),(1); +SELECT * FROM t1 WHERE a=1; +DROP TABLE t1; + +CREATE TABLE t1 (a int, b int, pk int, PRIMARY KEY (pk)) engine=CONNECT; +SELECT x.a +FROM t1 AS x JOIN t1 AS y ON (x.a = y.b) +WHERE x.pk > 3; +INSERT INTO t1 values (1,2,1),(2,1,2),(1,2,3),(3,4,4); +SELECT x.a +FROM t1 AS x JOIN t1 AS y ON (x.a = y.b) +WHERE x.pk > 3; +INSERT INTO t1 values (1,2,5); +SELECT x.a +FROM t1 AS x JOIN t1 AS y ON (x.a = y.b) +WHERE x.pk > 3; +DROP TABLE t1; + +--echo # +--echo # MDEV-27591 Connect tables (FIX/DOS) don't work with DESC keys - wrong results +--echo # +--error ER_UNKNOWN_ERROR +CREATE TABLE t1 ( + id INT, + f VARCHAR(32), + PRIMARY KEY (id DESC) +) ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='emp.txt'; + # # Clean up # diff --git a/storage/connect/mysql-test/connect/t/json.test b/storage/connect/mysql-test/connect/t/json.test index 8b42ef9cfab20..80306fc54801f 100644 --- a/storage/connect/mysql-test/connect/t/json.test +++ b/storage/connect/mysql-test/connect/t/json.test @@ -282,6 +282,30 @@ SELECT * FROM t1; SELECT * FROM t1 WHERE WEEK = 4; DROP TABLE t1, t2, t3, t4; + +--echo # +--echo # MDEV-29426 memory leak on "SHOW INDEX" +--echo # +CREATE TABLE t1 +( + ISBN CHAR(15) NOT NULL, + Language CHAR(2) JPATH='$.LANG', + Subject CHAR(32) JPATH='$.SUBJECT', + AuthorFN CHAR(128) JPATH='$.AUTHOR[*].FIRSTNAME', + AuthorLN CHAR(128) JPATH='$.AUTHOR[*].LASTNAME', + Title CHAR(32) JPATH='$.TITLE', + Translation CHAR(32) JPATH='$.TRANSLATED.PREFIX', + TranslatorFN CHAR(80) JPATH='$.TRANSLATED.TRANSLATOR.FIRSTNAME', + TranslatorLN CHAR(80) JPATH='$.TRANSLATED.TRANSLATOR.LASTNAME', + Publisher CHAR(20) JPATH='$.PUBLISHER.NAME', + Location CHAR(16) JPATH='$.PUBLISHER.PLACE', + Year int(4) JPATH='$.DATEPUB', + INDEX IX(ISBN) +) +ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='bib0.json' LRECL=320 OPTION_LIST='Pretty=0'; +SHOW INDEX FROM t1; +DROP TABLE t1; + # # Clean up # diff --git a/storage/connect/mysql-test/connect/t/misc.test b/storage/connect/mysql-test/connect/t/misc.test new file mode 100644 index 0000000000000..5cfe2a8fdbb09 --- /dev/null +++ b/storage/connect/mysql-test/connect/t/misc.test @@ -0,0 +1,142 @@ +--source have_libxml2.inc + +# Overlong table type +--error ER_UNKNOWN_ERROR +execute immediate concat('create table t engine=CONNECT table_type=JSON',REPEAT('1',5000), +' FILE_NAME=''users.json'' HTTP=''http://localhost:4142/'' URI=''/users'''); + +# Overlong subtype +--error ER_UNKNOWN_ERROR +execute immediate concat('create table t engine=CONNECT table_type=OEM module=''libname'' +Option_list=''Myopt=foo'' subtype=''MYTYPE',REPEAT('1', 10000), ''''); + + +# Overlong filename +--error ER_UNKNOWN_ERROR +execute immediate concat('create table t engine=CONNECT table_type=DBF file_name=''', + REPLACE(@@secure_file_priv,'\\','/'),'cust.dbf', REPEAT('1', 10000), ''''); + + +# Format string in SRCDEF +--replace_result $MASTER_MYPORT MASTER_MYPORT +eval create table t engine=connect table_type=mysql + CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/foobar' + SRCDEF='SELECT 1,''%n'' FROM DUAL WHERE %s'; +--error ER_GET_ERRMSG +select *from t; +drop table t; + +--replace_result $MASTER_MYPORT MASTER_MYPORT +--error ER_UNKNOWN_ERROR +eval create table t engine=connect table_type=mysql + CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/foobar' + SRCDEF='SELECT 1,%n FROM DUAL WHERE %s'; + +--replace_result $MASTER_MYPORT MASTER_MYPORT +eval create table t engine=connect table_type=mysql + CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/foobar' + SRCDEF='SELECT 1 FROM DUAL WHERE %s'; +select *from t; +drop table t; + +write_file $MYSQLTEST_VARDIR/tmp/beer.xml; + + + + + + + + + + + + + + +
NameOriginDescription
HuntsmanBath, UK
Wonderful hop, light alcohol
TuborgDanmark
In small bottles
+
+EOF + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +# Format string in colnode +eval create table beers ( +`Name` char(16) xpath='brandName', +`Origin` char(16) xpath='origin', +`Description` char(32) xpath='details') +engine=CONNECT table_type=XML file_name='$MYSQLTEST_VARDIR/tmp/beer.xml' +tabname='table' option_list='rownode=tr,colnode=td%n'; +select * from beers; +drop table beers; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval create table beers ( +`Name` char(16) xpath='brandName', +`Origin` char(16) xpath='origin', +`Description` char(32) xpath='details') +engine=CONNECT table_type=XML file_name='$MYSQLTEST_VARDIR/tmp/beer.xml' +tabname='table' option_list='rownode=tr,colnode=td'; +insert into beers values('11','22','33'); +drop table beers; + +remove_file $MYSQLTEST_VARDIR/tmp/beer.xml; + +write_file $MYSQLTEST_VARDIR/tmp/test.json; +[ + { + "ISBN": "9782212090819", + "LANG": "fr", + "SUBJECT": "applications", + "AUTHOR": [ + { + "FIRSTNAME": "Jean-Christophe", + "LASTNAME": "Bernadac" + }, + { + "FIRSTNAME": "François", + "LASTNAME": "Knab" + } + ], + "TITLE": "Construire une application XML", + "PUBLISHER": { + "NAME": "Eyrolles", + "PLACE": "Paris" + }, + "DATEPUB": 1999 + }, + { + "ISBN": "9782840825685", + "LANG": "fr", + "SUBJECT": "applications", + "AUTHOR": [ + { + "FIRSTNAME": "William J.", + "LASTNAME": "Pardi" + } + ], + "TITLE": "XML en Action", + "TRANSLATED": { + "PREFIX": "adapté de l'anglais par", + "TRANSLATOR": { + "FIRSTNAME": "James", + "LASTNAME": "Guerin" + } + }, + "PUBLISHER": { + "NAME": "Microsoft Press", + "PLACE": "Paris" + }, + "DATEPUB": 1999 + } +] +EOF + +execute immediate CONCAT('create table jsampall +(Author char(128) jpath=''$.AUTHOR["', REPEAT('a',10000),'"]'') +engine=CONNECT table_type=JSON +file_name=''',REPLACE(@@secure_file_priv,'\\','/'),'tmp/test.json'''); + +select author from jsampall; +drop table jsampall; +remove_file $MYSQLTEST_VARDIR/tmp/test.json; + diff --git a/storage/connect/mysql-test/connect/t/mysql.test b/storage/connect/mysql-test/connect/t/mysql.test index 7585c202b8bad..cd52f78fb302a 100644 --- a/storage/connect/mysql-test/connect/t/mysql.test +++ b/storage/connect/mysql-test/connect/t/mysql.test @@ -470,3 +470,84 @@ SELECT * FROM t2; DROP TABLE t2; DROP TABLE t1; + +--echo # +--echo # MDEV-27766 CONNECT Engine Support for INSERT IGNORE with Mysql Table type +--echo # + +CREATE TABLE t1 (a INT PRIMARY KEY); +INSERT INTO t1 VALUES (10),(20),(30); +--replace_result $PORT PORT +--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@localhost:$PORT/test/t1' OPTION_LIST="Delayed=1,Ignored=1" +INSERT INTO t2 VALUES (10),(20),(30),(40); +DROP TABLE t2; +DROP TABLE t1; + +--echo # +--echo # MDEV-28533 CONNECT engine does not quote columns involved in WHERE clause +--echo # + +CREATE TABLE t1 (id int, `spaced col` varchar(10),`nospace` varchar(10)); +insert into t1 values (1,1,'x1'),(2,'C-003','x2'); + +SELECT * from t1; + +--replace_result $PORT PORT +--eval CREATE TABLE t2 (id int, `spaced col` varchar(10), `nospace` varchar(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='test' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' + +SELECT * from t2; +SELECT `id` FROM t2 WHERE t2.`nospace` = 'x1'; +SELECT `id` FROM t2 WHERE t2.`spaced col` = 'C-003'; + + +DROP TABLE t1; +DROP TABLE t2; + +--echo # +--echo # MDEV-28489 / MDEV-26722 UTF8 bytes calculated incorrectly +--echo # + +CREATE TABLE t1 (name varchar(20)) CHARSET=utf8; +INSERT INTO t1 (name) VALUES ('Иванова'), ('Ivanova'); + +--replace_result $PORT PORT +--eval CREATE TABLE t2 (name varchar(1)) ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='test' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' CHARSET=utf8 + +SELECT hex(name) from t1; +# This will warn as we are truncating data +SELECT hex(name) from t2; + +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (col char(5)) CHARSET=utf8; +INSERT INTO t1 (col) VALUES ('glace'), ('glacé'); + +--replace_result $PORT PORT +--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='test' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' CHARSET=utf8 + +SELECT hex(col) from t1; +SELECT hex(col) from t2; + +DROP TABLE t2; +DROP TABLE t1; + + +--echo # +--echo # MDEV-29782 CONNECT engine converted YEAR to DATETIME, causing INSERT to fail +--echo # + +CREATE TABLE t1 (id year); + +--replace_result $PORT PORT +--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='test' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' + +INSERT INTO t2 VALUES (1999); +SELECT * FROM t2; + +DROP TABLE t2; +DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/storage/connect/mysql-test/connect/t/odbc_postgresql.sql b/storage/connect/mysql-test/connect/t/odbc_postgresql.sql index 1c302294393f5..9b22c69af1384 100644 --- a/storage/connect/mysql-test/connect/t/odbc_postgresql.sql +++ b/storage/connect/mysql-test/connect/t/odbc_postgresql.sql @@ -2,7 +2,7 @@ -- The SQL script to create PostgreSQL data for odbc_postgresql.test -- -- Run this script as a admin user: --- psql -U postgres < odbc_postgresql.sql +-- sudo -u postgres psql < storage/connect/mysql-test/connect/t/odbc_postgresql.sql SET NAMES 'UTF8'; @@ -11,7 +11,7 @@ DROP USER IF EXISTS mtr; CREATE USER mtr WITH PASSWORD 'mtr'; CREATE DATABASE mtr OWNER=mtr ENCODING='UTF8'; -GRANT ALL ON DATABASE mtr TO mtr; +GRANT ALL PRIVILEGES ON DATABASE mtr TO mtr; \c mtr SET role mtr; CREATE TABLE t1 (a INT NOT NULL); @@ -25,3 +25,8 @@ INSERT INTO schema1.t1 VALUES ('aaa'),('bbb'),('ccc'),('яяя'); CREATE VIEW schema1.v1 AS SELECT * FROM schema1.t1; CREATE TABLE schema1.t2 (a CHAR(10) NOT NULL); INSERT INTO schema1.t2 VALUES ('xxx'),('yyy'),('zzz'),('ÄÖÜ'); +CREATE TABLE schema1.t3 (a CHAR(10) NOT NULL, b CHAR(10) NOT NULL); +INSERT INTO schema1.t3 VALUES ('xxx', 'aaa'),('yyy', 'bbb'),('zzz', 'ccc'),('ÄÖÜ', 'яяя'); +CREATE TABLE schema1.space_in_column_name ("my space column" CHAR(20) NOT NULL); +INSERT INTO schema1.space_in_column_name VALUES ('My value'); +\dt schema1.* diff --git a/storage/connect/mysql-test/connect/t/odbc_postgresql.test b/storage/connect/mysql-test/connect/t/odbc_postgresql.test index 7fc1613071323..187bec55b38e8 100644 --- a/storage/connect/mysql-test/connect/t/odbc_postgresql.test +++ b/storage/connect/mysql-test/connect/t/odbc_postgresql.test @@ -5,10 +5,10 @@ # To configure your system to be able to run this test, # follow through the following steps: # -# 1. Install and configure PostgreSQL database to stat on the system startup +# 1. Install and configure PostgreSQL database to start on the system startup # # 2. Create user, database, schema and tables to be used by mtr: -# psql -U postgres < odbc_postgresql.sql +# sudo -u postgres psql < storage/connect/mysql-test/connect/t/odbc_postgresql.sql # # 3. Install PostgreSQL ODBC Driver. # - On CentOS, Fedora: @@ -18,18 +18,23 @@ # # 4. Create a data source with the name "ConnectEnginePostgresql" # - On Windows: use odbcadm.exe -# - On Linux: put these lines into /etc/odbc.ini +# - On Linux: put these lines into /etc/odbc.ini or in ~/.odbc.ini # #[ConnectEnginePostgresql] #Description=PostgreSQL DSN for ConnectSE -#Driver=PostgreSQL (should the path to the driver so file) +#Driver=PostgreSQL (should the path to the driver so file, on linux: /usr/lib/x86_64-linux-gnu/odbc/psqlodbca.so) #Database=mtr #Servername=localhost #Port=5432 # # 5. Allow user "mtr" to connect to the database "mtr" -# Add this line into the begginning of pg_hba.conf -# (usually /var/lib/pgsql/data/pg_hba.conf on Linux): +# Find `pg_hba.conf` file: +# Run `SHOW hba_file;` or `locate pg_hba.conf` to find right location +# (usually /var/lib/pgsql/data/pg_hba.conf or /etc/postgresql/[version]/main/pg_hba.conf on Linux) +# Add this line into the beginning of pg_hba.conf: +# For unix socket connection (connect with `psql -U mtr`) +#local mtr mtr password +# For TCP/IP connection (connect with `psql -U mtr -h 127.0.0.1`) #host mtr mtr 127.0.0.1/32 password # # 6. Restart the server: @@ -205,3 +210,25 @@ CREATE VIEW v1 AS SELECT * FROM t1; SELECT * FROM v1; DROP VIEW v1; DROP TABLE t1; + +# MDEV-25767 DELETE with WHERE condition crashes when two columns used for +# pkey +CREATE TABLE t1 (a VARCHAR(6), b VARCHAR(6), PRIMARY KEY(a, b)) ENGINE=CONNECT TABNAME='schema1.t3' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr'; +DELETE FROM t1 WHERE a='20'; +DROP TABLE t1; + +--echo # +--echo # MDEV-29687 ODBC tables do not quote identifier names correctly +--echo # +CREATE TABLE pg_in_maria ENGINE=CONNECT TABNAME='schema1.space_in_column_name' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' quoted=1; +SELECT * from pg_in_maria; +DROP TABLE pg_in_maria; + +--echo # +--echo # MDEV-29397 UPDATE with WHERE on part of two-part primary key causes +--echo # info to turn into error. +--echo # +CREATE TABLE t1 (a VARCHAR(6), b VARCHAR(6), PRIMARY KEY(a, b)) ENGINE=CONNECT TABNAME='schema1.t3' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr'; +UPDATE t1 SET a='10' WHERE a='20'; +DROP TABLE t1; + diff --git a/storage/connect/myutil.cpp b/storage/connect/myutil.cpp index c49db48bfb3ae..45b2c46e21724 100644 --- a/storage/connect/myutil.cpp +++ b/storage/connect/myutil.cpp @@ -183,6 +183,7 @@ int MYSQLtoPLG(int mytype, char *var) switch (mytype) { case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_YEAR: type = TYPE_SHORT; break; case MYSQL_TYPE_LONG: @@ -209,7 +210,6 @@ int MYSQLtoPLG(int mytype, char *var) case MYSQL_TYPE_TIMESTAMP: case MYSQL_TYPE_DATE: case MYSQL_TYPE_DATETIME: - case MYSQL_TYPE_YEAR: case MYSQL_TYPE_TIME: type = TYPE_DATE; break; diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp index 50069b7433bd1..0c5903baa7769 100644 --- a/storage/connect/odbconn.cpp +++ b/storage/connect/odbconn.cpp @@ -1000,6 +1000,11 @@ ODBConn::ODBConn(PGLOBAL g, TDBODBC *tdbp) m_Full = false; m_UseCnc = false; m_IDQuoteChar[0] = '"'; + if (tdbp) + { + if (tdbp->Quoted && tdbp->Quote) + m_IDQuoteChar[0] = *tdbp->Quote; + } m_IDQuoteChar[1] = 0; //*m_ErrMsg = '\0'; } // end of ODBConn @@ -1182,8 +1187,9 @@ int ODBConn::Open(PCSZ ConnectString, POPARM sop, DWORD options) // Verify support for required functionality and cache info // VerifyConnect(); Deprecated GetConnectInfo(); + // Still we want to use the set QChar } catch(DBX *xp) { - sprintf(g->Message, "%s: %s", xp->m_Msg, xp->GetErrorMessage(0)); + snprintf(g->Message, sizeof(g->Message), "%s: %s", xp->m_Msg, xp->GetErrorMessage(0)); Close(); // Free(); return -1; @@ -1422,7 +1428,7 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols) PGLOBAL& g = m_G; void *buffer; bool b; - UWORD n; + UWORD n, k; SWORD len, tp, ncol = 0; ODBCCOL *colp; RETCODE rc; @@ -1489,15 +1495,16 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols) } else { do { rc = SQLExecDirect(hstmt, (PUCHAR)sql, SQL_NTS); - } while (rc == SQL_STILL_EXECUTING); + } while (rc == SQL_STILL_EXECUTING); if (!Check(rc)) ThrowDBX(rc, "SQLExecDirect", hstmt); do { rc = SQLNumResultCols(hstmt, &ncol); - } while (rc == SQL_STILL_EXECUTING); + } while (rc == SQL_STILL_EXECUTING); + k = 0; // used for column number } // endif Srcdef for (n = 0, colp = tocols; colp; colp = (PODBCCOL)colp->GetNext()) @@ -1519,18 +1526,23 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols) sprintf(m_G->Message, MSG(INV_COLUMN_TYPE), colp->GetResultType(), SVP(colp->GetName())); ThrowDBX(m_G->Message); - } // endif tp + } // endif tp + + if (m_Tdb->Srcdef) + k = colp->GetIndex(); + else + k++; if (trace(1)) htrc("Binding col=%u type=%d buf=%p len=%d slen=%p\n", - n, tp, buffer, len, colp->GetStrLen()); + k, tp, buffer, len, colp->GetStrLen()); - rc = SQLBindCol(hstmt, colp->GetIndex(), tp, buffer, len, colp->GetStrLen()); + rc = SQLBindCol(hstmt, k, tp, buffer, len, colp->GetStrLen()); if (!Check(rc)) ThrowDBX(rc, "SQLBindCol", hstmt); - } // endif pcol + } // endif colp } catch(DBX *x) { if (trace(1)) @@ -1640,7 +1652,7 @@ int ODBConn::Fetch(int pos) for (int i = 0; i < MAX_NUM_OF_MSG && x->m_ErrMsg[i]; i++) htrc(x->m_ErrMsg[i]); - sprintf(g->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0)); + snprintf(g->Message, sizeof(g->Message), "%s: %s", x->m_Msg, x->GetErrorMessage(0)); irc = -1; } // end try/catch @@ -1676,7 +1688,7 @@ int ODBConn::PrepareSQL(char *sql) for (int i = 0; i < MAX_NUM_OF_MSG && x->m_ErrMsg[i]; i++) htrc(x->m_ErrMsg[i]); - sprintf(g->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0)); + snprintf(g->Message, sizeof(g->Message), "%s: %s", x->m_Msg, x->GetErrorMessage(0)); } // end try/catch } // endif Mode @@ -1722,7 +1734,7 @@ int ODBConn::PrepareSQL(char *sql) for (int i = 0; i < MAX_NUM_OF_MSG && x->m_ErrMsg[i]; i++) htrc(x->m_ErrMsg[i]); - sprintf(g->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0)); + snprintf(g->Message, sizeof(g->Message), "%s: %s", x->m_Msg, x->GetErrorMessage(0)); if (b) SQLCancel(hstmt); @@ -1922,7 +1934,7 @@ bool ODBConn::ExecSQLcommand(char *sql) for (int i = 0; i < MAX_NUM_OF_MSG && x->m_ErrMsg[i]; i++) htrc(x->m_ErrMsg[i]); - sprintf(g->Message, "Remote %s: %s", x->m_Msg, x->GetErrorMessage(0)); + snprintf(g->Message, sizeof(g->Message), "Remote %s: %s", x->m_Msg, x->GetErrorMessage(0)); if (b) SQLCancel(hstmt); @@ -1932,17 +1944,17 @@ bool ODBConn::ExecSQLcommand(char *sql) } // end try/catch if (!Check(rc = SQLFreeStmt(hstmt, SQL_CLOSE))) - sprintf(g->Message, "SQLFreeStmt: rc=%d", rc); + snprintf(g->Message, sizeof(g->Message), "SQLFreeStmt: rc=%d", rc); if (m_Transact) { // Terminate the transaction if (!Check(rc = SQLEndTran(SQL_HANDLE_DBC, m_hdbc, (rcd) ? SQL_ROLLBACK : SQL_COMMIT))) - sprintf(g->Message, "SQLEndTran: rc=%d", rc); + snprintf(g->Message, sizeof(g->Message), "SQLEndTran: rc=%d", rc); if (!Check(rc = SQLSetConnectAttr(m_hdbc, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER)SQL_AUTOCOMMIT_ON, SQL_IS_UINTEGER))) - sprintf(g->Message, "SQLSetConnectAttr: rc=%d", rc); + snprintf(g->Message, sizeof(g->Message), "SQLSetConnectAttr: rc=%d", rc); m_Transact = false; } // endif m_Transact @@ -2007,7 +2019,7 @@ PQRYRES ODBConn::GetMetaData(PGLOBAL g, PCSZ dsn, PCSZ src) } // endfor i } catch(DBX *x) { - sprintf(g->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0)); + snprintf(g->Message, sizeof(g->Message), "%s: %s", x->m_Msg, x->GetErrorMessage(0)); goto err; } // end try/catch @@ -2058,7 +2070,7 @@ PQRYRES ODBConn::GetMetaData(PGLOBAL g, PCSZ dsn, PCSZ src) } // endfor i } catch(DBX *x) { - sprintf(g->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0)); + snprintf(g->Message, sizeof(g->Message), "%s: %s", x->m_Msg, x->GetErrorMessage(0)); qrp = NULL; } // end try/catch @@ -2368,7 +2380,7 @@ int ODBConn::GetCatInfo(CATPARM *cap) // Now bind the column buffers for (n = 0, crp = qrp->Colresp; crp; crp = crp->Next) { if ((tp = GetSQLCType(crp->Type)) == SQL_TYPE_NULL) { - sprintf(g->Message, MSG(INV_COLUMN_TYPE), crp->Type, crp->Name); + snprintf(g->Message, sizeof(g->Message), MSG(INV_COLUMN_TYPE), crp->Type, crp->Name); ThrowDBX(g->Message); } // endif tp @@ -2454,9 +2466,9 @@ int ODBConn::GetCatInfo(CATPARM *cap) if (rc == SQL_NO_DATA_FOUND) { if (cap->Pat) - sprintf(g->Message, MSG(NO_TABCOL_DATA), cap->Tab, cap->Pat); + snprintf(g->Message, sizeof(g->Message), MSG(NO_TABCOL_DATA), cap->Tab, cap->Pat); else - sprintf(g->Message, MSG(NO_TAB_DATA), cap->Tab); + snprintf(g->Message, sizeof(g->Message), MSG(NO_TAB_DATA), cap->Tab); ThrowDBX(g->Message); } else if (rc == SQL_SUCCESS) { @@ -2481,7 +2493,7 @@ int ODBConn::GetCatInfo(CATPARM *cap) for (int i = 0; i < MAX_NUM_OF_MSG && x->m_ErrMsg[i]; i++) htrc(x->m_ErrMsg[i]); - sprintf(g->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0)); + snprintf(g->Message, sizeof(g->Message), "%s: %s", x->m_Msg, x->GetErrorMessage(0)); irc = -1; } // end try/catch @@ -2543,7 +2555,7 @@ PQRYRES ODBConn::AllocateResult(PGLOBAL g) if (!(crp->Kdata = AllocValBlock(g, NULL, crp->Type, m_Rows, crp->Clen, 0, FALSE, TRUE, uns))) { - sprintf(g->Message, MSG(INV_RESULT_TYPE), + snprintf(g->Message, sizeof(g->Message), MSG(INV_RESULT_TYPE), GetFormatType(crp->Type)); return NULL; } // endif Kdata @@ -2571,7 +2583,7 @@ int ODBConn::Rewind(char *sql, ODBCCOL *tocols) int rc, rbuf = -1; if (!m_hstmt) - rbuf = -1; + rbuf = 0; else if (m_Full) rbuf = m_Rows; // No need to "rewind" else if (m_Scrollable) { diff --git a/storage/connect/plgdbsem.h b/storage/connect/plgdbsem.h index 370bf69ffa060..4371f90a21d54 100644 --- a/storage/connect/plgdbsem.h +++ b/storage/connect/plgdbsem.h @@ -14,11 +14,7 @@ /***********************************************************************/ /* DB Constant definitions. */ /***********************************************************************/ -#if defined(FRENCH) -#define DEFAULT_LOCALE "French" -#else // !FRENCH #define DEFAULT_LOCALE "English" -#endif // !FRENCH #define DOS_MAX_PATH 144 /* Must be the same across systems */ #define DOS_BUFF_LEN 100 /* Number of lines in binary file buffer */ diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp index 55c7b8110fdf7..0f075a67876fe 100644 --- a/storage/connect/plgdbutl.cpp +++ b/storage/connect/plgdbutl.cpp @@ -313,7 +313,7 @@ PDBUSER PlgMakeUser(PGLOBAL g) PDBUSER dbuserp; if (!(dbuserp = (PDBUSER)malloc(sizeof(DBUSERBLK)))) { - sprintf(g->Message, MSG(MALLOC_ERROR), "PlgMakeUser"); + snprintf(g->Message, sizeof(g->Message), MSG(MALLOC_ERROR), "PlgMakeUser"); return NULL; } // endif dbuserp @@ -416,7 +416,7 @@ char *ExtractFromPath(PGLOBAL g, char *pBuff, char *FileName, OPVAL op) case OP_FNAME: fname = pBuff; break; case OP_FTYPE: ftype = pBuff; break; default: - sprintf(g->Message, MSG(INVALID_OPER), op, "ExtractFromPath"); + snprintf(g->Message, sizeof(g->Message), MSG(INVALID_OPER), op, "ExtractFromPath"); return NULL; } // endswitch op @@ -1399,7 +1399,7 @@ void *PlgDBSubAlloc(PGLOBAL g, void *memp, size_t size) memp, size, pph->To_Free, pph->FreeBlk); if (size > pph->FreeBlk) { /* Not enough memory left in pool */ - sprintf(g->Message, + snprintf(g->Message, sizeof(g->Message), "Not enough memory in Work area for request of %zd (used=%zd free=%zd)", size, pph->To_Free, pph->FreeBlk); @@ -1530,7 +1530,7 @@ DllExport void NewPointer(PTABS t, void *oldv, void *newv) if (!(tp = new TABPTR)) { PGLOBAL g = t->G; - sprintf(g->Message, "NewPointer: %s", MSG(MEM_ALLOC_ERROR)); + snprintf(g->Message, sizeof(g->Message), "NewPointer: %s", MSG(MEM_ALLOC_ERROR)); throw 3; } else { tp->Next = t->P1; @@ -1565,7 +1565,7 @@ int FileComp(PGLOBAL g, char *file1, char *file2) if (h[i] == -1) { // if (errno != ENOENT) { - sprintf(g->Message, MSG(OPEN_MODE_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR), "rb", (int)errno, fn[i]); strcat(strcat(g->Message, ": "), strerror(errno)); throw 666; @@ -1574,7 +1574,7 @@ int FileComp(PGLOBAL g, char *file1, char *file2) } else { if ((len[i] = _filelength(h[i])) < 0) { - sprintf(g->Message, MSG(FILELEN_ERROR), "_filelength", fn[i]); + snprintf(g->Message, sizeof(g->Message), MSG(FILELEN_ERROR), "_filelength", fn[i]); throw 666; } // endif len @@ -1588,7 +1588,7 @@ int FileComp(PGLOBAL g, char *file1, char *file2) while (rc == -1) { for (i = 0; i < 2; i++) if ((n[i] = read(h[i], bp[i], 4096)) < 0) { - sprintf(g->Message, MSG(READ_ERROR), fn[i], strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), fn[i], strerror(errno)); goto fin; } // endif n diff --git a/storage/connect/plgxml.cpp b/storage/connect/plgxml.cpp index 8c5cc261899f3..d78ba120ebc0b 100644 --- a/storage/connect/plgxml.cpp +++ b/storage/connect/plgxml.cpp @@ -52,7 +52,7 @@ bool XMLDOCUMENT::InitZip(PGLOBAL g, PCSZ entry) zip = new(g) UNZIPUTL(entry, NULL, mul); return zip == NULL; #else // !ZIP_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "ZIP"); return true; #endif // !ZIP_SUPPORT } // end of InitZip diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp index a63eee75c1bc0..6fb40c92a1b04 100644 --- a/storage/connect/plugutil.cpp +++ b/storage/connect/plugutil.cpp @@ -259,6 +259,12 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath) if (trace(2)) htrc("prefix=%-.256s fn=%-.256s path=%-.256s\n", prefix, FileName, defpath); + if (strlen(FileName) >= _MAX_PATH) + { + *pBuff= 0; /* Hope this is treated as error of some kind*/ + return FileName; + } + if (!strncmp(FileName, "//", 2) || !strncmp(FileName, "\\\\", 2)) { strcpy(pBuff, FileName); // Remote file return pBuff; @@ -365,13 +371,13 @@ char *PlugReadMessage(PGLOBAL g, int mid, char *m) PlugSetPath(msgfile, NULL, buff, msg_path); if (!(mfile = fopen(msgfile, "rt"))) { - sprintf(stmsg, "Fail to open message file %-.256s", msgfile); + snprintf(stmsg, sizeof(stmsg), "Fail to open message file %s", msgfile); goto err; } // endif mfile for (;;) if (!fgets(buff, 256, mfile)) { - sprintf(stmsg, "Cannot get message %d %-.256s", mid, SVP(m)); + snprintf(stmsg, sizeof(stmsg), "Cannot get message %d %s", mid, SVP(m)); goto fin; } else if (atoi(buff) == mid) @@ -380,7 +386,7 @@ char *PlugReadMessage(PGLOBAL g, int mid, char *m) if (sscanf(buff, " %*d %.31s \"%.255[^\"]", msgid, stmsg) < 2) { // Old message file if (!sscanf(buff, " %*d \"%.255[^\"]", stmsg)) { - sprintf(stmsg, "Bad message file for %d %-.256s", mid, SVP(m)); + snprintf(stmsg, sizeof(stmsg), "Bad message file for %d %s", mid, SVP(m)); goto fin; } else m = NULL; @@ -419,17 +425,18 @@ char *PlugGetMessage(PGLOBAL g, int mid) if (n == 0) { DWORD rc = GetLastError(); - msg = (char*)PlugSubAlloc(g, NULL, 512); // Extend buf allocation - n = sprintf(msg, "Message %d, rc=%d: ", mid, rc); + const int BUF_SIZE= 512; + msg = (char*)PlugSubAlloc(g, NULL, BUF_SIZE); // Extend buf allocation + n = snprintf(msg, BUF_SIZE, "Message %d, rc=%d: ", mid, rc); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, - (LPTSTR)(msg + n), 512 - n, NULL); + (LPTSTR)(msg + n), BUF_SIZE - n, NULL); return msg; } // endif n #else // ALL if (!GetRcString(mid, stmsg, 200)) - sprintf(stmsg, "Message %d not found", mid); + snprintf(stmsg, sizeof(stmsg) "Message %d not found", mid); #endif // ALL if (g) { @@ -472,7 +479,7 @@ bool AllocSarea(PGLOBAL g, size_t size) g->Sarea = malloc(size); if (!g->Sarea) { - sprintf(g->Message, MSG(MALLOC_ERROR), "malloc"); + snprintf(g->Message, sizeof(g->Message), MSG(MALLOC_ERROR), "malloc"); g->Sarea_Size = 0; } else { g->Sarea_Size = size; @@ -558,7 +565,7 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size) /*******************************************************************/ memp = g->Sarea; - size = ((size + 7) / 8) * 8; /* Round up size to multiple of 8 */ + size = ROUNDUP_TO_8(size); /* Round up size to multiple of 8 */ pph = (PPOOLHEADER)memp; if (trace(16)) @@ -568,7 +575,7 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size) if (size > pph->FreeBlk) { /* Not enough memory left in pool */ PCSZ pname = "Work"; - sprintf(g->Message, + snprintf(g->Message, sizeof(g->Message), "Not enough memory in %-.256s area for request of %zu (used=%zu free=%zu)", pname, size, pph->To_Free, pph->FreeBlk); diff --git a/storage/connect/rcmsg.c b/storage/connect/rcmsg.c index 4cd443d88bb2b..e2fd08ba8661a 100644 --- a/storage/connect/rcmsg.c +++ b/storage/connect/rcmsg.c @@ -32,17 +32,6 @@ const char *GetMsgid(int id) const char *p = NULL; // This conditional until a real fix is found for MDEV-7304 -#if defined(FRENCH) - if (!stricmp(msglang(), "french")) - switch (id) { -#include "frids.h" -#if defined(NEWMSG) -#include "frcas.h" -#endif // NEWMSG - } // endswitch(id) - - else // English -#endif // FRENCH switch (id) { #include "enids.h" #if defined(NEWMSG) diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp index 954c6b675491e..9af9faa333a3b 100644 --- a/storage/connect/reldef.cpp +++ b/storage/connect/reldef.cpp @@ -91,9 +91,14 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char* tab, char* db, bool info) /* directories are used (to make this even remotely secure). */ /*********************************************************************/ if (check_valid_path(module, strlen(module))) { - strcpy(g->Message, "Module cannot contain a path"); + safe_strcpy(g->Message, sizeof(g->Message), "Module cannot contain a path"); return NULL; - } else + } + else if (strlen(subtype)+1+3 >= sizeof(getname)) { + safe_strcpy(g->Message, sizeof(g->Message), "Subtype string too long"); + return NULL; + } + else PlugSetPath(soname, module, GetPluginDir()); // The exported name is always in uppercase @@ -109,17 +114,18 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char* tab, char* db, bool info) char buf[256]; DWORD rc = GetLastError(); - sprintf(g->Message, MSG(DLL_LOAD_ERROR), rc, soname); + snprintf(g->Message, sizeof(g->Message), MSG(DLL_LOAD_ERROR), rc, soname); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)buf, sizeof(buf), NULL); - strcat(strcat(g->Message, ": "), buf); + safe_strcat(g->Message, sizeof(g->Message), ": "); + safe_strcat(g->Message, sizeof(g->Message), buf); return NULL; } // endif hDll // Get the function returning an instance of the external DEF class if (!(coldef = (XCOLDEF)GetProcAddress((HINSTANCE)hdll, getname))) { - sprintf(g->Message, MSG(PROCADD_ERROR), GetLastError(), getname); + snprintf(g->Message, sizeof(g->Message), MSG(PROCADD_ERROR), GetLastError(), getname); FreeLibrary((HMODULE)hdll); return NULL; } // endif coldef @@ -129,21 +135,21 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char* tab, char* db, bool info) // Load the desired shared library if (!(hdll = dlopen(soname, RTLD_LAZY))) { error = dlerror(); - sprintf(g->Message, MSG(SHARED_LIB_ERR), soname, SVP(error)); + snprintf(g->Message, sizeof(g->Message), MSG(SHARED_LIB_ERR), soname, SVP(error)); return NULL; } // endif Hdll // Get the function returning an instance of the external DEF class if (!(coldef = (XCOLDEF)dlsym(hdll, getname))) { error = dlerror(); - sprintf(g->Message, MSG(GET_FUNC_ERR), getname, SVP(error)); + snprintf(g->Message, sizeof(g->Message), MSG(GET_FUNC_ERR), getname, SVP(error)); dlclose(hdll); return NULL; } // endif coldef #endif // !_WIN32 // Just in case the external Get function does not set error messages - sprintf(g->Message, "Error getting column info from %s", subtype); + snprintf(g->Message, sizeof(g->Message), "Error getting column info from %s", subtype); // Get the table column definition qrp = coldef(g, topt, tab, db, info); @@ -276,7 +282,7 @@ char *RELDEF::GetStringCatInfo(PGLOBAL g, PCSZ what, PCSZ sdef) if (IsFileType(GetTypeID(ftype))) { name= Hc->GetPartName(); sval= (char*)PlugSubAlloc(g, NULL, strlen(name) + 12); - strcat(strcpy(sval, name), "."); + snprintf(sval, strlen(name) + 12, "%s.", name); n= strlen(sval); // Fold ftype to lower case @@ -515,7 +521,7 @@ int TABDEF::GetColCatInfo(PGLOBAL g) case 'T': nof = sizeof(char); break; case 'G': nof = sizeof(longlong); break; default: /* Wrong format */ - sprintf(g->Message, "Invalid format %c", fty); + snprintf(g->Message, sizeof(g->Message), "Invalid format %c", fty); return -1; } // endswitch fty @@ -618,12 +624,11 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) /* directories are used (to make this even remotely secure). */ /*********************************************************************/ if (check_valid_path(Module, strlen(Module))) { - strcpy(g->Message, "Module cannot contain a path"); + safe_strcpy(g->Message, sizeof(g->Message), "Module cannot contain a path"); return NULL; } else // PlugSetPath(soname, Module, GetPluginDir()); // Crashes on Fedora - strncat(strcpy(soname, GetPluginDir()), Module, - sizeof(soname) - strlen(soname) - 1); + snprintf(soname, sizeof(soname), "%s%s", GetPluginDir(), Module); #if defined(_WIN32) // Is the DLL already loaded? @@ -633,11 +638,12 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) char buf[256]; DWORD rc = GetLastError(); - sprintf(g->Message, MSG(DLL_LOAD_ERROR), rc, soname); + snprintf(g->Message, sizeof(g->Message), MSG(DLL_LOAD_ERROR), rc, soname); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)buf, sizeof(buf), NULL); - strcat(strcat(g->Message, ": "), buf); + safe_strcat(g->Message, sizeof(g->Message), ": "); + safe_strcat(g->Message, sizeof(g->Message), buf); return NULL; } // endif hDll @@ -653,11 +659,12 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) char buf[256]; DWORD rc = GetLastError(); - sprintf(g->Message, MSG(PROCADD_ERROR), rc, getname); + snprintf(g->Message, sizeof(g->Message), MSG(PROCADD_ERROR), rc, getname); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)buf, sizeof(buf), NULL); - strcat(strcat(g->Message, ": "), buf); + safe_strcat(g->Message, sizeof(g->Message), ": "); + safe_strcat(g->Message, sizeof(g->Message), buf); FreeLibrary((HMODULE)Hdll); return NULL; } // endif getdef @@ -671,13 +678,13 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) if (dladdr(&connect_hton, &dl_info)) { if (dlopen(dl_info.dli_fname, RTLD_NOLOAD | RTLD_NOW | RTLD_GLOBAL) == 0) { error = dlerror(); - sprintf(g->Message, "dlopen failed: %s, OEM not supported", SVP(error)); + snprintf(g->Message, sizeof(g->Message), "dlopen failed: %s, OEM not supported", SVP(error)); return NULL; } // endif dlopen } else { error = dlerror(); - sprintf(g->Message, "dladdr failed: %s, OEM not supported", SVP(error)); + snprintf(g->Message, sizeof(g->Message), "dladdr failed: %s, OEM not supported", SVP(error)); return NULL; } // endif dladdr #endif // 0 @@ -685,7 +692,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) // Load the desired shared library if (!Hdll && !(Hdll = dlopen(soname, RTLD_LAZY))) { error = dlerror(); - sprintf(g->Message, MSG(SHARED_LIB_ERR), soname, SVP(error)); + snprintf(g->Message, sizeof(g->Message), MSG(SHARED_LIB_ERR), soname, SVP(error)); return NULL; } // endif Hdll @@ -699,14 +706,14 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) // Get the function returning an instance of the external DEF class if (!(getdef = (XGETDEF)dlsym(Hdll, getname))) { error = dlerror(); - sprintf(g->Message, MSG(GET_FUNC_ERR), getname, SVP(error)); + snprintf(g->Message, sizeof(g->Message), MSG(GET_FUNC_ERR), getname, SVP(error)); dlclose(Hdll); return NULL; } // endif getdef #endif // !_WIN32 // Just in case the external Get function does not set error messages - sprintf(g->Message, MSG(DEF_ALLOC_ERROR), Subtype); + snprintf(g->Message, sizeof(g->Message), MSG(DEF_ALLOC_ERROR), Subtype); // Get the table definition block if (!(xdefp = getdef(g, NULL))) @@ -806,7 +813,7 @@ PTDB OEMDEF::GetTable(PGLOBAL g, MODE mode) else txfp = new(g) ZLBFAM(defp); #else // !GZ_SUPPORT - strcpy(g->Message, "Compress not supported"); + safe_strcpy(g->Message, sizeof(g->Message), "Compress not supported"); return NULL; #endif // !GZ_SUPPORT } else if (rfm == RECFM_VAR) { @@ -829,7 +836,7 @@ PTDB OEMDEF::GetTable(PGLOBAL g, MODE mode) else txfp = new(g) VCTFAM((PVCTDEF)defp); #else // !VCT_SUPPORT - strcpy(g->Message, "VCT no more supported"); + safe_strcpy(g->Message, sizeof(g->Message), "VCT no more supported"); return NULL; #endif // !VCT_SUPPORT } // endif's @@ -916,11 +923,11 @@ int COLDEF::Define(PGLOBAL g, void *, PCOLINFO cfp, int poff) Buf_Type = cfp->Type; if ((Clen = GetTypeSize(Buf_Type, cfp->Length)) < 0) { - sprintf(g->Message, MSG(BAD_COL_TYPE), GetTypeName(Buf_Type), Name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_COL_TYPE), GetTypeName(Buf_Type), Name); return -1; } // endswitch - strcpy(F.Type, GetFormatType(Buf_Type)); + safe_strcpy(F.Type, sizeof(F.Type), GetFormatType(Buf_Type)); F.Length = cfp->Length; F.Prec = cfp->Scale; Offset = (cfp->Offset < 0) ? poff : cfp->Offset; diff --git a/storage/connect/tabbson.cpp b/storage/connect/tabbson.cpp index 871a54c8c94fb..dfaf2284a72eb 100644 --- a/storage/connect/tabbson.cpp +++ b/storage/connect/tabbson.cpp @@ -39,6 +39,7 @@ #include "checklvl.h" #include "resource.h" #include "mycat.h" // for FNC_COL +#include "m_string.h" /***********************************************************************/ /* This should be an option. */ @@ -80,7 +81,7 @@ PQRYRES BSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info) } // endif info if (GetIntegerTableOption(g, topt, "Multiple", 0)) { - strcpy(g->Message, "Cannot find column definition for multiple table"); + safe_strcpy(g->Message, sizeof(g->Message), "Cannot find column definition for multiple table"); return NULL; } // endif Multiple @@ -206,7 +207,7 @@ int BSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) tdp->Uri = (dsn && *dsn ? dsn : NULL); if (!tdp->Fn && !tdp->Uri) { - strcpy(g->Message, MSG(MISSING_FNAME)); + safe_strcpy(g->Message, sizeof(g->Message), MSG(MISSING_FNAME)); return 0; } else topt->subtype = NULL; @@ -233,7 +234,7 @@ int BSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) (tdp->Version == 2) ? "Mongo2Interface" : "Mongo3Interface"); tdp->Pretty = 0; #else // !MONGO_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "MONGO"); return 0; #endif // !MONGO_SUPPORT } // endif Uri @@ -245,7 +246,7 @@ int BSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) #if defined(ZIP_SUPPORT) tjsp = new(g) TDBBSON(g, tdp, new(g) UNZFAM(tdp)); #else // !ZIP_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "ZIP"); return 0; #endif // !ZIP_SUPPORT } else @@ -261,7 +262,7 @@ int BSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) } else { if (!((tdp->Lrecl = GetIntegerTableOption(g, topt, "Lrecl", 0)))) { if (!mgo) { - sprintf(g->Message, "LRECL must be specified for pretty=%d", tdp->Pretty); + snprintf(g->Message, sizeof(g->Message), "LRECL must be specified for pretty=%d", tdp->Pretty); return 0; } else tdp->Lrecl = 8192; // Should be enough @@ -276,7 +277,7 @@ int BSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) #if defined(ZIP_SUPPORT) tjnp = new(g)TDBBSN(g, tdp, new(g) UNZFAM(tdp)); #else // !ZIP_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "ZIP"); return NULL; #endif // !ZIP_SUPPORT } else if (tdp->Uri) { @@ -284,14 +285,14 @@ int BSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) #if defined(CMGO_SUPPORT) tjnp = new(g) TDBBSN(g, tdp, new(g) CMGFAM(tdp)); #else - sprintf(g->Message, "Mongo %s Driver not available", "C"); + snprintf(g->Message, sizeof(g->Message), "Mongo %s Driver not available", "C"); return 0; #endif } else if (tdp->Driver && toupper(*tdp->Driver) == 'J') { #if defined(JAVA_SUPPORT) tjnp = new(g) TDBBSN(g, tdp, new(g) JMGFAM(tdp)); #else - sprintf(g->Message, "Mongo %s Driver not available", "Java"); + snprintf(g->Message, sizeof(g->Message), "Mongo %s Driver not available", "Java"); return 0; #endif } else { // Driver not specified @@ -300,7 +301,7 @@ int BSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) #elif defined(JAVA_SUPPORT) tjnp = new(g) TDBBSN(g, tdp, new(g) JMGFAM(tdp)); #else - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "MONGO"); return 0; #endif } // endif Driver @@ -318,7 +319,7 @@ int BSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) switch (tjnp->ReadDB(g)) { case RC_EF: - strcpy(g->Message, "Void json table"); + safe_strcpy(g->Message, sizeof(g->Message), "Void json table"); case RC_FX: goto err; default: @@ -328,7 +329,7 @@ int BSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) } // endif pretty if (!(row = (jsp) ? bp->GetObject(jsp) : NULL)) { - strcpy(g->Message, "Can only retrieve columns from object rows"); + safe_strcpy(g->Message, sizeof(g->Message), "Can only retrieve columns from object rows"); goto err; } // endif row @@ -405,7 +406,7 @@ bool BSONDISC::Find(PGLOBAL g, PBVAL jvp, PCSZ key, int j) if (jvp && !bp->IsJson(jvp)) { if (JsonAllPath() && !fmt[bf]) - strcat(fmt, colname); + safe_strcat(fmt, sizeof(fmt), colname); jcol.Type = (JTYP)jvp->Type; @@ -439,7 +440,7 @@ bool BSONDISC::Find(PGLOBAL g, PBVAL jvp, PCSZ key, int j) jcol.Cbn = true; } else if (j < lvl && !Stringified(strfy, colname)) { if (!fmt[bf]) - strcat(fmt, colname); + safe_strcat(fmt, sizeof(fmt), colname); p = fmt + strlen(fmt); jsp = jvp; @@ -477,7 +478,7 @@ bool BSONDISC::Find(PGLOBAL g, PBVAL jvp, PCSZ key, int j) n = sizeof(fmt) - (strlen(fmt) + 1); if (!tdp->Xcol || stricmp(tdp->Xcol, key)) { - sprintf(buf, "%d", k); + snprintf(buf, sizeof(buf), "%d", k); if (tdp->Uri) { strncat(strncat(fmt, sep, n), buf, n - strlen(sep)); @@ -503,18 +504,18 @@ bool BSONDISC::Find(PGLOBAL g, PBVAL jvp, PCSZ key, int j) return false; default: - sprintf(g->Message, "Logical error after %s", fmt); + snprintf(g->Message, sizeof(g->Message), "Logical error after %s", fmt); return true; } // endswitch Type } else if (lvl >= 0) { if (Stringified(strfy, colname)) { if (!fmt[bf]) - strcat(fmt, colname); + safe_strcat(fmt, sizeof(fmt), colname); - strcat(fmt, ".*"); + safe_strcat(fmt, sizeof(fmt), ".*"); } else if (JsonAllPath() && !fmt[bf]) - strcat(fmt, colname); + safe_strcat(fmt, sizeof(fmt), colname); jcol.Type = TYPE_STRG; jcol.Len = sz; @@ -626,7 +627,7 @@ PBVAL BTUTIL::FindRow(PGLOBAL g) } else { if (bp || *objpath == '[') { // Old style if (objpath[strlen(objpath) - 1] != ']') { - sprintf(g->Message, "Invalid Table path %s", Tp->Objname); + snprintf(g->Message, sizeof(g->Message), "Invalid Table path %s", Tp->Objname); return NULL; } else if (!bp) objpath++; @@ -706,7 +707,7 @@ PBVAL BTUTIL::MakeTopTree(PGLOBAL g, int type) if (bp || *objpath == '[') { // Old style if (objpath[strlen(objpath) - 1] != ']') { - sprintf(g->Message, "Invalid Table path %s", Tp->Objname); + snprintf(g->Message, sizeof(g->Message), "Invalid Table path %s", Tp->Objname); return NULL; } else if (!bp) objpath++; @@ -798,7 +799,7 @@ void BCUTIL::SetJsonValue(PGLOBAL g, PVAL vp, PBVAL jvp) break; default: - sprintf(G->Message, "Unsupported column type %d", vp->GetType()); + snprintf(G->Message, sizeof(G->Message), "Unsupported column type %d", vp->GetType()); throw 888; } // endswitch Type @@ -918,7 +919,7 @@ PBVAL BCUTIL::GetRowValue(PGLOBAL g, PBVAL row, int i) bvp = row; break; default: - sprintf(g->Message, "Invalid row JSON type %d", row->Type); + snprintf(g->Message, sizeof(g->Message), "Invalid row JSON type %d", row->Type); bvp = NULL; } // endswitch Type @@ -961,7 +962,7 @@ PVAL BCUTIL::ExpandArray(PGLOBAL g, PBVAL arp, int n) } // endif ars if (!(bvp = GetArrayValue(arp, (nodes[n].Rx = nodes[n].Nx)))) { - strcpy(g->Message, "Logical error expanding array"); + safe_strcpy(g->Message, sizeof(g->Message), "Logical error expanding array"); throw 666; } // endif jvp @@ -1122,7 +1123,7 @@ PBVAL BCUTIL::GetRow(PGLOBAL g) val = row; break; default: - sprintf(g->Message, "Invalid row JSON type %d", row->Type); + snprintf(g->Message, sizeof(g->Message), "Invalid row JSON type %d", row->Type); val = NULL; } // endswitch Type @@ -1146,7 +1147,7 @@ PBVAL BCUTIL::GetRow(PGLOBAL g) } else if (row->Type == TYPE_JAR) { AddArrayValue(row, (nwr = NewVal(type))); } else { - strcpy(g->Message, "Wrong type when writing new row"); + safe_strcpy(g->Message, sizeof(g->Message), "Wrong type when writing new row"); nwr = NULL; } // endif's @@ -1222,7 +1223,7 @@ bool BSONDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) Wrapname = GetStringCatInfo(g, "Wrapper", "Mongo3Interface"); #endif // JAVA_SUPPORT #else // !MONGO_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "MONGO"); return true; #endif // !MONGO_SUPPORT } // endif Uri @@ -1255,7 +1256,7 @@ PTDB BSONDEF::GetTable(PGLOBAL g, MODE m) // Allocate the parse work memory G = PlugInit(NULL, (size_t)Lrecl * (Pretty < 0 ? 3 : 5)); } else { - strcpy(g->Message, "LRECL is not defined"); + safe_strcpy(g->Message, sizeof(g->Message), "LRECL is not defined"); return NULL; } // endif Lrecl @@ -1266,14 +1267,14 @@ PTDB BSONDEF::GetTable(PGLOBAL g, MODE m) #if defined(CMGO_SUPPORT) txfp = new(g) CMGFAM(this); #else - sprintf(g->Message, "Mongo %s Driver not available", "C"); + snprintf(g->Message, sizeof(g->Message), "Mongo %s Driver not available", "C"); return NULL; #endif } else if (Driver && toupper(*Driver) == 'J') { #if defined(JAVA_SUPPORT) txfp = new(g) JMGFAM(this); #else - sprintf(g->Message, "Mongo %s Driver not available", "Java"); + snprintf(g->Message, sizeof(g->Message), "Mongo %s Driver not available", "Java"); return NULL; #endif } else { // Driver not specified @@ -1282,7 +1283,7 @@ PTDB BSONDEF::GetTable(PGLOBAL g, MODE m) #elif defined(JAVA_SUPPORT) txfp = new(g) JMGFAM(this); #else // !MONGO_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "MONGO"); return NULL; #endif // !MONGO_SUPPORT } // endif Driver @@ -1295,11 +1296,11 @@ PTDB BSONDEF::GetTable(PGLOBAL g, MODE m) } else if (m == MODE_INSERT) { txfp = new(g) ZIPFAM(this); } else { - strcpy(g->Message, "UPDATE/DELETE not supported for ZIP"); + safe_strcpy(g->Message, sizeof(g->Message), "UPDATE/DELETE not supported for ZIP"); return NULL; } // endif's m #else // !ZIP_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "ZIP"); return NULL; #endif // !ZIP_SUPPORT } else if (Compressed) { @@ -1309,7 +1310,7 @@ PTDB BSONDEF::GetTable(PGLOBAL g, MODE m) else txfp = new(g) ZLBFAM(this); #else // !GZ_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "GZ"); return NULL; #endif // !GZ_SUPPORT } else if (map) { @@ -1325,14 +1326,14 @@ PTDB BSONDEF::GetTable(PGLOBAL g, MODE m) if (m == MODE_READ || m == MODE_ANY || m == MODE_ALTER) { txfp = new(g) UNZFAM(this); } else if (m == MODE_INSERT) { - strcpy(g->Message, "INSERT supported only for zipped JSON when pretty=0"); + safe_strcpy(g->Message, sizeof(g->Message), "INSERT supported only for zipped JSON when pretty=0"); return NULL; } else { - strcpy(g->Message, "UPDATE/DELETE not supported for ZIP"); + safe_strcpy(g->Message, sizeof(g->Message), "UPDATE/DELETE not supported for ZIP"); return NULL; } // endif's m #else // !ZIP_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "ZIP"); return NULL; #endif // !ZIP_SUPPORT } else @@ -1554,7 +1555,7 @@ bool TDBBSN::OpenDB(PGLOBAL g) case MODE_ARRAY: type = TYPE_JAR; break; case MODE_VALUE: type = TYPE_JVAL; break; default: - sprintf(g->Message, "Invalid Jmode %d", Jmode); + snprintf(g->Message, sizeof(g->Message), "Invalid Jmode %d", Jmode); return true; } // endswitch Jmode @@ -1661,8 +1662,8 @@ bool TDBBSN::PrepareWriting(PGLOBAL g) strcat(s, ","); if ((signed)strlen(s) > Lrecl) { - strncpy(To_Line, s, Lrecl); - sprintf(g->Message, "Line truncated (lrecl=%d)", Lrecl); + safe_strcpy(To_Line, Lrecl, s); + snprintf(g->Message, sizeof(g->Message), "Line truncated (lrecl=%d)", Lrecl); return PushWarning(g, this); } else strcpy(To_Line, s); @@ -1764,7 +1765,7 @@ bool BSONCOL::CheckExpand(PGLOBAL g, int i, PSZ nm, bool b) Xpd = true; // Expandable object Nodes[i].Op = OP_EXP; } else if (b) { - strcpy(g->Message, "Cannot expand more than one branch"); + safe_strcpy(g->Message, sizeof(g->Message), "Cannot expand more than one branch"); return true; } // endif Xcol @@ -1788,7 +1789,7 @@ bool BSONCOL::SetArrayOptions(PGLOBAL g, char* p, int i, PSZ nm) p[--n] = 0; } else if (!IsNum(p)) { // Wrong array specification - sprintf(g->Message, "Invalid array specification %s for %s", p, Name); + snprintf(g->Message, sizeof(g->Message), "Invalid array specification %s for %s", p, Name); return true; } // endif p @@ -1847,7 +1848,7 @@ bool BSONCOL::SetArrayOptions(PGLOBAL g, char* p, int i, PSZ nm) break; default: - sprintf(g->Message, + snprintf(g->Message, sizeof(g->Message), "Invalid function specification %c for %s", *p, Name); return true; } // endswitch *p @@ -1863,7 +1864,7 @@ bool BSONCOL::SetArrayOptions(PGLOBAL g, char* p, int i, PSZ nm) } // endif n } else { - sprintf(g->Message, "Wrong array specification for %s", Name); + snprintf(g->Message, sizeof(g->Message), "Wrong array specification for %s", Name); return true; } // endif's @@ -1932,7 +1933,7 @@ bool BSONCOL::ParseJpath(PGLOBAL g) goto fin; } // endif Name - sprintf(g->Message, "Cannot parse updated column %s", Name); + snprintf(g->Message, sizeof(g->Message), "Cannot parse updated column %s", Name); return true; } // endif To_Orig @@ -1975,7 +1976,7 @@ bool BSONCOL::ParseJpath(PGLOBAL g) if (SetArrayOptions(g, p, i, Nodes[i - 1].Key)) return true; else if (Xpd && Tbp->Mode == MODE_DELETE) { - strcpy(g->Message, "Cannot delete expanded columns"); + safe_strcpy(g->Message, sizeof(g->Message), "Cannot delete expanded columns"); return true; } // endif Xpd @@ -2098,7 +2099,7 @@ void BSONCOL::ReadColumn(PGLOBAL g) void BSONCOL::WriteColumn(PGLOBAL g) { if (Xpd && Tbp->Pretty < 2) { - strcpy(g->Message, "Cannot write expanded column when Pretty is not 2"); + safe_strcpy(g->Message, sizeof(g->Message), "Cannot write expanded column when Pretty is not 2"); throw 666; } // endif Xpd @@ -2128,7 +2129,7 @@ void BSONCOL::WriteColumn(PGLOBAL g) char *s = Value->GetCharValue(); if (!(jsp = Cp->ParseJson(g, s, strlen(s)))) { - strcpy(g->Message, s); + safe_strcpy(g->Message, sizeof(g->Message), s); throw 666; } // endif jsp @@ -2174,7 +2175,7 @@ void BSONCOL::WriteColumn(PGLOBAL g) break; default: // ?????????? - sprintf(g->Message, "Invalid column type %d", Buf_Type); + snprintf(g->Message, sizeof(g->Message), "Invalid column type %d", Buf_Type); } // endswitch Type } // end of WriteColumn @@ -2314,7 +2315,7 @@ int TDBBSON::MakeDocument(PGLOBAL g) if (!a && *p && *p != '[' && !IsNum(p)) { // obj is a key if (jsp->Type != TYPE_JOB) { - strcpy(g->Message, "Table path does not match the json file"); + safe_strcpy(g->Message, sizeof(g->Message), "Table path does not match the json file"); return RC_FX; } // endif Type @@ -2324,7 +2325,7 @@ int TDBBSON::MakeDocument(PGLOBAL g) val = Bp->GetKeyValue(objp, key); if (!val || !(jsp = Bp->GetBson(val))) { - sprintf(g->Message, "Cannot find object key %s", key); + snprintf(g->Message, sizeof(g->Message), "Cannot find object key %s", key); return RC_FX; } // endif val @@ -2332,7 +2333,7 @@ int TDBBSON::MakeDocument(PGLOBAL g) if (*p == '[') { // Old style if (p[strlen(p) - 1] != ']') { - sprintf(g->Message, "Invalid Table path near %s", p); + snprintf(g->Message, sizeof(g->Message), "Invalid Table path near %s", p); return RC_FX; } else p++; @@ -2340,7 +2341,7 @@ int TDBBSON::MakeDocument(PGLOBAL g) } // endif p if (jsp->Type != TYPE_JAR) { - strcpy(g->Message, "Table path does not match the json file"); + safe_strcpy(g->Message, sizeof(g->Message), "Table path does not match the json file"); return RC_FX; } // endif Type @@ -2350,7 +2351,7 @@ int TDBBSON::MakeDocument(PGLOBAL g) val = Bp->GetArrayValue(arp, i); if (!val) { - sprintf(g->Message, "Cannot find array value %d", i); + snprintf(g->Message, sizeof(g->Message), "Cannot find array value %d", i); return RC_FX; } // endif val @@ -2434,7 +2435,7 @@ void TDBBSON::ResetSize(void) int TDBBSON::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool) { if (pxdf) { - strcpy(g->Message, "JSON not indexable when pretty = 2"); + safe_strcpy(g->Message, sizeof(g->Message), "JSON not indexable when pretty = 2"); return RC_FX; } else return RC_OK; @@ -2515,7 +2516,7 @@ bool TDBBSON::OpenDB(PGLOBAL g) case MODE_ARRAY: Row = Bp->NewVal(TYPE_JAR); break; case MODE_VALUE: Row = Bp->NewVal(TYPE_JVAL); break; default: - sprintf(g->Message, "Invalid Jmode %d", Jmode); + snprintf(g->Message, sizeof(g->Message), "Invalid Jmode %d", Jmode); return true; } // endswitch Jmode diff --git a/storage/connect/tabbson.h b/storage/connect/tabbson.h index 1696f4dfdbc6e..9d5a8b7daf510 100644 --- a/storage/connect/tabbson.h +++ b/storage/connect/tabbson.h @@ -257,7 +257,7 @@ class DllExport BSONCOL : public DOSCOL { bool SetArrayOptions(PGLOBAL g, char* p, int i, PSZ nm); // Default constructor not to be used - BSONCOL(void) {} + BSONCOL(void) = default; // Members TDBBSN *Tbp; // To the JSN table block diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp index 2e70fdfc55802..0fdc182f6df23 100644 --- a/storage/connect/tabdos.cpp +++ b/storage/connect/tabdos.cpp @@ -62,6 +62,7 @@ #include "tabmul.h" #include "array.h" #include "blkfil.h" +#include "m_string.h" /***********************************************************************/ /* DB static variables. */ @@ -199,7 +200,7 @@ bool DOSDEF::GetOptFileName(PGLOBAL g, char *filename) case RECFM_CSV: ftype = ".cop"; break; case RECFM_DBF: ftype = ".dbp"; break; default: - sprintf(g->Message, MSG(INVALID_FTYPE), Recfm); + snprintf(g->Message, sizeof(g->Message), MSG(INVALID_FTYPE), Recfm); return true; } // endswitch Ftype @@ -258,7 +259,7 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf) sep = GetBoolCatInfo("SepIndex", false); if (!sep && pxdf) { - strcpy(g->Message, MSG(NO_RECOV_SPACE)); + safe_strcpy(g->Message, sizeof(g->Message), MSG(NO_RECOV_SPACE)); return true; } // endif sep @@ -270,7 +271,7 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf) case RECFM_CSV: ftype = ".cnx"; break; case RECFM_DBF: ftype = ".dbx"; break; default: - sprintf(g->Message, MSG(BAD_RECFM_VAL), Recfm); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_RECFM_VAL), Recfm); return true; } // endswitch Ftype @@ -293,7 +294,8 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf) for (; pxdf; pxdf = pxdf->GetNext()) { _splitpath(Ofn, drive, direc, fname, NULL); - strcat(strcat(fname, "_"), pxdf->GetName()); + safe_strcat(fname, sizeof(fname), "_"); + safe_strcat(fname, sizeof(fname), pxdf->GetName()); _makepath(filename, drive, direc, fname, ftype); PlugSetPath(filename, filename, GetPath()); #if defined(_WIN32) @@ -312,7 +314,7 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf) } else { // !sep // Drop all indexes, delete the common file PlugSetPath(filename, Ofn, GetPath()); - strcat(PlugRemoveType(filename, filename), ftype); + safe_strcat(PlugRemoveType(filename, filename), sizeof(filename), ftype); #if defined(_WIN32) if (!DeleteFile(filename)) rc = (GetLastError() != ERROR_FILE_NOT_FOUND); @@ -323,7 +325,7 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf) } // endif sep if (rc) - sprintf(g->Message, MSG(DEL_FILE_ERR), filename); + snprintf(g->Message, sizeof(g->Message), MSG(DEL_FILE_ERR), filename); return rc; // Return true if error } // end of DeleteIndexFile @@ -365,7 +367,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) if (mode == MODE_READ || mode == MODE_ANY || mode == MODE_ALTER) { txfp = new(g) UZDFAM(this); } else { - strcpy(g->Message, "Zipped DBF tables are read only"); + safe_strcpy(g->Message, sizeof(g->Message), "Zipped DBF tables are read only"); return NULL; } // endif's mode @@ -386,7 +388,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) } else if (mode == MODE_INSERT) { txfp = new(g) ZIPFAM(this); } else { - strcpy(g->Message, "UPDATE/DELETE not supported for ZIP"); + safe_strcpy(g->Message, sizeof(g->Message), "UPDATE/DELETE not supported for ZIP"); return NULL; } // endif's mode @@ -397,7 +399,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) } else if (mode == MODE_INSERT) { txfp = new(g) ZPXFAM(this); } else { - strcpy(g->Message, "UPDATE/DELETE not supported for ZIP"); + safe_strcpy(g->Message, sizeof(g->Message), "UPDATE/DELETE not supported for ZIP"); return NULL; } // endif's mode @@ -405,7 +407,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) } // endif Recfm #else // !ZIP_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "ZIP"); return NULL; #endif // !ZIP_SUPPORT } else if (Recfm != RECFM_VAR && Compressed < 2) { @@ -417,7 +419,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) #if defined(GZ_SUPPORT) txfp = new(g) GZXFAM(this); #else // !GZ_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "GZ"); return NULL; #endif // !GZ_SUPPORT } else @@ -433,7 +435,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) txfp = new(g) ZLBFAM(this); #else // !GZ_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "GZ"); return NULL; #endif // !GZ_SUPPORT } else if (map) @@ -468,7 +470,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) ((PZLBFAM)txfp)->SetOptimized(To_Pos != NULL); } // endelse #else - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "GZ"); return NULL; #endif } else @@ -655,7 +657,7 @@ int TDBDOS::MakeBlockValues(PGLOBAL g) if ((nrec = defp->GetElemt()) < 2) { if (!To_Def->Partitioned()) { // This may be wrong to do in some cases - strcpy(g->Message, MSG(TABLE_NOT_OPT)); + safe_strcpy(g->Message, sizeof(g->Message), MSG(TABLE_NOT_OPT)); return RC_INFO; // Not to be optimized } else return RC_OK; @@ -675,7 +677,7 @@ int TDBDOS::MakeBlockValues(PGLOBAL g) if ((block = (int)((MaxSize + (int)nrec - 1) / (int)nrec)) < 2) { // This may be wrong to do in some cases defp->RemoveOptValues(g); - strcpy(g->Message, MSG(TABLE_NOT_OPT)); + safe_strcpy(g->Message, sizeof(g->Message), MSG(TABLE_NOT_OPT)); return RC_INFO; // Not to be optimized } // endif block @@ -758,7 +760,7 @@ int TDBDOS::MakeBlockValues(PGLOBAL g) // No optimised columns. Still useful for blocked variable tables. if (!colp && defp->Recfm != RECFM_VAR) { - strcpy(g->Message, "No optimised columns"); + safe_strcpy(g->Message, sizeof(g->Message), "No optimised columns"); return RC_INFO; } // endif colp @@ -788,7 +790,8 @@ int TDBDOS::MakeBlockValues(PGLOBAL g) /*********************************************************************/ char *p = (char *)PlugSubAlloc(g, NULL, 24 + strlen(Name)); - dup->Step = strcat(strcpy(p, MSG(OPTIMIZING)), Name); + snprintf(p, 24 + strlen(Name), "%s%s", MSG(OPTIMIZING), Name); + dup->Step = p; dup->ProgMax = GetProgMax(g); dup->ProgCur = 0; #endif // SOCKET_MODE || THREAD @@ -805,7 +808,7 @@ int TDBDOS::MakeBlockValues(PGLOBAL g) } else { if (++curnum >= nrec) { if (++curblk >= block) { - strcpy(g->Message, MSG(BAD_BLK_ESTIM)); + safe_strcpy(g->Message, sizeof(g->Message), MSG(BAD_BLK_ESTIM)); goto err; } else curnum = 0; @@ -833,7 +836,7 @@ int TDBDOS::MakeBlockValues(PGLOBAL g) #if defined(PROG_INFO) if (!dup->Step) { - strcpy(g->Message, MSG(OPT_CANCELLED)); + safe_strcpy(g->Message, sizeof(g->Message), MSG(OPT_CANCELLED)); goto err; } else dup->ProgCur = GetProgCur(); @@ -911,9 +914,10 @@ bool TDBDOS::SaveBlockValues(PGLOBAL g) return true; if (!(opfile = fopen(filename, "wb"))) { - sprintf(g->Message, MSG(OPEN_MODE_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR), "wb", (int)errno, filename); - strcat(strcat(g->Message, ": "), strerror(errno)); + safe_strcat(g->Message, sizeof(g->Message), ": "); + safe_strcat(g->Message, sizeof(g->Message), strerror(errno)); if (trace(1)) htrc("%s\n", g->Message); @@ -932,12 +936,12 @@ bool TDBDOS::SaveBlockValues(PGLOBAL g) n[0] = Txfp->Last; n[1] = lg; n[2] = Txfp->Nrec; n[3] = Txfp->Block; if (fwrite(n, sizeof(int), NZ, opfile) != NZ) { - sprintf(g->Message, MSG(OPT_HEAD_WR_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_HEAD_WR_ERR), strerror(errno)); rc = true; } // endif size if (fwrite(Txfp->BlkPos, lg, block, opfile) != block) { - sprintf(g->Message, MSG(OPTBLK_WR_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPTBLK_WR_ERR), strerror(errno)); rc = true; } // endif size @@ -960,17 +964,17 @@ bool TDBDOS::SaveBlockValues(PGLOBAL g) n[4] = ndv; n[5] = nbm; if (fwrite(n, sizeof(int), NZ + 2, opfile) != NZ + 2) { - sprintf(g->Message, MSG(OPT_HEAD_WR_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_HEAD_WR_ERR), strerror(errno)); rc = true; } // endif size if (fwrite(colp->Dval->GetValPointer(), lg, ndv, opfile) != ndv) { - sprintf(g->Message, MSG(OPT_DVAL_WR_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_DVAL_WR_ERR), strerror(errno)); rc = true; } // endif size if (fwrite(colp->Bmap->GetValPointer(), sizeof(int), nbk, opfile) != nbk) { - sprintf(g->Message, MSG(OPT_BMAP_WR_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_BMAP_WR_ERR), strerror(errno)); rc = true; } // endif size @@ -978,17 +982,17 @@ bool TDBDOS::SaveBlockValues(PGLOBAL g) n[0] = colp->Index; n[1] = lg; n[2] = Txfp->Nrec; n[3] = block; if (fwrite(n, sizeof(int), NZ, opfile) != NZ) { - sprintf(g->Message, MSG(OPT_HEAD_WR_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_HEAD_WR_ERR), strerror(errno)); rc = true; } // endif size if (fwrite(colp->Min->GetValPointer(), lg, block, opfile) != block) { - sprintf(g->Message, MSG(OPT_MIN_WR_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_MIN_WR_ERR), strerror(errno)); rc = true; } // endif size if (fwrite(colp->Max->GetValPointer(), lg, block, opfile) != block) { - sprintf(g->Message, MSG(OPT_MAX_WR_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_MAX_WR_ERR), strerror(errno)); rc = true; } // endif size @@ -1096,12 +1100,12 @@ bool TDBDOS::GetBlockValues(PGLOBAL g) lg = sizeof(int); if (fread(n, sizeof(int), NZ, opfile) != NZ) { - sprintf(g->Message, MSG(OPT_HEAD_RD_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_HEAD_RD_ERR), strerror(errno)); goto err; } // endif size if (n[1] != lg || n[2] != nrec) { - sprintf(g->Message, MSG(OPT_NOT_MATCH), filename); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_NOT_MATCH), filename); goto err; } // endif @@ -1112,7 +1116,7 @@ bool TDBDOS::GetBlockValues(PGLOBAL g) defp->To_Pos = (int*)PlugSubAlloc(g, NULL, blk * lg); if (fread(defp->To_Pos, lg, blk, opfile) != blk) { - sprintf(g->Message, MSG(OPTBLK_RD_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPTBLK_RD_ERR), strerror(errno)); goto err; } // endif size @@ -1128,19 +1132,19 @@ bool TDBDOS::GetBlockValues(PGLOBAL g) // Now start the reading process. if (fread(n, sizeof(int), NZ, opfile) != NZ) { - sprintf(g->Message, MSG(OPT_HEAD_RD_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_HEAD_RD_ERR), strerror(errno)); goto err; } // endif size if (n[0] == -i) { // Read the XDB2 opt values from the opt file if (n[1] != lg || n[2] != nrec || n[3] != block) { - sprintf(g->Message, MSG(OPT_NOT_MATCH), filename); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_NOT_MATCH), filename); goto err; } // endif if (fread(n, sizeof(int), 2, opfile) != 2) { - sprintf(g->Message, MSG(OPT_HEAD_RD_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_HEAD_RD_ERR), strerror(errno)); goto err; } // endif fread @@ -1152,7 +1156,7 @@ bool TDBDOS::GetBlockValues(PGLOBAL g) cdp->SetNdv((int)ndv); if (fread(cdp->GetDval(), lg, ndv, opfile) != ndv) { - sprintf(g->Message, MSG(OPT_DVAL_RD_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_DVAL_RD_ERR), strerror(errno)); goto err; } // endif size @@ -1162,7 +1166,7 @@ bool TDBDOS::GetBlockValues(PGLOBAL g) cdp->SetNbm((int)nbm); if (fread(cdp->GetBmap(), sizeof(int), nbk, opfile) != nbk) { - sprintf(g->Message, MSG(OPT_BMAP_RD_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_BMAP_RD_ERR), strerror(errno)); goto err; } // endif size @@ -1170,7 +1174,7 @@ bool TDBDOS::GetBlockValues(PGLOBAL g) } else { // Read the Min/Max values from the opt file if (n[0] != i || n[1] != lg || n[2] != nrec || n[3] != block) { - sprintf(g->Message, MSG(OPT_NOT_MATCH), filename); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_NOT_MATCH), filename); goto err; } // endif @@ -1178,7 +1182,7 @@ bool TDBDOS::GetBlockValues(PGLOBAL g) cdp->SetMin(PlugSubAlloc(g, NULL, blk * lg)); if (fread(cdp->GetMin(), lg, blk, opfile) != blk) { - sprintf(g->Message, MSG(OPT_MIN_RD_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_MIN_RD_ERR), strerror(errno)); goto err; } // endif size @@ -1186,7 +1190,7 @@ bool TDBDOS::GetBlockValues(PGLOBAL g) cdp->SetMax(PlugSubAlloc(g, NULL, blk * lg)); if (fread(cdp->GetMax(), lg, blk, opfile) != blk) { - sprintf(g->Message, MSG(OPT_MAX_RD_ERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_MAX_RD_ERR), strerror(errno)); goto err; } // endif size @@ -1230,7 +1234,8 @@ bool TDBDOS::GetDistinctColumnValues(PGLOBAL g, int nrec) /* Initialize progress information */ /*********************************************************************/ p = (char *)PlugSubAlloc(g, NULL, 48 + strlen(Name)); - dup->Step = strcat(strcpy(p, MSG(GET_DIST_VALS)), Name); + snprintf(p, 48 + strlen(Name), "%s%s", MSG(GET_DIST_VALS), Name); + dup->Step = p; dup->ProgMax = GetProgMax(g); dup->ProgCur = 0; @@ -1242,12 +1247,12 @@ bool TDBDOS::GetDistinctColumnValues(PGLOBAL g, int nrec) #if defined(SOCKET_MODE) if (SendProgress(dup)) { - strcpy(g->Message, MSG(OPT_CANCELLED)); + safe_strcpy(g->Message, sizeof(g->Message), MSG(OPT_CANCELLED)); return true; } else #elif defined(THREAD) if (!dup->Step) { - strcpy(g->Message, MSG(OPT_CANCELLED)); + safe_strcpy(g->Message, sizeof(g->Message), MSG(OPT_CANCELLED)); return true; } else #endif // THREAD @@ -1488,7 +1493,7 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv) if (conv) { // The constant has not the good type and will not match // the block min/max values. Warn and abort. - sprintf(g->Message, "Block opt: %s", MSG(VALTYPE_NOMATCH)); + snprintf(g->Message, sizeof(g->Message), "Block opt: %s", MSG(VALTYPE_NOMATCH)); PushWarning(g, this); return NULL; } // endif Conv @@ -1528,7 +1533,7 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv) } else if (n == 8 || n == 14) { if (n == 8 && ctype != TYPE_LIST) { // Should never happen - strcpy(g->Message, "Block opt: bad constant"); + safe_strcpy(g->Message, sizeof(g->Message), "Block opt: bad constant"); throw 99; } // endif Conv @@ -1686,14 +1691,14 @@ int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add) // Are we are called from CreateTable or CreateIndex? if (pxdf) { if (!add && dfp->GetIndx()) { - strcpy(g->Message, MSG(INDX_EXIST_YET)); + safe_strcpy(g->Message, sizeof(g->Message), MSG(INDX_EXIST_YET)); return RC_FX; } // endif To_Indx if (add && dfp->GetIndx()) { for (sxp = dfp->GetIndx(); sxp; sxp = sxp->GetNext()) if (!stricmp(sxp->GetName(), pxdf->GetName())) { - sprintf(g->Message, MSG(INDEX_YET_ON), pxdf->GetName(), Name); + snprintf(g->Message, sizeof(g->Message), MSG(INDEX_YET_ON), pxdf->GetName(), Name); return RC_FX; } else if (!sxp->GetNext()) break; @@ -1714,10 +1719,10 @@ int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add) for (n = 0, xdp = pxdf; xdp; xdp = xdp->GetNext()) for (kdp = xdp->GetToKeyParts(); kdp; kdp = kdp->GetNext()) { if (!(colp = ColDB(g, kdp->GetName(), 0))) { - sprintf(g->Message, MSG(INDX_COL_NOTIN), kdp->GetName(), Name); + snprintf(g->Message, sizeof(g->Message), MSG(INDX_COL_NOTIN), kdp->GetName(), Name); goto err; } else if (colp->GetResultType() == TYPE_DECIM) { - sprintf(g->Message, "Decimal columns are not indexable yet"); + snprintf(g->Message, sizeof(g->Message), "Decimal columns are not indexable yet"); goto err; } // endif Type @@ -1798,7 +1803,7 @@ int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add) htrc("Exception %d: %s\n", n, g->Message); rc = RC_FX; } catch (const char *msg) { - strcpy(g->Message, msg); + safe_strcpy(g->Message, sizeof(g->Message), msg); rc = RC_FX; } // end catch @@ -1832,7 +1837,7 @@ bool TDBDOS::InitialyzeIndex(PGLOBAL g, volatile PIXDEF xdp, bool sorted) PKPDEF kdp; if (!xdp && !(xdp = To_Xdp)) { - strcpy(g->Message, "NULL dynamic index"); + safe_strcpy(g->Message, sizeof(g->Message), "NULL dynamic index"); return true; } else dynamic = To_Filter && xdp->IsUnique() && xdp->IsDynamic(); @@ -1845,14 +1850,14 @@ bool TDBDOS::InitialyzeIndex(PGLOBAL g, volatile PIXDEF xdp, bool sorted) // Get the key column description list for (k = 0, kdp = xdp->GetToKeyParts(); kdp; kdp = kdp->GetNext()) if (!(colp = ColDB(g, kdp->GetName(), 0)) || colp->InitValue(g)) { - sprintf(g->Message, "Wrong column %s", kdp->GetName()); + snprintf(g->Message, sizeof(g->Message), "Wrong column %s", kdp->GetName()); return true; } else To_Key_Col[k++] = colp; #if defined(_DEBUG) if (k != Knum) { - sprintf(g->Message, "Key part number mismatch for %s", + snprintf(g->Message, sizeof(g->Message), "Key part number mismatch for %s", xdp->GetName()); return 0; } // endif k @@ -1921,7 +1926,7 @@ bool TDBDOS::InitialyzeIndex(PGLOBAL g, volatile PIXDEF xdp, bool sorted) htrc("Exception %d: %s\n", n, g->Message); brc = true; } catch (const char *msg) { - strcpy(g->Message, msg); + safe_strcpy(g->Message, sizeof(g->Message), msg); brc = true; } // end catch @@ -1953,7 +1958,7 @@ int TDBDOS::RowNumber(PGLOBAL g, bool) /*******************************************************************/ /* Don't know how to retrieve RowID from file address. */ /*******************************************************************/ - sprintf(g->Message, MSG(NO_ROWID_FOR_AM), + snprintf(g->Message, sizeof(g->Message), MSG(NO_ROWID_FOR_AM), GetAmName(g, Txfp->GetAmType())); return 0; } else @@ -2479,7 +2484,7 @@ bool DOSCOL::VarSize(void) bool DOSCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) { if (!(To_Val = value)) { - sprintf(g->Message, MSG(VALUE_ERROR), Name); + snprintf(g->Message, sizeof(g->Message), MSG(VALUE_ERROR), Name); return true; } else if (Buf_Type == value->GetType()) { // Values are of the (good) column type @@ -2498,7 +2503,7 @@ bool DOSCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) } else { // Values are not of the (good) column type if (check) { - sprintf(g->Message, MSG(TYPE_VALUE_ERR), Name, + snprintf(g->Message, sizeof(g->Message), MSG(TYPE_VALUE_ERR), Name, GetTypeName(Buf_Type), GetTypeName(value->GetType())); return true; } // endif check @@ -2550,7 +2555,7 @@ void DOSCOL::ReadColumn(PGLOBAL g) if (!tdbp->IsRead()) if ((rc = tdbp->ReadBuffer(g)) != RC_OK) { if (rc == RC_EF) - sprintf(g->Message, MSG(INV_DEF_READ), rc); + snprintf(g->Message, sizeof(g->Message), MSG(INV_DEF_READ), rc); throw 11; } // endif @@ -2615,12 +2620,12 @@ void DOSCOL::ReadColumn(PGLOBAL g) break; default: - sprintf(g->Message, MSG(BAD_RECFM), tdbp->Ftype); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_RECFM), tdbp->Ftype); throw 34; } // endswitch Ftype if (err) { - sprintf(g->Message, "Out of range value for column %s at row %d", + snprintf(g->Message, sizeof(g->Message), "Out of range value for column %s at row %d", Name, tdbp->RowNumber(g)); PushWarning(g, tdbp); } // endif err @@ -2682,38 +2687,38 @@ void DOSCOL::WriteColumn(PGLOBAL g) if (Ldz || Nod || Dcm >= 0) { switch (Buf_Type) { case TYPE_SHORT: - strcpy(fmt, (Ldz) ? "%0*hd" : "%*.hd"); + safe_strcpy(fmt, sizeof(fmt), (Ldz) ? "%0*hd" : "%*.hd"); i = 0; if (Nod) for (; i < Dcm; i++) - strcat(fmt, "0"); + safe_strcat(fmt, sizeof(fmt), "0"); len = sprintf(Buf, fmt, field - i, Value->GetShortValue()); break; case TYPE_INT: - strcpy(fmt, (Ldz) ? "%0*d" : "%*.d"); + safe_strcpy(fmt, sizeof(fmt), (Ldz) ? "%0*d" : "%*.d"); i = 0; if (Nod) for (; i < Dcm; i++) - strcat(fmt, "0"); + safe_strcat(fmt,sizeof(fmt), "0"); len = sprintf(Buf, fmt, field - i, Value->GetIntValue()); break; case TYPE_TINY: - strcpy(fmt, (Ldz) ? "%0*d" : "%*.d"); + safe_strcpy(fmt, sizeof(fmt), (Ldz) ? "%0*d" : "%*.d"); i = 0; if (Nod) for (; i < Dcm; i++) - strcat(fmt, "0"); + safe_strcat(fmt, sizeof(fmt), "0"); len = sprintf(Buf, fmt, field - i, Value->GetTinyValue()); break; case TYPE_DOUBLE: case TYPE_DECIM: - strcpy(fmt, (Ldz) ? "%0*.*lf" : "%*.*lf"); + safe_strcpy(fmt, sizeof(fmt), (Ldz) ? "%0*.*lf" : "%*.*lf"); len = field + ((Nod && Dcm) ? 1 : 0); snprintf(Buf, len + 1, fmt, len, Dcm, Value->GetFloatValue()); len = strlen(Buf); @@ -2730,7 +2735,7 @@ void DOSCOL::WriteColumn(PGLOBAL g) len = strlen(Buf); break; default: - sprintf(g->Message, "Invalid field format for column %s", Name); + snprintf(g->Message, sizeof(g->Message), "Invalid field format for column %s", Name); throw 31; } // endswitch BufType @@ -2744,7 +2749,7 @@ void DOSCOL::WriteColumn(PGLOBAL g) if ((len = n) > field) { char *p = Value->GetCharString(Buf); - sprintf(g->Message, MSG(VALUE_TOO_LONG), p, Name, field); + snprintf(g->Message, sizeof(g->Message), MSG(VALUE_TOO_LONG), p, Name, field); throw 31; } else if (Dsp) for (i = 0; i < len; i++) @@ -2772,7 +2777,7 @@ void DOSCOL::WriteColumn(PGLOBAL g) /* Updating to be done only during the second pass (Status=true) */ /*******************************************************************/ if (Value->GetBinValue(p, Long, Status)) { - sprintf(g->Message, MSG(BIN_F_TOO_LONG), + snprintf(g->Message, sizeof(g->Message), MSG(BIN_F_TOO_LONG), Name, Value->GetSize(), Long); throw 31; } // endif @@ -2832,11 +2837,11 @@ bool DOSCOL::SetBitMap(PGLOBAL g) if ((i = Dval->Find(Value)) < 0) { char buf[32]; - sprintf(g->Message, MSG(DVAL_NOTIN_LIST), + snprintf(g->Message, sizeof(g->Message), MSG(DVAL_NOTIN_LIST), Value->GetCharString(buf), Name); return true; } else if (i >= dup->Maxbmp) { - sprintf(g->Message, MSG(OPT_LOGIC_ERR), i); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_LOGIC_ERR), i); return true; } else { m = i / MAXBMP; @@ -2860,7 +2865,7 @@ bool DOSCOL::CheckSorted(PGLOBAL g) // Verify whether this column is sorted all right if (OldVal->CompareValue(Value) > 0) { // Column is no more in ascending order - sprintf(g->Message, MSG(COL_NOT_SORTED), Name, To_Tdb->GetName()); + snprintf(g->Message, sizeof(g->Message), MSG(COL_NOT_SORTED), Name, To_Tdb->GetName()); Sorted = false; return true; } else @@ -2901,7 +2906,7 @@ bool DOSCOL::AddDistinctValue(PGLOBAL g) // Check whether we have room for an additional value if (Ndv == Freq) { // Too many values because of wrong Freq setting - sprintf(g->Message, MSG(BAD_FREQ_SET), Name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FREQ_SET), Name); return true; } // endif Ndv diff --git a/storage/connect/tabdos.h b/storage/connect/tabdos.h index 80dfe63845d05..22bb5c63ce341 100644 --- a/storage/connect/tabdos.h +++ b/storage/connect/tabdos.h @@ -245,7 +245,7 @@ class DllExport DOSCOL : public COLBLK { bool AddDistinctValue(PGLOBAL g); // Default constructor not to be used - DOSCOL(void) {} + DOSCOL(void) = default; // Members PVBLK Min; // Array of block min values diff --git a/storage/connect/tabext.cpp b/storage/connect/tabext.cpp index 212d27f06d16e..f558cb04f4d7d 100644 --- a/storage/connect/tabext.cpp +++ b/storage/connect/tabext.cpp @@ -65,7 +65,7 @@ int CONDFIL::Init(PGLOBAL g, PHC hc) while (alt) { if (!(p = strchr(alt, '='))) { - strcpy(g->Message, "Invalid alias list"); + safe_strcpy(g->Message, sizeof(g->Message), "Invalid alias list"); rc = RC_FX; break; } // endif !p @@ -126,7 +126,7 @@ EXTDEF::EXTDEF(void) bool EXTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) { if (g->Createas) { - strcpy(g->Message, + safe_strcpy(g->Message, sizeof(g->Message), "Multiple-table UPDATE/DELETE commands are not supported"); return true; } // endif multi @@ -142,8 +142,14 @@ bool EXTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) Username = GetStringCatInfo(g, "User", NULL); Password = GetStringCatInfo(g, "Password", NULL); - if ((Srcdef = GetStringCatInfo(g, "Srcdef", NULL))) + // Memory was Boolean, it is now integer + if (!(Memory = GetIntCatInfo("Memory", 0))) + Memory = GetBoolCatInfo("Memory", false) ? 1 : 0; + + if ((Srcdef = GetStringCatInfo(g, "Srcdef", NULL))) { Read_Only = true; + if (Memory == 2) Memory = 1; + } // endif Srcdef Qrystr = GetStringCatInfo(g, "Query_String", "?"); Sep = GetStringCatInfo(g, "Separator", NULL); @@ -153,6 +159,9 @@ bool EXTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) Maxerr = GetIntCatInfo("Maxerr", 0); Maxres = GetIntCatInfo("Maxres", 0); Quoted = GetIntCatInfo("Quoted", 0); + Qchar = GetStringCatInfo(g,"Qchar", NULL); + if (Qchar && !Quoted) + Quoted = 1; Options = 0; Cto = 0; Qto = 0; @@ -166,10 +175,6 @@ bool EXTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) if (Catfunc == FNC_TABLE) Tabtyp = GetStringCatInfo(g, "Tabtype", NULL); - // Memory was Boolean, it is now integer - if (!(Memory = GetIntCatInfo("Memory", 0))) - Memory = GetBoolCatInfo("Memory", false) ? 1 : 0; - Pseudo = 2; // FILID is Ok but not ROWID return false; } // end of DefineAM @@ -196,6 +201,7 @@ TDBEXT::TDBEXT(EXTDEF *tdp) : TDB(tdp) Cto = tdp->Cto; Qto = tdp->Qto; Quoted = MY_MAX(0, tdp->GetQuoted()); + Quote = tdp->GetQchar(); Rows = tdp->GetElemt(); Memory = tdp->Memory; Scrollable = tdp->Scrollable; @@ -212,12 +218,12 @@ TDBEXT::TDBEXT(EXTDEF *tdp) : TDB(tdp) Cto = 0; Qto = 0; Quoted = 0; + Quote = NULL; Rows = 0; Memory = 0; Scrollable = false; } // endif tdp - Quote = NULL; Query = NULL; Count = NULL; //Where = NULL; @@ -250,6 +256,7 @@ TDBEXT::TDBEXT(PTDBEXT tdbp) : TDB(tdbp) Cto = tdbp->Cto; Qto = tdbp->Qto; Quoted = tdbp->Quoted; + Quote = tdbp->Quote; Rows = tdbp->Rows; Memory = tdbp->Memory; Scrollable = tdbp->Scrollable; @@ -284,6 +291,37 @@ int TDBEXT::Decode(PCSZ txt, char *buf, size_t n) return 0; } // end of Decode +/* + Count number of %s placeholders in string. + Returns -1 if other sprintf placeholders are found, .g %d +*/ +static int count_placeholders(const char *fmt) +{ + int cnt= 0; + for (const char *p=fmt; *p; p++) + { + if (*p == '%') + { + switch (p[1]) + { + case 's': + /* %s found */ + cnt++; + p++; + break; + case '%': + /* masking char for % found */ + p++; + break; + default: + /* some other placeholder found */ + return -1; + } + } + } + return cnt; +} + /***********************************************************************/ /* MakeSrcdef: make the SQL statement from SRDEF option. */ /***********************************************************************/ @@ -308,20 +346,33 @@ bool TDBEXT::MakeSrcdef(PGLOBAL g) ? To_CondFil->Having : PlugDup(g, "1=1"); } // endif ph - if (!stricmp(ph, "W")) { + int n_placeholders = count_placeholders(Srcdef); + if (n_placeholders < 0) + { + safe_strcpy(g->Message, sizeof(g->Message), "MakeSQL: Wrong place holders specification"); + return true; + } + + if (!stricmp(ph, "W") && n_placeholders <= 1) { Query = new(g)STRING(g, strlen(Srcdef) + strlen(fil1)); Query->SetLength(sprintf(Query->GetStr(), Srcdef, fil1)); - } else if (!stricmp(ph, "WH")) { + } + else if (!stricmp(ph, "WH") && n_placeholders <= 2) + { Query = new(g)STRING(g, strlen(Srcdef) + strlen(fil1) + strlen(fil2)); Query->SetLength(sprintf(Query->GetStr(), Srcdef, fil1, fil2)); - } else if (!stricmp(ph, "H")) { + } + else if (!stricmp(ph, "H") && n_placeholders <= 1) + { Query = new(g)STRING(g, strlen(Srcdef) + strlen(fil2)); Query->SetLength(sprintf(Query->GetStr(), Srcdef, fil2)); - } else if (!stricmp(ph, "HW")) { + } + else if (!stricmp(ph, "HW") && n_placeholders <= 2) + { Query = new(g)STRING(g, strlen(Srcdef) + strlen(fil1) + strlen(fil2)); Query->SetLength(sprintf(Query->GetStr(), Srcdef, fil2, fil1)); } else { - strcpy(g->Message, "MakeSQL: Wrong place holders specification"); + safe_strcpy(g->Message, sizeof(g->Message), "MakeSQL: Wrong place holders specification"); return true; } // endif's ph @@ -343,6 +394,8 @@ bool TDBEXT::MakeSQL(PGLOBAL g, bool cnt) int len; bool first = true; PCOL colp; + char *res= NULL, *my_schema_table= NULL; + size_t my_len= 0; if (Srcdef) return MakeSrcdef(g); @@ -412,10 +465,37 @@ bool TDBEXT::MakeSQL(PGLOBAL g, bool cnt) Decode(TableName, buf, sizeof(buf)); if (Quote) { - // Put table name between identifier quotes in case in contains blanks - Query->Append(Quote); - Query->Append(buf); - Query->Append(Quote); + // Tabname can have both database and table identifiers, we need to parse + if ((res= strstr(buf, "."))) + { + // Parse schema + my_len= res - buf + 1; + my_schema_table= (char *) malloc(my_len); + memcpy(my_schema_table, buf, my_len - 1); + my_schema_table[my_len - 1] = 0; + Query->Append(Quote); + Query->Append(my_schema_table); + Query->Append(Quote); + free(my_schema_table); + Query->Append("."); + // Parse table + my_len= strlen(buf) - my_len + 1; + my_schema_table= (char *) malloc(my_len + 1); + memcpy(my_schema_table, ++res, my_len); + my_schema_table[my_len] = 0; + Query->Append(Quote); + Query->Append(my_schema_table); + Query->Append(Quote); + free(my_schema_table); + } + else + { + // Put table name between identifier quotes in case in contains blanks + Query->Append(Quote); + Query->Append(buf); + Query->Append(Quote); + } + } else Query->Append(buf); @@ -433,7 +513,7 @@ bool TDBEXT::MakeSQL(PGLOBAL g, bool cnt) len += ((Mode == MODE_READX) ? 256 : 1); if (Query->IsTruncated()) { - strcpy(g->Message, "MakeSQL: Out of memory"); + safe_strcpy(g->Message, sizeof(g->Message), "MakeSQL: Out of memory"); return true; } else Query->Resize(len); @@ -494,6 +574,7 @@ bool TDBEXT::MakeCommand(PGLOBAL g) bool qtd = Quoted > 0; char q = qtd ? *Quote : ' '; int i = 0, k = 0; + size_t stmt_sz = 0; // Make a lower case copy of the originale query and change // back ticks to the data source identifier quoting character @@ -505,26 +586,30 @@ bool TDBEXT::MakeCommand(PGLOBAL g) p[7] = 0; // Remove where clause Qrystr[(p - qrystr) + 7] = 0; body = To_CondFil->Body; - stmt = (char*)PlugSubAlloc(g, NULL, strlen(qrystr) - + strlen(body) + 64); + stmt_sz = strlen(qrystr) + strlen(body) + 64; } else - stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64); + stmt_sz = strlen(Qrystr) + 64; + stmt = (char*)PlugSubAlloc(g, NULL, stmt_sz); // Check whether the table name is equal to a keyword // If so, it must be quoted in the original query - strlwr(strcat(strcat(strcpy(name, " "), Name), " ")); + snprintf(name, sizeof(name), " %s ", Name); + strlwr(name); if (strstr(" update delete low_priority ignore quick from ", name)) { if (Quote) { - strlwr(strcat(strcat(strcpy(name, Quote), Name), Quote)); + snprintf(name, sizeof(name), "%s%s%s", Quote, Name, Quote); + strlwr(name); k += 2; } else { - strcpy(g->Message, "Quoted must be specified"); + safe_strcpy(g->Message, sizeof(g->Message), "Quoted must be specified"); return true; } // endif Quote - } else - strlwr(strcpy(name, Name)); // Not a keyword + } else { + safe_strcpy(name, sizeof(name), Name); // Not a keyword + strlwr(name); + } if ((p = strstr(qrystr, name))) { for (i = 0; i < p - qrystr; i++) @@ -538,21 +623,29 @@ bool TDBEXT::MakeCommand(PGLOBAL g) schmp = Schema; if (qtd && *(p - 1) == ' ') { - if (schmp) - strcat(strcat(stmt, schmp), "."); + if (schmp) { + safe_strcat(stmt, stmt_sz, schmp); + safe_strcat(stmt, stmt_sz, "."); + } - strcat(strcat(strcat(stmt, Quote), TableName), Quote); + safe_strcat(stmt, stmt_sz, Quote); + safe_strcat(stmt, stmt_sz, TableName); + safe_strcat(stmt, stmt_sz, Quote); } else { if (schmp) { if (qtd && *(p - 1) != ' ') { stmt[i - 1] = 0; - strcat(strcat(strcat(stmt, schmp), "."), Quote); - } else - strcat(strcat(stmt, schmp), "."); + safe_strcat(stmt, stmt_sz, schmp); + safe_strcat(stmt, stmt_sz, "."); + safe_strcat(stmt, stmt_sz, Quote); + } else { + safe_strcat(stmt, stmt_sz, schmp); + safe_strcat(stmt, stmt_sz, "."); + } } // endif schmp - strcat(stmt, TableName); + safe_strcat(stmt, stmt_sz, TableName); } // endif's i = (int)strlen(stmt); @@ -564,10 +657,10 @@ bool TDBEXT::MakeCommand(PGLOBAL g) RemoveConst(g, stmt); if (body) - strcat(stmt, body); + safe_strcat(stmt, stmt_sz, body); } else { - sprintf(g->Message, "Cannot use this %s command", + snprintf(g->Message, sizeof(g->Message), "Cannot use this %s command", (Mode == MODE_UPDATE) ? "UPDATE" : "DELETE"); return true; } // endif p @@ -678,7 +771,7 @@ EXTCOL::EXTCOL(PEXTCOL col1, PTDB tdbp) : COLBLK(col1, tdbp) bool EXTCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) { if (!(To_Val = value)) { - sprintf(g->Message, MSG(VALUE_ERROR), Name); + snprintf(g->Message, sizeof(g->Message), MSG(VALUE_ERROR), Name); return true; } else if (Buf_Type == value->GetType()) { // Values are of the (good) column type @@ -697,7 +790,7 @@ bool EXTCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) } else { // Values are not of the (good) column type if (check) { - sprintf(g->Message, MSG(TYPE_VALUE_ERR), Name, + snprintf(g->Message, sizeof(g->Message), MSG(TYPE_VALUE_ERR), Name, GetTypeName(Buf_Type), GetTypeName(value->GetType())); return true; } // endif check diff --git a/storage/connect/tabext.h b/storage/connect/tabext.h index 5fef1b9ece0a3..8a0d6c784a5eb 100644 --- a/storage/connect/tabext.h +++ b/storage/connect/tabext.h @@ -68,6 +68,7 @@ class DllExport EXTDEF : public TABDEF { /* EXT table */ inline PSZ GetSrcdef(void) { return Srcdef; } inline char GetSep(void) { return (Sep) ? *Sep : 0; } inline int GetQuoted(void) { return Quoted; } + inline PSZ GetQchar(void) { return Qchar; } inline int GetOptions(void) { return Options; } // Methods diff --git a/storage/connect/tabfix.cpp b/storage/connect/tabfix.cpp index 60c37075f66e3..c965b63835c07 100644 --- a/storage/connect/tabfix.cpp +++ b/storage/connect/tabfix.cpp @@ -256,7 +256,7 @@ int TDBFIX::RowNumber(PGLOBAL g, bool b) /* Don't know how to retrieve Rows from DBF file address */ /* because of eventual deleted lines still in the file. */ /*****************************************************************/ - sprintf(g->Message, MSG(NO_ROWID_FOR_AM), + snprintf(g->Message, sizeof(g->Message), MSG(NO_ROWID_FOR_AM), GetAmName(g, Txfp->GetAmType())); return 0; } // endif To_Kindex @@ -408,7 +408,7 @@ BINCOL::BINCOL(PGLOBAL g, PCOLDEF cdp, PTDB tp, PCOL cp, int i, PCSZ am) case 'F': M = sizeof(float); break; case 'D': M = sizeof(double); break; default: - sprintf(g->Message, MSG(BAD_BIN_FMT), Fmt, Name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_BIN_FMT), Fmt, Name); throw 11; } // endswitch Fmt @@ -482,7 +482,7 @@ void BINCOL::ReadColumn(PGLOBAL g) if (!tdbp->IsRead()) if ((rc = tdbp->ReadBuffer(g)) != RC_OK) { if (rc == RC_EF) - sprintf(g->Message, MSG(INV_DEF_READ), rc); + snprintf(g->Message, sizeof(g->Message), MSG(INV_DEF_READ), rc); throw 11; } // endif @@ -535,14 +535,14 @@ void BINCOL::ReadColumn(PGLOBAL g) break; case 'C': // Text if (Value->SetValue_char(p, Long)) { - sprintf(g->Message, "Out of range value for column %s at row %d", + snprintf(g->Message, sizeof(g->Message), "Out of range value for column %s at row %d", Name, tdbp->RowNumber(g)); PushWarning(g, tdbp); } // endif SetValue_char break; default: - sprintf(g->Message, MSG(BAD_BIN_FMT), Fmt, Name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_BIN_FMT), Fmt, Name); throw 11; } // endswitch Fmt @@ -591,7 +591,7 @@ void BINCOL::WriteColumn(PGLOBAL g) if (Status) Value->GetValueNonAligned(p, Value->GetBigintValue()); } else if (Value->GetBinValue(p, Long, Status)) { - sprintf(g->Message, MSG(BIN_F_TOO_LONG), + snprintf(g->Message, sizeof(g->Message), MSG(BIN_F_TOO_LONG), Name, Value->GetSize(), Long); throw 31; } // endif p @@ -601,7 +601,7 @@ void BINCOL::WriteColumn(PGLOBAL g) n = Value->GetBigintValue(); if (n > 32767LL || n < -32768LL) { - sprintf(g->Message, MSG(VALUE_TOO_BIG), n, Name); + snprintf(g->Message, sizeof(g->Message), MSG(VALUE_TOO_BIG), n, Name); throw 31; } else if (Status) Value->GetValueNonAligned(p, (short)n); @@ -611,7 +611,7 @@ void BINCOL::WriteColumn(PGLOBAL g) n = Value->GetBigintValue(); if (n > 255LL || n < -256LL) { - sprintf(g->Message, MSG(VALUE_TOO_BIG), n, Name); + snprintf(g->Message, sizeof(g->Message), MSG(VALUE_TOO_BIG), n, Name); throw 31; } else if (Status) *p = (char)n; @@ -621,7 +621,7 @@ void BINCOL::WriteColumn(PGLOBAL g) n = Value->GetBigintValue(); if (n > INT_MAX || n < INT_MIN) { - sprintf(g->Message, MSG(VALUE_TOO_BIG), n, Name); + snprintf(g->Message, sizeof(g->Message), MSG(VALUE_TOO_BIG), n, Name); throw 31; } else if (Status) Value->GetValueNonAligned(p, (int)n); @@ -645,7 +645,7 @@ void BINCOL::WriteColumn(PGLOBAL g) break; case 'C': // Characters if ((n = (signed)strlen(Value->GetCharString(Buf))) > Long) { - sprintf(g->Message, MSG(BIN_F_TOO_LONG), Name, (int) n, Long); + snprintf(g->Message, sizeof(g->Message), MSG(BIN_F_TOO_LONG), Name, (int) n, Long); throw 31; } // endif n @@ -657,7 +657,7 @@ void BINCOL::WriteColumn(PGLOBAL g) break; default: - sprintf(g->Message, MSG(BAD_BIN_FMT), Fmt, Name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_BIN_FMT), Fmt, Name); throw 31; } // endswitch Fmt diff --git a/storage/connect/tabfix.h b/storage/connect/tabfix.h index 5f859a2bffeb4..1a0d756bfcf61 100644 --- a/storage/connect/tabfix.h +++ b/storage/connect/tabfix.h @@ -82,7 +82,7 @@ class DllExport BINCOL : public DOSCOL { static void SetEndian(void); protected: - BINCOL(void) {} // Default constructor not to be used + BINCOL(void) = default; // Default constructor not to be used // Members static char Endian; // The host endian setting (L or B) diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp index 49233f4f79969..037a465af1395 100644 --- a/storage/connect/tabfmt.cpp +++ b/storage/connect/tabfmt.cpp @@ -62,6 +62,7 @@ #define NO_FUNC #include "plgcnx.h" // For DB types #include "resource.h" +#include "m_string.h" /***********************************************************************/ /* This should be an option. */ @@ -137,7 +138,7 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info) ? strchr(tdp->Entry, '*') || strchr(tdp->Entry, '?') : GetBooleanTableOption(g, topt, "Mulentries", false); #else // !ZIP_SUPPORT - strcpy(g->Message, "ZIP not supported by this version"); + safe_strcpy(g->Message, sizeof(g->Message), "ZIP not supported by this version"); return NULL; #endif // !ZIP_SUPPORT } // endif // Zipped @@ -145,7 +146,7 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info) fn = tdp->Fn = GetStringTableOption(g, topt, "Filename", NULL); if (!tdp->Fn) { - strcpy(g->Message, MSG(MISSING_FNAME)); + safe_strcpy(g->Message, sizeof(g->Message), MSG(MISSING_FNAME)); return NULL; } // endif Fn @@ -230,7 +231,7 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info) colname[0] = p; } else if (rc == RC_EF) { - sprintf(g->Message, MSG(FILE_IS_EMPTY), fn); + snprintf(g->Message, sizeof(g->Message), MSG(FILE_IS_EMPTY), fn); goto err; } else goto err; @@ -269,10 +270,10 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info) /*******************************************************************/ if ((rc = tdbp->ReadDB(g)) == RC_OK) { } else if (rc == RC_EF) { - sprintf(g->Message, MSG(EOF_AFTER_LINE), num_read -1); + snprintf(g->Message, sizeof(g->Message), MSG(EOF_AFTER_LINE), num_read -1); break; } else { - sprintf(g->Message, MSG(ERR_READING_REC), num_read, fn); + snprintf(g->Message, sizeof(g->Message), MSG(ERR_READING_REC), num_read, fn); goto err; } // endif's @@ -285,7 +286,7 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info) if (*p == sep) { if (phase != 1) { if (i == MAXCOL - 1) { - sprintf(g->Message, MSG(TOO_MANY_FIELDS), num_read, fn); + snprintf(g->Message, sizeof(g->Message), MSG(TOO_MANY_FIELDS), num_read, fn); goto err; } // endif i @@ -313,7 +314,7 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info) if (phase == 0) { if (blank) { if (++nerr > mxr) { - sprintf(g->Message, MSG(MISPLACED_QUOTE), num_read); + snprintf(g->Message, sizeof(g->Message), MSG(MISPLACED_QUOTE), num_read); goto err; } else goto skip; @@ -325,7 +326,7 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info) if (*(p+1) == q) { // This is currently not implemented for CSV tables // if (++nerr > mxr) { -// sprintf(g->Message, MSG(QUOTE_IN_QUOTE), num_read); +// snprintf(g->Message, sizeof(g->Message), MSG(QUOTE_IN_QUOTE), num_read); // goto err; // } else // goto skip; @@ -336,7 +337,7 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info) phase = 2; } else if (++nerr > mxr) { // phase == 2 - sprintf(g->Message, MSG(MISPLACED_QUOTE), num_read); + snprintf(g->Message, sizeof(g->Message), MSG(MISPLACED_QUOTE), num_read); goto err; } else goto skip; @@ -344,7 +345,7 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info) } else { if (phase == 2) { if (++nerr > mxr) { - sprintf(g->Message, MSG(MISPLACED_QUOTE), num_read); + snprintf(g->Message, sizeof(g->Message), MSG(MISPLACED_QUOTE), num_read); goto err; } else goto skip; @@ -366,7 +367,7 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info) if (phase == 1) { if (++nerr > mxr) { - sprintf(g->Message, MSG(UNBALANCE_QUOTE), num_read); + snprintf(g->Message, sizeof(g->Message), MSG(UNBALANCE_QUOTE), num_read); goto err; } else goto skip; @@ -472,7 +473,7 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) if (Catfunc == FNC_NO) for (PCOLDEF cdp = To_Cols; cdp; cdp = cdp->GetNext()) if (cdp->GetOffset() < 1 && !cdp->IsSpecial()) { - strcpy(g->Message, MSG(BAD_OFFSET_VAL)); + safe_strcpy(g->Message, sizeof(g->Message), MSG(BAD_OFFSET_VAL)); return true; } // endif Offset @@ -528,11 +529,11 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode) } else if (mode == MODE_INSERT) { txfp = new(g) ZIPFAM(this); } else { - strcpy(g->Message, "UPDATE/DELETE not supported for ZIP"); + safe_strcpy(g->Message, sizeof(g->Message), "UPDATE/DELETE not supported for ZIP"); return NULL; } // endif's mode #else // !ZIP_SUPPORT - strcpy(g->Message, "ZIP not supported"); + safe_strcpy(g->Message, sizeof(g->Message), "ZIP not supported"); return NULL; #endif // !ZIP_SUPPORT } else if (map) { @@ -546,7 +547,7 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode) txfp = new(g) ZLBFAM(this); #else // !GZ_SUPPORT - strcpy(g->Message, "Compress not supported"); + safe_strcpy(g->Message, sizeof(g->Message), "Compress not supported"); return NULL; #endif // !GZ_SUPPORT } else @@ -583,7 +584,7 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode) ((PZLBFAM)txfp)->SetOptimized(To_Pos != NULL); } // endelse #else - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "GZ"); return NULL; #endif } else @@ -864,7 +865,7 @@ bool TDBCSV::SkipHeader(PGLOBAL g) } // endfor cdp if (hlen > Lrecl) { - sprintf(g->Message, MSG(LRECL_TOO_SMALL), hlen); + snprintf(g->Message, sizeof(g->Message), MSG(LRECL_TOO_SMALL), hlen); return true; } // endif hlen @@ -878,7 +879,7 @@ bool TDBCSV::SkipHeader(PGLOBAL g) if (q) To_Line[strlen(To_Line)] = Qot; - strcat(To_Line, cdp->GetName()); + safe_strcat(To_Line, Lrecl, cdp->GetName()); if (q) To_Line[strlen(To_Line)] = Qot; @@ -948,7 +949,7 @@ int TDBCSV::ReadBuffer(PGLOBAL g) if (*p != Sep && i != Fields - 1) { // Should be the separator if (CheckErr()) { - sprintf(g->Message, MSG(MISSING_FIELD), + snprintf(g->Message, sizeof(g->Message), MSG(MISSING_FIELD), i+1, Name, RowNumber(g)); return RC_FX; } else if (Accept) @@ -975,7 +976,7 @@ int TDBCSV::ReadBuffer(PGLOBAL g) } // endif n } else if (CheckErr()) { - sprintf(g->Message, MSG(BAD_QUOTE_FIELD), + snprintf(g->Message, sizeof(g->Message), MSG(BAD_QUOTE_FIELD), Name, i+1, RowNumber(g)); return RC_FX; } else if (Accept) { @@ -992,7 +993,7 @@ int TDBCSV::ReadBuffer(PGLOBAL g) len = strlen(p2); bad = true; } else if (CheckErr()) { - sprintf(g->Message, MSG(MISSING_FIELD), i+1, Name, RowNumber(g)); + snprintf(g->Message, sizeof(g->Message), MSG(MISSING_FIELD), i+1, Name, RowNumber(g)); return RC_FX; } else if (Accept) { len = strlen(p2); @@ -1008,7 +1009,7 @@ int TDBCSV::ReadBuffer(PGLOBAL g) if (Mode != MODE_UPDATE) Fldlen[i] = len; else if (len > Fldlen[i]) { - sprintf(g->Message, MSG(FIELD_TOO_LONG), i+1, RowNumber(g)); + snprintf(g->Message, sizeof(g->Message), MSG(FIELD_TOO_LONG), i+1, RowNumber(g)); return RC_FX; } else { strncpy(Field[i], p2, len); @@ -1048,14 +1049,16 @@ bool TDBCSV::PrepareWriting(PGLOBAL g) for (i = 0; i < Fields; i++) { if (i) - strcat(To_Line, sep); + safe_strcat(To_Line, Lrecl, sep); if (Field[i]) { if (!strlen(Field[i])) { // Generally null fields are not quoted - if (Quoted > 2) - // Except if explicitely required - strcat(strcat(To_Line, qot), qot); + if (Quoted > 2) { + // Except if explicitly required + safe_strcat(To_Line, Lrecl, qot); + safe_strcat(To_Line, Lrecl, qot); + } } else if (Qot && (strchr(Field[i], Sep) || *Field[i] == Qot || Quoted > 1 || (Quoted == 1 && !Fldtyp[i]))) { @@ -1074,12 +1077,15 @@ bool TDBCSV::PrepareWriting(PGLOBAL g) To_Line[k++] = Qot; To_Line[k] = '\0'; - } else - strcat(strcat(strcat(To_Line, qot), Field[i]), qot); + } else { + safe_strcat(To_Line, Lrecl, qot); + safe_strcat(To_Line, Lrecl, Field[i]); + safe_strcat(To_Line, Lrecl, qot); + } } else - strcat(To_Line, Field[i]); + safe_strcat(To_Line, Lrecl, Field[i]); } } // endfor i @@ -1143,7 +1149,7 @@ int TDBCSV::CheckWrite(PGLOBAL g) || Quoted > 1 || (Quoted == 1 && !Fldtyp[i])) { if (!Qot) { - sprintf(g->Message, MSG(SEP_IN_FIELD), i + 1); + snprintf(g->Message, sizeof(g->Message), MSG(SEP_IN_FIELD), i + 1); return -1; } else { // Quotes inside a quoted field must be doubled @@ -1156,7 +1162,7 @@ int TDBCSV::CheckWrite(PGLOBAL g) } // endif } if ((nlen += n) > maxlen) { - strcpy(g->Message, MSG(LINE_TOO_LONG)); + safe_strcpy(g->Message, sizeof(g->Message), MSG(LINE_TOO_LONG)); return -1; } // endif nlen @@ -1225,7 +1231,7 @@ bool TDBFMT::OpenDB(PGLOBAL g) Linenum = 0; if (Mode == MODE_INSERT || Mode == MODE_UPDATE) { - sprintf(g->Message, MSG(FMT_WRITE_NIY), "FMT"); + snprintf(g->Message, sizeof(g->Message), MSG(FMT_WRITE_NIY), "FMT"); return true; // NIY } // endif Mode @@ -1255,18 +1261,18 @@ bool TDBFMT::OpenDB(PGLOBAL g) if (!cdp->IsSpecial() && !cdp->IsVirtual() && (i = cdp->GetOffset() - 1) < Fields) { if (!(pfm = cdp->GetFmt())) { - sprintf(g->Message, MSG(NO_FLD_FORMAT), i + 1, Name); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FLD_FORMAT), i + 1, Name); return true; } // endif pfm // Roughly check the Fmt format if ((n = strlen(pfm) - 2) < 4) { - sprintf(g->Message, MSG(BAD_FLD_FORMAT), i + 1, Name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FLD_FORMAT), i + 1, Name); return true; } // endif n FldFormat[i] = (PSZ)PlugSubAlloc(g, NULL, n + 5); - strcpy(FldFormat[i], pfm); + safe_strcpy(FldFormat[i], n + 5, pfm); if (!strcmp(pfm + n, "%m")) { // This is a field that can be missing. Flag it so it can @@ -1276,7 +1282,7 @@ bool TDBFMT::OpenDB(PGLOBAL g) } else if (i+1 < Fields && strcmp(pfm + n, "%n")) { // There are trailing characters after the field contents // add a marker for the next field start position. - strcat(FldFormat[i], "%n"); + safe_strcat(FldFormat[i], n + 5, "%n"); FmtTest[i] = 1; } // endif's @@ -1338,7 +1344,7 @@ int TDBFMT::ReadBuffer(PGLOBAL g) sscanf("a", "%*c"); // Seems to reset things Ok if (CheckErr()) { - sprintf(g->Message, MSG(BAD_LINEFLD_FMT), Linenum, i + 1, Name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_LINEFLD_FMT), Linenum, i + 1, Name); return RC_FX; } else if (Accept) bad = true; @@ -1361,7 +1367,7 @@ int TDBFMT::ReadBuffer(PGLOBAL g) // if (Mode != MODE_UPDATE) Fldlen[i] = len; // else if (len > Fldlen[i]) { -// sprintf(g->Message, MSG(FIELD_TOO_LONG), i+1, To_Tdb->RowNumber(g)); +// snprintf(g->Message, sizeof(g->Message), MSG(FIELD_TOO_LONG), i+1, To_Tdb->RowNumber(g)); // return RC_FX; // } else { // strncpy(Field[i], To_Line + pos, len); @@ -1384,7 +1390,7 @@ int TDBFMT::ReadBuffer(PGLOBAL g) /***********************************************************************/ int TDBFMT::WriteDB(PGLOBAL g) { - sprintf(g->Message, MSG(FMT_WRITE_NIY), "FMT"); + snprintf(g->Message, sizeof(g->Message), MSG(FMT_WRITE_NIY), "FMT"); return RC_FX; // NIY } // end of WriteDB @@ -1443,7 +1449,7 @@ void CSVCOL::ReadColumn(PGLOBAL g) if (!tdbp->IsRead()) if ((rc = tdbp->ReadBuffer(g)) != RC_OK) { if (rc == RC_EF) - sprintf(g->Message, MSG(INV_DEF_READ), rc); + snprintf(g->Message, sizeof(g->Message), MSG(INV_DEF_READ), rc); throw 34; } // endif @@ -1461,7 +1467,7 @@ void CSVCOL::ReadColumn(PGLOBAL g) if (Long > colen && tdbp->CheckErr()) { Long = colen; // Restore column length - sprintf(g->Message, MSG(FLD_TOO_LNG_FOR), + snprintf(g->Message, sizeof(g->Message), MSG(FLD_TOO_LNG_FOR), Fldnum + 1, Name, To_Tdb->RowNumber(g), tdbp->GetFile(g)); throw 34; } // endif Long @@ -1525,7 +1531,7 @@ void CSVCOL::WriteColumn(PGLOBAL g) htrc("new length(%p)=%d\n", p, n); if (n > flen) { - sprintf(g->Message, MSG(BAD_FLD_LENGTH), Name, p, n, + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FLD_LENGTH), Name, p, n, tdbp->RowNumber(g), tdbp->GetFile(g)); throw 34; } else if (Dsp) @@ -1542,7 +1548,7 @@ void CSVCOL::WriteColumn(PGLOBAL g) /*********************************************************************/ if (Fldnum < 0) { // This can happen for wrong offset value in XDB files - sprintf(g->Message, MSG(BAD_FIELD_RANK), Fldnum + 1, Name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FIELD_RANK), Fldnum + 1, Name); throw 34; } else strncpy(tdbp->Field[Fldnum], p, flen); diff --git a/storage/connect/tabfmt.h b/storage/connect/tabfmt.h index 10f0757c60b31..268d00b1724cd 100644 --- a/storage/connect/tabfmt.h +++ b/storage/connect/tabfmt.h @@ -121,7 +121,7 @@ class DllExport CSVCOL : public DOSCOL { protected: // Default constructor not to be used - CSVCOL(void) {} + CSVCOL(void) = default; // Members int Fldnum; // Field ordinal number (0 based) @@ -163,7 +163,7 @@ class DllExport TDBFMT : public TDBCSV { protected: virtual bool PrepareWriting(PGLOBAL g) - {sprintf(g->Message, MSG(TABLE_READ_ONLY), "FMT"); return true;} + {snprintf(g->Message, sizeof(g->Message), MSG(TABLE_READ_ONLY), "FMT"); return true;} // Members PSZ *FldFormat; // Field read format diff --git a/storage/connect/tabjdbc.cpp b/storage/connect/tabjdbc.cpp index 1268bcfd1de3c..0242832b02ff2 100644 --- a/storage/connect/tabjdbc.cpp +++ b/storage/connect/tabjdbc.cpp @@ -159,7 +159,7 @@ int JDBCDEF::ParseURL(PGLOBAL g, char *url, bool b) // get_server_by_name() clones the server if exists if (!(server= get_server_by_name(current_thd->mem_root, url, &server_buffer))) { - sprintf(g->Message, "Server %s does not exist!", url); + snprintf(g->Message, sizeof(g->Message), "Server %s does not exist!", url); return RC_FX; } // endif server @@ -224,7 +224,7 @@ bool JDBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) Url = GetStringCatInfo(g, "Url", NULL); if (!Url) { - sprintf(g->Message, "Missing URL for JDBC table %s", Name); + snprintf(g->Message, sizeof(g->Message), "Missing URL for JDBC table %s", Name); return true; } // endif Url @@ -232,7 +232,7 @@ bool JDBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) if (Url) if ((rc = ParseURL(g, Url)) == RC_FX) { - sprintf(g->Message, "Wrong JDBC URL %s", Url); + snprintf(g->Message, sizeof(g->Message), "Wrong JDBC URL %s", Url); return true; } // endif rc @@ -277,7 +277,7 @@ PTDB JDBCDEF::GetTable(PGLOBAL g, MODE m) if (Multiple == 1) tdbp = new(g)TDBMUL(tdbp); else if (Multiple == 2) - strcpy(g->Message, "NO_JDBC_MUL"); + safe_strcpy(g->Message, sizeof(g->Message), "NO_JDBC_MUL"); } // endswitch Catfunc @@ -386,7 +386,7 @@ bool TDBJDBC::MakeInsert(PGLOBAL g) for (colp = Columns; colp; colp = colp->GetNext()) if (colp->IsSpecial()) { - strcpy(g->Message, "No JDBC special columns"); + safe_strcpy(g->Message, sizeof(g->Message), "No JDBC special columns"); return true; } else { // Column name can be encoded in UTF-8 @@ -460,7 +460,7 @@ bool TDBJDBC::MakeInsert(PGLOBAL g) } // endfor colp if ((Query->Append(") VALUES ("))) { - strcpy(g->Message, "MakeInsert: Out of memory"); + safe_strcpy(g->Message, sizeof(g->Message), "MakeInsert: Out of memory"); return true; } else // in case prepared statement fails pos = Query->GetLength(); @@ -470,7 +470,7 @@ bool TDBJDBC::MakeInsert(PGLOBAL g) Query->Append("?,"); if (Query->IsTruncated()) { - strcpy(g->Message, "MakeInsert: Out of memory"); + safe_strcpy(g->Message, sizeof(g->Message), "MakeInsert: Out of memory"); return true; } else Query->RepLast(')'); @@ -532,12 +532,15 @@ int TDBJDBC::Cardinality(PGLOBAL g) // Table name can be encoded in UTF-8 Decode(TableName, tbn, sizeof(tbn)); - strcpy(qry, "SELECT COUNT(*) FROM "); + safe_strcpy(qry, sizeof(qry), "SELECT COUNT(*) FROM "); - if (Quote) - strcat(strcat(strcat(qry, Quote), tbn), Quote); + if (Quote) { + safe_strcat(qry, sizeof(qry), Quote); + safe_strcat(qry, sizeof(qry), tbn); + safe_strcat(qry, sizeof(qry), Quote); + } else - strcat(qry, tbn); + safe_strcat(qry, sizeof(qry), tbn); // Allocate a Count(*) column (must not use the default constructor) Cnp = new(g)JDBCCOL; @@ -648,7 +651,7 @@ bool TDBJDBC::OpenDB(PGLOBAL g) if ((n = Jcp->GetResultSize(Query->GetStr(), Cnp)) < 0) { char* msg = PlugDup(g, g->Message); - sprintf(g->Message, "Get result size: %s (rc=%d)", msg, n); + snprintf(g->Message, sizeof(g->Message), "Get result size: %s (rc=%d)", msg, n); return true; } else if (n) { Jcp->m_Rows = n; @@ -656,7 +659,7 @@ bool TDBJDBC::OpenDB(PGLOBAL g) if ((Qrp = Jcp->AllocateResult(g, this))) Memory = 2; // Must be filled else { - strcpy(g->Message, "Result set memory allocation failed"); + safe_strcpy(g->Message, sizeof(g->Message), "Result set memory allocation failed"); return true; } // endif n @@ -683,7 +686,7 @@ bool TDBJDBC::OpenDB(PGLOBAL g) #if 0 if (!(rc = MakeInsert(g))) { if (Nparm != Jcp->PrepareSQL(Query->GetStr())) { - strcpy(g->Message, MSG(PARM_CNT_MISS)); + safe_strcpy(g->Message, sizeof(g->Message), MSG(PARM_CNT_MISS)); rc = true; } else rc = BindParameters(g); @@ -694,7 +697,7 @@ bool TDBJDBC::OpenDB(PGLOBAL g) } else if (Mode == MODE_UPDATE || Mode == MODE_DELETE) { rc = false; // wait for CheckCond before calling MakeCommand(g); } else - sprintf(g->Message, "Invalid mode %d", Mode); + snprintf(g->Message, sizeof(g->Message), "Invalid mode %d", Mode); if (rc) { Jcp->Close(); @@ -735,12 +738,12 @@ bool TDBJDBC::SetRecpos(PGLOBAL g, int recpos) CurNum = recpos; Fpos = recpos; } else { - strcpy(g->Message, "Scrolling out of row set NIY"); + safe_strcpy(g->Message, sizeof(g->Message), "Scrolling out of row set NIY"); return true; } // endif recpos } else { - strcpy(g->Message, "This action requires a scrollable cursor"); + safe_strcpy(g->Message, sizeof(g->Message), "This action requires a scrollable cursor"); return true; } // endif's @@ -786,7 +789,7 @@ bool TDBJDBC::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr) if (To_CondFil) if (Query->Append(" AND ") || Query->Append(To_CondFil->Body)) { - strcpy(g->Message, "Readkey: Out of memory"); + safe_strcpy(g->Message, sizeof(g->Message), "Readkey: Out of memory"); return true; } // endif Append @@ -919,7 +922,7 @@ int TDBJDBC::WriteDB(PGLOBAL g) } // endfor colp if (unlikely(Query->IsTruncated())) { - strcpy(g->Message, "WriteDB: Out of memory"); + safe_strcpy(g->Message, sizeof(g->Message), "WriteDB: Out of memory"); return RC_FX; } // endif Query @@ -951,7 +954,7 @@ int TDBJDBC::DeleteDB(PGLOBAL g, int irc) // Send the DELETE (all) command to the remote table if (Jcp->ExecuteUpdate(Query->GetStr()) == RC_OK) { AftRows = Jcp->m_Aff; - sprintf(g->Message, "%s: %d affected rows", TableName, AftRows); + snprintf(g->Message, sizeof(g->Message), "%s: %d affected rows", TableName, AftRows); if (trace(1)) htrc("%s\n", g->Message); @@ -979,7 +982,7 @@ void TDBJDBC::CloseDB(PGLOBAL g) if (!Werr && (Mode == MODE_INSERT || Mode == MODE_UPDATE || Mode == MODE_DELETE)) { - sprintf(g->Message, "%s: %d affected rows", TableName, AftRows); + snprintf(g->Message, sizeof(g->Message), "%s: %d affected rows", TableName, AftRows); if (trace(1)) htrc("%s\n", g->Message); @@ -1112,13 +1115,13 @@ PCMD TDBXJDC::MakeCMD(PGLOBAL g) (To_CondFil->Op == OP_EQ || To_CondFil->Op == OP_IN)) { xcmd = To_CondFil->Cmds; } else - strcpy(g->Message, "Invalid command specification filter"); + safe_strcpy(g->Message, sizeof(g->Message), "Invalid command specification filter"); } else - strcpy(g->Message, "No command column in select list"); + safe_strcpy(g->Message, sizeof(g->Message), "No command column in select list"); } else if (!Srcdef) - strcpy(g->Message, "No Srcdef default command"); + safe_strcpy(g->Message, sizeof(g->Message), "No Srcdef default command"); else xcmd = new(g) CMD(g, Srcdef); @@ -1149,7 +1152,7 @@ bool TDBXJDC::OpenDB(PGLOBAL g) this, Tdb_No, Use, Mode); if (Use == USE_OPEN) { - strcpy(g->Message, "Multiple execution is not allowed"); + safe_strcpy(g->Message, sizeof(g->Message), "Multiple execution is not allowed"); return true; } // endif use @@ -1171,7 +1174,7 @@ bool TDBXJDC::OpenDB(PGLOBAL g) Use = USE_OPEN; // Do it now in case we are recursively called if (Mode != MODE_READ && Mode != MODE_READX) { - strcpy(g->Message, "No INSERT/DELETE/UPDATE of XJDBC tables"); + safe_strcpy(g->Message, sizeof(g->Message), "No INSERT/DELETE/UPDATE of XJDBC tables"); return true; } // endif Mode @@ -1224,7 +1227,7 @@ int TDBXJDC::ReadDB(PGLOBAL g) /***********************************************************************/ int TDBXJDC::WriteDB(PGLOBAL g) { - strcpy(g->Message, "Execsrc tables are read only"); + safe_strcpy(g->Message, sizeof(g->Message), "Execsrc tables are read only"); return RC_FX; } // end of DeleteDB @@ -1233,7 +1236,7 @@ int TDBXJDC::WriteDB(PGLOBAL g) /***********************************************************************/ int TDBXJDC::DeleteDB(PGLOBAL g, int irc) { - strcpy(g->Message, "NO_XJDBC_DELETE"); + safe_strcpy(g->Message, sizeof(g->Message), "NO_XJDBC_DELETE"); return RC_FX; } // end of DeleteDB diff --git a/storage/connect/tabjmg.cpp b/storage/connect/tabjmg.cpp index 983ee39d65f1c..06a91f57deadd 100644 --- a/storage/connect/tabjmg.cpp +++ b/storage/connect/tabjmg.cpp @@ -96,7 +96,7 @@ bool JMGDISC::ColDesc(PGLOBAL g, jobject obj, char *pcn, char *pfmt, n = Jcp->env->GetIntArrayElements(val, 0); if (Jcp->Check(n[0])) { - sprintf(g->Message, "ColDesc: %s", Jcp->Msg); + snprintf(g->Message, sizeof(g->Message), "ColDesc: %s", Jcp->Msg); goto err; } else if (!n[0]) continue; @@ -526,7 +526,7 @@ char *JMGCOL::Mini(PGLOBAL g, const bson_t *bson, bool b) bson_free(str); if (i >= Long) { - sprintf(g->Message, "Value too long for column %s", Name); + snprintf(g->Message, sizeof(g->Message), "Value too long for column %s", Name); throw (int)TYPE_AM_MGO; } // endif i @@ -596,7 +596,7 @@ bool JMGCOL::AddValue(PGLOBAL g, bson_t *doc, char *key, bool upd) rc = BSON_APPEND_DATE_TIME(doc, key, Value->GetBigintValue() * 1000); break; default: - sprintf(g->Message, "Type %d not supported yet", Buf_Type); + snprintf(g->Message, sizeof(g->Message), "Type %d not supported yet", Buf_Type); return true; } // endswitch Buf_Type diff --git a/storage/connect/tabjmg.h b/storage/connect/tabjmg.h index cf7cff83b684d..06c1462d10349 100644 --- a/storage/connect/tabjmg.h +++ b/storage/connect/tabjmg.h @@ -118,7 +118,7 @@ class DllExport JMGCOL : public EXTCOL { protected: // Default constructor not to be used - JMGCOL(void) {} + JMGCOL(void) = default; //char *GetProjPath(PGLOBAL g); //char *Mini(PGLOBAL g, const bson_t *bson, bool b); diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp index 07a4712e8b0d2..27bdfee5f35e0 100644 --- a/storage/connect/tabjson.cpp +++ b/storage/connect/tabjson.cpp @@ -85,7 +85,7 @@ PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info) } // endif info if (GetIntegerTableOption(g, topt, "Multiple", 0)) { - strcpy(g->Message, "Cannot find column definition for multiple table"); + safe_strcpy(g->Message, sizeof(g->Message), "Cannot find column definition for multiple table"); return NULL; } // endif Multiple @@ -212,7 +212,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) tdp->Uri = (dsn && *dsn ? dsn : NULL); if (!tdp->Fn && !tdp->Uri) { - strcpy(g->Message, MSG(MISSING_FNAME)); + safe_strcpy(g->Message, sizeof(g->Message), MSG(MISSING_FNAME)); return 0; } else topt->subtype = NULL; @@ -239,7 +239,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) (tdp->Version == 2) ? "Mongo2Interface" : "Mongo3Interface"); tdp->Pretty = 0; #else // !MONGO_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "MONGO"); return 0; #endif // !MONGO_SUPPORT } // endif Uri @@ -249,7 +249,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) #if defined(ZIP_SUPPORT) tjsp = new(g) TDBJSON(tdp, new(g) UNZFAM(tdp)); #else // !ZIP_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "ZIP"); return 0; #endif // !ZIP_SUPPORT } else @@ -263,7 +263,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) if (!(tdp->Lrecl = GetIntegerTableOption(g, topt, "Lrecl", 0))) { if (!mgo && !tdp->Uri) { - sprintf(g->Message, "LRECL must be specified for pretty=%d", tdp->Pretty); + snprintf(g->Message, sizeof(g->Message), "LRECL must be specified for pretty=%d", tdp->Pretty); return 0; } else tdp->Lrecl = 8192; // Should be enough @@ -275,7 +275,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) #if defined(ZIP_SUPPORT) tjnp = new(g)TDBJSN(tdp, new(g) UNZFAM(tdp)); #else // !ZIP_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "ZIP"); return NULL; #endif // !ZIP_SUPPORT } else if (tdp->Uri) { @@ -283,14 +283,14 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) #if defined(CMGO_SUPPORT) tjnp = new(g) TDBJSN(tdp, new(g) CMGFAM(tdp)); #else - sprintf(g->Message, "Mongo %s Driver not available", "C"); + snprintf(g->Message, sizeof(g->Message), "Mongo %s Driver not available", "C"); return 0; #endif } else if (tdp->Driver && toupper(*tdp->Driver) == 'J') { #if defined(JAVA_SUPPORT) tjnp = new(g) TDBJSN(tdp, new(g) JMGFAM(tdp)); #else - sprintf(g->Message, "Mongo %s Driver not available", "Java"); + snprintf(g->Message, sizeof(g->Message), "Mongo %s Driver not available", "Java"); return 0; #endif } else { // Driver not specified @@ -299,7 +299,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) #elif defined(JAVA_SUPPORT) tjnp = new(g) TDBJSN(tdp, new(g) JMGFAM(tdp)); #else - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "MONGO"); return 0; #endif } // endif Driver @@ -320,7 +320,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) switch (tjnp->ReadDB(g)) { case RC_EF: - strcpy(g->Message, "Void json table"); + safe_strcpy(g->Message, sizeof(g->Message), "Void json table"); case RC_FX: goto err; default: @@ -333,7 +333,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) } // endif pretty if (!(row = (jsp) ? jsp->GetObject() : NULL)) { - strcpy(g->Message, "Can only retrieve columns from object rows"); + safe_strcpy(g->Message, sizeof(g->Message), "Can only retrieve columns from object rows"); goto err; } // endif row @@ -417,7 +417,7 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j) if (jvp && jvp->DataType != TYPE_JSON) { if (JsonAllPath() && !fmt[bf]) - strcat(fmt, colname); + safe_strcat(fmt, sizeof(fmt), colname); jcol.Type = jvp->DataType; @@ -450,7 +450,7 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j) jcol.Cbn = true; } else if (j < lvl && !Stringified(strfy, colname)) { if (!fmt[bf]) - strcat(fmt, colname); + safe_strcat(fmt, sizeof(fmt), colname); p = fmt + strlen(fmt); jsp = jvp->GetJson(); @@ -513,18 +513,18 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j) return false; default: - sprintf(g->Message, "Logical error after %s", fmt); + snprintf(g->Message, sizeof(g->Message), "Logical error after %s", fmt); return true; } // endswitch Type } else if (lvl >= 0) { if (Stringified(strfy, colname)) { if (!fmt[bf]) - strcat(fmt, colname); + safe_strcat(fmt, sizeof(fmt), colname); - strcat(fmt, ".*"); + safe_strcat(fmt, sizeof(fmt), ".*"); } else if (JsonAllPath() && !fmt[bf]) - strcat(fmt, colname); + safe_strcat(fmt, sizeof(fmt), colname); jcol.Type = TYPE_STRG; jcol.Len = sz; @@ -671,7 +671,7 @@ bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) Wrapname = GetStringCatInfo(g, "Wrapper", "Mongo3Interface"); #endif // JAVA_SUPPORT #else // !MONGO_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "MONGO"); return true; #endif // !MONGO_SUPPORT } // endif Uri @@ -706,14 +706,14 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m) #if defined(CMGO_SUPPORT) txfp = new(g) CMGFAM(this); #else - sprintf(g->Message, "Mongo %s Driver not available", "C"); + snprintf(g->Message, sizeof(g->Message), "Mongo %s Driver not available", "C"); return NULL; #endif } else if (Driver && toupper(*Driver) == 'J') { #if defined(JAVA_SUPPORT) txfp = new(g) JMGFAM(this); #else - sprintf(g->Message, "Mongo %s Driver not available", "Java"); + snprintf(g->Message, sizeof(g->Message), "Mongo %s Driver not available", "Java"); return NULL; #endif } else { // Driver not specified @@ -722,7 +722,7 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m) #elif defined(JAVA_SUPPORT) txfp = new(g) JMGFAM(this); #else // !MONGO_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "MONGO"); return NULL; #endif // !MONGO_SUPPORT } // endif Driver @@ -735,11 +735,11 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m) } else if (m == MODE_INSERT) { txfp = new(g) ZIPFAM(this); } else { - strcpy(g->Message, "UPDATE/DELETE not supported for ZIP"); + safe_strcpy(g->Message, sizeof(g->Message), "UPDATE/DELETE not supported for ZIP"); return NULL; } // endif's m #else // !ZIP_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "ZIP"); return NULL; #endif // !ZIP_SUPPORT } else if (Compressed) { @@ -749,7 +749,7 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m) else txfp = new(g) ZLBFAM(this); #else // !GZ_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "GZ"); return NULL; #endif // !GZ_SUPPORT } else if (map) @@ -775,7 +775,7 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m) #endif // 0 ((TDBJSN*)tdbp)->G = PlugInit(NULL, (size_t)Lrecl * (Pretty >= 0 ? 12 : 4)); } else { - strcpy(g->Message, "LRECL is not defined"); + safe_strcpy(g->Message, sizeof(g->Message), "LRECL is not defined"); return NULL; } // endif Lrecl @@ -785,14 +785,14 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m) if (m == MODE_READ || m == MODE_ANY || m == MODE_ALTER) { txfp = new(g) UNZFAM(this); } else if (m == MODE_INSERT) { - strcpy(g->Message, "INSERT supported only for zipped JSON when pretty=0"); + safe_strcpy(g->Message, sizeof(g->Message), "INSERT supported only for zipped JSON when pretty=0"); return NULL; } else { - strcpy(g->Message, "UPDATE/DELETE not supported for ZIP"); + safe_strcpy(g->Message, sizeof(g->Message), "UPDATE/DELETE not supported for ZIP"); return NULL; } // endif's m #else // !ZIP_SUPPORT - sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "ZIP"); return NULL; #endif // !ZIP_SUPPORT } else @@ -980,7 +980,7 @@ PJSON TDBJSN::FindRow(PGLOBAL g) } else { if (bp || *objpath == '[') { if (objpath[strlen(objpath) - 1] != ']') { - sprintf(g->Message, "Invalid Table path %s", Objname); + snprintf(g->Message, sizeof(g->Message), "Invalid Table path %s", Objname); return NULL; } else if (!bp) objpath++; @@ -1031,7 +1031,7 @@ bool TDBJSN::OpenDB(PGLOBAL g) case MODE_ARRAY: Row = new(g) JARRAY; break; case MODE_VALUE: Row = new(g) JVALUE; break; default: - sprintf(g->Message, "Invalid Jmode %d", Jmode); + snprintf(g->Message, sizeof(g->Message), "Invalid Jmode %d", Jmode); return true; } // endswitch Jmode @@ -1144,7 +1144,7 @@ int TDBJSN::ReadDB(PGLOBAL g) { M = 1; rc = RC_OK; } else if (Pretty != 1 || strcmp(To_Line, "]")) { - strcpy(g->Message, G->Message); + safe_strcpy(g->Message, sizeof(g->Message), G->Message); rc = RC_FX; } else rc = RC_EF; @@ -1209,7 +1209,7 @@ bool TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp) if (bp || *objpath == '[') { // Old style if (objpath[strlen(objpath) - 1] != ']') { - sprintf(g->Message, "Invalid Table path %s", Objname); + snprintf(g->Message, sizeof(g->Message), "Invalid Table path %s", Objname); return true; } else if (!bp) objpath++; @@ -1257,8 +1257,8 @@ bool TDBJSN::PrepareWriting(PGLOBAL g) strcat(s, ","); if ((signed)strlen(s) > Lrecl) { - strncpy(To_Line, s, Lrecl); - sprintf(g->Message, "Line truncated (lrecl=%d)", Lrecl); + safe_strcpy(To_Line, Lrecl, s); + snprintf(g->Message, sizeof(g->Message), "Line truncated (lrecl=%d)", Lrecl); return PushWarning(g, this); } else strcpy(To_Line, s); @@ -1359,7 +1359,7 @@ bool JSONCOL::CheckExpand(PGLOBAL g, int i, PSZ nm, bool b) Xpd = true; // Expandable object Nodes[i].Op = OP_EXP; } else if (b) { - strcpy(g->Message, "Cannot expand more than one branch"); + safe_strcpy(g->Message, sizeof(g->Message), "Cannot expand more than one branch"); return true; } // endif Xcol @@ -1383,7 +1383,7 @@ bool JSONCOL::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm) p[--n] = 0; } else if (!IsNum(p)) { // Wrong array specification - sprintf(g->Message, "Invalid array specification %s for %s", p, Name); + snprintf(g->Message, sizeof(g->Message), "Invalid array specification %s for %s", p, Name); return true; } // endif p @@ -1442,7 +1442,7 @@ bool JSONCOL::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm) break; default: - sprintf(g->Message, + snprintf(g->Message, sizeof(g->Message), "Invalid function specification %c for %s", *p, Name); return true; } // endswitch *p @@ -1458,7 +1458,7 @@ bool JSONCOL::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm) } // endif n } else { - sprintf(g->Message, "Wrong array specification for %s", Name); + snprintf(g->Message, sizeof(g->Message), "Wrong array specification for %s", Name); return true; } // endif's @@ -1527,7 +1527,7 @@ bool JSONCOL::ParseJpath(PGLOBAL g) goto fin; } // endif Name - sprintf(g->Message, "Cannot parse updated column %s", Name); + snprintf(g->Message, sizeof(g->Message), "Cannot parse updated column %s", Name); return true; } // endif To_Orig @@ -1570,7 +1570,7 @@ bool JSONCOL::ParseJpath(PGLOBAL g) if (SetArrayOptions(g, p, i, Nodes[i - 1].Key)) return true; else if (Xpd && Tjp->Mode == MODE_DELETE) { - strcpy(g->Message, "Cannot delete expanded columns"); + safe_strcpy(g->Message, sizeof(g->Message), "Cannot delete expanded columns"); return true; } // endif Xpd @@ -1674,7 +1674,7 @@ PSZ JSONCOL::GetJpath(PGLOBAL g, bool proj) PVAL JSONCOL::MakeJson(PGLOBAL g, PJSON jsp, int n) { if (Value->IsTypeNum()) { - strcpy(g->Message, "Cannot make Json for a numeric column"); + safe_strcpy(g->Message, sizeof(g->Message), "Cannot make Json for a numeric column"); if (!Warned) { PushWarning(g, Tjp); @@ -1689,10 +1689,10 @@ PVAL JSONCOL::MakeJson(PGLOBAL g, PJSON jsp, int n) ulong len = Tjp->Lrecl ? Tjp->Lrecl : 500; PBSON bsp = JbinAlloc(g, NULL, len, jsp); - strcat(bsp->Msg, " column"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " column"); ((BINVAL*)Value)->SetBinValue(bsp, sizeof(BSON)); } else { - strcpy(g->Message, "Column size too small"); + safe_strcpy(g->Message, sizeof(g->Message), "Column size too small"); Value->SetValue_char(NULL, 0); } // endif Clen #endif // 0 @@ -1742,7 +1742,7 @@ PJVAL JSONCOL::GetRowValue(PGLOBAL g, PJSON row, int i) val = (PJVAL)row; break; default: - sprintf(g->Message, "Invalid row JSON type %d", row->GetType()); + snprintf(g->Message, sizeof(g->Message), "Invalid row JSON type %d", row->GetType()); val = NULL; } // endswitch Type @@ -1804,7 +1804,7 @@ void JSONCOL::SetJsonValue(PGLOBAL g, PVAL vp, PJVAL jvp) break; default: - sprintf(g->Message, "Unsupported column type %d\n", vp->GetType()); + snprintf(g->Message, sizeof(g->Message), "Unsupported column type %d\n", vp->GetType()); throw 888; } // endswitch Type @@ -1904,7 +1904,7 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i) val = (PJVAL)row; break; default: - sprintf(g->Message, "Invalid row JSON type %d", row->GetType()); + snprintf(g->Message, sizeof(g->Message), "Invalid row JSON type %d", row->GetType()); val = NULL; } // endswitch Type @@ -1934,7 +1934,7 @@ PVAL JSONCOL::ExpandArray(PGLOBAL g, PJAR arp, int n) } // endif ars if (!(jvp = arp->GetArrayValue((Nodes[n].Rx = Nodes[n].Nx)))) { - strcpy(g->Message, "Logical error expanding array"); + safe_strcpy(g->Message, sizeof(g->Message), "Logical error expanding array"); throw 666; } // endif jvp @@ -2099,7 +2099,7 @@ PJSON JSONCOL::GetRow(PGLOBAL g) val = (PJVAL)row; break; default: - sprintf(g->Message, "Invalid row JSON type %d", row->GetType()); + snprintf(g->Message, sizeof(g->Message), "Invalid row JSON type %d", row->GetType()); val = NULL; } // endswitch Type @@ -2122,7 +2122,7 @@ PJSON JSONCOL::GetRow(PGLOBAL g) ((PJAR)row)->AddArrayValue(G, new(G) JVALUE(nwr)); ((PJAR)row)->InitArray(G); } else { - strcpy(g->Message, "Wrong type when writing new row"); + safe_strcpy(g->Message, sizeof(g->Message), "Wrong type when writing new row"); nwr = NULL; } // endif's @@ -2143,7 +2143,7 @@ PJSON JSONCOL::GetRow(PGLOBAL g) void JSONCOL::WriteColumn(PGLOBAL g) { if (Xpd && Tjp->Pretty < 2) { - strcpy(g->Message, "Cannot write expanded column when Pretty is not 2"); + safe_strcpy(g->Message, sizeof(g->Message), "Cannot write expanded column when Pretty is not 2"); throw 666; } // endif Xpd @@ -2179,7 +2179,7 @@ void JSONCOL::WriteColumn(PGLOBAL g) if (s && *s) { if (!(jsp = ParseJson(G, s, strlen(s)))) { - strcpy(g->Message, s); + safe_strcpy(g->Message, sizeof(g->Message), s); throw 666; } // endif jsp @@ -2226,7 +2226,7 @@ void JSONCOL::WriteColumn(PGLOBAL g) break; default: // ?????????? - sprintf(g->Message, "Invalid column type %d", Buf_Type); + snprintf(g->Message, sizeof(g->Message), "Invalid column type %d", Buf_Type); } // endswitch Type } // end of WriteColumn @@ -2362,7 +2362,7 @@ int TDBJSON::MakeDocument(PGLOBAL g) if (!a && *p && *p != '[' && !IsNum(p)) { // obj is a key if (jsp->GetType() != TYPE_JOB) { - strcpy(g->Message, "Table path does not match the json file"); + safe_strcpy(g->Message, sizeof(g->Message), "Table path does not match the json file"); return RC_FX; } // endif Type @@ -2372,7 +2372,7 @@ int TDBJSON::MakeDocument(PGLOBAL g) val = objp->GetKeyValue(key); if (!val || !(jsp = val->GetJson())) { - sprintf(g->Message, "Cannot find object key %s", key); + snprintf(g->Message, sizeof(g->Message), "Cannot find object key %s", key); return RC_FX; } // endif val @@ -2380,7 +2380,7 @@ int TDBJSON::MakeDocument(PGLOBAL g) if (*p == '[') { // Old style if (p[strlen(p) - 1] != ']') { - sprintf(g->Message, "Invalid Table path near %s", p); + snprintf(g->Message, sizeof(g->Message), "Invalid Table path near %s", p); return RC_FX; } else p++; @@ -2388,7 +2388,7 @@ int TDBJSON::MakeDocument(PGLOBAL g) } // endif p if (jsp->GetType() != TYPE_JAR) { - strcpy(g->Message, "Table path does not match the json file"); + safe_strcpy(g->Message, sizeof(g->Message), "Table path does not match the json file"); return RC_FX; } // endif Type @@ -2398,7 +2398,7 @@ int TDBJSON::MakeDocument(PGLOBAL g) val = arp->GetArrayValue(i); if (!val) { - sprintf(g->Message, "Cannot find array value %d", i); + snprintf(g->Message, sizeof(g->Message), "Cannot find array value %d", i); return RC_FX; } // endif val @@ -2483,7 +2483,7 @@ void TDBJSON::ResetSize(void) int TDBJSON::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool) { if (pxdf) { - strcpy(g->Message, "JSON not indexable when pretty = 2"); + safe_strcpy(g->Message, sizeof(g->Message), "JSON not indexable when pretty = 2"); return RC_FX; } else return RC_OK; @@ -2562,7 +2562,7 @@ bool TDBJSON::OpenDB(PGLOBAL g) case MODE_ARRAY: Row = new(g) JARRAY; break; case MODE_VALUE: Row = new(g) JVALUE; break; default: - sprintf(g->Message, "Invalid Jmode %d", Jmode); + snprintf(g->Message, sizeof(g->Message), "Invalid Jmode %d", Jmode); return true; } // endswitch Jmode @@ -2646,7 +2646,7 @@ int TDBJSON::DeleteDB(PGLOBAL g, int irc) if (irc == RC_OK) { // Deleted current row if (Doc->DeleteValue(Fpos)) { - sprintf(g->Message, "Value %d does not exist", Fpos + 1); + snprintf(g->Message, sizeof(g->Message), "Value %d does not exist", Fpos + 1); return RC_FX; } // endif Delete diff --git a/storage/connect/tabjson.h b/storage/connect/tabjson.h index 623e5b6d509cd..dcf40620dae31 100644 --- a/storage/connect/tabjson.h +++ b/storage/connect/tabjson.h @@ -238,7 +238,7 @@ class DllExport JSONCOL : public DOSCOL { PJSON GetRow(PGLOBAL g); // Default constructor not to be used - JSONCOL(void) {} + JSONCOL(void) = default; // Members PGLOBAL G; // Support of parse memory diff --git a/storage/connect/table.cpp b/storage/connect/table.cpp index d4d3a34d67e7e..b0b5b86ca3b91 100644 --- a/storage/connect/table.cpp +++ b/storage/connect/table.cpp @@ -207,7 +207,7 @@ PCOL TDB::InsertSpcBlk(PGLOBAL g, PCOLDEF cdp) !stricmp(name, "FPATH") || !stricmp(name, "FNAME") || !stricmp(name, "FTYPE") || !stricmp(name, "SERVID")) { if (!To_Def || !(To_Def->GetPseudo() & 2)) { - sprintf(g->Message, MSG(BAD_SPEC_COLUMN)); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_SPEC_COLUMN)); return NULL; } // endif Pseudo @@ -235,12 +235,12 @@ PCOL TDB::InsertSpcBlk(PGLOBAL g, PCOLDEF cdp) } else if (!stricmp(name, "ROWNUM")) { colp = new(g)RIDBLK(cp, true); } else { - sprintf(g->Message, MSG(BAD_SPECIAL_COL), name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_SPECIAL_COL), name); return NULL; } // endif's name if (!(colp = InsertSpecialColumn(colp))) { - sprintf(g->Message, MSG(BAD_SPECIAL_COL), name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_SPECIAL_COL), name); return NULL; } // endif Insert @@ -266,7 +266,7 @@ void TDB::MarkDB(PGLOBAL, PTDB tdb2) /***********************************************************************/ int TDB::RowNumber(PGLOBAL g, bool) { - sprintf(g->Message, MSG(ROWID_NOT_IMPL), GetAmName(g, GetAmType())); + snprintf(g->Message, sizeof(g->Message), MSG(ROWID_NOT_IMPL), GetAmName(g, GetAmType())); return 0; } // end of RowNumber @@ -495,7 +495,7 @@ PCOL TDBASE::InsertSpcBlk(PGLOBAL g, PCOLDEF cdp) !stricmp(name, "FPATH") || !stricmp(name, "FNAME") || !stricmp(name, "FTYPE") || !stricmp(name, "SERVID")) { if (!To_Def || !(To_Def->GetPseudo() & 2)) { - sprintf(g->Message, MSG(BAD_SPEC_COLUMN)); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_SPEC_COLUMN)); return NULL; } // endif Pseudo @@ -523,12 +523,12 @@ PCOL TDBASE::InsertSpcBlk(PGLOBAL g, PCOLDEF cdp) } else if (!stricmp(name, "ROWNUM")) { colp = new(g) RIDBLK(cp, true); } else { - sprintf(g->Message, MSG(BAD_SPECIAL_COL), name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_SPECIAL_COL), name); return NULL; } // endif's name if (!(colp = InsertSpecialColumn(colp))) { - sprintf(g->Message, MSG(BAD_SPECIAL_COL), name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_SPECIAL_COL), name); return NULL; } // endif Insert @@ -642,12 +642,12 @@ bool TDBCAT::Initialize(PGLOBAL g) return true; if (Qrp->Truncated) { - sprintf(g->Message, "Result limited to %d lines", Qrp->Maxres); + snprintf(g->Message, sizeof(g->Message), "Result limited to %d lines", Qrp->Maxres); PushWarning(g, this); } // endif Truncated if (Qrp->BadLines) { - sprintf(g->Message, "%d bad lines in result", Qrp->BadLines); + snprintf(g->Message, sizeof(g->Message), "%d bad lines in result", Qrp->BadLines); PushWarning(g, this); } // endif Badlines @@ -720,7 +720,7 @@ bool TDBCAT::InitCol(PGLOBAL g) if (!colp->Crp /*&& !colp->GetValue()->IsConstant()*/) { - sprintf(g->Message, "Invalid flag %d for column %s", + snprintf(g->Message, sizeof(g->Message), "Invalid flag %d for column %s", colp->Flag, colp->Name); return true; } else if (crp->Fld == FLD_SCALE || crp->Fld == FLD_RADIX) diff --git a/storage/connect/tabmac.cpp b/storage/connect/tabmac.cpp index ed161ac4be1ad..723dc359ee8b0 100644 --- a/storage/connect/tabmac.cpp +++ b/storage/connect/tabmac.cpp @@ -100,7 +100,7 @@ PCOL TDBMAC::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) void TDBMAC::MakeErrorMsg(PGLOBAL g, DWORD drc) { if (drc == ERROR_BUFFER_OVERFLOW) - sprintf(g->Message, + snprintf(g->Message, sizeof(g->Message), "GetAdaptersInfo: Buffer Overflow buflen=%d maxsize=%d", Buflen, MaxSize); else if (drc == ERROR_INVALID_PARAMETER) @@ -111,7 +111,7 @@ void TDBMAC::MakeErrorMsg(PGLOBAL g, DWORD drc) else if (drc == ERROR_NOT_SUPPORTED) strcpy(g->Message, "GetAdaptersInfo is not supported"); else - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), 0, g->Message, sizeof(g->Message), NULL); @@ -159,7 +159,7 @@ bool TDBMAC::GetFixedInfo(PGLOBAL g) } // endif drc if (drc != ERROR_SUCCESS) { - sprintf(g->Message, "GetNetworkParams failed. Rc=%08x\n", drc); + snprintf(g->Message, sizeof(g->Message), "GetNetworkParams failed. Rc=%08x\n", drc); return true; } // endif drc diff --git a/storage/connect/tabmul.cpp b/storage/connect/tabmul.cpp index d260149514de7..4fad2b27cd809 100644 --- a/storage/connect/tabmul.cpp +++ b/storage/connect/tabmul.cpp @@ -723,7 +723,7 @@ int TDBDIR::GetMaxSize(PGLOBAL g) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), 0, (LPTSTR)&buf, sizeof(buf), NULL); - sprintf(g->Message, MSG(BAD_FILE_HANDLE), buf); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FILE_HANDLE), buf); return -1; } // endif rc @@ -738,7 +738,7 @@ int TDBDIR::GetMaxSize(PGLOBAL g) rc = GetLastError(); if (rc != ERROR_NO_MORE_FILES) { - sprintf(g->Message, MSG(NEXT_FILE_ERROR), rc); + snprintf(g->Message, sizeof(g->Message), MSG(NEXT_FILE_ERROR), rc); FindClose(hSearch); return -1; } // endif rc @@ -755,7 +755,7 @@ int TDBDIR::GetMaxSize(PGLOBAL g) // Start searching files in the target directory. if (!(Dir = opendir(Direc))) { - sprintf(g->Message, MSG(BAD_DIRECTORY), Direc, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_DIRECTORY), Direc, strerror(errno)); return -1; } // endif dir @@ -763,7 +763,7 @@ int TDBDIR::GetMaxSize(PGLOBAL g) strcat(strcpy(Fpath, Direc), Entry->d_name); if (lstat(Fpath, &Fileinfo) < 0) { - sprintf(g->Message, "%s: %s", Fpath, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), "%s: %s", Fpath, strerror(errno)); return -1; } else if (S_ISREG(Fileinfo.st_mode)) // Test whether the file name matches the table name filter @@ -851,7 +851,7 @@ int TDBDIR::ReadDB(PGLOBAL g) if (!Dir) // Start searching files in the target directory. if (!(Dir = opendir(Direc))) { - sprintf(g->Message, MSG(BAD_DIRECTORY), Direc, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_DIRECTORY), Direc, strerror(errno)); rc = RC_FX; } // endif dir @@ -861,7 +861,7 @@ int TDBDIR::ReadDB(PGLOBAL g) strcat(strcpy(Fpath, Direc), Entry->d_name); if (lstat(Fpath, &Fileinfo) < 0) { - sprintf(g->Message, "%s: %s", Fpath, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), "%s: %s", Fpath, strerror(errno)); rc = RC_FX; } else if (S_ISREG(Fileinfo.st_mode)) // Test whether the file name matches the table name filter @@ -1015,7 +1015,7 @@ void DIRCOL::ReadColumn(PGLOBAL g) case 10: Value->SetValue((int)Tdbp->Fileinfo.st_gid); break; #endif // !_WIN32 default: - sprintf(g->Message, MSG(INV_DIRCOL_OFST), N); + snprintf(g->Message, sizeof(g->Message), MSG(INV_DIRCOL_OFST), N); throw GetAmType(); } // endswitch N @@ -1066,7 +1066,7 @@ int TDBSDR::FindInDir(PGLOBAL g) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), 0, (LPTSTR)&buf, sizeof(buf), NULL); - sprintf(g->Message, MSG(BAD_FILE_HANDLE), buf); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FILE_HANDLE), buf); return -1; } // endif rc @@ -1087,7 +1087,7 @@ int TDBSDR::FindInDir(PGLOBAL g) rc = GetLastError(); if (rc != ERROR_NO_MORE_FILES) { - sprintf(g->Message, MSG(NEXT_FILE_ERROR), rc); + snprintf(g->Message, sizeof(g->Message), MSG(NEXT_FILE_ERROR), rc); FindClose(h); return -1; } // endif rc @@ -1108,7 +1108,7 @@ int TDBSDR::FindInDir(PGLOBAL g) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), 0, (LPTSTR)&buf, sizeof(buf), NULL); - sprintf(g->Message, MSG(BAD_FILE_HANDLE), buf); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FILE_HANDLE), buf); return -1; } // endif rc @@ -1122,7 +1122,7 @@ int TDBSDR::FindInDir(PGLOBAL g) rc = GetLastError(); if (rc != ERROR_NO_MORE_FILES) { - sprintf(g->Message, MSG(NEXT_FILE_ERROR), rc); + snprintf(g->Message, sizeof(g->Message), MSG(NEXT_FILE_ERROR), rc); FindClose(h); return -1; } // endif rc @@ -1161,7 +1161,7 @@ int TDBSDR::FindInDir(PGLOBAL g) DIR *dir = opendir(Direc); if (!dir) { - sprintf(g->Message, MSG(BAD_DIRECTORY), Direc, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_DIRECTORY), Direc, strerror(errno)); return -1; } // endif dir @@ -1169,7 +1169,7 @@ int TDBSDR::FindInDir(PGLOBAL g) strcat(strcpy(Fpath, Direc), Entry->d_name); if (lstat(Fpath, &Fileinfo) < 0) { - sprintf(g->Message, "%s: %s", Fpath, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), "%s: %s", Fpath, strerror(errno)); return -1; } else if (S_ISDIR(Fileinfo.st_mode) && *Entry->d_name != '.') { // Look in the name sub-directory @@ -1288,7 +1288,7 @@ int TDBSDR::ReadDB(PGLOBAL g) if (!Sub->D) // Start searching files in the target directory. if (!(Sub->D = opendir(Direc))) { - sprintf(g->Message, MSG(BAD_DIRECTORY), Direc, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_DIRECTORY), Direc, strerror(errno)); rc = RC_FX; } // endif dir @@ -1298,7 +1298,7 @@ int TDBSDR::ReadDB(PGLOBAL g) strcat(strcpy(Fpath, Direc), Entry->d_name); if (lstat(Fpath, &Fileinfo) < 0) { - sprintf(g->Message, "%s: %s", Fpath, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), "%s: %s", Fpath, strerror(errno)); rc = RC_FX; } else if (S_ISDIR(Fileinfo.st_mode) && strcmp(Entry->d_name, ".") && strcmp(Entry->d_name, "..")) { @@ -1419,7 +1419,7 @@ int TDBDHR::GetMaxSize(PGLOBAL g) FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)&filename, sizeof(filename), NULL); - sprintf(g->Message, MSG(BAD_FILE_HANDLE), filename); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FILE_HANDLE), filename); } // endswitch rc } else { @@ -1428,7 +1428,7 @@ int TDBDHR::GetMaxSize(PGLOBAL g) rc = GetLastError(); if (rc != ERROR_NO_MORE_FILES) { - sprintf(g->Message, MSG(NEXT_FILE_ERROR), rc); + snprintf(g->Message, sizeof(g->Message), MSG(NEXT_FILE_ERROR), rc); n = -1; } // endif rc @@ -1470,7 +1470,7 @@ bool TDBDHR::OpenDB(PGLOBAL g) /*********************************************************************/ if (NeedIndexing(g)) { // Direct access of DHR tables is not implemented yet - sprintf(g->Message, MSG(NO_DIR_INDX_RD), "DHR"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_DIR_INDX_RD), "DHR"); return true; } // endif NeedIndexing @@ -1511,7 +1511,7 @@ int TDBDHR::ReadDB(PGLOBAL g) FORMAT_MESSAGE_IGNORE_INSERTS, NULL, erc, 0, (LPTSTR)&filename, sizeof(filename), NULL); - sprintf(g->Message, MSG(BAD_FILE_HANDLE), filename); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FILE_HANDLE), filename); rc = RC_FX; } // endswitch erc @@ -1520,7 +1520,7 @@ int TDBDHR::ReadDB(PGLOBAL g) DWORD erc = GetLastError(); if (erc != ERROR_NO_MORE_FILES) { - sprintf(g->Message, MSG(NEXT_FILE_ERROR), erc); + snprintf(g->Message, sizeof(g->Message), MSG(NEXT_FILE_ERROR), erc); FindClose(Hsearch); rc = RC_FX; } else diff --git a/storage/connect/tabmul.h b/storage/connect/tabmul.h index a9d3f88cc441d..a01e4e7fdf29a 100644 --- a/storage/connect/tabmul.h +++ b/storage/connect/tabmul.h @@ -237,7 +237,7 @@ class DIRCOL : public COLBLK { protected: // Default constructor not to be used - DIRCOL(void) {} + DIRCOL(void) = default; #if defined(_WIN32) void SetTimeValue(PGLOBAL g, FILETIME& ftime); #endif // _WIN32 diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index b14b0b14231ee..7192b572309db 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -94,6 +94,7 @@ MYSQLDEF::MYSQLDEF(void) Isview = false; Bind = false; Delayed = false; + Ignored = false; //Xsrc = false; Huge = false; } // end of MYSQLDEF constructor @@ -321,6 +322,9 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int) Desc = "MySQL Table"; + Delayed = !!GetIntCatInfo("Delayed", 0); + Ignored = !!GetIntCatInfo("Ignored", 0); + if (stricmp(am, "MYPRX")) { // Normal case of specific MYSQL table url = GetStringCatInfo(g, "Connect", NULL); @@ -339,7 +343,6 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int) return true; Bind = !!GetIntCatInfo("Bind", 0); - Delayed = !!GetIntCatInfo("Delayed", 0); } else { // MYSQL access from a PROXY table TABLE_SHARE* s; @@ -425,6 +428,7 @@ TDBMYSQL::TDBMYSQL(PMYDEF tdp) : TDBEXT(tdp) Isview = tdp->Isview; Prep = tdp->Bind; Delayed = tdp->Delayed; + Ignored = tdp->Ignored; Myc.m_Use = tdp->Huge; } else { Host = NULL; @@ -440,6 +444,7 @@ TDBMYSQL::TDBMYSQL(PMYDEF tdp) : TDBEXT(tdp) Isview = false; Prep = false; Delayed = false; + Ignored = false; } // endif tdp Bind = NULL; @@ -466,6 +471,7 @@ TDBMYSQL::TDBMYSQL(PTDBMY tdbp) : TDBEXT(tdbp) Isview = tdbp->Isview; Prep = tdbp->Prep; Delayed = tdbp->Delayed; + Ignored = tdbp->Ignored; Bind = NULL; //Query = tdbp->Query; Fetched = tdbp->Fetched; @@ -623,11 +629,13 @@ bool TDBMYSQL::MakeInsert(PGLOBAL g) len += (strlen(TableName) + 40); Query = new(g) STRING(g, len); + Query->Set("INSERT "); if (Delayed) - Query->Set("INSERT DELAYED INTO "); - else - Query->Set("INSERT INTO "); + Query->Append("DELAYED "); + if (Ignored) + Query->Append("IGNORE "); + Query->Append("INTO "); Query->Append(tk); Query->Append(TableName); Query->Append("` ("); @@ -704,7 +712,7 @@ bool TDBMYSQL::MakeCommand(PGLOBAL g) strlwr(strcpy(qrystr, Query->GetStr())); } else { - sprintf(g->Message, "Cannot use this %s command", + snprintf(g->Message, sizeof(g->Message), "Cannot use this %s command", (Mode == MODE_UPDATE) ? "UPDATE" : "DELETE"); return true; } // endif p @@ -904,12 +912,17 @@ bool TDBMYSQL::OpenDB(PGLOBAL g) /*********************************************************************/ if (Mode == MODE_READ || Mode == MODE_READX) { MakeSelect(g, Mode == MODE_READX); + if (Mode == MODE_READ && !Query) + { + Myc.Close(); + return true; + } m_Rc = (Mode == MODE_READ) ? Myc.ExecSQL(g, Query->GetStr()) : RC_OK; #if 0 if (!Myc.m_Res || !Myc.m_Fields) { - sprintf(g->Message, "%s result", (Myc.m_Res) ? "Void" : "No"); + snprintf(g->Message, sizeof(g->Message), "%s result", (Myc.m_Res) ? "Void" : "No"); Myc.Close(); return true; } // endif m_Res @@ -941,15 +954,6 @@ bool TDBMYSQL::OpenDB(PGLOBAL g) } // endif MakeInsert - if (m_Rc != RC_FX) { - char cmd[64]; - int w; - - sprintf(cmd, "ALTER TABLE `%s` DISABLE KEYS", TableName); - - m_Rc = Myc.ExecSQL(g, cmd, &w); // may fail for some engines - } // endif m_Rc - } else // m_Rc = (Mode == MODE_DELETE) ? MakeDelete(g) : MakeUpdate(g); m_Rc = (MakeCommand(g)) ? RC_FX : RC_OK; @@ -1007,7 +1011,7 @@ PCOL TDBMYSQL::MakeFieldColumn(PGLOBAL g, char *name) } // endfor n if (!colp) - sprintf(g->Message, "Column %s is not in view", name); + snprintf(g->Message, sizeof(g->Message), "Column %s is not in view", name); return colp; } // end of MakeFieldColumn @@ -1044,7 +1048,7 @@ int TDBMYSQL::SendCommand(PGLOBAL g) if (Myc.ExecSQLcmd(g, Query->GetStr(), &w) == RC_NF) { AftRows = Myc.m_Afrw; - sprintf(g->Message, "%s: %d affected rows", TableName, AftRows); + snprintf(g->Message, sizeof(g->Message), "%s: %d affected rows", TableName, AftRows); PushWarning(g, this, 0); // 0 means a Note if (trace(1)) @@ -1053,7 +1057,7 @@ int TDBMYSQL::SendCommand(PGLOBAL g) if (w && Myc.ExecSQL(g, "SHOW WARNINGS") == RC_OK) { // We got warnings from the remote server while (Myc.Fetch(g, -1) == RC_OK) { - sprintf(g->Message, "%s: (%s) %s", TableName, + snprintf(g->Message, sizeof(g->Message), "%s: (%s) %s", TableName, Myc.GetCharField(1), Myc.GetCharField(2)); PushWarning(g, this); } // endwhile Fetch @@ -1211,16 +1215,6 @@ int TDBMYSQL::DeleteDB(PGLOBAL g, int irc) void TDBMYSQL::CloseDB(PGLOBAL g) { if (Myc.Connected()) { - if (Mode == MODE_INSERT) { - char cmd[64]; - int w; - PDBUSER dup = PlgGetUser(g); - - dup->Step = "Enabling indexes"; - sprintf(cmd, "ALTER TABLE `%s` ENABLE KEYS", TableName); - Myc.m_Rows = -1; // To execute the query - m_Rc = Myc.ExecSQL(g, cmd, &w); // May fail for some engines - } // endif m_Rc Myc.Close(); } // endif Myc @@ -1316,7 +1310,7 @@ bool MYSQLCOL::FindRank(PGLOBAL g) return false; } // endif Name - sprintf(g->Message, "Column %s not in result set", Name); + snprintf(g->Message, sizeof(g->Message), "Column %s not in result set", Name); return true; } // end of FindRank @@ -1326,7 +1320,7 @@ bool MYSQLCOL::FindRank(PGLOBAL g) bool MYSQLCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) { if (!(To_Val = value)) { - sprintf(g->Message, MSG(VALUE_ERROR), Name); + snprintf(g->Message, sizeof(g->Message), MSG(VALUE_ERROR), Name); return true; } else if (Buf_Type == value->GetType()) { // Values are of the (good) column type @@ -1345,7 +1339,7 @@ bool MYSQLCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) } else { // Values are not of the (good) column type if (check) { - sprintf(g->Message, MSG(TYPE_VALUE_ERR), Name, + snprintf(g->Message, sizeof(g->Message), MSG(TYPE_VALUE_ERR), Name, GetTypeName(Buf_Type), GetTypeName(value->GetType())); return true; } // endif check @@ -1408,7 +1402,7 @@ void MYSQLCOL::ReadColumn(PGLOBAL g) { if ((rc = tdbp->Myc.Fetch(g, tdbp->N)) != RC_OK) { if (rc == RC_EF) - sprintf(g->Message, MSG(INV_DEF_READ), rc); + snprintf(g->Message, sizeof(g->Message), MSG(INV_DEF_READ), rc); throw 11; } else @@ -1426,7 +1420,7 @@ void MYSQLCOL::ReadColumn(PGLOBAL g) p = buf; if (Value->SetValue_char(p, strlen(p))) { - sprintf(g->Message, "Out of range value for column %s at row %d", + snprintf(g->Message, sizeof(g->Message), "Out of range value for column %s at row %d", Name, tdbp->RowNumber(g)); PushWarning(g, tdbp); } // endif SetValue_char diff --git a/storage/connect/tabmysql.h b/storage/connect/tabmysql.h index 4b61c7eb762ee..b5af77de50ba3 100644 --- a/storage/connect/tabmysql.h +++ b/storage/connect/tabmysql.h @@ -60,6 +60,7 @@ class MYSQLDEF : public EXTDEF {/* Logical table description */ bool Isview; /* true if this table is a MySQL view */ bool Bind; /* Use prepared statement on insert */ bool Delayed; /* Delayed insert */ + bool Ignored; /* Use insert IGNORE */ //bool Xsrc; /* Execution type */ bool Huge; /* True for big table */ }; // end of MYSQLDEF @@ -132,6 +133,7 @@ class TDBMYSQL : public TDBEXT { bool Isview; // True if this table is a MySQL view bool Prep; // Use prepared statement on insert bool Delayed; // Use delayed insert + bool Ignored; // Use insert IGNORE int m_Rc; // Return code from command //int AftRows; // The number of affected rows int N; // The current table index diff --git a/storage/connect/taboccur.cpp b/storage/connect/taboccur.cpp index 718b8a066d169..fabbf65526ef7 100644 --- a/storage/connect/taboccur.cpp +++ b/storage/connect/taboccur.cpp @@ -361,7 +361,7 @@ bool TDBOCCUR::MakeColumnList(PGLOBAL g) for (i = 0, pn = Colist; i < Mult; i++, pn += (strlen(pn) + 1)) { if (!(Col[i] = Tdbp->ColDB(g, pn, 0))) { // Column not found in table - sprintf(g->Message, MSG(COL_ISNOT_TABLE), pn, Tabname); + snprintf(g->Message, sizeof(g->Message), MSG(COL_ISNOT_TABLE), pn, Tabname); return true; } // endif Col @@ -409,7 +409,7 @@ bool TDBOCCUR::ViewColumnList(PGLOBAL g) for (i = 0, pn = Colist; i < Mult; i++, pn += (strlen(pn) + 1)) if (!(Col[i] = tdbp->MakeFieldColumn(g, pn))) { // Column not found in table - sprintf(g->Message, MSG(COL_ISNOT_TABLE), pn, Tabname); + snprintf(g->Message, sizeof(g->Message), MSG(COL_ISNOT_TABLE), pn, Tabname); return true; } // endif Col diff --git a/storage/connect/taboccur.h b/storage/connect/taboccur.h index 13bc055cd6fb8..8cd507acb7d42 100644 --- a/storage/connect/taboccur.h +++ b/storage/connect/taboccur.h @@ -99,7 +99,7 @@ class OCCURCOL : public COLBLK { protected: // Default constructor not to be used - OCCURCOL(void) {} + OCCURCOL(void) = default; // Members int I; @@ -121,7 +121,7 @@ class RANKCOL : public COLBLK { protected: // Default constructor not to be used - RANKCOL(void) {} + RANKCOL(void) = default; // Members }; // end of class RANKCOL diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp index 4e8b4417a33a2..d60cd03995194 100644 --- a/storage/connect/tabodbc.cpp +++ b/storage/connect/tabodbc.cpp @@ -109,7 +109,7 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) Desc = Connect = GetStringCatInfo(g, "Connect", NULL); if (!Connect && !Catfunc) { - sprintf(g->Message, "Missing connection for ODBC table %s", Name); + snprintf(g->Message, sizeof(g->Message), "Missing connection for ODBC table %s", Name); return true; } // endif Connect @@ -553,7 +553,7 @@ bool TDBODBC::OpenDB(PGLOBAL g) if (Memory < 3) { // Method will depend on cursor type - if ((Rbuf = Ocp->Rewind(Query->GetStr(), (PODBCCOL)Columns)) < 0) { + if (Query && (Rbuf = Ocp->Rewind(Query->GetStr(), (PODBCCOL)Columns)) < 0) { if (Mode != MODE_READX) { Ocp->Close(); return true; @@ -605,7 +605,7 @@ bool TDBODBC::OpenDB(PGLOBAL g) if ((n = Ocp->GetResultSize(Query->GetStr(), Cnp)) < 0) { char* msg = PlugDup(g, g->Message); - sprintf(g->Message, "Get result size: %s (rc=%d)", msg, n); + snprintf(g->Message, sizeof(g->Message), "Get result size: %s (rc=%d)", msg, n); return true; } else if (n) { Ocp->m_Rows = n; @@ -650,7 +650,7 @@ bool TDBODBC::OpenDB(PGLOBAL g) } else if (Mode == MODE_UPDATE || Mode == MODE_DELETE) { rc = false; // wait for CheckCond before calling MakeCommand(g); } else - sprintf(g->Message, "Invalid mode %d", Mode); + snprintf(g->Message, sizeof(g->Message), "Invalid mode %d", Mode); if (rc) { Ocp->Close(); @@ -775,7 +775,7 @@ int TDBODBC::ReadDB(PGLOBAL g) // Send the UPDATE/DELETE command to the remote table if (!Ocp->ExecSQLcommand(Query->GetStr())) { - sprintf(g->Message, "%s: %d affected rows", TableName, AftRows); + snprintf(g->Message, sizeof(g->Message), "%s: %d affected rows", TableName, AftRows); if (trace(1)) htrc("%s\n", g->Message); @@ -851,7 +851,7 @@ int TDBODBC::DeleteDB(PGLOBAL g, int irc) // Send the DELETE (all) command to the remote table if (!Ocp->ExecSQLcommand(Query->GetStr())) { - sprintf(g->Message, "%s: %d affected rows", TableName, AftRows); + snprintf(g->Message, sizeof(g->Message), "%s: %d affected rows", TableName, AftRows); if (trace(1)) htrc("%s\n", g->Message); diff --git a/storage/connect/tabpivot.cpp b/storage/connect/tabpivot.cpp index 5ba4b51152883..ba9b903399d94 100644 --- a/storage/connect/tabpivot.cpp +++ b/storage/connect/tabpivot.cpp @@ -193,7 +193,7 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g) *pcrp = crp->Next; } else if (!stricmp(Picol, crp->Name)) { if (crp->Nulls) { - sprintf(g->Message, "Pivot column %s cannot be nullable", Picol); + snprintf(g->Message, sizeof(g->Message), "Pivot column %s cannot be nullable", Picol); goto err; } // endif Nulls @@ -549,14 +549,14 @@ bool TDBPIVOT::MakePivotColumns(PGLOBAL g) // Now it is time to allocate the pivot and function columns if (!(Fcolp = Tdbp->ColDB(g, Fncol, 0))) { // Function column not found in table - sprintf(g->Message, MSG(COL_ISNOT_TABLE), Fncol, Tabname); + snprintf(g->Message, sizeof(g->Message), MSG(COL_ISNOT_TABLE), Fncol, Tabname); return true; } else if (Fcolp->InitValue(g)) return true; if (!(Xcolp = Tdbp->ColDB(g, Picol, 0))) { // Pivot column not found in table - sprintf(g->Message, MSG(COL_ISNOT_TABLE), Picol, Tabname); + snprintf(g->Message, sizeof(g->Message), MSG(COL_ISNOT_TABLE), Picol, Tabname); return true; } else if (Xcolp->InitValue(g)) return true; @@ -670,7 +670,7 @@ bool TDBPIVOT::OpenDB(PGLOBAL g) /*******************************************************************/ /* Currently PIVOT tables cannot be modified. */ /*******************************************************************/ - sprintf(g->Message, MSG(TABLE_READ_ONLY), "PIVOT"); + snprintf(g->Message, sizeof(g->Message), MSG(TABLE_READ_ONLY), "PIVOT"); return TRUE; } // endif Mode @@ -799,7 +799,7 @@ int TDBPIVOT::ReadDB(PGLOBAL g) /***********************************************************************/ int TDBPIVOT::WriteDB(PGLOBAL g) { - sprintf(g->Message, MSG(TABLE_READ_ONLY), "PIVOT"); + snprintf(g->Message, sizeof(g->Message), MSG(TABLE_READ_ONLY), "PIVOT"); return RC_FX; } // end of WriteDB @@ -808,7 +808,7 @@ int TDBPIVOT::WriteDB(PGLOBAL g) /***********************************************************************/ int TDBPIVOT::DeleteDB(PGLOBAL g, int) { - sprintf(g->Message, MSG(NO_TABLE_DEL), "PIVOT"); + snprintf(g->Message, sizeof(g->Message), MSG(NO_TABLE_DEL), "PIVOT"); return RC_FX; } // end of DeleteDB diff --git a/storage/connect/tabpivot.h b/storage/connect/tabpivot.h index d819d55a61a31..0a37804ff87f8 100644 --- a/storage/connect/tabpivot.h +++ b/storage/connect/tabpivot.h @@ -188,7 +188,7 @@ class SRCCOL : public PRXCOL { protected: // Default constructor not to be used - SRCCOL(void) {} + SRCCOL(void) = default; // Members }; // end of class SRCCOL diff --git a/storage/connect/tabrest.cpp b/storage/connect/tabrest.cpp index d1975dae32dea..b38168622e9c8 100644 --- a/storage/connect/tabrest.cpp +++ b/storage/connect/tabrest.cpp @@ -88,7 +88,7 @@ int Xcurl(http://github.com/PGLOBAL%20g,%20PCSZ%20Http,%20PCSZ%20Uri,%20PCSZ%20filename) CloseHandle(pi.hProcess); CloseHandle(pi.hThread); } else { - sprintf(g->Message, "CreateProcess curl failed (%d)", GetLastError()); + snprintf(g->Message, sizeof(g->Message), "CreateProcess curl failed (%d)", GetLastError()); rc = 1; } // endif CreateProcess #else // !_WIN32 @@ -113,7 +113,11 @@ int Xcurl(http://github.com/PGLOBAL%20g,%20PCSZ%20Http,%20PCSZ%20Uri,%20PCSZ%20filename) } // endif f - pID = vfork(); +#ifdef HAVE_VFORK + pID = vfork(); +#else + pID = fork(); +#endif sprintf(fn, "-o%s", filename); if (pID == 0) { @@ -156,7 +160,7 @@ XGETREST GetRestFunction(PGLOBAL g) char buf[256]; DWORD rc = GetLastError(); - sprintf(g->Message, MSG(DLL_LOAD_ERROR), rc, soname); + snprintf(g->Message, sizeof(g->Message), MSG(DLL_LOAD_ERROR), rc, soname); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)buf, sizeof(buf), NULL); @@ -169,7 +173,7 @@ XGETREST GetRestFunction(PGLOBAL g) char buf[256]; DWORD rc = GetLastError(); - sprintf(g->Message, MSG(PROCADD_ERROR), rc, "restGetFile"); + snprintf(g->Message, sizeof(g->Message), MSG(PROCADD_ERROR), rc, "restGetFile"); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)buf, sizeof(buf), NULL); @@ -185,14 +189,14 @@ XGETREST GetRestFunction(PGLOBAL g) // Load the desired shared library if (!(Hso = dlopen(soname, RTLD_LAZY))) { error = dlerror(); - sprintf(g->Message, MSG(SHARED_LIB_ERR), soname, SVP(error)); + snprintf(g->Message, sizeof(g->Message), MSG(SHARED_LIB_ERR), soname, SVP(error)); return NULL; } // endif Hdll // Get the function returning an instance of the external DEF class if (!(getRestFnc = (XGETREST)dlsym(Hso, "restGetFile"))) { error = dlerror(); - sprintf(g->Message, MSG(GET_FUNC_ERR), "restGetFile", SVP(error)); + snprintf(g->Message, sizeof(g->Message), MSG(GET_FUNC_ERR), "restGetFile", SVP(error)); dlclose(Hso); return NULL; } // endif getdef @@ -236,7 +240,7 @@ PQRYRES RESTColumns(PGLOBAL g, PTOS tp, char *tab, char *db, bool info) fn = filename; tp->subtype = PlugDup(g, fn); - sprintf(g->Message, "No file name. Table will use %s", fn); + snprintf(g->Message, sizeof(g->Message), "No file name. Table will use %s", fn); PUSH_WARNING(g->Message); } // endif fn @@ -262,7 +266,7 @@ PQRYRES RESTColumns(PGLOBAL g, PTOS tp, char *tab, char *db, bool info) qrp = XMLColumns(g, db, tab, tp, info); #endif // XML_SUPPORT else - sprintf(g->Message, "Usupported file type %s", ftype); + snprintf(g->Message, sizeof(g->Message), "Usupported file type %s", ftype); return qrp; } // end of RESTColumns @@ -297,7 +301,7 @@ bool RESTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) if (n == 0) { htrc("DefineAM: Unsupported REST table type %s\n", ftype); - sprintf(g->Message, "Unsupported REST table type %s", ftype); + snprintf(g->Message, sizeof(g->Message), "Unsupported REST table type %s", ftype); return true; } // endif n diff --git a/storage/connect/tabsys.cpp b/storage/connect/tabsys.cpp index 9a8e4a9c56242..7d90b46727631 100644 --- a/storage/connect/tabsys.cpp +++ b/storage/connect/tabsys.cpp @@ -318,7 +318,7 @@ int TDBINI::DeleteDB(PGLOBAL g, int irc) case RC_FX: while (ReadDB(g) == RC_OK) if (!WritePrivateProfileString(Section, NULL, NULL, Ifile)) { - sprintf(g->Message, "Error %d accessing %s", + snprintf(g->Message, sizeof(g->Message), "Error %d accessing %s", GetLastError(), Ifile); return RC_FX; } // endif @@ -330,7 +330,7 @@ int TDBINI::DeleteDB(PGLOBAL g, int irc) return RC_FX; } else if (!WritePrivateProfileString(Section, NULL, NULL, Ifile)) { - sprintf(g->Message, "Error %d accessing %s", + snprintf(g->Message, sizeof(g->Message), "Error %d accessing %s", GetLastError(), Ifile); return RC_FX; } // endif rc @@ -401,7 +401,7 @@ void INICOL::AllocBuf(PGLOBAL g) bool INICOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) { if (!(To_Val = value)) { - sprintf(g->Message, MSG(VALUE_ERROR), Name); + snprintf(g->Message, sizeof(g->Message), MSG(VALUE_ERROR), Name); return true; } else if (Buf_Type == value->GetType()) { // Values are of the (good) column type @@ -420,7 +420,7 @@ bool INICOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) } else { // Values are not of the (good) column type if (check) { - sprintf(g->Message, MSG(TYPE_VALUE_ERR), Name, + snprintf(g->Message, sizeof(g->Message), MSG(TYPE_VALUE_ERR), Name, GetTypeName(Buf_Type), GetTypeName(value->GetType())); return true; } // endif check @@ -510,7 +510,7 @@ void INICOL::WriteColumn(PGLOBAL g) p = Value->GetCharString(Valbuf); if (strlen(p) > (unsigned)Long) { - sprintf(g->Message, MSG(VALUE_TOO_LONG), p, Name, Long); + snprintf(g->Message, sizeof(g->Message), MSG(VALUE_TOO_LONG), p, Name, Long); throw 31; } else if (Flag == 1) { if (tdbp->Mode == MODE_UPDATE) { @@ -534,7 +534,7 @@ void INICOL::WriteColumn(PGLOBAL g) rc = WritePrivateProfileString(tdbp->Section, Name, p, tdbp->Ifile); if (!rc) { - sprintf(g->Message, "Error %d writing to %s", + snprintf(g->Message, sizeof(g->Message), "Error %d writing to %s", GetLastError(), tdbp->Ifile); throw 31; } // endif rc @@ -746,7 +746,7 @@ int TDBXIN::DeleteDB(PGLOBAL g, int irc) } else if (irc == RC_FX) { for (Section = Seclist; *Section; Section += (strlen(Section) + 1)) if (!WritePrivateProfileString(Section, NULL, NULL, Ifile)) { - sprintf(g->Message, "Error %d accessing %s", + snprintf(g->Message, sizeof(g->Message), "Error %d accessing %s", GetLastError(), Ifile); return RC_FX; } // endif @@ -756,7 +756,7 @@ int TDBXIN::DeleteDB(PGLOBAL g, int irc) return RC_FX; } else if (!WritePrivateProfileString(Section, Keycur, NULL, Ifile)) { - sprintf(g->Message, "Error %d accessing %s", + snprintf(g->Message, sizeof(g->Message), "Error %d accessing %s", GetLastError(), Ifile); return RC_FX; } // endif @@ -836,7 +836,7 @@ void XINCOL::WriteColumn(PGLOBAL g) p = Value->GetCharString(Valbuf); if (strlen(p) > (unsigned)Long) { - sprintf(g->Message, MSG(VALUE_TOO_LONG), p, Name, Long); + snprintf(g->Message, sizeof(g->Message), MSG(VALUE_TOO_LONG), p, Name, Long); throw 31; } else if (Flag == 1) { if (tdbp->Mode == MODE_UPDATE) { @@ -870,7 +870,7 @@ void XINCOL::WriteColumn(PGLOBAL g) rc = WritePrivateProfileString(tdbp->Section, tdbp->Keycur, p, tdbp->Ifile); if (!rc) { - sprintf(g->Message, "Error %d writing to %s", + snprintf(g->Message, sizeof(g->Message), "Error %d writing to %s", GetLastError(), tdbp->Ifile); throw 31; } // endif rc diff --git a/storage/connect/tabsys.h b/storage/connect/tabsys.h index 0c6017af177ee..0a427b12daea1 100644 --- a/storage/connect/tabsys.h +++ b/storage/connect/tabsys.h @@ -108,7 +108,7 @@ class INICOL : public COLBLK { protected: // Default constructor not to be used - INICOL(void) {} + INICOL(void) = default; // Members char *Valbuf; // To the key value buffer @@ -176,7 +176,7 @@ class XINCOL : public INICOL { protected: // Default constructor not to be used - XINCOL(void) {} + XINCOL(void) = default; // Members }; // end of class XINICOL diff --git a/storage/connect/tabtbl.cpp b/storage/connect/tabtbl.cpp index b6277088bac24..607e7d131f316 100644 --- a/storage/connect/tabtbl.cpp +++ b/storage/connect/tabtbl.cpp @@ -230,7 +230,6 @@ PCOL TDBTBL::InsertSpecialColumn(PCOL scp) /***********************************************************************/ bool TDBTBL::InitTableList(PGLOBAL g) { - int n; uint sln; const char *scs; PTABLE tp, tabp; @@ -243,7 +242,7 @@ bool TDBTBL::InitTableList(PGLOBAL g) sln = hc->get_table()->s->connect_string.length; // PlugSetPath(filename, Tdbp->GetFile(g), Tdbp->GetPath()); - for (n = 0, tp = tdp->Tablep; tp; tp = tp->GetNext()) { + for (tp = tdp->Tablep; tp; tp = tp->GetNext()) { if (TestFil(g, To_CondFil, tp)) { tabp = new(g) XTAB(tp); @@ -276,7 +275,6 @@ bool TDBTBL::InitTableList(PGLOBAL g) else Tablist = tabp; - n++; } // endif filp } // endfor tp @@ -691,7 +689,7 @@ bool TDBTBM::OpenTables(PGLOBAL g) // pthread_attr_setdetachstate(&tp->attr, PTHREAD_CREATE_JOINABLE); if ((k = pthread_create(&tp->Tid, &tp->attr, ThreadOpen, tp))) { - sprintf(g->Message, "pthread_create error %d", k); + snprintf(g->Message, sizeof(g->Message), "pthread_create error %d", k); Nbc++; continue; } // endif k diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp index 9730f8a698190..b2ec19ebfd5c3 100644 --- a/storage/connect/tabutil.cpp +++ b/storage/connect/tabutil.cpp @@ -109,7 +109,7 @@ TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db, if (thd->is_error()) thd->clear_error(); // Avoid stopping info commands - sprintf(g->Message, "Error %d opening share\n", s->error); + snprintf(g->Message, sizeof(g->Message), "Error %d opening share\n", s->error); free_table_share(s); return NULL; } // endif open_table_def @@ -204,19 +204,19 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, if ((type = MYSQLtoPLG(fp->type(), &v)) == TYPE_ERROR) { if (v == 'K') { // Skip this column - sprintf(g->Message, "Column %s skipped (unsupported type)", colname); + snprintf(g->Message, sizeof(g->Message), "Column %s skipped (unsupported type)", colname); push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message); continue; } // endif v - sprintf(g->Message, "Column %s unsupported type", colname); + snprintf(g->Message, sizeof(g->Message), "Column %s unsupported type", colname); qrp = NULL; break; } // endif type if (v == 'X') { len = zconv; - sprintf(g->Message, "Column %s converted to varchar(%d)", + snprintf(g->Message, sizeof(g->Message), "Column %s converted to varchar(%d)", colname, len); push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message); } // endif v @@ -411,7 +411,7 @@ PTDB TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b) cdb = (tp->Schema) ? tp->Schema : curdb; if (!stricmp(name, tp->Name) && !stricmp(db, cdb)) { - sprintf(g->Message, "Table %s.%s pointing on itself", db, name); + snprintf(g->Message, sizeof(g->Message), "Table %s.%s pointing on itself", db, name); return NULL; } // endif @@ -441,7 +441,7 @@ PTDB TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b) char buf[MAX_STR]; strcpy(buf, g->Message); - snprintf(g->Message, MAX_STR, "Error accessing %s.%s: %s", db, name, buf); + snprintf(g->Message, sizeof(g->Message), "Error accessing %s.%s: %s", db, name, buf); hc->tshp = NULL; goto err; } // endif Define @@ -578,7 +578,7 @@ bool TDBPRX::OpenDB(PGLOBAL g) PTDB utp; if (!(utp= Tdbp->Duplicate(g))) { - sprintf(g->Message, MSG(INV_UPDT_TABLE), Tdbp->GetName()); + snprintf(g->Message, sizeof(g->Message), MSG(INV_UPDT_TABLE), Tdbp->GetName()); return true; } // endif tp @@ -721,7 +721,7 @@ bool PRXCOL::Init(PGLOBAL g, PTDB tp) // this may be needed by some tables (which?) Colp->SetColUse(ColUse); } else { - sprintf(g->Message, MSG(NO_MATCHING_COL), Name, tp->GetName()); + snprintf(g->Message, sizeof(g->Message), MSG(NO_MATCHING_COL), Name, tp->GetName()); return true; } // endif Colp diff --git a/storage/connect/tabutil.h b/storage/connect/tabutil.h index c8e7e75106f3c..6cf2b11632b5f 100644 --- a/storage/connect/tabutil.h +++ b/storage/connect/tabutil.h @@ -122,7 +122,7 @@ class DllExport PRXCOL : public COLBLK { char *Decode(PGLOBAL g, const char *cnm); // Default constructor not to be used - PRXCOL(void) {} + PRXCOL(void) = default; // Members PCOL Colp; // Points to matching table column diff --git a/storage/connect/tabvct.h b/storage/connect/tabvct.h index 189a9ae222190..06ccde71bcb50 100644 --- a/storage/connect/tabvct.h +++ b/storage/connect/tabvct.h @@ -110,7 +110,7 @@ class DllExport VCTCOL : public DOSCOL { virtual void ReadBlock(PGLOBAL g); virtual void WriteBlock(PGLOBAL g); - VCTCOL(void) {} // Default constructor not to be used + VCTCOL(void) = default; // Default constructor not to be used // Members PVBLK Blk; // Block buffer diff --git a/storage/connect/tabvir.cpp b/storage/connect/tabvir.cpp index 2fdb7f6474451..0c4a41be3c3f9 100644 --- a/storage/connect/tabvir.cpp +++ b/storage/connect/tabvir.cpp @@ -251,7 +251,7 @@ int TDBVIR::ReadDB(PGLOBAL) /***********************************************************************/ int TDBVIR::WriteDB(PGLOBAL g) { - sprintf(g->Message, MSG(VIR_READ_ONLY), To_Def->GetType()); + snprintf(g->Message, sizeof(g->Message), MSG(VIR_READ_ONLY), To_Def->GetType()); return RC_FX; } // end of WriteDB @@ -260,7 +260,7 @@ int TDBVIR::WriteDB(PGLOBAL g) /***********************************************************************/ int TDBVIR::DeleteDB(PGLOBAL g, int) { - sprintf(g->Message, MSG(VIR_NO_DELETE), To_Def->GetType()); + snprintf(g->Message, sizeof(g->Message), MSG(VIR_NO_DELETE), To_Def->GetType()); return RC_FX; } // end of DeleteDB @@ -288,7 +288,7 @@ VIRCOL::VIRCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ) void VIRCOL::ReadColumn(PGLOBAL g) { // This should never be called - sprintf(g->Message, "ReadColumn: Column %s is not virtual", Name); + snprintf(g->Message, sizeof(g->Message), "ReadColumn: Column %s is not virtual", Name); throw (int)TYPE_COLBLK; } // end of ReadColumn diff --git a/storage/connect/tabvir.h b/storage/connect/tabvir.h index e7313bbae67a8..b92ca0c50f8e1 100644 --- a/storage/connect/tabvir.h +++ b/storage/connect/tabvir.h @@ -21,7 +21,7 @@ PQRYRES VirColumns(PGLOBAL g, bool info); class DllExport VIRDEF : public TABDEF { /* Logical table description */ public: // Constructor - VIRDEF(void) {} + VIRDEF(void) = default; // Implementation virtual const char *GetType(void) {return "VIRTUAL";} @@ -86,7 +86,7 @@ class VIRCOL : public COLBLK { protected: // Default constructor not to be used - VIRCOL(void) {} + VIRCOL(void) = default; // No additional members }; // end of class VIRCOL diff --git a/storage/connect/tabwmi.cpp b/storage/connect/tabwmi.cpp index a6aab7d256330..935d21c59c967 100644 --- a/storage/connect/tabwmi.cpp +++ b/storage/connect/tabwmi.cpp @@ -62,7 +62,7 @@ PWMIUT InitWMI(PGLOBAL g, PCSZ nsp, PCSZ classname) res = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (FAILED(res)) { - sprintf(g->Message, "Failed to initialize COM library. " + snprintf(g->Message, sizeof(g->Message), "Failed to initialize COM library. " "Error code = %x", res); return NULL; } // endif res @@ -74,7 +74,7 @@ PWMIUT InitWMI(PGLOBAL g, PCSZ nsp, PCSZ classname) NULL, EOAC_NONE, NULL); if (res != RPC_E_TOO_LATE && FAILED(res)) { - sprintf(g->Message, "Failed to initialize security. " + snprintf(g->Message, sizeof(g->Message), "Failed to initialize security. " "Error code = %p", res); CoUninitialize(); return NULL; @@ -85,7 +85,7 @@ PWMIUT InitWMI(PGLOBAL g, PCSZ nsp, PCSZ classname) CLSCTX_INPROC_SERVER, IID_IWbemLocator, (void**) &loc); if (FAILED(res)) { - sprintf(g->Message, "Failed to create Locator. " + snprintf(g->Message, sizeof(g->Message), "Failed to create Locator. " "Error code = %x", res); CoUninitialize(); return NULL; @@ -95,7 +95,7 @@ PWMIUT InitWMI(PGLOBAL g, PCSZ nsp, PCSZ classname) NULL, NULL, NULL, 0, NULL, NULL, &wp->Svc); if (FAILED(res)) { - sprintf(g->Message, "Could not connect. Error code = %x", res); + snprintf(g->Message, sizeof(g->Message), "Could not connect. Error code = %x", res); loc->Release(); CoUninitialize(); return NULL; @@ -119,7 +119,7 @@ PWMIUT InitWMI(PGLOBAL g, PCSZ nsp, PCSZ classname) res = wp->Svc->GetObject(bstr_t(p), 0, 0, &wp->Cobj, 0); if (FAILED(res)) { - sprintf(g->Message, "failed GetObject %s in %s\n", classname, nsp); + snprintf(g->Message, sizeof(g->Message), "failed GetObject %s in %s\n", classname, nsp); wp->Svc->Release(); wp->Svc = NULL; // MUST be set to NULL (why?) return NULL; @@ -164,12 +164,12 @@ PQRYRES WMIColumns(PGLOBAL g, PCSZ nsp, PCSZ cls, bool info) res = wp->Cobj->Get(bstr_t("__Property_Count"), 0, &val, NULL, NULL); if (FAILED(res)) { - sprintf(g->Message, "failed Get(__Property_Count) res=%d\n", res); + snprintf(g->Message, sizeof(g->Message), "failed Get(__Property_Count) res=%d\n", res); goto err; } // endif res if (!(n = val.lVal)) { - sprintf(g->Message, "Class %s in %s has no properties\n", + snprintf(g->Message, sizeof(g->Message), "Class %s in %s has no properties\n", cls, nsp); goto err; } // endif res @@ -182,7 +182,7 @@ PQRYRES WMIColumns(PGLOBAL g, PCSZ nsp, PCSZ cls, bool info) NULL, &prnlist); if (FAILED(res)) { - sprintf(g->Message, "failed GetNames res=%d\n", res); + snprintf(g->Message, sizeof(g->Message), "failed GetNames res=%d\n", res); goto err; } // endif res @@ -194,7 +194,7 @@ PQRYRES WMIColumns(PGLOBAL g, PCSZ nsp, PCSZ cls, bool info) res = SafeArrayGetElement(prnlist, &i, &propname); if (FAILED(res)) { - sprintf(g->Message, "failed GetArrayElement res=%d\n", res); + snprintf(g->Message, sizeof(g->Message), "failed GetArrayElement res=%d\n", res); goto err; } // endif res @@ -221,7 +221,7 @@ PQRYRES WMIColumns(PGLOBAL g, PCSZ nsp, PCSZ cls, bool info) res = wp->Cobj->BeginEnumeration(WBEM_FLAG_NONSYSTEM_ONLY); if (FAILED(res)) { - sprintf(g->Message, "failed BeginEnumeration hr=%d\n", res); + snprintf(g->Message, sizeof(g->Message), "failed BeginEnumeration hr=%d\n", res); qrp = NULL; goto err; } // endif hr @@ -230,7 +230,7 @@ PQRYRES WMIColumns(PGLOBAL g, PCSZ nsp, PCSZ cls, bool info) res = wp->Cobj->Next(0, &propname, &val, &type, NULL); if (FAILED(res)) { - sprintf(g->Message, "failed getting Next hr=%d\n", res); + snprintf(g->Message, sizeof(g->Message), "failed getting Next hr=%d\n", res); qrp = NULL; goto err; } else if (res == WBEM_S_NO_MORE_DATA) { @@ -340,7 +340,7 @@ bool WMIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) !stricmp(Nspace, "root\\cli") ? "Msft_CliAlias" : "")); if (!*Wclass) { - sprintf(g->Message, "Missing class name for %s", Nspace); + snprintf(g->Message, sizeof(g->Message), "Missing class name for %s", Nspace); return true; } else if (!strchr(Wclass, '_')) { char *p = (char*)PlugSubAlloc(g, NULL, strlen(Wclass) + 7); @@ -363,7 +363,7 @@ PTDB WMIDEF::GetTable(PGLOBAL g, MODE m) else if (Catfunc == FNC_COL) return new(g) TDBWCL(this); - sprintf(g->Message, "Bad catfunc %ud for WMI", Catfunc); + snprintf(g->Message, sizeof(g->Message), "Bad catfunc %ud for WMI", Catfunc); return NULL; } // end of GetTable @@ -423,7 +423,7 @@ bool TDBWMI::Initialize(PGLOBAL g) Res = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (FAILED(Res)) { - sprintf(g->Message, "Failed to initialize COM library. " + snprintf(g->Message, sizeof(g->Message), "Failed to initialize COM library. " "Error code = %x", Res); return true; // Program has failed. } // endif Res @@ -436,8 +436,8 @@ bool TDBWMI::Initialize(PGLOBAL g) IID_IWbemLocator, (LPVOID*) &loc); if (FAILED(Res)) { - sprintf(g->Message, "Failed to create Locator. " - "Error code = %x", Res); + snprintf(g->Message, sizeof(g->Message), "Failed to create Locator. " + "Error code = %x", Res); CoUninitialize(); return true; // Program has failed. } // endif Res @@ -449,7 +449,7 @@ bool TDBWMI::Initialize(PGLOBAL g) NULL, NULL,0, NULL, 0, 0, &Svc); if (FAILED(Res)) { - sprintf(g->Message, "Could not connect. Error code = %x", Res); + snprintf(g->Message, sizeof(g->Message), "Could not connect. Error code = %x", Res); loc->Release(); CoUninitialize(); return true; // Program has failed. @@ -464,7 +464,7 @@ bool TDBWMI::Initialize(PGLOBAL g) RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE); if (FAILED(Res)) { - sprintf(g->Message, "Could not set proxy. Error code = %x", Res); + snprintf(g->Message, sizeof(g->Message), "Could not set proxy. Error code = %x", Res); Svc->Release(); CoUninitialize(); return true; // Program has failed. @@ -561,7 +561,7 @@ bool TDBWMI::GetWMIInfo(PGLOBAL g) char *cmd = MakeWQL(g); if (cmd == NULL) { - sprintf(g->Message, "Error making WQL statement"); + snprintf(g->Message, sizeof(g->Message), "Error making WQL statement"); Svc->Release(); CoUninitialize(); return true; // Program has failed. @@ -574,7 +574,7 @@ bool TDBWMI::GetWMIInfo(PGLOBAL g) NULL, &Enumerator); if (FAILED(Rc)) { - sprintf(g->Message, "Query %s failed. Error code = %x", cmd, Rc); + snprintf(g->Message, sizeof(g->Message), "Query %s failed. Error code = %x", cmd, Rc); Svc->Release(); CoUninitialize(); return true; // Program has failed. @@ -771,7 +771,7 @@ void WMICOL::ReadColumn(PGLOBAL g) break; case VT_I4: case VT_UI4: - Value->SetValue(Prop.lVal); + Value->SetValue((long long)Prop.lVal); break; case VT_I2: case VT_UI2: @@ -810,7 +810,7 @@ void WMICOL::ReadColumn(PGLOBAL g) char buf[24]; int rc = VariantTimeToSystemTime(Prop.date, &stm); - sprintf(buf, "%02d/%02d/%d %02d:%02d:%02d", + snprintf(buf, sizeof(buf), "%02d/%02d/%d %02d:%02d:%02d", stm.wDay, stm.wMonth, stm.wYear, stm.wHour, stm.wMinute, stm.wSecond); Value->SetValue_psz(buf); diff --git a/storage/connect/tabxcl.h b/storage/connect/tabxcl.h index 2ae967035484b..08beb5fe6ac01 100644 --- a/storage/connect/tabxcl.h +++ b/storage/connect/tabxcl.h @@ -95,7 +95,7 @@ class XCLCOL : public PRXCOL { protected: // Default constructor not to be used - XCLCOL(void) {} + XCLCOL(void) = default; // Members char *Cbuf; // The column buffer diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp index c56f2bea1103c..a5957178b605b 100644 --- a/storage/connect/tabxml.cpp +++ b/storage/connect/tabxml.cpp @@ -518,7 +518,7 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) defcol = "TD"; break; default: - sprintf(g->Message, MSG(INV_COL_TYPE), buf); + snprintf(g->Message, sizeof(g->Message), MSG(INV_COL_TYPE), buf); return true; } // endswitch typname @@ -783,7 +783,7 @@ int TDBXML::LoadTableFile(PGLOBAL g, char *filename) // Initialize the implementation if (Docp->Initialize(g, Entry, Zipped)) { - sprintf(g->Message, MSG(INIT_FAILED), (Usedom) ? "DOM" : "libxml2"); + snprintf(g->Message, sizeof(g->Message), MSG(INIT_FAILED), (Usedom) ? "DOM" : "libxml2"); return RC_FX; } // endif init @@ -873,7 +873,7 @@ bool TDBXML::Initialize(PGLOBAL g) // Evaluate table xpath if ((TabNode = Root->SelectSingleNode(g, tabpath))) { if (TabNode->GetType() != XML_ELEMENT_NODE) { - sprintf(g->Message, MSG(BAD_NODE_TYPE), TabNode->GetType()); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_NODE_TYPE), TabNode->GetType()); goto error; } // endif Type @@ -890,12 +890,12 @@ bool TDBXML::Initialize(PGLOBAL g) if (!(DBnode = Root->SelectSingleNode(g, tabpath))) { // DB node does not exist yet; we cannot create it // because we don't know where it should be placed - sprintf(g->Message, MSG(MISSING_NODE), XmlDB, Xfile); + snprintf(g->Message, sizeof(g->Message), MSG(MISSING_NODE), XmlDB, Xfile); goto error; } // endif DBnode if (!(TabNode = DBnode->AddChildNode(g, Tabname))) { - sprintf(g->Message, MSG(FAIL_ADD_NODE), Tabname); + snprintf(g->Message, sizeof(g->Message), MSG(FAIL_ADD_NODE), Tabname); goto error; } // endif TabNode @@ -940,7 +940,7 @@ bool TDBXML::Initialize(PGLOBAL g) goto error; } else { - sprintf(g->Message, MSG(FILE_UNFOUND), Xfile); + snprintf(g->Message, sizeof(g->Message), MSG(FILE_UNFOUND), Xfile); if (Mode == MODE_READ) { PushWarning(g, this); @@ -952,7 +952,7 @@ bool TDBXML::Initialize(PGLOBAL g) } else if (rc == RC_INFO) { // Loading failed - sprintf(g->Message, MSG(LOADING_FAILED), Xfile); + snprintf(g->Message, sizeof(g->Message), MSG(LOADING_FAILED), Xfile); goto error; } else // (rc == RC_FX) goto error; @@ -985,9 +985,9 @@ bool TDBXML::Initialize(PGLOBAL g) buf, sizeof(buf), NULL, NULL); if (rc) - sprintf(g->Message, "%s: %s", MSG(COM_ERROR), buf); + snprintf(g->Message, sizeof(g->Message), "%s: %s", MSG(COM_ERROR), buf); else - sprintf(g->Message, "%s hr=%x", MSG(COM_ERROR), e.Error()); + snprintf(g->Message, sizeof(g->Message), "%s hr=%x", MSG(COM_ERROR), e.Error()); goto error; #endif // _WIN32 @@ -1144,7 +1144,7 @@ int TDBXML::RowNumber(PGLOBAL g, bool b) /*******************************************************************/ /* Don't know how to retrieve RowID for expanded XML tables. */ /*******************************************************************/ - sprintf(g->Message, MSG(NO_ROWID_FOR_AM), + snprintf(g->Message, sizeof(g->Message), MSG(NO_ROWID_FOR_AM), GetAmName(g, GetAmType())); return 0; // Means error } else @@ -1266,7 +1266,7 @@ int TDBXML::ReadDB(PGLOBAL g) // Get the new row node if (Nlist) { if ((RowNode = Nlist->GetItem(g, Irow, RowNode)) == NULL) { - sprintf(g->Message, MSG(MISSING_ROWNODE), Irow); + snprintf(g->Message, sizeof(g->Message), MSG(MISSING_ROWNODE), Irow); return RC_FX; } // endif RowNode @@ -1333,7 +1333,7 @@ int TDBXML::DeleteDB(PGLOBAL g, int irc) // Delete all rows for (Irow = 0; Irow < Nrow; Irow++) if ((RowNode = Nlist->GetItem(g, Irow, RowNode)) == NULL) { - sprintf(g->Message, MSG(MISSING_ROWNODE), Irow); + snprintf(g->Message, sizeof(g->Message), MSG(MISSING_ROWNODE), Irow); return RC_FX; } else { TabNode->DeleteChild(g, RowNode); @@ -1519,13 +1519,17 @@ bool XMLCOL::ParseXpath(PGLOBAL g, bool mode) if (!mode) // Take care of an eventual extra column node a la html if (Tdbp->Colname) { - sprintf(pbuf, Tdbp->Colname, Rank + ((Tdbp->Usedom) ? 0 : 1)); - strcat(pbuf, "/"); - } // endif Colname + char *p = strstr(Tdbp->Colname, "%d"); + if (p) + snprintf(pbuf, len + 3, "%.*s%d%s/", (int) (p - Tdbp->Colname), Tdbp->Colname, + Rank + (Tdbp->Usedom ? 0 : 1), p + 2); + else + snprintf(pbuf, len + 3, "%s/", Tdbp->Colname); + } // endif Colname if (Xname) { if (Type == 2) { - sprintf(g->Message, MSG(BAD_COL_XPATH), Name, Tdbp->Name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_COL_XPATH), Name, Tdbp->Name); return true; } else strcat(pbuf, Xname); @@ -1557,7 +1561,7 @@ bool XMLCOL::ParseXpath(PGLOBAL g, bool mode) if (mode) { // For Update or Insert the Xpath must be explicit if (strchr("@/.*", *p)) { - sprintf(g->Message, MSG(XPATH_NOT_SUPP), Name); + snprintf(g->Message, sizeof(g->Message), MSG(XPATH_NOT_SUPP), Name); return true; } else Nodes[i] = p; @@ -1568,7 +1572,7 @@ bool XMLCOL::ParseXpath(PGLOBAL g, bool mode) } // endfor i, p if (*p == '/' || *p == '.') { - sprintf(g->Message, MSG(XPATH_NOT_SUPP), Name); + snprintf(g->Message, sizeof(g->Message), MSG(XPATH_NOT_SUPP), Name); return true; } else if (*p == '@') { p++; // Remove the @ if mode @@ -1629,7 +1633,7 @@ bool XMLCOL::ParseXpath(PGLOBAL g, bool mode) bool XMLCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) { if (!(To_Val = value)) { - sprintf(g->Message, MSG(VALUE_ERROR), Name); + snprintf(g->Message, sizeof(g->Message), MSG(VALUE_ERROR), Name); return true; } else if (Buf_Type == value->GetType()) { // Values are of the (good) column type @@ -1648,7 +1652,7 @@ bool XMLCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) } else { // Values are not of the (good) column type if (check) { - sprintf(g->Message, MSG(TYPE_VALUE_ERR), Name, + snprintf(g->Message, sizeof(g->Message), MSG(TYPE_VALUE_ERR), Name, GetTypeName(Buf_Type), GetTypeName(value->GetType())); return true; } // endif check @@ -1701,7 +1705,7 @@ void XMLCOL::ReadColumn(PGLOBAL g) if (ValNode) { if (ValNode->GetType() != XML_ELEMENT_NODE && ValNode->GetType() != XML_ATTRIBUTE_NODE) { - sprintf(g->Message, MSG(BAD_VALNODE), ValNode->GetType(), Name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_VALNODE), ValNode->GetType(), Name); throw (int)TYPE_AM_XML; } // endif type @@ -1811,6 +1815,9 @@ void XMLCOL::WriteColumn(PGLOBAL g) else if (Tdbp->Clist) ColNode = NULL; + // refresh CList in case its Listp was freed in SelectSingleNode above + if (Tdbp->Clist) + Tdbp->RowNode->SelectNodes(g, Tdbp->Colname, Tdbp->Clist); } // endfor i /*********************************************************************/ @@ -1867,7 +1874,7 @@ void XMLCOL::WriteColumn(PGLOBAL g) p = Value->GetCharString(buf); if (strlen(p) > (unsigned)Long) { - sprintf(g->Message, MSG(VALUE_TOO_LONG), p, Name, Long); + snprintf(g->Message, sizeof(g->Message), MSG(VALUE_TOO_LONG), p, Name, Long); throw (int)TYPE_AM_XML; } else strcpy(Valbuf, p); @@ -1908,7 +1915,7 @@ void XMULCOL::ReadColumn(PGLOBAL g) if (N > Tdbp->Limit) { N = Tdbp->Limit; - sprintf(g->Message, "Multiple values limited to %d", Tdbp->Limit); + snprintf(g->Message, sizeof(g->Message), "Multiple values limited to %d", Tdbp->Limit); PushWarning(g, Tdbp); } // endif N @@ -1917,7 +1924,7 @@ void XMULCOL::ReadColumn(PGLOBAL g) if (ValNode->GetType() != XML_ELEMENT_NODE && ValNode->GetType() != XML_ATTRIBUTE_NODE) { - sprintf(g->Message, MSG(BAD_VALNODE), ValNode->GetType(), Name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_VALNODE), ValNode->GetType(), Name); throw (int)TYPE_AM_XML; } // endif type @@ -2053,7 +2060,7 @@ void XMULCOL::WriteColumn(PGLOBAL g) len = Nlx->GetLength(); if (len > 1 && !Tdbp->Xpand) { - sprintf(g->Message, MSG(BAD_VAL_UPDATE), Name); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_VAL_UPDATE), Name); throw (int)TYPE_AM_XML; } else ValNode = Nlx->GetItem(g, Tdbp->Nsub, Vxnp); @@ -2128,7 +2135,7 @@ void XMULCOL::WriteColumn(PGLOBAL g) p = Value->GetCharString(buf); if (strlen(p) > (unsigned)Long) { - sprintf(g->Message, MSG(VALUE_TOO_LONG), p, Name, Long); + snprintf(g->Message, sizeof(g->Message), MSG(VALUE_TOO_LONG), p, Name, Long); throw (int)TYPE_AM_XML; } else strcpy(Valbuf, p); @@ -2255,7 +2262,7 @@ void XPOSCOL::WriteColumn(PGLOBAL g) p = Value->GetCharString(buf); if (strlen(p) > (unsigned)Long) { - sprintf(g->Message, MSG(VALUE_TOO_LONG), p, Name, Long); + snprintf(g->Message, sizeof(g->Message), MSG(VALUE_TOO_LONG), p, Name, Long); throw (int)TYPE_AM_XML; } else strcpy(Valbuf, p); diff --git a/storage/connect/tabzip.cpp b/storage/connect/tabzip.cpp index d9c13e2a58ad8..3f41bf9f0370b 100644 --- a/storage/connect/tabzip.cpp +++ b/storage/connect/tabzip.cpp @@ -85,7 +85,7 @@ bool TDBZIP::open(PGLOBAL g, const char *fn) PlugSetPath(filename, fn, GetPath()); if (!zipfile && !(zipfile = unzOpen64(filename))) - sprintf(g->Message, "Zipfile open error"); + snprintf(g->Message, sizeof(g->Message), "Zipfile open error"); return (zipfile == NULL); } // end of open @@ -155,7 +155,7 @@ int TDBZIP::ReadDB(PGLOBAL g) if (nexterr == UNZ_END_OF_LIST_OF_FILE) return RC_EF; else if (nexterr != UNZ_OK) { - sprintf(g->Message, "unzGoToNextFile error %d", nexterr); + snprintf(g->Message, sizeof(g->Message), "unzGoToNextFile error %d", nexterr); return RC_FX; } // endif nexterr @@ -163,7 +163,7 @@ int TDBZIP::ReadDB(PGLOBAL g) sizeof(fn), NULL, 0, NULL, 0); if (err != UNZ_OK) { - sprintf(g->Message, "unzGetCurrentFileInfo64 error %d", err); + snprintf(g->Message, sizeof(g->Message), "unzGetCurrentFileInfo64 error %d", err); return RC_FX; } // endif err diff --git a/storage/connect/tabzip.h b/storage/connect/tabzip.h index d36e4dc01d00f..3c16fae99bc94 100644 --- a/storage/connect/tabzip.h +++ b/storage/connect/tabzip.h @@ -23,7 +23,7 @@ class DllExport ZIPDEF : public DOSDEF { /* Table description */ friend class UNZFAM; public: // Constructor - ZIPDEF(void) {} + ZIPDEF(void) = default; // Implementation virtual const char *GetType(void) {return "ZIP";} @@ -94,7 +94,7 @@ class DllExport ZIPCOL : public COLBLK { protected: // Default constructor not to be used - ZIPCOL(void) {} + ZIPCOL(void) = default; // Members TDBZIP *Tdbz; diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp index 78dce431869fb..528c4abf3dbd2 100644 --- a/storage/connect/valblk.cpp +++ b/storage/connect/valblk.cpp @@ -105,7 +105,7 @@ PVBLK AllocValBlock(PGLOBAL g, void *mp, int type, int nval, int len, blkp = new(g) PTRBLK(g, mp, nval); break; default: - sprintf(g->Message, MSG(BAD_VALBLK_TYPE), type); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_VALBLK_TYPE), type); return NULL; } // endswitch Type @@ -138,7 +138,7 @@ PSZ VALBLK::GetCharValue(int) PGLOBAL& g = Global; assert(g); - sprintf(g->Message, MSG(NO_CHAR_FROM), Type); + snprintf(g->Message, sizeof(g->Message), MSG(NO_CHAR_FROM), Type); throw Type; return NULL; } // end of GetCharValue @@ -148,7 +148,7 @@ PSZ VALBLK::GetCharValue(int) /***********************************************************************/ bool VALBLK::SetFormat(PGLOBAL g, PCSZ, int, int) { - sprintf(g->Message, MSG(NO_DATE_FMT), Type); + snprintf(g->Message, sizeof(g->Message), MSG(NO_DATE_FMT), Type); return true; } // end of SetFormat @@ -191,7 +191,7 @@ bool VALBLK::AllocBuff(PGLOBAL g, size_t size) Mblk.Size = size; if (!(Blkp = PlgDBalloc(g, NULL, Mblk))) { - sprintf(g->Message, MSG(MEM_ALLOC_ERR), "Blkp", (int) Mblk.Size); + snprintf(g->Message, sizeof(g->Message), MSG(MEM_ALLOC_ERR), "Blkp", (int) Mblk.Size); fprintf(stderr, "%s\n", g->Message); return true; } // endif Blkp @@ -604,7 +604,7 @@ int TYPBLK::GetMaxLength(void) int i, n, m; for (i = n = 0; i < Nval; i++) { - m = sprintf(buf, Fmt, UnalignedRead(i)); + m = snprintf(buf, sizeof(buf), Fmt, UnalignedRead(i)); n = MY_MAX(n, m); } // endfor i @@ -1380,7 +1380,7 @@ PVBLK MBVALS::Allocate(PGLOBAL g, int type, int len, int prec, Mblk.Size = n * GetTypeSize(type, len); if (!PlgDBalloc(g, NULL, Mblk)) { - sprintf(g->Message, MSG(ALLOC_ERROR), "MBVALS::Allocate"); + snprintf(g->Message, sizeof(g->Message), MSG(ALLOC_ERROR), "MBVALS::Allocate"); return NULL; } else Vblk = AllocValBlock(g, Mblk.Memp, type, n, len, prec, @@ -1395,7 +1395,7 @@ PVBLK MBVALS::Allocate(PGLOBAL g, int type, int len, int prec, bool MBVALS::ReAllocate(PGLOBAL g, int n) { if (!PlgDBrealloc(g, NULL, Mblk, n * Vblk->GetVlen())) { - sprintf(g->Message, MSG(ALLOC_ERROR), "MBVALS::ReAllocate"); + snprintf(g->Message, sizeof(g->Message), MSG(ALLOC_ERROR), "MBVALS::ReAllocate"); return TRUE; } else Vblk->ReAlloc(Mblk.Memp, n); diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp index a34133a9b72da..7265b2ed0ca36 100644 --- a/storage/connect/value.cpp +++ b/storage/connect/value.cpp @@ -163,9 +163,9 @@ PCSZ GetTypeName(int type) /***********************************************************************/ /* GetTypeSize: returns the PlugDB internal type size. */ /***********************************************************************/ -int GetTypeSize(int type, int len) - { - switch (type) { +unsigned GetTypeSize(int type, unsigned len) +{ + switch (type) { case TYPE_DECIM: case TYPE_BIN: case TYPE_STRING: len = len * sizeof(char); break; @@ -176,7 +176,7 @@ int GetTypeSize(int type, int len) case TYPE_DOUBLE: len = sizeof(double); break; case TYPE_TINY: len = sizeof(char); break; case TYPE_PCHAR: len = sizeof(char*); break; - default: len = -1; + default: len = 0; } // endswitch type return len; @@ -360,7 +360,7 @@ PVAL AllocateValue(PGLOBAL g, void *value, short type, short prec) valp = new(g) TYPVAL(*(char *)value, TYPE_TINY); break; default: - sprintf(g->Message, MSG(BAD_VALUE_TYPE), type); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_VALUE_TYPE), type); return NULL; } // endswitch Type @@ -421,7 +421,7 @@ PVAL AllocateValue(PGLOBAL g, int type, int len, int prec, valp = new(g) BINVAL(g, (void*)NULL, len, prec); break; default: - sprintf(g->Message, MSG(BAD_VALUE_TYPE), type); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_VALUE_TYPE), type); return NULL; } // endswitch type @@ -493,7 +493,7 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns) break; default: - sprintf(g->Message, MSG(BAD_VALUE_TYPE), newtype); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_VALUE_TYPE), newtype); return NULL; } // endswitch type @@ -1189,7 +1189,7 @@ bool TYPVAL::Compall(PGLOBAL g, PVAL *vp, int np, OPVAL op) Tval = MY_MAX(val[0], val[1]); break; default: -// sprintf(g->Message, MSG(BAD_EXP_OPER), op); +// snprintf(g->Message, sizeof(g->Message), MSG(BAD_EXP_OPER), op); strcpy(g->Message, "Function not supported"); return true; } // endswitch op @@ -1199,7 +1199,7 @@ bool TYPVAL::Compall(PGLOBAL g, PVAL *vp, int np, OPVAL op) /***********************************************************************/ /* FormatValue: This function set vp (a STRING value) to the string */ -/* constructed from its own value formated using the fmt format. */ +/* constructed from its own value formatted using the fmt format. */ /* This function assumes that the format matches the value type. */ /***********************************************************************/ template @@ -1435,7 +1435,7 @@ void TYPVAL::SetValue(int n) int k = sprintf(buf, "%d", n); if (k > Len) { - sprintf(g->Message, MSG(VALSTR_TOO_LONG), buf, Len); + snprintf(g->Message, sizeof(g->Message), MSG(VALSTR_TOO_LONG), buf, Len); throw 138; } else SetValue_psz(buf); @@ -1453,7 +1453,7 @@ void TYPVAL::SetValue(uint n) int k = sprintf(buf, "%u", n); if (k > Len) { - sprintf(g->Message, MSG(VALSTR_TOO_LONG), buf, Len); + snprintf(g->Message, sizeof(g->Message), MSG(VALSTR_TOO_LONG), buf, Len); throw 138; } else SetValue_psz(buf); @@ -1489,7 +1489,7 @@ void TYPVAL::SetValue(longlong n) int k = sprintf(buf, "%lld", n); if (k > Len) { - sprintf(g->Message, MSG(VALSTR_TOO_LONG), buf, Len); + snprintf(g->Message, sizeof(g->Message), MSG(VALSTR_TOO_LONG), buf, Len); throw 138; } else SetValue_psz(buf); @@ -1507,7 +1507,7 @@ void TYPVAL::SetValue(ulonglong n) int k = sprintf(buf, "%llu", n); if (k > Len) { - sprintf(g->Message, MSG(VALSTR_TOO_LONG), buf, Len); + snprintf(g->Message, sizeof(g->Message), MSG(VALSTR_TOO_LONG), buf, Len); throw 138; } else SetValue_psz(buf); @@ -1532,7 +1532,7 @@ void TYPVAL::SetValue(double f) break; if (k > Len) { - sprintf(g->Message, MSG(VALSTR_TOO_LONG), buf, Len); + snprintf(g->Message, sizeof(g->Message), MSG(VALSTR_TOO_LONG), buf, Len); throw 138; } else SetValue_psz(buf); @@ -1700,7 +1700,7 @@ bool TYPVAL::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) SetValue_psz((strcmp(p[0], p[1]) > 0) ? p[0] : p[1]); break; default: - // sprintf(g->Message, MSG(BAD_EXP_OPER), op); + // snprintf(g->Message, sizeof(g->Message), MSG(BAD_EXP_OPER), op); strcpy(g->Message, "Function not supported"); return true; } // endswitch op @@ -1711,7 +1711,7 @@ bool TYPVAL::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) /***********************************************************************/ /* FormatValue: This function set vp (a STRING value) to the string */ -/* constructed from its own value formated using the fmt format. */ +/* constructed from its own value formatted using the fmt format. */ /* This function assumes that the format matches the value type. */ /***********************************************************************/ bool TYPVAL::FormatValue(PVAL vp, PCSZ fmt) @@ -2325,7 +2325,7 @@ bool BINVAL::IsEqual(PVAL vp, bool chktype) /***********************************************************************/ /* FormatValue: This function set vp (a STRING value) to the string */ -/* constructed from its own value formated using the fmt format. */ +/* constructed from its own value formatted using the fmt format. */ /* This function assumes that the format matches the value type. */ /***********************************************************************/ bool BINVAL::FormatValue(PVAL vp, PCSZ fmt) @@ -2398,7 +2398,7 @@ bool DTVAL::SetFormat(PGLOBAL g, PVAL valp) DTVAL *vp; if (valp->GetType() != TYPE_DATE) { - sprintf(g->Message, MSG(NO_FORMAT_TYPE), valp->GetType()); + snprintf(g->Message, sizeof(g->Message), MSG(NO_FORMAT_TYPE), valp->GetType()); return true; } else vp = (DTVAL*)valp; @@ -2865,7 +2865,7 @@ bool DTVAL::WeekNum(PGLOBAL g, int& nval) /***********************************************************************/ /* FormatValue: This function set vp (a STRING value) to the string */ -/* constructed from its own value formated using the fmt format. */ +/* constructed from its own value formatted using the fmt format. */ /* This function assumes that the format matches the value type. */ /***********************************************************************/ bool DTVAL::FormatValue(PVAL vp, PCSZ fmt) diff --git a/storage/connect/value.h b/storage/connect/value.h index a0d947347c3f0..7eb0dec29f232 100644 --- a/storage/connect/value.h +++ b/storage/connect/value.h @@ -41,7 +41,7 @@ typedef struct _datpar *PDTP; // For DTVAL /***********************************************************************/ // Exported functions DllExport PCSZ GetTypeName(int); -DllExport int GetTypeSize(int, int); +DllExport unsigned GetTypeSize(int, unsigned); #ifdef ODBC_SUPPORT /* This function is exported for use in OEM table type DLLs */ DllExport int TranslateSQLType(int stp, int prec, diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp index 6ed70f21a8517..4bcbbfd4235fb 100644 --- a/storage/connect/xindex.cpp +++ b/storage/connect/xindex.cpp @@ -92,7 +92,7 @@ int PlgMakeIndex(PGLOBAL g, PSZ name, PIXDEF pxdf, bool add) if (!(tdbp = cat->GetTable(g, tablep))) rc = RC_NF; else if (!tdbp->GetDef()->Indexable()) { - sprintf(g->Message, MSG(TABLE_NO_INDEX), name); + snprintf(g->Message, sizeof(g->Message), MSG(TABLE_NO_INDEX), name); rc = RC_NF; } else if ((rc = ((PTDBASE)tdbp)->MakeIndex(g, pxdf, add)) == RC_INFO) rc = RC_OK; // No or remote index @@ -351,7 +351,7 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp) Record.Size = n * sizeof(int); if (!PlgDBalloc(g, NULL, Record)) { - sprintf(g->Message, MSG(MEM_ALLOC_ERR), "index", n); + snprintf(g->Message, sizeof(g->Message), MSG(MEM_ALLOC_ERR), "index", n); goto err; // Error } // endif @@ -362,7 +362,7 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp) colp = To_Cols[k]; if (!kdfp) { - sprintf(g->Message, MSG(INT_COL_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(INT_COL_ERROR), (colp) ? colp->GetName() : "???"); goto err; // Error } // endif kdfp @@ -470,7 +470,7 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp) case RC_EF: goto end_of_file; default: - sprintf(g->Message, MSG(RC_READING), rc, Tdbp->Name); + snprintf(g->Message, sizeof(g->Message), MSG(RC_READING), rc, Tdbp->Name); goto err; } // endswitch rc @@ -479,7 +479,7 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp) /* future direct access. */ /*******************************************************************/ if (nkey == n) { - sprintf(g->Message, MSG(TOO_MANY_KEYS), nkey); + snprintf(g->Message, sizeof(g->Message), MSG(TOO_MANY_KEYS), nkey); return true; } else To_Rec[nkey] = Tdbp->GetRecpos(); @@ -534,14 +534,14 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp) Index.Size = Num_K * sizeof(int); if (!PlgDBalloc(g, NULL, Index)) { - sprintf(g->Message, MSG(MEM_ALLOC_ERR), "index", Num_K); + snprintf(g->Message, sizeof(g->Message), MSG(MEM_ALLOC_ERR), "index", Num_K); goto err; // Error } // endif alloc Offset.Size = (Num_K + 1) * sizeof(int); if (!PlgDBalloc(g, NULL, Offset)) { - sprintf(g->Message, MSG(MEM_ALLOC_ERR), "offset", Num_K + 1); + snprintf(g->Message, sizeof(g->Message), MSG(MEM_ALLOC_ERR), "offset", Num_K + 1); goto err; // Error } // endif alloc @@ -842,7 +842,7 @@ bool XINDEX::SaveIndex(PGLOBAL g, PIXDEF sxp) case RECFM_CSV: ftype = ".cnx"; break; case RECFM_DBF: ftype = ".dbx"; break; default: - sprintf(g->Message, MSG(INVALID_FTYPE), Tdbp->Ftype); + snprintf(g->Message, sizeof(g->Message), MSG(INVALID_FTYPE), Tdbp->Ftype); return true; } // endswitch Ftype @@ -996,7 +996,7 @@ bool XINDEX::Init(PGLOBAL g) case RECFM_CSV: ftype = ".cnx"; break; case RECFM_DBF: ftype = ".dbx"; break; default: - sprintf(g->Message, MSG(INVALID_FTYPE), Tdbp->Ftype); + snprintf(g->Message, sizeof(g->Message), MSG(INVALID_FTYPE), Tdbp->Ftype); return true; } // endswitch Ftype @@ -1050,7 +1050,7 @@ bool XINDEX::Init(PGLOBAL g) // The test on ID was suppressed because MariaDB can change an index ID // when other indexes are added or deleted if (/*nv[0] != ID ||*/ nv[1] != Nk) { - sprintf(g->Message, MSG(BAD_INDEX_FILE), fn); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_INDEX_FILE), fn); if (trace(1)) htrc("nv[0]=%d ID=%d nv[1]=%d Nk=%d\n", nv[0], ID, nv[1], Nk); @@ -1066,7 +1066,7 @@ bool XINDEX::Init(PGLOBAL g) Offset.Size = Ndif * sizeof(int); if (!PlgDBalloc(g, NULL, Offset)) { - sprintf(g->Message, MSG(MEM_ALLOC_ERR), "offset", Ndif); + snprintf(g->Message, sizeof(g->Message), MSG(MEM_ALLOC_ERR), "offset", Ndif); goto err; } // endif @@ -1083,7 +1083,7 @@ bool XINDEX::Init(PGLOBAL g) n = nv[3]; // n was just an evaluated max value if (nv[3] != n) { - sprintf(g->Message, MSG(OPT_NOT_MATCH), fn); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_NOT_MATCH), fn); goto err; } // endif @@ -1099,7 +1099,7 @@ bool XINDEX::Init(PGLOBAL g) Record.Size = Num_K * sizeof(int); if (!PlgDBalloc(g, NULL, Record)) { - sprintf(g->Message, MSG(MEM_ALLOC_ERR), "index", Num_K); + snprintf(g->Message, sizeof(g->Message), MSG(MEM_ALLOC_ERR), "index", Num_K); goto err; } // endif @@ -1123,7 +1123,7 @@ bool XINDEX::Init(PGLOBAL g) if (nv[4] != colp->GetResultType() || !colp->GetValue() || (nv[3] != colp->GetValue()->GetClen() && nv[4] != TYPE_STRING)) { - sprintf(g->Message, MSG(XCOL_MISMATCH), colp->GetName()); + snprintf(g->Message, sizeof(g->Message), MSG(XCOL_MISMATCH), colp->GetName()); goto err; // Error } // endif GetKey @@ -1249,7 +1249,7 @@ bool XINDEX::MapInit(PGLOBAL g) case RECFM_CSV: ftype = ".cnx"; break; case RECFM_DBF: ftype = ".dbx"; break; default: - sprintf(g->Message, MSG(INVALID_FTYPE), Tdbp->Ftype); + snprintf(g->Message, sizeof(g->Message), MSG(INVALID_FTYPE), Tdbp->Ftype); return true; } // endswitch Ftype @@ -1312,7 +1312,7 @@ bool XINDEX::MapInit(PGLOBAL g) // when other indexes are added or deleted if (/*nv0 != ID ||*/ nv[1] != Nk) { // Not this index - sprintf(g->Message, MSG(BAD_INDEX_FILE), fn); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_INDEX_FILE), fn); if (trace(1)) htrc("nv0=%d ID=%d nv[1]=%d Nk=%d\n", nv0, ID, nv[1], Nk); @@ -1337,7 +1337,7 @@ bool XINDEX::MapInit(PGLOBAL g) n = nv[3]; // n was just an evaluated max value if (nv[3] != n) { - sprintf(g->Message, MSG(OPT_NOT_MATCH), fn); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_NOT_MATCH), fn); goto err; } // endif @@ -1371,7 +1371,7 @@ bool XINDEX::MapInit(PGLOBAL g) if (nv[4] != colp->GetResultType() || !colp->GetValue() || (nv[3] != colp->GetValue()->GetClen() && nv[4] != TYPE_STRING)) { - sprintf(g->Message, MSG(XCOL_MISMATCH), colp->GetName()); + snprintf(g->Message, sizeof(g->Message), MSG(XCOL_MISMATCH), colp->GetName()); goto err; // Error } // endif GetKey @@ -1464,7 +1464,7 @@ bool XINDEX::GetAllSizes(PGLOBAL g,/* int &ndif,*/ int &numk) case RECFM_CSV: ftype = ".cnx"; break; case RECFM_DBF: ftype = ".dbx"; break; default: - sprintf(g->Message, MSG(INVALID_FTYPE), Tdbp->Ftype); + snprintf(g->Message, sizeof(g->Message), MSG(INVALID_FTYPE), Tdbp->Ftype); return true; } // endswitch Ftype @@ -1511,7 +1511,7 @@ bool XINDEX::GetAllSizes(PGLOBAL g,/* int &ndif,*/ int &numk) // The test on ID was suppressed because MariaDB can change an index ID // when other indexes are added or deleted if (/*nv[0] != ID ||*/ nv[1] != Nk) { - sprintf(g->Message, MSG(BAD_INDEX_FILE), fn); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_INDEX_FILE), fn); if (trace(1)) htrc("nv[0]=%d ID=%d nv[1]=%d Nk=%d\n", nv[0], ID, nv[1], Nk); @@ -1532,7 +1532,7 @@ bool XINDEX::GetAllSizes(PGLOBAL g,/* int &ndif,*/ int &numk) n = nv[3]; // n was just an evaluated max value if (nv[3] != n) { - sprintf(g->Message, MSG(OPT_NOT_MATCH), fn); + snprintf(g->Message, sizeof(g->Message), MSG(OPT_NOT_MATCH), fn); goto err; } // endif #endif // 0 @@ -1554,7 +1554,7 @@ bool XINDEX::GetAllSizes(PGLOBAL g,/* int &ndif,*/ int &numk) if (nv[4] != colp->GetResultType() || (nv[3] != colp->GetValue()->GetClen() && nv[4] != TYPE_STRING)) { - sprintf(g->Message, MSG(XCOL_MISMATCH), colp->GetName()); + snprintf(g->Message, sizeof(g->Message), MSG(XCOL_MISMATCH), colp->GetName()); goto err; // Error } // endif GetKey @@ -2029,6 +2029,10 @@ int XINDXS::Range(PGLOBAL g, int limit, bool incl) PXCOL kp = To_KeyCol; OPVAL op = Op; +// In case single column index doesn't exist return + if (!kp) + return 0; + switch (limit) { case 1: Op = (incl) ? OP_GE : OP_GT; break; case 2: Op = (incl) ? OP_GT : OP_GE; break; @@ -2338,7 +2342,7 @@ bool XFILE::Open(PGLOBAL g, char *filename, int id, MODE mode) case MODE_WRITE: pmod = "wb"; break; case MODE_INSERT: pmod = "ab"; break; default: - sprintf(g->Message, MSG(BAD_FUNC_MODE), "Xopen", mode); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FUNC_MODE), "Xopen", mode); return true; } // endswitch mode @@ -2354,7 +2358,7 @@ bool XFILE::Open(PGLOBAL g, char *filename, int id, MODE mode) /* Position the cursor at end of file so ftell returns file size. */ /*******************************************************************/ if (fseek(Xfile, 0, SEEK_END)) { - sprintf(g->Message, MSG(FUNC_ERRNO), errno, "Xseek"); + snprintf(g->Message, sizeof(g->Message), MSG(FUNC_ERRNO), errno, "Xseek"); return true; } // endif @@ -2379,7 +2383,7 @@ bool XFILE::Open(PGLOBAL g, char *filename, int id, MODE mode) } else if (mode == MODE_READ && id >= 0) { // Get offset from the header if (fread(noff, sizeof(IOFF), MAX_INDX, Xfile) != MAX_INDX) { - sprintf(g->Message, MSG(XFILE_READERR), errno); + snprintf(g->Message, sizeof(g->Message), MSG(XFILE_READERR), errno); return true; } // endif MAX_INDX @@ -2388,7 +2392,7 @@ bool XFILE::Open(PGLOBAL g, char *filename, int id, MODE mode) // Position the cursor at the offset of this index if (fseek(Xfile, noff[id].v.Low, SEEK_SET)) { - sprintf(g->Message, MSG(FUNC_ERRNO), errno, "Xseek"); + snprintf(g->Message, sizeof(g->Message), MSG(FUNC_ERRNO), errno, "Xseek"); return true; } // endif @@ -2408,7 +2412,7 @@ bool XFILE::Seek(PGLOBAL g, int low, int high __attribute__((unused)), #endif // !_DEBUG if (fseek(Xfile, low, origin)) { - sprintf(g->Message, MSG(FUNC_ERRNO), errno, "Xseek"); + snprintf(g->Message, sizeof(g->Message), MSG(FUNC_ERRNO), errno, "Xseek"); return true; } // endif @@ -2421,7 +2425,7 @@ bool XFILE::Seek(PGLOBAL g, int low, int high __attribute__((unused)), bool XFILE::Read(PGLOBAL g, void *buf, int n, int size) { if (fread(buf, size, n, Xfile) != (size_t)n) { - sprintf(g->Message, MSG(XFILE_READERR), errno); + snprintf(g->Message, sizeof(g->Message), MSG(XFILE_READERR), errno); return true; } // endif size @@ -2436,7 +2440,7 @@ int XFILE::Write(PGLOBAL g, void *buf, int n, int size, bool& rc) int niw = (int)fwrite(buf, size, n, Xfile); if (niw != n) { - sprintf(g->Message, MSG(XFILE_WRITERR), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(XFILE_WRITERR), strerror(errno)); rc = true; } // endif size @@ -2512,7 +2516,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) IOFF noff[MAX_INDX]; if (Hfile != INVALID_HANDLE_VALUE) { - sprintf(g->Message, MSG(FILE_OPEN_YET), filename); + snprintf(g->Message, sizeof(g->Message), MSG(FILE_OPEN_YET), filename); return true; } // endif @@ -2543,7 +2547,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) creation = OPEN_EXISTING; break; default: - sprintf(g->Message, MSG(BAD_FUNC_MODE), "Xopen", mode); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FUNC_MODE), "Xopen", mode); return true; } // endswitch @@ -2552,7 +2556,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) if (Hfile == INVALID_HANDLE_VALUE) { rc = GetLastError(); - sprintf(g->Message, MSG(OPEN_ERROR), rc, mode, filename); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, mode, filename); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)filename, sizeof(filename), NULL); @@ -2571,7 +2575,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) rc = SetFilePointer(Hfile, 0, &high, FILE_END); if (rc == INVALID_SET_FILE_POINTER && (drc = GetLastError()) != NO_ERROR) { - sprintf(g->Message, MSG(ERROR_IN_SFP), drc); + snprintf(g->Message, sizeof(g->Message), MSG(ERROR_IN_SFP), drc); CloseHandle(Hfile); Hfile = INVALID_HANDLE_VALUE; return true; @@ -2592,7 +2596,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) rc = ReadFile(Hfile, noff, sizeof(noff), &drc, NULL); if (!rc) { - sprintf(g->Message, MSG(XFILE_READERR), GetLastError()); + snprintf(g->Message, sizeof(g->Message), MSG(XFILE_READERR), GetLastError()); return true; } // endif rc @@ -2601,7 +2605,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) (PLONG)&noff[id].v.High, FILE_BEGIN); if (rc == INVALID_SET_FILE_POINTER) { - sprintf(g->Message, MSG(FUNC_ERRNO), GetLastError(), "SetFilePointer"); + snprintf(g->Message, sizeof(g->Message), MSG(FUNC_ERRNO), GetLastError(), "SetFilePointer"); return true; } // endif @@ -2626,7 +2630,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) oflag |= (O_WRONLY | O_APPEND); break; default: - sprintf(g->Message, MSG(BAD_FUNC_MODE), "Xopen", mode); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_FUNC_MODE), "Xopen", mode); return true; } // endswitch @@ -2649,7 +2653,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) /* Position the cursor at end of file so ftell returns file size. */ /*******************************************************************/ if (!(NewOff.Val = (longlong)lseek64(Hfile, 0LL, SEEK_END))) { - sprintf(g->Message, MSG(FUNC_ERRNO), errno, "Seek"); + snprintf(g->Message, sizeof(g->Message), MSG(FUNC_ERRNO), errno, "Seek"); return true; } // endif @@ -2669,7 +2673,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) } else if (mode == MODE_READ && id >= 0) { // Get offset from the header if (read(Hfile, noff, sizeof(noff)) != sizeof(noff)) { - sprintf(g->Message, MSG(READ_ERROR), "Index file", strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), "Index file", strerror(errno)); return true; } // endif read @@ -2678,9 +2682,9 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) // Position the cursor at the offset of this index if (lseek64(Hfile, noff[id].Val, SEEK_SET) < 0) { - sprintf(g->Message, "(XHUGE)lseek64: %s (%lld)", strerror(errno), noff[id].Val); + snprintf(g->Message, sizeof(g->Message), "(XHUGE)lseek64: %s (%lld)", strerror(errno), noff[id].Val); printf("%s\n", g->Message); -// sprintf(g->Message, MSG(FUNC_ERRNO), errno, "Hseek"); +// snprintf(g->Message, sizeof(g->Message), MSG(FUNC_ERRNO), errno, "Hseek"); return true; } // endif lseek64 @@ -2700,7 +2704,7 @@ bool XHUGE::Seek(PGLOBAL g, int low, int high, int origin) DWORD rc = SetFilePointer(Hfile, low, &hi, origin); if (rc == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) { - sprintf(g->Message, MSG(FUNC_ERROR), "Xseek"); + snprintf(g->Message, sizeof(g->Message), MSG(FUNC_ERROR), "Xseek"); return true; } // endif @@ -2709,7 +2713,7 @@ bool XHUGE::Seek(PGLOBAL g, int low, int high, int origin) + (off64_t)high * ((off64_t)0x100 * (off64_t)0x1000000); if (lseek64(Hfile, pos, origin) < 0) { - sprintf(g->Message, MSG(ERROR_IN_LSK), errno); + snprintf(g->Message, sizeof(g->Message), MSG(ERROR_IN_LSK), errno); if (trace(1)) htrc("lseek64 error %d\n", errno); @@ -2750,7 +2754,7 @@ bool XHUGE::Read(PGLOBAL g, void *buf, int n, int size) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, drc, 0, (LPTSTR)buf, sizeof(buf), NULL); - sprintf(g->Message, MSG(READ_ERROR), "index file", buf); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), "index file", buf); rc = true; } // endif brc #else // UNIX @@ -2760,7 +2764,7 @@ bool XHUGE::Read(PGLOBAL g, void *buf, int n, int size) htrc("Hfile=%d n=%d size=%d count=%d\n", Hfile, n, size, count); if (read(Hfile, buf, count) != count) { - sprintf(g->Message, MSG(READ_ERROR), "Index file", strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), "Index file", strerror(errno)); if (trace(1)) htrc("read error %d\n", errno); @@ -2790,7 +2794,7 @@ int XHUGE::Write(PGLOBAL g, void *buf, int n, int size, bool& rc) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, drc, 0, (LPTSTR)msg, sizeof(msg), NULL); - sprintf(g->Message, MSG(WRITING_ERROR), "index file", msg); + snprintf(g->Message, sizeof(g->Message), MSG(WRITING_ERROR), "index file", msg); rc = true; } // endif size @@ -2802,7 +2806,7 @@ int XHUGE::Write(PGLOBAL g, void *buf, int n, int size, bool& rc) nbw = write(Hfile, buf, count); if (nbw != (signed)count) { - sprintf(g->Message, MSG(WRITING_ERROR), + snprintf(g->Message, sizeof(g->Message), MSG(WRITING_ERROR), "index file", strerror(errno)); rc = true; } // endif nbw @@ -3019,7 +3023,7 @@ bool KXYCOL::Init(PGLOBAL g, PCOL colp, int n, bool sm, int kln) // Currently no indexing on NULL columns if (colp->IsNullable() && kln) { - sprintf(g->Message, "Cannot index nullable column %s", colp->GetName()); + snprintf(g->Message, sizeof(g->Message), "Cannot index nullable column %s", colp->GetName()); return true; } // endif nullable @@ -3042,7 +3046,7 @@ bool KXYCOL::Init(PGLOBAL g, PCOL colp, int n, bool sm, int kln) Keys.Size = (size_t)n * (size_t)Klen; if (!PlgDBalloc(g, NULL, Keys)) { - sprintf(g->Message, MSG(KEY_ALLOC_ERROR), Klen, n); + snprintf(g->Message, sizeof(g->Message), MSG(KEY_ALLOC_ERROR), Klen, n); return true; // Error } // endif @@ -3160,7 +3164,7 @@ bool KXYCOL::MakeBlockArray(PGLOBAL g, int nb, int size) // Allocate the required memory if (!PlgDBalloc(g, NULL, Bkeys)) { - sprintf(g->Message, MSG(KEY_ALLOC_ERROR), Klen, nb); + snprintf(g->Message, sizeof(g->Message), MSG(KEY_ALLOC_ERROR), Klen, nb); return true; // Error } // endif diff --git a/storage/connect/xobject.cpp b/storage/connect/xobject.cpp index c595ce5d6c43b..21a91653801dc 100644 --- a/storage/connect/xobject.cpp +++ b/storage/connect/xobject.cpp @@ -162,7 +162,7 @@ bool CONSTANT::Rephrase(PGLOBAL g, PSZ work) sprintf(work + strlen(work), "%d", Value->GetTinyValue()); break; default: - sprintf(g->Message, MSG(BAD_CONST_TYPE), Value->GetType()); + snprintf(g->Message, sizeof(g->Message), MSG(BAD_CONST_TYPE), Value->GetType()); return false; } // endswitch diff --git a/storage/connect/xtable.h b/storage/connect/xtable.h index 1b499e090477e..58acf550a0b42 100644 --- a/storage/connect/xtable.h +++ b/storage/connect/xtable.h @@ -264,7 +264,7 @@ class DllExport CATCOL : public COLBLK { virtual void ReadColumn(PGLOBAL g); protected: - CATCOL(void) {} // Default constructor not to be used + CATCOL(void) = default; // Default constructor not to be used // Members PTDBCAT Tdbp; // Points to ODBC table block diff --git a/storage/connect/zip.c b/storage/connect/zip.c index 52d63e108e797..f6a106019682e 100644 --- a/storage/connect/zip.c +++ b/storage/connect/zip.c @@ -1471,11 +1471,6 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in { uLong uTotalOutBefore = zi->ci.stream.total_out; err=deflate(&zi->ci.stream, Z_NO_FLUSH); - if(uTotalOutBefore > zi->ci.stream.total_out) - { - int bBreak = 0; - bBreak++; - } zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ; } diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index 5f42f657ef3a9..c66c33a7818c2 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -1060,12 +1060,17 @@ static MYSQL_THDVAR_DOUBLE( 1000.5, 0); +static MYSQL_THDVAR_INT( + deprecated_var, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, "-1..1", + NULL, NULL, 0, -1, 1, 0); + static struct st_mysql_sys_var* example_system_variables[]= { MYSQL_SYSVAR(enum_var), MYSQL_SYSVAR(ulong_var), MYSQL_SYSVAR(int_var), MYSQL_SYSVAR(double_var), MYSQL_SYSVAR(double_thdvar), + MYSQL_SYSVAR(deprecated_var), MYSQL_SYSVAR(varopt_default), NULL }; diff --git a/storage/example/ha_example.h b/storage/example/ha_example.h index 2d3fa6d4216ac..5d067f7cda9bd 100644 --- a/storage/example/ha_example.h +++ b/storage/example/ha_example.h @@ -68,9 +68,7 @@ class ha_example: public handler public: ha_example(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_example() - { - } + ~ha_example() = default; /** @brief The name of the index type that will be used for display. diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index faaffa21f6b86..25b12de3cd510 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -1651,7 +1651,7 @@ int ha_federated::open(const char *name, int mode, uint test_if_locked) class Net_error_handler : public Internal_error_handler { public: - Net_error_handler() {} + Net_error_handler() = default; public: bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h index 2e785f878582e..fe729f08413be 100644 --- a/storage/federated/ha_federated.h +++ b/storage/federated/ha_federated.h @@ -121,7 +121,7 @@ class ha_federated: public handler int real_connect(); public: ha_federated(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_federated() {} + ~ha_federated() = default; /* Next pointer used in transaction */ @@ -146,7 +146,7 @@ class ha_federated: public handler HA_NO_PREFIX_CHAR_KEYS | HA_PRIMARY_KEY_REQUIRED_FOR_DELETE | HA_NO_TRANSACTIONS /* until fixed by WL#2952 */ | HA_PARTIAL_COLUMN_READ | HA_NULL_IN_KEY | - HA_CAN_ONLINE_BACKUPS | + HA_CAN_ONLINE_BACKUPS | HA_NON_COMPARABLE_ROWID | HA_CAN_REPAIR); } /* @@ -238,6 +238,19 @@ class ha_federated: public handler int rnd_next_int(uchar *buf); int rnd_pos(uchar *buf, uchar *pos); //required void position(const uchar *record); //required + /* + A ref is a pointer inside a local buffer. It is not comparable to + other ref's. This is never called as HA_NON_COMPARABLE_ROWID is set. + */ + int cmp_ref(const uchar *ref1, const uchar *ref2) + { +#ifdef NOT_YET + DBUG_ASSERT(0); + return 0; +#else + return handler::cmp_ref(ref1,ref2); /* Works if table scan is used */ +#endif + } int info(uint); //required int extra(ha_extra_function operation); diff --git a/storage/federatedx/CMakeLists.txt b/storage/federatedx/CMakeLists.txt index 5f983b5d6373a..6a9b12ee362ce 100644 --- a/storage/federatedx/CMakeLists.txt +++ b/storage/federatedx/CMakeLists.txt @@ -1,2 +1,3 @@ SET(FEDERATEDX_SOURCES ha_federatedx.cc federatedx_txn.cc federatedx_io.cc federatedx_io_null.cc federatedx_io_mysql.cc) -MYSQL_ADD_PLUGIN(federatedx ${FEDERATEDX_SOURCES} STORAGE_ENGINE) +MYSQL_ADD_PLUGIN(federatedx ${FEDERATEDX_SOURCES} STORAGE_ENGINE + RECOMPILE_FOR_EMBEDDED) diff --git a/storage/federatedx/federatedx_io_mysql.cc b/storage/federatedx/federatedx_io_mysql.cc index 669a8faef6396..fc32146b5cd78 100644 --- a/storage/federatedx/federatedx_io_mysql.cc +++ b/storage/federatedx/federatedx_io_mysql.cc @@ -31,6 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "sql_priv.h" #include +#include #include "ha_federatedx.h" diff --git a/storage/federatedx/federatedx_io_null.cc b/storage/federatedx/federatedx_io_null.cc index b1058dbd2f5d5..8a2394f215010 100644 --- a/storage/federatedx/federatedx_io_null.cc +++ b/storage/federatedx/federatedx_io_null.cc @@ -118,9 +118,7 @@ federatedx_io_null::federatedx_io_null(FEDERATEDX_SERVER *aserver) } -federatedx_io_null::~federatedx_io_null() -{ -} +federatedx_io_null::~federatedx_io_null() = default; void federatedx_io_null::reset() diff --git a/storage/federatedx/federatedx_pushdown.cc b/storage/federatedx/federatedx_pushdown.cc index 664f057023855..e9a9791a859b6 100644 --- a/storage/federatedx/federatedx_pushdown.cc +++ b/storage/federatedx/federatedx_pushdown.cc @@ -35,6 +35,64 @@ */ +/* + Check if table and database names are equal on local and remote servers + + SYNOPSIS + local_and_remote_names_match() + tbl_share Pointer to current table TABLE_SHARE structure + fshare Pointer to current table FEDERATEDX_SHARE structure + + DESCRIPTION + FederatedX table on the local server may refer to a table having another + name on the remote server. The remote table may even reside in a different + database. For example: + + -- Remote server + CREATE TABLE t1 (id int(32)); + + -- Local server + CREATE TABLE t2 ENGINE="FEDERATEDX" + CONNECTION="mysql://joe:joespass@192.168.1.111:9308/federatedx/t1"; + + It's not a problem while the federated_pushdown is disabled 'cause + the CONNECTION strings are being parsed for every table during + the execution, so the table names are translated from local to remote. + But in case of the federated_pushdown the whole query is pushed down + to the engine without any translation, so the remote server may try + to select data from a nonexistent table (for example, query + "SELECT * FROM t2" will try to retrieve data from nonexistent "t2"). + + This function checks whether there is a mismatch between local and remote + table/database names + + RETURN VALUE + false names are equal + true names are not equal + +*/ +bool local_and_remote_names_mismatch(const TABLE_SHARE *tbl_share, + const FEDERATEDX_SHARE *fshare) +{ + + if (lower_case_table_names) + { + if (strcasecmp(fshare->database, tbl_share->db.str) != 0) + return true; + } + else + { + if (strncmp(fshare->database, tbl_share->db.str, tbl_share->db.length) != 0) + return true; + } + + return my_strnncoll(system_charset_info, (uchar *) fshare->table_name, + strlen(fshare->table_name), + (uchar *) tbl_share->table_name.str, + tbl_share->table_name.length) != 0; +} + + static derived_handler* create_federatedx_derived_handler(THD* thd, TABLE_LIST *derived) { @@ -42,7 +100,6 @@ create_federatedx_derived_handler(THD* thd, TABLE_LIST *derived) return 0; ha_federatedx_derived_handler* handler = NULL; - handlerton *ht= 0; SELECT_LEX_UNIT *unit= derived->derived; @@ -54,9 +111,16 @@ create_federatedx_derived_handler(THD* thd, TABLE_LIST *derived) { if (!tbl->table) return 0; - if (!ht) - ht= tbl->table->file->partition_ht(); - else if (ht != tbl->table->file->partition_ht()) + /* + We intentionally don't support partitioned federatedx tables here, so + use file->ht and not file->partition_ht(). + */ + if (tbl->table->file->ht != federatedx_hton) + return 0; + + const FEDERATEDX_SHARE *fshare= + ((ha_federatedx*)tbl->table->file)->get_federatedx_share(); + if (local_and_remote_names_mismatch(tbl->table->s, fshare)) return 0; } } @@ -80,7 +144,7 @@ ha_federatedx_derived_handler::ha_federatedx_derived_handler(THD *thd, derived= dt; } -ha_federatedx_derived_handler::~ha_federatedx_derived_handler() {} +ha_federatedx_derived_handler::~ha_federatedx_derived_handler() = default; int ha_federatedx_derived_handler::init_scan() { @@ -170,15 +234,22 @@ create_federatedx_select_handler(THD* thd, SELECT_LEX *sel) return 0; ha_federatedx_select_handler* handler = NULL; - handlerton *ht= 0; for (TABLE_LIST *tbl= thd->lex->query_tables; tbl; tbl= tbl->next_global) { if (!tbl->table) return 0; - if (!ht) - ht= tbl->table->file->partition_ht(); - else if (ht != tbl->table->file->partition_ht()) + /* + We intentionally don't support partitioned federatedx tables here, so + use file->ht and not file->partition_ht(). + */ + if (tbl->table->file->ht != federatedx_hton) + return 0; + + const FEDERATEDX_SHARE *fshare= + ((ha_federatedx*)tbl->table->file)->get_federatedx_share(); + + if (local_and_remote_names_mismatch(tbl->table->s, fshare)) return 0; } @@ -210,7 +281,7 @@ ha_federatedx_select_handler::ha_federatedx_select_handler(THD *thd, select= sel; } -ha_federatedx_select_handler::~ha_federatedx_select_handler() {} +ha_federatedx_select_handler::~ha_federatedx_select_handler() = default; int ha_federatedx_select_handler::init_scan() { diff --git a/storage/federatedx/federatedx_txn.cc b/storage/federatedx/federatedx_txn.cc index 220896cc2a4a8..c434a00805c96 100644 --- a/storage/federatedx/federatedx_txn.cc +++ b/storage/federatedx/federatedx_txn.cc @@ -57,10 +57,12 @@ federatedx_txn::~federatedx_txn() void federatedx_txn::close(FEDERATEDX_SERVER *server) { +#ifdef DBUG_TRACE uint count= 0; +#endif federatedx_io *io, **iop; DBUG_ENTER("federatedx_txn::close"); - + DBUG_ASSERT(!server->use_count); DBUG_PRINT("info",("use count: %u connections: %u", server->use_count, server->io_count)); @@ -84,9 +86,11 @@ void federatedx_txn::close(FEDERATEDX_SERVER *server) { server->idle_list= io->idle_next; delete io; +#ifdef DBUG_TRACE count++; +#endif } - + DBUG_PRINT("info",("closed %u connections, txn_list: %s", count, txn_list ? "active": "empty")); DBUG_VOID_RETURN; @@ -172,12 +176,14 @@ void federatedx_txn::release(federatedx_io **ioptr) void federatedx_txn::release_scan() { +#ifdef DBUG_TRACE uint count= 0, returned= 0; +#endif federatedx_io *io, **pio; DBUG_ENTER("federatedx_txn::release_scan"); - /* return any inactive and idle connections to the server */ - for (pio= &txn_list; (io= *pio); count++) + /* return any inactive and idle connections to the server */ + for (pio= &txn_list; (io= *pio);) { if (io->active || io->busy) pio= &io->txn_next; @@ -196,8 +202,13 @@ void federatedx_txn::release_scan() io->idle_next= server->idle_list; server->idle_list= io; mysql_mutex_unlock(&server->mutex); +#ifdef DBUG_TRACE returned++; +#endif } +#ifdef DBUG_TRACE + count++; +#endif } DBUG_PRINT("info",("returned %u of %u connections(s)", returned, count)); diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc index 99513d709501c..598886b891563 100644 --- a/storage/federatedx/ha_federatedx.cc +++ b/storage/federatedx/ha_federatedx.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2008-2009, Patrick Galbraith & Antony Curtis -Copyright (c) 2020, MariaDB Corporation. +Copyright (c) 2020, 2022, MariaDB Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -315,6 +315,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define MYSQL_SERVER 1 #include #include +#include #include "ha_federatedx.h" #include "sql_servers.h" #include "sql_analyse.h" // append_escaped() @@ -610,7 +611,7 @@ int get_connection(MEM_ROOT *mem_root, FEDERATEDX_SHARE *share) parse_url() mem_root MEM_ROOT pointer for memory allocation share pointer to FEDERATEDX share - table pointer to current TABLE class + table_s pointer to current TABLE_SHARE class table_create_flag determines what error to throw DESCRIPTION @@ -1218,7 +1219,6 @@ bool ha_federatedx::create_where_from_key(String *to, KEY *key_info, const key_range *start_key, const key_range *end_key, - bool from_records_in_range, bool eq_range) { bool both_not_null= @@ -1239,7 +1239,6 @@ bool ha_federatedx::create_where_from_key(String *to, MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set); for (uint i= 0; i <= 1; i++) { - bool needs_quotes; KEY_PART_INFO *key_part; if (ranges[i] == NULL) continue; @@ -1262,7 +1261,12 @@ bool ha_federatedx::create_where_from_key(String *to, Field *field= key_part->field; uint store_length= key_part->store_length; uint part_length= MY_MIN(store_length, length); - needs_quotes= field->str_needs_quotes(); + bool needs_quotes= field->str_needs_quotes(); + bool reverse= key_part->key_part_flag & HA_REVERSE_SORT; + static const LEX_CSTRING lt={STRING_WITH_LEN(" < ") }; + static const LEX_CSTRING gt={STRING_WITH_LEN(" > ") }; + static const LEX_CSTRING le={STRING_WITH_LEN(" <= ") }; + static const LEX_CSTRING ge={STRING_WITH_LEN(" >= ") }; DBUG_DUMP("key, start of loop", ptr, length); if (key_part->null_bit) @@ -1304,16 +1308,8 @@ bool ha_federatedx::create_where_from_key(String *to, if (emit_key_part_name(&tmp, key_part)) goto err; - if (from_records_in_range) - { - if (tmp.append(STRING_WITH_LEN(" >= "))) - goto err; - } - else - { - if (tmp.append(STRING_WITH_LEN(" = "))) - goto err; - } + if (tmp.append(STRING_WITH_LEN(" = "))) + goto err; if (emit_key_part_element(&tmp, key_part, needs_quotes, 0, ptr, part_length)) @@ -1344,12 +1340,12 @@ bool ha_federatedx::create_where_from_key(String *to, if (i > 0) /* end key */ { - if (tmp.append(STRING_WITH_LEN(" <= "))) + if (tmp.append(reverse ? ge : le)) goto err; } else /* start key */ { - if (tmp.append(STRING_WITH_LEN(" > "))) + if (tmp.append(reverse ? lt : gt)) goto err; } @@ -1364,7 +1360,7 @@ bool ha_federatedx::create_where_from_key(String *to, case HA_READ_KEY_OR_NEXT: DBUG_PRINT("info", ("federatedx HA_READ_KEY_OR_NEXT %d", i)); if (emit_key_part_name(&tmp, key_part) || - tmp.append(STRING_WITH_LEN(" >= ")) || + tmp.append(reverse ? le : ge) || emit_key_part_element(&tmp, key_part, needs_quotes, 0, ptr, part_length)) goto err; @@ -1374,7 +1370,7 @@ bool ha_federatedx::create_where_from_key(String *to, if (store_length >= length) { if (emit_key_part_name(&tmp, key_part) || - tmp.append(STRING_WITH_LEN(" < ")) || + tmp.append(reverse ? gt : lt) || emit_key_part_element(&tmp, key_part, needs_quotes, 0, ptr, part_length)) goto err; @@ -1384,7 +1380,7 @@ bool ha_federatedx::create_where_from_key(String *to, case HA_READ_KEY_OR_PREV: DBUG_PRINT("info", ("federatedx HA_READ_KEY_OR_PREV %d", i)); if (emit_key_part_name(&tmp, key_part) || - tmp.append(STRING_WITH_LEN(" <= ")) || + tmp.append(reverse ? ge : le) || emit_key_part_element(&tmp, key_part, needs_quotes, 0, ptr, part_length)) goto err; @@ -1823,7 +1819,7 @@ int ha_federatedx::open(const char *name, int mode, uint test_if_locked) class Net_error_handler : public Internal_error_handler { public: - Net_error_handler() {} + Net_error_handler() = default; public: bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, @@ -2639,10 +2635,7 @@ int ha_federatedx::index_read_idx_with_result_set(uchar *buf, uint index, range.key= key; range.length= key_len; range.flag= find_flag; - create_where_from_key(&index_string, - &table->key_info[index], - &range, - NULL, 0, 0); + create_where_from_key(&index_string, &table->key_info[index], &range, 0, 0); sql_query.append(index_string); if ((retval= txn->acquire(share, ha_thd(), TRUE, &io))) @@ -2650,7 +2643,7 @@ int ha_federatedx::index_read_idx_with_result_set(uchar *buf, uint index, if (io->query(sql_query.ptr(), sql_query.length())) { - sprintf(error_buffer, "error: %d '%s'", + snprintf(error_buffer, sizeof(error_buffer), "error: %d '%s'", io->error_code(), io->error_str()); retval= ER_QUERY_ON_FOREIGN_DATA_SOURCE; goto error; @@ -2721,9 +2714,8 @@ int ha_federatedx::read_range_first(const key_range *start_key, sql_query.length(0); sql_query.append(share->select_query); - create_where_from_key(&sql_query, - &table->key_info[active_index], - start_key, end_key, 0, eq_range_arg); + create_where_from_key(&sql_query, &table->key_info[active_index], + start_key, end_key, eq_range_arg); if ((retval= txn->acquire(share, ha_thd(), TRUE, &io))) DBUG_RETURN(retval); @@ -3375,7 +3367,7 @@ static int test_connection(MYSQL_THD thd, federatedx_io *io, if ((retval= io->query(str.ptr(), str.length()))) { - sprintf(buffer, "database: '%s' username: '%s' hostname: '%s'", + snprintf(buffer, sizeof(buffer), "database: '%s' username: '%s' hostname: '%s'", share->database, share->username, share->hostname); DBUG_PRINT("info", ("error-code: %d", io->error_code())); my_error(ER_CANT_CREATE_FEDERATED_TABLE, MYF(0), buffer); diff --git a/storage/federatedx/ha_federatedx.h b/storage/federatedx/ha_federatedx.h index 665cb303fbac0..3573c658b11ee 100644 --- a/storage/federatedx/ha_federatedx.h +++ b/storage/federatedx/ha_federatedx.h @@ -291,8 +291,7 @@ class ha_federatedx final : public handler FEDERATEDX_IO_RESULT *result); bool create_where_from_key(String *to, KEY *key_info, const key_range *start_key, - const key_range *end_key, - bool records_in_range, bool eq_range); + const key_range *end_key, bool eq_range); int stash_remote_error(); static federatedx_txn *get_txn(THD *thd, bool no_create= FALSE); @@ -317,7 +316,7 @@ class ha_federatedx final : public handler int real_connect(FEDERATEDX_SHARE *my_share, uint create_flag); public: ha_federatedx(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_federatedx() {} + ~ha_federatedx() = default; /* The name of the index type that will be used for display don't implement this method unless you really have indexes @@ -336,7 +335,7 @@ class ha_federatedx final : public handler | HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_CAN_INDEX_BLOBS | HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | HA_CAN_REPAIR | HA_PRIMARY_KEY_REQUIRED_FOR_DELETE | HA_CAN_ONLINE_BACKUPS | - HA_PARTIAL_COLUMN_READ | HA_NULL_IN_KEY); + HA_PARTIAL_COLUMN_READ | HA_NULL_IN_KEY | HA_NON_COMPARABLE_ROWID); } /* This is a bitmap of flags that says how the storage engine @@ -426,6 +425,19 @@ class ha_federatedx final : public handler int rnd_next(uchar *buf); //required int rnd_pos(uchar *buf, uchar *pos); //required void position(const uchar *record); //required + /* + A ref is a pointer inside a local buffer. It is not comparable to + other ref's. This is never called as HA_NON_COMPARABLE_ROWID is set. + */ + int cmp_ref(const uchar *ref1, const uchar *ref2) + { +#ifdef NOT_YET + DBUG_ASSERT(0); + return 0; +#else + return handler::cmp_ref(ref1,ref2); /* Works if table scan is used */ +#endif + } int info(uint); //required int extra(ha_extra_function operation); @@ -451,6 +463,7 @@ class ha_federatedx final : public handler int reset(void); int free_result(void); + const FEDERATEDX_SHARE *get_federatedx_share() const { return share; } friend class ha_federatedx_derived_handler; friend class ha_federatedx_select_handler; }; diff --git a/storage/heap/ha_heap.h b/storage/heap/ha_heap.h index 3a41028c7194c..18e0d1a92d53e 100644 --- a/storage/heap/ha_heap.h +++ b/storage/heap/ha_heap.h @@ -36,7 +36,7 @@ class ha_heap final : public handler my_bool internal_table; public: ha_heap(handlerton *hton, TABLE_SHARE *table); - ~ha_heap() {} + ~ha_heap() = default; handler *clone(const char *name, MEM_ROOT *mem_root); const char *index_type(uint inx) { diff --git a/storage/heap/hp_test1.c b/storage/heap/hp_test1.c index 88eaf73f5500f..03054843c7ef5 100644 --- a/storage/heap/hp_test1.c +++ b/storage/heap/hp_test1.c @@ -30,7 +30,7 @@ static int flag=0,verbose=0,remove_ant=0,flags[50]; int main(int argc, char **argv) { - int i,j,error,deleted; + int i,j,error; HP_INFO *file; uchar record[128],key[32]; const char *filename; @@ -62,7 +62,6 @@ int main(int argc, char **argv) keyinfo[0].seg[0].null_bit= 0; keyinfo[0].flag = HA_NOSAME; - deleted=0; bzero((uchar*) flags,sizeof(flags)); printf("- Creating heap-file\n"); @@ -110,8 +109,6 @@ int main(int argc, char **argv) if (error || verbose) printf("key: %s delete: %d my_errno: %d\n",(char*) key,error,my_errno); flags[j]=0; - if (! error) - deleted++; } if (heap_check_heap(file,0)) { diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index a2ea7c24541fe..a61b762f58b43 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -17,9 +17,113 @@ # This is the CMakeLists for InnoDB +INCLUDE(CheckFunctionExists) +INCLUDE(CheckCSourceCompiles) +INCLUDE(CheckCSourceRuns) +INCLUDE(numa) +INCLUDE(TestBigEndian) +MYSQL_CHECK_NUMA() -INCLUDE(innodb.cmake) +INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake) + +IF(CMAKE_CROSSCOMPILING) + # Use CHECK_C_SOURCE_COMPILES instead of CHECK_C_SOURCE_RUNS when + # cross-compiling. Not as precise, but usually good enough. + # This only make sense for atomic tests in this file, this trick doesn't + # work in a general case. + MACRO(CHECK_C_SOURCE SOURCE VAR) + CHECK_C_SOURCE_COMPILES("${SOURCE}" "${VAR}") + ENDMACRO() +ELSE() + MACRO(CHECK_C_SOURCE SOURCE VAR) + CHECK_C_SOURCE_RUNS("${SOURCE}" "${VAR}") + ENDMACRO() +ENDIF() + +# OS tests +IF(UNIX) + IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") + ADD_DEFINITIONS("-D_GNU_SOURCE=1") + IF(HAVE_LIBNUMA) + LINK_LIBRARIES(numa) + ENDIF() + ENDIF() +ENDIF() + +# Enable InnoDB's UNIV_DEBUG in debug builds +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG") + +OPTION(WITH_INNODB_AHI "Include innodb_adaptive_hash_index" ON) +OPTION(WITH_INNODB_ROOT_GUESS "Cache index root block descriptors" ON) +IF(WITH_INNODB_AHI) + ADD_DEFINITIONS(-DBTR_CUR_HASH_ADAPT -DBTR_CUR_ADAPT) + IF(NOT WITH_INNODB_ROOT_GUESS) + MESSAGE(WARNING "WITH_INNODB_AHI implies WITH_INNODB_ROOT_GUESS") + SET(WITH_INNODB_ROOT_GUESS ON) + ENDIF() +ELSEIF(WITH_INNODB_ROOT_GUESS) + ADD_DEFINITIONS(-DBTR_CUR_ADAPT) +ENDIF() +ADD_FEATURE_INFO(INNODB_AHI WITH_INNODB_AHI "InnoDB Adaptive Hash Index") +ADD_FEATURE_INFO(INNODB_ROOT_GUESS WITH_INNODB_ROOT_GUESS + "Cache index root block descriptors in InnoDB") + +OPTION(WITH_INNODB_EXTRA_DEBUG "Enable extra InnoDB debug checks" OFF) +IF(WITH_INNODB_EXTRA_DEBUG) + ADD_DEFINITIONS(-DUNIV_ZIP_DEBUG) +ENDIF() +ADD_FEATURE_INFO(INNODB_EXTRA_DEBUG WITH_INNODB_EXTRA_DEBUG "Extra InnoDB debug checks") + +IF(HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE) + ADD_DEFINITIONS(-DHAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE=1) +ENDIF() + +IF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR + CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion -Wno-sign-conversion") + SET_SOURCE_FILES_PROPERTIES(fts/fts0pars.cc + PROPERTIES COMPILE_FLAGS -Wno-conversion) +ENDIF() + +IF(NOT MSVC) + # Work around MDEV-18417, MDEV-18656, MDEV-18417 + IF(WITH_ASAN AND CMAKE_COMPILER_IS_GNUCC AND + CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0") + SET_SOURCE_FILES_PROPERTIES(trx/trx0rec.cc PROPERTIES COMPILE_FLAGS -O1) + ENDIF() +ENDIF(NOT MSVC) + +CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF) + +# Include directories under innobase +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/innobase/include + ${CMAKE_SOURCE_DIR}/storage/innobase/handler) + +# Sun Studio bug with -xO2 +IF(CMAKE_CXX_COMPILER_ID MATCHES "SunPro" + AND CMAKE_CXX_FLAGS_RELEASE MATCHES "O2" + AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + # Sun Studio 12 crashes with -xO2 flag, but not with higher optimization + # -xO3 + SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/rem/rem0rec.cc + PROPERTIES COMPILE_FLAGS -xO3) +ENDIF() + + +IF(MSVC) + # Avoid "unreferenced label" warning in generated file + GET_FILENAME_COMPONENT(_SRC_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) + SET_SOURCE_FILES_PROPERTIES(${_SRC_DIR}/pars/pars0grm.c + PROPERTIES COMPILE_FLAGS "/wd4102") + SET_SOURCE_FILES_PROPERTIES(${_SRC_DIR}/pars/lexyy.c + PROPERTIES COMPILE_FLAGS "/wd4003") +ENDIF() + +# Include directories under innobase +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/innobase/include + ${CMAKE_SOURCE_DIR}/storage/innobase/handler + ${CMAKE_SOURCE_DIR}/libbinlogevents/include) INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/tpool) SET(INNOBASE_SOURCES @@ -78,19 +182,19 @@ SET(INNOBASE_SOURCES handler/i_s.cc ibuf/ibuf0ibuf.cc include/btr0btr.h - include/btr0btr.ic + include/btr0btr.inl include/btr0bulk.h include/btr0cur.h - include/btr0cur.ic + include/btr0cur.inl include/btr0defragment.h include/btr0pcur.h - include/btr0pcur.ic + include/btr0pcur.inl include/btr0sea.h - include/btr0sea.ic + include/btr0sea.inl include/btr0types.h include/buf0buddy.h include/buf0buf.h - include/buf0buf.ic + include/buf0buf.inl include/buf0checksum.h include/buf0dblwr.h include/buf0dump.h @@ -99,36 +203,35 @@ SET(INNOBASE_SOURCES include/buf0rea.h include/buf0types.h include/data0data.h - include/data0data.ic + include/data0data.inl include/data0type.h - include/data0type.ic + include/data0type.inl include/data0types.h include/db0err.h include/dict0boot.h include/dict0crea.h - include/dict0crea.ic + include/dict0crea.inl include/dict0defrag_bg.h include/dict0dict.h - include/dict0dict.ic + include/dict0dict.inl include/dict0load.h include/dict0mem.h - include/dict0mem.ic + include/dict0mem.inl include/dict0pagecompress.h - include/dict0pagecompress.ic + include/dict0pagecompress.inl include/dict0stats.h - include/dict0stats.ic + include/dict0stats.inl include/dict0stats_bg.h include/dict0types.h include/dyn0buf.h include/dyn0types.h include/eval0eval.h - include/eval0eval.ic + include/eval0eval.inl include/eval0proc.h - include/eval0proc.ic + include/eval0proc.inl include/fil0crypt.h - include/fil0crypt.ic + include/fil0crypt.inl include/fil0fil.h - include/fil0fil.ic include/fil0pagecompress.h include/fsp0file.h include/fsp0fsp.h @@ -142,135 +245,128 @@ SET(INNOBASE_SOURCES include/fts0pars.h include/fts0plugin.h include/fts0priv.h - include/fts0priv.ic + include/fts0priv.inl include/fts0tlex.h include/fts0tokenize.h include/fts0types.h - include/fts0types.ic + include/fts0types.inl include/fts0vlc.h - include/fut0fut.h include/fut0lst.h include/gis0geo.h include/gis0rtree.h - include/gis0rtree.ic + include/gis0rtree.inl include/gis0type.h include/ha_prototypes.h include/ha0ha.h - include/ha0ha.ic + include/ha0ha.inl include/ha0storage.h - include/ha0storage.ic + include/ha0storage.inl include/handler0alter.h include/hash0hash.h include/ibuf0ibuf.h - include/ibuf0ibuf.ic - include/ibuf0types.h + include/ibuf0ibuf.inl include/lock0iter.h include/lock0lock.h - include/lock0lock.ic + include/lock0lock.inl include/lock0prdt.h include/lock0priv.h - include/lock0priv.ic + include/lock0priv.inl include/lock0types.h include/log0crypt.h include/log0log.h include/log0recv.h include/log0types.h include/mach0data.h - include/mach0data.ic + include/mach0data.inl include/mem0mem.h - include/mem0mem.ic + include/mem0mem.inl include/mtr0log.h include/mtr0mtr.h - include/mtr0mtr.ic include/mtr0types.h include/os0file.h - include/os0file.ic - include/os0thread.h + include/os0file.inl include/page0cur.h - include/page0cur.ic + include/page0cur.inl include/page0page.h - include/page0page.ic + include/page0page.inl include/page0types.h include/page0zip.h - include/page0zip.ic + include/page0zip.inl include/pars0grm.h include/pars0opt.h include/pars0pars.h include/pars0sym.h include/pars0types.h include/que0que.h - include/que0que.ic + include/que0que.inl include/que0types.h include/read0types.h include/rem0cmp.h - include/rem0cmp.ic include/rem0rec.h - include/rem0rec.ic + include/rem0rec.inl include/rem0types.h include/row0ext.h - include/row0ext.ic + include/row0ext.inl include/row0ftsort.h include/row0import.h include/row0ins.h include/row0log.h - include/row0log.ic include/row0merge.h include/row0mysql.h include/row0purge.h include/row0quiesce.h include/row0row.h - include/row0row.ic + include/row0row.inl include/row0sel.h - include/row0sel.ic include/row0types.h include/row0uins.h include/row0umod.h include/row0undo.h include/row0upd.h - include/row0upd.ic + include/row0upd.inl include/row0vers.h include/rw_lock.h + include/small_vector.h include/srv0mon.h - include/srv0mon.ic + include/srv0mon.inl include/srv0srv.h include/srv0start.h include/srw_lock.h include/sux_lock.h + include/transactional_lock_guard.h include/trx0i_s.h include/trx0purge.h include/trx0rec.h - include/trx0rec.ic include/trx0roll.h include/trx0rseg.h - include/trx0rseg.ic include/trx0sys.h include/trx0trx.h - include/trx0trx.ic + include/trx0trx.inl include/trx0types.h include/trx0undo.h - include/trx0undo.ic + include/trx0undo.inl include/trx0xa.h include/univ.i include/ut0byte.h - include/ut0byte.ic + include/ut0byte.inl include/ut0counter.h include/ut0dbg.h include/ut0list.h - include/ut0list.ic + include/ut0list.inl include/ut0lst.h include/ut0mem.h - include/ut0mem.ic + include/ut0mem.inl include/ut0new.h include/ut0pool.h include/ut0rbt.h include/ut0rnd.h - include/ut0rnd.ic + include/ut0rnd.inl include/ut0sort.h include/ut0stage.h include/ut0ut.h - include/ut0ut.ic + include/ut0ut.inl include/ut0vec.h - include/ut0vec.ic + include/ut0vec.inl include/ut0wqueue.h lock/lock0iter.cc lock/lock0prdt.cc @@ -282,7 +378,6 @@ SET(INNOBASE_SOURCES mem/mem0mem.cc mtr/mtr0mtr.cc os/os0file.cc - os/os0thread.cc page/page0cur.cc page/page0page.cc page/page0zip.cc @@ -381,6 +476,20 @@ IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" COMPILE_FLAGS "-O0" ) ENDIF() + +# Older gcc version insist on -mhtm flag for including the +# htmxlintrin.h header. This is also true for new gcc versions +# like 11.2.0 in Debian Sid +# s390x because of the way it defines the high level intrinsics +# as not-inline in the header file can only be included by one +# source file that has -mhtm enabled. +IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64|powerpc64|s390x" + OR CMAKE_SYSTEM_NAME MATCHES "AIX") + ADD_COMPILE_FLAGS( + sync/srw_lock.cc + COMPILE_FLAGS "-mhtm" + ) +ENDIF() IF(MSVC) IF(CMAKE_SIZEOF_VOID_P EQUAL 8) ADD_COMPILE_FLAGS( @@ -391,6 +500,11 @@ IF(MSVC) # on generated file. TARGET_COMPILE_OPTIONS(innobase PRIVATE "/wd4065") ENDIF() +IF(CMAKE_C_COMPILER_ID MATCHES "Clang" AND + NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.0.0") + ADD_COMPILE_FLAGS(pars/pars0grm.cc fts/fts0pars.cc + COMPILE_FLAGS "-Wno-unused-but-set-variable") +ENDIF() IF(NOT (PLUGIN_INNOBASE STREQUAL DYNAMIC)) TARGET_LINK_LIBRARIES(innobase tpool mysys) diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index bd18fd2d45f41..8b66f3d387112 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -2,7 +2,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, 2021, MariaDB Corporation. +Copyright (c) 2014, 2023, 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 @@ -43,8 +43,7 @@ Created 6/2/1994 Heikki Tuuri #include "gis0geo.h" #include "dict0boot.h" #include "row0sel.h" /* row_search_max_autoinc() */ - -Atomic_counter btr_validate_index_running; +#include "log.h" /**************************************************************//** Checks if the page in the cursor can be merged with given page. @@ -59,17 +58,6 @@ btr_can_merge_with_page( buf_block_t** merge_block, /*!< out: the merge block */ mtr_t* mtr); /*!< in: mini-transaction */ -/** Report that an index page is corrupted. -@param[in] buffer block -@param[in] index tree */ -void btr_corruption_report(const buf_block_t* block, const dict_index_t* index) -{ - ib::fatal() - << "Flag mismatch in page " << block->page.id() - << " index " << index->name - << " of table " << index->table->name; -} - /* Latching strategy of the InnoDB B-tree -------------------------------------- @@ -188,25 +176,77 @@ make them consecutive on disk if possible. From the other file segment we allocate pages for the non-leaf levels of the tree. */ -#ifdef UNIV_BTR_DEBUG -/**************************************************************//** -Checks a file segment header within a B-tree root page. -@return TRUE if valid */ -static -ibool -btr_root_fseg_validate( -/*===================*/ - const fseg_header_t* seg_header, /*!< in: segment header */ - ulint space) /*!< in: tablespace identifier */ +/** Check a file segment header within a B-tree root page. +@param offset file segment header offset +@param block B-tree root page +@param space tablespace +@return whether the segment header is valid */ +static bool btr_root_fseg_validate(ulint offset, + const buf_block_t &block, + const fil_space_t &space) { - ulint offset = mach_read_from_2(seg_header + FSEG_HDR_OFFSET); + ut_ad(block.page.id().space() == space.id); + const uint16_t hdr= mach_read_from_2(offset + FSEG_HDR_OFFSET + + block.page.frame); + if (FIL_PAGE_DATA <= hdr && hdr <= srv_page_size - FIL_PAGE_DATA_END && + mach_read_from_4(block.page.frame + offset + FSEG_HDR_SPACE) == space.id) + return true; + sql_print_error("InnoDB: Index root page " UINT32PF " in %s is corrupted " + "at " ULINTPF, + block.page.id().page_no(), + UT_LIST_GET_FIRST(space.chain)->name); + return false; +} - ut_a(mach_read_from_4(seg_header + FSEG_HDR_SPACE) == space); - ut_a(offset >= FIL_PAGE_DATA); - ut_a(offset <= srv_page_size - FIL_PAGE_DATA_END); - return(TRUE); +/** Report a decryption failure. */ +ATTRIBUTE_COLD void btr_decryption_failed(const dict_index_t &index) +{ + ib_push_warning(static_cast(nullptr), DB_DECRYPTION_FAILED, + "Table %s is encrypted but encryption service or" + " used key_id is not available. " + " Can't continue reading table.", + index.table->name.m_name); + index.table->file_unreadable= true; +} + +/** Get an index page and declare its latching order level. +@param[in] index index tree +@param[in] page page number +@param[in] mode latch mode +@param[in] merge whether change buffer merge should be attempted +@param[in,out] mtr mini-transaction +@param[out] err error code +@return block */ +buf_block_t *btr_block_get(const dict_index_t &index, + uint32_t page, ulint mode, bool merge, + mtr_t *mtr, dberr_t *err) +{ + dberr_t local_err; + if (!err) + err= &local_err; + buf_block_t *block= + buf_page_get_gen(page_id_t{index.table->space->id, page}, + index.table->space->zip_size(), mode, nullptr, BUF_GET, + mtr, err, merge && !index.is_clust()); + ut_ad(!block == (*err != DB_SUCCESS)); + + if (UNIV_LIKELY(block != nullptr)) + { + if (!!page_is_comp(block->page.frame) != index.table->not_redundant() || + btr_page_get_index_id(block->page.frame) != index.id || + !fil_page_index_page_check(block->page.frame) || + index.is_spatial() != + (fil_page_get_type(block->page.frame) == FIL_PAGE_RTREE)) + { + *err= DB_PAGE_CORRUPTED; + block= nullptr; + } + } + else if (*err == DB_DECRYPTION_FAILED) + btr_decryption_failed(index); + + return block; } -#endif /* UNIV_BTR_DEBUG */ /**************************************************************//** Gets the root node of a tree and x- or s-latches it. @@ -214,46 +254,56 @@ Gets the root node of a tree and x- or s-latches it. buf_block_t* btr_root_block_get( /*===============*/ - const dict_index_t* index, /*!< in: index tree */ + dict_index_t* index, /*!< in: index tree */ rw_lock_type_t mode, /*!< in: either RW_S_LATCH or RW_X_LATCH */ - mtr_t* mtr) /*!< in: mtr */ + mtr_t* mtr, /*!< in: mtr */ + dberr_t* err) /*!< out: error code */ { - if (!index->table || !index->table->space || index->page == FIL_NULL) { - return NULL; - } - - buf_block_t* block = btr_block_get(*index, index->page, mode, false, - mtr); - - if (!block) { - index->table->file_unreadable = true; - - ib_push_warning( - static_cast(NULL), DB_DECRYPTION_FAILED, - "Table %s in file %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name.m_name, - UT_LIST_GET_FIRST(index->table->space->chain)->name); - - return NULL; - } - - btr_assert_not_corrupted(block, index); + if (!index->table || !index->table->space) + { + *err= DB_TABLESPACE_NOT_FOUND; + return nullptr; + } -#ifdef UNIV_BTR_DEBUG - if (!dict_index_is_ibuf(index)) { - const page_t* root = buf_block_get_frame(block); + buf_block_t *block; +#ifndef BTR_CUR_ADAPT + static constexpr buf_block_t *guess= nullptr; +#else + buf_block_t *&guess= btr_search_get_info(index)->root_guess; + guess= +#endif + block= + buf_page_get_gen(page_id_t{index->table->space->id, index->page}, + index->table->space->zip_size(), mode, guess, BUF_GET, + mtr, err, false); + ut_ad(!block == (*err != DB_SUCCESS)); - ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF - + root, index->table->space_id)); - ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP - + root, index->table->space_id)); - } -#endif /* UNIV_BTR_DEBUG */ + if (UNIV_LIKELY(block != nullptr)) + { + if (!!page_is_comp(block->page.frame) != index->table->not_redundant() || + btr_page_get_index_id(block->page.frame) != index->id || + !fil_page_index_page_check(block->page.frame) || + index->is_spatial() != + (fil_page_get_type(block->page.frame) == FIL_PAGE_RTREE)) + { + *err= DB_PAGE_CORRUPTED; + block= nullptr; + } + else if (index->is_ibuf()); + else if (!btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF, + *block, *index->table->space) || + !btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP, + *block, *index->table->space)) + { + *err= DB_CORRUPTION; + block= nullptr; + } + } + else if (*err == DB_DECRYPTION_FAILED) + btr_decryption_failed(*index); - return(block); + return block; } /**************************************************************//** @@ -263,14 +313,15 @@ static page_t* btr_root_get( /*=========*/ - const dict_index_t* index, /*!< in: index tree */ - mtr_t* mtr) /*!< in: mtr */ + dict_index_t* index, /*!< in: index tree */ + mtr_t* mtr, /*!< in: mtr */ + dberr_t* err) /*!< out: error code */ { - /* Intended to be used for segment list access. - SX lock doesn't block reading user data by other threads. - And block the segment list access by others.*/ - buf_block_t* root = btr_root_block_get(index, RW_SX_LATCH, mtr); - return(root ? buf_block_get_frame(root) : NULL); + /* Intended to be used for accessing file segment lists. + Concurrent read of other data is allowed. */ + if (buf_block_t *root= btr_root_block_get(index, RW_SX_LATCH, mtr, err)) + return root->page.frame; + return nullptr; } /**************************************************************//** @@ -432,6 +483,52 @@ btr_page_create( } } +buf_block_t * +mtr_t::get_already_latched(const page_id_t id, mtr_memo_type_t type) const +{ + ut_ad(is_active()); + ut_ad(type == MTR_MEMO_PAGE_X_FIX || type == MTR_MEMO_PAGE_SX_FIX || + type == MTR_MEMO_PAGE_S_FIX); + for (ulint i= 0; i < m_memo.size(); i++) + { + const mtr_memo_slot_t &slot= m_memo[i]; + const auto slot_type= mtr_memo_type_t(slot.type & ~MTR_MEMO_MODIFY); + if (slot_type == MTR_MEMO_PAGE_X_FIX || slot_type == type) + { + buf_block_t *block= static_cast(slot.object); + if (block->page.id() == id) + return block; + } + } + return nullptr; +} + +/** Fetch an index root page that was already latched in the +mini-transaction. */ +static buf_block_t *btr_get_latched_root(const dict_index_t &index, mtr_t *mtr) +{ + return mtr->get_already_latched(page_id_t{index.table->space_id, index.page}, + MTR_MEMO_PAGE_SX_FIX); +} + +/** Fetch an index page that should have been already latched in the +mini-transaction. */ +static buf_block_t * +btr_block_reget(mtr_t *mtr, const dict_index_t &index, + const page_id_t id, rw_lock_type_t rw_latch, + dberr_t *err) +{ + if (buf_block_t *block= + mtr->get_already_latched(id, mtr_memo_type_t(rw_latch))) + { + *err= DB_SUCCESS; + return block; + } + + ut_ad(mtr->memo_contains_flagged(&index.lock, MTR_MEMO_X_LOCK)); + return btr_block_get(index, id.page_no(), rw_latch, true, mtr, err); +} + /**************************************************************//** Allocates a new file page to be used in an ibuf tree. Takes the page from the free list of the tree, which must contain pages! @@ -441,28 +538,25 @@ buf_block_t* btr_page_alloc_for_ibuf( /*====================*/ dict_index_t* index, /*!< in: index tree */ - mtr_t* mtr) /*!< in: mtr */ + mtr_t* mtr, /*!< in: mtr */ + dberr_t* err) /*!< out: error code */ { - buf_block_t* new_block; - - buf_block_t* root = btr_root_block_get(index, RW_SX_LATCH, mtr); - - fil_addr_t node_addr = flst_get_first(PAGE_HEADER - + PAGE_BTR_IBUF_FREE_LIST - + root->page.frame); - ut_a(node_addr.page != FIL_NULL); - - new_block = buf_page_get( - page_id_t(index->table->space_id, node_addr.page), - index->table->space->zip_size(), - RW_X_LATCH, mtr); - - flst_remove(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, - new_block, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, - mtr); - ut_d(flst_validate(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, mtr)); - - return(new_block); + buf_block_t *root= btr_get_latched_root(*index, mtr); + if (UNIV_UNLIKELY(!root)) + return root; + buf_block_t *new_block= + buf_page_get_gen(page_id_t(IBUF_SPACE_ID, + mach_read_from_4(PAGE_HEADER + + PAGE_BTR_IBUF_FREE_LIST + + FLST_FIRST + FIL_ADDR_PAGE + + root->page.frame)), + 0, RW_X_LATCH, nullptr, BUF_GET, mtr, err); + if (new_block) + *err= flst_remove(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, new_block, + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, mtr); + ut_d(if (*err == DB_SUCCESS) + flst_validate(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, mtr)); + return new_block; } /**************************************************************//** @@ -481,26 +575,36 @@ btr_page_alloc_low( in the tree */ mtr_t* mtr, /*!< in/out: mini-transaction for the allocation */ - mtr_t* init_mtr) /*!< in/out: mtr or another + mtr_t* init_mtr, /*!< in/out: mtr or another mini-transaction in which the page should be initialized. */ + dberr_t* err) /*!< out: error code */ { - page_t* root = btr_root_get(index, mtr); + const auto savepoint= mtr->get_savepoint(); + buf_block_t *root= btr_root_block_get(index, RW_NO_LATCH, mtr, err); + if (UNIV_UNLIKELY(!root)) + return root; - fseg_header_t* seg_header = (level - ? PAGE_HEADER + PAGE_BTR_SEG_TOP - : PAGE_HEADER + PAGE_BTR_SEG_LEAF) - + root; - - /* Parameter TRUE below states that the caller has made the - reservation for free extents, and thus we know that a page can - be allocated: */ - - buf_block_t* block = fseg_alloc_free_page_general( - seg_header, hint_page_no, file_direction, - true, mtr, init_mtr); + if (mtr->have_u_or_x_latch(*root)) + { +#ifdef BTR_CUR_HASH_ADAPT + ut_ad(!root->index || !root->index->freed()); +#endif + mtr->rollback_to_savepoint(savepoint); + } + else + { + mtr->lock_register(savepoint, MTR_MEMO_PAGE_SX_FIX); + root->page.lock.u_lock(); +#ifdef BTR_CUR_HASH_ADAPT + btr_search_drop_page_hash_index(root, true); +#endif + } - return block; + fseg_header_t *seg_header= root->page.frame + + (level ? PAGE_HEADER + PAGE_BTR_SEG_TOP : PAGE_HEADER + PAGE_BTR_SEG_LEAF); + return fseg_alloc_free_page_general(seg_header, hint_page_no, file_direction, + true, mtr, init_mtr, err); } /**************************************************************//** @@ -518,38 +622,37 @@ btr_page_alloc( in the tree */ mtr_t* mtr, /*!< in/out: mini-transaction for the allocation */ - mtr_t* init_mtr) /*!< in/out: mini-transaction + mtr_t* init_mtr, /*!< in/out: mini-transaction for x-latching and initializing the page */ + dberr_t* err) /*!< out: error code */ { - if (dict_index_is_ibuf(index)) { - - return(btr_page_alloc_for_ibuf(index, mtr)); - } - - return btr_page_alloc_low( - index, hint_page_no, file_direction, level, mtr, init_mtr); + ut_ad(level < BTR_MAX_NODE_LEVEL); + return index->is_ibuf() + ? btr_page_alloc_for_ibuf(index, mtr, err) + : btr_page_alloc_low(index, hint_page_no, file_direction, level, + mtr, init_mtr, err); } /**************************************************************//** Frees a page used in an ibuf tree. Puts the page to the free list of the ibuf tree. */ static -void +dberr_t btr_page_free_for_ibuf( /*===================*/ dict_index_t* index, /*!< in: index tree */ buf_block_t* block, /*!< in: block to be freed, x-latched */ mtr_t* mtr) /*!< in: mtr */ { - ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); - - buf_block_t* root = btr_root_block_get(index, RW_SX_LATCH, mtr); - - flst_add_first(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, - block, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, mtr); - - ut_d(flst_validate(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, mtr)); + ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); + buf_block_t *root= btr_get_latched_root(*index, mtr); + dberr_t err= + flst_add_first(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, + block, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, mtr); + ut_d(if (err == DB_SUCCESS) + flst_validate(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, mtr)); + return err; } /** Free an index page. @@ -557,51 +660,71 @@ btr_page_free_for_ibuf( @param[in,out] block block to be freed @param[in,out] mtr mini-transaction @param[in] blob whether this is freeing a BLOB page -@param[in] latched whether index->table->space->x_lock() was called */ -void btr_page_free(dict_index_t* index, buf_block_t* block, mtr_t* mtr, - bool blob, bool space_latched) +@param[in] latched whether index->table->space->x_lock() was called +@return error code */ +dberr_t btr_page_free(dict_index_t* index, buf_block_t* block, mtr_t* mtr, + bool blob, bool space_latched) { - ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); -#ifdef BTR_CUR_HASH_ADAPT - if (block->index && !block->index->freed()) { - ut_ad(!blob); - ut_ad(page_is_leaf(block->page.frame)); - } + ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); +#if defined BTR_CUR_HASH_ADAPT && defined UNIV_DEBUG + if (btr_search_check_marked_free_index(block)) + { + ut_ad(!blob); + ut_ad(page_is_leaf(block->page.frame)); + } #endif - const page_id_t id(block->page.id()); - ut_ad(index->table->space_id == id.space()); - /* The root page is freed by btr_free_root(). */ - ut_ad(id.page_no() != index->page); - ut_ad(mtr->is_named_space(index->table->space)); + const uint32_t page{block->page.id().page_no()}; + ut_ad(index->table->space_id == block->page.id().space()); + /* The root page is freed by btr_free_root(). */ + ut_ad(page != index->page); + ut_ad(mtr->is_named_space(index->table->space)); - /* The page gets invalid for optimistic searches: increment the frame - modify clock */ + /* The page gets invalid for optimistic searches: increment the frame + modify clock */ + buf_block_modify_clock_inc(block); - buf_block_modify_clock_inc(block); + /* TODO: Discard any operations for block from mtr->m_log. + The page will be freed, so previous changes to it by this + mini-transaction should not matter. */ - if (dict_index_is_ibuf(index)) { - btr_page_free_for_ibuf(index, block, mtr); - return; - } + if (index->is_ibuf()) + return btr_page_free_for_ibuf(index, block, mtr); - /* TODO: Discard any operations for block from mtr->log. - The page will be freed, so previous changes to it by this - mini-transaction should not matter. */ - page_t* root = btr_root_get(index, mtr); - fseg_header_t* seg_header = &root[blob - || page_is_leaf(block->page.frame) - ? PAGE_HEADER + PAGE_BTR_SEG_LEAF - : PAGE_HEADER + PAGE_BTR_SEG_TOP]; - fil_space_t* space= index->table->space; - const uint32_t page= id.page_no(); + fil_space_t *space= index->table->space; + dberr_t err; - fseg_free_page(seg_header, space, page, mtr, space_latched); - buf_page_free(space, page, mtr); + const auto savepoint= mtr->get_savepoint(); + if (buf_block_t *root= btr_root_block_get(index, RW_NO_LATCH, mtr, &err)) + { + if (mtr->have_u_or_x_latch(*root)) + { +#ifdef BTR_CUR_HASH_ADAPT + ut_ad(!root->index || !root->index->freed()); +#endif + mtr->rollback_to_savepoint(savepoint); + } + else + { + mtr->lock_register(savepoint, MTR_MEMO_PAGE_SX_FIX); + root->page.lock.u_lock(); +#ifdef BTR_CUR_HASH_ADAPT + btr_search_drop_page_hash_index(root, true); +#endif + } + err= fseg_free_page(&root->page.frame[blob || + page_is_leaf(block->page.frame) + ? PAGE_HEADER + PAGE_BTR_SEG_LEAF + : PAGE_HEADER + PAGE_BTR_SEG_TOP], + space, page, mtr, space_latched); + } + if (err == DB_SUCCESS) + buf_page_free(space, page, mtr); - /* The page was marked free in the allocation bitmap, but it - should remain exclusively latched until mtr_t::commit() or until it - is explicitly freed from the mini-transaction. */ - ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); + /* The page was marked free in the allocation bitmap, but it + should remain exclusively latched until mtr_t::commit() or until it + is explicitly freed from the mini-transaction. */ + ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); + return err; } /** Set the child page number in a node pointer record. @@ -629,6 +752,7 @@ inline void btr_node_ptr_set_child_page_no(buf_block_t *block, mtr->write<4>(*block, rec + offs - REC_NODE_PTR_SIZE, page_no); } +MY_ATTRIBUTE((nonnull(1,2,3,4),warn_unused_result)) /************************************************************//** Returns the child page of a node pointer and sx-latches it. @return child page, sx-latched */ @@ -639,7 +763,8 @@ btr_node_ptr_get_child( const rec_t* node_ptr,/*!< in: node pointer */ dict_index_t* index, /*!< in: index */ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */ - mtr_t* mtr) /*!< in: mtr */ + mtr_t* mtr, /*!< in: mtr */ + dberr_t* err = nullptr) /*!< out: error code */ { ut_ad(rec_offs_validate(node_ptr, index, offsets)); ut_ad(index->table->space_id @@ -648,110 +773,115 @@ btr_node_ptr_get_child( return btr_block_get( *index, btr_node_ptr_get_child_page_no(node_ptr, offsets), RW_SX_LATCH, btr_page_get_level(page_align(node_ptr)) == 1, - mtr); + mtr, err); } +MY_ATTRIBUTE((nonnull(2,3,4), warn_unused_result)) /************************************************************//** Returns the upper level node pointer to a page. It is assumed that mtr holds an sx-latch on the tree. @return rec_get_offsets() of the node pointer record */ static rec_offs* -btr_page_get_father_node_ptr_func( -/*==============================*/ +btr_page_get_father_node_ptr_for_validate( rec_offs* offsets,/*!< in: work area for the return value */ mem_heap_t* heap, /*!< in: memory heap to use */ btr_cur_t* cursor, /*!< in: cursor pointing to user record, out: cursor on node pointer record, its page x-latched */ - ulint latch_mode,/*!< in: BTR_CONT_MODIFY_TREE - or BTR_CONT_SEARCH_TREE */ mtr_t* mtr) /*!< in: mtr */ { - dtuple_t* tuple; - rec_t* user_rec; - rec_t* node_ptr; - ulint level; - ulint page_no; - dict_index_t* index; - - ut_ad(latch_mode == BTR_CONT_MODIFY_TREE - || latch_mode == BTR_CONT_SEARCH_TREE); - - page_no = btr_cur_get_block(cursor)->page.id().page_no(); - index = btr_cur_get_index(cursor); + const uint32_t page_no = btr_cur_get_block(cursor)->page.id().page_no(); + dict_index_t* index = btr_cur_get_index(cursor); ut_ad(!dict_index_is_spatial(index)); - - ut_ad(srv_read_only_mode - || mtr->memo_contains_flagged(&index->lock, MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK)); - + ut_ad(mtr->memo_contains(index->lock, MTR_MEMO_X_LOCK)); ut_ad(dict_index_get_page(index) != page_no); - level = btr_page_get_level(btr_cur_get_page(cursor)); + const auto level = btr_page_get_level(btr_cur_get_page(cursor)); - user_rec = btr_cur_get_rec(cursor); + const rec_t* user_rec = btr_cur_get_rec(cursor); ut_a(page_rec_is_user_rec(user_rec)); - tuple = dict_index_build_node_ptr(index, user_rec, 0, heap, level); - dberr_t err = DB_SUCCESS; - - err = btr_cur_search_to_nth_level( - index, level + 1, tuple, - PAGE_CUR_LE, latch_mode, cursor, 0, mtr); - - if (err != DB_SUCCESS) { - ib::warn() << " Error code: " << err - << " btr_page_get_father_node_ptr_func " - << " level: " << level + 1 - << " table: " << index->table->name - << " index: " << index->name(); + if (btr_cur_search_to_nth_level(level + 1, + dict_index_build_node_ptr(index, + user_rec, 0, + heap, level), + RW_S_LATCH, + cursor, mtr) != DB_SUCCESS) { + return nullptr; } - node_ptr = btr_cur_get_rec(cursor); + const rec_t* node_ptr = btr_cur_get_rec(cursor); offsets = rec_get_offsets(node_ptr, index, offsets, 0, ULINT_UNDEFINED, &heap); if (btr_node_ptr_get_child_page_no(node_ptr, offsets) != page_no) { - rec_t* print_rec; - - ib::error() - << "Corruption of an index tree: table " - << index->table->name - << " index " << index->name - << ", father ptr page no " - << btr_node_ptr_get_child_page_no(node_ptr, offsets) - << ", child page no " << page_no; - - print_rec = page_rec_get_next( - page_get_infimum_rec(page_align(user_rec))); - offsets = rec_get_offsets(print_rec, index, offsets, - page_rec_is_leaf(user_rec) - ? index->n_core_fields : 0, - ULINT_UNDEFINED, &heap); - page_rec_print(print_rec, offsets); - offsets = rec_get_offsets(node_ptr, index, offsets, 0, - ULINT_UNDEFINED, &heap); - page_rec_print(node_ptr, offsets); - - ib::fatal() - << "You should dump + drop + reimport the table to" - << " fix the corruption. If the crash happens at" - << " database startup. " << FORCE_RECOVERY_MSG - << " Then dump + drop + reimport."; + offsets = nullptr; } return(offsets); } -#define btr_page_get_father_node_ptr(of,heap,cur,mtr) \ - btr_page_get_father_node_ptr_func( \ - of,heap,cur,BTR_CONT_MODIFY_TREE,mtr) +MY_ATTRIBUTE((nonnull(2,3,4), warn_unused_result)) +/** Return the node pointer to a page. +@param offsets work area for the return value +@param heap memory heap +@param cursor in: child page; out: node pointer to it +@param mtr mini-transaction +@return rec_get_offsets() of the node pointer record +@retval nullptr if the parent page had not been latched in mtr */ +static rec_offs *btr_page_get_parent(rec_offs *offsets, mem_heap_t *heap, + btr_cur_t *cursor, mtr_t *mtr) +{ + const uint32_t page_no= cursor->block()->page.id().page_no(); + const dict_index_t *index= cursor->index(); + ut_ad(!index->is_spatial()); + ut_ad(index->page != page_no); + + uint32_t p= index->page; + auto level= btr_page_get_level(cursor->block()->page.frame); + const dtuple_t *tuple= + dict_index_build_node_ptr(index, btr_cur_get_rec(cursor), 0, heap, level); + level++; + + ulint i; + for (i= 0; i < mtr->get_savepoint(); i++) + if (buf_block_t *block= mtr->block_at_savepoint(i)) + if (block->page.id().page_no() == p) + { + ut_ad(block->page.lock.have_u_or_x() || + (!block->page.lock.have_s() && index->lock.have_x())); + ulint up_match= 0, low_match= 0; + cursor->page_cur.block= block; + if (page_cur_search_with_match(tuple, PAGE_CUR_LE, &up_match, + &low_match, &cursor->page_cur, + nullptr)) + return nullptr; + offsets= rec_get_offsets(cursor->page_cur.rec, index, offsets, 0, + ULINT_UNDEFINED, &heap); + p= btr_node_ptr_get_child_page_no(cursor->page_cur.rec, offsets); + if (p != page_no) + { + if (btr_page_get_level(block->page.frame) == level) + return nullptr; + i= 0; // MDEV-29835 FIXME: require all pages to be latched in order! + continue; + } + ut_ad(block->page.lock.have_u_or_x()); + if (block->page.lock.have_u_not_x()) + { + /* btr_cur_t::search_leaf(BTR_MODIFY_TREE) only U-latches the + root page initially. */ + ut_ad(block->page.id().page_no() == index->page); + block->page.lock.u_x_upgrade(); + mtr->page_lock_upgrade(*block); + } + return offsets; + } -#define btr_page_get_father_node_ptr_for_validate(of,heap,cur,mtr) \ - btr_page_get_father_node_ptr_func( \ - of,heap,cur,BTR_CONT_SEARCH_TREE,mtr) + return nullptr; +} /************************************************************//** Returns the upper level node pointer to a page. It is assumed that mtr holds @@ -763,36 +893,33 @@ btr_page_get_father_block( /*======================*/ rec_offs* offsets,/*!< in: work area for the return value */ mem_heap_t* heap, /*!< in: memory heap to use */ - dict_index_t* index, /*!< in: b-tree index */ - buf_block_t* block, /*!< in: child page in the index */ mtr_t* mtr, /*!< in: mtr */ btr_cur_t* cursor) /*!< out: cursor on node pointer record, its page x-latched */ { - rec_t* rec - = page_rec_get_next(page_get_infimum_rec(buf_block_get_frame( - block))); - btr_cur_position(index, rec, block, cursor); - return(btr_page_get_father_node_ptr(offsets, heap, cursor, mtr)); + rec_t *rec= + page_rec_get_next(page_get_infimum_rec(cursor->block()->page.frame)); + if (UNIV_UNLIKELY(!rec)) + return nullptr; + cursor->page_cur.rec= rec; + return btr_page_get_parent(offsets, heap, cursor, mtr); } /** Seek to the parent page of a B-tree page. -@param[in,out] index b-tree -@param[in] block child page @param[in,out] mtr mini-transaction -@param[out] cursor cursor pointing to the x-latched parent page */ -void btr_page_get_father(dict_index_t* index, buf_block_t* block, mtr_t* mtr, - btr_cur_t* cursor) +@param[in,out] cursor cursor pointing to the x-latched parent page +@return whether the cursor was successfully positioned */ +bool btr_page_get_father(mtr_t* mtr, btr_cur_t* cursor) { - mem_heap_t* heap; - rec_t* rec - = page_rec_get_next(page_get_infimum_rec(buf_block_get_frame( - block))); - btr_cur_position(index, rec, block, cursor); - - heap = mem_heap_create(100); - btr_page_get_father_node_ptr(NULL, heap, cursor, mtr); - mem_heap_free(heap); + rec_t *rec= + page_rec_get_next(page_get_infimum_rec(cursor->block()->page.frame)); + if (UNIV_UNLIKELY(!rec)) + return false; + cursor->page_cur.rec= rec; + mem_heap_t *heap= mem_heap_create(100); + const bool got= btr_page_get_parent(nullptr, heap, cursor, mtr); + mem_heap_free(heap); + return got; } #ifdef UNIV_DEBUG @@ -802,28 +929,25 @@ constexpr index_id_t BTR_FREED_INDEX_ID = 0; /** Free a B-tree root page. btr_free_but_not_root() must already have been called. -In a persistent tablespace, the caller must invoke fsp_init_file_page() -before mtr.commit(). -@param[in,out] block index root page -@param[in,out] mtr mini-transaction */ -static void btr_free_root(buf_block_t *block, mtr_t *mtr) +@param block index root page +@param space tablespace +@param mtr mini-transaction */ +static void btr_free_root(buf_block_t *block, const fil_space_t &space, + mtr_t *mtr) { ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX | MTR_MEMO_PAGE_SX_FIX)); - ut_ad(mtr->is_named_space(block->page.id().space())); - - btr_search_drop_page_hash_index(block); + ut_ad(mtr->is_named_space(&space)); -#ifdef UNIV_BTR_DEBUG - ut_a(btr_root_fseg_validate(PAGE_HEADER + PAGE_BTR_SEG_TOP + - block->page.frame, - block->page.id().space())); -#endif /* UNIV_BTR_DEBUG */ + btr_search_drop_page_hash_index(block, false); - /* Free the entire segment in small steps. */ - ut_d(mtr->freeing_tree()); - while (!fseg_free_step(PAGE_HEADER + PAGE_BTR_SEG_TOP + - block->page.frame, mtr)); + if (btr_root_fseg_validate(PAGE_HEADER + PAGE_BTR_SEG_TOP, *block, space)) + { + /* Free the entire segment in small steps. */ + ut_d(mtr->freeing_tree()); + while (!fseg_free_step(PAGE_HEADER + PAGE_BTR_SEG_TOP + + block->page.frame, mtr)); + } } MY_ATTRIBUTE((warn_unused_result)) @@ -845,8 +969,6 @@ buf_block_t *btr_free_root_check(const page_id_t page_id, ulint zip_size, nullptr, BUF_GET_POSSIBLY_FREED, mtr); if (!block); - else if (block->page.is_freed()) - block= nullptr; else if (fil_page_index_page_check(block->page.frame) && index_id == btr_page_get_index_id(block->page.frame)) /* This should be a root page. It should not be possible to @@ -902,6 +1024,7 @@ static void btr_root_page_init(buf_block_t *block, index_id_t index_id, @param[in,out] space tablespace where created @param[in] index index, or NULL to create a system table @param[in,out] mtr mini-transaction +@param[out] err error code @return page number of the created root @retval FIL_NULL if did not succeed */ uint32_t @@ -910,12 +1033,14 @@ btr_create( fil_space_t* space, index_id_t index_id, dict_index_t* index, - mtr_t* mtr) + mtr_t* mtr, + dberr_t* err) { buf_block_t* block; ut_ad(mtr->is_named_space(space)); ut_ad(index_id != BTR_FREED_INDEX_ID); + ut_ad(index || space == fil_system.sys_space); /* Create the two new segments (one, in the case of an ibuf tree) for the index tree; the segment headers are put on the allocated root page @@ -925,7 +1050,7 @@ btr_create( if (UNIV_UNLIKELY(type & DICT_IBUF)) { /* Allocate first the ibuf header page */ buf_block_t* ibuf_hdr_block = fseg_create( - space, IBUF_HEADER + IBUF_TREE_SEG_HEADER, mtr); + space, IBUF_HEADER + IBUF_TREE_SEG_HEADER, mtr, err); if (ibuf_hdr_block == NULL) { return(FIL_NULL); @@ -936,11 +1061,11 @@ btr_create( /* Allocate then the next page to the segment: it will be the tree root page */ - block = fseg_alloc_free_page( + block = fseg_alloc_free_page_general( buf_block_get_frame(ibuf_hdr_block) + IBUF_HEADER + IBUF_TREE_SEG_HEADER, IBUF_TREE_ROOT_PAGE_NO, - FSP_UP, mtr); + FSP_UP, false, mtr, mtr, err); if (block == NULL) { return(FIL_NULL); @@ -951,17 +1076,17 @@ btr_create( flst_init(block, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, mtr); } else { block = fseg_create(space, PAGE_HEADER + PAGE_BTR_SEG_TOP, - mtr); + mtr, err); if (block == NULL) { return(FIL_NULL); } if (!fseg_create(space, PAGE_HEADER + PAGE_BTR_SEG_LEAF, mtr, - false, block)) { + err, false, block)) { /* Not enough space for new segment, free root segment before return. */ - btr_free_root(block, mtr); + btr_free_root(block, *space, mtr); return(FIL_NULL); } } @@ -1014,27 +1139,21 @@ btr_free_but_not_root( mtr_start(&mtr); ut_d(mtr.freeing_tree()); mtr_set_log_mode(&mtr, log_mode); - mtr.set_named_space_id(block->page.id().space()); - - page_t* root = block->page.frame; + fil_space_t *space = mtr.set_named_space_id(block->page.id().space()); - if (!root) { + if (!btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF, + *block, *space) + || !btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP, + *block, *space)) { mtr_commit(&mtr); return; } -#ifdef UNIV_BTR_DEBUG - ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF - + root, block->page.id().space())); - ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP - + root, block->page.id().space())); -#endif /* UNIV_BTR_DEBUG */ - /* NOTE: page hash indexes are dropped when a page is freed inside fsp0fsp. */ - bool finished = fseg_free_step(root + PAGE_HEADER + PAGE_BTR_SEG_LEAF, - &mtr + bool finished = fseg_free_step(PAGE_HEADER + PAGE_BTR_SEG_LEAF + + block->page.frame, &mtr #ifdef BTR_CUR_HASH_ADAPT , ahi #endif /* BTR_CUR_HASH_ADAPT */ @@ -1048,21 +1167,16 @@ btr_free_but_not_root( top_loop: mtr_start(&mtr); mtr_set_log_mode(&mtr, log_mode); - mtr.set_named_space_id(block->page.id().space()); - - root = block->page.frame; + space = mtr.set_named_space_id(block->page.id().space()); -#ifdef UNIV_BTR_DEBUG - ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP - + root, block->page.id().space())); -#endif /* UNIV_BTR_DEBUG */ - - finished = fseg_free_step_not_header( - root + PAGE_HEADER + PAGE_BTR_SEG_TOP, &mtr + finished = !btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP, + *block, *space) + || fseg_free_step_not_header(PAGE_HEADER + PAGE_BTR_SEG_TOP + + block->page.frame, &mtr #ifdef BTR_CUR_HASH_ADAPT - ,ahi + ,ahi #endif /* BTR_CUR_HASH_ADAPT */ - ); + ); mtr_commit(&mtr); if (!finished) { @@ -1072,9 +1186,10 @@ btr_free_but_not_root( /** Clear the index tree and reinitialize the root page, in the rollback of TRX_UNDO_EMPTY. The BTR_SEG_LEAF is freed and reinitialized. -@param thr query thread */ +@param thr query thread +@return error code */ TRANSACTIONAL_TARGET -void dict_index_t::clear(que_thr_t *thr) +dberr_t dict_index_t::clear(que_thr_t *thr) { mtr_t mtr; mtr.start(); @@ -1082,10 +1197,13 @@ void dict_index_t::clear(que_thr_t *thr) mtr.set_log_mode(MTR_LOG_NO_REDO); else set_modified(mtr); + mtr_sx_lock_index(this, &mtr); - if (buf_block_t *root_block= buf_page_get(page_id_t(table->space->id, page), - table->space->zip_size(), - RW_X_LATCH, &mtr)) + dberr_t err; + if (buf_block_t *root_block= + buf_page_get_gen(page_id_t(table->space->id, page), + table->space->zip_size(), + RW_X_LATCH, nullptr, BUF_GET, &mtr, &err)) { btr_free_but_not_root(root_block, mtr.get_log_mode() #ifdef BTR_CUR_HASH_ADAPT @@ -1095,17 +1213,18 @@ void dict_index_t::clear(que_thr_t *thr) #ifdef BTR_CUR_HASH_ADAPT if (root_block->index) - btr_search_drop_page_hash_index(root_block); + btr_search_drop_page_hash_index(root_block, false); ut_ad(n_ahi_pages() == 0); #endif mtr.memset(root_block, PAGE_HEADER + PAGE_BTR_SEG_LEAF, FSEG_HEADER_SIZE, 0); - if (fseg_create(table->space, PAGE_HEADER + PAGE_BTR_SEG_LEAF, &mtr, false, - root_block)) + if (fseg_create(table->space, PAGE_HEADER + PAGE_BTR_SEG_LEAF, &mtr, + &err, false, root_block)) btr_root_page_init(root_block, id, this, &mtr); } mtr.commit(); + return err; } /** Free a persistent index tree if it exists. @@ -1122,7 +1241,7 @@ void btr_free_if_exists(fil_space_t *space, uint32_t page, { btr_free_but_not_root(root, mtr->get_log_mode()); mtr->set_named_space(space); - btr_free_root(root, mtr); + btr_free_root(root, *space, mtr); } } @@ -1143,7 +1262,7 @@ void btr_drop_temporary_table(const dict_table_t &table) { btr_free_but_not_root(block, MTR_LOG_NO_REDO); mtr.set_log_mode(MTR_LOG_NO_REDO); - btr_free_root(block, &mtr); + btr_free_root(block, *fil_system.temp_space, &mtr); mtr.commit(); mtr.start(); } @@ -1235,53 +1354,56 @@ btr_read_autoinc_with_fallback(const dict_table_t* table, unsigned col_no) void btr_write_autoinc(dict_index_t* index, ib_uint64_t autoinc, bool reset) { - ut_ad(index->is_primary()); - ut_ad(index->table->persistent_autoinc); - ut_ad(!index->table->is_temporary()); + ut_ad(index->is_primary()); + ut_ad(index->table->persistent_autoinc); + ut_ad(!index->table->is_temporary()); - mtr_t mtr; - mtr.start(); - fil_space_t* space = index->table->space; - mtr.set_named_space(space); - page_set_autoinc(buf_page_get(page_id_t(space->id, index->page), - space->zip_size(), - RW_SX_LATCH, &mtr), - autoinc, &mtr, reset); - mtr.commit(); + mtr_t mtr; + mtr.start(); + fil_space_t *space= index->table->space; + if (buf_block_t *root= buf_page_get(page_id_t(space->id, index->page), + space->zip_size(), RW_SX_LATCH, &mtr)) + { + mtr.set_named_space(space); + page_set_autoinc(root, autoinc, &mtr, reset); + } + + mtr.commit(); } /** Reorganize an index page. @param cursor index page cursor -@param index the index that the cursor belongs to @param mtr mini-transaction */ -static void btr_page_reorganize_low(page_cur_t *cursor, dict_index_t *index, - mtr_t *mtr) +static dberr_t btr_page_reorganize_low(page_cur_t *cursor, mtr_t *mtr) { - const mtr_log_t log_mode= mtr->set_log_mode(MTR_LOG_NO_REDO); - buf_block_t *const block= cursor->block; ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); ut_ad(!is_buf_block_get_page_zip(block)); - btr_assert_not_corrupted(block, index); ut_ad(fil_page_index_page_check(block->page.frame)); - ut_ad(index->is_dummy || - block->page.id().space() == index->table->space->id); - ut_ad(index->is_dummy || block->page.id().page_no() != index->page || + ut_ad(cursor->index->is_dummy || + block->page.id().space() == cursor->index->table->space->id); + ut_ad(cursor->index->is_dummy || + block->page.id().page_no() != cursor->index->page || !page_has_siblings(block->page.frame)); + /* Save the cursor position. */ + const ulint pos= page_rec_get_n_recs_before(cursor->rec); + + if (UNIV_UNLIKELY(pos == ULINT_UNDEFINED)) + return DB_CORRUPTION; + + btr_search_drop_page_hash_index(block, false); + buf_block_t *old= buf_block_alloc(); /* Copy the old page to temporary space */ memcpy_aligned(old->page.frame, block->page.frame, srv_page_size); - btr_search_drop_page_hash_index(block); - - /* Save the cursor position. */ - const ulint pos= page_rec_get_n_recs_before(cursor->rec); + const mtr_log_t log_mode= mtr->set_log_mode(MTR_LOG_NO_REDO); - page_create(block, mtr, index->table->not_redundant()); - if (index->is_spatial()) + page_create(block, mtr, cursor->index->table->not_redundant()); + if (cursor->index->is_spatial()) block->page.frame[FIL_PAGE_TYPE + 1]= byte(FIL_PAGE_RTREE); static_assert(((FIL_PAGE_INDEX & 0xff00) | byte(FIL_PAGE_RTREE)) == @@ -1290,9 +1412,14 @@ static void btr_page_reorganize_low(page_cur_t *cursor, dict_index_t *index, /* Copy the records from the temporary space to the recreated page; do not copy the lock bits yet */ - page_copy_rec_list_end_no_locks(block, old, - page_get_infimum_rec(old->page.frame), - index, mtr); + dberr_t err= + page_copy_rec_list_end_no_locks(block, old, + page_get_infimum_rec(old->page.frame), + cursor->index, mtr); + mtr->set_log_mode(log_mode); + + if (UNIV_UNLIKELY(err != DB_SUCCESS)) + return err; /* Copy the PAGE_MAX_TRX_ID or PAGE_ROOT_AUTO_INC. */ ut_ad(!page_get_max_trx_id(block->page.frame)); @@ -1302,17 +1429,18 @@ static void btr_page_reorganize_low(page_cur_t *cursor, dict_index_t *index, if (page_get_max_trx_id(block->page.frame)) /* PAGE_MAX_TRX_ID must be zero on non-leaf pages other than clustered index root pages. */ - ut_ad(dict_index_is_sec_or_ibuf(index) + ut_ad(dict_index_is_sec_or_ibuf(cursor->index) ? page_is_leaf(block->page.frame) - : block->page.id().page_no() == index->page); + : block->page.id().page_no() == cursor->index->page); else /* PAGE_MAX_TRX_ID is unused in clustered index pages (other than the root where it is repurposed as PAGE_ROOT_AUTO_INC), non-leaf pages, and in temporary tables. It was always zero-initialized in page_create(). PAGE_MAX_TRX_ID must be nonzero on dict_index_is_sec_or_ibuf() leaf pages. */ - ut_ad(index->table->is_temporary() || !page_is_leaf(block->page.frame) || - !dict_index_is_sec_or_ibuf(index)); + ut_ad(cursor->index->table->is_temporary() || + !page_is_leaf(block->page.frame) || + !dict_index_is_sec_or_ibuf(cursor->index)); #endif const uint16_t data_size1= page_get_data_size(old->page.frame); @@ -1323,27 +1451,39 @@ static void btr_page_reorganize_low(page_cur_t *cursor, dict_index_t *index, page_get_max_insert_size_after_reorganize(block->page.frame, 1); if (UNIV_UNLIKELY(data_size1 != data_size2 || max1 != max2)) - ib::fatal() << "Page old data size " << data_size1 - << " new data size " << data_size2 - << ", page old max ins size " << max1 - << " new max ins size " << max2; + { + sql_print_error("InnoDB: Page old data size %u new data size %u" + ", page old max ins size %zu new max ins size %zu", + data_size1, data_size2, max1, max2); + return DB_CORRUPTION; + } /* Restore the cursor position. */ - if (pos) - cursor->rec = page_rec_get_nth(block->page.frame, pos); - else + if (!pos) ut_ad(cursor->rec == page_get_infimum_rec(block->page.frame)); + else if (!(cursor->rec= page_rec_get_nth(block->page.frame, pos))) + return DB_CORRUPTION; - if (block->page.id().page_no() == index->page && - fil_page_get_type(old->page.frame) == FIL_PAGE_TYPE_INSTANT) + if (block->page.id().page_no() != cursor->index->page || + fil_page_get_type(old->page.frame) != FIL_PAGE_TYPE_INSTANT) + ut_ad(!memcmp(old->page.frame, block->page.frame, PAGE_HEADER)); + else if (!cursor->index->is_instant()) + { + ut_ad(!memcmp(old->page.frame, block->page.frame, FIL_PAGE_TYPE)); + ut_ad(!memcmp(old->page.frame + FIL_PAGE_TYPE + 2, + block->page.frame + FIL_PAGE_TYPE + 2, + PAGE_HEADER - FIL_PAGE_TYPE - 2)); + mtr->write<2,mtr_t::FORCED>(*block, FIL_PAGE_TYPE + block->page.frame, + FIL_PAGE_INDEX); + } + else { /* Preserve the PAGE_INSTANT information. */ - ut_ad(index->is_instant()); memcpy_aligned<2>(FIL_PAGE_TYPE + block->page.frame, FIL_PAGE_TYPE + old->page.frame, 2); memcpy_aligned<2>(PAGE_HEADER + PAGE_INSTANT + block->page.frame, PAGE_HEADER + PAGE_INSTANT + old->page.frame, 2); - if (!index->table->instant); + if (!cursor->index->table->instant); else if (page_is_comp(block->page.frame)) { memcpy(PAGE_NEW_INFIMUM + block->page.frame, @@ -1358,18 +1498,21 @@ static void btr_page_reorganize_low(page_cur_t *cursor, dict_index_t *index, memcpy(PAGE_OLD_SUPREMUM + block->page.frame, PAGE_OLD_SUPREMUM + old->page.frame, 8); } + + ut_ad(!memcmp(old->page.frame, block->page.frame, PAGE_HEADER)); } - ut_ad(!memcmp(old->page.frame, block->page.frame, PAGE_HEADER)); ut_ad(!memcmp(old->page.frame + PAGE_MAX_TRX_ID + PAGE_HEADER, block->page.frame + PAGE_MAX_TRX_ID + PAGE_HEADER, PAGE_DATA - (PAGE_MAX_TRX_ID + PAGE_HEADER))); - if (!dict_table_is_locking_disabled(index->table)) + if (!cursor->index->has_locking()); + else if (cursor->index->page == FIL_NULL) + ut_ad(cursor->index->is_dummy); + else lock_move_reorganize_page(block, old); /* Write log for the changes, if needed. */ - mtr->set_log_mode(log_mode); if (log_mode == MTR_LOG_ALL) { /* Check and log the changes in the page header. */ @@ -1494,6 +1637,7 @@ static void btr_page_reorganize_low(page_cur_t *cursor, dict_index_t *index, MONITOR_INC(MONITOR_INDEX_REORG_ATTEMPTS); MONITOR_INC(MONITOR_INDEX_REORG_SUCCESSFUL); + return DB_SUCCESS; } /*************************************************************//** @@ -1505,9 +1649,9 @@ be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit(). On uncompressed pages, IBUF_BITMAP_FREE is unaffected by reorganization. -@retval true if the operation was successful -@retval false if it is a compressed page, and recompression failed */ -bool +@return error code +@retval DB_FAIL if reorganizing a ROW_FORMAT=COMPRESSED page failed */ +dberr_t btr_page_reorganize_block( ulint z_level,/*!< in: compression level to be used if dealing with compressed page */ @@ -1515,15 +1659,12 @@ btr_page_reorganize_block( dict_index_t* index, /*!< in: the index tree of the page */ mtr_t* mtr) /*!< in/out: mini-transaction */ { - if (buf_block_get_page_zip(block)) { - return page_zip_reorganize(block, index, z_level, mtr, true); - } - - page_cur_t cur; - page_cur_set_before_first(block, &cur); - - btr_page_reorganize_low(&cur, index, mtr); - return true; + if (buf_block_get_page_zip(block)) + return page_zip_reorganize(block, index, z_level, mtr, true); + page_cur_t cur; + page_cur_set_before_first(block, &cur); + cur.index= index; + return btr_page_reorganize_low(&cur, mtr); } /*************************************************************//** @@ -1535,33 +1676,28 @@ be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit(). On uncompressed pages, IBUF_BITMAP_FREE is unaffected by reorganization. -@retval true if the operation was successful -@retval false if it is a compressed page, and recompression failed */ -bool -btr_page_reorganize( -/*================*/ - page_cur_t* cursor, /*!< in/out: page cursor */ - dict_index_t* index, /*!< in: the index tree of the page */ - mtr_t* mtr) /*!< in/out: mini-transaction */ +@param cursor page cursor +@param mtr mini-transaction +@return error code +@retval DB_FAIL if reorganizing a ROW_FORMAT=COMPRESSED page failed */ +dberr_t btr_page_reorganize(page_cur_t *cursor, mtr_t *mtr) { - if (!buf_block_get_page_zip(cursor->block)) { - btr_page_reorganize_low(cursor, index, mtr); - return true; - } - - ulint pos = page_rec_get_n_recs_before(cursor->rec); - if (!page_zip_reorganize(cursor->block, index, page_zip_level, mtr, - true)) { - return false; - } - if (pos) { - cursor->rec = page_rec_get_nth(cursor->block->page.frame, pos); - } else { - ut_ad(cursor->rec == page_get_infimum_rec( - cursor->block->page.frame)); - } - - return true; + if (!buf_block_get_page_zip(cursor->block)) + return btr_page_reorganize_low(cursor, mtr); + + ulint pos= page_rec_get_n_recs_before(cursor->rec); + if (UNIV_UNLIKELY(pos == ULINT_UNDEFINED)) + return DB_CORRUPTION; + + dberr_t err= page_zip_reorganize(cursor->block, cursor->index, + page_zip_level, mtr, true); + if (err == DB_FAIL); + else if (!pos) + ut_ad(cursor->rec == page_get_infimum_rec(cursor->block->page.frame)); + else if (!(cursor->rec= page_rec_get_nth(cursor->block->page.frame, pos))) + err= DB_CORRUPTION; + + return err; } /** Empty an index page (possibly the root page). @see btr_page_create(). @@ -1587,7 +1723,7 @@ btr_page_empty( || page_zip_validate(page_zip, block->page.frame, index)); #endif /* UNIV_ZIP_DEBUG */ - btr_search_drop_page_hash_index(block); + btr_search_drop_page_hash_index(block, false); /* Recreate the page: note that global data on page (possible segment headers, next page-field, etc.) is preserved intact */ @@ -1694,39 +1830,37 @@ void btr_reset_instant(const dict_index_t &index, bool all, mtr_t *mtr) { ut_ad(!index.table->is_temporary()); ut_ad(index.is_primary()); - if (buf_block_t *root = btr_root_block_get(&index, RW_SX_LATCH, mtr)) + buf_block_t *root= btr_get_latched_root(index, mtr); + byte *page_type= root->page.frame + FIL_PAGE_TYPE; + if (all) { - byte *page_type= root->page.frame + FIL_PAGE_TYPE; - if (all) - { - ut_ad(mach_read_from_2(page_type) == FIL_PAGE_TYPE_INSTANT || - mach_read_from_2(page_type) == FIL_PAGE_INDEX); - mtr->write<2,mtr_t::MAYBE_NOP>(*root, page_type, FIL_PAGE_INDEX); - byte *instant= PAGE_INSTANT + PAGE_HEADER + root->page.frame; - mtr->write<2,mtr_t::MAYBE_NOP>(*root, instant, - page_ptr_get_direction(instant + 1)); - } - else - ut_ad(mach_read_from_2(page_type) == FIL_PAGE_TYPE_INSTANT); - static const byte supremuminfimum[8 + 8] = "supremuminfimum"; - uint16_t infimum, supremum; - if (page_is_comp(root->page.frame)) - { - infimum= PAGE_NEW_INFIMUM; - supremum= PAGE_NEW_SUPREMUM; - } - else - { - infimum= PAGE_OLD_INFIMUM; - supremum= PAGE_OLD_SUPREMUM; - } - ut_ad(!memcmp(&root->page.frame[infimum], supremuminfimum + 8, 8) == - !memcmp(&root->page.frame[supremum], supremuminfimum, 8)); - mtr->memcpy(*root, &root->page.frame[infimum], - supremuminfimum + 8, 8); - mtr->memcpy(*root, &root->page.frame[supremum], - supremuminfimum, 8); + ut_ad(mach_read_from_2(page_type) == FIL_PAGE_TYPE_INSTANT || + mach_read_from_2(page_type) == FIL_PAGE_INDEX); + mtr->write<2,mtr_t::MAYBE_NOP>(*root, page_type, FIL_PAGE_INDEX); + byte *instant= PAGE_INSTANT + PAGE_HEADER + root->page.frame; + mtr->write<2,mtr_t::MAYBE_NOP>(*root, instant, + page_ptr_get_direction(instant + 1)); + } + else + ut_ad(mach_read_from_2(page_type) == FIL_PAGE_TYPE_INSTANT); + static const byte supremuminfimum[8 + 8] = "supremuminfimum"; + uint16_t infimum, supremum; + if (page_is_comp(root->page.frame)) + { + infimum= PAGE_NEW_INFIMUM; + supremum= PAGE_NEW_SUPREMUM; + } + else + { + infimum= PAGE_OLD_INFIMUM; + supremum= PAGE_OLD_SUPREMUM; } + ut_ad(!memcmp(&root->page.frame[infimum], supremuminfimum + 8, 8) == + !memcmp(&root->page.frame[supremum], supremuminfimum, 8)); + mtr->memcpy(*root, &root->page.frame[infimum], + supremuminfimum + 8, 8); + mtr->memcpy(*root, &root->page.frame[supremum], + supremuminfimum, 8); } /*************************************************************//** @@ -1748,10 +1882,10 @@ btr_root_raise_and_insert( mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ const dtuple_t* tuple, /*!< in: tuple to insert */ ulint n_ext, /*!< in: number of externally stored columns */ - mtr_t* mtr) /*!< in: mtr */ + mtr_t* mtr, /*!< in: mtr */ + dberr_t* err) /*!< out: error code */ { dict_index_t* index; - ulint new_page_no; rec_t* rec; dtuple_t* node_ptr; ulint level; @@ -1773,32 +1907,33 @@ btr_root_raise_and_insert( #endif /* UNIV_ZIP_DEBUG */ const page_id_t root_id{root->page.id()}; -#ifdef UNIV_BTR_DEBUG - if (!dict_index_is_ibuf(index)) { - ulint space = index->table->space_id; - - ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF - + root->page.frame, space)); - ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP - + root->page.frame, space)); - } - - ut_a(dict_index_get_page(index) == root_id.page_no()); -#endif /* UNIV_BTR_DEBUG */ ut_ad(mtr->memo_contains_flagged(&index->lock, MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); ut_ad(mtr->memo_contains_flagged(root, MTR_MEMO_PAGE_X_FIX)); + if (index->page != root_id.page_no()) { + ut_ad("corrupted root page number" == 0); + return nullptr; + } + + if (index->is_ibuf()) { + } else if (!btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF, + *root, *index->table->space) + || !btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP, + *root, *index->table->space)) { + return nullptr; + } + /* Allocate a new page to the tree. Root splitting is done by first moving the root records to the new page, emptying the root, putting a node pointer to the new page, and then splitting the new page. */ level = btr_page_get_level(root->page.frame); - new_block = btr_page_alloc(index, 0, FSP_NO_DIR, level, mtr, mtr); + new_block = btr_page_alloc(index, 0, FSP_NO_DIR, level, mtr, mtr, err); - if (new_block == NULL && os_has_said_disk_full) { - return(NULL); + if (!new_block) { + return nullptr; } new_page_zip = buf_block_get_page_zip(new_block); @@ -1822,14 +1957,23 @@ btr_root_raise_and_insert( } /* Copy the records from root to the new page one by one. */ - if (0 #ifdef UNIV_ZIP_COPY || new_page_zip #endif /* UNIV_ZIP_COPY */ || !page_copy_rec_list_end(new_block, root, page_get_infimum_rec(root->page.frame), - index, mtr)) { + index, mtr, err)) { + switch (*err) { + case DB_SUCCESS: + break; + case DB_FAIL: + *err = DB_SUCCESS; + break; + default: + return nullptr; + } + ut_a(new_page_zip); /* Copy the page byte for byte. */ @@ -1837,8 +1981,11 @@ btr_root_raise_and_insert( root->page.frame, index, mtr); /* Update the lock table and possible hash index. */ - lock_move_rec_list_end(new_block, root, - page_get_infimum_rec(root->page.frame)); + if (index->has_locking()) { + lock_move_rec_list_end( + new_block, root, + page_get_infimum_rec(root->page.frame)); + } /* Move any existing predicate locks */ if (dict_index_is_spatial(index)) { @@ -1886,7 +2033,7 @@ btr_root_raise_and_insert( information of the record to be inserted on the infimum of the root page: we cannot discard the lock structs on the root page */ - if (!dict_table_is_locking_disabled(index->table)) { + if (index->has_locking()) { lock_update_root_raise(*new_block, root_id); } @@ -1895,8 +2042,9 @@ btr_root_raise_and_insert( *heap = mem_heap_create(1000); } + const uint32_t new_page_no = new_block->page.id().page_no(); rec = page_rec_get_next(page_get_infimum_rec(new_block->page.frame)); - new_page_no = new_block->page.id().page_no(); + ut_ad(rec); /* We just created the page. */ /* Build the node pointer (= node key and page address) for the child */ @@ -1936,7 +2084,7 @@ btr_root_raise_and_insert( page_cur_set_before_first(root, page_cursor); node_ptr_rec = page_cur_tuple_insert(page_cursor, node_ptr, - index, offsets, heap, 0, mtr); + offsets, heap, 0, mtr); /* The root page should only contain the node pointer to new_block at this point. Thus, the data should fit. */ @@ -1949,23 +2097,23 @@ btr_root_raise_and_insert( ibuf_reset_free_bits(new_block); } - if (tuple != NULL) { - /* Reposition the cursor to the child node */ - page_cur_search(new_block, index, tuple, page_cursor); - } else { - /* Set cursor to first record on child node */ - page_cur_set_before_first(new_block, page_cursor); + page_cursor->block = new_block; + page_cursor->index = index; + + ut_ad(dtuple_check_typed(tuple)); + /* Reposition the cursor to the child node */ + ulint low_match = 0, up_match = 0; + + if (page_cur_search_with_match(tuple, PAGE_CUR_LE, + &up_match, &low_match, + page_cursor, nullptr)) { + *err = DB_CORRUPTION; + return nullptr; } /* Split the child and insert tuple */ - if (dict_index_is_spatial(index)) { - /* Split rtree page and insert tuple */ - return(rtr_page_split_and_insert(flags, cursor, offsets, heap, - tuple, n_ext, mtr)); - } else { - return(btr_page_split_and_insert(flags, cursor, offsets, heap, - tuple, n_ext, mtr)); - } + return btr_page_split_and_insert(flags, cursor, offsets, heap, + tuple, n_ext, mtr, err); } /** Decide if the page should be split at the convergence point of inserts @@ -1991,10 +2139,10 @@ rec_t* btr_page_get_split_rec_to_left(const btr_cur_t* cursor) So, we can only assert that when the metadata record exists, index->is_instant() must hold. */ ut_ad(!page_is_leaf(page) || page_has_prev(page) - || cursor->index->is_instant() + || cursor->index()->is_instant() || !(rec_get_info_bits(page_rec_get_next_const( page_get_infimum_rec(page)), - cursor->index->table->not_redundant()) + cursor->index()->table->not_redundant()) & REC_INFO_MIN_REC_FLAG)); const rec_t* infimum = page_get_infimum_rec(page); @@ -2036,7 +2184,7 @@ btr_page_get_split_rec_to_right(const btr_cur_t* cursor, rec_t** split_rec) insert_point = page_rec_get_next(insert_point); - if (page_rec_is_supremum(insert_point)) { + if (!insert_point || page_rec_is_supremum(insert_point)) { insert_point = NULL; } else { insert_point = page_rec_get_next(insert_point); @@ -2087,14 +2235,14 @@ btr_page_get_split_rec( page = btr_cur_get_page(cursor); - insert_size = rec_get_converted_size(cursor->index, tuple, n_ext); + insert_size = rec_get_converted_size(cursor->index(), tuple, n_ext); free_space = page_get_free_space_of_empty(page_is_comp(page)); page_zip = btr_cur_get_page_zip(cursor); if (page_zip) { /* Estimate the free space of an empty compressed page. */ ulint free_space_zip = page_zip_empty_size( - cursor->index->n_fields, + cursor->index()->n_fields, page_zip_get_size(page_zip)); if (free_space > (ulint) free_space_zip) { @@ -2139,9 +2287,10 @@ btr_page_get_split_rec( /* Include tuple */ incl_data += insert_size; } else { - offsets = rec_get_offsets(rec, cursor->index, offsets, - page_is_leaf(page) - ? cursor->index->n_core_fields + offsets = rec_get_offsets(rec, cursor->index(), + offsets, page_is_leaf(page) + ? cursor->index() + ->n_core_fields : 0, ULINT_UNDEFINED, &heap); incl_data += rec_offs_size(offsets); @@ -2178,6 +2327,7 @@ btr_page_get_split_rec( return(rec); } +#ifdef UNIV_DEBUG /*************************************************************//** Returns TRUE if the insert fits on the appropriate half-page with the chosen split_rec. @@ -2192,7 +2342,7 @@ btr_page_insert_fits( on upper half-page, or NULL if tuple to be inserted should be first */ rec_offs** offsets,/*!< in: rec_get_offsets( - split_rec, cursor->index); out: garbage */ + split_rec, cursor->index()); out: garbage */ const dtuple_t* tuple, /*!< in: tuple to insert */ ulint n_ext, /*!< in: number of externally stored columns */ mem_heap_t** heap) /*!< in: temporary memory heap */ @@ -2210,9 +2360,9 @@ btr_page_insert_fits( ut_ad(!split_rec || !page_is_comp(page) == !rec_offs_comp(*offsets)); ut_ad(!split_rec - || rec_offs_validate(split_rec, cursor->index, *offsets)); + || rec_offs_validate(split_rec, cursor->index(), *offsets)); - insert_size = rec_get_converted_size(cursor->index, tuple, n_ext); + insert_size = rec_get_converted_size(cursor->index(), tuple, n_ext); free_space = page_get_free_space_of_empty(page_is_comp(page)); /* free_space is now the free space of a created new page */ @@ -2224,19 +2374,20 @@ btr_page_insert_fits( end_rec) will end up on the other half page from tuple when it is inserted. */ - if (split_rec == NULL) { - rec = page_rec_get_next(page_get_infimum_rec(page)); + if (!(end_rec = split_rec)) { end_rec = page_rec_get_next(btr_cur_get_rec(cursor)); - - } else if (cmp_dtuple_rec(tuple, split_rec, *offsets) >= 0) { - - rec = page_rec_get_next(page_get_infimum_rec(page)); - end_rec = split_rec; - } else { + } else if (cmp_dtuple_rec(tuple, split_rec, cursor->index(), + *offsets) < 0) { rec = split_rec; end_rec = page_get_supremum_rec(page); + goto got_rec; + } + + if (!(rec = page_rec_get_next(page_get_infimum_rec(page)))) { + return false; } +got_rec: if (total_data + page_dir_calc_reserved_space(total_n_recs) <= free_space) { @@ -2250,9 +2401,9 @@ btr_page_insert_fits( /* In this loop we calculate the amount of reserved space after rec is removed from page. */ - *offsets = rec_get_offsets(rec, cursor->index, *offsets, + *offsets = rec_get_offsets(rec, cursor->index(), *offsets, page_is_leaf(page) - ? cursor->index->n_core_fields + ? cursor->index()->n_core_fields : 0, ULINT_UNDEFINED, heap); @@ -2268,16 +2419,19 @@ btr_page_insert_fits( return(true); } - rec = page_rec_get_next_const(rec); + if (!(rec = page_rec_get_next_const(rec))) { + break; + } } return(false); } +#endif /*******************************************************//** Inserts a data tuple to a tree on a non-leaf level. It is assumed that mtr holds an x-latch on the tree. */ -void +dberr_t btr_insert_on_non_leaf_level( ulint flags, /*!< in: undo logging and locking flags */ dict_index_t* index, /*!< in: index */ @@ -2287,7 +2441,6 @@ btr_insert_on_non_leaf_level( { big_rec_t* dummy_big_rec; btr_cur_t cursor; - dberr_t err; rec_t* rec; mem_heap_t* heap = NULL; rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; @@ -2297,69 +2450,70 @@ btr_insert_on_non_leaf_level( ut_ad(level > 0); - if (!dict_index_is_spatial(index)) { - dberr_t err = btr_cur_search_to_nth_level( - index, level, tuple, PAGE_CUR_LE, - BTR_CONT_MODIFY_TREE, - &cursor, 0, mtr); - - if (err != DB_SUCCESS) { - ib::warn() << " Error code: " << err - << " btr_page_get_father_node_ptr_func " - << " level: " << level - << " table: " << index->table->name - << " index: " << index->name; - } - } else { + flags |= BTR_NO_LOCKING_FLAG | BTR_KEEP_SYS_FLAG + | BTR_NO_UNDO_LOG_FLAG; + cursor.page_cur.index = index; + + dberr_t err; + + if (index->is_spatial()) { /* For spatial index, initialize structures to track its parents etc. */ rtr_init_rtr_info(&rtr_info, false, &cursor, index, false); rtr_info_update_btr(&cursor, &rtr_info); - - btr_cur_search_to_nth_level(index, level, tuple, - PAGE_CUR_RTREE_INSERT, - BTR_CONT_MODIFY_TREE, - &cursor, 0, mtr); + err = rtr_search_to_nth_level(level, tuple, + PAGE_CUR_RTREE_INSERT, + BTR_CONT_MODIFY_TREE, + &cursor, mtr); + } else { + err = btr_cur_search_to_nth_level(level, tuple, RW_X_LATCH, + &cursor, mtr); } ut_ad(cursor.flag == BTR_CUR_BINARY); + ut_ad(btr_cur_get_block(&cursor) + != mtr->at_savepoint(mtr->get_savepoint() - 1) + || index->is_spatial() + || mtr->memo_contains(index->lock, MTR_MEMO_X_LOCK)); - err = btr_cur_optimistic_insert( - flags - | BTR_NO_LOCKING_FLAG - | BTR_KEEP_SYS_FLAG - | BTR_NO_UNDO_LOG_FLAG, - &cursor, &offsets, &heap, - tuple, &rec, &dummy_big_rec, 0, NULL, mtr); + if (UNIV_LIKELY(err == DB_SUCCESS)) { + err = btr_cur_optimistic_insert(flags, + &cursor, &offsets, &heap, + tuple, &rec, + &dummy_big_rec, 0, NULL, mtr); + } if (err == DB_FAIL) { - err = btr_cur_pessimistic_insert(flags - | BTR_NO_LOCKING_FLAG - | BTR_KEEP_SYS_FLAG - | BTR_NO_UNDO_LOG_FLAG, + err = btr_cur_pessimistic_insert(flags, &cursor, &offsets, &heap, tuple, &rec, &dummy_big_rec, 0, NULL, mtr); - ut_a(err == DB_SUCCESS); } - if (heap != NULL) { + if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); } - if (dict_index_is_spatial(index)) { + if (index->is_spatial()) { ut_ad(cursor.rtr_info); rtr_clean_rtr_info(&rtr_info, true); } + + return err; } +static_assert(FIL_PAGE_OFFSET % 4 == 0, "alignment"); +static_assert(FIL_PAGE_PREV % 4 == 0, "alignment"); +static_assert(FIL_PAGE_NEXT % 4 == 0, "alignment"); + +MY_ATTRIBUTE((nonnull,warn_unused_result)) /**************************************************************//** Attaches the halves of an index page on the appropriate level in an index tree. */ -static MY_ATTRIBUTE((nonnull)) -void +static +dberr_t btr_attach_half_pages( /*==================*/ ulint flags, /*!< in: undo logging and @@ -2374,8 +2528,8 @@ btr_attach_half_pages( { dtuple_t* node_ptr_upper; mem_heap_t* heap; - buf_block_t* prev_block = NULL; - buf_block_t* next_block = NULL; + buf_block_t* prev_block = nullptr; + buf_block_t* next_block = nullptr; buf_block_t* lower_block; buf_block_t* upper_block; @@ -2394,9 +2548,12 @@ btr_attach_half_pages( lower_block = new_block; upper_block = block; + cursor.page_cur.block = block; + cursor.page_cur.index = index; + /* Look up the index for the node pointer to page */ - offsets = btr_page_get_father_block(NULL, heap, index, - block, mtr, &cursor); + offsets = btr_page_get_father_block(nullptr, heap, mtr, + &cursor); /* Replace the address of the old child node (= page) with the address of the new lower half */ @@ -2414,6 +2571,7 @@ btr_attach_half_pages( /* Get the level of the split pages */ const ulint level = btr_page_get_level(block->page.frame); ut_ad(level == btr_page_get_level(new_block->page.frame)); + page_id_t id{block->page.id()}; /* Get the previous and next pages of page */ const uint32_t prev_page_no = btr_page_get_prev(block->page.frame); @@ -2421,12 +2579,28 @@ btr_attach_half_pages( /* for consistency, both blocks should be locked, before change */ if (prev_page_no != FIL_NULL && direction == FSP_DOWN) { - prev_block = btr_block_get(*index, prev_page_no, RW_X_LATCH, - !level, mtr); + id.set_page_no(prev_page_no); + prev_block = mtr->get_already_latched(id, MTR_MEMO_PAGE_X_FIX); +#if 1 /* MDEV-29835 FIXME: acquire page latches upfront */ + if (!prev_block) { + ut_ad(mtr->memo_contains(index->lock, + MTR_MEMO_X_LOCK)); + prev_block = btr_block_get(*index, prev_page_no, + RW_X_LATCH, !level, mtr); + } +#endif } if (next_page_no != FIL_NULL && direction != FSP_DOWN) { - next_block = btr_block_get(*index, next_page_no, RW_X_LATCH, - !level, mtr); + id.set_page_no(next_page_no); + next_block = mtr->get_already_latched(id, MTR_MEMO_PAGE_X_FIX); +#if 1 /* MDEV-29835 FIXME: acquire page latches upfront */ + if (!next_block) { + ut_ad(mtr->memo_contains(index->lock, + MTR_MEMO_X_LOCK)); + next_block = btr_block_get(*index, next_page_no, + RW_X_LATCH, !level, mtr); + } +#endif } /* Build the node pointer (= node key and page address) for the upper @@ -2439,32 +2613,38 @@ btr_attach_half_pages( /* Insert it next to the pointer to the lower half. Note that this may generate recursion leading to a split on the higher level. */ - btr_insert_on_non_leaf_level(flags, index, level + 1, - node_ptr_upper, mtr); + dberr_t err = btr_insert_on_non_leaf_level( + flags, index, level + 1, node_ptr_upper, mtr); /* Free the memory heap */ mem_heap_free(heap); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + return err; + } + /* Update page links of the level */ if (prev_block) { -#ifdef UNIV_BTR_DEBUG - ut_a(page_is_comp(prev_block->page.frame) - == page_is_comp(block->page.frame)); - ut_a(btr_page_get_next(prev_block->page.frame) - == block->page.id().page_no()); -#endif /* UNIV_BTR_DEBUG */ + if (UNIV_UNLIKELY(memcmp_aligned<4>(prev_block->page.frame + + FIL_PAGE_NEXT, + block->page.frame + + FIL_PAGE_OFFSET, + 4))) { + return DB_CORRUPTION; + } btr_page_set_next(prev_block, lower_block->page.id().page_no(), mtr); } if (next_block) { -#ifdef UNIV_BTR_DEBUG - ut_a(page_is_comp(next_block->page.frame) - == page_is_comp(block->page.frame)); - ut_a(btr_page_get_prev(next_block->page.frame) - == block->page.id().page_no()); -#endif /* UNIV_BTR_DEBUG */ + if (UNIV_UNLIKELY(memcmp_aligned<4>(next_block->page.frame + + FIL_PAGE_PREV, + block->page.frame + + FIL_PAGE_OFFSET, + 4))) { + return DB_CORRUPTION; + } btr_page_set_prev(next_block, upper_block->page.id().page_no(), mtr); } @@ -2483,6 +2663,8 @@ btr_attach_half_pages( btr_page_set_prev(upper_block, lower_block->page.id().page_no(), mtr); btr_page_set_next(lower_block, upper_block->page.id().page_no(), mtr); + + return DB_SUCCESS; } /*************************************************************//** @@ -2506,15 +2688,17 @@ btr_page_tuple_smaller( /* Read the first user record in the page. */ block = btr_cur_get_block(cursor); page_cur_set_before_first(block, &pcur); - page_cur_move_to_next(&pcur); - first_rec = page_cur_get_rec(&pcur); + if (UNIV_UNLIKELY(!(first_rec = page_cur_move_to_next(&pcur)))) { + ut_ad("corrupted page" == 0); + return false; + } - *offsets = rec_get_offsets(first_rec, cursor->index, *offsets, + *offsets = rec_get_offsets(first_rec, cursor->index(), *offsets, page_is_leaf(block->page.frame) - ? cursor->index->n_core_fields : 0, + ? cursor->index()->n_core_fields : 0, n_uniq, heap); - return(cmp_dtuple_rec(tuple, first_rec, *offsets) < 0); + return cmp_dtuple_rec(tuple, first_rec, cursor->index(), *offsets) < 0; } /** Insert the tuple into the right sibling page, if the cursor is at the end @@ -2545,62 +2729,70 @@ btr_insert_into_right_sibling( page_t* page = buf_block_get_frame(block); const uint32_t next_page_no = btr_page_get_next(page); - ut_ad(mtr->memo_contains_flagged(&cursor->index->lock, + ut_ad(mtr->memo_contains_flagged(&cursor->index()->lock, MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); ut_ad(heap); + ut_ad(dtuple_check_typed(tuple)); if (next_page_no == FIL_NULL || !page_rec_is_supremum( page_rec_get_next(btr_cur_get_rec(cursor)))) { - return(NULL); + return nullptr; } page_cur_t next_page_cursor; buf_block_t* next_block; page_t* next_page; btr_cur_t next_father_cursor; - rec_t* rec = NULL; + rec_t* rec = nullptr; ulint max_size; - next_block = btr_block_get(*cursor->index, next_page_no, RW_X_LATCH, + next_block = btr_block_get(*cursor->index(), next_page_no, RW_X_LATCH, page_is_leaf(page), mtr); if (UNIV_UNLIKELY(!next_block)) { - return NULL; + return nullptr; } next_page = buf_block_get_frame(next_block); + const bool is_leaf = page_is_leaf(next_page); - bool is_leaf = page_is_leaf(next_page); + next_page_cursor.index = cursor->index(); + next_page_cursor.block = next_block; + next_father_cursor.page_cur = next_page_cursor; - btr_page_get_father( - cursor->index, next_block, mtr, &next_father_cursor); + if (!btr_page_get_father(mtr, &next_father_cursor)) { + return nullptr; + } - page_cur_search( - next_block, cursor->index, tuple, PAGE_CUR_LE, - &next_page_cursor); + ulint up_match = 0, low_match = 0; + + if (page_cur_search_with_match(tuple, + PAGE_CUR_LE, &up_match, &low_match, + &next_page_cursor, nullptr)) { + return nullptr; + } max_size = page_get_max_insert_size_after_reorganize(next_page, 1); /* Extends gap lock for the next page */ - if (!dict_table_is_locking_disabled(cursor->index->table)) { - lock_update_split_left(next_block, block); + if (is_leaf && cursor->index()->has_locking()) { + lock_update_node_pointer(block, next_block); } - rec = page_cur_tuple_insert( - &next_page_cursor, tuple, cursor->index, offsets, &heap, - n_ext, mtr); + rec = page_cur_tuple_insert(&next_page_cursor, tuple, offsets, &heap, + n_ext, mtr); - if (rec == NULL) { + if (!rec) { if (is_leaf && next_block->page.zip.ssize - && !dict_index_is_clust(cursor->index) - && !cursor->index->table->is_temporary()) { + && !dict_index_is_clust(cursor->index()) + && !cursor->index()->table->is_temporary()) { /* Reset the IBUF_BITMAP_FREE bits, because page_cur_tuple_insert() will have attempted page reorganize before failing. */ ibuf_reset_free_bits(next_block); } - return(NULL); + return nullptr; } ibool compressed; @@ -2619,24 +2811,28 @@ btr_insert_into_right_sibling( &err, TRUE, &next_father_cursor, BTR_CREATE_FLAG, false, mtr); - ut_a(err == DB_SUCCESS); + if (err != DB_SUCCESS) { + return nullptr; + } if (!compressed) { - btr_cur_compress_if_useful(&next_father_cursor, FALSE, mtr); + btr_cur_compress_if_useful(&next_father_cursor, false, mtr); } dtuple_t* node_ptr = dict_index_build_node_ptr( - cursor->index, rec, next_block->page.id().page_no(), + cursor->index(), rec, next_block->page.id().page_no(), heap, level); - btr_insert_on_non_leaf_level( - flags, cursor->index, level + 1, node_ptr, mtr); + if (btr_insert_on_non_leaf_level(flags, cursor->index(), level + 1, + node_ptr, mtr) != DB_SUCCESS) { + return nullptr; + } - ut_ad(rec_offs_validate(rec, cursor->index, *offsets)); + ut_ad(rec_offs_validate(rec, cursor->index(), *offsets)); if (is_leaf - && !dict_index_is_clust(cursor->index) - && !cursor->index->table->is_temporary()) { + && !dict_index_is_clust(cursor->index()) + && !cursor->index()->table->is_temporary()) { /* Update the free bits of the B-tree page in the insert buffer bitmap. */ @@ -2652,6 +2848,93 @@ btr_insert_into_right_sibling( return(rec); } +/*************************************************************//** +Moves record list end to another page. Moved records include +split_rec. + +IMPORTANT: The caller will have to update IBUF_BITMAP_FREE +if new_block is a compressed leaf page in a secondary index. +This has to be done either within the same mini-transaction, +or by invoking ibuf_reset_free_bits() before mtr_commit(). + +@return error code */ +static +dberr_t +page_move_rec_list_end( +/*===================*/ + buf_block_t* new_block, /*!< in/out: index page where to move */ + buf_block_t* block, /*!< in: index page from where to move */ + rec_t* split_rec, /*!< in: first record to move */ + dict_index_t* index, /*!< in: record descriptor */ + mtr_t* mtr) /*!< in: mtr */ +{ + page_t* new_page = buf_block_get_frame(new_block); + ulint old_data_size; + ulint new_data_size; + ulint old_n_recs; + ulint new_n_recs; + + ut_ad(!dict_index_is_spatial(index)); + + old_data_size = page_get_data_size(new_page); + old_n_recs = page_get_n_recs(new_page); +#ifdef UNIV_ZIP_DEBUG + { + page_zip_des_t* new_page_zip + = buf_block_get_page_zip(new_block); + page_zip_des_t* page_zip + = buf_block_get_page_zip(block); + ut_a(!new_page_zip == !page_zip); + ut_a(!new_page_zip + || page_zip_validate(new_page_zip, new_page, index)); + ut_a(!page_zip + || page_zip_validate(page_zip, page_align(split_rec), + index)); + } +#endif /* UNIV_ZIP_DEBUG */ + + dberr_t err; + if (!page_copy_rec_list_end(new_block, block, + split_rec, index, mtr, &err)) { + return err; + } + + new_data_size = page_get_data_size(new_page); + new_n_recs = page_get_n_recs(new_page); + + ut_ad(new_data_size >= old_data_size); + + return page_delete_rec_list_end(split_rec, block, index, + new_n_recs - old_n_recs, + new_data_size - old_data_size, mtr); +} + +/*************************************************************//** +Moves record list start to another page. Moved records do not include +split_rec. + +IMPORTANT: The caller will have to update IBUF_BITMAP_FREE +if new_block is a compressed leaf page in a secondary index. +This has to be done either within the same mini-transaction, +or by invoking ibuf_reset_free_bits() before mtr_commit(). + +@return error code */ +static +dberr_t +page_move_rec_list_start( +/*=====================*/ + buf_block_t* new_block, /*!< in/out: index page where to move */ + buf_block_t* block, /*!< in/out: page containing split_rec */ + rec_t* split_rec, /*!< in: first record not to move */ + dict_index_t* index, /*!< in: record descriptor */ + mtr_t* mtr) /*!< in: mtr */ +{ + dberr_t err; + if (page_copy_rec_list_start(new_block, block, split_rec, index, mtr, &err)) + page_delete_rec_list_start(split_rec, block, index, mtr); + return err; +} + /*************************************************************//** Splits an index page to halves and inserts the tuple. It is assumed that mtr holds an x-latch to the index tree. NOTE: the tree x-latch is @@ -2659,9 +2942,6 @@ released within this function! NOTE that the operation of this function must always succeed, we cannot reverse it: therefore enough free disk space (2 pages) must be guaranteed to be available before this function is called. -NOTE: jonaso added support for calling function with tuple == NULL -which cause it to only split a page. - @return inserted record or NULL if run out of space */ rec_t* btr_page_split_and_insert( @@ -2674,7 +2954,8 @@ btr_page_split_and_insert( mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ const dtuple_t* tuple, /*!< in: tuple to insert */ ulint n_ext, /*!< in: number of externally stored columns */ - mtr_t* mtr) /*!< in: mtr */ + mtr_t* mtr, /*!< in: mtr */ + dberr_t* err) /*!< out: error code */ { buf_block_t* block; page_t* page; @@ -2692,26 +2973,32 @@ btr_page_split_and_insert( ulint n_iterations = 0; ulint n_uniq; - if (cursor->index->is_spatial()) { + ut_ad(*err == DB_SUCCESS); + ut_ad(dtuple_check_typed(tuple)); + + buf_pool.pages_split++; + + if (cursor->index()->is_spatial()) { /* Split rtree page and update parent */ - return(rtr_page_split_and_insert(flags, cursor, offsets, heap, - tuple, n_ext, mtr)); + return rtr_page_split_and_insert(flags, cursor, offsets, heap, + tuple, n_ext, mtr, err); } if (!*heap) { *heap = mem_heap_create(1024); } - n_uniq = dict_index_get_n_unique_in_tree(cursor->index); + n_uniq = dict_index_get_n_unique_in_tree(cursor->index()); func_start: mem_heap_empty(*heap); *offsets = NULL; - ut_ad(mtr->memo_contains_flagged(&cursor->index->lock, MTR_MEMO_X_LOCK + ut_ad(mtr->memo_contains_flagged(&cursor->index()->lock, + MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); - ut_ad(!dict_index_is_online_ddl(cursor->index) + ut_ad(!dict_index_is_online_ddl(cursor->index()) || (flags & BTR_CREATE_FLAG) - || dict_index_is_clust(cursor->index)); - ut_ad(cursor->index->lock.have_u_or_x()); + || dict_index_is_clust(cursor->index())); + ut_ad(cursor->index()->lock.have_u_or_x()); block = btr_cur_get_block(cursor); page = buf_block_get_frame(block); @@ -2733,7 +3020,7 @@ btr_page_split_and_insert( uint32_t hint_page_no = block->page.id().page_no() + 1; byte direction = FSP_UP; - if (tuple && n_iterations > 0) { + if (n_iterations > 0) { split_rec = btr_page_get_split_rec(cursor, tuple, n_ext); if (split_rec == NULL) { @@ -2758,20 +3045,23 @@ btr_page_split_and_insert( page_get_infimum_rec(page)); } else { split_rec = NULL; + goto got_split_rec; } - } - DBUG_EXECUTE_IF("disk_is_full", - os_has_said_disk_full = true; - return(NULL);); + if (UNIV_UNLIKELY(!split_rec)) { + *err = DB_CORRUPTION; + return nullptr; + } + } +got_split_rec: /* 2. Allocate a new page to the index */ const uint16_t page_level = btr_page_get_level(page); - new_block = btr_page_alloc(cursor->index, hint_page_no, direction, - page_level, mtr, mtr); + new_block = btr_page_alloc(cursor->index(), hint_page_no, direction, + page_level, mtr, mtr, err); if (!new_block) { - return(NULL); + return nullptr; } new_page = buf_block_get_frame(new_block); @@ -2782,13 +3072,13 @@ btr_page_split_and_insert( to contain FIL_NULL in FIL_PAGE_PREV at this stage. */ memset_aligned<4>(new_page + FIL_PAGE_PREV, 0, 4); } - btr_page_create(new_block, new_page_zip, cursor->index, + btr_page_create(new_block, new_page_zip, cursor->index(), page_level, mtr); /* Only record the leaf level page splits. */ if (!page_level) { - cursor->index->stat_defrag_n_page_split ++; - cursor->index->stat_defrag_modified_counter ++; - btr_defragment_save_defrag_stats_if_needed(cursor->index); + cursor->index()->stat_defrag_n_page_split ++; + cursor->index()->stat_defrag_modified_counter ++; + btr_defragment_save_defrag_stats_if_needed(cursor->index()); } /* 3. Calculate the first record on the upper half-page, and the @@ -2798,13 +3088,14 @@ btr_page_split_and_insert( if (split_rec) { first_rec = move_limit = split_rec; - *offsets = rec_get_offsets(split_rec, cursor->index, *offsets, - page_is_leaf(page) - ? cursor->index->n_core_fields : 0, + *offsets = rec_get_offsets(split_rec, cursor->index(), + *offsets, page_is_leaf(page) + ? cursor->index()->n_core_fields + : 0, n_uniq, heap); - insert_left = !tuple - || cmp_dtuple_rec(tuple, split_rec, *offsets) < 0; + insert_left = cmp_dtuple_rec(tuple, split_rec, cursor->index(), + *offsets) < 0; if (!insert_left && new_page_zip && n_iterations > 0) { /* If a compressed page has already been split, @@ -2814,61 +3105,63 @@ btr_page_split_and_insert( goto insert_empty; } } else if (insert_left) { - ut_a(n_iterations > 0); + if (UNIV_UNLIKELY(!n_iterations)) { +corrupted: + *err = DB_CORRUPTION; + return nullptr; + } first_rec = page_rec_get_next(page_get_infimum_rec(page)); +insert_move_limit: move_limit = page_rec_get_next(btr_cur_get_rec(cursor)); + if (UNIV_UNLIKELY(!first_rec || !move_limit)) { + goto corrupted; + } } else { insert_empty: ut_ad(!split_rec); ut_ad(!insert_left); buf = UT_NEW_ARRAY_NOKEY( byte, - rec_get_converted_size(cursor->index, tuple, n_ext)); + rec_get_converted_size(cursor->index(), tuple, n_ext)); - first_rec = rec_convert_dtuple_to_rec(buf, cursor->index, + first_rec = rec_convert_dtuple_to_rec(buf, cursor->index(), tuple, n_ext); - move_limit = page_rec_get_next(btr_cur_get_rec(cursor)); + goto insert_move_limit; } /* 4. Do first the modifications in the tree structure */ /* FIXME: write FIL_PAGE_PREV,FIL_PAGE_NEXT in new_block earlier! */ - btr_attach_half_pages(flags, cursor->index, block, - first_rec, new_block, direction, mtr); + *err = btr_attach_half_pages(flags, cursor->index(), block, + first_rec, new_block, direction, mtr); + + if (UNIV_UNLIKELY(*err != DB_SUCCESS)) { + return nullptr; + } +#ifdef UNIV_DEBUG /* If the split is made on the leaf level and the insert will fit on the appropriate half-page, we may release the tree x-latch. We can then move the records after releasing the tree latch, thus reducing the tree latch contention. */ - bool insert_will_fit; - if (tuple == NULL) { - insert_will_fit = true; - } else if (split_rec) { - insert_will_fit = !new_page_zip - && btr_page_insert_fits(cursor, split_rec, - offsets, tuple, n_ext, heap); - } else { - if (!insert_left) { - UT_DELETE_ARRAY(buf); - buf = NULL; - } - - insert_will_fit = !new_page_zip - && btr_page_insert_fits(cursor, NULL, - offsets, tuple, n_ext, heap); + const bool insert_will_fit = !new_page_zip + && btr_page_insert_fits(cursor, split_rec, offsets, tuple, + n_ext, heap); +#endif + if (!split_rec && !insert_left) { + UT_DELETE_ARRAY(buf); + buf = NULL; } - if (!srv_read_only_mode - && insert_will_fit +#if 0 // FIXME: this used to be a no-op, and may cause trouble if enabled + if (insert_will_fit && page_is_leaf(page) - && !dict_index_is_online_ddl(cursor->index)) { - - mtr->memo_release(&cursor->index->lock, - MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK); - + && !dict_index_is_online_ddl(cursor->index())) { + mtr->release(cursor->index()->lock); /* NOTE: We cannot release root block latch here, because it has segment header and already modified in most of cases.*/ } +#endif /* 5. Move then the records to the new page */ if (direction == FSP_DOWN) { @@ -2878,26 +3171,39 @@ btr_page_split_and_insert( #ifdef UNIV_ZIP_COPY || page_zip #endif /* UNIV_ZIP_COPY */ - || !page_move_rec_list_start(new_block, block, move_limit, - cursor->index, mtr)) { - /* For some reason, compressing new_page failed, + || (*err = page_move_rec_list_start(new_block, block, + move_limit, + cursor->index(), + mtr))) { + if (*err != DB_FAIL) { + return nullptr; + } + + /* For some reason, compressing new_block failed, even though it should contain fewer records than the original page. Copy the page byte for byte and then delete the records from both pages as appropriate. Deleting will always succeed. */ ut_a(new_page_zip); - page_zip_copy_recs(new_block, - page_zip, page, cursor->index, mtr); - page_delete_rec_list_end(move_limit - page + new_page, - new_block, cursor->index, - ULINT_UNDEFINED, - ULINT_UNDEFINED, mtr); + page_zip_copy_recs(new_block, page_zip, page, + cursor->index(), mtr); + *err = page_delete_rec_list_end(move_limit + - page + new_page, + new_block, + cursor->index(), + ULINT_UNDEFINED, + ULINT_UNDEFINED, mtr); + if (*err != DB_SUCCESS) { + return nullptr; + } /* Update the lock table and possible hash index. */ - lock_move_rec_list_start( - new_block, block, move_limit, - new_page + PAGE_NEW_INFIMUM); + if (cursor->index()->has_locking()) { + lock_move_rec_list_start( + new_block, block, move_limit, + new_page + PAGE_NEW_INFIMUM); + } btr_search_move_or_delete_hash_entries( new_block, block); @@ -2905,13 +3211,13 @@ btr_page_split_and_insert( /* Delete the records from the source page. */ page_delete_rec_list_start(move_limit, block, - cursor->index, mtr); + cursor->index(), mtr); } left_block = new_block; right_block = block; - if (!dict_table_is_locking_disabled(cursor->index->table)) { + if (cursor->index()->has_locking()) { lock_update_split_left(right_block, left_block); } } else { @@ -2921,8 +3227,13 @@ btr_page_split_and_insert( #ifdef UNIV_ZIP_COPY || page_zip #endif /* UNIV_ZIP_COPY */ - || !page_move_rec_list_end(new_block, block, move_limit, - cursor->index, mtr)) { + || (*err = page_move_rec_list_end(new_block, block, + move_limit, + cursor->index(), mtr))) { + if (*err != DB_FAIL) { + return nullptr; + } + /* For some reason, compressing new_page failed, even though it should contain fewer records than the original page. Copy the page byte for byte @@ -2930,38 +3241,45 @@ btr_page_split_and_insert( as appropriate. Deleting will always succeed. */ ut_a(new_page_zip); - page_zip_copy_recs(new_block, - page_zip, page, cursor->index, mtr); + page_zip_copy_recs(new_block, page_zip, page, + cursor->index(), mtr); page_delete_rec_list_start(move_limit - page + new_page, new_block, - cursor->index, mtr); + cursor->index(), mtr); /* Update the lock table and possible hash index. */ - lock_move_rec_list_end(new_block, block, move_limit); + if (cursor->index()->has_locking()) { + lock_move_rec_list_end(new_block, block, + move_limit); + } btr_search_move_or_delete_hash_entries( new_block, block); /* Delete the records from the source page. */ - page_delete_rec_list_end(move_limit, block, - cursor->index, - ULINT_UNDEFINED, - ULINT_UNDEFINED, mtr); + *err = page_delete_rec_list_end(move_limit, block, + cursor->index(), + ULINT_UNDEFINED, + ULINT_UNDEFINED, mtr); + if (*err != DB_SUCCESS) { + return nullptr; + } } left_block = block; right_block = new_block; - if (!dict_table_is_locking_disabled(cursor->index->table)) { + if (cursor->index()->has_locking()) { lock_update_split_right(right_block, left_block); } } #ifdef UNIV_ZIP_DEBUG if (page_zip) { - ut_a(page_zip_validate(page_zip, page, cursor->index)); - ut_a(page_zip_validate(new_page_zip, new_page, cursor->index)); + ut_a(page_zip_validate(page_zip, page, cursor->index())); + ut_a(page_zip_validate(new_page_zip, new_page, + cursor->index())); } #endif /* UNIV_ZIP_DEBUG */ @@ -2974,17 +3292,20 @@ btr_page_split_and_insert( buf_block_t* const insert_block = insert_left ? left_block : right_block; - if (UNIV_UNLIKELY(!tuple)) { - rec = NULL; - goto func_exit; - } - /* 7. Reposition the cursor for insert and try insertion */ page_cursor = btr_cur_get_page_cur(cursor); + page_cursor->block = insert_block; - page_cur_search(insert_block, cursor->index, tuple, page_cursor); + ulint up_match = 0, low_match = 0; - rec = page_cur_tuple_insert(page_cursor, tuple, cursor->index, + if (page_cur_search_with_match(tuple, + PAGE_CUR_LE, &up_match, &low_match, + page_cursor, nullptr)) { + *err = DB_CORRUPTION; + return nullptr; + } + + rec = page_cur_tuple_insert(page_cursor, tuple, offsets, heap, n_ext, mtr); #ifdef UNIV_ZIP_DEBUG @@ -2997,7 +3318,7 @@ btr_page_split_and_insert( ut_a(!insert_page_zip || page_zip_validate(insert_page_zip, insert_page, - cursor->index)); + cursor->index())); } #endif /* UNIV_ZIP_DEBUG */ @@ -3010,13 +3331,17 @@ btr_page_split_and_insert( For compressed pages, page_cur_tuple_insert() will have attempted this already. */ - if (page_cur_get_page_zip(page_cursor) - || !btr_page_reorganize(page_cursor, cursor->index, mtr)) { - + if (page_cur_get_page_zip(page_cursor)) { goto insert_failed; } - rec = page_cur_tuple_insert(page_cursor, tuple, cursor->index, + *err = btr_page_reorganize(page_cursor, mtr); + + if (*err != DB_SUCCESS) { + return nullptr; + } + + rec = page_cur_tuple_insert(page_cursor, tuple, offsets, heap, n_ext, mtr); if (rec == NULL) { @@ -3024,8 +3349,8 @@ btr_page_split_and_insert( start of the function for a new split */ insert_failed: /* We play safe and reset the free bits for new_page */ - if (!dict_index_is_clust(cursor->index) - && !cursor->index->table->is_temporary()) { + if (!dict_index_is_clust(page_cursor->index) + && !page_cursor->index->table->is_temporary()) { ibuf_reset_free_bits(new_block); ibuf_reset_free_bits(block); } @@ -3042,21 +3367,20 @@ btr_page_split_and_insert( /* Insert fit on the page: update the free bits for the left and right pages in the same mtr */ - if (!dict_index_is_clust(cursor->index) - && !cursor->index->table->is_temporary() + if (!dict_index_is_clust(page_cursor->index) + && !page_cursor->index->table->is_temporary() && page_is_leaf(page)) { ibuf_update_free_bits_for_two_pages_low( left_block, right_block, mtr); } - MONITOR_INC(MONITOR_INDEX_SPLIT); - - ut_ad(page_validate(buf_block_get_frame(left_block), cursor->index)); - ut_ad(page_validate(buf_block_get_frame(right_block), cursor->index)); + ut_ad(page_validate(buf_block_get_frame(left_block), + page_cursor->index)); + ut_ad(page_validate(buf_block_get_frame(right_block), + page_cursor->index)); - ut_ad(tuple || !rec); - ut_ad(!rec || rec_offs_validate(rec, cursor->index, *offsets)); + ut_ad(!rec || rec_offs_validate(rec, page_cursor->index, *offsets)); return(rec); } @@ -3067,54 +3391,54 @@ btr_page_split_and_insert( dberr_t btr_level_list_remove(const buf_block_t& block, const dict_index_t& index, mtr_t* mtr) { - ut_ad(mtr->memo_contains_flagged(&block, MTR_MEMO_PAGE_X_FIX)); - ut_ad(block.zip_size() == index.table->space->zip_size()); - ut_ad(index.table->space->id == block.page.id().space()); - /* Get the previous and next page numbers of page */ - - const page_t* page = block.page.frame; - const uint32_t prev_page_no = btr_page_get_prev(page); - const uint32_t next_page_no = btr_page_get_next(page); - - /* Update page links of the level */ - - if (prev_page_no != FIL_NULL) { - buf_block_t* prev_block = btr_block_get( - index, prev_page_no, RW_X_LATCH, page_is_leaf(page), - mtr); -#ifdef UNIV_BTR_DEBUG - ut_a(page_is_comp(prev_block->page.frame) - == page_is_comp(page)); - static_assert(FIL_PAGE_NEXT % 4 == 0, "alignment"); - static_assert(FIL_PAGE_OFFSET % 4 == 0, "alignment"); - ut_a(!memcmp_aligned<4>(prev_block->page.frame + FIL_PAGE_NEXT, - page + FIL_PAGE_OFFSET, 4)); -#endif /* UNIV_BTR_DEBUG */ - - btr_page_set_next(prev_block, next_page_no, mtr); - } - - if (next_page_no != FIL_NULL) { - buf_block_t* next_block = btr_block_get( - index, next_page_no, RW_X_LATCH, page_is_leaf(page), - mtr); + ut_ad(mtr->memo_contains_flagged(&block, MTR_MEMO_PAGE_X_FIX)); + ut_ad(block.zip_size() == index.table->space->zip_size()); + ut_ad(index.table->space->id == block.page.id().space()); + /* Get the previous and next page numbers of page */ + const uint32_t prev_page_no= btr_page_get_prev(block.page.frame); + const uint32_t next_page_no= btr_page_get_next(block.page.frame); + page_id_t id{block.page.id()}; + buf_block_t *prev= nullptr, *next; + dberr_t err; + + /* Update page links of the level */ + if (prev_page_no != FIL_NULL) + { + id.set_page_no(prev_page_no); + prev= mtr->get_already_latched(id, MTR_MEMO_PAGE_X_FIX); +#if 1 /* MDEV-29835 FIXME: acquire page latches upfront */ + if (!prev) + { + ut_ad(mtr->memo_contains(index.lock, MTR_MEMO_X_LOCK)); + prev= btr_block_get(index, id.page_no(), RW_X_LATCH, + page_is_leaf(block.page.frame), mtr, &err); + if (UNIV_UNLIKELY(!prev)) + return err; + } +#endif + } - if (!next_block) { - return DB_ERROR; - } -#ifdef UNIV_BTR_DEBUG - ut_a(page_is_comp(next_block->page.frame) - == page_is_comp(page)); - static_assert(FIL_PAGE_PREV % 4 == 0, "alignment"); - static_assert(FIL_PAGE_OFFSET % 4 == 0, "alignment"); - ut_a(!memcmp_aligned<4>(next_block->page.frame + FIL_PAGE_PREV, - page + FIL_PAGE_OFFSET, 4)); -#endif /* UNIV_BTR_DEBUG */ + if (next_page_no != FIL_NULL) + { + id.set_page_no(next_page_no); + next= mtr->get_already_latched(id, MTR_MEMO_PAGE_X_FIX); +#if 1 /* MDEV-29835 FIXME: acquire page latches upfront */ + if (!next) + { + ut_ad(mtr->memo_contains(index.lock, MTR_MEMO_X_LOCK)); + next= btr_block_get(index, id.page_no(), RW_X_LATCH, + page_is_leaf(block.page.frame), mtr, &err); + if (UNIV_UNLIKELY(!next)) + return err; + } +#endif + btr_page_set_prev(next, prev_page_no, mtr); + } - btr_page_set_prev(next_block, prev_page_no, mtr); - } + if (prev) + btr_page_set_next(prev, next_page_no, mtr); - return DB_SUCCESS; + return DB_SUCCESS; } /*************************************************************//** @@ -3128,7 +3452,8 @@ btr_lift_page_up( must not be empty: use btr_discard_only_page_on_level if the last record from the page should be removed */ - mtr_t* mtr) /*!< in: mtr */ + mtr_t* mtr, /*!< in/out: mini-transaction */ + dberr_t* err) /*!< out: error code */ { buf_block_t* father_block; ulint page_level; @@ -3143,6 +3468,7 @@ btr_lift_page_up( ut_ad(!page_has_siblings(page)); ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); + ut_ad(!page_is_empty(page)); page_level = btr_page_get_level(page); root_page_no = dict_index_get_page(index); @@ -3155,14 +3481,14 @@ btr_lift_page_up( * (REC_OFFS_HEADER_SIZE + 1 + 1 + unsigned(index->n_fields))); buf_block_t* b; + cursor.page_cur.index = index; + cursor.page_cur.block = block; - if (dict_index_is_spatial(index)) { + if (index->is_spatial()) { offsets = rtr_page_get_father_block( - NULL, heap, index, block, mtr, - NULL, &cursor); + nullptr, heap, mtr, nullptr, &cursor); } else { offsets = btr_page_get_father_block(offsets, heap, - index, block, mtr, &cursor); } father_block = btr_cur_get_block(&cursor); @@ -3179,14 +3505,12 @@ btr_lift_page_up( b->page.id().page_no() != root_page_no; ) { ut_a(n_blocks < BTR_MAX_LEVELS); - if (dict_index_is_spatial(index)) { + if (index->is_spatial()) { offsets = rtr_page_get_father_block( - NULL, heap, index, b, mtr, - NULL, &cursor); + nullptr, heap, mtr, nullptr, &cursor); } else { offsets = btr_page_get_father_block(offsets, heap, - index, b, mtr, &cursor); } @@ -3219,7 +3543,7 @@ btr_lift_page_up( mem_heap_free(heap); } - btr_search_drop_page_hash_index(block); + btr_search_drop_page_hash_index(block, false); /* Make the father empty */ btr_page_empty(father_block, father_page_zip, index, page_level, mtr); @@ -3229,11 +3553,21 @@ btr_lift_page_up( if (index->is_instant() && father_block->page.id().page_no() == root_page_no) { ut_ad(!father_page_zip); + + if (page_is_leaf(page)) { + const rec_t* rec = page_rec_get_next( + page_get_infimum_rec(page)); + ut_ad(rec_is_metadata(rec, *index)); + if (rec_is_add_metadata(rec, *index) + && page_get_n_recs(page) == 1) { + index->clear_instant_add(); + goto copied; + } + } + btr_set_instant(father_block, *index, mtr); } - page_level++; - /* Copy the records to the father page one by one. */ if (0 #ifdef UNIV_ZIP_COPY @@ -3241,7 +3575,17 @@ btr_lift_page_up( #endif /* UNIV_ZIP_COPY */ || !page_copy_rec_list_end(father_block, block, page_get_infimum_rec(page), - index, mtr)) { + index, mtr, err)) { + switch (*err) { + case DB_SUCCESS: + break; + case DB_FAIL: + *err = DB_SUCCESS; + break; + default: + return nullptr; + } + const page_zip_des_t* page_zip = buf_block_get_page_zip(block); ut_a(father_page_zip); @@ -3253,8 +3597,10 @@ btr_lift_page_up( /* Update the lock table and possible hash index. */ - lock_move_rec_list_end(father_block, block, - page_get_infimum_rec(page)); + if (index->has_locking()) { + lock_move_rec_list_end(father_block, block, + page_get_infimum_rec(page)); + } /* Also update the predicate locks */ if (dict_index_is_spatial(index)) { @@ -3265,7 +3611,8 @@ btr_lift_page_up( } } - if (!dict_table_is_locking_disabled(index->table)) { +copied: + if (index->has_locking()) { const page_id_t id{block->page.id()}; /* Free predicate page locks on the block */ if (index->is_spatial()) { @@ -3275,6 +3622,8 @@ btr_lift_page_up( } } + page_level++; + /* Go upward to root page, decrementing levels by one. */ for (i = lift_father_up ? 1 : 0; i < n_blocks; i++, page_level++) { ut_ad(btr_page_get_level(blocks[i]->page.frame) @@ -3309,21 +3658,21 @@ level lifts the records of the page to the father page, thus reducing the tree height. It is assumed that mtr holds an x-latch on the tree and on the page. If cursor is on the leaf level, mtr must also hold x-latches to the brothers, if they exist. -@return TRUE on success */ -ibool +@return error code */ +dberr_t btr_compress( /*=========*/ btr_cur_t* cursor, /*!< in/out: cursor on the page to merge or lift; the page must not be empty: when deleting records, use btr_discard_page() if the page would become empty */ - ibool adjust, /*!< in: TRUE if should adjust the - cursor position even if compression occurs */ + bool adjust, /*!< in: whether the cursor position should be + adjusted even when compression occurs */ mtr_t* mtr) /*!< in/out: mini-transaction */ { dict_index_t* index; - buf_block_t* merge_block; - page_t* merge_page = NULL; + buf_block_t* merge_block = nullptr; + page_t* merge_page = nullptr; page_zip_des_t* merge_page_zip; ibool is_left; buf_block_t* block; @@ -3342,8 +3691,6 @@ btr_compress( page = btr_cur_get_page(cursor); index = btr_cur_get_index(cursor); - btr_assert_not_corrupted(block, index); - ut_ad(mtr->memo_contains_flagged(&index->lock, MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); @@ -3352,20 +3699,20 @@ btr_compress( const uint32_t left_page_no = btr_page_get_prev(page); const uint32_t right_page_no = btr_page_get_next(page); + dberr_t err = DB_SUCCESS; -#ifdef UNIV_DEBUG - if (!page_is_leaf(page) && left_page_no == FIL_NULL) { - ut_a(REC_INFO_MIN_REC_FLAG & rec_get_info_bits( - page_rec_get_next(page_get_infimum_rec(page)), - page_is_comp(page))); - } -#endif /* UNIV_DEBUG */ + ut_ad(page_is_leaf(page) || left_page_no != FIL_NULL + || (REC_INFO_MIN_REC_FLAG & rec_get_info_bits( + page_rec_get_next(page_get_infimum_rec(page)), + page_is_comp(page)))); heap = mem_heap_create(100); + father_cursor.page_cur.index = index; + father_cursor.page_cur.block = block; - if (dict_index_is_spatial(index)) { + if (index->is_spatial()) { offsets = rtr_page_get_father_block( - NULL, heap, index, block, mtr, cursor, &father_cursor); + NULL, heap, mtr, cursor, &father_cursor); ut_ad(cursor->page_cur.block->page.id() == block->page.id()); rec_t* my_rec = father_cursor.page_cur.rec; @@ -3376,24 +3723,51 @@ btr_compress( << page_no << "instead of " << block->page.id().page_no(); offsets = btr_page_get_father_block( - NULL, heap, index, block, mtr, &father_cursor); + NULL, heap, mtr, &father_cursor); } } else { offsets = btr_page_get_father_block( - NULL, heap, index, block, mtr, &father_cursor); + NULL, heap, mtr, &father_cursor); } if (adjust) { nth_rec = page_rec_get_n_recs_before(btr_cur_get_rec(cursor)); - ut_ad(nth_rec > 0); + if (UNIV_UNLIKELY(!nth_rec || nth_rec == ULINT_UNDEFINED)) { + corrupted: + err = DB_CORRUPTION; + err_exit: + /* We play it safe and reset the free bits. */ + if (merge_block && merge_block->zip_size() + && page_is_leaf(merge_block->page.frame) + && !index->is_clust()) { + ibuf_reset_free_bits(merge_block); + } + goto func_exit; + } } if (left_page_no == FIL_NULL && right_page_no == FIL_NULL) { /* The page is the only one on the level, lift the records to the father */ - merge_block = btr_lift_page_up(index, block, mtr); - goto func_exit; + merge_block = btr_lift_page_up(index, block, mtr, &err); +success: + if (adjust) { + ut_ad(nth_rec > 0); + if (rec_t* nth + = page_rec_get_nth(merge_block->page.frame, + nth_rec)) { + btr_cur_position(index, nth, + merge_block, cursor); + } else { + goto corrupted; + } + } + + MONITOR_INC(MONITOR_INDEX_MERGE_SUCCESSFUL); +func_exit: + mem_heap_free(heap); + DBUG_RETURN(err); } ut_d(leftmost_child = @@ -3417,20 +3791,20 @@ btr_compress( if (!merge_block) { merge_page = NULL; } +cannot_merge: + err = DB_FAIL; goto err_exit; } merge_page = buf_block_get_frame(merge_block); -#ifdef UNIV_BTR_DEBUG - if (is_left) { - ut_a(btr_page_get_next(merge_page) - == block->page.id().page_no()); - } else { - ut_a(btr_page_get_prev(merge_page) - == block->page.id().page_no()); + if (UNIV_UNLIKELY(memcmp_aligned<4>(merge_page + (is_left + ? FIL_PAGE_NEXT + : FIL_PAGE_PREV), + block->page.frame + + FIL_PAGE_OFFSET, 4))) { + goto corrupted; } -#endif /* UNIV_BTR_DEBUG */ ut_ad(page_validate(merge_page, index)); @@ -3445,9 +3819,12 @@ btr_compress( } #endif /* UNIV_ZIP_DEBUG */ + btr_cur_t cursor2; + cursor2.page_cur.index = index; + cursor2.page_cur.block = merge_block; + /* Move records to the merge page */ if (is_left) { - btr_cur_t cursor2; rtr_mbr_t new_mbr; rec_offs* offsets2 = NULL; @@ -3457,8 +3834,7 @@ btr_compress( page */ if (!rtr_check_same_block( index, &cursor2, - btr_cur_get_block(&father_cursor), - merge_block, heap)) { + btr_cur_get_block(&father_cursor), heap)) { is_left = false; goto retry; } @@ -3482,22 +3858,24 @@ btr_compress( rec_t* orig_pred = page_copy_rec_list_start( merge_block, block, page_get_supremum_rec(page), - index, mtr); + index, mtr, &err); if (!orig_pred) { goto err_exit; } - btr_search_drop_page_hash_index(block); + btr_search_drop_page_hash_index(block, false); /* Remove the page from the level list */ - if (DB_SUCCESS != btr_level_list_remove(*block, *index, mtr)) { + err = btr_level_list_remove(*block, *index, mtr); + + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { goto err_exit; } const page_id_t id{block->page.id()}; - if (dict_index_is_spatial(index)) { + if (index->is_spatial()) { rec_t* my_rec = father_cursor.page_cur.rec; ulint page_no = btr_node_ptr_get_child_page_no( @@ -3510,17 +3888,9 @@ btr_compress( } if (mbr_changed) { -#ifdef UNIV_DEBUG - bool success = rtr_update_mbr_field( - &cursor2, offsets2, &father_cursor, - merge_page, &new_mbr, NULL, mtr); - - ut_ad(success); -#else rtr_update_mbr_field( &cursor2, offsets2, &father_cursor, merge_page, &new_mbr, NULL, mtr); -#endif } else { rtr_node_ptr_delete(&father_cursor, mtr); } @@ -3528,47 +3898,46 @@ btr_compress( /* No GAP lock needs to be worrying about */ lock_sys.prdt_page_free_from_discard(id); } else { - btr_cur_node_ptr_delete(&father_cursor, mtr); - if (!dict_table_is_locking_disabled(index->table)) { + err = btr_cur_node_ptr_delete(&father_cursor, mtr); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + goto err_exit; + } + if (index->has_locking()) { lock_update_merge_left( *merge_block, orig_pred, id); } } if (adjust) { - nth_rec += page_rec_get_n_recs_before(orig_pred); + ulint n = page_rec_get_n_recs_before(orig_pred); + if (UNIV_UNLIKELY(!n || n == ULINT_UNDEFINED)) { + goto corrupted; + } + nth_rec += n; } } else { rec_t* orig_succ; ibool compressed; dberr_t err; - btr_cur_t cursor2; - /* father cursor pointing to node ptr - of the right sibling */ -#ifdef UNIV_BTR_DEBUG byte fil_page_prev[4]; -#endif /* UNIV_BTR_DEBUG */ - - if (dict_index_is_spatial(index)) { - cursor2.rtr_info = NULL; + if (index->is_spatial()) { /* For spatial index, we disallow merge of blocks with different parents, since the merge would need to update entry (for MBR and Primary key) in the parent of block being merged */ if (!rtr_check_same_block( index, &cursor2, - btr_cur_get_block(&father_cursor), - merge_block, heap)) { - goto err_exit; + btr_cur_get_block(&father_cursor), heap)) { + goto cannot_merge; } /* Set rtr_info for cursor2, since it is necessary in recursive page merge. */ cursor2.rtr_info = cursor->rtr_info; cursor2.tree_height = cursor->tree_height; - } else { - btr_page_get_father(index, merge_block, mtr, &cursor2); + } else if (!btr_page_get_father(mtr, &cursor2)) { + goto cannot_merge; } if (merge_page_zip && left_page_no == FIL_NULL) { @@ -3578,33 +3947,28 @@ btr_compress( requires that FIL_PAGE_PREV be FIL_NULL. Clear the field, but prepare to restore it. */ static_assert(FIL_PAGE_PREV % 8 == 0, "alignment"); -#ifdef UNIV_BTR_DEBUG memcpy(fil_page_prev, merge_page + FIL_PAGE_PREV, 4); -#endif /* UNIV_BTR_DEBUG */ compile_time_assert(FIL_NULL == 0xffffffffU); memset_aligned<4>(merge_page + FIL_PAGE_PREV, 0xff, 4); } orig_succ = page_copy_rec_list_end(merge_block, block, page_get_infimum_rec(page), - cursor->index, mtr); + cursor->index(), mtr, &err); if (!orig_succ) { ut_a(merge_page_zip); -#ifdef UNIV_BTR_DEBUG if (left_page_no == FIL_NULL) { /* FIL_PAGE_PREV was restored from merge_page_zip. */ - ut_a(!memcmp(fil_page_prev, - merge_page + FIL_PAGE_PREV, 4)); + ut_ad(!memcmp(fil_page_prev, + merge_page + FIL_PAGE_PREV, 4)); } -#endif /* UNIV_BTR_DEBUG */ goto err_exit; } - btr_search_drop_page_hash_index(block); + btr_search_drop_page_hash_index(block, false); -#ifdef UNIV_BTR_DEBUG if (merge_page_zip && left_page_no == FIL_NULL) { /* Restore FIL_PAGE_PREV in order to avoid an assertion @@ -3615,10 +3979,11 @@ btr_compress( are X-latched. */ memcpy(merge_page + FIL_PAGE_PREV, fil_page_prev, 4); } -#endif /* UNIV_BTR_DEBUG */ /* Remove the page from the level list */ - if (DB_SUCCESS != btr_level_list_remove(*block, *index, mtr)) { + err = btr_level_list_remove(*block, *index, mtr); + + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { goto err_exit; } @@ -3689,12 +4054,11 @@ btr_compress( ut_a(err == DB_SUCCESS); if (!compressed) { - btr_cur_compress_if_useful(&cursor2, - FALSE, + btr_cur_compress_if_useful(&cursor2, false, mtr); } - if (!dict_table_is_locking_disabled(index->table)) { + if (index->has_locking()) { lock_update_merge_right( merge_block, orig_succ, block); } @@ -3755,39 +4119,14 @@ btr_compress( } /* Free the file page */ - btr_page_free(index, block, mtr); - - /* btr_check_node_ptr() needs parent block latched. - If the merge_block's parent block is not same, - we cannot use btr_check_node_ptr() */ - ut_ad(leftmost_child - || btr_check_node_ptr(index, merge_block, mtr)); -func_exit: - mem_heap_free(heap); - - if (adjust) { - ut_ad(nth_rec > 0); - btr_cur_position( - index, - page_rec_get_nth(merge_block->page.frame, nth_rec), - merge_block, cursor); - } - - MONITOR_INC(MONITOR_INDEX_MERGE_SUCCESSFUL); - - DBUG_RETURN(TRUE); - -err_exit: - /* We play it safe and reset the free bits. */ - if (merge_block && merge_block->zip_size() - && page_is_leaf(merge_block->page.frame) - && !dict_index_is_clust(index)) { - - ibuf_reset_free_bits(merge_block); - } - - mem_heap_free(heap); - DBUG_RETURN(FALSE); + err = btr_page_free(index, block, mtr); + if (err == DB_SUCCESS) { + ut_ad(leftmost_child + || btr_check_node_ptr(index, merge_block, mtr)); + goto success; + } else { + goto err_exit; + } } /*************************************************************//** @@ -3812,6 +4151,9 @@ btr_discard_only_page_on_level( const trx_id_t max_trx_id = page_get_max_trx_id(block->page.frame); const rec_t* r = page_rec_get_next( page_get_infimum_rec(block->page.frame)); + /* In the caller we checked that a valid key exists in the page, + because we were able to look up a parent page. */ + ut_ad(r); ut_ad(rec_is_metadata(r, *index) == index->is_instant()); while (block->page.id().page_no() != dict_index_get_page(index)) { @@ -3825,24 +4167,32 @@ btr_discard_only_page_on_level( ut_ad(fil_page_index_page_check(page)); ut_ad(block->page.id().space() == index->table->space->id); ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); - btr_search_drop_page_hash_index(block); + btr_search_drop_page_hash_index(block, false); + cursor.page_cur.index = index; + cursor.page_cur.block = block; - if (dict_index_is_spatial(index)) { + if (index->is_spatial()) { /* Check any concurrent search having this page */ rtr_check_discard_page(index, NULL, block); - rtr_page_get_father(index, block, mtr, NULL, &cursor); + if (!rtr_page_get_father(mtr, nullptr, &cursor)) { + return; + } } else { - btr_page_get_father(index, block, mtr, &cursor); + if (!btr_page_get_father(mtr, &cursor)) { + return; + } } father = btr_cur_get_block(&cursor); - if (!dict_table_is_locking_disabled(index->table)) { + if (index->has_locking()) { lock_update_discard( father, PAGE_HEAP_NO_SUPREMUM, block); } /* Free the file page */ - btr_page_free(index, block, mtr); + if (btr_page_free(index, block, mtr) != DB_SUCCESS) { + return; + } block = father; page_level++; @@ -3852,17 +4202,6 @@ btr_discard_only_page_on_level( for the node pointer to the (now discarded) block(s). */ ut_ad(!page_has_siblings(block->page.frame)); -#ifdef UNIV_BTR_DEBUG - if (!dict_index_is_ibuf(index)) { - const page_t* root = buf_block_get_frame(block); - const ulint space = index->table->space_id; - ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF - + root, space)); - ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP - + root, space)); - } -#endif /* UNIV_BTR_DEBUG */ - mem_heap_t* heap = nullptr; const rec_t* rec = nullptr; rec_offs* offsets = nullptr; @@ -3890,11 +4229,11 @@ btr_discard_only_page_on_level( if (rec) { page_cur_t cur; page_cur_set_before_first(block, &cur); + cur.index = index; DBUG_ASSERT(index->table->instant); DBUG_ASSERT(rec_is_alter_metadata(rec, *index)); btr_set_instant(block, *index, mtr); - rec = page_cur_insert_rec_low(&cur, index, rec, - offsets, mtr); + rec = page_cur_insert_rec_low(&cur, rec, offsets, mtr); ut_ad(rec); mem_heap_free(heap); } else if (index->is_instant()) { @@ -3915,7 +4254,7 @@ btr_discard_only_page_on_level( Discards a page from a B-tree. This is used to remove the last record from a B-tree page: the whole page must be removed at the same time. This cannot be used for the root page, which is allowed to be empty. */ -void +dberr_t btr_discard_page( /*=============*/ btr_cur_t* cursor, /*!< in: cursor on the page to discard: not on @@ -3929,6 +4268,7 @@ btr_discard_page( block = btr_cur_get_block(cursor); index = btr_cur_get_index(cursor); + parent_cursor.page_cur = cursor->page_cur; ut_ad(dict_index_get_page(index) != block->page.id().page_no()); @@ -3938,25 +4278,40 @@ btr_discard_page( MONITOR_INC(MONITOR_INDEX_DISCARD); - if (dict_index_is_spatial(index)) { - rtr_page_get_father(index, block, mtr, cursor, &parent_cursor); - } else { - btr_page_get_father(index, block, mtr, &parent_cursor); + if (index->is_spatial() + ? !rtr_page_get_father(mtr, cursor, &parent_cursor) + : !btr_page_get_father(mtr, &parent_cursor)) { + return DB_CORRUPTION; } /* Decide the page which will inherit the locks */ const uint32_t left_page_no = btr_page_get_prev(block->page.frame); const uint32_t right_page_no = btr_page_get_next(block->page.frame); + page_id_t merge_page_id{block->page.id()}; ut_d(bool parent_is_different = false); + dberr_t err; if (left_page_no != FIL_NULL) { - merge_block = btr_block_get(*index, left_page_no, RW_X_LATCH, - true, mtr); -#ifdef UNIV_BTR_DEBUG - ut_a(btr_page_get_next(merge_block->page.frame) - == block->page.id().page_no()); -#endif /* UNIV_BTR_DEBUG */ + merge_page_id.set_page_no(left_page_no); + merge_block = btr_block_reget(mtr, *index, merge_page_id, + RW_X_LATCH, &err); + if (UNIV_UNLIKELY(!merge_block)) { + return err; + } +#if 1 /* MDEV-29835 FIXME: Acquire the page latch upfront. */ + ut_ad(!memcmp_aligned<4>(merge_block->page.frame + + FIL_PAGE_NEXT, + block->page.frame + FIL_PAGE_OFFSET, + 4)); +#else + if (UNIV_UNLIKELY(memcmp_aligned<4>(merge_block->page.frame + + FIL_PAGE_NEXT, + block->page.frame + + FIL_PAGE_OFFSET, 4))) { + return DB_CORRUPTION; + } +#endif ut_d(parent_is_different = (page_rec_get_next( page_get_infimum_rec( @@ -3964,57 +4319,73 @@ btr_discard_page( &parent_cursor))) == btr_cur_get_rec(&parent_cursor))); } else if (right_page_no != FIL_NULL) { - merge_block = btr_block_get(*index, right_page_no, RW_X_LATCH, - true, mtr); -#ifdef UNIV_BTR_DEBUG - ut_a(btr_page_get_prev(merge_block->page.frame) - == block->page.id().page_no()); -#endif /* UNIV_BTR_DEBUG */ + merge_page_id.set_page_no(right_page_no); + merge_block = btr_block_reget(mtr, *index, merge_page_id, + RW_X_LATCH, &err); + if (UNIV_UNLIKELY(!merge_block)) { + return err; + } +#if 1 /* MDEV-29835 FIXME: Acquire the page latch upfront. */ + ut_ad(!memcmp_aligned<4>(merge_block->page.frame + + FIL_PAGE_PREV, + block->page.frame + FIL_PAGE_OFFSET, + 4)); +#else + if (UNIV_UNLIKELY(memcmp_aligned<4>(merge_block->page.frame + + FIL_PAGE_PREV, + block->page.frame + + FIL_PAGE_OFFSET, 4))) { + return DB_CORRUPTION; + } +#endif ut_d(parent_is_different = page_rec_is_supremum( page_rec_get_next(btr_cur_get_rec(&parent_cursor)))); - if (!page_is_leaf(merge_block->page.frame)) { - rec_t* node_ptr = page_rec_get_next( - page_get_infimum_rec(merge_block->page.frame)); + if (page_is_leaf(merge_block->page.frame)) { + } else if (rec_t* node_ptr = + page_rec_get_next(page_get_infimum_rec( + merge_block->page.frame))) { ut_ad(page_rec_is_user_rec(node_ptr)); /* We have to mark the leftmost node pointer as the predefined minimum record. */ btr_set_min_rec_mark(node_ptr, *merge_block, mtr); + } else { + return DB_CORRUPTION; } } else { btr_discard_only_page_on_level(index, block, mtr); + return DB_SUCCESS; + } - return; + if (UNIV_UNLIKELY(memcmp_aligned<2>(&merge_block->page.frame + [PAGE_HEADER + PAGE_LEVEL], + &block->page.frame + [PAGE_HEADER + PAGE_LEVEL], 2))) { + return DB_CORRUPTION; } - ut_a(page_is_comp(merge_block->page.frame) - == page_is_comp(block->page.frame)); - ut_ad(!memcmp_aligned<2>(&merge_block->page.frame - [PAGE_HEADER + PAGE_LEVEL], - &block->page.frame - [PAGE_HEADER + PAGE_LEVEL], 2)); - btr_search_drop_page_hash_index(block); + btr_search_drop_page_hash_index(block, false); if (dict_index_is_spatial(index)) { rtr_node_ptr_delete(&parent_cursor, mtr); - } else { - btr_cur_node_ptr_delete(&parent_cursor, mtr); + } else if (dberr_t err = + btr_cur_node_ptr_delete(&parent_cursor, mtr)) { + return err; } /* Remove the page from the level list */ - ut_a(DB_SUCCESS == btr_level_list_remove(*block, *index, mtr)); + if (dberr_t err = btr_level_list_remove(*block, *index, mtr)) { + return err; + } #ifdef UNIV_ZIP_DEBUG - { - page_zip_des_t* merge_page_zip - = buf_block_get_page_zip(merge_block); - ut_a(!merge_page_zip - || page_zip_validate(merge_page_zip, - merge_block->page.frame, index)); - } + if (page_zip_des_t* merge_page_zip + = buf_block_get_page_zip(merge_block)) + ut_a(page_zip_validate(merge_page_zip, + merge_block->page.frame, index)); #endif /* UNIV_ZIP_DEBUG */ - if (!dict_table_is_locking_disabled(index->table)) { + if (index->has_locking()) { if (left_page_no != FIL_NULL) { lock_update_discard(merge_block, PAGE_HEAP_NO_SUPREMUM, block); @@ -4023,27 +4394,32 @@ btr_discard_page( lock_get_min_heap_no(merge_block), block); } - } - if (dict_index_is_spatial(index)) { - rtr_check_discard_page(index, cursor, block); + if (index->is_spatial()) { + rtr_check_discard_page(index, cursor, block); + } } /* Free the file page */ - btr_page_free(index, block, mtr); - - /* btr_check_node_ptr() needs parent block latched. - If the merge_block's parent block is not same, - we cannot use btr_check_node_ptr() */ - ut_ad(parent_is_different - || btr_check_node_ptr(index, merge_block, mtr)); - - if (btr_cur_get_block(&parent_cursor)->page.id().page_no() - == index->page - && !page_has_siblings(btr_cur_get_page(&parent_cursor)) - && page_get_n_recs(btr_cur_get_page(&parent_cursor)) == 1) { - btr_lift_page_up(index, merge_block, mtr); + err = btr_page_free(index, block, mtr); + + if (err == DB_SUCCESS) { + /* btr_check_node_ptr() needs parent block latched. + If the merge_block's parent block is not same, + we cannot use btr_check_node_ptr() */ + ut_ad(parent_is_different + || btr_check_node_ptr(index, merge_block, mtr)); + + if (btr_cur_get_block(&parent_cursor)->page.id().page_no() + == index->page + && !page_has_siblings(btr_cur_get_page(&parent_cursor)) + && page_get_n_recs(btr_cur_get_page(&parent_cursor)) + == 1) { + btr_lift_page_up(index, merge_block, mtr, &err); + } } + + return err; } #ifdef UNIV_BTR_PRINT @@ -4134,12 +4510,12 @@ btr_print_recursive( *offsets = rec_get_offsets( node_ptr, index, *offsets, 0, ULINT_UNDEFINED, heap); - btr_print_recursive(index, - btr_node_ptr_get_child(node_ptr, - index, - *offsets, - &mtr2), - width, heap, offsets, &mtr2); + if (buf_block_t *child = + btr_node_ptr_get_child(node_ptr, index, *offsets, + &mtr2)) { + btr_print_recursive(index, child, width, heap, + offsets, &mtr2); + } mtr_commit(&mtr2); } @@ -4206,16 +4582,20 @@ btr_check_node_ptr( return(TRUE); } + cursor.page_cur.index = index; + cursor.page_cur.block = block; + heap = mem_heap_create(256); if (dict_index_is_spatial(index)) { - offsets = rtr_page_get_father_block(NULL, heap, index, block, mtr, + offsets = rtr_page_get_father_block(NULL, heap, mtr, NULL, &cursor); } else { - offsets = btr_page_get_father_block(NULL, heap, index, block, mtr, - &cursor); + offsets = btr_page_get_father_block(NULL, heap, mtr, &cursor); } + ut_ad(offsets); + if (page_is_leaf(page)) { goto func_exit; @@ -4233,7 +4613,8 @@ btr_check_node_ptr( tuple, btr_cur_get_rec(&cursor), PAGE_CUR_WITHIN)); } else { - ut_a(!cmp_dtuple_rec(tuple, btr_cur_get_rec(&cursor), offsets)); + ut_a(!cmp_dtuple_rec(tuple, btr_cur_get_rec(&cursor), index, + offsets)); } func_exit: mem_heap_free(heap); @@ -4376,7 +4757,7 @@ btr_index_rec_validate( len -= BTR_EXTERN_FIELD_REF_SIZE; ulint extern_len = mach_read_from_4( data + len + BTR_EXTERN_LEN + 4); - if (fixed_size == extern_len) { + if (fixed_size == extern_len + len) { goto next_field; } } @@ -4431,16 +4812,15 @@ btr_index_rec_validate( /************************************************************//** Checks the size and number of fields in records based on the definition of the index. -@return TRUE if ok */ +@return true if ok */ static -ibool +bool btr_index_page_validate( /*====================*/ buf_block_t* block, /*!< in: index page */ dict_index_t* index) /*!< in: index */ { page_cur_t cur; - ibool ret = TRUE; #ifndef DBUG_OFF ulint nth = 1; #endif /* !DBUG_OFF */ @@ -4457,17 +4837,13 @@ btr_index_page_validate( page_cur_get_page(&cur), 0)) == 1);); - page_cur_move_to_next(&cur); - - for (;;) { + while (page_cur_move_to_next(&cur)) { if (page_cur_is_after_last(&cur)) { - - break; + return true; } if (!btr_index_rec_validate(cur.rec, index, TRUE)) { - - return(FALSE); + break; } /* Verify that page_rec_get_nth_const() is correctly @@ -4479,11 +4855,9 @@ btr_index_page_validate( cur.rec))); ut_a(nth++ == page_rec_get_n_recs_before( cur.rec));); - - page_cur_move_to_next(&cur); } - return(ret); + return false; } /************************************************************//** @@ -4526,17 +4900,14 @@ btr_validate_report2( error << ", index tree level " << level; } -/************************************************************//** -Validates index tree level. -@return TRUE if ok */ +/** Validate an index tree level. */ static -bool +dberr_t btr_validate_level( /*===============*/ dict_index_t* index, /*!< in: index tree */ const trx_t* trx, /*!< in: transaction or NULL */ - ulint level, /*!< in: level number */ - bool lockout)/*!< in: true if X-latch index is intended */ + ulint level) /*!< in: level number */ { buf_block_t* block; page_t* page; @@ -4548,7 +4919,6 @@ btr_validate_level( rec_t* rec; page_cur_t cursor; dtuple_t* node_ptr_tuple; - bool ret = true; mtr_t mtr; mem_heap_t* heap = mem_heap_create(256); rec_offs* offsets = NULL; @@ -4556,56 +4926,61 @@ btr_validate_level( #ifdef UNIV_ZIP_DEBUG page_zip_des_t* page_zip; #endif /* UNIV_ZIP_DEBUG */ - ulint savepoint = 0; - ulint savepoint2 = 0; - uint32_t parent_page_no = FIL_NULL; - uint32_t parent_right_page_no = FIL_NULL; - bool rightmost_child = false; mtr.start(); - if (!srv_read_only_mode) { - if (lockout) { - mtr_x_lock_index(index, &mtr); - } else { - mtr_sx_lock_index(index, &mtr); - } - } + mtr_x_lock_index(index, &mtr); - block = btr_root_block_get(index, RW_SX_LATCH, &mtr); + dberr_t err; + block = btr_root_block_get(index, RW_SX_LATCH, &mtr, &err); + if (!block) { + mtr.commit(); + return err; + } page = buf_block_get_frame(block); fil_space_t* space = index->table->space; while (level != btr_page_get_level(page)) { const rec_t* node_ptr; - - if (fseg_page_is_free(space, block->page.id().page_no())) { - + switch (dberr_t e = + fseg_page_is_allocated(space, + block->page.id().page_no())) { + case DB_SUCCESS_LOCKED_REC: + break; + case DB_SUCCESS: btr_validate_report1(index, level, block); - ib::warn() << "Page is free"; - - ret = false; + e = DB_CORRUPTION; + /* fall through */ + default: + err = e; } - - ut_a(index->table->space_id == block->page.id().space()); - ut_a(block->page.id().space() == page_get_space_id(page)); + ut_ad(index->table->space_id == block->page.id().space()); + ut_ad(block->page.id().space() == page_get_space_id(page)); #ifdef UNIV_ZIP_DEBUG page_zip = buf_block_get_page_zip(block); ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ - ut_a(!page_is_leaf(page)); + if (page_is_leaf(page)) { +corrupted: + err = DB_CORRUPTION; + goto invalid_page; + } page_cur_set_before_first(block, &cursor); - page_cur_move_to_next(&cursor); + if (!(node_ptr = page_cur_move_to_next(&cursor))) { + goto corrupted; + } - node_ptr = page_cur_get_rec(&cursor); offsets = rec_get_offsets(node_ptr, index, offsets, 0, ULINT_UNDEFINED, &heap); - savepoint2 = mtr_set_savepoint(&mtr); - block = btr_node_ptr_get_child(node_ptr, index, offsets, &mtr); + block = btr_node_ptr_get_child(node_ptr, index, offsets, &mtr, + &err); + if (!block) { + break; + } page = buf_block_get_frame(block); /* For R-Tree, since record order might not be the same as @@ -4621,13 +4996,14 @@ btr_validate_level( /* To obey latch order of tree blocks, we should release the right_block once to obtain lock of the uncle block. */ - mtr_release_block_at_savepoint( - &mtr, savepoint2, block); + mtr.release_last_page(); - savepoint2 = mtr_set_savepoint(&mtr); block = btr_block_get(*index, left_page_no, RW_SX_LATCH, false, - &mtr); + &mtr, &err); + if (!block) { + goto invalid_page; + } page = buf_block_get_frame(block); left_page_no = btr_page_get_prev(page); } @@ -4638,87 +5014,89 @@ btr_validate_level( level. */ loop: + if (!block) { +invalid_page: + mtr.commit(); +func_exit: + mem_heap_free(heap); + return err; + } + mem_heap_empty(heap); offsets = offsets2 = NULL; - if (!srv_read_only_mode) { - if (lockout) { - mtr_x_lock_index(index, &mtr); - } else { - mtr_sx_lock_index(index, &mtr); - } - } + + mtr_x_lock_index(index, &mtr); + + page = block->page.frame; #ifdef UNIV_ZIP_DEBUG page_zip = buf_block_get_page_zip(block); ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ - ut_a(block->page.id().space() == index->table->space_id); - - if (fseg_page_is_free(space, block->page.id().page_no())) { - + if (DB_SUCCESS_LOCKED_REC + != fseg_page_is_allocated(space, block->page.id().page_no())) { btr_validate_report1(index, level, block); ib::warn() << "Page is marked as free"; - ret = false; - + err = DB_CORRUPTION; } else if (btr_page_get_index_id(page) != index->id) { - ib::error() << "Page index id " << btr_page_get_index_id(page) << " != data dictionary index id " << index->id; - - ret = false; - + err = DB_CORRUPTION; } else if (!page_validate(page, index)) { - btr_validate_report1(index, level, block); - ret = false; - + err = DB_CORRUPTION; + } else if (btr_page_get_level(page) != level) { + btr_validate_report1(index, level, block); + ib::error() << "Page level is not " << level; + err = DB_CORRUPTION; } else if (level == 0 && !btr_index_page_validate(block, index)) { - /* We are on level 0. Check that the records have the right number of fields, and field lengths are right. */ - - ret = false; + err = DB_CORRUPTION; + } else if (!page_is_empty(page)) { + } else if (level) { + btr_validate_report1(index, level, block); + ib::error() << "Non-leaf page is empty"; + } else if (block->page.id().page_no() != index->page) { + btr_validate_report1(index, level, block); + ib::error() << "Empty leaf page is not index root"; } - ut_a(btr_page_get_level(page) == level); - uint32_t right_page_no = btr_page_get_next(page); uint32_t left_page_no = btr_page_get_prev(page); - ut_a(!page_is_empty(page) - || (level == 0 - && page_get_page_no(page) == dict_index_get_page(index))); - if (right_page_no != FIL_NULL) { const rec_t* right_rec; - savepoint = mtr_set_savepoint(&mtr); right_block = btr_block_get(*index, right_page_no, RW_SX_LATCH, - !level, &mtr); + !level, &mtr, &err); + if (!right_block) { + btr_validate_report1(index, level, block); + fputs("InnoDB: broken FIL_PAGE_NEXT link\n", stderr); + goto invalid_page; + } right_page = buf_block_get_frame(right_block); if (btr_page_get_prev(right_page) != page_get_page_no(page)) { btr_validate_report2(index, level, block, right_block); fputs("InnoDB: broken FIL_PAGE_NEXT" " or FIL_PAGE_PREV links\n", stderr); - - ret = false; + err = DB_CORRUPTION; } - if (page_is_comp(right_page) != page_is_comp(page)) { - btr_validate_report2(index, level, block, right_block); - fputs("InnoDB: 'compact' flag mismatch\n", stderr); - - ret = false; - - goto node_ptr_fails; + if (!(rec = page_rec_get_prev(page_get_supremum_rec(page)))) { +broken_links: + btr_validate_report1(index, level, block); + fputs("InnoDB: broken record links\n", stderr); + goto invalid_page; + } + if (!(right_rec = + page_rec_get_next(page_get_infimum_rec(right_page)))) { + goto broken_links; } - rec = page_rec_get_prev(page_get_supremum_rec(page)); - right_rec = page_rec_get_next(page_get_infimum_rec( - right_page)); offsets = rec_get_offsets(rec, index, offsets, page_is_leaf(page) ? index->n_core_fields : 0, @@ -4731,7 +5109,7 @@ btr_validate_level( /* For spatial index, we cannot guarantee the key ordering across pages, so skip the record compare verification for now. Will enhanced in special R-Tree index validation scheme */ - if (!dict_index_is_spatial(index) + if (index->is_btree() && cmp_rec_rec(rec, right_rec, offsets, offsets2, index) >= 0) { @@ -4740,24 +5118,35 @@ btr_validate_level( fputs("InnoDB: records in wrong order" " on adjacent pages\n", stderr); - fputs("InnoDB: record ", stderr); rec = page_rec_get_prev(page_get_supremum_rec(page)); - rec_print(stderr, rec, index); - putc('\n', stderr); + if (rec) { + fputs("InnoDB: record ", stderr); + rec_print(stderr, rec, index); + putc('\n', stderr); + } fputs("InnoDB: record ", stderr); rec = page_rec_get_next( page_get_infimum_rec(right_page)); - rec_print(stderr, rec, index); + if (rec) { + rec_print(stderr, rec, index); + } putc('\n', stderr); - - ret = false; + err = DB_CORRUPTION; } } - if (level > 0 && left_page_no == FIL_NULL) { - ut_a(REC_INFO_MIN_REC_FLAG & rec_get_info_bits( - page_rec_get_next(page_get_infimum_rec(page)), - page_is_comp(page))); + if (!level || left_page_no != FIL_NULL) { + } else if (const rec_t* first = + page_rec_get_next_const(page_get_infimum_rec(page))) { + if (!(REC_INFO_MIN_REC_FLAG + & rec_get_info_bits(first, page_is_comp(page)))) { + btr_validate_report1(index, level, block); + ib::error() << "Missing REC_INFO_MIN_REC_FLAG"; + err = DB_CORRUPTION; + } + } else { + err = DB_CORRUPTION; + goto node_ptr_fails; } /* Similarly skip the father node check for spatial index for now, @@ -4766,35 +5155,33 @@ btr_validate_level( in parent level and linked pages in the child level. 2) Search parent from root is very costly for R-tree. We will add special validation mechanism for R-tree later (WL #7520) */ - if (!dict_index_is_spatial(index) - && block->page.id().page_no() != dict_index_get_page(index)) { - + if (index->is_btree() && block->page.id().page_no() != index->page) { /* Check father node pointers */ - rec_t* node_ptr; + rec_t* node_ptr + = page_rec_get_next(page_get_infimum_rec(page)); + if (!node_ptr) { + err = DB_CORRUPTION; + goto node_ptr_fails; + } - btr_cur_position( - index, page_rec_get_next(page_get_infimum_rec(page)), - block, &node_cur); + btr_cur_position(index, node_ptr, block, &node_cur); offsets = btr_page_get_father_node_ptr_for_validate( offsets, heap, &node_cur, &mtr); father_page = btr_cur_get_page(&node_cur); node_ptr = btr_cur_get_rec(&node_cur); - parent_page_no = page_get_page_no(father_page); - parent_right_page_no = btr_page_get_next(father_page); - rightmost_child = page_rec_is_supremum( - page_rec_get_next(node_ptr)); - - btr_cur_position( - index, - page_rec_get_prev(page_get_supremum_rec(page)), - block, &node_cur); + rec = page_rec_get_prev(page_get_supremum_rec(page)); + if (rec) { + btr_cur_position(index, rec, block, &node_cur); - offsets = btr_page_get_father_node_ptr_for_validate( + offsets = btr_page_get_father_node_ptr_for_validate( offsets, heap, &node_cur, &mtr); + } else { + offsets = nullptr; + } - if (node_ptr != btr_cur_get_rec(&node_cur) + if (!offsets || node_ptr != btr_cur_get_rec(&node_cur) || btr_node_ptr_get_child_page_no(node_ptr, offsets) != block->page.id().page_no()) { @@ -4806,30 +5193,30 @@ btr_validate_level( fputs("InnoDB: node ptr ", stderr); rec_print(stderr, node_ptr, index); - rec = btr_cur_get_rec(&node_cur); - fprintf(stderr, "\n" - "InnoDB: node ptr child page n:o %u\n", - btr_node_ptr_get_child_page_no(rec, offsets)); - - fputs("InnoDB: record on page ", stderr); - rec_print_new(stderr, rec, offsets); - putc('\n', stderr); - ret = false; + if (offsets) { + rec = btr_cur_get_rec(&node_cur); + fprintf(stderr, "\n" + "InnoDB: node ptr child page n:o %u\n", + btr_node_ptr_get_child_page_no( + rec, offsets)); + fputs("InnoDB: record on page ", stderr); + rec_print_new(stderr, rec, offsets); + putc('\n', stderr); + } + err = DB_CORRUPTION; goto node_ptr_fails; } - if (!page_is_leaf(page)) { + if (page_is_leaf(page)) { + } else if (const rec_t* first_rec = + page_rec_get_next(page_get_infimum_rec(page))) { node_ptr_tuple = dict_index_build_node_ptr( - index, - page_rec_get_next(page_get_infimum_rec(page)), + index, first_rec, 0, heap, btr_page_get_level(page)); - if (cmp_dtuple_rec(node_ptr_tuple, node_ptr, + if (cmp_dtuple_rec(node_ptr_tuple, node_ptr, index, offsets)) { - const rec_t* first_rec = page_rec_get_next( - page_get_infimum_rec(page)); - btr_validate_report1(index, level, block); ib::error() << "Node ptrs differ on levels > 0"; @@ -4839,54 +5226,39 @@ btr_validate_level( fputs("InnoDB: first rec ", stderr); rec_print(stderr, first_rec, index); putc('\n', stderr); - ret = false; - + err = DB_CORRUPTION; goto node_ptr_fails; } + } else { + err = DB_CORRUPTION; + goto node_ptr_fails; } if (left_page_no == FIL_NULL) { - ut_a(node_ptr == page_rec_get_next( - page_get_infimum_rec(father_page))); - ut_a(!page_has_prev(father_page)); + if (page_has_prev(father_page) + || node_ptr != page_rec_get_next( + page_get_infimum_rec(father_page))) { + err = DB_CORRUPTION; + goto node_ptr_fails; + } } if (right_page_no == FIL_NULL) { - ut_a(node_ptr == page_rec_get_prev( - page_get_supremum_rec(father_page))); - ut_a(!page_has_next(father_page)); - } else { - const rec_t* right_node_ptr; - - right_node_ptr = page_rec_get_next(node_ptr); - - if (!lockout && rightmost_child) { - - /* To obey latch order of tree blocks, - we should release the right_block once to - obtain lock of the uncle block. */ - mtr_release_block_at_savepoint( - &mtr, savepoint, right_block); - - if (parent_right_page_no != FIL_NULL) { - btr_block_get(*index, - parent_right_page_no, - RW_SX_LATCH, false, - &mtr); - } - - right_block = btr_block_get(*index, - right_page_no, - RW_SX_LATCH, - !level, &mtr); + if (page_has_next(father_page) + || node_ptr != page_rec_get_prev( + page_get_supremum_rec(father_page))) { + err = DB_CORRUPTION; + goto node_ptr_fails; } - + } else if (const rec_t* right_node_ptr + = page_rec_get_next(node_ptr)) { btr_cur_position( - index, page_rec_get_next( - page_get_infimum_rec( - buf_block_get_frame( - right_block))), + index, + page_get_infimum_rec(right_block->page.frame), right_block, &right_node_cur); + if (!page_cur_move_to_next(&right_node_cur.page_cur)) { + goto node_pointer_corrupted; + } offsets = btr_page_get_father_node_ptr_for_validate( offsets, heap, &right_node_cur, &mtr); @@ -4896,7 +5268,8 @@ btr_validate_level( if (btr_cur_get_rec(&right_node_cur) != right_node_ptr) { - ret = false; +node_pointer_corrupted: + err = DB_CORRUPTION; fputs("InnoDB: node pointer to" " the right page is wrong\n", stderr); @@ -4912,7 +5285,7 @@ btr_validate_level( != page_rec_get_next( page_get_infimum_rec( right_father_page))) { - ret = false; + err = DB_CORRUPTION; fputs("InnoDB: node pointer 2 to" " the right page is wrong\n", stderr); @@ -4924,7 +5297,7 @@ btr_validate_level( if (page_get_page_no(right_father_page) != btr_page_get_next(father_page)) { - ret = false; + err = DB_CORRUPTION; fputs("InnoDB: node pointer 3 to" " the right page is wrong\n", stderr); @@ -4933,6 +5306,8 @@ btr_validate_level( block); } } + } else { + err = DB_CORRUPTION; } } @@ -4948,30 +5323,12 @@ btr_validate_level( mtr.start(); - if (!lockout) { - if (rightmost_child) { - if (parent_right_page_no != FIL_NULL) { - btr_block_get(*index, - parent_right_page_no, - RW_SX_LATCH, false, - &mtr); - } - } else if (parent_page_no != FIL_NULL) { - btr_block_get(*index, parent_page_no, - RW_SX_LATCH, false, &mtr); - } - } - block = btr_block_get(*index, right_page_no, RW_SX_LATCH, - !level, &mtr); - page = buf_block_get_frame(block); - + !level, &mtr, &err); goto loop; } - mem_heap_free(heap); - - return(ret); + goto func_exit; } /**************************************************************//** @@ -4983,55 +5340,23 @@ btr_validate_index( dict_index_t* index, /*!< in: index */ const trx_t* trx) /*!< in: transaction or NULL */ { - dberr_t err = DB_SUCCESS; - bool lockout = dict_index_is_spatial(index); - - /* Full Text index are implemented by auxiliary tables, - not the B-tree */ - if (dict_index_is_online_ddl(index) || (index->type & DICT_FTS)) { - return(err); - } - - mtr_t mtr; - - mtr_start(&mtr); - - if (!srv_read_only_mode) { - if (lockout) { - mtr_x_lock_index(index, &mtr); - } else { - mtr_sx_lock_index(index, &mtr); - } - } - - page_t* root = btr_root_get(index, &mtr); - - if (!root) { - mtr_commit(&mtr); - return DB_CORRUPTION; - } - - ulint n = btr_page_get_level(root); - - btr_validate_index_running++; - for (ulint i = 0; i <= n; ++i) { - - if (!btr_validate_level(index, trx, n - i, lockout)) { - err = DB_CORRUPTION; - } - } + mtr_t mtr; + mtr.start(); - mtr_commit(&mtr); - /* In theory we need release barrier here, so that - btr_validate_index_running decrement is guaranteed to - happen after latches are released. + mtr_x_lock_index(index, &mtr); - Original code issued SEQ_CST on update and non-atomic - access on load. Which means it had broken synchronisation - as well. */ - btr_validate_index_running--; + dberr_t err; + if (page_t *root= btr_root_get(index, &mtr, &err)) + for (auto level= btr_page_get_level(root);; level--) + { + if (dberr_t err_level= btr_validate_level(index, trx, level)) + err= err_level; + if (!level) + break; + } - return(err); + mtr.commit(); + return err; } /**************************************************************//** @@ -5058,6 +5383,7 @@ btr_can_merge_with_page( DBUG_ENTER("btr_can_merge_with_page"); if (page_no == FIL_NULL) { +error: *merge_block = NULL; DBUG_RETURN(false); } @@ -5067,6 +5393,9 @@ btr_can_merge_with_page( mblock = btr_block_get(*index, page_no, RW_X_LATCH, page_is_leaf(page), mtr); + if (!mblock) { + goto error; + } mpage = buf_block_get_frame(mblock); n_recs = page_get_n_recs(page); @@ -5093,8 +5422,8 @@ btr_can_merge_with_page( if (data_size > max_ins_size) { /* We have to reorganize mpage */ - if (!btr_page_reorganize_block(page_zip_level, mblock, index, - mtr)) { + if (btr_page_reorganize_block(page_zip_level, mblock, index, + mtr) != DB_SUCCESS) { goto error; } @@ -5114,8 +5443,4 @@ btr_can_merge_with_page( *merge_block = mblock; DBUG_RETURN(true); - -error: - *merge_block = NULL; - DBUG_RETURN(false); } diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc index 263a2f9200312..013cd13102cd8 100644 --- a/storage/innobase/btr/btr0bulk.cc +++ b/storage/innobase/btr/btr0bulk.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2014, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -61,17 +61,22 @@ PageBulk::init() m_index->set_modified(alloc_mtr); uint32_t n_reserved; - if (!fsp_reserve_free_extents(&n_reserved, - m_index->table->space, - 1, FSP_NORMAL, &alloc_mtr)) { + dberr_t err = fsp_reserve_free_extents( + &n_reserved, m_index->table->space, 1, FSP_NORMAL, + &alloc_mtr); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { +oom: alloc_mtr.commit(); m_mtr.commit(); - return(DB_OUT_OF_FILE_SPACE); + return err; } /* Allocate a new page. */ new_block = btr_page_alloc(m_index, 0, FSP_UP, m_level, - &alloc_mtr, &m_mtr); + &alloc_mtr, &m_mtr, &err); + if (!new_block) { + goto oom; + } m_index->table->space->release_free_extents(n_reserved); @@ -103,9 +108,12 @@ PageBulk::init() } else { new_block = btr_block_get(*m_index, m_page_no, RW_X_LATCH, false, &m_mtr); + if (!new_block) { + m_mtr.commit(); + return(DB_CORRUPTION); + } new_page = buf_block_get_frame(new_block); - ut_ad(new_block->page.id().page_no() == m_page_no); ut_ad(page_dir_get_n_heap(new_page) == PAGE_HEAP_NO_USER_LOW); @@ -362,7 +370,6 @@ inline void PageBulk::finishPage() ut_ad((fmt != REDUNDANT) == m_is_comp); ulint count= 0; - ulint n_recs= 0; byte *slot= my_assume_aligned<2>(m_page + srv_page_size - (PAGE_DIR + PAGE_DIR_SLOT_SIZE)); const page_dir_slot_t *const slot0 = slot; @@ -378,7 +385,6 @@ inline void PageBulk::finishPage() ut_ad(offset >= PAGE_NEW_SUPREMUM); ut_ad(offset < page_offset(slot)); count++; - n_recs++; if (count == (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2) { @@ -432,7 +438,6 @@ inline void PageBulk::finishPage() while (insert_rec != m_page + PAGE_OLD_SUPREMUM) { count++; - n_recs++; if (count == (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2) { @@ -558,8 +563,9 @@ inline void PageBulk::finish() void PageBulk::commit(bool success) { finish(); - if (success && !dict_index_is_clust(m_index) && page_is_leaf(m_page)) - ibuf_set_bitmap_for_bulk_load(m_block, innobase_fill_factor == 100); + if (success && !m_index->is_clust() && page_is_leaf(m_page)) + ibuf_set_bitmap_for_bulk_load(m_block, &m_mtr, + innobase_fill_factor == 100); m_mtr.commit(); } @@ -629,7 +635,7 @@ PageBulk::getSplitRec() < total_used_size / 2); /* Keep at least one record on left page */ - if (page_rec_is_infimum(page_rec_get_prev(rec))) { + if (page_rec_is_first(rec, m_page)) { rec = page_rec_get_next(rec); ut_ad(page_rec_is_user_rec(rec)); } @@ -671,35 +677,40 @@ void PageBulk::copyOut( rec_t* split_rec) { - rec_t* rec; - rec_t* last_rec; - ulint n; - /* Suppose before copyOut, we have 5 records on the page: infimum->r1->r2->r3->r4->r5->supremum, and r3 is the split rec. after copyOut, we have 2 records on the page: infimum->r1->r2->supremum. slot ajustment is not done. */ - rec = page_rec_get_next(page_get_infimum_rec(m_page)); - last_rec = page_rec_get_prev(page_get_supremum_rec(m_page)); - n = 0; + rec_t *rec = page_get_infimum_rec(m_page); + ulint n; - while (rec != split_rec) { - rec = page_rec_get_next(rec); - n++; + for (n = 0;; n++) { + rec_t *next = page_rec_get_next(rec); + if (next == split_rec) { + break; + } + rec = next; } ut_ad(n > 0); + const rec_t *last_rec = split_rec; + for (;;) { + const rec_t *next = page_rec_get_next_const(last_rec); + if (page_rec_is_supremum(next)) { + break; + } + last_rec = next; + } + /* Set last record's next in page */ - rec_offs* offsets = NULL; - rec = page_rec_get_prev(split_rec); const ulint n_core = page_rec_is_leaf(split_rec) ? m_index->n_core_fields : 0; - offsets = rec_get_offsets(rec, m_index, offsets, n_core, - ULINT_UNDEFINED, &m_heap); + rec_offs* offsets = rec_get_offsets(rec, m_index, nullptr, n_core, + ULINT_UNDEFINED, &m_heap); mach_write_to_2(rec - REC_NEXT, m_is_comp ? static_cast (PAGE_NEW_SUPREMUM - page_offset(rec)) @@ -755,6 +766,11 @@ bool PageBulk::isSpaceAvailable( ulint rec_size) { + if (m_rec_no >= 8190) { + ut_ad(srv_page_size == 65536); + return false; + } + ulint slot_size; ulint required_space; @@ -811,7 +827,6 @@ PageBulk::storeExt( btr_pcur_t btr_pcur; btr_pcur.pos_state = BTR_PCUR_IS_POSITIONED; btr_pcur.latch_mode = BTR_MODIFY_LEAF; - btr_pcur.btr_cur.index = m_index; btr_pcur.btr_cur.page_cur.index = m_index; btr_pcur.btr_cur.page_cur.rec = m_cur_rec; btr_pcur.btr_cur.page_cur.offsets = offsets; @@ -820,14 +835,6 @@ PageBulk::storeExt( dberr_t err = btr_store_big_rec_extern_fields( &btr_pcur, offsets, big_rec, &m_mtr, BTR_STORE_INSERT_BULK); - /* Reset m_block and m_cur_rec from page cursor, because - block may be changed during blob insert. (FIXME: Can it really?) */ - ut_ad(m_block == btr_pcur.btr_cur.page_cur.block); - - m_block = btr_pcur.btr_cur.page_cur.block; - m_cur_rec = btr_pcur.btr_cur.page_cur.rec; - m_page = buf_block_get_frame(m_block); - return(err); } @@ -848,38 +855,19 @@ PageBulk::release() } /** Start mtr and latch the block */ -dberr_t -PageBulk::latch() +void PageBulk::latch() { - m_mtr.start(); - m_index->set_modified(m_mtr); - - ut_ad(m_block->page.buf_fix_count()); - - /* In case the block is U-latched by page_cleaner. */ - if (!buf_page_optimistic_get(RW_X_LATCH, m_block, m_modify_clock, - &m_mtr)) { - /* FIXME: avoid another lookup */ - m_block = buf_page_get_gen(page_id_t(m_index->table->space_id, - m_page_no), - 0, RW_X_LATCH, - m_block, BUF_GET_IF_IN_POOL, - &m_mtr, &m_err); - - if (m_err != DB_SUCCESS) { - return (m_err); - } - - ut_ad(m_block != NULL); - } - - ut_d(const auto buf_fix_count =) m_block->page.unfix(); - - ut_ad(buf_fix_count); - ut_ad(m_cur_rec > m_page); - ut_ad(m_cur_rec < m_heap_top); - - return (m_err); + m_mtr.start(); + m_index->set_modified(m_mtr); +#ifdef BTR_CUR_HASH_ADAPT + ut_ad(!m_block->index); +#endif + m_block->page.lock.x_lock(); + ut_ad(m_block->page.buf_fix_count()); + m_mtr.memo_push(m_block, MTR_MEMO_PAGE_X_FIX); + + ut_ad(m_cur_rec > m_page); + ut_ad(m_cur_rec < m_heap_top); } /** Split a page @@ -1207,25 +1195,35 @@ BtrBulk::finish(dberr_t err) ut_ad(last_page_no != FIL_NULL); last_block = btr_block_get(*m_index, last_page_no, RW_X_LATCH, false, &mtr); + if (!last_block) { + err = DB_CORRUPTION; +err_exit: + mtr.commit(); + return err; + } + first_rec = page_rec_get_next( page_get_infimum_rec(last_block->page.frame)); + /* Because this index tree is being created by this thread, + we assume that it cannot be corrupted. */ + ut_ad(first_rec); ut_ad(page_rec_is_user_rec(first_rec)); /* Copy last page to root page. */ err = root_page_bulk.init(); if (err != DB_SUCCESS) { - mtr.commit(); - return(err); + goto err_exit; } root_page_bulk.copyIn(first_rec); root_page_bulk.finish(); /* Remove last page. */ - btr_page_free(m_index, last_block, &mtr); - + err = btr_page_free(m_index, last_block, &mtr); mtr.commit(); - err = pageCommit(&root_page_bulk, NULL, false); + if (dberr_t e = pageCommit(&root_page_bulk, NULL, false)) { + err = e; + } ut_ad(err == DB_SUCCESS); } diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index ceac301a50263..59ba6eaa2b45b 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -3,7 +3,7 @@ Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2015, 2021, MariaDB Corporation. +Copyright (c) 2015, 2023, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -71,6 +71,7 @@ Created 10/16/1994 Heikki Tuuri #ifdef WITH_WSREP #include "mysql/service_wsrep.h" #endif /* WITH_WSREP */ +#include "log.h" /** Buffered B-tree operation types, introduced as part of delete buffering. */ enum btr_op_t { @@ -102,14 +103,14 @@ throughput clearly from about 100000. */ #define BTR_CUR_FINE_HISTORY_LENGTH 100000 #ifdef BTR_CUR_HASH_ADAPT -/** Number of searches down the B-tree in btr_cur_search_to_nth_level(). */ +/** Number of searches down the B-tree in btr_cur_t::search_leaf(). */ ib_counter_t btr_cur_n_non_sea; /** Old value of btr_cur_n_non_sea. Copied by srv_refresh_innodb_monitor_stats(). Referenced by srv_printf_innodb_monitor(). */ ulint btr_cur_n_non_sea_old; /** Number of successful adaptive hash index lookups in -btr_cur_search_to_nth_level(). */ +btr_cur_t::search_leaf(). */ ib_counter_t btr_cur_n_sea; /** Old value of btr_cur_n_sea. Copied by srv_refresh_innodb_monitor_stats(). Referenced by @@ -152,17 +153,6 @@ btr_cur_unmark_extern_fields( dict_index_t* index, /*!< in: index of the page */ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */ mtr_t* mtr); /*!< in: mtr, or NULL if not logged */ -/*******************************************************************//** -Adds path information to the cursor for the current page, for which -the binary search has been performed. */ -static -void -btr_cur_add_path_info( -/*==================*/ - btr_cur_t* cursor, /*!< in: cursor positioned on a page */ - ulint height, /*!< in: height of the page in tree; - 0 means leaf node */ - ulint root_height); /*!< in: root node height in tree */ /***********************************************************//** Frees the externally stored fields for a record, if the field is mentioned in the update vector. */ @@ -197,184 +187,6 @@ btr_rec_free_externally_stored_fields( /*==================== B-TREE SEARCH =========================*/ -/** Latches the leaf page or pages requested. -@param[in] block leaf page where the search converged -@param[in] latch_mode BTR_SEARCH_LEAF, ... -@param[in] cursor cursor -@param[in] mtr mini-transaction -@return blocks and savepoints which actually latched. */ -btr_latch_leaves_t -btr_cur_latch_leaves( - buf_block_t* block, - ulint latch_mode, - btr_cur_t* cursor, - mtr_t* mtr) -{ - rw_lock_type_t mode; - uint32_t left_page_no; - uint32_t right_page_no; - buf_block_t* get_block; - bool spatial; - btr_latch_leaves_t latch_leaves = {{NULL, NULL, NULL}, {0, 0, 0}}; - - compile_time_assert(int(MTR_MEMO_PAGE_S_FIX) == int(RW_S_LATCH)); - compile_time_assert(int(MTR_MEMO_PAGE_X_FIX) == int(RW_X_LATCH)); - compile_time_assert(int(MTR_MEMO_PAGE_SX_FIX) == int(RW_SX_LATCH)); - ut_ad(block->page.id().space() == cursor->index->table->space->id); - - spatial = dict_index_is_spatial(cursor->index) && cursor->rtr_info; - ut_ad(block->page.in_file()); - ut_ad(srv_read_only_mode - || mtr->memo_contains_flagged(&cursor->index->lock, - MTR_MEMO_S_LOCK - | MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK)); - - switch (latch_mode) { - case BTR_SEARCH_LEAF: - case BTR_MODIFY_LEAF: - case BTR_SEARCH_TREE: - if (spatial) { - cursor->rtr_info->tree_savepoints[RTR_MAX_LEVELS] - = mtr_set_savepoint(mtr); - } - - mode = latch_mode == BTR_MODIFY_LEAF ? RW_X_LATCH : RW_S_LATCH; - latch_leaves.savepoints[1] = mtr_set_savepoint(mtr); - get_block = btr_block_get(*cursor->index, - block->page.id().page_no(), mode, - true, mtr); - latch_leaves.blocks[1] = get_block; -#ifdef UNIV_BTR_DEBUG - ut_a(page_is_comp(get_block->page.frame) - == page_is_comp(block->page.frame)); -#endif /* UNIV_BTR_DEBUG */ - if (spatial) { - cursor->rtr_info->tree_blocks[RTR_MAX_LEVELS] - = get_block; - } - - return(latch_leaves); - case BTR_MODIFY_TREE: - /* It is exclusive for other operations which calls - btr_page_set_prev() */ - ut_ad(mtr->memo_contains_flagged(&cursor->index->lock, - MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK)); - /* x-latch also siblings from left to right */ - left_page_no = btr_page_get_prev(block->page.frame); - - if (left_page_no != FIL_NULL) { - - if (spatial) { - cursor->rtr_info->tree_savepoints[ - RTR_MAX_LEVELS] = mtr_set_savepoint(mtr); - } - - latch_leaves.savepoints[0] = mtr_set_savepoint(mtr); - get_block = btr_block_get( - *cursor->index, left_page_no, RW_X_LATCH, - true, mtr); - latch_leaves.blocks[0] = get_block; - - if (spatial) { - cursor->rtr_info->tree_blocks[RTR_MAX_LEVELS] - = get_block; - } - } - - if (spatial) { - cursor->rtr_info->tree_savepoints[RTR_MAX_LEVELS + 1] - = mtr_set_savepoint(mtr); - } - - latch_leaves.savepoints[1] = mtr_set_savepoint(mtr); - get_block = btr_block_get( - *cursor->index, block->page.id().page_no(), - RW_X_LATCH, true, mtr); - latch_leaves.blocks[1] = get_block; - -#ifdef UNIV_BTR_DEBUG - ut_a(page_is_comp(get_block->page.frame) - == page_is_comp(block->page.frame)); -#endif /* UNIV_BTR_DEBUG */ - - if (spatial) { - cursor->rtr_info->tree_blocks[RTR_MAX_LEVELS + 1] - = get_block; - } - - right_page_no = btr_page_get_next(block->page.frame); - - if (right_page_no != FIL_NULL) { - if (spatial) { - cursor->rtr_info->tree_savepoints[ - RTR_MAX_LEVELS + 2] = mtr_set_savepoint( - mtr); - } - latch_leaves.savepoints[2] = mtr_set_savepoint(mtr); - get_block = btr_block_get(*cursor->index, - right_page_no, RW_X_LATCH, - true, mtr); - latch_leaves.blocks[2] = get_block; -#ifdef UNIV_BTR_DEBUG - if (get_block) { - ut_a(page_is_comp(get_block->page.frame) - == page_is_comp(block->page.frame)); - ut_a(btr_page_get_prev(get_block->page.frame) - == block->page.id().page_no()); - } -#endif /* UNIV_BTR_DEBUG */ - if (spatial) { - cursor->rtr_info->tree_blocks[ - RTR_MAX_LEVELS + 2] = get_block; - } - } - - return(latch_leaves); - - case BTR_SEARCH_PREV: - case BTR_MODIFY_PREV: - mode = latch_mode == BTR_SEARCH_PREV ? RW_S_LATCH : RW_X_LATCH; - /* Because we are holding index->lock, no page splits - or merges may run concurrently, and we may read - FIL_PAGE_PREV from a buffer-fixed, unlatched page. */ - left_page_no = btr_page_get_prev(block->page.frame); - - if (left_page_no != FIL_NULL) { - latch_leaves.savepoints[0] = mtr_set_savepoint(mtr); - get_block = btr_block_get( - *cursor->index, left_page_no, mode, - true, mtr); - latch_leaves.blocks[0] = get_block; - cursor->left_block = get_block; -#ifdef UNIV_BTR_DEBUG - ut_a(page_is_comp(get_block->page.frame) - == page_is_comp(block->page.frame)); - ut_a(btr_page_get_next(get_block->page.frame) - == block->page.id().page_no()); -#endif /* UNIV_BTR_DEBUG */ - } - - latch_leaves.savepoints[1] = mtr_set_savepoint(mtr); - get_block = btr_block_get(*cursor->index, - block->page.id().page_no(), mode, - true, mtr); - latch_leaves.blocks[1] = get_block; -#ifdef UNIV_BTR_DEBUG - ut_a(page_is_comp(get_block->page.frame) - == page_is_comp(block->page.frame)); -#endif /* UNIV_BTR_DEBUG */ - return(latch_leaves); - case BTR_CONT_MODIFY_TREE: - ut_ad(dict_index_is_spatial(cursor->index)); - return(latch_leaves); - } - - ut_error; - return(latch_leaves); -} - /** Load the instant ALTER TABLE metadata from the clustered index when loading a table definition. @param[in,out] index clustered index definition @@ -389,21 +201,28 @@ static dberr_t btr_cur_instant_init_low(dict_index_t* index, mtr_t* mtr) ut_ad(index->table->supports_instant()); ut_ad(index->table->is_readable()); + dberr_t err; const fil_space_t* space = index->table->space; if (!space) { +corrupted: + err = DB_CORRUPTION; unreadable: ib::error() << "Table " << index->table->name << " has an unreadable root page"; index->table->corrupted = true; - return DB_CORRUPTION; + index->table->file_unreadable = true; + return err; } - buf_block_t* root = btr_root_block_get(index, RW_SX_LATCH, mtr); - - if (!root || btr_cur_instant_root_init(index, root->page.frame)) { + buf_block_t* root = btr_root_block_get(index, RW_SX_LATCH, mtr, &err); + if (!root) { goto unreadable; } + if (btr_cur_instant_root_init(index, root->page.frame)) { + goto corrupted; + } + ut_ad(index->n_core_null_bytes != dict_index_t::NO_CORE_NULL_BYTES); if (fil_page_get_type(root->page.frame) == FIL_PAGE_INDEX) { @@ -415,10 +234,10 @@ static dberr_t btr_cur_instant_init_low(dict_index_t* index, mtr_t* mtr) /* Relax the assertion in rec_init_offsets(). */ ut_ad(!index->in_instant_init); ut_d(index->in_instant_init = true); - dberr_t err = btr_cur_open_at_index_side(true, index, BTR_SEARCH_LEAF, - &cur, 0, mtr); + err = cur.open_leaf(true, index, BTR_SEARCH_LEAF, mtr); ut_d(index->in_instant_init = false); if (err != DB_SUCCESS) { + index->table->file_unreadable = true; index->table->corrupted = true; return err; } @@ -426,15 +245,13 @@ static dberr_t btr_cur_instant_init_low(dict_index_t* index, mtr_t* mtr) ut_ad(page_cur_is_before_first(&cur.page_cur)); ut_ad(page_is_leaf(cur.page_cur.block->page.frame)); - page_cur_move_to_next(&cur.page_cur); - - const rec_t* rec = cur.page_cur.rec; + const rec_t* rec = page_cur_move_to_next(&cur.page_cur); const ulint comp = dict_table_is_comp(index->table); - const ulint info_bits = rec_get_info_bits(rec, comp); + const ulint info_bits = rec ? rec_get_info_bits(rec, comp) : 0; if (page_rec_is_supremum(rec) || !(info_bits & REC_INFO_MIN_REC_FLAG)) { - if (!index->is_instant()) { + if (rec && !index->is_instant()) { /* The FIL_PAGE_TYPE_INSTANT and PAGE_INSTANT may be assigned even if instant ADD COLUMN was not committed. Changes to these page header fields are not @@ -549,6 +366,10 @@ static dberr_t btr_cur_instant_init_low(dict_index_t* index, mtr_t* mtr) page_id_t(space->id, mach_read_from_4(ptr + BTR_EXTERN_PAGE_NO)), 0, RW_S_LATCH, mtr); + if (!block) { + goto incompatible; + } + if (fil_page_get_type(block->page.frame) != FIL_PAGE_TYPE_BLOB || mach_read_from_4(&block->page.frame [FIL_PAGE_DATA @@ -667,14 +488,14 @@ index root page. bool btr_cur_instant_root_init(dict_index_t* index, const page_t* page) { ut_ad(!index->is_dummy); - ut_ad(fil_page_index_page_check(page)); - ut_ad(!page_has_siblings(page)); - ut_ad(page_get_space_id(page) == index->table->space_id); - ut_ad(page_get_page_no(page) == index->page); - ut_ad(!page_is_comp(page) == !dict_table_is_comp(index->table)); ut_ad(index->is_primary()); ut_ad(!index->is_instant()); ut_ad(index->table->supports_instant()); + + if (page_has_siblings(page)) { + return true; + } + /* This is normally executed as part of btr_cur_instant_init() when dict_load_table_one() is loading a table definition. Other threads should not access or modify the n_core_null_bytes, @@ -685,13 +506,14 @@ bool btr_cur_instant_root_init(dict_index_t* index, const page_t* page) switch (fil_page_get_type(page)) { default: - ut_ad("wrong page type" == 0); return true; case FIL_PAGE_INDEX: /* The field PAGE_INSTANT is guaranteed 0 on clustered index root pages of ROW_FORMAT=COMPACT or ROW_FORMAT=DYNAMIC when instant ADD COLUMN is not used. */ - ut_ad(!page_is_comp(page) || !page_get_instant(page)); + if (page_is_comp(page) && page_get_instant(page)) { + return true; + } index->n_core_null_bytes = static_cast( UT_BITS_IN_BYTES(unsigned(index->n_nullable))); return false; @@ -746,112 +568,13 @@ bool btr_cur_instant_root_init(dict_index_t* index, const page_t* page) return index->n_core_null_bytes > 128; } -/** Optimistically latches the leaf page or pages requested. -@param[in] block guessed buffer block -@param[in] modify_clock modify clock value -@param[in,out] latch_mode BTR_SEARCH_LEAF, ... -@param[in,out] cursor cursor -@param[in] mtr mini-transaction -@return true if success */ -TRANSACTIONAL_TARGET -bool -btr_cur_optimistic_latch_leaves( - buf_block_t* block, - ib_uint64_t modify_clock, - ulint* latch_mode, - btr_cur_t* cursor, - mtr_t* mtr) -{ - ut_ad(block->page.buf_fix_count()); - ut_ad(block->page.in_file()); - ut_ad(block->page.frame); - - switch (*latch_mode) { - default: - ut_error; - return(false); - case BTR_SEARCH_LEAF: - case BTR_MODIFY_LEAF: - return(buf_page_optimistic_get(*latch_mode, block, - modify_clock, mtr)); - case BTR_SEARCH_PREV: - case BTR_MODIFY_PREV: - uint32_t curr_page_no, left_page_no; - { - transactional_shared_lock_guard g{ - block->page.lock}; - if (block->modify_clock != modify_clock) { - return false; - } - curr_page_no = block->page.id().page_no(); - left_page_no = btr_page_get_prev(block->page.frame); - } - - const rw_lock_type_t mode = *latch_mode == BTR_SEARCH_PREV - ? RW_S_LATCH : RW_X_LATCH; - - if (left_page_no != FIL_NULL) { - dberr_t err = DB_SUCCESS; - cursor->left_block = buf_page_get_gen( - page_id_t(cursor->index->table->space_id, - left_page_no), - cursor->index->table->space->zip_size(), - mode, nullptr, BUF_GET_POSSIBLY_FREED, - mtr, &err); - - if (!cursor->left_block) { - cursor->index->table->file_unreadable = true; - } else if (cursor->left_block->page.is_freed() - || btr_page_get_next( - cursor->left_block->page.frame) - != curr_page_no) { - /* release the left block */ - btr_leaf_page_release( - cursor->left_block, mode, mtr); - return false; - } - } else { - cursor->left_block = NULL; - } - - if (buf_page_optimistic_get(mode, block, modify_clock, mtr)) { - if (btr_page_get_prev(block->page.frame) - == left_page_no) { - /* block was already buffer-fixed while - entering the function and - buf_page_optimistic_get() buffer-fixes - it again. */ - ut_ad(2 <= block->page.buf_fix_count()); - *latch_mode = mode; - return(true); - } else { - /* release the block and decrement of - buf_fix_count which was incremented - in buf_page_optimistic_get() */ - btr_leaf_page_release(block, mode, mtr); - } - } - - ut_ad(block->page.buf_fix_count()); - /* release the left block */ - if (cursor->left_block != NULL) { - btr_leaf_page_release(cursor->left_block, - mode, mtr); - } - } - - return false; -} - /** Gets intention in btr_intention_t from latch_mode, and cleares the intention at the latch_mode. @param latch_mode in/out: pointer to latch_mode @return intention for latching tree */ static -btr_intention_t -btr_cur_get_and_clear_intention( - ulint *latch_mode) +btr_intention_t btr_cur_get_and_clear_intention(btr_latch_mode *latch_mode) { btr_intention_t intention; @@ -866,41 +589,25 @@ btr_cur_get_and_clear_intention( /* both or unknown */ intention = BTR_INTENTION_BOTH; } - *latch_mode &= ulint(~(BTR_LATCH_FOR_INSERT | BTR_LATCH_FOR_DELETE)); + *latch_mode = btr_latch_mode( + *latch_mode & ~(BTR_LATCH_FOR_INSERT | BTR_LATCH_FOR_DELETE)); return(intention); } -/** -Gets the desired latch type for the root leaf (root page is root leaf) -at the latch mode. -@param latch_mode in: BTR_SEARCH_LEAF, ... -@return latch type */ -static -rw_lock_type_t -btr_cur_latch_for_root_leaf( - ulint latch_mode) +/** @return whether the distance between two records is at most the +specified value */ +static bool +page_rec_distance_is_at_most(const rec_t *left, const rec_t *right, ulint val) { - switch (latch_mode) { - case BTR_SEARCH_LEAF: - case BTR_SEARCH_TREE: - case BTR_SEARCH_PREV: - return(RW_S_LATCH); - case BTR_MODIFY_LEAF: - case BTR_MODIFY_TREE: - case BTR_MODIFY_PREV: - return(RW_X_LATCH); - case BTR_CONT_MODIFY_TREE: - case BTR_CONT_SEARCH_TREE: - /* A root page should be latched already, - and don't need to be latched here. - fall through (RW_NO_LATCH) */ - case BTR_NO_LATCHES: - return(RW_NO_LATCH); - } - - ut_error; - return(RW_NO_LATCH); /* avoid compiler warnings */ + do + { + if (left == right) + return true; + left= page_rec_get_next_const(left); + } + while (left && val--); + return false; } /** Detects whether the modifying record might need a modifying tree structure. @@ -1041,29 +748,40 @@ btr_cur_will_modify_tree( /** Detects whether the modifying record might need a opposite modification to the intention. -@param[in] page page -@param[in] lock_intention lock intention for the tree operation -@param[in] rec record (current node_ptr) -@return true if tree modification is needed */ -static -bool -btr_cur_need_opposite_intention( - const page_t* page, - btr_intention_t lock_intention, - const rec_t* rec) +@param bpage buffer pool page +@param is_clust whether this is a clustered index +@param lock_intention lock intention for the tree operation +@param node_ptr_max_size the maximum size of a node pointer +@param compress_limit BTR_CUR_PAGE_COMPRESS_LIMIT(index) +@param rec record (current node_ptr) +@return true if tree modification is needed */ +static bool btr_cur_need_opposite_intention(const buf_page_t &bpage, + bool is_clust, + btr_intention_t lock_intention, + ulint node_ptr_max_size, + ulint compress_limit, + const rec_t *rec) { - switch (lock_intention) { - case BTR_INTENTION_DELETE: - return (page_has_prev(page) && page_rec_is_first(rec, page)) || - (page_has_next(page) && page_rec_is_last(rec, page)); - case BTR_INTENTION_INSERT: - return page_has_next(page) && page_rec_is_last(rec, page); - case BTR_INTENTION_BOTH: - return(false); - } - - ut_error; - return(false); + if (UNIV_LIKELY_NULL(bpage.zip.data) && + !page_zip_available(&bpage.zip, is_clust, node_ptr_max_size, 1)) + return true; + const page_t *const page= bpage.frame; + if (lock_intention != BTR_INTENTION_INSERT) + { + /* We compensate also for btr_cur_compress_recommendation() */ + if (!page_has_siblings(page) || + page_rec_is_first(rec, page) || page_rec_is_last(rec, page) || + page_get_data_size(page) < node_ptr_max_size + compress_limit) + return true; + if (lock_intention == BTR_INTENTION_DELETE) + return false; + } + else if (page_has_next(page) && page_rec_is_last(rec, page)) + return true; + LIMIT_OPTIMISTIC_INSERT_DEBUG(page_get_n_recs(page), return true); + const ulint max_size= page_get_max_insert_size_after_reorganize(page, 2); + return max_size < BTR_CUR_PAGE_REORGANIZE_LIMIT + node_ptr_max_size || + max_size < node_ptr_max_size * 2; } /** @@ -1205,1935 +923,1147 @@ static ulint btr_node_ptr_max_size(const dict_index_t* index) return rec_max_size; } -/********************************************************************//** -Searches an index tree and positions a tree cursor on a given level. -NOTE: n_fields_cmp in tuple must be set so that it cannot be compared -to node pointer page number fields on the upper levels of the tree! -Note that if mode is PAGE_CUR_LE, which is used in inserts, then -cursor->up_match and cursor->low_match both will have sensible values. -If mode is PAGE_CUR_GE, then up_match will a have a sensible value. - -If mode is PAGE_CUR_LE , cursor is left at the place where an insert of the -search tuple should be performed in the B-tree. InnoDB does an insert -immediately after the cursor. Thus, the cursor may end up on a user record, -or on a page infimum record. */ -TRANSACTIONAL_TARGET -dberr_t -btr_cur_search_to_nth_level_func( - dict_index_t* index, /*!< in: index */ - ulint level, /*!< in: the tree level of search */ - const dtuple_t* tuple, /*!< in: data tuple; NOTE: n_fields_cmp in - tuple must be set so that it cannot get - compared to the node ptr page number field! */ - page_cur_mode_t mode, /*!< in: PAGE_CUR_L, ...; - Inserts should always be made using - PAGE_CUR_LE to search the position! */ - ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ..., ORed with - at most one of BTR_INSERT, BTR_DELETE_MARK, - BTR_DELETE, or BTR_ESTIMATE; - cursor->left_block is used to store a pointer - to the left neighbor page, in the cases - BTR_SEARCH_PREV and BTR_MODIFY_PREV; - NOTE that if ahi_latch, we might not have a - cursor page latch, we assume that ahi_latch - protects the record! */ - btr_cur_t* cursor, /*!< in/out: tree cursor; the cursor page is - s- or x-latched, but see also above! */ -#ifdef BTR_CUR_HASH_ADAPT - srw_spin_lock* ahi_latch, - /*!< in: currently held AHI rdlock, or NULL */ -#endif /* BTR_CUR_HASH_ADAPT */ - mtr_t* mtr, /*!< in: mtr */ - ib_uint64_t autoinc)/*!< in: PAGE_ROOT_AUTO_INC to be written - (0 if none) */ +/** @return a B-tree search mode suitable for non-leaf pages +@param mode leaf page search mode */ +static inline page_cur_mode_t btr_cur_nonleaf_mode(page_cur_mode_t mode) { - page_t* page = NULL; /* remove warning */ - buf_block_t* block; - buf_block_t* guess; - ulint height; - ulint up_match; - ulint up_bytes; - ulint low_match; - ulint low_bytes; - ulint rw_latch; - page_cur_mode_t page_mode; - page_cur_mode_t search_mode = PAGE_CUR_UNSUPP; - ulint buf_mode; - ulint estimate; - ulint node_ptr_max_size = srv_page_size / 2; - page_cur_t* page_cursor; - btr_op_t btr_op; - ulint root_height = 0; /* remove warning */ - dberr_t err = DB_SUCCESS; - - btr_intention_t lock_intention; - bool modify_external; - buf_block_t* tree_blocks[BTR_MAX_LEVELS]; - ulint tree_savepoints[BTR_MAX_LEVELS]; - ulint n_blocks = 0; - ulint n_releases = 0; - bool detected_same_key_root = false; - - ulint leftmost_from_level = 0; - buf_block_t** prev_tree_blocks = NULL; - ulint* prev_tree_savepoints = NULL; - ulint prev_n_blocks = 0; - ulint prev_n_releases = 0; - bool need_path = true; - bool rtree_parent_modified = false; - bool mbr_adj = false; - bool found = false; - - DBUG_ENTER("btr_cur_search_to_nth_level"); - -#ifdef BTR_CUR_ADAPT - btr_search_t* info; -#endif /* BTR_CUR_ADAPT */ - mem_heap_t* heap = NULL; - rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; - rec_offs* offsets = offsets_; - rec_offs offsets2_[REC_OFFS_NORMAL_SIZE]; - rec_offs* offsets2 = offsets2_; - rec_offs_init(offsets_); - rec_offs_init(offsets2_); - /* Currently, PAGE_CUR_LE is the only search mode used for searches - ending to upper levels */ - - ut_ad(level == 0 || mode == PAGE_CUR_LE - || RTREE_SEARCH_MODE(mode)); - ut_ad(dict_index_check_search_tuple(index, tuple)); - ut_ad(!dict_index_is_ibuf(index) || ibuf_inside(mtr)); - ut_ad(dtuple_check_typed(tuple)); - ut_ad(!(index->type & DICT_FTS)); - ut_ad(index->page != FIL_NULL); - - MEM_UNDEFINED(&cursor->up_match, sizeof cursor->up_match); - MEM_UNDEFINED(&cursor->up_bytes, sizeof cursor->up_bytes); - MEM_UNDEFINED(&cursor->low_match, sizeof cursor->low_match); - MEM_UNDEFINED(&cursor->low_bytes, sizeof cursor->low_bytes); -#ifdef UNIV_DEBUG - cursor->up_match = ULINT_UNDEFINED; - cursor->low_match = ULINT_UNDEFINED; -#endif /* UNIV_DEBUG */ - - ibool s_latch_by_caller; - - s_latch_by_caller = latch_mode & BTR_ALREADY_S_LATCHED; - - ut_ad(!s_latch_by_caller - || srv_read_only_mode - || mtr->memo_contains_flagged(&index->lock, MTR_MEMO_S_LOCK - | MTR_MEMO_SX_LOCK)); - - /* These flags are mutually exclusive, they are lumped together - with the latch mode for historical reasons. It's possible for - none of the flags to be set. */ - switch (UNIV_EXPECT(latch_mode - & (BTR_INSERT | BTR_DELETE | BTR_DELETE_MARK), - 0)) { - case 0: - btr_op = BTR_NO_OP; - break; - case BTR_INSERT: - btr_op = (latch_mode & BTR_IGNORE_SEC_UNIQUE) - ? BTR_INSERT_IGNORE_UNIQUE_OP - : BTR_INSERT_OP; - break; - case BTR_DELETE: - btr_op = BTR_DELETE_OP; - ut_a(cursor->purge_node); - break; - case BTR_DELETE_MARK: - btr_op = BTR_DELMARK_OP; - break; - default: - /* only one of BTR_INSERT, BTR_DELETE, BTR_DELETE_MARK - should be specified at a time */ - ut_error; - } - - /* Operations on the insert buffer tree cannot be buffered. */ - ut_ad(btr_op == BTR_NO_OP || !dict_index_is_ibuf(index)); - /* Operations on the clustered index cannot be buffered. */ - ut_ad(btr_op == BTR_NO_OP || !dict_index_is_clust(index)); - /* Operations on the temporary table(indexes) cannot be buffered. */ - ut_ad(btr_op == BTR_NO_OP || !index->table->is_temporary()); - /* Operation on the spatial index cannot be buffered. */ - ut_ad(btr_op == BTR_NO_OP || !dict_index_is_spatial(index)); - - estimate = latch_mode & BTR_ESTIMATE; - - lock_intention = btr_cur_get_and_clear_intention(&latch_mode); - - modify_external = latch_mode & BTR_MODIFY_EXTERNAL; - - /* Turn the flags unrelated to the latch mode off. */ - latch_mode = BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode); + if (mode > PAGE_CUR_GE) + { + ut_ad(mode == PAGE_CUR_L || mode == PAGE_CUR_LE); + return mode; + } + if (mode == PAGE_CUR_GE) + return PAGE_CUR_L; + ut_ad(mode == PAGE_CUR_G); + return PAGE_CUR_LE; +} - ut_ad(!modify_external || latch_mode == BTR_MODIFY_LEAF); +dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, + btr_latch_mode latch_mode, mtr_t *mtr) +{ + ut_ad(index()->is_btree() || index()->is_ibuf()); + ut_ad(!index()->is_ibuf() || ibuf_inside(mtr)); + + buf_block_t *guess; + btr_op_t btr_op; + btr_intention_t lock_intention; + bool detected_same_key_root= false; + + mem_heap_t* heap = NULL; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; + rec_offs offsets2_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets2 = offsets2_; + rec_offs_init(offsets_); + rec_offs_init(offsets2_); + + ut_ad(dict_index_check_search_tuple(index(), tuple)); + ut_ad(dtuple_check_typed(tuple)); + ut_ad(index()->page != FIL_NULL); + + MEM_UNDEFINED(&up_match, sizeof up_match); + MEM_UNDEFINED(&up_bytes, sizeof up_bytes); + MEM_UNDEFINED(&low_match, sizeof low_match); + MEM_UNDEFINED(&low_bytes, sizeof low_bytes); + ut_d(up_match= ULINT_UNDEFINED); + ut_d(low_match= ULINT_UNDEFINED); + + ut_ad(!(latch_mode & BTR_ALREADY_S_LATCHED) || + mtr->memo_contains_flagged(&index()->lock, + MTR_MEMO_S_LOCK | MTR_MEMO_SX_LOCK | + MTR_MEMO_X_LOCK)); + + /* These flags are mutually exclusive, they are lumped together + with the latch mode for historical reasons. It's possible for + none of the flags to be set. */ + switch (UNIV_EXPECT(latch_mode & BTR_DELETE, 0)) { + default: + btr_op= BTR_NO_OP; + break; + case BTR_INSERT: + btr_op= (latch_mode & BTR_IGNORE_SEC_UNIQUE) + ? BTR_INSERT_IGNORE_UNIQUE_OP + : BTR_INSERT_OP; + break; + case BTR_DELETE: + btr_op= BTR_DELETE_OP; + ut_a(purge_node); + break; + case BTR_DELETE_MARK: + btr_op= BTR_DELMARK_OP; + break; + } - ut_ad(!s_latch_by_caller - || latch_mode == BTR_SEARCH_LEAF - || latch_mode == BTR_SEARCH_TREE - || latch_mode == BTR_MODIFY_LEAF); + /* Operations on the insert buffer tree cannot be buffered. */ + ut_ad(btr_op == BTR_NO_OP || !index()->is_ibuf()); + /* Operations on the clustered index cannot be buffered. */ + ut_ad(btr_op == BTR_NO_OP || !index()->is_clust()); + /* Operations on the temporary table(indexes) cannot be buffered. */ + ut_ad(btr_op == BTR_NO_OP || !index()->table->is_temporary()); - ut_ad(autoinc == 0 || dict_index_is_clust(index)); - ut_ad(autoinc == 0 - || latch_mode == BTR_MODIFY_TREE - || latch_mode == BTR_MODIFY_LEAF); - ut_ad(autoinc == 0 || level == 0); + const bool latch_by_caller= latch_mode & BTR_ALREADY_S_LATCHED; + lock_intention= btr_cur_get_and_clear_intention(&latch_mode); + latch_mode= BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode); - cursor->flag = BTR_CUR_BINARY; - cursor->index = index; + ut_ad(!latch_by_caller + || latch_mode == BTR_SEARCH_LEAF + || latch_mode == BTR_MODIFY_LEAF + || latch_mode == BTR_MODIFY_TREE + || latch_mode == BTR_MODIFY_ROOT_AND_LEAF); + flag= BTR_CUR_BINARY; #ifndef BTR_CUR_ADAPT - guess = NULL; + guess= nullptr; #else - info = btr_search_get_info(index); - guess = info->root_guess; - -#ifdef BTR_CUR_HASH_ADAPT + btr_search_t *info= btr_search_get_info(index()); + guess= info->root_guess; + +# ifdef BTR_CUR_HASH_ADAPT +# ifdef UNIV_SEARCH_PERF_STAT + info->n_searches++; +# endif + bool ahi_enabled= btr_search_enabled && !index()->is_ibuf(); + /* We do a dirty read of btr_search_enabled below, + and btr_search_guess_on_hash() will have to check it again. */ + if (!ahi_enabled); + else if (btr_search_guess_on_hash(index(), info, tuple, mode, + latch_mode, this, mtr)) + { + /* Search using the hash index succeeded */ + ut_ad(up_match != ULINT_UNDEFINED || mode != PAGE_CUR_GE); + ut_ad(up_match != ULINT_UNDEFINED || mode != PAGE_CUR_LE); + ut_ad(low_match != ULINT_UNDEFINED || mode != PAGE_CUR_LE); + ++btr_cur_n_sea; -# ifdef UNIV_SEARCH_PERF_STAT - info->n_searches++; + return DB_SUCCESS; + } + else + ++btr_cur_n_non_sea; # endif - if (!btr_search_enabled) { - } else if (autoinc == 0 - && !estimate - && latch_mode <= BTR_MODIFY_LEAF - && !modify_external - /* If !ahi_latch, we do a dirty read of - btr_search_enabled below, and btr_search_guess_on_hash() - will have to check it again. */ - && btr_search_enabled -# ifdef PAGE_CUR_LE_OR_EXTENDS - && mode != PAGE_CUR_LE_OR_EXTENDS -# endif /* PAGE_CUR_LE_OR_EXTENDS */ - && info->last_hash_succ - && !(tuple->info_bits & REC_INFO_MIN_REC_FLAG) - && !index->is_spatial() && !index->table->is_temporary() - && btr_search_guess_on_hash(index, info, tuple, mode, - latch_mode, cursor, - ahi_latch, mtr)) { - - /* Search using the hash index succeeded */ - - ut_ad(cursor->up_match != ULINT_UNDEFINED - || mode != PAGE_CUR_GE); - ut_ad(cursor->up_match != ULINT_UNDEFINED - || mode != PAGE_CUR_LE); - ut_ad(cursor->low_match != ULINT_UNDEFINED - || mode != PAGE_CUR_LE); - ++btr_cur_n_sea; - - DBUG_RETURN(err); - } else { - ++btr_cur_n_non_sea; - } -# endif /* BTR_CUR_HASH_ADAPT */ -#endif /* BTR_CUR_ADAPT */ - - /* If the hash search did not succeed, do binary search down the - tree */ - -#ifdef BTR_CUR_HASH_ADAPT - if (ahi_latch) { - /* Release possible search latch to obey latching order */ - ahi_latch->rd_unlock(); - } -#endif /* BTR_CUR_HASH_ADAPT */ - - /* Store the position of the tree latch we push to mtr so that we - know how to release it when we have latched leaf node(s) */ - - ulint savepoint = mtr_set_savepoint(mtr); - - rw_lock_type_t upper_rw_latch; - - switch (latch_mode) { - case BTR_MODIFY_TREE: - /* Most of delete-intended operations are purging. - Free blocks and read IO bandwidth should be prior - for them, when the history list is glowing huge. */ - if (lock_intention == BTR_INTENTION_DELETE - && buf_pool.n_pend_reads - && trx_sys.history_size_approx() - > BTR_CUR_FINE_HISTORY_LENGTH) { -x_latch_index: - mtr_x_lock_index(index, mtr); - } else if (index->is_spatial() - && lock_intention <= BTR_INTENTION_BOTH) { - /* X lock the if there is possibility of - pessimistic delete on spatial index. As we could - lock upward for the tree */ - goto x_latch_index; - } else { - mtr_sx_lock_index(index, mtr); - } - upper_rw_latch = RW_X_LATCH; - break; - case BTR_CONT_MODIFY_TREE: - ut_ad(srv_read_only_mode - || mtr->memo_contains_flagged(&index->lock, - MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK)); - if (index->is_spatial()) { - /* If we are about to locate parent page for split - and/or merge operation for R-Tree index, X latch - the parent */ - upper_rw_latch = RW_X_LATCH; - break; - } - /* fall through */ - case BTR_CONT_SEARCH_TREE: - /* Do nothing */ - ut_ad(srv_read_only_mode - || mtr->memo_contains_flagged(&index->lock, - MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK)); - upper_rw_latch = RW_NO_LATCH; - break; - default: - if (!srv_read_only_mode) { - if (s_latch_by_caller) { - } else if (!modify_external) { - /* BTR_SEARCH_TREE is intended to be used with - BTR_ALREADY_S_LATCHED */ - ut_ad(latch_mode != BTR_SEARCH_TREE); - - mtr_s_lock_index(index, mtr); - } else { - /* BTR_MODIFY_EXTERNAL needs to be excluded */ - mtr_sx_lock_index(index, mtr); - } - upper_rw_latch = RW_S_LATCH; - } else { - upper_rw_latch = RW_NO_LATCH; - } - } - const rw_lock_type_t root_leaf_rw_latch = btr_cur_latch_for_root_leaf( - latch_mode); - - page_cursor = btr_cur_get_page_cur(cursor); - - const ulint zip_size = index->table->space->zip_size(); - - /* Start with the root page. */ - page_id_t page_id(index->table->space_id, index->page); - - if (root_leaf_rw_latch == RW_X_LATCH) { - node_ptr_max_size = btr_node_ptr_max_size(index); - } - - up_match = 0; - up_bytes = 0; - low_match = 0; - low_bytes = 0; - - height = ULINT_UNDEFINED; - - /* We use these modified search modes on non-leaf levels of the - B-tree. These let us end up in the right B-tree leaf. In that leaf - we use the original search mode. */ - - switch (mode) { - case PAGE_CUR_GE: - page_mode = PAGE_CUR_L; - break; - case PAGE_CUR_G: - page_mode = PAGE_CUR_LE; - break; - default: -#ifdef PAGE_CUR_LE_OR_EXTENDS - ut_ad(mode == PAGE_CUR_L || mode == PAGE_CUR_LE - || RTREE_SEARCH_MODE(mode) - || mode == PAGE_CUR_LE_OR_EXTENDS); -#else /* PAGE_CUR_LE_OR_EXTENDS */ - ut_ad(mode == PAGE_CUR_L || mode == PAGE_CUR_LE - || RTREE_SEARCH_MODE(mode)); -#endif /* PAGE_CUR_LE_OR_EXTENDS */ - page_mode = mode; - break; - } - - /* Loop and search until we arrive at the desired level */ - btr_latch_leaves_t latch_leaves = {{NULL, NULL, NULL}, {0, 0, 0}}; - -search_loop: - buf_mode = BUF_GET; - rw_latch = RW_NO_LATCH; - rtree_parent_modified = false; - - if (height != 0) { - /* We are about to fetch the root or a non-leaf page. */ - if ((latch_mode != BTR_MODIFY_TREE || height == level) - && !prev_tree_blocks) { - /* If doesn't have SX or X latch of index, - each pages should be latched before reading. */ - if (height == ULINT_UNDEFINED - && upper_rw_latch == RW_S_LATCH - && (modify_external || autoinc)) { - /* needs sx-latch of root page - for fseg operation or for writing - PAGE_ROOT_AUTO_INC */ - rw_latch = RW_SX_LATCH; - } else { - rw_latch = upper_rw_latch; - } - } - } else if (latch_mode <= BTR_MODIFY_LEAF) { - rw_latch = latch_mode; - - if (btr_op != BTR_NO_OP - && ibuf_should_try(index, btr_op != BTR_INSERT_OP)) { - - /* Try to buffer the operation if the leaf - page is not in the buffer pool. */ - - buf_mode = btr_op == BTR_DELETE_OP - ? BUF_GET_IF_IN_POOL_OR_WATCH - : BUF_GET_IF_IN_POOL; - } - } - -retry_page_get: - ut_ad(n_blocks < BTR_MAX_LEVELS); - tree_savepoints[n_blocks] = mtr_set_savepoint(mtr); - block = buf_page_get_gen(page_id, zip_size, rw_latch, guess, - buf_mode, mtr, &err, - height == 0 && !index->is_clust()); - tree_blocks[n_blocks] = block; - - /* Note that block==NULL signifies either an error or change - buffering. */ - - if (err != DB_SUCCESS) { - ut_ad(block == NULL); - if (err == DB_DECRYPTION_FAILED) { - ib_push_warning((void *)NULL, - DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name.m_name); - index->table->file_unreadable = true; - } - - goto func_exit; - } - - if (block == NULL) { - /* This must be a search to perform an insert/delete - mark/ delete; try using the insert/delete buffer */ - - ut_ad(height == 0); - ut_ad(cursor->thr); - - switch (btr_op) { - default: - ut_error; - break; - case BTR_INSERT_OP: - case BTR_INSERT_IGNORE_UNIQUE_OP: - ut_ad(buf_mode == BUF_GET_IF_IN_POOL); - ut_ad(!dict_index_is_spatial(index)); - - if (ibuf_insert(IBUF_OP_INSERT, tuple, index, - page_id, zip_size, cursor->thr)) { - - cursor->flag = BTR_CUR_INSERT_TO_IBUF; - - goto func_exit; - } - break; - - case BTR_DELMARK_OP: - ut_ad(buf_mode == BUF_GET_IF_IN_POOL); - ut_ad(!dict_index_is_spatial(index)); - - if (ibuf_insert(IBUF_OP_DELETE_MARK, tuple, - index, page_id, zip_size, - cursor->thr)) { - - cursor->flag = BTR_CUR_DEL_MARK_IBUF; - - goto func_exit; - } - - break; - - case BTR_DELETE_OP: - ut_ad(buf_mode == BUF_GET_IF_IN_POOL_OR_WATCH); - ut_ad(!dict_index_is_spatial(index)); - auto& chain = buf_pool.page_hash.cell_get( - page_id.fold()); - - if (!row_purge_poss_sec(cursor->purge_node, - index, tuple)) { - - /* The record cannot be purged yet. */ - cursor->flag = BTR_CUR_DELETE_REF; - } else if (ibuf_insert(IBUF_OP_DELETE, tuple, - index, page_id, zip_size, - cursor->thr)) { - - /* The purge was buffered. */ - cursor->flag = BTR_CUR_DELETE_IBUF; - } else { - /* The purge could not be buffered. */ - buf_pool.watch_unset(page_id, chain); - break; - } - - buf_pool.watch_unset(page_id, chain); - goto func_exit; - } - - /* Insert to the insert/delete buffer did not succeed, we - must read the page from disk. */ - - buf_mode = BUF_GET; - - goto retry_page_get; - } - - if (height && prev_tree_blocks) { - /* also latch left sibling */ - buf_block_t* get_block; - - ut_ad(rw_latch == RW_NO_LATCH); - - rw_latch = upper_rw_latch; - - /* Because we are holding index->lock, no page splits - or merges may run concurrently, and we may read - FIL_PAGE_PREV from a buffer-fixed, unlatched page. */ - uint32_t left_page_no = btr_page_get_prev(block->page.frame); - - if (left_page_no != FIL_NULL) { - ut_ad(prev_n_blocks < leftmost_from_level); - - prev_tree_savepoints[prev_n_blocks] - = mtr_set_savepoint(mtr); - get_block = buf_page_get_gen( - page_id_t(page_id.space(), left_page_no), - zip_size, rw_latch, NULL, buf_mode, - mtr, &err); - prev_tree_blocks[prev_n_blocks] = get_block; - prev_n_blocks++; - - if (err != DB_SUCCESS) { - if (err == DB_DECRYPTION_FAILED) { - ib_push_warning((void *)NULL, - DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name.m_name); - index->table->file_unreadable = true; - } +#endif - goto func_exit; - } + /* If the hash search did not succeed, do binary search down the + tree */ - /* BTR_MODIFY_TREE doesn't update prev/next_page_no, - without their parent page's lock. So, not needed to - retry here, because we have the parent page's lock. */ - } + /* Store the position of the tree latch we push to mtr so that we + know how to release it when we have latched leaf node(s) */ - /* release RW_NO_LATCH page and lock with RW_S_LATCH */ - mtr_release_block_at_savepoint( - mtr, tree_savepoints[n_blocks], - tree_blocks[n_blocks]); + const ulint savepoint= mtr->get_savepoint(); - tree_savepoints[n_blocks] = mtr_set_savepoint(mtr); - block = buf_page_get_gen(page_id, zip_size, - rw_latch, NULL, buf_mode, mtr, &err); - tree_blocks[n_blocks] = block; + ulint node_ptr_max_size= 0, compress_limit= 0; + rw_lock_type_t rw_latch= RW_S_LATCH; - if (err != DB_SUCCESS) { - if (err == DB_DECRYPTION_FAILED) { - ib_push_warning((void *)NULL, - DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name.m_name); - index->table->file_unreadable = true; - } + switch (latch_mode) { + case BTR_MODIFY_TREE: + rw_latch= RW_X_LATCH; + node_ptr_max_size= btr_node_ptr_max_size(index()); + if (latch_by_caller) + { + ut_ad(mtr->memo_contains_flagged(&index()->lock, MTR_MEMO_X_LOCK)); + break; + } + if (lock_intention == BTR_INTENTION_DELETE) + { + compress_limit= BTR_CUR_PAGE_COMPRESS_LIMIT(index()); + if (os_aio_pending_reads_approx() && + trx_sys.history_size_approx() > BTR_CUR_FINE_HISTORY_LENGTH) + { + /* Most delete-intended operations are due to the purge of history. + Prioritize them when the history list is growing huge. */ + mtr_x_lock_index(index(), mtr); + break; + } + } + mtr_sx_lock_index(index(), mtr); + break; +#ifdef UNIV_DEBUG + case BTR_CONT_MODIFY_TREE: + ut_ad("invalid mode" == 0); + break; +#endif + case BTR_MODIFY_ROOT_AND_LEAF: + rw_latch= RW_SX_LATCH; + /* fall through */ + default: + if (!latch_by_caller) + mtr_s_lock_index(index(), mtr); + } - goto func_exit; - } - } - - page = buf_block_get_frame(block); - - if (height == ULINT_UNDEFINED - && page_is_leaf(page) - && rw_latch != RW_NO_LATCH - && rw_latch != root_leaf_rw_latch) { - /* The root page is also a leaf page (root_leaf). - We should reacquire the page, because the root page - is latched differently from leaf pages. */ - ut_ad(root_leaf_rw_latch != RW_NO_LATCH); - ut_ad(rw_latch == RW_S_LATCH || rw_latch == RW_SX_LATCH); - ut_ad(rw_latch == RW_S_LATCH || modify_external || autoinc); - ut_ad(!autoinc || root_leaf_rw_latch == RW_X_LATCH); - - ut_ad(n_blocks == 0); - mtr_release_block_at_savepoint( - mtr, tree_savepoints[n_blocks], - tree_blocks[n_blocks]); - - upper_rw_latch = root_leaf_rw_latch; - goto search_loop; - } - -#ifdef UNIV_ZIP_DEBUG - if (rw_latch != RW_NO_LATCH) { - const page_zip_des_t* page_zip - = buf_block_get_page_zip(block); - ut_a(!page_zip || page_zip_validate(page_zip, page, index)); - } -#endif /* UNIV_ZIP_DEBUG */ - - ut_ad(fil_page_index_page_check(page)); - ut_ad(index->id == btr_page_get_index_id(page)); - - if (height == ULINT_UNDEFINED) { - /* We are in the root node */ - - height = btr_page_get_level(page); - root_height = height; - cursor->tree_height = root_height + 1; - - if (dict_index_is_spatial(index)) { - ut_ad(cursor->rtr_info); - - /* If SSN in memory is not initialized, fetch - it from root page */ - if (!rtr_get_current_ssn_id(index)) { - /* FIXME: do this in dict_load_table_one() */ - index->set_ssn(page_get_ssn_id(page) + 1); - } - - /* Save the MBR */ - cursor->rtr_info->thr = cursor->thr; - rtr_get_mbr_from_tuple(tuple, &cursor->rtr_info->mbr); - } - -#ifdef BTR_CUR_ADAPT - info->root_guess = block; -#endif - } - - if (height == 0) { - if (rw_latch == RW_NO_LATCH) { - latch_leaves = btr_cur_latch_leaves( - block, latch_mode, cursor, mtr); - } - - switch (latch_mode) { - case BTR_MODIFY_TREE: - case BTR_CONT_MODIFY_TREE: - case BTR_CONT_SEARCH_TREE: - break; - default: - if (!s_latch_by_caller - && !srv_read_only_mode - && !modify_external) { - /* Release the tree s-latch */ - /* NOTE: BTR_MODIFY_EXTERNAL - needs to keep tree sx-latch */ - mtr_release_s_latch_at_savepoint( - mtr, savepoint, - &index->lock); - } - - /* release upper blocks */ - if (prev_tree_blocks) { - ut_ad(!autoinc); - for (; - prev_n_releases < prev_n_blocks; - prev_n_releases++) { - mtr_release_block_at_savepoint( - mtr, - prev_tree_savepoints[ - prev_n_releases], - prev_tree_blocks[ - prev_n_releases]); - } - } - - for (; n_releases < n_blocks; n_releases++) { - if (n_releases == 0 - && (modify_external || autoinc)) { - /* keep the root page latch */ - ut_ad(mtr->memo_contains_flagged( - tree_blocks[n_releases], - MTR_MEMO_PAGE_SX_FIX - | MTR_MEMO_PAGE_X_FIX)); - continue; - } - - mtr_release_block_at_savepoint( - mtr, tree_savepoints[n_releases], - tree_blocks[n_releases]); - } - } - - page_mode = mode; - } - - if (dict_index_is_spatial(index)) { - /* Remember the page search mode */ - search_mode = page_mode; - - /* Some adjustment on search mode, when the - page search mode is PAGE_CUR_RTREE_LOCATE - or PAGE_CUR_RTREE_INSERT, as we are searching - with MBRs. When it is not the target level, we - should search all sub-trees that "CONTAIN" the - search range/MBR. When it is at the target - level, the search becomes PAGE_CUR_LE */ - if (page_mode == PAGE_CUR_RTREE_LOCATE - && level == height) { - if (level == 0) { - page_mode = PAGE_CUR_LE; - } else { - page_mode = PAGE_CUR_RTREE_GET_FATHER; - } - } - - if (page_mode == PAGE_CUR_RTREE_INSERT) { - page_mode = (level == height) - ? PAGE_CUR_LE - : PAGE_CUR_RTREE_INSERT; - - ut_ad(!page_is_leaf(page) || page_mode == PAGE_CUR_LE); - } - - /* "need_path" indicates if we need to tracking the parent - pages, if it is not spatial comparison, then no need to - track it */ - if (page_mode < PAGE_CUR_CONTAIN) { - need_path = false; - } - - up_match = 0; - low_match = 0; - - if (latch_mode == BTR_MODIFY_TREE - || latch_mode == BTR_CONT_MODIFY_TREE - || latch_mode == BTR_CONT_SEARCH_TREE) { - /* Tree are locked, no need for Page Lock to protect - the "path" */ - cursor->rtr_info->need_page_lock = false; - } - } - - if (dict_index_is_spatial(index) && page_mode >= PAGE_CUR_CONTAIN) { - ut_ad(need_path); - found = rtr_cur_search_with_match( - block, index, tuple, page_mode, page_cursor, - cursor->rtr_info); - - /* Need to use BTR_MODIFY_TREE to do the MBR adjustment */ - if (search_mode == PAGE_CUR_RTREE_INSERT - && cursor->rtr_info->mbr_adj) { - if (latch_mode & BTR_MODIFY_LEAF) { - /* Parent MBR needs updated, should retry - with BTR_MODIFY_TREE */ - goto func_exit; - } else if (latch_mode & BTR_MODIFY_TREE) { - rtree_parent_modified = true; - cursor->rtr_info->mbr_adj = false; - mbr_adj = true; - } else { - ut_ad(0); - } - } - - if (found && page_mode == PAGE_CUR_RTREE_GET_FATHER) { - cursor->low_match = - DICT_INDEX_SPATIAL_NODEPTR_SIZE + 1; - } -#ifdef BTR_CUR_HASH_ADAPT - } else if (height == 0 && btr_search_enabled - && !(tuple->info_bits & REC_INFO_MIN_REC_FLAG) - && !dict_index_is_spatial(index)) { - /* The adaptive hash index is only used when searching - for leaf pages (height==0), but not in r-trees. - We only need the byte prefix comparison for the purpose - of updating the adaptive hash index. */ - page_cur_search_with_match_bytes( - block, index, tuple, page_mode, &up_match, &up_bytes, - &low_match, &low_bytes, page_cursor); -#endif /* BTR_CUR_HASH_ADAPT */ - } else { - /* Search for complete index fields. */ - up_bytes = low_bytes = 0; - page_cur_search_with_match( - block, index, tuple, page_mode, &up_match, - &low_match, page_cursor, - need_path ? cursor->rtr_info : NULL); - } - - if (estimate) { - btr_cur_add_path_info(cursor, height, root_height); - } - - /* If this is the desired level, leave the loop */ - - ut_ad(height == btr_page_get_level(page_cur_get_page(page_cursor))); - - /* Add Predicate lock if it is serializable isolation - and only if it is in the search case */ - if (dict_index_is_spatial(index) - && cursor->rtr_info->need_prdt_lock - && mode != PAGE_CUR_RTREE_INSERT - && mode != PAGE_CUR_RTREE_LOCATE - && mode >= PAGE_CUR_CONTAIN) { - lock_prdt_t prdt; - - { - trx_t* trx = thr_get_trx(cursor->thr); - TMLockTrxGuard g{TMLockTrxArgs(*trx)}; - lock_init_prdt_from_mbr( - &prdt, &cursor->rtr_info->mbr, mode, - trx->lock.lock_heap); - } - - if (rw_latch == RW_NO_LATCH && height != 0) { - block->page.lock.s_lock(); - } - - lock_prdt_lock(block, &prdt, index, LOCK_S, - LOCK_PREDICATE, cursor->thr); - - if (rw_latch == RW_NO_LATCH && height != 0) { - block->page.lock.s_unlock(); - } - } - - if (level != height) { - - const rec_t* node_ptr; - ut_ad(height > 0); - - height--; - guess = NULL; - - node_ptr = page_cur_get_rec(page_cursor); - - offsets = rec_get_offsets(node_ptr, index, offsets, 0, - ULINT_UNDEFINED, &heap); - - /* If the rec is the first or last in the page for - pessimistic delete intention, it might cause node_ptr insert - for the upper level. We should change the intention and retry. - */ - if (latch_mode == BTR_MODIFY_TREE - && btr_cur_need_opposite_intention( - page, lock_intention, node_ptr)) { - -need_opposite_intention: - ut_ad(upper_rw_latch == RW_X_LATCH); - - if (n_releases > 0) { - /* release root block */ - mtr_release_block_at_savepoint( - mtr, tree_savepoints[0], - tree_blocks[0]); - } - - /* release all blocks */ - for (; n_releases <= n_blocks; n_releases++) { - mtr_release_block_at_savepoint( - mtr, tree_savepoints[n_releases], - tree_blocks[n_releases]); - } - - lock_intention = BTR_INTENTION_BOTH; - - page_id.set_page_no(index->page); - up_match = 0; - low_match = 0; - height = ULINT_UNDEFINED; - - n_blocks = 0; - n_releases = 0; - - goto search_loop; - } - - if (dict_index_is_spatial(index)) { - if (page_rec_is_supremum(node_ptr)) { - cursor->low_match = 0; - cursor->up_match = 0; - goto func_exit; - } - - /* If we are doing insertion or record locating, - remember the tree nodes we visited */ - if (page_mode == PAGE_CUR_RTREE_INSERT - || (search_mode == PAGE_CUR_RTREE_LOCATE - && (latch_mode != BTR_MODIFY_LEAF))) { - bool add_latch = false; - - if (latch_mode == BTR_MODIFY_TREE - && rw_latch == RW_NO_LATCH) { - ut_ad(mtr->memo_contains_flagged( - &index->lock, MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK)); - block->page.lock.s_lock(); - add_latch = true; - } - - /* Store the parent cursor location */ -#ifdef UNIV_DEBUG - ulint num_stored = rtr_store_parent_path( - block, cursor, latch_mode, - height + 1, mtr); -#else - rtr_store_parent_path( - block, cursor, latch_mode, - height + 1, mtr); -#endif - - if (page_mode == PAGE_CUR_RTREE_INSERT) { - btr_pcur_t* r_cursor = - rtr_get_parent_cursor( - cursor, height + 1, - true); - /* If it is insertion, there should - be only one parent for each level - traverse */ -#ifdef UNIV_DEBUG - ut_ad(num_stored == 1); -#endif - - node_ptr = btr_pcur_get_rec(r_cursor); - - } - - if (add_latch) { - block->page.lock.s_unlock(); - } - - ut_ad(!page_rec_is_supremum(node_ptr)); - } - - ut_ad(page_mode == search_mode - || (page_mode == PAGE_CUR_WITHIN - && search_mode == PAGE_CUR_RTREE_LOCATE)); - - page_mode = search_mode; - } - - /* If the first or the last record of the page - or the same key value to the first record or last record, - the another page might be chosen when BTR_CONT_MODIFY_TREE. - So, the parent page should not released to avoiding deadlock - with blocking the another search with the same key value. */ - if (!detected_same_key_root - && lock_intention == BTR_INTENTION_BOTH - && !dict_index_is_unique(index) - && latch_mode == BTR_MODIFY_TREE - && (up_match >= rec_offs_n_fields(offsets) - 1 - || low_match >= rec_offs_n_fields(offsets) - 1)) { - const rec_t* first_rec = page_rec_get_next_const( - page_get_infimum_rec(page)); - ulint matched_fields; - - ut_ad(upper_rw_latch == RW_X_LATCH); - - if (node_ptr == first_rec - || page_rec_is_last(node_ptr, page)) { - detected_same_key_root = true; - } else { - matched_fields = 0; - - offsets2 = rec_get_offsets( - first_rec, index, offsets2, - 0, ULINT_UNDEFINED, &heap); - cmp_rec_rec(node_ptr, first_rec, - offsets, offsets2, index, false, - &matched_fields); - - if (matched_fields - >= rec_offs_n_fields(offsets) - 1) { - detected_same_key_root = true; - } else { - const rec_t* last_rec; - - last_rec = page_rec_get_prev_const( - page_get_supremum_rec(page)); - - matched_fields = 0; - - offsets2 = rec_get_offsets( - last_rec, index, offsets2, - 0, ULINT_UNDEFINED, &heap); - cmp_rec_rec( - node_ptr, last_rec, - offsets, offsets2, index, - false, &matched_fields); - if (matched_fields - >= rec_offs_n_fields(offsets) - 1) { - detected_same_key_root = true; - } - } - } - } - - /* If the page might cause modify_tree, - we should not release the parent page's lock. */ - if (!detected_same_key_root - && latch_mode == BTR_MODIFY_TREE - && !btr_cur_will_modify_tree( - index, page, lock_intention, node_ptr, - node_ptr_max_size, zip_size, mtr) - && !rtree_parent_modified) { - ut_ad(upper_rw_latch == RW_X_LATCH); - ut_ad(n_releases <= n_blocks); - - /* we can release upper blocks */ - for (; n_releases < n_blocks; n_releases++) { - if (n_releases == 0) { - /* we should not release root page - to pin to same block. */ - continue; - } - - /* release unused blocks to unpin */ - mtr_release_block_at_savepoint( - mtr, tree_savepoints[n_releases], - tree_blocks[n_releases]); - } - } - - if (height == level - && latch_mode == BTR_MODIFY_TREE) { - ut_ad(upper_rw_latch == RW_X_LATCH); - /* we should sx-latch root page, if released already. - It contains seg_header. */ - if (n_releases > 0) { - mtr_block_sx_latch_at_savepoint( - mtr, tree_savepoints[0], - tree_blocks[0]); - } - - /* x-latch the branch blocks not released yet. */ - for (ulint i = n_releases; i <= n_blocks; i++) { - mtr_block_x_latch_at_savepoint( - mtr, tree_savepoints[i], - tree_blocks[i]); - } - } - - /* We should consider prev_page of parent page, if the node_ptr - is the leftmost of the page. because BTR_SEARCH_PREV and - BTR_MODIFY_PREV latches prev_page of the leaf page. */ - if ((latch_mode == BTR_SEARCH_PREV - || latch_mode == BTR_MODIFY_PREV) - && !prev_tree_blocks) { - /* block should be latched for consistent - btr_page_get_prev() */ - ut_ad(mtr->memo_contains_flagged( - block, MTR_MEMO_PAGE_S_FIX - | MTR_MEMO_PAGE_X_FIX)); - - if (page_has_prev(page) - && page_rec_is_first(node_ptr, page)) { - - if (leftmost_from_level == 0) { - leftmost_from_level = height + 1; - } - } else { - leftmost_from_level = 0; - } - - if (height == 0 && leftmost_from_level > 0) { - /* should retry to get also prev_page - from level==leftmost_from_level. */ - prev_tree_blocks = static_cast( - ut_malloc_nokey(sizeof(buf_block_t*) - * leftmost_from_level)); - - prev_tree_savepoints = static_cast( - ut_malloc_nokey(sizeof(ulint) - * leftmost_from_level)); - - /* back to the level (leftmost_from_level+1) */ - ulint idx = n_blocks - - (leftmost_from_level - 1); - - page_id.set_page_no( - tree_blocks[idx]->page.id().page_no()); - - for (ulint i = n_blocks - - (leftmost_from_level - 1); - i <= n_blocks; i++) { - mtr_release_block_at_savepoint( - mtr, tree_savepoints[i], - tree_blocks[i]); - } - - n_blocks -= (leftmost_from_level - 1); - height = leftmost_from_level; - ut_ad(n_releases == 0); - - /* replay up_match, low_match */ - up_match = 0; - low_match = 0; - rtr_info_t* rtr_info = need_path - ? cursor->rtr_info : NULL; - - for (ulint i = 0; i < n_blocks; i++) { - page_cur_search_with_match( - tree_blocks[i], index, tuple, - page_mode, &up_match, - &low_match, page_cursor, - rtr_info); - } - - goto search_loop; - } - } - - /* Go to the child node */ - page_id.set_page_no( - btr_node_ptr_get_child_page_no(node_ptr, offsets)); - - n_blocks++; - - if (UNIV_UNLIKELY(height == 0 && dict_index_is_ibuf(index))) { - /* We're doing a search on an ibuf tree and we're one - level above the leaf page. */ - - ut_ad(level == 0); - - buf_mode = BUF_GET; - rw_latch = RW_NO_LATCH; - goto retry_page_get; - } - - if (dict_index_is_spatial(index) - && page_mode >= PAGE_CUR_CONTAIN - && page_mode != PAGE_CUR_RTREE_INSERT) { - ut_ad(need_path); - rtr_node_path_t* path = - cursor->rtr_info->path; - - if (!path->empty() && found) { - ut_ad(path->back().page_no - == page_id.page_no()); - path->pop_back(); -#ifdef UNIV_DEBUG - if (page_mode == PAGE_CUR_RTREE_LOCATE - && (latch_mode != BTR_MODIFY_LEAF)) { - btr_pcur_t* cur - = cursor->rtr_info->parent_path->back( - ).cursor; - rec_t* my_node_ptr - = btr_pcur_get_rec(cur); - - offsets = rec_get_offsets( - my_node_ptr, index, offsets, - 0, ULINT_UNDEFINED, &heap); - - ulint my_page_no - = btr_node_ptr_get_child_page_no( - my_node_ptr, offsets); - - ut_ad(page_id.page_no() == my_page_no); - } -#endif - } - } - - goto search_loop; - } else if (!dict_index_is_spatial(index) - && latch_mode == BTR_MODIFY_TREE - && lock_intention == BTR_INTENTION_INSERT - && page_has_next(page) - && page_rec_is_last(page_cur_get_rec(page_cursor), page)) { - - /* btr_insert_into_right_sibling() might cause - deleting node_ptr at upper level */ - - guess = NULL; - - if (height == 0) { - /* release the leaf pages if latched */ - for (uint i = 0; i < 3; i++) { - if (latch_leaves.blocks[i] != NULL) { - mtr_release_block_at_savepoint( - mtr, latch_leaves.savepoints[i], - latch_leaves.blocks[i]); - latch_leaves.blocks[i] = NULL; - } - } - } - - goto need_opposite_intention; - } - - if (level != 0) { - ut_ad(!autoinc); - - if (upper_rw_latch == RW_NO_LATCH) { - ut_ad(latch_mode == BTR_CONT_MODIFY_TREE - || latch_mode == BTR_CONT_SEARCH_TREE); - buf_block_t* child_block = btr_block_get( - *index, page_id.page_no(), - latch_mode == BTR_CONT_MODIFY_TREE - ? RW_X_LATCH : RW_SX_LATCH, false, mtr); - btr_assert_not_corrupted(child_block, index); - } else { - ut_ad(mtr->memo_contains_flagged(block, - upper_rw_latch)); - btr_assert_not_corrupted(block, index); - - if (s_latch_by_caller) { - ut_ad(latch_mode == BTR_SEARCH_TREE); - /* to exclude modifying tree operations - should sx-latch the index. */ - ut_ad(mtr->memo_contains(index->lock, - MTR_MEMO_SX_LOCK)); - /* because has sx-latch of index, - can release upper blocks. */ - for (; n_releases < n_blocks; n_releases++) { - mtr_release_block_at_savepoint( - mtr, - tree_savepoints[n_releases], - tree_blocks[n_releases]); - } - } - } - - if (page_mode <= PAGE_CUR_LE) { - cursor->low_match = low_match; - cursor->up_match = up_match; - } - } else { - cursor->low_match = low_match; - cursor->low_bytes = low_bytes; - cursor->up_match = up_match; - cursor->up_bytes = up_bytes; - - if (autoinc) { - page_set_autoinc(tree_blocks[0], autoinc, mtr, false); - } - -#ifdef BTR_CUR_HASH_ADAPT - /* We do a dirty read of btr_search_enabled here. We - will properly check btr_search_enabled again in - btr_search_build_page_hash_index() before building a - page hash index, while holding search latch. */ - if (!btr_search_enabled) { - } else if (tuple->info_bits & REC_INFO_MIN_REC_FLAG) { - ut_ad(index->is_instant()); - /* This may be a search tuple for - btr_pcur_restore_position(). */ - ut_ad(tuple->is_metadata() - || (tuple->is_metadata(tuple->info_bits - ^ REC_STATUS_INSTANT))); - } else if (index->is_spatial()) { - } else if (index->table->is_temporary()) { - } else if (rec_is_metadata(btr_cur_get_rec(cursor), *index)) { - /* Only user records belong in the adaptive - hash index. */ - } else { - btr_search_info_update(index, cursor); - } -#endif /* BTR_CUR_HASH_ADAPT */ - ut_ad(cursor->up_match != ULINT_UNDEFINED - || mode != PAGE_CUR_GE); - ut_ad(cursor->up_match != ULINT_UNDEFINED - || mode != PAGE_CUR_LE); - ut_ad(cursor->low_match != ULINT_UNDEFINED - || mode != PAGE_CUR_LE); - } - - /* For spatial index, remember what blocks are still latched */ - if (dict_index_is_spatial(index) - && (latch_mode == BTR_MODIFY_TREE - || latch_mode == BTR_MODIFY_LEAF)) { - for (ulint i = 0; i < n_releases; i++) { - cursor->rtr_info->tree_blocks[i] = NULL; - cursor->rtr_info->tree_savepoints[i] = 0; - } - - for (ulint i = n_releases; i <= n_blocks; i++) { - cursor->rtr_info->tree_blocks[i] = tree_blocks[i]; - cursor->rtr_info->tree_savepoints[i] = tree_savepoints[i]; - } - } - -func_exit: - - if (UNIV_LIKELY_NULL(heap)) { - mem_heap_free(heap); - } - - ut_free(prev_tree_blocks); - ut_free(prev_tree_savepoints); - - if (mbr_adj) { - /* remember that we will need to adjust parent MBR */ - cursor->rtr_info->mbr_adj = true; - } - -#ifdef BTR_CUR_HASH_ADAPT - if (ahi_latch) { - ahi_latch->rd_lock(SRW_LOCK_CALL); - } -#endif /* BTR_CUR_HASH_ADAPT */ - - DBUG_RETURN(err); -} - -/*****************************************************************//** -Opens a cursor at either end of an index. */ -dberr_t -btr_cur_open_at_index_side( - bool from_left, /*!< in: true if open to the low end, - false if to the high end */ - dict_index_t* index, /*!< in: index */ - ulint latch_mode, /*!< in: latch mode */ - btr_cur_t* cursor, /*!< in/out: cursor */ - ulint level, /*!< in: level to search for - (0=leaf). */ - mtr_t* mtr) /*!< in/out: mini-transaction */ -{ - page_cur_t* page_cursor; - ulint node_ptr_max_size = srv_page_size / 2; - ulint height; - ulint root_height = 0; /* remove warning */ - rec_t* node_ptr; - ulint estimate; - btr_intention_t lock_intention; - buf_block_t* tree_blocks[BTR_MAX_LEVELS]; - ulint tree_savepoints[BTR_MAX_LEVELS]; - ulint n_blocks = 0; - ulint n_releases = 0; - mem_heap_t* heap = NULL; - rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; - rec_offs* offsets = offsets_; - dberr_t err = DB_SUCCESS; - - rec_offs_init(offsets_); - - estimate = latch_mode & BTR_ESTIMATE; - latch_mode &= ulint(~BTR_ESTIMATE); - - ut_ad(level != ULINT_UNDEFINED); - - bool s_latch_by_caller; - - s_latch_by_caller = latch_mode & BTR_ALREADY_S_LATCHED; - latch_mode &= ulint(~BTR_ALREADY_S_LATCHED); - - lock_intention = btr_cur_get_and_clear_intention(&latch_mode); - - ut_ad(!(latch_mode & BTR_MODIFY_EXTERNAL)); - - /* This function doesn't need to lock left page of the leaf page */ - if (latch_mode == BTR_SEARCH_PREV) { - latch_mode = BTR_SEARCH_LEAF; - } else if (latch_mode == BTR_MODIFY_PREV) { - latch_mode = BTR_MODIFY_LEAF; - } - - /* Store the position of the tree latch we push to mtr so that we - know how to release it when we have latched the leaf node */ - - ulint savepoint = mtr_set_savepoint(mtr); - - rw_lock_type_t upper_rw_latch; - - switch (latch_mode) { - case BTR_CONT_MODIFY_TREE: - case BTR_CONT_SEARCH_TREE: - upper_rw_latch = RW_NO_LATCH; - break; - case BTR_MODIFY_TREE: - /* Most of delete-intended operations are purging. - Free blocks and read IO bandwidth should be prior - for them, when the history list is glowing huge. */ - if (lock_intention == BTR_INTENTION_DELETE - && buf_pool.n_pend_reads - && trx_sys.history_size_approx() - > BTR_CUR_FINE_HISTORY_LENGTH) { - mtr_x_lock_index(index, mtr); - } else { - mtr_sx_lock_index(index, mtr); - } - upper_rw_latch = RW_X_LATCH; - break; - default: - ut_ad(!s_latch_by_caller - || mtr->memo_contains_flagged(&index->lock, - MTR_MEMO_SX_LOCK - | MTR_MEMO_S_LOCK)); - if (!srv_read_only_mode) { - if (!s_latch_by_caller) { - /* BTR_SEARCH_TREE is intended to be used with - BTR_ALREADY_S_LATCHED */ - ut_ad(latch_mode != BTR_SEARCH_TREE); - - mtr_s_lock_index(index, mtr); - } - upper_rw_latch = RW_S_LATCH; - } else { - upper_rw_latch = RW_NO_LATCH; - } - } - - const rw_lock_type_t root_leaf_rw_latch = btr_cur_latch_for_root_leaf( - latch_mode); - - page_cursor = btr_cur_get_page_cur(cursor); - cursor->index = index; - - page_id_t page_id(index->table->space_id, index->page); - const ulint zip_size = index->table->space->zip_size(); - - if (root_leaf_rw_latch == RW_X_LATCH) { - node_ptr_max_size = btr_node_ptr_max_size(index); - } - - height = ULINT_UNDEFINED; - - for (;;) { - ut_ad(n_blocks < BTR_MAX_LEVELS); - tree_savepoints[n_blocks] = mtr_set_savepoint(mtr); - - const ulint rw_latch = height - && (latch_mode != BTR_MODIFY_TREE || height == level) - ? upper_rw_latch : RW_NO_LATCH; - buf_block_t* block = buf_page_get_gen(page_id, zip_size, - rw_latch, NULL, BUF_GET, - mtr, &err, - height == 0 - && !index->is_clust()); - ut_ad((block != NULL) == (err == DB_SUCCESS)); - tree_blocks[n_blocks] = block; - - if (err != DB_SUCCESS) { - if (err == DB_DECRYPTION_FAILED) { - ib_push_warning((void *)NULL, - DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name.m_name); - index->table->file_unreadable = true; - } - - goto exit_loop; - } - - const page_t* page = buf_block_get_frame(block); - - if (height == ULINT_UNDEFINED - && page_is_leaf(page) - && rw_latch != RW_NO_LATCH - && rw_latch != root_leaf_rw_latch) { - /* We should retry to get the page, because the root page - is latched with different level as a leaf page. */ - ut_ad(root_leaf_rw_latch != RW_NO_LATCH); - ut_ad(rw_latch == RW_S_LATCH); - - ut_ad(n_blocks == 0); - mtr_release_block_at_savepoint( - mtr, tree_savepoints[n_blocks], - tree_blocks[n_blocks]); - - upper_rw_latch = root_leaf_rw_latch; - continue; - } - - ut_ad(fil_page_index_page_check(page)); - ut_ad(index->id == btr_page_get_index_id(page)); - - if (height == ULINT_UNDEFINED) { - /* We are in the root node */ - - height = btr_page_get_level(page); - root_height = height; - ut_a(height >= level); - } else { - /* TODO: flag the index corrupted if this fails */ - ut_ad(height == btr_page_get_level(page)); - } - - if (height == 0) { - if (rw_latch == RW_NO_LATCH) { - btr_cur_latch_leaves(block, latch_mode, - cursor, mtr); - } - - /* In versions <= 3.23.52 we had forgotten to - release the tree latch here. If in an index - scan we had to scan far to find a record - visible to the current transaction, that could - starve others waiting for the tree latch. */ - - switch (latch_mode) { - case BTR_MODIFY_TREE: - case BTR_CONT_MODIFY_TREE: - case BTR_CONT_SEARCH_TREE: - break; - default: - if (UNIV_UNLIKELY(srv_read_only_mode)) { - break; - } - if (!s_latch_by_caller) { - /* Release the tree s-latch */ - mtr_release_s_latch_at_savepoint( - mtr, savepoint, &index->lock); - } - - /* release upper blocks */ - for (; n_releases < n_blocks; n_releases++) { - mtr_release_block_at_savepoint( - mtr, - tree_savepoints[n_releases], - tree_blocks[n_releases]); - } - } - } else if (height == level /* height != 0 */ - && UNIV_LIKELY(!srv_read_only_mode)) { - /* We already have the block latched. */ - ut_ad(latch_mode == BTR_SEARCH_TREE); - ut_ad(s_latch_by_caller); - ut_ad(upper_rw_latch == RW_S_LATCH); - ut_ad(mtr->memo_contains_flagged(block, - MTR_MEMO_PAGE_S_FIX)); - - if (s_latch_by_caller) { - /* to exclude modifying tree operations - should sx-latch the index. */ - ut_ad(mtr->memo_contains(index->lock, - MTR_MEMO_SX_LOCK)); - /* because has sx-latch of index, - can release upper blocks. */ - for (; n_releases < n_blocks; n_releases++) { - mtr_release_block_at_savepoint( - mtr, - tree_savepoints[n_releases], - tree_blocks[n_releases]); - } - } - } - - if (from_left) { - page_cur_set_before_first(block, page_cursor); - } else { - page_cur_set_after_last(block, page_cursor); - } + const ulint zip_size= index()->table->space->zip_size(); + + /* Start with the root page. */ + page_id_t page_id(index()->table->space_id, index()->page); + + const page_cur_mode_t page_mode= btr_cur_nonleaf_mode(mode); + ulint height= ULINT_UNDEFINED; + up_match= 0; + up_bytes= 0; + low_match= 0; + low_bytes= 0; + ulint buf_mode= BUF_GET; + search_loop: + dberr_t err; + auto block_savepoint= mtr->get_savepoint(); + buf_block_t *block= + buf_page_get_gen(page_id, zip_size, rw_latch, guess, buf_mode, mtr, + &err, height == 0 && !index()->is_clust()); + if (!block) + { + switch (err) { + case DB_DECRYPTION_FAILED: + btr_decryption_failed(*index()); + /* fall through */ + default: + func_exit: + if (UNIV_LIKELY_NULL(heap)) + mem_heap_free(heap); + return err; + case DB_SUCCESS: + /* This must be a search to perform an insert, delete mark, or delete; + try using the change buffer */ + ut_ad(height == 0); + ut_ad(thr); + break; + } - if (height == level) { - if (estimate) { - btr_cur_add_path_info(cursor, height, - root_height); - } + switch (btr_op) { + default: + MY_ASSERT_UNREACHABLE(); + break; + case BTR_INSERT_OP: + case BTR_INSERT_IGNORE_UNIQUE_OP: + ut_ad(buf_mode == BUF_GET_IF_IN_POOL); + + if (ibuf_insert(IBUF_OP_INSERT, tuple, index(), page_id, zip_size, thr)) + { + flag= BTR_CUR_INSERT_TO_IBUF; + goto func_exit; + } + break; + + case BTR_DELMARK_OP: + ut_ad(buf_mode == BUF_GET_IF_IN_POOL); + + if (ibuf_insert(IBUF_OP_DELETE_MARK, tuple, + index(), page_id, zip_size, thr)) + { + flag = BTR_CUR_DEL_MARK_IBUF; + goto func_exit; + } + + break; + + case BTR_DELETE_OP: + ut_ad(buf_mode == BUF_GET_IF_IN_POOL_OR_WATCH); + auto& chain = buf_pool.page_hash.cell_get(page_id.fold()); + + if (!row_purge_poss_sec(purge_node, index(), tuple)) + /* The record cannot be purged yet. */ + flag= BTR_CUR_DELETE_REF; + else if (ibuf_insert(IBUF_OP_DELETE, tuple, index(), + page_id, zip_size, thr)) + /* The purge was buffered. */ + flag= BTR_CUR_DELETE_IBUF; + else + { + /* The purge could not be buffered. */ + buf_pool.watch_unset(page_id, chain); + break; + } + + buf_pool.watch_unset(page_id, chain); + goto func_exit; + } - break; - } + /* Change buffering did not succeed, we must read the page. */ + buf_mode= BUF_GET; + goto search_loop; + } - ut_ad(height > 0); + if (!!page_is_comp(block->page.frame) != index()->table->not_redundant() || + btr_page_get_index_id(block->page.frame) != index()->id || + fil_page_get_type(block->page.frame) == FIL_PAGE_RTREE || + !fil_page_index_page_check(block->page.frame)) + { + corrupted: + ut_ad("corrupted" == 0); // FIXME: remove this + err= DB_CORRUPTION; + goto func_exit; + } - if (from_left) { - page_cur_move_to_next(page_cursor); - } else { - page_cur_move_to_prev(page_cursor); - } + page_cur.block= block; + ut_ad(block == mtr->at_savepoint(block_savepoint)); +#ifdef UNIV_ZIP_DEBUG + if (rw_latch == RW_NO_LATCH); + else if (const page_zip_des_t *page_zip= buf_block_get_page_zip(block)) + ut_a(page_zip_validate(page_zip, block->page.frame, index())); +#endif /* UNIV_ZIP_DEBUG */ + const uint32_t page_level= btr_page_get_level(block->page.frame); - if (estimate) { - btr_cur_add_path_info(cursor, height, root_height); - } + if (height == ULINT_UNDEFINED) + { + /* We are in the B-tree index root page. */ +#ifdef BTR_CUR_ADAPT + info->root_guess= block; +#endif + height= page_level; + tree_height= height + 1; - height--; - - node_ptr = page_cur_get_rec(page_cursor); - offsets = rec_get_offsets(node_ptr, cursor->index, offsets, - 0, ULINT_UNDEFINED, &heap); - - /* If the rec is the first or last in the page for - pessimistic delete intention, it might cause node_ptr insert - for the upper level. We should change the intention and retry. - */ - if (latch_mode == BTR_MODIFY_TREE - && btr_cur_need_opposite_intention( - page, lock_intention, node_ptr)) { - - ut_ad(upper_rw_latch == RW_X_LATCH); - /* release all blocks */ - for (; n_releases <= n_blocks; n_releases++) { - mtr_release_block_at_savepoint( - mtr, tree_savepoints[n_releases], - tree_blocks[n_releases]); - } + if (!height) + { + /* The root page is also a leaf page. + We may have to reacquire the page latch in a different mode. */ + switch (rw_latch) { + case RW_S_LATCH: + if ((latch_mode & ~12) != RW_S_LATCH) + { + ut_ad(rw_lock_type_t(latch_mode & ~12) == RW_X_LATCH); + goto relatch_x; + } + if (latch_mode != BTR_MODIFY_PREV) + { + if (!latch_by_caller) + /* Release the tree s-latch */ + mtr->rollback_to_savepoint(savepoint, savepoint + 1); + goto reached_latched_leaf; + } + /* fall through */ + case RW_SX_LATCH: + ut_ad(rw_latch == RW_S_LATCH || + latch_mode == BTR_MODIFY_ROOT_AND_LEAF); + relatch_x: + mtr->rollback_to_savepoint(block_savepoint); + height= ULINT_UNDEFINED; + rw_latch= RW_X_LATCH; + goto search_loop; + case RW_X_LATCH: + if (latch_mode == BTR_MODIFY_TREE) + goto reached_index_root_and_leaf; + goto reached_root_and_leaf; + case RW_NO_LATCH: + ut_ad(mtr->memo_contains_flagged(&index()->lock, MTR_MEMO_X_LOCK)); + } + goto reached_leaf; + } + } + else if (UNIV_UNLIKELY(height != page_level)) + goto corrupted; + else + switch (latch_mode) { + case BTR_MODIFY_TREE: + break; + case BTR_MODIFY_ROOT_AND_LEAF: + ut_ad((mtr->at_savepoint(block_savepoint - 1)->page.id().page_no() == + index()->page) == (tree_height <= height + 2)); + if (tree_height <= height + 2) + /* Retain the root page latch. */ + break; + goto release_parent_page; + default: + if (rw_latch == RW_NO_LATCH) + { + ut_ad(!height); + break; + } + release_parent_page: + ut_ad(block_savepoint > savepoint); + mtr->rollback_to_savepoint(block_savepoint - 1, block_savepoint); + block_savepoint--; + } - lock_intention = BTR_INTENTION_BOTH; + if (!height) + { + reached_leaf: + /* We reached the leaf level. */ + ut_ad(block == mtr->at_savepoint(block_savepoint)); - page_id.set_page_no(dict_index_get_page(index)); + if (latch_mode == BTR_MODIFY_ROOT_AND_LEAF) + { + reached_root_and_leaf: + if (!latch_by_caller) + mtr->rollback_to_savepoint(savepoint, savepoint + 1); + reached_index_root_and_leaf: + ut_ad(rw_latch == RW_X_LATCH); +#ifdef BTR_CUR_HASH_ADAPT + btr_search_drop_page_hash_index(block, true); +#endif + if (page_cur_search_with_match(tuple, mode, &up_match, &low_match, + &page_cur, nullptr)) + goto corrupted; + ut_ad(up_match != ULINT_UNDEFINED || mode != PAGE_CUR_GE); + ut_ad(up_match != ULINT_UNDEFINED || mode != PAGE_CUR_LE); + ut_ad(low_match != ULINT_UNDEFINED || mode != PAGE_CUR_LE); + goto func_exit; + } - height = ULINT_UNDEFINED; + switch (latch_mode) { + case BTR_SEARCH_PREV: + case BTR_MODIFY_PREV: + static_assert(BTR_MODIFY_PREV & BTR_MODIFY_LEAF, ""); + static_assert(BTR_SEARCH_PREV & BTR_SEARCH_LEAF, ""); + ut_ad(!latch_by_caller); + + if (rw_latch == RW_NO_LATCH) + { + /* latch also siblings from left to right */ + rw_latch= rw_lock_type_t(latch_mode & (RW_X_LATCH | RW_S_LATCH)); + if (page_has_prev(block->page.frame) && + !btr_block_get(*index(), btr_page_get_prev(block->page.frame), + rw_latch, false, mtr, &err)) + goto func_exit; + mtr->upgrade_buffer_fix(block_savepoint, rw_latch); + if (page_has_next(block->page.frame) && + !btr_block_get(*index(), btr_page_get_next(block->page.frame), + rw_latch, false, mtr, &err)) + goto func_exit; + } + goto release_tree; + case BTR_SEARCH_LEAF: + case BTR_MODIFY_LEAF: + if (rw_latch == RW_NO_LATCH) + { + ut_ad(index()->is_ibuf()); + mtr->upgrade_buffer_fix(block_savepoint, rw_lock_type_t(latch_mode)); + } + if (!latch_by_caller) + { +release_tree: + /* Release the tree s-latch */ + block_savepoint--; + mtr->rollback_to_savepoint(savepoint, savepoint + 1); + } + /* release upper blocks */ + if (savepoint < block_savepoint) + mtr->rollback_to_savepoint(savepoint, block_savepoint); + break; + default: + ut_ad(latch_mode == BTR_MODIFY_TREE); + ut_ad(rw_latch == RW_NO_LATCH); + /* x-latch also siblings from left to right */ + if (page_has_prev(block->page.frame) && + !btr_block_get(*index(), btr_page_get_prev(block->page.frame), + RW_X_LATCH, false, mtr, &err)) + goto func_exit; + mtr->upgrade_buffer_fix(block_savepoint, RW_X_LATCH); + if (page_has_next(block->page.frame) && + !btr_block_get(*index(), btr_page_get_next(block->page.frame), + RW_X_LATCH, false, mtr, &err)) + goto func_exit; + if (btr_cur_need_opposite_intention(block->page, index()->is_clust(), + lock_intention, + node_ptr_max_size, compress_limit, + page_cur.rec)) + goto need_opposite_intention; + } - n_blocks = 0; - n_releases = 0; + reached_latched_leaf: +#ifdef BTR_CUR_HASH_ADAPT + if (ahi_enabled && !(tuple->info_bits & REC_INFO_MIN_REC_FLAG)) + { + if (page_cur_search_with_match_bytes(tuple, mode, + &up_match, &up_bytes, + &low_match, &low_bytes, &page_cur)) + goto corrupted; + } + else +#endif /* BTR_CUR_HASH_ADAPT */ + if (page_cur_search_with_match(tuple, mode, &up_match, &low_match, + &page_cur, nullptr)) + goto corrupted; - continue; - } + ut_ad(up_match != ULINT_UNDEFINED || mode != PAGE_CUR_GE); + ut_ad(up_match != ULINT_UNDEFINED || mode != PAGE_CUR_LE); + ut_ad(low_match != ULINT_UNDEFINED || mode != PAGE_CUR_LE); - if (latch_mode == BTR_MODIFY_TREE - && !btr_cur_will_modify_tree( - cursor->index, page, lock_intention, node_ptr, - node_ptr_max_size, zip_size, mtr)) { - ut_ad(upper_rw_latch == RW_X_LATCH); - ut_ad(n_releases <= n_blocks); - - /* we can release upper blocks */ - for (; n_releases < n_blocks; n_releases++) { - if (n_releases == 0) { - /* we should not release root page - to pin to same block. */ - continue; - } +#ifdef BTR_CUR_HASH_ADAPT + /* We do a dirty read of btr_search_enabled here. We will + properly check btr_search_enabled again in + btr_search_build_page_hash_index() before building a page hash + index, while holding search latch. */ + if (!btr_search_enabled); + else if (tuple->info_bits & REC_INFO_MIN_REC_FLAG) + /* This may be a search tuple for btr_pcur_t::restore_position(). */ + ut_ad(tuple->is_metadata() || + (tuple->is_metadata(tuple->info_bits ^ REC_STATUS_INSTANT))); + else if (index()->table->is_temporary()); + else if (!rec_is_metadata(page_cur.rec, *index())) + btr_search_info_update(index(), this); +#endif /* BTR_CUR_HASH_ADAPT */ - /* release unused blocks to unpin */ - mtr_release_block_at_savepoint( - mtr, tree_savepoints[n_releases], - tree_blocks[n_releases]); - } - } + goto func_exit; + } - if (height == level - && latch_mode == BTR_MODIFY_TREE) { - ut_ad(upper_rw_latch == RW_X_LATCH); - /* we should sx-latch root page, if released already. - It contains seg_header. */ - if (n_releases > 0) { - mtr_block_sx_latch_at_savepoint( - mtr, tree_savepoints[0], - tree_blocks[0]); - } + guess= nullptr; + if (page_cur_search_with_match(tuple, page_mode, &up_match, &low_match, + &page_cur, nullptr)) + goto corrupted; + offsets= rec_get_offsets(page_cur.rec, index(), offsets, 0, ULINT_UNDEFINED, + &heap); + + ut_ad(block == mtr->at_savepoint(block_savepoint)); + + switch (latch_mode) { + default: + break; + case BTR_MODIFY_TREE: + if (btr_cur_need_opposite_intention(block->page, index()->is_clust(), + lock_intention, + node_ptr_max_size, compress_limit, + page_cur.rec)) + /* If the rec is the first or last in the page for pessimistic + delete intention, it might cause node_ptr insert for the upper + level. We should change the intention and retry. */ + need_opposite_intention: + return pessimistic_search_leaf(tuple, mode, mtr); + + if (detected_same_key_root || lock_intention != BTR_INTENTION_BOTH || + index()->is_unique() || + (up_match <= rec_offs_n_fields(offsets) && + low_match <= rec_offs_n_fields(offsets))) + break; + + /* If the first or the last record of the page or the same key + value to the first record or last record, then another page might + be chosen when BTR_CONT_MODIFY_TREE. So, the parent page should + not released to avoiding deadlock with blocking the another search + with the same key value. */ + const rec_t *first= + page_rec_get_next_const(page_get_infimum_rec(block->page.frame)); + ulint matched_fields; + + if (UNIV_UNLIKELY(!first)) + goto corrupted; + if (page_cur.rec == first || + page_rec_is_last(page_cur.rec, block->page.frame)) + { + same_key_root: + detected_same_key_root= true; + break; + } - /* x-latch the branch blocks not released yet. */ - for (ulint i = n_releases; i <= n_blocks; i++) { - mtr_block_x_latch_at_savepoint( - mtr, tree_savepoints[i], - tree_blocks[i]); - } - } + matched_fields= 0; + offsets2= rec_get_offsets(first, index(), offsets2, 0, ULINT_UNDEFINED, + &heap); + cmp_rec_rec(page_cur.rec, first, offsets, offsets2, index(), false, + &matched_fields); + if (matched_fields >= rec_offs_n_fields(offsets) - 1) + goto same_key_root; + if (const rec_t* last= + page_rec_get_prev_const(page_get_supremum_rec(block->page.frame))) + { + matched_fields= 0; + offsets2= rec_get_offsets(last, index(), offsets2, 0, ULINT_UNDEFINED, + &heap); + cmp_rec_rec(page_cur.rec, last, offsets, offsets2, index(), false, + &matched_fields); + if (matched_fields >= rec_offs_n_fields(offsets) - 1) + goto same_key_root; + } + else + goto corrupted; - /* Go to the child node */ - page_id.set_page_no( - btr_node_ptr_get_child_page_no(node_ptr, offsets)); + /* Release the non-root parent page unless it may need to be modified. */ + if (tree_height > height + 1 && + !btr_cur_will_modify_tree(index(), block->page.frame, lock_intention, + page_cur.rec, node_ptr_max_size, + zip_size, mtr)) + { + mtr->rollback_to_savepoint(block_savepoint - 1, block_savepoint); + block_savepoint--; + } + } - n_blocks++; - } + /* Go to the child node */ + page_id.set_page_no(btr_node_ptr_get_child_page_no(page_cur.rec, offsets)); - exit_loop: - if (heap) { - mem_heap_free(heap); - } + if (!--height) + { + /* We are about to access the leaf level. */ + + switch (latch_mode) { + case BTR_MODIFY_ROOT_AND_LEAF: + rw_latch= RW_X_LATCH; + break; + case BTR_MODIFY_PREV: /* ibuf_insert() or btr_pcur_move_to_prev() */ + case BTR_SEARCH_PREV: /* btr_pcur_move_to_prev() */ + ut_ad(rw_latch == RW_S_LATCH || rw_latch == RW_X_LATCH); + + if (page_has_prev(block->page.frame) && + page_rec_is_first(page_cur.rec, block->page.frame)) + { + ut_ad(block_savepoint + 1 == mtr->get_savepoint()); + /* Latch the previous page if the node pointer is the leftmost + of the current page. */ + buf_block_t *left= btr_block_get(*index(), + btr_page_get_prev(block->page.frame), + RW_NO_LATCH, false, mtr, &err); + if (UNIV_UNLIKELY(!left)) + goto func_exit; + ut_ad(block_savepoint + 2 == mtr->get_savepoint()); + if (UNIV_LIKELY(left->page.lock.s_lock_try())) + mtr->lock_register(block_savepoint + 1, MTR_MEMO_PAGE_S_FIX); + else + { + if (rw_latch == RW_S_LATCH) + block->page.lock.s_unlock(); + else + block->page.lock.x_unlock(); + mtr->upgrade_buffer_fix(block_savepoint + 1, RW_S_LATCH); + mtr->lock_register(block_savepoint, MTR_MEMO_BUF_FIX); + mtr->upgrade_buffer_fix(block_savepoint, RW_S_LATCH); + /* While our latch on the level-2 page prevents splits or + merges of this level-1 block, other threads may have + modified it due to splitting or merging some level-0 (leaf) + pages underneath it. Thus, we must search again. */ + if (page_cur_search_with_match(tuple, page_mode, + &up_match, &low_match, + &page_cur, nullptr)) + goto corrupted; + offsets= rec_get_offsets(page_cur.rec, index(), offsets, 0, + ULINT_UNDEFINED, &heap); + page_id.set_page_no(btr_node_ptr_get_child_page_no(page_cur.rec, + offsets)); + } + } + goto leaf_with_no_latch; + case BTR_MODIFY_LEAF: + case BTR_SEARCH_LEAF: + if (index()->is_ibuf()) + goto leaf_with_no_latch; + rw_latch= rw_lock_type_t(latch_mode); + if (btr_op != BTR_NO_OP && + ibuf_should_try(index(), btr_op != BTR_INSERT_OP)) + /* Try to buffer the operation if the leaf page + is not in the buffer pool. */ + buf_mode= btr_op == BTR_DELETE_OP + ? BUF_GET_IF_IN_POOL_OR_WATCH + : BUF_GET_IF_IN_POOL; + break; + case BTR_MODIFY_TREE: + ut_ad(rw_latch == RW_X_LATCH); + + if (lock_intention == BTR_INTENTION_INSERT && + page_has_next(block->page.frame) && + page_rec_is_last(page_cur.rec, block->page.frame)) + { + /* btr_insert_into_right_sibling() might cause deleting node_ptr + at upper level */ + mtr->rollback_to_savepoint(block_savepoint); + goto need_opposite_intention; + } + /* fall through */ + default: + leaf_with_no_latch: + rw_latch= RW_NO_LATCH; + } + } - return err; + goto search_loop; } -/**********************************************************************//** -Positions a cursor at a randomly chosen position within a B-tree. -@return true if the index is available and we have put the cursor, false -if the index is unavailable */ -bool -btr_cur_open_at_rnd_pos( - dict_index_t* index, /*!< in: index */ - ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ - btr_cur_t* cursor, /*!< in/out: B-tree cursor */ - mtr_t* mtr) /*!< in: mtr */ +ATTRIBUTE_COLD void mtr_t::index_lock_upgrade() { - page_cur_t* page_cursor; - ulint node_ptr_max_size = srv_page_size / 2; - ulint height; - rec_t* node_ptr; - btr_intention_t lock_intention; - buf_block_t* tree_blocks[BTR_MAX_LEVELS]; - ulint tree_savepoints[BTR_MAX_LEVELS]; - ulint n_blocks = 0; - ulint n_releases = 0; - mem_heap_t* heap = NULL; - rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; - rec_offs* offsets = offsets_; - rec_offs_init(offsets_); + auto &slot= m_memo[get_savepoint() - 1]; + if (slot.type == MTR_MEMO_X_LOCK) + return; + ut_ad(slot.type == MTR_MEMO_SX_LOCK); + index_lock *lock= static_cast(slot.object); + lock->u_x_upgrade(SRW_LOCK_CALL); + slot.type= MTR_MEMO_X_LOCK; +} - ut_ad(!index->is_spatial()); +ATTRIBUTE_COLD +dberr_t btr_cur_t::pessimistic_search_leaf(const dtuple_t *tuple, + page_cur_mode_t mode, mtr_t *mtr) +{ + ut_ad(index()->is_btree() || index()->is_ibuf()); + ut_ad(!index()->is_ibuf() || ibuf_inside(mtr)); + + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; + rec_offs_init(offsets_); + + ut_ad(flag == BTR_CUR_BINARY); + ut_ad(dict_index_check_search_tuple(index(), tuple)); + ut_ad(dtuple_check_typed(tuple)); + buf_block_t *block= mtr->at_savepoint(1); + ut_ad(block->page.id().page_no() == index()->page); + block->page.fix(); + mtr->rollback_to_savepoint(1); + mtr->index_lock_upgrade(); + + const page_cur_mode_t page_mode{btr_cur_nonleaf_mode(mode)}; + + mtr->page_lock(block, RW_X_LATCH); + + up_match= 0; + up_bytes= 0; + low_match= 0; + low_bytes= 0; + ulint height= btr_page_get_level(block->page.frame); + tree_height= height + 1; + mem_heap_t *heap= nullptr; + + search_loop: + dberr_t err; + page_cur.block= block; + + if (UNIV_UNLIKELY(!height)) + { + if (page_cur_search_with_match(tuple, mode, &up_match, &low_match, + &page_cur, nullptr)) + corrupted: + err= DB_CORRUPTION; + else + { + ut_ad(up_match != ULINT_UNDEFINED || mode != PAGE_CUR_GE); + ut_ad(up_match != ULINT_UNDEFINED || mode != PAGE_CUR_LE); + ut_ad(low_match != ULINT_UNDEFINED || mode != PAGE_CUR_LE); - lock_intention = btr_cur_get_and_clear_intention(&latch_mode); +#ifdef BTR_CUR_HASH_ADAPT + /* We do a dirty read of btr_search_enabled here. We will + properly check btr_search_enabled again in + btr_search_build_page_hash_index() before building a page hash + index, while holding search latch. */ + if (!btr_search_enabled); + else if (tuple->info_bits & REC_INFO_MIN_REC_FLAG) + /* This may be a search tuple for btr_pcur_t::restore_position(). */ + ut_ad(tuple->is_metadata() || + (tuple->is_metadata(tuple->info_bits ^ REC_STATUS_INSTANT))); + else if (index()->table->is_temporary()); + else if (!rec_is_metadata(page_cur.rec, *index())) + btr_search_info_update(index(), this); +#endif /* BTR_CUR_HASH_ADAPT */ + err= DB_SUCCESS; + } - ut_ad(!(latch_mode & BTR_MODIFY_EXTERNAL)); + func_exit: + if (UNIV_LIKELY_NULL(heap)) + mem_heap_free(heap); + return err; + } - ulint savepoint = mtr_set_savepoint(mtr); + if (page_cur_search_with_match(tuple, page_mode, &up_match, &low_match, + &page_cur, nullptr)) + goto corrupted; - rw_lock_type_t upper_rw_latch; + page_id_t page_id{block->page.id()}; - switch (latch_mode) { - case BTR_MODIFY_TREE: - /* Most of delete-intended operations are purging. - Free blocks and read IO bandwidth should be prior - for them, when the history list is glowing huge. */ - if (lock_intention == BTR_INTENTION_DELETE - && buf_pool.n_pend_reads - && trx_sys.history_size_approx() - > BTR_CUR_FINE_HISTORY_LENGTH) { - mtr_x_lock_index(index, mtr); - } else { - mtr_sx_lock_index(index, mtr); - } - upper_rw_latch = RW_X_LATCH; - break; - case BTR_SEARCH_PREV: - case BTR_MODIFY_PREV: - /* This function doesn't support left uncle - page lock for left leaf page lock, when - needed. */ - case BTR_SEARCH_TREE: - case BTR_CONT_MODIFY_TREE: - case BTR_CONT_SEARCH_TREE: - ut_ad(0); - /* fall through */ - default: - if (!srv_read_only_mode) { - mtr_s_lock_index(index, mtr); - upper_rw_latch = RW_S_LATCH; - } else { - upper_rw_latch = RW_NO_LATCH; - } - } + offsets= rec_get_offsets(page_cur.rec, index(), offsets, 0, ULINT_UNDEFINED, + &heap); + /* Go to the child node */ + page_id.set_page_no(btr_node_ptr_get_child_page_no(page_cur.rec, offsets)); - DBUG_EXECUTE_IF("test_index_is_unavailable", - return(false);); + const auto block_savepoint= mtr->get_savepoint(); + block= + buf_page_get_gen(page_id, block->zip_size(), RW_NO_LATCH, nullptr, BUF_GET, + mtr, &err, !--height && !index()->is_clust()); - if (index->page == FIL_NULL) { - /* Since we don't hold index lock until just now, the index - could be modified by others, for example, if this is a - statistics updater for referenced table, it could be marked - as unavailable by 'DROP TABLE' in the mean time, since - we don't hold lock for statistics updater */ - return(false); - } + if (!block) + { + if (err == DB_DECRYPTION_FAILED) + btr_decryption_failed(*index()); + goto func_exit; + } - const rw_lock_type_t root_leaf_rw_latch = btr_cur_latch_for_root_leaf( - latch_mode); + if (!!page_is_comp(block->page.frame) != index()->table->not_redundant() || + btr_page_get_index_id(block->page.frame) != index()->id || + fil_page_get_type(block->page.frame) == FIL_PAGE_RTREE || + !fil_page_index_page_check(block->page.frame)) + goto corrupted; - page_cursor = btr_cur_get_page_cur(cursor); - cursor->index = index; + if (height != btr_page_get_level(block->page.frame)) + goto corrupted; - page_id_t page_id(index->table->space_id, index->page); - const ulint zip_size = index->table->space->zip_size(); - dberr_t err = DB_SUCCESS; + if (page_has_prev(block->page.frame) && + !btr_block_get(*index(), btr_page_get_prev(block->page.frame), + RW_X_LATCH, false, mtr, &err)) + goto func_exit; + mtr->upgrade_buffer_fix(block_savepoint, RW_X_LATCH); +#ifdef UNIV_ZIP_DEBUG + const page_zip_des_t *page_zip= buf_block_get_page_zip(block); + ut_a(!page_zip || page_zip_validate(page_zip, block->page.frame, index())); +#endif /* UNIV_ZIP_DEBUG */ + if (page_has_next(block->page.frame) && + !btr_block_get(*index(), btr_page_get_next(block->page.frame), + RW_X_LATCH, false, mtr, &err)) + goto func_exit; + goto search_loop; +} - if (root_leaf_rw_latch == RW_X_LATCH) { - node_ptr_max_size = btr_node_ptr_max_size(index); - } +/********************************************************************//** +Searches an index tree and positions a tree cursor on a given non-leaf level. +NOTE: n_fields_cmp in tuple must be set so that it cannot be compared +to node pointer page number fields on the upper levels of the tree! +cursor->up_match and cursor->low_match both will have sensible values. +Cursor is left at the place where an insert of the +search tuple should be performed in the B-tree. InnoDB does an insert +immediately after the cursor. Thus, the cursor may end up on a user record, +or on a page infimum record. +@param level the tree level of search +@param tuple data tuple; NOTE: n_fields_cmp in tuple must be set so that + it cannot get compared to the node ptr page number field! +@param latch RW_S_LATCH or RW_X_LATCH +@param cursor tree cursor; the cursor page is s- or x-latched, but see also + above! +@param mtr mini-transaction +@return DB_SUCCESS on success or error code otherwise */ +TRANSACTIONAL_TARGET +dberr_t btr_cur_search_to_nth_level(ulint level, + const dtuple_t *tuple, + rw_lock_type_t rw_latch, + btr_cur_t *cursor, mtr_t *mtr) +{ + dict_index_t *const index= cursor->index(); + + ut_ad(index->is_btree() || index->is_ibuf()); + mem_heap_t *heap= nullptr; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs *offsets= offsets_; + rec_offs_init(offsets_); + ut_ad(level); + ut_ad(dict_index_check_search_tuple(index, tuple)); + ut_ad(index->is_ibuf() ? ibuf_inside(mtr) : index->is_btree()); + ut_ad(dtuple_check_typed(tuple)); + ut_ad(index->page != FIL_NULL); + + MEM_UNDEFINED(&cursor->up_bytes, sizeof cursor->up_bytes); + MEM_UNDEFINED(&cursor->low_bytes, sizeof cursor->low_bytes); + cursor->up_match= 0; + cursor->low_match= 0; + cursor->flag= BTR_CUR_BINARY; - height = ULINT_UNDEFINED; +#ifndef BTR_CUR_ADAPT + buf_block_t *block= nullptr; +#else + btr_search_t *info= btr_search_get_info(index); + buf_block_t *block= info->root_guess; +#endif /* BTR_CUR_ADAPT */ - for (;;) { - page_t* page; + ut_ad(mtr->memo_contains_flagged(&index->lock, + MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); - ut_ad(n_blocks < BTR_MAX_LEVELS); - tree_savepoints[n_blocks] = mtr_set_savepoint(mtr); + const ulint zip_size= index->table->space->zip_size(); - const rw_lock_type_t rw_latch = height - && latch_mode != BTR_MODIFY_TREE - ? upper_rw_latch : RW_NO_LATCH; - buf_block_t* block = buf_page_get_gen(page_id, zip_size, - rw_latch, NULL, BUF_GET, - mtr, &err, - height == 0 - && !index->is_clust()); - tree_blocks[n_blocks] = block; + /* Start with the root page. */ + page_id_t page_id(index->table->space_id, index->page); + ulint height= ULINT_UNDEFINED; - ut_ad((block != NULL) == (err == DB_SUCCESS)); +search_loop: + dberr_t err= DB_SUCCESS; + if (buf_block_t *b= + mtr->get_already_latched(page_id, mtr_memo_type_t(rw_latch))) + block= b; + else if (!(block= buf_page_get_gen(page_id, zip_size, rw_latch, + block, BUF_GET, mtr, &err))) + { + if (err == DB_DECRYPTION_FAILED) + btr_decryption_failed(*index); + goto func_exit; + } - if (err != DB_SUCCESS) { - if (err == DB_DECRYPTION_FAILED) { - ib_push_warning((void *)NULL, - DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name.m_name); - index->table->file_unreadable = true; - } +#ifdef UNIV_ZIP_DEBUG + if (const page_zip_des_t *page_zip= buf_block_get_page_zip(block)) + ut_a(page_zip_validate(page_zip, block->page.frame, index)); +#endif /* UNIV_ZIP_DEBUG */ - break; - } + if (!!page_is_comp(block->page.frame) != index->table->not_redundant() || + btr_page_get_index_id(block->page.frame) != index->id || + fil_page_get_type(block->page.frame) == FIL_PAGE_RTREE || + !fil_page_index_page_check(block->page.frame)) + { + corrupted: + err= DB_CORRUPTION; + func_exit: + if (UNIV_LIKELY_NULL(heap)) + mem_heap_free(heap); + return err; + } - page = buf_block_get_frame(block); + const uint32_t page_level= btr_page_get_level(block->page.frame); - if (height == ULINT_UNDEFINED - && page_is_leaf(page) - && rw_latch != RW_NO_LATCH - && rw_latch != root_leaf_rw_latch) { - /* We should retry to get the page, because the root page - is latched with different level as a leaf page. */ - ut_ad(root_leaf_rw_latch != RW_NO_LATCH); - ut_ad(rw_latch == RW_S_LATCH); - - ut_ad(n_blocks == 0); - mtr_release_block_at_savepoint( - mtr, tree_savepoints[n_blocks], - tree_blocks[n_blocks]); - - upper_rw_latch = root_leaf_rw_latch; - continue; - } + if (height == ULINT_UNDEFINED) + { + /* We are in the root node */ + height= page_level; + if (!height) + goto corrupted; + cursor->tree_height= height + 1; + } + else if (height != ulint{page_level}) + goto corrupted; + + cursor->page_cur.block= block; + + /* Search for complete index fields. */ + if (page_cur_search_with_match(tuple, PAGE_CUR_LE, &cursor->up_match, + &cursor->low_match, &cursor->page_cur, + nullptr)) + goto corrupted; + + /* If this is the desired level, leave the loop */ + if (level == height) + goto func_exit; + + ut_ad(height > level); + height--; + + offsets = rec_get_offsets(cursor->page_cur.rec, index, offsets, 0, + ULINT_UNDEFINED, &heap); + /* Go to the child node */ + page_id.set_page_no(btr_node_ptr_get_child_page_no(cursor->page_cur.rec, + offsets)); + block= nullptr; + goto search_loop; +} - ut_ad(fil_page_index_page_check(page)); - ut_ad(index->id == btr_page_get_index_id(page)); +dberr_t btr_cur_t::open_leaf(bool first, dict_index_t *index, + btr_latch_mode latch_mode, mtr_t *mtr) +{ + ulint n_blocks= 0; + mem_heap_t *heap= nullptr; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs *offsets= offsets_; + dberr_t err; - if (height == ULINT_UNDEFINED) { - /* We are in the root node */ + rec_offs_init(offsets_); - height = btr_page_get_level(page); - } + const bool latch_by_caller= latch_mode & BTR_ALREADY_S_LATCHED; + latch_mode= btr_latch_mode(latch_mode & ~BTR_ALREADY_S_LATCHED); - if (height == 0) { - if (rw_latch == RW_NO_LATCH - || srv_read_only_mode) { - btr_cur_latch_leaves(block, latch_mode, cursor, - mtr); - } + btr_intention_t lock_intention= btr_cur_get_and_clear_intention(&latch_mode); - /* btr_cur_open_at_index_side_func() and - btr_cur_search_to_nth_level() release - tree s-latch here.*/ - switch (latch_mode) { - case BTR_MODIFY_TREE: - case BTR_CONT_MODIFY_TREE: - case BTR_CONT_SEARCH_TREE: - break; - default: - /* Release the tree s-latch */ - if (!srv_read_only_mode) { - mtr_release_s_latch_at_savepoint( - mtr, savepoint, - &index->lock); - } + /* Store the position of the tree latch we push to mtr so that we + know how to release it when we have latched the leaf node */ - /* release upper blocks */ - for (; n_releases < n_blocks; n_releases++) { - mtr_release_block_at_savepoint( - mtr, - tree_savepoints[n_releases], - tree_blocks[n_releases]); - } - } - } + auto savepoint= mtr->get_savepoint(); - page_cur_open_on_rnd_user_rec(block, page_cursor); + rw_lock_type_t upper_rw_latch= RW_X_LATCH; + ulint node_ptr_max_size= 0, compress_limit= 0; - if (height == 0) { + if (latch_mode == BTR_MODIFY_TREE) + { + node_ptr_max_size= btr_node_ptr_max_size(index); + /* Most of delete-intended operations are purging. Free blocks + and read IO bandwidth should be prioritized for them, when the + history list is growing huge. */ + savepoint++; + if (lock_intention == BTR_INTENTION_DELETE) + { + compress_limit= BTR_CUR_PAGE_COMPRESS_LIMIT(index); + + if (os_aio_pending_reads_approx() && + trx_sys.history_size_approx() > BTR_CUR_FINE_HISTORY_LENGTH) + { + mtr_x_lock_index(index, mtr); + goto index_locked; + } + } + mtr_sx_lock_index(index, mtr); + } + else + { + static_assert(int{BTR_CONT_MODIFY_TREE} == (12 | BTR_MODIFY_LEAF), ""); + ut_ad(!(latch_mode & 8)); + /* This function doesn't need to lock left page of the leaf page */ + static_assert(int{BTR_SEARCH_PREV} == (4 | BTR_SEARCH_LEAF), ""); + static_assert(int{BTR_MODIFY_PREV} == (4 | BTR_MODIFY_LEAF), ""); + latch_mode= btr_latch_mode(latch_mode & ~4); + ut_ad(!latch_by_caller || + mtr->memo_contains_flagged(&index->lock, + MTR_MEMO_SX_LOCK | MTR_MEMO_S_LOCK)); + upper_rw_latch= RW_S_LATCH; + if (!latch_by_caller) + { + savepoint++; + mtr_s_lock_index(index, mtr); + } + } - break; - } +index_locked: + ut_ad(savepoint == mtr->get_savepoint()); - ut_ad(height > 0); + const rw_lock_type_t root_leaf_rw_latch= + rw_lock_type_t(latch_mode & (RW_S_LATCH | RW_X_LATCH)); - height--; + page_cur.index = index; - node_ptr = page_cur_get_rec(page_cursor); - offsets = rec_get_offsets(node_ptr, cursor->index, offsets, - 0, ULINT_UNDEFINED, &heap); + uint32_t page= index->page; + const auto zip_size= index->table->space->zip_size(); - /* If the rec is the first or last in the page for - pessimistic delete intention, it might cause node_ptr insert - for the upper level. We should change the intention and retry. - */ - if (latch_mode == BTR_MODIFY_TREE - && btr_cur_need_opposite_intention( - page, lock_intention, node_ptr)) { + for (ulint height= ULINT_UNDEFINED;;) + { + ut_ad(n_blocks < BTR_MAX_LEVELS); + ut_ad(savepoint + n_blocks == mtr->get_savepoint()); - ut_ad(upper_rw_latch == RW_X_LATCH); - /* release all blocks */ - for (; n_releases <= n_blocks; n_releases++) { - mtr_release_block_at_savepoint( - mtr, tree_savepoints[n_releases], - tree_blocks[n_releases]); - } + const rw_lock_type_t rw_latch= height && latch_mode != BTR_MODIFY_TREE + ? upper_rw_latch + : RW_NO_LATCH; + buf_block_t* block= + btr_block_get(*index, page, rw_latch, !height && !index->is_clust(), mtr, + &err); - lock_intention = BTR_INTENTION_BOTH; + ut_ad(!block == (err != DB_SUCCESS)); - page_id.set_page_no(dict_index_get_page(index)); + if (!block) + { + if (err == DB_DECRYPTION_FAILED) + btr_decryption_failed(*index); + break; + } - height = ULINT_UNDEFINED; + if (first) + page_cur_set_before_first(block, &page_cur); + else + page_cur_set_after_last(block, &page_cur); - n_blocks = 0; - n_releases = 0; + const uint32_t l= btr_page_get_level(block->page.frame); - continue; - } + if (height == ULINT_UNDEFINED) + { + /* We are in the root node */ + height= l; + if (height); + else if (upper_rw_latch != root_leaf_rw_latch) + { + /* We should retry to get the page, because the root page + is latched with different level as a leaf page. */ + ut_ad(n_blocks == 0); + ut_ad(root_leaf_rw_latch != RW_NO_LATCH); + upper_rw_latch= root_leaf_rw_latch; + mtr->rollback_to_savepoint(savepoint); + height= ULINT_UNDEFINED; + continue; + } + else + { + reached_leaf: + const auto leaf_savepoint= mtr->get_savepoint(); + ut_ad(leaf_savepoint); + ut_ad(block == mtr->at_savepoint(leaf_savepoint - 1)); + + if (latch_mode == BTR_MODIFY_TREE) + { + ut_ad(rw_latch == RW_NO_LATCH); + /* x-latch also siblings from left to right */ + if (page_has_prev(block->page.frame) && + !btr_block_get(*index, btr_page_get_prev(block->page.frame), + RW_X_LATCH, false, mtr, &err)) + break; + mtr->upgrade_buffer_fix(leaf_savepoint - 1, RW_X_LATCH); + if (page_has_next(block->page.frame) && + !btr_block_get(*index, btr_page_get_next(block->page.frame), + RW_X_LATCH, false, mtr, &err)) + break; + + if (!index->lock.have_x() && + btr_cur_need_opposite_intention(block->page, index->is_clust(), + lock_intention, + node_ptr_max_size, + compress_limit, page_cur.rec)) + goto need_opposite_intention; + } + else + { + if (rw_latch == RW_NO_LATCH) + mtr->upgrade_buffer_fix(leaf_savepoint - 1, + rw_lock_type_t(latch_mode & + (RW_X_LATCH | RW_S_LATCH))); + if (latch_mode != BTR_CONT_MODIFY_TREE) + { + ut_ad(latch_mode == BTR_MODIFY_LEAF || + latch_mode == BTR_SEARCH_LEAF); + /* Release index->lock if needed, and the non-leaf pages. */ + mtr->rollback_to_savepoint(savepoint - !latch_by_caller, + leaf_savepoint - 1); + } + } + break; + } + } + else if (UNIV_UNLIKELY(height != l)) + { + corrupted: + err= DB_CORRUPTION; + break; + } - if (latch_mode == BTR_MODIFY_TREE - && !btr_cur_will_modify_tree( - cursor->index, page, lock_intention, node_ptr, - node_ptr_max_size, zip_size, mtr)) { - ut_ad(upper_rw_latch == RW_X_LATCH); - ut_ad(n_releases <= n_blocks); - - /* we can release upper blocks */ - for (; n_releases < n_blocks; n_releases++) { - if (n_releases == 0) { - /* we should not release root page - to pin to same block. */ - continue; - } + if (!height) + goto reached_leaf; - /* release unused blocks to unpin */ - mtr_release_block_at_savepoint( - mtr, tree_savepoints[n_releases], - tree_blocks[n_releases]); - } - } + height--; - if (height == 0 - && latch_mode == BTR_MODIFY_TREE) { - ut_ad(upper_rw_latch == RW_X_LATCH); - /* we should sx-latch root page, if released already. - It contains seg_header. */ - if (n_releases > 0) { - mtr_block_sx_latch_at_savepoint( - mtr, tree_savepoints[0], - tree_blocks[0]); - } + if (first + ? !page_cur_move_to_next(&page_cur) + : !page_cur_move_to_prev(&page_cur)) + goto corrupted; - /* x-latch the branch blocks not released yet. */ - for (ulint i = n_releases; i <= n_blocks; i++) { - mtr_block_x_latch_at_savepoint( - mtr, tree_savepoints[i], - tree_blocks[i]); - } - } + offsets= rec_get_offsets(page_cur.rec, index, offsets, 0, ULINT_UNDEFINED, + &heap); - /* Go to the child node */ - page_id.set_page_no( - btr_node_ptr_get_child_page_no(node_ptr, offsets)); + ut_ad(latch_mode != BTR_MODIFY_TREE || upper_rw_latch == RW_X_LATCH); - n_blocks++; - } + if (latch_mode != BTR_MODIFY_TREE); + else if (btr_cur_need_opposite_intention(block->page, index->is_clust(), + lock_intention, + node_ptr_max_size, compress_limit, + page_cur.rec)) + { + need_opposite_intention: + /* If the rec is the first or last in the page for pessimistic + delete intention, it might cause node_ptr insert for the upper + level. We should change the intention and retry. */ + + mtr->rollback_to_savepoint(savepoint); + mtr->index_lock_upgrade(); + /* X-latch all pages from now on */ + latch_mode= BTR_CONT_MODIFY_TREE; + page= index->page; + height= ULINT_UNDEFINED; + n_blocks= 0; + continue; + } + else + { + if (!btr_cur_will_modify_tree(index, block->page.frame, + lock_intention, page_cur.rec, + node_ptr_max_size, zip_size, mtr)) + { + ut_ad(n_blocks); + /* release buffer-fixes on pages that will not be modified + (except the root) */ + if (n_blocks > 1) + { + mtr->rollback_to_savepoint(savepoint + 1, savepoint + n_blocks - 1); + n_blocks= 1; + } + } + + if (!height) + { + if (page == index->page) + mtr->upgrade_buffer_fix(savepoint, RW_X_LATCH); + else + { + /* The U-latch protects BTR_SEG_HEAP, BTR_SEG_TOP. */ + mtr->upgrade_buffer_fix(savepoint, RW_SX_LATCH); + + /* Upgrade buffer-fix to exclusive latches on all remaining pages. */ + for (ulint i= 1; i <= n_blocks; i++) + mtr->upgrade_buffer_fix(savepoint + i, RW_X_LATCH); + } + } + } - if (UNIV_LIKELY_NULL(heap)) { - mem_heap_free(heap); - } + /* Go to the child node */ + page= btr_node_ptr_get_child_page_no(page_cur.rec, offsets); + n_blocks++; + } - return err == DB_SUCCESS; + if (UNIV_LIKELY_NULL(heap)) + mem_heap_free(heap); + + return err; } /*==================== B-TREE INSERT =========================*/ @@ -3173,26 +2103,25 @@ btr_cur_insert_if_possible( page_cursor = btr_cur_get_page_cur(cursor); /* Now, try the insert */ - rec = page_cur_tuple_insert(page_cursor, tuple, cursor->index, - offsets, heap, n_ext, mtr); + rec = page_cur_tuple_insert(page_cursor, tuple, offsets, heap, n_ext, + mtr); /* If the record did not fit, reorganize. For compressed pages, page_cur_tuple_insert() attempted this already. */ if (!rec && !page_cur_get_page_zip(page_cursor) - && btr_page_reorganize(page_cursor, cursor->index, mtr)) { - rec = page_cur_tuple_insert( - page_cursor, tuple, cursor->index, - offsets, heap, n_ext, mtr); + && btr_page_reorganize(page_cursor, mtr) == DB_SUCCESS) { + rec = page_cur_tuple_insert(page_cursor, tuple, offsets, heap, + n_ext, mtr); } - ut_ad(!rec || rec_offs_validate(rec, cursor->index, *offsets)); + ut_ad(!rec || rec_offs_validate(rec, page_cursor->index, *offsets)); return(rec); } /*************************************************************//** For an insert, checks the locks and does the undo logging if desired. -@return DB_SUCCESS, DB_WAIT_LOCK, DB_FAIL, or error number */ +@return DB_SUCCESS, DB_LOCK_WAIT, DB_FAIL, or error number */ UNIV_INLINE MY_ATTRIBUTE((warn_unused_result, nonnull(2,3,5,6))) dberr_t btr_cur_ins_lock_and_undo( @@ -3216,7 +2145,7 @@ btr_cur_ins_lock_and_undo( request if yes */ rec_t* rec = btr_cur_get_rec(cursor); - dict_index_t* index = cursor->index; + dict_index_t* index = cursor->index(); ut_ad(!dict_index_is_online_ddl(index) || dict_index_is_clust(index) @@ -3343,7 +2272,7 @@ It is assumed that mtr holds an x-latch on the page. The operation does not succeed if there is too little space on the page. If there is just one record on the page, the insert will always succeed; this is to prevent trying to split a page with just one record. -@return DB_SUCCESS, DB_WAIT_LOCK, DB_FAIL, or error number */ +@return DB_SUCCESS, DB_LOCK_WAIT, DB_FAIL, or error number */ dberr_t btr_cur_optimistic_insert( /*======================*/ @@ -3388,7 +2317,7 @@ btr_cur_optimistic_insert( block = btr_cur_get_block(cursor); page = buf_block_get_frame(block); - index = cursor->index; + index = cursor->index(); ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); ut_ad(!dict_index_is_online_ddl(index) @@ -3437,8 +2366,7 @@ btr_cur_optimistic_insert( return(DB_TOO_BIG_RECORD); } - LIMIT_OPTIMISTIC_INSERT_DEBUG(page_get_n_recs(page), - goto fail); + LIMIT_OPTIMISTIC_INSERT_DEBUG(page_get_n_recs(page), goto fail); if (block->page.zip.data && leaf && (page_get_data_size(page) + rec_size @@ -3452,7 +2380,7 @@ btr_cur_optimistic_insert( /* prefetch siblings of the leaf for the pessimistic operation, if the page is leaf. */ - if (page_is_leaf(page)) { + if (leaf) { btr_cur_prefetch_siblings(block, index); } fail_err: @@ -3504,7 +2432,8 @@ btr_cur_optimistic_insert( << ib::hex(thr ? thr->graph->trx->id : 0) << ' ' << rec_printer(entry).str()); DBUG_EXECUTE_IF("do_page_reorganize", - btr_page_reorganize(page_cursor, index, mtr);); + ut_a(!n_recs || btr_page_reorganize(page_cursor, mtr) + == DB_SUCCESS);); /* Now, try the insert */ { @@ -3520,7 +2449,7 @@ btr_cur_optimistic_insert( #ifdef UNIV_DEBUG if (!(flags & BTR_CREATE_FLAG) - && index->is_primary() && page_is_leaf(page)) { + && leaf && index->is_primary()) { const dfield_t* trx_id = dtuple_get_nth_field( entry, dict_col_get_clust_pos( dict_table_get_sys_col(index->table, @@ -3546,9 +2475,8 @@ btr_cur_optimistic_insert( } #endif - *rec = page_cur_tuple_insert( - page_cursor, entry, index, offsets, heap, - n_ext, mtr); + *rec = page_cur_tuple_insert(page_cursor, entry, offsets, heap, + n_ext, mtr); reorg = page_cursor_rec != page_cur_get_rec(page_cursor); } @@ -3567,25 +2495,17 @@ btr_cur_optimistic_insert( goto fail; } else { ut_ad(!reorg); + reorg = true; /* If the record did not fit, reorganize */ - if (!btr_page_reorganize(page_cursor, index, mtr)) { - ut_ad(0); - goto fail; - } - - ut_ad(page_get_max_insert_size(page, 1) == max_size); - - reorg = TRUE; - - *rec = page_cur_tuple_insert(page_cursor, entry, index, - offsets, heap, n_ext, mtr); - - if (UNIV_UNLIKELY(!*rec)) { - ib::fatal() << "Cannot insert tuple " << *entry - << "into index " << index->name - << " of table " << index->table->name - << ". Max size: " << max_size; + err = btr_page_reorganize(page_cursor, mtr); + if (err != DB_SUCCESS + || page_get_max_insert_size(page, 1) != max_size + || !(*rec = page_cur_tuple_insert(page_cursor, entry, + offsets, heap, n_ext, + mtr))) { + err = DB_CORRUPTION; + goto fail_err; } } @@ -3677,11 +2597,9 @@ btr_cur_pessimistic_insert( | BTR_NO_UNDO_LOG_FLAG)) */ mtr_t* mtr) /*!< in/out: mini-transaction */ { - dict_index_t* index = cursor->index; + dict_index_t* index = cursor->index(); big_rec_t* big_rec_vec = NULL; - dberr_t err; bool inherit = false; - bool success; uint32_t n_reserved = 0; ut_ad(dtuple_check_typed(entry)); @@ -3701,27 +2619,24 @@ btr_cur_pessimistic_insert( /* Check locks and write to undo log, if specified */ - err = btr_cur_ins_lock_and_undo(flags, cursor, entry, - thr, mtr, &inherit); + dberr_t err = btr_cur_ins_lock_and_undo(flags, cursor, entry, + thr, mtr, &inherit); if (err != DB_SUCCESS) { - return(err); } - if (!(flags & BTR_NO_UNDO_LOG_FLAG)) { - /* First reserve enough free space for the file segments - of the index tree, so that the insert will not fail because - of lack of space */ - - uint32_t n_extents = uint32_t(cursor->tree_height / 16 + 3); + /* First reserve enough free space for the file segments of + the index tree, so that the insert will not fail because of + lack of space */ - success = fsp_reserve_free_extents(&n_reserved, - index->table->space, - n_extents, FSP_NORMAL, mtr); - if (!success) { - return(DB_OUT_OF_FILE_SPACE); - } + if (!index->is_ibuf() + && (err = fsp_reserve_free_extents(&n_reserved, index->table->space, + uint32_t(cursor->tree_height / 16 + + 3), + FSP_NORMAL, mtr)) + != DB_SUCCESS) { + return err; } if (page_zip_rec_needs_ext(rec_get_converted_size(index, entry, n_ext), @@ -3752,19 +2667,14 @@ btr_cur_pessimistic_insert( } } - if (dict_index_get_page(index) - == btr_cur_get_block(cursor)->page.id().page_no()) { + *rec = index->page == btr_cur_get_block(cursor)->page.id().page_no() + ? btr_root_raise_and_insert(flags, cursor, offsets, heap, + entry, n_ext, mtr, &err) + : btr_page_split_and_insert(flags, cursor, offsets, heap, + entry, n_ext, mtr, &err); - /* The page is the root page */ - *rec = btr_root_raise_and_insert( - flags, cursor, offsets, heap, entry, n_ext, mtr); - } else { - *rec = btr_page_split_and_insert( - flags, cursor, offsets, heap, entry, n_ext, mtr); - } - - if (*rec == NULL && os_has_said_disk_full) { - return(DB_OUT_OF_FILE_SPACE); + if (!*rec) { + goto func_exit; } ut_ad(page_rec_get_next(btr_cur_get_rec(cursor)) == *rec @@ -3815,17 +2725,19 @@ btr_cur_pessimistic_insert( } } + err = DB_SUCCESS; +func_exit: index->table->space->release_free_extents(n_reserved); *big_rec = big_rec_vec; - return(DB_SUCCESS); + return err; } /*==================== B-TREE UPDATE =========================*/ /*************************************************************//** For an update, checks the locks and does the undo logging. -@return DB_SUCCESS, DB_WAIT_LOCK, or error number */ +@return DB_SUCCESS, DB_LOCK_WAIT, or error number */ UNIV_INLINE MY_ATTRIBUTE((warn_unused_result)) dberr_t btr_cur_upd_lock_and_undo( @@ -3848,7 +2760,7 @@ btr_cur_upd_lock_and_undo( ut_ad((thr != NULL) || (flags & BTR_NO_LOCKING_FLAG)); rec = btr_cur_get_rec(cursor); - index = cursor->index; + index = cursor->index(); ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(mtr->is_named_space(index->table->space)); @@ -3904,6 +2816,7 @@ static void btr_cur_write_sys( trx_write_roll_ptr(static_cast(r->data), roll_ptr); } +MY_ATTRIBUTE((warn_unused_result)) /** Update DB_TRX_ID, DB_ROLL_PTR in a clustered index record. @param[in,out] block clustered index leaf page @param[in,out] rec clustered index record @@ -3911,11 +2824,12 @@ static void btr_cur_write_sys( @param[in] offsets rec_get_offsets(rec, index) @param[in] trx transaction @param[in] roll_ptr DB_ROLL_PTR value -@param[in,out] mtr mini-transaction */ -static void btr_cur_upd_rec_sys(buf_block_t *block, rec_t *rec, - dict_index_t *index, const rec_offs *offsets, - const trx_t *trx, roll_ptr_t roll_ptr, - mtr_t *mtr) +@param[in,out] mtr mini-transaction +@return error code */ +static dberr_t btr_cur_upd_rec_sys(buf_block_t *block, rec_t *rec, + dict_index_t *index, const rec_offs *offsets, + const trx_t *trx, roll_ptr_t roll_ptr, + mtr_t *mtr) { ut_ad(index->is_primary()); ut_ad(rec_offs_validate(rec, index, offsets)); @@ -3924,7 +2838,7 @@ static void btr_cur_upd_rec_sys(buf_block_t *block, rec_t *rec, { page_zip_write_trx_id_and_roll_ptr(block, rec, offsets, index->db_trx_id(), trx->id, roll_ptr, mtr); - return; + return DB_SUCCESS; } ulint offset= index->trx_id_offset; @@ -3954,8 +2868,8 @@ static void btr_cur_upd_rec_sys(buf_block_t *block, rec_t *rec, if (UNIV_LIKELY(index->trx_id_offset)) { const rec_t *prev= page_rec_get_prev_const(rec); - if (UNIV_UNLIKELY(prev == rec)) - ut_ad(0); + if (UNIV_UNLIKELY(!prev || prev == rec)) + return DB_CORRUPTION; else if (page_rec_is_infimum(prev)); else for (src= prev + offset; d < DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN; d++) @@ -3993,6 +2907,8 @@ static void btr_cur_upd_rec_sys(buf_block_t *block, rec_t *rec, if (UNIV_LIKELY(len)) /* extra safety, to avoid corrupting the log */ mtr->memcpy(*block, dest, sys + d, len); + + return DB_SUCCESS; } /*************************************************************//** @@ -4012,7 +2928,6 @@ btr_cur_update_alloc_zip_func( /*==========================*/ page_zip_des_t* page_zip,/*!< in/out: compressed page */ page_cur_t* cursor, /*!< in/out: B-tree page cursor */ - dict_index_t* index, /*!< in: the index corresponding to cursor */ #ifdef UNIV_DEBUG rec_offs* offsets,/*!< in/out: offsets of the cursor record */ #endif /* UNIV_DEBUG */ @@ -4021,6 +2936,7 @@ btr_cur_update_alloc_zip_func( false=update-in-place */ mtr_t* mtr) /*!< in/out: mini-transaction */ { + dict_index_t* index = cursor->index; /* Have a local copy of the variables as these can change dynamically. */ @@ -4047,32 +2963,26 @@ btr_cur_update_alloc_zip_func( return(false); } - if (!btr_page_reorganize(cursor, index, mtr)) { - goto out_of_space; - } - - rec_offs_make_valid(page_cur_get_rec(cursor), index, - page_is_leaf(page), offsets); + if (btr_page_reorganize(cursor, mtr) == DB_SUCCESS) { + rec_offs_make_valid(page_cur_get_rec(cursor), index, + page_is_leaf(page), offsets); - /* After recompressing a page, we must make sure that the free - bits in the insert buffer bitmap will not exceed the free - space on the page. Because this function will not attempt - recompression unless page_zip_available() fails above, it is - safe to reset the free bits if page_zip_available() fails - again, below. The free bits can safely be reset in a separate - mini-transaction. If page_zip_available() succeeds below, we - can be sure that the btr_page_reorganize() above did not reduce - the free space available on the page. */ + /* After recompressing a page, we must make sure that the free + bits in the insert buffer bitmap will not exceed the free + space on the page. Because this function will not attempt + recompression unless page_zip_available() fails above, it is + safe to reset the free bits if page_zip_available() fails + again, below. The free bits can safely be reset in a separate + mini-transaction. If page_zip_available() succeeds below, we + can be sure that the btr_page_reorganize() above did not reduce + the free space available on the page. */ - if (page_zip_available(page_zip, dict_index_is_clust(index), - length, create)) { - return(true); + if (page_zip_available(page_zip, dict_index_is_clust(index), + length, create)) { + return true; + } } -out_of_space: - ut_ad(rec_offs_validate(page_cur_get_rec(cursor), index, offsets)); - - /* Out of space: reset the free bits. */ if (!dict_index_is_clust(index) && !index->table->is_temporary() && page_is_leaf(page)) { @@ -4214,9 +3124,84 @@ void btr_cur_upd_rec_in_place(rec_t *rec, const dict_index_t *index, } } - if (UNIV_LIKELY_NULL(block->page.zip.data)) { - page_zip_write_rec(block, rec, index, offsets, 0, mtr); + if (UNIV_LIKELY(!block->page.zip.data)) { + return; + } + + switch (update->n_fields) { + case 0: + /* We only changed the delete-mark flag. */ + return; + case 1: + if (!index->is_clust() + || update->fields[0].field_no != index->db_roll_ptr()) { + break; + } + goto update_sys; + case 2: + if (!index->is_clust() + || update->fields[0].field_no != index->db_trx_id() + || update->fields[1].field_no != index->db_roll_ptr()) { + break; + } + update_sys: + ulint len; + const byte* sys = rec_get_nth_field(rec, offsets, + index->db_trx_id(), &len); + ut_ad(len == DATA_TRX_ID_LEN); + page_zip_write_trx_id_and_roll_ptr( + block, rec, offsets, index->db_trx_id(), + trx_read_trx_id(sys), + trx_read_roll_ptr(sys + DATA_TRX_ID_LEN), mtr); + return; } + + page_zip_write_rec(block, rec, index, offsets, 0, mtr); +} + +/** Check if a ROW_FORMAT=COMPRESSED page can be updated in place +@param cur cursor pointing to ROW_FORMAT=COMPRESSED page +@param offsets rec_get_offsets(btr_cur_get_rec(cur)) +@param update index fields being updated +@param mtr mini-transaction +@return the record in the ROW_FORMAT=COMPRESSED page +@retval nullptr if the page cannot be updated in place */ +ATTRIBUTE_COLD static +rec_t *btr_cur_update_in_place_zip_check(btr_cur_t *cur, rec_offs *offsets, + const upd_t& update, mtr_t *mtr) +{ + dict_index_t *index= cur->index(); + ut_ad(!index->table->is_temporary()); + + switch (update.n_fields) { + case 0: + /* We are only changing the delete-mark flag. */ + break; + case 1: + if (!index->is_clust() || + update.fields[0].field_no != index->db_roll_ptr()) + goto check_for_overflow; + /* We are only changing the delete-mark flag and DB_ROLL_PTR. */ + break; + case 2: + if (!index->is_clust() || + update.fields[0].field_no != index->db_trx_id() || + update.fields[1].field_no != index->db_roll_ptr()) + goto check_for_overflow; + /* We are only changing DB_TRX_ID, DB_ROLL_PTR, and the delete-mark. + They can be updated in place in the uncompressed part of the + ROW_FORMAT=COMPRESSED page. */ + break; + check_for_overflow: + default: + if (!btr_cur_update_alloc_zip(btr_cur_get_page_zip(cur), + btr_cur_get_page_cur(cur), + offsets, rec_offs_size(offsets), + false, mtr)) + return nullptr; + } + + return btr_cur_get_rec(cur); } /*************************************************************//** @@ -4252,7 +3237,8 @@ btr_cur_update_in_place( ut_ad(page_is_leaf(cursor->page_cur.block->page.frame)); rec = btr_cur_get_rec(cursor); - index = cursor->index; + index = cursor->index(); + ut_ad(!index->is_ibuf()); ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table)); ut_ad(trx_id > 0 || (flags & BTR_KEEP_SYS_FLAG) @@ -4278,17 +3264,10 @@ btr_cur_update_in_place( page_zip_des_t* page_zip = buf_block_get_page_zip(block); /* Check that enough space is available on the compressed page. */ - if (UNIV_LIKELY_NULL(page_zip)) { - ut_ad(!index->table->is_temporary()); - - if (!btr_cur_update_alloc_zip( - page_zip, btr_cur_get_page_cur(cursor), - index, offsets, rec_offs_size(offsets), - false, mtr)) { - return(DB_ZIP_OVERFLOW); - } - - rec = btr_cur_get_rec(cursor); + if (UNIV_LIKELY_NULL(page_zip) + && !(rec = btr_cur_update_in_place_zip_check( + cursor, offsets, *update, mtr))) { + return DB_ZIP_OVERFLOW; } /* Do lock checking and undo logging */ @@ -4303,8 +3282,11 @@ btr_cur_update_in_place( } if (!(flags & BTR_KEEP_SYS_FLAG)) { - btr_cur_upd_rec_sys(block, rec, index, offsets, - thr_get_trx(thr), roll_ptr, mtr); + err = btr_cur_upd_rec_sys(block, rec, index, offsets, + thr_get_trx(thr), roll_ptr, mtr); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + goto func_exit; + } } was_delete_marked = rec_get_deleted_flag( @@ -4420,6 +3402,11 @@ static void btr_cur_trim_alter_metadata(dtuple_t* entry, page_id_t(index->table->space->id, mach_read_from_4(ptr + BTR_EXTERN_PAGE_NO)), 0, RW_S_LATCH, &mtr); + if (!block) { + ut_ad("corruption" == 0); + mtr.commit(); + return; + } ut_ad(fil_page_get_type(block->page.frame) == FIL_PAGE_TYPE_BLOB); ut_ad(mach_read_from_4(&block->page.frame [FIL_PAGE_DATA + BTR_BLOB_HDR_NEXT_PAGE_NO]) @@ -4552,7 +3539,8 @@ btr_cur_optimistic_update( block = btr_cur_get_block(cursor); page = buf_block_get_frame(block); rec = btr_cur_get_rec(cursor); - index = cursor->index; + index = cursor->index(); + ut_ad(index->has_locking()); ut_ad(trx_id > 0 || (flags & BTR_KEEP_SYS_FLAG) || index->table->is_temporary()); ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table)); @@ -4655,7 +3643,7 @@ btr_cur_optimistic_update( } if (!btr_cur_update_alloc_zip( - page_zip, page_cursor, index, *offsets, + page_zip, page_cursor, *offsets, new_rec_size, true, mtr)) { return(DB_ZIP_OVERFLOW); } @@ -4668,7 +3656,6 @@ btr_cur_optimistic_update( (!dict_table_is_comp(index->table) && new_rec_size >= REDUNDANT_REC_MAX_DATA_SIZE)) { err = DB_OVERFLOW; - goto func_exit; } @@ -4736,7 +3723,7 @@ btr_cur_optimistic_update( /* Ok, we may do the replacement. Store on the page infimum the explicit locks on rec, before deleting rec (see the comment in btr_cur_pessimistic_update). */ - if (!dict_table_is_locking_disabled(index->table)) { + if (index->has_locking()) { lock_rec_store_on_page_infimum(block, rec); } @@ -4751,33 +3738,42 @@ btr_cur_optimistic_update( btr_search_update_hash_on_delete(cursor); } - page_cur_delete_rec(page_cursor, index, *offsets, mtr); + page_cur_delete_rec(page_cursor, *offsets, mtr); - page_cur_move_to_prev(page_cursor); + if (!page_cur_move_to_prev(page_cursor)) { + return DB_CORRUPTION; + } if (!(flags & BTR_KEEP_SYS_FLAG)) { btr_cur_write_sys(new_entry, index, trx_id, roll_ptr); } - /* There are no externally stored columns in new_entry */ - rec = btr_cur_insert_if_possible( - cursor, new_entry, offsets, heap, 0/*n_ext*/, mtr); - ut_a(rec); /* <- We calculated above the insert would fit */ + rec = btr_cur_insert_if_possible(cursor, new_entry, offsets, heap, + 0/*n_ext*/, mtr); + if (UNIV_UNLIKELY(!rec)) { + goto corrupted; + } if (UNIV_UNLIKELY(update->is_metadata())) { /* We must empty the PAGE_FREE list, because if this was a rollback, the shortened metadata record would have too many fields, and we would be unable to know the size of the freed record. */ - btr_page_reorganize(page_cursor, index, mtr); - } else if (!dict_table_is_locking_disabled(index->table)) { + err = btr_page_reorganize(page_cursor, mtr); + if (err != DB_SUCCESS) { + goto func_exit; + } + } else { /* Restore the old explicit lock state on the record */ lock_rec_restore_from_page_infimum(*block, rec, block->page.id()); } - page_cur_move_to_next(page_cursor); ut_ad(err == DB_SUCCESS); + if (!page_cur_move_to_next(page_cursor)) { +corrupted: + err = DB_CORRUPTION; + } func_exit: if (!(flags & BTR_KEEP_IBUF_BITMAP) @@ -4807,7 +3803,7 @@ updated record. In the split it may have inherited locks from the successor of the updated record, which is not correct. This function restores the right locks for the new supremum. */ static -void +dberr_t btr_cur_pess_upd_restore_supremum( /*==============================*/ buf_block_t* block, /*!< in: buffer block of rec */ @@ -4815,28 +3811,30 @@ btr_cur_pess_upd_restore_supremum( mtr_t* mtr) /*!< in: mtr */ { page_t* page; - buf_block_t* prev_block; page = buf_block_get_frame(block); if (page_rec_get_next(page_get_infimum_rec(page)) != rec) { /* Updated record is not the first user record on its page */ - - return; + return DB_SUCCESS; } const uint32_t prev_page_no = btr_page_get_prev(page); const page_id_t block_id{block->page.id()}; - const page_id_t prev_id(block_id.space(), prev_page_no); - - ut_ad(prev_page_no != FIL_NULL); - prev_block = buf_page_get_with_no_latch(prev_id, block->zip_size(), - mtr); -#ifdef UNIV_BTR_DEBUG - ut_a(btr_page_get_next(prev_block->page.frame) - == block->page.id().page_no()); -#endif /* UNIV_BTR_DEBUG */ + const page_id_t prev_id(block_id.space(), prev_page_no); + dberr_t err; + buf_block_t* prev_block + = buf_page_get_gen(prev_id, 0, RW_NO_LATCH, nullptr, + BUF_PEEK_IF_IN_POOL, mtr, &err); + /* Since we already held an x-latch on prev_block, it must + be available and not be corrupted unless the buffer pool got + corrupted somehow. */ + if (UNIV_UNLIKELY(!prev_block)) { + return err; + } + ut_ad(!memcmp_aligned<4>(prev_block->page.frame + FIL_PAGE_NEXT, + block->page.frame + FIL_PAGE_OFFSET, 4)); /* We must already have an x-latch on prev_block! */ ut_ad(mtr->memo_contains_flagged(prev_block, MTR_MEMO_PAGE_X_FIX)); @@ -4844,6 +3842,7 @@ btr_cur_pess_upd_restore_supremum( lock_rec_reset_and_inherit_gap_locks(*prev_block, block_id, PAGE_HEAP_NO_SUPREMUM, page_rec_get_heap_no(rec)); + return DB_SUCCESS; } /*************************************************************//** @@ -4899,7 +3898,8 @@ btr_cur_pessimistic_update( block = btr_cur_get_block(cursor); page_zip = buf_block_get_page_zip(block); - index = cursor->index; + index = cursor->index(); + ut_ad(index->has_locking()); ut_ad(mtr->memo_contains_flagged(&index->lock, MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); @@ -5038,7 +4038,13 @@ btr_cur_pessimistic_update( ut_ad(page_is_leaf(block->page.frame)); ut_ad(dict_index_is_clust(index)); - ut_ad(flags & BTR_KEEP_POS_FLAG); + if (UNIV_UNLIKELY(!(flags & BTR_KEEP_POS_FLAG))) { + ut_ad(page_zip != NULL); + dtuple_convert_back_big_rec(index, new_entry, + big_rec_vec); + big_rec_vec = NULL; + n_ext = dtuple_get_n_ext(new_entry); + } } /* Do lock checking and undo logging */ @@ -5050,18 +4056,17 @@ btr_cur_pessimistic_update( } if (optim_err == DB_OVERFLOW) { - /* First reserve enough free space for the file segments of the index tree, so that the update will not fail because of lack of space */ - uint32_t n_extents = uint32_t(cursor->tree_height / 16 + 3); - - if (!fsp_reserve_free_extents( - &n_reserved, index->table->space, n_extents, - flags & BTR_NO_UNDO_LOG_FLAG - ? FSP_CLEANING : FSP_NORMAL, - mtr)) { + err = fsp_reserve_free_extents( + &n_reserved, index->table->space, + uint32_t(cursor->tree_height / 16 + 3), + flags & BTR_NO_UNDO_LOG_FLAG + ? FSP_CLEANING : FSP_NORMAL, + mtr); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { err = DB_OUT_OF_FILE_SPACE; goto err_exit; } @@ -5096,9 +4101,7 @@ btr_cur_pessimistic_update( in the lock system delete the lock structs set on the root page even if the root page carries just node pointers. */ - if (!dict_table_is_locking_disabled(index->table)) { - lock_rec_store_on_page_infimum(block, rec); - } + lock_rec_store_on_page_infimum(block, rec); } #ifdef UNIV_ZIP_DEBUG @@ -5107,9 +4110,12 @@ btr_cur_pessimistic_update( #endif /* UNIV_ZIP_DEBUG */ page_cursor = btr_cur_get_page_cur(cursor); - page_cur_delete_rec(page_cursor, index, *offsets, mtr); + page_cur_delete_rec(page_cursor, *offsets, mtr); - page_cur_move_to_prev(page_cursor); + if (!page_cur_move_to_prev(page_cursor)) { + err = DB_CORRUPTION; + goto return_after_reservations; + } rec = btr_cur_insert_if_possible(cursor, new_entry, offsets, offsets_heap, n_ext, mtr); @@ -5122,7 +4128,10 @@ btr_cur_pessimistic_update( was a rollback, the shortened metadata record would have too many fields, and we would be unable to know the size of the freed record. */ - btr_page_reorganize(page_cursor, index, mtr); + err = btr_page_reorganize(page_cursor, mtr); + if (err != DB_SUCCESS) { + goto return_after_reservations; + } rec = page_cursor->rec; rec_offs_make_valid(rec, index, true, *offsets); if (page_cursor->block->page.id().page_no() @@ -5130,7 +4139,7 @@ btr_cur_pessimistic_update( btr_set_instant(page_cursor->block, *index, mtr); } - } else if (!dict_table_is_locking_disabled(index->table)) { + } else { lock_rec_restore_from_page_infimum( *btr_cur_get_block(cursor), rec, block->page.id()); @@ -5170,17 +4179,15 @@ btr_cur_pessimistic_update( } } - if (!srv_read_only_mode - && !big_rec_vec +#if 0 // FIXME: this used to be a no-op, and will cause trouble if enabled + if (!big_rec_vec && page_is_leaf(block->page.frame) && !dict_index_is_online_ddl(index)) { - - mtr_memo_release(mtr, &index->lock, - MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK); - + mtr->release(index->lock); /* NOTE: We cannot release root block latch here, because it has segment header and already modified in most of cases.*/ } +#endif err = DB_SUCCESS; goto return_after_reservations; @@ -5209,7 +4216,7 @@ btr_cur_pessimistic_update( /* btr_page_split_and_insert() in btr_cur_pessimistic_insert() invokes - mtr_memo_release(mtr, index->lock, MTR_MEMO_SX_LOCK). + mtr->release(index->lock). We must keep the index->lock when we created a big_rec, so that row_upd_clust_rec() can store the big_rec in the same mini-transaction. */ @@ -5234,10 +4241,10 @@ btr_cur_pessimistic_update( cursor, offsets, offsets_heap, new_entry, &rec, &dummy_big_rec, n_ext, NULL, mtr); - ut_a(rec); ut_a(err == DB_SUCCESS); + ut_a(rec); ut_a(dummy_big_rec == NULL); - ut_ad(rec_offs_validate(rec, cursor->index, *offsets)); + ut_ad(rec_offs_validate(rec, cursor->index(), *offsets)); page_cursor->rec = rec; /* Multiple transactions cannot simultaneously operate on the @@ -5274,9 +4281,12 @@ btr_cur_pessimistic_update( was a rollback, the shortened metadata record would have too many fields, and we would be unable to know the size of the freed record. */ - btr_page_reorganize(page_cursor, index, mtr); + err = btr_page_reorganize(page_cursor, mtr); + if (err != DB_SUCCESS) { + goto return_after_reservations; + } rec = page_cursor->rec; - } else if (!dict_table_is_locking_disabled(index->table)) { + } else { lock_rec_restore_from_page_infimum( *btr_cur_get_block(cursor), rec, block->page.id()); } @@ -5286,14 +4296,15 @@ btr_cur_pessimistic_update( record was nonexistent, the supremum might have inherited its locks from a wrong record. */ - if (!was_first && !dict_table_is_locking_disabled(index->table)) { - btr_cur_pess_upd_restore_supremum(btr_cur_get_block(cursor), - rec, mtr); + if (!was_first) { + err = btr_cur_pess_upd_restore_supremum( + btr_cur_get_block(cursor), rec, mtr); } return_after_reservations: #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(btr_cur_get_page_zip(cursor), + ut_a(err || + !page_zip || page_zip_validate(btr_cur_get_page_zip(cursor), btr_cur_get_page(cursor), index)); #endif /* UNIV_ZIP_DEBUG */ @@ -5400,12 +4411,8 @@ btr_cur_del_mark_set_clust_rec( << ib::hex(trx->id) << ": " << rec_printer(rec, offsets).str()); - if (dict_index_is_online_ddl(index)) { - row_log_table_delete(rec, index, offsets, NULL); - } - - btr_cur_upd_rec_sys(block, rec, index, offsets, trx, roll_ptr, mtr); - return(err); + return btr_cur_upd_rec_sys(block, rec, index, offsets, trx, roll_ptr, + mtr); } /*==================== B-TREE RECORD REMOVE =========================*/ @@ -5416,23 +4423,23 @@ that mtr holds an x-latch on the tree and on the cursor page. To avoid deadlocks, mtr must also own x-latches to brothers of page, if those brothers exist. NOTE: it is assumed that the caller has reserved enough free extents so that the compression will always succeed if done! -@return TRUE if compression occurred */ -ibool +@return whether compression occurred */ +bool btr_cur_compress_if_useful( /*=======================*/ btr_cur_t* cursor, /*!< in/out: cursor on the page to compress; cursor does not stay valid if !adjust and compression occurs */ - ibool adjust, /*!< in: TRUE if should adjust the - cursor position even if compression occurs */ + bool adjust, /*!< in: whether the cursor position should be + adjusted even when compression occurs */ mtr_t* mtr) /*!< in/out: mini-transaction */ { - ut_ad(mtr->memo_contains_flagged(&cursor->index->lock, + ut_ad(mtr->memo_contains_flagged(&cursor->index()->lock, MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); ut_ad(mtr->memo_contains_flagged(btr_cur_get_block(cursor), MTR_MEMO_PAGE_X_FIX)); - if (cursor->index->is_spatial()) { + if (cursor->index()->is_spatial()) { const trx_t* trx = cursor->rtr_info->thr ? thr_get_trx(cursor->rtr_info->thr) : NULL; @@ -5444,25 +4451,24 @@ btr_cur_compress_if_useful( } } - return(btr_cur_compress_recommendation(cursor, mtr) - && btr_compress(cursor, adjust, mtr)); + return btr_cur_compress_recommendation(cursor, mtr) + && btr_compress(cursor, adjust, mtr) == DB_SUCCESS; } /*******************************************************//** Removes the record on which the tree cursor is positioned on a leaf page. It is assumed that the mtr has an x-latch on the page where the cursor is positioned, but no latch on the whole tree. -@return TRUE if success, i.e., the page did not become too empty */ -ibool -btr_cur_optimistic_delete_func( -/*===========================*/ +@return error code +@retval DB_FAIL if the page would become too empty */ +dberr_t +btr_cur_optimistic_delete( +/*======================*/ btr_cur_t* cursor, /*!< in: cursor on leaf page, on the record to delete; cursor stays valid: if deletion succeeds, on function exit it points to the successor of the deleted record */ -#ifdef UNIV_DEBUG ulint flags, /*!< in: BTR_CREATE_FLAG or 0 */ -#endif /* UNIV_DEBUG */ mtr_t* mtr) /*!< in: mtr; if this function returns TRUE on a leaf page of a secondary index, the mtr must be committed @@ -5478,50 +4484,56 @@ btr_cur_optimistic_delete_func( ut_ad(flags == 0 || flags == BTR_CREATE_FLAG); ut_ad(mtr->memo_contains_flagged(btr_cur_get_block(cursor), MTR_MEMO_PAGE_X_FIX)); - ut_ad(mtr->is_named_space(cursor->index->table->space)); - ut_ad(!cursor->index->is_dummy); + ut_ad(mtr->is_named_space(cursor->index()->table->space)); + ut_ad(!cursor->index()->is_dummy); /* This is intended only for leaf page deletions */ block = btr_cur_get_block(cursor); - ut_ad(block->page.id().space() == cursor->index->table->space->id); + ut_ad(block->page.id().space() == cursor->index()->table->space->id); ut_ad(page_is_leaf(buf_block_get_frame(block))); - ut_ad(!dict_index_is_online_ddl(cursor->index) - || dict_index_is_clust(cursor->index) + ut_ad(!dict_index_is_online_ddl(cursor->index()) + || cursor->index()->is_clust() || (flags & BTR_CREATE_FLAG)); rec = btr_cur_get_rec(cursor); - offsets = rec_get_offsets(rec, cursor->index, offsets, - cursor->index->n_core_fields, + offsets = rec_get_offsets(rec, cursor->index(), offsets, + cursor->index()->n_core_fields, ULINT_UNDEFINED, &heap); - const ibool no_compress_needed = !rec_offs_any_extern(offsets) - && btr_cur_can_delete_without_compress( - cursor, rec_offs_size(offsets), mtr); - - if (!no_compress_needed) { + dberr_t err = DB_SUCCESS; + if (rec_offs_any_extern(offsets) + || !btr_cur_can_delete_without_compress(cursor, + rec_offs_size(offsets), + mtr)) { /* prefetch siblings of the leaf for the pessimistic operation. */ - btr_cur_prefetch_siblings(block, cursor->index); + btr_cur_prefetch_siblings(block, cursor->index()); + err = DB_FAIL; goto func_exit; } - if (UNIV_UNLIKELY(block->page.id().page_no() == cursor->index->page + if (UNIV_UNLIKELY(block->page.id().page_no() == cursor->index()->page && page_get_n_recs(block->page.frame) == 1 - + (cursor->index->is_instant() - && !rec_is_metadata(rec, *cursor->index)) - && !cursor->index->must_avoid_clear_instant_add())) { + + (cursor->index()->is_instant() + && !rec_is_metadata(rec, *cursor->index())) + && !cursor->index() + ->must_avoid_clear_instant_add())) { /* The whole index (and table) becomes logically empty. Empty the whole page. That is, if we are deleting the only user record, also delete the metadata record if one exists for instant ADD COLUMN (not generic ALTER TABLE). If we are deleting the metadata record and the table becomes empty, clean up the whole page. */ - dict_index_t* index = cursor->index; + dict_index_t* index = cursor->index(); const rec_t* first_rec = page_rec_get_next_const( page_get_infimum_rec(block->page.frame)); + if (UNIV_UNLIKELY(!first_rec)) { + err = DB_CORRUPTION; + goto func_exit; + } ut_ad(!index->is_instant() || rec_is_metadata(first_rec, *index)); const bool is_metadata = rec_is_metadata(rec, *index); @@ -5534,7 +4546,7 @@ btr_cur_optimistic_delete_func( || (first_rec != rec && rec_is_add_metadata(first_rec, *index)); if (UNIV_LIKELY(empty_table)) { - if (UNIV_LIKELY(!is_metadata)) { + if (UNIV_LIKELY(!is_metadata && !flags)) { lock_update_delete(block, rec); } btr_page_empty(block, buf_block_get_page_zip(block), @@ -5560,32 +4572,36 @@ btr_cur_optimistic_delete_func( If this is a recovered transaction, then index->is_instant() will hold until the insert into SYS_COLUMNS is rolled back. */ - ut_ad(cursor->index->table->supports_instant()); - ut_ad(cursor->index->is_primary()); + ut_ad(cursor->index()->table->supports_instant()); + ut_ad(cursor->index()->is_primary()); ut_ad(!page_zip); page_cur_delete_rec(btr_cur_get_page_cur(cursor), - cursor->index, offsets, mtr); + offsets, mtr); /* We must empty the PAGE_FREE list, because after rollback, this deleted metadata record would have too many fields, and we would be unable to know the size of the freed record. */ - btr_page_reorganize(btr_cur_get_page_cur(cursor), - cursor->index, mtr); + err = btr_page_reorganize(btr_cur_get_page_cur(cursor), + mtr); goto func_exit; } else { - lock_update_delete(block, rec); + if (!flags) { + lock_update_delete(block, rec); + } btr_search_update_hash_on_delete(cursor); } if (page_zip) { #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page, cursor->index)); + ut_a(page_zip_validate(page_zip, page, + cursor->index())); #endif /* UNIV_ZIP_DEBUG */ page_cur_delete_rec(btr_cur_get_page_cur(cursor), - cursor->index, offsets, mtr); + offsets, mtr); #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page, cursor->index)); + ut_a(page_zip_validate(page_zip, page, + cursor->index())); #endif /* UNIV_ZIP_DEBUG */ /* On compressed pages, the IBUF_BITMAP_FREE @@ -5599,14 +4615,14 @@ btr_cur_optimistic_delete_func( page, 1); page_cur_delete_rec(btr_cur_get_page_cur(cursor), - cursor->index, offsets, mtr); + offsets, mtr); /* The change buffer does not handle inserts into non-leaf pages, into clustered indexes, or into the change buffer. */ - if (!dict_index_is_clust(cursor->index) - && !cursor->index->table->is_temporary() - && !dict_index_is_ibuf(cursor->index)) { + if (!cursor->index()->is_clust() + && !cursor->index()->table->is_temporary() + && !dict_index_is_ibuf(cursor->index())) { ibuf_update_free_bits_low(block, max_ins, mtr); } } @@ -5617,7 +4633,7 @@ btr_cur_optimistic_delete_func( mem_heap_free(heap); } - return(no_compress_needed); + return err; } /*************************************************************//** @@ -5655,7 +4671,6 @@ btr_cur_pessimistic_delete( dict_index_t* index; rec_t* rec; uint32_t n_reserved = 0; - bool success; ibool ret = FALSE; mem_heap_t* heap; rec_offs* offsets; @@ -5685,13 +4700,11 @@ btr_cur_pessimistic_delete( uint32_t n_extents = uint32_t(cursor->tree_height / 32 + 1); - success = fsp_reserve_free_extents(&n_reserved, - index->table->space, - n_extents, - FSP_CLEANING, mtr); - if (!success) { - *err = DB_OUT_OF_FILE_SPACE; - + *err = fsp_reserve_free_extents(&n_reserved, + index->table->space, + n_extents, + FSP_CLEANING, mtr); + if (UNIV_UNLIKELY(*err != DB_SUCCESS)) { return(FALSE); } } @@ -5752,6 +4765,10 @@ btr_cur_pessimistic_delete( const rec_t* first_rec = page_rec_get_next_const( page_get_infimum_rec(page)); + if (UNIV_UNLIKELY(!first_rec)) { + *err = DB_CORRUPTION; + goto err_exit; + } ut_ad(!index->is_instant() || rec_is_metadata(first_rec, *index)); if (is_metadata || !index->is_instant() @@ -5775,15 +4792,15 @@ btr_cur_pessimistic_delete( btr_search_update_hash_on_delete(cursor); } else { page_cur_delete_rec(btr_cur_get_page_cur(cursor), - index, offsets, mtr); + offsets, mtr); /* We must empty the PAGE_FREE list, because after rollback, this deleted metadata record would carry too many fields, and we would be unable to know the size of the freed record. */ - btr_page_reorganize(btr_cur_get_page_cur(cursor), - index, mtr); + *err = btr_page_reorganize(btr_cur_get_page_cur(cursor), + mtr); ut_ad(!ret); - goto return_after_reservations; + goto err_exit; } } else if (UNIV_UNLIKELY(page_rec_is_first(rec, page))) { if (page_rec_is_last(rec, page)) { @@ -5798,7 +4815,15 @@ btr_cur_pessimistic_delete( goto return_after_reservations; } - next_rec = page_rec_get_next(rec); + if (UNIV_UNLIKELY(!(next_rec = page_rec_get_next(rec)))) { + ut_ad(!ret); + *err = DB_CORRUPTION; + goto err_exit; + } + + btr_cur_t cursor; + cursor.page_cur.index = index; + cursor.page_cur.block = block; if (!page_has_prev(page)) { /* If we delete the leftmost node pointer on a @@ -5811,56 +4836,56 @@ btr_cur_pessimistic_delete( we need to update parent page. */ rtr_mbr_t father_mbr; rec_t* father_rec; - btr_cur_t father_cursor; rec_offs* offsets; - bool upd_ret; ulint len; - rtr_page_get_father_block(NULL, heap, index, - block, mtr, NULL, - &father_cursor); - offsets = rec_get_offsets( - btr_cur_get_rec(&father_cursor), index, NULL, - 0, ULINT_UNDEFINED, &heap); + rtr_page_get_father_block(NULL, heap, mtr, NULL, + &cursor); + father_rec = btr_cur_get_rec(&cursor); + offsets = rec_get_offsets(father_rec, index, NULL, + 0, ULINT_UNDEFINED, &heap); - father_rec = btr_cur_get_rec(&father_cursor); rtr_read_mbr(rec_get_nth_field( father_rec, offsets, 0, &len), &father_mbr); - upd_ret = rtr_update_mbr_field(&father_cursor, offsets, - NULL, page, &father_mbr, - next_rec, mtr); - - if (!upd_ret) { - *err = DB_ERROR; - - mem_heap_free(heap); - return(FALSE); - } - + rtr_update_mbr_field(&cursor, offsets, NULL, + page, &father_mbr, next_rec, mtr); ut_d(parent_latched = true); } else { /* Otherwise, if we delete the leftmost node pointer on a page, we have to change the parent node pointer so that it is equal to the new leftmost node pointer on the page */ - btr_cur_t cursor; - btr_page_get_father(index, block, mtr, &cursor); - btr_cur_node_ptr_delete(&cursor, mtr); + ret = btr_page_get_father(mtr, &cursor); + if (!ret) { + *err = DB_CORRUPTION; + goto err_exit; + } + *err = btr_cur_node_ptr_delete(&cursor, mtr); + if (*err != DB_SUCCESS) { +got_err: + ret = FALSE; + goto err_exit; + } + const ulint level = btr_page_get_level(page); // FIXME: reuse the node_ptr from above dtuple_t* node_ptr = dict_index_build_node_ptr( index, next_rec, block->page.id().page_no(), heap, level); - btr_insert_on_non_leaf_level( + *err = btr_insert_on_non_leaf_level( flags, index, level + 1, node_ptr, mtr); + if (*err != DB_SUCCESS) { + ret = FALSE; + goto got_err; + } ut_d(parent_latched = true); } } - /* SPATIAL INDEX never use SX locks; we can allow page merges + /* SPATIAL INDEX never use U locks; we can allow page merges while holding X lock on the spatial index tree. Do not allow merges of non-leaf B-tree pages unless it is safe to do so. */ @@ -5871,7 +4896,7 @@ btr_cur_pessimistic_delete( index, page, BTR_INTENTION_DELETE, rec, btr_node_ptr_max_size(index), block->zip_size(), mtr); - page_cur_delete_rec(btr_cur_get_page_cur(cursor), index, + page_cur_delete_rec(btr_cur_get_page_cur(cursor), offsets, mtr); if (min_mark_next_rec) { @@ -5901,19 +4926,17 @@ btr_cur_pessimistic_delete( return_after_reservations: *err = DB_SUCCESS; - +err_exit: mem_heap_free(heap); - if (!srv_read_only_mode - && page_is_leaf(page) +#if 0 // FIXME: this used to be a no-op, and will cause trouble if enabled + if (page_is_leaf(page) && !dict_index_is_online_ddl(index)) { - - mtr_memo_release(mtr, &index->lock, - MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK); - + mtr->release(index->lock); /* NOTE: We cannot release root block latch here, because it has segment header and already modified in most of cases.*/ } +#endif index->table->space->release_free_extents(n_reserved); return(ret); @@ -5922,7 +4945,7 @@ btr_cur_pessimistic_delete( /** Delete the node pointer in a parent page. @param[in,out] parent cursor pointing to parent record @param[in,out] mtr mini-transaction */ -void btr_cur_node_ptr_delete(btr_cur_t* parent, mtr_t* mtr) +dberr_t btr_cur_node_ptr_delete(btr_cur_t* parent, mtr_t* mtr) { ut_ad(mtr->memo_contains_flagged(btr_cur_get_block(parent), MTR_MEMO_PAGE_X_FIX)); @@ -5930,615 +4953,661 @@ void btr_cur_node_ptr_delete(btr_cur_t* parent, mtr_t* mtr) ibool compressed = btr_cur_pessimistic_delete(&err, TRUE, parent, BTR_CREATE_FLAG, false, mtr); - ut_a(err == DB_SUCCESS); - if (!compressed) { + if (err == DB_SUCCESS && !compressed) { btr_cur_compress_if_useful(parent, FALSE, mtr); } + + return err; } -/*******************************************************************//** -Adds path information to the cursor for the current page, for which -the binary search has been performed. */ -static -void -btr_cur_add_path_info( -/*==================*/ - btr_cur_t* cursor, /*!< in: cursor positioned on a page */ - ulint height, /*!< in: height of the page in tree; - 0 means leaf node */ - ulint root_height) /*!< in: root node height in tree */ +/** Represents the cursor for the number of rows estimation. The +content is used for level-by-level diving and estimation the number of rows +on each level. */ +class btr_est_cur_t { - btr_path_t* slot; - - ut_a(cursor->path_arr); + /* Assume a page like: + records: (inf, a, b, c, d, sup) + index of the record: 0, 1, 2, 3, 4, 5 + */ + + /** Index of the record where the page cursor stopped on this level + (index in alphabetical order). In the above example, if the search stopped on + record 'c', then nth_rec will be 3. */ + ulint m_nth_rec; + + /** Number of the records on the page, not counting inf and sup. + In the above example n_recs will be 4. */ + ulint m_n_recs; + + /** Search tuple */ + const dtuple_t &m_tuple; + /** Cursor search mode */ + page_cur_mode_t m_mode; + /** Page cursor which is used for search */ + page_cur_t m_page_cur; + /** Page id of the page to get on level down, can differ from + m_block->page.id at the moment when the child's page id is already found, but + the child's block has not fetched yet */ + page_id_t m_page_id; + /** Current block */ + buf_block_t *m_block; + /** mtr savepoint of the current block */ + ulint m_savepoint; + /** Page search mode, can differ from m_mode for non-leaf pages, see c-tor + comments for details */ + page_cur_mode_t m_page_mode; + + /** Matched fields and bytes which are used for on-page search, see + btr_cur_t::(up|low)_(match|bytes) comments for details */ + ulint m_up_match= 0; + ulint m_up_bytes= 0; + ulint m_low_match= 0; + ulint m_low_bytes= 0; + +public: + btr_est_cur_t(dict_index_t *index, const dtuple_t &tuple, + page_cur_mode_t mode) + : m_tuple(tuple), m_mode(mode), + m_page_id(index->table->space_id, index->page), m_block(nullptr) + { - if (root_height >= BTR_PATH_ARRAY_N_SLOTS - 1) { - /* Do nothing; return empty path */ + ut_ad(dict_index_check_search_tuple(index, &tuple)); + ut_ad(dtuple_check_typed(&tuple)); + + m_page_cur.index = index; + /* We use these modified search modes on non-leaf levels of the B-tree. + These let us end up in the right B-tree leaf. In that leaf we use the + original search mode. */ + switch (mode) { + case PAGE_CUR_GE: + m_page_mode= PAGE_CUR_L; + break; + case PAGE_CUR_G: + m_page_mode= PAGE_CUR_LE; + break; + default: +#ifdef PAGE_CUR_LE_OR_EXTENDS + ut_ad(mode == PAGE_CUR_L || mode == PAGE_CUR_LE || + mode == PAGE_CUR_LE_OR_EXTENDS); +#else /* PAGE_CUR_LE_OR_EXTENDS */ + ut_ad(mode == PAGE_CUR_L || mode == PAGE_CUR_LE); +#endif /* PAGE_CUR_LE_OR_EXTENDS */ + m_page_mode= mode; + break; + } + } - slot = cursor->path_arr; - slot->nth_rec = ULINT_UNDEFINED; + /** Retrieve block with m_page_id, release the previously gotten block + if necessary. If this is a left border block cursor and both left and right + border blocks have the same parent, don't unlatch the parent, as it must be + latched to get the right block, and will be unlatched after the right block + is fetched. + @param level distance from the leaf page level; ULINT_UNDEFINED when + fetching the root page + @param mtr mtr + @param right_parent right border block parent, nullptr if the function + is called for the right block itself + @return true on success or false otherwise. */ + bool fetch_child(ulint level, mtr_t &mtr, const buf_block_t *right_parent) + { + buf_block_t *parent_block= m_block; + ulint parent_savepoint= m_savepoint; - return; - } + m_block= btr_block_get(*index(), m_page_id.page_no(), RW_S_LATCH, !level, + &mtr, nullptr); + if (!m_block) + return false; - if (height == 0) { - /* Mark end of slots for path */ - slot = cursor->path_arr + root_height + 1; - slot->nth_rec = ULINT_UNDEFINED; - } + if (parent_block && parent_block != right_parent) + mtr.rollback_to_savepoint(parent_savepoint, parent_savepoint + 1); - slot = cursor->path_arr + (root_height - height); + m_savepoint= mtr.get_savepoint() - 1; - const buf_block_t* block = btr_cur_get_block(cursor); + return level == ULINT_UNDEFINED || + btr_page_get_level(m_block->page.frame) == level; + } - slot->nth_rec = page_rec_get_n_recs_before(btr_cur_get_rec(cursor)); - slot->n_recs = page_get_n_recs(block->page.frame); - slot->page_no = block->page.id().page_no(); - slot->page_level = btr_page_get_level(block->page.frame); -} + /** Sets page mode for leaves */ + void set_page_mode_for_leaves() { m_page_mode= m_mode; } -/*******************************************************************//** -Estimate the number of rows between slot1 and slot2 for any level on a -B-tree. This function starts from slot1->page and reads a few pages to -the right, counting their records. If we reach slot2->page quickly then -we know exactly how many records there are between slot1 and slot2 and -we set is_n_rows_exact to TRUE. If we cannot reach slot2->page quickly -then we calculate the average number of records in the pages scanned -so far and assume that all pages that we did not scan up to slot2->page -contain the same number of records, then we multiply that average to -the number of pages between slot1->page and slot2->page (which is -n_rows_on_prev_level). In this case we set is_n_rows_exact to FALSE. -@return number of rows, not including the borders (exact or estimated) */ -static -ha_rows -btr_estimate_n_rows_in_range_on_level( -/*==================================*/ - dict_index_t* index, /*!< in: index */ - btr_path_t* slot1, /*!< in: left border */ - btr_path_t* slot2, /*!< in: right border */ - ha_rows n_rows_on_prev_level, /*!< in: number of rows - on the previous level for the - same descend paths; used to - determine the number of pages - on this level */ - bool* is_n_rows_exact) /*!< out: TRUE if the returned - value is exact i.e. not an - estimation */ -{ - ha_rows n_rows = 0; - uint n_pages_read = 0; - ulint level; + /** Does search on the current page. If there is no border in m_tuple, then + just move the cursor to the most left or right record. + @param level current level on tree. + @param root_height root height + @param left true if this is left border, false otherwise. + @return true on success, false otherwise. */ + bool search_on_page(ulint level, ulint root_height, bool left) + { + if (level != btr_page_get_level(m_block->page.frame)) + return false; - /* Assume by default that we will scan all pages between - slot1->page_no and slot2->page_no. */ - *is_n_rows_exact = true; + m_n_recs= page_get_n_recs(m_block->page.frame); - /* Add records from slot1->page_no which are to the right of - the record which serves as a left border of the range, if any - (we don't include the record itself in this count). */ - if (slot1->nth_rec <= slot1->n_recs) { - n_rows += slot1->n_recs - slot1->nth_rec; - } + if (dtuple_get_n_fields(&m_tuple) > 0) + { + m_up_bytes= m_low_bytes= 0; + m_page_cur.block= m_block; + if (page_cur_search_with_match(&m_tuple, m_page_mode, + &m_up_match, &m_low_match, &m_page_cur, + nullptr)) + return false; + m_nth_rec= page_rec_get_n_recs_before(page_cur_get_rec(&m_page_cur)); + } + else if (left) + { + page_cur_set_before_first(m_block, &m_page_cur); + if (level) + { + if (!page_cur_move_to_next(&m_page_cur)) + return false; + m_nth_rec= 1; + } + else + m_nth_rec= 0; + } + else + { + m_nth_rec= m_n_recs; + if (!level) + { + page_cur_set_after_last(m_block, &m_page_cur); + ++m_nth_rec; + } + else + { + m_page_cur.block= m_block; + m_page_cur.rec= page_rec_get_nth(m_block->page.frame, m_nth_rec); + } + } - /* Add records from slot2->page_no which are to the left of - the record which servers as a right border of the range, if any - (we don't include the record itself in this count). */ - if (slot2->nth_rec > 1) { - n_rows += slot2->nth_rec - 1; - } + return true; + } - /* Count the records in the pages between slot1->page_no and - slot2->page_no (non inclusive), if any. */ + /** Gets page id of the current record child. + @param offsets offsets array. + @param heap heap for offsets array */ + void get_child(rec_offs **offsets, mem_heap_t **heap) + { + const rec_t *node_ptr= page_cur_get_rec(&m_page_cur); - /* Do not read more than this number of pages in order not to hurt - performance with this code which is just an estimation. If we read - this many pages before reaching slot2->page_no then we estimate the - average from the pages scanned so far. */ -# define N_PAGES_READ_LIMIT 10 + /* FIXME: get the child page number directly without computing offsets */ + *offsets= rec_get_offsets(node_ptr, index(), *offsets, 0, ULINT_UNDEFINED, + heap); - const fil_space_t* space = index->table->space; - page_id_t page_id(space->id, slot1->page_no); - const ulint zip_size = space->zip_size(); + /* Go to the child node */ + m_page_id.set_page_no(btr_node_ptr_get_child_page_no(node_ptr, *offsets)); + } - level = slot1->page_level; + /** @return true if left border should be counted */ + bool should_count_the_left_border() const + { + if (dtuple_get_n_fields(&m_tuple) > 0) + { + ut_ad(!page_rec_is_infimum(page_cur_get_rec(&m_page_cur))); + return !page_rec_is_supremum(page_cur_get_rec(&m_page_cur)); + } + ut_ad(page_rec_is_infimum(page_cur_get_rec(&m_page_cur))); + return false; + } - do { - mtr_t mtr; - page_t* page; - buf_block_t* block; - dberr_t err=DB_SUCCESS; + /** @return true if right border should be counted */ + bool should_count_the_right_border() const + { + if (dtuple_get_n_fields(&m_tuple) > 0) + { + const rec_t *rec= page_cur_get_rec(&m_page_cur); + ut_ad(!(m_mode == PAGE_CUR_L && page_rec_is_supremum(rec))); + + return (m_mode == PAGE_CUR_LE /* if the range is '<=' */ + /* and the record was found */ + && m_low_match >= dtuple_get_n_fields(&m_tuple)) || + (m_mode == PAGE_CUR_L /* or if the range is '<' */ + /* and there are any records to match the criteria, i.e. if the + minimum record on the tree is 5 and x < 7 is specified then the + cursor will be positioned at 5 and we should count the border, + but if x < 2 is specified, then the cursor will be positioned at + 'inf' and we should not count the border */ + && !page_rec_is_infimum(rec)); + /* Notice that for "WHERE col <= 'foo'" the server passes to + ha_innobase::records_in_range(): min_key=NULL (left-unbounded) which is + expected max_key='foo' flag=HA_READ_AFTER_KEY (PAGE_CUR_G), which is + unexpected - one would expect flag=HA_READ_KEY_OR_PREV (PAGE_CUR_LE). In + this case the cursor will be positioned on the first record to the right + of the requested one (can also be positioned on the 'sup') and we should + not count the right border. */ + } + ut_ad(page_rec_is_supremum(page_cur_get_rec(&m_page_cur))); - mtr_start(&mtr); + /* The range specified is without a right border, just 'x > 123' + or 'x >= 123' and search_on_page() positioned the cursor on the + supremum record on the rightmost page, which must not be counted. */ + return false; + } - /* Fetch the page. Because we are not holding the - index->lock, the tree may have changed and we may be - attempting to read a page that is no longer part of - the B-tree. We pass BUF_GET_POSSIBLY_FREED in order to - silence a debug assertion about this. */ - block = buf_page_get_gen(page_id, zip_size, RW_S_LATCH, - NULL, BUF_GET_POSSIBLY_FREED, - &mtr, &err); + /** @return index */ + const dict_index_t *index() const { return m_page_cur.index; } - ut_ad((block != NULL) == (err == DB_SUCCESS)); + /** @return current block */ + const buf_block_t *block() const { return m_block; } - if (!block) { - if (err == DB_DECRYPTION_FAILED) { - ib_push_warning((void *)NULL, - DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name.m_name); - index->table->file_unreadable = true; - } + /** @return current page id */ + page_id_t page_id() const { return m_page_id; } - mtr_commit(&mtr); - goto inexact; - } + /** Copies block pointer and savepoint from another btr_est_cur_t in the case + if both left and right border cursors point to the same block. + @param o reference to the other btr_est_cur_t object. */ + void set_block(const btr_est_cur_t &o) + { + m_block= o.m_block; + m_savepoint= o.m_savepoint; + } - page = buf_block_get_frame(block); + /** @return current record number. */ + ulint nth_rec() const { return m_nth_rec; } - /* It is possible that the tree has been reorganized in the - meantime and this is a different page. If this happens the - calculated estimate will be bogus, which is not fatal as - this is only an estimate. We are sure that a page with - page_no exists because InnoDB never frees pages, only - reuses them. */ - if (!fil_page_index_page_check(page) - || btr_page_get_index_id(page) != index->id - || btr_page_get_level(page) != level) { - - /* The page got reused for something else */ - mtr_commit(&mtr); - goto inexact; - } + /** @return number of records in the current page. */ + ulint n_recs() const { return m_n_recs; } +}; - /* It is possible but highly unlikely that the page was - originally written by an old version of InnoDB that did - not initialize FIL_PAGE_TYPE on other than B-tree pages. - For example, this could be an almost-empty BLOB page - that happens to contain the magic values in the fields - that we checked above. */ +/** Estimate the number of rows between the left record of the path and the +right one(non-inclusive) for the certain level on a B-tree. This function +starts from the page next to the left page and reads a few pages to the right, +counting their records. If we reach the right page quickly then we know exactly +how many records there are between left and right records and we set +is_n_rows_exact to true. After some page is latched, the previous page is +unlatched. If we cannot reach the right page quickly then we calculate the +average number of records in the pages scanned so far and assume that all pages +that we did not scan up to the right page contain the same number of records, +then we multiply that average to the number of pages between right and left +records (which is n_rows_on_prev_level). In this case we set is_n_rows_exact to +false. +@param level current level. +@param left_cur the cursor of the left page. +@param right_page_no right page number. +@param n_rows_on_prev_level number of rows on the previous level. +@param[out] is_n_rows_exact true if exact rows number is returned. +@param[in,out] mtr mtr, +@return number of rows, not including the borders (exact or estimated). */ +static ha_rows btr_estimate_n_rows_in_range_on_level( + ulint level, btr_est_cur_t &left_cur, uint32_t right_page_no, + ha_rows n_rows_on_prev_level, bool &is_n_rows_exact, mtr_t &mtr) +{ + ha_rows n_rows= 0; + uint n_pages_read= 0; + /* Do not read more than this number of pages in order not to hurt + performance with this code which is just an estimation. If we read this many + pages before reaching right_page_no, then we estimate the average from the + pages scanned so far. */ + static constexpr uint n_pages_read_limit= 9; + ulint savepoint= 0; + buf_block_t *block= nullptr; + const dict_index_t *index= left_cur.index(); + + /* Assume by default that we will scan all pages between left and right(non + inclusive) pages */ + is_n_rows_exact= true; + + /* Add records from the left page which are to the right of the record which + serves as a left border of the range, if any (we don't include the record + itself in this count). */ + if (left_cur.nth_rec() <= left_cur.n_recs()) + { + n_rows+= left_cur.n_recs() - left_cur.nth_rec(); + } - n_pages_read++; + /* Count the records in the pages between left and right (non inclusive) + pages */ - if (page_id.page_no() != slot1->page_no) { - /* Do not count the records on slot1->page_no, - we already counted them before this loop. */ - n_rows += page_get_n_recs(page); - } + const fil_space_t *space= index->table->space; + page_id_t page_id(space->id, + btr_page_get_next(buf_block_get_frame(left_cur.block()))); - page_id.set_page_no(btr_page_get_next(page)); + if (page_id.page_no() == FIL_NULL) + goto inexact; - mtr_commit(&mtr); + do + { + page_t *page; + buf_block_t *prev_block= block; + ulint prev_savepoint= savepoint; - if (n_pages_read == N_PAGES_READ_LIMIT - || page_id.page_no() == FIL_NULL) { - /* Either we read too many pages or - we reached the end of the level without passing - through slot2->page_no, the tree must have changed - in the meantime */ - goto inexact; - } + savepoint= mtr.get_savepoint(); - } while (page_id.page_no() != slot2->page_no); + /* Fetch the page. */ + block= btr_block_get(*index, page_id.page_no(), RW_S_LATCH, !level, &mtr, + nullptr); - return(n_rows); + if (prev_block) + { + mtr.rollback_to_savepoint(prev_savepoint, prev_savepoint + 1); + if (block) + savepoint--; + } -inexact: + if (!block || btr_page_get_level(buf_block_get_frame(block)) != level) + goto inexact; - *is_n_rows_exact = false; + page= buf_block_get_frame(block); - /* We did interrupt before reaching slot2->page */ + /* It is possible but highly unlikely that the page was originally written + by an old version of InnoDB that did not initialize FIL_PAGE_TYPE on other + than B-tree pages. For example, this could be an almost-empty BLOB page + that happens to contain the magic values in the fields + that we checked above. */ - if (n_pages_read > 0) { - /* The number of pages on this level is - n_rows_on_prev_level, multiply it by the - average number of recs per page so far */ - n_rows = n_rows_on_prev_level * n_rows / n_pages_read; - } else { - /* The tree changed before we could even - start with slot1->page_no */ - n_rows = 10; - } + n_pages_read++; - return(n_rows); -} + n_rows+= page_get_n_recs(page); -/** If the tree gets changed too much between the two dives for the left -and right boundary then btr_estimate_n_rows_in_range_low() will retry -that many times before giving up and returning the value stored in -rows_in_range_arbitrary_ret_val. */ -static const unsigned rows_in_range_max_retries = 4; + page_id.set_page_no(btr_page_get_next(page)); -/** We pretend that a range has that many records if the tree keeps changing -for rows_in_range_max_retries retries while we try to estimate the records -in a given range. */ -static const ha_rows rows_in_range_arbitrary_ret_val = 10; + if (n_pages_read == n_pages_read_limit) + { + /* We read too many pages or we reached the end of the level + without passing through right_page_no. */ + goto inexact; + } -/** Estimates the number of rows in a given index range. -@param[in] index index -@param[in] tuple1 range start -@param[in] tuple2 range end -@param[in] nth_attempt if the tree gets modified too much while -we are trying to analyze it, then we will retry (this function will call -itself, incrementing this parameter) -@return estimated number of rows; if after rows_in_range_max_retries -retries the tree keeps changing, then we will just return -rows_in_range_arbitrary_ret_val as a result (if -nth_attempt >= rows_in_range_max_retries and the tree is modified between -the two dives). */ -static -ha_rows -btr_estimate_n_rows_in_range_low( - dict_index_t* index, - btr_pos_t* tuple1, - btr_pos_t* tuple2, - unsigned nth_attempt) -{ - btr_path_t path1[BTR_PATH_ARRAY_N_SLOTS]; - btr_path_t path2[BTR_PATH_ARRAY_N_SLOTS]; - btr_cur_t cursor; - btr_path_t* slot1; - btr_path_t* slot2; - bool diverged; - bool diverged_lot; - ulint divergence_level; - ha_rows n_rows; - bool is_n_rows_exact; - ulint i; - mtr_t mtr; - ha_rows table_n_rows; - page_cur_mode_t mode2= tuple2->mode; + } while (page_id.page_no() != right_page_no); - table_n_rows = dict_table_get_n_rows(index->table); + if (block) + { + ut_ad(block == mtr.at_savepoint(savepoint)); + mtr.rollback_to_savepoint(savepoint, savepoint + 1); + } - /* Below we dive to the two records specified by tuple1 and tuple2 and - we remember the entire dive paths from the tree root. The place where - the tuple1 path ends on the leaf level we call "left border" of our - interval and the place where the tuple2 path ends on the leaf level - - "right border". We take care to either include or exclude the interval - boundaries depending on whether <, <=, > or >= was specified. For - example if "5 < x AND x <= 10" then we should not include the left - boundary, but should include the right one. */ + return (n_rows); - mtr_start(&mtr); +inexact: - cursor.path_arr = path1; + if (block) + { + ut_ad(block == mtr.at_savepoint(savepoint)); + mtr.rollback_to_savepoint(savepoint, savepoint + 1); + } - bool should_count_the_left_border; + is_n_rows_exact= false; - if (dtuple_get_n_fields(tuple1->tuple) > 0) { + /* We did interrupt before reaching right page */ - btr_cur_search_to_nth_level(index, 0, tuple1->tuple, - tuple1->mode, - BTR_SEARCH_LEAF | BTR_ESTIMATE, - &cursor, 0, &mtr); + if (n_pages_read > 0) + { + /* The number of pages on this level is + n_rows_on_prev_level, multiply it by the + average number of recs per page so far */ + n_rows= n_rows_on_prev_level * n_rows / n_pages_read; + } + else + { + n_rows= 10; + } - ut_ad(!page_rec_is_infimum(btr_cur_get_rec(&cursor))); + return (n_rows); +} - /* We should count the border if there are any records to - match the criteria, i.e. if the maximum record on the tree is - 5 and x > 3 is specified then the cursor will be positioned at - 5 and we should count the border, but if x > 7 is specified, - then the cursor will be positioned at 'sup' on the rightmost - leaf page in the tree and we should not count the border. */ - should_count_the_left_border - = !page_rec_is_supremum(btr_cur_get_rec(&cursor)); - } else { - dberr_t err = DB_SUCCESS; +/** Estimates the number of rows in a given index range. Do search in the left +page, then if there are pages between left and right ones, read a few pages to +the right, if the right page is reached, count the exact number of rows without +fetching the right page, the right page will be fetched in the caller of this +function and the amount of its rows will be added. If the right page is not +reached, count the estimated(see btr_estimate_n_rows_in_range_on_level() for +details) rows number, and fetch the right page. If leaves are reached, unlatch +non-leaf pages except the right leaf parent. After the right leaf page is +fetched, commit mtr. +@param[in] index index +@param[in] range_start range start +@param[in] range_end range end +@return estimated number of rows; */ +ha_rows btr_estimate_n_rows_in_range(dict_index_t *index, + btr_pos_t *range_start, + btr_pos_t *range_end) +{ + DBUG_ENTER("btr_estimate_n_rows_in_range"); - err = btr_cur_open_at_index_side(true, index, - BTR_SEARCH_LEAF | BTR_ESTIMATE, - &cursor, 0, &mtr); + if (UNIV_UNLIKELY(index->page == FIL_NULL || index->is_corrupted())) + DBUG_RETURN(0); - if (err != DB_SUCCESS) { - ib::warn() << " Error code: " << err - << " btr_estimate_n_rows_in_range_low " - << " called from file: " - << __FILE__ << " line: " << __LINE__ - << " table: " << index->table->name - << " index: " << index->name; - } + ut_ad(index->is_btree()); - ut_ad(page_rec_is_infimum(btr_cur_get_rec(&cursor))); + btr_est_cur_t p1(index, *range_start->tuple, range_start->mode); + btr_est_cur_t p2(index, *range_end->tuple, range_end->mode); + mtr_t mtr; - /* The range specified is wihout a left border, just - 'x < 123' or 'x <= 123' and btr_cur_open_at_index_side() - positioned the cursor on the infimum record on the leftmost - page, which must not be counted. */ - should_count_the_left_border = false; - } + ulint height; + ulint root_height= 0; /* remove warning */ - tuple1->page_id= cursor.page_cur.block->page.id(); + mem_heap_t *heap= NULL; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs *offsets= offsets_; + rec_offs_init(offsets_); - mtr_commit(&mtr); + mtr.start(); - if (!index->is_readable()) { - return 0; - } + ut_ad(mtr.get_savepoint() == 0); + mtr_s_lock_index(index, &mtr); - mtr_start(&mtr); + ha_rows table_n_rows= dict_table_get_n_rows(index->table); - cursor.path_arr = path2; + height= ULINT_UNDEFINED; - bool should_count_the_right_border; + /* This becomes true when the two paths do not pass through the same pages + anymore. */ + bool diverged= false; + /* This is the height, i.e. the number of levels from the root, where paths + are not the same or adjacent any more. */ + ulint divergence_height= ULINT_UNDEFINED; + bool should_count_the_left_border= true; + bool should_count_the_right_border= true; + bool is_n_rows_exact= true; + ha_rows n_rows= 0; - if (dtuple_get_n_fields(tuple2->tuple) > 0) { + /* Loop and search until we arrive at the desired level. */ +search_loop: + if (!p1.fetch_child(height, mtr, p2.block())) + goto error; - btr_cur_search_to_nth_level(index, 0, tuple2->tuple, - mode2, - BTR_SEARCH_LEAF | BTR_ESTIMATE, - &cursor, 0, &mtr); + if (height == ULINT_UNDEFINED) + { + /* We are in the root node */ + height= btr_page_get_level(buf_block_get_frame(p1.block())); + root_height= height; + } - const rec_t* rec = btr_cur_get_rec(&cursor); + if (!height) + { + p1.set_page_mode_for_leaves(); + p2.set_page_mode_for_leaves(); + } - ut_ad(!(mode2 == PAGE_CUR_L && page_rec_is_supremum(rec))); + if (p1.page_id() == p2.page_id()) + p2.set_block(p1); + else + { + ut_ad(diverged); + if (divergence_height != ULINT_UNDEFINED) { + /* We need to call p1.search_on_page() here as + btr_estimate_n_rows_in_range_on_level() uses p1.m_n_recs and + p1.m_nth_rec. */ + if (!p1.search_on_page(height, root_height, true)) + goto error; + n_rows= btr_estimate_n_rows_in_range_on_level( + height, p1, p2.page_id().page_no(), n_rows, is_n_rows_exact, mtr); + } + if (!p2.fetch_child(height, mtr, nullptr)) + goto error; + } - should_count_the_right_border - = (mode2 == PAGE_CUR_LE /* if the range is '<=' */ - /* and the record was found */ - && cursor.low_match >= dtuple_get_n_fields(tuple2->tuple)) - || (mode2 == PAGE_CUR_L /* or if the range is '<' */ - /* and there are any records to match the criteria, - i.e. if the minimum record on the tree is 5 and - x < 7 is specified then the cursor will be - positioned at 5 and we should count the border, but - if x < 2 is specified, then the cursor will be - positioned at 'inf' and we should not count the - border */ - && !page_rec_is_infimum(rec)); - /* Notice that for "WHERE col <= 'foo'" MySQL passes to - ha_innobase::records_in_range(): - min_key=NULL (left-unbounded) which is expected - max_key='foo' flag=HA_READ_AFTER_KEY (PAGE_CUR_G), which is - unexpected - one would expect - flag=HA_READ_KEY_OR_PREV (PAGE_CUR_LE). In this case the - cursor will be positioned on the first record to the right of - the requested one (can also be positioned on the 'sup') and - we should not count the right border. */ - } else { - dberr_t err = DB_SUCCESS; + if (height == 0) + /* There is no need to release non-leaf pages here as they must already be + unlatched in btr_est_cur_t::fetch_child(). Try to search on pages after + releasing the index latch, to decrease contention. */ + mtr.rollback_to_savepoint(0, 1); - err = btr_cur_open_at_index_side(false, index, - BTR_SEARCH_LEAF | BTR_ESTIMATE, - &cursor, 0, &mtr); + /* There is no need to search on left page if + divergence_height != ULINT_UNDEFINED, as it was already searched before + btr_estimate_n_rows_in_range_on_level() call */ + if (divergence_height == ULINT_UNDEFINED && + !p1.search_on_page(height, root_height, true)) + goto error; - if (err != DB_SUCCESS) { - ib::warn() << " Error code: " << err - << " btr_estimate_n_rows_in_range_low " - << " called from file: " - << __FILE__ << " line: " << __LINE__ - << " table: " << index->table->name - << " index: " << index->name; - } + if (!p2.search_on_page(height, root_height, false)) + goto error; - ut_ad(page_rec_is_supremum(btr_cur_get_rec(&cursor))); - - /* The range specified is wihout a right border, just - 'x > 123' or 'x >= 123' and btr_cur_open_at_index_side() - positioned the cursor on the supremum record on the rightmost - page, which must not be counted. */ - should_count_the_right_border = false; - } - - tuple2->page_id= cursor.page_cur.block->page.id(); - - mtr_commit(&mtr); - - /* We have the path information for the range in path1 and path2 */ - - n_rows = 0; - is_n_rows_exact = true; - - /* This becomes true when the two paths do not pass through the - same pages anymore. */ - diverged = false; - - /* This becomes true when the paths are not the same or adjacent - any more. This means that they pass through the same or - neighboring-on-the-same-level pages only. */ - diverged_lot = false; - - /* This is the level where paths diverged a lot. */ - divergence_level = 1000000; - - for (i = 0; ; i++) { - ut_ad(i < BTR_PATH_ARRAY_N_SLOTS); - - slot1 = path1 + i; - slot2 = path2 + i; - - if (slot1->nth_rec == ULINT_UNDEFINED - || slot2->nth_rec == ULINT_UNDEFINED) { - - /* Here none of the borders were counted. For example, - if on the leaf level we descended to: - (inf, a, b, c, d, e, f, sup) - ^ ^ - path1 path2 - then n_rows will be 2 (c and d). */ - - if (is_n_rows_exact) { - /* Only fiddle to adjust this off-by-one - if the number is exact, otherwise we do - much grosser adjustments below. */ - - btr_path_t* last1 = &path1[i - 1]; - btr_path_t* last2 = &path2[i - 1]; - - /* If both paths end up on the same record on - the leaf level. */ - if (last1->page_no == last2->page_no - && last1->nth_rec == last2->nth_rec) { - - /* n_rows can be > 0 here if the paths - were first different and then converged - to the same record on the leaf level. - For example: - SELECT ... LIKE 'wait/synch/rwlock%' - mode1=PAGE_CUR_GE, - tuple1="wait/synch/rwlock" - path1[0]={nth_rec=58, n_recs=58, - page_no=3, page_level=1} - path1[1]={nth_rec=56, n_recs=55, - page_no=119, page_level=0} - - mode2=PAGE_CUR_G - tuple2="wait/synch/rwlock" - path2[0]={nth_rec=57, n_recs=57, - page_no=3, page_level=1} - path2[1]={nth_rec=56, n_recs=55, - page_no=119, page_level=0} */ - - /* If the range is such that we should - count both borders, then avoid - counting that record twice - once as a - left border and once as a right - border. */ - if (should_count_the_left_border - && should_count_the_right_border) { - - n_rows = 1; - } else { - /* Some of the borders should - not be counted, e.g. [3,3). */ - n_rows = 0; - } - } else { - if (should_count_the_left_border) { - n_rows++; - } + if (!diverged && (p1.nth_rec() != p2.nth_rec())) + { + ut_ad(p1.page_id() == p2.page_id()); + diverged= true; + if (p1.nth_rec() < p2.nth_rec()) + { + /* We do not count the borders (nor the left nor the right one), thus + "- 1". */ + n_rows= p2.nth_rec() - p1.nth_rec() - 1; + + if (n_rows > 0) + { + /* There is at least one row between the two borders pointed to by p1 + and p2, so on the level below the slots will point to non-adjacent + pages. */ + divergence_height= root_height - height; + } + } + else + { + /* It is possible that p1->nth_rec > p2->nth_rec if, for example, we have + a single page tree which contains (inf, 5, 6, supr) and we select where x + > 20 and x < 30; in this case p1->nth_rec will point to the supr record + and p2->nth_rec will point to 6. */ + n_rows= 0; + should_count_the_left_border= false; + should_count_the_right_border= false; + } + } + else if (diverged && divergence_height == ULINT_UNDEFINED) + { - if (should_count_the_right_border) { - n_rows++; - } - } - } + if (p1.nth_rec() < p1.n_recs() || p2.nth_rec() > 1) + { + ut_ad(p1.page_id() != p2.page_id()); + divergence_height= root_height - height; - if (i > divergence_level + 1 && !is_n_rows_exact) { - /* In trees whose height is > 1 our algorithm - tends to underestimate: multiply the estimate - by 2: */ + n_rows= 0; - n_rows = n_rows * 2; - } + if (p1.nth_rec() < p1.n_recs()) + { + n_rows+= p1.n_recs() - p1.nth_rec(); + } - DBUG_EXECUTE_IF("bug14007649", return(n_rows);); + if (p2.nth_rec() > 1) + { + n_rows+= p2.nth_rec() - 1; + } + } + } + else if (divergence_height != ULINT_UNDEFINED) + { + /* All records before the right page was already counted. Add records from + p2->page_no which are to the left of the record which servers as a right + border of the range, if any (we don't include the record itself in this + count). */ + if (p2.nth_rec() > 1) + n_rows+= p2.nth_rec() - 1; + } - /* Do not estimate the number of rows in the range - to over 1 / 2 of the estimated rows in the whole - table */ + if (height) + { + ut_ad(height > 0); + height--; + p1.get_child(&offsets, &heap); + p2.get_child(&offsets, &heap); + goto search_loop; + } - if (n_rows > table_n_rows / 2 && !is_n_rows_exact) { + should_count_the_left_border= + should_count_the_left_border && p1.should_count_the_left_border(); + should_count_the_right_border= + should_count_the_right_border && p2.should_count_the_right_border(); - n_rows = table_n_rows / 2; + mtr.commit(); + if (UNIV_LIKELY_NULL(heap)) + mem_heap_free(heap); - /* If there are just 0 or 1 rows in the table, - then we estimate all rows are in the range */ - if (n_rows == 0) { - n_rows = table_n_rows; - } - } + range_start->page_id= p1.page_id(); + range_end->page_id= p2.page_id(); - return(n_rows); - } + /* Here none of the borders were counted. For example, if on the leaf level + we descended to: + (inf, a, b, c, d, e, f, sup) + ^ ^ + path1 path2 + then n_rows will be 2 (c and d). */ - if (!diverged && slot1->nth_rec != slot2->nth_rec) { + if (is_n_rows_exact) + { + /* Only fiddle to adjust this off-by-one if the number is exact, otherwise + we do much grosser adjustments below. */ - /* If both slots do not point to the same page, - this means that the tree must have changed between - the dive for slot1 and the dive for slot2 at the - beginning of this function. */ - if (slot1->page_no != slot2->page_no - || slot1->page_level != slot2->page_level) { + /* If both paths end up on the same record on the leaf level. */ + if (p1.page_id() == p2.page_id() && p1.nth_rec() == p2.nth_rec()) + { - /* If the tree keeps changing even after a - few attempts, then just return some arbitrary - number. */ - if (nth_attempt >= rows_in_range_max_retries) { - return(rows_in_range_arbitrary_ret_val); - } + /* n_rows can be > 0 here if the paths were first different and then + converged to the same record on the leaf level. + For example: + SELECT ... LIKE 'wait/synch/rwlock%' + mode1=PAGE_CUR_GE, + tuple1="wait/synch/rwlock" + path1[0]={nth_rec=58, n_recs=58, + page_no=3, page_level=1} + path1[1]={nth_rec=56, n_recs=55, + page_no=119, page_level=0} + + mode2=PAGE_CUR_G + tuple2="wait/synch/rwlock" + path2[0]={nth_rec=57, n_recs=57, + page_no=3, page_level=1} + path2[1]={nth_rec=56, n_recs=55, + page_no=119, page_level=0} */ + + /* If the range is such that we should count both borders, then avoid + counting that record twice - once as a left border and once as a right + border. Some of the borders should not be counted, e.g. [3,3). */ + n_rows= should_count_the_left_border && should_count_the_right_border; + } + else + n_rows+= should_count_the_left_border + should_count_the_right_border; + } - return btr_estimate_n_rows_in_range_low( - index, tuple1, tuple2, - nth_attempt + 1); - } + if (root_height > divergence_height && !is_n_rows_exact) + /* In trees whose height is > 1 our algorithm tends to underestimate: + multiply the estimate by 2: */ + n_rows*= 2; - diverged = true; - - if (slot1->nth_rec < slot2->nth_rec) { - /* We do not count the borders (nor the left - nor the right one), thus "- 1". */ - n_rows = slot2->nth_rec - slot1->nth_rec - 1; - - if (n_rows > 0) { - /* There is at least one row between - the two borders pointed to by slot1 - and slot2, so on the level below the - slots will point to non-adjacent - pages. */ - diverged_lot = true; - divergence_level = i; - } - } else { - /* It is possible that - slot1->nth_rec >= slot2->nth_rec - if, for example, we have a single page - tree which contains (inf, 5, 6, supr) - and we select where x > 20 and x < 30; - in this case slot1->nth_rec will point - to the supr record and slot2->nth_rec - will point to 6. */ - n_rows = 0; - should_count_the_left_border = false; - should_count_the_right_border = false; - } + DBUG_EXECUTE_IF("bug14007649", DBUG_RETURN(n_rows);); - } else if (diverged && !diverged_lot) { + /* Do not estimate the number of rows in the range to over 1 / 2 of the + estimated rows in the whole table */ - if (slot1->nth_rec < slot1->n_recs - || slot2->nth_rec > 1) { + if (n_rows > table_n_rows / 2 && !is_n_rows_exact) + { - diverged_lot = true; - divergence_level = i; + n_rows= table_n_rows / 2; - n_rows = 0; + /* If there are just 0 or 1 rows in the table, then we estimate all rows + are in the range */ - if (slot1->nth_rec < slot1->n_recs) { - n_rows += slot1->n_recs - - slot1->nth_rec; - } + if (n_rows == 0) + n_rows= table_n_rows; + } - if (slot2->nth_rec > 1) { - n_rows += slot2->nth_rec - 1; - } - } - } else if (diverged_lot) { + DBUG_RETURN(n_rows); - n_rows = btr_estimate_n_rows_in_range_on_level( - index, slot1, slot2, n_rows, - &is_n_rows_exact); - } - } -} +error: + mtr.commit(); + if (UNIV_LIKELY_NULL(heap)) + mem_heap_free(heap); -/** Estimates the number of rows in a given index range. -@param[in] index index -@param[in] tuple1 range start, may also be empty tuple -@param[in] mode1 search mode for range start -@param[in] tuple2 range end, may also be empty tuple -@param[in] mode2 search mode for range end -@return estimated number of rows */ -ha_rows -btr_estimate_n_rows_in_range( - dict_index_t* index, - btr_pos_t *tuple1, - btr_pos_t *tuple2) -{ - return btr_estimate_n_rows_in_range_low( - index, tuple1, tuple2, 1); + DBUG_RETURN(0); } /*================== EXTERNAL STORAGE OF BIG FIELDS ===================*/ @@ -6818,30 +5887,35 @@ struct btr_blob_log_check_t { DEBUG_SYNC_C("blob_write_middle"); - log_free_check(); - - DEBUG_SYNC_C("blob_write_middle_after_check"); - const mtr_log_t log_mode = m_mtr->get_log_mode(); m_mtr->start(); m_mtr->set_log_mode(log_mode); index->set_modified(*m_mtr); + log_free_check(); + + DEBUG_SYNC_C("blob_write_middle_after_check"); + if (UNIV_UNLIKELY(page_no != FIL_NULL)) { + dberr_t err; + if (UNIV_LIKELY(index->page != page_no)) { + ut_a(btr_root_block_get(index, RW_SX_LATCH, + m_mtr, &err)); + } m_pcur->btr_cur.page_cur.block = btr_block_get( *index, page_no, RW_X_LATCH, false, m_mtr); + /* The page should not be evicted or corrupted while + we are holding a buffer-fix on it. */ + m_pcur->btr_cur.page_cur.block->page.unfix(); m_pcur->btr_cur.page_cur.rec = m_pcur->btr_cur.page_cur.block->page.frame + offs; - - m_pcur->btr_cur.page_cur.block->page.unfix(); } else { ut_ad(m_pcur->rel_pos == BTR_PCUR_ON); - bool ret = btr_pcur_restore_position( - BTR_MODIFY_LEAF | BTR_MODIFY_EXTERNAL, - m_pcur, m_mtr); - - ut_a(ret); + mtr_sx_lock_index(index, m_mtr); + ut_a(m_pcur->restore_position( + BTR_MODIFY_ROOT_AND_LEAF_ALREADY_LATCHED, + m_mtr) == btr_pcur_t::SAME_ALL); } *m_block = btr_pcur_get_block(m_pcur); @@ -6876,9 +5950,7 @@ the file, in case the file was somehow truncated in the crash. dberr_t btr_store_big_rec_extern_fields( /*============================*/ - btr_pcur_t* pcur, /*!< in/out: a persistent cursor. if - btr_mtr is restarted, then this can - be repositioned. */ + btr_pcur_t* pcur, /*!< in: a persistent cursor */ rec_offs* offsets, /*!< in/out: rec_get_offsets() on pcur. the "external storage" flags in offsets will correctly correspond @@ -6912,11 +5984,15 @@ btr_store_big_rec_extern_fields( ut_ad(buf_block_get_frame(rec_block) == page_align(rec)); ut_a(dict_index_is_clust(index)); + if (!fil_page_index_page_check(page_align(rec))) { + if (op != BTR_STORE_INSERT_BULK) { + return DB_PAGE_CORRUPTED; + } + } + btr_blob_log_check_t redo_log(pcur, btr_mtr, offsets, &rec_block, &rec, op); page_zip = buf_block_get_page_zip(rec_block); - ut_a(fil_page_index_page_check(page_align(rec)) - || op == BTR_STORE_INSERT_BULK); if (page_zip) { int err; @@ -7005,44 +6081,55 @@ btr_store_big_rec_extern_fields( page_zip = buf_block_get_page_zip(rec_block); } + ut_ad(btr_mtr->get_already_latched( + page_id_t{index->table->space_id, index->page}, + MTR_MEMO_PAGE_SX_FIX)); + mtr.start(); index->set_modified(mtr); - mtr.set_log_mode(btr_mtr->get_log_mode()); + mtr.set_log_mode_sub(*btr_mtr); - buf_page_get(rec_block->page.id(), - rec_block->zip_size(), RW_X_LATCH, &mtr); + rec_block->page.fix(); + rec_block->page.lock.x_lock(); + + mtr.memo_push(rec_block, MTR_MEMO_PAGE_X_FIX); +#ifdef BTR_CUR_HASH_ADAPT + ut_ad(!btr_search_check_marked_free_index(rec_block)); +#endif uint32_t hint_prev = prev_page_no; if (hint_prev == FIL_NULL) { hint_prev = rec_block->page.id().page_no(); } - if (!fsp_reserve_free_extents(&r_extents, - index->table->space, 1, - FSP_BLOB, &mtr, 1)) { + error = fsp_reserve_free_extents( + &r_extents, index->table->space, 1, + FSP_BLOB, &mtr, 1); + if (UNIV_UNLIKELY(error != DB_SUCCESS)) { +alloc_fail: mtr.commit(); - error = DB_OUT_OF_FILE_SPACE; goto func_exit; } block = btr_page_alloc(index, hint_prev + 1, - FSP_NO_DIR, 0, &mtr, &mtr); + FSP_NO_DIR, 0, &mtr, &mtr, + &error); index->table->space->release_free_extents(r_extents); - - ut_a(block != NULL); + if (!block) { + goto alloc_fail; + } const uint32_t space_id = block->page.id().space(); const uint32_t page_no = block->page.id().page_no(); - if (prev_page_no != FIL_NULL) { - buf_block_t* prev_block; - - prev_block = buf_page_get( - page_id_t(space_id, prev_page_no), - rec_block->zip_size(), - RW_X_LATCH, &mtr); - + if (prev_page_no == FIL_NULL) { + } else if (buf_block_t* prev_block = + buf_page_get_gen(page_id_t(space_id, + prev_page_no), + rec_block->zip_size(), + RW_X_LATCH, nullptr, + BUF_GET, &mtr, &error)) { if (page_zip) { mtr.write<4>(*prev_block, prev_block->page.frame @@ -7061,8 +6148,8 @@ btr_store_big_rec_extern_fields( + prev_block->page.frame, page_no); } - } else if (dict_index_is_online_ddl(index)) { - row_log_table_blob_alloc(index, page_no); + } else { + goto alloc_fail; } ut_ad(!page_has_siblings(block->page.frame)); @@ -7255,29 +6342,29 @@ btr_store_big_rec_extern_fields( } /** Check the FIL_PAGE_TYPE on an uncompressed BLOB page. -@param[in] block uncompressed BLOB page -@param[in] read true=read, false=purge */ -static void btr_check_blob_fil_page_type(const buf_block_t& block, bool read) +@param block uncompressed BLOB page +@param op operation +@return whether the type is invalid */ +static bool btr_check_blob_fil_page_type(const buf_block_t& block, + const char *op) { uint16_t type= fil_page_get_type(block.page.frame); - if (UNIV_LIKELY(type == FIL_PAGE_TYPE_BLOB)) - return; - /* FIXME: take the tablespace as a parameter */ - if (fil_space_t *space= fil_space_t::get(block.page.id().space())) + if (UNIV_LIKELY(type == FIL_PAGE_TYPE_BLOB)); + else if (fil_space_t *space= fil_space_t::get(block.page.id().space())) { /* Old versions of InnoDB did not initialize FIL_PAGE_TYPE on BLOB pages. Do not print anything about the type mismatch when reading a BLOB page that may be from old versions. */ - if (space->full_crc32() || DICT_TF_HAS_ATOMIC_BLOBS(space->flags)) - { - ib::fatal() << "FIL_PAGE_TYPE=" << type - << (read ? " on BLOB read file " : " on BLOB purge file ") - << space->chain.start->name - << " page " << block.page.id().page_no(); - } + bool fail= space->full_crc32() || DICT_TF_HAS_ATOMIC_BLOBS(space->flags); + if (fail) + sql_print_error("InnoDB: FIL_PAGE_TYPE=%u on BLOB %s file %s page %u", + type, op, space->chain.start->name, + block.page.id().page_no()); space->release(); + return fail; } + return false; } /*******************************************************************//** @@ -7309,16 +6396,11 @@ btr_free_externally_stored_field( containing the latch to data an an X-latch to the index tree */ { - page_t* page; const uint32_t space_id = mach_read_from_4( field_ref + BTR_EXTERN_SPACE_ID); - const uint32_t start_page = mach_read_from_4( - field_ref + BTR_EXTERN_PAGE_NO); - uint32_t page_no; - uint32_t next_page_no; - mtr_t mtr; ut_ad(index->is_primary()); + ut_ad(block->page.lock.have_x()); ut_ad(local_mtr->memo_contains_flagged(&index->lock, MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); ut_ad(local_mtr->memo_contains_page_flagged(field_ref, @@ -7343,29 +6425,22 @@ btr_free_externally_stored_field( ut_ad(space_id == index->table->space_id); const ulint ext_zip_size = index->table->space->zip_size(); - const ulint rec_zip_size = rec ? ext_zip_size : 0; - /* !rec holds in a call from purge when field_ref is in an undo page */ ut_ad(rec || !block->page.zip.data); for (;;) { - buf_block_t* ext_block; + mtr_t mtr; - mtr_start(&mtr); + mtr.start(); mtr.set_spaces(*local_mtr); - mtr.set_log_mode(local_mtr->get_log_mode()); + mtr.set_log_mode_sub(*local_mtr); ut_ad(!index->table->is_temporary() || local_mtr->get_log_mode() == MTR_LOG_NO_REDO); - const page_t* p = page_align(field_ref); - - const page_id_t page_id(page_get_space_id(p), - page_get_page_no(p)); - - buf_page_get(page_id, rec_zip_size, RW_X_LATCH, &mtr); - - page_no = mach_read_from_4(field_ref + BTR_EXTERN_PAGE_NO); + const uint32_t page_no = mach_read_from_4( + field_ref + BTR_EXTERN_PAGE_NO); + buf_block_t* ext_block; if (/* There is no external storage data */ page_no == FIL_NULL @@ -7376,22 +6451,32 @@ btr_free_externally_stored_field( || (rollback && (mach_read_from_1(field_ref + BTR_EXTERN_LEN) & BTR_EXTERN_INHERITED_FLAG))) { - +skip_free: /* Do not free */ - mtr_commit(&mtr); + mtr.commit(); return; } - if (page_no == start_page && dict_index_is_online_ddl(index)) { - row_log_table_blob_free(index, start_page); + ext_block = buf_page_get(page_id_t(space_id, page_no), + ext_zip_size, RW_X_LATCH, &mtr); + + if (!ext_block) { + goto skip_free; } - ext_block = buf_page_get( - page_id_t(space_id, page_no), ext_zip_size, - RW_X_LATCH, &mtr); + /* The buffer pool block containing the BLOB pointer is + exclusively latched by local_mtr. To satisfy some design + constraints, we must recursively latch it in mtr as well. */ + block->fix(); + block->page.lock.x_lock(); + + mtr.memo_push(block, MTR_MEMO_PAGE_X_FIX); +#ifdef BTR_CUR_HASH_ADAPT + ut_ad(!btr_search_check_marked_free_index(block)); +#endif - page = buf_block_get_frame(ext_block); + const page_t* page = buf_block_get_frame(ext_block); if (ext_zip_size) { /* Note that page_zip will be NULL @@ -7401,9 +6486,10 @@ btr_free_externally_stored_field( case FIL_PAGE_TYPE_ZBLOB2: break; default: - ut_error; + MY_ASSERT_UNREACHABLE(); } - next_page_no = mach_read_from_4(page + FIL_PAGE_NEXT); + const uint32_t next_page_no = mach_read_from_4( + page + FIL_PAGE_NEXT); btr_page_free(index, ext_block, &mtr, true, local_mtr->memo_contains( @@ -7426,9 +6512,9 @@ btr_free_externally_stored_field( } } else { ut_ad(!block->page.zip.data); - btr_check_blob_fil_page_type(*ext_block, false); + btr_check_blob_fil_page_type(*ext_block, "purge"); - next_page_no = mach_read_from_4( + const uint32_t next_page_no = mach_read_from_4( page + FIL_PAGE_DATA + BTR_BLOB_HDR_NEXT_PAGE_NO); btr_page_free(index, ext_block, &mtr, true, @@ -7560,10 +6646,12 @@ btr_copy_blob_prefix( mtr_start(&mtr); block = buf_page_get(id, 0, RW_S_LATCH, &mtr); + if (!block || btr_check_blob_fil_page_type(*block, "read")) { + mtr.commit(); + return copied_len; + } page = buf_block_get_frame(block); - btr_check_blob_fil_page_type(*block, true); - blob_header = page + offset; part_len = btr_blob_get_part_len(blob_header); copy_len = ut_min(part_len, len - copied_len); diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc index f8b5d42bb5734..642db0e9f1c57 100644 --- a/storage/innobase/btr/btr0defragment.cc +++ b/storage/innobase/btr/btr0defragment.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (C) 2012, 2014 Facebook, Inc. All Rights Reserved. -Copyright (C) 2014, 2021, MariaDB Corporation. +Copyright (C) 2014, 2023, 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 @@ -169,7 +169,7 @@ btr_defragment_find_index( @return whether the operation was interrupted */ bool btr_defragment_add_index(btr_pcur_t *pcur, THD *thd) { - dict_stats_empty_defrag_summary(pcur->btr_cur.index); + dict_stats_empty_defrag_summary(pcur->index()); pthread_cond_t cond; pthread_cond_init(&cond, nullptr); btr_defragment_item_t item(pcur, &cond); @@ -209,7 +209,7 @@ btr_defragment_remove_table( mysql_mutex_lock(&btr_defragment_mutex); for (auto item : btr_defragment_wq) { - if (item->cond && table == item->pcur->btr_cur.index->table) + if (item->cond && table == item->pcur->index()->table) { pthread_cond_signal(item->cond); item->cond= nullptr; @@ -259,9 +259,10 @@ btr_defragment_calc_n_recs_for_size( const ulint n_core = page_is_leaf(page) ? index->n_core_fields : 0; page_cur_set_before_first(block, &cur); - page_cur_move_to_next(&cur); - while (page_cur_get_rec(&cur) != page_get_supremum_rec(page)) { - rec_t* cur_rec = page_cur_get_rec(&cur); + while (rec_t* cur_rec = page_cur_move_to_next(&cur)) { + if (page_rec_is_supremum(cur_rec)) { + break; + } offsets = rec_get_offsets(cur_rec, index, offsets, n_core, ULINT_UNDEFINED, &heap); ulint rec_size = rec_offs_size(offsets); @@ -271,7 +272,6 @@ btr_defragment_calc_n_recs_for_size( break; } n_recs ++; - page_cur_move_to_next(&cur); } *n_recs_size = size; if (UNIV_LIKELY_NULL(heap)) { @@ -280,10 +280,75 @@ btr_defragment_calc_n_recs_for_size( return n_recs; } +MY_ATTRIBUTE((nonnull(2,3,4), warn_unused_result)) +/************************************************************//** +Returns the upper level node pointer to a page. It is assumed that mtr holds +an sx-latch on the tree. +@return rec_get_offsets() of the node pointer record */ +static +rec_offs* +btr_page_search_father_node_ptr( + rec_offs* offsets,/*!< in: work area for the return value */ + mem_heap_t* heap, /*!< in: memory heap to use */ + btr_cur_t* cursor, /*!< in: cursor pointing to user record, + out: cursor on node pointer record, + its page x-latched */ + mtr_t* mtr) /*!< in: mtr */ +{ + const uint32_t page_no = btr_cur_get_block(cursor)->page.id().page_no(); + dict_index_t* index = btr_cur_get_index(cursor); + ut_ad(!index->is_spatial()); + + ut_ad(mtr->memo_contains_flagged(&index->lock, MTR_MEMO_X_LOCK + | MTR_MEMO_SX_LOCK)); + ut_ad(dict_index_get_page(index) != page_no); + + const auto level = btr_page_get_level(btr_cur_get_page(cursor)); + + const rec_t* user_rec = btr_cur_get_rec(cursor); + ut_a(page_rec_is_user_rec(user_rec)); + + if (btr_cur_search_to_nth_level(level + 1, + dict_index_build_node_ptr(index, + user_rec, 0, + heap, level), + RW_X_LATCH, + cursor, mtr) != DB_SUCCESS) { + return nullptr; + } + + const rec_t* node_ptr = btr_cur_get_rec(cursor); + ut_ad(!btr_cur_get_block(cursor)->page.lock.not_recursive() + || mtr->memo_contains(index->lock, MTR_MEMO_X_LOCK)); + + offsets = rec_get_offsets(node_ptr, index, offsets, 0, + ULINT_UNDEFINED, &heap); + + if (btr_node_ptr_get_child_page_no(node_ptr, offsets) != page_no) { + offsets = nullptr; + } + + return(offsets); +} + +static bool btr_page_search_father(mtr_t *mtr, btr_cur_t *cursor) +{ + rec_t *rec= + page_rec_get_next(page_get_infimum_rec(cursor->block()->page.frame)); + if (UNIV_UNLIKELY(!rec)) + return false; + cursor->page_cur.rec= rec; + mem_heap_t *heap= mem_heap_create(100); + const bool got= btr_page_search_father_node_ptr(nullptr, heap, cursor, mtr); + mem_heap_free(heap); + return got; +} + /*************************************************************//** Merge as many records from the from_block to the to_block. Delete the from_block if all records are successfully merged to to_block. -@return the to_block to target for next merge operation. */ +@return the to_block to target for next merge operation. +@retval nullptr if corruption was noticed */ static buf_block_t* btr_defragment_merge_pages( @@ -330,9 +395,9 @@ btr_defragment_merge_pages( // reorganizing the page, otherwise we need to reorganize the page // first to release more space. if (move_size > max_ins_size) { - if (!btr_page_reorganize_block(page_zip_level, - to_block, index, - mtr)) { + dberr_t err = btr_page_reorganize_block(page_zip_level, + to_block, index, mtr); + if (err != DB_SUCCESS) { if (!dict_index_is_clust(index) && page_is_leaf(to_page)) { ibuf_reset_free_bits(to_block); @@ -341,23 +406,31 @@ btr_defragment_merge_pages( // not compressable. There's no point to try // merging into this page. Continue to the // next page. - return from_block; + return err == DB_FAIL ? from_block : nullptr; } ut_ad(page_validate(to_page, index)); max_ins_size = page_get_max_insert_size(to_page, n_recs); - ut_a(max_ins_size >= move_size); + if (max_ins_size < move_size) { + return nullptr; + } } // Move records to pack to_page more full. orig_pred = NULL; target_n_recs = n_recs_to_move; + dberr_t err; while (n_recs_to_move > 0) { - rec = page_rec_get_nth(from_page, - n_recs_to_move + 1); + if (!(rec = page_rec_get_nth(from_page, n_recs_to_move + 1))) { + return nullptr; + } orig_pred = page_copy_rec_list_start( - to_block, from_block, rec, index, mtr); + to_block, from_block, rec, index, mtr, &err); if (orig_pred) break; + if (err != DB_FAIL) { + return nullptr; + } + // If we reach here, that means compression failed after packing // n_recs_to_move number of records to to_page. We try to reduce // the targeted data size on the to_page by @@ -396,19 +469,23 @@ btr_defragment_merge_pages( } } btr_cur_t parent; - if (n_recs_to_move == n_recs) { + parent.page_cur.index = index; + parent.page_cur.block = from_block; + + if (!btr_page_search_father(mtr, &parent)) { + to_block = nullptr; + } else if (n_recs_to_move == n_recs) { /* The whole page is merged with the previous page, free it. */ - const page_id_t from{from_block->page.id()}; - lock_update_merge_left(*to_block, orig_pred, from); - btr_search_drop_page_hash_index(from_block); - ut_a(DB_SUCCESS == btr_level_list_remove(*from_block, *index, - mtr)); - btr_page_get_father(index, from_block, mtr, &parent); - btr_cur_node_ptr_delete(&parent, mtr); - /* btr_blob_dbg_remove(from_page, index, - "btr_defragment_n_pages"); */ - btr_page_free(index, from_block, mtr); + lock_update_merge_left(*to_block, orig_pred, + from_block->page.id()); + btr_search_drop_page_hash_index(from_block, false); + if (btr_level_list_remove(*from_block, *index, mtr) + != DB_SUCCESS + || btr_cur_node_ptr_delete(&parent, mtr) != DB_SUCCESS + || btr_page_free(index, from_block, mtr) != DB_SUCCESS) { + return nullptr; + } } else { // There are still records left on the page, so // increment n_defragmented. Node pointer will be changed @@ -424,15 +501,23 @@ btr_defragment_merge_pages( orig_pred, from_block); // FIXME: reuse the node_ptr! - btr_page_get_father(index, from_block, mtr, &parent); - btr_cur_node_ptr_delete(&parent, mtr); + if (btr_cur_node_ptr_delete(&parent, mtr) + != DB_SUCCESS) { + return nullptr; + } rec = page_rec_get_next( page_get_infimum_rec(from_page)); + if (!rec) { + return nullptr; + } node_ptr = dict_index_build_node_ptr( index, rec, page_get_page_no(from_page), heap, level); - btr_insert_on_non_leaf_level(0, index, level+1, - node_ptr, mtr); + if (btr_insert_on_non_leaf_level(0, index, level+1, + node_ptr, mtr) + != DB_SUCCESS) { + return nullptr; + } } to_block = from_block; } @@ -507,6 +592,9 @@ btr_defragment_n_pages( blocks[i] = btr_block_get(*index, page_no, RW_X_LATCH, true, mtr); + if (!blocks[i]) { + return nullptr; + } } if (n_pages == 1) { @@ -517,7 +605,8 @@ btr_defragment_n_pages( return NULL; /* given page is the last page. Lift the records to father. */ - btr_lift_page_up(index, block, mtr); + dberr_t err; + btr_lift_page_up(index, block, mtr, &err); } return NULL; } @@ -580,6 +669,9 @@ btr_defragment_n_pages( if (new_block != current_block) { n_defragmented ++; current_block = new_block; + if (!new_block) { + break; + } } } mem_heap_free(heap); @@ -631,7 +723,7 @@ static void btr_defragment_chunk(void*) mysql_mutex_unlock(&btr_defragment_mutex); func_exit: set_current_thd(nullptr); - innobase_destroy_background_thd(thd); + destroy_background_thd(thd); return; } item = *btr_defragment_wq.begin(); @@ -665,28 +757,31 @@ static void btr_defragment_chunk(void*) } log_free_check(); mtr_start(&mtr); - dict_index_t *index = item->pcur->btr_cur.index; + dict_index_t *index = item->pcur->index(); index->set_modified(mtr); - /* To follow the latching order defined in WL#6326, acquire index->lock X-latch. - This entitles us to acquire page latches in any order for the index. */ + /* To follow the latching order defined in WL#6326, + acquire index->lock X-latch. This entitles us to + acquire page latches in any order for the index. */ mtr_x_lock_index(index, &mtr); - /* This will acquire index->lock SX-latch, which per WL#6363 is allowed - when we are already holding the X-latch. */ - btr_pcur_restore_position(BTR_MODIFY_TREE, item->pcur, &mtr); - buf_block_t* first_block = btr_pcur_get_block(item->pcur); if (buf_block_t *last_block = - btr_defragment_n_pages(first_block, index, - srv_defragment_n_pages, - &mtr)) { + item->pcur->restore_position( + BTR_PURGE_TREE_ALREADY_LATCHED, &mtr) + == btr_pcur_t::CORRUPTED + ? nullptr + : btr_defragment_n_pages(btr_pcur_get_block(item->pcur), + index, srv_defragment_n_pages, + &mtr)) { /* If we haven't reached the end of the index, place the cursor on the last record of last page, store the cursor position, and put back in queue. */ page_t* last_page = buf_block_get_frame(last_block); rec_t* rec = page_rec_get_prev( page_get_supremum_rec(last_page)); - ut_a(page_rec_is_user_rec(rec)); - page_cur_position(rec, last_block, - btr_pcur_get_page_cur(item->pcur)); + if (rec && page_rec_is_user_rec(rec)) { + page_cur_position(rec, last_block, + btr_pcur_get_page_cur( + item->pcur)); + } btr_pcur_store_position(item->pcur, &mtr); mtr_commit(&mtr); /* Update the last_processed time of this index. */ diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index ac91f87c8e1ac..1dd26f8c46761 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2021, MariaDB Corporation. +Copyright (c) 2016, 2023, 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 @@ -29,25 +29,6 @@ Created 2/23/1996 Heikki Tuuri #include "rem0cmp.h" #include "trx0trx.h" -/**************************************************************//** -Allocates memory for a persistent cursor object and initializes the cursor. -@return own: persistent cursor */ -btr_pcur_t* -btr_pcur_create_for_mysql(void) -/*============================*/ -{ - btr_pcur_t* pcur; - DBUG_ENTER("btr_pcur_create_for_mysql"); - - pcur = (btr_pcur_t*) ut_malloc_nokey(sizeof(btr_pcur_t)); - - pcur->btr_cur.index = NULL; - btr_pcur_init(pcur); - - DBUG_PRINT("btr_pcur_create_for_mysql", ("pcur: %p", pcur)); - DBUG_RETURN(pcur); -} - /**************************************************************//** Resets a persistent cursor object, freeing ::old_rec_buf if it is allocated and resetting the other members to their initial values. */ @@ -56,34 +37,17 @@ btr_pcur_reset( /*===========*/ btr_pcur_t* cursor) /*!< in, out: persistent cursor */ { - btr_pcur_free(cursor); + ut_free(cursor->old_rec_buf); + memset(&cursor->btr_cur.page_cur, 0, sizeof(page_cur_t)); cursor->old_rec_buf = NULL; - cursor->btr_cur.index = NULL; - cursor->btr_cur.page_cur.rec = NULL; cursor->old_rec = NULL; cursor->old_n_core_fields = 0; cursor->old_n_fields = 0; - cursor->old_stored = false; cursor->latch_mode = BTR_NO_LATCHES; cursor->pos_state = BTR_PCUR_NOT_POSITIONED; } -/**************************************************************//** -Frees the memory for a persistent cursor object. */ -void -btr_pcur_free_for_mysql( -/*====================*/ - btr_pcur_t* cursor) /*!< in, own: persistent cursor */ -{ - DBUG_ENTER("btr_pcur_free_for_mysql"); - DBUG_PRINT("btr_pcur_free_for_mysql", ("pcur: %p", cursor)); - - btr_pcur_free(cursor); - ut_free(cursor); - DBUG_VOID_RETURN; -} - /**************************************************************//** The position of the cursor is stored by taking an initial segment of the record the cursor is positioned on, before, or after, and copying it to the @@ -125,8 +89,6 @@ btr_pcur_store_position( && mtr->memo_contains_flagged(&index->lock, MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK))); - cursor->old_stored = true; - if (page_is_empty(block->page.frame)) { /* It must be an empty index tree; NOTE that in this case we do not store the modify_clock, but always do a search @@ -148,6 +110,11 @@ btr_pcur_store_position( if (page_rec_is_supremum_low(offs)) { rec = page_rec_get_prev(rec); + if (UNIV_UNLIKELY(!rec || page_rec_is_infimum(rec))) { + ut_ad("corrupted index" == 0); + cursor->rel_pos = BTR_PCUR_AFTER_LAST_IN_TREE; + return; + } ut_ad(!page_rec_is_infimum(rec)); if (UNIV_UNLIKELY(rec_is_metadata(rec, *index))) { @@ -171,10 +138,16 @@ btr_pcur_store_position( } else if (page_rec_is_infimum_low(offs)) { rec = page_rec_get_next(rec); + if (UNIV_UNLIKELY(!rec)) { + ut_ad("corrupted page" == 0); + goto before_first; + } + if (rec_is_metadata(rec, *index)) { ut_ad(!page_has_prev(block->page.frame)); rec = page_rec_get_next(rec); - if (page_rec_is_supremum(rec)) { + ut_ad(rec); + if (!rec || page_rec_is_supremum(rec)) { goto before_first; } } @@ -239,46 +212,124 @@ btr_pcur_copy_stored_position( pcur_receive->old_n_fields = pcur_donate->old_n_fields; } +/** Optimistically latches the leaf page or pages requested. +@param[in] block guessed buffer block +@param[in,out] pcur cursor +@param[in,out] latch_mode BTR_SEARCH_LEAF, ... +@param[in,out] mtr mini-transaction +@return true if success */ +TRANSACTIONAL_TARGET +static bool btr_pcur_optimistic_latch_leaves(buf_block_t *block, + btr_pcur_t *pcur, + btr_latch_mode *latch_mode, + mtr_t *mtr) +{ + ut_ad(block->page.buf_fix_count()); + ut_ad(block->page.in_file()); + ut_ad(block->page.frame); + + static_assert(BTR_SEARCH_PREV & BTR_SEARCH_LEAF, ""); + static_assert(BTR_MODIFY_PREV & BTR_MODIFY_LEAF, ""); + static_assert((BTR_SEARCH_PREV ^ BTR_MODIFY_PREV) == + (RW_S_LATCH ^ RW_X_LATCH), ""); + + const rw_lock_type_t mode= + rw_lock_type_t(*latch_mode & (RW_X_LATCH | RW_S_LATCH)); + + switch (*latch_mode) { + default: + ut_ad(*latch_mode == BTR_SEARCH_LEAF || *latch_mode == BTR_MODIFY_LEAF); + return buf_page_optimistic_get(mode, block, pcur->modify_clock, mtr); + case BTR_SEARCH_PREV: + case BTR_MODIFY_PREV: + page_id_t id{0}; + uint32_t left_page_no; + ulint zip_size; + buf_block_t *left_block= nullptr; + { + transactional_shared_lock_guard g{block->page.lock}; + if (block->modify_clock != pcur->modify_clock) + return false; + id= block->page.id(); + zip_size= block->zip_size(); + left_page_no= btr_page_get_prev(block->page.frame); + } + + if (left_page_no != FIL_NULL) + { + left_block= + buf_page_get_gen(page_id_t(id.space(), left_page_no), zip_size, + mode, nullptr, BUF_GET_POSSIBLY_FREED, mtr); + + if (left_block && + btr_page_get_next(left_block->page.frame) != id.page_no()) + { +release_left_block: + mtr->release_last_page(); + return false; + } + } + + if (buf_page_optimistic_get(mode, block, pcur->modify_clock, mtr)) + { + if (btr_page_get_prev(block->page.frame) == left_page_no) + { + /* block was already buffer-fixed while entering the function and + buf_page_optimistic_get() buffer-fixes it again. */ + ut_ad(2 <= block->page.buf_fix_count()); + *latch_mode= btr_latch_mode(mode); + return true; + } + + mtr->release_last_page(); + } + + ut_ad(block->page.buf_fix_count()); + if (left_block) + goto release_left_block; + return false; + } +} + /** Structure acts as functor to do the latching of leaf pages. It returns true if latching of leaf pages succeeded and false otherwise. */ struct optimistic_latch_leaves { btr_pcur_t *const cursor; - ulint *latch_mode; + btr_latch_mode *const latch_mode; mtr_t *const mtr; - optimistic_latch_leaves(btr_pcur_t *cursor, ulint *latch_mode, mtr_t *mtr) - :cursor(cursor), latch_mode(latch_mode), mtr(mtr) {} - - bool operator() (buf_block_t *hint) const + bool operator()(buf_block_t *hint) const { - return hint && btr_cur_optimistic_latch_leaves( - hint, cursor->modify_clock, latch_mode, - btr_pcur_get_btr_cur(cursor), mtr); + return hint && + btr_pcur_optimistic_latch_leaves(hint, cursor, latch_mode, mtr); } }; -/**************************************************************//** -Restores the stored position of a persistent cursor bufferfixing the page and -obtaining the specified latches. If the cursor position was saved when the -(1) cursor was positioned on a user record: this function restores the position -to the last record LESS OR EQUAL to the stored record; -(2) cursor was positioned on a page infimum record: restores the position to -the last record LESS than the user record which was the successor of the page -infimum; -(3) cursor was positioned on the page supremum: restores to the first record -GREATER than the user record which was the predecessor of the supremum. -(4) cursor was positioned before the first or after the last in an empty tree: -restores to before first or after the last in the tree. -@return TRUE if the cursor position was stored when it was on a user -record and it can be restored on a user record whose ordering fields -are identical to the ones of the original user record */ -ibool -btr_pcur_restore_position( - ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ - btr_pcur_t* cursor, /*!< in: detached persistent cursor */ - mtr_t* mtr) /*!< in: mtr */ +/** Restores the stored position of a persistent cursor bufferfixing +the page and obtaining the specified latches. If the cursor position +was saved when the +(1) cursor was positioned on a user record: this function restores the +position to the last record LESS OR EQUAL to the stored record; +(2) cursor was positioned on a page infimum record: restores the +position to the last record LESS than the user record which was the +successor of the page infimum; +(3) cursor was positioned on the page supremum: restores to the first +record GREATER than the user record which was the predecessor of the +supremum. +(4) cursor was positioned before the first or after the last in an +empty tree: restores to before first or after the last in the tree. +@param latch_mode BTR_SEARCH_LEAF, ... +@param mtr mini-transaction +@return btr_pcur_t::SAME_ALL cursor position on user rec and points on +the record with the same field values as in the stored record, +btr_pcur_t::SAME_UNIQ cursor position is on user rec and points on the +record with the same unique field values as in the stored record, +btr_pcur_t::NOT_SAME cursor position is not on user rec or points on +the record with not the samebuniq field values as in the stored */ +btr_pcur_t::restore_status +btr_pcur_t::restore_position(btr_latch_mode restore_latch_mode, mtr_t *mtr) { dict_index_t* index; dtuple_t* tuple; @@ -287,98 +338,89 @@ btr_pcur_restore_position( mem_heap_t* heap; ut_ad(mtr->is_active()); - //ut_ad(cursor->old_stored); - ut_ad(cursor->pos_state == BTR_PCUR_WAS_POSITIONED - || cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(pos_state == BTR_PCUR_WAS_POSITIONED + || pos_state == BTR_PCUR_IS_POSITIONED); - index = btr_cur_get_index(btr_pcur_get_btr_cur(cursor)); + index = btr_cur_get_index(&btr_cur); if (UNIV_UNLIKELY - (cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE - || cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) { - dberr_t err = DB_SUCCESS; - + (rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE + || rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) { /* In these cases we do not try an optimistic restoration, but always do a search */ - err = btr_cur_open_at_index_side( - cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE, - index, latch_mode, - btr_pcur_get_btr_cur(cursor), 0, mtr); - - if (err != DB_SUCCESS) { - ib::warn() << " Error code: " << err - << " btr_pcur_restore_position " - << " table: " << index->table->name - << " index: " << index->name; + if (btr_cur.open_leaf(rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE, + index, restore_latch_mode, mtr) + != DB_SUCCESS) { + return restore_status::CORRUPTED; } - cursor->latch_mode = - BTR_LATCH_MODE_WITHOUT_INTENTION(latch_mode); - cursor->pos_state = BTR_PCUR_IS_POSITIONED; - cursor->block_when_stored.clear(); + latch_mode = + BTR_LATCH_MODE_WITHOUT_INTENTION(restore_latch_mode); + pos_state = BTR_PCUR_IS_POSITIONED; + block_when_stored.clear(); - return(FALSE); + return restore_status::NOT_SAME; } - ut_a(cursor->old_rec); - ut_a(cursor->old_n_core_fields); - ut_a(cursor->old_n_core_fields <= index->n_core_fields); - ut_a(cursor->old_n_fields); + ut_a(old_rec); + ut_a(old_n_core_fields); + ut_a(old_n_core_fields <= index->n_core_fields); + ut_a(old_n_fields); + + static_assert(BTR_SEARCH_PREV == (4 | BTR_SEARCH_LEAF), ""); + static_assert(BTR_MODIFY_PREV == (4 | BTR_MODIFY_LEAF), ""); - switch (latch_mode) { - case BTR_SEARCH_LEAF: - case BTR_MODIFY_LEAF: + switch (restore_latch_mode | 4) { case BTR_SEARCH_PREV: case BTR_MODIFY_PREV: /* Try optimistic restoration. */ + if (block_when_stored.run_with_hint( + optimistic_latch_leaves{this, &restore_latch_mode, + mtr})) { + pos_state = BTR_PCUR_IS_POSITIONED; + latch_mode = restore_latch_mode; - if (cursor->block_when_stored.run_with_hint( - optimistic_latch_leaves(cursor, &latch_mode, - mtr))) { - cursor->pos_state = BTR_PCUR_IS_POSITIONED; - cursor->latch_mode = latch_mode; - - if (cursor->rel_pos == BTR_PCUR_ON) { + if (rel_pos == BTR_PCUR_ON) { #ifdef UNIV_DEBUG const rec_t* rec; rec_offs offsets1_[REC_OFFS_NORMAL_SIZE]; rec_offs offsets2_[REC_OFFS_NORMAL_SIZE]; rec_offs* offsets1 = offsets1_; rec_offs* offsets2 = offsets2_; - rec = btr_pcur_get_rec(cursor); + rec = btr_pcur_get_rec(this); rec_offs_init(offsets1_); rec_offs_init(offsets2_); heap = mem_heap_create(256); - ut_ad(cursor->old_n_core_fields + ut_ad(old_n_core_fields == index->n_core_fields); offsets1 = rec_get_offsets( - cursor->old_rec, index, offsets1, - cursor->old_n_core_fields, - cursor->old_n_fields, &heap); + old_rec, index, offsets1, + old_n_core_fields, + old_n_fields, &heap); offsets2 = rec_get_offsets( rec, index, offsets2, index->n_core_fields, - cursor->old_n_fields, &heap); + old_n_fields, &heap); - ut_ad(!cmp_rec_rec(cursor->old_rec, + ut_ad(!cmp_rec_rec(old_rec, rec, offsets1, offsets2, index)); mem_heap_free(heap); #endif /* UNIV_DEBUG */ - return(TRUE); + return restore_status::SAME_ALL; } /* This is the same record as stored, may need to be adjusted for BTR_PCUR_BEFORE/AFTER, depending on search mode and direction. */ - if (btr_pcur_is_on_user_rec(cursor)) { - cursor->pos_state + if (btr_pcur_is_on_user_rec(this)) { + pos_state = BTR_PCUR_IS_POSITIONED_OPTIMISTIC; } - return(FALSE); + return restore_status::NOT_SAME; } } @@ -386,19 +428,19 @@ btr_pcur_restore_position( heap = mem_heap_create(256); - tuple = dtuple_create(heap, cursor->old_n_fields); + tuple = dtuple_create(heap, old_n_fields); - dict_index_copy_types(tuple, index, cursor->old_n_fields); + dict_index_copy_types(tuple, index, old_n_fields); - rec_copy_prefix_to_dtuple(tuple, cursor->old_rec, index, - cursor->old_n_core_fields, - cursor->old_n_fields, heap); + rec_copy_prefix_to_dtuple(tuple, old_rec, index, + old_n_core_fields, + old_n_fields, heap); ut_ad(dtuple_check_typed(tuple)); /* Save the old search mode of the cursor */ - old_mode = cursor->search_mode; + old_mode = search_mode; - switch (cursor->rel_pos) { + switch (rel_pos) { case BTR_PCUR_ON: mode = PAGE_CUR_LE; break; @@ -409,45 +451,47 @@ btr_pcur_restore_position( mode = PAGE_CUR_L; break; default: - ut_error; + MY_ASSERT_UNREACHABLE(); mode = PAGE_CUR_UNSUPP; } - btr_pcur_open_with_no_init_func(index, tuple, mode, latch_mode, - cursor, -#ifdef BTR_CUR_HASH_ADAPT - NULL, -#endif /* BTR_CUR_HASH_ADAPT */ - mtr); + if (btr_pcur_open_with_no_init(tuple, mode, restore_latch_mode, + this, mtr) != DB_SUCCESS) { + mem_heap_free(heap); + return restore_status::CORRUPTED; + } /* Restore the old search mode */ - cursor->search_mode = old_mode; + search_mode = old_mode; - ut_ad(cursor->rel_pos == BTR_PCUR_ON - || cursor->rel_pos == BTR_PCUR_BEFORE - || cursor->rel_pos == BTR_PCUR_AFTER); + ut_ad(rel_pos == BTR_PCUR_ON + || rel_pos == BTR_PCUR_BEFORE + || rel_pos == BTR_PCUR_AFTER); rec_offs offsets[REC_OFFS_NORMAL_SIZE]; rec_offs_init(offsets); - if (cursor->rel_pos == BTR_PCUR_ON - && btr_pcur_is_on_user_rec(cursor) - && !cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor), - rec_get_offsets(btr_pcur_get_rec(cursor), - index, offsets, - index->n_core_fields, - ULINT_UNDEFINED, &heap))) { - - /* We have to store the NEW value for the modify clock, - since the cursor can now be on a different page! - But we can retain the value of old_rec */ - - cursor->block_when_stored.store(btr_pcur_get_block(cursor)); - cursor->modify_clock = buf_block_get_modify_clock( - cursor->block_when_stored.block()); - cursor->old_stored = true; - - mem_heap_free(heap); - - return(TRUE); + restore_status ret_val= restore_status::NOT_SAME; + if (rel_pos == BTR_PCUR_ON && btr_pcur_is_on_user_rec(this)) { + ulint n_matched_fields= 0; + if (!cmp_dtuple_rec_with_match( + tuple, btr_pcur_get_rec(this), index, + rec_get_offsets(btr_pcur_get_rec(this), index, offsets, + index->n_core_fields, ULINT_UNDEFINED, &heap), + &n_matched_fields)) { + + /* We have to store the NEW value for the modify clock, + since the cursor can now be on a different page! + But we can retain the value of old_rec */ + + block_when_stored.store(btr_pcur_get_block(this)); + modify_clock= buf_block_get_modify_clock( + block_when_stored.block()); + + mem_heap_free(heap); + + return restore_status::SAME_ALL; + } + if (n_matched_fields >= index->n_uniq) + ret_val= restore_status::SAME_UNIQ; } mem_heap_free(heap); @@ -456,9 +500,9 @@ btr_pcur_restore_position( to the cursor because it can now be on a different page, the record under it may have been removed, etc. */ - btr_pcur_store_position(cursor, mtr); + btr_pcur_store_position(this, mtr); - return(FALSE); + return ret_val; } /*********************************************************//** @@ -466,7 +510,7 @@ Moves the persistent cursor to the first record on the next page. Releases the latch on the current page, and bufferunfixes it. Note that there must not be modifications on the current page, as then the x-latch can be released only in mtr_commit. */ -void +dberr_t btr_pcur_move_to_next_page( /*=======================*/ btr_pcur_t* cursor, /*!< in: persistent cursor; must be on the @@ -477,49 +521,49 @@ btr_pcur_move_to_next_page( ut_ad(cursor->latch_mode != BTR_NO_LATCHES); ut_ad(btr_pcur_is_after_last_on_page(cursor)); - cursor->old_stored = false; + cursor->old_rec = nullptr; const page_t* page = btr_pcur_get_page(cursor); - - if (UNIV_UNLIKELY(!page)) { - return; - } - const uint32_t next_page_no = btr_page_get_next(page); - ut_ad(next_page_no != FIL_NULL); + switch (next_page_no) { + case 0: + case 1: + case FIL_NULL: + return DB_CORRUPTION; + } - ulint mode = cursor->latch_mode; - switch (mode) { - case BTR_SEARCH_TREE: - mode = BTR_SEARCH_LEAF; - break; - case BTR_MODIFY_TREE: - mode = BTR_MODIFY_LEAF; + if (UNIV_UNLIKELY(next_page_no == btr_pcur_get_block(cursor) + ->page.id().page_no())) { + return DB_CORRUPTION; } + dberr_t err; buf_block_t* next_block = btr_block_get( - *btr_pcur_get_btr_cur(cursor)->index, next_page_no, mode, - page_is_leaf(page), mtr); + *cursor->index(), next_page_no, cursor->latch_mode & ~12, + page_is_leaf(page), mtr, &err); if (UNIV_UNLIKELY(!next_block)) { - return; + return err; } const page_t* next_page = buf_block_get_frame(next_block); -#ifdef UNIV_BTR_DEBUG - ut_a(page_is_comp(next_page) == page_is_comp(page)); - ut_a(btr_page_get_prev(next_page) - == btr_pcur_get_block(cursor)->page.id().page_no()); -#endif /* UNIV_BTR_DEBUG */ - btr_leaf_page_release(btr_pcur_get_block(cursor), mode, mtr); + if (UNIV_UNLIKELY(memcmp_aligned<4>(next_page + FIL_PAGE_PREV, + page + FIL_PAGE_OFFSET, 4))) { + return DB_CORRUPTION; + } page_cur_set_before_first(next_block, btr_pcur_get_page_cur(cursor)); ut_d(page_check_dir(next_page)); + + const auto s = mtr->get_savepoint(); + mtr->rollback_to_savepoint(s - 2, s - 1); + return DB_SUCCESS; } +MY_ATTRIBUTE((nonnull,warn_unused_result)) /*********************************************************//** Moves the persistent cursor backward if it is on the first record of the page. Commits mtr. Note that to prevent a possible deadlock, the operation @@ -530,36 +574,18 @@ return, but it may happen that the cursor is not positioned on the last record of any page, because the structure of the tree may have changed during the time when the cursor had no latches. */ static -void +bool btr_pcur_move_backward_from_page( /*=============================*/ btr_pcur_t* cursor, /*!< in: persistent cursor, must be on the first record of the current page */ mtr_t* mtr) /*!< in: mtr */ { - ulint prev_page_no; - page_t* page; - buf_block_t* prev_block; - ulint latch_mode; - ulint latch_mode2; - - ut_ad(cursor->latch_mode != BTR_NO_LATCHES); ut_ad(btr_pcur_is_before_first_on_page(cursor)); ut_ad(!btr_pcur_is_before_first_in_tree(cursor)); - latch_mode = cursor->latch_mode; - - if (latch_mode == BTR_SEARCH_LEAF) { - - latch_mode2 = BTR_SEARCH_PREV; - - } else if (latch_mode == BTR_MODIFY_LEAF) { - - latch_mode2 = BTR_MODIFY_PREV; - } else { - latch_mode2 = 0; /* To eliminate compiler warning */ - ut_error; - } + const auto latch_mode = cursor->latch_mode; + ut_ad(latch_mode == BTR_SEARCH_LEAF || latch_mode == BTR_MODIFY_LEAF); btr_pcur_store_position(cursor, mtr); @@ -567,43 +593,59 @@ btr_pcur_move_backward_from_page( mtr_start(mtr); - btr_pcur_restore_position(latch_mode2, cursor, mtr); - - page = btr_pcur_get_page(cursor); - - prev_page_no = btr_page_get_prev(page); - - if (prev_page_no == FIL_NULL) { - } else if (btr_pcur_is_before_first_on_page(cursor)) { - - prev_block = btr_pcur_get_btr_cur(cursor)->left_block; - - btr_leaf_page_release(btr_pcur_get_block(cursor), - latch_mode, mtr); + static_assert(BTR_SEARCH_PREV == (4 | BTR_SEARCH_LEAF), ""); + static_assert(BTR_MODIFY_PREV == (4 | BTR_MODIFY_LEAF), ""); - page_cur_set_after_last(prev_block, - btr_pcur_get_page_cur(cursor)); - } else { - - /* The repositioned cursor did not end on an infimum - record on a page. Cursor repositioning acquired a latch - also on the previous page, but we do not need the latch: - release it. */ - - prev_block = btr_pcur_get_btr_cur(cursor)->left_block; + if (UNIV_UNLIKELY(cursor->restore_position( + btr_latch_mode(4 | latch_mode), mtr) + == btr_pcur_t::CORRUPTED)) { + return true; + } - btr_leaf_page_release(prev_block, latch_mode, mtr); + buf_block_t* block = btr_pcur_get_block(cursor); + + if (page_has_prev(block->page.frame)) { + buf_block_t* left_block + = mtr->at_savepoint(mtr->get_savepoint() - 1); + const page_t* const left = left_block->page.frame; + if (memcmp_aligned<4>(left + FIL_PAGE_NEXT, + block->page.frame + + FIL_PAGE_OFFSET, 4)) { + /* This should be the right sibling page, or + if there is none, the current block. */ + ut_ad(left_block == block + || !memcmp_aligned<4>(left + FIL_PAGE_PREV, + block->page.frame + + FIL_PAGE_OFFSET, 4)); + /* The previous one must be the left sibling. */ + left_block + = mtr->at_savepoint(mtr->get_savepoint() - 2); + ut_ad(!memcmp_aligned<4>(left_block->page.frame + + FIL_PAGE_NEXT, + block->page.frame + + FIL_PAGE_OFFSET, 4)); + } + if (btr_pcur_is_before_first_on_page(cursor)) { + page_cur_set_after_last(left_block, + &cursor->btr_cur.page_cur); + /* Release the right sibling. */ + } else { + /* Release the left sibling. */ + block = left_block; + } + mtr->release(*block); } cursor->latch_mode = latch_mode; - cursor->old_stored = false; + cursor->old_rec = nullptr; + return false; } /*********************************************************//** Moves the persistent cursor to the previous record in the tree. If no records are left, the cursor stays 'before first in tree'. @return TRUE if the cursor was not before first in tree */ -ibool +bool btr_pcur_move_to_prev( /*==================*/ btr_pcur_t* cursor, /*!< in: persistent cursor; NOTE that the @@ -613,56 +655,12 @@ btr_pcur_move_to_prev( ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - cursor->old_stored = false; + cursor->old_rec = nullptr; if (btr_pcur_is_before_first_on_page(cursor)) { - - if (btr_pcur_is_before_first_in_tree(cursor)) { - - return(FALSE); - } - - btr_pcur_move_backward_from_page(cursor, mtr); - - return(TRUE); + return (!btr_pcur_is_before_first_in_tree(cursor) + && !btr_pcur_move_backward_from_page(cursor, mtr)); } - btr_pcur_move_to_prev_on_page(cursor); - - return(TRUE); -} - -/**************************************************************//** -If mode is PAGE_CUR_G or PAGE_CUR_GE, opens a persistent cursor on the first -user record satisfying the search condition, in the case PAGE_CUR_L or -PAGE_CUR_LE, on the last user record. If no such user record exists, then -in the first case sets the cursor after last in tree, and in the latter case -before first in tree. The latching mode must be BTR_SEARCH_LEAF or -BTR_MODIFY_LEAF. */ -void -btr_pcur_open_on_user_rec( - dict_index_t* index, /*!< in: index */ - const dtuple_t* tuple, /*!< in: tuple on which search done */ - page_cur_mode_t mode, /*!< in: PAGE_CUR_L, ... */ - ulint latch_mode, /*!< in: BTR_SEARCH_LEAF or - BTR_MODIFY_LEAF */ - btr_pcur_t* cursor, /*!< in: memory buffer for persistent - cursor */ - mtr_t* mtr) /*!< in: mtr */ -{ - btr_pcur_open_low(index, 0, tuple, mode, latch_mode, cursor, 0, mtr); - - if ((mode == PAGE_CUR_GE) || (mode == PAGE_CUR_G)) { - - if (btr_pcur_is_after_last_on_page(cursor)) { - - btr_pcur_move_to_next_user_rec(cursor, mtr); - } - } else { - ut_ad((mode == PAGE_CUR_LE) || (mode == PAGE_CUR_L)); - - /* Not implemented yet */ - - ut_error; - } + return btr_pcur_move_to_prev_on_page(cursor) != nullptr; } diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index 96bbd8af3c1d9..300276ff3a638 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -302,7 +302,7 @@ are consistent. @param[in] cursor cursor which was just positioned */ static void btr_search_info_update_hash(btr_search_t *info, btr_cur_t *cursor) { - dict_index_t* index = cursor->index; + dict_index_t* index = cursor->index(); int cmp; if (dict_index_is_ibuf(index)) { @@ -704,14 +704,14 @@ btr_search_update_hash_ref( return; } - if (index != cursor->index) { - ut_ad(index->id == cursor->index->id); - btr_search_drop_page_hash_index(block); + if (index != cursor->index()) { + ut_ad(index->id == cursor->index()->id); + btr_search_drop_page_hash_index(block, false); return; } ut_ad(block->page.id().space() == index->table->space_id); - ut_ad(index == cursor->index); + ut_ad(index == cursor->index()); ut_ad(!dict_index_is_ibuf(index)); auto part = btr_search_sys.get_part(*index); part->latch.wr_lock(SRW_LOCK_CALL); @@ -781,22 +781,35 @@ btr_search_check_guess( mem_heap_t* heap = NULL; rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs* offsets = offsets_; - ibool success = FALSE; + bool success = false; rec_offs_init(offsets_); - n_unique = dict_index_get_n_unique_in_tree(cursor->index); + n_unique = dict_index_get_n_unique_in_tree(cursor->index()); rec = btr_cur_get_rec(cursor); - ut_ad(page_rec_is_user_rec(rec)); - ut_ad(page_rec_is_leaf(rec)); + if (UNIV_UNLIKELY(!page_rec_is_user_rec(rec) + || !page_rec_is_leaf(rec))) { + ut_ad("corrupted index" == 0); + return false; + } else if (cursor->index()->table->not_redundant()) { + switch (rec_get_status(rec)) { + case REC_STATUS_INSTANT: + case REC_STATUS_ORDINARY: + break; + default: + ut_ad("corrupted index" == 0); + return false; + } + } match = 0; - offsets = rec_get_offsets(rec, cursor->index, offsets, - cursor->index->n_core_fields, + offsets = rec_get_offsets(rec, cursor->index(), offsets, + cursor->index()->n_core_fields, n_unique, &heap); - cmp = cmp_dtuple_rec_with_match(tuple, rec, offsets, &match); + cmp = cmp_dtuple_rec_with_match(tuple, rec, cursor->index(), offsets, + &match); if (mode == PAGE_CUR_GE) { if (cmp > 0) { @@ -806,7 +819,7 @@ btr_search_check_guess( cursor->up_match = match; if (match >= n_unique) { - success = TRUE; + success = true; goto exit_func; } } else if (mode == PAGE_CUR_LE) { @@ -835,20 +848,35 @@ btr_search_check_guess( match = 0; if ((mode == PAGE_CUR_G) || (mode == PAGE_CUR_GE)) { - ut_ad(!page_rec_is_infimum(rec)); - const rec_t* prev_rec = page_rec_get_prev(rec); + if (UNIV_UNLIKELY(!prev_rec)) { + ut_ad("corrupted index" == 0); + goto exit_func; + } + if (page_rec_is_infimum(prev_rec)) { success = !page_has_prev(page_align(prev_rec)); goto exit_func; } - offsets = rec_get_offsets(prev_rec, cursor->index, offsets, - cursor->index->n_core_fields, + if (cursor->index()->table->not_redundant()) { + switch (rec_get_status(prev_rec)) { + case REC_STATUS_INSTANT: + case REC_STATUS_ORDINARY: + break; + default: + ut_ad("corrupted index" == 0); + goto exit_func; + } + } + + offsets = rec_get_offsets(prev_rec, cursor->index(), offsets, + cursor->index()->n_core_fields, n_unique, &heap); - cmp = cmp_dtuple_rec_with_match( - tuple, prev_rec, offsets, &match); + cmp = cmp_dtuple_rec_with_match(tuple, prev_rec, + cursor->index(), offsets, + &match); if (mode == PAGE_CUR_GE) { success = cmp > 0; } else { @@ -859,20 +887,36 @@ btr_search_check_guess( const rec_t* next_rec = page_rec_get_next(rec); + if (UNIV_UNLIKELY(!next_rec)) { + ut_ad("corrupted index" == 0); + goto exit_func; + } + if (page_rec_is_supremum(next_rec)) { if (!page_has_next(page_align(next_rec))) { cursor->up_match = 0; - success = TRUE; + success = true; } goto exit_func; } - offsets = rec_get_offsets(next_rec, cursor->index, offsets, - cursor->index->n_core_fields, + if (cursor->index()->table->not_redundant()) { + switch (rec_get_status(next_rec)) { + case REC_STATUS_INSTANT: + case REC_STATUS_ORDINARY: + break; + default: + ut_ad("corrupted index" == 0); + goto exit_func; + } + } + + offsets = rec_get_offsets(next_rec, cursor->index(), offsets, + cursor->index()->n_core_fields, n_unique, &heap); cmp = cmp_dtuple_rec_with_match( - tuple, next_rec, offsets, &match); + tuple, next_rec, cursor->index(), offsets, &match); if (mode == PAGE_CUR_LE) { success = cmp < 0; cursor->up_match = match; @@ -994,15 +1038,9 @@ both have sensible values. @param[in,out] info index search info @param[in] tuple logical record @param[in] mode PAGE_CUR_L, .... -@param[in] latch_mode BTR_SEARCH_LEAF, ...; - NOTE that only if has_search_latch is 0, we will - have a latch set on the cursor page, otherwise - we assume the caller uses his search latch - to protect the record! +@param[in] latch_mode BTR_SEARCH_LEAF, ... @param[out] cursor tree cursor -@param[in] ahi_latch the adaptive hash index latch being held, - or NULL -@param[in] mtr mini transaction +@param[in] mtr mini-transaction @return whether the search succeeded */ TRANSACTIONAL_TARGET bool @@ -1013,35 +1051,30 @@ btr_search_guess_on_hash( ulint mode, ulint latch_mode, btr_cur_t* cursor, - srw_spin_lock* ahi_latch, mtr_t* mtr) { ulint fold; index_id_t index_id; ut_ad(mtr->is_active()); + ut_ad(index->is_btree() || index->is_ibuf()); - if (!btr_search_enabled) { + /* Note that, for efficiency, the struct info may not be protected by + any latch here! */ + + if (latch_mode > BTR_MODIFY_LEAF + || !info->last_hash_succ || !info->n_hash_potential + || (tuple->info_bits & REC_INFO_MIN_REC_FLAG)) { return false; } - ut_ad(!index->is_ibuf()); - ut_ad(!ahi_latch - || ahi_latch == &btr_search_sys.get_part(*index)->latch); + ut_ad(index->is_btree()); + ut_ad(!index->table->is_temporary()); + ut_ad(latch_mode == BTR_SEARCH_LEAF || latch_mode == BTR_MODIFY_LEAF); compile_time_assert(ulint{BTR_SEARCH_LEAF} == ulint{RW_S_LATCH}); compile_time_assert(ulint{BTR_MODIFY_LEAF} == ulint{RW_X_LATCH}); - /* Not supported for spatial index */ - ut_ad(!dict_index_is_spatial(index)); - - /* Note that, for efficiency, the struct info may not be protected by - any latch here! */ - - if (info->n_hash_potential == 0) { - return false; - } - cursor->n_fields = info->n_fields; cursor->n_bytes = info->n_bytes; @@ -1062,104 +1095,73 @@ btr_search_guess_on_hash( auto part = btr_search_sys.get_part(*index); const rec_t* rec; - if (!ahi_latch) { - part->latch.rd_lock(SRW_LOCK_CALL); + part->latch.rd_lock(SRW_LOCK_CALL); - if (!btr_search_enabled) { - goto fail; - } - } else { - ut_ad(btr_search_enabled); + if (!btr_search_enabled) { + goto ahi_release_and_fail; } rec = static_cast( ha_search_and_get_data(&part->table, fold)); if (!rec) { - if (!ahi_latch) { +ahi_release_and_fail: + part->latch.rd_unlock(); fail: - part->latch.rd_unlock(); - } - btr_search_failure(info, cursor); return false; } buf_block_t* block = buf_pool.block_from_ahi(rec); - if (!ahi_latch) { - buf_pool_t::hash_chain& chain = buf_pool.page_hash.cell_get( - block->page.id().fold()); - bool fail, got_latch; - { - transactional_shared_lock_guard g{ - buf_pool.page_hash.lock_get(chain)}; - - const auto state = block->page.state(); - if (state == buf_page_t::REMOVE_HASH) { - /* Another thread is just freeing the block - from the LRU list of the buffer pool: do not - try to access this page. */ - goto fail; - } - if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) { -#ifndef NO_ELISION - xend(); -#endif - ut_error; - } - - fail = index != block->index - && index_id == block->index->id; - got_latch = (latch_mode == BTR_SEARCH_LEAF) - ? block->page.lock.s_lock_try() - : block->page.lock.x_lock_try(); - } + buf_pool_t::hash_chain& chain = buf_pool.page_hash.cell_get( + block->page.id().fold()); + bool got_latch; + { + transactional_shared_lock_guard g{ + buf_pool.page_hash.lock_get(chain)}; + got_latch = (latch_mode == BTR_SEARCH_LEAF) + ? block->page.lock.s_lock_try() + : block->page.lock.x_lock_try(); + } - ut_a(!fail || block->index->freed()); - if (!got_latch) { - goto fail; - } + if (!got_latch) { + goto ahi_release_and_fail; + } - block->page.fix(); - block->page.set_accessed(); - buf_page_make_young_if_needed(&block->page); - mtr_memo_type_t fix_type; + const auto state = block->page.state(); + if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) { + ut_ad(state == buf_page_t::REMOVE_HASH); +block_and_ahi_release_and_fail: if (latch_mode == BTR_SEARCH_LEAF) { - fix_type = MTR_MEMO_PAGE_S_FIX; - ut_ad(!block->page.is_read_fixed()); + block->page.lock.s_unlock(); } else { - fix_type = MTR_MEMO_PAGE_X_FIX; - ut_ad(!block->page.is_io_fixed()); + block->page.lock.x_unlock(); } - mtr->memo_push(block, fix_type); - - ++buf_pool.stat.n_page_gets; - - part->latch.rd_unlock(); + goto ahi_release_and_fail; + } - if (UNIV_UNLIKELY(fail)) { - goto fail_and_release_page; - } + ut_ad(state < buf_page_t::READ_FIX || state >= buf_page_t::WRITE_FIX); + ut_ad(state < buf_page_t::READ_FIX || latch_mode == BTR_SEARCH_LEAF); - DBUG_ASSERT(!block->page.is_freed()); - } else if (UNIV_UNLIKELY(index != block->index - && index_id == block->index->id)) { + if (index != block->index && index_id == block->index->id) { ut_a(block->index->freed()); - goto fail_and_release_page; + goto block_and_ahi_release_and_fail; } - if (!block->page.in_file()) { - ut_ad(block->page.state() == buf_page_t::REMOVE_HASH); + block->page.fix(); + block->page.set_accessed(); + buf_page_make_young_if_needed(&block->page); + static_assert(ulint{MTR_MEMO_PAGE_S_FIX} == ulint{BTR_SEARCH_LEAF}, + ""); + static_assert(ulint{MTR_MEMO_PAGE_X_FIX} == ulint{BTR_MODIFY_LEAF}, + ""); -fail_and_release_page: - if (!ahi_latch) { - btr_leaf_page_release(block, latch_mode, mtr); - } + part->latch.rd_unlock(); - btr_search_failure(info, cursor); - return false; - } + ++buf_pool.stat.n_page_gets; + + mtr->memo_push(block, mtr_memo_type_t(latch_mode)); ut_ad(page_rec_is_user_rec(rec)); @@ -1173,8 +1175,9 @@ btr_search_guess_on_hash( record to determine if our guess for the cursor position is right. */ if (index_id != btr_page_get_index_id(block->page.frame) - || !btr_search_check_guess(cursor, !!ahi_latch, tuple, mode)) { - goto fail_and_release_page; + || !btr_search_check_guess(cursor, false, tuple, mode)) { + mtr->release_last_page(); + goto fail; } if (info->n_hash_potential < BTR_SEARCH_BUILD_LIMIT + 5) { @@ -1182,54 +1185,11 @@ btr_search_guess_on_hash( info->n_hash_potential++; } -#ifdef notdefined - /* These lines of code can be used in a debug version to check - the correctness of the searched cursor position: */ - - info->last_hash_succ = FALSE; - - /* Currently, does not work if the following fails: */ - ut_ad(!ahi_latch); - - btr_leaf_page_release(block, latch_mode, mtr); - - btr_cur_search_to_nth_level( - index, 0, tuple, mode, latch_mode, &cursor2, 0, mtr); - - if (mode == PAGE_CUR_GE - && page_rec_is_supremum(btr_cur_get_rec(&cursor2))) { - - /* If mode is PAGE_CUR_GE, then the binary search - in the index tree may actually take us to the supremum - of the previous page */ - - info->last_hash_succ = FALSE; - - btr_pcur_open_on_user_rec( - index, tuple, mode, latch_mode, &pcur, mtr); - - ut_ad(btr_pcur_get_rec(&pcur) == btr_cur_get_rec(cursor)); - } else { - ut_ad(btr_cur_get_rec(&cursor2) == btr_cur_get_rec(cursor)); - } - - /* NOTE that it is theoretically possible that the above assertions - fail if the page of the cursor gets removed from the buffer pool - meanwhile! Thus it might not be a bug. */ -#endif info->last_hash_succ = TRUE; #ifdef UNIV_SEARCH_PERF_STAT btr_search_n_succ++; #endif - /* Increment the page get statistics though we did not really - fix the page: for user info only */ - ++buf_pool.stat.n_page_gets; - - if (!ahi_latch) { - buf_page_make_young_if_needed(&block->page); - } - return true; } @@ -1238,27 +1198,19 @@ btr_search_guess_on_hash( index page for which we know that block->buf_fix_count == 0 or it is an index page which has already been removed from the buf_pool.page_hash - i.e.: it is in state BUF_BLOCK_REMOVE_HASH */ -void btr_search_drop_page_hash_index(buf_block_t* block) + i.e.: it is in state BUF_BLOCK_REMOVE_HASH +@param[in] garbage_collect drop ahi only if the index is marked + as freed */ +void btr_search_drop_page_hash_index(buf_block_t* block, + bool garbage_collect) { ulint n_fields; ulint n_bytes; - const page_t* page; const rec_t* rec; - ulint fold; - ulint prev_fold; - ulint n_cached; - ulint n_recs; - ulint* folds; - ulint i; mem_heap_t* heap; rec_offs* offsets; retry: - /* This debug check uses a dirty read that could theoretically cause - false positives while buf_pool.clear_hash_index() is executing. */ - assert_block_ahi_valid(block); - if (!block->index) { return; } @@ -1282,13 +1234,21 @@ void btr_search_drop_page_hash_index(buf_block_t* block) auto part = btr_search_sys.get_part(index_id, block->page.id().space()); + part->latch.rd_lock(SRW_LOCK_CALL); + dict_index_t* index = block->index; bool is_freed = index && index->freed(); if (is_freed) { + part->latch.rd_unlock(); part->latch.wr_lock(SRW_LOCK_CALL); - } else { - part->latch.rd_lock(SRW_LOCK_CALL); + if (index != block->index) { + part->latch.wr_unlock(); + goto retry; + } + } else if (garbage_collect) { + part->latch.rd_unlock(); + return; } assert_block_ahi_valid(block); @@ -1321,33 +1281,50 @@ void btr_search_drop_page_hash_index(buf_block_t* block) ut_a(n_fields > 0 || n_bytes > 0); - page = block->page.frame; - n_recs = page_get_n_recs(page); + const page_t* const page = block->page.frame; + ulint n_recs = page_get_n_recs(page); + if (!n_recs) { + ut_ad("corrupted adaptive hash index" == 0); + return; + } /* Calculate and cache fold values into an array for fast deletion from the hash index */ - folds = (ulint*) ut_malloc_nokey(n_recs * sizeof(ulint)); - - n_cached = 0; - rec = page_get_infimum_rec(page); rec = page_rec_get_next_low(rec, page_is_comp(page)); - if (rec_is_metadata(rec, *index)) { + + ulint* folds; + ulint n_cached = 0; + ulint prev_fold = 0; + + if (rec && rec_is_metadata(rec, *index)) { rec = page_rec_get_next_low(rec, page_is_comp(page)); + if (!--n_recs) { + /* The page only contains the hidden metadata record + for instant ALTER TABLE that the adaptive hash index + never points to. */ + folds = nullptr; + goto all_deleted; + } } - prev_fold = 0; - - heap = NULL; - offsets = NULL; + folds = (ulint*) ut_malloc_nokey(n_recs * sizeof(ulint)); + heap = nullptr; + offsets = nullptr; - while (!page_rec_is_supremum(rec)) { + while (rec) { + if (n_cached >= n_recs) { + ut_ad(page_rec_is_supremum(rec)); + break; + } + ut_ad(page_rec_is_user_rec(rec)); offsets = rec_get_offsets( rec, index, offsets, index->n_core_fields, btr_search_get_n_fields(n_fields, n_bytes), &heap); - fold = rec_fold(rec, offsets, n_fields, n_bytes, index_id); + const ulint fold = rec_fold(rec, offsets, n_fields, n_bytes, + index_id); if (fold == prev_fold && prev_fold != 0) { @@ -1356,11 +1333,13 @@ void btr_search_drop_page_hash_index(buf_block_t* block) /* Remove all hash nodes pointing to this page from the hash chain */ + folds[n_cached++] = fold; - folds[n_cached] = fold; - n_cached++; next_rec: rec = page_rec_get_next_low(rec, page_rec_is_comp(rec)); + if (!rec || page_rec_is_supremum(rec)) { + break; + } prev_fold = fold; } @@ -1368,6 +1347,7 @@ void btr_search_drop_page_hash_index(buf_block_t* block) mem_heap_free(heap); } +all_deleted: if (!is_freed) { part->latch.wr_lock(SRW_LOCK_CALL); @@ -1392,7 +1372,7 @@ void btr_search_drop_page_hash_index(buf_block_t* block) goto retry; } - for (i = 0; i < n_cached; i++) { + for (ulint i = 0; i < n_cached; i++) { ha_remove_all_nodes_to_page(&part->table, part->heap, folds[i], page); } @@ -1406,7 +1386,7 @@ void btr_search_drop_page_hash_index(buf_block_t* block) } } - block->index = NULL; + block->index = nullptr; MONITOR_INC(MONITOR_ADAPTIVE_HASH_PAGE_REMOVED); MONITOR_INC_VALUE(MONITOR_ADAPTIVE_HASH_ROW_REMOVED, n_cached); @@ -1437,19 +1417,13 @@ void btr_search_drop_page_hash_when_freed(const page_id_t page_id) block = buf_page_get_gen(page_id, 0, RW_X_LATCH, NULL, BUF_PEEK_IF_IN_POOL, &mtr); - if (block) { - /* If AHI is still valid, page can't be in free state. - AHI is dropped when page is freed. */ - DBUG_ASSERT(!block->page.is_freed()); - - if (block->index) { - /* In all our callers, the table handle should - be open, or we should be in the process of - dropping the table (preventing eviction). */ - DBUG_ASSERT(block->index->table->get_ref_count() - || dict_sys.locked()); - btr_search_drop_page_hash_index(block); - } + if (block && block->index) { + /* In all our callers, the table handle should + be open, or we should be in the process of + dropping the table (preventing eviction). */ + DBUG_ASSERT(block->index->table->get_ref_count() + || dict_sys.locked()); + btr_search_drop_page_hash_index(block, false); } mtr_commit(&mtr); @@ -1476,7 +1450,6 @@ btr_search_build_page_hash_index( bool left_side) { const rec_t* rec; - const rec_t* next_rec; ulint fold; ulint next_fold; ulint n_cached; @@ -1518,7 +1491,7 @@ btr_search_build_page_hash_index( } if (rebuild) { - btr_search_drop_page_hash_index(block); + btr_search_drop_page_hash_index(block, false); } /* Check that the values for hash index build are sensible */ @@ -1542,10 +1515,11 @@ btr_search_build_page_hash_index( } rec = page_rec_get_next_const(page_get_infimum_rec(page)); + if (!rec) return; if (rec_is_metadata(rec, *index)) { rec = page_rec_get_next_const(rec); - if (!--n_recs) return; + if (!rec || !--n_recs) return; } /* Calculate and cache fold values and corresponding records into @@ -1575,9 +1549,7 @@ btr_search_build_page_hash_index( n_cached++; } - for (;;) { - next_rec = page_rec_get_next_const(rec); - + while (const rec_t* next_rec = page_rec_get_next_const(rec)) { if (page_rec_is_supremum(next_rec)) { if (!left_side) { @@ -1670,7 +1642,7 @@ btr_search_build_page_hash_index( @param[in,out] cursor cursor which was just positioned */ void btr_search_info_update_slow(btr_search_t *info, btr_cur_t *cursor) { - srw_spin_lock* ahi_latch = &btr_search_sys.get_part(*cursor->index) + srw_spin_lock* ahi_latch = &btr_search_sys.get_part(*cursor->index()) ->latch; buf_block_t* block = btr_cur_get_block(cursor); @@ -1685,7 +1657,7 @@ void btr_search_info_update_slow(btr_search_t *info, btr_cur_t *cursor) if (build_index || (cursor->flag == BTR_CUR_HASH_FAIL)) { - btr_search_check_free_space_in_heap(cursor->index); + btr_search_check_free_space_in_heap(cursor->index()); } if (cursor->flag == BTR_CUR_HASH_FAIL) { @@ -1702,7 +1674,7 @@ void btr_search_info_update_slow(btr_search_t *info, btr_cur_t *cursor) /* Note that since we did not protect block->n_fields etc. with any semaphore, the values can be inconsistent. We have to check inside the function call that they make sense. */ - btr_search_build_page_hash_index(cursor->index, block, + btr_search_build_page_hash_index(cursor->index(), block, ahi_latch, block->n_fields, block->n_bytes, @@ -1743,7 +1715,7 @@ btr_search_move_or_delete_hash_entries( if (new_block->index) { drop_exit: - btr_search_drop_page_hash_index(block); + btr_search_drop_page_hash_index(block, false); return; } @@ -1751,12 +1723,13 @@ btr_search_move_or_delete_hash_entries( return; } + ahi_latch->rd_lock(SRW_LOCK_CALL); + if (index->freed()) { + ahi_latch->rd_unlock(); goto drop_exit; } - ahi_latch->rd_lock(SRW_LOCK_CALL); - if (block->index) { uint16_t n_fields = block->curr_n_fields; uint16_t n_bytes = block->curr_n_bytes; @@ -1813,15 +1786,15 @@ void btr_search_update_hash_on_delete(btr_cur_t *cursor) return; } - ut_ad(!cursor->index->table->is_temporary()); + ut_ad(!cursor->index()->table->is_temporary()); - if (index != cursor->index) { - btr_search_drop_page_hash_index(block); + if (index != cursor->index()) { + btr_search_drop_page_hash_index(block, false); return; } ut_ad(block->page.id().space() == index->table->space_id); - ut_a(index == cursor->index); + ut_a(index == cursor->index()); ut_a(block->curr_n_fields > 0 || block->curr_n_bytes > 0); ut_ad(!dict_index_is_ibuf(index)); @@ -1868,7 +1841,7 @@ void btr_search_update_hash_node_on_insert(btr_cur_t *cursor, dict_index_t* index; rec_t* rec; - ut_ad(ahi_latch == &btr_search_sys.get_part(*cursor->index)->latch); + ut_ad(ahi_latch == &btr_search_sys.get_part(*cursor->index())->latch); if (!btr_search_enabled) { return; @@ -1887,15 +1860,15 @@ void btr_search_update_hash_node_on_insert(btr_cur_t *cursor, return; } - ut_ad(!cursor->index->table->is_temporary()); + ut_ad(!cursor->index()->table->is_temporary()); - if (index != cursor->index) { - ut_ad(index->id == cursor->index->id); - btr_search_drop_page_hash_index(block); + if (index != cursor->index()) { + ut_ad(index->id == cursor->index()->id); + btr_search_drop_page_hash_index(block, false); return; } - ut_a(cursor->index == index); + ut_a(cursor->index() == index); ut_ad(!dict_index_is_ibuf(index)); ahi_latch->wr_lock(SRW_LOCK_CALL); @@ -1910,12 +1883,15 @@ void btr_search_update_hash_node_on_insert(btr_cur_t *cursor, && (cursor->n_fields == block->curr_n_fields) && (cursor->n_bytes == block->curr_n_bytes) && !block->curr_left_side) { - - if (ha_search_and_update_if_found( - &btr_search_sys.get_part(*cursor->index)->table, - cursor->fold, rec, block, - page_rec_get_next(rec))) { - MONITOR_INC(MONITOR_ADAPTIVE_HASH_ROW_UPDATED); + if (const rec_t *new_rec = page_rec_get_next_const(rec)) { + if (ha_search_and_update_if_found( + &btr_search_sys.get_part(*cursor->index()) + ->table, + cursor->fold, rec, block, new_rec)) { + MONITOR_INC(MONITOR_ADAPTIVE_HASH_ROW_UPDATED); + } + } else { + ut_ad("corrupted page" == 0); } func_exit: @@ -1952,7 +1928,7 @@ void btr_search_update_hash_on_insert(btr_cur_t *cursor, rec_offs* offsets = offsets_; rec_offs_init(offsets_); - ut_ad(ahi_latch == &btr_search_sys.get_part(*cursor->index)->latch); + ut_ad(ahi_latch == &btr_search_sys.get_part(*cursor->index())->latch); ut_ad(page_is_leaf(btr_cur_get_page(cursor))); if (!btr_search_enabled) { @@ -1976,15 +1952,16 @@ void btr_search_update_hash_on_insert(btr_cur_t *cursor, rec = btr_cur_get_rec(cursor); - ut_ad(!cursor->index->table->is_temporary()); + ut_ad(!cursor->index()->table->is_temporary()); - if (index != cursor->index) { - ut_ad(index->id == cursor->index->id); - btr_search_drop_page_hash_index(block); + if (index != cursor->index()) { + ut_ad(index->id == cursor->index()->id); +drop: + btr_search_drop_page_hash_index(block, false); return; } - ut_a(index == cursor->index); + ut_a(index == cursor->index()); ut_ad(!dict_index_is_ibuf(index)); n_fields = block->curr_n_fields; @@ -1992,7 +1969,9 @@ void btr_search_update_hash_on_insert(btr_cur_t *cursor, const bool left_side = block->curr_left_side; ins_rec = page_rec_get_next_const(rec); + if (UNIV_UNLIKELY(!ins_rec)) goto drop; next_rec = page_rec_get_next_const(ins_rec); + if (UNIV_UNLIKELY(!next_rec)) goto drop; offsets = rec_get_offsets(ins_rec, index, offsets, index->n_core_fields, @@ -2342,5 +2321,20 @@ btr_search_validate() return(true); } +#ifdef UNIV_DEBUG +bool btr_search_check_marked_free_index(const buf_block_t *block) +{ + const index_id_t index_id= btr_page_get_index_id(block->page.frame); + auto part= btr_search_sys.get_part(index_id, block->page.id().space()); + + part->latch.rd_lock(SRW_LOCK_CALL); + + bool is_freed= block->index && block->index->freed(); + + part->latch.rd_unlock(); + + return is_freed; +} +#endif /* UNIV_DEBUG */ #endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */ #endif /* BTR_CUR_HASH_ADAPT */ diff --git a/storage/innobase/buf/buf0buddy.cc b/storage/innobase/buf/buf0buddy.cc index 3d476fbac7768..85a698bc875b5 100644 --- a/storage/innobase/buf/buf0buddy.cc +++ b/storage/innobase/buf/buf0buddy.cc @@ -298,7 +298,7 @@ static buf_buddy_free_t* buf_buddy_alloc_zip(ulint i) buf = UT_LIST_GET_FIRST(buf_pool.zip_free[i]); - if (buf_pool.curr_size < buf_pool.old_size + if (buf_pool.is_shrinking() && UT_LIST_GET_LEN(buf_pool.withdraw) < buf_pool.withdraw_target) { @@ -609,7 +609,7 @@ void buf_buddy_free_low(void* buf, ulint i) We may waste up to 15360*max_len bytes to free blocks (1024 + 2048 + 4096 + 8192 = 15360) */ if (UT_LIST_GET_LEN(buf_pool.zip_free[i]) < 16 - && buf_pool.curr_size >= buf_pool.old_size) { + && !buf_pool.is_shrinking()) { goto func_exit; } @@ -715,7 +715,7 @@ buf_buddy_realloc(void* buf, ulint size) void buf_buddy_condense_free() { mysql_mutex_assert_owner(&buf_pool.mutex); - ut_ad(buf_pool.curr_size < buf_pool.old_size); + ut_ad(buf_pool.is_shrinking()); for (ulint i = 0; i < UT_ARR_SIZE(buf_pool.zip_free); ++i) { buf_buddy_free_t* buf = diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index e781a1dac8c20..365ec1340f0b8 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -67,6 +67,7 @@ Created 11/5/1995 Heikki Tuuri #include "buf0dump.h" #include #include +#include "log.h" using st_::span; @@ -403,28 +404,21 @@ static bool buf_page_decrypt_after_read(buf_page_t *bpage, return (true); } - if (node.space->purpose == FIL_TYPE_TEMPORARY + buf_tmp_buffer_t* slot; + + if (id.space() == SRV_TMP_SPACE_ID && innodb_encrypt_temporary_tables) { - buf_tmp_buffer_t* slot = buf_pool.io_buf_reserve(); - ut_a(slot); + slot = buf_pool.io_buf_reserve(); slot->allocate(); - - if (!buf_tmp_page_decrypt(slot->crypt_buf, dst_frame)) { - slot->release(); - ib::error() << "Encrypted page " << id - << " in file " << node.name; - return false; - } - + bool ok = buf_tmp_page_decrypt(slot->crypt_buf, dst_frame); slot->release(); - return true; + return ok; } /* Page is encrypted if encryption information is found from tablespace and page contains used key_version. This is true also for pages first compressed and then encrypted. */ - buf_tmp_buffer_t* slot; uint key_version = buf_page_get_key_version(dst_frame, flags); if (page_compressed && !key_version) { @@ -437,17 +431,12 @@ static bool buf_page_decrypt_after_read(buf_page_t *bpage, } slot = buf_pool.io_buf_reserve(); - ut_a(slot); slot->allocate(); decompress_with_slot: - ut_d(fil_page_type_validate(node.space, dst_frame)); - ulint write_size = fil_page_decompress( slot->crypt_buf, dst_frame, flags); slot->release(); - ut_ad(!write_size - || fil_page_type_validate(node.space, dst_frame)); ut_ad(node.space->referenced()); return write_size != 0; } @@ -465,9 +454,7 @@ static bool buf_page_decrypt_after_read(buf_page_t *bpage, } slot = buf_pool.io_buf_reserve(); - ut_a(slot); slot->allocate(); - ut_d(fil_page_type_validate(node.space, dst_frame)); /* decrypt using crypt_buf to dst_frame */ if (!fil_space_decrypt(node.space, slot->crypt_buf, dst_frame)) { @@ -475,8 +462,6 @@ static bool buf_page_decrypt_after_read(buf_page_t *bpage, goto decrypt_failed; } - ut_d(fil_page_type_validate(node.space, dst_frame)); - if ((fil_space_t::full_crc32(flags) && page_compressed) || fil_page_get_type(dst_frame) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) { @@ -583,9 +568,6 @@ bool buf_is_zeroes(span buf) bool buf_page_is_corrupted(bool check_lsn, const byte *read_buf, uint32_t fsp_flags) { -#ifndef UNIV_INNOCHECKSUM - DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(true); ); -#endif if (fil_space_t::full_crc32(fsp_flags)) { bool compressed = false, corrupted = false; const uint size = buf_page_full_crc32_size( @@ -604,7 +586,7 @@ bool buf_page_is_corrupted(bool check_lsn, const byte *read_buf, DBUG_EXECUTE_IF( "page_intermittent_checksum_mismatch", { static int page_counter; - if (page_counter++ == 2) { + if (page_counter++ == 3) { crc32++; } }); @@ -630,10 +612,6 @@ bool buf_page_is_corrupted(bool check_lsn, const byte *read_buf, return false; } -#ifndef UNIV_INNOCHECKSUM - uint32_t crc32 = 0; - bool crc32_inited = false; -#endif /* !UNIV_INNOCHECKSUM */ const ulint zip_size = fil_space_t::zip_size(fsp_flags); const uint16_t page_type = fil_page_get_type(read_buf); @@ -728,6 +706,8 @@ bool buf_page_is_corrupted(bool check_lsn, const byte *read_buf, return false; } + const uint32_t crc32 = buf_calc_page_crc32(read_buf); + /* Very old versions of InnoDB only stored 8 byte lsn to the start and the end of the page. */ @@ -738,18 +718,14 @@ bool buf_page_is_corrupted(bool check_lsn, const byte *read_buf, != mach_read_from_4(read_buf + FIL_PAGE_LSN) && checksum_field2 != BUF_NO_CHECKSUM_MAGIC) { - crc32 = buf_calc_page_crc32(read_buf); - crc32_inited = true; - DBUG_EXECUTE_IF( "page_intermittent_checksum_mismatch", { - static int page_counter; - if (page_counter++ == 2) { - crc32++; - } - }); + static int page_counter; + if (page_counter++ == 3) return true; + }); - if (checksum_field2 != crc32 + if ((checksum_field1 != crc32 + || checksum_field2 != crc32) && checksum_field2 != buf_calc_page_old_checksum(read_buf)) { return true; @@ -759,25 +735,11 @@ bool buf_page_is_corrupted(bool check_lsn, const byte *read_buf, switch (checksum_field1) { case 0: case BUF_NO_CHECKSUM_MAGIC: - break; - default: - if (!crc32_inited) { - crc32 = buf_calc_page_crc32(read_buf); - crc32_inited = true; - } - - if (checksum_field1 != crc32 - && checksum_field1 - != buf_calc_page_new_checksum(read_buf)) { - return true; - } + return false; } - - return crc32_inited - && ((checksum_field1 == crc32 - && checksum_field2 != crc32) - || (checksum_field1 != crc32 - && checksum_field2 == crc32)); + return (checksum_field1 != crc32 || checksum_field2 != crc32) + && checksum_field1 + != buf_calc_page_new_checksum(read_buf); } #endif /* !UNIV_INNOCHECKSUM */ } @@ -793,6 +755,7 @@ in the event that you want all of the memory to be dumped to a core file. Returns number of errors found in madvise calls. */ +MY_ATTRIBUTE((used)) int buf_madvise_do_dump() { @@ -817,136 +780,41 @@ buf_madvise_do_dump() } #endif +#ifndef UNIV_DEBUG +static inline byte hex_to_ascii(byte hex_digit) +{ + const int offset= hex_digit <= 9 ? '0' : 'a' - 10; + return byte(hex_digit + offset); +} +#endif + /** Dump a page to stderr. @param[in] read_buf database page @param[in] zip_size compressed page size, or 0 */ -void buf_page_print(const byte* read_buf, ulint zip_size) +ATTRIBUTE_COLD +void buf_page_print(const byte *read_buf, ulint zip_size) { - dict_index_t* index; - #ifndef UNIV_DEBUG - const ulint size = zip_size ? zip_size : srv_page_size; - ib::info() << "Page dump in ascii and hex (" - << size << " bytes):"; + const size_t size = zip_size ? zip_size : srv_page_size; + const byte * const end= read_buf + size; + sql_print_information("InnoDB: Page dump (%zu bytes):", size); - ut_print_buf(stderr, read_buf, size); - fputs("\nInnoDB: End of page dump\n", stderr); -#endif + do + { + byte row[64]; - if (zip_size) { - /* Print compressed page. */ - ib::info() << "Compressed page type (" - << fil_page_get_type(read_buf) - << "); stored checksum in field1 " - << mach_read_from_4( - read_buf + FIL_PAGE_SPACE_OR_CHKSUM) - << "; calculated checksums for field1: " - << "crc32 " - << page_zip_calc_checksum(read_buf, zip_size, false) - << ", adler32 " - << page_zip_calc_checksum(read_buf, zip_size, true) - << "; page LSN " - << mach_read_from_8(read_buf + FIL_PAGE_LSN) - << "; page number (if stored to page" - << " already) " - << mach_read_from_4(read_buf + FIL_PAGE_OFFSET) - << "; space id (if stored to page already) " - << mach_read_from_4( - read_buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); + for (byte *r= row; r != &row[64]; r+= 2, read_buf++) + { + r[0]= hex_to_ascii(byte(*read_buf >> 4)); + r[1]= hex_to_ascii(*read_buf & 15); + } - } else { - const uint32_t crc32 = buf_calc_page_crc32(read_buf); - ulint page_type = fil_page_get_type(read_buf); - - ib::info() << "Uncompressed page, stored checksum in field1 " - << mach_read_from_4( - read_buf + FIL_PAGE_SPACE_OR_CHKSUM) - << ", calculated checksums for field1: crc32 " - << crc32 - << ", innodb " - << buf_calc_page_new_checksum(read_buf) - << ", page type " << page_type - << ", stored checksum in field2 " - << mach_read_from_4(read_buf + srv_page_size - - FIL_PAGE_END_LSN_OLD_CHKSUM) - << ", innodb checksum for field2: " - << buf_calc_page_old_checksum(read_buf) - << ", page LSN " - << mach_read_from_4(read_buf + FIL_PAGE_LSN) - << " " - << mach_read_from_4(read_buf + FIL_PAGE_LSN + 4) - << ", low 4 bytes of LSN at page end " - << mach_read_from_4(read_buf + srv_page_size - - FIL_PAGE_END_LSN_OLD_CHKSUM + 4) - << ", page number (if stored to page already) " - << mach_read_from_4(read_buf + FIL_PAGE_OFFSET) - << ", space id (if created with >= MySQL-4.1.1" - " and stored already) " - << mach_read_from_4( - read_buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); - } + sql_print_information("InnoDB: %.*s", 64, row); + } + while (read_buf != end); - switch (fil_page_get_type(read_buf)) { - index_id_t index_id; - case FIL_PAGE_INDEX: - case FIL_PAGE_TYPE_INSTANT: - case FIL_PAGE_RTREE: - index_id = btr_page_get_index_id(read_buf); - ib::info() << "Page may be an index page where" - " index id is " << index_id; - - index = dict_index_find_on_id_low(index_id); - if (index) { - ib::info() - << "Index " << index_id - << " is " << index->name - << " in table " << index->table->name; - } - break; - case FIL_PAGE_UNDO_LOG: - fputs("InnoDB: Page may be an undo log page\n", stderr); - break; - case FIL_PAGE_INODE: - fputs("InnoDB: Page may be an 'inode' page\n", stderr); - break; - case FIL_PAGE_IBUF_FREE_LIST: - fputs("InnoDB: Page may be an insert buffer free list page\n", - stderr); - break; - case FIL_PAGE_TYPE_ALLOCATED: - fputs("InnoDB: Page may be a freshly allocated page\n", - stderr); - break; - case FIL_PAGE_IBUF_BITMAP: - fputs("InnoDB: Page may be an insert buffer bitmap page\n", - stderr); - break; - case FIL_PAGE_TYPE_SYS: - fputs("InnoDB: Page may be a system page\n", - stderr); - break; - case FIL_PAGE_TYPE_TRX_SYS: - fputs("InnoDB: Page may be a transaction system page\n", - stderr); - break; - case FIL_PAGE_TYPE_FSP_HDR: - fputs("InnoDB: Page may be a file space header page\n", - stderr); - break; - case FIL_PAGE_TYPE_XDES: - fputs("InnoDB: Page may be an extent descriptor page\n", - stderr); - break; - case FIL_PAGE_TYPE_BLOB: - fputs("InnoDB: Page may be a BLOB page\n", - stderr); - break; - case FIL_PAGE_TYPE_ZBLOB: - case FIL_PAGE_TYPE_ZBLOB2: - fputs("InnoDB: Page may be a compressed BLOB page\n", - stderr); - break; - } + sql_print_information("InnoDB: End of page dump"); +#endif } /** Initialize a buffer page descriptor. @@ -1110,9 +978,10 @@ inline const buf_block_t *buf_pool_t::chunk_t::not_freed() const void buf_pool_t::page_hash_table::create(ulint n) { n_cells= ut_find_prime(n); - const size_t size= pad(n_cells) * sizeof *array; - void* v= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE); - memset(v, 0, size); + const size_t size= MY_ALIGN(pad(n_cells) * sizeof *array, + CPU_LEVEL1_DCACHE_LINESIZE); + void *v= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE); + memset_aligned(v, 0, size); array= static_cast(v); } @@ -1126,15 +995,19 @@ bool buf_pool_t::create() ut_ad(srv_buf_pool_size > 0); ut_ad(!resizing); ut_ad(!chunks_old); - ut_ad(!field_ref_zero); + /* mariabackup loads tablespaces, and it requires field_ref_zero to be + allocated before innodb initialization */ + ut_ad(srv_operation >= SRV_OPERATION_RESTORE || !field_ref_zero); NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE; - if (auto b= aligned_malloc(UNIV_PAGE_SIZE_MAX, 4096)) - field_ref_zero= static_cast - (memset_aligned<4096>(b, 0, UNIV_PAGE_SIZE_MAX)); - else - return true; + if (!field_ref_zero) { + if (auto b= aligned_malloc(UNIV_PAGE_SIZE_MAX, 4096)) + field_ref_zero= static_cast + (memset_aligned<4096>(b, 0, UNIV_PAGE_SIZE_MAX)); + else + return true; + } chunk_t::map_reg= UT_NEW_NOKEY(chunk_t::map()); @@ -1191,7 +1064,6 @@ bool buf_pool_t::create() for (size_t i= 0; i < UT_ARR_SIZE(zip_free); ++i) UT_LIST_INIT(zip_free[i], &buf_buddy_free_t::list); ulint s= curr_size; - old_size= s; s/= BUF_READ_AHEAD_PORTION; read_ahead_area= s >= READ_AHEAD_PAGES ? READ_AHEAD_PAGES @@ -1412,6 +1284,41 @@ inline bool buf_pool_t::realloc(buf_block_t *block) return(true); /* free_list was enough */ } +void buf_pool_t::io_buf_t::create(ulint n_slots) +{ + this->n_slots= n_slots; + slots= static_cast + (ut_malloc_nokey(n_slots * sizeof *slots)); + memset((void*) slots, 0, n_slots * sizeof *slots); +} + +void buf_pool_t::io_buf_t::close() +{ + for (buf_tmp_buffer_t *s= slots, *e= slots + n_slots; s != e; s++) + { + aligned_free(s->crypt_buf); + aligned_free(s->comp_buf); + } + ut_free(slots); + slots= nullptr; + n_slots= 0; +} + +buf_tmp_buffer_t *buf_pool_t::io_buf_t::reserve() +{ + for (;;) + { + for (buf_tmp_buffer_t *s= slots, *e= slots + n_slots; s != e; s++) + if (s->acquire()) + return s; + os_aio_wait_until_no_pending_writes(true); + for (buf_tmp_buffer_t *s= slots, *e= slots + n_slots; s != e; s++) + if (s->acquire()) + return s; + os_aio_wait_until_no_pending_reads(true); + } +} + /** Sets the global variable that feeds MySQL's innodb_buffer_pool_resize_status to the specified string. The format and the following parameters are the same as the ones used for printf(3). @@ -1444,8 +1351,8 @@ inline bool buf_pool_t::withdraw_blocks() buf_block_t* block; ulint loop_count = 0; - ib::info() << "start to withdraw the last " - << withdraw_target << " blocks"; + ib::info() << "Start to withdraw the last " + << withdraw_target << " blocks."; while (UT_LIST_GET_LEN(withdraw) < withdraw_target) { @@ -1478,21 +1385,25 @@ inline bool buf_pool_t::withdraw_blocks() block = next_block; } - mysql_mutex_unlock(&mutex); /* reserve free_list length */ if (UT_LIST_GET_LEN(withdraw) < withdraw_target) { buf_flush_LRU( std::max(withdraw_target - UT_LIST_GET_LEN(withdraw), - srv_LRU_scan_depth)); - buf_flush_wait_batch_end_acquiring_mutex(true); + srv_LRU_scan_depth), + true); + mysql_mutex_unlock(&buf_pool.mutex); + buf_dblwr.flush_buffered_writes(); + mysql_mutex_lock(&buf_pool.flush_list_mutex); + buf_flush_wait_LRU_batch_end(); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + mysql_mutex_lock(&buf_pool.mutex); } /* relocate blocks/buddies in withdrawn area */ ulint count2 = 0; - mysql_mutex_lock(&mutex); buf_pool_mutex_exit_forbid(); for (buf_page_t* bpage = UT_LIST_GET_FIRST(LRU), *next_bpage; bpage; bpage = next_bpage) { @@ -1528,15 +1439,15 @@ inline bool buf_pool_t::withdraw_blocks() mysql_mutex_unlock(&mutex); buf_resize_status( - "withdrawing blocks. (" ULINTPF "/" ULINTPF ")", + "Withdrawing blocks. (" ULINTPF "/" ULINTPF ").", UT_LIST_GET_LEN(withdraw), withdraw_target); - ib::info() << "withdrew " + ib::info() << "Withdrew " << count1 << " blocks from free list." - << " Tried to relocate " << count2 << " pages (" + << " Tried to relocate " << count2 << " blocks (" << UT_LIST_GET_LEN(withdraw) << "/" - << withdraw_target << ")"; + << withdraw_target << ")."; if (++loop_count >= 10) { /* give up for now. @@ -1559,8 +1470,8 @@ inline bool buf_pool_t::withdraw_blocks() } } - ib::info() << "withdrawn target: " << UT_LIST_GET_LEN(withdraw) - << " blocks"; + ib::info() << "Withdrawn target: " << UT_LIST_GET_LEN(withdraw) + << " blocks."; return(false); } @@ -1643,7 +1554,7 @@ inline void buf_pool_t::resize() str_new_size << ib::bytes_iec{srv_buf_pool_size}; str_chunk_size << ib::bytes_iec{srv_buf_pool_chunk_unit}; - buf_resize_status("Resizing buffer pool from %s to %s (unit=%s).", + buf_resize_status("Resizing buffer pool from %s to %s (unit = %s).", str_old_size.str().c_str(), str_new_size.str().c_str(), str_chunk_size.str().c_str()); @@ -1664,7 +1575,6 @@ inline void buf_pool_t::resize() #endif /* BTR_CUR_HASH_ADAPT */ mysql_mutex_lock(&mutex); - ut_ad(curr_size == old_size); ut_ad(n_chunks_new == n_chunks); ut_ad(UT_LIST_GET_LEN(withdraw) == 0); @@ -1673,7 +1583,7 @@ inline void buf_pool_t::resize() curr_size = n_chunks_new * chunks->size; mysql_mutex_unlock(&mutex); - if (curr_size < old_size) { + if (is_shrinking()) { /* set withdraw target */ size_t w = 0; @@ -1694,7 +1604,7 @@ inline void buf_pool_t::resize() withdraw_retry: /* wait for the number of blocks fit to the new size (if needed)*/ - bool should_retry_withdraw = curr_size < old_size + bool should_retry_withdraw = is_shrinking() && withdraw_blocks(); if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { @@ -1742,7 +1652,7 @@ inline void buf_pool_t::resize() goto withdraw_retry; } - buf_resize_status("Latching whole of buffer pool."); + buf_resize_status("Latching entire buffer pool."); #ifndef DBUG_OFF { @@ -1766,18 +1676,18 @@ inline void buf_pool_t::resize() /* Indicate critical path */ resizing.store(true, std::memory_order_relaxed); - mysql_mutex_lock(&mutex); - page_hash.write_lock_all(); + mysql_mutex_lock(&mutex); + page_hash.write_lock_all(); chunk_t::map_reg = UT_NEW_NOKEY(chunk_t::map()); /* add/delete chunks */ - buf_resize_status("buffer pool resizing with chunks " - ULINTPF " to " ULINTPF ".", + buf_resize_status("Resizing buffer pool from " + ULINTPF " chunks to " ULINTPF " chunks.", n_chunks, n_chunks_new); - if (n_chunks_new < n_chunks) { + if (is_shrinking()) { /* delete chunks */ chunk_t* chunk = chunks + n_chunks_new; const chunk_t* const echunk = chunks + n_chunks; @@ -1815,7 +1725,7 @@ inline void buf_pool_t::resize() withdraw_target = 0; ib::info() << n_chunks - n_chunks_new - << " chunks (" << sum_freed + << " Chunks (" << sum_freed << " blocks) were freed."; n_chunks = n_chunks_new; @@ -1841,8 +1751,7 @@ inline void buf_pool_t::resize() goto calc_buf_pool_size; } - ulint n_chunks_copy = ut_min(n_chunks_new, - n_chunks); + ulint n_chunks_copy = ut_min(n_chunks_new, n_chunks); memcpy(new_chunks, chunks, n_chunks_copy * sizeof *new_chunks); @@ -1909,7 +1818,6 @@ inline void buf_pool_t::resize() /* set size */ ut_ad(UT_LIST_GET_LEN(withdraw) == 0); ulint s= curr_size; - old_size= s; s/= BUF_READ_AHEAD_PORTION; read_ahead_area= s >= READ_AHEAD_PAGES ? READ_AHEAD_PAGES @@ -1934,18 +1842,18 @@ inline void buf_pool_t::resize() if (!warning && new_size_too_diff) { srv_buf_pool_base_size = srv_buf_pool_size; - buf_resize_status("Resizing also other hash tables."); + buf_resize_status("Resizing other hash tables."); srv_lock_table_size = 5 * (srv_buf_pool_size >> srv_page_size_shift); lock_sys.resize(srv_lock_table_size); dict_sys.resize(); - ib::info() << "Resized hash tables at lock_sys," + ib::info() << "Resized hash tables: lock_sys," #ifdef BTR_CUR_HASH_ADAPT " adaptive hash index," #endif /* BTR_CUR_HASH_ADAPT */ - " dictionary."; + " and dictionary."; } /* normalize ibuf.max_size */ @@ -1953,9 +1861,8 @@ inline void buf_pool_t::resize() if (srv_buf_pool_old_size != srv_buf_pool_size) { - ib::info() << "Completed to resize buffer pool from " - << srv_buf_pool_old_size - << " to " << srv_buf_pool_size << "."; + buf_resize_status("Completed resizing buffer pool from %zu to %zu bytes." + ,srv_buf_pool_old_size, srv_buf_pool_size); srv_buf_pool_old_size = srv_buf_pool_size; } @@ -1967,16 +1874,8 @@ inline void buf_pool_t::resize() } #endif /* BTR_CUR_HASH_ADAPT */ - char now[32]; - - ut_sprintf_timestamp(now); - if (!warning) { - buf_resize_status("Completed resizing buffer pool at %s.", - now); - } else { - buf_resize_status("Resizing buffer pool failed," - " finished resizing at %s.", now); - } + if (warning) + buf_resize_status("Resizing buffer pool failed"); ut_d(validate()); @@ -2077,28 +1976,22 @@ static void buf_relocate(buf_page_t *bpage, buf_page_t *dpage) buf_pool.page_hash.replace(chain, bpage, dpage); } -/** Register a watch for a page identifier. The caller must hold an -exclusive page hash latch. The *hash_lock may be released, -relocated, and reacquired. -@param id page identifier -@param chain hash table chain with exclusively held page_hash -@return a buffer pool block corresponding to id -@retval nullptr if the block was not present, and a watch was installed */ -inline buf_page_t *buf_pool_t::watch_set(const page_id_t id, - buf_pool_t::hash_chain &chain) +buf_page_t *buf_pool_t::watch_set(const page_id_t id, + buf_pool_t::hash_chain &chain) { ut_ad(&chain == &page_hash.cell_get(id.fold())); - ut_ad(page_hash.lock_get(chain).is_write_locked()); + page_hash.lock_get(chain).lock(); -retry: - if (buf_page_t *bpage= page_hash.get(id, chain)) + buf_page_t *bpage= page_hash.get(id, chain); + + if (bpage) { - if (!watch_is_sentinel(*bpage)) - /* The page was loaded meanwhile. */ - return bpage; - /* Add to an existing watch. */ +got_block: bpage->fix(); - return nullptr; + if (watch_is_sentinel(*bpage)) + bpage= nullptr; + page_hash.lock_get(chain).unlock(); + return bpage; } page_hash.lock_get(chain).unlock(); @@ -2127,25 +2020,23 @@ inline buf_page_t *buf_pool_t::watch_set(const page_id_t id, w->set_state(buf_page_t::UNFIXED + 1); w->id_= id; - buf_page_t *bpage= page_hash.get(id, chain); + page_hash.lock_get(chain).lock(); + bpage= page_hash.get(id, chain); if (UNIV_LIKELY_NULL(bpage)) { w->set_state(buf_page_t::NOT_USED); - page_hash.lock_get(chain).lock(); mysql_mutex_unlock(&mutex); - goto retry; + goto got_block; } - page_hash.lock_get(chain).lock(); ut_ad(w->state() == buf_page_t::UNFIXED + 1); buf_pool.page_hash.append(chain, w); mysql_mutex_unlock(&mutex); + page_hash.lock_get(chain).unlock(); return nullptr; } ut_error; - mysql_mutex_unlock(&mutex); - return nullptr; } /** Stop watching whether a page has been read in. @@ -2159,17 +2050,23 @@ void buf_pool_t::watch_unset(const page_id_t id, buf_pool_t::hash_chain &chain) buf_page_t *w; { transactional_lock_guard g{page_hash.lock_get(chain)}; - /* The page must exist because watch_set() increments buf_fix_count. */ + /* The page must exist because watch_set() did fix(). */ w= page_hash.get(id, chain); - const auto state= w->state(); - ut_ad(state >= buf_page_t::UNFIXED); - ut_ad(~buf_page_t::LRU_MASK & state); ut_ad(w->in_page_hash); - if (state != buf_page_t::UNFIXED + 1 || !watch_is_sentinel(*w)) + if (!watch_is_sentinel(*w)) { + no_watch: w->unfix(); w= nullptr; } + else + { + const auto state= w->state(); + ut_ad(~buf_page_t::LRU_MASK & state); + ut_ad(state >= buf_page_t::UNFIXED + 1); + if (state != buf_page_t::UNFIXED + 1) + goto no_watch; + } } if (!w) @@ -2220,6 +2117,7 @@ void buf_page_free(fil_space_t *space, uint32_t page, mtr_t *mtr) ++buf_pool.stat.n_page_gets; const page_id_t page_id(space->id, page); buf_pool_t::hash_chain &chain= buf_pool.page_hash.cell_get(page_id.fold()); + uint32_t fix; buf_block_t *block; { transactional_shared_lock_guard g @@ -2232,16 +2130,22 @@ void buf_page_free(fil_space_t *space, uint32_t page, mtr_t *mtr) /* To avoid a deadlock with buf_LRU_free_page() of some other page and buf_page_write_complete() of this page, we must not wait for a page latch while holding a page_hash latch. */ - block->page.fix(); + fix= block->page.fix(); + } + + if (UNIV_UNLIKELY(fix < buf_page_t::UNFIXED)) + { + block->page.unfix(); + return; } block->page.lock.x_lock(); #ifdef BTR_CUR_HASH_ADAPT if (block->index) - btr_search_drop_page_hash_index(block); + btr_search_drop_page_hash_index(block, false); #endif /* BTR_CUR_HASH_ADAPT */ block->page.set_freed(block->page.state()); - mtr->memo_push(block, MTR_MEMO_PAGE_X_FIX); + mtr->memo_push(block, MTR_MEMO_PAGE_X_MODIFY); } /** Get read access to a compressed page (usually of type @@ -2268,29 +2172,66 @@ buf_page_t* buf_page_get_zip(const page_id_t page_id, ulint zip_size) lookup: for (bool discard_attempted= false;;) { +#ifndef NO_ELISION + if (xbegin()) { - transactional_shared_lock_guard g{hash_lock}; + if (hash_lock.is_locked()) + xabort(); bpage= buf_pool.page_hash.get(page_id, chain); if (!bpage || buf_pool.watch_is_sentinel(*bpage)) + { + xend(); goto must_read_page; + } + if (!bpage->zip.data) + { + /* There is no ROW_FORMAT=COMPRESSED page. */ + xend(); + return nullptr; + } + if (discard_attempted || !bpage->frame) + { + if (!bpage->lock.s_lock_try()) + xabort(); + xend(); + break; + } + xend(); + } + else +#endif + { + hash_lock.lock_shared(); + bpage= buf_pool.page_hash.get(page_id, chain); + if (!bpage || buf_pool.watch_is_sentinel(*bpage)) + { + hash_lock.unlock_shared(); + goto must_read_page; + } ut_ad(bpage->in_file()); ut_ad(page_id == bpage->id()); if (!bpage->zip.data) + { /* There is no ROW_FORMAT=COMPRESSED page. */ + hash_lock.unlock_shared(); return nullptr; + } if (discard_attempted || !bpage->frame) { - /* Even when we are holding a page_hash latch, it should be + /* Even when we are holding a hash_lock, it should be acceptable to wait for a page S-latch here, because buf_page_t::read_complete() will not wait for buf_pool.mutex, and because S-latch would not conflict with a U-latch that would be protecting buf_page_t::write_complete(). */ bpage->lock.s_lock(); + hash_lock.unlock_shared(); break; } + + hash_lock.unlock_shared(); } discard_attempted= true; @@ -2315,13 +2256,15 @@ buf_page_t* buf_page_get_zip(const page_id_t page_id, ulint zip_size) return bpage; must_read_page: - if (dberr_t err= buf_read_page(page_id, zip_size)) - { + switch (dberr_t err= buf_read_page(page_id, zip_size)) { + case DB_SUCCESS: + case DB_SUCCESS_LOCKED_REC: + goto lookup; + default: ib::error() << "Reading compressed page " << page_id << " failed with error: " << err; return nullptr; } - goto lookup; } /********************************************************************//** @@ -2388,6 +2331,7 @@ buf_zip_decompress( case FIL_PAGE_RTREE: if (page_zip_decompress(&block->page.zip, block->page.frame, TRUE)) { +func_exit: if (space) { space->release(); } @@ -2407,11 +2351,7 @@ buf_zip_decompress( case FIL_PAGE_TYPE_ZBLOB2: /* Copy to uncompressed storage. */ memcpy(block->page.frame, frame, block->zip_size()); - if (space) { - space->release(); - } - - return(TRUE); + goto func_exit; } ib::error() << "Unknown compressed page type " @@ -2426,12 +2366,6 @@ buf_zip_decompress( } if (space) { - if (encrypted) { - dict_set_encrypted_by_space(space); - } else { - dict_set_corrupted_by_space(space); - } - space->release(); } @@ -2444,7 +2378,7 @@ buf_zip_decompress( @param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH @param[in] guess guessed block or NULL @param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, -BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH +BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH @param[in] mtr mini-transaction @param[out] err DB_SUCCESS or error code @param[in] allow_ibuf_merge Allow change buffer merge to happen @@ -2467,17 +2401,12 @@ buf_page_get_low( unsigned access_time; ulint retries = 0; - ut_ad((mtr == NULL) == (mode == BUF_EVICT_IF_IN_POOL)); ut_ad(!mtr || mtr->is_active()); + ut_ad(mtr || mode == BUF_PEEK_IF_IN_POOL); ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH) || (rw_latch == RW_SX_LATCH) || (rw_latch == RW_NO_LATCH)); - ut_ad(!allow_ibuf_merge - || mode == BUF_GET - || mode == BUF_GET_POSSIBLY_FREED - || mode == BUF_GET_IF_IN_POOL - || mode == BUF_GET_IF_IN_POOL_OR_WATCH); if (err) { *err = DB_SUCCESS; @@ -2485,24 +2414,15 @@ buf_page_get_low( #ifdef UNIV_DEBUG switch (mode) { - case BUF_EVICT_IF_IN_POOL: - /* After DISCARD TABLESPACE, the tablespace would not exist, - but in IMPORT TABLESPACE, PageConverter::operator() must - replace any old pages, which were not evicted during DISCARD. - Skip the assertion on space_page_size. */ + default: + ut_ad(!allow_ibuf_merge); + ut_ad(mode == BUF_PEEK_IF_IN_POOL); break; - case BUF_PEEK_IF_IN_POOL: + case BUF_GET_POSSIBLY_FREED: case BUF_GET_IF_IN_POOL: /* The caller may pass a dummy page size, because it does not really matter. */ break; - default: - ut_error; - case BUF_GET_POSSIBLY_FREED: - break; - case BUF_GET_NO_LATCH: - ut_ad(rw_latch == RW_NO_LATCH); - /* fall through */ case BUF_GET: case BUF_GET_IF_IN_POOL_OR_WATCH: ut_ad(!mtr->is_freeing_tree()); @@ -2559,19 +2479,15 @@ buf_page_get_low( switch (mode) { case BUF_GET_IF_IN_POOL: case BUF_PEEK_IF_IN_POOL: - case BUF_EVICT_IF_IN_POOL: return nullptr; case BUF_GET_IF_IN_POOL_OR_WATCH: - /* We cannot easily use a memory transaction here. */ - hash_lock.lock(); + /* Buffer-fixing inside watch_set() will prevent eviction */ block = reinterpret_cast (buf_pool.watch_set(page_id, chain)); - /* buffer-fixing will prevent eviction */ - state = block ? block->page.fix() : 0; - hash_lock.unlock(); if (block) { - goto got_block; + state = block->page.state(); + goto got_block_fixed; } return nullptr; @@ -2588,67 +2504,23 @@ buf_page_get_low( corrupted, or if an encrypted page with a valid checksum cannot be decypted. */ - if (dberr_t local_err = buf_read_page(page_id, zip_size)) { - if (mode == BUF_GET_POSSIBLY_FREED) { - if (err) { - *err = local_err; - } - return nullptr; - } else if (retries < BUF_PAGE_READ_MAX_RETRIES) { - ++retries; - DBUG_EXECUTE_IF("innodb_page_corruption_retries", + switch (dberr_t local_err = buf_read_page(page_id, zip_size)) { + case DB_SUCCESS: + case DB_SUCCESS_LOCKED_REC: + buf_read_ahead_random(page_id, zip_size, ibuf_inside(mtr)); + break; + default: + if (mode != BUF_GET_POSSIBLY_FREED + && retries++ < BUF_PAGE_READ_MAX_RETRIES) { + DBUG_EXECUTE_IF("intermittent_read_failure", retries = BUF_PAGE_READ_MAX_RETRIES;); - } else { - if (err) { - *err = local_err; - } - /* Pages whose encryption key is unavailable or the - configured key, encryption algorithm or encryption - method are incorrect are marked as encrypted in - buf_page_check_corrupt(). Unencrypted page could be - corrupted in a way where the key_id field is - nonzero. There is no checksum on field - FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION. */ - switch (local_err) { - case DB_PAGE_CORRUPTED: - if (!srv_force_recovery) { - break; - } - /* fall through */ - case DB_DECRYPTION_FAILED: - return nullptr; - default: - break; - } - - /* Try to set table as corrupted instead of - asserting. */ - if (page_id.space() == TRX_SYS_SPACE) { - } else if (page_id.space() == SRV_TMP_SPACE_ID) { - } else if (fil_space_t* space - = fil_space_t::get(page_id.space())) { - bool set = dict_set_corrupted_by_space(space); - space->release(); - if (set) { - return nullptr; - } - } - - if (local_err == DB_IO_ERROR) { - return nullptr; - } - - ib::fatal() << "Unable to read page " << page_id - << " into the buffer pool after " - << BUF_PAGE_READ_MAX_RETRIES - << ". The most probable cause" - " of this error may be that the" - " table has been corrupted." - " See https://mariadb.com/kb/en/library/innodb-recovery-modes/"; } - } else { - buf_read_ahead_random(page_id, zip_size, ibuf_inside(mtr)); - retries = 0; + /* fall through */ + case DB_PAGE_CORRUPTED: + if (err) { + *err = local_err; + } + return nullptr; } ut_d(if (!(++buf_dbg_counter % 5771)) buf_pool.validate()); @@ -2657,50 +2529,74 @@ buf_page_get_low( got_block: ut_ad(!block->page.in_zip_hash); state++; +got_block_fixed: ut_ad(state > buf_page_t::FREED); if (state > buf_page_t::READ_FIX && state < buf_page_t::WRITE_FIX) { - if (mode == BUF_PEEK_IF_IN_POOL - || mode == BUF_EVICT_IF_IN_POOL) { + if (mode == BUF_PEEK_IF_IN_POOL) { ignore_block: + ut_ad(mode == BUF_GET_POSSIBLY_FREED + || mode == BUF_PEEK_IF_IN_POOL); block->unfix(); + if (err) { + *err = DB_CORRUPTION; + } return nullptr; } - if (UNIV_LIKELY(block->page.frame != nullptr)) { - /* A read-fix is released after block->page.lock - in buf_page_t::read_complete() or - buf_pool_t::corrupted_evict(), or - after buf_zip_decompress() in this function. */ - block->page.lock.s_lock(); - state = block->page.state(); - block->page.lock.s_unlock(); - ut_ad(state < buf_page_t::READ_FIX); - } - } else if (mode == BUF_PEEK_IF_IN_POOL) { if (UNIV_UNLIKELY(!block->page.frame)) { - /* This mode is only used for dropping an - adaptive hash index. There cannot be an - adaptive hash index for a compressed-only page. */ - goto ignore_block; + goto wait_for_unzip; + } + /* A read-fix is released after block->page.lock + in buf_page_t::read_complete() or + buf_pool_t::corrupted_evict(), or + after buf_zip_decompress() in this function. */ + block->page.lock.s_lock(); + state = block->page.state(); + ut_ad(state < buf_page_t::READ_FIX + || state >= buf_page_t::WRITE_FIX); + const page_id_t id{block->page.id()}; + block->page.lock.s_unlock(); + + if (UNIV_UNLIKELY(id != page_id)) { + ut_ad(id == page_id_t{~0ULL}); + block->page.unfix(); + if (++retries < BUF_PAGE_READ_MAX_RETRIES) { + goto loop; + } + + if (err) { + *err = DB_PAGE_CORRUPTED; + } + + return nullptr; } - } else if (mode == BUF_EVICT_IF_IN_POOL) { + } else if (mode != BUF_PEEK_IF_IN_POOL) { + } else if (!mtr) { ut_ad(!block->page.oldest_modification()); mysql_mutex_lock(&buf_pool.mutex); block->unfix(); +free_unfixed_block: if (!buf_LRU_free_page(&block->page, true)) { ut_ad(0); } mysql_mutex_unlock(&buf_pool.mutex); return nullptr; + } else if (UNIV_UNLIKELY(!block->page.frame)) { + /* The BUF_PEEK_IF_IN_POOL mode is mainly used for dropping an + adaptive hash index. There cannot be an + adaptive hash index for a compressed-only page. */ + goto ignore_block; } - ut_ad(mode == BUF_GET_IF_IN_POOL || block->zip_size() == zip_size); + ut_ad(mode == BUF_GET_IF_IN_POOL || mode == BUF_PEEK_IF_IN_POOL + || block->zip_size() == zip_size); if (UNIV_UNLIKELY(!block->page.frame)) { if (!block->page.lock.x_lock_try()) { +wait_for_unzip: /* The page is being read or written, or another thread is executing buf_zip_decompress() in buf_page_get_low() on it. */ @@ -2742,14 +2638,11 @@ buf_page_get_low( if (state < buf_page_t::UNFIXED + 1) { ut_ad(state > buf_page_t::FREED); - ut_ad(mode == BUF_GET_POSSIBLY_FREED - || mode == BUF_PEEK_IF_IN_POOL); - block->page.unfix(); block->page.lock.x_unlock(); hash_lock.unlock(); buf_LRU_block_free_non_file_page(new_block); mysql_mutex_unlock(&buf_pool.mutex); - return nullptr; + goto ignore_block; } mysql_mutex_unlock(&buf_pool.mutex); @@ -2800,20 +2693,19 @@ buf_page_get_low( /* Decompress the page while not holding buf_pool.mutex. */ - auto ok = buf_zip_decompress(block, false); - block->page.read_unfix(state); - state = block->page.state(); - block->page.lock.x_unlock(); + const auto ok = buf_zip_decompress(block, false); --buf_pool.n_pend_unzip; - if (!ok) { - /* FIXME: Evict the corrupted - ROW_FORMAT=COMPRESSED page! */ - if (err) { *err = DB_PAGE_CORRUPTED; } - return nullptr; + mysql_mutex_lock(&buf_pool.mutex); + } + state = block->page.read_unfix(state); + block->page.lock.x_unlock(); + + if (!ok) { + goto free_unfixed_block; } } @@ -2821,8 +2713,20 @@ buf_page_get_low( re_evict: if (mode != BUF_GET_IF_IN_POOL && mode != BUF_GET_IF_IN_POOL_OR_WATCH) { - } else if (!ibuf_debug) { + } else if (!ibuf_debug || recv_recovery_is_on()) { } else if (fil_space_t* space = fil_space_t::get(page_id.space())) { + for (ulint i = 0; i < mtr->get_savepoint(); i++) { + if (buf_block_t* b = mtr->block_at_savepoint(i)) { + if (b->page.oldest_modification() > 2 + && b->page.lock.have_any()) { + /* We are holding a dirty page latch + that would hang buf_flush_sync(). */ + space->release(); + goto re_evict_fail; + } + } + } + /* Try to evict the block from the buffer pool, to use the insert buffer (change buffer) as much as possible. */ @@ -2835,24 +2739,19 @@ buf_page_get_low( const bool evicted = buf_LRU_free_page(&block->page, true); space->release(); + if (!evicted) { + block->fix(); + } + + mysql_mutex_unlock(&buf_pool.mutex); + if (evicted) { - page_hash_latch& hash_lock - = buf_pool.page_hash.lock_get(chain); - hash_lock.lock(); - mysql_mutex_unlock(&buf_pool.mutex); - /* We may set the watch, as it would have - been set if the page were not in the - buffer pool in the first place. */ - block= reinterpret_cast( - mode == BUF_GET_IF_IN_POOL_OR_WATCH - ? buf_pool.watch_set(page_id, chain) - : buf_pool.page_hash.get(page_id, chain)); - hash_lock.unlock(); + if (mode == BUF_GET_IF_IN_POOL_OR_WATCH) { + buf_pool.watch_set(page_id, chain); + } return(NULL); } - block->fix(); - mysql_mutex_unlock(&buf_pool.mutex); buf_flush_sync(); state = block->page.state(); @@ -2864,63 +2763,126 @@ buf_page_get_low( /* Failed to evict the page; change it directly */ } +re_evict_fail: #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ - ut_ad(state > buf_page_t::FREED); - ut_ad(state < buf_page_t::UNFIXED || (~buf_page_t::LRU_MASK) & state); - ut_ad(state > buf_page_t::WRITE_FIX || state < buf_page_t::READ_FIX); - - /* While tablespace is reinited the indexes are already freed but the - blocks related to it still resides in buffer pool. Trying to remove - such blocks from buffer pool would invoke removal of AHI entries - associated with these blocks. Logic to remove AHI entry will try to - load the block but block is already in free state. Handle the said case - with mode = BUF_PEEK_IF_IN_POOL that is invoked from - "btr_search_drop_page_hash_when_freed". */ - ut_ad(mode == BUF_GET_POSSIBLY_FREED || mode == BUF_PEEK_IF_IN_POOL - || state > buf_page_t::UNFIXED); - - const bool not_first_access = block->page.set_accessed(); - - if (mode != BUF_PEEK_IF_IN_POOL) { - buf_page_make_young_if_needed(&block->page); - if (!not_first_access) { - buf_read_ahead_linear(page_id, block->zip_size(), - ibuf_inside(mtr)); - } + if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) { + goto ignore_block; } + ut_ad((~buf_page_t::LRU_MASK) & state); + ut_ad(state > buf_page_t::WRITE_FIX || state < buf_page_t::READ_FIX); #ifdef UNIV_DEBUG if (!(++buf_dbg_counter % 5771)) buf_pool.validate(); #endif /* UNIV_DEBUG */ ut_ad(block->page.frame); - ut_ad(block->page.id() == page_id); - if (state >= buf_page_t::UNFIXED && allow_ibuf_merge && fil_page_get_type(block->page.frame) == FIL_PAGE_INDEX && page_is_leaf(block->page.frame)) { block->page.lock.x_lock(); + ut_ad(block->page.id() == page_id + || (state >= buf_page_t::READ_FIX + && state < buf_page_t::WRITE_FIX)); + +#ifdef BTR_CUR_HASH_ADAPT + btr_search_drop_page_hash_index(block, true); +#endif /* BTR_CUR_HASH_ADAPT */ + + dberr_t e; + + if (UNIV_UNLIKELY(block->page.id() != page_id)) { +page_id_mismatch: + state = block->page.state(); + e = DB_CORRUPTION; +ibuf_merge_corrupted: + if (err) { + *err = e; + } + + if (block->page.id().is_corrupted()) { + buf_pool.corrupted_evict(&block->page, state); + } + return nullptr; + } + state = block->page.state(); ut_ad(state < buf_page_t::READ_FIX); if (state >= buf_page_t::IBUF_EXIST && state < buf_page_t::REINIT) { block->page.clear_ibuf_exist(); - ibuf_merge_or_delete_for_page(block, page_id, - block->zip_size()); + e = ibuf_merge_or_delete_for_page(block, page_id, + block->zip_size()); + if (UNIV_UNLIKELY(e != DB_SUCCESS)) { + goto ibuf_merge_corrupted; + } } if (rw_latch == RW_X_LATCH) { - mtr->memo_push(block, MTR_MEMO_PAGE_X_FIX); + goto get_latch_valid; } else { block->page.lock.x_unlock(); goto get_latch; } } else { get_latch: - mtr->page_lock(block, rw_latch); + switch (rw_latch) { + case RW_NO_LATCH: + mtr->memo_push(block, MTR_MEMO_BUF_FIX); + return block; + case RW_S_LATCH: + block->page.lock.s_lock(); + ut_ad(!block->page.is_read_fixed()); + if (UNIV_UNLIKELY(block->page.id() != page_id)) { + block->page.lock.s_unlock(); + block->page.lock.x_lock(); + goto page_id_mismatch; + } +get_latch_valid: + mtr->memo_push(block, mtr_memo_type_t(rw_latch)); +#ifdef BTR_CUR_HASH_ADAPT + btr_search_drop_page_hash_index(block, true); +#endif /* BTR_CUR_HASH_ADAPT */ + break; + case RW_SX_LATCH: + block->page.lock.u_lock(); + ut_ad(!block->page.is_io_fixed()); + if (UNIV_UNLIKELY(block->page.id() != page_id)) { + block->page.lock.u_x_upgrade(); + goto page_id_mismatch; + } + goto get_latch_valid; + default: + ut_ad(rw_latch == RW_X_LATCH); + if (block->page.lock.x_lock_upgraded()) { + ut_ad(block->page.id() == page_id); + block->unfix(); + mtr->page_lock_upgrade(*block); + return block; + } + if (UNIV_UNLIKELY(block->page.id() != page_id)) { + goto page_id_mismatch; + } + goto get_latch_valid; + } + + ut_ad(page_id_t(page_get_space_id(block->page.frame), + page_get_page_no(block->page.frame)) + == page_id); + + if (mode == BUF_GET_POSSIBLY_FREED + || mode == BUF_PEEK_IF_IN_POOL) { + return block; + } + + const bool not_first_access{block->page.set_accessed()}; + buf_page_make_young_if_needed(&block->page); + if (!not_first_access) { + buf_read_ahead_linear(page_id, block->zip_size(), + ibuf_inside(mtr)); + } } return block; @@ -2932,8 +2894,8 @@ buf_page_get_low( @param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH @param[in] guess guessed block or NULL @param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, -BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH -@param[in] mtr mini-transaction +BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH +@param[in,out] mtr mini-transaction, or NULL @param[out] err DB_SUCCESS or error code @param[in] allow_ibuf_merge Allow change buffer merge while reading the pages from file. @@ -2949,50 +2911,73 @@ buf_page_get_gen( dberr_t* err, bool allow_ibuf_merge) { - if (buf_block_t *block= recv_sys.recover(page_id)) + buf_block_t *block= recv_sys.recover(page_id); + if (UNIV_LIKELY(!block)) + return buf_page_get_low(page_id, zip_size, rw_latch, + guess, mode, mtr, err, allow_ibuf_merge); + else if (UNIV_UNLIKELY(block == reinterpret_cast(-1))) { - /* Recovery is a special case; we fix() before acquiring lock. */ - auto s= block->page.fix(); - ut_ad(s >= buf_page_t::FREED); - /* The block may be write-fixed at this point because we are not - holding a lock, but it must not be read-fixed. */ - ut_ad(s < buf_page_t::READ_FIX || s >= buf_page_t::WRITE_FIX); + corrupted: if (err) - *err= DB_SUCCESS; - const bool must_merge= allow_ibuf_merge && - ibuf_page_exists(page_id, block->zip_size()); + *err= DB_CORRUPTION; + return nullptr; + } + /* Recovery is a special case; we fix() before acquiring lock. */ + auto s= block->page.fix(); + ut_ad(s >= buf_page_t::FREED); + /* The block may be write-fixed at this point because we are not + holding a lock, but it must not be read-fixed. */ + ut_ad(s < buf_page_t::READ_FIX || s >= buf_page_t::WRITE_FIX); + if (err) + *err= DB_SUCCESS; + const bool must_merge= allow_ibuf_merge && + ibuf_page_exists(page_id, block->zip_size()); + if (s < buf_page_t::UNFIXED) + { + got_freed_page: + ut_ad(mode == BUF_GET_POSSIBLY_FREED || mode == BUF_PEEK_IF_IN_POOL); + mysql_mutex_lock(&buf_pool.mutex); + block->page.unfix(); + buf_LRU_free_page(&block->page, true); + mysql_mutex_unlock(&buf_pool.mutex); + goto corrupted; + } + else if (must_merge && + fil_page_get_type(block->page.frame) == FIL_PAGE_INDEX && + page_is_leaf(block->page.frame)) + { + block->page.lock.x_lock(); + s= block->page.state(); + ut_ad(s > buf_page_t::FREED); + ut_ad(s < buf_page_t::READ_FIX); if (s < buf_page_t::UNFIXED) - ut_ad(mode == BUF_GET_POSSIBLY_FREED || mode == BUF_PEEK_IF_IN_POOL); - else if (must_merge && - fil_page_get_type(block->page.frame) == FIL_PAGE_INDEX && - page_is_leaf(block->page.frame)) { - block->page.lock.x_lock(); - s= block->page.state(); - ut_ad(s > buf_page_t::FREED); - ut_ad(s < buf_page_t::READ_FIX); - if (s < buf_page_t::UNFIXED) - ut_ad(mode == BUF_GET_POSSIBLY_FREED || mode == BUF_PEEK_IF_IN_POOL); - else + block->page.lock.x_unlock(); + goto got_freed_page; + } + else + { + if (block->page.is_ibuf_exist()) + block->page.clear_ibuf_exist(); + if (dberr_t e= + ibuf_merge_or_delete_for_page(block, page_id, block->zip_size())) { - if (block->page.is_ibuf_exist()) - block->page.clear_ibuf_exist(); - ibuf_merge_or_delete_for_page(block, page_id, block->zip_size()); + if (err) + *err= e; + buf_pool.corrupted_evict(&block->page, s); + return nullptr; } + } - if (rw_latch == RW_X_LATCH) - { - mtr->memo_push(block, MTR_MEMO_PAGE_X_FIX); - return block; - } - block->page.lock.x_unlock(); + if (rw_latch == RW_X_LATCH) + { + mtr->memo_push(block, MTR_MEMO_PAGE_X_FIX); + return block; } - mtr->page_lock(block, rw_latch); - return block; + block->page.lock.x_unlock(); } - - return buf_page_get_low(page_id, zip_size, rw_latch, - guess, mode, mtr, err, allow_ibuf_merge); + mtr->page_lock(block, rw_latch); + return block; } /********************************************************************//** @@ -3072,8 +3057,7 @@ bool buf_page_optimistic_get(ulint rw_latch, buf_block_t *block, ut_ad(!block->page.is_read_fixed()); block->page.set_accessed(); buf_page_make_young_if_needed(&block->page); - mtr->memo_push(block, rw_latch == RW_S_LATCH - ? MTR_MEMO_PAGE_S_FIX : MTR_MEMO_PAGE_X_FIX); + mtr->memo_push(block, mtr_memo_type_t(rw_latch)); } ut_d(if (!(++buf_dbg_counter % 5771)) buf_pool.validate()); @@ -3112,7 +3096,7 @@ buf_block_t *buf_page_try_get(const page_id_t page_id, mtr_t *mtr) block->page.fix(); ut_ad(!block->page.is_read_fixed()); - mtr_memo_push(mtr, block, MTR_MEMO_PAGE_S_FIX); + mtr->memo_push(block, MTR_MEMO_PAGE_S_FIX); #ifdef UNIV_DEBUG if (!(++buf_dbg_counter % 5771)) buf_pool.validate(); @@ -3147,6 +3131,7 @@ static buf_block_t *buf_page_create_low(page_id_t page_id, ulint zip_size, free_block->initialise(page_id, zip_size, buf_page_t::MEMORY); buf_pool_t::hash_chain &chain= buf_pool.page_hash.cell_get(page_id.fold()); +retry: mysql_mutex_lock(&buf_pool.mutex); buf_page_t *bpage= buf_pool.page_hash.get(page_id, chain); @@ -3165,6 +3150,13 @@ static buf_block_t *buf_page_create_low(page_id_t page_id, ulint zip_size, { mysql_mutex_unlock(&buf_pool.mutex); bpage->lock.x_lock(); + const page_id_t id{bpage->id()}; + if (UNIV_UNLIKELY(id != page_id)) + { + ut_ad(id.is_corrupted()); + bpage->lock.x_unlock(); + goto retry; + } mysql_mutex_lock(&buf_pool.mutex); } @@ -3184,7 +3176,7 @@ static buf_block_t *buf_page_create_low(page_id_t page_id, ulint zip_size, { mysql_mutex_unlock(&buf_pool.mutex); buf_block_t *block= reinterpret_cast(bpage); - mtr_memo_push(mtr, block, MTR_MEMO_PAGE_X_FIX); + mtr->memo_push(block, MTR_MEMO_PAGE_X_FIX); #ifdef BTR_CUR_HASH_ADAPT drop_hash_entry= block->index; #endif @@ -3224,7 +3216,7 @@ static buf_block_t *buf_page_create_low(page_id_t page_id, ulint zip_size, bpage->lock.free(); #endif ut_free(bpage); - mtr_memo_push(mtr, free_block, MTR_MEMO_PAGE_X_FIX); + mtr->memo_push(free_block, MTR_MEMO_PAGE_X_FIX); bpage= &free_block->page; } } @@ -3243,7 +3235,8 @@ static buf_block_t *buf_page_create_low(page_id_t page_id, ulint zip_size, #ifdef BTR_CUR_HASH_ADAPT if (drop_hash_entry) - btr_search_drop_page_hash_index(reinterpret_cast(bpage)); + btr_search_drop_page_hash_index(reinterpret_cast(bpage), + false); #endif /* BTR_CUR_HASH_ADAPT */ if (ibuf_exist && !recv_recovery_is_on()) @@ -3282,12 +3275,12 @@ static buf_block_t *buf_page_create_low(page_id_t page_id, ulint zip_size, buf_unzip_LRU_add_block(reinterpret_cast(bpage), FALSE); } + buf_pool.stat.n_pages_created++; mysql_mutex_unlock(&buf_pool.mutex); mtr->memo_push(reinterpret_cast(bpage), MTR_MEMO_PAGE_X_FIX); bpage->set_accessed(); - buf_pool.stat.n_pages_created++; /* Delete possible entries for the page from the insert buffer: such can exist if the page belonged to an index which was dropped */ @@ -3439,37 +3432,6 @@ ATTRIBUTE_COLD void buf_page_monitor(const buf_page_t &bpage, bool read) MONITOR_INC_NOCHECK(counter); } -/** Mark a table corrupted. -@param[in] bpage corrupted page -@param[in] space tablespace of the corrupted page */ -ATTRIBUTE_COLD -static void buf_mark_space_corrupt(buf_page_t* bpage, const fil_space_t& space) -{ - /* If block is not encrypted find the table with specified - space id, and mark it corrupted. Encrypted tables - are marked unusable later e.g. in ::open(). */ - if (!space.crypt_data - || space.crypt_data->type == CRYPT_SCHEME_UNENCRYPTED) { - dict_set_corrupted_by_space(&space); - } else { - dict_set_encrypted_by_space(&space); - } -} - -/** Mark a table corrupted. -@param[in] bpage Corrupted page -@param[in] node data file -Also remove the bpage from LRU list. */ -ATTRIBUTE_COLD -static void buf_corrupt_page_release(buf_page_t *bpage, const fil_node_t &node) -{ - ut_ad(bpage->id().space() == node.space->id); - buf_pool.corrupted_evict(bpage); - - if (!srv_force_recovery) - buf_mark_space_corrupt(bpage, *node.space); -} - /** Check if the encrypted page is corrupted for the full crc32 format. @param[in] space_id page belongs to space id @param[in] d page @@ -3498,8 +3460,7 @@ or decrypt/decompress just failed. @retval DB_SUCCESS if page has been read and is not corrupted @retval DB_PAGE_CORRUPTED if page based on checksum check is corrupted @retval DB_DECRYPTION_FAILED if page post encryption checksum matches but -after decryption normal page checksum does not match. -@retval DB_TABLESPACE_DELETED if accessed tablespace is not found */ +after decryption normal page checksum does not match. */ static dberr_t buf_page_check_corrupt(buf_page_t *bpage, const fil_node_t &node) { @@ -3545,21 +3506,8 @@ static dberr_t buf_page_check_corrupt(buf_page_t *bpage, ib::error() << "The page " << bpage->id() << " in file '" << node.name - << "' cannot be decrypted."; - - ib::info() - << "However key management plugin or used key_version " - << key_version - << " is not found or" - " used encryption algorithm or method does not match."; - - if (bpage->id().space() != TRX_SYS_SPACE) { - ib::info() - << "Marking tablespace as missing." - " You may drop this table or" - " install correct key management plugin" - " and key file."; - } + << "' cannot be decrypted; key_version=" + << key_version; } return (err); @@ -3569,7 +3517,8 @@ static dberr_t buf_page_check_corrupt(buf_page_t *bpage, @param node data file @return whether the operation succeeded @retval DB_PAGE_CORRUPTED if the checksum fails -@retval DB_DECRYPTION_FAILED if the page cannot be decrypted */ +@retval DB_DECRYPTION_FAILED if the page cannot be decrypted +@retval DB_FAIL if the page contains the wrong ID */ dberr_t buf_page_t::read_complete(const fil_node_t &node) { const page_id_t expected_id{id()}; @@ -3609,7 +3558,11 @@ dberr_t buf_page_t::read_complete(const fil_node_t &node) if (read_id == expected_id); else if (read_id == page_id_t(0, 0)) - /* This is likely an uninitialized page. */; + { + /* This is likely an uninitialized (all-zero) page. */ + err= DB_FAIL; + goto release_page; + } else if (!node.space->full_crc32() && page_id_t(0, read_id.page_no()) == expected_id) /* FIL_PAGE_SPACE_ID was written as garbage in the system tablespace @@ -3625,25 +3578,18 @@ dberr_t buf_page_t::read_complete(const fil_node_t &node) goto release_page; } else + { ib::error() << "Space id and page no stored in the page, read in are " << read_id << ", should be " << expected_id; + err= DB_PAGE_CORRUPTED; + goto release_page; + } } err= buf_page_check_corrupt(this, node); if (UNIV_UNLIKELY(err != DB_SUCCESS)) { database_corrupted: - /* Not a real corruption if it was triggered by error injection */ - DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", - if (!is_predefined_tablespace(id().space())) - { - buf_corrupt_page_release(this, node); - ib::info() << "Simulated IMPORT corruption"; - return err; - } - err= DB_SUCCESS; - goto page_not_corrupt;); - if (belongs_to_unzip_LRU()) memset_aligned(frame, 0, srv_page_size); @@ -3656,38 +3602,28 @@ dberr_t buf_page_t::read_complete(const fil_node_t &node) buf_page_print(read_frame, zip_size()); + node.space->set_corrupted(); + ib::info() << " You can use CHECK TABLE to scan" " your table for corruption. " << FORCE_RECOVERY_MSG; } if (!srv_force_recovery) - { - /* If the corruption is in the system tablespace, we will - intentionally crash the server. */ - if (expected_id.space() == TRX_SYS_SPACE) - ib::fatal() << "Aborting because of a corrupt database page."; - buf_corrupt_page_release(this, node); - return err; - } + goto release_page; } - DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", - page_not_corrupt: err= err; ); - if (err == DB_PAGE_CORRUPTED || err == DB_DECRYPTION_FAILED) { release_page: - buf_corrupt_page_release(this, node); - if (recv_recovery_is_on()) - recv_sys.free_corrupted_page(expected_id); + buf_pool.corrupted_evict(this, buf_page_t::READ_FIX); return err; } const bool recovery= recv_recovery_is_on(); - if (recovery) - recv_recover_page(node.space, this); + if (recovery && !recv_recover_page(node.space, this)) + return DB_PAGE_CORRUPTED; const bool ibuf_may_exist= frame && !recv_no_ibuf_operations && (!expected_id.space() || !is_predefined_tablespace(expected_id.space())) && @@ -3711,10 +3647,6 @@ dberr_t buf_page_t::read_complete(const fil_node_t &node) lock.x_unlock(true); - ut_d(auto n=) buf_pool.n_pend_reads--; - ut_ad(n > 0); - buf_pool.stat.n_pages_read++; - return DB_SUCCESS; } @@ -3746,9 +3678,6 @@ void buf_pool_invalidate() { mysql_mutex_lock(&buf_pool.mutex); - buf_flush_wait_batch_end(true); - buf_flush_wait_batch_end(false); - /* It is possible that a write batch that has been posted earlier is still not complete. For buffer pool invalidation to proceed we must ensure there is NO write activity happening. */ @@ -3842,7 +3771,7 @@ void buf_pool_t::validate() mysql_mutex_unlock(&flush_list_mutex); - if (curr_size == old_size + if (n_chunks_new == n_chunks && n_lru + n_free > curr_size + n_zip) { ib::fatal() << "n_LRU " << n_lru << ", n_free " << n_free @@ -3852,7 +3781,7 @@ void buf_pool_t::validate() ut_ad(UT_LIST_GET_LEN(LRU) >= n_lru); - if (curr_size == old_size + if (n_chunks_new == n_chunks && UT_LIST_GET_LEN(free) != n_free) { ib::fatal() << "Free list len " @@ -3898,9 +3827,8 @@ void buf_pool_t::print() << ", modified database pages=" << UT_LIST_GET_LEN(flush_list) << ", n pending decompressions=" << n_pend_unzip - << ", n pending reads=" << n_pend_reads - << ", n pending flush LRU=" << n_flush_LRU_ - << " list=" << n_flush_list_ + << ", n pending flush LRU=" << n_flush() + << " list=" << os_aio_pending_writes() << ", pages made young=" << stat.n_pages_made_young << ", not young=" << stat.n_pages_not_made_young << ", pages read=" << stat.n_pages_read @@ -4012,13 +3940,13 @@ void buf_stats_get_pool_info(buf_pool_info_t *pool_info) pool_info->flush_list_len = UT_LIST_GET_LEN(buf_pool.flush_list); pool_info->n_pend_unzip = UT_LIST_GET_LEN(buf_pool.unzip_LRU); - mysql_mutex_unlock(&buf_pool.flush_list_mutex); - pool_info->n_pend_reads = buf_pool.n_pend_reads; + pool_info->n_pend_reads = os_aio_pending_reads_approx(); - pool_info->n_pending_flush_lru = buf_pool.n_flush_LRU_; + pool_info->n_pending_flush_lru = buf_pool.n_flush(); - pool_info->n_pending_flush_list = buf_pool.n_flush_list_; + pool_info->n_pending_flush_list = os_aio_pending_writes(); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); current_time = time(NULL); time_elapsed = 0.001 + difftime(current_time, diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 533e69a05d0dd..1260145ed1c50 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -46,7 +46,17 @@ inline buf_block_t *buf_dblwr_trx_sys_get(mtr_t *mtr) 0, RW_X_LATCH, mtr); } -/** Initialize the doublewrite buffer data structure. +void buf_dblwr_t::init() +{ + if (!active_slot) + { + active_slot= &slots[0]; + mysql_mutex_init(buf_dblwr_mutex_key, &mutex, nullptr); + pthread_cond_init(&cond, nullptr); + } +} + +/** Initialise the persistent storage of the doublewrite buffer. @param header doublewrite page header in the TRX_SYS page */ inline void buf_dblwr_t::init(const byte *header) { @@ -54,8 +64,6 @@ inline void buf_dblwr_t::init(const byte *header) ut_ad(!active_slot->reserved); ut_ad(!batch_running); - mysql_mutex_init(buf_dblwr_mutex_key, &mutex, nullptr); - pthread_cond_init(&cond, nullptr); block1= page_id_t(0, mach_read_from_4(header + TRX_SYS_DOUBLEWRITE_BLOCK1)); block2= page_id_t(0, mach_read_from_4(header + TRX_SYS_DOUBLEWRITE_BLOCK2)); @@ -74,7 +82,7 @@ inline void buf_dblwr_t::init(const byte *header) @return whether the operation succeeded */ bool buf_dblwr_t::create() { - if (is_initialised()) + if (is_created()) return true; mtr_t mtr; @@ -83,7 +91,13 @@ bool buf_dblwr_t::create() start_again: mtr.start(); + dberr_t err; buf_block_t *trx_sys_block= buf_dblwr_trx_sys_get(&mtr); + if (!trx_sys_block) + { + mtr.commit(); + return false; + } if (mach_read_from_4(TRX_SYS_DOUBLEWRITE + TRX_SYS_DOUBLEWRITE_MAGIC + trx_sys_block->page.frame) == @@ -98,10 +112,10 @@ bool buf_dblwr_t::create() if (UT_LIST_GET_FIRST(fil_system.sys_space->chain)->size < 3 * size) { -too_small: ib::error() << "Cannot create doublewrite buffer: " "the first file in innodb_data_file_path must be at least " << (3 * (size >> (20U - srv_page_size_shift))) << "M."; +fail: mtr.commit(); return false; } @@ -109,9 +123,13 @@ bool buf_dblwr_t::create() { buf_block_t *b= fseg_create(fil_system.sys_space, TRX_SYS_DOUBLEWRITE + TRX_SYS_DOUBLEWRITE_FSEG, - &mtr, false, trx_sys_block); + &mtr, &err, false, trx_sys_block); if (!b) - goto too_small; + { + ib::error() << "Cannot create doublewrite buffer: " << err; + goto fail; + } + ib::info() << "Doublewrite buffer not found: creating new"; /* FIXME: After this point, the doublewrite buffer creation @@ -126,8 +144,9 @@ bool buf_dblwr_t::create() for (uint32_t prev_page_no= 0, i= 0, extent_size= FSP_EXTENT_SIZE; i < 2 * size + extent_size / 2; i++) { - buf_block_t *new_block= fseg_alloc_free_page(fseg_header, prev_page_no + 1, - FSP_UP, &mtr); + buf_block_t *new_block= + fseg_alloc_free_page_general(fseg_header, prev_page_no + 1, FSP_UP, + false, &mtr, &mtr, &err); if (!new_block) { ib::error() << "Cannot create doublewrite buffer: " @@ -240,7 +259,7 @@ dberr_t buf_dblwr_t::init_or_load_pages(pfs_os_file_t file, const char *path) /* Read the TRX_SYS header to check if we are using the doublewrite buffer */ dberr_t err= os_file_read(IORequestRead, file, read_buf, TRX_SYS_PAGE_NO << srv_page_size_shift, - srv_page_size); + srv_page_size, nullptr); if (err != DB_SUCCESS) { @@ -272,7 +291,7 @@ dberr_t buf_dblwr_t::init_or_load_pages(pfs_os_file_t file, const char *path) /* Read the pages from the doublewrite buffer to memory */ err= os_file_read(IORequestRead, file, write_buf, block1.page_no() << srv_page_size_shift, - size << srv_page_size_shift); + size << srv_page_size_shift, nullptr); if (err != DB_SUCCESS) { @@ -283,7 +302,7 @@ dberr_t buf_dblwr_t::init_or_load_pages(pfs_os_file_t file, const char *path) err= os_file_read(IORequestRead, file, write_buf + (size << srv_page_size_shift), block2.page_no() << srv_page_size_shift, - size << srv_page_size_shift); + size << srv_page_size_shift, nullptr); if (err != DB_SUCCESS) { ib::error() << "Failed to read the second double write buffer extent"; @@ -330,7 +349,7 @@ dberr_t buf_dblwr_t::init_or_load_pages(pfs_os_file_t file, const char *path) void buf_dblwr_t::recover() { ut_ad(log_sys.last_checkpoint_lsn); - if (!is_initialised()) + if (!is_created()) return; uint32_t page_no_dblwr= 0; @@ -393,9 +412,12 @@ void buf_dblwr_t::recover() physical_size, read_buf); if (UNIV_UNLIKELY(fio.err != DB_SUCCESS)) + { ib::warn() << "Double write buffer recovery: " << page_id << " ('" << space->chain.start->name << "') read failed with error: " << fio.err; + continue; + } if (buf_is_zeroes(span(read_buf, physical_size))) { @@ -436,10 +458,9 @@ void buf_dblwr_t::recover() /** Free the doublewrite buffer. */ void buf_dblwr_t::close() { - if (!is_initialised()) + if (!active_slot) return; - /* Free the double write data structures. */ ut_ad(!active_slot->reserved); ut_ad(!active_slot->first_free); ut_ad(!batch_running); @@ -453,19 +474,18 @@ void buf_dblwr_t::close() mysql_mutex_destroy(&mutex); memset((void*) this, 0, sizeof *this); - active_slot= &slots[0]; } /** Update the doublewrite buffer on write completion. */ void buf_dblwr_t::write_completed() { ut_ad(this == &buf_dblwr); - ut_ad(srv_use_doublewrite_buf); - ut_ad(is_initialised()); ut_ad(!srv_read_only_mode); mysql_mutex_lock(&mutex); + ut_ad(is_created()); + ut_ad(srv_use_doublewrite_buf); ut_ad(batch_running); slot *flush_slot= active_slot == &slots[0] ? &slots[1] : &slots[0]; ut_ad(flush_slot->reserved); @@ -576,7 +596,6 @@ bool buf_dblwr_t::flush_buffered_writes(const ulint size) const bool multi_batch= block1 + static_cast(size) != block2 && old_first_free > size; flushing_buffered_writes= 1 + multi_batch; - pages_submitted+= old_first_free; /* Now safe to release the mutex. */ mysql_mutex_unlock(&mutex); #ifdef UNIV_DEBUG @@ -626,7 +645,7 @@ void buf_dblwr_t::flush_buffered_writes_completed(const IORequest &request) { ut_ad(this == &buf_dblwr); ut_ad(srv_use_doublewrite_buf); - ut_ad(is_initialised()); + ut_ad(is_created()); ut_ad(!srv_read_only_mode); ut_ad(!request.bpage); ut_ad(request.node == fil_system.sys_space->chain.start); @@ -692,7 +711,7 @@ posted, and also when we may have to wait for a page latch! Otherwise a deadlock of threads can occur. */ void buf_dblwr_t::flush_buffered_writes() { - if (!is_initialised() || !srv_use_doublewrite_buf) + if (!is_created() || !srv_use_doublewrite_buf) { fil_flush_file_spaces(); return; diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc index b4b3dd75f30b5..bb705ec56516c 100644 --- a/storage/innobase/buf/buf0dump.cc +++ b/storage/innobase/buf/buf0dump.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -35,7 +35,6 @@ Created April 08, 2011 Vasil Dimov #include "buf0dump.h" #include "dict0dict.h" #include "os0file.h" -#include "os0thread.h" #include "srv0srv.h" #include "srv0start.h" #include "ut0byte.h" @@ -416,73 +415,6 @@ buf_dump( export_vars.innodb_buffer_pool_load_incomplete = 0; } -/*****************************************************************//** -Artificially delay the buffer pool loading if necessary. The idea of -this function is to prevent hogging the server with IO and slowing down -too much normal client queries. */ -UNIV_INLINE -void -buf_load_throttle_if_needed( -/*========================*/ - ulint* last_check_time, /*!< in/out: milliseconds since epoch - of the last time we did check if - throttling is needed, we do the check - every srv_io_capacity IO ops. */ - ulint* last_activity_count, - ulint n_io) /*!< in: number of IO ops done since - buffer pool load has started */ -{ - if (n_io % srv_io_capacity < srv_io_capacity - 1) { - return; - } - - if (*last_check_time == 0 || *last_activity_count == 0) { - *last_check_time = ut_time_ms(); - *last_activity_count = srv_get_activity_count(); - return; - } - - /* srv_io_capacity IO operations have been performed by buffer pool - load since the last time we were here. */ - - /* If no other activity, then keep going without any delay. */ - if (srv_get_activity_count() == *last_activity_count) { - return; - } - - /* There has been other activity, throttle. */ - - ulint now = ut_time_ms(); - ulint elapsed_time = now - *last_check_time; - - /* Notice that elapsed_time is not the time for the last - srv_io_capacity IO operations performed by BP load. It is the - time elapsed since the last time we detected that there has been - other activity. This has a small and acceptable deficiency, e.g.: - 1. BP load runs and there is no other activity. - 2. Other activity occurs, we run N IO operations after that and - enter here (where 0 <= N < srv_io_capacity). - 3. last_check_time is very old and we do not sleep at this time, but - only update last_check_time and last_activity_count. - 4. We run srv_io_capacity more IO operations and call this function - again. - 5. There has been more other activity and thus we enter here. - 6. Now last_check_time is recent and we sleep if necessary to prevent - more than srv_io_capacity IO operations per second. - The deficiency is that we could have slept at 3., but for this we - would have to update last_check_time before the - "cur_activity_count == *last_activity_count" check and calling - ut_time_ms() that often may turn out to be too expensive. */ - - if (elapsed_time < 1000 /* 1 sec (1000 milli secs) */) { - std::this_thread::sleep_for( - std::chrono::milliseconds(1000 - elapsed_time)); - } - - *last_check_time = ut_time_ms(); - *last_activity_count = srv_get_activity_count(); -} - /*****************************************************************//** Perform a buffer pool load from the file specified by innodb_buffer_pool_filename. If any errors occur then the value of @@ -632,9 +564,6 @@ buf_load() std::sort(dump, dump + dump_n); } - ulint last_check_time = 0; - ulint last_activity_cnt = 0; - /* Avoid calling the expensive fil_space_t::get() for each page within the same tablespace. dump[] is sorted by (space, page), so all pages from a given tablespace are consecutive. */ @@ -708,9 +637,6 @@ buf_load() return; } - buf_load_throttle_if_needed( - &last_check_time, &last_activity_cnt, i); - #ifdef UNIV_DEBUG if ((i+1) >= srv_buf_pool_load_pages_abort) { buf_load_abort_flag = true; @@ -725,7 +651,7 @@ buf_load() ut_free(dump); if (i == dump_n) { - os_aio_wait_until_no_pending_reads(); + os_aio_wait_until_no_pending_reads(true); } ut_sprintf_timestamp(now); diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index f2c86e2cc2449..691993c819ea1 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -44,15 +44,12 @@ Created 11/11/1995 Heikki Tuuri #include "snappy-c.h" /** Number of pages flushed via LRU. Protected by buf_pool.mutex. -Also included in buf_flush_page_count. */ +Also included in buf_pool.stat.n_pages_written. */ ulint buf_lru_flush_page_count; /** Number of pages freed without flushing. Protected by buf_pool.mutex. */ ulint buf_lru_freed_page_count; -/** Number of pages flushed. Protected by buf_pool.mutex. */ -ulint buf_flush_page_count; - /** Flag indicating if the page_cleaner is in active state. */ Atomic_relaxed buf_page_cleaner_is_active; @@ -83,12 +80,6 @@ static struct ulint flush_pass; } page_cleaner; -/** If LRU list of a buf_pool is less than this size then LRU eviction -should not happen. This is because when we do LRU flushing we also put -the blocks on free list. If LRU list is very small then we can end up -in thrashing. */ -#define BUF_LRU_MIN_LEN 256 - /* @} */ #ifdef UNIV_DEBUG @@ -118,11 +109,16 @@ static void buf_flush_validate_skip() } #endif /* UNIV_DEBUG */ -/** Wake up the page cleaner if needed */ -void buf_pool_t::page_cleaner_wakeup() +void buf_pool_t::page_cleaner_wakeup(bool for_LRU) { + ut_d(buf_flush_validate_skip()); if (!page_cleaner_idle()) + { + if (for_LRU) + /* Ensure that the page cleaner is not in a timed wait. */ + pthread_cond_signal(&do_flush_list); return; + } double dirty_pct= double(UT_LIST_GET_LEN(buf_pool.flush_list)) * 100.0 / double(UT_LIST_GET_LEN(buf_pool.LRU) + UT_LIST_GET_LEN(buf_pool.free)); double pct_lwm= srv_max_dirty_pages_pct_lwm; @@ -152,66 +148,26 @@ void buf_pool_t::page_cleaner_wakeup() - by allowing last_activity_count to updated when page-cleaner is made active and has work to do. This ensures that the last_activity signal is consumed by the page-cleaner before the next one is generated. */ - if ((pct_lwm != 0.0 && pct_lwm <= dirty_pct) || - (pct_lwm != 0.0 && last_activity_count == srv_get_activity_count()) || + if (for_LRU || + (pct_lwm != 0.0 && (pct_lwm <= dirty_pct || + last_activity_count == srv_get_activity_count())) || srv_max_buf_pool_modified_pct <= dirty_pct) { - page_cleaner_is_idle= false; + page_cleaner_status-= PAGE_CLEANER_IDLE; pthread_cond_signal(&do_flush_list); } } -inline void buf_pool_t::delete_from_flush_list_low(buf_page_t *bpage) +/** Remove a block from flush_list. +@param bpage buffer pool page */ +void buf_pool_t::delete_from_flush_list(buf_page_t *bpage) noexcept { ut_ad(!fsp_is_system_temporary(bpage->id().space())); mysql_mutex_assert_owner(&flush_list_mutex); flush_hp.adjust(bpage); UT_LIST_REMOVE(flush_list, bpage); -} - -/** Insert a modified block into the flush list. -@param block modified block -@param lsn start LSN of the mini-transaction that modified the block */ -void buf_pool_t::insert_into_flush_list(buf_block_t *block, lsn_t lsn) -{ - mysql_mutex_assert_not_owner(&mutex); -#ifdef SAFE_MUTEX - if (!recv_recovery_is_on()) - mysql_mutex_assert_owner(&log_sys.flush_order_mutex); -#endif /* SAFE_MUTEX */ - ut_ad(lsn > 2); - static_assert(log_t::FIRST_LSN >= 2, "compatibility"); - ut_ad(!fsp_is_system_temporary(block->page.id().space())); - - mysql_mutex_lock(&flush_list_mutex); - if (ut_d(const lsn_t old=) block->page.oldest_modification()) - { - ut_ad(old == 1); - delete_from_flush_list_low(&block->page); - } - else - stat.flush_list_bytes+= block->physical_size(); - ut_ad(stat.flush_list_bytes <= curr_pool_size); - - block->page.set_oldest_modification(lsn); - MEM_CHECK_DEFINED(block->page.zip.data - ? block->page.zip.data : block->page.frame, - block->physical_size()); - UT_LIST_ADD_FIRST(flush_list, &block->page); - ut_d(buf_flush_validate_skip()); - page_cleaner_wakeup(); - mysql_mutex_unlock(&flush_list_mutex); -} - -/** Remove a block from flush_list. -@param bpage buffer pool page -@param clear whether to invoke buf_page_t::clear_oldest_modification() */ -void buf_pool_t::delete_from_flush_list(buf_page_t *bpage, bool clear) -{ - delete_from_flush_list_low(bpage); - stat.flush_list_bytes-= bpage->physical_size(); - if (clear) - bpage->clear_oldest_modification(); + flush_list_bytes-= bpage->physical_size(); + bpage->clear_oldest_modification(); #ifdef UNIV_DEBUG buf_flush_validate_skip(); #endif /* UNIV_DEBUG */ @@ -226,10 +182,10 @@ void buf_flush_remove_pages(uint32_t id) { const page_id_t first(id, 0), end(id + 1, 0); ut_ad(id); - mysql_mutex_lock(&buf_pool.mutex); for (;;) { + mysql_mutex_lock(&buf_pool.mutex); bool deferred= false; mysql_mutex_lock(&buf_pool.flush_list_mutex); @@ -252,18 +208,14 @@ void buf_flush_remove_pages(uint32_t id) bpage= prev; } + mysql_mutex_unlock(&buf_pool.mutex); mysql_mutex_unlock(&buf_pool.flush_list_mutex); if (!deferred) break; - mysql_mutex_unlock(&buf_pool.mutex); - std::this_thread::yield(); - mysql_mutex_lock(&buf_pool.mutex); - buf_flush_wait_batch_end(false); + os_aio_wait_until_no_pending_writes(true); } - - mysql_mutex_unlock(&buf_pool.mutex); } /*******************************************************************//** @@ -308,7 +260,7 @@ buf_flush_relocate_on_flush_list( bpage->clear_oldest_modification(); if (lsn == 1) { - buf_pool.stat.flush_list_bytes -= dpage->physical_size(); + buf_pool.flush_list_bytes -= dpage->physical_size(); dpage->list.prev = nullptr; dpage->list.next = nullptr; dpage->clear_oldest_modification(); @@ -348,6 +300,21 @@ inline void buf_page_t::write_complete(bool temporary) lock.u_unlock(true); } +inline void buf_pool_t::n_flush_inc() +{ + mysql_mutex_assert_owner(&flush_list_mutex); + page_cleaner_status+= LRU_FLUSH; +} + +inline void buf_pool_t::n_flush_dec() +{ + mysql_mutex_lock(&flush_list_mutex); + ut_ad(page_cleaner_status >= LRU_FLUSH); + if ((page_cleaner_status-= LRU_FLUSH) < LRU_FLUSH) + pthread_cond_broadcast(&done_flush_LRU); + mysql_mutex_unlock(&flush_list_mutex); +} + /** Complete write of a file page from buf_pool. @param request write request */ void buf_page_write_complete(const IORequest &request) @@ -363,13 +330,6 @@ void buf_page_write_complete(const IORequest &request) ut_ad(!buf_dblwr.is_inside(bpage->id())); ut_ad(request.node->space->id == bpage->id().space()); - if (state < buf_page_t::WRITE_FIX_REINIT && - request.node->space->use_doublewrite()) - { - ut_ad(request.node->space != fil_system.temp_space); - buf_dblwr.write_completed(); - } - if (request.slot) request.slot->release(); @@ -377,33 +337,32 @@ void buf_page_write_complete(const IORequest &request) buf_page_monitor(*bpage, false); DBUG_PRINT("ib_buf", ("write page %u:%u", bpage->id().space(), bpage->id().page_no())); - const bool temp= fsp_is_system_temporary(bpage->id().space()); - mysql_mutex_lock(&buf_pool.mutex); + mysql_mutex_assert_not_owner(&buf_pool.mutex); mysql_mutex_assert_not_owner(&buf_pool.flush_list_mutex); - buf_pool.stat.n_pages_written++; - bpage->write_complete(temp); if (request.is_LRU()) { + const bool temp= bpage->oldest_modification() == 2; + if (!temp && state < buf_page_t::WRITE_FIX_REINIT && + request.node->space->use_doublewrite()) + buf_dblwr.write_completed(); + /* We must hold buf_pool.mutex while releasing the block, so that + no other thread can access it before we have freed it. */ + mysql_mutex_lock(&buf_pool.mutex); + bpage->write_complete(temp); buf_LRU_free_page(bpage, true); + mysql_mutex_unlock(&buf_pool.mutex); - ut_ad(buf_pool.n_flush_LRU_); - if (!--buf_pool.n_flush_LRU_) - { - pthread_cond_broadcast(&buf_pool.done_flush_LRU); - pthread_cond_signal(&buf_pool.done_free); - } + buf_pool.n_flush_dec(); } else { - ut_ad(!temp); - ut_ad(buf_pool.n_flush_list_); - if (!--buf_pool.n_flush_list_) - pthread_cond_broadcast(&buf_pool.done_flush_list); + if (state < buf_page_t::WRITE_FIX_REINIT && + request.node->space->use_doublewrite()) + buf_dblwr.write_completed(); + bpage->write_complete(false); } - - mysql_mutex_unlock(&buf_pool.mutex); } /** Calculate a ROW_FORMAT=COMPRESSED page checksum and update the page. @@ -583,7 +542,7 @@ static void buf_tmp_reserve_compression_buf(buf_tmp_buffer_t* slot) buffer be bigger than input buffer. Adjust the allocated size. */ ulint size= srv_page_size; if (provider_service_lzo->is_loaded) - size+= LZO1X_1_15_MEM_COMPRESS; + size= LZO1X_1_15_MEM_COMPRESS; else if (provider_service_snappy->is_loaded) size= snappy_max_compressed_length(size); slot->comp_buf= static_cast(aligned_malloc(size, srv_page_size)); @@ -631,7 +590,6 @@ static byte *buf_page_encrypt(fil_space_t* space, buf_page_t* bpage, byte* s, ut_ad(space->id == bpage->id().space()); ut_ad(!*slot); - ut_d(fil_page_type_validate(space, s)); const uint32_t page_no= bpage->id().page_no(); switch (page_no) { @@ -728,7 +686,6 @@ static byte *buf_page_encrypt(fil_space_t* space, buf_page_t* bpage, byte* s, /* Workaround for MDEV-15527. */ memset(tmp + len, 0 , srv_page_size - len); - ut_d(fil_page_type_validate(space, tmp)); if (encrypted) tmp= fil_space_encrypt(space, page_no, tmp, d); @@ -743,49 +700,46 @@ static byte *buf_page_encrypt(fil_space_t* space, buf_page_t* bpage, byte* s, d= tmp; } - ut_d(fil_page_type_validate(space, d)); (*slot)->out_buf= d; return d; } /** Free a page whose underlying file page has been freed. */ -inline void buf_pool_t::release_freed_page(buf_page_t *bpage) +ATTRIBUTE_COLD void buf_pool_t::release_freed_page(buf_page_t *bpage) noexcept { mysql_mutex_assert_owner(&mutex); - mysql_mutex_lock(&flush_list_mutex); ut_d(const lsn_t oldest_modification= bpage->oldest_modification();) if (fsp_is_system_temporary(bpage->id().space())) { ut_ad(bpage->frame); ut_ad(oldest_modification == 2); + bpage->clear_oldest_modification(); } else { + mysql_mutex_lock(&flush_list_mutex); ut_ad(oldest_modification > 2); - delete_from_flush_list(bpage, false); + delete_from_flush_list(bpage); + mysql_mutex_unlock(&flush_list_mutex); } - bpage->clear_oldest_modification(); - mysql_mutex_unlock(&flush_list_mutex); - bpage->lock.u_unlock(true); + bpage->lock.u_unlock(true); buf_LRU_free_page(bpage, true); } -/** Write a flushable page to a file. buf_pool.mutex must be held. -@param lru true=buf_pool.LRU; false=buf_pool.flush_list +/** Write a flushable page to a file or free a freeable block. +@param evict whether to evict the page on write completion @param space tablespace -@return whether the page was flushed and buf_pool.mutex was released */ -inline bool buf_page_t::flush(bool lru, fil_space_t *space) +@return whether a page write was initiated and buf_pool.mutex released */ +bool buf_page_t::flush(bool evict, fil_space_t *space) { + mysql_mutex_assert_not_owner(&buf_pool.flush_list_mutex); ut_ad(in_file()); ut_ad(in_LRU_list); ut_ad((space->purpose == FIL_TYPE_TEMPORARY) == (space == fil_system.temp_space)); + ut_ad(evict || space != fil_system.temp_space); ut_ad(space->referenced()); - ut_ad(lru || space != fil_system.temp_space); - - if (!lock.u_lock_try(true)) - return false; const auto s= state(); ut_a(s >= FREED); @@ -793,44 +747,36 @@ inline bool buf_page_t::flush(bool lru, fil_space_t *space) if (s < UNFIXED) { buf_pool.release_freed_page(this); - mysql_mutex_unlock(&buf_pool.mutex); - return true; - } - - if (s >= READ_FIX || oldest_modification() < 2) - { - lock.u_unlock(true); return false; } - mysql_mutex_assert_not_owner(&buf_pool.flush_list_mutex); - - /* Apart from the U-lock, this block will also be protected by - is_write_fixed() and oldest_modification()>1. - Thus, it cannot be relocated or removed. */ - - DBUG_PRINT("ib_buf", ("%s %u page %u:%u", - lru ? "LRU" : "flush_list", - id().space(), id().page_no())); ut_d(const auto f=) zip.fix.fetch_add(WRITE_FIX - UNFIXED); ut_ad(f >= UNFIXED); ut_ad(f < READ_FIX); - ut_ad(space == fil_system.temp_space + ut_ad((space == fil_system.temp_space) ? oldest_modification() == 2 : oldest_modification() > 2); - if (lru) - { - ut_ad(buf_pool.n_flush_LRU_ < ULINT_UNDEFINED); - buf_pool.n_flush_LRU_++; - } - else + + /* Increment the I/O operation count used for selecting LRU policy. */ + buf_LRU_stat_inc_io(); + mysql_mutex_unlock(&buf_pool.mutex); + + IORequest::Type type= IORequest::WRITE_ASYNC; + if (UNIV_UNLIKELY(evict)) { - ut_ad(buf_pool.n_flush_list_ < ULINT_UNDEFINED); - buf_pool.n_flush_list_++; + type= IORequest::WRITE_LRU; + mysql_mutex_lock(&buf_pool.flush_list_mutex); + buf_pool.n_flush_inc(); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); } - buf_flush_page_count++; - mysql_mutex_unlock(&buf_pool.mutex); + /* Apart from the U-lock, this block will also be protected by + is_write_fixed() and oldest_modification()>1. + Thus, it cannot be relocated or removed. */ + + DBUG_PRINT("ib_buf", ("%s %u page %u:%u", + evict ? "LRU" : "flush_list", + id().space(), id().page_no())); buf_block_t *block= reinterpret_cast(this); page_t *write_frame= zip.data; @@ -840,7 +786,6 @@ inline bool buf_page_t::flush(bool lru, fil_space_t *space) #if defined HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE || defined _WIN32 size_t orig_size; #endif - IORequest::Type type= lru ? IORequest::WRITE_LRU : IORequest::WRITE_ASYNC; buf_tmp_buffer_t *slot= nullptr; if (UNIV_UNLIKELY(!frame)) /* ROW_FORMAT=COMPRESSED */ @@ -884,7 +829,10 @@ inline bool buf_page_t::flush(bool lru, fil_space_t *space) { switch (space->chain.start->punch_hole) { case 1: - type= lru ? IORequest::PUNCH_LRU : IORequest::PUNCH; + static_assert(IORequest::PUNCH_LRU - IORequest::PUNCH == + IORequest::WRITE_LRU - IORequest::WRITE_ASYNC, ""); + type= + IORequest::Type(type + (IORequest::PUNCH - IORequest::WRITE_ASYNC)); break; case 2: size= orig_size; @@ -911,18 +859,16 @@ inline bool buf_page_t::flush(bool lru, fil_space_t *space) else buf_dblwr.add_to_batch(IORequest{this, slot, space->chain.start, type}, size); - - /* Increment the I/O operation count used for selecting LRU policy. */ - buf_LRU_stat_inc_io(); return true; } /** Check whether a page can be flushed from the buf_pool. @param id page identifier @param fold id.fold() -@param lru true=buf_pool.LRU; false=buf_pool.flush_list +@param evict true=buf_pool.LRU; false=buf_pool.flush_list @return whether the page can be flushed */ -static bool buf_flush_check_neighbor(const page_id_t id, ulint fold, bool lru) +static bool buf_flush_check_neighbor(const page_id_t id, ulint fold, + bool evict) { mysql_mutex_assert_owner(&buf_pool.mutex); ut_ad(fold == id.fold()); @@ -934,23 +880,23 @@ static bool buf_flush_check_neighbor(const page_id_t id, ulint fold, bool lru) if (!bpage || buf_pool.watch_is_sentinel(*bpage)) return false; - /* We avoid flushing 'non-old' blocks in an LRU flush, because the + /* We avoid flushing 'non-old' blocks in an eviction flush, because the flushed blocks are soon freed */ - if (lru && !bpage->is_old()) + if (evict && !bpage->is_old()) return false; - return bpage->oldest_modification() > 1 && bpage->ready_for_flush(); + return bpage->oldest_modification() > 1 && !bpage->is_io_fixed(); } /** Check which neighbors of a page can be flushed from the buf_pool. @param space tablespace @param id page identifier of a dirty page @param contiguous whether to consider contiguous areas of pages -@param lru true=buf_pool.LRU; false=buf_pool.flush_list +@param evict true=buf_pool.LRU; false=buf_pool.flush_list @return last page number that can be flushed */ static page_id_t buf_flush_check_neighbors(const fil_space_t &space, page_id_t &id, bool contiguous, - bool lru) + bool evict) { ut_ad(id.page_no() < space.size + (space.physical_size() == 2048 ? 1 @@ -983,7 +929,7 @@ static page_id_t buf_flush_check_neighbors(const fil_space_t &space, for (page_id_t i= id - 1;; --i) { fold--; - if (!buf_flush_check_neighbor(i, fold, lru)) + if (!buf_flush_check_neighbor(i, fold, evict)) { low= i + 1; break; @@ -999,7 +945,7 @@ static page_id_t buf_flush_check_neighbors(const fil_space_t &space, while (++i < high) { ++fold; - if (!buf_flush_check_neighbor(i, fold, lru)) + if (!buf_flush_check_neighbor(i, fold, evict)) break; } @@ -1007,80 +953,96 @@ static page_id_t buf_flush_check_neighbors(const fil_space_t &space, return i; } -MY_ATTRIBUTE((nonnull)) -/** Write punch-hole or zeroes of the freed ranges when -innodb_immediate_scrub_data_uncompressed from the freed ranges. -@param space tablespace which may contain ranges of freed pages */ -static void buf_flush_freed_pages(fil_space_t *space) +MY_ATTRIBUTE((warn_unused_result)) +/** Apply freed_ranges to the file. +@param writable whether the file is writable +@return number of pages written or hole-punched */ +uint32_t fil_space_t::flush_freed(bool writable) { - const bool punch_hole= space->chain.start->punch_hole == 1; + const bool punch_hole= chain.start->punch_hole == 1; if (!punch_hole && !srv_immediate_scrub_data_uncompressed) - return; - lsn_t flush_to_disk_lsn= log_sys.get_flushed_lsn(); + return 0; + + mysql_mutex_assert_not_owner(&buf_pool.flush_list_mutex); + mysql_mutex_assert_not_owner(&buf_pool.mutex); - std::unique_lock freed_lock(space->freed_range_mutex); - if (space->freed_ranges.empty() - || flush_to_disk_lsn < space->get_last_freed_lsn()) + freed_range_mutex.lock(); + if (freed_ranges.empty() || log_sys.get_flushed_lsn() < get_last_freed_lsn()) { - freed_lock.unlock(); - return; + freed_range_mutex.unlock(); + return 0; } - range_set freed_ranges= std::move(space->freed_ranges); - freed_lock.unlock(); + const unsigned physical{physical_size()}; - for (const auto &range : freed_ranges) - { - const ulint physical_size= space->physical_size(); + range_set freed= std::move(freed_ranges); + uint32_t written= 0; - if (punch_hole) + if (!writable); + else if (punch_hole) + { + for (const auto &range : freed) { - space->reacquire(); - space->io(IORequest(IORequest::PUNCH_RANGE), - os_offset_t{range.first} * physical_size, - (range.last - range.first + 1) * physical_size, - nullptr); + written+= range.last - range.first + 1; + reacquire(); + io(IORequest(IORequest::PUNCH_RANGE), + os_offset_t{range.first} * physical, + (range.last - range.first + 1) * physical, nullptr); } - else + } + else + { + for (const auto &range : freed) { + written+= range.last - range.first + 1; for (os_offset_t i= range.first; i <= range.last; i++) { - space->reacquire(); - space->io(IORequest(IORequest::WRITE_ASYNC), - i * physical_size, physical_size, - const_cast(field_ref_zero)); + reacquire(); + io(IORequest(IORequest::WRITE_ASYNC), i * physical, physical, + const_cast(field_ref_zero)); } } - buf_pool.stat.n_pages_written+= (range.last - range.first + 1); } + + freed_range_mutex.unlock(); + return written; } /** Flushes to disk all flushable pages within the flush area and also write zeroes or punch the hole for the freed ranges of pages. @param space tablespace @param page_id page identifier +@param bpage buffer page @param contiguous whether to consider contiguous areas of pages -@param lru true=buf_pool.LRU; false=buf_pool.flush_list +@param evict true=buf_pool.LRU; false=buf_pool.flush_list @param n_flushed number of pages flushed so far in this batch @param n_to_flush maximum number of pages we are allowed to flush @return number of pages flushed */ static ulint buf_flush_try_neighbors(fil_space_t *space, const page_id_t page_id, - bool contiguous, bool lru, + buf_page_t *bpage, + bool contiguous, bool evict, ulint n_flushed, ulint n_to_flush) { ut_ad(space->id == page_id.space()); + ut_ad(bpage->id() == page_id); ulint count= 0; page_id_t id= page_id; - page_id_t high= buf_flush_check_neighbors(*space, id, contiguous, lru); + page_id_t high= buf_flush_check_neighbors(*space, id, contiguous, evict); ut_ad(page_id >= id); ut_ad(page_id < high); - for (ulint id_fold= id.fold(); id < high && !space->is_stopping(); - ++id, ++id_fold) + for (ulint id_fold= id.fold(); id < high; ++id, ++id_fold) { + if (UNIV_UNLIKELY(space->is_stopping())) + { + if (bpage) + bpage->lock.u_unlock(true); + break; + } + if (count + n_flushed >= n_to_flush) { if (id > page_id) @@ -1094,31 +1056,42 @@ static ulint buf_flush_try_neighbors(fil_space_t *space, const buf_pool_t::hash_chain &chain= buf_pool.page_hash.cell_get(id_fold); mysql_mutex_lock(&buf_pool.mutex); - if (buf_page_t *bpage= buf_pool.page_hash.get(id, chain)) + if (buf_page_t *b= buf_pool.page_hash.get(id, chain)) { - ut_ad(bpage->in_file()); - /* We avoid flushing 'non-old' blocks in an LRU flush, - because the flushed blocks are soon freed */ - if (!lru || id == page_id || bpage->is_old()) + ut_ad(b->in_file()); + if (id == page_id) { - if (!buf_pool.watch_is_sentinel(*bpage) && - bpage->oldest_modification() > 1 && bpage->ready_for_flush() && - bpage->flush(lru, space)) + ut_ad(bpage == b); + bpage= nullptr; + ut_ad(!buf_pool.watch_is_sentinel(*b)); + ut_ad(b->oldest_modification() > 1); + flush: + if (b->flush(evict, space)) { ++count; continue; } } + /* We avoid flushing 'non-old' blocks in an eviction flush, + because the flushed blocks are soon freed */ + else if ((!evict || b->is_old()) && !buf_pool.watch_is_sentinel(*b) && + b->oldest_modification() > 1 && b->lock.u_lock_try(true)) + { + if (b->oldest_modification() < 2) + b->lock.u_unlock(true); + else + goto flush; + } } mysql_mutex_unlock(&buf_pool.mutex); } - if (auto n= count - 1) + if (count > 1) { MONITOR_INC_VALUE_CUMULATIVE(MONITOR_FLUSH_NEIGHBOR_TOTAL_PAGE, MONITOR_FLUSH_NEIGHBOR_COUNT, - MONITOR_FLUSH_NEIGHBOR_PAGES, n); + MONITOR_FLUSH_NEIGHBOR_PAGES, count - 1); } return count; @@ -1129,12 +1102,8 @@ This utility moves the uncompressed frames of pages to the free list. Note that this function does not actually flush any data to disk. It just detaches the uncompressed frames from the compressed pages at the tail of the unzip_LRU and puts those freed frames in the free list. -Note that it is a best effort attempt and it is not guaranteed that -after a call to this function there will be 'max' blocks in the free -list. -@param[in] max desired number of blocks in the free_list @return number of blocks moved to the free list. */ -static ulint buf_free_from_unzip_LRU_list_batch(ulint max) +static ulint buf_free_from_unzip_LRU_list_batch() { ulint scanned = 0; ulint count = 0; @@ -1144,7 +1113,6 @@ static ulint buf_free_from_unzip_LRU_list_batch(ulint max) buf_block_t* block = UT_LIST_GET_LAST(buf_pool.unzip_LRU); while (block - && count < max && UT_LIST_GET_LEN(buf_pool.free) < srv_LRU_scan_depth && UT_LIST_GET_LEN(buf_pool.unzip_LRU) > UT_LIST_GET_LEN(buf_pool.LRU) / 10) { @@ -1175,14 +1143,12 @@ static ulint buf_free_from_unzip_LRU_list_batch(ulint max) /** Start writing out pages for a tablespace. @param id tablespace identifier -@return tablespace -@retval nullptr if the pages for this tablespace should be discarded */ -static fil_space_t *buf_flush_space(const uint32_t id) +@return tablespace and number of pages written */ +static std::pair buf_flush_space(const uint32_t id) { - fil_space_t *space= fil_space_t::get(id); - if (space) - buf_flush_freed_pages(space); - return space; + if (fil_space_t *space= fil_space_t::get(id)) + return {space, space->flush_freed(true)}; + return {nullptr, 0}; } struct flush_counters_t @@ -1193,40 +1159,36 @@ struct flush_counters_t ulint evicted; }; -/** Try to discard a dirty page. +/** Discard a dirty page, and release buf_pool.flush_list_mutex. @param bpage dirty page whose tablespace is not accessible */ static void buf_flush_discard_page(buf_page_t *bpage) { - mysql_mutex_assert_owner(&buf_pool.mutex); - mysql_mutex_assert_not_owner(&buf_pool.flush_list_mutex); ut_ad(bpage->in_file()); ut_ad(bpage->oldest_modification()); - if (!bpage->lock.u_lock_try(false)) - return; - - mysql_mutex_lock(&buf_pool.flush_list_mutex); buf_pool.delete_from_flush_list(bpage); mysql_mutex_unlock(&buf_pool.flush_list_mutex); ut_d(const auto state= bpage->state()); ut_ad(state == buf_page_t::FREED || state == buf_page_t::UNFIXED || state == buf_page_t::IBUF_EXIST || state == buf_page_t::REINIT); - bpage->lock.u_unlock(); - + bpage->lock.u_unlock(true); buf_LRU_free_page(bpage, true); } -/** Flush dirty blocks from the end of the LRU list. -@param max maximum number of blocks to make available in buf_pool.free -@param n counts of flushed and evicted pages */ -static void buf_flush_LRU_list_batch(ulint max, flush_counters_t *n) +/** Flush dirty blocks from the end buf_pool.LRU, +and move clean blocks to buf_pool.free. +@param max maximum number of blocks to flush +@param evict whether dirty pages are to be evicted after flushing them +@param n counts of flushed and evicted pages */ +static void buf_flush_LRU_list_batch(ulint max, bool evict, + flush_counters_t *n) { ulint scanned= 0; ulint free_limit= srv_LRU_scan_depth; mysql_mutex_assert_owner(&buf_pool.mutex); - if (buf_pool.withdraw_target && buf_pool.curr_size < buf_pool.old_size) + if (buf_pool.withdraw_target && buf_pool.is_shrinking()) free_limit+= buf_pool.withdraw_target - UT_LIST_GET_LEN(buf_pool.withdraw); const auto neighbors= UT_LIST_GET_LEN(buf_pool.LRU) < BUF_LRU_OLD_MIN_LEN @@ -1237,70 +1199,114 @@ static void buf_flush_LRU_list_batch(ulint max, flush_counters_t *n) static_assert(FIL_NULL > SRV_SPACE_ID_UPPER_BOUND, "consistency"); for (buf_page_t *bpage= UT_LIST_GET_LAST(buf_pool.LRU); - bpage && n->flushed + n->evicted < max && - UT_LIST_GET_LEN(buf_pool.LRU) > BUF_LRU_MIN_LEN && - UT_LIST_GET_LEN(buf_pool.free) < free_limit; ++scanned) + bpage && + ((UT_LIST_GET_LEN(buf_pool.LRU) > BUF_LRU_MIN_LEN && + UT_LIST_GET_LEN(buf_pool.free) < free_limit) || + recv_recovery_is_on()); + ++scanned, bpage= buf_pool.lru_hp.get()) { buf_page_t *prev= UT_LIST_GET_PREV(LRU, bpage); - const lsn_t oldest_modification= bpage->oldest_modification(); buf_pool.lru_hp.set(prev); - const auto state= bpage->state(); + auto state= bpage->state(); ut_ad(state >= buf_page_t::FREED); ut_ad(bpage->in_LRU_list); - if (oldest_modification <= 1) - { + switch (bpage->oldest_modification()) { + case 0: + evict: if (state != buf_page_t::FREED && (state >= buf_page_t::READ_FIX || (~buf_page_t::LRU_MASK & state))) - goto must_skip; - if (buf_LRU_free_page(bpage, true)) - ++n->evicted; + continue; + buf_LRU_free_page(bpage, true); + ++n->evicted; + /* fall through */ + case 1: + if (UNIV_LIKELY(scanned & 31)) + continue; + mysql_mutex_unlock(&buf_pool.mutex); + reacquire_mutex: + mysql_mutex_lock(&buf_pool.mutex); + continue; } - else if (state < buf_page_t::READ_FIX) + + if (state < buf_page_t::READ_FIX && bpage->lock.u_lock_try(true)) { - /* Block is ready for flush. Dispatch an IO request. The IO - helper thread will put it on free list in IO completion routine. */ + ut_ad(!bpage->is_io_fixed()); + bool do_evict= evict; + switch (bpage->oldest_modification()) { + case 1: + mysql_mutex_lock(&buf_pool.flush_list_mutex); + buf_pool.delete_from_flush_list(bpage); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + /* fall through */ + case 0: + bpage->lock.u_unlock(true); + goto evict; + case 2: + /* LRU flushing will always evict pages of the temporary tablespace. */ + do_evict= true; + } + /* Block is ready for flush. Dispatch an IO request. + If do_evict, the page may be evicted by buf_page_write_complete(). */ const page_id_t page_id(bpage->id()); const uint32_t space_id= page_id.space(); if (!space || space->id != space_id) { if (last_space_id != space_id) { + buf_pool.lru_hp.set(bpage); + mysql_mutex_unlock(&buf_pool.mutex); if (space) space->release(); - space= buf_flush_space(space_id); + auto p= buf_flush_space(space_id); + space= p.first; last_space_id= space_id; + if (!space) + { + mysql_mutex_lock(&buf_pool.mutex); + goto no_space; + } + mysql_mutex_lock(&buf_pool.mutex); + buf_pool.stat.n_pages_written+= p.second; } else + { ut_ad(!space); + goto no_space; + } } else if (space->is_stopping()) { space->release(); space= nullptr; + no_space: + mysql_mutex_lock(&buf_pool.flush_list_mutex); + buf_flush_discard_page(bpage); + continue; } - if (!space) - buf_flush_discard_page(bpage); - else if (neighbors && space->is_rotational()) + if (neighbors && space->is_rotational()) { mysql_mutex_unlock(&buf_pool.mutex); - n->flushed+= buf_flush_try_neighbors(space, page_id, neighbors == 1, - true, n->flushed, max); -reacquire_mutex: - mysql_mutex_lock(&buf_pool.mutex); + n->flushed+= buf_flush_try_neighbors(space, page_id, bpage, + neighbors == 1, + do_evict, n->flushed, max); + goto reacquire_mutex; + } + else if (n->flushed >= max && !recv_recovery_is_on()) + { + bpage->lock.u_unlock(true); + break; } - else if (bpage->flush(true, space)) + else if (bpage->flush(do_evict, space)) { ++n->flushed; goto reacquire_mutex; } } else - must_skip: /* Can't evict or dispatch this block. Go to previous. */ ut_ad(buf_pool.lru_hp.is_hp(prev)); - bpage= buf_pool.lru_hp.get(); } buf_pool.lru_hp.set(nullptr); @@ -1317,26 +1323,21 @@ static void buf_flush_LRU_list_batch(ulint max, flush_counters_t *n) /** Flush and move pages from LRU or unzip_LRU list to the free list. Whether LRU or unzip_LRU is used depends on the state of the system. -@param max maximum number of blocks to make available in buf_pool.free -@return number of flushed pages */ -static ulint buf_do_LRU_batch(ulint max) +@param max maximum number of blocks to flush +@param evict whether dirty pages are to be evicted after flushing them +@param n counts of flushed and evicted pages */ +static void buf_do_LRU_batch(ulint max, bool evict, flush_counters_t *n) { - const ulint n_unzip_LRU_evicted= buf_LRU_evict_from_unzip_LRU() - ? buf_free_from_unzip_LRU_list_batch(max) - : 0; - flush_counters_t n; - n.flushed= 0; - n.evicted= n_unzip_LRU_evicted; - buf_flush_LRU_list_batch(max, &n); - mysql_mutex_assert_owner(&buf_pool.mutex); - - if (const ulint evicted= n.evicted - n_unzip_LRU_evicted) - buf_lru_freed_page_count+= evicted; + if (buf_LRU_evict_from_unzip_LRU()) + buf_free_from_unzip_LRU_list_batch(); + n->evicted= 0; + n->flushed= 0; + buf_flush_LRU_list_batch(max, evict, n); - if (n.flushed) - buf_lru_flush_page_count+= n.flushed; - - return n.flushed; + mysql_mutex_assert_owner(&buf_pool.mutex); + buf_lru_freed_page_count+= n->evicted; + buf_lru_flush_page_count+= n->flushed; + buf_pool.stat.n_pages_written+= n->flushed; } /** This utility flushes dirty blocks from the end of the flush_list. @@ -1350,6 +1351,7 @@ static ulint buf_do_flush_list_batch(ulint max_n, lsn_t lsn) ulint scanned= 0; mysql_mutex_assert_owner(&buf_pool.mutex); + mysql_mutex_assert_owner(&buf_pool.flush_list_mutex); const auto neighbors= UT_LIST_GET_LEN(buf_pool.LRU) < BUF_LRU_OLD_MIN_LEN ? 0 : srv_flush_neighbors; @@ -1360,7 +1362,6 @@ static ulint buf_do_flush_list_batch(ulint max_n, lsn_t lsn) /* Start from the end of the list looking for a suitable block to be flushed. */ - mysql_mutex_lock(&buf_pool.flush_list_mutex); ulint len= UT_LIST_GET_LEN(buf_pool.flush_list); for (buf_page_t *bpage= UT_LIST_GET_LAST(buf_pool.flush_list); @@ -1371,32 +1372,42 @@ static ulint buf_do_flush_list_batch(ulint max_n, lsn_t lsn) break; ut_ad(bpage->in_file()); - buf_page_t *prev= UT_LIST_GET_PREV(list, bpage); - - if (oldest_modification == 1) { - buf_pool.delete_from_flush_list(bpage); - skip: - bpage= prev; - continue; - } + buf_page_t *prev= UT_LIST_GET_PREV(list, bpage); - ut_ad(oldest_modification > 2); + if (oldest_modification == 1) + { + clear: + buf_pool.delete_from_flush_list(bpage); + skip: + bpage= prev; + continue; + } - if (!bpage->ready_for_flush()) - goto skip; + ut_ad(oldest_modification > 2); - /* In order not to degenerate this scan to O(n*n) we attempt to - preserve the pointer position. Any thread that would remove 'prev' - from buf_pool.flush_list must adjust the hazard pointer. + if (!bpage->lock.u_lock_try(true)) + goto skip; - Note: A concurrent execution of buf_flush_list_space() may - terminate this scan prematurely. The buf_pool.n_flush_list() - should prevent multiple threads from executing - buf_do_flush_list_batch() concurrently, - but buf_flush_list_space() is ignoring that. */ - buf_pool.flush_hp.set(prev); - mysql_mutex_unlock(&buf_pool.flush_list_mutex); + ut_ad(!bpage->is_io_fixed()); + + if (bpage->oldest_modification() == 1) + { + bpage->lock.u_unlock(true); + goto clear; + } + + /* In order not to degenerate this scan to O(n*n) we attempt to + preserve the pointer position. Any thread that would remove 'prev' + from buf_pool.flush_list must adjust the hazard pointer. + + Note: A concurrent execution of buf_flush_list_space() may + terminate this scan prematurely. The buf_pool.flush_list_active + should prevent multiple threads from executing + buf_do_flush_list_batch() concurrently, + but buf_flush_list_space() is ignoring that. */ + buf_pool.flush_hp.set(prev); + } const page_id_t page_id(bpage->id()); const uint32_t space_id= page_id.space(); @@ -1404,10 +1415,16 @@ static ulint buf_do_flush_list_batch(ulint max_n, lsn_t lsn) { if (last_space_id != space_id) { + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + mysql_mutex_unlock(&buf_pool.mutex); if (space) space->release(); - space= buf_flush_space(space_id); + auto p= buf_flush_space(space_id); + space= p.first; last_space_id= space_id; + mysql_mutex_lock(&buf_pool.mutex); + buf_pool.stat.n_pages_written+= p.second; + mysql_mutex_lock(&buf_pool.flush_list_mutex); } else ut_ad(!space); @@ -1420,18 +1437,22 @@ static ulint buf_do_flush_list_batch(ulint max_n, lsn_t lsn) if (!space) buf_flush_discard_page(bpage); - else if (neighbors && space->is_rotational()) - { - mysql_mutex_unlock(&buf_pool.mutex); - count+= buf_flush_try_neighbors(space, page_id, neighbors == 1, - false, count, max_n); - reacquire_mutex: - mysql_mutex_lock(&buf_pool.mutex); - } - else if (bpage->flush(false, space)) + else { - ++count; - goto reacquire_mutex; + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + if (neighbors && space->is_rotational()) + { + mysql_mutex_unlock(&buf_pool.mutex); + count+= buf_flush_try_neighbors(space, page_id, bpage, neighbors == 1, + false, count, max_n); + reacquire_mutex: + mysql_mutex_lock(&buf_pool.mutex); + } + else if (bpage->flush(false, space)) + { + ++count; + goto reacquire_mutex; + } } mysql_mutex_lock(&buf_pool.flush_list_mutex); @@ -1439,7 +1460,6 @@ static ulint buf_do_flush_list_batch(ulint max_n, lsn_t lsn) } buf_pool.flush_hp.set(nullptr); - mysql_mutex_unlock(&buf_pool.flush_list_mutex); if (space) space->release(); @@ -1449,76 +1469,86 @@ static ulint buf_do_flush_list_batch(ulint max_n, lsn_t lsn) MONITOR_FLUSH_BATCH_SCANNED_NUM_CALL, MONITOR_FLUSH_BATCH_SCANNED_PER_CALL, scanned); - if (count) - MONITOR_INC_VALUE_CUMULATIVE(MONITOR_FLUSH_BATCH_TOTAL_PAGE, - MONITOR_FLUSH_BATCH_COUNT, - MONITOR_FLUSH_BATCH_PAGES, - count); - mysql_mutex_assert_owner(&buf_pool.mutex); return count; } -/** Wait until a flush batch ends. -@param lru true=buf_pool.LRU; false=buf_pool.flush_list */ -void buf_flush_wait_batch_end(bool lru) +/** Wait until a LRU flush batch ends. */ +void buf_flush_wait_LRU_batch_end() { - const auto &n_flush= lru ? buf_pool.n_flush_LRU_ : buf_pool.n_flush_list_; + mysql_mutex_assert_owner(&buf_pool.flush_list_mutex); + mysql_mutex_assert_not_owner(&buf_pool.mutex); - if (n_flush) + if (buf_pool.n_flush()) { - auto cond= lru ? &buf_pool.done_flush_LRU : &buf_pool.done_flush_list; tpool::tpool_wait_begin(); thd_wait_begin(nullptr, THD_WAIT_DISKIO); do - my_cond_wait(cond, &buf_pool.mutex.m_mutex); - while (n_flush); + my_cond_wait(&buf_pool.done_flush_LRU, + &buf_pool.flush_list_mutex.m_mutex); + while (buf_pool.n_flush()); tpool::tpool_wait_end(); thd_wait_end(nullptr); - pthread_cond_broadcast(cond); } } /** Write out dirty blocks from buf_pool.flush_list. +The caller must invoke buf_dblwr.flush_buffered_writes() +after releasing buf_pool.mutex. @param max_n wished maximum mumber of blocks flushed @param lsn buf_pool.get_oldest_modification(LSN_MAX) target @return the number of processed pages @retval 0 if a buf_pool.flush_list batch is already running */ -static ulint buf_flush_list(ulint max_n= ULINT_UNDEFINED, lsn_t lsn= LSN_MAX) +static ulint buf_flush_list_holding_mutex(ulint max_n= ULINT_UNDEFINED, + lsn_t lsn= LSN_MAX) { ut_ad(lsn); + mysql_mutex_assert_owner(&buf_pool.mutex); - if (buf_pool.n_flush_list()) - return 0; - - mysql_mutex_lock(&buf_pool.mutex); - const bool running= buf_pool.n_flush_list_ != 0; - /* FIXME: we are performing a dirty read of buf_pool.flush_list.count - while not holding buf_pool.flush_list_mutex */ - if (running || !UT_LIST_GET_LEN(buf_pool.flush_list)) + mysql_mutex_lock(&buf_pool.flush_list_mutex); + if (buf_pool.flush_list_active()) { - if (!running) - pthread_cond_broadcast(&buf_pool.done_flush_list); - mysql_mutex_unlock(&buf_pool.mutex); +nothing_to_do: + mysql_mutex_unlock(&buf_pool.flush_list_mutex); return 0; } - - buf_pool.n_flush_list_++; - const ulint n_flushed= buf_do_flush_list_batch(max_n, lsn); - const ulint n_flushing= --buf_pool.n_flush_list_; - - buf_pool.try_LRU_scan= true; - - mysql_mutex_unlock(&buf_pool.mutex); - - if (!n_flushing) + if (!buf_pool.get_oldest_modification(0)) + { pthread_cond_broadcast(&buf_pool.done_flush_list); + goto nothing_to_do; + } + buf_pool.flush_list_set_active(); + const ulint n_flushed= buf_do_flush_list_batch(max_n, lsn); + if (n_flushed) + buf_pool.stat.n_pages_written+= n_flushed; + buf_pool.flush_list_set_inactive(); + pthread_cond_broadcast(&buf_pool.done_flush_list); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); - buf_dblwr.flush_buffered_writes(); + if (n_flushed) + MONITOR_INC_VALUE_CUMULATIVE(MONITOR_FLUSH_BATCH_TOTAL_PAGE, + MONITOR_FLUSH_BATCH_COUNT, + MONITOR_FLUSH_BATCH_PAGES, + n_flushed); DBUG_PRINT("ib_buf", ("flush_list completed, " ULINTPF " pages", n_flushed)); return n_flushed; } +/** Write out dirty blocks from buf_pool.flush_list. +@param max_n wished maximum mumber of blocks flushed +@param lsn buf_pool.get_oldest_modification(LSN_MAX) target +@return the number of processed pages +@retval 0 if a buf_pool.flush_list batch is already running */ +static ulint buf_flush_list(ulint max_n= ULINT_UNDEFINED, + lsn_t lsn= LSN_MAX) +{ + mysql_mutex_lock(&buf_pool.mutex); + ulint n= buf_flush_list_holding_mutex(max_n, lsn); + mysql_mutex_unlock(&buf_pool.mutex); + buf_dblwr.flush_buffered_writes(); + return n; +} + /** Try to flush all the dirty pages that belong to a given tablespace. @param space tablespace @param n_flushed number of pages written @@ -1530,12 +1560,16 @@ bool buf_flush_list_space(fil_space_t *space, ulint *n_flushed) bool may_have_skipped= false; ulint max_n_flush= srv_io_capacity; - - mysql_mutex_lock(&buf_pool.mutex); - mysql_mutex_lock(&buf_pool.flush_list_mutex); + ulint n_flush= 0; bool acquired= space->acquire(); - buf_flush_freed_pages(space); + { + const uint32_t written{space->flush_freed(acquired)}; + mysql_mutex_lock(&buf_pool.mutex); + if (written) + buf_pool.stat.n_pages_written+= written; + } + mysql_mutex_lock(&buf_pool.flush_list_mutex); for (buf_page_t *bpage= UT_LIST_GET_LAST(buf_pool.flush_list); bpage; ) { @@ -1543,11 +1577,17 @@ bool buf_flush_list_space(fil_space_t *space, ulint *n_flushed) ut_ad(bpage->in_file()); buf_page_t *prev= UT_LIST_GET_PREV(list, bpage); - if (bpage->id().space() != space_id); - else if (bpage->oldest_modification() == 1) + if (bpage->oldest_modification() == 1) + clear: buf_pool.delete_from_flush_list(bpage); - else if (!bpage->ready_for_flush()) + else if (bpage->id().space() != space_id); + else if (!bpage->lock.u_lock_try(true)) may_have_skipped= true; + else if (bpage->oldest_modification() == 1) + { + bpage->lock.u_unlock(true); + goto clear; + } else { /* In order not to degenerate this scan to O(n*n) we attempt to @@ -1559,13 +1599,10 @@ bool buf_flush_list_space(fil_space_t *space, ulint *n_flushed) concurrently. This may terminate our iteration prematurely, leading us to return may_have_skipped=true. */ buf_pool.flush_hp.set(prev); - mysql_mutex_unlock(&buf_pool.flush_list_mutex); if (!acquired) - { was_freed: buf_flush_discard_page(bpage); - } else { if (space->is_stopping()) @@ -1574,28 +1611,24 @@ bool buf_flush_list_space(fil_space_t *space, ulint *n_flushed) acquired= false; goto was_freed; } - if (!bpage->flush(false, space)) - { - may_have_skipped= true; - mysql_mutex_lock(&buf_pool.flush_list_mutex); - goto next_after_skip; - } - if (n_flushed) - ++*n_flushed; - if (!--max_n_flush) + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + if (bpage->flush(false, space)) { + ++n_flush; + if (!--max_n_flush) + { + mysql_mutex_lock(&buf_pool.mutex); + mysql_mutex_lock(&buf_pool.flush_list_mutex); + may_have_skipped= true; + goto done; + } mysql_mutex_lock(&buf_pool.mutex); - mysql_mutex_lock(&buf_pool.flush_list_mutex); - may_have_skipped= true; - break; } - mysql_mutex_lock(&buf_pool.mutex); } mysql_mutex_lock(&buf_pool.flush_list_mutex); if (!buf_pool.flush_hp.is_hp(prev)) may_have_skipped= true; - next_after_skip: bpage= buf_pool.flush_hp.get(); continue; } @@ -1608,62 +1641,56 @@ bool buf_flush_list_space(fil_space_t *space, ulint *n_flushed) buf_flush_list_space(). We should always return true from buf_flush_list_space() if that should be the case; in buf_do_flush_list_batch() we will simply perform less work. */ - +done: buf_pool.flush_hp.set(nullptr); mysql_mutex_unlock(&buf_pool.flush_list_mutex); - buf_pool.try_LRU_scan= true; + buf_pool.stat.n_pages_written+= n_flush; + buf_pool.try_LRU_scan= true; + pthread_cond_broadcast(&buf_pool.done_free); mysql_mutex_unlock(&buf_pool.mutex); + if (n_flushed) + *n_flushed= n_flush; + if (acquired) space->release(); if (space->purpose == FIL_TYPE_IMPORT) - os_aio_wait_until_no_pending_writes(); + os_aio_wait_until_no_pending_writes(true); else buf_dblwr.flush_buffered_writes(); return may_have_skipped; } -/** Write out dirty blocks from buf_pool.LRU. +/** Write out dirty blocks from buf_pool.LRU, +and move clean blocks to buf_pool.free. +The caller must invoke buf_dblwr.flush_buffered_writes() +after releasing buf_pool.mutex. @param max_n wished maximum mumber of blocks flushed -@return the number of processed pages +@param evict whether to evict pages after flushing +@return evict ? number of processed pages : number of pages written @retval 0 if a buf_pool.LRU batch is already running */ -ulint buf_flush_LRU(ulint max_n) +ulint buf_flush_LRU(ulint max_n, bool evict) { - if (buf_pool.n_flush_LRU()) - return 0; - - log_buffer_flush_to_disk(); - - mysql_mutex_lock(&buf_pool.mutex); - if (buf_pool.n_flush_LRU_) - { - mysql_mutex_unlock(&buf_pool.mutex); - return 0; - } - buf_pool.n_flush_LRU_++; - - ulint n_flushed= buf_do_LRU_batch(max_n); - - const ulint n_flushing= --buf_pool.n_flush_LRU_; + mysql_mutex_assert_owner(&buf_pool.mutex); - buf_pool.try_LRU_scan= true; + flush_counters_t n; + buf_do_LRU_batch(max_n, evict, &n); - mysql_mutex_unlock(&buf_pool.mutex); + ulint pages= n.flushed; - if (!n_flushing) + if (n.evicted) { - pthread_cond_broadcast(&buf_pool.done_flush_LRU); - pthread_cond_signal(&buf_pool.done_free); + if (evict) + pages+= n.evicted; + buf_pool.try_LRU_scan= true; + pthread_cond_broadcast(&buf_pool.done_free); } - buf_dblwr.flush_buffered_writes(); - - DBUG_PRINT("ib_buf", ("LRU flush completed, " ULINTPF " pages", n_flushed)); - return n_flushed; + return pages; } #ifdef HAVE_PMEM @@ -1699,24 +1726,34 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept else #endif { - n_pending_checkpoint_writes++; - mysql_mutex_unlock(&mutex); + ut_ad(!checkpoint_pending); + checkpoint_pending= true; + latch.wr_unlock(); /* FIXME: issue an asynchronous write */ log.write(offset, {c, get_block_size()}); if (srv_file_flush_method != SRV_O_DSYNC) ut_a(log.flush()); - mysql_mutex_lock(&mutex); - n_pending_checkpoint_writes--; + latch.wr_lock(SRW_LOCK_CALL); + ut_ad(checkpoint_pending); + checkpoint_pending= false; } - ut_ad(!n_pending_checkpoint_writes); + ut_ad(!checkpoint_pending); next_checkpoint_no++; last_checkpoint_lsn= next_checkpoint_lsn; DBUG_PRINT("ib_log", ("checkpoint ended at " LSN_PF ", flushed to " LSN_PF, next_checkpoint_lsn, get_flushed_lsn())); + if (overwrite_warned) + { + sql_print_information("InnoDB: Crash recovery was broken " + "between LSN=" LSN_PF + " and checkpoint LSN=" LSN_PF ".", + overwrite_warned, next_checkpoint_lsn); + overwrite_warned= 0; + } - mysql_mutex_unlock(&mutex); + latch.wr_unlock(); } /** Initiate a log checkpoint, discarding the start of the log. @@ -1726,10 +1763,11 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept static bool log_checkpoint_low(lsn_t oldest_lsn, lsn_t end_lsn) { ut_ad(!srv_read_only_mode); - mysql_mutex_assert_owner(&log_sys.mutex); +#ifndef SUX_LOCK_GENERIC + ut_ad(log_sys.latch.is_write_locked()); +#endif ut_ad(oldest_lsn <= end_lsn); ut_ad(end_lsn == log_sys.get_lsn()); - ut_ad(!recv_no_log_write); if (oldest_lsn == log_sys.last_checkpoint_lsn || (oldest_lsn == end_lsn && oldest_lsn == log_sys.last_checkpoint_lsn + @@ -1739,10 +1777,11 @@ static bool log_checkpoint_low(lsn_t oldest_lsn, lsn_t end_lsn) /* Do nothing, because nothing was logged (other than a FILE_CHECKPOINT record) since the previous checkpoint. */ do_nothing: - mysql_mutex_unlock(&log_sys.mutex); + log_sys.latch.wr_unlock(); return true; } + ut_ad(!recv_no_log_write); ut_ad(oldest_lsn > log_sys.last_checkpoint_lsn); /* Repeat the FILE_MODIFY records after the checkpoint, in case some log records between the checkpoint and log_sys.lsn need them. @@ -1752,28 +1791,28 @@ static bool log_checkpoint_low(lsn_t oldest_lsn, lsn_t end_lsn) It is important that we write out the redo log before any further dirty pages are flushed to the tablespace files. At this point, - because we hold log_sys.mutex, mtr_t::commit() in other threads will - be blocked, and no pages can be added to the flush lists. */ + because we hold exclusive log_sys.latch, + mtr_t::commit() in other threads will be blocked, + and no pages can be added to buf_pool.flush_list. */ const lsn_t flush_lsn{fil_names_clear(oldest_lsn)}; ut_ad(flush_lsn >= end_lsn + SIZE_OF_FILE_CHECKPOINT); - mysql_mutex_unlock(&log_sys.mutex); + log_sys.latch.wr_unlock(); log_write_up_to(flush_lsn, true); - mysql_mutex_lock(&log_sys.mutex); + log_sys.latch.wr_lock(SRW_LOCK_CALL); if (log_sys.last_checkpoint_lsn >= oldest_lsn) goto do_nothing; ut_ad(log_sys.get_flushed_lsn() >= flush_lsn); - if (log_sys.n_pending_checkpoint_writes) + if (log_sys.checkpoint_pending) { /* A checkpoint write is running */ - mysql_mutex_unlock(&log_sys.mutex); + log_sys.latch.wr_unlock(); return false; } log_sys.next_checkpoint_lsn= oldest_lsn; log_sys.write_checkpoint(end_lsn); - mysql_mutex_assert_not_owner(&log_sys.mutex); return true; } @@ -1797,12 +1836,10 @@ static bool log_checkpoint() fil_flush_file_spaces(); } - mysql_mutex_lock(&log_sys.mutex); + log_sys.latch.wr_lock(SRW_LOCK_CALL); const lsn_t end_lsn= log_sys.get_lsn(); - mysql_mutex_lock(&log_sys.flush_order_mutex); mysql_mutex_lock(&buf_pool.flush_list_mutex); const lsn_t oldest_lsn= buf_pool.get_oldest_modification(end_lsn); - mysql_mutex_unlock(&log_sys.flush_order_mutex); mysql_mutex_unlock(&buf_pool.flush_list_mutex); return log_checkpoint_low(oldest_lsn, end_lsn); } @@ -1827,9 +1864,14 @@ static void buf_flush_wait(lsn_t lsn) buf_flush_sync_lsn= lsn; buf_pool.page_cleaner_set_idle(false); pthread_cond_signal(&buf_pool.do_flush_list); + my_cond_wait(&buf_pool.done_flush_list, + &buf_pool.flush_list_mutex.m_mutex); + if (buf_pool.get_oldest_modification(lsn) >= lsn) + break; } - my_cond_wait(&buf_pool.done_flush_list, - &buf_pool.flush_list_mutex.m_mutex); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + os_aio_wait_until_no_pending_writes(false); + mysql_mutex_lock(&buf_pool.flush_list_mutex); } } @@ -1839,7 +1881,6 @@ ATTRIBUTE_COLD void buf_flush_wait_flushed(lsn_t sync_lsn) { ut_ad(sync_lsn); ut_ad(sync_lsn < LSN_MAX); - mysql_mutex_assert_not_owner(&log_sys.mutex); ut_ad(!srv_read_only_mode); if (recv_recovery_is_on()) @@ -1850,6 +1891,7 @@ ATTRIBUTE_COLD void buf_flush_wait_flushed(lsn_t sync_lsn) if (buf_pool.get_oldest_modification(sync_lsn) < sync_lsn) { MONITOR_INC(MONITOR_FLUSH_SYNC_WAITS); + #if 1 /* FIXME: remove this, and guarantee that the page cleaner serves us */ if (UNIV_UNLIKELY(!buf_page_cleaner_is_active)) { @@ -1857,13 +1899,13 @@ ATTRIBUTE_COLD void buf_flush_wait_flushed(lsn_t sync_lsn) { mysql_mutex_unlock(&buf_pool.flush_list_mutex); ulint n_pages= buf_flush_list(srv_max_io_capacity, sync_lsn); - buf_flush_wait_batch_end_acquiring_mutex(false); if (n_pages) { MONITOR_INC_VALUE_CUMULATIVE(MONITOR_FLUSH_SYNC_TOTAL_PAGE, MONITOR_FLUSH_SYNC_COUNT, MONITOR_FLUSH_SYNC_PAGES, n_pages); } + os_aio_wait_until_no_pending_writes(false); mysql_mutex_lock(&buf_pool.flush_list_mutex); } while (buf_pool.get_oldest_modification(sync_lsn) < sync_lsn); @@ -1888,6 +1930,7 @@ ATTRIBUTE_COLD void buf_flush_wait_flushed(lsn_t sync_lsn) record from a previous fil_names_clear() call, which we must write out before we can advance the checkpoint. */ log_write_up_to(sync_lsn, true); + DBUG_EXECUTE_IF("ib_log_checkpoint_avoid_hard", return;); log_checkpoint(); } } @@ -1897,12 +1940,13 @@ ATTRIBUTE_COLD void buf_flush_wait_flushed(lsn_t sync_lsn) @param furious true=furious flushing, false=limit to innodb_io_capacity */ ATTRIBUTE_COLD void buf_flush_ahead(lsn_t lsn, bool furious) { - mysql_mutex_assert_not_owner(&log_sys.mutex); ut_ad(!srv_read_only_mode); if (recv_recovery_is_on()) recv_sys.apply(true); + DBUG_EXECUTE_IF("ib_log_checkpoint_avoid_hard", return;); + Atomic_relaxed &limit= furious ? buf_flush_sync_lsn : buf_flush_async_lsn; @@ -1919,28 +1963,16 @@ ATTRIBUTE_COLD void buf_flush_ahead(lsn_t lsn, bool furious) } } -/** Wait for pending flushes to complete. */ -void buf_flush_wait_batch_end_acquiring_mutex(bool lru) -{ - if (lru ? buf_pool.n_flush_LRU() : buf_pool.n_flush_list()) - { - mysql_mutex_lock(&buf_pool.mutex); - buf_flush_wait_batch_end(lru); - mysql_mutex_unlock(&buf_pool.mutex); - } -} - /** Conduct checkpoint-related flushing for innodb_flush_sync=ON, and try to initiate checkpoints until the target is met. @param lsn minimum value of buf_pool.get_oldest_modification(LSN_MAX) */ ATTRIBUTE_COLD static void buf_flush_sync_for_checkpoint(lsn_t lsn) { ut_ad(!srv_read_only_mode); + mysql_mutex_assert_not_owner(&buf_pool.flush_list_mutex); for (;;) { - mysql_mutex_unlock(&buf_pool.flush_list_mutex); - if (ulint n_flushed= buf_flush_list(srv_max_io_capacity, lsn)) { MONITOR_INC_VALUE_CUMULATIVE(MONITOR_FLUSH_SYNC_TOTAL_PAGE, @@ -1956,11 +1988,9 @@ ATTRIBUTE_COLD static void buf_flush_sync_for_checkpoint(lsn_t lsn) fil_flush_file_spaces(); } - mysql_mutex_lock(&log_sys.mutex); + log_sys.latch.wr_lock(SRW_LOCK_CALL); const lsn_t newest_lsn= log_sys.get_lsn(); - mysql_mutex_lock(&log_sys.flush_order_mutex); mysql_mutex_lock(&buf_pool.flush_list_mutex); - mysql_mutex_unlock(&log_sys.flush_order_mutex); lsn_t measure= buf_pool.get_oldest_modification(0); const lsn_t checkpoint_lsn= measure ? measure : newest_lsn; @@ -1974,13 +2004,11 @@ ATTRIBUTE_COLD static void buf_flush_sync_for_checkpoint(lsn_t lsn) } else { - mysql_mutex_unlock(&log_sys.mutex); + log_sys.latch.wr_unlock(); if (!measure) measure= LSN_MAX; } - mysql_mutex_assert_not_owner(&log_sys.mutex); - /* After attempting log checkpoint, check if we have reached our target. */ const lsn_t target= buf_flush_sync_lsn; @@ -1991,6 +2019,7 @@ ATTRIBUTE_COLD static void buf_flush_sync_for_checkpoint(lsn_t lsn) /* wake up buf_flush_wait() */ pthread_cond_broadcast(&buf_pool.done_flush_list); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); lsn= std::max(lsn, target); @@ -2041,16 +2070,19 @@ af_get_pct_for_lsn( / 7.5)); } -/** This function is called approximately once every second by the -page_cleaner thread if innodb_adaptive_flushing=ON. +/** This function is called approximately once every second by +buf_flush_page_cleaner() if innodb_max_dirty_pages_pct_lwm>0 +and innodb_adaptive_flushing=ON. Based on various factors it decides if there is a need to do flushing. @return number of pages recommended to be flushed @param last_pages_in number of pages flushed in previous batch @param oldest_lsn buf_pool.get_oldest_modification(0) +@param pct_lwm innodb_max_dirty_pages_pct_lwm, or 0 to ignore it @param dirty_blocks UT_LIST_GET_LEN(buf_pool.flush_list) @param dirty_pct 100*flush_list.count / (LRU.count + free.count) */ static ulint page_cleaner_flush_pages_recommendation(ulint last_pages_in, lsn_t oldest_lsn, + double pct_lwm, ulint dirty_blocks, double dirty_pct) { @@ -2080,60 +2112,57 @@ static ulint page_cleaner_flush_pages_recommendation(ulint last_pages_in, n_pages= std::min(srv_io_capacity, dirty_blocks); } +func_exit: + page_cleaner.flush_pass++; return n_pages; } sum_pages += last_pages_in; - double time_elapsed = difftime(curr_time, prev_time); + const ulint time_elapsed = std::max(curr_time - prev_time, 1); - /* We update our variables every srv_flushing_avg_loops + /* We update our variables every innodb_flushing_avg_loops iterations to smooth out transition in workload. */ if (++n_iterations >= srv_flushing_avg_loops - || time_elapsed >= static_cast(srv_flushing_avg_loops)) { - - if (time_elapsed < 1) { - time_elapsed = 1; - } + || time_elapsed >= srv_flushing_avg_loops) { - avg_page_rate = static_cast( - ((static_cast(sum_pages) - / time_elapsed) - + static_cast(avg_page_rate)) / 2); + avg_page_rate = (sum_pages / time_elapsed + avg_page_rate) / 2; /* How much LSN we have generated since last call. */ - lsn_rate = static_cast( - static_cast(cur_lsn - prev_lsn) - / time_elapsed); + lsn_rate = (cur_lsn - prev_lsn) / time_elapsed; lsn_avg_rate = (lsn_avg_rate + lsn_rate) / 2; - ulint flush_tm = page_cleaner.flush_time; - ulint flush_pass = page_cleaner.flush_pass; - - page_cleaner.flush_time = 0; - page_cleaner.flush_pass = 0; - - if (flush_pass) { - flush_tm /= flush_pass; + if (page_cleaner.flush_pass) { + page_cleaner.flush_time /= page_cleaner.flush_pass; } - MONITOR_SET(MONITOR_FLUSH_ADAPTIVE_AVG_TIME, flush_tm); - MONITOR_SET(MONITOR_FLUSH_ADAPTIVE_AVG_PASS, flush_pass); - prev_lsn = cur_lsn; prev_time = curr_time; - n_iterations = 0; + MONITOR_SET(MONITOR_FLUSH_ADAPTIVE_AVG_TIME, + page_cleaner.flush_time); + MONITOR_SET(MONITOR_FLUSH_ADAPTIVE_AVG_PASS, + page_cleaner.flush_pass); + page_cleaner.flush_time = 0; + page_cleaner.flush_pass = 0; + + n_iterations = 0; sum_pages = 0; } - const ulint pct_for_dirty = srv_max_dirty_pages_pct_lwm == 0 - ? (dirty_pct >= max_pct ? 100 : 0) - : static_cast - (max_pct > 0.0 ? dirty_pct / max_pct : dirty_pct); - ulint pct_total = std::max(pct_for_dirty, pct_for_lsn); + MONITOR_SET(MONITOR_FLUSH_PCT_FOR_LSN, pct_for_lsn); + + double total_ratio; + if (pct_lwm == 0.0 || max_pct == 0.0) { + total_ratio = 1; + } else { + total_ratio = std::max(double(pct_for_lsn) / 100, + (dirty_pct / max_pct)); + } + + MONITOR_SET(MONITOR_FLUSH_PCT_FOR_DIRTY, ulint(total_ratio * 100)); /* Estimate pages to be flushed for the lsn progress */ lsn_t target_lsn = oldest_lsn @@ -2159,7 +2188,7 @@ static ulint page_cleaner_flush_pages_recommendation(ulint last_pages_in, pages_for_lsn = 1; } - n_pages = (ulint(double(srv_io_capacity) * double(pct_total) / 100.0) + n_pages = (ulint(double(srv_io_capacity) * total_ratio) + avg_page_rate + pages_for_lsn) / 3; if (n_pages > srv_max_io_capacity) { @@ -2172,12 +2201,16 @@ static ulint page_cleaner_flush_pages_recommendation(ulint last_pages_in, MONITOR_SET(MONITOR_FLUSH_AVG_PAGE_RATE, avg_page_rate); MONITOR_SET(MONITOR_FLUSH_LSN_AVG_RATE, lsn_avg_rate); - MONITOR_SET(MONITOR_FLUSH_PCT_FOR_DIRTY, pct_for_dirty); - MONITOR_SET(MONITOR_FLUSH_PCT_FOR_LSN, pct_for_lsn); - return(n_pages); + goto func_exit; } +#if defined __aarch64__&&defined __GNUC__&&__GNUC__==4&&!defined __clang__ +/* Avoid GCC 4.8.5 internal compiler error "could not split insn". +We would only need this for buf_flush_page_cleaner(), +but GCC 4.8.5 does not support pop_options. */ +# pragma GCC optimize ("O0") +#endif /** page_cleaner thread tasked with flushing dirty pages from the buffer pools. As of now we'll have only one coordinator. */ static void buf_flush_page_cleaner() @@ -2193,8 +2226,6 @@ static void buf_flush_page_cleaner() timespec abstime; set_timespec(abstime, 1); - mysql_mutex_lock(&buf_pool.flush_list_mutex); - lsn_t lsn_limit; ulint last_activity_count= srv_get_activity_count(); @@ -2202,44 +2233,34 @@ static void buf_flush_page_cleaner() { lsn_limit= buf_flush_sync_lsn; - if (UNIV_UNLIKELY(lsn_limit != 0)) + if (UNIV_UNLIKELY(lsn_limit != 0) && UNIV_LIKELY(srv_flush_sync)) { -furious_flush: - if (UNIV_LIKELY(srv_flush_sync)) - { - buf_flush_sync_for_checkpoint(lsn_limit); - last_pages= 0; - set_timespec(abstime, 1); - continue; - } + furious_flush: + buf_flush_sync_for_checkpoint(lsn_limit); + last_pages= 0; + set_timespec(abstime, 1); + continue; } + + mysql_mutex_lock(&buf_pool.flush_list_mutex); + if (buf_pool.ran_out()) + goto no_wait; else if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) break; - /* If buf pager cleaner is idle and there is no work - (either dirty pages are all flushed or adaptive flushing - is not enabled) then opt for non-timed wait */ if (buf_pool.page_cleaner_idle() && (!UT_LIST_GET_LEN(buf_pool.flush_list) || srv_max_dirty_pages_pct_lwm == 0.0)) - my_cond_wait(&buf_pool.do_flush_list, &buf_pool.flush_list_mutex.m_mutex); + /* We are idle; wait for buf_pool.page_cleaner_wakeup() */ + my_cond_wait(&buf_pool.do_flush_list, + &buf_pool.flush_list_mutex.m_mutex); else my_cond_timedwait(&buf_pool.do_flush_list, &buf_pool.flush_list_mutex.m_mutex, &abstime); - + no_wait: set_timespec(abstime, 1); - lsn_t soft_lsn_limit= buf_flush_async_lsn; lsn_limit= buf_flush_sync_lsn; - - if (UNIV_UNLIKELY(lsn_limit != 0)) - { - if (UNIV_LIKELY(srv_flush_sync)) - goto furious_flush; - } - else if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) - break; - const lsn_t oldest_lsn= buf_pool.get_oldest_modification(0); if (!oldest_lsn) @@ -2250,117 +2271,155 @@ static void buf_flush_page_cleaner() /* wake up buf_flush_wait() */ pthread_cond_broadcast(&buf_pool.done_flush_list); } -unemployed: + unemployed: buf_flush_async_lsn= 0; + set_idle: buf_pool.page_cleaner_set_idle(true); + if (UNIV_UNLIKELY(srv_shutdown_state > SRV_SHUTDOWN_INITIATED)) + break; + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + end_of_batch: + buf_dblwr.flush_buffered_writes(); - DBUG_EXECUTE_IF("ib_log_checkpoint_avoid", continue;); + do + { + DBUG_EXECUTE_IF("ib_log_checkpoint_avoid", continue;); + DBUG_EXECUTE_IF("ib_log_checkpoint_avoid_hard", continue;); + + if (!recv_recovery_is_on() && + !srv_startup_is_before_trx_rollback_phase && + srv_operation <= SRV_OPERATION_EXPORT_RESTORED) + log_checkpoint(); + } + while (false); + + if (!buf_pool.ran_out()) + continue; + mysql_mutex_lock(&buf_pool.flush_list_mutex); + } + + lsn_t soft_lsn_limit= buf_flush_async_lsn; + + if (UNIV_UNLIKELY(lsn_limit != 0)) + { + if (srv_flush_sync) + goto do_furious_flush; + if (oldest_lsn >= lsn_limit) + { + buf_flush_sync_lsn= 0; + pthread_cond_broadcast(&buf_pool.done_flush_list); + } + else if (lsn_limit > soft_lsn_limit) + soft_lsn_limit= lsn_limit; + } + + double pct_lwm= 0.0; + ulint n_flushed= 0, n; + if (UNIV_UNLIKELY(soft_lsn_limit != 0)) + { + if (oldest_lsn >= soft_lsn_limit) + buf_flush_async_lsn= soft_lsn_limit= 0; + } + else if (buf_pool.ran_out()) + { + buf_pool.page_cleaner_set_idle(false); mysql_mutex_unlock(&buf_pool.flush_list_mutex); + n= srv_max_io_capacity; + mysql_mutex_lock(&buf_pool.mutex); + LRU_flush: + n= buf_flush_LRU(n, false); + mysql_mutex_unlock(&buf_pool.mutex); + last_pages+= n; - if (!recv_recovery_is_on() && - !srv_startup_is_before_trx_rollback_phase && - srv_operation == SRV_OPERATION_NORMAL) - log_checkpoint(); + if (pct_lwm == 0.0) + goto end_of_batch; + /* when idle flushing kicks in page_cleaner is marked active. + reset it back to idle since the it was made active as part of + idle flushing stage. */ mysql_mutex_lock(&buf_pool.flush_list_mutex); - continue; + goto set_idle; } + else if (UNIV_UNLIKELY(srv_shutdown_state > SRV_SHUTDOWN_INITIATED)) + break; const ulint dirty_blocks= UT_LIST_GET_LEN(buf_pool.flush_list); - ut_ad(dirty_blocks); /* We perform dirty reads of the LRU+free list lengths here. Division by zero is not possible, because buf_pool.flush_list is guaranteed to be nonempty, and it is a subset of buf_pool.LRU. */ const double dirty_pct= double(dirty_blocks) * 100.0 / double(UT_LIST_GET_LEN(buf_pool.LRU) + UT_LIST_GET_LEN(buf_pool.free)); - - bool idle_flush= false; - - if (lsn_limit || soft_lsn_limit); - else if (af_needed_for_redo(oldest_lsn)); - else if (srv_max_dirty_pages_pct_lwm != 0.0) + pct_lwm= srv_max_dirty_pages_pct_lwm; + if (pct_lwm != 0.0) { const ulint activity_count= srv_get_activity_count(); if (activity_count != last_activity_count) + { last_activity_count= activity_count; - else if (buf_pool.page_cleaner_idle() && buf_pool.n_pend_reads == 0) + goto maybe_unemployed; + } + else if (buf_pool.page_cleaner_idle() && !os_aio_pending_reads()) { - /* reaching here means 3 things: - - last_activity_count == activity_count: suggesting server is idle - (no trx_t::commit activity) - - page cleaner is idle (dirty_pct < srv_max_dirty_pages_pct_lwm) - - there are no pending reads but there are dirty pages to flush */ - idle_flush= true; + /* reaching here means 3 things: + - last_activity_count == activity_count: suggesting server is idle + (no trx_t::commit() activity) + - page cleaner is idle (dirty_pct < srv_max_dirty_pages_pct_lwm) + - there are no pending reads but there are dirty pages to flush */ buf_pool.update_last_activity_count(activity_count); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + goto idle_flush; + } + else + { + maybe_unemployed: + const bool below{dirty_pct < pct_lwm}; + pct_lwm= 0.0; + if (below) + goto possibly_unemployed; } - - if (!idle_flush && dirty_pct < srv_max_dirty_pages_pct_lwm) - goto unemployed; } else if (dirty_pct < srv_max_buf_pool_modified_pct) - goto unemployed; - - if (UNIV_UNLIKELY(lsn_limit != 0) && oldest_lsn >= lsn_limit) - lsn_limit= buf_flush_sync_lsn= 0; - if (UNIV_UNLIKELY(soft_lsn_limit != 0) && oldest_lsn >= soft_lsn_limit) - soft_lsn_limit= buf_flush_async_lsn= 0; + possibly_unemployed: + if (!soft_lsn_limit && !af_needed_for_redo(oldest_lsn)) + goto unemployed; buf_pool.page_cleaner_set_idle(false); mysql_mutex_unlock(&buf_pool.flush_list_mutex); - if (!lsn_limit) - lsn_limit= soft_lsn_limit; - - ulint n_flushed; - - if (UNIV_UNLIKELY(lsn_limit != 0)) + if (UNIV_UNLIKELY(soft_lsn_limit != 0)) { - n_flushed= buf_flush_list(srv_max_io_capacity, lsn_limit); - /* wake up buf_flush_wait() */ - pthread_cond_broadcast(&buf_pool.done_flush_list); - goto try_checkpoint; + n= srv_max_io_capacity; + goto background_flush; } - else if (idle_flush || !srv_adaptive_flushing) + + if (!srv_adaptive_flushing) { - n_flushed= buf_flush_list(srv_io_capacity); -try_checkpoint: - if (n_flushed) - { - MONITOR_INC_VALUE_CUMULATIVE(MONITOR_FLUSH_BACKGROUND_TOTAL_PAGE, - MONITOR_FLUSH_BACKGROUND_COUNT, - MONITOR_FLUSH_BACKGROUND_PAGES, - n_flushed); -do_checkpoint: - /* The periodic log_checkpoint() call here makes it harder to - reproduce bugs in crash recovery or mariabackup --prepare, or - in code that writes the redo log records. Omitting the call - here should not affect correctness, because log_free_check() - should still be invoking checkpoints when needed. */ - DBUG_EXECUTE_IF("ib_log_checkpoint_avoid", goto next;); - - if (!recv_recovery_is_on() && srv_operation == SRV_OPERATION_NORMAL) - log_checkpoint(); - } + idle_flush: + n= srv_io_capacity; + soft_lsn_limit= LSN_MAX; + background_flush: + mysql_mutex_lock(&buf_pool.mutex); + n_flushed= buf_flush_list_holding_mutex(n, soft_lsn_limit); + MONITOR_INC_VALUE_CUMULATIVE(MONITOR_FLUSH_BACKGROUND_TOTAL_PAGE, + MONITOR_FLUSH_BACKGROUND_COUNT, + MONITOR_FLUSH_BACKGROUND_PAGES, + n_flushed); } - else if (ulint n= page_cleaner_flush_pages_recommendation(last_pages, - oldest_lsn, - dirty_blocks, - dirty_pct)) + else if ((n= page_cleaner_flush_pages_recommendation(last_pages, + oldest_lsn, + pct_lwm, + dirty_blocks, + dirty_pct)) != 0) { - page_cleaner.flush_pass++; const ulint tm= ut_time_ms(); - last_pages= n_flushed= buf_flush_list(n); + mysql_mutex_lock(&buf_pool.mutex); + last_pages= n_flushed= buf_flush_list_holding_mutex(n); page_cleaner.flush_time+= ut_time_ms() - tm; - - if (n_flushed) - { - MONITOR_INC_VALUE_CUMULATIVE(MONITOR_FLUSH_ADAPTIVE_TOTAL_PAGE, - MONITOR_FLUSH_ADAPTIVE_COUNT, - MONITOR_FLUSH_ADAPTIVE_PAGES, - n_flushed); - goto do_checkpoint; - } + MONITOR_INC_VALUE_CUMULATIVE(MONITOR_FLUSH_ADAPTIVE_TOTAL_PAGE, + MONITOR_FLUSH_ADAPTIVE_COUNT, + MONITOR_FLUSH_ADAPTIVE_PAGES, + n_flushed); } else if (buf_flush_async_lsn <= oldest_lsn) { @@ -2368,30 +2427,29 @@ static void buf_flush_page_cleaner() goto unemployed; } -#ifndef DBUG_OFF -next: -#endif /* !DBUG_OFF */ - mysql_mutex_lock(&buf_pool.flush_list_mutex); - - /* when idle flushing kicks in page_cleaner is marked active. - reset it back to idle since the it was made active as part of - idle flushing stage. */ - if (idle_flush) - buf_pool.page_cleaner_set_idle(true); + n= n >= n_flushed ? n - n_flushed : 0; + goto LRU_flush; } mysql_mutex_unlock(&buf_pool.flush_list_mutex); if (srv_fast_shutdown != 2) { - buf_flush_wait_batch_end_acquiring_mutex(true); - buf_flush_wait_batch_end_acquiring_mutex(false); + buf_dblwr.flush_buffered_writes(); + mysql_mutex_lock(&buf_pool.flush_list_mutex); + buf_flush_wait_LRU_batch_end(); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + os_aio_wait_until_no_pending_writes(false); } mysql_mutex_lock(&buf_pool.flush_list_mutex); lsn_limit= buf_flush_sync_lsn; if (UNIV_UNLIKELY(lsn_limit != 0)) + { + do_furious_flush: + mysql_mutex_unlock(&buf_pool.flush_list_mutex); goto furious_flush; + } buf_page_cleaner_is_active= false; pthread_cond_broadcast(&buf_pool.done_flush_list); mysql_mutex_unlock(&buf_pool.flush_list_mutex); @@ -2407,7 +2465,7 @@ static void buf_flush_page_cleaner() ATTRIBUTE_COLD void buf_flush_page_cleaner_init() { ut_ad(!buf_page_cleaner_is_active); - ut_ad(srv_operation == SRV_OPERATION_NORMAL || + ut_ad(srv_operation <= SRV_OPERATION_EXPORT_RESTORED || srv_operation == SRV_OPERATION_RESTORE || srv_operation == SRV_OPERATION_RESTORE_EXPORT); buf_flush_async_lsn= 0; @@ -2416,17 +2474,6 @@ ATTRIBUTE_COLD void buf_flush_page_cleaner_init() std::thread(buf_flush_page_cleaner).detach(); } -#if defined(HAVE_SYSTEMD) && !defined(EMBEDDED_LIBRARY) -/** @return the number of dirty pages in the buffer pool */ -static ulint buf_flush_list_length() -{ - mysql_mutex_lock(&buf_pool.flush_list_mutex); - const ulint len= UT_LIST_GET_LEN(buf_pool.flush_list); - mysql_mutex_unlock(&buf_pool.flush_list_mutex); - return len; -} -#endif - /** Flush the buffer pool on shutdown. */ ATTRIBUTE_COLD void buf_flush_buffer_pool() { @@ -2442,37 +2489,25 @@ ATTRIBUTE_COLD void buf_flush_buffer_pool() { mysql_mutex_unlock(&buf_pool.flush_list_mutex); buf_flush_list(srv_max_io_capacity); - if (buf_pool.n_flush_list()) - { - timespec abstime; - service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, - "Waiting to flush " ULINTPF " pages", - buf_flush_list_length()); - set_timespec(abstime, INNODB_EXTEND_TIMEOUT_INTERVAL / 2); - mysql_mutex_lock(&buf_pool.mutex); - while (buf_pool.n_flush_list_) - my_cond_timedwait(&buf_pool.done_flush_list, &buf_pool.mutex.m_mutex, - &abstime); - mysql_mutex_unlock(&buf_pool.mutex); - } + os_aio_wait_until_no_pending_writes(false); mysql_mutex_lock(&buf_pool.flush_list_mutex); + service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, + "Waiting to flush " ULINTPF " pages", + UT_LIST_GET_LEN(buf_pool.flush_list)); } mysql_mutex_unlock(&buf_pool.flush_list_mutex); - ut_ad(!buf_pool.any_io_pending()); + ut_ad(!os_aio_pending_reads()); } /** Synchronously flush dirty blocks during recv_sys_t::apply(). NOTE: The calling thread is not allowed to hold any buffer page latches! */ void buf_flush_sync_batch(lsn_t lsn) { - thd_wait_begin(nullptr, THD_WAIT_DISKIO); - tpool::tpool_wait_begin(); + lsn= std::max(lsn, log_sys.get_lsn()); mysql_mutex_lock(&buf_pool.flush_list_mutex); buf_flush_wait(lsn); mysql_mutex_unlock(&buf_pool.flush_list_mutex); - tpool::tpool_wait_end(); - thd_wait_end(nullptr); } /** Synchronously flush dirty blocks. @@ -2500,6 +2535,7 @@ void buf_flush_sync() if (lsn == log_sys.get_lsn()) break; } + mysql_mutex_unlock(&buf_pool.flush_list_mutex); tpool::tpool_wait_end(); thd_wait_end(nullptr); diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index 5469ac49b3aea..724aa641f1247 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -136,7 +136,6 @@ static void buf_LRU_block_free_hashed_page(buf_block_t *block) @param[in] bpage control block */ static inline void incr_LRU_size_in_bytes(const buf_page_t* bpage) { - /* FIXME: use atomics, not mutex */ mysql_mutex_assert_owner(&buf_pool.mutex); buf_pool.stat.LRU_bytes += bpage->physical_size(); @@ -190,8 +189,6 @@ LRU list. The compressed page is preserved, and it need not be clean. @return true if freed */ static bool buf_LRU_free_from_unzip_LRU_list(ulint limit) { - mysql_mutex_assert_owner(&buf_pool.mutex); - if (!buf_LRU_evict_from_unzip_LRU()) { return(false); } @@ -210,6 +207,7 @@ static bool buf_LRU_free_from_unzip_LRU_list(ulint limit) freed = buf_LRU_free_page(&block->page, false); if (freed) { + scanned++; break; } @@ -254,17 +252,16 @@ static bool buf_LRU_free_from_common_LRU_list(ulint limit) } freed = true; + scanned++; break; } } - if (scanned) { - MONITOR_INC_VALUE_CUMULATIVE( - MONITOR_LRU_SEARCH_SCANNED, - MONITOR_LRU_SEARCH_SCANNED_NUM_CALL, - MONITOR_LRU_SEARCH_SCANNED_PER_CALL, - scanned); - } + MONITOR_INC_VALUE_CUMULATIVE( + MONITOR_LRU_SEARCH_SCANNED, + MONITOR_LRU_SEARCH_SCANNED_NUM_CALL, + MONITOR_LRU_SEARCH_SCANNED_PER_CALL, + scanned); return(freed); } @@ -288,7 +285,7 @@ buf_block_t* buf_LRU_get_free_only() ut_a(!block->page.in_file()); UT_LIST_REMOVE(buf_pool.free, &block->page); - if (buf_pool.curr_size >= buf_pool.old_size + if (!buf_pool.is_shrinking() || UT_LIST_GET_LEN(buf_pool.withdraw) >= buf_pool.withdraw_target || !buf_pool.will_be_withdrawn(block->page)) { @@ -321,7 +318,7 @@ static void buf_LRU_check_size_of_non_data_objects() { mysql_mutex_assert_owner(&buf_pool.mutex); - if (recv_recovery_is_on() || buf_pool.curr_size != buf_pool.old_size) + if (recv_recovery_is_on() || buf_pool.n_chunks_new != buf_pool.n_chunks) return; const auto s= UT_LIST_GET_LEN(buf_pool.free) + UT_LIST_GET_LEN(buf_pool.LRU); @@ -399,6 +396,13 @@ buf_block_t *buf_LRU_get_free_block(bool have_mutex) mysql_mutex_assert_owner(&buf_pool.mutex); goto got_mutex; } + DBUG_EXECUTE_IF("recv_ran_out_of_buffer", + if (recv_recovery_is_on() + && recv_sys.apply_log_recs) { + mysql_mutex_lock(&buf_pool.mutex); + goto flush_lru; + }); +get_mutex: mysql_mutex_lock(&buf_pool.mutex); got_mutex: buf_LRU_check_size_of_non_data_objects(); @@ -441,20 +445,32 @@ buf_block_t *buf_LRU_get_free_block(bool have_mutex) if ((block = buf_LRU_get_free_only()) != nullptr) { goto got_block; } - if (!buf_pool.n_flush_LRU_) { - break; + mysql_mutex_unlock(&buf_pool.mutex); + mysql_mutex_lock(&buf_pool.flush_list_mutex); + const auto n_flush = buf_pool.n_flush(); + if (!buf_pool.try_LRU_scan) { + buf_pool.page_cleaner_wakeup(true); + } + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + mysql_mutex_lock(&buf_pool.mutex); + if (!n_flush) { + goto not_found; + } + if (!buf_pool.try_LRU_scan) { + my_cond_wait(&buf_pool.done_free, + &buf_pool.mutex.m_mutex); } - my_cond_wait(&buf_pool.done_free, &buf_pool.mutex.m_mutex); } -#ifndef DBUG_OFF not_found: -#endif - mysql_mutex_unlock(&buf_pool.mutex); + if (n_iterations > 1) { + MONITOR_INC( MONITOR_LRU_GET_FREE_WAITS ); + } - if (n_iterations > 20 && !buf_lru_free_blocks_error_printed + if (n_iterations == 21 && !buf_lru_free_blocks_error_printed && srv_buf_pool_old_size == srv_buf_pool_size) { - + buf_lru_free_blocks_error_printed = true; + mysql_mutex_unlock(&buf_pool.mutex); ib::warn() << "Difficult to find free blocks in the buffer pool" " (" << n_iterations << " search iterations)! " << flush_failures << " failed attempts to" @@ -466,12 +482,7 @@ buf_block_t *buf_LRU_get_free_block(bool have_mutex) << os_n_file_writes << " OS file writes, " << os_n_fsyncs << " OS fsyncs."; - - buf_lru_free_blocks_error_printed = true; - } - - if (n_iterations > 1) { - MONITOR_INC( MONITOR_LRU_GET_FREE_WAITS ); + mysql_mutex_lock(&buf_pool.mutex); } /* No free block was found: try to flush the LRU list. @@ -482,16 +493,19 @@ buf_block_t *buf_LRU_get_free_block(bool have_mutex) removing the block from buf_pool.page_hash and buf_pool.LRU is fairly involved (particularly in case of ROW_FORMAT=COMPRESSED pages). We can do that in a separate patch sometime in future. */ - - if (!buf_flush_LRU(innodb_lru_flush_size)) { +#ifndef DBUG_OFF +flush_lru: +#endif + if (!buf_flush_LRU(innodb_lru_flush_size, true)) { MONITOR_INC(MONITOR_LRU_SINGLE_FLUSH_FAILURE_COUNT); ++flush_failures; } n_iterations++; - mysql_mutex_lock(&buf_pool.mutex); buf_pool.stat.LRU_waits++; - goto got_mutex; + mysql_mutex_unlock(&buf_pool.mutex); + buf_dblwr.flush_buffered_writes(); + goto get_mutex; } /** Move the LRU_old pointer so that the length of the old blocks list @@ -800,50 +814,57 @@ bool buf_LRU_free_page(buf_page_t *bpage, bool zip) /* We cannot use transactional_lock_guard here, because buf_buddy_relocate() in buf_buddy_free() could get stuck. */ hash_lock.lock(); - lsn_t oldest_modification = bpage->oldest_modification_acquire(); + const lsn_t oldest_modification = bpage->oldest_modification_acquire(); if (UNIV_UNLIKELY(!bpage->can_relocate())) { /* Do not free buffer fixed and I/O-fixed blocks. */ goto func_exit; } - if (oldest_modification == 1) { + switch (oldest_modification) { + case 2: + ut_ad(id.space() == SRV_TMP_SPACE_ID); + ut_ad(!bpage->zip.data); + if (!bpage->is_freed()) { + goto func_exit; + } + bpage->clear_oldest_modification(); + break; + case 1: mysql_mutex_lock(&buf_pool.flush_list_mutex); - oldest_modification = bpage->oldest_modification(); - if (oldest_modification) { - ut_ad(oldest_modification == 1); + if (const lsn_t om = bpage->oldest_modification()) { + ut_ad(om == 1); buf_pool.delete_from_flush_list(bpage); } mysql_mutex_unlock(&buf_pool.flush_list_mutex); ut_ad(!bpage->oldest_modification()); - oldest_modification = 0; - } - - if (zip || !bpage->zip.data) { - /* This would completely free the block. */ - /* Do not completely free dirty blocks. */ - - if (oldest_modification) { - goto func_exit; + /* fall through */ + case 0: + if (zip || !bpage->zip.data || !bpage->frame) { + break; } - } else if (oldest_modification && !bpage->frame) { -func_exit: - hash_lock.unlock(); - return(false); - - } else if (bpage->frame) { +relocate_compressed: b = static_cast(ut_zalloc_nokey(sizeof *b)); ut_a(b); mysql_mutex_lock(&buf_pool.flush_list_mutex); new (b) buf_page_t(*bpage); b->frame = nullptr; b->set_state(buf_page_t::UNFIXED + 1); + break; + default: + if (zip || !bpage->zip.data || !bpage->frame) { + /* This would completely free the block. */ + /* Do not completely free dirty blocks. */ +func_exit: + hash_lock.unlock(); + return(false); + } + goto relocate_compressed; } mysql_mutex_assert_owner(&buf_pool.mutex); - DBUG_PRINT("ib_buf", ("free page %u:%u", - id.space(), id.page_no())); + DBUG_PRINT("ib_buf", ("free page %u:%u", id.space(), id.page_no())); ut_ad(bpage->can_relocate()); @@ -954,7 +975,7 @@ bool buf_LRU_free_page(buf_page_t *bpage, bool zip) order to avoid bogus Valgrind or MSAN warnings.*/ MEM_MAKE_DEFINED(block->page.frame, srv_page_size); - btr_search_drop_page_hash_index(block); + btr_search_drop_page_hash_index(block, false); MEM_UNDEFINED(block->page.frame, srv_page_size); mysql_mutex_lock(&buf_pool.mutex); } @@ -1010,7 +1031,7 @@ buf_LRU_block_free_non_file_page( page_zip_set_size(&block->page.zip, 0); } - if (buf_pool.curr_size < buf_pool.old_size + if (buf_pool.is_shrinking() && UT_LIST_GET_LEN(buf_pool.withdraw) < buf_pool.withdraw_target && buf_pool.will_be_withdrawn(block->page)) { /* This should be withdrawn */ @@ -1021,7 +1042,8 @@ buf_LRU_block_free_non_file_page( } else { UT_LIST_ADD_FIRST(buf_pool.free, &block->page); ut_d(block->page.in_free_list = true); - pthread_cond_signal(&buf_pool.done_free); + buf_pool.try_LRU_scan= true; + pthread_cond_broadcast(&buf_pool.done_free); } MEM_NOACCESS(block->page.frame, srv_page_size); @@ -1090,17 +1112,8 @@ static bool buf_LRU_block_remove_hashed(buf_page_t *bpage, const page_id_t id, break; case FIL_PAGE_TYPE_ZBLOB: case FIL_PAGE_TYPE_ZBLOB2: - break; case FIL_PAGE_INDEX: case FIL_PAGE_RTREE: -#if defined UNIV_ZIP_DEBUG && defined BTR_CUR_HASH_ADAPT - /* During recovery, we only update the - compressed page, not the uncompressed one. */ - ut_a(recv_recovery_is_on() - || page_zip_validate( - &bpage->zip, page, - ((buf_block_t*) bpage)->index)); -#endif /* UNIV_ZIP_DEBUG && BTR_CUR_HASH_ADAPT */ break; default: ib::error() << "The compressed page to be" @@ -1202,8 +1215,10 @@ static bool buf_LRU_block_remove_hashed(buf_page_t *bpage, const page_id_t id, } /** Release and evict a corrupted page. -@param bpage page that was being read */ -ATTRIBUTE_COLD void buf_pool_t::corrupted_evict(buf_page_t *bpage) +@param bpage x-latched page that was found corrupted +@param state expected current state of the page */ +ATTRIBUTE_COLD +void buf_pool_t::corrupted_evict(buf_page_t *bpage, uint32_t state) { const page_id_t id{bpage->id()}; buf_pool_t::hash_chain &chain= buf_pool.page_hash.cell_get(id.fold()); @@ -1214,14 +1229,14 @@ ATTRIBUTE_COLD void buf_pool_t::corrupted_evict(buf_page_t *bpage) ut_ad(!bpage->oldest_modification()); bpage->set_corrupt_id(); - constexpr auto read_unfix= buf_page_t::READ_FIX - buf_page_t::UNFIXED; - auto s= bpage->zip.fix.fetch_sub(read_unfix) - read_unfix; + auto unfix= state - buf_page_t::FREED; + auto s= bpage->zip.fix.fetch_sub(unfix) - unfix; bpage->lock.x_unlock(true); - while (s != buf_page_t::UNFIXED) + while (s != buf_page_t::FREED || bpage->lock.is_locked_or_waiting()) { - ut_ad(s > buf_page_t::UNFIXED); - ut_ad(s < buf_page_t::READ_FIX); + ut_ad(s >= buf_page_t::FREED); + ut_ad(s < buf_page_t::UNFIXED); /* Wait for other threads to release the fix count before releasing the bpage from LRU list. */ (void) LF_BACKOFF(); @@ -1234,8 +1249,7 @@ ATTRIBUTE_COLD void buf_pool_t::corrupted_evict(buf_page_t *bpage) mysql_mutex_unlock(&mutex); - ut_d(auto n=) n_pend_reads--; - ut_ad(n > 0); + recv_sys.free_corrupted_page(id); } /** Update buf_pool.LRU_old_ratio. diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index 2dc779e81d0f2..39ecd5de27f60 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2021, MariaDB Corporation. +Copyright (c) 2015, 2022, 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 @@ -41,6 +41,7 @@ Created 11/5/1995 Heikki Tuuri #include "os0file.h" #include "srv0start.h" #include "srv0srv.h" +#include "log.h" /** If there are buf_pool.curr_size per the number below pending reads, then read-ahead is not done: this is to prevent flooding the buffer pool with @@ -50,19 +51,30 @@ i/o-fixed buffer blocks */ /** Remove the sentinel block for the watch before replacing it with a real block. watch_unset() or watch_occurred() will notice that the block has been replaced with the real block. -@param watch sentinel -@param chain locked hash table chain */ -inline void buf_pool_t::watch_remove(buf_page_t *watch, - buf_pool_t::hash_chain &chain) +@param w sentinel +@param chain locked hash table chain +@return w->state() */ +inline uint32_t buf_pool_t::watch_remove(buf_page_t *w, + buf_pool_t::hash_chain &chain) { mysql_mutex_assert_owner(&buf_pool.mutex); - ut_ad(page_hash.lock_get(chain).is_write_locked()); - ut_a(watch_is_sentinel(*watch)); - if (watch->buf_fix_count()) - page_hash.remove(chain, watch); - ut_ad(!watch->in_page_hash); - watch->set_state(buf_page_t::NOT_USED); - watch->id_= page_id_t(~0ULL); + ut_ad(xtest() || page_hash.lock_get(chain).is_write_locked()); + ut_ad(w >= &watch[0]); + ut_ad(w < &watch[array_elements(watch)]); + ut_ad(!w->in_zip_hash); + ut_ad(!w->zip.data); + + uint32_t s{w->state()}; + w->set_state(buf_page_t::NOT_USED); + ut_ad(s >= buf_page_t::UNFIXED); + ut_ad(s < buf_page_t::READ_FIX); + + if (~buf_page_t::LRU_MASK & s) + page_hash.remove(chain, w); + + ut_ad(!w->in_page_hash); + w->id_= page_id_t(~0ULL); + return s; } /** Initialize a page for read to the buffer buf_pool. If the page is @@ -139,14 +151,8 @@ static buf_page_t* buf_page_init_for_read(ulint mode, const page_id_t page_id, {buf_pool.page_hash.lock_get(chain)}; if (hash_page) - { - /* Preserve the reference count. */ - uint32_t buf_fix_count= hash_page->state(); - ut_a(buf_fix_count >= buf_page_t::UNFIXED); - ut_a(buf_fix_count < buf_page_t::READ_FIX); - buf_pool.watch_remove(hash_page, chain); - block->page.fix(buf_fix_count - buf_page_t::UNFIXED); - } + bpage->set_state(buf_pool.watch_remove(hash_page, chain) + + (buf_page_t::READ_FIX - buf_page_t::UNFIXED)); buf_pool.page_hash.append(chain, &block->page); } @@ -209,16 +215,8 @@ static buf_page_t* buf_page_init_for_read(ulint mode, const page_id_t page_id, {buf_pool.page_hash.lock_get(chain)}; if (hash_page) - { - /* Preserve the reference count. It can be 0 if - buf_pool_t::watch_unset() is executing concurrently, - waiting for buf_pool.mutex, which we are holding. */ - uint32_t buf_fix_count= hash_page->state(); - ut_a(buf_fix_count >= buf_page_t::UNFIXED); - ut_a(buf_fix_count < buf_page_t::READ_FIX); - bpage->fix(buf_fix_count - buf_page_t::UNFIXED); - buf_pool.watch_remove(hash_page, chain); - } + bpage->set_state(buf_pool.watch_remove(hash_page, chain) + + (buf_page_t::READ_FIX - buf_page_t::UNFIXED)); buf_pool.page_hash.append(chain, bpage); } @@ -228,12 +226,10 @@ static buf_page_t* buf_page_init_for_read(ulint mode, const page_id_t page_id, buf_LRU_add_block(bpage, true/* to old blocks */); } - mysql_mutex_unlock(&buf_pool.mutex); - buf_pool.n_pend_reads++; - goto func_exit_no_mutex; + buf_pool.stat.n_pages_read++; func_exit: mysql_mutex_unlock(&buf_pool.mutex); -func_exit_no_mutex: + if (mode == BUF_READ_IBUF_PAGES_ONLY) ibuf_mtr_commit(&mtr); @@ -247,20 +243,18 @@ buffer buf_pool if it is not already there, in which case does nothing. Sets the io_fix flag and sets an exclusive lock on the buffer frame. The flag is cleared and the x-lock released by an i/o-handler thread. -@param[out] err DB_SUCCESS or DB_TABLESPACE_DELETED - if we are trying - to read from a non-existent tablespace @param[in,out] space tablespace @param[in] sync true if synchronous aio is desired @param[in] mode BUF_READ_IBUF_PAGES_ONLY, ..., @param[in] page_id page id @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param[in] unzip true=request uncompressed page -@return whether a read request was queued */ +@return error code +@retval DB_SUCCESS if the page was read +@retval DB_SUCCESS_LOCKED_REC if the page exists in the buffer pool already */ static -bool +dberr_t buf_read_page_low( - dberr_t* err, fil_space_t* space, bool sync, ulint mode, @@ -270,15 +264,12 @@ buf_read_page_low( { buf_page_t* bpage; - *err = DB_SUCCESS; - if (buf_dblwr.is_inside(page_id)) { ib::error() << "Trying to read doublewrite buffer page " << page_id; ut_ad(0); -nothing_read: space->release(); - return false; + return DB_PAGE_CORRUPTED; } if (sync) { @@ -290,7 +281,7 @@ buf_read_page_low( /* Trx sys header is so low in the latching order that we play safe and do not leave the i/o-completion to an asynchronous i/o-thread. Change buffer pages must always be read with - syncronous i/o, to make sure they do not get involved in + synchronous i/o, to make sure they do not get involved in thread deadlocks. */ sync = true; } @@ -301,8 +292,9 @@ buf_read_page_low( completed */ bpage = buf_page_init_for_read(mode, page_id, zip_size, unzip); - if (bpage == NULL) { - goto nothing_read; + if (!bpage) { + space->release(); + return DB_SUCCESS_LOCKED_REC; } ut_ad(bpage->in_file()); @@ -322,31 +314,20 @@ buf_read_page_low( ? IORequest::READ_SYNC : IORequest::READ_ASYNC), page_id.page_no() * len, len, dst, bpage); - *err= fio.err; if (UNIV_UNLIKELY(fio.err != DB_SUCCESS)) { - if (!sync || fio.err == DB_TABLESPACE_DELETED - || fio.err == DB_IO_ERROR) { - buf_pool.corrupted_evict(bpage); - return false; - } - - ut_error; - } - - if (sync) { + buf_pool.corrupted_evict(bpage, buf_page_t::READ_FIX); + } else if (sync) { thd_wait_end(NULL); - /* The i/o was already completed in space->io() */ - *err = bpage->read_complete(*fio.node); + fio.err = bpage->read_complete(*fio.node); space->release(); - - if (*err != DB_SUCCESS) { - return false; + if (fio.err == DB_FAIL) { + fio.err = DB_PAGE_CORRUPTED; } } - return true; + return fio.err; } /** Applies a random read-ahead in buf_pool if there are at least a threshold @@ -381,7 +362,8 @@ buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf) read-ahead, as that could break the ibuf page access order */ return 0; - if (buf_pool.n_pend_reads > buf_pool.curr_size / BUF_READ_AHEAD_PEND_LIMIT) + if (os_aio_pending_reads_approx() > + buf_pool.curr_size / BUF_READ_AHEAD_PEND_LIMIT) return 0; fil_space_t* space= fil_space_t::get(page_id.space()); @@ -424,24 +406,26 @@ buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf) continue; if (space->is_stopping()) break; - dberr_t err; space->reacquire(); - if (buf_read_page_low(&err, space, false, ibuf_mode, i, zip_size, false)) + if (buf_read_page_low(space, false, ibuf_mode, i, zip_size, false) == + DB_SUCCESS) count++; } if (count) + { DBUG_PRINT("ib_buf", ("random read-ahead %zu pages from %s: %u", count, space->chain.start->name, low.page_no())); - space->release(); - - /* Read ahead is considered one I/O operation for the purpose of - LRU policy decision. */ - buf_LRU_stat_inc_io(); + mysql_mutex_lock(&buf_pool.mutex); + /* Read ahead is considered one I/O operation for the purpose of + LRU policy decision. */ + buf_LRU_stat_inc_io(); + buf_pool.stat.n_ra_pages_read_rnd+= count; + mysql_mutex_unlock(&buf_pool.mutex); + } - buf_pool.stat.n_ra_pages_read_rnd+= count; - srv_stats.buf_pool_reads.add(count); + space->release(); return count; } @@ -451,8 +435,9 @@ on the buffer frame. The flag is cleared and the x-lock released by the i/o-handler thread. @param[in] page_id page id @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@retval DB_SUCCESS if the page was read and is not corrupted, -@retval DB_PAGE_CORRUPTED if page based on checksum check is corrupted, +@retval DB_SUCCESS if the page was read and is not corrupted +@retval DB_SUCCESS_LOCKED_REC if the page was not read +@retval DB_PAGE_CORRUPTED if page based on checksum check is corrupted @retval DB_DECRYPTION_FAILED if page post encryption checksum matches but after decryption normal page checksum does not match. @retval DB_TABLESPACE_DELETED if tablespace .ibd file is missing */ @@ -466,13 +451,9 @@ dberr_t buf_read_page(const page_id_t page_id, ulint zip_size) return DB_TABLESPACE_DELETED; } - dberr_t err; - if (buf_read_page_low(&err, space, true, BUF_READ_ANY_PAGE, - page_id, zip_size, false)) - srv_stats.buf_pool_reads.add(1); - - buf_LRU_stat_inc_io(); - return err; + buf_LRU_stat_inc_io(); /* NOT protected by buf_pool.mutex */ + return buf_read_page_low(space, true, BUF_READ_ANY_PAGE, + page_id, zip_size, false); } /** High-level function which reads a page asynchronously from a file to the @@ -485,32 +466,8 @@ released by the i/o-handler thread. void buf_read_page_background(fil_space_t *space, const page_id_t page_id, ulint zip_size) { - dberr_t err; - - if (buf_read_page_low(&err, space, false, BUF_READ_ANY_PAGE, - page_id, zip_size, false)) { - srv_stats.buf_pool_reads.add(1); - } - - switch (err) { - case DB_SUCCESS: - case DB_ERROR: - break; - case DB_TABLESPACE_DELETED: - ib::info() << "trying to read page " << page_id - << " in the background" - " in a non-existing or being-dropped tablespace"; - break; - case DB_PAGE_CORRUPTED: - case DB_DECRYPTION_FAILED: - ib::error() - << "Background Page read failed to " - "read, uncompress, or decrypt " << page_id; - break; - default: - ib::fatal() << "Error " << err << " in background read of " - << page_id; - } + buf_read_page_low(space, false, BUF_READ_ANY_PAGE, + page_id, zip_size, false); /* We do not increment number of I/O operations used for LRU policy here (buf_LRU_stat_inc_io()). We use this in heuristics to decide @@ -558,7 +515,8 @@ buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf) /* No read-ahead to avoid thread deadlocks */ return 0; - if (buf_pool.n_pend_reads > buf_pool.curr_size / BUF_READ_AHEAD_PEND_LIMIT) + if (os_aio_pending_reads_approx() > + buf_pool.curr_size / BUF_READ_AHEAD_PEND_LIMIT) return 0; const uint32_t buf_read_ahead_area= buf_pool.read_ahead_area; @@ -668,26 +626,36 @@ buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf) continue; if (space->is_stopping()) break; - dberr_t err; space->reacquire(); - count+= buf_read_page_low(&err, space, false, ibuf_mode, new_low, zip_size, - false); + if (buf_read_page_low(space, false, ibuf_mode, new_low, zip_size, false) == + DB_SUCCESS) + count++; } if (count) + { DBUG_PRINT("ib_buf", ("random read-ahead %zu pages from %s: %u", count, space->chain.start->name, new_low.page_no())); - space->release(); - - /* Read ahead is considered one I/O operation for the purpose of - LRU policy decision. */ - buf_LRU_stat_inc_io(); + mysql_mutex_lock(&buf_pool.mutex); + /* Read ahead is considered one I/O operation for the purpose of + LRU policy decision. */ + buf_LRU_stat_inc_io(); + buf_pool.stat.n_ra_pages_read+= count; + mysql_mutex_unlock(&buf_pool.mutex); + } - buf_pool.stat.n_ra_pages_read+= count; + space->release(); return count; } +/** @return whether a page has been freed */ +inline bool fil_space_t::is_freed(uint32_t page) +{ + std::lock_guard freed_lock(freed_range_mutex); + return freed_ranges.contains(page); +} + /** Issues read requests for pages which recovery wants to read in. @param space_id tablespace identifier @param page_nos page numbers to read, in ascending order */ @@ -705,7 +673,7 @@ void buf_read_recv_pages(uint32_t space_id, st_::span page_nos) for (ulint i = 0; i < page_nos.size(); i++) { /* Ignore if the page already present in freed ranges. */ - if (space->freed_ranges.contains(page_nos[i])) { + if (space->is_freed(page_nos[i])) { continue; } @@ -716,29 +684,20 @@ void buf_read_recv_pages(uint32_t space_id, st_::span page_nos) limit += buf_pool.chunks[j].size / 2; } - for (ulint count = 0; buf_pool.n_pend_reads >= limit; ) { - std::this_thread::sleep_for( - std::chrono::milliseconds(10)); - - if (!(++count % 1000)) { - - ib::error() - << "Waited for " << count / 100 - << " seconds for " - << buf_pool.n_pend_reads - << " pending reads"; - } + if (os_aio_pending_reads() >= limit) { + os_aio_wait_until_no_pending_reads(false); } - dberr_t err; space->reacquire(); - buf_read_page_low(&err, space, false, - BUF_READ_ANY_PAGE, cur_page_id, zip_size, - true); - - if (err == DB_DECRYPTION_FAILED || err == DB_PAGE_CORRUPTED) { - ib::error() << "Recovery failed to read or decrypt " - << cur_page_id; + switch (buf_read_page_low(space, false, BUF_READ_ANY_PAGE, + cur_page_id, zip_size, true)) { + case DB_SUCCESS: case DB_SUCCESS_LOCKED_REC: + break; + default: + sql_print_error("InnoDB: Recovery failed to read page " + UINT32PF " from %s", + cur_page_id.page_no(), + space->chain.start->name); } } diff --git a/storage/innobase/data/data0data.cc b/storage/innobase/data/data0data.cc index 13efd7f366523..9a7eff2142f8a 100644 --- a/storage/innobase/data/data0data.cc +++ b/storage/innobase/data/data0data.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -79,40 +79,6 @@ void dtuple_t::trim(const dict_index_t& index) n_fields = i; } -/** Compare two data tuples. -@param[in] tuple1 first data tuple -@param[in] tuple2 second data tuple -@return positive, 0, negative if tuple1 is greater, equal, less, than tuple2, -respectively */ -int -dtuple_coll_cmp( - const dtuple_t* tuple1, - const dtuple_t* tuple2) -{ - ulint n_fields; - ulint i; - int cmp; - - ut_ad(tuple1 != NULL); - ut_ad(tuple2 != NULL); - ut_ad(tuple1->magic_n == DATA_TUPLE_MAGIC_N); - ut_ad(tuple2->magic_n == DATA_TUPLE_MAGIC_N); - ut_ad(dtuple_check_typed(tuple1)); - ut_ad(dtuple_check_typed(tuple2)); - - n_fields = dtuple_get_n_fields(tuple1); - - cmp = (int) n_fields - (int) dtuple_get_n_fields(tuple2); - - for (i = 0; cmp == 0 && i < n_fields; i++) { - const dfield_t* field1 = dtuple_get_nth_field(tuple1, i); - const dfield_t* field2 = dtuple_get_nth_field(tuple2, i); - cmp = cmp_dfield_dfield(field1, field2); - } - - return(cmp); -} - /*********************************************************************//** Sets number of fields used in a tuple. Normally this is set in dtuple_create, but if you want later to set it smaller, you can use this. */ @@ -581,7 +547,6 @@ dtuple_convert_big_rec( big_rec_t* vector; dfield_t* dfield; ulint size; - ulint n_fields; ulint local_prefix_len; if (!dict_index_is_clust(index)) { @@ -617,7 +582,7 @@ dtuple_convert_big_rec( a variable-length field that yields the biggest savings when stored externally */ - n_fields = 0; + ut_d(ulint n_fields = 0); uint16_t longest_i; ulint longest; @@ -733,9 +698,8 @@ dtuple_convert_big_rec( dfield_set_data(dfield, data, local_len); dfield_set_ext(dfield); - n_fields++; (*n_ext)++; - ut_ad(n_fields < dtuple_get_n_fields(entry)); + ut_ad(++n_fields < dtuple_get_n_fields(entry)); if (upd && !upd->is_modified(longest_i)) { diff --git a/storage/innobase/dict/dict0boot.cc b/storage/innobase/dict/dict0boot.cc index 9e5031da43061..5516bce920bca 100644 --- a/storage/innobase/dict/dict0boot.cc +++ b/storage/innobase/dict/dict0boot.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2021, MariaDB Corporation. +Copyright (c) 2016, 2022, 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 @@ -35,6 +35,16 @@ Created 4/18/1996 Heikki Tuuri #include "log0recv.h" #include "os0file.h" +/** The DICT_HDR page identifier */ +static constexpr page_id_t hdr_page_id{DICT_HDR_SPACE, DICT_HDR_PAGE_NO}; + +/** @return the DICT_HDR block, x-latched */ +static buf_block_t *dict_hdr_get(mtr_t *mtr) +{ + /* We assume that the DICT_HDR page is always readable and available. */ + return buf_page_get_gen(hdr_page_id, 0, RW_X_LATCH, nullptr, BUF_GET, mtr); +} + /**********************************************************************//** Returns a new table, index, or space id. */ void @@ -97,25 +107,25 @@ void dict_hdr_flush_row_id(row_id_t id) } /** Create the DICT_HDR page on database initialization. -@return whether the operation failed */ -static bool dict_hdr_create() +@return error code */ +dberr_t dict_create() { - buf_block_t* block; ulint root_page_no; - bool fail = false; + dberr_t err; mtr_t mtr; mtr.start(); compile_time_assert(DICT_HDR_SPACE == 0); /* Create the dictionary header file block in a new, allocated file segment in the system tablespace */ - block = fseg_create(fil_system.sys_space, - DICT_HDR + DICT_HDR_FSEG_HEADER, &mtr); - - ut_a(block->page.id() == page_id_t(DICT_HDR_SPACE, DICT_HDR_PAGE_NO)); - - buf_block_t* d = dict_hdr_get(&mtr); + buf_block_t* d = fseg_create(fil_system.sys_space, + DICT_HDR + DICT_HDR_FSEG_HEADER, &mtr, + &err); + if (!d) { + goto func_exit; + } + ut_a(d->page.id() == hdr_page_id); /* Start counting row, table, index, and tree ids from DICT_HDR_FIRST_ID */ @@ -139,10 +149,8 @@ static bool dict_hdr_create() /*--------------------------*/ root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE, fil_system.sys_space, DICT_TABLES_ID, - nullptr, &mtr); + nullptr, &mtr, &err); if (root_page_no == FIL_NULL) { -failed: - fail = true; goto func_exit; } @@ -151,9 +159,9 @@ static bool dict_hdr_create() /*--------------------------*/ root_page_no = btr_create(DICT_UNIQUE, fil_system.sys_space, DICT_TABLE_IDS_ID, - nullptr, &mtr); + nullptr, &mtr, &err); if (root_page_no == FIL_NULL) { - goto failed; + goto func_exit; } mtr.write<4>(*d, DICT_HDR + DICT_HDR_TABLE_IDS + d->page.frame, @@ -161,9 +169,9 @@ static bool dict_hdr_create() /*--------------------------*/ root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE, fil_system.sys_space, DICT_COLUMNS_ID, - nullptr, &mtr); + nullptr, &mtr, &err); if (root_page_no == FIL_NULL) { - goto failed; + goto func_exit; } mtr.write<4>(*d, DICT_HDR + DICT_HDR_COLUMNS + d->page.frame, @@ -171,9 +179,9 @@ static bool dict_hdr_create() /*--------------------------*/ root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE, fil_system.sys_space, DICT_INDEXES_ID, - nullptr, &mtr); + nullptr, &mtr, &err); if (root_page_no == FIL_NULL) { - goto failed; + goto func_exit; } mtr.write<4>(*d, DICT_HDR + DICT_HDR_INDEXES + d->page.frame, @@ -181,25 +189,23 @@ static bool dict_hdr_create() /*--------------------------*/ root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE, fil_system.sys_space, DICT_FIELDS_ID, - nullptr, &mtr); + nullptr, &mtr, &err); if (root_page_no == FIL_NULL) { - goto failed; + goto func_exit; } mtr.write<4>(*d, DICT_HDR + DICT_HDR_FIELDS + d->page.frame, root_page_no); func_exit: mtr.commit(); - return fail; + return err ? err : dict_boot(); } /*****************************************************************//** Initializes the data dictionary memory structures when the database is started. This function is also called when the data dictionary is created. @return DB_SUCCESS or error code. */ -dberr_t -dict_boot(void) -/*===========*/ +dberr_t dict_boot() { dict_table_t* table; dict_index_t* index; @@ -222,17 +228,23 @@ dict_boot(void) static_assert(DICT_NUM_COLS__SYS_FOREIGN_COLS == 4, "compatibility"); static_assert(DICT_NUM_FIELDS__SYS_FOREIGN_COLS == 6, "compatibility"); - mtr_start(&mtr); - + mtr.start(); /* Create the hash tables etc. */ dict_sys.create(); + dberr_t err; + const buf_block_t *d = buf_page_get_gen(hdr_page_id, 0, RW_X_LATCH, + nullptr, BUF_GET, &mtr, &err); + if (!d) { + mtr.commit(); + return err; + } + heap = mem_heap_create(450); dict_sys.lock(SRW_LOCK_CALL); - /* Get the dictionary header */ - const byte* dict_hdr = &dict_hdr_get(&mtr)->page.frame[DICT_HDR]; + const byte* dict_hdr = &d->page.frame[DICT_HDR]; /* Because we only write new row ids to disk-based data structure (dictionary header) when it is divisible by @@ -285,9 +297,9 @@ dict_boot(void) dict_mem_index_add_field(index, "NAME", 0); index->id = DICT_TABLES_ID; - dberr_t error = dict_index_add_to_cache( + err = dict_index_add_to_cache( index, mach_read_from_4(dict_hdr + DICT_HDR_TABLES)); - ut_a(error == DB_SUCCESS); + ut_a(err == DB_SUCCESS); ut_ad(!table->is_instant()); table->indexes.start->n_core_null_bytes = static_cast( UT_BITS_IN_BYTES(unsigned(table->indexes.start->n_nullable))); @@ -297,9 +309,9 @@ dict_boot(void) dict_mem_index_add_field(index, "ID", 0); index->id = DICT_TABLE_IDS_ID; - error = dict_index_add_to_cache( + err = dict_index_add_to_cache( index, mach_read_from_4(dict_hdr + DICT_HDR_TABLE_IDS)); - ut_a(error == DB_SUCCESS); + ut_a(err == DB_SUCCESS); /*-------------------------*/ table = dict_table_t::create(dict_sys.SYS_TABLE[dict_sys.SYS_COLUMNS], @@ -327,9 +339,9 @@ dict_boot(void) dict_mem_index_add_field(index, "POS", 0); index->id = DICT_COLUMNS_ID; - error = dict_index_add_to_cache( + err = dict_index_add_to_cache( index, mach_read_from_4(dict_hdr + DICT_HDR_COLUMNS)); - ut_a(error == DB_SUCCESS); + ut_a(err == DB_SUCCESS); ut_ad(!table->is_instant()); table->indexes.start->n_core_null_bytes = static_cast( UT_BITS_IN_BYTES(unsigned(table->indexes.start->n_nullable))); @@ -370,9 +382,9 @@ dict_boot(void) dict_mem_index_add_field(index, "ID", 0); index->id = DICT_INDEXES_ID; - error = dict_index_add_to_cache( + err = dict_index_add_to_cache( index, mach_read_from_4(dict_hdr + DICT_HDR_INDEXES)); - ut_a(error == DB_SUCCESS); + ut_a(err == DB_SUCCESS); ut_ad(!table->is_instant()); table->indexes.start->n_core_null_bytes = static_cast( UT_BITS_IN_BYTES(unsigned(table->indexes.start->n_nullable))); @@ -399,18 +411,19 @@ dict_boot(void) dict_mem_index_add_field(index, "POS", 0); index->id = DICT_FIELDS_ID; - error = dict_index_add_to_cache( + err = dict_index_add_to_cache( index, mach_read_from_4(dict_hdr + DICT_HDR_FIELDS)); - ut_a(error == DB_SUCCESS); + ut_a(err == DB_SUCCESS); ut_ad(!table->is_instant()); table->indexes.start->n_core_null_bytes = static_cast( UT_BITS_IN_BYTES(unsigned(table->indexes.start->n_nullable))); - mtr_commit(&mtr); + mtr.commit(); - dberr_t err = ibuf_init_at_db_start(); + err = ibuf_init_at_db_start(); - if (err == DB_SUCCESS) { + if (err == DB_SUCCESS || srv_force_recovery >= SRV_FORCE_NO_DDL_UNDO) { + err = DB_SUCCESS; /* Load definitions of other indexes on system tables */ dict_load_sys_table(dict_sys.sys_tables); @@ -423,13 +436,5 @@ dict_boot(void) dict_sys.unlock(); } - return(err); -} - -/*****************************************************************//** -Creates and initializes the data dictionary at the server bootstrap. -@return DB_SUCCESS or error code. */ -dberr_t dict_create() -{ - return dict_hdr_create() ? DB_ERROR : dict_boot(); + return err; } diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index f1bc2fcd9807f..cce5f2f24d02d 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2023, 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 @@ -536,15 +536,15 @@ dict_create_sys_fields_tuple( dict_field_t* field; dfield_t* dfield; byte* ptr; - ibool index_contains_column_prefix_field = FALSE; - ulint j; + bool wide_pos = false; ut_ad(index); ut_ad(heap); - for (j = 0; j < index->n_fields; j++) { - if (dict_index_get_nth_field(index, j)->prefix_len > 0) { - index_contains_column_prefix_field = TRUE; + for (unsigned j = 0; j < index->n_fields; j++) { + const dict_field_t* f = dict_index_get_nth_field(index, j); + if (f->prefix_len || f->descending) { + wide_pos = true; break; } } @@ -569,12 +569,15 @@ dict_create_sys_fields_tuple( ptr = static_cast(mem_heap_alloc(heap, 4)); - if (index_contains_column_prefix_field) { - /* If there are column prefix fields in the index, then - we store the number of the field to the 2 HIGH bytes - and the prefix length to the 2 low bytes, */ - - mach_write_to_4(ptr, (fld_no << 16) + field->prefix_len); + if (wide_pos) { + /* If there are column prefixes or columns with + descending order in the index, then we write the + field number to the 16 most significant bits, + the DESC flag to bit 15, and the prefix length + in the 15 least significant bits. */ + mach_write_to_4(ptr, (fld_no << 16) + | (!!field->descending) << 15 + | field->prefix_len); } else { /* Else we store the number of the field to the 2 LOW bytes. This is to keep the storage format compatible with @@ -722,7 +725,7 @@ dict_build_field_def_step( } /***************************************************************//** -Creates an index tree for the index if it is not a member of a cluster. +Creates an index tree for the index. @return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t @@ -751,51 +754,62 @@ dict_create_index_tree_step( mtr.start(); search_tuple = dict_create_search_tuple(node->ind_row, node->heap); + node->page_no = FIL_NULL; + pcur.btr_cur.page_cur.index = + UT_LIST_GET_FIRST(dict_sys.sys_indexes->indexes); - btr_pcur_open(UT_LIST_GET_FIRST(dict_sys.sys_indexes->indexes), - search_tuple, PAGE_CUR_L, BTR_MODIFY_LEAF, - &pcur, &mtr); + dberr_t err = btr_pcur_open(search_tuple, PAGE_CUR_L, BTR_MODIFY_LEAF, + &pcur, &mtr); + + if (err != DB_SUCCESS) { +func_exit: + mtr.commit(); + return err; + } btr_pcur_move_to_next_user_rec(&pcur, &mtr); + if (UNIV_UNLIKELY(btr_pcur_is_after_last_on_page(&pcur))) { +corrupted: + err = DB_CORRUPTION; + goto func_exit; + } + + ulint len; + byte* data = rec_get_nth_field_old(btr_pcur_get_rec(&pcur), + DICT_FLD__SYS_INDEXES__ID, + &len); + if (UNIV_UNLIKELY(len != 8 || mach_read_from_8(data) != index->id)) { + goto corrupted; + } - dberr_t err = DB_SUCCESS; + data = rec_get_nth_field_old(btr_pcur_get_rec(&pcur), + DICT_FLD__SYS_INDEXES__PAGE_NO, &len); + if (len != 4) { + goto corrupted; + } - if (!index->is_readable()) { - node->page_no = FIL_NULL; - } else { + if (index->is_readable()) { index->set_modified(mtr); node->page_no = btr_create( index->type, index->table->space, - index->id, index, &mtr); - - if (node->page_no == FIL_NULL) { - err = DB_OUT_OF_FILE_SPACE; - } + index->id, index, &mtr, &err); DBUG_EXECUTE_IF("ib_import_create_index_failure_1", node->page_no = FIL_NULL; err = DB_OUT_OF_FILE_SPACE; ); } - ulint len; - byte* data = rec_get_nth_field_old(btr_pcur_get_rec(&pcur), - DICT_FLD__SYS_INDEXES__PAGE_NO, - &len); - ut_ad(len == 4); mtr.write<4,mtr_t::MAYBE_NOP>(*btr_pcur_get_block(&pcur), data, node->page_no); - - mtr.commit(); - - return(err); + goto func_exit; } /***************************************************************//** Creates an index tree for the index if it is not a member of a cluster. Don't update SYSTEM TABLES. -@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ +@return error code */ dberr_t dict_create_index_tree_in_mem( /*==========================*/ @@ -815,13 +829,14 @@ dict_create_index_tree_in_mem( ut_ad(index->is_readable()); ut_ad(!(index->table->flags2 & DICT_TF2_DISCARDED)); + dberr_t err; index->page = btr_create(index->type, index->table->space, - index->id, index, &mtr); + index->id, index, &mtr, &err); mtr_commit(&mtr); index->trx_id = trx->id; - return index->page == FIL_NULL ? DB_OUT_OF_FILE_SPACE : DB_SUCCESS; + return err; } /** Drop the index tree associated with a row in SYS_INDEXES table. @@ -846,7 +861,7 @@ uint32_t dict_drop_index_tree(btr_pcur_t *pcur, trx_t *trx, mtr_t *mtr) len > DICT_NUM_FIELDS__SYS_INDEXES) { rec_corrupted: - ib::error() << "Corrupted SYS_INDEXES record"; + sql_print_error("InnoDB: Corrupted SYS_INDEXES record"); return 0; } @@ -1096,7 +1111,7 @@ dict_create_table_step( } if (node->state == TABLE_ADD_TO_CACHE) { - node->table->can_be_evicted = true; + node->table->can_be_evicted = !node->table->fts; node->table->add_to_cache(); err = DB_SUCCESS; @@ -1105,15 +1120,7 @@ dict_create_table_step( function_exit: trx->error_state = err; - if (err == DB_SUCCESS) { - /* Ok: do nothing */ - - } else if (err == DB_LOCK_WAIT) { - - return(NULL); - } else { - /* SQL error detected */ - + if (err != DB_SUCCESS) { return(NULL); } @@ -1297,16 +1304,8 @@ dict_create_index_step( function_exit: trx->error_state = err; - if (err == DB_SUCCESS) { - /* Ok: do nothing */ - - } else if (err == DB_LOCK_WAIT) { - - return(NULL); - } else { - /* SQL error detected */ - - return(NULL); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + return nullptr; } thr->run_node = que_node_get_parent(node); @@ -1328,7 +1327,7 @@ bool dict_sys_t::load_sys_tables() { sys_foreign= nullptr; mismatch= true; - ib::error() << "Invalid definition of SYS_FOREIGN"; + sql_print_error("InnoDB: Invalid definition of SYS_FOREIGN"); } if (!(sys_foreign_cols= load_table(SYS_TABLE[SYS_FOREIGN_COLS], DICT_ERR_IGNORE_FK_NOKEY))); @@ -1340,7 +1339,7 @@ bool dict_sys_t::load_sys_tables() { sys_foreign_cols= nullptr; mismatch= true; - ib::error() << "Invalid definition of SYS_FOREIGN_COLS"; + sql_print_error("InnoDB: Invalid definition of SYS_FOREIGN_COLS"); } if (!(sys_virtual= load_table(SYS_TABLE[SYS_VIRTUAL], DICT_ERR_IGNORE_FK_NOKEY))); @@ -1351,7 +1350,7 @@ bool dict_sys_t::load_sys_tables() { sys_virtual= nullptr; mismatch= true; - ib::error() << "Invalid definition of SYS_VIRTUAL"; + sql_print_error("InnoDB: Invalid definition of SYS_VIRTUAL"); } unlock(); return mismatch; @@ -1367,8 +1366,8 @@ dberr_t dict_sys_t::create_or_check_sys_tables() if (load_sys_tables()) { - ib::info() << "Set innodb_read_only=1 or innodb_force_recovery=3" - " to start up"; + sql_print_information("InnoDB: Set innodb_read_only=1 " + "or innodb_force_recovery=3 to start up"); return DB_CORRUPTION; } @@ -1400,7 +1399,7 @@ dberr_t dict_sys_t::create_or_check_sys_tables() const auto srv_file_per_table_backup= srv_file_per_table; srv_file_per_table= 0; dberr_t error; - const char *tablename; + span tablename; if (!sys_foreign) { @@ -1418,9 +1417,11 @@ dberr_t dict_sys_t::create_or_check_sys_tables() "END;\n", trx); if (UNIV_UNLIKELY(error != DB_SUCCESS)) { - tablename= SYS_TABLE[SYS_FOREIGN].data(); + tablename= SYS_TABLE[SYS_FOREIGN]; err_exit: - ib::error() << "Creation of " << tablename << " failed: " << error; + sql_print_error("InnoDB: Creation of %.*s failed: %s", + int(tablename.size()), tablename.data(), + ut_strerr(error)); trx->rollback(); row_mysql_unlock_data_dictionary(trx); trx->free(); @@ -1440,7 +1441,7 @@ dberr_t dict_sys_t::create_or_check_sys_tables() "END;\n", trx); if (UNIV_UNLIKELY(error != DB_SUCCESS)) { - tablename= SYS_TABLE[SYS_FOREIGN_COLS].data(); + tablename= SYS_TABLE[SYS_FOREIGN_COLS]; goto err_exit; } } @@ -1455,7 +1456,7 @@ dberr_t dict_sys_t::create_or_check_sys_tables() "END;\n", trx); if (UNIV_UNLIKELY(error != DB_SUCCESS)) { - tablename= SYS_TABLE[SYS_VIRTUAL].data(); + tablename= SYS_TABLE[SYS_VIRTUAL]; goto err_exit; } } @@ -1469,10 +1470,11 @@ dberr_t dict_sys_t::create_or_check_sys_tables() if (sys_foreign); else if (!(sys_foreign= load_table(SYS_TABLE[SYS_FOREIGN]))) { - tablename= SYS_TABLE[SYS_FOREIGN].data(); + tablename= SYS_TABLE[SYS_FOREIGN]; load_fail: unlock(); - ib::error() << "Failed to CREATE TABLE " << tablename; + sql_print_error("InnoDB: Failed to CREATE TABLE %.*s", + int(tablename.size()), tablename.data()); return DB_TABLE_NOT_FOUND; } else @@ -1481,7 +1483,7 @@ dberr_t dict_sys_t::create_or_check_sys_tables() if (sys_foreign_cols); else if (!(sys_foreign_cols= load_table(SYS_TABLE[SYS_FOREIGN_COLS]))) { - tablename= SYS_TABLE[SYS_FOREIGN_COLS].data(); + tablename= SYS_TABLE[SYS_FOREIGN_COLS]; goto load_fail; } else @@ -1490,7 +1492,7 @@ dberr_t dict_sys_t::create_or_check_sys_tables() if (sys_virtual); else if (!(sys_virtual= load_table(SYS_TABLE[SYS_VIRTUAL]))) { - tablename= SYS_TABLE[SYS_VIRTUAL].data(); + tablename= SYS_TABLE[SYS_VIRTUAL]; goto load_fail; } else @@ -1513,12 +1515,14 @@ dict_foreign_eval_sql( const char* id, /*!< in: foreign key id */ trx_t* trx) /*!< in/out: transaction */ { - dberr_t error; FILE* ef = dict_foreign_err_file; - error = que_eval_sql(info, sql, trx); + dberr_t error = que_eval_sql(info, sql, trx); - if (error == DB_DUPLICATE_KEY) { + switch (error) { + case DB_SUCCESS: + break; + case DB_DUPLICATE_KEY: mysql_mutex_lock(&dict_foreign_err_mutex); rewind(ef); ut_print_timestamp(ef); @@ -1538,15 +1542,11 @@ dict_foreign_eval_sql( "names can occur. Workaround: name your constraints\n" "explicitly with unique names.\n", ef); - - mysql_mutex_unlock(&dict_foreign_err_mutex); - - return(error); - } - - if (UNIV_UNLIKELY(error != DB_SUCCESS)) { - ib::error() << "Foreign key constraint creation failed: " - << error; + goto release; + default: + sql_print_error("InnoDB: " + "Foreign key constraint creation failed: %s", + ut_strerr(error)); mysql_mutex_lock(&dict_foreign_err_mutex); ut_print_timestamp(ef); @@ -1556,12 +1556,11 @@ dict_foreign_eval_sql( fputs(".\n" "See the MariaDB .err log in the datadir" " for more information.\n", ef); +release: mysql_mutex_unlock(&dict_foreign_err_mutex); - - return(error); } - return(DB_SUCCESS); + return error; } /********************************************************************//** diff --git a/storage/innobase/dict/dict0defrag_bg.cc b/storage/innobase/dict/dict0defrag_bg.cc index 043ea24ccbf93..bec6da8e6af67 100644 --- a/storage/innobase/dict/dict0defrag_bg.cc +++ b/storage/innobase/dict/dict0defrag_bg.cc @@ -194,7 +194,7 @@ static void dict_stats_process_entry_from_defrag_pool(THD *thd) { if (dict_index_t *index= !table->corrupted ? dict_table_find_index_on_id(table, index_id) : nullptr) - if (!index->is_corrupted()) + if (index->is_btree()) dict_stats_save_defrag_stats(index); dict_table_close(table, false, thd, mdl); } @@ -297,7 +297,7 @@ btr_get_size_and_reserved( { ulint dummy; - ut_ad(mtr->memo_contains(index->lock, MTR_MEMO_S_LOCK)); + ut_ad(mtr->memo_contains(index->lock, MTR_MEMO_SX_LOCK)); ut_a(flag == BTR_N_LEAF_PAGES || flag == BTR_TOTAL_SIZE); if (index->page == FIL_NULL @@ -307,7 +307,8 @@ btr_get_size_and_reserved( return(ULINT_UNDEFINED); } - buf_block_t* root = btr_root_block_get(index, RW_SX_LATCH, mtr); + dberr_t err; + buf_block_t* root = btr_root_block_get(index, RW_SX_LATCH, mtr, &err); *used = 0; if (!root) { return ULINT_UNDEFINED; @@ -344,7 +345,7 @@ dict_stats_save_defrag_stats( mtr_t mtr; ulint n_leaf_pages; mtr.start(); - mtr_s_lock_index(index, &mtr); + mtr_sx_lock_index(index, &mtr); ulint n_leaf_reserved= btr_get_size_and_reserved(index, BTR_N_LEAF_PAGES, &n_leaf_pages, &mtr); mtr.commit(); diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index a990a518d5b9a..32aba4bad850b 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -2,7 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2023, 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 @@ -68,6 +68,7 @@ Created 1/8/1996 Heikki Tuuri #include "srv0mon.h" #include "srv0start.h" #include "trx0undo.h" +#include "trx0purge.h" #include #include @@ -601,13 +602,13 @@ dict_index_get_nth_field_pos( } /** Parse the table file name into table name and database name. -@tparam dict_locked whether dict_sys.lock() was called -@param[in,out] db_name database name buffer -@param[in,out] tbl_name table name buffer -@param[out] db_name_len database name length -@param[out] tbl_name_len table name length +@tparam dict_frozen whether the caller holds dict_sys.latch +@param[in,out] db_name database name buffer +@param[in,out] tbl_name table name buffer +@param[out] db_name_len database name length +@param[out] tbl_name_len table name length @return whether the table name is visible to SQL */ -template +template bool dict_table_t::parse_name(char (&db_name)[NAME_LEN + 1], char (&tbl_name)[NAME_LEN + 1], size_t *db_name_len, size_t *tbl_name_len) const @@ -615,7 +616,7 @@ bool dict_table_t::parse_name(char (&db_name)[NAME_LEN + 1], char db_buf[MAX_DATABASE_NAME_LEN + 1]; char tbl_buf[MAX_TABLE_NAME_LEN + 1]; - if (!dict_locked) + if (!dict_frozen) dict_sys.freeze(SRW_LOCK_CALL); /* protect against renaming */ ut_ad(dict_sys.frozen()); const size_t db_len= name.dblen(); @@ -635,7 +636,7 @@ bool dict_table_t::parse_name(char (&db_name)[NAME_LEN + 1], memcpy(tbl_buf, mdl_name.m_name + db_len + 1, tbl_len); tbl_buf[tbl_len]= 0; - if (!dict_locked) + if (!dict_frozen) dict_sys.unfreeze(); *db_name_len= filename_to_tablename(db_buf, db_name, @@ -661,7 +662,7 @@ dict_table_t::parse_name<>(char(&)[NAME_LEN + 1], char(&)[NAME_LEN + 1], @param[in] table_op operation to perform when opening @return table object after locking MDL shared @retval nullptr if the table is not readable, or if trylock && MDL blocked */ -template +template dict_table_t* dict_acquire_mdl_shared(dict_table_t *table, THD *thd, @@ -673,17 +674,18 @@ dict_acquire_mdl_shared(dict_table_t *table, MDL_context *mdl_context= static_cast(thd_mdl_context(thd)); size_t db_len; + dict_table_t *not_found= nullptr; if (trylock) { + static_assert(!trylock || !purge_thd, "usage"); dict_sys.freeze(SRW_LOCK_CALL); db_len= dict_get_db_name_len(table->name.m_name); dict_sys.unfreeze(); } else { - ut_ad(dict_sys.frozen()); - ut_ad(!dict_sys.locked()); + ut_ad(dict_sys.frozen_not_locked()); db_len= dict_get_db_name_len(table->name.m_name); } @@ -747,7 +749,13 @@ dict_acquire_mdl_shared(dict_table_t *table, } } +retry_table_open: dict_sys.freeze(SRW_LOCK_CALL); + if (purge_thd && purge_sys.must_wait_FTS()) + { + not_found= reinterpret_cast(-1); + goto return_without_mdl; + } table= dict_sys.find_table(table_id); if (table) table->acquire(); @@ -755,6 +763,11 @@ dict_acquire_mdl_shared(dict_table_t *table, { dict_sys.unfreeze(); dict_sys.lock(SRW_LOCK_CALL); + if (purge_thd && purge_sys.must_wait_FTS()) + { + dict_sys.unlock(); + goto retry_table_open; + } table= dict_load_table_on_id(table_id, table_op == DICT_TABLE_OP_LOAD_TABLESPACE ? DICT_ERR_IGNORE_RECOVER_LOCK @@ -776,12 +789,12 @@ dict_acquire_mdl_shared(dict_table_t *table, mdl_context->release_lock(*mdl); *mdl= nullptr; } - return nullptr; + return not_found; } size_t db1_len, tbl1_len; - if (!table->parse_name(db_buf1, tbl_buf1, &db1_len, &tbl1_len)) + if (!table->parse_name(db_buf1, tbl_buf1, &db1_len, &tbl1_len)) { /* The table was renamed to #sql prefix. Release MDL (if any) for the old name and return. */ @@ -813,18 +826,20 @@ dict_acquire_mdl_shared(dict_table_t *table, goto retry; } -template dict_table_t* dict_acquire_mdl_shared +template dict_table_t* dict_acquire_mdl_shared (dict_table_t*,THD*,MDL_ticket**,dict_table_op_t); -template dict_table_t* dict_acquire_mdl_shared +template dict_table_t* dict_acquire_mdl_shared (dict_table_t*,THD*,MDL_ticket**,dict_table_op_t); /** Look up a table by numeric identifier. +@tparam purge_thd Whether the function is called by purge thread @param[in] table_id table identifier @param[in] dict_locked data dictionary locked @param[in] table_op operation to perform when opening @param[in,out] thd background thread, or NULL to not acquire MDL @param[out] mdl mdl ticket, or NULL @return table, NULL if does not exist */ +template dict_table_t* dict_table_open_on_id(table_id_t table_id, bool dict_locked, dict_table_op_t table_op, THD *thd, @@ -837,9 +852,16 @@ dict_table_open_on_id(table_id_t table_id, bool dict_locked, if (table) { + if (purge_thd && purge_sys.must_wait_FTS()) + { + table= reinterpret_cast(-1); + goto func_exit; + } + table->acquire(); if (thd && !dict_locked) - table= dict_acquire_mdl_shared(table, thd, mdl, table_op); + table= dict_acquire_mdl_shared( + table, thd, mdl, table_op); } else if (table_op != DICT_TABLE_OP_OPEN_ONLY_IF_CACHED) { @@ -853,26 +875,44 @@ dict_table_open_on_id(table_id_t table_id, bool dict_locked, ? DICT_ERR_IGNORE_RECOVER_LOCK : DICT_ERR_IGNORE_FK_NOKEY); if (table) + { + if (purge_thd && purge_sys.must_wait_FTS()) + { + dict_sys.unlock(); + return reinterpret_cast(-1); + } table->acquire(); + } if (!dict_locked) { dict_sys.unlock(); if (table && thd) { dict_sys.freeze(SRW_LOCK_CALL); - table= dict_acquire_mdl_shared(table, thd, mdl, table_op); + table= dict_acquire_mdl_shared( + table, thd, mdl, table_op); dict_sys.unfreeze(); } return table; } } +func_exit: if (!dict_locked) dict_sys.unfreeze(); return table; } +template dict_table_t* dict_table_open_on_id +(table_id_t table_id, bool dict_locked, + dict_table_op_t table_op, THD *thd, + MDL_ticket **mdl); +template dict_table_t* dict_table_open_on_id +(table_id_t table_id, bool dict_locked, + dict_table_op_t table_op, THD *thd, + MDL_ticket **mdl); + /********************************************************************//** Looks for column n position in the clustered index. @return position in internal representation of the clustered index */ @@ -962,7 +1002,7 @@ void dict_sys_t::lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)) latch_ex_wait_start.store(0, std::memory_order_relaxed); ut_ad(!latch_readers); ut_ad(!latch_ex); - ut_d(latch_ex= true); + ut_d(latch_ex= pthread_self()); return; } @@ -980,15 +1020,15 @@ void dict_sys_t::lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)) latch.wr_lock(SRW_LOCK_ARGS(file, line)); ut_ad(!latch_readers); ut_ad(!latch_ex); - ut_d(latch_ex= true); + ut_d(latch_ex= pthread_self()); } #ifdef UNIV_PFS_RWLOCK ATTRIBUTE_NOINLINE void dict_sys_t::unlock() { - ut_ad(latch_ex); + ut_ad(latch_ex == pthread_self()); ut_ad(!latch_readers); - ut_d(latch_ex= false); + ut_d(latch_ex= 0); latch.wr_unlock(); } @@ -1233,7 +1273,7 @@ static bool dict_table_can_be_evicted(dict_table_t *table) dict_index_t *dict_index_t::clone() const { ut_ad(n_fields); - ut_ad(!(type & (DICT_IBUF | DICT_SPATIAL | DICT_FTS))); + ut_ad(is_btree()); ut_ad(online_status == ONLINE_INDEX_COMPLETE); ut_ad(is_committed()); ut_ad(!is_dummy); @@ -1364,45 +1404,6 @@ dict_table_find_index_on_id( return(NULL); } -/**********************************************************************//** -Looks for an index with the given id. NOTE that we do not acquire -dict_sys.latch: this function is for emergency purposes like -printing info of a corrupt database page! -@return index or NULL if not found in cache */ -dict_index_t* -dict_index_find_on_id_low( -/*======================*/ - index_id_t id) /*!< in: index id */ -{ - if (!dict_sys.is_initialised()) return NULL; - - dict_table_t* table; - - for (table = UT_LIST_GET_FIRST(dict_sys.table_LRU); - table != NULL; - table = UT_LIST_GET_NEXT(table_LRU, table)) { - - dict_index_t* index = dict_table_find_index_on_id(table, id); - - if (index != NULL) { - return(index); - } - } - - for (table = UT_LIST_GET_FIRST(dict_sys.table_non_LRU); - table != NULL; - table = UT_LIST_GET_NEXT(table_LRU, table)) { - - dict_index_t* index = dict_table_find_index_on_id(table, id); - - if (index != NULL) { - return(index); - } - } - - return(NULL); -} - /** Function object to remove a foreign key constraint from the referenced_set of the referenced table. The foreign key object is also removed from the dictionary cache. The foreign key constraint @@ -1419,12 +1420,61 @@ struct dict_foreign_remove_partial } }; +/** This function returns a new path name after replacing the basename +in an old path with a new basename. The old_path is a full path +name including the extension. The tablename is in the normal +form "databasename/tablename". The new base name is found after +the forward slash. Both input strings are null terminated. + +This function allocates memory to be returned. It is the callers +responsibility to free the return value after it is no longer needed. + +@param[in] old_path Pathname +@param[in] tablename Contains new base name +@return own: new full pathname */ +static char *dir_pathname(const char *old_path, span tablename) +{ + /* Split the tablename into its database and table name components. + They are separated by a '/'. */ + const char *base_name= tablename.data(); + for (const char *last= tablename.end(); last > tablename.data(); last--) + { + if (last[-1] == '/') + { + base_name= last; + break; + } + } + const size_t base_name_len= tablename.end() - base_name; + + /* Find the offset of the last slash. We will strip off the + old basename.ibd which starts after that slash. */ + const char *last_slash= strrchr(old_path, '/'); +#ifdef _WIN32 + if (const char *last= strrchr(old_path, '\\')) + if (last > last_slash) + last_slash= last; +#endif + + size_t dir_len= last_slash + ? size_t(last_slash - old_path) + : strlen(old_path); + + /* allocate a new path and move the old directory path to it. */ + size_t new_path_len= dir_len + base_name_len + sizeof "/.ibd"; + char *new_path= static_cast(ut_malloc_nokey(new_path_len)); + memcpy(new_path, old_path, dir_len); + snprintf(new_path + dir_len, new_path_len - dir_len, "/%.*s.ibd", + int(base_name_len), base_name); + return new_path; +} + /** Rename the data file. @param new_name name of the table @param replace whether to replace the file with the new name (as part of rolling back TRUNCATE) */ dberr_t -dict_table_t::rename_tablespace(const char *new_name, bool replace) const +dict_table_t::rename_tablespace(span new_name, bool replace) const { ut_ad(dict_table_is_file_per_table(this)); ut_ad(!is_temporary()); @@ -1433,28 +1483,29 @@ dict_table_t::rename_tablespace(const char *new_name, bool replace) const return DB_SUCCESS; const char *old_path= UT_LIST_GET_FIRST(space->chain)->name; - fil_space_t::name_type space_name{new_name, strlen(new_name)}; const bool data_dir= DICT_TF_HAS_DATA_DIR(flags); char *path= data_dir - ? os_file_make_new_pathname(old_path, new_name) - : fil_make_filepath(nullptr, space_name, IBD, false); + ? dir_pathname(old_path, new_name) + : fil_make_filepath(nullptr, new_name, IBD, false); dberr_t err; if (!path) err= DB_OUT_OF_MEMORY; else if (!strcmp(path, old_path)) err= DB_SUCCESS; else if (data_dir && - DB_SUCCESS != RemoteDatafile::create_link_file(space_name, path)) + DB_SUCCESS != RemoteDatafile::create_link_file(new_name, path)) err= DB_TABLESPACE_EXISTS; else { + space->x_lock(); err= space->rename(path, true, replace); if (data_dir) { if (err == DB_SUCCESS) - space_name= {name.m_name, strlen(name.m_name)}; - RemoteDatafile::delete_link_file(space_name); + new_name= {name.m_name, strlen(name.m_name)}; + RemoteDatafile::delete_link_file(new_name); } + space->x_unlock(); } ut_free(path); @@ -1468,18 +1519,13 @@ dberr_t dict_table_rename_in_cache( /*=======================*/ dict_table_t* table, /*!< in/out: table */ - const char* new_name, /*!< in: new name */ - bool rename_also_foreigns, - /*!< in: in ALTER TABLE we want - to preserve the original table name - in constraints which reference it */ + span new_name, /*!< in: new name */ bool replace_new_file) /*!< in: whether to replace the file with the new name (as part of rolling back TRUNCATE) */ { dict_foreign_t* foreign; - ulint fold; char old_name[MAX_FULL_NAME_LEN + 1]; ut_ad(dict_sys.locked()); @@ -1489,23 +1535,8 @@ dict_table_rename_in_cache( ut_a(old_name_len < sizeof old_name); strcpy(old_name, table->name.m_name); - fold = my_crc32c(0, new_name, strlen(new_name)); - - /* Look for a table with the same name: error if such exists */ - dict_table_t* table2; - HASH_SEARCH(name_hash, &dict_sys.table_hash, fold, - dict_table_t*, table2, ut_ad(table2->cached), - (strcmp(table2->name.m_name, new_name) == 0)); - DBUG_EXECUTE_IF("dict_table_rename_in_cache_failure", - if (table2 == NULL) { - table2 = (dict_table_t*) -1; - } ); - if (table2) { - ib::error() << "Cannot rename table '" << table->name - << "' to '" << new_name << "' since the" - " dictionary cache already contains '" << new_name << "'."; - return(DB_ERROR); - } + const uint32_t fold= my_crc32c(0, new_name.data(), new_name.size()); + ut_a(!dict_sys.find_table(new_name)); if (!dict_table_is_file_per_table(table)) { } else if (dberr_t err = table->rename_tablespace(new_name, @@ -1517,8 +1548,14 @@ dict_table_rename_in_cache( HASH_DELETE(dict_table_t, name_hash, &dict_sys.table_hash, my_crc32c(0, table->name.m_name, old_name_len), table); - const bool keep_mdl_name = dict_table_t::is_temporary_name(new_name) - && !table->name.is_temporary(); + bool keep_mdl_name = !table->name.is_temporary(); + + if (!keep_mdl_name) { + } else if (const char* s = static_cast + (memchr(new_name.data(), '/', new_name.size()))) { + keep_mdl_name = new_name.end() - s >= 5 + && !memcmp(s, "/#sql", 5); + } if (keep_mdl_name) { /* Preserve the original table name for @@ -1527,18 +1564,17 @@ dict_table_rename_in_cache( table->name.m_name); } - const size_t new_len = strlen(new_name); - - if (new_len > strlen(table->name.m_name)) { + if (new_name.size() > strlen(table->name.m_name)) { /* We allocate MAX_FULL_NAME_LEN + 1 bytes here to avoid memory fragmentation, we assume a repeated calls of ut_realloc() with the same size do not cause fragmentation */ - ut_a(new_len <= MAX_FULL_NAME_LEN); + ut_a(new_name.size() <= MAX_FULL_NAME_LEN); table->name.m_name = static_cast( ut_realloc(table->name.m_name, MAX_FULL_NAME_LEN + 1)); } - strcpy(table->name.m_name, new_name); + memcpy(table->name.m_name, new_name.data(), new_name.size()); + table->name.m_name[new_name.size()] = '\0'; if (!keep_mdl_name) { table->mdl_name.m_name = table->name.m_name; @@ -1548,7 +1584,7 @@ dict_table_rename_in_cache( HASH_INSERT(dict_table_t, name_hash, &dict_sys.table_hash, fold, table); - if (!rename_also_foreigns) { + if (table->name.is_temporary()) { /* In ALTER TABLE we think of the rename table operation in the direction table -> temporary table (#sql...) as dropping the table with the old name and creating @@ -1630,7 +1666,7 @@ dict_table_rename_in_cache( in UTF-8 charset. The variable fkid here is used to store foreign key constraint name in charset my_charset_filename for comparison further below. */ - char fkid[MAX_TABLE_NAME_LEN+20]; + char fkid[MAX_TABLE_NAME_LEN * 2 + 20]; /* The old table name in my_charset_filename is stored in old_name_cs_filename */ @@ -1662,7 +1698,8 @@ dict_table_rename_in_cache( } } - strncpy(fkid, foreign->id, MAX_TABLE_NAME_LEN); + strncpy(fkid, foreign->id, (sizeof fkid) - 1); + fkid[(sizeof fkid) - 1] = '\0'; const bool on_tmp = dict_table_t::is_temporary_name( fkid); @@ -1895,8 +1932,8 @@ void dict_sys_t::remove(dict_table_t* table, bool lru, bool keep) #ifdef BTR_CUR_HASH_ADAPT if (table->fts) { fts_optimize_remove_table(table); - fts_free(table); - table->fts = NULL; + table->fts->~fts_t(); + table->fts = nullptr; } table->autoinc_mutex.wr_lock(); @@ -2098,7 +2135,6 @@ dict_index_remove_from_cache_low( there can't be any active operations on this index (or table). */ if (index->online_log) { - ut_ad(index->online_status == ONLINE_INDEX_CREATION); row_log_free(index->online_log); index->online_log = NULL; } @@ -2253,15 +2289,14 @@ dict_index_find_cols( return(TRUE); } -/*******************************************************************//** -Adds a column to index. */ -void -dict_index_add_col( -/*===============*/ - dict_index_t* index, /*!< in/out: index */ - const dict_table_t* table, /*!< in: table */ - dict_col_t* col, /*!< in: column */ - ulint prefix_len) /*!< in: column prefix length */ +/** Add a column to an index. +@param index index +@param table table +@param col column +@param prefix_len column prefix length +@param descending whether to use descending order */ +void dict_index_add_col(dict_index_t *index, const dict_table_t *table, + dict_col_t *col, ulint prefix_len, bool descending) { dict_field_t* field; const char* col_name; @@ -2299,6 +2334,8 @@ dict_index_add_col( field->fixed_len = 0; } + field->descending = descending; + /* The comparison limit above must be constant. If it were changed, the disk format of some fixed-length columns would change, which would be a disaster. */ @@ -2330,7 +2367,7 @@ dict_index_copy( field = dict_index_get_nth_field(index2, i); dict_index_add_col(index1, index2->table, field->col, - field->prefix_len); + field->prefix_len, field->descending); } } @@ -2644,17 +2681,12 @@ dict_index_build_internal_non_clust( index entry uniquely */ for (i = 0; i < clust_index->n_uniq; i++) { - field = dict_index_get_nth_field(clust_index, i); - if (!indexed[field->col->ind]) { + if (!indexed[field->col->ind] || index->is_spatial()) { dict_index_add_col(new_index, table, field->col, - field->prefix_len); - } else if (dict_index_is_spatial(index)) { - /*For spatial index, we still need to add the - field to index. */ - dict_index_add_col(new_index, table, field->col, - field->prefix_len); + field->prefix_len, + field->descending); } } @@ -2687,7 +2719,7 @@ dict_index_build_internal_fts( { dict_index_t* new_index; - ut_ad(index->type == DICT_FTS); + ut_ad(index->type & DICT_FTS); ut_ad(dict_sys.locked()); /* Create a new index */ @@ -2722,17 +2754,6 @@ dict_index_build_internal_fts( } /*====================== FOREIGN KEY PROCESSING ========================*/ -/*********************************************************************//** -Checks if a table is referenced by foreign keys. -@return TRUE if table is referenced by a foreign key */ -ibool -dict_table_is_referenced_by_foreign_key( -/*====================================*/ - const dict_table_t* table) /*!< in: InnoDB table */ -{ - return(!table->referenced_set.empty()); -} - /**********************************************************************//** Removes a foreign constraint struct from the dictionary cache. */ void @@ -3488,10 +3509,11 @@ dict_table_get_highest_foreign_id( for (dict_foreign_set::iterator it = table->foreign_set.begin(); it != table->foreign_set.end(); ++it) { - char fkid[MAX_TABLE_NAME_LEN+20]; + char fkid[MAX_TABLE_NAME_LEN * 2 + 20]; foreign = *it; - strcpy(fkid, foreign->id); + strncpy(fkid, foreign->id, (sizeof fkid) - 1); + fkid[(sizeof fkid) - 1] = '\0'; /* Convert foreign key identifier on dictionary memory cache to filename charset. */ innobase_convert_to_filename_charset( @@ -3673,9 +3695,19 @@ dict_index_get_if_in_cache_low( /*===========================*/ index_id_t index_id) /*!< in: index id */ { - ut_ad(dict_sys.frozen()); + ut_ad(dict_sys.frozen()); + + for (dict_table_t *table= UT_LIST_GET_FIRST(dict_sys.table_LRU); + table; table= UT_LIST_GET_NEXT(table_LRU, table)) + if (dict_index_t *index= dict_table_find_index_on_id(table, index_id)) + return index; - return(dict_index_find_on_id_low(index_id)); + for (dict_table_t *table = UT_LIST_GET_FIRST(dict_sys.table_non_LRU); + table; table= UT_LIST_GET_NEXT(table_LRU, table)) + if (dict_index_t *index= dict_table_find_index_on_id(table, index_id)) + return index; + + return nullptr; } #ifdef UNIV_DEBUG @@ -4054,80 +4086,10 @@ dict_print_info_on_foreign_keys( return str; } -/** Given a space_id of a file-per-table tablespace, search the -dict_sys.table_LRU list and return the dict_table_t* pointer for it. -@param space tablespace -@return table if found, NULL if not */ -static -dict_table_t* -dict_find_single_table_by_space(const fil_space_t* space) -{ - dict_table_t* table; - ulint num_item; - ulint count = 0; - - ut_ad(space->id > 0); - - if (!dict_sys.is_initialised()) { - /* This could happen when it's in redo processing. */ - return(NULL); - } - - table = UT_LIST_GET_FIRST(dict_sys.table_LRU); - num_item = UT_LIST_GET_LEN(dict_sys.table_LRU); - - /* This function intentionally does not acquire mutex as it is used - by error handling code in deep call stack as last means to avoid - killing the server, so it worth to risk some consequences for - the action. */ - while (table && count < num_item) { - if (table->space == space) { - if (dict_table_is_file_per_table(table)) { - return(table); - } - return(NULL); - } - - table = UT_LIST_GET_NEXT(table_LRU, table); - count++; - } - - return(NULL); -} - -/**********************************************************************//** -Flags a table with specified space_id corrupted in the data dictionary -cache -@return true if successful */ -bool dict_set_corrupted_by_space(const fil_space_t* space) -{ - dict_table_t* table; - - table = dict_find_single_table_by_space(space); - - if (!table) { - return false; - } - - /* mark the table->corrupted bit only, since the caller - could be too deep in the stack for SYS_INDEXES update */ - table->corrupted = true; - table->file_unreadable = true; - return true; -} - -/** Flag a table encrypted in the data dictionary cache. */ -void dict_set_encrypted_by_space(const fil_space_t* space) -{ - if (dict_table_t* table = dict_find_single_table_by_space(space)) { - table->file_unreadable = true; - } -} - /**********************************************************************//** Flags an index corrupted both in the data dictionary cache and in the SYS_INDEXES */ -void dict_set_corrupted(dict_index_t *index, const char *ctx, bool dict_locked) +void dict_set_corrupted(dict_index_t *index, const char *ctx) { mem_heap_t* heap; mtr_t mtr; @@ -4138,11 +4100,8 @@ void dict_set_corrupted(dict_index_t *index, const char *ctx, bool dict_locked) const char* status; btr_cur_t cursor; - if (!dict_locked) { - dict_sys.lock(SRW_LOCK_CALL); - } + dict_sys.lock(SRW_LOCK_CALL); - ut_ad(dict_sys.locked()); ut_ad(!dict_table_is_comp(dict_sys.sys_tables)); ut_ad(!dict_table_is_comp(dict_sys.sys_indexes)); @@ -4150,6 +4109,7 @@ void dict_set_corrupted(dict_index_t *index, const char *ctx, bool dict_locked) is corrupted */ if (dict_index_is_clust(index)) { index->table->corrupted = TRUE; + goto func_exit; } if (index->type & DICT_CORRUPT) { @@ -4187,9 +4147,12 @@ void dict_set_corrupted(dict_index_t *index, const char *ctx, bool dict_locked) dfield_set_data(dfield, buf, 8); dict_index_copy_types(tuple, sys_index, 2); + cursor.page_cur.index = sys_index; - btr_cur_search_to_nth_level(sys_index, 0, tuple, PAGE_CUR_LE, - BTR_MODIFY_LEAF, &cursor, 0, &mtr); + if (cursor.search_leaf(tuple, PAGE_CUR_LE, BTR_MODIFY_LEAF, &mtr) + != DB_SUCCESS) { + goto fail; + } if (cursor.low_match == dtuple_get_n_fields(tuple)) { /* UPDATE SYS_INDEXES SET TYPE=index->type @@ -4214,33 +4177,7 @@ void dict_set_corrupted(dict_index_t *index, const char *ctx, bool dict_locked) << " in table " << index->table->name << " in " << ctx; func_exit: - if (!dict_locked) { - dict_sys.unlock(); - } -} - -/** Flags an index corrupted in the data dictionary cache only. This -is used mostly to mark a corrupted index when index's own dictionary -is corrupted, and we force to load such index for repair purpose -@param[in,out] index index which is corrupted */ -void -dict_set_corrupted_index_cache_only( - dict_index_t* index) -{ - ut_ad(index != NULL); - ut_ad(index->table != NULL); - ut_ad(dict_sys.locked()); - ut_ad(!dict_table_is_comp(dict_sys.sys_tables)); - ut_ad(!dict_table_is_comp(dict_sys.sys_indexes)); - - /* Mark the table as corrupted only if the clustered index - is corrupted */ - if (dict_index_is_clust(index)) { - index->table->corrupted = TRUE; - index->table->file_unreadable = true; - } - - index->type |= DICT_CORRUPT; + dict_sys.unlock(); } /** Sets merge_threshold in the SYS_INDEXES @@ -4269,8 +4206,6 @@ dict_index_set_merge_threshold( mtr.start(); - dict_sys.lock(SRW_LOCK_CALL); - sys_index = UT_LIST_GET_FIRST(dict_sys.sys_indexes->indexes); /* Find the index row in SYS_INDEXES */ @@ -4287,9 +4222,12 @@ dict_index_set_merge_threshold( dfield_set_data(dfield, buf, 8); dict_index_copy_types(tuple, sys_index, 2); + cursor.page_cur.index = sys_index; - btr_cur_search_to_nth_level(sys_index, 0, tuple, PAGE_CUR_GE, - BTR_MODIFY_LEAF, &cursor, 0, &mtr); + if (cursor.search_leaf(tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF, &mtr) + != DB_SUCCESS) { + goto func_exit; + } if (cursor.up_match == dtuple_get_n_fields(tuple) && rec_get_n_fields_old(btr_cur_get_rec(&cursor)) @@ -4304,10 +4242,9 @@ dict_index_set_merge_threshold( field, merge_threshold); } +func_exit: mtr_commit(&mtr); mem_heap_free(heap); - - dict_sys.unlock(); } #ifdef UNIV_DEBUG @@ -4724,7 +4661,7 @@ dict_foreign_qualify_index( return(false); } - if (index->type & (DICT_SPATIAL | DICT_FTS | DICT_CORRUPT)) { + if (!index->is_btree()) { return false; } diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index 20ab06c8461fe..f769839db14c1 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2021, MariaDB Corporation. +Copyright (c) 2016, 2023, 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 @@ -43,6 +43,7 @@ Created 4/24/1996 Heikki Tuuri #include "srv0start.h" #include "srv0srv.h" #include "fts0opt.h" +#include "row0vers.h" /** Loads a table definition and also all its index definitions. @@ -65,48 +66,49 @@ static dict_table_t *dict_load_table_one(const span &name, dict_names_t &fk_tables); /** Load an index definition from a SYS_INDEXES record to dict_index_t. -If allocate=TRUE, we will create a dict_index_t structure and fill it -accordingly. If allocated=FALSE, the dict_index_t will be supplied by -the caller and filled with information read from the record. @return error message @retval NULL on success */ static const char* dict_load_index_low( byte* table_id, /*!< in/out: table id (8 bytes), - an "in" value if allocate=TRUE - and "out" when allocate=FALSE */ + an "in" value if mtr + and "out" when !mtr */ + bool uncommitted, /*!< in: false=READ COMMITTED, + true=READ UNCOMMITTED */ mem_heap_t* heap, /*!< in/out: temporary memory heap */ const rec_t* rec, /*!< in: SYS_INDEXES record */ - ibool allocate, /*!< in: TRUE=allocate *index, - FALSE=fill in a pre-allocated - *index */ + mtr_t* mtr, /*!< in/out: mini-transaction, + or nullptr if a pre-allocated + *index is to be filled in */ + dict_table_t* table, /*!< in/out: table, or NULL */ dict_index_t** index); /*!< out,own: index, or NULL */ /** Load a table column definition from a SYS_COLUMNS record to dict_table_t. -@return error message -@retval NULL on success */ -static -const char* -dict_load_column_low( - dict_table_t* table, /*!< in/out: table, could be NULL - if we just populate a dict_column_t - struct with information from - a SYS_COLUMNS record */ - mem_heap_t* heap, /*!< in/out: memory heap - for temporary storage */ - dict_col_t* column, /*!< out: dict_column_t to fill, - or NULL if table != NULL */ - table_id_t* table_id, /*!< out: table id */ - const char** col_name, /*!< out: column name */ - const rec_t* rec, /*!< in: SYS_COLUMNS record */ - ulint* nth_v_col); /*!< out: if not NULL, this - records the "n" of "nth" virtual - column */ +@param table table, or nullptr if the output will be in column +@param use_uncommitted 0=READ COMMITTED, 1=detect, 2=READ UNCOMMITTED +@param heap memory heap for temporary storage +@param column pointer to output buffer, or nullptr if table!=nullptr +@param table_id table identifier +@param col_name column name +@param rec SYS_COLUMNS record +@param mtr mini-transaction +@param nth_v_col nullptr, or pointer to a counter of virtual columns +@return error message +@retval nullptr on success */ +static const char *dict_load_column_low(dict_table_t *table, + unsigned use_uncommitted, + mem_heap_t *heap, dict_col_t *column, + table_id_t *table_id, + const char **col_name, + const rec_t *rec, + mtr_t *mtr, + ulint *nth_v_col); /** Load a virtual column "mapping" (to base columns) information from a SYS_VIRTUAL record @param[in,out] table table +@param[in] uncommitted false=READ COMMITTED, true=READ UNCOMMITTED @param[in,out] column mapped base column's dict_column_t @param[in,out] table_id table id @param[in,out] pos virtual column position @@ -118,6 +120,7 @@ static const char* dict_load_virtual_low( dict_table_t* table, + bool uncommitted, dict_col_t** column, table_id_t* table_id, ulint* pos, @@ -133,6 +136,8 @@ dict_load_field_low( byte* index_id, /*!< in/out: index id (8 bytes) an "in" value if index != NULL and "out" if index == NULL */ + bool uncommitted, /*!< in: false=READ COMMITTED, + true=READ UNCOMMITTED */ dict_index_t* index, /*!< in/out: index, could be NULL if we just populate a dict_field_t struct with information from @@ -143,6 +148,7 @@ dict_load_field_low( byte* last_index_id, /*!< in: last index id */ mem_heap_t* heap, /*!< in/out: memory heap for temporary storage */ + mtr_t* mtr, /*!< in/out: mini-transaction */ const rec_t* rec); /*!< in: SYS_FIELDS record */ #ifdef UNIV_DEBUG @@ -179,7 +185,7 @@ dict_getnext_system_low( { rec_t* rec = NULL; - while (!rec || rec_get_deleted_flag(rec, 0)) { + while (!rec) { btr_pcur_move_to_next_user_rec(pcur, mtr); rec = btr_pcur_get_rec(pcur); @@ -209,9 +215,15 @@ dict_startscan_system( mtr_t* mtr, /*!< in: the mini-transaction */ dict_table_t* table) /*!< in: system table */ { - btr_pcur_open_at_index_side(true, table->indexes.start, - BTR_SEARCH_LEAF, pcur, true, 0, mtr); - return dict_getnext_system_low(pcur, mtr); + btr_pcur_init(pcur); + if (pcur->open_leaf(true, table->indexes.start, BTR_SEARCH_LEAF, mtr) != + DB_SUCCESS) + return nullptr; + const rec_t *rec; + do + rec= dict_getnext_system_low(pcur, mtr); + while (rec && rec_get_deleted_flag(rec, 0)); + return rec; } /********************************************************************//** @@ -224,15 +236,12 @@ dict_getnext_system( to the record */ mtr_t* mtr) /*!< in: the mini-transaction */ { - const rec_t* rec; - - /* Restore the position */ - btr_pcur_restore_position(BTR_SEARCH_LEAF, pcur, mtr); - - /* Get the next record */ - rec = dict_getnext_system_low(pcur, mtr); - - return(rec); + const rec_t *rec=nullptr; + if (pcur->restore_position(BTR_SEARCH_LEAF, mtr) != btr_pcur_t::CORRUPTED) + do + rec= dict_getnext_system_low(pcur, mtr); + while (rec && rec_get_deleted_flag(rec, 0)); + return rec; } /********************************************************************//** @@ -248,19 +257,16 @@ dict_process_sys_indexes_rec( dict_index_t* index, /*!< out: index to be filled */ table_id_t* table_id) /*!< out: index table id */ { - const char* err_msg; - byte* buf; + byte buf[8]; - ut_d(index->is_dummy = true); - ut_d(index->in_instant_init = false); - buf = static_cast(mem_heap_alloc(heap, 8)); + ut_d(index->is_dummy = true); + ut_d(index->in_instant_init = false); - /* Parse the record, and get "dict_index_t" struct filled */ - err_msg = dict_load_index_low(buf, heap, rec, FALSE, &index); - - *table_id = mach_read_from_8(buf); - - return(err_msg); + /* Parse the record, and get "dict_index_t" struct filled */ + const char *err_msg= dict_load_index_low(buf, false, heap, rec, + nullptr, nullptr, &index); + *table_id= mach_read_from_8(buf); + return err_msg; } /********************************************************************//** @@ -281,8 +287,9 @@ dict_process_sys_columns_rec( const char* err_msg; /* Parse the record, and get "dict_col_t" struct filled */ - err_msg = dict_load_column_low(NULL, heap, column, - table_id, col_name, rec, nth_v_col); + err_msg = dict_load_column_low(NULL, 0, heap, column, + table_id, col_name, rec, nullptr, + nth_v_col); return(err_msg); } @@ -301,13 +308,8 @@ dict_process_sys_virtual_rec( ulint* pos, ulint* base_pos) { - const char* err_msg; - - /* Parse the record, and get "dict_col_t" struct filled */ - err_msg = dict_load_virtual_low(NULL, NULL, table_id, - pos, base_pos, rec); - - return(err_msg); + return dict_load_virtual_low(nullptr, false, nullptr, table_id, + pos, base_pos, rec); } /********************************************************************//** @@ -325,17 +327,14 @@ dict_process_sys_fields_rec( index_id_t* index_id, /*!< out: current index id */ index_id_t last_id) /*!< in: previous index id */ { - byte* buf; - byte* last_index_id; + byte buf[8]; + byte last_index_id[8]; const char* err_msg; - buf = static_cast(mem_heap_alloc(heap, 8)); - - last_index_id = static_cast(mem_heap_alloc(heap, 8)); mach_write_to_8(last_index_id, last_id); - err_msg = dict_load_field_low(buf, NULL, sys_field, - pos, last_index_id, heap, rec); + err_msg = dict_load_field_low(buf, false, nullptr, sys_field, + pos, last_index_id, heap, nullptr, rec); *index_id = mach_read_from_8(buf); @@ -507,10 +506,6 @@ dict_sys_tables_rec_check( ut_ad(dict_sys.locked()); - if (rec_get_deleted_flag(rec, 0)) { - return("delete-marked record in SYS_TABLES"); - } - if (rec_get_n_fields_old(rec) != DICT_NUM_FIELDS__SYS_TABLES) { return("wrong number of columns in SYS_TABLES record"); } @@ -636,29 +631,79 @@ uint32_t dict_sys_tables_type_to_tf(uint32_t type, bool not_redundant) return(flags); } +/** Outcome of dict_sys_tables_rec_read() */ +enum table_read_status { READ_OK= 0, READ_ERROR, READ_NOT_FOUND }; + /** Read and return 5 integer fields from a SYS_TABLES record. @param[in] rec A record of SYS_TABLES -@param[in] name SYS_TABLES.NAME +@param[in] uncommitted true=use READ UNCOMMITTED, false=READ COMMITTED +@param[in] mtr mini-transaction @param[out] table_id Pointer to the table_id for this table @param[out] space_id Pointer to the space_id for this table @param[out] n_cols Pointer to number of columns for this table. @param[out] flags Pointer to table flags @param[out] flags2 Pointer to table flags2 -@return true if the record was read correctly, false if not. */ +@param[out] trx_id DB_TRX_ID of the committed SYS_TABLES record, + or nullptr to perform READ UNCOMMITTED +@return whether the record was read correctly */ MY_ATTRIBUTE((warn_unused_result)) static -bool +table_read_status dict_sys_tables_rec_read( const rec_t* rec, - const span& name, + bool uncommitted, + mtr_t* mtr, table_id_t* table_id, uint32_t* space_id, uint32_t* n_cols, uint32_t* flags, - uint32_t* flags2) + uint32_t* flags2, + trx_id_t* trx_id) { const byte* field; ulint len; + mem_heap_t* heap = nullptr; + + field = rec_get_nth_field_old( + rec, DICT_FLD__SYS_TABLES__DB_TRX_ID, &len); + ut_ad(len == 6 || len == UNIV_SQL_NULL); + trx_id_t id = len == 6 ? trx_read_trx_id(field) : 0; + if (id && !uncommitted && trx_sys.find(nullptr, id, false)) { + const auto savepoint = mtr->get_savepoint(); + heap = mem_heap_create(1024); + dict_index_t* index = UT_LIST_GET_FIRST( + dict_sys.sys_tables->indexes); + rec_offs* offsets = rec_get_offsets( + rec, index, nullptr, true, ULINT_UNDEFINED, &heap); + const rec_t* old_vers; + row_vers_build_for_semi_consistent_read( + nullptr, rec, mtr, index, &offsets, &heap, + heap, &old_vers, nullptr); + mtr->rollback_to_savepoint(savepoint); + rec = old_vers; + if (!rec) { + mem_heap_free(heap); + return READ_NOT_FOUND; + } + field = rec_get_nth_field_old( + rec, DICT_FLD__SYS_TABLES__DB_TRX_ID, &len); + if (UNIV_UNLIKELY(len != 6)) { + mem_heap_free(heap); + return READ_ERROR; + } + id = trx_read_trx_id(field); + } + + if (rec_get_deleted_flag(rec, 0)) { + ut_ad(id); + if (trx_id) { + return READ_NOT_FOUND; + } + } + + if (trx_id) { + *trx_id = id; + } field = rec_get_nth_field_old( rec, DICT_FLD__SYS_TABLES__ID, &len); @@ -767,8 +812,13 @@ dict_sys_tables_rec_read( " data dictionary contains invalid flags." " SYS_TABLES.TYPE=" UINT32PF " SYS_TABLES.N_COLS=" UINT32PF, - int(name.size()), name.data(), type, *n_cols); - return(false); + int(rec_get_field_start_offs(rec, 1)), rec, + type, *n_cols); +err_exit: + if (UNIV_LIKELY_NULL(heap)) { + mem_heap_free(heap); + } + return READ_ERROR; } *flags = dict_sys_tables_type_to_tf(type, not_redundant); @@ -779,7 +829,8 @@ dict_sys_tables_rec_read( high bit set in n_cols, and flags would be zero. MySQL 4.1 was the first version to support innodb_file_per_table, that is, *space_id != 0. */ - if (not_redundant || *space_id != 0 || *n_cols & DICT_N_COLS_COMPACT) { + if (not_redundant || *space_id != 0 || *n_cols & DICT_N_COLS_COMPACT + || fil_system.sys_space->full_crc32()) { /* Get flags2 from SYS_TABLES.MIX_LEN */ field = rec_get_nth_field_old( @@ -792,9 +843,10 @@ dict_sys_tables_rec_read( " contains invalid flags." " SYS_TABLES.TYPE=" UINT32PF " SYS_TABLES.MIX_LEN=" UINT32PF, - int(name.size()), name.data(), + int(rec_get_field_start_offs(rec, 1)), + rec, type, *flags2); - return(false); + goto err_exit; } /* DICT_TF2_FTS will be set when indexes are being loaded */ @@ -806,25 +858,35 @@ dict_sys_tables_rec_read( *flags2 = 0; } - return(true); + if (UNIV_LIKELY_NULL(heap)) { + mem_heap_free(heap); + } + + return READ_OK; } -/** Load and check each non-predefined tablespace mentioned in SYS_TABLES. -Search SYS_TABLES and check each tablespace mentioned that has not -already been added to the fil_system. If it is valid, add it to the -file_system list. -@return the highest space ID found. */ -static uint32_t dict_check_sys_tables() +/** Check each tablespace found in the data dictionary. +Then look at each table defined in SYS_TABLES that has a space_id > 0 +to find all the file-per-table tablespaces. + +In a crash recovery we already have some tablespace objects created from +processing the REDO log. We will compare the +space_id information in the data dictionary to what we find in the +tablespace file. In addition, more validation will be done if recovery +was needed and force_recovery is not set. + +We also scan the biggest space id, and store it to fil_system. */ +void dict_check_tablespaces_and_store_max_id() { uint32_t max_space_id = 0; btr_pcur_t pcur; mtr_t mtr; - DBUG_ENTER("dict_check_sys_tables"); + DBUG_ENTER("dict_check_tablespaces_and_store_max_id"); - ut_ad(dict_sys.locked()); + mtr.start(); - mtr_start(&mtr); + dict_sys.lock(SRW_LOCK_CALL); for (const rec_t *rec = dict_startscan_system(&pcur, &mtr, dict_sys.sys_tables); @@ -842,7 +904,6 @@ static uint32_t dict_check_sys_tables() continue; } - /* Copy the table name from rec */ const char *field = reinterpret_cast( rec_get_nth_field_old(rec, DICT_FLD__SYS_TABLES__NAME, &len)); @@ -850,10 +911,10 @@ static uint32_t dict_check_sys_tables() DBUG_PRINT("dict_check_sys_tables", ("name: %*.s", static_cast(len), field)); - const span name{field, len}; - - if (!dict_sys_tables_rec_read(rec, name, &table_id, &space_id, - &n_cols, &flags, &flags2) + if (dict_sys_tables_rec_read(rec, false, + &mtr, &table_id, &space_id, + &n_cols, &flags, &flags2, nullptr) + != READ_OK || space_id == TRX_SYS_SPACE) { continue; } @@ -878,13 +939,18 @@ static uint32_t dict_check_sys_tables() continue; } + const span name{field, len}; + char* filepath = fil_make_filepath(nullptr, name, IBD, false); + const bool not_dropped{!rec_get_deleted_flag(rec, 0)}; + /* Check that the .ibd file exists. */ - if (fil_ibd_open(false, FIL_TYPE_TABLESPACE, + if (fil_ibd_open(not_dropped, FIL_TYPE_TABLESPACE, space_id, dict_tf_to_fsp_flags(flags), name, filepath)) { + } else if (!not_dropped) { } else if (srv_operation == SRV_OPERATION_NORMAL && srv_start_after_restore && srv_force_recovery < SRV_FORCE_NO_BACKGROUND @@ -897,8 +963,7 @@ static uint32_t dict_check_sys_tables() sql_print_warning("InnoDB: Ignoring tablespace for" " %.*s because it" " could not be opened.", - static_cast(name.size()), - name.data()); + static_cast(len), field); } max_space_id = ut_max(max_space_id, space_id); @@ -906,44 +971,10 @@ static uint32_t dict_check_sys_tables() ut_free(filepath); } - mtr_commit(&mtr); - - DBUG_RETURN(max_space_id); -} - -/** Check each tablespace found in the data dictionary. -Then look at each table defined in SYS_TABLES that has a space_id > 0 -to find all the file-per-table tablespaces. - -In a crash recovery we already have some tablespace objects created from -processing the REDO log. We will compare the -space_id information in the data dictionary to what we find in the -tablespace file. In addition, more validation will be done if recovery -was needed and force_recovery is not set. - -We also scan the biggest space id, and store it to fil_system. */ -void dict_check_tablespaces_and_store_max_id() -{ - mtr_t mtr; - - DBUG_ENTER("dict_check_tablespaces_and_store_max_id"); - - dict_sys.lock(SRW_LOCK_CALL); - - /* Initialize the max space_id from sys header */ - mtr.start(); - uint32_t max_space_id = mach_read_from_4(DICT_HDR_MAX_SPACE_ID - + DICT_HDR - + dict_hdr_get(&mtr) - ->page.frame); mtr.commit(); fil_set_max_space_id_if_bigger(max_space_id); - /* Open all tablespaces referenced in SYS_TABLES. */ - max_space_id = dict_check_sys_tables(); - fil_set_max_space_id_if_bigger(max_space_id); - dict_sys.unlock(); DBUG_VOID_RETURN; @@ -951,28 +982,31 @@ void dict_check_tablespaces_and_store_max_id() /** Error message for a delete-marked record in dict_load_column_low() */ static const char *dict_load_column_del= "delete-marked record in SYS_COLUMNS"; +/** Error message for a missing record in dict_load_column_low() */ static const char *dict_load_column_none= "SYS_COLUMNS record not found"; +/** Message for incomplete instant ADD/DROP in dict_load_column_low() */ +static const char *dict_load_column_instant= "incomplete instant ADD/DROP"; /** Load a table column definition from a SYS_COLUMNS record to dict_table_t. -@return error message -@retval NULL on success */ -static -const char* -dict_load_column_low( - dict_table_t* table, /*!< in/out: table, could be NULL - if we just populate a dict_column_t - struct with information from - a SYS_COLUMNS record */ - mem_heap_t* heap, /*!< in/out: memory heap - for temporary storage */ - dict_col_t* column, /*!< out: dict_column_t to fill, - or NULL if table != NULL */ - table_id_t* table_id, /*!< out: table id */ - const char** col_name, /*!< out: column name */ - const rec_t* rec, /*!< in: SYS_COLUMNS record */ - ulint* nth_v_col) /*!< out: if not NULL, this - records the "n" of "nth" virtual - column */ +@param table table, or nullptr if the output will be in column +@param use_uncommitted 0=READ COMMITTED, 1=detect, 2=READ UNCOMMITTED +@param heap memory heap for temporary storage +@param column pointer to output buffer, or nullptr if table!=nullptr +@param table_id table identifier +@param col_name column name +@param rec SYS_COLUMNS record +@param mtr mini-transaction +@param nth_v_col nullptr, or pointer to a counter of virtual columns +@return error message +@retval nullptr on success */ +static const char *dict_load_column_low(dict_table_t *table, + unsigned use_uncommitted, + mem_heap_t *heap, dict_col_t *column, + table_id_t *table_id, + const char **col_name, + const rec_t *rec, + mtr_t *mtr, + ulint *nth_v_col) { char* name; const byte* field; @@ -985,10 +1019,6 @@ dict_load_column_low( ut_ad(!table == !!column); - if (rec_get_deleted_flag(rec, 0)) { - return(dict_load_column_del); - } - if (rec_get_n_fields_old(rec) != DICT_NUM_FIELDS__SYS_COLUMNS) { return("wrong number of columns in SYS_COLUMNS record"); } @@ -1020,7 +1050,34 @@ dict_load_column_low( goto err_len; } - const trx_id_t trx_id = mach_read_from_6(field); + const trx_id_t trx_id = trx_read_trx_id(field); + + if (trx_id && mtr && use_uncommitted < 2 + && trx_sys.find(nullptr, trx_id, false)) { + if (use_uncommitted) { + return dict_load_column_instant; + } + const auto savepoint = mtr->get_savepoint(); + dict_index_t* index = UT_LIST_GET_FIRST( + dict_sys.sys_columns->indexes); + rec_offs* offsets = rec_get_offsets( + rec, index, nullptr, true, ULINT_UNDEFINED, &heap); + const rec_t* old_vers; + row_vers_build_for_semi_consistent_read( + nullptr, rec, mtr, index, &offsets, &heap, + heap, &old_vers, nullptr); + mtr->rollback_to_savepoint(savepoint); + rec = old_vers; + if (!old_vers) { + return dict_load_column_none; + } + ut_ad(!rec_get_deleted_flag(rec, 0)); + } + + if (rec_get_deleted_flag(rec, 0)) { + ut_ad(trx_id); + return dict_load_column_del; + } rec_get_nth_field_offs_old( rec, DICT_FLD__SYS_COLUMNS__DB_ROLL_PTR, &len); @@ -1034,11 +1091,7 @@ dict_load_column_low( goto err_len; } - name = mem_heap_strdupl(heap, (const char*) field, len); - - if (col_name) { - *col_name = name; - } + *col_name = name = mem_heap_strdupl(heap, (const char*) field, len); field = rec_get_nth_field_old( rec, DICT_FLD__SYS_COLUMNS__MTYPE, &len); @@ -1132,6 +1185,7 @@ static const char *dict_load_virtual_none= "SYS_VIRTUAL record not found"; /** Load a virtual column "mapping" (to base columns) information from a SYS_VIRTUAL record @param[in,out] table table +@param[in] uncommitted false=READ COMMITTED, true=READ UNCOMMITTED @param[in,out] column mapped base column's dict_column_t @param[in,out] table_id table id @param[in,out] pos virtual column position @@ -1143,6 +1197,7 @@ static const char* dict_load_virtual_low( dict_table_t* table, + bool uncommitted, dict_col_t** column, table_id_t* table_id, ulint* pos, @@ -1153,10 +1208,6 @@ dict_load_virtual_low( ulint len; ulint base; - if (rec_get_deleted_flag(rec, 0)) { - return(dict_load_virtual_del); - } - if (rec_get_n_fields_old(rec) != DICT_NUM_FIELDS__SYS_VIRTUAL) { return("wrong number of columns in SYS_VIRTUAL record"); } @@ -1196,7 +1247,7 @@ dict_load_virtual_low( *base_pos = base; } - rec_get_nth_field_offs_old( + field = rec_get_nth_field_old( rec, DICT_FLD__SYS_VIRTUAL__DB_TRX_ID, &len); if (len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL) { goto err_len; @@ -1208,6 +1259,18 @@ dict_load_virtual_low( goto err_len; } + const trx_id_t trx_id = trx_read_trx_id(field); + + if (trx_id && column && !uncommitted + && trx_sys.find(nullptr, trx_id, false)) { + if (!rec_get_deleted_flag(rec, 0)) { + return dict_load_virtual_none; + } + } else if (rec_get_deleted_flag(rec, 0)) { + ut_ad(trx_id != 0); + return dict_load_virtual_del; + } + if (column != NULL) { *column = dict_table_get_nth_col(table, base); } @@ -1215,28 +1278,25 @@ dict_load_virtual_low( return(NULL); } -/********************************************************************//** -Loads definitions for table columns. */ -static -void -dict_load_columns( -/*==============*/ - dict_table_t* table, /*!< in/out: table */ - mem_heap_t* heap) /*!< in/out: memory heap - for temporary storage */ +/** Load the definitions for table columns. +@param table table +@param use_uncommitted 0=READ COMMITTED, 1=detect, 2=READ UNCOMMITTED +@param heap memory heap for temporary storage +@return error code +@retval DB_SUCCESS on success +@retval DB_SUCCESS_LOCKED_REC on success if use_uncommitted=1 +and instant ADD/DROP/reorder was detected */ +MY_ATTRIBUTE((nonnull, warn_unused_result)) +static dberr_t dict_load_columns(dict_table_t *table, unsigned use_uncommitted, + mem_heap_t *heap) { btr_pcur_t pcur; - dtuple_t* tuple; - dfield_t* dfield; - const rec_t* rec; - byte* buf; - ulint i; mtr_t mtr; ulint n_skipped = 0; ut_ad(dict_sys.locked()); - mtr_start(&mtr); + mtr.start(); dict_index_t* sys_index = dict_sys.sys_columns->indexes.start; ut_ad(!dict_sys.sys_columns->not_redundant()); @@ -1246,45 +1306,57 @@ dict_load_columns( ut_ad(name_of_col_is(dict_sys.sys_columns, sys_index, DICT_FLD__SYS_COLUMNS__PREC, "PREC")); - tuple = dtuple_create(heap, 1); - dfield = dtuple_get_nth_field(tuple, 0); - - buf = static_cast(mem_heap_alloc(heap, 8)); - mach_write_to_8(buf, table->id); - - dfield_set_data(dfield, buf, 8); - dict_index_copy_types(tuple, sys_index, 1); - - btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE, - BTR_SEARCH_LEAF, &pcur, &mtr); + dfield_t dfield; + dtuple_t tuple{ + 0,1,1,&dfield,0,nullptr +#ifdef UNIV_DEBUG + , DATA_TUPLE_MAGIC_N +#endif + }; + byte table_id[8]; + mach_write_to_8(table_id, table->id); + dfield_set_data(&dfield, table_id, 8); + dict_index_copy_types(&tuple, sys_index, 1); + pcur.btr_cur.page_cur.index = sys_index; + + dberr_t err = btr_pcur_open_on_user_rec(&tuple, + BTR_SEARCH_LEAF, &pcur, &mtr); + if (err != DB_SUCCESS) { + goto func_exit; + } ut_ad(table->n_t_cols == static_cast( table->n_cols) + static_cast(table->n_v_cols)); - for (i = 0; + for (ulint i = 0; i + DATA_N_SYS_COLS < table->n_t_cols + n_skipped; i++) { const char* err_msg; const char* name = NULL; ulint nth_v_col = ULINT_UNDEFINED; - - rec = btr_pcur_get_rec(&pcur); + const rec_t* rec = btr_pcur_get_rec(&pcur); err_msg = btr_pcur_is_on_user_rec(&pcur) - ? dict_load_column_low(table, heap, NULL, NULL, - &name, rec, &nth_v_col) + ? dict_load_column_low(table, use_uncommitted, + heap, NULL, NULL, + &name, rec, &mtr, &nth_v_col) : dict_load_column_none; if (!err_msg) { } else if (err_msg == dict_load_column_del) { n_skipped++; goto next_rec; + } else if (err_msg == dict_load_column_instant) { + err = DB_SUCCESS_LOCKED_REC; + goto func_exit; } else if (err_msg == dict_load_column_none - && strstr(table->name.m_name, - "/" TEMP_FILE_PREFIX_INNODB)) { + && strstr(table->name.m_name, + "/" TEMP_FILE_PREFIX_INNODB)) { break; } else { - ib::fatal() << err_msg << " for table " << table->name; + ib::error() << err_msg << " for table " << table->name; + err = DB_CORRUPTION; + goto func_exit; } /* Note: Currently we have one DOC_ID column that is @@ -1304,6 +1376,8 @@ dict_load_columns( the flag is set before the table is created. */ if (table->fts == NULL) { table->fts = fts_create(table); + table->fts->cache = fts_cache_create(table); + DICT_TF2_FLAG_SET(table, DICT_TF2_FTS_AUX_HEX_NAME); } ut_a(table->fts->doc_col == ULINT_UNDEFINED); @@ -1325,40 +1399,33 @@ dict_load_columns( btr_pcur_move_to_next_user_rec(&pcur, &mtr); } - btr_pcur_close(&pcur); - mtr_commit(&mtr); +func_exit: + mtr.commit(); + return err; } /** Loads SYS_VIRTUAL info for one virtual column -@param[in,out] table table -@param[in] nth_v_col virtual column sequence num -@param[in,out] v_col virtual column -@param[in,out] heap memory heap -*/ +@param table table definition +@param uncommitted false=READ COMMITTED, true=READ UNCOMMITTED +@param nth_v_col virtual column position */ +MY_ATTRIBUTE((nonnull, warn_unused_result)) static -void -dict_load_virtual_one_col( - dict_table_t* table, - ulint nth_v_col, - dict_v_col_t* v_col, - mem_heap_t* heap) +dberr_t +dict_load_virtual_col(dict_table_t *table, bool uncommitted, ulint nth_v_col) { + const dict_v_col_t* v_col = dict_table_get_nth_v_col(table, nth_v_col); + + if (v_col->num_base == 0) { + return DB_SUCCESS; + } + dict_index_t* sys_virtual_index; btr_pcur_t pcur; - dtuple_t* tuple; - dfield_t* dfield; - byte* buf; - ulint i = 0; mtr_t mtr; - ulint skipped = 0; ut_ad(dict_sys.locked()); - if (v_col->num_base == 0) { - return; - } - - mtr_start(&mtr); + mtr.start(); sys_virtual_index = dict_sys.sys_virtual->indexes.start; ut_ad(!dict_sys.sys_virtual->not_redundant()); @@ -1366,35 +1433,35 @@ dict_load_virtual_one_col( ut_ad(name_of_col_is(dict_sys.sys_virtual, sys_virtual_index, DICT_FLD__SYS_VIRTUAL__POS, "POS")); - tuple = dtuple_create(heap, 2); - - /* table ID field */ - dfield = dtuple_get_nth_field(tuple, 0); - - buf = static_cast(mem_heap_alloc(heap, 8)); - mach_write_to_8(buf, table->id); - - dfield_set_data(dfield, buf, 8); - - /* virtual column pos field */ - dfield = dtuple_get_nth_field(tuple, 1); - - buf = static_cast(mem_heap_alloc(heap, 4)); - ulint vcol_pos = dict_create_v_col_pos(nth_v_col, v_col->m_col.ind); - mach_write_to_4(buf, vcol_pos); - - dfield_set_data(dfield, buf, 4); - - dict_index_copy_types(tuple, sys_virtual_index, 2); - - btr_pcur_open_on_user_rec(sys_virtual_index, tuple, PAGE_CUR_GE, - BTR_SEARCH_LEAF, &pcur, &mtr); + dfield_t dfield[2]; + dtuple_t tuple{ + 0,2,2,dfield,0,nullptr +#ifdef UNIV_DEBUG + , DATA_TUPLE_MAGIC_N +#endif + }; + byte table_id[8], vcol_pos[4]; + mach_write_to_8(table_id, table->id); + dfield_set_data(&dfield[0], table_id, 8); + mach_write_to_4(vcol_pos, + dict_create_v_col_pos(nth_v_col, v_col->m_col.ind)); + dfield_set_data(&dfield[1], vcol_pos, 4); + + dict_index_copy_types(&tuple, sys_virtual_index, 2); + pcur.btr_cur.page_cur.index = sys_virtual_index; + + dberr_t err = btr_pcur_open_on_user_rec(&tuple, + BTR_SEARCH_LEAF, &pcur, &mtr); + if (err != DB_SUCCESS) { + goto func_exit; + } - for (i = 0; i < unsigned{v_col->num_base} + skipped; i++) { + for (ulint i = 0, skipped = 0; + i < unsigned{v_col->num_base} + skipped; i++) { ulint pos; const char* err_msg = btr_pcur_is_on_user_rec(&pcur) - ? dict_load_virtual_low(table, + ? dict_load_virtual_low(table, uncommitted, &v_col->base_col[i - skipped], NULL, &pos, NULL, @@ -1402,7 +1469,7 @@ dict_load_virtual_one_col( : dict_load_virtual_none; if (!err_msg) { - ut_ad(pos == vcol_pos); + ut_ad(pos == mach_read_from_4(vcol_pos)); } else if (err_msg == dict_load_virtual_del) { skipped++; } else if (err_msg == dict_load_virtual_none @@ -1410,31 +1477,29 @@ dict_load_virtual_one_col( "/" TEMP_FILE_PREFIX_INNODB)) { break; } else { - ib::fatal() << err_msg << " for table " << table->name; + ib::error() << err_msg << " for table " << table->name; + err = DB_CORRUPTION; + break; } btr_pcur_move_to_next_user_rec(&pcur, &mtr); } - btr_pcur_close(&pcur); - mtr_commit(&mtr); +func_exit: + mtr.commit(); + return err; } /** Loads info from SYS_VIRTUAL for virtual columns. -@param[in,out] table table -@param[in] heap memory heap -*/ -static -void -dict_load_virtual( - dict_table_t* table, - mem_heap_t* heap) +@param table table definition +@param uncommitted false=READ COMMITTED, true=READ UNCOMMITTED */ +MY_ATTRIBUTE((nonnull, warn_unused_result)) +static dberr_t dict_load_virtual(dict_table_t *table, bool uncommitted) { - for (ulint i = 0; i < table->n_v_cols; i++) { - dict_v_col_t* v_col = dict_table_get_nth_v_col(table, i); - - dict_load_virtual_one_col(table, i, v_col, heap); - } + for (ulint i= 0; i < table->n_v_cols; i++) + if (dberr_t err= dict_load_virtual_col(table, uncommitted, i)) + return err; + return DB_SUCCESS; } /** Error message for a delete-marked record in dict_load_field_low() */ @@ -1451,6 +1516,8 @@ dict_load_field_low( byte* index_id, /*!< in/out: index id (8 bytes) an "in" value if index != NULL and "out" if index == NULL */ + bool uncommitted, /*!< in: false=READ COMMITTED, + true=READ UNCOMMITTED */ dict_index_t* index, /*!< in/out: index, could be NULL if we just populate a dict_field_t struct with information from @@ -1461,21 +1528,20 @@ dict_load_field_low( byte* last_index_id, /*!< in: last index id */ mem_heap_t* heap, /*!< in/out: memory heap for temporary storage */ + mtr_t* mtr, /*!< in/out: mini-transaction */ const rec_t* rec) /*!< in: SYS_FIELDS record */ { const byte* field; ulint len; unsigned pos_and_prefix_len; unsigned prefix_len; + bool descending; bool first_field; ulint position; /* Either index or sys_field is supplied, not both */ - ut_a((!index) || (!sys_field)); - - if (rec_get_deleted_flag(rec, 0)) { - return(dict_load_field_del); - } + ut_ad((!index) != (!sys_field)); + ut_ad((!index) == !mtr); if (rec_get_n_fields_old(rec) != DICT_NUM_FIELDS__SYS_FIELDS) { return("wrong number of columns in SYS_FIELDS record"); @@ -1522,14 +1588,16 @@ dict_load_field_low( } if (first_field || pos_and_prefix_len > 0xFFFFUL) { - prefix_len = pos_and_prefix_len & 0xFFFFUL; + prefix_len = pos_and_prefix_len & 0x7FFFUL; + descending = (pos_and_prefix_len & 0x8000UL); position = (pos_and_prefix_len & 0xFFFF0000UL) >> 16; } else { prefix_len = 0; + descending = false; position = pos_and_prefix_len & 0xFFFFUL; } - rec_get_nth_field_offs_old( + field = rec_get_nth_field_old( rec, DICT_FLD__SYS_FIELDS__DB_TRX_ID, &len); if (len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL) { goto err_len; @@ -1540,6 +1608,32 @@ dict_load_field_low( goto err_len; } + const trx_id_t trx_id = trx_read_trx_id(field); + + if (!trx_id) { + ut_ad(!rec_get_deleted_flag(rec, 0)); + } else if (!mtr || uncommitted) { + } else if (trx_sys.find(nullptr, trx_id, false)) { + const auto savepoint = mtr->get_savepoint(); + dict_index_t* sys_field = UT_LIST_GET_FIRST( + dict_sys.sys_fields->indexes); + rec_offs* offsets = rec_get_offsets( + rec, sys_field, nullptr, true, ULINT_UNDEFINED, &heap); + const rec_t* old_vers; + row_vers_build_for_semi_consistent_read( + nullptr, rec, mtr, sys_field, &offsets, &heap, + heap, &old_vers, nullptr); + mtr->rollback_to_savepoint(savepoint); + rec = old_vers; + if (!old_vers || rec_get_deleted_flag(rec, 0)) { + return dict_load_field_none; + } + } + + if (rec_get_deleted_flag(rec, 0)) { + return(dict_load_field_del); + } + field = rec_get_nth_field_old( rec, DICT_FLD__SYS_FIELDS__COL_NAME, &len); if (len == 0 || len == UNIV_SQL_NULL) { @@ -1549,62 +1643,65 @@ dict_load_field_low( if (index) { dict_mem_index_add_field( index, mem_heap_strdupl(heap, (const char*) field, len), - prefix_len); + prefix_len, descending); } else { - ut_a(sys_field); - ut_a(pos); - sys_field->name = mem_heap_strdupl( heap, (const char*) field, len); sys_field->prefix_len = prefix_len & ((1U << 12) - 1); + sys_field->descending = descending; *pos = position; } return(NULL); } -/********************************************************************//** -Loads definitions for index fields. -@return DB_SUCCESS if ok, DB_CORRUPTION if corruption */ -static -ulint -dict_load_fields( -/*=============*/ - dict_index_t* index, /*!< in/out: index whose fields to load */ - mem_heap_t* heap) /*!< in: memory heap for temporary storage */ +/** +Load definitions for index fields. +@param index index whose fields are to be loaded +@param uncommitted false=READ COMMITTED, true=READ UNCOMMITTED +@param heap memory heap for temporary storage +@return error code +@return DB_SUCCESS if the fields were loaded successfully */ +static dberr_t dict_load_fields(dict_index_t *index, bool uncommitted, + mem_heap_t *heap) { btr_pcur_t pcur; - dtuple_t* tuple; - dfield_t* dfield; - byte* buf; - ulint i; mtr_t mtr; - dberr_t error; ut_ad(dict_sys.locked()); - mtr_start(&mtr); + mtr.start(); dict_index_t* sys_index = dict_sys.sys_fields->indexes.start; ut_ad(!dict_sys.sys_fields->not_redundant()); ut_ad(name_of_col_is(dict_sys.sys_fields, sys_index, DICT_FLD__SYS_FIELDS__COL_NAME, "COL_NAME")); - tuple = dtuple_create(heap, 1); - dfield = dtuple_get_nth_field(tuple, 0); - - buf = static_cast(mem_heap_alloc(heap, 8)); - mach_write_to_8(buf, index->id); - - dfield_set_data(dfield, buf, 8); - dict_index_copy_types(tuple, sys_index, 1); + dfield_t dfield; + dtuple_t tuple{ + 0,1,1,&dfield,0,nullptr +#ifdef UNIV_DEBUG + , DATA_TUPLE_MAGIC_N +#endif + }; + byte index_id[8]; + mach_write_to_8(index_id, index->id); + dfield_set_data(&dfield, index_id, 8); + dict_index_copy_types(&tuple, sys_index, 1); + pcur.btr_cur.page_cur.index = sys_index; + + dberr_t error = btr_pcur_open_on_user_rec(&tuple, BTR_SEARCH_LEAF, + &pcur, &mtr); + if (error != DB_SUCCESS) { + goto func_exit; + } - btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE, - BTR_SEARCH_LEAF, &pcur, &mtr); - for (i = 0; i < index->n_fields; i++) { + for (ulint i = 0; i < index->n_fields; i++) { const char *err_msg = btr_pcur_is_on_user_rec(&pcur) - ? dict_load_field_low(buf, index, NULL, NULL, NULL, - heap, btr_pcur_get_rec(&pcur)) + ? dict_load_field_low(index_id, uncommitted, index, + nullptr, nullptr, nullptr, + heap, &mtr, + btr_pcur_get_rec(&pcur)) : dict_load_field_none; if (!err_msg) { @@ -1622,17 +1719,15 @@ dict_load_fields( << index->table->name; } error = DB_CORRUPTION; - goto func_exit; + break; } btr_pcur_move_to_next_user_rec(&pcur, &mtr); } - error = DB_SUCCESS; func_exit: - btr_pcur_close(&pcur); - mtr_commit(&mtr); - return(error); + mtr.commit(); + return error; } /** Error message for a delete-marked record in dict_load_index_low() */ @@ -1643,36 +1738,32 @@ static const char *dict_load_index_none= "SYS_INDEXES record not found"; static const char *dict_load_table_flags= "incorrect flags in SYS_TABLES"; /** Load an index definition from a SYS_INDEXES record to dict_index_t. -If allocate=TRUE, we will create a dict_index_t structure and fill it -accordingly. If allocated=FALSE, the dict_index_t will be supplied by -the caller and filled with information read from the record. @return error message @retval NULL on success */ static const char* dict_load_index_low( byte* table_id, /*!< in/out: table id (8 bytes), - an "in" value if allocate=TRUE - and "out" when allocate=FALSE */ + an "in" value if mtr + and "out" when !mtr */ + bool uncommitted, /*!< in: false=READ COMMITTED, + true=READ UNCOMMITTED */ mem_heap_t* heap, /*!< in/out: temporary memory heap */ const rec_t* rec, /*!< in: SYS_INDEXES record */ - ibool allocate, /*!< in: TRUE=allocate *index, - FALSE=fill in a pre-allocated - *index */ + mtr_t* mtr, /*!< in/out: mini-transaction, + or nullptr if a pre-allocated + *index is to be filled in */ + dict_table_t* table, /*!< in/out: table, or NULL */ dict_index_t** index) /*!< out,own: index, or NULL */ { const byte* field; ulint len; - ulint name_len; - char* name_buf; index_id_t id; ulint n_fields; ulint type; unsigned merge_threshold; - if (allocate) { - /* If allocate=TRUE, no dict_index_t will - be supplied. Initialize "*index" to NULL */ + if (mtr) { *index = NULL; } @@ -1707,7 +1798,7 @@ dict_load_index_low( return("incorrect column length in SYS_INDEXES"); } - if (!allocate) { + if (!mtr) { /* We are reading a SYS_INDEXES record. Copy the table_id */ memcpy(table_id, (const char*) field, 8); } else if (memcmp(field, table_id, 8)) { @@ -1724,7 +1815,7 @@ dict_load_index_low( id = mach_read_from_8(field); - rec_get_nth_field_offs_old( + field = rec_get_nth_field_old( rec, DICT_FLD__SYS_INDEXES__DB_TRX_ID, &len); if (len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL) { goto err_len; @@ -1735,15 +1826,31 @@ dict_load_index_low( goto err_len; } - field = rec_get_nth_field_old( - rec, DICT_FLD__SYS_INDEXES__NAME, &name_len); - if (name_len == 0 || name_len == UNIV_SQL_NULL) { - goto err_len; + const trx_id_t trx_id = trx_read_trx_id(field); + if (!trx_id) { + ut_ad(!rec_get_deleted_flag(rec, 0)); + } else if (!mtr || uncommitted) { + } else if (trx_sys.find(nullptr, trx_id, false)) { + const auto savepoint = mtr->get_savepoint(); + dict_index_t* sys_index = UT_LIST_GET_FIRST( + dict_sys.sys_indexes->indexes); + rec_offs* offsets = rec_get_offsets( + rec, sys_index, nullptr, true, ULINT_UNDEFINED, &heap); + const rec_t* old_vers; + row_vers_build_for_semi_consistent_read( + nullptr, rec, mtr, sys_index, &offsets, &heap, + heap, &old_vers, nullptr); + mtr->rollback_to_savepoint(savepoint); + rec = old_vers; + if (!old_vers || rec_get_deleted_flag(rec, 0)) { + return dict_load_index_none; + } + } else if (rec_get_deleted_flag(rec, 0) + && rec[8 + 8 + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN] + != static_cast(*TEMP_INDEX_PREFIX_STR) + && table->def_trx_id < trx_id) { + table->def_trx_id = trx_id; } - ut_ad(field == &rec[8 + 8 + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN]); - - name_buf = mem_heap_strdupl(heap, (const char*) field, - name_len); field = rec_get_nth_field_old( rec, DICT_FLD__SYS_INDEXES__N_FIELDS, &len); @@ -1768,16 +1875,27 @@ dict_load_index_low( goto err_len; } + ut_d(const auto name_offs =) + rec_get_nth_field_offs_old(rec, DICT_FLD__SYS_INDEXES__NAME, &len); + ut_ad(name_offs == 8 + 8 + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); + + if (len == 0 || len == UNIV_SQL_NULL) { + goto err_len; + } + if (rec_get_deleted_flag(rec, 0)) { - return(dict_load_index_del); + return dict_load_index_del; } - if (allocate) { - *index = dict_mem_index_create(NULL, name_buf, type, n_fields); - } else { - ut_a(*index); + char* name = mem_heap_strdupl(heap, reinterpret_cast(rec) + + (8 + 8 + DATA_TRX_ID_LEN + + DATA_ROLL_PTR_LEN), + len); - dict_mem_fill_index_struct(*index, NULL, name_buf, + if (mtr) { + *index = dict_mem_index_create(table, name, type, n_fields); + } else { + dict_mem_fill_index_struct(*index, nullptr, name, type, n_fields); } @@ -1789,33 +1907,27 @@ dict_load_index_low( return(NULL); } -/********************************************************************//** -Loads definitions for table indexes. Adds them to the data dictionary -cache. -@return DB_SUCCESS if ok, DB_CORRUPTION if corruption of dictionary -table or DB_UNSUPPORTED if table has unknown index type */ +/** Load definitions for table indexes. Adds them to the data dictionary cache. +@param table table definition +@param uncommitted false=READ COMMITTED, true=READ UNCOMMITTED +@param heap memory heap for temporary storage +@param ignore_err errors to be ignored when loading the index definition +@return error code +@retval DB_SUCCESS if all indexes were successfully loaded +@retval DB_CORRUPTION if corruption of dictionary table +@retval DB_UNSUPPORTED if table has unknown index type */ static MY_ATTRIBUTE((nonnull)) -dberr_t -dict_load_indexes( -/*==============*/ - dict_table_t* table, /*!< in/out: table */ - mem_heap_t* heap, /*!< in: memory heap for temporary storage */ - dict_err_ignore_t ignore_err) - /*!< in: error to be ignored when - loading the index definition */ +dberr_t dict_load_indexes(dict_table_t *table, bool uncommitted, + mem_heap_t *heap, dict_err_ignore_t ignore_err) { dict_index_t* sys_index; btr_pcur_t pcur; - dtuple_t* tuple; - dfield_t* dfield; - const rec_t* rec; - byte* buf; + byte table_id[8]; mtr_t mtr; - dberr_t error = DB_SUCCESS; ut_ad(dict_sys.locked()); - mtr_start(&mtr); + mtr.start(); sys_index = dict_sys.sys_indexes->indexes.start; ut_ad(!dict_sys.sys_indexes->not_redundant()); @@ -1824,22 +1936,28 @@ dict_load_indexes( ut_ad(name_of_col_is(dict_sys.sys_indexes, sys_index, DICT_FLD__SYS_INDEXES__PAGE_NO, "PAGE_NO")); - tuple = dtuple_create(heap, 1); - dfield = dtuple_get_nth_field(tuple, 0); - - buf = static_cast(mem_heap_alloc(heap, 8)); - mach_write_to_8(buf, table->id); - - dfield_set_data(dfield, buf, 8); - dict_index_copy_types(tuple, sys_index, 1); + dfield_t dfield; + dtuple_t tuple{ + 0,1,1,&dfield,0,nullptr +#ifdef UNIV_DEBUG + , DATA_TUPLE_MAGIC_N +#endif + }; + mach_write_to_8(table_id, table->id); + dfield_set_data(&dfield, table_id, 8); + dict_index_copy_types(&tuple, sys_index, 1); + pcur.btr_cur.page_cur.index = sys_index; + + dberr_t error = btr_pcur_open_on_user_rec(&tuple, BTR_SEARCH_LEAF, + &pcur, &mtr); + if (error != DB_SUCCESS) { + goto func_exit; + } - btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE, - BTR_SEARCH_LEAF, &pcur, &mtr); while (btr_pcur_is_on_user_rec(&pcur)) { dict_index_t* index = NULL; const char* err_msg; - - rec = btr_pcur_get_rec(&pcur); + const rec_t* rec = btr_pcur_get_rec(&pcur); if ((ignore_err & DICT_ERR_IGNORE_RECOVER_LOCK) && (rec_get_n_fields_old(rec) == DICT_NUM_FIELDS__SYS_INDEXES @@ -1863,7 +1981,8 @@ dict_load_indexes( } } - err_msg = dict_load_index_low(buf, heap, rec, TRUE, &index); + err_msg = dict_load_index_low(table_id, uncommitted, heap, rec, + &mtr, table, &index); ut_ad(!index == !!err_msg); if (err_msg == dict_load_index_none) { @@ -1873,10 +1992,6 @@ dict_load_indexes( } if (err_msg == dict_load_index_del) { - const trx_id_t id = mach_read_from_6(rec + 8 + 8); - if (id > table->def_trx_id) { - table->def_trx_id = id; - } goto next_rec; } else if (err_msg) { ib::error() << err_msg; @@ -1887,9 +2002,10 @@ dict_load_indexes( goto func_exit; } else if (rec[8 + 8 + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN] == static_cast(*TEMP_INDEX_PREFIX_STR)) { + dict_mem_index_free(index); goto next_rec; } else { - const trx_id_t id = mach_read_from_6(rec + 8 + 8); + const trx_id_t id = trx_read_trx_id(rec + 8 + 8); if (id > table->def_trx_id) { table->def_trx_id = id; } @@ -1902,7 +2018,7 @@ dict_load_indexes( if (ignore_err != DICT_ERR_IGNORE_DROP && index->is_corrupted() && index->is_clust()) { dict_mem_index_free(index); - error = DB_INDEX_CORRUPT; + error = DB_TABLE_CORRUPT; goto func_exit; } @@ -1929,7 +2045,8 @@ dict_load_indexes( } else if (index->page == FIL_NULL && table->is_readable() && (!(index->type & DICT_FTS))) { - if (ignore_err != DICT_ERR_IGNORE_DROP) { + if (!uncommitted + && ignore_err != DICT_ERR_IGNORE_DROP) { ib::error_or_warn(!(ignore_err & DICT_ERR_IGNORE_INDEX)) << "Index " << index->name @@ -1951,8 +2068,11 @@ dict_load_indexes( dictionary cache for such metadata corruption, since we would always be able to set it when loading the dictionary cache */ - index->table = table; - dict_set_corrupted_index_cache_only(index); + if (index->is_clust()) { + index->table->corrupted = true; + index->table->file_unreadable = true; + } + index->type |= DICT_CORRUPT; } else if (!dict_index_is_clust(index) && NULL == dict_table_get_first_index(table)) { @@ -1970,8 +2090,10 @@ dict_load_indexes( of the database server */ dict_mem_index_free(index); } else { - index->table = table; - dict_load_fields(index, heap); + error = dict_load_fields(index, uncommitted, heap); + if (error != DB_SUCCESS) { + goto func_exit; + } /* The data dictionary tables should never contain invalid index definitions. If we ignored this error @@ -2011,8 +2133,11 @@ dict_load_indexes( ut_ad(table->fts_doc_id_index == NULL); if (table->fts != NULL) { - table->fts_doc_id_index = dict_table_get_index_on_name( + dict_index_t *idx = dict_table_get_index_on_name( table, FTS_DOC_ID_INDEX_NAME); + if (idx && dict_index_is_unique(idx)) { + table->fts_doc_id_index = idx; + } } /* If the table contains FTS indexes, populate table->fts->indexes */ @@ -2024,122 +2149,72 @@ dict_load_indexes( } func_exit: - btr_pcur_close(&pcur); - mtr_commit(&mtr); - - return(error); + mtr.commit(); + return error; } /** Load a table definition from a SYS_TABLES record to dict_table_t. Do not load any columns or indexes. -@param[in] name Table name +@param[in,out] mtr mini-transaction +@param[in] uncommitted whether to use READ UNCOMMITTED isolation level @param[in] rec SYS_TABLES record @param[out,own] table table, or nullptr @return error message @retval nullptr on success */ -const char *dict_load_table_low(const span &name, +const char *dict_load_table_low(mtr_t *mtr, bool uncommitted, const rec_t *rec, dict_table_t **table) { table_id_t table_id; uint32_t space_id, t_num, flags, flags2; ulint n_cols, n_v_col; + trx_id_t trx_id; if (const char* error_text = dict_sys_tables_rec_check(rec)) { *table = NULL; return(error_text); } - if (!dict_sys_tables_rec_read(rec, name, &table_id, &space_id, - &t_num, &flags, &flags2)) { + if (auto r = dict_sys_tables_rec_read(rec, uncommitted, mtr, + &table_id, &space_id, + &t_num, &flags, &flags2, + &trx_id)) { *table = NULL; - return(dict_load_table_flags); + return r == READ_ERROR ? dict_load_table_flags : nullptr; } dict_table_decode_n_col(t_num, &n_cols, &n_v_col); - *table = dict_table_t::create(name, nullptr, n_cols + n_v_col, - n_v_col, flags, flags2); + *table = dict_table_t::create( + span(reinterpret_cast(rec), + rec_get_field_start_offs(rec, 1)), + nullptr, n_cols + n_v_col, n_v_col, flags, flags2); (*table)->space_id = space_id; (*table)->id = table_id; (*table)->file_unreadable = !!(flags2 & DICT_TF2_DISCARDED); - - ulint len; - (*table)->def_trx_id = mach_read_from_6( - rec_get_nth_field_old(rec, DICT_FLD__SYS_TABLES__DB_TRX_ID, - &len)); - ut_ad(len == DATA_TRX_ID_LEN); - static_assert(DATA_TRX_ID_LEN == 6, "compatibility"); + (*table)->def_trx_id = trx_id; return(NULL); } -/********************************************************************//** -Using the table->heap, copy the null-terminated filepath into -table->data_dir_path and replace the 'databasename/tablename.ibd' -portion with 'tablename'. -This allows SHOW CREATE TABLE to return the correct DATA DIRECTORY path. -Make this data directory path only if it has not yet been saved. */ -static -void -dict_save_data_dir_path( -/*====================*/ - dict_table_t* table, /*!< in/out: table */ - const char* filepath) /*!< in: filepath of tablespace */ -{ - ut_ad(dict_sys.frozen()); - ut_a(DICT_TF_HAS_DATA_DIR(table->flags)); - - ut_a(!table->data_dir_path); - ut_a(filepath); - - /* Be sure this filepath is not the default filepath. */ - if (char* default_filepath = fil_make_filepath(nullptr, table->name, - IBD, false)) { - if (0 != strcmp(filepath, default_filepath)) { - ulint pathlen = strlen(filepath); - ut_a(pathlen < OS_FILE_MAX_PATH); - ut_a(0 == strcmp(filepath + pathlen - 4, DOT_IBD)); - - table->data_dir_path = mem_heap_strdup( - table->heap, filepath); - os_file_make_data_dir_path(table->data_dir_path); - } - - ut_free(default_filepath); - } -} - /** Make sure the data_file_name is saved in dict_table_t if needed. -@param[in,out] table Table object -@param[in] dict_locked dict_sys.frozen() */ -void dict_get_and_save_data_dir_path(dict_table_t* table, bool dict_locked) +@param[in,out] table Table object */ +void dict_get_and_save_data_dir_path(dict_table_t *table) { - ut_ad(!table->is_temporary()); - ut_ad(!table->space || table->space->id == table->space_id); + ut_ad(!table->is_temporary()); + ut_ad(!table->space || table->space->id == table->space_id); - if (!table->data_dir_path && table->space_id && table->space) { - if (!dict_locked) { - dict_sys.freeze(SRW_LOCK_CALL); - } - - table->flags |= 1 << DICT_TF_POS_DATA_DIR - & ((1U << DICT_TF_BITS) - 1); - dict_save_data_dir_path(table, - table->space->chain.start->name); - - if (table->data_dir_path == NULL) { - /* Since we did not set the table data_dir_path, - unset the flag. This does not change - SYS_TABLES or FSP_SPACE_FLAGS on the header page - of the tablespace, but it makes dict_table_t - consistent. */ - table->flags &= ~DICT_TF_MASK_DATA_DIR - & ((1U << DICT_TF_BITS) - 1); - } - - if (!dict_locked) { - dict_sys.unfreeze(); - } - } + if (!table->data_dir_path && table->space_id && table->space) + { + const char *filepath= table->space->chain.start->name; + if (strncmp(fil_path_to_mysql_datadir, filepath, + strlen(fil_path_to_mysql_datadir))) + { + table->lock_mutex_lock(); + table->flags|= 1 << DICT_TF_POS_DATA_DIR & ((1U << DICT_TF_BITS) - 1); + table->data_dir_path= mem_heap_strdup(table->heap, filepath); + os_file_make_data_dir_path(table->data_dir_path); + table->lock_mutex_unlock(); + } + } } /** Opens a tablespace for dict_load_table_one() @@ -2193,7 +2268,7 @@ dict_load_tablespace( char* filepath = NULL; if (DICT_TF_HAS_DATA_DIR(table->flags)) { /* This will set table->data_dir_path from fil_system */ - dict_get_and_save_data_dir_path(table, true); + dict_get_and_save_data_dir_path(table); if (table->data_dir_path) { filepath = fil_make_filepath( @@ -2202,7 +2277,7 @@ dict_load_tablespace( } table->space = fil_ibd_open( - true, FIL_TYPE_TABLESPACE, table->space_id, + 2, FIL_TYPE_TABLESPACE, table->space_id, dict_tf_to_fsp_flags(table->flags), {table->name.m_name, strlen(table->name.m_name)}, filepath); @@ -2234,14 +2309,7 @@ static dict_table_t *dict_load_table_one(const span &name, dict_err_ignore_t ignore_err, dict_names_t &fk_tables) { - dberr_t err; btr_pcur_t pcur; - dtuple_t* tuple; - mem_heap_t* heap; - dfield_t* dfield; - const rec_t* rec; - const byte* field; - ulint len; mtr_t mtr; DBUG_ENTER("dict_load_table_one"); @@ -2250,10 +2318,6 @@ static dict_table_t *dict_load_table_one(const span &name, ut_ad(dict_sys.locked()); - heap = mem_heap_create(32000); - - mtr_start(&mtr); - dict_index_t *sys_index = dict_sys.sys_tables->indexes.start; ut_ad(!dict_sys.sys_tables->not_redundant()); ut_ad(name_of_col_is(dict_sys.sys_tables, sys_index, @@ -2267,51 +2331,79 @@ static dict_table_t *dict_load_table_one(const span &name, ut_ad(name_of_col_is(dict_sys.sys_tables, sys_index, DICT_FLD__SYS_TABLES__SPACE, "SPACE")); - tuple = dtuple_create(heap, 1); - dfield = dtuple_get_nth_field(tuple, 0); - - dfield_set_data(dfield, name.data(), name.size()); - dict_index_copy_types(tuple, sys_index, 1); + dfield_t dfield; + dtuple_t tuple{ + 0,1,1,&dfield,0,nullptr +#ifdef UNIV_DEBUG + , DATA_TUPLE_MAGIC_N +#endif + }; + dfield_set_data(&dfield, name.data(), name.size()); + dict_index_copy_types(&tuple, sys_index, 1); + pcur.btr_cur.page_cur.index = sys_index; - btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE, - BTR_SEARCH_LEAF, &pcur, &mtr); - rec = btr_pcur_get_rec(&pcur); + bool uncommitted = false; +reload: + mtr.start(); + dberr_t err = btr_pcur_open_on_user_rec(&tuple, + BTR_SEARCH_LEAF, &pcur, &mtr); - if (!btr_pcur_is_on_user_rec(&pcur) - || rec_get_deleted_flag(rec, 0)) { + if (err != DB_SUCCESS || !btr_pcur_is_on_user_rec(&pcur)) { /* Not found */ err_exit: - btr_pcur_close(&pcur); - mtr_commit(&mtr); - mem_heap_free(heap); - - DBUG_RETURN(NULL); + mtr.commit(); + DBUG_RETURN(nullptr); } - field = rec_get_nth_field_old( - rec, DICT_FLD__SYS_TABLES__NAME, &len); + const rec_t* rec = btr_pcur_get_rec(&pcur); /* Check if the table name in record is the searched one */ - if (len != name.size() || memcmp(name.data(), field, len)) { + if (rec_get_field_start_offs(rec, 1) != name.size() + || memcmp(name.data(), rec, name.size())) { goto err_exit; } dict_table_t* table; - if (const char* err_msg = dict_load_table_low(name, rec, &table)) { + if (const char* err_msg = + dict_load_table_low(&mtr, uncommitted, rec, &table)) { if (err_msg != dict_load_table_flags) { ib::error() << err_msg; } goto err_exit; } + if (!table) { + goto err_exit; + } - btr_pcur_close(&pcur); - mtr_commit(&mtr); + const unsigned use_uncommitted = uncommitted + ? 2 + : table->id == mach_read_from_8( + rec + rec_get_field_start_offs( + rec, DICT_FLD__SYS_TABLES__ID)); - dict_load_tablespace(table, ignore_err); + mtr.commit(); + + mem_heap_t* heap = mem_heap_create(32000); - dict_load_columns(table, heap); + dict_load_tablespace(table, ignore_err); - dict_load_virtual(table, heap); + switch (dict_load_columns(table, use_uncommitted, heap)) { + case DB_SUCCESS_LOCKED_REC: + ut_ad(!uncommitted); + uncommitted = true; + dict_mem_table_free(table); + mem_heap_free(heap); + goto reload; + case DB_SUCCESS: + if (!dict_load_virtual(table, uncommitted)) { + break; + } + /* fall through */ + default: + dict_mem_table_free(table); + mem_heap_free(heap); + DBUG_RETURN(nullptr); + } dict_table_add_system_columns(table, heap); @@ -2333,9 +2425,9 @@ static dict_table_t *dict_load_table_one(const span &name, ? DICT_ERR_IGNORE_ALL : ignore_err; - err = dict_load_indexes(table, heap, index_load_err); + err = dict_load_indexes(table, uncommitted, heap, index_load_err); - if (err == DB_INDEX_CORRUPT) { + if (err == DB_TABLE_CORRUPT) { /* Refuse to load the table if the table has a corrupted cluster index */ ut_ad(index_load_err != DICT_ERR_IGNORE_DROP); @@ -2343,8 +2435,8 @@ static dict_table_t *dict_load_table_one(const span &name, << table->name; evict: dict_sys.remove(table); - table = NULL; - goto func_exit; + mem_heap_free(heap); + DBUG_RETURN(nullptr); } if (err != DB_SUCCESS || !table->is_readable()) { @@ -2355,7 +2447,7 @@ static dict_table_t *dict_load_table_one(const span &name, corrupted: table->corrupted = true; table->file_unreadable = true; - err = DB_CORRUPTION; + err = DB_TABLE_CORRUPT; } else if (table->space->id && ignore_err == DICT_ERR_IGNORE_DROP) { /* Do not bother to load data from .ibd files @@ -2399,16 +2491,13 @@ static dict_table_t *dict_load_table_one(const span &name, changed when dict_load_foreigns() is called below */ table->fk_max_recusive_level = 0; - /* If the force recovery flag is set, we open the table irrespective - of the error condition, since the user may want to dump data from the - clustered index. However we load the foreign key information only if + /* We will load the foreign key information only if all indexes were loaded. */ if (!table->is_readable()) { /* Don't attempt to load the indexes from disk. */ } else if (err == DB_SUCCESS) { - err = dict_load_foreigns(table->name.m_name, NULL, - true, true, - ignore_err, fk_tables); + err = dict_load_foreigns(table->name.m_name, nullptr, + 0, true, ignore_err, fk_tables); if (err != DB_SUCCESS) { ib::warn() << "Load table " << table->name @@ -2422,7 +2511,6 @@ static dict_table_t *dict_load_table_one(const span &name, } } -func_exit: mem_heap_free(heap); ut_ad(!table @@ -2437,7 +2525,8 @@ static dict_table_t *dict_load_table_one(const span &name, /* the table->fts could be created in dict_load_column when a user defined FTS_DOC_ID is present, but no FTS */ - fts_free(table); + table->fts->~fts_t(); + table->fts = nullptr; } else if (fts_optimize_wq) { fts_optimize_add_table(table); } else if (table->can_be_evicted) { @@ -2511,18 +2600,17 @@ dict_load_table_on_id( mach_write_to_8(id_buf, table_id); dfield_set_data(&dfield, id_buf, 8); dict_index_copy_types(&tuple, sys_table_ids, 1); + pcur.btr_cur.page_cur.index = sys_table_ids; - btr_pcur_open_on_user_rec(sys_table_ids, &tuple, PAGE_CUR_GE, - BTR_SEARCH_LEAF, &pcur, &mtr); - - - const rec_t* rec = btr_pcur_get_rec(&pcur); dict_table_t* table = nullptr; - if (page_rec_is_user_rec(rec)) { + if (btr_pcur_open_on_user_rec(&tuple, BTR_SEARCH_LEAF, &pcur, &mtr) + == DB_SUCCESS + && btr_pcur_is_on_user_rec(&pcur)) { /*---------------------------------------------------*/ /* Now we have the record in the secondary index containing the table ID and NAME */ + const rec_t* rec = btr_pcur_get_rec(&pcur); check_rec: field = rec_get_nth_field_old( rec, DICT_FLD__SYS_TABLE_IDS__ID, &len); @@ -2530,11 +2618,16 @@ dict_load_table_on_id( /* Check if the table id in record is the one searched for */ if (table_id == mach_read_from_8(field)) { - if (rec_get_deleted_flag(rec, 0)) { - /* Until purge has completed, there - may be delete-marked duplicate records - for the same SYS_TABLES.ID, but different - SYS_TABLES.NAME. */ + field = rec_get_nth_field_old(rec, + DICT_FLD__SYS_TABLE_IDS__NAME, &len); + table = dict_sys.load_table( + {reinterpret_cast(field), + len}, ignore_err); + if (table && table->id != table_id) { + ut_ad(rec_get_deleted_flag(rec, 0)); + table = nullptr; + } + if (!table) { while (btr_pcur_move_to_next(&pcur, &mtr)) { rec = btr_pcur_get_rec(&pcur); @@ -2542,21 +2635,12 @@ dict_load_table_on_id( goto check_rec; } } - } else { - /* Now we get the table name from the record */ - field = rec_get_nth_field_old(rec, - DICT_FLD__SYS_TABLE_IDS__NAME, &len); - table = dict_sys.load_table( - {reinterpret_cast(field), - len}, ignore_err); } } } - btr_pcur_close(&pcur); mtr.commit(); - - return(table); + return table; } /********************************************************************//** @@ -2574,11 +2658,12 @@ dict_load_sys_table( heap = mem_heap_create(1000); - dict_load_indexes(table, heap, DICT_ERR_IGNORE_NONE); + dict_load_indexes(table, false, heap, DICT_ERR_IGNORE_NONE); mem_heap_free(heap); } +MY_ATTRIBUTE((nonnull, warn_unused_result)) /********************************************************************//** Loads foreign key constraint col names (also for the referenced table). Members that must be set (and valid) in foreign: @@ -2589,19 +2674,9 @@ Members that will be created and set by this function: foreign->foreign_col_names[i] foreign->referenced_col_names[i] (for i=0..foreign->n_fields-1) */ -static -void -dict_load_foreign_cols( -/*===================*/ - dict_foreign_t* foreign)/*!< in/out: foreign constraint object */ +static dberr_t dict_load_foreign_cols(dict_foreign_t *foreign, trx_id_t trx_id) { btr_pcur_t pcur; - dtuple_t* tuple; - dfield_t* dfield; - const rec_t* rec; - const byte* field; - ulint len; - ulint i; mtr_t mtr; size_t id_len; @@ -2617,25 +2692,64 @@ dict_load_foreign_cols( mem_heap_alloc(foreign->heap, foreign->n_fields * sizeof(void*))); - mtr_start(&mtr); + mtr.start(); dict_index_t* sys_index = dict_sys.sys_foreign_cols->indexes.start; ut_ad(!dict_sys.sys_foreign_cols->not_redundant()); - tuple = dtuple_create(foreign->heap, 1); - dfield = dtuple_get_nth_field(tuple, 0); + dfield_t dfield; + dtuple_t tuple{ + 0,1,1,&dfield,0,nullptr +#ifdef UNIV_DEBUG + , DATA_TUPLE_MAGIC_N +#endif + }; - dfield_set_data(dfield, foreign->id, id_len); - dict_index_copy_types(tuple, sys_index, 1); + dfield_set_data(&dfield, foreign->id, id_len); + dict_index_copy_types(&tuple, sys_index, 1); + pcur.btr_cur.page_cur.index = sys_index; - btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE, - BTR_SEARCH_LEAF, &pcur, &mtr); - for (i = 0; i < foreign->n_fields; i++) { + mem_heap_t* heap = nullptr; + dberr_t err = btr_pcur_open_on_user_rec(&tuple, + BTR_SEARCH_LEAF, &pcur, &mtr); + if (err != DB_SUCCESS) { + goto func_exit; + } + for (ulint i = 0; i < foreign->n_fields; i++) { + ut_a(btr_pcur_is_on_user_rec(&pcur)); - rec = btr_pcur_get_rec(&pcur); + const rec_t* rec = btr_pcur_get_rec(&pcur); + ulint len; + const byte* field = rec_get_nth_field_old( + rec, DICT_FLD__SYS_FOREIGN_COLS__DB_TRX_ID, &len); + ut_a(len == DATA_TRX_ID_LEN); - ut_a(btr_pcur_is_on_user_rec(&pcur)); - ut_a(!rec_get_deleted_flag(rec, 0)); + if (UNIV_LIKELY_NULL(heap)) { + mem_heap_empty(heap); + } + + const trx_id_t id = trx_read_trx_id(field); + if (!id) { + } else if (id != trx_id && trx_sys.find(nullptr, id, false)) { + const auto savepoint = mtr.get_savepoint(); + rec_offs* offsets = rec_get_offsets( + rec, sys_index, nullptr, true, ULINT_UNDEFINED, + &heap); + const rec_t* old_vers; + row_vers_build_for_semi_consistent_read( + nullptr, rec, &mtr, sys_index, &offsets, &heap, + heap, &old_vers, nullptr); + mtr.rollback_to_savepoint(savepoint); + rec = old_vers; + if (!rec || rec_get_deleted_flag(rec, 0)) { + goto next; + } + } + + if (rec_get_deleted_flag(rec, 0)) { + ut_ad(id); + goto next; + } field = rec_get_nth_field_old( rec, DICT_FLD__SYS_FOREIGN_COLS__ID, &len); @@ -2660,7 +2774,7 @@ dict_load_foreign_cols( rec, DICT_FLD__SYS_FOREIGN_COLS__REF_COL_NAME, &ref_col_name_len); - ib::fatal sout; + ib::error sout; sout << "Unable to load column names for foreign" " key '" << foreign->id @@ -2675,6 +2789,9 @@ dict_load_foreign_cols( sout << "', REF_COL_NAME='"; sout.write(ref_col_name, ref_col_name_len); sout << "')"; + + err = DB_CORRUPTION; + break; } field = rec_get_nth_field_old( @@ -2692,27 +2809,33 @@ dict_load_foreign_cols( foreign->referenced_col_names[i] = mem_heap_strdupl( foreign->heap, (char*) field, len); +next: btr_pcur_move_to_next_user_rec(&pcur, &mtr); } - - btr_pcur_close(&pcur); - mtr_commit(&mtr); +func_exit: + mtr.commit(); + if (UNIV_LIKELY_NULL(heap)) { + mem_heap_free(heap); + } + return err; } /***********************************************************************//** Loads a foreign key constraint to the dictionary cache. If the referenced table is not yet loaded, it is added in the output parameter (fk_tables). @return DB_SUCCESS or error code */ -static MY_ATTRIBUTE((nonnull(1), warn_unused_result)) +static MY_ATTRIBUTE((warn_unused_result)) dberr_t dict_load_foreign( /*==============*/ - const char* id, - /*!< in: foreign constraint id, must be - '\0'-terminated */ + const char* table_name, /*!< in: table name */ + bool uncommitted, /*!< in: use READ UNCOMMITTED + transaction isolation level */ const char** col_names, /*!< in: column names, or NULL to use foreign->foreign_table->col_names */ + trx_id_t trx_id, + /*!< in: current transaction id, or 0 */ bool check_recursive, /*!< in: whether to record the foreign table parent count to avoid unlimited recursive @@ -2720,6 +2843,8 @@ dict_load_foreign( bool check_charsets, /*!< in: whether to check charset compatibility */ + span id, + /*!< in: foreign constraint id */ dict_err_ignore_t ignore_err, /*!< in: error to be ignored */ dict_names_t& fk_tables) @@ -2732,81 +2857,92 @@ dict_load_foreign( { dict_foreign_t* foreign; btr_pcur_t pcur; - dtuple_t* tuple; - mem_heap_t* heap2; - dfield_t* dfield; - const rec_t* rec; const byte* field; ulint len; mtr_t mtr; dict_table_t* for_table; dict_table_t* ref_table; - size_t id_len; DBUG_ENTER("dict_load_foreign"); DBUG_PRINT("dict_load_foreign", - ("id: '%s', check_recursive: %d", id, check_recursive)); + ("id: '%.*s', check_recursive: %d", + int(id.size()), id.data(), check_recursive)); ut_ad(dict_sys.locked()); - id_len = strlen(id); - - heap2 = mem_heap_create(1000); - - mtr_start(&mtr); - dict_index_t* sys_index = dict_sys.sys_foreign->indexes.start; ut_ad(!dict_sys.sys_foreign->not_redundant()); - tuple = dtuple_create(heap2, 1); - dfield = dtuple_get_nth_field(tuple, 0); - - dfield_set_data(dfield, id, id_len); - dict_index_copy_types(tuple, sys_index, 1); - - btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE, - BTR_SEARCH_LEAF, &pcur, &mtr); - rec = btr_pcur_get_rec(&pcur); - - if (!btr_pcur_is_on_user_rec(&pcur) - || rec_get_deleted_flag(rec, 0)) { - /* Not found */ + dfield_t dfield; + dtuple_t tuple{ + 0,1,1,&dfield,0,nullptr +#ifdef UNIV_DEBUG + , DATA_TUPLE_MAGIC_N +#endif + }; + dfield_set_data(&dfield, id.data(), id.size()); + dict_index_copy_types(&tuple, sys_index, 1); + pcur.btr_cur.page_cur.index = sys_index; - ib::error() << "Cannot load foreign constraint " << id - << ": could not find the relevant record in " - "SYS_FOREIGN"; + mtr.start(); - btr_pcur_close(&pcur); - mtr_commit(&mtr); - mem_heap_free(heap2); + mem_heap_t* heap = nullptr; + dberr_t err = btr_pcur_open_on_user_rec(&tuple, + BTR_SEARCH_LEAF, &pcur, &mtr); + if (err != DB_SUCCESS) { + goto err_exit; + } - DBUG_RETURN(DB_ERROR); + if (!btr_pcur_is_on_user_rec(&pcur)) { +not_found: + err = DB_NOT_FOUND; +err_exit: + mtr.commit(); + if (UNIV_LIKELY_NULL(heap)) { + mem_heap_free(heap); + } + DBUG_RETURN(err); } + const rec_t* rec = btr_pcur_get_rec(&pcur); + static_assert(DICT_FLD__SYS_FOREIGN__ID == 0, "compatibility"); field = rec_get_nth_field_old(rec, DICT_FLD__SYS_FOREIGN__ID, &len); /* Check if the id in record is the searched one */ - if (len != id_len || memcmp(id, field, len)) { - { - ib::error err; - err << "Cannot load foreign constraint " << id - << ": found "; - err.write(field, len); - err << " instead in SYS_FOREIGN"; - } + if (len != id.size() || memcmp(id.data(), field, id.size())) { + goto not_found; + } - btr_pcur_close(&pcur); - mtr_commit(&mtr); - mem_heap_free(heap2); + field = rec_get_nth_field_old( + rec, DICT_FLD__SYS_FOREIGN__DB_TRX_ID, &len); + ut_a(len == DATA_TRX_ID_LEN); + + const trx_id_t tid = trx_read_trx_id(field); + + if (tid && tid != trx_id && !uncommitted + && trx_sys.find(nullptr, tid, false)) { + const auto savepoint = mtr.get_savepoint(); + rec_offs* offsets = rec_get_offsets( + rec, sys_index, nullptr, true, ULINT_UNDEFINED, &heap); + const rec_t* old_vers; + row_vers_build_for_semi_consistent_read( + nullptr, rec, &mtr, sys_index, &offsets, &heap, + heap, &old_vers, nullptr); + mtr.rollback_to_savepoint(savepoint); + rec = old_vers; + if (!rec) { + goto not_found; + } + } - DBUG_RETURN(DB_ERROR); + if (rec_get_deleted_flag(rec, 0)) { + ut_ad(tid); + goto not_found; } /* Read the table names and the number of columns associated with the constraint */ - mem_heap_free(heap2); - foreign = dict_mem_foreign_create(); uint32_t n_fields_and_type = mach_read_from_4( @@ -2820,7 +2956,7 @@ dict_load_foreign( foreign->type = (n_fields_and_type >> 24) & ((1U << 6) - 1); foreign->n_fields = n_fields_and_type & dict_index_t::MAX_N_FIELDS; - foreign->id = mem_heap_strdupl(foreign->heap, id, id_len); + foreign->id = mem_heap_strdupl(foreign->heap, id.data(), id.size()); field = rec_get_nth_field_old( rec, DICT_FLD__SYS_FOREIGN__FOR_NAME, &len); @@ -2829,18 +2965,36 @@ dict_load_foreign( foreign->heap, (char*) field, len); dict_mem_foreign_table_name_lookup_set(foreign, TRUE); - const ulint foreign_table_name_len = len; + const size_t foreign_table_name_len = len; + const size_t table_name_len = strlen(table_name); field = rec_get_nth_field_old( rec, DICT_FLD__SYS_FOREIGN__REF_NAME, &len); + + if (!my_charset_latin1.strnncoll(table_name, table_name_len, + foreign->foreign_table_name, + foreign_table_name_len)) { + } else if (!check_recursive + && !my_charset_latin1.strnncoll(table_name, table_name_len, + (const char*) field, len)) { + } else { + dict_foreign_free(foreign); + goto not_found; + } + foreign->referenced_table_name = mem_heap_strdupl( - foreign->heap, (char*) field, len); + foreign->heap, (const char*) field, len); dict_mem_referenced_table_name_lookup_set(foreign, TRUE); - btr_pcur_close(&pcur); - mtr_commit(&mtr); + mtr.commit(); + if (UNIV_LIKELY_NULL(heap)) { + mem_heap_free(heap); + } - dict_load_foreign_cols(foreign); + err = dict_load_foreign_cols(foreign, trx_id); + if (err != DB_SUCCESS) { + goto load_error; + } ref_table = dict_sys.find_table( {foreign->referenced_table_name_lookup, @@ -2860,9 +3014,9 @@ dict_load_foreign( mem_heap_strdupl(ref_table->heap, foreign->foreign_table_name_lookup, foreign_table_name_len)); - +load_error: dict_foreign_remove_from_cache(foreign); - DBUG_RETURN(DB_SUCCESS); + DBUG_RETURN(err); } ut_a(for_table || ref_table); @@ -2895,7 +3049,8 @@ dict_load_foreigns( const char* table_name, /*!< in: table name */ const char** col_names, /*!< in: column names, or NULL to use table->col_names */ - bool check_recursive,/*!< in: Whether to check + trx_id_t trx_id, /*!< in: DDL transaction id, + or 0 to check recursive load of tables chained by FK */ bool check_charsets, /*!< in: whether to check @@ -2907,15 +3062,7 @@ dict_load_foreigns( subsequently to load all the foreign key constraints. */ { - ulint tuple_buf[(DTUPLE_EST_ALLOC(1) + sizeof(ulint) - 1) - / sizeof(ulint)]; btr_pcur_t pcur; - dtuple_t* tuple; - dfield_t* dfield; - const rec_t* rec; - const byte* field; - ulint len; - dberr_t err; mtr_t mtr; DBUG_ENTER("dict_load_foreigns"); @@ -2932,23 +3079,34 @@ dict_load_foreigns( } ut_ad(!dict_sys.sys_foreign->not_redundant()); - mtr_start(&mtr); dict_index_t *sec_index = dict_table_get_next_index( dict_table_get_first_index(dict_sys.sys_foreign)); ut_ad(!strcmp(sec_index->fields[0].name, "FOR_NAME")); -start_load: - - tuple = dtuple_create_from_mem(tuple_buf, sizeof(tuple_buf), 1, 0); - dfield = dtuple_get_nth_field(tuple, 0); + bool check_recursive = !trx_id; + dfield_t dfield; + dtuple_t tuple{ + 0,1,1,&dfield,0,nullptr +#ifdef UNIV_DEBUG + , DATA_TUPLE_MAGIC_N +#endif + }; - dfield_set_data(dfield, table_name, strlen(table_name)); - dict_index_copy_types(tuple, sec_index, 1); +start_load: + mtr.start(); + dfield_set_data(&dfield, table_name, strlen(table_name)); + dict_index_copy_types(&tuple, sec_index, 1); + pcur.btr_cur.page_cur.index = sec_index; - btr_pcur_open_on_user_rec(sec_index, tuple, PAGE_CUR_GE, - BTR_SEARCH_LEAF, &pcur, &mtr); + dberr_t err = btr_pcur_open_on_user_rec(&tuple, + BTR_SEARCH_LEAF, &pcur, &mtr); + if (err != DB_SUCCESS) { + DBUG_RETURN(err); + } loop: - rec = btr_pcur_get_rec(&pcur); + const rec_t* rec = btr_pcur_get_rec(&pcur); + const byte* field; + const auto maybe_deleted = rec_get_deleted_flag(rec, 0); if (!btr_pcur_is_on_user_rec(&pcur)) { /* End of index */ @@ -2959,6 +3117,7 @@ dict_load_foreigns( /* Now we have the record in the secondary index containing a table name and a foreign constraint ID */ + ulint len; field = rec_get_nth_field_old( rec, DICT_FLD__SYS_FOREIGN_FOR_NAME__NAME, &len); @@ -2966,13 +3125,12 @@ dict_load_foreigns( following call does the comparison in the latin1_swedish_ci charset-collation, in a case-insensitive way. */ - if (0 != cmp_data_data(dfield_get_type(dfield)->mtype, - dfield_get_type(dfield)->prtype, - static_cast( - dfield_get_data(dfield)), - dfield_get_len(dfield), - field, len)) { - + if (cmp_data(dfield_get_type(&dfield)->mtype, + dfield_get_type(&dfield)->prtype, + false, + reinterpret_cast(table_name), + dfield_get_len(&dfield), + field, len)) { goto load_next_index; } @@ -2983,10 +3141,6 @@ dict_load_foreigns( may not be the same case, but the previous comparison showed that they match with no-case. */ - if (rec_get_deleted_flag(rec, 0)) { - goto next_rec; - } - if (lower_case_table_names != 2 && memcmp(field, table_name, len)) { goto next_rec; } @@ -2996,54 +3150,64 @@ dict_load_foreigns( rec, DICT_FLD__SYS_FOREIGN_FOR_NAME__ID, &len); /* Copy the string because the page may be modified or evicted - after mtr_commit() below. */ - char fk_id[MAX_TABLE_NAME_LEN + 1]; - - ut_a(len <= MAX_TABLE_NAME_LEN); - memcpy(fk_id, field, len); - fk_id[len] = '\0'; + after mtr.commit() below. */ + char fk_id[MAX_TABLE_NAME_LEN + NAME_LEN]; + err = DB_SUCCESS; + if (UNIV_LIKELY(len < sizeof fk_id)) { + memcpy(fk_id, field, len); + } btr_pcur_store_position(&pcur, &mtr); - mtr_commit(&mtr); + mtr.commit(); /* Load the foreign constraint definition to the dictionary cache */ - err = dict_load_foreign(fk_id, col_names, - check_recursive, check_charsets, ignore_err, - fk_tables); - - if (err != DB_SUCCESS) { - btr_pcur_close(&pcur); - + err = len < sizeof fk_id + ? dict_load_foreign(table_name, false, col_names, trx_id, + check_recursive, check_charsets, + {fk_id, len}, ignore_err, fk_tables) + : DB_CORRUPTION; + + switch (err) { + case DB_SUCCESS: + break; + case DB_NOT_FOUND: + if (maybe_deleted) { + break; + } + sql_print_error("InnoDB: Cannot load foreign constraint %.*s:" + " could not find the relevant record in " + "SYS_FOREIGN", int(len), fk_id); + /* fall through */ + default: +corrupted: + ut_free(pcur.old_rec_buf); DBUG_RETURN(err); } - mtr_start(&mtr); - - btr_pcur_restore_position(BTR_SEARCH_LEAF, &pcur, &mtr); + mtr.start(); + if (pcur.restore_position(BTR_SEARCH_LEAF, &mtr) + == btr_pcur_t::CORRUPTED) { + mtr.commit(); + goto corrupted; + } next_rec: btr_pcur_move_to_next_user_rec(&pcur, &mtr); goto loop; load_next_index: - btr_pcur_close(&pcur); - mtr_commit(&mtr); - - sec_index = dict_table_get_next_index(sec_index); - - if (sec_index != NULL) { - - mtr_start(&mtr); + mtr.commit(); + if ((sec_index = dict_table_get_next_index(sec_index))) { /* Switch to scan index on REF_NAME, fk_max_recusive_level already been updated when scanning FOR_NAME index, no need to update again */ - check_recursive = FALSE; - + check_recursive = false; goto start_load; } + ut_free(pcur.old_rec_buf); DBUG_RETURN(DB_SUCCESS); } diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index 1a8d5764d0f16..b8b2d583c2423 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -2,7 +2,7 @@ Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2022, 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 @@ -212,7 +212,7 @@ dict_mem_table_free( || DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID) || DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_ADD_DOC_ID)) { if (table->fts) { - fts_free(table); + table->fts->~fts_t(); } } @@ -1045,32 +1045,6 @@ dict_mem_table_free_foreign_vcol_set( } } -/**********************************************************************//** -Adds a field definition to an index. NOTE: does not take a copy -of the column name if the field is a column. The memory occupied -by the column name may be released only after publishing the index. */ -void -dict_mem_index_add_field( -/*=====================*/ - dict_index_t* index, /*!< in: index */ - const char* name, /*!< in: column name */ - ulint prefix_len) /*!< in: 0 or the column prefix length - in a MySQL index like - INDEX (textcol(25)) */ -{ - dict_field_t* field; - - ut_ad(index); - ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); - - index->n_def++; - - field = dict_index_get_nth_field(index, unsigned(index->n_def) - 1); - - field->name = name; - field->prefix_len = prefix_len & ((1U << 12) - 1); -} - /**********************************************************************//** Frees an index memory object. */ void @@ -1197,11 +1171,14 @@ bool dict_foreign_t::affects_fulltext() const return false; } -/** Reconstruct the clustered index fields. */ -inline void dict_index_t::reconstruct_fields() +/** Reconstruct the clustered index fields. +@return whether metadata is incorrect */ +inline bool dict_index_t::reconstruct_fields() { DBUG_ASSERT(is_primary()); + const auto old_n_fields = n_fields; + n_fields = (n_fields + table->instant->n_dropped) & dict_index_t::MAX_N_FIELDS; n_def = (n_def + table->instant->n_dropped) @@ -1229,13 +1206,17 @@ inline void dict_index_t::reconstruct_fields() } else { DBUG_ASSERT(!c.is_not_null()); const auto old = std::find_if( - fields + n_first, fields + n_fields, + fields + n_first, fields + old_n_fields, [c](const dict_field_t& o) { return o.col->ind == c.ind(); }); + + if (old >= fields + old_n_fields + || old->prefix_len + || old->col != &table->cols[c.ind()]) { + return true; + } + ut_ad(old >= &fields[n_first]); - ut_ad(old < &fields[n_fields]); - DBUG_ASSERT(!old->prefix_len); - DBUG_ASSERT(old->col == &table->cols[c.ind()]); f = *old; } @@ -1248,6 +1229,8 @@ inline void dict_index_t::reconstruct_fields() fields = tfields; n_core_null_bytes = static_cast(UT_BITS_IN_BYTES(n_core_null)); + + return false; } /** Reconstruct dropped or reordered columns. @@ -1312,8 +1295,7 @@ bool dict_table_t::deserialise_columns(const byte* metadata, ulint len) } DBUG_ASSERT(col == &dropped_cols[n_dropped_cols]); - UT_LIST_GET_FIRST(indexes)->reconstruct_fields(); - return false; + return UT_LIST_GET_FIRST(indexes)->reconstruct_fields(); } /** Check if record in clustered index is historical row. @@ -1351,6 +1333,20 @@ dict_index_t::vers_history_row( { ut_ad(!is_primary()); + /* + Get row_end from clustered index + + TODO (optimization): row_end can be taken from unique secondary index + as well. For that dict_index_t::vers_end member should be added and + updated at index init (dict_index_build_internal_non_clust()). + + Test case: + + create or replace table t1 (x int unique, y int unique, + foreign key r (y) references t1 (x)) + with system versioning engine innodb; + insert into t1 values (1, 1); + */ bool error = false; mem_heap_t* heap = NULL; dict_index_t* clust_index = NULL; diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index fd744e6e2f52f..39f5943d5a41c 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2009, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2022, MariaDB Corporation. +Copyright (c) 2015, 2023, 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 @@ -33,6 +33,7 @@ Created Jan 06, 2010 Vasil Dimov #include #include "log.h" #include "btr0btr.h" +#include "que0que.h" #include #include @@ -167,10 +168,7 @@ dict_stats_should_ignore_index( /*===========================*/ const dict_index_t* index) /*!< in: index */ { - return((index->type & (DICT_FTS | DICT_SPATIAL)) - || index->is_corrupted() - || index->to_be_dropped - || !index->is_committed()); + return !index->is_btree() || index->to_be_dropped || !index->is_committed(); } @@ -341,6 +339,8 @@ dict_table_schema_check( const dict_table_t* table= dict_sys.load_table(req_schema->table_name); if (!table) { + if (opt_bootstrap) + return DB_TABLE_NOT_FOUND; if (req_schema == &table_stats_schema) { if (innodb_table_stats_not_found_reported) { return DB_STATS_DO_NOT_EXIST; @@ -1038,6 +1038,12 @@ struct index_field_stats_t n_non_null_key_vals(n_non_null_key_vals) { } + + bool is_bulk_operation() const + { + return n_diff_key_vals == UINT64_MAX && + n_sample_sizes == UINT64_MAX && n_non_null_key_vals == UINT64_MAX; + } }; /*******************************************************************//** @@ -1075,6 +1081,60 @@ btr_record_not_null_field_in_rec( } } +inline dberr_t +btr_cur_t::open_random_leaf(rec_offs *&offsets, mem_heap_t *&heap, mtr_t &mtr) +{ + ut_ad(!index()->is_spatial()); + ut_ad(!mtr.get_savepoint()); + + mtr_s_lock_index(index(), &mtr); + + if (index()->page == FIL_NULL) + return DB_CORRUPTION; + + dberr_t err; + auto offset= index()->page; + bool merge= false; + ulint height= ULINT_UNDEFINED; + + while (buf_block_t *block= + btr_block_get(*index(), offset, RW_S_LATCH, merge, &mtr, &err)) + { + page_cur.block= block; + + if (height == ULINT_UNDEFINED) + { + height= btr_page_get_level(block->page.frame); + if (height > BTR_MAX_LEVELS) + return DB_CORRUPTION; + + if (height == 0) + goto got_leaf; + } + + if (height == 0) + { + mtr.rollback_to_savepoint(0, mtr.get_savepoint() - 1); + got_leaf: + page_cur.rec= page_get_infimum_rec(block->page.frame); + return DB_SUCCESS; + } + + if (!--height) + merge= !index()->is_clust(); + + page_cur_open_on_rnd_user_rec(&page_cur); + + offsets= rec_get_offsets(page_cur.rec, page_cur.index, offsets, 0, + ULINT_UNDEFINED, &heap); + + /* Go to the child node */ + offset= btr_node_ptr_get_child_page_no(page_cur.rec, offsets); + } + + return err; +} + /** Estimated table level stats from sampled value. @param value sampled stats @param index index being sampled @@ -1103,7 +1163,6 @@ std::vector btr_estimate_number_of_different_key_vals(dict_index_t* index, trx_id_t bulk_trx_id) { - btr_cur_t cursor; page_t* page; rec_t* rec; ulint n_cols; @@ -1113,8 +1172,6 @@ btr_estimate_number_of_different_key_vals(dict_index_t* index, uintmax_t n_sample_pages=1; /* number of pages to sample */ ulint not_empty_flag = 0; ulint total_external_size = 0; - ulint i; - ulint j; uintmax_t add_on; mtr_t mtr; mem_heap_t* heap = NULL; @@ -1123,7 +1180,7 @@ btr_estimate_number_of_different_key_vals(dict_index_t* index, std::vector result; - ut_ad(!index->is_spatial()); + ut_ad(index->is_btree()); n_cols = dict_index_get_n_unique(index); @@ -1220,20 +1277,17 @@ btr_estimate_number_of_different_key_vals(dict_index_t* index, ut_ad(n_sample_pages > 0 && n_sample_pages <= (index->stat_index_size <= 1 ? 1 : index->stat_index_size)); /* We sample some pages in the index to get an estimate */ + btr_cur_t cursor; + cursor.page_cur.index = index; - for (i = 0; i < n_sample_pages; i++) { + for (ulint i = 0; i < n_sample_pages; i++) { mtr.start(); - bool available; - - available = btr_cur_open_at_rnd_pos(index, BTR_SEARCH_LEAF, - &cursor, &mtr); - - if (!available || index->table->bulk_trx_id != bulk_trx_id) { + if (cursor.open_random_leaf(offsets_rec, heap, mtr) != + DB_SUCCESS + || index->table->bulk_trx_id != bulk_trx_id) { mtr.commit(); - mem_heap_free(heap); - - return result; + goto exit_loop; } /* Count the number of different key values for each prefix of @@ -1242,18 +1296,12 @@ btr_estimate_number_of_different_key_vals(dict_index_t* index, because otherwise our algorithm would give a wrong estimate for an index where there is just one key value. */ - if (!index->is_readable()) { - mtr.commit(); - goto exit_loop; - } - page = btr_cur_get_page(&cursor); - rec = page_rec_get_next(page_get_infimum_rec(page)); - const ulint n_core = page_is_leaf(page) - ? index->n_core_fields : 0; + rec = page_rec_get_next(cursor.page_cur.rec); + const ulint n_core = index->n_core_fields; - if (!page_rec_is_supremum(rec)) { + if (rec && !page_rec_is_supremum(rec)) { not_empty_flag = 1; offsets_rec = rec_get_offsets(rec, index, offsets_rec, n_core, @@ -1268,7 +1316,7 @@ btr_estimate_number_of_different_key_vals(dict_index_t* index, while (!page_rec_is_supremum(rec)) { ulint matched_fields; rec_t* next_rec = page_rec_get_next(rec); - if (page_rec_is_supremum(next_rec)) { + if (!next_rec || page_rec_is_supremum(next_rec)) { total_external_size += btr_rec_get_externally_stored_len( rec, offsets_rec); @@ -1286,7 +1334,7 @@ btr_estimate_number_of_different_key_vals(dict_index_t* index, index, stats_null_not_equal, &matched_fields); - for (j = matched_fields; j < n_cols; j++) { + for (ulint j = matched_fields; j < n_cols; j++) { /* We add one if this index record has a different prefix from the previous */ @@ -1342,7 +1390,7 @@ btr_estimate_number_of_different_key_vals(dict_index_t* index, result.reserve(n_cols); - for (j = 0; j < n_cols; j++) { + for (ulint j = 0; j < n_cols; j++) { index_field_stats_t stat; stat.n_diff_key_vals @@ -1381,7 +1429,6 @@ btr_estimate_number_of_different_key_vals(dict_index_t* index, } mem_heap_free(heap); - return result; } @@ -1391,13 +1438,16 @@ relatively quick and is used to calculate transient statistics that are not saved on disk. This was the only way to calculate statistics before the Persistent Statistics feature was introduced. This function doesn't update the defragmentation related stats. -Only persistent statistics supports defragmentation stats. */ +Only persistent statistics supports defragmentation stats. +@return error code +@retval DB_SUCCESS_LOCKED_REC if the table under bulk insert operation */ static -void +dberr_t dict_stats_update_transient_for_index( /*==================================*/ dict_index_t* index) /*!< in/out: index */ { + dberr_t err = DB_SUCCESS; if (srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO && (srv_force_recovery >= SRV_FORCE_NO_LOG_REDO || !dict_index_is_clust(index))) { @@ -1411,6 +1461,7 @@ dict_stats_update_transient_for_index( index->table->stats_mutex_lock(); dict_stats_empty_index(index, false); index->table->stats_mutex_unlock(); + return err; #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG } else if (ibuf_debug && !dict_index_is_clust(index)) { goto dummy_empty; @@ -1422,9 +1473,11 @@ dict_stats_update_transient_for_index( mtr_t mtr; mtr.start(); - mtr_s_lock_index(index, &mtr); + mtr_sx_lock_index(index, &mtr); + + dberr_t err; buf_block_t* root = btr_root_block_get(index, RW_SX_LATCH, - &mtr); + &mtr, &err); if (!root) { invalid: mtr.commit(); @@ -1433,6 +1486,7 @@ dict_stats_update_transient_for_index( const auto bulk_trx_id = index->table->bulk_trx_id; if (bulk_trx_id && trx_sys.find(nullptr, bulk_trx_id, false)) { + err= DB_SUCCESS_LOCKED_REC; goto invalid; } @@ -1474,6 +1528,8 @@ dict_stats_update_transient_for_index( } } } + + return err; } /*********************************************************************//** @@ -1481,9 +1537,11 @@ Calculates new estimates for table and index statistics. This function is relatively quick and is used to calculate transient statistics that are not saved on disk. This was the only way to calculate statistics before the -Persistent Statistics feature was introduced. */ +Persistent Statistics feature was introduced. +@return error code +@retval DB_SUCCESS_LOCKED REC if the table under bulk insert operation */ static -void +dberr_t dict_stats_update_transient( /*========================*/ dict_table_t* table) /*!< in/out: table */ @@ -1492,6 +1550,7 @@ dict_stats_update_transient( dict_index_t* index; ulint sum_of_index_sizes = 0; + dberr_t err = DB_SUCCESS; /* Find out the sizes of the indexes and how many different values for the key they approximately have */ @@ -1500,34 +1559,35 @@ dict_stats_update_transient( if (!table->space) { /* Nothing to do. */ +empty_table: dict_stats_empty_table(table, true); - return; + return err; } else if (index == NULL) { /* Table definition is corrupt */ ib::warn() << "Table " << table->name << " has no indexes. Cannot calculate statistics."; - dict_stats_empty_table(table, true); - return; + goto empty_table; } for (; index != NULL; index = dict_table_get_next_index(index)) { ut_ad(!dict_index_is_ibuf(index)); - if (index->type & (DICT_FTS | DICT_SPATIAL)) { + if (!index->is_btree()) { continue; } if (dict_stats_should_ignore_index(index) - || !index->is_readable()) { + || !index->is_readable() + || err == DB_SUCCESS_LOCKED_REC) { index->table->stats_mutex_lock(); dict_stats_empty_index(index, false); index->table->stats_mutex_unlock(); continue; } - dict_stats_update_transient_for_index(index); + err = dict_stats_update_transient_for_index(index); sum_of_index_sizes += index->stat_index_size; } @@ -1551,8 +1611,100 @@ dict_stats_update_transient( table->stat_initialized = TRUE; table->stats_mutex_unlock(); + + return err; +} + +/** Open a cursor at the first page in a tree level. +@param page_cur cursor +@param level level to search for (0=leaf) +@param mtr mini-transaction */ +static dberr_t page_cur_open_level(page_cur_t *page_cur, ulint level, + mtr_t *mtr) +{ + mem_heap_t *heap= nullptr; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs *offsets= offsets_; + dberr_t err; + + dict_index_t *const index= page_cur->index; + + rec_offs_init(offsets_); + ut_ad(level != ULINT_UNDEFINED); + ut_ad(mtr->memo_contains_flagged(&index->lock, MTR_MEMO_SX_LOCK)); + ut_ad(mtr->get_savepoint() == 1); + + uint32_t page= index->page; + + for (ulint height = ULINT_UNDEFINED;; height--) + { + buf_block_t* block= + btr_block_get(*index, page, RW_S_LATCH, + !height && !index->is_clust(), mtr, &err); + if (!block) + break; + + const uint32_t l= btr_page_get_level(block->page.frame); + + if (height == ULINT_UNDEFINED) + { + ut_ad(!heap); + /* We are in the root node */ + height= l; + if (UNIV_UNLIKELY(height < level)) + return DB_CORRUPTION; + } + else if (UNIV_UNLIKELY(height != l) || page_has_prev(block->page.frame)) + { + err= DB_CORRUPTION; + break; + } + + page_cur_set_before_first(block, page_cur); + + if (height == level) + break; + + ut_ad(height); + + if (!page_cur_move_to_next(page_cur)) + { + err= DB_CORRUPTION; + break; + } + + offsets= rec_get_offsets(page_cur->rec, index, offsets, 0, ULINT_UNDEFINED, + &heap); + page= btr_node_ptr_get_child_page_no(page_cur->rec, offsets); + } + + if (UNIV_LIKELY_NULL(heap)) + mem_heap_free(heap); + + /* Release all page latches except the one on the desired page. */ + const auto end= mtr->get_savepoint(); + if (end > 1) + mtr->rollback_to_savepoint(1, end - 1); + + return err; +} + +/** Open a cursor at the first page in a tree level. +@param page_cur cursor +@param level level to search for (0=leaf) +@param mtr mini-transaction +@param index index tree */ +static dberr_t btr_pcur_open_level(btr_pcur_t *pcur, ulint level, mtr_t *mtr, + dict_index_t *index) +{ + pcur->latch_mode= BTR_SEARCH_LEAF; + pcur->search_mode= PAGE_CUR_G; + pcur->pos_state= BTR_PCUR_IS_POSITIONED; + pcur->btr_cur.page_cur.index= index; + return page_cur_open_level(&pcur->btr_cur.page_cur, level, mtr); } + /* @{ Pseudo code about the relation between the following functions let N = N_SAMPLE_PAGES(index) @@ -1609,7 +1761,8 @@ dict_stats_analyze_index_level( DEBUG_PRINTF(" %s(table=%s, index=%s, level=" ULINTPF ")\n", __func__, index->table->name, index->name, level); - ut_ad(mtr->memo_contains(index->lock, MTR_MEMO_SX_LOCK)); + *total_recs = 0; + *total_pages = 0; n_uniq = dict_index_get_n_unique(index); @@ -1642,24 +1795,19 @@ dict_stats_analyze_index_level( /* Position pcur on the leftmost record on the leftmost page on the desired level. */ - btr_pcur_open_at_index_side( - true, index, BTR_SEARCH_TREE_ALREADY_S_LATCHED, - &pcur, true, level, mtr); - btr_pcur_move_to_next_on_page(&pcur); + if (btr_pcur_open_level(&pcur, level, mtr, index) != DB_SUCCESS + || !btr_pcur_move_to_next_on_page(&pcur)) { + goto func_exit; + } page = btr_pcur_get_page(&pcur); /* The page must not be empty, except when it is the root page (and the whole index is empty). */ ut_ad(btr_pcur_is_on_user_rec(&pcur) || page_is_leaf(page)); - ut_ad(btr_pcur_get_rec(&pcur) - == page_rec_get_next_const(page_get_infimum_rec(page))); - - /* check that we are indeed on the desired level */ - ut_a(btr_page_get_level(page) == level); - /* there should not be any pages on the left */ - ut_a(!page_has_prev(page)); + prev_rec = NULL; + prev_rec_is_copied = false; if (REC_INFO_MIN_REC_FLAG & rec_get_info_bits( btr_pcur_get_rec(&pcur), page_is_comp(page))) { @@ -1669,20 +1817,12 @@ dict_stats_analyze_index_level( ut_ad(index->is_instant()); btr_pcur_move_to_next_user_rec(&pcur, mtr); } - } else { + } else if (UNIV_UNLIKELY(level != 0)) { /* The first record on the leftmost page must be marked as such on each level except the leaf level. */ - ut_a(level == 0); + goto func_exit; } - prev_rec = NULL; - prev_rec_is_copied = false; - - /* no records by default */ - *total_recs = 0; - - *total_pages = 0; - /* iterate over all user records on this level and compare each two adjacent ones, even the last on page X and the fist on page X+1 */ @@ -1721,10 +1861,7 @@ dict_stats_analyze_index_level( if (level == 0 && !srv_stats_include_delete_marked - && rec_get_deleted_flag( - rec, - page_is_comp(btr_pcur_get_page(&pcur)))) { - + && rec_get_deleted_flag(rec, page_rec_is_comp(rec))) { if (rec_is_last_on_page && !prev_rec_is_copied && prev_rec != NULL) { @@ -1804,7 +1941,7 @@ dict_stats_analyze_index_level( records on this level at some point we will jump from one page to the next and then rec and prev_rec will be on different pages and - btr_pcur_move_to_next_user_rec() will release the + btr_cur_move_to_next_user_rec() will release the latch on the page that prev_rec is on */ prev_rec = rec_copy_prefix_to_buf( rec, index, n_uniq, @@ -1813,7 +1950,7 @@ dict_stats_analyze_index_level( } else { /* still on the same page, the next call to - btr_pcur_move_to_next_user_rec() will not jump + btr_cur_move_to_next_user_rec() will not jump on the next page, we can simply assign pointers instead of copying the records like above */ @@ -1884,15 +2021,41 @@ dict_stats_analyze_index_level( } #endif /* UNIV_STATS_DEBUG */ - /* Release the latch on the last page, because that is not done by - btr_pcur_close(). This function works also for non-leaf pages. */ - btr_leaf_page_release(btr_pcur_get_block(&pcur), BTR_SEARCH_LEAF, mtr); - - btr_pcur_close(&pcur); +func_exit: ut_free(prev_rec_buf); mem_heap_free(heap); } + +/************************************************************//** +Gets the pointer to the next non delete-marked record on the page. +If all subsequent records are delete-marked, then this function +will return the supremum record. +@return pointer to next non delete-marked record or pointer to supremum */ +static +const rec_t* +page_rec_get_next_non_del_marked( +/*=============================*/ + const rec_t* rec) /*!< in: pointer to record */ +{ + const page_t *const page= page_align(rec); + + if (page_is_comp(page)) + { + for (rec= page_rec_get_next_low(rec, TRUE); + rec && rec_get_deleted_flag(rec, TRUE); + rec= page_rec_get_next_low(rec, TRUE)); + return rec ? rec : page + PAGE_NEW_SUPREMUM; + } + else + { + for (rec= page_rec_get_next_low(rec, FALSE); + rec && rec_get_deleted_flag(rec, FALSE); + rec= page_rec_get_next_low(rec, FALSE)); + return rec ? rec : page + PAGE_OLD_SUPREMUM; + } +} + /** Scan a page, reading records from left to right and counting the number of distinct records (looking only at the first n_prefix columns) and the number of external pages pointed by records from this page. @@ -1950,7 +2113,7 @@ dict_stats_scan_page( rec = get_next(page_get_infimum_rec(page)); - if (page_rec_is_supremum(rec)) { + if (!rec || page_rec_is_supremum(rec)) { /* the page is empty or contains only delete-marked records */ *n_diff = 0; *out_rec = NULL; @@ -1969,7 +2132,7 @@ dict_stats_scan_page( *n_diff = 1; - while (!page_rec_is_supremum(next_rec)) { + while (next_rec && !page_rec_is_supremum(next_rec)) { ulint matched_fields; @@ -2091,16 +2254,18 @@ dict_stats_analyze_index_below_cur( /* descend to the leaf level on the B-tree */ for (;;) { - - dberr_t err = DB_SUCCESS; + dberr_t err; block = buf_page_get_gen(page_id, zip_size, RW_S_LATCH, NULL, BUF_GET, &mtr, &err, !index->is_clust() && 1 == btr_page_get_level(page)); + if (!block) { + goto func_exit; + } - page = buf_block_get_frame(block); + page = block->page.frame; if (page_is_leaf(page)) { /* leaf level */ @@ -2164,6 +2329,7 @@ dict_stats_analyze_index_below_cur( __func__, page_no, n_diff); #endif +func_exit: mtr_commit(&mtr); mem_heap_free(heap); } @@ -2243,49 +2409,40 @@ dict_stats_analyze_index_for_n_prefix( n_prefix, n_diff_data->n_diff_on_level); #endif - ut_ad(mtr->memo_contains(index->lock, MTR_MEMO_SX_LOCK)); + ut_ad(n_diff_data->level); /* Position pcur on the leftmost record on the leftmost page on the desired level. */ - btr_pcur_open_at_index_side( - true, index, BTR_SEARCH_TREE_ALREADY_S_LATCHED, - &pcur, true, n_diff_data->level, mtr); - btr_pcur_move_to_next_on_page(&pcur); + n_diff_data->n_diff_all_analyzed_pages = 0; + n_diff_data->n_external_pages_sum = 0; + + if (btr_pcur_open_level(&pcur, n_diff_data->level, mtr, index) + != DB_SUCCESS + || !btr_pcur_move_to_next_on_page(&pcur)) { + return; + } page = btr_pcur_get_page(&pcur); const rec_t* first_rec = btr_pcur_get_rec(&pcur); - /* We shouldn't be scanning the leaf level. The caller of this function - should have stopped the descend on level 1 or higher. */ - ut_ad(n_diff_data->level > 0); - ut_ad(!page_is_leaf(page)); - /* The page must not be empty, except when it is the root page (and the whole index is empty). */ - ut_ad(btr_pcur_is_on_user_rec(&pcur)); - ut_ad(first_rec == page_rec_get_next_const(page_get_infimum_rec(page))); - - /* check that we are indeed on the desired level */ - ut_a(btr_page_get_level(page) == n_diff_data->level); - - /* there should not be any pages on the left */ - ut_a(!page_has_prev(page)); - - /* check whether the first record on the leftmost page is marked - as such; we are on a non-leaf level */ - ut_a(rec_get_info_bits(first_rec, page_is_comp(page)) - & REC_INFO_MIN_REC_FLAG); + if (page_has_prev(page) + || !btr_pcur_is_on_user_rec(&pcur) + || btr_page_get_level(page) != n_diff_data->level + || first_rec != page_rec_get_next_const(page_get_infimum_rec(page)) + || !(rec_get_info_bits(first_rec, page_is_comp(page)) + & REC_INFO_MIN_REC_FLAG)) { + return; + } const ib_uint64_t last_idx_on_level = boundaries->at( static_cast(n_diff_data->n_diff_on_level - 1)); rec_idx = 0; - n_diff_data->n_diff_all_analyzed_pages = 0; - n_diff_data->n_external_pages_sum = 0; - for (i = 0; i < n_diff_data->n_leaf_pages_to_analyze; i++) { /* there are n_diff_on_level elements in 'boundaries' and we divide those elements @@ -2394,8 +2551,6 @@ dict_stats_analyze_index_for_n_prefix( n_diff_data->n_external_pages_sum += n_external_pages; } - - btr_pcur_close(&pcur); } /** statistics for an index */ @@ -2411,6 +2566,19 @@ struct index_stats_t for (ulint i= 0; i < n_uniq; ++i) stats.push_back(index_field_stats_t{0, 1, 0}); } + + void set_bulk_operation() + { + memset((void*) &stats[0], 0xff, stats.size() * sizeof stats[0]); + } + + bool is_bulk_operation() const + { + for (auto &s : stats) + if (!s.is_bulk_operation()) + return false; + return true; + } }; /** Set dict_index_t::stat_n_diff_key_vals[] and stat_n_sample_sizes[]. @@ -2510,47 +2678,36 @@ static index_stats_t dict_stats_analyze_index(dict_index_t* index) ut_ad(!index->table->stats_mutex_is_owner()); ut_ad(index->table->get_ref_count()); - /* Disable update statistic for Rtree */ - if (dict_index_is_spatial(index)) { + if (!index->is_btree()) { DBUG_RETURN(result); } DEBUG_PRINTF(" %s(index=%s)\n", __func__, index->name()); mtr.start(); - mtr_s_lock_index(index, &mtr); - uint16_t root_level; - - { - buf_block_t* root; - root = btr_root_block_get(index, RW_SX_LATCH, &mtr); - if (!root) { + mtr_sx_lock_index(index, &mtr); + dberr_t err; + buf_block_t* root = btr_root_block_get(index, RW_SX_LATCH, &mtr, &err); + if (!root) { empty_index: - mtr.commit(); - dict_stats_assert_initialized_index(index); - DBUG_RETURN(result); - } - - root_level = btr_page_get_level(root->page.frame); - - mtr.x_lock_space(index->table->space); - ulint dummy, size; - result.index_size - = fseg_n_reserved_pages(*root, PAGE_HEADER - + PAGE_BTR_SEG_LEAF - + root->page.frame, - &size, &mtr) - + fseg_n_reserved_pages(*root, PAGE_HEADER - + PAGE_BTR_SEG_TOP - + root->page.frame, - &dummy, &mtr); - result.n_leaf_pages = size ? size : 1; + mtr.commit(); + dict_stats_assert_initialized_index(index); + DBUG_RETURN(result); } + uint16_t root_level = btr_page_get_level(root->page.frame); + mtr.x_lock_space(index->table->space); + ulint dummy, size; + result.index_size + = fseg_n_reserved_pages(*root, PAGE_HEADER + PAGE_BTR_SEG_LEAF + + root->page.frame, &size, &mtr) + + fseg_n_reserved_pages(*root, PAGE_HEADER + PAGE_BTR_SEG_TOP + + root->page.frame, &dummy, &mtr); + result.n_leaf_pages = size ? size : 1; + const auto bulk_trx_id = index->table->bulk_trx_id; if (bulk_trx_id && trx_sys.find(nullptr, bulk_trx_id, false)) { - result.index_size = 1; - result.n_leaf_pages = 1; + result.set_bulk_operation(); goto empty_index; } @@ -2649,8 +2806,9 @@ static index_stats_t dict_stats_analyze_index(dict_index_t* index) mtr.commit(); mtr.start(); mtr_sx_lock_index(index, &mtr); + ut_ad(mtr.get_savepoint() == 1); buf_block_t *root = btr_root_block_get(index, RW_S_LATCH, - &mtr); + &mtr, &err); if (!root || root_level != btr_page_get_level(root->page.frame) || index->table->bulk_trx_id != bulk_trx_id) { /* Just quit if the tree has changed beyond @@ -2664,7 +2822,7 @@ static index_stats_t dict_stats_analyze_index(dict_index_t* index) break; } - mtr.memo_release(root, MTR_MEMO_PAGE_S_FIX); + mtr.rollback_to_savepoint(1); /* check whether we should pick the current level; we pick level 1 even if it does not have enough @@ -2726,6 +2884,7 @@ static index_stats_t dict_stats_analyze_index(dict_index_t* index) break; } + mtr.rollback_to_savepoint(1); dict_stats_analyze_index_level(index, level, n_diff_on_level, @@ -2733,7 +2892,7 @@ static index_stats_t dict_stats_analyze_index(dict_index_t* index) &total_pages, n_diff_boundaries, &mtr); - + mtr.rollback_to_savepoint(1); level_is_analyzed = true; if (level == 1 @@ -2812,7 +2971,8 @@ static index_stats_t dict_stats_analyze_index(dict_index_t* index) Calculates new estimates for table and index statistics. This function is relatively slow and is used to calculate persistent statistics that will be saved on disk. -@return DB_SUCCESS or error code */ +@return DB_SUCCESS or error code +@retval DB_SUCCESS_LOCKED_REC if the table under bulk insert operation */ static dberr_t dict_stats_update_persistent( @@ -2846,6 +3006,11 @@ dict_stats_update_persistent( index_stats_t stats = dict_stats_analyze_index(index); + if (stats.is_bulk_operation()) { + dict_stats_empty_table(table, false); + return DB_SUCCESS_LOCKED_REC; + } + table->stats_mutex_lock(); index->stat_index_size = stats.index_size; index->stat_n_leaf_pages = stats.n_leaf_pages; @@ -2869,9 +3034,7 @@ dict_stats_update_persistent( index != NULL; index = dict_table_get_next_index(index)) { - ut_ad(!dict_index_is_ibuf(index)); - - if (index->type & (DICT_FTS | DICT_SPATIAL)) { + if (!index->is_btree()) { continue; } @@ -2885,6 +3048,12 @@ dict_stats_update_persistent( stats = dict_stats_analyze_index(index); table->stats_mutex_lock(); + if (stats.is_bulk_operation()) { + table->stats_mutex_unlock(); + dict_stats_empty_table(table, false); + return DB_SUCCESS_LOCKED_REC; + } + index->stat_index_size = stats.index_size; index->stat_n_leaf_pages = stats.n_leaf_pages; @@ -3115,7 +3284,9 @@ dict_stats_save( ret = lock_table_for_trx(index_stats, trx, LOCK_X); } if (ret != DB_SUCCESS) { - trx->commit(); + if (trx->state != TRX_STATE_NOT_STARTED) { + trx->commit(); + } goto unlocked_free_and_exit; } @@ -3641,6 +3812,41 @@ dict_stats_fetch_from_ps( stats. */ dict_stats_empty_table(table, true); + THD* thd = current_thd; + MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; + dict_table_t* table_stats = dict_table_open_on_name( + TABLE_STATS_NAME, false, DICT_ERR_IGNORE_NONE); + if (table_stats) { + dict_sys.freeze(SRW_LOCK_CALL); + table_stats = dict_acquire_mdl_shared(table_stats, thd, + &mdl_table); + dict_sys.unfreeze(); + } + if (!table_stats + || strcmp(table_stats->name.m_name, TABLE_STATS_NAME)) { +release_and_exit: + if (table_stats) { + dict_table_close(table_stats, false, thd, mdl_table); + } + return DB_STATS_DO_NOT_EXIST; + } + + dict_table_t* index_stats = dict_table_open_on_name( + INDEX_STATS_NAME, false, DICT_ERR_IGNORE_NONE); + if (index_stats) { + dict_sys.freeze(SRW_LOCK_CALL); + index_stats = dict_acquire_mdl_shared(index_stats, thd, + &mdl_index); + dict_sys.unfreeze(); + } + if (!index_stats) { + goto release_and_exit; + } + if (strcmp(index_stats->name.m_name, INDEX_STATS_NAME)) { + dict_table_close(index_stats, false, thd, mdl_index); + goto release_and_exit; + } + trx = trx_create(); trx_start_internal_read_only(trx); @@ -3723,6 +3929,9 @@ dict_stats_fetch_from_ps( /* pinfo is freed by que_eval_sql() */ dict_sys.unlock(); + dict_table_close(table_stats, false, thd, mdl_table); + dict_table_close(index_stats, false, thd, mdl_index); + trx_commit_for_mysql(trx); trx->free(); @@ -3806,7 +4015,8 @@ dict_stats_update_for_index( /*********************************************************************//** Calculates new estimates for table and index statistics. The statistics are used in query optimization. -@return DB_SUCCESS or error code */ +@return DB_SUCCESS or error code +@retval DB_SUCCESS_LOCKED_REC if the table under bulk insert operation */ dberr_t dict_stats_update( /*==============*/ @@ -3832,7 +4042,7 @@ dict_stats_update( if (trx_id_t bulk_trx_id = table->bulk_trx_id) { if (trx_sys.find(nullptr, bulk_trx_id, false)) { dict_stats_empty_table(table, false); - return DB_SUCCESS; + return DB_SUCCESS_LOCKED_REC; } } @@ -3929,7 +4139,8 @@ dict_stats_update( or is corrupted, calculate the transient stats */ if (innodb_table_stats_not_found == false && - table->stats_error_printed == false) { + table->stats_error_printed == false && + !opt_bootstrap) { ib::error() << "Fetch of persistent statistics" " requested for table " << table->name @@ -4026,9 +4237,7 @@ dict_stats_update( } transient: - dict_stats_update_transient(table); - - return(DB_SUCCESS); + return dict_stats_update_transient(table); } /** Execute DELETE FROM mysql.innodb_table_stats diff --git a/storage/innobase/dict/dict0stats_bg.cc b/storage/innobase/dict/dict0stats_bg.cc index e035c0688ee09..a66aac226a3c8 100644 --- a/storage/innobase/dict/dict0stats_bg.cc +++ b/storage/innobase/dict/dict0stats_bg.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -37,7 +37,6 @@ Created Apr 25, 2012 Vasil Dimov # include "mysql/service_wsrep.h" # include "wsrep.h" # include "log.h" -# include "wsrep_mysqld.h" #endif #include @@ -103,17 +102,18 @@ static void dict_stats_recalc_pool_add(table_id_t id) { ut_ad(!srv_read_only_mode); ut_ad(id); + bool schedule = false; mysql_mutex_lock(&recalc_pool_mutex); const auto begin= recalc_pool.begin(), end= recalc_pool.end(); if (end == std::find_if(begin, end, [&](const recalc &r){return r.id == id;})) { recalc_pool.emplace_back(recalc{id, recalc::IDLE}); + schedule = true; } mysql_mutex_unlock(&recalc_pool_mutex); - - if (begin == end) + if (schedule) dict_stats_schedule_now(); } @@ -339,8 +339,9 @@ static bool dict_stats_process_entry_from_recalc_pool(THD *thd) const bool update_now= difftime(time(nullptr), table->stats_last_recalc) >= MIN_RECALC_INTERVAL; - if (update_now) - dict_stats_update(table, DICT_STATS_RECALC_PERSISTENT); + const dberr_t err= update_now + ? dict_stats_update(table, DICT_STATS_RECALC_PERSISTENT) + : DB_SUCCESS_LOCKED_REC; dict_table_close(table, false, thd, mdl); @@ -361,7 +362,7 @@ static bool dict_stats_process_entry_from_recalc_pool(THD *thd) ut_ad(i->state == recalc::IN_PROGRESS); recalc_pool.erase(i); const bool reschedule= !update_now && recalc_pool.empty(); - if (!update_now) + if (err == DB_SUCCESS_LOCKED_REC) recalc_pool.emplace_back(recalc{table_id, recalc::IDLE}); mysql_mutex_unlock(&recalc_pool_mutex); if (reschedule) @@ -381,7 +382,7 @@ static void dict_stats_func(void*) while (dict_stats_process_entry_from_recalc_pool(thd)) {} dict_defrag_process_entries_from_defrag_pool(thd); set_current_thd(nullptr); - innobase_destroy_background_thd(thd); + destroy_background_thd(thd); } diff --git a/storage/innobase/dict/drop.cc b/storage/innobase/dict/drop.cc index 0093601f32fd8..35b732c53b6c0 100644 --- a/storage/innobase/dict/drop.cc +++ b/storage/innobase/dict/drop.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2021, MariaDB Corporation. +Copyright (c) 2021, 2022, 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 @@ -68,6 +68,8 @@ before transaction commit and must be rolled back explicitly are as follows: #include "dict0defrag_bg.h" #include "btr0defragment.h" +#include "ibuf0ibuf.h" +#include "lock0lock.h" #include "que0que.h" #include "pars0pars.h" @@ -82,7 +84,10 @@ dberr_t trx_t::drop_table_foreign(const table_name_t &name) ut_ad(dict_operation); ut_ad(dict_operation_lock_mode); - if (!dict_sys.sys_foreign || !dict_sys.sys_foreign_cols) + if (!dict_sys.sys_foreign || dict_sys.sys_foreign->corrupted) + return DB_SUCCESS; + + if (!dict_sys.sys_foreign_cols || dict_sys.sys_foreign_cols->corrupted) return DB_SUCCESS; pars_info_t *info= pars_info_create(); @@ -152,7 +157,7 @@ dberr_t trx_t::drop_table(const dict_table_t &table) ut_ad(table.n_lock_x_or_s == 1); ut_ad(UT_LIST_GET_LEN(table.locks) >= 1); #ifdef UNIV_DEBUG - bool found_x; + bool found_x= false; for (lock_t *lock= UT_LIST_GET_FIRST(table.locks); lock; lock= UT_LIST_GET_NEXT(un_member.tab_lock.locks, lock)) { @@ -171,7 +176,7 @@ dberr_t trx_t::drop_table(const dict_table_t &table) ut_ad(found_x); #endif - if (dict_sys.sys_virtual) + if (dict_sys.sys_virtual && !dict_sys.sys_virtual->corrupted) { pars_info_t *info= pars_info_create(); pars_info_add_ull_literal(info, "id", table.id); @@ -233,7 +238,28 @@ void trx_t::commit(std::vector &deleted) commit_persist(); if (dict_operation) { + std::vector space_ids; + space_ids.reserve(mod_tables.size()); ut_ad(dict_sys.locked()); + lock_sys.wr_lock(SRW_LOCK_CALL); + mutex_lock(); + lock_release_on_drop(this); + ut_ad(UT_LIST_GET_LEN(lock.trx_locks) == 0); + ut_ad(ib_vector_is_empty(autoinc_locks)); + mem_heap_empty(lock.lock_heap); + lock.table_locks.clear(); + /* commit_persist() already reset this. */ + ut_ad(!lock.was_chosen_as_deadlock_victim); + lock.n_rec_locks= 0; + while (dict_table_t *table= UT_LIST_GET_FIRST(lock.evicted_tables)) + { + UT_LIST_REMOVE(lock.evicted_tables, table); + dict_mem_table_free(table); + } + dict_operation= false; + id= 0; + mutex_unlock(); + for (const auto &p : mod_tables) { if (p.second.is_dropped()) @@ -244,17 +270,26 @@ void trx_t::commit(std::vector &deleted) if (btr_defragment_active) btr_defragment_remove_table(table); const fil_space_t *space= table->space; - ut_ad(!strstr(table->name.m_name, "/FTS_") || - purge_sys.must_wait_FTS()); + ut_ad(!p.second.is_aux_table() || purge_sys.must_wait_FTS()); dict_sys.remove(table); if (const auto id= space ? space->id : 0) { + space_ids.emplace_back(id); pfs_os_file_t d= fil_delete_tablespace(id); if (d != OS_FILE_CLOSED) deleted.emplace_back(d); } } } + + lock_sys.wr_unlock(); + + mysql_mutex_lock(&lock_sys.wait_mutex); + lock_sys.deadlock_check(); + mysql_mutex_unlock(&lock_sys.wait_mutex); + + for (const auto id : space_ids) + ibuf_delete_for_discarded_space(id); } commit_cleanup(); } diff --git a/storage/innobase/eval/eval0eval.cc b/storage/innobase/eval/eval0eval.cc index 73ab113cff528..bafb0b55d091c 100644 --- a/storage/innobase/eval/eval0eval.cc +++ b/storage/innobase/eval/eval0eval.cc @@ -144,8 +144,8 @@ eval_cmp_like( switch (op) { case IB_LIKE_PREFIX: arg4 = que_node_get_next(arg3); - return(!cmp_dfield_dfield_like_prefix(que_node_get_val(arg1), - que_node_get_val(arg4))); + return(cmp_dfield_dfield_eq_prefix(que_node_get_val(arg1), + que_node_get_val(arg4))); case IB_LIKE_EXACT: return(!cmp_dfield_dfield(que_node_get_val(arg1), que_node_get_val(arg2))); diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 854903721805f..4918cefb947d0 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -640,10 +640,7 @@ static dberr_t fil_space_decrypt_full_crc32( lsn_t lsn = mach_read_from_8(src_frame + FIL_PAGE_LSN); uint offset = mach_read_from_4(src_frame + FIL_PAGE_OFFSET); - ut_a(key_version != ENCRYPTION_KEY_NOT_ENCRYPTED); - - ut_ad(crypt_data); - ut_ad(crypt_data->is_encrypted()); + ut_ad(key_version != ENCRYPTION_KEY_NOT_ENCRYPTED); memcpy(tmp_frame, src_frame, FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); @@ -665,15 +662,7 @@ static dberr_t fil_space_decrypt_full_crc32( (uint) space, offset, lsn); if (rc != MY_AES_OK || dstlen != srclen) { - if (rc == -1) { - return DB_DECRYPTION_FAILED; - } - - ib::fatal() << "Unable to decrypt data-block " - << " src: " << src << "srclen: " - << srclen << " buf: " << dst << "buflen: " - << dstlen << " return-code: " << rc - << " Can't continue!"; + return DB_DECRYPTION_FAILED; } /* Copy only checksum part in the trailer */ @@ -707,8 +696,7 @@ static dberr_t fil_space_decrypt_for_non_full_checksum( src_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); ib_uint64_t lsn = mach_read_from_8(src_frame + FIL_PAGE_LSN); - ut_a(key_version != ENCRYPTION_KEY_NOT_ENCRYPTED); - ut_a(crypt_data != NULL && crypt_data->is_encrypted()); + ut_ad(key_version != ENCRYPTION_KEY_NOT_ENCRYPTED); /* read space & lsn */ uint header_len = FIL_PAGE_DATA; @@ -735,18 +723,7 @@ static dberr_t fil_space_decrypt_for_non_full_checksum( space, offset, lsn); if (! ((rc == MY_AES_OK) && ((ulint) dstlen == srclen))) { - - if (rc == -1) { - return DB_DECRYPTION_FAILED; - } - - ib::fatal() << "Unable to decrypt data-block " - << " src: " << static_cast(src) - << "srclen: " - << srclen << " buf: " - << static_cast(dst) << "buflen: " - << dstlen << " return-code: " << rc - << " Can't continue!"; + return DB_DECRYPTION_FAILED; } /* For compressed tables we do not store the FIL header because @@ -772,8 +749,8 @@ static dberr_t fil_space_decrypt_for_non_full_checksum( @param[in] tmp_frame Temporary buffer @param[in] physical_size page size @param[in,out] src_frame Page to decrypt -@param[out] err DB_SUCCESS or DB_DECRYPTION_FAILED -@return DB_SUCCESS or error */ +@retval DB_SUCCESS on success +@retval DB_DECRYPTION_FAILED on error */ dberr_t fil_space_decrypt( uint32_t space_id, @@ -783,6 +760,10 @@ fil_space_decrypt( ulint physical_size, byte* src_frame) { + if (!crypt_data || !crypt_data->is_encrypted()) { + return DB_DECRYPTION_FAILED; + } + if (fil_space_t::full_crc32(fsp_flags)) { return fil_space_decrypt_full_crc32( space_id, crypt_data, tmp_frame, src_frame); @@ -799,7 +780,8 @@ Decrypt a page. @param[in] tmp_frame Temporary buffer used for decrypting @param[in,out] src_frame Page to decrypt @return decrypted page, or original not encrypted page if decryption is -not needed.*/ +not needed. +@retval nullptr on failure */ byte* fil_space_decrypt( const fil_space_t* space, @@ -808,7 +790,6 @@ fil_space_decrypt( { const ulint physical_size = space->physical_size(); - ut_ad(space->crypt_data != NULL && space->crypt_data->is_encrypted()); ut_ad(space->referenced()); if (DB_SUCCESS != fil_space_decrypt(space->id, space->flags, @@ -820,9 +801,7 @@ fil_space_decrypt( /* Copy the decrypted page back to page buffer, not really any other options. */ - memcpy(src_frame, tmp_frame, physical_size); - - return src_frame; + return static_cast(memcpy(src_frame, tmp_frame, physical_size)); } /***********************************************************************/ @@ -914,43 +893,32 @@ fil_crypt_needs_rotation( /** Read page 0 and possible crypt data from there. @param[in,out] space Tablespace */ -static inline -void -fil_crypt_read_crypt_data(fil_space_t* space) +static inline void fil_crypt_read_crypt_data(fil_space_t *space) { - if (space->crypt_data || space->size || !space->get_size()) { - /* The encryption metadata has already been read, or - the tablespace is not encrypted and the file has been - opened already, or the file cannot be accessed, - likely due to a concurrent DROP - (possibly as part of TRUNCATE or ALTER TABLE). - FIXME: The file can become unaccessible any time - after this check! We should really remove this - function and instead make crypt_data an integral - part of fil_space_t. */ - return; - } + if (space->crypt_data || space->size || !space->get_size()) + /* The encryption metadata has already been read, or the + tablespace is not encrypted and the file has been opened already, + or the file cannot be accessed, likely due to a concurrent DROP + (possibly as part of TRUNCATE or ALTER TABLE). + + FIXME: The file can become unaccessible any time after this check! + We should really remove this function and instead make crypt_data + an integral part of fil_space_t. */ + return; - const ulint zip_size = space->zip_size(); - mtr_t mtr; - mtr.start(); - if (buf_block_t* block = buf_page_get_gen(page_id_t(space->id, 0), - zip_size, RW_S_LATCH, - nullptr, - BUF_GET_POSSIBLY_FREED, - &mtr)) { - if (block->page.is_freed()) { - goto func_exit; - } - mysql_mutex_lock(&fil_system.mutex); - if (!space->crypt_data && !space->is_stopping()) { - space->crypt_data = fil_space_read_crypt_data( - zip_size, block->page.frame); - } - mysql_mutex_unlock(&fil_system.mutex); - } -func_exit: - mtr.commit(); + const ulint zip_size= space->zip_size(); + mtr_t mtr; + mtr.start(); + if (buf_block_t* b= buf_page_get_gen(page_id_t{space->id, 0}, zip_size, + RW_S_LATCH, nullptr, + BUF_GET_POSSIBLY_FREED, &mtr)) + { + mysql_mutex_lock(&fil_system.mutex); + if (!space->crypt_data && !space->is_stopping()) + space->crypt_data= fil_space_read_crypt_data(zip_size, b->page.frame); + mysql_mutex_unlock(&fil_system.mutex); + } + mtr.commit(); } /** Start encrypting a space @@ -997,15 +965,9 @@ static bool fil_crypt_start_encrypting_space(fil_space_t* space) mtr.start(); /* 2 - get page 0 */ - dberr_t err = DB_SUCCESS; if (buf_block_t* block = buf_page_get_gen( page_id_t(space->id, 0), space->zip_size(), - RW_X_LATCH, NULL, BUF_GET_POSSIBLY_FREED, - &mtr, &err)) { - if (block->page.is_freed()) { - goto abort; - } - + RW_X_LATCH, NULL, BUF_GET_POSSIBLY_FREED, &mtr)) { crypt_data->type = CRYPT_SCHEME_1; crypt_data->min_key_version = 0; // all pages are unencrypted crypt_data->rotate_state.start_time = time(0); @@ -1381,7 +1343,7 @@ inline bool fil_space_t::acquire_if_not_stopped() return true; if (UNIV_UNLIKELY(n & STOPPING)) return false; - return UNIV_LIKELY(!(n & CLOSING)) || prepare(true); + return UNIV_LIKELY(!(n & CLOSING)) || prepare_acquired(); } bool fil_crypt_must_default_encrypt() @@ -1497,7 +1459,7 @@ space_list_t::iterator fil_space_t::next(space_list_t::iterator space, const uint32_t n= space->acquire_low(); if (UNIV_LIKELY(!(n & (STOPPING | CLOSING)))) break; - if (!(n & STOPPING) && space->prepare(true)) + if (!(n & STOPPING) && space->prepare_acquired()) break; } } @@ -1716,7 +1678,9 @@ fil_crypt_get_page_throttle( return NULL; } - if (fseg_page_is_free(space, state->offset)) { + if (offset % (zip_size ? zip_size : srv_page_size) + && DB_SUCCESS_LOCKED_REC + != fseg_page_is_allocated(space, offset)) { /* page is already freed */ return NULL; } @@ -1794,10 +1758,7 @@ fil_crypt_rotate_page( const lsn_t block_lsn = mach_read_from_8(FIL_PAGE_LSN + frame); uint kv = buf_page_get_key_version(frame, space->flags); - if (block->page.is_freed()) { - /* Do not modify freed pages to avoid an assertion - failure on recovery.*/ - } else if (block->page.oldest_modification() > 1) { + if (block->page.oldest_modification() > 1) { /* Do not unnecessarily touch pages that are already dirty. */ } else if (space->is_stopping()) { @@ -1809,11 +1770,11 @@ fil_crypt_rotate_page( allocated. Because key rotation is accessing pages in a pattern that is unlike the normal B-tree and undo log access pattern, we cannot - invoke fseg_page_is_free() here, because that + invoke fseg_page_is_allocated() here, because that could result in a deadlock. If we invoked - fseg_page_is_free() and released the + fseg_page_is_allocated() and released the tablespace latch before acquiring block->lock, - then the fseg_page_is_free() information + then the fseg_page_is_allocated() information could be stale already. */ /* If the data file was originally created @@ -1871,9 +1832,7 @@ fil_crypt_rotate_page( } else { /* If block read failed mtr memo and log should be empty. */ ut_ad(!mtr.has_modifications()); - ut_ad(!mtr.is_dirty()); - ut_ad(mtr.get_memo()->size() == 0); - ut_ad(mtr.get_log()->size() == 0); + ut_ad(mtr.is_empty()); mtr.commit(); } @@ -1974,10 +1933,8 @@ fil_crypt_flush_space( if (buf_block_t* block = buf_page_get_gen( page_id_t(space->id, 0), space->zip_size(), RW_X_LATCH, NULL, BUF_GET_POSSIBLY_FREED, &mtr)) { - if (block->page.is_freed()) { - mtr.set_named_space(space); - crypt_data->write_page0(block, &mtr); - } + mtr.set_named_space(space); + crypt_data->write_page0(block, &mtr); } mtr.commit(); diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index cd2c867de6089..be313140225ea 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -45,10 +45,9 @@ Created 10/25/1995 Heikki Tuuri #include "srv0start.h" #include "trx0purge.h" #include "buf0lru.h" -#include "ibuf0ibuf.h" #include "buf0flu.h" #include "log.h" -#ifdef UNIV_LINUX +#ifdef __linux__ # include # include # include @@ -60,6 +59,12 @@ Created 10/25/1995 Heikki Tuuri #include "bzlib.h" #include "snappy-c.h" +ATTRIBUTE_COLD void fil_space_t::set_corrupted() const +{ + if (!is_stopping() && !is_corrupted.test_and_set()) + sql_print_error("InnoDB: File '%s' is corrupted", chain.start->name); +} + /** Try to close a file to adhere to the innodb_open_files limit. @param print_info whether to diagnose why a file cannot be closed @return whether a file was closed */ @@ -83,13 +88,21 @@ bool fil_space_t::try_to_close(bool print_info) of fil_system.space_list, so that they would be less likely to be closed here. */ fil_node_t *node= UT_LIST_GET_FIRST(space.chain); - ut_ad(node); + if (!node) + /* fil_ibd_create() did not invoke fil_space_t::add() yet */ + continue; ut_ad(!UT_LIST_GET_NEXT(chain, node)); if (!node->is_open()) continue; - if (const auto n= space.set_closing()) + /* Other thread is trying to do fil_delete_tablespace() + concurrently for the same tablespace. So ignore this + tablespace and try to close the other one */ + const auto n= space.set_closing(); + if (n & STOPPING) + continue; + if (n & (PENDING | NEEDS_FSYNC)) { if (!print_info) continue; @@ -111,22 +124,15 @@ bool fil_space_t::try_to_close(bool print_info) } node->close(); + + fil_system.move_closed_last_to_space_list(node->space); + return true; } return false; } -/** Rename a single-table tablespace. -The tablespace must exist in the memory cache. -@param[in] id tablespace identifier -@param[in] old_path old file name -@param[in] new_path_in new file name, -or NULL if it is located in the normal data directory -@return true if success */ -static bool fil_rename_tablespace(uint32_t id, const char *old_path, - const char *new_path_in); - /* IMPLEMENTATION OF THE TABLESPACE MEMORY CACHE ============================================= @@ -225,9 +231,7 @@ fil_space_t *fil_space_get_by_id(uint32_t id) mysql_mutex_assert_owner(&fil_system.mutex); HASH_SEARCH(hash, &fil_system.spaces, id, - fil_space_t*, space, - ut_ad(space->magic_n == FIL_SPACE_MAGIC_N), - space->id == id); + fil_space_t*, space,, space->id == id); return(space); } @@ -290,6 +294,8 @@ fil_node_t* fil_space_t::add(const char* name, pfs_os_file_t handle, uint32_t size, bool is_raw, bool atomic_write, uint32_t max_pages) { + mysql_mutex_assert_owner(&fil_system.mutex); + fil_node_t* node; ut_ad(name != NULL); @@ -314,7 +320,6 @@ fil_node_t* fil_space_t::add(const char* name, pfs_os_file_t handle, node->atomic_write = atomic_write; - mysql_mutex_lock(&fil_system.mutex); this->size += size; UT_LIST_ADD_LAST(chain, node); if (node->is_open()) { @@ -325,7 +330,6 @@ fil_node_t* fil_space_t::add(const char* name, pfs_os_file_t handle, release(); } } - mysql_mutex_unlock(&fil_system.mutex); return node; } @@ -397,13 +401,7 @@ static bool fil_node_open_file_low(fil_node_t *node) ut_ad(node->is_open()); - if (UNIV_LIKELY(!fil_system.freeze_space_list)) - { - /* Move the file last in fil_system.space_list, so that - fil_space_t::try_to_close() should close it as a last resort. */ - fil_system.space_list.erase(space_list_t::iterator(node->space)); - fil_system.space_list.push_back(*node->space); - } + fil_system.move_opened_last_to_space_list(node->space); fil_system.n_open++; return true; @@ -444,6 +442,8 @@ static bool fil_node_open_file(fil_node_t *node) /* Flush tablespaces so that we can close modified files. */ fil_flush_file_spaces(); mysql_mutex_lock(&fil_system.mutex); + if (node->is_open()) + return true; } } @@ -651,11 +651,9 @@ fil_space_extend_must_retry( } /** @return whether the file is usable for io() */ -ATTRIBUTE_COLD bool fil_space_t::prepare(bool have_mutex) +ATTRIBUTE_COLD bool fil_space_t::prepare_acquired() { ut_ad(referenced()); - if (!have_mutex) - mysql_mutex_lock(&fil_system.mutex); mysql_mutex_assert_owner(&fil_system.mutex); fil_node_t *node= UT_LIST_GET_LAST(chain); ut_ad(!id || purpose == FIL_TYPE_TEMPORARY || @@ -665,6 +663,7 @@ ATTRIBUTE_COLD bool fil_space_t::prepare(bool have_mutex) if (!is_open) release(); + else if (node->deferred); else if (auto desired_size= recv_size) { bool success; @@ -700,8 +699,16 @@ ATTRIBUTE_COLD bool fil_space_t::prepare(bool have_mutex) clear: clear_closing(); - if (!have_mutex) - mysql_mutex_unlock(&fil_system.mutex); + return is_open; +} + +/** @return whether the file is usable for io() */ +ATTRIBUTE_COLD bool fil_space_t::acquire_and_prepare() +{ + mysql_mutex_lock(&fil_system.mutex); + const auto flags= acquire_low() & (STOPPING | CLOSING); + const bool is_open= !flags || (flags == CLOSING && prepare_acquired()); + mysql_mutex_unlock(&fil_system.mutex); return is_open; } @@ -791,14 +798,31 @@ pfs_os_file_t fil_system_t::detach(fil_space_t *space, bool detach_handle) space->is_in_default_encrypt= false; default_encrypt_tables.remove(*space); } - space_list.erase(space_list_t::iterator(space)); + + { + space_list_t::iterator s= space_list_t::iterator(space); + if (space_list_last_opened == space) + { + if (s == space_list.begin()) + { + ut_ad(srv_operation > SRV_OPERATION_EXPORT_RESTORED || + srv_shutdown_state > SRV_SHUTDOWN_NONE); + space_list_last_opened= nullptr; + } + else + { + space_list_t::iterator prev= s; + space_list_last_opened= &*--prev; + } + } + space_list.erase(s); + } + if (space == sys_space) sys_space= nullptr; else if (space == temp_space) temp_space= nullptr; - ut_a(space->magic_n == FIL_SPACE_MAGIC_N); - for (fil_node_t* node= UT_LIST_GET_FIRST(space->chain); node; node= UT_LIST_GET_NEXT(chain, node)) if (node->is_open()) @@ -881,18 +905,22 @@ bool fil_space_free(uint32_t id, bool x_latched) } if (!recv_recovery_is_on()) { - mysql_mutex_lock(&log_sys.mutex); - } + log_sys.latch.wr_lock(SRW_LOCK_CALL); - mysql_mutex_assert_owner(&log_sys.mutex); - - if (space->max_lsn != 0) { - ut_d(space->max_lsn = 0); - fil_system.named_spaces.remove(*space); - } + if (space->max_lsn) { + ut_d(space->max_lsn = 0); + fil_system.named_spaces.remove(*space); + } - if (!recv_recovery_is_on()) { - mysql_mutex_unlock(&log_sys.mutex); + log_sys.latch.wr_unlock(); + } else { +#ifndef SUX_LOCK_GENERIC + ut_ad(log_sys.latch.is_write_locked()); +#endif + if (space->max_lsn) { + ut_d(space->max_lsn = 0); + fil_system.named_spaces.remove(*space); + } } fil_space_free_low(space); @@ -908,15 +936,18 @@ bool fil_space_free(uint32_t id, bool x_latched) @param purpose tablespace purpose @param crypt_data encryption information @param mode encryption mode +@param opened true if space files are opened @return pointer to created tablespace, to be filled in with add() @retval nullptr on failure (such as when the same tablespace exists) */ fil_space_t *fil_space_t::create(uint32_t id, uint32_t flags, fil_type_t purpose, fil_space_crypt_t *crypt_data, - fil_encryption_t mode) + fil_encryption_t mode, + bool opened) { fil_space_t* space; + mysql_mutex_assert_owner(&fil_system.mutex); ut_ad(fil_system.is_initialised()); ut_ad(fil_space_t::is_valid_flags(flags & ~FSP_FLAGS_MEM_MASK, id)); ut_ad(srv_page_size == UNIV_PAGE_SIZE_ORIG || flags != 0); @@ -934,7 +965,6 @@ fil_space_t *fil_space_t::create(uint32_t id, uint32_t flags, space->purpose = purpose; space->flags = flags; - space->magic_n = FIL_SPACE_MAGIC_N; space->crypt_data = crypt_data; space->n_pending.store(CLOSING, std::memory_order_relaxed); @@ -950,8 +980,6 @@ fil_space_t *fil_space_t::create(uint32_t id, uint32_t flags, space->latch.SRW_LOCK_INIT(fil_space_latch_key); - mysql_mutex_lock(&fil_system.mutex); - if (const fil_space_t *old_space = fil_space_get_by_id(id)) { ib::error() << "Trying to add tablespace with id " << id << " to the cache, but tablespace '" @@ -959,7 +987,6 @@ fil_space_t *fil_space_t::create(uint32_t id, uint32_t flags, ? old_space->chain.start->name : "") << "' already exists in the cache!"; - mysql_mutex_unlock(&fil_system.mutex); space->~fil_space_t(); ut_free(space); return(NULL); @@ -967,7 +994,10 @@ fil_space_t *fil_space_t::create(uint32_t id, uint32_t flags, HASH_INSERT(fil_space_t, hash, &fil_system.spaces, id, space); - fil_system.space_list.push_back(*space); + if (opened) + fil_system.add_opened_last_to_space_list(space); + else + fil_system.space_list.push_back(*space); switch (id) { case 0: @@ -983,6 +1013,9 @@ fil_space_t *fil_space_t::create(uint32_t id, uint32_t flags, if (UNIV_LIKELY(id <= fil_system.max_assigned_id)) { break; } + if (UNIV_UNLIKELY(srv_operation == SRV_OPERATION_BACKUP)) { + break; + } if (!fil_system.space_id_reuse_warned) { ib::warn() << "Allocated tablespace ID " << id << ", old maximum was " @@ -1000,12 +1033,12 @@ fil_space_t *fil_space_t::create(uint32_t id, uint32_t flags, if (rotate) { fil_system.default_encrypt_tables.push_back(*space); space->is_in_default_encrypt = true; - } - mysql_mutex_unlock(&fil_system.mutex); - - if (rotate && srv_n_fil_crypt_threads_started) { - fil_crypt_threads_signal(); + if (srv_n_fil_crypt_threads_started) { + mysql_mutex_unlock(&fil_system.mutex); + fil_crypt_threads_signal(); + mysql_mutex_lock(&fil_system.mutex); + } } return(space); @@ -1128,7 +1161,10 @@ bool fil_space_t::open(bool create_new_db) } if (create_new_db) + { + node->find_metadata(node->handle); continue; + } if (skip_read) { size+= node->size; @@ -1196,7 +1232,7 @@ void fil_system_t::create(ulint hash_size) spaces.create(hash_size); fil_space_crypt_init(); -#ifdef UNIV_LINUX +#ifdef __linux__ ssd.clear(); char fn[sizeof(dirent::d_name) + sizeof "/sys/block/" "/queue/rotational"]; @@ -1276,10 +1312,19 @@ void fil_system_t::close() ut_ad(!spaces.array); -#ifdef UNIV_LINUX +#ifdef __linux__ ssd.clear(); ssd.shrink_to_fit(); -#endif /* UNIV_LINUX */ +#endif /* __linux__ */ +} + +void fil_system_t::add_opened_last_to_space_list(fil_space_t *space) +{ + if (UNIV_LIKELY(space_list_last_opened != nullptr)) + space_list.insert(++space_list_t::iterator(space_list_last_opened), *space); + else + space_list.push_front(*space); + space_list_last_opened= space; } /** Extend all open data files to the recovered size */ @@ -1337,7 +1382,10 @@ void fil_space_t::close_all() for (ulint count= 10000; count--;) { - if (!space.set_closing()) + const auto n= space.set_closing(); + if (n & STOPPING) + goto next; + if (!(n & (PENDING | NEEDS_FSYNC))) { node->close(); goto next; @@ -1391,13 +1439,13 @@ fil_space_t *fil_space_t::get(uint32_t id) mysql_mutex_lock(&fil_system.mutex); fil_space_t *space= fil_space_get_by_id(id); const uint32_t n= space ? space->acquire_low() : 0; - mysql_mutex_unlock(&fil_system.mutex); if (n & STOPPING) space= nullptr; - else if ((n & CLOSING) && !space->prepare()) + else if ((n & CLOSING) && !space->prepare_acquired()) space= nullptr; + mysql_mutex_unlock(&fil_system.mutex); return space; } @@ -1417,8 +1465,8 @@ inline void mtr_t::log_file_op(mfile_type_t type, uint32_t space_id, ut_ad(strchr(path, '/')); ut_ad(!strcmp(&path[strlen(path) - strlen(DOT_IBD)], DOT_IBD)); - flag_modified(); - if (m_log_mode != MTR_LOG_ALL) + m_modifications= true; + if (!is_logged()) return; m_last= nullptr; @@ -1460,39 +1508,6 @@ inline void mtr_t::log_file_op(mfile_type_t type, uint32_t space_id, m_log.push(reinterpret_cast(path), uint32_t(len)); } -/** Write redo log for renaming a file. -@param[in] space_id tablespace id -@param[in] old_name tablespace file name -@param[in] new_name tablespace file name after renaming -@param[in,out] mtr mini-transaction */ -static void fil_name_write_rename_low(uint32_t space_id, const char *old_name, - const char *new_name, mtr_t *mtr) -{ - ut_ad(!is_predefined_tablespace(space_id)); - mtr->log_file_op(FILE_RENAME, space_id, old_name, new_name); -} - -static void fil_name_commit_durable(mtr_t *mtr) -{ - mysql_mutex_lock(&log_sys.mutex); - auto lsn= mtr->commit_files(); - mysql_mutex_unlock(&log_sys.mutex); - log_write_up_to(lsn, true); -} - -/** Write redo log for renaming a file. -@param[in] space_id tablespace id -@param[in] old_name tablespace file name -@param[in] new_name tablespace file name after renaming */ -static void fil_name_write_rename(uint32_t space_id, - const char *old_name, const char* new_name) -{ - mtr_t mtr; - mtr.start(); - fil_name_write_rename_low(space_id, old_name, new_name, &mtr); - fil_name_commit_durable(&mtr); -} - /** Write FILE_MODIFY for a file. @param[in] space_id tablespace id @param[in] name tablespace file name @@ -1620,45 +1635,10 @@ pfs_os_file_t fil_delete_tablespace(uint32_t id) mtr_t mtr; mtr.start(); mtr.log_file_op(FILE_DELETE, id, space->chain.start->name); - fil_name_commit_durable(&mtr); - - /* Remove any additional files. */ - if (char *cfg_name= fil_make_filepath(space->chain.start->name, - fil_space_t::name_type{}, CFG, - false)) - { - os_file_delete_if_exists(innodb_data_file_key, cfg_name, nullptr); - ut_free(cfg_name); - } - if (FSP_FLAGS_HAS_DATA_DIR(space->flags)) - RemoteDatafile::delete_link_file(space->name()); - - /* Remove the directory entry. The file will actually be deleted - when our caller closes the handle. */ - os_file_delete(innodb_data_file_key, space->chain.start->name); - - mysql_mutex_lock(&fil_system.mutex); - /* Sanity checks after reacquiring fil_system.mutex */ - ut_ad(space == fil_space_get_by_id(id)); - ut_ad(!space->referenced()); - ut_ad(space->is_stopping()); - ut_ad(UT_LIST_GET_LEN(space->chain) == 1); - /* Detach the file handle. */ - handle= fil_system.detach(space, true); - mysql_mutex_unlock(&fil_system.mutex); - - mysql_mutex_lock(&log_sys.mutex); - if (space->max_lsn) - { - ut_d(space->max_lsn = 0); - fil_system.named_spaces.remove(*space); - } - mysql_mutex_unlock(&log_sys.mutex); - + mtr.commit_file(*space, nullptr, &handle); fil_space_free_low(space); } - ibuf_delete_for_discarded_space(id); return handle; } @@ -1709,9 +1689,10 @@ char* fil_make_filepath(const char *path, const fil_space_t::name_type &name, if (path != NULL) { memcpy(full_name, path, path_len); len = path_len; - full_name[len] = '\0'; } + full_name[len] = '\0'; + if (trim_name) { /* Find the offset of the last DIR separator and set it to null in order to strip off the old basename from this path. */ @@ -1777,117 +1758,55 @@ char *fil_make_filepath(const char* path, const table_name_t name, dberr_t fil_space_t::rename(const char *path, bool log, bool replace) { ut_ad(UT_LIST_GET_LEN(chain) == 1); - ut_ad(!is_system_tablespace(id)); + ut_ad(!is_predefined_tablespace(id)); const char *old_path= chain.start->name; + ut_ad(strchr(old_path, '/')); + ut_ad(strchr(path, '/')); + if (!strcmp(path, old_path)) return DB_SUCCESS; - if (log) + if (!log) { - bool exists= false; - os_file_type_t ftype; - - if (os_file_status(old_path, &exists, &ftype) && !exists) - { - ib::error() << "Cannot rename '" << old_path << "' to '" << path - << "' because the source file does not exist."; - return DB_TABLESPACE_NOT_FOUND; - } - - exists= false; - if (replace); - else if (!os_file_status(path, &exists, &ftype) || exists) - { - ib::error() << "Cannot rename '" << old_path << "' to '" << path - << "' because the target file exists."; - return DB_TABLESPACE_EXISTS; - } - - fil_name_write_rename(id, old_path, path); + if (!os_file_rename(innodb_data_file_key, old_path, path)) + return DB_ERROR; + mysql_mutex_lock(&fil_system.mutex); + ut_free(chain.start->name); + chain.start->name= mem_strdup(path); + mysql_mutex_unlock(&fil_system.mutex); + return DB_SUCCESS; } - return fil_rename_tablespace(id, old_path, path) ? DB_SUCCESS : DB_ERROR; -} - -/** Rename a single-table tablespace. -The tablespace must exist in the memory cache. -@param[in] id tablespace identifier -@param[in] old_path old file name -@param[in] new_path_in new file name, -or NULL if it is located in the normal data directory -@return true if success */ -static bool fil_rename_tablespace(uint32_t id, const char *old_path, - const char *new_path_in) -{ - fil_space_t* space; - fil_node_t* node; - ut_a(id != 0); - - mysql_mutex_lock(&fil_system.mutex); - - space = fil_space_get_by_id(id); + bool exists= false; + os_file_type_t ftype; - if (space == NULL) { - ib::error() << "Cannot find space id " << id - << " in the tablespace memory cache, though the file '" - << old_path - << "' in a rename operation should have that id."; - mysql_mutex_unlock(&fil_system.mutex); - return(false); - } - - /* The following code must change when InnoDB supports - multiple datafiles per tablespace. */ - ut_a(UT_LIST_GET_LEN(space->chain) == 1); - node = UT_LIST_GET_FIRST(space->chain); - space->reacquire(); - - mysql_mutex_unlock(&fil_system.mutex); - - char* new_file_name = mem_strdup(new_path_in); - char* old_file_name = node->name; - - ut_ad(strchr(old_file_name, '/')); - ut_ad(strchr(new_file_name, '/')); - - if (!recv_recovery_is_on()) { - mysql_mutex_lock(&log_sys.mutex); - } - - /* log_sys.mutex is above fil_system.mutex in the latching order */ - mysql_mutex_assert_owner(&log_sys.mutex); - mysql_mutex_lock(&fil_system.mutex); - space->release(); - ut_ad(node->name == old_file_name); - bool success; - DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2", - goto skip_second_rename; ); - success = os_file_rename(innodb_data_file_key, - old_file_name, - new_file_name); - DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2", -skip_second_rename: - success = false; ); - - ut_ad(node->name == old_file_name); - - if (success) { - node->name = new_file_name; - } else { - old_file_name = new_file_name; - } - - if (!recv_recovery_is_on()) { - mysql_mutex_unlock(&log_sys.mutex); - } - - mysql_mutex_unlock(&fil_system.mutex); + /* Check upfront if the rename operation might succeed, because we + must durably write redo log before actually attempting to execute + the rename in the file system. */ + if (os_file_status(old_path, &exists, &ftype) && !exists) + { + sql_print_error("InnoDB: Cannot rename '%s' to '%s'" + " because the source file does not exist.", + old_path, path); + return DB_TABLESPACE_NOT_FOUND; + } - ut_free(old_file_name); + exists= false; + if (replace); + else if (!os_file_status(path, &exists, &ftype) || exists) + { + sql_print_error("InnoDB: Cannot rename '%s' to '%s'" + " because the target file exists.", + old_path, path); + return DB_TABLESPACE_EXISTS; + } - return(success); + mtr_t mtr; + mtr.start(); + mtr.log_file_op(FILE_RENAME, id, old_path, path); + return mtr.commit_file(*this, path) ? DB_SUCCESS : DB_ERROR; } /** Create a tablespace file. @@ -1933,7 +1852,11 @@ fil_ibd_create( mtr.start(); mtr.log_file_op(FILE_CREATE, space_id, path); - fil_name_commit_durable(&mtr); + log_sys.latch.wr_lock(SRW_LOCK_CALL); + auto lsn= mtr.commit_files(); + log_sys.latch.wr_unlock(); + mtr.flag_wr_unlock(); + log_write_up_to(lsn, true); ulint type; static_assert(((UNIV_ZIP_SIZE_MIN >> 1) << 3) == 4096, @@ -2022,17 +1945,23 @@ fil_ibd_create( } } + DBUG_EXECUTE_IF("checkpoint_after_file_create", + log_make_checkpoint();); + + mysql_mutex_lock(&fil_system.mutex); if (fil_space_t* space = fil_space_t::create(space_id, flags, FIL_TYPE_TABLESPACE, - crypt_data, mode)) { + crypt_data, mode, true)) { fil_node_t* node = space->add(path, file, size, false, true); + mysql_mutex_unlock(&fil_system.mutex); IF_WIN(node->find_metadata(), node->find_metadata(file, true)); mtr.start(); mtr.set_named_space(space); - fsp_header_init(space, size, &mtr); + ut_a(fsp_header_init(space, size, &mtr) == DB_SUCCESS); mtr.commit(); - *err = DB_SUCCESS; return space; + } else { + mysql_mutex_unlock(&fil_system.mutex); } if (space_name.data()) { @@ -2063,7 +1992,7 @@ a remote tablespace is found it will be changed to true. If the fix_dict boolean is set, then it is safe to use an internal SQL statement to update the dictionary tables if they are incorrect. -@param[in] validate true if we should validate the tablespace +@param[in] validate 0=maybe missing, 1=do not validate, 2=validate @param[in] purpose FIL_TYPE_TABLESPACE or FIL_TYPE_TEMPORARY @param[in] id tablespace ID @param[in] flags expected FSP_SPACE_FLAGS @@ -2075,7 +2004,7 @@ If file-per-table, it is the table name in the databasename/tablename format @retval NULL if the tablespace could not be opened */ fil_space_t* fil_ibd_open( - bool validate, + unsigned validate, fil_type_t purpose, uint32_t id, uint32_t flags, @@ -2087,7 +2016,7 @@ fil_ibd_open( fil_space_t* space = fil_space_get_by_id(id); mysql_mutex_unlock(&fil_system.mutex); if (space) { - if (validate && !srv_read_only_mode) { + if (validate > 1 && !srv_read_only_mode) { fsp_flags_try_adjust(space, flags & ~FSP_FLAGS_MEM_MASK); } @@ -2124,8 +2053,9 @@ fil_ibd_open( /* Look for a filepath embedded in an ISL where the default file would be. */ - if (df_remote.open_link_file(name)) { - validate = true; + bool must_validate = df_remote.open_link_file(name); + + if (must_validate) { if (df_remote.open_read_only(true) == DB_SUCCESS) { ut_ad(df_remote.is_open()); ++tablespaces_found; @@ -2138,16 +2068,17 @@ fil_ibd_open( << df_remote.filepath() << "' could not be opened read-only."; } + } else if (path_in && !df_default.same_filepath_as(path_in)) { + /* Dict path is not the default path. Always validate + remote files. If default is opened, it was moved. */ + must_validate = true; + } else if (validate > 1) { + must_validate = true; } - /* Attempt to open the tablespace at the dictionary filepath. */ - if (path_in) { - if (!df_default.same_filepath_as(path_in)) { - /* Dict path is not the default path. Always validate - remote files. If default is opened, it was moved. */ - validate = true; - } - } + const bool operation_not_for_export = + srv_operation != SRV_OPERATION_RESTORE_EXPORT + && srv_operation != SRV_OPERATION_EXPORT_RESTORED; /* Always look for a file at the default location. But don't log an error if the tablespace is already open in remote or dict. */ @@ -2158,7 +2089,8 @@ fil_ibd_open( the first server startup. The tables ought to be dropped by drop_garbage_tables_after_restore() a little later. */ - const bool strict = !tablespaces_found + const bool strict = validate && !tablespaces_found + && operation_not_for_export && !(srv_operation == SRV_OPERATION_NORMAL && srv_start_after_restore && srv_force_recovery < SRV_FORCE_NO_BACKGROUND @@ -2184,7 +2116,7 @@ fil_ibd_open( normal, we only found 1. */ /* For encrypted tablespace, we need to check the encryption in header of first page. */ - if (!validate && tablespaces_found == 1) { + if (!must_validate && tablespaces_found == 1) { goto skip_validate; } @@ -2200,20 +2132,25 @@ fil_ibd_open( First, bail out if no tablespace files were found. */ if (valid_tablespaces_found == 0) { if (!strict - && IF_WIN(GetLastError() == ERROR_FILE_NOT_FOUND, + && IF_WIN(GetLastError() == ERROR_FILE_NOT_FOUND + || GetLastError() == ERROR_PATH_NOT_FOUND, errno == ENOENT)) { /* Suppress a message about a missing file. */ goto corrupted; } - os_file_get_last_error(true); + os_file_get_last_error(operation_not_for_export, + !operation_not_for_export); + if (!operation_not_for_export) { + goto corrupted; + } sql_print_error("InnoDB: Could not find a valid tablespace" " file for %.*s. %s", static_cast(name.size()), name.data(), TROUBLESHOOT_DATADICT_MSG); goto corrupted; } - if (!validate) { + if (!must_validate) { goto skip_validate; } @@ -2284,8 +2221,10 @@ fil_ibd_open( first_page) : NULL; + mysql_mutex_lock(&fil_system.mutex); space = fil_space_t::create(id, flags, purpose, crypt_data); if (!space) { + mysql_mutex_unlock(&fil_system.mutex); goto error; } @@ -2295,8 +2234,9 @@ fil_ibd_open( space->add( df_remote.is_open() ? df_remote.filepath() : df_default.filepath(), OS_FILE_CLOSED, 0, false, true); + mysql_mutex_unlock(&fil_system.mutex); - if (validate && !srv_read_only_mode) { + if (must_validate && !srv_read_only_mode) { df_remote.close(); df_default.close(); if (space->acquire()) { @@ -2366,12 +2306,14 @@ fil_ibd_discover( switch (srv_operation) { case SRV_OPERATION_BACKUP: case SRV_OPERATION_RESTORE_DELTA: + case SRV_OPERATION_BACKUP_NO_DEFER: ut_ad(0); break; case SRV_OPERATION_RESTORE_EXPORT: case SRV_OPERATION_RESTORE: break; case SRV_OPERATION_NORMAL: + case SRV_OPERATION_EXPORT_RESTORED: size_t len= strlen(db); if (len <= 4 || strcmp(db + len - 4, dot_ext[IBD])) { break; @@ -2571,10 +2513,20 @@ fil_ibd_load(uint32_t space_id, const char *filename, fil_space_t *&space) ? fil_space_read_crypt_data(fil_space_t::zip_size(flags), first_page) : NULL; + + if (crypt_data && !crypt_data->is_key_found()) { + crypt_data->~fil_space_crypt_t(); + ut_free(crypt_data); + return FIL_LOAD_INVALID; + } + + mysql_mutex_lock(&fil_system.mutex); + space = fil_space_t::create( space_id, flags, FIL_TYPE_TABLESPACE, crypt_data); if (space == NULL) { + mysql_mutex_unlock(&fil_system.mutex); return(FIL_LOAD_INVALID); } @@ -2586,6 +2538,7 @@ fil_ibd_load(uint32_t space_id, const char *filename, fil_space_t *&space) let fil_node_open() do that task. */ space->add(file.filepath(), OS_FILE_CLOSED, 0, false, false); + mysql_mutex_unlock(&fil_system.mutex); return(FIL_LOAD_OK); } @@ -2680,16 +2633,16 @@ fil_space_t *fil_space_for_table_exists_in_mem(uint32_t id, /** Report information about an invalid page access. */ ATTRIBUTE_COLD -static void fil_invalid_page_access_msg(bool fatal, const char *name, +static void fil_invalid_page_access_msg(const char *name, os_offset_t offset, ulint len, bool is_read) { - sql_print_error("%s%s %zu bytes at " UINT64PF + sql_print_error("%s %zu bytes at " UINT64PF " outside the bounds of the file: %s", - fatal ? "[FATAL] InnoDB: " : "InnoDB: ", - is_read ? "Trying to read" : "Trying to write", - len, offset, name); - if (fatal) + is_read + ? "InnoDB: Trying to read" + : "[FATAL] InnoDB: Trying to write", len, offset, name); + if (!is_read) abort(); } @@ -2738,14 +2691,22 @@ fil_io_t fil_space_t::io(const IORequest &type, os_offset_t offset, size_t len, fil_node_t* node= UT_LIST_GET_FIRST(chain); ut_ad(node); + ulint p = static_cast(offset >> srv_page_size_shift); + dberr_t err; if (type.type == IORequest::READ_ASYNC && is_stopping()) { - release(); - return {DB_TABLESPACE_DELETED, nullptr}; + err = DB_TABLESPACE_DELETED; + node = nullptr; + goto release; } - ulint p = static_cast(offset >> srv_page_size_shift); - bool fatal; + DBUG_EXECUTE_IF("intermittent_recovery_failure", + if (type.is_read() && !(~get_rnd_value() & 0x3ff0)) + goto io_error;); + + DBUG_EXECUTE_IF("intermittent_read_failure", + if (srv_was_started && type.is_read() && + !(~get_rnd_value() & 0x3ff0)) goto io_error;); if (UNIV_LIKELY_NULL(UT_LIST_GET_NEXT(chain, node))) { ut_ad(this == fil_system.sys_space @@ -2756,16 +2717,20 @@ fil_io_t fil_space_t::io(const IORequest &type, os_offset_t offset, size_t len, p -= node->size; node = UT_LIST_GET_NEXT(chain, node); if (!node) { - release(); - if (type.type != IORequest::READ_ASYNC) { - fatal = true; fail: + if (type.type != IORequest::READ_ASYNC) { fil_invalid_page_access_msg( - fatal, node->name, + node->name, offset, len, type.is_read()); } - return {DB_IO_ERROR, nullptr}; +#ifndef DBUG_OFF +io_error: +#endif + set_corrupted(); + err = DB_CORRUPTION; + node = nullptr; + goto release; } } @@ -2773,21 +2738,9 @@ fil_io_t fil_space_t::io(const IORequest &type, os_offset_t offset, size_t len, } if (UNIV_UNLIKELY(node->size <= p)) { - release(); - - if (type.type == IORequest::READ_ASYNC) { - /* If we can tolerate the non-existent pages, we - should return with DB_ERROR and let caller decide - what to do. */ - return {DB_ERROR, nullptr}; - } - - fatal = node->space->purpose != FIL_TYPE_IMPORT; goto fail; } - dberr_t err; - if (type.type == IORequest::PUNCH_RANGE) { err = os_file_punch_hole(node->handle, offset, len); /* Punch hole is not supported, make space not to @@ -2803,22 +2756,20 @@ fil_io_t fil_space_t::io(const IORequest &type, os_offset_t offset, size_t len, buf, offset, len); } - /* We an try to recover the page from the double write buffer if - the decompression fails or the page is corrupt. */ - - ut_a(type.type == IORequest::DBLWR_RECOVER || err == DB_SUCCESS); if (!type.is_async()) { if (type.is_write()) { release_sync_write: node->complete_write(); release: release(); + goto func_exit; } ut_ad(fil_validate_skip()); } if (err != DB_SUCCESS) { goto release; } +func_exit: return {err, node}; } @@ -2864,8 +2815,9 @@ void fil_aio_callback(const IORequest &request) mysql_mutex_unlock(&recv_sys.mutex); } - ib::error() << "Failed to read page " << id.page_no() - << " from file '" << request.node->name << "': " << err; + if (err != DB_FAIL) + ib::error() << "Failed to read page " << id.page_no() + << " from file '" << request.node->name << "': " << err; } } @@ -3027,7 +2979,9 @@ void fil_names_dirty( fil_space_t* space) { - mysql_mutex_assert_owner(&log_sys.mutex); +#ifndef SUX_LOCK_GENERIC + ut_ad(log_sys.latch.is_write_locked()); +#endif ut_ad(recv_recovery_is_on()); ut_ad(log_sys.get_lsn() != 0); ut_ad(space->max_lsn == 0); @@ -3041,7 +2995,9 @@ fil_names_dirty( tablespace was modified for the first time since fil_names_clear(). */ ATTRIBUTE_NOINLINE ATTRIBUTE_COLD void mtr_t::name_write() { - mysql_mutex_assert_owner(&log_sys.mutex); +#ifndef SUX_LOCK_GENERIC + ut_ad(log_sys.latch.is_write_locked()); +#endif ut_d(fil_space_validate_for_mtr_commit(m_user_space)); ut_ad(!m_user_space->max_lsn); m_user_space->max_lsn= log_sys.get_lsn(); @@ -3054,10 +3010,6 @@ ATTRIBUTE_NOINLINE ATTRIBUTE_COLD void mtr_t::name_write() fil_name_write(m_user_space->id, UT_LIST_GET_FIRST(m_user_space->chain)->name, &mtr); - - DBUG_EXECUTE_IF("fil_names_write_bogus", - {fil_name_write(SRV_SPACE_ID_UPPER_BOUND, - "./test/bogus file.ibd", &mtr);}); mtr.commit_files(); } @@ -3069,7 +3021,9 @@ lsn_t fil_names_clear(lsn_t lsn) { mtr_t mtr; - mysql_mutex_assert_owner(&log_sys.mutex); +#ifndef SUX_LOCK_GENERIC + ut_ad(log_sys.latch.is_write_locked()); +#endif ut_ad(lsn); ut_ad(log_sys.is_latest()); @@ -3077,7 +3031,7 @@ lsn_t fil_names_clear(lsn_t lsn) for (auto it = fil_system.named_spaces.begin(); it != fil_system.named_spaces.end(); ) { - if (mtr.get_log()->size() + strlen(it->chain.start->name) + if (mtr.get_log_size() + strlen(it->chain.start->name) >= recv_sys.MTR_SIZE_MAX - (3 + 5)) { /* Prevent log parse buffer overflow */ mtr.commit_files(); diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc index c32f9d296c93b..e93ca4bc1772b 100644 --- a/storage/innobase/fsp/fsp0file.cc +++ b/storage/innobase/fsp/fsp0file.cc @@ -29,6 +29,7 @@ Created 2013-7-26 by Kevin Lewis #include "os0file.h" #include "page0page.h" #include "srv0start.h" +#include "log.h" /** Release the resources. */ void @@ -263,12 +264,11 @@ Datafile::read_first_page(bool read_only_mode) ulint n_read = 0; - err = os_file_read_no_error_handling( + err = os_file_read( IORequestReadPartial, m_handle, m_first_page, 0, page_size, &n_read); if (err == DB_SUCCESS) { - ut_a(n_read == page_size); break; } @@ -306,10 +306,23 @@ Datafile::read_first_page(bool read_only_mode) if (!fil_space_t::is_valid_flags(m_flags, m_space_id)) { uint32_t cflags = fsp_flags_convert_from_101(m_flags); if (cflags == UINT32_MAX) { - ib::error() - << "Invalid flags " << ib::hex(m_flags) - << " in " << m_filepath; - return(DB_CORRUPTION); + switch (fsp_flags_is_incompatible_mysql(m_flags)) { + case 0: + sql_print_error("InnoDB: Invalid flags 0x%" PRIx32 " in %s", + m_flags, m_filepath); + return DB_CORRUPTION; + case 3: + case 2: + sql_print_error("InnoDB: MySQL-8.0 tablespace in %s", + m_filepath); + break; + case 1: + sql_print_error("InnoDB: MySQL Encrypted tablespace in %s", + m_filepath); + break; + } + sql_print_error("InnoDB: Restart in MySQL for migration/recovery."); + return DB_UNSUPPORTED; } else { m_flags = cflags; } @@ -654,7 +667,7 @@ Datafile::find_space_id() for (ulint j = 0; j < page_count; ++j) { if (os_file_read(IORequestRead, m_handle, page, - j * page_size, page_size)) { + j * page_size, page_size, nullptr)) { ib::info() << "READ FAIL: page_no:" << j; continue; @@ -743,7 +756,7 @@ the double write buffer. bool Datafile::restore_from_doublewrite() { - if (srv_operation != SRV_OPERATION_NORMAL) { + if (srv_operation > SRV_OPERATION_EXPORT_RESTORED) { return true; } diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index 77b14edaf559e..c6044b201fe6a 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, 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 @@ -31,7 +31,6 @@ Created 11/29/1995 Heikki Tuuri #include "mtr0log.h" #include "ut0byte.h" #include "page0page.h" -#include "fut0fut.h" #include "srv0srv.h" #include "srv0start.h" #include "ibuf0ibuf.h" @@ -41,30 +40,17 @@ Created 11/29/1995 Heikki Tuuri #include "log0log.h" #include "dict0mem.h" #include "fsp0types.h" - -// JAN: MySQL 5.7 Encryption -// #include +#include "log.h" typedef uint32_t page_no_t; -/** Return an extent to the free list of a space. -@param[in,out] space tablespace -@param[in] offset page number in the extent -@param[in,out] mtr mini-transaction */ -MY_ATTRIBUTE((nonnull)) -static -void -fsp_free_extent( - fil_space_t* space, - page_no_t offset, - mtr_t* mtr); - /** Returns the first extent descriptor for a segment. We think of the extent lists of the segment catenated in the order FSEG_FULL -> FSEG_NOT_FULL -> FSEG_FREE. @param[in] inode segment inode @param[in] space tablespace @param[in,out] mtr mini-transaction +@param[out] err error code @return the first extent descriptor, or NULL if none */ MY_ATTRIBUTE((nonnull, warn_unused_result)) static @@ -72,8 +58,10 @@ xdes_t* fseg_get_first_extent( fseg_inode_t* inode, const fil_space_t* space, - mtr_t* mtr); + mtr_t* mtr, + dberr_t* err); +ATTRIBUTE_COLD MY_ATTRIBUTE((nonnull, warn_unused_result)) /** Put new extents to the free list if there are free extents above the free limit. If an extent happens to contain an extent descriptor page, the extent is put to the FSP_FREE_FRAG list with the page marked as used. @@ -83,8 +71,8 @@ then we will not allocate more extents @param[in,out] space tablespace @param[in,out] header tablespace header @param[in,out] mtr mini-transaction */ -static ATTRIBUTE_COLD -void +static +dberr_t fsp_fill_free_list( bool init_space, fil_space_t* space, @@ -104,7 +92,9 @@ direction they go alphabetically: FSP_DOWN, FSP_UP, FSP_NO_DIR @param[in,out] mtr mini-transaction @param[in,out] init_mtr mtr or another mini-transaction in which the page should be initialized. -@retval NULL if no page could be allocated */ +@param[out] err error code +@return the allocated page +@retval nullptr if no page could be allocated */ static buf_block_t* fseg_alloc_free_page_low( @@ -118,22 +108,37 @@ fseg_alloc_free_page_low( /*!< whether the space has already been reserved */ #endif /* UNIV_DEBUG */ mtr_t* mtr, - mtr_t* init_mtr) - MY_ATTRIBUTE((warn_unused_result)); + mtr_t* init_mtr, + dberr_t* err) + MY_ATTRIBUTE((nonnull, warn_unused_result)); +MY_ATTRIBUTE((nonnull, warn_unused_result)) /** Get the tablespace header block, SX-latched @param[in] space tablespace @param[in,out] mtr mini-transaction -@return pointer to the space header, page x-locked */ -static buf_block_t *fsp_get_header(const fil_space_t *space, mtr_t *mtr) +@param[out] err error code +@return pointer to the space header, page x-locked +@retval nullptr if the page cannot be retrieved or is corrupted */ +static buf_block_t *fsp_get_header(const fil_space_t *space, mtr_t *mtr, + dberr_t *err) { - buf_block_t *block= buf_page_get_gen(page_id_t(space->id, 0), - space->zip_size(), RW_SX_LATCH, - nullptr, BUF_GET_POSSIBLY_FREED, mtr); - if (!block || block->page.is_freed()) - return nullptr; - ut_ad(space->id == mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_ID + - block->page.frame)); + const page_id_t id{space->id, 0}; + buf_block_t *block= mtr->get_already_latched(id, MTR_MEMO_PAGE_SX_FIX); + if (block) + *err= DB_SUCCESS; + else + { + block= buf_page_get_gen(id, space->zip_size(), RW_SX_LATCH, + nullptr, BUF_GET_POSSIBLY_FREED, + mtr, err); + if (block && + space->id != mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_ID + + block->page.frame)) + { + *err= DB_CORRUPTION; + block= nullptr; + } + } return block; } @@ -215,7 +220,7 @@ inline bool xdes_is_full(const xdes_t *descr) @param[in] state the state @param[in,out] mtr mini-transaction */ inline void xdes_set_state(const buf_block_t &block, xdes_t *descr, - byte state, mtr_t *mtr) + byte state, mtr_t *mtr) { ut_ad(descr && mtr); ut_ad(state >= XDES_FREE); @@ -261,15 +266,16 @@ inline void xdes_init(const buf_block_t &block, xdes_t *descr, mtr_t *mtr) @param[in] page page number @param[in,out] descr extent descriptor @param[in,out] xdes extent descriptor page -@param[in,out] mtr mini-transaction */ -static MY_ATTRIBUTE((nonnull)) -void +@param[in,out] mtr mini-transaction +@return error code */ +static MY_ATTRIBUTE((nonnull, warn_unused_result)) +dberr_t fseg_mark_page_used(fseg_inode_t *seg_inode, buf_block_t *iblock, ulint page, xdes_t *descr, buf_block_t *xdes, mtr_t *mtr) { ut_ad(fil_page_get_type(iblock->page.frame) == FIL_PAGE_INODE); ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE)); - ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE); + ut_ad(!memcmp(FSEG_MAGIC_N_BYTES, FSEG_MAGIC_N + seg_inode, 4)); ut_ad(!memcmp(seg_inode + FSEG_ID, descr + XDES_ID, 4)); const uint16_t xoffset= uint16_t(descr - xdes->page.frame + XDES_FLST_NODE); @@ -278,12 +284,16 @@ fseg_mark_page_used(fseg_inode_t *seg_inode, buf_block_t *iblock, if (!xdes_get_n_used(descr)) { /* We move the extent from the free list to the NOT_FULL list */ - flst_remove(iblock, uint16_t(FSEG_FREE + ioffset), xdes, xoffset, mtr); - flst_add_last(iblock, uint16_t(FSEG_NOT_FULL + ioffset), - xdes, xoffset, mtr); + if (dberr_t err= flst_remove(iblock, uint16_t(FSEG_FREE + ioffset), + xdes, xoffset, mtr)) + return err; + if (dberr_t err= flst_add_last(iblock, uint16_t(FSEG_NOT_FULL + ioffset), + xdes, xoffset, mtr)) + return err; } - ut_ad(xdes_is_free(descr, page % FSP_EXTENT_SIZE)); + if (UNIV_UNLIKELY(!xdes_is_free(descr, page % FSP_EXTENT_SIZE))) + return DB_CORRUPTION; /* We mark the page as used */ xdes_set_free(*xdes, descr, page % FSP_EXTENT_SIZE, mtr); @@ -294,11 +304,17 @@ fseg_mark_page_used(fseg_inode_t *seg_inode, buf_block_t *iblock, if (xdes_is_full(descr)) { /* We move the extent from the NOT_FULL list to the FULL list */ - flst_remove(iblock, uint16_t(FSEG_NOT_FULL + ioffset), xdes, xoffset, mtr); - flst_add_last(iblock, uint16_t(FSEG_FULL + ioffset), xdes, xoffset, mtr); + if (dberr_t err= flst_remove(iblock, uint16_t(FSEG_NOT_FULL + ioffset), + xdes, xoffset, mtr)) + return err; + if (dberr_t err= flst_add_last(iblock, uint16_t(FSEG_FULL + ioffset), + xdes, xoffset, mtr)) + return err; mtr->write<4>(*iblock, seg_inode + FSEG_NOT_FULL_N_USED, not_full_n_used - FSP_EXTENT_SIZE); } + + return DB_SUCCESS; } /** Get pointer to a the extent descriptor of a page. @@ -306,6 +322,7 @@ fseg_mark_page_used(fseg_inode_t *seg_inode, buf_block_t *iblock, @param[in] space tablespace @param[in] offset page offset @param[in,out] mtr mini-transaction +@param[out] err error code @param[out] desc_block descriptor block @param[in] init_space whether the tablespace is being initialized @return pointer to the extent descriptor, NULL if the page does not @@ -317,6 +334,7 @@ xdes_get_descriptor_with_space_hdr( const fil_space_t* space, page_no_t offset, mtr_t* mtr, + dberr_t* err = nullptr, buf_block_t** desc_block = nullptr, bool init_space = false) { @@ -337,8 +355,8 @@ xdes_get_descriptor_with_space_hdr( || srv_is_undo_tablespace(space->id)))))); ut_ad(size == space->size_in_header); - if ((offset >= size) || (offset >= limit)) { - return(NULL); + if (offset >= size || offset >= limit) { + return nullptr; } const unsigned zip_size = space->zip_size(); @@ -349,14 +367,11 @@ xdes_get_descriptor_with_space_hdr( if (descr_page_no) { block = buf_page_get_gen(page_id_t(space->id, descr_page_no), - zip_size, RW_SX_LATCH, nullptr, - BUF_GET_POSSIBLY_FREED, mtr); - if (block && block->page.is_freed()) { - block = nullptr; - } + zip_size, RW_SX_LATCH, nullptr, + BUF_GET_POSSIBLY_FREED, mtr, err); } - if (desc_block != NULL) { + if (desc_block) { *desc_block = block; } @@ -367,6 +382,7 @@ xdes_get_descriptor_with_space_hdr( : nullptr; } +MY_ATTRIBUTE((nonnull(1,3), warn_unused_result)) /** Get the extent descriptor of a page. The page where the extent descriptor resides is x-locked. If the page offset is equal to the free limit of the space, we will add new @@ -377,67 +393,19 @@ defined, as they are uninitialized above the free limit. @param[in] offset page offset; if equal to the free limit, we try to add new extents to the space free list @param[in,out] mtr mini-transaction +@param[out] err error code @param[out] xdes extent descriptor page @return the extent descriptor */ static xdes_t *xdes_get_descriptor(const fil_space_t *space, page_no_t offset, - mtr_t *mtr, buf_block_t **xdes= nullptr) -{ - buf_block_t *block= buf_page_get_gen(page_id_t(space->id, 0), - space->zip_size(), RW_SX_LATCH, - nullptr, BUF_GET_POSSIBLY_FREED, mtr); - if (!block || block->page.is_freed()) - return nullptr; - return xdes_get_descriptor_with_space_hdr(block, space, offset, mtr, xdes); -} - -/** Get the extent descriptor of a page. -The page where the extent descriptor resides is x-locked. If the page -offset is equal to the free limit of the space, we will add new -extents from above the free limit to the space free list, if not free -limit == space size. This adding is necessary to make the descriptor -defined, as they are uninitialized above the free limit. -@param[in] space tablespace -@param[in] page descriptor page offset -@param[in] offset page offset -@param[in,out] mtr mini-transaction -@return the extent descriptor -@retval NULL if the descriptor is not available */ -MY_ATTRIBUTE((warn_unused_result)) -static -const xdes_t* -xdes_get_descriptor_const( - const fil_space_t* space, - page_no_t page, - page_no_t offset, - mtr_t* mtr) + mtr_t *mtr, dberr_t *err= nullptr, + buf_block_t **xdes= nullptr) { - ut_ad(space->is_owner() || mtr->memo_contains(*space, true)); - ut_ad(offset < space->free_limit); - ut_ad(offset < space->size_in_header); - - const ulint zip_size = space->zip_size(); - - if (buf_block_t* block = buf_page_get_gen(page_id_t(space->id, page), - zip_size, RW_S_LATCH, - nullptr, - BUF_GET_POSSIBLY_FREED, - mtr)) { - if (block->page.is_freed()) { - return nullptr; - } - - ut_ad(page != 0 || space->free_limit == mach_read_from_4( - FSP_FREE_LIMIT + FSP_HEADER_OFFSET - + block->page.frame)); - ut_ad(page != 0 || space->size_in_header == mach_read_from_4( - FSP_SIZE + FSP_HEADER_OFFSET - + block->page.frame)); - - return(block->page.frame + XDES_ARR_OFFSET + XDES_SIZE - * xdes_calc_descriptor_index(zip_size, offset)); - } - - return(NULL); + if (buf_block_t *block= + buf_page_get_gen(page_id_t(space->id, 0), space->zip_size(), RW_SX_LATCH, + nullptr, BUF_GET_POSSIBLY_FREED, mtr, err)) + return xdes_get_descriptor_with_space_hdr(block, space, offset, mtr, + err, xdes); + return nullptr; } MY_ATTRIBUTE((nonnull(3), warn_unused_result)) @@ -446,16 +414,27 @@ extent descriptor resides is x-locked. @param space tablespace @param lst_node file address of the list node contained in the descriptor @param mtr mini-transaction +@param err error code @param block extent descriptor block @return pointer to the extent descriptor */ static inline xdes_t *xdes_lst_get_descriptor(const fil_space_t &space, fil_addr_t lst_node, - mtr_t *mtr, buf_block_t **block= nullptr) + mtr_t *mtr, buf_block_t **block= nullptr, + dberr_t *err= nullptr) { ut_ad(mtr->memo_contains(space)); - auto b= fut_get_ptr(space.id, space.zip_size(), lst_node, RW_SX_LATCH, - mtr, block); - return b ? b - XDES_FLST_NODE : nullptr; + ut_ad(lst_node.boffset < space.physical_size()); + buf_block_t *b; + if (!block) + block= &b; + *block= buf_page_get_gen(page_id_t{space.id, lst_node.page}, + space.zip_size(), RW_SX_LATCH, + nullptr, BUF_GET_POSSIBLY_FREED, mtr, err); + if (*block) + return (*block)->page.frame + lst_node.boffset - XDES_FLST_NODE; + + space.set_corrupted(); + return nullptr; } /********************************************************************//** @@ -501,34 +480,29 @@ updating an allocation bitmap page. @param[in] mtr mini-transaction */ void fil_space_t::modify_check(const mtr_t& mtr) const { - switch (mtr.get_log_mode()) { - case MTR_LOG_NONE: - /* These modes are only allowed within a non-bitmap page - when there is a higher-level redo log record written. */ - ut_ad(purpose == FIL_TYPE_TABLESPACE - || purpose == FIL_TYPE_TEMPORARY); - break; - case MTR_LOG_NO_REDO: - ut_ad(purpose == FIL_TYPE_TEMPORARY - || purpose == FIL_TYPE_IMPORT); - return; - case MTR_LOG_ALL: - /* We may only write redo log for a persistent - tablespace. */ - ut_ad(purpose == FIL_TYPE_TABLESPACE); - ut_ad(mtr.is_named_space(id)); - return; - } - - ut_ad("invalid log mode" == 0); + switch (mtr.get_log_mode()) { + case MTR_LOG_NONE: + /* These modes are only allowed within a non-bitmap page + when there is a higher-level redo log record written. */ + ut_ad(purpose == FIL_TYPE_TABLESPACE || purpose == FIL_TYPE_TEMPORARY); + break; + case MTR_LOG_NO_REDO: + ut_ad(purpose == FIL_TYPE_TEMPORARY || purpose == FIL_TYPE_IMPORT); + break; + default: + /* We may only write redo log for a persistent tablespace. */ + ut_ad(purpose == FIL_TYPE_TABLESPACE); + ut_ad(mtr.is_named_space(id)); + } } #endif /** Initialize a tablespace header. @param[in,out] space tablespace @param[in] size current size in blocks -@param[in,out] mtr mini-transaction */ -void fsp_header_init(fil_space_t* space, uint32_t size, mtr_t* mtr) +@param[in,out] mtr mini-transaction +@return error code */ +dberr_t fsp_header_init(fil_space_t *space, uint32_t size, mtr_t *mtr) { const page_id_t page_id(space->id, 0); const ulint zip_size = space->zip_size(); @@ -584,8 +558,10 @@ void fsp_header_init(fil_space_t* space, uint32_t size, mtr_t* mtr) + block->page.frame, 1U); - fsp_fill_free_list(!is_system_tablespace(space->id), - space, block, mtr); + if (dberr_t err = fsp_fill_free_list(!is_system_tablespace(space->id), + space, block, mtr)) { + return err; + } /* Write encryption metadata to page 0 if tablespace is encrypted or encryption is disabled by table option. */ @@ -594,6 +570,8 @@ void fsp_header_init(fil_space_t* space, uint32_t size, mtr_t* mtr) space->crypt_data->not_encrypted())) { space->crypt_data->write_page0(block, mtr); } + + return DB_SUCCESS; } /** Try to extend a single-table tablespace so that a page would fit in the @@ -614,7 +592,7 @@ fsp_try_extend_data_file_with_pages( bool success; ulint size; - ut_a(!is_system_tablespace(space->id)); + ut_ad(!is_system_tablespace(space->id)); ut_d(space->modify_check(*mtr)); size = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SIZE @@ -700,9 +678,9 @@ fsp_try_extend_data_file(fil_space_t *space, buf_block_t *header, mtr_t *mtr) to reset the flag to false as dealing with this error requires server restart. */ if (!srv_sys_space.get_tablespace_full_status()) { - ib::error() << "The InnoDB system tablespace " - << OUT_OF_SPACE_MSG - << " innodb_data_file_path."; + sql_print_error("InnoDB: The InnoDB system tablespace " + "%s" " innodb_data_file_path.", + OUT_OF_SPACE_MSG); srv_sys_space.set_tablespace_full_status(true); } return(0); @@ -714,9 +692,10 @@ fsp_try_extend_data_file(fil_space_t *space, buf_block_t *header, mtr_t *mtr) to reset the flag to false as dealing with this error requires server restart. */ if (!srv_tmp_space.get_tablespace_full_status()) { - ib::error() << "The InnoDB temporary tablespace " - << OUT_OF_SPACE_MSG - << " innodb_temp_data_file_path."; + sql_print_error("InnoDB: The InnoDB temporary" + " tablespace %s" + " innodb_temp_data_file_path.", + OUT_OF_SPACE_MSG); srv_tmp_space.set_tablespace_full_status(true); } return(0); @@ -800,170 +779,163 @@ and we are only initializing the first extent and the first bitmap pages; then we will not allocate more extents @param[in,out] space tablespace @param[in,out] header tablespace header -@param[in,out] mtr mini-transaction */ +@param[in,out] mtr mini-transaction +@return error code */ static -void +dberr_t fsp_fill_free_list( bool init_space, fil_space_t* space, buf_block_t* header, mtr_t* mtr) { - ut_d(space->modify_check(*mtr)); - - /* Check if we can fill free list from above the free list limit */ - uint32_t size = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SIZE - + header->page.frame); - uint32_t limit = mach_read_from_4(FSP_HEADER_OFFSET + FSP_FREE_LIMIT - + header->page.frame); + ut_d(space->modify_check(*mtr)); - ut_ad(size == space->size_in_header); - ut_ad(limit == space->free_limit); - - const ulint zip_size = space->zip_size(); + /* Check if we can fill free list from above the free list limit */ + uint32_t size= + mach_read_from_4(FSP_HEADER_OFFSET + FSP_SIZE + header->page.frame); + uint32_t limit= + mach_read_from_4(FSP_HEADER_OFFSET + FSP_FREE_LIMIT + header->page.frame); - if (size < limit + FSP_EXTENT_SIZE * FSP_FREE_ADD) { - bool skip_resize = init_space; - switch (space->id) { - case TRX_SYS_SPACE: - skip_resize = !srv_sys_space.can_auto_extend_last_file(); - break; - case SRV_TMP_SPACE_ID: - skip_resize = !srv_tmp_space.can_auto_extend_last_file(); - break; - } - - if (!skip_resize) { - fsp_try_extend_data_file(space, header, mtr); - size = space->size_in_header; - } - } + ut_ad(size == space->size_in_header); + ut_ad(limit == space->free_limit); - uint32_t count = 0; + const auto zip_size= space->zip_size(); - for (uint32_t i = limit, extent_size = FSP_EXTENT_SIZE, - physical_size = space->physical_size(); - (init_space && i < 1) - || (i + extent_size <= size && count < FSP_FREE_ADD); - i += extent_size) { - const bool init_xdes = !ut_2pow_remainder(i, physical_size); - - space->free_limit = i + extent_size; - mtr->write<4>(*header, FSP_HEADER_OFFSET + FSP_FREE_LIMIT - + header->page.frame, i + extent_size); - - if (init_xdes) { - - buf_block_t* block; + if (size < limit + FSP_EXTENT_SIZE * FSP_FREE_ADD) + { + bool skip_resize= init_space; + switch (space->id) { + case TRX_SYS_SPACE: + skip_resize= !srv_sys_space.can_auto_extend_last_file(); + break; + case SRV_TMP_SPACE_ID: + skip_resize= !srv_tmp_space.can_auto_extend_last_file(); + break; + } - /* We are going to initialize a new descriptor page - and a new ibuf bitmap page: the prior contents of the - pages should be ignored. */ + if (!skip_resize) + { + fsp_try_extend_data_file(space, header, mtr); + size= space->size_in_header; + } + } - if (i > 0) { - buf_block_t *f= buf_LRU_get_free_block(false); - block= buf_page_create( - space, static_cast(i), - zip_size, mtr, f); - if (UNIV_UNLIKELY(block != f)) { - buf_pool.free_block(f); - } - fsp_init_file_page(space, block, mtr); - mtr->write<2>(*block, FIL_PAGE_TYPE - + block->page.frame, - FIL_PAGE_TYPE_XDES); - } + uint32_t count= 0; + for (uint32_t i= limit, extent_size= FSP_EXTENT_SIZE, + physical_size= space->physical_size(); + (init_space && i < 1) || + (i + extent_size <= size && count < FSP_FREE_ADD); + i += extent_size) + { + const bool init_xdes= !ut_2pow_remainder(i, physical_size); + space->free_limit= i + extent_size; + mtr->write<4>(*header, FSP_HEADER_OFFSET + FSP_FREE_LIMIT + + header->page.frame, i + extent_size); - if (space->purpose != FIL_TYPE_TEMPORARY) { - buf_block_t *f= buf_LRU_get_free_block(false); - block = buf_page_create( - space, - static_cast( - i + FSP_IBUF_BITMAP_OFFSET), - zip_size, mtr, f); - if (UNIV_UNLIKELY(block != f)) { - buf_pool.free_block(f); - } - fsp_init_file_page(space, block, mtr); - mtr->write<2>(*block, FIL_PAGE_TYPE - + block->page.frame, - FIL_PAGE_IBUF_BITMAP); - } - } + if (init_xdes) + { + /* We are going to initialize a new descriptor page + and a new ibuf bitmap page: the prior contents of the + pages should be ignored. */ + + if (i) + { + buf_block_t *f= buf_LRU_get_free_block(false); + buf_block_t *block= buf_page_create(space, static_cast(i), + zip_size, mtr, f); + if (UNIV_UNLIKELY(block != f)) + buf_pool.free_block(f); + fsp_init_file_page(space, block, mtr); + mtr->write<2>(*block, FIL_PAGE_TYPE + block->page.frame, + FIL_PAGE_TYPE_XDES); + } + + if (space->purpose != FIL_TYPE_TEMPORARY) + { + buf_block_t *f= buf_LRU_get_free_block(false); + buf_block_t *block= + buf_page_create(space, + static_cast(i + FSP_IBUF_BITMAP_OFFSET), + zip_size, mtr, f); + if (UNIV_UNLIKELY(block != f)) + buf_pool.free_block(f); + fsp_init_file_page(space, block, mtr); + mtr->write<2>(*block, FIL_PAGE_TYPE + block->page.frame, + FIL_PAGE_IBUF_BITMAP); + } + } - buf_block_t* xdes = nullptr; - xdes_t* descr = xdes_get_descriptor_with_space_hdr( - header, space, i, mtr, &xdes, init_space); - if (!descr) { - ut_ad("corruption" == 0); - return; - } + buf_block_t *xdes= nullptr; + xdes_t *descr; + { + dberr_t err= DB_SUCCESS; + descr= xdes_get_descriptor_with_space_hdr(header, space, i, mtr, + &err, &xdes, init_space); + if (!descr) + return err; + } - if (xdes != header && !space->full_crc32()) { - fil_block_check_type(*xdes, FIL_PAGE_TYPE_XDES, mtr); - } - xdes_init(*xdes, descr, mtr); - const uint16_t xoffset= static_cast( - descr - xdes->page.frame + XDES_FLST_NODE); - - if (UNIV_UNLIKELY(init_xdes)) { - - /* The first page in the extent is a descriptor page - and the second is an ibuf bitmap page: mark them - used */ - - xdes_set_free(*xdes, descr, 0, mtr); - xdes_set_free(*xdes, descr, - FSP_IBUF_BITMAP_OFFSET, mtr); - xdes_set_state(*xdes, descr, XDES_FREE_FRAG, mtr); - - flst_add_last(header, - FSP_HEADER_OFFSET + FSP_FREE_FRAG, - xdes, xoffset, mtr); - byte* n_used = FSP_HEADER_OFFSET + FSP_FRAG_N_USED - + header->page.frame; - mtr->write<4>(*header, n_used, - 2U + mach_read_from_4(n_used)); - } else { - flst_add_last(header, FSP_HEADER_OFFSET + FSP_FREE, - xdes, xoffset, mtr); - count++; - } - } + if (xdes != header && !space->full_crc32()) + fil_block_check_type(*xdes, FIL_PAGE_TYPE_XDES, mtr); + xdes_init(*xdes, descr, mtr); + const uint16_t xoffset= + static_cast(descr - xdes->page.frame + XDES_FLST_NODE); + if (UNIV_UNLIKELY(init_xdes)) + { + /* The first page in the extent is a descriptor page and the + second is an ibuf bitmap page: mark them used */ + xdes_set_free(*xdes, descr, 0, mtr); + xdes_set_free(*xdes, descr, FSP_IBUF_BITMAP_OFFSET, mtr); + xdes_set_state(*xdes, descr, XDES_FREE_FRAG, mtr); + if (dberr_t err= flst_add_last(header, FSP_HEADER_OFFSET + FSP_FREE_FRAG, + xdes, xoffset, mtr)) + return err; + byte *n_used= FSP_HEADER_OFFSET + FSP_FRAG_N_USED + header->page.frame; + mtr->write<4>(*header, n_used, 2U + mach_read_from_4(n_used)); + } + else + { + if (dberr_t err= + flst_add_last(header, FSP_HEADER_OFFSET + FSP_FREE, + xdes, xoffset, mtr)) + return err; + count++; + } + } - space->free_len += count; + space->free_len+= count; + return DB_SUCCESS; } +MY_ATTRIBUTE((nonnull, warn_unused_result)) /** Allocates a new free extent. @param[in,out] space tablespace @param[in] hint hint of which extent would be desirable: any page offset in the extent goes; the hint must not be > FSP_FREE_LIMIT @param[out] xdes extent descriptor page @param[in,out] mtr mini-transaction -@return extent descriptor, NULL if cannot be allocated */ -static -xdes_t* -fsp_alloc_free_extent( - fil_space_t* space, - uint32_t hint, - buf_block_t** xdes, - mtr_t* mtr) +@return extent descriptor +@retval nullptr if cannot be allocated */ +static xdes_t *fsp_alloc_free_extent(fil_space_t *space, uint32_t hint, + buf_block_t **xdes, mtr_t *mtr, + dberr_t *err) { fil_addr_t first; xdes_t* descr; buf_block_t* desc_block; - buf_block_t* header = fsp_get_header(space, mtr); + buf_block_t* header = fsp_get_header(space, mtr, err); if (!header) { - ut_ad("corruption" == 0); +corrupted: + space->set_corrupted(); return nullptr; } descr = xdes_get_descriptor_with_space_hdr( - header, space, hint, mtr, &desc_block); + header, space, hint, mtr, err, &desc_block); if (!descr) { - ut_ad("corruption" == 0); - return nullptr; + goto corrupted; } if (desc_block != header && !space->full_crc32()) { @@ -978,7 +950,10 @@ fsp_alloc_free_extent( + header->page.frame); if (first.page == FIL_NULL) { - fsp_fill_free_list(false, space, header, mtr); + *err = fsp_fill_free_list(false, space, header, mtr); + if (UNIV_UNLIKELY(*err != DB_SUCCESS)) { + goto corrupted; + } first = flst_get_first(FSP_HEADER_OFFSET + FSP_FREE + header->page.frame); @@ -988,57 +963,64 @@ fsp_alloc_free_extent( } descr = xdes_lst_get_descriptor(*space, first, mtr, - &desc_block); + &desc_block, err); if (!descr) { - ut_ad("corruption" == 0); - return nullptr; + return descr; } } - flst_remove(header, FSP_HEADER_OFFSET + FSP_FREE, desc_block, - static_cast( - descr - desc_block->page.frame + XDES_FLST_NODE), - mtr); + *err = flst_remove(header, FSP_HEADER_OFFSET + FSP_FREE, desc_block, + static_cast(descr - desc_block->page.frame + + XDES_FLST_NODE), + mtr); + if (UNIV_UNLIKELY(*err != DB_SUCCESS)) { + return nullptr; + } + space->free_len--; *xdes = desc_block; return(descr); } +MY_ATTRIBUTE((nonnull, warn_unused_result)) /** Allocate a single free page. @param[in,out] header tablespace header @param[in,out] xdes extent descriptor page @param[in,out] descr extent descriptor @param[in] bit slot to allocate in the extent -@param[in,out] mtr mini-transaction */ -static void +@param[in,out] mtr mini-transaction +@return error code */ +static dberr_t fsp_alloc_from_free_frag(buf_block_t *header, buf_block_t *xdes, xdes_t *descr, ulint bit, mtr_t *mtr) { - ut_ad(xdes_get_state(descr) == XDES_FREE_FRAG); - ut_a(xdes_is_free(descr, bit)); - xdes_set_free(*xdes, descr, bit, mtr); + if (UNIV_UNLIKELY(xdes_get_state(descr) != XDES_FREE_FRAG || + !xdes_is_free(descr, bit))) + return DB_CORRUPTION; + xdes_set_free(*xdes, descr, bit, mtr); - /* Update the FRAG_N_USED field */ - byte* n_used_p = FSP_HEADER_OFFSET + FSP_FRAG_N_USED - + header->page.frame; + /* Update the FRAG_N_USED field */ + byte *n_used_p= FSP_HEADER_OFFSET + FSP_FRAG_N_USED + header->page.frame; + uint32_t n_used = mach_read_from_4(n_used_p) + 1; - uint32_t n_used = mach_read_from_4(n_used_p) + 1; - - if (xdes_is_full(descr)) { - /* The fragment is full: move it to another list */ - const uint16_t xoffset= static_cast( - descr - xdes->page.frame + XDES_FLST_NODE); - flst_remove(header, FSP_HEADER_OFFSET + FSP_FREE_FRAG, - xdes, xoffset, mtr); - xdes_set_state(*xdes, descr, XDES_FULL_FRAG, mtr); - - flst_add_last(header, FSP_HEADER_OFFSET + FSP_FULL_FRAG, - xdes, xoffset, mtr); - n_used -= FSP_EXTENT_SIZE; - } + if (xdes_is_full(descr)) + { + /* The fragment is full: move it to another list */ + const uint16_t xoffset= + static_cast(descr - xdes->page.frame + XDES_FLST_NODE); + if (dberr_t err= flst_remove(header, FSP_HEADER_OFFSET + FSP_FREE_FRAG, + xdes, xoffset, mtr)) + return err; + if (dberr_t err= flst_add_last(header, FSP_HEADER_OFFSET + FSP_FULL_FRAG, + xdes, xoffset, mtr)) + return err; + xdes_set_state(*xdes, descr, XDES_FULL_FRAG, mtr); + n_used-= FSP_EXTENT_SIZE; + } - mtr->write<4>(*header, n_used_p, n_used); + mtr->write<4>(*header, n_used_p, n_used); + return DB_SUCCESS; } /** Gets a buffer block for an allocated page. @@ -1091,126 +1073,152 @@ The page is marked as used. @param[in,out] mtr mini-transaction @param[in,out] init_mtr mini-transaction in which the page should be initialized (may be the same as mtr) -@retval NULL if no page could be allocated */ +@param[out] err error code +@return allocated block +@retval nullptr if no page could be allocated */ static MY_ATTRIBUTE((warn_unused_result, nonnull)) -buf_block_t* -fsp_alloc_free_page( - fil_space_t* space, - uint32_t hint, - mtr_t* mtr, - mtr_t* init_mtr) +buf_block_t *fsp_alloc_free_page(fil_space_t *space, uint32_t hint, + mtr_t *mtr, mtr_t *init_mtr, dberr_t *err) { - fil_addr_t first; - xdes_t* descr; - const uint32_t space_id = space->id; - - ut_d(space->modify_check(*mtr)); - buf_block_t* block = fsp_get_header(space, mtr); - - if (!block) { - return nullptr; - } - - buf_block_t *xdes; - - /* Get the hinted descriptor */ - descr = xdes_get_descriptor_with_space_hdr(block, space, hint, mtr, - &xdes); - - if (descr && (xdes_get_state(descr) == XDES_FREE_FRAG)) { - /* Ok, we can take this extent */ - } else { - /* Else take the first extent in free_frag list */ - first = flst_get_first(FSP_HEADER_OFFSET + FSP_FREE_FRAG - + block->page.frame); - - if (first.page == FIL_NULL) { - /* There are no partially full fragments: allocate - a free extent and add it to the FREE_FRAG list. NOTE - that the allocation may have as a side-effect that an - extent containing a descriptor page is added to the - FREE_FRAG list. But we will allocate our page from the - the free extent anyway. */ - - descr = fsp_alloc_free_extent(space, hint, &xdes, mtr); - - if (!descr) { - /* No free space left */ - return nullptr; - } - - xdes_set_state(*xdes, descr, XDES_FREE_FRAG, mtr); - flst_add_last(block, FSP_HEADER_OFFSET + FSP_FREE_FRAG, - xdes, static_cast( - descr - xdes->page.frame - + XDES_FLST_NODE), mtr); - } else { - descr = xdes_lst_get_descriptor(*space, first, mtr, - &xdes); - if (!descr) { - ut_ad("corruption" == 0); - return nullptr; - } - } + ut_d(space->modify_check(*mtr)); + buf_block_t *block= fsp_get_header(space, mtr, err); + if (!block) + return block; - /* Reset the hint */ - hint = 0; - } + buf_block_t *xdes; + /* Get the hinted descriptor */ + xdes_t *descr= xdes_get_descriptor_with_space_hdr(block, space, hint, mtr, + err, &xdes); + if (descr && xdes_get_state(descr) == XDES_FREE_FRAG) + /* Ok, we can take this extent */; + else if (*err != DB_SUCCESS) + { + err_exit: + space->set_corrupted(); + return nullptr; + } + else + { + /* Else take the first extent in free_frag list */ + fil_addr_t first = flst_get_first(FSP_HEADER_OFFSET + FSP_FREE_FRAG + + block->page.frame); + if (first.page == FIL_NULL) + { + /* There are no partially full fragments: allocate a free extent + and add it to the FREE_FRAG list. NOTE that the allocation may + have as a side-effect that an extent containing a descriptor + page is added to the FREE_FRAG list. But we will allocate our + page from the the free extent anyway. */ + descr= fsp_alloc_free_extent(space, hint, &xdes, mtr, err); + if (!descr) + return nullptr; + *err= flst_add_last(block, FSP_HEADER_OFFSET + FSP_FREE_FRAG, xdes, + static_cast(descr - xdes->page.frame + + XDES_FLST_NODE), mtr); + if (UNIV_UNLIKELY(*err != DB_SUCCESS)) + return nullptr; + xdes_set_state(*xdes, descr, XDES_FREE_FRAG, mtr); + } + else + { + descr= xdes_lst_get_descriptor(*space, first, mtr, &xdes, err); + if (!descr) + return nullptr; + /* Reset the hint */ + hint= 0; + } + } - /* Now we have in descr an extent with at least one free page. Look - for a free page in the extent. */ + /* Now we have in descr an extent with at least one free page. Look + for a free page in the extent. */ + uint32_t free= xdes_find_free(descr, hint % FSP_EXTENT_SIZE); + if (free == FIL_NULL) + { + corrupted: + *err= DB_CORRUPTION; + goto err_exit; + } - uint32_t free = xdes_find_free(descr, hint % FSP_EXTENT_SIZE); - if (free == FIL_NULL) { - ib::error() << "Allocation metadata for file '" - << space->chain.start->name - << "' is corrupted"; - ut_ad("corruption" == 0); - return nullptr; - } + uint32_t page_no= xdes_get_offset(descr) + free; + uint32_t space_size = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SIZE + + block->page.frame); + ut_ad(space_size == space->size_in_header || + (space->id == TRX_SYS_SPACE && + srv_startup_is_before_trx_rollback_phase)); - uint32_t page_no = xdes_get_offset(descr) + free; + if (space_size <= page_no) + { + /* It must be that we are extending a single-table tablespace + whose size is still < 64 pages */ + ut_ad(!is_system_tablespace(space->id)); + if (page_no >= FSP_EXTENT_SIZE) + { + sql_print_error("InnoDB: Trying to extend %s" + " by single page(s) though the size is " UINT32PF "." + " Page no " UINT32PF ".", + space->chain.start->name, space_size, page_no); + goto corrupted; + } - uint32_t space_size = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SIZE - + block->page.frame); - ut_ad(space_size == space->size_in_header - || (space_id == TRX_SYS_SPACE - && srv_startup_is_before_trx_rollback_phase)); + if (!fsp_try_extend_data_file_with_pages(space, page_no, block, mtr)) + { + *err= DB_OUT_OF_FILE_SPACE; + return nullptr; + } + } - if (space_size <= page_no) { - /* It must be that we are extending a single-table tablespace - whose size is still < 64 pages */ + *err= fsp_alloc_from_free_frag(block, xdes, descr, free, mtr); + if (UNIV_UNLIKELY(*err != DB_SUCCESS)) + goto corrupted; + return fsp_page_create(space, page_no, init_mtr); +} - ut_a(!is_system_tablespace(space_id)); - if (page_no >= FSP_EXTENT_SIZE) { - ib::error() << "Trying to extend " - << space->chain.start->name - << " by single page(s) though the size is " - << space_size - << ". Page no " << page_no << "."; - return(NULL); - } +MY_ATTRIBUTE((nonnull, warn_unused_result)) +/** Return an extent to the free list of a space. +@param[in,out] space tablespace +@param[in] offset page number in the extent +@param[in,out] mtr mini-transaction +@return error code */ +static dberr_t fsp_free_extent(fil_space_t* space, page_no_t offset, + mtr_t* mtr) +{ + ut_ad(space->is_owner()); + dberr_t err; + buf_block_t *block= fsp_get_header(space, mtr, &err); + if (!block) + return err; + buf_block_t *xdes; + xdes_t *descr= xdes_get_descriptor_with_space_hdr(block, space, offset, mtr, + &err, &xdes); + if (!descr) + { + ut_ad(err || space->is_stopping()); + return err; + } - if (!fsp_try_extend_data_file_with_pages(space, page_no, - block, mtr)) { - /* No disk space left */ - return(NULL); - } - } + if (UNIV_UNLIKELY(xdes_get_state(descr) == XDES_FREE)) + { + space->set_corrupted(); + return DB_CORRUPTION; + } - fsp_alloc_from_free_frag(block, xdes, descr, free, mtr); - return fsp_page_create(space, page_no, init_mtr); + xdes_init(*xdes, descr, mtr); + space->free_len++; + return flst_add_last(block, FSP_HEADER_OFFSET + FSP_FREE, + xdes, static_cast(descr - xdes->page.frame + + XDES_FLST_NODE), mtr); } +MY_ATTRIBUTE((nonnull)) /** Frees a single page of a space. The page is marked as free and clean. @param[in,out] space tablespace @param[in] offset page number -@param[in,out] mtr mini-transaction */ -static void fsp_free_page(fil_space_t* space, page_no_t offset, mtr_t* mtr) +@param[in,out] mtr mini-transaction +@return error code */ +static dberr_t fsp_free_page(fil_space_t *space, page_no_t offset, mtr_t *mtr) { xdes_t* descr; - ulint state; ulint frag_n_used; ut_ad(mtr); @@ -1218,61 +1226,35 @@ static void fsp_free_page(fil_space_t* space, page_no_t offset, mtr_t* mtr) /* fprintf(stderr, "Freeing page %lu in space %lu\n", page, space); */ - buf_block_t* header = fsp_get_header(space, mtr); + dberr_t err; + buf_block_t* header = fsp_get_header(space, mtr, &err); if (!header) { ut_ad(space->is_stopping()); - return; + return err; } buf_block_t* xdes; descr = xdes_get_descriptor_with_space_hdr(header, space, offset, mtr, - &xdes); + &err, &xdes); if (!descr) { - ut_ad(space->is_stopping()); - return; + ut_ad(err || space->is_stopping()); + return err; } - state = xdes_get_state(descr); - - if (UNIV_UNLIKELY(state != XDES_FREE_FRAG - && state != XDES_FULL_FRAG)) { - ib::error() << "File space extent descriptor of page " - << page_id_t(space->id, offset) - << " has state " << state; - /* Crash in debug version, so that we get a core dump - of this corruption. */ - ut_ad(0); + const auto state = xdes_get_state(descr); - if (state == XDES_FREE) { - /* We put here some fault tolerance: if the page - is already free, return without doing anything! */ - - return; + switch (state) { + case XDES_FREE_FRAG: + case XDES_FULL_FRAG: + if (!xdes_is_free(descr, offset % FSP_EXTENT_SIZE)) { + break; } - - ut_error; - } - - if (xdes_is_free(descr, offset % FSP_EXTENT_SIZE)) { - ib::error() << "File space extent descriptor of page " - << page_id_t(space->id, offset) - << " says it is free."; - /* Crash in debug version, so that we get a core dump - of this corruption. */ - ut_ad(0); - - /* We put here some fault tolerance: if the page - is already free, return without doing anything! */ - - return; + /* fall through */ + default: + space->set_corrupted(); + return DB_CORRUPTION; } - mtr->free(*space, static_cast(offset)); - - const ulint bit = offset % FSP_EXTENT_SIZE; - - xdes_set_free(*xdes, descr, bit, mtr); - frag_n_used = mach_read_from_4(FSP_HEADER_OFFSET + FSP_FRAG_N_USED + header->page.frame); @@ -1281,56 +1263,44 @@ static void fsp_free_page(fil_space_t* space, page_no_t offset, mtr_t* mtr) if (state == XDES_FULL_FRAG) { /* The fragment was full: move it to another list */ - flst_remove(header, FSP_HEADER_OFFSET + FSP_FULL_FRAG, - xdes, xoffset, mtr); + err = flst_remove(header, FSP_HEADER_OFFSET + FSP_FULL_FRAG, + xdes, xoffset, mtr); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + return err; + } + err = flst_add_last(header, FSP_HEADER_OFFSET + FSP_FREE_FRAG, + xdes, xoffset, mtr); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + return err; + } xdes_set_state(*xdes, descr, XDES_FREE_FRAG, mtr); - flst_add_last(header, FSP_HEADER_OFFSET + FSP_FREE_FRAG, - xdes, xoffset, mtr); mtr->write<4>(*header, FSP_HEADER_OFFSET + FSP_FRAG_N_USED + header->page.frame, frag_n_used + FSP_EXTENT_SIZE - 1); + } else if (UNIV_UNLIKELY(!frag_n_used)) { + return DB_CORRUPTION; } else { - ut_a(frag_n_used > 0); mtr->write<4>(*header, FSP_HEADER_OFFSET + FSP_FRAG_N_USED + header->page.frame, frag_n_used - 1); } if (!xdes_get_n_used(descr)) { /* The extent has become free: move it to another list */ - flst_remove(header, FSP_HEADER_OFFSET + FSP_FREE_FRAG, - xdes, xoffset, mtr); - fsp_free_extent(space, offset, mtr); + err = flst_remove(header, FSP_HEADER_OFFSET + FSP_FREE_FRAG, + xdes, xoffset, mtr); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + return err; + } + err = fsp_free_extent(space, offset, mtr); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + return err; + } } -} - -/** Return an extent to the free list of a space. -@param[in,out] space tablespace -@param[in] offset page number in the extent -@param[in,out] mtr mini-transaction */ -static void fsp_free_extent(fil_space_t* space, page_no_t offset, mtr_t* mtr) -{ - ut_ad(space->is_owner()); - - buf_block_t *block= fsp_get_header(space, mtr); - if (!block) - return; - buf_block_t *xdes; - xdes_t* descr= xdes_get_descriptor_with_space_hdr(block, space, offset, mtr, - &xdes); - if (!descr) - { - ut_ad(space->is_stopping()); - return; - } - - ut_a(xdes_get_state(descr) != XDES_FREE); - xdes_init(*xdes, descr, mtr); + mtr->free(*space, static_cast(offset)); + xdes_set_free(*xdes, descr, offset % FSP_EXTENT_SIZE, mtr); - flst_add_last(block, FSP_HEADER_OFFSET + FSP_FREE, - xdes, static_cast(descr - xdes->page.frame + - XDES_FLST_NODE), mtr); - space->free_len++; + return DB_SUCCESS; } /** @return Number of segment inodes which fit on a single page */ @@ -1347,69 +1317,64 @@ inline ulint FSP_SEG_INODES_PER_PAGE(ulint physical_size) FSEG_ARR_OFFSET + FSEG_INODE_SIZE * i + page /** Looks for a used segment inode on a segment inode page. -@param[in] page segment inode page -@param[in] physical_size page size -@return segment inode index, or ULINT_UNDEFINED if not found */ +@param page segment inode page +@param physical_size page size +@return segment inode index +@retval ULINT_UNDEFINED if not found */ static ulint -fsp_seg_inode_page_find_used(const page_t* page, ulint physical_size) +fsp_seg_inode_page_find_used(const page_t *page, ulint physical_size) { - for (ulint i = 0; i < FSP_SEG_INODES_PER_PAGE(physical_size); i++) { - if (!mach_read_from_8( - FSEG_ID - + fsp_seg_inode_page_get_nth_inode(page, i))) { - continue; - } - /* This is used */ - ut_ad(FSEG_MAGIC_N_VALUE == mach_read_from_4( - FSEG_MAGIC_N - + fsp_seg_inode_page_get_nth_inode(page, i))); - return i; - } + for (ulint i= 0; i < FSP_SEG_INODES_PER_PAGE(physical_size); i++) + { + const byte *inode= fsp_seg_inode_page_get_nth_inode(page, i); + if (mach_read_from_8(FSEG_ID + inode)) + { + ut_ad(!memcmp(FSEG_MAGIC_N_BYTES, FSEG_MAGIC_N + inode, 4)); + return i; + } + } - return(ULINT_UNDEFINED); + return ULINT_UNDEFINED; } /** Looks for an unused segment inode on a segment inode page. @param[in] page segment inode page @param[in] i search forward starting from this index @param[in] physical_size page size -@return segment inode index, or ULINT_UNDEFINED if not found */ +@return segment inode index +@retval ULINT_UNDEFINED if not found */ static ulint -fsp_seg_inode_page_find_free(const page_t* page, ulint i, ulint physical_size) +fsp_seg_inode_page_find_free(const page_t *page, ulint i, ulint physical_size) { - for (; i < FSP_SEG_INODES_PER_PAGE(physical_size); i++) { - if (!mach_read_from_8( - FSEG_ID - + fsp_seg_inode_page_get_nth_inode(page, i))) { - /* This is unused */ - return i; - } - - ut_ad(FSEG_MAGIC_N_VALUE == mach_read_from_4( - FSEG_MAGIC_N - + fsp_seg_inode_page_get_nth_inode(page, i))); - } - - return ULINT_UNDEFINED; + for (; i < FSP_SEG_INODES_PER_PAGE(physical_size); i++) + { + const byte *inode= fsp_seg_inode_page_get_nth_inode(page, i); + if (mach_read_from_8(FSEG_ID + inode)) + ut_ad(!memcmp(FSEG_MAGIC_N_BYTES, FSEG_MAGIC_N + inode, 4)); + else + /* This is unused */ + return i; + } + return ULINT_UNDEFINED; } +MY_ATTRIBUTE((nonnull, warn_unused_result)) /** Allocate a file segment inode page. @param[in,out] space tablespace -@param[in,out] header tablespace header -@param[in,out] mtr mini-transaction -@return whether the allocation succeeded */ -MY_ATTRIBUTE((nonnull, warn_unused_result)) -static -bool -fsp_alloc_seg_inode_page(fil_space_t *space, buf_block_t *header, mtr_t *mtr) +@param[in,out] header tablespace header +@param[in,out] mtr mini-transaction +@return error code */ +static dberr_t fsp_alloc_seg_inode_page(fil_space_t *space, + buf_block_t *header, mtr_t *mtr) { ut_ad(header->page.id().space() == space->id); - buf_block_t *block= fsp_alloc_free_page(space, 0, mtr, mtr); + dberr_t err; + buf_block_t *block= fsp_alloc_free_page(space, 0, mtr, mtr, &err); if (!block) - return false; + return err; ut_ad(block->page.lock.not_recursive()); @@ -1422,123 +1387,136 @@ fsp_alloc_seg_inode_page(fil_space_t *space, buf_block_t *header, mtr_t *mtr) ut_ad(!mach_read_from_8(inode)); #endif - flst_add_last(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE, - block, FSEG_INODE_PAGE_NODE, mtr); - return true; + return flst_add_last(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE, + block, FSEG_INODE_PAGE_NODE, mtr); } +MY_ATTRIBUTE((nonnull, warn_unused_result)) /** Allocate a file segment inode. @param[in,out] space tablespace @param[in,out] header tablespace header @param[out] iblock segment inode page @param[in,out] mtr mini-transaction +@param[out] err error code @return segment inode -@retval NULL if not enough space */ -MY_ATTRIBUTE((nonnull, warn_unused_result)) +@retval nullptr on failure */ static fseg_inode_t* fsp_alloc_seg_inode(fil_space_t *space, buf_block_t *header, - buf_block_t **iblock, mtr_t *mtr) + buf_block_t **iblock, mtr_t *mtr, dberr_t *err) { - buf_block_t* block; - fseg_inode_t* inode; - - /* Allocate a new segment inode page if needed. */ - if (!flst_get_len(FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE - + header->page.frame) - && !fsp_alloc_seg_inode_page(space, header, mtr)) { - return(NULL); - } - const page_id_t page_id( - space->id, - flst_get_first(FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE - + header->page.frame).page); - - block = buf_page_get_gen(page_id, space->zip_size(), RW_SX_LATCH, - nullptr, BUF_GET_POSSIBLY_FREED, mtr); - if (!block || block->page.is_freed()) { - return nullptr; - } - - if (!space->full_crc32()) { - fil_block_check_type(*block, FIL_PAGE_INODE, mtr); - } + /* Allocate a new segment inode page if needed. */ + if (!flst_get_len(FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE + + header->page.frame)) + { + *err= fsp_alloc_seg_inode_page(space, header, mtr); + if (*err != DB_SUCCESS) + return nullptr; + } - const ulint physical_size = space->physical_size(); + const page_id_t page_id + { + space->id, + mach_read_from_4(FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE + FLST_FIRST + + FIL_ADDR_PAGE + header->page.frame) + }; + + buf_block_t *block= + buf_page_get_gen(page_id, space->zip_size(), RW_SX_LATCH, + nullptr, BUF_GET_POSSIBLY_FREED, mtr, err); + if (!block) + return nullptr; - ulint n = fsp_seg_inode_page_find_free(block->page.frame, 0, - physical_size); + if (!space->full_crc32()) + fil_block_check_type(*block, FIL_PAGE_INODE, mtr); - ut_a(n < FSP_SEG_INODES_PER_PAGE(physical_size)); + const ulint physical_size= space->physical_size(); + ulint n= fsp_seg_inode_page_find_free(block->page.frame, 0, physical_size); - inode = fsp_seg_inode_page_get_nth_inode(block->page.frame, n); + if (UNIV_UNLIKELY(n >= FSP_SEG_INODES_PER_PAGE(physical_size))) + { + *err= DB_CORRUPTION; + return nullptr; + } + fseg_inode_t *inode= fsp_seg_inode_page_get_nth_inode(block->page.frame, n); - if (ULINT_UNDEFINED == fsp_seg_inode_page_find_free(block->page.frame, - n + 1, - physical_size)) { - /* There are no other unused headers left on the page: move it - to another list */ - flst_remove(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE, - block, FSEG_INODE_PAGE_NODE, mtr); - flst_add_last(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FULL, - block, FSEG_INODE_PAGE_NODE, mtr); - } + if (ULINT_UNDEFINED == fsp_seg_inode_page_find_free(block->page.frame, n + 1, + physical_size)) + { + /* There are no other unused headers left on the page: move it + to another list */ + *err= flst_remove(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE, + block, FSEG_INODE_PAGE_NODE, mtr); + if (UNIV_UNLIKELY(*err != DB_SUCCESS)) + return nullptr; + *err= flst_add_last(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FULL, + block, FSEG_INODE_PAGE_NODE, mtr); + if (UNIV_UNLIKELY(*err != DB_SUCCESS)) + return nullptr; + } - ut_ad(!mach_read_from_8(inode + FSEG_ID) - || mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE); - *iblock = block; - return(inode); + ut_ad(!mach_read_from_8(inode + FSEG_ID) || + !memcmp(FSEG_MAGIC_N_BYTES, FSEG_MAGIC_N + inode, 4)); + *iblock= block; + return inode; } +MY_ATTRIBUTE((nonnull)) /** Frees a file segment inode. @param[in,out] space tablespace @param[in,out] inode segment inode @param[in,out] iblock segment inode page @param[in,out] mtr mini-transaction */ -static void fsp_free_seg_inode( - fil_space_t* space, - fseg_inode_t* inode, - buf_block_t* iblock, - mtr_t* mtr) +static void fsp_free_seg_inode(fil_space_t *space, fseg_inode_t *inode, + buf_block_t *iblock, mtr_t *mtr) { - ut_d(space->modify_check(*mtr)); + ut_d(space->modify_check(*mtr)); - buf_block_t* header = fsp_get_header(space, mtr); - if (!header) { - return; - } + dberr_t err; + buf_block_t *header= fsp_get_header(space, mtr, &err); + if (!header) + return; + if (UNIV_UNLIKELY(memcmp(FSEG_MAGIC_N_BYTES, FSEG_MAGIC_N + inode, 4))) + { + space->set_corrupted(); + return; + } - ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE); + const ulint physical_size= space->physical_size(); - const ulint physical_size = space->physical_size(); + if (ULINT_UNDEFINED == fsp_seg_inode_page_find_free(iblock->page.frame, 0, + physical_size)) + { + /* Move the page to another list */ + if (flst_remove(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FULL, + iblock, FSEG_INODE_PAGE_NODE, mtr) != DB_SUCCESS) + return; + if (flst_add_last(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE, + iblock, FSEG_INODE_PAGE_NODE, mtr) != DB_SUCCESS) + return; + } - if (ULINT_UNDEFINED - == fsp_seg_inode_page_find_free(iblock->page.frame, 0, - physical_size)) { - /* Move the page to another list */ - flst_remove(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FULL, - iblock, FSEG_INODE_PAGE_NODE, mtr); - flst_add_last(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE, - iblock, FSEG_INODE_PAGE_NODE, mtr); - } + mtr->memset(iblock, page_offset(inode) + FSEG_ID, FSEG_INODE_SIZE, 0); - mtr->memset(iblock, page_offset(inode) + FSEG_ID, FSEG_INODE_SIZE, 0); + if (ULINT_UNDEFINED != fsp_seg_inode_page_find_used(iblock->page.frame, + physical_size)) + return; - if (ULINT_UNDEFINED == fsp_seg_inode_page_find_used(iblock->page.frame, - physical_size)) { - /* There are no other used headers left on the page: free it */ - flst_remove(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE, - iblock, FSEG_INODE_PAGE_NODE, mtr); - fsp_free_page(space, iblock->page.id().page_no(), mtr); - } + /* There are no other used headers left on the page: free it */ + if (flst_remove(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE, + iblock, FSEG_INODE_PAGE_NODE, mtr) == DB_SUCCESS) + fsp_free_page(space, iblock->page.id().page_no(), mtr); } +MY_ATTRIBUTE((nonnull(1,4,5), warn_unused_result)) /** Returns the file segment inode, page x-latched. @param[in] header segment header @param[in] space space id @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param[in,out] mtr mini-transaction -@param[out] block inode block, or NULL to ignore -@return segment inode, page x-latched; NULL if the inode is free */ +@param[out] block inode block +@param[out] err error code +@return segment inode, page x-latched +@retrval nullptr if the inode is free or corruption was noticed */ static fseg_inode_t* fseg_inode_try_get( @@ -1546,47 +1524,34 @@ fseg_inode_try_get( uint32_t space, ulint zip_size, mtr_t* mtr, - buf_block_t** block) + buf_block_t** block, + dberr_t* err = nullptr) { - fil_addr_t inode_addr; - fseg_inode_t* inode; - - inode_addr.page = mach_read_from_4(header + FSEG_HDR_PAGE_NO); - inode_addr.boffset = mach_read_from_2(header + FSEG_HDR_OFFSET); - ut_ad(space == mach_read_from_4(header + FSEG_HDR_SPACE)); + if (UNIV_UNLIKELY(space != mach_read_from_4(header + FSEG_HDR_SPACE))) + { + corrupted: + if (err) + *err= DB_CORRUPTION; + return nullptr; + } - inode = fut_get_ptr(space, zip_size, inode_addr, RW_SX_LATCH, - mtr, block); + *block= + buf_page_get_gen(page_id_t(space, + mach_read_from_4(header + FSEG_HDR_PAGE_NO)), + zip_size, RW_SX_LATCH, nullptr, BUF_GET_POSSIBLY_FREED, + mtr, err); + if (!*block) + return nullptr; - if (UNIV_UNLIKELY(!inode)) { - } else if (UNIV_UNLIKELY(!mach_read_from_8(inode + FSEG_ID))) { - inode = NULL; - } else { - ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) - == FSEG_MAGIC_N_VALUE); - } + const uint16_t offset= mach_read_from_2(header + FSEG_HDR_OFFSET); + if (UNIV_UNLIKELY(offset >= (*block)->physical_size())) + goto corrupted; - return(inode); -} + fseg_inode_t *inode= (*block)->page.frame + offset; + if (UNIV_UNLIKELY(!mach_read_from_8(inode + FSEG_ID) || + memcmp(FSEG_MAGIC_N_BYTES, FSEG_MAGIC_N + inode, 4))) + goto corrupted; -/** Returns the file segment inode, page x-latched. -@param[in] header segment header -@param[in] space space id -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in,out] mtr mini-transaction -@param[out] block inode block -@return segment inode, page x-latched */ -static -fseg_inode_t* -fseg_inode_get( - const fseg_header_t* header, - uint32_t space, - ulint zip_size, - mtr_t* mtr, - buf_block_t** block = NULL) -{ - fseg_inode_t *inode= fseg_inode_try_get(header, space, zip_size, mtr, block); - ut_a(inode); return inode; } @@ -1599,7 +1564,7 @@ static uint32_t fseg_get_nth_frag_page_no(const fseg_inode_t *inode, ulint n) { ut_ad(inode); ut_ad(n < FSEG_FRAG_ARR_N_SLOTS); - ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE); + ut_ad(!memcmp(FSEG_MAGIC_N_BYTES, FSEG_MAGIC_N + inode, 4)); return(mach_read_from_4(inode + FSEG_FRAG_ARR + n * FSEG_FRAG_SLOT_SIZE)); } @@ -1615,7 +1580,7 @@ inline void fseg_set_nth_frag_page_no(fseg_inode_t *inode, buf_block_t *iblock, { ut_ad(n < FSEG_FRAG_ARR_N_SLOTS); ut_ad(mtr->memo_contains_flagged(iblock, MTR_MEMO_PAGE_SX_FIX)); - ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE); + ut_ad(!memcmp(FSEG_MAGIC_N_BYTES, FSEG_MAGIC_N + inode, 4)); mtr->write<4>(*iblock, inode + FSEG_FRAG_ARR + n * FSEG_FRAG_SLOT_SIZE, page_no); @@ -1691,18 +1656,20 @@ static ulint fseg_get_n_frag_pages(const fseg_inode_t *inode) @param space tablespace @param byte_offset byte offset of the created segment header @param mtr mini-transaction +@param err error code @param has_done_reservation whether fsp_reserve_free_extents() was invoked @param block block where segment header is placed, or NULL to allocate an additional page for that @return the block where the segment header is placed, x-latched -@retval NULL if could not create segment because of lack of space */ +@retval nullptr if could not create segment */ buf_block_t* -fseg_create(fil_space_t *space, ulint byte_offset, mtr_t *mtr, +fseg_create(fil_space_t *space, ulint byte_offset, mtr_t *mtr, dberr_t *err, bool has_done_reservation, buf_block_t *block) { fseg_inode_t* inode; ib_id_t seg_id; uint32_t n_reserved; + bool reserved_extent = false; DBUG_ENTER("fseg_create"); @@ -1716,23 +1683,40 @@ fseg_create(fil_space_t *space, ulint byte_offset, mtr_t *mtr, ut_ad(!block || block->page.id().space() == space->id); - if (!has_done_reservation - && !fsp_reserve_free_extents(&n_reserved, space, 2, - FSP_NORMAL, mtr)) { - DBUG_RETURN(NULL); - } - - buf_block_t* header = fsp_get_header(space, mtr); + buf_block_t* header = fsp_get_header(space, mtr, err); if (!header) { - ut_ad("corruption" == 0); + block = nullptr; goto funct_exit; } buf_block_t* iblock; - inode = fsp_alloc_seg_inode(space, header, &iblock, mtr); +inode_alloc: + inode = fsp_alloc_seg_inode(space, header, &iblock, mtr, err); + + if (!inode) { + block = nullptr; +reserve_extent: + if (!has_done_reservation && !reserved_extent) { + *err = fsp_reserve_free_extents(&n_reserved, space, 2, + FSP_NORMAL, mtr); + if (UNIV_UNLIKELY(*err != DB_SUCCESS)) { + DBUG_RETURN(nullptr); + } + + /* Extents reserved successfully. So + try allocating the page or inode */ + reserved_extent = true; + if (inode) { + goto page_alloc; + } + + goto inode_alloc; + } - if (inode == NULL) { + if (inode) { + fsp_free_seg_inode(space, inode, iblock, mtr); + } goto funct_exit; } @@ -1752,7 +1736,7 @@ fseg_create(fil_space_t *space, ulint byte_offset, mtr_t *mtr, flst_init(*iblock, inode + FSEG_NOT_FULL, mtr); flst_init(*iblock, inode + FSEG_FULL, mtr); - mtr->write<4>(*iblock, inode + FSEG_MAGIC_N, FSEG_MAGIC_N_VALUE); + mtr->memcpy(*iblock, inode + FSEG_MAGIC_N, FSEG_MAGIC_N_BYTES, 4); compile_time_assert(FSEG_FRAG_SLOT_SIZE == 4); compile_time_assert(FIL_NULL == 0xffffffff); mtr->memset(iblock, @@ -1760,20 +1744,17 @@ fseg_create(fil_space_t *space, ulint byte_offset, mtr_t *mtr, FSEG_FRAG_SLOT_SIZE * FSEG_FRAG_ARR_N_SLOTS, 0xff); if (!block) { +page_alloc: block = fseg_alloc_free_page_low(space, inode, iblock, 0, FSP_UP, #ifdef UNIV_DEBUG has_done_reservation, #endif /* UNIV_DEBUG */ - mtr, mtr); - - /* The allocation cannot fail if we have already reserved a - space for the page. */ - ut_ad(!has_done_reservation || block != NULL); + mtr, mtr, err); - if (block == NULL) { - fsp_free_seg_inode(space, inode, iblock, mtr); - goto funct_exit; + if (!block) { + ut_ad(!has_done_reservation); + goto reserve_extent; } ut_d(const auto x = block->page.lock.x_lock_count()); @@ -1795,7 +1776,7 @@ fseg_create(fil_space_t *space, ulint byte_offset, mtr_t *mtr, + block->page.frame, space->id); funct_exit: - if (!has_done_reservation) { + if (!has_done_reservation && reserved_extent) { space->release_free_extents(n_reserved); } @@ -1836,149 +1817,127 @@ ulint fseg_n_reserved_pages(const buf_block_t &block, mtr_t *mtr) { ut_ad(page_align(header) == block.page.frame); - return fseg_n_reserved_pages_low(fseg_inode_get(header, - block.page.id().space(), - block.zip_size(), mtr), - used); + buf_block_t *iblock; + if (fseg_inode_t *inode= + fseg_inode_try_get(header, block.page.id().space(), block.zip_size(), + mtr, &iblock)) + return fseg_n_reserved_pages_low(inode, used); + return *used= 0; } +MY_ATTRIBUTE((nonnull, warn_unused_result)) /** Tries to fill the free list of a segment with consecutive free extents. This happens if the segment is big enough to allow extents in the free list, the free list is empty, and the extents can be allocated consecutively from the hint onward. -@param[in,out] inode segment inode +@param[in] inode segment inode @param[in,out] iblock segment inode page @param[in] space tablespace @param[in] hint hint which extent would be good as the first extent @param[in,out] mtr mini-transaction */ -static -void -fseg_fill_free_list( - fseg_inode_t* inode, - buf_block_t* iblock, - fil_space_t* space, - uint32_t hint, - mtr_t* mtr) +static dberr_t fseg_fill_free_list(const fseg_inode_t *inode, + buf_block_t *iblock, fil_space_t *space, + uint32_t hint, mtr_t *mtr) { - xdes_t* descr; - ulint i; - ib_id_t seg_id; - ulint reserved; - ulint used; - - ut_ad(inode && mtr); - ut_ad(!((page_offset(inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE)); - ut_d(space->modify_check(*mtr)); - - reserved = fseg_n_reserved_pages_low(inode, &used); - - if (reserved < FSEG_FREE_LIST_LIMIT * FSP_EXTENT_SIZE) { + ulint used; - /* The segment is too small to allow extents in free list */ + ut_ad(!((page_offset(inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE)); + ut_d(space->modify_check(*mtr)); - return; - } - - if (flst_get_len(inode + FSEG_FREE) > 0) { - /* Free list is not empty */ - - return; - } + if (fseg_n_reserved_pages_low(inode, &used) < + FSEG_FREE_LIST_LIMIT * FSP_EXTENT_SIZE) + /* The segment is too small to allow extents in free list */ + return DB_SUCCESS; - for (i = 0; i < FSEG_FREE_LIST_MAX_LEN; i++) { - buf_block_t* xdes; - descr = xdes_get_descriptor(space, hint, mtr, &xdes); - - if (!descr || (XDES_FREE != xdes_get_state(descr))) { - /* We cannot allocate the desired extent: stop */ - return; - } - - descr = fsp_alloc_free_extent(space, hint, &xdes, mtr); + if (UNIV_UNLIKELY(memcmp(FSEG_MAGIC_N_BYTES, FSEG_MAGIC_N + inode, 4))) + { + space->set_corrupted(); + return DB_CORRUPTION; + } - xdes_set_state(*xdes, descr, XDES_FSEG, mtr); + if (flst_get_len(inode + FSEG_FREE) > 0) + /* Free list is not empty */ + return DB_SUCCESS; - seg_id = mach_read_from_8(inode + FSEG_ID); - ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) - == FSEG_MAGIC_N_VALUE); - mtr->write<8>(*xdes, descr + XDES_ID, seg_id); + for (ulint i= 0; i < FSEG_FREE_LIST_MAX_LEN; i++, hint += FSP_EXTENT_SIZE) + { + buf_block_t *xdes; + dberr_t err; + xdes_t *descr= xdes_get_descriptor(space, hint, mtr, &err, &xdes); + if (!descr || XDES_FREE != xdes_get_state(descr)) + /* We cannot allocate the desired extent: stop */ + return err; + + descr= fsp_alloc_free_extent(space, hint, &xdes, mtr, &err); + if (UNIV_UNLIKELY(!descr)) + return err; + + if (dberr_t err= + flst_add_last(iblock, + static_cast(inode - iblock->page.frame + + FSEG_FREE), xdes, + static_cast(descr - xdes->page.frame + + XDES_FLST_NODE), mtr)) + return err; + xdes_set_state(*xdes, descr, XDES_FSEG, mtr); + mtr->memcpy(*xdes, descr + XDES_ID, inode + FSEG_ID, 8); + } - flst_add_last(iblock, - static_cast(inode - iblock->page.frame - + FSEG_FREE), xdes, - static_cast(descr - xdes->page.frame - + XDES_FLST_NODE), mtr); - hint += FSP_EXTENT_SIZE; - } + return DB_SUCCESS; } +MY_ATTRIBUTE((nonnull, warn_unused_result)) /** Allocates a free extent for the segment: looks first in the free list of the segment, then tries to allocate from the space free list. NOTE that the extent returned still resides in the segment free list, it is not yet taken off it! -@param[in,out] inode segment inode +@param[in] inode segment inode @param[in,out] iblock segment inode page @param[out] xdes extent descriptor page @param[in,out] space tablespace @param[in,out] mtr mini-transaction -@retval NULL if no page could be allocated */ +@param[out] err error code +@retval nullptr if no page could be allocated */ static xdes_t* fseg_alloc_free_extent( - fseg_inode_t* inode, + const fseg_inode_t* inode, buf_block_t* iblock, buf_block_t** xdes, fil_space_t* space, - mtr_t* mtr) + mtr_t* mtr, + dberr_t* err) { - xdes_t* descr; - ib_id_t seg_id; - fil_addr_t first; - - ut_ad(!((page_offset(inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE)); - ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE); - ut_d(space->modify_check(*mtr)); - - if (flst_get_len(inode + FSEG_FREE) > 0) { - /* Segment free list is not empty, allocate from it */ - - first = flst_get_first(inode + FSEG_FREE); - - descr = xdes_lst_get_descriptor(*space, first, mtr, xdes); - if (UNIV_UNLIKELY(!descr)) { - ib::error() << "Allocation metadata for file '" - << space->chain.start->name - << "' is corrupted"; - ut_ad("corruption" == 0); - return nullptr; - } - } else { - /* Segment free list was empty, allocate from space */ - descr = fsp_alloc_free_extent(space, 0, xdes, mtr); - - if (descr == NULL) { - - return(NULL); - } + ut_ad(!((page_offset(inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE)); + ut_ad(!memcmp(FSEG_MAGIC_N_BYTES, FSEG_MAGIC_N + inode, 4)); + ut_d(space->modify_check(*mtr)); - seg_id = mach_read_from_8(inode + FSEG_ID); - - xdes_set_state(**xdes, descr, XDES_FSEG, mtr); - mtr->write<8,mtr_t::MAYBE_NOP>(**xdes, descr + XDES_ID, - seg_id); - flst_add_last(iblock, - static_cast(inode - iblock->page.frame - + FSEG_FREE), *xdes, - static_cast(descr - (*xdes)->page.frame - + XDES_FLST_NODE), mtr); + if (flst_get_len(inode + FSEG_FREE)) + { + /* Segment free list is not empty, allocate from it */ + return xdes_lst_get_descriptor(*space, flst_get_first(inode + FSEG_FREE), + mtr, xdes, err); + } - /* Try to fill the segment free list */ - fseg_fill_free_list(inode, iblock, space, - xdes_get_offset(descr) + FSP_EXTENT_SIZE, - mtr); - } + xdes_t* descr= fsp_alloc_free_extent(space, 0, xdes, mtr, err); + if (UNIV_UNLIKELY(!descr)) + return descr; + xdes_set_state(**xdes, descr, XDES_FSEG, mtr); + mtr->memcpy(**xdes, descr + XDES_ID, inode + FSEG_ID, 8); + *err= flst_add_last(iblock, + static_cast(inode - iblock->page.frame + + FSEG_FREE), *xdes, + static_cast(descr - (*xdes)->page.frame + + XDES_FLST_NODE), mtr); + if (UNIV_LIKELY(*err != DB_SUCCESS)) + return nullptr; + /* Try to fill the segment free list */ + *err= fseg_fill_free_list(inode, iblock, space, + xdes_get_offset(descr) + FSP_EXTENT_SIZE, mtr); + if (UNIV_UNLIKELY(*err != DB_SUCCESS)) + return nullptr; - return(descr); + return descr; } /** Allocates a single free page from a segment. @@ -1994,7 +1953,9 @@ direction they go alphabetically: FSP_DOWN, FSP_UP, FSP_NO_DIR @param[in,out] mtr mini-transaction @param[in,out] init_mtr mtr or another mini-transaction in which the page should be initialized. -@retval NULL if no page could be allocated */ +@param[out] err error code +@return the allocated page +@retval nullptr if no page could be allocated */ static buf_block_t* fseg_alloc_free_page_low( @@ -2008,7 +1969,8 @@ fseg_alloc_free_page_low( /*!< whether the space has already been reserved */ #endif /* UNIV_DEBUG */ mtr_t* mtr, - mtr_t* init_mtr) + mtr_t* init_mtr, + dberr_t* err) { ib_id_t seg_id; ulint used; @@ -2019,11 +1981,9 @@ fseg_alloc_free_page_low( xdes_t* ret_descr; /*!< the extent of the allocated page */ buf_block_t* xdes; ulint n; - const uint32_t space_id = space->id; ut_ad((direction >= FSP_UP) && (direction <= FSP_NO_DIR)); - ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N) - == FSEG_MAGIC_N_VALUE); + ut_ad(!memcmp(FSEG_MAGIC_N_BYTES, FSEG_MAGIC_N + seg_inode, 4)); ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE)); seg_id = mach_read_from_8(seg_inode + FSEG_ID); @@ -2033,20 +1993,22 @@ fseg_alloc_free_page_low( reserved = fseg_n_reserved_pages_low(seg_inode, &used); - buf_block_t* header = fsp_get_header(space, mtr); + buf_block_t* header = fsp_get_header(space, mtr, err); if (!header) { - ut_ad("corruption" == 0); - return nullptr; + return header; } descr = xdes_get_descriptor_with_space_hdr(header, space, hint, mtr, - &xdes); + err, &xdes); if (!descr) { + if (*err != DB_SUCCESS) { + return nullptr; + } /* Hint outside space or too high above free limit: reset hint */ /* The file space header page is always allocated. */ hint = 0; - descr = xdes_get_descriptor(space, hint, mtr, &xdes); + descr = xdes_get_descriptor(space, hint, mtr, err, &xdes); if (!descr) { return nullptr; } @@ -2075,32 +2037,44 @@ fseg_alloc_free_page_low( ========================================================= the hinted page ===============*/ - ret_descr = fsp_alloc_free_extent(space, hint, &xdes, mtr); + ret_descr = fsp_alloc_free_extent(space, hint, &xdes, + mtr, err); - ut_a(ret_descr == descr); + if (UNIV_UNLIKELY(ret_descr != descr)) { + if (*err != DB_SUCCESS) { + *err = DB_CORRUPTION; + } + return nullptr; + } xdes_set_state(*xdes, ret_descr, XDES_FSEG, mtr); mtr->write<8,mtr_t::MAYBE_NOP>(*xdes, ret_descr + XDES_ID, seg_id); - flst_add_last(iblock, - static_cast(seg_inode - - iblock->page.frame - + FSEG_FREE), xdes, - static_cast(ret_descr - - xdes->page.frame - + XDES_FLST_NODE), mtr); + *err = flst_add_last( + iblock, + static_cast(seg_inode - iblock->page.frame + + FSEG_FREE), xdes, + static_cast(ret_descr + - xdes->page.frame + + XDES_FLST_NODE), mtr); + if (UNIV_UNLIKELY(*err != DB_SUCCESS)) { + return nullptr; + } /* Try to fill the segment free list */ - fseg_fill_free_list(seg_inode, iblock, space, - hint + FSP_EXTENT_SIZE, mtr); + *err = fseg_fill_free_list(seg_inode, iblock, space, + hint + FSP_EXTENT_SIZE, mtr); + if (UNIV_UNLIKELY(*err != DB_SUCCESS)) { + return nullptr; + } goto take_hinted_page; /*-----------------------------------------------------------*/ } else if ((direction != FSP_NO_DIR) && ((reserved - used) < reserved / FSEG_FILLFACTOR) && (used >= FSEG_FRAG_LIMIT) - && !!(ret_descr = fseg_alloc_free_extent(seg_inode, iblock, - &xdes, space, - mtr))) { + && (ret_descr = fseg_alloc_free_extent(seg_inode, iblock, + &xdes, space, + mtr, err))) { /* 3. We take any free extent (which was already assigned above =============================================================== in the if-condition to ret_descr) and take the lowest or @@ -2114,6 +2088,8 @@ fseg_alloc_free_page_low( } ut_ad(!has_done_reservation || ret_page != FIL_NULL); /*-----------------------------------------------------------*/ + } else if (UNIV_UNLIKELY(*err != DB_SUCCESS)) { + return nullptr; } else if ((xdes_get_state(descr) == XDES_FSEG) && mach_read_from_8(descr + XDES_ID) == seg_id && (!xdes_is_full(descr))) { @@ -2148,10 +2124,6 @@ fseg_alloc_free_page_low( ret_descr = xdes_lst_get_descriptor(*space, first, mtr, &xdes); if (!ret_descr) { - ib::error() << "Allocation metadata for file '" - << space->chain.start->name - << "' is corrupted"; - ut_ad("corruption" == 0); return nullptr; } @@ -2166,15 +2138,18 @@ fseg_alloc_free_page_low( /* 6. We allocate an individual page from the space ===================================================*/ buf_block_t* block = fsp_alloc_free_page( - space, hint, mtr, init_mtr); + space, hint, mtr, init_mtr, err); - ut_ad(!has_done_reservation || block); + ut_ad(block || !has_done_reservation || *err); if (block) { /* Put the page in the fragment page array of the segment */ n = fseg_find_free_frag_page_slot(seg_inode); - ut_a(n != ULINT_UNDEFINED); + if (UNIV_UNLIKELY(n == ULINT_UNDEFINED)) { + *err = DB_CORRUPTION; + return nullptr; + } fseg_set_nth_frag_page_no( seg_inode, iblock, n, @@ -2189,14 +2164,13 @@ fseg_alloc_free_page_low( /* 7. We allocate a new extent and take its first page ======================================================*/ ret_descr = fseg_alloc_free_extent(seg_inode, iblock, &xdes, - space, mtr); + space, mtr, err); - if (ret_descr == NULL) { - ret_page = FIL_NULL; - ut_ad(!has_done_reservation); + if (!ret_descr) { + ut_ad(!has_done_reservation || *err); + return nullptr; } else { ret_page = xdes_get_offset(ret_descr); - ut_ad(!has_done_reservation || ret_page != FIL_NULL); } } @@ -2207,16 +2181,17 @@ fseg_alloc_free_page_low( return(NULL); } - if (space->size <= ret_page && !is_predefined_tablespace(space_id)) { + if (space->size <= ret_page && !is_predefined_tablespace(space->id)) { /* It must be that we are extending a single-table tablespace whose size is still < 64 pages */ if (ret_page >= FSP_EXTENT_SIZE) { - ib::error() << "Trying to extend '" - << space->chain.start->name - << "' by single page(s) though the" - << " space size " << space->size - << ". Page no " << ret_page << "."; + sql_print_error("InnoDB: Trying to extend '%s'" + " by single page(s) though the" + " space size " UINT32PF "." + " Page no " UINT32PF ".", + space->chain.start->name, space->size, + ret_page); ut_ad(!has_done_reservation); return(NULL); } @@ -2238,13 +2213,16 @@ fseg_alloc_free_page_low( or FSEG_FREE), and the page is not yet marked as used. */ ut_d(buf_block_t* xxdes); - ut_ad(xdes_get_descriptor(space, ret_page, mtr, &xxdes) + ut_ad(xdes_get_descriptor(space, ret_page, mtr, err, &xxdes) == ret_descr); ut_ad(xdes == xxdes); ut_ad(xdes_is_free(ret_descr, ret_page % FSP_EXTENT_SIZE)); - fseg_mark_page_used(seg_inode, iblock, ret_page, ret_descr, - xdes, mtr); + *err = fseg_mark_page_used(seg_inode, iblock, ret_page, + ret_descr, xdes, mtr); + if (UNIV_UNLIKELY(*err != DB_SUCCESS)) { + return nullptr; + } } return fsp_page_create(space, ret_page, init_mtr); @@ -2272,8 +2250,9 @@ fseg_alloc_free_page_general( is no need to do the check for this individual page */ mtr_t* mtr, /*!< in/out: mini-transaction */ - mtr_t* init_mtr)/*!< in/out: mtr or another mini-transaction + mtr_t* init_mtr,/*!< in/out: mtr or another mini-transaction in which the page should be initialized. */ + dberr_t* err) /*!< out: error code */ { fseg_inode_t* inode; fil_space_t* space; @@ -2283,16 +2262,21 @@ fseg_alloc_free_page_general( const uint32_t space_id = page_get_space_id(page_align(seg_header)); space = mtr->x_lock_space(space_id); - inode = fseg_inode_get(seg_header, space_id, space->zip_size(), - mtr, &iblock); + inode = fseg_inode_try_get(seg_header, space_id, space->zip_size(), + mtr, &iblock, err); + if (!inode) { + return nullptr; + } if (!space->full_crc32()) { fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr); } - if (!has_done_reservation - && !fsp_reserve_free_extents(&n_reserved, space, 2, - FSP_NORMAL, mtr)) { - return(NULL); + if (!has_done_reservation) { + *err = fsp_reserve_free_extents(&n_reserved, space, 2, + FSP_NORMAL, mtr); + if (*err != DB_SUCCESS) { + return nullptr; + } } block = fseg_alloc_free_page_low(space, @@ -2300,11 +2284,11 @@ fseg_alloc_free_page_general( #ifdef UNIV_DEBUG has_done_reservation, #endif /* UNIV_DEBUG */ - mtr, init_mtr); + mtr, init_mtr, err); /* The allocation cannot fail if we have already reserved a space for the page. */ - ut_ad(!has_done_reservation || block != NULL); + ut_ad(block || !has_done_reservation || *err); if (!has_done_reservation) { space->release_free_extents(n_reserved); @@ -2313,6 +2297,7 @@ fseg_alloc_free_page_general( return(block); } +MY_ATTRIBUTE((nonnull, warn_unused_result)) /** Check that we have at least n_pages frag pages free in the first extent of a single-table tablespace, and they are also physically initialized to the data file. That is we have already extended the data file so that those @@ -2323,10 +2308,9 @@ with pages. @param[in] size tablespace size in pages, less than FSP_EXTENT_SIZE @param[in,out] mtr mini-transaction @param[in] n_pages number of pages to reserve -@return true if there were at least n_pages free pages, or we were able -to extend */ +@return error code */ static -bool +dberr_t fsp_reserve_free_pages( fil_space_t* space, buf_block_t* header, @@ -2334,25 +2318,23 @@ fsp_reserve_free_pages( mtr_t* mtr, uint32_t n_pages) { - xdes_t* descr; - - ut_a(!is_system_tablespace(space->id)); - ut_a(size < FSP_EXTENT_SIZE); - - descr = xdes_get_descriptor_with_space_hdr(header, space, 0, mtr); - if (!descr) { - return false; - } - uint32_t n_used = xdes_get_n_used(descr); - - if (n_used > size) { - ut_ad("corruption" == 0); - return false; - } + ut_ad(space != fil_system.sys_space && space != fil_system.temp_space); + ut_ad(size < FSP_EXTENT_SIZE); - return(size >= n_used + n_pages - || fsp_try_extend_data_file_with_pages( - space, n_used + n_pages - 1, header, mtr)); + dberr_t err= DB_OUT_OF_FILE_SPACE; + const xdes_t *descr= + xdes_get_descriptor_with_space_hdr(header, space, 0, mtr, &err); + if (!descr) + return err; + const uint32_t n_used= xdes_get_n_used(descr); + if (size >= n_used + n_pages) + return DB_SUCCESS; + if (n_used > size) + return DB_CORRUPTION; + return fsp_try_extend_data_file_with_pages(space, n_used + n_pages - 1, + header, mtr) + ? DB_SUCCESS + : DB_OUT_OF_FILE_SPACE; } /** Reserves free pages from a tablespace. All mini-transactions which may @@ -2392,8 +2374,9 @@ free pages available. @param[in] n_pages for small tablespaces (tablespace size is less than FSP_EXTENT_SIZE), number of free pages to reserve. -@return true if we were able to make the reservation */ -bool +@return error code +@retval DB_SUCCESS if we were able to make the reservation */ +dberr_t fsp_reserve_free_extents( uint32_t* n_reserved, fil_space_t* space, @@ -2412,9 +2395,10 @@ fsp_reserve_free_extents( mtr->x_lock_space(space); const unsigned physical_size = space->physical_size(); - buf_block_t* header = fsp_get_header(space, mtr); + dberr_t err; + buf_block_t* header = fsp_get_header(space, mtr, &err); if (!header) { - ut_ad("corruption" == 0); + return err; } try_again: uint32_t size = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SIZE @@ -2424,8 +2408,8 @@ fsp_reserve_free_extents( if (size < extent_size && n_pages < extent_size / 2) { /* Use different rules for small single-table tablespaces */ *n_reserved = 0; - return(fsp_reserve_free_pages(space, header, size, - mtr, n_pages)); + return fsp_reserve_free_pages(space, header, size, + mtr, n_pages); } uint32_t n_free_list_ext = flst_get_len(FSP_HEADER_OFFSET + FSP_FREE @@ -2488,24 +2472,26 @@ fsp_reserve_free_extents( } if (space->reserve_free_extents(n_free, n_ext)) { - return(true); + return DB_SUCCESS; } try_to_extend: if (fsp_try_extend_data_file(space, header, mtr)) { goto try_again; } - return(false); + return DB_OUT_OF_FILE_SPACE; } +MY_ATTRIBUTE((nonnull, warn_unused_result)) /** Frees a single page of a segment. @param[in] seg_inode segment inode @param[in,out] space tablespace @param[in] offset page number @param[in,out] mtr mini-transaction -@param[in] ahi Drop adaptive hash index */ +@param[in] ahi Drop adaptive hash index +@return error code */ static -void +dberr_t fseg_free_page_low( fseg_inode_t* seg_inode, buf_block_t* iblock, @@ -2517,13 +2503,7 @@ fseg_free_page_low( #endif /* BTR_CUR_HASH_ADAPT */ ) { - ib_id_t descr_id; - ib_id_t seg_id; - - ut_ad(seg_inode != NULL); - ut_ad(mtr != NULL); - ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N) - == FSEG_MAGIC_N_VALUE); + ut_ad(!memcmp(FSEG_MAGIC_N_BYTES, FSEG_MAGIC_N + seg_inode, 4)); ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE)); ut_ad(iblock->page.frame == page_align(seg_inode)); ut_d(space->modify_check(*mtr)); @@ -2538,16 +2518,16 @@ fseg_free_page_low( const uint32_t extent_size = FSP_EXTENT_SIZE; ut_ad(ut_is_2pow(extent_size)); buf_block_t* xdes; - xdes_t* descr = xdes_get_descriptor(space, offset, mtr, &xdes); + dberr_t err; + xdes_t* descr = xdes_get_descriptor(space, offset, mtr, &err, &xdes); - if (!descr || xdes_is_free(descr, offset & (extent_size - 1))) { - if (space->is_stopping()) { - return; - } - ib::error() << "Page " << offset << " in file '" - << space->chain.start->name - << "' is already marked as free"; - return; + if (!descr) { + return err; + } + if (UNIV_UNLIKELY(xdes_is_free(descr, offset & (extent_size - 1)))) { +corrupted: + space->set_corrupted(); + return DB_CORRUPTION; } if (xdes_get_state(descr) != XDES_FSEG) { @@ -2566,22 +2546,13 @@ fseg_free_page_low( break; } - fsp_free_page(space, offset, mtr); - return; + return fsp_free_page(space, offset, mtr); } /* If we get here, the page is in some extent of the segment */ - descr_id = mach_read_from_8(descr + XDES_ID); - seg_id = mach_read_from_8(seg_inode + FSEG_ID); - - if (UNIV_UNLIKELY(descr_id != seg_id)) { - ib::error() << "InnoDB is trying to free page " << offset - << " in file '" << space->chain.start->name - << "' which does not belong to segment " - << descr_id - << " but belongs to segment " << seg_id; - return; + if (UNIV_UNLIKELY(memcmp(descr + XDES_ID, seg_inode + FSEG_ID, 8))) { + goto corrupted; } byte* p_not_full = seg_inode + FSEG_NOT_FULL_N_USED; @@ -2592,32 +2563,44 @@ fseg_free_page_low( if (xdes_is_full(descr)) { /* The fragment is full: move it to another list */ - flst_remove(iblock, static_cast(FSEG_FULL + ioffset), - xdes, xoffset, mtr); - flst_add_last(iblock, static_cast(FSEG_NOT_FULL - + ioffset), - xdes, xoffset, mtr); + err = flst_remove(iblock, + static_cast(FSEG_FULL + ioffset), + xdes, xoffset, mtr); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + return err; + } + err = flst_add_last(iblock, static_cast(FSEG_NOT_FULL + + ioffset), + xdes, xoffset, mtr); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + return err; + } not_full_n_used += extent_size - 1; } else { - ut_a(not_full_n_used > 0); + if (!not_full_n_used) { + goto corrupted; + } not_full_n_used--; } mtr->write<4>(*iblock, p_not_full, not_full_n_used); - - const ulint bit = offset & (extent_size - 1); - - xdes_set_free(*xdes, descr, bit, mtr); + xdes_set_free(*xdes, descr, offset & (extent_size - 1), mtr); if (!xdes_get_n_used(descr)) { - /* The extent has become free: free it to space */ - flst_remove(iblock, static_cast(FSEG_NOT_FULL - + ioffset), - xdes, xoffset, mtr); - fsp_free_extent(space, offset, mtr); + err = flst_remove(iblock, static_cast(FSEG_NOT_FULL + + ioffset), + xdes, xoffset, mtr); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + return err; + } + err = fsp_free_extent(space, offset, mtr); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + return err; + } } mtr->free(*space, static_cast(offset)); + return DB_SUCCESS; } /** Free a page in a file segment. @@ -2625,11 +2608,11 @@ fseg_free_page_low( @param[in,out] space tablespace @param[in] offset page number @param[in,out] mtr mini-transaction -@param[in] have_latch whether space->x_lock() was already called */ -void fseg_free_page(fseg_header_t *seg_header, fil_space_t *space, - uint32_t offset, mtr_t *mtr, bool have_latch) +@param[in] have_latch whether space->x_lock() was already called +@return error code */ +dberr_t fseg_free_page(fseg_header_t *seg_header, fil_space_t *space, + uint32_t offset, mtr_t *mtr, bool have_latch) { - DBUG_ENTER("fseg_free_page"); buf_block_t *iblock; if (have_latch) ut_ad(space->is_owner()); @@ -2639,56 +2622,70 @@ void fseg_free_page(fseg_header_t *seg_header, fil_space_t *space, DBUG_PRINT("fseg_free_page", ("space_id: " ULINTPF ", page_no: %u", space->id, offset)); + dberr_t err; if (fseg_inode_t *seg_inode= fseg_inode_try_get(seg_header, space->id, space->zip_size(), - mtr, &iblock)) + mtr, &iblock, &err)) { if (!space->full_crc32()) fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr); - fseg_free_page_low(seg_inode, iblock, space, offset, mtr); + return fseg_free_page_low(seg_inode, iblock, space, offset, mtr); } - DBUG_VOID_RETURN; + return err; } -/** Determine whether a page is free. -@param[in,out] space tablespace -@param[in] page page number -@return whether the page is marked as free */ -bool -fseg_page_is_free(fil_space_t* space, unsigned page) +/** Determine whether a page is allocated. +@param space tablespace +@param page page number +@return error code +@retval DB_SUCCESS if the page is marked as free +@retval DB_SUCCESS_LOCKED_REC if the page is marked as allocated */ +dberr_t fseg_page_is_allocated(fil_space_t *space, unsigned page) { - bool is_free; - mtr_t mtr; - page_no_t dpage = xdes_calc_descriptor_page(space->zip_size(), - page); - - mtr.start(); - if (!space->is_owner()) { - mtr.s_lock_space(space); - } - - if (page >= space->free_limit || page >= space->size_in_header) { - is_free = true; - } else if (const xdes_t* descr = xdes_get_descriptor_const( - space, dpage, page, &mtr)) { - is_free = xdes_is_free(descr, page % FSP_EXTENT_SIZE); - } else { - is_free = true; - } - mtr.commit(); + mtr_t mtr; + uint32_t dpage= xdes_calc_descriptor_page(space->zip_size(), page); + const unsigned zip_size= space->zip_size(); + dberr_t err= DB_SUCCESS; + + mtr.start(); + if (!space->is_owner()) + mtr.x_lock_space(space); + + if (page >= space->free_limit || page >= space->size_in_header); + else if (const buf_block_t *b= + buf_page_get_gen(page_id_t(space->id, dpage), space->zip_size(), + RW_S_LATCH, nullptr, BUF_GET_POSSIBLY_FREED, + &mtr, &err)) + { + if (!dpage && + (space->free_limit != + mach_read_from_4(FSP_FREE_LIMIT + FSP_HEADER_OFFSET + + b->page.frame) || + space->size_in_header != + mach_read_from_4(FSP_SIZE + FSP_HEADER_OFFSET + b->page.frame))) + err= DB_CORRUPTION; + else + err= xdes_is_free(b->page.frame + XDES_ARR_OFFSET + XDES_SIZE + * xdes_calc_descriptor_index(zip_size, page), + page & (FSP_EXTENT_SIZE - 1)) + ? DB_SUCCESS + : DB_SUCCESS_LOCKED_REC; + } - return(is_free); + mtr.commit(); + return err; } +MY_ATTRIBUTE((nonnull, warn_unused_result)) /** Free an extent of a segment to the space free list. @param[in,out] seg_inode segment inode @param[in,out] space tablespace @param[in] page page number in the extent -@param[in,out] mtr mini-transaction */ -MY_ATTRIBUTE((nonnull)) +@param[in,out] mtr mini-transaction +@return error code */ static -void +dberr_t fseg_free_extent( fseg_inode_t* seg_inode, buf_block_t* iblock, @@ -2701,17 +2698,19 @@ fseg_free_extent( ) { buf_block_t* xdes; - xdes_t* descr = xdes_get_descriptor(space, page, mtr, &xdes); + dberr_t err; + xdes_t* descr = xdes_get_descriptor(space, page, mtr, &err, &xdes); if (!descr) { - ut_ad(space->is_stopping()); - return; + return err; } - ut_a(xdes_get_state(descr) == XDES_FSEG); - ut_a(!memcmp(descr + XDES_ID, seg_inode + FSEG_ID, 8)); - ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N) - == FSEG_MAGIC_N_VALUE); + if (UNIV_UNLIKELY(xdes_get_state(descr) != XDES_FSEG + || memcmp(descr + XDES_ID, seg_inode + FSEG_ID, 8) + || memcmp(FSEG_MAGIC_N_BYTES, FSEG_MAGIC_N + + seg_inode, 4))) { + return DB_CORRUPTION; + } ut_d(space->modify_check(*mtr)); const uint32_t first_page_in_extent = page - (page % FSP_EXTENT_SIZE); @@ -2734,31 +2733,47 @@ fseg_free_extent( } #endif /* BTR_CUR_HASH_ADAPT */ + uint16_t lst; + if (xdes_is_full(descr)) { - flst_remove(iblock, static_cast(FSEG_FULL + ioffset), - xdes, xoffset, mtr); + lst = static_cast(FSEG_FULL + ioffset); +remove: + err = flst_remove(iblock, lst, xdes, xoffset, mtr); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + return err; + } } else if (!xdes_get_n_used(descr)) { - flst_remove(iblock, static_cast(FSEG_FREE + ioffset), - xdes, xoffset, mtr); + lst = static_cast(FSEG_FREE + ioffset); + goto remove; } else { - flst_remove(iblock, static_cast(FSEG_NOT_FULL - + ioffset), - xdes, xoffset, mtr); + err = flst_remove( + iblock, static_cast(FSEG_NOT_FULL + ioffset), + xdes, xoffset, mtr); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + return err; + } uint32_t not_full_n_used = mach_read_from_4( FSEG_NOT_FULL_N_USED + seg_inode); uint32_t descr_n_used = xdes_get_n_used(descr); - ut_a(not_full_n_used >= descr_n_used); + if (not_full_n_used < descr_n_used) { + return DB_CORRUPTION; + } mtr->write<4>(*iblock, seg_inode + FSEG_NOT_FULL_N_USED, not_full_n_used - descr_n_used); } - fsp_free_extent(space, page, mtr); + err = fsp_free_extent(space, page, mtr); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + return err; + } for (uint32_t i = 0; i < FSP_EXTENT_SIZE; i++) { if (!xdes_is_free(descr, i)) { buf_page_free(space, first_page_in_extent + i, mtr); } } + + return DB_SUCCESS; } /** Frees part of a segment. This function can be used to free @@ -2783,8 +2798,6 @@ fseg_free_step( ulint n; fseg_inode_t* inode; - DBUG_ENTER("fseg_free_step"); - const uint32_t space_id = page_get_space_id(page_align(header)); const uint32_t header_page = page_get_page_no(page_align(header)); @@ -2792,45 +2805,44 @@ fseg_free_step( xdes_t* descr = xdes_get_descriptor(space, header_page, mtr); if (!descr) { - ut_ad(space->is_stopping()); - DBUG_RETURN(true); + return true; } /* Check that the header resides on a page which has not been freed yet */ - ut_a(!xdes_is_free(descr, header_page % FSP_EXTENT_SIZE)); + if (UNIV_UNLIKELY(xdes_is_free(descr, + header_page & (FSP_EXTENT_SIZE - 1)))) { + /* Some corruption was detected: stop the freeing + in order to prevent a crash. */ + return true; + } buf_block_t* iblock; const ulint zip_size = space->zip_size(); inode = fseg_inode_try_get(header, space_id, zip_size, mtr, &iblock); - if (space->is_stopping()) { - DBUG_RETURN(true); - } - - if (inode == NULL) { - ib::warn() << "Double free of inode from " - << page_id_t(space_id, header_page); - DBUG_RETURN(true); + if (!inode || space->is_stopping()) { + return true; } if (!space->full_crc32()) { fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr); } - descr = fseg_get_first_extent(inode, space, mtr); - if (space->is_stopping()) { - DBUG_RETURN(true); - } + dberr_t err; + descr = fseg_get_first_extent(inode, space, mtr, &err); - if (descr != NULL) { + if (descr) { /* Free the extent held by the segment */ - fseg_free_extent(inode, iblock, space, xdes_get_offset(descr), - mtr + return fseg_free_extent(inode, iblock, space, + xdes_get_offset(descr), mtr #ifdef BTR_CUR_HASH_ADAPT - , ahi + , ahi #endif /* BTR_CUR_HASH_ADAPT */ - ); - DBUG_RETURN(false); + ) != DB_SUCCESS; + } + + if (err != DB_SUCCESS || space->is_stopping()) { + return true; } /* Free a frag page */ @@ -2839,17 +2851,18 @@ fseg_free_step( if (n == ULINT_UNDEFINED) { /* Freeing completed: free the segment inode */ fsp_free_seg_inode(space, inode, iblock, mtr); - - DBUG_RETURN(true); + return true; } page_no_t page_no = fseg_get_nth_frag_page_no(inode, n); - fseg_free_page_low(inode, iblock, space, page_no, mtr + if (fseg_free_page_low(inode, iblock, space, page_no, mtr #ifdef BTR_CUR_HASH_ADAPT - , ahi + , ahi #endif /* BTR_CUR_HASH_ADAPT */ - ); + ) != DB_SUCCESS) { + return true; + } buf_page_free(space, page_no, mtr); @@ -2859,10 +2872,10 @@ fseg_free_step( /* Freeing completed: free the segment inode */ fsp_free_seg_inode(space, inode, iblock, mtr); - DBUG_RETURN(true); + return true; } - DBUG_RETURN(false); + return false; } bool @@ -2899,22 +2912,27 @@ fseg_free_step_not_header( fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr); } - if (xdes_t* descr = fseg_get_first_extent(inode, space, mtr)) { + dberr_t err; + if (xdes_t* descr = fseg_get_first_extent(inode, space, mtr, &err)) { /* Free the extent held by the segment */ - fseg_free_extent(inode, iblock, space, xdes_get_offset(descr), - mtr + return fseg_free_extent(inode, iblock, space, + xdes_get_offset(descr), + mtr #ifdef BTR_CUR_HASH_ADAPT - , ahi + , ahi #endif /* BTR_CUR_HASH_ADAPT */ - ); - return false; + ) != DB_SUCCESS; + } else if (err != DB_SUCCESS) { + return true; } /* Free a frag page */ ulint n = fseg_find_last_used_frag_page_slot(inode); - ut_a(n != ULINT_UNDEFINED); + if (UNIV_UNLIKELY(n == ULINT_UNDEFINED)) { + return true; + } uint32_t page_no = fseg_get_nth_frag_page_no(inode, n); @@ -2922,11 +2940,13 @@ fseg_free_step_not_header( return true; } - fseg_free_page_low(inode, iblock, space, page_no, mtr + if (fseg_free_page_low(inode, iblock, space, page_no, mtr #ifdef BTR_CUR_HASH_ADAPT - , ahi + , ahi #endif /* BTR_CUR_HASH_ADAPT */ - ); + ) != DB_SUCCESS) { + return true; + } buf_page_free(space, page_no, mtr); return false; } @@ -2937,36 +2957,43 @@ FSEG_FULL -> FSEG_NOT_FULL -> FSEG_FREE. @param[in] inode segment inode @param[in] space tablespace @param[in,out] mtr mini-transaction -@return the first extent descriptor, or NULL if none */ +@return the first extent descriptor +@retval nullptr if none, or on corruption */ MY_ATTRIBUTE((nonnull, warn_unused_result)) static xdes_t* fseg_get_first_extent( fseg_inode_t* inode, const fil_space_t* space, - mtr_t* mtr) + mtr_t* mtr, + dberr_t* err) { - fil_addr_t first; + if (UNIV_UNLIKELY(space->id != page_get_space_id(page_align(inode)) || + memcmp(inode + FSEG_MAGIC_N, FSEG_MAGIC_N_BYTES, 4))) + { + corrupted: + *err= DB_CORRUPTION; + return nullptr; + } - ut_ad(space->id == page_get_space_id(page_align(inode))); - ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE); + fil_addr_t first; - if (flst_get_len(inode + FSEG_FULL) > 0) { - first = flst_get_first(inode + FSEG_FULL); - } else if (flst_get_len(inode + FSEG_NOT_FULL) > 0) { - first = flst_get_first(inode + FSEG_NOT_FULL); - } else if (flst_get_len(inode + FSEG_FREE) > 0) { - first = flst_get_first(inode + FSEG_FREE); - } else { - return nullptr; - } + if (flst_get_len(inode + FSEG_FULL)) + first= flst_get_first(inode + FSEG_FULL); + else if (flst_get_len(inode + FSEG_NOT_FULL)) + first= flst_get_first(inode + FSEG_NOT_FULL); + else if (flst_get_len(inode + FSEG_FREE)) + first= flst_get_first(inode + FSEG_FREE); + else + { + *err= DB_SUCCESS; + return nullptr; + } - if (first.page == FIL_NULL) { - ut_ad("corruption" == 0); - return nullptr; - } + if (first.page == FIL_NULL) + goto corrupted; - return xdes_lst_get_descriptor(*space, first, mtr); + return xdes_lst_get_descriptor(*space, first, mtr, nullptr, err); } #ifdef UNIV_BTR_PRINT @@ -3006,7 +3033,7 @@ static void fseg_print_low(const fseg_inode_t *inode) << " free extents " << n_free << ";" << " not full extents " << n_not_full << ": pages " << n_used; - ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE); + ut_ad(!memcmp(FSEG_MAGIC_N_BYTES, FSEG_MAGIC_N + inode, 4)); } /*******************************************************************//** @@ -3017,15 +3044,12 @@ fseg_print( fseg_header_t* header, /*!< in: segment header */ mtr_t* mtr) /*!< in/out: mini-transaction */ { - fseg_inode_t* inode; - ulint space_id; - - space_id = page_get_space_id(page_align(header)); - const fil_space_t* space = mtr_x_lock_space(space_id, mtr); - - inode = fseg_inode_get(header, space_id, space->zip_size(), mtr); - - fseg_print_low(inode); + const fil_space_t *space= + mtr->x_lock_space(page_get_space_id(page_align(header))); + buf_block_t *block; + if (fseg_inode_t *inode= + fseg_inode_try_get(header, space->id, space->zip_size(), mtr, &block)) + fseg_print_low(inode); } #endif /* UNIV_BTR_PRINT */ diff --git a/storage/innobase/fsp/fsp0space.cc b/storage/innobase/fsp/fsp0space.cc index 6bdf9fcc4d81a..c2152b0859088 100644 --- a/storage/innobase/fsp/fsp0space.cc +++ b/storage/innobase/fsp/fsp0space.cc @@ -88,25 +88,25 @@ Tablespace::open_or_create(bool is_temp) ut_ad(!m_files.empty()); for (iterator it = begin(); it != end(); ++it) { - if (it->m_exists) { err = it->open_or_create( m_ignore_read_only ? false : srv_read_only_mode); + if (err != DB_SUCCESS) { + return err; + } } else { err = it->open_or_create( m_ignore_read_only ? false : srv_read_only_mode); - /* Set the correct open flags now that we have - successfully created the file. */ - if (err == DB_SUCCESS) { - file_found(*it); + if (err != DB_SUCCESS) { + return err; } - } - if (err != DB_SUCCESS) { - break; + /* Set the correct open flags now that we have + successfully created the file. */ + file_found(*it); } /* We can close the handle now and open the tablespace @@ -130,20 +130,22 @@ Tablespace::open_or_create(bool is_temp) fsp_flags = FSP_FLAGS_PAGE_SSIZE(); } + mysql_mutex_lock(&fil_system.mutex); space = fil_space_t::create( m_space_id, fsp_flags, is_temp ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE, NULL); if (!space) { + mysql_mutex_unlock(&fil_system.mutex); return DB_ERROR; } + } else { + mysql_mutex_lock(&fil_system.mutex); } - - ut_a(fil_validate()); - space->add(it->m_filepath, OS_FILE_CLOSED, it->m_size, false, true); + mysql_mutex_unlock(&fil_system.mutex); } return(err); diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc index 9b91b94cd4f99..9aef6f389ef4f 100644 --- a/storage/innobase/fsp/fsp0sysspace.cc +++ b/storage/innobase/fsp/fsp0sysspace.cc @@ -446,12 +446,27 @@ SysTablespace::create_file( case SRV_NOT_RAW: err = file.open_or_create( - m_ignore_read_only ? false : srv_read_only_mode); + !m_ignore_read_only && srv_read_only_mode); break; } + if (err != DB_SUCCESS) { + return err; + } - if (err == DB_SUCCESS && file.m_type != SRV_OLD_RAW) { + switch (file.m_type) { + case SRV_OLD_RAW: + break; + case SRV_NOT_RAW: +#ifndef _WIN32 + if (!space_id() && my_disable_locking + && os_file_lock(file.m_handle, file.m_filepath)) { + err = DB_ERROR; + break; + } +#endif + /* fall through */ + case SRV_NEW_RAW: err = set_size(file); } @@ -492,7 +507,7 @@ SysTablespace::open_file( case SRV_NOT_RAW: err = file.open_or_create( - m_ignore_read_only ? false : srv_read_only_mode); + !m_ignore_read_only && srv_read_only_mode); if (err != DB_SUCCESS) { return(err); @@ -507,6 +522,14 @@ SysTablespace::open_file( break; case SRV_NOT_RAW: +#ifndef _WIN32 + if (!space_id() && (m_ignore_read_only || !srv_read_only_mode) + && my_disable_locking + && os_file_lock(file.m_handle, file.m_filepath)) { + err = DB_ERROR; + break; + } +#endif /* Check file size for existing file. */ err = check_size(file); break; @@ -553,7 +576,7 @@ inline dberr_t SysTablespace::read_lsn_and_check_flags() ut_a(it->order() == 0); - if (srv_operation == SRV_OPERATION_NORMAL) { + if (srv_operation <= SRV_OPERATION_EXPORT_RESTORED) { buf_dblwr.init_or_load_pages(it->handle(), it->filepath()); } @@ -897,6 +920,7 @@ SysTablespace::open_or_create( /* Close the curent handles, add space and file info to the fil_system cache and the Data Dictionary, and re-open them in file_system cache so that they stay open until shutdown. */ + mysql_mutex_lock(&fil_system.mutex); ulint node_counter = 0; for (files_t::iterator it = begin; it != end; ++it) { it->close(); @@ -910,7 +934,8 @@ SysTablespace::open_or_create( FIL_TYPE_TEMPORARY, NULL); ut_ad(space == fil_system.temp_space); if (!space) { - return DB_ERROR; + err = DB_ERROR; + break; } ut_ad(!space->is_compressed()); ut_ad(space->full_crc32()); @@ -921,12 +946,11 @@ SysTablespace::open_or_create( FIL_TYPE_TABLESPACE, NULL); ut_ad(space == fil_system.sys_space); if (!space) { - return DB_ERROR; + err = DB_ERROR; + break; } } - ut_a(fil_validate()); - uint32_t max_size = (++node_counter == m_files.size() ? (m_last_file_size_max == 0 ? UINT32_MAX @@ -937,6 +961,7 @@ SysTablespace::open_or_create( it->m_type != SRV_NOT_RAW, true, max_size); } + mysql_mutex_unlock(&fil_system.mutex); return(err); } diff --git a/storage/innobase/fts/fts0ast.cc b/storage/innobase/fts/fts0ast.cc index bb42f7c9f54f7..74d02d6381795 100644 --- a/storage/innobase/fts/fts0ast.cc +++ b/storage/innobase/fts/fts0ast.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2020, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, MariaDB Corporation. +Copyright (c) 2018, 2022, 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 @@ -28,6 +28,7 @@ Created 2007/3/16 Sunny Bains. #include "fts0ast.h" #include "fts0pars.h" #include "fts0fts.h" +#include "trx0trx.h" /* The FTS ast visit pass. */ enum fts_ast_visit_pass_t { diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 394f481632101..8886cfa6d9fa7 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2021, Oracle and/or its affiliates. -Copyright (c) 2016, 2022, MariaDB Corporation. +Copyright (c) 2016, 2023, 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 @@ -32,7 +32,7 @@ Full Text Search interface #include "fts0fts.h" #include "fts0priv.h" #include "fts0types.h" -#include "fts0types.ic" +#include "fts0types.inl" #include "fts0vlc.h" #include "fts0plugin.h" #include "dict0stats.h" @@ -52,14 +52,14 @@ by looking up the key word in the obsolete table names */ /** This is maximum FTS cache for each table and would be a configurable variable */ -ulong fts_max_cache_size; +Atomic_relaxed fts_max_cache_size; /** Whether the total memory used for FTS cache is exhausted, and we will need a sync to free some memory */ bool fts_need_sync = false; /** Variable specifying the total memory allocated for FTS cache */ -ulong fts_max_total_cache_size; +Atomic_relaxed fts_max_total_cache_size; /** This is FTS result cache limit for each query and would be a configurable variable */ @@ -216,28 +216,13 @@ fts_update_max_cache_size( /*********************************************************************//** This function fetches the document just inserted right before we commit the transaction, and tokenize the inserted text data -and insert into FTS auxiliary table and its cache. -@return TRUE if successful */ +and insert into FTS auxiliary table and its cache. */ static -ulint +void fts_add_doc_by_id( /*==============*/ fts_trx_table_t*ftt, /*!< in: FTS trx table */ - doc_id_t doc_id, /*!< in: doc id */ - ib_vector_t* fts_indexes MY_ATTRIBUTE((unused))); - /*!< in: affected fts indexes */ -/******************************************************************//** -Update the last document id. This function could create a new -transaction to update the last document id. -@return DB_SUCCESS if OK */ -static -dberr_t -fts_update_sync_doc_id( -/*===================*/ - const dict_table_t* table, /*!< in: table */ - doc_id_t doc_id, /*!< in: last document id */ - trx_t* trx) /*!< in: update trx, or NULL */ - MY_ATTRIBUTE((nonnull(1))); + doc_id_t doc_id); /*!< in: doc id */ /** Tokenize a document. @param[in,out] doc document to tokenize @@ -393,8 +378,10 @@ fts_read_stopword( fts_string_t str; mem_heap_t* heap; ib_rbt_bound_t parent; + dict_table_t* table; sel_node = static_cast(row); + table = sel_node->table_list->table; stopword_info = static_cast(user_arg); stop_words = stopword_info->cached_stopword; @@ -409,6 +396,27 @@ fts_read_stopword( str.f_n_char = 0; str.f_str = static_cast(dfield_get_data(dfield)); str.f_len = dfield_get_len(dfield); + exp = que_node_get_next(exp); + ut_ad(exp); + + if (table->versioned()) { + dfield = que_node_get_val(exp); + ut_ad(dfield_get_type(dfield)->vers_sys_end()); + void* data = dfield_get_data(dfield); + ulint len = dfield_get_len(dfield); + if (table->versioned_by_id()) { + ut_ad(len == sizeof trx_id_max_bytes); + if (0 != memcmp(data, trx_id_max_bytes, len)) { + return true; + } + } else { + ut_ad(len == sizeof timestamp_max_bytes); + if (0 != memcmp(data, timestamp_max_bytes, len)) { + return true; + } + } + } + ut_ad(!que_node_get_next(exp)); /* Only create new node if it is a value not already existed */ if (str.f_len != UNIV_SQL_NULL @@ -452,7 +460,9 @@ fts_load_user_stopword( /* Validate the user table existence in the right format */ bool ret= false; - stopword_info->charset = fts_valid_stopword_table(stopword_table_name); + const char* row_end; + stopword_info->charset = fts_valid_stopword_table(stopword_table_name, + &row_end); if (!stopword_info->charset) { cleanup: if (!fts->dict_locked) { @@ -477,6 +487,7 @@ fts_load_user_stopword( pars_info_t* info = pars_info_create(); pars_info_bind_id(info, "table_stopword", stopword_table_name); + pars_info_bind_id(info, "row_end", row_end); pars_info_bind_function(info, "my_func", fts_read_stopword, stopword_info); @@ -486,7 +497,7 @@ fts_load_user_stopword( "PROCEDURE P() IS\n" "DECLARE FUNCTION my_func;\n" "DECLARE CURSOR c IS" - " SELECT value" + " SELECT value, $row_end" " FROM $table_stopword;\n" "BEGIN\n" "\n" @@ -809,7 +820,8 @@ void fts_clear_all(dict_table_t *table) fts_optimize_remove_table(table); - fts_free(table); + table->fts->~fts_t(); + table->fts= nullptr; DICT_TF2_FLAG_UNSET(table, DICT_TF2_FTS); } @@ -1394,6 +1406,13 @@ static dberr_t fts_drop_table(trx_t *trx, const char *table_name, bool rename) return err; } +#ifdef UNIV_DEBUG + for (auto &p : trx->mod_tables) + { + if (p.first == table) + p.second.set_aux_table(); + } +#endif /* UNIV_DEBUG */ return DB_SUCCESS; } @@ -1569,22 +1588,31 @@ have any other reference count. static void fts_table_no_ref_count(const char *table_name) { dict_table_t *table= dict_table_open_on_name( - table_name, false, DICT_ERR_IGNORE_TABLESPACE); + table_name, true, DICT_ERR_IGNORE_TABLESPACE); if (!table) return; while (table->get_ref_count() > 1) + { + dict_sys.unlock(); std::this_thread::sleep_for(std::chrono::milliseconds(50)); + dict_sys.lock(SRW_LOCK_CALL); + } table->release(); } /** Stop the purge thread and check n_ref_count of all auxiliary and common table associated with the fts table. -@param table parent FTS table */ -void purge_sys_t::stop_FTS(const dict_table_t &table) +@param table parent FTS table +@param already_stopped True indicates purge threads were + already stopped*/ +void purge_sys_t::stop_FTS(const dict_table_t &table, bool already_stopped) { - purge_sys.stop_FTS(); + dict_sys.lock(SRW_LOCK_CALL); + if (!already_stopped) + purge_sys.stop_FTS(); + fts_table_t fts_table; char table_name[MAX_FULL_NAME_LEN]; @@ -1593,28 +1621,31 @@ void purge_sys_t::stop_FTS(const dict_table_t &table) for (const char **suffix= fts_common_tables; *suffix; suffix++) { fts_table.suffix= *suffix; - fts_get_table_name(&fts_table, table_name, false); + fts_get_table_name(&fts_table, table_name, true); fts_table_no_ref_count(table_name); } - if (!table.fts) - return; - auto indexes= table.fts->indexes; - if (!indexes) - return; - for (ulint i= 0;i < ib_vector_size(indexes); ++i) + if (table.fts) { - const dict_index_t *index= static_cast( - ib_vector_getp(indexes, i)); - FTS_INIT_INDEX_TABLE(&fts_table, nullptr, FTS_INDEX_TABLE, index); - for (const fts_index_selector_t *s= fts_index_selector; - s->suffix; s++) + if (auto indexes= table.fts->indexes) { - fts_table.suffix= s->suffix; - fts_get_table_name(&fts_table, table_name, false); - fts_table_no_ref_count(table_name); + for (ulint i= 0;i < ib_vector_size(indexes); ++i) + { + const dict_index_t *index= static_cast( + ib_vector_getp(indexes, i)); + FTS_INIT_INDEX_TABLE(&fts_table, nullptr, FTS_INDEX_TABLE, index); + for (const fts_index_selector_t *s= fts_index_selector; + s->suffix; s++) + { + fts_table.suffix= s->suffix; + fts_get_table_name(&fts_table, table_name, true); + fts_table_no_ref_count(table_name); + } + } } } + + dict_sys.unlock(); } /** Lock the internal FTS_ tables for table, before fts_drop_tables(). @@ -1650,24 +1681,26 @@ on the given table. static dberr_t fts_drop_common_tables(trx_t *trx, fts_table_t *fts_table, bool rename) { - dberr_t error = DB_SUCCESS; - - for (ulint i = 0; fts_common_tables[i] != NULL; ++i) { - dberr_t err; - char table_name[MAX_FULL_NAME_LEN]; + dberr_t error= DB_SUCCESS; - fts_table->suffix = fts_common_tables[i]; - fts_get_table_name(fts_table, table_name, true); + for (ulint i= 0; fts_common_tables[i]; ++i) + { + char table_name[MAX_FULL_NAME_LEN]; - err = fts_drop_table(trx, table_name, rename); + fts_table->suffix= fts_common_tables[i]; + fts_get_table_name(fts_table, table_name, true); - /* We only return the status of the last error. */ - if (err != DB_SUCCESS && err != DB_FAIL) { - error = err; - } - } + if (dberr_t err= fts_drop_table(trx, table_name, rename)) + { + if (trx->state != TRX_STATE_ACTIVE) + return err; + /* We only return the status of the last error. */ + if (err != DB_FAIL) + error= err; + } + } - return(error); + return error; } /****************************************************************//** @@ -1920,9 +1953,16 @@ fts_create_common_tables( goto func_exit; } - index = dict_mem_index_create(table, FTS_DOC_ID_INDEX_NAME, - DICT_UNIQUE, 1); - dict_mem_index_add_field(index, FTS_DOC_ID_COL_NAME, 0); + if (table->versioned()) { + index = dict_mem_index_create(table, FTS_DOC_ID_INDEX_NAME, + DICT_UNIQUE, 2); + dict_mem_index_add_field(index, FTS_DOC_ID_COL_NAME, 0); + dict_mem_index_add_field(index, table->cols[table->vers_end].name(*table), 0); + } else { + index = dict_mem_index_create(table, FTS_DOC_ID_INDEX_NAME, + DICT_UNIQUE, 1); + dict_mem_index_add_field(index, FTS_DOC_ID_COL_NAME, 0); + } error = row_create_index_for_mysql(index, trx, NULL, FIL_ENCRYPTION_DEFAULT, @@ -2230,9 +2270,7 @@ fts_trx_table_create( fts_trx_table_t* ftt; ftt = static_cast( - mem_heap_alloc(fts_trx->heap, sizeof(*ftt))); - - memset(ftt, 0x0, sizeof(*ftt)); + mem_heap_zalloc(fts_trx->heap, sizeof *ftt)); ftt->table = table; ftt->fts_trx = fts_trx; @@ -2485,27 +2523,6 @@ fts_get_max_cache_size( } #endif -/*********************************************************************//** -Update the next and last Doc ID in the CONFIG table to be the input -"doc_id" value (+ 1). We would do so after each FTS index build or -table truncate */ -void -fts_update_next_doc_id( -/*===================*/ - trx_t* trx, /*!< in/out: transaction */ - const dict_table_t* table, /*!< in: table */ - doc_id_t doc_id) /*!< in: DOC ID to set */ -{ - table->fts->cache->synced_doc_id = doc_id; - table->fts->cache->next_doc_id = doc_id + 1; - - table->fts->cache->first_doc_id = table->fts->cache->next_doc_id; - - fts_update_sync_doc_id( - table, table->fts->cache->synced_doc_id, trx); - -} - /*********************************************************************//** Get the next available document id. @return DB_SUCCESS if OK */ @@ -2565,7 +2582,6 @@ fts_cmp_set_sync_doc_id( que_t* graph = NULL; fts_cache_t* cache = table->fts->cache; char table_name[MAX_FULL_NAME_LEN]; -retry: ut_a(table->fts->doc_col != ULINT_UNDEFINED); fts_table.suffix = "CONFIG"; @@ -2573,7 +2589,8 @@ fts_cmp_set_sync_doc_id( fts_table.type = FTS_COMMON_TABLE; fts_table.table = table; - trx = trx_create(); + trx= trx_create(); +retry: trx_start_internal(trx); trx->op_info = "update the next FTS document id"; @@ -2635,7 +2652,7 @@ fts_cmp_set_sync_doc_id( } mysql_mutex_unlock(&cache->doc_id_lock); - if (cmp_doc_id > *doc_id) { + if (cmp_doc_id && cmp_doc_id >= *doc_id) { error = fts_update_sync_doc_id( table, cache->synced_doc_id, trx); } @@ -2653,7 +2670,8 @@ fts_cmp_set_sync_doc_id( "for table " << table->name; fts_sql_rollback(trx); - if (error == DB_DEADLOCK) { + if (error == DB_DEADLOCK || error == DB_LOCK_WAIT_TIMEOUT) { + DEBUG_SYNC_C("fts_cmp_set_sync_doc_id_retry"); std::this_thread::sleep_for(FTS_DEADLOCK_RETRY_WAIT); goto retry; } @@ -2664,17 +2682,17 @@ fts_cmp_set_sync_doc_id( return(error); } -/*********************************************************************//** -Update the last document id. This function could create a new +/** Update the last document id. This function could create a new transaction to update the last document id. -@return DB_SUCCESS if OK */ -static +@param table table to be updated +@param doc_id last document id +@param trx update trx or null +@retval DB_SUCCESS if OK */ dberr_t fts_update_sync_doc_id( -/*===================*/ - const dict_table_t* table, /*!< in: table */ - doc_id_t doc_id, /*!< in: last document id */ - trx_t* trx) /*!< in: update trx, or NULL */ + const dict_table_t* table, + doc_id_t doc_id, + trx_t* trx) { byte id[FTS_MAX_ID_LEN]; pars_info_t* info; @@ -2775,7 +2793,7 @@ fts_add( ut_a(row->state == FTS_INSERT || row->state == FTS_MODIFY); - fts_add_doc_by_id(ftt, doc_id, row->fts_indexes); + fts_add_doc_by_id(ftt, doc_id); mysql_mutex_lock(&table->fts->cache->deleted_lock); ++table->fts->cache->added; @@ -3324,16 +3342,13 @@ fts_add_doc_from_tuple( /*********************************************************************//** This function fetches the document inserted during the committing transaction, and tokenize the inserted text data and insert into -FTS auxiliary table and its cache. -@return TRUE if successful */ +FTS auxiliary table and its cache. */ static -ulint +void fts_add_doc_by_id( /*==============*/ fts_trx_table_t*ftt, /*!< in: FTS trx table */ - doc_id_t doc_id, /*!< in: doc id */ - ib_vector_t* fts_indexes MY_ATTRIBUTE((unused))) - /*!< in: affected fts indexes */ + doc_id_t doc_id) /*!< in: doc id */ { mtr_t mtr; mem_heap_t* heap; @@ -3373,24 +3388,39 @@ fts_add_doc_by_id( is_id_cluster = (clust_index == fts_id_index); mtr_start(&mtr); - btr_pcur_init(&pcur); /* Search based on Doc ID. Here, we'll need to consider the case when there is no primary index on Doc ID */ - tuple = dtuple_create(heap, 1); + const ulint n_uniq = table->fts_n_uniq(); + tuple = dtuple_create(heap, n_uniq); dfield = dtuple_get_nth_field(tuple, 0); dfield->type.mtype = DATA_INT; dfield->type.prtype = DATA_NOT_NULL | DATA_UNSIGNED | DATA_BINARY_TYPE; mach_write_to_8((byte*) &temp_doc_id, doc_id); dfield_set_data(dfield, &temp_doc_id, sizeof(temp_doc_id)); - - btr_pcur_open_with_no_init( - fts_id_index, tuple, PAGE_CUR_LE, BTR_SEARCH_LEAF, - &pcur, 0, &mtr); + pcur.btr_cur.page_cur.index = fts_id_index; + + if (n_uniq == 2) { + ut_ad(table->versioned()); + ut_ad(fts_id_index->fields[1].col->vers_sys_end()); + dfield = dtuple_get_nth_field(tuple, 1); + dfield->type.mtype = fts_id_index->fields[1].col->mtype; + dfield->type.prtype = fts_id_index->fields[1].col->prtype; + if (table->versioned_by_id()) { + dfield_set_data(dfield, trx_id_max_bytes, + sizeof(trx_id_max_bytes)); + } else { + dfield_set_data(dfield, timestamp_max_bytes, + sizeof(timestamp_max_bytes)); + } + } /* If we have a match, add the data to doc structure */ - if (btr_pcur_get_low_match(&pcur) == 1) { + if (btr_pcur_open_with_no_init(tuple, PAGE_CUR_LE, + BTR_SEARCH_LEAF, &pcur, &mtr) + == DB_SUCCESS + && btr_pcur_get_low_match(&pcur) == n_uniq) { const rec_t* rec; btr_pcur_t* doc_pcur; const rec_t* clust_rec; @@ -3414,7 +3444,6 @@ fts_add_doc_by_id( dtuple_t* clust_ref; ulint n_fields; - btr_pcur_init(&clust_pcur); n_fields = dict_index_get_n_unique(clust_index); clust_ref = dtuple_create(heap, n_fields); @@ -3422,14 +3451,18 @@ fts_add_doc_by_id( row_build_row_ref_in_tuple( clust_ref, rec, fts_id_index, NULL); - - btr_pcur_open_with_no_init( - clust_index, clust_ref, PAGE_CUR_LE, - BTR_SEARCH_LEAF, &clust_pcur, 0, &mtr); + clust_pcur.btr_cur.page_cur.index = clust_index; + + if (btr_pcur_open_with_no_init(clust_ref, + PAGE_CUR_LE, + BTR_SEARCH_LEAF, + &clust_pcur, &mtr) + != DB_SUCCESS) { + goto func_exit; + } doc_pcur = &clust_pcur; clust_rec = btr_pcur_get_rec(&clust_pcur); - } offsets = rec_get_offsets(clust_rec, clust_index, NULL, @@ -3452,7 +3485,6 @@ fts_add_doc_by_id( get_doc, clust_index, doc_pcur, offsets, &doc); if (doc.found) { - ibool success MY_ATTRIBUTE((unused)); btr_pcur_store_position(doc_pcur, &mtr); mtr_commit(&mtr); @@ -3511,12 +3543,12 @@ fts_add_doc_by_id( mtr_start(&mtr); if (i < num_idx - 1) { - - success = btr_pcur_restore_position( - BTR_SEARCH_LEAF, doc_pcur, - &mtr); - - ut_ad(success); + if (doc_pcur->restore_position( + BTR_SEARCH_LEAF, &mtr) + != btr_pcur_t::SAME_ALL) { + ut_ad("invalid state" == 0); + i = num_idx - 1; + } } } @@ -3524,16 +3556,15 @@ fts_add_doc_by_id( } if (!is_id_cluster) { - btr_pcur_close(doc_pcur); + ut_free(doc_pcur->old_rec_buf); } } func_exit: mtr_commit(&mtr); - btr_pcur_close(&pcur); + ut_free(pcur.old_rec_buf); mem_heap_free(heap); - return(TRUE); } @@ -3586,21 +3617,40 @@ fts_get_max_doc_id( ut_ad(innobase_strcasecmp(FTS_DOC_ID_COL_NAME, dfield->name) == 0); #endif - mtr_start(&mtr); + mtr.start(); /* fetch the largest indexes value */ - btr_pcur_open_at_index_side( - false, index, BTR_SEARCH_LEAF, &pcur, true, 0, &mtr); - - if (!page_is_empty(btr_pcur_get_page(&pcur))) { + if (pcur.open_leaf(false, index, BTR_SEARCH_LEAF, &mtr) == DB_SUCCESS + && !page_is_empty(btr_pcur_get_page(&pcur))) { const rec_t* rec = NULL; + constexpr ulint doc_id_len= 8; do { rec = btr_pcur_get_rec(&pcur); - if (page_rec_is_user_rec(rec)) { + if (!page_rec_is_user_rec(rec)) { + continue; + } + + if (index->n_uniq == 1) { break; } + + ut_ad(table->versioned()); + ut_ad(index->n_uniq == 2); + + const byte *data = rec + doc_id_len; + if (table->versioned_by_id()) { + if (0 == memcmp(data, trx_id_max_bytes, + sizeof trx_id_max_bytes)) { + break; + } + } else { + if (0 == memcmp(data, timestamp_max_bytes, + sizeof timestamp_max_bytes)) { + break; + } + } } while (btr_pcur_move_to_prev(&pcur, &mtr)); if (!rec || rec_is_metadata(rec, *index)) { @@ -3611,8 +3661,7 @@ fts_get_max_doc_id( } func_exit: - btr_pcur_close(&pcur); - mtr_commit(&mtr); + mtr.commit(); return(doc_id); } @@ -4226,11 +4275,17 @@ fts_sync( fts_sync_begin(sync); begin_sync: - if (cache->total_size > fts_max_cache_size) { + const size_t fts_cache_size= fts_max_cache_size; + if (cache->total_size > fts_cache_size) { /* Avoid the case: sync never finish when insert/update keeps comming. */ ut_ad(sync->unlock_cache); sync->unlock_cache = false; + ib::warn() << "Total InnoDB FTS size " + << cache->total_size << " for the table " + << cache->sync->table->name + << " exceeds the innodb_ft_cache_size " + << fts_cache_size; } for (i = 0; i < ib_vector_size(cache->indexes); ++i) { @@ -4251,6 +4306,13 @@ fts_sync( if (error != DB_SUCCESS) { goto end_sync; } + + if (!sync->unlock_cache + && cache->total_size < fts_max_cache_size) { + /* Reset the unlock cache if the value + is less than innodb_ft_cache_size */ + sync->unlock_cache = true; + } } DBUG_EXECUTE_IF("fts_instrument_sync_interrupted", @@ -4309,16 +4371,11 @@ FTS auxiliary INDEX table and clear the cache at the end. @return DB_SUCCESS on success, error code on failure. */ dberr_t fts_sync_table(dict_table_t* table, bool wait) { - dberr_t err = DB_SUCCESS; - - ut_ad(table->fts); + ut_ad(table->fts); - if (table->space && table->fts->cache - && !dict_table_is_corrupted(table)) { - err = fts_sync(table->fts->cache->sync, !wait, wait); - } - - return(err); + return table->space && !table->corrupted && table->fts->cache + ? fts_sync(table->fts->cache->sync, !wait, wait) + : DB_SUCCESS; } /** Check if a fts token is a stopword or less than fts_min_token_size @@ -4570,7 +4627,7 @@ fts_tokenize_add_word_for_parser( ut_ad(boolean_info->position >= 0); position = boolean_info->position + fts_param->add_pos; */ - position = fts_param->add_pos; + position = fts_param->add_pos++; fts_add_token(result_doc, str, position); @@ -5245,14 +5302,14 @@ fts_t::~fts_t() { ut_ad(add_wq == NULL); - if (cache != NULL) { + if (cache) { fts_cache_clear(cache); fts_cache_destroy(cache); - cache = NULL; } /* There is no need to call ib_vector_free() on this->indexes because it is stored in this->fts_heap. */ + mem_heap_free(fts_heap); } /*********************************************************************//** @@ -5275,22 +5332,6 @@ fts_create( return(fts); } -/*********************************************************************//** -Free the FTS resources. */ -void -fts_free( -/*=====*/ - dict_table_t* table) /*!< in/out: table with FTS indexes */ -{ - fts_t* fts = table->fts; - - fts->~fts_t(); - - mem_heap_free(fts->fts_heap); - - table->fts = NULL; -} - /*********************************************************************//** Take a FTS savepoint. */ UNIV_INLINE @@ -5695,12 +5736,16 @@ bool fts_check_aux_table(const char *name, /**********************************************************************//** Check whether user supplied stopword table is of the right format. Caller is responsible to hold dictionary locks. -@return the stopword column charset if qualifies */ +@param stopword_table_name table name +@param row_end name of the system-versioning end column, or "value" +@return the stopword column charset +@retval NULL if the table does not exist or qualify */ CHARSET_INFO* fts_valid_stopword_table( /*=====================*/ - const char* stopword_table_name) /*!< in: Stopword table + const char* stopword_table_name, /*!< in: Stopword table name */ + const char** row_end) /* row_end value of system-versioned table */ { dict_table_t* table; dict_col_t* col = NULL; @@ -5739,6 +5784,13 @@ fts_valid_stopword_table( } ut_ad(col); + ut_ad(!table->versioned() || col->ind != table->vers_end); + + if (row_end) { + *row_end = table->versioned() + ? dict_table_get_col_name(table, table->vers_end) + : "value"; /* for fts_load_user_stopword() */ + } return(fts_get_charset(col->prtype)); } @@ -5874,18 +5926,20 @@ fts_load_stopword( /**********************************************************************//** Callback function when we initialize the FTS at the start up time. It recovers the maximum Doc IDs presented in the current table. +Tested by innodb_fts.crash_recovery @return: always returns TRUE */ static ibool fts_init_get_doc_id( /*================*/ void* row, /*!< in: sel_node_t* */ - void* user_arg) /*!< in: fts cache */ + void* user_arg) /*!< in: table with fts */ { doc_id_t doc_id = FTS_NULL_DOC_ID; sel_node_t* node = static_cast(row); que_node_t* exp = node->select_list; - fts_cache_t* cache = static_cast(user_arg); + dict_table_t* table = static_cast(user_arg); + fts_cache_t* cache = table->fts->cache; ut_ad(ib_vector_is_empty(cache->get_docs)); @@ -5900,6 +5954,29 @@ fts_init_get_doc_id( doc_id = static_cast(mach_read_from_8( static_cast(data))); + exp = que_node_get_next(que_node_get_next(exp)); + if (exp) { + ut_ad(table->versioned()); + dfield = que_node_get_val(exp); + type = dfield_get_type(dfield); + ut_ad(type->vers_sys_end()); + data = dfield_get_data(dfield); + ulint len = dfield_get_len(dfield); + if (table->versioned_by_id()) { + ut_ad(len == sizeof trx_id_max_bytes); + if (0 != memcmp(data, trx_id_max_bytes, len)) { + return true; + } + } else { + ut_ad(len == sizeof timestamp_max_bytes); + if (0 != memcmp(data, timestamp_max_bytes, len)) { + return true; + } + } + ut_ad(!(exp = que_node_get_next(exp))); + } + ut_ad(!exp); + if (doc_id >= cache->next_doc_id) { cache->next_doc_id = doc_id + 1; } @@ -6062,7 +6139,7 @@ fts_init_index( fts_doc_fetch_by_doc_id(NULL, start_doc, index, FTS_FETCH_DOC_BY_ID_LARGE, - fts_init_get_doc_id, cache); + fts_init_get_doc_id, table); } else { if (table->fts->cache->stopword_info.status & STOPWORD_NOT_INIT) { diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc index adc44d74e7bbe..fe31767d90133 100644 --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2021, MariaDB Corporation. +Copyright (c) 2016, 2022, 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 @@ -37,6 +37,13 @@ Completed 2011/7/10 Sunny and Jimmy Yang #include "zlib.h" #include "fts0opt.h" #include "fts0vlc.h" +#include "wsrep.h" + +#ifdef WITH_WSREP +extern Atomic_relaxed wsrep_sst_disable_writes; +#else +constexpr bool wsrep_sst_disable_writes= false; +#endif /** The FTS optimize thread's work queue. */ ib_wqueue_t* fts_optimize_wq; @@ -2831,6 +2838,20 @@ static void fts_optimize_callback(void *) && ib_wqueue_is_empty(fts_optimize_wq) && n_tables > 0 && n_optimize > 0) { + + /* The queue is empty but we have tables + to optimize. */ + if (UNIV_UNLIKELY(wsrep_sst_disable_writes)) { +retry_later: + if (fts_is_sync_needed()) { + fts_need_sync = true; + } + if (n_tables) { + timer->set_time(5000, 0); + } + return; + } + fts_slot_t* slot = static_cast( ib_vector_get(fts_slots, current)); @@ -2845,19 +2866,13 @@ static void fts_optimize_callback(void *) n_optimize = fts_optimize_how_many(); current = 0; } - } else if (n_optimize == 0 || !ib_wqueue_is_empty(fts_optimize_wq)) { fts_msg_t* msg = static_cast (ib_wqueue_nowait(fts_optimize_wq)); /* Timeout ? */ - if (msg == NULL) { - if (fts_is_sync_needed()) { - fts_need_sync = true; - } - if (n_tables) - timer->set_time(5000, 0); - return; + if (!msg) { + goto retry_later; } switch (msg->type) { @@ -2883,6 +2898,11 @@ static void fts_optimize_callback(void *) break; case FTS_MSG_SYNC_TABLE: + if (UNIV_UNLIKELY(wsrep_sst_disable_writes)) { + add_msg(msg); + goto retry_later; + } + DBUG_EXECUTE_IF( "fts_instrument_msg_sync_sleep", std::this_thread::sleep_for( @@ -2941,7 +2961,6 @@ fts_optimize_init(void) /* Create FTS optimize work queue */ fts_optimize_wq = ib_wqueue_create(); - ut_a(fts_optimize_wq != NULL); timer = srv_thread_pool->create_timer(timer_callback); /* Create FTS vector to store fts_slot_t */ @@ -3003,7 +3022,7 @@ fts_optimize_shutdown() &fts_optimize_wq->mutex.m_mutex); } - innobase_destroy_background_thd(fts_opt_thd); + destroy_background_thd(fts_opt_thd); fts_opt_thd = NULL; pthread_cond_destroy(&fts_opt_shutdown_cond); mysql_mutex_unlock(&fts_optimize_wq->mutex); diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc index 2b9fbcfb569c1..4407224a24d7f 100644 --- a/storage/innobase/fts/fts0que.cc +++ b/storage/innobase/fts/fts0que.cc @@ -1203,6 +1203,14 @@ fts_query_difference( return(query->error); } +/* Free the query intersection +@param query query instance */ +static void fts_query_free_intersection(fts_query_t* query) +{ + fts_query_free_doc_ids(query, query->intersection); + query->intersection = NULL; +} + /*****************************************************************//** Intersect the token doc ids with the current set. @return DB_SUCCESS if all go well */ @@ -1301,6 +1309,7 @@ fts_query_intersect( /* error is passed by 'query->error' */ if (query->error != DB_SUCCESS) { ut_ad(query->error == DB_FTS_EXCEED_RESULT_CACHE_LIMIT); + fts_query_free_intersection(query); return(query->error); } @@ -1329,6 +1338,8 @@ fts_query_intersect( ut_a(!query->multi_exist || (query->multi_exist && rbt_size(query->doc_ids) <= n_doc_ids)); + } else if (query->intersection) { + fts_query_free_intersection(query); } } @@ -1547,6 +1558,10 @@ fts_merge_doc_ids( query, ranking->doc_id, ranking->rank); if (query->error != DB_SUCCESS) { + if (query->intersection) { + ut_a(query->oper == FTS_EXIST); + fts_query_free_intersection(query); + } DBUG_RETURN(query->error); } diff --git a/storage/innobase/fut/fut0lst.cc b/storage/innobase/fut/fut0lst.cc index 98f37be002a3d..a52027f28bca7 100644 --- a/storage/innobase/fut/fut0lst.cc +++ b/storage/innobase/fut/fut0lst.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2019, 2021, MariaDB Corporation. +Copyright (c) 2019, 2022, 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 @@ -38,9 +38,8 @@ Created 11/28/1995 Heikki Tuuri static void flst_write_addr(const buf_block_t& block, byte *faddr, uint32_t page, uint16_t boffset, mtr_t* mtr) { - ut_ad(mtr->memo_contains_page_flagged(faddr, - MTR_MEMO_PAGE_X_FIX - | MTR_MEMO_PAGE_SX_FIX)); + ut_ad(mtr->memo_contains_page_flagged(faddr, MTR_MEMO_PAGE_X_FIX | + MTR_MEMO_PAGE_SX_FIX)); ut_a(page == FIL_NULL || boffset >= FIL_PAGE_DATA); ut_a(ut_align_offset(faddr, srv_page_size) >= FIL_PAGE_DATA); @@ -69,7 +68,7 @@ static void flst_write_addr(const buf_block_t& block, byte *faddr, /** Write 2 null file addresses. @param[in] b file page -@param[in,out] addr file address to be zeroed out +@param[in,out] addr file address to be zeroed out @param[in,out] mtr mini-transaction */ static void flst_zero_both(const buf_block_t& b, byte *addr, mtr_t *mtr) { @@ -120,10 +119,11 @@ static void flst_add_to_empty(buf_block_t *base, uint16_t boffset, @param[in] coffset byte offset of the insert position @param[in,out] add block to be added @param[in] aoffset byte offset of the block to be added -@param[in,outr] mtr mini-transaction */ -static void flst_insert_after(buf_block_t *base, uint16_t boffset, - buf_block_t *cur, uint16_t coffset, - buf_block_t *add, uint16_t aoffset, mtr_t *mtr) +@param[in,out] mtr mini-transaction */ +static dberr_t flst_insert_after(buf_block_t *base, uint16_t boffset, + buf_block_t *cur, uint16_t coffset, + buf_block_t *add, uint16_t aoffset, + mtr_t *mtr) { ut_ad(base != cur || boffset != coffset); ut_ad(base != add || boffset != aoffset); @@ -145,23 +145,25 @@ static void flst_insert_after(buf_block_t *base, uint16_t boffset, flst_write_addr(*add, add->page.frame + aoffset + FLST_NEXT, next_addr.page, next_addr.boffset, mtr); + dberr_t err= DB_SUCCESS; + if (next_addr.page == FIL_NULL) flst_write_addr(*base, base->page.frame + boffset + FLST_LAST, add->page.id().page_no(), aoffset, mtr); - else - { - buf_block_t *block; - if (flst_node_t *next= fut_get_ptr(add->page.id().space(), add->zip_size(), - next_addr, RW_SX_LATCH, mtr, &block)) - flst_write_addr(*block, next + FLST_PREV, - add->page.id().page_no(), aoffset, mtr); - } + else if (buf_block_t *block= + buf_page_get_gen(page_id_t{add->page.id().space(), next_addr.page}, + add->zip_size(), RW_SX_LATCH, nullptr, + BUF_GET_POSSIBLY_FREED, mtr, &err)) + flst_write_addr(*block, block->page.frame + + next_addr.boffset + FLST_PREV, + add->page.id().page_no(), aoffset, mtr); flst_write_addr(*cur, cur->page.frame + coffset + FLST_NEXT, add->page.id().page_no(), aoffset, mtr); byte *len= &base->page.frame[boffset + FLST_LEN]; mtr->write<4>(*base, len, mach_read_from_4(len) + 1); + return err; } /** Insert a node before another one. @@ -171,10 +173,12 @@ static void flst_insert_after(buf_block_t *base, uint16_t boffset, @param[in] coffset byte offset of the insert position @param[in,out] add block to be added @param[in] aoffset byte offset of the block to be added -@param[in,outr] mtr mini-transaction */ -static void flst_insert_before(buf_block_t *base, uint16_t boffset, - buf_block_t *cur, uint16_t coffset, - buf_block_t *add, uint16_t aoffset, mtr_t *mtr) +@param[in,out] mtr mini-transaction +@return error code */ +static dberr_t flst_insert_before(buf_block_t *base, uint16_t boffset, + buf_block_t *cur, uint16_t coffset, + buf_block_t *add, uint16_t aoffset, + mtr_t *mtr) { ut_ad(base != cur || boffset != coffset); ut_ad(base != add || boffset != aoffset); @@ -194,25 +198,27 @@ static void flst_insert_before(buf_block_t *base, uint16_t boffset, flst_write_addr(*add, add->page.frame + aoffset + FLST_PREV, prev_addr.page, prev_addr.boffset, mtr); flst_write_addr(*add, add->page.frame + aoffset + FLST_NEXT, - cur->page.id().page_no(), coffset, mtr); + cur->page.id().page_no(), coffset, mtr); + + dberr_t err= DB_SUCCESS; if (prev_addr.page == FIL_NULL) flst_write_addr(*base, base->page.frame + boffset + FLST_FIRST, add->page.id().page_no(), aoffset, mtr); - else - { - buf_block_t *block; - if (flst_node_t *prev= fut_get_ptr(add->page.id().space(), add->zip_size(), - prev_addr, RW_SX_LATCH, mtr, &block)) - flst_write_addr(*block, prev + FLST_NEXT, - add->page.id().page_no(), aoffset, mtr); - } + else if (buf_block_t *block= + buf_page_get_gen(page_id_t{add->page.id().space(), prev_addr.page}, + add->zip_size(), RW_SX_LATCH, nullptr, + BUF_GET_POSSIBLY_FREED, mtr, &err)) + flst_write_addr(*block, block->page.frame + + prev_addr.boffset + FLST_NEXT, + add->page.id().page_no(), aoffset, mtr); flst_write_addr(*cur, cur->page.frame + coffset + FLST_PREV, add->page.id().page_no(), aoffset, mtr); byte *len= &base->page.frame[boffset + FLST_LEN]; mtr->write<4>(*base, len, mach_read_from_4(len) + 1); + return err; } /** Initialize a list base node. @@ -234,8 +240,8 @@ void flst_init(const buf_block_t& block, byte *base, mtr_t *mtr) @param[in,out] add block to be added @param[in] aoffset byte offset of the node to be added @param[in,outr] mtr mini-transaction */ -void flst_add_last(buf_block_t *base, uint16_t boffset, - buf_block_t *add, uint16_t aoffset, mtr_t *mtr) +dberr_t flst_add_last(buf_block_t *base, uint16_t boffset, + buf_block_t *add, uint16_t aoffset, mtr_t *mtr) { ut_ad(base != add || boffset != aoffset); ut_ad(boffset < base->physical_size()); @@ -244,21 +250,23 @@ void flst_add_last(buf_block_t *base, uint16_t boffset, MTR_MEMO_PAGE_SX_FIX)); ut_ad(mtr->memo_contains_flagged(add, MTR_MEMO_PAGE_X_FIX | MTR_MEMO_PAGE_SX_FIX)); - if (!flst_get_len(base->page.frame + boffset)) + { flst_add_to_empty(base, boffset, add, aoffset, mtr); + return DB_SUCCESS; + } else { fil_addr_t addr= flst_get_last(base->page.frame + boffset); buf_block_t *cur= add; - const flst_node_t *c= addr.page == add->page.id().page_no() - ? add->page.frame + addr.boffset - : fut_get_ptr(add->page.id().space(), add->zip_size(), addr, - RW_SX_LATCH, mtr, &cur); - if (c) - flst_insert_after(base, boffset, cur, - static_cast(c - cur->page.frame), - add, aoffset, mtr); + dberr_t err; + if (addr.page != add->page.id().page_no() && + !(cur= buf_page_get_gen(page_id_t{add->page.id().space(), addr.page}, + add->zip_size(), RW_SX_LATCH, nullptr, + BUF_GET_POSSIBLY_FREED, mtr, &err))) + return err; + return flst_insert_after(base, boffset, cur, addr.boffset, + add, aoffset, mtr); } } @@ -267,9 +275,10 @@ void flst_add_last(buf_block_t *base, uint16_t boffset, @param[in] boffset byte offset of the base node @param[in,out] add block to be added @param[in] aoffset byte offset of the node to be added -@param[in,outr] mtr mini-transaction */ -void flst_add_first(buf_block_t *base, uint16_t boffset, - buf_block_t *add, uint16_t aoffset, mtr_t *mtr) +@param[in,out] mtr mini-transaction +@return error code */ +dberr_t flst_add_first(buf_block_t *base, uint16_t boffset, + buf_block_t *add, uint16_t aoffset, mtr_t *mtr) { ut_ad(base != add || boffset != aoffset); ut_ad(boffset < base->physical_size()); @@ -280,19 +289,22 @@ void flst_add_first(buf_block_t *base, uint16_t boffset, MTR_MEMO_PAGE_SX_FIX)); if (!flst_get_len(base->page.frame + boffset)) + { flst_add_to_empty(base, boffset, add, aoffset, mtr); + return DB_SUCCESS; + } else { fil_addr_t addr= flst_get_first(base->page.frame + boffset); buf_block_t *cur= add; - const flst_node_t *c= addr.page == add->page.id().page_no() - ? add->page.frame + addr.boffset - : fut_get_ptr(add->page.id().space(), add->zip_size(), addr, - RW_SX_LATCH, mtr, &cur); - if (c) - flst_insert_before(base, boffset, cur, - static_cast(c - cur->page.frame), - add, aoffset, mtr); + dberr_t err; + if (addr.page != add->page.id().page_no() && + !(cur= buf_page_get_gen(page_id_t{add->page.id().space(), addr.page}, + add->zip_size(), RW_SX_LATCH, nullptr, + BUF_GET_POSSIBLY_FREED, mtr, &err))) + return err; + return flst_insert_before(base, boffset, cur, addr.boffset, + add, aoffset, mtr); } } @@ -301,9 +313,10 @@ void flst_add_first(buf_block_t *base, uint16_t boffset, @param[in] boffset byte offset of the base node @param[in,out] cur block to be removed @param[in] coffset byte offset of the current record to be removed -@param[in,outr] mtr mini-transaction */ -void flst_remove(buf_block_t *base, uint16_t boffset, - buf_block_t *cur, uint16_t coffset, mtr_t *mtr) +@param[in,out] mtr mini-transaction +@return error code */ +dberr_t flst_remove(buf_block_t *base, uint16_t boffset, + buf_block_t *cur, uint16_t coffset, mtr_t *mtr) { ut_ad(boffset < base->physical_size()); ut_ad(coffset < cur->physical_size()); @@ -314,18 +327,19 @@ void flst_remove(buf_block_t *base, uint16_t boffset, const fil_addr_t prev_addr= flst_get_prev_addr(cur->page.frame + coffset); const fil_addr_t next_addr= flst_get_next_addr(cur->page.frame + coffset); + dberr_t err= DB_SUCCESS; if (prev_addr.page == FIL_NULL) flst_write_addr(*base, base->page.frame + boffset + FLST_FIRST, next_addr.page, next_addr.boffset, mtr); else { - buf_block_t *block= cur; - if (flst_node_t *prev= prev_addr.page == cur->page.id().page_no() - ? cur->page.frame + prev_addr.boffset - : fut_get_ptr(cur->page.id().space(), cur->zip_size(), prev_addr, - RW_SX_LATCH, mtr, &block)) - flst_write_addr(*block, prev + FLST_NEXT, + buf_block_t *b= cur; + if (prev_addr.page == b->page.id().page_no() || + (b= buf_page_get_gen(page_id_t(b->page.id().space(), prev_addr.page), + b->zip_size(), RW_SX_LATCH, nullptr, + BUF_GET_POSSIBLY_FREED, mtr, &err))) + flst_write_addr(*b, b->page.frame + prev_addr.boffset + FLST_NEXT, next_addr.page, next_addr.boffset, mtr); } @@ -334,18 +348,23 @@ void flst_remove(buf_block_t *base, uint16_t boffset, prev_addr.page, prev_addr.boffset, mtr); else { - buf_block_t *block= cur; - if (flst_node_t *next= next_addr.page == cur->page.id().page_no() - ? cur->page.frame + next_addr.boffset - : fut_get_ptr(cur->page.id().space(), cur->zip_size(), next_addr, - RW_SX_LATCH, mtr, &block)) - flst_write_addr(*block, next + FLST_PREV, + dberr_t err2; + if (next_addr.page == cur->page.id().page_no() || + (cur= buf_page_get_gen(page_id_t(cur->page.id().space(), + next_addr.page), + cur->zip_size(), RW_SX_LATCH, nullptr, + BUF_GET_POSSIBLY_FREED, mtr, &err2))) + flst_write_addr(*cur, cur->page.frame + next_addr.boffset + FLST_PREV, prev_addr.page, prev_addr.boffset, mtr); + else if (err == DB_SUCCESS) + err= err2; } byte *len= &base->page.frame[boffset + FLST_LEN]; - ut_ad(mach_read_from_4(len) > 0); + if (UNIV_UNLIKELY(!mach_read_from_4(len))) + return DB_CORRUPTION; mtr->write<4>(*base, len, mach_read_from_4(len) - 1); + return err; } #ifdef UNIV_DEBUG @@ -369,11 +388,11 @@ void flst_validate(const buf_block_t *base, uint16_t boffset, mtr_t *mtr) for (uint32_t i= len; i--; ) { mtr2.start(); - const flst_node_t *node= fut_get_ptr(base->page.id().space(), - base->zip_size(), addr, - RW_SX_LATCH, &mtr2); - ut_ad(node); - addr= flst_get_next_addr(node); + const buf_block_t *b= + buf_page_get_gen(page_id_t(base->page.id().space(), addr.page), + base->zip_size(), RW_SX_LATCH, nullptr, BUF_GET, mtr); + ut_ad(b); + addr= flst_get_next_addr(b->page.frame + addr.boffset); mtr2.commit(); } @@ -384,11 +403,11 @@ void flst_validate(const buf_block_t *base, uint16_t boffset, mtr_t *mtr) for (uint32_t i= len; i--; ) { mtr2.start(); - const flst_node_t *node= fut_get_ptr(base->page.id().space(), - base->zip_size(), addr, - RW_SX_LATCH, &mtr2); - ut_ad(node); - addr= flst_get_prev_addr(node); + const buf_block_t *b= + buf_page_get_gen(page_id_t(base->page.id().space(), addr.page), + base->zip_size(), RW_SX_LATCH, nullptr, BUF_GET, mtr); + ut_ad(b); + addr= flst_get_prev_addr(b->page.frame + addr.boffset); mtr2.commit(); } diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc index 8097fbe201186..83afd732b2161 100644 --- a/storage/innobase/gis/gis0rtree.cc +++ b/storage/innobase/gis/gis0rtree.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2021, MariaDB Corporation. +Copyright (c) 2018, 2022, 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 @@ -70,7 +70,7 @@ rtr_page_split_initialize_nodes( block = btr_cur_get_block(cursor); page = buf_block_get_frame(block); - n_uniq = dict_index_get_n_unique_in_tree(cursor->index); + n_uniq = dict_index_get_n_unique_in_tree(cursor->index()); n_recs = ulint(page_get_n_recs(page)) + 1; @@ -88,8 +88,8 @@ rtr_page_split_initialize_nodes( rec = page_rec_get_next(page_get_infimum_rec(page)); const ulint n_core = page_is_leaf(page) - ? cursor->index->n_core_fields : 0; - *offsets = rec_get_offsets(rec, cursor->index, *offsets, n_core, + ? cursor->index()->n_core_fields : 0; + *offsets = rec_get_offsets(rec, cursor->index(), *offsets, n_core, n_uniq, &heap); source_cur = rec_get_nth_field(rec, *offsets, 0, &len); @@ -101,7 +101,7 @@ rtr_page_split_initialize_nodes( memcpy(cur->coords, source_cur, DATA_MBR_LEN); rec = page_rec_get_next(rec); - *offsets = rec_get_offsets(rec, cursor->index, *offsets, + *offsets = rec_get_offsets(rec, cursor->index(), *offsets, n_core, n_uniq, &heap); source_cur = rec_get_nth_field(rec, *offsets, 0, &len); } @@ -111,9 +111,9 @@ rtr_page_split_initialize_nodes( dtuple_get_nth_field(tuple, 0))); cur->coords = reserve_coords(buf_pos, SPDIMS); rec = (byte*) mem_heap_alloc( - heap, rec_get_converted_size(cursor->index, tuple, 0)); + heap, rec_get_converted_size(cursor->index(), tuple, 0)); - rec = rec_convert_dtuple_to_rec(rec, cursor->index, tuple, 0); + rec = rec_convert_dtuple_to_rec(rec, cursor->index(), tuple, 0); cur->key = rec; memcpy(cur->coords, source_cur, DATA_MBR_LEN); @@ -185,9 +185,8 @@ rtr_index_build_node_ptr( } /**************************************************************//** -Update the mbr field of a spatial index row. -@return true if update is successful */ -bool +Update the mbr field of a spatial index row. */ +void rtr_update_mbr_field( /*=================*/ btr_cur_t* cursor, /*!< in/out: cursor pointed to rec.*/ @@ -201,7 +200,7 @@ rtr_update_mbr_field( rec_t* new_rec, /*!< in: rec to use */ mtr_t* mtr) /*!< in: mtr */ { - dict_index_t* index = cursor->index; + dict_index_t* index = cursor->index(); mem_heap_t* heap; page_t* page; rec_t* rec; @@ -246,6 +245,7 @@ rtr_update_mbr_field( /* We need to remember the child page no of cursor2, since page could be reorganized or insert a new rec before it. */ if (cursor2) { + ut_ad(cursor2->index() == index); rec_t* del_rec = btr_cur_get_rec(cursor2); offsets2 = rec_get_offsets(btr_cur_get_rec(cursor2), index, NULL, 0, @@ -269,7 +269,7 @@ rtr_update_mbr_field( if (!btr_cur_update_alloc_zip( page_zip, btr_cur_get_page_cur(cursor), - index, offsets, + offsets, rec_offs_size(offsets), false, mtr)) { @@ -322,7 +322,7 @@ rtr_update_mbr_field( offsets2)); page_cur_delete_rec(btr_cur_get_page_cur(cursor2), - index, offsets2, mtr); + offsets2, mtr); } } else if (page_get_n_recs(page) == 1) { /* When there's only one rec in the page, we do insert/delete to @@ -353,9 +353,10 @@ rtr_update_mbr_field( ut_ad(old_rec != insert_rec); page_cur_position(old_rec, block, &page_cur); + page_cur.index = index; offsets2 = rec_get_offsets(old_rec, index, NULL, n_core, ULINT_UNDEFINED, &heap); - page_cur_delete_rec(&page_cur, index, offsets2, mtr); + page_cur_delete_rec(&page_cur, offsets2, mtr); } else { update_mbr: @@ -367,8 +368,7 @@ rtr_update_mbr_field( /* Delete the rec which cursor point to. */ next_rec = page_rec_get_next(rec); - page_cur_delete_rec(btr_cur_get_page_cur(cursor), - index, offsets, mtr); + page_cur_delete_rec(&cursor->page_cur, offsets, mtr); if (!ins_suc) { ut_ad(rec_info & REC_INFO_MIN_REC_FLAG); @@ -401,40 +401,40 @@ rtr_update_mbr_field( == btr_node_ptr_get_child_page_no(cur2_rec, offsets2)); page_cur_delete_rec(btr_cur_get_page_cur(cursor2), - index, offsets2, mtr); + offsets2, mtr); cursor2 = NULL; } /* Insert the new rec. */ - page_cur_search_with_match(block, index, node_ptr, - PAGE_CUR_LE , &up_match, &low_match, - btr_cur_get_page_cur(cursor), NULL); + if (page_cur_search_with_match(node_ptr, PAGE_CUR_LE, + &up_match, &low_match, + btr_cur_get_page_cur(cursor), + NULL)) { + goto err_exit; + } err = btr_cur_optimistic_insert(flags, cursor, &insert_offsets, &heap, node_ptr, &insert_rec, &dummy_big_rec, 0, NULL, mtr); - if (!ins_suc && err == DB_SUCCESS) { - ins_suc = true; - } - /* If optimistic insert fail, try reorganize the page and insert again. */ - if (err != DB_SUCCESS && ins_suc) { - btr_page_reorganize(btr_cur_get_page_cur(cursor), - index, mtr); - - err = btr_cur_optimistic_insert(flags, - cursor, - &insert_offsets, - &heap, - node_ptr, - &insert_rec, - &dummy_big_rec, - 0, NULL, mtr); + if (err == DB_SUCCESS) { + ins_suc = true; + } else if (ins_suc) { + ut_ad(err == DB_FAIL); + err = btr_page_reorganize(btr_cur_get_page_cur(cursor), + mtr); + if (err == DB_SUCCESS) { + err = btr_cur_optimistic_insert( + flags, cursor, &insert_offsets, &heap, + node_ptr, &insert_rec, &dummy_big_rec, + 0, NULL, mtr); + } /* Will do pessimistic insert */ if (err != DB_SUCCESS) { + ut_ad(err == DB_FAIL); ins_suc = false; } } @@ -466,10 +466,14 @@ rtr_update_mbr_field( cur2_pno = btr_node_ptr_get_child_page_no(cur2_rec, offsets2); if ((del_page_no != cur2_pno) || (cur2_rec == insert_rec)) { - cur2_rec = page_rec_get_next( - page_get_infimum_rec(page)); + cur2_rec = page_get_infimum_rec(page); + + while ((cur2_rec + = page_rec_get_next(cur2_rec))) { + if (page_rec_is_supremum(cur2_rec)) { + break; + } - while (!page_rec_is_supremum(cur2_rec)) { offsets2 = rec_get_offsets(cur2_rec, index, NULL, n_core, @@ -484,10 +488,7 @@ rtr_update_mbr_field( break; } } - cur2_rec = page_rec_get_next(cur2_rec); } - - ut_ad(!page_rec_is_supremum(cur2_rec)); } rec_info = rec_get_info_bits(cur2_rec, @@ -504,7 +505,7 @@ rtr_update_mbr_field( ut_ad(cur2_pno == del_page_no && cur2_rec != insert_rec); page_cur_delete_rec(btr_cur_get_page_cur(cursor2), - index, offsets2, mtr); + offsets2, mtr); } if (!ins_suc) { @@ -533,16 +534,15 @@ rtr_update_mbr_field( || (REC_INFO_MIN_REC_FLAG & rec_get_info_bits( page_rec_get_next(page_get_infimum_rec(page)), page_is_comp(page)))); - +err_exit: mem_heap_free(heap); - - return(true); } +MY_ATTRIBUTE((nonnull, warn_unused_result)) /**************************************************************//** Update parent page's MBR and Predicate lock information during a split */ -static MY_ATTRIBUTE((nonnull)) -void +static +dberr_t rtr_adjust_upper_level( /*===================*/ btr_cur_t* sea_cur, /*!< in: search cursor */ @@ -556,24 +556,23 @@ rtr_adjust_upper_level( { ulint page_no; ulint new_page_no; - dict_index_t* index = sea_cur->index; btr_cur_t cursor; rec_offs* offsets; mem_heap_t* heap; ulint level; - dtuple_t* node_ptr_upper; + dtuple_t* node_ptr_upper = nullptr; page_cur_t* page_cursor; lock_prdt_t prdt; lock_prdt_t new_prdt; - dberr_t err; big_rec_t* dummy_big_rec; rec_t* rec; /* Create a memory heap where the data tuple is stored */ heap = mem_heap_create(1024); - cursor.init(); cursor.thr = sea_cur->thr; + cursor.page_cur.index = sea_cur->index(); + cursor.page_cur.block = block; /* Get the level of the split pages */ level = btr_page_get_level(buf_block_get_frame(block)); @@ -585,8 +584,7 @@ rtr_adjust_upper_level( /* Set new mbr for the old page on the upper level. */ /* Look up the index for the node pointer to page */ - offsets = rtr_page_get_father_block( - NULL, heap, index, block, mtr, sea_cur, &cursor); + offsets = rtr_page_get_father_block(NULL, heap, mtr, sea_cur, &cursor); page_cursor = btr_cur_get_page_cur(&cursor); @@ -602,29 +600,31 @@ rtr_adjust_upper_level( } } - /* Insert the node for the new page. */ - node_ptr_upper = rtr_index_build_node_ptr( - index, new_mbr, - page_rec_get_next(page_get_infimum_rec(new_block->page.frame)), - new_page_no, heap); - - ulint up_match = 0; - ulint low_match = 0; - - buf_block_t* father_block = btr_cur_get_block(&cursor); - - page_cur_search_with_match( - father_block, index, node_ptr_upper, - PAGE_CUR_LE , &up_match, &low_match, - btr_cur_get_page_cur(&cursor), NULL); - - err = btr_cur_optimistic_insert( - flags - | BTR_NO_LOCKING_FLAG - | BTR_KEEP_SYS_FLAG - | BTR_NO_UNDO_LOG_FLAG, - &cursor, &offsets, &heap, - node_ptr_upper, &rec, &dummy_big_rec, 0, NULL, mtr); + dberr_t err; + + if (const rec_t* first = page_rec_get_next_const( + page_get_infimum_rec(new_block->page.frame))) { + /* Insert the node for the new page. */ + node_ptr_upper = rtr_index_build_node_ptr( + sea_cur->index(), new_mbr, first, new_page_no, heap); + ulint up_match = 0, low_match = 0; + err = page_cur_search_with_match(node_ptr_upper, + PAGE_CUR_LE, + &up_match, &low_match, + btr_cur_get_page_cur(&cursor), + NULL) + ? DB_CORRUPTION + : btr_cur_optimistic_insert(flags + | BTR_NO_LOCKING_FLAG + | BTR_KEEP_SYS_FLAG + | BTR_NO_UNDO_LOG_FLAG, + &cursor, &offsets, &heap, + node_ptr_upper, &rec, + &dummy_big_rec, 0, NULL, + mtr); + } else { + err = DB_CORRUPTION; + } if (err == DB_FAIL) { cursor.rtr_info = sea_cur->rtr_info; @@ -643,42 +643,49 @@ rtr_adjust_upper_level( node_ptr_upper, &rec, &dummy_big_rec, 0, NULL, mtr); cursor.rtr_info = NULL; - ut_a(err == DB_SUCCESS); - mem_heap_free(new_heap); } - prdt.data = static_cast(mbr); - prdt.op = 0; - new_prdt.data = static_cast(new_mbr); - new_prdt.op = 0; + if (err == DB_SUCCESS) { + prdt.data = static_cast(mbr); + prdt.op = 0; + new_prdt.data = static_cast(new_mbr); + new_prdt.op = 0; - lock_prdt_update_parent(block, new_block, &prdt, &new_prdt, - page_cursor->block->page.id()); + lock_prdt_update_parent(block, new_block, &prdt, &new_prdt, + page_cursor->block->page.id()); + } mem_heap_free(heap); - ut_ad(block->zip_size() == index->table->space->zip_size()); + ut_ad(block->zip_size() == sea_cur->index()->table->space->zip_size()); - const uint32_t next_page_no = btr_page_get_next(block->page.frame); + if (err != DB_SUCCESS) { + return err; + } - if (next_page_no != FIL_NULL) { - buf_block_t* next_block = btr_block_get( - *index, next_page_no, RW_X_LATCH, false, mtr); -#ifdef UNIV_BTR_DEBUG - ut_a(page_is_comp(next_block->page.frame) - == page_is_comp(block->page.frame)); - ut_a(btr_page_get_prev(next_block->page.frame) - == block->page.id().page_no()); -#endif /* UNIV_BTR_DEBUG */ + const uint32_t next_page_no = btr_page_get_next(block->page.frame); + if (next_page_no == FIL_NULL) { + } else if (buf_block_t* next_block = + btr_block_get(*sea_cur->index(), next_page_no, RW_X_LATCH, + false, mtr, &err)) { + if (UNIV_UNLIKELY(memcmp_aligned<4>(next_block->page.frame + + FIL_PAGE_PREV, + block->page.frame + + FIL_PAGE_OFFSET, 4))) { + return DB_CORRUPTION; + } btr_page_set_prev(next_block, new_page_no, mtr); + } else { + return err; } btr_page_set_next(block, new_page_no, mtr); btr_page_set_prev(new_block, page_no, mtr); btr_page_set_next(new_block, next_page_no, mtr); + return DB_SUCCESS; } /*************************************************************//** @@ -689,9 +696,10 @@ if new_block is a compressed leaf page in a secondary index. This has to be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit(). -@return TRUE on success; FALSE on compression failure */ +@return error code +@retval DB_FAIL on ROW_FORMAT=COMPRESSED compression failure */ static -ibool +dberr_t rtr_split_page_move_rec_list( /*=========================*/ rtr_split_node_t* node_array, /*!< in: split node array. */ @@ -719,7 +727,6 @@ rtr_split_page_move_rec_list( page_zip_des_t* new_page_zip = buf_block_get_page_zip(new_block); rec_t* rec; - rec_t* ret; ulint moved = 0; ulint max_to_move = 0; rtr_rec_move_t* rec_move = NULL; @@ -731,10 +738,10 @@ rtr_split_page_move_rec_list( page_cur_set_before_first(block, &page_cursor); page_cur_set_before_first(new_block, &new_page_cursor); + page_cursor.index = new_page_cursor.index = index; page = buf_block_get_frame(block); new_page = buf_block_get_frame(new_block); - ret = page_rec_get_prev(page_get_supremum_rec(new_page)); end_split_node = node_array + page_get_n_recs(page); @@ -766,15 +773,17 @@ rtr_split_page_move_rec_list( rec = page_cur_insert_rec_low( &new_page_cursor, - index, cur_split_node->key, offsets, mtr); + cur_split_node->key, offsets, mtr); - ut_a(rec); + if (UNIV_UNLIKELY + (!rec + || !page_cur_move_to_next(&new_page_cursor))) { + return DB_CORRUPTION; + } lock_rec_restore_from_page_infimum( *new_block, rec, block->page.id()); - page_cur_move_to_next(&new_page_cursor); - rec_move[moved].new_rec = rec; rec_move[moved].old_rec = cur_split_node->key; rec_move[moved].moved = false; @@ -805,35 +814,16 @@ rtr_split_page_move_rec_list( if (!page_zip_compress(new_block, index, page_zip_level, mtr)) { - ulint ret_pos; - - /* Before trying to reorganize the page, - store the number of preceding records on the page. */ - ret_pos = page_rec_get_n_recs_before(ret); - /* Before copying, "ret" was the predecessor - of the predefined supremum record. If it was - the predefined infimum record, then it would - still be the infimum, and we would have - ret_pos == 0. */ - - if (UNIV_UNLIKELY - (!page_zip_reorganize(new_block, index, - page_zip_level, mtr))) { - - if (UNIV_UNLIKELY - (!page_zip_decompress(new_page_zip, - new_page, FALSE))) { - ut_error; + if (dberr_t err = + page_zip_reorganize(new_block, index, + page_zip_level, mtr)) { + if (err == DB_FAIL) { + ut_a(page_zip_decompress(new_page_zip, + new_page, + FALSE)); } -#ifdef UNIV_GIS_DEBUG - ut_ad(page_validate(new_page, index)); -#endif - - return(false); + return err; } - - /* The page was reorganized: Seek to ret_pos. */ - ret = page_rec_get_nth(new_page, ret_pos); } } @@ -850,12 +840,11 @@ rtr_split_page_move_rec_list( page_cur_get_rec(&page_cursor), index, offsets, n_core, ULINT_UNDEFINED, &heap); - page_cur_delete_rec(&page_cursor, - index, offsets, mtr); + page_cur_delete_rec(&page_cursor, offsets, mtr); } } - return(true); + return DB_SUCCESS; } /*************************************************************//** @@ -877,7 +866,8 @@ rtr_page_split_and_insert( mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ const dtuple_t* tuple, /*!< in: tuple to insert */ ulint n_ext, /*!< in: number of externally stored columns */ - mtr_t* mtr) /*!< in: mtr */ + mtr_t* mtr, /*!< in: mtr */ + dberr_t* err) /*!< out: error code */ { buf_block_t* block; page_t* page; @@ -885,7 +875,6 @@ rtr_page_split_and_insert( buf_block_t* new_block; page_zip_des_t* page_zip; page_zip_des_t* new_page_zip; - buf_block_t* insert_block; page_cur_t* page_cursor; rec_t* rec = 0; ulint n_recs; @@ -904,7 +893,7 @@ rtr_page_split_and_insert( lock_prdt_t new_prdt; rec_t* first_rec = NULL; int first_rec_group = 1; - ulint n_iterations = 0; + IF_DBUG(bool iterated = false,); if (!*heap) { *heap = mem_heap_create(1024); @@ -914,12 +903,10 @@ rtr_page_split_and_insert( mem_heap_empty(*heap); *offsets = NULL; - ut_ad(mtr->memo_contains_flagged(&cursor->index->lock, MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK)); - ut_ad(!dict_index_is_online_ddl(cursor->index) - || (flags & BTR_CREATE_FLAG) - || dict_index_is_clust(cursor->index)); - ut_ad(cursor->index->lock.have_u_or_x()); + ut_ad(mtr->memo_contains_flagged(&cursor->index()->lock, + MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); + ut_ad(!dict_index_is_online_ddl(cursor->index())); + ut_ad(cursor->index()->lock.have_u_or_x()); block = btr_cur_get_block(cursor); page = buf_block_get_frame(block); @@ -934,6 +921,11 @@ rtr_page_split_and_insert( if (!page_has_prev(page) && !page_is_leaf(page)) { first_rec = page_rec_get_next( page_get_infimum_rec(buf_block_get_frame(block))); + if (UNIV_UNLIKELY(!first_rec)) { +corrupted: + *err = DB_CORRUPTION; + return nullptr; + } } /* Initial split nodes array. */ @@ -957,7 +949,7 @@ rtr_page_split_and_insert( } #endif - insert_size = rec_get_converted_size(cursor->index, tuple, n_ext); + insert_size = rec_get_converted_size(cursor->index(), tuple, n_ext); total_data = page_get_data_size(page) + insert_size; first_rec_group = split_rtree_node(rtr_split_node_array, static_cast(n_recs), @@ -968,10 +960,10 @@ rtr_page_split_and_insert( /* Allocate a new page to the index */ const uint16_t page_level = btr_page_get_level(page); - new_block = btr_page_alloc(cursor->index, page_id.page_no() + 1, - FSP_UP, page_level, mtr, mtr); - if (!new_block) { - return NULL; + new_block = btr_page_alloc(cursor->index(), page_id.page_no() + 1, + FSP_UP, page_level, mtr, mtr, err); + if (UNIV_UNLIKELY(!new_block)) { + return nullptr; } new_page_zip = buf_block_get_page_zip(new_block); @@ -980,7 +972,7 @@ rtr_page_split_and_insert( to contain FIL_NULL in FIL_PAGE_PREV at this stage. */ memset_aligned<4>(new_block->page.frame + FIL_PAGE_PREV, 0, 4); } - btr_page_create(new_block, new_page_zip, cursor->index, + btr_page_create(new_block, new_page_zip, cursor->index(), page_level, mtr); new_page = buf_block_get_frame(new_block); @@ -988,7 +980,7 @@ rtr_page_split_and_insert( /* Set new ssn to the new page and page. */ page_set_ssn_id(new_block, new_page_zip, current_ssn, mtr); - next_ssn = rtr_get_new_ssn_id(cursor->index); + next_ssn = rtr_get_new_ssn_id(cursor->index()); page_set_ssn_id(block, page_zip, next_ssn, mtr); @@ -998,10 +990,17 @@ rtr_page_split_and_insert( #ifdef UNIV_ZIP_COPY || page_zip #endif - || !rtr_split_page_move_rec_list(rtr_split_node_array, - first_rec_group, - new_block, block, first_rec, - cursor->index, *heap, mtr)) { + || (*err = rtr_split_page_move_rec_list(rtr_split_node_array, + first_rec_group, + new_block, block, + first_rec, cursor->index(), + *heap, mtr))) { + if (*err != DB_FAIL) { + return nullptr; + } + + *err = DB_SUCCESS; + ulint n = 0; rec_t* rec; ulint moved = 0; @@ -1017,7 +1016,7 @@ rtr_page_split_and_insert( ut_a(new_page_zip); page_zip_copy_recs(new_block, - page_zip, page, cursor->index, mtr); + page_zip, page, cursor->index(), mtr); page_cursor = btr_cur_get_page_cur(cursor); @@ -1052,7 +1051,7 @@ rtr_page_split_and_insert( lock_rtr_move_rec_list(new_block, block, rec_move, moved); const ulint n_core = page_level - ? 0 : cursor->index->n_core_fields; + ? 0 : cursor->index()->n_core_fields; /* Delete recs in first group from the new page. */ for (cur_split_node = rtr_split_node_array; @@ -1072,11 +1071,11 @@ rtr_page_split_and_insert( *offsets = rec_get_offsets( page_cur_get_rec(page_cursor), - cursor->index, *offsets, n_core, + cursor->index(), *offsets, n_core, ULINT_UNDEFINED, heap); page_cur_delete_rec(page_cursor, - cursor->index, *offsets, mtr); + *offsets, mtr); n++; } } @@ -1089,43 +1088,45 @@ rtr_page_split_and_insert( block, page_cursor); *offsets = rec_get_offsets( page_cur_get_rec(page_cursor), - cursor->index, *offsets, n_core, + page_cursor->index, *offsets, n_core, ULINT_UNDEFINED, heap); - page_cur_delete_rec(page_cursor, - cursor->index, *offsets, mtr); + page_cur_delete_rec(page_cursor, *offsets, + mtr); } } #ifdef UNIV_GIS_DEBUG - ut_ad(page_validate(new_page, cursor->index)); - ut_ad(page_validate(page, cursor->index)); + ut_ad(page_validate(new_page, cursor->index())); + ut_ad(page_validate(page, cursor->index())); #endif } /* Insert the new rec to the proper page. */ cur_split_node = end_split_node - 1; - if (cur_split_node->n_node != first_rec_group) { - insert_block = new_block; - } else { - insert_block = block; - } /* Reposition the cursor for insert and try insertion */ page_cursor = btr_cur_get_page_cur(cursor); + page_cursor->block = cur_split_node->n_node != first_rec_group + ? new_block : block; - page_cur_search(insert_block, cursor->index, tuple, - PAGE_CUR_LE, page_cursor); + ulint up_match = 0, low_match = 0; + + if (page_cur_search_with_match(tuple, + PAGE_CUR_LE, &up_match, &low_match, + page_cursor, nullptr)) { + goto corrupted; + } /* It's possible that the new record is too big to be inserted into the page, and it'll need the second round split in this case. We test this scenario here*/ DBUG_EXECUTE_IF("rtr_page_need_second_split", - if (n_iterations == 0) { + if (!iterated) { rec = NULL; goto after_insert; } ); - rec = page_cur_tuple_insert(page_cursor, tuple, cursor->index, + rec = page_cur_tuple_insert(page_cursor, tuple, offsets, heap, n_ext, mtr); /* If insert did not fit, try page reorganization. @@ -1133,14 +1134,13 @@ rtr_page_split_and_insert( attempted this already. */ if (rec == NULL) { if (!is_page_cur_get_page_zip(page_cursor) - && btr_page_reorganize(page_cursor, cursor->index, mtr)) { + && btr_page_reorganize(page_cursor, mtr)) { rec = page_cur_tuple_insert(page_cursor, tuple, - cursor->index, offsets, + offsets, heap, n_ext, mtr); } - /* If insert fail, we will try to split the insert_block - again. */ + /* If insert fail, we will try to split the block again. */ } #ifdef UNIV_DEBUG @@ -1148,8 +1148,8 @@ rtr_page_split_and_insert( #endif /* Calculate the mbr on the upper half-page, and the mbr on original page. */ - rtr_page_cal_mbr(cursor->index, block, &mbr, *heap); - rtr_page_cal_mbr(cursor->index, new_block, &new_mbr, *heap); + rtr_page_cal_mbr(cursor->index(), block, &mbr, *heap); + rtr_page_cal_mbr(cursor->index(), new_block, &new_mbr, *heap); prdt.data = &mbr; new_prdt.data = &new_mbr; @@ -1158,32 +1158,30 @@ rtr_page_split_and_insert( lock_prdt_update_split(new_block, &prdt, &new_prdt, page_id); /* Adjust the upper level. */ - rtr_adjust_upper_level(cursor, flags, block, new_block, - &mbr, &new_mbr, mtr); + *err = rtr_adjust_upper_level(cursor, flags, block, new_block, + &mbr, &new_mbr, mtr); + if (UNIV_UNLIKELY(*err != DB_SUCCESS)) { + return nullptr; + } /* Save the new ssn to the root page, since we need to reinit the first ssn value from it after restart server. */ - root_block = btr_root_block_get(cursor->index, RW_SX_LATCH, mtr); + root_block = btr_root_block_get(cursor->index(), RW_SX_LATCH, + mtr, err); + if (UNIV_UNLIKELY(!root_block)) { + return nullptr; + } page_zip = buf_block_get_page_zip(root_block); page_set_ssn_id(root_block, page_zip, next_ssn, mtr); - /* Insert fit on the page: update the free bits for the - left and right pages in the same mtr */ - - if (page_is_leaf(page)) { - ibuf_update_free_bits_for_two_pages_low( - block, new_block, mtr); - } - - /* If the new res insert fail, we need to do another split again. */ if (!rec) { /* We play safe and reset the free bits for new_page */ - if (!dict_index_is_clust(cursor->index) - && !cursor->index->table->is_temporary()) { + if (!dict_index_is_clust(cursor->index()) + && !cursor->index()->table->is_temporary()) { ibuf_reset_free_bits(new_block); ibuf_reset_free_bits(block); } @@ -1193,23 +1191,24 @@ rtr_page_split_and_insert( parent. */ rtr_clean_rtr_info(cursor->rtr_info, true); cursor->rtr_info = NULL; - n_iterations++; + IF_DBUG(iterated=true,); rec_t* i_rec = page_rec_get_next(page_get_infimum_rec( buf_block_get_frame(block))); - btr_cur_position(cursor->index, i_rec, block, cursor); + if (UNIV_UNLIKELY(!i_rec)) { + goto corrupted; + } + btr_cur_position(cursor->index(), i_rec, block, cursor); goto func_start; } #ifdef UNIV_GIS_DEBUG - ut_ad(page_validate(buf_block_get_frame(block), cursor->index)); - ut_ad(page_validate(buf_block_get_frame(new_block), cursor->index)); + ut_ad(page_validate(buf_block_get_frame(block), cursor->index())); + ut_ad(page_validate(buf_block_get_frame(new_block), cursor->index())); - ut_ad(!rec || rec_offs_validate(rec, cursor->index, *offsets)); + ut_ad(!rec || rec_offs_validate(rec, cursor->index(), *offsets)); #endif - MONITOR_INC(MONITOR_INDEX_SPLIT); - return(rec); } @@ -1226,14 +1225,13 @@ rtr_ins_enlarge_mbr( rtr_mbr_t new_mbr; buf_block_t* block; mem_heap_t* heap; - dict_index_t* index = btr_cur->index; page_cur_t* page_cursor; rec_offs* offsets; node_visit_t* node_visit; btr_cur_t cursor; page_t* page; - ut_ad(dict_index_is_spatial(index)); + ut_ad(btr_cur->index()->is_spatial()); /* If no rtr_info or rtree is one level tree, return. */ if (!btr_cur->rtr_info || btr_cur->tree_height == 1) { @@ -1261,24 +1259,20 @@ rtr_ins_enlarge_mbr( } /* Calculate the mbr of the child page. */ - rtr_page_cal_mbr(index, block, &new_mbr, heap); + rtr_page_cal_mbr(page_cursor->index, block, &new_mbr, heap); /* Get father block. */ - cursor.init(); + cursor.page_cur.index = page_cursor->index; + cursor.page_cur.block = block; offsets = rtr_page_get_father_block( - NULL, heap, index, block, mtr, btr_cur, &cursor); + NULL, heap, mtr, btr_cur, &cursor); page = buf_block_get_frame(block); /* Update the mbr field of the rec. */ - if (!rtr_update_mbr_field(&cursor, offsets, NULL, page, - &new_mbr, NULL, mtr)) { - err = DB_ERROR; - break; - } - - page_cursor = btr_cur_get_page_cur(&cursor); - block = page_cur_get_block(page_cursor); + rtr_update_mbr_field(&cursor, offsets, NULL, page, + &new_mbr, NULL, mtr); + block = btr_cur_get_block(&cursor); } mem_heap_free(heap); @@ -1288,14 +1282,9 @@ rtr_ins_enlarge_mbr( /*************************************************************//** Copy recs from a page to new_block of rtree. -Differs from page_copy_rec_list_end, because this function does not -touch the lock table and max trx id on page or compress the page. -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if new_block is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). */ -void +@return error code */ +dberr_t rtr_page_copy_rec_list_end_no_locks( /*================================*/ buf_block_t* new_block, /*!< in: index page to copy to */ @@ -1325,18 +1314,21 @@ rtr_page_copy_rec_list_end_no_locks( page_cur_position(rec, block, &cur1); - if (page_cur_is_before_first(&cur1)) { - page_cur_move_to_next(&cur1); + if (page_cur_is_before_first(&cur1) && !page_cur_move_to_next(&cur1)) { + return DB_CORRUPTION; } - btr_assert_not_corrupted(new_block, index); ut_a(page_is_comp(new_page) == page_rec_is_comp(rec)); ut_a(mach_read_from_2(new_page + srv_page_size - 10) == (ulint) (page_is_comp(new_page) ? PAGE_NEW_INFIMUM : PAGE_OLD_INFIMUM)); cur_rec = page_rec_get_next( page_get_infimum_rec(buf_block_get_frame(new_block))); + if (UNIV_UNLIKELY(!cur_rec)) { + return DB_CORRUPTION; + } page_cur_position(cur_rec, new_block, &page_cur); + page_cur.index = index; /* Copy records from the original page to the new page */ while (!page_cur_is_after_last(&cur1)) { @@ -1345,6 +1337,9 @@ rtr_page_copy_rec_list_end_no_locks( if (page_rec_is_infimum(cur_rec)) { cur_rec = page_rec_get_next(cur_rec); + if (UNIV_UNLIKELY(!cur_rec)) { + return DB_CORRUPTION; + } } offsets1 = rec_get_offsets(cur1_rec, index, offsets1, n_core, @@ -1360,12 +1355,10 @@ rtr_page_copy_rec_list_end_no_locks( offsets1, offsets2, index, false, &cur_matched_fields); if (cmp < 0) { - page_cur_move_to_prev(&page_cur); - break; + goto move_to_prev; } else if (cmp > 0) { /* Skip small recs. */ - page_cur_move_to_next(&page_cur); - cur_rec = page_cur_get_rec(&page_cur); + cur_rec = page_cur_move_to_next(&page_cur); } else if (n_core) { if (rec_get_deleted_flag(cur1_rec, dict_table_is_comp(index->table))) { @@ -1384,26 +1377,23 @@ rtr_page_copy_rec_list_end_no_locks( /* If position is on suprenum rec, need to move to previous rec. */ if (page_rec_is_supremum(cur_rec)) { - page_cur_move_to_prev(&page_cur); +move_to_prev: + cur_rec = page_cur_move_to_prev(&page_cur); + } else { + cur_rec = page_cur_get_rec(&page_cur); } - cur_rec = page_cur_get_rec(&page_cur); + if (UNIV_UNLIKELY(!cur_rec)) { + return DB_CORRUPTION; + } offsets1 = rec_get_offsets(cur1_rec, index, offsets1, n_core, ULINT_UNDEFINED, &heap); - ins_rec = page_cur_insert_rec_low(&page_cur, index, + ins_rec = page_cur_insert_rec_low(&page_cur, cur1_rec, offsets1, mtr); - if (UNIV_UNLIKELY(!ins_rec)) { - fprintf(stderr, "page number %u and %u\n", - new_block->page.id().page_no(), - block->page.id().page_no()); - - ib::fatal() << "rec offset " << page_offset(rec) - << ", cur1 offset " - << page_offset(page_cur_get_rec(&cur1)) - << ", cur_rec offset " - << page_offset(cur_rec); + if (UNIV_UNLIKELY(!ins_rec || moved >= max_move)) { + return DB_CORRUPTION; } rec_move[moved].new_rec = ins_rec; @@ -1411,20 +1401,20 @@ rtr_page_copy_rec_list_end_no_locks( rec_move[moved].moved = false; moved++; next: - if (moved > max_move) { - ut_ad(0); - break; + if (UNIV_UNLIKELY(!page_cur_move_to_next(&cur1))) { + return DB_CORRUPTION; } - - page_cur_move_to_next(&cur1); } *num_moved = moved; + return DB_SUCCESS; } /*************************************************************//** -Copy recs till a specified rec from a page to new_block of rtree. */ -void +Copy recs till a specified rec from a page to new_block of rtree. + +@return error code */ +dberr_t rtr_page_copy_rec_list_start_no_locks( /*==================================*/ buf_block_t* new_block, /*!< in: index page to copy to */ @@ -1452,11 +1442,17 @@ rtr_page_copy_rec_list_start_no_locks( rec_offs_init(offsets_2); page_cur_set_before_first(block, &cur1); - page_cur_move_to_next(&cur1); + if (UNIV_UNLIKELY(!page_cur_move_to_next(&cur1))) { + return DB_CORRUPTION; + } cur_rec = page_rec_get_next( page_get_infimum_rec(buf_block_get_frame(new_block))); + if (UNIV_UNLIKELY(!cur_rec)) { + return DB_CORRUPTION; + } page_cur_position(cur_rec, new_block, &page_cur); + page_cur.index = index; while (page_cur_get_rec(&cur1) != rec) { rec_t* cur1_rec = page_cur_get_rec(&cur1); @@ -1464,6 +1460,9 @@ rtr_page_copy_rec_list_start_no_locks( if (page_rec_is_infimum(cur_rec)) { cur_rec = page_rec_get_next(cur_rec); + if (UNIV_UNLIKELY(!cur_rec)) { + return DB_CORRUPTION; + } } offsets1 = rec_get_offsets(cur1_rec, index, offsets1, n_core, @@ -1479,13 +1478,10 @@ rtr_page_copy_rec_list_start_no_locks( offsets1, offsets2, index, false, &cur_matched_fields); if (cmp < 0) { - page_cur_move_to_prev(&page_cur); - cur_rec = page_cur_get_rec(&page_cur); - break; + goto move_to_prev; } else if (cmp > 0) { /* Skip small recs. */ - page_cur_move_to_next(&page_cur); - cur_rec = page_cur_get_rec(&page_cur); + cur_rec = page_cur_move_to_next(&page_cur); } else if (n_core) { if (rec_get_deleted_flag( cur1_rec, @@ -1505,23 +1501,23 @@ rtr_page_copy_rec_list_start_no_locks( /* If position is on suprenum rec, need to move to previous rec. */ if (page_rec_is_supremum(cur_rec)) { - page_cur_move_to_prev(&page_cur); +move_to_prev: + cur_rec = page_cur_move_to_prev(&page_cur); + } else { + cur_rec = page_cur_get_rec(&page_cur); } - cur_rec = page_cur_get_rec(&page_cur); + if (UNIV_UNLIKELY(!cur_rec)) { + return DB_CORRUPTION; + } offsets1 = rec_get_offsets(cur1_rec, index, offsets1, n_core, ULINT_UNDEFINED, &heap); - ins_rec = page_cur_insert_rec_low(&page_cur, index, + ins_rec = page_cur_insert_rec_low(&page_cur, cur1_rec, offsets1, mtr); - if (UNIV_UNLIKELY(!ins_rec)) { - ib::fatal() << new_block->page.id() - << "rec offset " << page_offset(rec) - << ", cur1 offset " - << page_offset(page_cur_get_rec(&cur1)) - << ", cur_rec offset " - << page_offset(cur_rec); + if (UNIV_UNLIKELY(!ins_rec || moved >= max_move)) { + return DB_CORRUPTION; } rec_move[moved].new_rec = ins_rec; @@ -1529,15 +1525,13 @@ rtr_page_copy_rec_list_start_no_locks( rec_move[moved].moved = false; moved++; next: - if (moved > max_move) { - ut_ad(0); - break; + if (UNIV_UNLIKELY(!page_cur_move_to_next(&cur1))) { + return DB_CORRUPTION; } - - page_cur_move_to_next(&cur1); } *num_moved = moved; + return DB_SUCCESS; } /****************************************************************//** @@ -1558,7 +1552,7 @@ rtr_merge_mbr_changed( ulint len; bool changed = false; - ut_ad(dict_index_is_spatial(cursor->index)); + ut_ad(cursor->index()->is_spatial()); rec = btr_cur_get_rec(cursor); @@ -1586,7 +1580,7 @@ rtr_merge_mbr_changed( /****************************************************************//** Merge 2 mbrs and update the the mbr that cursor is on. */ -dberr_t +void rtr_merge_and_update_mbr( /*=====================*/ btr_cur_t* cursor, /*!< in/out: cursor */ @@ -1596,27 +1590,15 @@ rtr_merge_and_update_mbr( page_t* child_page, /*!< in: the page. */ mtr_t* mtr) /*!< in: mtr */ { - dberr_t err = DB_SUCCESS; rtr_mbr_t new_mbr; - bool changed = false; - - ut_ad(dict_index_is_spatial(cursor->index)); - - changed = rtr_merge_mbr_changed(cursor, cursor2, offsets, offsets2, - &new_mbr); - /* Update the mbr field of the rec. And will delete the record - pointed by cursor2 */ - if (changed) { - if (!rtr_update_mbr_field(cursor, offsets, cursor2, child_page, - &new_mbr, NULL, mtr)) { - err = DB_ERROR; - } + if (rtr_merge_mbr_changed(cursor, cursor2, offsets, offsets2, + &new_mbr)) { + rtr_update_mbr_field(cursor, offsets, cursor2, child_page, + &new_mbr, NULL, mtr); } else { rtr_node_ptr_delete(cursor2, mtr); } - - return(err); } /*************************************************************//** @@ -1650,16 +1632,15 @@ rtr_check_same_block( btr_cur_t* cursor, /*!< in/out: position at the parent entry pointing to the child if successful */ buf_block_t* parentb,/*!< in: parent page to check */ - buf_block_t* childb, /*!< in: child Page */ mem_heap_t* heap) /*!< in: memory heap */ { - ulint page_no = childb->page.id().page_no(); + const uint32_t page_no = + btr_cur_get_block(cursor)->page.id().page_no(); rec_offs* offsets; - rec_t* rec = page_rec_get_next(page_get_infimum_rec( - buf_block_get_frame(parentb))); + rec_t* rec = page_get_infimum_rec(parentb->page.frame); - while (!page_rec_is_supremum(rec)) { + while ((rec = page_rec_get_next(rec)) && !page_rec_is_supremum(rec)) { offsets = rec_get_offsets( rec, index, NULL, 0, ULINT_UNDEFINED, &heap); @@ -1667,8 +1648,6 @@ rtr_check_same_block( btr_cur_position(index, rec, parentb, cursor); return(true); } - - rec = page_rec_get_next(rec); } return(false); @@ -1862,7 +1841,8 @@ rtr_estimate_n_rows_in_range( index->set_modified(mtr); mtr_s_lock_index(index, &mtr); - buf_block_t* block = btr_root_block_get(index, RW_S_LATCH, &mtr); + dberr_t err; + buf_block_t* block = btr_root_block_get(index, RW_S_LATCH, &mtr, &err); if (!block) { err_exit: mtr.commit(); @@ -1877,9 +1857,9 @@ rtr_estimate_n_rows_in_range( /* Scan records in root page and calculate area. */ double area = 0; - for (const rec_t* rec = page_rec_get_next( + for (const rec_t* rec = page_rec_get_next_const( page_get_infimum_rec(block->page.frame)); - !page_rec_is_supremum(rec); + rec && !page_rec_is_supremum(rec); rec = page_rec_get_next_const(rec)) { rtr_mbr_t mbr; double rec_area; diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index 1e2125240324c..8ca8681bce9d1 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2016, 2018, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2023, 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 @@ -44,7 +44,6 @@ Created 2014/01/16 Jimmy Yang static bool rtr_cur_restore_position( - ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ btr_cur_t* cursor, /*!< in: detached persistent cursor */ ulint level, /*!< in: index level */ mtr_t* mtr); /*!< in: mtr */ @@ -74,6 +73,70 @@ rtr_adjust_parent_path( } } +/** Latches the leaf page or pages requested. +@param[in] block_savepoint leaf page where the search converged +@param[in] latch_mode BTR_SEARCH_LEAF, ... +@param[in] cursor cursor +@param[in] mtr mini-transaction */ +static void +rtr_latch_leaves( + ulint block_savepoint, + btr_latch_mode latch_mode, + btr_cur_t* cursor, + mtr_t* mtr) +{ + compile_time_assert(int(MTR_MEMO_PAGE_S_FIX) == int(RW_S_LATCH)); + compile_time_assert(int(MTR_MEMO_PAGE_X_FIX) == int(RW_X_LATCH)); + compile_time_assert(int(MTR_MEMO_PAGE_SX_FIX) == int(RW_SX_LATCH)); + + buf_block_t* block = mtr->at_savepoint(block_savepoint); + + ut_ad(block->page.id().space() == cursor->index()->table->space->id); + ut_ad(block->page.in_file()); + ut_ad(mtr->memo_contains_flagged(&cursor->index()->lock, + MTR_MEMO_S_LOCK + | MTR_MEMO_X_LOCK + | MTR_MEMO_SX_LOCK)); + + switch (latch_mode) { + uint32_t left_page_no; + uint32_t right_page_no; + default: + ut_ad(latch_mode == BTR_CONT_MODIFY_TREE); + break; + case BTR_MODIFY_TREE: + /* It is exclusive for other operations which calls + btr_page_set_prev() */ + ut_ad(mtr->memo_contains_flagged(&cursor->index()->lock, + MTR_MEMO_X_LOCK + | MTR_MEMO_SX_LOCK)); + /* x-latch also siblings from left to right */ + left_page_no = btr_page_get_prev(block->page.frame); + + if (left_page_no != FIL_NULL) { + btr_block_get(*cursor->index(), left_page_no, RW_X_LATCH, + true, mtr); + } + + mtr->upgrade_buffer_fix(block_savepoint, RW_X_LATCH); + + right_page_no = btr_page_get_next(block->page.frame); + + if (right_page_no != FIL_NULL) { + btr_block_get(*cursor->index(), right_page_no, + RW_X_LATCH, true, mtr); + } + break; + case BTR_SEARCH_LEAF: + case BTR_MODIFY_LEAF: + rw_lock_type_t mode = + rw_lock_type_t(latch_mode & (RW_X_LATCH | RW_S_LATCH)); + static_assert(int{RW_S_LATCH} == int{BTR_SEARCH_LEAF}, ""); + static_assert(int{RW_X_LATCH} == int{BTR_MODIFY_LEAF}, ""); + mtr->upgrade_buffer_fix(block_savepoint, mode); + } +} + /*************************************************************//** Find the next matching record. This function is used by search or record locating during index delete/update. @@ -95,17 +158,15 @@ rtr_pcur_getnext_from_path( /*!< in: index tree locked */ mtr_t* mtr) /*!< in: mtr */ { - dict_index_t* index = btr_cur->index; + dict_index_t* index = btr_cur->index(); bool found = false; page_cur_t* page_cursor; ulint level = 0; node_visit_t next_rec; rtr_info_t* rtr_info = btr_cur->rtr_info; node_seq_t page_ssn; - ulint my_latch_mode; ulint skip_parent = false; bool new_split = false; - bool need_parent; bool for_delete = false; bool for_undo_ins = false; @@ -116,7 +177,7 @@ rtr_pcur_getnext_from_path( ut_ad(dtuple_get_n_fields_cmp(tuple)); - my_latch_mode = BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode); + const auto my_latch_mode = BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode); for_delete = latch_mode & BTR_RTREE_DELETE_MARK; for_undo_ins = latch_mode & BTR_RTREE_UNDO_INS; @@ -131,13 +192,13 @@ rtr_pcur_getnext_from_path( /* Whether need to track parent information. Only need so when we do tree altering operations (such as index page merge) */ - need_parent = ((my_latch_mode == BTR_MODIFY_TREE - || my_latch_mode == BTR_CONT_MODIFY_TREE) - && mode == PAGE_CUR_RTREE_LOCATE); + static_assert(BTR_CONT_MODIFY_TREE == (4 | BTR_MODIFY_TREE), ""); + + const bool need_parent = mode == PAGE_CUR_RTREE_LOCATE + && (my_latch_mode | 4) == BTR_CONT_MODIFY_TREE; if (!index_locked) { - ut_ad(latch_mode & BTR_SEARCH_LEAF - || latch_mode & BTR_MODIFY_LEAF); + ut_ad(mtr->is_empty()); mtr_s_lock_index(index, mtr); } else { ut_ad(mtr->memo_contains_flagged(&index->lock, @@ -156,15 +217,13 @@ rtr_pcur_getnext_from_path( buf_block_t* block; node_seq_t path_ssn; const page_t* page; - ulint rw_latch = RW_X_LATCH; - ulint tree_idx; + rw_lock_type_t rw_latch; mysql_mutex_lock(&rtr_info->rtr_path_mutex); next_rec = rtr_info->path->back(); rtr_info->path->pop_back(); level = next_rec.level; path_ssn = next_rec.seq_no; - tree_idx = btr_cur->tree_height - level - 1; /* Maintain the parent path info as well, if needed */ if (need_parent && !skip_parent && !new_split) { @@ -215,64 +274,36 @@ rtr_pcur_getnext_from_path( One reason for pre-latch is that we might need to position some parent position (requires latch) during search */ if (level == 0) { - /* S latched for SEARCH_LEAF, and X latched - for MODIFY_LEAF */ - if (my_latch_mode <= BTR_MODIFY_LEAF) { - rw_latch = my_latch_mode; - } - - if (my_latch_mode == BTR_CONT_MODIFY_TREE - || my_latch_mode == BTR_MODIFY_TREE) { - rw_latch = RW_NO_LATCH; - } - - } else if (level == target_level) { + static_assert(ulint{BTR_SEARCH_LEAF} == + ulint{RW_S_LATCH}, ""); + static_assert(ulint{BTR_MODIFY_LEAF} == + ulint{RW_X_LATCH}, ""); + rw_latch = (my_latch_mode | 4) == BTR_CONT_MODIFY_TREE + ? RW_NO_LATCH + : rw_lock_type_t(my_latch_mode); + } else { rw_latch = RW_X_LATCH; } - /* Release previous locked blocks */ - if (my_latch_mode != BTR_SEARCH_LEAF) { - for (ulint idx = 0; idx < btr_cur->tree_height; - idx++) { - if (rtr_info->tree_blocks[idx]) { - mtr_release_block_at_savepoint( - mtr, - rtr_info->tree_savepoints[idx], - rtr_info->tree_blocks[idx]); - rtr_info->tree_blocks[idx] = NULL; - } - } - for (ulint idx = RTR_MAX_LEVELS; idx < RTR_MAX_LEVELS + 3; - idx++) { - if (rtr_info->tree_blocks[idx]) { - mtr_release_block_at_savepoint( - mtr, - rtr_info->tree_savepoints[idx], - rtr_info->tree_blocks[idx]); - rtr_info->tree_blocks[idx] = NULL; - } - } + if (my_latch_mode == BTR_MODIFY_LEAF) { + mtr->rollback_to_savepoint(1); } - /* set up savepoint to record any locks to be taken */ - rtr_info->tree_savepoints[tree_idx] = mtr_set_savepoint(mtr); - - ut_ad(my_latch_mode == BTR_MODIFY_TREE - || my_latch_mode == BTR_CONT_MODIFY_TREE + ut_ad((my_latch_mode | 4) == BTR_CONT_MODIFY_TREE || !page_is_leaf(btr_cur_get_page(btr_cur)) || !btr_cur->page_cur.block->page.lock.have_any()); + const auto block_savepoint = mtr->get_savepoint(); block = buf_page_get_gen( page_id_t(index->table->space_id, next_rec.page_no), zip_size, rw_latch, NULL, BUF_GET, mtr); - if (block == NULL) { - continue; + if (!block) { + found = false; + break; } - rtr_info->tree_blocks[tree_idx] = block; - page = buf_block_get_frame(block); page_ssn = page_get_ssn_id(page); @@ -305,20 +336,20 @@ rtr_pcur_getnext_from_path( page_cursor = btr_cur_get_page_cur(btr_cur); page_cursor->rec = NULL; + page_cursor->block = block; if (mode == PAGE_CUR_RTREE_LOCATE) { - if (level == target_level && level == 0) { - ulint low_match; + if (target_level == 0 && level == 0) { + ulint low_match = 0, up_match = 0; found = false; - low_match = page_cur_search( - block, index, tuple, - PAGE_CUR_LE, - btr_cur_get_page_cur(btr_cur)); - - if (low_match == dtuple_get_n_fields_cmp( - tuple)) { + if (!page_cur_search_with_match( + tuple, PAGE_CUR_LE, + &up_match, &low_match, + btr_cur_get_page_cur(btr_cur), nullptr) + && low_match + == dtuple_get_n_fields_cmp(tuple)) { rec_t* rec = btr_cur_get_rec(btr_cur); if (!rec_get_deleted_flag(rec, @@ -358,17 +389,12 @@ rtr_pcur_getnext_from_path( BTR_PCUR_IS_POSITIONED; r_cursor->latch_mode = my_latch_mode; btr_pcur_store_position(r_cursor, mtr); -#ifdef UNIV_DEBUG - ulint num_stored = - rtr_store_parent_path( - block, btr_cur, - rw_latch, level, mtr); - ut_ad(num_stored > 0); -#else + ut_d(ulint num_stored =) rtr_store_parent_path( - block, btr_cur, rw_latch, + block, btr_cur, + btr_latch_mode(rw_latch), level, mtr); -#endif /* UNIV_DEBUG */ + ut_ad(num_stored > 0); } } } else { @@ -408,24 +434,23 @@ rtr_pcur_getnext_from_path( if (found) { if (level == target_level) { - page_cur_t* r_cur;; + ut_ad(block + == mtr->at_savepoint(block_savepoint)); if (my_latch_mode == BTR_MODIFY_TREE && level == 0) { ut_ad(rw_latch == RW_NO_LATCH); - btr_cur_latch_leaves( - block, + rtr_latch_leaves( + block_savepoint, BTR_MODIFY_TREE, btr_cur, mtr); } - r_cur = btr_cur_get_page_cur(btr_cur); - page_cur_position( page_cur_get_rec(page_cursor), page_cur_get_block(page_cursor), - r_cur); + btr_cur_get_page_cur(btr_cur)); btr_cur->low_match = level != 0 ? DICT_INDEX_SPATIAL_NODEPTR_SIZE + 1 @@ -437,24 +462,18 @@ rtr_pcur_getnext_from_path( last node just located */ skip_parent = true; } else { - /* Release latch on the current page */ - ut_ad(rtr_info->tree_blocks[tree_idx]); - - mtr_release_block_at_savepoint( - mtr, rtr_info->tree_savepoints[tree_idx], - rtr_info->tree_blocks[tree_idx]); - rtr_info->tree_blocks[tree_idx] = NULL; + mtr->release_last_page(); } } while (!rtr_info->path->empty()); const rec_t* rec = btr_cur_get_rec(btr_cur); - if (page_rec_is_infimum(rec) || page_rec_is_supremum(rec)) { - mtr_commit(mtr); - mtr_start(mtr); + if (!page_rec_is_user_rec(rec)) { + mtr->commit(); + mtr->start(); } else if (!index_locked) { - mtr_memo_release(mtr, &index->lock, MTR_MEMO_X_LOCK); + mtr->release(index->lock); } return(found); @@ -504,88 +523,553 @@ rtr_pcur_move_to_next( false, mtr)); } +#ifdef UNIV_DEBUG /*************************************************************//** Check if the cursor holds record pointing to the specified child page @return true if it is (pointing to the child page) false otherwise */ -static -bool -rtr_compare_cursor_rec( -/*===================*/ - dict_index_t* index, /*!< in: index */ - btr_cur_t* cursor, /*!< in: Cursor to check */ - ulint page_no, /*!< in: desired child page number */ - mem_heap_t** heap) /*!< in: memory heap */ +static void rtr_compare_cursor_rec(const rec_t *rec, dict_index_t *index, + ulint page_no) { - const rec_t* rec; - rec_offs* offsets; + if (!rec) + return; + mem_heap_t *heap= nullptr; + rec_offs *offsets= rec_get_offsets(rec, index, nullptr, 0, + ULINT_UNDEFINED, &heap); + ut_ad(btr_node_ptr_get_child_page_no(rec, offsets) == page_no); + mem_heap_free(heap); +} +#endif - rec = btr_cur_get_rec(cursor); +TRANSACTIONAL_TARGET +dberr_t rtr_search_to_nth_level(ulint level, const dtuple_t *tuple, + page_cur_mode_t mode, + btr_latch_mode latch_mode, + btr_cur_t *cur, mtr_t *mtr) +{ + page_cur_mode_t page_mode; + page_cur_mode_t search_mode= PAGE_CUR_UNSUPP; + + bool mbr_adj= false; + bool found= false; + dict_index_t *const index= cur->index(); + + mem_heap_t *heap= nullptr; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs *offsets= offsets_; + rec_offs_init(offsets_); + ut_ad(level == 0 || mode == PAGE_CUR_LE || RTREE_SEARCH_MODE(mode)); + ut_ad(dict_index_check_search_tuple(index, tuple)); + ut_ad(dtuple_check_typed(tuple)); + ut_ad(index->is_spatial()); + ut_ad(index->page != FIL_NULL); + + MEM_UNDEFINED(&cur->up_match, sizeof cur->up_match); + MEM_UNDEFINED(&cur->up_bytes, sizeof cur->up_bytes); + MEM_UNDEFINED(&cur->low_match, sizeof cur->low_match); + MEM_UNDEFINED(&cur->low_bytes, sizeof cur->low_bytes); + ut_d(cur->up_match= ULINT_UNDEFINED); + ut_d(cur->low_match= ULINT_UNDEFINED); + + const bool latch_by_caller= latch_mode & BTR_ALREADY_S_LATCHED; + + ut_ad(!latch_by_caller + || mtr->memo_contains_flagged(&index->lock, MTR_MEMO_S_LOCK + | MTR_MEMO_SX_LOCK)); + latch_mode= BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode); + + ut_ad(!latch_by_caller || latch_mode == BTR_SEARCH_LEAF || + latch_mode == BTR_MODIFY_LEAF); + + cur->flag= BTR_CUR_BINARY; + +#ifndef BTR_CUR_ADAPT + buf_block_t *guess= nullptr; +#else + btr_search_t *const info= btr_search_get_info(index); + buf_block_t *guess= info->root_guess; +#endif - offsets = rec_get_offsets(rec, index, NULL, 0, ULINT_UNDEFINED, heap); + /* Store the position of the tree latch we push to mtr so that we + know how to release it when we have latched leaf node(s) */ + + const ulint savepoint= mtr->get_savepoint(); + + rw_lock_type_t upper_rw_latch, root_leaf_rw_latch= RW_NO_LATCH; + + switch (latch_mode) { + case BTR_MODIFY_TREE: + mtr_x_lock_index(index, mtr); + upper_rw_latch= root_leaf_rw_latch= RW_X_LATCH; + break; + case BTR_CONT_MODIFY_TREE: + ut_ad(mtr->memo_contains_flagged(&index->lock, MTR_MEMO_X_LOCK | + MTR_MEMO_SX_LOCK)); + upper_rw_latch= RW_X_LATCH; + break; + default: + ut_ad(latch_mode != BTR_MODIFY_PREV); + ut_ad(latch_mode != BTR_SEARCH_PREV); + if (!latch_by_caller) + mtr_s_lock_index(index, mtr); + upper_rw_latch= root_leaf_rw_latch= RW_S_LATCH; + if (latch_mode == BTR_MODIFY_LEAF) + root_leaf_rw_latch= RW_X_LATCH; + } + + auto root_savepoint= mtr->get_savepoint(); + const ulint zip_size= index->table->space->zip_size(); + + /* Start with the root page. */ + page_id_t page_id(index->table->space_id, index->page); + + ulint up_match= 0, up_bytes= 0, low_match= 0, low_bytes= 0; + ulint height= ULINT_UNDEFINED; + + /* We use these modified search modes on non-leaf levels of the + B-tree. These let us end up in the right B-tree leaf. In that leaf + we use the original search mode. */ + + switch (mode) { + case PAGE_CUR_GE: + page_mode= PAGE_CUR_L; + break; + case PAGE_CUR_G: + page_mode= PAGE_CUR_LE; + break; + default: +#ifdef PAGE_CUR_LE_OR_EXTENDS + ut_ad(mode == PAGE_CUR_L || mode == PAGE_CUR_LE + || RTREE_SEARCH_MODE(mode) + || mode == PAGE_CUR_LE_OR_EXTENDS); +#else /* PAGE_CUR_LE_OR_EXTENDS */ + ut_ad(mode == PAGE_CUR_L || mode == PAGE_CUR_LE + || RTREE_SEARCH_MODE(mode)); +#endif /* PAGE_CUR_LE_OR_EXTENDS */ + page_mode= mode; + break; + } + + search_loop: + auto buf_mode= BUF_GET; + ulint rw_latch= RW_NO_LATCH; + + if (height) + { + /* We are about to fetch the root or a non-leaf page. */ + if (latch_mode != BTR_MODIFY_TREE || height == level) + /* If doesn't have SX or X latch of index, + each page should be latched before reading. */ + rw_latch= upper_rw_latch; + } + else if (latch_mode <= BTR_MODIFY_LEAF) + rw_latch= latch_mode; + + dberr_t err; + auto block_savepoint= mtr->get_savepoint(); + buf_block_t *block= buf_page_get_gen(page_id, zip_size, rw_latch, guess, + buf_mode, mtr, &err, false); + if (!block) + { + if (err == DB_DECRYPTION_FAILED) + btr_decryption_failed(*index); + func_exit: + if (UNIV_LIKELY_NULL(heap)) + mem_heap_free(heap); + + if (mbr_adj) + /* remember that we will need to adjust parent MBR */ + cur->rtr_info->mbr_adj= true; + + return err; + } + + const page_t *page= buf_block_get_frame(block); +#ifdef UNIV_ZIP_DEBUG + if (rw_latch != RW_NO_LATCH) { + const page_zip_des_t *page_zip= buf_block_get_page_zip(block); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); + } +#endif /* UNIV_ZIP_DEBUG */ + + ut_ad(fil_page_index_page_check(page)); + ut_ad(index->id == btr_page_get_index_id(page)); + + if (height != ULINT_UNDEFINED); + else if (page_is_leaf(page) && + rw_latch != RW_NO_LATCH && rw_latch != root_leaf_rw_latch) + { + /* The root page is also a leaf page (root_leaf). + We should reacquire the page, because the root page + is latched differently from leaf pages. */ + ut_ad(root_leaf_rw_latch != RW_NO_LATCH); + ut_ad(rw_latch == RW_S_LATCH || rw_latch == RW_SX_LATCH); + + ut_ad(block == mtr->at_savepoint(block_savepoint)); + mtr->rollback_to_savepoint(block_savepoint); + + upper_rw_latch= root_leaf_rw_latch; + goto search_loop; + } + else + { + /* We are in the root node */ + + height= btr_page_get_level(page); + cur->tree_height= height + 1; + + ut_ad(cur->rtr_info); + + /* If SSN in memory is not initialized, fetch it from root page */ + if (!rtr_get_current_ssn_id(index)) + /* FIXME: do this in dict_load_table_one() */ + index->set_ssn(page_get_ssn_id(page) + 1); + + /* Save the MBR */ + cur->rtr_info->thr= cur->thr; + rtr_get_mbr_from_tuple(tuple, &cur->rtr_info->mbr); + +#ifdef BTR_CUR_ADAPT + info->root_guess= block; +#endif + } + + if (height == 0) { + if (rw_latch == RW_NO_LATCH) + { + ut_ad(block == mtr->at_savepoint(block_savepoint)); + rtr_latch_leaves(block_savepoint, latch_mode, cur, mtr); + } + + switch (latch_mode) { + case BTR_MODIFY_TREE: + case BTR_CONT_MODIFY_TREE: + break; + default: + if (!latch_by_caller) + { + /* Release the tree s-latch */ + mtr->rollback_to_savepoint(savepoint, + savepoint + 1); + block_savepoint--; + root_savepoint--; + } + /* release upper blocks */ + if (savepoint < block_savepoint) + mtr->rollback_to_savepoint(savepoint, block_savepoint); + } + + page_mode= mode; + } + + /* Remember the page search mode */ + search_mode= page_mode; + + /* Some adjustment on search mode, when the page search mode is + PAGE_CUR_RTREE_LOCATE or PAGE_CUR_RTREE_INSERT, as we are searching + with MBRs. When it is not the target level, we should search all + sub-trees that "CONTAIN" the search range/MBR. When it is at the + target level, the search becomes PAGE_CUR_LE */ + + if (page_mode == PAGE_CUR_RTREE_INSERT) + { + page_mode= (level == height) + ? PAGE_CUR_LE + : PAGE_CUR_RTREE_INSERT; + + ut_ad(!page_is_leaf(page) || page_mode == PAGE_CUR_LE); + } + else if (page_mode == PAGE_CUR_RTREE_LOCATE && level == height) + page_mode= level == 0 ? PAGE_CUR_LE : PAGE_CUR_RTREE_GET_FATHER; + + up_match= 0; + low_match= 0; + + if (latch_mode == BTR_MODIFY_TREE || latch_mode == BTR_CONT_MODIFY_TREE) + /* Tree are locked, no need for Page Lock to protect the "path" */ + cur->rtr_info->need_page_lock= false; + + cur->page_cur.block= block; + + if (page_mode >= PAGE_CUR_CONTAIN) + { + found= rtr_cur_search_with_match(block, index, tuple, page_mode, + &cur->page_cur, cur->rtr_info); + + /* Need to use BTR_MODIFY_TREE to do the MBR adjustment */ + if (search_mode == PAGE_CUR_RTREE_INSERT && cur->rtr_info->mbr_adj) { + static_assert(BTR_MODIFY_TREE == (8 | BTR_MODIFY_LEAF), ""); + + if (!(latch_mode & 8)) + /* Parent MBR needs updated, should retry with BTR_MODIFY_TREE */ + goto func_exit; + + cur->rtr_info->mbr_adj= false; + mbr_adj= true; + } + + if (found && page_mode == PAGE_CUR_RTREE_GET_FATHER) + cur->low_match= DICT_INDEX_SPATIAL_NODEPTR_SIZE + 1; + } + else + { + /* Search for complete index fields. */ + up_bytes= low_bytes= 0; + if (page_cur_search_with_match(tuple, page_mode, &up_match, + &low_match, &cur->page_cur, nullptr)) { + err= DB_CORRUPTION; + goto func_exit; + } + } - return(btr_node_ptr_get_child_page_no(rec, offsets) == page_no); + /* If this is the desired level, leave the loop */ + + ut_ad(height == btr_page_get_level(btr_cur_get_page(cur))); + + /* Add Predicate lock if it is serializable isolation + and only if it is in the search case */ + if (mode >= PAGE_CUR_CONTAIN && mode != PAGE_CUR_RTREE_INSERT && + mode != PAGE_CUR_RTREE_LOCATE && cur->rtr_info->need_prdt_lock) + { + lock_prdt_t prdt; + + { + trx_t* trx= thr_get_trx(cur->thr); + TMLockTrxGuard g{TMLockTrxArgs(*trx)}; + lock_init_prdt_from_mbr(&prdt, &cur->rtr_info->mbr, mode, + trx->lock.lock_heap); + } + + if (rw_latch == RW_NO_LATCH && height != 0) + block->page.lock.s_lock(); + + lock_prdt_lock(block, &prdt, index, LOCK_S, LOCK_PREDICATE, cur->thr); + + if (rw_latch == RW_NO_LATCH && height != 0) + block->page.lock.s_unlock(); + } + + if (level != height) + { + ut_ad(height > 0); + + height--; + guess= nullptr; + + const rec_t *node_ptr= btr_cur_get_rec(cur); + + offsets= rec_get_offsets(node_ptr, index, offsets, 0, + ULINT_UNDEFINED, &heap); + + if (page_rec_is_supremum(node_ptr)) + { + cur->low_match= 0; + cur->up_match= 0; + goto func_exit; + } + + /* If we are doing insertion or record locating, + remember the tree nodes we visited */ + if (page_mode == PAGE_CUR_RTREE_INSERT || + (search_mode == PAGE_CUR_RTREE_LOCATE && + latch_mode != BTR_MODIFY_LEAF)) + { + const bool add_latch= latch_mode == BTR_MODIFY_TREE && + rw_latch == RW_NO_LATCH; + + if (add_latch) + { + ut_ad(mtr->memo_contains_flagged(&index->lock, MTR_MEMO_X_LOCK | + MTR_MEMO_SX_LOCK)); + block->page.lock.s_lock(); + } + + /* Store the parent cursor location */ + ut_d(auto num_stored=) + rtr_store_parent_path(block, cur, latch_mode, height + 1, mtr); + + if (page_mode == PAGE_CUR_RTREE_INSERT) + { + btr_pcur_t *r_cursor= rtr_get_parent_cursor(cur, height + 1, true); + /* If it is insertion, there should be only one parent for + each level traverse */ + ut_ad(num_stored == 1); + node_ptr= btr_pcur_get_rec(r_cursor); + } + + if (add_latch) + block->page.lock.s_unlock(); + + ut_ad(!page_rec_is_supremum(node_ptr)); + } + + ut_ad(page_mode == search_mode || + (page_mode == PAGE_CUR_WITHIN && + search_mode == PAGE_CUR_RTREE_LOCATE)); + page_mode= search_mode; + + if (height == level && latch_mode == BTR_MODIFY_TREE) + { + ut_ad(upper_rw_latch == RW_X_LATCH); + for (auto i= root_savepoint, n= mtr->get_savepoint(); i < n; i++) + mtr->upgrade_buffer_fix(i, RW_X_LATCH); + } + + /* Go to the child node */ + page_id.set_page_no(btr_node_ptr_get_child_page_no(node_ptr, offsets)); + + if (page_mode >= PAGE_CUR_CONTAIN && page_mode != PAGE_CUR_RTREE_INSERT) + { + rtr_node_path_t *path= cur->rtr_info->path; + + if (found && !path->empty()) + { + ut_ad(path->back().page_no == page_id.page_no()); + path->pop_back(); +#ifdef UNIV_DEBUG + if (page_mode == PAGE_CUR_RTREE_LOCATE && + latch_mode != BTR_MODIFY_LEAF) + { + btr_pcur_t* pcur= cur->rtr_info->parent_path->back().cursor; + rec_t *my_node_ptr= btr_pcur_get_rec(pcur); + + offsets= rec_get_offsets(my_node_ptr, index, offsets, + 0, ULINT_UNDEFINED, &heap); + + ut_ad(page_id.page_no() == + btr_node_ptr_get_child_page_no(my_node_ptr, offsets)); + } +#endif + } + } + + goto search_loop; + } + + if (level) + { + if (upper_rw_latch == RW_NO_LATCH) + { + ut_ad(latch_mode == BTR_CONT_MODIFY_TREE); + btr_block_get(*index, page_id.page_no(), RW_X_LATCH, false, mtr, &err); + } + else + { + ut_ad(mtr->memo_contains_flagged(block, upper_rw_latch)); + ut_ad(!latch_by_caller); + } + + if (page_mode <= PAGE_CUR_LE) + { + cur->low_match= low_match; + cur->up_match= up_match; + } + } + else + { + cur->low_match= low_match; + cur->low_bytes= low_bytes; + cur->up_match= up_match; + cur->up_bytes= up_bytes; + + ut_ad(up_match != ULINT_UNDEFINED || mode != PAGE_CUR_GE); + ut_ad(up_match != ULINT_UNDEFINED || mode != PAGE_CUR_LE); + ut_ad(low_match != ULINT_UNDEFINED || mode != PAGE_CUR_LE); + } + + goto func_exit; +} + +dberr_t rtr_search_leaf(btr_cur_t *cur, const dtuple_t *tuple, + btr_latch_mode latch_mode, + mtr_t *mtr, page_cur_mode_t mode) +{ + return rtr_search_to_nth_level(0, tuple, mode, latch_mode, cur, mtr); +} + +/** Search for a spatial index leaf page record. +@param pcur cursor +@param tuple search tuple +@param mode search mode +@param mtr mini-transaction */ +dberr_t rtr_search_leaf(btr_pcur_t *pcur, const dtuple_t *tuple, + page_cur_mode_t mode, mtr_t *mtr) +{ +#ifdef UNIV_DEBUG + switch (mode) { + case PAGE_CUR_CONTAIN: + case PAGE_CUR_INTERSECT: + case PAGE_CUR_WITHIN: + case PAGE_CUR_DISJOINT: + case PAGE_CUR_MBR_EQUAL: + break; + default: + ut_ad("invalid mode" == 0); + } +#endif + pcur->latch_mode= BTR_SEARCH_LEAF; + pcur->search_mode= mode; + pcur->pos_state= BTR_PCUR_IS_POSITIONED; + pcur->trx_if_known= nullptr; + return rtr_search_leaf(&pcur->btr_cur, tuple, BTR_SEARCH_LEAF, mtr, mode); } /**************************************************************//** Initializes and opens a persistent cursor to an index tree. It should be -closed with btr_pcur_close. Mainly called by row_search_index_entry() */ -void -rtr_pcur_open( - dict_index_t* index, /*!< in: index */ +closed with btr_pcur_close. */ +bool rtr_search( const dtuple_t* tuple, /*!< in: tuple on which search done */ - page_cur_mode_t mode, /*!< in: PAGE_CUR_RTREE_LOCATE, ... */ - ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */ + btr_latch_mode latch_mode,/*!< in: BTR_MODIFY_LEAF, ... */ btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ mtr_t* mtr) /*!< in: mtr */ { - btr_cur_t* btr_cursor; - ulint n_fields; - ulint low_match; - rec_t* rec; - - ut_ad(latch_mode & BTR_MODIFY_LEAF || latch_mode & BTR_MODIFY_TREE); - ut_ad(mode == PAGE_CUR_RTREE_LOCATE); + static_assert(BTR_MODIFY_TREE == (8 | BTR_MODIFY_LEAF), ""); + ut_ad(latch_mode & BTR_MODIFY_LEAF); + ut_ad(!(latch_mode & BTR_ALREADY_S_LATCHED)); + ut_ad(mtr->is_empty()); /* Initialize the cursor */ btr_pcur_init(cursor); cursor->latch_mode = BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode); - cursor->search_mode = mode; + cursor->search_mode = PAGE_CUR_RTREE_LOCATE; + cursor->trx_if_known = nullptr; + + if (latch_mode & 8) { + mtr_x_lock_index(cursor->index(), mtr); + } else { + latch_mode + = btr_latch_mode(latch_mode | BTR_ALREADY_S_LATCHED); + mtr_sx_lock_index(cursor->index(), mtr); + } /* Search with the tree cursor */ - btr_cursor = btr_pcur_get_btr_cur(cursor); + btr_cur_t* btr_cursor = btr_pcur_get_btr_cur(cursor); - btr_cursor->rtr_info = rtr_create_rtr_info(false, false, - btr_cursor, index); + btr_cursor->rtr_info + = rtr_create_rtr_info(false, false, + btr_cursor, cursor->index()); - /* Purge will SX lock the tree instead of take Page Locks */ if (btr_cursor->thr) { btr_cursor->rtr_info->need_page_lock = true; btr_cursor->rtr_info->thr = btr_cursor->thr; } - if ((latch_mode & BTR_MODIFY_TREE) && index->lock.have_u_not_x()) { - index->lock.u_x_upgrade(SRW_LOCK_CALL); - mtr->lock_upgrade(index->lock); + if (rtr_search_leaf(btr_cursor, tuple, latch_mode, mtr) + != DB_SUCCESS) { + return true; } - btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode, - btr_cursor, 0, mtr); cursor->pos_state = BTR_PCUR_IS_POSITIONED; - cursor->trx_if_known = NULL; + const rec_t* rec = btr_pcur_get_rec(cursor); - low_match = btr_pcur_get_low_match(cursor); + const bool d= rec_get_deleted_flag( + rec, cursor->index()->table->not_redundant()); - rec = btr_pcur_get_rec(cursor); - - n_fields = dtuple_get_n_fields(tuple); - - const bool d= rec_get_deleted_flag(rec, index->table->not_redundant()); - - if (page_rec_is_infimum(rec) || low_match != n_fields + if (page_rec_is_infimum(rec) + || btr_pcur_get_low_match(cursor) != dtuple_get_n_fields(tuple) || (d && latch_mode & (BTR_RTREE_DELETE_MARK | BTR_RTREE_UNDO_INS))) { @@ -593,73 +1077,47 @@ rtr_pcur_open( btr_cursor->rtr_info->fd_del = true; btr_cursor->low_match = 0; } - /* Did not find matched row in first dive. Release - latched block if any before search more pages */ - if (latch_mode & BTR_MODIFY_LEAF) { - ulint tree_idx = btr_cursor->tree_height - 1; - rtr_info_t* rtr_info = btr_cursor->rtr_info; - - if (rtr_info->tree_blocks[tree_idx]) { - mtr_release_block_at_savepoint( - mtr, - rtr_info->tree_savepoints[tree_idx], - rtr_info->tree_blocks[tree_idx]); - rtr_info->tree_blocks[tree_idx] = NULL; - } - } - bool ret = rtr_pcur_getnext_from_path( - tuple, mode, btr_cursor, 0, latch_mode, - latch_mode & (BTR_MODIFY_TREE | BTR_ALREADY_S_LATCHED), - mtr); + mtr->rollback_to_savepoint(1); - if (ret) { - low_match = btr_pcur_get_low_match(cursor); - ut_ad(low_match == n_fields); + if (!rtr_pcur_getnext_from_path(tuple, PAGE_CUR_RTREE_LOCATE, + btr_cursor, 0, latch_mode, + true, mtr)) { + return true; } + + ut_ad(btr_pcur_get_low_match(cursor) + == dtuple_get_n_fields(tuple)); } + + if (!(latch_mode & 8)) { + mtr->rollback_to_savepoint(0, 1); + } + + return false; } /* Get the rtree page father. -@param[in] index rtree index -@param[in] block child page in the index -@param[in] mtr mtr +@param[in,out] mtr mtr @param[in] sea_cur search cursor, contains information about parent nodes in search -@param[in] cursor cursor on node pointer record, - its page x-latched */ -void -rtr_page_get_father( - dict_index_t* index, - buf_block_t* block, - mtr_t* mtr, - btr_cur_t* sea_cur, - btr_cur_t* cursor) +@param[out] cursor cursor on node pointer record, + its page x-latched +@return whether the cursor was successfully positioned */ +bool rtr_page_get_father(mtr_t *mtr, btr_cur_t *sea_cur, btr_cur_t *cursor) { - mem_heap_t* heap = mem_heap_create(100); -#ifdef UNIV_DEBUG - rec_offs* offsets; - - offsets = rtr_page_get_father_block( - NULL, heap, index, block, mtr, sea_cur, cursor); - - ulint page_no = btr_node_ptr_get_child_page_no(cursor->page_cur.rec, - offsets); - - ut_ad(page_no == block->page.id().page_no()); -#else - rtr_page_get_father_block( - NULL, heap, index, block, mtr, sea_cur, cursor); -#endif - - mem_heap_free(heap); + mem_heap_t *heap = mem_heap_create(100); + rec_offs *offsets= rtr_page_get_father_block(nullptr, heap, + mtr, sea_cur, cursor); + mem_heap_free(heap); + return offsets != nullptr; } +MY_ATTRIBUTE((warn_unused_result)) /********************************************************************//** Returns the upper level node pointer to a R-Tree page. It is assumed that mtr holds an x-latch on the tree. */ -static void rtr_get_father_node( - dict_index_t* index, /*!< in: index */ +static const rec_t* rtr_get_father_node( ulint level, /*!< in: the tree level of search */ const dtuple_t* tuple, /*!< in: data tuple; NOTE: n_fields_cmp in tuple must be set so that it cannot get @@ -670,28 +1128,18 @@ static void rtr_get_father_node( ulint page_no,/*!< Current page no */ mtr_t* mtr) /*!< in: mtr */ { - mem_heap_t* heap = NULL; - bool ret = false; - const rec_t* rec; - ulint n_fields; - bool new_rtr = false; + const rec_t* rec = nullptr; + auto had_rtr = btr_cur->rtr_info; + dict_index_t* const index = btr_cur->index(); /* Try to optimally locate the parent node. Level should always less than sea_cur->tree_height unless the root is splitting */ if (sea_cur && sea_cur->tree_height > level) { ut_ad(mtr->memo_contains_flagged(&index->lock, MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); - ret = rtr_cur_restore_position( - BTR_CONT_MODIFY_TREE, sea_cur, level, mtr); - - /* Once we block shrink tree nodes while there are - active search on it, this optimal locating should always - succeeds */ - ut_ad(ret); - - if (ret) { + if (rtr_cur_restore_position(sea_cur, level, mtr)) { btr_pcur_t* r_cursor = rtr_get_parent_cursor( - sea_cur, level, false); + sea_cur, level, false); rec = btr_pcur_get_rec(r_cursor); @@ -699,70 +1147,57 @@ static void rtr_get_father_node( page_cur_position(rec, btr_pcur_get_block(r_cursor), btr_cur_get_page_cur(btr_cur)); - btr_cur->rtr_info = sea_cur->rtr_info; + had_rtr = btr_cur->rtr_info = sea_cur->rtr_info; btr_cur->tree_height = sea_cur->tree_height; - ut_ad(rtr_compare_cursor_rec( - index, btr_cur, page_no, &heap)); - goto func_exit; } + goto func_exit; } /* We arrive here in one of two scenario 1) check table and btr_valide 2) index root page being raised */ - ut_ad(!sea_cur || sea_cur->tree_height == level); if (btr_cur->rtr_info) { rtr_clean_rtr_info(btr_cur->rtr_info, true); - } else { - new_rtr = true; } btr_cur->rtr_info = rtr_create_rtr_info(false, false, btr_cur, index); - if (sea_cur && sea_cur->tree_height == level) { - /* root split, and search the new root */ - btr_cur_search_to_nth_level( - index, level, tuple, PAGE_CUR_RTREE_LOCATE, - BTR_CONT_MODIFY_TREE, btr_cur, 0, mtr); - + if (rtr_search_to_nth_level(level, tuple, PAGE_CUR_RTREE_LOCATE, + BTR_CONT_MODIFY_TREE, btr_cur, mtr) + != DB_SUCCESS) { + } else if (sea_cur && sea_cur->tree_height == level) { + rec = btr_cur_get_rec(btr_cur); } else { /* btr_validate */ ut_ad(level >= 1); ut_ad(!sea_cur); - btr_cur_search_to_nth_level( - index, level, tuple, PAGE_CUR_RTREE_LOCATE, - BTR_CONT_MODIFY_TREE, btr_cur, 0, mtr); - rec = btr_cur_get_rec(btr_cur); - n_fields = dtuple_get_n_fields_cmp(tuple); + const ulint n_fields = dtuple_get_n_fields_cmp(tuple); if (page_rec_is_infimum(rec) || (btr_cur->low_match != n_fields)) { - ret = rtr_pcur_getnext_from_path( - tuple, PAGE_CUR_RTREE_LOCATE, btr_cur, - level, BTR_CONT_MODIFY_TREE, - true, mtr); - - ut_ad(ret && btr_cur->low_match == n_fields); + if (!rtr_pcur_getnext_from_path( + tuple, PAGE_CUR_RTREE_LOCATE, btr_cur, + level, BTR_CONT_MODIFY_TREE, true, mtr)) { + rec = nullptr; + } else { + ut_ad(btr_cur->low_match == n_fields); + rec = btr_cur_get_rec(btr_cur); + } } } - ret = rtr_compare_cursor_rec( - index, btr_cur, page_no, &heap); - - ut_ad(ret); - func_exit: - if (heap) { - mem_heap_free(heap); - } + ut_d(rtr_compare_cursor_rec(rec, index, page_no)); - if (new_rtr && btr_cur->rtr_info) { + if (!had_rtr && btr_cur->rtr_info) { rtr_clean_rtr_info(btr_cur->rtr_info, true); btr_cur->rtr_info = NULL; } + + return rec; } /** Returns the upper level node pointer to a R-Tree page. It is assumed @@ -780,8 +1215,6 @@ rtr_page_get_father_node_ptr( mtr_t* mtr) /*!< in: mtr */ { dtuple_t* tuple; - rec_t* user_rec; - rec_t* node_ptr; ulint level; ulint page_no; dict_index_t* index; @@ -790,15 +1223,14 @@ rtr_page_get_father_node_ptr( page_no = btr_cur_get_block(cursor)->page.id().page_no(); index = btr_cur_get_index(cursor); - ut_ad(srv_read_only_mode - || mtr->memo_contains_flagged(&index->lock, MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK)); + ut_ad(mtr->memo_contains_flagged(&index->lock, MTR_MEMO_X_LOCK + | MTR_MEMO_SX_LOCK)); ut_ad(dict_index_get_page(index) != page_no); level = btr_page_get_level(btr_cur_get_page(cursor)); - user_rec = btr_cur_get_rec(cursor); + const rec_t* user_rec = btr_cur_get_rec(cursor); ut_a(page_rec_is_user_rec(user_rec)); offsets = rec_get_offsets(user_rec, index, offsets, @@ -813,50 +1245,20 @@ rtr_page_get_father_node_ptr( sea_cur = NULL; } - rtr_get_father_node(index, level + 1, tuple, sea_cur, cursor, - page_no, mtr); + const rec_t* node_ptr = rtr_get_father_node(level + 1, tuple, + sea_cur, cursor, + page_no, mtr); + if (!node_ptr) { + return nullptr; + } - node_ptr = btr_cur_get_rec(cursor); ut_ad(!page_rec_is_comp(node_ptr) || rec_get_status(node_ptr) == REC_STATUS_NODE_PTR); offsets = rec_get_offsets(node_ptr, index, offsets, 0, ULINT_UNDEFINED, &heap); - ulint child_page = btr_node_ptr_get_child_page_no(node_ptr, offsets); - - if (child_page != page_no) { - const rec_t* print_rec; - - ib::fatal error; - - error << "Corruption of index " << index->name - << " of table " << index->table->name - << " parent page " << page_no - << " child page " << child_page; - - print_rec = page_rec_get_next( - page_get_infimum_rec(page_align(user_rec))); - offsets = rec_get_offsets(print_rec, index, offsets, - page_rec_is_leaf(user_rec) - ? index->n_fields : 0, - ULINT_UNDEFINED, &heap); - error << "; child "; - rec_print(error.m_oss, print_rec, - rec_get_info_bits(print_rec, rec_offs_comp(offsets)), - offsets); - offsets = rec_get_offsets(node_ptr, index, offsets, 0, - ULINT_UNDEFINED, &heap); - error << "; parent "; - rec_print(error.m_oss, print_rec, - rec_get_info_bits(print_rec, rec_offs_comp(offsets)), - offsets); - - error << ". You should dump + drop + reimport the table to" - " fix the corruption. If the crash happens at" - " database startup, see " - "https://mariadb.com/kb/en/library/innodb-recovery-modes/" - " about forcing" - " recovery. Then dump + drop + reimport."; + if (btr_node_ptr_get_child_page_no(node_ptr, offsets) != page_no) { + offsets = nullptr; } return(offsets); @@ -871,20 +1273,18 @@ rtr_page_get_father_block( /*======================*/ rec_offs* offsets,/*!< in: work area for the return value */ mem_heap_t* heap, /*!< in: memory heap to use */ - dict_index_t* index, /*!< in: b-tree index */ - buf_block_t* block, /*!< in: child page in the index */ mtr_t* mtr, /*!< in: mtr */ btr_cur_t* sea_cur,/*!< in: search cursor, contains information about parent nodes in search */ btr_cur_t* cursor) /*!< out: cursor on node pointer record, its page x-latched */ { - rec_t* rec = page_rec_get_next( - page_get_infimum_rec(buf_block_get_frame(block))); - btr_cur_position(index, rec, block, cursor); - - return(rtr_page_get_father_node_ptr(offsets, heap, sea_cur, - cursor, mtr)); + rec_t *rec= + page_rec_get_next(page_get_infimum_rec(cursor->block()->page.frame)); + if (!rec) + return nullptr; + cursor->page_cur.rec= rec; + return rtr_page_get_father_node_ptr(offsets, heap, sea_cur, cursor, mtr); } /*******************************************************************//** @@ -902,7 +1302,7 @@ rtr_create_rtr_info( { rtr_info_t* rtr_info; - index = index ? index : cursor->index; + index = index ? index : cursor->index(); ut_ad(index); rtr_info = static_cast(ut_zalloc_nokey(sizeof(*rtr_info))); @@ -972,32 +1372,10 @@ rtr_init_rtr_info( if (!reinit) { /* Reset all members. */ - rtr_info->path = NULL; - rtr_info->parent_path = NULL; - rtr_info->matches = NULL; - + memset(rtr_info, 0, sizeof *rtr_info); + static_assert(PAGE_CUR_UNSUPP == 0, "compatibility"); mysql_mutex_init(rtr_path_mutex_key, &rtr_info->rtr_path_mutex, nullptr); - - memset(rtr_info->tree_blocks, 0x0, - sizeof(rtr_info->tree_blocks)); - memset(rtr_info->tree_savepoints, 0x0, - sizeof(rtr_info->tree_savepoints)); - rtr_info->mbr.xmin = 0.0; - rtr_info->mbr.xmax = 0.0; - rtr_info->mbr.ymin = 0.0; - rtr_info->mbr.ymax = 0.0; - rtr_info->thr = NULL; - rtr_info->heap = NULL; - rtr_info->cursor = NULL; - rtr_info->index = NULL; - rtr_info->need_prdt_lock = false; - rtr_info->need_page_lock = false; - rtr_info->allocated = false; - rtr_info->mbr_adj = false; - rtr_info->fd_del = false; - rtr_info->search_tuple = NULL; - rtr_info->search_mode = PAGE_CUR_UNSUPP; } ut_ad(!rtr_info->matches || rtr_info->matches->matched_recs->empty()); @@ -1223,7 +1601,6 @@ struct optimistic_get static bool rtr_cur_restore_position( - ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ btr_cur_t* btr_cur, /*!< in: detached persistent cursor */ ulint level, /*!< in: index level */ mtr_t* mtr) /*!< in: mtr */ @@ -1239,6 +1616,7 @@ rtr_cur_restore_position( ut_ad(mtr->is_active()); index = btr_cur_get_index(btr_cur); + ut_ad(r_cursor->index() == btr_cur->index()); if (r_cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE || r_cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE) { @@ -1250,8 +1628,6 @@ rtr_cur_restore_position( r_cursor->modify_clock = 100; ); - ut_ad(latch_mode == BTR_CONT_MODIFY_TREE); - if (r_cursor->block_when_stored.run_with_hint( optimistic_get(r_cursor, mtr))) { ut_ad(r_cursor->pos_state == BTR_PCUR_IS_POSITIONED); @@ -1298,7 +1674,6 @@ rtr_cur_restore_position( /* Page has changed, for R-Tree, the page cannot be shrunk away, so we search the page and its right siblings */ - buf_block_t* block; node_seq_t page_ssn; const page_t* page; page_cur_t* page_cursor; @@ -1316,18 +1691,27 @@ rtr_cur_restore_position( ut_ad(r_cursor == node->cursor); search_again: - block = buf_page_get_gen( + ulint up_match = 0, low_match = 0; + + page_cursor->block = buf_page_get_gen( page_id_t(index->table->space_id, page_no), zip_size, RW_X_LATCH, NULL, BUF_GET, mtr); - ut_ad(block); + if (!page_cursor->block) { +corrupted: + ret = false; + goto func_exit; + } /* Get the page SSN */ - page = buf_block_get_frame(block); + page = buf_block_get_frame(page_cursor->block); page_ssn = page_get_ssn_id(page); - ulint low_match = page_cur_search( - block, index, tuple, PAGE_CUR_LE, page_cursor); + if (page_cur_search_with_match(tuple, PAGE_CUR_LE, + &up_match, &low_match, page_cursor, + nullptr)) { + goto corrupted; + } if (low_match == r_cursor->old_n_fields) { const rec_t* rec; @@ -1365,6 +1749,7 @@ rtr_cur_restore_position( goto search_again; } +func_exit: mem_heap_free(heap); return(ret); @@ -1418,7 +1803,7 @@ rtr_store_parent_path( /*==================*/ const buf_block_t* block, /*!< in: block of the page */ btr_cur_t* btr_cur,/*!< in/out: persistent cursor */ - ulint latch_mode, + btr_latch_mode latch_mode, /*!< in: latch_mode */ ulint level, /*!< in: index level */ mtr_t* mtr) /*!< in: mtr */ @@ -1477,7 +1862,7 @@ rtr_non_leaf_insert_stack_push( page_cur_position(rec, block, btr_pcur_get_page_cur(my_cursor)); - (btr_pcur_get_btr_cur(my_cursor))->index = index; + btr_pcur_get_page_cur(my_cursor)->index = index; new_seq = rtr_get_current_ssn_id(index); rtr_non_leaf_stack_push(path, block->page.id().page_no(), @@ -1685,13 +2070,20 @@ rtr_cur_search_with_match( mode = PAGE_CUR_WITHIN; } - rec = page_dir_slot_get_rec(page_dir_get_nth_slot(page, 0)); + rec = page_dir_slot_get_rec_validate(page_dir_get_nth_slot(page, 0)); + + if (UNIV_UNLIKELY(!rec)) { + return false; + } last_rec = rec; best_rec = rec; if (page_rec_is_infimum(rec)) { rec = page_rec_get_next_const(rec); + if (UNIV_UNLIKELY(!rec)) { + return false; + } } /* Check insert tuple size is larger than first rec, and try to @@ -1889,7 +2281,7 @@ rtr_cur_search_with_match( } /* All records on page are searched */ - if (page_rec_is_supremum(rec)) { + if (rec && page_rec_is_supremum(rec)) { if (!n_core) { if (!found) { /* No match case, if it is for insertion, diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index c83c7aaac9a5d..8e96685b275f1 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4,7 +4,7 @@ Copyright (c) 2000, 2020, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2009, Percona Inc. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -54,7 +54,7 @@ this program; if not, write to the Free Software Foundation, Inc., #include #include #include -#include "field.h" +#include "sql_type_geom.h" #include "scope.h" #include "srv0srv.h" @@ -79,7 +79,6 @@ this program; if not, write to the Free Software Foundation, Inc., #include "dict0load.h" #include "btr0defragment.h" #include "dict0crea.h" -#include "dict0dict.h" #include "dict0stats.h" #include "dict0stats_bg.h" #include "fil0fil.h" @@ -94,9 +93,9 @@ this program; if not, write to the Free Software Foundation, Inc., #include "mtr0mtr.h" #include "os0file.h" #include "page0zip.h" -#include "rem0types.h" #include "row0import.h" #include "row0ins.h" +#include "row0log.h" #include "row0merge.h" #include "row0mysql.h" #include "row0quiesce.h" @@ -131,7 +130,6 @@ void thd_clear_error(MYSQL_THD thd); TABLE *find_fk_open_table(THD *thd, const char *db, size_t db_len, const char *table, size_t table_len); MYSQL_THD create_background_thd(); -void destroy_background_thd(MYSQL_THD thd); void reset_thd(MYSQL_THD thd); TABLE *get_purge_table(THD *thd); TABLE *open_purge_table(THD *thd, const char *db, size_t dblen, @@ -242,10 +240,10 @@ static void innodb_max_purge_lag_wait_update(THD *thd, st_mysql_sys_var *, if (thd_kill_level(thd)) break; /* Adjust for purge_coordinator_state::refresh() */ - mysql_mutex_lock(&log_sys.mutex); + log_sys.latch.rd_lock(SRW_LOCK_CALL); const lsn_t last= log_sys.last_checkpoint_lsn, max_age= log_sys.max_checkpoint_age; - mysql_mutex_unlock(&log_sys.mutex); + log_sys.latch.rd_unlock(); const lsn_t lsn= log_sys.get_lsn(); if ((lsn - last) / 4 >= max_age / 5) buf_flush_ahead(last + max_age / 5, false); @@ -530,12 +528,9 @@ mysql_pfs_key_t fts_cache_mutex_key; mysql_pfs_key_t fts_cache_init_mutex_key; mysql_pfs_key_t fts_delete_mutex_key; mysql_pfs_key_t fts_doc_id_mutex_key; -mysql_pfs_key_t fts_pll_tokenize_mutex_key; mysql_pfs_key_t ibuf_bitmap_mutex_key; mysql_pfs_key_t ibuf_mutex_key; mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key; -mysql_pfs_key_t log_sys_mutex_key; -mysql_pfs_key_t log_flush_order_mutex_key; mysql_pfs_key_t recalc_pool_mutex_key; mysql_pfs_key_t purge_sys_pq_mutex_key; mysql_pfs_key_t recv_sys_mutex_key; @@ -552,10 +547,7 @@ mysql_pfs_key_t trx_pool_manager_mutex_key; mysql_pfs_key_t lock_wait_mutex_key; mysql_pfs_key_t trx_sys_mutex_key; mysql_pfs_key_t srv_threads_mutex_key; -mysql_pfs_key_t thread_mutex_key; -mysql_pfs_key_t row_drop_list_mutex_key; -mysql_pfs_key_t rw_trx_hash_element_mutex_key; -mysql_pfs_key_t read_view_mutex_key; +mysql_pfs_key_t tpool_cache_mutex_key; /* all_innodb_mutexes array contains mutexes that are performance schema instrumented if "UNIV_PFS_MUTEX" @@ -571,12 +563,9 @@ static PSI_mutex_info all_innodb_mutexes[] = { PSI_KEY(fts_cache_init_mutex), PSI_KEY(fts_delete_mutex), PSI_KEY(fts_doc_id_mutex), - PSI_KEY(log_flush_order_mutex), - PSI_KEY(ibuf_bitmap_mutex), PSI_KEY(ibuf_mutex), PSI_KEY(ibuf_pessimistic_insert_mutex), PSI_KEY(index_online_log), - PSI_KEY(log_sys_mutex), PSI_KEY(page_zip_stat_per_index_mutex), PSI_KEY(purge_sys_pq_mutex), PSI_KEY(recv_sys_mutex), @@ -592,6 +581,7 @@ static PSI_mutex_info all_innodb_mutexes[] = { PSI_KEY(rtr_match_mutex), PSI_KEY(rtr_path_mutex), PSI_KEY(trx_sys_mutex), + PSI_KEY(tpool_cache_mutex), }; # endif /* UNIV_PFS_MUTEX */ @@ -602,7 +592,9 @@ mysql_pfs_key_t index_online_log_key; mysql_pfs_key_t fil_space_latch_key; mysql_pfs_key_t trx_i_s_cache_lock_key; mysql_pfs_key_t trx_purge_latch_key; +mysql_pfs_key_t trx_rseg_latch_key; mysql_pfs_key_t lock_latch_key; +mysql_pfs_key_t log_latch_key; /* all_innodb_rwlocks array contains rwlocks that are performance schema instrumented if "UNIV_PFS_RWLOCK" @@ -616,7 +608,9 @@ static PSI_rwlock_info all_innodb_rwlocks[] = { &fil_space_latch_key, "fil_space_latch", 0 }, { &trx_i_s_cache_lock_key, "trx_i_s_cache_lock", 0 }, { &trx_purge_latch_key, "trx_purge_latch", 0 }, + { &trx_rseg_latch_key, "trx_rseg_latch", 0 }, { &lock_latch_key, "lock_latch", 0 }, + { &log_latch_key, "log_latch", 0 }, { &index_tree_rw_lock_key, "index_tree_rw_lock", PSI_RWLOCK_FLAG_SX } }; # endif /* UNIV_PFS_RWLOCK */ @@ -637,7 +631,6 @@ static PSI_thread_info all_innodb_threads[] = { performance schema instrumented if "UNIV_PFS_IO" is defined */ static PSI_file_info all_innodb_files[] = { PSI_KEY(innodb_data_file), - PSI_KEY(innodb_log_file), PSI_KEY(innodb_temp_file) }; # endif /* UNIV_PFS_IO */ @@ -712,6 +705,18 @@ innodb_stopword_table_validate( for update function */ struct st_mysql_value* value); /*!< in: incoming string */ +static +void innodb_ft_cache_size_update(THD*, st_mysql_sys_var*, void*, const void* save) +{ + fts_max_cache_size= *static_cast(save); +} + +static +void innodb_ft_total_cache_size_update(THD*, st_mysql_sys_var*, void*, const void* save) +{ + fts_max_total_cache_size= *static_cast(save); +} + static bool is_mysql_datadir_path(const char *path); /** Validate passed-in "value" is a valid directory name. @@ -911,46 +916,39 @@ static SHOW_VAR innodb_status_variables[]= { (char*) &export_vars.innodb_buffer_pool_resize_status, SHOW_CHAR}, {"buffer_pool_load_incomplete", &export_vars.innodb_buffer_pool_load_incomplete, SHOW_BOOL}, - {"buffer_pool_pages_data", - &export_vars.innodb_buffer_pool_pages_data, SHOW_SIZE_T}, + {"buffer_pool_pages_data", &UT_LIST_GET_LEN(buf_pool.LRU), SHOW_SIZE_T}, {"buffer_pool_bytes_data", &export_vars.innodb_buffer_pool_bytes_data, SHOW_SIZE_T}, {"buffer_pool_pages_dirty", - &export_vars.innodb_buffer_pool_pages_dirty, SHOW_SIZE_T}, - {"buffer_pool_bytes_dirty", - &export_vars.innodb_buffer_pool_bytes_dirty, SHOW_SIZE_T}, - {"buffer_pool_pages_flushed", &buf_flush_page_count, SHOW_SIZE_T}, - {"buffer_pool_pages_free", - &export_vars.innodb_buffer_pool_pages_free, SHOW_SIZE_T}, + &UT_LIST_GET_LEN(buf_pool.flush_list), SHOW_SIZE_T}, + {"buffer_pool_bytes_dirty", &buf_pool.flush_list_bytes, SHOW_SIZE_T}, + {"buffer_pool_pages_flushed", &buf_pool.stat.n_pages_written, SHOW_SIZE_T}, + {"buffer_pool_pages_free", &UT_LIST_GET_LEN(buf_pool.free), SHOW_SIZE_T}, #ifdef UNIV_DEBUG {"buffer_pool_pages_latched", &export_vars.innodb_buffer_pool_pages_latched, SHOW_SIZE_T}, #endif /* UNIV_DEBUG */ {"buffer_pool_pages_made_not_young", - &export_vars.innodb_buffer_pool_pages_made_not_young, SHOW_SIZE_T}, + &buf_pool.stat.n_pages_not_made_young, SHOW_SIZE_T}, {"buffer_pool_pages_made_young", - &export_vars.innodb_buffer_pool_pages_made_young, SHOW_SIZE_T}, + &buf_pool.stat.n_pages_made_young, SHOW_SIZE_T}, {"buffer_pool_pages_misc", &export_vars.innodb_buffer_pool_pages_misc, SHOW_SIZE_T}, - {"buffer_pool_pages_old", - &export_vars.innodb_buffer_pool_pages_old, SHOW_SIZE_T}, + {"buffer_pool_pages_old", &buf_pool.LRU_old_len, SHOW_SIZE_T}, {"buffer_pool_pages_total", &export_vars.innodb_buffer_pool_pages_total, SHOW_SIZE_T}, {"buffer_pool_pages_LRU_flushed", &buf_lru_flush_page_count, SHOW_SIZE_T}, {"buffer_pool_pages_LRU_freed", &buf_lru_freed_page_count, SHOW_SIZE_T}, + {"buffer_pool_pages_split", &buf_pool.pages_split, SHOW_SIZE_T}, {"buffer_pool_read_ahead_rnd", - &export_vars.innodb_buffer_pool_read_ahead_rnd, SHOW_SIZE_T}, - {"buffer_pool_read_ahead", - &export_vars.innodb_buffer_pool_read_ahead, SHOW_SIZE_T}, + &buf_pool.stat.n_ra_pages_read_rnd, SHOW_SIZE_T}, + {"buffer_pool_read_ahead", &buf_pool.stat.n_ra_pages_read, SHOW_SIZE_T}, {"buffer_pool_read_ahead_evicted", - &export_vars.innodb_buffer_pool_read_ahead_evicted, SHOW_SIZE_T}, - {"buffer_pool_read_requests", - &export_vars.innodb_buffer_pool_read_requests, SHOW_SIZE_T}, - {"buffer_pool_reads", - &export_vars.innodb_buffer_pool_reads, SHOW_SIZE_T}, + &buf_pool.stat.n_ra_pages_evicted, SHOW_SIZE_T}, + {"buffer_pool_read_requests", &buf_pool.stat.n_page_gets, SHOW_SIZE_T}, + {"buffer_pool_reads", &buf_pool.stat.n_pages_read, SHOW_SIZE_T}, {"buffer_pool_wait_free", &buf_pool.stat.LRU_waits, SHOW_SIZE_T}, - {"buffer_pool_write_requests", - &export_vars.innodb_buffer_pool_write_requests, SHOW_SIZE_T}, + {"buffer_pool_write_requests", &buf_pool.flush_list_requests, SHOW_SIZE_T}, {"checkpoint_age", &export_vars.innodb_checkpoint_age, SHOW_SIZE_T}, {"checkpoint_max_age", &export_vars.innodb_checkpoint_max_age, SHOW_SIZE_T}, {"data_fsyncs", (size_t*) &os_n_fsyncs, SHOW_SIZE_T}, @@ -1024,10 +1022,6 @@ static SHOW_VAR innodb_status_variables[]= { /* Status variables for page compression */ {"page_compression_saved", &export_vars.innodb_page_compression_saved, SHOW_LONGLONG}, - {"num_index_pages_written", - &export_vars.innodb_index_pages_written, SHOW_LONGLONG}, - {"num_non_index_pages_written", - &export_vars.innodb_non_index_pages_written, SHOW_LONGLONG}, {"num_pages_page_compressed", &export_vars.innodb_pages_page_compressed, SHOW_LONGLONG}, {"num_page_compressed_trim_op", @@ -1082,8 +1076,6 @@ static SHOW_VAR innodb_status_variables[]= { &export_vars.innodb_encryption_rotation_pages_flushed, SHOW_SIZE_T}, {"encryption_rotation_estimated_iops", &export_vars.innodb_encryption_rotation_estimated_iops, SHOW_SIZE_T}, - {"encryption_key_rotation_list_length", - &export_vars.innodb_key_rotation_list_length, SHOW_LONGLONG}, {"encryption_n_merge_blocks_encrypted", &export_vars.innodb_n_merge_blocks_encrypted, SHOW_LONGLONG}, {"encryption_n_merge_blocks_decrypted", @@ -1219,7 +1211,7 @@ struct log_flush_request }; /** Buffer of pending innodb_log_flush_request() */ -MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) static +alignas(CPU_LEVEL1_DCACHE_LINESIZE) static struct { /** first request */ @@ -1473,7 +1465,8 @@ static void innodb_drop_database(handlerton*, char *path) "WHILE 1 = 1 LOOP\n" " FETCH tab INTO tid,name;\n" " IF (SQL % NOTFOUND) THEN EXIT; END IF;\n" - " IF SUBSTR(name, 0, LENGTH(:db)) <> :db THEN EXIT; END IF;\n" + " IF TO_BINARY(SUBSTR(name, 0, LENGTH(:db))) <> TO_BINARY(:db)" + " THEN EXIT; END IF;\n" " DELETE FROM SYS_COLUMNS WHERE TABLE_ID=tid;\n" " DELETE FROM SYS_TABLES WHERE ID=tid;\n" " OPEN idx;\n" @@ -1530,20 +1523,28 @@ static void innodb_drop_database(handlerton*, char *path) we will "manually" purge the tablespaces that belong to the records that we delete-marked. */ - mem_heap_t *heap= mem_heap_create(100); - dtuple_t *tuple= dtuple_create(heap, 1); - dfield_t *dfield= dtuple_get_nth_field(tuple, 0); + dfield_t dfield; + dtuple_t tuple{ + 0,1,1,&dfield,0,nullptr +#ifdef UNIV_DEBUG + , DATA_TUPLE_MAGIC_N +#endif + }; dict_index_t* sys_index= UT_LIST_GET_FIRST(dict_sys.sys_tables->indexes); btr_pcur_t pcur; namebuf[len++]= '/'; - dfield_set_data(dfield, namebuf, len); - dict_index_copy_types(tuple, sys_index, 1); + dfield_set_data(&dfield, namebuf, len); + dict_index_copy_types(&tuple, sys_index, 1); std::vector to_close; + std::vector space_ids; mtr_t mtr; mtr.start(); - for (btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE, - BTR_SEARCH_LEAF, &pcur, &mtr); - btr_pcur_is_on_user_rec(&pcur); + pcur.btr_cur.page_cur.index = sys_index; + err= btr_pcur_open_on_user_rec(&tuple, BTR_SEARCH_LEAF, &pcur, &mtr); + if (err != DB_SUCCESS) + goto err_exit; + + for (; btr_pcur_is_on_user_rec(&pcur); btr_pcur_move_to_next_user_rec(&pcur, &mtr)) { const rec_t *rec= btr_pcur_get_rec(&pcur); @@ -1579,15 +1580,19 @@ static void innodb_drop_database(handlerton*, char *path) ut_ad("corrupted SYS_TABLES.SPACE" == 0); else if (uint32_t space_id= mach_read_from_4(s)) { + space_ids.emplace_back(space_id); pfs_os_file_t detached= fil_delete_tablespace(space_id); if (detached != OS_FILE_CLOSED) to_close.emplace_back(detached); } } + err_exit: mtr.commit(); - mem_heap_free(heap); for (pfs_os_file_t detached : to_close) os_file_close(detached); + for (const auto id : space_ids) + ibuf_delete_for_discarded_space(id); + /* Any changes must be persisted before we return. */ log_write_up_to(mtr.commit_lsn(), true); } @@ -1768,29 +1773,6 @@ MYSQL_THD innobase_create_background_thd(const char* name) return thd; } -extern "C" void thd_increment_pending_ops(MYSQL_THD); - -THD *innodb_thd_increment_pending_ops(THD *thd) -{ - if (!thd || THDVAR(thd, background_thread)) - return nullptr; - thd_increment_pending_ops(thd); - return thd; -} - -/** Destroy a background purge thread THD. -@param[in] thd MYSQL_THD to destroy */ -void -innobase_destroy_background_thd( -/*============================*/ - MYSQL_THD thd) -{ - /* need to close the connection explicitly, the server won't do it - if innodb is in the PLUGIN_IS_DYING state */ - innobase_close_connection(innodb_hton_ptr, thd); - thd_set_ha_data(thd, innodb_hton_ptr, NULL); - destroy_background_thd(thd); -} /** Close opened tables, free memory, delete items for a MYSQL_THD. @param[in] thd MYSQL_THD to reset */ @@ -1900,6 +1882,59 @@ thd_to_trx_id( return(thd_to_trx(thd)->id); } +Atomic_relaxed wsrep_sst_disable_writes; + +static void sst_disable_innodb_writes() +{ + const uint old_count= srv_n_fil_crypt_threads; + fil_crypt_set_thread_cnt(0); + srv_n_fil_crypt_threads= old_count; + + wsrep_sst_disable_writes= true; + dict_stats_shutdown(); + purge_sys.stop(); + /* We are holding a global MDL thanks to FLUSH TABLES WITH READ LOCK. + + That will prevent any writes from arriving into InnoDB, but it will + not prevent writes of modified pages from the buffer pool, or log + checkpoints. + + Let us perform a log checkpoint to ensure that the entire buffer + pool is clean, so that no writes to persistent files will be + possible during the snapshot, and to guarantee that no crash + recovery will be necessary when starting up on the snapshot. */ + log_make_checkpoint(); + /* If any FILE_MODIFY records were written by the checkpoint, an + extra write of a FILE_CHECKPOINT record could still be invoked by + buf_flush_page_cleaner(). Let us prevent that by invoking another + checkpoint (which will write the FILE_CHECKPOINT record). */ + log_make_checkpoint(); + ut_d(recv_no_log_write= true); + /* If this were not a no-op, an assertion would fail due to + recv_no_log_write. */ + ut_d(log_make_checkpoint()); +} + +static void sst_enable_innodb_writes() +{ + ut_ad(recv_no_log_write); + ut_d(recv_no_log_write= false); + dict_stats_start(); + purge_sys.resume(); + wsrep_sst_disable_writes= false; + const uint old_count= srv_n_fil_crypt_threads; + srv_n_fil_crypt_threads= 0; + fil_crypt_set_thread_cnt(old_count); +} + +static void innodb_disable_internal_writes(bool disable) +{ + if (disable) + sst_disable_innodb_writes(); + else + sst_enable_innodb_writes(); +} + static void wsrep_abort_transaction(handlerton*, THD *, THD *, my_bool); static int innobase_wsrep_set_checkpoint(handlerton* hton, const XID* xid); static int innobase_wsrep_get_checkpoint(handlerton* hton, XID* xid); @@ -1966,8 +2001,9 @@ static void drop_garbage_tables_after_restore() ut_d(purge_sys.stop_FTS()); mtr.start(); - btr_pcur_open_at_index_side(true, dict_sys.sys_tables->indexes.start, - BTR_SEARCH_LEAF, &pcur, true, 0, &mtr); + if (pcur.open_leaf(true, dict_sys.sys_tables->indexes.start, BTR_SEARCH_LEAF, + &mtr) != DB_SUCCESS) + goto all_fail; for (;;) { btr_pcur_move_to_next_user_rec(&pcur, &mtr); @@ -2051,12 +2087,14 @@ static void drop_garbage_tables_after_restore() os_file_close(d); mtr.start(); - btr_pcur_restore_position(BTR_SEARCH_LEAF, &pcur, &mtr); + if (pcur.restore_position(BTR_SEARCH_LEAF, &mtr) == btr_pcur_t::CORRUPTED) + break; } - btr_pcur_close(&pcur); +all_fail: mtr.commit(); trx->free(); + ut_free(pcur.old_rec_buf); ut_d(purge_sys.resume_FTS()); } @@ -2064,7 +2102,7 @@ static void innodb_ddl_recovery_done(handlerton*) { ut_ad(!ddl_recovery_done); ut_d(ddl_recovery_done= true); - if (!srv_read_only_mode && srv_operation == SRV_OPERATION_NORMAL && + if (!srv_read_only_mode && srv_operation <= SRV_OPERATION_EXPORT_RESTORED && srv_force_recovery < SRV_FORCE_NO_BACKGROUND) { if (srv_start_after_restore && !high_level_read_only) @@ -2103,7 +2141,7 @@ convert_error_code_to_mysql( "constraints that exceed max " "depth of %d. Please " "drop extra constraints and try " - "again", DICT_FK_MAX_RECURSIVE_LOAD); + "again", FK_MAX_CASCADE_DEL); return(HA_ERR_FK_DEPTH_EXCEEDED); case DB_CANT_CREATE_GEOMETRY_OBJECT: @@ -2177,6 +2215,7 @@ convert_error_code_to_mysql( code should be introduced */ case DB_CORRUPTION: + case DB_PAGE_CORRUPTED: return(HA_ERR_CRASHED); case DB_OUT_OF_FILE_SPACE: @@ -2295,7 +2334,7 @@ innobase_mysql_print_thd( /******************************************************************//** Get the variable length bounds of the given character set. */ -void +static void innobase_get_cset_width( /*====================*/ ulint cset, /*!< in: MySQL charset-collation code */ @@ -2307,7 +2346,7 @@ innobase_get_cset_width( ut_ad(mbminlen); ut_ad(mbmaxlen); - cs = all_charsets[cset]; + cs = cset ? get_charset((uint)cset, MYF(MY_WME)) : NULL; if (cs) { *mbminlen = cs->mbminlen; *mbmaxlen = cs->mbmaxlen; @@ -2335,6 +2374,29 @@ innobase_get_cset_width( } } +/*********************************************************************//** +Compute the mbminlen and mbmaxlen members of a data type structure. */ +void +dtype_get_mblen( +/*============*/ + ulint mtype, /*!< in: main type */ + ulint prtype, /*!< in: precise type (and collation) */ + unsigned*mbminlen, /*!< out: minimum length of a + multi-byte character */ + unsigned*mbmaxlen) /*!< out: maximum length of a + multi-byte character */ +{ + if (dtype_is_string_type(mtype)) { + innobase_get_cset_width(dtype_get_charset_coll(prtype), + mbminlen, mbmaxlen); + ut_ad(*mbminlen <= *mbmaxlen); + ut_ad(*mbminlen < DATA_MBMAX); + ut_ad(*mbmaxlen < DATA_MBMAX); + } else { + *mbminlen = *mbmaxlen = 0; + } +} + /******************************************************************//** Converts an identifier to a table name. */ void @@ -2742,44 +2804,6 @@ innobase_next_autoinc( return(~(ulonglong) 0); } -/*******************************************************************//** -Reset the auto-increment counter to the given value, i.e. the next row -inserted will get the given value. This is called e.g. after TRUNCATE -is emulated by doing a 'DELETE FROM t'. HA_ERR_WRONG_COMMAND is -returned by storage engines that don't support this operation. -@return 0 or error code */ -int ha_innobase::reset_auto_increment(ulonglong value) -{ - DBUG_ENTER("ha_innobase::reset_auto_increment"); - - dberr_t error; - - update_thd(ha_thd()); - - error = row_lock_table_autoinc_for_mysql(m_prebuilt); - - if (error != DB_SUCCESS) { -err_exit: - DBUG_RETURN(convert_error_code_to_mysql( - error, m_prebuilt->table->flags, m_user_thd)); - } - - /* The next value can never be 0. */ - if (value == 0) { - value = 1; - } - - error = innobase_lock_autoinc(); - if (error != DB_SUCCESS) { - goto err_exit; - } - - dict_table_autoinc_initialize(m_prebuilt->table, value); - m_prebuilt->table->autoinc_mutex.wr_unlock(); - - DBUG_RETURN(0); -} - /*********************************************************************//** Initializes some fields in an InnoDB transaction object. */ static @@ -2796,7 +2820,7 @@ innobase_trx_init( while holding lock_sys.latch, by lock_rec_enqueue_waiting(), will not end up acquiring LOCK_global_system_variables in intern_sys_var_ptr(). */ - THDVAR(thd, lock_wait_timeout); + (void) THDVAR(thd, lock_wait_timeout); trx->check_foreigns = !thd_test_options( thd, OPTION_NO_FOREIGN_KEY_CHECKS); @@ -3011,10 +3035,8 @@ ha_innobase::ha_innobase( /*********************************************************************//** Destruct ha_innobase handler. */ -ha_innobase::~ha_innobase() +ha_innobase::~ha_innobase() = default; /*======================*/ -{ -} /*********************************************************************//** Updates the user_thd field in a handle and also allocates a new InnoDB @@ -3578,7 +3600,7 @@ ha_innobase::init_table_handle_for_HANDLER(void) innobase_register_trx(ht, m_user_thd, m_prebuilt->trx); /* We did the necessary inits in this function, no need to repeat them - in row_search_for_mysql */ + in row_search_mvcc() */ m_prebuilt->sql_stat_start = FALSE; @@ -3601,11 +3623,6 @@ ha_innobase::init_table_handle_for_HANDLER(void) m_prebuilt->trx->bulk_insert = false; } -#ifdef WITH_INNODB_DISALLOW_WRITES -/** Condition variable for innodb_disallow_writes */ -static pthread_cond_t allow_writes_cond; -#endif /* WITH_INNODB_DISALLOW_WRITES */ - /*********************************************************************//** Free any resources that were allocated and return failure. @return always return 1 */ @@ -3623,12 +3640,57 @@ static int innodb_init_abort() } srv_tmp_space.shutdown(); -#ifdef WITH_INNODB_DISALLOW_WRITES - pthread_cond_destroy(&allow_writes_cond); -#endif /* WITH_INNODB_DISALLOW_WRITES */ DBUG_RETURN(1); } +/** Return the minimum buffer pool size based on page size */ +static inline ulint min_buffer_pool_size() +{ + ulint s= (BUF_LRU_MIN_LEN + BUF_LRU_MIN_LEN / 4) * srv_page_size; + /* buf_pool_chunk_size minimum is 1M, so round up to a multiple */ + ulint alignment= 1U << 20; + return UT_CALC_ALIGN(s, alignment); +} + +/** Validate the requested buffer pool size. Also, reserve the necessary +memory needed for buffer pool resize. +@param[in] thd thread handle +@param[in] var pointer to system variable +@param[out] save immediate result for update function +@param[in] value incoming string +@return 0 on success, 1 on failure. +*/ +static +int +innodb_buffer_pool_size_validate( + THD* thd, + struct st_mysql_sys_var* var, + void* save, + struct st_mysql_value* value); + +/** Update the system variable innodb_buffer_pool_size using the "saved" +value. This function is registered as a callback with MySQL. +@param[in] thd thread handle +@param[in] var pointer to system variable +@param[out] var_ptr where the formal string goes +@param[in] save immediate result from check function */ +static +void +innodb_buffer_pool_size_update( + THD* thd, + struct st_mysql_sys_var* var, + void* var_ptr, + const void* save); + +static MYSQL_SYSVAR_ULONGLONG(buffer_pool_size, innobase_buffer_pool_size, + PLUGIN_VAR_RQCMDARG, + "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.", + innodb_buffer_pool_size_validate, + innodb_buffer_pool_size_update, + 128ULL << 20, + 2ULL << 20, + LLONG_MAX, 1024*1024L); + /****************************************************************//** Gives the file extension of an InnoDB single-table tablespace. */ static const char* ha_innobase_exts[] = { @@ -3662,8 +3724,6 @@ static ulonglong innodb_prepare_commit_versioned(THD* thd, ulonglong *trx_id) if (t.second.is_bulk_insert()) { ut_ad(trx->bulk_insert); - ut_ad(!trx->check_unique_secondary); - ut_ad(!trx->check_foreigns); if (t.second.write_bulk(t.first, trx)) return ULONGLONG_MAX; } @@ -3683,7 +3743,7 @@ static void innodb_buffer_pool_size_init() { /* Size unit of buffer pool is larger than srv_buf_pool_size. adjust srv_buf_pool_chunk_unit for srv_buf_pool_size. */ - srv_buf_pool_chunk_unit = ulong(srv_buf_pool_size); + srv_buf_pool_chunk_unit = srv_buf_pool_size; } else if (srv_buf_pool_chunk_unit == 0) { @@ -3740,12 +3800,15 @@ static int innodb_init_params() /* The buffer pool needs to be able to accommodate enough many pages, even for larger pages */ - if (srv_page_size > UNIV_PAGE_SIZE_DEF - && innobase_buffer_pool_size < (24 * 1024 * 1024)) { + MYSQL_SYSVAR_NAME(buffer_pool_size).min_val= min_buffer_pool_size(); + + if (innobase_buffer_pool_size < MYSQL_SYSVAR_NAME(buffer_pool_size).min_val) { ib::error() << "innodb_page_size=" << srv_page_size << " requires " - << "innodb_buffer_pool_size > 24M current " - << innobase_buffer_pool_size; + << "innodb_buffer_pool_size >= " + << (MYSQL_SYSVAR_NAME(buffer_pool_size).min_val >> 20) + << "MiB current " << (innobase_buffer_pool_size >> 20) + << "MiB"; DBUG_RETURN(HA_ERR_INITIALIZATION); } @@ -3975,6 +4038,14 @@ static int innodb_init_params() } #endif +#if defined __linux__ || defined _WIN32 + if (srv_flush_log_at_trx_commit == 2) { + /* Do not disable the file system cache if + innodb_flush_log_at_trx_commit=2. */ + log_sys.log_buffered = true; + } +#endif + if (srv_read_only_mode) { ib::info() << "Started in read only mode"; srv_use_doublewrite_buf = FALSE; @@ -4069,6 +4140,7 @@ static int innodb_init(void* p) innobase_hton->abort_transaction=wsrep_abort_transaction; innobase_hton->set_checkpoint=innobase_wsrep_set_checkpoint; innobase_hton->get_checkpoint=innobase_wsrep_get_checkpoint; + innobase_hton->disable_internal_writes=innodb_disable_internal_writes; #endif /* WITH_WSREP */ innobase_hton->check_version = innodb_check_version; @@ -4114,10 +4186,6 @@ static int innodb_init(void* p) /* After this point, error handling has to use innodb_init_abort(). */ -#ifdef WITH_INNODB_DISALLOW_WRITES - pthread_cond_init(&allow_writes_cond, nullptr); -#endif /* WITH_INNODB_DISALLOW_WRITES */ - #ifdef HAVE_PSI_INTERFACE /* Register keys with MySQL performance schema */ int count; @@ -4230,9 +4298,6 @@ innobase_end(handlerton*, ha_panic_function) innodb_shutdown(); -#ifdef WITH_INNODB_DISALLOW_WRITES - pthread_cond_destroy(&allow_writes_cond); -#endif /* WITH_INNODB_DISALLOW_WRITES */ mysql_mutex_destroy(&log_requests.mutex); } @@ -4415,6 +4480,25 @@ innobase_commit_ordered( DBUG_VOID_RETURN; } +/** Mark the end of a statement. +@param trx transaction +@return whether an error occurred */ +static bool end_of_statement(trx_t *trx) +{ + trx_mark_sql_stat_end(trx); + if (UNIV_LIKELY(trx->error_state == DB_SUCCESS)) + return false; + + trx_savept_t savept; + savept.least_undo_no= 0; + trx->rollback(&savept); + /* MariaDB will roll back the entire transaction. */ + trx->bulk_insert= false; + trx->last_sql_stat_start.least_undo_no= 0; + trx->savepoints_discard(); + return true; +} + /*****************************************************************//** Commits a transaction in an InnoDB database or marks an SQL statement ended. @@ -4491,10 +4575,7 @@ innobase_commit( /* Store the current undo_no of the transaction so that we know where to roll back if we have to roll back the next SQL statement */ - - trx_mark_sql_stat_end(trx); - if (UNIV_UNLIKELY(trx->error_state != DB_SUCCESS)) { - trx_rollback_for_mysql(trx); + if (UNIV_UNLIKELY(end_of_statement(trx))) { DBUG_RETURN(1); } } @@ -4874,6 +4955,7 @@ static int innobase_close_connection(handlerton *hton, THD *thd) DBUG_ASSERT(hton == innodb_hton_ptr); if (auto trx= thd_to_trx(thd)) { + thd_set_ha_data(thd, innodb_hton_ptr, NULL); if (trx->state == TRX_STATE_PREPARED && trx->has_logged_persistent()) { trx_disconnect_prepared(trx); @@ -4881,6 +4963,7 @@ static int innobase_close_connection(handlerton *hton, THD *thd) } innobase_rollback_trx(trx); trx->free(); + DEBUG_SYNC(thd, "innobase_connection_closed"); } return 0; } @@ -5089,33 +5172,26 @@ ha_innobase::keys_to_use_for_scanning() return(&key_map_full); } -/****************************************************************//** -Ensures that if there's a concurrent inplace ADD INDEX, being-indexed virtual -columns are computed. They are not marked as indexed in the old table, so the -server won't add them to the read_set automatically */ -void -ha_innobase::column_bitmaps_signal() -/*================================*/ +/** Ensure that indexed virtual columns will be computed. */ +void ha_innobase::column_bitmaps_signal() { - if (!table->vfield || table->current_lock != F_WRLCK) { - return; - } + if (!table->vfield || table->current_lock != F_WRLCK) + return; - dict_index_t* clust_index = dict_table_get_first_index(m_prebuilt->table); - uint num_v = 0; - for (uint j = 0; j < table->s->virtual_fields; j++) { - if (table->vfield[j]->stored_in_db()) { - continue; - } + dict_index_t* clust_index= dict_table_get_first_index(m_prebuilt->table); + uint num_v= 0; + for (uint j = 0; j < table->s->virtual_fields; j++) + { + if (table->vfield[j]->stored_in_db()) + continue; - dict_col_t* col = &m_prebuilt->table->v_cols[num_v].m_col; - if (col->ord_part || - (dict_index_is_online_ddl(clust_index) && - row_log_col_is_indexed(clust_index, num_v))) { - table->mark_virtual_column_with_deps(table->vfield[j]); - } - num_v++; - } + dict_col_t *col= &m_prebuilt->table->v_cols[num_v].m_col; + if (col->ord_part || + (dict_index_is_online_ddl(clust_index) && + row_log_col_is_indexed(clust_index, num_v))) + table->mark_virtual_column_with_deps(table->vfield[j]); + num_v++; + } } @@ -5406,6 +5482,11 @@ innobase_match_index_columns( col_type= DATA_FIXBINARY; } + if (innodb_idx_fld->descending + != !!(key_part->key_part_flag & HA_REVERSE_SORT)) { + DBUG_RETURN(FALSE); + } + if (col_type != mtype) { /* If the col_type we get from mysql type is a geometry data type, we should check if mtype is a legacy type @@ -5870,11 +5951,6 @@ ha_innobase::open(const char* name, int, uint) MONITOR_INC(MONITOR_TABLE_OPEN); if ((ib_table->flags2 & DICT_TF2_DISCARDED)) { - - ib_senderrf(thd, - IB_LOG_LEVEL_WARN, ER_TABLESPACE_DISCARDED, - table->s->table_name.str); - /* Allow an open because a proper DISCARD should have set all the flags and index root page numbers to FIL_NULL that should prevent any DML from running but it should allow DDL @@ -6503,7 +6579,8 @@ innobase_mysql_fts_get_token( ulint mwc = 0; ulint length = 0; - + bool reset_token_str = false; +reset: token->f_str = const_cast(doc); while (doc < end) { @@ -6513,6 +6590,9 @@ innobase_mysql_fts_get_token( mbl = cs->ctype(&ctype, (uchar*) doc, (uchar*) end); if (true_word_char(ctype, *doc)) { mwc = 0; + } else if (*doc == '\'' && length == 1) { + /* Could be apostrophe */ + reset_token_str = true; } else if (!misc_word_char(*doc) || mwc) { break; } else { @@ -6522,6 +6602,14 @@ innobase_mysql_fts_get_token( ++length; doc += mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1); + if (reset_token_str) { + /* Reset the token if the single character + followed by apostrophe */ + mwc = 0; + length = 0; + reset_token_str = false; + goto reset; + } } token->f_len = (uint) (doc - token->f_str) - mwc; @@ -7261,7 +7349,7 @@ ha_innobase::build_template( /* We must at least fetch all primary key cols. Note that if the clustered index was internally generated by InnoDB on the row id (no primary key was - defined), then row_search_for_mysql() will always + defined), then row_search_mvcc() will always retrieve the row id to a special buffer in the m_prebuilt struct. */ @@ -7276,6 +7364,11 @@ ha_innobase::build_template( m_prebuilt->versioned_write = table->versioned_write(VERS_TRX_ID); m_prebuilt->need_to_access_clustered = (index == clust_index); + if (m_prebuilt->in_fts_query) { + /* Do clustered index lookup to fetch the FTS_DOC_ID */ + m_prebuilt->need_to_access_clustered = true; + } + /* Either m_prebuilt->index should be a secondary index, or it should be the clustered index. */ ut_ad(dict_index_is_clust(index) == (index == clust_index)); @@ -7314,9 +7407,12 @@ ha_innobase::build_template( ulint num_v = 0; - if ((active_index != MAX_KEY - && active_index == pushed_idx_cond_keyno) - || (pushed_rowid_filter && rowid_filter_is_active)) { + if (active_index != MAX_KEY + && active_index == pushed_idx_cond_keyno) { + m_prebuilt->idx_cond = this; + goto icp; + } else if (pushed_rowid_filter && rowid_filter_is_active) { +icp: /* Push down an index condition or an end_range check. */ for (ulint i = 0; i < n_fields; i++) { const Field* field = table->field[i]; @@ -7497,9 +7593,6 @@ ha_innobase::build_template( } } } - if (active_index == pushed_idx_cond_keyno) { - m_prebuilt->idx_cond = this; - } } else { no_icp: /* No index condition pushdown */ @@ -7898,6 +7991,7 @@ ha_innobase::write_row( #ifdef WITH_WSREP if (!error_result && trx->is_wsrep() + && !trx->is_bulk_insert() && wsrep_thd_is_local(m_user_thd) && !wsrep_thd_ignore_table(m_user_thd) && !wsrep_consistency_check(m_user_thd) @@ -8100,34 +8194,13 @@ calc_row_difference( } } -#ifdef UNIV_DEBUG - bool online_ord_part = false; -#endif - if (is_virtual) { /* If the virtual column is not indexed, we shall ignore it for update */ if (!col->ord_part) { - /* Check whether there is a table-rebuilding - online ALTER TABLE in progress, and this - virtual column could be newly indexed, thus - it will be materialized. Then we will have - to log its update. - Note, we do not support online dropping virtual - column while adding new index, nor with - online alter column order while adding index, - so the virtual column sequence must not change - if it is online operation */ - if (dict_index_is_online_ddl(clust_index) - && row_log_col_is_indexed(clust_index, - num_v)) { -#ifdef UNIV_DEBUG - online_ord_part = true; -#endif - } else { - num_v++; - continue; - } + next: + num_v++; + continue; } if (!uvect->old_vrow) { @@ -8153,8 +8226,7 @@ calc_row_difference( prebuilt, vfield, o_len, col, old_mysql_row_col, col_pack_len, buf); - num_v++; - continue; + goto next; } } @@ -8203,7 +8275,7 @@ calc_row_difference( upd_fld_set_virtual_col(ufield); ufield->field_no = num_v; - ut_ad(col->ord_part || online_ord_part); + ut_ad(col->ord_part); ufield->old_v_val = static_cast( mem_heap_alloc( uvect->heap, @@ -8288,7 +8360,7 @@ calc_row_difference( prebuilt, vfield, o_len, col, old_mysql_row_col, col_pack_len, buf); - ut_ad(col->ord_part || online_ord_part); + ut_ad(col->ord_part); num_v++; } } @@ -8432,6 +8504,37 @@ wsrep_calc_row_hash( return(0); } + +/** Append table-level exclusive key. +@param thd MySQL thread handle +@param table table +@retval false on success +@retval true on failure */ +ATTRIBUTE_COLD bool wsrep_append_table_key(MYSQL_THD thd, const dict_table_t &table) +{ + char db_buf[NAME_LEN + 1]; + char tbl_buf[NAME_LEN + 1]; + ulint db_buf_len, tbl_buf_len; + + if (!table.parse_name(db_buf, tbl_buf, &db_buf_len, &tbl_buf_len)) + { + WSREP_ERROR("Parse_name for table key append failed: %s", + wsrep_thd_query(thd)); + return true; + } + + /* Append table-level exclusive key */ + const int rcode = wsrep_thd_append_table_key(thd, db_buf, + tbl_buf, WSREP_SERVICE_KEY_EXCLUSIVE); + if (rcode) + { + WSREP_ERROR("Appending table key failed: %s, %d", + wsrep_thd_query(thd), rcode); + return true; + } + + return false; +} #endif /* WITH_WSREP */ /** @@ -8523,14 +8626,20 @@ ha_innobase::update_row( const bool vers_ins_row = vers_set_fields && thd_sql_command(m_user_thd) != SQLCOM_ALTER_TABLE; + TABLE_LIST *tl= table->pos_in_table_list; + uint8 op_map= tl->trg_event_map | tl->slave_fk_event_map; /* This is not a delete */ m_prebuilt->upd_node->is_delete = (vers_set_fields && !vers_ins_row) || - (thd_sql_command(m_user_thd) == SQLCOM_DELETE && + (op_map & trg2bit(TRG_EVENT_DELETE) && table->versioned(VERS_TIMESTAMP)) ? VERSIONED_DELETE : NO_DELETE; + if (m_prebuilt->upd_node->is_delete) { + trx->fts_next_doc_id = 0; + } + error = row_update_for_mysql(m_prebuilt); if (error == DB_SUCCESS && vers_ins_row @@ -8596,11 +8705,16 @@ ha_innobase::update_row( && !wsrep_thd_ignore_table(m_user_thd)) { DBUG_PRINT("wsrep", ("update row key")); - if (wsrep_append_keys(m_user_thd, - wsrep_protocol_version >= 4 - ? WSREP_SERVICE_KEY_UPDATE - : WSREP_SERVICE_KEY_EXCLUSIVE, - old_row, new_row)){ + /* We use table-level exclusive key for SEQUENCES + and normal key append for others. */ + if (table->s->table_type == TABLE_TYPE_SEQUENCE) { + if (wsrep_append_table_key(m_user_thd, *m_prebuilt->table)) + DBUG_RETURN(HA_ERR_INTERNAL_ERROR); + } else if (wsrep_append_keys(m_user_thd, + wsrep_protocol_version >= 4 + ? WSREP_SERVICE_KEY_UPDATE + : WSREP_SERVICE_KEY_EXCLUSIVE, + old_row, new_row)) { WSREP_DEBUG("WSREP: UPDATE_ROW_KEY FAILED"); DBUG_PRINT("wsrep", ("row key failed")); DBUG_RETURN(HA_ERR_INTERNAL_ERROR); @@ -8641,6 +8755,7 @@ ha_innobase::delete_row( && trx->id != table->vers_start_id() ? VERSIONED_DELETE : PLAIN_DELETE; + trx->fts_next_doc_id = 0; error = row_update_for_mysql(m_prebuilt); @@ -8660,16 +8775,6 @@ ha_innobase::delete_row( error, m_prebuilt->table->flags, m_user_thd)); } -/** Delete all rows from the table. -@return error number or 0 */ - -int -ha_innobase::delete_all_rows() -{ - DBUG_ENTER("ha_innobase::delete_all_rows"); - DBUG_RETURN(HA_ERR_WRONG_COMMAND); -} - /**********************************************************************//** Removes a new lock set on a row, if it was not read optimistically. This can be called after a row has been read in the processing of an UPDATE or a DELETE @@ -8825,7 +8930,7 @@ statement issued by the user. We also increment trx->n_mysql_tables_in_use. instructions to m_prebuilt->template of the table handle instance in ::index_read. The template is used to save CPU time in large joins. - 3) In row_search_for_mysql, if m_prebuilt->sql_stat_start is true, we + 3) In row_search_mvcc(), if m_prebuilt->sql_stat_start is true, we allocate a new consistent read view for the trx if it does not yet have one, or in the case of a locking read, set an InnoDB 'intention' table level lock on the table. @@ -9127,7 +9232,7 @@ ha_innobase::change_active_index( } /* The caller seems to ignore this. Thus, we must check - this again in row_search_for_mysql(). */ + this again in row_search_mvcc(). */ DBUG_RETURN(convert_error_code_to_mysql(DB_MISSING_HISTORY, 0, NULL)); } @@ -9176,6 +9281,14 @@ ha_innobase::change_active_index( DBUG_RETURN(0); } +/* @return true if it's necessary to switch current statement log format from +STATEMENT to ROW if binary log format is MIXED and autoincrement values +are changed in the statement */ +bool ha_innobase::autoinc_lock_mode_stmt_unsafe() const +{ + return innobase_autoinc_lock_mode == AUTOINC_NO_LOCKING; +} + /***********************************************************************//** Reads the next or previous row from a cursor, which must have previously been positioned using index_read. @@ -9595,9 +9708,12 @@ ha_innobase::ft_init_ext( /*****************************************************************//** Set up search tuple for a query through FTS_DOC_ID_INDEX on supplied Doc ID. This is used by MySQL to retrieve the documents -once the search result (Doc IDs) is available */ +once the search result (Doc IDs) is available + +@return DB_SUCCESS or DB_INDEX_CORRUPT +*/ static -void +dberr_t innobase_fts_create_doc_id_key( /*===========================*/ dtuple_t* tuple, /* in/out: m_prebuilt->search_tuple */ @@ -9609,8 +9725,10 @@ innobase_fts_create_doc_id_key( { doc_id_t temp_doc_id; dfield_t* dfield = dtuple_get_nth_field(tuple, 0); + const ulint n_uniq = index->table->fts_n_uniq(); - ut_a(dict_index_get_n_unique(index) == 1); + if (dict_index_get_n_unique(index) != n_uniq) + return DB_INDEX_CORRUPT; dtuple_set_n_fields(tuple, index->n_fields); dict_index_copy_types(tuple, index, index->n_fields); @@ -9628,12 +9746,25 @@ innobase_fts_create_doc_id_key( *doc_id = temp_doc_id; dfield_set_data(dfield, doc_id, sizeof(*doc_id)); - dtuple_set_n_fields_cmp(tuple, 1); + if (n_uniq == 2) { + ut_ad(index->table->versioned()); + dfield = dtuple_get_nth_field(tuple, 1); + if (index->table->versioned_by_id()) { + dfield_set_data(dfield, trx_id_max_bytes, + sizeof(trx_id_max_bytes)); + } else { + dfield_set_data(dfield, timestamp_max_bytes, + sizeof(timestamp_max_bytes)); + } + } + + dtuple_set_n_fields_cmp(tuple, n_uniq); - for (ulint i = 1; i < index->n_fields; i++) { + for (ulint i = n_uniq; i < index->n_fields; i++) { dfield = dtuple_get_nth_field(tuple, i); dfield_set_null(dfield); } + return DB_SUCCESS; } /**********************************************************************//** @@ -9715,13 +9846,18 @@ ha_innobase::ft_read( /* We pass a pointer of search_doc_id because it will be converted to storage byte order used in the search tuple. */ - innobase_fts_create_doc_id_key(tuple, index, &search_doc_id); + dberr_t ret = innobase_fts_create_doc_id_key( + tuple, index, &search_doc_id); + + if (ret == DB_SUCCESS) { + ret = row_search_mvcc( + buf, PAGE_CUR_GE, m_prebuilt, + ROW_SEL_EXACT, 0); + } int error; - switch (dberr_t ret = row_search_for_mysql(buf, PAGE_CUR_GE, - m_prebuilt, - ROW_SEL_EXACT, 0)) { + switch (ret) { case DB_SUCCESS: error = 0; table->status = 0; @@ -9995,6 +10131,8 @@ wsrep_append_key( (shared, exclusive, semi...) */ ) { + ut_ad(!trx->is_bulk_insert()); + DBUG_ENTER("wsrep_append_key"); DBUG_PRINT("enter", ("thd: %lu trx: %lld", thd_get_thread_id(thd), @@ -10830,7 +10968,9 @@ create_index( } dict_mem_index_add_field(index, field->field_name.str, - 0); + 0, + key->key_part->key_part_flag + & HA_REVERSE_SORT); } DBUG_RETURN(convert_error_code_to_mysql( @@ -10924,7 +11064,9 @@ create_index( index->type |= DICT_VIRTUAL; } - dict_mem_index_add_field(index, field_name, prefix_len); + dict_mem_index_add_field(index, field_name, prefix_len, + key_part->key_part_flag + & HA_REVERSE_SORT); } ut_ad(key->flags & HA_FULLTEXT || !(index->type & DICT_FTS)); @@ -11130,9 +11272,12 @@ create_table_info_t::create_options_are_invalid() break; } - if (m_create_info->data_file_name - && m_create_info->data_file_name[0] != '\0' - && !create_option_data_directory_is_valid()) { + if (!m_create_info->data_file_name + || !m_create_info->data_file_name[0]) { + } else if (!my_use_symdir) { + my_error(WARN_OPTION_IGNORED, MYF(ME_WARNING), + "DATA DIRECTORY"); + } else if (!create_option_data_directory_is_valid()) { ret = "DATA DIRECTORY"; } @@ -11328,7 +11473,7 @@ ha_innobase::update_create_info( return; } - dict_get_and_save_data_dir_path(m_prebuilt->table, false); + dict_get_and_save_data_dir_path(m_prebuilt->table); if (m_prebuilt->table->data_dir_path) { create_info->data_file_name = m_prebuilt->table->data_dir_path; @@ -11345,6 +11490,8 @@ innobase_fts_load_stopword( trx_t* trx, /*!< in: transaction */ THD* thd) /*!< in: current thread */ { + ut_ad(dict_sys.locked()); + const char *stopword_table= THDVAR(thd, ft_user_stopword_table); if (!stopword_table) { @@ -11354,9 +11501,11 @@ innobase_fts_load_stopword( mysql_mutex_unlock(&LOCK_global_system_variables); } - return !high_level_read_only && - fts_load_stopword(table, trx, stopword_table, - THDVAR(thd, ft_enable_stopword), false); + table->fts->dict_locked= true; + bool success= fts_load_stopword(table, trx, stopword_table, + THDVAR(thd, ft_enable_stopword), false); + table->fts->dict_locked= false; + return success; } /** Parse the table name into normal name and remote path if needed. @@ -11404,7 +11553,8 @@ create_table_info_t::parse_table_name( CREATE TABLE ... DATA DIRECTORY={path} TABLESPACE={name}... ; we ignore the DATA DIRECTORY. */ if (m_create_info->data_file_name - && m_create_info->data_file_name[0] != '\0') { + && m_create_info->data_file_name[0] + && my_use_symdir) { if (!create_option_data_directory_is_valid()) { push_warning_printf( m_thd, Sql_condition::WARN_LEVEL_WARN, @@ -11460,6 +11610,7 @@ bool create_table_info_t::innobase_table_flags() m_flags2 = 0; /* Check if there are any FTS indexes defined on this table. */ + const uint fts_n_uniq= m_form->versioned() ? 2 : 1; for (uint i = 0; i < m_form->s->keys; i++) { const KEY* key = &m_form->key_info[i]; @@ -11484,6 +11635,8 @@ bool create_table_info_t::innobase_table_flags() /* Do a pre-check on FTS DOC ID index */ if (!(key->flags & HA_NOSAME) + || key->user_defined_key_parts != fts_n_uniq + || (key->key_part[0].key_part_flag & HA_REVERSE_SORT) || strcmp(key->name.str, FTS_DOC_ID_INDEX_NAME) || strcmp(key->key_part[0].field->field_name.str, FTS_DOC_ID_COL_NAME)) { @@ -11636,29 +11789,33 @@ bool create_table_info_t::innobase_table_flags() zip_ssize = 0; } + ulint level = 0; + if (is_temp) { m_flags2 |= DICT_TF2_TEMPORARY; - } else if (m_use_file_per_table) { - m_flags2 |= DICT_TF2_USE_FILE_PER_TABLE; - } + } else { + if (m_use_file_per_table) { + m_flags2 |= DICT_TF2_USE_FILE_PER_TABLE; + } - ulint level = ulint(options->page_compression_level); - if (!level) { - level = page_zip_level; - if (!level && options->page_compressed) { - push_warning_printf( - m_thd, Sql_condition::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: PAGE_COMPRESSED requires" - " PAGE_COMPRESSION_LEVEL or" - " innodb_compression_level > 0"); - DBUG_RETURN(false); + level = ulint(options->page_compression_level); + if (!level) { + level = page_zip_level; + if (!level && options->page_compressed) { + push_warning_printf( + m_thd, Sql_condition::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: PAGE_COMPRESSED requires" + " PAGE_COMPRESSION_LEVEL or" + " innodb_compression_level > 0"); + DBUG_RETURN(false); + } } } /* Set the table flags */ dict_tf_set(&m_flags, innodb_row_format, zip_ssize, - m_use_data_dir, options->page_compressed, level); + m_use_data_dir, level && options->page_compressed, level); if (m_form->s->table_type == TABLE_TYPE_SEQUENCE) { m_flags |= DICT_TF_MASK_NO_ROLLBACK; @@ -11864,8 +12021,9 @@ create_table_info_t::set_tablespace_type( used with TEMPORARY tables. */ m_use_data_dir = m_use_file_per_table - && (m_create_info->data_file_name != NULL) - && (m_create_info->data_file_name[0] != '\0'); + && m_create_info->data_file_name + && m_create_info->data_file_name[0] + && my_use_symdir; } /** Initialize the create_table_info_t object. @@ -12644,7 +12802,8 @@ int create_table_info_t::create_table(bool create_fk) m_table->name.m_name); if (m_table->fts) { - fts_free(m_table); + m_table->fts->~fts_t(); + m_table->fts = nullptr; } my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), @@ -12686,14 +12845,18 @@ int create_table_info_t::create_table(bool create_fk) dberr_t err = create_fk ? create_foreign_keys() : DB_SUCCESS; if (err == DB_SUCCESS) { + const dict_err_ignore_t ignore_err = m_trx->check_foreigns + ? DICT_ERR_IGNORE_NONE : DICT_ERR_IGNORE_FK_NOKEY; + /* Check that also referencing constraints are ok */ dict_names_t fk_tables; - err = dict_load_foreigns(m_table_name, NULL, false, true, - DICT_ERR_IGNORE_NONE, fk_tables); + err = dict_load_foreigns(m_table_name, nullptr, + m_trx->id, true, + ignore_err, fk_tables); while (err == DB_SUCCESS && !fk_tables.empty()) { dict_sys.load_table( {fk_tables.front(), strlen(fk_tables.front())}, - DICT_ERR_IGNORE_NONE); + ignore_err); fk_tables.pop_front(); } } @@ -12756,7 +12919,6 @@ bool create_table_info_t::row_size_is_acceptable( return true; } -/* FIXME: row size check has some flaws and should be improved */ dict_index_t::record_size_info_t dict_index_t::record_size_info() const { ut_ad(!(type & DICT_FTS)); @@ -12846,6 +13008,8 @@ dict_index_t::record_size_info_t dict_index_t::record_size_info() const { /* dict_index_add_col() should guarantee this */ ut_ad(!f.prefix_len || f.fixed_len == f.prefix_len); + if (f.prefix_len) + field_max_size= f.prefix_len; /* Fixed lengths are not encoded in ROW_FORMAT=COMPACT. */ goto add_field_size; @@ -12899,7 +13063,8 @@ dict_index_t::record_size_info_t dict_index_t::record_size_info() const unique columns, result.shortest_size equals the size of the node pointer record minus the node pointer column. */ if (i + 1 == dict_index_get_n_unique_in_tree(this) && - result.shortest_size + REC_NODE_PTR_SIZE >= page_ptr_max) + result.shortest_size + REC_NODE_PTR_SIZE + (comp ? 0 : 2) >= + page_ptr_max) { result.set_too_big(i); } @@ -12945,7 +13110,6 @@ bool create_table_info_t::row_size_is_acceptable( if (info.row_is_too_big()) { ut_ad(info.get_overrun_size() != 0); - ut_ad(info.max_leaf_size != 0); const size_t idx= info.get_first_overrun_field_index(); const dict_field_t *field= dict_index_get_nth_field(&index, idx); @@ -12973,96 +13137,59 @@ bool create_table_info_t::row_size_is_acceptable( return true; } -/** Update a new table in an InnoDB database. -@return error number */ -int -create_table_info_t::create_table_update_dict() +void create_table_info_t::create_table_update_dict(dict_table_t *table, + THD *thd, + const HA_CREATE_INFO &info, + const TABLE &t) { - dict_table_t* innobase_table; - - DBUG_ENTER("create_table_update_dict"); - - innobase_table = dict_table_open_on_name( - m_table_name, false, DICT_ERR_IGNORE_NONE); - - DBUG_ASSERT(innobase_table != 0); - if (innobase_table->fts != NULL) { - if (innobase_table->fts_doc_id_index == NULL) { - innobase_table->fts_doc_id_index - = dict_table_get_index_on_name( - innobase_table, FTS_DOC_ID_INDEX_NAME); - DBUG_ASSERT(innobase_table->fts_doc_id_index != NULL); - } else { - DBUG_ASSERT(innobase_table->fts_doc_id_index - == dict_table_get_index_on_name( - innobase_table, - FTS_DOC_ID_INDEX_NAME)); - } - } + ut_ad(dict_sys.locked()); - DBUG_ASSERT((innobase_table->fts == NULL) - == (innobase_table->fts_doc_id_index == NULL)); - - innobase_copy_frm_flags_from_create_info(innobase_table, m_create_info); - - dict_stats_update(innobase_table, DICT_STATS_EMPTY_TABLE); - - /* Load server stopword into FTS cache */ - if (m_flags2 & DICT_TF2_FTS) { - if (!innobase_fts_load_stopword(innobase_table, NULL, m_thd)) { - innobase_table->release(); - DBUG_RETURN(-1); - } - - dict_sys.lock(SRW_LOCK_CALL); - fts_optimize_add_table(innobase_table); - dict_sys.unlock(); - } + DBUG_ASSERT(table->get_ref_count()); + if (table->fts) + { + if (!table->fts_doc_id_index) + table->fts_doc_id_index= + dict_table_get_index_on_name(table, FTS_DOC_ID_INDEX_NAME); + else + DBUG_ASSERT(table->fts_doc_id_index == + dict_table_get_index_on_name(table, FTS_DOC_ID_INDEX_NAME)); + } - if (const Field* ai = m_form->found_next_number_field) { - ut_ad(ai->stored_in_db()); + DBUG_ASSERT(!table->fts == !table->fts_doc_id_index); - ib_uint64_t autoinc = m_create_info->auto_increment_value; + innobase_copy_frm_flags_from_create_info(table, &info); - if (autoinc == 0) { - autoinc = 1; - } + /* Load server stopword into FTS cache */ + if (table->flags2 & DICT_TF2_FTS && + innobase_fts_load_stopword(table, nullptr, thd)) + fts_optimize_add_table(table); - innobase_table->autoinc_mutex.wr_lock(); - dict_table_autoinc_initialize(innobase_table, autoinc); + if (const Field *ai = t.found_next_number_field) + { + ut_ad(ai->stored_in_db()); + ib_uint64_t autoinc= info.auto_increment_value; + if (autoinc == 0) + autoinc= 1; - if (innobase_table->is_temporary()) { - /* AUTO_INCREMENT is not persistent for - TEMPORARY TABLE. Temporary tables are never - evicted. Keep the counter in memory only. */ - } else { - const unsigned col_no = innodb_col_no(ai); - - innobase_table->persistent_autoinc - = static_cast( - dict_table_get_nth_col_pos( - innobase_table, col_no, NULL) - + 1) - & dict_index_t::MAX_N_FIELDS; - - /* Persist the "last used" value, which - typically is AUTO_INCREMENT - 1. - In btr_create(), the value 0 was already written. */ - if (--autoinc) { - btr_write_autoinc( - dict_table_get_first_index( - innobase_table), - autoinc); - } - } + table->autoinc_mutex.wr_lock(); + dict_table_autoinc_initialize(table, autoinc); - innobase_table->autoinc_mutex.wr_unlock(); - } + if (!table->is_temporary()) + { + const unsigned col_no= innodb_col_no(ai); + table->persistent_autoinc= static_cast + (dict_table_get_nth_col_pos(table, col_no, nullptr) + 1) & + dict_index_t::MAX_N_FIELDS; + /* Persist the "last used" value, which typically is AUTO_INCREMENT - 1. + In btr_create(), the value 0 was already written. */ + if (--autoinc) + btr_write_autoinc(dict_table_get_first_index(table), autoinc); + } - innobase_parse_hint_from_comment(m_thd, innobase_table, m_form->s); + table->autoinc_mutex.wr_unlock(); + } - dict_table_close(innobase_table); - DBUG_RETURN(0); + innobase_parse_hint_from_comment(thd, table, t.s); } /** Allocate a new trx. */ @@ -13079,91 +13206,80 @@ create_table_info_t::allocate_trx() @param[in] create_info Create info (including create statement string). @param[in] file_per_table whether to create .ibd file @param[in,out] trx dictionary transaction, or NULL to create new -@return 0 if success else error number. */ -inline int -ha_innobase::create( - const char* name, - TABLE* form, - HA_CREATE_INFO* create_info, - bool file_per_table, - trx_t* trx) +@return error code +@retval 0 on success */ +int +ha_innobase::create(const char *name, TABLE *form, HA_CREATE_INFO *create_info, + bool file_per_table, trx_t *trx= nullptr) { - char norm_name[FN_REFLEN]; /* {database}/{tablename} */ - char remote_path[FN_REFLEN]; /* Absolute path of table */ + char norm_name[FN_REFLEN]; /* {database}/{tablename} */ + char remote_path[FN_REFLEN]; /* Absolute path of table */ - DBUG_ENTER("ha_innobase::create"); + DBUG_ENTER("ha_innobase::create"); + DBUG_ASSERT(form->s == table_share); + DBUG_ASSERT(table_share->table_type == TABLE_TYPE_SEQUENCE || + table_share->table_type == TABLE_TYPE_NORMAL); - DBUG_ASSERT(form->s == table_share); - DBUG_ASSERT(table_share->table_type == TABLE_TYPE_SEQUENCE - || table_share->table_type == TABLE_TYPE_NORMAL); + create_table_info_t info(ha_thd(), form, create_info, norm_name, + remote_path, file_per_table, trx); - create_table_info_t info(ha_thd(), - form, - create_info, - norm_name, - remote_path, - file_per_table, trx); + int error= info.initialize(); + if (!error) + error= info.prepare_create_table(name, !trx); + if (error) + DBUG_RETURN(error); - { - int error = info.initialize(); - if (!error) { - error = info.prepare_create_table(name, !trx); - } - if (error) { - if (trx) { - trx_rollback_for_mysql(trx); - row_mysql_unlock_data_dictionary(trx); - } - DBUG_RETURN(error); - } - } + const bool own_trx= !trx; + if (own_trx) + { + info.allocate_trx(); + trx= info.trx(); + DBUG_ASSERT(trx_state_eq(trx, TRX_STATE_NOT_STARTED)); - const bool own_trx = !trx; - int error = 0; + if (!(info.flags2() & DICT_TF2_TEMPORARY)) + { + trx_start_for_ddl(trx); + if (dberr_t err= lock_sys_tables(trx)) + error= convert_error_code_to_mysql(err, 0, nullptr); + } + row_mysql_lock_data_dictionary(trx); + } - if (own_trx) { - info.allocate_trx(); - trx = info.trx(); - DBUG_ASSERT(trx_state_eq(trx, TRX_STATE_NOT_STARTED)); - } - if (own_trx && !(info.flags2() & DICT_TF2_TEMPORARY)) { - trx_start_for_ddl(trx); - if (dberr_t err = lock_sys_tables(trx)) { - error = convert_error_code_to_mysql(err, 0, nullptr); - } - } - if (own_trx) { - row_mysql_lock_data_dictionary(trx); - } + if (!error) + error= info.create_table(own_trx); - if (!error) { - error = info.create_table(own_trx); - } + if (own_trx || (info.flags2() & DICT_TF2_TEMPORARY)) + { + if (error) + trx_rollback_for_mysql(trx); + else + { + std::vector deleted; + trx->commit(deleted); + ut_ad(deleted.empty()); + info.table()->acquire(); + info.create_table_update_dict(info.table(), info.thd(), + *create_info, *form); + } - if (error) { - /* Drop the being-created table before rollback, - so that rollback can possibly rename back a table - that could have been renamed before the failed creation. */ - trx_rollback_for_mysql(trx); - row_mysql_unlock_data_dictionary(trx); - } else { - /* When this is invoked as part of ha_innobase::truncate(), - the old copy of the table will be deleted here. */ - std::vector deleted; - trx->commit(deleted); - row_mysql_unlock_data_dictionary(trx); - for (pfs_os_file_t d : deleted) os_file_close(d); - error = info.create_table_update_dict(); - if (!(info.flags2() & DICT_TF2_TEMPORARY)) { - log_write_up_to(trx->commit_lsn, true); - } - } + if (own_trx) + { + row_mysql_unlock_data_dictionary(trx); - if (own_trx) { - trx->free(); - } + if (!error) + { + dict_stats_update(info.table(), DICT_STATS_EMPTY_TABLE); + if (!info.table()->is_temporary()) + log_write_up_to(trx->commit_lsn, true); + info.table()->release(); + } + trx->free(); + } + } + else if (!error && m_prebuilt) + m_prebuilt->table= info.table(); - DBUG_RETURN(error); + DBUG_RETURN(error); } /** Create a new table to an InnoDB database. @@ -13171,13 +13287,10 @@ ha_innobase::create( @param[in] form Table format; columns and index information. @param[in] create_info Create info (including create statement string). @return 0 if success else error number. */ -int -ha_innobase::create( - const char* name, - TABLE* form, - HA_CREATE_INFO* create_info) +int ha_innobase::create(const char *name, TABLE *form, + HA_CREATE_INFO *create_info) { - return create(name, form, create_info, srv_file_per_table); + return create(name, form, create_info, srv_file_per_table); } /*****************************************************************//** @@ -13346,11 +13459,12 @@ int ha_innobase::delete_table(const char *name) if (table->is_temporary()) { - dict_sys.remove(table, false, true); dict_sys.unlock(); parent_trx->mod_tables.erase(table); /* CREATE...SELECT error handling */ btr_drop_temporary_table(*table); - dict_mem_table_free(table); + dict_sys.lock(SRW_LOCK_CALL); + dict_sys.remove(table); + dict_sys.unlock(); DBUG_RETURN(0); } @@ -13358,6 +13472,7 @@ int ha_innobase::delete_table(const char *name) dict_sys.unlock(); trx_t *trx= parent_trx; + dberr_t err= DB_SUCCESS; if (!trx->lock.table_locks.empty() && thd_ddl_options(trx->mysql_thd)->is_create_select()) { @@ -13377,11 +13492,28 @@ int ha_innobase::delete_table(const char *name) { trx= innobase_trx_allocate(thd); trx_start_for_ddl(trx); + + if (table->name.is_temporary()) + /* There is no need to lock any FOREIGN KEY child tables. */; +#ifdef WITH_PARTITION_STORAGE_ENGINE + else if (table->name.part()) + /* FOREIGN KEY constraints cannot exist on partitioned tables. */; +#endif + else + { + dict_sys.freeze(SRW_LOCK_CALL); + for (const dict_foreign_t* f : table->referenced_set) + if (dict_table_t* child= f->foreign_table) + if ((err= lock_table_for_trx(child, trx, LOCK_X)) != DB_SUCCESS) + break; + dict_sys.unfreeze(); + } } dict_table_t *table_stats= nullptr, *index_stats= nullptr; MDL_ticket *mdl_table= nullptr, *mdl_index= nullptr; - dberr_t err= lock_table_for_trx(table, trx, LOCK_X); + if (err == DB_SUCCESS) + err= lock_table_for_trx(table, trx, LOCK_X); const bool fts= err == DB_SUCCESS && (table->flags2 & (DICT_TF2_FTS_HAS_DOC_ID | DICT_TF2_FTS)); @@ -13443,33 +13575,51 @@ int ha_innobase::delete_table(const char *name) dict_sys.unfreeze(); } - auto &timeout= THDVAR(thd, lock_wait_timeout); - const auto save_timeout= timeout; - if (table->name.is_temporary()) - timeout= 0; + const bool skip_wait{table->name.is_temporary()}; if (table_stats && index_stats && !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) && !strcmp(index_stats->name.m_name, INDEX_STATS_NAME) && - !(err= lock_table_for_trx(table_stats, trx, LOCK_X))) - err= lock_table_for_trx(index_stats, trx, LOCK_X); + !(err= lock_table_for_trx(table_stats, trx, LOCK_X, skip_wait))) + err= lock_table_for_trx(index_stats, trx, LOCK_X, skip_wait); - if (err != DB_SUCCESS && !timeout) + if (err != DB_SUCCESS && skip_wait) { /* We may skip deleting statistics if we cannot lock the tables, when the table carries a temporary name. */ + ut_ad(err == DB_LOCK_WAIT); + ut_ad(trx->error_state == DB_SUCCESS); err= DB_SUCCESS; dict_table_close(table_stats, false, thd, mdl_table); dict_table_close(index_stats, false, thd, mdl_index); table_stats= nullptr; index_stats= nullptr; } - - timeout= save_timeout; } if (err == DB_SUCCESS) + { + if (!table->space) + { + const char *data_dir_path= DICT_TF_HAS_DATA_DIR(table->flags) + ? table->data_dir_path : nullptr; + char *path= fil_make_filepath(data_dir_path, table->name, CFG, + data_dir_path != nullptr); + os_file_delete_if_exists(innodb_data_file_key, path, nullptr); + ut_free(path); + path= fil_make_filepath(data_dir_path, table->name, IBD, + data_dir_path != nullptr); + os_file_delete_if_exists(innodb_data_file_key, path, nullptr); + ut_free(path); + if (data_dir_path) + { + path= fil_make_filepath(nullptr, table->name, ISL, false); + os_file_delete_if_exists(innodb_data_file_key, path, nullptr); + ut_free(path); + } + } err= lock_sys_tables(trx); + } dict_sys.lock(SRW_LOCK_CALL); @@ -13669,228 +13819,251 @@ static dberr_t innobase_rename_table(trx_t *trx, const char *from, @retval 0 on success */ int ha_innobase::truncate() { - DBUG_ENTER("ha_innobase::truncate"); + DBUG_ENTER("ha_innobase::truncate"); - update_thd(); + update_thd(); - if (is_read_only()) { - DBUG_RETURN(HA_ERR_TABLE_READONLY); - } + if (is_read_only()) + DBUG_RETURN(HA_ERR_TABLE_READONLY); - HA_CREATE_INFO info; - dict_table_t* ib_table = m_prebuilt->table; - info.init(); - update_create_info_from_table(&info, table); - switch (dict_tf_get_rec_format(ib_table->flags)) { - case REC_FORMAT_REDUNDANT: - info.row_type = ROW_TYPE_REDUNDANT; - break; - case REC_FORMAT_COMPACT: - info.row_type = ROW_TYPE_COMPACT; - break; - case REC_FORMAT_COMPRESSED: - info.row_type = ROW_TYPE_COMPRESSED; - break; - case REC_FORMAT_DYNAMIC: - info.row_type = ROW_TYPE_DYNAMIC; - break; - } + HA_CREATE_INFO info; + dict_table_t *ib_table= m_prebuilt->table; + info.init(); + update_create_info_from_table(&info, table); + switch (dict_tf_get_rec_format(ib_table->flags)) { + case REC_FORMAT_REDUNDANT: + info.row_type= ROW_TYPE_REDUNDANT; + break; + case REC_FORMAT_COMPACT: + info.row_type= ROW_TYPE_COMPACT; + break; + case REC_FORMAT_COMPRESSED: + info.row_type= ROW_TYPE_COMPRESSED; + break; + case REC_FORMAT_DYNAMIC: + info.row_type= ROW_TYPE_DYNAMIC; + break; + } - const auto stored_lock = m_prebuilt->stored_select_lock_type; - trx_t* trx = innobase_trx_allocate(m_user_thd); - trx_start_for_ddl(trx); + const auto stored_lock= m_prebuilt->stored_select_lock_type; + trx_t *trx= innobase_trx_allocate(m_user_thd); + trx_start_for_ddl(trx); - if (ib_table->is_temporary()) { - info.options|= HA_LEX_CREATE_TMP_TABLE; - btr_drop_temporary_table(*ib_table); - m_prebuilt->table = nullptr; - row_prebuilt_free(m_prebuilt); - m_prebuilt = nullptr; - my_free(m_upd_buf); - m_upd_buf = nullptr; - m_upd_buf_size = 0; + if (ib_table->is_temporary()) + { + info.options|= HA_LEX_CREATE_TMP_TABLE; + btr_drop_temporary_table(*ib_table); + m_prebuilt->table= nullptr; + row_prebuilt_free(m_prebuilt); + m_prebuilt= nullptr; + my_free(m_upd_buf); + m_upd_buf= nullptr; + m_upd_buf_size= 0; - row_mysql_lock_data_dictionary(trx); - ib_table->release(); - dict_sys.remove(ib_table, false, true); + row_mysql_lock_data_dictionary(trx); + ib_table->release(); + dict_sys.remove(ib_table, false, true); + int err= create(ib_table->name.m_name, table, &info, true, trx); + row_mysql_unlock_data_dictionary(trx); - int err = create(ib_table->name.m_name, table, &info, true, - trx); - if (!err) { - err = open(ib_table->name.m_name, 0, 0); - m_prebuilt->stored_select_lock_type = stored_lock; - } + ut_ad(!err); + if (!err) + { + err= open(ib_table->name.m_name, 0, 0); + m_prebuilt->table->release(); + m_prebuilt->stored_select_lock_type= stored_lock; + } - trx->free(); + trx->free(); #ifdef BTR_CUR_HASH_ADAPT - if (UT_LIST_GET_LEN(ib_table->freed_indexes)) { - ib_table->vc_templ = nullptr; - ib_table->id = 0; - DBUG_RETURN(err); - } + if (UT_LIST_GET_LEN(ib_table->freed_indexes)) + { + ib_table->vc_templ= nullptr; + ib_table->id= 0; + } + else #endif /* BTR_CUR_HASH_ADAPT */ + dict_mem_table_free(ib_table); - dict_mem_table_free(ib_table); - DBUG_RETURN(err); - } + DBUG_RETURN(err); + } - mem_heap_t* heap = mem_heap_create(1000); + mem_heap_t *heap= mem_heap_create(1000); - dict_get_and_save_data_dir_path(ib_table, false); - info.data_file_name = ib_table->data_dir_path; - const char* temp_name = dict_mem_create_temporary_tablename( - heap, ib_table->name.m_name, ib_table->id); - const char* name = mem_heap_strdup(heap, ib_table->name.m_name); + if (!ib_table->space) + ib_senderrf(m_user_thd, IB_LOG_LEVEL_WARN, ER_TABLESPACE_DISCARDED, + table->s->table_name.str); - dict_table_t *table_stats = nullptr, *index_stats = nullptr; - MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; + dict_get_and_save_data_dir_path(ib_table); + info.data_file_name= ib_table->data_dir_path; + const char *temp_name= + dict_mem_create_temporary_tablename(heap, + ib_table->name.m_name, ib_table->id); + const char *name= mem_heap_strdup(heap, ib_table->name.m_name); - dberr_t error = DB_SUCCESS; + dict_table_t *table_stats = nullptr, *index_stats = nullptr; + MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; - dict_sys.freeze(SRW_LOCK_CALL); - for (const dict_foreign_t* f : ib_table->referenced_set) { - if (dict_table_t* child = f->foreign_table) { - error = lock_table_for_trx(child, trx, LOCK_X); - if (error != DB_SUCCESS) { - break; - } - } - } - dict_sys.unfreeze(); + dberr_t error= DB_SUCCESS; - if (error == DB_SUCCESS) { - error = lock_table_for_trx(ib_table, trx, LOCK_X); - } + dict_sys.freeze(SRW_LOCK_CALL); + for (const dict_foreign_t *f : ib_table->referenced_set) + if (dict_table_t *child= f->foreign_table) + if ((error= lock_table_for_trx(child, trx, LOCK_X)) != DB_SUCCESS) + break; + dict_sys.unfreeze(); - const bool fts = error == DB_SUCCESS - && ib_table->flags2 & (DICT_TF2_FTS_HAS_DOC_ID | DICT_TF2_FTS); + if (error == DB_SUCCESS) + error= lock_table_for_trx(ib_table, trx, LOCK_X); - if (fts) { - fts_optimize_remove_table(ib_table); - purge_sys.stop_FTS(*ib_table); - error = fts_lock_tables(trx, *ib_table); - } + const bool fts= error == DB_SUCCESS && + ib_table->flags2 & (DICT_TF2_FTS_HAS_DOC_ID | DICT_TF2_FTS); - /* Wait for purge threads to stop using the table. */ - for (uint n = 15; ib_table->get_ref_count() > 1; ) { - if (!--n) { - error = DB_LOCK_WAIT_TIMEOUT; - break; - } + if (fts) + { + fts_optimize_remove_table(ib_table); + purge_sys.stop_FTS(*ib_table); + error= fts_lock_tables(trx, *ib_table); + } - std::this_thread::sleep_for(std::chrono::milliseconds(50)); - } + /* Wait for purge threads to stop using the table. */ + for (uint n = 15; ib_table->get_ref_count() > 1; ) + { + if (!--n) + { + error= DB_LOCK_WAIT_TIMEOUT; + break; + } + std::this_thread::sleep_for(std::chrono::milliseconds(50)); + } - if (error == DB_SUCCESS && dict_stats_is_persistent_enabled(ib_table) - && !ib_table->is_stats_table()) { - table_stats= dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats = dict_acquire_mdl_shared( - table_stats, m_user_thd, &mdl_table); - dict_sys.unfreeze(); - } - index_stats = dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats = dict_acquire_mdl_shared( - index_stats, m_user_thd, &mdl_index); - dict_sys.unfreeze(); - } + if (error == DB_SUCCESS && dict_stats_is_persistent_enabled(ib_table) && + !ib_table->is_stats_table()) + { + table_stats= dict_table_open_on_name(TABLE_STATS_NAME, false, + DICT_ERR_IGNORE_NONE); + if (table_stats) + { + dict_sys.freeze(SRW_LOCK_CALL); + table_stats= dict_acquire_mdl_shared(table_stats, m_user_thd, + &mdl_table); + dict_sys.unfreeze(); + } + index_stats= dict_table_open_on_name(INDEX_STATS_NAME, false, + DICT_ERR_IGNORE_NONE); + if (index_stats) + { + dict_sys.freeze(SRW_LOCK_CALL); + index_stats= dict_acquire_mdl_shared(index_stats, m_user_thd, + &mdl_index); + dict_sys.unfreeze(); + } - if (table_stats && index_stats - && !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) - && !strcmp(index_stats->name.m_name, INDEX_STATS_NAME) && - !(error = lock_table_for_trx(table_stats, trx, LOCK_X))) { - error = lock_table_for_trx(index_stats, trx, LOCK_X); - } - } + if (table_stats && index_stats && + !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) && + !strcmp(index_stats->name.m_name, INDEX_STATS_NAME) && + !(error= lock_table_for_trx(table_stats, trx, LOCK_X))) + error= lock_table_for_trx(index_stats, trx, LOCK_X); + } - if (error == DB_SUCCESS) { - error = lock_sys_tables(trx); - } + if (error == DB_SUCCESS) + error= lock_sys_tables(trx); - row_mysql_lock_data_dictionary(trx); + std::vector deleted; - if (error == DB_SUCCESS) { - error = innobase_rename_table(trx, ib_table->name.m_name, - temp_name, false); + row_mysql_lock_data_dictionary(trx); - if (error == DB_SUCCESS) { - error = trx->drop_table(*ib_table); - } - } + if (error == DB_SUCCESS) + { + error= innobase_rename_table(trx, ib_table->name.m_name, temp_name, false); + if (error == DB_SUCCESS) + error= trx->drop_table(*ib_table); + } - int err = convert_error_code_to_mysql(error, ib_table->flags, - m_user_thd); - if (err) { - trx_rollback_for_mysql(trx); - if (fts) { - fts_optimize_add_table(ib_table); - purge_sys.resume_FTS(); - } - row_mysql_unlock_data_dictionary(trx); - } else { - const auto update_time = ib_table->update_time; - const auto stored_lock = m_prebuilt->stored_select_lock_type; - const auto def_trx_id = ib_table->def_trx_id; - ib_table->release(); - m_prebuilt->table = nullptr; + int err = convert_error_code_to_mysql(error, ib_table->flags, m_user_thd); + const auto update_time = ib_table->update_time; - err = create(name, table, &info, - dict_table_is_file_per_table(ib_table), trx); - /* On success, create() durably committed trx. */ - if (fts) { - purge_sys.resume_FTS(); - } + if (err) + { + trx_rollback_for_mysql(trx); + if (fts) + fts_optimize_add_table(ib_table); + } + else + { + const auto def_trx_id= ib_table->def_trx_id; + ib_table->release(); + m_prebuilt->table= nullptr; - if (err) { -reload: - m_prebuilt->table = dict_table_open_on_name( - name, false, DICT_ERR_IGNORE_NONE); - m_prebuilt->table->def_trx_id = def_trx_id; - } else { - row_prebuilt_t* prebuilt = m_prebuilt; - uchar* upd_buf = m_upd_buf; - ulint upd_buf_size = m_upd_buf_size; - /* Mimic ha_innobase::close(). */ - m_prebuilt = nullptr; - m_upd_buf = nullptr; - m_upd_buf_size = 0; + err= create(name, table, &info, dict_table_is_file_per_table(ib_table), + trx); + if (!err) + { + m_prebuilt->table->acquire(); + create_table_info_t::create_table_update_dict(m_prebuilt->table, + m_user_thd, info, *table); + trx->commit(deleted); + } + else + { + trx_rollback_for_mysql(trx); + m_prebuilt->table= dict_table_open_on_name(name, true, + DICT_ERR_IGNORE_FK_NOKEY); + m_prebuilt->table->def_trx_id= def_trx_id; + } + dict_names_t fk_tables; + dict_load_foreigns(m_prebuilt->table->name.m_name, nullptr, 1, true, + DICT_ERR_IGNORE_FK_NOKEY, fk_tables); + for (const char *f : fk_tables) + dict_sys.load_table({f, strlen(f)}); + } - err = open(name, 0, 0); + if (fts) + purge_sys.resume_FTS(); - if (!err) { - m_prebuilt->stored_select_lock_type - = stored_lock; - m_prebuilt->table->update_time = update_time; - row_prebuilt_free(prebuilt); - my_free(upd_buf); - } else { - /* Revert to the old table. */ - m_prebuilt = prebuilt; - m_upd_buf = upd_buf; - m_upd_buf_size = upd_buf_size; - goto reload; - } - } - } + row_mysql_unlock_data_dictionary(trx); + for (pfs_os_file_t d : deleted) os_file_close(d); - trx->free(); + if (!err) + { + dict_stats_update(m_prebuilt->table, DICT_STATS_EMPTY_TABLE); + log_write_up_to(trx->commit_lsn, true); + row_prebuilt_t *prebuilt= m_prebuilt; + uchar *upd_buf= m_upd_buf; + ulint upd_buf_size= m_upd_buf_size; + /* Mimic ha_innobase::close(). */ + m_prebuilt= nullptr; + m_upd_buf= nullptr; + m_upd_buf_size= 0; + + err= open(name, 0, 0); + if (!err) + { + m_prebuilt->stored_select_lock_type= stored_lock; + m_prebuilt->table->update_time= update_time; + row_prebuilt_free(prebuilt); + my_free(upd_buf); + } + else + { + /* Revert to the old table. */ + m_prebuilt= prebuilt; + m_upd_buf= upd_buf; + m_upd_buf_size= upd_buf_size; + } + } - mem_heap_free(heap); + trx->free(); - if (table_stats) { - dict_table_close(table_stats, false, m_user_thd, mdl_table); - } - if (index_stats) { - dict_table_close(index_stats, false, m_user_thd, mdl_index); - } + mem_heap_free(heap); - DBUG_RETURN(err); + if (table_stats) + dict_table_close(table_stats, false, m_user_thd, mdl_table); + if (index_stats) + dict_table_close(index_stats, false, m_user_thd, mdl_index); + + DBUG_RETURN(err); } /*********************************************************************//** @@ -13970,17 +14143,15 @@ ha_innobase::rename_table( if (error == DB_SUCCESS && table_stats && index_stats && !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) && !strcmp(index_stats->name.m_name, INDEX_STATS_NAME)) { - auto &timeout = THDVAR(thd, lock_wait_timeout); - const auto save_timeout = timeout; - if (from_temp) { - timeout = 0; - } - error = lock_table_for_trx(table_stats, trx, LOCK_X); + error = lock_table_for_trx(table_stats, trx, LOCK_X, + from_temp); if (error == DB_SUCCESS) { error = lock_table_for_trx(index_stats, trx, - LOCK_X); + LOCK_X, from_temp); } if (error != DB_SUCCESS && from_temp) { + ut_ad(error == DB_LOCK_WAIT); + ut_ad(trx->error_state == DB_SUCCESS); error = DB_SUCCESS; /* We may skip renaming statistics if we cannot lock the tables, when the @@ -13993,7 +14164,6 @@ ha_innobase::rename_table( table_stats = nullptr; index_stats = nullptr; } - timeout = save_timeout; } } @@ -14660,9 +14830,11 @@ ha_innobase::info_low( stats.index_file_length = ulonglong(stat_sum_of_other_index_sizes) * size; + space->s_lock(); stats.delete_length = 1024 * fsp_get_available_space_in_free_extents( *space); + space->s_unlock(); } stats.check_time = 0; stats.mrr_length_per_rec= (uint)ref_length + 8; // 8 = max(sizeof(void *)); @@ -14892,16 +15064,9 @@ inline int ha_innobase::defragment_table() for (dict_index_t *index= dict_table_get_first_index(m_prebuilt->table); index; index= dict_table_get_next_index(index)) { - if (index->is_corrupted() || index->is_spatial()) + if (!index->is_btree()) continue; - if (index->page == FIL_NULL) - { - /* Do not defragment auxiliary tables related to FULLTEXT INDEX. */ - ut_ad(index->type & DICT_FTS); - continue; - } - if (btr_defragment_find_index(index)) { // We borrow this error code. When the same index is already in @@ -14916,14 +15081,10 @@ inline int ha_innobase::defragment_table() } btr_pcur_t pcur; - pcur.btr_cur.index = nullptr; - btr_pcur_init(&pcur); mtr_t mtr; mtr.start(); - if (dberr_t err= btr_pcur_open_at_index_side(true, index, - BTR_SEARCH_LEAF, &pcur, - true, 0, &mtr)) + if (dberr_t err= pcur.open_leaf(true, index, BTR_SEARCH_LEAF, &mtr)) { mtr.commit(); return convert_error_code_to_mysql(err, 0, m_user_thd); @@ -14937,9 +15098,9 @@ inline int ha_innobase::defragment_table() btr_pcur_move_to_next(&pcur, &mtr); btr_pcur_store_position(&pcur, &mtr); mtr.commit(); - ut_ad(pcur.btr_cur.index == index); + ut_ad(pcur.index() == index); const bool interrupted= btr_defragment_add_index(&pcur, m_user_thd); - btr_pcur_free(&pcur); + ut_free(pcur.old_rec_buf); if (interrupted) return ER_QUERY_INTERRUPTED; } @@ -15011,7 +15172,6 @@ ha_innobase::check( THD* thd, /*!< in: user thread handle */ HA_CHECK_OPT* check_opt) /*!< in: check options */ { - dict_index_t* index; ulint n_rows; ulint n_rows_in_table = ULINT_UNDEFINED; bool is_ok = true; @@ -15019,8 +15179,10 @@ ha_innobase::check( DBUG_ENTER("ha_innobase::check"); DBUG_ASSERT(thd == ha_thd()); + DBUG_ASSERT(thd == m_user_thd); ut_a(m_prebuilt->trx->magic_n == TRX_MAGIC_N); ut_a(m_prebuilt->trx == thd_to_trx(thd)); + ut_ad(m_prebuilt->trx->mysql_thd == thd); if (m_prebuilt->mysql_template == NULL) { /* Build the template; we will use a dummy template @@ -15030,7 +15192,6 @@ ha_innobase::check( } if (!m_prebuilt->table->space) { - ib_senderrf( thd, IB_LOG_LEVEL_ERROR, @@ -15038,10 +15199,7 @@ ha_innobase::check( table->s->table_name.str); DBUG_RETURN(HA_ADMIN_CORRUPT); - - } else if (!m_prebuilt->table->is_readable() && - !m_prebuilt->table->space) { - + } else if (!m_prebuilt->table->is_readable()) { ib_senderrf( thd, IB_LOG_LEVEL_ERROR, ER_TABLESPACE_MISSING, @@ -15052,30 +15210,6 @@ ha_innobase::check( m_prebuilt->trx->op_info = "checking table"; - if (m_prebuilt->table->corrupted) { - /* If some previous operation has marked the table as - corrupted in memory, and has not propagated such to - clustered index, we will do so here */ - index = dict_table_get_first_index(m_prebuilt->table); - - if (!index->is_corrupted()) { - dict_set_corrupted(index, "CHECK TABLE", false); - } - - push_warning_printf(m_user_thd, - Sql_condition::WARN_LEVEL_WARN, - HA_ERR_INDEX_CORRUPT, - "InnoDB: Index %s is marked as" - " corrupted", - index->name()); - - /* Now that the table is already marked as corrupted, - there is no need to check any index of this table */ - m_prebuilt->trx->op_info = ""; - - DBUG_RETURN(HA_ADMIN_CORRUPT); - } - uint old_isolation_level = m_prebuilt->trx->isolation_level; /* We must run the index record counts at an isolation level @@ -15083,47 +15217,45 @@ ha_innobase::check( of records in some index; to play safe, we normally use REPEATABLE READ here */ m_prebuilt->trx->isolation_level = high_level_read_only + && !m_prebuilt->table->is_temporary() ? TRX_ISO_READ_UNCOMMITTED : TRX_ISO_REPEATABLE_READ; - ut_ad(!m_prebuilt->table->corrupted); + trx_start_if_not_started(m_prebuilt->trx, false); + m_prebuilt->trx->read_view.open(m_prebuilt->trx); - for (index = dict_table_get_first_index(m_prebuilt->table); - index != NULL; + for (dict_index_t* index + = dict_table_get_first_index(m_prebuilt->table); + index; index = dict_table_get_next_index(index)) { /* If this is an index being created or dropped, skip */ if (!index->is_committed()) { continue; } + if (index->type & DICT_FTS) { + /* We do not check any FULLTEXT INDEX. */ + continue; + } - if (!(check_opt->flags & T_QUICK) - && !index->is_corrupted()) { - - dberr_t err = btr_validate_index( - index, m_prebuilt->trx); + if ((check_opt->flags & T_QUICK) || index->is_corrupted()) { + } else if (trx_id_t bulk_trx_id = + m_prebuilt->table->bulk_trx_id) { + if (!m_prebuilt->trx->read_view.changes_visible( + bulk_trx_id)) { + is_ok = true; + goto func_exit; + } - if (err != DB_SUCCESS) { + if (btr_validate_index(index, m_prebuilt->trx) + != DB_SUCCESS) { is_ok = false; - - if (err == DB_DECRYPTION_FAILED) { - push_warning_printf( - thd, - Sql_condition::WARN_LEVEL_WARN, - ER_NO_SUCH_TABLE, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue checking table.", - index->table->name.m_name); - } else { - push_warning_printf( - thd, - Sql_condition::WARN_LEVEL_WARN, - ER_NOT_KEYFILE, - "InnoDB: The B-tree of" - " index %s is corrupted.", - index->name()); - } - + push_warning_printf( + thd, + Sql_condition::WARN_LEVEL_WARN, + ER_NOT_KEYFILE, + "InnoDB: The B-tree of" + " index %s is corrupted.", + index->name()); continue; } } @@ -15141,14 +15273,13 @@ ha_innobase::check( if (!index->is_primary()) { m_prebuilt->index_usable = FALSE; dict_set_corrupted(index, - "dict_set_index_corrupted", - false); + "dict_set_index_corrupted"); }); if (UNIV_UNLIKELY(!m_prebuilt->index_usable)) { if (index->is_corrupted()) { push_warning_printf( - m_user_thd, + thd, Sql_condition::WARN_LEVEL_WARN, HA_ERR_INDEX_CORRUPT, "InnoDB: Index %s is marked as" @@ -15157,7 +15288,7 @@ ha_innobase::check( is_ok = false; } else { push_warning_printf( - m_user_thd, + thd, Sql_condition::WARN_LEVEL_WARN, HA_ERR_TABLE_DEF_CHANGED, "InnoDB: Insufficient history for" @@ -15170,18 +15301,22 @@ ha_innobase::check( m_prebuilt->sql_stat_start = TRUE; m_prebuilt->template_type = ROW_MYSQL_DUMMY_TEMPLATE; m_prebuilt->n_template = 0; - m_prebuilt->need_to_access_clustered = FALSE; + m_prebuilt->read_just_key = 0; + m_prebuilt->autoinc_error = DB_SUCCESS; + m_prebuilt->need_to_access_clustered = + !!(check_opt->flags & T_EXTEND); dtuple_set_n_fields(m_prebuilt->search_tuple, 0); m_prebuilt->select_lock_type = LOCK_NONE; /* Scan this index. */ - if (dict_index_is_spatial(index)) { + if (index->is_spatial()) { ret = row_count_rtree_recs(m_prebuilt, &n_rows); + } else if (index->type & DICT_FTS) { + ret = DB_SUCCESS; } else { - ret = row_scan_index_for_mysql( - m_prebuilt, index, &n_rows); + ret = row_check_index(m_prebuilt, &n_rows); } DBUG_EXECUTE_IF( @@ -15190,11 +15325,18 @@ ha_innobase::check( ret = DB_CORRUPTION; }); - if (ret == DB_INTERRUPTED || thd_killed(m_user_thd)) { + if (ret == DB_INTERRUPTED || thd_killed(thd)) { /* Do not report error since this could happen during shutdown */ break; } + + if (ret == DB_SUCCESS + && m_prebuilt->autoinc_error != DB_MISSING_HISTORY) { + /* See if any non-fatal errors were reported. */ + ret = m_prebuilt->autoinc_error; + } + if (ret != DB_SUCCESS) { /* Assume some kind of corruption. */ push_warning_printf( @@ -15204,8 +15346,7 @@ ha_innobase::check( " index %s is corrupted.", index->name()); is_ok = false; - dict_set_corrupted(index, "CHECK TABLE-check index", - false); + dict_set_corrupted(index, "CHECK TABLE-check index"); } @@ -15220,8 +15361,7 @@ ha_innobase::check( " entries, should be " ULINTPF ".", index->name(), n_rows, n_rows_in_table); is_ok = false; - dict_set_corrupted(index, "CHECK TABLE; Wrong count", - false); + dict_set_corrupted(index, "CHECK TABLE; Wrong count"); } } @@ -15240,6 +15380,7 @@ ha_innobase::check( } # endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */ #endif /* BTR_CUR_HASH_ADAPT */ +func_exit: m_prebuilt->trx->op_info = ""; DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT); @@ -15523,30 +15664,12 @@ delete is then allowed internally to resolve a duplicate key conflict in REPLACE, not an update. @return > 0 if referenced by a FOREIGN KEY */ -uint -ha_innobase::referenced_by_foreign_key(void) -/*========================================*/ +uint ha_innobase::referenced_by_foreign_key() { - if (dict_table_is_referenced_by_foreign_key(m_prebuilt->table)) { - - return(1); - } - - return(0); -} - -/*******************************************************************//** -Frees the foreign key create info for a table stored in InnoDB, if it is -non-NULL. */ - -void -ha_innobase::free_foreign_key_create_info( -/*======================================*/ - char* str) /*!< in, own: create info string to free */ -{ - if (str != NULL) { - my_free(str); - } + dict_sys.freeze(SRW_LOCK_CALL); + const bool empty= m_prebuilt->table->referenced_set.empty(); + dict_sys.unfreeze(); + return !empty; } /*******************************************************************//** @@ -15717,6 +15840,12 @@ ha_innobase::start_stmt( if (!trx->bulk_insert) { break; } + + /* Trigger could've initiated another stmt. + So apply all bulk operation and mark as + end bulk insert for all tables */ + trx->bulk_insert_apply(); + trx->end_bulk_insert(); trx->bulk_insert = false; trx->last_sql_stat_start.least_undo_no = trx->undo_no; } @@ -16534,8 +16663,8 @@ ha_innobase::get_auto_increment( (3) It is restricted only for insert operations. */ - if (increment > 1 && thd_sql_command(m_user_thd) != SQLCOM_ALTER_TABLE - && autoinc < col_max_value) { + if (increment > 1 && increment <= ~autoinc && autoinc < col_max_value + && thd_sql_command(m_user_thd) != SQLCOM_ALTER_TABLE) { ulonglong prev_auto_inc = autoinc; @@ -16761,7 +16890,8 @@ ha_innobase::cmp_ref( } if (result) { - + if (key_part->key_part_flag & HA_REVERSE_SORT) + result = -result; return(result); } @@ -16916,8 +17046,9 @@ innobase_xa_prepare( /* Store the current undo_no of the transaction so that we know where to roll back if we have to roll back the next SQL statement */ - - trx_mark_sql_stat_end(trx); + if (UNIV_UNLIKELY(end_of_statement(trx))) { + return 1; + } } if (thd_sql_command(thd) != SQLCOM_XA_PREPARE @@ -17279,7 +17410,7 @@ innodb_stopword_table_validate( /* Validate the stopword table's (if supplied) existence and of the right format */ int ret = stopword_table_name && !fts_valid_stopword_table( - stopword_table_name); + stopword_table_name, NULL); row_mysql_unlock_data_dictionary(trx); @@ -17306,16 +17437,11 @@ static void innodb_buffer_pool_size_update(THD*,st_mysql_sys_var*,void*, const void* save) { - longlong in_val = *static_cast(save); - snprintf(export_vars.innodb_buffer_pool_resize_status, sizeof(export_vars.innodb_buffer_pool_resize_status), - "Requested to resize buffer pool."); + "Buffer pool resize requested"); buf_resize_start(); - - ib::info() << export_vars.innodb_buffer_pool_resize_status - << " (new size: " << in_val << " bytes)"; } /** The latest assigned innodb_ft_aux_table name */ @@ -17866,44 +17992,6 @@ innodb_monitor_update( return; } -/** Validate SET GLOBAL innodb_buffer_pool_filename. -On Windows, file names with colon (:) are not allowed. -@param thd connection -@param save &srv_buf_dump_filename -@param value new value to be validated -@return 0 for valid name */ -static int innodb_srv_buf_dump_filename_validate(THD *thd, st_mysql_sys_var*, - void *save, - st_mysql_value *value) -{ - char buff[OS_FILE_MAX_PATH]; - int len= sizeof buff; - - if (const char *buf_name= value->val_str(value, buff, &len)) - { -#ifdef _WIN32 - if (!is_filename_allowed(buf_name, len, FALSE)) - { - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_WRONG_ARGUMENTS, - "InnoDB: innodb_buffer_pool_filename " - "cannot have colon (:) in the file name."); - return 1; - } -#endif /* _WIN32 */ - if (buf_name == buff) - { - ut_ad(static_cast(len) < sizeof buff); - buf_name= thd_strmake(thd, buf_name, len); - } - - *static_cast(save)= buf_name; - return 0; - } - - return 1; -} - #ifdef UNIV_DEBUG static char* srv_buffer_pool_evict; @@ -18099,7 +18187,9 @@ innodb_enable_monitor_at_startup( /****************************************************************//** Callback function for accessing the InnoDB variables from MySQL: SHOW VARIABLES. */ -static int show_innodb_vars(THD*, SHOW_VAR* var, char*) +static int show_innodb_vars(THD*, SHOW_VAR* var, void *, + struct system_status_var *status_var, + enum enum_var_type var_type) { innodb_export_status(); var->type = SHOW_ARRAY; @@ -18376,6 +18466,16 @@ buffer_pool_load_abort( } } +#if defined __linux__ || defined _WIN32 +static void innodb_log_file_buffering_update(THD *thd, st_mysql_sys_var*, + void *, const void *save) +{ + mysql_mutex_unlock(&LOCK_global_system_variables); + log_sys.set_buffered(*static_cast(save)); + mysql_mutex_lock(&LOCK_global_system_variables); +} +#endif + /** Update innodb_status_output or innodb_status_output_locks, which control InnoDB "status monitor" output to the error log. @param[out] var current value @@ -18441,7 +18541,7 @@ innodb_encrypt_tables_update(THD*, st_mysql_sys_var*, void*, const void* save) } static SHOW_VAR innodb_status_variables_export[]= { - {"Innodb", (char*) &show_innodb_vars, SHOW_FUNC}, + SHOW_FUNC_ENTRY("Innodb", &show_innodb_vars), {NullS, NullS, SHOW_LONG} }; @@ -18523,7 +18623,15 @@ void lock_wait_wsrep_kill(trx_t *bf_trx, ulong thd_id, trx_id_t trx_id) lock_sys.cancel_lock_wait_for_trx(vtrx); DEBUG_SYNC(bf_thd, "before_wsrep_thd_abort"); - wsrep_thd_bf_abort(bf_thd, vthd, true); + if (!wsrep_thd_bf_abort(bf_thd, vthd, true)) + { + wsrep_thd_LOCK(vthd); + wsrep_thd_set_wsrep_aborter(NULL, vthd); + wsrep_thd_UNLOCK(vthd); + + WSREP_DEBUG("wsrep_thd_bf_abort has failed, victim %lu will survive", + thd_get_thread_id(vthd)); + } } wsrep_thd_kill_UNLOCK(vthd); } @@ -18550,7 +18658,10 @@ wsrep_abort_transaction( ut_ad(bf_thd); ut_ad(victim_thd); + wsrep_thd_kill_LOCK(victim_thd); + wsrep_thd_LOCK(victim_thd); trx_t* victim_trx= thd_to_trx(victim_thd); + wsrep_thd_UNLOCK(victim_thd); WSREP_DEBUG("abort transaction: BF: %s victim: %s victim conf: %s", wsrep_thd_query(bf_thd), @@ -18560,7 +18671,6 @@ wsrep_abort_transaction( if (victim_trx) { victim_trx->lock.set_wsrep_victim(); - wsrep_thd_kill_LOCK(victim_thd); wsrep_thd_LOCK(victim_thd); bool aborting= !wsrep_thd_set_wsrep_aborter(bf_thd, victim_thd); wsrep_thd_UNLOCK(victim_thd); @@ -18577,8 +18687,6 @@ wsrep_abort_transaction( };); wsrep_thd_bf_abort(bf_thd, victim_thd, signal); } - wsrep_thd_kill_UNLOCK(victim_thd); - DBUG_VOID_RETURN; } else { DBUG_EXECUTE_IF("sync.before_wsrep_thd_abort", { @@ -18589,11 +18697,10 @@ wsrep_abort_transaction( DBUG_ASSERT(!debug_sync_set_action(bf_thd, STRING_WITH_LEN(act))); };); - wsrep_thd_kill_LOCK(victim_thd); wsrep_thd_bf_abort(bf_thd, victim_thd, signal); - wsrep_thd_kill_UNLOCK(victim_thd); } + wsrep_thd_kill_UNLOCK(victim_thd); DBUG_VOID_RETURN; } @@ -18792,7 +18899,7 @@ static MYSQL_SYSVAR_ENUM(flush_method, srv_file_flush_method, static MYSQL_SYSVAR_STR(log_group_home_dir, srv_log_group_home_dir, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, - "Path to InnoDB log files.", NULL, NULL, NULL); + "Path to ib_logfile0", NULL, NULL, NULL); static MYSQL_SYSVAR_DOUBLE(max_dirty_pages_pct, srv_max_buf_pool_modified_pct, PLUGIN_VAR_RQCMDARG, @@ -18927,31 +19034,6 @@ static MYSQL_SYSVAR_UINT(autoextend_increment, "Data file autoextend increment in megabytes", NULL, NULL, 64, 1, 1000, 0); -/** Validate the requested buffer pool size. Also, reserve the necessary -memory needed for buffer pool resize. -@param[in] thd thread handle -@param[in] var pointer to system variable -@param[out] save immediate result for update function -@param[in] value incoming string -@return 0 on success, 1 on failure. -*/ -static -int -innodb_buffer_pool_size_validate( - THD* thd, - struct st_mysql_sys_var* var, - void* save, - struct st_mysql_value* value); - -static MYSQL_SYSVAR_ULONGLONG(buffer_pool_size, innobase_buffer_pool_size, - PLUGIN_VAR_RQCMDARG, - "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.", - innodb_buffer_pool_size_validate, - innodb_buffer_pool_size_update, - srv_buf_pool_def_size, - srv_buf_pool_min_size, - LLONG_MAX, 1024*1024L); - static MYSQL_SYSVAR_SIZE_T(buffer_pool_chunk_size, srv_buf_pool_chunk_unit, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "Size of a single memory chunk" @@ -18961,9 +19043,9 @@ static MYSQL_SYSVAR_SIZE_T(buffer_pool_chunk_size, srv_buf_pool_chunk_unit, 0, 0, SIZE_T_MAX, 1024 * 1024); static MYSQL_SYSVAR_STR(buffer_pool_filename, srv_buf_dump_filename, - PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "Filename to/from which to dump/load the InnoDB buffer pool", - innodb_srv_buf_dump_filename_validate, NULL, SRV_BUF_DUMP_FILENAME_DEFAULT); + NULL, NULL, SRV_BUF_DUMP_FILENAME_DEFAULT); static MYSQL_SYSVAR_BOOL(buffer_pool_dump_now, innodb_buffer_pool_dump_now, PLUGIN_VAR_RQCMDARG, @@ -19113,15 +19195,35 @@ static MYSQL_SYSVAR_STR(ft_aux_table, innodb_ft_aux_table, "FTS internal auxiliary table to be checked", innodb_ft_aux_table_validate, NULL, NULL); -static MYSQL_SYSVAR_ULONG(ft_cache_size, fts_max_cache_size, - PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, +#if UNIV_WORD_SIZE == 4 + +static MYSQL_SYSVAR_SIZE_T(ft_cache_size, + *reinterpret_cast(&fts_max_cache_size), + PLUGIN_VAR_RQCMDARG, "InnoDB Fulltext search cache size in bytes", - NULL, NULL, 8000000, 1600000, 80000000, 0); + NULL, innodb_ft_cache_size_update, 8000000, 1600000, 1U << 29, 0); -static MYSQL_SYSVAR_ULONG(ft_total_cache_size, fts_max_total_cache_size, - PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, +static MYSQL_SYSVAR_SIZE_T(ft_total_cache_size, + *reinterpret_cast(&fts_max_total_cache_size), + PLUGIN_VAR_RQCMDARG, + "Total memory allocated for InnoDB Fulltext Search cache", + NULL, innodb_ft_total_cache_size_update, 640000000, 32000000, 1600000000, 0); + +#else + +static MYSQL_SYSVAR_SIZE_T(ft_cache_size, + *reinterpret_cast(&fts_max_cache_size), + PLUGIN_VAR_RQCMDARG, + "InnoDB Fulltext search cache size in bytes", + NULL, innodb_ft_cache_size_update, 8000000, 1600000, 1ULL << 40, 0); + +static MYSQL_SYSVAR_SIZE_T(ft_total_cache_size, + *reinterpret_cast(&fts_max_total_cache_size), + PLUGIN_VAR_RQCMDARG, "Total memory allocated for InnoDB Fulltext Search cache", - NULL, NULL, 640000000, 32000000, 1600000000, 0); + NULL, innodb_ft_total_cache_size_update, 640000000, 32000000, 1ULL << 40, 0); + +#endif static MYSQL_SYSVAR_SIZE_T(ft_result_cache_limit, fts_result_cache_limit, PLUGIN_VAR_RQCMDARG, @@ -19189,10 +19291,17 @@ static MYSQL_SYSVAR_SIZE_T(log_buffer_size, log_sys.buf_size, "Redo log buffer size in bytes.", NULL, NULL, 16U << 20, 2U << 20, SIZE_T_MAX, 4096); +#if defined __linux__ || defined _WIN32 +static MYSQL_SYSVAR_BOOL(log_file_buffering, log_sys.log_buffered, + PLUGIN_VAR_OPCMDARG, + "Whether the file system cache for ib_logfile0 is enabled", + nullptr, innodb_log_file_buffering_update, FALSE); +#endif + static MYSQL_SYSVAR_ULONGLONG(log_file_size, srv_log_file_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "Redo log size in bytes.", - NULL, NULL, 96 << 20, 1U << 20, std::numeric_limits::max(), 4096); + NULL, NULL, 96 << 20, 4 << 20, std::numeric_limits::max(), 4096); static MYSQL_SYSVAR_UINT(old_blocks_pct, innobase_old_blocks_pct, PLUGIN_VAR_RQCMDARG, @@ -19323,10 +19432,22 @@ static MYSQL_SYSVAR_BOOL(numa_interleave, srv_numa_interleave, NULL, NULL, FALSE); #endif /* HAVE_LIBNUMA */ +static void innodb_change_buffering_update(THD *thd, struct st_mysql_sys_var*, + void*, const void *save) +{ + ulong i= *static_cast(save); + if (i != IBUF_USE_NONE && !ibuf.index) + push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_NOT_KEYFILE, + "InnoDB: The change buffer is corrupted."); + else + innodb_change_buffering= i; +} + static MYSQL_SYSVAR_ENUM(change_buffering, innodb_change_buffering, PLUGIN_VAR_RQCMDARG, "Buffer changes to secondary indexes.", - NULL, NULL, IBUF_USE_ALL, &innodb_change_buffering_typelib); + nullptr, innodb_change_buffering_update, + IBUF_USE_NONE, &innodb_change_buffering_typelib); static MYSQL_SYSVAR_UINT(change_buffer_max_size, srv_change_buffer_max_size, @@ -19363,42 +19484,6 @@ static MYSQL_SYSVAR_ULONG(buf_dump_status_frequency, srv_buf_dump_status_frequen "dumped. Default is 0 (only start and end status is printed).", NULL, NULL, 0, 0, 100, 0); -#ifdef WITH_INNODB_DISALLOW_WRITES -my_bool innodb_disallow_writes; - -void innodb_wait_allow_writes() -{ - if (UNIV_UNLIKELY(innodb_disallow_writes)) - { - mysql_mutex_lock(&LOCK_global_system_variables); - while (innodb_disallow_writes) - my_cond_wait(&allow_writes_cond, &LOCK_global_system_variables.m_mutex); - mysql_mutex_unlock(&LOCK_global_system_variables); - } -} - -/************************************************************************** -An "update" method for innobase_disallow_writes variable. */ -static -void -innobase_disallow_writes_update(THD*, st_mysql_sys_var*, - void* var_ptr, const void* save) -{ - const my_bool val = *static_cast(save); - *static_cast(var_ptr) = val; - mysql_mutex_unlock(&LOCK_global_system_variables); - if (!val) { - pthread_cond_broadcast(&allow_writes_cond); - } - mysql_mutex_lock(&LOCK_global_system_variables); -} - -static MYSQL_SYSVAR_BOOL(disallow_writes, innodb_disallow_writes, - PLUGIN_VAR_NOCMDOPT, - "Tell InnoDB to stop any writes to disk", - NULL, innobase_disallow_writes_update, FALSE); -#endif /* WITH_INNODB_DISALLOW_WRITES */ - static MYSQL_SYSVAR_BOOL(random_read_ahead, srv_random_read_ahead, PLUGIN_VAR_NOCMDARG, "Whether to use read ahead for random access within an extent.", @@ -19468,8 +19553,8 @@ static MYSQL_SYSVAR_BOOL(read_only, srv_read_only_mode, static MYSQL_SYSVAR_BOOL(read_only_compressed, innodb_read_only_compressed, PLUGIN_VAR_OPCMDARG, - "Make ROW_FORMAT=COMPRESSED tables read-only (ON by default)", - NULL, NULL, TRUE); + "Make ROW_FORMAT=COMPRESSED tables read-only", + NULL, NULL, FALSE); static MYSQL_SYSVAR_BOOL(cmp_per_index_enabled, srv_cmp_per_index_enabled, PLUGIN_VAR_OPCMDARG, @@ -19523,7 +19608,7 @@ static MYSQL_SYSVAR_UINT(saved_page_number_debug, srv_saved_page_number_debug, PLUGIN_VAR_OPCMDARG, "An InnoDB page number.", NULL, NULL, 0, 0, UINT_MAX32, 0); -#endif +#endif /* UNIV_DEBUG */ static MYSQL_SYSVAR_BOOL(force_primary_key, srv_force_primary_key, @@ -19667,6 +19752,9 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(deadlock_report), MYSQL_SYSVAR(page_size), MYSQL_SYSVAR(log_buffer_size), +#if defined __linux__ || defined _WIN32 + MYSQL_SYSVAR(log_file_buffering), +#endif MYSQL_SYSVAR(log_file_size), MYSQL_SYSVAR(log_group_home_dir), MYSQL_SYSVAR(max_dirty_pages_pct), @@ -19721,9 +19809,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(change_buffer_dump), MYSQL_SYSVAR(change_buffering_debug), #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ -#ifdef WITH_INNODB_DISALLOW_WRITES - MYSQL_SYSVAR(disallow_writes), -#endif /* WITH_INNODB_DISALLOW_WRITES */ MYSQL_SYSVAR(random_read_ahead), MYSQL_SYSVAR(read_ahead_threshold), MYSQL_SYSVAR(read_only), @@ -19961,17 +20046,13 @@ static TABLE* innodb_find_table_for_vc(THD* thd, dict_table_t* table) return mysql_table; } -/** Get the computed value by supplying the base column values. -@param[in,out] table table whose virtual column - template to be built */ +/** Only used by the purge thread +@param[in,out] table table whose virtual column template to be built */ TABLE* innobase_init_vc_templ(dict_table_t* table) { - if (table->vc_templ != NULL) { - return NULL; - } DBUG_ENTER("innobase_init_vc_templ"); - table->vc_templ = UT_NEW_NOKEY(dict_vcol_templ_t()); + ut_ad(table->vc_templ == NULL); TABLE *mysql_table= innodb_find_table_for_vc(current_thd, table); @@ -19980,8 +20061,12 @@ TABLE* innobase_init_vc_templ(dict_table_t* table) DBUG_RETURN(NULL); } - innobase_build_v_templ(mysql_table, table, table->vc_templ, NULL, - false); + dict_vcol_templ_t* vc_templ = UT_NEW_NOKEY(dict_vcol_templ_t()); + + dict_sys.lock(SRW_LOCK_CALL); + table->vc_templ = vc_templ; + innobase_build_v_templ(mysql_table, table, vc_templ, nullptr, true); + dict_sys.unlock(); DBUG_RETURN(mysql_table); } @@ -20040,7 +20125,7 @@ innobase_rename_vc_templ( for purge thread. */ -bool innobase_allocate_row_for_vcol(THD *thd, dict_index_t *index, +bool innobase_allocate_row_for_vcol(THD *thd, const dict_index_t *index, mem_heap_t **heap, TABLE **table, VCOL_STORAGE *storage) { @@ -20124,7 +20209,8 @@ innobase_get_computed_value( TABLE* mysql_table, byte* mysql_rec, const dict_table_t* old_table, - const upd_t* update) + const upd_t* update, + bool ignore_warnings) { byte rec_buf2[REC_VERSION_56_MAX_INDEX_COL_LEN]; byte* buf; @@ -20231,7 +20317,9 @@ innobase_get_computed_value( MY_BITMAP *old_write_set = dbug_tmp_use_all_columns(mysql_table, &mysql_table->write_set); MY_BITMAP *old_read_set = dbug_tmp_use_all_columns(mysql_table, &mysql_table->read_set); - ret = mysql_table->update_virtual_field(mysql_table->field[col->m_col.ind]); + ret = mysql_table->update_virtual_field( + mysql_table->field[col->m_col.ind], + ignore_warnings); dbug_tmp_restore_column_map(&mysql_table->read_set, old_read_set); dbug_tmp_restore_column_map(&mysql_table->write_set, old_write_set); @@ -20494,6 +20582,26 @@ bool ha_innobase::can_convert_blob(const Field_blob *field, return true; } + +bool ha_innobase::can_convert_nocopy(const Field &field, + const Column_definition &new_type) const +{ + if (const Field_string *tf= dynamic_cast(&field)) + return can_convert_string(tf, new_type); + + if (const Field_varstring *tf= dynamic_cast(&field)) + return can_convert_varstring(tf, new_type); + + if (dynamic_cast(&field)) + return false; + + if (const Field_blob *tf= dynamic_cast(&field)) + return can_convert_blob(tf, new_type); + + return false; +} + + Compare_keys ha_innobase::compare_key_parts( const Field &old_field, const Column_definition &new_field, const KEY_PART_INFO &old_part, const KEY_PART_INFO &new_part) const @@ -20504,7 +20612,7 @@ Compare_keys ha_innobase::compare_key_parts( if (!is_equal) { - if (!old_field.can_be_converted_by_engine(new_field)) + if (!old_field.table->file->can_convert_nocopy(old_field, new_field)) return Compare_keys::NotEqual; if (!Charset(old_cs).eq_collation_specific_names(new_cs)) @@ -20729,8 +20837,19 @@ innodb_buffer_pool_size_validate( struct st_mysql_value* value) { longlong intbuf; + value->val_int(value, &intbuf); + if (static_cast(intbuf) < MYSQL_SYSVAR_NAME(buffer_pool_size).min_val) { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WRONG_ARGUMENTS, + "innodb_buffer_pool_size must be at least" + " %lld for innodb_page_size=%lu", + MYSQL_SYSVAR_NAME(buffer_pool_size).min_val, + srv_page_size); + return(1); + } + if (!srv_was_started) { push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WRONG_ARGUMENTS, @@ -20763,7 +20882,7 @@ innodb_buffer_pool_size_validate( push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WRONG_ARGUMENTS, "innodb_buffer_pool_size must be at least" - " innodb_buffer_pool_chunk_size=%lu", + " innodb_buffer_pool_chunk_size=%zu", srv_buf_pool_chunk_unit); /* nothing to do */ return(0); @@ -21099,3 +21218,21 @@ void ins_node_t::vers_update_end(row_prebuilt_t *prebuilt, bool history_row) if (UNIV_LIKELY_NULL(local_heap)) mem_heap_free(local_heap); } + +/** Calculate aligned buffer pool size based on srv_buf_pool_chunk_unit, +if needed. +@param[in] size size in bytes +@return aligned size */ +ulint +buf_pool_size_align( + ulint size) +{ + const size_t m = srv_buf_pool_chunk_unit; + size = ut_max(size, (size_t) MYSQL_SYSVAR_NAME(buffer_pool_size).min_val); + + if (size % m == 0) { + return(size); + } else { + return (size / m + 1) * m; + } +} diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 4185f7a68cd0c..1f42bf180a843 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2022, 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 @@ -109,8 +109,6 @@ class ha_innobase final : public handler double read_time(uint index, uint ranges, ha_rows rows) override; - int delete_all_rows() override; - int write_row(const uchar * buf) override; int update_row(const uchar * old_data, const uchar * new_data) override; @@ -192,12 +190,12 @@ class ha_innobase final : public handler void update_create_info(HA_CREATE_INFO* create_info) override; - inline int create( + int create( const char* name, TABLE* form, HA_CREATE_INFO* create_info, bool file_per_table, - trx_t* trx = NULL); + trx_t* trx); int create( const char* name, @@ -227,7 +225,7 @@ class ha_innobase final : public handler uint referenced_by_foreign_key() override; - void free_foreign_key_create_info(char* str) override; + void free_foreign_key_create_info(char* str) override { my_free(str); } uint lock_count(void) const override; @@ -244,7 +242,6 @@ class ha_innobase final : public handler ulonglong nb_desired_values, ulonglong* first_value, ulonglong* nb_reserved_values) override; - int reset_auto_increment(ulonglong value) override; bool get_error_message(int error, String *buf) override; @@ -425,15 +422,9 @@ class ha_innobase final : public handler @retval false if pushed (always) */ bool rowid_filter_push(Rowid_filter *rowid_filter) override; - bool - can_convert_string(const Field_string* field, - const Column_definition& new_field) const override; - bool can_convert_varstring( - const Field_varstring* field, - const Column_definition& new_field) const override; - bool - can_convert_blob(const Field_blob* field, - const Column_definition& new_field) const override; + bool can_convert_nocopy(const Field &field, + const Column_definition& new_field) const + override; /** @return whether innodb_strict_mode is active */ static bool is_innodb_strict_mode(THD* thd); @@ -448,6 +439,16 @@ class ha_innobase final : public handler const KEY_PART_INFO& new_part) const override; protected: + bool + can_convert_string(const Field_string* field, + const Column_definition& new_field) const; + bool can_convert_varstring( + const Field_varstring* field, + const Column_definition& new_field) const; + bool + can_convert_blob(const Field_blob* field, + const Column_definition& new_field) const; + dberr_t innobase_get_autoinc(ulonglong* value); dberr_t innobase_lock_autoinc(); ulonglong innobase_peek_autoinc(); @@ -465,6 +466,10 @@ class ha_innobase final : public handler int general_fetch(uchar* buf, uint direction, uint match_mode); int change_active_index(uint keynr); + /* @return true if it's necessary to switch current statement log + format from STATEMENT to ROW if binary log format is MIXED and + autoincrement values are changed in the statement */ + bool autoinc_lock_mode_stmt_unsafe() const override; dict_index_t* innobase_get_index(uint keynr); #ifdef WITH_WSREP @@ -564,9 +569,6 @@ bool thd_is_strict_mode(const MYSQL_THD thd); extern void mysql_bin_log_commit_pos(THD *thd, ulonglong *out_pos, const char **out_file); struct trx_t; -#ifdef WITH_WSREP -#include -#endif /* WITH_WSREP */ extern const struct _ft_vft ft_vft_result; @@ -641,8 +643,9 @@ class create_table_info_t @param create_fk whether to add FOREIGN KEY constraints */ int create_table(bool create_fk = true); - /** Update the internal data dictionary. */ - int create_table_update_dict(); + static void create_table_update_dict(dict_table_t* table, THD* thd, + const HA_CREATE_INFO& info, + const TABLE& t); /** Validates the create options. Checks that the options KEY_BLOCK_SIZE, ROW_FORMAT, DATA DIRECTORY, TEMPORARY & TABLESPACE @@ -702,12 +705,13 @@ class create_table_info_t trx_t* trx() const { return(m_trx); } - /** Return table name. */ - const char* table_name() const - { return(m_table_name); } + /** @return table name */ + const char* table_name() const { return(m_table_name); } + + /** @return the created table */ + dict_table_t *table() const { return m_table; } - THD* thd() const - { return(m_thd); } + THD* thd() const { return(m_thd); } private: /** Parses the table name into normal name and either temp path or diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 075239306b026..20decb897ba18 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2005, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, 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 @@ -227,7 +227,7 @@ inline void dict_table_t::prepare_instant(const dict_table_t& old, If that is the case, the instant ALTER TABLE would keep the InnoDB table in its current format. */ - const dict_index_t& oindex = *old.indexes.start; + dict_index_t& oindex = *old.indexes.start; dict_index_t& index = *indexes.start; first_alter_pos = 0; @@ -373,6 +373,15 @@ inline void dict_table_t::prepare_instant(const dict_table_t& old, goto found_nullable; } } + + /* In case of discarded tablespace, InnoDB can't + read the root page. So assign the null bytes based + on nullabled fields */ + if (!oindex.table->space) { + oindex.n_core_null_bytes = static_cast( + UT_BITS_IN_BYTES(unsigned(oindex.n_nullable))); + } + /* The n_core_null_bytes only matters for ROW_FORMAT=COMPACT and ROW_FORMAT=DYNAMIC tables. */ ut_ad(UT_BITS_IN_BYTES(core_null) == oindex.n_core_null_bytes @@ -836,6 +845,152 @@ inline void dict_table_t::rollback_instant( } } +/* Report an InnoDB error to the client by invoking my_error(). */ +static ATTRIBUTE_COLD __attribute__((nonnull)) +void +my_error_innodb( +/*============*/ + dberr_t error, /*!< in: InnoDB error code */ + const char* table, /*!< in: table name */ + ulint flags) /*!< in: table flags */ +{ + switch (error) { + case DB_MISSING_HISTORY: + my_error(ER_TABLE_DEF_CHANGED, MYF(0)); + break; + case DB_RECORD_NOT_FOUND: + my_error(ER_KEY_NOT_FOUND, MYF(0), table); + break; + case DB_DEADLOCK: + my_error(ER_LOCK_DEADLOCK, MYF(0)); + break; + case DB_LOCK_WAIT_TIMEOUT: + my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0)); + break; + case DB_INTERRUPTED: + my_error(ER_QUERY_INTERRUPTED, MYF(0)); + break; + case DB_OUT_OF_MEMORY: + my_error(ER_OUT_OF_RESOURCES, MYF(0)); + break; + case DB_OUT_OF_FILE_SPACE: + my_error(ER_RECORD_FILE_FULL, MYF(0), table); + break; + case DB_TEMP_FILE_WRITE_FAIL: + my_error(ER_TEMP_FILE_WRITE_FAILURE, MYF(0)); + break; + case DB_TOO_BIG_INDEX_COL: + my_error(ER_INDEX_COLUMN_TOO_LONG, MYF(0), + (ulong) DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG(flags)); + break; + case DB_TOO_MANY_CONCURRENT_TRXS: + my_error(ER_TOO_MANY_CONCURRENT_TRXS, MYF(0)); + break; + case DB_LOCK_TABLE_FULL: + my_error(ER_LOCK_TABLE_FULL, MYF(0)); + break; + case DB_UNDO_RECORD_TOO_BIG: + my_error(ER_UNDO_RECORD_TOO_BIG, MYF(0)); + break; + case DB_CORRUPTION: + my_error(ER_NOT_KEYFILE, MYF(0), table); + break; + case DB_TOO_BIG_RECORD: { + /* Note that in page0zip.ic page_zip_rec_needs_ext() rec_size + is limited to COMPRESSED_REC_MAX_DATA_SIZE (16K) or + REDUNDANT_REC_MAX_DATA_SIZE (16K-1). */ + bool comp = !!(flags & DICT_TF_COMPACT); + ulint free_space = page_get_free_space_of_empty(comp) / 2; + + if (free_space >= ulint(comp ? COMPRESSED_REC_MAX_DATA_SIZE : + REDUNDANT_REC_MAX_DATA_SIZE)) { + free_space = (comp ? COMPRESSED_REC_MAX_DATA_SIZE : + REDUNDANT_REC_MAX_DATA_SIZE) - 1; + } + + my_error(ER_TOO_BIG_ROWSIZE, MYF(0), free_space); + break; + } + case DB_INVALID_NULL: + /* TODO: report the row, as we do for DB_DUPLICATE_KEY */ + my_error(ER_INVALID_USE_OF_NULL, MYF(0)); + break; + case DB_CANT_CREATE_GEOMETRY_OBJECT: + my_error(ER_CANT_CREATE_GEOMETRY_OBJECT, MYF(0)); + break; + case DB_TABLESPACE_EXISTS: + my_error(ER_TABLESPACE_EXISTS, MYF(0), table); + break; + +#ifdef UNIV_DEBUG + case DB_SUCCESS: + case DB_DUPLICATE_KEY: + case DB_ONLINE_LOG_TOO_BIG: + /* These codes should not be passed here. */ + ut_error; +#endif /* UNIV_DEBUG */ + default: + my_error(ER_GET_ERRNO, MYF(0), error, "InnoDB"); + break; + } +} + +/** Get the name of an erroneous key. +@param[in] error_key_num InnoDB number of the erroneus key +@param[in] ha_alter_info changes that were being performed +@param[in] table InnoDB table +@return the name of the erroneous key */ +static +const char* +get_error_key_name( + ulint error_key_num, + const Alter_inplace_info* ha_alter_info, + const dict_table_t* table) +{ + if (error_key_num == ULINT_UNDEFINED) { + return(FTS_DOC_ID_INDEX_NAME); + } else if (ha_alter_info->key_count == 0) { + return(dict_table_get_first_index(table)->name); + } else { + return(ha_alter_info->key_info_buffer[error_key_num].name.str); + } +} + +/** Convert field type and length to InnoDB format */ +static void get_type(const Field &f, uint &prtype, uint8_t &mtype, + uint16_t &len) +{ + mtype= get_innobase_type_from_mysql_type(&prtype, &f); + len= static_cast(f.pack_length()); + prtype|= f.type(); + if (f.type() == MYSQL_TYPE_VARCHAR) + { + auto l= static_cast(f).length_bytes; + len= static_cast(len - l); + if (l == 2) + prtype|= DATA_LONG_TRUE_VARCHAR; + } + if (!f.real_maybe_null()) + prtype |= DATA_NOT_NULL; + if (f.binary()) + prtype |= DATA_BINARY_TYPE; + if (f.table->versioned()) + { + if (&f == f.table->field[f.table->s->vers.start_fieldno]) + prtype|= DATA_VERS_START; + else if (&f == f.table->field[f.table->s->vers.end_fieldno]) + prtype|= DATA_VERS_END; + else if (!(f.flags & VERS_UPDATE_UNVERSIONED_FLAG)) + prtype|= DATA_VERSIONED; + } + + if (!f.stored_in_db()) + prtype|= DATA_VIRTUAL; + + if (dtype_is_string_type(mtype)) + prtype|= f.charset()->number << 16; +} + struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx { /** Dummy query graph */ @@ -930,6 +1085,10 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx /** The page_compression_level attribute, or 0 */ const uint page_compression_level; + /** Indexed columns whose charset-collation is changing + in a way that does not require the table to be rebuilt */ + col_collations change_col_collate; + ha_innobase_inplace_ctx(row_prebuilt_t*& prebuilt_arg, dict_index_t** drop_arg, ulint num_to_drop_arg, @@ -1021,7 +1180,8 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx old_v_cols[i].~dict_v_col_t(); } if (instant_table->fts) { - fts_free(instant_table); + instant_table->fts->~fts_t(); + instant_table->fts = nullptr; } dict_mem_table_free(instant_table); } @@ -1173,6 +1333,128 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx return true; return false; } + + /** Handle the apply log failure for online DDL operation. + @param ha_alter_info handler alter inplace info + @param altered_table MySQL table that is being altered + @param error error code + @retval false if error value is DB_SUCCESS or + TRUE in case of error */ + bool log_failure(Alter_inplace_info *ha_alter_info, + TABLE *altered_table, dberr_t error) + { + ulint err_key= thr_get_trx(thr)->error_key_num; + switch (error) { + KEY *dup_key; + case DB_SUCCESS: + return false; + case DB_DUPLICATE_KEY: + if (err_key == ULINT_UNDEFINED) + /* This should be the hidden index on FTS_DOC_ID */ + dup_key= nullptr; + else + { + DBUG_ASSERT(err_key < ha_alter_info->key_count); + dup_key= &ha_alter_info->key_info_buffer[err_key]; + } + print_keydup_error(altered_table, dup_key, MYF(0)); + break; + case DB_ONLINE_LOG_TOO_BIG: + my_error(ER_INNODB_ONLINE_LOG_TOO_BIG, MYF(0), + get_error_key_name(err_key, ha_alter_info, new_table)); + break; + case DB_INDEX_CORRUPT: + my_error(ER_INDEX_CORRUPT, MYF(0), + get_error_key_name(err_key, ha_alter_info, new_table)); + break; + default: + my_error_innodb(error, old_table->name.m_name, old_table->flags); + } + return true; + } + + /** Check whether the column has any change in collation type. + If it is then store the column information in heap + @param index index being added (or rebuilt) + @param altered_table altered table definition */ + void change_col_collation(dict_index_t *index, const TABLE &altered_table) + { + ut_ad(!need_rebuild()); + ut_ad(!index->is_primary()); + ut_ad(!index->is_committed()); + + unsigned n_cols= 0; + for (unsigned i= 0; i < index->n_fields; i++) + { + const char *field_name= index->fields[i].name(); + if (!field_name || !dtype_is_string_type(index->fields[i].col->mtype)) + continue; + for (uint j= 0; j < altered_table.s->fields; j++) + { + const Field *altered_field= altered_table.field[j]; + + if (my_strcasecmp(system_charset_info, field_name, + altered_field->field_name.str)) + continue; + + unsigned prtype; + uint8_t mtype; + uint16_t len; + get_type(*altered_field, prtype, mtype, len); + + if (prtype == index->fields[i].col->prtype) + continue; + auto it= change_col_collate.find(index->fields[i].col->ind); + if (it != change_col_collate.end()) + { + n_cols++; + index->fields[i].col= it->second; + continue; + } + + const CHARSET_INFO *cs= altered_field->charset(); + + dict_col_t *col= + static_cast(mem_heap_alloc(heap, sizeof *col)); + *col= *index->fields[i].col; + col->prtype= prtype; + col->mtype= mtype; + col->mbminlen= cs->mbminlen & 7; + col->mbmaxlen= cs->mbmaxlen & 7; + col->len= len; + index->fields[i].col= col; + n_cols++; + change_col_collate[col->ind]= col; + } + } + + index->init_change_cols(n_cols); + } + + void cleanup_col_collation() + { + ut_ad(old_table == new_table); + if (change_col_collate.empty()) + return; + const dict_index_t *index= dict_table_get_first_index(old_table); + while ((index= dict_table_get_next_index(index)) != nullptr) + { + if (index->is_committed()) + continue; + auto collate_end= change_col_collate.end(); + for (unsigned i= 0, j= 0; i < index->n_fields; i++) + { + const dict_col_t *col= index->fields[i].col; + auto it= change_col_collate.find(col->ind); + if (it != collate_end) + { + ut_ad(it->second == col); + index->fields[i].col= + index->change_col_info->add(index->heap, *col, j++); + } + } + } + } }; /********************************************************************//** @@ -1180,96 +1462,6 @@ Get the upper limit of the MySQL integral and floating-point type. @return maximum allowed value for the field */ ulonglong innobase_get_int_col_max_value(const Field *field); -/* Report an InnoDB error to the client by invoking my_error(). */ -static ATTRIBUTE_COLD __attribute__((nonnull)) -void -my_error_innodb( -/*============*/ - dberr_t error, /*!< in: InnoDB error code */ - const char* table, /*!< in: table name */ - ulint flags) /*!< in: table flags */ -{ - switch (error) { - case DB_MISSING_HISTORY: - my_error(ER_TABLE_DEF_CHANGED, MYF(0)); - break; - case DB_RECORD_NOT_FOUND: - my_error(ER_KEY_NOT_FOUND, MYF(0), table); - break; - case DB_DEADLOCK: - my_error(ER_LOCK_DEADLOCK, MYF(0)); - break; - case DB_LOCK_WAIT_TIMEOUT: - my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0)); - break; - case DB_INTERRUPTED: - my_error(ER_QUERY_INTERRUPTED, MYF(0)); - break; - case DB_OUT_OF_MEMORY: - my_error(ER_OUT_OF_RESOURCES, MYF(0)); - break; - case DB_OUT_OF_FILE_SPACE: - my_error(ER_RECORD_FILE_FULL, MYF(0), table); - break; - case DB_TEMP_FILE_WRITE_FAIL: - my_error(ER_TEMP_FILE_WRITE_FAILURE, MYF(0)); - break; - case DB_TOO_BIG_INDEX_COL: - my_error(ER_INDEX_COLUMN_TOO_LONG, MYF(0), - (ulong) DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG(flags)); - break; - case DB_TOO_MANY_CONCURRENT_TRXS: - my_error(ER_TOO_MANY_CONCURRENT_TRXS, MYF(0)); - break; - case DB_LOCK_TABLE_FULL: - my_error(ER_LOCK_TABLE_FULL, MYF(0)); - break; - case DB_UNDO_RECORD_TOO_BIG: - my_error(ER_UNDO_RECORD_TOO_BIG, MYF(0)); - break; - case DB_CORRUPTION: - my_error(ER_NOT_KEYFILE, MYF(0), table); - break; - case DB_TOO_BIG_RECORD: { - /* Note that in page0zip.ic page_zip_rec_needs_ext() rec_size - is limited to COMPRESSED_REC_MAX_DATA_SIZE (16K) or - REDUNDANT_REC_MAX_DATA_SIZE (16K-1). */ - bool comp = !!(flags & DICT_TF_COMPACT); - ulint free_space = page_get_free_space_of_empty(comp) / 2; - - if (free_space >= ulint(comp ? COMPRESSED_REC_MAX_DATA_SIZE : - REDUNDANT_REC_MAX_DATA_SIZE)) { - free_space = (comp ? COMPRESSED_REC_MAX_DATA_SIZE : - REDUNDANT_REC_MAX_DATA_SIZE) - 1; - } - - my_error(ER_TOO_BIG_ROWSIZE, MYF(0), free_space); - break; - } - case DB_INVALID_NULL: - /* TODO: report the row, as we do for DB_DUPLICATE_KEY */ - my_error(ER_INVALID_USE_OF_NULL, MYF(0)); - break; - case DB_CANT_CREATE_GEOMETRY_OBJECT: - my_error(ER_CANT_CREATE_GEOMETRY_OBJECT, MYF(0)); - break; - case DB_TABLESPACE_EXISTS: - my_error(ER_TABLESPACE_EXISTS, MYF(0), table); - break; - -#ifdef UNIV_DEBUG - case DB_SUCCESS: - case DB_DUPLICATE_KEY: - case DB_ONLINE_LOG_TOO_BIG: - /* These codes should not be passed here. */ - ut_error; -#endif /* UNIV_DEBUG */ - default: - my_error(ER_GET_ERRNO, MYF(0), error, "InnoDB"); - break; - } -} - /** Determine if fulltext indexes exist in a given table. @param table MySQL table @return number of fulltext indexes */ @@ -1760,8 +1952,13 @@ instant_alter_column_possible( Field** af = altered_table->field; Field** const end = altered_table->field + altered_table->s->fields; + List_iterator_fast cf_it( + ha_alter_info->alter_info->create_list); for (unsigned c = 0; af < end; af++) { - if (!(*af)->stored_in_db()) { + const Create_field* cf = cf_it++; + if (!cf->field || !(*af)->stored_in_db()) { + /* Ignore virtual or newly created + column */ continue; } @@ -1928,18 +2125,25 @@ static bool innobase_table_is_empty(const dict_table_t *table, btr_pcur_t pcur; buf_block_t *block; page_cur_t *cur; - const rec_t *rec; + rec_t *rec; bool next_page= false; mtr.start(); - btr_pcur_open_at_index_side(true, clust_index, BTR_SEARCH_LEAF, - &pcur, true, 0, &mtr); - btr_pcur_move_to_next_user_rec(&pcur, &mtr); - if (!rec_is_metadata(btr_pcur_get_rec(&pcur), *clust_index)) - btr_pcur_move_to_prev_on_page(&pcur); + if (pcur.open_leaf(true, clust_index, BTR_SEARCH_LEAF, &mtr) != DB_SUCCESS) + { +non_empty: + mtr.commit(); + return false; + } + rec= page_rec_get_next(btr_pcur_get_rec(&pcur)); + if (UNIV_UNLIKELY(!rec)) + goto non_empty; + if (rec_is_metadata(rec, *clust_index)) + btr_pcur_get_page_cur(&pcur)->rec= rec; scan_leaf: cur= btr_pcur_get_page_cur(&pcur); - page_cur_move_to_next(cur); + if (UNIV_UNLIKELY(!page_cur_move_to_next(cur))) + goto non_empty; next_page: if (next_page) { @@ -1951,12 +2155,15 @@ static bool innobase_table_is_empty(const dict_table_t *table, } next_page= false; - block= page_cur_get_block(cur); block= btr_block_get(*clust_index, next_page_no, BTR_SEARCH_LEAF, false, &mtr); - btr_leaf_page_release(page_cur_get_block(cur), BTR_SEARCH_LEAF, &mtr); + if (!block) + goto non_empty; page_cur_set_before_first(block, cur); - page_cur_move_to_next(cur); + if (UNIV_UNLIKELY(!page_cur_move_to_next(cur))) + goto non_empty; + const auto s= mtr.get_savepoint(); + mtr.rollback_to_savepoint(s - 2, s - 1); } rec= page_cur_get_rec(cur); @@ -1964,9 +2171,7 @@ static bool innobase_table_is_empty(const dict_table_t *table, { if (ignore_delete_marked) goto scan_leaf; -non_empty: - mtr.commit(); - return false; + goto non_empty; } else if (!page_rec_is_supremum(rec)) goto non_empty; @@ -2035,6 +2240,12 @@ ha_innobase::check_if_supported_inplace_alter( update_thd(); + if (!m_prebuilt->table->space) { + ib_senderrf(m_user_thd, IB_LOG_LEVEL_WARN, + ER_TABLESPACE_DISCARDED, + table->s->table_name.str); + } + if (is_read_only(!high_level_read_only && (ha_alter_info->handler_flags & ALTER_OPTIONS) && ha_alter_info->create_info->key_block_size == 0 @@ -2337,6 +2548,11 @@ ha_innobase::check_if_supported_inplace_alter( < dict_table_get_n_user_cols(m_prebuilt->table))); if (fulltext_indexes && m_prebuilt->table->fts) { + /* FTS index of versioned table has row_end, need rebuild */ + if (table->versioned() != altered_table->versioned()) { + need_rebuild= true; + } + /* FULLTEXT indexes are supposed to remain. */ /* Disallow DROP INDEX FTS_DOC_ID_INDEX */ @@ -2823,7 +3039,7 @@ innobase_find_equiv_index( = key_part.field->pack_length(); /* Any index on virtual columns cannot be used - for reference constaint */ + for reference constraint */ if (!key_part.field->stored_in_db()) { goto no_match; } @@ -3600,6 +3816,8 @@ innobase_create_index_field_def( index_field->col_no = key_part->fieldnr - num_v; } + index_field->descending= !!(key_part->key_part_flag & HA_REVERSE_SORT); + if (DATA_LARGE_MTYPE(col_type) || (key_part->length < field->pack_length() && field->type() != MYSQL_TYPE_VARCHAR) @@ -3701,6 +3919,7 @@ innobase_create_index_def( index->fields[0].col_no = key->key_part[0].fieldnr - num_v; index->fields[0].prefix_len = 0; index->fields[0].is_v_col = false; + index->fields[0].descending = false; /* Currently, the spatial index cannot be created on virtual columns. It is blocked in the SQL layer. */ @@ -3746,6 +3965,8 @@ innobase_fts_check_doc_id_index( /* Check if a unique index with the name of FTS_DOC_ID_INDEX_NAME is being created. */ + const ulint fts_n_uniq= altered_table->versioned() ? 2 : 1; + for (uint i = 0; i < altered_table->s->keys; i++) { const KEY& key = altered_table->key_info[i]; @@ -3755,7 +3976,9 @@ innobase_fts_check_doc_id_index( } if ((key.flags & HA_NOSAME) - && key.user_defined_key_parts == 1 + && key.user_defined_key_parts == fts_n_uniq + && !(key.key_part[0].key_part_flag + & HA_REVERSE_SORT) && !strcmp(key.name.str, FTS_DOC_ID_INDEX_NAME) && !strcmp(key.key_part[0].field->field_name.str, FTS_DOC_ID_COL_NAME)) { @@ -3785,7 +4008,7 @@ innobase_fts_check_doc_id_index( } if (!dict_index_is_unique(index) - || dict_index_get_n_unique(index) > 1 + || dict_index_get_n_unique(index) != table->fts_n_uniq() || strcmp(index->name, FTS_DOC_ID_INDEX_NAME)) { return(FTS_INCORRECT_DOC_ID_INDEX); } @@ -3796,6 +4019,7 @@ innobase_fts_check_doc_id_index( /* The column would be of a BIGINT data type */ if (strcmp(field->name, FTS_DOC_ID_COL_NAME) == 0 + && !field->descending && field->col->mtype == DATA_INT && field->col->len == 8 && field->col->prtype & DATA_NOT_NULL @@ -3826,6 +4050,7 @@ innobase_fts_check_doc_id_index_in_def( { /* Check whether there is a "FTS_DOC_ID_INDEX" in the to be built index list */ + const uint fts_n_uniq= key_info->table->versioned() ? 2 : 1; for (ulint j = 0; j < n_key; j++) { const KEY* key = &key_info[j]; @@ -3836,7 +4061,8 @@ innobase_fts_check_doc_id_index_in_def( /* Do a check on FTS DOC ID_INDEX, it must be unique, named as "FTS_DOC_ID_INDEX" and on column "FTS_DOC_ID" */ if (!(key->flags & HA_NOSAME) - || key->user_defined_key_parts != 1 + || key->user_defined_key_parts != fts_n_uniq + || (key->key_part[0].key_part_flag & HA_REVERSE_SORT) || strcmp(key->name.str, FTS_DOC_ID_INDEX_NAME) || strcmp(key->key_part[0].field->field_name.str, FTS_DOC_ID_COL_NAME)) { @@ -4028,13 +4254,24 @@ ha_innobase_inplace_ctx::create_key_defs( if (add_fts_doc_idx) { index_def_t* index = indexdef++; + uint nfields = 1; + if (altered_table->versioned()) + ++nfields; index->fields = static_cast( - mem_heap_alloc(heap, sizeof *index->fields)); - index->n_fields = 1; - index->fields->col_no = fts_doc_id_col; - index->fields->prefix_len = 0; - index->fields->is_v_col = false; + mem_heap_alloc(heap, sizeof(*index->fields) * nfields)); + index->n_fields = nfields; + index->fields[0].col_no = fts_doc_id_col; + index->fields[0].prefix_len = 0; + index->fields[0].descending = false; + index->fields[0].is_v_col = false; + if (nfields == 2) { + index->fields[1].col_no + = altered_table->s->vers.end_fieldno; + index->fields[1].prefix_len = 0; + index->fields[1].descending = false; + index->fields[1].is_v_col = false; + } index->ind_type = DICT_UNIQUE; ut_ad(!rebuild || !add_fts_doc_id @@ -4643,7 +4880,8 @@ columns are removed from the PK; (3) Changing the order of existing PK columns; (4) Decreasing the prefix length just like removing existing PK columns follows rule(1), Increasing the prefix length just like adding existing -PK columns follows rule(2). +PK columns follows rule(2); +(5) Changing the ASC/DESC attribute of the existing PK columns. @param[in] col_map mapping of old column numbers to new ones @param[in] ha_alter_info Data used during in-place alter @param[in] old_clust_index index to be compared @@ -4736,10 +4974,16 @@ innobase_pk_order_preserved( continue; } + const dict_field_t &of = old_clust_index->fields[old_field]; + const dict_field_t &nf = new_clust_index->fields[new_field]; + + if (of.descending != nf.descending) { + return false; + } + /* Check prefix length change. */ const lint prefix_change = innobase_pk_col_prefix_compare( - new_clust_index->fields[new_field].prefix_len, - old_clust_index->fields[old_field].prefix_len); + nf.prefix_len, of.prefix_len); if (prefix_change < 0) { /* If a column's prefix length is decreased, it should @@ -4894,20 +5138,19 @@ prepare_inplace_add_virtual( const TABLE* table) { ha_innobase_inplace_ctx* ctx; - uint16_t i = 0, j = 0; + uint16_t i = 0; ctx = static_cast (ha_alter_info->handler_ctx); - ctx->num_to_add_vcol = altered_table->s->virtual_fields - + ctx->num_to_drop_vcol - table->s->virtual_fields; + unsigned j = altered_table->s->virtual_fields + ctx->num_to_drop_vcol; ctx->add_vcol = static_cast( - mem_heap_zalloc(ctx->heap, ctx->num_to_add_vcol - * sizeof *ctx->add_vcol)); + mem_heap_zalloc(ctx->heap, j * sizeof *ctx->add_vcol)); ctx->add_vcol_name = static_cast( - mem_heap_alloc(ctx->heap, ctx->num_to_add_vcol - * sizeof *ctx->add_vcol_name)); + mem_heap_alloc(ctx->heap, j * sizeof *ctx->add_vcol_name)); + + j = 0; for (const Create_field& new_field : ha_alter_info->alter_info->create_list) { @@ -4986,6 +5229,7 @@ prepare_inplace_add_virtual( j++; } + ctx->num_to_add_vcol = j; return(false); } @@ -5643,7 +5887,16 @@ static bool innobase_instant_try( const dict_col_t* old_cols = user_table->cols; DBUG_ASSERT(user_table->n_cols == ctx->old_n_cols); +#ifdef BTR_CUR_HASH_ADAPT + /* Acquire the ahi latch to avoid a race condition + between ahi access and instant alter table */ + srw_spin_lock* ahi_latch = btr_search_sys.get_latch(*index); + ahi_latch->wr_lock(SRW_LOCK_CALL); +#endif /* BTR_CUR_HASH_ADAPT */ const bool metadata_changed = ctx->instant_column(); +#ifdef BTR_CUR_HASH_ADAPT + ahi_latch->wr_unlock(); +#endif /* BTR_CUR_HASH_ADAPT */ DBUG_ASSERT(index->n_fields >= n_old_fields); /* The table may have been emptied and may have lost its @@ -5819,21 +6072,35 @@ static bool innobase_instant_try( mtr.start(); index->set_modified(mtr); btr_pcur_t pcur; - btr_pcur_open_at_index_side(true, index, BTR_MODIFY_TREE, &pcur, true, - 0, &mtr); + dberr_t err= pcur.open_leaf(true, index, BTR_MODIFY_TREE, &mtr); + if (err != DB_SUCCESS) { +func_exit: + mtr.commit(); + + if (err != DB_SUCCESS) { + my_error_innodb(err, table->s->table_name.str, + user_table->flags); + return true; + } + return false; + } ut_ad(btr_pcur_is_before_first_on_page(&pcur)); - btr_pcur_move_to_next_on_page(&pcur); buf_block_t* block = btr_pcur_get_block(&pcur); ut_ad(page_is_leaf(block->page.frame)); ut_ad(!page_has_prev(block->page.frame)); ut_ad(!buf_block_get_page_zip(block)); - const rec_t* rec = btr_pcur_get_rec(&pcur); + const rec_t* rec = btr_pcur_move_to_next_on_page(&pcur); + if (UNIV_UNLIKELY(!rec)) { + err = DB_CORRUPTION; + goto func_exit; + } + que_thr_t* thr = pars_complete_graph_for_exec( NULL, trx, ctx->heap, NULL); - const bool is_root = block->page.id().page_no() == index->page; + page_id_t id{block->page.id()}; + const bool is_root = id.page_no() == index->page; - dberr_t err = DB_SUCCESS; if (rec_is_metadata(rec, *index)) { ut_ad(page_rec_is_user_rec(rec)); if (is_root @@ -5849,9 +6116,15 @@ static bool innobase_instant_try( } /* Ensure that the root page is in the correct format. */ - buf_block_t* root = btr_root_block_get(index, RW_X_LATCH, - &mtr); - DBUG_ASSERT(root); + id.set_page_no(index->page); + buf_block_t* root = mtr.get_already_latched( + id, MTR_MEMO_PAGE_SX_FIX); + + if (UNIV_UNLIKELY(!root)) { + err = DB_CORRUPTION; + goto func_exit; + } + if (fil_page_get_type(root->page.frame) != FIL_PAGE_TYPE_INSTANT) { DBUG_ASSERT("wrong page type" == 0); @@ -5902,10 +6175,13 @@ static bool innobase_instant_try( &offsets, &offsets_heap, ctx->heap, &big_rec, update, UPD_NODE_NO_ORD_CHANGE, thr, trx->id, &mtr); + if (err == DB_SUCCESS) { + offsets = rec_get_offsets( + btr_pcur_get_rec(&pcur), index, offsets, + index->n_core_fields, ULINT_UNDEFINED, + &offsets_heap); + } - offsets = rec_get_offsets( - btr_pcur_get_rec(&pcur), index, offsets, - index->n_core_fields, ULINT_UNDEFINED, &offsets_heap); if (big_rec) { if (err == DB_SUCCESS) { err = btr_store_big_rec_extern_fields( @@ -5918,7 +6194,7 @@ static bool innobase_instant_try( if (offsets_heap) { mem_heap_free(offsets_heap); } - btr_pcur_close(&pcur); + ut_free(pcur.old_rec_buf); goto func_exit; } else if (is_root && page_rec_is_supremum(rec) && !index->table->instant) { @@ -5942,10 +6218,12 @@ static bool innobase_instant_try( mtr.commit(); mtr.start(); index->set_modified(mtr); - if (buf_block_t* root = btr_root_block_get(index, RW_SX_LATCH, &mtr)) { + if (buf_block_t* root = btr_root_block_get(index, RW_SX_LATCH, &mtr, + &err)) { if (fil_page_get_type(root->page.frame) != FIL_PAGE_INDEX) { DBUG_ASSERT("wrong page type" == 0); - goto err_exit; + err = DB_CORRUPTION; + goto func_exit; } btr_set_instant(root, *index, &mtr); @@ -5955,21 +6233,9 @@ static bool innobase_instant_try( err = row_ins_clust_index_entry_low( BTR_NO_LOCKING_FLAG, BTR_MODIFY_TREE, index, index->n_uniq, entry, 0, thr); - } else { -err_exit: - err = DB_CORRUPTION; - } - -func_exit: - mtr.commit(); - - if (err != DB_SUCCESS) { - my_error_innodb(err, table->s->table_name.str, - user_table->flags); - return true; } - return false; + goto func_exit; } /** Adjust the create index column number from "New table" to @@ -6156,8 +6422,10 @@ prepare_inplace_alter_table_dict( /* If we promised ALGORITHM=NOCOPY or ALGORITHM=INSTANT, we must retain the original ROW_FORMAT of the table. */ flags = (user_table->flags & (DICT_TF_MASK_COMPACT + | DICT_TF_MASK_ZIP_SSIZE | DICT_TF_MASK_ATOMIC_BLOBS)) | (flags & ~(DICT_TF_MASK_COMPACT + | DICT_TF_MASK_ZIP_SSIZE | DICT_TF_MASK_ATOMIC_BLOBS)); } @@ -6969,6 +7237,8 @@ prepare_inplace_alter_table_dict( if (n_v_col) { index->assign_new_v_col(n_v_col); } + + ctx->change_col_collation(index, *altered_table); /* Note the id of the transaction that created this index, we use it to restrict readers from accessing this index, to ensure read consistency. */ @@ -7006,6 +7276,8 @@ prepare_inplace_alter_table_dict( row_log_free( index->online_log); index->online_log = NULL; + ctx->old_table->indexes.start + ->online_log = nullptr; ok = false; }); @@ -7066,13 +7338,10 @@ prepare_inplace_alter_table_dict( goto error_handling; } - ctx->new_table->fts->dict_locked = true; - error = innobase_fts_load_stopword( ctx->new_table, ctx->trx, ctx->prebuilt->trx->mysql_thd) ? DB_SUCCESS : DB_ERROR; - ctx->new_table->fts->dict_locked = false; if (error != DB_SUCCESS) { goto error_handling; @@ -7128,24 +7397,8 @@ prepare_inplace_alter_table_dict( ctx->trx->rollback(); - if (ctx->need_rebuild()) { - /* Free the log for online table rebuild, if - one was allocated. */ - - dict_index_t* clust_index = dict_table_get_first_index( - user_table); - - clust_index->lock.x_lock(SRW_LOCK_CALL); - - if (clust_index->online_log) { - ut_ad(ctx->online); - row_log_abort_sec(clust_index); - clust_index->online_status - = ONLINE_INDEX_COMPLETE; - } - - clust_index->lock.x_unlock(); - } + ut_ad(!ctx->need_rebuild() + || !user_table->indexes.start->online_log); ctx->prebuilt->trx->error_info = NULL; ctx->trx->error_state = DB_SUCCESS; @@ -7556,6 +7809,7 @@ ha_innobase::prepare_inplace_alter_table( if (!(ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE)) { /* Nothing to do */ DBUG_ASSERT(!m_prebuilt->trx->dict_operation_lock_mode); + m_prebuilt->trx_id = 0; DBUG_RETURN(false); } @@ -8318,27 +8572,6 @@ alter_templ_needs_rebuild( return(false); } -/** Get the name of an erroneous key. -@param[in] error_key_num InnoDB number of the erroneus key -@param[in] ha_alter_info changes that were being performed -@param[in] table InnoDB table -@return the name of the erroneous key */ -static -const char* -get_error_key_name( - ulint error_key_num, - const Alter_inplace_info* ha_alter_info, - const dict_table_t* table) -{ - if (error_key_num == ULINT_UNDEFINED) { - return(FTS_DOC_ID_INDEX_NAME); - } else if (ha_alter_info->key_count == 0) { - return(dict_table_get_first_index(table)->name); - } else { - return(ha_alter_info->key_info_buffer[error_key_num].name.str); - } -} - /** Alter the table structure in-place with operations specified using Alter_inplace_info. The level of concurrency allowed during this operation depends @@ -8475,7 +8708,9 @@ ha_innobase::inplace_alter_table( ctx->add_index, ctx->add_key_numbers, ctx->num_to_add_index, altered_table, ctx->defaults, ctx->col_map, ctx->add_autoinc, ctx->sequence, ctx->skip_pk_sort, - ctx->m_stage, add_v, eval_table, ctx->allow_not_null); + ctx->m_stage, add_v, eval_table, ctx->allow_not_null, + ctx->change_col_collate.empty() + ? nullptr : &ctx->change_col_collate); #ifndef DBUG_OFF oom: @@ -8512,6 +8747,11 @@ ha_innobase::inplace_alter_table( switch (error) { KEY* dup_key; + default: + my_error_innodb(error, + table_share->table_name.str, + m_prebuilt->table->flags); + break; all_done: case DB_SUCCESS: ut_d(dict_sys.freeze(SRW_LOCK_CALL)); @@ -8548,18 +8788,14 @@ ha_innobase::inplace_alter_table( get_error_key_name(m_prebuilt->trx->error_key_num, ha_alter_info, m_prebuilt->table)); break; - case DB_DECRYPTION_FAILED: { + case DB_DECRYPTION_FAILED: String str; const char* engine= table_type(); get_error_message(HA_ERR_DECRYPTION_FAILED, &str); - my_error(ER_GET_ERRMSG, MYF(0), HA_ERR_DECRYPTION_FAILED, str.c_ptr(), engine); + my_error(ER_GET_ERRMSG, MYF(0), HA_ERR_DECRYPTION_FAILED, + str.c_ptr(), engine); break; } - default: - my_error_innodb(error, - table_share->table_name.str, - m_prebuilt->table->flags); - } /* prebuilt->table->n_ref_count can be anything here, given that we hold at most a shared lock on the table. */ @@ -8675,7 +8911,8 @@ innobase_rollback_sec_index( && !DICT_TF2_FLAG_IS_SET(user_table, DICT_TF2_FTS_HAS_DOC_ID) && !innobase_fulltext_exist(table)) { - fts_free(user_table); + user_table->fts->~fts_t(); + user_table->fts = nullptr; } } @@ -8703,6 +8940,7 @@ inline bool rollback_inplace_alter_table(Alter_inplace_info *ha_alter_info, DBUG_ENTER("rollback_inplace_alter_table"); + DEBUG_SYNC_C("innodb_rollback_inplace_alter_table"); if (!ctx) /* If we have not started a transaction yet, (almost) nothing has been or needs to be done. */ @@ -8715,13 +8953,14 @@ inline bool rollback_inplace_alter_table(Alter_inplace_info *ha_alter_info, const bool fts_exist= (ctx->new_table->flags2 & (DICT_TF2_FTS_HAS_DOC_ID | DICT_TF2_FTS)) || ctx->adding_fulltext_index(); - if (fts_exist) - { - fts_optimize_remove_table(ctx->new_table); - purge_sys.stop_FTS(*ctx->new_table); - } if (ctx->need_rebuild()) { + if (fts_exist) + { + fts_optimize_remove_table(ctx->new_table); + purge_sys.stop_FTS(*ctx->new_table); + } + dberr_t err= lock_table_for_trx(ctx->new_table, ctx->trx, LOCK_X); if (fts_exist) { @@ -8765,15 +9004,31 @@ inline bool rollback_inplace_alter_table(Alter_inplace_info *ha_alter_info, thd_lock_wait_timeout(ctx->trx->mysql_thd); const uint save_timeout= innodb_lock_wait_timeout; innodb_lock_wait_timeout= ~0U; /* infinite */ - + dict_index_t *old_clust_index= ctx->old_table->indexes.start; + old_clust_index->lock.x_lock(SRW_LOCK_CALL); + old_clust_index->online_log= nullptr; + old_clust_index->lock.x_unlock(); if (fts_exist) { + const dict_index_t *fts_index= nullptr; for (ulint a= 0; a < ctx->num_to_add_index; a++) { const dict_index_t *index = ctx->add_index[a]; if (index->type & DICT_FTS) - ut_a(!fts_lock_index_tables(ctx->trx, *index)); + fts_index= index; } + + /* Remove the fts table from fts_optimize_wq if there are + no FTS secondary index exist other than newly added one */ + if (fts_index && + (ib_vector_is_empty(prebuilt->table->fts->indexes) || + (ib_vector_size(prebuilt->table->fts->indexes) == 1 && + fts_index == static_cast( + ib_vector_getp(prebuilt->table->fts->indexes, 0))))) + fts_optimize_remove_table(prebuilt->table); + + purge_sys.stop_FTS(*prebuilt->table); + ut_a(!fts_index || !fts_lock_index_tables(ctx->trx, *fts_index)); ut_a(!fts_lock_common_tables(ctx->trx, *ctx->new_table)); ut_a(!lock_sys_tables(ctx->trx)); } @@ -8783,6 +9038,7 @@ inline bool rollback_inplace_alter_table(Alter_inplace_info *ha_alter_info, ut_a(!lock_table_for_trx(dict_sys.sys_fields, ctx->trx, LOCK_X)); } innodb_lock_wait_timeout= save_timeout; + DEBUG_SYNC_C("innodb_rollback_after_fts_lock"); row_mysql_lock_data_dictionary(ctx->trx); ctx->rollback_instant(); innobase_rollback_sec_index(ctx->old_table, table, @@ -8790,6 +9046,7 @@ inline bool rollback_inplace_alter_table(Alter_inplace_info *ha_alter_info, Alter_info::ALTER_TABLE_LOCK_EXCLUSIVE, ctx->trx, prebuilt->trx); ctx->clean_new_vcol_index(); + ctx->cleanup_col_collation(); ut_d(dict_table_check_for_dup_indexes(ctx->old_table, CHECK_ABORTED_OK)); } @@ -8815,6 +9072,14 @@ inline bool rollback_inplace_alter_table(Alter_inplace_info *ha_alter_info, dict_sys.lock(SRW_LOCK_CALL); + if (ctx->add_vcol) + { + for (ulint i = 0; i < ctx->num_to_add_vcol; i++) + ctx->add_vcol[i].~dict_v_col_t(); + ctx->num_to_add_vcol= 0; + ctx->add_vcol= nullptr; + } + for (ulint i= 0; i < ctx->num_to_add_fk; i++) dict_foreign_free(ctx->add_fk[i]); /* Clear the to_be_dropped flags in the data dictionary cache. @@ -8923,7 +9188,7 @@ innobase_rename_column_try( const char* to) { dberr_t error; - bool clust_has_prefixes = false; + bool clust_has_wide_format = false; DBUG_ENTER("innobase_rename_column_try"); @@ -8944,10 +9209,11 @@ innobase_rename_column_try( index != NULL; index = dict_table_get_next_index(index)) { - bool has_prefixes = false; + bool wide_format = false; for (size_t i = 0; i < dict_index_get_n_fields(index); i++) { - if (dict_index_get_nth_field(index, i)->prefix_len) { - has_prefixes = true; + dict_field_t* field= dict_index_get_nth_field(index, i); + if (field->prefix_len || field->descending) { + wide_format = true; break; } } @@ -8962,8 +9228,10 @@ innobase_rename_column_try( } pars_info_t* info = pars_info_create(); - ulint pos = has_prefixes ? i << 16 | f.prefix_len : i; - + ulint pos = wide_format + ? i << 16 | f.prefix_len + | !!f.descending << 15 + : i; pars_info_add_ull_literal(info, "indexid", index->id); pars_info_add_int4_literal(info, "nth", pos); pars_info_add_str_literal(info, "new", to); @@ -8983,15 +9251,16 @@ innobase_rename_column_try( goto err_exit; } - if (!has_prefixes || !clust_has_prefixes - || f.prefix_len) { + if (!wide_format || !clust_has_wide_format + || f.prefix_len || f.descending) { continue; } /* For secondary indexes, the - has_prefixes check can be 'polluted' - by PRIMARY KEY column prefix. Try also - the simpler encoding of SYS_FIELDS.POS. */ + wide_format check can be 'polluted' + by PRIMARY KEY column prefix or descending + field. Try also the simpler encoding + of SYS_FIELDS.POS. */ info = pars_info_create(); pars_info_add_ull_literal(info, "indexid", index->id); @@ -9013,7 +9282,7 @@ innobase_rename_column_try( } if (index == dict_table_get_first_index(ctx.old_table)) { - clust_has_prefixes = has_prefixes; + clust_has_wide_format = wide_format; } } @@ -9149,16 +9418,14 @@ innobase_rename_columns_try( const char* table_name) { uint i = 0; - ulint num_v = 0; DBUG_ASSERT(ctx->need_rebuild()); DBUG_ASSERT(ha_alter_info->handler_flags & ALTER_COLUMN_NAME); for (Field** fp = table->field; *fp; fp++, i++) { - const bool is_virtual = !(*fp)->stored_in_db(); if (!((*fp)->flags & FIELD_IS_RENAMED)) { - goto processed_field; + continue; } for (const Create_field& cf : @@ -9176,46 +9443,12 @@ innobase_rename_columns_try( ut_error; processed_field: - if (is_virtual) { - num_v++; - } - continue; } return(false); } -/** Convert field type and length to InnoDB format */ -static void get_type(const Field& f, uint& prtype, uint8_t& mtype, - uint16_t& len) -{ - mtype = get_innobase_type_from_mysql_type(&prtype, &f); - len = static_cast(f.pack_length()); - prtype |= f.type(); - if (f.type() == MYSQL_TYPE_VARCHAR) { - auto l = static_cast(f).length_bytes; - len = static_cast(len - l); - if (l == 2) prtype |= DATA_LONG_TRUE_VARCHAR; - } - if (!f.real_maybe_null()) prtype |= DATA_NOT_NULL; - if (f.binary()) prtype |= DATA_BINARY_TYPE; - if (f.table->versioned()) { - if (&f == f.table->field[f.table->s->vers.start_fieldno]) { - prtype |= DATA_VERS_START; - } else if (&f == f.table->field[f.table->s->vers.end_fieldno]) { - prtype |= DATA_VERS_END; - } else if (!(f.flags & VERS_UPDATE_UNVERSIONED_FLAG)) { - prtype |= DATA_VERSIONED; - } - } - if (!f.stored_in_db()) prtype |= DATA_VIRTUAL; - - if (dtype_is_string_type(mtype)) { - prtype |= f.charset()->number << 16; - } -} - /** Enlarge a column in the data dictionary tables. @param ctx In-place ALTER TABLE context @param trx data dictionary transaction @@ -9703,8 +9936,8 @@ innobase_update_foreign_cache( dict_names_t fk_tables; err = dict_load_foreigns(user_table->name.m_name, - ctx->col_names, false, true, - DICT_ERR_IGNORE_NONE, + ctx->col_names, 1, true, + DICT_ERR_IGNORE_FK_NOKEY, fk_tables); if (err == DB_CANNOT_ADD_CONSTRAINT) { @@ -9714,7 +9947,7 @@ innobase_update_foreign_cache( loaded with "foreign_key checks" off, so let's retry the loading with charset_check is off */ err = dict_load_foreigns(user_table->name.m_name, - ctx->col_names, false, false, + ctx->col_names, 1, false, DICT_ERR_IGNORE_NONE, fk_tables); @@ -9912,6 +10145,7 @@ commit_try_rebuild( ha_innobase_inplace_ctx*ctx, TABLE* altered_table, const TABLE* old_table, + bool statistics_exist, trx_t* trx, const char* table_name) { @@ -9982,7 +10216,9 @@ commit_try_rebuild( if (error == DB_SUCCESS) { /* The statistics for the surviving indexes will be re-inserted in alter_stats_rebuild(). */ - error = trx->drop_table_statistics(old_name); + if (statistics_exist) { + error = trx->drop_table_statistics(old_name); + } if (error == DB_SUCCESS) { error = trx->drop_table(*user_table); } @@ -10358,7 +10594,11 @@ commit_try_norebuild( default: sql_print_error("InnoDB: %s: %s\n", op, ut_strerr(error)); - DBUG_ASSERT(0); + DBUG_ASSERT(error == DB_IO_ERROR + || error == DB_LOCK_TABLE_FULL + || error == DB_DECRYPTION_FAILED + || error == DB_PAGE_CORRUPTED + || error == DB_CORRUPTION); my_error(ER_INTERNAL_ERROR, MYF(0), op); } @@ -10534,6 +10774,7 @@ commit_cache_norebuild( DBUG_ASSERT(dict_index_get_online_status(index) == ONLINE_INDEX_COMPLETE); DBUG_ASSERT(!index->is_committed()); + index->change_col_info = nullptr; index->set_committed(true); } @@ -10613,6 +10854,10 @@ commit_cache_norebuild( : NULL; DBUG_ASSERT((ctx->new_table->fts == NULL) == (ctx->new_table->fts_doc_id_index == NULL)); + if (table->found_next_number_field + && !altered_table->found_next_number_field) { + ctx->prebuilt->table->persistent_autoinc = 0; + } DBUG_RETURN(found); } @@ -10707,7 +10952,6 @@ static bool alter_rebuild_apply_log( dropped were not created in the copy of the table. Apply any last bit of the rebuild log and then rename the tables. */ dict_table_t* user_table = ctx->old_table; - dict_table_t* rebuilt_table = ctx->new_table; DEBUG_SYNC_C("row_log_table_apply2_before"); @@ -10736,41 +10980,8 @@ static bool alter_rebuild_apply_log( ctx->new_table->vc_templ = NULL; } - ulint err_key = thr_get_trx(ctx->thr)->error_key_num; - - switch (error) { - KEY* dup_key; - case DB_SUCCESS: - break; - case DB_DUPLICATE_KEY: - if (err_key == ULINT_UNDEFINED) { - /* This should be the hidden index on - FTS_DOC_ID. */ - dup_key = NULL; - } else { - DBUG_ASSERT(err_key < ha_alter_info->key_count); - dup_key = &ha_alter_info->key_info_buffer[err_key]; - } - - print_keydup_error(altered_table, dup_key, MYF(0)); - DBUG_RETURN(true); - case DB_ONLINE_LOG_TOO_BIG: - my_error(ER_INNODB_ONLINE_LOG_TOO_BIG, MYF(0), - get_error_key_name(err_key, ha_alter_info, - rebuilt_table)); - DBUG_RETURN(true); - case DB_INDEX_CORRUPT: - my_error(ER_INDEX_CORRUPT, MYF(0), - get_error_key_name(err_key, ha_alter_info, - rebuilt_table)); - DBUG_RETURN(true); - default: - my_error_innodb(error, ctx->old_table->name.m_name, - user_table->flags); - DBUG_RETURN(true); - } - - DBUG_RETURN(false); + DBUG_RETURN(ctx->log_failure( + ha_alter_info, altered_table, error)); } /** Commit or rollback the changes made during @@ -10828,7 +11039,15 @@ ha_innobase::commit_inplace_alter_table( if (!(ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE)) { DBUG_ASSERT(!ctx0); MONITOR_ATOMIC_DEC(MONITOR_PENDING_ALTER_TABLE); - ha_alter_info->group_commit_ctx = NULL; + if (table->found_next_number_field + && !altered_table->found_next_number_field) { + m_prebuilt->table->persistent_autoinc = 0; + /* Don't reset ha_alter_info->group_commit_ctx to make + partitions engine to call this function for all + partitions. */ + } + else + ha_alter_info->group_commit_ctx = NULL; DBUG_RETURN(false); } @@ -10876,12 +11095,14 @@ ha_innobase::commit_inplace_alter_table( } } + bool already_stopped= false; for (inplace_alter_handler_ctx** pctx = ctx_array; *pctx; pctx++) { auto ctx = static_cast(*pctx); dberr_t error = DB_SUCCESS; if (fts_exist) { - purge_sys.stop_FTS(*ctx->old_table); + purge_sys.stop_FTS(*ctx->old_table, already_stopped); + already_stopped = true; } if (new_clustered && ctx->old_table->fts) { @@ -10915,6 +11136,12 @@ ha_innobase::commit_inplace_alter_table( LOCK_X); } + DBUG_EXECUTE_IF("deadlock_table_fail", + { + error= DB_DEADLOCK; + trx_rollback_for_mysql(trx); + }); + if (error != DB_SUCCESS) { lock_fail: my_error_innodb( @@ -10922,6 +11149,16 @@ ha_innobase::commit_inplace_alter_table( if (fts_exist) { purge_sys.resume_FTS(); } + + /* Deadlock encountered and rollbacked the + transaction. So restart the transaction + to remove the newly created table or + index from data dictionary and table cache + in rollback_inplace_alter_table() */ + if (trx->state == TRX_STATE_NOT_STARTED) { + trx_start_for_ddl(trx); + } + DBUG_RETURN(true); } else if ((ctx->new_table->flags2 & (DICT_TF2_FTS_HAS_DOC_ID | DICT_TF2_FTS)) @@ -10959,6 +11196,76 @@ ha_innobase::commit_inplace_alter_table( DBUG_RETURN(true); } } + } else { + dberr_t error= DB_SUCCESS; + for (inplace_alter_handler_ctx** pctx= ctx_array; *pctx; + pctx++) { + auto ctx= static_cast(*pctx); + + if (!ctx->online || !ctx->old_table->space + || !ctx->old_table->is_readable()) { + continue; + } + + for (ulint i = 0; i < ctx->num_to_add_index; i++) { + dict_index_t *index= ctx->add_index[i]; + + ut_ad(!(index->type & + (DICT_FTS | DICT_SPATIAL))); + + index->lock.x_lock(SRW_LOCK_CALL); + if (!index->online_log) { + /* online log would've cleared + when we detect the error in + other index */ + index->lock.x_unlock(); + continue; + } + + if (index->is_corrupted()) { + /* Online index log has been + preserved to show the error + when it happened via + row_log_apply() by DML thread */ + error= row_log_get_error(index); +err_index: + ut_ad(error != DB_SUCCESS); + ctx->log_failure( + ha_alter_info, + altered_table, error); + row_log_free(index->online_log); + index->online_log= nullptr; + index->lock.x_unlock(); + + ctx->old_table->indexes.start + ->online_log= nullptr; + if (fts_exist) { + purge_sys.resume_FTS(); + } + MONITOR_ATOMIC_INC( + MONITOR_BACKGROUND_DROP_INDEX); + DBUG_RETURN(true); + } + + index->lock.x_unlock(); + + error = row_log_apply( + m_prebuilt->trx, index, altered_table, + ctx->m_stage); + + index->lock.x_lock(SRW_LOCK_CALL); + + if (error != DB_SUCCESS) { + goto err_index; + } + + row_log_free(index->online_log); + index->online_log= nullptr; + index->lock.x_unlock(); + } + + ctx->old_table->indexes.start->online_log= nullptr; + } } dict_table_t *table_stats = nullptr, *index_stats = nullptr; @@ -10991,6 +11298,11 @@ ha_innobase::commit_inplace_alter_table( error = lock_table_for_trx(index_stats, trx, LOCK_X); } } + + DBUG_EXECUTE_IF("stats_lock_fail", + error = DB_LOCK_WAIT_TIMEOUT; + trx_rollback_for_mysql(trx);); + if (error == DB_SUCCESS) { error = lock_sys_tables(trx); } @@ -11007,6 +11319,18 @@ ha_innobase::commit_inplace_alter_table( if (fts_exist) { purge_sys.resume_FTS(); } + + if (trx->state == TRX_STATE_NOT_STARTED) { + /* Transaction may have been rolled back + due to a lock wait timeout, deadlock, + or a KILL statement. So restart the + transaction to remove the newly created + table or index stubs from data dictionary + and table cache in + rollback_inplace_alter_table() */ + trx_start_for_ddl(trx); + } + DBUG_RETURN(true); } @@ -11052,6 +11376,7 @@ ha_innobase::commit_inplace_alter_table( if (commit_try_rebuild(ha_alter_info, ctx, altered_table, table, + table_stats && index_stats, trx, table_share->table_name.str)) { goto fail; @@ -11215,7 +11540,8 @@ ha_innobase::commit_inplace_alter_table( || ha_alter_info->alter_info->create_list.elements)) || (ctx0->is_instant() && m_prebuilt->table->n_v_cols - && ha_alter_info->handler_flags & ALTER_STORED_COLUMN_ORDER)) { + && ha_alter_info->handler_flags & ALTER_STORED_COLUMN_ORDER) + || !ctx0->change_col_collate.empty()) { DBUG_ASSERT(ctx0->old_table->get_ref_count() == 1); ut_ad(ctx0->prebuilt == m_prebuilt); @@ -11238,6 +11564,8 @@ ha_innobase::commit_inplace_alter_table( purge_sys.resume_FTS(); } MONITOR_ATOMIC_DEC(MONITOR_PENDING_ALTER_TABLE); + /* There is no need to reset dict_table_t::persistent_autoinc + as the table is reloaded */ DBUG_RETURN(false); } diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 717427c9f385d..cf7c3b04f841d 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2021, MariaDB Corporation. +Copyright (c) 2014, 2022, 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 @@ -46,7 +46,6 @@ Created July 18, 2007 Vasil Dimov #include "trx0i_s.h" #include "trx0trx.h" #include "srv0mon.h" -#include "fut0fut.h" #include "pars0pars.h" #include "fts0types.h" #include "fts0opt.h" @@ -58,6 +57,7 @@ Created July 18, 2007 Vasil Dimov #include "dict0crea.h" #include "fts0vlc.h" #include "scope.h" +#include "log.h" /** The latest successfully looked up innodb_fts_aux_table */ table_id_t innodb_ft_aux_table_id; @@ -169,19 +169,37 @@ time_t MYSQL_TYPE_DATETIME --------------------------------- */ -/*******************************************************************//** +/** Common function to fill any of the dynamic tables: INFORMATION_SCHEMA.innodb_trx INFORMATION_SCHEMA.innodb_locks INFORMATION_SCHEMA.innodb_lock_waits -@return 0 on success */ -static -int -trx_i_s_common_fill_table( -/*======================*/ - THD* thd, /*!< in: thread */ - TABLE_LIST* tables, /*!< in/out: tables to fill */ - Item* ); /*!< in: condition (not used) */ +@retval false if access to the table is blocked +@retval true if something should be filled in */ +static bool trx_i_s_common_fill_table(THD *thd, TABLE_LIST *tables) +{ + DBUG_ENTER("trx_i_s_common_fill_table"); + + /* deny access to non-superusers */ + if (check_global_access(thd, PROCESS_ACL)) + DBUG_RETURN(false); + + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str); + + /* update the cache */ + trx_i_s_cache_start_write(trx_i_s_cache); + trx_i_s_possibly_fetch_data_into_cache(trx_i_s_cache); + trx_i_s_cache_end_write(trx_i_s_cache); + + if (trx_i_s_cache_is_truncated(trx_i_s_cache)) + sql_print_warning("InnoDB: Data in %.*s truncated due to memory limit" + " of %u bytes", + int(tables->schema_table_name.length), + tables->schema_table_name.str, + TRX_I_S_MEM_LIMIT); + + DBUG_RETURN(true); +} /*******************************************************************//** Unbind a dynamic INFORMATION_SCHEMA table. @@ -318,7 +336,7 @@ static ST_FIELD_INFO innodb_trx_fields_info[]= #define IDX_TRX_ISOLATION_LEVEL 16 Column("trx_isolation_level", - Enum(&isolation_level_values_typelib), NOT_NULL, DEFAULT_NONE), + Enum(&isolation_level_values_typelib), NOT_NULL), #define IDX_TRX_UNIQUE_CHECKS 17 Column("trx_unique_checks", SLong(1), NOT_NULL), @@ -344,26 +362,29 @@ static ST_FIELD_INFO innodb_trx_fields_info[]= /*******************************************************************//** Read data from cache buffer and fill the INFORMATION_SCHEMA.innodb_trx table with it. -@return 0 on success */ -static -int -fill_innodb_trx_from_cache( -/*=======================*/ - trx_i_s_cache_t* cache, /*!< in: cache to read from */ - THD* thd, /*!< in: used to call - schema_table_store_record() */ - TABLE* table) /*!< in/out: fill this table */ +@retval 0 on success +@retval 1 on failure */ +static int fill_innodb_trx_from_cache(THD *thd, TABLE_LIST *tables, Item*) { - Field** fields; ulint rows_num; char lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1]; ulint i; DBUG_ENTER("fill_innodb_trx_from_cache"); - fields = table->field; + if (!trx_i_s_common_fill_table(thd, tables)) { + DBUG_RETURN(0); + } + + struct cache + { + cache() { trx_i_s_cache_start_read(trx_i_s_cache); } + ~cache() { trx_i_s_cache_end_read(trx_i_s_cache); } + } c; + + Field** fields = tables->table->field; - rows_num = trx_i_s_cache_get_rows_used(cache, + rows_num = trx_i_s_cache_get_rows_used(trx_i_s_cache, I_S_INNODB_TRX); for (i = 0; i < rows_num; i++) { @@ -372,7 +393,7 @@ fill_innodb_trx_from_cache( row = (i_s_trx_row_t*) trx_i_s_cache_get_nth_row( - cache, I_S_INNODB_TRX, i); + trx_i_s_cache, I_S_INNODB_TRX, i); /* trx_id */ OK(fields[IDX_TRX_ID]->store(row->trx_id, true)); @@ -481,7 +502,7 @@ fill_innodb_trx_from_cache( OK(fields[IDX_TRX_AUTOCOMMIT_NON_LOCKING]->store( row->trx_is_autocommit_non_locking, true)); - OK(schema_table_store_record(thd, table)); + OK(schema_table_store_record(thd, tables->table)); } DBUG_RETURN(0); @@ -503,7 +524,7 @@ innodb_trx_init( schema = (ST_SCHEMA_TABLE*) p; schema->fields_info = Show::innodb_trx_fields_info; - schema->fill_table = trx_i_s_common_fill_table; + schema->fill_table = fill_innodb_trx_from_cache; DBUG_RETURN(0); } @@ -596,10 +617,10 @@ static ST_FIELD_INFO innodb_locks_fields_info[]= Column("lock_trx_id", ULonglong(), NOT_NULL), #define IDX_LOCK_MODE 2 - Column("lock_mode", Enum(&lock_mode_values_typelib), NOT_NULL, DEFAULT_NONE), + Column("lock_mode", Enum(&lock_mode_values_typelib), NOT_NULL), #define IDX_LOCK_TYPE 3 - Column("lock_type", Enum(&lock_type_values_typelib), NOT_NULL, DEFAULT_NONE), + Column("lock_type", Enum(&lock_type_values_typelib), NOT_NULL), #define IDX_LOCK_TABLE 4 Column("lock_table", Varchar(1024), NOT_NULL), @@ -630,20 +651,29 @@ static int fill_innodb_locks_from_cache( /*=========================*/ - trx_i_s_cache_t* cache, /*!< in: cache to read from */ THD* thd, /*!< in: MySQL client connection */ - TABLE* table) /*!< in/out: fill this table */ + TABLE_LIST* tables, /*!< in/out: fill this table */ + Item*) { - Field** fields; ulint rows_num; char lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1]; ulint i; DBUG_ENTER("fill_innodb_locks_from_cache"); - fields = table->field; + if (!trx_i_s_common_fill_table(thd, tables)) { + DBUG_RETURN(0); + } + + struct cache + { + cache() { trx_i_s_cache_start_read(trx_i_s_cache); } + ~cache() { trx_i_s_cache_end_read(trx_i_s_cache); } + } c; - rows_num = trx_i_s_cache_get_rows_used(cache, + Field** fields = tables->table->field; + + rows_num = trx_i_s_cache_get_rows_used(trx_i_s_cache, I_S_INNODB_LOCKS); for (i = 0; i < rows_num; i++) { @@ -654,7 +684,7 @@ fill_innodb_locks_from_cache( row = (i_s_locks_row_t*) trx_i_s_cache_get_nth_row( - cache, I_S_INNODB_LOCKS, i); + trx_i_s_cache, I_S_INNODB_LOCKS, i); /* lock_id */ trx_i_s_create_lock_id(row, lock_id, sizeof(lock_id)); @@ -701,7 +731,7 @@ fill_innodb_locks_from_cache( fields[IDX_LOCK_DATA]->set_null(); } - OK(schema_table_store_record(thd, table)); + OK(schema_table_store_record(thd, tables->table)); } DBUG_RETURN(0); @@ -723,7 +753,7 @@ innodb_locks_init( schema = (ST_SCHEMA_TABLE*) p; schema->fields_info = Show::innodb_locks_fields_info; - schema->fill_table = trx_i_s_common_fill_table; + schema->fill_table = fill_innodb_locks_from_cache; DBUG_RETURN(0); } @@ -805,12 +835,11 @@ static int fill_innodb_lock_waits_from_cache( /*==============================*/ - trx_i_s_cache_t* cache, /*!< in: cache to read from */ THD* thd, /*!< in: used to call schema_table_store_record() */ - TABLE* table) /*!< in/out: fill this table */ + TABLE_LIST* tables, /*!< in/out: fill this table */ + Item*) { - Field** fields; ulint rows_num; char requested_lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1]; char blocking_lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1]; @@ -818,9 +847,19 @@ fill_innodb_lock_waits_from_cache( DBUG_ENTER("fill_innodb_lock_waits_from_cache"); - fields = table->field; + if (!trx_i_s_common_fill_table(thd, tables)) { + DBUG_RETURN(0); + } + + struct cache + { + cache() { trx_i_s_cache_start_read(trx_i_s_cache); } + ~cache() { trx_i_s_cache_end_read(trx_i_s_cache); } + } c; + + Field** fields = tables->table->field; - rows_num = trx_i_s_cache_get_rows_used(cache, + rows_num = trx_i_s_cache_get_rows_used(trx_i_s_cache, I_S_INNODB_LOCK_WAITS); for (i = 0; i < rows_num; i++) { @@ -829,7 +868,7 @@ fill_innodb_lock_waits_from_cache( row = (i_s_lock_waits_row_t*) trx_i_s_cache_get_nth_row( - cache, I_S_INNODB_LOCK_WAITS, i); + trx_i_s_cache, I_S_INNODB_LOCK_WAITS, i); /* requesting_trx_id */ OK(fields[IDX_REQUESTING_TRX_ID]->store( @@ -855,7 +894,7 @@ fill_innodb_lock_waits_from_cache( blocking_lock_id, sizeof(blocking_lock_id)))); - OK(schema_table_store_record(thd, table)); + OK(schema_table_store_record(thd, tables->table)); } DBUG_RETURN(0); @@ -877,7 +916,7 @@ innodb_lock_waits_init( schema = (ST_SCHEMA_TABLE*) p; schema->fields_info = Show::innodb_lock_waits_fields_info; - schema->fill_table = trx_i_s_common_fill_table; + schema->fill_table = fill_innodb_lock_waits_from_cache; DBUG_RETURN(0); } @@ -931,105 +970,6 @@ struct st_maria_plugin i_s_innodb_lock_waits = MariaDB_PLUGIN_MATURITY_STABLE, }; -/*******************************************************************//** -Common function to fill any of the dynamic tables: -INFORMATION_SCHEMA.innodb_trx -INFORMATION_SCHEMA.innodb_locks -INFORMATION_SCHEMA.innodb_lock_waits -@return 0 on success */ -static -int -trx_i_s_common_fill_table( -/*======================*/ - THD* thd, /*!< in: thread */ - TABLE_LIST* tables, /*!< in/out: tables to fill */ - Item* ) /*!< in: condition (not used) */ -{ - LEX_CSTRING table_name; - int ret; - trx_i_s_cache_t* cache; - - DBUG_ENTER("trx_i_s_common_fill_table"); - - /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { - - DBUG_RETURN(0); - } - - /* minimize the number of places where global variables are - referenced */ - cache = trx_i_s_cache; - - /* which table we have to fill? */ - table_name = tables->schema_table_name; - /* or table_name = tables->schema_table->table_name; */ - - RETURN_IF_INNODB_NOT_STARTED(table_name.str); - - /* update the cache */ - trx_i_s_cache_start_write(cache); - trx_i_s_possibly_fetch_data_into_cache(cache); - trx_i_s_cache_end_write(cache); - - if (trx_i_s_cache_is_truncated(cache)) { - - ib::warn() << "Data in " << table_name.str << " truncated due to" - " memory limit of " << TRX_I_S_MEM_LIMIT << " bytes"; - } - - ret = 0; - - trx_i_s_cache_start_read(cache); - - if (innobase_strcasecmp(table_name.str, "innodb_trx") == 0) { - - if (fill_innodb_trx_from_cache( - cache, thd, tables->table) != 0) { - - ret = 1; - } - - } else if (innobase_strcasecmp(table_name.str, "innodb_locks") == 0) { - - if (fill_innodb_locks_from_cache( - cache, thd, tables->table) != 0) { - - ret = 1; - } - - } else if (innobase_strcasecmp(table_name.str, "innodb_lock_waits") == 0) { - - if (fill_innodb_lock_waits_from_cache( - cache, thd, tables->table) != 0) { - - ret = 1; - } - - } else { - ib::error() << "trx_i_s_common_fill_table() was" - " called to fill unknown table: " << table_name.str << "." - " This function only knows how to fill" - " innodb_trx, innodb_locks and" - " innodb_lock_waits tables."; - - ret = 1; - } - - trx_i_s_cache_end_read(cache); - -#if 0 - DBUG_RETURN(ret); -#else - /* if this function returns something else than 0 then a - deadlock occurs between the mysqld server and mysql client, - see http://bugs.mysql.com/29900 ; when that bug is resolved - we can enable the DBUG_RETURN(ret) above */ - ret++; // silence a gcc46 warning - DBUG_RETURN(0); -#endif -} - namespace Show { /* Fields of the dynamic table information_schema.innodb_cmp. */ static ST_FIELD_INFO i_s_cmp_fields_info[] = @@ -1346,9 +1286,8 @@ i_s_cmp_per_index_fill_low( for (iter = snap.begin(), i = 0; iter != snap.end(); iter++, i++) { - dict_index_t* index = dict_index_find_on_id_low(iter->first); - - if (index != NULL) { + if (dict_index_t* index + = dict_index_get_if_in_cache_low(iter->first)) { char db_utf8[MAX_DB_UTF8_LEN]; char table_utf8[MAX_TABLE_UTF8_LEN]; @@ -1882,7 +1821,7 @@ static ST_FIELD_INFO innodb_metrics_fields_info[]= Column("ENABLED", SLong(1), NOT_NULL), #define METRIC_TYPE 15 - Column("TYPE", Enum(&metric_type_values_typelib), NOT_NULL, DEFAULT_NONE), + Column("TYPE", Enum(&metric_type_values_typelib), NOT_NULL), #define METRIC_DESC 16 Column("COMMENT", Varchar(NAME_LEN + 1), NOT_NULL), @@ -3874,10 +3813,10 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[]= Column("COMPRESSED_SIZE", ULonglong(), NOT_NULL), #define IDX_BUFFER_PAGE_STATE 15 + I_S_AHI - Column("PAGE_STATE", Enum(&page_state_values_typelib), NOT_NULL, DEFAULT_NONE), + Column("PAGE_STATE", Enum(&page_state_values_typelib), NOT_NULL), #define IDX_BUFFER_PAGE_IO_FIX 16 + I_S_AHI - Column("IO_FIX", Enum(&io_values_typelib), NOT_NULL, DEFAULT_NONE), + Column("IO_FIX", Enum(&io_values_typelib), NOT_NULL), #define IDX_BUFFER_PAGE_IS_OLD 17 + I_S_AHI Column("IS_OLD", SLong(1), NOT_NULL), @@ -4391,7 +4330,7 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = Column("COMPRESSED", SLong(1), NOT_NULL), #define IDX_BUF_LRU_PAGE_IO_FIX 16 + I_S_AHI - Column("IO_FIX", Enum(&io_values_typelib), NOT_NULL, DEFAULT_NONE), + Column("IO_FIX", Enum(&io_values_typelib), NOT_NULL), #define IDX_BUF_LRU_PAGE_IS_OLD 17 + I_S_AHI Column("IS_OLD", SLong(1), NULLABLE), @@ -4808,12 +4747,13 @@ i_s_dict_fill_sys_tables( /** Convert one SYS_TABLES record to dict_table_t. @param pcur persistent cursor position on SYS_TABLES record +@param mtr mini-transaction (nullptr=use the dict_sys cache) @param rec record to read from (nullptr=use the dict_sys cache) @param table the converted dict_table_t @return error message @retval nullptr on success */ -static const char *i_s_sys_tables_rec(const btr_pcur_t &pcur, const rec_t *rec, - dict_table_t **table) +static const char *i_s_sys_tables_rec(const btr_pcur_t &pcur, mtr_t *mtr, + const rec_t *rec, dict_table_t **table) { static_assert(DICT_FLD__SYS_TABLES__NAME == 0, "compatibility"); size_t len; @@ -4831,12 +4771,11 @@ static const char *i_s_sys_tables_rec(const btr_pcur_t &pcur, const rec_t *rec, return "corrupted SYS_TABLES.NAME"; } - const spanname{reinterpret_cast(pcur.old_rec), len}; - if (rec) - return dict_load_table_low(name, rec, table); + return dict_load_table_low(mtr, false, rec, table); - *table= dict_sys.load_table(name); + *table= dict_sys.load_table + (span{reinterpret_cast(pcur.old_rec), len}); return *table ? nullptr : "Table not found in cache"; } @@ -4878,7 +4817,7 @@ i_s_sys_tables_fill_table( /* Create and populate a dict_table_t structure with information from SYS_TABLES row */ - err_msg = i_s_sys_tables_rec(pcur, rec, &table_rec); + err_msg = i_s_sys_tables_rec(pcur, &mtr, rec, &table_rec); mtr.commit(); dict_sys.unlock(); @@ -5012,71 +4951,61 @@ static ST_FIELD_INFO innodb_sys_tablestats_fields_info[]= }; } // namespace Show -/** Populate information_schema.innodb_sys_tablestats table with information -from SYS_TABLES. -@param[in] thd thread ID -@param[in,out] table table -@param[in] ref_count table reference count -@param[in,out] table_to_fill fill this table +/** Populate information_schema.innodb_sys_tablestats table with a table, +and release exclusive dict_sys.latch. +@param[in] thd connection +@param[in,out] table InnoDB table metadata +@param[in,out] table_to_fill INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS @return 0 on success */ static int -i_s_dict_fill_sys_tablestats( - THD* thd, - dict_table_t* table, - ulint ref_count, - TABLE* table_to_fill) +i_s_dict_fill_sys_tablestats(THD* thd, dict_table_t *table, + TABLE* table_to_fill) { - Field** fields; + DBUG_ENTER("i_s_dict_fill_sys_tablestats"); - DBUG_ENTER("i_s_dict_fill_sys_tablestats"); + Field **fields= table_to_fill->field; - fields = table_to_fill->field; - - OK(fields[SYS_TABLESTATS_ID]->store(longlong(table->id), TRUE)); - - OK(field_store_string(fields[SYS_TABLESTATS_NAME], - table->name.m_name)); - - { - table->stats_mutex_lock(); - auto _ = make_scope_exit([table]() { - table->stats_mutex_unlock(); }); - - OK(fields[SYS_TABLESTATS_INIT]->store(table->stat_initialized, - true)); - - if (table->stat_initialized) { - OK(fields[SYS_TABLESTATS_NROW]->store( - table->stat_n_rows, true)); - - OK(fields[SYS_TABLESTATS_CLUST_SIZE]->store( - table->stat_clustered_index_size, true)); + { + table->stats_mutex_lock(); + auto _ = make_scope_exit([table]() { + table->stats_mutex_unlock(); dict_sys.unlock(); }); - OK(fields[SYS_TABLESTATS_INDEX_SIZE]->store( - table->stat_sum_of_other_index_sizes, - true)); + OK(fields[SYS_TABLESTATS_ID]->store(longlong(table->id), TRUE)); - OK(fields[SYS_TABLESTATS_MODIFIED]->store( - table->stat_modified_counter, true)); - } else { - OK(fields[SYS_TABLESTATS_NROW]->store(0, true)); + OK(field_store_string(fields[SYS_TABLESTATS_NAME], + table->name.m_name)); + OK(fields[SYS_TABLESTATS_INIT]->store(table->stat_initialized, true)); - OK(fields[SYS_TABLESTATS_CLUST_SIZE]->store(0, true)); + if (table->stat_initialized) + { + OK(fields[SYS_TABLESTATS_NROW]->store(table->stat_n_rows, true)); - OK(fields[SYS_TABLESTATS_INDEX_SIZE]->store(0, true)); + OK(fields[SYS_TABLESTATS_CLUST_SIZE]-> + store(table->stat_clustered_index_size, true)); - OK(fields[SYS_TABLESTATS_MODIFIED]->store(0, true)); - } - } + OK(fields[SYS_TABLESTATS_INDEX_SIZE]-> + store(table->stat_sum_of_other_index_sizes, true)); - OK(fields[SYS_TABLESTATS_AUTONINC]->store(table->autoinc, true)); + OK(fields[SYS_TABLESTATS_MODIFIED]-> + store(table->stat_modified_counter, true)); + } + else + { + OK(fields[SYS_TABLESTATS_NROW]->store(0, true)); + OK(fields[SYS_TABLESTATS_CLUST_SIZE]->store(0, true)); + OK(fields[SYS_TABLESTATS_INDEX_SIZE]->store(0, true)); + OK(fields[SYS_TABLESTATS_MODIFIED]->store(0, true)); + } - OK(fields[SYS_TABLESTATS_TABLE_REF_COUNT]->store(ref_count, true)); + OK(fields[SYS_TABLESTATS_AUTONINC]->store(table->autoinc, true)); - OK(schema_table_store_record(thd, table_to_fill)); + OK(fields[SYS_TABLESTATS_TABLE_REF_COUNT]-> + store(table->get_ref_count(), true)); + } - DBUG_RETURN(0); + OK(schema_table_store_record(thd, table_to_fill)); + DBUG_RETURN(0); } /*******************************************************************//** @@ -5111,22 +5040,17 @@ i_s_sys_tables_fill_table_stats( while (rec) { const char* err_msg; - dict_table_t* table_rec= 0; + dict_table_t* table_rec = nullptr; mtr.commit(); /* Fetch the dict_table_t structure corresponding to this SYS_TABLES record */ - err_msg = i_s_sys_tables_rec(pcur, nullptr, &table_rec); + err_msg = i_s_sys_tables_rec(pcur, nullptr, nullptr, + &table_rec); if (UNIV_LIKELY(!err_msg)) { - bool evictable = dict_sys.prevent_eviction(table_rec); - ulint ref_count = table_rec->get_ref_count(); - dict_sys.unlock(); - i_s_dict_fill_sys_tablestats(thd, table_rec, ref_count, + i_s_dict_fill_sys_tablestats(thd, table_rec, tables->table); - if (!evictable) { - table_rec = nullptr; - } } else { ut_ad(!table_rec); dict_sys.unlock(); @@ -5138,9 +5062,6 @@ i_s_sys_tables_fill_table_stats( /* Get the next record */ mtr.start(); dict_sys.lock(SRW_LOCK_CALL); - if (table_rec) { - dict_sys.allow_eviction(table_rec); - } rec = dict_getnext_system(&pcur, &mtr); } @@ -5242,10 +5163,10 @@ static ST_FIELD_INFO innodb_sysindex_fields_info[]= Column("N_FIELDS", SLong(), NOT_NULL), #define SYS_INDEX_PAGE_NO 5 - Column("PAGE_NO", SLong(), NOT_NULL), + Column("PAGE_NO", SLong(), NULLABLE), #define SYS_INDEX_SPACE 6 - Column("SPACE", SLong(), NOT_NULL), + Column("SPACE", SLong(), NULLABLE), #define SYS_INDEX_MERGE_THRESHOLD 7 Column("MERGE_THRESHOLD", SLong(), NOT_NULL), @@ -5297,12 +5218,14 @@ i_s_dict_fill_sys_indexes( if (index->page == FIL_NULL) { fields[SYS_INDEX_PAGE_NO]->set_null(); } else { + fields[SYS_INDEX_PAGE_NO]->set_notnull(); OK(fields[SYS_INDEX_PAGE_NO]->store(index->page, true)); } - if (space_id == ULINT_UNDEFINED) { + if (space_id == FIL_NULL) { fields[SYS_INDEX_SPACE]->set_null(); } else { + fields[SYS_INDEX_SPACE]->set_notnull(); OK(fields[SYS_INDEX_SPACE]->store(space_id, true)); } @@ -6483,6 +6406,8 @@ static ST_FIELD_INFO innodb_sys_tablespaces_fields_info[]= }; } // namespace Show +extern size_t os_file_get_fs_block_size(const char *path); + /** Produce one row of INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES. @param thd connection @param s tablespace @@ -6513,8 +6438,13 @@ static int i_s_sys_tablespaces_fill(THD *thd, const fil_space_t &s, TABLE *t) OK(f->store(name.data(), name.size(), system_charset_info)); f->set_notnull(); } - else - f->set_notnull(); + else if (srv_is_undo_tablespace(s.id)) + { + char name[15]; + snprintf(name, sizeof name, "innodb_undo%03u", + (s.id - srv_undo_space_id_start + 1)); + OK(f->store(name, strlen(name), system_charset_info)); + } else f->set_notnull(); } fields[SYS_TABLESPACES_NAME]->set_null(); @@ -6524,31 +6454,18 @@ static int i_s_sys_tablespaces_fill(THD *thd, const fil_space_t &s, TABLE *t) OK(field_store_string(fields[SYS_TABLESPACES_FILENAME], filepath)); OK(fields[SYS_TABLESPACES_PAGE_SIZE]->store(s.physical_size(), true)); - os_file_stat_t stat; - stat.block_size= 0; + size_t fs_block_size; os_file_size_t file= os_file_get_size(filepath); if (file.m_total_size == os_offset_t(~0)) { file.m_total_size= 0; file.m_alloc_size= 0; + fs_block_size= 0; } else - { - /* Get the file system (or Volume) block size. */ - switch (dberr_t err= os_file_get_status(filepath, &stat, false, false)) { - case DB_FAIL: - ib::warn() << "File '" << filepath << "', failed to get stats"; - break; - case DB_SUCCESS: - case DB_NOT_FOUND: - break; - default: - ib::error() << "File '" << filepath << "' " << err; - break; - } - } + fs_block_size= os_file_get_fs_block_size(filepath); - OK(fields[SYS_TABLESPACES_FS_BLOCK_SIZE]->store(stat.block_size, true)); + OK(fields[SYS_TABLESPACES_FS_BLOCK_SIZE]->store(fs_block_size, true)); OK(fields[SYS_TABLESPACES_FILE_SIZE]->store(file.m_total_size, true)); OK(fields[SYS_TABLESPACES_ALLOC_SIZE]->store(file.m_alloc_size, true)); @@ -6581,7 +6498,9 @@ static int i_s_sys_tablespaces_fill_table(THD *thd, TABLE_LIST *tables, Item*) { space.reacquire(); mysql_mutex_unlock(&fil_system.mutex); + space.s_lock(); err= i_s_sys_tablespaces_fill(thd, space, tables->table); + space.s_unlock(); mysql_mutex_lock(&fil_system.mutex); space.release(); if (err) @@ -6591,6 +6510,8 @@ static int i_s_sys_tablespaces_fill_table(THD *thd, TABLE_LIST *tables, Item*) fil_system.freeze_space_list--; mysql_mutex_unlock(&fil_system.mutex); + if (err == DB_SUCCESS) + err= i_s_sys_tablespaces_fill(thd, *fil_system.temp_space, tables->table); DBUG_RETURN(err); } @@ -6718,7 +6639,6 @@ i_s_dict_fill_tablespaces_encryption( { Field** fields; struct fil_space_crypt_status_t status; - DBUG_ENTER("i_s_dict_fill_tablespaces_encryption"); fields = table_to_fill->field; @@ -6740,6 +6660,14 @@ i_s_dict_fill_tablespaces_encryption( name.data(), name.size(), system_charset_info)); fields[TABLESPACES_ENCRYPTION_NAME]->set_notnull(); + } else if (srv_is_undo_tablespace(space->id)) { + char undo_name[sizeof "innodb_undo000"]; + snprintf(undo_name, sizeof undo_name, + "innodb_undo%03" PRIu32, space->id); + OK(fields[TABLESPACES_ENCRYPTION_NAME]->store( + undo_name, strlen(undo_name), + system_charset_info)); + fields[TABLESPACES_ENCRYPTION_NAME]->set_notnull(); } else { fields[TABLESPACES_ENCRYPTION_NAME]->set_null(); } @@ -6807,8 +6735,10 @@ i_s_tablespaces_encryption_fill_table( && !space.is_stopping()) { space.reacquire(); mysql_mutex_unlock(&fil_system.mutex); + space.s_lock(); err = i_s_dict_fill_tablespaces_encryption( thd, &space, tables->table); + space.s_unlock(); mysql_mutex_lock(&fil_system.mutex); space.release(); if (err) { diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index f41e3f659fc47..4dae6bbd6dc3e 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2022, MariaDB Corporation. +Copyright (c) 2016, 2023, 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 @@ -49,6 +49,7 @@ Created 7/19/1997 Heikki Tuuri #include "que0que.h" #include "srv0start.h" /* srv_shutdown_state */ #include "rem0cmp.h" +#include "log.h" /* STRUCTURE OF AN INSERT BUFFER RECORD @@ -239,9 +240,7 @@ static /** The mutex protecting the insert buffer */ mysql_mutex_t ibuf_mutex, /** The mutex covering pessimistic inserts into the change buffer */ - ibuf_pessimistic_insert_mutex, - /** mutex covering all change buffer bitmap pages */ - ibuf_bitmap_mutex; + ibuf_pessimistic_insert_mutex; /** The area in pages from which contract looks for page numbers for merge */ const ulint IBUF_MERGE_AREA = 8; @@ -327,23 +326,18 @@ ibuf_header_page_get( /** Acquire the change buffer root page. @param[in,out] mtr mini-transaction @return change buffer root page, SX-latched */ -static buf_block_t *ibuf_tree_root_get(mtr_t *mtr) +static buf_block_t *ibuf_tree_root_get(mtr_t *mtr, dberr_t *err= nullptr) { - buf_block_t* block; - - ut_ad(ibuf_inside(mtr)); - mysql_mutex_assert_owner(&ibuf_mutex); + ut_ad(ibuf_inside(mtr)); + mysql_mutex_assert_owner(&ibuf_mutex); - mtr_sx_lock_index(ibuf.index, mtr); + mtr_sx_lock_index(ibuf.index, mtr); - /* only segment list access is exclusive each other */ - block = buf_page_get( - page_id_t(IBUF_SPACE_ID, FSP_IBUF_TREE_ROOT_PAGE_NO), - 0, RW_SX_LATCH, mtr); - - ut_ad(ibuf.empty == page_is_empty(block->page.frame)); - - return block; + buf_block_t *block= + buf_page_get_gen(page_id_t{IBUF_SPACE_ID, FSP_IBUF_TREE_ROOT_PAGE_NO}, + 0, RW_SX_LATCH, nullptr, BUF_GET, mtr, err); + ut_ad(!block || ibuf.empty == page_is_empty(block->page.frame)); + return block; } /******************************************************************//** @@ -358,7 +352,6 @@ ibuf_close(void) mysql_mutex_destroy(&ibuf_pessimistic_insert_mutex); mysql_mutex_destroy(&ibuf_mutex); - mysql_mutex_destroy(&ibuf_bitmap_mutex); dict_table_t* ibuf_table = ibuf.index->table; ibuf.index->lock.free(); @@ -396,7 +389,6 @@ ibuf_init_at_db_start(void) /*=======================*/ { page_t* root; - ulint n_used; ut_ad(!ibuf.index); mtr_t mtr; @@ -404,13 +396,49 @@ ibuf_init_at_db_start(void) compile_time_assert(IBUF_SPACE_ID == TRX_SYS_SPACE); compile_time_assert(IBUF_SPACE_ID == 0); mtr.x_lock_space(fil_system.sys_space); - buf_block_t* header_page = buf_page_get( + dberr_t err; + buf_block_t* header_page = buf_page_get_gen( page_id_t(IBUF_SPACE_ID, FSP_IBUF_HEADER_PAGE_NO), - 0, RW_X_LATCH, &mtr); + 0, RW_X_LATCH, nullptr, BUF_GET, &mtr, &err); if (!header_page) { +err_exit: + sql_print_error("InnoDB: The change buffer is corrupted" + " or has been removed on upgrade" + " to MariaDB 11.0 or later"); mtr.commit(); - return DB_DECRYPTION_FAILED; + if (innodb_change_buffering == IBUF_USE_NONE) { + err = DB_SUCCESS; + } + return err; + } + + fseg_n_reserved_pages(*header_page, + IBUF_HEADER + IBUF_TREE_SEG_HEADER + + header_page->page.frame, &ibuf.seg_size, &mtr); + + do { + DBUG_EXECUTE_IF("intermittent_read_failure", continue;); + ut_ad(ibuf.seg_size >= 2); + } while (0); + + if (buf_block_t* block = + buf_page_get_gen(page_id_t(IBUF_SPACE_ID, + FSP_IBUF_TREE_ROOT_PAGE_NO), + 0, RW_X_LATCH, nullptr, BUF_GET, &mtr, &err)) { + root = buf_block_get_frame(block); + } else { + goto err_exit; + } + + DBUG_EXECUTE_IF("ibuf_init_corrupt", + err = DB_CORRUPTION; + goto err_exit;); + + if (page_is_comp(root) || fil_page_get_type(root) != FIL_PAGE_INDEX + || btr_page_get_index_id(root) != DICT_IBUF_ID_MIN) { + err = DB_CORRUPTION; + goto err_exit; } /* At startup we intialize ibuf to have a maximum of @@ -422,30 +450,10 @@ ibuf_init_at_db_start(void) * CHANGE_BUFFER_DEFAULT_SIZE) / 100; mysql_mutex_init(ibuf_mutex_key, &ibuf_mutex, nullptr); - mysql_mutex_init(ibuf_bitmap_mutex_key, &ibuf_bitmap_mutex, nullptr); mysql_mutex_init(ibuf_pessimistic_insert_mutex_key, &ibuf_pessimistic_insert_mutex, nullptr); mysql_mutex_lock(&ibuf_mutex); - - fseg_n_reserved_pages(*header_page, - IBUF_HEADER + IBUF_TREE_SEG_HEADER - + header_page->page.frame, &n_used, &mtr); - - ut_ad(n_used >= 2); - - ibuf.seg_size = n_used; - - { - buf_block_t* block; - - block = buf_page_get( - page_id_t(IBUF_SPACE_ID, FSP_IBUF_TREE_ROOT_PAGE_NO), - 0, RW_X_LATCH, &mtr); - - root = buf_block_get_frame(block); - } - ibuf_size_update(root); mysql_mutex_unlock(&ibuf_mutex); @@ -474,9 +482,8 @@ ibuf_init_at_db_start(void) ib::info() << "Dumping the change buffer"; ibuf_mtr_start(&mtr); btr_pcur_t pcur; - if (DB_SUCCESS == btr_pcur_open_at_index_side( - true, ibuf.index, BTR_SEARCH_LEAF, &pcur, - true, 0, &mtr)) { + if (DB_SUCCESS + == pcur.open_leaf(true, ibuf.index, BTR_SEARCH_LEAF, &mtr)) { while (btr_pcur_move_to_next_user_rec(&pcur, &mtr)) { rec_print_old(stderr, btr_pcur_get_rec(&pcur)); } @@ -496,6 +503,7 @@ ibuf_max_size_update( ulint new_val) /*!< in: new value in terms of percentage of the buffer pool size */ { + if (UNIV_UNLIKELY(!ibuf.index)) return; ulint new_size = ((buf_pool_get_curr_size() >> srv_page_size_shift) * new_val) / 100; mysql_mutex_lock(&ibuf_mutex); @@ -666,9 +674,9 @@ ibuf_bitmap_get_map_page( ulint zip_size, mtr_t* mtr) { - return buf_page_get_gen( - ibuf_bitmap_page_no_calc(page_id, zip_size), - zip_size, RW_X_LATCH, NULL, BUF_GET_POSSIBLY_FREED, mtr); + return buf_page_get_gen(ibuf_bitmap_page_no_calc(page_id, zip_size), + zip_size, RW_X_LATCH, nullptr, + BUF_GET_POSSIBLY_FREED, mtr); } /************************************************************************//** @@ -721,42 +729,36 @@ ibuf_set_free_bits_func( #endif /* UNIV_IBUF_DEBUG */ ulint val) /*!< in: value to set: < 4 */ { - if (!page_is_leaf(block->page.frame)) { - return; - } - - mtr_t mtr; - mtr.start(); - const page_id_t id(block->page.id()); + if (!page_is_leaf(block->page.frame)) + return; - const fil_space_t* space = mtr.set_named_space_id(id.space()); + mtr_t mtr; + mtr.start(); + const page_id_t id(block->page.id()); + const fil_space_t *space= mtr.set_named_space_id(id.space()); - buf_block_t* bitmap_page = ibuf_bitmap_get_map_page(id, - block->zip_size(), - &mtr); - - if (space->purpose != FIL_TYPE_TABLESPACE) { - mtr.set_log_mode(MTR_LOG_NO_REDO); - } + if (buf_block_t *bitmap_page= + ibuf_bitmap_get_map_page(id, block->zip_size(), &mtr)) + { + if (space->purpose != FIL_TYPE_TABLESPACE) + mtr.set_log_mode(MTR_LOG_NO_REDO); #ifdef UNIV_IBUF_DEBUG - if (max_val != ULINT_UNDEFINED) { - ulint old_val; - - old_val = ibuf_bitmap_page_get_bits( - bitmap_page, id, - IBUF_BITMAP_FREE, &mtr); - ut_a(old_val <= max_val); - } - - ut_a(val <= ibuf_index_page_calc_free(block)); + if (max_val != ULINT_UNDEFINED) + { + ulint old_val= ibuf_bitmap_page_get_bits(bitmap_page, id, + IBUF_BITMAP_FREE, &mtr); + ut_a(old_val <= max_val); + } + + ut_a(val <= ibuf_index_page_calc_free(block)); #endif /* UNIV_IBUF_DEBUG */ - ibuf_bitmap_page_set_bits( - bitmap_page, id, block->physical_size(), - val, &mtr); + ibuf_bitmap_page_set_bits + (bitmap_page, id, block->physical_size(), val, &mtr); + } - mtr.commit(); + mtr.commit(); } /************************************************************************//** @@ -868,26 +870,16 @@ ibuf_update_free_bits_for_two_pages_low( buf_block_t* block2, /*!< in: index page */ mtr_t* mtr) /*!< in: mtr */ { - ulint state; - - ut_ad(mtr->is_named_space(block1->page.id().space())); - ut_ad(block1->page.id().space() == block2->page.id().space()); - - /* As we have to x-latch two random bitmap pages, we have to acquire - the bitmap mutex to prevent a deadlock with a similar operation - performed by another OS thread. */ - - mysql_mutex_lock(&ibuf_bitmap_mutex); - - state = ibuf_index_page_calc_free(block1); - - ibuf_set_free_bits_low(block1, state, mtr); - - state = ibuf_index_page_calc_free(block2); + ut_ad(mtr->is_named_space(block1->page.id().space())); + ut_ad(block1->page.id().space() == block2->page.id().space()); - ibuf_set_free_bits_low(block2, state, mtr); + /* Avoid deadlocks by acquiring multiple bitmap page latches in + a consistent order (smaller pointer first). */ + if (block1 > block2) + std::swap(block1, block2); - mysql_mutex_unlock(&ibuf_bitmap_mutex); + ibuf_set_free_bits_low(block1, ibuf_index_page_calc_free(block1), mtr); + ibuf_set_free_bits_low(block2, ibuf_index_page_calc_free(block2), mtr); } /** Returns TRUE if the page is one of the fixed address ibuf pages. @@ -948,14 +940,12 @@ ibuf_page_low( not be modified by any other thread. Nobody should be calling ibuf_add_free_page() or ibuf_remove_free_page() while the page is linked to the insert buffer b-tree. */ - dberr_t err = DB_SUCCESS; - buf_block_t* block = buf_page_get_gen( ibuf_bitmap_page_no_calc(page_id, zip_size), - zip_size, RW_NO_LATCH, NULL, BUF_GET_NO_LATCH, - &local_mtr, &err); + zip_size, RW_NO_LATCH, nullptr, BUF_GET, &local_mtr); - ret = ibuf_bitmap_page_get_bits_low( + ret = block + && ibuf_bitmap_page_get_bits_low( block->page.frame, page_id, zip_size, MTR_MEMO_BUF_FIX, &local_mtr, IBUF_BITMAP_IBUF); @@ -969,11 +959,12 @@ ibuf_page_low( mtr_start(mtr); } - ret = ibuf_bitmap_page_get_bits(ibuf_bitmap_get_map_page( - page_id, zip_size, - mtr)->page.frame, - page_id, zip_size, - IBUF_BITMAP_IBUF, mtr); + buf_block_t *block = ibuf_bitmap_get_map_page(page_id, zip_size, + mtr); + ret = block + && ibuf_bitmap_page_get_bits(block->page.frame, + page_id, zip_size, + IBUF_BITMAP_IBUF, mtr); if (mtr == &local_mtr) { mtr_commit(mtr); @@ -1657,6 +1648,7 @@ ibuf_entry_build( dfield_copy(field, entry_field); ifield = dict_index_get_nth_field(index, i); + ut_ad(!ifield->descending); /* Prefix index columns of fixed-length columns are of fixed length. However, in the function call below, dfield_get_type(entry_field) contains the fixed length @@ -1794,6 +1786,10 @@ static bool ibuf_add_free_page() order */ mtr.x_lock_space(fil_system.sys_space); header_page = ibuf_header_page_get(&mtr); + if (!header_page) { + mtr.commit(); + return false; + } /* Allocate a new page: NOTE that if the page has been a part of a non-clustered index which has subsequently been dropped, then the @@ -1805,11 +1801,12 @@ static bool ibuf_add_free_page() of a deadlock. This is the reason why we created a special ibuf header page apart from the ibuf tree. */ - block = fseg_alloc_free_page( + dberr_t err; + block = fseg_alloc_free_page_general( header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER, 0, FSP_UP, - &mtr); + false, &mtr, &mtr, &err); - if (block == NULL) { + if (!block) { mtr.commit(); return false; } @@ -1820,15 +1817,24 @@ static bool ibuf_add_free_page() mtr.write<2>(*block, block->page.frame + FIL_PAGE_TYPE, FIL_PAGE_IBUF_FREE_LIST); + buf_block_t* ibuf_root = ibuf_tree_root_get(&mtr); + if (UNIV_UNLIKELY(!ibuf_root)) { +corrupted: + /* Do not bother to try to free the allocated block, because + the change buffer is seriously corrupted already. */ + mysql_mutex_unlock(&ibuf_mutex); + ibuf_mtr_commit(&mtr); + return false; + } /* Add the page to the free list and update the ibuf size data */ - flst_add_last(ibuf_tree_root_get(&mtr), - PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, - block, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr); - - ibuf.seg_size++; - ibuf.free_list_len++; + err = flst_add_last(ibuf_root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, + block, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, + &mtr); + if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + goto corrupted; + } /* Set the bit indicating that this page is now an ibuf tree page (level 2 page) */ @@ -1836,23 +1842,24 @@ static bool ibuf_add_free_page() const page_id_t page_id(block->page.id()); buf_block_t* bitmap_page = ibuf_bitmap_get_map_page(page_id, 0, &mtr); + if (UNIV_UNLIKELY(!bitmap_page)) { + goto corrupted; + } + + ibuf.seg_size++; + ibuf.free_list_len++; + mysql_mutex_unlock(&ibuf_mutex); ibuf_bitmap_page_set_bits(bitmap_page, page_id, - srv_page_size, true, - &mtr); - + srv_page_size, true, &mtr); ibuf_mtr_commit(&mtr); - return true; } /*********************************************************************//** Removes a page from the free list and frees it to the fsp system. */ -static -void -ibuf_remove_free_page(void) -/*=======================*/ +static void ibuf_remove_free_page() { mtr_t mtr; mtr_t mtr2; @@ -1872,8 +1879,8 @@ ibuf_remove_free_page(void) mysql_mutex_lock(&ibuf_pessimistic_insert_mutex); mysql_mutex_lock(&ibuf_mutex); - if (!ibuf_data_too_much_free()) { - + if (!header_page || !ibuf_data_too_much_free()) { +early_exit: mysql_mutex_unlock(&ibuf_mutex); mysql_mutex_unlock(&ibuf_pessimistic_insert_mutex); @@ -1886,10 +1893,16 @@ ibuf_remove_free_page(void) buf_block_t* root = ibuf_tree_root_get(&mtr2); + if (UNIV_UNLIKELY(!root)) { + ibuf_mtr_commit(&mtr2); + goto early_exit; + } + mysql_mutex_unlock(&ibuf_mutex); - uint32_t page_no = flst_get_last(PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST - + root->page.frame).page; + const uint32_t page_no = flst_get_last(PAGE_HEADER + + PAGE_BTR_IBUF_FREE_LIST + + root->page.frame).page; /* NOTE that we must release the latch on the ibuf tree root because in fseg_free_page we access level 1 pages, and the root @@ -1905,43 +1918,60 @@ ibuf_remove_free_page(void) page from it. */ compile_time_assert(IBUF_SPACE_ID == 0); - fseg_free_page(header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER, - fil_system.sys_space, page_no, &mtr); + const page_id_t page_id{IBUF_SPACE_ID, page_no}; + buf_block_t* bitmap_page = nullptr; + dberr_t err = fseg_free_page( + header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER, + fil_system.sys_space, page_no, &mtr); - const page_id_t page_id(IBUF_SPACE_ID, page_no); + if (err != DB_SUCCESS) { + goto func_exit; + } ibuf_enter(&mtr); mysql_mutex_lock(&ibuf_mutex); - root = ibuf_tree_root_get(&mtr); + root = ibuf_tree_root_get(&mtr, &err); + if (UNIV_UNLIKELY(!root)) { + mysql_mutex_unlock(&ibuf_pessimistic_insert_mutex); + goto func_exit; + } ut_ad(page_no == flst_get_last(PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST + root->page.frame).page); - buf_block_t* block = buf_page_get(page_id, 0, RW_X_LATCH, &mtr); - /* Remove the page from the free list and update the ibuf size data */ - - flst_remove(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, - block, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr); + if (buf_block_t* block = + buf_page_get_gen(page_id, 0, RW_X_LATCH, nullptr, BUF_GET, + &mtr, &err)) { + err = flst_remove(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, + block, + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, + &mtr); + } mysql_mutex_unlock(&ibuf_pessimistic_insert_mutex); - ibuf.seg_size--; - ibuf.free_list_len--; - - /* Set the bit indicating that this page is no more an ibuf tree page - (level 2 page) */ - - buf_block_t* bitmap_page = ibuf_bitmap_get_map_page(page_id, 0, &mtr); + if (err == DB_SUCCESS) { + ibuf.seg_size--; + ibuf.free_list_len--; + bitmap_page = ibuf_bitmap_get_map_page(page_id, 0, &mtr); + } +func_exit: mysql_mutex_unlock(&ibuf_mutex); - ibuf_bitmap_page_set_bits( - bitmap_page, page_id, srv_page_size, false, &mtr); + if (bitmap_page) { + /* Set the bit indicating that this page is no more an + ibuf tree page (level 2 page) */ + ibuf_bitmap_page_set_bits( + bitmap_page, page_id, srv_page_size, false, &mtr); + } - buf_page_free(fil_system.sys_space, page_no, &mtr); + if (err == DB_SUCCESS) { + buf_page_free(fil_system.sys_space, page_no, &mtr); + } ibuf_mtr_commit(&mtr); } @@ -1954,6 +1984,7 @@ void ibuf_free_excess_pages(void) /*========================*/ { + if (UNIV_UNLIKELY(!ibuf.index)) return; /* Free at most a few pages at a time, so that we do not delay the requested service too much */ @@ -2022,23 +2053,25 @@ ibuf_get_merge_page_nos_func( *n_stored = 0; - limit = ut_min(IBUF_MAX_N_PAGES_MERGED, - buf_pool_get_curr_size() / 4); - if (page_rec_is_supremum(rec)) { rec = page_rec_get_prev_const(rec); + if (UNIV_UNLIKELY(!rec)) { +corruption: + ut_ad("corrupted page" == 0); + return 0; + } } if (page_rec_is_infimum(rec)) { - rec = page_rec_get_next_const(rec); + if (!rec || page_rec_is_supremum(rec)) { + return 0; + } } - if (page_rec_is_supremum(rec)) { - - return(0); - } + limit = ut_min(IBUF_MAX_N_PAGES_MERGED, + buf_pool_get_curr_size() / 4); first_page_no = ibuf_rec_get_page_no(mtr, rec); first_space_id = ibuf_rec_get_space(mtr, rec); @@ -2070,7 +2103,9 @@ ibuf_get_merge_page_nos_func( prev_page_no = rec_page_no; prev_space_id = rec_space_id; - rec = page_rec_get_prev_const(rec); + if (UNIV_UNLIKELY(!(rec = page_rec_get_prev_const(rec)))) { + goto corruption; + } } rec = page_rec_get_next_const(rec); @@ -2084,7 +2119,7 @@ ibuf_get_merge_page_nos_func( sum_volumes = 0; volume_for_page = 0; - while (*n_stored < limit) { + while (*n_stored < limit && rec) { if (page_rec_is_supremum(rec)) { /* When no more records available, mark this with another 'impossible' pair of space id, page no */ @@ -2245,16 +2280,74 @@ static MY_ATTRIBUTE((warn_unused_result, nonnull)) bool ibuf_delete_rec(const page_id_t page_id, btr_pcur_t* pcur, const dtuple_t* search_tuple, mtr_t* mtr); +/** Delete the change buffer records for the given page id +@param page_id page identifier */ +static void ibuf_delete_recs(const page_id_t page_id) +{ + if (!ibuf.index || srv_read_only_mode) + return; + dfield_t dfield[IBUF_REC_FIELD_METADATA]; + dtuple_t tuple {0,IBUF_REC_FIELD_METADATA,IBUF_REC_FIELD_METADATA, + dfield,0,nullptr +#ifdef UNIV_DEBUG + ,DATA_TUPLE_MAGIC_N +#endif + }; + byte space_id[4], page_no[4]; + + mach_write_to_4(space_id, page_id.space()); + mach_write_to_4(page_no, page_id.page_no()); + + dfield_set_data(&dfield[0], space_id, 4); + dfield_set_data(&dfield[1], field_ref_zero, 1); + dfield_set_data(&dfield[2], page_no, 4); + dtuple_set_types_binary(&tuple, IBUF_REC_FIELD_METADATA); + + mtr_t mtr; +loop: + btr_pcur_t pcur; + pcur.btr_cur.page_cur.index= ibuf.index; + ibuf_mtr_start(&mtr); + if (btr_pcur_open(&tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF, &pcur, &mtr)) + goto func_exit; + if (!btr_pcur_is_on_user_rec(&pcur)) + { + ut_ad(btr_pcur_is_after_last_on_page(&pcur)); + goto func_exit; + } + + for (;;) + { + ut_ad(btr_pcur_is_on_user_rec(&pcur)); + const rec_t* ibuf_rec = btr_pcur_get_rec(&pcur); + if (ibuf_rec_get_space(&mtr, ibuf_rec) != page_id.space() + || ibuf_rec_get_page_no(&mtr, ibuf_rec) != page_id.page_no()) + break; + /* Delete the record from ibuf */ + if (ibuf_delete_rec(page_id, &pcur, &tuple, &mtr)) + { + /* Deletion was pessimistic and mtr was committed: + we start from the beginning again */ + ut_ad(mtr.has_committed()); + goto loop; + } + + if (btr_pcur_is_after_last_on_page(&pcur)) + { + ibuf_mtr_commit(&mtr); + btr_pcur_close(&pcur); + goto loop; + } + } +func_exit: + ibuf_mtr_commit(&mtr); + btr_pcur_close(&pcur); +} + /** Merge the change buffer to some pages. */ static void ibuf_read_merge_pages(const uint32_t* space_ids, const uint32_t* page_nos, ulint n_stored) { -#ifndef DBUG_OFF - mem_heap_t* heap = mem_heap_create(512); - ulint dops[IBUF_OP_COUNT]; - memset(dops, 0, sizeof(dops)); -#endif - for (ulint i = 0; i < n_stored; i++) { const uint32_t space_id = space_ids[i]; fil_space_t* s = fil_space_t::get(space_id); @@ -2277,24 +2370,36 @@ static void ibuf_read_merge_pages(const uint32_t* space_ids, if (UNIV_LIKELY(page_nos[i] < size)) { mtr.start(); dberr_t err; + buf_block_t *block = buf_page_get_gen(page_id_t(space_id, page_nos[i]), zip_size, RW_X_LATCH, nullptr, BUF_GET_POSSIBLY_FREED, &mtr, &err, true); + bool remove = !block + || fil_page_get_type(block->page.frame) + != FIL_PAGE_INDEX + || !page_is_leaf(block->page.frame); mtr.commit(); if (err == DB_TABLESPACE_DELETED) { goto tablespace_deleted; } + if (!remove) { + continue; + } + } + + if (srv_shutdown_state == SRV_SHUTDOWN_NONE + || srv_fast_shutdown) { + continue; } -#ifndef DBUG_OFF - DBUG_EXECUTE_IF("ibuf_merge_corruption", goto work_around;); - continue; /* The following code works around a hang when the - change buffer is corrupted, likely due to the race - condition in crash recovery that was fixed in - MDEV-24449. But, it also introduces corruption by - itself in the following scenario: + change buffer is corrupted, likely due to the + failure of ibuf_merge_or_delete_for_page() to + invoke ibuf_delete_recs() if (!bitmap_bits). + + It also introduced corruption by itself in the + following scenario: (1) We merged buffered changes in buf_page_get_gen() (2) We committed the mini-transaction @@ -2303,120 +2408,61 @@ static void ibuf_read_merge_pages(const uint32_t* space_ids, (5) Other threads buffer changes for that page. (6) We will wrongly discard those newly buffered changes below. - This code will be available in debug builds, so that - users may try to fix a shutdown hang that occurs due - to a corrupted change buffer. */ + To prevent this scenario, we will only invoke this code + on shutdown. A call to ibuf_max_size_update(0) will cause + ibuf_insert_low() to refuse to insert anything into the + change buffer. */ -work_around: /* Prevent an infinite loop, by removing entries from - the change buffer also in the case the bitmap bits were + the change buffer in the case the bitmap bits were wrongly clear even though buffered changes exist. */ - const dtuple_t* tuple = ibuf_search_tuple_build( - space_id, page_nos[i], heap); -loop: - btr_pcur_t pcur; - ibuf_mtr_start(&mtr); - btr_pcur_open(ibuf.index, tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF, - &pcur, &mtr); - if (!btr_pcur_is_on_user_rec(&pcur)) { - ut_ad(btr_pcur_is_after_last_on_page(&pcur)); - goto done; - } - - for (;;) { - ut_ad(btr_pcur_is_on_user_rec(&pcur)); - - const rec_t* ibuf_rec = btr_pcur_get_rec(&pcur); - if (ibuf_rec_get_space(&mtr, ibuf_rec) != space_id - || ibuf_rec_get_page_no(&mtr, ibuf_rec) - != page_nos[i]) { - break; - } - - dops[ibuf_rec_get_op_type(&mtr, ibuf_rec)]++; - /* Delete the record from ibuf */ - if (ibuf_delete_rec(page_id_t(space_id, page_nos[i]), - &pcur, tuple, &mtr)) { - /* Deletion was pessimistic and mtr - was committed: we start from the - beginning again */ - ut_ad(mtr.has_committed()); - goto loop; - } - - if (btr_pcur_is_after_last_on_page(&pcur)) { - ibuf_mtr_commit(&mtr); - btr_pcur_close(&pcur); - goto loop; - } - } -done: - ibuf_mtr_commit(&mtr); - btr_pcur_close(&pcur); - mem_heap_empty(heap); -#endif + ibuf_delete_recs(page_id_t(space_ids[i], page_nos[i])); } - -#ifndef DBUG_OFF - ibuf_add_ops(ibuf.n_discarded_ops, dops); - mem_heap_free(heap); -#endif } -/*********************************************************************//** -Contracts insert buffer trees by reading pages to the buffer pool. +/** Contract the change buffer by reading pages to the buffer pool. @return a lower limit for the combined size in bytes of entries which -will be merged from ibuf trees to the pages read, 0 if ibuf is -empty */ -static -ulint -ibuf_merge_pages( -/*=============*/ - ulint* n_pages) /*!< out: number of pages to which merged */ +will be merged from ibuf trees to the pages read +@retval 0 if ibuf.empty */ +ulint ibuf_contract() { + if (UNIV_UNLIKELY(!ibuf.index)) return 0; mtr_t mtr; - btr_pcur_t pcur; + btr_cur_t cur; ulint sum_sizes; uint32_t page_nos[IBUF_MAX_N_PAGES_MERGED]; uint32_t space_ids[IBUF_MAX_N_PAGES_MERGED]; - *n_pages = 0; - ibuf_mtr_start(&mtr); - /* Open a cursor to a randomly chosen leaf of the tree, at a random - position within the leaf */ - bool available; - - available = btr_pcur_open_at_rnd_pos(ibuf.index, BTR_SEARCH_LEAF, - &pcur, &mtr); - /* No one should make this index unavailable when server is running */ - ut_a(available); + if (cur.open_leaf(true, ibuf.index, BTR_SEARCH_LEAF, &mtr) != + DB_SUCCESS) { + return 0; + } - ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf.index)); + ut_ad(page_validate(btr_cur_get_page(&cur), ibuf.index)); - if (page_is_empty(btr_pcur_get_page(&pcur))) { + if (page_is_empty(btr_cur_get_page(&cur))) { /* If a B-tree page is empty, it must be the root page and the whole B-tree must be empty. InnoDB does not allow empty B-tree pages other than the root. */ ut_ad(ibuf.empty); - ut_ad(btr_pcur_get_block(&pcur)->page.id() + ut_ad(btr_cur_get_block(&cur)->page.id() == page_id_t(IBUF_SPACE_ID, FSP_IBUF_TREE_ROOT_PAGE_NO)); ibuf_mtr_commit(&mtr); - btr_pcur_close(&pcur); return(0); } + ulint n_pages = 0; sum_sizes = ibuf_get_merge_page_nos(TRUE, - btr_pcur_get_rec(&pcur), &mtr, + btr_cur_get_rec(&cur), &mtr, space_ids, - page_nos, n_pages); + page_nos, &n_pages); ibuf_mtr_commit(&mtr); - btr_pcur_close(&pcur); - ibuf_read_merge_pages(space_ids, page_nos, *n_pages); + ibuf_read_merge_pages(space_ids, page_nos, n_pages); return(sum_sizes + 1); } @@ -2430,31 +2476,47 @@ ibuf_merge_space( /*=============*/ ulint space) /*!< in: tablespace id to merge */ { + if (UNIV_UNLIKELY(!ibuf.index)) return 0; mtr_t mtr; btr_pcur_t pcur; - mem_heap_t* heap = mem_heap_create(512); - dtuple_t* tuple = ibuf_search_tuple_build(space, 0, heap); + + dfield_t dfield[IBUF_REC_FIELD_METADATA]; + dtuple_t tuple {0, IBUF_REC_FIELD_METADATA, + IBUF_REC_FIELD_METADATA,dfield,0,nullptr +#ifdef UNIV_DEBUG + , DATA_TUPLE_MAGIC_N +#endif + }; + byte space_id[4]; + + mach_write_to_4(space_id, space); + + dfield_set_data(&dfield[0], space_id, 4); + dfield_set_data(&dfield[1], field_ref_zero, 1); + dfield_set_data(&dfield[2], field_ref_zero, 4); + + dtuple_set_types_binary(&tuple, IBUF_REC_FIELD_METADATA); ulint n_pages = 0; ut_ad(space < SRV_SPACE_ID_UPPER_BOUND); + log_free_check(); ibuf_mtr_start(&mtr); /* Position the cursor on the first matching record. */ - btr_pcur_open( - ibuf.index, tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur, - &mtr); - - mem_heap_free(heap); - - ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf.index)); + pcur.btr_cur.page_cur.index = ibuf.index; + dberr_t err = btr_pcur_open(&tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, + &pcur, &mtr); + ut_ad(err != DB_SUCCESS || page_validate(btr_pcur_get_page(&pcur), + ibuf.index)); ulint sum_sizes = 0; uint32_t pages[IBUF_MAX_N_PAGES_MERGED]; uint32_t spaces[IBUF_MAX_N_PAGES_MERGED]; - if (page_is_empty(btr_pcur_get_page(&pcur))) { + if (err != DB_SUCCESS) { + } else if (page_is_empty(btr_pcur_get_page(&pcur))) { /* If a B-tree page is empty, it must be the root page and the whole B-tree must be empty. InnoDB does not allow empty B-tree pages other than the root. */ @@ -2472,8 +2534,6 @@ ibuf_merge_space( ibuf_mtr_commit(&mtr); - btr_pcur_close(&pcur); - if (n_pages > 0) { ut_ad(n_pages <= UT_ARR_SIZE(pages)); @@ -2489,72 +2549,6 @@ ibuf_merge_space( return(n_pages); } -/** Contract the change buffer by reading pages to the buffer pool. -@param[out] n_pages number of pages merged -@param[in] sync whether the caller waits for -the issued reads to complete -@return a lower limit for the combined size in bytes of entries which -will be merged from ibuf trees to the pages read, 0 if ibuf is -empty */ -MY_ATTRIBUTE((warn_unused_result)) -static ulint ibuf_merge(ulint* n_pages) -{ - *n_pages = 0; - - /* We perform a dirty read of ibuf.empty, without latching - the insert buffer root page. We trust this dirty read except - when a slow shutdown is being executed. During a slow - shutdown, the insert buffer merge must be completed. */ - - if (ibuf.empty && srv_shutdown_state <= SRV_SHUTDOWN_INITIATED) { - return(0); -#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG - } else if (ibuf_debug) { - return(0); -#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ - } else { - return ibuf_merge_pages(n_pages); - } -} - -/** Contract the change buffer by reading pages to the buffer pool. -@return a lower limit for the combined size in bytes of entries which -will be merged from ibuf trees to the pages read, 0 if ibuf is empty */ -static ulint ibuf_contract() -{ - ulint n_pages; - return ibuf_merge_pages(&n_pages); -} - -/** Contract the change buffer by reading pages to the buffer pool. -@return a lower limit for the combined size in bytes of entries which -will be merged from ibuf trees to the pages read, 0 if ibuf is -empty */ -ulint ibuf_merge_all() -{ -#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG - if (ibuf_debug) { - return(0); - } -#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ - - ulint sum_bytes = 0; - ulint n_pages = srv_io_capacity; - - for (ulint sum_pages = 0; sum_pages < n_pages; ) { - ulint n_pag2; - ulint n_bytes = ibuf_merge(&n_pag2); - - if (n_bytes == 0) { - break; - } - - sum_bytes += n_bytes; - } - - return sum_bytes; -} - /*********************************************************************//** Contract insert buffer trees after insert if they are too big. */ UNIV_INLINE @@ -2564,13 +2558,7 @@ ibuf_contract_after_insert( ulint entry_size) /*!< in: size of a record which was inserted into an ibuf tree */ { - /* Perform dirty reads of ibuf.size and ibuf.max_size, to - reduce ibuf_mutex contention. ibuf.max_size remains constant - after ibuf_init_at_db_start(), but ibuf.size should be - protected by ibuf_mutex. Given that ibuf.size fits in a - machine word, this should be OK; at worst we are doing some - excessive ibuf_contract() or occasionally skipping a - ibuf_contract(). */ + /* dirty comparison, to avoid contention on ibuf_mutex */ if (ibuf.size < ibuf.max_size) { return; } @@ -2789,14 +2777,16 @@ ibuf_get_volume_buffered( page = page_align(rec); ut_ad(page_validate(page, ibuf.index)); - if (page_rec_is_supremum(rec)) { - rec = page_rec_get_prev_const(rec); + if (page_rec_is_supremum(rec) + && UNIV_UNLIKELY(!(rec = page_rec_get_prev_const(rec)))) { +corruption: + ut_ad("corrupted page" == 0); + return srv_page_size; } uint32_t prev_page_no; - for (; !page_rec_is_infimum(rec); - rec = page_rec_get_prev_const(rec)) { + for (; !page_rec_is_infimum(rec); ) { ut_ad(page_align(rec) == page); if (page_no != ibuf_rec_get_page_no(mtr, rec) @@ -2808,6 +2798,10 @@ ibuf_get_volume_buffered( volume += ibuf_get_volume_buffered_count( mtr, rec, hash_bitmap, UT_ARR_SIZE(hash_bitmap), n_recs); + + if (UNIV_UNLIKELY(!(rec = page_rec_get_prev_const(rec)))) { + goto corruption; + } } /* Look at the previous page */ @@ -2819,28 +2813,30 @@ ibuf_get_volume_buffered( goto count_later; } - { - buf_block_t* block; - - block = buf_page_get( - page_id_t(IBUF_SPACE_ID, prev_page_no), - 0, RW_X_LATCH, mtr); - + if (buf_block_t* block = + buf_page_get(page_id_t(IBUF_SPACE_ID, prev_page_no), + 0, RW_X_LATCH, mtr)) { prev_page = buf_block_get_frame(block); ut_ad(page_validate(prev_page, ibuf.index)); + } else { + return srv_page_size; } -#ifdef UNIV_BTR_DEBUG static_assert(FIL_PAGE_NEXT % 4 == 0, "alignment"); static_assert(FIL_PAGE_OFFSET % 4 == 0, "alignment"); - ut_a(!memcmp_aligned<4>(prev_page + FIL_PAGE_NEXT, - page + FIL_PAGE_OFFSET, 4)); -#endif /* UNIV_BTR_DEBUG */ - rec = page_get_supremum_rec(prev_page); - rec = page_rec_get_prev_const(rec); + if (UNIV_UNLIKELY(memcmp_aligned<4>(prev_page + FIL_PAGE_NEXT, + page + FIL_PAGE_OFFSET, 4))) { + return srv_page_size; + } + + rec = page_rec_get_prev_const(page_get_supremum_rec(prev_page)); - for (;; rec = page_rec_get_prev_const(rec)) { + if (UNIV_UNLIKELY(!rec)) { + goto corruption; + } + + for (;;) { ut_ad(page_align(rec) == prev_page); if (page_rec_is_infimum(rec)) { @@ -2861,6 +2857,10 @@ ibuf_get_volume_buffered( volume += ibuf_get_volume_buffered_count( mtr, rec, hash_bitmap, UT_ARR_SIZE(hash_bitmap), n_recs); + + if (UNIV_UNLIKELY(!(rec = page_rec_get_prev_const(rec)))) { + goto corruption; + } } count_later: @@ -2872,6 +2872,9 @@ ibuf_get_volume_buffered( for (; !page_rec_is_supremum(rec); rec = page_rec_get_next_const(rec)) { + if (UNIV_UNLIKELY(!rec)) { + return srv_page_size; + } if (page_no != ibuf_rec_get_page_no(mtr, rec) || space != ibuf_rec_get_space(mtr, rec)) { @@ -2892,37 +2895,34 @@ ibuf_get_volume_buffered( return(volume); } - { - buf_block_t* block; - - block = buf_page_get( - page_id_t(IBUF_SPACE_ID, next_page_no), - 0, RW_X_LATCH, mtr); - + if (buf_block_t* block = + buf_page_get(page_id_t(IBUF_SPACE_ID, next_page_no), + 0, RW_X_LATCH, mtr)) { next_page = buf_block_get_frame(block); ut_ad(page_validate(next_page, ibuf.index)); + } else { + return srv_page_size; } -#ifdef UNIV_BTR_DEBUG static_assert(FIL_PAGE_PREV % 4 == 0, "alignment"); static_assert(FIL_PAGE_OFFSET % 4 == 0, "alignment"); - ut_a(!memcmp_aligned<4>(next_page + FIL_PAGE_PREV, - page + FIL_PAGE_OFFSET, 4)); -#endif /* UNIV_BTR_DEBUG */ + + if (UNIV_UNLIKELY(memcmp_aligned<4>(next_page + FIL_PAGE_PREV, + page + FIL_PAGE_OFFSET, 4))) { + return 0; + } rec = page_get_infimum_rec(next_page); rec = page_rec_get_next_const(rec); - for (;; rec = page_rec_get_next_const(rec)) { - ut_ad(page_align(rec) == next_page); - - if (page_rec_is_supremum(rec)) { - + for (; ; rec = page_rec_get_next_const(rec)) { + if (!rec || page_rec_is_supremum(rec)) { /* We give up */ - return(srv_page_size); } + ut_ad(page_align(rec) == next_page); + if (page_no != ibuf_rec_get_page_no(mtr, rec) || space != ibuf_rec_get_space(mtr, rec)) { @@ -2942,37 +2942,38 @@ void ibuf_update_max_tablespace_id(void) /*===============================*/ { - uint32_t max_space_id; + if (UNIV_UNLIKELY(!ibuf.index)) return; const rec_t* rec; const byte* field; ulint len; btr_pcur_t pcur; mtr_t mtr; - ut_a(!dict_table_is_comp(ibuf.index->table)); + ut_ad(!ibuf.index->table->not_redundant()); ibuf_mtr_start(&mtr); - btr_pcur_open_at_index_side( - false, ibuf.index, BTR_SEARCH_LEAF, &pcur, true, 0, &mtr); + if (pcur.open_leaf(false, ibuf.index, BTR_SEARCH_LEAF, &mtr) + != DB_SUCCESS) { +func_exit: + ibuf_mtr_commit(&mtr); + return; + } ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf.index)); - btr_pcur_move_to_prev(&pcur, &mtr); - - if (btr_pcur_is_before_first_on_page(&pcur)) { - /* The tree is empty */ + if (!btr_pcur_move_to_prev(&pcur, &mtr) + || btr_pcur_is_before_first_on_page(&pcur)) { + goto func_exit; + } - max_space_id = 0; - } else { - rec = btr_pcur_get_rec(&pcur); + rec = btr_pcur_get_rec(&pcur); - field = rec_get_nth_field_old(rec, IBUF_REC_FIELD_SPACE, &len); + field = rec_get_nth_field_old(rec, IBUF_REC_FIELD_SPACE, &len); - ut_a(len == 4); + ut_a(len == 4); - max_space_id = mach_read_from_4(field); - } + const uint32_t max_space_id = mach_read_from_4(field); ibuf_mtr_commit(&mtr); @@ -3131,7 +3132,7 @@ ibuf_index_page_calc_free_from_bits(ulint physical_size, ulint bits) /** Buffer an operation in the insert/delete buffer, instead of doing it directly to the disk page, if this is possible. -@param[in] mode BTR_MODIFY_PREV or BTR_MODIFY_TREE +@param[in] mode BTR_MODIFY_PREV or BTR_INSERT_TREE @param[in] op operation type @param[in] no_counter TRUE=use 5.0.3 format; FALSE=allow delete buffering @@ -3146,7 +3147,7 @@ or clustered static TRANSACTIONAL_TARGET MY_ATTRIBUTE((warn_unused_result)) dberr_t ibuf_insert_low( - ulint mode, + btr_latch_mode mode, ibuf_op_t op, ibool no_counter, const dtuple_t* entry, @@ -3167,7 +3168,7 @@ ibuf_insert_low( lint min_n_recs; rec_t* ins_rec; buf_block_t* bitmap_page; - buf_block_t* block; + buf_block_t* block = NULL; page_t* root; dberr_t err; ibool do_merge; @@ -3186,16 +3187,17 @@ ibuf_insert_low( do_merge = FALSE; - /* Perform dirty reads of ibuf.size and ibuf.max_size, to - reduce ibuf_mutex contention. Given that ibuf.max_size and - ibuf.size fit in a machine word, this should be OK; at worst - we are doing some excessive ibuf_contract() or occasionally + /* Perform dirty comparison of ibuf.max_size and ibuf.size to + reduce ibuf_mutex contention. This should be OK; at worst we + are doing some excessive ibuf_contract() or occasionally skipping an ibuf_contract(). */ - if (ibuf.max_size == 0) { + const ulint max_size = ibuf.max_size; + + if (max_size == 0) { return(DB_STRONG_FAIL); } - if (ibuf.size >= ibuf.max_size + IBUF_CONTRACT_DO_NOT_INSERT) { + if (ibuf.size >= max_size + IBUF_CONTRACT_DO_NOT_INSERT) { /* Insert buffer is now too big, contract it but do not try to insert */ @@ -3226,7 +3228,7 @@ ibuf_insert_low( the new entry to it without exceeding the free space limit for the page. */ - if (BTR_LATCH_MODE_WITHOUT_INTENTION(mode) == BTR_MODIFY_TREE) { + if (mode == BTR_INSERT_TREE) { for (;;) { mysql_mutex_lock(&ibuf_pessimistic_insert_mutex); mysql_mutex_lock(&ibuf_mutex); @@ -3248,8 +3250,28 @@ ibuf_insert_low( } ibuf_mtr_start(&mtr); + pcur.btr_cur.page_cur.index = ibuf.index; + + err = btr_pcur_open(ibuf_entry, PAGE_CUR_LE, mode, &pcur, &mtr); + if (err != DB_SUCCESS) { +func_exit: + ibuf_mtr_commit(&mtr); + ut_free(pcur.old_rec_buf); + mem_heap_free(heap); + + if (err == DB_SUCCESS && mode == BTR_INSERT_TREE) { + ibuf_contract_after_insert(entry_size); + } + + if (do_merge) { +#ifdef UNIV_IBUF_DEBUG + ut_a(n_stored <= IBUF_MAX_N_PAGES_MERGED); +#endif + ibuf_read_merge_pages(space_ids, page_nos, n_stored); + } + return err; + } - btr_pcur_open(ibuf.index, ibuf_entry, PAGE_CUR_LE, mode, &pcur, &mtr); ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf.index)); /* Find out the volume of already buffered inserts for the same index @@ -3284,7 +3306,7 @@ ibuf_insert_low( until after the IBUF_OP_DELETE has been buffered. */ fail_exit: - if (BTR_LATCH_MODE_WITHOUT_INTENTION(mode) == BTR_MODIFY_TREE) { + if (mode == BTR_INSERT_TREE) { mysql_mutex_unlock(&ibuf_mutex); mysql_mutex_unlock(&ibuf_pessimistic_insert_mutex); } @@ -3308,14 +3330,20 @@ ibuf_insert_low( /* We check if the index page is suitable for buffered entries */ - if (buf_pool.page_hash_contains( + if (!bitmap_page || buf_pool.page_hash_contains( page_id, buf_pool.page_hash.cell_get(page_id.fold()))) { commit_exit: ibuf_mtr_commit(&bitmap_mtr); goto fail_exit; + } else if (!lock_sys.rd_lock_try()) { + goto commit_exit; } else { - LockGuard g{lock_sys.rec_hash, page_id}; - if (lock_sys_t::get_first(g.cell(), page_id)) { + hash_cell_t* cell = lock_sys.rec_hash.cell_get(page_id.fold()); + lock_sys.rec_hash.latch(cell)->acquire(); + const lock_t* lock = lock_sys_t::get_first(*cell, page_id); + lock_sys.rec_hash.latch(cell)->release(); + lock_sys.rd_unlock(); + if (lock) { goto commit_exit; } } @@ -3394,15 +3422,20 @@ ibuf_insert_low( ibuf.empty = page_is_empty(root); } } else { - ut_ad(BTR_LATCH_MODE_WITHOUT_INTENTION(mode) - == BTR_MODIFY_TREE); + ut_ad(mode == BTR_INSERT_TREE); /* We acquire an sx-latch to the root page before the insert, because a pessimistic insert releases the tree x-latch, which would cause the sx-latching of the root after that to break the latching order. */ - - root = ibuf_tree_root_get(&mtr)->page.frame; + if (buf_block_t* ibuf_root = ibuf_tree_root_get(&mtr)) { + root = ibuf_root->page.frame; + } else { + err = DB_CORRUPTION; + mysql_mutex_unlock(&ibuf_pessimistic_insert_mutex); + mysql_mutex_unlock(&ibuf_mutex); + goto ibuf_insert_done; + } err = btr_cur_optimistic_insert( BTR_NO_LOCKING_FLAG | BTR_NO_UNDO_LOG_FLAG, @@ -3427,6 +3460,7 @@ ibuf_insert_low( ut_ad(block->page.id().space() == IBUF_SPACE_ID); } +ibuf_insert_done: if (offsets_heap) { mem_heap_free(offsets_heap); } @@ -3437,25 +3471,7 @@ ibuf_insert_low( thr_get_trx(thr)->id, &mtr); } -func_exit: - ibuf_mtr_commit(&mtr); - btr_pcur_close(&pcur); - - mem_heap_free(heap); - - if (err == DB_SUCCESS - && BTR_LATCH_MODE_WITHOUT_INTENTION(mode) == BTR_MODIFY_TREE) { - ibuf_contract_after_insert(entry_size); - } - - if (do_merge) { -#ifdef UNIV_IBUF_DEBUG - ut_a(n_stored <= IBUF_MAX_N_PAGES_MERGED); -#endif - ibuf_read_merge_pages(space_ids, page_nos, n_stored); - } - - return(err); + goto func_exit; } /** Buffer an operation in the change buffer, instead of applying it @@ -3478,6 +3494,10 @@ ibuf_insert( ulint zip_size, que_thr_t* thr) { + if (!index->is_committed()) { + return false; + } + dberr_t err; ulint entry_size; ibool no_counter; @@ -3491,7 +3511,7 @@ ibuf_insert( ut_ad(dtuple_check_typed(entry)); ut_ad(page_id.space() != SRV_TMP_SPACE_ID); - + ut_ad(index->is_btree()); ut_a(!dict_index_is_clust(index)); ut_ad(!index->table->is_temporary()); @@ -3581,7 +3601,7 @@ ibuf_insert( entry, entry_size, index, page_id, zip_size, thr); if (err == DB_FAIL) { - err = ibuf_insert_low(BTR_MODIFY_TREE | BTR_LATCH_FOR_INSERT, + err = ibuf_insert_low(BTR_INSERT_TREE, op, no_counter, entry, entry_size, index, page_id, zip_size, thr); } @@ -3592,84 +3612,47 @@ ibuf_insert( DBUG_RETURN(err == DB_SUCCESS); } +MY_ATTRIBUTE((nonnull, warn_unused_result)) /********************************************************************//** During merge, inserts to an index page a secondary index entry extracted from the insert buffer. -@return newly inserted record */ -static MY_ATTRIBUTE((nonnull)) -rec_t* +@return error code */ +static +dberr_t ibuf_insert_to_index_page_low( /*==========================*/ const dtuple_t* entry, /*!< in: buffered entry to insert */ - buf_block_t* block, /*!< in/out: index page where the buffered - entry should be placed */ - dict_index_t* index, /*!< in: record descriptor */ rec_offs** offsets,/*!< out: offsets on *rec */ mem_heap_t* heap, /*!< in/out: memory heap */ mtr_t* mtr, /*!< in/out: mtr */ page_cur_t* page_cur)/*!< in/out: cursor positioned on the record after which to insert the buffered entry */ { - rec_t* rec; - DBUG_ENTER("ibuf_insert_to_index_page_low"); - - rec = page_cur_tuple_insert(page_cur, entry, index, - offsets, &heap, 0, mtr); - if (rec != NULL) { - DBUG_RETURN(rec); - } - - /* Page reorganization or recompression should already have - been attempted by page_cur_tuple_insert(). Besides, per - ibuf_index_page_calc_free_zip() the page should not have been - recompressed or reorganized. */ - ut_ad(!is_buf_block_get_page_zip(block)); + if (page_cur_tuple_insert(page_cur, entry, offsets, &heap, 0, mtr)) + return DB_SUCCESS; - /* If the record did not fit, reorganize */ + /* Page reorganization or recompression should already have been + attempted by page_cur_tuple_insert(). Besides, per + ibuf_index_page_calc_free_zip() the page should not have been + recompressed or reorganized. */ + ut_ad(!is_buf_block_get_page_zip(page_cur->block)); - btr_page_reorganize(page_cur, index, mtr); + /* If the record did not fit, reorganize */ + if (dberr_t err= btr_page_reorganize(page_cur, mtr)) + return err; - /* This time the record must fit */ + /* This time the record must fit */ + if (page_cur_tuple_insert(page_cur, entry, offsets, &heap, 0, mtr)) + return DB_SUCCESS; - rec = page_cur_tuple_insert(page_cur, entry, index, - offsets, &heap, 0, mtr); - if (rec != NULL) { - DBUG_RETURN(rec); - } - - ib::error() << "Insert buffer insert fails; page free " - << page_get_max_insert_size(block->page.frame, 1) - << ", dtuple size " - << rec_get_converted_size(index, entry, 0); - - fputs("InnoDB: Cannot insert index record ", stderr); - dtuple_print(stderr, entry); - fputs("\nInnoDB: The table where this index record belongs\n" - "InnoDB: is now probably corrupt. Please run CHECK TABLE on\n" - "InnoDB: that table.\n", stderr); - - if (buf_block_t *bitmap_page = ibuf_bitmap_get_map_page( - block->page.id(), block->zip_size(), mtr)) { - - ib::error() << "page " << block->page.id() << ", size " - << block->physical_size() << ", bitmap bits " - << ibuf_bitmap_page_get_bits( - bitmap_page->page.frame, - block->page.id(), block->zip_size(), - IBUF_BITMAP_FREE, mtr); - } - - ib::error() << BUG_REPORT_MSG; - - ut_ad(0); - DBUG_RETURN(NULL); + return DB_CORRUPTION; } /************************************************************************ During merge, inserts to an index page a secondary index entry extracted from the insert buffer. */ static -void +dberr_t ibuf_insert_to_index_page( /*======================*/ const dtuple_t* entry, /*!< in: buffered entry to insert */ @@ -3679,14 +3662,11 @@ ibuf_insert_to_index_page( mtr_t* mtr) /*!< in: mtr */ { page_cur_t page_cur; - ulint low_match; page_t* page = buf_block_get_frame(block); rec_t* rec; rec_offs* offsets; mem_heap_t* heap; - DBUG_ENTER("ibuf_insert_to_index_page"); - DBUG_PRINT("ibuf", ("page " UINT32PF ":" UINT32PF, block->page.id().space(), block->page.id().page_no())); @@ -3705,38 +3685,30 @@ ibuf_insert_to_index_page( if (UNIV_UNLIKELY(dict_table_is_comp(index->table) != (ibool)!!page_is_comp(page))) { - ib::warn() << "Trying to insert a record from the insert" - " buffer to an index page but the 'compact' flag does" - " not match!"; - goto dump; + return DB_CORRUPTION; } rec = page_rec_get_next(page_get_infimum_rec(page)); - if (page_rec_is_supremum(rec)) { - ib::warn() << "Trying to insert a record from the insert" - " buffer to an index page but the index page" - " is empty!"; - goto dump; + if (!rec || page_rec_is_supremum(rec)) { + return DB_CORRUPTION; } if (!rec_n_fields_is_sane(index, rec, entry)) { - ib::warn() << "Trying to insert a record from the insert" - " buffer to an index page but the number of fields" - " does not match!"; - rec_print(stderr, rec, index); -dump: - dtuple_print(stderr, entry); - ut_ad(0); + return DB_CORRUPTION; + } - ib::warn() << "The table where this index record belongs" - " is now probably corrupt. Please run CHECK TABLE on" - " your tables. " << BUG_REPORT_MSG; + ulint up_match = 0, low_match = 0; + page_cur.index = index; + page_cur.block = block; - DBUG_VOID_RETURN; + if (page_cur_search_with_match(entry, PAGE_CUR_LE, + &up_match, &low_match, &page_cur, + nullptr)) { + return DB_CORRUPTION; } - low_match = page_cur_search(block, index, entry, &page_cur); + dberr_t err = DB_SUCCESS; heap = mem_heap_create( sizeof(upd_t) @@ -3777,7 +3749,7 @@ ibuf_insert_to_index_page( if (!row_upd_changes_field_size_or_external(index, offsets, update) && (!page_zip || btr_cur_update_alloc_zip( - page_zip, &page_cur, index, offsets, + page_zip, &page_cur, offsets, rec_offs_size(offsets), false, mtr))) { /* This is the easy case. Do something similar to btr_cur_update_in_place(). */ @@ -3818,26 +3790,21 @@ ibuf_insert_to_index_page( /* Delete the different-length record, and insert the buffered one. */ - lock_rec_store_on_page_infimum(block, rec); - page_cur_delete_rec(&page_cur, index, offsets, mtr); - page_cur_move_to_prev(&page_cur); - rec = ibuf_insert_to_index_page_low(entry, block, index, - &offsets, heap, mtr, - &page_cur); - - ut_ad(!cmp_dtuple_rec(entry, rec, offsets)); - lock_rec_restore_from_page_infimum(*block, rec, - block->page.id()); + page_cur_delete_rec(&page_cur, offsets, mtr); + if (!(page_cur_move_to_prev(&page_cur))) { + err = DB_CORRUPTION; + goto updated_in_place; + } } else { offsets = NULL; - ibuf_insert_to_index_page_low(entry, block, index, - &offsets, heap, mtr, - &page_cur); } + + err = ibuf_insert_to_index_page_low(entry, &offsets, heap, mtr, + &page_cur); updated_in_place: mem_heap_free(heap); - DBUG_VOID_RETURN; + return err; } /****************************************************************//** @@ -3849,18 +3816,21 @@ ibuf_set_del_mark( /*==============*/ const dtuple_t* entry, /*!< in: entry */ buf_block_t* block, /*!< in/out: block */ - const dict_index_t* index, /*!< in: record descriptor */ + dict_index_t* index, /*!< in: record descriptor */ mtr_t* mtr) /*!< in: mtr */ { page_cur_t page_cur; - ulint low_match; + page_cur.block = block; + page_cur.index = index; + ulint up_match = 0, low_match = 0; ut_ad(ibuf_inside(mtr)); ut_ad(dtuple_check_typed(entry)); - low_match = page_cur_search(block, index, entry, &page_cur); - - if (low_match == dtuple_get_n_fields(entry)) { + if (!page_cur_search_with_match(entry, PAGE_CUR_LE, + &up_match, &low_match, &page_cur, + nullptr) + && low_match == dtuple_get_n_fields(entry)) { rec_t* rec = page_cur_get_rec(&page_cur); /* Delete mark the old index record. According to a @@ -3909,16 +3879,19 @@ ibuf_delete( before latching any further pages */ { page_cur_t page_cur; - ulint low_match; + page_cur.block = block; + page_cur.index = index; + ulint up_match = 0, low_match = 0; ut_ad(ibuf_inside(mtr)); ut_ad(dtuple_check_typed(entry)); ut_ad(!index->is_spatial()); ut_ad(!index->is_clust()); - low_match = page_cur_search(block, index, entry, &page_cur); - - if (low_match == dtuple_get_n_fields(entry)) { + if (!page_cur_search_with_match(entry, PAGE_CUR_LE, + &up_match, &low_match, &page_cur, + nullptr) + && low_match == dtuple_get_n_fields(entry)) { page_zip_des_t* page_zip= buf_block_get_page_zip(block); page_t* page = buf_block_get_frame(block); rec_t* rec = page_cur_get_rec(&page_cur); @@ -3960,8 +3933,6 @@ ibuf_delete( return; } - lock_update_delete(block, rec); - if (!page_zip) { max_ins_size = page_get_max_insert_size_after_reorganize( @@ -3970,7 +3941,7 @@ ibuf_delete( #ifdef UNIV_ZIP_DEBUG ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ - page_cur_delete_rec(&page_cur, index, offsets, mtr); + page_cur_delete_rec(&page_cur, offsets, mtr); #ifdef UNIV_ZIP_DEBUG ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ @@ -3984,8 +3955,6 @@ ibuf_delete( if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); } - } else { - /* The record must have been purged already. */ } } @@ -3999,15 +3968,13 @@ ibuf_restore_pos( const page_id_t page_id,/*!< in: page identifier */ const dtuple_t* search_tuple, /*!< in: search tuple for entries of page_no */ - ulint mode, /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE */ + btr_latch_mode mode, /*!< in: BTR_MODIFY_LEAF or BTR_PURGE_TREE */ btr_pcur_t* pcur, /*!< in/out: persistent cursor whose position is to be restored */ mtr_t* mtr) /*!< in/out: mini-transaction */ { - ut_ad(mode == BTR_MODIFY_LEAF - || BTR_LATCH_MODE_WITHOUT_INTENTION(mode) == BTR_MODIFY_TREE); - - if (UNIV_LIKELY(btr_pcur_restore_position(mode, pcur, mtr))) { + if (UNIV_LIKELY(pcur->restore_position(mode, mtr) == + btr_pcur_t::SAME_ALL)) { return true; } @@ -4023,9 +3990,6 @@ ibuf_restore_pos( rec_print_old(stderr, btr_pcur_get_rec(pcur)); rec_print_old(stderr, pcur->old_rec); dtuple_print(stderr, search_tuple); - - rec_print_old(stderr, - page_rec_get_next(btr_pcur_get_rec(pcur))); } ibuf_btr_pcur_commit_specify_mtr(pcur, mtr); @@ -4043,8 +4007,6 @@ static MY_ATTRIBUTE((warn_unused_result, nonnull)) bool ibuf_delete_rec(const page_id_t page_id, btr_pcur_t* pcur, const dtuple_t* search_tuple, mtr_t* mtr) { - ibool success; - page_t* root; dberr_t err; ut_ad(ibuf_inside(mtr)); @@ -4054,15 +4016,16 @@ bool ibuf_delete_rec(const page_id_t page_id, btr_pcur_t* pcur, ut_ad(ibuf_rec_get_space(mtr, btr_pcur_get_rec(pcur)) == page_id.space()); - success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), - 0, mtr); - - if (success) { + switch (btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), + BTR_CREATE_FLAG, mtr)) { + case DB_FAIL: + break; + case DB_SUCCESS: if (page_is_empty(btr_pcur_get_page(pcur))) { /* If a B-tree page is empty, it must be the root page and the whole B-tree must be empty. InnoDB does not allow empty B-tree pages other than the root. */ - root = btr_pcur_get_page(pcur); + ut_d(const page_t* root = btr_pcur_get_page(pcur)); ut_ad(page_get_space_id(root) == IBUF_SPACE_ID); ut_ad(page_get_page_no(root) @@ -4073,7 +4036,8 @@ bool ibuf_delete_rec(const page_id_t page_id, btr_pcur_t* pcur, ut_ad(!ibuf.empty); ibuf.empty = true; } - + /* fall through */ + default: return(FALSE); } @@ -4089,26 +4053,25 @@ bool ibuf_delete_rec(const page_id_t page_id, btr_pcur_t* pcur, ibuf_mtr_start(mtr); mysql_mutex_lock(&ibuf_mutex); + mtr_x_lock_index(ibuf.index, mtr); if (!ibuf_restore_pos(page_id, search_tuple, - BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE, - pcur, mtr)) { - + BTR_PURGE_TREE_ALREADY_LATCHED, pcur, mtr)) { mysql_mutex_unlock(&ibuf_mutex); - ut_ad(mtr->has_committed()); goto func_exit; } - root = ibuf_tree_root_get(mtr)->page.frame; + if (buf_block_t* ibuf_root = ibuf_tree_root_get(mtr)) { + btr_cur_pessimistic_delete(&err, TRUE, + btr_pcur_get_btr_cur(pcur), + BTR_CREATE_FLAG, false, mtr); + ut_a(err == DB_SUCCESS); - btr_cur_pessimistic_delete(&err, TRUE, btr_pcur_get_btr_cur(pcur), 0, - false, mtr); - ut_a(err == DB_SUCCESS); + ibuf_size_update(ibuf_root->page.frame); + ibuf.empty = page_is_empty(ibuf_root->page.frame); + } - ibuf_size_update(root); mysql_mutex_unlock(&ibuf_mutex); - - ibuf.empty = page_is_empty(root); ibuf_btr_pcur_commit_specify_mtr(pcur, mtr); func_exit: @@ -4178,25 +4141,16 @@ exist entries for such a page if the page belonged to an index which subsequently was dropped. @param block X-latched page to try to apply changes to, or NULL to discard @param page_id page identifier -@param zip_size ROW_FORMAT=COMPRESSED page size, or 0 */ -void ibuf_merge_or_delete_for_page(buf_block_t *block, const page_id_t page_id, - ulint zip_size) +@param zip_size ROW_FORMAT=COMPRESSED page size, or 0 +@return error code */ +dberr_t ibuf_merge_or_delete_for_page(buf_block_t *block, + const page_id_t page_id, + ulint zip_size) { if (trx_sys_hdr_page(page_id)) { - return; + return DB_SUCCESS; } - btr_pcur_t pcur; -#ifdef UNIV_IBUF_DEBUG - ulint volume = 0; -#endif /* UNIV_IBUF_DEBUG */ - bool corruption_noticed = false; - mtr_t mtr; - - /* Counts for merged & discarded operations. */ - ulint mops[IBUF_OP_COUNT]; - ulint dops[IBUF_OP_COUNT]; - ut_ad(!block || page_id == block->page.id()); ut_ad(!block || block->page.frame); ut_ad(!block || !block->page.is_ibuf_exist()); @@ -4208,13 +4162,20 @@ void ibuf_merge_or_delete_for_page(buf_block_t *block, const page_id_t page_id, if (ibuf_fixed_addr_page(page_id, physical_size) || fsp_descr_page(page_id, physical_size)) { - return; + return DB_SUCCESS; } + btr_pcur_t pcur; +#ifdef UNIV_IBUF_DEBUG + ulint volume = 0; +#endif /* UNIV_IBUF_DEBUG */ + dberr_t err = DB_SUCCESS; + mtr_t mtr; + fil_space_t* space = fil_space_t::get(page_id.space()); if (UNIV_UNLIKELY(!space)) { - block = NULL; + block = nullptr; } else { ulint bitmap_bits = 0; @@ -4233,64 +4194,67 @@ void ibuf_merge_or_delete_for_page(buf_block_t *block, const page_id_t page_id, ibuf_mtr_commit(&mtr); - if (bitmap_bits && fseg_page_is_free( - space, page_id.page_no())) { + if (bitmap_bits + && DB_SUCCESS + == fseg_page_is_allocated(space, page_id.page_no())) { ibuf_mtr_start(&mtr); mtr.set_named_space(space); ibuf_reset_bitmap(block, page_id, zip_size, &mtr); ibuf_mtr_commit(&mtr); bitmap_bits = 0; + if (!block + || btr_page_get_index_id(block->page.frame) + != DICT_IBUF_ID_MIN + IBUF_SPACE_ID) { + ibuf_delete_recs(page_id); + } } if (!bitmap_bits) { /* No changes are buffered for this page. */ space->release(); - return; + return DB_SUCCESS; } } - mem_heap_t* heap = mem_heap_create(512); - - const dtuple_t* search_tuple = ibuf_search_tuple_build( - page_id.space(), page_id.page_no(), heap); - - if (block != NULL) { + if (!block) { + } else if (!fil_page_index_page_check(block->page.frame) + || !page_is_leaf(block->page.frame)) { + space->set_corrupted(); + err = DB_CORRUPTION; + block = nullptr; + } else { /* Move the ownership of the x-latch on the page to this OS thread, so that we can acquire a second x-latch on it. This is needed for the insert operations to the index page to pass the debug checks. */ block->page.lock.claim_ownership(); + } - if (!fil_page_index_page_check(block->page.frame) - || !page_is_leaf(block->page.frame)) { + mem_heap_t* heap = mem_heap_create(512); - corruption_noticed = true; + const dtuple_t* search_tuple = ibuf_search_tuple_build( + page_id.space(), page_id.page_no(), heap); - ib::error() << "Corruption in the tablespace. Bitmap" - " shows insert buffer records to page " - << page_id << " though the page type is " - << fil_page_get_type(block->page.frame) - << ", which is not an index leaf page. We try" - " to resolve the problem by skipping the" - " insert buffer merge for this page. Please" - " run CHECK TABLE on your tables to determine" - " if they are corrupt after this."; - ut_ad(0); - } - } + /* Counts for merged & discarded operations. */ + ulint mops[IBUF_OP_COUNT]; + ulint dops[IBUF_OP_COUNT]; memset(mops, 0, sizeof(mops)); memset(dops, 0, sizeof(dops)); + pcur.btr_cur.page_cur.index = ibuf.index; loop: ibuf_mtr_start(&mtr); /* Position pcur in the insert buffer at the first entry for this index page */ - btr_pcur_open_on_user_rec( - ibuf.index, search_tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF, - &pcur, &mtr); + if (btr_pcur_open_on_user_rec(search_tuple, + BTR_MODIFY_LEAF, &pcur, &mtr) + != DB_SUCCESS) { + err = DB_CORRUPTION; + goto reset_bit; + } if (block) { block->page.fix(); @@ -4325,7 +4289,7 @@ void ibuf_merge_or_delete_for_page(buf_block_t *block, const page_id_t page_id, goto reset_bit; } - if (corruption_noticed) { + if (err) { fputs("InnoDB: Discarding record\n ", stderr); rec_print_old(stderr, rec); fputs("\nInnoDB: from the insert buffer!\n\n", stderr); @@ -4438,8 +4402,6 @@ void ibuf_merge_or_delete_for_page(buf_block_t *block, const page_id_t page_id, goto loop; } else if (btr_pcur_is_after_last_on_page(&pcur)) { ibuf_mtr_commit(&mtr); - btr_pcur_close(&pcur); - goto loop; } } @@ -4450,49 +4412,67 @@ void ibuf_merge_or_delete_for_page(buf_block_t *block, const page_id_t page_id, } ibuf_mtr_commit(&mtr); + ut_free(pcur.old_rec_buf); if (space) { space->release(); } - btr_pcur_close(&pcur); mem_heap_free(heap); ibuf.n_merges++; ibuf_add_ops(ibuf.n_merged_ops, mops); ibuf_add_ops(ibuf.n_discarded_ops, dops); + + return err; } /** Delete all change buffer entries for a tablespace, -in DISCARD TABLESPACE, IMPORT TABLESPACE, or crash recovery. +in DISCARD TABLESPACE, IMPORT TABLESPACE, or read-ahead. @param[in] space missing or to-be-discarded tablespace */ void ibuf_delete_for_discarded_space(uint32_t space) { - mem_heap_t* heap; + if (UNIV_UNLIKELY(!ibuf.index)) return; + btr_pcur_t pcur; - dtuple_t* search_tuple; const rec_t* ibuf_rec; mtr_t mtr; /* Counts for discarded operations. */ ulint dops[IBUF_OP_COUNT]; - heap = mem_heap_create(512); + dfield_t dfield[IBUF_REC_FIELD_METADATA]; + dtuple_t search_tuple {0,IBUF_REC_FIELD_METADATA, + IBUF_REC_FIELD_METADATA,dfield,0 + ,nullptr +#ifdef UNIV_DEBUG + ,DATA_TUPLE_MAGIC_N +#endif /* UNIV_DEBUG */ + }; + byte space_id[4]; + mach_write_to_4(space_id, space); + dfield_set_data(&dfield[0], space_id, 4); + dfield_set_data(&dfield[1], field_ref_zero, 1); + dfield_set_data(&dfield[2], field_ref_zero, 4); + dtuple_set_types_binary(&search_tuple, IBUF_REC_FIELD_METADATA); /* Use page number 0 to build the search tuple so that we get the cursor positioned at the first entry for this space id */ - search_tuple = ibuf_search_tuple_build(space, 0, heap); - memset(dops, 0, sizeof(dops)); + pcur.btr_cur.page_cur.index = ibuf.index; + loop: + log_free_check(); ibuf_mtr_start(&mtr); /* Position pcur in the insert buffer at the first entry for the space */ - btr_pcur_open_on_user_rec( - ibuf.index, search_tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF, - &pcur, &mtr); + if (btr_pcur_open_on_user_rec(&search_tuple, + BTR_MODIFY_LEAF, &pcur, &mtr) + != DB_SUCCESS) { + goto leave_loop; + } if (!btr_pcur_is_on_user_rec(&pcur)) { ut_ad(btr_pcur_is_after_last_on_page(&pcur)); @@ -4516,29 +4496,27 @@ void ibuf_delete_for_discarded_space(uint32_t space) /* Delete the record from ibuf */ if (ibuf_delete_rec(page_id_t(space, page_no), - &pcur, search_tuple, &mtr)) { + &pcur, &search_tuple, &mtr)) { /* Deletion was pessimistic and mtr was committed: we start from the beginning again */ ut_ad(mtr.has_committed()); +clear: + ut_free(pcur.old_rec_buf); goto loop; } if (btr_pcur_is_after_last_on_page(&pcur)) { ibuf_mtr_commit(&mtr); - btr_pcur_close(&pcur); - - goto loop; + goto clear; } } leave_loop: ibuf_mtr_commit(&mtr); - btr_pcur_close(&pcur); + ut_free(pcur.old_rec_buf); ibuf_add_ops(ibuf.n_discarded_ops, dops); - - mem_heap_free(heap); } /******************************************************************//** @@ -4554,8 +4532,8 @@ ibuf_is_empty(void) ut_d(mysql_mutex_lock(&ibuf_mutex)); const buf_block_t* root = ibuf_tree_root_get(&mtr); - bool is_empty = page_is_empty(root->page.frame); - ut_a(is_empty == ibuf.empty); + bool is_empty = root && page_is_empty(root->page.frame); + ut_ad(!root || is_empty == ibuf.empty); ut_d(mysql_mutex_unlock(&ibuf_mutex)); ibuf_mtr_commit(&mtr); @@ -4569,12 +4547,13 @@ ibuf_print( /*=======*/ FILE* file) /*!< in: file where to print */ { + if (UNIV_UNLIKELY(!ibuf.index)) return; mysql_mutex_lock(&ibuf_mutex); fprintf(file, "Ibuf: size " ULINTPF ", free list len " ULINTPF "," " seg size " ULINTPF ", " ULINTPF " merges\n", - ibuf.size, + ulint{ibuf.size}, ibuf.free_list_len, ibuf.seg_size, ulint{ibuf.n_merges}); @@ -4608,8 +4587,6 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) mtr_t mtr; - mysql_mutex_lock(&ibuf_mutex); - /* The two bitmap pages (allocation bitmap and ibuf bitmap) repeat every page_size pages. For example if page_size is 16 KiB, then the two bitmap pages repeat every 16 KiB * 16384 = 256 MiB. In the loop @@ -4618,20 +4595,14 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) for (uint32_t page_no = 0; page_no < size; page_no += physical_size) { if (trx_is_interrupted(trx)) { - mysql_mutex_unlock(&ibuf_mutex); return(DB_INTERRUPTED); } mtr_start(&mtr); - mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO); - - ibuf_enter(&mtr); - buf_block_t* bitmap_page = ibuf_bitmap_get_map_page( page_id_t(space->id, page_no), zip_size, &mtr); if (!bitmap_page) { - mysql_mutex_unlock(&ibuf_mutex); mtr.commit(); return DB_CORRUPTION; } @@ -4648,13 +4619,12 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) buf_block_t* block = buf_page_get( page_id_t(space->id, curr_page), zip_size, RW_S_LATCH, &mtr); - page_t* page = buf_block_get_frame(block); + page_t* page = buf_block_get_frame(block); ut_ad(buf_is_zeroes(span( page, physical_size))); } #endif /* UNIV_DEBUG */ - ibuf_exit(&mtr); mtr_commit(&mtr); continue; } @@ -4669,8 +4639,6 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) cur_page_id, zip_size, IBUF_BITMAP_IBUF, &mtr)) { - mysql_mutex_unlock(&ibuf_mutex); - ibuf_exit(&mtr); mtr_commit(&mtr); ib_errf(trx->mysql_thd, @@ -4704,45 +4672,29 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) } } - ibuf_exit(&mtr); mtr_commit(&mtr); } - mysql_mutex_unlock(&ibuf_mutex); return(DB_SUCCESS); } -/** Updates free bits and buffered bits for bulk loaded page. -@param[in] block index page -@param[in] reset flag if reset free val */ -void -ibuf_set_bitmap_for_bulk_load( - buf_block_t* block, - bool reset) +void ibuf_set_bitmap_for_bulk_load(buf_block_t *block, mtr_t *mtr, bool reset) { - mtr_t mtr; - ulint free_val; - - ut_a(page_is_leaf(buf_block_get_frame(block))); - - free_val = ibuf_index_page_calc_free(block); - - mtr.start(); - fil_space_t* space = mtr.set_named_space_id(block->page.id().space()); - - buf_block_t* bitmap_page = ibuf_bitmap_get_map_page(block->page.id(), - space->zip_size(), - &mtr); - - free_val = reset ? 0 : ibuf_index_page_calc_free(block); - /* FIXME: update the bitmap byte only once! */ - ibuf_bitmap_page_set_bits( - bitmap_page, block->page.id(), block->physical_size(), - free_val, &mtr); - - ibuf_bitmap_page_set_bits( - bitmap_page, block->page.id(), block->physical_size(), - false, &mtr); - - mtr.commit(); + ut_a(page_is_leaf(block->page.frame)); + const page_id_t id{block->page.id()}; + const auto zip_size= block->zip_size(); + + if (buf_block_t *bitmap_page= ibuf_bitmap_get_map_page(id, zip_size, mtr)) + { + if (ibuf_bitmap_page_get_bits(bitmap_page->page.frame, id, zip_size, + IBUF_BITMAP_BUFFERED, mtr)) + ibuf_delete_recs(id); + + ulint free_val= reset ? 0 : ibuf_index_page_calc_free(block); + /* FIXME: update the bitmap byte only once! */ + ibuf_bitmap_page_set_bits + (bitmap_page, id, block->physical_size(), free_val, mtr); + ibuf_bitmap_page_set_bits + (bitmap_page, id, block->physical_size(), false, mtr); + } } diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index 95e148bee54b3..a56598d3620cd 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -2,7 +2,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, 2021, MariaDB Corporation. +Copyright (c) 2014, 2023, 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 @@ -25,8 +25,7 @@ The B-tree Created 6/2/1994 Heikki Tuuri *******************************************************/ -#ifndef btr0btr_h -#define btr0btr_h +#pragma once #include "dict0dict.h" #include "data0data.h" @@ -56,136 +55,20 @@ not acceptable for it to lead to mysterious memory corruption, but it is acceptable for the program to die with a clear assert failure. */ #define BTR_MAX_LEVELS 100 -/** Latching modes for btr_cur_search_to_nth_level(). */ -enum btr_latch_mode { - /** Search a record on a leaf page and S-latch it. */ - BTR_SEARCH_LEAF = RW_S_LATCH, - /** (Prepare to) modify a record on a leaf page and X-latch it. */ - BTR_MODIFY_LEAF = RW_X_LATCH, - /** Obtain no latches. */ - BTR_NO_LATCHES = RW_NO_LATCH, - /** Start modifying the entire B-tree. */ - BTR_MODIFY_TREE = 33, - /** Continue modifying the entire B-tree. */ - BTR_CONT_MODIFY_TREE = 34, - /** Search the previous record. */ - BTR_SEARCH_PREV = 35, - /** Modify the previous record. */ - BTR_MODIFY_PREV = 36, - /** Start searching the entire B-tree. */ - BTR_SEARCH_TREE = 37, - /** Continue searching the entire B-tree. */ - BTR_CONT_SEARCH_TREE = 38, - - /* BTR_INSERT, BTR_DELETE and BTR_DELETE_MARK are mutually - exclusive. */ - /** The search tuple will be inserted to the secondary index - at the searched position. When the leaf page is not in the - buffer pool, try to use the change buffer. */ - BTR_INSERT = 512, - - /** Try to delete mark a secondary index leaf page record at - the searched position using the change buffer when the page is - not in the buffer pool. */ - BTR_DELETE_MARK = 4096, - - /** Try to purge the record using the change buffer when the - secondary index leaf page is not in the buffer pool. */ - BTR_DELETE = 8192, - - /** The caller is already holding dict_index_t::lock S-latch. */ - BTR_ALREADY_S_LATCHED = 16384, - /** Search and S-latch a leaf page, assuming that the - dict_index_t::lock S-latch is being held. */ - BTR_SEARCH_LEAF_ALREADY_S_LATCHED = BTR_SEARCH_LEAF - | BTR_ALREADY_S_LATCHED, - /** Search the entire index tree, assuming that the - dict_index_t::lock S-latch is being held. */ - BTR_SEARCH_TREE_ALREADY_S_LATCHED = BTR_SEARCH_TREE - | BTR_ALREADY_S_LATCHED, - /** Search and X-latch a leaf page, assuming that the - dict_index_t::lock S-latch is being held. */ - BTR_MODIFY_LEAF_ALREADY_S_LATCHED = BTR_MODIFY_LEAF - | BTR_ALREADY_S_LATCHED, - - /** Attempt to delete-mark a secondary index record. */ - BTR_DELETE_MARK_LEAF = BTR_MODIFY_LEAF | BTR_DELETE_MARK, - /** Attempt to delete-mark a secondary index record - while holding the dict_index_t::lock S-latch. */ - BTR_DELETE_MARK_LEAF_ALREADY_S_LATCHED = BTR_DELETE_MARK_LEAF - | BTR_ALREADY_S_LATCHED, - /** Attempt to purge a secondary index record. */ - BTR_PURGE_LEAF = BTR_MODIFY_LEAF | BTR_DELETE, - /** Attempt to purge a secondary index record - while holding the dict_index_t::lock S-latch. */ - BTR_PURGE_LEAF_ALREADY_S_LATCHED = BTR_PURGE_LEAF - | BTR_ALREADY_S_LATCHED, - - /** In the case of BTR_MODIFY_TREE, the caller specifies - the intention to delete record only. It is used to optimize - block->lock range.*/ - BTR_LATCH_FOR_DELETE = 65536, - - /** Attempt to purge a secondary index record in the tree. */ - BTR_PURGE_TREE = BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE -}; - -/** This flag ORed to btr_latch_mode says that we do the search in query -optimization */ -#define BTR_ESTIMATE 1024U - -/** This flag ORed to BTR_INSERT says that we can ignore possible -UNIQUE definition on secondary indexes when we decide if we can use -the insert buffer to speed up inserts */ -#define BTR_IGNORE_SEC_UNIQUE 2048U - -/** In the case of BTR_MODIFY_TREE, the caller specifies the intention -to insert record only. It is used to optimize block->lock range.*/ -#define BTR_LATCH_FOR_INSERT 32768U - -/** This flag is for undo insert of rtree. For rtree, we need this flag -to find proper rec to undo insert.*/ -#define BTR_RTREE_UNDO_INS 131072U - -/** In the case of BTR_MODIFY_LEAF, the caller intends to allocate or -free the pages of externally stored fields. */ -#define BTR_MODIFY_EXTERNAL 262144U - -/** Try to delete mark the record at the searched position when the -record is in spatial index */ -#define BTR_RTREE_DELETE_MARK 524288U - #define BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode) \ - ((latch_mode) & ulint(~(BTR_INSERT \ + btr_latch_mode((latch_mode) & ~(BTR_INSERT \ | BTR_DELETE_MARK \ | BTR_RTREE_UNDO_INS \ | BTR_RTREE_DELETE_MARK \ | BTR_DELETE \ - | BTR_ESTIMATE \ | BTR_IGNORE_SEC_UNIQUE \ | BTR_ALREADY_S_LATCHED \ | BTR_LATCH_FOR_INSERT \ - | BTR_LATCH_FOR_DELETE \ - | BTR_MODIFY_EXTERNAL))) - -#define BTR_LATCH_MODE_WITHOUT_INTENTION(latch_mode) \ - ((latch_mode) & ulint(~(BTR_LATCH_FOR_INSERT \ - | BTR_LATCH_FOR_DELETE \ - | BTR_MODIFY_EXTERNAL))) - -/** Report that an index page is corrupted. -@param[in] buffer block -@param[in] index tree */ -ATTRIBUTE_COLD ATTRIBUTE_NORETURN __attribute__((nonnull)) -void btr_corruption_report(const buf_block_t* block,const dict_index_t* index); - -/** Assert that a B-tree page is not corrupted. -@param block buffer block containing a B-tree page -@param index the B-tree index */ -#define btr_assert_not_corrupted(block, index) \ - if (!!page_is_comp(buf_block_get_frame(block)) \ - != index->table->not_redundant()) \ - btr_corruption_report(block, index) + | BTR_LATCH_FOR_DELETE)) + +#define BTR_LATCH_MODE_WITHOUT_INTENTION(latch_mode) \ + btr_latch_mode((latch_mode) \ + & ~(BTR_LATCH_FOR_INSERT | BTR_LATCH_FOR_DELETE)) /**************************************************************//** Checks and adjusts the root node of a tree during IMPORT TABLESPACE. @@ -196,37 +79,20 @@ btr_root_adjust_on_import( const dict_index_t* index) /*!< in: index tree */ MY_ATTRIBUTE((warn_unused_result)); +/** Report a decryption failure. */ +ATTRIBUTE_COLD void btr_decryption_failed(const dict_index_t &index); + /** Get an index page and declare its latching order level. @param[in] index index tree @param[in] page page number @param[in] mode latch mode @param[in] merge whether change buffer merge should be attempted @param[in,out] mtr mini-transaction +@param[out] err error code @return block */ -inline buf_block_t *btr_block_get(const dict_index_t &index, - uint32_t page, ulint mode, bool merge, - mtr_t *mtr) -{ - dberr_t err; - - if (buf_block_t* block = buf_page_get_gen( - page_id_t(index.table->space->id, page), - index.table->space->zip_size(), mode, NULL, BUF_GET, - mtr, &err, merge && !index.is_clust())) { - ut_ad(err == DB_SUCCESS); - return block; - } else { - ut_ad(err != DB_SUCCESS); - - if (err == DB_DECRYPTION_FAILED) { - if (index.table) { - index.table->file_unreadable = true; - } - } - - return NULL; - } -} +buf_block_t *btr_block_get(const dict_index_t &index, + uint32_t page, ulint mode, bool merge, + mtr_t *mtr, dberr_t *err= nullptr); /**************************************************************//** Gets the index id field of a page. @@ -265,17 +131,6 @@ inline uint32_t btr_page_get_prev(const page_t* page) return mach_read_from_4(my_assume_aligned<4>(page + FIL_PAGE_PREV)); } -/**************************************************************//** -Releases the latch on a leaf page and bufferunfixes it. */ -UNIV_INLINE -void -btr_leaf_page_release( -/*==================*/ - buf_block_t* block, /*!< in: buffer block */ - ulint latch_mode, /*!< in: BTR_SEARCH_LEAF or - BTR_MODIFY_LEAF */ - mtr_t* mtr) /*!< in: mtr */ - MY_ATTRIBUTE((nonnull)); /**************************************************************//** Gets the child node file address in a node pointer. NOTE: the offsets array must contain all offsets for the record since @@ -297,6 +152,7 @@ btr_node_ptr_get_child_page_no( @param[in] index_id index id @param[in] index index, or NULL to create a system table @param[in,out] mtr mini-transaction +@param[out] err error code @return page number of the created root @retval FIL_NULL if did not succeed */ uint32_t @@ -305,7 +161,9 @@ btr_create( fil_space_t* space, index_id_t index_id, dict_index_t* index, - mtr_t* mtr); + mtr_t* mtr, + dberr_t* err) + MY_ATTRIBUTE((nonnull(2,5,6), warn_unused_result)); /** Free a persistent index tree if it exists. @param[in,out] space tablespce @@ -353,11 +211,11 @@ btr_write_autoinc(dict_index_t* index, ib_uint64_t autoinc, bool reset = false) @param[in,out] mtr mini-transaction */ void btr_set_instant(buf_block_t* root, const dict_index_t& index, mtr_t* mtr); +ATTRIBUTE_COLD __attribute__((nonnull)) /** Reset the table to the canonical format on ROLLBACK of instant ALTER TABLE. @param[in] index clustered index with instant ALTER TABLE @param[in] all whether to reset FIL_PAGE_TYPE as well @param[in,out] mtr mini-transaction */ -ATTRIBUTE_COLD __attribute__((nonnull)) void btr_reset_instant(const dict_index_t &index, bool all, mtr_t *mtr); /*************************************************************//** @@ -380,8 +238,9 @@ btr_root_raise_and_insert( that can be emptied, or NULL */ const dtuple_t* tuple, /*!< in: tuple to insert */ ulint n_ext, /*!< in: number of externally stored columns */ - mtr_t* mtr) /*!< in: mtr */ - MY_ATTRIBUTE((warn_unused_result)); + mtr_t* mtr, /*!< in: mtr */ + dberr_t* err) /*!< out: error code */ + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*************************************************************//** Reorganizes an index page. @@ -391,15 +250,12 @@ be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit(). On uncompressed pages, IBUF_BITMAP_FREE is unaffected by reorganization. -@retval true if the operation was successful -@retval false if it is a compressed page, and recompression failed */ -bool -btr_page_reorganize( -/*================*/ - page_cur_t* cursor, /*!< in/out: page cursor */ - dict_index_t* index, /*!< in: the index tree of the page */ - mtr_t* mtr) /*!< in/out: mini-transaction */ - MY_ATTRIBUTE((nonnull)); +@param cursor page cursor +@param mtr mini-transaction +@return error code +@retval DB_FAIL if reorganizing a ROW_FORMAT=COMPRESSED page failed */ +dberr_t btr_page_reorganize(page_cur_t *cursor, mtr_t *mtr) + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Decide if the page should be split at the convergence point of inserts converging to the left. @param[in] cursor insert position @@ -438,18 +294,20 @@ btr_page_split_and_insert( that can be emptied, or NULL */ const dtuple_t* tuple, /*!< in: tuple to insert */ ulint n_ext, /*!< in: number of externally stored columns */ - mtr_t* mtr) /*!< in: mtr */ - MY_ATTRIBUTE((warn_unused_result)); + mtr_t* mtr, /*!< in: mtr */ + dberr_t* err) /*!< out: error code */ + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************//** Inserts a data tuple to a tree on a non-leaf level. It is assumed that mtr holds an x-latch on the tree. */ -void +dberr_t btr_insert_on_non_leaf_level( ulint flags, /*!< in: undo logging and locking flags */ dict_index_t* index, /*!< in: index */ ulint level, /*!< in: level, must be > 0 */ dtuple_t* tuple, /*!< in: the record to be inserted */ - mtr_t* mtr); /*!< in: mtr */ + mtr_t* mtr) /*!< in: mtr */ + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Set a child page pointer record as the predefined minimum record. @tparam has_prev whether the page is supposed to have a left sibling @@ -475,13 +333,11 @@ inline void btr_set_min_rec_mark(rec_t *rec, const buf_block_t &block, } /** Seek to the parent page of a B-tree page. -@param[in,out] index b-tree -@param[in] block child page @param[in,out] mtr mini-transaction -@param[out] cursor cursor pointing to the x-latched parent page */ -void btr_page_get_father(dict_index_t* index, buf_block_t* block, mtr_t* mtr, - btr_cur_t* cursor) - MY_ATTRIBUTE((nonnull)); +@param[in,out] cursor cursor pointing to the x-latched parent page +@return whether the cursor was successfully positioned */ +bool btr_page_get_father(mtr_t* mtr, btr_cur_t* cursor) + MY_ATTRIBUTE((nonnull,warn_unused_result)); #ifdef UNIV_DEBUG /************************************************************//** Checks that the node pointer to a page is appropriate. @@ -503,23 +359,24 @@ level lifts the records of the page to the father page, thus reducing the tree height. It is assumed that mtr holds an x-latch on the tree and on the page. If cursor is on the leaf level, mtr must also hold x-latches to the brothers, if they exist. -@return TRUE on success */ -ibool +@return error code +@retval DB_FAIL if the tree could not be merged */ +dberr_t btr_compress( /*=========*/ btr_cur_t* cursor, /*!< in/out: cursor on the page to merge or lift; the page must not be empty: when deleting records, use btr_discard_page() if the page would become empty */ - ibool adjust, /*!< in: TRUE if should adjust the - cursor position even if compression occurs */ + bool adjust, /*!< in: whether the cursor position should be + adjusted even when compression occurs */ mtr_t* mtr) /*!< in/out: mini-transaction */ - MY_ATTRIBUTE((nonnull)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*************************************************************//** Discards a page from a B-tree. This is used to remove the last record from a B-tree page: the whole page must be removed at the same time. This cannot be used for the root page, which is allowed to be empty. */ -void +dberr_t btr_discard_page( /*=============*/ btr_cur_t* cursor, /*!< in: cursor on the page to discard: not on @@ -541,9 +398,10 @@ btr_page_alloc( in the tree */ mtr_t* mtr, /*!< in/out: mini-transaction for the allocation */ - mtr_t* init_mtr) /*!< in/out: mini-transaction + mtr_t* init_mtr, /*!< in/out: mini-transaction for x-latching and initializing the page */ + dberr_t* err) /*!< out: error code */ MY_ATTRIBUTE((warn_unused_result)); /** Empty an index page (possibly the root page). @see btr_page_create(). @param[in,out] block page to be emptied @@ -578,8 +436,8 @@ btr_page_create( @param[in] blob whether this is freeing a BLOB page @param[in] latched whether index->table->space->x_lock() was called */ MY_ATTRIBUTE((nonnull)) -void btr_page_free(dict_index_t* index, buf_block_t* block, mtr_t* mtr, - bool blob = false, bool space_latched = false); +dberr_t btr_page_free(dict_index_t *index, buf_block_t *block, mtr_t *mtr, + bool blob= false, bool space_latched= false); /**************************************************************//** Gets the root node of a tree and x- or s-latches it. @@ -587,10 +445,11 @@ Gets the root node of a tree and x- or s-latches it. buf_block_t* btr_root_block_get( /*===============*/ - const dict_index_t* index, /*!< in: index tree */ + dict_index_t* index, /*!< in: index tree */ rw_lock_type_t mode, /*!< in: either RW_S_LATCH or RW_X_LATCH */ - mtr_t* mtr); /*!< in: mtr */ + mtr_t* mtr, /*!< in: mtr */ + dberr_t* err); /*!< out: error code */ /*************************************************************//** Reorganizes an index page. @@ -600,15 +459,15 @@ be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit(). On uncompressed pages, IBUF_BITMAP_FREE is unaffected by reorganization. -@retval true if the operation was successful -@retval false if it is a compressed page, and recompression failed */ -bool btr_page_reorganize_block( +@return error code +@retval DB_FAIL if reorganizing a ROW_FORMAT=COMPRESSED page failed */ +dberr_t btr_page_reorganize_block( ulint z_level,/*!< in: compression level to be used if dealing with compressed page */ buf_block_t* block, /*!< in/out: B-tree page */ dict_index_t* index, /*!< in: the index tree of the page */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull)); + __attribute__((nonnull, warn_unused_result)); #ifdef UNIV_BTR_PRINT /*************************************************************//** @@ -670,17 +529,15 @@ btr_lift_page_up( must not be empty: use btr_discard_only_page_on_level if the last record from the page should be removed */ - mtr_t* mtr) /*!< in: mtr */ + mtr_t* mtr, /*!< in/out: mini-transaction */ + dberr_t* err) /*!< out: error code */ __attribute__((nonnull)); #define BTR_N_LEAF_PAGES 1 #define BTR_TOTAL_SIZE 2 -#include "btr0btr.ic" +#include "btr0btr.inl" /**************************************************************** Global variable controlling if scrubbing should be performed */ extern my_bool srv_immediate_scrub_data_uncompressed; -extern Atomic_counter btr_validate_index_running; - -#endif diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic deleted file mode 100644 index f92622cc40011..0000000000000 --- a/storage/innobase/include/btr0btr.ic +++ /dev/null @@ -1,149 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2021, 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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/btr0btr.ic -The B-tree - -Created 6/2/1994 Heikki Tuuri -*******************************************************/ - -#include "mach0data.h" -#include "mtr0mtr.h" -#include "mtr0log.h" -#include "page0zip.h" - -/**************************************************************//** -Gets the index id field of a page. -@return index id */ -UNIV_INLINE -index_id_t -btr_page_get_index_id( -/*==================*/ - const page_t* page) /*!< in: index page */ -{ - return(mach_read_from_8(page + PAGE_HEADER + PAGE_INDEX_ID)); -} - -/** Set PAGE_LEVEL. -@param[in,out] block buffer block -@param[in] level page level -@param[in,out] mtr mini-transaction */ -inline -void btr_page_set_level(buf_block_t *block, ulint level, mtr_t *mtr) -{ - ut_ad(level <= BTR_MAX_NODE_LEVEL); - constexpr uint16_t field= PAGE_HEADER + PAGE_LEVEL; - byte *b= my_assume_aligned<2>(&block->page.frame[field]); - if (mtr->write<2,mtr_t::MAYBE_NOP>(*block, b, level) && - UNIV_LIKELY_NULL(block->page.zip.data)) - memcpy_aligned<2>(&block->page.zip.data[field], b, 2); -} - -/** Set FIL_PAGE_NEXT. -@param[in,out] block buffer block -@param[in] next number of successor page -@param[in,out] mtr mini-transaction */ -inline void btr_page_set_next(buf_block_t *block, ulint next, mtr_t *mtr) -{ - constexpr uint16_t field= FIL_PAGE_NEXT; - byte *b= my_assume_aligned<4>(&block->page.frame[field]); - if (mtr->write<4,mtr_t::MAYBE_NOP>(*block, b, next) && - UNIV_LIKELY_NULL(block->page.zip.data)) - memcpy_aligned<4>(&block->page.zip.data[field], b, 4); -} - -/** Set FIL_PAGE_PREV. -@param[in,out] block buffer block -@param[in] prev number of predecessor page -@param[in,out] mtr mini-transaction */ -inline void btr_page_set_prev(buf_block_t *block, ulint prev, mtr_t *mtr) -{ - constexpr uint16_t field= FIL_PAGE_PREV; - byte *b= my_assume_aligned<4>(&block->page.frame[field]); - if (mtr->write<4,mtr_t::MAYBE_NOP>(*block, b, prev) && - UNIV_LIKELY_NULL(block->page.zip.data)) - memcpy_aligned<4>(&block->page.zip.data[field], b, 4); -} - -/**************************************************************//** -Gets the child node file address in a node pointer. -NOTE: the offsets array must contain all offsets for the record since -we read the last field according to offsets and assume that it contains -the child page number. In other words offsets must have been retrieved -with rec_get_offsets(n_fields=ULINT_UNDEFINED). -@return child node address */ -UNIV_INLINE -uint32_t -btr_node_ptr_get_child_page_no( -/*===========================*/ - const rec_t* rec, /*!< in: node pointer record */ - const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ -{ - const byte* field; - ulint len; - - ut_ad(!rec_offs_comp(offsets) || rec_get_node_ptr_flag(rec)); - - /* The child address is in the last field */ - field = rec_get_nth_field(rec, offsets, - rec_offs_n_fields(offsets) - 1, &len); - - ut_ad(len == 4); - - uint32_t page_no = mach_read_from_4(field); - ut_ad(page_no > 1); - - return(page_no); -} - -/**************************************************************//** -Releases the latches on a leaf page and bufferunfixes it. */ -UNIV_INLINE -void -btr_leaf_page_release( -/*==================*/ - buf_block_t* block, /*!< in: buffer block */ - ulint latch_mode, /*!< in: BTR_SEARCH_LEAF or - BTR_MODIFY_LEAF */ - mtr_t* mtr) /*!< in: mtr */ -{ - ut_ad(latch_mode == BTR_SEARCH_LEAF - || latch_mode == BTR_MODIFY_LEAF - || latch_mode == BTR_NO_LATCHES); - - ut_ad(!mtr->memo_contains_flagged(block, MTR_MEMO_MODIFY)); - - mtr_memo_type_t mode; - switch (latch_mode) { - case BTR_SEARCH_LEAF: - mode = MTR_MEMO_PAGE_S_FIX; - break; - case BTR_MODIFY_LEAF: - mode = MTR_MEMO_PAGE_X_FIX; - break; - case BTR_NO_LATCHES: - mode = MTR_MEMO_BUF_FIX; - break; - default: - ut_a(0); - } - - mtr->memo_release(block, mode); -} diff --git a/storage/innobase/include/btr0btr.inl b/storage/innobase/include/btr0btr.inl new file mode 100644 index 0000000000000..9a9e39b6b4c84 --- /dev/null +++ b/storage/innobase/include/btr0btr.inl @@ -0,0 +1,111 @@ +/***************************************************************************** + +Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2015, 2022, 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 02110-1335 USA + +*****************************************************************************/ + +/**************************************************//** +@file include/btr0btr.ic +The B-tree + +Created 6/2/1994 Heikki Tuuri +*******************************************************/ + +#include "mtr0log.h" + +/**************************************************************//** +Gets the index id field of a page. +@return index id */ +UNIV_INLINE +index_id_t +btr_page_get_index_id( +/*==================*/ + const page_t* page) /*!< in: index page */ +{ + return(mach_read_from_8(page + PAGE_HEADER + PAGE_INDEX_ID)); +} + +/** Set PAGE_LEVEL. +@param[in,out] block buffer block +@param[in] level page level +@param[in,out] mtr mini-transaction */ +inline +void btr_page_set_level(buf_block_t *block, ulint level, mtr_t *mtr) +{ + ut_ad(level <= BTR_MAX_NODE_LEVEL); + constexpr uint16_t field= PAGE_HEADER + PAGE_LEVEL; + byte *b= my_assume_aligned<2>(&block->page.frame[field]); + if (mtr->write<2,mtr_t::MAYBE_NOP>(*block, b, level) && + UNIV_LIKELY_NULL(block->page.zip.data)) + memcpy_aligned<2>(&block->page.zip.data[field], b, 2); +} + +/** Set FIL_PAGE_NEXT. +@param[in,out] block buffer block +@param[in] next number of successor page +@param[in,out] mtr mini-transaction */ +inline void btr_page_set_next(buf_block_t *block, ulint next, mtr_t *mtr) +{ + constexpr uint16_t field= FIL_PAGE_NEXT; + byte *b= my_assume_aligned<4>(&block->page.frame[field]); + if (mtr->write<4,mtr_t::MAYBE_NOP>(*block, b, next) && + UNIV_LIKELY_NULL(block->page.zip.data)) + memcpy_aligned<4>(&block->page.zip.data[field], b, 4); +} + +/** Set FIL_PAGE_PREV. +@param[in,out] block buffer block +@param[in] prev number of predecessor page +@param[in,out] mtr mini-transaction */ +inline void btr_page_set_prev(buf_block_t *block, ulint prev, mtr_t *mtr) +{ + constexpr uint16_t field= FIL_PAGE_PREV; + byte *b= my_assume_aligned<4>(&block->page.frame[field]); + if (mtr->write<4,mtr_t::MAYBE_NOP>(*block, b, prev) && + UNIV_LIKELY_NULL(block->page.zip.data)) + memcpy_aligned<4>(&block->page.zip.data[field], b, 4); +} + +/**************************************************************//** +Gets the child node file address in a node pointer. +NOTE: the offsets array must contain all offsets for the record since +we read the last field according to offsets and assume that it contains +the child page number. In other words offsets must have been retrieved +with rec_get_offsets(n_fields=ULINT_UNDEFINED). +@return child node address */ +UNIV_INLINE +uint32_t +btr_node_ptr_get_child_page_no( +/*===========================*/ + const rec_t* rec, /*!< in: node pointer record */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ +{ + const byte* field; + ulint len; + + ut_ad(!rec_offs_comp(offsets) || rec_get_node_ptr_flag(rec)); + + /* The child address is in the last field */ + field = rec_get_nth_field(rec, offsets, + rec_offs_n_fields(offsets) - 1, &len); + + ut_ad(len == 4); + + uint32_t page_no = mach_read_from_4(field); + ut_ad(page_no > 1); + + return(page_no); +} diff --git a/storage/innobase/include/btr0bulk.h b/storage/innobase/include/btr0bulk.h index 943836f8759b9..9fcea86d95dee 100644 --- a/storage/innobase/include/btr0bulk.h +++ b/storage/innobase/include/btr0bulk.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2014, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2019, 2020, MariaDB Corporation. +Copyright (c) 2019, 2022, 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 @@ -170,7 +170,7 @@ class PageBulk inline void release(); /** Start mtr and latch block */ - inline dberr_t latch(); + inline void latch(); /** Check if required space is available in the page for the rec to be inserted. We check fill factor & padding here. diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 778b8cd04e8d9..f6abc9f5e5265 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2023, 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 @@ -63,13 +63,6 @@ enum { BTR_KEEP_IBUF_BITMAP = 32 }; -/* btr_cur_latch_leaves() returns latched blocks and savepoints. */ -struct btr_latch_leaves_t { - /* left block, target block and right block */ - buf_block_t* blocks[3]; - ulint savepoints[3]; -}; - #include "que0types.h" #include "row0types.h" @@ -97,7 +90,7 @@ btr_cur_get_page( Returns the index of a cursor. @param cursor b-tree cursor @return index */ -#define btr_cur_get_index(cursor) ((cursor)->index) +#define btr_cur_get_index(cursor) ((cursor)->index()) /*********************************************************//** Positions a tree cursor at a given record. */ UNIV_INLINE @@ -127,101 +120,36 @@ bool btr_cur_instant_root_init(dict_index_t* index, const page_t* page) ATTRIBUTE_COLD __attribute__((nonnull, warn_unused_result)); -/** Optimistically latches the leaf page or pages requested. -@param[in] block guessed buffer block -@param[in] modify_clock modify clock value -@param[in,out] latch_mode BTR_SEARCH_LEAF, ... -@param[in,out] cursor cursor -@param[in] mtr mini-transaction -@return true if success */ -bool -btr_cur_optimistic_latch_leaves( - buf_block_t* block, - ib_uint64_t modify_clock, - ulint* latch_mode, - btr_cur_t* cursor, - mtr_t* mtr); - +MY_ATTRIBUTE((warn_unused_result)) /********************************************************************//** -Searches an index tree and positions a tree cursor on a given level. +Searches an index tree and positions a tree cursor on a given non-leaf level. NOTE: n_fields_cmp in tuple must be set so that it cannot be compared to node pointer page number fields on the upper levels of the tree! -Note that if mode is PAGE_CUR_LE, which is used in inserts, then cursor->up_match and cursor->low_match both will have sensible values. -If mode is PAGE_CUR_GE, then up_match will a have a sensible value. */ -dberr_t -btr_cur_search_to_nth_level_func( - dict_index_t* index, /*!< in: index */ - ulint level, /*!< in: the tree level of search */ - const dtuple_t* tuple, /*!< in: data tuple; NOTE: n_fields_cmp in - tuple must be set so that it cannot get - compared to the node ptr page number field! */ - page_cur_mode_t mode, /*!< in: PAGE_CUR_L, ...; - NOTE that if the search is made using a unique - prefix of a record, mode should be PAGE_CUR_LE, - not PAGE_CUR_GE, as the latter may end up on - the previous page of the record! Inserts - should always be made using PAGE_CUR_LE to - search the position! */ - ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ..., ORed with - at most one of BTR_INSERT, BTR_DELETE_MARK, - BTR_DELETE, or BTR_ESTIMATE; - cursor->left_block is used to store a pointer - to the left neighbor page, in the cases - BTR_SEARCH_PREV and BTR_MODIFY_PREV; - NOTE that if ahi_latch, we might not have a - cursor page latch, we assume that ahi_latch - protects the record! */ - btr_cur_t* cursor, /*!< in/out: tree cursor; the cursor page is - s- or x-latched, but see also above! */ -#ifdef BTR_CUR_HASH_ADAPT - srw_spin_lock* ahi_latch, - /*!< in: currently held AHI rdlock, or NULL */ -#endif /* BTR_CUR_HASH_ADAPT */ - mtr_t* mtr, /*!< in/out: mini-transaction */ - ib_uint64_t autoinc = 0); - /*!< in: PAGE_ROOT_AUTO_INC to be written - (0 if none) */ -#ifdef BTR_CUR_HASH_ADAPT -# define btr_cur_search_to_nth_level(i,l,t,m,lm,c,a,mtr) \ - btr_cur_search_to_nth_level_func(i,l,t,m,lm,c,a,mtr) -#else /* BTR_CUR_HASH_ADAPT */ -# define btr_cur_search_to_nth_level(i,l,t,m,lm,c,a,mtr) \ - btr_cur_search_to_nth_level_func(i,l,t,m,lm,c,mtr) -#endif /* BTR_CUR_HASH_ADAPT */ - -/*****************************************************************//** -Opens a cursor at either end of an index. -@return DB_SUCCESS or error code */ -dberr_t -btr_cur_open_at_index_side( - bool from_left, /*!< in: true if open to the low end, - false if to the high end */ - dict_index_t* index, /*!< in: index */ - ulint latch_mode, /*!< in: latch mode */ - btr_cur_t* cursor, /*!< in/out: cursor */ - ulint level, /*!< in: level to search for - (0=leaf) */ - mtr_t* mtr) /*!< in/out: mini-transaction */ - MY_ATTRIBUTE((nonnull)); +Cursor is left at the place where an insert of the +search tuple should be performed in the B-tree. InnoDB does an insert +immediately after the cursor. Thus, the cursor may end up on a user record, +or on a page infimum record. +@param level the tree level of search +@param tuple data tuple; NOTE: n_fields_cmp in tuple must be set so that + it cannot get compared to the node ptr page number field! +@param latch RW_S_LATCH or RW_X_LATCH +@param cursor tree cursor; the cursor page is s- or x-latched, but see also + above! +@param mtr mini-transaction +@return DB_SUCCESS on success or error code otherwise */ +dberr_t btr_cur_search_to_nth_level(ulint level, + const dtuple_t *tuple, + rw_lock_type_t rw_latch, + btr_cur_t *cursor, mtr_t *mtr); -/**********************************************************************//** -Positions a cursor at a randomly chosen position within a B-tree. -@return true if the index is available and we have put the cursor, false -if the index is unavailable */ -bool -btr_cur_open_at_rnd_pos( - dict_index_t* index, /*!< in: index */ - ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ - btr_cur_t* cursor, /*!< in/out: B-tree cursor */ - mtr_t* mtr); /*!< in: mtr */ /*************************************************************//** Tries to perform an insert to a page in an index tree, next to cursor. It is assumed that mtr holds an x-latch on the page. The operation does not succeed if there is too little space on the page. If there is just one record on the page, the insert will always succeed; this is to prevent trying to split a page with just one record. -@return DB_SUCCESS, DB_WAIT_LOCK, DB_FAIL, or error number */ +@return DB_SUCCESS, DB_LOCK_WAIT, DB_FAIL, or error number */ dberr_t btr_cur_optimistic_insert( /*======================*/ @@ -298,7 +226,6 @@ btr_cur_update_alloc_zip_func( /*==========================*/ page_zip_des_t* page_zip,/*!< in/out: compressed page */ page_cur_t* cursor, /*!< in/out: B-tree page cursor */ - dict_index_t* index, /*!< in: the index corresponding to cursor */ #ifdef UNIV_DEBUG rec_offs* offsets,/*!< in/out: offsets of the cursor record */ #endif /* UNIV_DEBUG */ @@ -308,11 +235,11 @@ btr_cur_update_alloc_zip_func( mtr_t* mtr) /*!< in/out: mini-transaction */ MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifdef UNIV_DEBUG -# define btr_cur_update_alloc_zip(page_zip,cursor,index,offsets,len,cr,mtr) \ - btr_cur_update_alloc_zip_func(page_zip,cursor,index,offsets,len,cr,mtr) +# define btr_cur_update_alloc_zip(page_zip,cursor,offsets,len,cr,mtr) \ + btr_cur_update_alloc_zip_func(page_zip,cursor,offsets,len,cr,mtr) #else /* UNIV_DEBUG */ -# define btr_cur_update_alloc_zip(page_zip,cursor,index,offsets,len,cr,mtr) \ - btr_cur_update_alloc_zip_func(page_zip,cursor,index,len,cr,mtr) +# define btr_cur_update_alloc_zip(page_zip,cursor,offsets,len,cr,mtr) \ + btr_cur_update_alloc_zip_func(page_zip,cursor,len,cr,mtr) #endif /* UNIV_DEBUG */ /** Apply an update vector to a record. No field size changes are allowed. @@ -442,44 +369,36 @@ that mtr holds an x-latch on the tree and on the cursor page. To avoid deadlocks, mtr must also own x-latches to brothers of page, if those brothers exist. NOTE: it is assumed that the caller has reserved enough free extents so that the compression will always succeed if done! -@return TRUE if compression occurred */ -ibool +@return whether compression occurred */ +bool btr_cur_compress_if_useful( /*=======================*/ btr_cur_t* cursor, /*!< in/out: cursor on the page to compress; - cursor does not stay valid if compression - occurs */ - ibool adjust, /*!< in: TRUE if should adjust the - cursor position even if compression occurs */ + cursor does not stay valid if !adjust and + compression occurs */ + bool adjust, /*!< in: whether the cursor position should be + adjusted even when compression occurs */ mtr_t* mtr) /*!< in/out: mini-transaction */ MY_ATTRIBUTE((nonnull)); /*******************************************************//** Removes the record on which the tree cursor is positioned. It is assumed that the mtr has an x-latch on the page where the cursor is positioned, but no latch on the whole tree. -@return TRUE if success, i.e., the page did not become too empty */ -ibool -btr_cur_optimistic_delete_func( -/*===========================*/ +@return error code +@retval DB_FAIL if the page would become too empty */ +dberr_t +btr_cur_optimistic_delete( +/*======================*/ btr_cur_t* cursor, /*!< in: cursor on the record to delete; cursor stays valid: if deletion succeeds, on function exit it points to the successor of the deleted record */ -# ifdef UNIV_DEBUG ulint flags, /*!< in: BTR_CREATE_FLAG or 0 */ -# endif /* UNIV_DEBUG */ mtr_t* mtr) /*!< in: mtr; if this function returns TRUE on a leaf page of a secondary index, the mtr must be committed before latching any further pages */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -# ifdef UNIV_DEBUG -# define btr_cur_optimistic_delete(cursor, flags, mtr) \ - btr_cur_optimistic_delete_func(cursor, flags, mtr) -# else /* UNIV_DEBUG */ -# define btr_cur_optimistic_delete(cursor, flags, mtr) \ - btr_cur_optimistic_delete_func(cursor, mtr) -# endif /* UNIV_DEBUG */ /*************************************************************//** Removes the record on which the tree cursor is positioned. Tries to compress the page if its fillfactor drops below a threshold @@ -511,8 +430,8 @@ btr_cur_pessimistic_delete( /** Delete the node pointer in a parent page. @param[in,out] parent cursor pointing to parent record @param[in,out] mtr mini-transaction */ -void btr_cur_node_ptr_delete(btr_cur_t* parent, mtr_t* mtr) - MY_ATTRIBUTE((nonnull)); +dberr_t btr_cur_node_ptr_delete(btr_cur_t* parent, mtr_t* mtr) + MY_ATTRIBUTE((nonnull, warn_unused_result)); /***********************************************************//** Parses a redo log record of updating a record in-place. @return end of log record or NULL */ @@ -538,16 +457,20 @@ struct btr_pos_t page_id_t page_id; /* Out: Page where we found the tuple */ }; -/** Estimates the number of rows in a given index range. -@param[in] index index -@param[in/out] range_start -@param[in/out] range_ end -@return estimated number of rows */ -ha_rows -btr_estimate_n_rows_in_range( - dict_index_t* index, - btr_pos_t* range_start, - btr_pos_t* range_end); +/** Estimates the number of rows in a given index range. Do search in the +left page, then if there are pages between left and right ones, read a few +pages to the right, if the right page is reached, fetch it and count the exact +number of rows, otherwise count the estimated(see +btr_estimate_n_rows_in_range_on_level() for details) number if rows, and +fetch the right page. If leaves are reached, unlatch non-leaf pages except +the right leaf parent. After the right leaf page is fetched, commit mtr. +@param[in] index index +@param[in] range_start range start +@param[in] range_end range end +@return estimated number of rows; */ +ha_rows btr_estimate_n_rows_in_range(dict_index_t *index, + btr_pos_t *range_start, + btr_pos_t *range_end); /** Gets the externally stored size of a record, in units of a database page. @param[in] rec record @@ -605,9 +528,7 @@ file segment of the index tree. dberr_t btr_store_big_rec_extern_fields( /*============================*/ - btr_pcur_t* pcur, /*!< in/out: a persistent cursor. if - btr_mtr is restarted, then this can - be repositioned. */ + btr_pcur_t* pcur, /*!< in: a persistent cursor */ rec_offs* offsets, /*!< in/out: rec_get_offsets() on pcur. the "external storage" flags in offsets will correctly correspond @@ -618,7 +539,7 @@ btr_store_big_rec_extern_fields( latches to the clustered index. can be committed and restarted. */ enum blob_op op) /*! in: operation code */ - MY_ATTRIBUTE((warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Frees the space in an externally stored field to the file space @@ -703,19 +624,6 @@ btr_rec_copy_externally_stored_field( ulint* len, mem_heap_t* heap); -/** Latches the leaf page or pages requested. -@param[in] block leaf page where the search converged -@param[in] latch_mode BTR_SEARCH_LEAF, ... -@param[in] cursor cursor -@param[in] mtr mini-transaction -@return blocks and savepoints which actually latched. */ -btr_latch_leaves_t -btr_cur_latch_leaves( - buf_block_t* block, - ulint latch_mode, - btr_cur_t* cursor, - mtr_t* mtr); - /*######################################################################*/ /** In the pessimistic delete, if the page data size drops below this @@ -774,24 +682,18 @@ enum btr_cur_method { /** The tree cursor: the definition appears here only for the compiler to know struct size! */ struct btr_cur_t { - dict_index_t* index; /*!< index where positioned */ page_cur_t page_cur; /*!< page cursor */ purge_node_t* purge_node; /*!< purge node, for BTR_DELETE */ - buf_block_t* left_block; /*!< this field is used to store - a pointer to the left neighbor - page, in the cases - BTR_SEARCH_PREV and - BTR_MODIFY_PREV */ /*------------------------------*/ que_thr_t* thr; /*!< this field is only used - when btr_cur_search_to_nth_level + when search_leaf() is called for an index entry insertion: the calling query thread is passed here to be used in the insert buffer */ /*------------------------------*/ /** The following fields are used in - btr_cur_search_to_nth_level to pass information: */ + search_leaf() to pass information: */ /* @{ */ enum btr_cur_method flag; /*!< Search method used */ ulint tree_height; /*!< Tree height if the search is done @@ -800,8 +702,7 @@ struct btr_cur_t { ulint up_match; /*!< If the search mode was PAGE_CUR_LE, the number of matched fields to the the first user record to the right of - the cursor record after - btr_cur_search_to_nth_level; + the cursor record after search_leaf(); for the mode PAGE_CUR_GE, the matched fields to the first user record AT THE CURSOR or to the right of it; @@ -818,8 +719,7 @@ struct btr_cur_t { ulint low_match; /*!< if search mode was PAGE_CUR_LE, the number of matched fields to the first user record AT THE CURSOR or - to the left of it after - btr_cur_search_to_nth_level; + to the left of it after search_leaf(); NOT defined for PAGE_CUR_GE or any other search modes; see also the NOTE in up_match! */ @@ -839,28 +739,45 @@ struct btr_cur_t { information of the path through the tree */ rtr_info_t* rtr_info; /*!< rtree search info */ - btr_cur_t():thr(NULL), rtr_info(NULL) {} - /* default values */ - /** Zero-initialize all fields */ - void init() - { - index = NULL; - memset(&page_cur, 0, sizeof page_cur); - purge_node = NULL; - left_block = NULL; - thr = NULL; - flag = btr_cur_method(0); - tree_height = 0; - up_match = 0; - up_bytes = 0; - low_match = 0; - low_bytes = 0; - n_fields = 0; - n_bytes = 0; - fold = 0; - path_arr = NULL; - rtr_info = NULL; - } + btr_cur_t() { memset((void*) this, 0, sizeof *this); } + + dict_index_t *index() const { return page_cur.index; } + buf_block_t *block() const { return page_cur.block; } + + /** Open the cursor on the first or last record. + @param first true=first record, false=last record + @param index B-tree + @param latch_mode which latches to acquire + @param mtr mini-transaction + @return error code */ + dberr_t open_leaf(bool first, dict_index_t *index, btr_latch_mode latch_mode, + mtr_t *mtr); + + /** Search the leaf page record corresponding to a key. + @param tuple key to search for, with correct n_fields_cmp + @param mode search mode; PAGE_CUR_LE for unique prefix or for inserting + @param latch_mode latch mode + @param mtr mini-transaction + @return error code */ + dberr_t search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, + btr_latch_mode latch_mode, mtr_t *mtr); + + /** Search the leaf page record corresponding to a key, exclusively latching + all sibling pages on the way. + @param tuple key to search for, with correct n_fields_cmp + @param mode search mode; PAGE_CUR_LE for unique prefix or for inserting + @param mtr mini-transaction + @return error code */ + dberr_t pessimistic_search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, + mtr_t *mtr); + + /** Open the cursor at a random leaf page record. + @param offsets temporary memory for rec_get_offsets() + @param heap memory heap for rec_get_offsets() + @param mtr mini-transaction + @return error code */ + inline dberr_t open_random_leaf(rec_offs *&offsets, mem_heap_t *& heap, + mtr_t &mtr); }; /** Modify the delete-mark flag of a record. @@ -913,14 +830,14 @@ inherited external field. */ #define BTR_EXTERN_INHERITED_FLAG 64U #ifdef BTR_CUR_HASH_ADAPT -/** Number of searches down the B-tree in btr_cur_search_to_nth_level(). */ +/** Number of searches down the B-tree in btr_cur_t::search_leaf(). */ extern ib_counter_t btr_cur_n_non_sea; /** Old value of btr_cur_n_non_sea. Copied by srv_refresh_innodb_monitor_stats(). Referenced by srv_printf_innodb_monitor(). */ extern ulint btr_cur_n_non_sea_old; /** Number of successful adaptive hash index lookups in -btr_cur_search_to_nth_level(). */ +btr_cur_t::search_leaf(). */ extern ib_counter_t btr_cur_n_sea; /** Old value of btr_cur_n_sea. Copied by srv_refresh_innodb_monitor_stats(). Referenced by @@ -933,6 +850,6 @@ extern ulint btr_cur_n_sea_old; extern uint btr_cur_limit_optimistic_insert_debug; #endif /* UNIV_DEBUG */ -#include "btr0cur.ic" +#include "btr0cur.inl" #endif diff --git a/storage/innobase/include/btr0cur.ic b/storage/innobase/include/btr0cur.ic deleted file mode 100644 index 76a2d3be49c76..0000000000000 --- a/storage/innobase/include/btr0cur.ic +++ /dev/null @@ -1,170 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2021, 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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/btr0cur.ic -The index tree cursor - -Created 10/16/1994 Heikki Tuuri -*******************************************************/ - -#include "btr0btr.h" - -#ifdef UNIV_DEBUG -# define LIMIT_OPTIMISTIC_INSERT_DEBUG(NREC, CODE)\ -if (btr_cur_limit_optimistic_insert_debug > 1\ - && (NREC) >= btr_cur_limit_optimistic_insert_debug) {\ - CODE;\ -} -#else -# define LIMIT_OPTIMISTIC_INSERT_DEBUG(NREC, CODE) -#endif /* UNIV_DEBUG */ - -/*********************************************************//** -Returns the compressed page on which the tree cursor is positioned. -@return pointer to compressed page, or NULL if the page is not compressed */ -UNIV_INLINE -page_zip_des_t* -btr_cur_get_page_zip( -/*=================*/ - btr_cur_t* cursor) /*!< in: tree cursor */ -{ - return(buf_block_get_page_zip(btr_cur_get_block(cursor))); -} - -/*********************************************************//** -Returns the page of a tree cursor. -@return pointer to page */ -UNIV_INLINE -page_t* -btr_cur_get_page( -/*=============*/ - btr_cur_t* cursor) /*!< in: tree cursor */ -{ - return(page_align(page_cur_get_rec(&(cursor->page_cur)))); -} - -/*********************************************************//** -Positions a tree cursor at a given record. */ -UNIV_INLINE -void -btr_cur_position( -/*=============*/ - dict_index_t* index, /*!< in: index */ - rec_t* rec, /*!< in: record in tree */ - buf_block_t* block, /*!< in: buffer block of rec */ - btr_cur_t* cursor) /*!< out: cursor */ -{ - page_cur_position(rec, block, btr_cur_get_page_cur(cursor)); - cursor->index = index; -} - -/*********************************************************************//** -Checks if compressing an index page where a btr cursor is placed makes -sense. -@return TRUE if compression is recommended */ -UNIV_INLINE -ibool -btr_cur_compress_recommendation( -/*============================*/ - btr_cur_t* cursor, /*!< in: btr cursor */ - mtr_t* mtr) /*!< in: mtr */ -{ - const page_t* page; - - ut_ad(mtr->memo_contains_flagged(btr_cur_get_block(cursor), - MTR_MEMO_PAGE_X_FIX)); - - page = btr_cur_get_page(cursor); - - LIMIT_OPTIMISTIC_INSERT_DEBUG(page_get_n_recs(page) * 2U, - return(FALSE)); - - if (!page_has_siblings(page) - || page_get_data_size(page) - < BTR_CUR_PAGE_COMPRESS_LIMIT(cursor->index)) { - - /* The page fillfactor has dropped below a predefined - minimum value OR the level in the B-tree contains just - one page: we recommend compression if this is not the - root page. */ - - return cursor->index->page - != btr_cur_get_block(cursor)->page.id().page_no(); - } - - return(FALSE); -} - -/*********************************************************************//** -Checks if the record on which the cursor is placed can be deleted without -making tree compression necessary (or, recommended). -@return TRUE if can be deleted without recommended compression */ -UNIV_INLINE -ibool -btr_cur_can_delete_without_compress( -/*================================*/ - btr_cur_t* cursor, /*!< in: btr cursor */ - ulint rec_size,/*!< in: rec_get_size(btr_cur_get_rec(cursor))*/ - mtr_t* mtr) /*!< in: mtr */ -{ - page_t* page; - - ut_ad(mtr->memo_contains_flagged(btr_cur_get_block(cursor), - MTR_MEMO_PAGE_X_FIX)); - - page = btr_cur_get_page(cursor); - - if (!page_has_siblings(page) || page_get_n_recs(page) < 2 - || page_get_data_size(page) - rec_size - < BTR_CUR_PAGE_COMPRESS_LIMIT(cursor->index)) { - - /* The page fillfactor will drop below a predefined - minimum value, OR the level in the B-tree contains just - one page, OR the page will become empty: we recommend - compression if this is not the root page. */ - - return cursor->index->page - == btr_cur_get_block(cursor)->page.id().page_no(); - } - - return(TRUE); -} - -/*******************************************************************//** -Determine if an operation on off-page columns is an update. -@return TRUE if op != BTR_STORE_INSERT */ -UNIV_INLINE -ibool -btr_blob_op_is_update( -/*==================*/ - enum blob_op op) /*!< in: operation */ -{ - switch (op) { - case BTR_STORE_INSERT: - case BTR_STORE_INSERT_BULK: - return(FALSE); - case BTR_STORE_INSERT_UPDATE: - case BTR_STORE_UPDATE: - return(TRUE); - } - - ut_ad(0); - return(FALSE); -} diff --git a/storage/innobase/include/btr0cur.inl b/storage/innobase/include/btr0cur.inl new file mode 100644 index 0000000000000..955cf34288e23 --- /dev/null +++ b/storage/innobase/include/btr0cur.inl @@ -0,0 +1,170 @@ +/***************************************************************************** + +Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, 2022, 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 02110-1335 USA + +*****************************************************************************/ + +/**************************************************//** +@file include/btr0cur.ic +The index tree cursor + +Created 10/16/1994 Heikki Tuuri +*******************************************************/ + +#include "btr0btr.h" + +#ifdef UNIV_DEBUG +# define LIMIT_OPTIMISTIC_INSERT_DEBUG(NREC, CODE)\ +if (btr_cur_limit_optimistic_insert_debug > 1\ + && (NREC) >= btr_cur_limit_optimistic_insert_debug) {\ + CODE;\ +} +#else +# define LIMIT_OPTIMISTIC_INSERT_DEBUG(NREC, CODE) +#endif /* UNIV_DEBUG */ + +/*********************************************************//** +Returns the compressed page on which the tree cursor is positioned. +@return pointer to compressed page, or NULL if the page is not compressed */ +UNIV_INLINE +page_zip_des_t* +btr_cur_get_page_zip( +/*=================*/ + btr_cur_t* cursor) /*!< in: tree cursor */ +{ + return(buf_block_get_page_zip(btr_cur_get_block(cursor))); +} + +/*********************************************************//** +Returns the page of a tree cursor. +@return pointer to page */ +UNIV_INLINE +page_t* +btr_cur_get_page( +/*=============*/ + btr_cur_t* cursor) /*!< in: tree cursor */ +{ + return(page_align(page_cur_get_rec(&(cursor->page_cur)))); +} + +/*********************************************************//** +Positions a tree cursor at a given record. */ +UNIV_INLINE +void +btr_cur_position( +/*=============*/ + dict_index_t* index, /*!< in: index */ + rec_t* rec, /*!< in: record in tree */ + buf_block_t* block, /*!< in: buffer block of rec */ + btr_cur_t* cursor) /*!< out: cursor */ +{ + page_cur_position(rec, block, btr_cur_get_page_cur(cursor)); + cursor->page_cur.index = index; +} + +/*********************************************************************//** +Checks if compressing an index page where a btr cursor is placed makes +sense. +@return TRUE if compression is recommended */ +UNIV_INLINE +ibool +btr_cur_compress_recommendation( +/*============================*/ + btr_cur_t* cursor, /*!< in: btr cursor */ + mtr_t* mtr) /*!< in: mtr */ +{ + const page_t* page; + + ut_ad(mtr->memo_contains_flagged(btr_cur_get_block(cursor), + MTR_MEMO_PAGE_X_FIX)); + + page = btr_cur_get_page(cursor); + + LIMIT_OPTIMISTIC_INSERT_DEBUG(page_get_n_recs(page) * 2U, + return(FALSE)); + + if (!page_has_siblings(page) + || page_get_data_size(page) + < BTR_CUR_PAGE_COMPRESS_LIMIT(cursor->index())) { + + /* The page fillfactor has dropped below a predefined + minimum value OR the level in the B-tree contains just + one page: we recommend compression if this is not the + root page. */ + + return cursor->index()->page + != btr_cur_get_block(cursor)->page.id().page_no(); + } + + return(FALSE); +} + +/*********************************************************************//** +Checks if the record on which the cursor is placed can be deleted without +making tree compression necessary (or, recommended). +@return TRUE if can be deleted without recommended compression */ +UNIV_INLINE +ibool +btr_cur_can_delete_without_compress( +/*================================*/ + btr_cur_t* cursor, /*!< in: btr cursor */ + ulint rec_size,/*!< in: rec_get_size(btr_cur_get_rec(cursor))*/ + mtr_t* mtr) /*!< in: mtr */ +{ + page_t* page; + + ut_ad(mtr->memo_contains_flagged(btr_cur_get_block(cursor), + MTR_MEMO_PAGE_X_FIX)); + + page = btr_cur_get_page(cursor); + + if (!page_has_siblings(page) || page_get_n_recs(page) < 2 + || page_get_data_size(page) - rec_size + < BTR_CUR_PAGE_COMPRESS_LIMIT(cursor->index())) { + + /* The page fillfactor will drop below a predefined + minimum value, OR the level in the B-tree contains just + one page, OR the page will become empty: we recommend + compression if this is not the root page. */ + + return cursor->index()->page + == btr_cur_get_block(cursor)->page.id().page_no(); + } + + return(TRUE); +} + +/*******************************************************************//** +Determine if an operation on off-page columns is an update. +@return TRUE if op != BTR_STORE_INSERT */ +UNIV_INLINE +ibool +btr_blob_op_is_update( +/*==================*/ + enum blob_op op) /*!< in: operation */ +{ + switch (op) { + case BTR_STORE_INSERT: + case BTR_STORE_INSERT_BULK: + return(FALSE); + case BTR_STORE_INSERT_UPDATE: + case BTR_STORE_UPDATE: + return(TRUE); + } + + ut_ad(0); + return(FALSE); +} diff --git a/storage/innobase/include/btr0pcur.h b/storage/innobase/include/btr0pcur.h index 45406bd4b6fda..c66a3bfa3297d 100644 --- a/storage/innobase/include/btr0pcur.h +++ b/storage/innobase/include/btr0pcur.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2023, 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 @@ -24,8 +24,7 @@ The index tree persistent cursor Created 2/23/1996 Heikki Tuuri *******************************************************/ -#ifndef btr0pcur_h -#define btr0pcur_h +#pragma once #include "dict0dict.h" #include "btr0cur.h" @@ -46,13 +45,6 @@ of a scroll cursor easier */ BTR_PCUR_AFTER_LAST_IN_TREE = 5 /* in an empty tree */ }; -/**************************************************************//** -Allocates memory for a persistent cursor object and initializes the cursor. -@return own: persistent cursor */ -btr_pcur_t* -btr_pcur_create_for_mysql(void); -/*============================*/ - /**************************************************************//** Resets a persistent cursor object, freeing ::old_rec_buf if it is allocated and resetting the other members to their initial values. */ @@ -62,12 +54,6 @@ btr_pcur_reset( btr_pcur_t* cursor);/*!< in, out: persistent cursor */ /**************************************************************//** -Frees the memory for a persistent cursor object. */ -void -btr_pcur_free_for_mysql( -/*====================*/ - btr_pcur_t* cursor); /*!< in, own: persistent cursor */ -/**************************************************************//** Copies the stored position of a pcur to another pcur. */ void btr_pcur_copy_stored_position( @@ -84,86 +70,23 @@ btr_pcur_init( /*==========*/ btr_pcur_t* pcur); /*!< in: persistent cursor */ -/** Free old_rec_buf. -@param[in] pcur Persistent cursor holding old_rec to be freed. */ -UNIV_INLINE -void -btr_pcur_free( - btr_pcur_t* pcur); +/** Opens an persistent cursor to an index tree without initializing the +cursor. +@param tuple tuple on which search done +@param mode PAGE_CUR_L, ...; NOTE that if the search is made using a + unique prefix of a record, mode should be PAGE_CUR_LE, not + PAGE_CUR_GE, as the latter may end up on the previous page of + the record! +@param latch_mode BTR_SEARCH_LEAF, ... +@param cursor memory buffer for persistent cursor +@param mtr mini-transaction +@return DB_SUCCESS on success or error code otherwise. */ +inline +dberr_t btr_pcur_open_with_no_init(const dtuple_t *tuple, page_cur_mode_t mode, + btr_latch_mode latch_mode, + btr_pcur_t *cursor, mtr_t *mtr); /**************************************************************//** -Initializes and opens a persistent cursor to an index tree. It should be -closed with btr_pcur_close. */ -UNIV_INLINE -dberr_t -btr_pcur_open_low( -/*==============*/ - dict_index_t* index, /*!< in: index */ - ulint level, /*!< in: level in the btree */ - const dtuple_t* tuple, /*!< in: tuple on which search done */ - page_cur_mode_t mode, /*!< in: PAGE_CUR_L, ...; - NOTE that if the search is made using a unique - prefix of a record, mode should be - PAGE_CUR_LE, not PAGE_CUR_GE, as the latter - may end up on the previous page from the - record! */ - ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */ - btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ - ib_uint64_t autoinc,/*!< in: PAGE_ROOT_AUTO_INC to be written - (0 if none) */ - mtr_t* mtr); /*!< in: mtr */ -#define btr_pcur_open(i,t,md,l,c,m) \ - btr_pcur_open_low(i,0,t,md,l,c,0,m) -/**************************************************************//** -Opens an persistent cursor to an index tree without initializing the -cursor. */ -UNIV_INLINE -dberr_t -btr_pcur_open_with_no_init_func( -/*============================*/ - dict_index_t* index, /*!< in: index */ - const dtuple_t* tuple, /*!< in: tuple on which search done */ - page_cur_mode_t mode, /*!< in: PAGE_CUR_L, ...; - NOTE that if the search is made using a unique - prefix of a record, mode should be - PAGE_CUR_LE, not PAGE_CUR_GE, as the latter - may end up on the previous page of the - record! */ - ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ...; - NOTE that if ahi_latch then we might not - acquire a cursor page latch, but assume - that the ahi_latch protects the record! */ - btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ -#ifdef BTR_CUR_HASH_ADAPT - srw_spin_lock* ahi_latch, - /*!< in: currently held AHI rdlock, or NULL */ -#endif /* BTR_CUR_HASH_ADAPT */ - mtr_t* mtr); /*!< in: mtr */ -#ifdef BTR_CUR_HASH_ADAPT -# define btr_pcur_open_with_no_init(ix,t,md,l,cur,ahi,m) \ - btr_pcur_open_with_no_init_func(ix,t,md,l,cur,ahi,m) -#else /* BTR_CUR_HASH_ADAPT */ -# define btr_pcur_open_with_no_init(ix,t,md,l,cur,ahi,m) \ - btr_pcur_open_with_no_init_func(ix,t,md,l,cur,m) -#endif /* BTR_CUR_HASH_ADAPT */ - -/*****************************************************************//** -Opens a persistent cursor at either end of an index. */ -UNIV_INLINE -dberr_t -btr_pcur_open_at_index_side( -/*========================*/ - bool from_left, /*!< in: true if open to the low end, - false if to the high end */ - dict_index_t* index, /*!< in: index */ - ulint latch_mode, /*!< in: latch mode */ - btr_pcur_t* pcur, /*!< in/out: cursor */ - bool init_pcur, /*!< in: whether to initialize pcur */ - ulint level, /*!< in: level to search for - (0=leaf) */ - mtr_t* mtr) /*!< in/out: mini-transaction */ - MY_ATTRIBUTE((nonnull)); -/**************************************************************//** Gets the up_match value for a pcur after a search. @return number of matched fields at the cursor or to the right if search mode was PAGE_CUR_GE, otherwise undefined */ @@ -181,34 +104,7 @@ ulint btr_pcur_get_low_match( /*===================*/ const btr_pcur_t* cursor); /*!< in: persistent cursor */ -/**************************************************************//** -If mode is PAGE_CUR_G or PAGE_CUR_GE, opens a persistent cursor on the first -user record satisfying the search condition, in the case PAGE_CUR_L or -PAGE_CUR_LE, on the last user record. If no such user record exists, then -in the first case sets the cursor after last in tree, and in the latter case -before first in tree. The latching mode must be BTR_SEARCH_LEAF or -BTR_MODIFY_LEAF. */ -void -btr_pcur_open_on_user_rec( - dict_index_t* index, /*!< in: index */ - const dtuple_t* tuple, /*!< in: tuple on which search done */ - page_cur_mode_t mode, /*!< in: PAGE_CUR_L, ... */ - ulint latch_mode, /*!< in: BTR_SEARCH_LEAF or - BTR_MODIFY_LEAF */ - btr_pcur_t* cursor, /*!< in: memory buffer for persistent - cursor */ - mtr_t* mtr); /*!< in: mtr */ -/**********************************************************************//** -Positions a cursor at a randomly chosen position within a B-tree. -@return true if the index is available and we have put the cursor, false -if the index is unavailable */ -UNIV_INLINE -bool -btr_pcur_open_at_rnd_pos( - dict_index_t* index, /*!< in: index */ - ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ - btr_pcur_t* cursor, /*!< in/out: B-tree pcur */ - mtr_t* mtr); /*!< in: mtr */ + /**************************************************************//** Frees the possible memory heap of a persistent cursor and sets the latch mode of the persistent cursor to BTR_NO_LATCHES. @@ -218,9 +114,7 @@ cursor is currently positioned. The latch is acquired by the are not allowed, you must take care (if using the cursor in S-mode) to manually release the latch by either calling btr_leaf_page_release(btr_pcur_get_block(&pcur), pcur.latch_mode, mtr) -or by committing the mini-transaction right after btr_pcur_close(). -A subsequent attempt to crawl the same page in the same mtr would cause -an assertion failure. */ +or by mtr_t::commit(). */ UNIV_INLINE void btr_pcur_close( @@ -238,26 +132,6 @@ btr_pcur_store_position( /*====================*/ btr_pcur_t* cursor, /*!< in: persistent cursor */ mtr_t* mtr); /*!< in: mtr */ -/**************************************************************//** -Restores the stored position of a persistent cursor bufferfixing the page and -obtaining the specified latches. If the cursor position was saved when the -(1) cursor was positioned on a user record: this function restores the position -to the last record LESS OR EQUAL to the stored record; -(2) cursor was positioned on a page infimum record: restores the position to -the last record LESS than the user record which was the successor of the page -infimum; -(3) cursor was positioned on the page supremum: restores to the first record -GREATER than the user record which was the predecessor of the supremum. -(4) cursor was positioned before the first or after the last in an empty tree: -restores to before first or after the last in the tree. -@return TRUE if the cursor position was stored when it was on a user -record and it can be restored on a user record whose ordering fields -are identical to the ones of the original user record */ -ibool -btr_pcur_restore_position( - ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ - btr_pcur_t* cursor, /*!< in: detached persistent cursor */ - mtr_t* mtr); /*!< in: mtr */ /*********************************************************//** Gets the rel_pos field for a cursor whose position has been stored. @return BTR_PCUR_ON, ... */ @@ -306,13 +180,14 @@ btr_pcur_move_to_next( /*********************************************************//** Moves the persistent cursor to the previous record in the tree. If no records are left, the cursor stays 'before first in tree'. -@return TRUE if the cursor was not before first in tree */ -ibool +@return true if the cursor was not before first in tree */ +bool btr_pcur_move_to_prev( /*==================*/ btr_pcur_t* cursor, /*!< in: persistent cursor; NOTE that the function may release the page latch */ - mtr_t* mtr); /*!< in: mtr */ + mtr_t* mtr) /*!< in: mtr */ + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************//** Moves the persistent cursor to the next user record in the tree. If no user records are left, the cursor ends up 'after last in tree'. @@ -329,12 +204,13 @@ Moves the persistent cursor to the first record on the next page. Releases the latch on the current page, and bufferunfixes it. Note that there must not be modifications on the current page, as then the x-latch can be released only in mtr_commit. */ -void +dberr_t btr_pcur_move_to_next_page( /*=======================*/ btr_pcur_t* cursor, /*!< in: persistent cursor; must be on the last record of the current page */ - mtr_t* mtr); /*!< in: mtr */ + mtr_t* mtr) /*!< in: mtr */ + MY_ATTRIBUTE((nonnull, warn_unused_result)); #define btr_pcur_get_btr_cur(cursor) (&(cursor)->btr_cur) #define btr_pcur_get_page_cur(cursor) (&(cursor)->btr_cur.page_cur) @@ -371,17 +247,19 @@ static inline bool btr_pcur_is_before_first_in_tree(btr_pcur_t* cursor); Checks if the persistent cursor is after the last user record in the index tree. */ static inline bool btr_pcur_is_after_last_in_tree(btr_pcur_t* cursor); +MY_ATTRIBUTE((nonnull, warn_unused_result)) /*********************************************************//** Moves the persistent cursor to the next record on the same page. */ UNIV_INLINE -void +rec_t* btr_pcur_move_to_next_on_page( /*==========================*/ btr_pcur_t* cursor);/*!< in/out: persistent cursor */ +MY_ATTRIBUTE((nonnull, warn_unused_result)) /*********************************************************//** Moves the persistent cursor to the previous record on the same page. */ UNIV_INLINE -void +rec_t* btr_pcur_move_to_prev_on_page( /*==========================*/ btr_pcur_t* cursor);/*!< in/out: persistent cursor */ @@ -418,64 +296,102 @@ enum pcur_pos_t { /* The persistent B-tree cursor structure. This is used mainly for SQL selects, updates, and deletes. */ -struct btr_pcur_t{ - /** a B-tree cursor */ - btr_cur_t btr_cur; - /** see TODO note below! - BTR_SEARCH_LEAF, BTR_MODIFY_LEAF, BTR_MODIFY_TREE or BTR_NO_LATCHES, - depending on the latching state of the page and tree where the cursor - is positioned; BTR_NO_LATCHES means that the cursor is not currently - positioned: - we say then that the cursor is detached; it can be restored to - attached if the old position was stored in old_rec */ - ulint latch_mode; - /** true if old_rec is stored */ - bool old_stored; - /** if cursor position is stored, contains an initial segment of the - latest record cursor was positioned either on, before or after */ - rec_t* old_rec; - /** btr_cur.index->n_core_fields when old_rec was copied */ - uint16 old_n_core_fields; - /** number of fields in old_rec */ - uint16 old_n_fields; - /** BTR_PCUR_ON, BTR_PCUR_BEFORE, or BTR_PCUR_AFTER, depending on - whether cursor was on, before, or after the old_rec record */ - enum btr_pcur_pos_t rel_pos; - /** buffer block when the position was stored */ - buf::Block_hint block_when_stored; - /** the modify clock value of the buffer block when the cursor position - was stored */ - ib_uint64_t modify_clock; - /** btr_pcur_store_position() and btr_pcur_restore_position() state. */ - enum pcur_pos_t pos_state; - /** PAGE_CUR_G, ... */ - page_cur_mode_t search_mode; - /** the transaction, if we know it; otherwise this field is not defined; - can ONLY BE USED in error prints in fatal assertion failures! */ - trx_t* trx_if_known; - /*-----------------------------*/ - /* NOTE that the following fields may possess dynamically allocated - memory which should be freed if not needed anymore! */ - - /** NULL, or a dynamically allocated buffer for old_rec */ - byte* old_rec_buf; - /** old_rec_buf size if old_rec_buf is not NULL */ - ulint buf_size; - - btr_pcur_t() : - btr_cur(), latch_mode(RW_NO_LATCH), - old_stored(false), old_rec(NULL), - old_n_fields(0), rel_pos(btr_pcur_pos_t(0)), - block_when_stored(), - modify_clock(0), pos_state(BTR_PCUR_NOT_POSITIONED), - search_mode(PAGE_CUR_UNSUPP), trx_if_known(NULL), - old_rec_buf(NULL), buf_size(0) - { - btr_cur.init(); - } - - /** Return the index of this persistent cursor */ - dict_index_t* index() const { return(btr_cur.index); } +struct btr_pcur_t +{ + /** Return value of restore_position() */ + enum restore_status { + /** cursor position on user rec and points on the record with + the same field values as in the stored record */ + SAME_ALL, + /** cursor position is on user rec and points on the record with + the same unique field values as in the stored record */ + SAME_UNIQ, + /** cursor position is not on user rec or points on the record + with not the same uniq field values as in the stored record */ + NOT_SAME, + /** the index tree is corrupted */ + CORRUPTED + }; + /** a B-tree cursor */ + btr_cur_t btr_cur; + /** @see BTR_PCUR_WAS_POSITIONED + BTR_SEARCH_LEAF, BTR_MODIFY_LEAF, BTR_MODIFY_TREE or BTR_NO_LATCHES, + depending on the latching state of the page and tree where the cursor + is positioned; BTR_NO_LATCHES means that the cursor is not currently + positioned: + we say then that the cursor is detached; it can be restored to + attached if the old position was stored in old_rec */ + btr_latch_mode latch_mode= BTR_NO_LATCHES; + /** if cursor position is stored, contains an initial segment of the + latest record cursor was positioned either on, before or after */ + rec_t *old_rec= nullptr; + /** btr_cur.index()->n_core_fields when old_rec was copied */ + uint16 old_n_core_fields= 0; + /** number of fields in old_rec */ + uint16 old_n_fields= 0; + /** BTR_PCUR_ON, BTR_PCUR_BEFORE, or BTR_PCUR_AFTER, depending on + whether cursor was on, before, or after the old_rec record */ + btr_pcur_pos_t rel_pos= btr_pcur_pos_t(0); + /** buffer block when the position was stored */ + buf::Block_hint block_when_stored; + /** the modify clock value of the buffer block when the cursor position + was stored */ + ib_uint64_t modify_clock= 0; + /** btr_pcur_store_position() and restore_position() state. */ + enum pcur_pos_t pos_state= BTR_PCUR_NOT_POSITIONED; + page_cur_mode_t search_mode= PAGE_CUR_UNSUPP; + /** the transaction, if we know it; otherwise this field is not defined; + can ONLY BE USED in error prints in fatal assertion failures! */ + trx_t *trx_if_known= nullptr; + /** a dynamically allocated buffer for old_rec */ + byte *old_rec_buf= nullptr; + /** old_rec_buf size if old_rec_buf is not NULL */ + ulint buf_size= 0; + + /** Return the index of this persistent cursor */ + dict_index_t *index() const { return(btr_cur.index()); } + MY_ATTRIBUTE((nonnull, warn_unused_result)) + /** Restores the stored position of a persistent cursor bufferfixing + the page and obtaining the specified latches. If the cursor position + was saved when the + (1) cursor was positioned on a user record: this function restores the + position to the last record LESS OR EQUAL to the stored record; + (2) cursor was positioned on a page infimum record: restores the + position to the last record LESS than the user record which was the + successor of the page infimum; + (3) cursor was positioned on the page supremum: restores to the first + record GREATER than the user record which was the predecessor of the + supremum. + (4) cursor was positioned before the first or after the last in an + empty tree: restores to before first or after the last in the tree. + @param latch_mode BTR_SEARCH_LEAF, ... + @param mtr mini-transaction + @retval SAME_ALL cursor position on user rec and points on + the record with the same field values as in the stored record, + @retval SAME_UNIQ cursor position is on user rec and points on the + record with the same unique field values as in the stored record, + @retval NOT_SAME cursor position is not on user rec or points on + the record with not the same uniq field values as in the stored + @retval CORRUPTED if the index is corrupted */ + restore_status restore_position(btr_latch_mode latch_mode, mtr_t *mtr); + + /** Open the cursor on the first or last record. + @param first true=first record, false=last record + @param index B-tree + @param latch_mode which latches to acquire + @param mtr mini-transaction + @return error code */ + dberr_t open_leaf(bool first, dict_index_t *index, btr_latch_mode latch_mode, + mtr_t *mtr) + + { + this->latch_mode= BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode); + search_mode= first ? PAGE_CUR_G : PAGE_CUR_L; + pos_state= BTR_PCUR_IS_POSITIONED; + old_rec= nullptr; + + return btr_cur.open_leaf(first, index, this->latch_mode, mtr); + } }; inline buf_block_t *btr_pcur_get_block(btr_pcur_t *cursor) @@ -497,6 +413,47 @@ inline rec_t *btr_pcur_get_rec(const btr_pcur_t *cursor) return cursor->btr_cur.page_cur.rec; } -#include "btr0pcur.ic" +/**************************************************************//** +Initializes and opens a persistent cursor to an index tree. */ +inline +dberr_t +btr_pcur_open( + const dtuple_t* tuple, /*!< in: tuple on which search done */ + page_cur_mode_t mode, /*!< in: PAGE_CUR_LE, ... */ + btr_latch_mode latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */ + btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ + mtr_t* mtr) /*!< in: mtr */ +{ + cursor->latch_mode= BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode); + cursor->search_mode= mode; + cursor->pos_state= BTR_PCUR_IS_POSITIONED; + cursor->trx_if_known= nullptr; + return cursor->btr_cur.search_leaf(tuple, mode, latch_mode, mtr); +} + +/** Open a cursor on the first user record satisfying the search condition; +in case of no match, after the last index record. */ +MY_ATTRIBUTE((nonnull, warn_unused_result)) +inline +dberr_t +btr_pcur_open_on_user_rec( + const dtuple_t* tuple, /*!< in: tuple on which search done */ + btr_latch_mode latch_mode, /*!< in: BTR_SEARCH_LEAF or + BTR_MODIFY_LEAF */ + btr_pcur_t* cursor, /*!< in: memory buffer for persistent + cursor */ + mtr_t* mtr) /*!< in: mtr */ +{ + ut_ad(latch_mode == BTR_SEARCH_LEAF || latch_mode == BTR_MODIFY_LEAF); + if (dberr_t err= + btr_pcur_open(tuple, PAGE_CUR_GE, latch_mode, cursor, mtr)) + return err; + if (!btr_pcur_is_after_last_on_page(cursor) || + btr_pcur_is_after_last_in_tree(cursor)) + return DB_SUCCESS; + if (dberr_t err= btr_pcur_move_to_next_page(cursor, mtr)) + return err; + return btr_pcur_move_to_next_on_page(cursor) ? DB_SUCCESS : DB_CORRUPTION; +} -#endif +#include "btr0pcur.inl" diff --git a/storage/innobase/include/btr0pcur.ic b/storage/innobase/include/btr0pcur.ic deleted file mode 100644 index f5e59c7268e50..0000000000000 --- a/storage/innobase/include/btr0pcur.ic +++ /dev/null @@ -1,565 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2021, 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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/btr0pcur.ic -The index tree persistent cursor - -Created 2/23/1996 Heikki Tuuri -*******************************************************/ - - -/*********************************************************//** -Gets the rel_pos field for a cursor whose position has been stored. -@return BTR_PCUR_ON, ... */ -UNIV_INLINE -ulint -btr_pcur_get_rel_pos( -/*=================*/ - const btr_pcur_t* cursor) /*!< in: persistent cursor */ -{ - ut_ad(cursor); - ut_ad(cursor->old_rec); - ut_ad(cursor->old_stored); - ut_ad(cursor->pos_state == BTR_PCUR_WAS_POSITIONED - || cursor->pos_state == BTR_PCUR_IS_POSITIONED); - - return(cursor->rel_pos); -} - -/**************************************************************//** -Gets the up_match value for a pcur after a search. -@return number of matched fields at the cursor or to the right if -search mode was PAGE_CUR_GE, otherwise undefined */ -UNIV_INLINE -ulint -btr_pcur_get_up_match( -/*==================*/ - const btr_pcur_t* cursor) /*!< in: persistent cursor */ -{ - const btr_cur_t* btr_cursor; - - ut_ad((cursor->pos_state == BTR_PCUR_WAS_POSITIONED) - || (cursor->pos_state == BTR_PCUR_IS_POSITIONED)); - - btr_cursor = btr_pcur_get_btr_cur(cursor); - - ut_ad(btr_cursor->up_match != ULINT_UNDEFINED); - - return(btr_cursor->up_match); -} - -/**************************************************************//** -Gets the low_match value for a pcur after a search. -@return number of matched fields at the cursor or to the right if -search mode was PAGE_CUR_LE, otherwise undefined */ -UNIV_INLINE -ulint -btr_pcur_get_low_match( -/*===================*/ - const btr_pcur_t* cursor) /*!< in: persistent cursor */ -{ - const btr_cur_t* btr_cursor; - - ut_ad((cursor->pos_state == BTR_PCUR_WAS_POSITIONED) - || (cursor->pos_state == BTR_PCUR_IS_POSITIONED)); - - btr_cursor = btr_pcur_get_btr_cur(cursor); - ut_ad(btr_cursor->low_match != ULINT_UNDEFINED); - - return(btr_cursor->low_match); -} - -/*********************************************************//** -Checks if the persistent cursor is after the last user record on -a page. */ -UNIV_INLINE -ibool -btr_pcur_is_after_last_on_page( -/*===========================*/ - const btr_pcur_t* cursor) /*!< in: persistent cursor */ -{ - ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); - ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - - return(page_cur_is_after_last(btr_pcur_get_page_cur(cursor))); -} - -/*********************************************************//** -Checks if the persistent cursor is before the first user record on -a page. */ -UNIV_INLINE -ibool -btr_pcur_is_before_first_on_page( -/*=============================*/ - const btr_pcur_t* cursor) /*!< in: persistent cursor */ -{ - ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); - ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - - return(page_cur_is_before_first(btr_pcur_get_page_cur(cursor))); -} - -/*********************************************************//** -Checks if the persistent cursor is on a user record. */ -UNIV_INLINE -ibool -btr_pcur_is_on_user_rec( -/*====================*/ - const btr_pcur_t* cursor) /*!< in: persistent cursor */ -{ - ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); - ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - - if (btr_pcur_is_before_first_on_page(cursor) - || btr_pcur_is_after_last_on_page(cursor)) { - - return(FALSE); - } - - return(TRUE); -} - -/*********************************************************//** -Checks if the persistent cursor is before the first user record in -the index tree. */ -static inline bool btr_pcur_is_before_first_in_tree(btr_pcur_t* cursor) -{ - ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); - ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - - return !page_has_prev(btr_pcur_get_page(cursor)) - && page_cur_is_before_first(btr_pcur_get_page_cur(cursor)); -} - -/*********************************************************//** -Checks if the persistent cursor is after the last user record in -the index tree. */ -static inline bool btr_pcur_is_after_last_in_tree(btr_pcur_t* cursor) -{ - ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); - ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - - return !page_has_next(btr_pcur_get_page(cursor)) - && page_cur_is_after_last(btr_pcur_get_page_cur(cursor)); -} - -/*********************************************************//** -Moves the persistent cursor to the next record on the same page. */ -UNIV_INLINE -void -btr_pcur_move_to_next_on_page( -/*==========================*/ - btr_pcur_t* cursor) /*!< in/out: persistent cursor */ -{ - ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); - ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - - page_cur_move_to_next(btr_pcur_get_page_cur(cursor)); - - cursor->old_stored = false; -} - -/*********************************************************//** -Moves the persistent cursor to the previous record on the same page. */ -UNIV_INLINE -void -btr_pcur_move_to_prev_on_page( -/*==========================*/ - btr_pcur_t* cursor) /*!< in/out: persistent cursor */ -{ - ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); - ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - - page_cur_move_to_prev(btr_pcur_get_page_cur(cursor)); - - cursor->old_stored = false; -} - -/*********************************************************//** -Moves the persistent cursor to the next user record in the tree. If no user -records are left, the cursor ends up 'after last in tree'. -@return TRUE if the cursor moved forward, ending on a user record */ -UNIV_INLINE -ibool -btr_pcur_move_to_next_user_rec( -/*===========================*/ - btr_pcur_t* cursor, /*!< in: persistent cursor; NOTE that the - function may release the page latch */ - mtr_t* mtr) /*!< in: mtr */ -{ - ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); - ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - cursor->old_stored = false; -loop: - if (btr_pcur_is_after_last_on_page(cursor)) { - if (btr_pcur_is_after_last_in_tree(cursor)) { - return(FALSE); - } - - btr_pcur_move_to_next_page(cursor, mtr); - } else { - btr_pcur_move_to_next_on_page(cursor); - } - - if (btr_pcur_is_on_user_rec(cursor)) { - - return(TRUE); - } - - goto loop; -} - -/*********************************************************//** -Moves the persistent cursor to the next record in the tree. If no records are -left, the cursor stays 'after last in tree'. -@return TRUE if the cursor was not after last in tree */ -UNIV_INLINE -ibool -btr_pcur_move_to_next( -/*==================*/ - btr_pcur_t* cursor, /*!< in: persistent cursor; NOTE that the - function may release the page latch */ - mtr_t* mtr) /*!< in: mtr */ -{ - ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); - ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - - cursor->old_stored = false; - - if (btr_pcur_is_after_last_on_page(cursor)) { - if (btr_pcur_is_after_last_in_tree(cursor)) { - return(FALSE); - } - - btr_pcur_move_to_next_page(cursor, mtr); - return(TRUE); - } - - btr_pcur_move_to_next_on_page(cursor); - return(TRUE); -} - -/**************************************************************//** -Commits the mtr and sets the pcur latch mode to BTR_NO_LATCHES, -that is, the cursor becomes detached. -Function btr_pcur_store_position should be used before calling this, -if restoration of cursor is wanted later. */ -UNIV_INLINE -void -btr_pcur_commit_specify_mtr( -/*========================*/ - btr_pcur_t* pcur, /*!< in: persistent cursor */ - mtr_t* mtr) /*!< in: mtr to commit */ -{ - ut_ad(pcur->pos_state == BTR_PCUR_IS_POSITIONED); - - pcur->latch_mode = BTR_NO_LATCHES; - - mtr_commit(mtr); - - pcur->pos_state = BTR_PCUR_WAS_POSITIONED; -} - -/** Commits the mtr and sets the clustered index pcur and secondary index -pcur latch mode to BTR_NO_LATCHES, that is, the cursor becomes detached. -Function btr_pcur_store_position should be used for both cursor before -calling this, if restoration of cursor is wanted later. -@param[in] pcur persistent cursor -@param[in] sec_pcur secondary index persistent cursor -@param[in] mtr mtr to commit */ -UNIV_INLINE -void -btr_pcurs_commit_specify_mtr( - btr_pcur_t* pcur, - btr_pcur_t* sec_pcur, - mtr_t* mtr) -{ - ut_ad(pcur->pos_state == BTR_PCUR_IS_POSITIONED); - ut_ad(sec_pcur->pos_state == BTR_PCUR_IS_POSITIONED); - - pcur->latch_mode = BTR_NO_LATCHES; - sec_pcur->latch_mode = BTR_NO_LATCHES; - - mtr_commit(mtr); - - pcur->pos_state = BTR_PCUR_WAS_POSITIONED; - sec_pcur->pos_state = BTR_PCUR_WAS_POSITIONED; -} - -/**************************************************************//** -Sets the old_rec_buf field to NULL. */ -UNIV_INLINE -void -btr_pcur_init( -/*==========*/ - btr_pcur_t* pcur) /*!< in: persistent cursor */ -{ - pcur->old_stored = false; - pcur->old_rec_buf = NULL; - pcur->old_rec = NULL; - - pcur->btr_cur.rtr_info = NULL; -} - -/** Free old_rec_buf. -@param[in] pcur Persistent cursor holding old_rec to be freed. */ -UNIV_INLINE -void -btr_pcur_free( - btr_pcur_t* pcur) -{ - ut_free(pcur->old_rec_buf); -} - -/**************************************************************//** -Initializes and opens a persistent cursor to an index tree. It should be -closed with btr_pcur_close. */ -UNIV_INLINE -dberr_t -btr_pcur_open_low( -/*==============*/ - dict_index_t* index, /*!< in: index */ - ulint level, /*!< in: level in the btree */ - const dtuple_t* tuple, /*!< in: tuple on which search done */ - page_cur_mode_t mode, /*!< in: PAGE_CUR_L, ...; - NOTE that if the search is made using a unique - prefix of a record, mode should be - PAGE_CUR_LE, not PAGE_CUR_GE, as the latter - may end up on the previous page from the - record! */ - ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */ - btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ - ib_uint64_t autoinc,/*!< in: PAGE_ROOT_AUTO_INC to be written - (0 if none) */ - mtr_t* mtr) /*!< in: mtr */ -{ - btr_cur_t* btr_cursor; - dberr_t err = DB_SUCCESS; - - /* Initialize the cursor */ - - btr_pcur_init(cursor); - - cursor->latch_mode = BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode); - cursor->search_mode = mode; - - /* Search with the tree cursor */ - - btr_cursor = btr_pcur_get_btr_cur(cursor); - - ut_ad(!dict_index_is_spatial(index)); - - err = btr_cur_search_to_nth_level_func( - index, level, tuple, mode, latch_mode, btr_cursor, -#ifdef BTR_CUR_HASH_ADAPT - NULL, -#endif /* BTR_CUR_HASH_ADAPT */ - mtr, autoinc); - - if (UNIV_UNLIKELY(err != DB_SUCCESS)) { - ib::warn() << "btr_pcur_open_low" - << " level: " << level - << " table: " << index->table->name - << " index: " << index->name - << " error: " << err; - } - - cursor->pos_state = BTR_PCUR_IS_POSITIONED; - - cursor->trx_if_known = NULL; - - return(err); -} - -/**************************************************************//** -Opens an persistent cursor to an index tree without initializing the -cursor. */ -UNIV_INLINE -dberr_t -btr_pcur_open_with_no_init_func( -/*============================*/ - dict_index_t* index, /*!< in: index */ - const dtuple_t* tuple, /*!< in: tuple on which search done */ - page_cur_mode_t mode, /*!< in: PAGE_CUR_L, ...; - NOTE that if the search is made using a unique - prefix of a record, mode should be - PAGE_CUR_LE, not PAGE_CUR_GE, as the latter - may end up on the previous page of the - record! */ - ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ...; - NOTE that if ahi_latch then we might not - acquire a cursor page latch, but assume - that the ahi_latch protects the record! */ - btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ -#ifdef BTR_CUR_HASH_ADAPT - srw_spin_lock* ahi_latch, - /*!< in: currently held AHI rdlock, or NULL */ -#endif /* BTR_CUR_HASH_ADAPT */ - mtr_t* mtr) /*!< in: mtr */ -{ - btr_cur_t* btr_cursor; - dberr_t err = DB_SUCCESS; - - cursor->latch_mode = BTR_LATCH_MODE_WITHOUT_INTENTION(latch_mode); - cursor->search_mode = mode; - - /* Search with the tree cursor */ - - btr_cursor = btr_pcur_get_btr_cur(cursor); - - err = btr_cur_search_to_nth_level_func( - index, 0, tuple, mode, latch_mode, btr_cursor, -#ifdef BTR_CUR_HASH_ADAPT - ahi_latch, -#endif /* BTR_CUR_HASH_ADAPT */ - mtr); - - cursor->pos_state = BTR_PCUR_IS_POSITIONED; - - cursor->old_stored = false; - - cursor->trx_if_known = NULL; - return err; -} - -/*****************************************************************//** -Opens a persistent cursor at either end of an index. */ -UNIV_INLINE -dberr_t -btr_pcur_open_at_index_side( -/*========================*/ - bool from_left, /*!< in: true if open to the low end, - false if to the high end */ - dict_index_t* index, /*!< in: index */ - ulint latch_mode, /*!< in: latch mode */ - btr_pcur_t* pcur, /*!< in/out: cursor */ - bool init_pcur, /*!< in: whether to initialize pcur */ - ulint level, /*!< in: level to search for - (0=leaf) */ - mtr_t* mtr) /*!< in/out: mini-transaction */ -{ - dberr_t err = DB_SUCCESS; - - pcur->latch_mode = BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode); - - pcur->search_mode = from_left ? PAGE_CUR_G : PAGE_CUR_L; - - if (init_pcur) { - btr_pcur_init(pcur); - } - - err = btr_cur_open_at_index_side( - from_left, index, latch_mode, - btr_pcur_get_btr_cur(pcur), level, mtr); - pcur->pos_state = BTR_PCUR_IS_POSITIONED; - - pcur->old_stored = false; - - pcur->trx_if_known = NULL; - - return (err); -} - -/**********************************************************************//** -Positions a cursor at a randomly chosen position within a B-tree. -@return true if the index is available and we have put the cursor, false -if the index is unavailable */ -UNIV_INLINE -bool -btr_pcur_open_at_rnd_pos( - dict_index_t* index, /*!< in: index */ - ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ - btr_pcur_t* cursor, /*!< in/out: B-tree pcur */ - mtr_t* mtr) /*!< in: mtr */ -{ - /* Initialize the cursor */ - - cursor->latch_mode = latch_mode; - cursor->search_mode = PAGE_CUR_G; - - btr_pcur_init(cursor); - - bool available; - - available = btr_cur_open_at_rnd_pos(index, latch_mode, - btr_pcur_get_btr_cur(cursor), - mtr); - cursor->pos_state = BTR_PCUR_IS_POSITIONED; - cursor->old_stored = false; - - cursor->trx_if_known = NULL; - - return(available); -} - -/**************************************************************//** -Frees the possible memory heap of a persistent cursor and sets the latch -mode of the persistent cursor to BTR_NO_LATCHES. -WARNING: this function does not release the latch on the page where the -cursor is currently positioned. The latch is acquired by the -"move to next/previous" family of functions. Since recursive shared locks -are not allowed, you must take care (if using the cursor in S-mode) to -manually release the latch by either calling -btr_leaf_page_release(btr_pcur_get_block(&pcur), pcur.latch_mode, mtr) -or by committing the mini-transaction right after btr_pcur_close(). -A subsequent attempt to crawl the same page in the same mtr would cause -an assertion failure. */ -UNIV_INLINE -void -btr_pcur_close( -/*===========*/ - btr_pcur_t* cursor) /*!< in: persistent cursor */ -{ - ut_free(cursor->old_rec_buf); - - if (cursor->btr_cur.rtr_info) { - rtr_clean_rtr_info(cursor->btr_cur.rtr_info, true); - cursor->btr_cur.rtr_info = NULL; - } - - cursor->old_rec = NULL; - cursor->old_rec_buf = NULL; - cursor->btr_cur.page_cur.rec = NULL; - cursor->btr_cur.page_cur.block = NULL; - - cursor->old_rec = NULL; - cursor->old_stored = false; - - cursor->latch_mode = BTR_NO_LATCHES; - cursor->pos_state = BTR_PCUR_NOT_POSITIONED; - - cursor->trx_if_known = NULL; -} - -/*********************************************************//** -Moves the persistent cursor to the infimum record on the same page. */ -UNIV_INLINE -void -btr_pcur_move_before_first_on_page( -/*===============================*/ - btr_pcur_t* cursor) /*!< in/out: persistent cursor */ -{ - ut_ad(cursor->latch_mode != BTR_NO_LATCHES); - - page_cur_set_before_first(btr_pcur_get_block(cursor), - btr_pcur_get_page_cur(cursor)); - - cursor->old_stored = false; -} diff --git a/storage/innobase/include/btr0pcur.inl b/storage/innobase/include/btr0pcur.inl new file mode 100644 index 0000000000000..b827d70dc47bf --- /dev/null +++ b/storage/innobase/include/btr0pcur.inl @@ -0,0 +1,372 @@ +/***************************************************************************** + +Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2015, 2023, 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 02110-1335 USA + +*****************************************************************************/ + +/**************************************************//** +@file include/btr0pcur.ic +The index tree persistent cursor + +Created 2/23/1996 Heikki Tuuri +*******************************************************/ + + +/*********************************************************//** +Gets the rel_pos field for a cursor whose position has been stored. +@return BTR_PCUR_ON, ... */ +UNIV_INLINE +ulint +btr_pcur_get_rel_pos( +/*=================*/ + const btr_pcur_t* cursor) /*!< in: persistent cursor */ +{ + ut_ad(cursor); + ut_ad(cursor->old_rec); + ut_ad(cursor->pos_state == BTR_PCUR_WAS_POSITIONED + || cursor->pos_state == BTR_PCUR_IS_POSITIONED); + + return(cursor->rel_pos); +} + +/**************************************************************//** +Gets the up_match value for a pcur after a search. +@return number of matched fields at the cursor or to the right if +search mode was PAGE_CUR_GE, otherwise undefined */ +UNIV_INLINE +ulint +btr_pcur_get_up_match( +/*==================*/ + const btr_pcur_t* cursor) /*!< in: persistent cursor */ +{ + const btr_cur_t* btr_cursor; + + ut_ad((cursor->pos_state == BTR_PCUR_WAS_POSITIONED) + || (cursor->pos_state == BTR_PCUR_IS_POSITIONED)); + + btr_cursor = btr_pcur_get_btr_cur(cursor); + + ut_ad(btr_cursor->up_match != ULINT_UNDEFINED); + + return(btr_cursor->up_match); +} + +/**************************************************************//** +Gets the low_match value for a pcur after a search. +@return number of matched fields at the cursor or to the right if +search mode was PAGE_CUR_LE, otherwise undefined */ +UNIV_INLINE +ulint +btr_pcur_get_low_match( +/*===================*/ + const btr_pcur_t* cursor) /*!< in: persistent cursor */ +{ + const btr_cur_t* btr_cursor; + + ut_ad((cursor->pos_state == BTR_PCUR_WAS_POSITIONED) + || (cursor->pos_state == BTR_PCUR_IS_POSITIONED)); + + btr_cursor = btr_pcur_get_btr_cur(cursor); + ut_ad(btr_cursor->low_match != ULINT_UNDEFINED); + + return(btr_cursor->low_match); +} + +/*********************************************************//** +Checks if the persistent cursor is after the last user record on +a page. */ +UNIV_INLINE +ibool +btr_pcur_is_after_last_on_page( +/*===========================*/ + const btr_pcur_t* cursor) /*!< in: persistent cursor */ +{ + ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(cursor->latch_mode != BTR_NO_LATCHES); + + return(page_cur_is_after_last(btr_pcur_get_page_cur(cursor))); +} + +/*********************************************************//** +Checks if the persistent cursor is before the first user record on +a page. */ +UNIV_INLINE +ibool +btr_pcur_is_before_first_on_page( +/*=============================*/ + const btr_pcur_t* cursor) /*!< in: persistent cursor */ +{ + ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(cursor->latch_mode != BTR_NO_LATCHES); + + return(page_cur_is_before_first(btr_pcur_get_page_cur(cursor))); +} + +/*********************************************************//** +Checks if the persistent cursor is on a user record. */ +UNIV_INLINE +ibool +btr_pcur_is_on_user_rec( +/*====================*/ + const btr_pcur_t* cursor) /*!< in: persistent cursor */ +{ + return !btr_pcur_is_before_first_on_page(cursor) && + !btr_pcur_is_after_last_on_page(cursor); +} + +/*********************************************************//** +Checks if the persistent cursor is before the first user record in +the index tree. */ +static inline bool btr_pcur_is_before_first_in_tree(btr_pcur_t* cursor) +{ + ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(cursor->latch_mode != BTR_NO_LATCHES); + + return !page_has_prev(btr_pcur_get_page(cursor)) + && page_cur_is_before_first(btr_pcur_get_page_cur(cursor)); +} + +/*********************************************************//** +Checks if the persistent cursor is after the last user record in +the index tree. */ +static inline bool btr_pcur_is_after_last_in_tree(btr_pcur_t* cursor) +{ + ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(cursor->latch_mode != BTR_NO_LATCHES); + + return !page_has_next(btr_pcur_get_page(cursor)) + && page_cur_is_after_last(btr_pcur_get_page_cur(cursor)); +} + +/*********************************************************//** +Moves the persistent cursor to the next record on the same page. */ +UNIV_INLINE +rec_t* +btr_pcur_move_to_next_on_page( +/*==========================*/ + btr_pcur_t* cursor) /*!< in/out: persistent cursor */ +{ + ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(cursor->latch_mode != BTR_NO_LATCHES); + + cursor->old_rec = nullptr; + return page_cur_move_to_next(btr_pcur_get_page_cur(cursor)); +} + +/*********************************************************//** +Moves the persistent cursor to the previous record on the same page. */ +UNIV_INLINE +rec_t* +btr_pcur_move_to_prev_on_page( +/*==========================*/ + btr_pcur_t* cursor) /*!< in/out: persistent cursor */ +{ + ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(cursor->latch_mode != BTR_NO_LATCHES); + cursor->old_rec = nullptr; + + return page_cur_move_to_prev(btr_pcur_get_page_cur(cursor)); +} + +/*********************************************************//** +Moves the persistent cursor to the next user record in the tree. If no user +records are left, the cursor ends up 'after last in tree'. +@return TRUE if the cursor moved forward, ending on a user record */ +UNIV_INLINE +ibool +btr_pcur_move_to_next_user_rec( +/*===========================*/ + btr_pcur_t* cursor, /*!< in: persistent cursor; NOTE that the + function may release the page latch */ + mtr_t* mtr) /*!< in: mtr */ +{ + ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(cursor->latch_mode != BTR_NO_LATCHES); + cursor->old_rec = nullptr; +loop: + if (btr_pcur_is_after_last_on_page(cursor)) { + if (btr_pcur_is_after_last_in_tree(cursor) + || btr_pcur_move_to_next_page(cursor, mtr) != DB_SUCCESS) { + return(FALSE); + } + } else if (UNIV_UNLIKELY(!btr_pcur_move_to_next_on_page(cursor))) { + return false; + } + + if (btr_pcur_is_on_user_rec(cursor)) { + + return(TRUE); + } + + goto loop; +} + +/*********************************************************//** +Moves the persistent cursor to the next record in the tree. If no records are +left, the cursor stays 'after last in tree'. +@return TRUE if the cursor was not after last in tree */ +UNIV_INLINE +ibool +btr_pcur_move_to_next( +/*==================*/ + btr_pcur_t* cursor, /*!< in: persistent cursor; NOTE that the + function may release the page latch */ + mtr_t* mtr) /*!< in: mtr */ +{ + ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(cursor->latch_mode != BTR_NO_LATCHES); + + cursor->old_rec= nullptr; + + if (btr_pcur_is_after_last_on_page(cursor)) + return !btr_pcur_is_after_last_in_tree(cursor) && + btr_pcur_move_to_next_page(cursor, mtr) == DB_SUCCESS; + else + return !!btr_pcur_move_to_next_on_page(cursor); +} + +/**************************************************************//** +Commits the mtr and sets the pcur latch mode to BTR_NO_LATCHES, +that is, the cursor becomes detached. +Function btr_pcur_store_position should be used before calling this, +if restoration of cursor is wanted later. */ +UNIV_INLINE +void +btr_pcur_commit_specify_mtr( +/*========================*/ + btr_pcur_t* pcur, /*!< in: persistent cursor */ + mtr_t* mtr) /*!< in: mtr to commit */ +{ + ut_ad(pcur->pos_state == BTR_PCUR_IS_POSITIONED); + + pcur->latch_mode = BTR_NO_LATCHES; + + mtr_commit(mtr); + + pcur->pos_state = BTR_PCUR_WAS_POSITIONED; +} + +/** Commits the mtr and sets the clustered index pcur and secondary index +pcur latch mode to BTR_NO_LATCHES, that is, the cursor becomes detached. +Function btr_pcur_store_position should be used for both cursor before +calling this, if restoration of cursor is wanted later. +@param[in] pcur persistent cursor +@param[in] sec_pcur secondary index persistent cursor +@param[in] mtr mtr to commit */ +UNIV_INLINE +void +btr_pcurs_commit_specify_mtr( + btr_pcur_t* pcur, + btr_pcur_t* sec_pcur, + mtr_t* mtr) +{ + ut_ad(pcur->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(sec_pcur->pos_state == BTR_PCUR_IS_POSITIONED); + + pcur->latch_mode = BTR_NO_LATCHES; + sec_pcur->latch_mode = BTR_NO_LATCHES; + + mtr_commit(mtr); + + pcur->pos_state = BTR_PCUR_WAS_POSITIONED; + sec_pcur->pos_state = BTR_PCUR_WAS_POSITIONED; +} + +/**************************************************************//** +Sets the old_rec_buf field to NULL. */ +UNIV_INLINE +void +btr_pcur_init( +/*==========*/ + btr_pcur_t* pcur) /*!< in: persistent cursor */ +{ + pcur->old_rec_buf = NULL; + pcur->old_rec = NULL; + + pcur->btr_cur.rtr_info = NULL; +} + +/** Opens an persistent cursor to an index tree without initializing the +cursor. +@param tuple tuple on which search done +@param mode search mode; NOTE that if the search is made using a + unique prefix of a record, mode should be PAGE_CUR_LE, not + PAGE_CUR_GE, as the latter may end up on the previous page of + the record! +@param latch_mode BTR_SEARCH_LEAF, ... +@param cursor memory buffer for persistent cursor +@param mtr mini-transaction +@return DB_SUCCESS on success or error code otherwise. */ +inline +dberr_t btr_pcur_open_with_no_init(const dtuple_t *tuple, page_cur_mode_t mode, + btr_latch_mode latch_mode, + btr_pcur_t *cursor, mtr_t *mtr) +{ + cursor->latch_mode= BTR_LATCH_MODE_WITHOUT_INTENTION(latch_mode); + cursor->search_mode= mode; + cursor->pos_state= BTR_PCUR_IS_POSITIONED; + cursor->trx_if_known= nullptr; + return cursor->btr_cur.search_leaf(tuple, mode, latch_mode, mtr); +} + +/**************************************************************//** +Frees the possible memory heap of a persistent cursor and sets the latch +mode of the persistent cursor to BTR_NO_LATCHES. +WARNING: this function does not release the latch on the page where the +cursor is currently positioned. The latch is acquired by the +"move to next/previous" family of functions. Since recursive shared locks +are not allowed, you must take care (if using the cursor in S-mode) to +manually release the latch by either calling +btr_leaf_page_release(btr_pcur_get_block(&pcur), pcur.latch_mode, mtr) +or by mtr_t::commit(). */ +UNIV_INLINE +void +btr_pcur_close( +/*===========*/ + btr_pcur_t* cursor) /*!< in: persistent cursor */ +{ + ut_free(cursor->old_rec_buf); + + if (cursor->btr_cur.rtr_info) + rtr_clean_rtr_info(cursor->btr_cur.rtr_info, true); + + cursor->btr_cur.rtr_info= nullptr; + cursor->old_rec = nullptr; + cursor->old_rec_buf = nullptr; + cursor->btr_cur.page_cur.rec = nullptr; + cursor->btr_cur.page_cur.block = nullptr; + + cursor->latch_mode = BTR_NO_LATCHES; + cursor->pos_state = BTR_PCUR_NOT_POSITIONED; + + cursor->trx_if_known = nullptr; +} + +/*********************************************************//** +Moves the persistent cursor to the infimum record on the same page. */ +UNIV_INLINE +void +btr_pcur_move_before_first_on_page( +/*===============================*/ + btr_pcur_t* cursor) /*!< in/out: persistent cursor */ +{ + ut_ad(cursor->latch_mode != BTR_NO_LATCHES); + + page_cur_set_before_first(btr_pcur_get_block(cursor), + btr_pcur_get_page_cur(cursor)); + + cursor->old_rec = nullptr; +} diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h index b45183a642847..48e4fadab9b46 100644 --- a/storage/innobase/include/btr0sea.h +++ b/storage/innobase/include/btr0sea.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -63,15 +63,9 @@ both have sensible values. @param[in,out] info index search info @param[in] tuple logical record @param[in] mode PAGE_CUR_L, .... -@param[in] latch_mode BTR_SEARCH_LEAF, ...; - NOTE that only if has_search_latch is 0, we will - have a latch set on the cursor page, otherwise - we assume the caller uses his search latch - to protect the record! +@param[in] latch_mode BTR_SEARCH_LEAF, ... @param[out] cursor tree cursor -@param[in] ahi_latch the adaptive hash index latch being held, - or NULL -@param[in] mtr mini transaction +@param[in] mtr mini-transaction @return whether the search succeeded */ bool btr_search_guess_on_hash( @@ -81,7 +75,6 @@ btr_search_guess_on_hash( ulint mode, ulint latch_mode, btr_cur_t* cursor, - srw_spin_lock* ahi_latch, mtr_t* mtr); /** Move or delete hash entries for moved records, usually in a page split. @@ -100,8 +93,11 @@ btr_search_move_or_delete_hash_entries( index page for which we know that block->buf_fix_count == 0 or it is an index page which has already been removed from the buf_pool.page_hash - i.e.: it is in state BUF_BLOCK_REMOVE_HASH */ -void btr_search_drop_page_hash_index(buf_block_t* block); + i.e.: it is in state BUF_BLOCK_REMOVE_HASH +@param[in] garbage_collect drop ahi only if the index is marked + as freed */ +void btr_search_drop_page_hash_index(buf_block_t* block, + bool garbage_collect); /** Drop possible adaptive hash index entries when a page is evicted from the buffer pool or freed in a file, or the index is being dropped. @@ -146,16 +142,23 @@ static inline void btr_search_s_lock_all(); /** Unlock all search latches from shared mode. */ static inline void btr_search_s_unlock_all(); +# ifdef UNIV_DEBUG +/** @return if the index is marked as freed */ +bool btr_search_check_marked_free_index(const buf_block_t *block); +# endif /* UNIV_DEBUG */ #else /* BTR_CUR_HASH_ADAPT */ # define btr_search_sys_create() # define btr_search_sys_free() -# define btr_search_drop_page_hash_index(block) +# define btr_search_drop_page_hash_index(block, garbage_collect) # define btr_search_s_lock_all(index) # define btr_search_s_unlock_all(index) # define btr_search_info_update(index, cursor) # define btr_search_move_or_delete_hash_entries(new_block, block) # define btr_search_update_hash_on_insert(cursor, ahi_latch) # define btr_search_update_hash_on_delete(cursor) +# ifdef UNIV_DEBUG +# define btr_search_check_marked_free_index(block) +# endif /* UNIV_DEBUG */ #endif /* BTR_CUR_HASH_ADAPT */ #ifdef BTR_CUR_ADAPT @@ -394,6 +397,6 @@ again set this much timeout. This is to reduce contention. */ #define BTR_SEA_TIMEOUT 10000 #endif /* BTR_CUR_HASH_ADAPT */ -#include "btr0sea.ic" +#include "btr0sea.inl" #endif diff --git a/storage/innobase/include/btr0sea.ic b/storage/innobase/include/btr0sea.inl similarity index 100% rename from storage/innobase/include/btr0sea.ic rename to storage/innobase/include/btr0sea.inl diff --git a/storage/innobase/include/btr0types.h b/storage/innobase/include/btr0types.h index 83c374e2561d3..fc829e7857a37 100644 --- a/storage/innobase/include/btr0types.h +++ b/storage/innobase/include/btr0types.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2019, MariaDB Corporation. +Copyright (c) 2018, 2023, 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 @@ -24,8 +24,7 @@ The index tree general types Created 2/17/1996 Heikki Tuuri *************************************************************************/ -#ifndef btr0types_h -#define btr0types_h +#pragma once #include "page0types.h" #include "rem0types.h" @@ -56,4 +55,100 @@ in the index record. */ #define BTR_EXTERN_LOCAL_STORED_MAX_SIZE \ (BTR_EXTERN_FIELD_REF_SIZE * 2) -#endif +/** Latching modes for btr_cur_t::search_leaf(). */ +enum btr_latch_mode { + /** Search a record on a leaf page and S-latch it. */ + BTR_SEARCH_LEAF = RW_S_LATCH, + /** (Prepare to) modify a record on a leaf page and X-latch it. */ + BTR_MODIFY_LEAF = RW_X_LATCH, + /** U-latch root and X-latch a leaf page */ + BTR_MODIFY_ROOT_AND_LEAF = RW_SX_LATCH, + /** Obtain no latches. */ + BTR_NO_LATCHES = RW_NO_LATCH, + /** Search the previous record. + Used in btr_pcur_move_backward_from_page(). */ + BTR_SEARCH_PREV = 4 | BTR_SEARCH_LEAF, + /** Modify the previous record. + Used in btr_pcur_move_backward_from_page() and ibuf_insert(). */ + BTR_MODIFY_PREV = 4 | BTR_MODIFY_LEAF, + /** Start modifying the entire B-tree. */ + BTR_MODIFY_TREE = 8 | BTR_MODIFY_LEAF, + /** Continue modifying the entire R-tree. + Only used by rtr_search_to_nth_level(). */ + BTR_CONT_MODIFY_TREE = 4 | BTR_MODIFY_TREE, + + /* BTR_INSERT, BTR_DELETE and BTR_DELETE_MARK are mutually + exclusive. */ + /** The search tuple will be inserted to the secondary index + at the searched position. When the leaf page is not in the + buffer pool, try to use the change buffer. */ + BTR_INSERT = 64, + + /** Try to delete mark a secondary index leaf page record at + the searched position using the change buffer when the page is + not in the buffer pool. */ + BTR_DELETE_MARK = 128, + + /** Try to purge the record using the change buffer when the + secondary index leaf page is not in the buffer pool. */ + BTR_DELETE = BTR_INSERT | BTR_DELETE_MARK, + + /** The caller is already holding dict_index_t::lock S-latch. */ + BTR_ALREADY_S_LATCHED = 256, + /** Search and S-latch a leaf page, assuming that the + dict_index_t::lock S-latch is being held. */ + BTR_SEARCH_LEAF_ALREADY_S_LATCHED = BTR_SEARCH_LEAF + | BTR_ALREADY_S_LATCHED, + /** Search and X-latch a leaf page, assuming that the + dict_index_t::lock is being held in non-exclusive mode. */ + BTR_MODIFY_LEAF_ALREADY_LATCHED = BTR_MODIFY_LEAF + | BTR_ALREADY_S_LATCHED, + /** Attempt to modify records in an x-latched tree. */ + BTR_MODIFY_TREE_ALREADY_LATCHED = BTR_MODIFY_TREE + | BTR_ALREADY_S_LATCHED, + /** U-latch root and X-latch a leaf page, assuming that + dict_index_t::lock is being held in U mode. */ + BTR_MODIFY_ROOT_AND_LEAF_ALREADY_LATCHED = BTR_MODIFY_ROOT_AND_LEAF + | BTR_ALREADY_S_LATCHED, + + /** Attempt to delete-mark a secondary index record. */ + BTR_DELETE_MARK_LEAF = BTR_MODIFY_LEAF | BTR_DELETE_MARK, + /** Attempt to delete-mark a secondary index record + while holding the dict_index_t::lock S-latch. */ + BTR_DELETE_MARK_LEAF_ALREADY_S_LATCHED = BTR_DELETE_MARK_LEAF + | BTR_ALREADY_S_LATCHED, + /** Attempt to purge a secondary index record. */ + BTR_PURGE_LEAF = BTR_MODIFY_LEAF | BTR_DELETE, + /** Attempt to purge a secondary index record + while holding the dict_index_t::lock S-latch. */ + BTR_PURGE_LEAF_ALREADY_S_LATCHED = BTR_PURGE_LEAF + | BTR_ALREADY_S_LATCHED, + + /** In the case of BTR_MODIFY_TREE, the caller specifies + the intention to delete record only. It is used to optimize + block->lock range.*/ + BTR_LATCH_FOR_DELETE = 512, + + /** In the case of BTR_MODIFY_TREE, the caller specifies + the intention to delete record only. It is used to optimize + block->lock range.*/ + BTR_LATCH_FOR_INSERT = 1024, + + /** Attempt to delete a record in the tree. */ + BTR_PURGE_TREE = BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE, + /** Attempt to delete a record in an x-latched tree. */ + BTR_PURGE_TREE_ALREADY_LATCHED = BTR_PURGE_TREE + | BTR_ALREADY_S_LATCHED, + + /** Attempt to insert a record into the tree. */ + BTR_INSERT_TREE = BTR_MODIFY_TREE | BTR_LATCH_FOR_INSERT, + + /** This flag ORed to BTR_INSERT says that we can ignore possible + UNIQUE definition on secondary indexes when we decide if we can use + the insert buffer to speed up inserts */ + BTR_IGNORE_SEC_UNIQUE = 2048, + /** Rollback in spatial index */ + BTR_RTREE_UNDO_INS = 4096, + /** Try to delete mark a spatial index record */ + BTR_RTREE_DELETE_MARK = 8192 +}; diff --git a/storage/innobase/include/buf0buddy.h b/storage/innobase/include/buf0buddy.h index cba310744135e..bb9994203d6b0 100644 --- a/storage/innobase/include/buf0buddy.h +++ b/storage/innobase/include/buf0buddy.h @@ -88,5 +88,4 @@ bool buf_buddy_realloc(void* buf, ulint size); /** Combine all pairs of free buddies. */ void buf_buddy_condense_free(); - #endif /* buf0buddy_h */ diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 3fb61639e841a..4295c3ba34263 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2022, 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 @@ -24,8 +24,7 @@ The database buffer pool high-level routines Created 11/5/1995 Heikki Tuuri *******************************************************/ -#ifndef buf0buf_h -#define buf0buf_h +#pragma once /** Magic value to use instead of checksums when they are disabled */ #define BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL @@ -43,21 +42,12 @@ Created 11/5/1995 Heikki Tuuri #include "transactional_lock_guard.h" #include -// Forward declaration -struct fil_addr_t; - /** @name Modes for buf_page_get_gen */ /* @{ */ #define BUF_GET 10 /*!< get always */ #define BUF_GET_IF_IN_POOL 11 /*!< get if in pool */ #define BUF_PEEK_IF_IN_POOL 12 /*!< get if in pool, do not make the block young in the LRU list */ -#define BUF_GET_NO_LATCH 14 /*!< get and bufferfix, but - set no latch; we have - separated this case, because - it is error-prone programming - not to set a latch, and it - should be used with care */ #define BUF_GET_IF_IN_POOL_OR_WATCH 15 /*!< Get the page only if it's in the buffer pool, if not then set a watch @@ -65,9 +55,14 @@ struct fil_addr_t; #define BUF_GET_POSSIBLY_FREED 16 /*!< Like BUF_GET, but do not mind if the file page has been freed. */ -#define BUF_EVICT_IF_IN_POOL 20 /*!< evict a clean block if found */ /* @} */ +/** If LRU list of a buf_pool is less than this size then LRU eviction +should not happen. This is because when we do LRU flushing we also put +the blocks on free list. If LRU list is very small then we can end up +in thrashing. */ +#define BUF_LRU_MIN_LEN 256 + /** This structure defines information we will fetch from each buffer pool. It will be used to print table IO stats */ struct buf_pool_info_t @@ -161,21 +156,9 @@ buf_block_free( /*===========*/ buf_block_t* block); /*!< in, own: block to be freed */ -/**************************************************************//** -NOTE! The following macros should be used instead of buf_page_get_gen, -to improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed -in LA! */ #define buf_page_get(ID, SIZE, LA, MTR) \ buf_page_get_gen(ID, SIZE, LA, NULL, BUF_GET, MTR) -/**************************************************************//** -Use these macros to bufferfix a page with no latching. Remember not to -read the contents of the page unless you know it is safe. Do not modify -the contents of the page! We have separated this case, because it is -error-prone programming not to set a latch, and it should be used -with care. */ -#define buf_page_get_with_no_latch(ID, SIZE, MTR) \ - buf_page_get_gen(ID, SIZE, RW_NO_LATCH, NULL, BUF_GET_NO_LATCH, MTR) /** Try to acquire a page latch. @param rw_latch RW_S_LATCH or RW_X_LATCH @param block guessed block @@ -211,8 +194,8 @@ buf_page_t *buf_page_get_zip(const page_id_t page_id, ulint zip_size); @param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH @param[in] guess guessed block or NULL @param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, -BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH -@param[in] mtr mini-transaction +BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH +@param[in,out] mtr mini-transaction @param[out] err DB_SUCCESS or error code @param[in] allow_ibuf_merge Allow change buffer merge while reading the pages from file. @@ -226,7 +209,8 @@ buf_page_get_gen( ulint mode, mtr_t* mtr, dberr_t* err = NULL, - bool allow_ibuf_merge = false); + bool allow_ibuf_merge = false) + MY_ATTRIBUTE((nonnull(6), warn_unused_result)); /** This is the low level function used to get access to a database page. @param[in] page_id page id @@ -234,8 +218,9 @@ buf_page_get_gen( @param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH @param[in] guess guessed block or NULL @param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, -BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH -@param[in] mtr mini-transaction +BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH +@param[in,out] mtr mini-transaction, or NULL if a + block with page_id is to be evicted @param[out] err DB_SUCCESS or error code @param[in] allow_ibuf_merge Allow change buffer merge to happen while reading the page from file @@ -344,27 +329,6 @@ bool buf_page_is_corrupted(bool check_lsn, const byte *read_buf, uint32_t fsp_flags) MY_ATTRIBUTE((warn_unused_result)); -inline void *aligned_malloc(size_t size, size_t align) -{ -#ifdef _MSC_VER - return _aligned_malloc(size, align); -#else - void *result; - if (posix_memalign(&result, align, size)) - result= NULL; - return result; -#endif -} - -inline void aligned_free(void *ptr) -{ -#ifdef _MSC_VER - _aligned_free(ptr); -#else - free(ptr); -#endif -} - /** Read the key version from the page. In full crc32 format, key version is stored at {0-3th} bytes. In other format, it is stored in 26th position. @@ -484,7 +448,6 @@ ATTRIBUTE_COLD void buf_page_monitor(const buf_page_t &bpage, bool read); if needed. @param[in] size size in bytes @return aligned size */ -UNIV_INLINE ulint buf_pool_size_align( ulint size); @@ -757,13 +720,14 @@ class buf_page_t ut_ad(s < REINIT); } - void read_unfix(uint32_t s) + uint32_t read_unfix(uint32_t s) { ut_ad(lock.is_write_locked()); ut_ad(s == UNFIXED + 1 || s == IBUF_EXIST + 1 || s == REINIT + 1); - ut_d(auto old_state=) zip.fix.fetch_add(s - READ_FIX); + uint32_t old_state= zip.fix.fetch_add(s - READ_FIX); ut_ad(old_state >= READ_FIX); ut_ad(old_state < WRITE_FIX); + return old_state + (s - READ_FIX); } void set_freed(uint32_t prev_state, uint32_t count= 0) @@ -806,25 +770,26 @@ class buf_page_t @param node data file @return whether the operation succeeded @retval DB_PAGE_CORRUPTED if the checksum fails - @retval DB_DECRYPTION_FAILED if the page cannot be decrypted */ + @retval DB_DECRYPTION_FAILED if the page cannot be decrypted + @retval DB_FAIL if the page contains the wrong ID */ dberr_t read_complete(const fil_node_t &node); /** Note that a block is no longer dirty, while not removing it from buf_pool.flush_list */ inline void write_complete(bool temporary); - /** Write a flushable page to a file. buf_pool.mutex must be held. - @param lru true=buf_pool.LRU; false=buf_pool.flush_list + /** Write a flushable page to a file or free a freeable block. + @param evict whether to evict the page on write completion @param space tablespace - @return whether the page was flushed and buf_pool.mutex was released */ - inline bool flush(bool lru, fil_space_t *space); + @return whether a page write was initiated and buf_pool.mutex released */ + bool flush(bool evict, fil_space_t *space); /** Notify that a page in a temporary tablespace has been modified. */ void set_temp_modified() { ut_ad(fsp_is_system_temporary(id().space())); ut_ad(in_file()); - ut_ad(!oldest_modification()); + ut_ad((oldest_modification() | 2) == 2); oldest_modification_= 2; } @@ -887,8 +852,6 @@ class buf_page_t /** @return whether the block is mapped to a data file */ bool in_file() const { return state() >= FREED; } - /** @return whether the block is modified and ready for flushing */ - inline bool ready_for_flush() const; /** @return whether the block can be relocated in memory. The block can be dirty, but it must not be I/O-fixed or bufferfixed. */ inline bool can_relocate() const; @@ -1061,14 +1024,14 @@ Compute the hash fold value for blocks in buf_pool.zip_hash. */ #define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b)) /* @} */ -/** A "Hazard Pointer" class used to iterate over page lists -inside the buffer pool. A hazard pointer is a buf_page_t pointer +/** A "Hazard Pointer" class used to iterate over buf_pool.LRU or +buf_pool.flush_list. A hazard pointer is a buf_page_t pointer which we intend to iterate over next and we want it remain valid -even after we release the buffer pool mutex. */ +even after we release the mutex that protects the list. */ class HazardPointer { public: - virtual ~HazardPointer() {} + virtual ~HazardPointer() = default; /** @return current value */ buf_page_t *get() const { mysql_mutex_assert_owner(m_mutex); return m_hp; } @@ -1107,16 +1070,15 @@ class HazardPointer class FlushHp : public HazardPointer { public: - ~FlushHp() override {} + ~FlushHp() override = default; /** Adjust the value of hp. This happens when some other thread working on the same list attempts to remove the hp from the list. @param bpage buffer block to be compared */ + MY_ATTRIBUTE((nonnull)) void adjust(const buf_page_t *bpage) override { - ut_ad(bpage != NULL); - /* We only support reverse traversal for now. */ if (is_hp(bpage)) m_hp= UT_LIST_GET_PREV(list, m_hp); @@ -1128,15 +1090,15 @@ class FlushHp : public HazardPointer /** Class implementing buf_pool.LRU hazard pointer */ class LRUHp : public HazardPointer { public: - ~LRUHp() override {} + ~LRUHp() override = default; /** Adjust the value of hp. This happens when some other thread working on the same list attempts to remove the hp from the list. @param bpage buffer block to be compared */ + MY_ATTRIBUTE((nonnull)) void adjust(const buf_page_t *bpage) override { - ut_ad(bpage); /** We only support reverse traversal for now. */ if (is_hp(bpage)) m_hp= UT_LIST_GET_PREV(LRU, m_hp); @@ -1151,8 +1113,7 @@ itr in that position and the other thread can start scan from there */ class LRUItr : public LRUHp { public: - LRUItr() : LRUHp() {} - ~LRUItr() override {} + ~LRUItr() override = default; /** Select from where to start a scan. If we have scanned too deep into the LRU list it resets the value to the tail @@ -1181,7 +1142,8 @@ struct buf_buddy_free_t { /*!< Node of zip_free list */ }; -/** @brief The buffer pool statistics structure. */ +/** @brief The buffer pool statistics structure; +protected by buf_pool.mutex unless otherwise noted. */ struct buf_pool_stat_t{ /** Initialize the counters */ void init() { memset((void*) this, 0, sizeof *this); } @@ -1190,9 +1152,8 @@ struct buf_pool_stat_t{ /*!< number of page gets performed; also successful searches through the adaptive hash index are - counted as page gets; this field - is NOT protected by the buffer - pool mutex */ + counted as page gets; + NOT protected by buf_pool.mutex */ ulint n_pages_read; /*!< number read operations */ ulint n_pages_written;/*!< number write operations */ ulint n_pages_created;/*!< number of pages created @@ -1210,10 +1171,9 @@ struct buf_pool_stat_t{ young because the first access was not long enough ago, in buf_page_peek_if_too_old() */ - /** number of waits for eviction; writes protected by buf_pool.mutex */ + /** number of waits for eviction */ ulint LRU_waits; ulint LRU_bytes; /*!< LRU size in bytes */ - ulint flush_list_bytes;/*!< flush_list size in bytes */ }; /** Statistics of buddy blocks of a given size. */ @@ -1339,7 +1299,7 @@ class buf_pool_t { ut_ad(is_initialised()); size_t size= 0; - for (auto j= n_chunks; j--; ) + for (auto j= ut_min(n_chunks_new, n_chunks); j--; ) size+= chunks[j].size; return size; } @@ -1349,7 +1309,7 @@ class buf_pool_t @return whether the frame will be withdrawn */ bool will_be_withdrawn(const byte *ptr) const { - ut_ad(curr_size < old_size); + ut_ad(n_chunks_new < n_chunks); #ifdef SAFE_MUTEX if (resize_in_progress()) mysql_mutex_assert_owner(&mutex); @@ -1369,7 +1329,7 @@ class buf_pool_t @return whether the frame will be withdrawn */ bool will_be_withdrawn(const buf_page_t &bpage) const { - ut_ad(curr_size < old_size); + ut_ad(n_chunks_new < n_chunks); #ifdef SAFE_MUTEX if (resize_in_progress()) mysql_mutex_assert_owner(&mutex); @@ -1385,8 +1345,9 @@ class buf_pool_t } /** Release and evict a corrupted page. - @param bpage page that was being read */ - ATTRIBUTE_COLD void corrupted_evict(buf_page_t *bpage); + @param bpage x-latched page that was found corrupted + @param state expected current state of the page */ + ATTRIBUTE_COLD void corrupted_evict(buf_page_t *bpage, uint32_t state); /** Release a memory block to the buffer pool. */ ATTRIBUTE_COLD void free_block(buf_block_t *block); @@ -1503,14 +1464,12 @@ class buf_pool_t return !watch_is_sentinel(*page_hash.get(id, chain)); } - /** Register a watch for a page identifier. The caller must hold an - exclusive page hash latch. The *hash_lock may be released, - relocated, and reacquired. + /** Register a watch for a page identifier. @param id page identifier - @param chain hash table chain with exclusively held page_hash - @return a buffer pool block corresponding to id - @retval nullptr if the block was not present, and a watch was installed */ - inline buf_page_t *watch_set(const page_id_t id, hash_chain &chain); + @param chain page_hash.cell_get(id.fold()) + @return a buffer page corresponding to id + @retval nullptr if the block was not present in page_hash */ + buf_page_t *watch_set(const page_id_t id, hash_chain &chain); /** Stop watching whether a page has been read in. watch_set(id) must have returned nullptr before. @@ -1521,16 +1480,29 @@ class buf_pool_t /** Remove the sentinel block for the watch before replacing it with a real block. watch_unset() or watch_occurred() will notice that the block has been replaced with the real block. - @param watch sentinel - @param chain locked hash table chain */ - inline void watch_remove(buf_page_t *watch, hash_chain &chain); + @param w sentinel + @param chain locked hash table chain + @return w->state() */ + inline uint32_t watch_remove(buf_page_t *w, hash_chain &chain); /** @return whether less than 1/4 of the buffer pool is available */ + TPOOL_SUPPRESS_TSAN bool running_out() const { return !recv_recovery_is_on() && - UNIV_UNLIKELY(UT_LIST_GET_LEN(free) + UT_LIST_GET_LEN(LRU) < - std::min(curr_size, old_size) / 4); + UT_LIST_GET_LEN(free) + UT_LIST_GET_LEN(LRU) < + n_chunks_new / 4 * chunks->size; + } + + /** @return whether the buffer pool has run out */ + TPOOL_SUPPRESS_TSAN + bool ran_out() const + { return UNIV_UNLIKELY(!try_LRU_scan || !UT_LIST_GET_LEN(free)); } + + /** @return whether the buffer pool is shrinking */ + inline bool is_shrinking() const + { + return n_chunks_new < n_chunks; } #ifdef UNIV_DEBUG @@ -1563,18 +1535,11 @@ class buf_pool_t static constexpr uint32_t READ_AHEAD_PAGES= 64; /** Buffer pool mutex */ - MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) mysql_mutex_t mutex; - /** Number of pending LRU flush; protected by mutex. */ - ulint n_flush_LRU_; - /** broadcast when n_flush_LRU reaches 0; protected by mutex */ - pthread_cond_t done_flush_LRU; - /** Number of pending flush_list flush; protected by mutex */ - ulint n_flush_list_; - /** broadcast when n_flush_list reaches 0; protected by mutex */ - pthread_cond_t done_flush_list; - - TPOOL_SUPPRESS_TSAN ulint n_flush_LRU() const { return n_flush_LRU_; } - TPOOL_SUPPRESS_TSAN ulint n_flush_list() const { return n_flush_list_; } + alignas(CPU_LEVEL1_DCACHE_LINESIZE) mysql_mutex_t mutex; + /** current statistics; protected by mutex */ + buf_pool_stat_t stat; + /** old statistics; protected by mutex */ + buf_pool_stat_t old_stat; /** @name General fields */ /* @{ */ @@ -1589,15 +1554,15 @@ class buf_pool_t ut_allocator allocator; /*!< Allocator used for allocating memory for the the "chunks" member. */ - volatile ulint n_chunks; /*!< number of buffer pool chunks */ - volatile ulint n_chunks_new; /*!< new number of buffer pool chunks */ + ulint n_chunks; /*!< number of buffer pool chunks */ + ulint n_chunks_new; /*!< new number of buffer pool chunks. + both n_chunks{,new} are protected under + mutex */ chunk_t* chunks; /*!< buffer pool chunks */ chunk_t* chunks_old; /*!< old buffer pool chunks to be freed after resizing buffer pool */ /** current pool size in pages */ Atomic_counter curr_size; - /** previous pool size in pages */ - Atomic_counter old_size; /** read-ahead request size in pages */ Atomic_counter read_ahead_area; @@ -1724,8 +1689,6 @@ class buf_pool_t /** map of block->frame to buf_block_t blocks that belong to buf_buddy_alloc(); protected by buf_pool.mutex */ hash_table_t zip_hash; - /** number of pending read operations */ - Atomic_counter n_pend_reads; Atomic_counter n_pend_unzip; /*!< number of pending decompressions */ @@ -1735,44 +1698,96 @@ class buf_pool_t buf_buddy_stat_t buddy_stat[BUF_BUDDY_SIZES_MAX + 1]; /*!< Statistics of buddy system, indexed by block size */ - buf_pool_stat_t stat; /*!< current statistics */ - buf_pool_stat_t old_stat; /*!< old statistics */ /* @} */ + /** number of index page splits */ + Atomic_counter pages_split; + /** @name Page flushing algorithm fields */ /* @{ */ /** mutex protecting flush_list, buf_page_t::set_oldest_modification() and buf_page_t::list pointers when !oldest_modification() */ - MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) mysql_mutex_t flush_list_mutex; + alignas(CPU_LEVEL1_DCACHE_LINESIZE) mysql_mutex_t flush_list_mutex; /** "hazard pointer" for flush_list scans; protected by flush_list_mutex */ FlushHp flush_hp; - /** modified blocks (a subset of LRU) */ + /** flush_list size in bytes; protected by flush_list_mutex */ + ulint flush_list_bytes; + /** possibly modified persistent pages (a subset of LRU); + os_aio_pending_writes() is approximately COUNT(is_write_fixed()) */ UT_LIST_BASE_NODE_T(buf_page_t) flush_list; + /** number of blocks ever added to flush_list; + sometimes protected by flush_list_mutex */ + size_t flush_list_requests; + + TPOOL_SUPPRESS_TSAN void add_flush_list_requests(size_t size) + { ut_ad(size); flush_list_requests+= size; } private: - /** whether the page cleaner needs wakeup from indefinite sleep */ - bool page_cleaner_is_idle; + static constexpr unsigned PAGE_CLEANER_IDLE= 1; + static constexpr unsigned FLUSH_LIST_ACTIVE= 2; + static constexpr unsigned LRU_FLUSH= 4; + + /** Number of pending LRU flush * LRU_FLUSH + + PAGE_CLEANER_IDLE + FLUSH_LIST_ACTIVE flags */ + unsigned page_cleaner_status; /** track server activity count for signaling idle flushing */ ulint last_activity_count; public: /** signalled to wake up the page_cleaner; protected by flush_list_mutex */ pthread_cond_t do_flush_list; + /** broadcast when !n_flush(); protected by flush_list_mutex */ + pthread_cond_t done_flush_LRU; + /** broadcast when a batch completes; protected by flush_list_mutex */ + pthread_cond_t done_flush_list; + + /** @return number of pending LRU flush */ + unsigned n_flush() const + { + mysql_mutex_assert_owner(&flush_list_mutex); + return page_cleaner_status / LRU_FLUSH; + } + + /** Increment the number of pending LRU flush */ + inline void n_flush_inc(); + + /** Decrement the number of pending LRU flush */ + inline void n_flush_dec(); + + /** @return whether flush_list flushing is active */ + bool flush_list_active() const + { + mysql_mutex_assert_owner(&flush_list_mutex); + return page_cleaner_status & FLUSH_LIST_ACTIVE; + } + + void flush_list_set_active() + { + ut_ad(!flush_list_active()); + page_cleaner_status+= FLUSH_LIST_ACTIVE; + } + void flush_list_set_inactive() + { + ut_ad(flush_list_active()); + page_cleaner_status-= FLUSH_LIST_ACTIVE; + } /** @return whether the page cleaner must sleep due to being idle */ - bool page_cleaner_idle() const + bool page_cleaner_idle() const noexcept { mysql_mutex_assert_owner(&flush_list_mutex); - return page_cleaner_is_idle; + return page_cleaner_status & PAGE_CLEANER_IDLE; } - /** Wake up the page cleaner if needed */ - void page_cleaner_wakeup(); + /** Wake up the page cleaner if needed. + @param for_LRU whether to wake up for LRU eviction */ + void page_cleaner_wakeup(bool for_LRU= false); /** Register whether an explicit wakeup of the page cleaner is needed */ void page_cleaner_set_idle(bool deep_sleep) { mysql_mutex_assert_owner(&flush_list_mutex); - page_cleaner_is_idle= deep_sleep; + page_cleaner_status= (page_cleaner_status & ~PAGE_CLEANER_IDLE) | + (PAGE_CLEANER_IDLE * deep_sleep); } /** Update server last activity count */ @@ -1782,9 +1797,6 @@ class buf_pool_t last_activity_count= activity_count; } - // n_flush_LRU() + n_flush_list() - // is approximately COUNT(is_write_fixed()) in flush_list - unsigned freed_page_clock;/*!< a sequence number used to count the number of buffer blocks removed from the end of @@ -1794,16 +1806,10 @@ class buf_pool_t to read this for heuristic purposes without holding any mutex or latch */ - bool try_LRU_scan; /*!< Cleared when an LRU - scan for free block fails. This - flag is used to avoid repeated - scans of LRU list when we know - that there is no free block - available in the scan depth for - eviction. Set whenever - we flush a batch from the - buffer pool. Protected by the - buf_pool.mutex */ + /** Cleared when buf_LRU_get_free_block() fails. + Set whenever the free list grows, along with a broadcast of done_free. + Protected by buf_pool.mutex. */ + Atomic_relaxed try_LRU_scan; /* @} */ /** @name LRU replacement algorithm fields */ @@ -1812,7 +1818,8 @@ class buf_pool_t UT_LIST_BASE_NODE_T(buf_page_t) free; /*!< base node of the free block list */ - /** signaled each time when the free list grows; protected by mutex */ + /** broadcast each time when the free list grows or try_LRU_scan is set; + protected by mutex */ pthread_cond_t done_free; UT_LIST_BASE_NODE_T(buf_page_t) withdraw; @@ -1867,37 +1874,24 @@ class buf_pool_t /** Reserve a buffer. */ buf_tmp_buffer_t *io_buf_reserve() { return io_buf.reserve(); } - /** @return whether any I/O is pending */ - bool any_io_pending() const - { - return n_pend_reads || n_flush_LRU() || n_flush_list(); - } - /** @return total amount of pending I/O */ - ulint io_pending() const - { - return n_pend_reads + n_flush_LRU() + n_flush_list(); - } - -private: - /** Remove a block from the flush list. */ - inline void delete_from_flush_list_low(buf_page_t *bpage); - /** Remove a block from flush_list. - @param bpage buffer pool page - @param clear whether to invoke buf_page_t::clear_oldest_modification() */ - void delete_from_flush_list(buf_page_t *bpage, bool clear); -public: /** Remove a block from flush_list. @param bpage buffer pool page */ - void delete_from_flush_list(buf_page_t *bpage) - { delete_from_flush_list(bpage, true); } + void delete_from_flush_list(buf_page_t *bpage) noexcept; + + /** Prepare to insert a modified blcok into flush_list. + @param lsn start LSN of the mini-transaction + @return insert position for insert_into_flush_list() */ + inline buf_page_t *prepare_insert_into_flush_list(lsn_t lsn) noexcept; /** Insert a modified block into the flush list. + @param prev insert position (from prepare_insert_into_flush_list()) @param block modified block @param lsn start LSN of the mini-transaction that modified the block */ - void insert_into_flush_list(buf_block_t *block, lsn_t lsn); + inline void insert_into_flush_list(buf_page_t *prev, buf_block_t *block, + lsn_t lsn) noexcept; /** Free a page whose underlying file page has been freed. */ - inline void release_freed_page(buf_page_t *bpage); + ATTRIBUTE_COLD void release_freed_page(buf_page_t *bpage) noexcept; private: /** Temporary memory for page_compressed and encrypted I/O */ @@ -1908,34 +1902,12 @@ class buf_pool_t /** array of slots */ buf_tmp_buffer_t *slots; - void create(ulint n_slots) - { - this->n_slots= n_slots; - slots= static_cast - (ut_malloc_nokey(n_slots * sizeof *slots)); - memset((void*) slots, 0, n_slots * sizeof *slots); - } + void create(ulint n_slots); - void close() - { - for (buf_tmp_buffer_t *s= slots, *e= slots + n_slots; s != e; s++) - { - aligned_free(s->crypt_buf); - aligned_free(s->comp_buf); - } - ut_free(slots); - slots= nullptr; - n_slots= 0; - } + void close(); /** Reserve a buffer */ - buf_tmp_buffer_t *reserve() - { - for (buf_tmp_buffer_t *s= slots, *e= slots + n_slots; s != e; s++) - if (s->acquire()) - return s; - return nullptr; - } + buf_tmp_buffer_t *reserve(); } io_buf; /** whether resize() is in the critical path */ @@ -1982,7 +1954,8 @@ inline void buf_page_t::set_state(uint32_t s) { mysql_mutex_assert_owner(&buf_pool.mutex); ut_ad(s <= REMOVE_HASH || s >= UNFIXED); - ut_ad(s <= READ_FIX); + ut_ad(s < WRITE_FIX); + ut_ad(s <= READ_FIX || zip.fix == READ_FIX); zip.fix= s; } @@ -2008,7 +1981,7 @@ inline void buf_page_t::set_corrupt_id() is_write_locked()); } #endif - id_= page_id_t(~0ULL); + id_.set_corrupted(); } /** Set oldest_modification when adding to buf_pool.flush_list */ @@ -2023,7 +1996,10 @@ inline void buf_page_t::set_oldest_modification(lsn_t lsn) /** Clear oldest_modification after removing from buf_pool.flush_list */ inline void buf_page_t::clear_oldest_modification() { - mysql_mutex_assert_owner(&buf_pool.flush_list_mutex); +#ifdef SAFE_MUTEX + if (oldest_modification() != 2) + mysql_mutex_assert_owner(&buf_pool.flush_list_mutex); +#endif /* SAFE_MUTEX */ ut_d(const auto s= state()); ut_ad(s >= REMOVE_HASH); ut_ad(oldest_modification()); @@ -2035,17 +2011,6 @@ inline void buf_page_t::clear_oldest_modification() oldest_modification_.store(0, std::memory_order_release); } -/** @return whether the block is modified and ready for flushing */ -inline bool buf_page_t::ready_for_flush() const -{ - mysql_mutex_assert_owner(&buf_pool.mutex); - ut_ad(in_LRU_list); - const auto s= state(); - ut_a(s >= FREED); - ut_ad(!fsp_is_system_temporary(id().space()) || oldest_modification() == 2); - return s < READ_FIX; -} - /** @return whether the block can be relocated in memory. The block can be dirty, but it must not be I/O-fixed or bufferfixed. */ inline bool buf_page_t::can_relocate() const @@ -2194,8 +2159,6 @@ struct CheckUnzipLRUAndLRUList { }; #endif /* UNIV_DEBUG */ -#include "buf0buf.ic" +#include "buf0buf.inl" #endif /* !UNIV_INNOCHECKSUM */ - -#endif diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic deleted file mode 100644 index 2eb69edddd003..0000000000000 --- a/storage/innobase/include/buf0buf.ic +++ /dev/null @@ -1,162 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2008, Google Inc. -Copyright (c) 2014, 2021, MariaDB Corporation. - -Portions of this file contain modifications contributed and copyrighted by -Google, Inc. Those modifications are gratefully acknowledged and are described -briefly in the InnoDB documentation. The contributions by Google are -incorporated with their permission, and subject to the conditions contained in -the file COPYING.Google. - -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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/buf0buf.ic -The database buffer buf_pool - -Created 11/5/1995 Heikki Tuuri -*******************************************************/ - -#include "mtr0mtr.h" -#include "buf0flu.h" -#include "buf0lru.h" -#include "buf0rea.h" -#include "fsp0types.h" - -/** Determine if a block is still close enough to the MRU end of the LRU list -meaning that it is not in danger of getting evicted and also implying -that it has been accessed recently. -The page must be either buffer-fixed, or its page hash must be locked. -@param[in] bpage buffer pool page -@return whether bpage is close to MRU end of LRU */ -inline bool buf_page_peek_if_young(const buf_page_t *bpage) -{ - /* FIXME: bpage->freed_page_clock is 31 bits */ - return((buf_pool.freed_page_clock & ((1UL << 31) - 1)) - < (bpage->freed_page_clock - + (buf_pool.curr_size - * (BUF_LRU_OLD_RATIO_DIV - buf_pool.LRU_old_ratio) - / (BUF_LRU_OLD_RATIO_DIV * 4)))); -} - -/** Determine if a block should be moved to the start of the LRU list if -there is danger of dropping from the buffer pool. -@param[in] bpage buffer pool page -@return true if bpage should be made younger */ -inline bool buf_page_peek_if_too_old(const buf_page_t *bpage) -{ - if (buf_pool.freed_page_clock == 0) { - /* If eviction has not started yet, do not update the - statistics or move blocks in the LRU list. This is - either the warm-up phase or an in-memory workload. */ - return(FALSE); - } else if (buf_LRU_old_threshold_ms && bpage->old) { - uint32_t access_time = bpage->is_accessed(); - - /* It is possible that the below comparison returns an - unexpected result. 2^32 milliseconds pass in about 50 days, - so if the difference between ut_time_ms() and access_time - is e.g. 50 days + 15 ms, then the below will behave as if - it is 15 ms. This is known and fixing it would require to - increase buf_page_t::access_time from 32 to 64 bits. */ - if (access_time - && ((ib_uint32_t) (ut_time_ms() - access_time)) - >= buf_LRU_old_threshold_ms) { - return(TRUE); - } - - buf_pool.stat.n_pages_not_made_young++; - return false; - } else { - return !buf_page_peek_if_young(bpage); - } -} - -/** Allocate a buffer block. -@return own: the allocated block, in state BUF_BLOCK_MEMORY */ -inline buf_block_t *buf_block_alloc() -{ - return buf_LRU_get_free_block(false); -} - -/********************************************************************//** -Frees a buffer block which does not contain a file page. */ -UNIV_INLINE -void -buf_block_free( -/*===========*/ - buf_block_t* block) /*!< in, own: block to be freed */ -{ - mysql_mutex_lock(&buf_pool.mutex); - buf_LRU_block_free_non_file_page(block); - mysql_mutex_unlock(&buf_pool.mutex); -} - -/********************************************************************//** -Increments the modify clock of a frame by 1. The caller must (1) own the -buf_pool mutex and block bufferfix count has to be zero, (2) or own an x-lock -on the block. */ -UNIV_INLINE -void -buf_block_modify_clock_inc( -/*=======================*/ - buf_block_t* block) /*!< in: block */ -{ -#ifdef SAFE_MUTEX - ut_ad((mysql_mutex_is_owner(&buf_pool.mutex) - && !block->page.buf_fix_count()) - || block->page.lock.have_u_or_x()); -#else /* SAFE_MUTEX */ - ut_ad(!block->page.buf_fix_count() || block->page.lock.have_u_or_x()); -#endif /* SAFE_MUTEX */ - assert_block_ahi_valid(block); - - block->modify_clock++; -} - -/********************************************************************//** -Returns the value of the modify clock. The caller must have an s-lock -or x-lock on the block. -@return value */ -UNIV_INLINE -ib_uint64_t -buf_block_get_modify_clock( -/*=======================*/ - buf_block_t* block) /*!< in: block */ -{ - ut_ad(block->page.lock.have_any()); - return(block->modify_clock); -} - -/** Calculate aligned buffer pool size based on srv_buf_pool_chunk_unit, -if needed. -@param[in] size size in bytes -@return aligned size */ -UNIV_INLINE -ulint -buf_pool_size_align( - ulint size) -{ - const size_t m = srv_buf_pool_chunk_unit; - size = ut_max(size, srv_buf_pool_min_size); - - if (size % m == 0) { - return(size); - } else { - return (ulint)((size / m + 1) * m); - } -} diff --git a/storage/innobase/include/buf0buf.inl b/storage/innobase/include/buf0buf.inl new file mode 100644 index 0000000000000..4516a24803c74 --- /dev/null +++ b/storage/innobase/include/buf0buf.inl @@ -0,0 +1,143 @@ +/***************************************************************************** + +Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2008, Google Inc. +Copyright (c) 2014, 2022, MariaDB Corporation. + +Portions of this file contain modifications contributed and copyrighted by +Google, Inc. Those modifications are gratefully acknowledged and are described +briefly in the InnoDB documentation. The contributions by Google are +incorporated with their permission, and subject to the conditions contained in +the file COPYING.Google. + +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 02110-1335 USA + +*****************************************************************************/ + +/**************************************************//** +@file include/buf0buf.ic +The database buffer buf_pool + +Created 11/5/1995 Heikki Tuuri +*******************************************************/ + +#include "mtr0mtr.h" +#include "buf0flu.h" +#include "buf0lru.h" +#include "buf0rea.h" +#include "fsp0types.h" + +/** Determine if a block is still close enough to the MRU end of the LRU list +meaning that it is not in danger of getting evicted and also implying +that it has been accessed recently. +The page must be either buffer-fixed, or its page hash must be locked. +@param[in] bpage buffer pool page +@return whether bpage is close to MRU end of LRU */ +inline bool buf_page_peek_if_young(const buf_page_t *bpage) +{ + /* FIXME: bpage->freed_page_clock is 31 bits */ + return((buf_pool.freed_page_clock & ((1UL << 31) - 1)) + < (bpage->freed_page_clock + + (buf_pool.curr_size + * (BUF_LRU_OLD_RATIO_DIV - buf_pool.LRU_old_ratio) + / (BUF_LRU_OLD_RATIO_DIV * 4)))); +} + +/** Determine if a block should be moved to the start of the LRU list if +there is danger of dropping from the buffer pool. +@param[in] bpage buffer pool page +@return true if bpage should be made younger */ +inline bool buf_page_peek_if_too_old(const buf_page_t *bpage) +{ + if (buf_pool.freed_page_clock == 0) { + /* If eviction has not started yet, do not update the + statistics or move blocks in the LRU list. This is + either the warm-up phase or an in-memory workload. */ + return(FALSE); + } else if (buf_LRU_old_threshold_ms && bpage->old) { + uint32_t access_time = bpage->is_accessed(); + + /* It is possible that the below comparison returns an + unexpected result. 2^32 milliseconds pass in about 50 days, + so if the difference between ut_time_ms() and access_time + is e.g. 50 days + 15 ms, then the below will behave as if + it is 15 ms. This is known and fixing it would require to + increase buf_page_t::access_time from 32 to 64 bits. */ + if (access_time + && ((ib_uint32_t) (ut_time_ms() - access_time)) + >= buf_LRU_old_threshold_ms) { + return(TRUE); + } + + buf_pool.stat.n_pages_not_made_young++; + return false; + } else { + return !buf_page_peek_if_young(bpage); + } +} + +/** Allocate a buffer block. +@return own: the allocated block, in state BUF_BLOCK_MEMORY */ +inline buf_block_t *buf_block_alloc() +{ + return buf_LRU_get_free_block(false); +} + +/********************************************************************//** +Frees a buffer block which does not contain a file page. */ +UNIV_INLINE +void +buf_block_free( +/*===========*/ + buf_block_t* block) /*!< in, own: block to be freed */ +{ + mysql_mutex_lock(&buf_pool.mutex); + buf_LRU_block_free_non_file_page(block); + mysql_mutex_unlock(&buf_pool.mutex); +} + +/********************************************************************//** +Increments the modify clock of a frame by 1. The caller must (1) own the +buf_pool mutex and block bufferfix count has to be zero, (2) or own an x-lock +on the block. */ +UNIV_INLINE +void +buf_block_modify_clock_inc( +/*=======================*/ + buf_block_t* block) /*!< in: block */ +{ +#ifdef SAFE_MUTEX + ut_ad((mysql_mutex_is_owner(&buf_pool.mutex) + && !block->page.buf_fix_count()) + || block->page.lock.have_u_or_x()); +#else /* SAFE_MUTEX */ + ut_ad(!block->page.buf_fix_count() || block->page.lock.have_u_or_x()); +#endif /* SAFE_MUTEX */ + assert_block_ahi_valid(block); + + block->modify_clock++; +} + +/********************************************************************//** +Returns the value of the modify clock. The caller must have an s-lock +or x-lock on the block. +@return value */ +UNIV_INLINE +ib_uint64_t +buf_block_get_modify_clock( +/*=======================*/ + buf_block_t* block) /*!< in: block */ +{ + ut_ad(block->page.lock.have_any()); + return(block->modify_clock); +} diff --git a/storage/innobase/include/buf0dblwr.h b/storage/innobase/include/buf0dblwr.h index fb9df55504c00..9932b0e521ff4 100644 --- a/storage/innobase/include/buf0dblwr.h +++ b/storage/innobase/include/buf0dblwr.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -54,9 +54,9 @@ class buf_dblwr_t }; /** the page number of the first doublewrite block (block_size() pages) */ - page_id_t block1= page_id_t(0, 0); + page_id_t block1{0, 0}; /** the page number of the second doublewrite block (block_size() pages) */ - page_id_t block2= page_id_t(0, 0); + page_id_t block2{0, 0}; /** mutex protecting the data members below */ mysql_mutex_t mutex; @@ -66,17 +66,15 @@ class buf_dblwr_t bool batch_running; /** number of expected flush_buffered_writes_completed() calls */ unsigned flushing_buffered_writes; - /** pages submitted to flush_buffered_writes() */ - ulint pages_submitted; /** number of flush_buffered_writes_completed() calls */ ulint writes_completed; /** number of pages written by flush_buffered_writes_completed() */ ulint pages_written; slot slots[2]; - slot *active_slot= &slots[0]; + slot *active_slot; - /** Initialize the doublewrite buffer data structure. + /** Initialise the persistent storage of the doublewrite buffer. @param header doublewrite page header in the TRX_SYS page */ inline void init(const byte *header); @@ -84,6 +82,8 @@ class buf_dblwr_t bool flush_buffered_writes(const ulint size); public: + /** Initialise the doublewrite buffer data structures. */ + void init(); /** Create or restore the doublewrite buffer in the TRX_SYS page. @return whether the operation succeeded */ bool create(); @@ -92,9 +92,6 @@ class buf_dblwr_t /** Acquire the mutex */ void lock() { mysql_mutex_lock(&mutex); } - /** @return the number of submitted page writes */ - ulint submitted() const - { mysql_mutex_assert_owner(&mutex); return pages_submitted; } /** @return the number of completed batches */ ulint batches() const { mysql_mutex_assert_owner(&mutex); return writes_completed; } @@ -137,14 +134,14 @@ class buf_dblwr_t @param size payload size in bytes */ void add_to_batch(const IORequest &request, size_t size); - /** Determine whether the doublewrite buffer is initialized */ - bool is_initialised() const + /** Determine whether the doublewrite buffer has been created */ + bool is_created() const { return UNIV_LIKELY(block1 != page_id_t(0, 0)); } /** @return whether a page identifier is part of the doublewrite buffer */ bool is_inside(const page_id_t id) const { - if (!is_initialised()) + if (!is_created()) return false; ut_ad(block1 < block2); if (id < block1) @@ -156,13 +153,10 @@ class buf_dblwr_t /** Wait for flush_buffered_writes() to be fully completed */ void wait_flush_buffered_writes() { - if (is_initialised()) - { - mysql_mutex_lock(&mutex); - while (batch_running) - my_cond_wait(&cond, &mutex.m_mutex); - mysql_mutex_unlock(&mutex); - } + mysql_mutex_lock(&mutex); + while (batch_running) + my_cond_wait(&cond, &mutex.m_mutex); + mysql_mutex_unlock(&mutex); } }; diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h index 665fd1115e7c3..31fe444668111 100644 --- a/storage/innobase/include/buf0flu.h +++ b/storage/innobase/include/buf0flu.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2021, MariaDB Corporation. +Copyright (c) 2014, 2022, 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 @@ -30,10 +30,8 @@ Created 11/5/1995 Heikki Tuuri #include "log0log.h" #include "buf0buf.h" -/** Number of pages flushed. Protected by buf_pool.mutex. */ -extern ulint buf_flush_page_count; /** Number of pages flushed via LRU. Protected by buf_pool.mutex. -Also included in buf_flush_page_count. */ +Also included in buf_pool.stat.n_pages_written. */ extern ulint buf_lru_flush_page_count; /** Number of pages freed without flushing. Protected by buf_pool.mutex. */ extern ulint buf_lru_freed_page_count; @@ -86,15 +84,18 @@ buf_flush_init_for_writing( bool buf_flush_list_space(fil_space_t *space, ulint *n_flushed= nullptr) MY_ATTRIBUTE((warn_unused_result)); -/** Write out dirty blocks from buf_pool.LRU. +/** Write out dirty blocks from buf_pool.LRU, +and move clean blocks to buf_pool.free. +The caller must invoke buf_dblwr.flush_buffered_writes() +after releasing buf_pool.mutex. @param max_n wished maximum mumber of blocks flushed -@return the number of processed pages +@param evict whether to evict pages after flushing +@return evict ? number of processed pages : number of pages written @retval 0 if a buf_pool.LRU batch is already running */ -ulint buf_flush_LRU(ulint max_n); +ulint buf_flush_LRU(ulint max_n, bool evict); -/** Wait until a flush batch ends. -@param lru true=buf_pool.LRU; false=buf_pool.flush_list */ -void buf_flush_wait_batch_end(bool lru); +/** Wait until a LRU flush batch ends. */ +void buf_flush_wait_LRU_batch_end(); /** Wait until all persistent pages are flushed up to a limit. @param sync_lsn buf_pool.get_oldest_modification(LSN_MAX) to wait for */ ATTRIBUTE_COLD void buf_flush_wait_flushed(lsn_t sync_lsn); @@ -103,39 +104,9 @@ ATTRIBUTE_COLD void buf_flush_wait_flushed(lsn_t sync_lsn); @param furious true=furious flushing, false=limit to innodb_io_capacity */ ATTRIBUTE_COLD void buf_flush_ahead(lsn_t lsn, bool furious); -/********************************************************************//** -This function should be called at a mini-transaction commit, if a page was -modified in it. Puts the block to the list of modified blocks, if it not -already in it. */ -inline void buf_flush_note_modification(buf_block_t *b, lsn_t start, lsn_t end) -{ - ut_ad(!srv_read_only_mode); - ut_d(const auto s= b->page.state()); - ut_ad(s > buf_page_t::FREED); - ut_ad(s < buf_page_t::READ_FIX); - ut_ad(mach_read_from_8(b->page.frame + FIL_PAGE_LSN) <= end); - mach_write_to_8(b->page.frame + FIL_PAGE_LSN, end); - if (UNIV_LIKELY_NULL(b->page.zip.data)) - memcpy_aligned<8>(FIL_PAGE_LSN + b->page.zip.data, - FIL_PAGE_LSN + b->page.frame, 8); - - const lsn_t oldest_modification= b->page.oldest_modification(); - - if (oldest_modification > 1) - ut_ad(oldest_modification <= start); - else if (fsp_is_system_temporary(b->page.id().space())) - b->page.set_temp_modified(); - else - buf_pool.insert_into_flush_list(b, start); - srv_stats.buf_pool_write_requests.inc(); -} - /** Initialize page_cleaner. */ ATTRIBUTE_COLD void buf_flush_page_cleaner_init(); -/** Wait for pending flushes to complete. */ -void buf_flush_wait_batch_end_acquiring_mutex(bool lru); - /** Flush the buffer pool on shutdown. */ ATTRIBUTE_COLD void buf_flush_buffer_pool(); diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h index 986a792b97e2a..4ec8938c689a5 100644 --- a/storage/innobase/include/buf0rea.h +++ b/storage/innobase/include/buf0rea.h @@ -33,10 +33,11 @@ Created 11/5/1995 Heikki Tuuri buffer buf_pool if it is not already there. Sets the io_fix flag and sets an exclusive lock on the buffer frame. The flag is cleared and the x-lock released by the i/o-handler thread. -@param[in] page_id page id -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@retval DB_SUCCESS if the page was read and is not corrupted, -@retval DB_PAGE_CORRUPTED if page based on checksum check is corrupted, +@param page_id page id +@param zip_size ROW_FORMAT=COMPRESSED page size, or 0 +@retval DB_SUCCESS if the page was read and is not corrupted +@retval DB_SUCCESS_LOCKED_REC if the page was not read +@retval DB_PAGE_CORRUPTED if page based on checksum check is corrupted @retval DB_DECRYPTION_FAILED if page post encryption checksum matches but after decryption normal page checksum does not match. @retval DB_TABLESPACE_DELETED if tablespace .ibd file is missing */ diff --git a/storage/innobase/include/buf0types.h b/storage/innobase/include/buf0types.h index 6bc46dbbc0482..6c13f5ee30809 100644 --- a/storage/innobase/include/buf0types.h +++ b/storage/innobase/include/buf0types.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved. -Copyright (c) 2019, 2021, MariaDB Corporation. +Copyright (c) 2019, 2022, 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 @@ -89,20 +89,25 @@ this must be equal to srv_page_size */ class page_id_t { public: - /** Constructor from (space, page_no). @param space tablespace id @param page_no page number */ - page_id_t(uint32_t space, uint32_t page_no) : + constexpr page_id_t(uint32_t space, uint32_t page_no) : m_id(uint64_t{space} << 32 | page_no) {} - page_id_t(uint64_t id) : m_id(id) {} - bool operator==(const page_id_t& rhs) const { return m_id == rhs.m_id; } - bool operator!=(const page_id_t& rhs) const { return m_id != rhs.m_id; } - bool operator<(const page_id_t& rhs) const { return m_id < rhs.m_id; } - bool operator>(const page_id_t& rhs) const { return m_id > rhs.m_id; } - bool operator<=(const page_id_t& rhs) const { return m_id <= rhs.m_id; } - bool operator>=(const page_id_t& rhs) const { return m_id >= rhs.m_id; } + constexpr page_id_t(uint64_t id) : m_id(id) {} + constexpr bool operator==(const page_id_t& rhs) const + { return m_id == rhs.m_id; } + constexpr bool operator!=(const page_id_t& rhs) const + { return m_id != rhs.m_id; } + constexpr bool operator<(const page_id_t& rhs) const + { return m_id < rhs.m_id; } + constexpr bool operator>(const page_id_t& rhs) const + { return m_id > rhs.m_id; } + constexpr bool operator<=(const page_id_t& rhs) const + { return m_id <= rhs.m_id; } + constexpr bool operator>=(const page_id_t& rhs) const + { return m_id >= rhs.m_id; } page_id_t &operator--() { ut_ad(page_no()); m_id--; return *this; } page_id_t &operator++() { @@ -123,15 +128,16 @@ class page_id_t /** Retrieve the tablespace id. @return tablespace id */ - uint32_t space() const { return static_cast(m_id >> 32); } + constexpr uint32_t space() const { return static_cast(m_id >> 32); } /** Retrieve the page number. @return page number */ - uint32_t page_no() const { return static_cast(m_id); } + constexpr uint32_t page_no() const { return static_cast(m_id); } /** Retrieve the fold value. @return fold value */ - ulint fold() const { return (space() << 20) + space() + page_no(); } + constexpr ulint fold() const + { return (ulint{space()} << 20) + space() + page_no(); } /** Reset the page number only. @param[in] page_no page number */ @@ -140,7 +146,13 @@ class page_id_t m_id= (m_id & ~uint64_t{0} << 32) | page_no; } - ulonglong raw() { return m_id; } + constexpr ulonglong raw() const { return m_id; } + + /** Flag the page identifier as corrupted. */ + void set_corrupted() { m_id= ~0ULL; } + + /** @return whether the page identifier belongs to a corrupted page */ + constexpr bool is_corrupted() const { return m_id == ~0ULL; } private: /** The page identifier */ diff --git a/storage/innobase/include/data0data.h b/storage/innobase/include/data0data.h index fc774b6ee60ce..a5356e0d1a3bc 100644 --- a/storage/innobase/include/data0data.h +++ b/storage/innobase/include/data0data.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, 2020 MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -316,16 +316,6 @@ dtuple_get_n_ext( /*=============*/ const dtuple_t* tuple) /*!< in: tuple */ MY_ATTRIBUTE((nonnull)); -/** Compare two data tuples. -@param[in] tuple1 first data tuple -@param[in] tuple2 second data tuple -@return positive, 0, negative if tuple1 is greater, equal, less, than tuple2, -respectively */ -int -dtuple_coll_cmp( - const dtuple_t* tuple1, - const dtuple_t* tuple2) - MY_ATTRIBUTE((warn_unused_result)); /** Fold a prefix given as the number of fields of a tuple. @param[in] tuple index record @param[in] n_fields number of complete fields to fold @@ -581,6 +571,10 @@ struct dtuple_t { /** @return whether this is a hidden metadata record for instant ADD COLUMN or ALTER TABLE */ bool is_metadata() const { return is_metadata(info_bits); } + + /** Copy type information from index fields. + @param index index field to be copied */ + inline void copy_field_types(const dict_index_t &index); }; inline ulint dtuple_get_n_fields(const dtuple_t* tuple) @@ -705,6 +699,6 @@ struct big_rec_t { ulint n_fld); }; -#include "data0data.ic" +#include "data0data.inl" #endif diff --git a/storage/innobase/include/data0data.ic b/storage/innobase/include/data0data.inl similarity index 100% rename from storage/innobase/include/data0data.ic rename to storage/innobase/include/data0data.inl diff --git a/storage/innobase/include/data0type.h b/storage/innobase/include/data0type.h index 333210b47796d..3d63ddb767c74 100644 --- a/storage/innobase/include/data0type.h +++ b/storage/innobase/include/data0type.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -24,9 +24,7 @@ Data types Created 1/16/1996 Heikki Tuuri *******************************************************/ -#ifndef data0type_h -#define data0type_h - +#pragma once #include "univ.i" /** Special length indicating a missing instantly added column */ @@ -196,9 +194,6 @@ constexpr uint8_t DATA_MBR_LEN= uint8_t(SPDIMS * 2 * sizeof(double)); /** system-versioned user data column */ #define DATA_VERSIONED (DATA_VERS_START|DATA_VERS_END) -/** Check whether locking is disabled (never). */ -#define dict_table_is_locking_disabled(table) false - /*-------------------------------------------*/ /* This many bytes we need to store the type information affecting the @@ -325,7 +320,6 @@ dtype_get_prtype( /*********************************************************************//** Compute the mbminlen and mbmaxlen members of a data type structure. */ -UNIV_INLINE void dtype_get_mblen( /*============*/ @@ -494,6 +488,8 @@ dtype_print( const dtype_t* type); #endif /* UNIV_DEBUG */ +struct dict_col_t; + /* Structure for an SQL data type. If you add fields to this structure, be sure to initialize them everywhere. This structure is initialized in the following functions: @@ -549,6 +545,10 @@ struct dtype_t{ mbminlen = 0; mbmaxlen = 0; } + + /** Copy the type information from a column. + @param col column type to be copied */ + void assign(const dict_col_t &col); }; /** The DB_TRX_ID,DB_ROLL_PTR values for "no history is available" */ @@ -588,6 +588,4 @@ static const byte REC_INFO_METADATA_ADD static const byte REC_INFO_METADATA_ALTER = REC_INFO_METADATA_ADD | REC_INFO_DELETED_FLAG; -#include "data0type.ic" - -#endif +#include "data0type.inl" diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic deleted file mode 100644 index 06d909598550d..0000000000000 --- a/storage/innobase/include/data0type.ic +++ /dev/null @@ -1,521 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, MariaDB Corporation. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/data0type.ic -Data types - -Created 1/16/1996 Heikki Tuuri -*******************************************************/ - -#include "mach0data.h" -#include "ha_prototypes.h" - -/*********************************************************************//** -Determines if a MySQL string type is a subset of UTF-8. This function -may return false negatives, in case further character-set collation -codes are introduced in MySQL later. -@return whether a subset of UTF-8 */ -UNIV_INLINE -bool -dtype_is_utf8( -/*==========*/ - ulint prtype) /*!< in: precise data type */ -{ - /* These codes have been copied from strings/ctype-extra.c - and strings/ctype-utf8.c. */ - switch (dtype_get_charset_coll(prtype)) { - case 11: /* ascii_general_ci */ - case 65: /* ascii_bin */ - case 33: /* utf8_general_ci */ - case 83: /* utf8_bin */ - case 254: /* utf8_general_cs */ - return true; - } - - return false; -} - -/*********************************************************************//** -Gets the MySQL type code from a dtype. -@return MySQL type code; this is NOT an InnoDB type code! */ -UNIV_INLINE -ulint -dtype_get_mysql_type( -/*=================*/ - const dtype_t* type) /*!< in: type struct */ -{ - return(type->prtype & 0xFFUL); -} - -/*********************************************************************//** -Compute the mbminlen and mbmaxlen members of a data type structure. */ -UNIV_INLINE -void -dtype_get_mblen( -/*============*/ - ulint mtype, /*!< in: main type */ - ulint prtype, /*!< in: precise type (and collation) */ - unsigned*mbminlen, /*!< out: minimum length of a - multi-byte character */ - unsigned*mbmaxlen) /*!< out: maximum length of a - multi-byte character */ -{ - if (dtype_is_string_type(mtype)) { - innobase_get_cset_width(dtype_get_charset_coll(prtype), - mbminlen, mbmaxlen); - ut_ad(*mbminlen <= *mbmaxlen); - ut_ad(*mbminlen < DATA_MBMAX); - ut_ad(*mbmaxlen < DATA_MBMAX); - } else { - *mbminlen = *mbmaxlen = 0; - } -} - -/*********************************************************************//** -Compute the mbminlen and mbmaxlen members of a data type structure. */ -UNIV_INLINE -void -dtype_set_mblen( -/*============*/ - dtype_t* type) /*!< in/out: type */ -{ - unsigned mbminlen, mbmaxlen; - - dtype_get_mblen(type->mtype, type->prtype, &mbminlen, &mbmaxlen); - type->mbminlen = mbminlen & 7; - type->mbmaxlen = mbmaxlen & 7; - - ut_ad(dtype_validate(type)); -} - -/*********************************************************************//** -Sets a data type structure. */ -UNIV_INLINE -void -dtype_set( -/*======*/ - dtype_t* type, /*!< in: type struct to init */ - ulint mtype, /*!< in: main data type */ - ulint prtype, /*!< in: precise type */ - ulint len) /*!< in: precision of type */ -{ - ut_ad(type); - ut_ad(mtype <= DATA_MTYPE_MAX); - - type->mtype = static_cast(mtype); - type->prtype = static_cast(prtype); - type->len = static_cast(len); - - dtype_set_mblen(type); -} - -/*********************************************************************//** -Copies a data type structure. */ -UNIV_INLINE -void -dtype_copy( -/*=======*/ - dtype_t* type1, /*!< in: type struct to copy to */ - const dtype_t* type2) /*!< in: type struct to copy from */ -{ - *type1 = *type2; - - ut_ad(dtype_validate(type1)); -} - -/*********************************************************************//** -Gets the SQL main data type. -@return SQL main data type */ -UNIV_INLINE -ulint -dtype_get_mtype( -/*============*/ - const dtype_t* type) /*!< in: data type */ -{ - ut_ad(type); - - return(type->mtype); -} - -/*********************************************************************//** -Gets the precise data type. -@return precise data type */ -UNIV_INLINE -ulint -dtype_get_prtype( -/*=============*/ - const dtype_t* type) /*!< in: data type */ -{ - ut_ad(type); - - return(type->prtype); -} - -/*********************************************************************//** -Gets the type length. -@return fixed length of the type, in bytes, or 0 if variable-length */ -UNIV_INLINE -ulint -dtype_get_len( -/*==========*/ - const dtype_t* type) /*!< in: data type */ -{ - ut_ad(type); - - return(type->len); -} - -/*********************************************************************//** -Gets the minimum length of a character, in bytes. -@return minimum length of a char, in bytes, or 0 if this is not a -character type */ -UNIV_INLINE -ulint -dtype_get_mbminlen( -/*===============*/ - const dtype_t* type) /*!< in: type */ -{ - return type->mbminlen; -} -/*********************************************************************//** -Gets the maximum length of a character, in bytes. -@return maximum length of a char, in bytes, or 0 if this is not a -character type */ -UNIV_INLINE -ulint -dtype_get_mbmaxlen( -/*===============*/ - const dtype_t* type) /*!< in: type */ -{ - return type->mbmaxlen; -} - -/**********************************************************************//** -Stores for a type the information which determines its alphabetical ordering -and the storage size of an SQL NULL value. This is the >= 4.1.x storage -format. */ -UNIV_INLINE -void -dtype_new_store_for_order_and_null_size( -/*====================================*/ - byte* buf, /*!< in: buffer for - DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE - bytes where we store the info */ - const dtype_t* type, /*!< in: type struct */ - ulint prefix_len)/*!< in: prefix length to - replace type->len, or 0 */ -{ - compile_time_assert(6 == DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE); - - ulint len; - - ut_ad(type); - ut_ad(type->mtype >= DATA_VARCHAR); - ut_ad(type->mtype <= DATA_MTYPE_MAX); - - buf[0] = (byte)(type->mtype & 0xFFUL); - - if (type->prtype & DATA_BINARY_TYPE) { - buf[0] |= 128; - } - - /* In versions < 4.1.2 we had: if (type->prtype & DATA_NONLATIN1) { - buf[0] |= 64; - } - */ - - buf[1] = (byte)(type->prtype & 0xFFUL); - - len = prefix_len ? prefix_len : type->len; - - mach_write_to_2(buf + 2, len & 0xFFFFUL); - - ut_ad(dtype_get_charset_coll(type->prtype) <= MAX_CHAR_COLL_NUM); - mach_write_to_2(buf + 4, dtype_get_charset_coll(type->prtype)); - - if (type->prtype & DATA_NOT_NULL) { - buf[4] |= 128; - } -} - -/**********************************************************************//** -Reads to a type the stored information which determines its alphabetical -ordering and the storage size of an SQL NULL value. This is the < 4.1.x -storage format. */ -UNIV_INLINE -void -dtype_read_for_order_and_null_size( -/*===============================*/ - dtype_t* type, /*!< in: type struct */ - const byte* buf) /*!< in: buffer for stored type order info */ -{ - compile_time_assert(4 == DATA_ORDER_NULL_TYPE_BUF_SIZE); - type->mtype = buf[0] & 63; - type->prtype = buf[1]; - - if (buf[0] & 128) { - type->prtype |= DATA_BINARY_TYPE; - } - - type->len = mach_read_from_2(buf + 2); - - type->prtype = dtype_form_prtype(type->prtype, - data_mysql_default_charset_coll); - dtype_set_mblen(type); -} - -/**********************************************************************//** -Reads to a type the stored information which determines its alphabetical -ordering and the storage size of an SQL NULL value. This is the >= 4.1.x -storage format. */ -UNIV_INLINE -void -dtype_new_read_for_order_and_null_size( -/*===================================*/ - dtype_t* type, /*!< in: type struct */ - const byte* buf) /*!< in: buffer for stored type order info */ -{ - compile_time_assert(6 == DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE); - - type->mtype = buf[0] & 63; - type->prtype = buf[1]; - - if (buf[0] & 128) { - type->prtype |= DATA_BINARY_TYPE; - } - - if (buf[4] & 128) { - type->prtype |= DATA_NOT_NULL; - } - - type->len = mach_read_from_2(buf + 2); - - ulint charset_coll = mach_read_from_2(buf + 4) & CHAR_COLL_MASK; - - if (dtype_is_string_type(type->mtype)) { - ut_a(charset_coll <= MAX_CHAR_COLL_NUM); - - if (charset_coll == 0) { - /* This insert buffer record was inserted with MySQL - version < 4.1.2, and the charset-collation code was not - explicitly stored to dtype->prtype at that time. It - must be the default charset-collation of this MySQL - installation. */ - - charset_coll = data_mysql_default_charset_coll; - } - - type->prtype = dtype_form_prtype(type->prtype, charset_coll); - } - dtype_set_mblen(type); -} - -/***********************************************************************//** -Returns the size of a fixed size data type, 0 if not a fixed size type. -@return fixed size, or 0 */ -UNIV_INLINE -unsigned -dtype_get_fixed_size_low( -/*=====================*/ - ulint mtype, /*!< in: main type */ - ulint prtype, /*!< in: precise type */ - ulint len, /*!< in: length */ - ulint mbminlen, /*!< in: minimum length of a - multibyte character, in bytes */ - ulint mbmaxlen, /*!< in: maximum length of a - multibyte character, in bytes */ - ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */ -{ - switch (mtype) { - case DATA_SYS: -#ifdef UNIV_DEBUG - switch (prtype & DATA_MYSQL_TYPE_MASK) { - case DATA_ROW_ID: - ut_ad(len == DATA_ROW_ID_LEN); - break; - case DATA_TRX_ID: - ut_ad(len == DATA_TRX_ID_LEN); - break; - case DATA_ROLL_PTR: - ut_ad(len == DATA_ROLL_PTR_LEN); - break; - default: - ut_ad(0); - return(0); - } -#endif /* UNIV_DEBUG */ - /* fall through */ - case DATA_CHAR: - case DATA_FIXBINARY: - case DATA_INT: - case DATA_FLOAT: - case DATA_DOUBLE: - return static_cast(len); - case DATA_MYSQL: - if (prtype & DATA_BINARY_TYPE) { - return static_cast(len); - } else if (!comp) { - return static_cast(len); - } else { -#ifdef UNIV_DEBUG - unsigned i_mbminlen, i_mbmaxlen; - - innobase_get_cset_width( - dtype_get_charset_coll(prtype), - &i_mbminlen, &i_mbmaxlen); - - ut_ad(i_mbminlen == mbminlen); - ut_ad(i_mbmaxlen == mbmaxlen); -#endif /* UNIV_DEBUG */ - if (mbminlen == mbmaxlen) { - return static_cast(len); - } - } - /* Treat as variable-length. */ - /* fall through */ - case DATA_VARCHAR: - case DATA_BINARY: - case DATA_DECIMAL: - case DATA_VARMYSQL: - case DATA_GEOMETRY: - case DATA_BLOB: - return(0); - default: - ut_error; - } - - return(0); -} - -/***********************************************************************//** -Returns the minimum size of a data type. -@return minimum size */ -UNIV_INLINE -unsigned -dtype_get_min_size_low( -/*===================*/ - ulint mtype, /*!< in: main type */ - ulint prtype, /*!< in: precise type */ - ulint len, /*!< in: length */ - ulint mbminlen, /*!< in: minimum length of a character */ - ulint mbmaxlen) /*!< in: maximum length of a character */ -{ - switch (mtype) { - case DATA_SYS: -#ifdef UNIV_DEBUG - switch (prtype & DATA_MYSQL_TYPE_MASK) { - case DATA_ROW_ID: - ut_ad(len == DATA_ROW_ID_LEN); - break; - case DATA_TRX_ID: - ut_ad(len == DATA_TRX_ID_LEN); - break; - case DATA_ROLL_PTR: - ut_ad(len == DATA_ROLL_PTR_LEN); - break; - default: - ut_ad(0); - return(0); - } -#endif /* UNIV_DEBUG */ - /* fall through */ - case DATA_CHAR: - case DATA_FIXBINARY: - case DATA_INT: - case DATA_FLOAT: - case DATA_DOUBLE: - return static_cast(len); - case DATA_MYSQL: - if (prtype & DATA_BINARY_TYPE) { - return static_cast(len); - } else { - if (mbminlen == mbmaxlen) { - return static_cast(len); - } - - /* this is a variable-length character set */ - ut_a(mbminlen > 0); - ut_a(mbmaxlen > mbminlen); - ut_a(len % mbmaxlen == 0); - return static_cast( - len * mbminlen / mbmaxlen); - } - case DATA_VARCHAR: - case DATA_BINARY: - case DATA_DECIMAL: - case DATA_VARMYSQL: - case DATA_GEOMETRY: - case DATA_BLOB: - return(0); - default: - ut_error; - } - - return(0); -} - -/***********************************************************************//** -Returns the maximum size of a data type. Note: types in system tables may be -incomplete and return incorrect information. -@return maximum size */ -UNIV_INLINE -ulint -dtype_get_max_size_low( -/*===================*/ - ulint mtype, /*!< in: main type */ - ulint len) /*!< in: length */ -{ - switch (mtype) { - case DATA_SYS: - case DATA_CHAR: - case DATA_FIXBINARY: - case DATA_INT: - case DATA_FLOAT: - case DATA_DOUBLE: - case DATA_MYSQL: - case DATA_VARCHAR: - case DATA_BINARY: - case DATA_DECIMAL: - case DATA_VARMYSQL: - return(len); - case DATA_GEOMETRY: - case DATA_BLOB: - break; - default: - ut_error; - } - - return(ULINT_MAX); -} - -/***********************************************************************//** -Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a type. -For fixed length types it is the fixed length of the type, otherwise 0. -@return SQL null storage size in ROW_FORMAT=REDUNDANT */ -UNIV_INLINE -ulint -dtype_get_sql_null_size( -/*====================*/ - const dtype_t* type, /*!< in: type */ - ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */ -{ - return(dtype_get_fixed_size_low(type->mtype, type->prtype, type->len, - type->mbminlen, type->mbmaxlen, comp)); -} diff --git a/storage/innobase/include/data0type.inl b/storage/innobase/include/data0type.inl new file mode 100644 index 0000000000000..329cee5d190a0 --- /dev/null +++ b/storage/innobase/include/data0type.inl @@ -0,0 +1,487 @@ +/***************************************************************************** + +Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, 2020, MariaDB Corporation. + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +*****************************************************************************/ + +/**************************************************//** +@file include/data0type.ic +Data types + +Created 1/16/1996 Heikki Tuuri +*******************************************************/ + +#include "mach0data.h" +#include "ha_prototypes.h" + +/*********************************************************************//** +Determines if a MySQL string type is a subset of UTF-8. This function +may return false negatives, in case further character-set collation +codes are introduced in MySQL later. +@return whether a subset of UTF-8 */ +UNIV_INLINE +bool +dtype_is_utf8( +/*==========*/ + ulint prtype) /*!< in: precise data type */ +{ + /* These codes have been copied from strings/ctype-extra.c + and strings/ctype-utf8.c. */ + switch (dtype_get_charset_coll(prtype)) { + case 11: /* ascii_general_ci */ + case 65: /* ascii_bin */ + case 33: /* utf8_general_ci */ + case 83: /* utf8_bin */ + case 254: /* utf8_general_cs */ + return true; + } + + return false; +} + +/*********************************************************************//** +Gets the MySQL type code from a dtype. +@return MySQL type code; this is NOT an InnoDB type code! */ +UNIV_INLINE +ulint +dtype_get_mysql_type( +/*=================*/ + const dtype_t* type) /*!< in: type struct */ +{ + return(type->prtype & 0xFFUL); +} + +/*********************************************************************//** +Compute the mbminlen and mbmaxlen members of a data type structure. */ +UNIV_INLINE +void +dtype_set_mblen( +/*============*/ + dtype_t* type) /*!< in/out: type */ +{ + unsigned mbminlen, mbmaxlen; + + dtype_get_mblen(type->mtype, type->prtype, &mbminlen, &mbmaxlen); + type->mbminlen = mbminlen & 7; + type->mbmaxlen = mbmaxlen & 7; + + ut_ad(dtype_validate(type)); +} + +/*********************************************************************//** +Sets a data type structure. */ +UNIV_INLINE +void +dtype_set( +/*======*/ + dtype_t* type, /*!< in: type struct to init */ + ulint mtype, /*!< in: main data type */ + ulint prtype, /*!< in: precise type */ + ulint len) /*!< in: precision of type */ +{ + ut_ad(type); + ut_ad(mtype <= DATA_MTYPE_MAX); + + type->mtype = static_cast(mtype); + type->prtype = static_cast(prtype); + type->len = static_cast(len); + + dtype_set_mblen(type); +} + +/*********************************************************************//** +Copies a data type structure. */ +UNIV_INLINE +void +dtype_copy( +/*=======*/ + dtype_t* type1, /*!< in: type struct to copy to */ + const dtype_t* type2) /*!< in: type struct to copy from */ +{ + *type1 = *type2; + + ut_ad(dtype_validate(type1)); +} + +/*********************************************************************//** +Gets the SQL main data type. +@return SQL main data type */ +UNIV_INLINE +ulint +dtype_get_mtype( +/*============*/ + const dtype_t* type) /*!< in: data type */ +{ + ut_ad(type); + + return(type->mtype); +} + +/*********************************************************************//** +Gets the precise data type. +@return precise data type */ +UNIV_INLINE +ulint +dtype_get_prtype( +/*=============*/ + const dtype_t* type) /*!< in: data type */ +{ + ut_ad(type); + + return(type->prtype); +} + +/*********************************************************************//** +Gets the type length. +@return fixed length of the type, in bytes, or 0 if variable-length */ +UNIV_INLINE +ulint +dtype_get_len( +/*==========*/ + const dtype_t* type) /*!< in: data type */ +{ + ut_ad(type); + + return(type->len); +} + +/*********************************************************************//** +Gets the minimum length of a character, in bytes. +@return minimum length of a char, in bytes, or 0 if this is not a +character type */ +UNIV_INLINE +ulint +dtype_get_mbminlen( +/*===============*/ + const dtype_t* type) /*!< in: type */ +{ + return type->mbminlen; +} +/*********************************************************************//** +Gets the maximum length of a character, in bytes. +@return maximum length of a char, in bytes, or 0 if this is not a +character type */ +UNIV_INLINE +ulint +dtype_get_mbmaxlen( +/*===============*/ + const dtype_t* type) /*!< in: type */ +{ + return type->mbmaxlen; +} + +/**********************************************************************//** +Stores for a type the information which determines its alphabetical ordering +and the storage size of an SQL NULL value. This is the >= 4.1.x storage +format. */ +UNIV_INLINE +void +dtype_new_store_for_order_and_null_size( +/*====================================*/ + byte* buf, /*!< in: buffer for + DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE + bytes where we store the info */ + const dtype_t* type, /*!< in: type struct */ + ulint prefix_len)/*!< in: prefix length to + replace type->len, or 0 */ +{ + compile_time_assert(6 == DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE); + + ulint len; + + ut_ad(type); + ut_ad(type->mtype >= DATA_VARCHAR); + ut_ad(type->mtype <= DATA_MTYPE_MAX); + + buf[0] = (byte)(type->mtype & 0xFFUL); + + if (type->prtype & DATA_BINARY_TYPE) { + buf[0] |= 128; + } + + /* In versions < 4.1.2 we had: if (type->prtype & DATA_NONLATIN1) { + buf[0] |= 64; + } + */ + + buf[1] = (byte)(type->prtype & 0xFFUL); + + len = prefix_len ? prefix_len : type->len; + + mach_write_to_2(buf + 2, len & 0xFFFFUL); + + ut_ad(dtype_get_charset_coll(type->prtype) <= MAX_CHAR_COLL_NUM); + mach_write_to_2(buf + 4, dtype_get_charset_coll(type->prtype)); + + if (type->prtype & DATA_NOT_NULL) { + buf[4] |= 128; + } +} + +/**********************************************************************//** +Reads to a type the stored information which determines its alphabetical +ordering and the storage size of an SQL NULL value. This is the < 4.1.x +storage format. */ +UNIV_INLINE +void +dtype_read_for_order_and_null_size( +/*===============================*/ + dtype_t* type, /*!< in: type struct */ + const byte* buf) /*!< in: buffer for stored type order info */ +{ + compile_time_assert(4 == DATA_ORDER_NULL_TYPE_BUF_SIZE); + type->mtype = buf[0] & 63; + type->prtype = buf[1]; + + if (buf[0] & 128) { + type->prtype |= DATA_BINARY_TYPE; + } + + type->len = mach_read_from_2(buf + 2); + + type->prtype = dtype_form_prtype(type->prtype, + data_mysql_default_charset_coll); + dtype_set_mblen(type); +} + +/**********************************************************************//** +Reads to a type the stored information which determines its alphabetical +ordering and the storage size of an SQL NULL value. This is the >= 4.1.x +storage format. */ +UNIV_INLINE +void +dtype_new_read_for_order_and_null_size( +/*===================================*/ + dtype_t* type, /*!< in: type struct */ + const byte* buf) /*!< in: buffer for stored type order info */ +{ + compile_time_assert(6 == DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE); + + type->mtype = buf[0] & 63; + type->prtype = buf[1]; + + if (buf[0] & 128) { + type->prtype |= DATA_BINARY_TYPE; + } + + if (buf[4] & 128) { + type->prtype |= DATA_NOT_NULL; + } + + type->len = mach_read_from_2(buf + 2); + + ulint charset_coll = mach_read_from_2(buf + 4) & CHAR_COLL_MASK; + + if (dtype_is_string_type(type->mtype)) { + ut_a(charset_coll <= MAX_CHAR_COLL_NUM); + + if (charset_coll == 0) { + /* This insert buffer record was inserted with MySQL + version < 4.1.2, and the charset-collation code was not + explicitly stored to dtype->prtype at that time. It + must be the default charset-collation of this MySQL + installation. */ + + charset_coll = data_mysql_default_charset_coll; + } + + type->prtype = dtype_form_prtype(type->prtype, charset_coll); + } + dtype_set_mblen(type); +} + +/***********************************************************************//** +Returns the size of a fixed size data type, 0 if not a fixed size type. +@return fixed size, or 0 */ +UNIV_INLINE +unsigned +dtype_get_fixed_size_low( +/*=====================*/ + ulint mtype, /*!< in: main type */ + ulint prtype, /*!< in: precise type */ + ulint len, /*!< in: length */ + ulint mbminlen, /*!< in: minimum length of a + multibyte character, in bytes */ + ulint mbmaxlen, /*!< in: maximum length of a + multibyte character, in bytes */ + ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */ +{ + switch (mtype) { + case DATA_SYS: +#ifdef UNIV_DEBUG + switch (prtype & DATA_MYSQL_TYPE_MASK) { + case DATA_ROW_ID: + ut_ad(len == DATA_ROW_ID_LEN); + break; + case DATA_TRX_ID: + ut_ad(len == DATA_TRX_ID_LEN); + break; + case DATA_ROLL_PTR: + ut_ad(len == DATA_ROLL_PTR_LEN); + break; + default: + ut_ad(0); + return(0); + } +#endif /* UNIV_DEBUG */ + /* fall through */ + case DATA_CHAR: + case DATA_FIXBINARY: + case DATA_INT: + case DATA_FLOAT: + case DATA_DOUBLE: + return static_cast(len); + case DATA_MYSQL: + if (prtype & DATA_BINARY_TYPE) { + return static_cast(len); + } else if (!comp) { + return static_cast(len); + } else { + if (mbminlen == mbmaxlen) { + return static_cast(len); + } + } + /* Treat as variable-length. */ + /* fall through */ + case DATA_VARCHAR: + case DATA_BINARY: + case DATA_DECIMAL: + case DATA_VARMYSQL: + case DATA_GEOMETRY: + case DATA_BLOB: + return(0); + default: + ut_error; + } + + return(0); +} + +/***********************************************************************//** +Returns the minimum size of a data type. +@return minimum size */ +UNIV_INLINE +unsigned +dtype_get_min_size_low( +/*===================*/ + ulint mtype, /*!< in: main type */ + ulint prtype, /*!< in: precise type */ + ulint len, /*!< in: length */ + ulint mbminlen, /*!< in: minimum length of a character */ + ulint mbmaxlen) /*!< in: maximum length of a character */ +{ + switch (mtype) { + case DATA_SYS: +#ifdef UNIV_DEBUG + switch (prtype & DATA_MYSQL_TYPE_MASK) { + case DATA_ROW_ID: + ut_ad(len == DATA_ROW_ID_LEN); + break; + case DATA_TRX_ID: + ut_ad(len == DATA_TRX_ID_LEN); + break; + case DATA_ROLL_PTR: + ut_ad(len == DATA_ROLL_PTR_LEN); + break; + default: + ut_ad(0); + return(0); + } +#endif /* UNIV_DEBUG */ + /* fall through */ + case DATA_CHAR: + case DATA_FIXBINARY: + case DATA_INT: + case DATA_FLOAT: + case DATA_DOUBLE: + return static_cast(len); + case DATA_MYSQL: + if (prtype & DATA_BINARY_TYPE) { + return static_cast(len); + } else { + if (mbminlen == mbmaxlen) { + return static_cast(len); + } + + /* this is a variable-length character set */ + ut_a(mbminlen > 0); + ut_a(mbmaxlen > mbminlen); + ut_a(len % mbmaxlen == 0); + return static_cast( + len * mbminlen / mbmaxlen); + } + case DATA_VARCHAR: + case DATA_BINARY: + case DATA_DECIMAL: + case DATA_VARMYSQL: + case DATA_GEOMETRY: + case DATA_BLOB: + return(0); + default: + ut_error; + } + + return(0); +} + +/***********************************************************************//** +Returns the maximum size of a data type. Note: types in system tables may be +incomplete and return incorrect information. +@return maximum size */ +UNIV_INLINE +ulint +dtype_get_max_size_low( +/*===================*/ + ulint mtype, /*!< in: main type */ + ulint len) /*!< in: length */ +{ + switch (mtype) { + case DATA_SYS: + case DATA_CHAR: + case DATA_FIXBINARY: + case DATA_INT: + case DATA_FLOAT: + case DATA_DOUBLE: + case DATA_MYSQL: + case DATA_VARCHAR: + case DATA_BINARY: + case DATA_DECIMAL: + case DATA_VARMYSQL: + return(len); + case DATA_GEOMETRY: + case DATA_BLOB: + break; + default: + ut_error; + } + + return(ULINT_MAX); +} + +/***********************************************************************//** +Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a type. +For fixed length types it is the fixed length of the type, otherwise 0. +@return SQL null storage size in ROW_FORMAT=REDUNDANT */ +UNIV_INLINE +ulint +dtype_get_sql_null_size( +/*====================*/ + const dtype_t* type, /*!< in: type */ + ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */ +{ + return(dtype_get_fixed_size_low(type->mtype, type->prtype, type->len, + type->mbminlen, type->mbmaxlen, comp)); +} diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h index bd5eb0688cba5..64182aabc386c 100644 --- a/storage/innobase/include/db0err.h +++ b/storage/innobase/include/db0err.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2021, MariaDB Corporation. +Copyright (c) 2015, 2022, 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 @@ -141,9 +141,6 @@ enum dberr_t { DB_IO_PARTIAL_FAILED, /*!< Partial IO request failed */ - DB_FORCED_ABORT, /*!< Transaction was forced to rollback - by a higher priority transaction */ - DB_TABLE_CORRUPT, /*!< Table/clustered index is corrupted */ diff --git a/storage/innobase/include/dict0boot.h b/storage/innobase/include/dict0boot.h index 07ecfe4edffa9..a65287476ef8e 100644 --- a/storage/innobase/include/dict0boot.h +++ b/storage/innobase/include/dict0boot.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2021, MariaDB Corporation. +Copyright (c) 2018, 2022, 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 @@ -33,9 +33,6 @@ Created 4/18/1996 Heikki Tuuri #include "buf0buf.h" #include "dict0dict.h" -/** @return the DICT_HDR block, x-latched */ -#define dict_hdr_get(mtr) buf_page_get \ - (page_id_t(DICT_HDR_SPACE, DICT_HDR_PAGE_NO), 0, RW_X_LATCH, mtr) /**********************************************************************//** Returns a new table, index, or space id. */ void diff --git a/storage/innobase/include/dict0crea.h b/storage/innobase/include/dict0crea.h index 0267f1bae6928..c40df12babe5a 100644 --- a/storage/innobase/include/dict0crea.h +++ b/storage/innobase/include/dict0crea.h @@ -110,7 +110,7 @@ uint32_t dict_drop_index_tree(btr_pcur_t *pcur, trx_t *trx, mtr_t *mtr) /***************************************************************//** Creates an index tree for the index if it is not a member of a cluster. Don't update SYSTEM TABLES. -@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ +@return error code */ dberr_t dict_create_index_tree_in_mem( /*==========================*/ @@ -272,6 +272,6 @@ dict_get_v_col_pos( #define INDEX_CREATE_INDEX_TREE 3 #define INDEX_ADD_TO_CACHE 4 -#include "dict0crea.ic" +#include "dict0crea.inl" #endif diff --git a/storage/innobase/include/dict0crea.ic b/storage/innobase/include/dict0crea.inl similarity index 100% rename from storage/innobase/include/dict0crea.ic rename to storage/innobase/include/dict0crea.inl diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 505fe76b00841..8daa07160a3e8 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -2,7 +2,7 @@ Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2022, 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 @@ -132,7 +132,7 @@ enum dict_table_op_t { @param[in] table_op operation to perform when opening @return table object after locking MDL shared @retval NULL if the table is not readable, or if trylock && MDL blocked */ -template +template dict_table_t* dict_acquire_mdl_shared(dict_table_t *table, THD *thd, @@ -146,6 +146,7 @@ dict_acquire_mdl_shared(dict_table_t *table, @param[in,out] thd background thread, or NULL to not acquire MDL @param[out] mdl mdl ticket, or NULL @return table, NULL if does not exist */ +template dict_table_t* dict_table_open_on_id(table_id_t table_id, bool dict_locked, dict_table_op_t table_op, THD *thd= nullptr, @@ -368,12 +369,8 @@ dberr_t dict_table_rename_in_cache( /*=======================*/ dict_table_t* table, /*!< in/out: table */ - const char* new_name, /*!< in: new name */ - bool rename_also_foreigns, - /*!< in: in ALTER TABLE we want - to preserve the original table name - in constraints which reference it */ - bool replace_new_file = false) + span new_name, /*!< in: new name */ + bool replace_new_file) /*!< in: whether to replace the file with the new name (as part of rolling back TRUNCATE) */ @@ -424,14 +421,6 @@ dict_foreign_add_to_cache( dict_err_ignore_t ignore_err) /*!< in: error to be ignored */ MY_ATTRIBUTE((nonnull(1), warn_unused_result)); -/*********************************************************************//** -Checks if a table is referenced by foreign keys. -@return TRUE if table is referenced by a foreign key */ -ibool -dict_table_is_referenced_by_foreign_key( -/*====================================*/ - const dict_table_t* table) /*!< in: InnoDB table */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************************//** Replace the index passed in with another equivalent index in the foreign key lists of the table. @@ -641,19 +630,6 @@ dict_table_get_next_index( # define dict_table_get_next_index(index) UT_LIST_GET_NEXT(indexes, index) #endif /* UNIV_DEBUG */ -/* Skip corrupted index */ -#define dict_table_skip_corrupt_index(index) \ - while (index && index->is_corrupted()) { \ - index = dict_table_get_next_index(index); \ - } - -/* Get the next non-corrupt index */ -#define dict_table_next_uncorrupted_index(index) \ -do { \ - index = dict_table_get_next_index(index); \ - dict_table_skip_corrupt_index(index); \ -} while (0) - #define dict_index_is_clust(index) (index)->is_clust() #define dict_index_is_auto_gen_clust(index) (index)->is_gen_clust() #define dict_index_is_unique(index) (index)->is_unique() @@ -928,17 +904,6 @@ dict_table_copy_types( dtuple_t* tuple, /*!< in/out: data tuple */ const dict_table_t* table) /*!< in: table */ MY_ATTRIBUTE((nonnull)); -/**********************************************************************//** -Looks for an index with the given id. NOTE that we do not acquire -dict_sys.latch: this function is for emergency purposes like -printing info of a corrupt database page! -@return index or NULL if not found from cache */ -dict_index_t* -dict_index_find_on_id_low( -/*======================*/ - index_id_t id) /*!< in: index id */ - MY_ATTRIBUTE((warn_unused_result)); - /** Adds an index to the dictionary cache, with possible indexing newly added column. @param[in,out] index index; NOTE! The index memory @@ -1108,16 +1073,16 @@ dict_table_get_nth_col_pos( ulint n, /*!< in: column number */ ulint* prefix_col_pos) /*!< out: col num if prefix */ MY_ATTRIBUTE((nonnull(1), warn_unused_result)); -/*******************************************************************//** -Adds a column to index. */ -void -dict_index_add_col( -/*===============*/ - dict_index_t* index, /*!< in/out: index */ - const dict_table_t* table, /*!< in: table */ - dict_col_t* col, /*!< in: column */ - ulint prefix_len) /*!< in: column prefix length */ - MY_ATTRIBUTE((nonnull)); +/** Add a column to an index. +@param index index +@param table table +@param col column +@param prefix_len column prefix length +@param descending whether to use descending order */ +void dict_index_add_col(dict_index_t *index, const dict_table_t *table, + dict_col_t *col, ulint prefix_len, + bool descending= false) + MY_ATTRIBUTE((nonnull)); /*******************************************************************//** Copies types of fields contained in index to tuple. */ @@ -1350,10 +1315,10 @@ class dict_sys_t std::atomic latch_ex_wait_start; /** the rw-latch protecting the data dictionary cache */ - MY_ALIGNED(CACHE_LINE_SIZE) srw_lock latch; + alignas(CPU_LEVEL1_DCACHE_LINESIZE) srw_lock latch; #ifdef UNIV_DEBUG /** whether latch is being held in exclusive mode (by any thread) */ - bool latch_ex; + Atomic_relaxed latch_ex; /** number of S-latch holders */ Atomic_counter latch_readers; #endif @@ -1511,39 +1476,28 @@ class dict_sys_t } #endif - /** Move a table to the non-LRU list from the LRU list. - @return whether the table was evictable */ - bool prevent_eviction(dict_table_t *table) + /** Move a table to the non-LRU list from the LRU list. */ + void prevent_eviction(dict_table_t *table) { ut_d(locked()); ut_ad(find(table)); if (!table->can_be_evicted) - return false; + return; table->can_be_evicted= false; UT_LIST_REMOVE(table_LRU, table); UT_LIST_ADD_LAST(table_non_LRU, table); - return true; - } - /** Move a table from the non-LRU list to the LRU list. */ - void allow_eviction(dict_table_t *table) - { - ut_d(locked()); - ut_ad(find(table)); - ut_ad(!table->can_be_evicted); - table->can_be_evicted= true; - UT_LIST_REMOVE(table_non_LRU, table); - UT_LIST_ADD_FIRST(table_LRU, table); } #ifdef UNIV_DEBUG /** @return whether any thread (not necessarily the current thread) is holding the latch; that is, this check may return false positives */ - bool frozen() const { return latch_readers || locked(); } + bool frozen() const { return latch_readers || latch_ex; } /** @return whether any thread (not necessarily the current thread) - is holding the exclusive latch; that is, this check may return false - positives */ - bool locked() const { return latch_ex; } + is holding a shared latch */ + bool frozen_not_locked() const { return latch_readers; } + /** @return whether the current thread holds the exclusive latch */ + bool locked() const { return latch_ex == pthread_self(); } #endif private: /** Acquire the exclusive latch */ @@ -1562,11 +1516,11 @@ class dict_sys_t { ut_ad(!latch_readers); ut_ad(!latch_ex); - ut_d(latch_ex= true); + ut_d(latch_ex= pthread_self()); } else lock_wait(SRW_LOCK_ARGS(file, line)); - } + } #ifdef UNIV_PFS_RWLOCK /** Unlock the data dictionary cache. */ @@ -1579,9 +1533,9 @@ class dict_sys_t /** Unlock the data dictionary cache. */ void unlock() { - ut_ad(latch_ex); + ut_ad(latch_ex == pthread_self()); ut_ad(!latch_readers); - ut_d(latch_ex= false); + ut_d(latch_ex= 0); latch.wr_unlock(); } /** Acquire a shared lock on the dictionary cache. */ @@ -1673,41 +1627,13 @@ dict_fs2utf8( size_t table_utf8_size)/*!< in: table_utf8 size */ MY_ATTRIBUTE((nonnull)); -/**********************************************************************//** -Check whether the table is corrupted. -@return nonzero for corrupted table, zero for valid tables */ -UNIV_INLINE -ulint -dict_table_is_corrupted( -/*====================*/ - const dict_table_t* table) /*!< in: table */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); - -/** Flag an index and table corrupted both in the data dictionary cache +/** Flag an index corrupted both in the data dictionary cache and in the system table SYS_INDEXES. @param index index to be flagged as corrupted -@param ctx context (for error log reporting) -@param dict_locked whether dict_sys.latch is held in exclusive mode */ -void dict_set_corrupted(dict_index_t *index, const char *ctx, bool dict_locked) +@param ctx context (for error log reporting) */ +void dict_set_corrupted(dict_index_t *index, const char *ctx) ATTRIBUTE_COLD __attribute__((nonnull)); -/** Flags an index corrupted in the data dictionary cache only. This -is used mostly to mark a corrupted index when index's own dictionary -is corrupted, and we force to load such index for repair purpose -@param[in,out] index index that is corrupted */ -void -dict_set_corrupted_index_cache_only( - dict_index_t* index); - -/**********************************************************************//** -Flags a table with specified space_id corrupted in the table dictionary -cache. -@return TRUE if successful */ -bool dict_set_corrupted_by_space(const fil_space_t* space); - -/** Flag a table encrypted in the data dictionary cache. */ -void dict_set_encrypted_by_space(const fil_space_t* space); - /** Sets merge_threshold in the SYS_INDEXES @param[in,out] index index @param[in] merge_threshold value to set */ @@ -1814,6 +1740,6 @@ bool dict_table_have_virtual_index( dict_table_t* table); -#include "dict0dict.ic" +#include "dict0dict.inl" #endif diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic deleted file mode 100644 index 8af2d93f831c7..0000000000000 --- a/storage/innobase/include/dict0dict.ic +++ /dev/null @@ -1,1230 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2021, 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 02110-1335 USA - -*****************************************************************************/ - -/******************************************************************//** -@file include/dict0dict.ic -Data dictionary system - -Created 1/8/1996 Heikki Tuuri -***********************************************************************/ - -#include "fsp0sysspace.h" -#include "dict0pagecompress.h" - -/*********************************************************************//** -Gets the minimum number of bytes per character. -@return minimum multi-byte char size, in bytes */ -UNIV_INLINE -unsigned -dict_col_get_mbminlen( -/*==================*/ - const dict_col_t* col) /*!< in: column */ -{ - return col->mbminlen; -} -/*********************************************************************//** -Gets the maximum number of bytes per character. -@return maximum multi-byte char size, in bytes */ -UNIV_INLINE -unsigned -dict_col_get_mbmaxlen( -/*==================*/ - const dict_col_t* col) /*!< in: column */ -{ - return col->mbmaxlen; -} -/*********************************************************************//** -Gets the column data type. */ -UNIV_INLINE -void -dict_col_copy_type( -/*===============*/ - const dict_col_t* col, /*!< in: column */ - dtype_t* type) /*!< out: data type */ -{ - ut_ad(col != NULL); - ut_ad(type != NULL); - - type->mtype = col->mtype; - type->prtype = col->prtype; - type->len = col->len; - type->mbminlen = col->mbminlen; - type->mbmaxlen = col->mbmaxlen; -} - -#ifdef UNIV_DEBUG -/*********************************************************************//** -Assert that a column and a data type match. -@return TRUE */ -UNIV_INLINE -ibool -dict_col_type_assert_equal( -/*=======================*/ - const dict_col_t* col, /*!< in: column */ - const dtype_t* type) /*!< in: data type */ -{ - ut_ad(col->mtype == type->mtype); - ut_ad(col->prtype == type->prtype); - //ut_ad(col->len == type->len); - ut_ad(col->mbminlen == type->mbminlen); - ut_ad(col->mbmaxlen == type->mbmaxlen); - - return(TRUE); -} -#endif /* UNIV_DEBUG */ - -/***********************************************************************//** -Returns the minimum size of the column. -@return minimum size */ -UNIV_INLINE -unsigned -dict_col_get_min_size( -/*==================*/ - const dict_col_t* col) /*!< in: column */ -{ - return(dtype_get_min_size_low(col->mtype, col->prtype, col->len, - col->mbminlen, col->mbmaxlen)); -} -/***********************************************************************//** -Returns the maximum size of the column. -@return maximum size */ -UNIV_INLINE -ulint -dict_col_get_max_size( -/*==================*/ - const dict_col_t* col) /*!< in: column */ -{ - return(dtype_get_max_size_low(col->mtype, col->len)); -} -/***********************************************************************//** -Returns the size of a fixed size column, 0 if not a fixed size column. -@return fixed size, or 0 */ -UNIV_INLINE -unsigned -dict_col_get_fixed_size( -/*====================*/ - const dict_col_t* col, /*!< in: column */ - ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */ -{ - return(dtype_get_fixed_size_low(col->mtype, col->prtype, col->len, - col->mbminlen, col->mbmaxlen, comp)); -} -/***********************************************************************//** -Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a column. -For fixed length types it is the fixed length of the type, otherwise 0. -@return SQL null storage size in ROW_FORMAT=REDUNDANT */ -UNIV_INLINE -unsigned -dict_col_get_sql_null_size( -/*=======================*/ - const dict_col_t* col, /*!< in: column */ - ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */ -{ - return(dict_col_get_fixed_size(col, comp)); -} - -/*********************************************************************//** -Gets the column number. -@return col->ind, table column position (starting from 0) */ -UNIV_INLINE -unsigned -dict_col_get_no( -/*============*/ - const dict_col_t* col) /*!< in: column */ -{ - return(col->ind); -} - -/*********************************************************************//** -Gets the column position in the clustered index. */ -UNIV_INLINE -ulint -dict_col_get_clust_pos( -/*===================*/ - const dict_col_t* col, /*!< in: table column */ - const dict_index_t* clust_index) /*!< in: clustered index */ -{ - ulint i; - - ut_ad(dict_index_is_clust(clust_index)); - - for (i = 0; i < clust_index->n_def; i++) { - const dict_field_t* field = &clust_index->fields[i]; - - if (!field->prefix_len && field->col == col) { - return(i); - } - } - - return(ULINT_UNDEFINED); -} - -/** Gets the column position in the given index. -@param[in] col table column -@param[in] index index to be searched for column -@return position of column in the given index. */ -UNIV_INLINE -ulint -dict_col_get_index_pos( - const dict_col_t* col, - const dict_index_t* index) -{ - ulint i; - - for (i = 0; i < index->n_def; i++) { - const dict_field_t* field = &index->fields[i]; - - if (!field->prefix_len && field->col == col) { - return(i); - } - } - - return(ULINT_UNDEFINED); -} - -#ifdef UNIV_DEBUG -/********************************************************************//** -Gets the first index on the table (the clustered index). -@return index, NULL if none exists */ -UNIV_INLINE -dict_index_t* -dict_table_get_first_index( -/*=======================*/ - const dict_table_t* table) /*!< in: table */ -{ - ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - - return(UT_LIST_GET_FIRST(((dict_table_t*) table)->indexes)); -} - -/********************************************************************//** -Gets the last index on the table. -@return index, NULL if none exists */ -UNIV_INLINE -dict_index_t* -dict_table_get_last_index( -/*=======================*/ - const dict_table_t* table) /*!< in: table */ -{ - ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - return(UT_LIST_GET_LAST((const_cast(table)) - ->indexes)); -} - -/********************************************************************//** -Gets the next index on the table. -@return index, NULL if none left */ -UNIV_INLINE -dict_index_t* -dict_table_get_next_index( -/*======================*/ - const dict_index_t* index) /*!< in: index */ -{ - ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); - return(UT_LIST_GET_NEXT(indexes, (dict_index_t*) index)); -} -#endif /* UNIV_DEBUG */ - -/********************************************************************//** -Gets the number of user-defined non-virtual columns in a table in the -dictionary cache. -@return number of user-defined (e.g., not ROW_ID) non-virtual -columns of a table */ -UNIV_INLINE -unsigned -dict_table_get_n_user_cols( -/*=======================*/ - const dict_table_t* table) /*!< in: table */ -{ - ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - /* n_cols counts stored columns only. A table may contain - virtual columns and no user-specified stored columns at all. */ - ut_ad(table->n_cols >= DATA_N_SYS_COLS); - return unsigned(table->n_cols) - DATA_N_SYS_COLS; -} - -/********************************************************************//** -Gets the number of all non-virtual columns (also system) in a table -in the dictionary cache. -@return number of non-virtual columns of a table */ -UNIV_INLINE -unsigned -dict_table_get_n_cols( -/*==================*/ - const dict_table_t* table) /*!< in: table */ -{ - ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - return(table->n_cols); -} - -/** Gets the number of virtual columns in a table in the dictionary cache. -@param[in] table the table to check -@return number of virtual columns of a table */ -UNIV_INLINE -unsigned -dict_table_get_n_v_cols( - const dict_table_t* table) -{ - ut_ad(table); - ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - - return(table->n_v_cols); -} - -/** Check if a table has indexed virtual columns -@param[in] table the table to check -@return true is the table has indexed virtual columns */ -UNIV_INLINE -bool -dict_table_has_indexed_v_cols( - const dict_table_t* table) -{ - - for (unsigned i = 0; i < table->n_v_cols; i++) { - const dict_v_col_t* col = dict_table_get_nth_v_col(table, i); - if (col->m_col.ord_part) { - return(true); - } - } - - return(false); -} - -/********************************************************************//** -Gets the approximately estimated number of rows in the table. -@return estimated number of rows */ -UNIV_INLINE -ib_uint64_t -dict_table_get_n_rows( -/*==================*/ - const dict_table_t* table) /*!< in: table */ -{ - ut_ad(table->stat_initialized); - - return(table->stat_n_rows); -} - -/********************************************************************//** -Increment the number of rows in the table by one. -Notice that this operation is not protected by any latch, the number is -approximate. */ -UNIV_INLINE -void -dict_table_n_rows_inc( -/*==================*/ - dict_table_t* table) /*!< in/out: table */ -{ - if (table->stat_initialized) { - ib_uint64_t n_rows = table->stat_n_rows; - if (n_rows < 0xFFFFFFFFFFFFFFFFULL) { - table->stat_n_rows = n_rows + 1; - } - } -} - -/********************************************************************//** -Decrement the number of rows in the table by one. -Notice that this operation is not protected by any latch, the number is -approximate. */ -UNIV_INLINE -void -dict_table_n_rows_dec( -/*==================*/ - dict_table_t* table) /*!< in/out: table */ -{ - if (table->stat_initialized) { - ib_uint64_t n_rows = table->stat_n_rows; - if (n_rows > 0) { - table->stat_n_rows = n_rows - 1; - } - } -} - -#ifdef UNIV_DEBUG -/********************************************************************//** -Gets the nth column of a table. -@return pointer to column object */ -UNIV_INLINE -dict_col_t* -dict_table_get_nth_col( -/*===================*/ - const dict_table_t* table, /*!< in: table */ - ulint pos) /*!< in: position of column */ -{ - ut_ad(pos < table->n_def); - ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - - return((dict_col_t*) (table->cols) + pos); -} - -/** Gets the nth virtual column of a table. -@param[in] table table -@param[in] pos position of virtual column -@return pointer to virtual column object */ -UNIV_INLINE -dict_v_col_t* -dict_table_get_nth_v_col( - const dict_table_t* table, - ulint pos) -{ - ut_ad(table); - ut_ad(pos < table->n_v_def); - ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - ut_ad(!table->v_cols[pos].m_col.is_added()); - ut_ad(!table->v_cols[pos].m_col.is_dropped()); - return &table->v_cols[pos]; -} - -/********************************************************************//** -Gets the given system column of a table. -@return pointer to column object */ -UNIV_INLINE -dict_col_t* -dict_table_get_sys_col( -/*===================*/ - const dict_table_t* table, /*!< in: table */ - unsigned sys) /*!< in: DATA_ROW_ID, ... */ -{ - dict_col_t* col; - col = dict_table_get_nth_col(table, - dict_table_get_sys_col_no(table, sys)); - ut_ad(col->mtype == DATA_SYS); - ut_ad(col->prtype == (sys | DATA_NOT_NULL)); - - return(col); -} -#endif /* UNIV_DEBUG */ - -/********************************************************************//** -Gets the given system column number of a table. -@return column number */ -UNIV_INLINE -unsigned -dict_table_get_sys_col_no( -/*======================*/ - const dict_table_t* table, /*!< in: table */ - unsigned sys) /*!< in: DATA_ROW_ID, ... */ -{ - ut_ad(sys < DATA_N_SYS_COLS); - ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - return unsigned(table->n_cols) + (sys - DATA_N_SYS_COLS); -} - -/************************************************************************ -Check if the table has an FTS index. */ -UNIV_INLINE -ibool -dict_table_has_fts_index( -/*=====================*/ - /* out: TRUE if table has an FTS index */ - dict_table_t* table) /* in: table */ -{ - return(DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS)); -} - -/** Validate the flags for tables that are not ROW_FORMAT=REDUNDANT. -@param[in] flags table flags -@return whether the flags are valid */ -inline -bool -dict_tf_is_valid_not_redundant(ulint flags) -{ - const bool atomic_blobs = DICT_TF_HAS_ATOMIC_BLOBS(flags); - - ulint zip_ssize = DICT_TF_GET_ZIP_SSIZE(flags); - - if (!zip_ssize) { - /* Not ROW_FORMAT=COMPRESSED */ - } else if (!atomic_blobs) { - /* ROW_FORMAT=COMPRESSED implies ROW_FORMAT=DYNAMIC - for the uncompressed page format */ - return(false); - } else if (zip_ssize > PAGE_ZIP_SSIZE_MAX - || zip_ssize > srv_page_size_shift - || srv_page_size_shift > UNIV_ZIP_SIZE_SHIFT_MAX) { - /* KEY_BLOCK_SIZE is out of bounds, or - ROW_FORMAT=COMPRESSED is not supported with this - innodb_page_size (only up to 16KiB) */ - return(false); - } - - switch (DICT_TF_GET_PAGE_COMPRESSION_LEVEL(flags)) { - case 0: - /* PAGE_COMPRESSION_LEVEL=0 should imply PAGE_COMPRESSED=NO */ - return(!DICT_TF_GET_PAGE_COMPRESSION(flags)); - case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: - /* PAGE_COMPRESSION_LEVEL requires - ROW_FORMAT=COMPACT or ROW_FORMAT=DYNAMIC - (not ROW_FORMAT=COMPRESSED or ROW_FORMAT=REDUNDANT) - and PAGE_COMPRESSED=YES */ - return(!zip_ssize && DICT_TF_GET_PAGE_COMPRESSION(flags)); - default: - /* Invalid PAGE_COMPRESSION_LEVEL value */ - return(false); - } -} - -/** Validate the table flags. -@param[in] flags Table flags -@return true if valid. */ -UNIV_INLINE -bool -dict_tf_is_valid( - ulint flags) -{ - ut_ad(flags < 1U << DICT_TF_BITS); - /* The DATA_DIRECTORY flag can be assigned fully independently - of all other persistent table flags. */ - flags &= ~DICT_TF_MASK_DATA_DIR; - if (!(flags & 1)) { - /* Only ROW_FORMAT=REDUNDANT has 0 in the least significant - bit. For ROW_FORMAT=REDUNDANT, only the DATA_DIR flag - (which we cleared above) can be set. If any other flags - are set, the flags are invalid. */ - return(flags == 0 || flags == DICT_TF_MASK_NO_ROLLBACK); - } - - return(dict_tf_is_valid_not_redundant(flags)); -} - -/** Validate both table flags and table flags2 and make sure they -are compatible. -@param[in] flags Table flags -@param[in] flags2 Table flags2 -@return true if valid. */ -UNIV_INLINE -bool -dict_tf2_is_valid( - ulint flags, - ulint flags2) -{ - if (!dict_tf_is_valid(flags)) { - return(false); - } - - if ((flags2 & DICT_TF2_UNUSED_BIT_MASK) != 0) { - return(false); - } - - return(true); -} - -/********************************************************************//** -Determine the file format from dict_table_t::flags -The low order bit will be zero for REDUNDANT and 1 for COMPACT. For any -other row_format, file_format is > 0 and DICT_TF_COMPACT will also be set. -@return file format version */ -UNIV_INLINE -rec_format_t -dict_tf_get_rec_format( -/*===================*/ - ulint flags) /*!< in: dict_table_t::flags */ -{ - ut_a(dict_tf_is_valid(flags)); - - if (!DICT_TF_GET_COMPACT(flags)) { - return(REC_FORMAT_REDUNDANT); - } - - if (!DICT_TF_HAS_ATOMIC_BLOBS(flags)) { - return(REC_FORMAT_COMPACT); - } - - if (DICT_TF_GET_ZIP_SSIZE(flags)) { - return(REC_FORMAT_COMPRESSED); - } - - return(REC_FORMAT_DYNAMIC); -} - -/** Set the various values in a dict_table_t::flags pointer. -@param[in,out] flags, Pointer to a 4 byte Table Flags -@param[in] format File Format -@param[in] zip_ssize Zip Shift Size -@param[in] use_data_dir Table uses DATA DIRECTORY -@param[in] page_compressed Table uses page compression -@param[in] page_compression_level Page compression level */ -UNIV_INLINE -void -dict_tf_set( -/*========*/ - ulint* flags, - rec_format_t format, - ulint zip_ssize, - bool use_data_dir, - bool page_compressed, - ulint page_compression_level) -{ - *flags = use_data_dir ? 1 << DICT_TF_POS_DATA_DIR : 0; - - switch (format) { - case REC_FORMAT_REDUNDANT: - ut_ad(zip_ssize == 0); - /* no other options are allowed */ - ut_ad(!page_compressed); - return; - case REC_FORMAT_COMPACT: - *flags |= DICT_TF_COMPACT; - ut_ad(zip_ssize == 0); - break; - case REC_FORMAT_COMPRESSED: - *flags |= DICT_TF_COMPACT - | (1 << DICT_TF_POS_ATOMIC_BLOBS) - | (zip_ssize << DICT_TF_POS_ZIP_SSIZE); - break; - case REC_FORMAT_DYNAMIC: - *flags |= DICT_TF_COMPACT - | (1 << DICT_TF_POS_ATOMIC_BLOBS); - ut_ad(zip_ssize == 0); - break; - } - - if (page_compressed) { - *flags |= (1 << DICT_TF_POS_ATOMIC_BLOBS) - | (1 << DICT_TF_POS_PAGE_COMPRESSION) - | (page_compression_level << DICT_TF_POS_PAGE_COMPRESSION_LEVEL); - - ut_ad(zip_ssize == 0); - ut_ad(dict_tf_get_page_compression(*flags) == TRUE); - ut_ad(dict_tf_get_page_compression_level(*flags) == page_compression_level); - } -} - -/** Convert a 32 bit integer table flags to the 32 bit FSP Flags. -Fsp Flags are written into the tablespace header at the offset -FSP_SPACE_FLAGS and are also stored in the fil_space_t::flags field. -The following chart shows the translation of the low order bit. -Other bits are the same. -========================= Low order bit ========================== - | REDUNDANT | COMPACT | COMPRESSED | DYNAMIC -dict_table_t::flags | 0 | 1 | 1 | 1 -fil_space_t::flags | 0 | 0 | 1 | 1 -================================================================== -@param[in] table_flags dict_table_t::flags -@return tablespace flags (fil_space_t::flags) */ -inline uint32_t dict_tf_to_fsp_flags(unsigned table_flags) -{ - uint32_t fsp_flags; - uint32_t page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL( - table_flags); - - ut_ad((DICT_TF_GET_PAGE_COMPRESSION(table_flags) == 0) - == (page_compression_level == 0)); - - DBUG_EXECUTE_IF("dict_tf_to_fsp_flags_failure", return UINT32_MAX;); - - /* No ROW_FORMAT=COMPRESSED for innodb_checksum_algorithm=full_crc32 */ - if ((srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_FULL_CRC32 - || srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_FULL_CRC32) - && !(table_flags & DICT_TF_MASK_ZIP_SSIZE)) { - - fsp_flags = 1U << FSP_FLAGS_FCRC32_POS_MARKER - | FSP_FLAGS_FCRC32_PAGE_SSIZE(); - - if (page_compression_level) { - fsp_flags |= static_cast( - innodb_compression_algorithm) - << FSP_FLAGS_FCRC32_POS_COMPRESSED_ALGO; - } - } else { - /* Adjust bit zero. */ - fsp_flags = DICT_TF_HAS_ATOMIC_BLOBS(table_flags) ? 1 : 0; - - /* ZIP_SSIZE and ATOMIC_BLOBS are at the same position. */ - fsp_flags |= table_flags - & (DICT_TF_MASK_ZIP_SSIZE | DICT_TF_MASK_ATOMIC_BLOBS); - - fsp_flags |= FSP_FLAGS_PAGE_SSIZE(); - - if (page_compression_level) { - fsp_flags |= FSP_FLAGS_MASK_PAGE_COMPRESSION; - } - } - - ut_a(fil_space_t::is_valid_flags(fsp_flags, false)); - - if (DICT_TF_HAS_DATA_DIR(table_flags)) { - fsp_flags |= 1U << FSP_FLAGS_MEM_DATA_DIR; - } - - fsp_flags |= page_compression_level << FSP_FLAGS_MEM_COMPRESSION_LEVEL; - - return(fsp_flags); -} - -/********************************************************************//** -Convert a 32 bit integer table flags to the 32bit integer that is written -to a SYS_TABLES.TYPE field. The following chart shows the translation of -the low order bit. Other bits are the same. -========================= Low order bit ========================== - | REDUNDANT | COMPACT | COMPRESSED and DYNAMIC -dict_table_t::flags | 0 | 1 | 1 -SYS_TABLES.TYPE | 1 | 1 | 1 -================================================================== -@return ulint containing SYS_TABLES.TYPE */ -UNIV_INLINE -ulint -dict_tf_to_sys_tables_type( -/*=======================*/ - ulint flags) /*!< in: dict_table_t::flags */ -{ - ulint type; - - ut_a(dict_tf_is_valid(flags)); - - /* Adjust bit zero. It is always 1 in SYS_TABLES.TYPE */ - type = 1; - - /* ZIP_SSIZE, ATOMIC_BLOBS, DATA_DIR, PAGE_COMPRESSION, - PAGE_COMPRESSION_LEVEL are the same. */ - type |= flags & (DICT_TF_MASK_ZIP_SSIZE - | DICT_TF_MASK_ATOMIC_BLOBS - | DICT_TF_MASK_DATA_DIR - | DICT_TF_MASK_PAGE_COMPRESSION - | DICT_TF_MASK_PAGE_COMPRESSION_LEVEL - | DICT_TF_MASK_NO_ROLLBACK); - - return(type); -} - -/********************************************************************//** -Gets the number of fields in the internal representation of an index, -including fields added by the dictionary system. -@return number of fields */ -UNIV_INLINE -uint16_t -dict_index_get_n_fields( -/*====================*/ - const dict_index_t* index) /*!< in: an internal - representation of index (in - the dictionary cache) */ -{ - ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); - return(index->n_fields); -} - -/********************************************************************//** -Gets the number of fields in the internal representation of an index -that uniquely determine the position of an index entry in the index, if -we do not take multiversioning into account: in the B-tree use the value -returned by dict_index_get_n_unique_in_tree. -@return number of fields */ -UNIV_INLINE -uint16_t -dict_index_get_n_unique( -/*====================*/ - const dict_index_t* index) /*!< in: an internal representation - of index (in the dictionary cache) */ -{ - ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); - ut_ad(index->cached); - return(index->n_uniq); -} - -/********************************************************************//** -Gets the number of fields in the internal representation of an index -which uniquely determine the position of an index entry in the index, if -we also take multiversioning into account. -@return number of fields */ -UNIV_INLINE -uint16_t -dict_index_get_n_unique_in_tree( -/*============================*/ - const dict_index_t* index) /*!< in: an internal representation - of index (in the dictionary cache) */ -{ - ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); - ut_ad(index->cached); - - if (dict_index_is_clust(index)) { - - return(dict_index_get_n_unique(index)); - } - - return(dict_index_get_n_fields(index)); -} - -/** -Gets the number of fields on nonleaf page level in the internal representation -of an index which uniquely determine the position of an index entry in the -index, if we also take multiversioning into account. Note, it doesn't -include page no field. -@param[in] index index -@return number of fields */ -UNIV_INLINE -uint16_t -dict_index_get_n_unique_in_tree_nonleaf( - const dict_index_t* index) -{ - ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); - ut_ad(index->cached); - - if (dict_index_is_spatial(index)) { - /* For spatial index, on non-leaf page, we have only - 2 fields(mbr+page_no). So, except page no field, - there's one field there. */ - return(DICT_INDEX_SPATIAL_NODEPTR_SIZE); - } else { - return(dict_index_get_n_unique_in_tree(index)); - } -} - -/********************************************************************//** -Gets the number of user-defined ordering fields in the index. In the internal -representation of clustered indexes we add the row id to the ordering fields -to make a clustered index unique, but this function returns the number of -fields the user defined in the index as ordering fields. -@return number of fields */ -UNIV_INLINE -uint16_t -dict_index_get_n_ordering_defined_by_user( -/*======================================*/ - const dict_index_t* index) /*!< in: an internal representation - of index (in the dictionary cache) */ -{ - return(index->n_user_defined_cols); -} - -#ifdef UNIV_DEBUG -/********************************************************************//** -Gets the nth field of an index. -@return pointer to field object */ -UNIV_INLINE -dict_field_t* -dict_index_get_nth_field( -/*=====================*/ - const dict_index_t* index, /*!< in: index */ - ulint pos) /*!< in: position of field */ -{ - ut_ad(pos < index->n_def); - ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); - - return((dict_field_t*) (index->fields) + pos); -} -#endif /* UNIV_DEBUG */ - -/*********************************************************************//** -Gets the field column. -@return field->col, pointer to the table column */ -UNIV_INLINE -const dict_col_t* -dict_field_get_col( -/*===============*/ - const dict_field_t* field) /*!< in: index field */ -{ - return(field->col); -} - -/********************************************************************//** -Gets pointer to the nth column in an index. -@return column */ -UNIV_INLINE -const dict_col_t* -dict_index_get_nth_col( -/*===================*/ - const dict_index_t* index, /*!< in: index */ - ulint pos) /*!< in: position of the field */ -{ - return(dict_field_get_col(dict_index_get_nth_field(index, pos))); -} - -/********************************************************************//** -Gets the column number the nth field in an index. -@return column number */ -UNIV_INLINE -ulint -dict_index_get_nth_col_no( -/*======================*/ - const dict_index_t* index, /*!< in: index */ - ulint pos) /*!< in: position of the field */ -{ - return(dict_col_get_no(dict_index_get_nth_col(index, pos))); -} - -/********************************************************************//** -Looks for column n in an index. -@return position in internal representation of the index; -ULINT_UNDEFINED if not contained */ -UNIV_INLINE -ulint -dict_index_get_nth_col_pos( -/*=======================*/ - const dict_index_t* index, /*!< in: index */ - ulint n, /*!< in: column number */ - ulint* prefix_col_pos) /*!< out: col num if prefix */ -{ - return(dict_index_get_nth_col_or_prefix_pos(index, n, false, false, - prefix_col_pos)); -} - -/********************************************************************//** -Returns the minimum data size of an index record. -@return minimum data size in bytes */ -UNIV_INLINE -unsigned -dict_index_get_min_size( -/*====================*/ - const dict_index_t* index) /*!< in: index */ -{ - unsigned n= dict_index_get_n_fields(index); - unsigned size= 0; - - while (n--) - size+= dict_col_get_min_size(dict_index_get_nth_col(index, n)); - - return size; -} - -/*********************************************************************//** -Gets the page number of the root of the index tree. -@return page number */ -UNIV_INLINE -uint32_t -dict_index_get_page( -/*================*/ - const dict_index_t* index) /*!< in: index */ -{ - ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); - - return(index->page); -} - -/********************************************************************//** -Returns free space reserved for future updates of records. This is -relevant only in the case of many consecutive inserts, as updates -which make the records bigger might fragment the index. -@return number of free bytes on page, reserved for updates */ -UNIV_INLINE -ulint -dict_index_get_space_reserve(void) -/*==============================*/ -{ - return(srv_page_size / 16); -} - -/********************************************************************//** -Gets the status of online index creation. -@return the status */ -UNIV_INLINE -enum online_index_status -dict_index_get_online_status( -/*=========================*/ - const dict_index_t* index) /*!< in: secondary index */ -{ - enum online_index_status status; - - status = (enum online_index_status) index->online_status; - - /* Without the index->lock protection, the online - status can change from ONLINE_INDEX_CREATION to - ONLINE_INDEX_COMPLETE (or ONLINE_INDEX_ABORTED) in - row_log_apply() once log application is done. So to make - sure the status is ONLINE_INDEX_CREATION or ONLINE_INDEX_COMPLETE - you should always do the recheck after acquiring index->lock */ - -#ifdef UNIV_DEBUG - switch (status) { - case ONLINE_INDEX_COMPLETE: - case ONLINE_INDEX_CREATION: - case ONLINE_INDEX_ABORTED: - case ONLINE_INDEX_ABORTED_DROPPED: - return(status); - } - ut_error; -#endif /* UNIV_DEBUG */ - return(status); -} - -/********************************************************************//** -Sets the status of online index creation. */ -UNIV_INLINE -void -dict_index_set_online_status( -/*=========================*/ - dict_index_t* index, /*!< in/out: index */ - enum online_index_status status) /*!< in: status */ -{ - ut_ad(!(index->type & DICT_FTS)); - ut_ad(index->lock.have_x()); - -#ifdef UNIV_DEBUG - switch (dict_index_get_online_status(index)) { - case ONLINE_INDEX_COMPLETE: - case ONLINE_INDEX_CREATION: - break; - case ONLINE_INDEX_ABORTED: - ut_ad(status == ONLINE_INDEX_ABORTED_DROPPED); - break; - case ONLINE_INDEX_ABORTED_DROPPED: - ut_error; - } -#endif /* UNIV_DEBUG */ - - index->online_status = status & 3; - ut_ad(dict_index_get_online_status(index) == status); -} - -/********************************************************************//** -Determines if a secondary index is being or has been created online, -or if the table is being rebuilt online, allowing concurrent modifications -to the table. -@retval true if the index is being or has been built online, or -if this is a clustered index and the table is being or has been rebuilt online -@retval false if the index has been created or the table has been -rebuilt completely */ -UNIV_INLINE -bool -dict_index_is_online_ddl( -/*=====================*/ - const dict_index_t* index) /*!< in: index */ -{ -#ifdef UNIV_DEBUG - if (dict_index_is_clust(index)) { - switch (dict_index_get_online_status(index)) { - case ONLINE_INDEX_CREATION: - return(true); - case ONLINE_INDEX_COMPLETE: - return(false); - case ONLINE_INDEX_ABORTED: - case ONLINE_INDEX_ABORTED_DROPPED: - break; - } - ut_ad(0); - return(false); - } -#endif /* UNIV_DEBUG */ - - return(UNIV_UNLIKELY(dict_index_get_online_status(index) - != ONLINE_INDEX_COMPLETE)); -} - -/**********************************************************************//** -Check whether a column exists in an FTS index. -@return ULINT_UNDEFINED if no match else the offset within the vector */ -UNIV_INLINE -ulint -dict_table_is_fts_column( -/*=====================*/ - ib_vector_t* indexes,/*!< in: vector containing only FTS indexes */ - ulint col_no, /*!< in: col number to search for */ - bool is_virtual) /*!< in: whether it is a virtual column */ - -{ - ulint i; - - for (i = 0; i < ib_vector_size(indexes); ++i) { - dict_index_t* index; - - index = (dict_index_t*) ib_vector_getp(indexes, i); - - if (index->contains_col_or_prefix(col_no, is_virtual)) { - return(i); - } - } - - return(ULINT_UNDEFINED); -} - -/**********************************************************************//** -Determine bytes of column prefix to be stored in the undo log. Please -note that if !dict_table_has_atomic_blobs(table), no prefix -needs to be stored in the undo log. -@return bytes of column prefix to be stored in the undo log */ -UNIV_INLINE -ulint -dict_max_field_len_store_undo( -/*==========================*/ - dict_table_t* table, /*!< in: table */ - const dict_col_t* col) /*!< in: column which index prefix - is based on */ -{ - if (!dict_table_has_atomic_blobs(table)) { - return(0); - } - - if (col->max_prefix != 0) { - return(col->max_prefix); - } - - return(REC_VERSION_56_MAX_INDEX_COL_LEN); -} - -/** Determine maximum bytes of a virtual column need to be stored -in the undo log. -@param[in] table dict_table_t for the table -@param[in] col_no virtual column number -@return maximum bytes of virtual column to be stored in the undo log */ -UNIV_INLINE -ulint -dict_max_v_field_len_store_undo( - dict_table_t* table, - ulint col_no) -{ - const dict_col_t* col - = &dict_table_get_nth_v_col(table, col_no)->m_col; - ulint max_log_len; - - /* This calculation conforms to the non-virtual column - maximum log length calculation: - 1) if No atomic BLOB, upto REC_ANTELOPE_MAX_INDEX_COL_LEN - 2) if atomic BLOB, upto col->max_prefix or - REC_VERSION_56_MAX_INDEX_COL_LEN, whichever is less */ - if (dict_table_has_atomic_blobs(table)) { - if (DATA_BIG_COL(col) && col->max_prefix > 0) { - max_log_len = col->max_prefix; - } else { - max_log_len = DICT_MAX_FIELD_LEN_BY_FORMAT(table); - } - } else { - max_log_len = REC_ANTELOPE_MAX_INDEX_COL_LEN; - } - - return(max_log_len); -} - -/********************************************************************//** -Check whether the table is corrupted. -@return nonzero for corrupted table, zero for valid tables */ -UNIV_INLINE -ulint -dict_table_is_corrupted( -/*====================*/ - const dict_table_t* table) /*!< in: table */ -{ - ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - return(table->corrupted); -} - -/** Check if the table is found is a file_per_table tablespace. -This test does not use table flags2 since some REDUNDANT tables in the -system tablespace may have garbage in the MIX_LEN field where flags2 is -stored. These garbage MIX_LEN fields were written before v3.23.52. -A patch was added to v3.23.52 which initializes the MIX_LEN field to 0. -Since file-per-table tablespaces were added in 4.1, any SYS_TABLES -record with a non-zero space ID will have a reliable MIX_LEN field. -However, this test does not use flags2 from SYS_TABLES.MIX_LEN. Instead, -assume that if the tablespace is not a predefined system tablespace, - then it must be file-per-table. -Also, during ALTER TABLE, the DICT_TF2_USE_FILE_PER_TABLE flag may not be -set on one of the file-per-table tablespaces. -This test cannot be done on a table in the process of being created -because the space_id will be zero until the tablespace is created. -@param[in] table An existing open table to check -@return true if this table was created as a file-per-table tablespace. */ -UNIV_INLINE -bool -dict_table_is_file_per_table( - const dict_table_t* table) /*!< in: table to check */ -{ - return table->space != fil_system.sys_space - && table->space != fil_system.temp_space; -} - -/** Acquire the table handle. */ -inline void dict_table_t::acquire() -{ - ut_ad(dict_sys.frozen()); - n_ref_count++; -} - -/** Release the table handle. -@return whether the last handle was released */ -inline -bool -dict_table_t::release() -{ - auto n = n_ref_count--; - ut_ad(n > 0); - return n == 1; -} - -/** Encode the number of columns and number of virtual columns in a -4 bytes value. We could do this because the number of columns in -InnoDB is limited to 1017 -@param[in] n_col number of non-virtual column -@param[in] n_v_col number of virtual column -@return encoded value */ -UNIV_INLINE -ulint -dict_table_encode_n_col( - ulint n_col, - ulint n_v_col) -{ - return(n_col + (n_v_col<<16)); -} - -/** decode number of virtual and non-virtual columns in one 4 bytes value. -@param[in] encoded encoded value -@param[in,out] n_col number of non-virtual column -@param[in,out] n_v_col number of virtual column */ -UNIV_INLINE -void -dict_table_decode_n_col( - ulint encoded, - ulint* n_col, - ulint* n_v_col) -{ - - ulint num = encoded & ~DICT_N_COLS_COMPACT; - *n_v_col = num >> 16; - *n_col = num & 0xFFFF; -} - -/** Free the virtual column template -@param[in,out] vc_templ virtual column template */ -void -dict_free_vc_templ( - dict_vcol_templ_t* vc_templ) -{ - UT_DELETE_ARRAY(vc_templ->default_rec); - vc_templ->default_rec = NULL; - - if (vc_templ->vtempl != NULL) { - ut_ad(vc_templ->n_v_col > 0); - for (ulint i = 0; i < vc_templ->n_col - + vc_templ->n_v_col; i++) { - if (vc_templ->vtempl[i] != NULL) { - ut_free(vc_templ->vtempl[i]); - } - } - ut_free(vc_templ->vtempl); - vc_templ->vtempl = NULL; - } -} - -/** Check whether the table have virtual index. -@param[in] table InnoDB table -@return true if the table have virtual index, false otherwise. */ -UNIV_INLINE -bool -dict_table_have_virtual_index( - dict_table_t* table) -{ - for (ulint col_no = 0; col_no < dict_table_get_n_v_cols(table); - col_no++) { - const dict_v_col_t* col - = dict_table_get_nth_v_col(table, col_no); - - if (col->m_col.ord_part) { - return(true); - } - } - - return(false); -} diff --git a/storage/innobase/include/dict0dict.inl b/storage/innobase/include/dict0dict.inl new file mode 100644 index 0000000000000..4cc3eae96ab03 --- /dev/null +++ b/storage/innobase/include/dict0dict.inl @@ -0,0 +1,1217 @@ +/***************************************************************************** + +Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2013, 2022, 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 02110-1335 USA + +*****************************************************************************/ + +/******************************************************************//** +@file include/dict0dict.ic +Data dictionary system + +Created 1/8/1996 Heikki Tuuri +***********************************************************************/ + +#include "fsp0sysspace.h" +#include "dict0pagecompress.h" + +/*********************************************************************//** +Gets the minimum number of bytes per character. +@return minimum multi-byte char size, in bytes */ +UNIV_INLINE +unsigned +dict_col_get_mbminlen( +/*==================*/ + const dict_col_t* col) /*!< in: column */ +{ + return col->mbminlen; +} +/*********************************************************************//** +Gets the maximum number of bytes per character. +@return maximum multi-byte char size, in bytes */ +UNIV_INLINE +unsigned +dict_col_get_mbmaxlen( +/*==================*/ + const dict_col_t* col) /*!< in: column */ +{ + return col->mbmaxlen; +} +/*********************************************************************//** +Gets the column data type. */ +UNIV_INLINE +void +dict_col_copy_type( +/*===============*/ + const dict_col_t* col, /*!< in: column */ + dtype_t* type) /*!< out: data type */ +{ + ut_ad(col != NULL); + ut_ad(type != NULL); + + type->mtype = col->mtype; + type->prtype = col->prtype; + type->len = col->len; + type->mbminlen = col->mbminlen; + type->mbmaxlen = col->mbmaxlen; +} + +#ifdef UNIV_DEBUG +/*********************************************************************//** +Assert that a column and a data type match. +@return TRUE */ +UNIV_INLINE +ibool +dict_col_type_assert_equal( +/*=======================*/ + const dict_col_t* col, /*!< in: column */ + const dtype_t* type) /*!< in: data type */ +{ + ut_ad(col->mtype == type->mtype); + ut_ad(col->prtype == type->prtype); + //ut_ad(col->len == type->len); + ut_ad(col->mbminlen == type->mbminlen); + ut_ad(col->mbmaxlen == type->mbmaxlen); + + return(TRUE); +} +#endif /* UNIV_DEBUG */ + +/***********************************************************************//** +Returns the minimum size of the column. +@return minimum size */ +UNIV_INLINE +unsigned +dict_col_get_min_size( +/*==================*/ + const dict_col_t* col) /*!< in: column */ +{ + return(dtype_get_min_size_low(col->mtype, col->prtype, col->len, + col->mbminlen, col->mbmaxlen)); +} +/***********************************************************************//** +Returns the maximum size of the column. +@return maximum size */ +UNIV_INLINE +ulint +dict_col_get_max_size( +/*==================*/ + const dict_col_t* col) /*!< in: column */ +{ + return(dtype_get_max_size_low(col->mtype, col->len)); +} +/***********************************************************************//** +Returns the size of a fixed size column, 0 if not a fixed size column. +@return fixed size, or 0 */ +UNIV_INLINE +unsigned +dict_col_get_fixed_size( +/*====================*/ + const dict_col_t* col, /*!< in: column */ + ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */ +{ + return(dtype_get_fixed_size_low(col->mtype, col->prtype, col->len, + col->mbminlen, col->mbmaxlen, comp)); +} +/***********************************************************************//** +Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a column. +For fixed length types it is the fixed length of the type, otherwise 0. +@return SQL null storage size in ROW_FORMAT=REDUNDANT */ +UNIV_INLINE +unsigned +dict_col_get_sql_null_size( +/*=======================*/ + const dict_col_t* col, /*!< in: column */ + ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */ +{ + return(dict_col_get_fixed_size(col, comp)); +} + +/*********************************************************************//** +Gets the column number. +@return col->ind, table column position (starting from 0) */ +UNIV_INLINE +unsigned +dict_col_get_no( +/*============*/ + const dict_col_t* col) /*!< in: column */ +{ + return(col->ind); +} + +/*********************************************************************//** +Gets the column position in the clustered index. */ +UNIV_INLINE +ulint +dict_col_get_clust_pos( +/*===================*/ + const dict_col_t* col, /*!< in: table column */ + const dict_index_t* clust_index) /*!< in: clustered index */ +{ + ulint i; + + ut_ad(dict_index_is_clust(clust_index)); + + for (i = 0; i < clust_index->n_def; i++) { + const dict_field_t* field = &clust_index->fields[i]; + + if (!field->prefix_len && field->col == col) { + return(i); + } + } + + return(ULINT_UNDEFINED); +} + +/** Gets the column position in the given index. +@param[in] col table column +@param[in] index index to be searched for column +@return position of column in the given index. */ +UNIV_INLINE +ulint +dict_col_get_index_pos( + const dict_col_t* col, + const dict_index_t* index) +{ + ulint i; + + for (i = 0; i < index->n_def; i++) { + const dict_field_t* field = &index->fields[i]; + + if (!field->prefix_len && field->col == col) { + return(i); + } + } + + return(ULINT_UNDEFINED); +} + +#ifdef UNIV_DEBUG +/********************************************************************//** +Gets the first index on the table (the clustered index). +@return index, NULL if none exists */ +UNIV_INLINE +dict_index_t* +dict_table_get_first_index( +/*=======================*/ + const dict_table_t* table) /*!< in: table */ +{ + ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); + + return(UT_LIST_GET_FIRST(((dict_table_t*) table)->indexes)); +} + +/********************************************************************//** +Gets the last index on the table. +@return index, NULL if none exists */ +UNIV_INLINE +dict_index_t* +dict_table_get_last_index( +/*=======================*/ + const dict_table_t* table) /*!< in: table */ +{ + ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); + return(UT_LIST_GET_LAST((const_cast(table)) + ->indexes)); +} + +/********************************************************************//** +Gets the next index on the table. +@return index, NULL if none left */ +UNIV_INLINE +dict_index_t* +dict_table_get_next_index( +/*======================*/ + const dict_index_t* index) /*!< in: index */ +{ + ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); + return(UT_LIST_GET_NEXT(indexes, (dict_index_t*) index)); +} +#endif /* UNIV_DEBUG */ + +/********************************************************************//** +Gets the number of user-defined non-virtual columns in a table in the +dictionary cache. +@return number of user-defined (e.g., not ROW_ID) non-virtual +columns of a table */ +UNIV_INLINE +unsigned +dict_table_get_n_user_cols( +/*=======================*/ + const dict_table_t* table) /*!< in: table */ +{ + ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); + /* n_cols counts stored columns only. A table may contain + virtual columns and no user-specified stored columns at all. */ + ut_ad(table->n_cols >= DATA_N_SYS_COLS); + return unsigned(table->n_cols) - DATA_N_SYS_COLS; +} + +/********************************************************************//** +Gets the number of all non-virtual columns (also system) in a table +in the dictionary cache. +@return number of non-virtual columns of a table */ +UNIV_INLINE +unsigned +dict_table_get_n_cols( +/*==================*/ + const dict_table_t* table) /*!< in: table */ +{ + ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); + return(table->n_cols); +} + +/** Gets the number of virtual columns in a table in the dictionary cache. +@param[in] table the table to check +@return number of virtual columns of a table */ +UNIV_INLINE +unsigned +dict_table_get_n_v_cols( + const dict_table_t* table) +{ + ut_ad(table); + ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); + + return(table->n_v_cols); +} + +/** Check if a table has indexed virtual columns +@param[in] table the table to check +@return true is the table has indexed virtual columns */ +UNIV_INLINE +bool +dict_table_has_indexed_v_cols( + const dict_table_t* table) +{ + + for (unsigned i = 0; i < table->n_v_cols; i++) { + const dict_v_col_t* col = dict_table_get_nth_v_col(table, i); + if (col->m_col.ord_part) { + return(true); + } + } + + return(false); +} + +/********************************************************************//** +Gets the approximately estimated number of rows in the table. +@return estimated number of rows */ +UNIV_INLINE +ib_uint64_t +dict_table_get_n_rows( +/*==================*/ + const dict_table_t* table) /*!< in: table */ +{ + ut_ad(table->stat_initialized); + + return(table->stat_n_rows); +} + +/********************************************************************//** +Increment the number of rows in the table by one. +Notice that this operation is not protected by any latch, the number is +approximate. */ +UNIV_INLINE +void +dict_table_n_rows_inc( +/*==================*/ + dict_table_t* table) /*!< in/out: table */ +{ + if (table->stat_initialized) { + ib_uint64_t n_rows = table->stat_n_rows; + if (n_rows < 0xFFFFFFFFFFFFFFFFULL) { + table->stat_n_rows = n_rows + 1; + } + } +} + +/********************************************************************//** +Decrement the number of rows in the table by one. +Notice that this operation is not protected by any latch, the number is +approximate. */ +UNIV_INLINE +void +dict_table_n_rows_dec( +/*==================*/ + dict_table_t* table) /*!< in/out: table */ +{ + if (table->stat_initialized) { + ib_uint64_t n_rows = table->stat_n_rows; + if (n_rows > 0) { + table->stat_n_rows = n_rows - 1; + } + } +} + +#ifdef UNIV_DEBUG +/********************************************************************//** +Gets the nth column of a table. +@return pointer to column object */ +UNIV_INLINE +dict_col_t* +dict_table_get_nth_col( +/*===================*/ + const dict_table_t* table, /*!< in: table */ + ulint pos) /*!< in: position of column */ +{ + ut_ad(pos < table->n_def); + ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); + + return((dict_col_t*) (table->cols) + pos); +} + +/** Gets the nth virtual column of a table. +@param[in] table table +@param[in] pos position of virtual column +@return pointer to virtual column object */ +UNIV_INLINE +dict_v_col_t* +dict_table_get_nth_v_col( + const dict_table_t* table, + ulint pos) +{ + ut_ad(table); + ut_ad(pos < table->n_v_def); + ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); + ut_ad(!table->v_cols[pos].m_col.is_added()); + ut_ad(!table->v_cols[pos].m_col.is_dropped()); + return &table->v_cols[pos]; +} + +/********************************************************************//** +Gets the given system column of a table. +@return pointer to column object */ +UNIV_INLINE +dict_col_t* +dict_table_get_sys_col( +/*===================*/ + const dict_table_t* table, /*!< in: table */ + unsigned sys) /*!< in: DATA_ROW_ID, ... */ +{ + dict_col_t* col; + col = dict_table_get_nth_col(table, + dict_table_get_sys_col_no(table, sys)); + ut_ad(col->mtype == DATA_SYS); + ut_ad(col->prtype == (sys | DATA_NOT_NULL)); + + return(col); +} +#endif /* UNIV_DEBUG */ + +/********************************************************************//** +Gets the given system column number of a table. +@return column number */ +UNIV_INLINE +unsigned +dict_table_get_sys_col_no( +/*======================*/ + const dict_table_t* table, /*!< in: table */ + unsigned sys) /*!< in: DATA_ROW_ID, ... */ +{ + ut_ad(sys < DATA_N_SYS_COLS); + ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); + return unsigned(table->n_cols) + (sys - DATA_N_SYS_COLS); +} + +/************************************************************************ +Check if the table has an FTS index. */ +UNIV_INLINE +ibool +dict_table_has_fts_index( +/*=====================*/ + /* out: TRUE if table has an FTS index */ + dict_table_t* table) /* in: table */ +{ + return(DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS)); +} + +/** Validate the flags for tables that are not ROW_FORMAT=REDUNDANT. +@param[in] flags table flags +@return whether the flags are valid */ +inline +bool +dict_tf_is_valid_not_redundant(ulint flags) +{ + const bool atomic_blobs = DICT_TF_HAS_ATOMIC_BLOBS(flags); + + ulint zip_ssize = DICT_TF_GET_ZIP_SSIZE(flags); + + if (!zip_ssize) { + /* Not ROW_FORMAT=COMPRESSED */ + } else if (!atomic_blobs) { + /* ROW_FORMAT=COMPRESSED implies ROW_FORMAT=DYNAMIC + for the uncompressed page format */ + return(false); + } else if (zip_ssize > PAGE_ZIP_SSIZE_MAX + || zip_ssize > srv_page_size_shift + || srv_page_size_shift > UNIV_ZIP_SIZE_SHIFT_MAX) { + /* KEY_BLOCK_SIZE is out of bounds, or + ROW_FORMAT=COMPRESSED is not supported with this + innodb_page_size (only up to 16KiB) */ + return(false); + } + + switch (DICT_TF_GET_PAGE_COMPRESSION_LEVEL(flags)) { + case 0: + /* PAGE_COMPRESSION_LEVEL=0 should imply PAGE_COMPRESSED=NO */ + return(!DICT_TF_GET_PAGE_COMPRESSION(flags)); + case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: + /* PAGE_COMPRESSION_LEVEL requires + ROW_FORMAT=COMPACT or ROW_FORMAT=DYNAMIC + (not ROW_FORMAT=COMPRESSED or ROW_FORMAT=REDUNDANT) + and PAGE_COMPRESSED=YES */ + return(!zip_ssize && DICT_TF_GET_PAGE_COMPRESSION(flags)); + default: + /* Invalid PAGE_COMPRESSION_LEVEL value */ + return(false); + } +} + +/** Validate the table flags. +@param[in] flags Table flags +@return true if valid. */ +UNIV_INLINE +bool +dict_tf_is_valid( + ulint flags) +{ + ut_ad(flags < 1U << DICT_TF_BITS); + /* The DATA_DIRECTORY flag can be assigned fully independently + of all other persistent table flags. */ + flags &= ~DICT_TF_MASK_DATA_DIR; + if (!(flags & 1)) { + /* Only ROW_FORMAT=REDUNDANT has 0 in the least significant + bit. For ROW_FORMAT=REDUNDANT, only the DATA_DIR flag + (which we cleared above) can be set. If any other flags + are set, the flags are invalid. */ + return(flags == 0 || flags == DICT_TF_MASK_NO_ROLLBACK); + } + + return(dict_tf_is_valid_not_redundant(flags)); +} + +/** Validate both table flags and table flags2 and make sure they +are compatible. +@param[in] flags Table flags +@param[in] flags2 Table flags2 +@return true if valid. */ +UNIV_INLINE +bool +dict_tf2_is_valid( + ulint flags, + ulint flags2) +{ + if (!dict_tf_is_valid(flags)) { + return(false); + } + + if ((flags2 & DICT_TF2_UNUSED_BIT_MASK) != 0) { + return(false); + } + + return(true); +} + +/********************************************************************//** +Determine the file format from dict_table_t::flags +The low order bit will be zero for REDUNDANT and 1 for COMPACT. For any +other row_format, file_format is > 0 and DICT_TF_COMPACT will also be set. +@return file format version */ +UNIV_INLINE +rec_format_t +dict_tf_get_rec_format( +/*===================*/ + ulint flags) /*!< in: dict_table_t::flags */ +{ + ut_a(dict_tf_is_valid(flags)); + + if (!DICT_TF_GET_COMPACT(flags)) { + return(REC_FORMAT_REDUNDANT); + } + + if (!DICT_TF_HAS_ATOMIC_BLOBS(flags)) { + return(REC_FORMAT_COMPACT); + } + + if (DICT_TF_GET_ZIP_SSIZE(flags)) { + return(REC_FORMAT_COMPRESSED); + } + + return(REC_FORMAT_DYNAMIC); +} + +/** Set the various values in a dict_table_t::flags pointer. +@param[in,out] flags, Pointer to a 4 byte Table Flags +@param[in] format File Format +@param[in] zip_ssize Zip Shift Size +@param[in] use_data_dir Table uses DATA DIRECTORY +@param[in] page_compressed Table uses page compression +@param[in] page_compression_level Page compression level */ +UNIV_INLINE +void +dict_tf_set( +/*========*/ + ulint* flags, + rec_format_t format, + ulint zip_ssize, + bool use_data_dir, + bool page_compressed, + ulint page_compression_level) +{ + *flags = use_data_dir ? 1 << DICT_TF_POS_DATA_DIR : 0; + + switch (format) { + case REC_FORMAT_REDUNDANT: + ut_ad(zip_ssize == 0); + /* no other options are allowed */ + ut_ad(!page_compressed); + return; + case REC_FORMAT_COMPACT: + *flags |= DICT_TF_COMPACT; + ut_ad(zip_ssize == 0); + break; + case REC_FORMAT_COMPRESSED: + *flags |= DICT_TF_COMPACT + | (1 << DICT_TF_POS_ATOMIC_BLOBS) + | (zip_ssize << DICT_TF_POS_ZIP_SSIZE); + break; + case REC_FORMAT_DYNAMIC: + *flags |= DICT_TF_COMPACT + | (1 << DICT_TF_POS_ATOMIC_BLOBS); + ut_ad(zip_ssize == 0); + break; + } + + if (page_compressed) { + *flags |= (1 << DICT_TF_POS_ATOMIC_BLOBS) + | (1 << DICT_TF_POS_PAGE_COMPRESSION) + | (page_compression_level << DICT_TF_POS_PAGE_COMPRESSION_LEVEL); + + ut_ad(zip_ssize == 0); + ut_ad(dict_tf_get_page_compression(*flags) == TRUE); + ut_ad(dict_tf_get_page_compression_level(*flags) == page_compression_level); + } +} + +/** Convert a 32 bit integer table flags to the 32 bit FSP Flags. +Fsp Flags are written into the tablespace header at the offset +FSP_SPACE_FLAGS and are also stored in the fil_space_t::flags field. +The following chart shows the translation of the low order bit. +Other bits are the same. +========================= Low order bit ========================== + | REDUNDANT | COMPACT | COMPRESSED | DYNAMIC +dict_table_t::flags | 0 | 1 | 1 | 1 +fil_space_t::flags | 0 | 0 | 1 | 1 +================================================================== +@param[in] table_flags dict_table_t::flags +@return tablespace flags (fil_space_t::flags) */ +inline uint32_t dict_tf_to_fsp_flags(unsigned table_flags) +{ + uint32_t fsp_flags; + uint32_t page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL( + table_flags); + + ut_ad((DICT_TF_GET_PAGE_COMPRESSION(table_flags) == 0) + == (page_compression_level == 0)); + + DBUG_EXECUTE_IF("dict_tf_to_fsp_flags_failure", return UINT32_MAX;); + + /* No ROW_FORMAT=COMPRESSED for innodb_checksum_algorithm=full_crc32 */ + if ((srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_FULL_CRC32 + || srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_FULL_CRC32) + && !(table_flags & DICT_TF_MASK_ZIP_SSIZE)) { + + fsp_flags = 1U << FSP_FLAGS_FCRC32_POS_MARKER + | FSP_FLAGS_FCRC32_PAGE_SSIZE(); + + if (page_compression_level) { + fsp_flags |= static_cast( + innodb_compression_algorithm) + << FSP_FLAGS_FCRC32_POS_COMPRESSED_ALGO; + } + } else { + /* Adjust bit zero. */ + fsp_flags = DICT_TF_HAS_ATOMIC_BLOBS(table_flags) ? 1 : 0; + + /* ZIP_SSIZE and ATOMIC_BLOBS are at the same position. */ + fsp_flags |= table_flags + & (DICT_TF_MASK_ZIP_SSIZE | DICT_TF_MASK_ATOMIC_BLOBS); + + fsp_flags |= FSP_FLAGS_PAGE_SSIZE(); + + if (page_compression_level) { + fsp_flags |= FSP_FLAGS_MASK_PAGE_COMPRESSION; + } + } + + ut_a(fil_space_t::is_valid_flags(fsp_flags, false)); + + if (DICT_TF_HAS_DATA_DIR(table_flags)) { + fsp_flags |= 1U << FSP_FLAGS_MEM_DATA_DIR; + } + + fsp_flags |= page_compression_level << FSP_FLAGS_MEM_COMPRESSION_LEVEL; + + return(fsp_flags); +} + +/********************************************************************//** +Convert a 32 bit integer table flags to the 32bit integer that is written +to a SYS_TABLES.TYPE field. The following chart shows the translation of +the low order bit. Other bits are the same. +========================= Low order bit ========================== + | REDUNDANT | COMPACT | COMPRESSED and DYNAMIC +dict_table_t::flags | 0 | 1 | 1 +SYS_TABLES.TYPE | 1 | 1 | 1 +================================================================== +@return ulint containing SYS_TABLES.TYPE */ +UNIV_INLINE +ulint +dict_tf_to_sys_tables_type( +/*=======================*/ + ulint flags) /*!< in: dict_table_t::flags */ +{ + ulint type; + + ut_a(dict_tf_is_valid(flags)); + + /* Adjust bit zero. It is always 1 in SYS_TABLES.TYPE */ + type = 1; + + /* ZIP_SSIZE, ATOMIC_BLOBS, DATA_DIR, PAGE_COMPRESSION, + PAGE_COMPRESSION_LEVEL are the same. */ + type |= flags & (DICT_TF_MASK_ZIP_SSIZE + | DICT_TF_MASK_ATOMIC_BLOBS + | DICT_TF_MASK_DATA_DIR + | DICT_TF_MASK_PAGE_COMPRESSION + | DICT_TF_MASK_PAGE_COMPRESSION_LEVEL + | DICT_TF_MASK_NO_ROLLBACK); + + return(type); +} + +/********************************************************************//** +Gets the number of fields in the internal representation of an index, +including fields added by the dictionary system. +@return number of fields */ +UNIV_INLINE +uint16_t +dict_index_get_n_fields( +/*====================*/ + const dict_index_t* index) /*!< in: an internal + representation of index (in + the dictionary cache) */ +{ + ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); + return(index->n_fields); +} + +/********************************************************************//** +Gets the number of fields in the internal representation of an index +that uniquely determine the position of an index entry in the index, if +we do not take multiversioning into account: in the B-tree use the value +returned by dict_index_get_n_unique_in_tree. +@return number of fields */ +UNIV_INLINE +uint16_t +dict_index_get_n_unique( +/*====================*/ + const dict_index_t* index) /*!< in: an internal representation + of index (in the dictionary cache) */ +{ + ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); + ut_ad(index->cached); + return(index->n_uniq); +} + +/********************************************************************//** +Gets the number of fields in the internal representation of an index +which uniquely determine the position of an index entry in the index, if +we also take multiversioning into account. +@return number of fields */ +UNIV_INLINE +uint16_t +dict_index_get_n_unique_in_tree( +/*============================*/ + const dict_index_t* index) /*!< in: an internal representation + of index (in the dictionary cache) */ +{ + ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); + ut_ad(index->cached); + + if (dict_index_is_clust(index)) { + + return(dict_index_get_n_unique(index)); + } + + return(dict_index_get_n_fields(index)); +} + +/** +Gets the number of fields on nonleaf page level in the internal representation +of an index which uniquely determine the position of an index entry in the +index, if we also take multiversioning into account. Note, it doesn't +include page no field. +@param[in] index index +@return number of fields */ +UNIV_INLINE +uint16_t +dict_index_get_n_unique_in_tree_nonleaf( + const dict_index_t* index) +{ + ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); + ut_ad(index->cached); + + if (dict_index_is_spatial(index)) { + /* For spatial index, on non-leaf page, we have only + 2 fields(mbr+page_no). So, except page no field, + there's one field there. */ + return(DICT_INDEX_SPATIAL_NODEPTR_SIZE); + } else { + return(dict_index_get_n_unique_in_tree(index)); + } +} + +/********************************************************************//** +Gets the number of user-defined ordering fields in the index. In the internal +representation of clustered indexes we add the row id to the ordering fields +to make a clustered index unique, but this function returns the number of +fields the user defined in the index as ordering fields. +@return number of fields */ +UNIV_INLINE +uint16_t +dict_index_get_n_ordering_defined_by_user( +/*======================================*/ + const dict_index_t* index) /*!< in: an internal representation + of index (in the dictionary cache) */ +{ + return(index->n_user_defined_cols); +} + +#ifdef UNIV_DEBUG +/********************************************************************//** +Gets the nth field of an index. +@return pointer to field object */ +UNIV_INLINE +dict_field_t* +dict_index_get_nth_field( +/*=====================*/ + const dict_index_t* index, /*!< in: index */ + ulint pos) /*!< in: position of field */ +{ + ut_ad(pos < index->n_def); + ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); + + return((dict_field_t*) (index->fields) + pos); +} +#endif /* UNIV_DEBUG */ + +/*********************************************************************//** +Gets the field column. +@return field->col, pointer to the table column */ +UNIV_INLINE +const dict_col_t* +dict_field_get_col( +/*===============*/ + const dict_field_t* field) /*!< in: index field */ +{ + return(field->col); +} + +/********************************************************************//** +Gets pointer to the nth column in an index. +@return column */ +UNIV_INLINE +const dict_col_t* +dict_index_get_nth_col( +/*===================*/ + const dict_index_t* index, /*!< in: index */ + ulint pos) /*!< in: position of the field */ +{ + return(dict_field_get_col(dict_index_get_nth_field(index, pos))); +} + +/********************************************************************//** +Gets the column number the nth field in an index. +@return column number */ +UNIV_INLINE +ulint +dict_index_get_nth_col_no( +/*======================*/ + const dict_index_t* index, /*!< in: index */ + ulint pos) /*!< in: position of the field */ +{ + return(dict_col_get_no(dict_index_get_nth_col(index, pos))); +} + +/********************************************************************//** +Looks for column n in an index. +@return position in internal representation of the index; +ULINT_UNDEFINED if not contained */ +UNIV_INLINE +ulint +dict_index_get_nth_col_pos( +/*=======================*/ + const dict_index_t* index, /*!< in: index */ + ulint n, /*!< in: column number */ + ulint* prefix_col_pos) /*!< out: col num if prefix */ +{ + return(dict_index_get_nth_col_or_prefix_pos(index, n, false, false, + prefix_col_pos)); +} + +/********************************************************************//** +Returns the minimum data size of an index record. +@return minimum data size in bytes */ +UNIV_INLINE +unsigned +dict_index_get_min_size( +/*====================*/ + const dict_index_t* index) /*!< in: index */ +{ + unsigned n= dict_index_get_n_fields(index); + unsigned size= 0; + + while (n--) + size+= dict_col_get_min_size(dict_index_get_nth_col(index, n)); + + return size; +} + +/*********************************************************************//** +Gets the page number of the root of the index tree. +@return page number */ +UNIV_INLINE +uint32_t +dict_index_get_page( +/*================*/ + const dict_index_t* index) /*!< in: index */ +{ + ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); + + return(index->page); +} + +/********************************************************************//** +Returns free space reserved for future updates of records. This is +relevant only in the case of many consecutive inserts, as updates +which make the records bigger might fragment the index. +@return number of free bytes on page, reserved for updates */ +UNIV_INLINE +ulint +dict_index_get_space_reserve(void) +/*==============================*/ +{ + return(srv_page_size / 16); +} + +/********************************************************************//** +Gets the status of online index creation. +@return the status */ +UNIV_INLINE +enum online_index_status +dict_index_get_online_status( +/*=========================*/ + const dict_index_t* index) /*!< in: secondary index */ +{ + enum online_index_status status; + + status = (enum online_index_status) index->online_status; + + /* Without the index->lock protection, the online + status can change from ONLINE_INDEX_CREATION to + ONLINE_INDEX_COMPLETE (or ONLINE_INDEX_ABORTED) in + row_log_apply() once log application is done. So to make + sure the status is ONLINE_INDEX_CREATION or ONLINE_INDEX_COMPLETE + you should always do the recheck after acquiring index->lock */ + +#ifdef UNIV_DEBUG + switch (status) { + case ONLINE_INDEX_COMPLETE: + case ONLINE_INDEX_CREATION: + case ONLINE_INDEX_ABORTED: + case ONLINE_INDEX_ABORTED_DROPPED: + return(status); + } + ut_error; +#endif /* UNIV_DEBUG */ + return(status); +} + +/********************************************************************//** +Sets the status of online index creation. */ +UNIV_INLINE +void +dict_index_set_online_status( +/*=========================*/ + dict_index_t* index, /*!< in/out: index */ + enum online_index_status status) /*!< in: status */ +{ + ut_ad(!(index->type & DICT_FTS)); + ut_ad(index->lock.have_x()); + +#ifdef UNIV_DEBUG + switch (dict_index_get_online_status(index)) { + case ONLINE_INDEX_COMPLETE: + case ONLINE_INDEX_CREATION: + break; + case ONLINE_INDEX_ABORTED: + ut_ad(status == ONLINE_INDEX_ABORTED_DROPPED); + break; + case ONLINE_INDEX_ABORTED_DROPPED: + ut_error; + } +#endif /* UNIV_DEBUG */ + + index->online_status = status & 3; + ut_ad(dict_index_get_online_status(index) == status); +} + +/********************************************************************//** +Determines if a secondary index is being or has been created online, +or if the table is being rebuilt online, allowing concurrent modifications +to the table. +@retval true if the index is being or has been built online, or +if this is a clustered index and the table is being or has been rebuilt online +@retval false if the index has been created or the table has been +rebuilt completely */ +UNIV_INLINE +bool +dict_index_is_online_ddl( +/*=====================*/ + const dict_index_t* index) /*!< in: index */ +{ +#ifdef UNIV_DEBUG + if (dict_index_is_clust(index)) { + switch (dict_index_get_online_status(index)) { + case ONLINE_INDEX_CREATION: + return(true); + case ONLINE_INDEX_COMPLETE: + return(false); + case ONLINE_INDEX_ABORTED: + case ONLINE_INDEX_ABORTED_DROPPED: + break; + } + ut_ad(0); + return(false); + } +#endif /* UNIV_DEBUG */ + + return(UNIV_UNLIKELY(dict_index_get_online_status(index) + != ONLINE_INDEX_COMPLETE)); +} + +/**********************************************************************//** +Check whether a column exists in an FTS index. +@return ULINT_UNDEFINED if no match else the offset within the vector */ +UNIV_INLINE +ulint +dict_table_is_fts_column( +/*=====================*/ + ib_vector_t* indexes,/*!< in: vector containing only FTS indexes */ + ulint col_no, /*!< in: col number to search for */ + bool is_virtual) /*!< in: whether it is a virtual column */ + +{ + ulint i; + + for (i = 0; i < ib_vector_size(indexes); ++i) { + dict_index_t* index; + + index = (dict_index_t*) ib_vector_getp(indexes, i); + + if (index->contains_col_or_prefix(col_no, is_virtual)) { + return(i); + } + } + + return(ULINT_UNDEFINED); +} + +/**********************************************************************//** +Determine bytes of column prefix to be stored in the undo log. Please +note that if !dict_table_has_atomic_blobs(table), no prefix +needs to be stored in the undo log. +@return bytes of column prefix to be stored in the undo log */ +UNIV_INLINE +ulint +dict_max_field_len_store_undo( +/*==========================*/ + dict_table_t* table, /*!< in: table */ + const dict_col_t* col) /*!< in: column which index prefix + is based on */ +{ + if (!dict_table_has_atomic_blobs(table)) { + return(0); + } + + if (col->max_prefix != 0) { + return(col->max_prefix); + } + + return(REC_VERSION_56_MAX_INDEX_COL_LEN); +} + +/** Determine maximum bytes of a virtual column need to be stored +in the undo log. +@param[in] table dict_table_t for the table +@param[in] col_no virtual column number +@return maximum bytes of virtual column to be stored in the undo log */ +UNIV_INLINE +ulint +dict_max_v_field_len_store_undo( + dict_table_t* table, + ulint col_no) +{ + const dict_col_t* col + = &dict_table_get_nth_v_col(table, col_no)->m_col; + ulint max_log_len; + + /* This calculation conforms to the non-virtual column + maximum log length calculation: + 1) if No atomic BLOB, upto REC_ANTELOPE_MAX_INDEX_COL_LEN + 2) if atomic BLOB, upto col->max_prefix or + REC_VERSION_56_MAX_INDEX_COL_LEN, whichever is less */ + if (dict_table_has_atomic_blobs(table)) { + if (DATA_BIG_COL(col) && col->max_prefix > 0) { + max_log_len = col->max_prefix; + } else { + max_log_len = DICT_MAX_FIELD_LEN_BY_FORMAT(table); + } + } else { + max_log_len = REC_ANTELOPE_MAX_INDEX_COL_LEN; + } + + return(max_log_len); +} + +/** Check if the table is found is a file_per_table tablespace. +This test does not use table flags2 since some REDUNDANT tables in the +system tablespace may have garbage in the MIX_LEN field where flags2 is +stored. These garbage MIX_LEN fields were written before v3.23.52. +A patch was added to v3.23.52 which initializes the MIX_LEN field to 0. +Since file-per-table tablespaces were added in 4.1, any SYS_TABLES +record with a non-zero space ID will have a reliable MIX_LEN field. +However, this test does not use flags2 from SYS_TABLES.MIX_LEN. Instead, +assume that if the tablespace is not a predefined system tablespace, + then it must be file-per-table. +Also, during ALTER TABLE, the DICT_TF2_USE_FILE_PER_TABLE flag may not be +set on one of the file-per-table tablespaces. +This test cannot be done on a table in the process of being created +because the space_id will be zero until the tablespace is created. +@param[in] table An existing open table to check +@return true if this table was created as a file-per-table tablespace. */ +UNIV_INLINE +bool +dict_table_is_file_per_table( + const dict_table_t* table) /*!< in: table to check */ +{ + return table->space != fil_system.sys_space + && table->space != fil_system.temp_space; +} + +/** Acquire the table handle. */ +inline void dict_table_t::acquire() +{ + ut_ad(dict_sys.frozen()); + n_ref_count++; +} + +/** Release the table handle. +@return whether the last handle was released */ +inline +bool +dict_table_t::release() +{ + auto n = n_ref_count--; + ut_ad(n > 0); + return n == 1; +} + +/** Encode the number of columns and number of virtual columns in a +4 bytes value. We could do this because the number of columns in +InnoDB is limited to 1017 +@param[in] n_col number of non-virtual column +@param[in] n_v_col number of virtual column +@return encoded value */ +UNIV_INLINE +ulint +dict_table_encode_n_col( + ulint n_col, + ulint n_v_col) +{ + return(n_col + (n_v_col<<16)); +} + +/** decode number of virtual and non-virtual columns in one 4 bytes value. +@param[in] encoded encoded value +@param[in,out] n_col number of non-virtual column +@param[in,out] n_v_col number of virtual column */ +UNIV_INLINE +void +dict_table_decode_n_col( + ulint encoded, + ulint* n_col, + ulint* n_v_col) +{ + + ulint num = encoded & ~DICT_N_COLS_COMPACT; + *n_v_col = num >> 16; + *n_col = num & 0xFFFF; +} + +/** Free the virtual column template +@param[in,out] vc_templ virtual column template */ +void +dict_free_vc_templ( + dict_vcol_templ_t* vc_templ) +{ + UT_DELETE_ARRAY(vc_templ->default_rec); + vc_templ->default_rec = NULL; + + if (vc_templ->vtempl != NULL) { + ut_ad(vc_templ->n_v_col > 0); + for (ulint i = 0; i < vc_templ->n_col + + vc_templ->n_v_col; i++) { + if (vc_templ->vtempl[i] != NULL) { + ut_free(vc_templ->vtempl[i]); + } + } + ut_free(vc_templ->vtempl); + vc_templ->vtempl = NULL; + } +} + +/** Check whether the table have virtual index. +@param[in] table InnoDB table +@return true if the table have virtual index, false otherwise. */ +UNIV_INLINE +bool +dict_table_have_virtual_index( + dict_table_t* table) +{ + for (ulint col_no = 0; col_no < dict_table_get_n_v_cols(table); + col_no++) { + const dict_v_col_t* col + = dict_table_get_nth_v_col(table, col_no); + + if (col->m_col.ord_part) { + return(true); + } + } + + return(false); +} diff --git a/storage/innobase/include/dict0load.h b/storage/innobase/include/dict0load.h index 072773694a9d7..f7d33d5b43bae 100644 --- a/storage/innobase/include/dict0load.h +++ b/storage/innobase/include/dict0load.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -53,9 +53,8 @@ We also scan the biggest space id, and store it to fil_system. */ void dict_check_tablespaces_and_store_max_id(); /** Make sure the data_file_name is saved in dict_table_t if needed. -@param[in,out] table Table object -@param[in] dict_locked dict_sys.frozen() */ -void dict_get_and_save_data_dir_path(dict_table_t* table, bool dict_locked); +@param[in,out] table Table object */ +void dict_get_and_save_data_dir_path(dict_table_t* table); /***********************************************************************//** Loads a table object based on the table id. @@ -90,7 +89,8 @@ dict_load_foreigns( const char* table_name, /*!< in: table name */ const char** col_names, /*!< in: column names, or NULL to use table->col_names */ - bool check_recursive,/*!< in: Whether to check + trx_id_t trx_id, /*!< in: DDL transaction id, + or 0 to check recursive load of tables chained by FK */ bool check_charsets, /*!< in: whether to check @@ -100,7 +100,7 @@ dict_load_foreigns( which must be loaded subsequently to load all the foreign key constraints. */ - MY_ATTRIBUTE((nonnull(1), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1))); /********************************************************************//** This function opens a system table, and return the first record. @@ -124,12 +124,13 @@ dict_getnext_system( /** Load a table definition from a SYS_TABLES record to dict_table_t. Do not load any columns or indexes. -@param[in] name Table name +@param[in,out] mtr mini-transaction +@param[in] uncommitted whether to use READ UNCOMMITTED isolation level @param[in] rec SYS_TABLES record @param[out,own] table table, or nullptr @return error message @retval nullptr on success */ -const char *dict_load_table_low(const span &name, +const char *dict_load_table_low(mtr_t *mtr, bool uncommitted, const rec_t *rec, dict_table_t **table) MY_ATTRIBUTE((nonnull, warn_unused_result)); diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 744ef5316ef5d..c76262ff5bebd 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -2,7 +2,7 @@ Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2023, 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 @@ -396,18 +396,7 @@ dict_mem_index_create( ulint type, /*!< in: DICT_UNIQUE, DICT_CLUSTERED, ... ORed */ ulint n_fields); /*!< in: number of fields */ -/**********************************************************************//** -Adds a field definition to an index. NOTE: does not take a copy -of the column name if the field is a column. The memory occupied -by the column name may be released only after publishing the index. */ -void -dict_mem_index_add_field( -/*=====================*/ - dict_index_t* index, /*!< in: index */ - const char* name, /*!< in: column name */ - ulint prefix_len); /*!< in: 0 or the column prefix length - in a MySQL index like - INDEX (textcol(25)) */ + /**********************************************************************//** Frees an index memory object. */ void @@ -886,9 +875,11 @@ struct dict_field_t{ unsigned fixed_len:10; /*!< 0 or the fixed length of the column if smaller than DICT_ANTELOPE_MAX_INDEX_COL_LEN */ + /** 1=DESC, 0=ASC */ + unsigned descending:1; /** Zero-initialize all fields */ - dict_field_t() : col(NULL), name(NULL), prefix_len(0), fixed_len(0) {} + dict_field_t() { memset((void*) this, 0, sizeof *this); } /** Check whether two index fields are equivalent. @param[in] old the other index field @@ -966,6 +957,26 @@ const char innobase_index_reserve_name[] = "GEN_CLUST_INDEX"; /** Data structure for an index. Most fields will be initialized to 0, NULL or FALSE in dict_mem_index_create(). */ struct dict_index_t { + /** Columns whose character-set collation is being changed */ + struct col_info + { + /** number of columns whose charset-collation is being changed */ + unsigned n_cols; + /** columns with changed charset-collation */ + dict_col_t *cols; + + /** Add a column with changed collation. */ + dict_col_t *add(mem_heap_t *heap, const dict_col_t &col, unsigned offset) + { + ut_ad(offset < n_cols); + if (!cols) + cols= static_cast + (mem_heap_alloc(heap, n_cols * sizeof col)); + new (&cols[offset]) dict_col_t(col); + return &cols[offset]; + } + }; + /** Maximum number of fields */ static constexpr unsigned MAX_N_FIELDS= (1U << 10) - 1; @@ -1051,6 +1062,16 @@ struct dict_index_t { It should use heap from dict_index_t. It should be freed while removing the index from table. */ dict_add_v_col_info* new_vcol_info; + + /** During ALTER TABLE, columns that a being-added index depends on + and whose encoding or collation is being changed to something + that is compatible with the clustered index. + Allocated from dict_index_t::heap. + + @see rollback_inplace_alter_table() + @see ha_innobase_inplace_ctx::col_collations */ + col_info* change_col_info; + UT_LIST_NODE_T(dict_index_t) indexes;/*!< list of indexes of the table */ #ifdef BTR_CUR_ADAPT @@ -1145,6 +1166,7 @@ struct dict_index_t { { ut_ad(!to_be_dropped); ut_ad(committed || !(type & DICT_CLUSTERED)); + ut_ad(!committed || !change_col_info); uncommitted = !committed; } @@ -1184,6 +1206,9 @@ struct dict_index_t { /** @return whether this is the change buffer */ bool is_ibuf() const { return UNIV_UNLIKELY(type & DICT_IBUF); } + /** @return whether this index requires locking */ + bool has_locking() const { return !is_ibuf(); } + /** @return whether this is a normal B-tree index (not the change buffer, not SPATIAL or FULLTEXT) */ bool is_btree() const { @@ -1307,8 +1332,19 @@ struct dict_index_t { ulint get_new_n_vcol() const { return new_vcol_info ? new_vcol_info->n_v_col : 0; } - /** Reconstruct the clustered index fields. */ - inline void reconstruct_fields(); + /** Assign the number of collation change fields as a part of the index + @param n_cols number of columns whose collation is changing */ + void init_change_cols(unsigned n_cols) + { + ut_ad(n_fields > n_cols || type & DICT_FTS); + change_col_info= static_cast + (mem_heap_zalloc(heap, sizeof(col_info))); + change_col_info->n_cols= n_cols; + } + + /** Reconstruct the clustered index fields. + @return whether metadata is incorrect */ + inline bool reconstruct_fields(); /** Check if the index contains a column or a prefix of that column. @param[in] n column number @@ -1403,8 +1439,23 @@ struct dict_index_t { /** Clear the index tree and reinitialize the root page, in the rollback of TRX_UNDO_EMPTY. The BTR_SEG_LEAF is freed and reinitialized. - @param thr query thread */ - void clear(que_thr_t *thr); + @param thr query thread + @return error code */ + dberr_t clear(que_thr_t *thr); + + /** Check whether the online log is dummy value to indicate + whether table undergoes active DDL. + @retval true if online log is dummy value */ + bool online_log_is_dummy() const + { + return online_log == reinterpret_cast(this); + } + + /** Assign clustered index online log to dummy value */ + void online_log_make_dummy() + { + online_log= reinterpret_cast(this); + } }; /** Detach a virtual column from an index. @@ -1415,6 +1466,21 @@ inline void dict_col_t::detach(const dict_index_t &index) reinterpret_cast(this)->detach(index); } +/** Add a field definition to an index. +@param index index +@param name pointer to column name +@param prefix_len column prefix length, or 0 +@param descending whether to use descending order */ +inline void dict_mem_index_add_field(dict_index_t *index, const char *name, + ulint prefix_len, bool descending= false) +{ + ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); + dict_field_t &field= index->fields[index->n_def++]; + field.name= name; + field.prefix_len= prefix_len & ((1U << 12) - 1); + field.descending= descending; +} + /** The status of online index creation */ enum online_index_status { /** the index is complete and ready for access */ @@ -1940,28 +2006,29 @@ struct dict_table_t { /** For overflow fields returns potential max length stored inline */ inline size_t get_overflow_field_local_len() const; - /** Parse the table file name into table name and database name. - @tparam dict_locked whether dict_sys.lock() was called - @param[in,out] db_name database name buffer - @param[in,out] tbl_name table name buffer - @param[out] db_name_len database name length - @param[out] tbl_name_len table name length - @return whether the table name is visible to SQL */ - template - bool parse_name(char (&db_name)[NAME_LEN + 1], - char (&tbl_name)[NAME_LEN + 1], - size_t *db_name_len, size_t *tbl_name_len) const; - - /** Clear the table when rolling back TRX_UNDO_EMPTY */ - void clear(que_thr_t *thr); + /** Parse the table file name into table name and database name. + @tparam dict_frozen whether the caller holds dict_sys.latch + @param[in,out] db_name database name buffer + @param[in,out] tbl_name table name buffer + @param[out] db_name_len database name length + @param[out] tbl_name_len table name length + @return whether the table name is visible to SQL */ + template + bool parse_name(char (&db_name)[NAME_LEN + 1], + char (&tbl_name)[NAME_LEN + 1], + size_t *db_name_len, size_t *tbl_name_len) const; + + /** Clear the table when rolling back TRX_UNDO_EMPTY + @return error code */ + dberr_t clear(que_thr_t *thr); #ifdef UNIV_DEBUG /** @return whether the current thread holds the lock_mutex */ bool lock_mutex_is_owner() const - { return lock_mutex_owner == os_thread_get_curr_id(); } + { return lock_mutex_owner == pthread_self(); } /** @return whether the current thread holds the stats_mutex (lock_mutex) */ bool stats_mutex_is_owner() const - { return lock_mutex_owner == os_thread_get_curr_id(); } + { return lock_mutex_owner == pthread_self(); } #endif /* UNIV_DEBUG */ void lock_mutex_init() { lock_mutex.init(); } void lock_mutex_destroy() { lock_mutex.destroy(); } @@ -1970,20 +2037,20 @@ struct dict_table_t { { ut_ad(!lock_mutex_is_owner()); lock_mutex.wr_lock(); - ut_ad(!lock_mutex_owner.exchange(os_thread_get_curr_id())); + ut_ad(!lock_mutex_owner.exchange(pthread_self())); } /** Try to acquire lock_mutex */ bool lock_mutex_trylock() { ut_ad(!lock_mutex_is_owner()); bool acquired= lock_mutex.wr_lock_try(); - ut_ad(!acquired || !lock_mutex_owner.exchange(os_thread_get_curr_id())); + ut_ad(!acquired || !lock_mutex_owner.exchange(pthread_self())); return acquired; } /** Release lock_mutex */ void lock_mutex_unlock() { - ut_ad(lock_mutex_owner.exchange(0) == os_thread_get_curr_id()); + ut_ad(lock_mutex_owner.exchange(0) == pthread_self()); lock_mutex.wr_unlock(); } #ifndef SUX_LOCK_GENERIC @@ -2004,7 +2071,7 @@ struct dict_table_t { @param new_name name of the table @param replace whether to replace the file with the new name (as part of rolling back TRUNCATE) */ - dberr_t rename_tablespace(const char *new_name, bool replace) const; + dberr_t rename_tablespace(span new_name, bool replace) const; private: /** Initialize instant->field_map. @@ -2285,7 +2352,7 @@ struct dict_table_t { srw_spin_mutex lock_mutex; #ifdef UNIV_DEBUG /** The owner of lock_mutex (0 if none) */ - Atomic_relaxed lock_mutex_owner{0}; + Atomic_relaxed lock_mutex_owner{0}; #endif public: /** Autoinc counter value to give to the next inserted row. */ @@ -2366,10 +2433,19 @@ struct dict_table_t { return false; } + /** @return whether a DDL operation is in progress on this table */ + bool is_active_ddl() const + { + return UT_LIST_GET_FIRST(indexes)->online_log; + } + /** @return whether the name is mysql.innodb_index_stats or mysql.innodb_table_stats */ bool is_stats_table() const; + /** @return number of unique columns in FTS_DOC_ID index */ + unsigned fts_n_uniq() const { return versioned() ? 2 : 1; } + /** Create metadata. @param name table name @param space tablespace @@ -2381,6 +2457,16 @@ struct dict_table_t { static dict_table_t *create(const span &name, fil_space_t *space, ulint n_cols, ulint n_v_cols, ulint flags, ulint flags2); + + /** Check whether the table has any spatial indexes */ + bool has_spatial_index() const + { + for (auto i= UT_LIST_GET_FIRST(indexes); + (i= UT_LIST_GET_NEXT(indexes, i)) != nullptr; ) + if (i->is_spatial()) + return true; + return false; + } }; inline void dict_index_t::set_modified(mtr_t& mtr) const @@ -2556,6 +2642,6 @@ inline void dict_stats_empty_defrag_stats(dict_index_t* index) index->stat_defrag_n_page_split = 0; } -#include "dict0mem.ic" +#include "dict0mem.inl" #endif /* dict0mem_h */ diff --git a/storage/innobase/include/dict0mem.ic b/storage/innobase/include/dict0mem.inl similarity index 100% rename from storage/innobase/include/dict0mem.ic rename to storage/innobase/include/dict0mem.inl diff --git a/storage/innobase/include/dict0pagecompress.h b/storage/innobase/include/dict0pagecompress.h index dfa6f2a244d96..f1272dc447d99 100644 --- a/storage/innobase/include/dict0pagecompress.h +++ b/storage/innobase/include/dict0pagecompress.h @@ -56,6 +56,6 @@ dict_table_page_compression_level( const dict_table_t* table) /*!< in: table */ __attribute__((const)); -#include "dict0pagecompress.ic" +#include "dict0pagecompress.inl" #endif diff --git a/storage/innobase/include/dict0pagecompress.ic b/storage/innobase/include/dict0pagecompress.inl similarity index 100% rename from storage/innobase/include/dict0pagecompress.ic rename to storage/innobase/include/dict0pagecompress.inl diff --git a/storage/innobase/include/dict0stats.h b/storage/innobase/include/dict0stats.h index cdc5ec1bffb1e..0dc1b984577ce 100644 --- a/storage/innobase/include/dict0stats.h +++ b/storage/innobase/include/dict0stats.h @@ -229,7 +229,7 @@ dberr_t dict_stats_report_error(dict_table_t* table, bool defragment = false) MY_ATTRIBUTE((nonnull, warn_unused_result)); -#include "dict0stats.ic" +#include "dict0stats.inl" #ifdef UNIV_ENABLE_UNIT_TEST_DICT_STATS void test_dict_stats_all(); diff --git a/storage/innobase/include/dict0stats.ic b/storage/innobase/include/dict0stats.inl similarity index 100% rename from storage/innobase/include/dict0stats.ic rename to storage/innobase/include/dict0stats.inl diff --git a/storage/innobase/include/dict0stats_bg.h b/storage/innobase/include/dict0stats_bg.h index 5604420134be9..d9a2f6282a1e4 100644 --- a/storage/innobase/include/dict0stats_bg.h +++ b/storage/innobase/include/dict0stats_bg.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -28,7 +28,6 @@ Created Apr 26, 2012 Vasil Dimov #define dict0stats_bg_h #include "dict0types.h" -#include "os0thread.h" #ifdef HAVE_PSI_INTERFACE extern mysql_pfs_key_t recalc_pool_mutex_key; diff --git a/storage/innobase/include/dict0types.h b/storage/innobase/include/dict0types.h index 104e99fc0cd89..ec50e8cd951ed 100644 --- a/storage/innobase/include/dict0types.h +++ b/storage/innobase/include/dict0types.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2022, 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 @@ -72,7 +72,7 @@ enum dict_err_ignore_t { DICT_ERR_IGNORE_FK_NOKEY = 1, /*!< ignore error if any foreign key is missing */ DICT_ERR_IGNORE_INDEX = 2, /*!< ignore corrupted indexes */ - DICT_ERR_IGNORE_RECOVER_LOCK = 4, + DICT_ERR_IGNORE_RECOVER_LOCK = 4 | DICT_ERR_IGNORE_FK_NOKEY, /*!< Used when recovering table locks for resurrected transactions. Silently load a missing @@ -105,7 +105,7 @@ struct table_name_t char* m_name; /** Default constructor */ - table_name_t() {} + table_name_t() = default; /** Constructor */ table_name_t(char* name) : m_name(name) {} diff --git a/storage/innobase/include/dyn0buf.h b/storage/innobase/include/dyn0buf.h index cb8b998f0ead7..06af4dcca882b 100644 --- a/storage/innobase/include/dyn0buf.h +++ b/storage/innobase/include/dyn0buf.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2020, MariaDB Corporation. +Copyright (c) 2018, 2022, 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 @@ -313,67 +313,13 @@ class mtr_buf_t { return(m_size); } - /** - Iterate over each block and call the functor. - @return false if iteration was terminated. */ - template - bool for_each_block(Functor& functor) const - { - for (list_t::iterator it = m_list.begin(), end = m_list.end(); - it != end; ++it) { - - if (!functor(&*it)) { - return false; - } - } - - return(true); - } - /** Iterate over each block and call the functor. @return false if iteration was terminated. */ template bool for_each_block(const Functor& functor) const { - for (typename list_t::iterator it = m_list.begin(), - end = m_list.end(); - it != end; ++it) { - - if (!functor(&*it)) { - return false; - } - } - - return(true); - } - - /** - Iterate over all the blocks in reverse and call the iterator - @return false if iteration was terminated. */ - template - bool for_each_block_in_reverse(Functor& functor) const - { - for (list_t::reverse_iterator it = m_list.rbegin(), - end = m_list.rend(); - it != end; ++it) { - - if (!functor(&*it)) { - return false; - } - } - - return(true); - } - - /** - Iterate over all the blocks in reverse and call the iterator - @return false if iteration was terminated. */ - template - bool for_each_block_in_reverse(const Functor& functor) const - { - for (list_t::reverse_iterator it = m_list.rbegin(), - end = m_list.rend(); + for (list_t::iterator it = m_list.begin(), end = m_list.end(); it != end; ++it) { if (!functor(&*it)) { diff --git a/storage/innobase/include/eval0eval.h b/storage/innobase/include/eval0eval.h index ebd40924a49c9..a3ea046250b40 100644 --- a/storage/innobase/include/eval0eval.h +++ b/storage/innobase/include/eval0eval.h @@ -104,6 +104,6 @@ eval_cmp( func_node_t* cmp_node); /*!< in: comparison node */ -#include "eval0eval.ic" +#include "eval0eval.inl" #endif diff --git a/storage/innobase/include/eval0eval.ic b/storage/innobase/include/eval0eval.inl similarity index 100% rename from storage/innobase/include/eval0eval.ic rename to storage/innobase/include/eval0eval.inl diff --git a/storage/innobase/include/eval0proc.h b/storage/innobase/include/eval0proc.h index 71700bb5933fa..a93140bf053fc 100644 --- a/storage/innobase/include/eval0proc.h +++ b/storage/innobase/include/eval0proc.h @@ -89,6 +89,6 @@ return_step( /*========*/ que_thr_t* thr); /*!< in: query thread */ -#include "eval0proc.ic" +#include "eval0proc.inl" #endif diff --git a/storage/innobase/include/eval0proc.ic b/storage/innobase/include/eval0proc.inl similarity index 100% rename from storage/innobase/include/eval0proc.ic rename to storage/innobase/include/eval0proc.inl diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h index cffb26b93ed09..f43965cd16593 100644 --- a/storage/innobase/include/fil0crypt.h +++ b/storage/innobase/include/fil0crypt.h @@ -296,7 +296,8 @@ byte* fil_space_encrypt( @param[in] tmp_frame Temporary buffer @param[in] physical_size page size @param[in,out] src_frame Page to decrypt -@return DB_SUCCESS or error */ +@retval DB_SUCCESS on success +@retval DB_DECRYPTION_FAILED on error */ dberr_t fil_space_decrypt( uint32_t space_id, @@ -312,7 +313,8 @@ Decrypt a page @param[in] tmp_frame Temporary buffer used for decrypting @param[in,out] src_frame Page to decrypt @return decrypted page, or original not encrypted page if decryption is -not needed.*/ +not needed. +@retval nullptr on failure */ byte* fil_space_decrypt( const fil_space_t* space, @@ -368,7 +370,7 @@ Return crypt statistics @param[out] stat Crypt statistics */ void fil_crypt_total_stat(fil_crypt_stat_t *stat); -#include "fil0crypt.ic" +#include "fil0crypt.inl" #endif /* !UNIV_INNOCHECKSUM */ /** diff --git a/storage/innobase/include/fil0crypt.ic b/storage/innobase/include/fil0crypt.inl similarity index 100% rename from storage/innobase/include/fil0crypt.ic rename to storage/innobase/include/fil0crypt.inl diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 34a53746b424c..73e80d77b568a 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -24,8 +24,7 @@ The low-level file system Created 10/25/1995 Heikki Tuuri *******************************************************/ -#ifndef fil0fil_h -#define fil0fil_h +#pragma once #include "fsp0types.h" #include "mach0data.h" @@ -354,13 +353,10 @@ struct fil_space_t final /** fil_system.spaces chain node */ fil_space_t *hash; - lsn_t max_lsn; - /*!< LSN of the most recent - fil_names_write_if_was_clean(). - Reset to 0 by fil_names_clear(). - Protected by log_sys.mutex. - If and only if this is nonzero, the - tablespace will be in named_spaces. */ + /** LSN of the most recent fil_names_write_if_was_clean(). + Reset to 0 by fil_names_clear(). Protected by exclusive log_sys.latch. + If and only if max_lsn is nonzero, this is in fil_system.named_spaces. */ + lsn_t max_lsn; /** tablespace identifier */ uint32_t id; /** whether undo tablespace truncation is in progress */ @@ -412,33 +408,44 @@ struct fil_space_t final static constexpr uint32_t PENDING= ~(STOPPING | CLOSING | NEEDS_FSYNC); /** latch protecting all page allocation bitmap pages */ srw_lock latch; - os_thread_id_t latch_owner; + pthread_t latch_owner; ut_d(Atomic_relaxed latch_count;) public: - /** MariaDB encryption data */ - fil_space_crypt_t* crypt_data; + /** MariaDB encryption data */ + fil_space_crypt_t *crypt_data; - /** Checks that this tablespace in a list of unflushed tablespaces. */ - bool is_in_unflushed_spaces; + /** Whether needs_flush(), or this is in fil_system.unflushed_spaces */ + bool is_in_unflushed_spaces; - /** Checks that this tablespace needs key rotation. */ - bool is_in_default_encrypt; + /** Whether this in fil_system.default_encrypt_tables (needs key rotation) */ + bool is_in_default_encrypt; - /** mutex to protect freed ranges */ - std::mutex freed_range_mutex; - - /** Variables to store freed ranges. This can be used to write - zeroes/punch the hole in files. Protected by freed_mutex */ - range_set freed_ranges; +private: + /** Whether any corrupton of this tablespace has been reported */ + mutable std::atomic_flag is_corrupted; - /** Stores last page freed lsn. Protected by freed_mutex */ - lsn_t last_freed_lsn; +public: + /** mutex to protect freed_ranges and last_freed_lsn */ + std::mutex freed_range_mutex; +private: + /** Ranges of freed page numbers; protected by freed_range_mutex */ + range_set freed_ranges; - ulint magic_n;/*!< FIL_SPACE_MAGIC_N */ + /** LSN of freeing last page; protected by freed_range_mutex */ + lsn_t last_freed_lsn; +public: /** @return whether doublewrite buffering is needed */ inline bool use_doublewrite() const; + /** @return whether a page has been freed */ + inline bool is_freed(uint32_t page); + + /** Apply freed_ranges to the file. + @param writable whether the file is writable + @return number of pages written or hole-punched */ + uint32_t flush_freed(bool writable); + /** Append a file to the chain of files of a space. @param[in] name file name of a file that is not open @param[in] handle file handle, or OS_FILE_CLOSED @@ -495,13 +502,12 @@ struct fil_space_t final written while the space ID is being updated in each page. */ inline void set_imported(); + /** Report the tablespace as corrupted */ + ATTRIBUTE_COLD void set_corrupted() const; + /** @return whether the storage device is rotational (HDD, not SSD) */ inline bool is_rotational() const; - /** whether the tablespace discovery is being deferred during crash - recovery due to incompletely written page 0 */ - inline bool is_deferred() const; - /** Open each file. Never invoked on .ibd files. @param create_new_db whether to skip the call to fil_node_t::read_page0() @return whether all files were opened */ @@ -526,15 +532,16 @@ struct fil_space_t final private: MY_ATTRIBUTE((warn_unused_result)) - /** Try to acquire a tablespace reference. - @return the old reference count (if STOPPING is set, it was not acquired) */ - uint32_t acquire_low() + /** Try to acquire a tablespace reference (increment referenced()). + @param avoid when these flags are set, nothing will be acquired + @return the old reference count */ + uint32_t acquire_low(uint32_t avoid= STOPPING) { uint32_t n= 0; while (!n_pending.compare_exchange_strong(n, n + 1, std::memory_order_acquire, std::memory_order_relaxed) && - !(n & STOPPING)); + !(n & avoid)); return n; } public: @@ -548,10 +555,8 @@ struct fil_space_t final @return whether the file is usable */ bool acquire() { - uint32_t n= acquire_low(); - if (UNIV_LIKELY(!(n & (STOPPING | CLOSING)))) - return true; - return UNIV_LIKELY(!(n & STOPPING)) && prepare(); + const auto flags= acquire_low(STOPPING | CLOSING) & (STOPPING | CLOSING); + return UNIV_LIKELY(!flags) || (flags == CLOSING && acquire_and_prepare()); } /** Acquire another tablespace reference for I/O. */ @@ -572,7 +577,7 @@ struct fil_space_t final #if defined __GNUC__ && (defined __i386__ || defined __x86_64__) static_assert(NEEDS_FSYNC == 1U << 29, "compatibility"); __asm__ __volatile__("lock btrl $29, %0" : "+m" (n_pending)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_IX64) +#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) static_assert(NEEDS_FSYNC == 1U << 29, "compatibility"); _interlockedbittestandreset(reinterpret_cast (&n_pending), 29); @@ -588,7 +593,7 @@ struct fil_space_t final #if defined __GNUC__ && (defined __i386__ || defined __x86_64__) static_assert(CLOSING == 1U << 30, "compatibility"); __asm__ __volatile__("lock btrl $30, %0" : "+m" (n_pending)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_IX64) +#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) static_assert(CLOSING == 1U << 30, "compatibility"); _interlockedbittestandreset(reinterpret_cast (&n_pending), 30); @@ -621,8 +626,7 @@ struct fil_space_t final @return number of pending operations, possibly with NEEDS_FSYNC flag */ uint32_t set_closing() { - return n_pending.fetch_or(CLOSING, std::memory_order_acquire) & - (PENDING | NEEDS_FSYNC); + return n_pending.fetch_or(CLOSING, std::memory_order_acquire); } public: @@ -637,11 +641,7 @@ struct fil_space_t final /** @return last_freed_lsn */ lsn_t get_last_freed_lsn() { return last_freed_lsn; } /** Update last_freed_lsn */ - void update_last_freed_lsn(lsn_t lsn) - { - std::lock_guard freed_lock(freed_range_mutex); - last_freed_lsn= lsn; - } + void update_last_freed_lsn(lsn_t lsn) { last_freed_lsn= lsn; } /** Note that the file will need fsync(). @return whether this needs to be added to fil_system.unflushed_spaces */ @@ -662,11 +662,7 @@ struct fil_space_t final /** Clear all freed ranges for undo tablespace when InnoDB encounters TRIM redo log record */ - void clear_freed_ranges() - { - std::lock_guard freed_lock(freed_range_mutex); - freed_ranges.clear(); - } + void clear_freed_ranges() { freed_ranges.clear(); } #endif /* !UNIV_INNOCHECKSUM */ /** FSP_SPACE_FLAGS and FSP_FLAGS_MEM_ flags; check fsp0types.h to more info about flags. */ @@ -901,11 +897,13 @@ struct fil_space_t final @param purpose tablespace purpose @param crypt_data encryption information @param mode encryption mode + @param opened true if space files are opened @return pointer to created tablespace, to be filled in with add() @retval nullptr on failure (such as when the same tablespace exists) */ static fil_space_t *create(uint32_t id, uint32_t flags, fil_type_t purpose, fil_space_crypt_t *crypt_data, - fil_encryption_t mode= FIL_ENCRYPTION_DEFAULT); + fil_encryption_t mode= FIL_ENCRYPTION_DEFAULT, + bool opened= false); MY_ATTRIBUTE((warn_unused_result)) /** Acquire a tablespace reference. @@ -939,7 +937,6 @@ struct fil_space_t final /** Add the set of freed page ranges */ void add_free_range(const range_t range) { - std::lock_guard freed_lock(freed_range_mutex); freed_ranges.add_range(range); } @@ -990,20 +987,20 @@ struct fil_space_t final #ifdef UNIV_DEBUG bool is_latched() const { return latch_count != 0; } #endif - bool is_owner() const { return latch_owner == os_thread_get_curr_id(); } + bool is_owner() const { return latch_owner == pthread_self(); } /** Acquire the allocation latch in exclusive mode */ void x_lock() { latch.wr_lock(SRW_LOCK_CALL); ut_ad(!latch_owner); - latch_owner= os_thread_get_curr_id(); + latch_owner= pthread_self(); ut_ad(!latch_count.fetch_add(1)); } /** Release the allocation latch from exclusive mode */ void x_unlock() { ut_ad(latch_count.fetch_sub(1) == 1); - ut_ad(latch_owner == os_thread_get_curr_id()); + ut_ad(latch_owner == pthread_self()); latch_owner= 0; latch.wr_unlock(); } @@ -1030,20 +1027,19 @@ struct fil_space_t final private: /** @return whether the file is usable for io() */ - ATTRIBUTE_COLD bool prepare(bool have_mutex= false); + ATTRIBUTE_COLD bool prepare_acquired(); + /** @return whether the file is usable for io() */ + ATTRIBUTE_COLD bool acquire_and_prepare(); #endif /*!UNIV_INNOCHECKSUM */ }; #ifndef UNIV_INNOCHECKSUM -/** Value of fil_space_t::magic_n */ -#define FIL_SPACE_MAGIC_N 89472 - /** File node of a tablespace or the log data space */ struct fil_node_t final { /** tablespace containing this file */ fil_space_t *space; - /** file name; protected by fil_system.mutex and log_sys.mutex */ + /** file name; protected by fil_system.mutex and exclusive log_sys.latch */ char *name; /** file handle */ pfs_os_file_t handle; @@ -1112,7 +1108,7 @@ struct fil_node_t final inline bool fil_space_t::use_doublewrite() const { return !UT_LIST_GET_FIRST(chain)->atomic_write && srv_use_doublewrite_buf && - buf_dblwr.is_initialised(); + buf_dblwr.is_created(); } inline void fil_space_t::set_imported() @@ -1131,11 +1127,6 @@ inline bool fil_space_t::is_rotational() const return false; } -inline bool fil_space_t::is_deferred() const -{ - return UT_LIST_GET_FIRST(chain)->deferred; -} - /** Common InnoDB file extensions */ enum ib_extention { NO_EXT = 0, @@ -1218,8 +1209,9 @@ struct fil_addr_t { /** For the first page in a system tablespace data file(ibdata*, not *.ibd): the file has been flushed to disk at least up to this lsn -For other pages: 32-bit key version used to encrypt the page + 32-bit checksum -or 64 bites of zero if no encryption */ +For other pages of tablespaces not in innodb_checksum_algorithm=full_crc32 +format: 32-bit key version used to encrypt the page + 32-bit checksum +or 64 bits of zero if no encryption */ #define FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION 26U /** This overloads FIL_PAGE_FILE_FLUSH_LSN for RTREE Split Sequence Number */ @@ -1393,7 +1385,12 @@ struct fil_system_t private: bool m_initialised; -#ifdef UNIV_LINUX + + /** Points to the last opened space in space_list. Protected with + fil_system.mutex. */ + fil_space_t *space_list_last_opened= nullptr; + +#ifdef __linux__ /** available block devices that reside on non-rotational storage */ std::vector ssd; public: @@ -1434,14 +1431,13 @@ struct fil_system_t /** nonzero if fil_node_open_file_low() should avoid moving the tablespace to the end of space_list, for FIFO policy of try_to_close() */ ulint freeze_space_list; + /** List of all file spaces, opened spaces should be at the top of the list + to optimize try_to_close() execution. Protected with fil_system.mutex. */ ilist space_list; - /*!< list of all file spaces */ + /** list of all tablespaces for which a FILE_MODIFY record has been written + since the latest redo log checkpoint. + Protected only by exclusive log_sys.latch. */ ilist named_spaces; - /*!< list of all file spaces - for which a FILE_MODIFY - record has been written since - the latest redo log checkpoint. - Protected only by log_sys.mutex. */ /** list of all ENCRYPTED=DEFAULT tablespaces that need to be converted to the current value of innodb_encrypt_tables */ @@ -1451,6 +1447,50 @@ struct fil_system_t potential space_id reuse */ bool space_id_reuse_warned; + /** Add the file to the end of opened spaces list in + fil_system.space_list, so that fil_space_t::try_to_close() should close + it as a last resort. + @param space space to add */ + void add_opened_last_to_space_list(fil_space_t *space); + + /** Move the file to the end of opened spaces list in + fil_system.space_list, so that fil_space_t::try_to_close() should close + it as a last resort. + @param space space to move */ + inline void move_opened_last_to_space_list(fil_space_t *space) + { + /* In the case when several files of the same space are added in a + row, there is no need to remove and add a space to the same position + in space_list. It can be for system or temporary tablespaces. */ + if (freeze_space_list || space_list_last_opened == space) + return; + + space_list.erase(space_list_t::iterator(space)); + add_opened_last_to_space_list(space); + } + + /** Move closed file last in fil_system.space_list, so that + fil_space_t::try_to_close() iterates opened files first in FIFO order, + i.e. first opened, first closed. + @param space space to move */ + void move_closed_last_to_space_list(fil_space_t *space) + { + if (UNIV_UNLIKELY(freeze_space_list)) + return; + + space_list_t::iterator s= space_list_t::iterator(space); + + if (space_list_last_opened == space) + { + ut_ad(s != space_list.begin()); + space_list_t::iterator prev= s; + space_list_last_opened= &*--prev; + } + + space_list.erase(s); + space_list.push_back(*space); + } + /** Return the next tablespace from default_encrypt_tables list. @param space previous tablespace (nullptr to start from the start) @param recheck whether the removal condition needs to be rechecked after @@ -1489,7 +1529,7 @@ inline void fil_space_t::reacquire() inline bool fil_space_t::set_stopping_check() { mysql_mutex_assert_owner(&fil_system.mutex); -#if defined __clang_major__ && __clang_major__ < 10 +#if (defined __clang_major__ && __clang_major__ < 10) || defined __APPLE_CC__ /* Only clang-10 introduced support for asm goto */ return n_pending.fetch_or(STOPPING, std::memory_order_relaxed) & STOPPING; #elif defined __GNUC__ && (defined __i386__ || defined __x86_64__) @@ -1499,7 +1539,7 @@ inline bool fil_space_t::set_stopping_check() return true; not_stopped: return false; -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_IX64) +#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) static_assert(STOPPING == 1U << 31, "compatibility"); return _interlockedbittestandset(reinterpret_cast (&n_pending), 31); @@ -1516,7 +1556,7 @@ inline void fil_space_t::set_stopping() #if defined __GNUC__ && (defined __i386__ || defined __x86_64__) static_assert(STOPPING == 1U << 31, "compatibility"); __asm__ __volatile__("lock btsl $31, %0" : "+m" (n_pending)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_IX64) +#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) static_assert(STOPPING == 1U << 31, "compatibility"); _interlockedbittestandset(reinterpret_cast(&n_pending), 31); #else @@ -1545,9 +1585,10 @@ template inline void fil_space_t::flush() } else if (have_reference) flush_low(); - else if (!(acquire_low() & STOPPING)) + else { - flush_low(); + if (!(acquire_low() & (STOPPING | CLOSING))) + flush_low(); release(); } } @@ -1666,10 +1707,7 @@ file inode probably is much faster (the OS caches them) than accessing the first page of the file. This boolean may be initially false, but if a remote tablespace is found it will be changed to true. -If the fix_dict boolean is set, then it is safe to use an internal SQL -statement to update the dictionary tables if they are incorrect. - -@param[in] validate true if we should validate the tablespace +@param[in] validate 0=maybe missing, 1=do not validate, 2=validate @param[in] purpose FIL_TYPE_TABLESPACE or FIL_TYPE_TEMPORARY @param[in] id tablespace ID @param[in] flags expected FSP_SPACE_FLAGS @@ -1681,7 +1719,7 @@ If file-per-table, it is the table name in the databasename/tablename format @retval NULL if the tablespace could not be opened */ fil_space_t* fil_ibd_open( - bool validate, + unsigned validate, fil_type_t purpose, uint32_t id, uint32_t flags, @@ -1783,7 +1821,4 @@ void test_make_filepath(); @return block size */ ulint fil_space_get_block_size(const fil_space_t* space, unsigned offset); -#include "fil0fil.ic" #endif /* UNIV_INNOCHECKSUM */ - -#endif /* fil0fil_h */ diff --git a/storage/innobase/include/fil0fil.ic b/storage/innobase/include/fil0fil.ic deleted file mode 100644 index 3194e54c5b537..0000000000000 --- a/storage/innobase/include/fil0fil.ic +++ /dev/null @@ -1,145 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2015, 2019, 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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/fil0fil.ic -The low-level file system support functions - -Created 31/03/2015 Jan Lindström -*******************************************************/ - -#ifndef fil0fil_ic -#define fil0fil_ic - -/*******************************************************************//** -Return page type name */ -UNIV_INLINE -const char* -fil_get_page_type_name( -/*===================*/ - ulint page_type) /*!< in: FIL_PAGE_TYPE */ -{ - switch(page_type) { - case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED: - return "PAGE_COMPRESSED_ENRYPTED"; - case FIL_PAGE_PAGE_COMPRESSED: - return "PAGE_COMPRESSED"; - case FIL_PAGE_TYPE_INSTANT: - case FIL_PAGE_INDEX: - return "INDEX"; - case FIL_PAGE_RTREE: - return "RTREE"; - case FIL_PAGE_UNDO_LOG: - return "UNDO LOG"; - case FIL_PAGE_INODE: - return "INODE"; - case FIL_PAGE_IBUF_FREE_LIST: - return "IBUF_FREE_LIST"; - case FIL_PAGE_TYPE_ALLOCATED: - return "ALLOCATED"; - case FIL_PAGE_IBUF_BITMAP: - return "IBUF_BITMAP"; - case FIL_PAGE_TYPE_SYS: - return "SYS"; - case FIL_PAGE_TYPE_TRX_SYS: - return "TRX_SYS"; - case FIL_PAGE_TYPE_FSP_HDR: - return "FSP_HDR"; - case FIL_PAGE_TYPE_XDES: - return "XDES"; - case FIL_PAGE_TYPE_BLOB: - return "BLOB"; - case FIL_PAGE_TYPE_ZBLOB: - return "ZBLOB"; - case FIL_PAGE_TYPE_ZBLOB2: - return "ZBLOB2"; - case FIL_PAGE_TYPE_UNKNOWN: - return "OLD UNKNOWN PAGE TYPE"; - default: - return "PAGE TYPE CORRUPTED"; - } -} - -#ifdef UNIV_DEBUG -/** Validate page type. -@param[in] space Tablespace object -@param[in] page page to validate -@return true if valid, false if not */ -UNIV_INLINE -bool -fil_page_type_validate( - fil_space_t* space, - const byte* page) -{ - const uint16_t page_type = fil_page_get_type(page); - - if ((page_type & 1U << FIL_PAGE_COMPRESS_FCRC32_MARKER) - && space->full_crc32() - && space->is_compressed()) { - return true; - } - - /* Validate page type */ - if (!((page_type == FIL_PAGE_PAGE_COMPRESSED || - page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED || - page_type == FIL_PAGE_INDEX || - page_type == FIL_PAGE_TYPE_INSTANT || - page_type == FIL_PAGE_RTREE || - page_type == FIL_PAGE_UNDO_LOG || - page_type == FIL_PAGE_INODE || - page_type == FIL_PAGE_IBUF_FREE_LIST || - page_type == FIL_PAGE_TYPE_ALLOCATED || - page_type == FIL_PAGE_IBUF_BITMAP || - page_type == FIL_PAGE_TYPE_SYS || - page_type == FIL_PAGE_TYPE_TRX_SYS || - page_type == FIL_PAGE_TYPE_FSP_HDR || - page_type == FIL_PAGE_TYPE_XDES || - page_type == FIL_PAGE_TYPE_BLOB || - page_type == FIL_PAGE_TYPE_ZBLOB || - page_type == FIL_PAGE_TYPE_ZBLOB2 || - page_type == FIL_PAGE_TYPE_UNKNOWN))) { - - ulint space_id = mach_read_from_4( - page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); - - ulint offset = mach_read_from_4(page + FIL_PAGE_OFFSET); - - ulint key_version = mach_read_from_4( - page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); - - if (space && space->full_crc32()) { - key_version = mach_read_from_4( - page + FIL_PAGE_FCRC32_KEY_VERSION); - } - - /* Dump out the page info */ - ib::fatal() << "Page " << space_id << ":" << offset - << " name " << (space && space->chain.start - ? space->chain.start->name : "???") - << " page_type " << page_type - << " key_version " << key_version - << " lsn " << mach_read_from_8(page + FIL_PAGE_LSN) - << " compressed_len " << mach_read_from_2(page + FIL_PAGE_DATA); - return false; - } - - return true; -} -#endif /* UNIV_DEBUG */ - -#endif /* fil0fil_ic */ diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h index 80ce122c6036e..26261554f9bb7 100644 --- a/storage/innobase/include/fsp0fsp.h +++ b/storage/innobase/include/fsp0fsp.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2022, 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 @@ -207,16 +207,17 @@ typedef byte fseg_inode_t; (16 + 3 * FLST_BASE_NODE_SIZE \ + FSEG_FRAG_ARR_N_SLOTS * FSEG_FRAG_SLOT_SIZE) -static constexpr uint32_t FSEG_MAGIC_N_VALUE= 97937874; +static constexpr byte FSEG_MAGIC_N_BYTES[4]={0x05,0xd6,0x69,0xd2}; -#define FSEG_FILLFACTOR 8 /* If this value is x, then if - the number of unused but reserved +#define FSEG_FILLFACTOR 8 /* If the number of unused but reserved pages in a segment is less than - reserved pages * 1/x, and there are + reserved pages / FSEG_FILLFACTOR, + and there are at least FSEG_FRAG_LIMIT used pages, then we allow a new empty extent to be added to the segment in - fseg_alloc_free_page. Otherwise, we + fseg_alloc_free_page_general(). + Otherwise, we use unused pages of the segment. */ #define FSEG_FRAG_LIMIT FSEG_FRAG_ARR_N_SLOTS @@ -345,22 +346,25 @@ fsp_header_check_encryption_key( /** Initialize a tablespace header. @param[in,out] space tablespace @param[in] size current size in blocks -@param[in,out] mtr mini-transaction */ -void fsp_header_init(fil_space_t* space, uint32_t size, mtr_t* mtr) - MY_ATTRIBUTE((nonnull)); +@param[in,out] mtr mini-transaction +@return error code */ +dberr_t fsp_header_init(fil_space_t *space, uint32_t size, mtr_t *mtr) + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Create a new segment. @param space tablespace @param byte_offset byte offset of the created segment header @param mtr mini-transaction +@param err error code @param has_done_reservation whether fsp_reserve_free_extents() was invoked @param block block where segment header is placed, or NULL to allocate an additional page for that @return the block where the segment header is placed, x-latched -@retval NULL if could not create segment because of lack of space */ +@retval nullptr if could not create segment */ buf_block_t* -fseg_create(fil_space_t *space, ulint byte_offset, mtr_t *mtr, - bool has_done_reservation= false, buf_block_t *block= NULL); +fseg_create(fil_space_t *space, ulint byte_offset, mtr_t *mtr, dberr_t *err, + bool has_done_reservation= false, buf_block_t *block= nullptr) + MY_ATTRIBUTE((nonnull(1,3,4), warn_unused_result)); /** Calculate the number of pages reserved by a segment, and how many pages are currently used. @@ -375,22 +379,6 @@ ulint fseg_n_reserved_pages(const buf_block_t &block, MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Allocates a single free page from a segment. This function implements -the intelligent allocation strategy which tries to minimize -file space fragmentation. -@param[in,out] seg_header segment header -@param[in] hint hint of which page would be desirable -@param[in] direction if the new page is needed because - of an index page split, and records are - inserted there in order, into which - direction they go alphabetically: FSP_DOWN, - FSP_UP, FSP_NO_DIR -@param[in,out] mtr mini-transaction -@return X-latched block, or NULL if no page could be allocated */ -#define fseg_alloc_free_page(seg_header, hint, direction, mtr) \ - fseg_alloc_free_page_general(seg_header, hint, direction, \ - false, mtr, mtr) -/**********************************************************************//** -Allocates a single free page from a segment. This function implements the intelligent allocation strategy which tries to minimize file space fragmentation. @retval NULL if no page could be allocated */ @@ -411,8 +399,9 @@ fseg_alloc_free_page_general( is no need to do the check for this individual page */ mtr_t* mtr, /*!< in/out: mini-transaction */ - mtr_t* init_mtr)/*!< in/out: mtr or another mini-transaction + mtr_t* init_mtr,/*!< in/out: mtr or another mini-transaction in which the page should be initialized. */ + dberr_t* err) /*!< out: error code */ MY_ATTRIBUTE((warn_unused_result, nonnull)); /** Reserves free pages from a tablespace. All mini-transactions which may @@ -441,19 +430,21 @@ if the table only occupies < FSP_EXTENT_SIZE pages. That is why we apply different rules in that special case, just ensuring that there are n_pages free pages available. -@param[out] n_reserved number of extents actually reserved; if we - return true and the tablespace size is < - FSP_EXTENT_SIZE pages, then this can be 0, - otherwise it is n_ext -@param[in,out] space tablespace -@param[in] n_ext number of extents to reserve -@param[in] alloc_type page reservation type (FSP_BLOB, etc) -@param[in,out] mtr the mini transaction -@param[in] n_pages for small tablespaces (tablespace size is - less than FSP_EXTENT_SIZE), number of free - pages to reserve. -@return true if we were able to make the reservation */ -bool +@param[out] n_reserved number of extents actually reserved; if we + return true and the tablespace size is < + FSP_EXTENT_SIZE pages, then this can be 0, + otherwise it is n_ext +@param[in,out] space tablespace +@param[in] n_ext number of extents to reserve +@param[in] alloc_type page reservation type (FSP_BLOB, etc) +@param[in,out] mtr the mini transaction +@param[out] err error code +@param[in] n_pages for small tablespaces (tablespace size is + less than FSP_EXTENT_SIZE), number of free + pages to reserve. +@return error code +@retval DB_SUCCESS if we were able to make the reservation */ +dberr_t fsp_reserve_free_extents( uint32_t* n_reserved, fil_space_t* space, @@ -467,22 +458,26 @@ fsp_reserve_free_extents( @param[in,out] space tablespace @param[in] offset page number @param[in,out] mtr mini-transaction -@param[in] have_latch whether space->x_lock() was already called */ -void +@param[in] have_latch whether space->x_lock() was already called +@return error code */ +dberr_t fseg_free_page( fseg_header_t* seg_header, fil_space_t* space, uint32_t offset, mtr_t* mtr, - bool have_latch = false); -/** Determine whether a page is free. -@param[in,out] space tablespace -@param[in] page page number -@return whether the page is marked as free */ -bool -fseg_page_is_free(fil_space_t* space, unsigned page) + bool have_latch = false) MY_ATTRIBUTE((nonnull, warn_unused_result)); +/** Determine whether a page is allocated. +@param space tablespace +@param page page number +@return error code +@retval DB_SUCCESS if the page is marked as free +@retval DB_SUCCESS_LOCKED_REC if the page is marked as allocated */ +dberr_t fseg_page_is_allocated(fil_space_t *space, unsigned page) + MY_ATTRIBUTE((nonnull, warn_unused_result)); + /** Frees part of a segment. This function can be used to free a segment by repeatedly calling this function in different mini-transactions. Doing the freeing in a single mini-transaction @@ -711,6 +706,20 @@ inline bool fsp_flags_match(uint32_t expected, uint32_t actual) return actual == expected || fsp_flags_convert_from_101(actual) == expected; } +/** Determine if FSP_SPACE_FLAGS are from an incompatible MySQL format. +@param flags the contents of FSP_SPACE_FLAGS +@return MySQL flags shifted. +@retval 0, if not a MySQL incompatible format. */ +MY_ATTRIBUTE((warn_unused_result, const)) +inline uint32_t fsp_flags_is_incompatible_mysql(uint32_t flags) +{ + /* + MySQL-8.0 SDI flag (bit 14), + or MySQL 5.7 Encyption flag (bit 13) + */ + return flags >> 13 & 3; +} + /** Determine the descriptor index within a descriptor page. @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param[in] offset page offset diff --git a/storage/innobase/include/fsp0types.h b/storage/innobase/include/fsp0types.h index e062ed189bd24..9a23e84038051 100644 --- a/storage/innobase/include/fsp0types.h +++ b/storage/innobase/include/fsp0types.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2021, MariaDB Corporation. +Copyright (c) 2014, 2022, 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 @@ -48,7 +48,7 @@ extern const char *page_compression_algorithms[]; If records are inserted in order, there are the following flags to tell this (their type is made byte for the compiler to warn if direction and hint parameters are switched in -fseg_alloc_free_page) */ +fseg_alloc_free_page_general) */ /* @{ */ #define FSP_UP ((byte)111) /*!< alphabetically upwards */ #define FSP_DOWN ((byte)112) /*!< alphabetically downwards */ diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h index 9974912715c06..c0151b4406338 100644 --- a/storage/innobase/include/fts0fts.h +++ b/storage/innobase/include/fts0fts.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2021, MariaDB Corporation. +Copyright (c) 2016, 2022, 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 @@ -355,10 +355,10 @@ struct fts_stopword_t; extern const char* fts_default_stopword[]; /** Variable specifying the maximum FTS cache size for each table */ -extern ulong fts_max_cache_size; +extern Atomic_relaxed fts_max_cache_size; /** Variable specifying the total memory allocated for FTS cache */ -extern ulong fts_max_total_cache_size; +extern Atomic_relaxed fts_max_total_cache_size; /** Variable specifying the FTS result cache limit for each query */ extern size_t fts_result_cache_limit; @@ -398,17 +398,6 @@ fts_get_next_doc_id( /*================*/ const dict_table_t* table, /*!< in: table */ doc_id_t* doc_id);/*!< out: new document id */ -/*********************************************************************//** -Update the next and last Doc ID in the CONFIG table to be the input -"doc_id" value (+ 1). We would do so after each FTS index build or -table truncate */ -void -fts_update_next_doc_id( -/*===================*/ - trx_t* trx, /*!< in/out: transaction */ - const dict_table_t* table, /*!< in: table */ - doc_id_t doc_id) /*!< in: DOC ID to set */ - MY_ATTRIBUTE((nonnull(2))); /******************************************************************//** Create a new fts_doc_ids_t. @@ -621,14 +610,6 @@ fts_create( dict_table_t* table); /*!< out: table with FTS indexes */ -/**********************************************************************//** -Free the FTS resources. */ -void -fts_free( -/*=====*/ - dict_table_t* table); /*!< in/out: table with - FTS indexes */ - /*********************************************************************//** Run OPTIMIZE on the given table. @return DB_SUCCESS if all OK */ @@ -829,15 +810,14 @@ fts_get_max_doc_id( /*===============*/ dict_table_t* table); /*!< in: user table */ -/******************************************************************//** -Check whether user supplied stopword table exists and is of -the right format. -@return the stopword column charset if qualifies */ -CHARSET_INFO* -fts_valid_stopword_table( -/*=====================*/ - const char* stopword_table_name); /*!< in: Stopword table - name */ +/** Check whether a stopword table is in the right format. +@param stopword_table_name table name +@param row_end name of the system-versioning end column, or "value" +@return the stopword column charset +@retval NULL if the table does not exist or qualify */ +CHARSET_INFO *fts_valid_stopword_table(const char *stopword_table_name, + const char **row_end= NULL); + /****************************************************************//** This function loads specified stopword into FTS cache @return true if success */ @@ -950,6 +930,18 @@ bool fts_check_aux_table(const char *name, table_id_t *table_id, index_id_t *index_id); +/** Update the last document id. This function could create a new +transaction to update the last document id. +@param table table to be updated +@param doc_id last document id +@param trx update trx or null +@retval DB_SUCCESS if OK */ +dberr_t +fts_update_sync_doc_id(const dict_table_t *table, + doc_id_t doc_id, + trx_t *trx) + MY_ATTRIBUTE((nonnull(1))); + /** Sync the table during commit phase @param[in] table table to be synced */ void fts_sync_during_ddl(dict_table_t* table); diff --git a/storage/innobase/include/fts0priv.h b/storage/innobase/include/fts0priv.h index a8647b4dd1d31..ae0bb036e3780 100644 --- a/storage/innobase/include/fts0priv.h +++ b/storage/innobase/include/fts0priv.h @@ -480,6 +480,6 @@ fts_config_create_index_param_name( const dict_index_t* index) /*!< in: index for config */ MY_ATTRIBUTE((nonnull, malloc, warn_unused_result)); -#include "fts0priv.ic" +#include "fts0priv.inl" #endif /* INNOBASE_FTS0PRIV_H */ diff --git a/storage/innobase/include/fts0priv.ic b/storage/innobase/include/fts0priv.inl similarity index 100% rename from storage/innobase/include/fts0priv.ic rename to storage/innobase/include/fts0priv.inl diff --git a/storage/innobase/include/fts0types.h b/storage/innobase/include/fts0types.h index 0938514995bb3..fb278d543c441 100644 --- a/storage/innobase/include/fts0types.h +++ b/storage/innobase/include/fts0types.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -28,7 +28,6 @@ Created 2007-03-27 Sunny Bains #define INNOBASE_FTS0TYPES_H #include "fts0fts.h" -#include "fut0fut.h" #include "pars0pars.h" #include "que0types.h" #include "ut0byte.h" @@ -350,6 +349,6 @@ fts_select_index( const byte* str, ulint len); -#include "fts0types.ic" +#include "fts0types.inl" #endif /* INNOBASE_FTS0TYPES_H */ diff --git a/storage/innobase/include/fts0types.ic b/storage/innobase/include/fts0types.inl similarity index 100% rename from storage/innobase/include/fts0types.ic rename to storage/innobase/include/fts0types.inl diff --git a/storage/innobase/include/fut0fut.h b/storage/innobase/include/fut0fut.h deleted file mode 100644 index 79d0bc0da0c6a..0000000000000 --- a/storage/innobase/include/fut0fut.h +++ /dev/null @@ -1,77 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2019, 2021, 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 02110-1335 USA - -*****************************************************************************/ - -/******************************************************************//** -@file include/fut0fut.h -File-based utilities - -Created 12/13/1995 Heikki Tuuri -***********************************************************************/ - - -#ifndef fut0fut_h -#define fut0fut_h - -#include "mtr0mtr.h" - -/** Gets a pointer to a file address and latches the page. -@param[in] space space id -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] addr file address -@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_SX_LATCH -@param[out] ptr_block file page -@param[in,out] mtr mini-transaction -@return pointer to a byte in (*ptr_block)->frame; the *ptr_block is -bufferfixed and latched */ -inline -byte* -fut_get_ptr( - uint32_t space, - ulint zip_size, - fil_addr_t addr, - rw_lock_type_t rw_latch, - mtr_t* mtr, - buf_block_t** ptr_block = NULL) -{ - buf_block_t* block; - byte* ptr = NULL; - - ut_ad(addr.boffset < srv_page_size); - ut_ad((rw_latch == RW_S_LATCH) - || (rw_latch == RW_X_LATCH) - || (rw_latch == RW_SX_LATCH)); - - block = buf_page_get_gen(page_id_t(space, addr.page), zip_size, - rw_latch, nullptr, BUF_GET_POSSIBLY_FREED, - mtr); - if (!block) { - } else if (block->page.is_freed()) { - block = nullptr; - } else { - ptr = buf_block_get_frame(block) + addr.boffset; - } - - if (ptr_block != NULL) { - *ptr_block = block; - } - - return(ptr); -} - -#endif /* fut0fut_h */ diff --git a/storage/innobase/include/fut0lst.h b/storage/innobase/include/fut0lst.h index c27de3db78691..746dab80400f9 100644 --- a/storage/innobase/include/fut0lst.h +++ b/storage/innobase/include/fut0lst.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2021, MariaDB Corporation. +Copyright (c) 2018, 2022, 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 @@ -24,30 +24,21 @@ File-based list utilities Created 11/28/1995 Heikki Tuuri ***********************************************************************/ -#ifndef fut0lst_h -#define fut0lst_h +#pragma once + +/* The physical size of a list base node in bytes */ +#define FLST_BASE_NODE_SIZE (4 + 2 * FIL_ADDR_SIZE) +/* The physical size of a list node in bytes */ +#define FLST_NODE_SIZE (2 * FIL_ADDR_SIZE) #ifdef UNIV_INNOCHECKSUM # include "fil0fil.h" #else -#include "fut0fut.h" -#include "mtr0log.h" - -/* The C 'types' of base node and list node: these should be used to -write self-documenting code. Of course, the sizeof macro cannot be -applied to these types! */ +# include "mtr0log.h" typedef byte flst_base_node_t; typedef byte flst_node_t; -#endif /* !UNIV_INNOCHECKSUM */ - -/* The physical size of a list base node in bytes */ -#define FLST_BASE_NODE_SIZE (4 + 2 * FIL_ADDR_SIZE) -/* The physical size of a list node in bytes */ -#define FLST_NODE_SIZE (2 * FIL_ADDR_SIZE) - -#ifndef UNIV_INNOCHECKSUM /* We define the field offsets of a node for the list */ #define FLST_PREV 0 /* 6-byte address of the previous list element; the page part of address is FIL_NULL, if no @@ -83,7 +74,7 @@ inline void flst_init(const buf_block_t* block, uint16_t ofs, mtr_t* mtr) @param[in] block file page @param[in,out] base base node @param[in,out] mtr mini-transaction */ -void flst_init(const buf_block_t& block, byte *base, mtr_t *mtr) +void flst_init(const buf_block_t &block, byte *base, mtr_t *mtr) MY_ATTRIBUTE((nonnull)); /** Append a file list node to a list. @@ -91,28 +82,31 @@ void flst_init(const buf_block_t& block, byte *base, mtr_t *mtr) @param[in] boffset byte offset of the base node @param[in,out] add block to be added @param[in] aoffset byte offset of the node to be added -@param[in,outr] mtr mini-transaction */ -void flst_add_last(buf_block_t *base, uint16_t boffset, - buf_block_t *add, uint16_t aoffset, mtr_t *mtr) - MY_ATTRIBUTE((nonnull)); +@param[in,out] mtr mini-transaction +@return error code */ +dberr_t flst_add_last(buf_block_t *base, uint16_t boffset, + buf_block_t *add, uint16_t aoffset, mtr_t *mtr) + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Prepend a file list node to a list. @param[in,out] base base node block @param[in] boffset byte offset of the base node @param[in,out] add block to be added @param[in] aoffset byte offset of the node to be added -@param[in,outr] mtr mini-transaction */ -void flst_add_first(buf_block_t *base, uint16_t boffset, +@param[in,out] mtr mini-transaction +@return error code */ +dberr_t flst_add_first(buf_block_t *base, uint16_t boffset, buf_block_t *add, uint16_t aoffset, mtr_t *mtr) - MY_ATTRIBUTE((nonnull)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Remove a file list node. @param[in,out] base base node block @param[in] boffset byte offset of the base node @param[in,out] cur block to be removed @param[in] coffset byte offset of the current record to be removed -@param[in,outr] mtr mini-transaction */ -void flst_remove(buf_block_t *base, uint16_t boffset, - buf_block_t *cur, uint16_t coffset, mtr_t *mtr) - MY_ATTRIBUTE((nonnull)); +@param[in,out] mtr mini-transaction +@return error code */ +dberr_t flst_remove(buf_block_t *base, uint16_t boffset, + buf_block_t *cur, uint16_t coffset, mtr_t *mtr) + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** @return the length of a list */ inline uint32_t flst_get_len(const flst_base_node_t *base) @@ -154,11 +148,9 @@ inline fil_addr_t flst_get_prev_addr(const flst_node_t *node) return flst_read_addr(node + FLST_PREV); } -#ifdef UNIV_DEBUG +# ifdef UNIV_DEBUG /** Validate a file-based list. */ void flst_validate(const buf_block_t *base, uint16_t boffset, mtr_t *mtr); -#endif +# endif #endif /* !UNIV_INNOCHECKSUM */ - -#endif diff --git a/storage/innobase/include/gis0rtree.h b/storage/innobase/include/gis0rtree.h index 9f42e39bae87a..b07261ce04286 100644 --- a/storage/innobase/include/gis0rtree.h +++ b/storage/innobase/include/gis0rtree.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, MariaDB Corporation. +Copyright (c) 2017, 2023, 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 @@ -59,6 +59,44 @@ Created 2013/03/27 Jimmy Yang and Allen Lai /* Geometry data header */ #define GEO_DATA_HEADER_SIZE 4 + +/** Search for a spatial index leaf page record. +@param cur cursor +@param tuple search tuple +@param latch_mode latching mode +@param mtr mini-transaction +@param mode search mode */ +dberr_t rtr_search_leaf(btr_cur_t *cur, const dtuple_t *tuple, + btr_latch_mode latch_mode, mtr_t *mtr, + page_cur_mode_t mode= PAGE_CUR_RTREE_LOCATE) + MY_ATTRIBUTE((nonnull, warn_unused_result)); + +/** Search for inserting a spatial index leaf page record. +@param cur cursor +@param tuple search tuple +@param latch_mode latching mode +@param mtr mini-transaction */ +inline dberr_t rtr_insert_leaf(btr_cur_t *cur, const dtuple_t *tuple, + btr_latch_mode latch_mode, mtr_t *mtr) +{ + return rtr_search_leaf(cur, tuple, latch_mode, mtr, PAGE_CUR_RTREE_INSERT); +} + +/** Search for a spatial index leaf page record. +@param pcur cursor +@param tuple search tuple +@param mode search mode +@param mtr mini-transaction */ +dberr_t rtr_search_leaf(btr_pcur_t *pcur, const dtuple_t *tuple, + page_cur_mode_t mode, mtr_t *mtr) + MY_ATTRIBUTE((nonnull, warn_unused_result)); + +dberr_t rtr_search_to_nth_level(ulint level, const dtuple_t *tuple, + page_cur_mode_t mode, + btr_latch_mode latch_mode, + btr_cur_t *cur, mtr_t *mtr) + MY_ATTRIBUTE((nonnull, warn_unused_result)); + /**********************************************************************//** Builds a Rtree node pointer out of a physical record and a page number. @return own: node pointer */ @@ -93,7 +131,8 @@ rtr_page_split_and_insert( mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ const dtuple_t* tuple, /*!< in: tuple to insert */ ulint n_ext, /*!< in: number of externally stored columns */ - mtr_t* mtr); /*!< in: mtr */ + mtr_t* mtr, /*!< in: mtr */ + dberr_t* err); /*!< out: error code */ /**************************************************************//** Sets the child node mbr in a node pointer. */ @@ -123,7 +162,8 @@ rtr_pcur_move_to_next( function may release the page latch */ ulint cur_level, /*!< in: current level */ - mtr_t* mtr); /*!< in: mtr */ + mtr_t* mtr) /*!< in: mtr */ + MY_ATTRIBUTE((warn_unused_result)); /****************************************************************//** Searches the right position in rtree for a page cursor. */ @@ -254,21 +294,14 @@ rtr_get_mbr_from_tuple( rtr_mbr* mbr); /*!< out: mbr to fill */ /* Get the rtree page father. -@param[in] offsets work area for the return value -@param[in] index rtree index -@param[in] block child page in the index -@param[in] mtr mtr +@param[in,out] mtr mtr @param[in] sea_cur search cursor, contains information about parent nodes in search -@param[in] cursor cursor on node pointer record, - its page x-latched */ -void -rtr_page_get_father( - dict_index_t* index, - buf_block_t* block, - mtr_t* mtr, - btr_cur_t* sea_cur, - btr_cur_t* cursor); +@param[in,out] cursor cursor on node pointer record, + its page x-latched +@return whether the cursor was successfully positioned */ +bool rtr_page_get_father(mtr_t *mtr, btr_cur_t *sea_cur, btr_cur_t *cursor) + MY_ATTRIBUTE((nonnull(1,3), warn_unused_result)); /************************************************************//** Returns the father block to a page. It is assumed that mtr holds @@ -279,8 +312,6 @@ rtr_page_get_father_block( /*======================*/ rec_offs* offsets,/*!< in: work area for the return value */ mem_heap_t* heap, /*!< in: memory heap to use */ - dict_index_t* index, /*!< in: b-tree index */ - buf_block_t* block, /*!< in: child page in the index */ mtr_t* mtr, /*!< in: mtr */ btr_cur_t* sea_cur,/*!< in: search cursor, contains information about parent nodes in search */ @@ -294,7 +325,7 @@ rtr_store_parent_path( /*==================*/ const buf_block_t* block, /*!< in: block of the page */ btr_cur_t* btr_cur,/*!< in/out: persistent cursor */ - ulint latch_mode, + btr_latch_mode latch_mode, /*!< in: latch_mode */ ulint level, /*!< in: index level */ mtr_t* mtr); /*!< in: mtr */ @@ -302,21 +333,12 @@ rtr_store_parent_path( /**************************************************************//** Initializes and opens a persistent cursor to an index tree. It should be closed with btr_pcur_close. */ -void -rtr_pcur_open( - dict_index_t* index, /*!< in: index */ +bool rtr_search( const dtuple_t* tuple, /*!< in: tuple on which search done */ - page_cur_mode_t mode, /*!< in: PAGE_CUR_L, ...; - NOTE that if the search is made using a unique - prefix of a record, mode should be - PAGE_CUR_LE, not PAGE_CUR_GE, as the latter - may end up on the previous page from the - record! */ - ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */ + btr_latch_mode latch_mode,/*!< in: BTR_MODIFY_LEAF, ... */ btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ - mtr_t* mtr); /*!< in: mtr */ - -struct btr_cur_t; + mtr_t* mtr) /*!< in: mtr */ + MY_ATTRIBUTE((warn_unused_result)); /*********************************************************//** Returns the R-Tree node stored in the parent search path @@ -340,9 +362,12 @@ rtr_get_parent_cursor( ulint level, /*!< in: index level of buffer page */ ulint is_insert); /*!< in: whether insert operation */ +MY_ATTRIBUTE((warn_unused_result)) /*************************************************************//** -Copy recs from a page to new_block of rtree. */ -void +Copy recs from a page to new_block of rtree. + +@return error code */ +dberr_t rtr_page_copy_rec_list_end_no_locks( /*================================*/ buf_block_t* new_block, /*!< in: index page to copy to */ @@ -355,9 +380,12 @@ rtr_page_copy_rec_list_end_no_locks( ulint* num_moved, /*!< out: num of rec to move */ mtr_t* mtr); /*!< in: mtr */ +MY_ATTRIBUTE((warn_unused_result)) /*************************************************************//** -Copy recs till a specified rec from a page to new_block of rtree. */ -void +Copy recs till a specified rec from a page to new_block of rtree. + +@return error code */ +dberr_t rtr_page_copy_rec_list_start_no_locks( /*==================================*/ buf_block_t* new_block, /*!< in: index page to copy to */ @@ -372,7 +400,7 @@ rtr_page_copy_rec_list_start_no_locks( /****************************************************************//** Merge 2 mbrs and update the the mbr that cursor is on. */ -dberr_t +void rtr_merge_and_update_mbr( /*=====================*/ btr_cur_t* cursor, /*!< in/out: cursor */ @@ -404,9 +432,8 @@ rtr_merge_mbr_changed( /**************************************************************//** -Update the mbr field of a spatial index row. -@return true if successful */ -bool +Update the mbr field of a spatial index row. */ +void rtr_update_mbr_field( /*=================*/ btr_cur_t* cursor, /*!< in: cursor pointed to rec.*/ @@ -430,7 +457,6 @@ rtr_check_same_block( btr_cur_t* cur, /*!< in/out: position at the parent entry pointing to the child if successful */ buf_block_t* parentb,/*!< in: parent page to check */ - buf_block_t* childb, /*!< in: child Page */ mem_heap_t* heap); /*!< in: memory heap */ /*********************************************************************//** @@ -483,5 +509,5 @@ rtr_estimate_n_rows_in_range( const dtuple_t* tuple, page_cur_mode_t mode); -#include "gis0rtree.ic" +#include "gis0rtree.inl" #endif /*!< gis0rtree.h */ diff --git a/storage/innobase/include/gis0rtree.ic b/storage/innobase/include/gis0rtree.ic deleted file mode 100644 index 2564df7e0d610..0000000000000 --- a/storage/innobase/include/gis0rtree.ic +++ /dev/null @@ -1,242 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, 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 02110-1335 USA - -*****************************************************************************/ - -/******************************************************************//** -@file include gis0rtree.h -R-tree Inline code - -Created 2013/03/27 Jimmy Yang and Allen Lai -***********************************************************************/ - -/**************************************************************//** -Sets the child node mbr in a node pointer. */ -UNIV_INLINE -void -rtr_page_cal_mbr( -/*=============*/ - const dict_index_t* index, /*!< in: index */ - const buf_block_t* block, /*!< in: buffer block */ - rtr_mbr_t* rtr_mbr,/*!< out: MBR encapsulates the page */ - mem_heap_t* heap) /*!< in: heap for the memory - allocation */ -{ - page_t* page; - rec_t* rec; - const byte* field; - ulint len; - rec_offs* offsets = NULL; - double bmin, bmax; - double* amin; - double* amax; - ulint inc = 0; - double* mbr; - - rtr_mbr->xmin = DBL_MAX; - rtr_mbr->ymin = DBL_MAX; - rtr_mbr->xmax = -DBL_MAX; - rtr_mbr->ymax = -DBL_MAX; - - mbr = reinterpret_cast(rtr_mbr); - - page = buf_block_get_frame(block); - - rec = page_rec_get_next(page_get_infimum_rec(page)); - offsets = rec_get_offsets(rec, index, offsets, page_is_leaf(page) - ? index->n_fields : 0, - ULINT_UNDEFINED, &heap); - - do { - /* The mbr address is in the first field. */ - field = rec_get_nth_field(rec, offsets, 0, &len); - - ut_ad(len == DATA_MBR_LEN); - inc = 0; - for (unsigned i = 0; i < SPDIMS; i++) { - bmin = mach_double_read(field + inc); - bmax = mach_double_read(field + inc + sizeof(double)); - - amin = mbr + i * SPDIMS; - amax = mbr + i * SPDIMS + 1; - - if (*amin > bmin) - *amin = bmin; - if (*amax < bmax) - *amax = bmax; - - inc += 2 * sizeof(double); - } - - rec = page_rec_get_next(rec); - - if (rec == NULL) { - break; - } - } while (!page_rec_is_supremum(rec)); -} - -/**************************************************************//** -push a nonleaf index node to the search path */ -UNIV_INLINE -void -rtr_non_leaf_stack_push( -/*====================*/ - rtr_node_path_t* path, /*!< in/out: search path */ - uint32_t pageno, /*!< in: pageno to insert */ - node_seq_t seq_no, /*!< in: Node sequence num */ - ulint level, /*!< in: index page level */ - uint32_t child_no, /*!< in: child page no */ - btr_pcur_t* cursor, /*!< in: position cursor */ - double mbr_inc) /*!< in: MBR needs to be - enlarged */ -{ - node_visit_t insert_val; - - insert_val.page_no = pageno; - insert_val.seq_no = seq_no; - insert_val.level = level; - insert_val.child_no = child_no; - insert_val.cursor = cursor; - insert_val.mbr_inc = mbr_inc; - - path->push_back(insert_val); - -#ifdef RTR_SEARCH_DIAGNOSTIC - fprintf(stderr, "INNODB_RTR: Push page %d, level %d, seq %d" - " to search stack \n", - static_cast(pageno), static_cast(level), - static_cast(seq_no)); -#endif /* RTR_SEARCH_DIAGNOSTIC */ -} - -/*********************************************************************//** -Sets pointer to the data and length in a field. */ -UNIV_INLINE -void -rtr_write_mbr( -/*==========*/ - byte* data, /*!< out: data */ - const rtr_mbr_t* mbr) /*!< in: data */ -{ - const double* my_mbr = reinterpret_cast(mbr); - - for (unsigned i = 0; i < SPDIMS * 2; i++) { - mach_double_write(data + i * sizeof(double), my_mbr[i]); - } -} - -/*********************************************************************//** -Sets pointer to the data and length in a field. */ -UNIV_INLINE -void -rtr_read_mbr( -/*==========*/ - const byte* data, /*!< in: data */ - rtr_mbr_t* mbr) /*!< out: MBR */ -{ - for (unsigned i = 0; i < SPDIMS * 2; i++) { - (reinterpret_cast(mbr))[i] = mach_double_read( - data - + i * sizeof(double)); - } -} - -/*********************************************************//** -Returns the R-Tree node stored in the parent search path -@return pointer to R-Tree cursor component in the parent path, -NULL if parent path is empty or index is larger than num of items contained */ -UNIV_INLINE -node_visit_t* -rtr_get_parent_node( -/*================*/ - btr_cur_t* btr_cur, /*!< in: persistent cursor */ - ulint level, /*!< in: index level of buffer page */ - ulint is_insert) /*!< in: whether it is insert */ -{ - ulint num; - ulint tree_height = btr_cur->tree_height; - node_visit_t* found_node = NULL; - - if (level >= tree_height) { - return(NULL); - } - - mysql_mutex_lock(&btr_cur->rtr_info->rtr_path_mutex); - - num = btr_cur->rtr_info->parent_path->size(); - - if (!num) { - mysql_mutex_unlock(&btr_cur->rtr_info->rtr_path_mutex); - return(NULL); - } - - if (is_insert) { - ulint idx = tree_height - level - 1; - ut_ad(idx < num); - - found_node = &(*btr_cur->rtr_info->parent_path)[idx]; - } else { - node_visit_t* node; - - while (num > 0) { - node = &(*btr_cur->rtr_info->parent_path)[num - 1]; - - if (node->level == level) { - found_node = node; - break; - } - num--; - } - } - - mysql_mutex_unlock(&btr_cur->rtr_info->rtr_path_mutex); - - return(found_node); -} - -/*********************************************************//** -Returns the R-Tree cursor stored in the parent search path -@return pointer to R-Tree cursor component */ -UNIV_INLINE -btr_pcur_t* -rtr_get_parent_cursor( -/*==================*/ - btr_cur_t* btr_cur, /*!< in: persistent cursor */ - ulint level, /*!< in: index level of buffer page */ - ulint is_insert) /*!< in: whether insert operation */ -{ - node_visit_t* found_node = rtr_get_parent_node( - btr_cur, level, is_insert); - - return((found_node) ? found_node->cursor : NULL); -} - -/********************************************************************//** -Reinitialize a R-Tree search info in btr_cur_t */ -UNIV_INLINE -void -rtr_info_reinit_in_cursor( -/************************/ - btr_cur_t* cursor, /*!< in/out: tree cursor */ - dict_index_t* index, /*!< in: index struct */ - bool need_prdt) /*!< in: Whether predicate lock is - needed */ -{ - rtr_clean_rtr_info(cursor->rtr_info, false); - rtr_init_rtr_info(cursor->rtr_info, need_prdt, cursor, index, true); -} diff --git a/storage/innobase/include/gis0rtree.inl b/storage/innobase/include/gis0rtree.inl new file mode 100644 index 0000000000000..5101eeb6f7ace --- /dev/null +++ b/storage/innobase/include/gis0rtree.inl @@ -0,0 +1,245 @@ +/***************************************************************************** + +Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, 2021, 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 02110-1335 USA + +*****************************************************************************/ + +/******************************************************************//** +@file include gis0rtree.h +R-tree Inline code + +Created 2013/03/27 Jimmy Yang and Allen Lai +***********************************************************************/ + +/**************************************************************//** +Sets the child node mbr in a node pointer. */ +UNIV_INLINE +void +rtr_page_cal_mbr( +/*=============*/ + const dict_index_t* index, /*!< in: index */ + const buf_block_t* block, /*!< in: buffer block */ + rtr_mbr_t* rtr_mbr,/*!< out: MBR encapsulates the page */ + mem_heap_t* heap) /*!< in: heap for the memory + allocation */ +{ + page_t* page; + rec_t* rec; + const byte* field; + ulint len; + rec_offs* offsets = NULL; + double bmin, bmax; + double* amin; + double* amax; + ulint inc = 0; + double* mbr; + + rtr_mbr->xmin = DBL_MAX; + rtr_mbr->ymin = DBL_MAX; + rtr_mbr->xmax = -DBL_MAX; + rtr_mbr->ymax = -DBL_MAX; + + mbr = reinterpret_cast(rtr_mbr); + + page = buf_block_get_frame(block); + + rec = page_rec_get_next(page_get_infimum_rec(page)); + if (UNIV_UNLIKELY(!rec)) { + return; + } + offsets = rec_get_offsets(rec, index, offsets, page_is_leaf(page) + ? index->n_fields : 0, + ULINT_UNDEFINED, &heap); + + do { + /* The mbr address is in the first field. */ + field = rec_get_nth_field(rec, offsets, 0, &len); + + ut_ad(len == DATA_MBR_LEN); + inc = 0; + for (unsigned i = 0; i < SPDIMS; i++) { + bmin = mach_double_read(field + inc); + bmax = mach_double_read(field + inc + sizeof(double)); + + amin = mbr + i * SPDIMS; + amax = mbr + i * SPDIMS + 1; + + if (*amin > bmin) + *amin = bmin; + if (*amax < bmax) + *amax = bmax; + + inc += 2 * sizeof(double); + } + + rec = page_rec_get_next(rec); + + if (rec == NULL) { + break; + } + } while (!page_rec_is_supremum(rec)); +} + +/**************************************************************//** +push a nonleaf index node to the search path */ +UNIV_INLINE +void +rtr_non_leaf_stack_push( +/*====================*/ + rtr_node_path_t* path, /*!< in/out: search path */ + uint32_t pageno, /*!< in: pageno to insert */ + node_seq_t seq_no, /*!< in: Node sequence num */ + ulint level, /*!< in: index page level */ + uint32_t child_no, /*!< in: child page no */ + btr_pcur_t* cursor, /*!< in: position cursor */ + double mbr_inc) /*!< in: MBR needs to be + enlarged */ +{ + node_visit_t insert_val; + + insert_val.page_no = pageno; + insert_val.seq_no = seq_no; + insert_val.level = level; + insert_val.child_no = child_no; + insert_val.cursor = cursor; + insert_val.mbr_inc = mbr_inc; + + path->push_back(insert_val); + +#ifdef RTR_SEARCH_DIAGNOSTIC + fprintf(stderr, "INNODB_RTR: Push page %d, level %d, seq %d" + " to search stack \n", + static_cast(pageno), static_cast(level), + static_cast(seq_no)); +#endif /* RTR_SEARCH_DIAGNOSTIC */ +} + +/*********************************************************************//** +Sets pointer to the data and length in a field. */ +UNIV_INLINE +void +rtr_write_mbr( +/*==========*/ + byte* data, /*!< out: data */ + const rtr_mbr_t* mbr) /*!< in: data */ +{ + const double* my_mbr = reinterpret_cast(mbr); + + for (unsigned i = 0; i < SPDIMS * 2; i++) { + mach_double_write(data + i * sizeof(double), my_mbr[i]); + } +} + +/*********************************************************************//** +Sets pointer to the data and length in a field. */ +UNIV_INLINE +void +rtr_read_mbr( +/*==========*/ + const byte* data, /*!< in: data */ + rtr_mbr_t* mbr) /*!< out: MBR */ +{ + for (unsigned i = 0; i < SPDIMS * 2; i++) { + (reinterpret_cast(mbr))[i] = mach_double_read( + data + + i * sizeof(double)); + } +} + +/*********************************************************//** +Returns the R-Tree node stored in the parent search path +@return pointer to R-Tree cursor component in the parent path, +NULL if parent path is empty or index is larger than num of items contained */ +UNIV_INLINE +node_visit_t* +rtr_get_parent_node( +/*================*/ + btr_cur_t* btr_cur, /*!< in: persistent cursor */ + ulint level, /*!< in: index level of buffer page */ + ulint is_insert) /*!< in: whether it is insert */ +{ + ulint num; + ulint tree_height = btr_cur->tree_height; + node_visit_t* found_node = NULL; + + if (level >= tree_height) { + return(NULL); + } + + mysql_mutex_lock(&btr_cur->rtr_info->rtr_path_mutex); + + num = btr_cur->rtr_info->parent_path->size(); + + if (!num) { + mysql_mutex_unlock(&btr_cur->rtr_info->rtr_path_mutex); + return(NULL); + } + + if (is_insert) { + ulint idx = tree_height - level - 1; + ut_ad(idx < num); + + found_node = &(*btr_cur->rtr_info->parent_path)[idx]; + } else { + node_visit_t* node; + + while (num > 0) { + node = &(*btr_cur->rtr_info->parent_path)[num - 1]; + + if (node->level == level) { + found_node = node; + break; + } + num--; + } + } + + mysql_mutex_unlock(&btr_cur->rtr_info->rtr_path_mutex); + + return(found_node); +} + +/*********************************************************//** +Returns the R-Tree cursor stored in the parent search path +@return pointer to R-Tree cursor component */ +UNIV_INLINE +btr_pcur_t* +rtr_get_parent_cursor( +/*==================*/ + btr_cur_t* btr_cur, /*!< in: persistent cursor */ + ulint level, /*!< in: index level of buffer page */ + ulint is_insert) /*!< in: whether insert operation */ +{ + node_visit_t* found_node = rtr_get_parent_node( + btr_cur, level, is_insert); + + return((found_node) ? found_node->cursor : NULL); +} + +/********************************************************************//** +Reinitialize a R-Tree search info in btr_cur_t */ +UNIV_INLINE +void +rtr_info_reinit_in_cursor( +/************************/ + btr_cur_t* cursor, /*!< in/out: tree cursor */ + dict_index_t* index, /*!< in: index struct */ + bool need_prdt) /*!< in: Whether predicate lock is + needed */ +{ + rtr_clean_rtr_info(cursor->rtr_info, false); + rtr_init_rtr_info(cursor->rtr_info, need_prdt, cursor, index, true); +} diff --git a/storage/innobase/include/gis0type.h b/storage/innobase/include/gis0type.h index 4fccfdb6c2632..d6a4ef67a3855 100644 --- a/storage/innobase/include/gis0type.h +++ b/storage/innobase/include/gis0type.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2020, MariaDB Corporation. +Copyright (c) 2018, 2023, 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 @@ -105,12 +105,6 @@ typedef struct rtr_info{ matched_rec_t* matches;/*!< struct holding matching leaf records */ mysql_mutex_t rtr_path_mutex; /*!< mutex protect the "path" vector */ - buf_block_t* tree_blocks[RTR_MAX_LEVELS + RTR_LEAF_LATCH_NUM]; - /*!< tracking pages that would be locked - at leaf level, for future free */ - ulint tree_savepoints[RTR_MAX_LEVELS + RTR_LEAF_LATCH_NUM]; - /*!< savepoint used to release latches/blocks - on each level and leaf level */ rtr_mbr_t mbr; /*!< the search MBR */ que_thr_t* thr; /*!< the search thread */ mem_heap_t* heap; /*!< memory heap */ diff --git a/storage/innobase/include/ha0ha.h b/storage/innobase/include/ha0ha.h index 561c322521e60..5aaa559b88568 100644 --- a/storage/innobase/include/ha0ha.h +++ b/storage/innobase/include/ha0ha.h @@ -54,7 +54,7 @@ struct ha_node_t { const rec_t* data; /*!< pointer to the data */ }; -#include "ha0ha.ic" +#include "ha0ha.inl" #endif /* BTR_CUR_HASH_ADAPT */ #endif diff --git a/storage/innobase/include/ha0ha.ic b/storage/innobase/include/ha0ha.inl similarity index 100% rename from storage/innobase/include/ha0ha.ic rename to storage/innobase/include/ha0ha.inl diff --git a/storage/innobase/include/ha0storage.h b/storage/innobase/include/ha0storage.h index db23ddc66edbb..fdf50a2ee4a6b 100644 --- a/storage/innobase/include/ha0storage.h +++ b/storage/innobase/include/ha0storage.h @@ -132,6 +132,6 @@ ha_storage_get_size( /*================*/ const ha_storage_t* storage); /*!< in: hash storage */ -#include "ha0storage.ic" +#include "ha0storage.inl" #endif /* ha0storage_h */ diff --git a/storage/innobase/include/ha0storage.ic b/storage/innobase/include/ha0storage.inl similarity index 100% rename from storage/innobase/include/ha0storage.ic rename to storage/innobase/include/ha0storage.inl diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h index 2dd7c5713866e..d5239ec3f9a32 100644 --- a/storage/innobase/include/ha_prototypes.h +++ b/storage/innobase/include/ha_prototypes.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -139,15 +139,6 @@ at least ENUM and SET, and unsigned integer types are 'unsigned types' uint8_t get_innobase_type_from_mysql_type(unsigned *unsigned_flag, const Field *field); -/******************************************************************//** -Get the variable length bounds of the given character set. */ -void -innobase_get_cset_width( -/*====================*/ - ulint cset, /*!< in: MySQL charset-collation code */ - unsigned*mbminlen, /*!< out: minimum length of a char (in bytes) */ - unsigned*mbmaxlen); /*!< out: maximum length of a char (in bytes) */ - /******************************************************************//** Compares NUL-terminated UTF-8 strings case insensitively. @return 0 if a=b, <0 if a1 if a>b */ @@ -208,13 +199,6 @@ but can be used for comparison. extern "C" unsigned long long thd_start_utime(const MYSQL_THD thd); -/** - Indicate the start of an async operation in a foreground thread. -@param thd current_thd -@return thd -@retval nullptr if this is not a foreground thread */ -THD *innodb_thd_increment_pending_ops(THD *thd); - /** Determines the current SQL statement. Thread unsafe, can only be called from the thread owning the THD. @param[in] thd MySQL thread handle @@ -469,15 +453,24 @@ normalize_table_name_c_low( @return new MYSQL_THD */ MYSQL_THD innobase_create_background_thd(const char* name); -/** Destroy a background purge thread THD. +/** Destroy a THD object associated with a background task. @param[in] thd MYSQL_THD to destroy */ -void -innobase_destroy_background_thd(MYSQL_THD); +void destroy_background_thd(MYSQL_THD thd); /** Close opened tables, free memory, delete items for a MYSQL_THD. @param[in] thd MYSQL_THD to reset */ void innobase_reset_background_thd(MYSQL_THD); +#ifdef WITH_WSREP +/** Append table-level exclusive key. +@param thd MySQL thread handle +@param table table +@retval false on success +@retval true on failure */ +struct dict_table_t; +bool wsrep_append_table_key(MYSQL_THD thd, const dict_table_t &table); +#endif /* WITH_WSREP */ + #endif /* !UNIV_INNOCHECKSUM */ #endif /* HA_INNODB_PROTOTYPES_H */ diff --git a/storage/innobase/include/hash0hash.h b/storage/innobase/include/hash0hash.h index a732c17f7672a..6eb5bb3f18394 100644 --- a/storage/innobase/include/hash0hash.h +++ b/storage/innobase/include/hash0hash.h @@ -94,29 +94,6 @@ do {\ }\ } while (0) -/*******************************************************************//** -Inserts a struct to the head of hash table. */ - -#define HASH_PREPEND(TYPE, NAME, TABLE, FOLD, DATA) \ -do { \ - hash_cell_t* cell3333; \ - TYPE* struct3333; \ - \ - (DATA)->NAME = NULL; \ - \ - cell3333 = &(TABLE)->array[(TABLE)->calc_hash(FOLD)]; \ - \ - if (cell3333->node == NULL) { \ - cell3333->node = DATA; \ - DATA->NAME = NULL; \ - } else { \ - struct3333 = (TYPE*) cell3333->node; \ - \ - DATA->NAME = struct3333; \ - \ - cell3333->node = DATA; \ - } \ -} while (0) #ifdef UNIV_HASH_DEBUG # define HASH_ASSERT_VALID(DATA) ut_a((void*) (DATA) != (void*) -1) # define HASH_INVALIDATE(DATA, NAME) *(void**) (&DATA->NAME) = (void*) -1 diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h index 3ffa9facdbf31..c246b2ef513ec 100644 --- a/storage/innobase/include/ibuf0ibuf.h +++ b/storage/innobase/include/ibuf0ibuf.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2021, MariaDB Corporation. +Copyright (c) 2016, 2022, 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 @@ -30,7 +30,6 @@ Created 7/19/1997 Heikki Tuuri #include "mtr0mtr.h" #include "dict0mem.h" #include "fsp0fsp.h" -#include "ibuf0types.h" /** Default value for maximum on-disk size of change buffer in terms of percentage of the buffer pool. */ @@ -61,6 +60,37 @@ enum ibuf_use_t { /** Operations that can currently be buffered. */ extern ulong innodb_change_buffering; +/** Insert buffer struct */ +struct ibuf_t{ + Atomic_relaxed size; /*!< current size of the ibuf index + tree, in pages */ + Atomic_relaxed max_size; /*!< recommended maximum size of the + ibuf index tree, in pages */ + ulint seg_size; /*!< allocated pages of the file + segment containing ibuf header and + tree */ + bool empty; /*!< Protected by the page + latch of the root page of the + insert buffer tree + (FSP_IBUF_TREE_ROOT_PAGE_NO). true + if and only if the insert + buffer tree is empty. */ + ulint free_list_len; /*!< length of the free list */ + ulint height; /*!< tree height */ + dict_index_t* index; /*!< insert buffer index */ + + /** number of pages merged */ + Atomic_counter n_merges; + Atomic_counter n_merged_ops[IBUF_OP_COUNT]; + /*!< number of operations of each type + merged to index pages */ + Atomic_counter n_discarded_ops[IBUF_OP_COUNT]; + /*!< number of operations of each type + discarded without merging due to the + tablespace being deleted or the + index being dropped */ +}; + /** The insert buffer control structure */ extern ibuf_t ibuf; @@ -264,7 +294,6 @@ ibuf_page_low( MY_ATTRIBUTE((warn_unused_result)); #ifdef UNIV_DEBUG - /** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages. Must not be called when recv_no_ibuf_operations==true. @param[in] page_id tablespace/page identifier @@ -274,7 +303,7 @@ Must not be called when recv_no_ibuf_operations==true. # define ibuf_page(page_id, zip_size, mtr) \ ibuf_page_low(page_id, zip_size, true, mtr) -#else /* UVIV_DEBUG */ +#else /* UNIV_DEBUG */ /** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages. Must not be called when recv_no_ibuf_operations==true. @@ -285,7 +314,7 @@ Must not be called when recv_no_ibuf_operations==true. # define ibuf_page(page_id, zip_size, mtr) \ ibuf_page_low(page_id, zip_size, mtr) -#endif /* UVIV_DEBUG */ +#endif /* UNIV_DEBUG */ /***********************************************************************//** Frees excess pages from the ibuf free list. This function is called when an OS thread calls fsp services to allocate a new file segment, or a new page to a @@ -327,20 +356,22 @@ exist entries for such a page if the page belonged to an index which subsequently was dropped. @param block X-latched page to try to apply changes to, or NULL to discard @param page_id page identifier -@param zip_size ROW_FORMAT=COMPRESSED page size, or 0 */ -void ibuf_merge_or_delete_for_page(buf_block_t *block, const page_id_t page_id, - ulint zip_size); +@param zip_size ROW_FORMAT=COMPRESSED page size, or 0 +@return error code */ +dberr_t ibuf_merge_or_delete_for_page(buf_block_t *block, + const page_id_t page_id, + ulint zip_size); /** Delete all change buffer entries for a tablespace, -in DISCARD TABLESPACE, IMPORT TABLESPACE, or crash recovery. +in DISCARD TABLESPACE, IMPORT TABLESPACE, or read-ahead. @param[in] space missing or to-be-discarded tablespace */ void ibuf_delete_for_discarded_space(uint32_t space); /** Contract the change buffer by reading pages to the buffer pool. @return a lower limit for the combined size in bytes of entries which -will be merged from ibuf trees to the pages read, 0 if ibuf is -empty */ -ulint ibuf_merge_all(); +will be merged from ibuf trees to the pages read +@retval 0 if ibuf.empty */ +ulint ibuf_contract(); /** Contracts insert buffer trees by reading pages referring to space_id to the buffer pool. @@ -383,13 +414,11 @@ ibuf_close(void); dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) MY_ATTRIBUTE((nonnull, warn_unused_result)); -/** Updates free bits and buffered bits for bulk loaded page. -@param[in] block index page -@param]in] reset flag if reset free val */ -void -ibuf_set_bitmap_for_bulk_load( - buf_block_t* block, - bool reset); +/** Update free bits and buffered bits for bulk loaded page. +@param block secondary index leaf page +@param mtr mini-transaction +@param reset whether the page is full */ +void ibuf_set_bitmap_for_bulk_load(buf_block_t *block, mtr_t *mtr, bool reset); #define IBUF_HEADER_PAGE_NO FSP_IBUF_HEADER_PAGE_NO #define IBUF_TREE_ROOT_PAGE_NO FSP_IBUF_TREE_ROOT_PAGE_NO @@ -402,6 +431,6 @@ for the file segment from which the pages for the ibuf tree are allocated */ /* The insert buffer tree itself is always located in space 0. */ #define IBUF_SPACE_ID static_cast(0) -#include "ibuf0ibuf.ic" +#include "ibuf0ibuf.inl" #endif diff --git a/storage/innobase/include/ibuf0ibuf.ic b/storage/innobase/include/ibuf0ibuf.ic deleted file mode 100644 index 2c2620511c7ac..0000000000000 --- a/storage/innobase/include/ibuf0ibuf.ic +++ /dev/null @@ -1,307 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1997, 2015, 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 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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/ibuf0ibuf.ic -Insert buffer - -Created 7/19/1997 Heikki Tuuri -*******************************************************/ - -#include "page0page.h" -#include "page0zip.h" -#include "fsp0types.h" -#include "buf0lru.h" - -/** An index page must contain at least srv_page_size / -IBUF_PAGE_SIZE_PER_FREE_SPACE bytes of free space for ibuf to try to -buffer inserts to this page. If there is this much of free space, the -corresponding bits are set in the ibuf bitmap. */ -#define IBUF_PAGE_SIZE_PER_FREE_SPACE 32 - -/***************************************************************//** -Starts an insert buffer mini-transaction. */ -UNIV_INLINE -void -ibuf_mtr_start( -/*===========*/ - mtr_t* mtr) /*!< out: mini-transaction */ -{ - mtr_start(mtr); - mtr->enter_ibuf(); - - if (high_level_read_only || srv_read_only_mode) { - mtr_set_log_mode(mtr, MTR_LOG_NO_REDO); - } - -} -/***************************************************************//** -Commits an insert buffer mini-transaction. */ -UNIV_INLINE -void -ibuf_mtr_commit( -/*============*/ - mtr_t* mtr) /*!< in/out: mini-transaction */ -{ - ut_ad(mtr->is_inside_ibuf()); - ut_d(mtr->exit_ibuf()); - - mtr_commit(mtr); -} - -/** Insert buffer struct */ -struct ibuf_t{ - ulint size; /*!< current size of the ibuf index - tree, in pages */ - ulint max_size; /*!< recommended maximum size of the - ibuf index tree, in pages */ - ulint seg_size; /*!< allocated pages of the file - segment containing ibuf header and - tree */ - bool empty; /*!< Protected by the page - latch of the root page of the - insert buffer tree - (FSP_IBUF_TREE_ROOT_PAGE_NO). true - if and only if the insert - buffer tree is empty. */ - ulint free_list_len; /*!< length of the free list */ - ulint height; /*!< tree height */ - dict_index_t* index; /*!< insert buffer index */ - - /** number of pages merged */ - Atomic_counter n_merges; - Atomic_counter n_merged_ops[IBUF_OP_COUNT]; - /*!< number of operations of each type - merged to index pages */ - Atomic_counter n_discarded_ops[IBUF_OP_COUNT]; - /*!< number of operations of each type - discarded without merging due to the - tablespace being deleted or the - index being dropped */ -}; - -/************************************************************************//** -Sets the free bit of the page in the ibuf bitmap. This is done in a separate -mini-transaction, hence this operation does not restrict further work to only -ibuf bitmap operations, which would result if the latch to the bitmap page -were kept. */ -void -ibuf_set_free_bits_func( -/*====================*/ - buf_block_t* block, /*!< in: index page of a non-clustered index; - free bit is reset if page level is 0 */ -#ifdef UNIV_IBUF_DEBUG - ulint max_val,/*!< in: ULINT_UNDEFINED or a maximum - value which the bits must have before - setting; this is for debugging */ -#endif /* UNIV_IBUF_DEBUG */ - ulint val); /*!< in: value to set: < 4 */ -#ifdef UNIV_IBUF_DEBUG -# define ibuf_set_free_bits(b,v,max) ibuf_set_free_bits_func(b,max,v) -#else /* UNIV_IBUF_DEBUG */ -# define ibuf_set_free_bits(b,v,max) ibuf_set_free_bits_func(b,v) -#endif /* UNIV_IBUF_DEBUG */ - -/**********************************************************************//** -A basic partial test if an insert to the insert buffer could be possible and -recommended. */ -UNIV_INLINE -ibool -ibuf_should_try( -/*============*/ - dict_index_t* index, /*!< in: index where to insert */ - ulint ignore_sec_unique) /*!< in: if != 0, we should - ignore UNIQUE constraint on - a secondary index when we - decide */ -{ - return(innodb_change_buffering - && ibuf.max_size != 0 - && !dict_index_is_clust(index) - && !dict_index_is_spatial(index) - && index->table->quiesce == QUIESCE_NONE - && (ignore_sec_unique || !dict_index_is_unique(index))); -} - -/******************************************************************//** -Returns TRUE if the current OS thread is performing an insert buffer -routine. - -For instance, a read-ahead of non-ibuf pages is forbidden by threads -that are executing an insert buffer routine. -@return TRUE if inside an insert buffer routine */ -UNIV_INLINE -ibool -ibuf_inside( -/*========*/ - const mtr_t* mtr) /*!< in: mini-transaction */ -{ - return(mtr->is_inside_ibuf()); -} - -/** Translates the free space on a page to a value in the ibuf bitmap. -@param[in] page_size page size in bytes -@param[in] max_ins_size maximum insert size after reorganize for -the page -@return value for ibuf bitmap bits */ -UNIV_INLINE -ulint -ibuf_index_page_calc_free_bits( - ulint page_size, - ulint max_ins_size) -{ - ulint n; - ut_ad(ut_is_2pow(page_size)); - ut_ad(page_size > IBUF_PAGE_SIZE_PER_FREE_SPACE); - - n = max_ins_size / (page_size / IBUF_PAGE_SIZE_PER_FREE_SPACE); - - if (n == 3) { - n = 2; - } - - if (n > 3) { - n = 3; - } - - return(n); -} - -/*********************************************************************//** -Translates the free space on a compressed page to a value in the ibuf bitmap. -@return value for ibuf bitmap bits */ -UNIV_INLINE -ulint -ibuf_index_page_calc_free_zip( -/*==========================*/ - const buf_block_t* block) /*!< in: buffer block */ -{ - ulint max_ins_size; - const page_zip_des_t* page_zip; - lint zip_max_ins; - - ut_ad(block->page.zip.data); - - /* Consider the maximum insert size on the uncompressed page - without reorganizing the page. We must not assume anything - about the compression ratio. If zip_max_ins > max_ins_size and - there is 1/4 garbage on the page, recompression after the - reorganize could fail, in theory. So, let us guarantee that - merging a buffered insert to a compressed page will always - succeed without reorganizing or recompressing the page, just - by using the page modification log. */ - max_ins_size = page_get_max_insert_size( - buf_block_get_frame(block), 1); - - page_zip = buf_block_get_page_zip(block); - zip_max_ins = page_zip_max_ins_size(page_zip, - FALSE/* not clustered */); - - if (zip_max_ins < 0) { - return(0); - } else if (max_ins_size > (ulint) zip_max_ins) { - max_ins_size = (ulint) zip_max_ins; - } - - return(ibuf_index_page_calc_free_bits(block->physical_size(), - max_ins_size)); -} - -/*********************************************************************//** -Translates the free space on a page to a value in the ibuf bitmap. -@return value for ibuf bitmap bits */ -UNIV_INLINE -ulint -ibuf_index_page_calc_free( -/*======================*/ - const buf_block_t* block) /*!< in: buffer block */ -{ - if (!block->page.zip.data) { - ulint max_ins_size; - - max_ins_size = page_get_max_insert_size_after_reorganize( - buf_block_get_frame(block), 1); - - return(ibuf_index_page_calc_free_bits( - block->physical_size(), max_ins_size)); - } else { - return(ibuf_index_page_calc_free_zip(block)); - } -} - -/************************************************************************//** -Updates the free bits of an uncompressed page in the ibuf bitmap if -there is not enough free on the page any more. This is done in a -separate mini-transaction, hence this operation does not restrict -further work to only ibuf bitmap operations, which would result if the -latch to the bitmap page were kept. NOTE: The free bits in the insert -buffer bitmap must never exceed the free space on a page. It is -unsafe to increment the bits in a separately committed -mini-transaction, because in crash recovery, the free bits could -momentarily be set too high. It is only safe to use this function for -decrementing the free bits. Should more free space become available, -we must not update the free bits here, because that would break crash -recovery. */ -UNIV_INLINE -void -ibuf_update_free_bits_if_full( -/*==========================*/ - buf_block_t* block, /*!< in: index page to which we have added new - records; the free bits are updated if the - index is non-clustered and non-unique and - the page level is 0, and the page becomes - fuller */ - ulint max_ins_size,/*!< in: value of maximum insert size with - reorganize before the latest operation - performed to the page */ - ulint increase)/*!< in: upper limit for the additional space - used in the latest operation, if known, or - ULINT_UNDEFINED */ -{ - ulint before; - ulint after; - - ut_ad(buf_block_get_page_zip(block) == NULL); - - before = ibuf_index_page_calc_free_bits( - srv_page_size, max_ins_size); - - if (max_ins_size >= increase) { - compile_time_assert(ULINT32_UNDEFINED > UNIV_PAGE_SIZE_MAX); - after = ibuf_index_page_calc_free_bits( - srv_page_size, max_ins_size - increase); -#ifdef UNIV_IBUF_DEBUG - ut_a(after <= ibuf_index_page_calc_free(block)); -#endif - } else { - after = ibuf_index_page_calc_free(block); - } - - if (after == 0) { - /* We move the page to the front of the buffer pool LRU list: - the purpose of this is to prevent those pages to which we - cannot make inserts using the insert buffer from slipping - out of the buffer pool */ - - buf_page_make_young(&block->page); - } - - if (before > after) { - ibuf_set_free_bits(block, after, before); - } -} diff --git a/storage/innobase/include/ibuf0ibuf.inl b/storage/innobase/include/ibuf0ibuf.inl new file mode 100644 index 0000000000000..003bf22a047a8 --- /dev/null +++ b/storage/innobase/include/ibuf0ibuf.inl @@ -0,0 +1,282 @@ +/***************************************************************************** + +Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2021, 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 02110-1335 USA + +*****************************************************************************/ + +/**************************************************//** +@file include/ibuf0ibuf.ic +Insert buffer + +Created 7/19/1997 Heikki Tuuri +*******************************************************/ + +#include "page0page.h" +#include "page0zip.h" +#include "fsp0types.h" +#include "buf0lru.h" + +/** An index page must contain at least srv_page_size / +IBUF_PAGE_SIZE_PER_FREE_SPACE bytes of free space for ibuf to try to +buffer inserts to this page. If there is this much of free space, the +corresponding bits are set in the ibuf bitmap. */ +#define IBUF_PAGE_SIZE_PER_FREE_SPACE 32 + +/***************************************************************//** +Starts an insert buffer mini-transaction. */ +UNIV_INLINE +void +ibuf_mtr_start( +/*===========*/ + mtr_t* mtr) /*!< out: mini-transaction */ +{ + mtr_start(mtr); + mtr->enter_ibuf(); + + if (high_level_read_only || srv_read_only_mode) { + mtr_set_log_mode(mtr, MTR_LOG_NO_REDO); + } + +} +/***************************************************************//** +Commits an insert buffer mini-transaction. */ +UNIV_INLINE +void +ibuf_mtr_commit( +/*============*/ + mtr_t* mtr) /*!< in/out: mini-transaction */ +{ + ut_ad(mtr->is_inside_ibuf()); + ut_d(mtr->exit_ibuf()); + + mtr_commit(mtr); +} + +/************************************************************************//** +Sets the free bit of the page in the ibuf bitmap. This is done in a separate +mini-transaction, hence this operation does not restrict further work to only +ibuf bitmap operations, which would result if the latch to the bitmap page +were kept. */ +void +ibuf_set_free_bits_func( +/*====================*/ + buf_block_t* block, /*!< in: index page of a non-clustered index; + free bit is reset if page level is 0 */ +#ifdef UNIV_IBUF_DEBUG + ulint max_val,/*!< in: ULINT_UNDEFINED or a maximum + value which the bits must have before + setting; this is for debugging */ +#endif /* UNIV_IBUF_DEBUG */ + ulint val); /*!< in: value to set: < 4 */ +#ifdef UNIV_IBUF_DEBUG +# define ibuf_set_free_bits(b,v,max) ibuf_set_free_bits_func(b,max,v) +#else /* UNIV_IBUF_DEBUG */ +# define ibuf_set_free_bits(b,v,max) ibuf_set_free_bits_func(b,v) +#endif /* UNIV_IBUF_DEBUG */ + +/**********************************************************************//** +A basic partial test if an insert to the insert buffer could be possible and +recommended. */ +UNIV_INLINE +ibool +ibuf_should_try( +/*============*/ + dict_index_t* index, /*!< in: index where to insert */ + ulint ignore_sec_unique) /*!< in: if != 0, we should + ignore UNIQUE constraint on + a secondary index when we + decide */ +{ + if (index->type & (DICT_CLUSTERED | DICT_IBUF | DICT_SPATIAL) || + !innodb_change_buffering || !ibuf.max_size) + return false; + if (!ignore_sec_unique && index->is_unique()) + return false; + if (index->table->quiesce != QUIESCE_NONE) + return false; + for (unsigned i= 0; i < index->n_fields; i++) + if (index->fields[i].descending) + return false; + return true; +} + +/******************************************************************//** +Returns TRUE if the current OS thread is performing an insert buffer +routine. + +For instance, a read-ahead of non-ibuf pages is forbidden by threads +that are executing an insert buffer routine. +@return TRUE if inside an insert buffer routine */ +UNIV_INLINE +ibool +ibuf_inside( +/*========*/ + const mtr_t* mtr) /*!< in: mini-transaction */ +{ + return(mtr->is_inside_ibuf()); +} + +/** Translates the free space on a page to a value in the ibuf bitmap. +@param[in] page_size page size in bytes +@param[in] max_ins_size maximum insert size after reorganize for +the page +@return value for ibuf bitmap bits */ +UNIV_INLINE +ulint +ibuf_index_page_calc_free_bits( + ulint page_size, + ulint max_ins_size) +{ + ulint n; + ut_ad(ut_is_2pow(page_size)); + ut_ad(page_size > IBUF_PAGE_SIZE_PER_FREE_SPACE); + + n = max_ins_size / (page_size / IBUF_PAGE_SIZE_PER_FREE_SPACE); + + if (n == 3) { + n = 2; + } + + if (n > 3) { + n = 3; + } + + return(n); +} + +/*********************************************************************//** +Translates the free space on a compressed page to a value in the ibuf bitmap. +@return value for ibuf bitmap bits */ +UNIV_INLINE +ulint +ibuf_index_page_calc_free_zip( +/*==========================*/ + const buf_block_t* block) /*!< in: buffer block */ +{ + ulint max_ins_size; + const page_zip_des_t* page_zip; + lint zip_max_ins; + + ut_ad(block->page.zip.data); + + /* Consider the maximum insert size on the uncompressed page + without reorganizing the page. We must not assume anything + about the compression ratio. If zip_max_ins > max_ins_size and + there is 1/4 garbage on the page, recompression after the + reorganize could fail, in theory. So, let us guarantee that + merging a buffered insert to a compressed page will always + succeed without reorganizing or recompressing the page, just + by using the page modification log. */ + max_ins_size = page_get_max_insert_size( + buf_block_get_frame(block), 1); + + page_zip = buf_block_get_page_zip(block); + zip_max_ins = page_zip_max_ins_size(page_zip, + FALSE/* not clustered */); + + if (zip_max_ins < 0) { + return(0); + } else if (max_ins_size > (ulint) zip_max_ins) { + max_ins_size = (ulint) zip_max_ins; + } + + return(ibuf_index_page_calc_free_bits(block->physical_size(), + max_ins_size)); +} + +/*********************************************************************//** +Translates the free space on a page to a value in the ibuf bitmap. +@return value for ibuf bitmap bits */ +UNIV_INLINE +ulint +ibuf_index_page_calc_free( +/*======================*/ + const buf_block_t* block) /*!< in: buffer block */ +{ + if (!block->page.zip.data) { + ulint max_ins_size; + + max_ins_size = page_get_max_insert_size_after_reorganize( + buf_block_get_frame(block), 1); + + return(ibuf_index_page_calc_free_bits( + block->physical_size(), max_ins_size)); + } else { + return(ibuf_index_page_calc_free_zip(block)); + } +} + +/************************************************************************//** +Updates the free bits of an uncompressed page in the ibuf bitmap if +there is not enough free on the page any more. This is done in a +separate mini-transaction, hence this operation does not restrict +further work to only ibuf bitmap operations, which would result if the +latch to the bitmap page were kept. NOTE: The free bits in the insert +buffer bitmap must never exceed the free space on a page. It is +unsafe to increment the bits in a separately committed +mini-transaction, because in crash recovery, the free bits could +momentarily be set too high. It is only safe to use this function for +decrementing the free bits. Should more free space become available, +we must not update the free bits here, because that would break crash +recovery. */ +UNIV_INLINE +void +ibuf_update_free_bits_if_full( +/*==========================*/ + buf_block_t* block, /*!< in: index page to which we have added new + records; the free bits are updated if the + index is non-clustered and non-unique and + the page level is 0, and the page becomes + fuller */ + ulint max_ins_size,/*!< in: value of maximum insert size with + reorganize before the latest operation + performed to the page */ + ulint increase)/*!< in: upper limit for the additional space + used in the latest operation, if known, or + ULINT_UNDEFINED */ +{ + ulint before; + ulint after; + + ut_ad(buf_block_get_page_zip(block) == NULL); + + before = ibuf_index_page_calc_free_bits( + srv_page_size, max_ins_size); + + if (max_ins_size >= increase) { + compile_time_assert(ULINT32_UNDEFINED > UNIV_PAGE_SIZE_MAX); + after = ibuf_index_page_calc_free_bits( + srv_page_size, max_ins_size - increase); +#ifdef UNIV_IBUF_DEBUG + ut_a(after <= ibuf_index_page_calc_free(block)); +#endif + } else { + after = ibuf_index_page_calc_free(block); + } + + if (after == 0) { + /* We move the page to the front of the buffer pool LRU list: + the purpose of this is to prevent those pages to which we + cannot make inserts using the insert buffer from slipping + out of the buffer pool */ + + buf_page_make_young(&block->page); + } + + if (before > after) { + ibuf_set_free_bits(block, after, before); + } +} diff --git a/storage/innobase/include/ibuf0types.h b/storage/innobase/include/ibuf0types.h deleted file mode 100644 index 6b7c47208a093..0000000000000 --- a/storage/innobase/include/ibuf0types.h +++ /dev/null @@ -1,31 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1997, 2009, 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 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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/ibuf0types.h -Insert buffer global types - -Created 7/29/1997 Heikki Tuuri -*******************************************************/ - -#ifndef ibuf0types_h -#define ibuf0types_h - -struct ibuf_t; - -#endif diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index f2b1dc488d690..16acd0311778e 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2022, Oracle and/or its affiliates. Copyright (c) 2017, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -136,6 +136,41 @@ void lock_update_root_raise(const buf_block_t &block, const page_id_t root); @param new_block the target page @param old old page (not index root page) */ void lock_update_copy_and_discard(const buf_block_t &new_block, page_id_t old); + +/** Update gap locks between the last record of the left_block and the +first record of the right_block when a record is about to be inserted +at the start of the right_block, even though it should "naturally" be +inserted as the last record of the left_block according to the +current node pointer in the parent page. + +That is, we assume that the lowest common ancestor of the left_block +and right_block routes the key of the new record to the left_block, +but a heuristic which tries to avoid overflowing left_block has chosen +to insert the record into right_block instead. Said ancestor performs +this routing by comparing the key of the record to a "split point" - +all records greater or equal to than the split point (node pointer) +are in right_block, and smaller ones in left_block. +The split point may be smaller than the smallest key in right_block. + +The gap between the last record on the left_block and the first record +on the right_block is represented as a gap lock attached to the supremum +pseudo-record of left_block, and a gap lock attached to the new first +record of right_block. + +Thus, inserting the new record, and subsequently adjusting the node +pointers in parent pages to values smaller or equal to the new +records' key, will mean that gap will be sliced at a different place +("moved to the left"): fragment of the 1st gap will now become treated +as 2nd. Therefore, we must copy any GRANTED locks from 1st gap to the +2nd gap. Any WAITING locks must be of INSERT_INTENTION type (as no +other GAP locks ever wait for anything) and can stay at 1st gap, as +their only purpose is to notify the requester they can retry +insertion, and there's no correctness requirement to avoid waking them +up too soon. +@param left_block left page +@param right_block right page */ +void lock_update_node_pointer(const buf_block_t *left_block, + const buf_block_t *right_block); /*************************************************************//** Updates the lock table when a page is split to the left. */ void @@ -374,18 +409,18 @@ lock_clust_rec_read_check_and_lock_alt( LOCK_REC_NOT_GAP */ que_thr_t* thr) /*!< in: query thread */ MY_ATTRIBUTE((warn_unused_result)); -/*********************************************************************//** -Locks the specified database table in the mode given. If the lock cannot -be granted immediately, the query thread is put to wait. -@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */ -dberr_t -lock_table( -/*=======*/ - dict_table_t* table, /*!< in/out: database table - in dictionary cache */ - lock_mode mode, /*!< in: lock mode */ - que_thr_t* thr) /*!< in: query thread */ - MY_ATTRIBUTE((warn_unused_result)); + +/** Acquire a table lock. +@param table table to be locked +@param fktable pointer to table, in case of a FOREIGN key check +@param mode lock mode +@param thr SQL execution thread +@retval DB_SUCCESS if the lock was acquired +@retval DB_DEADLOCK if a deadlock occurred, or fktable && *fktable != table +@retval DB_LOCK_WAIT if lock_wait() must be invoked */ +dberr_t lock_table(dict_table_t *table, dict_table_t *const*fktable, + lock_mode mode, que_thr_t *thr) + MY_ATTRIBUTE((warn_unused_result)); /** Create a table lock object for a resurrected transaction. @param table table to be X-locked @@ -394,15 +429,13 @@ lock_table( void lock_table_resurrect(dict_table_t *table, trx_t *trx, lock_mode mode); /** Sets a lock on a table based on the given mode. -@param[in] table table to lock -@param[in,out] trx transaction -@param[in] mode LOCK_X or LOCK_S -@return error code or DB_SUCCESS. */ -dberr_t -lock_table_for_trx( - dict_table_t* table, - trx_t* trx, - enum lock_mode mode) +@param table table to lock +@param trx transaction +@param mode LOCK_X or LOCK_S +@param no_wait whether to skip handling DB_LOCK_WAIT +@return error code */ +dberr_t lock_table_for_trx(dict_table_t *table, trx_t *trx, lock_mode mode, + bool no_wait= false) MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Exclusively lock the data dictionary tables. @@ -428,6 +461,11 @@ lock_rec_unlock( and release possible other transactions waiting because of these locks. */ void lock_release(trx_t* trx); +/** Release the explicit locks of a committing transaction while +dict_sys.latch is exclusively locked, +and release possible other transactions waiting because of these locks. */ +void lock_release_on_drop(trx_t *trx); + /** Release non-exclusive locks on XA PREPARE, and release possible other transactions waiting because of these locks. */ void lock_release_on_prepare(trx_t *trx); @@ -686,10 +724,10 @@ class lock_sys_t bool m_initialised; /** mutex proteting the locks */ - MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) srw_spin_lock latch; + alignas(CPU_LEVEL1_DCACHE_LINESIZE) srw_spin_lock latch; #ifdef UNIV_DEBUG /** The owner of exclusive latch (0 if none); protected by latch */ - std::atomic writer{0}; + std::atomic writer{0}; /** Number of shared latches */ std::atomic readers{0}; #endif @@ -709,7 +747,7 @@ class lock_sys_t hash_table prdt_page_hash; /** mutex covering lock waits; @see trx_lock_t::wait_lock */ - MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) mysql_mutex_t wait_mutex; + alignas(CPU_LEVEL1_DCACHE_LINESIZE) mysql_mutex_t wait_mutex; private: /** The increment of wait_count for a wait. Anything smaller is a pending wait count. */ @@ -753,14 +791,14 @@ class lock_sys_t mysql_mutex_assert_not_owner(&wait_mutex); ut_ad(!is_writer()); latch.wr_lock(); - ut_ad(!writer.exchange(os_thread_get_curr_id(), + ut_ad(!writer.exchange(pthread_self(), std::memory_order_relaxed)); } /** Release exclusive lock_sys.latch */ void wr_unlock() { ut_ad(writer.exchange(0, std::memory_order_relaxed) == - os_thread_get_curr_id()); + pthread_self()); latch.wr_unlock(); } /** Acquire shared lock_sys.latch */ @@ -786,7 +824,7 @@ class lock_sys_t { ut_ad(!is_writer()); if (!latch.wr_lock_try()) return false; - ut_ad(!writer.exchange(os_thread_get_curr_id(), + ut_ad(!writer.exchange(pthread_self(), std::memory_order_relaxed)); return true; } @@ -810,9 +848,9 @@ class lock_sys_t bool is_writer() const { # ifdef SUX_LOCK_GENERIC - return writer.load(std::memory_order_relaxed) == os_thread_get_curr_id(); + return writer.load(std::memory_order_relaxed) == pthread_self(); # else - return writer.load(std::memory_order_relaxed) == os_thread_get_curr_id() || + return writer.load(std::memory_order_relaxed) == pthread_self() || (xtest() && !latch.is_locked_or_waiting()); # endif } @@ -853,8 +891,8 @@ class lock_sys_t /** Cancel a waiting lock request. @tparam check_victim whether to check for DB_DEADLOCK - @param lock waiting lock request @param trx active transaction + @param lock waiting lock request @retval DB_SUCCESS if no lock existed @retval DB_DEADLOCK if trx->lock.was_chosen_as_deadlock_victim was set @retval DB_LOCK_WAIT if the lock was canceled */ @@ -915,10 +953,8 @@ class lock_sys_t @param page whether to discard also from lock_sys.prdt_hash */ void prdt_page_free_from_discard(const page_id_t id, bool all= false); -#ifdef WITH_WSREP /** Cancel possible lock waiting for a transaction */ static void cancel_lock_wait_for_trx(trx_t *trx); -#endif /* WITH_WSREP */ }; /** The lock system */ @@ -1175,10 +1211,6 @@ without checking for deadlocks or conflicts. @param[in] index the index tree @param[in,out] trx transaction @param[in] holds_trx_mutex whether the caller holds trx->mutex -@param[in] insert_before_waiting if true, inserts new B-tree record lock -just after the last non-waiting lock of the current transaction which is -located before the first waiting for the current transaction lock, otherwise -the lock is inserted at the end of the queue @return created lock */ lock_t* lock_rec_create_low( @@ -1189,8 +1221,7 @@ lock_rec_create_low( ulint heap_no, dict_index_t* index, trx_t* trx, - bool holds_trx_mutex, - bool insert_before_waiting = false); + bool holds_trx_mutex); /** Enqueue a waiting request for a lock which cannot be granted immediately. Check for deadlocks. @@ -1233,6 +1264,6 @@ lock_rtr_move_rec_list( moved */ ulint num_move); /*!< in: num of rec to move */ -#include "lock0lock.ic" +#include "lock0lock.inl" #endif diff --git a/storage/innobase/include/lock0lock.ic b/storage/innobase/include/lock0lock.ic deleted file mode 100644 index 7d08cbb930c61..0000000000000 --- a/storage/innobase/include/lock0lock.ic +++ /dev/null @@ -1,79 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, 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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/lock0lock.ic -The transaction lock system - -Created 5/7/1996 Heikki Tuuri -*******************************************************/ - -#include "dict0dict.h" -#include "buf0buf.h" -#include "page0page.h" - -/*********************************************************************//** -Gets the heap_no of the smallest user record on a page. -@return heap_no of smallest user record, or PAGE_HEAP_NO_SUPREMUM */ -UNIV_INLINE -ulint -lock_get_min_heap_no( -/*=================*/ - const buf_block_t* block) /*!< in: buffer block */ -{ - const page_t* page = block->page.frame; - - if (page_is_comp(page)) { - return(rec_get_heap_no_new( - page - + rec_get_next_offs(page + PAGE_NEW_INFIMUM, - TRUE))); - } else { - return(rec_get_heap_no_old( - page - + rec_get_next_offs(page + PAGE_OLD_INFIMUM, - FALSE))); - } -} - -/*********************************************************************//** -Creates a new record lock and inserts it to the lock queue. Does NOT check -for deadlocks or lock compatibility! -@return created lock */ -UNIV_INLINE -lock_t* -lock_rec_create( -/*============*/ - lock_t* c_lock, /*!< conflicting lock */ - unsigned type_mode,/*!< in: lock mode and wait flag */ - const buf_block_t* block, /*!< in: buffer block containing - the record */ - ulint heap_no,/*!< in: heap number of the record */ - dict_index_t* index, /*!< in: index of record */ - trx_t* trx, /*!< in,out: transaction */ - bool caller_owns_trx_mutex) - /*!< in: TRUE if caller owns - trx mutex */ -{ - btr_assert_not_corrupted(block, index); - return lock_rec_create_low( - c_lock, - type_mode, block->page.id(), block->page.frame, heap_no, - index, trx, caller_owns_trx_mutex); -} diff --git a/storage/innobase/include/lock0lock.inl b/storage/innobase/include/lock0lock.inl new file mode 100644 index 0000000000000..1b9255ffb3e0a --- /dev/null +++ b/storage/innobase/include/lock0lock.inl @@ -0,0 +1,78 @@ +/***************************************************************************** + +Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, 2022, 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 02110-1335 USA + +*****************************************************************************/ + +/**************************************************//** +@file include/lock0lock.ic +The transaction lock system + +Created 5/7/1996 Heikki Tuuri +*******************************************************/ + +#include "dict0dict.h" +#include "buf0buf.h" +#include "page0page.h" + +/*********************************************************************//** +Gets the heap_no of the smallest user record on a page. +@return heap_no of smallest user record, or PAGE_HEAP_NO_SUPREMUM */ +UNIV_INLINE +ulint +lock_get_min_heap_no( +/*=================*/ + const buf_block_t* block) /*!< in: buffer block */ +{ + const page_t* page = block->page.frame; + + if (page_is_comp(page)) { + return(rec_get_heap_no_new( + page + + rec_get_next_offs(page + PAGE_NEW_INFIMUM, + TRUE))); + } else { + return(rec_get_heap_no_old( + page + + rec_get_next_offs(page + PAGE_OLD_INFIMUM, + FALSE))); + } +} + +/*********************************************************************//** +Creates a new record lock and inserts it to the lock queue. Does NOT check +for deadlocks or lock compatibility! +@return created lock */ +UNIV_INLINE +lock_t* +lock_rec_create( +/*============*/ + lock_t* c_lock, /*!< conflicting lock */ + unsigned type_mode,/*!< in: lock mode and wait flag */ + const buf_block_t* block, /*!< in: buffer block containing + the record */ + ulint heap_no,/*!< in: heap number of the record */ + dict_index_t* index, /*!< in: index of record */ + trx_t* trx, /*!< in,out: transaction */ + bool caller_owns_trx_mutex) + /*!< in: TRUE if caller owns + trx mutex */ +{ + return lock_rec_create_low( + c_lock, + type_mode, block->page.id(), block->page.frame, heap_no, + index, trx, caller_owns_trx_mutex); +} diff --git a/storage/innobase/include/lock0priv.h b/storage/innobase/include/lock0priv.h index b5ec7a0d29e15..b0a5f7aaf3b03 100644 --- a/storage/innobase/include/lock0priv.h +++ b/storage/innobase/include/lock0priv.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2021, MariaDB Corporation. +Copyright (c) 2015, 2022, 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 @@ -577,6 +577,6 @@ lock_table_has( const dict_table_t* table, /*!< in: table */ enum lock_mode mode); /*!< in: lock mode */ -#include "lock0priv.ic" +#include "lock0priv.inl" #endif /* lock0priv_h */ diff --git a/storage/innobase/include/lock0priv.ic b/storage/innobase/include/lock0priv.ic deleted file mode 100644 index 21e7c7c95dc62..0000000000000 --- a/storage/innobase/include/lock0priv.ic +++ /dev/null @@ -1,255 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2007, 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2021, 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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/lock0priv.ic -Lock module internal inline methods. - -Created July 16, 2007 Vasil Dimov -*******************************************************/ - -/* This file contains only methods which are used in -lock/lock0* files, other than lock/lock0lock.cc. -I.e. lock/lock0lock.cc contains more internal inline -methods but they are used only in that file. */ - -#ifndef LOCK_MODULE_IMPLEMENTATION -#error Do not include lock0priv.ic outside of the lock/ module -#endif - -#include "row0row.h" - -/*********************************************************************//** -Checks if some transaction has an implicit x-lock on a record in a clustered -index. -@return transaction id of the transaction which has the x-lock, or 0 */ -UNIV_INLINE -trx_id_t -lock_clust_rec_some_has_impl( -/*=========================*/ - const rec_t* rec, /*!< in: user record */ - const dict_index_t* index, /*!< in: clustered index */ - const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */ -{ - ut_ad(dict_index_is_clust(index)); - ut_ad(page_rec_is_user_rec(rec)); - - return(row_get_rec_trx_id(rec, index, offsets)); -} - -/*********************************************************************//** -Gets the number of bits in a record lock bitmap. -@return number of bits */ -UNIV_INLINE -ulint -lock_rec_get_n_bits( -/*================*/ - const lock_t* lock) /*!< in: record lock */ -{ - return(lock->un_member.rec_lock.n_bits); -} - -/**********************************************************************//** -Sets the nth bit of a record lock to TRUE. */ -inline -void -lock_rec_set_nth_bit( -/*=================*/ - lock_t* lock, /*!< in: record lock */ - ulint i) /*!< in: index of the bit */ -{ - ulint byte_index; - ulint bit_index; - - ut_ad(!lock->is_table()); - ut_ad(i < lock->un_member.rec_lock.n_bits); - - byte_index = i / 8; - bit_index = i % 8; - -#if defined __GNUC__ && !defined __clang__ && __GNUC__ < 6 -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wconversion" /* GCC 4 and 5 need this here */ -#endif - ((byte*) &lock[1])[byte_index] |= static_cast(1 << bit_index); -#if defined __GNUC__ && !defined __clang__ && __GNUC__ < 6 -# pragma GCC diagnostic pop -#endif -#ifdef SUX_LOCK_GENERIC - ut_ad(lock_sys.is_writer() || lock->trx->mutex_is_owner()); -#else - ut_ad(lock_sys.is_writer() || lock->trx->mutex_is_owner() - || (xtest() && !lock->trx->mutex_is_locked())); -#endif - lock->trx->lock.n_rec_locks++; -} - -/*********************************************************************//** -Gets the first or next record lock on a page. -@return next lock, NULL if none exists */ -UNIV_INLINE -lock_t* -lock_rec_get_next_on_page( -/*======================*/ - lock_t* lock) /*!< in: a record lock */ -{ - return const_cast(lock_rec_get_next_on_page_const(lock)); -} - -/*********************************************************************//** -Gets the next explicit lock request on a record. -@return next lock, NULL if none exists or if heap_no == ULINT_UNDEFINED */ -UNIV_INLINE -lock_t* -lock_rec_get_next( -/*==============*/ - ulint heap_no,/*!< in: heap number of the record */ - lock_t* lock) /*!< in: lock */ -{ - do { - lock = lock_rec_get_next_on_page(lock); - } while (lock && !lock_rec_get_nth_bit(lock, heap_no)); - - return(lock); -} - -/*********************************************************************//** -Gets the next explicit lock request on a record. -@return next lock, NULL if none exists or if heap_no == ULINT_UNDEFINED */ -UNIV_INLINE -const lock_t* -lock_rec_get_next_const( -/*====================*/ - ulint heap_no,/*!< in: heap number of the record */ - const lock_t* lock) /*!< in: lock */ -{ - return lock_rec_get_next(heap_no, const_cast(lock)); -} - -/*********************************************************************//** -Gets the nth bit of a record lock. -@return TRUE if bit set also if i == ULINT_UNDEFINED return FALSE*/ -UNIV_INLINE -ibool -lock_rec_get_nth_bit( -/*=================*/ - const lock_t* lock, /*!< in: record lock */ - ulint i) /*!< in: index of the bit */ -{ - const byte* b; - - ut_ad(!lock->is_table()); - - if (i >= lock->un_member.rec_lock.n_bits) { - - return(FALSE); - } - - b = ((const byte*) &lock[1]) + (i / 8); - - return(1 & *b >> (i % 8)); -} - -/*********************************************************************//** -Gets the first or next record lock on a page. -@return next lock, NULL if none exists */ -UNIV_INLINE -const lock_t* -lock_rec_get_next_on_page_const( -/*============================*/ - const lock_t* lock) /*!< in: a record lock */ -{ - ut_ad(!lock->is_table()); - - const page_id_t page_id{lock->un_member.rec_lock.page_id}; - - while (!!(lock= static_cast(HASH_GET_NEXT(hash, lock)))) - if (lock->un_member.rec_lock.page_id == page_id) - break; - return lock; -} - -/*********************************************************************//** -Calculates if lock mode 1 is compatible with lock mode 2. -@return nonzero if mode1 compatible with mode2 */ -UNIV_INLINE -ulint -lock_mode_compatible( -/*=================*/ - enum lock_mode mode1, /*!< in: lock mode */ - enum lock_mode mode2) /*!< in: lock mode */ -{ - ut_ad((ulint) mode1 < lock_types); - ut_ad((ulint) mode2 < lock_types); - - return(lock_compatibility_matrix[mode1][mode2]); -} - -/*********************************************************************//** -Calculates if lock mode 1 is stronger or equal to lock mode 2. -@return nonzero if mode1 stronger or equal to mode2 */ -UNIV_INLINE -ulint -lock_mode_stronger_or_eq( -/*=====================*/ - enum lock_mode mode1, /*!< in: lock mode */ - enum lock_mode mode2) /*!< in: lock mode */ -{ - ut_ad((ulint) mode1 < lock_types); - ut_ad((ulint) mode2 < lock_types); - - return(lock_strength_matrix[mode1][mode2]); -} - -/*********************************************************************//** -Checks if a transaction has the specified table lock, or stronger. This -function should only be called by the thread that owns the transaction. -@return lock or NULL */ -UNIV_INLINE -const lock_t* -lock_table_has( -/*===========*/ - const trx_t* trx, /*!< in: transaction */ - const dict_table_t* table, /*!< in: table */ - lock_mode in_mode)/*!< in: lock mode */ -{ - /* Look for stronger locks the same trx already has on the table */ - - for (lock_list::const_iterator it = trx->lock.table_locks.begin(), - end = trx->lock.table_locks.end(); it != end; ++it) { - - const lock_t* lock = *it; - - if (lock == NULL) { - continue; - } - - ut_ad(trx == lock->trx); - ut_ad(lock->is_table()); - ut_ad(lock->un_member.tab_lock.table); - - if (table == lock->un_member.tab_lock.table - && lock_mode_stronger_or_eq(lock->mode(), in_mode)) { - ut_ad(!lock->is_waiting()); - return(lock); - } - } - - return(NULL); -} diff --git a/storage/innobase/include/lock0priv.inl b/storage/innobase/include/lock0priv.inl new file mode 100644 index 0000000000000..3b4ebcc835b39 --- /dev/null +++ b/storage/innobase/include/lock0priv.inl @@ -0,0 +1,255 @@ +/***************************************************************************** + +Copyright (c) 2007, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, 2022, 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 02110-1335 USA + +*****************************************************************************/ + +/**************************************************//** +@file include/lock0priv.ic +Lock module internal inline methods. + +Created July 16, 2007 Vasil Dimov +*******************************************************/ + +/* This file contains only methods which are used in +lock/lock0* files, other than lock/lock0lock.cc. +I.e. lock/lock0lock.cc contains more internal inline +methods but they are used only in that file. */ + +#ifndef LOCK_MODULE_IMPLEMENTATION +#error Do not include lock0priv.ic outside of the lock/ module +#endif + +#include "row0row.h" + +/*********************************************************************//** +Checks if some transaction has an implicit x-lock on a record in a clustered +index. +@return transaction id of the transaction which has the x-lock, or 0 */ +UNIV_INLINE +trx_id_t +lock_clust_rec_some_has_impl( +/*=========================*/ + const rec_t* rec, /*!< in: user record */ + const dict_index_t* index, /*!< in: clustered index */ + const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */ +{ + ut_ad(dict_index_is_clust(index)); + ut_ad(page_rec_is_user_rec(rec)); + + return(row_get_rec_trx_id(rec, index, offsets)); +} + +/*********************************************************************//** +Gets the number of bits in a record lock bitmap. +@return number of bits */ +UNIV_INLINE +ulint +lock_rec_get_n_bits( +/*================*/ + const lock_t* lock) /*!< in: record lock */ +{ + return(lock->un_member.rec_lock.n_bits); +} + +/**********************************************************************//** +Sets the nth bit of a record lock to TRUE. */ +inline +void +lock_rec_set_nth_bit( +/*=================*/ + lock_t* lock, /*!< in: record lock */ + ulint i) /*!< in: index of the bit */ +{ + ulint byte_index; + ulint bit_index; + + ut_ad(!lock->is_table()); + ut_ad(i < lock->un_member.rec_lock.n_bits); + + byte_index = i / 8; + bit_index = i % 8; + +#if defined __GNUC__ && !defined __clang__ && __GNUC__ < 6 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wconversion" /* GCC 4 and 5 need this here */ +#endif + ((byte*) &lock[1])[byte_index] |= static_cast(1 << bit_index); +#if defined __GNUC__ && !defined __clang__ && __GNUC__ < 6 +# pragma GCC diagnostic pop +#endif +#ifdef SUX_LOCK_GENERIC + ut_ad(lock_sys.is_writer() || lock->trx->mutex_is_owner()); +#else + ut_ad(lock_sys.is_writer() || lock->trx->mutex_is_owner() + || (xtest() && !lock->trx->mutex_is_locked())); +#endif + lock->trx->lock.n_rec_locks++; +} + +/*********************************************************************//** +Gets the first or next record lock on a page. +@return next lock, NULL if none exists */ +UNIV_INLINE +lock_t* +lock_rec_get_next_on_page( +/*======================*/ + lock_t* lock) /*!< in: a record lock */ +{ + return const_cast(lock_rec_get_next_on_page_const(lock)); +} + +/*********************************************************************//** +Gets the next explicit lock request on a record. +@return next lock, NULL if none exists or if heap_no == ULINT_UNDEFINED */ +UNIV_INLINE +lock_t* +lock_rec_get_next( +/*==============*/ + ulint heap_no,/*!< in: heap number of the record */ + lock_t* lock) /*!< in: lock */ +{ + do { + lock = lock_rec_get_next_on_page(lock); + } while (lock && !lock_rec_get_nth_bit(lock, heap_no)); + + return(lock); +} + +/*********************************************************************//** +Gets the next explicit lock request on a record. +@return next lock, NULL if none exists or if heap_no == ULINT_UNDEFINED */ +UNIV_INLINE +const lock_t* +lock_rec_get_next_const( +/*====================*/ + ulint heap_no,/*!< in: heap number of the record */ + const lock_t* lock) /*!< in: lock */ +{ + return lock_rec_get_next(heap_no, const_cast(lock)); +} + +/*********************************************************************//** +Gets the nth bit of a record lock. +@return TRUE if bit set also if i == ULINT_UNDEFINED return FALSE*/ +UNIV_INLINE +ibool +lock_rec_get_nth_bit( +/*=================*/ + const lock_t* lock, /*!< in: record lock */ + ulint i) /*!< in: index of the bit */ +{ + const byte* b; + + ut_ad(!lock->is_table()); + + if (i >= lock->un_member.rec_lock.n_bits) { + + return(FALSE); + } + + b = ((const byte*) &lock[1]) + (i / 8); + + return(1 & *b >> (i % 8)); +} + +/*********************************************************************//** +Gets the first or next record lock on a page. +@return next lock, NULL if none exists */ +UNIV_INLINE +const lock_t* +lock_rec_get_next_on_page_const( +/*============================*/ + const lock_t* lock) /*!< in: a record lock */ +{ + ut_ad(!lock->is_table()); + + const page_id_t page_id{lock->un_member.rec_lock.page_id}; + + while (!!(lock= static_cast(HASH_GET_NEXT(hash, lock)))) + if (lock->un_member.rec_lock.page_id == page_id) + break; + return lock; +} + +/*********************************************************************//** +Calculates if lock mode 1 is compatible with lock mode 2. +@return nonzero if mode1 compatible with mode2 */ +UNIV_INLINE +ulint +lock_mode_compatible( +/*=================*/ + enum lock_mode mode1, /*!< in: lock mode */ + enum lock_mode mode2) /*!< in: lock mode */ +{ + ut_ad((ulint) mode1 < lock_types); + ut_ad((ulint) mode2 < lock_types); + + return(lock_compatibility_matrix[mode1][mode2]); +} + +/*********************************************************************//** +Calculates if lock mode 1 is stronger or equal to lock mode 2. +@return nonzero if mode1 stronger or equal to mode2 */ +UNIV_INLINE +ulint +lock_mode_stronger_or_eq( +/*=====================*/ + enum lock_mode mode1, /*!< in: lock mode */ + enum lock_mode mode2) /*!< in: lock mode */ +{ + ut_ad((ulint) mode1 < lock_types); + ut_ad((ulint) mode2 < lock_types); + + return(lock_strength_matrix[mode1][mode2]); +} + +/*********************************************************************//** +Checks if a transaction has the specified table lock, or stronger. This +function should only be called by the thread that owns the transaction. +@return lock or NULL */ +UNIV_INLINE +const lock_t* +lock_table_has( +/*===========*/ + const trx_t* trx, /*!< in: transaction */ + const dict_table_t* table, /*!< in: table */ + lock_mode in_mode)/*!< in: lock mode */ +{ + /* Look for stronger locks the same trx already has on the table */ + + for (lock_list::const_iterator it = trx->lock.table_locks.begin(), + end = trx->lock.table_locks.end(); it != end; ++it) { + + const lock_t* lock = *it; + + if (lock == NULL) { + continue; + } + + ut_ad(trx == lock->trx); + ut_ad(lock->is_table()); + ut_ad(lock->un_member.tab_lock.table); + + if (table == lock->un_member.tab_lock.table + && lock_mode_stronger_or_eq(lock->mode(), in_mode)) { + ut_ad(!lock->is_waiting()); + return(lock); + } + } + + return(NULL); +} diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 618bda3b87a52..6aca809c341d5 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -37,6 +37,7 @@ Created 12/9/1995 Heikki Tuuri #include "os0file.h" #include "span.h" #include "my_atomic_wrapper.h" +#include "srw_lock.h" #include using st_::span; @@ -54,19 +55,9 @@ std::string get_log_file_path(const char *filename= LOG_FILE_NAME); static inline void delete_log_file(const char* suffix) { auto path = get_log_file_path(LOG_FILE_NAME_PREFIX).append(suffix); - os_file_delete_if_exists(innodb_log_file_key, path.c_str(), nullptr); + os_file_delete_if_exists_func(path.c_str(), nullptr); } -/** Calculate the recommended highest values for lsn - last_checkpoint_lsn -and lsn - buf_pool.get_oldest_modification(). -@param[in] file_size requested innodb_log_file_size -@retval true on success -@retval false if the smallest log is too small to -accommodate the number of OS threads in the database server */ -bool -log_set_capacity(ulonglong file_size) - MY_ATTRIBUTE((warn_unused_result)); - struct completion_callback; /** Ensure that the log has been written to the log file up to a given @@ -83,10 +74,10 @@ void log_write_up_to(lsn_t lsn, bool durable, void log_buffer_flush_to_disk(bool durable= true); -/** Prepare to invoke log_write_and_flush(), before acquiring log_sys.mutex. */ +/** Prepare to invoke log_write_and_flush(), before acquiring log_sys.latch. */ ATTRIBUTE_COLD void log_write_and_flush_prepare(); -/** Durably write the log up to log_sys.lsn() and release log_sys.mutex. */ +/** Durably write the log up to log_sys.get_lsn(). */ ATTRIBUTE_COLD void log_write_and_flush(); /** Make a checkpoint */ @@ -108,11 +99,6 @@ void log_print( /*======*/ FILE* file); /*!< in: file where to print */ -/**********************************************************************//** -Refreshes the statistics used to print per-second averages. */ -void -log_refresh_stats(void); -/*===================*/ /** Offsets of a log file header */ /* @{ */ @@ -137,10 +123,10 @@ struct log_t; class log_file_t { friend log_t; - pfs_os_file_t m_file; + os_file_t m_file{OS_FILE_CLOSED}; public: log_file_t()= default; - log_file_t(pfs_os_file_t file) noexcept : m_file(file) {} + log_file_t(os_file_t file) noexcept : m_file(file) {} /** Open a file @return file size in bytes @@ -150,7 +136,7 @@ class log_file_t dberr_t close() noexcept; dberr_t read(os_offset_t offset, span buf) noexcept; - dberr_t write(os_offset_t offset, span buf) noexcept; + void write(os_offset_t offset, span buf) noexcept; bool flush() const noexcept { return os_file_flush(m_file); } #ifdef HAVE_PMEM byte *mmap(bool read_only, const struct stat &st) noexcept; @@ -194,7 +180,7 @@ struct log_t private: /** The log sequence number of the last change of durable InnoDB files */ - MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) + alignas(CPU_LEVEL1_DCACHE_LINESIZE) std::atomic lsn; /** the first guaranteed-durable log sequence number */ std::atomic flushed_to_disk_lsn; @@ -202,35 +188,58 @@ struct log_t preflush buffer pool pages, or initiate a log checkpoint. This must hold if lsn - last_checkpoint_lsn > max_checkpoint_age. */ std::atomic check_flush_or_checkpoint_; + + +#if defined(__aarch64__) +/* On ARM, we do more spinning */ +typedef srw_spin_lock log_rwlock_t; +#define LSN_LOCK_ATTR MY_MUTEX_INIT_FAST +#else +typedef srw_lock log_rwlock_t; +#define LSN_LOCK_ATTR nullptr +#endif + public: - /** mutex protecting the log */ - MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) mysql_mutex_t mutex; + /** rw-lock protecting buf */ + alignas(CPU_LEVEL1_DCACHE_LINESIZE) log_rwlock_t latch; private: /** Last written LSN */ lsn_t write_lsn; public: - /** first free offset within the log buffer in use */ - size_t buf_free; - /** recommended maximum size of buf, after which the buffer is flushed */ - size_t max_buf_free; - /** mutex that ensures that inserts into buf_pool.flush_list are in - LSN order; allows mtr_t::commit() to release log_sys.mutex earlier */ - MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) mysql_mutex_t flush_order_mutex; /** log record buffer, written to by mtr_t::commit() */ byte *buf; /** buffer for writing data to ib_logfile0, or nullptr if is_pmem() In write_buf(), buf and flush_buf are swapped */ byte *flush_buf; - /** number of write requests (to buf); protected by mutex */ - ulint write_to_buf; /** number of std::swap(buf, flush_buf) and writes from buf to log; - protected by mutex */ + protected by latch.wr_lock() */ ulint write_to_log; - /** number of waits in append_prepare() */ - ulint waits; + + /** Log sequence number when a log file overwrite (broken crash recovery) + was noticed. Protected by latch.wr_lock(). */ + lsn_t overwrite_warned; + /** innodb_log_buffer_size (size of buf and flush_buf, in bytes) */ size_t buf_size; +private: + /** spin lock protecting lsn, buf_free in append_prepare() */ + alignas(CPU_LEVEL1_DCACHE_LINESIZE) pthread_mutex_t lsn_lock; + void init_lsn_lock() { pthread_mutex_init(&lsn_lock, LSN_LOCK_ATTR); } + void lock_lsn() { pthread_mutex_lock(&lsn_lock); } + void unlock_lsn() { pthread_mutex_unlock(&lsn_lock); } + void destroy_lsn_lock() { pthread_mutex_destroy(&lsn_lock); } + +public: + /** first free offset within buf use; protected by lsn_lock */ + Atomic_relaxed buf_free; + /** number of write requests (to buf); protected by exclusive lsn_lock */ + ulint write_to_buf; + /** number of waits in append_prepare(); protected by lsn_lock */ + ulint waits; + /** recommended maximum size of buf, after which the buffer is flushed */ + size_t max_buf_free; + /** log file size in bytes, including the header */ lsn_t file_size; private: @@ -245,16 +254,16 @@ struct log_t uint32_t format; /** Log file */ log_file_t log; - - /** The fields involved in the log buffer flush @{ */ - - ulint n_log_ios; /*!< number of log i/os initiated thus - far */ - ulint n_log_ios_old; /*!< number of log i/o's at the - previous printout */ - time_t last_printout_time;/*!< when log_print was last time - called */ - /* @} */ +#if defined __linux__ || defined _WIN32 + /** whether file system caching is enabled for the log */ + my_bool log_buffered; +# ifdef _WIN32 + static constexpr bool log_maybe_unbuffered= true; +# else + /** whether file system caching may be disabled */ + bool log_maybe_unbuffered; +# endif +#endif /** Fields involved in checkpoints @{ */ lsn_t log_capacity; /*!< capacity of the log; if @@ -272,14 +281,14 @@ struct log_t /*!< this is the maximum allowed value for lsn - last_checkpoint_lsn when a new query step is started */ - /** latest completed checkpoint (protected by log_sys.mutex) */ + /** latest completed checkpoint (protected by latch.wr_lock()) */ Atomic_relaxed last_checkpoint_lsn; - lsn_t next_checkpoint_lsn; - /*!< next checkpoint lsn */ - /** next checkpoint number (protected by mutex) */ + /** next checkpoint LSN (protected by log_sys.latch) */ + lsn_t next_checkpoint_lsn; + /** next checkpoint number (protected by latch.wr_lock()) */ ulint next_checkpoint_no; - /** number of pending checkpoint writes */ - ulint n_pending_checkpoint_writes; + /** whether a checkpoint is pending */ + Atomic_relaxed checkpoint_pending; /** buffer for checkpoint header */ byte *checkpoint_buf; @@ -295,13 +304,26 @@ struct log_t bool is_opened() const noexcept { return log.is_opened(); } + static constexpr bool resize_in_progress() { return false; } + + /** Rename a log file after resizing. + @return whether an error occurred */ + static bool rename_resized() noexcept; + +#if defined __linux__ || defined _WIN32 + /** Try to enable or disable file system caching (update log_buffered) */ + void set_buffered(bool buffered); +#endif + void attach(log_file_t file, os_offset_t size); void close_file(); + /** Calculate the checkpoint safety margins. */ + static void set_capacity(); + lsn_t get_lsn(std::memory_order order= std::memory_order_relaxed) const { return lsn.load(order); } - void set_lsn(lsn_t lsn) { this->lsn.store(lsn, std::memory_order_release); } lsn_t get_flushed_lsn(std::memory_order order= std::memory_order_acquire) const noexcept @@ -310,17 +332,19 @@ struct log_t /** Initialize the LSN on initial log file creation. */ lsn_t init_lsn() noexcept { - mysql_mutex_lock(&mutex); + latch.wr_lock(SRW_LOCK_CALL); const lsn_t lsn{get_lsn()}; flushed_to_disk_lsn.store(lsn, std::memory_order_relaxed); write_lsn= lsn; - mysql_mutex_unlock(&mutex); + latch.wr_unlock(); return lsn; } void set_recovered_lsn(lsn_t lsn) noexcept { - mysql_mutex_assert_owner(&mutex); +#ifndef SUX_LOCK_GENERIC + ut_ad(latch.is_write_locked()); +#endif /* SUX_LOCK_GENERIC */ write_lsn= lsn; this->lsn.store(lsn, std::memory_order_relaxed); flushed_to_disk_lsn.store(lsn, std::memory_order_relaxed); @@ -360,20 +384,31 @@ struct log_t static size_t get_block_size() { return 512; } #endif +private: + /** Wait in append_prepare() for buffer to become available + @param ex whether log_sys.latch is exclusively locked */ + ATTRIBUTE_COLD static void append_prepare_wait(bool ex) noexcept; +public: /** Reserve space in the log buffer for appending data. - @param size upper limit of the length of the data to append(), in bytes - @return the current LSN */ - inline lsn_t append_prepare(size_t size) noexcept; + @tparam pmem log_sys.is_pmem() + @param size total length of the data to append(), in bytes + @param ex whether log_sys.latch is exclusively locked + @return the start LSN and the buffer position for append() */ + template + inline std::pair append_prepare(size_t size, bool ex) noexcept; /** Append a string of bytes to the redo log. + @param d destination @param s string of bytes @param size length of str, in bytes */ - void append(const void *s, size_t size) noexcept + void append(byte *&d, const void *s, size_t size) noexcept { - mysql_mutex_assert_owner(&mutex); - ut_ad(buf_free + size <= (is_pmem() ? file_size : buf_size)); - memcpy(buf + buf_free, s, size); - buf_free+= size; +#ifndef SUX_LOCK_GENERIC + ut_ad(latch.is_locked()); +#endif + ut_ad(d + size <= buf + (is_pmem() ? file_size : buf_size)); + memcpy(d, s, size); + d+= size; } /** Set the log file format. */ @@ -409,14 +444,15 @@ struct log_t return START_OFFSET + (lsn - first_lsn) % capacity(); } - /** Write checkpoint information to the log header and release mutex. + /** Write checkpoint information and invoke latch.wr_unlock(). @param end_lsn start LSN of the FILE_CHECKPOINT mini-transaction */ inline void write_checkpoint(lsn_t end_lsn) noexcept; - /** Write buf to ib_logfile0 and release mutex. + /** Write buf to ib_logfile0. + @tparam release_latch whether to invoke latch.wr_unlock() @return new write target @retval 0 if everything was written */ - inline lsn_t write_buf() noexcept; + template inline lsn_t write_buf() noexcept; /** Create the log. */ void create(lsn_t lsn) noexcept; @@ -425,8 +461,7 @@ struct log_t /** Redo log system */ extern log_t log_sys; -inline void log_free_check() -{ - if (log_sys.check_flush_or_checkpoint()) - log_check_margins(); -} +/** Wait for a log checkpoint if needed. +NOTE that this function may only be called while not holding +any synchronization objects except dict_sys.latch. */ +void log_free_check(); diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index 1c56a19259537..e787d81e8c290 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -37,11 +37,12 @@ Created 9/20/1997 Heikki Tuuri /** @return whether recovery is currently running. */ #define recv_recovery_is_on() UNIV_UNLIKELY(recv_sys.recovery_on) +ATTRIBUTE_COLD MY_ATTRIBUTE((nonnull, warn_unused_result)) /** Apply any buffered redo log to a page that was just read from a data file. @param[in,out] space tablespace -@param[in,out] bpage buffer pool page */ -ATTRIBUTE_COLD void recv_recover_page(fil_space_t* space, buf_page_t* bpage) - MY_ATTRIBUTE((nonnull)); +@param[in,out] bpage buffer pool page +@return whether the page was recovered correctly */ +bool recv_recover_page(fil_space_t* space, buf_page_t* bpage); /** Start recovering from a redo log checkpoint. of first system tablespace page @@ -61,15 +62,24 @@ enum store_t { /** Report an operation to create, delete, or rename a file during backup. @param[in] space_id tablespace identifier -@param[in] create whether the file is being created +@param[in] type file operation redo log type @param[in] name file name (not NUL-terminated) @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) */ -extern void (*log_file_op)(uint32_t space_id, bool create, +extern void (*log_file_op)(uint32_t space_id, int type, const byte* name, ulint len, const byte* new_name, ulint new_len); +/** Report an operation which does undo log tablespace truncation +during backup +@param space_id undo tablespace identifier */ +extern void (*undo_space_trunc)(uint32_t space_id); + +/** Report an operation which does INIT_PAGE for page0 during backup. +@param space_id tablespace identifier */ +extern void (*first_page_init)(uint32_t space_id); + /** Stored redo log record */ struct log_rec_t { @@ -260,13 +270,16 @@ struct recv_sys_t @param p iterator pointing to page_id @param mtr mini-transaction @param b pre-allocated buffer pool block - @return whether the page was successfully initialized */ + @return the recovered block + @retval nullptr if the page cannot be initialized based on log records + @retval -1 if the page cannot be recovered due to corruption */ inline buf_block_t *recover_low(const page_id_t page_id, map::iterator &p, mtr_t &mtr, buf_block_t *b); /** Attempt to initialize a page based on redo log records. @param page_id page identifier @return the recovered block - @retval nullptr if the page cannot be initialized based on log records */ + @retval nullptr if the page cannot be initialized based on log records + @retval -1 if the page cannot be recovered due to corruption */ buf_block_t *recover_low(const page_id_t page_id); /** All found log files (multiple ones are possible if we are upgrading @@ -384,7 +397,8 @@ struct recv_sys_t /** Attempt to initialize a page based on redo log records. @param page_id page identifier @return the recovered block - @retval nullptr if the page cannot be initialized based on log records */ + @retval nullptr if the page cannot be initialized based on log records + @retval -1 if the page cannot be recovered due to corruption */ buf_block_t *recover(const page_id_t page_id) { return UNIV_UNLIKELY(recovery_on) ? recover_low(page_id) : nullptr; @@ -416,9 +430,9 @@ extern bool recv_no_ibuf_operations; /** TRUE when recv_init_crash_recovery() has been called. */ extern bool recv_needed_recovery; #ifdef UNIV_DEBUG -/** TRUE if writing to the redo log (mtr_commit) is forbidden. -Protected by log_sys.mutex. */ -extern bool recv_no_log_write; +/** whether writing to the redo log is forbidden; +protected by exclusive log_sys.latch. */ +extern bool recv_no_log_write; #endif /* UNIV_DEBUG */ /** TRUE if buf_page_is_corrupted() should check if the log sequence diff --git a/storage/innobase/include/mach0data.h b/storage/innobase/include/mach0data.h index 4f4c9a4b596fa..79cbd7d18a1e2 100644 --- a/storage/innobase/include/mach0data.h +++ b/storage/innobase/include/mach0data.h @@ -370,6 +370,6 @@ mach_write_ulonglong( #endif /* !UNIV_INNOCHECKSUM */ -#include "mach0data.ic" +#include "mach0data.inl" #endif diff --git a/storage/innobase/include/mach0data.ic b/storage/innobase/include/mach0data.inl similarity index 100% rename from storage/innobase/include/mach0data.ic rename to storage/innobase/include/mach0data.inl diff --git a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h index b7fd9c098a69b..959147a61fcf9 100644 --- a/storage/innobase/include/mem0mem.h +++ b/storage/innobase/include/mem0mem.h @@ -341,5 +341,5 @@ struct mem_block_info_t { #define MEM_BLOCK_HEADER_SIZE UT_CALC_ALIGN(sizeof(mem_block_info_t),\ UNIV_MEM_ALIGNMENT) -#include "mem0mem.ic" +#include "mem0mem.inl" #endif diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.inl similarity index 100% rename from storage/innobase/include/mem0mem.ic rename to storage/innobase/include/mem0mem.inl diff --git a/storage/innobase/include/mtr0log.h b/storage/innobase/include/mtr0log.h index c955500ff7ae6..e2419309764ae 100644 --- a/storage/innobase/include/mtr0log.h +++ b/storage/innobase/include/mtr0log.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2019, 2022, MariaDB Corporation. +Copyright (c) 2019, 2023, 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 @@ -24,6 +24,9 @@ Mini-transaction log record encoding and decoding #pragma once #include "mtr0mtr.h" +/** The smallest invalid page identifier for persistent tablespaces */ +constexpr page_id_t end_page_id{SRV_SPACE_ID_UPPER_BOUND, 0}; + /** The minimum 2-byte integer (0b10xxxxxx xxxxxxxx) */ constexpr uint32_t MIN_2BYTE= 1 << 7; /** The minimum 3-byte integer (0b110xxxxx xxxxxxxx xxxxxxxx) */ @@ -194,7 +197,7 @@ inline bool mtr_t::write(const buf_block_t &block, void *ptr, V val) } byte *p= static_cast(ptr); const byte *const end= p + l; - if (w != FORCED && m_log_mode == MTR_LOG_ALL) + if (w != FORCED && is_logged()) { const byte *b= buf; while (*p++ == *b++) @@ -222,7 +225,7 @@ inline void mtr_t::memset(const buf_block_t &b, ulint ofs, ulint len, byte val) { ut_ad(len); set_modified(b); - if (m_log_mode != MTR_LOG_ALL) + if (!is_logged()) return; static_assert(MIN_4BYTE > UNIV_PAGE_SIZE_MAX, "consistency"); @@ -259,7 +262,7 @@ inline void mtr_t::memset(const buf_block_t &b, ulint ofs, size_t len, ut_ad(size); ut_ad(len > size); /* use mtr_t::memcpy() for shorter writes */ set_modified(b); - if (m_log_mode != MTR_LOG_ALL) + if (!is_logged()) return; static_assert(MIN_4BYTE > UNIV_PAGE_SIZE_MAX, "consistency"); @@ -317,7 +320,7 @@ inline void mtr_t::memcpy_low(const buf_block_t &block, uint16_t offset, { ut_ad(len); set_modified(block); - if (m_log_mode != MTR_LOG_ALL) + if (!is_logged()) return; if (len < mtr_buf_t::MAX_DATA_SIZE - (1 + 3 + 3 + 5 + 5)) { @@ -352,7 +355,7 @@ inline void mtr_t::memmove(const buf_block_t &b, ulint d, ulint s, ulint len) ut_ad(d + len <= ulint(srv_page_size)); set_modified(b); - if (m_log_mode != MTR_LOG_ALL) + if (!is_logged()) return; static_assert(MIN_4BYTE > UNIV_PAGE_SIZE_MAX, "consistency"); size_t lenlen= (len < MIN_2BYTE ? 1 : len < MIN_3BYTE ? 2 : 3); @@ -385,10 +388,11 @@ template inline byte *mtr_t::log_write(const page_id_t id, const buf_page_t *bpage, size_t len, bool alloc, size_t offset) { - static_assert(!(type & 15) && type != RESERVED && type != OPTION && + static_assert(!(type & 15) && type != RESERVED && type <= FILE_CHECKPOINT, "invalid type"); ut_ad(type >= FILE_CREATE || is_named_space(id.space())); ut_ad(!bpage || bpage->id() == id); + ut_ad(id < end_page_id); constexpr bool have_len= type != INIT_PAGE && type != FREE_PAGE; constexpr bool have_offset= type == WRITE || type == MEMSET || type == MEMMOVE; @@ -398,7 +402,8 @@ inline byte *mtr_t::log_write(const page_id_t id, const buf_page_t *bpage, ut_ad(have_offset || offset == 0); ut_ad(offset + len <= srv_page_size); static_assert(MIN_4BYTE >= UNIV_PAGE_SIZE_MAX, "consistency"); - + ut_ad(type == FREE_PAGE || type == OPTION || (type == EXTENDED && !bpage) || + memo_contains_flagged(bpage, MTR_MEMO_MODIFY)); size_t max_len; if (!have_len) max_len= 1 + 5 + 5; @@ -488,7 +493,7 @@ inline void mtr_t::memcpy(const buf_block_t &b, void *dest, const void *str, ut_ad(ut_align_down(dest, srv_page_size) == b.page.frame); char *d= static_cast(dest); const char *s= static_cast(str); - if (w != FORCED && m_log_mode == MTR_LOG_ALL) + if (w != FORCED && is_logged()) { ut_ad(len); const char *const end= d + len; @@ -508,55 +513,13 @@ inline void mtr_t::memcpy(const buf_block_t &b, void *dest, const void *str, memcpy(b, ut_align_offset(d, srv_page_size), len); } -/** Initialize an entire page. -@param[in,out] b buffer page */ -inline void mtr_t::init(buf_block_t *b) -{ - const page_id_t id{b->page.id()}; - ut_ad(is_named_space(id.space())); - ut_ad(!m_freed_pages == !m_freed_space); - - if (UNIV_LIKELY_NULL(m_freed_space) && - m_freed_space->id == id.space() && - m_freed_pages->remove_if_exists(b->page.id().page_no()) && - m_freed_pages->empty()) - { - delete m_freed_pages; - m_freed_pages= nullptr; - m_freed_space= nullptr; - } - - b->page.set_reinit(b->page.state() & buf_page_t::LRU_MASK); - - if (m_log_mode != MTR_LOG_ALL) - { - ut_ad(m_log_mode == MTR_LOG_NONE || m_log_mode == MTR_LOG_NO_REDO); - return; - } - - m_log.close(log_write(b->page.id(), &b->page)); - m_last_offset= FIL_PAGE_TYPE; -} - -/** Free a page. -@param[in] space tablespace contains page to be freed -@param[in] offset page offset to be freed */ -inline void mtr_t::free(fil_space_t &space, uint32_t offset) -{ - ut_ad(is_named_space(&space)); - ut_ad(!m_freed_space || m_freed_space == &space); - - if (m_log_mode == MTR_LOG_ALL) - m_log.close(log_write({space.id, offset}, nullptr)); -} - /** Write an EXTENDED log record. @param block buffer pool page @param type extended record subtype; @see mrec_ext_t */ inline void mtr_t::log_write_extended(const buf_block_t &block, byte type) { set_modified(block); - if (m_log_mode != MTR_LOG_ALL) + if (!is_logged()) return; byte *l= log_write(block.page.id(), &block.page, 1, true); *l++= type; @@ -583,7 +546,7 @@ inline void mtr_t::page_delete(const buf_block_t &block, ulint prev_rec) ut_ad(!block.zip_size()); ut_ad(prev_rec < block.physical_size()); set_modified(block); - if (m_log_mode != MTR_LOG_ALL) + if (!is_logged()) return; size_t len= (prev_rec < MIN_2BYTE ? 2 : prev_rec < MIN_3BYTE ? 3 : 4); byte *l= log_write(block.page.id(), &block.page, len, true); @@ -610,7 +573,7 @@ inline void mtr_t::page_delete(const buf_block_t &block, ulint prev_rec, ut_ad(hdr_size < MIN_3BYTE); ut_ad(prev_rec < block.physical_size()); ut_ad(data_size < block.physical_size()); - if (m_log_mode != MTR_LOG_ALL) + if (!is_logged()) return; size_t len= prev_rec < MIN_2BYTE ? 2 : prev_rec < MIN_3BYTE ? 3 : 4; len+= hdr_size < MIN_2BYTE ? 1 : 2; @@ -642,7 +605,7 @@ inline void mtr_t::undo_append(const buf_block_t &block, { ut_ad(len > 2); set_modified(block); - if (m_log_mode != MTR_LOG_ALL) + if (!is_logged()) return; const bool small= len + 1 < mtr_buf_t::MAX_DATA_SIZE - (1 + 3 + 3 + 5 + 5); byte *end= log_write(block.page.id(), &block.page, len + 1, small); @@ -665,7 +628,7 @@ inline void mtr_t::undo_append(const buf_block_t &block, @param id first page identifier that will not be in the file */ inline void mtr_t::trim_pages(const page_id_t id) { - if (m_log_mode != MTR_LOG_ALL) + if (!is_logged()) return; byte *l= log_write(id, nullptr, 1, true); *l++= TRIM_PAGES; diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index b79cf7e91c7a1..4d7b77b46389b 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, 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 @@ -24,11 +24,12 @@ Mini-transaction buffer Created 11/26/1995 Heikki Tuuri *******************************************************/ -#ifndef mtr0mtr_h -#define mtr0mtr_h +#pragma once #include "fil0fil.h" #include "dyn0buf.h" +#include "buf0buf.h" +#include "small_vector.h" /** Start a mini-transaction. */ #define mtr_start(m) (m)->start() @@ -36,34 +37,10 @@ Created 11/26/1995 Heikki Tuuri /** Commit a mini-transaction. */ #define mtr_commit(m) (m)->commit() -/** Set and return a savepoint in mtr. -@return savepoint */ -#define mtr_set_savepoint(m) (m)->get_savepoint() - -/** Release the (index tree) s-latch stored in an mtr memo after a -savepoint. */ -#define mtr_release_s_latch_at_savepoint(m, s, l) \ - (m)->release_s_latch_at_savepoint((s), (l)) - /** Change the logging mode of a mini-transaction. @return old mode */ #define mtr_set_log_mode(m, d) (m)->set_log_mode((d)) -/** Release an object in the memo stack. -@return true if released */ -#define mtr_memo_release(m, o, t) \ - (m)->memo_release((o), (t)) - -/** Print info of an mtr handle. */ -#define mtr_print(m) (m)->print() - -/** Return the log object of a mini-transaction buffer. -@return log */ -#define mtr_get_log(m) (m)->get_log() - -/** Push an object to an mtr memo stack. */ -#define mtr_memo_push(m, o, t) (m)->memo_push(o, t) - #ifdef UNIV_PFS_RWLOCK # define mtr_s_lock_index(i,m) (m)->s_lock(__FILE__, __LINE__, &(i)->lock) # define mtr_x_lock_index(i,m) (m)->x_lock(__FILE__, __LINE__, &(i)->lock) @@ -74,75 +51,122 @@ savepoint. */ # define mtr_sx_lock_index(i,m) (m)->u_lock(&(i)->lock) #endif -#define mtr_release_block_at_savepoint(m, s, b) \ - (m)->release_block_at_savepoint((s), (b)) - -#define mtr_block_sx_latch_at_savepoint(m, s, b) \ - (m)->sx_latch_at_savepoint((s), (b)) - -#define mtr_block_x_latch_at_savepoint(m, s, b) \ - (m)->x_latch_at_savepoint((s), (b)) - /** Mini-transaction memo stack slot. */ -struct mtr_memo_slot_t { - /** pointer to the object */ - void* object; - - /** type of the stored object */ - mtr_memo_type_t type; +struct mtr_memo_slot_t +{ + /** pointer to the object */ + void *object; + /** type of the stored object */ + mtr_memo_type_t type; + + /** Release the object */ + void release() const; }; /** Mini-transaction handle and buffer */ struct mtr_t { + mtr_t(); + ~mtr_t(); + /** Start a mini-transaction. */ void start(); /** Commit the mini-transaction. */ void commit(); + /** Release latches of unmodified buffer pages. + @param begin first slot to release + @param end last slot to release, or get_savepoint() */ + void rollback_to_savepoint(ulint begin, ulint end); + + /** Release latches of unmodified buffer pages. + @param begin first slot to release */ + void rollback_to_savepoint(ulint begin) + { rollback_to_savepoint(begin, m_memo.size()); } + + /** Release the last acquired buffer page latch. */ + void release_last_page() + { auto s= m_memo.size(); rollback_to_savepoint(s - 1, s); } + /** Commit a mini-transaction that is shrinking a tablespace. @param space tablespace that is being shrunk */ ATTRIBUTE_COLD void commit_shrink(fil_space_t &space); + /** Commit a mini-transaction that is deleting or renaming a file. + @param space tablespace that is being renamed or deleted + @param name new file name (nullptr=the file will be deleted) + @param detached_handle if detached_handle != nullptr and if space is detached + during the function execution the file handle if its + node will be set to OS_FILE_CLOSED, and the previous + value of the file handle will be assigned to the + address, pointed by detached_handle. + @return whether the operation succeeded */ + ATTRIBUTE_COLD bool commit_file(fil_space_t &space, const char *name, + pfs_os_file_t *detached_handle= nullptr); + /** Commit a mini-transaction that did not modify any pages, but generated some redo log on a higher level, such as FILE_MODIFY records and an optional FILE_CHECKPOINT marker. - The caller must hold log_sys.mutex. + The caller must hold exclusive log_sys.latch. This is to be used at log_checkpoint(). @param checkpoint_lsn the log sequence number of a checkpoint, or 0 @return current LSN */ lsn_t commit_files(lsn_t checkpoint_lsn= 0); /** @return mini-transaction savepoint (current size of m_memo) */ - ulint get_savepoint() const { ut_ad(is_active()); return m_memo.size(); } - - /** Release the (index tree) s-latch stored in an mtr memo after a - savepoint. - @param savepoint value returned by @see set_savepoint. - @param lock latch to release */ - inline void release_s_latch_at_savepoint( - ulint savepoint, - index_lock* lock); + ulint get_savepoint() const + { + ut_ad(is_active()); + return m_memo.size(); + } - /** Release the block in an mtr memo after a savepoint. */ - inline void release_block_at_savepoint( - ulint savepoint, - buf_block_t* block); + /** Get the block at a savepoint */ + buf_block_t *at_savepoint(ulint savepoint) const + { + ut_ad(is_active()); + const mtr_memo_slot_t &slot= m_memo[savepoint]; + ut_ad(slot.type < MTR_MEMO_S_LOCK); + ut_ad(slot.object); + return static_cast(slot.object); + } - /** SX-latch a not yet latched block after a savepoint. */ - inline void sx_latch_at_savepoint(ulint savepoint, buf_block_t* block); + /** Try to get a block at a savepoint. + @param savepoint the savepoint right before the block was acquired + @return the block at the savepoint + @retval nullptr if no buffer block was registered at that savepoint */ + buf_block_t *block_at_savepoint(ulint savepoint) const + { + ut_ad(is_active()); + const mtr_memo_slot_t &slot= m_memo[savepoint]; + return slot.type < MTR_MEMO_S_LOCK + ? static_cast(slot.object) + : nullptr; + } - /** X-latch a not yet latched block after a savepoint. */ - inline void x_latch_at_savepoint(ulint savepoint, buf_block_t* block); + /** Retrieve a page that has already been latched. + @param id page identifier + @param type page latch type + @return block + @retval nullptr if the block had not been latched yet */ + buf_block_t *get_already_latched(const page_id_t id, mtr_memo_type_t type) + const; /** @return the logging mode */ mtr_log_t get_log_mode() const { static_assert(MTR_LOG_ALL == 0, "efficiency"); - ut_ad(m_log_mode <= MTR_LOG_NO_REDO); return static_cast(m_log_mode); } + /** @return whether log is to be written for changes */ + bool is_logged() const + { + static_assert(MTR_LOG_ALL == 0, "efficiency"); + static_assert(MTR_LOG_NONE & MTR_LOG_NO_REDO, "efficiency"); + static_assert(!(MTR_LOG_NONE & MTR_LOG_SUB), "efficiency"); + return !(m_log_mode & MTR_LOG_NONE); + } + /** Change the logging mode. @param mode logging mode @return old mode */ @@ -153,10 +177,23 @@ struct mtr_t { return old_mode; } + /** Set the log mode of a sub-minitransaction + @param mtr parent mini-transaction */ + void set_log_mode_sub(const mtr_t &mtr) + { + ut_ad(mtr.m_log_mode == MTR_LOG_ALL || mtr.m_log_mode == MTR_LOG_NO_REDO); + m_log_mode= mtr.m_log_mode | MTR_LOG_SUB; + static_assert((MTR_LOG_SUB | MTR_LOG_NO_REDO) == MTR_LOG_NO_REDO, ""); + } + /** Check if we are holding a block latch in exclusive mode @param block buffer pool block to search for */ bool have_x_latch(const buf_block_t &block) const; + /** Check if we are holding a block latch in S or U mode + @param block buffer pool block to search for */ + bool have_u_or_x_latch(const buf_block_t &block) const; + /** Copy the tablespaces associated with the mini-transaction (needed for generating FILE_MODIFY records) @param[in] mtr mini-transaction that may modify @@ -252,44 +289,25 @@ struct mtr_t { memo_push(lock, MTR_MEMO_SX_LOCK); } - /** Acquire a tablespace S-latch. - @param space tablespace */ - void s_lock_space(fil_space_t *space) - { - ut_ad(space->purpose == FIL_TYPE_TEMPORARY || - space->purpose == FIL_TYPE_IMPORT || - space->purpose == FIL_TYPE_TABLESPACE); - memo_push(space, MTR_MEMO_SPACE_S_LOCK); - space->s_lock(); - } - /** Acquire an exclusive tablespace latch. @param space tablespace */ void x_lock_space(fil_space_t *space); - /** Release an object in the memo stack. - @param object object - @param type object type - @return bool if lock released */ - bool memo_release(const void *object, ulint type); - /** Release a page latch. - @param[in] ptr pointer to within a page frame - @param[in] type object type: MTR_MEMO_PAGE_X_FIX, ... */ - void release_page(const void *ptr, mtr_memo_type_t type); + /** Release an index latch. */ + void release(const index_lock &lock) { release(&lock); } + /** Release a latch to an unmodified page. */ + void release(const buf_block_t &block) { release(&block); } private: - /** Note that the mini-transaction will modify data. */ - void flag_modified() { m_modifications = true; } + /** Release an unmodified object. */ + void release(const void *object); +public: /** Mark the given latched page as modified. @param block page that will be modified */ - void modify(const buf_block_t& block); -public: - /** Note that the mini-transaction will modify a block. */ - void set_modified(const buf_block_t &block) - { flag_modified(); if (m_log_mode != MTR_LOG_NONE) modify(block); } + void set_modified(const buf_block_t &block); /** Set the state to not-modified. This will not log the changes. This is only used during redo log apply, to avoid logging the changes. */ - void discard_modifications() { m_modifications = false; } + void discard_modifications() { m_modifications= false; } /** Get the LSN of commit(). @return the commit LSN @@ -305,87 +323,130 @@ struct mtr_t { /** @return true if we are inside the change buffer code */ bool is_inside_ibuf() const { return m_inside_ibuf; } - /** Note that pages has been trimed */ + /** Note that some pages have been freed */ void set_trim_pages() { m_trim_pages= true; } - /** @return true if pages has been trimed */ - bool is_trim_pages() { return m_trim_pages; } - /** Latch a buffer pool block. @param block block to be latched @param rw_latch RW_S_LATCH, RW_SX_LATCH, RW_X_LATCH, RW_NO_LATCH */ void page_lock(buf_block_t *block, ulint rw_latch); + /** Acquire a latch on a buffer-fixed buffer pool block. + @param savepoint savepoint location of the buffer-fixed block + @param rw_latch latch to acquire */ + void upgrade_buffer_fix(ulint savepoint, rw_lock_type_t rw_latch); + + /** Register a change to the page latch state. */ + void lock_register(ulint savepoint, mtr_memo_type_t type) + { + mtr_memo_slot_t &slot= m_memo[savepoint]; + ut_ad(slot.type <= MTR_MEMO_BUF_FIX); + ut_ad(type < MTR_MEMO_S_LOCK); + slot.type= type; + } + /** Upgrade U locks on a block to X */ void page_lock_upgrade(const buf_block_t &block); - /** Upgrade X lock to X */ - void lock_upgrade(const index_lock &lock); + + /** Upgrade index U lock to X */ + ATTRIBUTE_COLD void index_lock_upgrade(); /** Check if we are holding tablespace latch @param space tablespace to search for - @param shared whether to look for shared latch, instead of exclusive @return whether space.latch is being held */ - bool memo_contains(const fil_space_t& space, bool shared= false) + bool memo_contains(const fil_space_t& space) const MY_ATTRIBUTE((warn_unused_result)); #ifdef UNIV_DEBUG /** Check if we are holding an rw-latch in this mini-transaction @param lock latch to search for @param type held latch type @return whether (lock,type) is contained */ - bool memo_contains(const index_lock &lock, mtr_memo_type_t type) + bool memo_contains(const index_lock &lock, mtr_memo_type_t type) const MY_ATTRIBUTE((warn_unused_result)); - /** Check if memo contains the given item. - @param object object to search - @param flags specify types of object (can be ORred) of - MTR_MEMO_PAGE_S_FIX ... values - @return true if contains */ - bool memo_contains_flagged(const void* ptr, ulint flags) const; - - /** Check if memo contains the given page. - @param[in] ptr pointer to within buffer frame - @param[in] flags specify types of object with OR of - MTR_MEMO_PAGE_S_FIX... values - @return the block - @retval NULL if not found */ - buf_block_t* memo_contains_page_flagged( - const byte* ptr, - ulint flags) const; - - /** Print info of an mtr handle. */ - void print() const; - - /** @return true if mini-transaction contains modifications. */ - bool has_modifications() const { return m_modifications; } - - /** @return the memo stack */ - const mtr_buf_t* get_memo() const { return &m_memo; } - - /** @return the memo stack */ - mtr_buf_t* get_memo() { return &m_memo; } + /** Check if memo contains an index or buffer block latch. + @param object object to search + @param flags specify types of object latches + @return true if contains */ + bool memo_contains_flagged(const void *object, ulint flags) const + MY_ATTRIBUTE((warn_unused_result, nonnull)); + + /** Check if memo contains the given page. + @param ptr pointer to within page frame + @param flags types latch to look for + @return the block + @retval nullptr if not found */ + buf_block_t *memo_contains_page_flagged(const byte *ptr, ulint flags) const; + + /** @return whether this mini-transaction modifies persistent data */ + bool has_modifications() const { return m_modifications; } #endif /* UNIV_DEBUG */ - /** @return true if a record was added to the mini-transaction */ - bool is_dirty() const { return m_made_dirty; } - - /** Get the buffered redo log of this mini-transaction. - @return redo log */ - const mtr_buf_t* get_log() const { return &m_log; } + /** Push a buffer page to an the memo. + @param block buffer block + @param type object type: MTR_MEMO_S_LOCK, ... */ + void memo_push(buf_block_t *block, mtr_memo_type_t type) + __attribute__((nonnull)) + { + ut_ad(is_active()); + ut_ad(type <= MTR_MEMO_PAGE_SX_MODIFY); + ut_ad(block->page.buf_fix_count()); + ut_ad(block->page.in_file()); +#ifdef UNIV_DEBUG + switch (type) { + case MTR_MEMO_PAGE_S_FIX: + ut_ad(block->page.lock.have_s()); + break; + case MTR_MEMO_PAGE_X_FIX: case MTR_MEMO_PAGE_X_MODIFY: + ut_ad(block->page.lock.have_x()); + break; + case MTR_MEMO_PAGE_SX_FIX: case MTR_MEMO_PAGE_SX_MODIFY: + ut_ad(block->page.lock.have_u_or_x()); + break; + case MTR_MEMO_BUF_FIX: + break; + case MTR_MEMO_MODIFY: + case MTR_MEMO_S_LOCK: case MTR_MEMO_X_LOCK: case MTR_MEMO_SX_LOCK: + case MTR_MEMO_SPACE_X_LOCK: + ut_ad("invalid type" == 0); + } +#endif + if (!(type & MTR_MEMO_MODIFY)); + else if (block->page.id().space() >= SRV_TMP_SPACE_ID) + { + block->page.set_temp_modified(); + type= mtr_memo_type_t(type & ~MTR_MEMO_MODIFY); + } + else + { + m_modifications= true; + if (!m_made_dirty) + /* If we are going to modify a previously clean persistent page, + we must set m_made_dirty, so that commit() will acquire + log_sys.flush_order_mutex and insert the block into + buf_pool.flush_list. */ + m_made_dirty= block->page.oldest_modification() <= 1; + } + m_memo.emplace_back(mtr_memo_slot_t{block, type}); + } - /** Get the buffered redo log of this mini-transaction. - @return redo log */ - mtr_buf_t* get_log() { return &m_log; } + /** Push an index lock or tablespace latch to the memo. + @param object index lock or tablespace latch + @param type object type: MTR_MEMO_S_LOCK, ... */ + void memo_push(void *object, mtr_memo_type_t type) __attribute__((nonnull)) + { + ut_ad(is_active()); + ut_ad(type >= MTR_MEMO_S_LOCK); + m_memo.emplace_back(mtr_memo_slot_t{object, type}); + } - /** Push an object to an mtr memo stack. - @param object object - @param type object type: MTR_MEMO_S_LOCK, ... */ - inline void memo_push(void* object, mtr_memo_type_t type); + /** @return the size of the log is empty */ + size_t get_log_size() const { return m_log.size(); } + /** @return whether the log and memo are empty */ + bool is_empty() const { return !get_savepoint() && !get_log_size(); } - /** Check if this mini-transaction is dirtying a clean page. - @param block block being x-fixed - @return true if the mtr is dirtying a clean page. */ - static inline bool is_block_dirtied(const buf_block_t* block) - MY_ATTRIBUTE((warn_unused_result)); + /** Write an OPT_PAGE_CHECKSUM record. */ + inline void page_checksum(const buf_page_t &bpage); /** Write request types */ enum write_type @@ -485,9 +546,9 @@ struct mtr_t { @param[in,out] b buffer page */ void init(buf_block_t *b); /** Free a page. - @param[in] space tablespace contains page to be freed - @param[in] offset page offset to be freed */ - inline void free(fil_space_t &space, uint32_t offset); + @param space tablespace + @param offset offset of the page to be freed */ + void free(const fil_space_t &space, uint32_t offset); /** Write log for partly initializing a B-tree or R-tree page. @param block B-tree or R-tree page @param comp false=ROW_FORMAT=REDUNDANT, true=COMPACT or DYNAMIC */ @@ -587,6 +648,9 @@ struct mtr_t { @return number of buffer count added by this mtr */ uint32_t get_fix_count(const buf_block_t *block) const; + /** Note that log_sys.latch is no longer being held exclusively. */ + void flag_wr_unlock() noexcept { ut_ad(m_latch_ex); m_latch_ex= false; } + /** type of page flushing is needed during commit() */ enum page_flush_ahead { @@ -599,6 +663,11 @@ struct mtr_t { }; private: + /** Handle any pages that were freed during the mini-transaction. */ + void process_freed_pages(); + /** Release modified pages when no log was written. */ + void release_unlogged(); + /** Log a write of a byte string to a page. @param block buffer page @param offset byte offset within page @@ -624,10 +693,6 @@ struct mtr_t { @param type extended record subtype; @see mrec_ext_t */ inline void log_write_extended(const buf_block_t &block, byte type); - /** Prepare to write the mini-transaction log to the redo log buffer. - @return number of bytes to write in finish_write() */ - inline size_t prepare_write(); - /** Write a FILE_MODIFY record when a non-predefined persistent tablespace was modified for the first time since fil_names_clear(). */ ATTRIBUTE_NOINLINE ATTRIBUTE_COLD void name_write(); @@ -635,11 +700,17 @@ struct mtr_t { /** Encrypt the log */ ATTRIBUTE_NOINLINE void encrypt(); + /** Append the redo log records to the redo log buffer. + @return {start_lsn,flush_ahead} */ + std::pair do_write(); + /** Append the redo log records to the redo log buffer. @param len number of bytes to write @return {start_lsn,flush_ahead} */ std::pair finish_write(size_t len); + /** Release all latches. */ + void release(); /** Release the resources */ inline void release_resources(); @@ -662,7 +733,7 @@ struct mtr_t { /** whether freeing_tree() has been called */ bool m_freeing_tree= false; #endif - +private: /** The page of the most recent m_log record written, or NULL */ const buf_page_t* m_last; /** The current byte offset in m_last, or 0 */ @@ -671,12 +742,15 @@ struct mtr_t { /** specifies which operations should be logged; default MTR_LOG_ALL */ uint16_t m_log_mode:2; - /** whether at least one buffer pool page was written to */ + /** whether at least one persistent page was written to */ uint16_t m_modifications:1; /** whether at least one previously clean buffer pool page was written to */ uint16_t m_made_dirty:1; + /** whether log_sys.latch is locked exclusively */ + uint16_t m_latch_ex:1; + /** whether change buffer is latched; only needed in non-debug builds to suppress some read-ahead operations, @see ibuf_inside() */ uint16_t m_inside_ibuf:1; @@ -694,7 +768,7 @@ struct mtr_t { #endif /* UNIV_DEBUG */ /** acquired dict_index_t::lock, fil_space_t::latch, buf_block_t */ - mtr_buf_t m_memo; + small_vector m_memo; /** mini-transaction log */ mtr_buf_t m_log; @@ -710,7 +784,3 @@ struct mtr_t { /** set of freed page ids */ range_set *m_freed_pages= nullptr; }; - -#include "mtr0mtr.ic" - -#endif /* mtr0mtr_h */ diff --git a/storage/innobase/include/mtr0mtr.ic b/storage/innobase/include/mtr0mtr.ic deleted file mode 100644 index 02ad88194fb04..0000000000000 --- a/storage/innobase/include/mtr0mtr.ic +++ /dev/null @@ -1,184 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, 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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/mtr0mtr.ic -Mini-transaction buffer - -Created 11/26/1995 Heikki Tuuri -*******************************************************/ - -#include "buf0buf.h" - -/** Check if a mini-transaction is dirtying a clean page. -@return true if the mtr is dirtying a clean page. */ -inline bool mtr_t::is_block_dirtied(const buf_block_t *block) -{ - ut_ad(block->page.in_file()); - ut_ad(block->page.frame); - ut_ad(block->page.buf_fix_count()); - return block->page.oldest_modification() <= 1; -} - -/** -Pushes an object to an mtr memo stack. */ -void -mtr_t::memo_push(void* object, mtr_memo_type_t type) -{ - ut_ad(is_active()); - ut_ad(object != NULL); - ut_ad(type >= MTR_MEMO_PAGE_S_FIX); - ut_ad(type <= MTR_MEMO_SPACE_S_LOCK); - ut_ad(ut_is_2pow(type)); - - /* If this mtr has x-fixed a clean page then we set - the made_dirty flag. This tells us if we need to - grab log_sys.flush_order_mutex at mtr_t::commit() so that we - can insert the dirtied page into the flush list. */ - - if ((type == MTR_MEMO_PAGE_X_FIX || type == MTR_MEMO_PAGE_SX_FIX) - && !m_made_dirty) { - - m_made_dirty = is_block_dirtied( - reinterpret_cast(object)); - } - - mtr_memo_slot_t* slot = m_memo.push(sizeof(*slot)); - - slot->type = type; - slot->object = object; -} - -/** -Releases the (index tree) s-latch stored in an mtr memo after a -savepoint. */ -void -mtr_t::release_s_latch_at_savepoint( - ulint savepoint, - index_lock* lock) -{ - ut_ad(is_active()); - ut_ad(m_memo.size() > savepoint); - - mtr_memo_slot_t* slot = m_memo.at(savepoint); - - ut_ad(slot->object == lock); - ut_ad(slot->type == MTR_MEMO_S_LOCK); - - lock->s_unlock(); - - slot->object = NULL; -} - -/** -SX-latches the not yet latched block after a savepoint. */ - -void -mtr_t::sx_latch_at_savepoint( - ulint savepoint, - buf_block_t* block) -{ - ut_ad(is_active()); - ut_ad(m_memo.size() > savepoint); - - ut_ad(!memo_contains_flagged( - block, - MTR_MEMO_PAGE_S_FIX - | MTR_MEMO_PAGE_X_FIX - | MTR_MEMO_PAGE_SX_FIX)); - - mtr_memo_slot_t* slot = m_memo.at(savepoint); - - ut_ad(slot->object == block); - - /* == RW_NO_LATCH */ - ut_a(slot->type == MTR_MEMO_BUF_FIX); - - block->page.lock.u_lock(); - ut_ad(!block->page.is_io_fixed()); - - if (!m_made_dirty) { - m_made_dirty = is_block_dirtied(block); - } - - slot->type = MTR_MEMO_PAGE_SX_FIX; -} - -/** -X-latches the not yet latched block after a savepoint. */ - -void -mtr_t::x_latch_at_savepoint( - ulint savepoint, - buf_block_t* block) -{ - ut_ad(is_active()); - ut_ad(m_memo.size() > savepoint); - - ut_ad(!memo_contains_flagged( - block, - MTR_MEMO_PAGE_S_FIX - | MTR_MEMO_PAGE_X_FIX - | MTR_MEMO_PAGE_SX_FIX)); - - mtr_memo_slot_t* slot = m_memo.at(savepoint); - - ut_ad(slot->object == block); - - /* == RW_NO_LATCH */ - ut_a(slot->type == MTR_MEMO_BUF_FIX); - - block->page.lock.x_lock(); - ut_ad(!block->page.is_io_fixed()); - - if (!m_made_dirty) { - m_made_dirty = is_block_dirtied(block); - } - - slot->type = MTR_MEMO_PAGE_X_FIX; -} - -/** -Releases the block in an mtr memo after a savepoint. */ - -void -mtr_t::release_block_at_savepoint( - ulint savepoint, - buf_block_t* block) -{ - ut_ad(is_active()); - - mtr_memo_slot_t *slot = m_memo.at(savepoint); - - ut_a(slot->object == block); - slot->object= nullptr; - block->page.unfix(); - - switch (slot->type) { - case MTR_MEMO_PAGE_S_FIX: - block->page.lock.s_unlock(); - break; - case MTR_MEMO_PAGE_SX_FIX: - case MTR_MEMO_PAGE_X_FIX: - block->page.lock.u_or_x_unlock(slot->type == MTR_MEMO_PAGE_SX_FIX); - break; - default: - break; - } -} diff --git a/storage/innobase/include/mtr0types.h b/storage/innobase/include/mtr0types.h index 3db8898892427..19db13a12b654 100644 --- a/storage/innobase/include/mtr0types.h +++ b/storage/innobase/include/mtr0types.h @@ -41,6 +41,11 @@ enum mtr_log_t { Set for attempting modification of a ROW_FORMAT=COMPRESSED page. */ MTR_LOG_NONE, + /** Log all operations, but do not write any OPT_PAGE_CHECKSUM + records because some of the modified pages were also modified + by another mini-transaction that did not write its log yet. */ + MTR_LOG_SUB, + /** Don't generate REDO log but add dirty pages to flush list */ MTR_LOG_NO_REDO }; @@ -77,12 +82,8 @@ type. The following record types refer to data pages: RESERVED (6): reserved for future use; a subtype code (encoded immediately after the length) would be written to reserve code space for further extensions - OPTION (7): optional record that may be ignored; a subtype code - (encoded immediately after the length) would distinguish actual - usage, such as: - * MDEV-18976 page checksum record - * binlog record - * SQL statement (at the start of statement) + OPTION (7): optional record that may be ignored; a subtype @see mrec_opt + (encoded immediately after the length) would distinguish actual usage Bits 3..0 indicate the redo log record length, excluding the first byte, but including additional length bytes and any other bytes, @@ -232,9 +233,7 @@ enum mrec_type_t /** Reserved for future use. */ RESERVED= 0x60, /** Optional record that may be ignored in crash recovery. - A subtype code will be encoded immediately after the length. - Possible subtypes would include a MDEV-18976 page checksum record, - a binlog record, or an SQL statement. */ + A subtype (@see mrec_opt) will be encoded after the page identifier. */ OPTION= 0x70 }; @@ -286,6 +285,15 @@ enum mrec_ext_t }; +/** Recognized OPTION record subtypes. */ +enum mrec_opt +{ + /** page checksum at the end of the mini-transaction */ + OPT_PAGE_CHECKSUM= 0 + /* Other possible subtypes: a binlog record, or an SQL statement. */ +}; + + /** Redo log record types for file-level operations. These bit patterns will be written to redo log files, so the existing codes or their interpretation on crash recovery must not be changed. */ @@ -334,8 +342,6 @@ enum mtr_memo_type_t { MTR_MEMO_SX_LOCK = RW_SX_LATCH << 5, /** wr_lock() on fil_space_t::latch */ - MTR_MEMO_SPACE_X_LOCK = MTR_MEMO_SX_LOCK << 1, - /** rd_lock() on fil_space_t::latch */ - MTR_MEMO_SPACE_S_LOCK = MTR_MEMO_SX_LOCK << 2 + MTR_MEMO_SPACE_X_LOCK = MTR_MEMO_SX_LOCK << 1 }; #endif /* !UNIV_INNOCHECKSUM */ diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index 1407edbb806d8..13f9d3de3f8ac 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -385,6 +385,14 @@ os_file_set_nocache( const char* operation_name); #endif +#ifndef _WIN32 /* On Microsoft Windows, mandatory locking is used */ +/** Obtain an exclusive lock on a file. +@param fd file descriptor +@param name file name +@return 0 on success */ +int os_file_lock(int fd, const char *name); +#endif + /** NOTE! Use the corresponding macro os_file_create(), not directly this function! Opens an existing file or creates a new. @@ -447,7 +455,6 @@ bool os_file_close_func(os_file_t file); /* Keys to register InnoDB I/O with performance schema */ extern mysql_pfs_key_t innodb_data_file_key; -extern mysql_pfs_key_t innodb_log_file_key; extern mysql_pfs_key_t innodb_temp_file_key; /* Following four macros are instumentations to register @@ -565,12 +572,8 @@ The wrapper functions have the prefix of "innodb_". */ # define os_file_close(file) \ pfs_os_file_close_func(file, __FILE__, __LINE__) -# define os_file_read(type, file, buf, offset, n) \ - pfs_os_file_read_func(type, file, buf, offset, n, __FILE__, __LINE__) - -# define os_file_read_no_error_handling(type, file, buf, offset, n, o) \ - pfs_os_file_read_no_error_handling_func( \ - type, file, buf, offset, n, o, __FILE__, __LINE__) +# define os_file_read(type, file, buf, offset, n, o) \ + pfs_os_file_read_func(type, file, buf, offset, n,o, __FILE__, __LINE__) # define os_file_write(type, name, file, buf, offset, n) \ pfs_os_file_write_func(type, name, file, buf, offset, \ @@ -710,31 +713,6 @@ os_file_read() which requests a synchronous read operation. UNIV_INLINE dberr_t pfs_os_file_read_func( - const IORequest& type, - pfs_os_file_t file, - void* buf, - os_offset_t offset, - ulint n, - const char* src_file, - uint src_line); - -/** NOTE! Please use the corresponding macro os_file_read_no_error_handling(), -not directly this function! -This is the performance schema instrumented wrapper function for -os_file_read_no_error_handling_func() which requests a synchronous -read operation. -@param[in] type IO request context -@param[in] file Open file handle -@param[out] buf buffer where to read -@param[in] offset file offset where to read -@param[in] n number of bytes to read -@param[out] o number of bytes actually read -@param[in] src_file file name where func invoked -@param[in] src_line line where the func invoked -@return DB_SUCCESS if request was successful */ -UNIV_INLINE -dberr_t -pfs_os_file_read_no_error_handling_func( const IORequest& type, pfs_os_file_t file, void* buf, @@ -865,11 +843,8 @@ to original un-instrumented file I/O APIs */ # define os_file_close(file) os_file_close_func(file) -# define os_file_read(type, file, buf, offset, n) \ - os_file_read_func(type, file, buf, offset, n) - -# define os_file_read_no_error_handling(type, file, buf, offset, n, o) \ - os_file_read_no_error_handling_func(type, file, buf, offset, n, o) +# define os_file_read(type, file, buf, offset, n, o) \ + os_file_read_func(type, file, buf, offset, n, o) # define os_file_write(type, name, file, buf, offset, n) \ os_file_write_func(type, name, file, buf, offset, n) @@ -958,13 +933,14 @@ os_file_flush_func( /** Retrieves the last error number if an error occurs in a file io function. The number should be retrieved before any other OS calls (because they may overwrite the error number). If the number is not known to this program, -the OS error number + 100 is returned. -@param[in] report true if we want an error message printed - for all errors -@return error number, or OS error number + 100 */ -ulint -os_file_get_last_error( - bool report); +the OS error number + OS_FILE_ERROR_MAX is returned. +@param[in] report_all_errors true if we want an error message + printed of all errors +@param[in] on_error_silent true then don't print any diagnostic + to the log +@return error number, or OS error number + OS_FILE_ERROR_MAX */ +ulint os_file_get_last_error(bool report_all_errors, + bool on_error_silent= false); /** NOTE! Use the corresponding macro os_file_read(), not directly this function! @@ -974,6 +950,7 @@ Requests a synchronous read operation. @param[out] buf buffer where to read @param[in] offset file offset where to read @param[in] n number of bytes to read +@param[out] o number of bytes actually read @return DB_SUCCESS if request was successful */ dberr_t os_file_read_func( @@ -981,7 +958,8 @@ os_file_read_func( os_file_t file, void* buf, os_offset_t offset, - ulint n) + ulint n, + ulint* o) MY_ATTRIBUTE((warn_unused_result)); /** Rewind file to its start, read at most size - 1 bytes from it to str, and @@ -996,27 +974,6 @@ os_file_read_string( char* str, ulint size); -/** NOTE! Use the corresponding macro os_file_read_no_error_handling(), -not directly this function! -Requests a synchronous positioned read operation. This function does not do -any error handling. In case of error it returns FALSE. -@param[in] type IO request context -@param[in] file Open file handle -@param[out] buf buffer where to read -@param[in] offset file offset where to read -@param[in] n number of bytes to read -@param[out] o number of bytes actually read -@return DB_SUCCESS or error code */ -dberr_t -os_file_read_no_error_handling_func( - const IORequest& type, - os_file_t file, - void* buf, - os_offset_t offset, - ulint n, - ulint* o) - MY_ATTRIBUTE((warn_unused_result)); - /** NOTE! Use the corresponding macro os_file_write(), not directly this function! Requests a synchronous write operation. @@ -1047,23 +1004,6 @@ os_file_status( bool* exists, os_file_type_t* type); -/** This function returns a new path name after replacing the basename -in an old path with a new basename. The old_path is a full path -name including the extension. The tablename is in the normal -form "databasename/tablename". The new base name is found after -the forward slash. Both input strings are null terminated. - -This function allocates memory to be returned. It is the callers -responsibility to free the return value after it is no longer needed. - -@param[in] old_path pathname -@param[in] new_name new file name -@return own: new full pathname */ -char* -os_file_make_new_pathname( - const char* old_path, - const char* new_name); - /** This function reduces a null-terminated full remote path name into the path that is sent by MySQL for DATA DIRECTORY clause. It replaces the 'databasename/tablename.ibd' found at the end of the path with just @@ -1109,11 +1049,20 @@ void os_aio_free(); @retval DB_IO_ERROR on I/O error */ dberr_t os_aio(const IORequest &type, void *buf, os_offset_t offset, size_t n); -/** Wait until there are no pending asynchronous writes. */ -void os_aio_wait_until_no_pending_writes(); +/** @return number of pending reads */ +size_t os_aio_pending_reads(); +/** @return approximate number of pending reads */ +size_t os_aio_pending_reads_approx(); +/** @return number of pending writes */ +size_t os_aio_pending_writes(); + +/** Wait until there are no pending asynchronous writes. +@param declare whether the wait will be declared in tpool */ +void os_aio_wait_until_no_pending_writes(bool declare); -/** Wait until all pending asynchronous reads have completed. */ -void os_aio_wait_until_no_pending_reads(); +/** Wait until all pending asynchronous reads have completed. +@param declare whether the wait will be declared in tpool */ +void os_aio_wait_until_no_pending_reads(bool declare); /** Prints info of the aio arrays. @param[in/out] file file where to print */ @@ -1225,6 +1174,6 @@ inline bool is_absolute_path(const char *path) return false; } -#include "os0file.ic" +#include "os0file.inl" #endif /* os0file_h */ diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic deleted file mode 100644 index e88f94b8ff3a9..0000000000000 --- a/storage/innobase/include/os0file.ic +++ /dev/null @@ -1,450 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2010, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2020, MariaDB Corporation. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/os0file.ic -The interface to the operating system file io - -Created 2/20/2010 Jimmy Yang -*******************************************************/ - -#ifdef UNIV_PFS_IO -/** NOTE! Please use the corresponding macro os_file_create_simple(), -not directly this function! -A performance schema instrumented wrapper function for -os_file_create_simple() which opens or creates a file. -@param[in] key Performance Schema Key -@param[in] name name of the file or path as a null-terminated - string -@param[in] create_mode create mode -@param[in] access_type OS_FILE_READ_ONLY or OS_FILE_READ_WRITE -@param[in] read_only if true read only mode checks are enforced -@param[out] success true if succeeded -@param[in] src_file file name where func invoked -@param[in] src_line line where the func invoked -@return own: handle to the file, not defined if error, error number -can be retrieved with os_file_get_last_error */ -UNIV_INLINE -pfs_os_file_t -pfs_os_file_create_simple_func( - mysql_pfs_key_t key, - const char* name, - ulint create_mode, - ulint access_type, - bool read_only, - bool* success, - const char* src_file, - uint src_line) -{ - PSI_file_locker_state state; - struct PSI_file_locker* locker = NULL; - - /* register a file open or creation depending on "create_mode" */ - register_pfs_file_open_begin( - &state, locker, key, - (create_mode == OS_FILE_CREATE) - ? PSI_FILE_CREATE : PSI_FILE_OPEN, - name, src_file, src_line); - - pfs_os_file_t file = os_file_create_simple_func( - name, create_mode, access_type, read_only, success); - - /* Register psi value for the file */ - register_pfs_file_open_end(locker, file, - (*success == TRUE ? success : 0)); - - return(file); -} - -/** NOTE! Please use the corresponding macro -os_file_create_simple_no_error_handling(), not directly this function! -A performance schema instrumented wrapper function for -os_file_create_simple_no_error_handling(). Add instrumentation to -monitor file creation/open. -@param[in] key Performance Schema Key -@param[in] name name of the file or path as a null-terminated - string -@param[in] create_mode create mode -@param[in] access_type OS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or - OS_FILE_READ_ALLOW_DELETE; the last option is - used by a backup program reading the file -@param[in] read_only if true read only mode checks are enforced -@param[out] success true if succeeded -@param[in] src_file file name where func invoked -@param[in] src_line line where the func invoked -@return own: handle to the file, not defined if error, error number -can be retrieved with os_file_get_last_error */ -UNIV_INLINE -pfs_os_file_t -pfs_os_file_create_simple_no_error_handling_func( - mysql_pfs_key_t key, - const char* name, - ulint create_mode, - ulint access_type, - bool read_only, - bool* success, - const char* src_file, - uint src_line) -{ - PSI_file_locker_state state; - struct PSI_file_locker* locker = NULL; - - /* register a file open or creation depending on "create_mode" */ - register_pfs_file_open_begin( - &state, locker, key, - create_mode == OS_FILE_CREATE - ? PSI_FILE_CREATE : PSI_FILE_OPEN, - name, src_file, src_line); - - pfs_os_file_t file = os_file_create_simple_no_error_handling_func( - name, create_mode, access_type, read_only, success); - - register_pfs_file_open_end(locker, file, - (*success == TRUE ? success : 0)); - - return(file); -} - -/** NOTE! Please use the corresponding macro os_file_create(), not directly -this function! -A performance schema wrapper function for os_file_create(). -Add instrumentation to monitor file creation/open. -@param[in] key Performance Schema Key -@param[in] name name of the file or path as a null-terminated - string -@param[in] create_mode create mode -@param[in] purpose OS_FILE_AIO, if asynchronous, non-buffered I/O - is desired, OS_FILE_NORMAL, if any normal file; - NOTE that it also depends on type, os_aio_.. - and srv_.. variables whether we really us - async I/O or unbuffered I/O: look in the - function source code for the exact rules -@param[in] read_only if true read only mode checks are enforced -@param[out] success true if succeeded -@param[in] src_file file name where func invoked -@param[in] src_line line where the func invoked -@return own: handle to the file, not defined if error, error number -can be retrieved with os_file_get_last_error */ -UNIV_INLINE -pfs_os_file_t -pfs_os_file_create_func( - mysql_pfs_key_t key, - const char* name, - ulint create_mode, - ulint purpose, - ulint type, - bool read_only, - bool* success, - const char* src_file, - uint src_line) -{ - PSI_file_locker_state state; - struct PSI_file_locker* locker = NULL; - - /* register a file open or creation depending on "create_mode" */ - register_pfs_file_open_begin( - &state, locker, key, - create_mode == OS_FILE_CREATE - ? PSI_FILE_CREATE : PSI_FILE_OPEN, - name, src_file, src_line); - - pfs_os_file_t file = os_file_create_func( - name, create_mode, purpose, type, read_only, success); - - register_pfs_file_open_end(locker, file, - (*success == TRUE ? success : 0)); - - return(file); -} -/** -NOTE! Please use the corresponding macro os_file_close(), not directly -this function! -A performance schema instrumented wrapper function for os_file_close(). -@param[in] file handle to a file -@param[in] src_file file name where func invoked -@param[in] src_line line where the func invoked -@return true if success */ -UNIV_INLINE -bool -pfs_os_file_close_func( - pfs_os_file_t file, - const char* src_file, - uint src_line) -{ - PSI_file_locker_state state; - struct PSI_file_locker* locker = NULL; - - /* register the file close */ - register_pfs_file_io_begin( - &state, locker, file, 0, PSI_FILE_CLOSE, src_file, src_line); - - bool result = os_file_close_func(file); - - register_pfs_file_io_end(locker, 0); - - return(result); -} - -/** NOTE! Please use the corresponding macro os_file_read(), not directly -this function! -This is the performance schema instrumented wrapper function for -os_file_read() which requests a synchronous read operation. -@param[in] type IO request context -@param[in] file Open file handle -@param[out] buf buffer where to read -@param[in] offset file offset where to read -@param[in] n number of bytes to read -@param[in] src_file file name where func invoked -@param[in] src_line line where the func invoked -@return DB_SUCCESS if request was successful */ -UNIV_INLINE -dberr_t -pfs_os_file_read_func( - const IORequest& type, - pfs_os_file_t file, - void* buf, - os_offset_t offset, - ulint n, - const char* src_file, - uint src_line) -{ - PSI_file_locker_state state; - struct PSI_file_locker* locker = NULL; - - register_pfs_file_io_begin( - &state, locker, file, n, PSI_FILE_READ, src_file, src_line); - - dberr_t result; - - result = os_file_read_func(type, file, buf, offset, n); - - register_pfs_file_io_end(locker, n); - - return(result); -} - -/** NOTE! Please use the corresponding macro os_file_read_no_error_handling(), -not directly this function! -This is the performance schema instrumented wrapper function for -os_file_read_no_error_handling_func() which requests a synchronous -read operation. -@param[in] type IO request context -@param[in] file Open file handle -@param[out] buf buffer where to read -@param[in] offset file offset where to read -@param[in] n number of bytes to read -@param[out] o number of bytes actually read -@param[in] src_file file name where func invoked -@param[in] src_line line where the func invoked -@return DB_SUCCESS if request was successful */ -UNIV_INLINE -dberr_t -pfs_os_file_read_no_error_handling_func( - const IORequest& type, - pfs_os_file_t file, - void* buf, - os_offset_t offset, - ulint n, - ulint* o, - const char* src_file, - uint src_line) -{ - PSI_file_locker_state state; - struct PSI_file_locker* locker = NULL; - - register_pfs_file_io_begin( - &state, locker, file, n, PSI_FILE_READ, src_file, src_line); - - dberr_t result = os_file_read_no_error_handling_func( - type, file, buf, offset, n, o); - - register_pfs_file_io_end(locker, n); - - return(result); -} - -/** NOTE! Please use the corresponding macro os_file_write(), not directly -this function! -This is the performance schema instrumented wrapper function for -os_file_write() which requests a synchronous write operation. -@param[in] type IO request context -@param[in] name Name of the file or path as NUL terminated - string -@param[in] file Open file handle -@param[out] buf buffer where to read -@param[in] offset file offset where to read -@param[in] n number of bytes to read -@param[in] src_file file name where func invoked -@param[in] src_line line where the func invoked -@return error code -@retval DB_SUCCESS if the request was successfully fulfilled */ -UNIV_INLINE -dberr_t -pfs_os_file_write_func( - const IORequest& type, - const char* name, - pfs_os_file_t file, - const void* buf, - os_offset_t offset, - ulint n, - const char* src_file, - uint src_line) -{ - PSI_file_locker_state state; - struct PSI_file_locker* locker = NULL; - - register_pfs_file_io_begin( - &state, locker, file, n, PSI_FILE_WRITE, src_file, src_line); - - dberr_t result; - - result = os_file_write_func(type, name, file, buf, offset, n); - - register_pfs_file_io_end(locker, n); - - return(result); -} - - -/** NOTE! Please use the corresponding macro os_file_flush(), not directly -this function! -This is the performance schema instrumented wrapper function for -os_file_flush() which flushes the write buffers of a given file to the disk. -Flushes the write buffers of a given file to the disk. -@param[in] file Open file handle -@param[in] src_file file name where func invoked -@param[in] src_line line where the func invoked -@return TRUE if success */ -UNIV_INLINE -bool -pfs_os_file_flush_func( - pfs_os_file_t file, - const char* src_file, - uint src_line) -{ - PSI_file_locker_state state; - struct PSI_file_locker* locker = NULL; - - register_pfs_file_io_begin( - &state, locker, file, 0, PSI_FILE_SYNC, src_file, src_line); - - bool result = os_file_flush_func(file); - - register_pfs_file_io_end(locker, 0); - - return(result); -} - -/** NOTE! Please use the corresponding macro os_file_rename(), not directly -this function! -This is the performance schema instrumented wrapper function for -os_file_rename() -@param[in] key Performance Schema Key -@param[in] oldpath old file path as a null-terminated string -@param[in] newpath new file path -@param[in] src_file file name where func invoked -@param[in] src_line line where the func invoked -@return true if success */ -UNIV_INLINE -bool -pfs_os_file_rename_func( - mysql_pfs_key_t key, - const char* oldpath, - const char* newpath, - const char* src_file, - uint src_line) - -{ - PSI_file_locker_state state; - struct PSI_file_locker* locker = NULL; - - register_pfs_file_rename_begin( - &state, locker, key, PSI_FILE_RENAME, newpath, - src_file, src_line); - - bool result = os_file_rename_func(oldpath, newpath); - - register_pfs_file_rename_end(locker, oldpath, newpath, !result); - - return(result); -} - -/** NOTE! Please use the corresponding macro os_file_delete(), not directly -this function! -This is the performance schema instrumented wrapper function for -os_file_delete() -@param[in] key Performance Schema Key -@param[in] name old file path as a null-terminated string -@param[in] src_file file name where func invoked -@param[in] src_line line where the func invoked -@return true if success */ -UNIV_INLINE -bool -pfs_os_file_delete_func( - mysql_pfs_key_t key, - const char* name, - const char* src_file, - uint src_line) -{ - PSI_file_locker_state state; - struct PSI_file_locker* locker = NULL; - - register_pfs_file_close_begin( - &state, locker, key, PSI_FILE_DELETE, name, src_file, src_line); - - bool result = os_file_delete_func(name); - - register_pfs_file_close_end(locker, 0); - - return(result); -} - -/** -NOTE! Please use the corresponding macro os_file_delete_if_exists(), not -directly this function! -This is the performance schema instrumented wrapper function for -os_file_delete_if_exists() -@param[in] key Performance Schema Key -@param[in] name old file path as a null-terminated string -@param[in] exist indicate if file pre-exist -@param[in] src_file file name where func invoked -@param[in] src_line line where the func invoked -@return true if success */ -UNIV_INLINE -bool -pfs_os_file_delete_if_exists_func( - mysql_pfs_key_t key, - const char* name, - bool* exist, - const char* src_file, - uint src_line) -{ - PSI_file_locker_state state; - struct PSI_file_locker* locker = NULL; - - register_pfs_file_close_begin( - &state, locker, key, PSI_FILE_DELETE, name, src_file, src_line); - - bool result = os_file_delete_if_exists_func(name, exist); - - register_pfs_file_close_end(locker, 0); - - return(result); -} -#endif /* UNIV_PFS_IO */ diff --git a/storage/innobase/include/os0file.inl b/storage/innobase/include/os0file.inl new file mode 100644 index 0000000000000..7de3150540d2c --- /dev/null +++ b/storage/innobase/include/os0file.inl @@ -0,0 +1,412 @@ +/***************************************************************************** + +Copyright (c) 2010, 2017, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2013, 2022, 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 02110-1335 USA + +*****************************************************************************/ + +/**************************************************//** +@file include/os0file.ic +The interface to the operating system file io + +Created 2/20/2010 Jimmy Yang +*******************************************************/ + +#ifdef UNIV_PFS_IO +/** NOTE! Please use the corresponding macro os_file_create_simple(), +not directly this function! +A performance schema instrumented wrapper function for +os_file_create_simple() which opens or creates a file. +@param[in] key Performance Schema Key +@param[in] name name of the file or path as a null-terminated + string +@param[in] create_mode create mode +@param[in] access_type OS_FILE_READ_ONLY or OS_FILE_READ_WRITE +@param[in] read_only if true read only mode checks are enforced +@param[out] success true if succeeded +@param[in] src_file file name where func invoked +@param[in] src_line line where the func invoked +@return own: handle to the file, not defined if error, error number +can be retrieved with os_file_get_last_error */ +UNIV_INLINE +pfs_os_file_t +pfs_os_file_create_simple_func( + mysql_pfs_key_t key, + const char* name, + ulint create_mode, + ulint access_type, + bool read_only, + bool* success, + const char* src_file, + uint src_line) +{ + PSI_file_locker_state state; + struct PSI_file_locker* locker = NULL; + + /* register a file open or creation depending on "create_mode" */ + register_pfs_file_open_begin( + &state, locker, key, + (create_mode == OS_FILE_CREATE) + ? PSI_FILE_CREATE : PSI_FILE_OPEN, + name, src_file, src_line); + + pfs_os_file_t file = os_file_create_simple_func( + name, create_mode, access_type, read_only, success); + + /* Register psi value for the file */ + register_pfs_file_open_end(locker, file, + (*success == TRUE ? success : 0)); + + return(file); +} + +/** NOTE! Please use the corresponding macro +os_file_create_simple_no_error_handling(), not directly this function! +A performance schema instrumented wrapper function for +os_file_create_simple_no_error_handling(). Add instrumentation to +monitor file creation/open. +@param[in] key Performance Schema Key +@param[in] name name of the file or path as a null-terminated + string +@param[in] create_mode create mode +@param[in] access_type OS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or + OS_FILE_READ_ALLOW_DELETE; the last option is + used by a backup program reading the file +@param[in] read_only if true read only mode checks are enforced +@param[out] success true if succeeded +@param[in] src_file file name where func invoked +@param[in] src_line line where the func invoked +@return own: handle to the file, not defined if error, error number +can be retrieved with os_file_get_last_error */ +UNIV_INLINE +pfs_os_file_t +pfs_os_file_create_simple_no_error_handling_func( + mysql_pfs_key_t key, + const char* name, + ulint create_mode, + ulint access_type, + bool read_only, + bool* success, + const char* src_file, + uint src_line) +{ + PSI_file_locker_state state; + struct PSI_file_locker* locker = NULL; + + /* register a file open or creation depending on "create_mode" */ + register_pfs_file_open_begin( + &state, locker, key, + create_mode == OS_FILE_CREATE + ? PSI_FILE_CREATE : PSI_FILE_OPEN, + name, src_file, src_line); + + pfs_os_file_t file = os_file_create_simple_no_error_handling_func( + name, create_mode, access_type, read_only, success); + + register_pfs_file_open_end(locker, file, + (*success == TRUE ? success : 0)); + + return(file); +} + +/** NOTE! Please use the corresponding macro os_file_create(), not directly +this function! +A performance schema wrapper function for os_file_create(). +Add instrumentation to monitor file creation/open. +@param[in] key Performance Schema Key +@param[in] name name of the file or path as a null-terminated + string +@param[in] create_mode create mode +@param[in] purpose OS_FILE_AIO, if asynchronous, non-buffered I/O + is desired, OS_FILE_NORMAL, if any normal file; + NOTE that it also depends on type, os_aio_.. + and srv_.. variables whether we really us + async I/O or unbuffered I/O: look in the + function source code for the exact rules +@param[in] read_only if true read only mode checks are enforced +@param[out] success true if succeeded +@param[in] src_file file name where func invoked +@param[in] src_line line where the func invoked +@return own: handle to the file, not defined if error, error number +can be retrieved with os_file_get_last_error */ +UNIV_INLINE +pfs_os_file_t +pfs_os_file_create_func( + mysql_pfs_key_t key, + const char* name, + ulint create_mode, + ulint purpose, + ulint type, + bool read_only, + bool* success, + const char* src_file, + uint src_line) +{ + PSI_file_locker_state state; + struct PSI_file_locker* locker = NULL; + + /* register a file open or creation depending on "create_mode" */ + register_pfs_file_open_begin( + &state, locker, key, + create_mode == OS_FILE_CREATE + ? PSI_FILE_CREATE : PSI_FILE_OPEN, + name, src_file, src_line); + + pfs_os_file_t file = os_file_create_func( + name, create_mode, purpose, type, read_only, success); + + register_pfs_file_open_end(locker, file, + (*success == TRUE ? success : 0)); + + return(file); +} +/** +NOTE! Please use the corresponding macro os_file_close(), not directly +this function! +A performance schema instrumented wrapper function for os_file_close(). +@param[in] file handle to a file +@param[in] src_file file name where func invoked +@param[in] src_line line where the func invoked +@return true if success */ +UNIV_INLINE +bool +pfs_os_file_close_func( + pfs_os_file_t file, + const char* src_file, + uint src_line) +{ + PSI_file_locker_state state; + struct PSI_file_locker* locker = NULL; + + /* register the file close */ + register_pfs_file_io_begin( + &state, locker, file, 0, PSI_FILE_CLOSE, src_file, src_line); + + bool result = os_file_close_func(file); + + register_pfs_file_io_end(locker, 0); + + return(result); +} + +/** NOTE! Please use the corresponding macro os_file_read(), not directly +this function! +This is the performance schema instrumented wrapper function for +os_file_read() which requests a synchronous read operation. +@param[in] type IO request context +@param[in] file Open file handle +@param[out] buf buffer where to read +@param[in] offset file offset where to read +@param[in] n number of bytes to read +@param[out] o number of bytes actually read +@param[in] src_file file name where func invoked +@param[in] src_line line where the func invoked +@return DB_SUCCESS if request was successful */ +UNIV_INLINE +dberr_t +pfs_os_file_read_func( + const IORequest& type, + pfs_os_file_t file, + void* buf, + os_offset_t offset, + ulint n, + ulint* o, + const char* src_file, + uint src_line) +{ + PSI_file_locker_state state; + struct PSI_file_locker* locker = NULL; + + register_pfs_file_io_begin( + &state, locker, file, n, PSI_FILE_READ, src_file, src_line); + + dberr_t result; + + result = os_file_read_func(type, file, buf, offset, n, o); + + register_pfs_file_io_end(locker, n); + + return(result); +} + +/** NOTE! Please use the corresponding macro os_file_write(), not directly +this function! +This is the performance schema instrumented wrapper function for +os_file_write() which requests a synchronous write operation. +@param[in] type IO request context +@param[in] name Name of the file or path as NUL terminated + string +@param[in] file Open file handle +@param[out] buf buffer where to read +@param[in] offset file offset where to read +@param[in] n number of bytes to read +@param[in] src_file file name where func invoked +@param[in] src_line line where the func invoked +@return error code +@retval DB_SUCCESS if the request was successfully fulfilled */ +UNIV_INLINE +dberr_t +pfs_os_file_write_func( + const IORequest& type, + const char* name, + pfs_os_file_t file, + const void* buf, + os_offset_t offset, + ulint n, + const char* src_file, + uint src_line) +{ + PSI_file_locker_state state; + struct PSI_file_locker* locker = NULL; + + register_pfs_file_io_begin( + &state, locker, file, n, PSI_FILE_WRITE, src_file, src_line); + + dberr_t result; + + result = os_file_write_func(type, name, file, buf, offset, n); + + register_pfs_file_io_end(locker, n); + + return(result); +} + + +/** NOTE! Please use the corresponding macro os_file_flush(), not directly +this function! +This is the performance schema instrumented wrapper function for +os_file_flush() which flushes the write buffers of a given file to the disk. +Flushes the write buffers of a given file to the disk. +@param[in] file Open file handle +@param[in] src_file file name where func invoked +@param[in] src_line line where the func invoked +@return TRUE if success */ +UNIV_INLINE +bool +pfs_os_file_flush_func( + pfs_os_file_t file, + const char* src_file, + uint src_line) +{ + PSI_file_locker_state state; + struct PSI_file_locker* locker = NULL; + + register_pfs_file_io_begin( + &state, locker, file, 0, PSI_FILE_SYNC, src_file, src_line); + + bool result = os_file_flush_func(file); + + register_pfs_file_io_end(locker, 0); + + return(result); +} + +/** NOTE! Please use the corresponding macro os_file_rename(), not directly +this function! +This is the performance schema instrumented wrapper function for +os_file_rename() +@param[in] key Performance Schema Key +@param[in] oldpath old file path as a null-terminated string +@param[in] newpath new file path +@param[in] src_file file name where func invoked +@param[in] src_line line where the func invoked +@return true if success */ +UNIV_INLINE +bool +pfs_os_file_rename_func( + mysql_pfs_key_t key, + const char* oldpath, + const char* newpath, + const char* src_file, + uint src_line) + +{ + PSI_file_locker_state state; + struct PSI_file_locker* locker = NULL; + + register_pfs_file_rename_begin( + &state, locker, key, PSI_FILE_RENAME, newpath, + src_file, src_line); + + bool result = os_file_rename_func(oldpath, newpath); + + register_pfs_file_rename_end(locker, oldpath, newpath, !result); + + return(result); +} + +/** NOTE! Please use the corresponding macro os_file_delete(), not directly +this function! +This is the performance schema instrumented wrapper function for +os_file_delete() +@param[in] key Performance Schema Key +@param[in] name old file path as a null-terminated string +@param[in] src_file file name where func invoked +@param[in] src_line line where the func invoked +@return true if success */ +UNIV_INLINE +bool +pfs_os_file_delete_func( + mysql_pfs_key_t key, + const char* name, + const char* src_file, + uint src_line) +{ + PSI_file_locker_state state; + struct PSI_file_locker* locker = NULL; + + register_pfs_file_close_begin( + &state, locker, key, PSI_FILE_DELETE, name, src_file, src_line); + + bool result = os_file_delete_func(name); + + register_pfs_file_close_end(locker, 0); + + return(result); +} + +/** +NOTE! Please use the corresponding macro os_file_delete_if_exists(), not +directly this function! +This is the performance schema instrumented wrapper function for +os_file_delete_if_exists() +@param[in] key Performance Schema Key +@param[in] name old file path as a null-terminated string +@param[in] exist indicate if file pre-exist +@param[in] src_file file name where func invoked +@param[in] src_line line where the func invoked +@return true if success */ +UNIV_INLINE +bool +pfs_os_file_delete_if_exists_func( + mysql_pfs_key_t key, + const char* name, + bool* exist, + const char* src_file, + uint src_line) +{ + PSI_file_locker_state state; + struct PSI_file_locker* locker = NULL; + + register_pfs_file_close_begin( + &state, locker, key, PSI_FILE_DELETE, name, src_file, src_line); + + bool result = os_file_delete_if_exists_func(name, exist); + + register_pfs_file_close_end(locker, 0); + + return(result); +} +#endif /* UNIV_PFS_IO */ diff --git a/storage/innobase/include/os0thread.h b/storage/innobase/include/os0thread.h deleted file mode 100644 index b2971462a7037..0000000000000 --- a/storage/innobase/include/os0thread.h +++ /dev/null @@ -1,42 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, 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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/os0thread.h -The interface to the operating system -process and thread control primitives - -Created 9/8/1995 Heikki Tuuri -*******************************************************/ - -#pragma once -#include "univ.i" - -#ifdef _WIN32 -typedef DWORD os_thread_id_t; /*!< In Windows the thread id - is an unsigned long int */ -#else - -typedef pthread_t os_thread_id_t; /*!< In Unix we use the thread - handle itself as the id of - the thread */ -#endif /* _WIN32 */ - -#define os_thread_eq(a,b) IF_WIN(a == b, pthread_equal(a, b)) -#define os_thread_get_curr_id() IF_WIN(GetCurrentThreadId(), pthread_self()) diff --git a/storage/innobase/include/page0cur.h b/storage/innobase/include/page0cur.h index c0f3bf6866e07..28aa30565e46a 100644 --- a/storage/innobase/include/page0cur.h +++ b/storage/innobase/include/page0cur.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2021, MariaDB Corporation. +Copyright (c) 2018, 2022, 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 @@ -54,14 +54,11 @@ page_zip_des_t* page_cur_get_page_zip( /*==================*/ page_cur_t* cur); /*!< in: page cursor */ -/*********************************************************//** -Gets the record where the cursor is positioned. +/* Gets the record where the cursor is positioned. +@param cur page cursor @return record */ UNIV_INLINE -rec_t* -page_cur_get_rec( -/*=============*/ - page_cur_t* cur); /*!< in: page cursor */ +rec_t *page_cur_get_rec(const page_cur_t *cur); #else /* UNIV_DEBUG */ # define page_cur_get_page(cur) page_align((cur)->rec) # define page_cur_get_block(cur) (cur)->block @@ -113,20 +110,6 @@ page_cur_position( const buf_block_t* block, /*!< in: buffer block containing the record */ page_cur_t* cur); /*!< out: page cursor */ -/**********************************************************//** -Moves the cursor to the next record on page. */ -UNIV_INLINE -void -page_cur_move_to_next( -/*==================*/ - page_cur_t* cur); /*!< in/out: cursor; must not be after last */ -/**********************************************************//** -Moves the cursor to the previous record on page. */ -UNIV_INLINE -void -page_cur_move_to_prev( -/*==================*/ - page_cur_t* cur); /*!< in/out: cursor; not before first */ /***********************************************************//** Inserts a record next to page cursor. Returns pointer to inserted record if @@ -146,7 +129,6 @@ page_cur_tuple_insert( /*==================*/ page_cur_t* cursor, /*!< in/out: a page cursor */ const dtuple_t* tuple, /*!< in: pointer to a data tuple */ - dict_index_t* index, /*!< in: record descriptor */ rec_offs** offsets,/*!< out: offsets on *rec */ mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ ulint n_ext, /*!< in: number of externally stored columns */ @@ -154,14 +136,12 @@ page_cur_tuple_insert( MY_ATTRIBUTE((nonnull, warn_unused_result)); /***********************************************************//** Inserts a record next to page cursor on an uncompressed page. -Returns pointer to inserted record if succeed, i.e., enough -space available, NULL otherwise. The cursor stays at the same position. -@return pointer to record if succeed, NULL otherwise */ +@return pointer to record +@retval nullptr if not enough space was available */ rec_t* page_cur_insert_rec_low( /*====================*/ const page_cur_t*cur, /*!< in: page cursor */ - dict_index_t* index, /*!< in: record descriptor */ const rec_t* rec, /*!< in: record to insert after cur */ rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */ mtr_t* mtr) /*!< in/out: mini-transaction */ @@ -169,21 +149,20 @@ page_cur_insert_rec_low( /***********************************************************//** Inserts a record next to page cursor on a compressed and uncompressed -page. Returns pointer to inserted record if succeed, i.e., -enough space available, NULL otherwise. -The cursor stays at the same position. +page. IMPORTANT: The caller will have to update IBUF_BITMAP_FREE if this is a compressed leaf page in a secondary index. This has to be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit(). -@return pointer to record if succeed, NULL otherwise */ +@return pointer to inserted record +@return nullptr on failure */ rec_t* page_cur_insert_rec_zip( /*====================*/ - page_cur_t* cursor, /*!< in/out: page cursor */ - dict_index_t* index, /*!< in: record descriptor */ + page_cur_t* cursor, /*!< in/out: page cursor, + logical position unchanged */ const rec_t* rec, /*!< in: pointer to a physical record */ rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */ mtr_t* mtr) /*!< in/out: mini-transaction */ @@ -195,7 +174,6 @@ void page_cur_delete_rec( /*================*/ page_cur_t* cursor, /*!< in/out: a page cursor */ - const dict_index_t* index, /*!< in: record descriptor */ const rec_offs* offsets,/*!< in: rec_get_offsets( cursor->rec, index) */ mtr_t* mtr) /*!< in/out: mini-transaction */ @@ -251,43 +229,12 @@ page_cur_delete_rec() for a ROW_FORMAT=COMPACT or DYNAMIC page. bool page_apply_delete_dynamic(const buf_block_t &block, ulint prev, size_t hdr_size, size_t data_size); -/** Search the right position for a page cursor. -@param[in] block buffer block -@param[in] index index tree -@param[in] tuple data tuple -@param[in] mode PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G, or PAGE_CUR_GE -@param[out] cursor page cursor -@return number of matched fields on the left */ -UNIV_INLINE -ulint -page_cur_search( - const buf_block_t* block, - const dict_index_t* index, - const dtuple_t* tuple, - page_cur_mode_t mode, - page_cur_t* cursor); - -/** Search the right position for a page cursor. -@param[in] block buffer block -@param[in] index index tree -@param[in] tuple data tuple -@param[out] cursor page cursor -@return number of matched fields on the left */ -UNIV_INLINE -ulint -page_cur_search( - const buf_block_t* block, - const dict_index_t* index, - const dtuple_t* tuple, - page_cur_t* cursor); - +MY_ATTRIBUTE((warn_unused_result)) /****************************************************************//** Searches the right position for a page cursor. */ -void +bool page_cur_search_with_match( /*=======================*/ - const buf_block_t* block, /*!< in: buffer block */ - const dict_index_t* index, /*!< in: record descriptor */ const dtuple_t* tuple, /*!< in: data tuple */ page_cur_mode_t mode, /*!< in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G, or @@ -298,12 +245,11 @@ page_cur_search_with_match( ulint* ilow_matched_fields, /*!< in/out: already matched fields in lower limit record */ - page_cur_t* cursor, /*!< out: page cursor */ + page_cur_t* cursor, /*!< in/out: page cursor */ rtr_info_t* rtr_info);/*!< in/out: rtree search stack */ #ifdef BTR_CUR_HASH_ADAPT +MY_ATTRIBUTE((warn_unused_result)) /** Search the right position for a page cursor. -@param[in] block buffer block -@param[in] index index tree @param[in] tuple key to be searched for @param[in] mode search mode @param[in,out] iup_matched_fields already matched fields in the @@ -314,11 +260,9 @@ first partially matched field in the upper limit record lower limit record @param[in,out] ilow_matched_bytes already matched bytes in the first partially matched field in the lower limit record -@param[out] cursor page cursor */ -void +@param[in,out] cursor page cursor */ +bool page_cur_search_with_match_bytes( - const buf_block_t* block, - const dict_index_t* index, const dtuple_t* tuple, page_cur_mode_t mode, ulint* iup_matched_fields, @@ -330,21 +274,30 @@ page_cur_search_with_match_bytes( /***********************************************************//** Positions a page cursor on a randomly chosen user record on a page. If there are no user records, sets the cursor on the infimum record. */ -void -page_cur_open_on_rnd_user_rec( -/*==========================*/ - buf_block_t* block, /*!< in: page */ - page_cur_t* cursor);/*!< out: page cursor */ +void page_cur_open_on_rnd_user_rec(page_cur_t *cursor); /** Index page cursor */ struct page_cur_t{ - const dict_index_t* index; + dict_index_t* index; rec_t* rec; /*!< pointer to a record on page */ rec_offs* offsets; buf_block_t* block; /*!< pointer to the block containing rec */ }; -#include "page0cur.ic" + +MY_ATTRIBUTE((nonnull, warn_unused_result)) +inline rec_t *page_cur_move_to_next(page_cur_t *cur) +{ + return cur->rec= page_rec_get_next(cur->rec); +} + +MY_ATTRIBUTE((nonnull, warn_unused_result)) +inline rec_t *page_cur_move_to_prev(page_cur_t *cur) +{ + return cur->rec= page_rec_get_prev(cur->rec); +} + +#include "page0cur.inl" #endif diff --git a/storage/innobase/include/page0cur.ic b/storage/innobase/include/page0cur.ic deleted file mode 100644 index 5ee96dd716ddf..0000000000000 --- a/storage/innobase/include/page0cur.ic +++ /dev/null @@ -1,277 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2021, 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 02110-1335 USA - -*****************************************************************************/ - -/********************************************************************//** -@file include/page0cur.ic -The page cursor - -Created 10/4/1994 Heikki Tuuri -*************************************************************************/ - -#ifdef UNIV_DEBUG -/*********************************************************//** -Gets pointer to the page frame where the cursor is positioned. -@return page */ -UNIV_INLINE -page_t* -page_cur_get_page( -/*==============*/ - page_cur_t* cur) /*!< in: page cursor */ -{ - return page_align(page_cur_get_rec(cur)); -} - -/*********************************************************//** -Gets pointer to the buffer block where the cursor is positioned. -@return page */ -UNIV_INLINE -buf_block_t* -page_cur_get_block( -/*===============*/ - page_cur_t* cur) /*!< in: page cursor */ -{ - ut_ad(cur); - ut_ad(!cur->rec || page_align(cur->rec) == cur->block->page.frame); - return cur->block; -} - -/*********************************************************//** -Gets pointer to the page frame where the cursor is positioned. -@return page */ -UNIV_INLINE -page_zip_des_t* -page_cur_get_page_zip( -/*==================*/ - page_cur_t* cur) /*!< in: page cursor */ -{ - return(buf_block_get_page_zip(page_cur_get_block(cur))); -} - -/*********************************************************//** -Gets the record where the cursor is positioned. -@return record */ -UNIV_INLINE -rec_t* -page_cur_get_rec( -/*=============*/ - page_cur_t* cur) /*!< in: page cursor */ -{ - ut_ad(cur); - ut_ad(!cur->rec || page_align(cur->rec) == cur->block->page.frame); - return cur->rec; -} -#endif /* UNIV_DEBUG */ - -/*********************************************************//** -Sets the cursor object to point before the first user record -on the page. */ -UNIV_INLINE -void -page_cur_set_before_first( -/*======================*/ - const buf_block_t* block, /*!< in: index page */ - page_cur_t* cur) /*!< in: cursor */ -{ - cur->block = const_cast(block); - cur->rec = page_get_infimum_rec(buf_block_get_frame(cur->block)); -} - -/*********************************************************//** -Sets the cursor object to point after the last user record on -the page. */ -UNIV_INLINE -void -page_cur_set_after_last( -/*====================*/ - const buf_block_t* block, /*!< in: index page */ - page_cur_t* cur) /*!< in: cursor */ -{ - cur->block = const_cast(block); - cur->rec = page_get_supremum_rec(buf_block_get_frame(cur->block)); -} - -/*********************************************************//** -Returns TRUE if the cursor is before first user record on page. -@return TRUE if at start */ -UNIV_INLINE -ibool -page_cur_is_before_first( -/*=====================*/ - const page_cur_t* cur) /*!< in: cursor */ -{ - ut_ad(cur); - ut_ad(page_align(cur->rec) == cur->block->page.frame); - return(page_rec_is_infimum(cur->rec)); -} - -/*********************************************************//** -Returns TRUE if the cursor is after last user record. -@return TRUE if at end */ -UNIV_INLINE -ibool -page_cur_is_after_last( -/*===================*/ - const page_cur_t* cur) /*!< in: cursor */ -{ - ut_ad(cur); - ut_ad(page_align(cur->rec) == cur->block->page.frame); - return(page_rec_is_supremum(cur->rec)); -} - -/**********************************************************//** -Positions the cursor on the given record. */ -UNIV_INLINE -void -page_cur_position( -/*==============*/ - const rec_t* rec, /*!< in: record on a page */ - const buf_block_t* block, /*!< in: buffer block containing - the record */ - page_cur_t* cur) /*!< out: page cursor */ -{ - ut_ad(rec && block && cur); - ut_ad(page_align(rec) == block->page.frame); - - cur->rec = (rec_t*) rec; - cur->block = (buf_block_t*) block; -} - -/**********************************************************//** -Moves the cursor to the next record on page. */ -UNIV_INLINE -void -page_cur_move_to_next( -/*==================*/ - page_cur_t* cur) /*!< in/out: cursor; must not be after last */ -{ - ut_ad(!page_cur_is_after_last(cur)); - - cur->rec = page_rec_get_next(cur->rec); -} - -/**********************************************************//** -Moves the cursor to the previous record on page. */ -UNIV_INLINE -void -page_cur_move_to_prev( -/*==================*/ - page_cur_t* cur) /*!< in/out: page cursor, not before first */ -{ - ut_ad(!page_cur_is_before_first(cur)); - - cur->rec = page_rec_get_prev(cur->rec); -} - -/** Search the right position for a page cursor. -@param[in] block buffer block -@param[in] index index tree -@param[in] tuple data tuple -@param[in] mode PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G, or PAGE_CUR_GE -@param[out] cursor page cursor -@return number of matched fields on the left */ -UNIV_INLINE -ulint -page_cur_search( - const buf_block_t* block, - const dict_index_t* index, - const dtuple_t* tuple, - page_cur_mode_t mode, - page_cur_t* cursor) -{ - ulint low_match = 0; - ulint up_match = 0; - - ut_ad(dtuple_check_typed(tuple)); - - page_cur_search_with_match(block, index, tuple, mode, - &up_match, &low_match, cursor, NULL); - return(low_match); -} - -/** Search the right position for a page cursor. -@param[in] block buffer block -@param[in] index index tree -@param[in] tuple data tuple -@param[out] cursor page cursor -@return number of matched fields on the left */ -UNIV_INLINE -ulint -page_cur_search( - const buf_block_t* block, - const dict_index_t* index, - const dtuple_t* tuple, - page_cur_t* cursor) -{ - return(page_cur_search(block, index, tuple, PAGE_CUR_LE, cursor)); -} - -/***********************************************************//** -Inserts a record next to page cursor. Returns pointer to inserted record if -succeed, i.e., enough space available, NULL otherwise. The cursor stays at -the same logical position, but the physical position may change if it is -pointing to a compressed page that was reorganized. - -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if this is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). - -@return pointer to record if succeed, NULL otherwise */ -UNIV_INLINE -rec_t* -page_cur_tuple_insert( -/*==================*/ - page_cur_t* cursor, /*!< in/out: a page cursor */ - const dtuple_t* tuple, /*!< in: pointer to a data tuple */ - dict_index_t* index, /*!< in: record descriptor */ - rec_offs** offsets,/*!< out: offsets on *rec */ - mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ - ulint n_ext, /*!< in: number of externally stored columns */ - mtr_t* mtr) /*!< in/out: mini-transaction */ -{ - rec_t* rec; - ulint size = rec_get_converted_size(index, tuple, n_ext); - - if (!*heap) { - *heap = mem_heap_create(size - + (4 + REC_OFFS_HEADER_SIZE - + dtuple_get_n_fields(tuple)) - * sizeof **offsets); - } - - rec = rec_convert_dtuple_to_rec((byte*) mem_heap_alloc(*heap, size), - index, tuple, n_ext); - - *offsets = rec_get_offsets(rec, index, *offsets, - page_is_leaf(cursor->block->page.frame) - ? index->n_core_fields : 0, - ULINT_UNDEFINED, heap); - ut_ad(size == rec_offs_size(*offsets)); - - if (is_buf_block_get_page_zip(cursor->block)) { - rec = page_cur_insert_rec_zip( - cursor, index, rec, *offsets, mtr); - } else { - rec = page_cur_insert_rec_low(cursor, - index, rec, *offsets, mtr); - } - - ut_ad(!rec || !cmp_dtuple_rec(tuple, rec, *offsets)); - return(rec); -} diff --git a/storage/innobase/include/page0cur.inl b/storage/innobase/include/page0cur.inl new file mode 100644 index 0000000000000..7c4eafa266a88 --- /dev/null +++ b/storage/innobase/include/page0cur.inl @@ -0,0 +1,203 @@ +/***************************************************************************** + +Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2015, 2022, 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 02110-1335 USA + +*****************************************************************************/ + +/********************************************************************//** +@file include/page0cur.ic +The page cursor + +Created 10/4/1994 Heikki Tuuri +*************************************************************************/ + +#ifdef UNIV_DEBUG +/*********************************************************//** +Gets pointer to the page frame where the cursor is positioned. +@return page */ +UNIV_INLINE +page_t* +page_cur_get_page( +/*==============*/ + page_cur_t* cur) /*!< in: page cursor */ +{ + return page_align(page_cur_get_rec(cur)); +} + +/*********************************************************//** +Gets pointer to the buffer block where the cursor is positioned. +@return page */ +UNIV_INLINE +buf_block_t* +page_cur_get_block( +/*===============*/ + page_cur_t* cur) /*!< in: page cursor */ +{ + ut_ad(cur); + ut_ad(!cur->rec || page_align(cur->rec) == cur->block->page.frame); + return cur->block; +} + +/*********************************************************//** +Gets pointer to the page frame where the cursor is positioned. +@return page */ +UNIV_INLINE +page_zip_des_t* +page_cur_get_page_zip( +/*==================*/ + page_cur_t* cur) /*!< in: page cursor */ +{ + return(buf_block_get_page_zip(page_cur_get_block(cur))); +} + +/* Gets the record where the cursor is positioned. +@param cur page cursor +@return record */ +UNIV_INLINE +rec_t *page_cur_get_rec(const page_cur_t *cur) +{ + ut_ad(cur); + ut_ad(!cur->rec || page_align(cur->rec) == cur->block->page.frame); + return cur->rec; +} +#endif /* UNIV_DEBUG */ + +/*********************************************************//** +Sets the cursor object to point before the first user record +on the page. */ +UNIV_INLINE +void +page_cur_set_before_first( +/*======================*/ + const buf_block_t* block, /*!< in: index page */ + page_cur_t* cur) /*!< in: cursor */ +{ + cur->block = const_cast(block); + cur->rec = page_get_infimum_rec(buf_block_get_frame(cur->block)); +} + +/*********************************************************//** +Sets the cursor object to point after the last user record on +the page. */ +UNIV_INLINE +void +page_cur_set_after_last( +/*====================*/ + const buf_block_t* block, /*!< in: index page */ + page_cur_t* cur) /*!< in: cursor */ +{ + cur->block = const_cast(block); + cur->rec = page_get_supremum_rec(buf_block_get_frame(cur->block)); +} + +/*********************************************************//** +Returns TRUE if the cursor is before first user record on page. +@return TRUE if at start */ +UNIV_INLINE +ibool +page_cur_is_before_first( +/*=====================*/ + const page_cur_t* cur) /*!< in: cursor */ +{ + ut_ad(cur); + ut_ad(page_align(cur->rec) == cur->block->page.frame); + return(page_rec_is_infimum(cur->rec)); +} + +/*********************************************************//** +Returns TRUE if the cursor is after last user record. +@return TRUE if at end */ +UNIV_INLINE +ibool +page_cur_is_after_last( +/*===================*/ + const page_cur_t* cur) /*!< in: cursor */ +{ + ut_ad(cur); + ut_ad(page_align(cur->rec) == cur->block->page.frame); + return(page_rec_is_supremum(cur->rec)); +} + +/**********************************************************//** +Positions the cursor on the given record. */ +UNIV_INLINE +void +page_cur_position( +/*==============*/ + const rec_t* rec, /*!< in: record on a page */ + const buf_block_t* block, /*!< in: buffer block containing + the record */ + page_cur_t* cur) /*!< out: page cursor */ +{ + ut_ad(rec && block && cur); + ut_ad(page_align(rec) == block->page.frame); + + cur->rec = (rec_t*) rec; + cur->block = (buf_block_t*) block; +} + +/***********************************************************//** +Inserts a record next to page cursor. Returns pointer to inserted record if +succeed, i.e., enough space available, NULL otherwise. The cursor stays at +the same logical position, but the physical position may change if it is +pointing to a compressed page that was reorganized. + +IMPORTANT: The caller will have to update IBUF_BITMAP_FREE +if this is a compressed leaf page in a secondary index. +This has to be done either within the same mini-transaction, +or by invoking ibuf_reset_free_bits() before mtr_commit(). + +@return pointer to record if succeed, NULL otherwise */ +UNIV_INLINE +rec_t* +page_cur_tuple_insert( +/*==================*/ + page_cur_t* cursor, /*!< in/out: a page cursor */ + const dtuple_t* tuple, /*!< in: pointer to a data tuple */ + rec_offs** offsets,/*!< out: offsets on *rec */ + mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ + ulint n_ext, /*!< in: number of externally stored columns */ + mtr_t* mtr) /*!< in/out: mini-transaction */ +{ + ulint size = rec_get_converted_size(cursor->index, tuple, n_ext); + + if (!*heap) { + *heap = mem_heap_create(size + + (4 + REC_OFFS_HEADER_SIZE + + dtuple_get_n_fields(tuple)) + * sizeof **offsets); + } + + rec_t* rec = rec_convert_dtuple_to_rec( + static_cast(mem_heap_alloc(*heap, size)), + cursor->index, tuple, n_ext); + + *offsets = rec_get_offsets(rec, cursor->index, *offsets, + page_is_leaf(cursor->block->page.frame) + ? cursor->index->n_core_fields : 0, + ULINT_UNDEFINED, heap); + ut_ad(size == rec_offs_size(*offsets)); + + if (is_buf_block_get_page_zip(cursor->block)) { + rec = page_cur_insert_rec_zip(cursor, rec, *offsets, mtr); + } else { + rec = page_cur_insert_rec_low(cursor, rec, *offsets, mtr); + } + + ut_ad(!rec || !cmp_dtuple_rec(tuple, rec, cursor->index, *offsets)); + return(rec); +} + diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index 41e46c2d0518d..2978656b508f4 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -1,6 +1,6 @@ /***************************************************************************** Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2022, 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 @@ -534,7 +534,8 @@ inline void page_header_reset_last_insert(buf_block_t *block, mtr_t *mtr) /************************************************************//** Returns the nth record of the record list. This is the inverse function of page_rec_get_n_recs_before(). -@return nth record */ +@return nth record +@retval nullptr on corrupted page */ const rec_t* page_rec_get_nth_const( /*===================*/ @@ -544,14 +545,12 @@ page_rec_get_nth_const( /************************************************************//** Returns the nth record of the record list. This is the inverse function of page_rec_get_n_recs_before(). -@return nth record */ -UNIV_INLINE -rec_t* -page_rec_get_nth( -/*=============*/ - page_t* page, /*< in: page */ - ulint nth) /*!< in: nth record */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); +@return nth record +@retval nullptr on corrupted page */ +inline rec_t *page_rec_get_nth(page_t* page, ulint nth) +{ + return const_cast(page_rec_get_nth_const(page, nth)); +} /************************************************************//** Returns the middle record of the records on the page. If there is an @@ -592,15 +591,11 @@ page_get_n_recs( /*============*/ const page_t* page); /*!< in: index page */ -/***************************************************************//** -Returns the number of records before the given record in chain. -The number includes infimum and supremum records. -This is the inverse function of page_rec_get_nth(). -@return number of records */ -ulint -page_rec_get_n_recs_before( -/*=======================*/ - const rec_t* rec); /*!< in: the physical record */ +/** Return the number of preceding records in an index page. +@param rec index record +@return number of preceding records, including the infimum pseudo-record +@retval ULINT_UNDEFINED on corrupted page */ +ulint page_rec_get_n_recs_before(const rec_t *rec); /*************************************************************//** Gets the number of records in the heap. @return number of user records */ @@ -649,6 +644,23 @@ inline const rec_t *page_dir_slot_get_rec(const page_dir_slot_t *slot) { return page_dir_slot_get_rec(const_cast(slot)); } + +inline rec_t *page_dir_slot_get_rec_validate(page_dir_slot_t *slot) +{ + const size_t s= mach_read_from_2(my_assume_aligned<2>(slot)); + page_t *page= page_align(slot); + + return UNIV_LIKELY(s >= PAGE_NEW_INFIMUM && + s <= page_header_get_field(page, PAGE_HEAP_TOP)) + ? page + s + : nullptr; +} +inline const rec_t *page_dir_slot_get_rec_validate(const page_dir_slot_t *slot) +{ + return page_dir_slot_get_rec_validate(const_cast(slot)); +} + + /***************************************************************//** Gets the number of records owned by a directory slot. @return number of records */ @@ -669,7 +681,8 @@ page_dir_calc_reserved_space( ulint n_recs); /*!< in: number of records */ /***************************************************************//** Looks for the directory slot which owns the given record. -@return the directory slot number */ +@return the directory slot number +@retval ULINT_UNDEFINED on corruption */ ulint page_dir_find_owner_slot( /*=====================*/ @@ -752,19 +765,9 @@ page_rec_get_next_const( /*====================*/ const rec_t* rec); /*!< in: pointer to record */ /************************************************************//** -Gets the pointer to the next non delete-marked record on the page. -If all subsequent records are delete-marked, then this function -will return the supremum record. -@return pointer to next non delete-marked record or pointer to supremum */ -UNIV_INLINE -const rec_t* -page_rec_get_next_non_del_marked( -/*=============================*/ - const rec_t* rec); /*!< in: pointer to record */ -/************************************************************//** Gets the pointer to the previous record. -@return pointer to previous record */ -UNIV_INLINE +@return pointer to previous record +@retval nullptr on error */ const rec_t* page_rec_get_prev_const( /*====================*/ @@ -772,13 +775,13 @@ page_rec_get_prev_const( infimum */ /************************************************************//** Gets the pointer to the previous record. -@return pointer to previous record */ -UNIV_INLINE -rec_t* -page_rec_get_prev( -/*==============*/ - rec_t* rec); /*!< in: pointer to record, - must not be page infimum */ +@param rec record (not page infimum) +@return pointer to previous record +@retval nullptr on error */ +inline rec_t *page_rec_get_prev(rec_t *rec) +{ + return const_cast(page_rec_get_prev_const(rec)); +} /************************************************************//** true if the record is the first user record on a page. @@ -791,17 +794,6 @@ page_rec_is_first( const page_t* page) /*!< in: page */ MY_ATTRIBUTE((warn_unused_result)); -/************************************************************//** -true if the record is the second user record on a page. -@return true if the second user record */ -UNIV_INLINE -bool -page_rec_is_second( -/*===============*/ - const rec_t* rec, /*!< in: record */ - const page_t* page) /*!< in: page */ - MY_ATTRIBUTE((warn_unused_result)); - /************************************************************//** true if the record is the last user record on a page. @return true if the last user record */ @@ -813,33 +805,6 @@ page_rec_is_last( const page_t* page) /*!< in: page */ MY_ATTRIBUTE((warn_unused_result)); -/************************************************************//** -true if distance between the records (measured in number of times we have to -move to the next record) is at most the specified value -@param[in] left_rec lefter record -@param[in] right_rec righter record -@param[in] val specified value to compare -@return true if the distance is smaller than the value */ -UNIV_INLINE -bool -page_rec_distance_is_at_most( -/*=========================*/ - const rec_t* left_rec, - const rec_t* right_rec, - ulint val) - MY_ATTRIBUTE((warn_unused_result)); - -/************************************************************//** -true if the record is the second last user record on a page. -@return true if the second last user record */ -UNIV_INLINE -bool -page_rec_is_second_last( -/*====================*/ - const rec_t* rec, /*!< in: record */ - const page_t* page) /*!< in: page */ - MY_ATTRIBUTE((warn_unused_result)); - /************************************************************//** Returns the maximum combined size of records which can be inserted on top of record heap. @@ -930,6 +895,8 @@ page_create_empty( dict_index_t* index, /*!< in: the index of the page */ mtr_t* mtr) /*!< in/out: mini-transaction */ MY_ATTRIBUTE((nonnull(1,2))); + +MY_ATTRIBUTE((nonnull, warn_unused_result)) /*************************************************************//** Differs from page_copy_rec_list_end, because this function does not touch the lock table and max trx id on page or compress the page. @@ -937,8 +904,10 @@ touch the lock table and max trx id on page or compress the page. IMPORTANT: The caller will have to update IBUF_BITMAP_FREE if new_block is a compressed leaf page in a secondary index. This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). */ -void +or by invoking ibuf_reset_free_bits() before mtr_t::commit(). + +@return error code */ +dberr_t page_copy_rec_list_end_no_locks( /*============================*/ buf_block_t* new_block, /*!< in: index page to copy to */ @@ -954,10 +923,10 @@ The records are copied to the start of the record list on new_page. IMPORTANT: The caller will have to update IBUF_BITMAP_FREE if new_block is a compressed leaf page in a secondary index. This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). +or by invoking ibuf_reset_free_bits() before mtr_t::commit(). -@return pointer to the original successor of the infimum record on -new_page, or NULL on zip overflow (new_block will be decompressed) */ +@return pointer to the original successor of the infimum record on new_block +@retval nullptr on ROW_FORMAT=COMPRESSED page overflow */ rec_t* page_copy_rec_list_end( /*===================*/ @@ -965,8 +934,9 @@ page_copy_rec_list_end( buf_block_t* block, /*!< in: index page containing rec */ rec_t* rec, /*!< in: record on page */ dict_index_t* index, /*!< in: record descriptor */ - mtr_t* mtr) /*!< in: mtr */ - MY_ATTRIBUTE((nonnull)); + mtr_t* mtr, /*!< in/out: mini-transaction */ + dberr_t* err) /*!< out: error code */ + MY_ATTRIBUTE((nonnull(1,2,3,4,5), warn_unused_result)); /*************************************************************//** Copies records from page to new_page, up to the given record, NOT including that record. Infimum and supremum records are not copied. @@ -977,8 +947,8 @@ if new_block is a compressed leaf page in a secondary index. This has to be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit(). -@return pointer to the original predecessor of the supremum record on -new_page, or NULL on zip overflow (new_block will be decompressed) */ +@return pointer to the original predecessor of the supremum record on new_block +@retval nullptr on ROW_FORMAT=COMPRESSED page overflow */ rec_t* page_copy_rec_list_start( /*=====================*/ @@ -986,12 +956,13 @@ page_copy_rec_list_start( buf_block_t* block, /*!< in: index page containing rec */ rec_t* rec, /*!< in: record on page */ dict_index_t* index, /*!< in: record descriptor */ - mtr_t* mtr) /*!< in: mtr */ - MY_ATTRIBUTE((nonnull)); + mtr_t* mtr, /*!< in/out: mini-transaction */ + dberr_t* err) /*!< out: error code */ + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*************************************************************//** Deletes records from a page from a given record onward, including that record. The infimum and supremum records are not deleted. */ -void +dberr_t page_delete_rec_list_end( /*=====================*/ rec_t* rec, /*!< in: pointer to record on page */ @@ -1003,7 +974,7 @@ page_delete_rec_list_end( records in the end of the chain to delete, or ULINT_UNDEFINED if not known */ mtr_t* mtr) /*!< in: mtr */ - MY_ATTRIBUTE((nonnull)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*************************************************************//** Deletes records from page, up to the given record, NOT including that record. Infimum and supremum records are not deleted. */ @@ -1015,45 +986,6 @@ page_delete_rec_list_start( dict_index_t* index, /*!< in: record descriptor */ mtr_t* mtr) /*!< in: mtr */ MY_ATTRIBUTE((nonnull)); -/*************************************************************//** -Moves record list end to another page. Moved records include -split_rec. - -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if new_block is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). - -@return TRUE on success; FALSE on compression failure (new_block will -be decompressed) */ -ibool -page_move_rec_list_end( -/*===================*/ - buf_block_t* new_block, /*!< in/out: index page where to move */ - buf_block_t* block, /*!< in: index page from where to move */ - rec_t* split_rec, /*!< in: first record to move */ - dict_index_t* index, /*!< in: record descriptor */ - mtr_t* mtr) /*!< in: mtr */ - MY_ATTRIBUTE((nonnull(1, 2, 4, 5))); -/*************************************************************//** -Moves record list start to another page. Moved records do not include -split_rec. - -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if new_block is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). - -@return TRUE on success; FALSE on compression failure */ -ibool -page_move_rec_list_start( -/*=====================*/ - buf_block_t* new_block, /*!< in/out: index page where to move */ - buf_block_t* block, /*!< in/out: page containing split_rec */ - rec_t* split_rec, /*!< in: first record not to move */ - dict_index_t* index, /*!< in: record descriptor */ - mtr_t* mtr) /*!< in: mtr */ - MY_ATTRIBUTE((nonnull(1, 2, 4, 5))); /** Create an index page. @param[in,out] block buffer block @param[in] comp nonzero=compact page format */ @@ -1160,12 +1092,10 @@ page_find_rec_with_heap_no( @param[in] page index tree leaf page @return the last record, not delete-marked @retval infimum record if all records are delete-marked */ -const rec_t* -page_find_rec_max_not_deleted( - const page_t* page); +const rec_t *page_find_rec_last_not_deleted(const page_t *page); #endif /* !UNIV_INNOCHECKSUM */ -#include "page0page.ic" +#include "page0page.inl" #endif diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic deleted file mode 100644 index 861bf4a53df1b..0000000000000 --- a/storage/innobase/include/page0page.ic +++ /dev/null @@ -1,724 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2021, 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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/page0page.ic -Index page routines - -Created 2/2/1994 Heikki Tuuri -*******************************************************/ - -#ifndef page0page_ic -#define page0page_ic - -#ifndef UNIV_INNOCHECKSUM -#include "rem0cmp.h" -#include "mtr0log.h" -#include "page0zip.h" - -/*************************************************************//** -Sets the max trx id field value if trx_id is bigger than the previous -value. */ -UNIV_INLINE -void -page_update_max_trx_id( -/*===================*/ - buf_block_t* block, /*!< in/out: page */ - page_zip_des_t* page_zip,/*!< in/out: compressed page whose - uncompressed part will be updated, or NULL */ - trx_id_t trx_id, /*!< in: transaction id */ - mtr_t* mtr) /*!< in/out: mini-transaction */ -{ - ut_ad(block); - ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); - ut_ad(trx_id); - ut_ad(page_is_leaf(buf_block_get_frame(block))); - - if (page_get_max_trx_id(buf_block_get_frame(block)) < trx_id) { - - page_set_max_trx_id(block, page_zip, trx_id, mtr); - } -} - -/*************************************************************//** -Returns the RTREE SPLIT SEQUENCE NUMBER (FIL_RTREE_SPLIT_SEQ_NUM). -@return SPLIT SEQUENCE NUMBER */ -UNIV_INLINE -node_seq_t -page_get_ssn_id( -/*============*/ - const page_t* page) /*!< in: page */ -{ - ut_ad(page); - - return(static_cast( - mach_read_from_8(page + FIL_RTREE_SPLIT_SEQ_NUM))); -} - -/*************************************************************//** -Sets the RTREE SPLIT SEQUENCE NUMBER field value */ -UNIV_INLINE -void -page_set_ssn_id( -/*============*/ - buf_block_t* block, /*!< in/out: page */ - page_zip_des_t* page_zip,/*!< in/out: compressed page whose - uncompressed part will be updated, or NULL */ - node_seq_t ssn_id, /*!< in: transaction id */ - mtr_t* mtr) /*!< in/out: mini-transaction */ -{ - ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_SX_FIX | - MTR_MEMO_PAGE_X_FIX)); - ut_ad(!page_zip || page_zip == &block->page.zip); - constexpr uint16_t field= FIL_RTREE_SPLIT_SEQ_NUM; - byte *b= my_assume_aligned<2>(&block->page.frame[field]); - if (mtr->write<8,mtr_t::MAYBE_NOP>(*block, b, ssn_id) && - UNIV_LIKELY_NULL(page_zip)) - memcpy_aligned<2>(&page_zip->data[field], b, 8); -} - -#endif /* !UNIV_INNOCHECKSUM */ - -#ifndef UNIV_INNOCHECKSUM -/*************************************************************//** -Returns the offset stored in the given header field. -@return offset from the start of the page, or 0 */ -UNIV_INLINE -uint16_t -page_header_get_offs( -/*=================*/ - const page_t* page, /*!< in: page */ - ulint field) /*!< in: PAGE_FREE, ... */ -{ - ut_ad((field == PAGE_FREE) - || (field == PAGE_LAST_INSERT) - || (field == PAGE_HEAP_TOP)); - - uint16_t offs = page_header_get_field(page, field); - - ut_ad((field != PAGE_HEAP_TOP) || offs); - - return(offs); -} - - -/** -Reset PAGE_LAST_INSERT. -@param[in,out] block file page -@param[in,out] mtr mini-transaction */ -inline void page_header_reset_last_insert(buf_block_t *block, mtr_t *mtr) -{ - constexpr uint16_t field= PAGE_HEADER + PAGE_LAST_INSERT; - byte *b= my_assume_aligned<2>(&block->page.frame[field]); - if (mtr->write<2,mtr_t::MAYBE_NOP>(*block, b, 0U) && - UNIV_LIKELY_NULL(block->page.zip.data)) - memset_aligned<2>(&block->page.zip.data[field], 0, 2); -} - -/***************************************************************//** -Returns the heap number of a record. -@return heap number */ -UNIV_INLINE -ulint -page_rec_get_heap_no( -/*=================*/ - const rec_t* rec) /*!< in: the physical record */ -{ - if (page_rec_is_comp(rec)) { - return(rec_get_heap_no_new(rec)); - } else { - return(rec_get_heap_no_old(rec)); - } -} - -/** Determine whether an index page record is a user record. -@param[in] rec record in an index page -@return true if a user record */ -inline -bool -page_rec_is_user_rec(const rec_t* rec) -{ - ut_ad(page_rec_check(rec)); - return(page_rec_is_user_rec_low(page_offset(rec))); -} - -/** Determine whether an index page record is the supremum record. -@param[in] rec record in an index page -@return true if the supremum record */ -inline -bool -page_rec_is_supremum(const rec_t* rec) -{ - ut_ad(page_rec_check(rec)); - return(page_rec_is_supremum_low(page_offset(rec))); -} - -/** Determine whether an index page record is the infimum record. -@param[in] rec record in an index page -@return true if the infimum record */ -inline -bool -page_rec_is_infimum(const rec_t* rec) -{ - ut_ad(page_rec_check(rec)); - return(page_rec_is_infimum_low(page_offset(rec))); -} - -/************************************************************//** -true if the record is the first user record on a page. -@return true if the first user record */ -UNIV_INLINE -bool -page_rec_is_first( -/*==============*/ - const rec_t* rec, /*!< in: record */ - const page_t* page) /*!< in: page */ -{ - ut_ad(page_get_n_recs(page) > 0); - - return(page_rec_get_next_const(page_get_infimum_rec(page)) == rec); -} - -/************************************************************//** -true if the record is the second user record on a page. -@return true if the second user record */ -UNIV_INLINE -bool -page_rec_is_second( -/*===============*/ - const rec_t* rec, /*!< in: record */ - const page_t* page) /*!< in: page */ -{ - ut_ad(page_get_n_recs(page) > 1); - - return(page_rec_get_next_const( - page_rec_get_next_const(page_get_infimum_rec(page))) == rec); -} - -/************************************************************//** -true if the record is the last user record on a page. -@return true if the last user record */ -UNIV_INLINE -bool -page_rec_is_last( -/*=============*/ - const rec_t* rec, /*!< in: record */ - const page_t* page) /*!< in: page */ -{ - ut_ad(page_get_n_recs(page) > 0); - - return(page_rec_get_next_const(rec) == page_get_supremum_rec(page)); -} - -/************************************************************//** -true if distance between the records (measured in number of times we have to -move to the next record) is at most the specified value */ -UNIV_INLINE -bool -page_rec_distance_is_at_most( -/*=========================*/ - const rec_t* left_rec, - const rec_t* right_rec, - ulint val) -{ - for (ulint i = 0; i <= val; i++) { - if (left_rec == right_rec) { - return (true); - } - left_rec = page_rec_get_next_const(left_rec); - } - return (false); -} - -/************************************************************//** -true if the record is the second last user record on a page. -@return true if the second last user record */ -UNIV_INLINE -bool -page_rec_is_second_last( -/*====================*/ - const rec_t* rec, /*!< in: record */ - const page_t* page) /*!< in: page */ -{ - ut_ad(page_get_n_recs(page) > 1); - ut_ad(!page_rec_is_last(rec, page)); - - return(page_rec_get_next_const( - page_rec_get_next_const(rec)) == page_get_supremum_rec(page)); -} - -/************************************************************//** -Returns the nth record of the record list. -This is the inverse function of page_rec_get_n_recs_before(). -@return nth record */ -UNIV_INLINE -rec_t* -page_rec_get_nth( -/*=============*/ - page_t* page, /*!< in: page */ - ulint nth) /*!< in: nth record */ -{ - return((rec_t*) page_rec_get_nth_const(page, nth)); -} - -/************************************************************//** -Returns the middle record of the records on the page. If there is an -even number of records in the list, returns the first record of the -upper half-list. -@return middle record */ -UNIV_INLINE -rec_t* -page_get_middle_rec( -/*================*/ - page_t* page) /*!< in: page */ -{ - ulint middle = (ulint(page_get_n_recs(page)) - + PAGE_HEAP_NO_USER_LOW) / 2; - - return(page_rec_get_nth(page, middle)); -} - -#endif /* !UNIV_INNOCHECKSUM */ - -/*************************************************************//** -Gets the page number. -@return page number */ -UNIV_INLINE -uint32_t -page_get_page_no( -/*=============*/ - const page_t* page) /*!< in: page */ -{ - ut_ad(page == page_align((page_t*) page)); - return mach_read_from_4(my_assume_aligned<4>(page + FIL_PAGE_OFFSET)); -} - -#ifndef UNIV_INNOCHECKSUM -/*************************************************************//** -Gets the tablespace identifier. -@return space id */ -UNIV_INLINE -uint32_t -page_get_space_id( -/*==============*/ - const page_t* page) /*!< in: page */ -{ - ut_ad(page == page_align((page_t*) page)); - return mach_read_from_4(my_assume_aligned<2> - (page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID)); -} - -#endif /* !UNIV_INNOCHECKSUM */ - -/*************************************************************//** -Gets the number of user records on page (infimum and supremum records -are not user records). -@return number of user records */ -UNIV_INLINE -uint16_t -page_get_n_recs( -/*============*/ - const page_t* page) /*!< in: index page */ -{ - return(page_header_get_field(page, PAGE_N_RECS)); -} - -#ifndef UNIV_INNOCHECKSUM -/*************************************************************//** -Gets the number of dir slots in directory. -@return number of slots */ -UNIV_INLINE -uint16_t -page_dir_get_n_slots( -/*=================*/ - const page_t* page) /*!< in: index page */ -{ - return(page_header_get_field(page, PAGE_N_DIR_SLOTS)); -} - -/*************************************************************//** -Gets the number of records in the heap. -@return number of user records */ -UNIV_INLINE -uint16_t -page_dir_get_n_heap( -/*================*/ - const page_t* page) /*!< in: index page */ -{ - return(page_header_get_field(page, PAGE_N_HEAP) & 0x7fff); -} - -/**************************************************************//** -Used to check the consistency of a record on a page. -@return TRUE if succeed */ -UNIV_INLINE -ibool -page_rec_check( -/*===========*/ - const rec_t* rec) /*!< in: record */ -{ - const page_t* page = page_align(rec); - - ut_a(rec); - - ut_a(page_offset(rec) <= page_header_get_field(page, PAGE_HEAP_TOP)); - ut_a(page_offset(rec) >= PAGE_DATA); - - return(TRUE); -} - -/***************************************************************//** -Gets the number of records owned by a directory slot. -@return number of records */ -UNIV_INLINE -ulint -page_dir_slot_get_n_owned( -/*======================*/ - const page_dir_slot_t* slot) /*!< in: page directory slot */ -{ - const rec_t* rec = page_dir_slot_get_rec(slot); - if (page_rec_is_comp(slot)) { - return(rec_get_n_owned_new(rec)); - } else { - return(rec_get_n_owned_old(rec)); - } -} - -/************************************************************//** -Calculates the space reserved for directory slots of a given number of -records. The exact value is a fraction number n * PAGE_DIR_SLOT_SIZE / -PAGE_DIR_SLOT_MIN_N_OWNED, and it is rounded upwards to an integer. */ -UNIV_INLINE -ulint -page_dir_calc_reserved_space( -/*=========================*/ - ulint n_recs) /*!< in: number of records */ -{ - return((PAGE_DIR_SLOT_SIZE * n_recs + PAGE_DIR_SLOT_MIN_N_OWNED - 1) - / PAGE_DIR_SLOT_MIN_N_OWNED); -} - -/************************************************************//** -Gets the pointer to the next record on the page. -@return pointer to next record */ -UNIV_INLINE -const rec_t* -page_rec_get_next_low( -/*==================*/ - const rec_t* rec, /*!< in: pointer to record */ - ulint comp) /*!< in: nonzero=compact page layout */ -{ - ulint offs; - const page_t* page; - - ut_ad(page_rec_check(rec)); - - page = page_align(rec); - - offs = rec_get_next_offs(rec, comp); - - if (offs >= srv_page_size) { - fprintf(stderr, - "InnoDB: Next record offset is nonsensical %lu" - " in record at offset %lu\n" - "InnoDB: rec address %p, space id %lu, page %lu\n", - (ulong) offs, (ulong) page_offset(rec), - (void*) rec, - (ulong) page_get_space_id(page), - (ulong) page_get_page_no(page)); - ut_error; - } else if (offs == 0) { - - return(NULL); - } - - ut_ad(page_rec_is_infimum(rec) - || (!page_is_leaf(page) && !page_has_prev(page)) - || !(rec_get_info_bits(page + offs, comp) - & REC_INFO_MIN_REC_FLAG)); - - return(page + offs); -} - -/************************************************************//** -Gets the pointer to the next record on the page. -@return pointer to next record */ -UNIV_INLINE -rec_t* -page_rec_get_next( -/*==============*/ - rec_t* rec) /*!< in: pointer to record */ -{ - return((rec_t*) page_rec_get_next_low(rec, page_rec_is_comp(rec))); -} - -/************************************************************//** -Gets the pointer to the next record on the page. -@return pointer to next record */ -UNIV_INLINE -const rec_t* -page_rec_get_next_const( -/*====================*/ - const rec_t* rec) /*!< in: pointer to record */ -{ - return(page_rec_get_next_low(rec, page_rec_is_comp(rec))); -} - -/************************************************************//** -Gets the pointer to the next non delete-marked record on the page. -If all subsequent records are delete-marked, then this function -will return the supremum record. -@return pointer to next non delete-marked record or pointer to supremum */ -UNIV_INLINE -const rec_t* -page_rec_get_next_non_del_marked( -/*=============================*/ - const rec_t* rec) /*!< in: pointer to record */ -{ - const rec_t* r; - ulint page_is_compact = page_rec_is_comp(rec); - - for (r = page_rec_get_next_const(rec); - !page_rec_is_supremum(r) - && rec_get_deleted_flag(r, page_is_compact); - r = page_rec_get_next_const(r)) { - /* noop */ - } - - return(r); -} - -/************************************************************//** -Gets the pointer to the previous record. -@return pointer to previous record */ -UNIV_INLINE -const rec_t* -page_rec_get_prev_const( -/*====================*/ - const rec_t* rec) /*!< in: pointer to record, must not be page - infimum */ -{ - const page_dir_slot_t* slot; - ulint slot_no; - const rec_t* rec2; - const rec_t* prev_rec = NULL; - const page_t* page; - - ut_ad(page_rec_check(rec)); - - page = page_align(rec); - - ut_ad(!page_rec_is_infimum(rec)); - - slot_no = page_dir_find_owner_slot(rec); - - ut_a(slot_no != 0); - - slot = page_dir_get_nth_slot(page, slot_no - 1); - - rec2 = page_dir_slot_get_rec(slot); - - if (page_is_comp(page)) { - while (rec != rec2) { - prev_rec = rec2; - rec2 = page_rec_get_next_low(rec2, TRUE); - } - } else { - while (rec != rec2) { - prev_rec = rec2; - rec2 = page_rec_get_next_low(rec2, FALSE); - } - } - - ut_a(prev_rec); - - return(prev_rec); -} - -/************************************************************//** -Gets the pointer to the previous record. -@return pointer to previous record */ -UNIV_INLINE -rec_t* -page_rec_get_prev( -/*==============*/ - rec_t* rec) /*!< in: pointer to record, must not be page - infimum */ -{ - return((rec_t*) page_rec_get_prev_const(rec)); -} - -#endif /* UNIV_INNOCHECKSUM */ - -/************************************************************//** -Returns the sum of the sizes of the records in the record list, excluding -the infimum and supremum records. -@return data in bytes */ -UNIV_INLINE -uint16_t -page_get_data_size( -/*===============*/ - const page_t* page) /*!< in: index page */ -{ - unsigned ret = page_header_get_field(page, PAGE_HEAP_TOP) - - (page_is_comp(page) - ? PAGE_NEW_SUPREMUM_END - : PAGE_OLD_SUPREMUM_END) - - page_header_get_field(page, PAGE_GARBAGE); - ut_ad(ret < srv_page_size); - return static_cast(ret); -} - -#ifndef UNIV_INNOCHECKSUM -/*************************************************************//** -Calculates free space if a page is emptied. -@return free space */ -UNIV_INLINE -ulint -page_get_free_space_of_empty( -/*=========================*/ - ulint comp) /*!< in: nonzero=compact page layout */ -{ - if (comp) { - return((ulint)(srv_page_size - - PAGE_NEW_SUPREMUM_END - - PAGE_DIR - - 2 * PAGE_DIR_SLOT_SIZE)); - } - - return((ulint)(srv_page_size - - PAGE_OLD_SUPREMUM_END - - PAGE_DIR - - 2 * PAGE_DIR_SLOT_SIZE)); -} - -/************************************************************//** -Each user record on a page, and also the deleted user records in the heap -takes its size plus the fraction of the dir cell size / -PAGE_DIR_SLOT_MIN_N_OWNED bytes for it. If the sum of these exceeds the -value of page_get_free_space_of_empty, the insert is impossible, otherwise -it is allowed. This function returns the maximum combined size of records -which can be inserted on top of the record heap. -@return maximum combined size for inserted records */ -UNIV_INLINE -ulint -page_get_max_insert_size( -/*=====================*/ - const page_t* page, /*!< in: index page */ - ulint n_recs) /*!< in: number of records */ -{ - ulint occupied; - ulint free_space; - - if (page_is_comp(page)) { - occupied = page_header_get_field(page, PAGE_HEAP_TOP) - - PAGE_NEW_SUPREMUM_END - + page_dir_calc_reserved_space( - n_recs + page_dir_get_n_heap(page) - 2); - - free_space = page_get_free_space_of_empty(TRUE); - } else { - occupied = page_header_get_field(page, PAGE_HEAP_TOP) - - PAGE_OLD_SUPREMUM_END - + page_dir_calc_reserved_space( - n_recs + page_dir_get_n_heap(page) - 2); - - free_space = page_get_free_space_of_empty(FALSE); - } - - /* Above the 'n_recs +' part reserves directory space for the new - inserted records; the '- 2' excludes page infimum and supremum - records */ - - if (occupied > free_space) { - - return(0); - } - - return(free_space - occupied); -} - -/************************************************************//** -Returns the maximum combined size of records which can be inserted on top -of the record heap if a page is first reorganized. -@return maximum combined size for inserted records */ -UNIV_INLINE -ulint -page_get_max_insert_size_after_reorganize( -/*======================================*/ - const page_t* page, /*!< in: index page */ - ulint n_recs) /*!< in: number of records */ -{ - ulint occupied; - ulint free_space; - - occupied = page_get_data_size(page) - + page_dir_calc_reserved_space(n_recs + page_get_n_recs(page)); - - free_space = page_get_free_space_of_empty(page_is_comp(page)); - - if (occupied > free_space) { - - return(0); - } - - return(free_space - occupied); -} - -/** Read the PAGE_DIRECTION field from a byte. -@param[in] ptr pointer to PAGE_DIRECTION_B -@return the value of the PAGE_DIRECTION field */ -inline -byte -page_ptr_get_direction(const byte* ptr) -{ - ut_ad(page_offset(ptr) == PAGE_HEADER + PAGE_DIRECTION_B); - return *ptr & ((1U << 3) - 1); -} - -/** Read the PAGE_INSTANT field. -@param[in] page index page -@return the value of the PAGE_INSTANT field */ -inline -uint16_t -page_get_instant(const page_t* page) -{ - uint16_t i = page_header_get_field(page, PAGE_INSTANT); -#ifdef UNIV_DEBUG - switch (fil_page_get_type(page)) { - case FIL_PAGE_TYPE_INSTANT: - ut_ad(page_get_direction(page) <= PAGE_NO_DIRECTION); - ut_ad(i >> 3); - break; - case FIL_PAGE_INDEX: - ut_ad(i <= PAGE_NO_DIRECTION || !page_is_comp(page)); - break; - case FIL_PAGE_RTREE: - ut_ad(i <= PAGE_NO_DIRECTION); - break; - default: - ut_ad("invalid page type" == 0); - break; - } -#endif /* UNIV_DEBUG */ - return static_cast(i >> 3); /* i / 8 */ -} -#endif /* !UNIV_INNOCHECKSUM */ - -#endif diff --git a/storage/innobase/include/page0page.inl b/storage/innobase/include/page0page.inl new file mode 100644 index 0000000000000..6c0167edcf9ba --- /dev/null +++ b/storage/innobase/include/page0page.inl @@ -0,0 +1,550 @@ +/***************************************************************************** + +Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2016, 2022, 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 02110-1335 USA + +*****************************************************************************/ + +/**************************************************//** +@file include/page0page.ic +Index page routines + +Created 2/2/1994 Heikki Tuuri +*******************************************************/ + +#ifndef UNIV_INNOCHECKSUM +#include "rem0cmp.h" +#include "mtr0log.h" +#include "page0zip.h" + +/*************************************************************//** +Sets the max trx id field value if trx_id is bigger than the previous +value. */ +UNIV_INLINE +void +page_update_max_trx_id( +/*===================*/ + buf_block_t* block, /*!< in/out: page */ + page_zip_des_t* page_zip,/*!< in/out: compressed page whose + uncompressed part will be updated, or NULL */ + trx_id_t trx_id, /*!< in: transaction id */ + mtr_t* mtr) /*!< in/out: mini-transaction */ +{ + ut_ad(block); + ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); + ut_ad(trx_id); + ut_ad(page_is_leaf(buf_block_get_frame(block))); + + if (page_get_max_trx_id(buf_block_get_frame(block)) < trx_id) { + + page_set_max_trx_id(block, page_zip, trx_id, mtr); + } +} + +/*************************************************************//** +Returns the RTREE SPLIT SEQUENCE NUMBER (FIL_RTREE_SPLIT_SEQ_NUM). +@return SPLIT SEQUENCE NUMBER */ +UNIV_INLINE +node_seq_t +page_get_ssn_id( +/*============*/ + const page_t* page) /*!< in: page */ +{ + ut_ad(page); + + return(static_cast( + mach_read_from_8(page + FIL_RTREE_SPLIT_SEQ_NUM))); +} + +/*************************************************************//** +Sets the RTREE SPLIT SEQUENCE NUMBER field value */ +UNIV_INLINE +void +page_set_ssn_id( +/*============*/ + buf_block_t* block, /*!< in/out: page */ + page_zip_des_t* page_zip,/*!< in/out: compressed page whose + uncompressed part will be updated, or NULL */ + node_seq_t ssn_id, /*!< in: transaction id */ + mtr_t* mtr) /*!< in/out: mini-transaction */ +{ + ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_SX_FIX | + MTR_MEMO_PAGE_X_FIX)); + ut_ad(!page_zip || page_zip == &block->page.zip); + constexpr uint16_t field= FIL_RTREE_SPLIT_SEQ_NUM; + byte *b= my_assume_aligned<2>(&block->page.frame[field]); + if (mtr->write<8,mtr_t::MAYBE_NOP>(*block, b, ssn_id) && + UNIV_LIKELY_NULL(page_zip)) + memcpy_aligned<2>(&page_zip->data[field], b, 8); +} + +#endif /* !UNIV_INNOCHECKSUM */ + +#ifndef UNIV_INNOCHECKSUM +/*************************************************************//** +Returns the offset stored in the given header field. +@return offset from the start of the page, or 0 */ +UNIV_INLINE +uint16_t +page_header_get_offs( +/*=================*/ + const page_t* page, /*!< in: page */ + ulint field) /*!< in: PAGE_FREE, ... */ +{ + ut_ad((field == PAGE_FREE) + || (field == PAGE_LAST_INSERT) + || (field == PAGE_HEAP_TOP)); + + uint16_t offs = page_header_get_field(page, field); + + ut_ad((field != PAGE_HEAP_TOP) || offs); + + return(offs); +} + + +/** +Reset PAGE_LAST_INSERT. +@param[in,out] block file page +@param[in,out] mtr mini-transaction */ +inline void page_header_reset_last_insert(buf_block_t *block, mtr_t *mtr) +{ + constexpr uint16_t field= PAGE_HEADER + PAGE_LAST_INSERT; + byte *b= my_assume_aligned<2>(&block->page.frame[field]); + if (mtr->write<2,mtr_t::MAYBE_NOP>(*block, b, 0U) && + UNIV_LIKELY_NULL(block->page.zip.data)) + memset_aligned<2>(&block->page.zip.data[field], 0, 2); +} + +/***************************************************************//** +Returns the heap number of a record. +@return heap number */ +UNIV_INLINE +ulint +page_rec_get_heap_no( +/*=================*/ + const rec_t* rec) /*!< in: the physical record */ +{ + if (page_rec_is_comp(rec)) { + return(rec_get_heap_no_new(rec)); + } else { + return(rec_get_heap_no_old(rec)); + } +} + +/** Determine whether an index page record is a user record. +@param[in] rec record in an index page +@return true if a user record */ +inline +bool +page_rec_is_user_rec(const rec_t* rec) +{ + ut_ad(page_rec_check(rec)); + return(page_rec_is_user_rec_low(page_offset(rec))); +} + +/** Determine whether an index page record is the supremum record. +@param[in] rec record in an index page +@return true if the supremum record */ +inline +bool +page_rec_is_supremum(const rec_t* rec) +{ + ut_ad(page_rec_check(rec)); + return(page_rec_is_supremum_low(page_offset(rec))); +} + +/** Determine whether an index page record is the infimum record. +@param[in] rec record in an index page +@return true if the infimum record */ +inline +bool +page_rec_is_infimum(const rec_t* rec) +{ + ut_ad(page_rec_check(rec)); + return(page_rec_is_infimum_low(page_offset(rec))); +} + +/************************************************************//** +true if the record is the first user record on a page. +@return true if the first user record */ +UNIV_INLINE +bool +page_rec_is_first( +/*==============*/ + const rec_t* rec, /*!< in: record */ + const page_t* page) /*!< in: page */ +{ + ut_ad(page_get_n_recs(page) > 0); + + return(page_rec_get_next_const(page_get_infimum_rec(page)) == rec); +} + +/************************************************************//** +true if the record is the last user record on a page. +@return true if the last user record */ +UNIV_INLINE +bool +page_rec_is_last( +/*=============*/ + const rec_t* rec, /*!< in: record */ + const page_t* page) /*!< in: page */ +{ + ut_ad(page_get_n_recs(page) > 0); + + return(page_rec_get_next_const(rec) == page_get_supremum_rec(page)); +} + +/************************************************************//** +Returns the middle record of the records on the page. If there is an +even number of records in the list, returns the first record of the +upper half-list. +@return middle record */ +UNIV_INLINE +rec_t* +page_get_middle_rec( +/*================*/ + page_t* page) /*!< in: page */ +{ + ulint middle = (ulint(page_get_n_recs(page)) + + PAGE_HEAP_NO_USER_LOW) / 2; + + return(page_rec_get_nth(page, middle)); +} + +#endif /* !UNIV_INNOCHECKSUM */ + +/*************************************************************//** +Gets the page number. +@return page number */ +UNIV_INLINE +uint32_t +page_get_page_no( +/*=============*/ + const page_t* page) /*!< in: page */ +{ + ut_ad(page == page_align((page_t*) page)); + return mach_read_from_4(my_assume_aligned<4>(page + FIL_PAGE_OFFSET)); +} + +#ifndef UNIV_INNOCHECKSUM +/*************************************************************//** +Gets the tablespace identifier. +@return space id */ +UNIV_INLINE +uint32_t +page_get_space_id( +/*==============*/ + const page_t* page) /*!< in: page */ +{ + ut_ad(page == page_align((page_t*) page)); + return mach_read_from_4(my_assume_aligned<2> + (page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID)); +} + +#endif /* !UNIV_INNOCHECKSUM */ + +/*************************************************************//** +Gets the number of user records on page (infimum and supremum records +are not user records). +@return number of user records */ +UNIV_INLINE +uint16_t +page_get_n_recs( +/*============*/ + const page_t* page) /*!< in: index page */ +{ + return(page_header_get_field(page, PAGE_N_RECS)); +} + +#ifndef UNIV_INNOCHECKSUM +/*************************************************************//** +Gets the number of dir slots in directory. +@return number of slots */ +UNIV_INLINE +uint16_t +page_dir_get_n_slots( +/*=================*/ + const page_t* page) /*!< in: index page */ +{ + return(page_header_get_field(page, PAGE_N_DIR_SLOTS)); +} + +/*************************************************************//** +Gets the number of records in the heap. +@return number of user records */ +UNIV_INLINE +uint16_t +page_dir_get_n_heap( +/*================*/ + const page_t* page) /*!< in: index page */ +{ + return(page_header_get_field(page, PAGE_N_HEAP) & 0x7fff); +} + +/**************************************************************//** +Used to check the consistency of a record on a page. +@return TRUE if succeed */ +UNIV_INLINE +ibool +page_rec_check( +/*===========*/ + const rec_t* rec) /*!< in: record */ +{ + const page_t* page = page_align(rec); + + ut_a(rec); + + ut_a(page_offset(rec) <= page_header_get_field(page, PAGE_HEAP_TOP)); + ut_a(page_offset(rec) >= PAGE_DATA); + + return(TRUE); +} + +/***************************************************************//** +Gets the number of records owned by a directory slot. +@return number of records */ +UNIV_INLINE +ulint +page_dir_slot_get_n_owned( +/*======================*/ + const page_dir_slot_t* slot) /*!< in: page directory slot */ +{ + const rec_t* rec = page_dir_slot_get_rec(slot); + if (page_rec_is_comp(slot)) { + return(rec_get_n_owned_new(rec)); + } else { + return(rec_get_n_owned_old(rec)); + } +} + +/************************************************************//** +Calculates the space reserved for directory slots of a given number of +records. The exact value is a fraction number n * PAGE_DIR_SLOT_SIZE / +PAGE_DIR_SLOT_MIN_N_OWNED, and it is rounded upwards to an integer. */ +UNIV_INLINE +ulint +page_dir_calc_reserved_space( +/*=========================*/ + ulint n_recs) /*!< in: number of records */ +{ + return((PAGE_DIR_SLOT_SIZE * n_recs + PAGE_DIR_SLOT_MIN_N_OWNED - 1) + / PAGE_DIR_SLOT_MIN_N_OWNED); +} + +/************************************************************//** +Gets the pointer to the next record on the page. +@return pointer to next record */ +UNIV_INLINE +const rec_t* +page_rec_get_next_low( +/*==================*/ + const rec_t* rec, /*!< in: pointer to record */ + ulint comp) /*!< in: nonzero=compact page layout */ +{ + const page_t *page= page_align(rec); + ut_ad(page_rec_check(rec)); + ulint offs= rec_get_next_offs(rec, comp); + if (!offs) + return nullptr; + if (UNIV_UNLIKELY(offs < (comp ? PAGE_NEW_SUPREMUM : PAGE_OLD_SUPREMUM))) + return nullptr; + if (UNIV_UNLIKELY(offs > page_header_get_field(page, PAGE_HEAP_TOP))) + return nullptr; + ut_ad(page_rec_is_infimum(rec) || + (!page_is_leaf(page) && !page_has_prev(page)) || + !(rec_get_info_bits(page + offs, comp) & REC_INFO_MIN_REC_FLAG)); + return page + offs; +} + +/************************************************************//** +Gets the pointer to the next record on the page. +@return pointer to next record */ +UNIV_INLINE +rec_t* +page_rec_get_next( +/*==============*/ + rec_t* rec) /*!< in: pointer to record */ +{ + return((rec_t*) page_rec_get_next_low(rec, page_rec_is_comp(rec))); +} + +/************************************************************//** +Gets the pointer to the next record on the page. +@return pointer to next record */ +UNIV_INLINE +const rec_t* +page_rec_get_next_const( +/*====================*/ + const rec_t* rec) /*!< in: pointer to record */ +{ + return(page_rec_get_next_low(rec, page_rec_is_comp(rec))); +} +#endif /* UNIV_INNOCHECKSUM */ + +/************************************************************//** +Returns the sum of the sizes of the records in the record list, excluding +the infimum and supremum records. +@return data in bytes */ +UNIV_INLINE +uint16_t +page_get_data_size( +/*===============*/ + const page_t* page) /*!< in: index page */ +{ + unsigned ret = page_header_get_field(page, PAGE_HEAP_TOP) + - (page_is_comp(page) + ? PAGE_NEW_SUPREMUM_END + : PAGE_OLD_SUPREMUM_END) + - page_header_get_field(page, PAGE_GARBAGE); + ut_ad(ret < srv_page_size); + return static_cast(ret); +} + +#ifndef UNIV_INNOCHECKSUM +/*************************************************************//** +Calculates free space if a page is emptied. +@return free space */ +UNIV_INLINE +ulint +page_get_free_space_of_empty( +/*=========================*/ + ulint comp) /*!< in: nonzero=compact page layout */ +{ + if (comp) { + return((ulint)(srv_page_size + - PAGE_NEW_SUPREMUM_END + - PAGE_DIR + - 2 * PAGE_DIR_SLOT_SIZE)); + } + + return((ulint)(srv_page_size + - PAGE_OLD_SUPREMUM_END + - PAGE_DIR + - 2 * PAGE_DIR_SLOT_SIZE)); +} + +/************************************************************//** +Each user record on a page, and also the deleted user records in the heap +takes its size plus the fraction of the dir cell size / +PAGE_DIR_SLOT_MIN_N_OWNED bytes for it. If the sum of these exceeds the +value of page_get_free_space_of_empty, the insert is impossible, otherwise +it is allowed. This function returns the maximum combined size of records +which can be inserted on top of the record heap. +@return maximum combined size for inserted records */ +UNIV_INLINE +ulint +page_get_max_insert_size( +/*=====================*/ + const page_t* page, /*!< in: index page */ + ulint n_recs) /*!< in: number of records */ +{ + ulint occupied; + ulint free_space; + + if (page_is_comp(page)) { + occupied = page_header_get_field(page, PAGE_HEAP_TOP) + - PAGE_NEW_SUPREMUM_END + + page_dir_calc_reserved_space( + n_recs + page_dir_get_n_heap(page) - 2); + + free_space = page_get_free_space_of_empty(TRUE); + } else { + occupied = page_header_get_field(page, PAGE_HEAP_TOP) + - PAGE_OLD_SUPREMUM_END + + page_dir_calc_reserved_space( + n_recs + page_dir_get_n_heap(page) - 2); + + free_space = page_get_free_space_of_empty(FALSE); + } + + /* Above the 'n_recs +' part reserves directory space for the new + inserted records; the '- 2' excludes page infimum and supremum + records */ + + if (occupied > free_space) { + + return(0); + } + + return(free_space - occupied); +} + +/************************************************************//** +Returns the maximum combined size of records which can be inserted on top +of the record heap if a page is first reorganized. +@return maximum combined size for inserted records */ +UNIV_INLINE +ulint +page_get_max_insert_size_after_reorganize( +/*======================================*/ + const page_t* page, /*!< in: index page */ + ulint n_recs) /*!< in: number of records */ +{ + ulint occupied; + ulint free_space; + + occupied = page_get_data_size(page) + + page_dir_calc_reserved_space(n_recs + page_get_n_recs(page)); + + free_space = page_get_free_space_of_empty(page_is_comp(page)); + + if (occupied > free_space) { + + return(0); + } + + return(free_space - occupied); +} + +/** Read the PAGE_DIRECTION field from a byte. +@param[in] ptr pointer to PAGE_DIRECTION_B +@return the value of the PAGE_DIRECTION field */ +inline +byte +page_ptr_get_direction(const byte* ptr) +{ + ut_ad(page_offset(ptr) == PAGE_HEADER + PAGE_DIRECTION_B); + return *ptr & ((1U << 3) - 1); +} + +/** Read the PAGE_INSTANT field. +@param[in] page index page +@return the value of the PAGE_INSTANT field */ +inline +uint16_t +page_get_instant(const page_t* page) +{ + uint16_t i = page_header_get_field(page, PAGE_INSTANT); +#ifdef UNIV_DEBUG + switch (fil_page_get_type(page)) { + case FIL_PAGE_TYPE_INSTANT: + ut_ad(page_get_direction(page) <= PAGE_NO_DIRECTION); + ut_ad(i >> 3); + break; + case FIL_PAGE_INDEX: + ut_ad(i <= PAGE_NO_DIRECTION || !page_is_comp(page)); + break; + case FIL_PAGE_RTREE: + ut_ad(i <= PAGE_NO_DIRECTION); + break; + default: + ut_ad("invalid page type" == 0); + break; + } +#endif /* UNIV_DEBUG */ + return static_cast(i >> 3); /* i / 8 */ +} +#endif /* !UNIV_INNOCHECKSUM */ diff --git a/storage/innobase/include/page0types.h b/storage/innobase/include/page0types.h index 885d2290f7c96..83fc45cdfc438 100644 --- a/storage/innobase/include/page0types.h +++ b/storage/innobase/include/page0types.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2019, 2021, MariaDB Corporation. +Copyright (c) 2019, 2022, 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 @@ -119,6 +119,16 @@ struct page_zip_des_t - reinterpret_cast(this)); } + page_zip_des_t() = default; + page_zip_des_t(const page_zip_des_t&) = default; + + /* Initialize everything except the member "fix". */ + page_zip_des_t(const page_zip_des_t& old, bool) { + memcpy((void*) this, (void*) &old, + reinterpret_cast(&fix) + - reinterpret_cast(this)); + } + private: friend buf_pool_t; friend buf_page_t; diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h index 45b5482fdb26f..4332990619e75 100644 --- a/storage/innobase/include/page0zip.h +++ b/storage/innobase/include/page0zip.h @@ -2,7 +2,7 @@ Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -327,9 +327,9 @@ IMPORTANT: if page_zip_reorganize() is invoked on a leaf page of a non-clustered index, the caller must update the insert buffer free bits in the same mini-transaction in such a way that the modification will be redo-logged. -@retval true on success -@retval false on failure; the block_zip will be left intact */ -bool +@return error code +@retval DB_FAIL on overflow; the block_zip will be left intact */ +dberr_t page_zip_reorganize( buf_block_t* block, /*!< in/out: page with compressed page; on the compressed page, in: size; @@ -339,7 +339,7 @@ page_zip_reorganize( ulint z_level,/*!< in: compression level */ mtr_t* mtr, /*!< in: mini-transaction */ bool restore = false)/*!< whether to restore on failure */ - MY_ATTRIBUTE((nonnull)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************************//** Copy the records of a page byte for byte. Do not copy the page header @@ -377,7 +377,7 @@ void page_zip_reset_stat_per_index(); /*===========================*/ -#include "page0zip.ic" +#include "page0zip.inl" #endif /* !UNIV_INNOCHECKSUM */ #endif /* page0zip_h */ diff --git a/storage/innobase/include/page0zip.ic b/storage/innobase/include/page0zip.inl similarity index 100% rename from storage/innobase/include/page0zip.ic rename to storage/innobase/include/page0zip.inl diff --git a/storage/innobase/include/que0que.h b/storage/innobase/include/que0que.h index f0aed6d22f475..c60f390a0929f 100644 --- a/storage/innobase/include/que0que.h +++ b/storage/innobase/include/que0que.h @@ -309,6 +309,6 @@ struct que_fork_t{ /* Flag which is ORed to control structure statement node types */ #define QUE_NODE_CONTROL_STAT 1024 -#include "que0que.ic" +#include "que0que.inl" #endif diff --git a/storage/innobase/include/que0que.ic b/storage/innobase/include/que0que.inl similarity index 100% rename from storage/innobase/include/que0que.ic rename to storage/innobase/include/que0que.inl diff --git a/storage/innobase/include/read0types.h b/storage/innobase/include/read0types.h index 37d97ebcaac12..e002f1b77e1cc 100644 --- a/storage/innobase/include/read0types.h +++ b/storage/innobase/include/read0types.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2021, MariaDB Corporation. +Copyright (c) 2018, 2022, 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 @@ -28,12 +28,9 @@ Created 2/16/1997 Heikki Tuuri #include "dict0mem.h" #include "trx0types.h" +#include "srw_lock.h" #include -#ifdef UNIV_PFS_MUTEX -extern mysql_pfs_key_t read_view_mutex_key; -#endif - /** Read view lists the trx ids of those transactions for which a consistent read should not see the modifications to the database. @@ -44,7 +41,7 @@ class ReadViewBase The read should not see any transaction with trx id >= this value. In other words, this is the "high water mark". */ - trx_id_t m_low_limit_id; + trx_id_t m_low_limit_id= 0; /** The read should see all trx ids which are strictly @@ -70,9 +67,6 @@ class ReadViewBase trx_id_t up_limit_id() const { return m_up_limit_id; } public: - ReadViewBase(): m_low_limit_id(0) {} - - /** Append state from another view. @@ -127,19 +121,6 @@ class ReadViewBase inline void snapshot(trx_t *trx); - /** - Check whether transaction id is valid. - @param[in] id transaction id to check - @param[in] name table name - - @todo changes_visible() was an unfortunate choice for this check. - It should be moved towards the functions that load trx id like - trx_read_trx_id(). No need to issue a warning, error log message should - be enough. Although statement should ideally fail if it sees corrupt - data. - */ - static void check_trx_id_sanity(trx_id_t id, const table_name_t &name); - /** Check whether the changes by id are visible. @param[in] id transaction id to check against the view @@ -155,26 +136,6 @@ class ReadViewBase !std::binary_search(m_ids.begin(), m_ids.end(), id); } - /** - Check whether the changes by id are visible. - @param[in] id transaction id to check against the view - @param[in] name table name - @return whether the view sees the modifications of id. - */ - bool changes_visible(trx_id_t id, const table_name_t &name) const - MY_ATTRIBUTE((warn_unused_result)) - { - if (id >= m_low_limit_id) - { - check_trx_id_sanity(id, name); - return false; - } - return id < m_up_limit_id || - m_ids.empty() || - !std::binary_search(m_ids.begin(), m_ids.end(), id); - } - - /** @param id transaction to check @return true if view sees transaction id @@ -186,6 +147,13 @@ class ReadViewBase /** @return the low limit id */ trx_id_t low_limit_id() const { return m_low_limit_id; } + + /** Clamp the low limit id for purge_sys.end_view */ + void clamp_low_limit_id(trx_id_t limit) + { + if (m_low_limit_id > limit) + m_low_limit_id= limit; + } }; @@ -206,7 +174,7 @@ class ReadView: public ReadViewBase std::atomic m_open; /** For synchronisation with purge coordinator. */ - mutable mysql_mutex_t m_mutex; + mutable srw_mutex m_mutex; /** trx id of creating transaction. @@ -215,9 +183,12 @@ class ReadView: public ReadViewBase trx_id_t m_creator_trx_id; public: - ReadView(): m_open(false) - { mysql_mutex_init(read_view_mutex_key, &m_mutex, nullptr); } - ~ReadView() { mysql_mutex_destroy(&m_mutex); } + ReadView() + { + memset(reinterpret_cast(this), 0, sizeof *this); + m_mutex.init(); + } + ~ReadView() { m_mutex.destroy(); } /** @@ -253,7 +224,6 @@ class ReadView: public ReadViewBase */ void set_creator_trx_id(trx_id_t id) { - ut_ad(id > 0); ut_ad(m_creator_trx_id == 0); m_creator_trx_id= id; } @@ -265,12 +235,12 @@ class ReadView: public ReadViewBase */ void print_limits(FILE *file) const { - mysql_mutex_lock(&m_mutex); + m_mutex.wr_lock(); if (is_open()) fprintf(file, "Trx read view will not see trx with" " id >= " TRX_ID_FMT ", sees < " TRX_ID_FMT "\n", low_limit_id(), up_limit_id()); - mysql_mutex_unlock(&m_mutex); + m_mutex.wr_unlock(); } @@ -278,8 +248,6 @@ class ReadView: public ReadViewBase A wrapper around ReadViewBase::changes_visible(). Intended to be called by the ReadView owner thread. */ - bool changes_visible(trx_id_t id, const table_name_t &name) const - { return id == m_creator_trx_id || ReadViewBase::changes_visible(id, name); } bool changes_visible(trx_id_t id) const { return id == m_creator_trx_id || ReadViewBase::changes_visible(id); } @@ -289,10 +257,10 @@ class ReadView: public ReadViewBase */ void append_to(ReadViewBase *to) const { - mysql_mutex_lock(&m_mutex); + m_mutex.wr_lock(); if (is_open()) to->append(*this); - mysql_mutex_unlock(&m_mutex); + m_mutex.wr_unlock(); } /** diff --git a/storage/innobase/include/rem0cmp.h b/storage/innobase/include/rem0cmp.h index 8d770405fcc91..3a30f5a92f3ea 100644 --- a/storage/innobase/include/rem0cmp.h +++ b/storage/innobase/include/rem0cmp.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, MariaDB Corporation. +Copyright (c) 2017, 2021, 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 @@ -24,8 +24,7 @@ Comparison services for records Created 7/1/1994 Heikki Tuuri ************************************************************************/ -#ifndef rem0cmp_h -#define rem0cmp_h +#pragma once #include "data0data.h" #include "data0type.h" @@ -43,39 +42,40 @@ cmp_cols_are_equal( ibool check_charsets); /*!< in: whether to check charsets */ /** Compare two data fields. -@param[in] mtype main type -@param[in] prtype precise type -@param[in] data1 data field -@param[in] len1 length of data1 in bytes, or UNIV_SQL_NULL -@param[in] data2 data field -@param[in] len2 length of data2 in bytes, or UNIV_SQL_NULL +@param mtype main type +@param prtype precise type +@param descending whether to use descending order +@param data1 data field +@param len1 length of data1 in bytes, or UNIV_SQL_NULL +@param data2 data field +@param len2 length of data2 in bytes, or UNIV_SQL_NULL @return the comparison result of data1 and data2 @retval 0 if data1 is equal to data2 @retval negative if data1 is less than data2 @retval positive if data1 is greater than data2 */ -int -cmp_data_data( - ulint mtype, - ulint prtype, - const byte* data1, - ulint len1, - const byte* data2, - ulint len2) - MY_ATTRIBUTE((warn_unused_result)); +int cmp_data(ulint mtype, ulint prtype, bool descending, + const byte *data1, size_t len1, const byte *data2, size_t len2) + MY_ATTRIBUTE((warn_unused_result)); /** Compare two data fields. -@param[in] dfield1 data field; must have type field set -@param[in] dfield2 data field +@param dfield1 data field; must have type field set +@param dfield2 data field +@param descending whether to use descending order @return the comparison result of dfield1 and dfield2 @retval 0 if dfield1 is equal to dfield2 @retval negative if dfield1 is less than dfield2 @retval positive if dfield1 is greater than dfield2 */ -UNIV_INLINE -int -cmp_dfield_dfield( -/*==============*/ - const dfield_t* dfield1,/*!< in: data field; must have type field set */ - const dfield_t* dfield2);/*!< in: data field */ +inline int cmp_dfield_dfield(const dfield_t *dfield1, const dfield_t *dfield2, + bool descending= false) +{ + ut_ad(dfield_check_typed(dfield1)); + const dtype_t *type= dfield_get_type(dfield1); + return cmp_data(type->mtype, type->prtype, descending, + static_cast(dfield_get_data(dfield1)), + dfield_get_len(dfield1), + static_cast(dfield_get_data(dfield2)), + dfield_get_len(dfield2)); +} #ifdef UNIV_DEBUG /** Compare a GIS data tuple to a physical record. @@ -103,15 +103,15 @@ inline int cmp_geometry_field(const void *a, const void *b) double x2= mach_double_read(mbr2); if (x1 > x2) return 1; - if (x2 > x1) + if (x1 < x2) return -1; - double y1= mach_double_read(mbr1 + sizeof(double) * SPDIMS); - double y2= mach_double_read(mbr2 + sizeof(double) * SPDIMS); + x1= mach_double_read(mbr1 + sizeof(double) * SPDIMS); + x2= mach_double_read(mbr2 + sizeof(double) * SPDIMS); - if (y1 > y2) + if (x1 > x2) return 1; - if (y2 > y1) + if (x1 < x2) return -1; /* left lower corner (xmin, ymin) overlaps, now right upper corner */ @@ -120,41 +120,39 @@ inline int cmp_geometry_field(const void *a, const void *b) if (x1 > x2) return 1; - if (x2 > x1) + if (x1 < x2) return -1; - y1= mach_double_read(mbr1 + sizeof(double) * 2 + sizeof(double)); - y2= mach_double_read(mbr2 + sizeof(double) * 2 + sizeof(double)); + x1= mach_double_read(mbr1 + sizeof(double) * 2 + sizeof(double)); + x2= mach_double_read(mbr2 + sizeof(double) * 2 + sizeof(double)); - if (y1 > y2) + if (x1 > x2) return 1; - if (y2 > y1) + if (x1 < x2) return -1; return 0; } /** Compare a data tuple to a physical record. -@param[in] dtuple data tuple -@param[in] rec B-tree record -@param[in] offsets rec_get_offsets(rec) -@param[in] n_cmp number of fields to compare -@param[in,out] matched_fields number of completely matched fields +@param dtuple data tuple +@param rec B-tree index record +@param index B-tree index +@param offsets rec_get_offsets(rec,index) +@param n_cmp number of fields to compare +@param matched_fields number of completely matched fields @return the comparison result of dtuple and rec @retval 0 if dtuple is equal to rec @retval negative if dtuple is less than rec @retval positive if dtuple is greater than rec */ -int -cmp_dtuple_rec_with_match_low( - const dtuple_t* dtuple, - const rec_t* rec, - const rec_offs* offsets, - ulint n_cmp, - ulint* matched_fields) - MY_ATTRIBUTE((nonnull)); -#define cmp_dtuple_rec_with_match(tuple,rec,offsets,fields) \ +int cmp_dtuple_rec_with_match_low(const dtuple_t *dtuple, const rec_t *rec, + const dict_index_t *index, + const rec_offs *offsets, + ulint n_cmp, ulint *matched_fields) + MY_ATTRIBUTE((nonnull)); +#define cmp_dtuple_rec_with_match(tuple,rec,index,offsets,fields) \ cmp_dtuple_rec_with_match_low( \ - tuple,rec,offsets,dtuple_get_n_fields_cmp(tuple),fields) + tuple,rec,index,offsets,dtuple_get_n_fields_cmp(tuple),fields) /** Compare a data tuple to a physical record. @param[in] dtuple data tuple @param[in] rec B-tree or R-tree index record @@ -178,28 +176,32 @@ cmp_dtuple_rec_with_match_bytes( MY_ATTRIBUTE((warn_unused_result)); /** Compare a data tuple to a physical record. @see cmp_dtuple_rec_with_match -@param[in] dtuple data tuple -@param[in] rec B-tree record -@param[in] offsets rec_get_offsets(rec) +@param dtuple data tuple +@param rec index record +@param index index +@param offsets rec_get_offsets(rec, index) @return the comparison result of dtuple and rec @retval 0 if dtuple is equal to rec @retval negative if dtuple is less than rec @retval positive if dtuple is greater than rec */ -int -cmp_dtuple_rec( - const dtuple_t* dtuple, - const rec_t* rec, - const rec_offs* offsets); -/**************************************************************//** -Checks if a dtuple is a prefix of a record. The last field in dtuple -is allowed to be a prefix of the corresponding field in the record. -@return TRUE if prefix */ -ibool -cmp_dtuple_is_prefix_of_rec( -/*========================*/ - const dtuple_t* dtuple, /*!< in: data tuple */ - const rec_t* rec, /*!< in: physical record */ - const rec_offs* offsets);/*!< in: array returned by rec_get_offsets() */ +inline int cmp_dtuple_rec(const dtuple_t *dtuple, const rec_t *rec, + const dict_index_t *index, const rec_offs *offsets) +{ + ulint matched= 0; + return cmp_dtuple_rec_with_match(dtuple, rec, index, offsets, &matched); +} + +/** Check if a dtuple is a prefix of a record. +@param dtuple data tuple +@param rec index record +@param index index +@param offsets rec_get_offsets(rec) +@return whether dtuple is a prefix of rec */ +bool cmp_dtuple_is_prefix_of_rec(const dtuple_t *dtuple, const rec_t *rec, + const dict_index_t *index, + const rec_offs *offsets) + MY_ATTRIBUTE((nonnull, warn_unused_result)); + /** Compare two physical records that contain the same number of columns, none of which are stored externally. @retval positive if rec1 (including non-ordering columns) is greater than rec2 @@ -246,18 +248,39 @@ cmp_rec_rec( MY_ATTRIBUTE((nonnull(1,2,3,4,5))); /** Compare two data fields. -@param[in] dfield1 data field -@param[in] dfield2 data field +@param dfield1 data field +@param dfield2 data field @return the comparison result of dfield1 and dfield2 -@retval 0 if dfield1 is equal to dfield2, or a prefix of dfield1 -@retval negative if dfield1 is less than dfield2 -@retval positive if dfield1 is greater than dfield2 */ -UNIV_INLINE -int -cmp_dfield_dfield_like_prefix( - const dfield_t* dfield1, - const dfield_t* dfield2); +@retval true if dfield1 is equal to dfield2, or a prefix of dfield1 +@retval false otherwise */ +inline bool cmp_dfield_dfield_eq_prefix(const dfield_t *dfield1, + const dfield_t *dfield2) +{ + ut_ad(dfield_check_typed(dfield1)); + ut_ad(dfield_check_typed(dfield2)); + const dtype_t *type= dfield_get_type(dfield1); -#include "rem0cmp.ic" +#ifdef UNIV_DEBUG + switch (type->prtype & DATA_MYSQL_TYPE_MASK) { + case MYSQL_TYPE_BIT: + case MYSQL_TYPE_STRING: + case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_TINY_BLOB: + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_VARCHAR: + break; + default: + ut_error; + } +#endif /* UNIV_DEBUG */ -#endif + uint cs_num= dtype_get_charset_coll(type->prtype); + CHARSET_INFO *cs= get_charset(cs_num, MYF(MY_WME)); + ut_a(cs); + return !cs->strnncoll(static_cast(dfield_get_data(dfield1)), + dfield_get_len(dfield1), + static_cast(dfield_get_data(dfield2)), + dfield_get_len(dfield2), 1); +} diff --git a/storage/innobase/include/rem0cmp.ic b/storage/innobase/include/rem0cmp.ic deleted file mode 100644 index 6e21382d1870c..0000000000000 --- a/storage/innobase/include/rem0cmp.ic +++ /dev/null @@ -1,107 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2020, MariaDB Corporation. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by 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 02110-1335 USA - -*****************************************************************************/ - -/*******************************************************************//** -@file include/rem0cmp.ic -Comparison services for records - -Created 7/1/1994 Heikki Tuuri -************************************************************************/ - -#include -#include - -/** Compare two data fields. -@param[in] dfield1 data field; must have type field set -@param[in] dfield2 data field -@return the comparison result of dfield1 and dfield2 -@retval 0 if dfield1 is equal to dfield2 -@retval negative if dfield1 is less than dfield2 -@retval positive if dfield1 is greater than dfield2 */ -UNIV_INLINE -int -cmp_dfield_dfield( - const dfield_t* dfield1, - const dfield_t* dfield2) -{ - const dtype_t* type; - - ut_ad(dfield_check_typed(dfield1)); - - type = dfield_get_type(dfield1); - - return(cmp_data_data(type->mtype, type->prtype, - (const byte*) dfield_get_data(dfield1), - dfield_get_len(dfield1), - (const byte*) dfield_get_data(dfield2), - dfield_get_len(dfield2))); -} - -/** Compare two data fields. -@param[in] dfield1 data field -@param[in] dfield2 data field -@return the comparison result of dfield1 and dfield2 -@retval 0 if dfield1 is equal to dfield2, or a prefix of dfield1 -@retval negative if dfield1 is less than dfield2 -@retval positive if dfield1 is greater than dfield2 */ -UNIV_INLINE -int -cmp_dfield_dfield_like_prefix( - const dfield_t* dfield1, - const dfield_t* dfield2) -{ - const dtype_t* type; - - ut_ad(dfield_check_typed(dfield1)); - ut_ad(dfield_check_typed(dfield2)); - - type = dfield_get_type(dfield1); - -#ifdef UNIV_DEBUG - switch (type->prtype & DATA_MYSQL_TYPE_MASK) { - case MYSQL_TYPE_BIT: - case MYSQL_TYPE_STRING: - case MYSQL_TYPE_VAR_STRING: - case MYSQL_TYPE_TINY_BLOB: - case MYSQL_TYPE_MEDIUM_BLOB: - case MYSQL_TYPE_BLOB: - case MYSQL_TYPE_LONG_BLOB: - case MYSQL_TYPE_VARCHAR: - break; - default: - ut_error; - } -#endif /* UNIV_DEBUG */ - - uint cs_num = (uint) dtype_get_charset_coll(type->prtype); - - if (CHARSET_INFO* cs = get_charset(cs_num, MYF(MY_WME))) { - return(cs->strnncoll( - static_cast( - dfield_get_data(dfield1)), - dfield_get_len(dfield1), - static_cast( - dfield_get_data(dfield2)), - dfield_get_len(dfield2), - 1)); - } - - ib::fatal() << "Unable to find charset-collation " << cs_num; - return(0); -} diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h index dbcff3e6fd6fb..2f038ab349f85 100644 --- a/storage/innobase/include/rem0rec.h +++ b/storage/innobase/include/rem0rec.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -141,28 +141,7 @@ constexpr rec_offs REC_OFFS_EXTERNAL= REC_OFFS_COMPACT >> 1; /** Default value flag in offsets returned by rec_get_offsets() */ constexpr rec_offs REC_OFFS_DEFAULT= REC_OFFS_COMPACT >> 2; constexpr rec_offs REC_OFFS_MASK= REC_OFFS_DEFAULT - 1; -/******************************************************//** -The following function is used to get the pointer of the next chained record -on the same page. -@return pointer to the next chained record, or NULL if none */ -UNIV_INLINE -const rec_t* -rec_get_next_ptr_const( -/*===================*/ - const rec_t* rec, /*!< in: physical record */ - ulint comp) /*!< in: nonzero=compact page format */ - MY_ATTRIBUTE((warn_unused_result)); -/******************************************************//** -The following function is used to get the pointer of the next chained record -on the same page. -@return pointer to the next chained record, or NULL if none */ -UNIV_INLINE -rec_t* -rec_get_next_ptr( -/*=============*/ - rec_t* rec, /*!< in: physical record */ - ulint comp) /*!< in: nonzero=compact page format */ - MY_ATTRIBUTE((warn_unused_result)); + /******************************************************//** The following function is used to get the offset of the next chained record on the same page. @@ -727,11 +706,9 @@ in the clustered index for instant ADD COLUMN or ALTER TABLE. @param[in] rec leaf page record @param[in] index index of the record @return whether the record is the metadata pseudo-record */ -inline bool rec_is_metadata(const rec_t* rec, const dict_index_t& index) +inline bool rec_is_metadata(const rec_t *rec, const dict_index_t &index) { - bool is = rec_is_metadata(rec, dict_table_is_comp(index.table)); - ut_ad(!is || index.is_instant()); - return is; + return rec_is_metadata(rec, index.table->not_redundant()); } /** Determine if the record is the metadata pseudo-record @@ -1246,7 +1223,7 @@ class rec_printer : public std::ostringstream { } /** Destructor */ - ~rec_printer() override {} + ~rec_printer() override = default; private: /** Copy constructor */ @@ -1293,7 +1270,7 @@ int wsrep_rec_get_foreign_key( ibool new_protocol); /* in: protocol > 1 */ #endif /* WITH_WSREP */ -#include "rem0rec.ic" +#include "rem0rec.inl" #endif /* !UNIV_INNOCHECKSUM */ #endif /* rem0rec_h */ diff --git a/storage/innobase/include/rem0rec.ic b/storage/innobase/include/rem0rec.ic deleted file mode 100644 index 30c72a7415ad9..0000000000000 --- a/storage/innobase/include/rem0rec.ic +++ /dev/null @@ -1,1204 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, MariaDB Corporation. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/********************************************************************//** -@file include/rem0rec.ic -Record manager - -Created 5/30/1994 Heikki Tuuri -*************************************************************************/ - -#include "mach0data.h" -#include "ut0byte.h" -#include "dict0boot.h" -#include "btr0types.h" - -/* Offsets of the bit-fields in an old-style record. NOTE! In the table the -most significant bytes and bits are written below less significant. - - (1) byte offset (2) bit usage within byte - downward from - origin -> 1 8 bits pointer to next record - 2 8 bits pointer to next record - 3 1 bit short flag - 7 bits number of fields - 4 3 bits number of fields - 5 bits heap number - 5 8 bits heap number - 6 4 bits n_owned - 4 bits info bits -*/ - -/* Offsets of the bit-fields in a new-style record. NOTE! In the table the -most significant bytes and bits are written below less significant. - - (1) byte offset (2) bit usage within byte - downward from - origin -> 1 8 bits relative offset of next record - 2 8 bits relative offset of next record - the relative offset is an unsigned 16-bit - integer: - (offset_of_next_record - - offset_of_this_record) mod 64Ki, - where mod is the modulo as a non-negative - number; - we can calculate the offset of the next - record with the formula: - relative_offset + offset_of_this_record - mod srv_page_size - 3 3 bits status: - 000=REC_STATUS_ORDINARY - 001=REC_STATUS_NODE_PTR - 010=REC_STATUS_INFIMUM - 011=REC_STATUS_SUPREMUM - 100=REC_STATUS_INSTANT - 1xx=reserved - 5 bits heap number - 4 8 bits heap number - 5 4 bits n_owned - 4 bits info bits -*/ - -/* We list the byte offsets from the origin of the record, the mask, -and the shift needed to obtain each bit-field of the record. */ - -#define REC_NEXT 2 -#define REC_NEXT_MASK 0xFFFFUL -#define REC_NEXT_SHIFT 0 - -#define REC_OLD_SHORT 3 /* This is single byte bit-field */ -#define REC_OLD_SHORT_MASK 0x1UL -#define REC_OLD_SHORT_SHIFT 0 - -#define REC_OLD_N_FIELDS 4 -#define REC_OLD_N_FIELDS_MASK 0x7FEUL -#define REC_OLD_N_FIELDS_SHIFT 1 - -#define REC_OLD_HEAP_NO 5 -#define REC_HEAP_NO_MASK 0xFFF8UL -#if 0 /* defined in rem0rec.h for use of page0zip.cc */ -#define REC_NEW_HEAP_NO 4 -#define REC_HEAP_NO_SHIFT 3 -#endif - -#define REC_OLD_N_OWNED 6 /* This is single byte bit-field */ -#define REC_NEW_N_OWNED 5 /* This is single byte bit-field */ -#define REC_N_OWNED_MASK 0xFUL -#define REC_N_OWNED_SHIFT 0 - -#define REC_OLD_INFO_BITS 6 /* This is single byte bit-field */ -#define REC_NEW_INFO_BITS 5 /* This is single byte bit-field */ -#define REC_INFO_BITS_MASK 0xF0UL -#define REC_INFO_BITS_SHIFT 0 - -#if REC_OLD_SHORT_MASK << (8 * (REC_OLD_SHORT - 3)) \ - ^ REC_OLD_N_FIELDS_MASK << (8 * (REC_OLD_N_FIELDS - 4)) \ - ^ REC_HEAP_NO_MASK << (8 * (REC_OLD_HEAP_NO - 4)) \ - ^ REC_N_OWNED_MASK << (8 * (REC_OLD_N_OWNED - 3)) \ - ^ REC_INFO_BITS_MASK << (8 * (REC_OLD_INFO_BITS - 3)) \ - ^ 0xFFFFFFFFUL -# error "sum of old-style masks != 0xFFFFFFFFUL" -#endif -#if REC_NEW_STATUS_MASK << (8 * (REC_NEW_STATUS - 3)) \ - ^ REC_HEAP_NO_MASK << (8 * (REC_NEW_HEAP_NO - 4)) \ - ^ REC_N_OWNED_MASK << (8 * (REC_NEW_N_OWNED - 3)) \ - ^ REC_INFO_BITS_MASK << (8 * (REC_NEW_INFO_BITS - 3)) \ - ^ 0xFFFFFFUL -# error "sum of new-style masks != 0xFFFFFFUL" -#endif - -/******************************************************//** -Gets a bit field from within 1 byte. */ -UNIV_INLINE -byte -rec_get_bit_field_1( -/*================*/ - const rec_t* rec, /*!< in: pointer to record origin */ - ulint offs, /*!< in: offset from the origin down */ - ulint mask, /*!< in: mask used to filter bits */ - ulint shift) /*!< in: shift right applied after masking */ -{ - return static_cast((*(rec - offs) & mask) >> shift); -} - -/******************************************************//** -Sets a bit field within 1 byte. */ -UNIV_INLINE -void -rec_set_bit_field_1( -/*================*/ - rec_t* rec, /*!< in: pointer to record origin */ - ulint val, /*!< in: value to set */ - ulint offs, /*!< in: offset from the origin down */ - ulint mask, /*!< in: mask used to filter bits */ - ulint shift) /*!< in: shift right applied after masking */ -{ - ut_ad(rec); - ut_ad(offs <= REC_N_OLD_EXTRA_BYTES); - ut_ad(mask); - ut_ad(mask <= 0xFFUL); - ut_ad(((mask >> shift) << shift) == mask); - ut_ad(((val << shift) & mask) == (val << shift)); - - mach_write_to_1(rec - offs, - (mach_read_from_1(rec - offs) & ~mask) - | (val << shift)); -} - -/******************************************************//** -Gets a bit field from within 2 bytes. */ -UNIV_INLINE -ulint -rec_get_bit_field_2( -/*================*/ - const rec_t* rec, /*!< in: pointer to record origin */ - ulint offs, /*!< in: offset from the origin down */ - ulint mask, /*!< in: mask used to filter bits */ - ulint shift) /*!< in: shift right applied after masking */ -{ - ut_ad(rec); - - return((mach_read_from_2(rec - offs) & mask) >> shift); -} - -/******************************************************//** -Sets a bit field within 2 bytes. */ -UNIV_INLINE -void -rec_set_bit_field_2( -/*================*/ - rec_t* rec, /*!< in: pointer to record origin */ - ulint val, /*!< in: value to set */ - ulint offs, /*!< in: offset from the origin down */ - ulint mask, /*!< in: mask used to filter bits */ - ulint shift) /*!< in: shift right applied after masking */ -{ - ut_ad(rec); - ut_ad(offs <= REC_N_OLD_EXTRA_BYTES); - ut_ad(mask > 0xFFUL); - ut_ad(mask <= 0xFFFFUL); - ut_ad((mask >> shift) & 1); - ut_ad(0 == ((mask >> shift) & ((mask >> shift) + 1))); - ut_ad(((mask >> shift) << shift) == mask); - ut_ad(((val << shift) & mask) == (val << shift)); - - mach_write_to_2(rec - offs, - (mach_read_from_2(rec - offs) & ~mask) - | (val << shift)); -} - -/******************************************************//** -The following function is used to get the pointer of the next chained record -on the same page. -@return pointer to the next chained record, or NULL if none */ -UNIV_INLINE -const rec_t* -rec_get_next_ptr_const( -/*===================*/ - const rec_t* rec, /*!< in: physical record */ - ulint comp) /*!< in: nonzero=compact page format */ -{ - ulint field_value; - - compile_time_assert(REC_NEXT_MASK == 0xFFFFUL); - compile_time_assert(REC_NEXT_SHIFT == 0); - - field_value = mach_read_from_2(rec - REC_NEXT); - - if (field_value == 0) { - - return(NULL); - } - - if (comp) { -#if UNIV_PAGE_SIZE_MAX <= 32768 - /* Note that for 64 KiB pages, field_value can 'wrap around' - and the debug assertion is not valid */ - - /* In the following assertion, field_value is interpreted - as signed 16-bit integer in 2's complement arithmetics. - If all platforms defined int16_t in the standard headers, - the expression could be written simpler as - (int16_t) field_value + ut_align_offset(...) < srv_page_size - */ - ut_ad((field_value >= 32768 - ? field_value - 65536 - : field_value) - + ut_align_offset(rec, srv_page_size) - < srv_page_size); -#endif - /* There must be at least REC_N_NEW_EXTRA_BYTES + 1 - between each record. */ - ut_ad((field_value > REC_N_NEW_EXTRA_BYTES - && field_value < 32768) - || field_value < (uint16) -REC_N_NEW_EXTRA_BYTES); - - return((byte*) ut_align_down(rec, srv_page_size) - + ut_align_offset(rec + field_value, srv_page_size)); - } else { - ut_ad(field_value < srv_page_size); - - return((byte*) ut_align_down(rec, srv_page_size) - + field_value); - } -} - -/******************************************************//** -The following function is used to get the pointer of the next chained record -on the same page. -@return pointer to the next chained record, or NULL if none */ -UNIV_INLINE -rec_t* -rec_get_next_ptr( -/*=============*/ - rec_t* rec, /*!< in: physical record */ - ulint comp) /*!< in: nonzero=compact page format */ -{ - return(const_cast(rec_get_next_ptr_const(rec, comp))); -} - -/******************************************************//** -The following function is used to get the offset of the next chained record -on the same page. -@return the page offset of the next chained record, or 0 if none */ -UNIV_INLINE -ulint -rec_get_next_offs( -/*==============*/ - const rec_t* rec, /*!< in: physical record */ - ulint comp) /*!< in: nonzero=compact page format */ -{ - ulint field_value; - compile_time_assert(REC_NEXT_MASK == 0xFFFFUL); - compile_time_assert(REC_NEXT_SHIFT == 0); - - field_value = mach_read_from_2(rec - REC_NEXT); - - if (comp) { -#if UNIV_PAGE_SIZE_MAX <= 32768 - /* Note that for 64 KiB pages, field_value can 'wrap around' - and the debug assertion is not valid */ - - /* In the following assertion, field_value is interpreted - as signed 16-bit integer in 2's complement arithmetics. - If all platforms defined int16_t in the standard headers, - the expression could be written simpler as - (int16_t) field_value + ut_align_offset(...) < srv_page_size - */ - ut_ad((field_value >= 32768 - ? field_value - 65536 - : field_value) - + ut_align_offset(rec, srv_page_size) - < srv_page_size); -#endif - if (field_value == 0) { - - return(0); - } - - /* There must be at least REC_N_NEW_EXTRA_BYTES + 1 - between each record. */ - ut_ad((field_value > REC_N_NEW_EXTRA_BYTES - && field_value < 32768) - || field_value < (uint16) -REC_N_NEW_EXTRA_BYTES); - - return(ut_align_offset(rec + field_value, srv_page_size)); - } else { - ut_ad(field_value < srv_page_size); - - return(field_value); - } -} - -/******************************************************//** -The following function is used to set the next record offset field -of an old-style record. */ -UNIV_INLINE -void -rec_set_next_offs_old( -/*==================*/ - rec_t* rec, /*!< in: old-style physical record */ - ulint next) /*!< in: offset of the next record */ -{ - ut_ad(srv_page_size > next); - compile_time_assert(REC_NEXT_MASK == 0xFFFFUL); - compile_time_assert(REC_NEXT_SHIFT == 0); - mach_write_to_2(rec - REC_NEXT, next); -} - -/******************************************************//** -The following function is used to set the next record offset field -of a new-style record. */ -UNIV_INLINE -void -rec_set_next_offs_new( -/*==================*/ - rec_t* rec, /*!< in/out: new-style physical record */ - ulint next) /*!< in: offset of the next record */ -{ - ulint field_value; - - ut_ad(srv_page_size > next); - - if (!next) { - field_value = 0; - } else { - /* The following two statements calculate - next - offset_of_rec mod 64Ki, where mod is the modulo - as a non-negative number */ - - field_value = (ulint) - ((lint) next - - (lint) ut_align_offset(rec, srv_page_size)); - field_value &= REC_NEXT_MASK; - } - - mach_write_to_2(rec - REC_NEXT, field_value); -} - -/******************************************************//** -The following function is used to get the number of fields -in an old-style record. -@return number of data fields */ -UNIV_INLINE -ulint -rec_get_n_fields_old( -/*=================*/ - const rec_t* rec) /*!< in: physical record */ -{ - ulint ret; - - ut_ad(rec); - - ret = rec_get_bit_field_2(rec, REC_OLD_N_FIELDS, - REC_OLD_N_FIELDS_MASK, - REC_OLD_N_FIELDS_SHIFT); - ut_ad(ret <= REC_MAX_N_FIELDS); - ut_ad(ret > 0); - - return(ret); -} - -/******************************************************//** -The following function is used to set the number of fields -in an old-style record. */ -UNIV_INLINE -void -rec_set_n_fields_old( -/*=================*/ - rec_t* rec, /*!< in: physical record */ - ulint n_fields) /*!< in: the number of fields */ -{ - ut_ad(rec); - ut_ad(n_fields <= REC_MAX_N_FIELDS); - ut_ad(n_fields > 0); - - rec_set_bit_field_2(rec, n_fields, REC_OLD_N_FIELDS, - REC_OLD_N_FIELDS_MASK, REC_OLD_N_FIELDS_SHIFT); -} - -/******************************************************//** -The following function is used to get the number of fields -in a record. -@return number of data fields */ -UNIV_INLINE -ulint -rec_get_n_fields( -/*=============*/ - const rec_t* rec, /*!< in: physical record */ - const dict_index_t* index) /*!< in: record descriptor */ -{ - ut_ad(rec); - ut_ad(index); - - if (!dict_table_is_comp(index->table)) { - return(rec_get_n_fields_old(rec)); - } - - switch (rec_get_status(rec)) { - case REC_STATUS_INSTANT: - case REC_STATUS_ORDINARY: - return(dict_index_get_n_fields(index)); - case REC_STATUS_NODE_PTR: - return(dict_index_get_n_unique_in_tree(index) + 1); - case REC_STATUS_INFIMUM: - case REC_STATUS_SUPREMUM: - return(1); - } - - ut_error; - return(ULINT_UNDEFINED); -} - -/** Confirms the n_fields of the entry is sane with comparing the other -record in the same page specified -@param[in] index index -@param[in] rec record of the same page -@param[in] entry index entry -@return true if n_fields is sane */ -UNIV_INLINE -bool -rec_n_fields_is_sane( - dict_index_t* index, - const rec_t* rec, - const dtuple_t* entry) -{ - const ulint n_fields = rec_get_n_fields(rec, index); - - return(n_fields == dtuple_get_n_fields(entry) - || (index->is_instant() - && n_fields >= index->n_core_fields) - /* a record for older SYS_INDEXES table - (missing merge_threshold column) is acceptable. */ - || (index->table->id == DICT_INDEXES_ID - && n_fields == dtuple_get_n_fields(entry) - 1)); -} - -/******************************************************//** -The following function is used to get the number of records owned by the -previous directory record. -@return number of owned records */ -UNIV_INLINE -ulint -rec_get_n_owned_old( -/*================*/ - const rec_t* rec) /*!< in: old-style physical record */ -{ - return(rec_get_bit_field_1(rec, REC_OLD_N_OWNED, - REC_N_OWNED_MASK, REC_N_OWNED_SHIFT)); -} - -/******************************************************//** -The following function is used to get the number of records owned by the -previous directory record. -@return number of owned records */ -UNIV_INLINE -ulint -rec_get_n_owned_new( -/*================*/ - const rec_t* rec) /*!< in: new-style physical record */ -{ - return(rec_get_bit_field_1(rec, REC_NEW_N_OWNED, - REC_N_OWNED_MASK, REC_N_OWNED_SHIFT)); -} - -/******************************************************//** -The following function is used to retrieve the info bits of a record. -@return info bits */ -UNIV_INLINE -byte -rec_get_info_bits( -/*==============*/ - const rec_t* rec, /*!< in: physical record */ - ulint comp) /*!< in: nonzero=compact page format */ -{ - return rec_get_bit_field_1( - rec, comp ? REC_NEW_INFO_BITS : REC_OLD_INFO_BITS, - REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT); -} - -/******************************************************//** -The following function is used to retrieve the info and status -bits of a record. (Only compact records have status bits.) -@return info and status bits */ -UNIV_INLINE -byte -rec_get_info_and_status_bits( -/*=========================*/ - const rec_t* rec, /*!< in: physical record */ - ulint comp) /*!< in: nonzero=compact page format */ -{ - compile_time_assert(!((REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) - & (REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT))); - if (comp) - return static_cast(rec_get_info_bits(rec, TRUE) | - rec_get_status(rec)); - else - return rec_get_info_bits(rec, FALSE); -} -/******************************************************//** -The following function is used to set the info and status -bits of a record. (Only compact records have status bits.) */ -UNIV_INLINE -void -rec_set_info_and_status_bits( -/*=========================*/ - rec_t* rec, /*!< in/out: physical record */ - ulint bits) /*!< in: info bits */ -{ - compile_time_assert(!((REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) - & (REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT))); - rec_set_status(rec, bits & REC_NEW_STATUS_MASK); - rec_set_bit_field_1(rec, bits & ~REC_NEW_STATUS_MASK, - REC_NEW_INFO_BITS, - REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT); -} - -/******************************************************//** -The following function tells if record is delete marked. -@return nonzero if delete marked */ -UNIV_INLINE -ulint -rec_get_deleted_flag( -/*=================*/ - const rec_t* rec, /*!< in: physical record */ - ulint comp) /*!< in: nonzero=compact page format */ -{ - if (comp) { - return(rec_get_bit_field_1(rec, REC_NEW_INFO_BITS, - REC_INFO_DELETED_FLAG, - REC_INFO_BITS_SHIFT)); - } else { - return(rec_get_bit_field_1(rec, REC_OLD_INFO_BITS, - REC_INFO_DELETED_FLAG, - REC_INFO_BITS_SHIFT)); - } -} - -/******************************************************//** -The following function tells if a new-style record is a node pointer. -@return TRUE if node pointer */ -UNIV_INLINE -bool -rec_get_node_ptr_flag( -/*==================*/ - const rec_t* rec) /*!< in: physical record */ -{ - return(REC_STATUS_NODE_PTR == rec_get_status(rec)); -} - -/******************************************************//** -The following function is used to get the order number -of an old-style record in the heap of the index page. -@return heap order number */ -UNIV_INLINE -ulint -rec_get_heap_no_old( -/*================*/ - const rec_t* rec) /*!< in: physical record */ -{ - return(rec_get_bit_field_2(rec, REC_OLD_HEAP_NO, - REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT)); -} - -/******************************************************//** -The following function is used to get the order number -of a new-style record in the heap of the index page. -@return heap order number */ -UNIV_INLINE -ulint -rec_get_heap_no_new( -/*================*/ - const rec_t* rec) /*!< in: physical record */ -{ - return(rec_get_bit_field_2(rec, REC_NEW_HEAP_NO, - REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT)); -} - -/******************************************************//** -The following function is used to test whether the data offsets in the record -are stored in one-byte or two-byte format. -@return TRUE if 1-byte form */ -UNIV_INLINE -ibool -rec_get_1byte_offs_flag( -/*====================*/ - const rec_t* rec) /*!< in: physical record */ -{ - return(rec_get_bit_field_1(rec, REC_OLD_SHORT, REC_OLD_SHORT_MASK, - REC_OLD_SHORT_SHIFT)); -} - -/******************************************************//** -The following function is used to set the 1-byte offsets flag. */ -UNIV_INLINE -void -rec_set_1byte_offs_flag( -/*====================*/ - rec_t* rec, /*!< in: physical record */ - ibool flag) /*!< in: TRUE if 1byte form */ -{ - ut_ad(flag <= 1); - - rec_set_bit_field_1(rec, flag, REC_OLD_SHORT, REC_OLD_SHORT_MASK, - REC_OLD_SHORT_SHIFT); -} - -/******************************************************//** -Returns the offset of nth field end if the record is stored in the 1-byte -offsets form. If the field is SQL null, the flag is ORed in the returned -value. -@return offset of the start of the field, SQL null flag ORed */ -UNIV_INLINE -uint8_t -rec_1_get_field_end_info( -/*=====================*/ - const rec_t* rec, /*!< in: record */ - ulint n) /*!< in: field index */ -{ - ut_ad(rec_get_1byte_offs_flag(rec)); - ut_ad(n < rec_get_n_fields_old(rec)); - - return(mach_read_from_1(rec - (REC_N_OLD_EXTRA_BYTES + n + 1))); -} - -/******************************************************//** -Returns the offset of nth field end if the record is stored in the 2-byte -offsets form. If the field is SQL null, the flag is ORed in the returned -value. -@return offset of the start of the field, SQL null flag and extern -storage flag ORed */ -UNIV_INLINE -uint16_t -rec_2_get_field_end_info( -/*=====================*/ - const rec_t* rec, /*!< in: record */ - ulint n) /*!< in: field index */ -{ - ut_ad(!rec_get_1byte_offs_flag(rec)); - ut_ad(n < rec_get_n_fields_old(rec)); - - return(mach_read_from_2(rec - (REC_N_OLD_EXTRA_BYTES + 2 * n + 2))); -} - -/******************************************************//** -Returns nonzero if the field is stored off-page. -@retval 0 if the field is stored in-page -@retval REC_2BYTE_EXTERN_MASK if the field is stored externally */ -UNIV_INLINE -ulint -rec_2_is_field_extern( -/*==================*/ - const rec_t* rec, /*!< in: record */ - ulint n) /*!< in: field index */ -{ - return(rec_2_get_field_end_info(rec, n) & REC_2BYTE_EXTERN_MASK); -} - -/**********************************************************//** -The following function sets the number of allocated elements -for an array of offsets. */ -UNIV_INLINE -void -rec_offs_set_n_alloc( -/*=================*/ - rec_offs*offsets, /*!< out: array for rec_get_offsets(), - must be allocated */ - ulint n_alloc) /*!< in: number of elements */ -{ - ut_ad(n_alloc > REC_OFFS_HEADER_SIZE); - MEM_UNDEFINED(offsets, n_alloc * sizeof *offsets); - offsets[0] = static_cast(n_alloc); -} - -/************************************************************//** -The following function is used to get an offset to the nth -data field in a record. -@return offset from the origin of rec */ -UNIV_INLINE -rec_offs -rec_get_nth_field_offs( -/*===================*/ - const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */ - ulint n, /*!< in: index of the field */ - ulint* len) /*!< out: length of the field; UNIV_SQL_NULL - if SQL null; UNIV_SQL_DEFAULT is default value */ -{ - ut_ad(n < rec_offs_n_fields(offsets)); - - rec_offs offs = n == 0 ? 0 : get_value(rec_offs_base(offsets)[n]); - rec_offs next_offs = rec_offs_base(offsets)[1 + n]; - - if (get_type(next_offs) == SQL_NULL) { - *len = UNIV_SQL_NULL; - } else if (get_type(next_offs) == DEFAULT) { - *len = UNIV_SQL_DEFAULT; - } else { - *len = get_value(next_offs) - offs; - } - - return(offs); -} - -/******************************************************//** -Determine if the offsets are for a record containing null BLOB pointers. -@return first field containing a null BLOB pointer, or NULL if none found */ -UNIV_INLINE -const byte* -rec_offs_any_null_extern( -/*=====================*/ - const rec_t* rec, /*!< in: record */ - const rec_offs* offsets) /*!< in: rec_get_offsets(rec) */ -{ - ulint i; - ut_ad(rec_offs_validate(rec, NULL, offsets)); - - if (!rec_offs_any_extern(offsets)) { - return(NULL); - } - - for (i = 0; i < rec_offs_n_fields(offsets); i++) { - if (rec_offs_nth_extern(offsets, i)) { - ulint len; - const byte* field - = rec_get_nth_field(rec, offsets, i, &len); - - ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE); - if (!memcmp(field + len - - BTR_EXTERN_FIELD_REF_SIZE, - field_ref_zero, - BTR_EXTERN_FIELD_REF_SIZE)) { - return(field); - } - } - } - - return(NULL); -} - -/******************************************************//** -Gets the physical size of a field. -@return length of field */ -UNIV_INLINE -ulint -rec_offs_nth_size( -/*==============*/ - const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */ - ulint n) /*!< in: nth field */ -{ - ut_ad(rec_offs_validate(NULL, NULL, offsets)); - ut_ad(n < rec_offs_n_fields(offsets)); - if (!n) { - return get_value(rec_offs_base(offsets)[1 + n]); - } - return get_value((rec_offs_base(offsets)[1 + n])) - - get_value(rec_offs_base(offsets)[n]); -} - -/******************************************************//** -Returns the number of extern bits set in a record. -@return number of externally stored fields */ -UNIV_INLINE -ulint -rec_offs_n_extern( -/*==============*/ - const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ -{ - ulint n = 0; - - if (rec_offs_any_extern(offsets)) { - ulint i; - - for (i = rec_offs_n_fields(offsets); i--; ) { - if (rec_offs_nth_extern(offsets, i)) { - n++; - } - } - } - - return(n); -} - -/******************************************************//** -Returns the offset of n - 1th field end if the record is stored in the 1-byte -offsets form. If the field is SQL null, the flag is ORed in the returned -value. This function and the 2-byte counterpart are defined here because the -C-compiler was not able to sum negative and positive constant offsets, and -warned of constant arithmetic overflow within the compiler. -@return offset of the start of the PREVIOUS field, SQL null flag ORed */ -UNIV_INLINE -ulint -rec_1_get_prev_field_end_info( -/*==========================*/ - const rec_t* rec, /*!< in: record */ - ulint n) /*!< in: field index */ -{ - ut_ad(rec_get_1byte_offs_flag(rec)); - ut_ad(n <= rec_get_n_fields_old(rec)); - - return(mach_read_from_1(rec - (REC_N_OLD_EXTRA_BYTES + n))); -} - -/******************************************************//** -Returns the offset of n - 1th field end if the record is stored in the 2-byte -offsets form. If the field is SQL null, the flag is ORed in the returned -value. -@return offset of the start of the PREVIOUS field, SQL null flag ORed */ -UNIV_INLINE -ulint -rec_2_get_prev_field_end_info( -/*==========================*/ - const rec_t* rec, /*!< in: record */ - ulint n) /*!< in: field index */ -{ - ut_ad(!rec_get_1byte_offs_flag(rec)); - ut_ad(n <= rec_get_n_fields_old(rec)); - - return(mach_read_from_2(rec - (REC_N_OLD_EXTRA_BYTES + 2 * n))); -} - -/******************************************************//** -Sets the field end info for the nth field if the record is stored in the -1-byte format. */ -UNIV_INLINE -void -rec_1_set_field_end_info( -/*=====================*/ - rec_t* rec, /*!< in: record */ - ulint n, /*!< in: field index */ - ulint info) /*!< in: value to set */ -{ - ut_ad(rec_get_1byte_offs_flag(rec)); - ut_ad(n < rec_get_n_fields_old(rec)); - - mach_write_to_1(rec - (REC_N_OLD_EXTRA_BYTES + n + 1), info); -} - -/******************************************************//** -Sets the field end info for the nth field if the record is stored in the -2-byte format. */ -UNIV_INLINE -void -rec_2_set_field_end_info( -/*=====================*/ - rec_t* rec, /*!< in: record */ - ulint n, /*!< in: field index */ - ulint info) /*!< in: value to set */ -{ - ut_ad(!rec_get_1byte_offs_flag(rec)); - ut_ad(n < rec_get_n_fields_old(rec)); - - mach_write_to_2(rec - (REC_N_OLD_EXTRA_BYTES + 2 * n + 2), info); -} - -/******************************************************//** -Returns the offset of nth field start if the record is stored in the 1-byte -offsets form. -@return offset of the start of the field */ -UNIV_INLINE -ulint -rec_1_get_field_start_offs( -/*=======================*/ - const rec_t* rec, /*!< in: record */ - ulint n) /*!< in: field index */ -{ - ut_ad(rec_get_1byte_offs_flag(rec)); - ut_ad(n <= rec_get_n_fields_old(rec)); - - if (n == 0) { - - return(0); - } - - return(rec_1_get_prev_field_end_info(rec, n) - & ~REC_1BYTE_SQL_NULL_MASK); -} - -/******************************************************//** -Returns the offset of nth field start if the record is stored in the 2-byte -offsets form. -@return offset of the start of the field */ -UNIV_INLINE -ulint -rec_2_get_field_start_offs( -/*=======================*/ - const rec_t* rec, /*!< in: record */ - ulint n) /*!< in: field index */ -{ - ut_ad(!rec_get_1byte_offs_flag(rec)); - ut_ad(n <= rec_get_n_fields_old(rec)); - - if (n == 0) { - - return(0); - } - - return(rec_2_get_prev_field_end_info(rec, n) - & ~(REC_2BYTE_SQL_NULL_MASK | REC_2BYTE_EXTERN_MASK)); -} - -/******************************************************//** -The following function is used to read the offset of the start of a data field -in the record. The start of an SQL null field is the end offset of the -previous non-null field, or 0, if none exists. If n is the number of the last -field + 1, then the end offset of the last field is returned. -@return offset of the start of the field */ -UNIV_INLINE -ulint -rec_get_field_start_offs( -/*=====================*/ - const rec_t* rec, /*!< in: record */ - ulint n) /*!< in: field index */ -{ - ut_ad(rec); - ut_ad(n <= rec_get_n_fields_old(rec)); - - if (n == 0) { - - return(0); - } - - if (rec_get_1byte_offs_flag(rec)) { - - return(rec_1_get_field_start_offs(rec, n)); - } - - return(rec_2_get_field_start_offs(rec, n)); -} - -/************************************************************//** -Gets the physical size of an old-style field. -Also an SQL null may have a field of size > 0, -if the data type is of a fixed size. -@return field size in bytes */ -UNIV_INLINE -ulint -rec_get_nth_field_size( -/*===================*/ - const rec_t* rec, /*!< in: record */ - ulint n) /*!< in: index of the field */ -{ - ulint os; - ulint next_os; - - os = rec_get_field_start_offs(rec, n); - next_os = rec_get_field_start_offs(rec, n + 1); - - ut_ad(next_os - os < srv_page_size); - - return(next_os - os); -} - -/**********************************************************//** -The following function returns the data size of an old-style physical -record, that is the sum of field lengths. SQL null fields -are counted as length 0 fields. The value returned by the function -is the distance from record origin to record end in bytes. -@return size */ -UNIV_INLINE -ulint -rec_get_data_size_old( -/*==================*/ - const rec_t* rec) /*!< in: physical record */ -{ - ut_ad(rec); - - return(rec_get_field_start_offs(rec, rec_get_n_fields_old(rec))); -} - -/**********************************************************//** -The following function sets the number of fields in offsets. */ -UNIV_INLINE -void -rec_offs_set_n_fields( -/*==================*/ - rec_offs* offsets, /*!< in/out: array returned by - rec_get_offsets() */ - ulint n_fields) /*!< in: number of fields */ -{ - ut_ad(offsets); - ut_ad(n_fields > 0); - ut_ad(n_fields <= REC_MAX_N_FIELDS); - ut_ad(n_fields + REC_OFFS_HEADER_SIZE - <= rec_offs_get_n_alloc(offsets)); - offsets[1] = static_cast(n_fields); -} - -/**********************************************************//** -The following function returns the data size of a physical -record, that is the sum of field lengths. SQL null fields -are counted as length 0 fields. The value returned by the function -is the distance from record origin to record end in bytes. -@return size */ -UNIV_INLINE -ulint -rec_offs_data_size( -/*===============*/ - const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ -{ - ulint size; - - ut_ad(rec_offs_validate(NULL, NULL, offsets)); - size = get_value(rec_offs_base(offsets)[rec_offs_n_fields(offsets)]); - ut_ad(size < srv_page_size); - return(size); -} - -/**********************************************************//** -Returns the total size of record minus data size of record. The value -returned by the function is the distance from record start to record origin -in bytes. -@return size */ -UNIV_INLINE -ulint -rec_offs_extra_size( -/*================*/ - const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ -{ - ulint size; - ut_ad(rec_offs_validate(NULL, NULL, offsets)); - size = *rec_offs_base(offsets) & REC_OFFS_MASK; - ut_ad(size < srv_page_size); - return(size); -} - -/**********************************************************//** -Returns the total size of a physical record. -@return size */ -UNIV_INLINE -ulint -rec_offs_size( -/*==========*/ - const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ -{ - return(rec_offs_data_size(offsets) + rec_offs_extra_size(offsets)); -} - -#ifdef UNIV_DEBUG -/**********************************************************//** -Returns a pointer to the end of the record. -@return pointer to end */ -UNIV_INLINE -byte* -rec_get_end( -/*========*/ - const rec_t* rec, /*!< in: pointer to record */ - const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ -{ - ut_ad(rec_offs_validate(rec, NULL, offsets)); - return(const_cast(rec + rec_offs_data_size(offsets))); -} - -/**********************************************************//** -Returns a pointer to the start of the record. -@return pointer to start */ -UNIV_INLINE -byte* -rec_get_start( -/*==========*/ - const rec_t* rec, /*!< in: pointer to record */ - const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ -{ - ut_ad(rec_offs_validate(rec, NULL, offsets)); - return(const_cast(rec - rec_offs_extra_size(offsets))); -} -#endif /* UNIV_DEBUG */ - -/** Copy a physical record to a buffer. -@param[in] buf buffer -@param[in] rec physical record -@param[in] offsets array returned by rec_get_offsets() -@return pointer to the origin of the copy */ -UNIV_INLINE -rec_t* -rec_copy( - void* buf, - const rec_t* rec, - const rec_offs* offsets) -{ - ulint extra_len; - ulint data_len; - - ut_ad(rec != NULL); - ut_ad(buf != NULL); - ut_ad(rec_offs_validate(rec, NULL, offsets)); - ut_ad(rec_validate(rec, offsets)); - - extra_len = rec_offs_extra_size(offsets); - data_len = rec_offs_data_size(offsets); - - memcpy(buf, rec - extra_len, extra_len + data_len); - - return((byte*) buf + extra_len); -} - -/**********************************************************//** -Returns the extra size of an old-style physical record if we know its -data size and number of fields. -@return extra size */ -UNIV_INLINE -ulint -rec_get_converted_extra_size( -/*=========================*/ - ulint data_size, /*!< in: data size */ - ulint n_fields, /*!< in: number of fields */ - ulint n_ext) /*!< in: number of externally stored columns */ -{ - if (!n_ext && data_size <= REC_1BYTE_OFFS_LIMIT) { - - return(REC_N_OLD_EXTRA_BYTES + n_fields); - } - - return(REC_N_OLD_EXTRA_BYTES + 2 * n_fields); -} - -/**********************************************************//** -The following function returns the size of a data tuple when converted to -a physical record. -@return size */ -UNIV_INLINE -ulint -rec_get_converted_size( -/*===================*/ - dict_index_t* index, /*!< in: record descriptor */ - const dtuple_t* dtuple, /*!< in: data tuple */ - ulint n_ext) /*!< in: number of externally stored columns */ -{ - ulint data_size; - ulint extra_size; - - ut_ad(dtuple_check_typed(dtuple)); -#ifdef UNIV_DEBUG - if (dict_index_is_ibuf(index)) { - ut_ad(dtuple->n_fields > 1); - } else if ((dtuple_get_info_bits(dtuple) & REC_NEW_STATUS_MASK) - == REC_STATUS_NODE_PTR) { - ut_ad(dtuple->n_fields - 1 - == dict_index_get_n_unique_in_tree_nonleaf(index)); - } else if (index->table->id == DICT_INDEXES_ID) { - /* The column SYS_INDEXES.MERGE_THRESHOLD was - instantly added in MariaDB 10.2.2 (MySQL 5.7). */ - ut_ad(!index->table->is_temporary()); - ut_ad(index->n_fields == DICT_NUM_FIELDS__SYS_INDEXES); - ut_ad(dtuple->n_fields == DICT_NUM_FIELDS__SYS_INDEXES - || dtuple->n_fields - == DICT_FLD__SYS_INDEXES__MERGE_THRESHOLD); - } else { - ut_ad(dtuple->n_fields >= index->n_core_fields); - ut_ad(dtuple->n_fields <= index->n_fields - || dtuple->is_alter_metadata()); - } -#endif - - if (dict_table_is_comp(index->table)) { - return rec_get_converted_size_comp(index, dtuple, NULL); - } - - data_size = dtuple_get_data_size(dtuple, 0); - - /* If primary key is being updated then the new record inherits - externally stored fields from the delete-marked old record. - In that case, n_ext may be less value than - dtuple_get_n_ext(tuple). */ - ut_ad(n_ext <= dtuple_get_n_ext(dtuple)); - extra_size = rec_get_converted_extra_size( - data_size, dtuple_get_n_fields(dtuple), n_ext); - - return(data_size + extra_size); -} diff --git a/storage/innobase/include/rem0rec.inl b/storage/innobase/include/rem0rec.inl new file mode 100644 index 0000000000000..46c209cbdec43 --- /dev/null +++ b/storage/innobase/include/rem0rec.inl @@ -0,0 +1,1134 @@ +/***************************************************************************** + +Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, 2022, 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 02110-1335 USA + +*****************************************************************************/ + +/********************************************************************//** +@file include/rem0rec.ic +Record manager + +Created 5/30/1994 Heikki Tuuri +*************************************************************************/ + +#include "mach0data.h" +#include "ut0byte.h" +#include "dict0boot.h" +#include "btr0types.h" + +/* Offsets of the bit-fields in an old-style record. NOTE! In the table the +most significant bytes and bits are written below less significant. + + (1) byte offset (2) bit usage within byte + downward from + origin -> 1 8 bits pointer to next record + 2 8 bits pointer to next record + 3 1 bit short flag + 7 bits number of fields + 4 3 bits number of fields + 5 bits heap number + 5 8 bits heap number + 6 4 bits n_owned + 4 bits info bits +*/ + +/* Offsets of the bit-fields in a new-style record. NOTE! In the table the +most significant bytes and bits are written below less significant. + + (1) byte offset (2) bit usage within byte + downward from + origin -> 1 8 bits relative offset of next record + 2 8 bits relative offset of next record + the relative offset is an unsigned 16-bit + integer: + (offset_of_next_record + - offset_of_this_record) mod 64Ki, + where mod is the modulo as a non-negative + number; + we can calculate the offset of the next + record with the formula: + relative_offset + offset_of_this_record + mod srv_page_size + 3 3 bits status: + 000=REC_STATUS_ORDINARY + 001=REC_STATUS_NODE_PTR + 010=REC_STATUS_INFIMUM + 011=REC_STATUS_SUPREMUM + 100=REC_STATUS_INSTANT + 1xx=reserved + 5 bits heap number + 4 8 bits heap number + 5 4 bits n_owned + 4 bits info bits +*/ + +/* We list the byte offsets from the origin of the record, the mask, +and the shift needed to obtain each bit-field of the record. */ + +#define REC_NEXT 2 +#define REC_NEXT_MASK 0xFFFFUL +#define REC_NEXT_SHIFT 0 + +#define REC_OLD_SHORT 3 /* This is single byte bit-field */ +#define REC_OLD_SHORT_MASK 0x1UL +#define REC_OLD_SHORT_SHIFT 0 + +#define REC_OLD_N_FIELDS 4 +#define REC_OLD_N_FIELDS_MASK 0x7FEUL +#define REC_OLD_N_FIELDS_SHIFT 1 + +#define REC_OLD_HEAP_NO 5 +#define REC_HEAP_NO_MASK 0xFFF8UL +#if 0 /* defined in rem0rec.h for use of page0zip.cc */ +#define REC_NEW_HEAP_NO 4 +#define REC_HEAP_NO_SHIFT 3 +#endif + +#define REC_OLD_N_OWNED 6 /* This is single byte bit-field */ +#define REC_NEW_N_OWNED 5 /* This is single byte bit-field */ +#define REC_N_OWNED_MASK 0xFUL +#define REC_N_OWNED_SHIFT 0 + +#define REC_OLD_INFO_BITS 6 /* This is single byte bit-field */ +#define REC_NEW_INFO_BITS 5 /* This is single byte bit-field */ +#define REC_INFO_BITS_MASK 0xF0UL +#define REC_INFO_BITS_SHIFT 0 + +#if REC_OLD_SHORT_MASK << (8 * (REC_OLD_SHORT - 3)) \ + ^ REC_OLD_N_FIELDS_MASK << (8 * (REC_OLD_N_FIELDS - 4)) \ + ^ REC_HEAP_NO_MASK << (8 * (REC_OLD_HEAP_NO - 4)) \ + ^ REC_N_OWNED_MASK << (8 * (REC_OLD_N_OWNED - 3)) \ + ^ REC_INFO_BITS_MASK << (8 * (REC_OLD_INFO_BITS - 3)) \ + ^ 0xFFFFFFFFUL +# error "sum of old-style masks != 0xFFFFFFFFUL" +#endif +#if REC_NEW_STATUS_MASK << (8 * (REC_NEW_STATUS - 3)) \ + ^ REC_HEAP_NO_MASK << (8 * (REC_NEW_HEAP_NO - 4)) \ + ^ REC_N_OWNED_MASK << (8 * (REC_NEW_N_OWNED - 3)) \ + ^ REC_INFO_BITS_MASK << (8 * (REC_NEW_INFO_BITS - 3)) \ + ^ 0xFFFFFFUL +# error "sum of new-style masks != 0xFFFFFFUL" +#endif + +/******************************************************//** +Gets a bit field from within 1 byte. */ +UNIV_INLINE +byte +rec_get_bit_field_1( +/*================*/ + const rec_t* rec, /*!< in: pointer to record origin */ + ulint offs, /*!< in: offset from the origin down */ + ulint mask, /*!< in: mask used to filter bits */ + ulint shift) /*!< in: shift right applied after masking */ +{ + return static_cast((*(rec - offs) & mask) >> shift); +} + +/******************************************************//** +Sets a bit field within 1 byte. */ +UNIV_INLINE +void +rec_set_bit_field_1( +/*================*/ + rec_t* rec, /*!< in: pointer to record origin */ + ulint val, /*!< in: value to set */ + ulint offs, /*!< in: offset from the origin down */ + ulint mask, /*!< in: mask used to filter bits */ + ulint shift) /*!< in: shift right applied after masking */ +{ + ut_ad(rec); + ut_ad(offs <= REC_N_OLD_EXTRA_BYTES); + ut_ad(mask); + ut_ad(mask <= 0xFFUL); + ut_ad(((mask >> shift) << shift) == mask); + ut_ad(((val << shift) & mask) == (val << shift)); + + mach_write_to_1(rec - offs, + (mach_read_from_1(rec - offs) & ~mask) + | (val << shift)); +} + +/******************************************************//** +Gets a bit field from within 2 bytes. */ +UNIV_INLINE +ulint +rec_get_bit_field_2( +/*================*/ + const rec_t* rec, /*!< in: pointer to record origin */ + ulint offs, /*!< in: offset from the origin down */ + ulint mask, /*!< in: mask used to filter bits */ + ulint shift) /*!< in: shift right applied after masking */ +{ + ut_ad(rec); + + return((mach_read_from_2(rec - offs) & mask) >> shift); +} + +/******************************************************//** +Sets a bit field within 2 bytes. */ +UNIV_INLINE +void +rec_set_bit_field_2( +/*================*/ + rec_t* rec, /*!< in: pointer to record origin */ + ulint val, /*!< in: value to set */ + ulint offs, /*!< in: offset from the origin down */ + ulint mask, /*!< in: mask used to filter bits */ + ulint shift) /*!< in: shift right applied after masking */ +{ + ut_ad(rec); + ut_ad(offs <= REC_N_OLD_EXTRA_BYTES); + ut_ad(mask > 0xFFUL); + ut_ad(mask <= 0xFFFFUL); + ut_ad((mask >> shift) & 1); + ut_ad(0 == ((mask >> shift) & ((mask >> shift) + 1))); + ut_ad(((mask >> shift) << shift) == mask); + ut_ad(((val << shift) & mask) == (val << shift)); + + mach_write_to_2(rec - offs, + (mach_read_from_2(rec - offs) & ~mask) + | (val << shift)); +} + +/******************************************************//** +The following function is used to get the offset of the next chained record +on the same page. +@return the page offset of the next chained record, or 0 if none */ +UNIV_INLINE +ulint +rec_get_next_offs( +/*==============*/ + const rec_t* rec, /*!< in: physical record */ + ulint comp) /*!< in: nonzero=compact page format */ +{ + ulint field_value; + compile_time_assert(REC_NEXT_MASK == 0xFFFFUL); + compile_time_assert(REC_NEXT_SHIFT == 0); + + field_value = mach_read_from_2(rec - REC_NEXT); + + if (comp) { +#if UNIV_PAGE_SIZE_MAX <= 32768 + /* Note that for 64 KiB pages, field_value can 'wrap around' + and the debug assertion is not valid */ + + /* In the following assertion, field_value is interpreted + as signed 16-bit integer in 2's complement arithmetics. + If all platforms defined int16_t in the standard headers, + the expression could be written simpler as + (int16_t) field_value + ut_align_offset(...) < srv_page_size + */ + ut_ad((field_value >= 32768 + ? field_value - 65536 + : field_value) + + ut_align_offset(rec, srv_page_size) + < srv_page_size); +#endif + if (field_value == 0) { + + return(0); + } + + /* There must be at least REC_N_NEW_EXTRA_BYTES + 1 + between each record. */ + ut_ad((field_value > REC_N_NEW_EXTRA_BYTES + && field_value < 32768) + || field_value < (uint16) -REC_N_NEW_EXTRA_BYTES); + + return(ut_align_offset(rec + field_value, srv_page_size)); + } else { + ut_ad(field_value < srv_page_size); + + return(field_value); + } +} + +/******************************************************//** +The following function is used to set the next record offset field +of an old-style record. */ +UNIV_INLINE +void +rec_set_next_offs_old( +/*==================*/ + rec_t* rec, /*!< in: old-style physical record */ + ulint next) /*!< in: offset of the next record */ +{ + ut_ad(srv_page_size > next); + compile_time_assert(REC_NEXT_MASK == 0xFFFFUL); + compile_time_assert(REC_NEXT_SHIFT == 0); + mach_write_to_2(rec - REC_NEXT, next); +} + +/******************************************************//** +The following function is used to set the next record offset field +of a new-style record. */ +UNIV_INLINE +void +rec_set_next_offs_new( +/*==================*/ + rec_t* rec, /*!< in/out: new-style physical record */ + ulint next) /*!< in: offset of the next record */ +{ + ulint field_value; + + ut_ad(srv_page_size > next); + + if (!next) { + field_value = 0; + } else { + /* The following two statements calculate + next - offset_of_rec mod 64Ki, where mod is the modulo + as a non-negative number */ + + field_value = (ulint) + ((lint) next + - (lint) ut_align_offset(rec, srv_page_size)); + field_value &= REC_NEXT_MASK; + } + + mach_write_to_2(rec - REC_NEXT, field_value); +} + +/******************************************************//** +The following function is used to get the number of fields +in an old-style record. +@return number of data fields */ +UNIV_INLINE +ulint +rec_get_n_fields_old( +/*=================*/ + const rec_t* rec) /*!< in: physical record */ +{ + ulint ret; + + ut_ad(rec); + + ret = rec_get_bit_field_2(rec, REC_OLD_N_FIELDS, + REC_OLD_N_FIELDS_MASK, + REC_OLD_N_FIELDS_SHIFT); + ut_ad(ret <= REC_MAX_N_FIELDS); + ut_ad(ret > 0); + + return(ret); +} + +/******************************************************//** +The following function is used to set the number of fields +in an old-style record. */ +UNIV_INLINE +void +rec_set_n_fields_old( +/*=================*/ + rec_t* rec, /*!< in: physical record */ + ulint n_fields) /*!< in: the number of fields */ +{ + ut_ad(rec); + ut_ad(n_fields <= REC_MAX_N_FIELDS); + ut_ad(n_fields > 0); + + rec_set_bit_field_2(rec, n_fields, REC_OLD_N_FIELDS, + REC_OLD_N_FIELDS_MASK, REC_OLD_N_FIELDS_SHIFT); +} + +/******************************************************//** +The following function is used to get the number of fields +in a record. +@return number of data fields */ +UNIV_INLINE +ulint +rec_get_n_fields( +/*=============*/ + const rec_t* rec, /*!< in: physical record */ + const dict_index_t* index) /*!< in: record descriptor */ +{ + ut_ad(rec); + ut_ad(index); + + if (!dict_table_is_comp(index->table)) { + return(rec_get_n_fields_old(rec)); + } + + switch (rec_get_status(rec)) { + case REC_STATUS_INSTANT: + case REC_STATUS_ORDINARY: + return(dict_index_get_n_fields(index)); + case REC_STATUS_NODE_PTR: + return(dict_index_get_n_unique_in_tree(index) + 1); + case REC_STATUS_INFIMUM: + case REC_STATUS_SUPREMUM: + return(1); + } + + ut_error; + return(ULINT_UNDEFINED); +} + +/** Confirms the n_fields of the entry is sane with comparing the other +record in the same page specified +@param[in] index index +@param[in] rec record of the same page +@param[in] entry index entry +@return true if n_fields is sane */ +UNIV_INLINE +bool +rec_n_fields_is_sane( + dict_index_t* index, + const rec_t* rec, + const dtuple_t* entry) +{ + const ulint n_fields = rec_get_n_fields(rec, index); + + return(n_fields == dtuple_get_n_fields(entry) + || (index->is_instant() + && n_fields >= index->n_core_fields) + /* a record for older SYS_INDEXES table + (missing merge_threshold column) is acceptable. */ + || (index->table->id == DICT_INDEXES_ID + && n_fields == dtuple_get_n_fields(entry) - 1)); +} + +/******************************************************//** +The following function is used to get the number of records owned by the +previous directory record. +@return number of owned records */ +UNIV_INLINE +ulint +rec_get_n_owned_old( +/*================*/ + const rec_t* rec) /*!< in: old-style physical record */ +{ + return(rec_get_bit_field_1(rec, REC_OLD_N_OWNED, + REC_N_OWNED_MASK, REC_N_OWNED_SHIFT)); +} + +/******************************************************//** +The following function is used to get the number of records owned by the +previous directory record. +@return number of owned records */ +UNIV_INLINE +ulint +rec_get_n_owned_new( +/*================*/ + const rec_t* rec) /*!< in: new-style physical record */ +{ + return(rec_get_bit_field_1(rec, REC_NEW_N_OWNED, + REC_N_OWNED_MASK, REC_N_OWNED_SHIFT)); +} + +/******************************************************//** +The following function is used to retrieve the info bits of a record. +@return info bits */ +UNIV_INLINE +byte +rec_get_info_bits( +/*==============*/ + const rec_t* rec, /*!< in: physical record */ + ulint comp) /*!< in: nonzero=compact page format */ +{ + return rec_get_bit_field_1( + rec, comp ? REC_NEW_INFO_BITS : REC_OLD_INFO_BITS, + REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT); +} + +/******************************************************//** +The following function is used to retrieve the info and status +bits of a record. (Only compact records have status bits.) +@return info and status bits */ +UNIV_INLINE +byte +rec_get_info_and_status_bits( +/*=========================*/ + const rec_t* rec, /*!< in: physical record */ + ulint comp) /*!< in: nonzero=compact page format */ +{ + compile_time_assert(!((REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) + & (REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT))); + if (comp) + return static_cast(rec_get_info_bits(rec, TRUE) | + rec_get_status(rec)); + else + return rec_get_info_bits(rec, FALSE); +} +/******************************************************//** +The following function is used to set the info and status +bits of a record. (Only compact records have status bits.) */ +UNIV_INLINE +void +rec_set_info_and_status_bits( +/*=========================*/ + rec_t* rec, /*!< in/out: physical record */ + ulint bits) /*!< in: info bits */ +{ + compile_time_assert(!((REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) + & (REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT))); + rec_set_status(rec, bits & REC_NEW_STATUS_MASK); + rec_set_bit_field_1(rec, bits & ~REC_NEW_STATUS_MASK, + REC_NEW_INFO_BITS, + REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT); +} + +/******************************************************//** +The following function tells if record is delete marked. +@return nonzero if delete marked */ +UNIV_INLINE +ulint +rec_get_deleted_flag( +/*=================*/ + const rec_t* rec, /*!< in: physical record */ + ulint comp) /*!< in: nonzero=compact page format */ +{ + if (comp) { + return(rec_get_bit_field_1(rec, REC_NEW_INFO_BITS, + REC_INFO_DELETED_FLAG, + REC_INFO_BITS_SHIFT)); + } else { + return(rec_get_bit_field_1(rec, REC_OLD_INFO_BITS, + REC_INFO_DELETED_FLAG, + REC_INFO_BITS_SHIFT)); + } +} + +/******************************************************//** +The following function tells if a new-style record is a node pointer. +@return TRUE if node pointer */ +UNIV_INLINE +bool +rec_get_node_ptr_flag( +/*==================*/ + const rec_t* rec) /*!< in: physical record */ +{ + return(REC_STATUS_NODE_PTR == rec_get_status(rec)); +} + +/******************************************************//** +The following function is used to get the order number +of an old-style record in the heap of the index page. +@return heap order number */ +UNIV_INLINE +ulint +rec_get_heap_no_old( +/*================*/ + const rec_t* rec) /*!< in: physical record */ +{ + return(rec_get_bit_field_2(rec, REC_OLD_HEAP_NO, + REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT)); +} + +/******************************************************//** +The following function is used to get the order number +of a new-style record in the heap of the index page. +@return heap order number */ +UNIV_INLINE +ulint +rec_get_heap_no_new( +/*================*/ + const rec_t* rec) /*!< in: physical record */ +{ + return(rec_get_bit_field_2(rec, REC_NEW_HEAP_NO, + REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT)); +} + +/******************************************************//** +The following function is used to test whether the data offsets in the record +are stored in one-byte or two-byte format. +@return TRUE if 1-byte form */ +UNIV_INLINE +ibool +rec_get_1byte_offs_flag( +/*====================*/ + const rec_t* rec) /*!< in: physical record */ +{ + return(rec_get_bit_field_1(rec, REC_OLD_SHORT, REC_OLD_SHORT_MASK, + REC_OLD_SHORT_SHIFT)); +} + +/******************************************************//** +The following function is used to set the 1-byte offsets flag. */ +UNIV_INLINE +void +rec_set_1byte_offs_flag( +/*====================*/ + rec_t* rec, /*!< in: physical record */ + ibool flag) /*!< in: TRUE if 1byte form */ +{ + ut_ad(flag <= 1); + + rec_set_bit_field_1(rec, flag, REC_OLD_SHORT, REC_OLD_SHORT_MASK, + REC_OLD_SHORT_SHIFT); +} + +/******************************************************//** +Returns the offset of nth field end if the record is stored in the 1-byte +offsets form. If the field is SQL null, the flag is ORed in the returned +value. +@return offset of the start of the field, SQL null flag ORed */ +UNIV_INLINE +uint8_t +rec_1_get_field_end_info( +/*=====================*/ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: field index */ +{ + ut_ad(rec_get_1byte_offs_flag(rec)); + ut_ad(n < rec_get_n_fields_old(rec)); + + return(mach_read_from_1(rec - (REC_N_OLD_EXTRA_BYTES + n + 1))); +} + +/******************************************************//** +Returns the offset of nth field end if the record is stored in the 2-byte +offsets form. If the field is SQL null, the flag is ORed in the returned +value. +@return offset of the start of the field, SQL null flag and extern +storage flag ORed */ +UNIV_INLINE +uint16_t +rec_2_get_field_end_info( +/*=====================*/ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: field index */ +{ + ut_ad(!rec_get_1byte_offs_flag(rec)); + ut_ad(n < rec_get_n_fields_old(rec)); + + return(mach_read_from_2(rec - (REC_N_OLD_EXTRA_BYTES + 2 * n + 2))); +} + +/******************************************************//** +Returns nonzero if the field is stored off-page. +@retval 0 if the field is stored in-page +@retval REC_2BYTE_EXTERN_MASK if the field is stored externally */ +UNIV_INLINE +ulint +rec_2_is_field_extern( +/*==================*/ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: field index */ +{ + return(rec_2_get_field_end_info(rec, n) & REC_2BYTE_EXTERN_MASK); +} + +/**********************************************************//** +The following function sets the number of allocated elements +for an array of offsets. */ +UNIV_INLINE +void +rec_offs_set_n_alloc( +/*=================*/ + rec_offs*offsets, /*!< out: array for rec_get_offsets(), + must be allocated */ + ulint n_alloc) /*!< in: number of elements */ +{ + ut_ad(n_alloc > REC_OFFS_HEADER_SIZE); + MEM_UNDEFINED(offsets, n_alloc * sizeof *offsets); + offsets[0] = static_cast(n_alloc); +} + +/************************************************************//** +The following function is used to get an offset to the nth +data field in a record. +@return offset from the origin of rec */ +UNIV_INLINE +rec_offs +rec_get_nth_field_offs( +/*===================*/ + const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */ + ulint n, /*!< in: index of the field */ + ulint* len) /*!< out: length of the field; UNIV_SQL_NULL + if SQL null; UNIV_SQL_DEFAULT is default value */ +{ + ut_ad(n < rec_offs_n_fields(offsets)); + + rec_offs offs = n == 0 ? 0 : get_value(rec_offs_base(offsets)[n]); + rec_offs next_offs = rec_offs_base(offsets)[1 + n]; + + if (get_type(next_offs) == SQL_NULL) { + *len = UNIV_SQL_NULL; + } else if (get_type(next_offs) == DEFAULT) { + *len = UNIV_SQL_DEFAULT; + } else { + *len = get_value(next_offs) - offs; + } + + return(offs); +} + +/******************************************************//** +Determine if the offsets are for a record containing null BLOB pointers. +@return first field containing a null BLOB pointer, or NULL if none found */ +UNIV_INLINE +const byte* +rec_offs_any_null_extern( +/*=====================*/ + const rec_t* rec, /*!< in: record */ + const rec_offs* offsets) /*!< in: rec_get_offsets(rec) */ +{ + ulint i; + ut_ad(rec_offs_validate(rec, NULL, offsets)); + + if (!rec_offs_any_extern(offsets)) { + return(NULL); + } + + for (i = 0; i < rec_offs_n_fields(offsets); i++) { + if (rec_offs_nth_extern(offsets, i)) { + ulint len; + const byte* field + = rec_get_nth_field(rec, offsets, i, &len); + + ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE); + if (!memcmp(field + len + - BTR_EXTERN_FIELD_REF_SIZE, + field_ref_zero, + BTR_EXTERN_FIELD_REF_SIZE)) { + return(field); + } + } + } + + return(NULL); +} + +/******************************************************//** +Gets the physical size of a field. +@return length of field */ +UNIV_INLINE +ulint +rec_offs_nth_size( +/*==============*/ + const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */ + ulint n) /*!< in: nth field */ +{ + ut_ad(rec_offs_validate(NULL, NULL, offsets)); + ut_ad(n < rec_offs_n_fields(offsets)); + if (!n) { + return get_value(rec_offs_base(offsets)[1 + n]); + } + return get_value((rec_offs_base(offsets)[1 + n])) + - get_value(rec_offs_base(offsets)[n]); +} + +/******************************************************//** +Returns the number of extern bits set in a record. +@return number of externally stored fields */ +UNIV_INLINE +ulint +rec_offs_n_extern( +/*==============*/ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ +{ + ulint n = 0; + + if (rec_offs_any_extern(offsets)) { + ulint i; + + for (i = rec_offs_n_fields(offsets); i--; ) { + if (rec_offs_nth_extern(offsets, i)) { + n++; + } + } + } + + return(n); +} + +/******************************************************//** +Returns the offset of n - 1th field end if the record is stored in the 1-byte +offsets form. If the field is SQL null, the flag is ORed in the returned +value. This function and the 2-byte counterpart are defined here because the +C-compiler was not able to sum negative and positive constant offsets, and +warned of constant arithmetic overflow within the compiler. +@return offset of the start of the PREVIOUS field, SQL null flag ORed */ +UNIV_INLINE +ulint +rec_1_get_prev_field_end_info( +/*==========================*/ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: field index */ +{ + ut_ad(rec_get_1byte_offs_flag(rec)); + ut_ad(n <= rec_get_n_fields_old(rec)); + + return(mach_read_from_1(rec - (REC_N_OLD_EXTRA_BYTES + n))); +} + +/******************************************************//** +Returns the offset of n - 1th field end if the record is stored in the 2-byte +offsets form. If the field is SQL null, the flag is ORed in the returned +value. +@return offset of the start of the PREVIOUS field, SQL null flag ORed */ +UNIV_INLINE +ulint +rec_2_get_prev_field_end_info( +/*==========================*/ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: field index */ +{ + ut_ad(!rec_get_1byte_offs_flag(rec)); + ut_ad(n <= rec_get_n_fields_old(rec)); + + return(mach_read_from_2(rec - (REC_N_OLD_EXTRA_BYTES + 2 * n))); +} + +/******************************************************//** +Sets the field end info for the nth field if the record is stored in the +1-byte format. */ +UNIV_INLINE +void +rec_1_set_field_end_info( +/*=====================*/ + rec_t* rec, /*!< in: record */ + ulint n, /*!< in: field index */ + ulint info) /*!< in: value to set */ +{ + ut_ad(rec_get_1byte_offs_flag(rec)); + ut_ad(n < rec_get_n_fields_old(rec)); + + mach_write_to_1(rec - (REC_N_OLD_EXTRA_BYTES + n + 1), info); +} + +/******************************************************//** +Sets the field end info for the nth field if the record is stored in the +2-byte format. */ +UNIV_INLINE +void +rec_2_set_field_end_info( +/*=====================*/ + rec_t* rec, /*!< in: record */ + ulint n, /*!< in: field index */ + ulint info) /*!< in: value to set */ +{ + ut_ad(!rec_get_1byte_offs_flag(rec)); + ut_ad(n < rec_get_n_fields_old(rec)); + + mach_write_to_2(rec - (REC_N_OLD_EXTRA_BYTES + 2 * n + 2), info); +} + +/******************************************************//** +Returns the offset of nth field start if the record is stored in the 1-byte +offsets form. +@return offset of the start of the field */ +UNIV_INLINE +ulint +rec_1_get_field_start_offs( +/*=======================*/ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: field index */ +{ + ut_ad(rec_get_1byte_offs_flag(rec)); + ut_ad(n <= rec_get_n_fields_old(rec)); + + if (n == 0) { + + return(0); + } + + return(rec_1_get_prev_field_end_info(rec, n) + & ~REC_1BYTE_SQL_NULL_MASK); +} + +/******************************************************//** +Returns the offset of nth field start if the record is stored in the 2-byte +offsets form. +@return offset of the start of the field */ +UNIV_INLINE +ulint +rec_2_get_field_start_offs( +/*=======================*/ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: field index */ +{ + ut_ad(!rec_get_1byte_offs_flag(rec)); + ut_ad(n <= rec_get_n_fields_old(rec)); + + if (n == 0) { + + return(0); + } + + return(rec_2_get_prev_field_end_info(rec, n) + & ~(REC_2BYTE_SQL_NULL_MASK | REC_2BYTE_EXTERN_MASK)); +} + +/******************************************************//** +The following function is used to read the offset of the start of a data field +in the record. The start of an SQL null field is the end offset of the +previous non-null field, or 0, if none exists. If n is the number of the last +field + 1, then the end offset of the last field is returned. +@return offset of the start of the field */ +UNIV_INLINE +ulint +rec_get_field_start_offs( +/*=====================*/ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: field index */ +{ + ut_ad(rec); + ut_ad(n <= rec_get_n_fields_old(rec)); + + if (n == 0) { + + return(0); + } + + if (rec_get_1byte_offs_flag(rec)) { + + return(rec_1_get_field_start_offs(rec, n)); + } + + return(rec_2_get_field_start_offs(rec, n)); +} + +/************************************************************//** +Gets the physical size of an old-style field. +Also an SQL null may have a field of size > 0, +if the data type is of a fixed size. +@return field size in bytes */ +UNIV_INLINE +ulint +rec_get_nth_field_size( +/*===================*/ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: index of the field */ +{ + ulint os; + ulint next_os; + + os = rec_get_field_start_offs(rec, n); + next_os = rec_get_field_start_offs(rec, n + 1); + + ut_ad(next_os - os < srv_page_size); + + return(next_os - os); +} + +/**********************************************************//** +The following function returns the data size of an old-style physical +record, that is the sum of field lengths. SQL null fields +are counted as length 0 fields. The value returned by the function +is the distance from record origin to record end in bytes. +@return size */ +UNIV_INLINE +ulint +rec_get_data_size_old( +/*==================*/ + const rec_t* rec) /*!< in: physical record */ +{ + ut_ad(rec); + + return(rec_get_field_start_offs(rec, rec_get_n_fields_old(rec))); +} + +/**********************************************************//** +The following function sets the number of fields in offsets. */ +UNIV_INLINE +void +rec_offs_set_n_fields( +/*==================*/ + rec_offs* offsets, /*!< in/out: array returned by + rec_get_offsets() */ + ulint n_fields) /*!< in: number of fields */ +{ + ut_ad(offsets); + ut_ad(n_fields > 0); + ut_ad(n_fields <= REC_MAX_N_FIELDS); + ut_ad(n_fields + REC_OFFS_HEADER_SIZE + <= rec_offs_get_n_alloc(offsets)); + offsets[1] = static_cast(n_fields); +} + +/**********************************************************//** +The following function returns the data size of a physical +record, that is the sum of field lengths. SQL null fields +are counted as length 0 fields. The value returned by the function +is the distance from record origin to record end in bytes. +@return size */ +UNIV_INLINE +ulint +rec_offs_data_size( +/*===============*/ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ +{ + ulint size; + + ut_ad(rec_offs_validate(NULL, NULL, offsets)); + size = get_value(rec_offs_base(offsets)[rec_offs_n_fields(offsets)]); + ut_ad(size < srv_page_size); + return(size); +} + +/**********************************************************//** +Returns the total size of record minus data size of record. The value +returned by the function is the distance from record start to record origin +in bytes. +@return size */ +UNIV_INLINE +ulint +rec_offs_extra_size( +/*================*/ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ +{ + ulint size; + ut_ad(rec_offs_validate(NULL, NULL, offsets)); + size = *rec_offs_base(offsets) & REC_OFFS_MASK; + ut_ad(size < srv_page_size); + return(size); +} + +/**********************************************************//** +Returns the total size of a physical record. +@return size */ +UNIV_INLINE +ulint +rec_offs_size( +/*==========*/ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ +{ + return(rec_offs_data_size(offsets) + rec_offs_extra_size(offsets)); +} + +#ifdef UNIV_DEBUG +/**********************************************************//** +Returns a pointer to the end of the record. +@return pointer to end */ +UNIV_INLINE +byte* +rec_get_end( +/*========*/ + const rec_t* rec, /*!< in: pointer to record */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ +{ + ut_ad(rec_offs_validate(rec, NULL, offsets)); + return(const_cast(rec + rec_offs_data_size(offsets))); +} + +/**********************************************************//** +Returns a pointer to the start of the record. +@return pointer to start */ +UNIV_INLINE +byte* +rec_get_start( +/*==========*/ + const rec_t* rec, /*!< in: pointer to record */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ +{ + ut_ad(rec_offs_validate(rec, NULL, offsets)); + return(const_cast(rec - rec_offs_extra_size(offsets))); +} +#endif /* UNIV_DEBUG */ + +/** Copy a physical record to a buffer. +@param[in] buf buffer +@param[in] rec physical record +@param[in] offsets array returned by rec_get_offsets() +@return pointer to the origin of the copy */ +UNIV_INLINE +rec_t* +rec_copy( + void* buf, + const rec_t* rec, + const rec_offs* offsets) +{ + ulint extra_len; + ulint data_len; + + ut_ad(rec != NULL); + ut_ad(buf != NULL); + ut_ad(rec_offs_validate(rec, NULL, offsets)); + ut_ad(rec_validate(rec, offsets)); + + extra_len = rec_offs_extra_size(offsets); + data_len = rec_offs_data_size(offsets); + + memcpy(buf, rec - extra_len, extra_len + data_len); + + return((byte*) buf + extra_len); +} + +/**********************************************************//** +Returns the extra size of an old-style physical record if we know its +data size and number of fields. +@return extra size */ +UNIV_INLINE +ulint +rec_get_converted_extra_size( +/*=========================*/ + ulint data_size, /*!< in: data size */ + ulint n_fields, /*!< in: number of fields */ + ulint n_ext) /*!< in: number of externally stored columns */ +{ + if (!n_ext && data_size <= REC_1BYTE_OFFS_LIMIT) { + + return(REC_N_OLD_EXTRA_BYTES + n_fields); + } + + return(REC_N_OLD_EXTRA_BYTES + 2 * n_fields); +} + +/**********************************************************//** +The following function returns the size of a data tuple when converted to +a physical record. +@return size */ +UNIV_INLINE +ulint +rec_get_converted_size( +/*===================*/ + dict_index_t* index, /*!< in: record descriptor */ + const dtuple_t* dtuple, /*!< in: data tuple */ + ulint n_ext) /*!< in: number of externally stored columns */ +{ + ulint data_size; + ulint extra_size; + + ut_ad(dtuple_check_typed(dtuple)); +#ifdef UNIV_DEBUG + if (dict_index_is_ibuf(index)) { + ut_ad(dtuple->n_fields > 1); + } else if ((dtuple_get_info_bits(dtuple) & REC_NEW_STATUS_MASK) + == REC_STATUS_NODE_PTR) { + ut_ad(dtuple->n_fields - 1 + == dict_index_get_n_unique_in_tree_nonleaf(index)); + } else if (index->table->id == DICT_INDEXES_ID) { + /* The column SYS_INDEXES.MERGE_THRESHOLD was + instantly added in MariaDB 10.2.2 (MySQL 5.7). */ + ut_ad(!index->table->is_temporary()); + ut_ad(index->n_fields == DICT_NUM_FIELDS__SYS_INDEXES); + ut_ad(dtuple->n_fields == DICT_NUM_FIELDS__SYS_INDEXES + || dtuple->n_fields + == DICT_FLD__SYS_INDEXES__MERGE_THRESHOLD); + } else { + ut_ad(dtuple->n_fields >= index->n_core_fields); + ut_ad(dtuple->n_fields <= index->n_fields + || dtuple->is_alter_metadata()); + } +#endif + + if (dict_table_is_comp(index->table)) { + return rec_get_converted_size_comp(index, dtuple, NULL); + } + + data_size = dtuple_get_data_size(dtuple, 0); + + /* If primary key is being updated then the new record inherits + externally stored fields from the delete-marked old record. + In that case, n_ext may be less value than + dtuple_get_n_ext(tuple). */ + ut_ad(n_ext <= dtuple_get_n_ext(dtuple)); + extra_size = rec_get_converted_extra_size( + data_size, dtuple_get_n_fields(dtuple), n_ext); + + return(data_size + extra_size); +} diff --git a/storage/innobase/include/row0ext.h b/storage/innobase/include/row0ext.h index 251f312566706..78886332aa67b 100644 --- a/storage/innobase/include/row0ext.h +++ b/storage/innobase/include/row0ext.h @@ -96,6 +96,6 @@ struct row_ext_t{ ulint len[1]; /*!< prefix lengths; 0 if not cached */ }; -#include "row0ext.ic" +#include "row0ext.inl" #endif diff --git a/storage/innobase/include/row0ext.ic b/storage/innobase/include/row0ext.inl similarity index 100% rename from storage/innobase/include/row0ext.ic rename to storage/innobase/include/row0ext.inl diff --git a/storage/innobase/include/row0ins.h b/storage/innobase/include/row0ins.h index 25c09258b3c41..ac2479c4863e4 100644 --- a/storage/innobase/include/row0ins.h +++ b/storage/innobase/include/row0ins.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -78,7 +78,7 @@ dberr_t row_ins_clust_index_entry_low( /*==========================*/ ulint flags, /*!< in: undo logging and locking flags */ - ulint mode, /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE, + btr_latch_mode mode, /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE, depending on whether we wish optimistic or pessimistic descent down the index tree */ dict_index_t* index, /*!< in: clustered index */ @@ -94,13 +94,13 @@ same fields is found, the other record is necessarily marked deleted. It is then unmarked. Otherwise, the entry is just inserted to the index. @retval DB_SUCCESS on success @retval DB_LOCK_WAIT on lock wait when !(flags & BTR_NO_LOCKING_FLAG) -@retval DB_FAIL if retry with BTR_MODIFY_TREE is needed +@retval DB_FAIL if retry with BTR_INSERT_TREE is needed @return error code */ dberr_t row_ins_sec_index_entry_low( /*========================*/ ulint flags, /*!< in: undo logging and locking flags */ - ulint mode, /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE, + btr_latch_mode mode, /*!< in: BTR_MODIFY_LEAF or BTR_INSERT_TREE, depending on whether we wish optimistic or pessimistic descent down the index tree */ dict_index_t* index, /*!< in: secondary index */ @@ -177,6 +177,7 @@ struct ins_node_t trx_id(0), entry_sys_heap(mem_heap_create(128)) { } + ~ins_node_t() { mem_heap_free(entry_sys_heap); } que_common_t common; /*!< node type: QUE_NODE_INSERT */ ulint ins_type;/* INS_VALUES, INS_SEARCHED, or INS_DIRECT */ dtuple_t* row; /*!< row to insert */ @@ -206,7 +207,6 @@ struct ins_node_t if this is NULL, entry list should be created and buffers for sys fields in row allocated */ void vers_update_end(row_prebuilt_t *prebuilt, bool history_row); - bool vers_history_row() const; /* true if 'row' is historical */ }; /** Create an insert object. diff --git a/storage/innobase/include/row0log.h b/storage/innobase/include/row0log.h index 9fcece5b99072..469f1f8a356a5 100644 --- a/storage/innobase/include/row0log.h +++ b/storage/innobase/include/row0log.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -24,15 +24,15 @@ Modification log for online index creation and online table rebuild Created 2011-05-26 Marko Makela *******************************************************/ -#ifndef row0log_h -#define row0log_h +#pragma once #include "que0types.h" #include "mtr0types.h" #include "row0types.h" #include "rem0types.h" -#include "data0types.h" +#include "dict0dict.h" #include "trx0types.h" +#include "trx0undo.h" class ut_stage_alter_t; @@ -74,37 +74,23 @@ row_log_free( /******************************************************//** Free the row log for an index on which online creation was aborted. */ -UNIV_INLINE -void -row_log_abort_sec( -/*==============*/ - dict_index_t* index) /*!< in/out: index (x-latched) */ - MY_ATTRIBUTE((nonnull)); - -/******************************************************//** -Try to log an operation to a secondary index that is -(or was) being created. -@retval true if the operation was logged or can be ignored -@retval false if online index creation is not taking place */ -UNIV_INLINE -bool -row_log_online_op_try( -/*==================*/ - dict_index_t* index, /*!< in/out: index, S or X latched */ - const dtuple_t* tuple, /*!< in: index tuple */ - trx_id_t trx_id) /*!< in: transaction ID for insert, - or 0 for delete */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); -/******************************************************//** -Logs an operation to a secondary index that is (or was) being created. */ -void -row_log_online_op( -/*==============*/ - dict_index_t* index, /*!< in/out: index, S or X latched */ - const dtuple_t* tuple, /*!< in: index tuple (NULL=empty the index) */ - trx_id_t trx_id) /*!< in: transaction ID for insert, - or 0 for delete */ - ATTRIBUTE_COLD; +inline void row_log_abort_sec(dict_index_t *index) +{ + ut_ad(index->lock.have_u_or_x()); + ut_ad(!index->is_clust()); + dict_index_set_online_status(index, ONLINE_INDEX_ABORTED); + row_log_free(index->online_log); + index->online_log= nullptr; +} + +/** Logs an operation to a secondary index that is (or was) being created. +@param index index, S or X latched +@param tuple index tuple +@param trx_id transaction ID for insert, or 0 for delete +@retval false if row_log_apply() failure happens +or true otherwise */ +bool row_log_online_op(dict_index_t *index, const dtuple_t *tuple, + trx_id_t trx_id) ATTRIBUTE_COLD; /******************************************************//** Gets the error status of the online index rebuild log. @@ -185,22 +171,6 @@ row_log_table_insert( dict_index_t* index, /*!< in/out: clustered index, S-latched or X-latched */ const rec_offs* offsets);/*!< in: rec_get_offsets(rec,index) */ -/******************************************************//** -Notes that a BLOB is being freed during online ALTER TABLE. */ -void -row_log_table_blob_free( -/*====================*/ - dict_index_t* index, /*!< in/out: clustered index, X-latched */ - ulint page_no)/*!< in: starting page number of the BLOB */ - ATTRIBUTE_COLD __attribute__((nonnull)); -/******************************************************//** -Notes that a BLOB is being allocated during online ALTER TABLE. */ -void -row_log_table_blob_alloc( -/*=====================*/ - dict_index_t* index, /*!< in/out: clustered index, X-latched */ - ulint page_no)/*!< in: starting page number of the BLOB */ - ATTRIBUTE_COLD __attribute__((nonnull)); /** Apply the row_log_table log to a table upon completing rebuild. @param[in] thr query graph @@ -252,6 +222,11 @@ row_log_apply( @return number of n_core_fields */ unsigned row_log_get_n_core_fields(const dict_index_t *index); +/** Get the error code of online log for the index +@param index online index +@return error code present in online log */ +dberr_t row_log_get_error(const dict_index_t *index); + #ifdef HAVE_PSI_STAGE_INTERFACE /** Estimate how much work is to be done by the log apply phase of an ALTER TABLE for this index. @@ -262,7 +237,3 @@ ulint row_log_estimate_work( const dict_index_t* index); #endif /* HAVE_PSI_STAGE_INTERFACE */ - -#include "row0log.ic" - -#endif /* row0log.h */ diff --git a/storage/innobase/include/row0log.ic b/storage/innobase/include/row0log.ic deleted file mode 100644 index f9f3dd006bf8b..0000000000000 --- a/storage/innobase/include/row0log.ic +++ /dev/null @@ -1,80 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2020, MariaDB Corporation. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by 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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/row0log.ic -Modification log for online index creation and online table rebuild - -Created 2012-10-18 Marko Makela -*******************************************************/ - -#include "dict0dict.h" - -/******************************************************//** -Free the row log for an index on which online creation was aborted. */ -UNIV_INLINE -void -row_log_abort_sec( -/*===============*/ - dict_index_t* index) /*!< in/out: index (x-latched) */ -{ - ut_ad(index->lock.have_u_or_x()); - ut_ad(!dict_index_is_clust(index)); - dict_index_set_online_status(index, ONLINE_INDEX_ABORTED); - row_log_free(index->online_log); - index->online_log = NULL; -} - -/******************************************************//** -Try to log an operation to a secondary index that is -(or was) being created. -@retval true if the operation was logged or can be ignored -@retval false if online index creation is not taking place */ -UNIV_INLINE -bool -row_log_online_op_try( -/*==================*/ - dict_index_t* index, /*!< in/out: index, S or X latched */ - const dtuple_t* tuple, /*!< in: index tuple */ - trx_id_t trx_id) /*!< in: transaction ID for insert, - or 0 for delete */ -{ - ut_ad(index->lock.have_any()); - - switch (dict_index_get_online_status(index)) { - case ONLINE_INDEX_COMPLETE: - /* This is a normal index. Do not log anything. - The caller must perform the operation on the - index tree directly. */ - return(false); - case ONLINE_INDEX_CREATION: - /* The index is being created online. Log the - operation. */ - row_log_online_op(index, tuple, trx_id); - break; - case ONLINE_INDEX_ABORTED: - case ONLINE_INDEX_ABORTED_DROPPED: - /* The index was created online, but the operation was - aborted. Do not log the operation and tell the caller - to skip the operation. */ - break; - } - - return(true); -} diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h index 64d97e6a777a2..93ea650d0cf1a 100644 --- a/storage/innobase/include/row0merge.h +++ b/storage/innobase/include/row0merge.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2021, MariaDB Corporation. +Copyright (c) 2015, 2022, 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 @@ -24,8 +24,7 @@ Index build routines using a merge sort Created 13/06/2005 Jan Lindstrom *******************************************************/ -#ifndef row0merge_h -#define row0merge_h +#pragma once #include "que0types.h" #include "trx0types.h" @@ -36,7 +35,8 @@ Created 13/06/2005 Jan Lindstrom #include "row0mysql.h" #include "lock0types.h" #include "srv0srv.h" -#include "ut0stage.h" + +class ut_stage_alter_t; /* Reserve free space from every block for key_version */ #define ROW_MERGE_RESERVE_SIZE 4 @@ -109,6 +109,7 @@ struct index_field_t { ulint prefix_len; /*!< column prefix length, or 0 if indexing the whole column */ bool is_v_col; /*!< whether this is a virtual column */ + bool descending; /*!< whether to use DESC order */ }; /** Definition of an index being created */ @@ -216,6 +217,11 @@ row_merge_is_index_usable( const dict_index_t* index) /*!< in: index to check */ MY_ATTRIBUTE((nonnull, warn_unused_result)); +/** Map from column numbers to column definitions that include +changes to the collation, when the encoding is compatible with +the original column and no table rebuild is needed */ +typedef std::map col_collations; + /** Build indexes on a table by reading a clustered index, creating a temporary file containing index entries, merge sorting these index entries and inserting sorted index entries to indexes. @@ -244,6 +250,7 @@ this function and it will be passed to other functions for further accounting. @param[in] eval_table mysql table used to evaluate virtual column value, see innobase_get_computed_value(). @param[in] allow_non_null allow the conversion from null to not-null +@param[in] col_collate columns whose collations changed, or nullptr @return DB_SUCCESS or error code */ dberr_t row_merge_build_indexes( @@ -263,7 +270,8 @@ row_merge_build_indexes( ut_stage_alter_t* stage, const dict_add_v_col_t* add_v, struct TABLE* eval_table, - bool allow_non_null) + bool allow_non_null, + const col_collations* col_collate) MY_ATTRIBUTE((warn_unused_result)); /** Write a buffer to a block. @@ -429,6 +437,10 @@ class row_merge_bulk_t ut_new_pfx_t m_block_pfx; /** Temporary file to store the blob */ merge_file_t m_blob_file; + /** Storage for description for the crypt_block */ + ut_new_pfx_t m_crypt_pfx; + /** Block for encryption */ + row_merge_block_t *m_crypt_block= nullptr; public: /** Constructor. Create all merge files, merge buffer for all the table indexes @@ -482,5 +494,3 @@ class row_merge_bulk_t /** Init temporary files for each index */ void init_tmp_file(); }; - -#endif /* row0merge.h */ diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index c4a94a9b5ef01..a9f1c87d6008b 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -263,7 +263,7 @@ row_update_for_mysql( /** This can only be used when the current transaction is at READ COMMITTED or READ UNCOMMITTED isolation level. -Before calling this function row_search_for_mysql() must have +Before calling this function row_search_mvcc() must have initialized prebuilt->new_rec_locks to store the information which new record locks really were set. This function removes a newly set clustered index record lock under prebuilt->pcur or @@ -382,22 +382,6 @@ row_rename_table_for_mysql( FOREIGN KEY constraints */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -/*********************************************************************//** -Scans an index for either COOUNT(*) or CHECK TABLE. -If CHECK TABLE; Checks that the index contains entries in an ascending order, -unique constraint is not broken, and calculates the number of index entries -in the read view of the current transaction. -@return DB_SUCCESS or other error */ -dberr_t -row_scan_index_for_mysql( -/*=====================*/ - row_prebuilt_t* prebuilt, /*!< in: prebuilt struct - in MySQL handle */ - const dict_index_t* index, /*!< in: index */ - ulint* n_rows) /*!< out: number of entries - seen in the consistent read */ - MY_ATTRIBUTE((warn_unused_result)); - /* A struct describing a place for an individual column in the MySQL row format which is presented to the table handler in ha_innobase. This template struct is used to speed up row transformations between @@ -606,7 +590,7 @@ struct row_prebuilt_t { ROW_READ_TRY_SEMI_CONSISTENT and to simply skip the row. If the row matches, the next call to - row_search_for_mysql() will lock + row_search_mvcc() will lock the row. This eliminates lock waits in some cases; note that this breaks @@ -615,7 +599,7 @@ struct row_prebuilt_t { the session is using READ COMMITTED or READ UNCOMMITTED isolation level, set in - row_search_for_mysql() if we set a new + row_search_mvcc() if we set a new record lock on the secondary or clustered index; this is used in row_unlock_for_mysql() @@ -718,7 +702,7 @@ struct row_prebuilt_t { /** Callback for row_mysql_sys_index_iterate() */ struct SysIndexCallback { - virtual ~SysIndexCallback() { } + virtual ~SysIndexCallback() = default; /** Callback method @param mtr current mini transaction @@ -755,9 +739,8 @@ struct VCOL_STORAGE @return TRUE malloc failure */ -bool innobase_allocate_row_for_vcol( - THD * thd, - dict_index_t* index, +bool innobase_allocate_row_for_vcol(THD *thd, + const dict_index_t* index, mem_heap_t** heap, TABLE** table, VCOL_STORAGE* storage); @@ -773,17 +756,13 @@ class ib_vcol_row ib_vcol_row(mem_heap_t *heap) : heap(heap) {} - byte *record(THD *thd, dict_index_t *index, TABLE **table) + byte *record(THD *thd, const dict_index_t *index, TABLE **table) { - if (!storage.innobase_record) - { - bool ok = innobase_allocate_row_for_vcol(thd, index, &heap, table, - &storage); - if (!ok) - return NULL; - } + if (!storage.innobase_record && + !innobase_allocate_row_for_vcol(thd, index, &heap, table, &storage)) + return nullptr; return storage.innobase_record; - }; + } ~ib_vcol_row() { @@ -815,7 +794,9 @@ void innobase_report_computed_value_failed(dtuple_t *row); @param[in] old_table during ALTER TABLE, this is the old table or NULL. @param[in] update update vector for the parent row -@param[in] foreign foreign key information +@param[in] ignore_warnings ignore warnings during calculation. Usually + means that a calculation is internal and + should have no side effects. @return the field filled with computed value */ dfield_t* innobase_get_computed_value( @@ -828,8 +809,9 @@ innobase_get_computed_value( THD* thd, TABLE* mysql_table, byte* mysql_rec, - const dict_table_t* old_table, - const upd_t* update); + const dict_table_t* old_table=NULL, + const upd_t* update=NULL, + bool ignore_warnings=false); /** Get the computed value by supplying the base column values. @param[in,out] table the table whose virtual column @@ -849,7 +831,7 @@ innobase_rename_vc_templ( #define ROW_MYSQL_REC_FIELDS 1 #define ROW_MYSQL_NO_TEMPLATE 2 #define ROW_MYSQL_DUMMY_TEMPLATE 3 /* dummy template used in - row_scan_and_check_index */ + row_check_index() */ /* Values for hint_need_to_fetch_extra_cols */ #define ROW_RETRIEVE_PRIMARY_KEY 1 diff --git a/storage/innobase/include/row0purge.h b/storage/innobase/include/row0purge.h index 34af658cb12b7..b1390fd1ef10f 100644 --- a/storage/innobase/include/row0purge.h +++ b/storage/innobase/include/row0purge.h @@ -72,9 +72,8 @@ row_purge_poss_sec( bool is_tree=false); /*************************************************************** -Does the purge operation for a single undo log record. This is a high-level -function used in an SQL execution graph. -@return query thread to run next or NULL */ +Does the purge operation. +@return query thread to run next */ que_thr_t* row_purge_step( /*===========*/ @@ -198,21 +197,7 @@ struct purge_node_t{ } /** Start processing an undo log record. */ - void start() - { - ut_ad(in_progress); - DBUG_ASSERT(common.type == QUE_NODE_PURGE); - - row= nullptr; - ref= nullptr; - index= nullptr; - update= nullptr; - found_clust= FALSE; - rec_type= ULINT_UNDEFINED; - cmpl_info= ULINT_UNDEFINED; - if (!purge_thd) - purge_thd= current_thd; - } + inline void start(); /** Close the existing table and release the MDL for it. */ @@ -253,16 +238,7 @@ struct purge_node_t{ /** Reset the state at end @return the query graph parent */ - que_node_t* end() - { - DBUG_ASSERT(common.type == QUE_NODE_PURGE); - close_table(); - ut_ad(undo_recs.empty()); - ut_d(in_progress= false); - purge_thd= nullptr; - mem_heap_empty(heap); - return common.parent; - } + inline que_node_t *end(); }; #endif diff --git a/storage/innobase/include/row0row.h b/storage/innobase/include/row0row.h index b4dab3c2f1bf9..a1350740e2a47 100644 --- a/storage/innobase/include/row0row.h +++ b/storage/innobase/include/row0row.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2020, MariaDB Corporation. +Copyright (c) 2016, 2022, 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 @@ -303,13 +303,13 @@ row_build_row_ref_fast( /***************************************************************//** Searches the clustered index record for a row, if we have the row reference. -@return TRUE if found */ -ibool +@return true if found */ +bool row_search_on_row_ref( /*==================*/ btr_pcur_t* pcur, /*!< out: persistent cursor, which must be closed by the caller */ - ulint mode, /*!< in: BTR_MODIFY_LEAF, ... */ + btr_latch_mode mode, /*!< in: BTR_MODIFY_LEAF, ... */ const dict_table_t* table, /*!< in: table */ const dtuple_t* ref, /*!< in: row reference */ mtr_t* mtr) /*!< in/out: mtr */ @@ -321,7 +321,7 @@ on the secondary index record are preserved. rec_t* row_get_clust_rec( /*==============*/ - ulint mode, /*!< in: BTR_MODIFY_LEAF, ... */ + btr_latch_mode mode, /*!< in: BTR_MODIFY_LEAF, ... */ const rec_t* rec, /*!< in: record in a secondary index */ dict_index_t* index, /*!< in: secondary index */ dict_index_t** clust_index,/*!< out: clustered index */ @@ -363,9 +363,8 @@ Searches an index record. enum row_search_result row_search_index_entry( /*===================*/ - dict_index_t* index, /*!< in: index */ const dtuple_t* entry, /*!< in: index entry */ - ulint mode, /*!< in: BTR_MODIFY_LEAF, ... */ + btr_latch_mode mode, /*!< in: BTR_MODIFY_LEAF, ... */ btr_pcur_t* pcur, /*!< in/out: persistent cursor, which must be closed by the caller */ mtr_t* mtr) /*!< in: mtr */ @@ -427,6 +426,6 @@ row_mtr_start(mtr_t* mtr, dict_index_t* index, bool pessimistic) log_free_check(); } -#include "row0row.ic" +#include "row0row.inl" #endif diff --git a/storage/innobase/include/row0row.ic b/storage/innobase/include/row0row.inl similarity index 100% rename from storage/innobase/include/row0row.ic rename to storage/innobase/include/row0row.inl diff --git a/storage/innobase/include/row0sel.h b/storage/innobase/include/row0sel.h index 6010771291fea..8134c60fe7206 100644 --- a/storage/innobase/include/row0sel.h +++ b/storage/innobase/include/row0sel.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2017, Oracle and/or its affiliates. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -24,8 +24,7 @@ Select Created 12/19/1997 Heikki Tuuri *******************************************************/ -#ifndef row0sel_h -#define row0sel_h +#pragma once #include "data0data.h" #include "que0types.h" @@ -58,15 +57,6 @@ void sel_col_prefetch_buf_free( /*======================*/ sel_buf_t* prefetch_buf); /*!< in, own: prefetch buffer */ -/*********************************************************************//** -Gets the plan node for the nth table in a join. -@return plan node */ -UNIV_INLINE -plan_t* -sel_node_get_nth_plan( -/*==================*/ - sel_node_t* node, /*!< in: select node */ - ulint i); /*!< in: get ith plan node */ /**********************************************************************//** Performs a select step. This is a high-level function used in SQL execution graphs. @@ -76,14 +66,6 @@ row_sel_step( /*=========*/ que_thr_t* thr); /*!< in: query thread */ /**********************************************************************//** -Performs an execution step of an open or close cursor statement node. -@return query thread to run next or NULL */ -UNIV_INLINE -que_thr_t* -open_step( -/*======*/ - que_thr_t* thr); /*!< in: query thread */ -/**********************************************************************//** Performs a fetch for a cursor. @return query thread to run next or NULL */ que_thr_t* @@ -136,37 +118,7 @@ row_sel_convert_mysql_key_to_innobase( ulint key_len); /*!< in: MySQL key value length */ -/** Searches for rows in the database. This is used in the interface to -MySQL. This function opens a cursor, and also implements fetch next -and fetch prev. NOTE that if we do a search with a full key value -from a unique index (ROW_SEL_EXACT), then we will not store the cursor -position and fetch next or fetch prev must not be tried to the cursor! - -@param[out] buf buffer for the fetched row in MySQL format -@param[in] mode search mode PAGE_CUR_L -@param[in,out] prebuilt prebuilt struct for the table handler; - this contains the info to search_tuple, - index; if search tuple contains 0 field then - we position the cursor at start or the end of - index, depending on 'mode' -@param[in] match_mode 0 or ROW_SEL_EXACT or ROW_SEL_EXACT_PREFIX -@param[in] direction 0 or ROW_SEL_NEXT or ROW_SEL_PREV; - Note: if this is != 0, then prebuilt must has a - pcur with stored position! In opening of a - cursor 'direction' should be 0. -@return DB_SUCCESS, DB_RECORD_NOT_FOUND, DB_END_OF_INDEX, DB_DEADLOCK, -DB_LOCK_TABLE_FULL, DB_CORRUPTION, or DB_TOO_BIG_RECORD */ -UNIV_INLINE -dberr_t -row_search_for_mysql( - byte* buf, - page_cur_mode_t mode, - row_prebuilt_t* prebuilt, - ulint match_mode, - ulint direction) - MY_ATTRIBUTE((warn_unused_result)); - -/** Searches for rows in the database using cursor. +/** Search for rows in the database using cursor. Function is mainly used for tables that are shared across connections and so it employs technique that can help re-construct the rows that transaction is suppose to see. @@ -184,7 +136,8 @@ It also has optimization such as pre-caching the rows, using AHI, etc. Note: if this is != 0, then prebuilt must has a pcur with stored position! In opening of a cursor 'direction' should be 0. -@return DB_SUCCESS or error code */ +@return DB_SUCCESS, DB_RECORD_NOT_FOUND, DB_END_OF_INDEX, DB_DEADLOCK, +DB_LOCK_TABLE_FULL, DB_CORRUPTION, or DB_TOO_BIG_RECORD */ dberr_t row_search_mvcc( byte* buf, @@ -210,6 +163,21 @@ row_count_rtree_recs( ulint* n_rows); /*!< out: number of entries seen in the consistent read */ +/** +Check the index records in CHECK TABLE. +The index must contain entries in an ascending order, +unique constraint must not be violated by duplicated keys, +and the number of index entries is counted in according to the +current read view. + +@param prebuilt index and transaction +@param n_rows number of records counted + +@return error code +@retval DB_SUCCESS if no error was found */ +dberr_t row_check_index(row_prebuilt_t *prebuilt, ulint *n_rows) + MY_ATTRIBUTE((nonnull, warn_unused_result)); + /** Read the max AUTOINC value from an index. @param[in] index index starting with an AUTO_INCREMENT column @return the largest AUTO_INCREMENT value @@ -382,6 +350,17 @@ struct sel_node_t{ fetches */ }; +/** +Get the plan node for a table in a join. +@param node query graph node for SELECT +@param i plan node element +@return ith plan node */ +inline plan_t *sel_node_get_nth_plan(sel_node_t *node, ulint i) +{ + ut_ad(i < node->n_tables); + return &node->plans[i]; +} + /** Fetch statement node */ struct fetch_node_t{ que_common_t common; /*!< type: QUE_NODE_FETCH */ @@ -476,7 +455,3 @@ row_sel_field_store_in_mysql_format_func( #endif /* UNIV_DEBUG */ const byte* data, /*!< in: data to store */ ulint len); /*!< in: length of the data */ - -#include "row0sel.ic" - -#endif diff --git a/storage/innobase/include/row0sel.ic b/storage/innobase/include/row0sel.ic deleted file mode 100644 index 7880605ca8f4a..0000000000000 --- a/storage/innobase/include/row0sel.ic +++ /dev/null @@ -1,138 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1997, 2014, 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 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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/row0sel.ic -Select - -Created 12/19/1997 Heikki Tuuri -*******************************************************/ - -#include "que0que.h" - -/*********************************************************************//** -Gets the plan node for the nth table in a join. -@return plan node */ -UNIV_INLINE -plan_t* -sel_node_get_nth_plan( -/*==================*/ - sel_node_t* node, /*!< in: select node */ - ulint i) /*!< in: get ith plan node */ -{ - ut_ad(i < node->n_tables); - - return(node->plans + i); -} - -/*********************************************************************//** -Resets the cursor defined by sel_node to the SEL_NODE_OPEN state, which means -that it will start fetching from the start of the result set again, regardless -of where it was before, and it will set intention locks on the tables. */ -UNIV_INLINE -void -sel_node_reset_cursor( -/*==================*/ - sel_node_t* node) /*!< in: select node */ -{ - node->state = SEL_NODE_OPEN; -} - -/**********************************************************************//** -Performs an execution step of an open or close cursor statement node. -@return query thread to run next or NULL */ -UNIV_INLINE -que_thr_t* -open_step( -/*======*/ - que_thr_t* thr) /*!< in: query thread */ -{ - sel_node_t* sel_node; - open_node_t* node; - ulint err; - - ut_ad(thr); - - node = (open_node_t*) thr->run_node; - ut_ad(que_node_get_type(node) == QUE_NODE_OPEN); - - sel_node = node->cursor_def; - - err = DB_SUCCESS; - - if (node->op_type == ROW_SEL_OPEN_CURSOR) { - - /* if (sel_node->state == SEL_NODE_CLOSED) { */ - - sel_node_reset_cursor(sel_node); - /* } else { - err = DB_ERROR; - } */ - } else { - if (sel_node->state != SEL_NODE_CLOSED) { - - sel_node->state = SEL_NODE_CLOSED; - } else { - err = DB_ERROR; - } - } - - if (err != DB_SUCCESS) { - /* SQL error detected */ - fprintf(stderr, "SQL error %lu\n", (ulong) err); - - ut_error; - } - - thr->run_node = que_node_get_parent(node); - - return(thr); -} - - -/** Searches for rows in the database. This is used in the interface to -MySQL. This function opens a cursor, and also implements fetch next -and fetch prev. NOTE that if we do a search with a full key value -from a unique index (ROW_SEL_EXACT), then we will not store the cursor -position and fetch next or fetch prev must not be tried to the cursor! - -@param[out] buf buffer for the fetched row in MySQL format -@param[in] mode search mode PAGE_CUR_L -@param[in,out] prebuilt prebuilt struct for the table handler; - this contains the info to search_tuple, - index; if search tuple contains 0 field then - we position the cursor at start or the end of - index, depending on 'mode' -@param[in] match_mode 0 or ROW_SEL_EXACT or ROW_SEL_EXACT_PREFIX -@param[in] direction 0 or ROW_SEL_NEXT or ROW_SEL_PREV; - Note: if this is != 0, then prebuilt must has a - pcur with stored position! In opening of a - cursor 'direction' should be 0. -@return DB_SUCCESS, DB_RECORD_NOT_FOUND, DB_END_OF_INDEX, DB_DEADLOCK, -DB_LOCK_TABLE_FULL, DB_CORRUPTION, or DB_TOO_BIG_RECORD */ -UNIV_INLINE -dberr_t -row_search_for_mysql( - byte* buf, - page_cur_mode_t mode, - row_prebuilt_t* prebuilt, - ulint match_mode, - ulint direction) -{ - return(row_search_mvcc(buf, mode, prebuilt, match_mode, direction)); -} diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h index 58c60a0a4da54..f60fc3595dcb6 100644 --- a/storage/innobase/include/row0upd.h +++ b/storage/innobase/include/row0upd.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -118,14 +118,6 @@ row_upd_changes_field_size_or_external( dict_index_t* index, /*!< in: index */ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ const upd_t* update);/*!< in: update vector */ -/***********************************************************//** -Returns true if row update contains disowned external fields. -@return true if the update contains disowned external fields. */ -bool -row_upd_changes_disowned_external( -/*==============================*/ - const upd_t* update) /*!< in: update vector */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); /***************************************************************//** Builds an update vector from those fields which in a secondary index entry @@ -150,6 +142,8 @@ the equal ordering fields. NOTE: we compare the fields as binary strings! @param[in] offsets rec_get_offsets(rec,index), or NULL @param[in] no_sys skip the system columns DB_TRX_ID and DB_ROLL_PTR +@param[in] ignore_warnings ignore warnings during vcol calculation, which + means that this calculation is internal only @param[in] trx transaction (for diagnostics), or NULL @param[in] heap memory heap from which allocated @@ -165,11 +159,12 @@ row_upd_build_difference_binary( const rec_t* rec, const rec_offs* offsets, bool no_sys, + bool ignore_warnings, trx_t* trx, mem_heap_t* heap, TABLE* mysql_table, dberr_t* error) - MY_ATTRIBUTE((nonnull(1,2,3,7,9), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,2,3,8,10), warn_unused_result)); /** Apply an update vector to an index entry. @param[in,out] entry index entry to be updated; the clustered index record must be covered by a lock or a page latch to prevent @@ -521,17 +516,13 @@ struct upd_node_t{ void vers_make_update(const trx_t *trx) { vers_update_fields(trx, table->vers_start); - } + } - /** Only set row_end = CURRENT_TIMESTAMP/trx->id. - Do not touch other fields at all. - @param[in] trx transaction */ - void vers_make_delete(const trx_t *trx) - { - update->n_fields = 0; - is_delete = VERSIONED_DELETE; - vers_update_fields(trx, table->vers_end); - } + /** Prepare update vector for versioned delete. + Set row_end to CURRENT_TIMESTAMP or trx->id. + Initialize fts_next_doc_id for versioned delete. + @param[in] trx transaction */ + void vers_make_delete(trx_t *trx); }; #define UPD_NODE_MAGIC_N 1579975 @@ -563,6 +554,6 @@ struct upd_node_t{ changed in the update */ -#include "row0upd.ic" +#include "row0upd.inl" #endif diff --git a/storage/innobase/include/row0upd.ic b/storage/innobase/include/row0upd.inl similarity index 100% rename from storage/innobase/include/row0upd.ic rename to storage/innobase/include/row0upd.inl diff --git a/storage/innobase/include/row0vers.h b/storage/innobase/include/row0vers.h index e05b18a8cccde..60f310e1b0f66 100644 --- a/storage/innobase/include/row0vers.h +++ b/storage/innobase/include/row0vers.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -55,7 +55,7 @@ row_vers_impl_x_locked( const rec_offs* offsets); /** Finds out if a version of the record, where the version >= the current -purge view, should have ientry as its secondary index entry. We check +purge_sys.view, should have ientry as its secondary index entry. We check if there is any not delete marked version of the record where the trx id >= purge view, and the secondary index entry == ientry; exactly in this case we return TRUE. @@ -85,7 +85,9 @@ row_vers_old_has_index_entry( Constructs the version of a clustered index record which a consistent read should see. We assume that the trx id stored in rec is such that the consistent read should not see rec in its present version. -@return DB_SUCCESS or DB_MISSING_HISTORY */ +@return error code +@retval DB_SUCCESS if a previous version was fetched +@retval DB_MISSING_HISTORY if the history is missing (a sign of corruption) */ dberr_t row_vers_build_for_consistent_read( /*===============================*/ diff --git a/storage/innobase/include/rw_lock.h b/storage/innobase/include/rw_lock.h index 0ae052fabe271..4881f2f1d350e 100644 --- a/storage/innobase/include/rw_lock.h +++ b/storage/innobase/include/rw_lock.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2020, 2021, MariaDB Corporation. +Copyright (c) 2020, 2022, 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 @@ -20,17 +20,7 @@ this program; if not, write to the Free Software Foundation, Inc., #include #include "my_dbug.h" -#if !(defined __linux__ || defined __OpenBSD__ || defined _WIN32) -# define SUX_LOCK_GENERIC -#elif 0 // defined SAFE_MUTEX -# define SUX_LOCK_GENERIC /* Use dummy implementation for debugging purposes */ -#endif - -#ifdef SUX_LOCK_GENERIC -/** Simple read-update-write lock based on std::atomic */ -#else /** Simple read-write lock based on std::atomic */ -#endif class rw_lock { /** The lock word */ @@ -45,10 +35,6 @@ class rw_lock static constexpr uint32_t WRITER_WAITING= 1U << 30; /** Flag to indicate that write_lock() or write_lock_wait() is pending */ static constexpr uint32_t WRITER_PENDING= WRITER | WRITER_WAITING; -#ifdef SUX_LOCK_GENERIC - /** Flag to indicate that an update lock exists */ - static constexpr uint32_t UPDATER= 1U << 29; -#endif /* SUX_LOCK_GENERIC */ /** Start waiting for an exclusive lock. */ void write_lock_wait_start() @@ -56,7 +42,7 @@ class rw_lock #if defined __GNUC__ && (defined __i386__ || defined __x86_64__) static_assert(WRITER_WAITING == 1U << 30, "compatibility"); __asm__ __volatile__("lock btsl $30, %0" : "+m" (lock)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_IX64) +#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) static_assert(WRITER_WAITING == 1U << 30, "compatibility"); _interlockedbittestandset(reinterpret_cast(&lock), 30); #else @@ -76,12 +62,8 @@ class rw_lock std::memory_order_relaxed); } /** Try to acquire a shared lock. - @tparam prioritize_updater whether to ignore WRITER_WAITING for UPDATER @param l the value of the lock word @return whether the lock was acquired */ -#ifdef SUX_LOCK_GENERIC - template -#endif /* SUX_LOCK_GENERIC */ bool read_trylock(uint32_t &l) { l= UNLOCKED; @@ -89,66 +71,11 @@ class rw_lock std::memory_order_relaxed)) { DBUG_ASSERT(!(WRITER & l) || !(~WRITER_PENDING & l)); -#ifdef SUX_LOCK_GENERIC - DBUG_ASSERT((~(WRITER_PENDING | UPDATER) & l) < UPDATER); - if (prioritize_updater - ? (WRITER & l) || ((WRITER_WAITING | UPDATER) & l) == WRITER_WAITING - : (WRITER_PENDING & l)) -#else /* SUX_LOCK_GENERIC */ if (l & WRITER_PENDING) -#endif /* SUX_LOCK_GENERIC */ - return false; - } - return true; - } -#ifdef SUX_LOCK_GENERIC - /** Try to acquire an update lock. - @param l the value of the lock word - @return whether the lock was acquired */ - bool update_trylock(uint32_t &l) - { - l= UNLOCKED; - while (!lock.compare_exchange_strong(l, l | UPDATER, - std::memory_order_acquire, - std::memory_order_relaxed)) - { - DBUG_ASSERT(!(WRITER & l) || !(~WRITER_PENDING & l)); - DBUG_ASSERT((~(WRITER_PENDING | UPDATER) & l) < UPDATER); - if ((WRITER_PENDING | UPDATER) & l) return false; } return true; } - /** Try to upgrade an update lock to an exclusive lock. - @return whether the update lock was upgraded to exclusive */ - bool upgrade_trylock() - { - auto l= UPDATER; - while (!lock.compare_exchange_strong(l, WRITER, - std::memory_order_acquire, - std::memory_order_relaxed)) - { - /* Either conflicting (read) locks have been granted, or - the WRITER_WAITING flag was set by some thread that is waiting - to become WRITER. */ - DBUG_ASSERT(((WRITER | UPDATER) & l) == UPDATER); - if (~(WRITER_WAITING | UPDATER) & l) - return false; - } - DBUG_ASSERT((l & ~WRITER_WAITING) == UPDATER); - /* Any thread that had set WRITER_WAITING will eventually be woken - up by ssux_lock_impl::x_unlock() or ssux_lock_impl::u_unlock() - (not ssux_lock_impl::wr_u_downgrade() to keep the code simple). */ - return true; - } - /** Downgrade an exclusive lock to an update lock. */ - void downgrade() - { - IF_DBUG_ASSERT(auto l=,) - lock.fetch_xor(WRITER | UPDATER, std::memory_order_relaxed); - DBUG_ASSERT((l & ~WRITER_WAITING) == WRITER); - } -#endif /* SUX_LOCK_GENERIC */ /** Wait for an exclusive lock. @return whether the exclusive lock was acquired */ @@ -175,24 +102,9 @@ class rw_lock { auto l= lock.fetch_sub(1, std::memory_order_release); DBUG_ASSERT(!(l & WRITER)); /* no write lock must have existed */ -#ifdef SUX_LOCK_GENERIC - DBUG_ASSERT(~(WRITER_PENDING | UPDATER) & l); /* at least one read lock */ - return (~(WRITER_PENDING | UPDATER) & l) == 1; -#else /* SUX_LOCK_GENERIC */ DBUG_ASSERT(~(WRITER_PENDING) & l); /* at least one read lock */ return (~WRITER_PENDING & l) == 1; -#endif /* SUX_LOCK_GENERIC */ - } -#ifdef SUX_LOCK_GENERIC - /** Release an update lock */ - void update_unlock() - { - IF_DBUG_ASSERT(auto l=,) - lock.fetch_and(~UPDATER, std::memory_order_release); - /* the update lock must have existed */ - DBUG_ASSERT((l & (WRITER | UPDATER)) == UPDATER); } -#endif /* SUX_LOCK_GENERIC */ /** Release an exclusive lock */ void write_unlock() { @@ -203,11 +115,7 @@ class rw_lock static_assert(WRITER == 1U << 31, "compatibility"); IF_DBUG_ASSERT(auto l=,) lock.fetch_sub(WRITER, std::memory_order_release); /* the write lock must have existed */ -#ifdef SUX_LOCK_GENERIC - DBUG_ASSERT((l & (WRITER | UPDATER)) == WRITER); -#else /* SUX_LOCK_GENERIC */ DBUG_ASSERT(l & WRITER); -#endif /* SUX_LOCK_GENERIC */ } /** Try to acquire a shared lock. @return whether the lock was acquired */ @@ -223,10 +131,6 @@ class rw_lock /** @return whether an exclusive lock is being held by any thread */ bool is_write_locked() const { return !!(value() & WRITER); } -#ifdef SUX_LOCK_GENERIC - /** @return whether an update lock is being held by any thread */ - bool is_update_locked() const { return !!(value() & UPDATER); } -#endif /* SUX_LOCK_GENERIC */ /** @return whether any lock is being held or waited for by any thread */ bool is_locked_or_waiting() const { return value() != 0; } /** @return whether any lock is being held by any thread */ diff --git a/storage/innobase/include/small_vector.h b/storage/innobase/include/small_vector.h new file mode 100644 index 0000000000000..d28a36184b8e2 --- /dev/null +++ b/storage/innobase/include/small_vector.h @@ -0,0 +1,100 @@ +/***************************************************************************** + +Copyright (c) 2023, 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 02110-1335 USA + +*****************************************************************************/ + +#pragma once +/* A normally small vector, inspired by llvm::SmallVector */ +#include "my_global.h" +#include +#include + +class small_vector_base +{ +protected: + typedef uint32_t Size_T; + void *BeginX; + Size_T Size= 0, Capacity; + small_vector_base()= delete; + small_vector_base(void *small, size_t small_size) + : BeginX(small), Capacity(Size_T(small_size)) {} + ATTRIBUTE_COLD void grow_by_1(void *small, size_t element_size); +public: + size_t size() const { return Size; } + size_t capacity() const { return Capacity; } + bool empty() const { return !Size; } + void clear() { Size= 0; } +protected: + void set_size(size_t N) { Size= Size_T(N); } +}; + +template +class small_vector : public small_vector_base +{ + /** The fixed storage allocation */ + T small[N]; + + using small_vector_base::set_size; + + void grow_if_needed() + { + if (unlikely(size() >= capacity())) + grow_by_1(small, sizeof *small); + } + +public: + small_vector() : small_vector_base(small, N) + { + TRASH_ALLOC(small, sizeof small); + } + ~small_vector() + { + if (small != begin()) + my_free(begin()); + MEM_MAKE_ADDRESSABLE(small, sizeof small); + } + + using iterator= T *; + using const_iterator= const T *; + using reverse_iterator= std::reverse_iterator; + using reference= T &; + using const_reference= const T&; + + iterator begin() { return static_cast(BeginX); } + const_iterator begin() const { return static_cast(BeginX); } + iterator end() { return begin() + size(); } + const_iterator end() const { return begin() + size(); } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + + reference operator[](size_t i) { assert(i < size()); return begin()[i]; } + const_reference operator[](size_t i) const + { return const_cast(*this)[i]; } + + void erase(const_iterator S, const_iterator E) + { + set_size(std::move(const_cast(E), end(), + const_cast(S)) - begin()); + } + + void emplace_back(T &&arg) + { + grow_if_needed(); + ::new (end()) T(arg); + set_size(size() + 1); + } +}; diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h index a355c65fe6bd2..1ca2d7a429f71 100644 --- a/storage/innobase/include/srv0mon.h +++ b/storage/innobase/include/srv0mon.h @@ -174,8 +174,6 @@ enum monitor_id_t { MONITOR_OVLD_BUF_POOL_PAGES_FREE, MONITOR_OVLD_PAGE_CREATED, MONITOR_OVLD_PAGES_WRITTEN, - MONITOR_OVLD_INDEX_PAGES_WRITTEN, - MONITOR_OVLD_NON_INDEX_PAGES_WRITTEN, MONITOR_OVLD_PAGES_READ, MONITOR_OVLD_INDEX_SEC_REC_CLUSTER_READS, MONITOR_OVLD_INDEX_SEC_REC_CLUSTER_READS_AVOIDED, @@ -304,7 +302,6 @@ enum monitor_id_t { MONITOR_LSN_CHECKPOINT_AGE, MONITOR_OVLD_BUF_OLDEST_LSN, MONITOR_OVLD_MAX_AGE_ASYNC, - MONITOR_LOG_IO, MONITOR_OVLD_LOG_WAITS, MONITOR_OVLD_LOG_WRITE_REQUEST, MONITOR_OVLD_LOG_WRITES, @@ -857,6 +854,6 @@ void srv_mon_default_on(void); /*====================*/ -#include "srv0mon.ic" +#include "srv0mon.inl" #endif diff --git a/storage/innobase/include/srv0mon.ic b/storage/innobase/include/srv0mon.inl similarity index 100% rename from storage/innobase/include/srv0mon.ic rename to storage/innobase/include/srv0mon.inl diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index fde39d998b66c..f02c10b603b92 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -3,7 +3,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2008, 2009, Google Inc. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -55,7 +55,7 @@ Created 10/10/1995 Heikki Tuuri /** Simple non-atomic counter @tparam Type the integer type of the counter */ template -struct MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) simple_counter +struct alignas(CPU_LEVEL1_DCACHE_LINESIZE) simple_counter { /** Increment the counter */ Type inc() { return add(1); } @@ -85,20 +85,8 @@ struct srv_stats_t /** Count the amount of data written in total (in bytes) */ ulint_ctr_1_t data_written; - - /** Store the number of write requests issued */ - ulint_ctr_1_t buf_pool_write_requests; - - /** Number of buffer pool reads that led to the reading of - a disk page */ - ulint_ctr_1_t buf_pool_reads; - /** Number of bytes saved by page compression */ ulint_ctr_n_t page_compression_saved; - /* Number of index pages written */ - ulint_ctr_n_t index_pages_written; - /* Number of non index pages written */ - ulint_ctr_n_t non_index_pages_written; /* Number of pages compressed with page compression */ ulint_ctr_n_t pages_page_compressed; /* Number of TRIM operations induced by page compression */ @@ -156,9 +144,6 @@ struct srv_stats_t /** Number of encryption_get_latest_key_version calls */ ulint_ctr_n_t n_key_requests; - /** Number of spaces in keyrotation list */ - ulint_ctr_n_t key_rotation_list_length; - /** Number of temporary tablespace blocks encrypted */ ulint_ctr_n_t n_temp_blocks_encrypted; @@ -279,19 +264,8 @@ extern uint srv_flush_log_at_timeout; extern my_bool srv_adaptive_flushing; extern my_bool srv_flush_sync; -#ifdef WITH_INNODB_DISALLOW_WRITES -extern my_bool innodb_disallow_writes; -void innodb_wait_allow_writes(); -#else -# define innodb_wait_allow_writes() do {} while (0) -#endif /* WITH_INNODB_DISALLOW_WRITES */ - /** Requested size in bytes */ extern ulint srv_buf_pool_size; -/** Minimum pool size in bytes */ -extern const ulint srv_buf_pool_min_size; -/** Default pool size in bytes */ -extern const ulint srv_buf_pool_def_size; /** Requested buffer pool chunk size */ extern size_t srv_buf_pool_chunk_unit; /** Scan depth for LRU flush batch i.e.: number of blocks scanned*/ @@ -315,8 +289,6 @@ extern ulint srv_lock_table_size; /** the value of innodb_checksum_algorithm */ extern ulong srv_checksum_algorithm; - -extern uint srv_n_file_io_threads; extern my_bool srv_random_read_ahead; extern ulong srv_read_ahead_threshold; extern uint srv_n_read_io_threads; @@ -391,6 +363,9 @@ extern my_bool srv_immediate_scrub_data_uncompressed; enum srv_operation_mode { /** Normal mode (MariaDB Server) */ SRV_OPERATION_NORMAL, + /** Mariabackup is executing server to export already restored + tablespaces */ + SRV_OPERATION_EXPORT_RESTORED, /** Mariabackup taking a backup */ SRV_OPERATION_BACKUP, /** Mariabackup restoring a backup for subsequent --copy-back */ @@ -398,7 +373,10 @@ enum srv_operation_mode { /** Mariabackup restoring the incremental part of a backup */ SRV_OPERATION_RESTORE_DELTA, /** Mariabackup restoring a backup for subsequent --export */ - SRV_OPERATION_RESTORE_EXPORT + SRV_OPERATION_RESTORE_EXPORT, + /** Mariabackup taking a backup and avoid deferring + any tablespace */ + SRV_OPERATION_BACKUP_NO_DEFER }; /** Current mode of operation */ @@ -439,8 +417,6 @@ extern bool srv_log_file_created; extern ulint srv_dml_needed_delay; -#define SRV_MAX_N_IO_THREADS 130 - /** innodb_purge_threads; the number of purge tasks to use */ extern uint srv_n_purge_threads; @@ -671,24 +647,11 @@ struct export_var_t{ char innodb_buffer_pool_resize_status[512];/*!< Buf pool resize status */ my_bool innodb_buffer_pool_load_incomplete;/*!< Buf pool load incomplete */ ulint innodb_buffer_pool_pages_total; /*!< Buffer pool size */ - ulint innodb_buffer_pool_pages_data; /*!< Data pages */ ulint innodb_buffer_pool_bytes_data; /*!< File bytes used */ - ulint innodb_buffer_pool_pages_dirty; /*!< Dirty data pages */ - ulint innodb_buffer_pool_bytes_dirty; /*!< File bytes modified */ ulint innodb_buffer_pool_pages_misc; /*!< Miscellanous pages */ - ulint innodb_buffer_pool_pages_free; /*!< Free pages */ #ifdef UNIV_DEBUG ulint innodb_buffer_pool_pages_latched; /*!< Latched pages */ #endif /* UNIV_DEBUG */ - ulint innodb_buffer_pool_pages_made_not_young; - ulint innodb_buffer_pool_pages_made_young; - ulint innodb_buffer_pool_pages_old; - ulint innodb_buffer_pool_read_requests; /*!< buf_pool.stat.n_page_gets */ - ulint innodb_buffer_pool_reads; /*!< srv_buf_pool_reads */ - ulint innodb_buffer_pool_write_requests;/*!< srv_stats.buf_pool_write_requests */ - ulint innodb_buffer_pool_read_ahead_rnd;/*!< srv_read_ahead_rnd */ - ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */ - ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/ ulint innodb_checkpoint_age; ulint innodb_checkpoint_max_age; ulint innodb_data_pending_reads; /*!< Pending reads */ @@ -751,10 +714,6 @@ struct export_var_t{ int64_t innodb_page_compression_saved;/*!< Number of bytes saved by page compression */ - int64_t innodb_index_pages_written; /*!< Number of index pages - written */ - int64_t innodb_non_index_pages_written; /*!< Number of non index pages - written */ int64_t innodb_pages_page_compressed;/*!< Number of pages compressed by page compression */ int64_t innodb_page_compressed_trim_op;/*!< Number of TRIM operations @@ -793,7 +752,6 @@ struct export_var_t{ ulint innodb_encryption_rotation_pages_flushed; ulint innodb_encryption_rotation_estimated_iops; int64_t innodb_encryption_key_requests; - int64_t innodb_key_rotation_list_length; }; extern tpool::thread_pool *srv_thread_pool; diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h index 9033cd916c349..44b19aa666bda 100644 --- a/storage/innobase/include/srv0start.h +++ b/storage/innobase/include/srv0start.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -52,9 +52,6 @@ void innodb_preshutdown(); /** Shut down InnoDB. */ void innodb_shutdown(); -/** Shut down background threads that can generate undo log. */ -void srv_shutdown_bg_undo_sources(); - /*************************************************************//** Copy the file path component of the physical file to parameter. It will copy up to and including the terminating path separator. diff --git a/storage/innobase/include/srw_lock.h b/storage/innobase/include/srw_lock.h index e8ed346d3aced..1dca0cc1054f0 100644 --- a/storage/innobase/include/srw_lock.h +++ b/storage/innobase/include/srw_lock.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2020, 2021, MariaDB Corporation. +Copyright (c) 2020, 2022, 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 @@ -20,27 +20,58 @@ this program; if not, write to the Free Software Foundation, Inc., #include "univ.i" #include "rw_lock.h" +#if defined __linux__ +/* futex(2): FUTEX_WAIT_PRIVATE, FUTEX_WAKE_PRIVATE */ +#elif defined __OpenBSD__ || defined __FreeBSD__ || defined __DragonFly__ +/* system calls similar to Linux futex(2) */ +#elif defined _WIN32 +/* SRWLOCK as well as WaitOnAddress(), WakeByAddressSingle() */ +#else +# define SUX_LOCK_GENERIC /* fall back to generic synchronization primitives */ +#endif + +#if !defined SUX_LOCK_GENERIC && 0 /* defined SAFE_MUTEX */ +# define SUX_LOCK_GENERIC /* Use dummy implementation for debugging purposes */ +#endif + #ifdef SUX_LOCK_GENERIC /** An exclusive-only variant of srw_lock */ template -class srw_mutex_impl final +class pthread_mutex_wrapper final { pthread_mutex_t lock; - void wr_wait(); public: - void init() { pthread_mutex_init(&lock, nullptr); } + void init() + { + if (spinloop) + pthread_mutex_init(&lock, MY_MUTEX_INIT_FAST); + else + pthread_mutex_init(&lock, nullptr); + } void destroy() { pthread_mutex_destroy(&lock); } +# ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP + void wr_lock() { pthread_mutex_lock(&lock); } +# else +private: + void wr_wait(); +public: inline void wr_lock(); +# endif void wr_unlock() { pthread_mutex_unlock(&lock); } bool wr_lock_try() { return !pthread_mutex_trylock(&lock); } }; -template<> void srw_mutex_impl::wr_wait(); +# ifndef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP +template<> void pthread_mutex_wrapper::wr_wait(); template<> -inline void srw_mutex_impl::wr_lock() { pthread_mutex_lock(&lock); } +inline void pthread_mutex_wrapper::wr_lock() +{ pthread_mutex_lock(&lock); } template<> -inline void srw_mutex_impl::wr_lock() { if (!wr_lock_try()) wr_wait(); } -#else +inline void pthread_mutex_wrapper::wr_lock() +{ if (!wr_lock_try()) wr_wait(); } +# endif +#endif + /** Futex-based mutex */ template class srw_mutex_impl final @@ -51,6 +82,15 @@ class srw_mutex_impl final /** Identifies that the lock is being held */ static constexpr uint32_t HOLDER= 1U << 31; +#ifdef SUX_LOCK_GENERIC +public: + /** The mutex for the condition variables. */ + pthread_mutex_t mutex; +private: + /** Condition variable for the lock word. Used with mutex. */ + pthread_cond_t cond; +#endif + /** Wait until the mutex has been acquired */ void wait_and_lock(); /** Wait for lock!=lk */ @@ -65,8 +105,22 @@ class srw_mutex_impl final bool is_locked() const { return (lock.load(std::memory_order_acquire) & HOLDER) != 0; } - void init() { DBUG_ASSERT(!is_locked_or_waiting()); } - void destroy() { DBUG_ASSERT(!is_locked_or_waiting()); } + void init() + { + DBUG_ASSERT(!is_locked_or_waiting()); +#ifdef SUX_LOCK_GENERIC + pthread_mutex_init(&mutex, nullptr); + pthread_cond_init(&cond, nullptr); +#endif + } + void destroy() + { + DBUG_ASSERT(!is_locked_or_waiting()); +#ifdef SUX_LOCK_GENERIC + pthread_mutex_destroy(&mutex); + pthread_cond_destroy(&cond); +#endif + } /** @return whether the mutex was acquired */ bool wr_lock_try() @@ -88,19 +142,20 @@ class srw_mutex_impl final } } }; -#endif +#ifdef SUX_LOCK_GENERIC +typedef pthread_mutex_wrapper srw_spin_mutex; +typedef pthread_mutex_wrapper srw_mutex; +#else typedef srw_mutex_impl srw_spin_mutex; typedef srw_mutex_impl srw_mutex; +#endif template class srw_lock_impl; /** Slim shared-update-exclusive lock with no recursion */ template class ssux_lock_impl final -#ifdef SUX_LOCK_GENERIC - : private rw_lock -#endif { #ifdef UNIV_PFS_RWLOCK friend class ssux_lock; @@ -110,50 +165,12 @@ class ssux_lock_impl final friend srw_lock_impl; # endif #endif -#ifdef SUX_LOCK_GENERIC - pthread_mutex_t mutex; - pthread_cond_t cond_shared; - pthread_cond_t cond_exclusive; - - /** Wait for a read lock. - @param l lock word from a failed read_trylock() */ - void read_lock(uint32_t l); - /** Wait for an update lock. - @param l lock word from a failed update_trylock() */ - void update_lock(uint32_t l); - /** Wait for a write lock after a failed write_trylock() or upgrade_trylock() - @param holding_u whether we already hold u_lock() */ - void write_lock(bool holding_u); - /** Wait for signal - @param l lock word from a failed acquisition */ - inline void writer_wait(uint32_t l); - /** Wait for signal - @param l lock word from a failed acquisition */ - inline void readers_wait(uint32_t l); - /** Wake waiters */ - inline void wake(); -public: - void init(); - void destroy(); - /** @return whether any writer is waiting */ - bool is_waiting() const { return (value() & WRITER_WAITING) != 0; } - bool is_write_locked() const { return rw_lock::is_write_locked(); } - bool is_locked_or_waiting() const { return rw_lock::is_locked_or_waiting(); } - - bool rd_lock_try() { uint32_t l; return read_trylock(l); } - bool wr_lock_try() { return write_trylock(); } - void rd_lock() { uint32_t l; if (!read_trylock(l)) read_lock(l); } - void u_lock() { uint32_t l; if (!update_trylock(l)) update_lock(l); } - bool u_lock_try() { uint32_t l; return update_trylock(l); } - void u_wr_upgrade() { if (!upgrade_trylock()) write_lock(true); } - void wr_u_downgrade() { downgrade(); } - void wr_lock() { if (!write_trylock()) write_lock(false); } - void rd_unlock(); - void u_unlock(); - void wr_unlock(); -#else /** mutex for synchronization; held by U or X lock holders */ srw_mutex_impl writer; +#ifdef SUX_LOCK_GENERIC + /** Condition variable for "readers"; used with writer.mutex. */ + pthread_cond_t readers_cond; +#endif /** S or U holders, and WRITER flag for X holder or waiter */ std::atomic readers; /** indicates an X request; readers=WRITER indicates granted X lock */ @@ -169,15 +186,29 @@ class ssux_lock_impl final /** Acquire a read lock */ void rd_wait(); public: - void init() { DBUG_ASSERT(is_vacant()); } - void destroy() { DBUG_ASSERT(is_vacant()); } + void init() + { + writer.init(); + DBUG_ASSERT(is_vacant()); +#ifdef SUX_LOCK_GENERIC + pthread_cond_init(&readers_cond, nullptr); +#endif + } + void destroy() + { + DBUG_ASSERT(is_vacant()); + writer.destroy(); +#ifdef SUX_LOCK_GENERIC + pthread_cond_destroy(&readers_cond); +#endif + } /** @return whether any writer is waiting */ bool is_waiting() const { return (readers.load(std::memory_order_relaxed) & WRITER) != 0; } -# ifndef DBUG_OFF +#ifndef DBUG_OFF /** @return whether the lock is being held or waited for */ bool is_vacant() const { return !is_locked_or_waiting(); } -# endif /* !DBUG_OFF */ +#endif /* !DBUG_OFF */ bool rd_lock_try() { @@ -224,7 +255,7 @@ class ssux_lock_impl final void wr_lock() { writer.wr_lock(); -#if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_IX64 +#if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 /* On IA-32 and AMD64, this type of fetch_or() can only be implemented as a loop around LOCK CMPXCHG. In this particular case, setting the most significant bit using fetch_add() is equivalent, and is @@ -288,7 +319,6 @@ class ssux_lock_impl final void unlock_shared() { rd_unlock(); } void lock() { wr_lock(); } void unlock() { wr_unlock(); } -#endif }; #if defined _WIN32 || defined SUX_LOCK_GENERIC @@ -505,6 +535,8 @@ class srw_lock_impl } bool rd_lock_try() { return lock.rd_lock_try(); } bool wr_lock_try() { return lock.wr_lock_try(); } + void lock_shared() { return rd_lock(SRW_LOCK_CALL); } + void unlock_shared() { return rd_unlock(); } #ifndef SUX_LOCK_GENERIC /** @return whether any lock may be held by any thread */ bool is_locked_or_waiting() const noexcept diff --git a/storage/innobase/include/sux_lock.h b/storage/innobase/include/sux_lock.h index 17a484c732e23..2c0167ac651e0 100644 --- a/storage/innobase/include/sux_lock.h +++ b/storage/innobase/include/sux_lock.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2020, 2021, MariaDB Corporation. +Copyright (c) 2020, 2022, 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 @@ -19,7 +19,6 @@ this program; if not, write to the Free Software Foundation, Inc., #pragma once #include "srw_lock.h" #include "my_atomic_wrapper.h" -#include "os0thread.h" #ifdef UNIV_DEBUG # include #endif @@ -36,19 +35,19 @@ class sux_lock final /** Numbers of U and X locks. Protected by lock. */ uint32_t recursive; /** The owner of the U or X lock (0 if none); protected by lock */ - std::atomic writer; + std::atomic writer; /** Special writer!=0 value to indicate that the lock is non-recursive and will be released by an I/O thread */ #if defined __linux__ || defined _WIN32 - static constexpr os_thread_id_t FOR_IO= os_thread_id_t(~0UL); + static constexpr pthread_t FOR_IO= pthread_t(~0UL); #else -# define FOR_IO ((os_thread_id_t) ~0UL) /* it could be a pointer */ +# define FOR_IO ((pthread_t) ~0UL) /* it could be a pointer */ #endif #ifdef UNIV_DEBUG /** Protects readers */ mutable srw_mutex readers_lock; /** Threads that hold the lock in shared mode */ - std::atomic*> readers; + std::atomic*> readers; #endif /** The multiplier in recursive for X locks */ @@ -109,7 +108,7 @@ class sux_lock final /** Acquire a recursive lock */ template void writer_recurse() { - ut_ad(writer == os_thread_get_curr_id()); + ut_ad(writer == pthread_self()); ut_d(auto rec= (recursive / (allow_readers ? RECURSIVE_U : RECURSIVE_X)) & RECURSIVE_MAX); ut_ad(allow_readers ? recursive : rec); @@ -120,14 +119,14 @@ class sux_lock final private: /** Transfer the ownership of a write lock to another thread @param id the new owner of the U or X lock */ - void set_new_owner(os_thread_id_t id) + void set_new_owner(pthread_t id) { IF_DBUG(DBUG_ASSERT(writer.exchange(id, std::memory_order_relaxed)), writer.store(id, std::memory_order_relaxed)); } /** Assign the ownership of a write lock to a thread @param id the owner of the U or X lock */ - void set_first_owner(os_thread_id_t id) + void set_first_owner(pthread_t id) { IF_DBUG(DBUG_ASSERT(!writer.exchange(id, std::memory_order_relaxed)), writer.store(id, std::memory_order_relaxed)); @@ -136,12 +135,12 @@ class sux_lock final /** Register the current thread as a holder of a shared lock */ void s_lock_register() { - const os_thread_id_t id= os_thread_get_curr_id(); + const pthread_t id= pthread_self(); readers_lock.wr_lock(); auto r= readers.load(std::memory_order_relaxed); if (!r) { - r= new std::unordered_multiset(); + r= new std::unordered_multiset(); readers.store(r, std::memory_order_relaxed); } r->emplace(id); @@ -152,12 +151,12 @@ class sux_lock final public: /** In crash recovery or the change buffer, claim the ownership of the exclusive block lock to the current thread */ - void claim_ownership() { set_new_owner(os_thread_get_curr_id()); } + void claim_ownership() { set_new_owner(pthread_self()); } /** @return whether the current thread is holding X or U latch */ bool have_u_or_x() const { - if (os_thread_get_curr_id() != writer.load(std::memory_order_relaxed)) + if (pthread_self() != writer.load(std::memory_order_relaxed)) return false; ut_ad(recursive); return true; @@ -175,7 +174,7 @@ class sux_lock final if (auto r= readers.load(std::memory_order_relaxed)) { readers_lock.wr_lock(); - bool found= r->find(os_thread_get_curr_id()) != r->end(); + bool found= r->find(pthread_self()) != r->end(); readers_lock.wr_unlock(); return found; } @@ -233,7 +232,7 @@ class sux_lock final void s_unlock() { #ifdef UNIV_DEBUG - const os_thread_id_t id= os_thread_get_curr_id(); + const pthread_t id= pthread_self(); auto r= readers.load(std::memory_order_relaxed); ut_ad(r); readers_lock.wr_lock(); @@ -250,7 +249,7 @@ class sux_lock final void u_or_x_unlock(bool allow_readers, bool claim_ownership= false) { ut_d(auto owner= writer.load(std::memory_order_relaxed)); - ut_ad(owner == os_thread_get_curr_id() || + ut_ad(owner == pthread_self() || (owner == FOR_IO && claim_ownership && recursive == (allow_readers ? RECURSIVE_U : RECURSIVE_X))); ut_d(auto rec= (recursive / (allow_readers ? RECURSIVE_U : RECURSIVE_X)) & @@ -314,7 +313,7 @@ inline void sux_lock::s_lock(const char *file, unsigned line) template<> inline void sux_lock::u_lock(const char *file, unsigned line) { - os_thread_id_t id= os_thread_get_curr_id(); + pthread_t id= pthread_self(); if (writer.load(std::memory_order_relaxed) == id) writer_recurse(); else @@ -329,7 +328,7 @@ inline void sux_lock::u_lock(const char *file, unsigned line) template<> inline void sux_lock::x_lock(const char *file, unsigned line) { - os_thread_id_t id= os_thread_get_curr_id(); + pthread_t id= pthread_self(); if (writer.load(std::memory_order_relaxed) == id) writer_recurse(); else @@ -371,7 +370,7 @@ inline void sux_lock::unlock_shared() { s_unlock(); } template inline void sux_lock::u_lock() { - os_thread_id_t id= os_thread_get_curr_id(); + pthread_t id= pthread_self(); if (writer.load(std::memory_order_relaxed) == id) writer_recurse(); else @@ -385,7 +384,7 @@ template inline void sux_lock::u_lock() template inline void sux_lock::x_lock(bool for_io) { - os_thread_id_t id= os_thread_get_curr_id(); + pthread_t id= pthread_self(); if (writer.load(std::memory_order_relaxed) == id) { ut_ad(!for_io); @@ -409,7 +408,7 @@ template inline void sux_lock::u_x_upgrade() template inline bool sux_lock::x_lock_upgraded() { - os_thread_id_t id= os_thread_get_curr_id(); + pthread_t id= pthread_self(); if (writer.load(std::memory_order_relaxed) == id) { ut_ad(recursive); @@ -436,7 +435,7 @@ template inline bool sux_lock::x_lock_upgraded() template inline bool sux_lock::u_lock_try(bool for_io) { - os_thread_id_t id= os_thread_get_curr_id(); + pthread_t id= pthread_self(); if (writer.load(std::memory_order_relaxed) == id) { if (for_io) @@ -456,7 +455,7 @@ template inline bool sux_lock::u_lock_try(bool for_io) template inline bool sux_lock::x_lock_try() { - os_thread_id_t id= os_thread_get_curr_id(); + pthread_t id= pthread_self(); if (writer.load(std::memory_order_relaxed) == id) { writer_recurse(); diff --git a/storage/innobase/include/transactional_lock_guard.h b/storage/innobase/include/transactional_lock_guard.h index 3167055630c26..168a68977a774 100644 --- a/storage/innobase/include/transactional_lock_guard.h +++ b/storage/innobase/include/transactional_lock_guard.h @@ -18,8 +18,8 @@ this program; if not, write to the Free Software Foundation, Inc., #pragma once -#if defined __powerpc64__ && defined __clang__ && defined __linux__ -#elif defined __powerpc64__&&defined __GNUC__&&defined __linux__&&__GNUC__ > 4 +#if defined __powerpc64__ +#elif defined __s390__ #elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) && !defined(__clang__) #elif defined __GNUC__ && (defined __i386__ || defined __x86_64__) # if __GNUC__ >= 8 @@ -45,8 +45,8 @@ bool transactional_lock_enabled(); # include # if defined __GNUC__ && !defined __INTEL_COMPILER -# define TRANSACTIONAL_TARGET __attribute__((target("rtm"))) -# define TRANSACTIONAL_INLINE __attribute__((target("rtm"),always_inline)) +# define TRANSACTIONAL_TARGET __attribute__((target("rtm"),hot)) +# define TRANSACTIONAL_INLINE __attribute__((target("rtm"),hot,always_inline)) # else # define TRANSACTIONAL_TARGET /* nothing */ # define TRANSACTIONAL_INLINE /* nothing */ @@ -69,26 +69,33 @@ static inline bool xtest() { return have_transactional_memory && _xtest(); } TRANSACTIONAL_INLINE static inline void xabort() { _xabort(0); } TRANSACTIONAL_INLINE static inline void xend() { _xend(); } -# elif defined __powerpc64__ -# include +# elif defined __powerpc64__ || defined __s390__ extern bool have_transactional_memory; bool transactional_lock_enabled(); -# define TRANSACTIONAL_TARGET __attribute__((target("htm"))) -# define TRANSACTIONAL_INLINE __attribute__((target("htm"),always_inline)) - -TRANSACTIONAL_INLINE static inline bool xbegin() -{ - return have_transactional_memory && - __TM_simple_begin() == _HTM_TBEGIN_STARTED; -} - +# define TRANSACTIONAL_TARGET __attribute__((hot)) +# define TRANSACTIONAL_INLINE __attribute__((hot,always_inline)) + +/** + Newer gcc compilers only provide __builtin_{htm} + functions when the -mhtm CFLAG is actually provided. So + we've got the option of including it globally, or + pushing down the inclusion of htmxlintrin.h to one + file with -mhtm enabled and removing the inline + optimization. + + Per FIXME in s390x's htmxlintrin.h, the __TM_simple_begin + isn't always_inline resulting in duplicate definitions if + it where included more than once. While xabort and xend + could be implemented here, we keep the implementation the + same as ppc64. + */ +TRANSACTIONAL_TARGET bool xbegin(); +TRANSACTIONAL_TARGET void xabort(); +TRANSACTIONAL_TARGET void xend(); # ifdef UNIV_DEBUG bool xtest(); # endif -TRANSACTIONAL_INLINE static inline void xabort() { __TM_abort(); } - -TRANSACTIONAL_INLINE static inline void xend() { __TM_end(); } # endif #endif diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h index dc032cdf73a7f..bf6f6eb8eff3f 100644 --- a/storage/innobase/include/trx0purge.h +++ b/storage/innobase/include/trx0purge.h @@ -24,8 +24,7 @@ Purge old versions Created 3/26/1996 Heikki Tuuri *******************************************************/ -#ifndef trx0purge_h -#define trx0purge_h +#pragma once #include "trx0sys.h" #include "que0types.h" @@ -33,10 +32,6 @@ Created 3/26/1996 Heikki Tuuri #include -/** A dummy undo record used as a return value when we have a whole undo log -which needs no purge */ -extern trx_undo_rec_t trx_purge_dummy_rec; - /** Prepend the history list with an undo log. Remove the undo log segment from the rseg slot if it is too big for reuse. @param[in] trx transaction @@ -46,10 +41,11 @@ void trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr); /** Run a purge batch. -@param n_tasks number of purge tasks to submit to the queue -@param truncate whether to truncate the history at the end of the batch +@param n_tasks number of purge tasks to submit to the queue +@param history_size trx_sys.history_size() +@param truncate whether to truncate the history at the end of the batch @return number of undo log pages handled in the batch */ -ulint trx_purge(ulint n_tasks, bool truncate); +ulint trx_purge(ulint n_tasks, ulint history_size, bool truncate); /** Rollback segements from a given transaction with trx-no scheduled for purge. */ @@ -61,7 +57,7 @@ class TrxUndoRsegs { typedef trx_rsegs_t::iterator iterator; typedef trx_rsegs_t::const_iterator const_iterator; - TrxUndoRsegs() {} + TrxUndoRsegs() = default; /** Constructor */ TrxUndoRsegs(trx_rseg_t& rseg) @@ -125,9 +121,10 @@ class purge_sys_t { public: /** latch protecting view, m_enabled */ - MY_ALIGNED(CACHE_LINE_SIZE) mutable srw_spin_lock latch; + alignas(CPU_LEVEL1_DCACHE_LINESIZE) mutable srw_spin_lock latch; private: - /** The purge will not remove undo logs which are >= this view */ + /** Read view at the start of a purge batch. Any encountered index records + that are older than view will be removed. */ ReadViewBase view; /** whether purge is enabled; protected by latch and std::atomic */ std::atomic m_enabled; @@ -137,6 +134,12 @@ class purge_sys_t Atomic_counter m_SYS_paused; /** number of stop_FTS() calls without resume_FTS() */ Atomic_counter m_FTS_paused; + + /** latch protecting end_view */ + alignas(CPU_LEVEL1_DCACHE_LINESIZE) srw_spin_lock_low end_latch; + /** Read view at the end of a purge batch (copied from view). Any undo pages + containing records older than end_view may be freed. */ + ReadViewBase end_view; public: que_t* query; /*!< The query graph which will do the parallelized purge operation */ @@ -265,32 +268,81 @@ class purge_sys_t /** check stop_SYS() */ void check_stop_FTS() { if (must_wait_FTS()) wait_FTS(); } - /** A wrapper around ReadView::changes_visible(). */ - bool changes_visible(trx_id_t id, const table_name_t &name) const - { - return view.changes_visible(id, name); - } + /** Determine if the history of a transaction is purgeable. + @param trx_id transaction identifier + @return whether the history is purgeable */ + TRANSACTIONAL_TARGET bool is_purgeable(trx_id_t trx_id) const; + /** A wrapper around ReadView::low_limit_no(). */ trx_id_t low_limit_no() const { - /* MDEV-22718 FIXME: We are not holding latch here! */ + /* This function may only be called by purge_coordinator_callback(). + + The purge coordinator task may call this without holding any latch, + because it is the only thread that may modify purge_sys.view. + + Any other threads that access purge_sys.view must hold purge_sys.latch, + typically via purge_sys_t::view_guard. */ return view.low_limit_no(); } /** A wrapper around trx_sys_t::clone_oldest_view(). */ + template void clone_oldest_view() { latch.wr_lock(SRW_LOCK_CALL); trx_sys.clone_oldest_view(&view); + if (also_end_view) + (end_view= view). + clamp_low_limit_id(head.trx_no ? head.trx_no : tail.trx_no); latch.wr_unlock(); } + /** Update end_view at the end of a purge batch. */ + inline void clone_end_view(); + + struct view_guard + { + inline view_guard(); + inline ~view_guard(); + + /** @return purge_sys.view */ + inline const ReadViewBase &view() const; + }; + + struct end_view_guard + { + inline end_view_guard(); + inline ~end_view_guard(); + + /** @return purge_sys.end_view */ + inline const ReadViewBase &view() const; + }; + /** Stop the purge thread and check n_ref_count of all auxiliary and common table associated with the fts table. - @param table parent FTS table */ - void stop_FTS(const dict_table_t &table); + @param table parent FTS table + @param already_stopped True indicates purge threads were + already stopped */ + void stop_FTS(const dict_table_t &table, bool already_stopped=false); }; /** The global data structure coordinating a purge */ extern purge_sys_t purge_sys; -#endif /* trx0purge_h */ +purge_sys_t::view_guard::view_guard() +{ purge_sys.latch.rd_lock(SRW_LOCK_CALL); } + +purge_sys_t::view_guard::~view_guard() +{ purge_sys.latch.rd_unlock(); } + +const ReadViewBase &purge_sys_t::view_guard::view() const +{ return purge_sys.view; } + +purge_sys_t::end_view_guard::end_view_guard() +{ purge_sys.end_latch.rd_lock(); } + +purge_sys_t::end_view_guard::~end_view_guard() +{ purge_sys.end_latch.rd_unlock(); } + +const ReadViewBase &purge_sys_t::end_view_guard::view() const +{ return purge_sys.end_view; } diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h index 5c7e468b93681..bb348d7ef8b53 100644 --- a/storage/innobase/include/trx0rec.h +++ b/storage/innobase/include/trx0rec.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -24,8 +24,7 @@ Transaction undo log record Created 3/26/1996 Heikki Tuuri *******************************************************/ -#ifndef trx0rec_h -#define trx0rec_h +#pragma once #include "trx0types.h" #include "row0types.h" @@ -37,29 +36,31 @@ Created 3/26/1996 Heikki Tuuri /***********************************************************************//** Copies the undo record to the heap. -@return own: copy of undo log record */ -UNIV_INLINE -trx_undo_rec_t* -trx_undo_rec_copy( -/*==============*/ - const trx_undo_rec_t* undo_rec, /*!< in: undo log record */ - mem_heap_t* heap); /*!< in: heap where copied */ -/**********************************************************************//** -Reads the undo log record type. -@return record type */ -UNIV_INLINE -ulint -trx_undo_rec_get_type( -/*==================*/ - const trx_undo_rec_t* undo_rec); /*!< in: undo log record */ +@param undo_rec record in an undo log page +@param heap memory heap +@return copy of undo_rec +@retval nullptr if the undo log record is corrupted */ +inline trx_undo_rec_t* trx_undo_rec_copy(const trx_undo_rec_t *undo_rec, + mem_heap_t *heap) +{ + const size_t offset= ut_align_offset(undo_rec, srv_page_size); + const size_t end= mach_read_from_2(undo_rec); + if (end <= offset || end >= srv_page_size - FIL_PAGE_DATA_END) + return nullptr; + const size_t len= end - offset; + trx_undo_rec_t *rec= static_cast + (mem_heap_dup(heap, undo_rec, len)); + mach_write_to_2(rec, len); + return rec; +} + /**********************************************************************//** Reads the undo log record number. @return undo no */ -UNIV_INLINE -undo_no_t -trx_undo_rec_get_undo_no( -/*=====================*/ - const trx_undo_rec_t* undo_rec); /*!< in: undo log record */ +inline undo_no_t trx_undo_rec_get_undo_no(const trx_undo_rec_t *undo_rec) +{ + return mach_u64_read_much_compressed(undo_rec + 3); +} /**********************************************************************//** Returns the start of the undo record data area. */ @@ -69,10 +70,10 @@ Returns the start of the undo record data area. */ /**********************************************************************//** Reads from an undo log record the general parameters. @return remaining part of undo log record after reading these values */ -byte* +const byte* trx_undo_rec_get_pars( /*==================*/ - trx_undo_rec_t* undo_rec, /*!< in: undo log record */ + const trx_undo_rec_t* undo_rec, /*!< in: undo log record */ ulint* type, /*!< out: undo record type: TRX_UNDO_INSERT_REC, ... */ ulint* cmpl_info, /*!< out: compiler info, relevant only @@ -82,13 +83,14 @@ trx_undo_rec_get_pars( undo_no_t* undo_no, /*!< out: undo log record number */ table_id_t* table_id) /*!< out: table id */ MY_ATTRIBUTE((nonnull)); + /*******************************************************************//** Builds a row reference from an undo log record. @return pointer to remaining part of undo record */ -byte* +const byte* trx_undo_rec_get_row_ref( /*=====================*/ - byte* ptr, /*!< in: remaining part of a copy of an undo log + const byte* ptr, /*!< in: remaining part of a copy of an undo log record, at the start of the row reference; NOTE that this copy of the undo log record must be preserved as long as the row reference is @@ -96,8 +98,9 @@ trx_undo_rec_get_row_ref( record! */ dict_index_t* index, /*!< in: clustered index */ const dtuple_t**ref, /*!< out, own: row reference */ - mem_heap_t* heap); /*!< in: memory heap from which the memory + mem_heap_t* heap) /*!< in: memory heap from which the memory needed is allocated */ + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Reads from an undo log update record the system field values of the old version. @@ -136,30 +139,6 @@ trx_undo_update_rec_get_update( mem_heap_t* heap, /*!< in: memory heap from which the memory needed is allocated */ upd_t** upd); /*!< out, own: update vector */ -/*******************************************************************//** -Builds a partial row from an update undo log record, for purge. -It contains the columns which occur as ordering in any index of the table. -Any missing columns are indicated by col->mtype == DATA_MISSING. -@return pointer to remaining part of undo record */ -byte* -trx_undo_rec_get_partial_row( -/*=========================*/ - const byte* ptr, /*!< in: remaining part in update undo log - record of a suitable type, at the start of - the stored index columns; - NOTE that this copy of the undo log record must - be preserved as long as the partial row is - used, as we do NOT copy the data in the - record! */ - dict_index_t* index, /*!< in: clustered index */ - const upd_t* update, /*!< in: updated columns */ - dtuple_t** row, /*!< out, own: partial row */ - ibool ignore_prefix, /*!< in: flag to indicate if we - expect blob prefixes in undo. Used - only in the assertion. */ - mem_heap_t* heap) /*!< in: memory heap from which the memory - needed is allocated */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Report a RENAME TABLE operation. @param[in,out] trx transaction @param[in] table table that is being renamed @@ -202,53 +181,59 @@ trx_undo_report_row_operation( is being called purge view and we would like to get the purge record even it is in the purge view (in normal case, it will return without fetching the purge record */ -#define TRX_UNDO_PREV_IN_PURGE 0x1 +static constexpr ulint TRX_UNDO_PREV_IN_PURGE = 1; /** This tells trx_undo_prev_version_build() to fetch the old value in the undo log (which is the after image for an update) */ -#define TRX_UNDO_GET_OLD_V_VALUE 0x2 +static constexpr ulint TRX_UNDO_GET_OLD_V_VALUE = 2; -/*******************************************************************//** -Build a previous version of a clustered index record. The caller must -hold a latch on the index page of the clustered index record. -@retval true if previous version was built, or if it was an insert -or the table has been rebuilt -@retval false if the previous version is earlier than purge_view, -which means that it may have been removed */ -bool +/** indicate a call from row_vers_old_has_index_entry() */ +static constexpr ulint TRX_UNDO_CHECK_PURGEABILITY = 4; + +/** Build a previous version of a clustered index record. The caller +must hold a latch on the index page of the clustered index record. +@param rec version of a clustered index record +@param index clustered index +@param offsets rec_get_offsets(rec, index) +@param heap memory heap from which the memory needed is + allocated +@param old_vers previous version or NULL if rec is the + first inserted version, or if history data + has been deleted (an error), or if the purge + could have removed the version + though it has not yet done so +@param v_heap memory heap used to create vrow + dtuple if it is not yet created. This heap + diffs from "heap" above in that it could be + prebuilt->old_vers_heap for selection +@param vrow virtual column info, if any +@param v_status status determine if it is going into this + function by purge thread or not. + And if we read "after image" of undo log +@return error code +@retval DB_SUCCESS if previous version was successfully built, +or if it was an insert or the undo record refers to the table before rebuild +@retval DB_MISSING_HISTORY if the history is missing */ +dberr_t trx_undo_prev_version_build( -/*========================*/ - const rec_t* index_rec,/*!< in: clustered index record in the - index tree */ - mtr_t* index_mtr,/*!< in: mtr which contains the latch to - index_rec page and purge_view */ - const rec_t* rec, /*!< in: version of a clustered index record */ - dict_index_t* index, /*!< in: clustered index */ - rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */ - mem_heap_t* heap, /*!< in: memory heap from which the memory - needed is allocated */ - rec_t** old_vers,/*!< out, own: previous version, or NULL if - rec is the first inserted version, or if - history data has been deleted */ - mem_heap_t* v_heap, /* !< in: memory heap used to create vrow - dtuple if it is not yet created. This heap - diffs from "heap" above in that it could be - prebuilt->old_vers_heap for selection */ - dtuple_t** vrow, /*!< out: virtual column info, if any */ + const rec_t *rec, + dict_index_t *index, + rec_offs *offsets, + mem_heap_t *heap, + rec_t **old_vers, + mem_heap_t *v_heap, + dtuple_t **vrow, ulint v_status); - /*!< in: status determine if it is going - into this function by purge thread or not. - And if we read "after image" of undo log */ /** Read from an undo log record a non-virtual column value. -@param[in,out] ptr pointer to remaining part of the undo record -@param[in,out] field stored field -@param[in,out] len length of the field, or UNIV_SQL_NULL -@param[in,out] orig_len original length of the locally stored part +@param ptr pointer to remaining part of the undo record +@param field stored field +@param len length of the field, or UNIV_SQL_NULL +@param orig_len original length of the locally stored part of an externally stored column, or 0 @return remaining part of undo log record after reading these values */ -byte *trx_undo_rec_get_col_val(const byte *ptr, const byte **field, - uint32_t *len, uint32_t *orig_len); +const byte *trx_undo_rec_get_col_val(const byte *ptr, const byte **field, + uint32_t *len, uint32_t *orig_len); /** Read virtual column value from undo log @param[in] table the table @@ -335,7 +320,3 @@ inline table_id_t trx_undo_rec_get_table_id(const trx_undo_rec_t *rec) mach_read_next_much_compressed(&rec); return mach_read_next_much_compressed(&rec); } - -#include "trx0rec.ic" - -#endif /* trx0rec_h */ diff --git a/storage/innobase/include/trx0rec.ic b/storage/innobase/include/trx0rec.ic deleted file mode 100644 index 02244d68b6fc8..0000000000000 --- a/storage/innobase/include/trx0rec.ic +++ /dev/null @@ -1,73 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1996, 2014, 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 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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/trx0rec.ic -Transaction undo log record - -Created 3/26/1996 Heikki Tuuri -*******************************************************/ - -/**********************************************************************//** -Reads from an undo log record the record type. -@return record type */ -UNIV_INLINE -ulint -trx_undo_rec_get_type( -/*==================*/ - const trx_undo_rec_t* undo_rec) /*!< in: undo log record */ -{ - return(mach_read_from_1(undo_rec + 2) & (TRX_UNDO_CMPL_INFO_MULT - 1)); -} - -/**********************************************************************//** -Reads the undo log record number. -@return undo no */ -UNIV_INLINE -undo_no_t -trx_undo_rec_get_undo_no( -/*=====================*/ - const trx_undo_rec_t* undo_rec) /*!< in: undo log record */ -{ - const byte* ptr; - - ptr = undo_rec + 3; - - return(mach_u64_read_much_compressed(ptr)); -} - -/***********************************************************************//** -Copies the undo record to the heap. -@return own: copy of undo log record */ -UNIV_INLINE -trx_undo_rec_t* -trx_undo_rec_copy( -/*==============*/ - const trx_undo_rec_t* undo_rec, /*!< in: undo log record */ - mem_heap_t* heap) /*!< in: heap where copied */ -{ - ulint len; - - len = mach_read_from_2(undo_rec) - - ut_align_offset(undo_rec, srv_page_size); - ut_ad(len < srv_page_size); - trx_undo_rec_t* rec = static_cast( - mem_heap_dup(heap, undo_rec, len)); - mach_write_to_2(rec, len); - return rec; -} diff --git a/storage/innobase/include/trx0rseg.h b/storage/innobase/include/trx0rseg.h index a9bcb0c3d51a4..1d95b7d2e7a73 100644 --- a/storage/innobase/include/trx0rseg.h +++ b/storage/innobase/include/trx0rseg.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -27,40 +27,25 @@ Created 3/26/1996 Heikki Tuuri #pragma once #include "trx0types.h" #include "fut0lst.h" -#ifdef WITH_WSREP -# include "trx0xa.h" -#endif /* WITH_WSREP */ - -/** Gets a rollback segment header. -@param[in] space space where placed -@param[in] page_no page number of the header -@param[in,out] mtr mini-transaction -@return rollback segment header, page x-latched */ -UNIV_INLINE -buf_block_t* -trx_rsegf_get(fil_space_t* space, uint32_t page_no, mtr_t* mtr); /** Create a rollback segment header. -@param[in,out] space system, undo, or temporary tablespace -@param[in] rseg_id rollback segment identifier -@param[in] max_trx_id new value of TRX_RSEG_MAX_TRX_ID -@param[in,out] sys_header the TRX_SYS page (NULL for temporary rseg) -@param[in,out] mtr mini-transaction +@param[in,out] space system, undo, or temporary tablespace +@param[in] rseg_id rollback segment identifier +@param[in] max_trx_id new value of TRX_RSEG_MAX_TRX_ID +@param[in,out] mtr mini-transaction +@param[out] err error code @return the created rollback segment -@retval NULL on failure */ -buf_block_t* -trx_rseg_header_create( - fil_space_t* space, - ulint rseg_id, - trx_id_t max_trx_id, - buf_block_t* sys_header, - mtr_t* mtr); +@retval nullptr on failure */ +buf_block_t *trx_rseg_header_create(fil_space_t *space, ulint rseg_id, + trx_id_t max_trx_id, mtr_t *mtr, + dberr_t *err) + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Initialize or recover the rollback segments at startup. */ dberr_t trx_rseg_array_init(); /** Create the temporary rollback segments. */ -void trx_temp_rseg_create(); +dberr_t trx_temp_rseg_create(mtr_t *mtr); /* Number of undo log slots in a rollback segment file copy */ #define TRX_RSEG_N_SLOTS (srv_page_size / 16) @@ -69,64 +54,55 @@ void trx_temp_rseg_create(); #define TRX_RSEG_MAX_N_TRXS (TRX_RSEG_N_SLOTS / 2) /** The rollback segment memory object */ -struct MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) trx_rseg_t +struct alignas(CPU_LEVEL1_DCACHE_LINESIZE) trx_rseg_t { /** tablespace containing the rollback segment; constant after init() */ fil_space_t *space; /** latch protecting everything except page_no, space */ - srw_spin_lock_low latch; + srw_spin_lock latch; /** rollback segment header page number; constant after init() */ uint32_t page_no; /** length of the TRX_RSEG_HISTORY list (number of transactions) */ uint32_t history_size; + /** Last known transaction that has not been purged yet, + or 0 if everything has been purged. */ + trx_id_t needs_purge; + private: - /** Reference counter to track rseg allocated transactions, - with SKIP and NEEDS_PURGE flags. */ + /** Reference counter to track is_persistent() transactions, + with SKIP flag. */ std::atomic ref; /** Whether undo tablespace truncation is pending */ static constexpr uint32_t SKIP= 1; - /** Whether the log segment needs purge */ - static constexpr uint32_t NEEDS_PURGE= 2; /** Transaction reference count multiplier */ - static constexpr uint32_t REF= 4; + static constexpr uint32_t REF= 2; uint32_t ref_load() const { return ref.load(std::memory_order_relaxed); } - /** Set a bit in ref */ - template void ref_set() + /** Set the SKIP bit */ + void ref_set_skip() { - static_assert(SKIP == 1U << 0, "compatibility"); - static_assert(NEEDS_PURGE == 1U << 1, "compatibility"); + static_assert(SKIP == 1U, "compatibility"); #if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - if (needs_purge) - __asm__ __volatile__("lock btsl $1, %0" : "+m" (ref)); - else - __asm__ __volatile__("lock btsl $0, %0" : "+m" (ref)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_IX64) - _interlockedbittestandset(reinterpret_cast(&ref), - needs_purge); + __asm__ __volatile__("lock btsl $0, %0" : "+m" (ref)); +#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) + _interlockedbittestandset(reinterpret_cast(&ref), 0); #else - ref.fetch_or(needs_purge ? NEEDS_PURGE : SKIP, std::memory_order_relaxed); + ref.fetch_or(SKIP, std::memory_order_relaxed); #endif } /** Clear a bit in ref */ - template void ref_reset() + void ref_reset_skip() { - static_assert(SKIP == 1U << 0, "compatibility"); - static_assert(NEEDS_PURGE == 1U << 1, "compatibility"); + static_assert(SKIP == 1U, "compatibility"); #if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - if (needs_purge) - __asm__ __volatile__("lock btrl $1, %0" : "+m" (ref)); - else - __asm__ __volatile__("lock btrl $0, %0" : "+m" (ref)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_IX64) - _interlockedbittestandreset(reinterpret_cast(&ref), - needs_purge); + __asm__ __volatile__("lock btrl $0, %0" : "+m" (ref)); +#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) + _interlockedbittestandreset(reinterpret_cast(&ref), 0); #else - ref.fetch_and(needs_purge ? ~NEEDS_PURGE : ~SKIP, - std::memory_order_relaxed); + ref.fetch_and(~SKIP, std::memory_order_relaxed); #endif } @@ -140,26 +116,21 @@ struct MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) trx_rseg_t void destroy(); /** Note that undo tablespace truncation was started. */ - void set_skip_allocation() { ut_ad(is_persistent()); ref_set(); } + void set_skip_allocation() { ut_ad(is_persistent()); ref_set_skip(); } /** Note that undo tablespace truncation was completed. */ void clear_skip_allocation() { ut_ad(is_persistent()); #if defined DBUG_OFF - ref_reset(); + ref_reset_skip(); #else ut_d(auto r=) ref.fetch_and(~SKIP, std::memory_order_relaxed); ut_ad(r == SKIP); #endif } - /** Note that the rollback segment requires purge. */ - void set_needs_purge() { ref_set(); } - /** Note that the rollback segment will not require purge. */ - void clear_needs_purge() { ref_reset(); } /** @return whether the segment is marked for undo truncation */ - bool skip_allocation() const { return ref_load() & SKIP; } - /** @return whether the segment needs purge */ - bool needs_purge() const { return ref_load() & NEEDS_PURGE; } + bool skip_allocation() const + { return ref.load(std::memory_order_acquire) & SKIP; } /** Increment the reference count */ void acquire() { ut_d(auto r=) ref.fetch_add(REF); ut_ad(!(r & SKIP)); } @@ -213,6 +184,12 @@ struct MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) trx_rseg_t last_commit_and_offset= static_cast(last_offset) << 48 | trx_no; } + /** @return the page identifier */ + page_id_t page_id() const { return page_id_t{space->id, page_no}; } + + /** @return the rollback segment header page, exclusively latched */ + buf_block_t *get(mtr_t *mtr, dberr_t *err) const; + /** @return whether the rollback segment is persistent */ bool is_persistent() const { @@ -268,32 +245,8 @@ If no binlog information is present, the first byte is NUL. */ #define TRX_RSEG_BINLOG_NAME_LEN 512 #ifdef WITH_WSREP -/** The offset to WSREP XID headers */ -#define TRX_RSEG_WSREP_XID_INFO TRX_RSEG_MAX_TRX_ID + 16 + 512 - -/** WSREP XID format (1 if present and valid, 0 if not present) */ -#define TRX_RSEG_WSREP_XID_FORMAT TRX_RSEG_WSREP_XID_INFO -/** WSREP XID GTRID length */ -#define TRX_RSEG_WSREP_XID_GTRID_LEN TRX_RSEG_WSREP_XID_INFO + 4 -/** WSREP XID bqual length */ -#define TRX_RSEG_WSREP_XID_BQUAL_LEN TRX_RSEG_WSREP_XID_INFO + 8 -/** WSREP XID data (XIDDATASIZE bytes) */ -#define TRX_RSEG_WSREP_XID_DATA TRX_RSEG_WSREP_XID_INFO + 12 -#endif /* WITH_WSREP*/ - -/*-------------------------------------------------------------*/ - -/** Read the page number of an undo log slot. -@param[in] rseg_header rollback segment header -@param[in] n slot number */ -inline uint32_t trx_rsegf_get_nth_undo(const buf_block_t *rseg_header, ulint n) -{ - ut_ad(n < TRX_RSEG_N_SLOTS); - return mach_read_from_4(TRX_RSEG + TRX_RSEG_UNDO_SLOTS + - n * TRX_RSEG_SLOT_SIZE + rseg_header->page.frame); -} +# include "trx0xa.h" -#ifdef WITH_WSREP /** Update the WSREP XID information in rollback segment header. @param[in,out] rseg_header rollback segment header @param[in] xid WSREP XID @@ -319,6 +272,16 @@ void trx_rseg_update_wsrep_checkpoint(const XID* xid); bool trx_rseg_read_wsrep_checkpoint(XID& xid); #endif /* WITH_WSREP */ +/** Read the page number of an undo log slot. +@param[in] rseg_header rollback segment header +@param[in] n slot number */ +inline uint32_t trx_rsegf_get_nth_undo(const buf_block_t *rseg_header, ulint n) +{ + ut_ad(n < TRX_RSEG_N_SLOTS); + return mach_read_from_4(TRX_RSEG + TRX_RSEG_UNDO_SLOTS + + n * TRX_RSEG_SLOT_SIZE + rseg_header->page.frame); +} + /** Upgrade a rollback segment header page to MariaDB 10.3 format. @param[in,out] rseg_header rollback segment header page @param[in,out] mtr mini-transaction */ @@ -333,5 +296,3 @@ up to which replication has proceeded. @param[in,out] mtr mini-transaction */ void trx_rseg_update_binlog_offset(buf_block_t *rseg_header, const trx_t *trx, mtr_t *mtr); - -#include "trx0rseg.ic" diff --git a/storage/innobase/include/trx0rseg.ic b/storage/innobase/include/trx0rseg.ic deleted file mode 100644 index af63d6acbf2d1..0000000000000 --- a/storage/innobase/include/trx0rseg.ic +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, 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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/trx0rseg.ic -Rollback segment - -Created 3/26/1996 Heikki Tuuri -*******************************************************/ - -#include "srv0srv.h" -#include "mtr0log.h" - -/** Gets a rollback segment header. -@param[in] space space where placed -@param[in] page_no page number of the header -@param[in,out] mtr mini-transaction -@return rollback segment header, page x-latched */ -UNIV_INLINE -buf_block_t* -trx_rsegf_get(fil_space_t* space, uint32_t page_no, mtr_t* mtr) -{ - ut_ad(space == fil_system.sys_space || space == fil_system.temp_space - || srv_is_undo_tablespace(space->id) - || !srv_was_started); - - return buf_page_get(page_id_t(space->id, page_no), - 0, RW_X_LATCH, mtr); -} diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h index cbac3fd3a94da..245b981974b61 100644 --- a/storage/innobase/include/trx0sys.h +++ b/storage/innobase/include/trx0sys.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -40,7 +40,6 @@ Created 3/26/1996 Heikki Tuuri #ifdef UNIV_PFS_MUTEX extern mysql_pfs_key_t trx_sys_mutex_key; -extern mysql_pfs_key_t rw_trx_hash_element_mutex_key; #endif /** Checks if a page address is the trx sys header page. @@ -53,9 +52,8 @@ inline bool trx_sys_hdr_page(const page_id_t page_id) /*****************************************************************//** Creates and initializes the transaction system at the database creation. */ -void -trx_sys_create_sys_pages(void); -/*==========================*/ +dberr_t trx_sys_create_sys_pages(mtr_t *mtr); + /** Find an available rollback segment. @param[in] sys_header @return an unallocated rollback segment slot in the TRX_SYS header @@ -132,9 +130,6 @@ trx_sys_print_mysql_binlog_offset(); bool trx_sys_create_rsegs(); -/** The automatically created system rollback segment has this id */ -#define TRX_SYS_SYSTEM_RSEG_ID 0 - /** The offset of the transaction system header on the page */ #define TRX_SYS FSEG_PAGE_DATA @@ -335,16 +330,14 @@ trx_t* current_trx(); struct rw_trx_hash_element_t { - rw_trx_hash_element_t(): trx(0) + rw_trx_hash_element_t() { - mysql_mutex_init(rw_trx_hash_element_mutex_key, &mutex, nullptr); + memset(reinterpret_cast(this), 0, sizeof *this); + mutex.init(); } - ~rw_trx_hash_element_t() - { - mysql_mutex_destroy(&mutex); - } + ~rw_trx_hash_element_t() { mutex.destroy(); } trx_id_t id; /* lf_hash_init() relies on this to be first in the struct */ @@ -357,7 +350,7 @@ struct rw_trx_hash_element_t */ Atomic_counter no; trx_t *trx; - mysql_mutex_t mutex; + srw_mutex mutex; }; @@ -526,10 +519,11 @@ class rw_trx_hash_t static my_bool debug_iterator(rw_trx_hash_element_t *element, debug_iterator_arg *arg) { - mysql_mutex_lock(&element->mutex); + element->mutex.wr_lock(); if (element->trx) validate_element(element->trx); - mysql_mutex_unlock(&element->mutex); + element->mutex.wr_unlock(); + ut_ad(element->id < element->no); return arg->action(element, arg->argument); } #endif @@ -631,7 +625,7 @@ class rw_trx_hash_t sizeof(trx_id_t))); if (element) { - mysql_mutex_lock(&element->mutex); + element->mutex.wr_lock(); lf_hash_search_unpin(pins); if ((trx= element->trx)) { DBUG_ASSERT(trx_id == trx->id); @@ -652,7 +646,7 @@ class rw_trx_hash_t trx->reference(); } } - mysql_mutex_unlock(&element->mutex); + element->mutex.wr_unlock(); } if (!caller_trx) lf_hash_put_pins(pins); @@ -686,9 +680,9 @@ class rw_trx_hash_t void erase(trx_t *trx) { ut_d(validate_element(trx)); - mysql_mutex_lock(&trx->rw_trx_hash_element->mutex); - trx->rw_trx_hash_element->trx= 0; - mysql_mutex_unlock(&trx->rw_trx_hash_element->mutex); + trx->rw_trx_hash_element->mutex.wr_lock(); + trx->rw_trx_hash_element->trx= nullptr; + trx->rw_trx_hash_element->mutex.wr_unlock(); int res= lf_hash_delete(&hash, get_pins(trx), reinterpret_cast(&trx->id), sizeof(trx_id_t)); @@ -722,12 +716,12 @@ class rw_trx_hash_t May return element with committed transaction. If caller doesn't like to see committed transactions, it has to skip those under element mutex: - mysql_mutex_lock(&element->mutex); + element->mutex.wr_lock(); if (trx_t trx= element->trx) { // trx is protected against commit in this branch } - mysql_mutex_unlock(&element->mutex); + element->mutex.wr_unlock(); May miss concurrently inserted transactions. @@ -833,8 +827,8 @@ class thread_safe_trx_ilist_t void unfreeze() const { mysql_mutex_unlock(&mutex); } private: - alignas(CACHE_LINE_SIZE) mutable mysql_mutex_t mutex; - alignas(CACHE_LINE_SIZE) ilist trx_list; + alignas(CPU_LEVEL1_DCACHE_LINESIZE) mutable mysql_mutex_t mutex; + alignas(CPU_LEVEL1_DCACHE_LINESIZE) ilist trx_list; }; /** The transaction system central memory data structure. */ @@ -844,7 +838,7 @@ class trx_sys_t The smallest number not yet assigned as a transaction id or transaction number. Accessed and updated with atomic operations. */ - MY_ALIGNED(CACHE_LINE_SIZE) Atomic_counter m_max_trx_id; + alignas(CPU_LEVEL1_DCACHE_LINESIZE) Atomic_counter m_max_trx_id; /** @@ -855,7 +849,8 @@ class trx_sys_t @sa assign_new_trx_no() @sa snapshot_ids() */ - MY_ALIGNED(CACHE_LINE_SIZE) std::atomic m_rw_trx_hash_version; + alignas(CPU_LEVEL1_DCACHE_LINESIZE) + std::atomic m_rw_trx_hash_version; bool m_initialised; @@ -875,7 +870,7 @@ class trx_sys_t Works faster when it is on it's own cache line (tested). */ - MY_ALIGNED(CACHE_LINE_SIZE) rw_trx_hash_t rw_trx_hash; + alignas(CPU_LEVEL1_DCACHE_LINESIZE) rw_trx_hash_t rw_trx_hash; #ifdef WITH_WSREP @@ -903,7 +898,7 @@ class trx_sys_t /** @return TRX_RSEG_HISTORY length (number of committed transactions to purge) */ - uint32_t history_size(); + size_t history_size(); /** @@ -911,13 +906,13 @@ class trx_sys_t @param threshold number of committed transactions @return whether TRX_RSEG_HISTORY length exceeds the threshold */ - bool history_exceeds(uint32_t threshold); + bool history_exceeds(size_t threshold); /** @return approximate history_size(), without latch protection */ - TPOOL_SUPPRESS_TSAN uint32_t history_size_approx() const; + TPOOL_SUPPRESS_TSAN size_t history_size_approx() const; /** @@ -927,20 +922,21 @@ class trx_sys_t /** - Returns the minimum trx id in rw trx list. + Determine if the specified transaction or any older one might be active. - This is the smallest id for which the trx can possibly be active. (But, you - must look at the trx->state to find out if the minimum trx id transaction - itself is active, or already committed.) - - @return the minimum trx id, or m_max_trx_id if the trx list is empty + @param trx current transaction + @param id transaction identifier + @return whether any transaction not newer than id might be active */ - trx_id_t get_min_trx_id() + bool find_same_or_older(trx_t *trx, trx_id_t id) { - trx_id_t id= get_max_trx_id(); - rw_trx_hash.iterate(get_min_trx_id_callback, &id); - return id; + if (trx->max_inactive_id >= id) + return false; + bool found= rw_trx_hash.iterate(trx, find_same_or_older_callback, &id); + if (!found) + trx->max_inactive_id= id; + return found; } @@ -1175,18 +1171,10 @@ class trx_sys_t } private: - static my_bool get_min_trx_id_callback(rw_trx_hash_element_t *element, - trx_id_t *id) + static my_bool find_same_or_older_callback(rw_trx_hash_element_t *element, + trx_id_t *id) { - if (element->id < *id) - { - mysql_mutex_lock(&element->mutex); - /* We don't care about read-only transactions here. */ - if (element->trx && element->trx->rsegs.m_redo.rseg) - *id= element->id; - mysql_mutex_unlock(&element->mutex); - } - return 0; + return element->id <= *id; } diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 33ed9aeb25ca7..152e794ac6ae7 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2021, MariaDB Corporation. +Copyright (c) 2015, 2022, 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 @@ -339,27 +339,11 @@ struct trx_lock_t /** lock wait start time */ Atomic_relaxed suspend_time; +#if defined(UNIV_DEBUG) || !defined(DBUG_OFF) /** 2=high priority WSREP thread has marked this trx to abort; 1=another transaction chose this as a victim in deadlock resolution. */ Atomic_relaxed was_chosen_as_deadlock_victim; - /** Clear the deadlock victim status. */ - void clear_deadlock_victim() - { -#ifndef WITH_WSREP - was_chosen_as_deadlock_victim= false; -#elif defined __GNUC__ && (defined __i386__ || defined __x86_64__) - /* There is no 8-bit version of the 80386 BTR instruction. - Technically, this is the wrong addressing mode (16-bit), but - there are other data members stored after the byte. */ - __asm__ __volatile__("lock btrw $0, %0" - : "+m" (was_chosen_as_deadlock_victim)); -#else - was_chosen_as_deadlock_victim.fetch_and(byte(~1)); -#endif - } - -#ifdef WITH_WSREP /** Flag the lock owner as a victim in Galera conflict resolution. */ void set_wsrep_victim() { @@ -373,7 +357,17 @@ struct trx_lock_t was_chosen_as_deadlock_victim.fetch_or(2); # endif } -#endif +#else /* defined(UNIV_DEBUG) || !defined(DBUG_OFF) */ + + /** High priority WSREP thread has marked this trx to abort or + another transaction chose this as a victim in deadlock resolution. */ + Atomic_relaxed was_chosen_as_deadlock_victim; + + /** Flag the lock owner as a victim in Galera conflict resolution. */ + void set_wsrep_victim() { + was_chosen_as_deadlock_victim= true; + } +#endif /* defined(UNIV_DEBUG) || !defined(DBUG_OFF) */ /** Next available rec_pool[] entry */ byte rec_cached; @@ -388,13 +382,13 @@ struct trx_lock_t only be modified by the thread that is serving the running transaction. */ - /** Pre-allocated record locks */ - struct { - ib_lock_t lock; byte pad[256]; - } rec_pool[8]; + /** Pre-allocated record locks */ + struct { + alignas(CPU_LEVEL1_DCACHE_LINESIZE) ib_lock_t lock; + } rec_pool[8]; - /** Pre-allocated table locks */ - ib_lock_t table_pool[8]; + /** Pre-allocated table locks */ + ib_lock_t table_pool[8]; /** Memory heap for trx_locks. Protected by lock_sys.assert_locked() and lock_sys.is_writer() || trx->mutex_is_owner(). */ @@ -436,9 +430,15 @@ class trx_mod_table_time_t /** First modification of a system versioned column (NONE= no versioning, BULK= the table was dropped) */ undo_no_t first_versioned= NONE; +#ifdef UNIV_DEBUG + /** Whether the modified table is a FTS auxiliary table */ + bool fts_aux_table= false; +#endif /* UNIV_DEBUG */ /** Buffer to store insert opertion */ row_merge_bulk_t *bulk_store= nullptr; + + friend struct trx_t; public: /** Constructor @param rows number of modified rows so far */ @@ -500,6 +500,19 @@ class trx_mod_table_time_t return false; } +#ifdef UNIV_DEBUG + void set_aux_table() { fts_aux_table= true; } + + bool is_aux_table() const { return fts_aux_table; } +#endif /* UNIV_DEBUG */ + + /** @return the first undo record that modified the table */ + undo_no_t get_first() const + { + ut_ad(valid()); + return LIMIT & first; + } + /** Add the tuple to the transaction bulk buffer for the given index. @param entry tuple to be inserted @param index bulk insert for the index @@ -512,22 +525,12 @@ class trx_mod_table_time_t /** Do bulk insert operation present in the buffered operation @return DB_SUCCESS or error code */ - dberr_t write_bulk(dict_table_t *table, trx_t *trx) - { - if (!bulk_store) - return DB_SUCCESS; - dberr_t err= bulk_store->write_to_table(table, trx); - delete bulk_store; - bulk_store= nullptr; - return err; - } + dberr_t write_bulk(dict_table_t *table, trx_t *trx); /** @return whether the buffer storage exist */ - bool bulk_buffer_exist() + bool bulk_buffer_exist() const { - if (is_bulk_insert() && bulk_store) - return true; - return false; + return bulk_store && is_bulk_insert(); } }; @@ -562,7 +565,7 @@ no longer be associated with a session when the server is restarted. A session may be served by at most one thread at a time. The serving thread of a session might change in some MySQL implementations. -Therefore we do not have os_thread_get_curr_id() assertions in the code. +Therefore we do not have pthread_self() assertions in the code. Normally, only the thread that is currently associated with a running transaction may access (read and modify) the trx object, and it may do @@ -616,14 +619,20 @@ struct trx_t : ilist_node<> { private: /** - Count of references. + Least significant 31 bits is count of references. We can't release the locks nor commit the transaction until this reference is 0. We can change the state to TRX_STATE_COMMITTED_IN_MEMORY to signify that it is no longer "active". - */ - Atomic_counter n_ref; + If the most significant bit is set this transaction should stop inheriting + (GAP)locks. Generally set to true during transaction prepare for RC or lower + isolation, if requested. Needed for replication replay where + we don't want to get blocked on GAP locks taken for protecting + concurrent unique insert or replace operation. + */ + alignas(CPU_LEVEL1_DCACHE_LINESIZE) + Atomic_relaxed skip_lock_inheritance_and_n_ref; public: @@ -633,6 +642,10 @@ struct trx_t : ilist_node<> Cleared in commit_in_memory() after commit_state(), trx_sys_t::deregister_rw(), release_locks(). */ trx_id_t id; + /** The largest encountered transaction identifier for which no + transaction was observed to be active. This is a cache to speed up + trx_sys_t::find_same_or_older(). */ + trx_id_t max_inactive_id; private: /** mutex protecting state and some of lock @@ -640,7 +653,7 @@ struct trx_t : ilist_node<> srw_spin_mutex mutex; #ifdef UNIV_DEBUG /** The owner of mutex (0 if none); protected by mutex */ - std::atomic mutex_owner{0}; + std::atomic mutex_owner{0}; #endif /* UNIV_DEBUG */ public: void mutex_init() { mutex.init(); } @@ -651,14 +664,14 @@ struct trx_t : ilist_node<> { ut_ad(!mutex_is_owner()); mutex.wr_lock(); - ut_ad(!mutex_owner.exchange(os_thread_get_curr_id(), + ut_ad(!mutex_owner.exchange(pthread_self(), std::memory_order_relaxed)); } /** Release the mutex */ void mutex_unlock() { ut_ad(mutex_owner.exchange(0, std::memory_order_relaxed) - == os_thread_get_curr_id()); + == pthread_self()); mutex.wr_unlock(); } #ifndef SUX_LOCK_GENERIC @@ -669,7 +682,7 @@ struct trx_t : ilist_node<> bool mutex_is_owner() const { return mutex_owner.load(std::memory_order_relaxed) == - os_thread_get_curr_id(); + pthread_self(); } #endif /* UNIV_DEBUG */ @@ -738,7 +751,7 @@ struct trx_t : ilist_node<> /** The locks of the transaction. Protected by lock_sys.latch (insertions also by trx_t::mutex). */ - trx_lock_t lock; + alignas(CPU_LEVEL1_DCACHE_LINESIZE) trx_lock_t lock; #ifdef WITH_WSREP /** whether wsrep_on(mysql_thd) held at the start of transaction */ @@ -805,8 +818,12 @@ struct trx_t : ilist_node<> flush the log in trx_commit_complete_for_mysql() */ ulint duplicates; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */ - bool dict_operation; /**< whether this modifies InnoDB - data dictionary */ + /** whether this modifies InnoDB dictionary tables */ + bool dict_operation; +#ifdef UNIV_DEBUG + /** copy of dict_operation during commit() */ + bool was_dict_operation; +#endif /** whether dict_sys.latch is held exclusively; protected by dict_sys.latch */ bool dict_operation_lock_mode; @@ -900,6 +917,10 @@ struct trx_t : ilist_node<> bool auto_commit; /*!< true if it is an autocommit */ bool will_lock; /*!< set to inform trx_start_low() that the transaction may acquire locks */ + /* True if transaction has to read the undo log and + log the DML changes for online DDL table */ + bool apply_online_log = false; + /*------------------------------*/ fts_trx_t* fts_trx; /*!< FTS information, or NULL if transaction hasn't modified tables @@ -973,9 +994,12 @@ struct trx_t : ilist_node<> @retval false if the rollback was aborted by shutdown */ inline bool rollback_finish(); private: + /** Apply any changes to tables for which online DDL is in progress. */ + ATTRIBUTE_COLD void apply_log(); /** Process tables that were modified by the committing transaction. */ inline void commit_tables(); - /** Mark a transaction committed in the main memory data structures. */ + /** Mark a transaction committed in the main memory data structures. + @param mtr mini-transaction (if there are any persistent modifications) */ inline void commit_in_memory(const mtr_t *mtr); /** Write log for committing the transaction. */ void commit_persist(); @@ -1017,26 +1041,48 @@ struct trx_t : ilist_node<> void savepoints_discard(trx_named_savept_t *savept); - bool is_referenced() const { return n_ref > 0; } + bool is_referenced() const + { + return (skip_lock_inheritance_and_n_ref & ~(1U << 31)) > 0; + } void reference() { -#ifdef UNIV_DEBUG - auto old_n_ref= -#endif - n_ref++; - ut_ad(old_n_ref >= 0); + ut_d(auto old_n_ref =) + skip_lock_inheritance_and_n_ref.fetch_add(1); + ut_ad(int32_t(old_n_ref << 1) >= 0); } - void release_reference() { -#ifdef UNIV_DEBUG - auto old_n_ref= + ut_d(auto old_n_ref =) + skip_lock_inheritance_and_n_ref.fetch_sub(1); + ut_ad(int32_t(old_n_ref << 1) > 0); + } + + bool is_not_inheriting_locks() const + { + return skip_lock_inheritance_and_n_ref >> 31; + } + + void set_skip_lock_inheritance() + { + ut_d(auto old_n_ref=) skip_lock_inheritance_and_n_ref.fetch_add(1U << 31); + ut_ad(!(old_n_ref >> 31)); + } + + void reset_skip_lock_inheritance() + { +#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) + __asm__("lock btrl $31, %0" : : "m"(skip_lock_inheritance_and_n_ref)); +#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) + _interlockedbittestandreset( + reinterpret_cast(&skip_lock_inheritance_and_n_ref), + 31); +#else + skip_lock_inheritance_and_n_ref.fetch_and(~1U << 31); #endif - n_ref--; - ut_ad(old_n_ref > 0); } /** @return whether the table has lock on @@ -1065,6 +1111,10 @@ struct trx_t : ilist_node<> ut_ad(!autoinc_locks || ib_vector_is_empty(autoinc_locks)); ut_ad(UT_LIST_GET_LEN(lock.evicted_tables) == 0); ut_ad(!dict_operation); + ut_ad(!apply_online_log); + ut_ad(!is_not_inheriting_locks()); + ut_ad(check_foreigns); + ut_ad(check_unique_secondary); } /** This has to be invoked on SAVEPOINT or at the end of a statement. @@ -1124,18 +1174,13 @@ struct trx_t : ilist_node<> @return DB_SUCCESS or error code */ dberr_t bulk_insert_apply() { - if (UNIV_LIKELY(!bulk_insert)) - return DB_SUCCESS; - ut_ad(!check_unique_secondary); - ut_ad(!check_foreigns); - for (auto& t : mod_tables) - if (t.second.is_bulk_insert()) - if (dberr_t err= t.second.write_bulk(t.first, this)) - return err; - return DB_SUCCESS; + return UNIV_UNLIKELY(bulk_insert) ? bulk_insert_apply_low(): DB_SUCCESS; } private: + /** Apply the buffered bulk inserts. */ + dberr_t bulk_insert_apply_low(); + /** Assign a rollback segment for modifying temporary tables. @return the assigned rollback segment */ trx_rseg_t *assign_temp_rseg(); @@ -1207,6 +1252,6 @@ struct commit_node_t{ }; -#include "trx0trx.ic" +#include "trx0trx.inl" #endif diff --git a/storage/innobase/include/trx0trx.ic b/storage/innobase/include/trx0trx.inl similarity index 100% rename from storage/innobase/include/trx0trx.ic rename to storage/innobase/include/trx0trx.inl diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h index 4d6caa89811dd..670fe00c25b25 100644 --- a/storage/innobase/include/trx0undo.h +++ b/storage/innobase/include/trx0undo.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -96,22 +96,6 @@ inline roll_ptr_t trx_read_roll_ptr(const byte* ptr) return mach_read_from_7(ptr); } -/** Gets an undo log page and x-latches it. -@param[in] page_id page id -@param[in,out] mtr mini-transaction -@return pointer to page x-latched */ -UNIV_INLINE -buf_block_t* -trx_undo_page_get(const page_id_t page_id, mtr_t* mtr); - -/** Gets an undo log page and s-latches it. -@param[in] page_id page id -@param[in,out] mtr mini-transaction -@return pointer to page s-latched */ -UNIV_INLINE -buf_block_t* -trx_undo_page_get_s_latched(const page_id_t page_id, mtr_t* mtr); - /** Get the next record in an undo log. @param[in] undo_page undo log page @param[in] rec undo record offset in the page @@ -140,8 +124,8 @@ trx_undo_get_prev_rec(buf_block_t *&block, uint16_t rec, uint32_t page_no, @param[in,out] mtr mini-transaction @return undo log record, the page latched, NULL if none */ trx_undo_rec_t* -trx_undo_get_next_rec(buf_block_t *&block, uint16_t rec, uint32_t page_no, - uint16_t offset, mtr_t *mtr); +trx_undo_get_next_rec(const buf_block_t *&block, uint16_t rec, + uint32_t page_no, uint16_t offset, mtr_t *mtr); /** Get the first record in an undo log. @param[in] space undo log header space @@ -150,11 +134,13 @@ trx_undo_get_next_rec(buf_block_t *&block, uint16_t rec, uint32_t page_no, @param[in] mode latching mode: RW_S_LATCH or RW_X_LATCH @param[out] block undo log page @param[in,out] mtr mini-transaction -@return undo log record, the page latched, NULL if none */ +@param[out] err error code +@return undo log record, the page latched +@retval nullptr if none */ trx_undo_rec_t* trx_undo_get_first_rec(const fil_space_t &space, uint32_t page_no, - uint16_t offset, ulint mode, buf_block_t*& block, - mtr_t *mtr); + uint16_t offset, ulint mode, const buf_block_t*& block, + mtr_t *mtr, dberr_t *err); /** Initialize an undo log page. NOTE: This corresponds to a redo log record and must not be changed! @@ -165,24 +151,24 @@ void trx_undo_page_init(const buf_block_t &block); /** Allocate an undo log page. @param[in,out] undo undo log @param[in,out] mtr mini-transaction that does not hold any page latch +@param[out] err error code @return X-latched block if success -@retval NULL on failure */ -buf_block_t* trx_undo_add_page(trx_undo_t* undo, mtr_t* mtr) - MY_ATTRIBUTE((nonnull, warn_unused_result)); +@retval nullptr on failure */ +buf_block_t *trx_undo_add_page(trx_undo_t *undo, mtr_t *mtr, dberr_t *err) + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Free the last undo log page. The caller must hold the rseg mutex. @param[in,out] undo undo log @param[in,out] mtr mini-transaction that does not hold any undo log page - or that has allocated the undo log page */ -void -trx_undo_free_last_page(trx_undo_t* undo, mtr_t* mtr) - MY_ATTRIBUTE((nonnull)); + or that has allocated the undo log page +@return error code */ +dberr_t trx_undo_free_last_page(trx_undo_t *undo, mtr_t *mtr) + MY_ATTRIBUTE((nonnull, warn_unused_result)); -/** Truncate the tail of an undo log during rollback. -@param[in,out] undo undo log -@param[in] limit all undo logs after this limit will be discarded -@param[in] is_temp whether this is temporary undo log */ -void trx_undo_truncate_end(trx_undo_t& undo, undo_no_t limit, bool is_temp); +/** Try to truncate the undo logs. +@param trx transaction +@return error code */ +dberr_t trx_undo_try_truncate(const trx_t &trx); /** Truncate the head of an undo log. NOTE that only whole pages are freed; the header page is not @@ -191,13 +177,15 @@ freed, but emptied, if all the records there are below the limit. @param[in] hdr_page_no header page number @param[in] hdr_offset header offset on the page @param[in] limit first undo number to preserve -(everything below the limit will be truncated) */ -void +(everything below the limit will be truncated) +@return error code */ +dberr_t trx_undo_truncate_start( trx_rseg_t* rseg, uint32_t hdr_page_no, uint16_t hdr_offset, - undo_no_t limit); + undo_no_t limit) + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Mark that an undo log header belongs to a data dictionary transaction. @param[in] trx dictionary transaction @param[in,out] undo undo log @@ -215,16 +203,18 @@ trx_undo_assign(trx_t* trx, dberr_t* err, mtr_t* mtr) MY_ATTRIBUTE((nonnull)); /** Assign an undo log for a transaction. A new undo log is created or a cached undo log reused. +@tparam is_temp whether this is temporary undo log @param[in,out] trx transaction @param[in] rseg rollback segment @param[out] undo the undo log -@param[out] err error code @param[in,out] mtr mini-transaction +@param[out] err error code @return the undo log block -@retval NULL on error */ +@retval nullptr on error */ +template buf_block_t* -trx_undo_assign_low(trx_t* trx, trx_rseg_t* rseg, trx_undo_t** undo, - dberr_t* err, mtr_t* mtr) +trx_undo_assign_low(trx_t *trx, trx_rseg_t *rseg, trx_undo_t **undo, + mtr_t *mtr, dberr_t *err) MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Sets the state of the undo log segment at a transaction finish. @@ -258,12 +248,10 @@ trx_undo_free_at_shutdown(trx_t *trx); @param[in,out] rseg rollback segment @param[in] id rollback segment slot @param[in] page_no undo log segment page number -@param[in,out] max_trx_id the largest observed transaction ID @return the undo log @retval nullptr on error */ trx_undo_t * -trx_undo_mem_create_at_db_start(trx_rseg_t *rseg, ulint id, uint32_t page_no, - trx_id_t &max_trx_id); +trx_undo_mem_create_at_db_start(trx_rseg_t *rseg, ulint id, uint32_t page_no); #endif /* !UNIV_INNOCHECKSUM */ @@ -326,6 +314,106 @@ struct trx_undo_t { /*!< undo log objects in the rollback segment are chained into lists */ }; + +/** Cache a pointer to an undo record in a latched buffer pool page, +parse the undo log record and store the record type, update vector +and compiler information */ +class UndorecApplier +{ + /** Undo log block page id */ + page_id_t page_id; + /** Undo log record pointer */ + const trx_undo_rec_t *undo_rec; + /** Offset of the undo log record within the block */ + uint16_t offset; + /** Transaction id of the undo log */ + const trx_id_t trx_id; + /** Undo log record type */ + ulint type; + /** compiler information */ + ulint cmpl_info; + /** Update vector */ + upd_t *update; + /** memory heap which can be used to build previous version of + the index record and its offsets */ + mem_heap_t *heap; + /** mini-transaction for accessing B-tree pages */ + mtr_t mtr; + +public: + UndorecApplier(page_id_t page_id, trx_id_t trx_id) : + page_id(page_id), trx_id(trx_id), heap(mem_heap_create(100)) + { + } + + /** Assign the next page id */ + void assign_next(const page_id_t next_page_id) + { + page_id= next_page_id; + } + + /** Assign the undo log record and offset */ + inline void assign_rec(const buf_block_t &block, uint16_t offset); + + uint16_t get_offset() const { return offset; } + + page_id_t get_page_id() const { return page_id; } + + /** Handle the DML undo log and apply it on online indexes */ + inline void apply_undo_rec(); + + ~UndorecApplier() + { + mem_heap_free(heap); + } + +private: + /** Handle the insert undo log and apply it on online indexes + @param tuple row reference from undo log record + @param clust_index clustered index */ + void log_insert(const dtuple_t &tuple, dict_index_t *clust_index); + + /** Handle the update, delete undo log and apply it on online + indexes. + @param tuple row reference from undo log record + @param clust_index clustered index */ + void log_update(const dtuple_t &tuple, dict_index_t *clust_index); + + /** Check whether the given roll pointer is generated by + the current undo log record information stored. + @return true if roll pointer matches with current undo log info */ + bool is_same(roll_ptr_t roll_ptr) const + { + uint16_t offset= static_cast(roll_ptr); + uint32_t page_no= static_cast(roll_ptr >> 16); + return page_no == page_id.page_no() && offset == this->offset; + } + + /** Clear the undo log record information */ + void clear_undo_rec() + { + undo_rec= nullptr; + cmpl_info= 0; + type= 0; + update= nullptr; + mem_heap_empty(heap); + } + + /** Get the correct version of the clustered index record that + was modified by the current undo log record. Because there could + be the multiple successive updates of the same record within the + same transaction. + @param tuple tuple contains primary key value + @param index clustered index + @param[out] clust_rec current clustered index record + @param offsets offsets points to the record + @return clustered index record which was changed by + the undo log record or nullptr when there is no clustered + index record changed by undo log record */ + const rec_t* get_old_rec(const dtuple_t &tuple, dict_index_t *index, + const rec_t **clust_rec, rec_offs **offsets); +}; + #endif /* !UNIV_INNOCHECKSUM */ /** The offset of the undo log page header on pages of the undo log */ @@ -405,6 +493,8 @@ or 0 if the transaction has not been committed */ /** Before MariaDB 10.3.1, when purge did not reset DB_TRX_ID of surviving user records, this used to be called TRX_UNDO_DEL_MARKS. +This field is redundant; it is only being read by some debug assertions. + The value 1 indicates that purge needs to process the undo log segment. The value 0 indicates that all of it has been processed, and trx_purge_free_segment() has been invoked, so the log is not safe to access. @@ -457,7 +547,7 @@ which purge would not result in removing delete-marked records. */ with the XA XID */ /* @} */ -#include "trx0undo.ic" +#include "trx0undo.inl" #endif /* !UNIV_INNOCHECKSUM */ #endif diff --git a/storage/innobase/include/trx0undo.ic b/storage/innobase/include/trx0undo.ic deleted file mode 100644 index 1a9c7774580b2..0000000000000 --- a/storage/innobase/include/trx0undo.ic +++ /dev/null @@ -1,151 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, 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 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/trx0undo.ic -Transaction undo log - -Created 3/26/1996 Heikki Tuuri -*******************************************************/ - -#include "data0type.h" -#include "page0page.h" - -/***********************************************************************//** -Builds a roll pointer. -@return roll pointer */ -UNIV_INLINE -roll_ptr_t -trx_undo_build_roll_ptr( -/*====================*/ - bool is_insert, /*!< in: TRUE if insert undo log */ - ulint rseg_id, /*!< in: rollback segment id */ - uint32_t page_no, /*!< in: page number */ - uint16_t offset) /*!< in: offset of the undo entry within page */ -{ - compile_time_assert(DATA_ROLL_PTR_LEN == 7); - ut_ad(rseg_id < TRX_SYS_N_RSEGS); - - return roll_ptr_t{is_insert} << ROLL_PTR_INSERT_FLAG_POS | - roll_ptr_t{rseg_id} << ROLL_PTR_RSEG_ID_POS | - roll_ptr_t{page_no} << ROLL_PTR_PAGE_POS | offset; -} - -/***********************************************************************//** -Decodes a roll pointer. */ -UNIV_INLINE -void -trx_undo_decode_roll_ptr( -/*=====================*/ - roll_ptr_t roll_ptr, /*!< in: roll pointer */ - bool* is_insert, /*!< out: TRUE if insert undo log */ - ulint* rseg_id, /*!< out: rollback segment id */ - uint32_t* page_no, /*!< out: page number */ - uint16_t* offset) /*!< out: offset of the undo - entry within page */ -{ - compile_time_assert(DATA_ROLL_PTR_LEN == 7); - ut_ad(roll_ptr < (1ULL << 56)); - *offset= static_cast(roll_ptr); - *page_no= static_cast(roll_ptr >> 16); - *rseg_id= static_cast(roll_ptr >> 48 & 0x7F); - *is_insert= static_cast(roll_ptr >> 55); -} - -/***********************************************************************//** -Determine if DB_ROLL_PTR is of the insert type. -@return true if insert */ -UNIV_INLINE -bool -trx_undo_roll_ptr_is_insert( -/*========================*/ - roll_ptr_t roll_ptr) /*!< in: roll pointer */ -{ - compile_time_assert(DATA_ROLL_PTR_LEN == 7); - ut_ad(roll_ptr < (1ULL << (ROLL_PTR_INSERT_FLAG_POS + 1))); - return static_cast(roll_ptr >> ROLL_PTR_INSERT_FLAG_POS); -} - -/***********************************************************************//** -Returns true if the record is of the insert type. -@return true if the record was freshly inserted (not updated). */ -UNIV_INLINE -bool -trx_undo_trx_id_is_insert( -/*======================*/ - const byte* trx_id) /*!< in: DB_TRX_ID, followed by DB_ROLL_PTR */ -{ - compile_time_assert(DATA_TRX_ID + 1 == DATA_ROLL_PTR); - return bool(trx_id[DATA_TRX_ID_LEN] >> 7); -} - -/** Gets an undo log page and x-latches it. -@param[in] page_id page id -@param[in,out] mtr mini-transaction -@return pointer to page x-latched */ -UNIV_INLINE -buf_block_t* -trx_undo_page_get(const page_id_t page_id, mtr_t* mtr) -{ - return buf_page_get(page_id, 0, RW_X_LATCH, mtr); -} - -/** Gets an undo log page and s-latches it. -@param[in] page_id page id -@param[in,out] mtr mini-transaction -@return pointer to page s-latched */ -UNIV_INLINE -buf_block_t* -trx_undo_page_get_s_latched(const page_id_t page_id, mtr_t* mtr) -{ - return buf_page_get(page_id, 0, RW_S_LATCH, mtr); -} - -/** Determine the end offset of undo log records of an undo log page. -@param[in] undo_page undo log page -@param[in] page_no undo log header page number -@param[in] offset undo log header offset -@return end offset */ -inline -uint16_t trx_undo_page_get_end(const buf_block_t *undo_page, uint32_t page_no, - uint16_t offset) -{ - if (page_no == undo_page->page.id().page_no()) - if (uint16_t end = mach_read_from_2(TRX_UNDO_NEXT_LOG + offset + - undo_page->page.frame)) - return end; - - return mach_read_from_2(TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_FREE + - undo_page->page.frame); -} - -/** Get the next record in an undo log. -@param[in] undo_page undo log page -@param[in] rec undo record offset in the page -@param[in] page_no undo log header page number -@param[in] offset undo log header offset on page -@return undo log record, the page latched, NULL if none */ -inline trx_undo_rec_t* -trx_undo_page_get_next_rec(const buf_block_t *undo_page, uint16_t rec, - uint32_t page_no, uint16_t offset) -{ - uint16_t end= trx_undo_page_get_end(undo_page, page_no, offset); - uint16_t next= mach_read_from_2(undo_page->page.frame + rec); - return next == end ? nullptr : undo_page->page.frame + next; -} diff --git a/storage/innobase/include/trx0undo.inl b/storage/innobase/include/trx0undo.inl new file mode 100644 index 0000000000000..9f05989f634e8 --- /dev/null +++ b/storage/innobase/include/trx0undo.inl @@ -0,0 +1,129 @@ +/***************************************************************************** + +Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, 2022, 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 02110-1335 USA + +*****************************************************************************/ + +/**************************************************//** +@file include/trx0undo.ic +Transaction undo log + +Created 3/26/1996 Heikki Tuuri +*******************************************************/ + +#include "data0type.h" +#include "page0page.h" + +/***********************************************************************//** +Builds a roll pointer. +@return roll pointer */ +UNIV_INLINE +roll_ptr_t +trx_undo_build_roll_ptr( +/*====================*/ + bool is_insert, /*!< in: TRUE if insert undo log */ + ulint rseg_id, /*!< in: rollback segment id */ + uint32_t page_no, /*!< in: page number */ + uint16_t offset) /*!< in: offset of the undo entry within page */ +{ + compile_time_assert(DATA_ROLL_PTR_LEN == 7); + ut_ad(rseg_id < TRX_SYS_N_RSEGS); + + return roll_ptr_t{is_insert} << ROLL_PTR_INSERT_FLAG_POS | + roll_ptr_t{rseg_id} << ROLL_PTR_RSEG_ID_POS | + roll_ptr_t{page_no} << ROLL_PTR_PAGE_POS | offset; +} + +/***********************************************************************//** +Decodes a roll pointer. */ +UNIV_INLINE +void +trx_undo_decode_roll_ptr( +/*=====================*/ + roll_ptr_t roll_ptr, /*!< in: roll pointer */ + bool* is_insert, /*!< out: TRUE if insert undo log */ + ulint* rseg_id, /*!< out: rollback segment id */ + uint32_t* page_no, /*!< out: page number */ + uint16_t* offset) /*!< out: offset of the undo + entry within page */ +{ + compile_time_assert(DATA_ROLL_PTR_LEN == 7); + ut_ad(roll_ptr < (1ULL << 56)); + *offset= static_cast(roll_ptr); + *page_no= static_cast(roll_ptr >> 16); + *rseg_id= static_cast(roll_ptr >> 48 & 0x7F); + *is_insert= static_cast(roll_ptr >> 55); +} + +/***********************************************************************//** +Determine if DB_ROLL_PTR is of the insert type. +@return true if insert */ +UNIV_INLINE +bool +trx_undo_roll_ptr_is_insert( +/*========================*/ + roll_ptr_t roll_ptr) /*!< in: roll pointer */ +{ + compile_time_assert(DATA_ROLL_PTR_LEN == 7); + ut_ad(roll_ptr < (1ULL << (ROLL_PTR_INSERT_FLAG_POS + 1))); + return static_cast(roll_ptr >> ROLL_PTR_INSERT_FLAG_POS); +} + +/***********************************************************************//** +Returns true if the record is of the insert type. +@return true if the record was freshly inserted (not updated). */ +UNIV_INLINE +bool +trx_undo_trx_id_is_insert( +/*======================*/ + const byte* trx_id) /*!< in: DB_TRX_ID, followed by DB_ROLL_PTR */ +{ + compile_time_assert(DATA_TRX_ID + 1 == DATA_ROLL_PTR); + return bool(trx_id[DATA_TRX_ID_LEN] >> 7); +} + +/** Determine the end offset of undo log records of an undo log page. +@param[in] undo_page undo log page +@param[in] page_no undo log header page number +@param[in] offset undo log header offset +@return end offset */ +inline +uint16_t trx_undo_page_get_end(const buf_block_t *undo_page, uint32_t page_no, + uint16_t offset) +{ + if (page_no == undo_page->page.id().page_no()) + if (uint16_t end = mach_read_from_2(TRX_UNDO_NEXT_LOG + offset + + undo_page->page.frame)) + return end; + + return mach_read_from_2(TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_FREE + + undo_page->page.frame); +} + +/** Get the next record in an undo log. +@param[in] undo_page undo log page +@param[in] rec undo record offset in the page +@param[in] page_no undo log header page number +@param[in] offset undo log header offset on page +@return undo log record, the page latched, NULL if none */ +inline trx_undo_rec_t* +trx_undo_page_get_next_rec(const buf_block_t *undo_page, uint16_t rec, + uint32_t page_no, uint16_t offset) +{ + uint16_t end= trx_undo_page_get_end(undo_page, page_no, offset); + uint16_t next= mach_read_from_2(undo_page->page.frame + rec); + return next == end ? nullptr : undo_page->page.frame + next; +} diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index cb34f6c31f62d..2af1f480764ff 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -67,6 +67,7 @@ support cross-platform development and expose comonly used SQL names. */ #include #include "my_counter.h" +#include "aligned.h" #include #include @@ -100,15 +101,6 @@ HAVE_PSI_INTERFACE is defined. */ # define UNIV_PFS_MEMORY # endif /* HAVE_PSI_MEMORY_INTERFACE */ -/* There are mutexes/rwlocks that we want to exclude from -instrumentation even if their corresponding performance schema -define is set. And this PFS_NOT_INSTRUMENTED is used -as the key value to identify those objects that would -be excluded from instrumentation. */ -# define PFS_NOT_INSTRUMENTED ULINT32_UNDEFINED - -# define PFS_IS_INSTRUMENTED(key) ((key) != PFS_NOT_INSTRUMENTED) - #ifdef HAVE_PFS_THREAD_PROVIDER_H /* For PSI_MUTEX_CALL() and similar. */ #include "pfs_thread_provider.h" @@ -191,9 +183,6 @@ using the call command. */ info output */ #endif -#define UNIV_BTR_DEBUG /* check B-tree links */ -#define UNIV_LIGHT_MEM_DEBUG /* light memory debugging */ - // #define UNIV_SQL_DEBUG #ifndef MY_ATTRIBUTE @@ -333,22 +322,19 @@ typedef ssize_t lint; #ifdef _WIN32 /* Use the integer types and formatting strings defined in Visual Studio. */ # define UINT32PF "%u" -# define INT64PF "%lld" # define UINT64scan "llu" # define UINT64PFx "%016llx" #elif defined __APPLE__ /* Apple prefers to call the 64-bit types 'long long' in both 32-bit and 64-bit environments. */ # define UINT32PF "%" PRIu32 -# define INT64PF "%lld" # define UINT64scan "llu" # define UINT64PFx "%016llx" #elif defined _AIX /* Workaround for macros expension trouble */ # define UINT32PF "%u" -# define INT64PF "%lld" # define UINT64scan "lu" -# define UINT64PFx "%016llx" +# define UINT64PFx "%016lx" #else /* Use the integer types and formatting strings defined in the C99 standard. */ # define UINT32PF "%" PRIu32 @@ -428,7 +414,7 @@ contains the sum of the following flag and the locally stored len. */ #endif /* CHECK FOR GCC VER_GT_2 */ /* Some macros to improve branch prediction and reduce cache misses */ -#if defined(COMPILER_HINTS) && defined(__GNUC__) +#ifdef __GNUC__ /* Tell the compiler that 'expr' probably evaluates to 'constant'. */ # define UNIV_EXPECT(expr,constant) __builtin_expect(expr, constant) /* Tell the compiler that a pointer is likely to be NULL */ @@ -448,16 +434,11 @@ it is read or written. */ # define UNIV_EXPECT(expr,value) (expr) # define UNIV_LIKELY_NULL(expr) (expr) -# if defined(COMPILER_HINTS) //# define UNIV_PREFETCH_R(addr) sun_prefetch_read_many((void*) addr) -# define UNIV_PREFETCH_R(addr) ((void) 0) -# define UNIV_PREFETCH_RW(addr) sun_prefetch_write_many(addr) -# else -# define UNIV_PREFETCH_R(addr) ((void) 0) -# define UNIV_PREFETCH_RW(addr) ((void) 0) -# endif /* COMPILER_HINTS */ +# define UNIV_PREFETCH_R(addr) ((void) 0) +# define UNIV_PREFETCH_RW(addr) sun_prefetch_write_many(addr) -# elif defined _MSC_VER && defined COMPILER_HINTS +# elif defined _MSC_VER # define UNIV_EXPECT(expr,value) (expr) # define UNIV_LIKELY_NULL(expr) (expr) # if defined _M_IX86 || defined _M_X64 @@ -513,12 +494,9 @@ extern mysql_pfs_key_t fts_cache_mutex_key; extern mysql_pfs_key_t fts_cache_init_mutex_key; extern mysql_pfs_key_t fts_delete_mutex_key; extern mysql_pfs_key_t fts_doc_id_mutex_key; -extern mysql_pfs_key_t fts_pll_tokenize_mutex_key; extern mysql_pfs_key_t ibuf_bitmap_mutex_key; extern mysql_pfs_key_t ibuf_mutex_key; extern mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key; -extern mysql_pfs_key_t log_sys_mutex_key; -extern mysql_pfs_key_t log_flush_order_mutex_key; extern mysql_pfs_key_t recalc_pool_mutex_key; extern mysql_pfs_key_t purge_sys_pq_mutex_key; extern mysql_pfs_key_t recv_sys_mutex_key; @@ -534,8 +512,6 @@ extern mysql_pfs_key_t trx_pool_mutex_key; extern mysql_pfs_key_t trx_pool_manager_mutex_key; extern mysql_pfs_key_t lock_wait_mutex_key; extern mysql_pfs_key_t srv_threads_mutex_key; -extern mysql_pfs_key_t thread_mutex_key; -extern mysql_pfs_key_t row_drop_list_mutex_key; # endif /* UNIV_PFS_MUTEX */ # ifdef UNIV_PFS_RWLOCK @@ -547,5 +523,7 @@ extern mysql_pfs_key_t index_tree_rw_lock_key; extern mysql_pfs_key_t index_online_log_key; extern mysql_pfs_key_t trx_sys_rw_lock_key; extern mysql_pfs_key_t lock_latch_key; +extern mysql_pfs_key_t log_latch_key; +extern mysql_pfs_key_t trx_rseg_latch_key; # endif /* UNIV_PFS_RWLOCK */ #endif /* HAVE_PSI_INTERFACE */ diff --git a/storage/innobase/include/ut0byte.h b/storage/innobase/include/ut0byte.h index 1a428d73d2377..7ed64c61c4bc9 100644 --- a/storage/innobase/include/ut0byte.h +++ b/storage/innobase/include/ut0byte.h @@ -112,6 +112,6 @@ ut_bit_set_nth( ulint n, /*!< in: nth bit requested */ ibool val); /*!< in: value for the bit to set */ -#include "ut0byte.ic" +#include "ut0byte.inl" #endif diff --git a/storage/innobase/include/ut0byte.ic b/storage/innobase/include/ut0byte.inl similarity index 100% rename from storage/innobase/include/ut0byte.ic rename to storage/innobase/include/ut0byte.inl diff --git a/storage/innobase/include/ut0counter.h b/storage/innobase/include/ut0counter.h index 448768ec29a42..d6589cc4fd367 100644 --- a/storage/innobase/include/ut0counter.h +++ b/storage/innobase/include/ut0counter.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -28,16 +28,9 @@ Created 2012/04/12 by Sunny Bains #ifndef ut0counter_h #define ut0counter_h -#include "os0thread.h" +#include "univ.i" #include "my_rdtsc.h" -/** CPU cache line size */ -#ifdef CPU_LEVEL1_DCACHE_LINESIZE -# define CACHE_LINE_SIZE CPU_LEVEL1_DCACHE_LINESIZE -#else -# error CPU_LEVEL1_DCACHE_LINESIZE is undefined -#endif /* CPU_LEVEL1_DCACHE_LINESIZE */ - /** Use the result of my_timer_cycles(), which mainly uses RDTSC for cycles as a random value. See the comments for my_timer_cycles() */ /** @return result from RDTSC or similar functions. */ @@ -53,7 +46,7 @@ get_rnd_value() /* We may go here if my_timer_cycles() returns 0, so we have to have the plan B for the counter. */ #if !defined(_WIN32) - return (size_t)os_thread_get_curr_id(); + return (size_t)pthread_self(); #else LARGE_INTEGER cnt; QueryPerformanceCounter(&cnt); @@ -71,19 +64,18 @@ be zero-initialized by the run-time environment. @see srv_stats */ template struct ib_atomic_counter_element_t { - MY_ALIGNED(CACHE_LINE_SIZE) Atomic_relaxed value; + alignas(CPU_LEVEL1_DCACHE_LINESIZE) Atomic_relaxed value; }; template struct ib_counter_element_t { - MY_ALIGNED(CACHE_LINE_SIZE) Type value; + alignas(CPU_LEVEL1_DCACHE_LINESIZE) Type value; }; /** Class for using fuzzy counters. The counter is multi-instance relaxed atomic so the results are not guaranteed to be 100% accurate but close -enough. Creates an array of counters and separates each element by the -CACHE_LINE_SIZE bytes */ +enough. */ template class Element = ib_atomic_counter_element_t, int N = 128 > @@ -123,9 +115,9 @@ struct ib_counter_t { } private: - static_assert(sizeof(Element) == CACHE_LINE_SIZE, ""); + static_assert(sizeof(Element) == CPU_LEVEL1_DCACHE_LINESIZE, ""); /** Array of counter elements */ - MY_ALIGNED(CACHE_LINE_SIZE) Element m_counter[N]; + alignas(CPU_LEVEL1_DCACHE_LINESIZE) Element m_counter[N]; }; #endif /* ut0counter_h */ diff --git a/storage/innobase/include/ut0list.h b/storage/innobase/include/ut0list.h index 7e27e10884b68..765f6a2a339c0 100644 --- a/storage/innobase/include/ut0list.h +++ b/storage/innobase/include/ut0list.h @@ -141,6 +141,6 @@ struct ib_list_helper_t { void* data; /*!< user data */ }; -#include "ut0list.ic" +#include "ut0list.inl" #endif diff --git a/storage/innobase/include/ut0list.ic b/storage/innobase/include/ut0list.inl similarity index 100% rename from storage/innobase/include/ut0list.ic rename to storage/innobase/include/ut0list.inl diff --git a/storage/innobase/include/ut0lst.h b/storage/innobase/include/ut0lst.h index 9a5f305982650..7b7ed7b8e804b 100644 --- a/storage/innobase/include/ut0lst.h +++ b/storage/innobase/include/ut0lst.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2019, MariaDB Corporation. +Copyright (c) 2019, 2022, 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 @@ -25,8 +25,7 @@ Created 9/10/1995 Heikki Tuuri Rewritten by Sunny Bains Dec 2011. ***********************************************************************/ -#ifndef ut0lst_h -#define ut0lst_h +#pragma once /* Do not include univ.i because univ.i includes this. */ @@ -474,17 +473,17 @@ template void ut_list_validate(const List& list, Functor& functor) { ut_list_map(list, functor); - +#ifdef UNIV_DEBUG /* Validate the list backwards. */ - ulint count = 0; + ulint count = list.count; for (typename List::elem_type* elem = list.end; elem != 0; elem = (elem->*list.node).prev) { - ++count; + --count; } - - ut_a(count == list.count); + ut_ad(!count); +#endif } /** Check the consistency of a doubly linked list. @@ -494,23 +493,24 @@ template inline void ut_list_validate(const List& list, const Functor& functor) { ut_list_map(list, functor); - +#ifdef UNIV_DEBUG /* Validate the list backwards. */ - ulint count = 0; + ulint count = list.count; for (typename List::elem_type* elem = list.end; elem != 0; elem = (elem->*list.node).prev) { - ++count; + --count; } - ut_a(count == list.count); + ut_ad(!count); +#endif } template inline void ut_list_validate(const List& list) { - ut_list_validate(list, NullValidate()); + ut_d(ut_list_validate(list, NullValidate())); } #ifdef UNIV_DEBUG @@ -561,8 +561,3 @@ ut_list_move_to_front( ut_list_prepend(list, elem); } } - -#ifdef UNIV_DEBUG -#endif - -#endif /* ut0lst.h */ diff --git a/storage/innobase/include/ut0mem.h b/storage/innobase/include/ut0mem.h index 2fc864d49a2fb..a5ed72f9f0253 100644 --- a/storage/innobase/include/ut0mem.h +++ b/storage/innobase/include/ut0mem.h @@ -71,6 +71,6 @@ ut_str_sql_format( ulint buf_size); /*!< in: output buffer size in bytes */ -#include "ut0mem.ic" +#include "ut0mem.inl" #endif diff --git a/storage/innobase/include/ut0mem.ic b/storage/innobase/include/ut0mem.inl similarity index 100% rename from storage/innobase/include/ut0mem.ic rename to storage/innobase/include/ut0mem.inl diff --git a/storage/innobase/include/ut0new.h b/storage/innobase/include/ut0new.h index cd116cc3a20dc..f4183e4c61af6 100644 --- a/storage/innobase/include/ut0new.h +++ b/storage/innobase/include/ut0new.h @@ -283,7 +283,7 @@ class ut_allocator { { } #else - ut_allocator() {} + ut_allocator() = default; ut_allocator(PSI_memory_key) {} #endif /* UNIV_PFS_MEMORY */ diff --git a/storage/innobase/include/ut0pool.h b/storage/innobase/include/ut0pool.h index 56ffbee48f398..aa0cfb9e060fb 100644 --- a/storage/innobase/include/ut0pool.h +++ b/storage/innobase/include/ut0pool.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2013, 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2021, MariaDB Corporation. +Copyright (c) 2018, 2022, 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 @@ -31,7 +31,7 @@ Created 2012-Feb-26 Sunny Bains #include #include -#include "ut0new.h" +#include /** Allocate the memory for the object in blocks. We keep the objects sorted on pointer so that they are closer together in case they have to be iterated @@ -41,8 +41,6 @@ struct Pool { typedef Type value_type; - // FIXME: Add an assertion to check alignment and offset is - // as we expect it. Also, sizeof(void*) can be 8, can we impove on this. struct Element { Pool* m_pool; value_type m_type; @@ -57,17 +55,23 @@ struct Pool { m_size(size), m_last() { + ut_ad(ut_is_2pow(size)); ut_a(size >= sizeof(Element)); + static_assert(!(sizeof(Element) % CPU_LEVEL1_DCACHE_LINESIZE), + "alignment"); m_lock_strategy.create(); ut_a(m_start == 0); - m_start = reinterpret_cast(ut_zalloc_nokey(m_size)); + m_start = static_cast( + aligned_malloc(m_size, CPU_LEVEL1_DCACHE_LINESIZE)); + memset_aligned( + m_start, 0, m_size); m_last = m_start; - m_end = &m_start[m_size / sizeof(*m_start)]; + m_end = &m_start[m_size / sizeof *m_start]; /* Note: Initialise only a small subset, even though we have allocated all the memory. This is required only because PFS @@ -90,7 +94,7 @@ struct Pool { Factory::destroy(&elem->m_type); } - ut_free(m_start); + IF_WIN(_aligned_free,free)(m_start); m_end = m_last = m_start = 0; m_size = 0; } diff --git a/storage/innobase/include/ut0rnd.h b/storage/innobase/include/ut0rnd.h index bcf47fa9c4181..511eb21fd11ae 100644 --- a/storage/innobase/include/ut0rnd.h +++ b/storage/innobase/include/ut0rnd.h @@ -123,6 +123,6 @@ ut_fold_binary( ulint len) /*!< in: length */ MY_ATTRIBUTE((pure)); -#include "ut0rnd.ic" +#include "ut0rnd.inl" #endif diff --git a/storage/innobase/include/ut0rnd.ic b/storage/innobase/include/ut0rnd.inl similarity index 100% rename from storage/innobase/include/ut0rnd.ic rename to storage/innobase/include/ut0rnd.inl diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index 166d8132a3ee4..fe16ce149da44 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -323,7 +323,7 @@ class logger { protected: /* This class must not be used directly */ - ATTRIBUTE_COLD ATTRIBUTE_NOINLINE logger() {} + ATTRIBUTE_COLD ATTRIBUTE_NOINLINE logger() = default; public: template ATTRIBUTE_COLD ATTRIBUTE_NOINLINE logger& operator<<(const T& rhs) @@ -438,7 +438,7 @@ class fatal_or_error : public logger { } // namespace ib -#include "ut0ut.ic" +#include "ut0ut.inl" #endif diff --git a/storage/innobase/include/ut0ut.ic b/storage/innobase/include/ut0ut.inl similarity index 100% rename from storage/innobase/include/ut0ut.ic rename to storage/innobase/include/ut0ut.inl diff --git a/storage/innobase/include/ut0vec.h b/storage/innobase/include/ut0vec.h index cfdaee607bedf..f4660f9646caa 100644 --- a/storage/innobase/include/ut0vec.h +++ b/storage/innobase/include/ut0vec.h @@ -280,6 +280,6 @@ struct ib_vector_t { ulint sizeof_value; }; -#include "ut0vec.ic" +#include "ut0vec.inl" #endif /* IB_VECTOR_H */ diff --git a/storage/innobase/include/ut0vec.ic b/storage/innobase/include/ut0vec.inl similarity index 100% rename from storage/innobase/include/ut0vec.ic rename to storage/innobase/include/ut0vec.inl diff --git a/storage/innobase/innodb.cmake b/storage/innobase/innodb.cmake deleted file mode 100644 index 5196637eed269..0000000000000 --- a/storage/innobase/innodb.cmake +++ /dev/null @@ -1,152 +0,0 @@ -# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2017, 2021, MariaDB Corporation. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -# This is the CMakeLists for InnoDB - -INCLUDE(CheckFunctionExists) -INCLUDE(CheckCSourceCompiles) -INCLUDE(CheckCSourceRuns) -INCLUDE(numa) -INCLUDE(TestBigEndian) - -MYSQL_CHECK_NUMA() - -INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake) - -IF(CMAKE_CROSSCOMPILING) - # Use CHECK_C_SOURCE_COMPILES instead of CHECK_C_SOURCE_RUNS when - # cross-compiling. Not as precise, but usually good enough. - # This only make sense for atomic tests in this file, this trick doesn't - # work in a general case. - MACRO(CHECK_C_SOURCE SOURCE VAR) - CHECK_C_SOURCE_COMPILES("${SOURCE}" "${VAR}") - ENDMACRO() -ELSE() - MACRO(CHECK_C_SOURCE SOURCE VAR) - CHECK_C_SOURCE_RUNS("${SOURCE}" "${VAR}") - ENDMACRO() -ENDIF() - -# OS tests -IF(UNIX) - IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") - ADD_DEFINITIONS("-DUNIV_LINUX -D_GNU_SOURCE=1") - IF(HAVE_LIBNUMA) - LINK_LIBRARIES(numa) - ENDIF() - ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP*") - ADD_DEFINITIONS("-DUNIV_HPUX") - ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "AIX") - ADD_DEFINITIONS("-DUNIV_AIX") - ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") - ADD_DEFINITIONS("-DUNIV_SOLARIS") - ENDIF() -ENDIF() - -OPTION(INNODB_COMPILER_HINTS "Compile InnoDB with compiler hints" ON) -MARK_AS_ADVANCED(INNODB_COMPILER_HINTS) - -IF(INNODB_COMPILER_HINTS) - ADD_DEFINITIONS("-DCOMPILER_HINTS") -ENDIF() -ADD_FEATURE_INFO(INNODB_COMPILER_HINTS INNODB_COMPILER_HINTS "InnoDB compiled with compiler hints") - -# Enable InnoDB's UNIV_DEBUG in debug builds -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG") - -OPTION(WITH_INNODB_AHI "Include innodb_adaptive_hash_index" ON) -OPTION(WITH_INNODB_ROOT_GUESS "Cache index root block descriptors" ON) -IF(WITH_INNODB_AHI) - ADD_DEFINITIONS(-DBTR_CUR_HASH_ADAPT -DBTR_CUR_ADAPT) - IF(NOT WITH_INNODB_ROOT_GUESS) - MESSAGE(WARNING "WITH_INNODB_AHI implies WITH_INNODB_ROOT_GUESS") - SET(WITH_INNODB_ROOT_GUESS ON) - ENDIF() -ELSEIF(WITH_INNODB_ROOT_GUESS) - ADD_DEFINITIONS(-DBTR_CUR_ADAPT) -ENDIF() -ADD_FEATURE_INFO(INNODB_AHI WITH_INNODB_AHI "InnoDB Adaptive Hash Index") -ADD_FEATURE_INFO(INNODB_ROOT_GUESS WITH_INNODB_ROOT_GUESS - "Cache index root block descriptors in InnoDB") - -OPTION(WITH_INNODB_EXTRA_DEBUG "Enable extra InnoDB debug checks" OFF) -IF(WITH_INNODB_EXTRA_DEBUG) - ADD_DEFINITIONS(-DUNIV_ZIP_DEBUG) -ENDIF() -ADD_FEATURE_INFO(INNODB_EXTRA_DEBUG WITH_INNODB_EXTRA_DEBUG "Extra InnoDB debug checks") - - -CHECK_FUNCTION_EXISTS(sched_getcpu HAVE_SCHED_GETCPU) -IF(HAVE_SCHED_GETCPU) - ADD_DEFINITIONS(-DHAVE_SCHED_GETCPU=1) -ENDIF() - -IF(HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE) - ADD_DEFINITIONS(-DHAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE=1) -ENDIF() - -IF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR - CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion -Wno-sign-conversion") - SET_SOURCE_FILES_PROPERTIES(fts/fts0pars.cc - PROPERTIES COMPILE_FLAGS -Wno-conversion) -ENDIF() - -IF(NOT MSVC) - # Work around MDEV-18417, MDEV-18656, MDEV-18417 - IF(WITH_ASAN AND CMAKE_COMPILER_IS_GNUCC AND - CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0") - SET_SOURCE_FILES_PROPERTIES(trx/trx0rec.cc PROPERTIES COMPILE_FLAGS -O1) - ENDIF() -ENDIF() - -CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF) - -OPTION(WITH_INNODB_DISALLOW_WRITES "InnoDB freeze writes patch from Google" ${WITH_WSREP}) -IF (WITH_INNODB_DISALLOW_WRITES) - ADD_DEFINITIONS(-DWITH_INNODB_DISALLOW_WRITES) -ENDIF() -ADD_FEATURE_INFO(INNODB_DISALLOW_WRITES WITH_INNODB_DISALLOW_WRITES "Expose innodb_disallow_writes switch to stop innodb from writing to disk") - - -# Include directories under innobase -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/innobase/include - ${CMAKE_SOURCE_DIR}/storage/innobase/handler) - -# Sun Studio bug with -xO2 -IF(CMAKE_CXX_COMPILER_ID MATCHES "SunPro" - AND CMAKE_CXX_FLAGS_RELEASE MATCHES "O2" - AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug") - # Sun Studio 12 crashes with -xO2 flag, but not with higher optimization - # -xO3 - SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/rem/rem0rec.cc - PROPERTIES COMPILE_FLAGS -xO3) -ENDIF() - - -IF(MSVC) - # Avoid "unreferenced label" warning in generated file - GET_FILENAME_COMPONENT(_SRC_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) - SET_SOURCE_FILES_PROPERTIES(${_SRC_DIR}/pars/pars0grm.c - PROPERTIES COMPILE_FLAGS "/wd4102") - SET_SOURCE_FILES_PROPERTIES(${_SRC_DIR}/pars/lexyy.c - PROPERTIES COMPILE_FLAGS "/wd4003") -ENDIF() - -# Include directories under innobase -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/innobase/include - ${CMAKE_SOURCE_DIR}/storage/innobase/handler - ${CMAKE_SOURCE_DIR}/libbinlogevents/include ) diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 5551c85db0bf4..3c7c3d348af80 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -1,7 +1,7 @@ /***************************************************************************** -Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2022, MariaDB Corporation. +Copyright (c) 1996, 2022, Oracle and/or its affiliates. +Copyright (c) 2014, 2023, 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 @@ -44,12 +44,14 @@ Created 5/7/1996 Heikki Tuuri #include "row0vers.h" #include "pars0pars.h" #include "srv0mon.h" +#include "que0que.h" +#include "scope.h" +#include #include #ifdef WITH_WSREP #include -#include #endif /* WITH_WSREP */ /** The value of innodb_deadlock_detect */ @@ -75,9 +77,10 @@ struct TableLockGetNode void lock_sys_t::hash_table::create(ulint n) { n_cells= ut_find_prime(n); - const size_t size= pad(n_cells) * sizeof *array; - void* v= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE); - memset(v, 0, size); + const size_t size= MY_ALIGN(pad(n_cells) * sizeof *array, + CPU_LEVEL1_DCACHE_LINESIZE); + void *v= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE); + memset_aligned(v, 0, size); array= static_cast(v); } @@ -87,9 +90,10 @@ void lock_sys_t::hash_table::resize(ulint n) { ut_ad(lock_sys.is_writer()); ulint new_n_cells= ut_find_prime(n); - const size_t size= pad(new_n_cells) * sizeof *array; - void* v= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE); - memset(v, 0, size); + const size_t size= MY_ALIGN(pad(new_n_cells) * sizeof *array, + CPU_LEVEL1_DCACHE_LINESIZE); + void *v= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE); + memset_aligned(v, 0, size); hash_cell_t *new_array= static_cast(v); for (auto i= pad(n_cells); i--; ) @@ -418,13 +422,13 @@ void lock_sys_t::wr_lock(const char *file, unsigned line) { mysql_mutex_assert_not_owner(&wait_mutex); latch.wr_lock(file, line); - ut_ad(!writer.exchange(os_thread_get_curr_id(), std::memory_order_relaxed)); + ut_ad(!writer.exchange(pthread_self(), std::memory_order_relaxed)); } /** Release exclusive lock_sys.latch */ void lock_sys_t::wr_unlock() { ut_ad(writer.exchange(0, std::memory_order_relaxed) == - os_thread_get_curr_id()); + pthread_self()); latch.wr_unlock(); } @@ -589,8 +593,6 @@ UNIV_INLINE bool lock_rec_has_to_wait( /*=================*/ - bool for_locking, - /*!< in is called locking or releasing */ const trx_t* trx, /*!< in: trx of new lock */ unsigned type_mode,/*!< in: precise mode of the new lock to set: LOCK_S or LOCK_X, possibly @@ -691,22 +693,31 @@ lock_rec_has_to_wait( #endif /* HAVE_REPLICATION */ #ifdef WITH_WSREP - /* New lock request from a transaction is using unique key - scan and this transaction is a wsrep high priority transaction - (brute force). If conflicting transaction is also wsrep high - priority transaction we should avoid lock conflict because - ordering of these transactions is already decided and - conflicting transaction will be later replayed. */ - if (trx->is_wsrep_UK_scan() - && wsrep_thd_is_BF(lock2->trx->mysql_thd, false)) { - return false; - } + /* New lock request from a transaction is using unique key + scan and this transaction is a wsrep high priority transaction + (brute force). If conflicting transaction is also wsrep high + priority transaction we should avoid lock conflict because + ordering of these transactions is already decided and + conflicting transaction will be later replayed. */ + if (trx->is_wsrep_UK_scan() + && wsrep_thd_is_BF(lock2->trx->mysql_thd, false)) { + return false; + } + + /* if BF-BF conflict, we have to look at write set order */ + if (trx->is_wsrep() && + (type_mode & LOCK_MODE_MASK) == LOCK_X && + (lock2->type_mode & LOCK_MODE_MASK) == LOCK_X && + wsrep_thd_order_before(trx->mysql_thd, + lock2->trx->mysql_thd)) { + return false; + } - /* We very well can let bf to wait normally as other - BF will be replayed in case of conflict. For debug - builds we will do additional sanity checks to catch - unsupported bf wait if any. */ - ut_d(wsrep_assert_no_bf_bf_wait(lock2, trx)); + /* We very well can let bf to wait normally as other + BF will be replayed in case of conflict. For debug + builds we will do additional sanity checks to catch + unsupported bf wait if any. */ + ut_d(wsrep_assert_no_bf_bf_wait(lock2, trx)); #endif /* WITH_WSREP */ return true; @@ -744,7 +755,7 @@ lock_has_to_wait( } return lock_rec_has_to_wait( - false, lock1->trx, lock1->type_mode, lock2, + lock1->trx, lock1->type_mode, lock2, lock_rec_get_nth_bit(lock1, PAGE_HEAP_NO_SUPREMUM)); } @@ -1010,38 +1021,18 @@ LOCK_INSERT_INTENTION @param[in] id page identifier @param[in] heap_no heap number of the record @param[in] trx our transaction -@param[out] was_ignored true if conflicting locks waiting for the current -transaction were ignored @return conflicting lock and the flag which indicated if conflicting locks which wait for the current transaction were ignored */ static lock_t *lock_rec_other_has_conflicting(unsigned mode, const hash_cell_t &cell, const page_id_t id, - ulint heap_no, const trx_t *trx, - bool *was_ignored= nullptr) + ulint heap_no, const trx_t *trx) { bool is_supremum = (heap_no == PAGE_HEAP_NO_SUPREMUM); for (lock_t* lock = lock_sys_t::get_first(cell, id, heap_no); lock; lock = lock_rec_get_next(heap_no, lock)) { - /* There is no need to lock lock_sys.wait_mutex to check - trx->lock.wait_trx here because the current function is - executed under the cell latch, and trx->lock.wait_trx - transaction can change wait_trx field only under the cell - latch, wait_trx trx_t object can not be deinitialized before - releasing all its locks, and during releasing the locks the - cell latch will also be requested. So while the cell latch is - held, lock->trx->lock.wait_trx can't be changed. There also - can't be lock loops for one record, because all waiting locks - of the record will always wait for the same lock of the record - in a cell array, and check for conflicting lock will always - start with the first lock for the heap_no, and go ahead with - the same order(the order of the locks in the cell array) */ - if (lock->is_waiting() && lock->trx->lock.wait_trx == trx) { - if (was_ignored) *was_ignored= true; - continue; - } - if (lock_rec_has_to_wait(true, trx, mode, lock, is_supremum)) { + if (lock_rec_has_to_wait(trx, mode, lock, is_supremum)) { return(lock); } } @@ -1065,39 +1056,25 @@ lock_sec_rec_some_has_impl( dict_index_t* index, /*!< in: secondary index */ const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */ { - trx_t* trx; - trx_id_t max_trx_id; - const page_t* page = page_align(rec); - - lock_sys.assert_unlocked(); - ut_ad(!dict_index_is_clust(index)); - ut_ad(page_rec_is_user_rec(rec)); - ut_ad(rec_offs_validate(rec, index, offsets)); - ut_ad(!rec_is_metadata(rec, *index)); - - max_trx_id = page_get_max_trx_id(page); - - /* Some transaction may have an implicit x-lock on the record only - if the max trx id for the page >= min trx id for the trx list, or - database recovery is running. */ - - if (max_trx_id < trx_sys.get_min_trx_id()) { - - trx = 0; - - } else if (!lock_check_trx_id_sanity(max_trx_id, rec, index, offsets)) { - - /* The page is corrupt: try to avoid a crash by returning 0 */ - trx = 0; + lock_sys.assert_unlocked(); + ut_ad(!dict_index_is_clust(index)); + ut_ad(page_rec_is_user_rec(rec)); + ut_ad(rec_offs_validate(rec, index, offsets)); + ut_ad(!rec_is_metadata(rec, *index)); - /* In this case it is possible that some transaction has an implicit - x-lock. We have to look in the clustered index. */ + const trx_id_t max_trx_id= page_get_max_trx_id(page_align(rec)); - } else { - trx = row_vers_impl_x_locked(caller_trx, rec, index, offsets); - } + /* Note: It is possible to have caller_trx->id == 0 in a locking read + if caller_trx has not modified any persistent tables. */ + if (!trx_sys.find_same_or_older(caller_trx, max_trx_id) || + !lock_check_trx_id_sanity(max_trx_id, rec, index, offsets)) + return nullptr; - return(trx); + /* We checked above that some active (or XA PREPARE) transaction exists + that is older than PAGE_MAX_TRX_ID. That is, some transaction may be + holding an implicit lock on the record. We have to look up the + clustered index record to find if it is (or was) the case. */ + return row_vers_impl_x_locked(caller_trx, rec, index, offsets); } /*********************************************************************//** @@ -1166,10 +1143,6 @@ without checking for deadlocks or conflicts. @param[in] index the index tree @param[in,out] trx transaction @param[in] holds_trx_mutex whether the caller holds trx->mutex -@param[in] insert_before_waiting if true, inserts new B-tree record lock -just after the last non-waiting lock of the current transaction which is -located before the first waiting for the current transaction lock, otherwise -the lock is inserted at the end of the queue @return created lock */ lock_t* lock_rec_create_low( @@ -1180,8 +1153,7 @@ lock_rec_create_low( ulint heap_no, dict_index_t* index, trx_t* trx, - bool holds_trx_mutex, - bool insert_before_waiting) + bool holds_trx_mutex) { lock_t* lock; ulint n_bytes; @@ -1256,36 +1228,7 @@ lock_rec_create_low( ut_ad(index->table->get_ref_count() || !index->table->can_be_evicted); const auto lock_hash = &lock_sys.hash_get(type_mode); - hash_cell_t& cell = *lock_hash->cell_get(page_id.fold()); - - if (insert_before_waiting - && !(type_mode & (LOCK_PREDICATE | LOCK_PRDT_PAGE))) { - /* Try to insert the lock just after the last non-waiting - lock of the current transaction which immediately - precedes the first waiting lock request. */ - - lock_t* last_non_waiting = nullptr; - - for (lock_t* l = lock_sys_t::get_first(cell, page_id, heap_no); - l; l = lock_rec_get_next(heap_no, l)) { - if (l->is_waiting() && l->trx->lock.wait_trx == trx) { - break; - } - if (l->trx == trx) { - last_non_waiting = l; - } - } - - if (!last_non_waiting) { - goto append_last; - } - - cell.insert_after(*last_non_waiting, *lock, &lock_t::hash); - } - else { -append_last: - cell.append(*lock, &lock_t::hash); - } + lock_hash->cell_get(page_id.fold())->append(*lock, &lock_t::hash); if (type_mode & LOCK_WAIT) { if (trx->lock.wait_trx) { @@ -1311,7 +1254,6 @@ lock_rec_create_low( /** Enqueue a waiting request for a lock which cannot be granted immediately. Check for deadlocks. -@param[in] c_lock conflicting lock @param[in] type_mode the requested lock mode (LOCK_S or LOCK_X) possibly ORed with LOCK_GAP or LOCK_REC_NOT_GAP, ORed with @@ -1345,6 +1287,14 @@ lock_rec_enqueue_waiting( trx_t* trx = thr_get_trx(thr); ut_ad(xtest() || trx->mutex_is_owner()); ut_ad(!trx->dict_operation_lock_mode); + /* Apart from Galera, only transactions that have waiting lock can be + chosen as deadlock victim. Only one lock can be waited for at a time, + and a transaction is associated with a single thread. That is why there + must not be waiting lock requests if the transaction is deadlock victim + and it is not WSREP. Galera transaction abort can be invoked from MDL + acquisition code when the transaction does not have waiting record + lock, that's why we check only deadlock victim bit here. */ + ut_ad(!(trx->lock.was_chosen_as_deadlock_victim & 1)); if (trx->mysql_thd && thd_lock_wait_timeout(trx->mysql_thd) == 0) { trx->error_state = DB_LOCK_WAIT_TIMEOUT; @@ -1362,7 +1312,6 @@ lock_rec_enqueue_waiting( } trx->lock.wait_thr = thr; - trx->lock.clear_deadlock_victim(); DBUG_LOG("ib_lock", "trx " << ib::hex(trx->id) << " waits for lock in index " << index->name @@ -1417,15 +1366,12 @@ which does NOT check for deadlocks or lock compatibility! @param[in] heap_no heap number of the record @param[in] index index of record @param[in,out] trx transaction -@param[in] caller_owns_trx_mutex TRUE if caller owns the transaction mutex -@param[in] insert_before_waiting true=insert B-tree record lock right -before a waiting lock request; false=insert the lock at the end of the queue */ +@param[in] caller_owns_trx_mutex TRUE if caller owns the transaction mutex */ TRANSACTIONAL_TARGET static void lock_rec_add_to_queue(unsigned type_mode, hash_cell_t &cell, const page_id_t id, const page_t *page, ulint heap_no, dict_index_t *index, - trx_t *trx, bool caller_owns_trx_mutex, - bool insert_before_waiting= false) + trx_t *trx, bool caller_owns_trx_mutex) { ut_d(lock_sys.hash_get(type_mode).assert_locked(id)); ut_ad(xtest() || caller_owns_trx_mutex == trx->mutex_is_owner()); @@ -1520,7 +1466,7 @@ static void lock_rec_add_to_queue(unsigned type_mode, hash_cell_t &cell, lock_rec_create_low(nullptr, type_mode, id, page, heap_no, index, trx, - caller_owns_trx_mutex, insert_before_waiting); + caller_owns_trx_mutex); } /*********************************************************************//** @@ -1548,7 +1494,14 @@ lock_rec_lock( que_thr_t* thr) /*!< in: query thread */ { trx_t *trx= thr_get_trx(thr); - + /* There must not be lock requests for reads or updates if transaction was + chosen as deadlock victim. Apart from Galera, only transactions that have + waiting lock may be chosen as deadlock victims. Only one lock can be waited + for at a time, and a transaction is associated with a single thread. Galera + transaction abort can be invoked from MDL acquisition code when the + transaction does not have waiting lock, that's why we check only deadlock + victim bit here. */ + ut_ad(!(trx->lock.was_chosen_as_deadlock_victim & 1)); ut_ad(!srv_read_only_mode); ut_ad(((LOCK_MODE_MASK | LOCK_TABLE) & mode) == LOCK_S || ((LOCK_MODE_MASK | LOCK_TABLE) & mode) == LOCK_X); @@ -1587,10 +1540,8 @@ lock_rec_lock( /* Do nothing if the trx already has a strong enough lock on rec */ if (!lock_rec_has_expl(mode, g.cell(), id, heap_no, trx)) { - bool was_ignored = false; if (lock_t *c_lock= lock_rec_other_has_conflicting(mode, g.cell(), id, - heap_no, trx, - &was_ignored)) + heap_no, trx)) /* If another transaction has a non-gap conflicting request in the queue, as this transaction does not @@ -1603,7 +1554,7 @@ lock_rec_lock( { /* Set the requested lock on the record. */ lock_rec_add_to_queue(mode, g.cell(), id, block->page.frame, heap_no, - index, trx, true, was_ignored); + index, trx, true); err= DB_SUCCESS_LOCKED_REC; } } @@ -1661,6 +1612,14 @@ lock_rec_has_to_wait_in_queue(const hash_cell_t &cell, const lock_t *wait_lock) if (heap_no < lock_rec_get_n_bits(lock) && (p[bit_offset] & bit_mask) && lock_has_to_wait(wait_lock, lock)) { +#ifdef WITH_WSREP + if (lock->trx->is_wsrep() && + wsrep_thd_order_before(wait_lock->trx->mysql_thd, + lock->trx->mysql_thd)) { + /* don't wait for another BF lock */ + continue; + } +#endif return(lock); } } @@ -1702,7 +1661,9 @@ void lock_sys_t::wait_resume(THD *thd, my_hrtime_t start, my_hrtime_t now) #ifdef HAVE_REPLICATION ATTRIBUTE_NOINLINE MY_ATTRIBUTE((nonnull)) -/** Report lock waits to parallel replication. +/** Report lock waits to parallel replication. Sets +trx->error_state= DB_DEADLOCK if trx->lock.was_chosen_as_deadlock_victim was +set when lock_sys.wait_mutex was unlocked. @param trx transaction that may be waiting for a lock @param wait_lock lock that is being waited for */ static void lock_wait_rpl_report(trx_t *trx) @@ -1717,7 +1678,8 @@ static void lock_wait_rpl_report(trx_t *trx) ut_ad(!(wait_lock->type_mode & LOCK_AUTO_INC)); /* This would likely be too large to attempt to use a memory transaction, even for wait_lock->is_table(). */ - if (!lock_sys.wr_lock_try()) + const bool nowait= lock_sys.wr_lock_try(); + if (!nowait) { mysql_mutex_unlock(&lock_sys.wait_mutex); lock_sys.wr_lock(SRW_LOCK_CALL); @@ -1727,6 +1689,10 @@ static void lock_wait_rpl_report(trx_t *trx) { func_exit: lock_sys.wr_unlock(); + /* trx->lock.was_chosen_as_deadlock_victim can be set when + lock_sys.wait_mutex was unlocked, let's check it. */ + if (!nowait && trx->lock.was_chosen_as_deadlock_victim) + trx->error_state= DB_DEADLOCK; return; } ut_ad(wait_lock->is_waiting()); @@ -1775,7 +1741,13 @@ dberr_t lock_wait(que_thr_t *thr) trx_t *trx= thr_get_trx(thr); if (trx->mysql_thd) - DEBUG_SYNC_C("lock_wait_suspend_thread_enter"); + DEBUG_SYNC_C("lock_wait_start"); + + /* Create the sync point for any quit from the function. */ + ut_d(SCOPE_EXIT([trx]() { + if (trx->mysql_thd) + DEBUG_SYNC_C("lock_wait_end"); + })); /* InnoDB system transactions may use the global value of innodb_lock_wait_timeout, because trx->mysql_thd == NULL. */ @@ -1806,11 +1778,8 @@ dberr_t lock_wait(que_thr_t *thr) { /* The lock has already been released or this transaction was chosen as a deadlock victim: no need to wait */ - if (trx->lock.was_chosen_as_deadlock_victim.fetch_and(byte(~1))) - trx->error_state= DB_DEADLOCK; - else - trx->error_state= DB_SUCCESS; - + trx->error_state= + trx->lock.was_chosen_as_deadlock_victim ? DB_DEADLOCK : DB_SUCCESS; return trx->error_state; } @@ -1845,21 +1814,26 @@ dberr_t lock_wait(que_thr_t *thr) wait_lock->un_member.tab_lock.table->id <= DICT_FIELDS_ID); thd_wait_begin(trx->mysql_thd, (type_mode & LOCK_TABLE) ? THD_WAIT_TABLE_LOCK : THD_WAIT_ROW_LOCK); - dberr_t error_state= DB_SUCCESS; + int err= 0; mysql_mutex_lock(&lock_sys.wait_mutex); if (trx->lock.wait_lock) { if (Deadlock::check_and_resolve(trx)) { ut_ad(!trx->lock.wait_lock); - error_state= DB_DEADLOCK; + trx->error_state= DB_DEADLOCK; goto end_wait; } } else + { + /* trx->lock.was_chosen_as_deadlock_victim can be changed before + lock_sys.wait_mutex is acquired, so let's check it once more. */ + trx->error_state= + trx->lock.was_chosen_as_deadlock_victim ? DB_DEADLOCK : DB_SUCCESS; goto end_wait; - + } if (row_lock_wait) lock_sys.wait_start(); @@ -1868,34 +1842,32 @@ dberr_t lock_wait(que_thr_t *thr) lock_wait_rpl_report(trx); #endif - trx->error_state= DB_SUCCESS; + if (trx->error_state != DB_SUCCESS) + goto check_trx_error; while (trx->lock.wait_lock) { - int err; + DEBUG_SYNC_C("lock_wait_before_suspend"); if (no_timeout) - { my_cond_wait(&trx->lock.cond, &lock_sys.wait_mutex.m_mutex); - err= 0; - } else err= my_cond_timedwait(&trx->lock.cond, &lock_sys.wait_mutex.m_mutex, &abstime); - error_state= trx->error_state; - switch (error_state) { +check_trx_error: + switch (trx->error_state) { case DB_DEADLOCK: case DB_INTERRUPTED: break; default: - ut_ad(error_state != DB_LOCK_WAIT_TIMEOUT); + ut_ad(trx->error_state != DB_LOCK_WAIT_TIMEOUT); /* Dictionary transactions must ignore KILL, because they could be executed as part of a multi-transaction DDL operation, such as rollback_inplace_alter_table() or ha_innobase::delete_table(). */ if (!trx->dict_operation && trx_is_interrupted(trx)) /* innobase_kill_query() can only set trx->error_state=DB_INTERRUPTED for any transaction that is attached to a connection. */ - error_state= DB_INTERRUPTED; + trx->error_state= DB_INTERRUPTED; else if (!err) continue; #ifdef WITH_WSREP @@ -1903,7 +1875,7 @@ dberr_t lock_wait(que_thr_t *thr) #endif else { - error_state= DB_LOCK_WAIT_TIMEOUT; + trx->error_state= DB_LOCK_WAIT_TIMEOUT; lock_sys.timeouts++; } } @@ -1913,6 +1885,7 @@ dberr_t lock_wait(que_thr_t *thr) if (row_lock_wait) lock_sys.wait_resume(trx->mysql_thd, suspend_time, my_hrtime_coarse()); + /* Cache trx->lock.wait_lock to avoid unnecessary atomic variable load */ if (lock_t *lock= trx->lock.wait_lock) { lock_sys_t::cancel(trx, lock); @@ -1923,23 +1896,30 @@ dberr_t lock_wait(que_thr_t *thr) mysql_mutex_unlock(&lock_sys.wait_mutex); thd_wait_end(trx->mysql_thd); - trx->error_state= error_state; - return error_state; + return trx->error_state; } /** Resume a lock wait */ -static void lock_wait_end(trx_t *trx) +template +void lock_wait_end(trx_t *trx) { mysql_mutex_assert_owner(&lock_sys.wait_mutex); ut_ad(trx->mutex_is_owner()); ut_d(const auto state= trx->state); - ut_ad(state == TRX_STATE_ACTIVE || state == TRX_STATE_PREPARED); - ut_ad(trx->lock.wait_thr); + ut_ad(state == TRX_STATE_COMMITTED_IN_MEMORY || state == TRX_STATE_ACTIVE || + state == TRX_STATE_PREPARED); + /* lock_wait() checks trx->lock.was_chosen_as_deadlock_victim flag before + requesting lock_sys.wait_mutex, and if the flag is set, it returns error, + what causes transaction rollback, which can reset trx->lock.wait_thr before + deadlock resolution starts cancelling victim's waiting lock. That's why we + don't check trx->lock.wait_thr here if the function was called from deadlock + resolution function. */ + ut_ad(from_deadlock || trx->lock.wait_thr); - if (trx->lock.was_chosen_as_deadlock_victim.fetch_and(byte(~1))) + if (trx->lock.was_chosen_as_deadlock_victim) { - ut_ad(state == TRX_STATE_ACTIVE); + ut_ad(from_deadlock || state == TRX_STATE_ACTIVE); trx->error_state= DB_DEADLOCK; } @@ -2165,49 +2145,58 @@ lock_rec_reset_and_release_wait(const hash_cell_t &cell, const page_id_t id, } } -/*************************************************************//** -Makes a record to inherit the locks (except LOCK_INSERT_INTENTION type) +/** Makes a record to inherit the locks (except LOCK_INSERT_INTENTION type) of another record as gap type locks, but does not reset the lock bits of the other record. Also waiting lock requests on rec are inherited as -GRANTED gap locks. */ -static -void -lock_rec_inherit_to_gap( -/*====================*/ - hash_cell_t& heir_cell, /*!< heir hash table cell */ - const page_id_t heir, /*!< in: page containing the - record which inherits */ - const hash_cell_t& donor_cell, /*!< donor hash table cell */ - const page_id_t donor, /*!< in: page containing the - record from which inherited; - does NOT reset the locks on - this record */ - const page_t* heir_page, /*!< in: heir page frame */ - ulint heir_heap_no, /*!< in: heap_no of the - inheriting record */ - ulint heap_no) /*!< in: heap_no of the - donating record */ +GRANTED gap locks. +@param heir_cell heir hash table cell +@param heir page containing the record which inherits +@param donor_cell donor hash table cell +@param donor page containing the record from which inherited; does NOT + reset the locks on this record +@param heir_page heir page frame +@param heir_heap_no heap_no of the inheriting record +@param heap_no heap_no of the donating record +@tparam from_split true if the function is invoked from + lock_update_split_(left|right)(), in this case not-gap + locks are not inherited to supremum if transaction + isolation level less or equal to READ COMMITTED */ +template +static void +lock_rec_inherit_to_gap(hash_cell_t &heir_cell, const page_id_t heir, + const hash_cell_t &donor_cell, const page_id_t donor, + const page_t *heir_page, ulint heir_heap_no, + ulint heap_no) { - /* At READ UNCOMMITTED or READ COMMITTED isolation level, - we do not want locks set - by an UPDATE or a DELETE to be inherited as gap type locks. But we - DO want S-locks/X-locks(taken for replace) set by a consistency - constraint to be inherited also then. */ + ut_ad(!from_split || heir_heap_no == PAGE_HEAP_NO_SUPREMUM); - for (lock_t* lock= lock_sys_t::get_first(donor_cell, donor, heap_no); - lock; - lock = lock_rec_get_next(heap_no, lock)) { - trx_t* lock_trx = lock->trx; - if (!lock->is_insert_intention() - && (lock_trx->isolation_level > TRX_ISO_READ_COMMITTED - || lock->mode() != - (lock_trx->duplicates ? LOCK_S : LOCK_X))) { - lock_rec_add_to_queue(LOCK_GAP | lock->mode(), - heir_cell, heir, heir_page, - heir_heap_no, - lock->index, lock_trx, false); - } - } + /* At READ UNCOMMITTED or READ COMMITTED isolation level, + we do not want locks set + by an UPDATE or a DELETE to be inherited as gap type locks. But we + DO want S-locks/X-locks(taken for replace) set by a consistency + constraint to be inherited also then. */ + + for (lock_t *lock= lock_sys_t::get_first(donor_cell, donor, heap_no); lock; + lock= lock_rec_get_next(heap_no, lock)) + { + trx_t *lock_trx= lock->trx; + if (!lock->trx->is_not_inheriting_locks() && + !lock->is_insert_intention() && + (lock_trx->isolation_level > TRX_ISO_READ_COMMITTED || + /* When we are in a page split (not purge), then we don't set a lock + on supremum if the donor lock type is LOCK_REC_NOT_GAP. That is, do + not create bogus gap locks for non-gap locks for READ UNCOMMITTED and + READ COMMITTED isolation levels. LOCK_ORDINARY and + LOCK_GAP require a gap before the record to be locked, that is why + setting lock on supremmum is necessary. */ + ((!from_split || !lock->is_record_not_gap()) && + lock->mode() != (lock_trx->duplicates ? LOCK_S : LOCK_X)))) + { + lock_rec_add_to_queue(LOCK_GAP | lock->mode(), heir_cell, heir, + heir_page, heir_heap_no, lock->index, lock_trx, + false); + } + } } /*************************************************************//** @@ -2231,7 +2220,8 @@ lock_rec_inherit_to_gap_if_gap_lock( for (lock_t *lock= lock_sys_t::get_first(g.cell(), id, heap_no); lock; lock= lock_rec_get_next(heap_no, lock)) - if (!lock->is_insert_intention() && (heap_no == PAGE_HEAP_NO_SUPREMUM || + if (!lock->trx->is_not_inheriting_locks() && + !lock->is_insert_intention() && (heap_no == PAGE_HEAP_NO_SUPREMUM || !lock->is_record_not_gap()) && !lock_table_has(lock->trx, lock->index->table, LOCK_X)) lock_rec_add_to_queue(LOCK_GAP | lock->mode(), @@ -2453,10 +2443,12 @@ lock_move_reorganize_page( lock_trx->mutex_unlock(); - if (new_heap_no == PAGE_HEAP_NO_SUPREMUM) + if (!rec1 || !rec2) { - ut_ad(old_heap_no == PAGE_HEAP_NO_SUPREMUM); - break; + ut_ad(!rec1 == !rec2); + ut_ad(new_heap_no == PAGE_HEAP_NO_SUPREMUM); + ut_ad(old_heap_no == PAGE_HEAP_NO_SUPREMUM); + break; } } @@ -2525,6 +2517,12 @@ lock_move_rec_list_end( FALSE); } + if (UNIV_UNLIKELY(!rec1 || !rec2)) + { + ut_ad("corrupted page" == 0); + return; + } + /* Copy lock requests on user records to new page and reset the lock bits on the old */ for (;;) @@ -2538,28 +2536,37 @@ lock_move_rec_list_end( if (comp) { rec1_heap_no= rec_get_heap_no_new(rec1); - if (rec1_heap_no == PAGE_HEAP_NO_SUPREMUM) + if (!(rec1= page_rec_get_next_low(rec1, TRUE))) + { + ut_ad(rec1_heap_no == PAGE_HEAP_NO_SUPREMUM); break; - + } rec2_heap_no= rec_get_heap_no_new(rec2); - rec1= page_rec_get_next_low(rec1, TRUE); rec2= page_rec_get_next_low(rec2, TRUE); } else { + ut_d(const rec_t *old1= rec1); rec1_heap_no= rec_get_heap_no_old(rec1); - - if (rec1_heap_no == PAGE_HEAP_NO_SUPREMUM) + if (!(rec1= page_rec_get_next_low(rec1, FALSE))) + { + ut_ad(rec1_heap_no == PAGE_HEAP_NO_SUPREMUM); break; - rec2_heap_no= rec_get_heap_no_old(rec2); + } - ut_ad(rec_get_data_size_old(rec1) == rec_get_data_size_old(rec2)); - ut_ad(!memcmp(rec1, rec2, rec_get_data_size_old(rec1))); + ut_ad(rec_get_data_size_old(old1) == rec_get_data_size_old(rec2)); + ut_ad(!memcmp(old1, rec2, rec_get_data_size_old(old1))); - rec1= page_rec_get_next_low(rec1, FALSE); + rec2_heap_no= rec_get_heap_no_old(rec2); rec2= page_rec_get_next_low(rec2, FALSE); } + if (UNIV_UNLIKELY(!rec2)) + { + ut_ad("corrupted page" == 0); + return; + } + trx_t *lock_trx= lock->trx; lock_trx->mutex_lock(); @@ -2652,6 +2659,12 @@ lock_move_rec_list_start( while (rec1 != rec) { + if (UNIV_UNLIKELY(!rec1 || !rec2)) + { + ut_ad("corrupted page" == 0); + return; + } + ut_ad(page_rec_is_metadata(rec1) == page_rec_is_metadata(rec2)); ut_d(const rec_t* const prev= rec1); @@ -2825,8 +2838,21 @@ lock_update_split_right( /* Inherit the locks to the supremum of left page from the successor of the infimum on right page */ - lock_rec_inherit_to_gap(g.cell1(), l, g.cell2(), r, left_block->page.frame, - PAGE_HEAP_NO_SUPREMUM, h); + lock_rec_inherit_to_gap(g.cell1(), l, g.cell2(), r, + left_block->page.frame, PAGE_HEAP_NO_SUPREMUM, + h); +} + +void lock_update_node_pointer(const buf_block_t *left_block, + const buf_block_t *right_block) +{ + const ulint h= lock_get_min_heap_no(right_block); + const page_id_t l{left_block->page.id()}; + const page_id_t r{right_block->page.id()}; + LockMultiGuard g{lock_sys.rec_hash, l, r}; + + lock_rec_inherit_to_gap(g.cell2(), r, g.cell1(), l, right_block->page.frame, + h, PAGE_HEAP_NO_SUPREMUM); } #ifdef UNIV_DEBUG @@ -2929,8 +2955,9 @@ lock_update_split_left( LockMultiGuard g{lock_sys.rec_hash, l, r}; /* Inherit the locks to the supremum of the left page from the successor of the infimum on the right page */ - lock_rec_inherit_to_gap(g.cell1(), l, g.cell2(), r, left_block->page.frame, - PAGE_HEAP_NO_SUPREMUM, h); + lock_rec_inherit_to_gap(g.cell1(), l, g.cell2(), r, + left_block->page.frame, PAGE_HEAP_NO_SUPREMUM, + h); } /** Update the lock table when a page is merged to the left. @@ -2943,11 +2970,15 @@ void lock_update_merge_left(const buf_block_t& left, const rec_t *orig_pred, ut_ad(left.page.frame == page_align(orig_pred)); const page_id_t l{left.page.id()}; + const rec_t *left_next_rec= page_rec_get_next_const(orig_pred); + if (UNIV_UNLIKELY(!left_next_rec)) + { + ut_ad("corrupted page" == 0); + return; + } /* This would likely be too large for a memory transaction. */ LockMultiGuard g{lock_sys.rec_hash, l, right}; - const rec_t *left_next_rec= page_rec_get_next_const(orig_pred); - if (!page_rec_is_supremum(left_next_rec)) { /* Inherit the locks on the supremum of the left page to the @@ -3094,12 +3125,18 @@ lock_update_insert( if (page_rec_is_comp(rec)) { receiver_heap_no = rec_get_heap_no_new(rec); - donator_heap_no = rec_get_heap_no_new( - page_rec_get_next_low(rec, TRUE)); + rec = page_rec_get_next_low(rec, TRUE); + if (UNIV_UNLIKELY(!rec)) { + return; + } + donator_heap_no = rec_get_heap_no_new(rec); } else { receiver_heap_no = rec_get_heap_no_old(rec); - donator_heap_no = rec_get_heap_no_old( - page_rec_get_next_low(rec, FALSE)); + rec = page_rec_get_next_low(rec, FALSE); + if (UNIV_UNLIKELY(!rec)) { + return; + } + donator_heap_no = rec_get_heap_no_old(rec); } lock_rec_inherit_to_gap_if_gap_lock( @@ -3166,6 +3203,8 @@ lock_rec_store_on_page_infimum( ut_ad(block->page.frame == page_align(rec)); const page_id_t id{block->page.id()}; + ut_d(SCOPE_EXIT( + []() { DEBUG_SYNC_C("lock_rec_store_on_page_infimum_end"); })); LockGuard g{lock_sys.rec_hash, id}; lock_rec_move(g.cell(), *block, id, g.cell(), id, @@ -3431,17 +3470,18 @@ lock_table_enqueue_waiting( ut_ad(trx->mutex_is_owner()); ut_ad(!trx->dict_operation_lock_mode); -#ifdef WITH_WSREP - if (trx->is_wsrep() && trx->lock.was_chosen_as_deadlock_victim) { - return(DB_DEADLOCK); - } -#endif /* WITH_WSREP */ - /* Enqueue the lock request that will wait to be granted */ lock_table_create(table, mode | LOCK_WAIT, trx, c_lock); trx->lock.wait_thr = thr; - trx->lock.clear_deadlock_victim(); + /* Apart from Galera, only transactions that have waiting lock + may be chosen as deadlock victims. Only one lock can be waited for at a + time, and a transaction is associated with a single thread. That is why + there must not be waiting lock requests if the transaction is deadlock + victim and it is not WSREP. Galera transaction abort can be invoked + from MDL acquisition code when the transaction does not have waiting + lock, that's why we check only deadlock victim bit here. */ + ut_ad(!(trx->lock.was_chosen_as_deadlock_victim & 1)); MONITOR_INC(MONITOR_TABLELOCK_WAIT); return(DB_LOCK_WAIT); @@ -3520,59 +3560,53 @@ static dberr_t lock_table_wsrep(dict_table_t *table, lock_mode mode, } #endif -/*********************************************************************//** -Locks the specified database table in the mode given. If the lock cannot -be granted immediately, the query thread is put to wait. -@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */ -dberr_t -lock_table( -/*=======*/ - dict_table_t* table, /*!< in/out: database table - in dictionary cache */ - lock_mode mode, /*!< in: lock mode */ - que_thr_t* thr) /*!< in: query thread */ +/** Acquire a table lock. +@param table table to be locked +@param fktable pointer to table, in case of a FOREIGN key check +@param mode lock mode +@param thr SQL execution thread +@retval DB_SUCCESS if the lock was acquired +@retval DB_DEADLOCK if a deadlock occurred, or fktable && *fktable != table +@retval DB_LOCK_WAIT if lock_wait() must be invoked */ +dberr_t lock_table(dict_table_t *table, dict_table_t *const*fktable, + lock_mode mode, que_thr_t *thr) { - trx_t* trx; - - if (table->is_temporary()) { - return DB_SUCCESS; - } + ut_ad(table); - trx = thr_get_trx(thr); + if (!fktable && table->is_temporary()) + return DB_SUCCESS; - /* Look for equal or stronger locks the same trx already - has on the table. No need to acquire LockMutexGuard here - because only this transaction can add/access table locks - to/from trx_t::table_locks. */ + ut_ad(fktable || table->get_ref_count() || !table->can_be_evicted); - if (lock_table_has(trx, table, mode) || srv_read_only_mode) { - return(DB_SUCCESS); - } - - /* Read only transactions can write to temp tables, we don't want - to promote them to RW transactions. Their updates cannot be visible - to other transactions. Therefore we can keep them out - of the read views. */ + trx_t *trx= thr_get_trx(thr); - if ((mode == LOCK_IX || mode == LOCK_X) - && !trx->read_only - && trx->rsegs.m_redo.rseg == 0) { + /* Look for equal or stronger locks the same trx already has on the + table. No need to acquire LockMutexGuard here because only the + thread that is executing a transaction can access trx_t::table_locks. */ + if (lock_table_has(trx, table, mode) || srv_read_only_mode) + return DB_SUCCESS; - trx_set_rw_mode(trx); - } + if ((mode == LOCK_IX || mode == LOCK_X) && + !trx->read_only && !trx->rsegs.m_redo.rseg) + trx_set_rw_mode(trx); #ifdef WITH_WSREP - if (trx->is_wsrep()) { - return lock_table_wsrep(table, mode, thr, trx); - } + if (trx->is_wsrep()) + return lock_table_wsrep(table, mode, thr, trx); #endif - lock_sys.rd_lock(SRW_LOCK_CALL); - table->lock_mutex_lock(); - dberr_t err = lock_table_low(table, mode, thr, trx); - table->lock_mutex_unlock(); - lock_sys.rd_unlock(); + lock_sys.rd_lock(SRW_LOCK_CALL); + dberr_t err; + if (fktable != nullptr && *fktable != table) + err= DB_DEADLOCK; + else + { + table->lock_mutex_lock(); + err= lock_table_low(table, mode, thr, trx); + table->lock_mutex_unlock(); + } + lock_sys.rd_unlock(); - return err; + return err; } /** Create a table lock object for a resurrected transaction. @@ -3687,52 +3721,50 @@ static void lock_table_dequeue(lock_t *in_lock, bool owns_wait_mutex) } } -/** Sets a lock on a table based on the given mode. -@param[in] table table to lock -@param[in,out] trx transaction -@param[in] mode LOCK_X or LOCK_S -@return error code or DB_SUCCESS. */ -dberr_t -lock_table_for_trx( - dict_table_t* table, - trx_t* trx, - enum lock_mode mode) -{ - mem_heap_t* heap; - que_thr_t* thr; - dberr_t err; - sel_node_t* node; - heap = mem_heap_create(512); - - node = sel_node_create(heap); - thr = pars_complete_graph_for_exec(node, trx, heap, NULL); - thr->graph->state = QUE_FORK_ACTIVE; - /* We use the select query graph as the dummy graph needed - in the lock module call */ - - thr = static_cast( - que_fork_get_first_thr( - static_cast(que_node_get_parent(thr)))); +/** Sets a lock on a table based on the given mode. +@param table table to lock +@param trx transaction +@param mode LOCK_X or LOCK_S +@param no_wait whether to skip handling DB_LOCK_WAIT +@return error code */ +dberr_t lock_table_for_trx(dict_table_t *table, trx_t *trx, lock_mode mode, + bool no_wait) +{ + mem_heap_t *heap= mem_heap_create(512); + sel_node_t *node= sel_node_create(heap); + que_thr_t *thr= pars_complete_graph_for_exec(node, trx, heap, nullptr); + thr->graph->state= QUE_FORK_ACTIVE; + + thr= static_cast + (que_fork_get_first_thr(static_cast + (que_node_get_parent(thr)))); run_again: - thr->run_node = thr; - thr->prev_node = thr->common.parent; + thr->run_node= thr; + thr->prev_node= thr->common.parent; + dberr_t err= lock_table(table, nullptr, mode, thr); - err = lock_table(table, mode, thr); - - trx->error_state = err; - - if (UNIV_UNLIKELY(err != DB_SUCCESS)) { - if (row_mysql_handle_errors(&err, trx, thr, NULL)) { - goto run_again; - } - } + switch (err) { + case DB_SUCCESS: + break; + case DB_LOCK_WAIT: + if (no_wait) + { + lock_sys.cancel_lock_wait_for_trx(trx); + break; + } + /* fall through */ + default: + trx->error_state= err; + if (row_mysql_handle_errors(&err, trx, thr, nullptr)) + goto run_again; + } - que_graph_free(thr->graph); - trx->op_info = ""; + que_graph_free(thr->graph); + trx->op_info= ""; - return(err); + return err; } /** Exclusively lock the data dictionary tables. @@ -3882,7 +3914,7 @@ TRANSACTIONAL_TARGET static bool lock_release_try(trx_t *trx) ut_ad(!lock->index->table->is_temporary()); ut_ad(lock->mode() != LOCK_X || lock->index->table->id >= DICT_HDR_FIRST_ID || - trx->dict_operation); + trx->dict_operation || trx->was_dict_operation); auto &lock_hash= lock_sys.hash_get(lock->type_mode); auto cell= lock_hash.cell_get(lock->un_member.rec_lock.page_id.fold()); auto latch= lock_sys_t::hash_table::latch(cell); @@ -3900,7 +3932,7 @@ TRANSACTIONAL_TARGET static bool lock_release_try(trx_t *trx) ut_ad(!table->is_temporary()); ut_ad(table->id >= DICT_HDR_FIRST_ID || (lock->mode() != LOCK_IX && lock->mode() != LOCK_X) || - trx->dict_operation); + trx->dict_operation || trx->was_dict_operation); if (!table->lock_mutex_trylock()) all_released= false; else @@ -3929,8 +3961,7 @@ void lock_release(trx_t *trx) #ifdef UNIV_DEBUG std::set to_evict; if (innodb_evict_tables_on_commit_debug && - !trx->is_recovered && !trx->dict_operation && - !trx->dict_operation_lock_mode) + !trx->is_recovered && !dict_sys.locked()) for (const auto& p : trx->mod_tables) if (!p.first->is_temporary()) to_evict.emplace(p.first->id); @@ -3957,7 +3988,7 @@ void lock_release(trx_t *trx) ut_ad(!lock->index->table->is_temporary()); ut_ad(lock->mode() != LOCK_X || lock->index->table->id >= DICT_HDR_FIRST_ID || - trx->dict_operation); + trx->dict_operation || trx->was_dict_operation); lock_rec_dequeue_from_page(lock, false); } else @@ -3966,7 +3997,7 @@ void lock_release(trx_t *trx) ut_ad(!table->is_temporary()); ut_ad(table->id >= DICT_HDR_FIRST_ID || (lock->mode() != LOCK_IX && lock->mode() != LOCK_X) || - trx->dict_operation); + trx->dict_operation || trx->was_dict_operation); lock_table_dequeue(lock, false); } @@ -3987,7 +4018,6 @@ void lock_release(trx_t *trx) mysql_mutex_unlock(&lock_sys.wait_mutex); } - trx->lock.was_chosen_as_deadlock_victim= false; trx->lock.n_rec_locks= 0; #ifdef UNIV_DEBUG @@ -4003,6 +4033,38 @@ void lock_release(trx_t *trx) #endif } +/** Release the explicit locks of a committing transaction while +dict_sys.latch is exclusively locked, +and release possible other transactions waiting because of these locks. */ +void lock_release_on_drop(trx_t *trx) +{ + ut_ad(lock_sys.is_writer()); + ut_ad(trx->mutex_is_owner()); + ut_ad(trx->dict_operation); + + while (lock_t *lock= UT_LIST_GET_LAST(trx->lock.trx_locks)) + { + ut_ad(lock->trx == trx); + if (!lock->is_table()) + { + ut_ad(!lock->index->table->is_temporary()); + ut_ad(lock->mode() != LOCK_X || + lock->index->table->id >= DICT_HDR_FIRST_ID || + trx->dict_operation); + lock_rec_dequeue_from_page(lock, false); + } + else + { + ut_d(dict_table_t *table= lock->un_member.tab_lock.table); + ut_ad(!table->is_temporary()); + ut_ad(table->id >= DICT_HDR_FIRST_ID || + (lock->mode() != LOCK_IX && lock->mode() != LOCK_X) || + trx->dict_operation); + lock_table_dequeue(lock, false); + } + } +} + /** Release non-exclusive locks on XA PREPARE, and wake up possible other transactions waiting because of these locks. @param trx transaction in XA PREPARE state @@ -4034,8 +4096,14 @@ static bool lock_release_on_prepare_try(trx_t *trx) if (!lock->is_table()) { ut_ad(!lock->index->table->is_temporary()); - if (lock->mode() == LOCK_X && !lock->is_gap()) + if (lock->mode() == LOCK_X && !lock->is_gap()) { + ut_ad(lock->trx->isolation_level > TRX_ISO_READ_COMMITTED || + /* Insert-intention lock is valid for supremum for isolation + level > TRX_ISO_READ_COMMITTED */ + lock->mode() == LOCK_X || + !lock_rec_get_nth_bit(lock, PAGE_HEAP_NO_SUPREMUM)); continue; + } auto &lock_hash= lock_sys.hash_get(lock->type_mode); auto cell= lock_hash.cell_get(lock->un_member.rec_lock.page_id.fold()); auto latch= lock_sys_t::hash_table::latch(cell); @@ -4081,6 +4149,8 @@ static bool lock_release_on_prepare_try(trx_t *trx) and release possible other transactions waiting because of these locks. */ void lock_release_on_prepare(trx_t *trx) { + auto _ = make_scope_exit([trx]() { trx->set_skip_lock_inheritance(); }); + for (ulint count= 5; count--; ) if (lock_release_on_prepare_try(trx)) return; @@ -4098,6 +4168,12 @@ void lock_release_on_prepare(trx_t *trx) ut_ad(!lock->index->table->is_temporary()); if (lock->mode() != LOCK_X || lock->is_gap()) lock_rec_dequeue_from_page(lock, false); + else + ut_ad(lock->trx->isolation_level > TRX_ISO_READ_COMMITTED || + /* Insert-intention lock is valid for supremum for isolation + level > TRX_ISO_READ_COMMITTED */ + lock->mode() == LOCK_X || + !lock_rec_get_nth_bit(lock, PAGE_HEAP_NO_SUPREMUM)); } else { @@ -4400,14 +4476,14 @@ lock_print_info_summary( fprintf(file, "Purge done for trx's n:o < " TRX_ID_FMT " undo n:o < " TRX_ID_FMT " state: %s\n" - "History list length %u\n", + "History list length %zu\n", purge_sys.tail.trx_no, purge_sys.tail.undo_no, purge_sys.enabled() ? (purge_sys.running() ? "running" : purge_sys.paused() ? "stopped" : "running but idle") : "disabled", - trx_sys.history_size()); + trx_sys.history_size_approx()); #ifdef PRINT_NUM_OF_LOCK_STRUCTS fprintf(file, @@ -4707,7 +4783,7 @@ lock_rec_queue_validate( wsrep_report_bf_lock_wait(impl_trx->mysql_thd, impl_trx->id); wsrep_report_bf_lock_wait(other_lock->trx->mysql_thd, other_lock->trx->id); - if (!lock_rec_has_expl(LOCK_S | LOCK_REC_NOT_GAP, + if (!lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP, cell, id, heap_no, impl_trx)) { ib::info() << "WSREP impl BF lock conflict"; @@ -4716,22 +4792,8 @@ lock_rec_queue_validate( #endif /* WITH_WSREP */ { ut_ad(other_lock->is_waiting()); - /* After MDEV-27025 fix the following case is - possible: - 1. trx 1 acquires S-lock; - 2. trx 2 creates X-lock waiting for trx 1; - 3. trx 1 creates implicit lock, as - lock_rec_other_has_conflicting() returns no - conflicting trx 2 X-lock, the explicit lock - will not be created; - 4. trx 3 creates waiting X-lock, - it will wait for S-lock of trx 1. - That is why we relaxing the condition here and - check only for S-lock. - */ - ut_ad(lock_rec_has_expl(LOCK_S - | LOCK_REC_NOT_GAP, - cell, id, heap_no, + ut_ad(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP, + cell, id, heap_no, impl_trx)); } } @@ -4826,25 +4888,25 @@ static bool lock_rec_validate_page(const buf_block_t *block, bool latched) holding a tablespace latch. */ if (!latched) for (i = nth_bit; i < lock_rec_get_n_bits(lock); i++) { - - if (i == PAGE_HEAP_NO_SUPREMUM - || lock_rec_get_nth_bit(lock, i)) { + bool locked = lock_rec_get_nth_bit(lock, i); + if (locked || i == PAGE_HEAP_NO_SUPREMUM) { rec = page_find_rec_with_heap_no(block->page.frame, i); ut_a(rec); - ut_ad(!lock_rec_get_nth_bit(lock, i) - || page_rec_is_leaf(rec)); - offsets = rec_get_offsets(rec, lock->index, offsets, - lock->index->n_core_fields, - ULINT_UNDEFINED, &heap); + ut_ad(!locked || page_rec_is_leaf(rec)); /* If this thread is holding the file space latch (fil_space_t::latch), the following check WILL break the latching order and may cause a deadlock of threads. */ - lock_rec_queue_validate( - true, id, rec, lock->index, offsets); + if (locked) { + offsets = rec_get_offsets(rec, lock->index, + offsets, lock->index->n_core_fields, + ULINT_UNDEFINED, &heap); + lock_rec_queue_validate(true, id, rec, + lock->index, offsets); + } nth_bit = i + 1; @@ -4903,9 +4965,7 @@ Validate a record lock's block */ static void lock_rec_block_validate(const page_id_t page_id) { /* The lock and the block that it is referring to may be freed at - this point. We pass BUF_GET_POSSIBLY_FREED to skip a debug check. - If the lock exists in lock_rec_validate_page() we assert - block->page.status != FREED. */ + this point. */ buf_block_t* block; mtr_t mtr; @@ -4922,17 +4982,11 @@ static void lock_rec_block_validate(const page_id_t page_id) block = buf_page_get_gen( page_id, space->zip_size(), - RW_X_LATCH, NULL, + RW_S_LATCH, NULL, BUF_GET_POSSIBLY_FREED, &mtr, &err); - if (err != DB_SUCCESS) { - ib::error() << "Lock rec block validate failed for tablespace " - << space->chain.start->name - << page_id << " err " << err; - } - - ut_ad(!block || block->page.is_freed() + ut_ad(!block || lock_rec_validate_page(block, space->is_latched())); mtr_commit(&mtr); @@ -4944,7 +4998,7 @@ static void lock_rec_block_validate(const page_id_t page_id) static my_bool lock_validate_table_locks(rw_trx_hash_element_t *element, void*) { lock_sys.assert_locked(); - mysql_mutex_lock(&element->mutex); + element->mutex.wr_lock(); if (element->trx) { check_trx_state(element->trx); @@ -4954,7 +5008,7 @@ static my_bool lock_validate_table_locks(rw_trx_hash_element_t *element, void*) if (lock->is_table()) lock_table_queue_validate(lock->un_member.tab_lock.table); } - mysql_mutex_unlock(&element->mutex); + element->mutex.wr_unlock(); return 0; } @@ -5013,13 +5067,15 @@ lock_rec_insert_check_and_lock( ut_ad(page_is_leaf(block->page.frame)); ut_ad(!index->table->is_temporary()); + const rec_t *next_rec= page_rec_get_next_const(rec); + if (UNIV_UNLIKELY(!next_rec || rec_is_metadata(next_rec, *index))) + return DB_CORRUPTION; + dberr_t err= DB_SUCCESS; bool inherit_in= *inherit; trx_t *trx= thr_get_trx(thr); - const rec_t *next_rec= page_rec_get_next_const(rec); ulint heap_no= page_rec_get_heap_no(next_rec); const page_id_t id{block->page.id()}; - ut_ad(!rec_is_metadata(next_rec, *index)); { LockGuard g{lock_sys.rec_hash, id}; @@ -5104,20 +5160,24 @@ has an implicit lock on the record. The transaction instance must have a reference count > 0 so that it can't be committed and freed before this function has completed. */ static -void +bool lock_rec_convert_impl_to_expl_for_trx( /*==================================*/ + trx_t* trx, /*!< in/out: active transaction */ const page_id_t id, /*!< in: page identifier */ const rec_t* rec, /*!< in: user record on page */ - dict_index_t* index, /*!< in: index of record */ - trx_t* trx, /*!< in/out: active transaction */ - ulint heap_no)/*!< in: rec heap number to lock */ + dict_index_t* index) /*!< in: index of record */ { + if (!trx) + return false; + ut_ad(trx->is_referenced()); ut_ad(page_rec_is_leaf(rec)); ut_ad(!rec_is_metadata(rec, *index)); DEBUG_SYNC_C("before_lock_rec_convert_impl_to_expl_for_trx"); + ulint heap_no= page_rec_get_heap_no(rec); + { LockGuard g{lock_sys.rec_hash, id}; trx->mutex_lock(); @@ -5127,13 +5187,14 @@ lock_rec_convert_impl_to_expl_for_trx( !lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP, g.cell(), id, heap_no, trx)) lock_rec_add_to_queue(LOCK_X | LOCK_REC_NOT_GAP, g.cell(), id, - page_align(rec), heap_no, index, trx, true, true); + page_align(rec), heap_no, index, trx, true); } trx->mutex_unlock(); trx->release_reference(); DEBUG_SYNC_C("after_lock_rec_convert_impl_to_expl_for_trx"); + return false; } @@ -5151,7 +5212,7 @@ static my_bool lock_rec_other_trx_holds_expl_callback( rw_trx_hash_element_t *element, lock_rec_other_trx_holds_expl_arg *arg) { - mysql_mutex_lock(&element->mutex); + element->mutex.wr_lock(); if (element->trx) { element->trx->mutex_lock(); @@ -5167,7 +5228,7 @@ static my_bool lock_rec_other_trx_holds_expl_callback( ut_ad(!expl_lock || expl_lock->trx == &arg->impl_trx); element->trx->mutex_unlock(); } - mysql_mutex_unlock(&element->mutex); + element->mutex.wr_unlock(); return 0; } @@ -5207,7 +5268,6 @@ static void lock_rec_other_trx_holds_expl(trx_t *caller_trx, trx_t *trx, } #endif /* UNIV_DEBUG */ - /** If an implicit x-lock exists on a record, convert it to an explicit one. Often, this is called by a transaction that is about to enter a lock wait @@ -5219,12 +5279,14 @@ This may also be called by the same transaction that is already holding an implicit exclusive lock on the record. In this case, no explicit lock should be created. +@tparam is_primary whether the index is the primary key @param[in,out] caller_trx current transaction @param[in] id index tree leaf page identifier @param[in] rec record on the leaf page @param[in] index the index of the record @param[in] offsets rec_get_offsets(rec,index) @return whether caller_trx already holds an exclusive lock on rec */ +template static bool lock_rec_convert_impl_to_expl( @@ -5242,8 +5304,9 @@ lock_rec_convert_impl_to_expl( ut_ad(!page_rec_is_comp(rec) == !rec_offs_comp(offsets)); ut_ad(page_rec_is_leaf(rec)); ut_ad(!rec_is_metadata(rec, *index)); + ut_ad(index->is_primary() == is_primary); - if (dict_index_is_clust(index)) { + if (is_primary) { trx_id_t trx_id; trx_id = lock_clust_rec_some_has_impl(rec, index, offsets); @@ -5269,20 +5332,7 @@ lock_rec_convert_impl_to_expl( ut_d(lock_rec_other_trx_holds_expl(caller_trx, trx, rec, id)); } - if (trx) { - ulint heap_no = page_rec_get_heap_no(rec); - - ut_ad(trx->is_referenced()); - - /* If the transaction is still active and has no - explicit x-lock set on the record, set one for it. - trx cannot be committed until the ref count is zero. */ - - lock_rec_convert_impl_to_expl_for_trx( - id, rec, index, trx, heap_no); - } - - return false; + return lock_rec_convert_impl_to_expl_for_trx(trx, id, rec, index); } /*********************************************************************//** @@ -5321,8 +5371,9 @@ lock_clust_rec_modify_check_and_lock( /* If a transaction has no explicit x-lock set on the record, set one for it */ - if (lock_rec_convert_impl_to_expl(thr_get_trx(thr), block->page.id(), - rec, index, offsets)) { + if (lock_rec_convert_impl_to_expl(thr_get_trx(thr), + block->page.id(), + rec, index, offsets)) { /* We already hold an implicit exclusive lock. */ return DB_SUCCESS; } @@ -5463,7 +5514,6 @@ lock_sec_rec_read_check_and_lock( que_thr_t* thr) /*!< in: query thread */ { dberr_t err; - ulint heap_no; ut_ad(!dict_index_is_clust(index)); ut_ad(!dict_index_is_online_ddl(index)); @@ -5480,22 +5530,17 @@ lock_sec_rec_read_check_and_lock( return(DB_SUCCESS); } - const page_id_t id{block->page.id()}; - ut_ad(!rec_is_metadata(rec, *index)); - heap_no = page_rec_get_heap_no(rec); - - /* Some transaction may have an implicit x-lock on the record only - if the max trx id for the page >= min trx id for the trx list or a - database recovery is running. */ trx_t *trx = thr_get_trx(thr); - if (!lock_table_has(trx, index->table, LOCK_X) - && !page_rec_is_supremum(rec) - && page_get_max_trx_id(block->page.frame) - >= trx_sys.get_min_trx_id() - && lock_rec_convert_impl_to_expl(thr_get_trx(thr), id, rec, - index, offsets) + + if (lock_table_has(trx, index->table, mode)) { + return DB_SUCCESS; + } + + if (!page_rec_is_supremum(rec) + && lock_rec_convert_impl_to_expl( + trx, block->page.id(), rec, index, offsets) && gap_mode == LOCK_REC_NOT_GAP) { /* We already hold an implicit exclusive lock. */ return DB_SUCCESS; @@ -5514,13 +5559,14 @@ lock_sec_rec_read_check_and_lock( #endif /* WITH_WSREP */ err = lock_rec_lock(false, gap_mode | mode, - block, heap_no, index, thr); + block, page_rec_get_heap_no(rec), index, thr); #ifdef WITH_WSREP if (trx->wsrep == 3) trx->wsrep = 1; #endif /* WITH_WSREP */ - ut_ad(lock_rec_queue_validate(false, id, rec, index, offsets)); + ut_ad(lock_rec_queue_validate(false, block->page.id(), + rec, index, offsets)); return(err); } @@ -5577,7 +5623,8 @@ lock_clust_rec_read_check_and_lock( trx_t *trx = thr_get_trx(thr); if (!lock_table_has(trx, index->table, LOCK_X) && heap_no != PAGE_HEAP_NO_SUPREMUM - && lock_rec_convert_impl_to_expl(trx, id, rec, index, offsets) + && lock_rec_convert_impl_to_expl(trx, id, + rec, index, offsets) && gap_mode == LOCK_REC_NOT_GAP) { /* We already hold an implicit exclusive lock. */ return DB_SUCCESS; @@ -5685,13 +5732,16 @@ static void lock_release_autoinc_locks(trx_t *trx) } /** Cancel a waiting lock request and release possibly waiting transactions */ -static void lock_cancel_waiting_and_release(lock_t *lock) +template +void lock_cancel_waiting_and_release(lock_t *lock) { lock_sys.assert_locked(*lock); mysql_mutex_assert_owner(&lock_sys.wait_mutex); trx_t *trx= lock->trx; trx->mutex_lock(); - ut_ad(trx->state == TRX_STATE_ACTIVE); + ut_d(const auto trx_state= trx->state); + ut_ad(trx_state == TRX_STATE_COMMITTED_IN_MEMORY || + trx_state == TRX_STATE_ACTIVE); if (!lock->is_table()) lock_rec_dequeue_from_page(lock, true); @@ -5710,11 +5760,11 @@ static void lock_cancel_waiting_and_release(lock_t *lock) /* Reset the wait flag and the back pointer to lock in trx. */ lock_reset_lock_and_trx_wait(lock); - lock_wait_end(trx); + lock_wait_end(trx); + trx->mutex_unlock(); } -#ifdef WITH_WSREP -TRANSACTIONAL_TARGET + void lock_sys_t::cancel_lock_wait_for_trx(trx_t *trx) { lock_sys.wr_lock(SRW_LOCK_CALL); @@ -5728,21 +5778,33 @@ void lock_sys_t::cancel_lock_wait_for_trx(trx_t *trx) lock_sys.wr_unlock(); mysql_mutex_unlock(&lock_sys.wait_mutex); } -#endif /* WITH_WSREP */ /** Cancel a waiting lock request. @tparam check_victim whether to check for DB_DEADLOCK -@param lock waiting lock request @param trx active transaction +@param lock waiting lock request @retval DB_SUCCESS if no lock existed @retval DB_DEADLOCK if trx->lock.was_chosen_as_deadlock_victim was set @retval DB_LOCK_WAIT if the lock was canceled */ template dberr_t lock_sys_t::cancel(trx_t *trx, lock_t *lock) { + DEBUG_SYNC_C("lock_sys_t_cancel_enter"); mysql_mutex_assert_owner(&lock_sys.wait_mutex); - ut_ad(trx->lock.wait_lock == lock); ut_ad(trx->state == TRX_STATE_ACTIVE); + /* trx->lock.wait_lock may be changed by other threads as long as + we are not holding lock_sys.latch. + + So, trx->lock.wait_lock==lock does not necessarily hold, but both + pointers should be valid, because other threads cannot assign + trx->lock.wait_lock=nullptr (or invalidate *lock) while we are + holding lock_sys.wait_mutex. Also, the type of trx->lock.wait_lock + (record or table lock) cannot be changed by other threads. So, it is + safe to call lock->is_table() while not holding lock_sys.latch. If + we have to release and reacquire lock_sys.wait_mutex, we must reread + trx->lock.wait_lock. We must also reread trx->lock.wait_lock after + lock_sys.latch acquiring, as it can be changed to not-null in lock moving + functions even if we hold lock_sys.wait_mutex. */ dberr_t err= DB_SUCCESS; /* This would be too large for a memory transaction, except in the DB_DEADLOCK case, which was already tested in lock_trx_handle_wait(). */ @@ -5754,14 +5816,25 @@ dberr_t lock_sys_t::cancel(trx_t *trx, lock_t *lock) lock_sys.rd_lock(SRW_LOCK_CALL); mysql_mutex_lock(&lock_sys.wait_mutex); lock= trx->lock.wait_lock; - if (!lock); - else if (check_victim && trx->lock.was_chosen_as_deadlock_victim) + /* Even if waiting lock was cancelled while lock_sys.wait_mutex was + unlocked, we need to return deadlock error if transaction was chosen + as deadlock victim to rollback it */ + if (check_victim && trx->lock.was_chosen_as_deadlock_victim) err= DB_DEADLOCK; - else + else if (lock) goto resolve_table_lock; } else { + /* This function is invoked from the thread which executes the + transaction. Table locks are requested before record locks. Some other + transaction can't change trx->lock.wait_lock from table to record for the + current transaction at this point, because the current transaction has not + requested record locks yet. There is no need to move any table locks by + other threads. And trx->lock.wait_lock can't be set to null while we are + holding lock_sys.wait_mutex. That's why there is no need to reload + trx->lock.wait_lock here. */ + ut_ad(lock == trx->lock.wait_lock); resolve_table_lock: dict_table_t *table= lock->un_member.tab_lock.table; if (!table->lock_mutex_trylock()) @@ -5772,6 +5845,7 @@ dberr_t lock_sys_t::cancel(trx_t *trx, lock_t *lock) mysql_mutex_unlock(&lock_sys.wait_mutex); table->lock_mutex_lock(); mysql_mutex_lock(&lock_sys.wait_mutex); + /* Cache trx->lock.wait_lock under the corresponding latches. */ lock= trx->lock.wait_lock; if (!lock) goto retreat; @@ -5781,6 +5855,10 @@ dberr_t lock_sys_t::cancel(trx_t *trx, lock_t *lock) goto retreat; } } + else + /* Cache trx->lock.wait_lock under the corresponding latches if + it was not cached yet */ + lock= trx->lock.wait_lock; if (lock->is_waiting()) lock_cancel_waiting_and_release(lock); /* Even if lock->is_waiting() did not hold above, we must return @@ -5804,15 +5882,21 @@ dberr_t lock_sys_t::cancel(trx_t *trx, lock_t *lock) mysql_mutex_unlock(&lock_sys.wait_mutex); lock_sys.wr_lock(SRW_LOCK_CALL); mysql_mutex_lock(&lock_sys.wait_mutex); + /* Cache trx->lock.wait_lock under the corresponding latches. */ lock= trx->lock.wait_lock; - if (!lock); - else if (check_victim && trx->lock.was_chosen_as_deadlock_victim) + /* Even if waiting lock was cancelled while lock_sys.wait_mutex was + unlocked, we need to return deadlock error if transaction was chosen + as deadlock victim to rollback it */ + if (check_victim && trx->lock.was_chosen_as_deadlock_victim) err= DB_DEADLOCK; - else + else if (lock) goto resolve_record_lock; } else { + /* Cache trx->lock.wait_lock under the corresponding latches if + it was not cached yet */ + lock= trx->lock.wait_lock; resolve_record_lock: if (lock->is_waiting()) lock_cancel_waiting_and_release(lock); @@ -5834,6 +5918,7 @@ dberr_t lock_sys_t::cancel(trx_t *trx, lock_t *lock) void lock_sys_t::cancel(trx_t *trx) { mysql_mutex_lock(&lock_sys.wait_mutex); + /* Cache trx->lock.wait_lock to avoid unnecessary atomic variable load */ if (lock_t *lock= trx->lock.wait_lock) { /* Dictionary transactions must be immune to KILL, because they @@ -5879,6 +5964,7 @@ lock_unlock_table_autoinc( /** Handle a pending lock wait (DB_LOCK_WAIT) in a semi-consistent read while holding a clustered index leaf page latch. + @param trx transaction that is or was waiting for a lock @retval DB_SUCCESS if the lock was granted @retval DB_DEADLOCK if the transaction must be aborted due to a deadlock @@ -5886,14 +5972,21 @@ while holding a clustered index leaf page latch. lock request was released */ dberr_t lock_trx_handle_wait(trx_t *trx) { + DEBUG_SYNC_C("lock_trx_handle_wait_enter"); if (trx->lock.was_chosen_as_deadlock_victim) return DB_DEADLOCK; + DEBUG_SYNC_C("lock_trx_handle_wait_before_unlocked_wait_lock_check"); + /* trx->lock.was_chosen_as_deadlock_victim must always be set before + trx->lock.wait_lock if the transaction was chosen as deadlock victim, + the function must not return DB_SUCCESS if + trx->lock.was_chosen_as_deadlock_victim is set. */ if (!trx->lock.wait_lock) - return DB_SUCCESS; + return trx->lock.was_chosen_as_deadlock_victim ? DB_DEADLOCK : DB_SUCCESS; dberr_t err= DB_SUCCESS; mysql_mutex_lock(&lock_sys.wait_mutex); if (trx->lock.was_chosen_as_deadlock_victim) err= DB_DEADLOCK; + /* Cache trx->lock.wait_lock to avoid unnecessary atomic variable load */ else if (lock_t *wait_lock= trx->lock.wait_lock) err= lock_sys_t::cancel(trx, wait_lock); lock_sys.deadlock_check(); @@ -5913,7 +6006,7 @@ static my_bool lock_table_locks_lookup(rw_trx_hash_element_t *element, const dict_table_t *table) { lock_sys.assert_locked(); - mysql_mutex_lock(&element->mutex); + element->mutex.wr_lock(); if (element->trx) { element->trx->mutex_lock(); @@ -5937,7 +6030,7 @@ static my_bool lock_table_locks_lookup(rw_trx_hash_element_t *element, } element->trx->mutex_unlock(); } - mysql_mutex_unlock(&element->mutex); + element->mutex.wr_unlock(); return 0; } #endif /* UNIV_DEBUG */ @@ -6197,6 +6290,7 @@ namespace Deadlock for (trx_t *next= cycle;;) { next= next->lock.wait_trx; + l++; const undo_no_t next_weight= TRX_WEIGHT(next) | (next->mysql_thd && #ifdef WITH_WSREP @@ -6291,8 +6385,11 @@ namespace Deadlock ut_ad(victim->state == TRX_STATE_ACTIVE); + /* victim->lock.was_chosen_as_deadlock_victim must always be set before + releasing waiting locks and reseting trx->lock.wait_lock */ victim->lock.was_chosen_as_deadlock_victim= true; - lock_cancel_waiting_and_release(victim->lock.wait_lock); + DEBUG_SYNC_C("deadlock_report_before_lock_releasing"); + lock_cancel_waiting_and_release(victim->lock.wait_lock); #ifdef WITH_WSREP if (victim->is_wsrep() && wsrep_thd_is_SR(victim->mysql_thd)) wsrep_handle_SR_rollback(trx->mysql_thd, victim->mysql_thd); @@ -6403,11 +6500,16 @@ void lock_update_split_and_merge( const page_id_t l{left_block->page.id()}; const page_id_t r{right_block->page.id()}; + const rec_t *left_next_rec= page_rec_get_next_const(orig_pred); + if (UNIV_UNLIKELY(!left_next_rec)) + { + ut_ad("corrupted page" == 0); + return; + } + ut_ad(!page_rec_is_metadata(left_next_rec)); /* This would likely be too large for a memory transaction. */ LockMultiGuard g{lock_sys.rec_hash, l, r}; - const rec_t *left_next_rec= page_rec_get_next_const(orig_pred); - ut_ad(!page_rec_is_metadata(left_next_rec)); /* Inherit the locks on the supremum of the left page to the first record which was moved from the right page */ diff --git a/storage/innobase/lock/lock0prdt.cc b/storage/innobase/lock/lock0prdt.cc index e924d46bd3f63..2975659138d4e 100644 --- a/storage/innobase/lock/lock0prdt.cc +++ b/storage/innobase/lock/lock0prdt.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2021, MariaDB Corporation. +Copyright (c) 2018, 2022, 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 @@ -799,6 +799,9 @@ lock_place_prdt_page_lock( ut_ad(index->is_spatial()); ut_ad(!dict_index_is_online_ddl(index)); + if (index->table->is_temporary()) { + return DB_SUCCESS; + } /* Another transaction cannot have an implicit lock on the record, because when we come here, we already have modified the clustered diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 69ee386293ff6..98df975b07837 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -61,9 +61,9 @@ Every change to a contents of a data page must be done through mtr_t, and mtr_t::commit() will write log records to the InnoDB redo log. */ -MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) +alignas(CPU_LEVEL1_DCACHE_LINESIZE) static group_commit_lock flush_lock; -MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) +alignas(CPU_LEVEL1_DCACHE_LINESIZE) static group_commit_lock write_lock; /** Redo log system */ @@ -74,52 +74,25 @@ log_t log_sys; #define LOG_BUF_FLUSH_MARGIN ((4 * 4096) /* cf. log_t::append_prepare() */ \ + (4U << srv_page_size_shift)) -/** Calculate the recommended highest values for lsn - last_checkpoint_lsn -and lsn - buf_pool.get_oldest_modification(). -@param[in] file_size requested innodb_log_file_size -@retval true on success -@retval false if the smallest log group is too small to -accommodate the number of OS threads in the database server */ -bool -log_set_capacity(ulonglong file_size) +void log_t::set_capacity() { - mysql_mutex_assert_owner(&log_sys.mutex); - +#ifndef SUX_LOCK_GENERIC + ut_ad(log_sys.latch.is_write_locked()); +#endif /* Margin for the free space in the smallest log, before a new query step which modifies the database, is started */ - const size_t LOG_CHECKPOINT_FREE_PER_THREAD = 4U - << srv_page_size_shift; - const size_t LOG_CHECKPOINT_EXTRA_FREE = 8U << srv_page_size_shift; - - lsn_t margin; - ulint free; - lsn_t smallest_capacity = file_size - log_t::START_OFFSET; + lsn_t smallest_capacity = srv_log_file_size - log_t::START_OFFSET; /* Add extra safety */ smallest_capacity -= smallest_capacity / 10; - /* For each OS thread we must reserve so much free space in the - smallest log group that it can accommodate the log entries produced - by single query steps: running out of free log space is a serious - system error which requires rebooting the database. */ - - free = LOG_CHECKPOINT_FREE_PER_THREAD * 10 - + LOG_CHECKPOINT_EXTRA_FREE; - if (free >= smallest_capacity / 2) { - sql_print_error("InnoDB: innodb_log_file_size is too small." - " %s", INNODB_PARAMETERS_MSG); - return false; - } - - margin = smallest_capacity - free; - margin = margin - margin / 10; /* Add still some extra safety */ + lsn_t margin = smallest_capacity - (48 << srv_page_size_shift); + margin -= margin / 10; /* Add still some extra safety */ log_sys.log_capacity = smallest_capacity; log_sys.max_modified_age_async = margin - margin / 8; log_sys.max_checkpoint_age = margin; - - return(true); } /** Initialize the redo log subsystem. */ @@ -128,14 +101,8 @@ void log_t::create() ut_ad(this == &log_sys); ut_ad(!is_initialised()); -#if defined(__aarch64__) - mysql_mutex_init(log_sys_mutex_key, &mutex, MY_MUTEX_INIT_FAST); - mysql_mutex_init( - log_flush_order_mutex_key, &flush_order_mutex, MY_MUTEX_INIT_FAST); -#else - mysql_mutex_init(log_sys_mutex_key, &mutex, nullptr); - mysql_mutex_init(log_flush_order_mutex_key, &flush_order_mutex, nullptr); -#endif + latch.SRW_LOCK_INIT(log_latch_key); + init_lsn_lock(); /* LSN 0 and 1 are reserved; @see buf_page_t::oldest_modification_ */ lsn.store(FIRST_LSN, std::memory_order_relaxed); @@ -159,17 +126,12 @@ void log_t::create() max_buf_free= buf_size / LOG_BUF_FLUSH_RATIO - LOG_BUF_FLUSH_MARGIN; set_check_flush_or_checkpoint(); - n_log_ios_old= n_log_ios; - last_printout_time= time(NULL); - last_checkpoint_lsn= FIRST_LSN; - n_log_ios= 0; - n_log_ios_old= 0; log_capacity= 0; max_modified_age_async= 0; max_checkpoint_age= 0; next_checkpoint_lsn= 0; - n_pending_checkpoint_writes= 0; + checkpoint_pending= false; buf_free= 0; @@ -180,7 +142,7 @@ dberr_t log_file_t::close() noexcept { ut_a(is_opened()); - if (!os_file_close(m_file)) + if (!os_file_close_func(m_file)) return DB_ERROR; m_file= OS_FILE_CLOSED; @@ -190,14 +152,16 @@ dberr_t log_file_t::close() noexcept dberr_t log_file_t::read(os_offset_t offset, span buf) noexcept { ut_ad(is_opened()); - return os_file_read(IORequestRead, m_file, buf.data(), offset, buf.size()); + return os_file_read(IORequestRead, m_file, buf.data(), offset, buf.size(), + nullptr); } -dberr_t log_file_t::write(os_offset_t offset, span buf) noexcept +void log_file_t::write(os_offset_t offset, span buf) noexcept { ut_ad(is_opened()); - return os_file_write(IORequestWrite, "ib_logfile0", m_file, - buf.data(), offset, buf.size()); + if (dberr_t err= os_file_write(IORequestWrite, "ib_logfile0", m_file, + buf.data(), offset, buf.size())) + ib::fatal() << "write(\"ib_logfile0\") returned " << err; } #ifdef HAVE_PMEM @@ -213,7 +177,7 @@ void log_t::attach(log_file_t file, os_offset_t size) #ifdef HAVE_PMEM ut_ad(!buf); ut_ad(!flush_buf); - if (size && !(size_t(size) & 4095)) + if (size && !(size_t(size) & 4095) && srv_operation != SRV_OPERATION_BACKUP) { void *ptr= my_mmap(0, size_t(size), @@ -225,11 +189,16 @@ void log_t::attach(log_file_t file, os_offset_t size) struct stat st; if (!fstat(log.m_file, &st)) { + MSAN_STAT_WORKAROUND(&st); const auto st_dev= st.st_dev; - if (!stat("/dev/shm", &st) && st.st_dev == st_dev) - ptr= my_mmap(0, size_t(size), - srv_read_only_mode ? PROT_READ : PROT_READ | PROT_WRITE, - MAP_SHARED, log.m_file, 0); + if (!stat("/dev/shm", &st)) + { + MSAN_STAT_WORKAROUND(&st); + if (st.st_dev == st_dev) + ptr= my_mmap(0, size_t(size), srv_read_only_mode + ? PROT_READ : PROT_READ | PROT_WRITE, + MAP_SHARED, log.m_file, 0); + } } } #endif /* __linux__ */ @@ -241,6 +210,8 @@ void log_t::attach(log_file_t file, os_offset_t size) #if defined __linux__ || defined _WIN32 set_block_size(CPU_LEVEL1_DCACHE_LINESIZE); #endif + log_maybe_unbuffered= true; + log_buffered= false; return; } } @@ -252,16 +223,11 @@ void log_t::attach(log_file_t file, os_offset_t size) #endif #if defined __linux__ || defined _WIN32 - if (!block_size) - set_block_size(512); -# ifdef __linux__ - else if (srv_file_flush_method != SRV_O_DSYNC) - sql_print_information("InnoDB: Buffered log writes (block size=%u bytes)", - block_size); -#endif - else - sql_print_information("InnoDB: File system buffers for log" - " disabled (block size=%u bytes)", block_size); + sql_print_information("InnoDB: %s (block size=%u bytes)", + log_buffered + ? "Buffered log writes" + : "File system buffers for log disabled", + block_size); #endif #ifdef HAVE_PMEM @@ -272,7 +238,9 @@ void log_t::attach(log_file_t file, os_offset_t size) void log_t::create(lsn_t lsn) noexcept { - mysql_mutex_assert_owner(&mutex); +#ifndef SUX_LOCK_GENERIC + ut_ad(latch.is_write_locked()); +#endif ut_ad(!recv_no_log_write); ut_ad(is_latest()); ut_ad(this == &log_sys); @@ -355,6 +323,62 @@ void log_t::close_file() ib::fatal() << "closing ib_logfile0 failed: " << err; } +#if defined __linux__ || defined _WIN32 +/** Acquire all latches that protect the log. */ +static void log_resize_acquire() +{ + if (!log_sys.is_pmem()) + { + while (flush_lock.acquire(log_sys.get_lsn() + 1, nullptr) != + group_commit_lock::ACQUIRED); + while (write_lock.acquire(log_sys.get_lsn() + 1, nullptr) != + group_commit_lock::ACQUIRED); + } + + log_sys.latch.wr_lock(SRW_LOCK_CALL); +} + +/** Release the latches that protect the log. */ +void log_resize_release() +{ + log_sys.latch.wr_unlock(); + + if (!log_sys.is_pmem()) + { + lsn_t lsn1= write_lock.release(write_lock.value()); + lsn_t lsn2= flush_lock.release(flush_lock.value()); + if (lsn1 || lsn2) + log_write_up_to(std::max(lsn1, lsn2), true, nullptr); + } +} + +/** Try to enable or disable file system caching (update log_buffered) */ +void log_t::set_buffered(bool buffered) +{ + if (!log_maybe_unbuffered || is_pmem() || high_level_read_only) + return; + log_resize_acquire(); + if (!resize_in_progress() && is_opened() && bool(log_buffered) != buffered) + { + os_file_close_func(log.m_file); + log.m_file= OS_FILE_CLOSED; + std::string path{get_log_file_path()}; + log_buffered= buffered; + bool success; + log.m_file= os_file_create_func(path.c_str(), + OS_FILE_OPEN, OS_FILE_NORMAL, OS_LOG_FILE, + false, &success); + ut_a(log.m_file != OS_FILE_CLOSED); + sql_print_information("InnoDB: %s (block size=%u bytes)", + log_buffered + ? "Buffered log writes" + : "File system buffers for log disabled", + block_size); + } + log_resize_release(); +} +#endif + /** Write an aligned buffer to ib_logfile0. @param buf buffer to be written @param len length of data to be written @@ -516,7 +540,6 @@ static size_t log_pad(lsn_t lsn, size_t pad, byte *begin, byte *extra) inline void log_t::persist(lsn_t lsn) noexcept { ut_ad(is_pmem()); - mysql_mutex_assert_not_owner(&mutex); ut_ad(!write_lock.is_owner()); ut_ad(!flush_lock.is_owner()); @@ -551,13 +574,16 @@ inline void log_t::persist(lsn_t lsn) noexcept } #endif -/** Write buf to ib_logfile0 and release mutex. -@return new write target -@retval 0 if everything was written */ -inline lsn_t log_t::write_buf() noexcept +/** Write buf to ib_logfile0. +@tparam release_latch whether to invoke latch.wr_unlock() +@return lsn of a callback pending on write_lock +@retval 0 if everything was written +*/ +template inline lsn_t log_t::write_buf() noexcept { - mysql_mutex_assert_owner(&mutex); - +#ifndef SUX_LOCK_GENERIC + ut_ad(latch.is_write_locked()); +#endif ut_ad(!srv_read_only_mode); ut_ad(!is_pmem()); @@ -565,7 +591,8 @@ inline lsn_t log_t::write_buf() noexcept if (write_lsn >= lsn) { - mysql_mutex_unlock(&mutex); + if (release_latch) + latch.wr_unlock(); ut_ad(write_lsn == lsn); } else @@ -574,38 +601,40 @@ inline lsn_t log_t::write_buf() noexcept write_lock.set_pending(lsn); ut_ad(write_lsn >= get_flushed_lsn()); const size_t block_size_1{get_block_size() - 1}; - const lsn_t offset{calc_lsn_offset(write_lsn) & ~block_size_1}; + const lsn_t offset{calc_lsn_offset(write_lsn) & ~lsn_t{block_size_1}}; DBUG_PRINT("ib_log", ("write " LSN_PF " to " LSN_PF " at " LSN_PF, write_lsn, lsn, offset)); const byte *write_buf{buf}; size_t length{buf_free}; ut_ad(length >= (calc_lsn_offset(write_lsn) & block_size_1)); - buf_free&= block_size_1; - ut_ad(buf_free == ((lsn - first_lsn) & block_size_1)); + const size_t new_buf_free{length & block_size_1}; + buf_free= new_buf_free; + ut_ad(new_buf_free == ((lsn - first_lsn) & block_size_1)); - if (buf_free) + if (new_buf_free) { #if 0 /* TODO: Pad the last log block with dummy records. */ - buf_free= log_pad(lsn, get_block_size() - buf_free, - buf + buf_free, flush_buf); + buf_free= log_pad(lsn, get_block_size() - new_buf_free, + buf + new_buf_free, flush_buf); ... /* TODO: Update the LSN and adjust other code. */ #else /* The rest of the block will be written as garbage. (We want to avoid memset() while holding mutex.) This block will be overwritten later, once records beyond the current LSN are generated. */ - MEM_MAKE_DEFINED(buf + length, get_block_size() - buf_free); + MEM_MAKE_DEFINED(buf + length, get_block_size() - new_buf_free); buf[length]= 0; /* allow recovery to catch EOF faster */ length&= ~block_size_1; - memcpy_aligned<16>(flush_buf, buf + length, (buf_free + 15) & ~15); + memcpy_aligned<16>(flush_buf, buf + length, (new_buf_free + 15) & ~15); length+= get_block_size(); #endif } std::swap(buf, flush_buf); write_to_log++; - mysql_mutex_unlock(&mutex); + if (release_latch) + latch.wr_unlock(); if (UNIV_UNLIKELY(srv_shutdown_state > SRV_SHUTDOWN_INITIATED)) { @@ -616,11 +645,6 @@ inline lsn_t log_t::write_buf() noexcept /* Do the write to the log file */ log_write_buf(write_buf, length, offset); write_lsn= lsn; - if (srv_file_flush_method == SRV_O_DSYNC) - { - flushed_to_disk_lsn.store(lsn, std::memory_order_release); - log_flush_notify(lsn); - } } return write_lock.release(lsn); @@ -630,7 +654,7 @@ inline bool log_t::flush(lsn_t lsn) noexcept { ut_ad(lsn >= get_flushed_lsn()); flush_lock.set_pending(lsn); - const bool success{log.flush()}; + const bool success{srv_file_flush_method == SRV_O_DSYNC || log.flush()}; if (UNIV_LIKELY(success)) { flushed_to_disk_lsn.store(lsn, std::memory_order_release); @@ -642,14 +666,13 @@ inline bool log_t::flush(lsn_t lsn) noexcept /** Ensure that previous log writes are durable. @param lsn previously written LSN @return new durable lsn target -@retval 0 if everything was adequately written */ +@retval 0 if there are no pending callbacks on flush_lock + or there is another group commit lead. +*/ static lsn_t log_flush(lsn_t lsn) { ut_ad(!log_sys.is_pmem()); - - if (srv_file_flush_method != SRV_O_DSYNC) - ut_a(log_sys.flush(lsn)); - + ut_a(log_sys.flush(lsn)); DBUG_EXECUTE_IF("crash_after_log_write_upto", DBUG_SUICIDE();); return flush_lock.release(lsn); } @@ -689,32 +712,34 @@ void log_write_up_to(lsn_t lsn, bool durable, #endif repeat: - if (durable && - flush_lock.acquire(lsn, callback) != group_commit_lock::ACQUIRED) - return; + if (durable) + { + if (flush_lock.acquire(lsn, callback) != group_commit_lock::ACQUIRED) + return; + flush_lock.set_pending(log_sys.get_lsn()); + } + - lsn_t write_lsn; + lsn_t pending_write_lsn= 0, pending_flush_lsn= 0; if (write_lock.acquire(lsn, durable ? nullptr : callback) == group_commit_lock::ACQUIRED) { - mysql_mutex_lock(&log_sys.mutex); - write_lsn= log_sys.write_buf(); + log_sys.latch.wr_lock(SRW_LOCK_CALL); + pending_write_lsn= log_sys.write_buf(); } - else - write_lsn= 0; if (durable) { - lsn= log_flush(write_lock.value()); - if (lsn || write_lsn) - { - /* There is no new group commit lead; some async waiters could stall. */ - callback= &dummy_callback; - if (write_lsn > lsn) - lsn= write_lsn; - goto repeat; - } + pending_flush_lsn= log_flush(write_lock.value()); + } + + if (pending_write_lsn || pending_flush_lsn) + { + /* There is no new group commit lead; some async waiters could stall. */ + callback= &dummy_callback; + lsn= std::max(pending_write_lsn, pending_flush_lsn); + goto repeat; } } @@ -726,11 +751,9 @@ void log_buffer_flush_to_disk(bool durable) log_write_up_to(log_sys.get_lsn(std::memory_order_acquire), durable); } -/** Prepare to invoke log_write_and_flush(), before acquiring log_sys.mutex. */ +/** Prepare to invoke log_write_and_flush(), before acquiring log_sys.latch. */ ATTRIBUTE_COLD void log_write_and_flush_prepare() { - mysql_mutex_assert_not_owner(&log_sys.mutex); - if (log_sys.is_pmem()) return; @@ -740,23 +763,18 @@ ATTRIBUTE_COLD void log_write_and_flush_prepare() group_commit_lock::ACQUIRED); } -/** Durably write the log and release log_sys.mutex */ +/** Durably write the log up to log_sys.get_lsn(). */ ATTRIBUTE_COLD void log_write_and_flush() { ut_ad(!srv_read_only_mode); if (!log_sys.is_pmem()) { - const lsn_t write_lsn{log_sys.write_buf()}; - const lsn_t flush_lsn{log_flush(write_lock.value())}; - if (write_lsn || flush_lsn) - log_write_up_to(std::max(write_lsn, flush_lsn), true, &dummy_callback); + log_sys.write_buf(); + log_flush(write_lock.value()); } #ifdef HAVE_PMEM else - { - mysql_mutex_unlock(&log_sys.mutex); log_sys.persist(log_sys.get_lsn()); - } #endif } @@ -766,11 +784,7 @@ Tries to establish a big enough margin of free space in the log buffer, such that a new log entry can be catenated without an immediate need for a flush. */ ATTRIBUTE_COLD static void log_flush_margin() { - mysql_mutex_lock(&log_sys.mutex); - const bool flush{log_sys.buf_free > log_sys.max_buf_free}; - mysql_mutex_unlock(&log_sys.mutex); - - if (flush) + if (log_sys.buf_free > log_sys.max_buf_free) log_buffer_flush_to_disk(false); } @@ -783,26 +797,31 @@ ATTRIBUTE_COLD static void log_checkpoint_margin() { while (log_sys.check_flush_or_checkpoint()) { - mysql_mutex_lock(&log_sys.mutex); + log_sys.latch.rd_lock(SRW_LOCK_CALL); ut_ad(!recv_no_log_write); if (!log_sys.check_flush_or_checkpoint()) { func_exit: - mysql_mutex_unlock(&log_sys.mutex); + log_sys.latch.rd_unlock(); return; } const lsn_t lsn= log_sys.get_lsn(); const lsn_t checkpoint= log_sys.last_checkpoint_lsn; const lsn_t sync_lsn= checkpoint + log_sys.max_checkpoint_age; + if (lsn <= sync_lsn) { +#ifndef DBUG_OFF + skip_checkpoint: +#endif log_sys.set_check_flush_or_checkpoint(false); goto func_exit; } - mysql_mutex_unlock(&log_sys.mutex); + DBUG_EXECUTE_IF("ib_log_checkpoint_avoid_hard", goto skip_checkpoint;); + log_sys.latch.rd_unlock(); /* We must wait to prevent the tail of the log overwriting the head. */ buf_flush_wait_flushed(std::min(sync_lsn, checkpoint + (1U << 20))); @@ -827,6 +846,16 @@ ATTRIBUTE_COLD void log_check_margins() while (log_sys.check_flush_or_checkpoint()); } +/** Wait for a log checkpoint if needed. +NOTE that this function may only be called while not holding +any synchronization objects except dict_sys.latch. */ +void log_free_check() +{ + ut_ad(!lock_sys.is_writer()); + if (log_sys.check_flush_or_checkpoint()) + log_check_margins(); +} + extern void buf_resize_shutdown(); /** Make a checkpoint at the latest lsn on shutdown. */ @@ -898,13 +927,9 @@ ATTRIBUTE_COLD void logs_empty_and_mark_files_at_shutdown() } /* We need these threads to stop early in shutdown. */ - const char* thread_name; - - if (srv_fast_shutdown != 2 && trx_rollback_is_active) { - thread_name = "rollback of recovered transactions"; - } else { - thread_name = NULL; - } + const char* thread_name = srv_fast_shutdown != 2 + && trx_rollback_is_active + ? "rollback of recovered transactions" : nullptr; if (thread_name) { ut_ad(!srv_read_only_mode); @@ -939,38 +964,15 @@ ATTRIBUTE_COLD void logs_empty_and_mark_files_at_shutdown() if (!buf_pool.is_initialised()) { ut_ad(!srv_was_started); - } else if (ulint pending_io = buf_pool.io_pending()) { - if (srv_print_verbose_log && count > 600) { - ib::info() << "Waiting for " << pending_io << " buffer" - " page I/Os to complete"; - count = 0; - } - - goto loop; } else { buf_flush_buffer_pool(); } - if (log_sys.is_initialised()) { - mysql_mutex_lock(&log_sys.mutex); - const ulint n_write = log_sys.n_pending_checkpoint_writes; - mysql_mutex_unlock(&log_sys.mutex); - - if (n_write) { - if (srv_print_verbose_log && count > 600) { - sql_print_information( - "InnoDB: Pending checkpoint writes: " - ULINTPF, n_write); - count = 0; - } - goto loop; - } - } - if (srv_fast_shutdown == 2 || !srv_was_started) { if (!srv_read_only_mode && srv_was_started) { - ib::info() << "Executing innodb_fast_shutdown=2." - " Next startup will execute crash recovery!"; + sql_print_information( + "InnoDB: Executing innodb_fast_shutdown=2." + " Next startup will execute crash recovery!"); /* In this fastest shutdown we do not flush the buffer pool: @@ -995,7 +997,7 @@ ATTRIBUTE_COLD void logs_empty_and_mark_files_at_shutdown() ? SIZE_OF_FILE_CHECKPOINT + 8 : SIZE_OF_FILE_CHECKPOINT; - mysql_mutex_lock(&log_sys.mutex); + log_sys.latch.rd_lock(SRW_LOCK_CALL); lsn = log_sys.get_lsn(); @@ -1003,7 +1005,7 @@ ATTRIBUTE_COLD void logs_empty_and_mark_files_at_shutdown() && lsn != log_sys.last_checkpoint_lsn + sizeof_cp; ut_ad(lsn >= log_sys.last_checkpoint_lsn); - mysql_mutex_unlock(&log_sys.mutex); + log_sys.latch.rd_unlock(); if (lsn_changed) { goto loop; @@ -1046,10 +1048,7 @@ log_print( /*======*/ FILE* file) /*!< in: file where to print */ { - double time_elapsed; - time_t current_time; - - mysql_mutex_lock(&log_sys.mutex); + log_sys.latch.rd_lock(SRW_LOCK_CALL); const lsn_t lsn= log_sys.get_lsn(); mysql_mutex_lock(&buf_pool.flush_list_mutex); @@ -1066,38 +1065,7 @@ log_print( pages_flushed, lsn_t{log_sys.last_checkpoint_lsn}); - current_time = time(NULL); - - time_elapsed = difftime(current_time, - log_sys.last_printout_time); - - if (time_elapsed <= 0) { - time_elapsed = 1; - } - - fprintf(file, - ULINTPF " pending chkp writes\n" - ULINTPF " log i/o's done, %.2f log i/o's/second\n", - log_sys.n_pending_checkpoint_writes, - log_sys.n_log_ios, - static_cast( - log_sys.n_log_ios - log_sys.n_log_ios_old) - / time_elapsed); - - log_sys.n_log_ios_old = log_sys.n_log_ios; - log_sys.last_printout_time = current_time; - - mysql_mutex_unlock(&log_sys.mutex); -} - -/**********************************************************************//** -Refreshes the statistics used to print per-second averages. */ -void -log_refresh_stats(void) -/*===================*/ -{ - log_sys.n_log_ios_old = log_sys.n_log_ios; - log_sys.last_printout_time = time(NULL); + log_sys.latch.rd_unlock(); } /** Shut down the redo log subsystem. */ @@ -1120,8 +1088,8 @@ void log_t::close() ut_ad(!flush_buf); #endif - mysql_mutex_destroy(&mutex); - mysql_mutex_destroy(&flush_order_mutex); + latch.destroy(); + destroy_lsn_lock(); recv_sys.close(); diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 530779a7e074e..37a496725fc95 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -62,7 +62,7 @@ recv_sys_t recv_sys; bool recv_needed_recovery; #ifdef UNIV_DEBUG /** TRUE if writing to the redo log (mtr_commit) is forbidden. -Protected by log_sys.mutex. */ +Protected by log_sys.latch. */ bool recv_no_log_write = false; #endif /* UNIV_DEBUG */ @@ -87,7 +87,7 @@ is bigger than the lsn we are able to scan up to, that is an indication that the recovery failed and the database may be corrupt. */ static lsn_t recv_max_page_lsn; -/** Stored physical log record with logical LSN */ +/** Stored physical log record */ struct log_phys_t : public log_rec_t { /** start LSN of the mini-transaction (not necessarily of this record) */ @@ -179,6 +179,35 @@ struct log_phys_t : public log_rec_t return false; } + /** Check an OPT_PAGE_CHECKSUM record. + @see mtr_t::page_checksum() + @param block buffer page + @param l pointer to checksum + @return whether an unrecoverable mismatch was found */ + static bool page_checksum(const buf_block_t &block, const byte *l) + { + size_t size; + const byte *page= block.page.zip.data; + if (UNIV_LIKELY_NULL(page)) + size= (UNIV_ZIP_SIZE_MIN >> 1) << block.page.zip.ssize; + else + { + page= block.page.frame; + size= srv_page_size; + } + if (UNIV_LIKELY(my_crc32c(my_crc32c(my_crc32c(0, page + FIL_PAGE_OFFSET, + FIL_PAGE_LSN - + FIL_PAGE_OFFSET), + page + FIL_PAGE_TYPE, 2), + page + FIL_PAGE_SPACE_ID, + size - (FIL_PAGE_SPACE_ID + 8)) == + mach_read_from_4(l))) + return false; + + ib::error() << "OPT_PAGE_CHECKSUM mismatch on " << block.page.id(); + return !srv_force_recovery; + } + /** The status of apply() */ enum apply_status { /** The page was not affected */ @@ -188,7 +217,9 @@ struct log_phys_t : public log_rec_t /** The page was modified, affecting the encryption parameters */ APPLIED_TO_ENCRYPTION, /** The page was modified, affecting the tablespace header */ - APPLIED_TO_FSP_HEADER + APPLIED_TO_FSP_HEADER, + /** The page was found to be corrupted */ + APPLIED_CORRUPTED, }; /** Apply log to a page frame. @@ -263,9 +294,19 @@ struct log_phys_t : public log_rec_t next_not_same_page: last_offset= 1; /* the next record must not be same_page */ } - next: l+= rlen; continue; + case OPTION: + ut_ad(rlen == 5); + ut_ad(*l == OPT_PAGE_CHECKSUM); + if (page_checksum(block, l + 1)) + { +page_corrupted: + sql_print_error("InnoDB: Set innodb_force_recovery=1" + " to ignore corruption."); + return APPLIED_CORRUPTED; + } + goto next_after_applying; } ut_ad(mach_read_from_4(frame + FIL_PAGE_OFFSET) == @@ -276,8 +317,6 @@ struct log_phys_t : public log_rec_t ut_ad(last_offset <= size); switch (b & 0x70) { - case OPTION: - goto next; case EXTENDED: if (UNIV_UNLIKELY(block.page.id().page_no() < 3 || block.page.zip.ssize)) @@ -306,13 +345,7 @@ struct log_phys_t : public log_rec_t if (UNIV_UNLIKELY(rlen <= 3)) goto record_corrupted; if (undo_append(block, ++l, --rlen) && !srv_force_recovery) - { - page_corrupted: - sql_print_error("InnoDB: Set innodb_force_recovery=1" - " to ignore corruption."); - recv_sys.set_corrupt_log(); - return applied; - } + goto page_corrupted; break; case INSERT_HEAP_REDUNDANT: case INSERT_REUSE_REDUNDANT: @@ -360,7 +393,7 @@ struct log_phys_t : public log_rec_t rlen-= ll; l+= ll; ll= mlog_decode_varint_length(*l); - if (UNIV_UNLIKELY(ll > 3 || ll >= rlen)) + if (UNIV_UNLIKELY(ll > 3 || ll > rlen)) goto record_corrupted; size_t data_c= mlog_decode_varint(l); ut_ad(data_c != MLOG_DECODE_ERROR); @@ -387,7 +420,7 @@ struct log_phys_t : public log_rec_t rlen-= ll; l+= ll; ll= mlog_decode_varint_length(*l); - if (UNIV_UNLIKELY(ll > 2 || ll >= rlen)) + if (UNIV_UNLIKELY(ll > 2 || ll > rlen)) goto record_corrupted; size_t data_c= mlog_decode_varint(l); rlen-= ll; @@ -618,22 +651,12 @@ static struct { /* Replace absolute DATA DIRECTORY file paths with short names relative to the backup directory. */ - const char *name= strrchr(filename, '/'); -#ifdef _WIN32 - if (const char *last= strrchr(filename, '\\')) - if (last > name) - name= last; -#endif - if (name) + if (const char *name= strrchr(filename, '/')) { - while (--name > filename && -#ifdef _WIN32 - *name != '\\' && -#endif - *name != '/'); + while (--name > filename && *name != '/'); if (name > filename) filename= name + 1; - } + } } char *fil_path= fil_make_filepath(nullptr, {filename, strlen(filename)}, @@ -694,7 +717,7 @@ static struct @param id tablespace id @return tablespace whose creation was deferred @retval nullptr if no such tablespace was found */ - const item *find(uint32_t id) + item *find(uint32_t id) { mysql_mutex_assert_owner(&recv_sys.mutex); auto it= defers.find(id); @@ -714,8 +737,10 @@ static struct bool reinit_all() { retry: + log_sys.latch.wr_unlock(); bool fail= false; buf_block_t *free_block= buf_LRU_get_free_block(false); + log_sys.latch.wr_lock(SRW_LOCK_CALL); mysql_mutex_lock(&recv_sys.mutex); for (auto d= defers.begin(); d != defers.end(); ) @@ -750,9 +775,10 @@ static struct if (!os_file_status(name->c_str(), &exists, &ftype) || !exists) goto processed; } - create(it, *name, static_cast - (1U << FSP_FLAGS_FCRC32_POS_MARKER | - FSP_FLAGS_FCRC32_PAGE_SSIZE()), nullptr, 0); + if (create(it, *name, static_cast + (1U << FSP_FLAGS_FCRC32_POS_MARKER | + FSP_FLAGS_FCRC32_PAGE_SSIZE()), nullptr, 0)) + mysql_mutex_unlock(&fil_system.mutex); } } else @@ -781,15 +807,33 @@ static struct @param flags FSP_SPACE_FLAGS @param crypt_data encryption metadata @param size tablespace size in pages - @return tablespace */ + @return tablespace; the caller must release fil_system.mutex + @retval nullptr if crypt_data is invalid */ static fil_space_t *create(const recv_spaces_t::const_iterator &it, const std::string &name, uint32_t flags, fil_space_crypt_t *crypt_data, uint32_t size) { + if (crypt_data && !crypt_data->is_key_found()) + { + crypt_data->~fil_space_crypt_t(); + ut_free(crypt_data); + return nullptr; + } + mysql_mutex_lock(&fil_system.mutex); fil_space_t *space= fil_space_t::create(it->first, flags, FIL_TYPE_TABLESPACE, crypt_data); ut_ad(space); - space->add(name.c_str(), OS_FILE_CLOSED, size, false, false); + const char *filename= name.c_str(); + if (srv_operation == SRV_OPERATION_RESTORE) + { + if (const char *tbl_name= strrchr(filename, '/')) + { + while (--tbl_name > filename && *tbl_name != '/'); + if (tbl_name > filename) + filename= tbl_name + 1; + } + } + space->add(filename, OS_FILE_CLOSED, size, false, false); space->recv_size= it->second.size; space->size_in_header= size; return space; @@ -830,17 +874,22 @@ static struct fil_space_read_crypt_data(fil_space_t::zip_size(flags), page), size); + if (!space) + goto next_item; + space->free_limit= fsp_header_get_field(page, FSP_FREE_LIMIT); space->free_len= flst_get_len(FSP_HEADER_OFFSET + FSP_FREE + page); fil_node_t *node= UT_LIST_GET_FIRST(space->chain); + mysql_mutex_unlock(&fil_system.mutex); if (!space->acquire()) - { + { free_space: fil_space_free(it->first, false); goto next_item; - } + } if (os_file_write(IORequestWrite, node->name, node->handle, - page, 0, fil_space_t::physical_size(flags)) != DB_SUCCESS) + page, 0, fil_space_t::physical_size(flags)) != + DB_SUCCESS) { space->release(); goto free_space; @@ -878,9 +927,10 @@ bool recv_sys_t::recover_deferred(recv_sys_t::map::iterator &p, { mtr_t mtr; buf_block_t *block= recover_low(first, p, mtr, free_block); - ut_ad(block == free_block); + ut_ad(block == free_block || block == reinterpret_cast(-1)); free_block= nullptr; - + if (UNIV_UNLIKELY(!block || block == reinterpret_cast(-1))) + goto fail; const byte *page= UNIV_LIKELY_NULL(block->page.zip.data) ? block->page.zip.data : block->page.frame; @@ -900,13 +950,16 @@ bool recv_sys_t::recover_deferred(recv_sys_t::map::iterator &p, fil_space_read_crypt_data (fil_space_t::zip_size(flags), page), size); + if (!space) + goto release_and_fail; space->free_limit= fsp_header_get_field(page, FSP_FREE_LIMIT); space->free_len= flst_get_len(FSP_HEADER_OFFSET + FSP_FREE + page); - block->page.lock.x_unlock(); fil_node_t *node= UT_LIST_GET_FIRST(space->chain); node->deferred= true; + mysql_mutex_unlock(&fil_system.mutex); if (!space->acquire()) - goto fail; + goto release_and_fail; + fil_names_dirty(space); const bool is_compressed= fil_space_t::is_compressed(flags); #ifdef _WIN32 const bool is_sparse= is_compressed; @@ -917,19 +970,39 @@ bool recv_sys_t::recover_deferred(recv_sys_t::map::iterator &p, DB_SUCCESS == os_file_punch_hole(node->handle, 0, 4096) && !my_test_if_thinly_provisioned(node->handle); #endif + /* Mimic fil_node_t::read_page0() in case the file exists and + has already been extended to a larger size. */ + ut_ad(node->size == size); + const os_offset_t file_size= os_file_get_size(node->handle); + if (file_size != os_offset_t(-1)) + { + const uint32_t n_pages= + uint32_t(file_size / fil_space_t::physical_size(flags)); + if (n_pages > size) + { + mysql_mutex_lock(&fil_system.mutex); + space->size= node->size= n_pages; + space->set_committed_size(); + mysql_mutex_unlock(&fil_system.mutex); + goto size_set; + } + } if (!os_file_set_size(node->name, node->handle, (size * fil_space_t::physical_size(flags)) & ~4095ULL, is_sparse)) { space->release(); - goto fail; + goto release_and_fail; } + size_set: node->deferred= false; space->release(); it->second.space= space; + block->page.lock.x_unlock(); return false; } + release_and_fail: block->page.lock.x_unlock(); } @@ -941,15 +1014,19 @@ bool recv_sys_t::recover_deferred(recv_sys_t::map::iterator &p, /** Report an operation to create, delete, or rename a file during backup. @param[in] space_id tablespace identifier -@param[in] create whether the file is being created +@param[in] type redo log type @param[in] name file name (not NUL-terminated) @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 (*log_file_op)(uint32_t space_id, bool create, +void (*log_file_op)(uint32_t space_id, int type, const byte* name, ulint len, const byte* new_name, ulint new_len); +void (*undo_space_trunc)(uint32_t space_id); + +void (*first_page_init)(uint32_t space_id); + /** Information about initializing page contents during redo log processing. FIXME: Rely on recv_sys.pages! */ class mlog_init_t @@ -1075,6 +1152,7 @@ class mlog_init_t } mtr.commit(); + clear(); } /** Clear the data structure */ @@ -1101,14 +1179,6 @@ inline void recv_sys_t::trim(const page_id_t page_id, lsn_t lsn) pages.erase(r); } } - if (fil_space_t* space = fil_space_get(page_id.space())) { - ut_ad(UT_LIST_GET_LEN(space->chain) == 1); - fil_node_t* file = UT_LIST_GET_FIRST(space->chain); - ut_ad(file->is_open()); - os_file_truncate(file->name, file->handle, - os_offset_t{page_id.page_no()} - << srv_page_size_shift, true); - } DBUG_VOID_RETURN; } @@ -1130,20 +1200,18 @@ inline size_t recv_sys_t::files_size() @param[in] name file name @param[in] len length of the file name @param[in] space_id the tablespace ID -@param[in] deleted whether this is a FILE_DELETE record +@param[in] ftype FILE_MODIFY, FILE_DELETE, or FILE_RENAME @param[in] lsn lsn of the redo log -@param[in] store whether the redo log has to - stored */ -static -void -fil_name_process(const char* name, ulint len, uint32_t space_id, - bool deleted, lsn_t lsn, store_t store) +@param[in] store whether the redo log has to be stored */ +static void fil_name_process(const char *name, ulint len, uint32_t space_id, + mfile_type_t ftype, lsn_t lsn, store_t store) { - if (srv_operation == SRV_OPERATION_BACKUP) { + if (srv_operation == SRV_OPERATION_BACKUP + || srv_operation == SRV_OPERATION_BACKUP_NO_DEFER) { return; } - ut_ad(srv_operation == SRV_OPERATION_NORMAL + ut_ad(srv_operation <= SRV_OPERATION_EXPORT_RESTORED || srv_operation == SRV_OPERATION_RESTORE || srv_operation == SRV_OPERATION_RESTORE_EXPORT); @@ -1151,6 +1219,7 @@ fil_name_process(const char* name, ulint len, uint32_t space_id, further checks can ensure that a FILE_MODIFY record was scanned before applying any page records for the space_id. */ + const bool deleted{ftype == FILE_DELETE}; const file_name_t fname(std::string(name, len), deleted); std::pair p = recv_spaces.emplace( space_id, fname); @@ -1158,13 +1227,17 @@ fil_name_process(const char* name, ulint len, uint32_t space_id, file_name_t& f = p.first->second; - if (deleted) { - /* Got FILE_DELETE */ - if (auto d = deferred_spaces.find(static_cast( - space_id))) { + if (auto d = deferred_spaces.find(space_id)) { + if (deleted) { d->deleted = true; + goto got_deleted; } + goto reload; + } + if (deleted) { +got_deleted: + /* Got FILE_DELETE */ if (!p.second && f.status != file_name_t::DELETED) { f.status = file_name_t::DELETED; if (f.space != NULL) { @@ -1176,6 +1249,7 @@ fil_name_process(const char* name, ulint len, uint32_t space_id, ut_ad(f.space == NULL); } else if (p.second // the first FILE_MODIFY or FILE_RENAME || f.name != fname.name) { +reload: fil_space_t* space; /* Check if the tablespace file exists and contains @@ -1186,8 +1260,7 @@ fil_name_process(const char* name, ulint len, uint32_t space_id, case FIL_LOAD_OK: ut_ad(space != NULL); - deferred_spaces.remove( - static_cast(space_id)); + deferred_spaces.remove(space_id); if (!f.space) { if (f.size || f.flags != f.initial_flags) { @@ -1250,47 +1323,30 @@ fil_name_process(const char* name, ulint len, uint32_t space_id, when lsn is already processed */ if (store != store_t::STORE_IF_EXISTS) { deferred_spaces.add( - static_cast(space_id), - fname.name.c_str(), lsn); + space_id, fname.name.c_str(), lsn); } break; case FIL_LOAD_INVALID: ut_ad(space == NULL); if (srv_force_recovery == 0) { - sql_print_warning( - "InnoDB: We do not continue the crash" - " recovery, because the table may" - " become corrupt if we cannot apply" - " the log records in the InnoDB log to" - " it. To fix the problem and start" - " mariadbd:"); - sql_print_information( - "InnoDB: 1) If there is a permission" - " problem in the file and mysqld" - " cannot open the file, you should" - " modify the permissions."); - sql_print_information( - "InnoDB: 2) If the tablespace is not" - " needed, or you can restore an older" - " version from a backup, then you can" - " remove the .ibd file, and use" - " --innodb_force_recovery=1 to force" - " startup without this file."); - sql_print_information( - "InnoDB: 3) If the file system or the" - " disk is broken, and you cannot" - " remove the .ibd file, you can set" - " --innodb_force_recovery."); + sql_print_error("InnoDB: Recovery cannot access" + " file %.*s (tablespace " + UINT32PF ")", int(len), name, + space_id); + sql_print_information("InnoDB: You may set " + "innodb_force_recovery=1" + " to ignore this and" + " possibly get a" + " corrupted database."); recv_sys.set_corrupt_fs(); break; } - sql_print_information( - "InnoDB: innodb_force_recovery was set to %lu." - " Continuing crash recovery even though" - " we cannot access the files for tablespace " - UINT32PF ".", srv_force_recovery, space_id); - break; + sql_print_warning("InnoDB: Ignoring changes to" + " file %.*s (tablespace " + UINT32PF ")" + " due to innodb_force_recovery", + int(len), name, space_id); } } } @@ -1351,7 +1407,7 @@ inline void recv_sys_t::clear() mysql_mutex_assert_owner(&mutex); apply_log_recs= false; apply_batch_on= false; - ut_ad(!after_apply || !UT_LIST_GET_LAST(blocks)); + ut_ad(!after_apply || found_corrupt_fs || !UT_LIST_GET_LAST(blocks)); pages.clear(); for (buf_block_t *block= UT_LIST_GET_LAST(blocks); block; ) @@ -1586,7 +1642,10 @@ ATTRIBUTE_COLD static dberr_t recv_log_recover_pre_10_2() sql_print_error("InnoDB: Cannot decrypt log for upgrading." " The encrypted log was created before MariaDB 10.2.2."); else - sql_print_error("%s%s.", uag, pre_10_2); + sql_print_error("%s%s. You must start up and shut down" + " MariaDB 10.1 or MySQL 5.6 or earlier" + " on the data directory.", + uag, pre_10_2); return DB_ERROR; } @@ -1604,7 +1663,7 @@ static dberr_t recv_log_recover_10_5(lsn_t lsn_offset) if (lsn_offset < (log_sys.is_pmem() ? log_sys.file_size : 4096)) memcpy_aligned<512>(buf, &log_sys.buf[lsn_offset & ~511], 512); else - recv_sys.read(lsn_offset & ~511, {buf, 512}); + recv_sys.read(lsn_offset & ~lsn_t{511}, {buf, 512}); if (!recv_check_log_block(buf)) { @@ -1635,10 +1694,10 @@ dberr_t recv_sys_t::find_checkpoint() file_checkpoint= 0; std::string path{get_log_file_path()}; bool success; - pfs_os_file_t file= os_file_create(innodb_log_file_key, path.c_str(), + os_file_t file{os_file_create_func(path.c_str(), OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT, OS_FILE_NORMAL, OS_LOG_FILE, - srv_read_only_mode, &success); + srv_read_only_mode, &success)}; if (file == OS_FILE_CLOSED) return DB_ERROR; const os_offset_t size{os_file_get_size(file)}; @@ -1661,10 +1720,10 @@ dberr_t recv_sys_t::find_checkpoint() for (int i= 1; i < 101; i++) { path= get_log_file_path(LOG_FILE_NAME_PREFIX).append(std::to_string(i)); - file= os_file_create(innodb_log_file_key, path.c_str(), - OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT | - OS_FILE_ON_ERROR_SILENT, - OS_FILE_NORMAL, OS_LOG_FILE, true, &success); + file= os_file_create_func(path.c_str(), + OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT | + OS_FILE_ON_ERROR_SILENT, + OS_FILE_NORMAL, OS_LOG_FILE, true, &success); if (file == OS_FILE_CLOSED) break; const os_offset_t sz{os_file_get_size(file)}; @@ -1707,7 +1766,8 @@ dberr_t recv_sys_t::find_checkpoint() lsn= 0; buf= my_assume_aligned<4096>(log_sys.buf); if (!log_sys.is_pmem()) - log_sys.log.read(0, {buf, 4096}); + if (dberr_t err= log_sys.log.read(0, {buf, 4096})) + return err; /* Check the header page checksum. There was no checksum in the first redo log format (version 0). */ log_sys.format= mach_read_from_4(buf + LOG_HEADER_FORMAT); @@ -1778,7 +1838,9 @@ dberr_t recv_sys_t::find_checkpoint() if (log_sys.is_pmem()) buf= log_sys.buf + field; else - log_sys.log.read(field, {buf, log_sys.get_block_size()}); + if (dberr_t err= log_sys.log.read(field, + {buf, log_sys.get_block_size()})) + return err; const lsn_t checkpoint_lsn{mach_read_from_8(buf)}; const lsn_t end_lsn{mach_read_from_8(buf + 8)}; if (checkpoint_lsn < first_lsn || end_lsn < checkpoint_lsn || @@ -1861,11 +1923,24 @@ dberr_t recv_sys_t::find_checkpoint() if (dberr_t err= recv_log_recover_10_5(lsn_offset)) { - sql_print_error("%s The redo log was created with %s%s", - srv_operation == SRV_OPERATION_NORMAL - ? "InnoDB: Upgrade after a crash is not supported." - : "mariadb-backup --prepare is not possible", creator, - (err == DB_ERROR ? "." : ", and it appears corrupted.")); + const char *msg1, *msg2, *msg3; + msg1= srv_operation == SRV_OPERATION_NORMAL + ? "InnoDB: Upgrade after a crash is not supported." + : "mariadb-backup --prepare is not possible."; + + if (err == DB_ERROR) + { + msg2= srv_operation == SRV_OPERATION_NORMAL + ? ". You must start up and shut down MariaDB " + : ". You must use mariadb-backup "; + msg3= (log_sys.format & ~log_t::FORMAT_ENCRYPTED) == log_t::FORMAT_10_5 + ? "10.7 or earlier." : "10.4 or earlier."; + } + else + msg2= ", and it appears corrupted.", msg3= ""; + + sql_print_error("%s The redo log was created with %s%s%s", + msg1, creator, msg2, msg3); return err; } @@ -1879,7 +1954,7 @@ inline bool page_recv_t::trim(lsn_t start_lsn) { while (log.head) { - if (log.head->lsn >= start_lsn) return false; + if (log.head->lsn > start_lsn) return false; last_offset= 1; /* the next record must not be same_page */ log_rec_t *next= log.head->next; recv_sys.free(log.head); @@ -2002,6 +2077,8 @@ static void store_freed_or_init_rec(page_id_t page_id, bool freed) /** Wrapper for log_sys.buf[] between recv_sys.offset and recv_sys.len */ struct recv_buf { + bool is_pmem() const noexcept { return log_sys.is_pmem(); } + const byte *ptr; constexpr recv_buf(const byte *ptr) : ptr(ptr) {} @@ -2095,6 +2172,8 @@ struct recv_buf /** Ring buffer wrapper for log_sys.buf[]; recv_sys.len == log_sys.file_size */ struct recv_ring : public recv_buf { + static constexpr bool is_pmem() { return true; } + constexpr recv_ring(const byte *ptr) : recv_buf(ptr) {} constexpr static bool is_eof() { return false; } @@ -2232,7 +2311,11 @@ template inline recv_sys_t::parse_mtr_result recv_sys_t::parse(store_t store, source &l) noexcept { - mysql_mutex_assert_owner(&log_sys.mutex); +#ifndef SUX_LOCK_GENERIC + ut_ad(log_sys.latch.is_write_locked() || + srv_operation == SRV_OPERATION_BACKUP || + srv_operation == SRV_OPERATION_BACKUP_NO_DEFER); +#endif mysql_mutex_assert_owner(&mutex); ut_ad(log_sys.next_checkpoint_lsn); ut_ad(log_sys.is_latest()); @@ -2312,6 +2395,11 @@ inline recv_sys_t::parse_mtr_result recv_sys_t::parse(store_t store, source &l) ut_d(const source el{l}); lsn+= l - begin; offset= l.ptr - log_sys.buf; + if (!l.is_pmem()); + else if (offset == log_sys.file_size) + offset= log_sys.START_OFFSET; + else + ut_ad(offset < log_sys.file_size); ut_d(std::set freed); #if 0 && defined UNIV_DEBUG /* MDEV-21727 FIXME: enable this */ @@ -2423,7 +2511,11 @@ inline recv_sys_t::parse_mtr_result recv_sys_t::parse(store_t store, source &l) got_page_op= !(b & 0x80); if (!got_page_op); else if (srv_operation == SRV_OPERATION_BACKUP) + { + if (page_no == 0 && first_page_init && (b & 0x10)) + first_page_init(space_id); continue; + } else if (file_checkpoint && !is_predefined_tablespace(space_id)) { recv_spaces_t::iterator i= recv_spaces.lower_bound(space_id); @@ -2458,7 +2550,8 @@ inline recv_sys_t::parse_mtr_result recv_sys_t::parse(store_t store, source &l) else if (UNIV_UNLIKELY(l - recs + rlen > srv_page_size)) goto record_corrupted; const page_id_t id{space_id, page_no}; - ut_d(if ((b & 0x70) == INIT_PAGE) freed.erase(id)); + ut_d(if ((b & 0x70) == INIT_PAGE || (b & 0x70) == OPTION) + freed.erase(id)); ut_ad(freed.find(id) == freed.end()); switch (b & 0x70) { case FREE_PAGE: @@ -2487,16 +2580,27 @@ inline recv_sys_t::parse_mtr_result recv_sys_t::parse(store_t store, source &l) goto record_corrupted; static_assert(UT_ARR_SIZE(truncated_undo_spaces) == TRX_SYS_MAX_UNDO_SPACES, "compatibility"); + /* The entire undo tablespace will be reinitialized by + innodb_undo_log_truncate=ON. Discard old log for all pages. */ + trim({space_id, 0}, lsn); truncated_undo_spaces[space_id - srv_undo_space_id_start]= { lsn, page_no }; + if (undo_space_trunc) + undo_space_trunc(space_id); #endif last_offset= 1; /* the next record must not be same_page */ continue; } last_offset= FIL_PAGE_TYPE; break; - case RESERVED: case OPTION: + if (rlen == 5 && *l == OPT_PAGE_CHECKSUM) + { + cl= l.copy_if_needed(iv, decrypt_buf, recs, rlen); + break; + } + /* fall through */ + case RESERVED: continue; case WRITE: case MEMMOVE: @@ -2592,9 +2696,9 @@ inline recv_sys_t::parse_mtr_result recv_sys_t::parse(store_t store, source &l) #if 0 && defined UNIV_DEBUG switch (b & 0x70) { case RESERVED: - case OPTION: ut_ad(0); /* we did "continue" earlier */ break; + case OPTION: case FREE_PAGE: break; default: @@ -2727,25 +2831,29 @@ inline recv_sys_t::parse_mtr_result recv_sys_t::parse(store_t store, source &l) continue; fil_name_process(fn, fnend - fn, space_id, - (b & 0xf0) == FILE_DELETE, start_lsn, - store); - if (fn2) - fil_name_process(fn2, fn2end - fn2, space_id, - false, start_lsn, store); - if ((b & 0xf0) < FILE_MODIFY && log_file_op) - log_file_op(space_id, (b & 0xf0) == FILE_CREATE, + (b & 0xf0) == FILE_DELETE ? FILE_DELETE : FILE_MODIFY, + start_lsn, store); + + if ((b & 0xf0) < FILE_CHECKPOINT && log_file_op) + log_file_op(space_id, b & 0xf0, reinterpret_cast(fn), static_cast(fnend - fn), reinterpret_cast(fn2), fn2 ? static_cast(fn2end - fn2) : 0); - if (fn2 && file_checkpoint) + if (fn2) { - const size_t len= fn2end - fn2; - auto r= renamed_spaces.emplace(space_id, std::string{fn2, len}); - if (!r.second) - r.first->second= std::string{fn2, len}; + fil_name_process(fn2, fn2end - fn2, space_id, + FILE_RENAME, start_lsn, store); + if (file_checkpoint) + { + const size_t len= fn2end - fn2; + auto r= renamed_spaces.emplace(space_id, std::string{fn2, len}); + if (!r.second) + r.first->second= std::string{fn2, len}; + } } + if (is_corrupt_fs()) return GOT_EOF; } @@ -2790,11 +2898,13 @@ lsn of a log record. @param[in,out] mtr mini-transaction @param[in,out] p recovery address @param[in,out] space tablespace, or NULL if not looked up yet -@param[in,out] init page initialization operation, or NULL */ -static void recv_recover_page(buf_block_t* block, mtr_t& mtr, - const recv_sys_t::map::iterator& p, - fil_space_t* space = NULL, - mlog_init_t::init* init = NULL) +@param[in,out] init page initialization operation, or NULL +@return the recovered page +@retval nullptr on failure */ +static buf_block_t *recv_recover_page(buf_block_t *block, mtr_t &mtr, + const recv_sys_t::map::iterator &p, + fil_space_t *space= nullptr, + mlog_init_t::init *init= nullptr) { mysql_mutex_assert_owner(&recv_sys.mutex); ut_ad(recv_sys.apply_log_recs); @@ -2835,7 +2945,7 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr, const log_phys_t* l = static_cast(recv); ut_ad(l->lsn); ut_ad(end_lsn <= l->lsn); - ut_ad(l->lsn <= log_sys.get_lsn()); + ut_ad(l->lsn <= recv_sys.lsn); ut_ad(l->start_lsn); ut_ad(recv_start_lsn <= l->start_lsn); @@ -2899,6 +3009,7 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr, start_lsn = 0; continue; case log_phys_t::APPLIED_YES: + case log_phys_t::APPLIED_CORRUPTED: goto set_start_lsn; case log_phys_t::APPLIED_TO_FSP_HEADER: case log_phys_t::APPLIED_TO_ENCRYPTION: @@ -2952,8 +3063,23 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr, } set_start_lsn: - if (recv_sys.is_corrupt_log() && !srv_force_recovery) { - break; + if ((a == log_phys_t::APPLIED_CORRUPTED + || recv_sys.is_corrupt_log()) && !srv_force_recovery) { + if (init) { + init->created = false; + if (space || block->page.id().page_no()) { + block->page.lock.x_lock_recursive(); + } + } + + mtr.discard_modifications(); + mtr.commit(); + + buf_pool.corrupted_evict(&block->page, + block->page.state() & + buf_page_t::LRU_MASK); + block = nullptr; + goto done; } if (!start_lsn) { @@ -2963,17 +3089,23 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr, if (start_lsn) { ut_ad(end_lsn >= start_lsn); + ut_ad(!block->page.oldest_modification()); mach_write_to_8(FIL_PAGE_LSN + frame, end_lsn); - if (UNIV_LIKELY(frame == block->page.frame)) { + if (UNIV_LIKELY(!block->page.zip.data)) { mach_write_to_8(srv_page_size - FIL_PAGE_END_LSN_OLD_CHKSUM + frame, end_lsn); } else { buf_zip_decompress(block, false); } - - buf_block_modify_clock_inc(block); - buf_flush_note_modification(block, start_lsn, end_lsn); + /* The following is adapted from + buf_pool_t::insert_into_flush_list() */ + mysql_mutex_lock(&buf_pool.flush_list_mutex); + buf_pool.flush_list_bytes+= block->physical_size(); + block->page.set_oldest_modification(start_lsn); + UT_LIST_ADD_FIRST(buf_pool.flush_list, &block->page); + buf_pool.page_cleaner_wakeup(); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); } else if (free_page && init) { /* There have been no operations that modify the page. Any buffered changes must not be merged. A subsequent @@ -2990,6 +3122,7 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr, mtr.discard_modifications(); mtr.commit(); +done: time_t now = time(NULL); mysql_mutex_lock(&recv_sys.mutex); @@ -2998,8 +3131,8 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr, recv_max_page_lsn = page_lsn; } - ut_ad(p->second.is_being_processed()); - ut_ad(!recv_sys.pages.empty()); + ut_ad(!block || p->second.is_being_processed()); + ut_ad(!block || !recv_sys.pages.empty()); if (recv_sys.report(now)) { const size_t n = recv_sys.pages.size(); @@ -3009,6 +3142,8 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr, "To recover: %zu pages" " from log", n); } + + return block; } /** Remove records for a corrupted page. @@ -3016,13 +3151,25 @@ This function should only be called when innodb_force_recovery is set. @param page_id corrupted page identifier */ ATTRIBUTE_COLD void recv_sys_t::free_corrupted_page(page_id_t page_id) { + if (!recovery_on) + return; + mysql_mutex_lock(&mutex); map::iterator p= pages.find(page_id); if (p != pages.end()) { p->second.log.clear(); pages.erase(p); + if (!srv_force_recovery) + { + set_corrupt_fs(); + ib::error() << "Unable to apply log to corrupted page " << page_id + << "; set innodb_force_recovery to ignore"; + } + else + ib::warn() << "Discarding log for corrupted page " << page_id; } + if (pages.empty()) pthread_cond_broadcast(&cond); mysql_mutex_unlock(&mutex); @@ -3054,8 +3201,9 @@ ATTRIBUTE_COLD void recv_sys_t::set_corrupt_fs() /** Apply any buffered redo log to a page that was just read from a data file. @param[in,out] space tablespace -@param[in,out] bpage buffer pool page */ -void recv_recover_page(fil_space_t* space, buf_page_t* bpage) +@param[in,out] bpage buffer pool page +@return whether the page was recovered correctly */ +bool recv_recover_page(fil_space_t* space, buf_page_t* bpage) { mtr_t mtr; mtr.start(); @@ -3072,16 +3220,18 @@ void recv_recover_page(fil_space_t* space, buf_page_t* bpage) mtr.memo_push(reinterpret_cast(bpage), MTR_MEMO_PAGE_X_FIX); + buf_block_t* success = reinterpret_cast(bpage); + mysql_mutex_lock(&recv_sys.mutex); if (recv_sys.apply_log_recs) { recv_sys_t::map::iterator p = recv_sys.pages.find(bpage->id()); if (p != recv_sys.pages.end() && !p->second.is_being_processed()) { - recv_recover_page( - reinterpret_cast(bpage), mtr, p, - space); - p->second.log.clear(); - recv_sys.pages.erase(p); + success = recv_recover_page(success, mtr, p, space); + if (UNIV_LIKELY(!!success)) { + p->second.log.clear(); + recv_sys.pages.erase(p); + } recv_sys.maybe_finish_batch(); goto func_exit; } @@ -3091,37 +3241,36 @@ void recv_recover_page(fil_space_t* space, buf_page_t* bpage) func_exit: mysql_mutex_unlock(&recv_sys.mutex); ut_ad(mtr.has_committed()); + return success; } -/** Reads in pages which have hashed log records, from an area around a given -page number. -@param[in] page_id page id */ +/** Read pages for which log needs to be applied. +@param page_id first page identifier to read +@param i iterator to recv_sys.pages */ TRANSACTIONAL_TARGET -static void recv_read_in_area(page_id_t page_id) +static void recv_read_in_area(page_id_t page_id, recv_sys_t::map::iterator i) { - uint32_t page_nos[32]; - page_id.set_page_no(ut_2pow_round(page_id.page_no(), 32U)); - const uint32_t up_limit = page_id.page_no() + 32; - uint32_t* p = page_nos; - - for (recv_sys_t::map::iterator i= recv_sys.pages.lower_bound(page_id); - i != recv_sys.pages.end() - && i->first.space() == page_id.space() - && i->first.page_no() < up_limit; i++) { - if (i->second.state == page_recv_t::RECV_NOT_PROCESSED - && !buf_pool.page_hash_contains( - i->first, - buf_pool.page_hash.cell_get(i->first.fold()))) { - i->second.state = page_recv_t::RECV_BEING_READ; - *p++ = i->first.page_no(); - } - } + uint32_t page_nos[32]; + ut_ad(page_id == i->first); + page_id.set_page_no(ut_2pow_round(page_id.page_no(), 32U)); + const page_id_t up_limit{page_id + 31}; + uint32_t* p= page_nos; - if (p != page_nos) { - mysql_mutex_unlock(&recv_sys.mutex); - buf_read_recv_pages(page_id.space(), {page_nos, p}); - mysql_mutex_lock(&recv_sys.mutex); - } + for (; i != recv_sys.pages.end() && i->first <= up_limit; i++) + { + if (i->second.state == page_recv_t::RECV_NOT_PROCESSED) + { + i->second.state= page_recv_t::RECV_BEING_READ; + *p++= i->first.page_no(); + } + } + + if (p != page_nos) + { + mysql_mutex_unlock(&recv_sys.mutex); + buf_read_recv_pages(page_id.space(), {page_nos, p}); + mysql_mutex_lock(&recv_sys.mutex); + } } /** Attempt to initialize a page based on redo log records. @@ -3129,7 +3278,9 @@ static void recv_read_in_area(page_id_t page_id) @param p iterator pointing to page_id @param mtr mini-transaction @param b pre-allocated buffer pool block -@return whether the page was successfully initialized */ +@return the recovered block +@retval nullptr if the page cannot be initialized based on log records +@retval -1 if the page cannot be recovered due to corruption */ inline buf_block_t *recv_sys_t::recover_low(const page_id_t page_id, map::iterator &p, mtr_t &mtr, buf_block_t *b) @@ -3141,15 +3292,11 @@ inline buf_block_t *recv_sys_t::recover_low(const page_id_t page_id, buf_block_t* block= nullptr; mlog_init_t::init &i= mlog_init.last(page_id); const lsn_t end_lsn= recs.log.last()->lsn; - bool first_page= page_id.page_no() == 0; if (end_lsn < i.lsn) DBUG_LOG("ib_log", "skip log for page " << page_id << " LSN " << end_lsn << " < " << i.lsn); fil_space_t *space= fil_space_t::get(page_id.space()); - if (!space && !first_page) - return block; - mtr.start(); mtr.set_log_mode(MTR_LOG_NO_REDO); @@ -3157,41 +3304,51 @@ inline buf_block_t *recv_sys_t::recover_low(const page_id_t page_id, if (!space) { + if (page_id.page_no() != 0) + { + nothing_recoverable: + mtr.commit(); + return nullptr; + } auto it= recv_spaces.find(page_id.space()); ut_ad(it != recv_spaces.end()); uint32_t flags= it->second.flags; zip_size= fil_space_t::zip_size(flags); block= buf_page_create_deferred(page_id.space(), zip_size, &mtr, b); + ut_ad(block == b); + block->page.lock.x_lock_recursive(); } else + { block= buf_page_create(space, page_id.page_no(), zip_size, &mtr, b); - if (UNIV_UNLIKELY(block != b)) - { - /* The page happened to exist in the buffer pool, or it - was just being read in. Before buf_page_get_with_no_latch() - returned to buf_page_create(), all changes must have been - applied to the page already. */ - ut_ad(pages.find(page_id) == pages.end()); - mtr.commit(); - block= nullptr; + if (UNIV_UNLIKELY(block != b)) + { + /* The page happened to exist in the buffer pool, or it + was just being read in. Before the exclusive page latch was acquired by + buf_page_create(), all changes to the page must have been applied. */ + ut_ad(pages.find(page_id) == pages.end()); + space->release(); + goto nothing_recoverable; + } } - else + + ut_ad(&recs == &pages.find(page_id)->second); + i.created= true; + map::iterator r= p++; + block= recv_recover_page(block, mtr, r, space, &i); + ut_ad(mtr.has_committed()); + + if (block) { - /* Buffer fix the first page while deferring the tablespace - and unfix it after creating defer tablespace */ - if (first_page && !space) - block->page.lock.x_lock(); - ut_ad(&recs == &pages.find(page_id)->second); - i.created= true; - recv_recover_page(block, mtr, p, space, &i); - ut_ad(mtr.has_committed()); recs.log.clear(); - map::iterator r= p++; pages.erase(r); - if (pages.empty()) - pthread_cond_signal(&cond); } + else + block= reinterpret_cast(-1); + + if (pages.empty()) + pthread_cond_signal(&cond); if (space) space->release(); @@ -3201,7 +3358,8 @@ inline buf_block_t *recv_sys_t::recover_low(const page_id_t page_id, /** Attempt to initialize a page based on redo log records. @param page_id page identifier -@return whether the page was successfully initialized */ +@return recovered block +@retval nullptr if the page cannot be initialized based on log records */ buf_block_t *recv_sys_t::recover_low(const page_id_t page_id) { buf_block_t *free_block= buf_LRU_get_free_block(false); @@ -3214,7 +3372,8 @@ buf_block_t *recv_sys_t::recover_low(const page_id_t page_id) { mtr_t mtr; block= recover_low(page_id, p, mtr, free_block); - ut_ad(!block || block == free_block); + ut_ad(!block || block == reinterpret_cast(-1) || + block == free_block); } mysql_mutex_unlock(&mutex); @@ -3262,13 +3421,10 @@ static void log_sort_flush_list() @param last_batch whether it is possible to write more redo log */ void recv_sys_t::apply(bool last_batch) { - ut_ad(srv_operation == SRV_OPERATION_NORMAL || + ut_ad(srv_operation <= SRV_OPERATION_EXPORT_RESTORED || srv_operation == SRV_OPERATION_RESTORE || srv_operation == SRV_OPERATION_RESTORE_EXPORT); -#ifdef SAFE_MUTEX - DBUG_ASSERT(!last_batch == mysql_mutex_is_owner(&log_sys.mutex)); -#endif /* SAFE_MUTEX */ mysql_mutex_assert_owner(&mutex); timespec abstime; @@ -3278,15 +3434,17 @@ void recv_sys_t::apply(bool last_batch) if (is_corrupt_log()) return; if (last_batch) - { - mysql_mutex_assert_not_owner(&log_sys.mutex); my_cond_wait(&cond, &mutex.m_mutex); - } else { - mysql_mutex_unlock(&mutex); +#ifndef SUX_LOCK_GENERIC + ut_ad(log_sys.latch.is_write_locked()); +#endif + log_sys.latch.wr_unlock(); set_timespec_nsec(abstime, 500000000ULL); /* 0.5s */ - my_cond_timedwait(&cond, &log_sys.mutex.m_mutex, &abstime); + my_cond_timedwait(&cond, &mutex.m_mutex, &abstime); + mysql_mutex_unlock(&mutex); + log_sys.latch.wr_lock(SRW_LOCK_CALL); mysql_mutex_lock(&mutex); } } @@ -3313,18 +3471,45 @@ void recv_sys_t::apply(bool last_batch) { const trunc& t= truncated_undo_spaces[id]; if (t.lsn) - trim(page_id_t(id + srv_undo_space_id_start, t.pages), t.lsn); + { + /* The entire undo tablespace will be reinitialized by + innodb_undo_log_truncate=ON. Discard old log for all pages. + Even though we recv_sys_t::parse() already invoked trim(), + this will be needed in case recovery consists of multiple batches + (there was an invocation with !last_batch). */ + trim({id + srv_undo_space_id_start, 0}, t.lsn); + if (fil_space_t *space = fil_space_get(id + srv_undo_space_id_start)) + { + ut_ad(UT_LIST_GET_LEN(space->chain) == 1); + fil_node_t *file= UT_LIST_GET_FIRST(space->chain); + ut_ad(file->is_open()); + os_file_truncate(file->name, file->handle, + os_offset_t{t.pages} << srv_page_size_shift, true); + } + } } fil_system.extend_to_recv_size(); + /* We must release log_sys.latch and recv_sys.mutex before + invoking buf_LRU_get_free_block(). Allocating a block may initiate + a redo log write and therefore acquire log_sys.latch. To avoid + deadlocks, log_sys.latch must not be acquired while holding + recv_sys.mutex. */ + mysql_mutex_unlock(&mutex); + if (!last_batch) + log_sys.latch.wr_unlock(); + buf_block_t *free_block= buf_LRU_get_free_block(false); + if (!last_batch) + log_sys.latch.wr_lock(SRW_LOCK_CALL); + mysql_mutex_lock(&mutex); + for (map::iterator p= pages.begin(); p != pages.end(); ) { const page_id_t page_id= p->first; - page_recv_t &recs= p->second; - ut_ad(!recs.log.empty()); + ut_ad(!p->second.log.empty()); const uint32_t space_id= page_id.space(); auto d= deferred_spaces.defers.find(space_id); @@ -3356,7 +3541,7 @@ void recv_sys_t::apply(bool last_batch) continue; } - switch (recs.state) { + switch (p->second.state) { case page_recv_t::RECV_BEING_READ: case page_recv_t::RECV_BEING_PROCESSED: p++; @@ -3366,43 +3551,23 @@ void recv_sys_t::apply(bool last_batch) { next_free_block: mysql_mutex_unlock(&mutex); + if (!last_batch) + log_sys.latch.wr_unlock(); free_block= buf_LRU_get_free_block(false); - mysql_mutex_lock(&mutex); -next_page: - p= pages.lower_bound(page_id); - } - continue; - case page_recv_t::RECV_NOT_PROCESSED: - mtr.start(); - mtr.set_log_mode(MTR_LOG_NO_REDO); - if (buf_block_t *block= buf_page_get_low(page_id, 0, RW_X_LATCH, - nullptr, BUF_GET_IF_IN_POOL, - &mtr, nullptr, false)) - { - recv_recover_page(block, mtr, p); - ut_ad(mtr.has_committed()); - } - else - { - mtr.commit(); if (!last_batch) - { - const auto it= recv_spaces.find(space_id); - if (it != recv_spaces.end() && - it->second.status == file_name_t::DELETED) - goto erase_page; - } - recv_read_in_area(page_id); + log_sys.latch.wr_lock(SRW_LOCK_CALL); + mysql_mutex_lock(&mutex); break; } - erase_page: - map::iterator r= p++; - r->second.log.clear(); - pages.erase(r); + ut_ad(p == pages.end() || p->first > page_id); continue; + case page_recv_t::RECV_NOT_PROCESSED: + recv_read_in_area(page_id, p); } - - goto next_page; + p= pages.lower_bound(page_id); + /* Ensure that progress will be made. */ + ut_ad(p == pages.end() || p->first > page_id || + p->second.state >= page_recv_t::RECV_BEING_READ); } buf_pool.free_block(free_block); @@ -3411,30 +3576,33 @@ void recv_sys_t::apply(bool last_batch) for (;;) { const bool empty= pages.empty(); - if (empty && !buf_pool.n_pend_reads) + if (empty && !os_aio_pending_reads()) break; if (!is_corrupt_fs() && !is_corrupt_log()) { if (last_batch) { - mysql_mutex_assert_not_owner(&log_sys.mutex); if (!empty) my_cond_wait(&cond, &mutex.m_mutex); else { mysql_mutex_unlock(&mutex); - os_aio_wait_until_no_pending_reads(); - ut_ad(!buf_pool.n_pend_reads); + os_aio_wait_until_no_pending_reads(false); mysql_mutex_lock(&mutex); ut_ad(pages.empty()); } } else { - mysql_mutex_unlock(&mutex); +#ifndef SUX_LOCK_GENERIC + ut_ad(log_sys.latch.is_write_locked()); +#endif + log_sys.latch.wr_unlock(); set_timespec_nsec(abstime, 500000000ULL); /* 0.5s */ - my_cond_timedwait(&cond, &log_sys.mutex.m_mutex, &abstime); + my_cond_timedwait(&cond, &mutex.m_mutex, &abstime); + mysql_mutex_unlock(&mutex); + log_sys.latch.wr_lock(SRW_LOCK_CALL); mysql_mutex_lock(&mutex); } continue; @@ -3452,26 +3620,23 @@ void recv_sys_t::apply(bool last_batch) else { mlog_init.reset(); - mysql_mutex_unlock(&log_sys.mutex); + log_sys.latch.wr_unlock(); } - mysql_mutex_assert_not_owner(&log_sys.mutex); mysql_mutex_unlock(&mutex); if (last_batch && srv_operation != SRV_OPERATION_RESTORE && srv_operation != SRV_OPERATION_RESTORE_EXPORT) + /* Instead of flushing, last_batch sorts the buf_pool.flush_list + in ascending order of buf_page_t::oldest_modification. */ log_sort_flush_list(); else - { - /* Instead of flushing, last_batch could sort the buf_pool.flush_list - in ascending order of buf_page_t::oldest_modification. */ buf_flush_sync_batch(lsn); - } if (!last_batch) { buf_pool_invalidate(); - mysql_mutex_lock(&log_sys.mutex); + log_sys.latch.wr_lock(SRW_LOCK_CALL); } #ifdef HAVE_PMEM else if (log_sys.is_pmem()) @@ -3531,7 +3696,9 @@ static bool recv_scan_log(bool last_phase) for (ut_d(lsn_t source_offset= 0);;) { - mysql_mutex_assert_owner(&log_sys.mutex); +#ifndef SUX_LOCK_GENERIC + ut_ad(log_sys.latch.is_write_locked()); +#endif #ifdef UNIV_DEBUG const bool wrap{source_offset + recv_sys.len == log_sys.file_size}; #endif @@ -3548,9 +3715,17 @@ static bool recv_scan_log(bool last_phase) if (source_offset + size > log_sys.file_size) size= static_cast(log_sys.file_size - source_offset); - log_sys.n_log_ios++; - log_sys.log.read(source_offset, {log_sys.buf + recv_sys.len, size}); - recv_sys.len+= size; + if (dberr_t err= log_sys.log.read(source_offset, + {log_sys.buf + recv_sys.len, size})) + { + mysql_mutex_unlock(&recv_sys.mutex); + ib::error() << "Failed to read log at " << source_offset + << ": " << err; + recv_sys.set_corrupt_log(); + mysql_mutex_lock(&recv_sys.mutex); + } + else + recv_sys.len+= size; } if (recv_sys.report(time(nullptr))) @@ -3571,7 +3746,7 @@ static bool recv_scan_log(bool last_phase) for (;;) { - const byte b{log_sys.buf[recv_sys.offset]}; + const byte& b{log_sys.buf[recv_sys.offset]}; r= recv_sys.parse_pmem(store); if (r == recv_sys_t::OK) { @@ -3627,7 +3802,6 @@ static bool recv_scan_log(bool last_phase) else { ut_ad(store == STORE_IF_EXISTS); - log_sys.set_recovered_lsn(recv_sys.lsn); recv_sys.apply(false); } } @@ -3644,6 +3818,9 @@ static bool recv_scan_log(bool last_phase) if (log_sys.is_pmem()) break; #endif + if (recv_sys.is_corrupt_log()) + break; + if (recv_sys.offset < log_sys.get_block_size()) break; @@ -3888,7 +4065,9 @@ recv_init_crash_recovery_spaces(bool rescan, bool& missing_tablespace) static dberr_t recv_rename_files() { mysql_mutex_assert_owner(&recv_sys.mutex); - mysql_mutex_assert_owner(&log_sys.mutex); +#ifndef SUX_LOCK_GENERIC + ut_ad(log_sys.latch.is_write_locked()); +#endif dberr_t err= DB_SUCCESS; @@ -3967,7 +4146,7 @@ dberr_t recv_recovery_from_checkpoint_start() { bool rescan = false; - ut_ad(srv_operation == SRV_OPERATION_NORMAL + ut_ad(srv_operation <= SRV_OPERATION_EXPORT_RESTORED || srv_operation == SRV_OPERATION_RESTORE || srv_operation == SRV_OPERATION_RESTORE_EXPORT); ut_d(mysql_mutex_lock(&buf_pool.flush_list_mutex)); @@ -3983,20 +4162,16 @@ dberr_t recv_recovery_from_checkpoint_start() recv_sys.recovery_on = true; - mysql_mutex_lock(&log_sys.mutex); + log_sys.latch.wr_lock(SRW_LOCK_CALL); dberr_t err = recv_sys.find_checkpoint(); if (err != DB_SUCCESS) { early_exit: - mysql_mutex_unlock(&log_sys.mutex); + log_sys.latch.wr_unlock(); return err; } - if (!log_set_capacity(srv_log_file_size)) { -err_exit: - err = DB_ERROR; - goto early_exit; - } + log_sys.set_capacity(); /* Start reading the log from the checkpoint lsn. The variable contiguous_lsn contains an lsn up to which the log is known to @@ -4088,7 +4263,7 @@ dberr_t recv_recovery_from_checkpoint_start() rescan = true; } - if (srv_operation == SRV_OPERATION_NORMAL) { + if (srv_operation <= SRV_OPERATION_EXPORT_RESTORED) { deferred_spaces.deferred_dblwr(); buf_dblwr.recover(); } @@ -4103,6 +4278,11 @@ dberr_t recv_recovery_from_checkpoint_start() || recv_sys.is_corrupt_fs()) { goto err_exit; } + + /* In case of multi-batch recovery, + redo log for the last batch is not + applied yet. */ + ut_d(recv_sys.after_apply = false); } } else { ut_ad(recv_sys.pages.empty()); @@ -4123,7 +4303,9 @@ dberr_t recv_recovery_from_checkpoint_start() } if (recv_sys.lsn < log_sys.next_checkpoint_lsn) { - goto err_exit; +err_exit: + err = DB_ERROR; + goto early_exit; } if (!srv_read_only_mode && log_sys.is_latest()) { @@ -4144,7 +4326,7 @@ dberr_t recv_recovery_from_checkpoint_start() } log_sys.buf_free = recv_sys.offset; if (recv_needed_recovery - && srv_operation == SRV_OPERATION_NORMAL) { + && srv_operation <= SRV_OPERATION_EXPORT_RESTORED) { /* Write a FILE_CHECKPOINT marker as the first thing, before generating any other redo log. This ensures that subsequent crash recovery will be possible even @@ -4162,7 +4344,6 @@ dberr_t recv_recovery_from_checkpoint_start() err = recv_rename_files(); } mysql_mutex_unlock(&recv_sys.mutex); - mysql_mutex_unlock(&log_sys.mutex); recv_lsn_checks_on = true; @@ -4174,6 +4355,7 @@ dberr_t recv_recovery_from_checkpoint_start() err = DB_CORRUPTION; } + log_sys.latch.wr_unlock(); return err; } diff --git a/storage/innobase/log/log0sync.cc b/storage/innobase/log/log0sync.cc index 65cc1d0633c3d..6b14d1d3591fd 100644 --- a/storage/innobase/log/log0sync.cc +++ b/storage/innobase/log/log0sync.cc @@ -222,7 +222,7 @@ group_commit_lock::lock_return_code group_commit_lock::acquire(value_type num, c thread_local_waiter.m_value = num; thread_local_waiter.m_group_commit_leader= false; std::unique_lock lk(m_mtx, std::defer_lock); - while (num > value()) + while (num > value() || thread_local_waiter.m_group_commit_leader) { lk.lock(); @@ -232,11 +232,9 @@ group_commit_lock::lock_return_code group_commit_lock::acquire(value_type num, c { lk.unlock(); do_completion_callback(callback); - thread_local_waiter.m_group_commit_leader=false; return lock_return_code::EXPIRED; } - thread_local_waiter.m_group_commit_leader= false; if (!m_lock) { /* Take the lock, become group commit leader.*/ @@ -249,17 +247,23 @@ group_commit_lock::lock_return_code group_commit_lock::acquire(value_type num, c return lock_return_code::ACQUIRED; } - if (callback && m_waiters_list) + if (callback && (m_waiters_list || num <= pending())) { /* - We need to have at least one waiter, - so it can become the new group commit leader. + If num > pending(), we have a good candidate for the next group + commit lead, that will be taking over the lock after current owner + releases it. We put current thread into waiter's list so it sleeps + and can be signaled and marked as group commit lead during lock release. + + For this to work well, pending() must deliver a good approximation for N + in the next call to group_commit_lock::release(N). */ m_pending_callbacks.push_back({num, *callback}); return lock_return_code::CALLBACK_QUEUED; } /* Add yourself to waiters list.*/ + thread_local_waiter.m_group_commit_leader= false; thread_local_waiter.m_next = m_waiters_list; m_waiters_list = &thread_local_waiter; lk.unlock(); @@ -369,6 +373,17 @@ group_commit_lock::value_type group_commit_lock::release(value_type num) lk.unlock(); + /* + Release designated next group commit lead first, + to minimize spurious wakeups. + */ + if (wakeup_list && wakeup_list->m_group_commit_leader) + { + next = wakeup_list->m_next; + wakeup_list->m_sema.wake(); + wakeup_list= next; + } + for (size_t i = 0; i < callback_count; i++) callbacks[i].m_callback(callbacks[i].m_param); diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index d483e3fb56675..3be297e9666a6 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, 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 @@ -32,181 +32,14 @@ Created 11/26/1995 Heikki Tuuri #ifdef BTR_CUR_HASH_ADAPT # include "btr0sea.h" #endif +#include "srv0start.h" #include "log.h" -/** Iterate over a memo block in reverse. */ -template -struct CIterate { - CIterate() : functor() {} - - CIterate(const Functor& functor) : functor(functor) {} - - /** @return false if the functor returns false. */ - bool operator()(mtr_buf_t::block_t* block) const - { - const mtr_memo_slot_t* start = - reinterpret_cast( - block->begin()); - - mtr_memo_slot_t* slot = - reinterpret_cast( - block->end()); - - ut_ad(!(block->used() % sizeof(*slot))); - - while (slot-- != start) { - - if (!functor(slot)) { - return(false); - } - } - - return(true); - } - - Functor functor; -}; - -template -struct Iterate { - Iterate() : functor() {} - - Iterate(const Functor& functor) : functor(functor) {} - - /** @return false if the functor returns false. */ - bool operator()(mtr_buf_t::block_t* block) - { - const mtr_memo_slot_t* start = - reinterpret_cast( - block->begin()); - - mtr_memo_slot_t* slot = - reinterpret_cast( - block->end()); - - ut_ad(!(block->used() % sizeof(*slot))); - - while (slot-- != start) { - - if (!functor(slot)) { - return(false); - } - } - - return(true); - } - - Functor functor; -}; - -/** Find specific object */ -struct Find { - - /** Constructor */ - Find(const void* object, ulint type) - : - m_slot(), - m_type(type), - m_object(object) - { - ut_a(object != NULL); - } - - /** @return false if the object was found. */ - bool operator()(mtr_memo_slot_t* slot) - { - if (m_object == slot->object && m_type == slot->type) { - m_slot = slot; - return(false); - } - - return(true); - } - - /** Slot if found */ - mtr_memo_slot_t*m_slot; - - /** Type of the object to look for */ - const ulint m_type; - - /** The object instance to look for */ - const void* m_object; -}; - -/** Find a page frame */ -struct FindPage +void mtr_memo_slot_t::release() const { - /** Constructor - @param[in] ptr pointer to within a page frame - @param[in] flags MTR_MEMO flags to look for */ - FindPage(const void* ptr, ulint flags) - : m_ptr(ptr), m_flags(flags), m_slot(NULL) - { - /* There must be some flags to look for. */ - ut_ad(flags); - /* We can only look for page-related flags. */ - ut_ad(!(flags & ulint(~(MTR_MEMO_PAGE_S_FIX - | MTR_MEMO_PAGE_X_FIX - | MTR_MEMO_PAGE_SX_FIX - | MTR_MEMO_BUF_FIX - | MTR_MEMO_MODIFY)))); - } - - /** Visit a memo entry. - @param[in] slot memo entry to visit - @retval false if a page was found - @retval true if the iteration should continue */ - bool operator()(mtr_memo_slot_t* slot) - { - ut_ad(m_slot == NULL); - - if (!(m_flags & slot->type) || slot->object == NULL) { - return(true); - } - - buf_page_t* bpage = static_cast(slot->object); - - if (m_ptr < bpage->frame - || m_ptr >= bpage->frame + srv_page_size) { - return(true); - } - ut_ad(!(slot->type & MTR_MEMO_PAGE_S_FIX) - || bpage->lock.have_s()); - ut_ad(!(slot->type & MTR_MEMO_PAGE_SX_FIX) - || bpage->lock.have_u_or_x()); - ut_ad(!(slot->type & MTR_MEMO_PAGE_X_FIX) - || bpage->lock.have_x()); - m_slot = slot; - return(false); - } + ut_ad(object); - /** @return the slot that was found */ - mtr_memo_slot_t* get_slot() const - { - ut_ad(m_slot != NULL); - return(m_slot); - } - /** @return the block that was found */ - buf_block_t* get_block() const - { - return(reinterpret_cast(get_slot()->object)); - } -private: - /** Pointer inside a page frame to look for */ - const void*const m_ptr; - /** MTR_MEMO flags to look for */ - const ulint m_flags; - /** The slot corresponding to m_ptr */ - mtr_memo_slot_t* m_slot; -}; - -/** Release latches and decrement the buffer fix count. -@param slot memo slot */ -static void memo_slot_release(mtr_memo_slot_t *slot) -{ - void *object= slot->object; - slot->object= nullptr; - switch (const auto type= slot->type) { + switch (type) { case MTR_MEMO_S_LOCK: static_cast(object)->s_unlock(); break; @@ -219,139 +52,117 @@ static void memo_slot_release(mtr_memo_slot_t *slot) static_cast(object)->set_committed_size(); static_cast(object)->x_unlock(); break; - case MTR_MEMO_SPACE_S_LOCK: - static_cast(object)->s_unlock(); - break; default: buf_page_t *bpage= static_cast(object); - bpage->unfix(); - switch (auto latch= slot->type & ~MTR_MEMO_MODIFY) { + ut_d(const auto s=) + bpage->unfix(); + ut_ad(s < buf_page_t::READ_FIX || s >= buf_page_t::WRITE_FIX); + switch (type) { case MTR_MEMO_PAGE_S_FIX: bpage->lock.s_unlock(); - return; - case MTR_MEMO_PAGE_SX_FIX: - case MTR_MEMO_PAGE_X_FIX: - bpage->lock.u_or_x_unlock(latch == MTR_MEMO_PAGE_SX_FIX); - /* fall through */ + break; case MTR_MEMO_BUF_FIX: - return; + break; + default: + ut_ad(type == MTR_MEMO_PAGE_SX_FIX || + type == MTR_MEMO_PAGE_X_FIX || + type == MTR_MEMO_PAGE_SX_MODIFY || + type == MTR_MEMO_PAGE_X_MODIFY); + bpage->lock.u_or_x_unlock(type & MTR_MEMO_PAGE_SX_FIX); } - ut_ad("invalid type" == 0); } } -/** Release the latches acquired by the mini-transaction. */ -struct ReleaseLatches { - /** @return true always. */ - bool operator()(mtr_memo_slot_t *slot) const +/** Prepare to insert a modified blcok into flush_list. +@param lsn start LSN of the mini-transaction +@return insert position for insert_into_flush_list() */ +inline buf_page_t *buf_pool_t::prepare_insert_into_flush_list(lsn_t lsn) + noexcept +{ +#ifndef SUX_LOCK_GENERIC + ut_ad(recv_recovery_is_on() || log_sys.latch.is_locked()); +#endif + ut_ad(lsn >= log_sys.last_checkpoint_lsn); + mysql_mutex_assert_owner(&flush_list_mutex); + static_assert(log_t::FIRST_LSN >= 2, "compatibility"); + +rescan: + buf_page_t *prev= UT_LIST_GET_FIRST(flush_list); + if (prev) { - void *object= slot->object; - if (!object) - return true; - slot->object= nullptr; - switch (const auto type= slot->type) { - case MTR_MEMO_S_LOCK: - static_cast(object)->s_unlock(); - break; - case MTR_MEMO_SPACE_X_LOCK: - static_cast(object)->set_committed_size(); - static_cast(object)->x_unlock(); - break; - case MTR_MEMO_SPACE_S_LOCK: - static_cast(object)->s_unlock(); - break; - case MTR_MEMO_X_LOCK: - case MTR_MEMO_SX_LOCK: - static_cast(object)-> - u_or_x_unlock(type == MTR_MEMO_SX_LOCK); - break; - default: - buf_page_t *bpage= static_cast(object); - bpage->unfix(); - switch (auto latch= slot->type & ~MTR_MEMO_MODIFY) { - case MTR_MEMO_PAGE_S_FIX: - bpage->lock.s_unlock(); - return true; - case MTR_MEMO_PAGE_SX_FIX: - case MTR_MEMO_PAGE_X_FIX: - bpage->lock.u_or_x_unlock(latch == MTR_MEMO_PAGE_SX_FIX); - /* fall through */ - case MTR_MEMO_BUF_FIX: - return true; + lsn_t om= prev->oldest_modification(); + if (om == 1) + { + delete_from_flush_list(prev); + goto rescan; + } + ut_ad(om > 2); + if (om <= lsn) + return nullptr; + while (buf_page_t *next= UT_LIST_GET_NEXT(list, prev)) + { + om= next->oldest_modification(); + if (om == 1) + { + delete_from_flush_list(next); + continue; } - ut_ad("invalid type" == 0); + ut_ad(om > 2); + if (om <= lsn) + break; + prev= next; } - return true; - } -}; - -/** Release the latches and blocks acquired by the mini-transaction. */ -struct ReleaseAll { - /** @return true always. */ - bool operator()(mtr_memo_slot_t *slot) const - { - if (slot->object) - memo_slot_release(slot); - return true; + flush_hp.adjust(prev); } -}; - -#ifdef UNIV_DEBUG -/** Check that all slots have been handled. */ -struct DebugCheck { - /** @return true always. */ - bool operator()(const mtr_memo_slot_t* slot) const - { - ut_ad(!slot->object); - return(true); - } -}; -#endif + return prev; +} -/** Release page latches held by the mini-transaction. */ -struct ReleaseBlocks +/** Insert a modified block into the flush list. +@param prev insert position (from prepare_insert_into_flush_list()) +@param block modified block +@param lsn start LSN of the mini-transaction that modified the block */ +inline void buf_pool_t::insert_into_flush_list(buf_page_t *prev, + buf_block_t *block, lsn_t lsn) + noexcept { - const lsn_t start, end; -#ifdef UNIV_DEBUG - const mtr_buf_t &memo; + ut_ad(!fsp_is_system_temporary(block->page.id().space())); + mysql_mutex_assert_owner(&flush_list_mutex); - ReleaseBlocks(lsn_t start, lsn_t end, const mtr_buf_t &memo) : - start(start), end(end), memo(memo) -#else /* UNIV_DEBUG */ - ReleaseBlocks(lsn_t start, lsn_t end, const mtr_buf_t&) : - start(start), end(end) -#endif /* UNIV_DEBUG */ + MEM_CHECK_DEFINED(block->page.zip.data + ? block->page.zip.data : block->page.frame, + block->physical_size()); + + if (const lsn_t old= block->page.oldest_modification()) { - ut_ad(start); - ut_ad(end); + if (old > 1) + return; + flush_hp.adjust(&block->page); + UT_LIST_REMOVE(flush_list, &block->page); } + else + flush_list_bytes+= block->physical_size(); - /** @return true always */ - bool operator()(mtr_memo_slot_t* slot) const - { - if (!slot->object) - return true; - switch (slot->type) { - case MTR_MEMO_PAGE_X_MODIFY: - case MTR_MEMO_PAGE_SX_MODIFY: - break; - default: - ut_ad(!(slot->type & MTR_MEMO_MODIFY)); - return true; - } + ut_ad(flush_list_bytes <= curr_pool_size); - buf_flush_note_modification(static_cast(slot->object), - start, end); - return true; - } -}; + if (prev) + UT_LIST_INSERT_AFTER(flush_list, prev, &block->page); + else + UT_LIST_ADD_FIRST(flush_list, &block->page); + + block->page.set_oldest_modification(lsn); +} + +mtr_t::mtr_t()= default; +mtr_t::~mtr_t()= default; /** Start a mini-transaction. */ void mtr_t::start() { + ut_ad(m_memo.empty()); ut_ad(!m_freed_pages); ut_ad(!m_freed_space); MEM_UNDEFINED(this, sizeof *this); + MEM_MAKE_DEFINED(&m_memo, sizeof m_memo); MEM_MAKE_DEFINED(&m_freed_space, sizeof m_freed_space); MEM_MAKE_DEFINED(&m_freed_pages, sizeof m_freed_pages); @@ -362,10 +173,10 @@ void mtr_t::start() m_last= nullptr; m_last_offset= 0; - new(&m_memo) mtr_buf_t(); new(&m_log) mtr_buf_t(); m_made_dirty= false; + m_latch_ex= false; m_inside_ibuf= false; m_modifications= false; m_log_mode= MTR_LOG_ALL; @@ -379,12 +190,121 @@ void mtr_t::start() inline void mtr_t::release_resources() { ut_ad(is_active()); - ut_d(m_memo.for_each_block_in_reverse(CIterate())); + ut_ad(m_memo.empty()); m_log.erase(); - m_memo.erase(); ut_d(m_commit= true); } +/** Handle any pages that were freed during the mini-transaction. */ +void mtr_t::process_freed_pages() +{ + if (m_freed_pages) + { + ut_ad(!m_freed_pages->empty()); + ut_ad(m_freed_space); + ut_ad(m_freed_space->is_owner()); + ut_ad(is_named_space(m_freed_space)); + + /* Update the last freed lsn */ + m_freed_space->freed_range_mutex.lock(); + m_freed_space->update_last_freed_lsn(m_commit_lsn); + if (!m_trim_pages) + for (const auto &range : *m_freed_pages) + m_freed_space->add_free_range(range); + else + m_freed_space->clear_freed_ranges(); + m_freed_space->freed_range_mutex.unlock(); + + delete m_freed_pages; + m_freed_pages= nullptr; + m_freed_space= nullptr; + /* mtr_t::start() will reset m_trim_pages */ + } + else + ut_ad(!m_freed_space); +} + +ATTRIBUTE_COLD __attribute__((noinline)) +/** Insert a modified block into buf_pool.flush_list on IMPORT TABLESPACE. */ +static void insert_imported(buf_block_t *block) +{ + if (block->page.oldest_modification() <= 1) + { + log_sys.latch.rd_lock(SRW_LOCK_CALL); + const lsn_t lsn= log_sys.last_checkpoint_lsn; + mysql_mutex_lock(&buf_pool.flush_list_mutex); + buf_pool.insert_into_flush_list + (buf_pool.prepare_insert_into_flush_list(lsn), block, lsn); + log_sys.latch.rd_unlock(); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + } +} + +/** Release modified pages when no log was written. */ +void mtr_t::release_unlogged() +{ + ut_ad(m_log_mode == MTR_LOG_NO_REDO); + ut_ad(m_log.size() == 0); + + process_freed_pages(); + + for (auto it= m_memo.rbegin(); it != m_memo.rend(); it++) + { + mtr_memo_slot_t &slot= *it; + ut_ad(slot.object); + switch (slot.type) { + case MTR_MEMO_S_LOCK: + static_cast(slot.object)->s_unlock(); + break; + case MTR_MEMO_SPACE_X_LOCK: + static_cast(slot.object)->set_committed_size(); + static_cast(slot.object)->x_unlock(); + break; + case MTR_MEMO_X_LOCK: + case MTR_MEMO_SX_LOCK: + static_cast(slot.object)-> + u_or_x_unlock(slot.type == MTR_MEMO_SX_LOCK); + break; + default: + buf_block_t *block= static_cast(slot.object); + ut_d(const auto s=) block->page.unfix(); + ut_ad(s >= buf_page_t::FREED); + ut_ad(s < buf_page_t::READ_FIX); + + if (slot.type & MTR_MEMO_MODIFY) + { + ut_ad(slot.type == MTR_MEMO_PAGE_X_MODIFY || + slot.type == MTR_MEMO_PAGE_SX_MODIFY); + ut_ad(block->page.id() < end_page_id); + insert_imported(block); + } + + switch (slot.type) { + case MTR_MEMO_PAGE_S_FIX: + block->page.lock.s_unlock(); + break; + case MTR_MEMO_BUF_FIX: + break; + default: + ut_ad(slot.type == MTR_MEMO_PAGE_SX_FIX || + slot.type == MTR_MEMO_PAGE_X_FIX || + slot.type == MTR_MEMO_PAGE_SX_MODIFY || + slot.type == MTR_MEMO_PAGE_X_MODIFY); + block->page.lock.u_or_x_unlock(slot.type & MTR_MEMO_PAGE_SX_FIX); + } + } + } + + m_memo.clear(); +} + +void mtr_t::release() +{ + for (auto it= m_memo.rbegin(); it != m_memo.rend(); it++) + it->release(); + m_memo.clear(); +} + /** Commit a mini-transaction. */ void mtr_t::commit() { @@ -394,111 +314,180 @@ void mtr_t::commit() /* This is a dirty read, for debugging. */ ut_ad(!m_modifications || !recv_no_log_write); ut_ad(!m_modifications || m_log_mode != MTR_LOG_NONE); + ut_ad(!m_latch_ex); if (m_modifications && (m_log_mode == MTR_LOG_NO_REDO || !m_log.empty())) { - ut_ad(!srv_read_only_mode || m_log_mode == MTR_LOG_NO_REDO); - - std::pair lsns; + if (UNIV_UNLIKELY(!is_logged())) + { + release_unlogged(); + goto func_exit; + } - if (const auto len= prepare_write()) - lsns= finish_write(len); - else - lsns= { m_commit_lsn, PAGE_FLUSH_NO }; + ut_ad(!srv_read_only_mode); + std::pair lsns{do_write()}; + process_freed_pages(); if (m_made_dirty) - mysql_mutex_lock(&log_sys.flush_order_mutex); + { + size_t modified= 0; + auto it= m_memo.rbegin(); - /* It is now safe to release log_sys.mutex because the - buf_pool.flush_order_mutex will ensure that we are the first one - to insert into buf_pool.flush_list. */ - mysql_mutex_unlock(&log_sys.mutex); + mysql_mutex_lock(&buf_pool.flush_list_mutex); - if (m_freed_pages) - { - ut_ad(!m_freed_pages->empty()); - ut_ad(m_freed_space); - ut_ad(m_freed_space->is_owner()); - ut_ad(is_named_space(m_freed_space)); - /* Update the last freed lsn */ - m_freed_space->update_last_freed_lsn(m_commit_lsn); - - if (!is_trim_pages()) - for (const auto &range : *m_freed_pages) - m_freed_space->add_free_range(range); + buf_page_t *const prev= + buf_pool.prepare_insert_into_flush_list(lsns.first); + + while (it != m_memo.rend()) + { + const mtr_memo_slot_t &slot= *it++; + if (slot.type & MTR_MEMO_MODIFY) + { + ut_ad(slot.type == MTR_MEMO_PAGE_X_MODIFY || + slot.type == MTR_MEMO_PAGE_SX_MODIFY); + modified++; + buf_block_t *b= static_cast(slot.object); + ut_ad(b->page.id() < end_page_id); + ut_d(const auto s= b->page.state()); + ut_ad(s > buf_page_t::FREED); + ut_ad(s < buf_page_t::READ_FIX); + ut_ad(mach_read_from_8(b->page.frame + FIL_PAGE_LSN) <= + m_commit_lsn); + mach_write_to_8(b->page.frame + FIL_PAGE_LSN, m_commit_lsn); + if (UNIV_LIKELY_NULL(b->page.zip.data)) + memcpy_aligned<8>(FIL_PAGE_LSN + b->page.zip.data, + FIL_PAGE_LSN + b->page.frame, 8); + buf_pool.insert_into_flush_list(prev, b, lsns.first); + } + } + + ut_ad(modified); + buf_pool.flush_list_requests+= modified; + buf_pool.page_cleaner_wakeup(); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + + if (m_latch_ex) + { + log_sys.latch.wr_unlock(); + m_latch_ex= false; + } else - m_freed_space->clear_freed_ranges(); - delete m_freed_pages; - m_freed_pages= nullptr; - m_freed_space= nullptr; - /* mtr_t::start() will reset m_trim_pages */ + log_sys.latch.rd_unlock(); + + release(); } else - ut_ad(!m_freed_space); + { + if (m_latch_ex) + { + log_sys.latch.wr_unlock(); + m_latch_ex= false; + } + else + log_sys.latch.rd_unlock(); - m_memo.for_each_block_in_reverse(CIterate - (ReleaseBlocks(lsns.first, m_commit_lsn, - m_memo))); - if (m_made_dirty) - mysql_mutex_unlock(&log_sys.flush_order_mutex); + size_t modified= 0; + + for (auto it= m_memo.rbegin(); it != m_memo.rend(); ) + { + const mtr_memo_slot_t &slot= *it++; + ut_ad(slot.object); + switch (slot.type) { + case MTR_MEMO_S_LOCK: + static_cast(slot.object)->s_unlock(); + break; + case MTR_MEMO_SPACE_X_LOCK: + static_cast(slot.object)->set_committed_size(); + static_cast(slot.object)->x_unlock(); + break; + case MTR_MEMO_X_LOCK: + case MTR_MEMO_SX_LOCK: + static_cast(slot.object)-> + u_or_x_unlock(slot.type == MTR_MEMO_SX_LOCK); + break; + default: + buf_page_t *bpage= static_cast(slot.object); + const auto s= bpage->unfix(); + if (slot.type & MTR_MEMO_MODIFY) + { + ut_ad(slot.type == MTR_MEMO_PAGE_X_MODIFY || + slot.type == MTR_MEMO_PAGE_SX_MODIFY); + ut_ad(bpage->oldest_modification() > 1); + ut_ad(bpage->oldest_modification() < m_commit_lsn); + ut_ad(bpage->id() < end_page_id); + ut_ad(s >= buf_page_t::FREED); + ut_ad(s < buf_page_t::READ_FIX); + ut_ad(mach_read_from_8(bpage->frame + FIL_PAGE_LSN) <= + m_commit_lsn); + if (s >= buf_page_t::UNFIXED) + { + mach_write_to_8(bpage->frame + FIL_PAGE_LSN, m_commit_lsn); + if (UNIV_LIKELY_NULL(bpage->zip.data)) + memcpy_aligned<8>(FIL_PAGE_LSN + bpage->zip.data, + FIL_PAGE_LSN + bpage->frame, 8); + } + modified++; + } + switch (auto latch= slot.type & ~MTR_MEMO_MODIFY) { + case MTR_MEMO_PAGE_S_FIX: + bpage->lock.s_unlock(); + continue; + case MTR_MEMO_PAGE_SX_FIX: + case MTR_MEMO_PAGE_X_FIX: + bpage->lock.u_or_x_unlock(latch == MTR_MEMO_PAGE_SX_FIX); + continue; + default: + ut_ad(latch == MTR_MEMO_BUF_FIX); + } + } + } - m_memo.for_each_block_in_reverse(CIterate()); + buf_pool.add_flush_list_requests(modified); + m_memo.clear(); + } if (UNIV_UNLIKELY(lsns.second != PAGE_FLUSH_NO)) buf_flush_ahead(m_commit_lsn, lsns.second == PAGE_FLUSH_SYNC); } else - m_memo.for_each_block_in_reverse(CIterate()); + { + if (m_freed_pages) + { + ut_ad(!m_freed_pages->empty()); + ut_ad(m_freed_space == fil_system.temp_space); + ut_ad(!m_trim_pages); + for (const auto &range : *m_freed_pages) + m_freed_space->add_free_range(range); + delete m_freed_pages; + m_freed_pages= nullptr; + m_freed_space= nullptr; + } + release(); + } +func_exit: release_resources(); } -/** Shrink a tablespace. */ -struct Shrink +void mtr_t::rollback_to_savepoint(ulint begin, ulint end) { - /** the first non-existing page in the tablespace */ - const page_id_t high; - - Shrink(const fil_space_t &space) : high({space.id, space.size}) {} + ut_ad(end <= m_memo.size()); + ut_ad(begin <= end); + ulint s= end; - bool operator()(mtr_memo_slot_t *slot) const + while (s-- > begin) { - if (!slot->object) - return true; - switch (slot->type) { - default: - ut_ad("invalid type" == 0); - return false; - case MTR_MEMO_SPACE_X_LOCK: - ut_ad(high.space() == static_cast(slot->object)->id); - return true; - case MTR_MEMO_PAGE_X_MODIFY: - case MTR_MEMO_PAGE_SX_MODIFY: - case MTR_MEMO_PAGE_X_FIX: - case MTR_MEMO_PAGE_SX_FIX: - auto &bpage= static_cast(slot->object)->page; - const auto s= bpage.state(); - ut_ad(s >= buf_page_t::FREED); - ut_ad(s < buf_page_t::READ_FIX); - ut_ad(bpage.frame); - const page_id_t id{bpage.id()}; - if (id < high) - { - ut_ad(id.space() == high.space() || - (id == page_id_t{0, TRX_SYS_PAGE_NO} && - srv_is_undo_tablespace(high.space()))); - break; - } - if (s >= buf_page_t::UNFIXED) - bpage.set_freed(s); - ut_ad(id.space() == high.space()); - if (bpage.oldest_modification() > 1) - bpage.reset_oldest_modification(); - slot->type= static_cast(slot->type & ~MTR_MEMO_MODIFY); - } - return true; + const mtr_memo_slot_t &slot= m_memo[s]; + ut_ad(slot.object); + /* This is intended for releasing latches on indexes or unmodified + buffer pool pages. */ + ut_ad(slot.type <= MTR_MEMO_SX_LOCK); + ut_ad(!(slot.type & MTR_MEMO_MODIFY)); + slot.release(); } -}; + + m_memo.erase(m_memo.begin() + begin, m_memo.begin() + end); +} /** Commit a mini-transaction that is shrinking a tablespace. @param space tablespace that is being shrunk */ @@ -509,48 +498,90 @@ void mtr_t::commit_shrink(fil_space_t &space) ut_ad(!high_level_read_only); ut_ad(m_modifications); ut_ad(m_made_dirty); + ut_ad(!m_memo.empty()); ut_ad(!recv_recovery_is_on()); ut_ad(m_log_mode == MTR_LOG_ALL); + ut_ad(!m_freed_pages); ut_ad(UT_LIST_GET_LEN(space.chain) == 1); log_write_and_flush_prepare(); + m_latch_ex= true; + log_sys.latch.wr_lock(SRW_LOCK_CALL); - const lsn_t start_lsn= finish_write(prepare_write()).first; + const lsn_t start_lsn= do_write().first; + ut_d(m_log.erase()); - mysql_mutex_lock(&log_sys.flush_order_mutex); /* Durably write the reduced FSP_SIZE before truncating the data file. */ log_write_and_flush(); +#ifndef SUX_LOCK_GENERIC + ut_ad(log_sys.latch.is_write_locked()); +#endif os_file_truncate(space.chain.start->name, space.chain.start->handle, os_offset_t{space.size} << srv_page_size_shift, true); - if (m_freed_pages) + space.clear_freed_ranges(); + + const page_id_t high{space.id, space.size}; + size_t modified= 0; + auto it= m_memo.rbegin(); + mysql_mutex_lock(&buf_pool.flush_list_mutex); + + buf_page_t *const prev= buf_pool.prepare_insert_into_flush_list(start_lsn); + + while (it != m_memo.rend()) { - ut_ad(!m_freed_pages->empty()); - ut_ad(m_freed_space == &space); - ut_ad(memo_contains(*m_freed_space)); - ut_ad(is_named_space(m_freed_space)); - m_freed_space->update_last_freed_lsn(m_commit_lsn); + mtr_memo_slot_t &slot= *it++; - if (!is_trim_pages()) - for (const auto &range : *m_freed_pages) - m_freed_space->add_free_range(range); + ut_ad(slot.object); + if (slot.type == MTR_MEMO_SPACE_X_LOCK) + ut_ad(high.space() == static_cast(slot.object)->id); else - m_freed_space->clear_freed_ranges(); - delete m_freed_pages; - m_freed_pages= nullptr; - m_freed_space= nullptr; - /* mtr_t::start() will reset m_trim_pages */ + { + ut_ad(slot.type == MTR_MEMO_PAGE_X_MODIFY || + slot.type == MTR_MEMO_PAGE_SX_MODIFY || + slot.type == MTR_MEMO_PAGE_X_FIX || + slot.type == MTR_MEMO_PAGE_SX_FIX); + buf_block_t *b= static_cast(slot.object); + const page_id_t id{b->page.id()}; + const auto s= b->page.state(); + ut_ad(s > buf_page_t::FREED); + ut_ad(s < buf_page_t::READ_FIX); + ut_ad(b->page.frame); + ut_ad(mach_read_from_8(b->page.frame + FIL_PAGE_LSN) <= m_commit_lsn); + ut_ad(!b->page.zip.data); // we no not shrink ROW_FORMAT=COMPRESSED + + if (id < high) + { + ut_ad(id.space() == high.space() || + (id == page_id_t{0, TRX_SYS_PAGE_NO} && + srv_is_undo_tablespace(high.space()))); + if (slot.type & MTR_MEMO_MODIFY) + { + modified++; + mach_write_to_8(b->page.frame + FIL_PAGE_LSN, m_commit_lsn); + buf_pool.insert_into_flush_list(prev, b, start_lsn); + } + } + else + { + ut_ad(id.space() == high.space()); + if (s >= buf_page_t::UNFIXED) + b->page.set_freed(s); + if (b->page.oldest_modification() > 1) + b->page.reset_oldest_modification(); + slot.type= mtr_memo_type_t(slot.type & ~MTR_MEMO_MODIFY); + } + } } - else - ut_ad(!m_freed_space); - m_memo.for_each_block_in_reverse(CIterate{space}); + ut_ad(modified); + buf_pool.flush_list_requests+= modified; + buf_pool.page_cleaner_wakeup(); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); - m_memo.for_each_block_in_reverse(CIterate - (ReleaseBlocks(start_lsn, m_commit_lsn, - m_memo))); - mysql_mutex_unlock(&log_sys.flush_order_mutex); + log_sys.latch.wr_unlock(); + m_latch_ex= false; mysql_mutex_lock(&fil_system.mutex); ut_ad(space.is_being_truncated); @@ -559,30 +590,147 @@ void mtr_t::commit_shrink(fil_space_t &space) space.is_being_truncated= false; mysql_mutex_unlock(&fil_system.mutex); - m_memo.for_each_block_in_reverse(CIterate()); + release(); + release_resources(); +} + +/** Commit a mini-transaction that is deleting or renaming a file. +@param space tablespace that is being renamed or deleted +@param name new file name (nullptr=the file will be deleted) +@param detached_handle if detached_handle != nullptr and if space is detached + during the function execution the file handle if its + node will be set to OS_FILE_CLOSED, and the previous + value of the file handle will be assigned to the + address, pointed by detached_handle. +@return whether the operation succeeded */ +bool mtr_t::commit_file(fil_space_t &space, const char *name, + pfs_os_file_t *detached_handle) +{ + ut_ad(is_active()); + ut_ad(!is_inside_ibuf()); + ut_ad(!high_level_read_only); + ut_ad(m_modifications); + ut_ad(!m_made_dirty); + ut_ad(!recv_recovery_is_on()); + ut_ad(m_log_mode == MTR_LOG_ALL); + ut_ad(UT_LIST_GET_LEN(space.chain) == 1); + ut_ad(!m_latch_ex); + + m_latch_ex= true; + + log_write_and_flush_prepare(); + + log_sys.latch.wr_lock(SRW_LOCK_CALL); + + size_t size= m_log.size() + 5; + if (log_sys.is_encrypted()) + { + /* We will not encrypt any FILE_ records, but we will reserve + a nonce at the end. */ + size+= 8; + m_commit_lsn= log_sys.get_lsn(); + } + else + m_commit_lsn= 0; + + m_crc= 0; + m_log.for_each_block([this](const mtr_buf_t::block_t *b) + { m_crc= my_crc32c(m_crc, b->begin(), b->used()); return true; }); + finish_write(size); + + if (!name && space.max_lsn) + { + ut_d(space.max_lsn= 0); + fil_system.named_spaces.remove(space); + } + + /* Block log_checkpoint(). */ + mysql_mutex_lock(&buf_pool.flush_list_mutex); + + /* Durably write the log for the file system operation. */ + log_write_and_flush(); + + log_sys.latch.wr_unlock(); + m_latch_ex= false; + + char *old_name= space.chain.start->name; + bool success; + + if (name) + { + char *new_name= mem_strdup(name); + mysql_mutex_lock(&fil_system.mutex); + success= os_file_rename(innodb_data_file_key, old_name, name); + if (success) + space.chain.start->name= new_name; + else + old_name= new_name; + mysql_mutex_unlock(&fil_system.mutex); + ut_free(old_name); + } + else + { + /* Remove any additional files. */ + if (char *cfg_name= fil_make_filepath(old_name, + fil_space_t::name_type{}, CFG, + false)) + { + os_file_delete_if_exists(innodb_data_file_key, cfg_name, nullptr); + ut_free(cfg_name); + } + + if (FSP_FLAGS_HAS_DATA_DIR(space.flags)) + RemoteDatafile::delete_link_file(space.name()); + + /* Remove the directory entry. The file will actually be deleted + when our caller closes the handle. */ + os_file_delete(innodb_data_file_key, old_name); + + mysql_mutex_lock(&fil_system.mutex); + /* Sanity checks after reacquiring fil_system.mutex */ + ut_ad(&space == fil_space_get_by_id(space.id)); + ut_ad(!space.referenced()); + ut_ad(space.is_stopping()); + + pfs_os_file_t handle = fil_system.detach(&space, true); + if (detached_handle) + *detached_handle = handle; + mysql_mutex_unlock(&fil_system.mutex); + + success= true; + } + + mysql_mutex_unlock(&buf_pool.flush_list_mutex); release_resources(); + + return success; } /** Commit a mini-transaction that did not modify any pages, but generated some redo log on a higher level, such as FILE_MODIFY records and an optional FILE_CHECKPOINT marker. -The caller must hold log_sys.mutex. +The caller must hold exclusive log_sys.latch. This is to be used at log_checkpoint(). @param checkpoint_lsn the log sequence number of a checkpoint, or 0 @return current LSN */ lsn_t mtr_t::commit_files(lsn_t checkpoint_lsn) { - mysql_mutex_assert_owner(&log_sys.mutex); +#ifndef SUX_LOCK_GENERIC + ut_ad(log_sys.latch.is_write_locked()); +#endif ut_ad(is_active()); ut_ad(!is_inside_ibuf()); ut_ad(m_log_mode == MTR_LOG_ALL); ut_ad(!m_made_dirty); - ut_ad(m_memo.size() == 0); + ut_ad(m_memo.empty()); ut_ad(!srv_read_only_mode); ut_ad(!m_freed_space); ut_ad(!m_freed_pages); ut_ad(!m_user_space); + ut_ad(!m_latch_ex); + + m_latch_ex= true; if (checkpoint_lsn) { @@ -626,19 +774,9 @@ lsn_t mtr_t::commit_files(lsn_t checkpoint_lsn) bool mtr_t::is_named_space(uint32_t space) const { - ut_ad(!m_user_space || m_user_space->id != TRX_SYS_SPACE); - - switch (m_log_mode) { - case MTR_LOG_NONE: - case MTR_LOG_NO_REDO: - return(true); - case MTR_LOG_ALL: - return(m_user_space_id == space - || is_predefined_tablespace(space)); - } - - ut_error; - return(false); + ut_ad(!m_user_space || m_user_space->id != TRX_SYS_SPACE); + return !is_logged() || m_user_space_id == space || + is_predefined_tablespace(space); } /** Check if a tablespace is associated with the mini-transaction (needed for generating a FILE_MODIFY record) @@ -648,16 +786,8 @@ bool mtr_t::is_named_space(const fil_space_t* space) const { ut_ad(!m_user_space || m_user_space->id != TRX_SYS_SPACE); - switch (m_log_mode) { - case MTR_LOG_NONE: - case MTR_LOG_NO_REDO: - return true; - case MTR_LOG_ALL: - return m_user_space == space || is_predefined_tablespace(space->id); - } - - ut_error; - return false; + return !is_logged() || m_user_space == space || + is_predefined_tablespace(space->id); } #endif /* UNIV_DEBUG */ @@ -700,130 +830,118 @@ void mtr_t::x_lock_space(fil_space_t *space) } } -/** Release an object in the memo stack. -@return true if released */ -bool -mtr_t::memo_release(const void* object, ulint type) -{ - ut_ad(is_active()); - - /* We cannot release a page that has been written to in the - middle of a mini-transaction. */ - ut_ad(!m_modifications || type != MTR_MEMO_PAGE_X_FIX); - - Iterate iteration(Find(object, type)); - - if (!m_memo.for_each_block_in_reverse(iteration)) { - memo_slot_release(iteration.functor.m_slot); - return(true); - } - - return(false); -} - -/** Release a page latch. -@param[in] ptr pointer to within a page frame -@param[in] type object type: MTR_MEMO_PAGE_X_FIX, ... */ -void -mtr_t::release_page(const void* ptr, mtr_memo_type_t type) +void mtr_t::release(const void *object) { - ut_ad(is_active()); - - /* We cannot release a page that has been written to in the - middle of a mini-transaction. */ - ut_ad(!m_modifications || type != MTR_MEMO_PAGE_X_FIX); - - Iterate iteration(FindPage(ptr, type)); - - if (!m_memo.for_each_block_in_reverse(iteration)) { - memo_slot_release(iteration.functor.get_slot()); - return; - } + ut_ad(is_active()); - /* The page was not found! */ - ut_ad(0); + auto it= + std::find_if(m_memo.begin(), m_memo.end(), + [object](const mtr_memo_slot_t& slot) + { return slot.object == object; }); + ut_ad(it != m_memo.end()); + ut_ad(!(it->type & MTR_MEMO_MODIFY)); + it->release(); + m_memo.erase(it, it + 1); + ut_ad(std::find_if(m_memo.begin(), m_memo.end(), + [object](const mtr_memo_slot_t& slot) + { return slot.object == &object; }) == m_memo.end()); } -static bool log_margin_warned; -static time_t log_margin_warn_time; -static bool log_close_warned; static time_t log_close_warn_time; /** Display a warning that the log tail is overwriting the head, making the server crash-unsafe. */ -ATTRIBUTE_COLD static void log_overwrite_warning(lsn_t age, lsn_t capacity) +ATTRIBUTE_COLD static void log_overwrite_warning(lsn_t lsn) { + if (log_sys.overwrite_warned) + return; + time_t t= time(nullptr); - if (!log_close_warned || difftime(t, log_close_warn_time) > 15) - { - log_close_warned= true; - log_close_warn_time= t; + if (difftime(t, log_close_warn_time) < 15) + return; - sql_print_error("InnoDB: The age of the last checkpoint is " LSN_PF - ", which exceeds the log capacity " LSN_PF ".", - age, capacity); - } + if (!log_sys.overwrite_warned) + log_sys.overwrite_warned= lsn; + log_close_warn_time= t; + + sql_print_error("InnoDB: Crash recovery is broken due to" + " insufficient innodb_log_file_size;" + " last checkpoint LSN=" LSN_PF ", current LSN=" LSN_PF + "%s.", + lsn_t{log_sys.last_checkpoint_lsn}, lsn, + srv_shutdown_state != SRV_SHUTDOWN_INITIATED + ? ". Shutdown is in progress" : ""); } -/** Reserve space in the log buffer for appending data. -@param size upper limit of the length of the data to append(), in bytes -@return the current LSN */ -inline lsn_t log_t::append_prepare(size_t size) noexcept +/** Wait in append_prepare() for buffer to become available +@param ex whether log_sys.latch is exclusively locked */ +ATTRIBUTE_COLD void log_t::append_prepare_wait(bool ex) noexcept { - mysql_mutex_assert_owner(&mutex); - - lsn_t lsn= get_lsn(); + log_sys.waits++; + log_sys.unlock_lsn(); - if (UNIV_UNLIKELY(size > log_capacity)) - { - time_t t= time(nullptr); - - /* return with warning output to avoid deadlock */ - if (!log_margin_warned || difftime(t, log_margin_warn_time) > 15) - { - log_margin_warned= true; - log_margin_warn_time= t; + if (ex) + log_sys.latch.wr_unlock(); + else + log_sys.latch.rd_unlock(); - sql_print_error("InnoDB: innodb_log_file_size is too small " - "for mini-transaction size %zu", size); - } - goto throttle; - } - else if (UNIV_UNLIKELY(lsn + size > last_checkpoint_lsn + log_capacity)) - throttle: - set_check_flush_or_checkpoint(); + DEBUG_SYNC_C("log_buf_size_exceeded"); + log_buffer_flush_to_disk(log_sys.is_pmem()); - if (is_pmem()) - { - for (ut_d(int count= 50); capacity() - size < - size_t(lsn - flushed_to_disk_lsn.load(std::memory_order_relaxed)); ) - { - waits++; - mysql_mutex_unlock(&mutex); - DEBUG_SYNC_C("log_buf_size_exceeded"); - log_write_up_to(lsn, true); - ut_ad(count--); - mysql_mutex_lock(&mutex); - lsn= get_lsn(); - } - return lsn; - } + if (ex) + log_sys.latch.wr_lock(SRW_LOCK_CALL); + else + log_sys.latch.rd_lock(SRW_LOCK_CALL); - /* Calculate the amount of free space needed. */ - size= (4 * 4096) - size + log_sys.buf_size; + log_sys.lock_lsn(); +} - for (ut_d(int count= 50); UNIV_UNLIKELY(buf_free > size); ) +/** Reserve space in the log buffer for appending data. +@tparam pmem log_sys.is_pmem() +@param size total length of the data to append(), in bytes +@param ex whether log_sys.latch is exclusively locked +@return the start LSN and the buffer position for append() */ +template +inline +std::pair log_t::append_prepare(size_t size, bool ex) noexcept +{ +#ifndef SUX_LOCK_GENERIC + ut_ad(latch.is_locked()); +# ifndef _WIN32 // there is no accurate is_write_locked() on SRWLOCK + ut_ad(ex == latch.is_write_locked()); +# endif +#endif + ut_ad(pmem == is_pmem()); + const lsn_t checkpoint_margin{last_checkpoint_lsn + log_capacity - size}; + const size_t avail{(pmem ? size_t(capacity()) : buf_size) - size}; + lock_lsn(); + write_to_buf++; + + for (ut_d(int count= 50); + UNIV_UNLIKELY((pmem + ? size_t(get_lsn() - + get_flushed_lsn(std::memory_order_relaxed)) + : size_t{buf_free}) > avail); ) { - waits++; - mysql_mutex_unlock(&mutex); - DEBUG_SYNC_C("log_buf_size_exceeded"); - log_write_up_to(lsn, false); + append_prepare_wait(ex); ut_ad(count--); - mysql_mutex_lock(&mutex); - lsn= get_lsn(); } - return lsn; + const lsn_t l{lsn.load(std::memory_order_relaxed)}; + lsn.store(l + size, std::memory_order_relaxed); + const size_t b{buf_free}; + size_t new_buf_free{b}; + new_buf_free+= size; + if (pmem && new_buf_free >= file_size) + new_buf_free-= size_t(capacity()); + buf_free= new_buf_free; + unlock_lsn(); + + if (UNIV_UNLIKELY(l > checkpoint_margin) || + (!pmem && b >= max_buf_free)) + set_check_flush_or_checkpoint(); + + return {l, &buf[b]}; } /** Finish appending data to the log. @@ -831,16 +949,16 @@ inline lsn_t log_t::append_prepare(size_t size) noexcept @return whether buf_flush_ahead() will have to be invoked */ static mtr_t::page_flush_ahead log_close(lsn_t lsn) noexcept { - mysql_mutex_assert_owner(&log_sys.mutex); - log_sys.write_to_buf++; - log_sys.set_lsn(lsn); +#ifndef SUX_LOCK_GENERIC + ut_ad(log_sys.latch.is_locked()); +#endif const lsn_t checkpoint_age= lsn - log_sys.last_checkpoint_lsn; if (UNIV_UNLIKELY(checkpoint_age >= log_sys.log_capacity) && /* silence message on create_log_file() after the log had been deleted */ checkpoint_age != lsn) - log_overwrite_warning(checkpoint_age, log_sys.log_capacity); + log_overwrite_warning(lsn); else if (UNIV_LIKELY(checkpoint_age <= log_sys.max_modified_age_async)) return mtr_t::PAGE_FLUSH_NO; else if (UNIV_LIKELY(checkpoint_age <= log_sys.max_checkpoint_age)) @@ -850,20 +968,79 @@ static mtr_t::page_flush_ahead log_close(lsn_t lsn) noexcept return mtr_t::PAGE_FLUSH_SYNC; } -inline size_t mtr_t::prepare_write() +inline void mtr_t::page_checksum(const buf_page_t &bpage) +{ + const byte *page= bpage.frame; + size_t size= srv_page_size; + + if (UNIV_LIKELY_NULL(bpage.zip.data)) + { + size= (UNIV_ZIP_SIZE_MIN >> 1) << bpage.zip.ssize; + switch (fil_page_get_type(bpage.zip.data)) { + case FIL_PAGE_TYPE_ALLOCATED: + case FIL_PAGE_INODE: + case FIL_PAGE_IBUF_BITMAP: + case FIL_PAGE_TYPE_FSP_HDR: + case FIL_PAGE_TYPE_XDES: + /* These are essentially uncompressed pages. */ + break; + default: + page= bpage.zip.data; + } + } + + /* We have to exclude from the checksum the normal + page checksum that is written by buf_flush_init_for_writing() + and FIL_PAGE_LSN which would be updated once we have actually + allocated the LSN. + + Unfortunately, we cannot access fil_space_t easily here. In order to + be compatible with encrypted tablespaces in the pre-full_crc32 + format we will unconditionally exclude the 8 bytes at + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + a.k.a. FIL_RTREE_SPLIT_SEQ_NUM. */ + const uint32_t checksum= + my_crc32c(my_crc32c(my_crc32c(0, page + FIL_PAGE_OFFSET, + FIL_PAGE_LSN - FIL_PAGE_OFFSET), + page + FIL_PAGE_TYPE, 2), + page + FIL_PAGE_SPACE_ID, size - (FIL_PAGE_SPACE_ID + 8)); + + byte *l= log_write